From: support Date: Wed, 6 Apr 2022 14:35:23 +0000 (+0000) Subject: Built motion from commit 286669c0.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:;/%22?a=commitdiff_plain;h=4bbf54b901173b7e463556d3e927779812ed3728;p=motion2.git Built motion from commit 286669c0.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e568b6f..2304ac4 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T13:39:06.419Z", + "time": "2022-04-06T14:27:33.892Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d2cca8a..66ac68c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T13:39:06.419Z", + "time": "2022-04-06T14:27:33.892Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 3a0cfbb..8653e4a 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 _0x68c3=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','integration','jscripty','urlForward'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x68c3,0xdc));var _0x368c=function(_0x30e6f1,_0x1a21e0){_0x30e6f1=_0x30e6f1-0x0;var _0x37a27e=_0x68c3[_0x30e6f1];return _0x37a27e;};'use strict';var Sequelize=require(_0x368c('0x0'));module[_0x368c('0x1')]={'name':{'type':Sequelize[_0x368c('0x2')],'get':function(_0x408af6){return this['getDataValue'](_0x368c('0x3'));}},'action':{'type':Sequelize[_0x368c('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x368c('0x5'),'motionbar',_0x368c('0x6'),_0x368c('0x7'),_0x368c('0x8'),_0x368c('0x9'),_0x368c('0xa')]],'msg':_0x368c('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xc')},'data2':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xd')},'data3':{'type':Sequelize[_0x368c('0x4')](0x1000),'comment':_0x368c('0xe')},'data4':{'type':Sequelize[_0x368c('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x368c('0x4')](0x1000),'comments':_0x368c('0xf')},'data6':{'type':Sequelize[_0x368c('0x4')],'comments':_0x368c('0x10')},'data7':{'type':Sequelize[_0x368c('0x11')],'comments':_0x368c('0x12')}}; \ No newline at end of file +var _0x38ec=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x4bfaa3,_0x4c3f7a){var _0x205678=function(_0x549fde){while(--_0x549fde){_0x4bfaa3['push'](_0x4bfaa3['shift']());}};_0x205678(++_0x4c3f7a);}(_0x38ec,0xfa));var _0xc38e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x38ec[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xc38e('0x0'));module[_0xc38e('0x1')]={'name':{'type':Sequelize[_0xc38e('0x2')],'get':function(_0x427553){return this[_0xc38e('0x3')](_0xc38e('0x4'));}},'action':{'type':Sequelize[_0xc38e('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xc38e('0x6'),_0xc38e('0x7'),'motionbar',_0xc38e('0x8'),_0xc38e('0x9'),_0xc38e('0xa'),_0xc38e('0xb'),_0xc38e('0xc')]],'msg':_0xc38e('0xd')}},'comment':_0xc38e('0xd')},'data1':{'type':Sequelize[_0xc38e('0x5')](0x1000),'comment':_0xc38e('0xe')},'data2':{'type':Sequelize[_0xc38e('0x5')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xc38e('0xf')},'data4':{'type':Sequelize[_0xc38e('0x5')](0x1000),'comments':_0xc38e('0x10')},'data5':{'type':Sequelize[_0xc38e('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xc38e('0x5')],'comments':_0xc38e('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0xc38e('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 6b35ca2..7dbefd8 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 _0x755a=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','then','destroy','stack','name','send','update','body','Action','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x755a,0x158));var _0xa755=function(_0x2e4a42,_0x38d181){_0x2e4a42=_0x2e4a42-0x0;var _0x109f87=_0x755a[_0x2e4a42];return _0x109f87;};'use strict';var emlformat=require(_0xa755('0x0'));var rimraf=require(_0xa755('0x1'));var zipdir=require(_0xa755('0x2'));var jsonpatch=require(_0xa755('0x3'));var rp=require('request-promise');var moment=require(_0xa755('0x4'));var BPromise=require(_0xa755('0x5'));var Mustache=require(_0xa755('0x6'));var util=require(_0xa755('0x7'));var path=require('path');var sox=require(_0xa755('0x8'));var csv=require(_0xa755('0x9'));var ejs=require(_0xa755('0xa'));var fs=require('fs');var fs_extra=require(_0xa755('0xb'));var _=require(_0xa755('0xc'));var squel=require('squel');var crypto=require(_0xa755('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa755('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa755('0xf'));var Redis=require('ioredis');var authService=require(_0xa755('0x10'));var qs=require(_0xa755('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa755('0x12'))(_0xa755('0x13'));var utils=require(_0xa755('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa755('0x15'));var db=require(_0xa755('0x16'))['db'];function respondWithStatusCode(_0x4d631b,_0x187de0){_0x187de0=_0x187de0||0xcc;return function(_0x2739ee){if(_0x2739ee){return _0x4d631b[_0xa755('0x17')](_0x187de0);}return _0x4d631b[_0xa755('0x18')](_0x187de0)[_0xa755('0x19')]();};}function respondWithResult(_0x12c7d1,_0x51e67c){_0x51e67c=_0x51e67c||0xc8;return function(_0x245015){if(_0x245015){return _0x12c7d1['status'](_0x51e67c)['json'](_0x245015);}};}function respondWithFilteredResult(_0x114c5e,_0x2afb0e){return function(_0x5fbd7f){if(_0x5fbd7f){var _0x23ed26=typeof _0x2afb0e['offset']==='undefined'&&typeof _0x2afb0e[_0xa755('0x1a')]===_0xa755('0x1b');var _0x513948=_0x5fbd7f[_0xa755('0x1c')];var _0x2d9e2b=_0x23ed26?0x0:_0x2afb0e[_0xa755('0x1d')];var _0x32b400=_0x23ed26?_0x5fbd7f['count']:_0x2afb0e[_0xa755('0x1d')]+_0x2afb0e[_0xa755('0x1a')];var _0x10239c;if(_0x32b400>=_0x513948){_0x32b400=_0x513948;_0x10239c=0xc8;}else{_0x10239c=0xce;}_0x114c5e[_0xa755('0x18')](_0x10239c);return _0x114c5e[_0xa755('0x1e')]('Content-Range',_0x2d9e2b+'-'+_0x32b400+'/'+_0x513948)[_0xa755('0x1f')](_0x5fbd7f);}return null;};}function patchUpdates(_0x5788c9){return function(_0x4faf7a){try{jsonpatch[_0xa755('0x20')](_0x4faf7a,_0x5788c9,!![]);}catch(_0x48053b){return BPromise[_0xa755('0x21')](_0x48053b);}return _0x4faf7a['save']();};}function saveUpdates(_0x5e7901,_0x9160e){return function(_0x595a7a){if(_0x595a7a){return _0x595a7a['update'](_0x5e7901)[_0xa755('0x22')](function(_0x299f0c){return _0x299f0c;});}return null;};}function removeEntity(_0x34cdc8,_0x33f752){return function(_0x17536b){if(_0x17536b){return _0x17536b[_0xa755('0x23')]()['then'](function(){_0x34cdc8[_0xa755('0x18')](0xcc)[_0xa755('0x19')]();});}};}function handleEntityNotFound(_0x1c3cb8,_0x24d20b){return function(_0x1b32ca){if(!_0x1b32ca){_0x1c3cb8[_0xa755('0x17')](0x194);}return _0x1b32ca;};}function handleError(_0x39509a,_0x37f7e0){_0x37f7e0=_0x37f7e0||0x1f4;return function(_0x56caa0){logger['error'](_0x56caa0[_0xa755('0x24')]);if(_0x56caa0['name']){delete _0x56caa0[_0xa755('0x25')];}_0x39509a[_0xa755('0x18')](_0x37f7e0)[_0xa755('0x26')](_0x56caa0);};}exports[_0xa755('0x27')]=function(_0x4bfe09,_0x70b345){if(_0x4bfe09[_0xa755('0x28')]['id']){delete _0x4bfe09['body']['id'];}return db[_0xa755('0x29')]['find']({'where':{'id':_0x4bfe09[_0xa755('0x2a')]['id']}})[_0xa755('0x22')](handleEntityNotFound(_0x70b345,null))[_0xa755('0x22')](saveUpdates(_0x4bfe09['body'],null))['then'](respondWithResult(_0x70b345,null))[_0xa755('0x2b')](handleError(_0x70b345,null));};exports[_0xa755('0x23')]=function(_0x3e6bc9,_0xe45b2a){return db['Action'][_0xa755('0x2c')]({'where':{'id':_0x3e6bc9[_0xa755('0x2a')]['id']}})[_0xa755('0x22')](handleEntityNotFound(_0xe45b2a,null))[_0xa755('0x22')](removeEntity(_0xe45b2a,null))[_0xa755('0x2b')](handleError(_0xe45b2a,null));}; \ No newline at end of file +var _0xa5ee=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','body','Action','find','catch','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x40e4c3,_0x3a1bb4){var _0x4383af=function(_0x53adfa){while(--_0x53adfa){_0x40e4c3['push'](_0x40e4c3['shift']());}};_0x4383af(++_0x3a1bb4);}(_0xa5ee,0xa8));var _0xea5e=function(_0x3faeac,_0x872ac2){_0x3faeac=_0x3faeac-0x0;var _0x323caf=_0xa5ee[_0x3faeac];return _0x323caf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea5e('0x0'));var zipdir=require(_0xea5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea5e('0x2'));var moment=require(_0xea5e('0x3'));var BPromise=require(_0xea5e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xea5e('0x5'));var sox=require(_0xea5e('0x6'));var csv=require(_0xea5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea5e('0x8'));var _=require('lodash');var squel=require(_0xea5e('0x9'));var crypto=require(_0xea5e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xea5e('0xb'));var toCsv=require(_0xea5e('0x7'));var querystring=require(_0xea5e('0xc'));var Papa=require(_0xea5e('0xd'));var Redis=require('ioredis');var authService=require(_0xea5e('0xe'));var qs=require(_0xea5e('0xf'));var as=require(_0xea5e('0x10'));var hardwareService=require(_0xea5e('0x11'));var logger=require(_0xea5e('0x12'))(_0xea5e('0x13'));var utils=require(_0xea5e('0x14'));var config=require(_0xea5e('0x15'));var licenseUtil=require(_0xea5e('0x16'));var db=require(_0xea5e('0x17'))['db'];function respondWithStatusCode(_0x4b4f63,_0x17fba0){_0x17fba0=_0x17fba0||0xcc;return function(_0x17753d){if(_0x17753d){return _0x4b4f63[_0xea5e('0x18')](_0x17fba0);}return _0x4b4f63[_0xea5e('0x19')](_0x17fba0)['end']();};}function respondWithResult(_0x291717,_0x469446){_0x469446=_0x469446||0xc8;return function(_0x2aaddf){if(_0x2aaddf){return _0x291717[_0xea5e('0x19')](_0x469446)[_0xea5e('0x1a')](_0x2aaddf);}};}function respondWithFilteredResult(_0x1ed54a,_0x14e572){return function(_0x3f075c){if(_0x3f075c){var _0x53a8c9=typeof _0x14e572['offset']===_0xea5e('0x1b')&&typeof _0x14e572['limit']===_0xea5e('0x1b');var _0x3d65ed=_0x3f075c['count'];var _0x5533fd=_0x53a8c9?0x0:_0x14e572[_0xea5e('0x1c')];var _0x3c1e52=_0x53a8c9?_0x3f075c[_0xea5e('0x1d')]:_0x14e572[_0xea5e('0x1c')]+_0x14e572[_0xea5e('0x1e')];var _0x4a8e94;if(_0x3c1e52>=_0x3d65ed){_0x3c1e52=_0x3d65ed;_0x4a8e94=0xc8;}else{_0x4a8e94=0xce;}_0x1ed54a[_0xea5e('0x19')](_0x4a8e94);return _0x1ed54a[_0xea5e('0x1f')](_0xea5e('0x20'),_0x5533fd+'-'+_0x3c1e52+'/'+_0x3d65ed)[_0xea5e('0x1a')](_0x3f075c);}return null;};}function patchUpdates(_0x3d8182){return function(_0x45437b){try{jsonpatch[_0xea5e('0x21')](_0x45437b,_0x3d8182,!![]);}catch(_0x349c89){return BPromise[_0xea5e('0x22')](_0x349c89);}return _0x45437b[_0xea5e('0x23')]();};}function saveUpdates(_0x5329f7,_0x1c6497){return function(_0xeffdc8){if(_0xeffdc8){return _0xeffdc8[_0xea5e('0x24')](_0x5329f7)[_0xea5e('0x25')](function(_0x26769a){return _0x26769a;});}return null;};}function removeEntity(_0x4aca12,_0x1b8064){return function(_0x5b0860){if(_0x5b0860){return _0x5b0860[_0xea5e('0x26')]()[_0xea5e('0x25')](function(){_0x4aca12['status'](0xcc)[_0xea5e('0x27')]();});}};}function handleEntityNotFound(_0xfd06e1,_0xa0ec7b){return function(_0xcb4983){if(!_0xcb4983){_0xfd06e1[_0xea5e('0x18')](0x194);}return _0xcb4983;};}function handleError(_0x191cde,_0x288ccf){_0x288ccf=_0x288ccf||0x1f4;return function(_0x40a63b){logger[_0xea5e('0x28')](_0x40a63b[_0xea5e('0x29')]);if(_0x40a63b[_0xea5e('0x2a')]){delete _0x40a63b[_0xea5e('0x2a')];}_0x191cde['status'](_0x288ccf)['send'](_0x40a63b);};}exports[_0xea5e('0x24')]=function(_0x31d1ec,_0x51bd76){if(_0x31d1ec[_0xea5e('0x2b')]['id']){delete _0x31d1ec[_0xea5e('0x2b')]['id'];}return db[_0xea5e('0x2c')][_0xea5e('0x2d')]({'where':{'id':_0x31d1ec['params']['id']}})[_0xea5e('0x25')](handleEntityNotFound(_0x51bd76,null))[_0xea5e('0x25')](saveUpdates(_0x31d1ec[_0xea5e('0x2b')],null))['then'](respondWithResult(_0x51bd76,null))[_0xea5e('0x2e')](handleError(_0x51bd76,null));};exports[_0xea5e('0x26')]=function(_0xb55e3c,_0xc2b3c7){return db[_0xea5e('0x2c')][_0xea5e('0x2d')]({'where':{'id':_0xb55e3c['params']['id']}})[_0xea5e('0x25')](handleEntityNotFound(_0xc2b3c7,null))[_0xea5e('0x25')](removeEntity(_0xc2b3c7,null))[_0xea5e('0x2e')](handleError(_0xc2b3c7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 48289ba..ee0db4a 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 _0x40e8=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./action.attributes','define','Action'];(function(_0x269d45,_0x5cf5c6){var _0x3fd9ec=function(_0x468ae1){while(--_0x468ae1){_0x269d45['push'](_0x269d45['shift']());}};_0x3fd9ec(++_0x5cf5c6);}(_0x40e8,0x8f));var _0x840e=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x40e8[_0x277721];return _0x286051;};'use strict';var _=require(_0x840e('0x0'));var util=require(_0x840e('0x1'));var logger=require(_0x840e('0x2'))(_0x840e('0x3'));var moment=require(_0x840e('0x4'));var BPromise=require('bluebird');var rp=require(_0x840e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x840e('0x6'));var config=require(_0x840e('0x7'));var attributes=require(_0x840e('0x8'));module['exports']=function(_0x27c853,_0x4d7205){return _0x27c853[_0x840e('0x9')](_0x840e('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47cb=['exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes'];(function(_0x4d4cd4,_0x18fe19){var _0x5a8132=function(_0x6bed92){while(--_0x6bed92){_0x4d4cd4['push'](_0x4d4cd4['shift']());}};_0x5a8132(++_0x18fe19);}(_0x47cb,0x74));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb47c('0x0'));var util=require(_0xb47c('0x1'));var logger=require(_0xb47c('0x2'))(_0xb47c('0x3'));var moment=require(_0xb47c('0x4'));var BPromise=require(_0xb47c('0x5'));var rp=require(_0xb47c('0x6'));var fs=require('fs');var path=require(_0xb47c('0x7'));var rimraf=require('rimraf');var config=require(_0xb47c('0x8'));var attributes=require(_0xb47c('0x9'));module[_0xb47c('0xa')]=function(_0x10891b,_0x325e36){return _0x10891b[_0xb47c('0xb')](_0xb47c('0xc'),attributes,{'tableName':_0xb47c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 2d51dbf..5b00170 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x195b7c,_0x26df69){var _0x4920ab=function(_0xff024){while(--_0xff024){_0x195b7c['push'](_0x195b7c['shift']());}};_0x4920ab(++_0x26df69);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x40c60f,_0x2e2b36){var _0x4458db=function(_0x2b1b58){while(--_0x2b1b58){_0x40c60f['push'](_0x40c60f['shift']());}};_0x4458db(++_0x2e2b36);}(_0x8ef6,0xf2));var _0x68ef=function(_0x301b4c,_0xc82115){_0x301b4c=_0x301b4c-0x0;var _0xcc2b51=_0x8ef6[_0x301b4c];return _0xcc2b51;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Action,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Action,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 94a2dee..258ceb3 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 _0x1b2a=['isAuthenticated','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update'];(function(_0x70e93d,_0x1f04a1){var _0x44f4a1=function(_0x4774c4){while(--_0x4774c4){_0x70e93d['push'](_0x70e93d['shift']());}};_0x44f4a1(++_0x1f04a1);}(_0x1b2a,0x115));var _0xa1b2=function(_0x496561,_0x3d004c){_0x496561=_0x496561-0x0;var _0x20a701=_0x1b2a[_0x496561];return _0x20a701;};'use strict';var multer=require('multer');var util=require(_0xa1b2('0x0'));var path=require(_0xa1b2('0x1'));var timeout=require(_0xa1b2('0x2'));var express=require('express');var router=express[_0xa1b2('0x3')]();var fs_extra=require(_0xa1b2('0x4'));var auth=require(_0xa1b2('0x5'));var interaction=require(_0xa1b2('0x6'));var config=require(_0xa1b2('0x7'));var controller=require(_0xa1b2('0x8'));router['put'](_0xa1b2('0x9'),auth['isAuthenticated'](),controller[_0xa1b2('0xa')]);router['delete'](_0xa1b2('0x9'),auth[_0xa1b2('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbcd1=['put','isAuthenticated','update','delete','/:id','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x37cc2a,_0x1e6e79){var _0x3a918b=function(_0x5bb8a6){while(--_0x5bb8a6){_0x37cc2a['push'](_0x37cc2a['shift']());}};_0x3a918b(++_0x1e6e79);}(_0xbcd1,0x19c));var _0x1bcd=function(_0x32f91b,_0x460016){_0x32f91b=_0x32f91b-0x0;var _0x3ee8f3=_0xbcd1[_0x32f91b];return _0x3ee8f3;};'use strict';var multer=require(_0x1bcd('0x0'));var util=require(_0x1bcd('0x1'));var path=require(_0x1bcd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1bcd('0x3')]();var fs_extra=require(_0x1bcd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1bcd('0x5'));var config=require(_0x1bcd('0x6'));var controller=require(_0x1bcd('0x7'));router[_0x1bcd('0x8')]('/:id',auth[_0x1bcd('0x9')](),controller[_0x1bcd('0xa')]);router[_0x1bcd('0xb')](_0x1bcd('0xc'),auth[_0x1bcd('0x9')](),controller['destroy']);module[_0x1bcd('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 722b896..d20112e 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 _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x18a313,_0x54020e){var _0x44ac80=function(_0xf53027){while(--_0xf53027){_0x18a313['push'](_0x18a313['shift']());}};_0x44ac80(++_0x54020e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x1416a5,_0x17ff94){var _0x5d7cd0=function(_0x59c85d){while(--_0x59c85d){_0x1416a5['push'](_0x1416a5['shift']());}};_0x5d7cd0(++_0x17ff94);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3b6f99,_0x1454d9){_0x3b6f99=_0x3b6f99-0x0;var _0x5c49aa=_0x3eea[_0x3b6f99];return _0x5c49aa;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 02c18f2..01138a9 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 _0x1b8f=['status','offset','limit','undefined','count','Content-Range','json','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','keys','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','SUM(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','IS\x20NULL','ValidationErrorItem','from','clone','output','web','fullPath','generate','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','MIN(%s)','GROUP_CONCAT(%s)','UNIX_TIMESTAMP(%s)','value','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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'];(function(_0x18b628,_0x1b4f7f){var _0x5f1d17=function(_0x145ccc){while(--_0x145ccc){_0x18b628['push'](_0x18b628['shift']());}};_0x5f1d17(++_0x1b4f7f);}(_0x1b8f,0x8b));var _0xf1b8=function(_0x596bc4,_0x1df224){_0x596bc4=_0x596bc4-0x0;var _0x4e6f7c=_0x1b8f[_0x596bc4];return _0x4e6f7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf1b8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf1b8('0x1'));var rp=require(_0xf1b8('0x2'));var moment=require(_0xf1b8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf1b8('0x4'));var util=require(_0xf1b8('0x5'));var path=require(_0xf1b8('0x6'));var sox=require(_0xf1b8('0x7'));var csv=require(_0xf1b8('0x8'));var ejs=require(_0xf1b8('0x9'));var fs=require('fs');var fs_extra=require(_0xf1b8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf1b8('0xb'));var jsforce=require(_0xf1b8('0xc'));var deskjs=require(_0xf1b8('0xd'));var toCsv=require(_0xf1b8('0x8'));var querystring=require(_0xf1b8('0xe'));var Papa=require(_0xf1b8('0xf'));var Redis=require('ioredis');var authService=require(_0xf1b8('0x10'));var qs=require(_0xf1b8('0x11'));var as=require(_0xf1b8('0x12'));var hardwareService=require(_0xf1b8('0x13'));var logger=require(_0xf1b8('0x14'))('api');var utils=require(_0xf1b8('0x15'));var config=require(_0xf1b8('0x16'));var licenseUtil=require(_0xf1b8('0x17'));var db=require(_0xf1b8('0x18'))['db'];var dbH=require(_0xf1b8('0x18'))['dbH'];function respondWithStatusCode(_0x255ad6,_0x902ecf){_0x902ecf=_0x902ecf||0xcc;return function(_0x15e249){if(_0x15e249){return _0x255ad6['sendStatus'](_0x902ecf);}return _0x255ad6[_0xf1b8('0x19')](_0x902ecf)['end']();};}function respondWithResult(_0x48a5ac,_0x16acd1){_0x16acd1=_0x16acd1||0xc8;return function(_0x111f46){if(_0x111f46){return _0x48a5ac[_0xf1b8('0x19')](_0x16acd1)['json'](_0x111f46);}};}function respondWithFilteredResult(_0x46a4cb,_0x1fa7c3){return function(_0x3a371d){if(_0x3a371d){var _0x2ece48=typeof _0x1fa7c3[_0xf1b8('0x1a')]==='undefined'&&typeof _0x1fa7c3[_0xf1b8('0x1b')]===_0xf1b8('0x1c');var _0x1fcd11=_0x3a371d[_0xf1b8('0x1d')];var _0x2262b0=_0x2ece48?0x0:_0x1fa7c3[_0xf1b8('0x1a')];var _0x3e3fc9=_0x2ece48?_0x3a371d[_0xf1b8('0x1d')]:_0x1fa7c3['offset']+_0x1fa7c3[_0xf1b8('0x1b')];var _0x3d9153;if(_0x3e3fc9>=_0x1fcd11){_0x3e3fc9=_0x1fcd11;_0x3d9153=0xc8;}else{_0x3d9153=0xce;}_0x46a4cb[_0xf1b8('0x19')](_0x3d9153);return _0x46a4cb['set'](_0xf1b8('0x1e'),_0x2262b0+'-'+_0x3e3fc9+'/'+_0x1fcd11)[_0xf1b8('0x1f')](_0x3a371d);}return null;};}function patchUpdates(_0x55afe9){return function(_0x41da5b){try{jsonpatch[_0xf1b8('0x20')](_0x41da5b,_0x55afe9,!![]);}catch(_0x4dc7df){return BPromise['reject'](_0x4dc7df);}return _0x41da5b[_0xf1b8('0x21')]();};}function saveUpdates(_0x15aacc,_0x2c2410){return function(_0x1faaa6){if(_0x1faaa6){return _0x1faaa6[_0xf1b8('0x22')](_0x15aacc)[_0xf1b8('0x23')](function(_0x597247){return _0x597247;});}return null;};}function removeEntity(_0x34b533,_0x531522){return function(_0x17f34f){if(_0x17f34f){return _0x17f34f[_0xf1b8('0x24')]()[_0xf1b8('0x23')](function(){var _0x4fd3e8=_0x17f34f[_0xf1b8('0x25')]({'plain':!![]});var _0x3cbee3=_0xf1b8('0x26');return db[_0xf1b8('0x27')][_0xf1b8('0x24')]({'where':{'type':_0x3cbee3,'resourceId':_0x4fd3e8['id']}})[_0xf1b8('0x23')](function(){return _0x17f34f;});})['then'](function(){_0x34b533[_0xf1b8('0x19')](0xcc)[_0xf1b8('0x28')]();});}};}function handleEntityNotFound(_0x57ef5c,_0x19a037){return function(_0x5bc68e){if(!_0x5bc68e){_0x57ef5c['sendStatus'](0x194);}return _0x5bc68e;};}function handleError(_0x58bb4b,_0x1b515b){_0x1b515b=_0x1b515b||0x1f4;return function(_0x26402f){logger[_0xf1b8('0x29')](_0x26402f[_0xf1b8('0x2a')]);if(_0x26402f['name']){delete _0x26402f['name'];}_0x58bb4b[_0xf1b8('0x19')](_0x1b515b)[_0xf1b8('0x2b')](_0x26402f);};}exports[_0xf1b8('0x2c')]=function(_0x2ce573,_0x3b1b75){var _0x62563c={},_0x2c5e33={},_0x268b6e={'count':0x0,'rows':[]};var _0x2c09c2=_[_0xf1b8('0x2d')](db[_0xf1b8('0x2e')][_0xf1b8('0x2f')],function(_0x1ab700){return{'name':_0x1ab700['fieldName'],'type':_0x1ab700[_0xf1b8('0x30')][_0xf1b8('0x31')]};});_0x2c5e33[_0xf1b8('0x32')]=_[_0xf1b8('0x2d')](_0x2c09c2,_0xf1b8('0x33'));_0x2c5e33[_0xf1b8('0x34')]=_['keys'](_0x2ce573[_0xf1b8('0x34')]);_0x2c5e33[_0xf1b8('0x35')]=_[_0xf1b8('0x36')](_0x2c5e33[_0xf1b8('0x32')],_0x2c5e33[_0xf1b8('0x34')]);_0x62563c[_0xf1b8('0x37')]=_[_0xf1b8('0x36')](_0x2c5e33[_0xf1b8('0x32')],qs['fields'](_0x2ce573[_0xf1b8('0x34')][_0xf1b8('0x38')]));_0x62563c['attributes']=_0x62563c[_0xf1b8('0x37')][_0xf1b8('0x39')]?_0x62563c['attributes']:_0x2c5e33[_0xf1b8('0x32')];if(!_0x2ce573[_0xf1b8('0x34')][_0xf1b8('0x3a')](_0xf1b8('0x3b'))){_0x62563c[_0xf1b8('0x1b')]=qs[_0xf1b8('0x1b')](_0x2ce573[_0xf1b8('0x34')][_0xf1b8('0x1b')]);_0x62563c[_0xf1b8('0x1a')]=qs['offset'](_0x2ce573[_0xf1b8('0x34')]['offset']);}_0x62563c[_0xf1b8('0x3c')]=qs[_0xf1b8('0x3d')](_0x2ce573[_0xf1b8('0x34')][_0xf1b8('0x3d')]);_0x62563c[_0xf1b8('0x3e')]=qs['filters'](_[_0xf1b8('0x3f')](_0x2ce573[_0xf1b8('0x34')],_0x2c5e33[_0xf1b8('0x35')]),_0x2c09c2);if(_0x2ce573['query'][_0xf1b8('0x40')]){_0x62563c[_0xf1b8('0x3e')]=_[_0xf1b8('0x41')](_0x62563c[_0xf1b8('0x3e')],{'$or':_[_0xf1b8('0x2d')](_0x2c09c2,function(_0x5e0c2b){if(_0x5e0c2b[_0xf1b8('0x30')]!==_0xf1b8('0x42')){var _0x3c844f={};_0x3c844f[_0x5e0c2b['name']]={'$like':'%'+_0x2ce573['query']['filter']+'%'};return _0x3c844f;}})});}_0x62563c=_['merge']({},_0x62563c,_0x2ce573[_0xf1b8('0x43')]);var _0x4352fb={'where':_0x62563c[_0xf1b8('0x3e')]};return db['AnalyticCustomReport'][_0xf1b8('0x1d')](_0x4352fb)[_0xf1b8('0x23')](function(_0x4ee2c1){_0x268b6e[_0xf1b8('0x1d')]=_0x4ee2c1;if(_0x2ce573['query'][_0xf1b8('0x44')]){_0x62563c['include']=[{'all':!![]}];}return db[_0xf1b8('0x2e')]['findAll'](_0x62563c);})['then'](function(_0x3421ce){_0x268b6e[_0xf1b8('0x45')]=_0x3421ce;return _0x268b6e;})[_0xf1b8('0x23')](respondWithFilteredResult(_0x3b1b75,_0x62563c))['catch'](handleError(_0x3b1b75,null));};exports['show']=function(_0x502583,_0x1432c6){var _0x161c17={'raw':![],'where':{'id':_0x502583['params']['id']}},_0x151269={};_0x151269[_0xf1b8('0x32')]=_[_0xf1b8('0x46')](db['AnalyticCustomReport'][_0xf1b8('0x2f')]);_0x151269['query']=_[_0xf1b8('0x46')](_0x502583[_0xf1b8('0x34')]);_0x151269[_0xf1b8('0x35')]=_[_0xf1b8('0x36')](_0x151269[_0xf1b8('0x32')],_0x151269[_0xf1b8('0x34')]);_0x161c17['attributes']=_[_0xf1b8('0x36')](_0x151269['model'],qs['fields'](_0x502583['query'][_0xf1b8('0x38')]));_0x161c17[_0xf1b8('0x37')]=_0x161c17[_0xf1b8('0x37')]['length']?_0x161c17[_0xf1b8('0x37')]:_0x151269[_0xf1b8('0x32')];if(_0x502583[_0xf1b8('0x34')]['includeAll']){_0x161c17[_0xf1b8('0x47')]=[{'all':!![]}];}_0x161c17=_['merge']({},_0x161c17,_0x502583['options']);return db[_0xf1b8('0x2e')][_0xf1b8('0x48')](_0x161c17)[_0xf1b8('0x23')](handleEntityNotFound(_0x1432c6,null))[_0xf1b8('0x23')](respondWithResult(_0x1432c6,null))[_0xf1b8('0x49')](handleError(_0x1432c6,null));};exports[_0xf1b8('0x4a')]=function(_0x36a3e6,_0x3877a6){return db[_0xf1b8('0x2e')]['create'](_0x36a3e6[_0xf1b8('0x4b')],{})['then'](function(_0x1aeef6){var _0x64fe44=_0x36a3e6['user'][_0xf1b8('0x25')]({'plain':!![]});if(!_0x64fe44)throw new Error(_0xf1b8('0x4c'));if(_0x64fe44[_0xf1b8('0x4d')]===_0xf1b8('0x4e')){var _0x3186a9=_0x1aeef6[_0xf1b8('0x25')]({'plain':!![]});var _0x4d5c84=_0xf1b8('0x4f');return db[_0xf1b8('0x50')][_0xf1b8('0x48')]({'where':{'name':_0x4d5c84,'userProfileId':_0x64fe44[_0xf1b8('0x51')]},'raw':!![]})[_0xf1b8('0x23')](function(_0x487855){if(_0x487855&&_0x487855[_0xf1b8('0x52')]===0x0){return db[_0xf1b8('0x27')][_0xf1b8('0x4a')]({'name':_0x3186a9['name'],'resourceId':_0x3186a9['id'],'type':_0xf1b8('0x26'),'sectionId':_0x487855['id']},{})[_0xf1b8('0x23')](function(){return _0x1aeef6;});}else{return _0x1aeef6;}})['catch'](function(_0x1b92b1){logger[_0xf1b8('0x29')](_0xf1b8('0x53'),_0x1b92b1);throw _0x1b92b1;});}return _0x1aeef6;})[_0xf1b8('0x23')](respondWithResult(_0x3877a6,0xc9))[_0xf1b8('0x49')](handleError(_0x3877a6,null));};exports[_0xf1b8('0x22')]=function(_0x1150da,_0x4afc53){if(_0x1150da[_0xf1b8('0x4b')]['id']){delete _0x1150da[_0xf1b8('0x4b')]['id'];}return db[_0xf1b8('0x2e')][_0xf1b8('0x48')]({'where':{'id':_0x1150da[_0xf1b8('0x54')]['id']}})['then'](handleEntityNotFound(_0x4afc53,null))[_0xf1b8('0x23')](saveUpdates(_0x1150da['body'],null))[_0xf1b8('0x23')](respondWithResult(_0x4afc53,null))[_0xf1b8('0x49')](handleError(_0x4afc53,null));};exports['destroy']=function(_0x46354b,_0x28169f){return db['AnalyticCustomReport'][_0xf1b8('0x48')]({'where':{'id':_0x46354b[_0xf1b8('0x54')]['id']}})[_0xf1b8('0x23')](handleEntityNotFound(_0x28169f,null))['then'](removeEntity(_0x28169f,null))[_0xf1b8('0x49')](handleError(_0x28169f,null));};exports[_0xf1b8('0x55')]=function(_0x23fd81,_0x2f3e86){var _0x3d8a40=0xa;var _0x2ea389=[_0xf1b8('0x56'),'left_join',_0xf1b8('0x57'),'cross_join'];var _0x20c698={'SUM':_0xf1b8('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xf1b8('0x59'),'MIN':'MIN(%s)','AVG':_0xf1b8('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf1b8('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x435473={'SEC_TO_TIME':_0xf1b8('0x5c'),'DATE':'DATE(%s)','HOUR':_0xf1b8('0x5d'),'ROUND':_0xf1b8('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x178111=function(_0x1b556f){return!_[_0xf1b8('0x5f')](['IS\x20NULL',_0xf1b8('0x60'),_0xf1b8('0x61'),_0xf1b8('0x62')],_0x1b556f);};var _0xa51dc2=function(_0x1d53a4){if(!_0x1d53a4||!_0x1d53a4['rules'][_0xf1b8('0x39')]){return'';}for(var _0xf352ad='(',_0x25a8a6=0x0;_0x25a8a6<_0x1d53a4[_0xf1b8('0x63')][_0xf1b8('0x39')];_0x25a8a6+=0x1){_0x25a8a6>0x0&&(_0xf352ad+='\x20'+_0x1d53a4[_0xf1b8('0x64')]+'\x20');_0xf352ad+=_0x1d53a4[_0xf1b8('0x63')][_0x25a8a6][_0xf1b8('0x65')]?_0xa51dc2(_0x1d53a4[_0xf1b8('0x63')][_0x25a8a6]['group']):_0x1d53a4['rules'][_0x25a8a6][_0xf1b8('0x66')]+'\x20'+_0x1d53a4[_0xf1b8('0x63')][_0x25a8a6][_0xf1b8('0x67')]+(_0x178111(_0x1d53a4[_0xf1b8('0x63')][_0x25a8a6][_0xf1b8('0x67')])?'\x20'+_0x1d53a4[_0xf1b8('0x63')][_0x25a8a6]['value']:'');}return _0xf352ad+')';};var _0x3ec0e4={'where':{'id':_0x23fd81[_0xf1b8('0x54')]['id']}},_0x24fdda,_0x4e1944,_0x561a10,_0x557493,_0x2b9958;_0x3ec0e4=_[_0xf1b8('0x41')]({},_0x3ec0e4,_0x23fd81['options']);return db[_0xf1b8('0x2e')][_0xf1b8('0x48')](_0x3ec0e4)[_0xf1b8('0x23')](function(_0x1ca565){if(_0x1ca565){_0x24fdda=_0x1ca565;return _0x1ca565[_0xf1b8('0x68')]();}return null;})[_0xf1b8('0x23')](function(_0x46a2d8){if(_0x46a2d8){if(!_0x46a2d8[_0xf1b8('0x39')]){throw new db[(_0xf1b8('0x69'))]['ValidationErrorItem'](_0xf1b8('0x6a'),0x193);}_0x4e1944=_0x46a2d8;return db['AnalyticMetric'][_0xf1b8('0x6b')]({'raw':!![]});}return null;})[_0xf1b8('0x23')](function(_0x118b7e){if(_0x118b7e){_0x561a10=_[_0xf1b8('0x6c')](_0x118b7e,'id');var _0x4d4845;var _0x1f86de=squel[_0xf1b8('0x6d')]();_0x1f86de['from'](_0x24fdda[_0xf1b8('0x6e')]);for(var _0x5613df=0x0;_0x5613df<_0x4e1944['length'];_0x5613df+=0x1){_0x4d4845=_0x4e1944[_0x5613df][_0xf1b8('0x6f')]?_0x561a10[_0x4e1944[_0x5613df][_0xf1b8('0x6f')]][_0xf1b8('0x70')]:_0x4e1944[_0x5613df]['field'];_0x4d4845=_0x4e1944[_0x5613df][_0xf1b8('0x71')]?_[_0xf1b8('0x72')](_0x20c698[_0x4e1944[_0x5613df][_0xf1b8('0x71')]],'%s',_0x4d4845):_0x4d4845;_0x4d4845=_0x4e1944[_0x5613df][_0xf1b8('0x73')]?_[_0xf1b8('0x72')](_0x435473[_0x4e1944[_0x5613df][_0xf1b8('0x73')]],'%s',_0x4d4845):_0x4d4845;if(_0x4e1944[_0x5613df][_0xf1b8('0x74')]){_0x1f86de[_0xf1b8('0x65')](_0x4d4845);}_0x4e1944[_0x5613df][_0xf1b8('0x75')]&&_0x1f86de[_0xf1b8('0x3c')](_0x4d4845,_0x4e1944[_0x5613df][_0xf1b8('0x75')]===_0xf1b8('0x76')?![]:!![]);_0x1f86de[_0xf1b8('0x66')](_0x4d4845,_0x4e1944[_0x5613df][_0xf1b8('0x77')]||_0x4d4845);}if(_0x24fdda[_0xf1b8('0x78')]){_0x24fdda['joins']=JSON[_0xf1b8('0x79')](_0x24fdda[_0xf1b8('0x78')]);for(var _0x2911f4=0x0;_0x2911f4<_0x24fdda[_0xf1b8('0x78')][_0xf1b8('0x39')];_0x2911f4+=0x1){if(_0x24fdda[_0xf1b8('0x78')][_0x2911f4][_0xf1b8('0x30')]&&_[_0xf1b8('0x5f')](_0x2ea389,_0x24fdda[_0xf1b8('0x78')][_0x2911f4]['type'])&&_0x24fdda['joins'][_0x2911f4][_0xf1b8('0x7a')]&&_0x24fdda['joins'][_0x2911f4][_0xf1b8('0x7b')]&&_0x24fdda[_0xf1b8('0x78')][_0x2911f4][_0xf1b8('0x7c')]){_0x1f86de[_0x24fdda['joins'][_0x2911f4][_0xf1b8('0x30')]](_0x24fdda[_0xf1b8('0x78')][_0x2911f4][_0xf1b8('0x7b')],null,util[_0xf1b8('0x73')](_0xf1b8('0x7d'),_0x24fdda[_0xf1b8('0x6e')],_0x24fdda[_0xf1b8('0x78')][_0x2911f4][_0xf1b8('0x7a')],_0x24fdda['joins'][_0x2911f4][_0xf1b8('0x7b')],_0x24fdda[_0xf1b8('0x78')][_0x2911f4][_0xf1b8('0x7c')]));}}}if(_0x24fdda[_0xf1b8('0x7e')]){_0x24fdda[_0xf1b8('0x7e')]=JSON[_0xf1b8('0x79')](_0x24fdda[_0xf1b8('0x7e')]);_0x1f86de[_0xf1b8('0x3e')](_0xa51dc2(_0x24fdda[_0xf1b8('0x7e')][_0xf1b8('0x65')]));}_0x2b9958=_0x1f86de['clone']();_0x1f86de[_0xf1b8('0x1b')](_0x3d8a40);_0x1f86de[_0xf1b8('0x1a')](0x0);logger[_0xf1b8('0x7f')](_0xf1b8('0x80'),_0x1f86de['toString']());return dbH[_0xf1b8('0x81')][_0xf1b8('0x34')](_0x1f86de[_0xf1b8('0x82')](),{'type':dbH[_0xf1b8('0x81')][_0xf1b8('0x83')][_0xf1b8('0x84')]});}})[_0xf1b8('0x23')](respondWithResult(_0x2f3e86,null))[_0xf1b8('0x49')](handleError(_0x2f3e86,null));};function runReport(_0xf57252,_0x31059b,_0x34897b){var _0x2614d9=_0x31059b[_0xf1b8('0x33')];var _0x2cc93b=0xa;var _0xa414da=[_0xf1b8('0x56'),_0xf1b8('0x85'),_0xf1b8('0x57'),'cross_join'];var _0x2b2a31={'SUM':'SUM(%s)','COUNT':_0xf1b8('0x86'),'COUNT DISTINCT':_0xf1b8('0x87'),'MAX':_0xf1b8('0x59'),'MIN':'MIN(%s)','AVG':_0xf1b8('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf1b8('0x88')};var _0x4bb421={'SEC_TO_TIME':_0xf1b8('0x5c'),'DATE':_0xf1b8('0x89'),'HOUR':_0xf1b8('0x5d'),'ROUND':_0xf1b8('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xa2ac0b=function(_0x5f1d4e){return!_[_0xf1b8('0x5f')]([_0xf1b8('0x8a'),_0xf1b8('0x60'),_0xf1b8('0x61'),_0xf1b8('0x62')],_0x5f1d4e);};var _0x387397=function(_0x44801e){if(!_0x44801e||!_0x44801e['rules'][_0xf1b8('0x39')]){return'';}for(var _0x18a114='(',_0x4b25b5=0x0;_0x4b25b5<_0x44801e[_0xf1b8('0x63')][_0xf1b8('0x39')];_0x4b25b5+=0x1){_0x4b25b5>0x0&&(_0x18a114+='\x20'+_0x44801e[_0xf1b8('0x64')]+'\x20');_0x18a114+=_0x44801e[_0xf1b8('0x63')][_0x4b25b5][_0xf1b8('0x65')]?_0x387397(_0x44801e[_0xf1b8('0x63')][_0x4b25b5][_0xf1b8('0x65')]):_0x44801e[_0xf1b8('0x63')][_0x4b25b5][_0xf1b8('0x66')]+'\x20'+_0x44801e[_0xf1b8('0x63')][_0x4b25b5]['condition']+(_0xa2ac0b(_0x44801e[_0xf1b8('0x63')][_0x4b25b5][_0xf1b8('0x67')])?'\x20'+_0x44801e['rules'][_0x4b25b5]['value']:'');}return _0x18a114+')';};var _0x1b7aff={'where':{'id':_0xf57252['id']}},_0x328d6d,_0x11a8ee,_0x48f6be,_0x33a05c,_0x3b7e7e;_0x1b7aff=_[_0xf1b8('0x41')]({},_0x1b7aff,_0x34897b);return db[_0xf1b8('0x2e')][_0xf1b8('0x48')](_0x1b7aff)[_0xf1b8('0x23')](function(_0x5153f0){if(_0x5153f0){_0x328d6d=_0x5153f0;return _0x5153f0[_0xf1b8('0x68')]();}return null;})[_0xf1b8('0x23')](function(_0x4ec1b4){if(_0x4ec1b4){if(!_0x4ec1b4[_0xf1b8('0x39')]){throw new db['Sequelize'][(_0xf1b8('0x8b'))](_0xf1b8('0x6a'),0x193);}_0x11a8ee=_0x4ec1b4;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})['then'](function(_0x550428){if(_0x550428){_0x48f6be=_[_0xf1b8('0x6c')](_0x550428,'id');var _0x825070;var _0x5d594b=squel[_0xf1b8('0x6d')]();_0x5d594b[_0xf1b8('0x8c')](_0x328d6d[_0xf1b8('0x6e')]);for(var _0x539415=0x0;_0x539415<_0x11a8ee[_0xf1b8('0x39')];_0x539415+=0x1){_0x825070=_0x11a8ee[_0x539415]['MetricId']?_0x48f6be[_0x11a8ee[_0x539415][_0xf1b8('0x6f')]]['metric']:_0x11a8ee[_0x539415][_0xf1b8('0x66')];_0x825070=_0x11a8ee[_0x539415]['function']?_[_0xf1b8('0x72')](_0x2b2a31[_0x11a8ee[_0x539415][_0xf1b8('0x71')]],'%s',_0x825070):_0x825070;_0x825070=_0x11a8ee[_0x539415]['format']?_[_0xf1b8('0x72')](_0x4bb421[_0x11a8ee[_0x539415][_0xf1b8('0x73')]],'%s',_0x825070):_0x825070;if(_0x11a8ee[_0x539415][_0xf1b8('0x74')]){_0x5d594b[_0xf1b8('0x65')](_0x825070);}_0x11a8ee[_0x539415][_0xf1b8('0x75')]&&_0x5d594b[_0xf1b8('0x3c')](_0x825070,_0x11a8ee[_0x539415][_0xf1b8('0x75')]===_0xf1b8('0x76')?![]:!![]);_0x5d594b[_0xf1b8('0x66')](_0x825070,_0x11a8ee[_0x539415]['alias']||_0x825070);}if(_0x328d6d[_0xf1b8('0x78')]){_0x328d6d[_0xf1b8('0x78')]=JSON[_0xf1b8('0x79')](_0x328d6d[_0xf1b8('0x78')]);for(var _0x4c5a38=0x0;_0x4c5a38<_0x328d6d[_0xf1b8('0x78')][_0xf1b8('0x39')];_0x4c5a38+=0x1){if(_0x328d6d[_0xf1b8('0x78')][_0x4c5a38][_0xf1b8('0x30')]&&_[_0xf1b8('0x5f')](_0xa414da,_0x328d6d[_0xf1b8('0x78')][_0x4c5a38]['type'])&&_0x328d6d[_0xf1b8('0x78')][_0x4c5a38][_0xf1b8('0x7a')]&&_0x328d6d[_0xf1b8('0x78')][_0x4c5a38][_0xf1b8('0x7b')]&&_0x328d6d[_0xf1b8('0x78')][_0x4c5a38][_0xf1b8('0x7c')]){_0x5d594b[_0x328d6d['joins'][_0x4c5a38][_0xf1b8('0x30')]](_0x328d6d['joins'][_0x4c5a38][_0xf1b8('0x7b')],null,util[_0xf1b8('0x73')](_0xf1b8('0x7d'),_0x328d6d['table'],_0x328d6d[_0xf1b8('0x78')][_0x4c5a38]['parentKey'],_0x328d6d[_0xf1b8('0x78')][_0x4c5a38]['foreignTable'],_0x328d6d['joins'][_0x4c5a38][_0xf1b8('0x7c')]));}}}if(_0x328d6d['conditions']){_0x328d6d[_0xf1b8('0x7e')]=JSON[_0xf1b8('0x79')](_0x328d6d[_0xf1b8('0x7e')]);_0x5d594b[_0xf1b8('0x3e')](_0x387397(_0x328d6d[_0xf1b8('0x7e')][_0xf1b8('0x65')]));}_0x3b7e7e=_0x5d594b[_0xf1b8('0x8d')]();_0x5d594b['limit'](_0x2cc93b);_0x5d594b['offset'](0x0);return;}})[_0xf1b8('0x23')](function(){if(_0x31059b[_0xf1b8('0x8e')]===_0xf1b8('0x8f')){return null;}var _0x905522=_[_0xf1b8('0x41')](_0x31059b,{'name':_0x31059b[_0xf1b8('0x90')]||_0x31059b[_0xf1b8('0x33')]||_0x328d6d[_0xf1b8('0x33')],'basename':_0x2614d9,'savename':util[_0xf1b8('0x73')]('%s-%s.%s',_0x31059b['name']||_0x328d6d[_0xf1b8('0x33')],require('randomstring')[_0xf1b8('0x91')](0x4),_0x31059b[_0xf1b8('0x8e')]||'csv'),'reportId':_0x328d6d['id'],'reportType':'custom'});return db[_0xf1b8('0x92')]['create'](_0x905522,{'raw':!![]});})[_0xf1b8('0x23')](function(_0x4059e7){if(_0x328d6d['table']===_0xf1b8('0x93')){_0x3b7e7e[_0xf1b8('0x3e')](_0x328d6d['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x31059b[_0xf1b8('0x94')],_0x31059b['endDate']);}else{_0x3b7e7e['where'](_0x328d6d[_0xf1b8('0x6e')]+_0xf1b8('0x95'),_0x31059b[_0xf1b8('0x94')],_0x31059b[_0xf1b8('0x96')]);}if(_0x4059e7){logger[_0xf1b8('0x97')](_0xf1b8('0x98'),_0x3b7e7e[_0xf1b8('0x82')]());require(_0xf1b8('0x99'))['fork'](path[_0xf1b8('0x56')](__dirname,_0xf1b8('0x9a'),_0x4059e7['output']),[_0x4059e7['id'],_0x3b7e7e['toString'](),path['join'](__dirname,_0xf1b8('0x9b'),_0x4059e7['savename']),_0x2614d9]);return _0x4059e7;}else{var _0x110ecc=squel[_0xf1b8('0x6d')]();_0x110ecc[_0xf1b8('0x8c')]('('+_0x3b7e7e['toString']()+')',_0xf1b8('0x9c'));_0x110ecc[_0xf1b8('0x66')](_0xf1b8('0x9d'),_0xf1b8('0x1d'));_0x3b7e7e[_0xf1b8('0x1b')](_0x31059b[_0xf1b8('0x1b')]||_0x2cc93b);_0x3b7e7e[_0xf1b8('0x1a')](_0x31059b[_0xf1b8('0x1a')]||0x0);return dbH[_0xf1b8('0x81')]['query'](_0x110ecc[_0xf1b8('0x82')](),{'type':dbH[_0xf1b8('0x81')][_0xf1b8('0x83')][_0xf1b8('0x84')]})[_0xf1b8('0x23')](function(_0x69f3f){if(!_0x69f3f['length']){_0x33a05c=0x0;}else{_0x33a05c=_0x69f3f[0x0][_0xf1b8('0x1d')]||0x0;}return dbH[_0xf1b8('0x81')][_0xf1b8('0x34')](_0x3b7e7e[_0xf1b8('0x82')](),{'type':dbH[_0xf1b8('0x81')][_0xf1b8('0x83')][_0xf1b8('0x84')]});})[_0xf1b8('0x23')](function(_0x47fced){return{'rows':_0x47fced||[],'count':_0x33a05c};});}});}exports[_0xf1b8('0x9e')]=function(_0x1fd176,_0x5dbe54){return runReport(_0x1fd176[_0xf1b8('0x54')],_0x1fd176[_0xf1b8('0x34')],_0x1fd176[_0xf1b8('0x43')])[_0xf1b8('0x23')](respondWithResult(_0x5dbe54,null))[_0xf1b8('0x49')](handleError(_0x5dbe54,null));};exports[_0xf1b8('0x9f')]=runReport;exports[_0xf1b8('0x34')]=function(_0x5a5200,_0x6a0d07){var _0x57c17a=0xa;var _0x478e5e=[_0xf1b8('0x56'),'left_join','right_join','cross_join'];var _0x5caab6={'SUM':_0xf1b8('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf1b8('0x87'),'MAX':_0xf1b8('0x59'),'MIN':_0xf1b8('0xa0'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf1b8('0xa1'),'GROUP_CONCAT ASC':_0xf1b8('0x5b'),'GROUP_CONCAT DESC':_0xf1b8('0x88')};var _0x2af072={'SEC_TO_TIME':_0xf1b8('0x5c'),'DATE':_0xf1b8('0x89'),'HOUR':_0xf1b8('0x5d'),'ROUND':_0xf1b8('0x5e'),'UNIX_TIMESTAMP':_0xf1b8('0xa2')};var _0x3fabdf=function(_0x945e0f){return!_[_0xf1b8('0x5f')](['IS\x20NULL',_0xf1b8('0x60'),_0xf1b8('0x61'),_0xf1b8('0x62')],_0x945e0f);};var _0x492fff=function(_0x19bb01){if(!_0x19bb01||!_0x19bb01[_0xf1b8('0x63')][_0xf1b8('0x39')]){return'';}for(var _0x2d1708='(',_0x103b31=0x0;_0x103b31<_0x19bb01[_0xf1b8('0x63')]['length'];_0x103b31+=0x1){_0x103b31>0x0&&(_0x2d1708+='\x20'+_0x19bb01['operator']+'\x20');_0x2d1708+=_0x19bb01[_0xf1b8('0x63')][_0x103b31][_0xf1b8('0x65')]?_0x492fff(_0x19bb01['rules'][_0x103b31][_0xf1b8('0x65')]):_0x19bb01[_0xf1b8('0x63')][_0x103b31]['field']+'\x20'+_0x19bb01['rules'][_0x103b31][_0xf1b8('0x67')]+(_0x3fabdf(_0x19bb01[_0xf1b8('0x63')][_0x103b31]['condition'])?'\x20'+_0x19bb01[_0xf1b8('0x63')][_0x103b31][_0xf1b8('0xa3')]:'');}return _0x2d1708+')';};var _0x3e8f30={'where':{'id':_0x5a5200[_0xf1b8('0x54')]['id']}},_0x15ed55,_0x368b66,_0x2600e6,_0x354305,_0x3056f7;_0x3e8f30=_[_0xf1b8('0x41')]({},_0x3e8f30,_0x5a5200[_0xf1b8('0x43')]);return db[_0xf1b8('0x2e')][_0xf1b8('0x48')](_0x3e8f30)[_0xf1b8('0x23')](function(_0x152f8b){if(_0x152f8b){_0x15ed55=_0x152f8b;return _0x152f8b[_0xf1b8('0x68')]();}return null;})['then'](function(_0x379ebb){if(_0x379ebb){if(!_0x379ebb['length']){throw new db[(_0xf1b8('0x69'))]['ValidationErrorItem'](_0xf1b8('0x6a'),0x193);}_0x368b66=_0x379ebb;return db['AnalyticMetric'][_0xf1b8('0x6b')]({'raw':!![]});}return null;})[_0xf1b8('0x23')](function(_0x1cda6d){if(_0x1cda6d){_0x2600e6=_[_0xf1b8('0x6c')](_0x1cda6d,'id');var _0x5a65ce;var _0x354768=squel['select']();_0x354768['from'](_0x15ed55[_0xf1b8('0x6e')]);for(var _0x1a9cda=0x0;_0x1a9cda<_0x368b66['length'];_0x1a9cda+=0x1){_0x5a65ce=_0x368b66[_0x1a9cda][_0xf1b8('0x6f')]?_0x2600e6[_0x368b66[_0x1a9cda]['MetricId']][_0xf1b8('0x70')]:_0x368b66[_0x1a9cda][_0xf1b8('0x66')];_0x5a65ce=_0x368b66[_0x1a9cda]['function']?_[_0xf1b8('0x72')](_0x5caab6[_0x368b66[_0x1a9cda]['function']],'%s',_0x5a65ce):_0x5a65ce;_0x5a65ce=_0x368b66[_0x1a9cda][_0xf1b8('0x73')]?_[_0xf1b8('0x72')](_0x2af072[_0x368b66[_0x1a9cda]['format']],'%s',_0x5a65ce):_0x5a65ce;if(_0x368b66[_0x1a9cda]['groupBy']){_0x354768[_0xf1b8('0x65')](_0x5a65ce);}_0x368b66[_0x1a9cda][_0xf1b8('0x75')]&&_0x354768[_0xf1b8('0x3c')](_0x5a65ce,_0x368b66[_0x1a9cda][_0xf1b8('0x75')]===_0xf1b8('0x76')?![]:!![]);_0x354768[_0xf1b8('0x66')](_0x5a65ce,_0x368b66[_0x1a9cda][_0xf1b8('0x77')]||_0x5a65ce);}if(_0x15ed55[_0xf1b8('0x78')]){_0x15ed55['joins']=JSON[_0xf1b8('0x79')](_0x15ed55[_0xf1b8('0x78')]);for(var _0x4b8c7a=0x0;_0x4b8c7a<_0x15ed55['joins'][_0xf1b8('0x39')];_0x4b8c7a+=0x1){if(_0x15ed55['joins'][_0x4b8c7a]['type']&&_[_0xf1b8('0x5f')](_0x478e5e,_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x30')])&&_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x7a')]&&_0x15ed55['joins'][_0x4b8c7a]['foreignTable']&&_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x7c')]){_0x354768[_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a]['type']](_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x7b')],null,util['format'](_0xf1b8('0x7d'),_0x15ed55[_0xf1b8('0x6e')],_0x15ed55['joins'][_0x4b8c7a][_0xf1b8('0x7a')],_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x7b')],_0x15ed55[_0xf1b8('0x78')][_0x4b8c7a][_0xf1b8('0x7c')]));}}}if(_0x15ed55['conditions']){_0x15ed55['conditions']=JSON[_0xf1b8('0x79')](_0x15ed55[_0xf1b8('0x7e')]);_0x354768[_0xf1b8('0x3e')](_0x492fff(_0x15ed55[_0xf1b8('0x7e')][_0xf1b8('0x65')]));}_0x3056f7=_0x354768['clone']();_0x354768['limit'](_0x57c17a);_0x354768[_0xf1b8('0x1a')](0x0);logger[_0xf1b8('0x7f')](_0xf1b8('0x80'),_0x354768[_0xf1b8('0x82')]());return dbH[_0xf1b8('0x81')][_0xf1b8('0x34')](_0x354768[_0xf1b8('0x82')](),{'type':dbH[_0xf1b8('0x81')][_0xf1b8('0x83')][_0xf1b8('0x84')]});}})[_0xf1b8('0x23')](function(){return{'sql':_0x3056f7[_0xf1b8('0x82')]()};})[_0xf1b8('0x23')](respondWithResult(_0x6a0d07,null))[_0xf1b8('0x49')](handleError(_0x6a0d07,null));}; \ No newline at end of file +var _0x1293=['index','map','AnalyticCustomReport','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','includeAll','include','findAll','show','params','keys','rawAttributes','length','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','sequelize','QueryTypes','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','getFields','keyBy','output','web','fullPath','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','toString','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','SELECT','run','runReport','debug','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','dbH','end','offset','limit','undefined','count','status','Content-Range','json','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','sendStatus','stack','name','send'];(function(_0x1f3765,_0x5596ab){var _0x4e4a55=function(_0x3ac3a5){while(--_0x3ac3a5){_0x1f3765['push'](_0x1f3765['shift']());}};_0x4e4a55(++_0x5596ab);}(_0x1293,0x77));var _0x3129=function(_0x4e151e,_0x583efc){_0x4e151e=_0x4e151e-0x0;var _0x3bd266=_0x1293[_0x4e151e];return _0x3bd266;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3129('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3129('0x1'));var moment=require(_0x3129('0x2'));var BPromise=require(_0x3129('0x3'));var Mustache=require(_0x3129('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3129('0x5'));var csv=require(_0x3129('0x6'));var ejs=require(_0x3129('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3129('0x8'));var squel=require(_0x3129('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3129('0xa'));var toCsv=require(_0x3129('0x6'));var querystring=require(_0x3129('0xb'));var Papa=require('papaparse');var Redis=require(_0x3129('0xc'));var authService=require(_0x3129('0xd'));var qs=require(_0x3129('0xe'));var as=require(_0x3129('0xf'));var hardwareService=require(_0x3129('0x10'));var logger=require(_0x3129('0x11'))(_0x3129('0x12'));var utils=require('../../config/utils');var config=require(_0x3129('0x13'));var licenseUtil=require(_0x3129('0x14'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x3129('0x15')];function respondWithStatusCode(_0xa33b1e,_0x443c6a){_0x443c6a=_0x443c6a||0xcc;return function(_0x2eacfc){if(_0x2eacfc){return _0xa33b1e['sendStatus'](_0x443c6a);}return _0xa33b1e['status'](_0x443c6a)[_0x3129('0x16')]();};}function respondWithResult(_0x300a33,_0x22975f){_0x22975f=_0x22975f||0xc8;return function(_0x5ef352){if(_0x5ef352){return _0x300a33['status'](_0x22975f)['json'](_0x5ef352);}};}function respondWithFilteredResult(_0x425d3d,_0x3f60a7){return function(_0x3558c2){if(_0x3558c2){var _0xbcb73e=typeof _0x3f60a7[_0x3129('0x17')]==='undefined'&&typeof _0x3f60a7[_0x3129('0x18')]===_0x3129('0x19');var _0xddfb9e=_0x3558c2[_0x3129('0x1a')];var _0x13c497=_0xbcb73e?0x0:_0x3f60a7[_0x3129('0x17')];var _0x95d039=_0xbcb73e?_0x3558c2[_0x3129('0x1a')]:_0x3f60a7[_0x3129('0x17')]+_0x3f60a7[_0x3129('0x18')];var _0x1a7160;if(_0x95d039>=_0xddfb9e){_0x95d039=_0xddfb9e;_0x1a7160=0xc8;}else{_0x1a7160=0xce;}_0x425d3d[_0x3129('0x1b')](_0x1a7160);return _0x425d3d['set'](_0x3129('0x1c'),_0x13c497+'-'+_0x95d039+'/'+_0xddfb9e)[_0x3129('0x1d')](_0x3558c2);}return null;};}function patchUpdates(_0x5a343c){return function(_0x2706f0){try{jsonpatch[_0x3129('0x1e')](_0x2706f0,_0x5a343c,!![]);}catch(_0x1727da){return BPromise[_0x3129('0x1f')](_0x1727da);}return _0x2706f0[_0x3129('0x20')]();};}function saveUpdates(_0x19ba48,_0x13a968){return function(_0x27ccc6){if(_0x27ccc6){return _0x27ccc6[_0x3129('0x21')](_0x19ba48)['then'](function(_0x1cbbf8){return _0x1cbbf8;});}return null;};}function removeEntity(_0x53bd28,_0x405f7c){return function(_0x47fcb2){if(_0x47fcb2){return _0x47fcb2[_0x3129('0x22')]()[_0x3129('0x23')](function(){var _0x5380c8=_0x47fcb2[_0x3129('0x24')]({'plain':!![]});var _0x470329=_0x3129('0x25');return db[_0x3129('0x26')][_0x3129('0x22')]({'where':{'type':_0x470329,'resourceId':_0x5380c8['id']}})['then'](function(){return _0x47fcb2;});})[_0x3129('0x23')](function(){_0x53bd28['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d0ab2,_0x38034c){return function(_0xa1b9a5){if(!_0xa1b9a5){_0x9d0ab2[_0x3129('0x27')](0x194);}return _0xa1b9a5;};}function handleError(_0x1b6827,_0x5261d2){_0x5261d2=_0x5261d2||0x1f4;return function(_0x57954c){logger['error'](_0x57954c[_0x3129('0x28')]);if(_0x57954c['name']){delete _0x57954c[_0x3129('0x29')];}_0x1b6827[_0x3129('0x1b')](_0x5261d2)[_0x3129('0x2a')](_0x57954c);};}exports[_0x3129('0x2b')]=function(_0x28aa87,_0x448013){var _0x1b02e1={},_0x5c1d89={},_0x575f11={'count':0x0,'rows':[]};var _0x2c5ed6=_[_0x3129('0x2c')](db[_0x3129('0x2d')]['rawAttributes'],function(_0x7719c6){return{'name':_0x7719c6['fieldName'],'type':_0x7719c6[_0x3129('0x2e')][_0x3129('0x2f')]};});_0x5c1d89[_0x3129('0x30')]=_[_0x3129('0x2c')](_0x2c5ed6,'name');_0x5c1d89['query']=_['keys'](_0x28aa87[_0x3129('0x31')]);_0x5c1d89[_0x3129('0x32')]=_[_0x3129('0x33')](_0x5c1d89[_0x3129('0x30')],_0x5c1d89[_0x3129('0x31')]);_0x1b02e1[_0x3129('0x34')]=_['intersection'](_0x5c1d89['model'],qs[_0x3129('0x35')](_0x28aa87[_0x3129('0x31')][_0x3129('0x35')]));_0x1b02e1[_0x3129('0x34')]=_0x1b02e1[_0x3129('0x34')]['length']?_0x1b02e1[_0x3129('0x34')]:_0x5c1d89[_0x3129('0x30')];if(!_0x28aa87[_0x3129('0x31')][_0x3129('0x36')](_0x3129('0x37'))){_0x1b02e1['limit']=qs[_0x3129('0x18')](_0x28aa87[_0x3129('0x31')][_0x3129('0x18')]);_0x1b02e1['offset']=qs[_0x3129('0x17')](_0x28aa87[_0x3129('0x31')][_0x3129('0x17')]);}_0x1b02e1['order']=qs[_0x3129('0x38')](_0x28aa87[_0x3129('0x31')][_0x3129('0x38')]);_0x1b02e1['where']=qs['filters'](_[_0x3129('0x39')](_0x28aa87[_0x3129('0x31')],_0x5c1d89['filters']),_0x2c5ed6);if(_0x28aa87[_0x3129('0x31')]['filter']){_0x1b02e1[_0x3129('0x3a')]=_[_0x3129('0x3b')](_0x1b02e1['where'],{'$or':_[_0x3129('0x2c')](_0x2c5ed6,function(_0x2798ad){if(_0x2798ad['type']!=='VIRTUAL'){var _0x944683={};_0x944683[_0x2798ad['name']]={'$like':'%'+_0x28aa87[_0x3129('0x31')]['filter']+'%'};return _0x944683;}})});}_0x1b02e1=_[_0x3129('0x3b')]({},_0x1b02e1,_0x28aa87['options']);var _0x3a8a32={'where':_0x1b02e1['where']};return db[_0x3129('0x2d')]['count'](_0x3a8a32)[_0x3129('0x23')](function(_0x44687f){_0x575f11['count']=_0x44687f;if(_0x28aa87[_0x3129('0x31')][_0x3129('0x3c')]){_0x1b02e1[_0x3129('0x3d')]=[{'all':!![]}];}return db[_0x3129('0x2d')][_0x3129('0x3e')](_0x1b02e1);})['then'](function(_0x33ec4d){_0x575f11['rows']=_0x33ec4d;return _0x575f11;})[_0x3129('0x23')](respondWithFilteredResult(_0x448013,_0x1b02e1))['catch'](handleError(_0x448013,null));};exports[_0x3129('0x3f')]=function(_0x38be53,_0x162b75){var _0x3fd51e={'raw':![],'where':{'id':_0x38be53[_0x3129('0x40')]['id']}},_0x48e3eb={};_0x48e3eb[_0x3129('0x30')]=_[_0x3129('0x41')](db[_0x3129('0x2d')][_0x3129('0x42')]);_0x48e3eb[_0x3129('0x31')]=_[_0x3129('0x41')](_0x38be53[_0x3129('0x31')]);_0x48e3eb[_0x3129('0x32')]=_[_0x3129('0x33')](_0x48e3eb['model'],_0x48e3eb[_0x3129('0x31')]);_0x3fd51e[_0x3129('0x34')]=_['intersection'](_0x48e3eb[_0x3129('0x30')],qs['fields'](_0x38be53['query'][_0x3129('0x35')]));_0x3fd51e[_0x3129('0x34')]=_0x3fd51e[_0x3129('0x34')][_0x3129('0x43')]?_0x3fd51e['attributes']:_0x48e3eb[_0x3129('0x30')];if(_0x38be53[_0x3129('0x31')][_0x3129('0x3c')]){_0x3fd51e[_0x3129('0x3d')]=[{'all':!![]}];}_0x3fd51e=_['merge']({},_0x3fd51e,_0x38be53[_0x3129('0x44')]);return db[_0x3129('0x2d')][_0x3129('0x45')](_0x3fd51e)['then'](handleEntityNotFound(_0x162b75,null))['then'](respondWithResult(_0x162b75,null))[_0x3129('0x46')](handleError(_0x162b75,null));};exports[_0x3129('0x47')]=function(_0x4ad861,_0xa998f5){return db[_0x3129('0x2d')][_0x3129('0x47')](_0x4ad861['body'],{})[_0x3129('0x23')](function(_0x42752a){var _0x466696=_0x4ad861['user'][_0x3129('0x24')]({'plain':!![]});if(!_0x466696)throw new Error(_0x3129('0x48'));if(_0x466696[_0x3129('0x49')]===_0x3129('0x4a')){var _0x19eb01=_0x42752a[_0x3129('0x24')]({'plain':!![]});var _0x3bcfa9=_0x3129('0x4b');return db[_0x3129('0x4c')][_0x3129('0x45')]({'where':{'name':_0x3bcfa9,'userProfileId':_0x466696['userProfileId']},'raw':!![]})[_0x3129('0x23')](function(_0x25bebf){if(_0x25bebf&&_0x25bebf[_0x3129('0x4d')]===0x0){return db[_0x3129('0x26')]['create']({'name':_0x19eb01['name'],'resourceId':_0x19eb01['id'],'type':_0x3129('0x25'),'sectionId':_0x25bebf['id']},{})[_0x3129('0x23')](function(){return _0x42752a;});}else{return _0x42752a;}})[_0x3129('0x46')](function(_0x24e05b){logger[_0x3129('0x4e')](_0x3129('0x4f'),_0x24e05b);throw _0x24e05b;});}return _0x42752a;})['then'](respondWithResult(_0xa998f5,0xc9))[_0x3129('0x46')](handleError(_0xa998f5,null));};exports[_0x3129('0x21')]=function(_0x203162,_0x1d61c5){if(_0x203162['body']['id']){delete _0x203162['body']['id'];}return db[_0x3129('0x2d')][_0x3129('0x45')]({'where':{'id':_0x203162[_0x3129('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d61c5,null))[_0x3129('0x23')](saveUpdates(_0x203162[_0x3129('0x50')],null))[_0x3129('0x23')](respondWithResult(_0x1d61c5,null))[_0x3129('0x46')](handleError(_0x1d61c5,null));};exports['destroy']=function(_0x55fd47,_0x1f35ff){return db['AnalyticCustomReport'][_0x3129('0x45')]({'where':{'id':_0x55fd47['params']['id']}})[_0x3129('0x23')](handleEntityNotFound(_0x1f35ff,null))[_0x3129('0x23')](removeEntity(_0x1f35ff,null))[_0x3129('0x46')](handleError(_0x1f35ff,null));};exports['preview']=function(_0x5c24f9,_0x3e6f6c){var _0x53e030=0xa;var _0x5bccd1=[_0x3129('0x51'),_0x3129('0x52'),_0x3129('0x53'),_0x3129('0x54')];var _0x436fd5={'SUM':_0x3129('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3129('0x56'),'MAX':_0x3129('0x57'),'MIN':_0x3129('0x58'),'AVG':_0x3129('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x3129('0x5a')};var _0x3e8724={'SEC_TO_TIME':_0x3129('0x5b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x3129('0x5c'),'UNIX_TIMESTAMP':_0x3129('0x5d')};var _0xddff28=function(_0x3729e0){return!_[_0x3129('0x5e')]([_0x3129('0x5f'),_0x3129('0x60'),_0x3129('0x61'),'IS\x20NOT\x20EMPTY'],_0x3729e0);};var _0x40ea04=function(_0x40da9){if(!_0x40da9||!_0x40da9[_0x3129('0x62')][_0x3129('0x43')]){return'';}for(var _0x25a7c8='(',_0x241c76=0x0;_0x241c76<_0x40da9[_0x3129('0x62')][_0x3129('0x43')];_0x241c76+=0x1){_0x241c76>0x0&&(_0x25a7c8+='\x20'+_0x40da9[_0x3129('0x63')]+'\x20');_0x25a7c8+=_0x40da9[_0x3129('0x62')][_0x241c76]['group']?_0x40ea04(_0x40da9['rules'][_0x241c76][_0x3129('0x64')]):_0x40da9['rules'][_0x241c76][_0x3129('0x65')]+'\x20'+_0x40da9[_0x3129('0x62')][_0x241c76][_0x3129('0x66')]+(_0xddff28(_0x40da9[_0x3129('0x62')][_0x241c76][_0x3129('0x66')])?'\x20'+_0x40da9[_0x3129('0x62')][_0x241c76][_0x3129('0x67')]:'');}return _0x25a7c8+')';};var _0x4e721f={'where':{'id':_0x5c24f9['params']['id']}},_0x5e6ac4,_0xa1a415,_0x28f5fa,_0x413ac4,_0x3f4a02;_0x4e721f=_['merge']({},_0x4e721f,_0x5c24f9[_0x3129('0x44')]);return db[_0x3129('0x2d')][_0x3129('0x45')](_0x4e721f)[_0x3129('0x23')](function(_0xc3672c){if(_0xc3672c){_0x5e6ac4=_0xc3672c;return _0xc3672c['getFields']();}return null;})[_0x3129('0x23')](function(_0xcbf9b8){if(_0xcbf9b8){if(!_0xcbf9b8[_0x3129('0x43')]){throw new db[(_0x3129('0x68'))][(_0x3129('0x69'))](_0x3129('0x6a'),0x193);}_0xa1a415=_0xcbf9b8;return db[_0x3129('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x3129('0x23')](function(_0x499fea){if(_0x499fea){_0x28f5fa=_['keyBy'](_0x499fea,'id');var _0x3ca3e9;var _0x46ece0=squel[_0x3129('0x6c')]();_0x46ece0[_0x3129('0x6d')](_0x5e6ac4[_0x3129('0x6e')]);for(var _0xdb1b8=0x0;_0xdb1b8<_0xa1a415[_0x3129('0x43')];_0xdb1b8+=0x1){_0x3ca3e9=_0xa1a415[_0xdb1b8][_0x3129('0x6f')]?_0x28f5fa[_0xa1a415[_0xdb1b8]['MetricId']][_0x3129('0x70')]:_0xa1a415[_0xdb1b8][_0x3129('0x65')];_0x3ca3e9=_0xa1a415[_0xdb1b8][_0x3129('0x71')]?_['replace'](_0x436fd5[_0xa1a415[_0xdb1b8][_0x3129('0x71')]],'%s',_0x3ca3e9):_0x3ca3e9;_0x3ca3e9=_0xa1a415[_0xdb1b8][_0x3129('0x72')]?_[_0x3129('0x73')](_0x3e8724[_0xa1a415[_0xdb1b8][_0x3129('0x72')]],'%s',_0x3ca3e9):_0x3ca3e9;if(_0xa1a415[_0xdb1b8][_0x3129('0x74')]){_0x46ece0[_0x3129('0x64')](_0x3ca3e9);}_0xa1a415[_0xdb1b8][_0x3129('0x75')]&&_0x46ece0[_0x3129('0x76')](_0x3ca3e9,_0xa1a415[_0xdb1b8][_0x3129('0x75')]===_0x3129('0x77')?![]:!![]);_0x46ece0[_0x3129('0x65')](_0x3ca3e9,_0xa1a415[_0xdb1b8][_0x3129('0x78')]||_0x3ca3e9);}if(_0x5e6ac4[_0x3129('0x79')]){_0x5e6ac4[_0x3129('0x79')]=JSON[_0x3129('0x7a')](_0x5e6ac4[_0x3129('0x79')]);for(var _0x14b516=0x0;_0x14b516<_0x5e6ac4[_0x3129('0x79')][_0x3129('0x43')];_0x14b516+=0x1){if(_0x5e6ac4[_0x3129('0x79')][_0x14b516][_0x3129('0x2e')]&&_[_0x3129('0x5e')](_0x5bccd1,_0x5e6ac4[_0x3129('0x79')][_0x14b516]['type'])&&_0x5e6ac4[_0x3129('0x79')][_0x14b516][_0x3129('0x7b')]&&_0x5e6ac4[_0x3129('0x79')][_0x14b516][_0x3129('0x7c')]&&_0x5e6ac4[_0x3129('0x79')][_0x14b516][_0x3129('0x7d')]){_0x46ece0[_0x5e6ac4['joins'][_0x14b516][_0x3129('0x2e')]](_0x5e6ac4['joins'][_0x14b516][_0x3129('0x7c')],null,util[_0x3129('0x72')](_0x3129('0x7e'),_0x5e6ac4[_0x3129('0x6e')],_0x5e6ac4['joins'][_0x14b516][_0x3129('0x7b')],_0x5e6ac4[_0x3129('0x79')][_0x14b516][_0x3129('0x7c')],_0x5e6ac4[_0x3129('0x79')][_0x14b516]['foreignKey']));}}}if(_0x5e6ac4[_0x3129('0x7f')]){_0x5e6ac4[_0x3129('0x7f')]=JSON[_0x3129('0x7a')](_0x5e6ac4[_0x3129('0x7f')]);_0x46ece0[_0x3129('0x3a')](_0x40ea04(_0x5e6ac4[_0x3129('0x7f')][_0x3129('0x64')]));}_0x3f4a02=_0x46ece0[_0x3129('0x80')]();_0x46ece0['limit'](_0x53e030);_0x46ece0[_0x3129('0x17')](0x0);logger['debug'](_0x3129('0x81'),_0x46ece0['toString']());return dbH[_0x3129('0x82')][_0x3129('0x31')](_0x46ece0['toString'](),{'type':dbH[_0x3129('0x82')][_0x3129('0x83')]['SELECT']});}})[_0x3129('0x23')](respondWithResult(_0x3e6f6c,null))[_0x3129('0x46')](handleError(_0x3e6f6c,null));};function runReport(_0x205ec9,_0x4aef35,_0x57f329){var _0x2862a5=_0x4aef35[_0x3129('0x29')];var _0x32b553=0xa;var _0x2092fc=[_0x3129('0x51'),_0x3129('0x52'),_0x3129('0x53'),_0x3129('0x54')];var _0xc1e123={'SUM':_0x3129('0x55'),'COUNT':_0x3129('0x84'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x3129('0x57'),'MIN':_0x3129('0x58'),'AVG':_0x3129('0x59'),'GROUP_CONCAT':_0x3129('0x85'),'GROUP_CONCAT ASC':_0x3129('0x86'),'GROUP_CONCAT DESC':_0x3129('0x5a')};var _0x40fa48={'SEC_TO_TIME':_0x3129('0x5b'),'DATE':_0x3129('0x87'),'HOUR':_0x3129('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x3129('0x5d')};var _0x17e8eb=function(_0x22054d){return!_[_0x3129('0x5e')]([_0x3129('0x5f'),_0x3129('0x60'),_0x3129('0x61'),_0x3129('0x89')],_0x22054d);};var _0x2233b4=function(_0x2735cf){if(!_0x2735cf||!_0x2735cf[_0x3129('0x62')][_0x3129('0x43')]){return'';}for(var _0x49731a='(',_0x5ed246=0x0;_0x5ed246<_0x2735cf[_0x3129('0x62')][_0x3129('0x43')];_0x5ed246+=0x1){_0x5ed246>0x0&&(_0x49731a+='\x20'+_0x2735cf[_0x3129('0x63')]+'\x20');_0x49731a+=_0x2735cf[_0x3129('0x62')][_0x5ed246][_0x3129('0x64')]?_0x2233b4(_0x2735cf[_0x3129('0x62')][_0x5ed246]['group']):_0x2735cf[_0x3129('0x62')][_0x5ed246][_0x3129('0x65')]+'\x20'+_0x2735cf[_0x3129('0x62')][_0x5ed246][_0x3129('0x66')]+(_0x17e8eb(_0x2735cf[_0x3129('0x62')][_0x5ed246]['condition'])?'\x20'+_0x2735cf[_0x3129('0x62')][_0x5ed246]['value']:'');}return _0x49731a+')';};var _0x174ce3={'where':{'id':_0x205ec9['id']}},_0x234977,_0x4fb2fc,_0x48fdf7,_0x415bd2,_0x4d9926;_0x174ce3=_[_0x3129('0x3b')]({},_0x174ce3,_0x57f329);return db['AnalyticCustomReport'][_0x3129('0x45')](_0x174ce3)[_0x3129('0x23')](function(_0x516808){if(_0x516808){_0x234977=_0x516808;return _0x516808[_0x3129('0x8a')]();}return null;})[_0x3129('0x23')](function(_0x130f63){if(_0x130f63){if(!_0x130f63[_0x3129('0x43')]){throw new db[(_0x3129('0x68'))][(_0x3129('0x69'))](_0x3129('0x6a'),0x193);}_0x4fb2fc=_0x130f63;return db[_0x3129('0x6b')][_0x3129('0x3e')]({'raw':!![]});}return null;})[_0x3129('0x23')](function(_0x18eacb){if(_0x18eacb){_0x48fdf7=_[_0x3129('0x8b')](_0x18eacb,'id');var _0x34c34b;var _0x273ea0=squel['select']();_0x273ea0[_0x3129('0x6d')](_0x234977[_0x3129('0x6e')]);for(var _0x15c8cc=0x0;_0x15c8cc<_0x4fb2fc['length'];_0x15c8cc+=0x1){_0x34c34b=_0x4fb2fc[_0x15c8cc][_0x3129('0x6f')]?_0x48fdf7[_0x4fb2fc[_0x15c8cc][_0x3129('0x6f')]][_0x3129('0x70')]:_0x4fb2fc[_0x15c8cc][_0x3129('0x65')];_0x34c34b=_0x4fb2fc[_0x15c8cc][_0x3129('0x71')]?_[_0x3129('0x73')](_0xc1e123[_0x4fb2fc[_0x15c8cc]['function']],'%s',_0x34c34b):_0x34c34b;_0x34c34b=_0x4fb2fc[_0x15c8cc][_0x3129('0x72')]?_['replace'](_0x40fa48[_0x4fb2fc[_0x15c8cc]['format']],'%s',_0x34c34b):_0x34c34b;if(_0x4fb2fc[_0x15c8cc][_0x3129('0x74')]){_0x273ea0[_0x3129('0x64')](_0x34c34b);}_0x4fb2fc[_0x15c8cc][_0x3129('0x75')]&&_0x273ea0['order'](_0x34c34b,_0x4fb2fc[_0x15c8cc][_0x3129('0x75')]===_0x3129('0x77')?![]:!![]);_0x273ea0['field'](_0x34c34b,_0x4fb2fc[_0x15c8cc]['alias']||_0x34c34b);}if(_0x234977[_0x3129('0x79')]){_0x234977[_0x3129('0x79')]=JSON[_0x3129('0x7a')](_0x234977['joins']);for(var _0x243632=0x0;_0x243632<_0x234977[_0x3129('0x79')][_0x3129('0x43')];_0x243632+=0x1){if(_0x234977['joins'][_0x243632][_0x3129('0x2e')]&&_[_0x3129('0x5e')](_0x2092fc,_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x2e')])&&_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x7b')]&&_0x234977['joins'][_0x243632][_0x3129('0x7c')]&&_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x7d')]){_0x273ea0[_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x2e')]](_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x7c')],null,util['format'](_0x3129('0x7e'),_0x234977[_0x3129('0x6e')],_0x234977[_0x3129('0x79')][_0x243632]['parentKey'],_0x234977[_0x3129('0x79')][_0x243632]['foreignTable'],_0x234977[_0x3129('0x79')][_0x243632][_0x3129('0x7d')]));}}}if(_0x234977[_0x3129('0x7f')]){_0x234977[_0x3129('0x7f')]=JSON['parse'](_0x234977[_0x3129('0x7f')]);_0x273ea0[_0x3129('0x3a')](_0x2233b4(_0x234977[_0x3129('0x7f')]['group']));}_0x4d9926=_0x273ea0[_0x3129('0x80')]();_0x273ea0['limit'](_0x32b553);_0x273ea0[_0x3129('0x17')](0x0);return;}})[_0x3129('0x23')](function(){if(_0x4aef35[_0x3129('0x8c')]===_0x3129('0x8d')){return null;}var _0x2cdfc9=_['merge'](_0x4aef35,{'name':_0x4aef35[_0x3129('0x8e')]||_0x4aef35[_0x3129('0x29')]||_0x234977['name'],'basename':_0x2862a5,'savename':util[_0x3129('0x72')]('%s-%s.%s',_0x4aef35[_0x3129('0x29')]||_0x234977[_0x3129('0x29')],require(_0x3129('0x8f'))[_0x3129('0x90')](0x4),_0x4aef35[_0x3129('0x8c')]||_0x3129('0x91')),'reportId':_0x234977['id'],'reportType':_0x3129('0x92')});return db['AnalyticExtractedReport'][_0x3129('0x47')](_0x2cdfc9,{'raw':!![]});})[_0x3129('0x23')](function(_0x2f62ad){if(_0x234977['table']==='cdr'){_0x4d9926[_0x3129('0x3a')](_0x234977[_0x3129('0x6e')]+_0x3129('0x93'),_0x4aef35['startDate'],_0x4aef35['endDate']);}else{_0x4d9926[_0x3129('0x3a')](_0x234977[_0x3129('0x6e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4aef35[_0x3129('0x94')],_0x4aef35[_0x3129('0x95')]);}if(_0x2f62ad){logger[_0x3129('0x96')](_0x3129('0x97'),_0x4d9926[_0x3129('0x98')]());require(_0x3129('0x99'))['fork'](path[_0x3129('0x51')](__dirname,_0x3129('0x9a'),_0x2f62ad[_0x3129('0x8c')]),[_0x2f62ad['id'],_0x4d9926[_0x3129('0x98')](),path[_0x3129('0x51')](__dirname,_0x3129('0x9b'),_0x2f62ad['savename']),_0x2862a5]);return _0x2f62ad;}else{var _0x32f4ad=squel[_0x3129('0x6c')]();_0x32f4ad[_0x3129('0x6d')]('('+_0x4d9926[_0x3129('0x98')]()+')',_0x3129('0x9c'));_0x32f4ad[_0x3129('0x65')](_0x3129('0x9d'),_0x3129('0x1a'));_0x4d9926['limit'](_0x4aef35[_0x3129('0x18')]||_0x32b553);_0x4d9926['offset'](_0x4aef35[_0x3129('0x17')]||0x0);return dbH[_0x3129('0x82')][_0x3129('0x31')](_0x32f4ad['toString'](),{'type':dbH[_0x3129('0x82')][_0x3129('0x83')]['SELECT']})[_0x3129('0x23')](function(_0x17e135){if(!_0x17e135['length']){_0x415bd2=0x0;}else{_0x415bd2=_0x17e135[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x4d9926[_0x3129('0x98')](),{'type':dbH[_0x3129('0x82')][_0x3129('0x83')][_0x3129('0x9e')]});})[_0x3129('0x23')](function(_0x470197){return{'rows':_0x470197||[],'count':_0x415bd2};});}});}exports[_0x3129('0x9f')]=function(_0x29deee,_0x15618b){return runReport(_0x29deee['params'],_0x29deee[_0x3129('0x31')],_0x29deee[_0x3129('0x44')])[_0x3129('0x23')](respondWithResult(_0x15618b,null))['catch'](handleError(_0x15618b,null));};exports[_0x3129('0xa0')]=runReport;exports[_0x3129('0x31')]=function(_0x2479f0,_0x248c51){var _0x2988ac=0xa;var _0xa963ea=[_0x3129('0x51'),_0x3129('0x52'),_0x3129('0x53'),_0x3129('0x54')];var _0x188746={'SUM':_0x3129('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3129('0x56'),'MAX':'MAX(%s)','MIN':_0x3129('0x58'),'AVG':_0x3129('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x3129('0x86'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1d85c2={'SEC_TO_TIME':_0x3129('0x5b'),'DATE':_0x3129('0x87'),'HOUR':_0x3129('0x88'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x244691=function(_0x1a7634){return!_[_0x3129('0x5e')]([_0x3129('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x3129('0x89')],_0x1a7634);};var _0x3a4a5f=function(_0x201106){if(!_0x201106||!_0x201106[_0x3129('0x62')][_0x3129('0x43')]){return'';}for(var _0x22cbfb='(',_0x503945=0x0;_0x503945<_0x201106['rules']['length'];_0x503945+=0x1){_0x503945>0x0&&(_0x22cbfb+='\x20'+_0x201106[_0x3129('0x63')]+'\x20');_0x22cbfb+=_0x201106[_0x3129('0x62')][_0x503945][_0x3129('0x64')]?_0x3a4a5f(_0x201106[_0x3129('0x62')][_0x503945]['group']):_0x201106[_0x3129('0x62')][_0x503945]['field']+'\x20'+_0x201106[_0x3129('0x62')][_0x503945][_0x3129('0x66')]+(_0x244691(_0x201106['rules'][_0x503945]['condition'])?'\x20'+_0x201106['rules'][_0x503945][_0x3129('0x67')]:'');}return _0x22cbfb+')';};var _0x52306a={'where':{'id':_0x2479f0['params']['id']}},_0x3e9bd,_0x504893,_0x840c7d,_0x15afdc,_0x560503;_0x52306a=_['merge']({},_0x52306a,_0x2479f0[_0x3129('0x44')]);return db[_0x3129('0x2d')]['find'](_0x52306a)[_0x3129('0x23')](function(_0x15fc33){if(_0x15fc33){_0x3e9bd=_0x15fc33;return _0x15fc33[_0x3129('0x8a')]();}return null;})[_0x3129('0x23')](function(_0x96f426){if(_0x96f426){if(!_0x96f426['length']){throw new db[(_0x3129('0x68'))][(_0x3129('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x504893=_0x96f426;return db[_0x3129('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x3129('0x23')](function(_0xf0280b){if(_0xf0280b){_0x840c7d=_['keyBy'](_0xf0280b,'id');var _0x585f29;var _0x1c3e63=squel[_0x3129('0x6c')]();_0x1c3e63[_0x3129('0x6d')](_0x3e9bd[_0x3129('0x6e')]);for(var _0x558f02=0x0;_0x558f02<_0x504893[_0x3129('0x43')];_0x558f02+=0x1){_0x585f29=_0x504893[_0x558f02][_0x3129('0x6f')]?_0x840c7d[_0x504893[_0x558f02][_0x3129('0x6f')]][_0x3129('0x70')]:_0x504893[_0x558f02][_0x3129('0x65')];_0x585f29=_0x504893[_0x558f02][_0x3129('0x71')]?_[_0x3129('0x73')](_0x188746[_0x504893[_0x558f02][_0x3129('0x71')]],'%s',_0x585f29):_0x585f29;_0x585f29=_0x504893[_0x558f02]['format']?_[_0x3129('0x73')](_0x1d85c2[_0x504893[_0x558f02][_0x3129('0x72')]],'%s',_0x585f29):_0x585f29;if(_0x504893[_0x558f02][_0x3129('0x74')]){_0x1c3e63[_0x3129('0x64')](_0x585f29);}_0x504893[_0x558f02]['orderBy']&&_0x1c3e63[_0x3129('0x76')](_0x585f29,_0x504893[_0x558f02][_0x3129('0x75')]===_0x3129('0x77')?![]:!![]);_0x1c3e63[_0x3129('0x65')](_0x585f29,_0x504893[_0x558f02][_0x3129('0x78')]||_0x585f29);}if(_0x3e9bd['joins']){_0x3e9bd[_0x3129('0x79')]=JSON[_0x3129('0x7a')](_0x3e9bd[_0x3129('0x79')]);for(var _0x15d414=0x0;_0x15d414<_0x3e9bd['joins']['length'];_0x15d414+=0x1){if(_0x3e9bd['joins'][_0x15d414]['type']&&_[_0x3129('0x5e')](_0xa963ea,_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x2e')])&&_0x3e9bd['joins'][_0x15d414][_0x3129('0x7b')]&&_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x7c')]&&_0x3e9bd[_0x3129('0x79')][_0x15d414]['foreignKey']){_0x1c3e63[_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x2e')]](_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x7c')],null,util[_0x3129('0x72')](_0x3129('0x7e'),_0x3e9bd[_0x3129('0x6e')],_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x7b')],_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x7c')],_0x3e9bd[_0x3129('0x79')][_0x15d414][_0x3129('0x7d')]));}}}if(_0x3e9bd[_0x3129('0x7f')]){_0x3e9bd[_0x3129('0x7f')]=JSON['parse'](_0x3e9bd['conditions']);_0x1c3e63[_0x3129('0x3a')](_0x3a4a5f(_0x3e9bd[_0x3129('0x7f')][_0x3129('0x64')]));}_0x560503=_0x1c3e63['clone']();_0x1c3e63[_0x3129('0x18')](_0x2988ac);_0x1c3e63[_0x3129('0x17')](0x0);logger[_0x3129('0xa1')](_0x3129('0x81'),_0x1c3e63[_0x3129('0x98')]());return dbH[_0x3129('0x82')][_0x3129('0x31')](_0x1c3e63[_0x3129('0x98')](),{'type':dbH[_0x3129('0x82')][_0x3129('0x83')]['SELECT']});}})['then'](function(){return{'sql':_0x560503[_0x3129('0x98')]()};})[_0x3129('0x23')](respondWithResult(_0x248c51,null))['catch'](handleError(_0x248c51,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d0ab346..7976437 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 _0x1d34=['request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3296c8,_0x28f39a){var _0x8a0bdb=function(_0x35592c){while(--_0x35592c){_0x3296c8['push'](_0x3296c8['shift']());}};_0x8a0bdb(++_0x28f39a);}(_0x1d34,0x1c8));var _0x41d3=function(_0xdca04e,_0x4d6e9d){_0xdca04e=_0xdca04e-0x0;var _0x221d9c=_0x1d34[_0xdca04e];return _0x221d9c;};'use strict';var _=require(_0x41d3('0x0'));var util=require(_0x41d3('0x1'));var logger=require(_0x41d3('0x2'))(_0x41d3('0x3'));var moment=require(_0x41d3('0x4'));var BPromise=require(_0x41d3('0x5'));var rp=require(_0x41d3('0x6'));var fs=require('fs');var path=require(_0x41d3('0x7'));var rimraf=require(_0x41d3('0x8'));var config=require(_0x41d3('0x9'));var attributes=require(_0x41d3('0xa'));module[_0x41d3('0xb')]=function(_0x2a7ae8,_0xd5edbc){return _0x2a7ae8[_0x41d3('0xc')](_0x41d3('0xd'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb029=['AnalyticCustomReport','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x21c369,_0xd10616){var _0x1bd425=function(_0x3ba7e9){while(--_0x3ba7e9){_0x21c369['push'](_0x21c369['shift']());}};_0x1bd425(++_0xd10616);}(_0xb029,0xab));var _0x9b02=function(_0x3cc81e,_0x3309df){_0x3cc81e=_0x3cc81e-0x0;var _0x3d83ba=_0xb029[_0x3cc81e];return _0x3d83ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9b02('0x0'));var moment=require('moment');var BPromise=require(_0x9b02('0x1'));var rp=require(_0x9b02('0x2'));var fs=require('fs');var path=require(_0x9b02('0x3'));var rimraf=require(_0x9b02('0x4'));var config=require(_0x9b02('0x5'));var attributes=require(_0x9b02('0x6'));module[_0x9b02('0x7')]=function(_0x45db3d,_0x23b2f2){return _0x45db3d[_0x9b02('0x8')](_0x9b02('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 7069f4c..1185137 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 _0x3a80=['code','message','info','result','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x109d07,_0x493a0f){var _0x549773=function(_0x1010df){while(--_0x1010df){_0x109d07['push'](_0x109d07['shift']());}};_0x549773(++_0x493a0f);}(_0x3a80,0x1cc));var _0x03a8=function(_0x13822a,_0x148b1c){_0x13822a=_0x13822a-0x0;var _0x1ff066=_0x3a80[_0x13822a];return _0x1ff066;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x03a8('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03a8('0x1'));var db=require(_0x03a8('0x2'))['db'];var utils=require(_0x03a8('0x3'));var logger=require('../../config/logger')(_0x03a8('0x4'));var config=require(_0x03a8('0x5'));var jayson=require(_0x03a8('0x6'));var client=jayson[_0x03a8('0x7')][_0x03a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45bf78,_0x2c4656,_0x4d7033){return new BPromise(function(_0x57976b,_0x3b2aab){return client['request'](_0x45bf78,_0x4d7033)[_0x03a8('0x9')](function(_0x403c84){logger['info'](_0x03a8('0xa'),_0x2c4656,'request\x20sent');logger['debug'](_0x03a8('0xb'),_0x2c4656,_0x03a8('0xc'),JSON[_0x03a8('0xd')](_0x403c84));if(_0x403c84[_0x03a8('0xe')]){if(_0x403c84[_0x03a8('0xe')][_0x03a8('0xf')]===0x1f4){logger[_0x03a8('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2c4656,_0x403c84['error'][_0x03a8('0x10')]);return _0x3b2aab(_0x403c84['error'][_0x03a8('0x10')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x2c4656,_0x403c84['error'][_0x03a8('0x10')]);return _0x57976b(_0x403c84[_0x03a8('0xe')][_0x03a8('0x10')]);}else{logger[_0x03a8('0x11')](_0x03a8('0xa'),_0x2c4656,_0x03a8('0xc'));_0x57976b(_0x403c84[_0x03a8('0x12')]['message']);}})['catch'](function(_0x5b3263){logger[_0x03a8('0xe')](_0x03a8('0xa'),_0x2c4656,_0x5b3263);_0x3b2aab(_0x5b3263);});});} \ No newline at end of file +var _0x1c64=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2c4c48,_0x402353){var _0x5ee161=function(_0xdf7e78){while(--_0xdf7e78){_0x2c4c48['push'](_0x2c4c48['shift']());}};_0x5ee161(++_0x402353);}(_0x1c64,0x13d));var _0x41c6=function(_0x402887,_0xb5813c){_0x402887=_0x402887-0x0;var _0x3fa3cb=_0x1c64[_0x402887];return _0x3fa3cb;};'use strict';var _=require(_0x41c6('0x0'));var util=require(_0x41c6('0x1'));var moment=require(_0x41c6('0x2'));var BPromise=require('bluebird');var rs=require(_0x41c6('0x3'));var fs=require('fs');var Redis=require(_0x41c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x41c6('0x5'));var logger=require(_0x41c6('0x6'))(_0x41c6('0x7'));var config=require(_0x41c6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x41c6('0x9')][_0x41c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x201b28,_0x24f07c,_0x2996c7){return new BPromise(function(_0x8453ba,_0x3d4c5b){return client['request'](_0x201b28,_0x2996c7)['then'](function(_0x4845fe){logger[_0x41c6('0xb')](_0x41c6('0xc'),_0x24f07c,_0x41c6('0xd'));logger[_0x41c6('0xe')](_0x41c6('0xf'),_0x24f07c,_0x41c6('0xd'),JSON[_0x41c6('0x10')](_0x4845fe));if(_0x4845fe[_0x41c6('0x11')]){if(_0x4845fe[_0x41c6('0x11')]['code']===0x1f4){logger['error'](_0x41c6('0xc'),_0x24f07c,_0x4845fe[_0x41c6('0x11')][_0x41c6('0x12')]);return _0x3d4c5b(_0x4845fe[_0x41c6('0x11')][_0x41c6('0x12')]);}logger[_0x41c6('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x24f07c,_0x4845fe[_0x41c6('0x11')][_0x41c6('0x12')]);return _0x8453ba(_0x4845fe[_0x41c6('0x11')][_0x41c6('0x12')]);}else{logger[_0x41c6('0xb')](_0x41c6('0xc'),_0x24f07c,'request\x20sent');_0x8453ba(_0x4845fe[_0x41c6('0x13')][_0x41c6('0x12')]);}})[_0x41c6('0x14')](function(_0x16b9f7){logger[_0x41c6('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x24f07c,_0x16b9f7);_0x3d4c5b(_0x16b9f7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 85d175f..d5e72d4 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 _0xc007=['/:id/run','/:id/query','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','preview'];(function(_0xb0140c,_0x36ed8c){var _0x42e239=function(_0x5ebc5b){while(--_0x5ebc5b){_0xb0140c['push'](_0xb0140c['shift']());}};_0x42e239(++_0x36ed8c);}(_0xc007,0x150));var _0x7c00=function(_0x595bd6,_0x4c01c9){_0x595bd6=_0x595bd6-0x0;var _0x17f264=_0xc007[_0x595bd6];return _0x17f264;};'use strict';var multer=require(_0x7c00('0x0'));var util=require(_0x7c00('0x1'));var path=require(_0x7c00('0x2'));var timeout=require(_0x7c00('0x3'));var express=require(_0x7c00('0x4'));var router=express[_0x7c00('0x5')]();var fs_extra=require(_0x7c00('0x6'));var auth=require(_0x7c00('0x7'));var interaction=require(_0x7c00('0x8'));var config=require(_0x7c00('0x9'));var controller=require(_0x7c00('0xa'));router[_0x7c00('0xb')]('/',auth[_0x7c00('0xc')](),controller[_0x7c00('0xd')]);router[_0x7c00('0xb')](_0x7c00('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7c00('0xb')]('/:id/preview',auth[_0x7c00('0xc')](),controller[_0x7c00('0xf')]);router[_0x7c00('0xb')](_0x7c00('0x10'),auth[_0x7c00('0xc')](),controller['run']);router[_0x7c00('0xb')](_0x7c00('0x11'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x7c00('0xc')](),controller[_0x7c00('0x12')]);router['put']('/:id',auth[_0x7c00('0xc')](),controller[_0x7c00('0x13')]);router[_0x7c00('0x14')](_0x7c00('0xe'),auth[_0x7c00('0xc')](),controller[_0x7c00('0x15')]);module['exports']=router; \ No newline at end of file +var _0xaf58=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','/:id','show','preview','run','/:id/query','create','update','delete','destroy','exports','util'];(function(_0x5905cd,_0x36f55e){var _0x43a05d=function(_0x5a5d16){while(--_0x5a5d16){_0x5905cd['push'](_0x5905cd['shift']());}};_0x43a05d(++_0x36f55e);}(_0xaf58,0x155));var _0x8af5=function(_0x3b2944,_0x255615){_0x3b2944=_0x3b2944-0x0;var _0xea505e=_0xaf58[_0x3b2944];return _0xea505e;};'use strict';var multer=require('multer');var util=require(_0x8af5('0x0'));var path=require(_0x8af5('0x1'));var timeout=require(_0x8af5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8af5('0x3'));var auth=require(_0x8af5('0x4'));var interaction=require(_0x8af5('0x5'));var config=require('../../config/environment');var controller=require(_0x8af5('0x6'));router[_0x8af5('0x7')]('/',auth[_0x8af5('0x8')](),controller['index']);router[_0x8af5('0x7')](_0x8af5('0x9'),auth[_0x8af5('0x8')](),controller[_0x8af5('0xa')]);router[_0x8af5('0x7')]('/:id/preview',auth[_0x8af5('0x8')](),controller[_0x8af5('0xb')]);router['get']('/:id/run',auth[_0x8af5('0x8')](),controller[_0x8af5('0xc')]);router['get'](_0x8af5('0xd'),auth[_0x8af5('0x8')](),controller['query']);router['post']('/',auth[_0x8af5('0x8')](),controller[_0x8af5('0xe')]);router['put'](_0x8af5('0x9'),auth[_0x8af5('0x8')](),controller[_0x8af5('0xf')]);router[_0x8af5('0x10')](_0x8af5('0x9'),auth[_0x8af5('0x8')](),controller[_0x8af5('0x11')]);module[_0x8af5('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 06e3ad4..c891f97 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 _0xbd51=['sequelize','STRING'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x53b025,_0x17e6e7){_0x53b025=_0x53b025-0x0;var _0x58f720=_0xbd51[_0x53b025];return _0x58f720;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x71ab=['TEXT','exports','STRING'];(function(_0x48aa52,_0x16ee0d){var _0x413d61=function(_0x361b3e){while(--_0x361b3e){_0x48aa52['push'](_0x48aa52['shift']());}};_0x413d61(++_0x16ee0d);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0xb71a('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb71a('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb71a('0x1')]},'conditions':{'type':Sequelize[_0xb71a('0x2')]},'joins':{'type':Sequelize[_0xb71a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 908abd7..31c7ce4 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 _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x2745eb,_0x2b6f48){var _0x19584=function(_0x51efb2){while(--_0x51efb2){_0x2745eb['push'](_0x2745eb['shift']());}};_0x19584(++_0x2b6f48);}(_0x5fab,0x177));var _0xb5fa=function(_0x542d87,_0x3f1428){_0x542d87=_0x542d87-0x0;var _0x18f154=_0x5fab[_0x542d87];return _0x18f154;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x21b0ef,_0x2bec64){var _0x135500=function(_0x4d155){while(--_0x4d155){_0x21b0ef['push'](_0x21b0ef['shift']());}};_0x135500(++_0x2bec64);}(_0x2675,0x75));var _0x5267=function(_0x5d8778,_0x3c2f0e){_0x5d8778=_0x5d8778-0x0;var _0x133e42=_0x2675[_0x5d8778];return _0x133e42;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index c3d6d3a..c1a16fa 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 _0xa697=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment'];(function(_0x9c12eb,_0x1b74fa){var _0x97dfd1=function(_0x360c8e){while(--_0x360c8e){_0x9c12eb['push'](_0x9c12eb['shift']());}};_0x97dfd1(++_0x1b74fa);}(_0xa697,0x168));var _0x7a69=function(_0x334126,_0x481df5){_0x334126=_0x334126-0x0;var _0x274957=_0xa697[_0x334126];return _0x274957;};'use strict';var _=require(_0x7a69('0x0'));var util=require(_0x7a69('0x1'));var logger=require(_0x7a69('0x2'))('api');var moment=require(_0x7a69('0x3'));var BPromise=require(_0x7a69('0x4'));var rp=require(_0x7a69('0x5'));var fs=require('fs');var path=require(_0x7a69('0x6'));var rimraf=require(_0x7a69('0x7'));var config=require(_0x7a69('0x8'));var attributes=require(_0x7a69('0x9'));module['exports']=function(_0x2fa607,_0x310d56){return _0x2fa607[_0x7a69('0xa')](_0x7a69('0xb'),attributes,{'tableName':_0x7a69('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c0f=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x148775,_0x27e4d2){var _0x519740=function(_0x31158e){while(--_0x31158e){_0x148775['push'](_0x148775['shift']());}};_0x519740(++_0x27e4d2);}(_0x1c0f,0x1da));var _0xf1c0=function(_0x1b4938,_0x455fa6){_0x1b4938=_0x1b4938-0x0;var _0x161473=_0x1c0f[_0x1b4938];return _0x161473;};'use strict';var _=require(_0xf1c0('0x0'));var util=require(_0xf1c0('0x1'));var logger=require(_0xf1c0('0x2'))('api');var moment=require(_0xf1c0('0x3'));var BPromise=require(_0xf1c0('0x4'));var rp=require(_0xf1c0('0x5'));var fs=require('fs');var path=require(_0xf1c0('0x6'));var rimraf=require(_0xf1c0('0x7'));var config=require(_0xf1c0('0x8'));var attributes=require(_0xf1c0('0x9'));module[_0xf1c0('0xa')]=function(_0x30e3f4,_0xcfbd71){return _0x30e3f4[_0xf1c0('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0xf1c0('0xc'),'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 edf9b50..cc69f02 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 _0x18a4=['request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s'];(function(_0x33e566,_0x3e90f4){var _0x828b80=function(_0x2b67d2){while(--_0x2b67d2){_0x33e566['push'](_0x33e566['shift']());}};_0x828b80(++_0x3e90f4);}(_0x18a4,0x8a));var _0x418a=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x18a4[_0x466e57];return _0x34df42;};'use strict';var _=require(_0x418a('0x0'));var util=require(_0x418a('0x1'));var moment=require('moment');var BPromise=require(_0x418a('0x2'));var rs=require(_0x418a('0x3'));var fs=require('fs');var Redis=require(_0x418a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x418a('0x5'));var logger=require('../../config/logger')(_0x418a('0x6'));var config=require(_0x418a('0x7'));var jayson=require(_0x418a('0x8'));var client=jayson[_0x418a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x593418,_0x191d1c,_0x11dc25){return new BPromise(function(_0x2a8d88,_0x36583c){return client[_0x418a('0xa')](_0x593418,_0x11dc25)[_0x418a('0xb')](function(_0x56a629){logger[_0x418a('0xc')](_0x418a('0xd'),_0x191d1c,'request\x20sent');logger[_0x418a('0xe')](_0x418a('0xf'),_0x191d1c,_0x418a('0x10'),JSON[_0x418a('0x11')](_0x56a629));if(_0x56a629[_0x418a('0x12')]){if(_0x56a629[_0x418a('0x12')][_0x418a('0x13')]===0x1f4){logger[_0x418a('0x12')](_0x418a('0xd'),_0x191d1c,_0x56a629[_0x418a('0x12')][_0x418a('0x14')]);return _0x36583c(_0x56a629[_0x418a('0x12')][_0x418a('0x14')]);}logger[_0x418a('0x12')](_0x418a('0xd'),_0x191d1c,_0x56a629[_0x418a('0x12')][_0x418a('0x14')]);return _0x2a8d88(_0x56a629['error'][_0x418a('0x14')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x191d1c,_0x418a('0x10'));_0x2a8d88(_0x56a629['result']['message']);}})[_0x418a('0x15')](function(_0x132bd0){logger['error'](_0x418a('0xd'),_0x191d1c,_0x132bd0);_0x36583c(_0x132bd0);});});} \ No newline at end of file +var _0x07cc=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x453929,_0x2ab5e4){var _0x56a8a3=function(_0x26960b){while(--_0x26960b){_0x453929['push'](_0x453929['shift']());}};_0x56a8a3(++_0x2ab5e4);}(_0x07cc,0x164));var _0xc07c=function(_0x4d0fc8,_0x108334){_0x4d0fc8=_0x4d0fc8-0x0;var _0x47cb1c=_0x07cc[_0x4d0fc8];return _0x47cb1c;};'use strict';var _=require(_0xc07c('0x0'));var util=require(_0xc07c('0x1'));var moment=require(_0xc07c('0x2'));var BPromise=require(_0xc07c('0x3'));var rs=require(_0xc07c('0x4'));var fs=require('fs');var Redis=require(_0xc07c('0x5'));var db=require(_0xc07c('0x6'))['db'];var utils=require(_0xc07c('0x7'));var logger=require(_0xc07c('0x8'))(_0xc07c('0x9'));var config=require(_0xc07c('0xa'));var jayson=require(_0xc07c('0xb'));var client=jayson[_0xc07c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd50b3e,_0x367560,_0x214981){return new BPromise(function(_0x409d66,_0x42d183){return client[_0xc07c('0xd')](_0xd50b3e,_0x214981)[_0xc07c('0xe')](function(_0x1964a3){logger[_0xc07c('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x367560,_0xc07c('0x10'));logger['debug'](_0xc07c('0x11'),_0x367560,_0xc07c('0x10'),JSON[_0xc07c('0x12')](_0x1964a3));if(_0x1964a3[_0xc07c('0x13')]){if(_0x1964a3[_0xc07c('0x13')]['code']===0x1f4){logger[_0xc07c('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x367560,_0x1964a3[_0xc07c('0x13')][_0xc07c('0x14')]);return _0x42d183(_0x1964a3[_0xc07c('0x13')][_0xc07c('0x14')]);}logger[_0xc07c('0x13')](_0xc07c('0x15'),_0x367560,_0x1964a3[_0xc07c('0x13')][_0xc07c('0x14')]);return _0x409d66(_0x1964a3[_0xc07c('0x13')][_0xc07c('0x14')]);}else{logger[_0xc07c('0xf')](_0xc07c('0x15'),_0x367560,'request\x20sent');_0x409d66(_0x1964a3[_0xc07c('0x16')][_0xc07c('0x14')]);}})[_0xc07c('0x17')](function(_0x5badab){logger[_0xc07c('0x13')](_0xc07c('0x15'),_0x367560,_0x5badab);_0x42d183(_0x5badab);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 405e6ea..0fdfe5a 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 _0xa380=['preview','/:id/run','run','/:id/query','query','post','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','/:id/preview'];(function(_0x41786d,_0x20ffcc){var _0x7dd80d=function(_0x1b702f){while(--_0x1b702f){_0x41786d['push'](_0x41786d['shift']());}};_0x7dd80d(++_0x20ffcc);}(_0xa380,0x153));var _0x0a38=function(_0x72f85e,_0x430cbd){_0x72f85e=_0x72f85e-0x0;var _0x2a25d6=_0xa380[_0x72f85e];return _0x2a25d6;};'use strict';var multer=require(_0x0a38('0x0'));var util=require(_0x0a38('0x1'));var path=require(_0x0a38('0x2'));var timeout=require(_0x0a38('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a38('0x4'));var interaction=require(_0x0a38('0x5'));var config=require(_0x0a38('0x6'));var controller=require(_0x0a38('0x7'));router[_0x0a38('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a38('0x9')]);router[_0x0a38('0x8')](_0x0a38('0xa'),auth[_0x0a38('0xb')](),controller['show']);router['get'](_0x0a38('0xc'),auth[_0x0a38('0xb')](),controller[_0x0a38('0xd')]);router[_0x0a38('0x8')](_0x0a38('0xe'),auth[_0x0a38('0xb')](),controller[_0x0a38('0xf')]);router['get'](_0x0a38('0x10'),auth[_0x0a38('0xb')](),controller[_0x0a38('0x11')]);router[_0x0a38('0x12')]('/',auth[_0x0a38('0xb')](),controller['create']);router['put']('/:id',auth[_0x0a38('0xb')](),controller[_0x0a38('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a38('0x14')]);module[_0x0a38('0x15')]=router; \ No newline at end of file +var _0x3940=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','/:id/query','query','post','create','update','delete','destroy','multer','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3940,0x91));var _0x0394=function(_0x441021,_0x145aab){_0x441021=_0x441021-0x0;var _0x1d9704=_0x3940[_0x441021];return _0x1d9704;};'use strict';var multer=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var path=require(_0x0394('0x2'));var timeout=require(_0x0394('0x3'));var express=require('express');var router=express[_0x0394('0x4')]();var fs_extra=require(_0x0394('0x5'));var auth=require(_0x0394('0x6'));var interaction=require(_0x0394('0x7'));var config=require('../../config/environment');var controller=require(_0x0394('0x8'));router[_0x0394('0x9')]('/',auth[_0x0394('0xa')](),controller[_0x0394('0xb')]);router['get'](_0x0394('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0394('0xd'),auth[_0x0394('0xa')](),controller['preview']);router['get']('/:id/run',auth[_0x0394('0xa')](),controller['run']);router[_0x0394('0x9')](_0x0394('0xe'),auth[_0x0394('0xa')](),controller[_0x0394('0xf')]);router[_0x0394('0x10')]('/',auth[_0x0394('0xa')](),controller[_0x0394('0x11')]);router['put'](_0x0394('0xc'),auth['isAuthenticated'](),controller[_0x0394('0x12')]);router[_0x0394('0x13')]('/:id',auth[_0x0394('0xa')](),controller[_0x0394('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index d9e7ed7..89c87a1 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 _0x7eb2=['ENUM','csv','pdf','xlsx','DATE','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x4d1ba8,_0x565258){var _0x568e3d=function(_0x386f5a){while(--_0x386f5a){_0x4d1ba8['push'](_0x4d1ba8['shift']());}};_0x568e3d(++_0x565258);}(_0x7eb2,0x164));var _0x27eb=function(_0x3034db,_0x572a9a){_0x3034db=_0x3034db-0x0;var _0x360f1f=_0x7eb2[_0x3034db];return _0x360f1f;};'use strict';var Sequelize=require(_0x27eb('0x0'));var moment=require(_0x27eb('0x1'));module[_0x27eb('0x2')]={'name':{'type':Sequelize[_0x27eb('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x27eb('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x27eb('0x4')](_0x27eb('0x5'),_0x27eb('0x6'),_0x27eb('0x7')),'allowNull':![],'defaultValue':_0x27eb('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x27eb('0x8')]},'endDate':{'type':Sequelize[_0x27eb('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x27eb('0x4')](_0x27eb('0x9'),_0x27eb('0xa')),'allowNull':![],'defaultValue':_0x27eb('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x27eb('0xb')]},'reportType':{'type':Sequelize[_0x27eb('0x3')]}}; \ No newline at end of file +var _0x734b=['moment','STRING','ENUM','csv','pdf','xlsx','DATE','manual','INTEGER','UNSIGNED','sequelize'];(function(_0x7c2035,_0x13334){var _0x50f5c1=function(_0x20a9b4){while(--_0x20a9b4){_0x7c2035['push'](_0x7c2035['shift']());}};_0x50f5c1(++_0x13334);}(_0x734b,0xfc));var _0xb734=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x734b[_0x2064e5];return _0x21a233;};'use strict';var Sequelize=require(_0xb734('0x0'));var moment=require(_0xb734('0x1'));module['exports']={'name':{'type':Sequelize[_0xb734('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xb734('0x3')](_0xb734('0x4'),_0xb734('0x5'),_0xb734('0x6')),'allowNull':![],'defaultValue':_0xb734('0x4')},'savename':{'type':Sequelize[_0xb734('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb734('0x7')]},'endDate':{'type':Sequelize[_0xb734('0x7')]},'status':{'type':Sequelize[_0xb734('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xb734('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xb734('0x8')},'reportId':{'type':Sequelize[_0xb734('0x9')](0xb)[_0xb734('0xa')]},'reportType':{'type':Sequelize[_0xb734('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 83c7f9c..3f7a964 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 _0x9eed=['catch','show','params','keys','include','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','output','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','get','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows'];(function(_0x3b9f8d,_0xf55310){var _0xd03021=function(_0xef88b4){while(--_0xef88b4){_0x3b9f8d['push'](_0x3b9f8d['shift']());}};_0xd03021(++_0xf55310);}(_0x9eed,0x19c));var _0xd9ee=function(_0x3ee645,_0xbcd3a7){_0x3ee645=_0x3ee645-0x0;var _0x34ebfc=_0x9eed[_0x3ee645];return _0x34ebfc;};'use strict';var emlformat=require(_0xd9ee('0x0'));var rimraf=require(_0xd9ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9ee('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd9ee('0x3'));var util=require('util');var path=require(_0xd9ee('0x4'));var sox=require('sox');var csv=require(_0xd9ee('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9ee('0x6'));var _=require(_0xd9ee('0x7'));var squel=require(_0xd9ee('0x8'));var crypto=require(_0xd9ee('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd9ee('0x5'));var querystring=require(_0xd9ee('0xa'));var Papa=require('papaparse');var Redis=require(_0xd9ee('0xb'));var authService=require(_0xd9ee('0xc'));var qs=require(_0xd9ee('0xd'));var as=require(_0xd9ee('0xe'));var hardwareService=require(_0xd9ee('0xf'));var logger=require(_0xd9ee('0x10'))(_0xd9ee('0x11'));var utils=require(_0xd9ee('0x12'));var config=require(_0xd9ee('0x13'));var licenseUtil=require(_0xd9ee('0x14'));var db=require(_0xd9ee('0x15'))['db'];function respondWithStatusCode(_0x770686,_0x1a24a6){_0x1a24a6=_0x1a24a6||0xcc;return function(_0x57ddd7){if(_0x57ddd7){return _0x770686['sendStatus'](_0x1a24a6);}return _0x770686['status'](_0x1a24a6)[_0xd9ee('0x16')]();};}function respondWithResult(_0x3751fb,_0x4d943f){_0x4d943f=_0x4d943f||0xc8;return function(_0x2efa3d){if(_0x2efa3d){return _0x3751fb['status'](_0x4d943f)['json'](_0x2efa3d);}};}function respondWithFilteredResult(_0x3e436d,_0x1470c2){return function(_0x1ab40b){if(_0x1ab40b){var _0x42668d=typeof _0x1470c2[_0xd9ee('0x17')]==='undefined'&&typeof _0x1470c2[_0xd9ee('0x18')]===_0xd9ee('0x19');var _0x2aff6c=_0x1ab40b[_0xd9ee('0x1a')];var _0x23692f=_0x42668d?0x0:_0x1470c2[_0xd9ee('0x17')];var _0x1f8738=_0x42668d?_0x1ab40b[_0xd9ee('0x1a')]:_0x1470c2[_0xd9ee('0x17')]+_0x1470c2[_0xd9ee('0x18')];var _0x5be913;if(_0x1f8738>=_0x2aff6c){_0x1f8738=_0x2aff6c;_0x5be913=0xc8;}else{_0x5be913=0xce;}_0x3e436d[_0xd9ee('0x1b')](_0x5be913);return _0x3e436d[_0xd9ee('0x1c')](_0xd9ee('0x1d'),_0x23692f+'-'+_0x1f8738+'/'+_0x2aff6c)['json'](_0x1ab40b);}return null;};}function patchUpdates(_0x1af8fb){return function(_0x149aa8){try{jsonpatch[_0xd9ee('0x1e')](_0x149aa8,_0x1af8fb,!![]);}catch(_0x529791){return BPromise[_0xd9ee('0x1f')](_0x529791);}return _0x149aa8[_0xd9ee('0x20')]();};}function saveUpdates(_0x2da4a2,_0x3d9d08){return function(_0x371fa8){if(_0x371fa8){return _0x371fa8['update'](_0x2da4a2)['then'](function(_0x4c98e8){return _0x4c98e8;});}return null;};}function removeEntity(_0x154b83,_0x315d1d){return function(_0xe5e175){if(_0xe5e175){return _0xe5e175['destroy']()[_0xd9ee('0x21')](function(){var _0x357b5f=_0xe5e175[_0xd9ee('0x22')]({'plain':!![]});var _0x4eda93=_0xd9ee('0x23');return db[_0xd9ee('0x24')][_0xd9ee('0x25')]({'where':{'type':_0x4eda93,'resourceId':_0x357b5f['id']}})[_0xd9ee('0x21')](function(){return _0xe5e175;});})['then'](function(){_0x154b83[_0xd9ee('0x1b')](0xcc)[_0xd9ee('0x16')]();});}};}function handleEntityNotFound(_0x41a7b5,_0x568fa1){return function(_0x5d6143){if(!_0x5d6143){_0x41a7b5[_0xd9ee('0x26')](0x194);}return _0x5d6143;};}function handleError(_0x29f1d7,_0x49c9a0){_0x49c9a0=_0x49c9a0||0x1f4;return function(_0x35c38c){logger[_0xd9ee('0x27')](_0x35c38c[_0xd9ee('0x28')]);if(_0x35c38c[_0xd9ee('0x29')]){delete _0x35c38c['name'];}_0x29f1d7[_0xd9ee('0x1b')](_0x49c9a0)[_0xd9ee('0x2a')](_0x35c38c);};}exports[_0xd9ee('0x2b')]=function(_0x20fbf6,_0xa5f247){var _0x5be78a={},_0xba529={},_0x299223={'count':0x0,'rows':[]};var _0x3ee533=_[_0xd9ee('0x2c')](db[_0xd9ee('0x2d')][_0xd9ee('0x2e')],function(_0x54bc08){return{'name':_0x54bc08[_0xd9ee('0x2f')],'type':_0x54bc08[_0xd9ee('0x30')][_0xd9ee('0x31')]};});_0xba529['model']=_[_0xd9ee('0x2c')](_0x3ee533,_0xd9ee('0x29'));_0xba529[_0xd9ee('0x32')]=_['keys'](_0x20fbf6[_0xd9ee('0x32')]);_0xba529['filters']=_['intersection'](_0xba529['model'],_0xba529[_0xd9ee('0x32')]);_0x5be78a[_0xd9ee('0x33')]=_[_0xd9ee('0x34')](_0xba529[_0xd9ee('0x35')],qs[_0xd9ee('0x36')](_0x20fbf6['query'][_0xd9ee('0x36')]));_0x5be78a[_0xd9ee('0x33')]=_0x5be78a[_0xd9ee('0x33')][_0xd9ee('0x37')]?_0x5be78a[_0xd9ee('0x33')]:_0xba529[_0xd9ee('0x35')];if(!_0x20fbf6[_0xd9ee('0x32')][_0xd9ee('0x38')](_0xd9ee('0x39'))){_0x5be78a[_0xd9ee('0x18')]=qs[_0xd9ee('0x18')](_0x20fbf6['query'][_0xd9ee('0x18')]);_0x5be78a[_0xd9ee('0x17')]=qs[_0xd9ee('0x17')](_0x20fbf6[_0xd9ee('0x32')][_0xd9ee('0x17')]);}_0x5be78a['order']=qs[_0xd9ee('0x3a')](_0x20fbf6['query'][_0xd9ee('0x3a')]);_0x5be78a[_0xd9ee('0x3b')]=qs[_0xd9ee('0x3c')](_[_0xd9ee('0x3d')](_0x20fbf6['query'],_0xba529[_0xd9ee('0x3c')]),_0x3ee533);if(_0x20fbf6[_0xd9ee('0x32')][_0xd9ee('0x3e')]){_0x5be78a[_0xd9ee('0x3b')]=_['merge'](_0x5be78a[_0xd9ee('0x3b')],{'$or':_[_0xd9ee('0x2c')](_0x3ee533,function(_0x384d0){if(_0x384d0[_0xd9ee('0x30')]!=='VIRTUAL'){var _0x5c305c={};_0x5c305c[_0x384d0['name']]={'$like':'%'+_0x20fbf6[_0xd9ee('0x32')]['filter']+'%'};return _0x5c305c;}})});}_0x5be78a=_[_0xd9ee('0x3f')]({},_0x5be78a,_0x20fbf6[_0xd9ee('0x40')]);var _0x16cead={'where':_0x5be78a[_0xd9ee('0x3b')]};return db[_0xd9ee('0x2d')][_0xd9ee('0x1a')](_0x16cead)['then'](function(_0x46405c){_0x299223[_0xd9ee('0x1a')]=_0x46405c;if(_0x20fbf6['query'][_0xd9ee('0x41')]){_0x5be78a['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd9ee('0x42')](_0x5be78a);})[_0xd9ee('0x21')](function(_0x12edd7){_0x299223[_0xd9ee('0x43')]=_0x12edd7;return _0x299223;})['then'](respondWithFilteredResult(_0xa5f247,_0x5be78a))[_0xd9ee('0x44')](handleError(_0xa5f247,null));};exports[_0xd9ee('0x45')]=function(_0x26f44f,_0x296d6d){var _0x5bef2c={'raw':!![],'where':{'id':_0x26f44f[_0xd9ee('0x46')]['id']}},_0x5009a5={};_0x5009a5[_0xd9ee('0x35')]=_[_0xd9ee('0x47')](db[_0xd9ee('0x2d')][_0xd9ee('0x2e')]);_0x5009a5[_0xd9ee('0x32')]=_[_0xd9ee('0x47')](_0x26f44f['query']);_0x5009a5[_0xd9ee('0x3c')]=_[_0xd9ee('0x34')](_0x5009a5['model'],_0x5009a5[_0xd9ee('0x32')]);_0x5bef2c[_0xd9ee('0x33')]=_[_0xd9ee('0x34')](_0x5009a5['model'],qs[_0xd9ee('0x36')](_0x26f44f['query'][_0xd9ee('0x36')]));_0x5bef2c[_0xd9ee('0x33')]=_0x5bef2c[_0xd9ee('0x33')]['length']?_0x5bef2c[_0xd9ee('0x33')]:_0x5009a5[_0xd9ee('0x35')];if(_0x26f44f[_0xd9ee('0x32')][_0xd9ee('0x41')]){_0x5bef2c[_0xd9ee('0x48')]=[{'all':!![]}];}_0x5bef2c=_[_0xd9ee('0x3f')]({},_0x5bef2c,_0x26f44f[_0xd9ee('0x40')]);return db['AnalyticExtractedReport']['find'](_0x5bef2c)[_0xd9ee('0x21')](handleEntityNotFound(_0x296d6d,null))['then'](respondWithResult(_0x296d6d,null))[_0xd9ee('0x44')](handleError(_0x296d6d,null));};exports['create']=function(_0x3a2df2,_0x2e0f78){return db[_0xd9ee('0x2d')][_0xd9ee('0x49')](_0x3a2df2[_0xd9ee('0x4a')],{})[_0xd9ee('0x21')](function(_0x282aa9){var _0x3f5cd5=_0x3a2df2['user']['get']({'plain':!![]});if(!_0x3f5cd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f5cd5[_0xd9ee('0x4b')]===_0xd9ee('0x4c')){var _0x503167=_0x282aa9[_0xd9ee('0x22')]({'plain':!![]});var _0x333edc=_0xd9ee('0x23');return db[_0xd9ee('0x4d')][_0xd9ee('0x4e')]({'where':{'name':_0x333edc,'userProfileId':_0x3f5cd5[_0xd9ee('0x4f')]},'raw':!![]})['then'](function(_0x10f6a5){if(_0x10f6a5&&_0x10f6a5[_0xd9ee('0x50')]===0x0){return db[_0xd9ee('0x24')][_0xd9ee('0x49')]({'name':_0x503167['name'],'resourceId':_0x503167['id'],'type':_0x10f6a5['name'],'sectionId':_0x10f6a5['id']},{})[_0xd9ee('0x21')](function(){return _0x282aa9;});}else{return _0x282aa9;}})['catch'](function(_0x41ad7c){logger[_0xd9ee('0x27')](_0xd9ee('0x51'),_0x41ad7c);throw _0x41ad7c;});}return _0x282aa9;})[_0xd9ee('0x21')](respondWithResult(_0x2e0f78,0xc9))[_0xd9ee('0x44')](handleError(_0x2e0f78,null));};exports[_0xd9ee('0x52')]=function(_0x2e8ae3,_0x1c863a){if(_0x2e8ae3['body']['id']){delete _0x2e8ae3['body']['id'];}return db[_0xd9ee('0x2d')][_0xd9ee('0x4e')]({'where':{'id':_0x2e8ae3[_0xd9ee('0x46')]['id']}})[_0xd9ee('0x21')](handleEntityNotFound(_0x1c863a,null))['then'](saveUpdates(_0x2e8ae3[_0xd9ee('0x4a')],null))[_0xd9ee('0x21')](respondWithResult(_0x1c863a,null))['catch'](handleError(_0x1c863a,null));};exports[_0xd9ee('0x25')]=function(_0x587c19,_0x4150f3){return db['AnalyticExtractedReport'][_0xd9ee('0x4e')]({'where':{'id':_0x587c19[_0xd9ee('0x46')]['id']}})[_0xd9ee('0x21')](handleEntityNotFound(_0x4150f3,null))[_0xd9ee('0x21')](removeEntity(_0x4150f3,null))[_0xd9ee('0x44')](handleError(_0x4150f3,null));};exports[_0xd9ee('0x53')]=function(_0x5a9e6a,_0x1426aa,_0x3c28cc){return db[_0xd9ee('0x2d')]['find']({'where':{'id':_0x5a9e6a['params']['id']},'attributes':['name',_0xd9ee('0x54'),'savename',_0xd9ee('0x55')],'raw':!![]})[_0xd9ee('0x21')](handleEntityNotFound(_0x1426aa,null))[_0xd9ee('0x21')](function(_0x75705f){if(_0x75705f){if(!fs['existsSync'](path[_0xd9ee('0x56')](config[_0xd9ee('0x57')],_0xd9ee('0x58'),_0x75705f[_0xd9ee('0x59')]))){throw new db[(_0xd9ee('0x5a'))]['ValidationError'](_0xd9ee('0x5b'));}if(_0x5a9e6a[_0xd9ee('0x32')][_0xd9ee('0x5c')]){return _0x1426aa[_0xd9ee('0x26')](0xc8);}return _0x1426aa[_0xd9ee('0x53')](path['join'](config[_0xd9ee('0x57')],_0xd9ee('0x58'),_0x75705f[_0xd9ee('0x59')]),util[_0xd9ee('0x5d')](_0xd9ee('0x5e'),_0x75705f[_0xd9ee('0x54')]||_0x75705f[_0xd9ee('0x29')],_0x75705f[_0xd9ee('0x55')][_0xd9ee('0x5f')]()));}})[_0xd9ee('0x44')](handleError(_0x1426aa,null));}; \ No newline at end of file +var _0xc39b=['ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','get','ExtractedReports','UserProfileResource','then','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','AnalyticExtractedReport','findAll','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','download','basename','savename','output','root','server/files/reports'];(function(_0x1c2744,_0x1c0562){var _0x338c56=function(_0x143f1f){while(--_0x143f1f){_0x1c2744['push'](_0x1c2744['shift']());}};_0x338c56(++_0x1c0562);}(_0xc39b,0x119));var _0xbc39=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc39b[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xbc39('0x0'));var rimraf=require(_0xbc39('0x1'));var zipdir=require(_0xbc39('0x2'));var jsonpatch=require(_0xbc39('0x3'));var rp=require(_0xbc39('0x4'));var moment=require(_0xbc39('0x5'));var BPromise=require(_0xbc39('0x6'));var Mustache=require('mustache');var util=require(_0xbc39('0x7'));var path=require('path');var sox=require(_0xbc39('0x8'));var csv=require(_0xbc39('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(_0xbc39('0xa'));var jsforce=require(_0xbc39('0xb'));var deskjs=require(_0xbc39('0xc'));var toCsv=require(_0xbc39('0x9'));var querystring=require(_0xbc39('0xd'));var Papa=require('papaparse');var Redis=require(_0xbc39('0xe'));var authService=require(_0xbc39('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc39('0x10'));var logger=require(_0xbc39('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xbc39('0x12'));var licenseUtil=require(_0xbc39('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412cb6,_0x253b28){_0x253b28=_0x253b28||0xcc;return function(_0x50d01d){if(_0x50d01d){return _0x412cb6[_0xbc39('0x14')](_0x253b28);}return _0x412cb6[_0xbc39('0x15')](_0x253b28)[_0xbc39('0x16')]();};}function respondWithResult(_0xf51596,_0x11dfc6){_0x11dfc6=_0x11dfc6||0xc8;return function(_0x57e30c){if(_0x57e30c){return _0xf51596[_0xbc39('0x15')](_0x11dfc6)['json'](_0x57e30c);}};}function respondWithFilteredResult(_0x4fe978,_0x43e3fa){return function(_0x57cefd){if(_0x57cefd){var _0x4b66ed=typeof _0x43e3fa[_0xbc39('0x17')]==='undefined'&&typeof _0x43e3fa[_0xbc39('0x18')]===_0xbc39('0x19');var _0x4dccb1=_0x57cefd[_0xbc39('0x1a')];var _0x4e3fb4=_0x4b66ed?0x0:_0x43e3fa[_0xbc39('0x17')];var _0x27b893=_0x4b66ed?_0x57cefd[_0xbc39('0x1a')]:_0x43e3fa[_0xbc39('0x17')]+_0x43e3fa[_0xbc39('0x18')];var _0x2a6d63;if(_0x27b893>=_0x4dccb1){_0x27b893=_0x4dccb1;_0x2a6d63=0xc8;}else{_0x2a6d63=0xce;}_0x4fe978[_0xbc39('0x15')](_0x2a6d63);return _0x4fe978[_0xbc39('0x1b')](_0xbc39('0x1c'),_0x4e3fb4+'-'+_0x27b893+'/'+_0x4dccb1)['json'](_0x57cefd);}return null;};}function patchUpdates(_0x4bf0c3){return function(_0x1af460){try{jsonpatch[_0xbc39('0x1d')](_0x1af460,_0x4bf0c3,!![]);}catch(_0x27af66){return BPromise[_0xbc39('0x1e')](_0x27af66);}return _0x1af460[_0xbc39('0x1f')]();};}function saveUpdates(_0x3e7076,_0x340f4d){return function(_0x12b077){if(_0x12b077){return _0x12b077['update'](_0x3e7076)['then'](function(_0xc147a7){return _0xc147a7;});}return null;};}function removeEntity(_0x50b81f,_0x416095){return function(_0x312ab8){if(_0x312ab8){return _0x312ab8[_0xbc39('0x20')]()['then'](function(){var _0x237bc0=_0x312ab8[_0xbc39('0x21')]({'plain':!![]});var _0xb0802d=_0xbc39('0x22');return db[_0xbc39('0x23')][_0xbc39('0x20')]({'where':{'type':_0xb0802d,'resourceId':_0x237bc0['id']}})[_0xbc39('0x24')](function(){return _0x312ab8;});})[_0xbc39('0x24')](function(){_0x50b81f[_0xbc39('0x15')](0xcc)[_0xbc39('0x16')]();});}};}function handleEntityNotFound(_0x8e2ace,_0x153577){return function(_0x432a69){if(!_0x432a69){_0x8e2ace['sendStatus'](0x194);}return _0x432a69;};}function handleError(_0x23627f,_0x172545){_0x172545=_0x172545||0x1f4;return function(_0x4b12df){logger[_0xbc39('0x25')](_0x4b12df[_0xbc39('0x26')]);if(_0x4b12df[_0xbc39('0x27')]){delete _0x4b12df[_0xbc39('0x27')];}_0x23627f[_0xbc39('0x15')](_0x172545)[_0xbc39('0x28')](_0x4b12df);};}exports[_0xbc39('0x29')]=function(_0x47ec8e,_0xec66cc){var _0x2c890c={},_0x3e22a4={},_0x50c7c8={'count':0x0,'rows':[]};var _0x422343=_[_0xbc39('0x2a')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x2f738a){return{'name':_0x2f738a[_0xbc39('0x2b')],'type':_0x2f738a[_0xbc39('0x2c')][_0xbc39('0x2d')]};});_0x3e22a4[_0xbc39('0x2e')]=_[_0xbc39('0x2a')](_0x422343,'name');_0x3e22a4[_0xbc39('0x2f')]=_[_0xbc39('0x30')](_0x47ec8e['query']);_0x3e22a4['filters']=_[_0xbc39('0x31')](_0x3e22a4['model'],_0x3e22a4[_0xbc39('0x2f')]);_0x2c890c[_0xbc39('0x32')]=_['intersection'](_0x3e22a4['model'],qs[_0xbc39('0x33')](_0x47ec8e[_0xbc39('0x2f')][_0xbc39('0x33')]));_0x2c890c[_0xbc39('0x32')]=_0x2c890c['attributes'][_0xbc39('0x34')]?_0x2c890c['attributes']:_0x3e22a4[_0xbc39('0x2e')];if(!_0x47ec8e['query'][_0xbc39('0x35')](_0xbc39('0x36'))){_0x2c890c[_0xbc39('0x18')]=qs[_0xbc39('0x18')](_0x47ec8e['query'][_0xbc39('0x18')]);_0x2c890c['offset']=qs[_0xbc39('0x17')](_0x47ec8e[_0xbc39('0x2f')][_0xbc39('0x17')]);}_0x2c890c[_0xbc39('0x37')]=qs[_0xbc39('0x38')](_0x47ec8e['query'][_0xbc39('0x38')]);_0x2c890c[_0xbc39('0x39')]=qs['filters'](_[_0xbc39('0x3a')](_0x47ec8e[_0xbc39('0x2f')],_0x3e22a4[_0xbc39('0x3b')]),_0x422343);if(_0x47ec8e['query'][_0xbc39('0x3c')]){_0x2c890c[_0xbc39('0x39')]=_[_0xbc39('0x3d')](_0x2c890c[_0xbc39('0x39')],{'$or':_[_0xbc39('0x2a')](_0x422343,function(_0x2eea11){if(_0x2eea11[_0xbc39('0x2c')]!==_0xbc39('0x3e')){var _0x1a356a={};_0x1a356a[_0x2eea11[_0xbc39('0x27')]]={'$like':'%'+_0x47ec8e[_0xbc39('0x2f')][_0xbc39('0x3c')]+'%'};return _0x1a356a;}})});}_0x2c890c=_[_0xbc39('0x3d')]({},_0x2c890c,_0x47ec8e[_0xbc39('0x3f')]);var _0x458d35={'where':_0x2c890c[_0xbc39('0x39')]};return db['AnalyticExtractedReport']['count'](_0x458d35)[_0xbc39('0x24')](function(_0x3c8d21){_0x50c7c8[_0xbc39('0x1a')]=_0x3c8d21;if(_0x47ec8e[_0xbc39('0x2f')][_0xbc39('0x40')]){_0x2c890c[_0xbc39('0x41')]=[{'all':!![]}];}return db[_0xbc39('0x42')][_0xbc39('0x43')](_0x2c890c);})[_0xbc39('0x24')](function(_0xbb578b){_0x50c7c8['rows']=_0xbb578b;return _0x50c7c8;})[_0xbc39('0x24')](respondWithFilteredResult(_0xec66cc,_0x2c890c))['catch'](handleError(_0xec66cc,null));};exports[_0xbc39('0x44')]=function(_0x282cf9,_0x3b6195){var _0xde8852={'raw':!![],'where':{'id':_0x282cf9[_0xbc39('0x45')]['id']}},_0x5e6fc9={};_0x5e6fc9[_0xbc39('0x2e')]=_[_0xbc39('0x30')](db[_0xbc39('0x42')]['rawAttributes']);_0x5e6fc9['query']=_['keys'](_0x282cf9[_0xbc39('0x2f')]);_0x5e6fc9[_0xbc39('0x3b')]=_[_0xbc39('0x31')](_0x5e6fc9[_0xbc39('0x2e')],_0x5e6fc9['query']);_0xde8852[_0xbc39('0x32')]=_['intersection'](_0x5e6fc9['model'],qs['fields'](_0x282cf9[_0xbc39('0x2f')][_0xbc39('0x33')]));_0xde8852[_0xbc39('0x32')]=_0xde8852[_0xbc39('0x32')][_0xbc39('0x34')]?_0xde8852[_0xbc39('0x32')]:_0x5e6fc9[_0xbc39('0x2e')];if(_0x282cf9['query'][_0xbc39('0x40')]){_0xde8852[_0xbc39('0x41')]=[{'all':!![]}];}_0xde8852=_[_0xbc39('0x3d')]({},_0xde8852,_0x282cf9[_0xbc39('0x3f')]);return db['AnalyticExtractedReport'][_0xbc39('0x46')](_0xde8852)[_0xbc39('0x24')](handleEntityNotFound(_0x3b6195,null))['then'](respondWithResult(_0x3b6195,null))['catch'](handleError(_0x3b6195,null));};exports['create']=function(_0x136ccf,_0x366ecf){return db[_0xbc39('0x42')][_0xbc39('0x47')](_0x136ccf['body'],{})[_0xbc39('0x24')](function(_0x2c5378){var _0x580a76=_0x136ccf[_0xbc39('0x48')]['get']({'plain':!![]});if(!_0x580a76)throw new Error(_0xbc39('0x49'));if(_0x580a76[_0xbc39('0x4a')]==='user'){var _0x178125=_0x2c5378[_0xbc39('0x21')]({'plain':!![]});var _0x20c92c=_0xbc39('0x22');return db[_0xbc39('0x4b')][_0xbc39('0x46')]({'where':{'name':_0x20c92c,'userProfileId':_0x580a76[_0xbc39('0x4c')]},'raw':!![]})['then'](function(_0x560de7){if(_0x560de7&&_0x560de7['autoAssociation']===0x0){return db[_0xbc39('0x23')][_0xbc39('0x47')]({'name':_0x178125['name'],'resourceId':_0x178125['id'],'type':_0x560de7[_0xbc39('0x27')],'sectionId':_0x560de7['id']},{})[_0xbc39('0x24')](function(){return _0x2c5378;});}else{return _0x2c5378;}})[_0xbc39('0x4d')](function(_0xc8ee94){logger[_0xbc39('0x25')](_0xbc39('0x4e'),_0xc8ee94);throw _0xc8ee94;});}return _0x2c5378;})[_0xbc39('0x24')](respondWithResult(_0x366ecf,0xc9))['catch'](handleError(_0x366ecf,null));};exports[_0xbc39('0x4f')]=function(_0xbec85b,_0x5389e3){if(_0xbec85b[_0xbc39('0x50')]['id']){delete _0xbec85b[_0xbc39('0x50')]['id'];}return db[_0xbc39('0x42')][_0xbc39('0x46')]({'where':{'id':_0xbec85b[_0xbc39('0x45')]['id']}})[_0xbc39('0x24')](handleEntityNotFound(_0x5389e3,null))[_0xbc39('0x24')](saveUpdates(_0xbec85b[_0xbc39('0x50')],null))[_0xbc39('0x24')](respondWithResult(_0x5389e3,null))[_0xbc39('0x4d')](handleError(_0x5389e3,null));};exports[_0xbc39('0x20')]=function(_0x3ceed6,_0x17b320){return db[_0xbc39('0x42')][_0xbc39('0x46')]({'where':{'id':_0x3ceed6[_0xbc39('0x45')]['id']}})['then'](handleEntityNotFound(_0x17b320,null))['then'](removeEntity(_0x17b320,null))[_0xbc39('0x4d')](handleError(_0x17b320,null));};exports[_0xbc39('0x51')]=function(_0x5d9e36,_0x4ea8cf,_0x22a3af){return db[_0xbc39('0x42')]['find']({'where':{'id':_0x5d9e36[_0xbc39('0x45')]['id']},'attributes':[_0xbc39('0x27'),_0xbc39('0x52'),_0xbc39('0x53'),_0xbc39('0x54')],'raw':!![]})[_0xbc39('0x24')](handleEntityNotFound(_0x4ea8cf,null))[_0xbc39('0x24')](function(_0x5706ef){if(_0x5706ef){if(!fs['existsSync'](path['join'](config[_0xbc39('0x55')],_0xbc39('0x56'),_0x5706ef['savename']))){throw new db['Sequelize'][(_0xbc39('0x57'))](_0xbc39('0x58'));}if(_0x5d9e36[_0xbc39('0x2f')][_0xbc39('0x59')]){return _0x4ea8cf[_0xbc39('0x14')](0xc8);}return _0x4ea8cf[_0xbc39('0x51')](path[_0xbc39('0x5a')](config[_0xbc39('0x55')],_0xbc39('0x56'),_0x5706ef[_0xbc39('0x53')]),util['format']('%s.%s',_0x5706ef[_0xbc39('0x52')]||_0x5706ef[_0xbc39('0x27')],_0x5706ef[_0xbc39('0x54')][_0xbc39('0x5b')]()));}})[_0xbc39('0x4d')](handleError(_0x4ea8cf,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 265957e..d88bc2d 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 _0x82a8=['request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird'];(function(_0x37a255,_0x2f43d3){var _0x1a02f5=function(_0x37d213){while(--_0x37d213){_0x37a255['push'](_0x37a255['shift']());}};_0x1a02f5(++_0x2f43d3);}(_0x82a8,0x19f));var _0x882a=function(_0x141283,_0x157975){_0x141283=_0x141283-0x0;var _0x530dc9=_0x82a8[_0x141283];return _0x530dc9;};'use strict';var _=require(_0x882a('0x0'));var util=require(_0x882a('0x1'));var logger=require(_0x882a('0x2'))('api');var moment=require(_0x882a('0x3'));var BPromise=require(_0x882a('0x4'));var rp=require(_0x882a('0x5'));var fs=require('fs');var path=require(_0x882a('0x6'));var rimraf=require(_0x882a('0x7'));var config=require(_0x882a('0x8'));var attributes=require(_0x882a('0x9'));module['exports']=function(_0x541982,_0x9e6500){return _0x541982[_0x882a('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0x882a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf36c=['AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports'];(function(_0x403115,_0x2d6d03){var _0x596ef3=function(_0x145d97){while(--_0x145d97){_0x403115['push'](_0x403115['shift']());}};_0x596ef3(++_0x2d6d03);}(_0xf36c,0xe8));var _0xcf36=function(_0x4f5e0a,_0x4a4263){_0x4f5e0a=_0x4f5e0a-0x0;var _0x48ff22=_0xf36c[_0x4f5e0a];return _0x48ff22;};'use strict';var _=require(_0xcf36('0x0'));var util=require(_0xcf36('0x1'));var logger=require(_0xcf36('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcf36('0x3'));var fs=require('fs');var path=require(_0xcf36('0x4'));var rimraf=require(_0xcf36('0x5'));var config=require('../../config/environment');var attributes=require(_0xcf36('0x6'));module[_0xcf36('0x7')]=function(_0x366cfe,_0x46f79c){return _0x366cfe['define'](_0xcf36('0x8'),attributes,{'tableName':_0xcf36('0x9'),'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 21c0672..4eec7f2 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 _0xf6bc=['jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x20956b,_0x5f54dc){var _0x4a7b0b=function(_0x1bf260){while(--_0x1bf260){_0x20956b['push'](_0x20956b['shift']());}};_0x4a7b0b(++_0x5f54dc);}(_0xf6bc,0x188));var _0xcf6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcf6b('0x0'));var moment=require(_0xcf6b('0x1'));var BPromise=require(_0xcf6b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf6b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf6b('0x4'));var logger=require(_0xcf6b('0x5'))('rpc');var config=require(_0xcf6b('0x6'));var jayson=require(_0xcf6b('0x7'));var client=jayson[_0xcf6b('0x8')][_0xcf6b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53dfef,_0x4e38d9,_0x140dc0){return new BPromise(function(_0x27c14c,_0x1ecb83){return client[_0xcf6b('0xa')](_0x53dfef,_0x140dc0)[_0xcf6b('0xb')](function(_0x2504b1){logger[_0xcf6b('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4e38d9,_0xcf6b('0xd'));logger[_0xcf6b('0xe')](_0xcf6b('0xf'),_0x4e38d9,_0xcf6b('0xd'),JSON[_0xcf6b('0x10')](_0x2504b1));if(_0x2504b1[_0xcf6b('0x11')]){if(_0x2504b1[_0xcf6b('0x11')]['code']===0x1f4){logger[_0xcf6b('0x11')](_0xcf6b('0x12'),_0x4e38d9,_0x2504b1['error'][_0xcf6b('0x13')]);return _0x1ecb83(_0x2504b1['error'][_0xcf6b('0x13')]);}logger[_0xcf6b('0x11')](_0xcf6b('0x12'),_0x4e38d9,_0x2504b1[_0xcf6b('0x11')]['message']);return _0x27c14c(_0x2504b1['error'][_0xcf6b('0x13')]);}else{logger['info'](_0xcf6b('0x12'),_0x4e38d9,_0xcf6b('0xd'));_0x27c14c(_0x2504b1[_0xcf6b('0x14')][_0xcf6b('0x13')]);}})['catch'](function(_0x3f3f23){logger[_0xcf6b('0x11')](_0xcf6b('0x12'),_0x4e38d9,_0x3f3f23);_0x1ecb83(_0x3f3f23);});});} \ No newline at end of file +var _0xc8ed=['stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc8ed,0x1a4));var _0xdc8e=function(_0x5f3a11,_0x5e443d){_0x5f3a11=_0x5f3a11-0x0;var _0x5cdf18=_0xc8ed[_0x5f3a11];return _0x5cdf18;};'use strict';var _=require(_0xdc8e('0x0'));var util=require(_0xdc8e('0x1'));var moment=require(_0xdc8e('0x2'));var BPromise=require(_0xdc8e('0x3'));var rs=require(_0xdc8e('0x4'));var fs=require('fs');var Redis=require(_0xdc8e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc8e('0x6'));var logger=require(_0xdc8e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc8e('0x8'));var client=jayson[_0xdc8e('0x9')][_0xdc8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x387dff,_0xcd991,_0x41292a){return new BPromise(function(_0x1b9642,_0x108cc4){return client[_0xdc8e('0xb')](_0x387dff,_0x41292a)[_0xdc8e('0xc')](function(_0x2268cf){logger[_0xdc8e('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xcd991,_0xdc8e('0xe'));logger[_0xdc8e('0xf')](_0xdc8e('0x10'),_0xcd991,_0xdc8e('0xe'),JSON[_0xdc8e('0x11')](_0x2268cf));if(_0x2268cf[_0xdc8e('0x12')]){if(_0x2268cf[_0xdc8e('0x12')]['code']===0x1f4){logger[_0xdc8e('0x12')](_0xdc8e('0x13'),_0xcd991,_0x2268cf['error']['message']);return _0x108cc4(_0x2268cf[_0xdc8e('0x12')][_0xdc8e('0x14')]);}logger[_0xdc8e('0x12')](_0xdc8e('0x13'),_0xcd991,_0x2268cf['error'][_0xdc8e('0x14')]);return _0x1b9642(_0x2268cf[_0xdc8e('0x12')]['message']);}else{logger[_0xdc8e('0xd')](_0xdc8e('0x13'),_0xcd991,'request\x20sent');_0x1b9642(_0x2268cf[_0xdc8e('0x15')][_0xdc8e('0x14')]);}})[_0xdc8e('0x16')](function(_0x1c136b){logger['error'](_0xdc8e('0x13'),_0xcd991,_0x1c136b);_0x108cc4(_0x1c136b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a6649c9..0ac47ca 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 _0x7e40=['/:id','show','post','put','update','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x15e893,_0x6b0d24){var _0x3dfba6=function(_0x5f2f6e){while(--_0x5f2f6e){_0x15e893['push'](_0x15e893['shift']());}};_0x3dfba6(++_0x6b0d24);}(_0x7e40,0xe5));var _0x07e4=function(_0x1876c1,_0x339ff0){_0x1876c1=_0x1876c1-0x0;var _0x5168c6=_0x7e40[_0x1876c1];return _0x5168c6;};'use strict';var multer=require(_0x07e4('0x0'));var util=require(_0x07e4('0x1'));var path=require(_0x07e4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x07e4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07e4('0x4'));var interaction=require(_0x07e4('0x5'));var config=require('../../config/environment');var controller=require(_0x07e4('0x6'));router[_0x07e4('0x7')]('/',auth[_0x07e4('0x8')](),controller['index']);router[_0x07e4('0x7')](_0x07e4('0x9'),auth[_0x07e4('0x8')](),controller[_0x07e4('0xa')]);router[_0x07e4('0x7')]('/:id/download',auth[_0x07e4('0x8')](),controller['download']);router[_0x07e4('0xb')]('/',auth[_0x07e4('0x8')](),controller['create']);router[_0x07e4('0xc')](_0x07e4('0x9'),auth[_0x07e4('0x8')](),controller[_0x07e4('0xd')]);router['delete'](_0x07e4('0x9'),auth[_0x07e4('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a09=['multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','update','exports'];(function(_0x36b5be,_0x25cbb9){var _0x186b09=function(_0x559d03){while(--_0x559d03){_0x36b5be['push'](_0x36b5be['shift']());}};_0x186b09(++_0x25cbb9);}(_0x7a09,0x1d0));var _0x97a0=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0x7a09[_0x10b434];return _0x31050b;};'use strict';var multer=require(_0x97a0('0x0'));var util=require(_0x97a0('0x1'));var path=require('path');var timeout=require(_0x97a0('0x2'));var express=require('express');var router=express[_0x97a0('0x3')]();var fs_extra=require(_0x97a0('0x4'));var auth=require(_0x97a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x97a0('0x6'));var controller=require(_0x97a0('0x7'));router[_0x97a0('0x8')]('/',auth[_0x97a0('0x9')](),controller['index']);router['get'](_0x97a0('0xa'),auth[_0x97a0('0x9')](),controller['show']);router[_0x97a0('0x8')](_0x97a0('0xb'),auth['isAuthenticated'](),controller[_0x97a0('0xc')]);router[_0x97a0('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x97a0('0xa'),auth[_0x97a0('0x9')](),controller[_0x97a0('0xe')]);router['delete'](_0x97a0('0xa'),auth[_0x97a0('0x9')](),controller['destroy']);module[_0x97a0('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 72f543b..5234119 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 _0xacad=['STRING','BOOLEAN','exports'];(function(_0x1a8192,_0x3453f2){var _0x131de2=function(_0x50ab1c){while(--_0x50ab1c){_0x1a8192['push'](_0x1a8192['shift']());}};_0x131de2(++_0x3453f2);}(_0xacad,0x104));var _0xdaca=function(_0x16a0ca,_0x24a32d){_0x16a0ca=_0x16a0ca-0x0;var _0x2d9111=_0xacad[_0x16a0ca];return _0x2d9111;};'use strict';var Sequelize=require('sequelize');module[_0xdaca('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xdaca('0x1')]},'format':{'type':Sequelize[_0xdaca('0x1')]},'groupBy':{'type':Sequelize[_0xdaca('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xdaca('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf871=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xf871,0x176));var _0x1f87=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0xf871[_0x1e4a8e];return _0x5408f9;};'use strict';var Sequelize=require(_0x1f87('0x0'));module['exports']={'field':{'type':Sequelize[_0x1f87('0x1')]},'alias':{'type':Sequelize[_0x1f87('0x2')]},'function':{'type':Sequelize[_0x1f87('0x2')]},'format':{'type':Sequelize[_0x1f87('0x2')]},'groupBy':{'type':Sequelize[_0x1f87('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1f87('0x2')]},'custom':{'type':Sequelize[_0x1f87('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 657a58e..46ffdbd 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 _0x2c14=['then','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','length','includeAll','find','create','bulkCreate','body','catch','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','undefined','offset','count','limit','status','set','Content-Range','apply','reject','save','update'];(function(_0x197671,_0x2a57d5){var _0x38edf8=function(_0x55337e){while(--_0x55337e){_0x197671['push'](_0x197671['shift']());}};_0x38edf8(++_0x2a57d5);}(_0x2c14,0x84));var _0x42c1=function(_0x2dccf6,_0x12d950){_0x2dccf6=_0x2dccf6-0x0;var _0x59e1ce=_0x2c14[_0x2dccf6];return _0x59e1ce;};'use strict';var emlformat=require(_0x42c1('0x0'));var rimraf=require(_0x42c1('0x1'));var zipdir=require(_0x42c1('0x2'));var jsonpatch=require(_0x42c1('0x3'));var rp=require(_0x42c1('0x4'));var moment=require(_0x42c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x42c1('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x42c1('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x42c1('0x8'));var crypto=require(_0x42c1('0x9'));var jsforce=require(_0x42c1('0xa'));var deskjs=require(_0x42c1('0xb'));var toCsv=require(_0x42c1('0x7'));var querystring=require(_0x42c1('0xc'));var Papa=require(_0x42c1('0xd'));var Redis=require('ioredis');var authService=require(_0x42c1('0xe'));var qs=require(_0x42c1('0xf'));var as=require(_0x42c1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c1('0x11'))('api');var utils=require(_0x42c1('0x12'));var config=require(_0x42c1('0x13'));var licenseUtil=require(_0x42c1('0x14'));var db=require(_0x42c1('0x15'))['db'];function respondWithStatusCode(_0x18cb26,_0x4766d1){_0x4766d1=_0x4766d1||0xcc;return function(_0x387b76){if(_0x387b76){return _0x18cb26['sendStatus'](_0x4766d1);}return _0x18cb26['status'](_0x4766d1)[_0x42c1('0x16')]();};}function respondWithResult(_0x53f13d,_0x156d1d){_0x156d1d=_0x156d1d||0xc8;return function(_0x1439bf){if(_0x1439bf){return _0x53f13d['status'](_0x156d1d)['json'](_0x1439bf);}};}function respondWithFilteredResult(_0x553f04,_0x5eb798){return function(_0x237781){if(_0x237781){var _0x2691d5=typeof _0x5eb798['offset']===_0x42c1('0x17')&&typeof _0x5eb798['limit']===_0x42c1('0x17');var _0x1589a2=_0x237781['count'];var _0x1a5c09=_0x2691d5?0x0:_0x5eb798[_0x42c1('0x18')];var _0x155bd3=_0x2691d5?_0x237781[_0x42c1('0x19')]:_0x5eb798[_0x42c1('0x18')]+_0x5eb798[_0x42c1('0x1a')];var _0x43e72d;if(_0x155bd3>=_0x1589a2){_0x155bd3=_0x1589a2;_0x43e72d=0xc8;}else{_0x43e72d=0xce;}_0x553f04[_0x42c1('0x1b')](_0x43e72d);return _0x553f04[_0x42c1('0x1c')](_0x42c1('0x1d'),_0x1a5c09+'-'+_0x155bd3+'/'+_0x1589a2)['json'](_0x237781);}return null;};}function patchUpdates(_0xca900a){return function(_0x54b78e){try{jsonpatch[_0x42c1('0x1e')](_0x54b78e,_0xca900a,!![]);}catch(_0x4776a6){return BPromise[_0x42c1('0x1f')](_0x4776a6);}return _0x54b78e[_0x42c1('0x20')]();};}function saveUpdates(_0xa6b14b,_0xae56){return function(_0x50c7c8){if(_0x50c7c8){return _0x50c7c8[_0x42c1('0x21')](_0xa6b14b)[_0x42c1('0x22')](function(_0x110084){return _0x110084;});}return null;};}function removeEntity(_0xb689b4,_0x54f0f6){return function(_0x2b03c1){if(_0x2b03c1){return _0x2b03c1['destroy']()[_0x42c1('0x22')](function(){_0xb689b4[_0x42c1('0x1b')](0xcc)[_0x42c1('0x16')]();});}};}function handleEntityNotFound(_0x232963,_0x335e52){return function(_0x1cb98d){if(!_0x1cb98d){_0x232963['sendStatus'](0x194);}return _0x1cb98d;};}function handleError(_0xfa9805,_0x30a344){_0x30a344=_0x30a344||0x1f4;return function(_0xfa2b99){logger['error'](_0xfa2b99[_0x42c1('0x23')]);if(_0xfa2b99[_0x42c1('0x24')]){delete _0xfa2b99[_0x42c1('0x24')];}_0xfa9805['status'](_0x30a344)[_0x42c1('0x25')](_0xfa2b99);};}exports[_0x42c1('0x26')]=function(_0x1327c4,_0x45017e){var _0x12a8b3={},_0x38c4e2={},_0x1085bb={'count':0x0,'rows':[]};var _0x2fdcb1=_[_0x42c1('0x27')](db[_0x42c1('0x28')][_0x42c1('0x29')],function(_0x47cf21){return{'name':_0x47cf21[_0x42c1('0x2a')],'type':_0x47cf21[_0x42c1('0x2b')][_0x42c1('0x2c')]};});_0x38c4e2['model']=_[_0x42c1('0x27')](_0x2fdcb1,'name');_0x38c4e2[_0x42c1('0x2d')]=_[_0x42c1('0x2e')](_0x1327c4[_0x42c1('0x2d')]);_0x38c4e2[_0x42c1('0x2f')]=_['intersection'](_0x38c4e2[_0x42c1('0x30')],_0x38c4e2['query']);_0x12a8b3[_0x42c1('0x31')]=_['intersection'](_0x38c4e2[_0x42c1('0x30')],qs[_0x42c1('0x32')](_0x1327c4[_0x42c1('0x2d')][_0x42c1('0x32')]));_0x12a8b3['attributes']=_0x12a8b3[_0x42c1('0x31')]['length']?_0x12a8b3[_0x42c1('0x31')]:_0x38c4e2['model'];if(!_0x1327c4['query'][_0x42c1('0x33')](_0x42c1('0x34'))){_0x12a8b3[_0x42c1('0x1a')]=qs[_0x42c1('0x1a')](_0x1327c4[_0x42c1('0x2d')][_0x42c1('0x1a')]);_0x12a8b3[_0x42c1('0x18')]=qs[_0x42c1('0x18')](_0x1327c4['query'][_0x42c1('0x18')]);}_0x12a8b3[_0x42c1('0x35')]=qs[_0x42c1('0x36')](_0x1327c4[_0x42c1('0x2d')][_0x42c1('0x36')]);_0x12a8b3[_0x42c1('0x37')]=qs[_0x42c1('0x2f')](_[_0x42c1('0x38')](_0x1327c4[_0x42c1('0x2d')],_0x38c4e2['filters']),_0x2fdcb1);if(_0x1327c4[_0x42c1('0x2d')][_0x42c1('0x39')]){_0x12a8b3[_0x42c1('0x37')]=_[_0x42c1('0x3a')](_0x12a8b3['where'],{'$or':_[_0x42c1('0x27')](_0x2fdcb1,function(_0x39cbba){if(_0x39cbba['type']!==_0x42c1('0x3b')){var _0x1830a6={};_0x1830a6[_0x39cbba[_0x42c1('0x24')]]={'$like':'%'+_0x1327c4[_0x42c1('0x2d')][_0x42c1('0x39')]+'%'};return _0x1830a6;}})});}_0x12a8b3=_['merge']({},_0x12a8b3,_0x1327c4[_0x42c1('0x3c')]);var _0xb52249={'where':_0x12a8b3[_0x42c1('0x37')]};return db[_0x42c1('0x28')][_0x42c1('0x19')](_0xb52249)[_0x42c1('0x22')](function(_0x46e098){_0x1085bb[_0x42c1('0x19')]=_0x46e098;if(_0x1327c4[_0x42c1('0x2d')]['includeAll']){_0x12a8b3[_0x42c1('0x3d')]=[{'all':!![]}];}return db[_0x42c1('0x28')][_0x42c1('0x3e')](_0x12a8b3);})[_0x42c1('0x22')](function(_0x720f35){_0x1085bb[_0x42c1('0x3f')]=_0x720f35;return _0x1085bb;})['then'](respondWithFilteredResult(_0x45017e,_0x12a8b3))['catch'](handleError(_0x45017e,null));};exports[_0x42c1('0x40')]=function(_0x2b1085,_0x44c819){var _0x4d4857={'raw':![],'where':{'id':_0x2b1085[_0x42c1('0x41')]['id']}},_0x37e365={};_0x37e365[_0x42c1('0x30')]=_[_0x42c1('0x2e')](db[_0x42c1('0x28')]['rawAttributes']);_0x37e365[_0x42c1('0x2d')]=_['keys'](_0x2b1085[_0x42c1('0x2d')]);_0x37e365[_0x42c1('0x2f')]=_['intersection'](_0x37e365[_0x42c1('0x30')],_0x37e365[_0x42c1('0x2d')]);_0x4d4857[_0x42c1('0x31')]=_[_0x42c1('0x42')](_0x37e365[_0x42c1('0x30')],qs[_0x42c1('0x32')](_0x2b1085['query'][_0x42c1('0x32')]));_0x4d4857[_0x42c1('0x31')]=_0x4d4857[_0x42c1('0x31')][_0x42c1('0x43')]?_0x4d4857[_0x42c1('0x31')]:_0x37e365['model'];if(_0x2b1085[_0x42c1('0x2d')][_0x42c1('0x44')]){_0x4d4857[_0x42c1('0x3d')]=[{'all':!![]}];}_0x4d4857=_[_0x42c1('0x3a')]({},_0x4d4857,_0x2b1085[_0x42c1('0x3c')]);return db[_0x42c1('0x28')][_0x42c1('0x45')](_0x4d4857)[_0x42c1('0x22')](handleEntityNotFound(_0x44c819,null))[_0x42c1('0x22')](respondWithResult(_0x44c819,null))['catch'](handleError(_0x44c819,null));};exports[_0x42c1('0x46')]=function(_0x20e58b,_0x1510d6){return db[_0x42c1('0x28')][_0x42c1('0x46')](_0x20e58b['body'],{})[_0x42c1('0x22')](respondWithResult(_0x1510d6,0xc9))['catch'](handleError(_0x1510d6,null));};exports[_0x42c1('0x47')]=function(_0x1bea82,_0x769150){return db[_0x42c1('0x28')][_0x42c1('0x47')](_0x1bea82[_0x42c1('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x769150,0xc9))[_0x42c1('0x49')](handleError(_0x769150,null));};exports[_0x42c1('0x21')]=function(_0x4b17e1,_0x311952){if(_0x4b17e1[_0x42c1('0x48')]['id']){delete _0x4b17e1[_0x42c1('0x48')]['id'];}return db[_0x42c1('0x28')][_0x42c1('0x45')]({'where':{'id':_0x4b17e1['params']['id']}})[_0x42c1('0x22')](handleEntityNotFound(_0x311952,null))[_0x42c1('0x22')](saveUpdates(_0x4b17e1[_0x42c1('0x48')],null))[_0x42c1('0x22')](respondWithResult(_0x311952,null))[_0x42c1('0x49')](handleError(_0x311952,null));};exports[_0x42c1('0x4a')]=function(_0x5dd29b,_0x2065e2){return db[_0x42c1('0x28')][_0x42c1('0x45')]({'where':{'id':_0x5dd29b[_0x42c1('0x41')]['id']}})['then'](handleEntityNotFound(_0x2065e2,null))[_0x42c1('0x22')](removeEntity(_0x2065e2,null))[_0x42c1('0x49')](handleError(_0x2065e2,null));};exports[_0x42c1('0x4b')]=function(_0x31faed,_0x8c09cd){return db[_0x42c1('0x28')][_0x42c1('0x4a')]({'where':{'id':_0x31faed[_0x42c1('0x2d')][_0x42c1('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x42c1('0x22')](respondWithResult(_0x8c09cd,0xcc))[_0x42c1('0x49')](handleError(_0x8c09cd,null));};exports[_0x42c1('0x4d')]=function(_0x459966,_0x4ec34d,_0xd89a3d){return db[_0x42c1('0x4e')][_0x42c1('0x4f')]({'where':{'id':_0x459966[_0x42c1('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ec34d,null))[_0x42c1('0x22')](function(_0x291abb){if(_0x291abb){return db[_0x42c1('0x50')][_0x42c1('0x51')](function(_0x117d18){return db['AnalyticFieldReport'][_0x42c1('0x4a')]({'where':{'CustomReportId':_0x459966['params']['id']},'transaction':_0x117d18})['then'](function(_0xea8b01){var _0x2c6048=_[_0x42c1('0x27')](_0x459966[_0x42c1('0x48')],function(_0x62ffb0){delete _0x62ffb0['id'];_0x62ffb0[_0x42c1('0x52')]=_0x459966['params']['id'];return _0x62ffb0;});return db[_0x42c1('0x28')][_0x42c1('0x47')](_0x2c6048,{'transaction':_0x117d18});});})[_0x42c1('0x22')](function(){return db['AnalyticFieldReport'][_0x42c1('0x3e')]({'where':{'CustomReportId':_0x459966[_0x42c1('0x41')]['id']}});});}})[_0x42c1('0x22')](respondWithResult(_0x4ec34d,null))[_0x42c1('0x49')](handleError(_0x4ec34d,null));}; \ No newline at end of file +var _0xb239=['keys','filters','query','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','rawAttributes','length','find','create','body','catch','bulkDestroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','update','destroy','then','stack','name','index','AnalyticFieldReport','fieldName','type','key','model','map'];(function(_0x33e40b,_0x131994){var _0x2a4a39=function(_0xdf8a1d){while(--_0xdf8a1d){_0x33e40b['push'](_0x33e40b['shift']());}};_0x2a4a39(++_0x131994);}(_0xb239,0x16a));var _0x9b23=function(_0x561391,_0x567f8d){_0x561391=_0x561391-0x0;var _0x5da03c=_0xb239[_0x561391];return _0x5da03c;};'use strict';var emlformat=require(_0x9b23('0x0'));var rimraf=require(_0x9b23('0x1'));var zipdir=require(_0x9b23('0x2'));var jsonpatch=require(_0x9b23('0x3'));var rp=require(_0x9b23('0x4'));var moment=require(_0x9b23('0x5'));var BPromise=require(_0x9b23('0x6'));var Mustache=require(_0x9b23('0x7'));var util=require(_0x9b23('0x8'));var path=require(_0x9b23('0x9'));var sox=require(_0x9b23('0xa'));var csv=require(_0x9b23('0xb'));var ejs=require(_0x9b23('0xc'));var fs=require('fs');var fs_extra=require(_0x9b23('0xd'));var _=require(_0x9b23('0xe'));var squel=require(_0x9b23('0xf'));var crypto=require('crypto');var jsforce=require(_0x9b23('0x10'));var deskjs=require(_0x9b23('0x11'));var toCsv=require(_0x9b23('0xb'));var querystring=require(_0x9b23('0x12'));var Papa=require(_0x9b23('0x13'));var Redis=require(_0x9b23('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b23('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x9b23('0x16'));var config=require(_0x9b23('0x17'));var licenseUtil=require(_0x9b23('0x18'));var db=require(_0x9b23('0x19'))['db'];function respondWithStatusCode(_0x983b15,_0x10cc39){_0x10cc39=_0x10cc39||0xcc;return function(_0xc3d256){if(_0xc3d256){return _0x983b15[_0x9b23('0x1a')](_0x10cc39);}return _0x983b15[_0x9b23('0x1b')](_0x10cc39)[_0x9b23('0x1c')]();};}function respondWithResult(_0x186fb2,_0x28a92f){_0x28a92f=_0x28a92f||0xc8;return function(_0x4f96ac){if(_0x4f96ac){return _0x186fb2[_0x9b23('0x1b')](_0x28a92f)[_0x9b23('0x1d')](_0x4f96ac);}};}function respondWithFilteredResult(_0x4122f3,_0x3668ff){return function(_0x70f3a4){if(_0x70f3a4){var _0x126abd=typeof _0x3668ff[_0x9b23('0x1e')]===_0x9b23('0x1f')&&typeof _0x3668ff[_0x9b23('0x20')]===_0x9b23('0x1f');var _0x32c6e4=_0x70f3a4['count'];var _0x1c9a7a=_0x126abd?0x0:_0x3668ff[_0x9b23('0x1e')];var _0x584f88=_0x126abd?_0x70f3a4['count']:_0x3668ff[_0x9b23('0x1e')]+_0x3668ff['limit'];var _0x1296bc;if(_0x584f88>=_0x32c6e4){_0x584f88=_0x32c6e4;_0x1296bc=0xc8;}else{_0x1296bc=0xce;}_0x4122f3[_0x9b23('0x1b')](_0x1296bc);return _0x4122f3[_0x9b23('0x21')](_0x9b23('0x22'),_0x1c9a7a+'-'+_0x584f88+'/'+_0x32c6e4)['json'](_0x70f3a4);}return null;};}function patchUpdates(_0x5d964f){return function(_0x2ac612){try{jsonpatch[_0x9b23('0x23')](_0x2ac612,_0x5d964f,!![]);}catch(_0x584f9b){return BPromise['reject'](_0x584f9b);}return _0x2ac612['save']();};}function saveUpdates(_0x32abb2,_0xe12b69){return function(_0x334902){if(_0x334902){return _0x334902[_0x9b23('0x24')](_0x32abb2)['then'](function(_0xb67afd){return _0xb67afd;});}return null;};}function removeEntity(_0x4b1131,_0x233b1b){return function(_0x497913){if(_0x497913){return _0x497913[_0x9b23('0x25')]()[_0x9b23('0x26')](function(){_0x4b1131[_0x9b23('0x1b')](0xcc)[_0x9b23('0x1c')]();});}};}function handleEntityNotFound(_0x4d514a,_0x3747de){return function(_0x4e08bd){if(!_0x4e08bd){_0x4d514a[_0x9b23('0x1a')](0x194);}return _0x4e08bd;};}function handleError(_0x1ca264,_0x59859b){_0x59859b=_0x59859b||0x1f4;return function(_0x445576){logger['error'](_0x445576[_0x9b23('0x27')]);if(_0x445576[_0x9b23('0x28')]){delete _0x445576[_0x9b23('0x28')];}_0x1ca264[_0x9b23('0x1b')](_0x59859b)['send'](_0x445576);};}exports[_0x9b23('0x29')]=function(_0x3fa455,_0x121aec){var _0x271f0a={},_0x4e0a53={},_0x1a1595={'count':0x0,'rows':[]};var _0x2eada6=_['map'](db[_0x9b23('0x2a')]['rawAttributes'],function(_0xf1558f){return{'name':_0xf1558f[_0x9b23('0x2b')],'type':_0xf1558f[_0x9b23('0x2c')][_0x9b23('0x2d')]};});_0x4e0a53[_0x9b23('0x2e')]=_[_0x9b23('0x2f')](_0x2eada6,_0x9b23('0x28'));_0x4e0a53['query']=_[_0x9b23('0x30')](_0x3fa455['query']);_0x4e0a53[_0x9b23('0x31')]=_['intersection'](_0x4e0a53[_0x9b23('0x2e')],_0x4e0a53[_0x9b23('0x32')]);_0x271f0a[_0x9b23('0x33')]=_[_0x9b23('0x34')](_0x4e0a53[_0x9b23('0x2e')],qs['fields'](_0x3fa455[_0x9b23('0x32')][_0x9b23('0x35')]));_0x271f0a['attributes']=_0x271f0a[_0x9b23('0x33')]['length']?_0x271f0a[_0x9b23('0x33')]:_0x4e0a53['model'];if(!_0x3fa455[_0x9b23('0x32')]['hasOwnProperty'](_0x9b23('0x36'))){_0x271f0a['limit']=qs[_0x9b23('0x20')](_0x3fa455[_0x9b23('0x32')][_0x9b23('0x20')]);_0x271f0a['offset']=qs[_0x9b23('0x1e')](_0x3fa455[_0x9b23('0x32')][_0x9b23('0x1e')]);}_0x271f0a[_0x9b23('0x37')]=qs[_0x9b23('0x38')](_0x3fa455[_0x9b23('0x32')]['sort']);_0x271f0a[_0x9b23('0x39')]=qs[_0x9b23('0x31')](_[_0x9b23('0x3a')](_0x3fa455['query'],_0x4e0a53[_0x9b23('0x31')]),_0x2eada6);if(_0x3fa455[_0x9b23('0x32')][_0x9b23('0x3b')]){_0x271f0a['where']=_[_0x9b23('0x3c')](_0x271f0a[_0x9b23('0x39')],{'$or':_[_0x9b23('0x2f')](_0x2eada6,function(_0x2dfeab){if(_0x2dfeab['type']!==_0x9b23('0x3d')){var _0x4326a4={};_0x4326a4[_0x2dfeab['name']]={'$like':'%'+_0x3fa455['query'][_0x9b23('0x3b')]+'%'};return _0x4326a4;}})});}_0x271f0a=_['merge']({},_0x271f0a,_0x3fa455[_0x9b23('0x3e')]);var _0x4716a1={'where':_0x271f0a[_0x9b23('0x39')]};return db[_0x9b23('0x2a')][_0x9b23('0x3f')](_0x4716a1)['then'](function(_0x5af92d){_0x1a1595[_0x9b23('0x3f')]=_0x5af92d;if(_0x3fa455[_0x9b23('0x32')][_0x9b23('0x40')]){_0x271f0a[_0x9b23('0x41')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x9b23('0x42')](_0x271f0a);})['then'](function(_0x74d3){_0x1a1595['rows']=_0x74d3;return _0x1a1595;})[_0x9b23('0x26')](respondWithFilteredResult(_0x121aec,_0x271f0a))['catch'](handleError(_0x121aec,null));};exports[_0x9b23('0x43')]=function(_0xd3272d,_0x5b2a51){var _0x3a817e={'raw':![],'where':{'id':_0xd3272d[_0x9b23('0x44')]['id']}},_0x24c58f={};_0x24c58f[_0x9b23('0x2e')]=_[_0x9b23('0x30')](db[_0x9b23('0x2a')][_0x9b23('0x45')]);_0x24c58f[_0x9b23('0x32')]=_[_0x9b23('0x30')](_0xd3272d[_0x9b23('0x32')]);_0x24c58f[_0x9b23('0x31')]=_[_0x9b23('0x34')](_0x24c58f['model'],_0x24c58f[_0x9b23('0x32')]);_0x3a817e[_0x9b23('0x33')]=_['intersection'](_0x24c58f['model'],qs[_0x9b23('0x35')](_0xd3272d[_0x9b23('0x32')]['fields']));_0x3a817e[_0x9b23('0x33')]=_0x3a817e[_0x9b23('0x33')][_0x9b23('0x46')]?_0x3a817e[_0x9b23('0x33')]:_0x24c58f[_0x9b23('0x2e')];if(_0xd3272d['query'][_0x9b23('0x40')]){_0x3a817e[_0x9b23('0x41')]=[{'all':!![]}];}_0x3a817e=_[_0x9b23('0x3c')]({},_0x3a817e,_0xd3272d[_0x9b23('0x3e')]);return db[_0x9b23('0x2a')][_0x9b23('0x47')](_0x3a817e)[_0x9b23('0x26')](handleEntityNotFound(_0x5b2a51,null))[_0x9b23('0x26')](respondWithResult(_0x5b2a51,null))['catch'](handleError(_0x5b2a51,null));};exports[_0x9b23('0x48')]=function(_0x44ab52,_0x48130a){return db[_0x9b23('0x2a')][_0x9b23('0x48')](_0x44ab52[_0x9b23('0x49')],{})[_0x9b23('0x26')](respondWithResult(_0x48130a,0xc9))[_0x9b23('0x4a')](handleError(_0x48130a,null));};exports['bulkCreate']=function(_0x2bd4f5,_0x83b004){return db[_0x9b23('0x2a')]['bulkCreate'](_0x2bd4f5[_0x9b23('0x49')],{'raw':![],'individualHooks':!![]})[_0x9b23('0x26')](respondWithResult(_0x83b004,0xc9))[_0x9b23('0x4a')](handleError(_0x83b004,null));};exports[_0x9b23('0x24')]=function(_0xd9bb7a,_0x4e1d88){if(_0xd9bb7a[_0x9b23('0x49')]['id']){delete _0xd9bb7a[_0x9b23('0x49')]['id'];}return db['AnalyticFieldReport'][_0x9b23('0x47')]({'where':{'id':_0xd9bb7a[_0x9b23('0x44')]['id']}})['then'](handleEntityNotFound(_0x4e1d88,null))[_0x9b23('0x26')](saveUpdates(_0xd9bb7a[_0x9b23('0x49')],null))[_0x9b23('0x26')](respondWithResult(_0x4e1d88,null))[_0x9b23('0x4a')](handleError(_0x4e1d88,null));};exports[_0x9b23('0x25')]=function(_0x3f6ab5,_0x426299){return db[_0x9b23('0x2a')][_0x9b23('0x47')]({'where':{'id':_0x3f6ab5[_0x9b23('0x44')]['id']}})[_0x9b23('0x26')](handleEntityNotFound(_0x426299,null))[_0x9b23('0x26')](removeEntity(_0x426299,null))[_0x9b23('0x4a')](handleError(_0x426299,null));};exports[_0x9b23('0x4b')]=function(_0x2cb882,_0x213214){return db[_0x9b23('0x2a')][_0x9b23('0x25')]({'where':{'id':_0x2cb882[_0x9b23('0x32')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x9b23('0x26')](respondWithResult(_0x213214,0xcc))[_0x9b23('0x4a')](handleError(_0x213214,null));};exports['addFields']=function(_0x183ab9,_0x49e248,_0x3ee39b){return db[_0x9b23('0x4c')][_0x9b23('0x4d')]({'where':{'id':_0x183ab9[_0x9b23('0x44')]['id']}})[_0x9b23('0x26')](handleEntityNotFound(_0x49e248,null))[_0x9b23('0x26')](function(_0x63eeb2){if(_0x63eeb2){return db[_0x9b23('0x4e')][_0x9b23('0x4f')](function(_0x28b83e){return db[_0x9b23('0x2a')][_0x9b23('0x25')]({'where':{'CustomReportId':_0x183ab9['params']['id']},'transaction':_0x28b83e})[_0x9b23('0x26')](function(_0x3ffd72){var _0x33e1ca=_[_0x9b23('0x2f')](_0x183ab9[_0x9b23('0x49')],function(_0x32e666){delete _0x32e666['id'];_0x32e666[_0x9b23('0x50')]=_0x183ab9[_0x9b23('0x44')]['id'];return _0x32e666;});return db['AnalyticFieldReport'][_0x9b23('0x51')](_0x33e1ca,{'transaction':_0x28b83e});});})[_0x9b23('0x26')](function(){return db[_0x9b23('0x2a')]['findAll']({'where':{'CustomReportId':_0x183ab9[_0x9b23('0x44')]['id']}});});}})['then'](respondWithResult(_0x49e248,null))[_0x9b23('0x4a')](handleError(_0x49e248,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 0217ae0..c82b9c1 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 _0x5168=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','util','../../config/logger','api','moment'];(function(_0x56e8ca,_0x57a67a){var _0x37fc7d=function(_0x57fc37){while(--_0x57fc37){_0x56e8ca['push'](_0x56e8ca['shift']());}};_0x37fc7d(++_0x57a67a);}(_0x5168,0x1ac));var _0x8516=function(_0x31abf3,_0x471f31){_0x31abf3=_0x31abf3-0x0;var _0x335fd1=_0x5168[_0x31abf3];return _0x335fd1;};'use strict';var _=require('lodash');var util=require(_0x8516('0x0'));var logger=require(_0x8516('0x1'))(_0x8516('0x2'));var moment=require(_0x8516('0x3'));var BPromise=require(_0x8516('0x4'));var rp=require(_0x8516('0x5'));var fs=require('fs');var path=require(_0x8516('0x6'));var rimraf=require(_0x8516('0x7'));var config=require(_0x8516('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x8516('0x9')]=function(_0x23665d,_0x3d12b5){return _0x23665d[_0x8516('0xa')](_0x8516('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8de0=['api','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x5a40fd,_0x505e29){var _0x2570f7=function(_0xf7afb3){while(--_0xf7afb3){_0x5a40fd['push'](_0x5a40fd['shift']());}};_0x2570f7(++_0x505e29);}(_0x8de0,0x8d));var _0x08de=function(_0x45a2ac,_0xe2f785){_0x45a2ac=_0x45a2ac-0x0;var _0x166152=_0x8de0[_0x45a2ac];return _0x166152;};'use strict';var _=require(_0x08de('0x0'));var util=require(_0x08de('0x1'));var logger=require('../../config/logger')(_0x08de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x08de('0x3'));var fs=require('fs');var path=require(_0x08de('0x4'));var rimraf=require(_0x08de('0x5'));var config=require(_0x08de('0x6'));var attributes=require(_0x08de('0x7'));module[_0x08de('0x8')]=function(_0x2a8463,_0x90f949){return _0x2a8463['define'](_0x08de('0x9'),attributes,{'tableName':_0x08de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index cd9d537..322387d 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 _0x256a=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','util','bluebird','randomstring','ioredis','../../config/logger','rpc','client','request','request\x20sent','debug'];(function(_0x21e6db,_0x1cc9ae){var _0x2bdf43=function(_0x33963f){while(--_0x33963f){_0x21e6db['push'](_0x21e6db['shift']());}};_0x2bdf43(++_0x1cc9ae);}(_0x256a,0x17d));var _0xa256=function(_0x3a6c87,_0x1238f9){_0x3a6c87=_0x3a6c87-0x0;var _0x1754db=_0x256a[_0x3a6c87];return _0x1754db;};'use strict';var _=require('lodash');var util=require(_0xa256('0x0'));var moment=require('moment');var BPromise=require(_0xa256('0x1'));var rs=require(_0xa256('0x2'));var fs=require('fs');var Redis=require(_0xa256('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa256('0x4'))(_0xa256('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa256('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x401d42,_0xdafcc2,_0x4e2119){return new BPromise(function(_0xdc1071,_0x52ac82){return client[_0xa256('0x7')](_0x401d42,_0x4e2119)['then'](function(_0x394ab0){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0xdafcc2,_0xa256('0x8'));logger[_0xa256('0x9')](_0xa256('0xa'),_0xdafcc2,_0xa256('0x8'),JSON[_0xa256('0xb')](_0x394ab0));if(_0x394ab0['error']){if(_0x394ab0[_0xa256('0xc')][_0xa256('0xd')]===0x1f4){logger[_0xa256('0xc')](_0xa256('0xe'),_0xdafcc2,_0x394ab0[_0xa256('0xc')][_0xa256('0xf')]);return _0x52ac82(_0x394ab0[_0xa256('0xc')][_0xa256('0xf')]);}logger[_0xa256('0xc')](_0xa256('0xe'),_0xdafcc2,_0x394ab0[_0xa256('0xc')][_0xa256('0xf')]);return _0xdc1071(_0x394ab0['error'][_0xa256('0xf')]);}else{logger[_0xa256('0x10')](_0xa256('0xe'),_0xdafcc2,'request\x20sent');_0xdc1071(_0x394ab0['result'][_0xa256('0xf')]);}})['catch'](function(_0x11eee1){logger[_0xa256('0xc')](_0xa256('0xe'),_0xdafcc2,_0x11eee1);_0x52ac82(_0x11eee1);});});} \ No newline at end of file +var _0x1c7f=['then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','request'];(function(_0x1f7a68,_0x200f6e){var _0x49f11c=function(_0x4d7afb){while(--_0x4d7afb){_0x1f7a68['push'](_0x1f7a68['shift']());}};_0x49f11c(++_0x200f6e);}(_0x1c7f,0x174));var _0xf1c7=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x1c7f[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf1c7('0x0'));var BPromise=require(_0xf1c7('0x1'));var rs=require(_0xf1c7('0x2'));var fs=require('fs');var Redis=require(_0xf1c7('0x3'));var db=require(_0xf1c7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf1c7('0x5'));var client=jayson['client'][_0xf1c7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dc218,_0x2b1c3e,_0x5f4ff3){return new BPromise(function(_0x5db6dd,_0x501716){return client[_0xf1c7('0x7')](_0x1dc218,_0x5f4ff3)[_0xf1c7('0x8')](function(_0x2ded38){logger[_0xf1c7('0x9')](_0xf1c7('0xa'),_0x2b1c3e,_0xf1c7('0xb'));logger[_0xf1c7('0xc')](_0xf1c7('0xd'),_0x2b1c3e,_0xf1c7('0xb'),JSON[_0xf1c7('0xe')](_0x2ded38));if(_0x2ded38[_0xf1c7('0xf')]){if(_0x2ded38[_0xf1c7('0xf')][_0xf1c7('0x10')]===0x1f4){logger[_0xf1c7('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2b1c3e,_0x2ded38[_0xf1c7('0xf')][_0xf1c7('0x11')]);return _0x501716(_0x2ded38[_0xf1c7('0xf')][_0xf1c7('0x11')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2b1c3e,_0x2ded38['error'][_0xf1c7('0x11')]);return _0x5db6dd(_0x2ded38[_0xf1c7('0xf')][_0xf1c7('0x11')]);}else{logger[_0xf1c7('0x9')](_0xf1c7('0xa'),_0x2b1c3e,_0xf1c7('0xb'));_0x5db6dd(_0x2ded38[_0xf1c7('0x12')][_0xf1c7('0x11')]);}})[_0xf1c7('0x13')](function(_0x4fcd97){logger[_0xf1c7('0xf')](_0xf1c7('0xa'),_0x2b1c3e,_0x4fcd97);_0x501716(_0x4fcd97);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9309476..6592012 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(_0x21b43a,_0x5d81e3){var _0x3161b0=function(_0x4dece3){while(--_0x4dece3){_0x21b43a['push'](_0x21b43a['shift']());}};_0x3161b0(++_0x5d81e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x5d71fc,_0x38d8b7){var _0x237783=function(_0x5243a0){while(--_0x5243a0){_0x5d71fc['push'](_0x5d71fc['shift']());}};_0x237783(++_0x38d8b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 cc5f9bb..d18c675 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 _0x9d62=['exports','STRING','name','sequelize'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x9d62,0xaf));var _0x29d6=function(_0x595f21,_0x1c62c2){_0x595f21=_0x595f21-0x0;var _0x58080a=_0x9d62[_0x595f21];return _0x58080a;};'use strict';var Sequelize=require(_0x29d6('0x0'));module[_0x29d6('0x1')]={'name':{'type':Sequelize[_0x29d6('0x2')],'allowNull':![],'unique':_0x29d6('0x3')},'table':{'type':Sequelize[_0x29d6('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x29d6('0x2')]}}; \ No newline at end of file +var _0x373d=['name','TEXT','sequelize','STRING'];(function(_0x36bbbb,_0x3f6709){var _0x3ca0eb=function(_0x299763){while(--_0x299763){_0x36bbbb['push'](_0x36bbbb['shift']());}};_0x3ca0eb(++_0x3f6709);}(_0x373d,0x1e2));var _0xd373=function(_0x36ca6e,_0x1bcabc){_0x36ca6e=_0x36ca6e-0x0;var _0x1e774c=_0x373d[_0x36ca6e];return _0x1e774c;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'name':{'type':Sequelize[_0xd373('0x1')],'allowNull':![],'unique':_0xd373('0x2')},'table':{'type':Sequelize[_0xd373('0x1')]},'metric':{'type':Sequelize[_0xd373('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 27b60c8..8aa5b5e 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x425d=['VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where','merge'];(function(_0x4ae05b,_0x18307c){var _0x421a1c=function(_0x4df697){while(--_0x4df697){_0x4ae05b['push'](_0x4ae05b['shift']());}};_0x421a1c(++_0x18307c);}(_0x425d,0x1e0));var _0xd425=function(_0x2e5727,_0x1a1910){_0x2e5727=_0x2e5727-0x0;var _0x41faad=_0x425d[_0x2e5727];return _0x41faad;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];function respondWithStatusCode(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xcc;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x1d')](_0x3cacf7);}return _0x9bb611['status'](_0x3cacf7)[_0xd425('0x1e')]();};}function respondWithResult(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0xc8;return function(_0x5d3d60){if(_0x5d3d60){return _0x17a498[_0xd425('0x1f')](_0x336dc3)[_0xd425('0x20')](_0x5d3d60);}};}function respondWithFilteredResult(_0x643fd2,_0x41f34d){return function(_0x1fc822){if(_0x1fc822){var _0x538a0a=typeof _0x41f34d[_0xd425('0x21')]===_0xd425('0x22')&&typeof _0x41f34d[_0xd425('0x23')]===_0xd425('0x22');var _0x5d6585=_0x1fc822[_0xd425('0x24')];var _0x434d97=_0x538a0a?0x0:_0x41f34d[_0xd425('0x21')];var _0x1155bc=_0x538a0a?_0x1fc822['count']:_0x41f34d['offset']+_0x41f34d['limit'];var _0x4b293a;if(_0x1155bc>=_0x5d6585){_0x1155bc=_0x5d6585;_0x4b293a=0xc8;}else{_0x4b293a=0xce;}_0x643fd2[_0xd425('0x1f')](_0x4b293a);return _0x643fd2[_0xd425('0x25')](_0xd425('0x26'),_0x434d97+'-'+_0x1155bc+'/'+_0x5d6585)['json'](_0x1fc822);}return null;};}function patchUpdates(_0x355af0){return function(_0x7e982e){try{jsonpatch['apply'](_0x7e982e,_0x355af0,!![]);}catch(_0x2e1ec4){return BPromise[_0xd425('0x27')](_0x2e1ec4);}return _0x7e982e[_0xd425('0x28')]();};}function saveUpdates(_0x1d3fc0,_0x3e93db){return function(_0xb240c4){if(_0xb240c4){return _0xb240c4[_0xd425('0x29')](_0x1d3fc0)[_0xd425('0x2a')](function(_0x314201){return _0x314201;});}return null;};}function removeEntity(_0x2b030b,_0x151ad9){return function(_0x40e84b){if(_0x40e84b){return _0x40e84b['destroy']()[_0xd425('0x2a')](function(){var _0x264b0e=_0x40e84b[_0xd425('0x2b')]({'plain':!![]});var _0x1908a5=_0xd425('0x2c');return db[_0xd425('0x2d')][_0xd425('0x2e')]({'where':{'type':_0x1908a5,'resourceId':_0x264b0e['id']}})['then'](function(){return _0x40e84b;});})[_0xd425('0x2a')](function(){_0x2b030b[_0xd425('0x1f')](0xcc)[_0xd425('0x1e')]();});}};}function handleEntityNotFound(_0x57c950,_0x27ef8a){return function(_0x3ad9bd){if(!_0x3ad9bd){_0x57c950[_0xd425('0x1d')](0x194);}return _0x3ad9bd;};}function handleError(_0x999fb9,_0x27d29a){_0x27d29a=_0x27d29a||0x1f4;return function(_0x185d7e){logger[_0xd425('0x2f')](_0x185d7e[_0xd425('0x30')]);if(_0x185d7e[_0xd425('0x31')]){delete _0x185d7e[_0xd425('0x31')];}_0x999fb9['status'](_0x27d29a)[_0xd425('0x32')](_0x185d7e);};}exports[_0xd425('0x33')]=function(_0x298602,_0x3695dd){var _0x3275b1={},_0x1abf33={},_0x47405f={'count':0x0,'rows':[]};var _0x40c392=_[_0xd425('0x34')](db[_0xd425('0x35')][_0xd425('0x36')],function(_0x5f3dab){return{'name':_0x5f3dab[_0xd425('0x37')],'type':_0x5f3dab[_0xd425('0x38')][_0xd425('0x39')]};});_0x1abf33[_0xd425('0x3a')]=_[_0xd425('0x34')](_0x40c392,'name');_0x1abf33[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x298602['query']);_0x1abf33['filters']=_['intersection'](_0x1abf33[_0xd425('0x3a')],_0x1abf33[_0xd425('0x3b')]);_0x3275b1[_0xd425('0x3d')]=_[_0xd425('0x3e')](_0x1abf33['model'],qs[_0xd425('0x3f')](_0x298602[_0xd425('0x3b')][_0xd425('0x3f')]));_0x3275b1[_0xd425('0x3d')]=_0x3275b1[_0xd425('0x3d')][_0xd425('0x40')]?_0x3275b1[_0xd425('0x3d')]:_0x1abf33['model'];if(!_0x298602[_0xd425('0x3b')]['hasOwnProperty'](_0xd425('0x41'))){_0x3275b1[_0xd425('0x23')]=qs[_0xd425('0x23')](_0x298602['query'][_0xd425('0x23')]);_0x3275b1[_0xd425('0x21')]=qs[_0xd425('0x21')](_0x298602[_0xd425('0x3b')]['offset']);}_0x3275b1[_0xd425('0x42')]=qs[_0xd425('0x43')](_0x298602['query']['sort']);_0x3275b1['where']=qs[_0xd425('0x44')](_[_0xd425('0x45')](_0x298602[_0xd425('0x3b')],_0x1abf33['filters']),_0x40c392);if(_0x298602['query']['filter']){_0x3275b1[_0xd425('0x46')]=_[_0xd425('0x47')](_0x3275b1[_0xd425('0x46')],{'$or':_[_0xd425('0x34')](_0x40c392,function(_0xa9fd7c){if(_0xa9fd7c[_0xd425('0x38')]!==_0xd425('0x48')){var _0x4b922f={};_0x4b922f[_0xa9fd7c[_0xd425('0x31')]]={'$like':'%'+_0x298602[_0xd425('0x3b')][_0xd425('0x49')]+'%'};return _0x4b922f;}})});}_0x3275b1=_['merge']({},_0x3275b1,_0x298602[_0xd425('0x4a')]);var _0x2dffc7={'where':_0x3275b1[_0xd425('0x46')]};return db['AnalyticMetric'][_0xd425('0x24')](_0x2dffc7)[_0xd425('0x2a')](function(_0x1c5ba6){_0x47405f[_0xd425('0x24')]=_0x1c5ba6;if(_0x298602['query'][_0xd425('0x4b')]){_0x3275b1[_0xd425('0x4c')]=[{'all':!![]}];}return db[_0xd425('0x35')][_0xd425('0x4d')](_0x3275b1);})[_0xd425('0x2a')](function(_0x2f6bf7){_0x47405f[_0xd425('0x4e')]=_0x2f6bf7;return _0x47405f;})['then'](respondWithFilteredResult(_0x3695dd,_0x3275b1))[_0xd425('0x4f')](handleError(_0x3695dd,null));};exports[_0xd425('0x50')]=function(_0x5b65fe,_0x1a44a8){var _0x491c51={'raw':!![],'where':{'id':_0x5b65fe[_0xd425('0x51')]['id']}},_0x5e12bf={};_0x5e12bf['model']=_[_0xd425('0x3c')](db['AnalyticMetric'][_0xd425('0x36')]);_0x5e12bf[_0xd425('0x3b')]=_[_0xd425('0x3c')](_0x5b65fe[_0xd425('0x3b')]);_0x5e12bf[_0xd425('0x44')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],_0x5e12bf['query']);_0x491c51[_0xd425('0x3d')]=_['intersection'](_0x5e12bf[_0xd425('0x3a')],qs[_0xd425('0x3f')](_0x5b65fe[_0xd425('0x3b')][_0xd425('0x3f')]));_0x491c51[_0xd425('0x3d')]=_0x491c51['attributes'][_0xd425('0x40')]?_0x491c51[_0xd425('0x3d')]:_0x5e12bf[_0xd425('0x3a')];if(_0x5b65fe[_0xd425('0x3b')][_0xd425('0x4b')]){_0x491c51['include']=[{'all':!![]}];}_0x491c51=_[_0xd425('0x47')]({},_0x491c51,_0x5b65fe[_0xd425('0x4a')]);return db[_0xd425('0x35')][_0xd425('0x52')](_0x491c51)[_0xd425('0x2a')](handleEntityNotFound(_0x1a44a8,null))[_0xd425('0x2a')](respondWithResult(_0x1a44a8,null))['catch'](handleError(_0x1a44a8,null));};exports[_0xd425('0x53')]=function(_0x128cb3,_0x5bfac6){return db[_0xd425('0x35')][_0xd425('0x53')](_0x128cb3[_0xd425('0x54')],{})[_0xd425('0x2a')](function(_0x5c0219){var _0x54f1d=_0x128cb3[_0xd425('0x55')][_0xd425('0x2b')]({'plain':!![]});if(!_0x54f1d)throw new Error(_0xd425('0x56'));if(_0x54f1d[_0xd425('0x57')]==='user'){var _0x4be6fa=_0x5c0219[_0xd425('0x2b')]({'plain':!![]});var _0x5496d8=_0xd425('0x2c');return db[_0xd425('0x58')]['find']({'where':{'name':_0x5496d8,'userProfileId':_0x54f1d[_0xd425('0x59')]},'raw':!![]})['then'](function(_0x48d5b8){if(_0x48d5b8&&_0x48d5b8[_0xd425('0x5a')]===0x0){return db[_0xd425('0x2d')][_0xd425('0x53')]({'name':_0x4be6fa[_0xd425('0x31')],'resourceId':_0x4be6fa['id'],'type':_0x48d5b8[_0xd425('0x31')],'sectionId':_0x48d5b8['id']},{})[_0xd425('0x2a')](function(){return _0x5c0219;});}else{return _0x5c0219;}})[_0xd425('0x4f')](function(_0x4118fe){logger['error'](_0xd425('0x5b'),_0x4118fe);throw _0x4118fe;});}return _0x5c0219;})[_0xd425('0x2a')](respondWithResult(_0x5bfac6,0xc9))[_0xd425('0x4f')](handleError(_0x5bfac6,null));};exports[_0xd425('0x29')]=function(_0x7b1080,_0x1c80c2){if(_0x7b1080[_0xd425('0x54')]['id']){delete _0x7b1080[_0xd425('0x54')]['id'];}return db['AnalyticMetric']['find']({'where':{'id':_0x7b1080['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x1c80c2,null))[_0xd425('0x2a')](saveUpdates(_0x7b1080[_0xd425('0x54')],null))[_0xd425('0x2a')](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['destroy']=function(_0x499a60,_0x5e1294){return db[_0xd425('0x35')][_0xd425('0x52')]({'where':{'id':_0x499a60['params']['id']}})[_0xd425('0x2a')](handleEntityNotFound(_0x5e1294,null))[_0xd425('0x2a')](removeEntity(_0x5e1294,null))[_0xd425('0x4f')](handleError(_0x5e1294,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x38189c,_0x4e89a5){var _0x133119=function(_0x3871e9){while(--_0x3871e9){_0x38189c['push'](_0x38189c['shift']());}};_0x133119(++_0x4e89a5);}(_0x55ca,0x126));var _0xa55c=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x55ca[_0x24c405];return _0x383aef;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ffbc6c7..f953a0f 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 _0xbd0e=['path','rimraf','exports','define','AnalyticMetric','analytics_metrics','util','api','moment','bluebird','request-promise'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0xbd0e,0x187));var _0xebd0=function(_0x3f4a75,_0x1ff97e){_0x3f4a75=_0x3f4a75-0x0;var _0x1cd60d=_0xbd0e[_0x3f4a75];return _0x1cd60d;};'use strict';var _=require('lodash');var util=require(_0xebd0('0x0'));var logger=require('../../config/logger')(_0xebd0('0x1'));var moment=require(_0xebd0('0x2'));var BPromise=require(_0xebd0('0x3'));var rp=require(_0xebd0('0x4'));var fs=require('fs');var path=require(_0xebd0('0x5'));var rimraf=require(_0xebd0('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xebd0('0x7')]=function(_0x3ce784,_0x2f0192){return _0x3ce784[_0xebd0('0x8')](_0xebd0('0x9'),attributes,{'tableName':_0xebd0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e4d=['rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','request-promise','path'];(function(_0x4a746e,_0x3166c0){var _0x451a87=function(_0x28903b){while(--_0x28903b){_0x4a746e['push'](_0x4a746e['shift']());}};_0x451a87(++_0x3166c0);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x16cb73,_0x472970){_0x16cb73=_0x16cb73-0x0;var _0x5060b5=_0x3e4d[_0x16cb73];return _0x5060b5;};'use strict';var _=require(_0xd3e4('0x0'));var util=require('util');var logger=require(_0xd3e4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd3e4('0x2'));var fs=require('fs');var path=require(_0xd3e4('0x3'));var rimraf=require(_0xd3e4('0x4'));var config=require('../../config/environment');var attributes=require(_0xd3e4('0x5'));module['exports']=function(_0x4b9a10,_0x7b42fe){return _0x4b9a10[_0xd3e4('0x6')](_0xd3e4('0x7'),attributes,{'tableName':_0xd3e4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c818a75..92c8193 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 _0x1ce5=['code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x48733a,_0x1e10d0){var _0x473636=function(_0x139234){while(--_0x139234){_0x48733a['push'](_0x48733a['shift']());}};_0x473636(++_0x1e10d0);}(_0x1ce5,0x1bc));var _0x51ce=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x1ce5[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51ce('0x0'));var BPromise=require('bluebird');var rs=require(_0x51ce('0x1'));var fs=require('fs');var Redis=require(_0x51ce('0x2'));var db=require(_0x51ce('0x3'))['db'];var utils=require(_0x51ce('0x4'));var logger=require(_0x51ce('0x5'))(_0x51ce('0x6'));var config=require(_0x51ce('0x7'));var jayson=require(_0x51ce('0x8'));var client=jayson[_0x51ce('0x9')][_0x51ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c75a5,_0x9f4b6f,_0x4be9d5){return new BPromise(function(_0x1d7d87,_0x4c95c6){return client['request'](_0x4c75a5,_0x4be9d5)[_0x51ce('0xb')](function(_0x4851c1){logger['info'](_0x51ce('0xc'),_0x9f4b6f,_0x51ce('0xd'));logger[_0x51ce('0xe')](_0x51ce('0xf'),_0x9f4b6f,_0x51ce('0xd'),JSON[_0x51ce('0x10')](_0x4851c1));if(_0x4851c1[_0x51ce('0x11')]){if(_0x4851c1[_0x51ce('0x11')][_0x51ce('0x12')]===0x1f4){logger[_0x51ce('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x9f4b6f,_0x4851c1[_0x51ce('0x11')][_0x51ce('0x13')]);return _0x4c95c6(_0x4851c1[_0x51ce('0x11')][_0x51ce('0x13')]);}logger['error'](_0x51ce('0xc'),_0x9f4b6f,_0x4851c1[_0x51ce('0x11')][_0x51ce('0x13')]);return _0x1d7d87(_0x4851c1['error'][_0x51ce('0x13')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x9f4b6f,_0x51ce('0xd'));_0x1d7d87(_0x4851c1[_0x51ce('0x14')]['message']);}})[_0x51ce('0x15')](function(_0x38e641){logger[_0x51ce('0x11')](_0x51ce('0xc'),_0x9f4b6f,_0x38e641);_0x4c95c6(_0x38e641);});});} \ No newline at end of file +var _0x8b9f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x1cf1c6,_0xaf1688){var _0x4ecf79=function(_0x186cca){while(--_0x186cca){_0x1cf1c6['push'](_0x1cf1c6['shift']());}};_0x4ecf79(++_0xaf1688);}(_0x8b9f,0x11a));var _0xf8b9=function(_0x57db4c,_0x8f9084){_0x57db4c=_0x57db4c-0x0;var _0x1758f2=_0x8b9f[_0x57db4c];return _0x1758f2;};'use strict';var _=require('lodash');var util=require(_0xf8b9('0x0'));var moment=require(_0xf8b9('0x1'));var BPromise=require('bluebird');var rs=require(_0xf8b9('0x2'));var fs=require('fs');var Redis=require(_0xf8b9('0x3'));var db=require(_0xf8b9('0x4'))['db'];var utils=require(_0xf8b9('0x5'));var logger=require(_0xf8b9('0x6'))(_0xf8b9('0x7'));var config=require(_0xf8b9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8b9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e3ae1,_0x1827fd,_0x202a1e){return new BPromise(function(_0xca0310,_0x3d05ee){return client[_0xf8b9('0xa')](_0x1e3ae1,_0x202a1e)[_0xf8b9('0xb')](function(_0x3bba60){logger[_0xf8b9('0xc')](_0xf8b9('0xd'),_0x1827fd,_0xf8b9('0xe'));logger[_0xf8b9('0xf')](_0xf8b9('0x10'),_0x1827fd,_0xf8b9('0xe'),JSON[_0xf8b9('0x11')](_0x3bba60));if(_0x3bba60[_0xf8b9('0x12')]){if(_0x3bba60[_0xf8b9('0x12')][_0xf8b9('0x13')]===0x1f4){logger['error'](_0xf8b9('0xd'),_0x1827fd,_0x3bba60[_0xf8b9('0x12')][_0xf8b9('0x14')]);return _0x3d05ee(_0x3bba60[_0xf8b9('0x12')]['message']);}logger[_0xf8b9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x1827fd,_0x3bba60[_0xf8b9('0x12')][_0xf8b9('0x14')]);return _0xca0310(_0x3bba60['error'][_0xf8b9('0x14')]);}else{logger[_0xf8b9('0xc')](_0xf8b9('0xd'),_0x1827fd,'request\x20sent');_0xca0310(_0x3bba60['result'][_0xf8b9('0x14')]);}})[_0xf8b9('0x15')](function(_0x517cfd){logger[_0xf8b9('0x12')](_0xf8b9('0xd'),_0x1827fd,_0x517cfd);_0x3d05ee(_0x517cfd);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 10a0afb..8bfe5ec 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 _0xf776=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','exports'];(function(_0x5da440,_0x50fe36){var _0x231f3b=function(_0x19695e){while(--_0x19695e){_0x5da440['push'](_0x5da440['shift']());}};_0x231f3b(++_0x50fe36);}(_0xf776,0x169));var _0x6f77=function(_0x27cc7f,_0x3529e8){_0x27cc7f=_0x27cc7f-0x0;var _0x585b31=_0xf776[_0x27cc7f];return _0x585b31;};'use strict';var multer=require(_0x6f77('0x0'));var util=require('util');var path=require(_0x6f77('0x1'));var timeout=require(_0x6f77('0x2'));var express=require('express');var router=express[_0x6f77('0x3')]();var fs_extra=require(_0x6f77('0x4'));var auth=require(_0x6f77('0x5'));var interaction=require(_0x6f77('0x6'));var config=require('../../config/environment');var controller=require(_0x6f77('0x7'));router['get']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0x9')]);router[_0x6f77('0xa')](_0x6f77('0xb'),auth['isAuthenticated'](),controller[_0x6f77('0xc')]);router['post']('/',auth[_0x6f77('0x8')](),controller[_0x6f77('0xd')]);router[_0x6f77('0xe')](_0x6f77('0xb'),auth['isAuthenticated'](),controller[_0x6f77('0xf')]);router[_0x6f77('0x10')](_0x6f77('0xb'),auth[_0x6f77('0x8')](),controller[_0x6f77('0x11')]);module[_0x6f77('0x12')]=router; \ No newline at end of file +var _0x4a80=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4a80,0xbe));var _0x04a8=function(_0x4deb98,_0x29ebdd){_0x4deb98=_0x4deb98-0x0;var _0x2c5f93=_0x4a80[_0x4deb98];return _0x2c5f93;};'use strict';var multer=require(_0x04a8('0x0'));var util=require('util');var path=require(_0x04a8('0x1'));var timeout=require(_0x04a8('0x2'));var express=require('express');var router=express[_0x04a8('0x3')]();var fs_extra=require(_0x04a8('0x4'));var auth=require(_0x04a8('0x5'));var interaction=require(_0x04a8('0x6'));var config=require(_0x04a8('0x7'));var controller=require(_0x04a8('0x8'));router[_0x04a8('0x9')]('/',auth[_0x04a8('0xa')](),controller[_0x04a8('0xb')]);router[_0x04a8('0x9')]('/:id',auth[_0x04a8('0xa')](),controller[_0x04a8('0xc')]);router[_0x04a8('0xd')]('/',auth[_0x04a8('0xa')](),controller[_0x04a8('0xe')]);router[_0x04a8('0xf')](_0x04a8('0x10'),auth[_0x04a8('0xa')](),controller[_0x04a8('0x11')]);router[_0x04a8('0x12')]('/:id',auth[_0x04a8('0xa')](),controller[_0x04a8('0x13')]);module[_0x04a8('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 947be8f..9dbf18c 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 _0xe34b=['sequelize','exports','TEXT'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xe34b,0x8a));var _0xbe34=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xe34b[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0xbe34('0x0'));module[_0xbe34('0x1')]={'tree':{'type':Sequelize[_0xbe34('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7d7a=['TEXT','sequelize','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7d7a,0x1ea));var _0xa7d7=function(_0x311005,_0x3cb529){_0x311005=_0x311005-0x0;var _0xf8e70d=_0x7d7a[_0x311005];return _0xf8e70d;};'use strict';var Sequelize=require(_0xa7d7('0x0'));module[_0xa7d7('0x1')]={'tree':{'type':Sequelize[_0xa7d7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b61536a..75501bf 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 _0x8c60=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','AnalyticTreeReport','rawAttributes','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x487a9c,_0x47402c){var _0x47d47d=function(_0x157236){while(--_0x157236){_0x487a9c['push'](_0x487a9c['shift']());}};_0x47d47d(++_0x47402c);}(_0x8c60,0x16d));var _0x08c6=function(_0x50beba,_0x534a49){_0x50beba=_0x50beba-0x0;var _0x1c94e6=_0x8c60[_0x50beba];return _0x1c94e6;};'use strict';var emlformat=require(_0x08c6('0x0'));var rimraf=require(_0x08c6('0x1'));var zipdir=require(_0x08c6('0x2'));var jsonpatch=require(_0x08c6('0x3'));var rp=require(_0x08c6('0x4'));var moment=require(_0x08c6('0x5'));var BPromise=require(_0x08c6('0x6'));var Mustache=require(_0x08c6('0x7'));var util=require('util');var path=require(_0x08c6('0x8'));var sox=require(_0x08c6('0x9'));var csv=require('to-csv');var ejs=require(_0x08c6('0xa'));var fs=require('fs');var fs_extra=require(_0x08c6('0xb'));var _=require(_0x08c6('0xc'));var squel=require(_0x08c6('0xd'));var crypto=require(_0x08c6('0xe'));var jsforce=require(_0x08c6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x08c6('0x10'));var querystring=require(_0x08c6('0x11'));var Papa=require(_0x08c6('0x12'));var Redis=require('ioredis');var authService=require(_0x08c6('0x13'));var qs=require(_0x08c6('0x14'));var as=require(_0x08c6('0x15'));var hardwareService=require(_0x08c6('0x16'));var logger=require(_0x08c6('0x17'))(_0x08c6('0x18'));var utils=require(_0x08c6('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x08c6('0x1a'));var db=require(_0x08c6('0x1b'))['db'];function respondWithStatusCode(_0x4627c4,_0x115e04){_0x115e04=_0x115e04||0xcc;return function(_0x5b9955){if(_0x5b9955){return _0x4627c4[_0x08c6('0x1c')](_0x115e04);}return _0x4627c4[_0x08c6('0x1d')](_0x115e04)[_0x08c6('0x1e')]();};}function respondWithResult(_0xbb16f1,_0x48448d){_0x48448d=_0x48448d||0xc8;return function(_0x294d25){if(_0x294d25){return _0xbb16f1[_0x08c6('0x1d')](_0x48448d)[_0x08c6('0x1f')](_0x294d25);}};}function respondWithFilteredResult(_0xcab2c4,_0x47fa9c){return function(_0x26c682){if(_0x26c682){var _0x5bb704=typeof _0x47fa9c[_0x08c6('0x20')]===_0x08c6('0x21')&&typeof _0x47fa9c[_0x08c6('0x22')]===_0x08c6('0x21');var _0x1ba677=_0x26c682[_0x08c6('0x23')];var _0x40aa20=_0x5bb704?0x0:_0x47fa9c[_0x08c6('0x20')];var _0x4c068c=_0x5bb704?_0x26c682[_0x08c6('0x23')]:_0x47fa9c['offset']+_0x47fa9c[_0x08c6('0x22')];var _0x56dc6;if(_0x4c068c>=_0x1ba677){_0x4c068c=_0x1ba677;_0x56dc6=0xc8;}else{_0x56dc6=0xce;}_0xcab2c4[_0x08c6('0x1d')](_0x56dc6);return _0xcab2c4[_0x08c6('0x24')](_0x08c6('0x25'),_0x40aa20+'-'+_0x4c068c+'/'+_0x1ba677)[_0x08c6('0x1f')](_0x26c682);}return null;};}function patchUpdates(_0x5e1c91){return function(_0x161d6e){try{jsonpatch[_0x08c6('0x26')](_0x161d6e,_0x5e1c91,!![]);}catch(_0x534f31){return BPromise[_0x08c6('0x27')](_0x534f31);}return _0x161d6e[_0x08c6('0x28')]();};}function saveUpdates(_0x29ec9b,_0x5010b5){return function(_0x5e226b){if(_0x5e226b){return _0x5e226b[_0x08c6('0x29')](_0x29ec9b)[_0x08c6('0x2a')](function(_0x12a80b){return _0x12a80b;});}return null;};}function removeEntity(_0x207ca8,_0x586775){return function(_0x37668e){if(_0x37668e){return _0x37668e[_0x08c6('0x2b')]()[_0x08c6('0x2a')](function(){_0x207ca8[_0x08c6('0x1d')](0xcc)[_0x08c6('0x1e')]();});}};}function handleEntityNotFound(_0x57e47,_0x3dc872){return function(_0x4ffbf7){if(!_0x4ffbf7){_0x57e47[_0x08c6('0x1c')](0x194);}return _0x4ffbf7;};}function handleError(_0x171660,_0x4b48cc){_0x4b48cc=_0x4b48cc||0x1f4;return function(_0x5b88bd){logger['error'](_0x5b88bd[_0x08c6('0x2c')]);if(_0x5b88bd[_0x08c6('0x2d')]){delete _0x5b88bd['name'];}_0x171660[_0x08c6('0x1d')](_0x4b48cc)['send'](_0x5b88bd);};}exports[_0x08c6('0x2e')]=function(_0x4af429,_0x2f472c){var _0x25e04f={},_0x47220e={},_0x303b66={'count':0x0,'rows':[]};var _0x3e59df=_[_0x08c6('0x2f')](db[_0x08c6('0x30')][_0x08c6('0x31')],function(_0x5d8cef){return{'name':_0x5d8cef['fieldName'],'type':_0x5d8cef[_0x08c6('0x32')]['key']};});_0x47220e[_0x08c6('0x33')]=_[_0x08c6('0x2f')](_0x3e59df,'name');_0x47220e['query']=_[_0x08c6('0x34')](_0x4af429[_0x08c6('0x35')]);_0x47220e['filters']=_['intersection'](_0x47220e[_0x08c6('0x33')],_0x47220e[_0x08c6('0x35')]);_0x25e04f[_0x08c6('0x36')]=_[_0x08c6('0x37')](_0x47220e['model'],qs[_0x08c6('0x38')](_0x4af429[_0x08c6('0x35')][_0x08c6('0x38')]));_0x25e04f['attributes']=_0x25e04f['attributes'][_0x08c6('0x39')]?_0x25e04f[_0x08c6('0x36')]:_0x47220e[_0x08c6('0x33')];if(!_0x4af429[_0x08c6('0x35')][_0x08c6('0x3a')](_0x08c6('0x3b'))){_0x25e04f['limit']=qs[_0x08c6('0x22')](_0x4af429[_0x08c6('0x35')][_0x08c6('0x22')]);_0x25e04f[_0x08c6('0x20')]=qs[_0x08c6('0x20')](_0x4af429[_0x08c6('0x35')][_0x08c6('0x20')]);}_0x25e04f[_0x08c6('0x3c')]=qs[_0x08c6('0x3d')](_0x4af429['query']['sort']);_0x25e04f['where']=qs['filters'](_[_0x08c6('0x3e')](_0x4af429[_0x08c6('0x35')],_0x47220e[_0x08c6('0x3f')]),_0x3e59df);if(_0x4af429[_0x08c6('0x35')][_0x08c6('0x40')]){_0x25e04f[_0x08c6('0x41')]=_[_0x08c6('0x42')](_0x25e04f[_0x08c6('0x41')],{'$or':_[_0x08c6('0x2f')](_0x3e59df,function(_0x474757){if(_0x474757[_0x08c6('0x32')]!==_0x08c6('0x43')){var _0x4c14a4={};_0x4c14a4[_0x474757['name']]={'$like':'%'+_0x4af429[_0x08c6('0x35')][_0x08c6('0x40')]+'%'};return _0x4c14a4;}})});}_0x25e04f=_['merge']({},_0x25e04f,_0x4af429[_0x08c6('0x44')]);var _0x5779cc={'where':_0x25e04f[_0x08c6('0x41')]};return db['AnalyticTreeReport'][_0x08c6('0x23')](_0x5779cc)[_0x08c6('0x2a')](function(_0x4c7a30){_0x303b66[_0x08c6('0x23')]=_0x4c7a30;if(_0x4af429[_0x08c6('0x35')][_0x08c6('0x45')]){_0x25e04f[_0x08c6('0x46')]=[{'all':!![]}];}return db[_0x08c6('0x30')][_0x08c6('0x47')](_0x25e04f);})['then'](function(_0x3993c6){_0x303b66['rows']=_0x3993c6;return _0x303b66;})['then'](respondWithFilteredResult(_0x2f472c,_0x25e04f))['catch'](handleError(_0x2f472c,null));};exports[_0x08c6('0x48')]=function(_0x2319df,_0x30c192){var _0x17420c={'raw':!![],'where':{'id':_0x2319df[_0x08c6('0x49')]['id']}},_0x2516cf={};_0x2516cf[_0x08c6('0x33')]=_[_0x08c6('0x34')](db['AnalyticTreeReport']['rawAttributes']);_0x2516cf[_0x08c6('0x35')]=_[_0x08c6('0x34')](_0x2319df[_0x08c6('0x35')]);_0x2516cf[_0x08c6('0x3f')]=_[_0x08c6('0x37')](_0x2516cf[_0x08c6('0x33')],_0x2516cf['query']);_0x17420c[_0x08c6('0x36')]=_[_0x08c6('0x37')](_0x2516cf[_0x08c6('0x33')],qs['fields'](_0x2319df[_0x08c6('0x35')][_0x08c6('0x38')]));_0x17420c[_0x08c6('0x36')]=_0x17420c['attributes']['length']?_0x17420c['attributes']:_0x2516cf[_0x08c6('0x33')];if(_0x2319df[_0x08c6('0x35')][_0x08c6('0x45')]){_0x17420c[_0x08c6('0x46')]=[{'all':!![]}];}_0x17420c=_['merge']({},_0x17420c,_0x2319df['options']);return db['AnalyticTreeReport'][_0x08c6('0x4a')](_0x17420c)[_0x08c6('0x2a')](handleEntityNotFound(_0x30c192,null))[_0x08c6('0x2a')](respondWithResult(_0x30c192,null))[_0x08c6('0x4b')](handleError(_0x30c192,null));};exports[_0x08c6('0x4c')]=function(_0xbb4542,_0x3e6a6d){return db[_0x08c6('0x30')][_0x08c6('0x4c')](_0xbb4542['body'],{})['then'](respondWithResult(_0x3e6a6d,0xc9))[_0x08c6('0x4b')](handleError(_0x3e6a6d,null));};exports['update']=function(_0xaa230e,_0x1e5041){if(_0xaa230e[_0x08c6('0x4d')]['id']){delete _0xaa230e['body']['id'];}return db[_0x08c6('0x30')][_0x08c6('0x4a')]({'where':{'id':_0xaa230e[_0x08c6('0x49')]['id']}})[_0x08c6('0x2a')](handleEntityNotFound(_0x1e5041,null))['then'](saveUpdates(_0xaa230e[_0x08c6('0x4d')],null))[_0x08c6('0x2a')](respondWithResult(_0x1e5041,null))['catch'](handleError(_0x1e5041,null));};exports[_0x08c6('0x2b')]=function(_0x11de80,_0x208597){return db[_0x08c6('0x30')][_0x08c6('0x4a')]({'where':{'id':_0x11de80[_0x08c6('0x49')]['id']}})[_0x08c6('0x2a')](handleEntityNotFound(_0x208597,null))[_0x08c6('0x2a')](removeEntity(_0x208597,null))[_0x08c6('0x4b')](handleError(_0x208597,null));}; \ No newline at end of file +var _0x1da8=['find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','rows','catch','show','params','include'];(function(_0x3278f3,_0x235c17){var _0x519768=function(_0x2839be){while(--_0x2839be){_0x3278f3['push'](_0x3278f3['shift']());}};_0x519768(++_0x235c17);}(_0x1da8,0x1d1));var _0x81da=function(_0x4fc192,_0x6aa2f4){_0x4fc192=_0x4fc192-0x0;var _0x3b2fe2=_0x1da8[_0x4fc192];return _0x3b2fe2;};'use strict';var emlformat=require(_0x81da('0x0'));var rimraf=require(_0x81da('0x1'));var zipdir=require(_0x81da('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81da('0x3'));var moment=require(_0x81da('0x4'));var BPromise=require(_0x81da('0x5'));var Mustache=require('mustache');var util=require(_0x81da('0x6'));var path=require('path');var sox=require(_0x81da('0x7'));var csv=require(_0x81da('0x8'));var ejs=require(_0x81da('0x9'));var fs=require('fs');var fs_extra=require(_0x81da('0xa'));var _=require(_0x81da('0xb'));var squel=require('squel');var crypto=require(_0x81da('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x81da('0x8'));var querystring=require(_0x81da('0xd'));var Papa=require(_0x81da('0xe'));var Redis=require(_0x81da('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x81da('0x10'));var as=require(_0x81da('0x11'));var hardwareService=require(_0x81da('0x12'));var logger=require('../../config/logger')(_0x81da('0x13'));var utils=require(_0x81da('0x14'));var config=require(_0x81da('0x15'));var licenseUtil=require(_0x81da('0x16'));var db=require(_0x81da('0x17'))['db'];function respondWithStatusCode(_0x26783a,_0x5a843e){_0x5a843e=_0x5a843e||0xcc;return function(_0x37c10e){if(_0x37c10e){return _0x26783a['sendStatus'](_0x5a843e);}return _0x26783a[_0x81da('0x18')](_0x5a843e)[_0x81da('0x19')]();};}function respondWithResult(_0x3fac64,_0x3f46cd){_0x3f46cd=_0x3f46cd||0xc8;return function(_0x366ce4){if(_0x366ce4){return _0x3fac64['status'](_0x3f46cd)[_0x81da('0x1a')](_0x366ce4);}};}function respondWithFilteredResult(_0x56fcca,_0x3584a1){return function(_0x610afc){if(_0x610afc){var _0x105969=typeof _0x3584a1['offset']==='undefined'&&typeof _0x3584a1[_0x81da('0x1b')]===_0x81da('0x1c');var _0x576d6e=_0x610afc[_0x81da('0x1d')];var _0x313f3c=_0x105969?0x0:_0x3584a1[_0x81da('0x1e')];var _0x5139af=_0x105969?_0x610afc[_0x81da('0x1d')]:_0x3584a1[_0x81da('0x1e')]+_0x3584a1[_0x81da('0x1b')];var _0x23f2c9;if(_0x5139af>=_0x576d6e){_0x5139af=_0x576d6e;_0x23f2c9=0xc8;}else{_0x23f2c9=0xce;}_0x56fcca[_0x81da('0x18')](_0x23f2c9);return _0x56fcca[_0x81da('0x1f')](_0x81da('0x20'),_0x313f3c+'-'+_0x5139af+'/'+_0x576d6e)[_0x81da('0x1a')](_0x610afc);}return null;};}function patchUpdates(_0x8b604b){return function(_0x46d0e7){try{jsonpatch[_0x81da('0x21')](_0x46d0e7,_0x8b604b,!![]);}catch(_0x297fc4){return BPromise[_0x81da('0x22')](_0x297fc4);}return _0x46d0e7[_0x81da('0x23')]();};}function saveUpdates(_0x4d22fe,_0x5d2a29){return function(_0x46ade4){if(_0x46ade4){return _0x46ade4[_0x81da('0x24')](_0x4d22fe)[_0x81da('0x25')](function(_0x23a06e){return _0x23a06e;});}return null;};}function removeEntity(_0xcb4010,_0x512f7b){return function(_0x5c6df4){if(_0x5c6df4){return _0x5c6df4[_0x81da('0x26')]()[_0x81da('0x25')](function(){_0xcb4010[_0x81da('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x683aa6,_0x595181){return function(_0x3bb18f){if(!_0x3bb18f){_0x683aa6[_0x81da('0x27')](0x194);}return _0x3bb18f;};}function handleError(_0x192837,_0x3436ac){_0x3436ac=_0x3436ac||0x1f4;return function(_0x7167bf){logger[_0x81da('0x28')](_0x7167bf[_0x81da('0x29')]);if(_0x7167bf[_0x81da('0x2a')]){delete _0x7167bf[_0x81da('0x2a')];}_0x192837['status'](_0x3436ac)[_0x81da('0x2b')](_0x7167bf);};}exports[_0x81da('0x2c')]=function(_0x1928c2,_0x17010b){var _0x161df8={},_0x58cba8={},_0x2b8be2={'count':0x0,'rows':[]};var _0x44384a=_[_0x81da('0x2d')](db[_0x81da('0x2e')][_0x81da('0x2f')],function(_0x1ef45c){return{'name':_0x1ef45c[_0x81da('0x30')],'type':_0x1ef45c[_0x81da('0x31')][_0x81da('0x32')]};});_0x58cba8[_0x81da('0x33')]=_[_0x81da('0x2d')](_0x44384a,_0x81da('0x2a'));_0x58cba8[_0x81da('0x34')]=_[_0x81da('0x35')](_0x1928c2[_0x81da('0x34')]);_0x58cba8[_0x81da('0x36')]=_['intersection'](_0x58cba8['model'],_0x58cba8[_0x81da('0x34')]);_0x161df8['attributes']=_[_0x81da('0x37')](_0x58cba8[_0x81da('0x33')],qs['fields'](_0x1928c2[_0x81da('0x34')][_0x81da('0x38')]));_0x161df8['attributes']=_0x161df8[_0x81da('0x39')][_0x81da('0x3a')]?_0x161df8['attributes']:_0x58cba8[_0x81da('0x33')];if(!_0x1928c2[_0x81da('0x34')]['hasOwnProperty'](_0x81da('0x3b'))){_0x161df8[_0x81da('0x1b')]=qs['limit'](_0x1928c2[_0x81da('0x34')]['limit']);_0x161df8['offset']=qs['offset'](_0x1928c2[_0x81da('0x34')][_0x81da('0x1e')]);}_0x161df8[_0x81da('0x3c')]=qs['sort'](_0x1928c2[_0x81da('0x34')][_0x81da('0x3d')]);_0x161df8[_0x81da('0x3e')]=qs[_0x81da('0x36')](_[_0x81da('0x3f')](_0x1928c2['query'],_0x58cba8[_0x81da('0x36')]),_0x44384a);if(_0x1928c2[_0x81da('0x34')]['filter']){_0x161df8[_0x81da('0x3e')]=_['merge'](_0x161df8[_0x81da('0x3e')],{'$or':_['map'](_0x44384a,function(_0x45f0ac){if(_0x45f0ac[_0x81da('0x31')]!==_0x81da('0x40')){var _0x4e1569={};_0x4e1569[_0x45f0ac['name']]={'$like':'%'+_0x1928c2['query'][_0x81da('0x41')]+'%'};return _0x4e1569;}})});}_0x161df8=_[_0x81da('0x42')]({},_0x161df8,_0x1928c2[_0x81da('0x43')]);var _0x4ecab8={'where':_0x161df8[_0x81da('0x3e')]};return db[_0x81da('0x2e')][_0x81da('0x1d')](_0x4ecab8)[_0x81da('0x25')](function(_0x39ca2e){_0x2b8be2[_0x81da('0x1d')]=_0x39ca2e;if(_0x1928c2['query'][_0x81da('0x44')]){_0x161df8['include']=[{'all':!![]}];}return db[_0x81da('0x2e')]['findAll'](_0x161df8);})[_0x81da('0x25')](function(_0x50ac8d){_0x2b8be2[_0x81da('0x45')]=_0x50ac8d;return _0x2b8be2;})[_0x81da('0x25')](respondWithFilteredResult(_0x17010b,_0x161df8))[_0x81da('0x46')](handleError(_0x17010b,null));};exports[_0x81da('0x47')]=function(_0x343ba6,_0x2b50a0){var _0x10804b={'raw':!![],'where':{'id':_0x343ba6[_0x81da('0x48')]['id']}},_0x21dceb={};_0x21dceb[_0x81da('0x33')]=_[_0x81da('0x35')](db[_0x81da('0x2e')][_0x81da('0x2f')]);_0x21dceb[_0x81da('0x34')]=_[_0x81da('0x35')](_0x343ba6['query']);_0x21dceb[_0x81da('0x36')]=_['intersection'](_0x21dceb[_0x81da('0x33')],_0x21dceb[_0x81da('0x34')]);_0x10804b[_0x81da('0x39')]=_[_0x81da('0x37')](_0x21dceb['model'],qs[_0x81da('0x38')](_0x343ba6[_0x81da('0x34')][_0x81da('0x38')]));_0x10804b[_0x81da('0x39')]=_0x10804b[_0x81da('0x39')][_0x81da('0x3a')]?_0x10804b['attributes']:_0x21dceb[_0x81da('0x33')];if(_0x343ba6[_0x81da('0x34')][_0x81da('0x44')]){_0x10804b[_0x81da('0x49')]=[{'all':!![]}];}_0x10804b=_[_0x81da('0x42')]({},_0x10804b,_0x343ba6[_0x81da('0x43')]);return db[_0x81da('0x2e')][_0x81da('0x4a')](_0x10804b)[_0x81da('0x25')](handleEntityNotFound(_0x2b50a0,null))[_0x81da('0x25')](respondWithResult(_0x2b50a0,null))[_0x81da('0x46')](handleError(_0x2b50a0,null));};exports['create']=function(_0x10c777,_0x3bb073){return db[_0x81da('0x2e')][_0x81da('0x4b')](_0x10c777[_0x81da('0x4c')],{})[_0x81da('0x25')](respondWithResult(_0x3bb073,0xc9))[_0x81da('0x46')](handleError(_0x3bb073,null));};exports[_0x81da('0x24')]=function(_0x54b400,_0x3d361c){if(_0x54b400['body']['id']){delete _0x54b400[_0x81da('0x4c')]['id'];}return db[_0x81da('0x2e')]['find']({'where':{'id':_0x54b400[_0x81da('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d361c,null))[_0x81da('0x25')](saveUpdates(_0x54b400[_0x81da('0x4c')],null))['then'](respondWithResult(_0x3d361c,null))['catch'](handleError(_0x3d361c,null));};exports[_0x81da('0x26')]=function(_0x1cfe09,_0xe25a30){return db[_0x81da('0x2e')]['find']({'where':{'id':_0x1cfe09['params']['id']}})[_0x81da('0x25')](handleEntityNotFound(_0xe25a30,null))[_0x81da('0x25')](removeEntity(_0xe25a30,null))[_0x81da('0x46')](handleError(_0xe25a30,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index efa4095..adb1511 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 _0xd3cc=['../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xd3cc,0xca));var _0xcd3c=function(_0x16a097,_0x1459ce){_0x16a097=_0x16a097-0x0;var _0x20e89d=_0xd3cc[_0x16a097];return _0x20e89d;};'use strict';var _=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var logger=require('../../config/logger')(_0xcd3c('0x2'));var moment=require(_0xcd3c('0x3'));var BPromise=require(_0xcd3c('0x4'));var rp=require(_0xcd3c('0x5'));var fs=require('fs');var path=require(_0xcd3c('0x6'));var rimraf=require(_0xcd3c('0x7'));var config=require(_0xcd3c('0x8'));var attributes=require(_0xcd3c('0x9'));module[_0xcd3c('0xa')]=function(_0x4a73eb,_0x5a7d8f){return _0x4a73eb[_0xcd3c('0xb')](_0xcd3c('0xc'),attributes,{'tableName':_0xcd3c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5211=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x5211,0x110));var _0x1521=function(_0x4a05e7,_0x22f0df){_0x4a05e7=_0x4a05e7-0x0;var _0x126423=_0x5211[_0x4a05e7];return _0x126423;};'use strict';var _=require(_0x1521('0x0'));var util=require(_0x1521('0x1'));var logger=require(_0x1521('0x2'))(_0x1521('0x3'));var moment=require(_0x1521('0x4'));var BPromise=require(_0x1521('0x5'));var rp=require(_0x1521('0x6'));var fs=require('fs');var path=require(_0x1521('0x7'));var rimraf=require(_0x1521('0x8'));var config=require(_0x1521('0x9'));var attributes=require(_0x1521('0xa'));module[_0x1521('0xb')]=function(_0x1da609,_0x4fbb89){return _0x1da609[_0x1521('0xc')](_0x1521('0xd'),attributes,{'tableName':_0x1521('0xe'),'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 5daeeb7..e09edd2 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 _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(_0x19df0b,_0x388e9e){var _0x1bc789=function(_0x4c5f4c){while(--_0x4c5f4c){_0x19df0b['push'](_0x19df0b['shift']());}};_0x1bc789(++_0x388e9e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e6d9c,_0x3c52a7){_0x3e6d9c=_0x3e6d9c-0x0;var _0x5a92a6=_0x5f2f[_0x3e6d9c];return _0x5a92a6;};'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 +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(_0x39b877,_0x522f3d){var _0x52adf1=function(_0x415c19){while(--_0x415c19){_0x39b877['push'](_0x39b877['shift']());}};_0x52adf1(++_0x522f3d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2bbd23,_0x43c40f){_0x2bbd23=_0x2bbd23-0x0;var _0x4dc031=_0x5f2f[_0x2bbd23];return _0x4dc031;};'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 8475530..a5c8c8d 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 _0x5460=['../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x5460,0x1f3));var _0x0546=function(_0x1fd0c5,_0xacc028){_0x1fd0c5=_0x1fd0c5-0x0;var _0x35167a=_0x5460[_0x1fd0c5];return _0x35167a;};'use strict';var multer=require('multer');var util=require(_0x0546('0x0'));var path=require(_0x0546('0x1'));var timeout=require('connect-timeout');var express=require(_0x0546('0x2'));var router=express['Router']();var fs_extra=require(_0x0546('0x3'));var auth=require(_0x0546('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0546('0x5'));var controller=require(_0x0546('0x6'));router[_0x0546('0x7')]('/',auth['isAuthenticated'](),controller[_0x0546('0x8')]);router['get'](_0x0546('0x9'),auth[_0x0546('0xa')](),controller[_0x0546('0xb')]);router[_0x0546('0xc')]('/',auth[_0x0546('0xa')](),controller[_0x0546('0xd')]);router[_0x0546('0xe')](_0x0546('0x9'),auth[_0x0546('0xa')](),controller[_0x0546('0xf')]);router['delete'](_0x0546('0x9'),auth['isAuthenticated'](),controller[_0x0546('0x10')]);module[_0x0546('0x11')]=router; \ No newline at end of file +var _0x433c=['delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x574d9b,_0x2063da){var _0x31d2a5=function(_0x97ce4c){while(--_0x97ce4c){_0x574d9b['push'](_0x574d9b['shift']());}};_0x31d2a5(++_0x2063da);}(_0x433c,0xe5));var _0xc433=function(_0x2166a3,_0x237c50){_0x2166a3=_0x2166a3-0x0;var _0x260035=_0x433c[_0x2166a3];return _0x260035;};'use strict';var multer=require(_0xc433('0x0'));var util=require('util');var path=require(_0xc433('0x1'));var timeout=require(_0xc433('0x2'));var express=require(_0xc433('0x3'));var router=express[_0xc433('0x4')]();var fs_extra=require(_0xc433('0x5'));var auth=require(_0xc433('0x6'));var interaction=require(_0xc433('0x7'));var config=require('../../config/environment');var controller=require(_0xc433('0x8'));router[_0xc433('0x9')]('/',auth['isAuthenticated'](),controller[_0xc433('0xa')]);router[_0xc433('0x9')](_0xc433('0xb'),auth[_0xc433('0xc')](),controller[_0xc433('0xd')]);router[_0xc433('0xe')]('/',auth[_0xc433('0xc')](),controller[_0xc433('0xf')]);router[_0xc433('0x10')](_0xc433('0xb'),auth[_0xc433('0xc')](),controller[_0xc433('0x11')]);router[_0xc433('0x12')](_0xc433('0xb'),auth[_0xc433('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 96f2412..a78d887 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 _0xe3c5=['sequelize','exports','STRING'];(function(_0x1064bc,_0x206f12){var _0x5edc45=function(_0x5087bd){while(--_0x5087bd){_0x1064bc['push'](_0x1064bc['shift']());}};_0x5edc45(++_0x206f12);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xe3c5[_0x58de4a];return _0x178820;};'use strict';var Sequelize=require(_0x5e3c('0x0'));module[_0x5e3c('0x1')]={'name':{'type':Sequelize[_0x5e3c('0x2')]},'basename':{'type':Sequelize[_0x5e3c('0x2')]},'type':{'type':Sequelize[_0x5e3c('0x2')]}}; \ No newline at end of file +var _0x1280=['sequelize','exports','STRING'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x1280,0xba));var _0x0128=function(_0x30a528,_0x1d04f2){_0x30a528=_0x30a528-0x0;var _0x3e029c=_0x1280[_0x30a528];return _0x3e029c;};'use strict';var Sequelize=require(_0x0128('0x0'));module[_0x0128('0x1')]={'name':{'type':Sequelize[_0x0128('0x2')]},'basename':{'type':Sequelize[_0x0128('0x2')]},'type':{'type':Sequelize[_0x0128('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9daec55..ba772e8 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 _0x7e07=['order','sort','filter','where','merge','VIRTUAL','rows','show','params','includeAll','include','find','catch','clone','omit','createdAt','updatedAt','body','create','destroy','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2880f7,_0x275f7d){var _0x1b9b02=function(_0x5994e9){while(--_0x5994e9){_0x2880f7['push'](_0x2880f7['shift']());}};_0x1b9b02(++_0x275f7d);}(_0x7e07,0x75));var _0x77e0=function(_0x44554c,_0x2d9f24){_0x44554c=_0x44554c-0x0;var _0x2ee60e=_0x7e07[_0x44554c];return _0x2ee60e;};'use strict';var emlformat=require(_0x77e0('0x0'));var rimraf=require(_0x77e0('0x1'));var zipdir=require(_0x77e0('0x2'));var jsonpatch=require(_0x77e0('0x3'));var rp=require(_0x77e0('0x4'));var moment=require('moment');var BPromise=require(_0x77e0('0x5'));var Mustache=require(_0x77e0('0x6'));var util=require(_0x77e0('0x7'));var path=require('path');var sox=require(_0x77e0('0x8'));var csv=require(_0x77e0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77e0('0xa'));var _=require(_0x77e0('0xb'));var squel=require(_0x77e0('0xc'));var crypto=require(_0x77e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77e0('0xe'));var toCsv=require(_0x77e0('0x9'));var querystring=require(_0x77e0('0xf'));var Papa=require(_0x77e0('0x10'));var Redis=require('ioredis');var authService=require(_0x77e0('0x11'));var qs=require(_0x77e0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77e0('0x13'));var logger=require(_0x77e0('0x14'))(_0x77e0('0x15'));var utils=require(_0x77e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x77e0('0x17'));var db=require(_0x77e0('0x18'))['db'];function respondWithStatusCode(_0x77e3ff,_0x41960e){_0x41960e=_0x41960e||0xcc;return function(_0x1e8582){if(_0x1e8582){return _0x77e3ff[_0x77e0('0x19')](_0x41960e);}return _0x77e3ff['status'](_0x41960e)[_0x77e0('0x1a')]();};}function respondWithResult(_0x2e91f3,_0x19adcf){_0x19adcf=_0x19adcf||0xc8;return function(_0x3d6afb){if(_0x3d6afb){return _0x2e91f3[_0x77e0('0x1b')](_0x19adcf)[_0x77e0('0x1c')](_0x3d6afb);}};}function respondWithFilteredResult(_0x11bf05,_0x2cc8be){return function(_0x1e7988){if(_0x1e7988){var _0x271235=typeof _0x2cc8be[_0x77e0('0x1d')]===_0x77e0('0x1e')&&typeof _0x2cc8be[_0x77e0('0x1f')]==='undefined';var _0x451c63=_0x1e7988[_0x77e0('0x20')];var _0x3e5477=_0x271235?0x0:_0x2cc8be['offset'];var _0xd13e1e=_0x271235?_0x1e7988[_0x77e0('0x20')]:_0x2cc8be[_0x77e0('0x1d')]+_0x2cc8be[_0x77e0('0x1f')];var _0x4e4656;if(_0xd13e1e>=_0x451c63){_0xd13e1e=_0x451c63;_0x4e4656=0xc8;}else{_0x4e4656=0xce;}_0x11bf05['status'](_0x4e4656);return _0x11bf05[_0x77e0('0x21')](_0x77e0('0x22'),_0x3e5477+'-'+_0xd13e1e+'/'+_0x451c63)['json'](_0x1e7988);}return null;};}function patchUpdates(_0x23724a){return function(_0x1006a3){try{jsonpatch[_0x77e0('0x23')](_0x1006a3,_0x23724a,!![]);}catch(_0x2da56c){return BPromise[_0x77e0('0x24')](_0x2da56c);}return _0x1006a3[_0x77e0('0x25')]();};}function saveUpdates(_0x76fcb4,_0x9f93d3){return function(_0x44911c){if(_0x44911c){return _0x44911c[_0x77e0('0x26')](_0x76fcb4)[_0x77e0('0x27')](function(_0xa05f85){return _0xa05f85;});}return null;};}function removeEntity(_0x1d2a81,_0x167687){return function(_0x389838){if(_0x389838){return _0x389838['destroy']()[_0x77e0('0x27')](function(){_0x1d2a81['status'](0xcc)[_0x77e0('0x1a')]();});}};}function handleEntityNotFound(_0x152755,_0x493dab){return function(_0xe45e01){if(!_0xe45e01){_0x152755[_0x77e0('0x19')](0x194);}return _0xe45e01;};}function handleError(_0x4e4c3f,_0x1da668){_0x1da668=_0x1da668||0x1f4;return function(_0x167811){logger[_0x77e0('0x28')](_0x167811['stack']);if(_0x167811[_0x77e0('0x29')]){delete _0x167811[_0x77e0('0x29')];}_0x4e4c3f[_0x77e0('0x1b')](_0x1da668)[_0x77e0('0x2a')](_0x167811);};}exports[_0x77e0('0x2b')]=function(_0x569b69,_0x2c5239){var _0x3a5ced={},_0x1f8042={},_0x9a79e5={'count':0x0,'rows':[]};var _0x54a758=_[_0x77e0('0x2c')](db[_0x77e0('0x2d')][_0x77e0('0x2e')],function(_0x2fd14d){return{'name':_0x2fd14d['fieldName'],'type':_0x2fd14d[_0x77e0('0x2f')][_0x77e0('0x30')]};});_0x1f8042[_0x77e0('0x31')]=_[_0x77e0('0x2c')](_0x54a758,_0x77e0('0x29'));_0x1f8042[_0x77e0('0x32')]=_[_0x77e0('0x33')](_0x569b69[_0x77e0('0x32')]);_0x1f8042[_0x77e0('0x34')]=_[_0x77e0('0x35')](_0x1f8042['model'],_0x1f8042[_0x77e0('0x32')]);_0x3a5ced[_0x77e0('0x36')]=_[_0x77e0('0x35')](_0x1f8042[_0x77e0('0x31')],qs[_0x77e0('0x37')](_0x569b69[_0x77e0('0x32')]['fields']));_0x3a5ced[_0x77e0('0x36')]=_0x3a5ced['attributes'][_0x77e0('0x38')]?_0x3a5ced[_0x77e0('0x36')]:_0x1f8042[_0x77e0('0x31')];if(!_0x569b69[_0x77e0('0x32')][_0x77e0('0x39')](_0x77e0('0x3a'))){_0x3a5ced[_0x77e0('0x1f')]=qs['limit'](_0x569b69[_0x77e0('0x32')][_0x77e0('0x1f')]);_0x3a5ced[_0x77e0('0x1d')]=qs[_0x77e0('0x1d')](_0x569b69[_0x77e0('0x32')][_0x77e0('0x1d')]);}_0x3a5ced[_0x77e0('0x3b')]=qs[_0x77e0('0x3c')](_0x569b69['query']['sort']);_0x3a5ced['where']=qs[_0x77e0('0x34')](_['pick'](_0x569b69['query'],_0x1f8042['filters']),_0x54a758);if(_0x569b69[_0x77e0('0x32')][_0x77e0('0x3d')]){_0x3a5ced[_0x77e0('0x3e')]=_[_0x77e0('0x3f')](_0x3a5ced[_0x77e0('0x3e')],{'$or':_[_0x77e0('0x2c')](_0x54a758,function(_0x2395b5){if(_0x2395b5[_0x77e0('0x2f')]!==_0x77e0('0x40')){var _0x5a37aa={};_0x5a37aa[_0x2395b5['name']]={'$like':'%'+_0x569b69['query'][_0x77e0('0x3d')]+'%'};return _0x5a37aa;}})});}_0x3a5ced=_[_0x77e0('0x3f')]({},_0x3a5ced,_0x569b69['options']);var _0x13cc05={'where':_0x3a5ced['where']};return db[_0x77e0('0x2d')][_0x77e0('0x20')](_0x13cc05)['then'](function(_0x350f40){_0x9a79e5[_0x77e0('0x20')]=_0x350f40;if(_0x569b69[_0x77e0('0x32')]['includeAll']){_0x3a5ced['include']=[{'all':!![]}];}return db[_0x77e0('0x2d')]['findAll'](_0x3a5ced);})[_0x77e0('0x27')](function(_0x24ce0d){_0x9a79e5[_0x77e0('0x41')]=_0x24ce0d;return _0x9a79e5;})[_0x77e0('0x27')](respondWithFilteredResult(_0x2c5239,_0x3a5ced))['catch'](handleError(_0x2c5239,null));};exports[_0x77e0('0x42')]=function(_0x1d9cce,_0x255cb2){var _0x574ad8={'raw':!![],'where':{'id':_0x1d9cce[_0x77e0('0x43')]['id']}},_0x5ab78c={};_0x5ab78c[_0x77e0('0x31')]=_[_0x77e0('0x33')](db[_0x77e0('0x2d')][_0x77e0('0x2e')]);_0x5ab78c[_0x77e0('0x32')]=_[_0x77e0('0x33')](_0x1d9cce[_0x77e0('0x32')]);_0x5ab78c[_0x77e0('0x34')]=_['intersection'](_0x5ab78c[_0x77e0('0x31')],_0x5ab78c[_0x77e0('0x32')]);_0x574ad8['attributes']=_[_0x77e0('0x35')](_0x5ab78c['model'],qs[_0x77e0('0x37')](_0x1d9cce[_0x77e0('0x32')][_0x77e0('0x37')]));_0x574ad8[_0x77e0('0x36')]=_0x574ad8[_0x77e0('0x36')][_0x77e0('0x38')]?_0x574ad8[_0x77e0('0x36')]:_0x5ab78c['model'];if(_0x1d9cce[_0x77e0('0x32')][_0x77e0('0x44')]){_0x574ad8[_0x77e0('0x45')]=[{'all':!![]}];}_0x574ad8=_[_0x77e0('0x3f')]({},_0x574ad8,_0x1d9cce['options']);return db[_0x77e0('0x2d')][_0x77e0('0x46')](_0x574ad8)['then'](handleEntityNotFound(_0x255cb2,null))['then'](respondWithResult(_0x255cb2,null))[_0x77e0('0x47')](handleError(_0x255cb2,null));};exports[_0x77e0('0x48')]=function(_0x57be33,_0x9ece){var _0x3e0d43={'where':{'id':_0x57be33[_0x77e0('0x43')]['id']}},_0x3a1fe3={};_0x3a1fe3['model']=_[_0x77e0('0x33')](db[_0x77e0('0x2d')][_0x77e0('0x2e')]);_0x3e0d43[_0x77e0('0x36')]=_[_0x77e0('0x35')](_0x3a1fe3[_0x77e0('0x31')],qs[_0x77e0('0x37')](_0x57be33[_0x77e0('0x32')][_0x77e0('0x37')]));_0x3e0d43[_0x77e0('0x36')]=_0x3e0d43['attributes'][_0x77e0('0x38')]?_0x3e0d43['attributes']:_0x3a1fe3[_0x77e0('0x31')];if(_0x57be33['query'][_0x77e0('0x44')]){_0x3e0d43[_0x77e0('0x45')]=[{'all':!![]}];}_0x3e0d43=_[_0x77e0('0x3f')]({},_0x3e0d43,_0x57be33['options']);return db[_0x77e0('0x2d')]['find'](_0x3e0d43)[_0x77e0('0x27')](handleEntityNotFound(_0x9ece,null))[_0x77e0('0x27')](function(_0x29404a){if(_0x29404a){var _0x624cb2=_0x29404a['get']({'plain':!![]});_0x624cb2=qs[_0x77e0('0x49')](_0x624cb2,['id',_0x77e0('0x4a'),_0x77e0('0x4b')]);_0x57be33[_0x77e0('0x4c')]=_['omit'](_0x57be33[_0x77e0('0x4c')],['id','createdAt',_0x77e0('0x4b')]);return db[_0x77e0('0x2d')][_0x77e0('0x4d')](_['merge'](_0x624cb2,_0x57be33['body']),{'include':_0x57be33[_0x77e0('0x32')][_0x77e0('0x44')]?[{'all':!![]}]:undefined});}})[_0x77e0('0x27')](respondWithResult(_0x9ece,0xc9))[_0x77e0('0x47')](handleError(_0x9ece,null));};exports[_0x77e0('0x26')]=function(_0x2cdab5,_0x2e176c){if(_0x2cdab5[_0x77e0('0x4c')]['id']){delete _0x2cdab5[_0x77e0('0x4c')]['id'];}return db[_0x77e0('0x2d')][_0x77e0('0x46')]({'where':{'id':_0x2cdab5['params']['id']}})[_0x77e0('0x27')](handleEntityNotFound(_0x2e176c,null))[_0x77e0('0x27')](saveUpdates(_0x2cdab5[_0x77e0('0x4c')],null))['then'](respondWithResult(_0x2e176c,null))[_0x77e0('0x47')](handleError(_0x2e176c,null));};exports[_0x77e0('0x4e')]=function(_0x2e9f19,_0x5a908f){return db[_0x77e0('0x2d')][_0x77e0('0x46')]({'where':{'id':_0x2e9f19[_0x77e0('0x43')]['id']}})[_0x77e0('0x27')](handleEntityNotFound(_0x5a908f,null))[_0x77e0('0x27')](removeEntity(_0x5a908f,null))[_0x77e0('0x47')](handleError(_0x5a908f,null));};exports['create']=function(_0x26ddc7,_0x3e7ff5,_0x4bceb8){_0x26ddc7['body'][_0x77e0('0x29')]=_0x26ddc7[_0x77e0('0x4f')]['originalname'];_0x26ddc7['body'][_0x77e0('0x50')]=_0x26ddc7[_0x77e0('0x4f')]['filename'];_0x26ddc7[_0x77e0('0x4c')][_0x77e0('0x2f')]=_0x26ddc7[_0x77e0('0x4f')][_0x77e0('0x51')];return db['Attachment']['create'](_0x26ddc7['body'])[_0x77e0('0x27')](respondWithResult(_0x3e7ff5,0xc9))[_0x77e0('0x47')](handleError(_0x3e7ff5,null));};exports[_0x77e0('0x52')]=function(_0xca5c59,_0x4d3df7,_0x13e089){return db[_0x77e0('0x2d')][_0x77e0('0x53')]({'where':{'id':_0xca5c59[_0x77e0('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4d3df7,null))[_0x77e0('0x27')](function(_0x29d561){if(_0x29d561){var _0x26210c=_0x29d561[_0x77e0('0x54')]!==null;var _0x4ebc0c=path[_0x77e0('0x55')](config[_0x77e0('0x56')],'server/files/attachments/');if(_0x26210c){_0x4ebc0c=path['join'](_0x4ebc0c,_0x77e0('0x57'));}var _0x5c6b2b=path[_0x77e0('0x55')](_0x4ebc0c,_0x29d561['basename']);return _0x4d3df7[_0x77e0('0x52')](_0x5c6b2b);}})[_0x77e0('0x47')](handleError(_0x4d3df7,null));}; \ No newline at end of file +var _0x0de4=['then','error','name','send','map','Attachment','rawAttributes','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','clone','keys','find','get','createdAt','updatedAt','body','omit','destroy','create','file','originalname','basename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update'];(function(_0x203f93,_0x2afda5){var _0x361762=function(_0x124281){while(--_0x124281){_0x203f93['push'](_0x203f93['shift']());}};_0x361762(++_0x2afda5);}(_0x0de4,0x143));var _0x40de=function(_0x2cf488,_0xcde934){_0x2cf488=_0x2cf488-0x0;var _0x398f6d=_0x0de4[_0x2cf488];return _0x398f6d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x40de('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40de('0x1'));var moment=require(_0x40de('0x2'));var BPromise=require(_0x40de('0x3'));var Mustache=require(_0x40de('0x4'));var util=require(_0x40de('0x5'));var path=require('path');var sox=require(_0x40de('0x6'));var csv=require(_0x40de('0x7'));var ejs=require(_0x40de('0x8'));var fs=require('fs');var fs_extra=require(_0x40de('0x9'));var _=require(_0x40de('0xa'));var squel=require(_0x40de('0xb'));var crypto=require(_0x40de('0xc'));var jsforce=require(_0x40de('0xd'));var deskjs=require(_0x40de('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40de('0xf'));var Papa=require(_0x40de('0x10'));var Redis=require(_0x40de('0x11'));var authService=require(_0x40de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x40de('0x13'));var hardwareService=require(_0x40de('0x14'));var logger=require(_0x40de('0x15'))(_0x40de('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x40de('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cf2d8,_0x56485d){_0x56485d=_0x56485d||0xcc;return function(_0x41f989){if(_0x41f989){return _0x4cf2d8[_0x40de('0x18')](_0x56485d);}return _0x4cf2d8[_0x40de('0x19')](_0x56485d)[_0x40de('0x1a')]();};}function respondWithResult(_0x59ec84,_0x1021cf){_0x1021cf=_0x1021cf||0xc8;return function(_0xa23415){if(_0xa23415){return _0x59ec84[_0x40de('0x19')](_0x1021cf)['json'](_0xa23415);}};}function respondWithFilteredResult(_0x19f214,_0x263af9){return function(_0x2bb26d){if(_0x2bb26d){var _0x2ffbe6=typeof _0x263af9[_0x40de('0x1b')]===_0x40de('0x1c')&&typeof _0x263af9['limit']===_0x40de('0x1c');var _0x3dd259=_0x2bb26d[_0x40de('0x1d')];var _0x2ca4c4=_0x2ffbe6?0x0:_0x263af9[_0x40de('0x1b')];var _0x503d7d=_0x2ffbe6?_0x2bb26d[_0x40de('0x1d')]:_0x263af9[_0x40de('0x1b')]+_0x263af9[_0x40de('0x1e')];var _0x71dc7d;if(_0x503d7d>=_0x3dd259){_0x503d7d=_0x3dd259;_0x71dc7d=0xc8;}else{_0x71dc7d=0xce;}_0x19f214['status'](_0x71dc7d);return _0x19f214[_0x40de('0x1f')]('Content-Range',_0x2ca4c4+'-'+_0x503d7d+'/'+_0x3dd259)[_0x40de('0x20')](_0x2bb26d);}return null;};}function patchUpdates(_0x16f5a1){return function(_0x20a95f){try{jsonpatch[_0x40de('0x21')](_0x20a95f,_0x16f5a1,!![]);}catch(_0x1b551f){return BPromise[_0x40de('0x22')](_0x1b551f);}return _0x20a95f[_0x40de('0x23')]();};}function saveUpdates(_0x4ef2dc,_0x5be995){return function(_0x374d17){if(_0x374d17){return _0x374d17[_0x40de('0x24')](_0x4ef2dc)[_0x40de('0x25')](function(_0x503d85){return _0x503d85;});}return null;};}function removeEntity(_0x3787a2,_0x32286c){return function(_0x55bd74){if(_0x55bd74){return _0x55bd74['destroy']()[_0x40de('0x25')](function(){_0x3787a2[_0x40de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x380e04,_0x20cd23){return function(_0x5e38bd){if(!_0x5e38bd){_0x380e04['sendStatus'](0x194);}return _0x5e38bd;};}function handleError(_0xb486eb,_0xf1be72){_0xf1be72=_0xf1be72||0x1f4;return function(_0x32ec16){logger[_0x40de('0x26')](_0x32ec16['stack']);if(_0x32ec16[_0x40de('0x27')]){delete _0x32ec16[_0x40de('0x27')];}_0xb486eb[_0x40de('0x19')](_0xf1be72)[_0x40de('0x28')](_0x32ec16);};}exports['index']=function(_0xcb72d6,_0x4d9565){var _0x4070f1={},_0x1691fa={},_0x5abb1f={'count':0x0,'rows':[]};var _0x45a375=_[_0x40de('0x29')](db[_0x40de('0x2a')][_0x40de('0x2b')],function(_0x1f3209){return{'name':_0x1f3209['fieldName'],'type':_0x1f3209['type'][_0x40de('0x2c')]};});_0x1691fa[_0x40de('0x2d')]=_[_0x40de('0x29')](_0x45a375,_0x40de('0x27'));_0x1691fa[_0x40de('0x2e')]=_['keys'](_0xcb72d6[_0x40de('0x2e')]);_0x1691fa['filters']=_[_0x40de('0x2f')](_0x1691fa['model'],_0x1691fa['query']);_0x4070f1['attributes']=_['intersection'](_0x1691fa[_0x40de('0x2d')],qs[_0x40de('0x30')](_0xcb72d6[_0x40de('0x2e')][_0x40de('0x30')]));_0x4070f1[_0x40de('0x31')]=_0x4070f1['attributes'][_0x40de('0x32')]?_0x4070f1[_0x40de('0x31')]:_0x1691fa[_0x40de('0x2d')];if(!_0xcb72d6['query'][_0x40de('0x33')]('nolimit')){_0x4070f1['limit']=qs['limit'](_0xcb72d6[_0x40de('0x2e')][_0x40de('0x1e')]);_0x4070f1[_0x40de('0x1b')]=qs[_0x40de('0x1b')](_0xcb72d6[_0x40de('0x2e')][_0x40de('0x1b')]);}_0x4070f1[_0x40de('0x34')]=qs[_0x40de('0x35')](_0xcb72d6['query'][_0x40de('0x35')]);_0x4070f1[_0x40de('0x36')]=qs[_0x40de('0x37')](_[_0x40de('0x38')](_0xcb72d6[_0x40de('0x2e')],_0x1691fa[_0x40de('0x37')]),_0x45a375);if(_0xcb72d6[_0x40de('0x2e')][_0x40de('0x39')]){_0x4070f1[_0x40de('0x36')]=_[_0x40de('0x3a')](_0x4070f1[_0x40de('0x36')],{'$or':_[_0x40de('0x29')](_0x45a375,function(_0x291ec0){if(_0x291ec0[_0x40de('0x3b')]!==_0x40de('0x3c')){var _0x44b7de={};_0x44b7de[_0x291ec0['name']]={'$like':'%'+_0xcb72d6[_0x40de('0x2e')]['filter']+'%'};return _0x44b7de;}})});}_0x4070f1=_[_0x40de('0x3a')]({},_0x4070f1,_0xcb72d6['options']);var _0x1c390c={'where':_0x4070f1[_0x40de('0x36')]};return db['Attachment'][_0x40de('0x1d')](_0x1c390c)['then'](function(_0x3d909f){_0x5abb1f[_0x40de('0x1d')]=_0x3d909f;if(_0xcb72d6[_0x40de('0x2e')][_0x40de('0x3d')]){_0x4070f1['include']=[{'all':!![]}];}return db[_0x40de('0x2a')][_0x40de('0x3e')](_0x4070f1);})[_0x40de('0x25')](function(_0x1bd6c9){_0x5abb1f[_0x40de('0x3f')]=_0x1bd6c9;return _0x5abb1f;})[_0x40de('0x25')](respondWithFilteredResult(_0x4d9565,_0x4070f1))[_0x40de('0x40')](handleError(_0x4d9565,null));};exports[_0x40de('0x41')]=function(_0x55462f,_0x231c9e){var _0x9a088e={'raw':!![],'where':{'id':_0x55462f[_0x40de('0x42')]['id']}},_0x10d18b={};_0x10d18b[_0x40de('0x2d')]=_['keys'](db[_0x40de('0x2a')][_0x40de('0x2b')]);_0x10d18b[_0x40de('0x2e')]=_['keys'](_0x55462f[_0x40de('0x2e')]);_0x10d18b['filters']=_['intersection'](_0x10d18b[_0x40de('0x2d')],_0x10d18b[_0x40de('0x2e')]);_0x9a088e['attributes']=_[_0x40de('0x2f')](_0x10d18b[_0x40de('0x2d')],qs[_0x40de('0x30')](_0x55462f['query'][_0x40de('0x30')]));_0x9a088e['attributes']=_0x9a088e[_0x40de('0x31')][_0x40de('0x32')]?_0x9a088e[_0x40de('0x31')]:_0x10d18b[_0x40de('0x2d')];if(_0x55462f['query'][_0x40de('0x3d')]){_0x9a088e[_0x40de('0x43')]=[{'all':!![]}];}_0x9a088e=_[_0x40de('0x3a')]({},_0x9a088e,_0x55462f[_0x40de('0x44')]);return db[_0x40de('0x2a')]['find'](_0x9a088e)['then'](handleEntityNotFound(_0x231c9e,null))['then'](respondWithResult(_0x231c9e,null))['catch'](handleError(_0x231c9e,null));};exports[_0x40de('0x45')]=function(_0x1bf058,_0x461d59){var _0x567de9={'where':{'id':_0x1bf058[_0x40de('0x42')]['id']}},_0x587ff5={};_0x587ff5[_0x40de('0x2d')]=_[_0x40de('0x46')](db[_0x40de('0x2a')][_0x40de('0x2b')]);_0x567de9[_0x40de('0x31')]=_[_0x40de('0x2f')](_0x587ff5[_0x40de('0x2d')],qs[_0x40de('0x30')](_0x1bf058[_0x40de('0x2e')]['fields']));_0x567de9[_0x40de('0x31')]=_0x567de9['attributes']['length']?_0x567de9['attributes']:_0x587ff5[_0x40de('0x2d')];if(_0x1bf058['query'][_0x40de('0x3d')]){_0x567de9[_0x40de('0x43')]=[{'all':!![]}];}_0x567de9=_[_0x40de('0x3a')]({},_0x567de9,_0x1bf058['options']);return db[_0x40de('0x2a')][_0x40de('0x47')](_0x567de9)[_0x40de('0x25')](handleEntityNotFound(_0x461d59,null))['then'](function(_0x558529){if(_0x558529){var _0x2e96e8=_0x558529[_0x40de('0x48')]({'plain':!![]});_0x2e96e8=qs['omit'](_0x2e96e8,['id',_0x40de('0x49'),_0x40de('0x4a')]);_0x1bf058[_0x40de('0x4b')]=_[_0x40de('0x4c')](_0x1bf058['body'],['id',_0x40de('0x49'),_0x40de('0x4a')]);return db[_0x40de('0x2a')]['create'](_[_0x40de('0x3a')](_0x2e96e8,_0x1bf058[_0x40de('0x4b')]),{'include':_0x1bf058[_0x40de('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x40de('0x25')](respondWithResult(_0x461d59,0xc9))[_0x40de('0x40')](handleError(_0x461d59,null));};exports[_0x40de('0x24')]=function(_0x37a5e4,_0x3ce2c4){if(_0x37a5e4['body']['id']){delete _0x37a5e4[_0x40de('0x4b')]['id'];}return db[_0x40de('0x2a')][_0x40de('0x47')]({'where':{'id':_0x37a5e4[_0x40de('0x42')]['id']}})[_0x40de('0x25')](handleEntityNotFound(_0x3ce2c4,null))['then'](saveUpdates(_0x37a5e4[_0x40de('0x4b')],null))[_0x40de('0x25')](respondWithResult(_0x3ce2c4,null))[_0x40de('0x40')](handleError(_0x3ce2c4,null));};exports[_0x40de('0x4d')]=function(_0x2a68e4,_0x2a2fa8){return db[_0x40de('0x2a')][_0x40de('0x47')]({'where':{'id':_0x2a68e4[_0x40de('0x42')]['id']}})[_0x40de('0x25')](handleEntityNotFound(_0x2a2fa8,null))[_0x40de('0x25')](removeEntity(_0x2a2fa8,null))[_0x40de('0x40')](handleError(_0x2a2fa8,null));};exports[_0x40de('0x4e')]=function(_0x3e0abb,_0x495228,_0xe0703){_0x3e0abb[_0x40de('0x4b')]['name']=_0x3e0abb[_0x40de('0x4f')][_0x40de('0x50')];_0x3e0abb[_0x40de('0x4b')][_0x40de('0x51')]=_0x3e0abb[_0x40de('0x4f')]['filename'];_0x3e0abb[_0x40de('0x4b')][_0x40de('0x3b')]=_0x3e0abb[_0x40de('0x4f')][_0x40de('0x52')];return db[_0x40de('0x2a')]['create'](_0x3e0abb[_0x40de('0x4b')])[_0x40de('0x25')](respondWithResult(_0x495228,0xc9))['catch'](handleError(_0x495228,null));};exports['download']=function(_0x5cf1f0,_0x7ba15,_0x513752){return db['Attachment'][_0x40de('0x53')]({'where':{'id':_0x5cf1f0[_0x40de('0x42')]['id']},'raw':!![]})[_0x40de('0x25')](handleEntityNotFound(_0x7ba15,null))[_0x40de('0x25')](function(_0x558bf9){if(_0x558bf9){var _0x589d61=_0x558bf9[_0x40de('0x54')]!==null;var _0x3d0f3a=path[_0x40de('0x55')](config[_0x40de('0x56')],_0x40de('0x57'));if(_0x589d61){_0x3d0f3a=path['join'](_0x3d0f3a,_0x40de('0x58'));}var _0x5e009b=path[_0x40de('0x55')](_0x3d0f3a,_0x558bf9[_0x40de('0x51')]);return _0x7ba15[_0x40de('0x59')](_0x5e009b);}})[_0x40de('0x40')](handleError(_0x7ba15,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c97473c..7d6ac36 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 _0x1f7b=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Attachment','lodash','util','../../config/logger','api'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x1f7b,0x1b8));var _0xb1f7=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x1f7b[_0x2df387];return _0x3b1708;};'use strict';var _=require(_0xb1f7('0x0'));var util=require(_0xb1f7('0x1'));var logger=require(_0xb1f7('0x2'))(_0xb1f7('0x3'));var moment=require(_0xb1f7('0x4'));var BPromise=require(_0xb1f7('0x5'));var rp=require(_0xb1f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1f7('0x7'));var config=require(_0xb1f7('0x8'));var attributes=require('./attachment.attributes');module[_0xb1f7('0x9')]=function(_0x32f25a,_0x27e69f){return _0x32f25a[_0xb1f7('0xa')](_0xb1f7('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4da8=['api','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','Attachment','attachments','lodash'];(function(_0x562362,_0x5d54f4){var _0x3a18ce=function(_0x4b96ed){while(--_0x4b96ed){_0x562362['push'](_0x562362['shift']());}};_0x3a18ce(++_0x5d54f4);}(_0x4da8,0x196));var _0x84da=function(_0x2100e1,_0x501e1c){_0x2100e1=_0x2100e1-0x0;var _0x59fb88=_0x4da8[_0x2100e1];return _0x59fb88;};'use strict';var _=require(_0x84da('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x84da('0x1'));var moment=require('moment');var BPromise=require(_0x84da('0x2'));var rp=require(_0x84da('0x3'));var fs=require('fs');var path=require(_0x84da('0x4'));var rimraf=require(_0x84da('0x5'));var config=require(_0x84da('0x6'));var attributes=require(_0x84da('0x7'));module['exports']=function(_0x4bde6,_0x50d17d){return _0x4bde6[_0x84da('0x8')](_0x84da('0x9'),attributes,{'tableName':_0x84da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 839fcd1..bdb3f73 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 _0xd52d=['result','CreateAttachment','Attachment','create','body','options','catch','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2074b5,_0x12746e){var _0x8e5890=function(_0x2887c8){while(--_0x2887c8){_0x2074b5['push'](_0x2074b5['shift']());}};_0x8e5890(++_0x12746e);}(_0xd52d,0x1c7));var _0xdd52=function(_0x1c3cbe,_0x4ec6b5){_0x1c3cbe=_0x1c3cbe-0x0;var _0x144a81=_0xd52d[_0x1c3cbe];return _0x144a81;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});}exports[_0xdd52('0x16')]=function(_0x4568dc){var _0x45062e=this;return new Promise(function(_0x4dc017,_0x46803a){return db[_0xdd52('0x17')][_0xdd52('0x18')](_0x4568dc[_0xdd52('0x19')],{'raw':_0x4568dc['options']?_0x4568dc[_0xdd52('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xdd52('0xb')](function(_0x56e1db){logger[_0xdd52('0xc')](_0xdd52('0x16'),_0x4568dc);logger['debug'](_0xdd52('0x16'),_0x4568dc,JSON['stringify'](_0x56e1db));_0x4dc017(_0x56e1db);})[_0xdd52('0x1b')](function(_0x59a041){logger[_0xdd52('0x12')](_0xdd52('0x16'),_0x59a041[_0xdd52('0x14')],_0x4568dc);_0x46803a(_0x45062e[_0xdd52('0x12')](0x1f4,_0x59a041[_0xdd52('0x14')]));});});}; \ No newline at end of file +var _0xca66=['body','options','raw','CreateAttachment','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Attachment','create'];(function(_0x2eaa96,_0x1c0a50){var _0x59030d=function(_0x37d0f6){while(--_0x37d0f6){_0x2eaa96['push'](_0x2eaa96['shift']());}};_0x59030d(++_0x1c0a50);}(_0xca66,0x8b));var _0x6ca6=function(_0x28e50f,_0x5b39de){_0x28e50f=_0x28e50f-0x0;var _0x22b9fd=_0xca66[_0x28e50f];return _0x22b9fd;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Attachment,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});}exports['CreateAttachment']=function(_0x2391ce){var _0x10be57=this;return new Promise(function(_0xc97f0,_0x1f21ff){return db[_0x6ca6('0x15')][_0x6ca6('0x16')](_0x2391ce[_0x6ca6('0x17')],{'raw':_0x2391ce[_0x6ca6('0x18')]?_0x2391ce[_0x6ca6('0x18')][_0x6ca6('0x19')]===undefined?!![]:![]:!![]})[_0x6ca6('0xa')](function(_0x4c3be9){logger[_0x6ca6('0xb')](_0x6ca6('0x1a'),_0x2391ce);logger[_0x6ca6('0xe')](_0x6ca6('0x1a'),_0x2391ce,JSON[_0x6ca6('0xf')](_0x4c3be9));_0xc97f0(_0x4c3be9);})[_0x6ca6('0x14')](function(_0x593f15){logger[_0x6ca6('0x10')](_0x6ca6('0x1a'),_0x593f15['message'],_0x2391ce);_0x1f21ff(_0x10be57['error'](0x1f4,_0x593f15[_0x6ca6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 5454986..d434b02 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 _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x43369e,_0x59e1d2){var _0x33b029=function(_0x292ea1){while(--_0x292ea1){_0x43369e['push'](_0x43369e['shift']());}};_0x33b029(++_0x59e1d2);}(_0xadb5,0xad));var _0x5adb=function(_0x1f3f6,_0x33e2bb){_0x1f3f6=_0x1f3f6-0x0;var _0x12ddbb=_0xadb5[_0x1f3f6];return _0x12ddbb;};'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('./attachment.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('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index d258545..8d15f6f 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 _0xa047=['error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','online','admin','user','agent','domain','blocked','add','minutes','getLicense','catch','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','use','User','passport','passport-local','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','baseDN','url','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x46f919,_0x19974b){var _0x412f5c=function(_0x1c79ea){while(--_0x1c79ea){_0x46f919['push'](_0x46f919['shift']());}};_0x412f5c(++_0x19974b);}(_0xa047,0x16f));var _0x7a04=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0xa047[_0x1e081a];return _0x428209;};'use strict';var passport=require(_0x7a04('0x0'));var LocalStrategy=require(_0x7a04('0x1'))[_0x7a04('0x2')];var moment=require(_0x7a04('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0x7a04('0x4'));var util=require(_0x7a04('0x5'));var db=require(_0x7a04('0x6'))['db'];var authService=require(_0x7a04('0x7'));var utils=require(_0x7a04('0x8'));var config=require(_0x7a04('0x9'));var logger=require(_0x7a04('0xa'))('api');function isActiveDirectoryConfigured(_0x534fea){var _0x4473d9=![];if(typeof _0x534fea[_0x7a04('0xb')]!=='undefined'){_0x4473d9=_0x534fea[_0x7a04('0xb')][_0x7a04('0xc')]&&_0x534fea[_0x7a04('0xb')][_0x7a04('0xd')]&&_0x534fea[_0x7a04('0xb')]['domain'];}return _0x4473d9;}function adAuthenticate(_0x371eea,_0x1f333f,_0x39dc7b){return new BPromise(function(_0x485354,_0x5c5675){try{var _0x2ac0f2=new ActiveDirectory(_0x371eea);_0x2ac0f2[_0x7a04('0xe')](_0x1f333f,_0x39dc7b,function(_0xe8f0b5,_0x584bc7){if(_0xe8f0b5){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x1f333f,util[_0x7a04('0xf')](_0xe8f0b5,{'showHidden':![],'depth':null}));_0x5c5675(_0x7a04('0x10'));}else if(!_0x584bc7){logger[_0x7a04('0x11')](_0x7a04('0x12'),_0x1f333f);_0x5c5675('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x485354(_0x584bc7);}});}catch(_0x1632aa){_0x5c5675(_0x1632aa);}});}function ActiveDirectoryAuthenticate(_0x3efcdd,_0x57e4cf,_0x1e44f4,_0xcefca5){var _0x21da41,_0x3495a8;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x7a04('0x13'),_0x57e4cf);return _0xcefca5(null,![],{'message':_0x7a04('0x10')});}return db[_0x7a04('0x14')][_0x7a04('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7a04('0x16')],'raw':!![]})[_0x7a04('0x17')](function(_0x14e324){_0x21da41=_0x14e324;if(!_0x21da41[_0x7a04('0x18')]){logger[_0x7a04('0x11')](_0x7a04('0x19'),_0x57e4cf);throw new Error(_0x7a04('0x10'));}return _0x3efcdd[_0x7a04('0x15')]({'attributes':['id',_0x7a04('0x1a'),_0x7a04('0x1b'),_0x7a04('0x1c'),'role',_0x7a04('0x1d'),'blocked','blockedAt',_0x7a04('0x1e')],'where':{'name':_0x57e4cf,'role':{'$or':[_0x7a04('0x1f'),_0x7a04('0x20'),_0x7a04('0x21')]},'adSsoEnabled':!![]}});})[_0x7a04('0x17')](function(_0x2e36d7){if(!_0x2e36d7||_0x2e36d7&&_0x2e36d7['name']!==_0x57e4cf){throw new Error(_0x7a04('0x10'));}_0x3495a8=_0x2e36d7;var _0x5c5f7e=_0x3495a8['name']+'@'+config[_0x7a04('0xb')][_0x7a04('0x22')];return adAuthenticate(config['activedirectory'],_0x5c5f7e,_0x1e44f4);})[_0x7a04('0x17')](function(_0x597261){if(_0x3495a8['disabled']){throw new Error(_0x7a04('0x10'));}if(_0x21da41[_0x7a04('0x16')]>0x0){if(_0x3495a8[_0x7a04('0x23')]){if(moment(_0x3495a8['blockedAt'])[_0x7a04('0x24')](_0x21da41[_0x7a04('0x16')],_0x7a04('0x25'))>moment()){throw new Error(_0x7a04('0x10'));}return utils['clearBlockUser'](_0x3495a8,0x0,![],null)[_0x7a04('0x17')](function(){return utils[_0x7a04('0x26')](_0x3495a8);})['then'](function(){return _0xcefca5(null,_0x3495a8);});}else{return utils['getLicense'](_0x3495a8)[_0x7a04('0x17')](function(){return _0xcefca5(null,_0x3495a8);});}}else{return utils[_0x7a04('0x26')](_0x3495a8)[_0x7a04('0x17')](function(){return _0xcefca5(null,_0x3495a8);});}})[_0x7a04('0x27')](function(_0x2cdc11){return _0xcefca5(null,![],_0x2cdc11);});}function handleError(_0x1eaf3d,_0x240132,_0x124ed9){return _0x1eaf3d[_0x7a04('0x28')](_0x240132||0x1f4)[_0x7a04('0x29')]({'message':_0x124ed9?_0x124ed9['message']||_0x124ed9:''});}exports[_0x7a04('0x2a')]=function(_0x4d3c1b,_0x5158ff,_0xa20db1){passport[_0x7a04('0xe')](_0x7a04('0x2b'),function(_0x58c38f,_0x44bfc2,_0x441fd9){var _0x59b4ca=_0x58c38f||_0x441fd9;if(_0x59b4ca){return handleError(_0x5158ff,0x191,_0x59b4ca);}if(!_0x44bfc2){return handleError(_0x5158ff,0x194,{'message':_0x7a04('0x2c')});}else{var _0x3806b2={'payload':{'id':_0x44bfc2['id'],'role':_0x44bfc2[_0x7a04('0x2d')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3806b2)[_0x7a04('0x17')](function(_0x203e11){_0x5158ff['json']({'id':_0x44bfc2['id'],'token':_0x203e11,'statusCall':'','isAlreadyLogged':_0x44bfc2['online']});});}})(_0x4d3c1b,_0x5158ff,_0xa20db1);};passport[_0x7a04('0x2e')](_0x7a04('0x2b'),new LocalStrategy({'usernameField':_0x7a04('0x1a'),'passwordField':_0x7a04('0x1b')},function(_0x3ef5b7,_0x1dc3a0,_0x5c1397){return ActiveDirectoryAuthenticate(db[_0x7a04('0x2f')],_0x3ef5b7,_0x1dc3a0,_0x5c1397);})); \ No newline at end of file +var _0x48ad=['salt','role','disabled','blocked','blockedAt','online','admin','user','agent','name','add','blockDuration','clearBlockUser','getLicense','status','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','passport','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','url','domain','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x48ad,0xe5));var _0xd48a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48ad[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require(_0xd48a('0x0'));var LocalStrategy=require('passport-local')[_0xd48a('0x1')];var moment=require(_0xd48a('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xd48a('0x3'));var util=require(_0xd48a('0x4'));var db=require(_0xd48a('0x5'))['db'];var authService=require(_0xd48a('0x6'));var utils=require('../../config/utils');var config=require(_0xd48a('0x7'));var logger=require(_0xd48a('0x8'))('api');function isActiveDirectoryConfigured(_0x337e41){var _0x3ee6fe=![];if(typeof _0x337e41[_0xd48a('0x9')]!==_0xd48a('0xa')){_0x3ee6fe=_0x337e41[_0xd48a('0x9')][_0xd48a('0xb')]&&_0x337e41['activedirectory'][_0xd48a('0xc')]&&_0x337e41[_0xd48a('0x9')][_0xd48a('0xd')];}return _0x3ee6fe;}function adAuthenticate(_0x395885,_0x1b6e36,_0x215741){return new BPromise(function(_0x6a1ae7,_0x48987d){try{var _0x198fd5=new ActiveDirectory(_0x395885);_0x198fd5['authenticate'](_0x1b6e36,_0x215741,function(_0x3bf4eb,_0x1ffe37){if(_0x3bf4eb){logger[_0xd48a('0xe')](_0xd48a('0xf'),_0x1b6e36,util['inspect'](_0x3bf4eb,{'showHidden':![],'depth':null}));_0x48987d(_0xd48a('0x10'));}else if(!_0x1ffe37){logger[_0xd48a('0xe')](_0xd48a('0x11'),_0x1b6e36);_0x48987d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x6a1ae7(_0x1ffe37);}});}catch(_0x55da2e){_0x48987d(_0x55da2e);}});}function ActiveDirectoryAuthenticate(_0x9f8391,_0x171b68,_0x35c317,_0x590333){var _0x5a8893,_0x3a4534;if(!isActiveDirectoryConfigured(config)){logger[_0xd48a('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x171b68);return _0x590333(null,![],{'message':_0xd48a('0x10')});}return db['Setting'][_0xd48a('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xd48a('0x13')](function(_0x3df730){_0x5a8893=_0x3df730;if(!_0x5a8893[_0xd48a('0x14')]){logger[_0xd48a('0xe')](_0xd48a('0x15'),_0x171b68);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x9f8391['findOne']({'attributes':['id','name',_0xd48a('0x16'),_0xd48a('0x17'),_0xd48a('0x18'),_0xd48a('0x19'),_0xd48a('0x1a'),_0xd48a('0x1b'),_0xd48a('0x1c')],'where':{'name':_0x171b68,'role':{'$or':[_0xd48a('0x1d'),_0xd48a('0x1e'),_0xd48a('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x26b136){if(!_0x26b136||_0x26b136&&_0x26b136[_0xd48a('0x20')]!==_0x171b68){throw new Error(_0xd48a('0x10'));}_0x3a4534=_0x26b136;var _0x1564fa=_0x3a4534[_0xd48a('0x20')]+'@'+config[_0xd48a('0x9')]['domain'];return adAuthenticate(config[_0xd48a('0x9')],_0x1564fa,_0x35c317);})[_0xd48a('0x13')](function(_0x411062){if(_0x3a4534['disabled']){throw new Error(_0xd48a('0x10'));}if(_0x5a8893['blockDuration']>0x0){if(_0x3a4534['blocked']){if(moment(_0x3a4534[_0xd48a('0x1b')])[_0xd48a('0x21')](_0x5a8893[_0xd48a('0x22')],'minutes')>moment()){throw new Error(_0xd48a('0x10'));}return utils[_0xd48a('0x23')](_0x3a4534,0x0,![],null)[_0xd48a('0x13')](function(){return utils[_0xd48a('0x24')](_0x3a4534);})[_0xd48a('0x13')](function(){return _0x590333(null,_0x3a4534);});}else{return utils[_0xd48a('0x24')](_0x3a4534)[_0xd48a('0x13')](function(){return _0x590333(null,_0x3a4534);});}}else{return utils['getLicense'](_0x3a4534)['then'](function(){return _0x590333(null,_0x3a4534);});}})['catch'](function(_0x2fa9f7){return _0x590333(null,![],_0x2fa9f7);});}function handleError(_0x12bc16,_0x26d6d5,_0x5509de){return _0x12bc16[_0xd48a('0x25')](_0x26d6d5||0x1f4)['send']({'message':_0x5509de?_0x5509de[_0xd48a('0x26')]||_0x5509de:''});}exports['login']=function(_0x5f0219,_0x32a52b,_0x5b7a91){passport['authenticate'](_0xd48a('0x27'),function(_0x143bd8,_0x25f8d8,_0x2be1e7){var _0x397d7d=_0x143bd8||_0x2be1e7;if(_0x397d7d){return handleError(_0x32a52b,0x191,_0x397d7d);}if(!_0x25f8d8){return handleError(_0x32a52b,0x194,{'message':_0xd48a('0x28')});}else{var _0x2fc3d8={'payload':{'id':_0x25f8d8['id'],'role':_0x25f8d8[_0xd48a('0x18')]},'options':{'expiresIn':0x15180}};return authService[_0xd48a('0x29')](_0x2fc3d8)['then'](function(_0x4e196d){_0x32a52b['json']({'id':_0x25f8d8['id'],'token':_0x4e196d,'statusCall':'','isAlreadyLogged':_0x25f8d8[_0xd48a('0x1c')]});});}})(_0x5f0219,_0x32a52b,_0x5b7a91);};passport['use']('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0xd48a('0x16')},function(_0x166790,_0x88913e,_0x5b5e1c){return ActiveDirectoryAuthenticate(db['User'],_0x166790,_0x88913e,_0x5b5e1c);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 7be1977..fe93af9 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 _0x91c8=['exports','Router','./authActiveDirectory.controller','login'];(function(_0x3af6a0,_0x2f9b12){var _0x1655fe=function(_0x55fd5b){while(--_0x55fd5b){_0x3af6a0['push'](_0x3af6a0['shift']());}};_0x1655fe(++_0x2f9b12);}(_0x91c8,0x81));var _0x891c=function(_0x1def1c,_0x54765e){_0x1def1c=_0x1def1c-0x0;var _0x4b7a88=_0x91c8[_0x1def1c];return _0x4b7a88;};'use strict';var express=require('express');var router=express[_0x891c('0x0')]();var controller=require(_0x891c('0x1'));router['post']('/',controller[_0x891c('0x2')]);module[_0x891c('0x3')]=router; \ No newline at end of file +var _0x1596=['./authActiveDirectory.controller','post','login','exports','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1596,0x90));var _0x6159=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1596[_0x321bb2];return _0x9c12ed;};'use strict';var express=require('express');var router=express[_0x6159('0x0')]();var controller=require(_0x6159('0x1'));router[_0x6159('0x2')]('/',controller[_0x6159('0x3')]);module[_0x6159('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index cfb5693..32494a8 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x144e29,_0x34954a){var _0x575122=function(_0x4bc699){while(--_0x4bc699){_0x144e29['push'](_0x144e29['shift']());}};_0x575122(++_0x34954a);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x7a54,0x106));var _0x47a5=function(_0x9e42dc,_0x219749){_0x9e42dc=_0x9e42dc-0x0;var _0x48766d=_0x7a54[_0x9e42dc];return _0x48766d;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2f98a4e..242156b 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 _0x17f0=['exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x27d878,_0x46f920){var _0x54ff9b=function(_0x8963c6){while(--_0x8963c6){_0x27d878['push'](_0x27d878['shift']());}};_0x54ff9b(++_0x46f920);}(_0x17f0,0x91));var _0x017f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x17f0[_0x2112d4];return _0x434972;};'use strict';var express=require(_0x017f('0x0'));var passport=require(_0x017f('0x1'));var router=express[_0x017f('0x2')]();var controller=require(_0x017f('0x3'));var userController=require(_0x017f('0x4'));var authService=require(_0x017f('0x5'));router[_0x017f('0x6')]('/',controller['login']);router[_0x017f('0x6')](_0x017f('0x7'),controller[_0x017f('0x8')],authService[_0x017f('0x9')],userController[_0x017f('0xa')],authService['setTokenCookie']);module[_0x017f('0xb')]=router; \ No newline at end of file +var _0x411b=['login','get','/callback','isMiddleware','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x411b,0x9f));var _0xb411=function(_0xe89d6c,_0x2cc354){_0xe89d6c=_0xe89d6c-0x0;var _0x454132=_0x411b[_0xe89d6c];return _0x454132;};'use strict';var express=require(_0xb411('0x0'));var passport=require(_0xb411('0x1'));var router=express[_0xb411('0x2')]();var controller=require(_0xb411('0x3'));var userController=require(_0xb411('0x4'));var authService=require(_0xb411('0x5'));router['get']('/',controller[_0xb411('0x6')]);router[_0xb411('0x7')](_0xb411('0x8'),controller['callback'],authService[_0xb411('0x9')],userController[_0xb411('0x6')],authService['setTokenCookie']);module[_0xb411('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index b05ed09..7e41f2e 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 _0x457f=['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','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','User','token','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordToken','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x5dc755,_0x3254d0){var _0x24ce81=function(_0x3c8315){while(--_0x3c8315){_0x5dc755['push'](_0x5dc755['shift']());}};_0x24ce81(++_0x3254d0);}(_0x457f,0xba));var _0xf457=function(_0x1dc723,_0x2801b9){_0x1dc723=_0x1dc723-0x0;var _0x370ce3=_0x457f[_0x1dc723];return _0x370ce3;};'use strict';var util=require('util');var passport=require(_0xf457('0x0'));var LocalStrategy=require(_0xf457('0x1'))[_0xf457('0x2')];var jayson=require(_0xf457('0x3'));var _=require(_0xf457('0x4'));var rs=require('randomstring');var moment=require(_0xf457('0x5'));var db=require(_0xf457('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xf457('0x7'));var client=jayson[_0xf457('0x8')][_0xf457('0x9')]({'port':0x232b});function localAuthenticate(_0x5696c9,_0x53c796,_0x23a8c5,_0x42ac5e){var _0x11e37f,_0x3fba73;return db[_0xf457('0xa')][_0xf457('0xb')]({'where':{'id':0x1},'attributes':[_0xf457('0xc'),_0xf457('0xd')],'raw':!![]})[_0xf457('0xe')](function(_0x48c23a){_0x11e37f=_0x48c23a;return _0x5696c9[_0xf457('0xb')]({'attributes':['id',_0xf457('0xf'),_0xf457('0x10'),_0xf457('0x11'),_0xf457('0x12'),_0xf457('0x13'),_0xf457('0x14'),_0xf457('0x15'),_0xf457('0x16')],'where':{'name':_0x53c796,'role':{'$or':[_0xf457('0x17'),_0xf457('0x18'),_0xf457('0x19')]}}});})[_0xf457('0xe')](function(_0x333c64){if(!_0x333c64||_0x333c64&&_0x333c64[_0xf457('0xf')]!==_0x53c796){throw new Error(_0xf457('0x1a'));}else{_0x3fba73=_0x333c64;return _0x3fba73;}})[_0xf457('0xe')](function(){_0x3fba73[_0xf457('0x1b')](_0x23a8c5,function(_0x386689,_0x590596){var _0x416358=_0x3fba73[_0xf457('0x16')]+0x1;if(_0x386689){return _0x42ac5e(_0x386689);}else if(!_0x590596){if(_0x3fba73[_0xf457('0x13')]){return _0x42ac5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x11e37f[_0xf457('0xc')]>0x0){if(_0x3fba73[_0xf457('0x14')]){if(_0x11e37f[_0xf457('0xd')]>0x0){if(moment(_0x3fba73[_0xf457('0x15')])[_0xf457('0x1c')](_0x11e37f[_0xf457('0xd')],_0xf457('0x1d'))>moment()){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}else{return utils['clearBlockUser'](_0x3fba73,_0x416358,![],null)[_0xf457('0xe')](function(){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});});}}else{return _0x42ac5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x416358>=_0x11e37f[_0xf457('0xc')]){return utils[_0xf457('0x1e')](_0x3fba73,0x0,!![],moment())[_0xf457('0xe')](function(){return _0x42ac5e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xf457('0x1e')](_0x3fba73,_0x416358,![],null)['then'](function(){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});});}}}else{return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}}else{if(_0x3fba73[_0xf457('0x13')]){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}else if(_0x11e37f[_0xf457('0xc')]>0x0){if(_0x3fba73[_0xf457('0x14')]){if(_0x11e37f[_0xf457('0xd')]>0x0){if(moment(_0x3fba73['blockedAt'])[_0xf457('0x1c')](_0x11e37f[_0xf457('0xd')],_0xf457('0x1d'))>moment()){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}else{return utils[_0xf457('0x1e')](_0x3fba73,0x0,![],null)['then'](function(){return utils[_0xf457('0x1f')](_0x3fba73);})['then'](function(){return _0x42ac5e(null,_0x3fba73);});}}else{return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}}else{return utils[_0xf457('0x1e')](_0x3fba73,0x0,![],null)['then'](function(){return utils[_0xf457('0x1f')](_0x3fba73);})[_0xf457('0xe')](function(){return _0x42ac5e(null,_0x3fba73);})['catch'](function(_0x2beda7){return _0x42ac5e(null,![],_0x2beda7);});}}else{if(_0x3fba73[_0xf457('0x14')]){return _0x42ac5e(null,![],{'message':_0xf457('0x1a')});}else{return utils[_0xf457('0x1f')](_0x3fba73)['then'](function(){return _0x42ac5e(null,_0x3fba73);});}}}});})[_0xf457('0x20')](function(_0x51cbb9){return _0x42ac5e(null,![],_0x51cbb9);});}function sendServiceMail(_0x4d666b){return db[_0xf457('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0xf457('0xf'),_0xf457('0x22')],'include':[{'model':db[_0xf457('0x23')],'as':_0xf457('0x24'),'include':[{'model':db[_0xf457('0x25')],'as':_0xf457('0x25')}]}]})[_0xf457('0xe')](function(_0x4fbbd6){if(!_0x4fbbd6){throw new Error(_0xf457('0x26'));}var _0xff81e6=_0x4fbbd6[_0xf457('0x27')]();var _0x22b847={'account':_0xff81e6,'message':_[_0xf457('0x28')]({'from':util[_0xf457('0x29')]('\x22%s\x22\x20<%s>',_0x4fbbd6[_0xf457('0xf')],_0x4fbbd6[_0xf457('0x22')]||_0x4fbbd6[_0xf457('0x24')]['user'])},_0x4d666b)};return client[_0xf457('0x2a')](_0xf457('0x2b'),_0x22b847);})[_0xf457('0xe')](function(_0x22d37f){if(_0x22d37f[_0xf457('0x2c')]){throw new Error(util[_0xf457('0x29')](_0xf457('0x2d'),_0x22d37f[_0xf457('0x2c')]['message']||JSON[_0xf457('0x2e')](_0x22d37f[_0xf457('0x2c')])));}return!![];});}function handleError(_0xbf140d,_0x8ae39d,_0x346f90){return _0xbf140d[_0xf457('0x2f')](_0x8ae39d||0x1f4)['send']({'message':_0x346f90?_0x346f90[_0xf457('0x30')]||_0x346f90:''});}exports[_0xf457('0x31')]=function(_0x1e6beb,_0x2841a3,_0xa2fb74){passport[_0xf457('0x1b')](_0xf457('0x32'),function(_0x8b0a50,_0x4bd7f9,_0x23225f){var _0x1bf277=_0x8b0a50||_0x23225f;if(_0x1bf277){return handleError(_0x2841a3,0x191,_0x1bf277);}if(!_0x4bd7f9){return handleError(_0x2841a3,0x194,{'message':_0xf457('0x33')});}else{var _0x25e6b2={'payload':{'id':_0x4bd7f9['id'],'role':_0x4bd7f9[_0xf457('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xf457('0x34')](_0x25e6b2)['then'](function(_0x255d5a){_0x2841a3[_0xf457('0x35')]({'id':_0x4bd7f9['id'],'token':_0x255d5a,'statusCall':'','isAlreadyLogged':_0x4bd7f9['online']});});}})(_0x1e6beb,_0x2841a3,_0xa2fb74);};exports[_0xf457('0x36')]=function(_0x4d4783,_0x2d78b1){if(!_0x4d4783[_0xf457('0x37')][_0xf457('0x22')]){return handleError(_0x2d78b1,0x1f4,{'message':_0xf457('0x38')});}var _0x5e08bc=rs['generate']();_0x4d4783[_0xf457('0x37')][_0xf457('0x22')]=_0x4d4783[_0xf457('0x37')]['email'][_0xf457('0x39')]()[_0xf457('0x3a')]();var _0x28a88f;return db[_0xf457('0xa')][_0xf457('0xb')]({'where':{'id':0x1},'attributes':[_0xf457('0xc'),'blockDuration'],'raw':!![]})[_0xf457('0xe')](function(_0x4223e5){_0x28a88f=_0x4223e5;return db['User'][_0xf457('0x3b')]({'where':{'email':_0x4d4783[_0xf457('0x37')][_0xf457('0x22')]}});})[_0xf457('0xe')](function(_0x25e015){if(!_0x25e015){throw new Error(_0xf457('0x3c'));}if(_0x25e015[_0xf457('0x13')]){throw new Error(_0xf457('0x3d'));}if(_0x25e015[_0xf457('0x14')]){if(moment(_0x25e015[_0xf457('0x15')])[_0xf457('0x1c')](_0x28a88f[_0xf457('0xd')],_0xf457('0x1d'))>moment()){throw new Error(_0xf457('0x3e'));}else{_0x25e015[_0xf457('0x14')]=![];_0x25e015['blockedAt']=null;}}_0x25e015['resetPasswordToken']=_0x5e08bc;_0x25e015[_0xf457('0x3f')]=Date[_0xf457('0x40')]()+0x36ee80;return _0x25e015[_0xf457('0x41')]();})[_0xf457('0xe')](function(){return sendServiceMail({'to':_0x4d4783[_0xf457('0x37')][_0xf457('0x22')],'subject':_0xf457('0x42'),'text':_0xf457('0x43')+_0xf457('0x44')+'https://'+_0x4d4783['headers'][_0xf457('0x45')]+'/reset/'+_0x5e08bc+'\x0a\x0a'+_0xf457('0x46')});})['then'](function(){_0x2d78b1[_0xf457('0x2f')](0xc8)[_0xf457('0x47')]({'message':_0xf457('0x48')});})[_0xf457('0x20')](function(_0x3d0bc2){return handleError(_0x2d78b1,0x1f4,_0x3d0bc2);});};exports[_0xf457('0x49')]=function(_0x3883c5,_0x3e28d8){return db[_0xf457('0x4a')][_0xf457('0x3b')]({'where':{'resetPasswordToken':_0x3883c5['params'][_0xf457('0x4b')],'resetPasswordExpires':{'$gt':Date[_0xf457('0x40')]()}}})[_0xf457('0xe')](function(_0x1fb011){if(!_0x1fb011){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting'][_0xf457('0xb')]({'attributes':['id',_0xf457('0x4c'),'enforcePasswordHistory',_0xf457('0x4d')]})[_0xf457('0xe')](function(_0x2c3a8d){if(_0x2c3a8d[_0xf457('0x4c')])authService[_0xf457('0x4e')](_0x3883c5[_0xf457('0x37')][_0xf457('0x10')]);if(!_0x2c3a8d[_0xf457('0x4f')]||!_0x1fb011[_0xf457('0x50')])return _0x1fb011;authService[_0xf457('0x51')](_0x3883c5[_0xf457('0x37')][_0xf457('0x10')],_0x1fb011[_0xf457('0x50')],_0x2c3a8d['passwordHistoryLimit']);return _0x1fb011;})[_0xf457('0xe')](function(){_0x1fb011['password']=_0x3883c5[_0xf457('0x37')][_0xf457('0x10')];_0x1fb011[_0xf457('0x52')]=null;_0x1fb011[_0xf457('0x3f')]=null;return _0x1fb011[_0xf457('0x41')]();});})[_0xf457('0xe')](function(){_0x3e28d8['status'](0xc8)[_0xf457('0x47')]({'message':'Password\x20reset!'});})[_0xf457('0x20')](function(_0x534a03){return handleError(_0x3e28d8,0x1f4,_0x534a03);});};passport['use'](_0xf457('0x32'),new LocalStrategy({'usernameField':_0xf457('0xf'),'passwordField':'password'},function(_0x52cf28,_0x1ed0c3,_0x1b0def){return localAuthenticate(db['User'],_0x52cf28,_0x1ed0c3,_0x1b0def);})); \ No newline at end of file +var _0xca83=['moment','../../components/auth/service','../../config/utils','http','Setting','blockDuration','findOne','name','password','salt','role','disabled','blocked','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','email','request','error','format','message','status','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','resetPasswordToken','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!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','use','local-login','util','passport-local','Strategy','jayson/promise','lodash'];(function(_0x423bb8,_0x4a9efc){var _0xbd76f5=function(_0x1933e1){while(--_0x1933e1){_0x423bb8['push'](_0x423bb8['shift']());}};_0xbd76f5(++_0x4a9efc);}(_0xca83,0x99));var _0x3ca8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xca83[_0x56916d];return _0x2b7f1f;};'use strict';var util=require(_0x3ca8('0x0'));var passport=require('passport');var LocalStrategy=require(_0x3ca8('0x1'))[_0x3ca8('0x2')];var jayson=require(_0x3ca8('0x3'));var _=require(_0x3ca8('0x4'));var rs=require('randomstring');var moment=require(_0x3ca8('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x3ca8('0x6'));var utils=require(_0x3ca8('0x7'));var client=jayson['client'][_0x3ca8('0x8')]({'port':0x232b});function localAuthenticate(_0x2a2c0b,_0x5272ae,_0x2f5eae,_0x5aa6b8){var _0x29cca8,_0x20ce05;return db[_0x3ca8('0x9')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x3ca8('0xa')],'raw':!![]})['then'](function(_0x15550b){_0x29cca8=_0x15550b;return _0x2a2c0b[_0x3ca8('0xb')]({'attributes':['id',_0x3ca8('0xc'),_0x3ca8('0xd'),_0x3ca8('0xe'),_0x3ca8('0xf'),_0x3ca8('0x10'),_0x3ca8('0x11'),'blockedAt',_0x3ca8('0x12')],'where':{'name':_0x5272ae,'role':{'$or':[_0x3ca8('0x13'),_0x3ca8('0x14'),_0x3ca8('0x15')]}}});})[_0x3ca8('0x16')](function(_0x214a00){if(!_0x214a00||_0x214a00&&_0x214a00[_0x3ca8('0xc')]!==_0x5272ae){throw new Error(_0x3ca8('0x17'));}else{_0x20ce05=_0x214a00;return _0x20ce05;}})[_0x3ca8('0x16')](function(){_0x20ce05[_0x3ca8('0x18')](_0x2f5eae,function(_0x4110a6,_0x365b09){var _0x5a7ea2=_0x20ce05[_0x3ca8('0x12')]+0x1;if(_0x4110a6){return _0x5aa6b8(_0x4110a6);}else if(!_0x365b09){if(_0x20ce05[_0x3ca8('0x10')]){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}else if(_0x29cca8[_0x3ca8('0x19')]>0x0){if(_0x20ce05[_0x3ca8('0x11')]){if(_0x29cca8[_0x3ca8('0xa')]>0x0){if(moment(_0x20ce05[_0x3ca8('0x1a')])[_0x3ca8('0x1b')](_0x29cca8[_0x3ca8('0xa')],_0x3ca8('0x1c'))>moment()){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}else{return utils[_0x3ca8('0x1d')](_0x20ce05,_0x5a7ea2,![],null)[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});});}}else{return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}}else{if(_0x5a7ea2>=_0x29cca8[_0x3ca8('0x19')]){return utils[_0x3ca8('0x1d')](_0x20ce05,0x0,!![],moment())[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});});}else{return utils[_0x3ca8('0x1d')](_0x20ce05,_0x5a7ea2,![],null)[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});});}}}else{return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}}else{if(_0x20ce05[_0x3ca8('0x10')]){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}else if(_0x29cca8[_0x3ca8('0x19')]>0x0){if(_0x20ce05[_0x3ca8('0x11')]){if(_0x29cca8[_0x3ca8('0xa')]>0x0){if(moment(_0x20ce05[_0x3ca8('0x1a')])[_0x3ca8('0x1b')](_0x29cca8['blockDuration'],_0x3ca8('0x1c'))>moment()){return _0x5aa6b8(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3ca8('0x1d')](_0x20ce05,0x0,![],null)[_0x3ca8('0x16')](function(){return utils[_0x3ca8('0x1e')](_0x20ce05);})[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,_0x20ce05);});}}else{return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}}else{return utils['clearBlockUser'](_0x20ce05,0x0,![],null)[_0x3ca8('0x16')](function(){return utils[_0x3ca8('0x1e')](_0x20ce05);})[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,_0x20ce05);})[_0x3ca8('0x1f')](function(_0x4fcca3){return _0x5aa6b8(null,![],_0x4fcca3);});}}else{if(_0x20ce05[_0x3ca8('0x11')]){return _0x5aa6b8(null,![],{'message':_0x3ca8('0x17')});}else{return utils['getLicense'](_0x20ce05)[_0x3ca8('0x16')](function(){return _0x5aa6b8(null,_0x20ce05);});}}}});})['catch'](function(_0x4377a1){return _0x5aa6b8(null,![],_0x4377a1);});}function sendServiceMail(_0x10632c){return db['MailAccount'][_0x3ca8('0x20')]({'where':{'service':!![]},'attributes':['id',_0x3ca8('0xc'),'email'],'include':[{'model':db[_0x3ca8('0x21')],'as':_0x3ca8('0x22'),'include':[{'model':db[_0x3ca8('0x23')],'as':'CloudProvider'}]}]})['then'](function(_0x56793a){if(!_0x56793a){throw new Error(_0x3ca8('0x24'));}var _0x255823=_0x56793a['getSmtpOptions']();var _0x3f77fc={'account':_0x255823,'message':_[_0x3ca8('0x25')]({'from':util['format'](_0x3ca8('0x26'),_0x56793a['name'],_0x56793a[_0x3ca8('0x27')]||_0x56793a[_0x3ca8('0x22')][_0x3ca8('0x14')])},_0x10632c)};return client[_0x3ca8('0x28')]('SendMail',_0x3f77fc);})['then'](function(_0x424a50){if(_0x424a50[_0x3ca8('0x29')]){throw new Error(util[_0x3ca8('0x2a')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x424a50['error'][_0x3ca8('0x2b')]||JSON['stringify'](_0x424a50[_0x3ca8('0x29')])));}return!![];});}function handleError(_0x4583a7,_0x1fc87b,_0x3a18d0){return _0x4583a7[_0x3ca8('0x2c')](_0x1fc87b||0x1f4)['send']({'message':_0x3a18d0?_0x3a18d0[_0x3ca8('0x2b')]||_0x3a18d0:''});}exports[_0x3ca8('0x2d')]=function(_0x3ae88f,_0x141834,_0x13c447){passport[_0x3ca8('0x18')]('local-login',function(_0xe78211,_0x112573,_0x343fe7){var _0x12f870=_0xe78211||_0x343fe7;if(_0x12f870){return handleError(_0x141834,0x191,_0x12f870);}if(!_0x112573){return handleError(_0x141834,0x194,{'message':_0x3ca8('0x2e')});}else{var _0x322b5c={'payload':{'id':_0x112573['id'],'role':_0x112573[_0x3ca8('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x3ca8('0x2f')](_0x322b5c)[_0x3ca8('0x16')](function(_0x2b7152){_0x141834[_0x3ca8('0x30')]({'id':_0x112573['id'],'token':_0x2b7152,'statusCall':'','isAlreadyLogged':_0x112573[_0x3ca8('0x31')]});});}})(_0x3ae88f,_0x141834,_0x13c447);};exports[_0x3ca8('0x32')]=function(_0x17423f,_0x310d1b){if(!_0x17423f[_0x3ca8('0x33')][_0x3ca8('0x27')]){return handleError(_0x310d1b,0x1f4,{'message':_0x3ca8('0x34')});}var _0x3cf66d=rs['generate']();_0x17423f['body'][_0x3ca8('0x27')]=_0x17423f[_0x3ca8('0x33')][_0x3ca8('0x27')][_0x3ca8('0x35')]()[_0x3ca8('0x36')]();var _0x2113d3;return db['Setting'][_0x3ca8('0xb')]({'where':{'id':0x1},'attributes':[_0x3ca8('0x19'),_0x3ca8('0xa')],'raw':!![]})['then'](function(_0x333afa){_0x2113d3=_0x333afa;return db[_0x3ca8('0x37')][_0x3ca8('0x20')]({'where':{'email':_0x17423f[_0x3ca8('0x33')][_0x3ca8('0x27')]}});})[_0x3ca8('0x16')](function(_0x16d57a){if(!_0x16d57a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x16d57a[_0x3ca8('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x16d57a[_0x3ca8('0x11')]){if(moment(_0x16d57a[_0x3ca8('0x1a')])[_0x3ca8('0x1b')](_0x2113d3[_0x3ca8('0xa')],_0x3ca8('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x16d57a['blocked']=![];_0x16d57a[_0x3ca8('0x1a')]=null;}}_0x16d57a[_0x3ca8('0x38')]=_0x3cf66d;_0x16d57a[_0x3ca8('0x39')]=Date[_0x3ca8('0x3a')]()+0x36ee80;return _0x16d57a[_0x3ca8('0x3b')]();})[_0x3ca8('0x16')](function(){return sendServiceMail({'to':_0x17423f['body'][_0x3ca8('0x27')],'subject':_0x3ca8('0x3c'),'text':_0x3ca8('0x3d')+_0x3ca8('0x3e')+_0x3ca8('0x3f')+_0x17423f[_0x3ca8('0x40')][_0x3ca8('0x41')]+'/reset/'+_0x3cf66d+'\x0a\x0a'+_0x3ca8('0x42')});})[_0x3ca8('0x16')](function(){_0x310d1b['status'](0xc8)['send']({'message':_0x3ca8('0x43')});})[_0x3ca8('0x1f')](function(_0x4b6f66){return handleError(_0x310d1b,0x1f4,_0x4b6f66);});};exports['reset']=function(_0x1f39cc,_0x1dad2f){return db[_0x3ca8('0x37')][_0x3ca8('0x20')]({'where':{'resetPasswordToken':_0x1f39cc[_0x3ca8('0x44')][_0x3ca8('0x45')],'resetPasswordExpires':{'$gt':Date[_0x3ca8('0x3a')]()}}})[_0x3ca8('0x16')](function(_0x57159b){if(!_0x57159b){throw new Error(_0x3ca8('0x46'));}return db['Setting']['findOne']({'attributes':['id','securePassword',_0x3ca8('0x47'),'passwordHistoryLimit']})[_0x3ca8('0x16')](function(_0x2f57c7){if(_0x2f57c7[_0x3ca8('0x48')])authService[_0x3ca8('0x49')](_0x1f39cc[_0x3ca8('0x33')][_0x3ca8('0xd')]);if(!_0x2f57c7[_0x3ca8('0x47')]||!_0x57159b[_0x3ca8('0x4a')])return _0x57159b;authService[_0x3ca8('0x4b')](_0x1f39cc[_0x3ca8('0x33')][_0x3ca8('0xd')],_0x57159b[_0x3ca8('0x4a')],_0x2f57c7[_0x3ca8('0x4c')]);return _0x57159b;})[_0x3ca8('0x16')](function(){_0x57159b[_0x3ca8('0xd')]=_0x1f39cc['body'][_0x3ca8('0xd')];_0x57159b[_0x3ca8('0x38')]=null;_0x57159b['resetPasswordExpires']=null;return _0x57159b[_0x3ca8('0x3b')]();});})[_0x3ca8('0x16')](function(){_0x1dad2f[_0x3ca8('0x2c')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x5dd00a){return handleError(_0x1dad2f,0x1f4,_0x5dd00a);});};passport[_0x3ca8('0x4d')](_0x3ca8('0x4e'),new LocalStrategy({'usernameField':'name','passwordField':_0x3ca8('0xd')},function(_0x27c42c,_0x54b771,_0x5c7717){return localAuthenticate(db[_0x3ca8('0x37')],_0x27c42c,_0x54b771,_0x5c7717);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8744d93..7e25a80 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 _0xabe9=['exports','express','Router','post','login','forgot','/reset/:token'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xabe9,0x174));var _0x9abe=function(_0x11ee5c,_0x2487a0){_0x11ee5c=_0x11ee5c-0x0;var _0x47b19f=_0xabe9[_0x11ee5c];return _0x47b19f;};'use strict';var express=require(_0x9abe('0x0'));var router=express[_0x9abe('0x1')]();var controller=require('./authLocal.controller');router[_0x9abe('0x2')]('/',controller[_0x9abe('0x3')]);router[_0x9abe('0x2')]('/forgot',controller[_0x9abe('0x4')]);router['post'](_0x9abe('0x5'),controller['reset']);module[_0x9abe('0x6')]=router; \ No newline at end of file +var _0x0490=['post','login','/forgot','/reset/:token','reset','exports','express'];(function(_0x25f2bb,_0x3cf160){var _0x21a2c3=function(_0x25f43e){while(--_0x25f43e){_0x25f2bb['push'](_0x25f2bb['shift']());}};_0x21a2c3(++_0x3cf160);}(_0x0490,0x1db));var _0x0049=function(_0x4d4c8f,_0x3669c5){_0x4d4c8f=_0x4d4c8f-0x0;var _0x702523=_0x0490[_0x4d4c8f];return _0x702523;};'use strict';var express=require(_0x0049('0x0'));var router=express['Router']();var controller=require('./authLocal.controller');router[_0x0049('0x1')]('/',controller[_0x0049('0x2')]);router[_0x0049('0x1')](_0x0049('0x3'),controller['forgot']);router[_0x0049('0x1')](_0x0049('0x4'),controller[_0x0049('0x5')]);module[_0x0049('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index e191bf3..c1a79af 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 _0xd347=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xd347,0x110));var _0x7d34=function(_0x2c41b8,_0x31846c){_0x2c41b8=_0x2c41b8-0x0;var _0x32b072=_0xd347[_0x2c41b8];return _0x32b072;};'use strict';var Sequelize=require(_0x7d34('0x0'));module[_0x7d34('0x1')]={'name':{'type':Sequelize[_0x7d34('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x7d34('0x2')]},'description':{'type':Sequelize[_0x7d34('0x2')]},'status':{'type':Sequelize[_0x7d34('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x7d34('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x807c=['sequelize','exports','STRING'];(function(_0x446438,_0x771136){var _0x58cfcc=function(_0x460868){while(--_0x460868){_0x446438['push'](_0x446438['shift']());}};_0x58cfcc(++_0x771136);}(_0x807c,0x186));var _0xc807=function(_0x8760bd,_0x4f3b26){_0x8760bd=_0x8760bd-0x0;var _0x3ef058=_0x807c[_0x8760bd];return _0x3ef058;};'use strict';var Sequelize=require(_0xc807('0x0'));module[_0xc807('0x1')]={'name':{'type':Sequelize[_0xc807('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc807('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index ef8dd6b..b3fabe0 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 _0x6a89=['rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','length','include','find','create','body','params','addConditions','Condition','ids','getConditions','findOne','options','hasOwnProperty','getActions','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','end','error','stack','name','index','Automation'];(function(_0x20614f,_0x141b39){var _0x2f2d1c=function(_0xba3195){while(--_0xba3195){_0x20614f['push'](_0x20614f['shift']());}};_0x2f2d1c(++_0x141b39);}(_0x6a89,0x74));var _0x96a8=function(_0xab78d1,_0x37b98c){_0xab78d1=_0xab78d1-0x0;var _0x43ef24=_0x6a89[_0xab78d1];return _0x43ef24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x96a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x96a8('0x1'));var moment=require(_0x96a8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x96a8('0x3'));var util=require(_0x96a8('0x4'));var path=require(_0x96a8('0x5'));var sox=require(_0x96a8('0x6'));var csv=require(_0x96a8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96a8('0x8'));var squel=require(_0x96a8('0x9'));var crypto=require(_0x96a8('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x96a8('0x7'));var querystring=require('querystring');var Papa=require(_0x96a8('0xb'));var Redis=require(_0x96a8('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x96a8('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96a8('0xe'))(_0x96a8('0xf'));var utils=require(_0x96a8('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x96a8('0x11'));var db=require(_0x96a8('0x12'))['db'];function respondWithStatusCode(_0x1eca51,_0x4b7c03){_0x4b7c03=_0x4b7c03||0xcc;return function(_0x66bea8){if(_0x66bea8){return _0x1eca51[_0x96a8('0x13')](_0x4b7c03);}return _0x1eca51[_0x96a8('0x14')](_0x4b7c03)['end']();};}function respondWithResult(_0x1e9679,_0x33d3ae){_0x33d3ae=_0x33d3ae||0xc8;return function(_0x4f77b3){if(_0x4f77b3){return _0x1e9679['status'](_0x33d3ae)[_0x96a8('0x15')](_0x4f77b3);}};}function respondWithFilteredResult(_0x4234e2,_0x304e73){return function(_0x51b0ee){if(_0x51b0ee){var _0x3e1126=typeof _0x304e73['offset']==='undefined'&&typeof _0x304e73[_0x96a8('0x16')]===_0x96a8('0x17');var _0x234ea1=_0x51b0ee[_0x96a8('0x18')];var _0xc66649=_0x3e1126?0x0:_0x304e73[_0x96a8('0x19')];var _0x219dd0=_0x3e1126?_0x51b0ee['count']:_0x304e73['offset']+_0x304e73[_0x96a8('0x16')];var _0x2cabb3;if(_0x219dd0>=_0x234ea1){_0x219dd0=_0x234ea1;_0x2cabb3=0xc8;}else{_0x2cabb3=0xce;}_0x4234e2[_0x96a8('0x14')](_0x2cabb3);return _0x4234e2[_0x96a8('0x1a')](_0x96a8('0x1b'),_0xc66649+'-'+_0x219dd0+'/'+_0x234ea1)['json'](_0x51b0ee);}return null;};}function patchUpdates(_0x4fd331){return function(_0x11c380){try{jsonpatch['apply'](_0x11c380,_0x4fd331,!![]);}catch(_0x198a30){return BPromise[_0x96a8('0x1c')](_0x198a30);}return _0x11c380[_0x96a8('0x1d')]();};}function saveUpdates(_0x2d313f,_0x21326e){return function(_0xb4fb49){if(_0xb4fb49){return _0xb4fb49[_0x96a8('0x1e')](_0x2d313f)[_0x96a8('0x1f')](function(_0x571eed){return _0x571eed;});}return null;};}function removeEntity(_0x5a9aad,_0x477fb4){return function(_0x57c743){if(_0x57c743){return _0x57c743['destroy']()[_0x96a8('0x1f')](function(){_0x5a9aad[_0x96a8('0x14')](0xcc)[_0x96a8('0x20')]();});}};}function handleEntityNotFound(_0x328dac,_0x3b0abe){return function(_0x3d567b){if(!_0x3d567b){_0x328dac[_0x96a8('0x13')](0x194);}return _0x3d567b;};}function handleError(_0x3a17de,_0x4a4124){_0x4a4124=_0x4a4124||0x1f4;return function(_0x117533){logger[_0x96a8('0x21')](_0x117533[_0x96a8('0x22')]);if(_0x117533[_0x96a8('0x23')]){delete _0x117533[_0x96a8('0x23')];}_0x3a17de[_0x96a8('0x14')](_0x4a4124)['send'](_0x117533);};}exports[_0x96a8('0x24')]=function(_0x24a74a,_0x31ce8b){var _0xdc1a1e={},_0xd568d9={},_0x2cb0c5={'count':0x0,'rows':[]};var _0x47b6f0=_['map'](db[_0x96a8('0x25')][_0x96a8('0x26')],function(_0x4555eb){return{'name':_0x4555eb[_0x96a8('0x27')],'type':_0x4555eb[_0x96a8('0x28')][_0x96a8('0x29')]};});_0xd568d9[_0x96a8('0x2a')]=_[_0x96a8('0x2b')](_0x47b6f0,'name');_0xd568d9['query']=_[_0x96a8('0x2c')](_0x24a74a['query']);_0xd568d9[_0x96a8('0x2d')]=_[_0x96a8('0x2e')](_0xd568d9[_0x96a8('0x2a')],_0xd568d9[_0x96a8('0x2f')]);_0xdc1a1e[_0x96a8('0x30')]=_[_0x96a8('0x2e')](_0xd568d9[_0x96a8('0x2a')],qs[_0x96a8('0x31')](_0x24a74a[_0x96a8('0x2f')]['fields']));_0xdc1a1e[_0x96a8('0x30')]=_0xdc1a1e[_0x96a8('0x30')]['length']?_0xdc1a1e[_0x96a8('0x30')]:_0xd568d9[_0x96a8('0x2a')];if(!_0x24a74a['query']['hasOwnProperty'](_0x96a8('0x32'))){_0xdc1a1e[_0x96a8('0x16')]=qs['limit'](_0x24a74a[_0x96a8('0x2f')][_0x96a8('0x16')]);_0xdc1a1e[_0x96a8('0x19')]=qs['offset'](_0x24a74a[_0x96a8('0x2f')][_0x96a8('0x19')]);}_0xdc1a1e[_0x96a8('0x33')]=qs[_0x96a8('0x34')](_0x24a74a[_0x96a8('0x2f')][_0x96a8('0x34')]);_0xdc1a1e[_0x96a8('0x35')]=qs[_0x96a8('0x2d')](_[_0x96a8('0x36')](_0x24a74a['query'],_0xd568d9[_0x96a8('0x2d')]),_0x47b6f0);if(_0x24a74a[_0x96a8('0x2f')][_0x96a8('0x37')]){_0xdc1a1e[_0x96a8('0x35')]=_['merge'](_0xdc1a1e[_0x96a8('0x35')],{'$or':_[_0x96a8('0x2b')](_0x47b6f0,function(_0x43eb2e){if(_0x43eb2e[_0x96a8('0x28')]!==_0x96a8('0x38')){var _0x2cdcad={};_0x2cdcad[_0x43eb2e[_0x96a8('0x23')]]={'$like':'%'+_0x24a74a[_0x96a8('0x2f')][_0x96a8('0x37')]+'%'};return _0x2cdcad;}})});}_0xdc1a1e=_[_0x96a8('0x39')]({},_0xdc1a1e,_0x24a74a['options']);var _0x5e451b={'where':_0xdc1a1e[_0x96a8('0x35')]};return db[_0x96a8('0x25')][_0x96a8('0x18')](_0x5e451b)[_0x96a8('0x1f')](function(_0x419ee4){_0x2cb0c5[_0x96a8('0x18')]=_0x419ee4;if(_0x24a74a['query'][_0x96a8('0x3a')]){_0xdc1a1e['include']=[{'all':!![]}];}return db[_0x96a8('0x25')][_0x96a8('0x3b')](_0xdc1a1e);})[_0x96a8('0x1f')](function(_0x3bc3fb){_0x2cb0c5[_0x96a8('0x3c')]=_0x3bc3fb;return _0x2cb0c5;})[_0x96a8('0x1f')](respondWithFilteredResult(_0x31ce8b,_0xdc1a1e))[_0x96a8('0x3d')](handleError(_0x31ce8b,null));};exports[_0x96a8('0x3e')]=function(_0x328e6f,_0x2e5826){var _0x1e3593={'raw':![],'where':{'id':_0x328e6f['params']['id']}},_0x198f00={};_0x198f00['model']=_['keys'](db['Automation']['rawAttributes']);_0x198f00[_0x96a8('0x2f')]=_[_0x96a8('0x2c')](_0x328e6f[_0x96a8('0x2f')]);_0x198f00['filters']=_[_0x96a8('0x2e')](_0x198f00[_0x96a8('0x2a')],_0x198f00[_0x96a8('0x2f')]);_0x1e3593[_0x96a8('0x30')]=_[_0x96a8('0x2e')](_0x198f00[_0x96a8('0x2a')],qs[_0x96a8('0x31')](_0x328e6f[_0x96a8('0x2f')][_0x96a8('0x31')]));_0x1e3593[_0x96a8('0x30')]=_0x1e3593[_0x96a8('0x30')][_0x96a8('0x3f')]?_0x1e3593[_0x96a8('0x30')]:_0x198f00[_0x96a8('0x2a')];if(_0x328e6f[_0x96a8('0x2f')][_0x96a8('0x3a')]){_0x1e3593[_0x96a8('0x40')]=[{'all':!![]}];}_0x1e3593=_['merge']({},_0x1e3593,_0x328e6f['options']);return db[_0x96a8('0x25')][_0x96a8('0x41')](_0x1e3593)['then'](handleEntityNotFound(_0x2e5826,null))[_0x96a8('0x1f')](respondWithResult(_0x2e5826,null))[_0x96a8('0x3d')](handleError(_0x2e5826,null));};exports[_0x96a8('0x42')]=function(_0x3ba1dc,_0x183cc5){return db[_0x96a8('0x25')]['create'](_0x3ba1dc['body'],{})[_0x96a8('0x1f')](respondWithResult(_0x183cc5,0xc9))[_0x96a8('0x3d')](handleError(_0x183cc5,null));};exports['update']=function(_0x22106a,_0x1aa08d){if(_0x22106a[_0x96a8('0x43')]['id']){delete _0x22106a[_0x96a8('0x43')]['id'];}return db[_0x96a8('0x25')]['find']({'where':{'id':_0x22106a[_0x96a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x1aa08d,null))['then'](saveUpdates(_0x22106a[_0x96a8('0x43')],null))[_0x96a8('0x1f')](respondWithResult(_0x1aa08d,null))['catch'](handleError(_0x1aa08d,null));};exports['destroy']=function(_0x643820,_0x5bed48){return db['Automation'][_0x96a8('0x41')]({'where':{'id':_0x643820[_0x96a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bed48,null))[_0x96a8('0x1f')](removeEntity(_0x5bed48,null))[_0x96a8('0x3d')](handleError(_0x5bed48,null));};exports[_0x96a8('0x45')]=function(_0x39ad16,_0x15c327,_0x2c4daa){return db[_0x96a8('0x46')]['find']({'where':{'id':_0x39ad16[_0x96a8('0x44')]['id']}})[_0x96a8('0x1f')](handleEntityNotFound(_0x15c327,null))[_0x96a8('0x1f')](function(_0x150f40){if(_0x150f40){return _0x150f40[_0x96a8('0x45')](_0x39ad16['body']['ids'],_['omit'](_0x39ad16[_0x96a8('0x43')],[_0x96a8('0x47'),'id'])||{});}})[_0x96a8('0x1f')](respondWithResult(_0x15c327,null))[_0x96a8('0x3d')](handleError(_0x15c327,null));};exports[_0x96a8('0x48')]=function(_0x131d1c,_0x20cec7,_0x400414){var _0x4003fd={};var _0x1d0252={};var _0x305e37;var _0x3e9abe;return db[_0x96a8('0x25')][_0x96a8('0x49')]({'where':{'id':_0x131d1c[_0x96a8('0x44')]['id']}})[_0x96a8('0x1f')](handleEntityNotFound(_0x20cec7,null))['then'](function(_0x47da30){if(_0x47da30){_0x305e37=_0x47da30;_0x1d0252[_0x96a8('0x2a')]=_[_0x96a8('0x2c')](db[_0x96a8('0x46')][_0x96a8('0x26')]);_0x1d0252[_0x96a8('0x2f')]=_[_0x96a8('0x2c')](_0x131d1c['query']);_0x1d0252['filters']=_[_0x96a8('0x2e')](_0x1d0252[_0x96a8('0x2a')],_0x1d0252[_0x96a8('0x2f')]);_0x4003fd[_0x96a8('0x30')]=_[_0x96a8('0x2e')](_0x1d0252[_0x96a8('0x2a')],qs[_0x96a8('0x31')](_0x131d1c[_0x96a8('0x2f')][_0x96a8('0x31')]));_0x4003fd['attributes']=_0x4003fd[_0x96a8('0x30')][_0x96a8('0x3f')]?_0x4003fd[_0x96a8('0x30')]:_0x1d0252[_0x96a8('0x2a')];_0x4003fd[_0x96a8('0x33')]=qs[_0x96a8('0x34')](_0x131d1c[_0x96a8('0x2f')]['sort']);_0x4003fd[_0x96a8('0x35')]=qs[_0x96a8('0x2d')](_[_0x96a8('0x36')](_0x131d1c['query'],_0x1d0252[_0x96a8('0x2d')]));if(_0x131d1c[_0x96a8('0x2f')][_0x96a8('0x37')]){_0x4003fd['where']=_[_0x96a8('0x39')](_0x4003fd[_0x96a8('0x35')],{'$or':_[_0x96a8('0x2b')](_0x4003fd[_0x96a8('0x30')],function(_0x46cee3){var _0x2f7dd5={};_0x2f7dd5[_0x46cee3]={'$like':'%'+_0x131d1c[_0x96a8('0x2f')][_0x96a8('0x37')]+'%'};return _0x2f7dd5;})});}_0x4003fd=_['merge']({},_0x4003fd,_0x131d1c[_0x96a8('0x4a')]);return _0x305e37[_0x96a8('0x48')](_0x4003fd);}})[_0x96a8('0x1f')](function(_0x4cb865){if(_0x4cb865){_0x3e9abe=_0x4cb865[_0x96a8('0x3f')];if(!_0x131d1c[_0x96a8('0x2f')][_0x96a8('0x4b')](_0x96a8('0x32'))){_0x4003fd['limit']=qs[_0x96a8('0x16')](_0x131d1c['query']['limit']);_0x4003fd[_0x96a8('0x19')]=qs[_0x96a8('0x19')](_0x131d1c[_0x96a8('0x2f')]['offset']);}return _0x305e37[_0x96a8('0x48')](_0x4003fd);}})['then'](function(_0x1c8bf9){if(_0x1c8bf9){return _0x1c8bf9?{'count':_0x3e9abe,'rows':_0x1c8bf9}:null;}})[_0x96a8('0x1f')](respondWithResult(_0x20cec7,null))['catch'](handleError(_0x20cec7,null));};exports['addActions']=function(_0x5c331b,_0x55aa58,_0x368de1){return db['Action'][_0x96a8('0x41')]({'where':{'id':_0x5c331b[_0x96a8('0x44')]['id']}})[_0x96a8('0x1f')](handleEntityNotFound(_0x55aa58,null))[_0x96a8('0x1f')](function(_0x3b0d58){if(_0x3b0d58){return _0x3b0d58['addActions'](_0x5c331b[_0x96a8('0x43')][_0x96a8('0x47')],_['omit'](_0x5c331b[_0x96a8('0x43')],[_0x96a8('0x47'),'id'])||{});}})['then'](respondWithResult(_0x55aa58,null))[_0x96a8('0x3d')](handleError(_0x55aa58,null));};exports['getActions']=function(_0x575ca9,_0xbd6dd8,_0x4a76da){var _0x523e33={};var _0x56f4e1={};var _0x31eacd;var _0xd32233;return db[_0x96a8('0x25')][_0x96a8('0x49')]({'where':{'id':_0x575ca9[_0x96a8('0x44')]['id']}})['then'](handleEntityNotFound(_0xbd6dd8,null))[_0x96a8('0x1f')](function(_0x11c980){if(_0x11c980){_0x31eacd=_0x11c980;_0x56f4e1[_0x96a8('0x2a')]=_[_0x96a8('0x2c')](db['Action'][_0x96a8('0x26')]);_0x56f4e1[_0x96a8('0x2f')]=_[_0x96a8('0x2c')](_0x575ca9['query']);_0x56f4e1[_0x96a8('0x2d')]=_[_0x96a8('0x2e')](_0x56f4e1[_0x96a8('0x2a')],_0x56f4e1[_0x96a8('0x2f')]);_0x523e33[_0x96a8('0x30')]=_['intersection'](_0x56f4e1['model'],qs[_0x96a8('0x31')](_0x575ca9[_0x96a8('0x2f')][_0x96a8('0x31')]));_0x523e33['attributes']=_0x523e33[_0x96a8('0x30')][_0x96a8('0x3f')]?_0x523e33[_0x96a8('0x30')]:_0x56f4e1[_0x96a8('0x2a')];_0x523e33['order']=qs[_0x96a8('0x34')](_0x575ca9[_0x96a8('0x2f')]['sort']);_0x523e33['where']=qs['filters'](_[_0x96a8('0x36')](_0x575ca9[_0x96a8('0x2f')],_0x56f4e1[_0x96a8('0x2d')]));if(_0x575ca9[_0x96a8('0x2f')][_0x96a8('0x37')]){_0x523e33['where']=_[_0x96a8('0x39')](_0x523e33[_0x96a8('0x35')],{'$or':_[_0x96a8('0x2b')](_0x523e33['attributes'],function(_0x59d5b4){var _0xebceb9={};_0xebceb9[_0x59d5b4]={'$like':'%'+_0x575ca9['query'][_0x96a8('0x37')]+'%'};return _0xebceb9;})});}_0x523e33=_[_0x96a8('0x39')]({},_0x523e33,_0x575ca9['options']);return _0x31eacd['getActions'](_0x523e33);}})['then'](function(_0x4b7cee){if(_0x4b7cee){_0xd32233=_0x4b7cee[_0x96a8('0x3f')];if(!_0x575ca9['query']['hasOwnProperty'](_0x96a8('0x32'))){_0x523e33[_0x96a8('0x16')]=qs['limit'](_0x575ca9['query']['limit']);_0x523e33[_0x96a8('0x19')]=qs[_0x96a8('0x19')](_0x575ca9['query'][_0x96a8('0x19')]);}return _0x31eacd[_0x96a8('0x4c')](_0x523e33);}})[_0x96a8('0x1f')](function(_0x419104){if(_0x419104){return _0x419104?{'count':_0xd32233,'rows':_0x419104}:null;}})['then'](respondWithResult(_0xbd6dd8,null))[_0x96a8('0x3d')](handleError(_0xbd6dd8,null));}; \ No newline at end of file +var _0x8a8d=['reject','save','update','then','destroy','end','error','stack','name','index','map','Automation','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','length','include','options','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','getActions','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a8d,0x1d3));var _0xd8a8=function(_0x874d96,_0xbea28b){_0x874d96=_0x874d96-0x0;var _0x42d821=_0x8a8d[_0x874d96];return _0x42d821;};'use strict';var emlformat=require(_0xd8a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd8a8('0x2'));var moment=require(_0xd8a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd8a8('0x4'));var util=require(_0xd8a8('0x5'));var path=require(_0xd8a8('0x6'));var sox=require(_0xd8a8('0x7'));var csv=require(_0xd8a8('0x8'));var ejs=require(_0xd8a8('0x9'));var fs=require('fs');var fs_extra=require(_0xd8a8('0xa'));var _=require('lodash');var squel=require(_0xd8a8('0xb'));var crypto=require(_0xd8a8('0xc'));var jsforce=require(_0xd8a8('0xd'));var deskjs=require(_0xd8a8('0xe'));var toCsv=require(_0xd8a8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8a8('0xf'));var authService=require(_0xd8a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd8a8('0x11'));var hardwareService=require(_0xd8a8('0x12'));var logger=require(_0xd8a8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd8a8('0x14'));var licenseUtil=require(_0xd8a8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b2306,_0x98e4e4){_0x98e4e4=_0x98e4e4||0xcc;return function(_0x1a18f3){if(_0x1a18f3){return _0x5b2306[_0xd8a8('0x16')](_0x98e4e4);}return _0x5b2306[_0xd8a8('0x17')](_0x98e4e4)['end']();};}function respondWithResult(_0x29a9ed,_0x3041ef){_0x3041ef=_0x3041ef||0xc8;return function(_0x1a3f1b){if(_0x1a3f1b){return _0x29a9ed[_0xd8a8('0x17')](_0x3041ef)[_0xd8a8('0x18')](_0x1a3f1b);}};}function respondWithFilteredResult(_0x2034b4,_0x4e911b){return function(_0x2ef247){if(_0x2ef247){var _0x5cae3e=typeof _0x4e911b[_0xd8a8('0x19')]==='undefined'&&typeof _0x4e911b[_0xd8a8('0x1a')]===_0xd8a8('0x1b');var _0x4b3c67=_0x2ef247[_0xd8a8('0x1c')];var _0xed58ce=_0x5cae3e?0x0:_0x4e911b[_0xd8a8('0x19')];var _0x217545=_0x5cae3e?_0x2ef247[_0xd8a8('0x1c')]:_0x4e911b['offset']+_0x4e911b[_0xd8a8('0x1a')];var _0x2eae9c;if(_0x217545>=_0x4b3c67){_0x217545=_0x4b3c67;_0x2eae9c=0xc8;}else{_0x2eae9c=0xce;}_0x2034b4[_0xd8a8('0x17')](_0x2eae9c);return _0x2034b4[_0xd8a8('0x1d')]('Content-Range',_0xed58ce+'-'+_0x217545+'/'+_0x4b3c67)[_0xd8a8('0x18')](_0x2ef247);}return null;};}function patchUpdates(_0x282519){return function(_0x5ae03d){try{jsonpatch[_0xd8a8('0x1e')](_0x5ae03d,_0x282519,!![]);}catch(_0x2c9403){return BPromise[_0xd8a8('0x1f')](_0x2c9403);}return _0x5ae03d[_0xd8a8('0x20')]();};}function saveUpdates(_0x4a4f57,_0x5045f0){return function(_0x207f08){if(_0x207f08){return _0x207f08[_0xd8a8('0x21')](_0x4a4f57)[_0xd8a8('0x22')](function(_0x19ebdf){return _0x19ebdf;});}return null;};}function removeEntity(_0x4bea3d,_0x4c5539){return function(_0x23ac91){if(_0x23ac91){return _0x23ac91[_0xd8a8('0x23')]()['then'](function(){_0x4bea3d[_0xd8a8('0x17')](0xcc)[_0xd8a8('0x24')]();});}};}function handleEntityNotFound(_0x4bab6d,_0x2a1865){return function(_0x31cf30){if(!_0x31cf30){_0x4bab6d[_0xd8a8('0x16')](0x194);}return _0x31cf30;};}function handleError(_0x2414d8,_0x48d703){_0x48d703=_0x48d703||0x1f4;return function(_0x976a65){logger[_0xd8a8('0x25')](_0x976a65[_0xd8a8('0x26')]);if(_0x976a65[_0xd8a8('0x27')]){delete _0x976a65[_0xd8a8('0x27')];}_0x2414d8[_0xd8a8('0x17')](_0x48d703)['send'](_0x976a65);};}exports[_0xd8a8('0x28')]=function(_0x563577,_0x2af619){var _0x557f0b={},_0x3696a0={},_0xe5e523={'count':0x0,'rows':[]};var _0x2b65d5=_[_0xd8a8('0x29')](db[_0xd8a8('0x2a')][_0xd8a8('0x2b')],function(_0x255383){return{'name':_0x255383[_0xd8a8('0x2c')],'type':_0x255383[_0xd8a8('0x2d')][_0xd8a8('0x2e')]};});_0x3696a0['model']=_[_0xd8a8('0x29')](_0x2b65d5,'name');_0x3696a0[_0xd8a8('0x2f')]=_['keys'](_0x563577[_0xd8a8('0x2f')]);_0x3696a0[_0xd8a8('0x30')]=_[_0xd8a8('0x31')](_0x3696a0['model'],_0x3696a0[_0xd8a8('0x2f')]);_0x557f0b[_0xd8a8('0x32')]=_[_0xd8a8('0x31')](_0x3696a0[_0xd8a8('0x33')],qs[_0xd8a8('0x34')](_0x563577[_0xd8a8('0x2f')][_0xd8a8('0x34')]));_0x557f0b[_0xd8a8('0x32')]=_0x557f0b[_0xd8a8('0x32')]['length']?_0x557f0b['attributes']:_0x3696a0[_0xd8a8('0x33')];if(!_0x563577[_0xd8a8('0x2f')][_0xd8a8('0x35')](_0xd8a8('0x36'))){_0x557f0b[_0xd8a8('0x1a')]=qs[_0xd8a8('0x1a')](_0x563577['query'][_0xd8a8('0x1a')]);_0x557f0b[_0xd8a8('0x19')]=qs[_0xd8a8('0x19')](_0x563577[_0xd8a8('0x2f')][_0xd8a8('0x19')]);}_0x557f0b[_0xd8a8('0x37')]=qs[_0xd8a8('0x38')](_0x563577['query'][_0xd8a8('0x38')]);_0x557f0b[_0xd8a8('0x39')]=qs['filters'](_[_0xd8a8('0x3a')](_0x563577[_0xd8a8('0x2f')],_0x3696a0[_0xd8a8('0x30')]),_0x2b65d5);if(_0x563577[_0xd8a8('0x2f')][_0xd8a8('0x3b')]){_0x557f0b['where']=_['merge'](_0x557f0b[_0xd8a8('0x39')],{'$or':_[_0xd8a8('0x29')](_0x2b65d5,function(_0x44574f){if(_0x44574f['type']!=='VIRTUAL'){var _0x301f10={};_0x301f10[_0x44574f[_0xd8a8('0x27')]]={'$like':'%'+_0x563577[_0xd8a8('0x2f')][_0xd8a8('0x3b')]+'%'};return _0x301f10;}})});}_0x557f0b=_[_0xd8a8('0x3c')]({},_0x557f0b,_0x563577['options']);var _0x41a48a={'where':_0x557f0b['where']};return db['Automation']['count'](_0x41a48a)['then'](function(_0x57f70b){_0xe5e523['count']=_0x57f70b;if(_0x563577['query'][_0xd8a8('0x3d')]){_0x557f0b['include']=[{'all':!![]}];}return db[_0xd8a8('0x2a')][_0xd8a8('0x3e')](_0x557f0b);})[_0xd8a8('0x22')](function(_0x1466e4){_0xe5e523[_0xd8a8('0x3f')]=_0x1466e4;return _0xe5e523;})[_0xd8a8('0x22')](respondWithFilteredResult(_0x2af619,_0x557f0b))[_0xd8a8('0x40')](handleError(_0x2af619,null));};exports[_0xd8a8('0x41')]=function(_0x2977fa,_0x470ec0){var _0xbfd748={'raw':![],'where':{'id':_0x2977fa[_0xd8a8('0x42')]['id']}},_0x2c34d4={};_0x2c34d4[_0xd8a8('0x33')]=_['keys'](db[_0xd8a8('0x2a')][_0xd8a8('0x2b')]);_0x2c34d4[_0xd8a8('0x2f')]=_[_0xd8a8('0x43')](_0x2977fa[_0xd8a8('0x2f')]);_0x2c34d4['filters']=_[_0xd8a8('0x31')](_0x2c34d4['model'],_0x2c34d4[_0xd8a8('0x2f')]);_0xbfd748[_0xd8a8('0x32')]=_['intersection'](_0x2c34d4['model'],qs['fields'](_0x2977fa['query']['fields']));_0xbfd748[_0xd8a8('0x32')]=_0xbfd748[_0xd8a8('0x32')][_0xd8a8('0x44')]?_0xbfd748[_0xd8a8('0x32')]:_0x2c34d4[_0xd8a8('0x33')];if(_0x2977fa[_0xd8a8('0x2f')][_0xd8a8('0x3d')]){_0xbfd748[_0xd8a8('0x45')]=[{'all':!![]}];}_0xbfd748=_[_0xd8a8('0x3c')]({},_0xbfd748,_0x2977fa[_0xd8a8('0x46')]);return db[_0xd8a8('0x2a')][_0xd8a8('0x47')](_0xbfd748)[_0xd8a8('0x22')](handleEntityNotFound(_0x470ec0,null))[_0xd8a8('0x22')](respondWithResult(_0x470ec0,null))['catch'](handleError(_0x470ec0,null));};exports['create']=function(_0x4e976c,_0x5cd897){return db[_0xd8a8('0x2a')][_0xd8a8('0x48')](_0x4e976c[_0xd8a8('0x49')],{})[_0xd8a8('0x22')](respondWithResult(_0x5cd897,0xc9))[_0xd8a8('0x40')](handleError(_0x5cd897,null));};exports[_0xd8a8('0x21')]=function(_0x2c0549,_0x39c9b8){if(_0x2c0549[_0xd8a8('0x49')]['id']){delete _0x2c0549[_0xd8a8('0x49')]['id'];}return db[_0xd8a8('0x2a')][_0xd8a8('0x47')]({'where':{'id':_0x2c0549[_0xd8a8('0x42')]['id']}})[_0xd8a8('0x22')](handleEntityNotFound(_0x39c9b8,null))['then'](saveUpdates(_0x2c0549[_0xd8a8('0x49')],null))['then'](respondWithResult(_0x39c9b8,null))[_0xd8a8('0x40')](handleError(_0x39c9b8,null));};exports['destroy']=function(_0x6c5e8a,_0x4123c8){return db[_0xd8a8('0x2a')]['find']({'where':{'id':_0x6c5e8a[_0xd8a8('0x42')]['id']}})['then'](handleEntityNotFound(_0x4123c8,null))[_0xd8a8('0x22')](removeEntity(_0x4123c8,null))[_0xd8a8('0x40')](handleError(_0x4123c8,null));};exports[_0xd8a8('0x4a')]=function(_0x39a149,_0x546935,_0x5a530b){return db[_0xd8a8('0x4b')][_0xd8a8('0x47')]({'where':{'id':_0x39a149['params']['id']}})[_0xd8a8('0x22')](handleEntityNotFound(_0x546935,null))[_0xd8a8('0x22')](function(_0x444cfe){if(_0x444cfe){return _0x444cfe[_0xd8a8('0x4a')](_0x39a149[_0xd8a8('0x49')][_0xd8a8('0x4c')],_[_0xd8a8('0x4d')](_0x39a149[_0xd8a8('0x49')],[_0xd8a8('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x546935,null))['catch'](handleError(_0x546935,null));};exports['getConditions']=function(_0x367a6b,_0x3ef6da,_0x18273c){var _0x16546d={};var _0x28b177={};var _0x4f582b;var _0x36aa95;return db[_0xd8a8('0x2a')][_0xd8a8('0x4e')]({'where':{'id':_0x367a6b['params']['id']}})[_0xd8a8('0x22')](handleEntityNotFound(_0x3ef6da,null))['then'](function(_0x5cd59f){if(_0x5cd59f){_0x4f582b=_0x5cd59f;_0x28b177[_0xd8a8('0x33')]=_['keys'](db[_0xd8a8('0x4b')][_0xd8a8('0x2b')]);_0x28b177[_0xd8a8('0x2f')]=_[_0xd8a8('0x43')](_0x367a6b[_0xd8a8('0x2f')]);_0x28b177[_0xd8a8('0x30')]=_[_0xd8a8('0x31')](_0x28b177['model'],_0x28b177[_0xd8a8('0x2f')]);_0x16546d['attributes']=_['intersection'](_0x28b177['model'],qs[_0xd8a8('0x34')](_0x367a6b['query'][_0xd8a8('0x34')]));_0x16546d[_0xd8a8('0x32')]=_0x16546d[_0xd8a8('0x32')][_0xd8a8('0x44')]?_0x16546d['attributes']:_0x28b177['model'];_0x16546d[_0xd8a8('0x37')]=qs[_0xd8a8('0x38')](_0x367a6b[_0xd8a8('0x2f')][_0xd8a8('0x38')]);_0x16546d[_0xd8a8('0x39')]=qs['filters'](_['pick'](_0x367a6b[_0xd8a8('0x2f')],_0x28b177[_0xd8a8('0x30')]));if(_0x367a6b[_0xd8a8('0x2f')][_0xd8a8('0x3b')]){_0x16546d[_0xd8a8('0x39')]=_[_0xd8a8('0x3c')](_0x16546d[_0xd8a8('0x39')],{'$or':_[_0xd8a8('0x29')](_0x16546d[_0xd8a8('0x32')],function(_0x52d547){var _0x5cc2c8={};_0x5cc2c8[_0x52d547]={'$like':'%'+_0x367a6b[_0xd8a8('0x2f')]['filter']+'%'};return _0x5cc2c8;})});}_0x16546d=_['merge']({},_0x16546d,_0x367a6b['options']);return _0x4f582b[_0xd8a8('0x4f')](_0x16546d);}})[_0xd8a8('0x22')](function(_0x473988){if(_0x473988){_0x36aa95=_0x473988['length'];if(!_0x367a6b[_0xd8a8('0x2f')]['hasOwnProperty']('nolimit')){_0x16546d[_0xd8a8('0x1a')]=qs[_0xd8a8('0x1a')](_0x367a6b[_0xd8a8('0x2f')][_0xd8a8('0x1a')]);_0x16546d[_0xd8a8('0x19')]=qs[_0xd8a8('0x19')](_0x367a6b['query'][_0xd8a8('0x19')]);}return _0x4f582b['getConditions'](_0x16546d);}})['then'](function(_0x5d4747){if(_0x5d4747){return _0x5d4747?{'count':_0x36aa95,'rows':_0x5d4747}:null;}})[_0xd8a8('0x22')](respondWithResult(_0x3ef6da,null))['catch'](handleError(_0x3ef6da,null));};exports[_0xd8a8('0x50')]=function(_0x5e79b9,_0xb3f0df,_0x225e7c){return db[_0xd8a8('0x51')][_0xd8a8('0x47')]({'where':{'id':_0x5e79b9['params']['id']}})[_0xd8a8('0x22')](handleEntityNotFound(_0xb3f0df,null))['then'](function(_0x4f000e){if(_0x4f000e){return _0x4f000e[_0xd8a8('0x50')](_0x5e79b9[_0xd8a8('0x49')][_0xd8a8('0x4c')],_[_0xd8a8('0x4d')](_0x5e79b9[_0xd8a8('0x49')],[_0xd8a8('0x4c'),'id'])||{});}})[_0xd8a8('0x22')](respondWithResult(_0xb3f0df,null))[_0xd8a8('0x40')](handleError(_0xb3f0df,null));};exports[_0xd8a8('0x52')]=function(_0xd1e013,_0x45aee4,_0x53626f){var _0x1929b6={};var _0x22ad66={};var _0x3f420d;var _0x3e82fe;return db[_0xd8a8('0x2a')]['findOne']({'where':{'id':_0xd1e013[_0xd8a8('0x42')]['id']}})[_0xd8a8('0x22')](handleEntityNotFound(_0x45aee4,null))[_0xd8a8('0x22')](function(_0x10fabc){if(_0x10fabc){_0x3f420d=_0x10fabc;_0x22ad66[_0xd8a8('0x33')]=_[_0xd8a8('0x43')](db['Action']['rawAttributes']);_0x22ad66[_0xd8a8('0x2f')]=_[_0xd8a8('0x43')](_0xd1e013[_0xd8a8('0x2f')]);_0x22ad66['filters']=_[_0xd8a8('0x31')](_0x22ad66['model'],_0x22ad66[_0xd8a8('0x2f')]);_0x1929b6[_0xd8a8('0x32')]=_['intersection'](_0x22ad66[_0xd8a8('0x33')],qs[_0xd8a8('0x34')](_0xd1e013[_0xd8a8('0x2f')][_0xd8a8('0x34')]));_0x1929b6[_0xd8a8('0x32')]=_0x1929b6[_0xd8a8('0x32')][_0xd8a8('0x44')]?_0x1929b6[_0xd8a8('0x32')]:_0x22ad66[_0xd8a8('0x33')];_0x1929b6['order']=qs[_0xd8a8('0x38')](_0xd1e013[_0xd8a8('0x2f')][_0xd8a8('0x38')]);_0x1929b6[_0xd8a8('0x39')]=qs[_0xd8a8('0x30')](_['pick'](_0xd1e013['query'],_0x22ad66[_0xd8a8('0x30')]));if(_0xd1e013[_0xd8a8('0x2f')][_0xd8a8('0x3b')]){_0x1929b6['where']=_[_0xd8a8('0x3c')](_0x1929b6['where'],{'$or':_['map'](_0x1929b6['attributes'],function(_0x17c2c5){var _0x2819e4={};_0x2819e4[_0x17c2c5]={'$like':'%'+_0xd1e013[_0xd8a8('0x2f')]['filter']+'%'};return _0x2819e4;})});}_0x1929b6=_['merge']({},_0x1929b6,_0xd1e013[_0xd8a8('0x46')]);return _0x3f420d[_0xd8a8('0x52')](_0x1929b6);}})[_0xd8a8('0x22')](function(_0x48d827){if(_0x48d827){_0x3e82fe=_0x48d827[_0xd8a8('0x44')];if(!_0xd1e013[_0xd8a8('0x2f')]['hasOwnProperty'](_0xd8a8('0x36'))){_0x1929b6[_0xd8a8('0x1a')]=qs[_0xd8a8('0x1a')](_0xd1e013[_0xd8a8('0x2f')][_0xd8a8('0x1a')]);_0x1929b6[_0xd8a8('0x19')]=qs[_0xd8a8('0x19')](_0xd1e013[_0xd8a8('0x2f')][_0xd8a8('0x19')]);}return _0x3f420d[_0xd8a8('0x52')](_0x1929b6);}})[_0xd8a8('0x22')](function(_0x296852){if(_0x296852){return _0x296852?{'count':_0x3e82fe,'rows':_0x296852}:null;}})[_0xd8a8('0x22')](respondWithResult(_0x45aee4,null))[_0xd8a8('0x40')](handleError(_0x45aee4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c77cd88..3f47072 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 _0x163c=['moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','lodash','util','../../config/logger','api'];(function(_0x2a8d02,_0x1a7ce1){var _0x2c5c34=function(_0x53e985){while(--_0x53e985){_0x2a8d02['push'](_0x2a8d02['shift']());}};_0x2c5c34(++_0x1a7ce1);}(_0x163c,0x1d0));var _0xc163=function(_0x107b5f,_0x28df55){_0x107b5f=_0x107b5f-0x0;var _0x585aa0=_0x163c[_0x107b5f];return _0x585aa0;};'use strict';var _=require(_0xc163('0x0'));var util=require(_0xc163('0x1'));var logger=require(_0xc163('0x2'))(_0xc163('0x3'));var moment=require(_0xc163('0x4'));var BPromise=require('bluebird');var rp=require(_0xc163('0x5'));var fs=require('fs');var path=require(_0xc163('0x6'));var rimraf=require(_0xc163('0x7'));var config=require(_0xc163('0x8'));var attributes=require(_0xc163('0x9'));module[_0xc163('0xa')]=function(_0x45b5c4,_0x332fe8){return _0x45b5c4['define'](_0xc163('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x577a=['api','bluebird','request-promise','path','define','Automation','tools_automations','util','../../config/logger'];(function(_0x5dac84,_0x3114b2){var _0x379fb1=function(_0x5e0bdf){while(--_0x5e0bdf){_0x5dac84['push'](_0x5dac84['shift']());}};_0x379fb1(++_0x3114b2);}(_0x577a,0x14b));var _0xa577=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x577a[_0x1c8c28];return _0x1f59b4;};'use strict';var _=require('lodash');var util=require(_0xa577('0x0'));var logger=require(_0xa577('0x1'))(_0xa577('0x2'));var moment=require('moment');var BPromise=require(_0xa577('0x3'));var rp=require(_0xa577('0x4'));var fs=require('fs');var path=require(_0xa577('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./automation.attributes');module['exports']=function(_0x498475,_0x2511c7){return _0x498475[_0xa577('0x6')](_0xa577('0x7'),attributes,{'tableName':_0xa577('0x8'),'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 e03eb21..e4ac445 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 _0x02a7=['Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x02a7,0x1a6));var _0x702a=function(_0x4ad01d,_0x1f5e22){_0x4ad01d=_0x4ad01d-0x0;var _0x3ec839=_0x02a7[_0x4ad01d];return _0x3ec839;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('Automation,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('Automation,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});} \ No newline at end of file +var _0x94d4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','message','Automation,\x20%s,\x20%s','result','catch','lodash','util','bluebird'];(function(_0x472f45,_0x3bc432){var _0x3ad4a8=function(_0x444080){while(--_0x444080){_0x472f45['push'](_0x472f45['shift']());}};_0x3ad4a8(++_0x3bc432);}(_0x94d4,0xa5));var _0x494d=function(_0x4e5a56,_0x12c78c){_0x4e5a56=_0x4e5a56-0x0;var _0x1195e3=_0x94d4[_0x4e5a56];return _0x1195e3;};'use strict';var _=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var moment=require('moment');var BPromise=require(_0x494d('0x2'));var rs=require(_0x494d('0x3'));var fs=require('fs');var Redis=require(_0x494d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x494d('0x5'));var logger=require(_0x494d('0x6'))(_0x494d('0x7'));var config=require(_0x494d('0x8'));var jayson=require(_0x494d('0x9'));var client=jayson[_0x494d('0xa')][_0x494d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c53d7,_0x4f4576,_0x5269db){return new BPromise(function(_0x396280,_0x3f6b68){return client['request'](_0x4c53d7,_0x5269db)['then'](function(_0x456fe8){logger[_0x494d('0xc')]('Automation,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));logger[_0x494d('0xe')](_0x494d('0xf'),_0x4f4576,_0x494d('0xd'),JSON['stringify'](_0x456fe8));if(_0x456fe8[_0x494d('0x10')]){if(_0x456fe8[_0x494d('0x10')]['code']===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x3f6b68(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);return _0x396280(_0x456fe8[_0x494d('0x10')][_0x494d('0x11')]);}else{logger[_0x494d('0xc')]('Automation,\x20%s,\x20%s',_0x4f4576,_0x494d('0xd'));_0x396280(_0x456fe8[_0x494d('0x13')][_0x494d('0x11')]);}})[_0x494d('0x14')](function(_0x120488){logger[_0x494d('0x10')](_0x494d('0x12'),_0x4f4576,_0x120488);_0x3f6b68(_0x120488);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 935ba17..e58cd11 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 _0x94dc=['post','addConditions','addActions','put','/:id','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','/:id/actions','getActions'];(function(_0x2a0dec,_0xf58f2){var _0x2e6a05=function(_0x1be135){while(--_0x1be135){_0x2a0dec['push'](_0x2a0dec['shift']());}};_0x2e6a05(++_0xf58f2);}(_0x94dc,0xb1));var _0xc94d=function(_0x34517f,_0x246e11){_0x34517f=_0x34517f-0x0;var _0x2c2f33=_0x94dc[_0x34517f];return _0x2c2f33;};'use strict';var multer=require(_0xc94d('0x0'));var util=require('util');var path=require(_0xc94d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc94d('0x2'));var router=express[_0xc94d('0x3')]();var fs_extra=require(_0xc94d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc94d('0x5'));var config=require(_0xc94d('0x6'));var controller=require(_0xc94d('0x7'));router[_0xc94d('0x8')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xa')]);router[_0xc94d('0x8')]('/:id',auth[_0xc94d('0x9')](),controller[_0xc94d('0xb')]);router[_0xc94d('0x8')](_0xc94d('0xc'),auth[_0xc94d('0x9')](),controller['getConditions']);router[_0xc94d('0x8')](_0xc94d('0xd'),auth[_0xc94d('0x9')](),controller[_0xc94d('0xe')]);router[_0xc94d('0xf')]('/',auth[_0xc94d('0x9')](),controller['create']);router[_0xc94d('0xf')](_0xc94d('0xc'),auth[_0xc94d('0x9')](),controller[_0xc94d('0x10')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller[_0xc94d('0x11')]);router[_0xc94d('0x12')](_0xc94d('0x13'),auth[_0xc94d('0x9')](),controller[_0xc94d('0x14')]);router[_0xc94d('0x15')](_0xc94d('0x13'),auth[_0xc94d('0x9')](),controller[_0xc94d('0x16')]);module[_0xc94d('0x17')]=router; \ No newline at end of file +var _0x6c6f=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','/:id','show','get','/:id/conditions','getConditions','/:id/actions','post','create','addConditions','addActions'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x6c6f,0x17a));var _0xf6c6=function(_0x30cb52,_0x638ecb){_0x30cb52=_0x30cb52-0x0;var _0x445ee0=_0x6c6f[_0x30cb52];return _0x445ee0;};'use strict';var multer=require(_0xf6c6('0x0'));var util=require(_0xf6c6('0x1'));var path=require(_0xf6c6('0x2'));var timeout=require(_0xf6c6('0x3'));var express=require(_0xf6c6('0x4'));var router=express[_0xf6c6('0x5')]();var fs_extra=require(_0xf6c6('0x6'));var auth=require(_0xf6c6('0x7'));var interaction=require(_0xf6c6('0x8'));var config=require(_0xf6c6('0x9'));var controller=require(_0xf6c6('0xa'));router['get']('/',auth[_0xf6c6('0xb')](),controller['index']);router['get'](_0xf6c6('0xc'),auth['isAuthenticated'](),controller[_0xf6c6('0xd')]);router[_0xf6c6('0xe')](_0xf6c6('0xf'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x10')]);router['get'](_0xf6c6('0x11'),auth[_0xf6c6('0xb')](),controller['getActions']);router[_0xf6c6('0x12')]('/',auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x13')]);router['post'](_0xf6c6('0xf'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x14')]);router[_0xf6c6('0x12')](_0xf6c6('0x11'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x15')]);router[_0xf6c6('0x16')](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller['update']);router[_0xf6c6('0x17')](_0xf6c6('0xc'),auth[_0xf6c6('0xb')](),controller[_0xf6c6('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 20b59cb..76d9fd8 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 _0xf1e4=['exports','name','ENUM','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1e4,0xb8));var _0x4f1e=function(_0x135d50,_0x2d0c2b){_0x135d50=_0x135d50-0x0;var _0x51cd2e=_0xf1e4[_0x135d50];return _0x51cd2e;};'use strict';var Sequelize=require(_0x4f1e('0x0'));module[_0x4f1e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f1e('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4f1e('0x3')](_0x4f1e('0x4')),'allowNull':![],'defaultValue':_0x4f1e('0x4')},'description':{'type':Sequelize[_0x4f1e('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4f1e('0x6')},'limitCalls':{'type':Sequelize[_0x4f1e('0x7')](0x4)[_0x4f1e('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4f1e('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4f1e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'comment':_0x4f1e('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x4f1e('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4f1e('0x5')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x4f1e('0x3')](_0x4f1e('0xd'),'never',_0x4f1e('0xe')),'defaultValue':_0x4f1e('0xd')},'dialAMDActive':{'type':Sequelize[_0x4f1e('0xf')],'defaultValue':0x0,'comment':_0x4f1e('0x10')},'dialAMDInitialSilence':{'type':Sequelize[_0x4f1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4f1e('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x4f1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4f1e('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4f1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4f1e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4f1e('0x7')](0x9)[_0x4f1e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f1e('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x4f1e('0x7')](0x9)[_0x4f1e('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4f1e('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4f1e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4f1e('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x4f1e('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4f1e('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4f1e('0x7')](0x9)[_0x4f1e('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4f1e('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4f1e('0x3')](_0x4f1e('0x19'),'ASC'),'defaultValue':_0x4f1e('0x19')},'dialPrefix':{'type':Sequelize[_0x4f1e('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f1e('0x1a')},'dialCutDigit':{'type':Sequelize[_0x4f1e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4f1e('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f1e('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f1e('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f1e('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4f1e('0x7')](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f1e('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4f1e('0x7')](0x3)[_0x4f1e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4f1e('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4f1e('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4f1e('0x24')}}; \ No newline at end of file +var _0x8e53=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','UNSIGNED','#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)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e53,0xb6));var _0x38e5=function(_0x356f75,_0x1206c4){_0x356f75=_0x356f75-0x0;var _0x20ffdd=_0x8e53[_0x356f75];return _0x20ffdd;};'use strict';var Sequelize=require(_0x38e5('0x0'));module['exports']={'name':{'type':Sequelize[_0x38e5('0x1')],'unique':_0x38e5('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x38e5('0x3')](_0x38e5('0x4')),'allowNull':![],'defaultValue':_0x38e5('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x38e5('0x5')],'defaultValue':0x0,'comment':_0x38e5('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x38e5('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x38e5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'comment':_0x38e5('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x38e5('0x11')},'dialTimezone':{'type':Sequelize[_0x38e5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x38e5('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x38e5('0x3')]('always',_0x38e5('0x12'),_0x38e5('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x38e5('0x5')],'defaultValue':0x0,'comment':_0x38e5('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x38e5('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x38e5('0x9')](0x9)[_0x38e5('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x38e5('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x38e5('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x38e5('0x9')](0x9)[_0x38e5('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x38e5('0x9')](0x9)[_0x38e5('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x38e5('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x38e5('0x9')](0x9)[_0x38e5('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x38e5('0x9')](0x9)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x38e5('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x38e5('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x38e5('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x38e5('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x38e5('0x3')]('DESC',_0x38e5('0x1a')),'defaultValue':_0x38e5('0x1b')},'dialPrefix':{'type':Sequelize[_0x38e5('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x38e5('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x38e5('0x1c')},'dialCutDigit':{'type':Sequelize[_0x38e5('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x38e5('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x38e5('0x9')](0x3)[_0x38e5('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x38e5('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x38e5('0x9')](0x5)[_0x38e5('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x38e5('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index e3baa39..6924a62 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 _0xb75c=['phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','CmListId','deletedAt\x20IS\x20NULL','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','ids','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','Campaign','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','createdAt','updatedAt','body','omit','update','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','format','spread','dialCheckDuplicateType','insert','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','toString','from','cm_contacts','ListId\x20=\x20?'];(function(_0x1d0912,_0x530c4d){var _0x296277=function(_0x4fc72d){while(--_0x4fc72d){_0x1d0912['push'](_0x1d0912['shift']());}};_0x296277(++_0x530c4d);}(_0xb75c,0x1ce));var _0xcb75=function(_0x3e66f3,_0x12254f){_0x3e66f3=_0x3e66f3-0x0;var _0x317a0=_0xb75c[_0x3e66f3];return _0x317a0;};'use strict';var emlformat=require(_0xcb75('0x0'));var rimraf=require(_0xcb75('0x1'));var zipdir=require(_0xcb75('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb75('0x3'));var moment=require('moment');var BPromise=require(_0xcb75('0x4'));var Mustache=require(_0xcb75('0x5'));var util=require(_0xcb75('0x6'));var path=require('path');var sox=require(_0xcb75('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb75('0x8'));var _=require(_0xcb75('0x9'));var squel=require(_0xcb75('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcb75('0xb'));var querystring=require(_0xcb75('0xc'));var Papa=require(_0xcb75('0xd'));var Redis=require('ioredis');var authService=require(_0xcb75('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xcb75('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcb75('0x10'))('api');var utils=require(_0xcb75('0x11'));var config=require(_0xcb75('0x12'));var licenseUtil=require(_0xcb75('0x13'));var db=require(_0xcb75('0x14'))['db'];function respondWithStatusCode(_0x526c03,_0x1e0bba){_0x1e0bba=_0x1e0bba||0xcc;return function(_0x13c953){if(_0x13c953){return _0x526c03[_0xcb75('0x15')](_0x1e0bba);}return _0x526c03[_0xcb75('0x16')](_0x1e0bba)[_0xcb75('0x17')]();};}function respondWithResult(_0x3ae629,_0x23c719){_0x23c719=_0x23c719||0xc8;return function(_0x2c14a1){if(_0x2c14a1){return _0x3ae629['status'](_0x23c719)['json'](_0x2c14a1);}};}function respondWithFilteredResult(_0xa0ce25,_0x1af8c1){return function(_0x589afc){if(_0x589afc){var _0x1b9765=typeof _0x1af8c1[_0xcb75('0x18')]==='undefined'&&typeof _0x1af8c1[_0xcb75('0x19')]===_0xcb75('0x1a');var _0x1a0413=_0x589afc[_0xcb75('0x1b')];var _0x57ad84=_0x1b9765?0x0:_0x1af8c1[_0xcb75('0x18')];var _0x32a66f=_0x1b9765?_0x589afc['count']:_0x1af8c1[_0xcb75('0x18')]+_0x1af8c1[_0xcb75('0x19')];var _0x6be8f0;if(_0x32a66f>=_0x1a0413){_0x32a66f=_0x1a0413;_0x6be8f0=0xc8;}else{_0x6be8f0=0xce;}_0xa0ce25[_0xcb75('0x16')](_0x6be8f0);return _0xa0ce25['set'](_0xcb75('0x1c'),_0x57ad84+'-'+_0x32a66f+'/'+_0x1a0413)[_0xcb75('0x1d')](_0x589afc);}return null;};}function patchUpdates(_0x14bba7){return function(_0x2489e9){try{jsonpatch[_0xcb75('0x1e')](_0x2489e9,_0x14bba7,!![]);}catch(_0x232c57){return BPromise['reject'](_0x232c57);}return _0x2489e9[_0xcb75('0x1f')]();};}function saveUpdates(_0x4ca28b,_0x265cf2){return function(_0x78e743){if(_0x78e743){return _0x78e743['update'](_0x4ca28b)[_0xcb75('0x20')](function(_0x1a7154){return _0x1a7154;});}return null;};}function removeEntity(_0x5b0874,_0x29a56e){return function(_0x338222){if(_0x338222){return _0x338222[_0xcb75('0x21')]()[_0xcb75('0x20')](function(){var _0x3c22fa=_0x338222[_0xcb75('0x22')]({'plain':!![]});var _0x1f6df6='IvrCampaigns';return db[_0xcb75('0x23')][_0xcb75('0x21')]({'where':{'type':_0x1f6df6,'resourceId':_0x3c22fa['id']}})['then'](function(){return _0x338222;});})[_0xcb75('0x20')](function(){_0x5b0874[_0xcb75('0x16')](0xcc)[_0xcb75('0x17')]();});}};}function handleEntityNotFound(_0x11b9c3,_0x2a3a6a){return function(_0x39e9d1){if(!_0x39e9d1){_0x11b9c3[_0xcb75('0x15')](0x194);}return _0x39e9d1;};}function handleError(_0x14e356,_0x10950e){_0x10950e=_0x10950e||0x1f4;return function(_0x54d718){logger[_0xcb75('0x24')](_0x54d718[_0xcb75('0x25')]);if(_0x54d718['name']){delete _0x54d718[_0xcb75('0x26')];}_0x14e356[_0xcb75('0x16')](_0x10950e)[_0xcb75('0x27')](_0x54d718);};}exports[_0xcb75('0x28')]=function(_0x203bcd,_0x4bd240){var _0x562b4a={},_0x551844={},_0x5898da={'count':0x0,'rows':[]};var _0x1c59fa=_['map'](db[_0xcb75('0x29')]['rawAttributes'],function(_0x1ed0c2){return{'name':_0x1ed0c2[_0xcb75('0x2a')],'type':_0x1ed0c2[_0xcb75('0x2b')]['key']};});_0x551844['model']=_[_0xcb75('0x2c')](_0x1c59fa,_0xcb75('0x26'));_0x551844[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x203bcd[_0xcb75('0x2d')]);_0x551844[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x551844[_0xcb75('0x31')],_0x551844[_0xcb75('0x2d')]);_0x562b4a[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x551844[_0xcb75('0x31')],qs['fields'](_0x203bcd[_0xcb75('0x2d')][_0xcb75('0x33')]));_0x562b4a['attributes']=_0x562b4a[_0xcb75('0x32')][_0xcb75('0x34')]?_0x562b4a[_0xcb75('0x32')]:_0x551844['model'];if(!_0x203bcd['query'][_0xcb75('0x35')](_0xcb75('0x36'))){_0x562b4a['limit']=qs[_0xcb75('0x19')](_0x203bcd['query'][_0xcb75('0x19')]);_0x562b4a[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x203bcd['query'][_0xcb75('0x18')]);}_0x562b4a[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x203bcd[_0xcb75('0x2d')][_0xcb75('0x38')]);_0x562b4a[_0xcb75('0x39')]=qs[_0xcb75('0x2f')](_[_0xcb75('0x3a')](_0x203bcd[_0xcb75('0x2d')],_0x551844[_0xcb75('0x2f')]),_0x1c59fa);if(_0x203bcd[_0xcb75('0x2d')]['filter']){_0x562b4a['where']=_['merge'](_0x562b4a[_0xcb75('0x39')],{'$or':_[_0xcb75('0x2c')](_0x1c59fa,function(_0x2fe0a6){if(_0x2fe0a6[_0xcb75('0x2b')]!=='VIRTUAL'){var _0x2eb5ac={};_0x2eb5ac[_0x2fe0a6[_0xcb75('0x26')]]={'$like':'%'+_0x203bcd[_0xcb75('0x2d')][_0xcb75('0x3b')]+'%'};return _0x2eb5ac;}})});}_0x562b4a=_[_0xcb75('0x3c')]({},_0x562b4a,_0x203bcd['options']);var _0x31331d={'where':_0x562b4a[_0xcb75('0x39')]};return db[_0xcb75('0x29')][_0xcb75('0x1b')](_0x31331d)[_0xcb75('0x20')](function(_0x53db83){_0x5898da[_0xcb75('0x1b')]=_0x53db83;if(_0x203bcd[_0xcb75('0x2d')]['includeAll']){_0x562b4a[_0xcb75('0x3d')]=[{'all':!![]}];}return db['Campaign'][_0xcb75('0x3e')](_0x562b4a);})[_0xcb75('0x20')](function(_0x20996a){_0x5898da[_0xcb75('0x3f')]=_0x20996a;return _0x5898da;})[_0xcb75('0x20')](respondWithFilteredResult(_0x4bd240,_0x562b4a))[_0xcb75('0x40')](handleError(_0x4bd240,null));};exports[_0xcb75('0x41')]=function(_0x30efa9,_0x3ae1e0){var _0x509de1={'raw':![],'where':{'id':_0x30efa9[_0xcb75('0x42')]['id']}},_0x27456a={};_0x27456a[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db[_0xcb75('0x29')][_0xcb75('0x43')]);_0x27456a[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x30efa9[_0xcb75('0x2d')]);_0x27456a[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x27456a[_0xcb75('0x31')],_0x27456a[_0xcb75('0x2d')]);_0x509de1[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x27456a[_0xcb75('0x31')],qs['fields'](_0x30efa9['query'][_0xcb75('0x33')]));_0x509de1[_0xcb75('0x32')]=_0x509de1[_0xcb75('0x32')][_0xcb75('0x34')]?_0x509de1['attributes']:_0x27456a[_0xcb75('0x31')];if(_0x30efa9[_0xcb75('0x2d')]['includeAll']){_0x509de1[_0xcb75('0x3d')]=[{'all':!![]}];}_0x509de1=_[_0xcb75('0x3c')]({},_0x509de1,_0x30efa9[_0xcb75('0x44')]);return db[_0xcb75('0x29')][_0xcb75('0x45')](_0x509de1)[_0xcb75('0x20')](handleEntityNotFound(_0x3ae1e0,null))[_0xcb75('0x20')](respondWithResult(_0x3ae1e0,null))[_0xcb75('0x40')](handleError(_0x3ae1e0,null));};exports['create']=function(_0x1fb0a3,_0x122f3e){return db['Campaign'][_0xcb75('0x46')](_0x1fb0a3['body'],{})['then'](function(_0x106f7d){var _0x473d42=_0x1fb0a3[_0xcb75('0x47')][_0xcb75('0x22')]({'plain':!![]});if(!_0x473d42)throw new Error(_0xcb75('0x48'));if(_0x473d42[_0xcb75('0x49')]===_0xcb75('0x47')){var _0x12fa20=_0x106f7d[_0xcb75('0x22')]({'plain':!![]});var _0x69d49a=_0xcb75('0x4a');return db[_0xcb75('0x4b')][_0xcb75('0x45')]({'where':{'name':_0x69d49a,'userProfileId':_0x473d42[_0xcb75('0x4c')]},'raw':!![]})[_0xcb75('0x20')](function(_0x1ec88b){if(_0x1ec88b&&_0x1ec88b[_0xcb75('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x12fa20[_0xcb75('0x26')],'resourceId':_0x12fa20['id'],'type':_0x1ec88b[_0xcb75('0x26')],'sectionId':_0x1ec88b['id']},{})[_0xcb75('0x20')](function(){return _0x106f7d;});}else{return _0x106f7d;}})['catch'](function(_0x5c19fc){logger[_0xcb75('0x24')](_0xcb75('0x4e'),_0x5c19fc);throw _0x5c19fc;});}return _0x106f7d;})[_0xcb75('0x20')](respondWithResult(_0x122f3e,0xc9))[_0xcb75('0x40')](handleError(_0x122f3e,null));};exports[_0xcb75('0x4f')]=function(_0xd27f71,_0x160964){var _0x5771d4={'where':{'id':_0xd27f71['params']['id']}},_0x507d03={};_0x507d03[_0xcb75('0x31')]=_['keys'](db['Campaign']['rawAttributes']);_0x5771d4[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x507d03[_0xcb75('0x31')],qs[_0xcb75('0x33')](_0xd27f71[_0xcb75('0x2d')]['fields']));_0x5771d4['attributes']=_0x5771d4['attributes'][_0xcb75('0x34')]?_0x5771d4[_0xcb75('0x32')]:_0x507d03[_0xcb75('0x31')];if(_0xd27f71[_0xcb75('0x2d')][_0xcb75('0x50')]){_0x5771d4[_0xcb75('0x3d')]=[{'all':!![]}];}_0x5771d4=_[_0xcb75('0x3c')]({},_0x5771d4,_0xd27f71[_0xcb75('0x44')]);return db[_0xcb75('0x29')][_0xcb75('0x45')](_0x5771d4)[_0xcb75('0x20')](handleEntityNotFound(_0x160964,null))[_0xcb75('0x20')](function(_0x32d9d5){if(_0x32d9d5){var _0x25a31f=_0x32d9d5[_0xcb75('0x22')]({'plain':!![]});_0x25a31f=qs['omit'](_0x25a31f,['id',_0xcb75('0x51'),_0xcb75('0x52')]);_0xd27f71[_0xcb75('0x53')]=_[_0xcb75('0x54')](_0xd27f71[_0xcb75('0x53')],['id',_0xcb75('0x51'),_0xcb75('0x52')]);return db[_0xcb75('0x29')][_0xcb75('0x46')](_['merge'](_0x25a31f,_0xd27f71['body']),{'include':_0xd27f71[_0xcb75('0x2d')][_0xcb75('0x50')]?[{'all':!![]}]:undefined})[_0xcb75('0x20')](function(_0x105594){var _0x3944ea=_0xd27f71['user'][_0xcb75('0x22')]({'plain':!![]});if(!_0x3944ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3944ea[_0xcb75('0x49')]==='user'){var _0x202fac=_0x105594[_0xcb75('0x22')]({'plain':!![]});var _0x52a0ea=_0xcb75('0x4a');return db['UserProfileSection'][_0xcb75('0x45')]({'where':{'name':_0x52a0ea,'userProfileId':_0x3944ea[_0xcb75('0x4c')]},'raw':!![]})[_0xcb75('0x20')](function(_0x9a0bc1){if(_0x9a0bc1&&_0x9a0bc1[_0xcb75('0x4d')]===0x0){return db[_0xcb75('0x23')]['create']({'name':_0x202fac[_0xcb75('0x26')],'resourceId':_0x202fac['id'],'type':_0x9a0bc1[_0xcb75('0x26')],'sectionId':_0x9a0bc1['id']},{})[_0xcb75('0x20')](function(){return _0x105594;});}else{return _0x105594;}})[_0xcb75('0x40')](function(_0x482cc6){logger[_0xcb75('0x24')](_0xcb75('0x4e'),_0x482cc6);throw _0x482cc6;});}return _0x105594;});}})['then'](respondWithResult(_0x160964,0xc9))[_0xcb75('0x40')](handleError(_0x160964,null));};exports[_0xcb75('0x55')]=function(_0x277860,_0x37dd13){if(_0x277860[_0xcb75('0x53')]['id']){delete _0x277860['body']['id'];}return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x277860[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x37dd13,null))[_0xcb75('0x20')](saveUpdates(_0x277860['body'],null))[_0xcb75('0x20')](respondWithResult(_0x37dd13,null))['catch'](handleError(_0x37dd13,null));};exports[_0xcb75('0x21')]=function(_0x294d77,_0x2dc012){return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x294d77[_0xcb75('0x42')]['id']}})['then'](handleEntityNotFound(_0x2dc012,null))[_0xcb75('0x20')](removeEntity(_0x2dc012,null))[_0xcb75('0x40')](handleError(_0x2dc012,null));};exports[_0xcb75('0x56')]=function(_0x26c247,_0x1e7063,_0x314bb6){var _0x50a006={'raw':!![],'where':{}};var _0x36cd38={};var _0x486b75={'count':0x0,'rows':[]};return db[_0xcb75('0x29')][_0xcb75('0x57')]({'where':{'id':_0x26c247[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x1e7063,null))['then'](function(_0xe2ce6c){if(_0xe2ce6c){_0x36cd38[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db[_0xcb75('0x58')]['rawAttributes']);_0x36cd38[_0xcb75('0x2d')]=_['keys'](_0x26c247['query']);_0x36cd38[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x36cd38[_0xcb75('0x31')],_0x36cd38[_0xcb75('0x2d')]);_0x50a006[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x36cd38[_0xcb75('0x31')],qs[_0xcb75('0x33')](_0x26c247[_0xcb75('0x2d')][_0xcb75('0x33')]));_0x50a006[_0xcb75('0x32')]=_0x50a006['attributes'][_0xcb75('0x34')]?_0x50a006['attributes']:_0x36cd38[_0xcb75('0x31')];if(!_0x26c247['query'][_0xcb75('0x35')]('nolimit')){_0x50a006[_0xcb75('0x19')]=qs['limit'](_0x26c247[_0xcb75('0x2d')][_0xcb75('0x19')]);_0x50a006[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x26c247[_0xcb75('0x2d')]['offset']);}_0x50a006[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x26c247['query'][_0xcb75('0x38')]);_0x50a006['where']=qs['filters'](_[_0xcb75('0x3a')](_0x26c247[_0xcb75('0x2d')],_0x36cd38[_0xcb75('0x2f')]));_0x50a006['where']['CampaignId']=_0xe2ce6c['id'];if(_0x26c247[_0xcb75('0x2d')][_0xcb75('0x3b')]){_0x50a006[_0xcb75('0x39')]=_['merge'](_0x50a006[_0xcb75('0x39')],{'$or':_[_0xcb75('0x2c')](_0x50a006[_0xcb75('0x32')],function(_0x40210f){var _0x4b323b={};_0x4b323b[_0x40210f]={'$like':'%'+_0x26c247['query'][_0xcb75('0x3b')]+'%'};return _0x4b323b;})});}_0x50a006=_[_0xcb75('0x3c')]({},_0x50a006,_0x26c247[_0xcb75('0x44')]);return db[_0xcb75('0x58')][_0xcb75('0x1b')]({'where':_0x50a006[_0xcb75('0x39')]})[_0xcb75('0x20')](function(_0x3991cb){_0x486b75[_0xcb75('0x1b')]=_0x3991cb;if(_0x26c247['query'][_0xcb75('0x50')]){_0x50a006[_0xcb75('0x3d')]=[{'all':!![]}];}return db[_0xcb75('0x58')][_0xcb75('0x3e')](_0x50a006);})[_0xcb75('0x20')](function(_0x14584b){_0x486b75['rows']=_0x14584b;return _0x486b75;});}})[_0xcb75('0x20')](respondWithFilteredResult(_0x1e7063,_0x50a006))[_0xcb75('0x40')](handleError(_0x1e7063,null));};exports[_0xcb75('0x59')]=function(_0x12e59d,_0x58e7c4,_0x530a2a){var _0x485ba0={'raw':!![],'where':{}};var _0x3406da={};var _0x239421={'count':0x0,'rows':[]};return db[_0xcb75('0x29')][_0xcb75('0x57')]({'where':{'id':_0x12e59d[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x58e7c4,null))['then'](function(_0x2e0dd9){if(_0x2e0dd9){_0x3406da[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db['CmHopperHistory'][_0xcb75('0x43')]);_0x3406da['query']=_['keys'](_0x12e59d['query']);_0x3406da[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x3406da[_0xcb75('0x31')],_0x3406da[_0xcb75('0x2d')]);_0x485ba0[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x3406da[_0xcb75('0x31')],qs[_0xcb75('0x33')](_0x12e59d[_0xcb75('0x2d')][_0xcb75('0x33')]));_0x485ba0[_0xcb75('0x32')]=_0x485ba0[_0xcb75('0x32')][_0xcb75('0x34')]?_0x485ba0[_0xcb75('0x32')]:_0x3406da[_0xcb75('0x31')];if(!_0x12e59d[_0xcb75('0x2d')][_0xcb75('0x35')]('nolimit')){_0x485ba0['limit']=qs[_0xcb75('0x19')](_0x12e59d[_0xcb75('0x2d')]['limit']);_0x485ba0[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x12e59d['query'][_0xcb75('0x18')]);}_0x485ba0[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x12e59d[_0xcb75('0x2d')][_0xcb75('0x38')]);_0x485ba0[_0xcb75('0x39')]=qs[_0xcb75('0x2f')](_['pick'](_0x12e59d[_0xcb75('0x2d')],_0x3406da[_0xcb75('0x2f')]));_0x485ba0[_0xcb75('0x39')]['CampaignId']=_0x2e0dd9['id'];if(_0x12e59d[_0xcb75('0x2d')][_0xcb75('0x3b')]){_0x485ba0['where']=_[_0xcb75('0x3c')](_0x485ba0['where'],{'$or':_[_0xcb75('0x2c')](_0x485ba0[_0xcb75('0x32')],function(_0x1f4681){var _0xcaa068={};_0xcaa068[_0x1f4681]={'$like':'%'+_0x12e59d['query'][_0xcb75('0x3b')]+'%'};return _0xcaa068;})});}_0x485ba0=_[_0xcb75('0x3c')]({},_0x485ba0,_0x12e59d[_0xcb75('0x44')]);return db[_0xcb75('0x5a')][_0xcb75('0x1b')]({'where':_0x485ba0[_0xcb75('0x39')]})[_0xcb75('0x20')](function(_0x38a85f){_0x239421['count']=_0x38a85f;if(_0x12e59d[_0xcb75('0x2d')][_0xcb75('0x50')]){_0x485ba0[_0xcb75('0x3d')]=[{'all':!![]}];}return db[_0xcb75('0x5a')][_0xcb75('0x3e')](_0x485ba0);})[_0xcb75('0x20')](function(_0x330641){_0x239421[_0xcb75('0x3f')]=_0x330641;return _0x239421;});}})[_0xcb75('0x20')](respondWithFilteredResult(_0x58e7c4,_0x485ba0))[_0xcb75('0x40')](handleError(_0x58e7c4,null));};exports[_0xcb75('0x5b')]=function(_0x512d2,_0x52ff4e,_0x2ef57c){var _0x4d0f02={'raw':!![],'where':{}};var _0x55d027={};var _0x3d3243={'count':0x0,'rows':[]};return db[_0xcb75('0x29')]['findOne']({'where':{'id':_0x512d2[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x52ff4e,null))[_0xcb75('0x20')](function(_0x33ec01){if(_0x33ec01){_0x55d027[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db[_0xcb75('0x5c')][_0xcb75('0x43')]);_0x55d027['query']=_[_0xcb75('0x2e')](_0x512d2[_0xcb75('0x2d')]);_0x55d027[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x55d027['model'],_0x55d027[_0xcb75('0x2d')]);_0x4d0f02[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x55d027[_0xcb75('0x31')],qs[_0xcb75('0x33')](_0x512d2['query'][_0xcb75('0x33')]));_0x4d0f02[_0xcb75('0x32')]=_0x4d0f02['attributes'][_0xcb75('0x34')]?_0x4d0f02[_0xcb75('0x32')]:_0x55d027[_0xcb75('0x31')];if(!_0x512d2[_0xcb75('0x2d')][_0xcb75('0x35')]('nolimit')){_0x4d0f02[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x512d2[_0xcb75('0x2d')]['limit']);_0x4d0f02[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x512d2['query']['offset']);}_0x4d0f02[_0xcb75('0x37')]=qs['sort'](_0x512d2[_0xcb75('0x2d')][_0xcb75('0x38')]);_0x4d0f02['where']=qs[_0xcb75('0x2f')](_[_0xcb75('0x3a')](_0x512d2[_0xcb75('0x2d')],_0x55d027['filters']));_0x4d0f02[_0xcb75('0x39')][_0xcb75('0x5d')]=_0x33ec01['id'];if(_0x512d2[_0xcb75('0x2d')][_0xcb75('0x3b')]){_0x4d0f02['where']=_['merge'](_0x4d0f02[_0xcb75('0x39')],{'$or':_[_0xcb75('0x2c')](_0x4d0f02[_0xcb75('0x32')],function(_0x54b163){var _0x573a48={};_0x573a48[_0x54b163]={'$like':'%'+_0x512d2[_0xcb75('0x2d')][_0xcb75('0x3b')]+'%'};return _0x573a48;})});}_0x4d0f02=_[_0xcb75('0x3c')]({},_0x4d0f02,_0x512d2[_0xcb75('0x44')]);return db[_0xcb75('0x5c')][_0xcb75('0x1b')]({'where':_0x4d0f02[_0xcb75('0x39')]})[_0xcb75('0x20')](function(_0x599ef8){_0x3d3243[_0xcb75('0x1b')]=_0x599ef8;if(_0x512d2[_0xcb75('0x2d')][_0xcb75('0x50')]){_0x4d0f02[_0xcb75('0x3d')]=[{'all':!![]}];}return db[_0xcb75('0x5c')][_0xcb75('0x3e')](_0x4d0f02);})['then'](function(_0x43d605){_0x3d3243[_0xcb75('0x3f')]=_0x43d605;return _0x3d3243;});}})['then'](respondWithFilteredResult(_0x52ff4e,_0x4d0f02))[_0xcb75('0x40')](handleError(_0x52ff4e,null));};exports['getHopperBlacks']=function(_0x4f5e2d,_0x48a56a,_0x22fa7f){var _0x2f5e17={'raw':!![],'where':{}};var _0x4f1c19={};var _0x568765={'count':0x0,'rows':[]};return db[_0xcb75('0x29')]['findOne']({'where':{'id':_0x4f5e2d[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x48a56a,null))[_0xcb75('0x20')](function(_0x32f8ec){if(_0x32f8ec){_0x4f1c19[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db['CmHopperBlack']['rawAttributes']);_0x4f1c19['query']=_[_0xcb75('0x2e')](_0x4f5e2d[_0xcb75('0x2d')]);_0x4f1c19['filters']=_[_0xcb75('0x30')](_0x4f1c19[_0xcb75('0x31')],_0x4f1c19[_0xcb75('0x2d')]);_0x2f5e17[_0xcb75('0x32')]=_['intersection'](_0x4f1c19[_0xcb75('0x31')],qs['fields'](_0x4f5e2d[_0xcb75('0x2d')]['fields']));_0x2f5e17['attributes']=_0x2f5e17['attributes']['length']?_0x2f5e17[_0xcb75('0x32')]:_0x4f1c19[_0xcb75('0x31')];if(!_0x4f5e2d['query'][_0xcb75('0x35')]('nolimit')){_0x2f5e17[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x4f5e2d[_0xcb75('0x2d')]['limit']);_0x2f5e17[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x4f5e2d[_0xcb75('0x2d')][_0xcb75('0x18')]);}_0x2f5e17[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x4f5e2d[_0xcb75('0x2d')]['sort']);_0x2f5e17[_0xcb75('0x39')]=qs[_0xcb75('0x2f')](_['pick'](_0x4f5e2d[_0xcb75('0x2d')],_0x4f1c19[_0xcb75('0x2f')]));_0x2f5e17[_0xcb75('0x39')][_0xcb75('0x5d')]=_0x32f8ec['id'];if(_0x4f5e2d[_0xcb75('0x2d')][_0xcb75('0x3b')]){_0x2f5e17[_0xcb75('0x39')]=_[_0xcb75('0x3c')](_0x2f5e17[_0xcb75('0x39')],{'$or':_['map'](_0x2f5e17['attributes'],function(_0x5990f5){var _0xda588d={};_0xda588d[_0x5990f5]={'$like':'%'+_0x4f5e2d[_0xcb75('0x2d')]['filter']+'%'};return _0xda588d;})});}_0x2f5e17=_[_0xcb75('0x3c')]({},_0x2f5e17,_0x4f5e2d[_0xcb75('0x44')]);return db[_0xcb75('0x5e')][_0xcb75('0x1b')]({'where':_0x2f5e17[_0xcb75('0x39')]})[_0xcb75('0x20')](function(_0x55e2a1){_0x568765[_0xcb75('0x1b')]=_0x55e2a1;if(_0x4f5e2d[_0xcb75('0x2d')]['includeAll']){_0x2f5e17[_0xcb75('0x3d')]=[{'all':!![]}];}return db[_0xcb75('0x5e')][_0xcb75('0x3e')](_0x2f5e17);})[_0xcb75('0x20')](function(_0x8ce3c0){_0x568765['rows']=_0x8ce3c0;return _0x568765;});}})['then'](respondWithFilteredResult(_0x48a56a,_0x2f5e17))[_0xcb75('0x40')](handleError(_0x48a56a,null));};exports[_0xcb75('0x5f')]=function(_0x59a12f,_0x2ae0eb,_0x432f4f){var _0x419ec5={};var _0x167b71={};var _0x49b260;var _0x3947e7;return db[_0xcb75('0x29')][_0xcb75('0x57')]({'where':{'id':_0x59a12f[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x2ae0eb,null))[_0xcb75('0x20')](function(_0xb13d){if(_0xb13d){_0x49b260=_0xb13d;_0x167b71[_0xcb75('0x31')]=_[_0xcb75('0x2e')](db[_0xcb75('0x60')][_0xcb75('0x43')]);_0x167b71[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x59a12f[_0xcb75('0x2d')]);_0x167b71['filters']=_[_0xcb75('0x30')](_0x167b71[_0xcb75('0x31')],_0x167b71[_0xcb75('0x2d')]);_0x419ec5[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x167b71[_0xcb75('0x31')],qs[_0xcb75('0x33')](_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x33')]));_0x419ec5[_0xcb75('0x32')]=_0x419ec5['attributes'][_0xcb75('0x34')]?_0x419ec5['attributes']:_0x167b71[_0xcb75('0x31')];_0x419ec5[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x38')]);_0x419ec5[_0xcb75('0x39')]=qs['filters'](_[_0xcb75('0x3a')](_0x59a12f[_0xcb75('0x2d')],_0x167b71[_0xcb75('0x2f')]));if(_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x3b')]){_0x419ec5['where']=_[_0xcb75('0x3c')](_0x419ec5[_0xcb75('0x39')],{'$or':_[_0xcb75('0x2c')](_0x419ec5[_0xcb75('0x32')],function(_0x4aac9e){var _0x8b6066={};_0x8b6066[_0x4aac9e]={'$like':'%'+_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x3b')]+'%'};return _0x8b6066;})});}_0x419ec5=_[_0xcb75('0x3c')]({},_0x419ec5,_0x59a12f['options']);return _0x49b260[_0xcb75('0x5f')](_0x419ec5);}})[_0xcb75('0x20')](function(_0x3294a2){if(_0x3294a2){_0x3947e7=_0x3294a2[_0xcb75('0x34')];if(!_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x35')](_0xcb75('0x36'))){_0x419ec5[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x59a12f['query'][_0xcb75('0x19')]);_0x419ec5[_0xcb75('0x18')]=qs[_0xcb75('0x18')](_0x59a12f[_0xcb75('0x2d')][_0xcb75('0x18')]);}return _0x49b260['getLists'](_0x419ec5);}})[_0xcb75('0x20')](function(_0x2002ed){if(_0x2002ed){return _0x2002ed?{'count':_0x3947e7,'rows':_0x2002ed}:null;}})[_0xcb75('0x20')](respondWithResult(_0x2ae0eb,null))['catch'](handleError(_0x2ae0eb,null));};exports[_0xcb75('0x61')]=function(_0x3fb5c3,_0x4b5ee8,_0x122d3c){var _0x55e6ea,_0x30ba07;var _0x5586ec=[];var _0x163418=moment()[_0xcb75('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x3fb5c3['params']['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x4b5ee8,null))[_0xcb75('0x20')](function(_0x4c7216){if(_0x4c7216){_0x30ba07=_0x4c7216;return _0x4c7216[_0xcb75('0x61')](_0x3fb5c3[_0xcb75('0x53')]['ids'],_[_0xcb75('0x54')](_0x3fb5c3[_0xcb75('0x53')],['ids','id'])||{});}return null;})[_0xcb75('0x63')](function(_0x40e0ca){var _0x1276f4;var _0x5e0086;_0x55e6ea=_0x40e0ca||[];var _0x106a51=[];if(_0x40e0ca){for(var _0x5393df=0x0;_0x5393df<_0x40e0ca[_0xcb75('0x34')];_0x5393df+=0x1){var _0x4b4752=_0x40e0ca[_0x5393df][_0xcb75('0x22')]({'plain':!![]});_0x30ba07[_0xcb75('0x64')]=_0x3fb5c3[_0xcb75('0x53')][_0xcb75('0x64')]?_0x3fb5c3[_0xcb75('0x53')][_0xcb75('0x64')]:_0x30ba07['dialCheckDuplicateType'];switch(_0x30ba07[_0xcb75('0x64')]){case'always':_0x1276f4=squel[_0xcb75('0x65')]()['into']('cm_hopper')[_0xcb75('0x66')]([_0xcb75('0x67'),_0xcb75('0x68'),_0xcb75('0x69'),_0xcb75('0x6a'),_0xcb75('0x5d'),_0xcb75('0x51'),'updatedAt'],squel[_0xcb75('0x6b')]()[_0xcb75('0x6c')]('phone',_0xcb75('0x67'))[_0xcb75('0x6c')](_0xcb75('0x6d'),_0xcb75('0x68'))[_0xcb75('0x6c')]('id',_0xcb75('0x69'))[_0xcb75('0x6c')](_0x4b4752['CmListId'][_0xcb75('0x6e')](),_0xcb75('0x6a'))[_0xcb75('0x6c')](_0x3fb5c3[_0xcb75('0x42')]['id'][_0xcb75('0x6e')](),_0xcb75('0x5d'))['field']('\x27'+_0x163418+'\x27','createdAt')[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27','updatedAt')[_0xcb75('0x6f')](_0xcb75('0x70'))[_0xcb75('0x39')]('deletedAt\x20IS\x20NULL')[_0xcb75('0x39')](_0xcb75('0x71'),_0x4b4752['CmListId'][_0xcb75('0x6e')]())[_0xcb75('0x39')](_0xcb75('0x72'))[_0xcb75('0x39')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcb75('0x6c')](_0xcb75('0x73'))[_0xcb75('0x6f')](_0xcb75('0x74'))[_0xcb75('0x39')](_0xcb75('0x75'),_0x3fb5c3[_0xcb75('0x42')]['id'][_0xcb75('0x6e')]()))[_0xcb75('0x39')](_0xcb75('0x76'),squel[_0xcb75('0x6b')]()['field'](_0xcb75('0x77'))['from'](_0xcb75('0x78'))[_0xcb75('0x39')](_0xcb75('0x75'),_0x3fb5c3['params']['id'][_0xcb75('0x6e')]())))[_0xcb75('0x6e')]();break;case'onlyIfOpen':_0x1276f4=squel[_0xcb75('0x65')]()['into'](_0xcb75('0x78'))[_0xcb75('0x66')](['phone',_0xcb75('0x68'),_0xcb75('0x69'),_0xcb75('0x6a'),_0xcb75('0x5d'),'createdAt',_0xcb75('0x52')],squel[_0xcb75('0x6b')]()['field']('phone',_0xcb75('0x67'))['field'](_0xcb75('0x6d'),_0xcb75('0x68'))['field']('id',_0xcb75('0x69'))[_0xcb75('0x6c')](_0x4b4752[_0xcb75('0x79')][_0xcb75('0x6e')](),'ListId')[_0xcb75('0x6c')](_0x3fb5c3[_0xcb75('0x42')]['id'][_0xcb75('0x6e')](),_0xcb75('0x5d'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27',_0xcb75('0x51'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27',_0xcb75('0x52'))[_0xcb75('0x6f')]('cm_contacts')[_0xcb75('0x39')](_0xcb75('0x7a'))[_0xcb75('0x39')](_0xcb75('0x71'),_0x4b4752[_0xcb75('0x79')][_0xcb75('0x6e')]())[_0xcb75('0x39')](_0xcb75('0x72'))[_0xcb75('0x39')](_0xcb75('0x76'),squel[_0xcb75('0x6b')]()[_0xcb75('0x6c')](_0xcb75('0x77'))[_0xcb75('0x6f')](_0xcb75('0x78'))[_0xcb75('0x39')](_0xcb75('0x75'),_0x3fb5c3[_0xcb75('0x42')]['id']['toString']())))[_0xcb75('0x6e')]();break;default:_0x1276f4=squel[_0xcb75('0x65')]()[_0xcb75('0x7b')](_0xcb75('0x78'))['fromQuery'](['phone','scheduledAt',_0xcb75('0x69'),_0xcb75('0x6a'),'CampaignId',_0xcb75('0x51'),_0xcb75('0x52')],squel[_0xcb75('0x6b')]()[_0xcb75('0x6c')](_0xcb75('0x67'),_0xcb75('0x67'))['field'](_0xcb75('0x6d'),_0xcb75('0x68'))[_0xcb75('0x6c')]('id',_0xcb75('0x69'))['field'](_0x4b4752[_0xcb75('0x79')][_0xcb75('0x6e')](),_0xcb75('0x6a'))[_0xcb75('0x6c')](_0x3fb5c3['params']['id'][_0xcb75('0x6e')](),_0xcb75('0x5d'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27',_0xcb75('0x51'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27','updatedAt')['from']('cm_contacts')['where'](_0xcb75('0x7a'))[_0xcb75('0x39')](_0xcb75('0x71'),_0x4b4752[_0xcb75('0x79')][_0xcb75('0x6e')]())[_0xcb75('0x39')](_0xcb75('0x72')))[_0xcb75('0x6e')]();}_0x5e0086=squel['insert']()[_0xcb75('0x7b')](_0xcb75('0x7c'))[_0xcb75('0x66')]([_0xcb75('0x7d'),_0xcb75('0x68'),_0xcb75('0x67'),_0xcb75('0x7e'),_0xcb75('0x51'),_0xcb75('0x52')],squel[_0xcb75('0x6b')]()[_0xcb75('0x6c')](_0xcb75('0x7f'),'id')[_0xcb75('0x6c')](_0xcb75('0x6d'),_0xcb75('0x68'))[_0xcb75('0x6c')](_0xcb75('0x80'),_0xcb75('0x67'))[_0xcb75('0x6c')](_0xcb75('0x81'),_0xcb75('0x7e'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27',_0xcb75('0x51'))[_0xcb75('0x6c')]('\x27'+_0x163418+'\x27',_0xcb75('0x52'))[_0xcb75('0x6f')](_0xcb75('0x82'),'ci')[_0xcb75('0x83')](_0xcb75('0x78'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0xcb75('0x84'),_0x4b4752[_0xcb75('0x79')][_0xcb75('0x6e')]())['where'](_0xcb75('0x85'),_0x3fb5c3[_0xcb75('0x42')]['id']['toString']())[_0xcb75('0x39')](_0xcb75('0x86'),_0x163418))[_0xcb75('0x6e')]();_0x106a51[_0xcb75('0x87')](db[_0xcb75('0x88')][_0xcb75('0x2d')](_0x1276f4));_0x5586ec['push'](db['sequelize'][_0xcb75('0x2d')](_0x5e0086));}return BPromise[_0xcb75('0x89')](_0x106a51);}})[_0xcb75('0x20')](function(){return BPromise[_0xcb75('0x89')](_0x5586ec);})[_0xcb75('0x20')](function(){return _0x55e6ea;})['then'](respondWithResult(_0x4b5ee8,null))[_0xcb75('0x40')](handleError(_0x4b5ee8,null));};exports[_0xcb75('0x8a')]=function(_0x4afaae,_0x2f30bb,_0xd06e2){return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x4afaae[_0xcb75('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f30bb,null))[_0xcb75('0x20')](function(_0x38f254){if(_0x38f254){return _0x38f254[_0xcb75('0x8a')](_0x4afaae[_0xcb75('0x2d')][_0xcb75('0x8b')]);}})[_0xcb75('0x20')](function(_0x580727){if(_0x580727){return db[_0xcb75('0x58')][_0xcb75('0x21')]({'where':{'ListId':_0x4afaae[_0xcb75('0x2d')][_0xcb75('0x8b')],'CampaignId':_0x4afaae['params']['id']}})[_0xcb75('0x20')](function(){return _0x580727;});}})[_0xcb75('0x20')](respondWithStatusCode(_0x2f30bb,null))['catch'](handleError(_0x2f30bb,null));};exports[_0xcb75('0x8c')]=function(_0x29114b,_0x546ec0,_0x14fc23){var _0xfb0f76={};var _0x1a4aad={};var _0x5aef41;var _0x4a052e;return db[_0xcb75('0x29')][_0xcb75('0x57')]({'where':{'id':_0x29114b[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x546ec0,null))['then'](function(_0x44e636){if(_0x44e636){_0x5aef41=_0x44e636;_0x1a4aad['model']=_['keys'](db[_0xcb75('0x60')][_0xcb75('0x43')]);_0x1a4aad[_0xcb75('0x2d')]=_['keys'](_0x29114b['query']);_0x1a4aad[_0xcb75('0x2f')]=_['intersection'](_0x1a4aad[_0xcb75('0x31')],_0x1a4aad[_0xcb75('0x2d')]);_0xfb0f76[_0xcb75('0x32')]=_[_0xcb75('0x30')](_0x1a4aad[_0xcb75('0x31')],qs['fields'](_0x29114b[_0xcb75('0x2d')][_0xcb75('0x33')]));_0xfb0f76[_0xcb75('0x32')]=_0xfb0f76[_0xcb75('0x32')][_0xcb75('0x34')]?_0xfb0f76[_0xcb75('0x32')]:_0x1a4aad[_0xcb75('0x31')];_0xfb0f76[_0xcb75('0x37')]=qs[_0xcb75('0x38')](_0x29114b[_0xcb75('0x2d')]['sort']);_0xfb0f76[_0xcb75('0x39')]=qs[_0xcb75('0x2f')](_[_0xcb75('0x3a')](_0x29114b['query'],_0x1a4aad[_0xcb75('0x2f')]));if(_0x29114b[_0xcb75('0x2d')]['filter']){_0xfb0f76['where']=_[_0xcb75('0x3c')](_0xfb0f76[_0xcb75('0x39')],{'$or':_['map'](_0xfb0f76[_0xcb75('0x32')],function(_0x2396f9){var _0x984144={};_0x984144[_0x2396f9]={'$like':'%'+_0x29114b[_0xcb75('0x2d')]['filter']+'%'};return _0x984144;})});}_0xfb0f76=_['merge']({},_0xfb0f76,_0x29114b[_0xcb75('0x44')]);return _0x5aef41['getBlackLists'](_0xfb0f76);}})[_0xcb75('0x20')](function(_0x34a7d9){if(_0x34a7d9){_0x4a052e=_0x34a7d9['length'];if(!_0x29114b[_0xcb75('0x2d')][_0xcb75('0x35')](_0xcb75('0x36'))){_0xfb0f76[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x29114b[_0xcb75('0x2d')][_0xcb75('0x19')]);_0xfb0f76[_0xcb75('0x18')]=qs['offset'](_0x29114b[_0xcb75('0x2d')][_0xcb75('0x18')]);}return _0x5aef41[_0xcb75('0x8c')](_0xfb0f76);}})[_0xcb75('0x20')](function(_0x51ad60){if(_0x51ad60){return _0x51ad60?{'count':_0x4a052e,'rows':_0x51ad60}:null;}})[_0xcb75('0x20')](respondWithResult(_0x546ec0,null))[_0xcb75('0x40')](handleError(_0x546ec0,null));};exports[_0xcb75('0x8d')]=function(_0x10d3ab,_0x45822a,_0x3ddda7){var _0x34919f,_0x5e69d3;var _0x3dfc49=[];var _0x59e04a=moment()[_0xcb75('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x10d3ab[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x45822a,null))[_0xcb75('0x20')](function(_0x1a737e){if(_0x1a737e){_0x5e69d3=_0x1a737e;return _0x1a737e[_0xcb75('0x8d')](_0x10d3ab[_0xcb75('0x53')][_0xcb75('0x8b')],_['omit'](_0x10d3ab[_0xcb75('0x53')],[_0xcb75('0x8b'),'id'])||{});}return null;})[_0xcb75('0x63')](function(_0x27c41f){var _0x5d2031;var _0x2d3cc0;_0x34919f=_0x27c41f||[];var _0x1250c1=[];if(_0x27c41f){for(var _0x2089a1=0x0;_0x2089a1<_0x27c41f[_0xcb75('0x34')];_0x2089a1+=0x1){var _0x1d6944=_0x27c41f[_0x2089a1]['get']({'plain':!![]});_0x5d2031=squel[_0xcb75('0x65')]()[_0xcb75('0x7b')](_0xcb75('0x8e'))[_0xcb75('0x66')]([_0xcb75('0x67'),_0xcb75('0x69'),_0xcb75('0x6a'),_0xcb75('0x5d'),_0xcb75('0x51'),'updatedAt'],squel[_0xcb75('0x6b')]()['field'](_0xcb75('0x67'),_0xcb75('0x67'))[_0xcb75('0x6c')]('id',_0xcb75('0x69'))[_0xcb75('0x6c')](_0x1d6944[_0xcb75('0x79')]['toString'](),'ListId')[_0xcb75('0x6c')](_0x10d3ab[_0xcb75('0x42')]['id'][_0xcb75('0x6e')](),_0xcb75('0x5d'))['field'](_0xcb75('0x6d'),_0xcb75('0x51'))[_0xcb75('0x6c')](_0xcb75('0x6d'),_0xcb75('0x52'))[_0xcb75('0x6f')]('cm_contacts')[_0xcb75('0x39')](_0xcb75('0x7a'))[_0xcb75('0x39')](_0xcb75('0x71'),_0x1d6944[_0xcb75('0x79')][_0xcb75('0x6e')]())[_0xcb75('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xcb75('0x6e')]();_0x1250c1[_0xcb75('0x87')](db[_0xcb75('0x88')]['query'](_0x5d2031));}return BPromise['all'](_0x1250c1);}})[_0xcb75('0x20')](function(){return _0x34919f;})['then'](respondWithResult(_0x45822a,null))[_0xcb75('0x40')](handleError(_0x45822a,null));};exports['removeBlackLists']=function(_0x1fe6c7,_0x5bee3d,_0x8dc5b8){return db[_0xcb75('0x29')][_0xcb75('0x45')]({'where':{'id':_0x1fe6c7[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](handleEntityNotFound(_0x5bee3d,null))[_0xcb75('0x20')](function(_0x3f2686){if(_0x3f2686){return _0x3f2686[_0xcb75('0x8f')](_0x1fe6c7[_0xcb75('0x2d')][_0xcb75('0x8b')]);}})['then'](function(_0x3e6c0a){if(_0x3e6c0a){return db[_0xcb75('0x5e')][_0xcb75('0x21')]({'where':{'ListId':_0x1fe6c7[_0xcb75('0x2d')][_0xcb75('0x8b')],'CampaignId':_0x1fe6c7[_0xcb75('0x42')]['id']}})[_0xcb75('0x20')](function(){return _0x3e6c0a;});}})['then'](respondWithStatusCode(_0x5bee3d,null))[_0xcb75('0x40')](handleError(_0x5bee3d,null));}; \ No newline at end of file +var _0x2746=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','error','send','index','map','Campaign','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','user','role','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','ids','spread','dialCheckDuplicateType','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','NOW()','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0x2746,0x19c));var _0x6274=function(_0x237ed0,_0x58f4e9){_0x237ed0=_0x237ed0-0x0;var _0x14fc5c=_0x2746[_0x237ed0];return _0x14fc5c;};'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(){var _0x2c1978=_0xa0c8bd[_0x6274('0x28')]({'plain':!![]});var _0x5228a1=_0x6274('0x29');return db['UserProfileResource'][_0x6274('0x27')]({'where':{'type':_0x5228a1,'resourceId':_0x2c1978['id']}})['then'](function(){return _0xa0c8bd;});})[_0x6274('0x26')](function(){_0xc49220[_0x6274('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x416fac,_0x5c272f){return function(_0x54b923){if(!_0x54b923){_0x416fac[_0x6274('0x18')](0x194);}return _0x54b923;};}function handleError(_0x375641,_0x39062a){_0x39062a=_0x39062a||0x1f4;return function(_0x490541){logger[_0x6274('0x2a')](_0x490541['stack']);if(_0x490541['name']){delete _0x490541['name'];}_0x375641[_0x6274('0x19')](_0x39062a)[_0x6274('0x2b')](_0x490541);};}exports[_0x6274('0x2c')]=function(_0x123454,_0x3b2598){var _0x3bd82d={},_0x4d0a32={},_0x3c7864={'count':0x0,'rows':[]};var _0x45d24c=_[_0x6274('0x2d')](db[_0x6274('0x2e')][_0x6274('0x2f')],function(_0x232b1f){return{'name':_0x232b1f[_0x6274('0x30')],'type':_0x232b1f['type']['key']};});_0x4d0a32[_0x6274('0x31')]=_[_0x6274('0x2d')](_0x45d24c,_0x6274('0x32'));_0x4d0a32[_0x6274('0x33')]=_[_0x6274('0x34')](_0x123454[_0x6274('0x33')]);_0x4d0a32[_0x6274('0x35')]=_[_0x6274('0x36')](_0x4d0a32[_0x6274('0x31')],_0x4d0a32[_0x6274('0x33')]);_0x3bd82d[_0x6274('0x37')]=_[_0x6274('0x36')](_0x4d0a32['model'],qs[_0x6274('0x38')](_0x123454[_0x6274('0x33')][_0x6274('0x38')]));_0x3bd82d[_0x6274('0x37')]=_0x3bd82d[_0x6274('0x37')][_0x6274('0x39')]?_0x3bd82d['attributes']:_0x4d0a32['model'];if(!_0x123454['query'][_0x6274('0x3a')](_0x6274('0x3b'))){_0x3bd82d[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x123454[_0x6274('0x33')][_0x6274('0x1e')]);_0x3bd82d[_0x6274('0x1c')]=qs[_0x6274('0x1c')](_0x123454[_0x6274('0x33')][_0x6274('0x1c')]);}_0x3bd82d[_0x6274('0x3c')]=qs[_0x6274('0x3d')](_0x123454[_0x6274('0x33')][_0x6274('0x3d')]);_0x3bd82d[_0x6274('0x3e')]=qs[_0x6274('0x35')](_[_0x6274('0x3f')](_0x123454[_0x6274('0x33')],_0x4d0a32['filters']),_0x45d24c);if(_0x123454[_0x6274('0x33')][_0x6274('0x40')]){_0x3bd82d[_0x6274('0x3e')]=_[_0x6274('0x41')](_0x3bd82d[_0x6274('0x3e')],{'$or':_[_0x6274('0x2d')](_0x45d24c,function(_0xf55aeb){if(_0xf55aeb[_0x6274('0x42')]!=='VIRTUAL'){var _0x513bd6={};_0x513bd6[_0xf55aeb[_0x6274('0x32')]]={'$like':'%'+_0x123454[_0x6274('0x33')][_0x6274('0x40')]+'%'};return _0x513bd6;}})});}_0x3bd82d=_[_0x6274('0x41')]({},_0x3bd82d,_0x123454[_0x6274('0x43')]);var _0x2e7c5f={'where':_0x3bd82d['where']};return db['Campaign'][_0x6274('0x1f')](_0x2e7c5f)['then'](function(_0x4d3c2a){_0x3c7864['count']=_0x4d3c2a;if(_0x123454[_0x6274('0x33')]['includeAll']){_0x3bd82d[_0x6274('0x44')]=[{'all':!![]}];}return db[_0x6274('0x2e')][_0x6274('0x45')](_0x3bd82d);})[_0x6274('0x26')](function(_0x4da418){_0x3c7864[_0x6274('0x46')]=_0x4da418;return _0x3c7864;})[_0x6274('0x26')](respondWithFilteredResult(_0x3b2598,_0x3bd82d))[_0x6274('0x47')](handleError(_0x3b2598,null));};exports['show']=function(_0x39b56c,_0x5f1fa2){var _0x1f2e1f={'raw':![],'where':{'id':_0x39b56c[_0x6274('0x48')]['id']}},_0x56fc3d={};_0x56fc3d[_0x6274('0x31')]=_[_0x6274('0x34')](db[_0x6274('0x2e')]['rawAttributes']);_0x56fc3d['query']=_['keys'](_0x39b56c[_0x6274('0x33')]);_0x56fc3d[_0x6274('0x35')]=_['intersection'](_0x56fc3d[_0x6274('0x31')],_0x56fc3d[_0x6274('0x33')]);_0x1f2e1f['attributes']=_[_0x6274('0x36')](_0x56fc3d[_0x6274('0x31')],qs[_0x6274('0x38')](_0x39b56c[_0x6274('0x33')]['fields']));_0x1f2e1f[_0x6274('0x37')]=_0x1f2e1f[_0x6274('0x37')][_0x6274('0x39')]?_0x1f2e1f[_0x6274('0x37')]:_0x56fc3d['model'];if(_0x39b56c[_0x6274('0x33')][_0x6274('0x49')]){_0x1f2e1f['include']=[{'all':!![]}];}_0x1f2e1f=_['merge']({},_0x1f2e1f,_0x39b56c[_0x6274('0x43')]);return db[_0x6274('0x2e')][_0x6274('0x4a')](_0x1f2e1f)[_0x6274('0x26')](handleEntityNotFound(_0x5f1fa2,null))[_0x6274('0x26')](respondWithResult(_0x5f1fa2,null))['catch'](handleError(_0x5f1fa2,null));};exports[_0x6274('0x4b')]=function(_0x18dab3,_0x5bb7bd){return db[_0x6274('0x2e')]['create'](_0x18dab3[_0x6274('0x4c')],{})['then'](function(_0x277ec7){var _0xc07326=_0x18dab3['user'][_0x6274('0x28')]({'plain':!![]});if(!_0xc07326)throw new Error(_0x6274('0x4d'));if(_0xc07326['role']==='user'){var _0x4cd287=_0x277ec7[_0x6274('0x28')]({'plain':!![]});var _0x520135='IvrCampaigns';return db[_0x6274('0x4e')][_0x6274('0x4a')]({'where':{'name':_0x520135,'userProfileId':_0xc07326[_0x6274('0x4f')]},'raw':!![]})[_0x6274('0x26')](function(_0x3453aa){if(_0x3453aa&&_0x3453aa[_0x6274('0x50')]===0x0){return db[_0x6274('0x51')][_0x6274('0x4b')]({'name':_0x4cd287[_0x6274('0x32')],'resourceId':_0x4cd287['id'],'type':_0x3453aa[_0x6274('0x32')],'sectionId':_0x3453aa['id']},{})['then'](function(){return _0x277ec7;});}else{return _0x277ec7;}})['catch'](function(_0x2d5fe3){logger[_0x6274('0x2a')](_0x6274('0x52'),_0x2d5fe3);throw _0x2d5fe3;});}return _0x277ec7;})[_0x6274('0x26')](respondWithResult(_0x5bb7bd,0xc9))[_0x6274('0x47')](handleError(_0x5bb7bd,null));};exports[_0x6274('0x53')]=function(_0x12c731,_0x414dbe){var _0x274707={'where':{'id':_0x12c731[_0x6274('0x48')]['id']}},_0x597181={};_0x597181[_0x6274('0x31')]=_[_0x6274('0x34')](db[_0x6274('0x2e')][_0x6274('0x2f')]);_0x274707[_0x6274('0x37')]=_[_0x6274('0x36')](_0x597181[_0x6274('0x31')],qs['fields'](_0x12c731[_0x6274('0x33')]['fields']));_0x274707['attributes']=_0x274707[_0x6274('0x37')][_0x6274('0x39')]?_0x274707[_0x6274('0x37')]:_0x597181[_0x6274('0x31')];if(_0x12c731['query']['includeAll']){_0x274707[_0x6274('0x44')]=[{'all':!![]}];}_0x274707=_[_0x6274('0x41')]({},_0x274707,_0x12c731['options']);return db[_0x6274('0x2e')][_0x6274('0x4a')](_0x274707)[_0x6274('0x26')](handleEntityNotFound(_0x414dbe,null))[_0x6274('0x26')](function(_0xd866a){if(_0xd866a){var _0x5db76f=_0xd866a[_0x6274('0x28')]({'plain':!![]});_0x5db76f=qs[_0x6274('0x54')](_0x5db76f,['id',_0x6274('0x55'),_0x6274('0x56')]);_0x12c731[_0x6274('0x4c')]=_['omit'](_0x12c731['body'],['id',_0x6274('0x55'),_0x6274('0x56')]);return db[_0x6274('0x2e')][_0x6274('0x4b')](_['merge'](_0x5db76f,_0x12c731['body']),{'include':_0x12c731[_0x6274('0x33')][_0x6274('0x49')]?[{'all':!![]}]:undefined})[_0x6274('0x26')](function(_0x2dae61){var _0xf2188d=_0x12c731[_0x6274('0x57')][_0x6274('0x28')]({'plain':!![]});if(!_0xf2188d)throw new Error(_0x6274('0x4d'));if(_0xf2188d[_0x6274('0x58')]===_0x6274('0x57')){var _0x388404=_0x2dae61[_0x6274('0x28')]({'plain':!![]});var _0x4133db=_0x6274('0x29');return db[_0x6274('0x4e')][_0x6274('0x4a')]({'where':{'name':_0x4133db,'userProfileId':_0xf2188d[_0x6274('0x4f')]},'raw':!![]})[_0x6274('0x26')](function(_0x2c380c){if(_0x2c380c&&_0x2c380c[_0x6274('0x50')]===0x0){return db[_0x6274('0x51')][_0x6274('0x4b')]({'name':_0x388404[_0x6274('0x32')],'resourceId':_0x388404['id'],'type':_0x2c380c[_0x6274('0x32')],'sectionId':_0x2c380c['id']},{})[_0x6274('0x26')](function(){return _0x2dae61;});}else{return _0x2dae61;}})[_0x6274('0x47')](function(_0x10e8ad){logger[_0x6274('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10e8ad);throw _0x10e8ad;});}return _0x2dae61;});}})[_0x6274('0x26')](respondWithResult(_0x414dbe,0xc9))[_0x6274('0x47')](handleError(_0x414dbe,null));};exports[_0x6274('0x25')]=function(_0x2bba78,_0x12750c){if(_0x2bba78[_0x6274('0x4c')]['id']){delete _0x2bba78[_0x6274('0x4c')]['id'];}return db[_0x6274('0x2e')][_0x6274('0x4a')]({'where':{'id':_0x2bba78[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x12750c,null))[_0x6274('0x26')](saveUpdates(_0x2bba78['body'],null))[_0x6274('0x26')](respondWithResult(_0x12750c,null))[_0x6274('0x47')](handleError(_0x12750c,null));};exports[_0x6274('0x27')]=function(_0x44ec97,_0x1ae76c){return db['Campaign']['find']({'where':{'id':_0x44ec97['params']['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x1ae76c,null))[_0x6274('0x26')](removeEntity(_0x1ae76c,null))['catch'](handleError(_0x1ae76c,null));};exports[_0x6274('0x59')]=function(_0x5116d6,_0x5a525b,_0x5aac85){var _0x4b9378={'raw':!![],'where':{}};var _0xdbc965={};var _0x1191af={'count':0x0,'rows':[]};return db[_0x6274('0x2e')][_0x6274('0x5a')]({'where':{'id':_0x5116d6[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x5a525b,null))[_0x6274('0x26')](function(_0x430ecf){if(_0x430ecf){_0xdbc965['model']=_[_0x6274('0x34')](db[_0x6274('0x5b')][_0x6274('0x2f')]);_0xdbc965[_0x6274('0x33')]=_[_0x6274('0x34')](_0x5116d6[_0x6274('0x33')]);_0xdbc965[_0x6274('0x35')]=_[_0x6274('0x36')](_0xdbc965['model'],_0xdbc965[_0x6274('0x33')]);_0x4b9378['attributes']=_[_0x6274('0x36')](_0xdbc965[_0x6274('0x31')],qs[_0x6274('0x38')](_0x5116d6[_0x6274('0x33')]['fields']));_0x4b9378[_0x6274('0x37')]=_0x4b9378[_0x6274('0x37')]['length']?_0x4b9378['attributes']:_0xdbc965['model'];if(!_0x5116d6[_0x6274('0x33')]['hasOwnProperty'](_0x6274('0x3b'))){_0x4b9378[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x5116d6[_0x6274('0x33')]['limit']);_0x4b9378['offset']=qs['offset'](_0x5116d6[_0x6274('0x33')][_0x6274('0x1c')]);}_0x4b9378[_0x6274('0x3c')]=qs['sort'](_0x5116d6[_0x6274('0x33')]['sort']);_0x4b9378[_0x6274('0x3e')]=qs[_0x6274('0x35')](_[_0x6274('0x3f')](_0x5116d6['query'],_0xdbc965[_0x6274('0x35')]));_0x4b9378[_0x6274('0x3e')][_0x6274('0x5c')]=_0x430ecf['id'];if(_0x5116d6[_0x6274('0x33')][_0x6274('0x40')]){_0x4b9378[_0x6274('0x3e')]=_[_0x6274('0x41')](_0x4b9378[_0x6274('0x3e')],{'$or':_['map'](_0x4b9378[_0x6274('0x37')],function(_0x5015aa){var _0x39cc11={};_0x39cc11[_0x5015aa]={'$like':'%'+_0x5116d6['query'][_0x6274('0x40')]+'%'};return _0x39cc11;})});}_0x4b9378=_[_0x6274('0x41')]({},_0x4b9378,_0x5116d6[_0x6274('0x43')]);return db[_0x6274('0x5b')]['count']({'where':_0x4b9378[_0x6274('0x3e')]})['then'](function(_0x3a9efb){_0x1191af[_0x6274('0x1f')]=_0x3a9efb;if(_0x5116d6['query']['includeAll']){_0x4b9378[_0x6274('0x44')]=[{'all':!![]}];}return db[_0x6274('0x5b')][_0x6274('0x45')](_0x4b9378);})[_0x6274('0x26')](function(_0x3d3fe9){_0x1191af[_0x6274('0x46')]=_0x3d3fe9;return _0x1191af;});}})[_0x6274('0x26')](respondWithFilteredResult(_0x5a525b,_0x4b9378))['catch'](handleError(_0x5a525b,null));};exports[_0x6274('0x5d')]=function(_0xa75214,_0x2c959f,_0x4bdf9c){var _0x81cf67={'raw':!![],'where':{}};var _0x2b6f1e={};var _0x2f0f96={'count':0x0,'rows':[]};return db[_0x6274('0x2e')]['findOne']({'where':{'id':_0xa75214[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x2c959f,null))[_0x6274('0x26')](function(_0x3109f6){if(_0x3109f6){_0x2b6f1e[_0x6274('0x31')]=_[_0x6274('0x34')](db[_0x6274('0x5e')]['rawAttributes']);_0x2b6f1e[_0x6274('0x33')]=_[_0x6274('0x34')](_0xa75214[_0x6274('0x33')]);_0x2b6f1e[_0x6274('0x35')]=_['intersection'](_0x2b6f1e[_0x6274('0x31')],_0x2b6f1e[_0x6274('0x33')]);_0x81cf67['attributes']=_[_0x6274('0x36')](_0x2b6f1e[_0x6274('0x31')],qs['fields'](_0xa75214[_0x6274('0x33')][_0x6274('0x38')]));_0x81cf67[_0x6274('0x37')]=_0x81cf67[_0x6274('0x37')]['length']?_0x81cf67[_0x6274('0x37')]:_0x2b6f1e[_0x6274('0x31')];if(!_0xa75214[_0x6274('0x33')][_0x6274('0x3a')](_0x6274('0x3b'))){_0x81cf67[_0x6274('0x1e')]=qs['limit'](_0xa75214['query'][_0x6274('0x1e')]);_0x81cf67[_0x6274('0x1c')]=qs['offset'](_0xa75214['query'][_0x6274('0x1c')]);}_0x81cf67[_0x6274('0x3c')]=qs[_0x6274('0x3d')](_0xa75214[_0x6274('0x33')][_0x6274('0x3d')]);_0x81cf67[_0x6274('0x3e')]=qs['filters'](_[_0x6274('0x3f')](_0xa75214[_0x6274('0x33')],_0x2b6f1e[_0x6274('0x35')]));_0x81cf67[_0x6274('0x3e')]['CampaignId']=_0x3109f6['id'];if(_0xa75214[_0x6274('0x33')][_0x6274('0x40')]){_0x81cf67['where']=_[_0x6274('0x41')](_0x81cf67['where'],{'$or':_[_0x6274('0x2d')](_0x81cf67[_0x6274('0x37')],function(_0x4db898){var _0x21d4e3={};_0x21d4e3[_0x4db898]={'$like':'%'+_0xa75214[_0x6274('0x33')][_0x6274('0x40')]+'%'};return _0x21d4e3;})});}_0x81cf67=_[_0x6274('0x41')]({},_0x81cf67,_0xa75214[_0x6274('0x43')]);return db[_0x6274('0x5e')][_0x6274('0x1f')]({'where':_0x81cf67[_0x6274('0x3e')]})[_0x6274('0x26')](function(_0x573e01){_0x2f0f96[_0x6274('0x1f')]=_0x573e01;if(_0xa75214['query'][_0x6274('0x49')]){_0x81cf67[_0x6274('0x44')]=[{'all':!![]}];}return db[_0x6274('0x5e')][_0x6274('0x45')](_0x81cf67);})[_0x6274('0x26')](function(_0x2f6ec2){_0x2f0f96['rows']=_0x2f6ec2;return _0x2f0f96;});}})['then'](respondWithFilteredResult(_0x2c959f,_0x81cf67))['catch'](handleError(_0x2c959f,null));};exports[_0x6274('0x5f')]=function(_0x5abfdf,_0x2ed4e0,_0x2b0e1e){var _0x2885e3={'raw':!![],'where':{}};var _0x484dcd={};var _0x182c4b={'count':0x0,'rows':[]};return db[_0x6274('0x2e')]['findOne']({'where':{'id':_0x5abfdf['params']['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x2ed4e0,null))[_0x6274('0x26')](function(_0x5ad69b){if(_0x5ad69b){_0x484dcd[_0x6274('0x31')]=_[_0x6274('0x34')](db[_0x6274('0x60')]['rawAttributes']);_0x484dcd[_0x6274('0x33')]=_[_0x6274('0x34')](_0x5abfdf[_0x6274('0x33')]);_0x484dcd[_0x6274('0x35')]=_['intersection'](_0x484dcd[_0x6274('0x31')],_0x484dcd[_0x6274('0x33')]);_0x2885e3[_0x6274('0x37')]=_[_0x6274('0x36')](_0x484dcd[_0x6274('0x31')],qs['fields'](_0x5abfdf[_0x6274('0x33')][_0x6274('0x38')]));_0x2885e3[_0x6274('0x37')]=_0x2885e3[_0x6274('0x37')][_0x6274('0x39')]?_0x2885e3['attributes']:_0x484dcd[_0x6274('0x31')];if(!_0x5abfdf['query'][_0x6274('0x3a')](_0x6274('0x3b'))){_0x2885e3['limit']=qs[_0x6274('0x1e')](_0x5abfdf[_0x6274('0x33')][_0x6274('0x1e')]);_0x2885e3['offset']=qs['offset'](_0x5abfdf[_0x6274('0x33')][_0x6274('0x1c')]);}_0x2885e3[_0x6274('0x3c')]=qs[_0x6274('0x3d')](_0x5abfdf[_0x6274('0x33')][_0x6274('0x3d')]);_0x2885e3[_0x6274('0x3e')]=qs['filters'](_[_0x6274('0x3f')](_0x5abfdf[_0x6274('0x33')],_0x484dcd['filters']));_0x2885e3[_0x6274('0x3e')]['CampaignId']=_0x5ad69b['id'];if(_0x5abfdf[_0x6274('0x33')]['filter']){_0x2885e3[_0x6274('0x3e')]=_[_0x6274('0x41')](_0x2885e3[_0x6274('0x3e')],{'$or':_[_0x6274('0x2d')](_0x2885e3[_0x6274('0x37')],function(_0x1680c9){var _0x12654d={};_0x12654d[_0x1680c9]={'$like':'%'+_0x5abfdf['query'][_0x6274('0x40')]+'%'};return _0x12654d;})});}_0x2885e3=_[_0x6274('0x41')]({},_0x2885e3,_0x5abfdf[_0x6274('0x43')]);return db[_0x6274('0x60')][_0x6274('0x1f')]({'where':_0x2885e3[_0x6274('0x3e')]})[_0x6274('0x26')](function(_0xe5d88b){_0x182c4b[_0x6274('0x1f')]=_0xe5d88b;if(_0x5abfdf[_0x6274('0x33')][_0x6274('0x49')]){_0x2885e3[_0x6274('0x44')]=[{'all':!![]}];}return db[_0x6274('0x60')][_0x6274('0x45')](_0x2885e3);})[_0x6274('0x26')](function(_0x281d89){_0x182c4b[_0x6274('0x46')]=_0x281d89;return _0x182c4b;});}})[_0x6274('0x26')](respondWithFilteredResult(_0x2ed4e0,_0x2885e3))[_0x6274('0x47')](handleError(_0x2ed4e0,null));};exports[_0x6274('0x61')]=function(_0x3f669b,_0x55f1ad,_0x16d84a){var _0x24f4c6={'raw':!![],'where':{}};var _0x3fcf92={};var _0x30bd87={'count':0x0,'rows':[]};return db[_0x6274('0x2e')][_0x6274('0x5a')]({'where':{'id':_0x3f669b[_0x6274('0x48')]['id']}})['then'](handleEntityNotFound(_0x55f1ad,null))[_0x6274('0x26')](function(_0x359363){if(_0x359363){_0x3fcf92[_0x6274('0x31')]=_[_0x6274('0x34')](db['CmHopperBlack']['rawAttributes']);_0x3fcf92[_0x6274('0x33')]=_[_0x6274('0x34')](_0x3f669b['query']);_0x3fcf92['filters']=_[_0x6274('0x36')](_0x3fcf92['model'],_0x3fcf92['query']);_0x24f4c6['attributes']=_['intersection'](_0x3fcf92['model'],qs['fields'](_0x3f669b['query'][_0x6274('0x38')]));_0x24f4c6[_0x6274('0x37')]=_0x24f4c6[_0x6274('0x37')][_0x6274('0x39')]?_0x24f4c6[_0x6274('0x37')]:_0x3fcf92[_0x6274('0x31')];if(!_0x3f669b[_0x6274('0x33')][_0x6274('0x3a')]('nolimit')){_0x24f4c6[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x3f669b[_0x6274('0x33')][_0x6274('0x1e')]);_0x24f4c6['offset']=qs[_0x6274('0x1c')](_0x3f669b[_0x6274('0x33')]['offset']);}_0x24f4c6['order']=qs[_0x6274('0x3d')](_0x3f669b[_0x6274('0x33')][_0x6274('0x3d')]);_0x24f4c6['where']=qs[_0x6274('0x35')](_[_0x6274('0x3f')](_0x3f669b['query'],_0x3fcf92[_0x6274('0x35')]));_0x24f4c6[_0x6274('0x3e')][_0x6274('0x5c')]=_0x359363['id'];if(_0x3f669b[_0x6274('0x33')][_0x6274('0x40')]){_0x24f4c6['where']=_['merge'](_0x24f4c6[_0x6274('0x3e')],{'$or':_[_0x6274('0x2d')](_0x24f4c6['attributes'],function(_0x1406d6){var _0x40185f={};_0x40185f[_0x1406d6]={'$like':'%'+_0x3f669b['query'][_0x6274('0x40')]+'%'};return _0x40185f;})});}_0x24f4c6=_[_0x6274('0x41')]({},_0x24f4c6,_0x3f669b[_0x6274('0x43')]);return db[_0x6274('0x62')][_0x6274('0x1f')]({'where':_0x24f4c6['where']})['then'](function(_0x2e340e){_0x30bd87[_0x6274('0x1f')]=_0x2e340e;if(_0x3f669b['query'][_0x6274('0x49')]){_0x24f4c6[_0x6274('0x44')]=[{'all':!![]}];}return db[_0x6274('0x62')][_0x6274('0x45')](_0x24f4c6);})[_0x6274('0x26')](function(_0x2b709f){_0x30bd87['rows']=_0x2b709f;return _0x30bd87;});}})[_0x6274('0x26')](respondWithFilteredResult(_0x55f1ad,_0x24f4c6))[_0x6274('0x47')](handleError(_0x55f1ad,null));};exports[_0x6274('0x63')]=function(_0x45ed7c,_0x50efc8,_0x1f0987){var _0x18fbee={};var _0x1ecdf1={};var _0x203765;var _0x10ba92;return db[_0x6274('0x2e')][_0x6274('0x5a')]({'where':{'id':_0x45ed7c[_0x6274('0x48')]['id']}})['then'](handleEntityNotFound(_0x50efc8,null))[_0x6274('0x26')](function(_0x3cd2f2){if(_0x3cd2f2){_0x203765=_0x3cd2f2;_0x1ecdf1[_0x6274('0x31')]=_['keys'](db[_0x6274('0x64')]['rawAttributes']);_0x1ecdf1[_0x6274('0x33')]=_[_0x6274('0x34')](_0x45ed7c[_0x6274('0x33')]);_0x1ecdf1[_0x6274('0x35')]=_[_0x6274('0x36')](_0x1ecdf1[_0x6274('0x31')],_0x1ecdf1[_0x6274('0x33')]);_0x18fbee[_0x6274('0x37')]=_[_0x6274('0x36')](_0x1ecdf1[_0x6274('0x31')],qs[_0x6274('0x38')](_0x45ed7c[_0x6274('0x33')][_0x6274('0x38')]));_0x18fbee[_0x6274('0x37')]=_0x18fbee[_0x6274('0x37')][_0x6274('0x39')]?_0x18fbee[_0x6274('0x37')]:_0x1ecdf1[_0x6274('0x31')];_0x18fbee[_0x6274('0x3c')]=qs[_0x6274('0x3d')](_0x45ed7c[_0x6274('0x33')][_0x6274('0x3d')]);_0x18fbee[_0x6274('0x3e')]=qs[_0x6274('0x35')](_['pick'](_0x45ed7c[_0x6274('0x33')],_0x1ecdf1[_0x6274('0x35')]));if(_0x45ed7c[_0x6274('0x33')][_0x6274('0x40')]){_0x18fbee[_0x6274('0x3e')]=_[_0x6274('0x41')](_0x18fbee[_0x6274('0x3e')],{'$or':_[_0x6274('0x2d')](_0x18fbee[_0x6274('0x37')],function(_0x2365de){var _0x2d1c4c={};_0x2d1c4c[_0x2365de]={'$like':'%'+_0x45ed7c[_0x6274('0x33')][_0x6274('0x40')]+'%'};return _0x2d1c4c;})});}_0x18fbee=_['merge']({},_0x18fbee,_0x45ed7c[_0x6274('0x43')]);return _0x203765[_0x6274('0x63')](_0x18fbee);}})['then'](function(_0x6457a1){if(_0x6457a1){_0x10ba92=_0x6457a1[_0x6274('0x39')];if(!_0x45ed7c[_0x6274('0x33')][_0x6274('0x3a')]('nolimit')){_0x18fbee[_0x6274('0x1e')]=qs[_0x6274('0x1e')](_0x45ed7c[_0x6274('0x33')][_0x6274('0x1e')]);_0x18fbee[_0x6274('0x1c')]=qs[_0x6274('0x1c')](_0x45ed7c['query']['offset']);}return _0x203765[_0x6274('0x63')](_0x18fbee);}})[_0x6274('0x26')](function(_0x130415){if(_0x130415){return _0x130415?{'count':_0x10ba92,'rows':_0x130415}:null;}})[_0x6274('0x26')](respondWithResult(_0x50efc8,null))[_0x6274('0x47')](handleError(_0x50efc8,null));};exports['addLists']=function(_0x153b71,_0x246058,_0x5e908d){var _0x49cd05,_0x282426;var _0x3582fb=[];var _0x18e9d4=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0x6274('0x2e')][_0x6274('0x4a')]({'where':{'id':_0x153b71[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x246058,null))[_0x6274('0x26')](function(_0x803de5){if(_0x803de5){_0x282426=_0x803de5;return _0x803de5['addLists'](_0x153b71['body'][_0x6274('0x65')],_[_0x6274('0x54')](_0x153b71['body'],[_0x6274('0x65'),'id'])||{});}return null;})[_0x6274('0x66')](function(_0x1ba600){var _0x572923;var _0x43608e;_0x49cd05=_0x1ba600||[];var _0x2ce26e=[];if(_0x1ba600){for(var _0x542803=0x0;_0x542803<_0x1ba600[_0x6274('0x39')];_0x542803+=0x1){var _0x408831=_0x1ba600[_0x542803]['get']({'plain':!![]});_0x282426[_0x6274('0x67')]=_0x153b71[_0x6274('0x4c')][_0x6274('0x67')]?_0x153b71[_0x6274('0x4c')][_0x6274('0x67')]:_0x282426[_0x6274('0x67')];switch(_0x282426['dialCheckDuplicateType']){case'always':_0x572923=squel[_0x6274('0x68')]()['into'](_0x6274('0x69'))['fromQuery']([_0x6274('0x6a'),_0x6274('0x6b'),_0x6274('0x6c'),_0x6274('0x6d'),_0x6274('0x5c'),'createdAt',_0x6274('0x56')],squel[_0x6274('0x6e')]()['field'](_0x6274('0x6a'),_0x6274('0x6a'))['field']('NOW()',_0x6274('0x6b'))['field']('id',_0x6274('0x6c'))[_0x6274('0x6f')](_0x408831[_0x6274('0x70')][_0x6274('0x71')](),'ListId')[_0x6274('0x6f')](_0x153b71[_0x6274('0x48')]['id'][_0x6274('0x71')](),_0x6274('0x5c'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27',_0x6274('0x55'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27',_0x6274('0x56'))[_0x6274('0x72')](_0x6274('0x73'))[_0x6274('0x3e')](_0x6274('0x74'))[_0x6274('0x3e')](_0x6274('0x75'),_0x408831[_0x6274('0x70')][_0x6274('0x71')]())[_0x6274('0x3e')](_0x6274('0x76'))[_0x6274('0x3e')](_0x6274('0x77'),squel[_0x6274('0x6e')]()[_0x6274('0x6f')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')['where'](_0x6274('0x78'),_0x153b71['params']['id'][_0x6274('0x71')]()))[_0x6274('0x3e')](_0x6274('0x77'),squel[_0x6274('0x6e')]()['field'](_0x6274('0x79'))[_0x6274('0x72')](_0x6274('0x69'))['where'](_0x6274('0x78'),_0x153b71[_0x6274('0x48')]['id'][_0x6274('0x71')]())))['toString']();break;case _0x6274('0x7a'):_0x572923=squel['insert']()[_0x6274('0x7b')]('cm_hopper')[_0x6274('0x7c')]([_0x6274('0x6a'),_0x6274('0x6b'),'ContactId',_0x6274('0x6d'),'CampaignId','createdAt','updatedAt'],squel[_0x6274('0x6e')]()['field']('phone',_0x6274('0x6a'))['field'](_0x6274('0x7d'),'scheduledAt')[_0x6274('0x6f')]('id',_0x6274('0x6c'))[_0x6274('0x6f')](_0x408831['CmListId'][_0x6274('0x71')](),_0x6274('0x6d'))[_0x6274('0x6f')](_0x153b71[_0x6274('0x48')]['id'][_0x6274('0x71')](),_0x6274('0x5c'))['field']('\x27'+_0x18e9d4+'\x27',_0x6274('0x55'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27',_0x6274('0x56'))[_0x6274('0x72')](_0x6274('0x73'))[_0x6274('0x3e')](_0x6274('0x74'))[_0x6274('0x3e')](_0x6274('0x75'),_0x408831[_0x6274('0x70')][_0x6274('0x71')]())[_0x6274('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x6274('0x3e')](_0x6274('0x77'),squel[_0x6274('0x6e')]()[_0x6274('0x6f')](_0x6274('0x79'))[_0x6274('0x72')](_0x6274('0x69'))[_0x6274('0x3e')](_0x6274('0x78'),_0x153b71[_0x6274('0x48')]['id'][_0x6274('0x71')]())))[_0x6274('0x71')]();break;default:_0x572923=squel[_0x6274('0x68')]()[_0x6274('0x7b')](_0x6274('0x69'))[_0x6274('0x7c')]([_0x6274('0x6a'),_0x6274('0x6b'),_0x6274('0x6c'),_0x6274('0x6d'),'CampaignId',_0x6274('0x55'),_0x6274('0x56')],squel[_0x6274('0x6e')]()[_0x6274('0x6f')](_0x6274('0x6a'),_0x6274('0x6a'))[_0x6274('0x6f')](_0x6274('0x7d'),'scheduledAt')['field']('id',_0x6274('0x6c'))[_0x6274('0x6f')](_0x408831[_0x6274('0x70')][_0x6274('0x71')](),_0x6274('0x6d'))[_0x6274('0x6f')](_0x153b71[_0x6274('0x48')]['id']['toString'](),_0x6274('0x5c'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27',_0x6274('0x55'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27',_0x6274('0x56'))[_0x6274('0x72')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x6274('0x3e')](_0x6274('0x75'),_0x408831[_0x6274('0x70')][_0x6274('0x71')]())[_0x6274('0x3e')](_0x6274('0x76')))[_0x6274('0x71')]();}_0x43608e=squel[_0x6274('0x68')]()[_0x6274('0x7b')](_0x6274('0x7e'))[_0x6274('0x7c')]([_0x6274('0x7f'),_0x6274('0x6b'),_0x6274('0x6a'),_0x6274('0x80'),_0x6274('0x55'),_0x6274('0x56')],squel['select']()[_0x6274('0x6f')](_0x6274('0x81'),'id')[_0x6274('0x6f')](_0x6274('0x7d'),'scheduledAt')[_0x6274('0x6f')](_0x6274('0x82'),_0x6274('0x6a'))[_0x6274('0x6f')](_0x6274('0x83'),_0x6274('0x80'))[_0x6274('0x6f')]('\x27'+_0x18e9d4+'\x27','createdAt')['field']('\x27'+_0x18e9d4+'\x27',_0x6274('0x56'))['from'](_0x6274('0x84'),'ci')[_0x6274('0x85')](_0x6274('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')['where'](_0x6274('0x86'),_0x408831[_0x6274('0x70')][_0x6274('0x71')]())[_0x6274('0x3e')](_0x6274('0x87'),_0x153b71[_0x6274('0x48')]['id'][_0x6274('0x71')]())[_0x6274('0x3e')](_0x6274('0x88'),_0x18e9d4))[_0x6274('0x71')]();_0x2ce26e[_0x6274('0x89')](db[_0x6274('0x8a')][_0x6274('0x33')](_0x572923));_0x3582fb['push'](db['sequelize'][_0x6274('0x33')](_0x43608e));}return BPromise[_0x6274('0x8b')](_0x2ce26e);}})[_0x6274('0x26')](function(){return BPromise['all'](_0x3582fb);})['then'](function(){return _0x49cd05;})[_0x6274('0x26')](respondWithResult(_0x246058,null))[_0x6274('0x47')](handleError(_0x246058,null));};exports[_0x6274('0x8c')]=function(_0x2b799f,_0x141b22,_0x4d08a6){return db[_0x6274('0x2e')][_0x6274('0x4a')]({'where':{'id':_0x2b799f['params']['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x141b22,null))['then'](function(_0x26fd0b){if(_0x26fd0b){return _0x26fd0b[_0x6274('0x8c')](_0x2b799f[_0x6274('0x33')][_0x6274('0x65')]);}})[_0x6274('0x26')](function(_0x248722){if(_0x248722){return db[_0x6274('0x5b')][_0x6274('0x27')]({'where':{'ListId':_0x2b799f[_0x6274('0x33')][_0x6274('0x65')],'CampaignId':_0x2b799f[_0x6274('0x48')]['id']}})[_0x6274('0x26')](function(){return _0x248722;});}})['then'](respondWithStatusCode(_0x141b22,null))[_0x6274('0x47')](handleError(_0x141b22,null));};exports[_0x6274('0x8d')]=function(_0x5ca291,_0x32505c,_0x3340a0){var _0x445755={};var _0x4a1615={};var _0x510dc5;var _0x251195;return db[_0x6274('0x2e')][_0x6274('0x5a')]({'where':{'id':_0x5ca291[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x32505c,null))[_0x6274('0x26')](function(_0xda2a80){if(_0xda2a80){_0x510dc5=_0xda2a80;_0x4a1615[_0x6274('0x31')]=_[_0x6274('0x34')](db[_0x6274('0x64')][_0x6274('0x2f')]);_0x4a1615[_0x6274('0x33')]=_[_0x6274('0x34')](_0x5ca291['query']);_0x4a1615[_0x6274('0x35')]=_[_0x6274('0x36')](_0x4a1615[_0x6274('0x31')],_0x4a1615['query']);_0x445755[_0x6274('0x37')]=_[_0x6274('0x36')](_0x4a1615[_0x6274('0x31')],qs['fields'](_0x5ca291[_0x6274('0x33')]['fields']));_0x445755[_0x6274('0x37')]=_0x445755['attributes'][_0x6274('0x39')]?_0x445755[_0x6274('0x37')]:_0x4a1615['model'];_0x445755['order']=qs[_0x6274('0x3d')](_0x5ca291[_0x6274('0x33')][_0x6274('0x3d')]);_0x445755[_0x6274('0x3e')]=qs[_0x6274('0x35')](_[_0x6274('0x3f')](_0x5ca291[_0x6274('0x33')],_0x4a1615[_0x6274('0x35')]));if(_0x5ca291[_0x6274('0x33')][_0x6274('0x40')]){_0x445755[_0x6274('0x3e')]=_[_0x6274('0x41')](_0x445755[_0x6274('0x3e')],{'$or':_[_0x6274('0x2d')](_0x445755[_0x6274('0x37')],function(_0x5dae80){var _0x4266d3={};_0x4266d3[_0x5dae80]={'$like':'%'+_0x5ca291[_0x6274('0x33')][_0x6274('0x40')]+'%'};return _0x4266d3;})});}_0x445755=_['merge']({},_0x445755,_0x5ca291['options']);return _0x510dc5['getBlackLists'](_0x445755);}})[_0x6274('0x26')](function(_0xa05006){if(_0xa05006){_0x251195=_0xa05006['length'];if(!_0x5ca291[_0x6274('0x33')]['hasOwnProperty'](_0x6274('0x3b'))){_0x445755['limit']=qs[_0x6274('0x1e')](_0x5ca291[_0x6274('0x33')]['limit']);_0x445755[_0x6274('0x1c')]=qs[_0x6274('0x1c')](_0x5ca291[_0x6274('0x33')]['offset']);}return _0x510dc5[_0x6274('0x8d')](_0x445755);}})['then'](function(_0xa9b517){if(_0xa9b517){return _0xa9b517?{'count':_0x251195,'rows':_0xa9b517}:null;}})[_0x6274('0x26')](respondWithResult(_0x32505c,null))[_0x6274('0x47')](handleError(_0x32505c,null));};exports[_0x6274('0x8e')]=function(_0x59e028,_0x17b3bb,_0xbee1c5){var _0x1dbf7d,_0x579608;var _0x7395ec=[];var _0x205d04=moment()[_0x6274('0x8f')](_0x6274('0x90'));return db[_0x6274('0x2e')]['find']({'where':{'id':_0x59e028['params']['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x17b3bb,null))[_0x6274('0x26')](function(_0x22f916){if(_0x22f916){_0x579608=_0x22f916;return _0x22f916[_0x6274('0x8e')](_0x59e028[_0x6274('0x4c')][_0x6274('0x65')],_[_0x6274('0x54')](_0x59e028[_0x6274('0x4c')],[_0x6274('0x65'),'id'])||{});}return null;})[_0x6274('0x66')](function(_0x4b65aa){var _0x47727b;var _0x1cb62c;_0x1dbf7d=_0x4b65aa||[];var _0xca13e=[];if(_0x4b65aa){for(var _0x2423ea=0x0;_0x2423ea<_0x4b65aa[_0x6274('0x39')];_0x2423ea+=0x1){var _0x1784a2=_0x4b65aa[_0x2423ea][_0x6274('0x28')]({'plain':!![]});_0x47727b=squel[_0x6274('0x68')]()[_0x6274('0x7b')](_0x6274('0x91'))[_0x6274('0x7c')]([_0x6274('0x6a'),'ContactId',_0x6274('0x6d'),_0x6274('0x5c'),'createdAt','updatedAt'],squel[_0x6274('0x6e')]()[_0x6274('0x6f')]('phone',_0x6274('0x6a'))[_0x6274('0x6f')]('id',_0x6274('0x6c'))[_0x6274('0x6f')](_0x1784a2[_0x6274('0x70')][_0x6274('0x71')](),'ListId')[_0x6274('0x6f')](_0x59e028[_0x6274('0x48')]['id'][_0x6274('0x71')](),_0x6274('0x5c'))[_0x6274('0x6f')]('NOW()','createdAt')[_0x6274('0x6f')]('NOW()',_0x6274('0x56'))[_0x6274('0x72')](_0x6274('0x73'))['where'](_0x6274('0x74'))[_0x6274('0x3e')]('ListId\x20=\x20?',_0x1784a2[_0x6274('0x70')][_0x6274('0x71')]())[_0x6274('0x3e')](_0x6274('0x76')))[_0x6274('0x71')]();_0xca13e[_0x6274('0x89')](db[_0x6274('0x8a')][_0x6274('0x33')](_0x47727b));}return BPromise['all'](_0xca13e);}})[_0x6274('0x26')](function(){return _0x1dbf7d;})[_0x6274('0x26')](respondWithResult(_0x17b3bb,null))[_0x6274('0x47')](handleError(_0x17b3bb,null));};exports[_0x6274('0x92')]=function(_0x25f3a8,_0x14fdf0,_0x148bd8){return db['Campaign'][_0x6274('0x4a')]({'where':{'id':_0x25f3a8[_0x6274('0x48')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x14fdf0,null))['then'](function(_0x8556ad){if(_0x8556ad){return _0x8556ad[_0x6274('0x92')](_0x25f3a8[_0x6274('0x33')][_0x6274('0x65')]);}})[_0x6274('0x26')](function(_0xd4ed56){if(_0xd4ed56){return db['CmHopperBlack'][_0x6274('0x27')]({'where':{'ListId':_0x25f3a8[_0x6274('0x33')][_0x6274('0x65')],'CampaignId':_0x25f3a8[_0x6274('0x48')]['id']}})['then'](function(){return _0xd4ed56;});}})[_0x6274('0x26')](respondWithStatusCode(_0x14fdf0,null))[_0x6274('0x47')](handleError(_0x14fdf0,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 2342055..0955764 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x6c6d17,_0x203165){var _0x425f24=function(_0x3fb7df){while(--_0x3fb7df){_0x6c6d17['push'](_0x6c6d17['shift']());}};_0x425f24(++_0x203165);}(_0x7a54,0x106));var _0x47a5=function(_0x4abdee,_0x5017ac){_0x4abdee=_0x4abdee-0x0;var _0x21e71f=_0x7a54[_0x4abdee];return _0x21e71f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x27f9ff,_0x26b9c){var _0x349f72=function(_0xfe811){while(--_0xfe811){_0x27f9ff['push'](_0x27f9ff['shift']());}};_0x349f72(++_0x26b9c);}(_0x7a54,0x106));var _0x47a5=function(_0x382893,_0x3eea1f){_0x382893=_0x382893-0x0;var _0x396877=_0x7a54[_0x382893];return _0x396877;};'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 b34f9d8..d201420 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 _0x8d9b=['info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','include','map','model','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x1f5e25,_0x171656){var _0x2fbb0a=function(_0x58237e){while(--_0x58237e){_0x1f5e25['push'](_0x1f5e25['shift']());}};_0x2fbb0a(++_0x171656);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var moment=require(_0xb8d9('0x2'));var BPromise=require(_0xb8d9('0x3'));var rs=require(_0xb8d9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb8d9('0x5'));var logger=require('../../config/logger')(_0xb8d9('0x6'));var config=require(_0xb8d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21c87d,_0x537b18,_0x53339b){return new BPromise(function(_0x4c2b8f,_0x13352e){return client[_0xb8d9('0x8')](_0x21c87d,_0x53339b)[_0xb8d9('0x9')](function(_0x2189b1){logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));logger['debug'](_0xb8d9('0xd'),_0x537b18,'request\x20sent',JSON[_0xb8d9('0xe')](_0x2189b1));if(_0x2189b1[_0xb8d9('0xf')]){if(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x10')]===0x1f4){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x13352e(_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);}logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x2189b1[_0xb8d9('0xf')][_0xb8d9('0x11')]);return _0x4c2b8f(_0x2189b1['error'][_0xb8d9('0x11')]);}else{logger[_0xb8d9('0xa')](_0xb8d9('0xb'),_0x537b18,_0xb8d9('0xc'));_0x4c2b8f(_0x2189b1[_0xb8d9('0x12')]['message']);}})['catch'](function(_0x5b7d5a){logger[_0xb8d9('0xf')](_0xb8d9('0xb'),_0x537b18,_0x5b7d5a);_0x13352e(_0x5b7d5a);});});}exports[_0xb8d9('0x13')]=function(_0x1183e4){var _0x4fec1e=this;return new Promise(function(_0x31b33f,_0x59b7f6){return db[_0xb8d9('0x14')][_0xb8d9('0x15')]({'raw':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x17')]===undefined?!![]:![]:!![],'where':_0x1183e4['options']?_0x1183e4['options']['where']||null:null,'attributes':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x18')]||null:null,'limit':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')]['limit']||null:null,'include':_0x1183e4[_0xb8d9('0x16')]?_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x19')]?_[_0xb8d9('0x1a')](_0x1183e4[_0xb8d9('0x16')][_0xb8d9('0x19')],function(_0x3f4b9d){return{'model':db[_0x3f4b9d[_0xb8d9('0x1b')]],'as':_0x3f4b9d['as'],'attributes':_0x3f4b9d[_0xb8d9('0x18')],'include':_0x3f4b9d[_0xb8d9('0x19')]?_['map'](_0x3f4b9d[_0xb8d9('0x19')],function(_0x49380d){return{'model':db[_0x49380d['model']],'as':_0x49380d['as'],'attributes':_0x49380d[_0xb8d9('0x18')],'include':_0x49380d[_0xb8d9('0x19')]?_[_0xb8d9('0x1a')](_0x49380d[_0xb8d9('0x19')],function(_0x30b346){return{'model':db[_0x30b346['model']],'as':_0x30b346['as'],'attributes':_0x30b346[_0xb8d9('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb8d9('0x9')](function(_0x3111aa){logger['info'](_0xb8d9('0x13'),_0x1183e4);logger[_0xb8d9('0x1c')](_0xb8d9('0x13'),_0x1183e4,JSON['stringify'](_0x3111aa));_0x31b33f(_0x3111aa);})[_0xb8d9('0x1d')](function(_0x12a043){logger['error'](_0xb8d9('0x13'),_0x12a043[_0xb8d9('0x11')],_0x1183e4);_0x59b7f6(_0x4fec1e[_0xb8d9('0xf')](0x1f4,_0x12a043[_0xb8d9('0x11')]));});});}; \ No newline at end of file +var _0xc2cc=['model','then','catch','GetCampaign','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','Campaign','findAll','options','raw','map','include','attributes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xc2cc,0x70));var _0xcc2c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xc2cc[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xcc2c('0x0'));var moment=require(_0xcc2c('0x1'));var BPromise=require(_0xcc2c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc2c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc2c('0x4'));var logger=require('../../config/logger')(_0xcc2c('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc2c('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x475a85,_0x4ab837,_0x144b90){return new BPromise(function(_0x5a276f,_0x1d311f){return client['request'](_0x475a85,_0x144b90)['then'](function(_0x2bde97){logger[_0xcc2c('0x7')](_0xcc2c('0x8'),_0x4ab837,_0xcc2c('0x9'));logger[_0xcc2c('0xa')](_0xcc2c('0xb'),_0x4ab837,_0xcc2c('0x9'),JSON[_0xcc2c('0xc')](_0x2bde97));if(_0x2bde97['error']){if(_0x2bde97[_0xcc2c('0xd')]['code']===0x1f4){logger[_0xcc2c('0xd')](_0xcc2c('0x8'),_0x4ab837,_0x2bde97[_0xcc2c('0xd')][_0xcc2c('0xe')]);return _0x1d311f(_0x2bde97['error']['message']);}logger['error'](_0xcc2c('0x8'),_0x4ab837,_0x2bde97[_0xcc2c('0xd')]['message']);return _0x5a276f(_0x2bde97['error'][_0xcc2c('0xe')]);}else{logger['info'](_0xcc2c('0x8'),_0x4ab837,_0xcc2c('0x9'));_0x5a276f(_0x2bde97[_0xcc2c('0xf')][_0xcc2c('0xe')]);}})['catch'](function(_0x5d6189){logger[_0xcc2c('0xd')](_0xcc2c('0x8'),_0x4ab837,_0x5d6189);_0x1d311f(_0x5d6189);});});}exports['GetCampaign']=function(_0x31849a){var _0x285deb=this;return new Promise(function(_0x440458,_0x2a9f02){return db[_0xcc2c('0x10')][_0xcc2c('0x11')]({'raw':_0x31849a[_0xcc2c('0x12')]?_0x31849a['options'][_0xcc2c('0x13')]===undefined?!![]:![]:!![],'where':_0x31849a[_0xcc2c('0x12')]?_0x31849a['options']['where']||null:null,'attributes':_0x31849a['options']?_0x31849a[_0xcc2c('0x12')]['attributes']||null:null,'limit':_0x31849a[_0xcc2c('0x12')]?_0x31849a[_0xcc2c('0x12')]['limit']||null:null,'include':_0x31849a[_0xcc2c('0x12')]?_0x31849a[_0xcc2c('0x12')]['include']?_[_0xcc2c('0x14')](_0x31849a['options'][_0xcc2c('0x15')],function(_0x5233e3){return{'model':db[_0x5233e3['model']],'as':_0x5233e3['as'],'attributes':_0x5233e3[_0xcc2c('0x16')],'include':_0x5233e3[_0xcc2c('0x15')]?_['map'](_0x5233e3[_0xcc2c('0x15')],function(_0x1d3f8d){return{'model':db[_0x1d3f8d[_0xcc2c('0x17')]],'as':_0x1d3f8d['as'],'attributes':_0x1d3f8d[_0xcc2c('0x16')],'include':_0x1d3f8d[_0xcc2c('0x15')]?_[_0xcc2c('0x14')](_0x1d3f8d['include'],function(_0xaab877){return{'model':db[_0xaab877[_0xcc2c('0x17')]],'as':_0xaab877['as'],'attributes':_0xaab877[_0xcc2c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xcc2c('0x18')](function(_0x430eef){logger['info']('GetCampaign',_0x31849a);logger['debug']('GetCampaign',_0x31849a,JSON[_0xcc2c('0xc')](_0x430eef));_0x440458(_0x430eef);})[_0xcc2c('0x19')](function(_0x406515){logger[_0xcc2c('0xd')](_0xcc2c('0x1a'),_0x406515[_0xcc2c('0xe')],_0x31849a);_0x2a9f02(_0x285deb[_0xcc2c('0xd')](0x1f4,_0x406515[_0xcc2c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index bf4d389..7716f6f 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 _0x2f76=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','getBlackLists','create','post','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0xf15be4,_0x2c2591){var _0x2b6849=function(_0x544282){while(--_0x544282){_0xf15be4['push'](_0xf15be4['shift']());}};_0x2b6849(++_0x2c2591);}(_0x2f76,0x122));var _0x62f7=function(_0x16c168,_0xad210f){_0x16c168=_0x16c168-0x0;var _0x419df6=_0x2f76[_0x16c168];return _0x419df6;};'use strict';var multer=require('multer');var util=require(_0x62f7('0x0'));var path=require(_0x62f7('0x1'));var timeout=require(_0x62f7('0x2'));var express=require(_0x62f7('0x3'));var router=express['Router']();var fs_extra=require(_0x62f7('0x4'));var auth=require(_0x62f7('0x5'));var interaction=require(_0x62f7('0x6'));var config=require(_0x62f7('0x7'));var controller=require('./campaign.controller');router[_0x62f7('0x8')]('/',auth[_0x62f7('0x9')](),controller[_0x62f7('0xa')]);router[_0x62f7('0x8')](_0x62f7('0xb'),auth[_0x62f7('0x9')](),controller[_0x62f7('0xc')]);router[_0x62f7('0x8')](_0x62f7('0xd'),auth['isAuthenticated'](),controller[_0x62f7('0xe')]);router['get'](_0x62f7('0xf'),auth['isAuthenticated'](),controller[_0x62f7('0x10')]);router['get'](_0x62f7('0x11'),auth['isAuthenticated'](),controller[_0x62f7('0x12')]);router[_0x62f7('0x8')]('/:id/hopper_black',auth[_0x62f7('0x9')](),controller['getHopperBlacks']);router[_0x62f7('0x8')](_0x62f7('0x13'),auth['isAuthenticated'](),controller[_0x62f7('0x14')]);router[_0x62f7('0x8')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x62f7('0x15')]);router['post']('/',auth[_0x62f7('0x9')](),controller[_0x62f7('0x16')]);router[_0x62f7('0x17')](_0x62f7('0x18'),auth[_0x62f7('0x9')](),controller[_0x62f7('0x19')]);router[_0x62f7('0x17')]('/:id/lists',auth[_0x62f7('0x9')](),controller[_0x62f7('0x1a')]);router[_0x62f7('0x17')](_0x62f7('0x1b'),auth[_0x62f7('0x9')](),controller[_0x62f7('0x1c')]);router[_0x62f7('0x1d')](_0x62f7('0xb'),auth['isAuthenticated'](),controller[_0x62f7('0x1e')]);router[_0x62f7('0x1f')](_0x62f7('0xb'),auth[_0x62f7('0x9')](),controller[_0x62f7('0x20')]);router['delete']('/:id/lists',auth[_0x62f7('0x9')](),controller['removeLists']);router[_0x62f7('0x1f')](_0x62f7('0x1b'),auth[_0x62f7('0x9')](),controller['removeBlackLists']);module[_0x62f7('0x21')]=router; \ No newline at end of file +var _0x7153=['isAuthenticated','index','show','/:id/hoppers','/:id/hopper_finals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','put','/:id','update','delete','removeLists','removeBlackLists','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7153,0x136));var _0x3715=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x7153[_0x23e7c1];return _0x1add43;};'use strict';var multer=require('multer');var util=require(_0x3715('0x0'));var path=require(_0x3715('0x1'));var timeout=require(_0x3715('0x2'));var express=require(_0x3715('0x3'));var router=express[_0x3715('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3715('0x5'));var interaction=require(_0x3715('0x6'));var config=require(_0x3715('0x7'));var controller=require('./campaign.controller');router[_0x3715('0x8')]('/',auth[_0x3715('0x9')](),controller[_0x3715('0xa')]);router[_0x3715('0x8')]('/:id',auth[_0x3715('0x9')](),controller[_0x3715('0xb')]);router['get'](_0x3715('0xc'),auth[_0x3715('0x9')](),controller['getHoppers']);router[_0x3715('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0x3715('0xd'),auth[_0x3715('0x9')](),controller['getHopperFinals']);router[_0x3715('0x8')]('/:id/hopper_black',auth[_0x3715('0x9')](),controller[_0x3715('0xe')]);router[_0x3715('0x8')](_0x3715('0xf'),auth[_0x3715('0x9')](),controller['getLists']);router[_0x3715('0x8')]('/:id/blacklists',auth[_0x3715('0x9')](),controller[_0x3715('0x10')]);router[_0x3715('0x11')]('/',auth[_0x3715('0x9')](),controller[_0x3715('0x12')]);router[_0x3715('0x11')](_0x3715('0x13'),auth[_0x3715('0x9')](),controller[_0x3715('0x14')]);router['post']('/:id/lists',auth[_0x3715('0x9')](),controller[_0x3715('0x15')]);router[_0x3715('0x11')](_0x3715('0x16'),auth[_0x3715('0x9')](),controller['addBlackLists']);router[_0x3715('0x17')](_0x3715('0x18'),auth[_0x3715('0x9')](),controller[_0x3715('0x19')]);router['delete'](_0x3715('0x18'),auth['isAuthenticated'](),controller['destroy']);router[_0x3715('0x1a')]('/:id/lists',auth[_0x3715('0x9')](),controller[_0x3715('0x1b')]);router[_0x3715('0x1a')]('/:id/blacklists',auth[_0x3715('0x9')](),controller[_0x3715('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5b3de58..6efd83e 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 _0xce89=['key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x1fda3c,_0xefd4cb){var _0x1a2d1e=function(_0x31a6c3){while(--_0x31a6c3){_0x1fda3c['push'](_0x1fda3c['shift']());}};_0x1a2d1e(++_0xefd4cb);}(_0xce89,0x175));var _0x9ce8=function(_0x28cee5,_0x265baf){_0x28cee5=_0x28cee5-0x0;var _0x262eef=_0xce89[_0x28cee5];return _0x262eef;};'use strict';var Sequelize=require(_0x9ce8('0x0'));module[_0x9ce8('0x1')]={'key':{'type':Sequelize[_0x9ce8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x9ce8('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x9ce8('0x2')]},'name':{'type':Sequelize[_0x9ce8('0x4')],'get':function(){return this['getDataValue'](_0x9ce8('0x5'));}}}; \ No newline at end of file +var _0x2ad2=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0xb471c,_0x27b05c){var _0x590467=function(_0x2ac574){while(--_0x2ac574){_0xb471c['push'](_0xb471c['shift']());}};_0x590467(++_0x27b05c);}(_0x2ad2,0x14a));var _0x22ad=function(_0x936f1f,_0x2eaf2f){_0x936f1f=_0x936f1f-0x0;var _0xb36ff7=_0x2ad2[_0x936f1f];return _0xb36ff7;};'use strict';var Sequelize=require(_0x22ad('0x0'));module[_0x22ad('0x1')]={'key':{'type':Sequelize[_0x22ad('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x22ad('0x2')]},'name':{'type':Sequelize[_0x22ad('0x3')],'get':function(){return this[_0x22ad('0x4')](_0x22ad('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b9841d3..989ef20 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 _0xef93=['../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','name','map','CannedAnswer','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x53b55f,_0x7980d0){var _0x71d9fa=function(_0x1c30c2){while(--_0x1c30c2){_0x53b55f['push'](_0x53b55f['shift']());}};_0x71d9fa(++_0x7980d0);}(_0xef93,0x18a));var _0x3ef9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xef93[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x3ef9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ef9('0x1'));var jsonpatch=require(_0x3ef9('0x2'));var rp=require(_0x3ef9('0x3'));var moment=require('moment');var BPromise=require(_0x3ef9('0x4'));var Mustache=require(_0x3ef9('0x5'));var util=require(_0x3ef9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3ef9('0x7'));var ejs=require(_0x3ef9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ef9('0x9'));var squel=require(_0x3ef9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3ef9('0xb'));var toCsv=require(_0x3ef9('0x7'));var querystring=require(_0x3ef9('0xc'));var Papa=require(_0x3ef9('0xd'));var Redis=require(_0x3ef9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3ef9('0xf'));var as=require(_0x3ef9('0x10'));var hardwareService=require(_0x3ef9('0x11'));var logger=require('../../config/logger')(_0x3ef9('0x12'));var utils=require(_0x3ef9('0x13'));var config=require(_0x3ef9('0x14'));var licenseUtil=require(_0x3ef9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d7bae,_0x401047){_0x401047=_0x401047||0xcc;return function(_0x5ced01){if(_0x5ced01){return _0x5d7bae['sendStatus'](_0x401047);}return _0x5d7bae[_0x3ef9('0x16')](_0x401047)[_0x3ef9('0x17')]();};}function respondWithResult(_0x216164,_0x1c9661){_0x1c9661=_0x1c9661||0xc8;return function(_0x5e20ab){if(_0x5e20ab){return _0x216164[_0x3ef9('0x16')](_0x1c9661)[_0x3ef9('0x18')](_0x5e20ab);}};}function respondWithFilteredResult(_0x13c09d,_0x24a04c){return function(_0x3c01dc){if(_0x3c01dc){var _0x1d2980=typeof _0x24a04c[_0x3ef9('0x19')]==='undefined'&&typeof _0x24a04c[_0x3ef9('0x1a')]===_0x3ef9('0x1b');var _0x2016dc=_0x3c01dc[_0x3ef9('0x1c')];var _0x475aab=_0x1d2980?0x0:_0x24a04c[_0x3ef9('0x19')];var _0x260539=_0x1d2980?_0x3c01dc[_0x3ef9('0x1c')]:_0x24a04c['offset']+_0x24a04c[_0x3ef9('0x1a')];var _0x55c7a8;if(_0x260539>=_0x2016dc){_0x260539=_0x2016dc;_0x55c7a8=0xc8;}else{_0x55c7a8=0xce;}_0x13c09d[_0x3ef9('0x16')](_0x55c7a8);return _0x13c09d[_0x3ef9('0x1d')](_0x3ef9('0x1e'),_0x475aab+'-'+_0x260539+'/'+_0x2016dc)[_0x3ef9('0x18')](_0x3c01dc);}return null;};}function patchUpdates(_0xc5b689){return function(_0x5f07ec){try{jsonpatch[_0x3ef9('0x1f')](_0x5f07ec,_0xc5b689,!![]);}catch(_0x218cb2){return BPromise[_0x3ef9('0x20')](_0x218cb2);}return _0x5f07ec[_0x3ef9('0x21')]();};}function saveUpdates(_0x43c1cb,_0x560b64){return function(_0x282bfe){if(_0x282bfe){return _0x282bfe[_0x3ef9('0x22')](_0x43c1cb)['then'](function(_0x24bbd5){return _0x24bbd5;});}return null;};}function removeEntity(_0x4809b7,_0x24fb78){return function(_0x190181){if(_0x190181){return _0x190181[_0x3ef9('0x23')]()['then'](function(){var _0x44bcb0=_0x190181[_0x3ef9('0x24')]({'plain':!![]});var _0x2067a2='CannedAnswers';return db[_0x3ef9('0x25')][_0x3ef9('0x23')]({'where':{'type':_0x2067a2,'resourceId':_0x44bcb0['id']}})[_0x3ef9('0x26')](function(){return _0x190181;});})[_0x3ef9('0x26')](function(){_0x4809b7['status'](0xcc)[_0x3ef9('0x17')]();});}};}function handleEntityNotFound(_0x2a83ab,_0x109847){return function(_0x38fe29){if(!_0x38fe29){_0x2a83ab[_0x3ef9('0x27')](0x194);}return _0x38fe29;};}function handleError(_0x454347,_0x4eff40){_0x4eff40=_0x4eff40||0x1f4;return function(_0x55704c){logger[_0x3ef9('0x28')](_0x55704c['stack']);if(_0x55704c[_0x3ef9('0x29')]){delete _0x55704c['name'];}_0x454347['status'](_0x4eff40)['send'](_0x55704c);};}exports['index']=function(_0x18e131,_0x5bcc79){var _0x298dc4={},_0x2006a7={},_0x1c49bc={'count':0x0,'rows':[]};var _0x314420=_[_0x3ef9('0x2a')](db[_0x3ef9('0x2b')][_0x3ef9('0x2c')],function(_0x1f6cfd){return{'name':_0x1f6cfd['fieldName'],'type':_0x1f6cfd[_0x3ef9('0x2d')][_0x3ef9('0x2e')]};});_0x2006a7[_0x3ef9('0x2f')]=_[_0x3ef9('0x2a')](_0x314420,_0x3ef9('0x29'));_0x2006a7['query']=_[_0x3ef9('0x30')](_0x18e131['query']);_0x2006a7[_0x3ef9('0x31')]=_[_0x3ef9('0x32')](_0x2006a7[_0x3ef9('0x2f')],_0x2006a7[_0x3ef9('0x33')]);_0x298dc4[_0x3ef9('0x34')]=_['intersection'](_0x2006a7[_0x3ef9('0x2f')],qs[_0x3ef9('0x35')](_0x18e131[_0x3ef9('0x33')][_0x3ef9('0x35')]));_0x298dc4[_0x3ef9('0x34')]=_0x298dc4[_0x3ef9('0x34')][_0x3ef9('0x36')]?_0x298dc4[_0x3ef9('0x34')]:_0x2006a7[_0x3ef9('0x2f')];if(!_0x18e131[_0x3ef9('0x33')][_0x3ef9('0x37')]('nolimit')){_0x298dc4['limit']=qs[_0x3ef9('0x1a')](_0x18e131[_0x3ef9('0x33')][_0x3ef9('0x1a')]);_0x298dc4['offset']=qs[_0x3ef9('0x19')](_0x18e131[_0x3ef9('0x33')][_0x3ef9('0x19')]);}_0x298dc4[_0x3ef9('0x38')]=qs[_0x3ef9('0x39')](_0x18e131['query'][_0x3ef9('0x39')]);_0x298dc4[_0x3ef9('0x3a')]=qs[_0x3ef9('0x31')](_['pick'](_0x18e131[_0x3ef9('0x33')],_0x2006a7[_0x3ef9('0x31')]),_0x314420);if(_0x18e131[_0x3ef9('0x33')][_0x3ef9('0x3b')]){_0x298dc4[_0x3ef9('0x3a')]=_['merge'](_0x298dc4['where'],{'$or':[{'key':{'$like':'%'+_0x18e131['query'][_0x3ef9('0x3b')]+'%'}},{'value':{'$like':'%'+_0x18e131[_0x3ef9('0x33')]['filter']+'%'}}]});}_0x298dc4=_[_0x3ef9('0x3c')]({},_0x298dc4,_0x18e131[_0x3ef9('0x3d')]);var _0x15d1db={'where':_0x298dc4[_0x3ef9('0x3a')]};return db['CannedAnswer'][_0x3ef9('0x1c')](_0x15d1db)[_0x3ef9('0x26')](function(_0x31b089){_0x1c49bc[_0x3ef9('0x1c')]=_0x31b089;if(_0x18e131[_0x3ef9('0x33')]['includeAll']){_0x298dc4[_0x3ef9('0x3e')]=[{'all':!![]}];}return db[_0x3ef9('0x2b')][_0x3ef9('0x3f')](_0x298dc4);})[_0x3ef9('0x26')](function(_0x316a31){_0x1c49bc[_0x3ef9('0x40')]=_0x316a31;return _0x1c49bc;})[_0x3ef9('0x26')](respondWithFilteredResult(_0x5bcc79,_0x298dc4))[_0x3ef9('0x41')](handleError(_0x5bcc79,null));};exports[_0x3ef9('0x42')]=function(_0x47f118,_0x237779){var _0xe72de8={'raw':!![],'where':{'id':_0x47f118['params']['id']}},_0xc8a4c1={};_0xc8a4c1[_0x3ef9('0x2f')]=_['keys'](db[_0x3ef9('0x2b')][_0x3ef9('0x2c')]);_0xc8a4c1[_0x3ef9('0x33')]=_[_0x3ef9('0x30')](_0x47f118[_0x3ef9('0x33')]);_0xc8a4c1[_0x3ef9('0x31')]=_[_0x3ef9('0x32')](_0xc8a4c1[_0x3ef9('0x2f')],_0xc8a4c1['query']);_0xe72de8[_0x3ef9('0x34')]=_[_0x3ef9('0x32')](_0xc8a4c1[_0x3ef9('0x2f')],qs['fields'](_0x47f118[_0x3ef9('0x33')][_0x3ef9('0x35')]));_0xe72de8[_0x3ef9('0x34')]=_0xe72de8[_0x3ef9('0x34')][_0x3ef9('0x36')]?_0xe72de8[_0x3ef9('0x34')]:_0xc8a4c1[_0x3ef9('0x2f')];if(_0x47f118[_0x3ef9('0x33')]['includeAll']){_0xe72de8['include']=[{'all':!![]}];}_0xe72de8=_[_0x3ef9('0x3c')]({},_0xe72de8,_0x47f118[_0x3ef9('0x3d')]);return db[_0x3ef9('0x2b')][_0x3ef9('0x43')](_0xe72de8)['then'](handleEntityNotFound(_0x237779,null))['then'](respondWithResult(_0x237779,null))['catch'](handleError(_0x237779,null));};exports[_0x3ef9('0x22')]=function(_0x54208d,_0x1b841d){if(_0x54208d[_0x3ef9('0x44')]['id']){delete _0x54208d[_0x3ef9('0x44')]['id'];}return db['CannedAnswer'][_0x3ef9('0x43')]({'where':{'id':_0x54208d[_0x3ef9('0x45')]['id']}})[_0x3ef9('0x26')](handleEntityNotFound(_0x1b841d,null))[_0x3ef9('0x26')](saveUpdates(_0x54208d[_0x3ef9('0x44')],null))['then'](respondWithResult(_0x1b841d,null))['catch'](handleError(_0x1b841d,null));};exports[_0x3ef9('0x23')]=function(_0x443e1b,_0x1aa57d){return db['CannedAnswer'][_0x3ef9('0x43')]({'where':{'id':_0x443e1b[_0x3ef9('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aa57d,null))['then'](removeEntity(_0x1aa57d,null))[_0x3ef9('0x41')](handleError(_0x1aa57d,null));};exports['create']=function(_0x1182ce,_0x124de9){var _0x3b0f0f={'key':_0x1182ce['body']['key']};if(_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x46')]){_0x3b0f0f[_0x3ef9('0x46')]=_0x1182ce[_0x3ef9('0x44')]['MailAccountId'];}else if(_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x47')]){_0x3b0f0f[_0x3ef9('0x47')]=_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x47')];}else if(_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x48')]){_0x3b0f0f[_0x3ef9('0x48')]=_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x48')];}else if(_0x1182ce['body']['ChatWebsiteId']){_0x3b0f0f[_0x3ef9('0x49')]=_0x1182ce[_0x3ef9('0x44')][_0x3ef9('0x49')];}return db[_0x3ef9('0x2b')]['find']({'where':_0x3b0f0f})[_0x3ef9('0x26')](function(_0x537adf){if(_0x537adf){throw new db[(_0x3ef9('0x4a'))][(_0x3ef9('0x4b'))](_0x3ef9('0x4c'));}return db[_0x3ef9('0x2b')]['create'](_0x1182ce[_0x3ef9('0x44')]);})[_0x3ef9('0x26')](function(_0x277c65){var _0x374b36=_0x1182ce['user']['get']({'plain':!![]});if(!_0x374b36)throw new Error(_0x3ef9('0x4d'));if(_0x374b36['role']==='user'){var _0x57e9bc=_0x277c65[_0x3ef9('0x24')]({'plain':!![]});return db[_0x3ef9('0x4e')]['find']({'where':{'name':_0x3ef9('0x4f'),'userProfileId':_0x374b36[_0x3ef9('0x50')]},'raw':!![]})[_0x3ef9('0x26')](function(_0x3ad957){if(_0x3ad957&&_0x3ad957['autoAssociation']===0x0){return db[_0x3ef9('0x25')][_0x3ef9('0x51')]({'name':_0x57e9bc[_0x3ef9('0x29')],'resourceId':_0x57e9bc['id'],'type':_0x3ad957['name'],'sectionId':_0x3ad957['id']},{})['then'](function(){return _0x277c65;});}else{return _0x277c65;}})[_0x3ef9('0x41')](function(_0x5963b7){logger[_0x3ef9('0x28')](_0x3ef9('0x52'),_0x5963b7);throw _0x5963b7;});}return _0x277c65;})[_0x3ef9('0x26')](respondWithResult(_0x124de9,0xc9))[_0x3ef9('0x41')](handleError(_0x124de9,null));}; \ No newline at end of file +var _0x9390=['status','offset','undefined','limit','count','set','json','apply','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','includeAll','include','findAll','rows','show','params','CannedAnswer','options','catch','update','body','find','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','rimraf','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x264716,_0x19baf0){var _0x2679b8=function(_0x13709c){while(--_0x13709c){_0x264716['push'](_0x264716['shift']());}};_0x2679b8(++_0x19baf0);}(_0x9390,0x133));var _0x0939=function(_0x18803b,_0x105b6c){_0x18803b=_0x18803b-0x0;var _0x454739=_0x9390[_0x18803b];return _0x454739;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0939('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0939('0x1'));var moment=require('moment');var BPromise=require(_0x0939('0x2'));var Mustache=require(_0x0939('0x3'));var util=require(_0x0939('0x4'));var path=require('path');var sox=require(_0x0939('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0939('0x6'));var _=require(_0x0939('0x7'));var squel=require(_0x0939('0x8'));var crypto=require(_0x0939('0x9'));var jsforce=require(_0x0939('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0939('0xb'));var Papa=require(_0x0939('0xc'));var Redis=require(_0x0939('0xd'));var authService=require(_0x0939('0xe'));var qs=require(_0x0939('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0939('0x10'));var utils=require(_0x0939('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0939('0x12'))['db'];function respondWithStatusCode(_0x3f875a,_0x408c0a){_0x408c0a=_0x408c0a||0xcc;return function(_0x203c7c){if(_0x203c7c){return _0x3f875a[_0x0939('0x13')](_0x408c0a);}return _0x3f875a['status'](_0x408c0a)[_0x0939('0x14')]();};}function respondWithResult(_0x5f004a,_0x36f2ee){_0x36f2ee=_0x36f2ee||0xc8;return function(_0x4c9246){if(_0x4c9246){return _0x5f004a[_0x0939('0x15')](_0x36f2ee)['json'](_0x4c9246);}};}function respondWithFilteredResult(_0x18a8df,_0x2fc5a6){return function(_0x4ddce7){if(_0x4ddce7){var _0x261aeb=typeof _0x2fc5a6[_0x0939('0x16')]===_0x0939('0x17')&&typeof _0x2fc5a6[_0x0939('0x18')]===_0x0939('0x17');var _0x29354e=_0x4ddce7['count'];var _0x59ddf7=_0x261aeb?0x0:_0x2fc5a6[_0x0939('0x16')];var _0x39e9c5=_0x261aeb?_0x4ddce7[_0x0939('0x19')]:_0x2fc5a6[_0x0939('0x16')]+_0x2fc5a6[_0x0939('0x18')];var _0x4147d9;if(_0x39e9c5>=_0x29354e){_0x39e9c5=_0x29354e;_0x4147d9=0xc8;}else{_0x4147d9=0xce;}_0x18a8df[_0x0939('0x15')](_0x4147d9);return _0x18a8df[_0x0939('0x1a')]('Content-Range',_0x59ddf7+'-'+_0x39e9c5+'/'+_0x29354e)[_0x0939('0x1b')](_0x4ddce7);}return null;};}function patchUpdates(_0x4aaf45){return function(_0x5e6863){try{jsonpatch[_0x0939('0x1c')](_0x5e6863,_0x4aaf45,!![]);}catch(_0x369111){return BPromise['reject'](_0x369111);}return _0x5e6863['save']();};}function saveUpdates(_0x255fd2,_0x35c61f){return function(_0x41b7d3){if(_0x41b7d3){return _0x41b7d3['update'](_0x255fd2)[_0x0939('0x1d')](function(_0x1be11e){return _0x1be11e;});}return null;};}function removeEntity(_0x3d9edd,_0x58e87a){return function(_0x39c9fc){if(_0x39c9fc){return _0x39c9fc[_0x0939('0x1e')]()[_0x0939('0x1d')](function(){var _0x411fd4=_0x39c9fc[_0x0939('0x1f')]({'plain':!![]});var _0xcd2fe6=_0x0939('0x20');return db[_0x0939('0x21')][_0x0939('0x1e')]({'where':{'type':_0xcd2fe6,'resourceId':_0x411fd4['id']}})['then'](function(){return _0x39c9fc;});})[_0x0939('0x1d')](function(){_0x3d9edd['status'](0xcc)[_0x0939('0x14')]();});}};}function handleEntityNotFound(_0x3e0761,_0x3e4ccc){return function(_0x5705f1){if(!_0x5705f1){_0x3e0761[_0x0939('0x13')](0x194);}return _0x5705f1;};}function handleError(_0x405dcb,_0x49be7b){_0x49be7b=_0x49be7b||0x1f4;return function(_0x269fd5){logger[_0x0939('0x22')](_0x269fd5[_0x0939('0x23')]);if(_0x269fd5[_0x0939('0x24')]){delete _0x269fd5[_0x0939('0x24')];}_0x405dcb[_0x0939('0x15')](_0x49be7b)[_0x0939('0x25')](_0x269fd5);};}exports[_0x0939('0x26')]=function(_0x3baa91,_0x3127ab){var _0x1994e1={},_0xe3eac0={},_0x374dfc={'count':0x0,'rows':[]};var _0x3afddb=_[_0x0939('0x27')](db['CannedAnswer']['rawAttributes'],function(_0x41b5be){return{'name':_0x41b5be[_0x0939('0x28')],'type':_0x41b5be[_0x0939('0x29')]['key']};});_0xe3eac0[_0x0939('0x2a')]=_[_0x0939('0x27')](_0x3afddb,_0x0939('0x24'));_0xe3eac0['query']=_[_0x0939('0x2b')](_0x3baa91[_0x0939('0x2c')]);_0xe3eac0['filters']=_[_0x0939('0x2d')](_0xe3eac0[_0x0939('0x2a')],_0xe3eac0['query']);_0x1994e1[_0x0939('0x2e')]=_['intersection'](_0xe3eac0['model'],qs['fields'](_0x3baa91[_0x0939('0x2c')][_0x0939('0x2f')]));_0x1994e1['attributes']=_0x1994e1[_0x0939('0x2e')][_0x0939('0x30')]?_0x1994e1[_0x0939('0x2e')]:_0xe3eac0[_0x0939('0x2a')];if(!_0x3baa91[_0x0939('0x2c')]['hasOwnProperty'](_0x0939('0x31'))){_0x1994e1[_0x0939('0x18')]=qs['limit'](_0x3baa91[_0x0939('0x2c')][_0x0939('0x18')]);_0x1994e1[_0x0939('0x16')]=qs['offset'](_0x3baa91[_0x0939('0x2c')][_0x0939('0x16')]);}_0x1994e1[_0x0939('0x32')]=qs[_0x0939('0x33')](_0x3baa91['query'][_0x0939('0x33')]);_0x1994e1['where']=qs[_0x0939('0x34')](_['pick'](_0x3baa91[_0x0939('0x2c')],_0xe3eac0[_0x0939('0x34')]),_0x3afddb);if(_0x3baa91[_0x0939('0x2c')][_0x0939('0x35')]){_0x1994e1[_0x0939('0x36')]=_[_0x0939('0x37')](_0x1994e1[_0x0939('0x36')],{'$or':[{'key':{'$like':'%'+_0x3baa91[_0x0939('0x2c')][_0x0939('0x35')]+'%'}},{'value':{'$like':'%'+_0x3baa91[_0x0939('0x2c')][_0x0939('0x35')]+'%'}}]});}_0x1994e1=_['merge']({},_0x1994e1,_0x3baa91['options']);var _0x18a173={'where':_0x1994e1[_0x0939('0x36')]};return db['CannedAnswer'][_0x0939('0x19')](_0x18a173)[_0x0939('0x1d')](function(_0x413368){_0x374dfc['count']=_0x413368;if(_0x3baa91[_0x0939('0x2c')][_0x0939('0x38')]){_0x1994e1[_0x0939('0x39')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0939('0x3a')](_0x1994e1);})[_0x0939('0x1d')](function(_0x436165){_0x374dfc[_0x0939('0x3b')]=_0x436165;return _0x374dfc;})[_0x0939('0x1d')](respondWithFilteredResult(_0x3127ab,_0x1994e1))['catch'](handleError(_0x3127ab,null));};exports[_0x0939('0x3c')]=function(_0x1756bd,_0x2eb35d){var _0x3a077c={'raw':!![],'where':{'id':_0x1756bd[_0x0939('0x3d')]['id']}},_0x4a3bd2={};_0x4a3bd2[_0x0939('0x2a')]=_[_0x0939('0x2b')](db[_0x0939('0x3e')]['rawAttributes']);_0x4a3bd2[_0x0939('0x2c')]=_[_0x0939('0x2b')](_0x1756bd[_0x0939('0x2c')]);_0x4a3bd2[_0x0939('0x34')]=_[_0x0939('0x2d')](_0x4a3bd2[_0x0939('0x2a')],_0x4a3bd2[_0x0939('0x2c')]);_0x3a077c[_0x0939('0x2e')]=_['intersection'](_0x4a3bd2['model'],qs[_0x0939('0x2f')](_0x1756bd['query'][_0x0939('0x2f')]));_0x3a077c[_0x0939('0x2e')]=_0x3a077c[_0x0939('0x2e')]['length']?_0x3a077c[_0x0939('0x2e')]:_0x4a3bd2[_0x0939('0x2a')];if(_0x1756bd[_0x0939('0x2c')][_0x0939('0x38')]){_0x3a077c['include']=[{'all':!![]}];}_0x3a077c=_['merge']({},_0x3a077c,_0x1756bd[_0x0939('0x3f')]);return db[_0x0939('0x3e')]['find'](_0x3a077c)['then'](handleEntityNotFound(_0x2eb35d,null))[_0x0939('0x1d')](respondWithResult(_0x2eb35d,null))[_0x0939('0x40')](handleError(_0x2eb35d,null));};exports[_0x0939('0x41')]=function(_0x84ad5a,_0x4b7476){if(_0x84ad5a['body']['id']){delete _0x84ad5a[_0x0939('0x42')]['id'];}return db['CannedAnswer'][_0x0939('0x43')]({'where':{'id':_0x84ad5a[_0x0939('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4b7476,null))['then'](saveUpdates(_0x84ad5a[_0x0939('0x42')],null))[_0x0939('0x1d')](respondWithResult(_0x4b7476,null))[_0x0939('0x40')](handleError(_0x4b7476,null));};exports[_0x0939('0x1e')]=function(_0x11936f,_0x53e65c){return db[_0x0939('0x3e')][_0x0939('0x43')]({'where':{'id':_0x11936f[_0x0939('0x3d')]['id']}})['then'](handleEntityNotFound(_0x53e65c,null))[_0x0939('0x1d')](removeEntity(_0x53e65c,null))[_0x0939('0x40')](handleError(_0x53e65c,null));};exports['create']=function(_0x51490b,_0x39da39){var _0x15ac9b={'key':_0x51490b[_0x0939('0x42')][_0x0939('0x44')]};if(_0x51490b[_0x0939('0x42')][_0x0939('0x45')]){_0x15ac9b[_0x0939('0x45')]=_0x51490b[_0x0939('0x42')]['MailAccountId'];}else if(_0x51490b['body'][_0x0939('0x46')]){_0x15ac9b['SmsAccountId']=_0x51490b[_0x0939('0x42')]['SmsAccountId'];}else if(_0x51490b['body'][_0x0939('0x47')]){_0x15ac9b[_0x0939('0x47')]=_0x51490b[_0x0939('0x42')][_0x0939('0x47')];}else if(_0x51490b[_0x0939('0x42')][_0x0939('0x48')]){_0x15ac9b[_0x0939('0x48')]=_0x51490b[_0x0939('0x42')][_0x0939('0x48')];}return db[_0x0939('0x3e')][_0x0939('0x43')]({'where':_0x15ac9b})[_0x0939('0x1d')](function(_0x1e8654){if(_0x1e8654){throw new db[(_0x0939('0x49'))][(_0x0939('0x4a'))](_0x0939('0x4b'));}return db[_0x0939('0x3e')][_0x0939('0x4c')](_0x51490b[_0x0939('0x42')]);})[_0x0939('0x1d')](function(_0x49a183){var _0x25a3ab=_0x51490b[_0x0939('0x4d')][_0x0939('0x1f')]({'plain':!![]});if(!_0x25a3ab)throw new Error(_0x0939('0x4e'));if(_0x25a3ab['role']===_0x0939('0x4d')){var _0x18917c=_0x49a183[_0x0939('0x1f')]({'plain':!![]});return db[_0x0939('0x4f')][_0x0939('0x43')]({'where':{'name':_0x0939('0x20'),'userProfileId':_0x25a3ab[_0x0939('0x50')]},'raw':!![]})[_0x0939('0x1d')](function(_0x2ee266){if(_0x2ee266&&_0x2ee266[_0x0939('0x51')]===0x0){return db[_0x0939('0x21')][_0x0939('0x4c')]({'name':_0x18917c[_0x0939('0x24')],'resourceId':_0x18917c['id'],'type':_0x2ee266[_0x0939('0x24')],'sectionId':_0x2ee266['id']},{})['then'](function(){return _0x49a183;});}else{return _0x49a183;}})[_0x0939('0x40')](function(_0x2e2ecd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e2ecd);throw _0x2e2ecd;});}return _0x49a183;})['then'](respondWithResult(_0x39da39,0xc9))['catch'](handleError(_0x39da39,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8d90e74..05d5315 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 _0x86e5=['request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment'];(function(_0x5eced9,_0x12674e){var _0x339702=function(_0xaefb8d){while(--_0xaefb8d){_0x5eced9['push'](_0x5eced9['shift']());}};_0x339702(++_0x12674e);}(_0x86e5,0x134));var _0x586e=function(_0x54d0b8,_0x31b232){_0x54d0b8=_0x54d0b8-0x0;var _0x502c5c=_0x86e5[_0x54d0b8];return _0x502c5c;};'use strict';var _=require('lodash');var util=require(_0x586e('0x0'));var logger=require(_0x586e('0x1'))(_0x586e('0x2'));var moment=require(_0x586e('0x3'));var BPromise=require('bluebird');var rp=require(_0x586e('0x4'));var fs=require('fs');var path=require(_0x586e('0x5'));var rimraf=require(_0x586e('0x6'));var config=require(_0x586e('0x7'));var attributes=require(_0x586e('0x8'));module[_0x586e('0x9')]=function(_0x669d60,_0x54bd92){return _0x669d60['define'](_0x586e('0xa'),attributes,{'tableName':_0x586e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x586e('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x35ea=['api','moment','bluebird','path','rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1b862a,_0x3e03af){var _0x1725fb=function(_0x599ab6){while(--_0x599ab6){_0x1b862a['push'](_0x1b862a['shift']());}};_0x1725fb(++_0x3e03af);}(_0x35ea,0x185));var _0xa35e=function(_0xa25342,_0x24522b){_0xa25342=_0xa25342-0x0;var _0x52be43=_0x35ea[_0xa25342];return _0x52be43;};'use strict';var _=require(_0xa35e('0x0'));var util=require(_0xa35e('0x1'));var logger=require(_0xa35e('0x2'))(_0xa35e('0x3'));var moment=require(_0xa35e('0x4'));var BPromise=require(_0xa35e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa35e('0x6'));var rimraf=require(_0xa35e('0x7'));var config=require('../../config/environment');var attributes=require(_0xa35e('0x8'));module[_0xa35e('0x9')]=function(_0x2ad302,_0x48acae){return _0x2ad302[_0xa35e('0xa')](_0xa35e('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa35e('0xc'),'collate':_0xa35e('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 7cbb628..8564753 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(_0x586cdb,_0x2461b2){var _0x11bedd=function(_0x35ce20){while(--_0x35ce20){_0x586cdb['push'](_0x586cdb['shift']());}};_0x11bedd(++_0x2461b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x280589,_0x88a39b){var _0x5da33c=function(_0x809069){while(--_0x809069){_0x280589['push'](_0x280589['shift']());}};_0x5da33c(++_0x88a39b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 370728a..7589e7a 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 _0xdf1f=['put','/:id','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','post','create'];(function(_0x3aa160,_0x3dcb73){var _0x1df08b=function(_0x4cd421){while(--_0x4cd421){_0x3aa160['push'](_0x3aa160['shift']());}};_0x1df08b(++_0x3dcb73);}(_0xdf1f,0x9d));var _0xfdf1=function(_0x584e52,_0x5443dc){_0x584e52=_0x584e52-0x0;var _0x5cf710=_0xdf1f[_0x584e52];return _0x5cf710;};'use strict';var multer=require('multer');var util=require(_0xfdf1('0x0'));var path=require(_0xfdf1('0x1'));var timeout=require(_0xfdf1('0x2'));var express=require('express');var router=express[_0xfdf1('0x3')]();var fs_extra=require(_0xfdf1('0x4'));var auth=require(_0xfdf1('0x5'));var interaction=require(_0xfdf1('0x6'));var config=require(_0xfdf1('0x7'));var controller=require(_0xfdf1('0x8'));router[_0xfdf1('0x9')]('/',auth[_0xfdf1('0xa')](),controller['index']);router[_0xfdf1('0x9')]('/:id',auth[_0xfdf1('0xa')](),controller['show']);router[_0xfdf1('0xb')]('/',auth[_0xfdf1('0xa')](),controller[_0xfdf1('0xc')]);router[_0xfdf1('0xd')](_0xfdf1('0xe'),auth[_0xfdf1('0xa')](),controller[_0xfdf1('0xf')]);router['delete']('/:id',auth[_0xfdf1('0xa')](),controller['destroy']);module[_0xfdf1('0x10')]=router; \ No newline at end of file +var _0x66ae=['fs-extra','../../components/interaction/service','./cannedAnswer.controller','isAuthenticated','get','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x5cea3c,_0x187f89){var _0x40aefe=function(_0xbab518){while(--_0xbab518){_0x5cea3c['push'](_0x5cea3c['shift']());}};_0x40aefe(++_0x187f89);}(_0x66ae,0x83));var _0xe66a=function(_0xdc6ffa,_0x5cb1d6){_0xdc6ffa=_0xdc6ffa-0x0;var _0x248293=_0x66ae[_0xdc6ffa];return _0x248293;};'use strict';var multer=require(_0xe66a('0x0'));var util=require('util');var path=require(_0xe66a('0x1'));var timeout=require(_0xe66a('0x2'));var express=require(_0xe66a('0x3'));var router=express[_0xe66a('0x4')]();var fs_extra=require(_0xe66a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe66a('0x6'));var config=require('../../config/environment');var controller=require(_0xe66a('0x7'));router['get']('/',auth[_0xe66a('0x8')](),controller['index']);router[_0xe66a('0x9')](_0xe66a('0xa'),auth[_0xe66a('0x8')](),controller[_0xe66a('0xb')]);router[_0xe66a('0xc')]('/',auth[_0xe66a('0x8')](),controller[_0xe66a('0xd')]);router['put']('/:id',auth[_0xe66a('0x8')](),controller[_0xe66a('0xe')]);router[_0xe66a('0xf')](_0xe66a('0xa'),auth[_0xe66a('0x8')](),controller['destroy']);module[_0xe66a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d17e2b5..43f492f 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 _0xe027=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe027,0xf9));var _0x7e02=function(_0x5908bb,_0x353a46){_0x5908bb=_0x5908bb-0x0;var _0x1e3662=_0xe027[_0x5908bb];return _0x1e3662;};'use strict';var Sequelize=require(_0x7e02('0x0'));module[_0x7e02('0x1')]={'calldate':{'type':Sequelize[_0x7e02('0x2')],'allowNull':![],'defaultValue':_0x7e02('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x7e02('0x4')]},'dst':{'type':Sequelize[_0x7e02('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7e02('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x7e02('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7e02('0x4')]},'amaflags':{'type':Sequelize[_0x7e02('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x7e02('0x4')]},'uniqueid':{'type':Sequelize[_0x7e02('0x4')]},'linkedid':{'type':Sequelize[_0x7e02('0x4')]},'sequence':{'type':Sequelize[_0x7e02('0x4')]},'peeraccount':{'type':Sequelize[_0x7e02('0x4')]},'type':{'type':Sequelize[_0x7e02('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde46=['sequelize','DATE','STRING','INTEGER'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xde46,0x174));var _0x6de4=function(_0x4d8368,_0x2abc37){_0x4d8368=_0x4d8368-0x0;var _0x4e809d=_0xde46[_0x4d8368];return _0x4e809d;};'use strict';var Sequelize=require(_0x6de4('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x6de4('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x6de4('0x2')]},'src':{'type':Sequelize[_0x6de4('0x2')]},'dst':{'type':Sequelize[_0x6de4('0x2')]},'dcontext':{'type':Sequelize[_0x6de4('0x2')]},'channel':{'type':Sequelize[_0x6de4('0x2')]},'dstchannel':{'type':Sequelize[_0x6de4('0x2')]},'lastapp':{'type':Sequelize[_0x6de4('0x2')]},'lastdata':{'type':Sequelize[_0x6de4('0x2')]},'duration':{'type':Sequelize[_0x6de4('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6de4('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6de4('0x2')]},'amaflags':{'type':Sequelize[_0x6de4('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6de4('0x2')]},'userfield':{'type':Sequelize[_0x6de4('0x2')]},'uniqueid':{'type':Sequelize[_0x6de4('0x2')]},'linkedid':{'type':Sequelize[_0x6de4('0x2')]},'sequence':{'type':Sequelize[_0x6de4('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6de4('0x2')]},'tag':{'type':Sequelize[_0x6de4('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 9fe9818..66e6c2d 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 _0xa0a1=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','count','set','apply','reject','then','destroy','end','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','keys','options','create','body','update','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x177879,_0x1e4e4f){var _0x33b9b0=function(_0x4e28b3){while(--_0x4e28b3){_0x177879['push'](_0x177879['shift']());}};_0x33b9b0(++_0x1e4e4f);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x1ae9a3,_0x5aff0a){_0x1ae9a3=_0x1ae9a3-0x0;var _0x52c623=_0xa0a1[_0x1ae9a3];return _0x52c623;};'use strict';var emlformat=require(_0x1a0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1a0a('0x1'));var jsonpatch=require(_0x1a0a('0x2'));var rp=require(_0x1a0a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1a0a('0x4'));var util=require(_0x1a0a('0x5'));var path=require('path');var sox=require(_0x1a0a('0x6'));var csv=require(_0x1a0a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a0a('0x8'));var _=require(_0x1a0a('0x9'));var squel=require(_0x1a0a('0xa'));var crypto=require(_0x1a0a('0xb'));var jsforce=require(_0x1a0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1a0a('0x7'));var querystring=require(_0x1a0a('0xd'));var Papa=require(_0x1a0a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1a0a('0xf'));var hardwareService=require(_0x1a0a('0x10'));var logger=require(_0x1a0a('0x11'))('api');var utils=require(_0x1a0a('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1a0a('0x13'));var db=require(_0x1a0a('0x14'))['db'];function respondWithStatusCode(_0x461b36,_0x1877bf){_0x1877bf=_0x1877bf||0xcc;return function(_0x289046){if(_0x289046){return _0x461b36[_0x1a0a('0x15')](_0x1877bf);}return _0x461b36[_0x1a0a('0x16')](_0x1877bf)['end']();};}function respondWithResult(_0x88d191,_0x3b0b2d){_0x3b0b2d=_0x3b0b2d||0xc8;return function(_0x3c531c){if(_0x3c531c){return _0x88d191[_0x1a0a('0x16')](_0x3b0b2d)[_0x1a0a('0x17')](_0x3c531c);}};}function respondWithFilteredResult(_0x4c8080,_0x16b8c9){return function(_0x80627b){if(_0x80627b){var _0x157b74=typeof _0x16b8c9['offset']===_0x1a0a('0x18')&&typeof _0x16b8c9['limit']===_0x1a0a('0x18');var _0x57f65d=_0x80627b['count'];var _0x3a988c=_0x157b74?0x0:_0x16b8c9[_0x1a0a('0x19')];var _0x307fdc=_0x157b74?_0x80627b[_0x1a0a('0x1a')]:_0x16b8c9['offset']+_0x16b8c9['limit'];var _0x239065;if(_0x307fdc>=_0x57f65d){_0x307fdc=_0x57f65d;_0x239065=0xc8;}else{_0x239065=0xce;}_0x4c8080[_0x1a0a('0x16')](_0x239065);return _0x4c8080[_0x1a0a('0x1b')]('Content-Range',_0x3a988c+'-'+_0x307fdc+'/'+_0x57f65d)[_0x1a0a('0x17')](_0x80627b);}return null;};}function patchUpdates(_0x3547fe){return function(_0x5bb4bd){try{jsonpatch[_0x1a0a('0x1c')](_0x5bb4bd,_0x3547fe,!![]);}catch(_0x1ba27f){return BPromise[_0x1a0a('0x1d')](_0x1ba27f);}return _0x5bb4bd['save']();};}function saveUpdates(_0x159a2a,_0xc33284){return function(_0x1f4083){if(_0x1f4083){return _0x1f4083['update'](_0x159a2a)[_0x1a0a('0x1e')](function(_0x47ef88){return _0x47ef88;});}return null;};}function removeEntity(_0x28c094,_0x2d426d){return function(_0x2d7967){if(_0x2d7967){return _0x2d7967[_0x1a0a('0x1f')]()[_0x1a0a('0x1e')](function(){_0x28c094['status'](0xcc)[_0x1a0a('0x20')]();});}};}function handleEntityNotFound(_0x8e4151,_0x561407){return function(_0x4cf939){if(!_0x4cf939){_0x8e4151[_0x1a0a('0x15')](0x194);}return _0x4cf939;};}function handleError(_0x184de8,_0x3f61e4){_0x3f61e4=_0x3f61e4||0x1f4;return function(_0x365ab5){logger[_0x1a0a('0x21')](_0x365ab5[_0x1a0a('0x22')]);if(_0x365ab5[_0x1a0a('0x23')]){delete _0x365ab5[_0x1a0a('0x23')];}_0x184de8[_0x1a0a('0x16')](_0x3f61e4)[_0x1a0a('0x24')](_0x365ab5);};}exports[_0x1a0a('0x25')]=function(_0x35fd0a,_0x354d89){var _0x385f2b={},_0x396c01={},_0x3069ab={'count':0x0,'rows':[]};var _0x297b12=_['map'](db[_0x1a0a('0x26')][_0x1a0a('0x27')],function(_0x36ca44){return{'name':_0x36ca44[_0x1a0a('0x28')],'type':_0x36ca44[_0x1a0a('0x29')][_0x1a0a('0x2a')]};});_0x396c01[_0x1a0a('0x2b')]=_[_0x1a0a('0x2c')](_0x297b12,_0x1a0a('0x23'));_0x396c01[_0x1a0a('0x2d')]=_['keys'](_0x35fd0a[_0x1a0a('0x2d')]);_0x396c01[_0x1a0a('0x2e')]=_['intersection'](_0x396c01[_0x1a0a('0x2b')],_0x396c01['query']);_0x385f2b['attributes']=_[_0x1a0a('0x2f')](_0x396c01[_0x1a0a('0x2b')],qs['fields'](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x385f2b[_0x1a0a('0x31')]=_0x385f2b['attributes'][_0x1a0a('0x32')]?_0x385f2b[_0x1a0a('0x31')]:_0x396c01['model'];if(!_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x33')]('nolimit')){_0x385f2b[_0x1a0a('0x34')]=qs[_0x1a0a('0x34')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x34')]);_0x385f2b['offset']=qs[_0x1a0a('0x19')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x19')]);}_0x385f2b[_0x1a0a('0x35')]=qs[_0x1a0a('0x36')](_0x35fd0a[_0x1a0a('0x2d')][_0x1a0a('0x36')]);_0x385f2b[_0x1a0a('0x37')]=qs[_0x1a0a('0x2e')](_['pick'](_0x35fd0a['query'],_0x396c01['filters']),_0x297b12);if(_0x35fd0a['query'][_0x1a0a('0x38')]){_0x385f2b['where']=_[_0x1a0a('0x39')](_0x385f2b[_0x1a0a('0x37')],{'$or':_['map'](_0x297b12,function(_0x5f586c){if(_0x5f586c[_0x1a0a('0x29')]!==_0x1a0a('0x3a')){var _0x13042e={};_0x13042e[_0x5f586c[_0x1a0a('0x23')]]={'$like':'%'+_0x35fd0a['query'][_0x1a0a('0x38')]+'%'};return _0x13042e;}})});}_0x385f2b=_['merge']({},_0x385f2b,_0x35fd0a['options']);var _0x4852e8={'where':_0x385f2b[_0x1a0a('0x37')]};return db[_0x1a0a('0x26')]['count'](_0x4852e8)[_0x1a0a('0x1e')](function(_0x2dcda5){_0x3069ab['count']=_0x2dcda5;if(_0x35fd0a['query'][_0x1a0a('0x3b')]){_0x385f2b[_0x1a0a('0x3c')]=[{'all':!![]}];}return db['Cdr'][_0x1a0a('0x3d')](_0x385f2b);})[_0x1a0a('0x1e')](function(_0x56cfd6){_0x3069ab[_0x1a0a('0x3e')]=_0x56cfd6;return _0x3069ab;})['then'](respondWithFilteredResult(_0x354d89,_0x385f2b))[_0x1a0a('0x3f')](handleError(_0x354d89,null));};exports['show']=function(_0x2dfcfb,_0x7b6e14){var _0x3466f6={'raw':!![],'where':{'id':_0x2dfcfb['params']['id']}},_0x2a72b7={};_0x2a72b7[_0x1a0a('0x2b')]=_[_0x1a0a('0x40')](db[_0x1a0a('0x26')][_0x1a0a('0x27')]);_0x2a72b7['query']=_[_0x1a0a('0x40')](_0x2dfcfb[_0x1a0a('0x2d')]);_0x2a72b7['filters']=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],_0x2a72b7[_0x1a0a('0x2d')]);_0x3466f6[_0x1a0a('0x31')]=_[_0x1a0a('0x2f')](_0x2a72b7[_0x1a0a('0x2b')],qs[_0x1a0a('0x30')](_0x2dfcfb[_0x1a0a('0x2d')][_0x1a0a('0x30')]));_0x3466f6[_0x1a0a('0x31')]=_0x3466f6['attributes'][_0x1a0a('0x32')]?_0x3466f6[_0x1a0a('0x31')]:_0x2a72b7['model'];if(_0x2dfcfb['query']['includeAll']){_0x3466f6['include']=[{'all':!![]}];}_0x3466f6=_[_0x1a0a('0x39')]({},_0x3466f6,_0x2dfcfb[_0x1a0a('0x41')]);return db['Cdr']['find'](_0x3466f6)['then'](handleEntityNotFound(_0x7b6e14,null))[_0x1a0a('0x1e')](respondWithResult(_0x7b6e14,null))[_0x1a0a('0x3f')](handleError(_0x7b6e14,null));};exports[_0x1a0a('0x42')]=function(_0x2c58a9,_0x4678da){return db[_0x1a0a('0x26')][_0x1a0a('0x42')](_0x2c58a9[_0x1a0a('0x43')],{})[_0x1a0a('0x1e')](respondWithResult(_0x4678da,0xc9))[_0x1a0a('0x3f')](handleError(_0x4678da,null));};exports[_0x1a0a('0x44')]=function(_0x2bab64,_0x23a985){if(_0x2bab64['body']['id']){delete _0x2bab64[_0x1a0a('0x43')]['id'];}return db[_0x1a0a('0x26')][_0x1a0a('0x45')]({'where':{'id':_0x2bab64['params']['id']}})[_0x1a0a('0x1e')](handleEntityNotFound(_0x23a985,null))[_0x1a0a('0x1e')](saveUpdates(_0x2bab64['body'],null))[_0x1a0a('0x1e')](respondWithResult(_0x23a985,null))[_0x1a0a('0x3f')](handleError(_0x23a985,null));};exports['destroy']=function(_0x555b6d,_0x313e79){return db['Cdr']['find']({'where':{'id':_0x555b6d[_0x1a0a('0x46')]['id']}})['then'](handleEntityNotFound(_0x313e79,null))[_0x1a0a('0x1e')](removeEntity(_0x313e79,null))[_0x1a0a('0x3f')](handleError(_0x313e79,null));};exports[_0x1a0a('0x47')]=function(_0x3678c7,_0x22a0f9){return db[_0x1a0a('0x26')][_0x1a0a('0x47')]()[_0x1a0a('0x1e')](respondWithResult(_0x22a0f9,null))[_0x1a0a('0x3f')](handleError(_0x22a0f9,null));}; \ No newline at end of file +var _0x5ad3=['destroy','error','stack','name','index','map','rawAttributes','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','Cdr','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then'];(function(_0x27aad9,_0x30cc39){var _0xc1c222=function(_0x454391){while(--_0x454391){_0x27aad9['push'](_0x27aad9['shift']());}};_0xc1c222(++_0x30cc39);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x5cdacf,_0x7c82b1){_0x5cdacf=_0x5cdacf-0x0;var _0xa68a8b=_0x5ad3[_0x5cdacf];return _0xa68a8b;};'use strict';var emlformat=require(_0x35ad('0x0'));var rimraf=require(_0x35ad('0x1'));var zipdir=require(_0x35ad('0x2'));var jsonpatch=require(_0x35ad('0x3'));var rp=require('request-promise');var moment=require(_0x35ad('0x4'));var BPromise=require(_0x35ad('0x5'));var Mustache=require(_0x35ad('0x6'));var util=require(_0x35ad('0x7'));var path=require(_0x35ad('0x8'));var sox=require(_0x35ad('0x9'));var csv=require(_0x35ad('0xa'));var ejs=require(_0x35ad('0xb'));var fs=require('fs');var fs_extra=require(_0x35ad('0xc'));var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var licenseUtil=require(_0x35ad('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c4dd5,_0x33e2ec){_0x33e2ec=_0x33e2ec||0xcc;return function(_0x595fe8){if(_0x595fe8){return _0x3c4dd5['sendStatus'](_0x33e2ec);}return _0x3c4dd5[_0x35ad('0x18')](_0x33e2ec)[_0x35ad('0x19')]();};}function respondWithResult(_0x3cda5e,_0x4b7ad9){_0x4b7ad9=_0x4b7ad9||0xc8;return function(_0x3e2676){if(_0x3e2676){return _0x3cda5e[_0x35ad('0x18')](_0x4b7ad9)['json'](_0x3e2676);}};}function respondWithFilteredResult(_0x1494be,_0x4d5185){return function(_0x4e3cd8){if(_0x4e3cd8){var _0x3a981a=typeof _0x4d5185[_0x35ad('0x1a')]===_0x35ad('0x1b')&&typeof _0x4d5185['limit']===_0x35ad('0x1b');var _0x2f3f27=_0x4e3cd8[_0x35ad('0x1c')];var _0x3158a1=_0x3a981a?0x0:_0x4d5185[_0x35ad('0x1a')];var _0x418416=_0x3a981a?_0x4e3cd8['count']:_0x4d5185[_0x35ad('0x1a')]+_0x4d5185[_0x35ad('0x1d')];var _0x574557;if(_0x418416>=_0x2f3f27){_0x418416=_0x2f3f27;_0x574557=0xc8;}else{_0x574557=0xce;}_0x1494be['status'](_0x574557);return _0x1494be[_0x35ad('0x1e')](_0x35ad('0x1f'),_0x3158a1+'-'+_0x418416+'/'+_0x2f3f27)['json'](_0x4e3cd8);}return null;};}function patchUpdates(_0x21f611){return function(_0x32735e){try{jsonpatch['apply'](_0x32735e,_0x21f611,!![]);}catch(_0x37c03d){return BPromise[_0x35ad('0x20')](_0x37c03d);}return _0x32735e[_0x35ad('0x21')]();};}function saveUpdates(_0x30542c,_0x1be6d2){return function(_0x43a6a8){if(_0x43a6a8){return _0x43a6a8[_0x35ad('0x22')](_0x30542c)[_0x35ad('0x23')](function(_0x2fb296){return _0x2fb296;});}return null;};}function removeEntity(_0xebc6c5,_0x4c5740){return function(_0x1cb9da){if(_0x1cb9da){return _0x1cb9da[_0x35ad('0x24')]()['then'](function(){_0xebc6c5[_0x35ad('0x18')](0xcc)[_0x35ad('0x19')]();});}};}function handleEntityNotFound(_0xa3cb9f,_0xfc80ac){return function(_0x368468){if(!_0x368468){_0xa3cb9f['sendStatus'](0x194);}return _0x368468;};}function handleError(_0x37e9bd,_0x226167){_0x226167=_0x226167||0x1f4;return function(_0x3dc3c4){logger[_0x35ad('0x25')](_0x3dc3c4[_0x35ad('0x26')]);if(_0x3dc3c4[_0x35ad('0x27')]){delete _0x3dc3c4[_0x35ad('0x27')];}_0x37e9bd[_0x35ad('0x18')](_0x226167)['send'](_0x3dc3c4);};}exports[_0x35ad('0x28')]=function(_0x11da54,_0x2f8b3){var _0x34b8b9={},_0x2c82f1={},_0x481803={'count':0x0,'rows':[]};var _0x571ad6=_[_0x35ad('0x29')](db['Cdr'][_0x35ad('0x2a')],function(_0x4ccaea){return{'name':_0x4ccaea['fieldName'],'type':_0x4ccaea['type']['key']};});_0x2c82f1[_0x35ad('0x2b')]=_['map'](_0x571ad6,'name');_0x2c82f1[_0x35ad('0x2c')]=_['keys'](_0x11da54[_0x35ad('0x2c')]);_0x2c82f1['filters']=_[_0x35ad('0x2d')](_0x2c82f1['model'],_0x2c82f1[_0x35ad('0x2c')]);_0x34b8b9['attributes']=_[_0x35ad('0x2d')](_0x2c82f1[_0x35ad('0x2b')],qs[_0x35ad('0x2e')](_0x11da54['query'][_0x35ad('0x2e')]));_0x34b8b9[_0x35ad('0x2f')]=_0x34b8b9[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x34b8b9[_0x35ad('0x2f')]:_0x2c82f1['model'];if(!_0x11da54['query'][_0x35ad('0x31')](_0x35ad('0x32'))){_0x34b8b9[_0x35ad('0x1d')]=qs[_0x35ad('0x1d')](_0x11da54['query'][_0x35ad('0x1d')]);_0x34b8b9[_0x35ad('0x1a')]=qs[_0x35ad('0x1a')](_0x11da54[_0x35ad('0x2c')][_0x35ad('0x1a')]);}_0x34b8b9[_0x35ad('0x33')]=qs['sort'](_0x11da54['query'][_0x35ad('0x34')]);_0x34b8b9[_0x35ad('0x35')]=qs[_0x35ad('0x36')](_[_0x35ad('0x37')](_0x11da54[_0x35ad('0x2c')],_0x2c82f1[_0x35ad('0x36')]),_0x571ad6);if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]){_0x34b8b9[_0x35ad('0x35')]=_['merge'](_0x34b8b9[_0x35ad('0x35')],{'$or':_['map'](_0x571ad6,function(_0x25e63e){if(_0x25e63e[_0x35ad('0x39')]!==_0x35ad('0x3a')){var _0x38d1c9={};_0x38d1c9[_0x25e63e[_0x35ad('0x27')]]={'$like':'%'+_0x11da54[_0x35ad('0x2c')][_0x35ad('0x38')]+'%'};return _0x38d1c9;}})});}_0x34b8b9=_[_0x35ad('0x3b')]({},_0x34b8b9,_0x11da54[_0x35ad('0x3c')]);var _0x5dd327={'where':_0x34b8b9[_0x35ad('0x35')]};return db[_0x35ad('0x3d')][_0x35ad('0x1c')](_0x5dd327)['then'](function(_0x19d82d){_0x481803[_0x35ad('0x1c')]=_0x19d82d;if(_0x11da54[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x34b8b9[_0x35ad('0x3f')]=[{'all':!![]}];}return db[_0x35ad('0x3d')][_0x35ad('0x40')](_0x34b8b9);})[_0x35ad('0x23')](function(_0x11de09){_0x481803[_0x35ad('0x41')]=_0x11de09;return _0x481803;})[_0x35ad('0x23')](respondWithFilteredResult(_0x2f8b3,_0x34b8b9))['catch'](handleError(_0x2f8b3,null));};exports[_0x35ad('0x42')]=function(_0x4edc2b,_0x3de722){var _0x3b80c0={'raw':!![],'where':{'id':_0x4edc2b[_0x35ad('0x43')]['id']}},_0x3df623={};_0x3df623[_0x35ad('0x2b')]=_[_0x35ad('0x44')](db[_0x35ad('0x3d')][_0x35ad('0x2a')]);_0x3df623[_0x35ad('0x2c')]=_['keys'](_0x4edc2b[_0x35ad('0x2c')]);_0x3df623[_0x35ad('0x36')]=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],_0x3df623[_0x35ad('0x2c')]);_0x3b80c0['attributes']=_[_0x35ad('0x2d')](_0x3df623[_0x35ad('0x2b')],qs['fields'](_0x4edc2b['query'][_0x35ad('0x2e')]));_0x3b80c0[_0x35ad('0x2f')]=_0x3b80c0[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x3b80c0['attributes']:_0x3df623[_0x35ad('0x2b')];if(_0x4edc2b[_0x35ad('0x2c')][_0x35ad('0x3e')]){_0x3b80c0[_0x35ad('0x3f')]=[{'all':!![]}];}_0x3b80c0=_[_0x35ad('0x3b')]({},_0x3b80c0,_0x4edc2b[_0x35ad('0x3c')]);return db[_0x35ad('0x3d')]['find'](_0x3b80c0)[_0x35ad('0x23')](handleEntityNotFound(_0x3de722,null))[_0x35ad('0x23')](respondWithResult(_0x3de722,null))[_0x35ad('0x45')](handleError(_0x3de722,null));};exports['create']=function(_0x5e3f96,_0x5644c4){return db[_0x35ad('0x3d')][_0x35ad('0x46')](_0x5e3f96[_0x35ad('0x47')],{})[_0x35ad('0x23')](respondWithResult(_0x5644c4,0xc9))['catch'](handleError(_0x5644c4,null));};exports[_0x35ad('0x22')]=function(_0x46c462,_0x3583ca){if(_0x46c462[_0x35ad('0x47')]['id']){delete _0x46c462[_0x35ad('0x47')]['id'];}return db[_0x35ad('0x3d')]['find']({'where':{'id':_0x46c462['params']['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x3583ca,null))[_0x35ad('0x23')](saveUpdates(_0x46c462['body'],null))['then'](respondWithResult(_0x3583ca,null))[_0x35ad('0x45')](handleError(_0x3583ca,null));};exports[_0x35ad('0x24')]=function(_0x196ebd,_0x5c7dbd){return db['Cdr'][_0x35ad('0x48')]({'where':{'id':_0x196ebd[_0x35ad('0x43')]['id']}})[_0x35ad('0x23')](handleEntityNotFound(_0x5c7dbd,null))['then'](removeEntity(_0x5c7dbd,null))[_0x35ad('0x45')](handleError(_0x5c7dbd,null));};exports[_0x35ad('0x49')]=function(_0x34061c,_0x467887){return db[_0x35ad('0x3d')][_0x35ad('0x49')]()['then'](respondWithResult(_0x467887,null))[_0x35ad('0x45')](handleError(_0x467887,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ae8d46e..ddf81e5 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x16be99,_0x2a5e1f){var _0x45fbac=function(_0x5b79f3){while(--_0x5b79f3){_0x16be99['push'](_0x16be99['shift']());}};_0x45fbac(++_0x2a5e1f);}(_0x7a54,0x106));var _0x47a5=function(_0x42e881,_0x5b5d7b){_0x42e881=_0x42e881-0x0;var _0x7c9cc1=_0x7a54[_0x42e881];return _0x7c9cc1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4170ad,_0x1f0cbb){var _0x70f4ff=function(_0x788fa){while(--_0x788fa){_0x4170ad['push'](_0x4170ad['shift']());}};_0x70f4ff(++_0x1f0cbb);}(_0x7a54,0x106));var _0x47a5=function(_0x329675,_0x582af0){_0x329675=_0x329675-0x0;var _0x370349=_0x7a54[_0x329675];return _0x370349;};'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 4ea14de..5b8db9b 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 _0x9377=['request\x20sent','error','code','Cdr,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x2f9ba5,_0x155057){var _0x183c0a=function(_0x532c91){while(--_0x532c91){_0x2f9ba5['push'](_0x2f9ba5['shift']());}};_0x183c0a(++_0x155057);}(_0x9377,0x1a4));var _0x7937=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9377[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7937('0x0'));var moment=require(_0x7937('0x1'));var BPromise=require(_0x7937('0x2'));var rs=require(_0x7937('0x3'));var fs=require('fs');var Redis=require(_0x7937('0x4'));var db=require(_0x7937('0x5'))['db'];var utils=require(_0x7937('0x6'));var logger=require(_0x7937('0x7'))(_0x7937('0x8'));var config=require(_0x7937('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7937('0xa')][_0x7937('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x412982,_0x51ea67,_0x591608){return new BPromise(function(_0x3e442b,_0x260133){return client[_0x7937('0xc')](_0x412982,_0x591608)[_0x7937('0xd')](function(_0x22e0ed){logger[_0x7937('0xe')]('Cdr,\x20%s,\x20%s',_0x51ea67,'request\x20sent');logger[_0x7937('0xf')](_0x7937('0x10'),_0x51ea67,_0x7937('0x11'),JSON['stringify'](_0x22e0ed));if(_0x22e0ed['error']){if(_0x22e0ed[_0x7937('0x12')][_0x7937('0x13')]===0x1f4){logger[_0x7937('0x12')](_0x7937('0x14'),_0x51ea67,_0x22e0ed[_0x7937('0x12')]['message']);return _0x260133(_0x22e0ed[_0x7937('0x12')][_0x7937('0x15')]);}logger['error'](_0x7937('0x14'),_0x51ea67,_0x22e0ed[_0x7937('0x12')]['message']);return _0x3e442b(_0x22e0ed['error'][_0x7937('0x15')]);}else{logger[_0x7937('0xe')](_0x7937('0x14'),_0x51ea67,_0x7937('0x11'));_0x3e442b(_0x22e0ed[_0x7937('0x16')]['message']);}})['catch'](function(_0x1385f7){logger[_0x7937('0x12')](_0x7937('0x14'),_0x51ea67,_0x1385f7);_0x260133(_0x1385f7);});});} \ No newline at end of file +var _0x76ed=['client','request','then','info','request\x20sent','debug','stringify','error','code','Cdr,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../mysqldb','../../config/environment'];(function(_0x2c04d9,_0x59ec65){var _0x5ad09a=function(_0x5e2ce3){while(--_0x5e2ce3){_0x2c04d9['push'](_0x2c04d9['shift']());}};_0x5ad09a(++_0x59ec65);}(_0x76ed,0xb6));var _0xd76e=function(_0x583a5e,_0x55d131){_0x583a5e=_0x583a5e-0x0;var _0x23ef19=_0x76ed[_0x583a5e];return _0x23ef19;};'use strict';var _=require(_0xd76e('0x0'));var util=require(_0xd76e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd76e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd76e('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd76e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd76e('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cd30b,_0x4dccc4,_0x5126bc){return new BPromise(function(_0x50c310,_0x4168a6){return client[_0xd76e('0x6')](_0x4cd30b,_0x5126bc)[_0xd76e('0x7')](function(_0x3eb115){logger[_0xd76e('0x8')]('Cdr,\x20%s,\x20%s',_0x4dccc4,_0xd76e('0x9'));logger[_0xd76e('0xa')]('Cdr,\x20%s,\x20%s,\x20%s',_0x4dccc4,'request\x20sent',JSON[_0xd76e('0xb')](_0x3eb115));if(_0x3eb115[_0xd76e('0xc')]){if(_0x3eb115[_0xd76e('0xc')][_0xd76e('0xd')]===0x1f4){logger[_0xd76e('0xc')](_0xd76e('0xe'),_0x4dccc4,_0x3eb115['error'][_0xd76e('0xf')]);return _0x4168a6(_0x3eb115[_0xd76e('0xc')][_0xd76e('0xf')]);}logger[_0xd76e('0xc')]('Cdr,\x20%s,\x20%s',_0x4dccc4,_0x3eb115[_0xd76e('0xc')]['message']);return _0x50c310(_0x3eb115['error'][_0xd76e('0xf')]);}else{logger[_0xd76e('0x8')](_0xd76e('0xe'),_0x4dccc4,_0xd76e('0x9'));_0x50c310(_0x3eb115['result'][_0xd76e('0xf')]);}})[_0xd76e('0x10')](function(_0x4939bc){logger[_0xd76e('0xc')](_0xd76e('0xe'),_0x4dccc4,_0x4939bc);_0x4168a6(_0x4939bc);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 3b143a1..53db06c 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3584,_0x3e6ba4){var _0x555a56=function(_0x5d37d2){while(--_0x5d37d2){_0x3584['push'](_0x3584['shift']());}};_0x555a56(++_0x3e6ba4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x253dad,_0x3bfafa){var _0x6c42df=function(_0x32fd1c){while(--_0x32fd1c){_0x253dad['push'](_0x253dad['shift']());}};_0x6c42df(++_0x3bfafa);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ba30ed7..59a82c4 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 _0x28e1=['noop','TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x5be1c6,_0x482e6c){var _0x33999c=function(_0x3c79e8){while(--_0x3c79e8){_0x5be1c6['push'](_0x5be1c6['shift']());}};_0x33999c(++_0x482e6c);}(_0x28e1,0xcf));var _0x128e=function(_0x960b7c,_0x43b316){_0x960b7c=_0x960b7c-0x0;var _0x432036=_0x28e1[_0x960b7c];return _0x432036;};'use strict';var Sequelize=require(_0x128e('0x0'));module[_0x128e('0x1')]={'priority':{'type':Sequelize[_0x128e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x128e('0x3')},'appdata':{'type':Sequelize[_0x128e('0x4')]()},'description':{'type':Sequelize[_0x128e('0x5')]},'interval':{'type':Sequelize[_0x128e('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x20c7=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x20c7,0x18a));var _0x720c=function(_0x4abf9d,_0x2b7758){_0x4abf9d=_0x4abf9d-0x0;var _0x2e5c06=_0x20c7[_0x4abf9d];return _0x2e5c06;};'use strict';var Sequelize=require(_0x720c('0x0'));module[_0x720c('0x1')]={'priority':{'type':Sequelize[_0x720c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x720c('0x3')],'allowNull':![],'defaultValue':_0x720c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x720c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x720c('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 045f2a5..a4dcee6 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 _0x93ed=['then','destroy','end','stack','name','send','show','params','rawAttributes','query','keys','filters','intersection','model','fields','includeAll','include','options','catch','body','ChatApplication','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x21c5e5,_0x1b2164){var _0x1ec0ec=function(_0x5f2da5){while(--_0x5f2da5){_0x21c5e5['push'](_0x21c5e5['shift']());}};_0x1ec0ec(++_0x1b2164);}(_0x93ed,0xfe));var _0xd93e=function(_0x1790ae,_0x162478){_0x1790ae=_0x1790ae-0x0;var _0x326cce=_0x93ed[_0x1790ae];return _0x326cce;};'use strict';var emlformat=require(_0xd93e('0x0'));var rimraf=require(_0xd93e('0x1'));var zipdir=require(_0xd93e('0x2'));var jsonpatch=require(_0xd93e('0x3'));var rp=require(_0xd93e('0x4'));var moment=require('moment');var BPromise=require(_0xd93e('0x5'));var Mustache=require('mustache');var util=require(_0xd93e('0x6'));var path=require(_0xd93e('0x7'));var sox=require('sox');var csv=require(_0xd93e('0x8'));var ejs=require(_0xd93e('0x9'));var fs=require('fs');var fs_extra=require(_0xd93e('0xa'));var _=require(_0xd93e('0xb'));var squel=require(_0xd93e('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd93e('0xd'));var toCsv=require(_0xd93e('0x8'));var querystring=require(_0xd93e('0xe'));var Papa=require(_0xd93e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd93e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd93e('0x11'));var logger=require(_0xd93e('0x12'))(_0xd93e('0x13'));var utils=require(_0xd93e('0x14'));var config=require(_0xd93e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd93e('0x16'))['db'];function respondWithStatusCode(_0x256f8a,_0x444b08){_0x444b08=_0x444b08||0xcc;return function(_0x2e4284){if(_0x2e4284){return _0x256f8a[_0xd93e('0x17')](_0x444b08);}return _0x256f8a['status'](_0x444b08)['end']();};}function respondWithResult(_0x528e2d,_0x567589){_0x567589=_0x567589||0xc8;return function(_0x1e1ef4){if(_0x1e1ef4){return _0x528e2d[_0xd93e('0x18')](_0x567589)[_0xd93e('0x19')](_0x1e1ef4);}};}function respondWithFilteredResult(_0x4e1ce2,_0xc53b90){return function(_0x490bc0){if(_0x490bc0){var _0x1826b8=typeof _0xc53b90[_0xd93e('0x1a')]===_0xd93e('0x1b')&&typeof _0xc53b90[_0xd93e('0x1c')]===_0xd93e('0x1b');var _0x404d5c=_0x490bc0[_0xd93e('0x1d')];var _0x54b6a1=_0x1826b8?0x0:_0xc53b90['offset'];var _0x54d919=_0x1826b8?_0x490bc0[_0xd93e('0x1d')]:_0xc53b90[_0xd93e('0x1a')]+_0xc53b90[_0xd93e('0x1c')];var _0x5eeb97;if(_0x54d919>=_0x404d5c){_0x54d919=_0x404d5c;_0x5eeb97=0xc8;}else{_0x5eeb97=0xce;}_0x4e1ce2['status'](_0x5eeb97);return _0x4e1ce2[_0xd93e('0x1e')](_0xd93e('0x1f'),_0x54b6a1+'-'+_0x54d919+'/'+_0x404d5c)[_0xd93e('0x19')](_0x490bc0);}return null;};}function patchUpdates(_0x235687){return function(_0x5bc3f9){try{jsonpatch[_0xd93e('0x20')](_0x5bc3f9,_0x235687,!![]);}catch(_0x1db090){return BPromise[_0xd93e('0x21')](_0x1db090);}return _0x5bc3f9[_0xd93e('0x22')]();};}function saveUpdates(_0x25193b,_0x4909c1){return function(_0x52376d){if(_0x52376d){return _0x52376d[_0xd93e('0x23')](_0x25193b)[_0xd93e('0x24')](function(_0xd34caf){return _0xd34caf;});}return null;};}function removeEntity(_0xe5553f,_0xd74297){return function(_0x128e72){if(_0x128e72){return _0x128e72[_0xd93e('0x25')]()[_0xd93e('0x24')](function(){_0xe5553f[_0xd93e('0x18')](0xcc)[_0xd93e('0x26')]();});}};}function handleEntityNotFound(_0x2a9670,_0x538a3e){return function(_0xf6c667){if(!_0xf6c667){_0x2a9670['sendStatus'](0x194);}return _0xf6c667;};}function handleError(_0x4fd87e,_0x1b2f60){_0x1b2f60=_0x1b2f60||0x1f4;return function(_0x2175ad){logger['error'](_0x2175ad[_0xd93e('0x27')]);if(_0x2175ad[_0xd93e('0x28')]){delete _0x2175ad[_0xd93e('0x28')];}_0x4fd87e['status'](_0x1b2f60)[_0xd93e('0x29')](_0x2175ad);};}exports[_0xd93e('0x2a')]=function(_0x5a5f48,_0x2bff6e){var _0x131a9c={'raw':!![],'where':{'id':_0x5a5f48[_0xd93e('0x2b')]['id']}},_0x49dae={};_0x49dae['model']=_['keys'](db['ChatApplication'][_0xd93e('0x2c')]);_0x49dae[_0xd93e('0x2d')]=_[_0xd93e('0x2e')](_0x5a5f48[_0xd93e('0x2d')]);_0x49dae[_0xd93e('0x2f')]=_[_0xd93e('0x30')](_0x49dae['model'],_0x49dae[_0xd93e('0x2d')]);_0x131a9c['attributes']=_[_0xd93e('0x30')](_0x49dae[_0xd93e('0x31')],qs[_0xd93e('0x32')](_0x5a5f48[_0xd93e('0x2d')][_0xd93e('0x32')]));_0x131a9c['attributes']=_0x131a9c['attributes']['length']?_0x131a9c['attributes']:_0x49dae['model'];if(_0x5a5f48[_0xd93e('0x2d')][_0xd93e('0x33')]){_0x131a9c[_0xd93e('0x34')]=[{'all':!![]}];}_0x131a9c=_['merge']({},_0x131a9c,_0x5a5f48[_0xd93e('0x35')]);return db['ChatApplication']['find'](_0x131a9c)[_0xd93e('0x24')](handleEntityNotFound(_0x2bff6e,null))[_0xd93e('0x24')](respondWithResult(_0x2bff6e,null))[_0xd93e('0x36')](handleError(_0x2bff6e,null));};exports[_0xd93e('0x23')]=function(_0x5f30ec,_0x481921){if(_0x5f30ec[_0xd93e('0x37')]['id']){delete _0x5f30ec[_0xd93e('0x37')]['id'];}return db[_0xd93e('0x38')]['find']({'where':{'id':_0x5f30ec[_0xd93e('0x2b')]['id']}})[_0xd93e('0x24')](handleEntityNotFound(_0x481921,null))['then'](saveUpdates(_0x5f30ec['body'],null))['then'](respondWithResult(_0x481921,null))[_0xd93e('0x36')](handleError(_0x481921,null));};exports[_0xd93e('0x25')]=function(_0x1b2027,_0x4455dd){return db[_0xd93e('0x38')][_0xd93e('0x39')]({'where':{'id':_0x1b2027[_0xd93e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4455dd,null))[_0xd93e('0x24')](removeEntity(_0x4455dd,null))['catch'](handleError(_0x4455dd,null));}; \ No newline at end of file +var _0xb48d=['stack','name','model','keys','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error'];(function(_0x367db8,_0xd21da0){var _0x553f0b=function(_0x4acb7c){while(--_0x4acb7c){_0x367db8['push'](_0x367db8['shift']());}};_0x553f0b(++_0xd21da0);}(_0xb48d,0x194));var _0xdb48=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb48d[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require(_0xdb48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb48('0x2'));var moment=require(_0xdb48('0x3'));var BPromise=require(_0xdb48('0x4'));var Mustache=require(_0xdb48('0x5'));var util=require('util');var path=require(_0xdb48('0x6'));var sox=require('sox');var csv=require(_0xdb48('0x7'));var ejs=require(_0xdb48('0x8'));var fs=require('fs');var fs_extra=require(_0xdb48('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb48('0xa'));var jsforce=require(_0xdb48('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdb48('0x7'));var querystring=require(_0xdb48('0xc'));var Papa=require('papaparse');var Redis=require(_0xdb48('0xd'));var authService=require(_0xdb48('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb48('0xf'));var logger=require(_0xdb48('0x10'))(_0xdb48('0x11'));var utils=require('../../config/utils');var config=require(_0xdb48('0x12'));var licenseUtil=require(_0xdb48('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaa4906,_0x3cbfee){_0x3cbfee=_0x3cbfee||0xcc;return function(_0x41e006){if(_0x41e006){return _0xaa4906[_0xdb48('0x14')](_0x3cbfee);}return _0xaa4906[_0xdb48('0x15')](_0x3cbfee)[_0xdb48('0x16')]();};}function respondWithResult(_0x5ebbdd,_0x43df86){_0x43df86=_0x43df86||0xc8;return function(_0x142eaf){if(_0x142eaf){return _0x5ebbdd[_0xdb48('0x15')](_0x43df86)['json'](_0x142eaf);}};}function respondWithFilteredResult(_0x28412d,_0x518dac){return function(_0x453d6b){if(_0x453d6b){var _0x3180d7=typeof _0x518dac[_0xdb48('0x17')]===_0xdb48('0x18')&&typeof _0x518dac[_0xdb48('0x19')]==='undefined';var _0x488997=_0x453d6b[_0xdb48('0x1a')];var _0x38099a=_0x3180d7?0x0:_0x518dac['offset'];var _0x3f98b0=_0x3180d7?_0x453d6b[_0xdb48('0x1a')]:_0x518dac['offset']+_0x518dac['limit'];var _0x1432a9;if(_0x3f98b0>=_0x488997){_0x3f98b0=_0x488997;_0x1432a9=0xc8;}else{_0x1432a9=0xce;}_0x28412d[_0xdb48('0x15')](_0x1432a9);return _0x28412d[_0xdb48('0x1b')]('Content-Range',_0x38099a+'-'+_0x3f98b0+'/'+_0x488997)[_0xdb48('0x1c')](_0x453d6b);}return null;};}function patchUpdates(_0x3d1b69){return function(_0x58604e){try{jsonpatch[_0xdb48('0x1d')](_0x58604e,_0x3d1b69,!![]);}catch(_0x3fb75a){return BPromise[_0xdb48('0x1e')](_0x3fb75a);}return _0x58604e[_0xdb48('0x1f')]();};}function saveUpdates(_0x3921d8,_0x5e63b3){return function(_0x2746c4){if(_0x2746c4){return _0x2746c4[_0xdb48('0x20')](_0x3921d8)[_0xdb48('0x21')](function(_0x5a33a0){return _0x5a33a0;});}return null;};}function removeEntity(_0x5aedc1,_0x52c046){return function(_0x3ad23a){if(_0x3ad23a){return _0x3ad23a[_0xdb48('0x22')]()[_0xdb48('0x21')](function(){_0x5aedc1['status'](0xcc)[_0xdb48('0x16')]();});}};}function handleEntityNotFound(_0x4d29d1,_0x3b3344){return function(_0x3a5bdd){if(!_0x3a5bdd){_0x4d29d1[_0xdb48('0x14')](0x194);}return _0x3a5bdd;};}function handleError(_0x531a2a,_0x483940){_0x483940=_0x483940||0x1f4;return function(_0x139139){logger[_0xdb48('0x23')](_0x139139[_0xdb48('0x24')]);if(_0x139139['name']){delete _0x139139[_0xdb48('0x25')];}_0x531a2a[_0xdb48('0x15')](_0x483940)['send'](_0x139139);};}exports['show']=function(_0x31edb6,_0x2cdfa4){var _0x2adb1e={'raw':!![],'where':{'id':_0x31edb6['params']['id']}},_0x2f55c6={};_0x2f55c6[_0xdb48('0x26')]=_[_0xdb48('0x27')](db[_0xdb48('0x28')]['rawAttributes']);_0x2f55c6[_0xdb48('0x29')]=_[_0xdb48('0x27')](_0x31edb6[_0xdb48('0x29')]);_0x2f55c6[_0xdb48('0x2a')]=_[_0xdb48('0x2b')](_0x2f55c6[_0xdb48('0x26')],_0x2f55c6['query']);_0x2adb1e[_0xdb48('0x2c')]=_[_0xdb48('0x2b')](_0x2f55c6[_0xdb48('0x26')],qs[_0xdb48('0x2d')](_0x31edb6[_0xdb48('0x29')][_0xdb48('0x2d')]));_0x2adb1e['attributes']=_0x2adb1e['attributes'][_0xdb48('0x2e')]?_0x2adb1e[_0xdb48('0x2c')]:_0x2f55c6[_0xdb48('0x26')];if(_0x31edb6[_0xdb48('0x29')][_0xdb48('0x2f')]){_0x2adb1e[_0xdb48('0x30')]=[{'all':!![]}];}_0x2adb1e=_[_0xdb48('0x31')]({},_0x2adb1e,_0x31edb6[_0xdb48('0x32')]);return db[_0xdb48('0x28')]['find'](_0x2adb1e)[_0xdb48('0x21')](handleEntityNotFound(_0x2cdfa4,null))[_0xdb48('0x21')](respondWithResult(_0x2cdfa4,null))[_0xdb48('0x33')](handleError(_0x2cdfa4,null));};exports[_0xdb48('0x20')]=function(_0x4cddf2,_0x4d05d0){if(_0x4cddf2[_0xdb48('0x34')]['id']){delete _0x4cddf2[_0xdb48('0x34')]['id'];}return db[_0xdb48('0x28')][_0xdb48('0x35')]({'where':{'id':_0x4cddf2[_0xdb48('0x36')]['id']}})[_0xdb48('0x21')](handleEntityNotFound(_0x4d05d0,null))[_0xdb48('0x21')](saveUpdates(_0x4cddf2[_0xdb48('0x34')],null))['then'](respondWithResult(_0x4d05d0,null))['catch'](handleError(_0x4d05d0,null));};exports[_0xdb48('0x22')]=function(_0x484cb2,_0x17e3d9){return db[_0xdb48('0x28')][_0xdb48('0x35')]({'where':{'id':_0x484cb2[_0xdb48('0x36')]['id']}})[_0xdb48('0x21')](handleEntityNotFound(_0x17e3d9,null))[_0xdb48('0x21')](removeEntity(_0x17e3d9,null))[_0xdb48('0x33')](handleError(_0x17e3d9,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 56ae65e..bb8c867 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 _0x5f09=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x263965,_0x5e0cb8){var _0x41f0fe=function(_0x33acad){while(--_0x33acad){_0x263965['push'](_0x263965['shift']());}};_0x41f0fe(++_0x5e0cb8);}(_0x5f09,0x8b));var _0x95f0=function(_0x1ebeff,_0x47867f){_0x1ebeff=_0x1ebeff-0x0;var _0x1ce0e2=_0x5f09[_0x1ebeff];return _0x1ce0e2;};'use strict';var _=require('lodash');var util=require(_0x95f0('0x0'));var logger=require(_0x95f0('0x1'))('api');var moment=require(_0x95f0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95f0('0x3'));var config=require(_0x95f0('0x4'));var attributes=require(_0x95f0('0x5'));module[_0x95f0('0x6')]=function(_0x347a2c,_0x49dc79){return _0x347a2c[_0x95f0('0x7')](_0x95f0('0x8'),attributes,{'tableName':_0x95f0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x95f0('0xa'),'collate':_0x95f0('0xb')});}; \ No newline at end of file +var _0x1978=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x37158c,_0x2e978c){var _0x201e77=function(_0x2aae20){while(--_0x2aae20){_0x37158c['push'](_0x37158c['shift']());}};_0x201e77(++_0x2e978c);}(_0x1978,0x174));var _0x8197=function(_0x44e52d,_0x355690){_0x44e52d=_0x44e52d-0x0;var _0x4fe42a=_0x1978[_0x44e52d];return _0x4fe42a;};'use strict';var _=require('lodash');var util=require(_0x8197('0x0'));var logger=require(_0x8197('0x1'))(_0x8197('0x2'));var moment=require(_0x8197('0x3'));var BPromise=require(_0x8197('0x4'));var rp=require(_0x8197('0x5'));var fs=require('fs');var path=require(_0x8197('0x6'));var rimraf=require(_0x8197('0x7'));var config=require(_0x8197('0x8'));var attributes=require(_0x8197('0x9'));module['exports']=function(_0x215d3c,_0x1556ad){return _0x215d3c[_0x8197('0xa')](_0x8197('0xb'),attributes,{'tableName':_0x8197('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8197('0xd'),'collate':_0x8197('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5d2d059..0a96b39 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 _0xa13f=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x4ab59c,_0x41d925){var _0x4d44e3=function(_0x1c9ff3){while(--_0x1c9ff3){_0x4ab59c['push'](_0x4ab59c['shift']());}};_0x4d44e3(++_0x41d925);}(_0xa13f,0xa1));var _0xfa13=function(_0x50fafe,_0x40da76){_0x50fafe=_0x50fafe-0x0;var _0x298bed=_0xa13f[_0x50fafe];return _0x298bed;};'use strict';var _=require(_0xfa13('0x0'));var util=require(_0xfa13('0x1'));var moment=require(_0xfa13('0x2'));var BPromise=require(_0xfa13('0x3'));var rs=require(_0xfa13('0x4'));var fs=require('fs');var Redis=require(_0xfa13('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfa13('0x6'));var logger=require(_0xfa13('0x7'))(_0xfa13('0x8'));var config=require(_0xfa13('0x9'));var jayson=require(_0xfa13('0xa'));var client=jayson[_0xfa13('0xb')][_0xfa13('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd16027,_0x5f54e1,_0x4528cd){return new BPromise(function(_0x4b4c3a,_0x5562c3){return client[_0xfa13('0xd')](_0xd16027,_0x4528cd)[_0xfa13('0xe')](function(_0x15ade5){logger[_0xfa13('0xf')](_0xfa13('0x10'),_0x5f54e1,_0xfa13('0x11'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x5f54e1,'request\x20sent',JSON['stringify'](_0x15ade5));if(_0x15ade5['error']){if(_0x15ade5[_0xfa13('0x12')][_0xfa13('0x13')]===0x1f4){logger[_0xfa13('0x12')]('ChatApplication,\x20%s,\x20%s',_0x5f54e1,_0x15ade5[_0xfa13('0x12')]['message']);return _0x5562c3(_0x15ade5[_0xfa13('0x12')]['message']);}logger['error'](_0xfa13('0x10'),_0x5f54e1,_0x15ade5['error'][_0xfa13('0x14')]);return _0x4b4c3a(_0x15ade5[_0xfa13('0x12')][_0xfa13('0x14')]);}else{logger[_0xfa13('0xf')](_0xfa13('0x10'),_0x5f54e1,_0xfa13('0x11'));_0x4b4c3a(_0x15ade5[_0xfa13('0x15')][_0xfa13('0x14')]);}})[_0xfa13('0x16')](function(_0x19c93c){logger[_0xfa13('0x12')](_0xfa13('0x10'),_0x5f54e1,_0x19c93c);_0x5562c3(_0x19c93c);});});} \ No newline at end of file +var _0x3994=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x200604,_0x48466b){var _0x316602=function(_0xd6a712){while(--_0xd6a712){_0x200604['push'](_0x200604['shift']());}};_0x316602(++_0x48466b);}(_0x3994,0x7f));var _0x4399=function(_0x56afd9,_0x573845){_0x56afd9=_0x56afd9-0x0;var _0x443781=_0x3994[_0x56afd9];return _0x443781;};'use strict';var _=require(_0x4399('0x0'));var util=require(_0x4399('0x1'));var moment=require(_0x4399('0x2'));var BPromise=require(_0x4399('0x3'));var rs=require(_0x4399('0x4'));var fs=require('fs');var Redis=require(_0x4399('0x5'));var db=require(_0x4399('0x6'))['db'];var utils=require(_0x4399('0x7'));var logger=require(_0x4399('0x8'))(_0x4399('0x9'));var config=require(_0x4399('0xa'));var jayson=require(_0x4399('0xb'));var client=jayson[_0x4399('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59604f,_0x5d4b4d,_0x551f96){return new BPromise(function(_0x4c35ba,_0x2d9fd5){return client[_0x4399('0xd')](_0x59604f,_0x551f96)[_0x4399('0xe')](function(_0x46dbaf){logger[_0x4399('0xf')](_0x4399('0x10'),_0x5d4b4d,_0x4399('0x11'));logger['debug'](_0x4399('0x12'),_0x5d4b4d,_0x4399('0x11'),JSON[_0x4399('0x13')](_0x46dbaf));if(_0x46dbaf[_0x4399('0x14')]){if(_0x46dbaf[_0x4399('0x14')][_0x4399('0x15')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x5d4b4d,_0x46dbaf['error'][_0x4399('0x16')]);return _0x2d9fd5(_0x46dbaf[_0x4399('0x14')][_0x4399('0x16')]);}logger[_0x4399('0x14')](_0x4399('0x10'),_0x5d4b4d,_0x46dbaf[_0x4399('0x14')][_0x4399('0x16')]);return _0x4c35ba(_0x46dbaf[_0x4399('0x14')][_0x4399('0x16')]);}else{logger[_0x4399('0xf')](_0x4399('0x10'),_0x5d4b4d,_0x4399('0x11'));_0x4c35ba(_0x46dbaf[_0x4399('0x17')][_0x4399('0x16')]);}})[_0x4399('0x18')](function(_0x8efe5c){logger[_0x4399('0x14')](_0x4399('0x10'),_0x5d4b4d,_0x8efe5c);_0x2d9fd5(_0x8efe5c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 630a1f0..1d21e90 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 _0x46e5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','show','put','isAuthenticated','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x56eefb,_0x1a1c6d){var _0x13ed78=function(_0x18f89a){while(--_0x18f89a){_0x56eefb['push'](_0x56eefb['shift']());}};_0x13ed78(++_0x1a1c6d);}(_0x46e5,0x1c6));var _0x546e=function(_0x3c1e65,_0x4bb935){_0x3c1e65=_0x3c1e65-0x0;var _0x53f0ad=_0x46e5[_0x3c1e65];return _0x53f0ad;};'use strict';var multer=require('multer');var util=require(_0x546e('0x0'));var path=require(_0x546e('0x1'));var timeout=require(_0x546e('0x2'));var express=require(_0x546e('0x3'));var router=express[_0x546e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x546e('0x5'));var interaction=require(_0x546e('0x6'));var config=require(_0x546e('0x7'));var controller=require(_0x546e('0x8'));router['get'](_0x546e('0x9'),auth['isAuthenticated'](),controller[_0x546e('0xa')]);router[_0x546e('0xb')](_0x546e('0x9'),auth[_0x546e('0xc')](),controller[_0x546e('0xd')]);router[_0x546e('0xe')](_0x546e('0x9'),auth[_0x546e('0xc')](),controller[_0x546e('0xf')]);module[_0x546e('0x10')]=router; \ No newline at end of file +var _0xa6f3=['get','/:id','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./chatApplication.controller'];(function(_0x52dfa9,_0x306d3f){var _0xdfaa57=function(_0x9991c6){while(--_0x9991c6){_0x52dfa9['push'](_0x52dfa9['shift']());}};_0xdfaa57(++_0x306d3f);}(_0xa6f3,0xe9));var _0x3a6f=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0xa6f3[_0x5ac1e5];return _0x1bccc6;};'use strict';var multer=require(_0x3a6f('0x0'));var util=require(_0x3a6f('0x1'));var path=require(_0x3a6f('0x2'));var timeout=require(_0x3a6f('0x3'));var express=require('express');var router=express[_0x3a6f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a6f('0x5'));var controller=require(_0x3a6f('0x6'));router[_0x3a6f('0x7')](_0x3a6f('0x8'),auth[_0x3a6f('0x9')](),controller['show']);router[_0x3a6f('0xa')](_0x3a6f('0x8'),auth[_0x3a6f('0x9')](),controller[_0x3a6f('0xb')]);router[_0x3a6f('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x3a6f('0xd')]);module[_0x3a6f('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index b6a1aa1..132306c 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 _0x27a0=['STRING','BOOLEAN','exports'];(function(_0x43403b,_0xe6f5ff){var _0x52c43d=function(_0x5e785d){while(--_0x5e785d){_0x43403b['push'](_0x43403b['shift']());}};_0x52c43d(++_0xe6f5ff);}(_0x27a0,0xbf));var _0x027a=function(_0x22f197,_0x3e96b1){_0x22f197=_0x22f197-0x0;var _0x5db5e6=_0x27a0[_0x22f197];return _0x5db5e6;};'use strict';var Sequelize=require('sequelize');module[_0x027a('0x0')]={'name':{'type':Sequelize[_0x027a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x027a('0x1')]},'write':{'type':Sequelize[_0x027a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7510=['BOOLEAN','exports','STRING'];(function(_0xcee3bc,_0x48eebc){var _0x231ad3=function(_0x2b224){while(--_0x2b224){_0xcee3bc['push'](_0xcee3bc['shift']());}};_0x231ad3(++_0x48eebc);}(_0x7510,0xa9));var _0x0751=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7510[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0751('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0751('0x1')]},'write':{'type':Sequelize[_0x0751('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 514985f..f63f3d3 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 _0xad32=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','type','VIRTUAL','options','where','include','findAll','rows','catch','show','includeAll','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','User','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','save','update','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','key','model'];(function(_0x1eab89,_0x4e037c){var _0x1e1965=function(_0x47b0ef){while(--_0x47b0ef){_0x1eab89['push'](_0x1eab89['shift']());}};_0x1e1965(++_0x4e037c);}(_0xad32,0x88));var _0x2ad3=function(_0x2ce055,_0x14be9a){_0x2ce055=_0x2ce055-0x0;var _0x38053a=_0xad32[_0x2ce055];return _0x38053a;};'use strict';var emlformat=require(_0x2ad3('0x0'));var rimraf=require(_0x2ad3('0x1'));var zipdir=require(_0x2ad3('0x2'));var jsonpatch=require(_0x2ad3('0x3'));var rp=require(_0x2ad3('0x4'));var moment=require(_0x2ad3('0x5'));var BPromise=require(_0x2ad3('0x6'));var Mustache=require(_0x2ad3('0x7'));var util=require(_0x2ad3('0x8'));var path=require('path');var sox=require(_0x2ad3('0x9'));var csv=require(_0x2ad3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ad3('0xb'));var _=require('lodash');var squel=require(_0x2ad3('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ad3('0xa'));var querystring=require(_0x2ad3('0xd'));var Papa=require(_0x2ad3('0xe'));var Redis=require('ioredis');var authService=require(_0x2ad3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ad3('0x10'));var hardwareService=require(_0x2ad3('0x11'));var logger=require(_0x2ad3('0x12'))(_0x2ad3('0x13'));var utils=require('../../config/utils');var config=require(_0x2ad3('0x14'));var licenseUtil=require(_0x2ad3('0x15'));var db=require('../../mysqldb')['db'];config[_0x2ad3('0x16')]=_[_0x2ad3('0x17')](config[_0x2ad3('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ad3('0x18'))(new Redis(config['redis']));require(_0x2ad3('0x19'))[_0x2ad3('0x1a')](socket);function respondWithStatusCode(_0x4455a0,_0x2f4abd){_0x2f4abd=_0x2f4abd||0xcc;return function(_0x247785){if(_0x247785){return _0x4455a0[_0x2ad3('0x1b')](_0x2f4abd);}return _0x4455a0[_0x2ad3('0x1c')](_0x2f4abd)['end']();};}function respondWithResult(_0x1c903c,_0x4fb87f){_0x4fb87f=_0x4fb87f||0xc8;return function(_0x4a0639){if(_0x4a0639){return _0x1c903c[_0x2ad3('0x1c')](_0x4fb87f)[_0x2ad3('0x1d')](_0x4a0639);}};}function respondWithFilteredResult(_0x503cd6,_0xb5d537){return function(_0x2e9d1d){if(_0x2e9d1d){var _0x43e474=typeof _0xb5d537[_0x2ad3('0x1e')]===_0x2ad3('0x1f')&&typeof _0xb5d537[_0x2ad3('0x20')]===_0x2ad3('0x1f');var _0x47e8ba=_0x2e9d1d[_0x2ad3('0x21')];var _0x5c017a=_0x43e474?0x0:_0xb5d537[_0x2ad3('0x1e')];var _0x2c5bf0=_0x43e474?_0x2e9d1d[_0x2ad3('0x21')]:_0xb5d537['offset']+_0xb5d537['limit'];var _0x4f3906;if(_0x2c5bf0>=_0x47e8ba){_0x2c5bf0=_0x47e8ba;_0x4f3906=0xc8;}else{_0x4f3906=0xce;}_0x503cd6[_0x2ad3('0x1c')](_0x4f3906);return _0x503cd6[_0x2ad3('0x22')]('Content-Range',_0x5c017a+'-'+_0x2c5bf0+'/'+_0x47e8ba)[_0x2ad3('0x1d')](_0x2e9d1d);}return null;};}function patchUpdates(_0x5a22ab){return function(_0xbfc3f2){try{jsonpatch['apply'](_0xbfc3f2,_0x5a22ab,!![]);}catch(_0x2afbd9){return BPromise['reject'](_0x2afbd9);}return _0xbfc3f2[_0x2ad3('0x23')]();};}function saveUpdates(_0x22a77a,_0x56cd18){return function(_0xbdeafc){if(_0xbdeafc){return _0xbdeafc[_0x2ad3('0x24')](_0x22a77a)[_0x2ad3('0x25')](function(_0xbf8d8d){return _0xbf8d8d;});}return null;};}function removeEntity(_0x342616,_0x5ddfcd){return function(_0x2905d8){if(_0x2905d8){return _0x2905d8['destroy']()['then'](function(){_0x342616['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a774a,_0x5bc9e1){return function(_0x136d88){if(!_0x136d88){_0x1a774a[_0x2ad3('0x1b')](0x194);}return _0x136d88;};}function handleError(_0x264b29,_0x3a0142){_0x3a0142=_0x3a0142||0x1f4;return function(_0x22bb76){logger[_0x2ad3('0x26')](_0x22bb76[_0x2ad3('0x27')]);if(_0x22bb76[_0x2ad3('0x28')]){delete _0x22bb76[_0x2ad3('0x28')];}_0x264b29[_0x2ad3('0x1c')](_0x3a0142)[_0x2ad3('0x29')](_0x22bb76);};}exports[_0x2ad3('0x2a')]=function(_0x375762,_0x2e3024){var _0x594afc={},_0x5f034a={},_0x814b6a={'count':0x0,'rows':[]};var _0x58e50f=_[_0x2ad3('0x2b')](db[_0x2ad3('0x2c')][_0x2ad3('0x2d')],function(_0x4b8ad4){return{'name':_0x4b8ad4['fieldName'],'type':_0x4b8ad4['type'][_0x2ad3('0x2e')]};});_0x5f034a[_0x2ad3('0x2f')]=_['map'](_0x58e50f,_0x2ad3('0x28'));_0x5f034a[_0x2ad3('0x30')]=_[_0x2ad3('0x31')](_0x375762[_0x2ad3('0x30')]);_0x5f034a[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x5f034a[_0x2ad3('0x2f')],_0x5f034a[_0x2ad3('0x30')]);_0x594afc['attributes']=_[_0x2ad3('0x33')](_0x5f034a[_0x2ad3('0x2f')],qs[_0x2ad3('0x34')](_0x375762[_0x2ad3('0x30')]['fields']));_0x594afc[_0x2ad3('0x35')]=_0x594afc['attributes'][_0x2ad3('0x36')]?_0x594afc['attributes']:_0x5f034a[_0x2ad3('0x2f')];if(!_0x375762[_0x2ad3('0x30')][_0x2ad3('0x37')]('nolimit')){_0x594afc[_0x2ad3('0x20')]=qs['limit'](_0x375762[_0x2ad3('0x30')]['limit']);_0x594afc[_0x2ad3('0x1e')]=qs[_0x2ad3('0x1e')](_0x375762[_0x2ad3('0x30')]['offset']);}_0x594afc[_0x2ad3('0x38')]=qs[_0x2ad3('0x39')](_0x375762['query'][_0x2ad3('0x39')]);_0x594afc['where']=qs[_0x2ad3('0x32')](_[_0x2ad3('0x3a')](_0x375762[_0x2ad3('0x30')],_0x5f034a[_0x2ad3('0x32')]),_0x58e50f);if(_0x375762['query'][_0x2ad3('0x3b')]){_0x594afc['where']=_[_0x2ad3('0x3c')](_0x594afc['where'],{'$or':_[_0x2ad3('0x2b')](_0x58e50f,function(_0x4345d4){if(_0x4345d4[_0x2ad3('0x3d')]!==_0x2ad3('0x3e')){var _0x80bce0={};_0x80bce0[_0x4345d4['name']]={'$like':'%'+_0x375762['query'][_0x2ad3('0x3b')]+'%'};return _0x80bce0;}})});}_0x594afc=_[_0x2ad3('0x3c')]({},_0x594afc,_0x375762[_0x2ad3('0x3f')]);var _0x4d5f83={'where':_0x594afc[_0x2ad3('0x40')]};return db[_0x2ad3('0x2c')][_0x2ad3('0x21')](_0x4d5f83)[_0x2ad3('0x25')](function(_0x181bcf){_0x814b6a[_0x2ad3('0x21')]=_0x181bcf;if(_0x375762[_0x2ad3('0x30')]['includeAll']){_0x594afc[_0x2ad3('0x41')]=[{'all':!![]}];}return db[_0x2ad3('0x2c')][_0x2ad3('0x42')](_0x594afc);})[_0x2ad3('0x25')](function(_0x464168){_0x814b6a[_0x2ad3('0x43')]=_0x464168;return _0x814b6a;})['then'](respondWithFilteredResult(_0x2e3024,_0x594afc))[_0x2ad3('0x44')](handleError(_0x2e3024,null));};exports[_0x2ad3('0x45')]=function(_0x472fbb,_0x50670e){var _0x7d813b={'raw':!![],'where':{'id':_0x472fbb['params']['id']}},_0xcf295b={};_0xcf295b[_0x2ad3('0x2f')]=_['keys'](db[_0x2ad3('0x2c')]['rawAttributes']);_0xcf295b[_0x2ad3('0x30')]=_[_0x2ad3('0x31')](_0x472fbb[_0x2ad3('0x30')]);_0xcf295b[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0xcf295b['model'],_0xcf295b[_0x2ad3('0x30')]);_0x7d813b[_0x2ad3('0x35')]=_['intersection'](_0xcf295b[_0x2ad3('0x2f')],qs[_0x2ad3('0x34')](_0x472fbb['query'][_0x2ad3('0x34')]));_0x7d813b[_0x2ad3('0x35')]=_0x7d813b[_0x2ad3('0x35')][_0x2ad3('0x36')]?_0x7d813b['attributes']:_0xcf295b[_0x2ad3('0x2f')];if(_0x472fbb['query'][_0x2ad3('0x46')]){_0x7d813b[_0x2ad3('0x41')]=[{'all':!![]}];}_0x7d813b=_['merge']({},_0x7d813b,_0x472fbb[_0x2ad3('0x3f')]);return db['ChatGroup'][_0x2ad3('0x47')](_0x7d813b)[_0x2ad3('0x25')](handleEntityNotFound(_0x50670e,null))[_0x2ad3('0x25')](respondWithResult(_0x50670e,null))['catch'](handleError(_0x50670e,null));};exports[_0x2ad3('0x48')]=function(_0x2d6c17,_0xd32c36){return db[_0x2ad3('0x2c')][_0x2ad3('0x48')](_0x2d6c17['body'],{})['then'](respondWithResult(_0xd32c36,0xc9))['catch'](handleError(_0xd32c36,null));};exports[_0x2ad3('0x24')]=function(_0x30c95f,_0x31dd02){if(_0x30c95f[_0x2ad3('0x49')]['id']){delete _0x30c95f['body']['id'];}return db['ChatGroup'][_0x2ad3('0x47')]({'where':{'id':_0x30c95f[_0x2ad3('0x4a')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x31dd02,null))[_0x2ad3('0x25')](saveUpdates(_0x30c95f[_0x2ad3('0x49')],null))[_0x2ad3('0x25')](respondWithResult(_0x31dd02,null))['catch'](handleError(_0x31dd02,null));};exports[_0x2ad3('0x4b')]=function(_0x494a35,_0x45a13e){return db[_0x2ad3('0x2c')]['find']({'where':{'id':_0x494a35[_0x2ad3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45a13e,null))[_0x2ad3('0x25')](removeEntity(_0x45a13e,null))[_0x2ad3('0x44')](handleError(_0x45a13e,null));};exports[_0x2ad3('0x4c')]=function(_0x35c1d1,_0x5d069c){return db[_0x2ad3('0x2c')][_0x2ad3('0x4c')]()[_0x2ad3('0x25')](respondWithResult(_0x5d069c,null))[_0x2ad3('0x44')](handleError(_0x5d069c,null));};exports[_0x2ad3('0x4d')]=function(_0xf10ad5,_0x27f58d,_0x5d3a1a){return db[_0x2ad3('0x4e')][_0x2ad3('0x21')]({'where':{'ChatGroupId':_0xf10ad5[_0x2ad3('0x4a')]['id'],'ToId':_0xf10ad5[_0x2ad3('0x4f')]['id'],'read':![]}})['then'](function(_0x2035da){return{'id':_[_0x2ad3('0x50')](_0xf10ad5[_0x2ad3('0x4a')]['id']),'count':_0x2035da};})[_0x2ad3('0x25')](respondWithResult(_0x27f58d,null))[_0x2ad3('0x44')](handleError(_0x27f58d,null));};exports[_0x2ad3('0x51')]=function(_0x1a88bd,_0xa3873c,_0x1d450d){return db[_0x2ad3('0x2c')][_0x2ad3('0x47')]({'where':{'id':_0x1a88bd[_0x2ad3('0x4a')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0xa3873c,null))[_0x2ad3('0x25')](function(_0xfab003){if(_0xfab003){return _0xfab003['addMembers'](_0x1a88bd[_0x2ad3('0x49')]['ids'],_['omit'](_0x1a88bd[_0x2ad3('0x49')],[_0x2ad3('0x52'),'id'])||{});}})['then'](respondWithResult(_0xa3873c,null))[_0x2ad3('0x44')](handleError(_0xa3873c,null));};exports[_0x2ad3('0x53')]=function(_0x35b86b,_0x4fb59f,_0x1fb584){var _0x5c94e5={};var _0x45c49c={};var _0x1773e2;var _0xfcdf8;return db[_0x2ad3('0x2c')]['findOne']({'where':{'id':_0x35b86b[_0x2ad3('0x4a')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x4fb59f,null))[_0x2ad3('0x25')](function(_0x419cd6){if(_0x419cd6){_0x1773e2=_0x419cd6;_0x45c49c[_0x2ad3('0x2f')]=_[_0x2ad3('0x31')](db[_0x2ad3('0x54')][_0x2ad3('0x2d')]);_0x45c49c[_0x2ad3('0x30')]=_['keys'](_0x35b86b[_0x2ad3('0x30')]);_0x45c49c[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x45c49c[_0x2ad3('0x2f')],_0x45c49c[_0x2ad3('0x30')]);_0x5c94e5['attributes']=_['intersection'](_0x45c49c[_0x2ad3('0x2f')],qs[_0x2ad3('0x34')](_0x35b86b[_0x2ad3('0x30')][_0x2ad3('0x34')]));_0x5c94e5[_0x2ad3('0x35')]=_0x5c94e5[_0x2ad3('0x35')][_0x2ad3('0x36')]?_0x5c94e5[_0x2ad3('0x35')]:_0x45c49c[_0x2ad3('0x2f')];_0x5c94e5['order']=qs[_0x2ad3('0x39')](_0x35b86b['query'][_0x2ad3('0x39')]);_0x5c94e5['where']=qs[_0x2ad3('0x32')](_[_0x2ad3('0x3a')](_0x35b86b[_0x2ad3('0x30')],_0x45c49c[_0x2ad3('0x32')]));if(_0x35b86b[_0x2ad3('0x30')]['filter']){_0x5c94e5[_0x2ad3('0x40')]=_['merge'](_0x5c94e5[_0x2ad3('0x40')],{'$or':_[_0x2ad3('0x2b')](_0x5c94e5[_0x2ad3('0x35')],function(_0x3853cb){var _0x1483ae={};_0x1483ae[_0x3853cb]={'$like':'%'+_0x35b86b[_0x2ad3('0x30')]['filter']+'%'};return _0x1483ae;})});}_0x5c94e5=_['merge']({},_0x5c94e5,_0x35b86b['options']);return _0x1773e2[_0x2ad3('0x53')](_0x5c94e5);}})[_0x2ad3('0x25')](function(_0x8cba7d){if(_0x8cba7d){_0xfcdf8=_0x8cba7d[_0x2ad3('0x36')];if(!_0x35b86b[_0x2ad3('0x30')][_0x2ad3('0x37')](_0x2ad3('0x55'))){_0x5c94e5[_0x2ad3('0x20')]=qs[_0x2ad3('0x20')](_0x35b86b[_0x2ad3('0x30')][_0x2ad3('0x20')]);_0x5c94e5[_0x2ad3('0x1e')]=qs[_0x2ad3('0x1e')](_0x35b86b[_0x2ad3('0x30')][_0x2ad3('0x1e')]);}return _0x1773e2[_0x2ad3('0x53')](_0x5c94e5);}})[_0x2ad3('0x25')](function(_0x123c60){if(_0x123c60){return _0x123c60?{'count':_0xfcdf8,'rows':_0x123c60}:null;}})[_0x2ad3('0x25')](respondWithResult(_0x4fb59f,null))[_0x2ad3('0x44')](handleError(_0x4fb59f,null));};exports[_0x2ad3('0x56')]=function(_0x4bbb68,_0x2e2e14,_0x43471b){return db[_0x2ad3('0x2c')][_0x2ad3('0x47')]({'where':{'id':_0x4bbb68[_0x2ad3('0x4a')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x2e2e14,null))[_0x2ad3('0x25')](function(_0xbb1f14){if(_0xbb1f14){return _0xbb1f14['removeMembers'](_0x4bbb68[_0x2ad3('0x30')][_0x2ad3('0x52')]);}})[_0x2ad3('0x25')](respondWithStatusCode(_0x2e2e14,null))[_0x2ad3('0x44')](handleError(_0x2e2e14,null));};exports[_0x2ad3('0x57')]=function(_0x3153bb,_0x320788,_0x436cbb){if(_0x3153bb[_0x2ad3('0x49')]['id']){delete _0x3153bb['body']['id'];}return db['ChatGroup'][_0x2ad3('0x47')]({'where':{'id':_0x3153bb[_0x2ad3('0x4a')]['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x320788,null))[_0x2ad3('0x25')](function(_0x3b3088){if(_0x3b3088){_0x3153bb[_0x2ad3('0x49')][_0x2ad3('0x58')]=_0x3b3088['id'];return db[_0x2ad3('0x4e')][_0x2ad3('0x48')](_0x3153bb[_0x2ad3('0x49')]);}})[_0x2ad3('0x25')](respondWithResult(_0x320788,null))['catch'](handleError(_0x320788,null));};exports[_0x2ad3('0x59')]=function(_0xd3f2ff,_0x5822d9,_0x25aa98){var _0x806bd3={};var _0x13a6d3={};var _0x23cdad;var _0x18403e;return db['ChatGroup']['findOne']({'where':{'id':_0xd3f2ff['params']['id']}})[_0x2ad3('0x25')](handleEntityNotFound(_0x5822d9,null))['then'](function(_0x479dde){if(_0x479dde){_0x23cdad=_0x479dde;_0x13a6d3[_0x2ad3('0x2f')]=_[_0x2ad3('0x31')](db['ChatInternalMessage'][_0x2ad3('0x2d')]);_0x13a6d3[_0x2ad3('0x30')]=_[_0x2ad3('0x31')](_0xd3f2ff[_0x2ad3('0x30')]);_0x13a6d3[_0x2ad3('0x32')]=_[_0x2ad3('0x33')](_0x13a6d3[_0x2ad3('0x2f')],_0x13a6d3['query']);_0x806bd3[_0x2ad3('0x35')]=_[_0x2ad3('0x33')](_0x13a6d3[_0x2ad3('0x2f')],qs[_0x2ad3('0x34')](_0xd3f2ff['query'][_0x2ad3('0x34')]));_0x806bd3[_0x2ad3('0x35')]=_0x806bd3[_0x2ad3('0x35')][_0x2ad3('0x36')]?_0x806bd3[_0x2ad3('0x35')]:_0x13a6d3['model'];_0x806bd3[_0x2ad3('0x38')]=qs['sort'](_0xd3f2ff['query']['sort']);_0x806bd3[_0x2ad3('0x40')]=qs[_0x2ad3('0x32')](_[_0x2ad3('0x3a')](_0xd3f2ff['query'],_0x13a6d3[_0x2ad3('0x32')]));if(_0xd3f2ff[_0x2ad3('0x30')]['filter']){_0x806bd3[_0x2ad3('0x40')]=_[_0x2ad3('0x3c')](_0x806bd3[_0x2ad3('0x40')],{'$or':_[_0x2ad3('0x2b')](_0x806bd3[_0x2ad3('0x35')],function(_0x67a515){var _0x2be546={};_0x2be546[_0x67a515]={'$like':'%'+_0xd3f2ff['query'][_0x2ad3('0x3b')]+'%'};return _0x2be546;})});}if(_0xd3f2ff[_0x2ad3('0x30')]['$gte']){var _0x3095a7=_0xd3f2ff['query'][_0x2ad3('0x5a')]['split'](',');var _0x149990={};_0x149990[_0x3095a7[0x0]]={'$gte':moment(_0x3095a7[0x1])['format'](_0x2ad3('0x5b'))};_0x806bd3[_0x2ad3('0x40')]=_[_0x2ad3('0x3c')](_0x806bd3[_0x2ad3('0x40')],_0x149990);}_0x806bd3=_['merge']({},_0x806bd3,_0xd3f2ff[_0x2ad3('0x3f')]);return _0x23cdad[_0x2ad3('0x59')](_0x806bd3);}})['then'](function(_0x2ebaaf){if(_0x2ebaaf){_0x18403e=_0x2ebaaf[_0x2ad3('0x36')];if(!_0xd3f2ff[_0x2ad3('0x30')]['hasOwnProperty'](_0x2ad3('0x55'))){_0x806bd3[_0x2ad3('0x20')]=qs[_0x2ad3('0x20')](_0xd3f2ff[_0x2ad3('0x30')][_0x2ad3('0x20')]);_0x806bd3[_0x2ad3('0x1e')]=qs[_0x2ad3('0x1e')](_0xd3f2ff[_0x2ad3('0x30')][_0x2ad3('0x1e')]);}return _0x23cdad[_0x2ad3('0x59')](_0x806bd3);}})[_0x2ad3('0x25')](function(_0xd81059){if(_0xd81059){return _0xd81059?{'count':_0x18403e,'rows':_0xd81059}:null;}})[_0x2ad3('0x25')](respondWithResult(_0x5822d9,null))['catch'](handleError(_0x5822d9,null));}; \ No newline at end of file +var _0x756b=['rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','options','nolimit','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','ChatGroup'];(function(_0xf19da5,_0x2c2268){var _0x2eafe4=function(_0x220f25){while(--_0x220f25){_0xf19da5['push'](_0xf19da5['shift']());}};_0x2eafe4(++_0x2c2268);}(_0x756b,0x1a1));var _0xb756=function(_0x293b51,_0x1579d1){_0x293b51=_0x293b51-0x0;var _0x4cebfb=_0x756b[_0x293b51];return _0x4cebfb;};'use strict';var emlformat=require(_0xb756('0x0'));var rimraf=require(_0xb756('0x1'));var zipdir=require(_0xb756('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb756('0x3'));var moment=require(_0xb756('0x4'));var BPromise=require(_0xb756('0x5'));var Mustache=require(_0xb756('0x6'));var util=require(_0xb756('0x7'));var path=require(_0xb756('0x8'));var sox=require('sox');var csv=require(_0xb756('0x9'));var ejs=require(_0xb756('0xa'));var fs=require('fs');var fs_extra=require(_0xb756('0xb'));var _=require(_0xb756('0xc'));var squel=require(_0xb756('0xd'));var crypto=require('crypto');var jsforce=require(_0xb756('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb756('0xf'));var Papa=require(_0xb756('0x10'));var Redis=require(_0xb756('0x11'));var authService=require(_0xb756('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb756('0x13'));var hardwareService=require(_0xb756('0x14'));var logger=require(_0xb756('0x15'))('api');var utils=require(_0xb756('0x16'));var config=require(_0xb756('0x17'));var licenseUtil=require(_0xb756('0x18'));var db=require('../../mysqldb')['db'];config[_0xb756('0x19')]=_['defaults'](config[_0xb756('0x19')],{'host':_0xb756('0x1a'),'port':0x18eb});var socket=require(_0xb756('0x1b'))(new Redis(config['redis']));require(_0xb756('0x1c'))['register'](socket);function respondWithStatusCode(_0xa9d552,_0x218768){_0x218768=_0x218768||0xcc;return function(_0x308064){if(_0x308064){return _0xa9d552[_0xb756('0x1d')](_0x218768);}return _0xa9d552[_0xb756('0x1e')](_0x218768)['end']();};}function respondWithResult(_0x40634e,_0x329549){_0x329549=_0x329549||0xc8;return function(_0x4fe513){if(_0x4fe513){return _0x40634e['status'](_0x329549)[_0xb756('0x1f')](_0x4fe513);}};}function respondWithFilteredResult(_0x138306,_0xa263fe){return function(_0x57666e){if(_0x57666e){var _0x5ac721=typeof _0xa263fe[_0xb756('0x20')]===_0xb756('0x21')&&typeof _0xa263fe[_0xb756('0x22')]===_0xb756('0x21');var _0x187164=_0x57666e[_0xb756('0x23')];var _0xf7a3=_0x5ac721?0x0:_0xa263fe['offset'];var _0x22c9a5=_0x5ac721?_0x57666e[_0xb756('0x23')]:_0xa263fe[_0xb756('0x20')]+_0xa263fe['limit'];var _0x44fc5a;if(_0x22c9a5>=_0x187164){_0x22c9a5=_0x187164;_0x44fc5a=0xc8;}else{_0x44fc5a=0xce;}_0x138306[_0xb756('0x1e')](_0x44fc5a);return _0x138306[_0xb756('0x24')](_0xb756('0x25'),_0xf7a3+'-'+_0x22c9a5+'/'+_0x187164)['json'](_0x57666e);}return null;};}function patchUpdates(_0x3e5df4){return function(_0x4f7d1e){try{jsonpatch['apply'](_0x4f7d1e,_0x3e5df4,!![]);}catch(_0x264188){return BPromise[_0xb756('0x26')](_0x264188);}return _0x4f7d1e['save']();};}function saveUpdates(_0x634422,_0x28bb1c){return function(_0x55978e){if(_0x55978e){return _0x55978e['update'](_0x634422)[_0xb756('0x27')](function(_0x24d7b7){return _0x24d7b7;});}return null;};}function removeEntity(_0x2bfa78,_0x4c3bc2){return function(_0x8ffe68){if(_0x8ffe68){return _0x8ffe68[_0xb756('0x28')]()['then'](function(){_0x2bfa78[_0xb756('0x1e')](0xcc)[_0xb756('0x29')]();});}};}function handleEntityNotFound(_0xd8fde9,_0xc22fc3){return function(_0x2ce96f){if(!_0x2ce96f){_0xd8fde9[_0xb756('0x1d')](0x194);}return _0x2ce96f;};}function handleError(_0x6a5bc6,_0xad1905){_0xad1905=_0xad1905||0x1f4;return function(_0x36998d){logger['error'](_0x36998d[_0xb756('0x2a')]);if(_0x36998d[_0xb756('0x2b')]){delete _0x36998d[_0xb756('0x2b')];}_0x6a5bc6[_0xb756('0x1e')](_0xad1905)[_0xb756('0x2c')](_0x36998d);};}exports[_0xb756('0x2d')]=function(_0x130271,_0x47dff1){var _0x3a37c8={},_0x1b75c8={},_0x395aed={'count':0x0,'rows':[]};var _0x111426=_[_0xb756('0x2e')](db[_0xb756('0x2f')][_0xb756('0x30')],function(_0x2ba25b){return{'name':_0x2ba25b[_0xb756('0x31')],'type':_0x2ba25b['type']['key']};});_0x1b75c8[_0xb756('0x32')]=_[_0xb756('0x2e')](_0x111426,_0xb756('0x2b'));_0x1b75c8[_0xb756('0x33')]=_[_0xb756('0x34')](_0x130271[_0xb756('0x33')]);_0x1b75c8[_0xb756('0x35')]=_['intersection'](_0x1b75c8['model'],_0x1b75c8['query']);_0x3a37c8['attributes']=_[_0xb756('0x36')](_0x1b75c8[_0xb756('0x32')],qs[_0xb756('0x37')](_0x130271[_0xb756('0x33')][_0xb756('0x37')]));_0x3a37c8[_0xb756('0x38')]=_0x3a37c8['attributes'][_0xb756('0x39')]?_0x3a37c8['attributes']:_0x1b75c8['model'];if(!_0x130271[_0xb756('0x33')][_0xb756('0x3a')]('nolimit')){_0x3a37c8[_0xb756('0x22')]=qs[_0xb756('0x22')](_0x130271[_0xb756('0x33')][_0xb756('0x22')]);_0x3a37c8[_0xb756('0x20')]=qs[_0xb756('0x20')](_0x130271['query']['offset']);}_0x3a37c8[_0xb756('0x3b')]=qs['sort'](_0x130271[_0xb756('0x33')][_0xb756('0x3c')]);_0x3a37c8[_0xb756('0x3d')]=qs[_0xb756('0x35')](_[_0xb756('0x3e')](_0x130271[_0xb756('0x33')],_0x1b75c8[_0xb756('0x35')]),_0x111426);if(_0x130271['query'][_0xb756('0x3f')]){_0x3a37c8[_0xb756('0x3d')]=_[_0xb756('0x40')](_0x3a37c8[_0xb756('0x3d')],{'$or':_['map'](_0x111426,function(_0x1b01f8){if(_0x1b01f8[_0xb756('0x41')]!==_0xb756('0x42')){var _0x227423={};_0x227423[_0x1b01f8[_0xb756('0x2b')]]={'$like':'%'+_0x130271[_0xb756('0x33')][_0xb756('0x3f')]+'%'};return _0x227423;}})});}_0x3a37c8=_['merge']({},_0x3a37c8,_0x130271['options']);var _0xf1bf39={'where':_0x3a37c8['where']};return db[_0xb756('0x2f')][_0xb756('0x23')](_0xf1bf39)[_0xb756('0x27')](function(_0x199a64){_0x395aed[_0xb756('0x23')]=_0x199a64;if(_0x130271['query'][_0xb756('0x43')]){_0x3a37c8[_0xb756('0x44')]=[{'all':!![]}];}return db[_0xb756('0x2f')]['findAll'](_0x3a37c8);})[_0xb756('0x27')](function(_0x26555e){_0x395aed[_0xb756('0x45')]=_0x26555e;return _0x395aed;})[_0xb756('0x27')](respondWithFilteredResult(_0x47dff1,_0x3a37c8))[_0xb756('0x46')](handleError(_0x47dff1,null));};exports[_0xb756('0x47')]=function(_0x2df60b,_0xb47dd1){var _0x59f7ec={'raw':!![],'where':{'id':_0x2df60b[_0xb756('0x48')]['id']}},_0x3ae574={};_0x3ae574[_0xb756('0x32')]=_[_0xb756('0x34')](db[_0xb756('0x2f')]['rawAttributes']);_0x3ae574[_0xb756('0x33')]=_[_0xb756('0x34')](_0x2df60b[_0xb756('0x33')]);_0x3ae574[_0xb756('0x35')]=_[_0xb756('0x36')](_0x3ae574[_0xb756('0x32')],_0x3ae574[_0xb756('0x33')]);_0x59f7ec[_0xb756('0x38')]=_['intersection'](_0x3ae574[_0xb756('0x32')],qs[_0xb756('0x37')](_0x2df60b[_0xb756('0x33')][_0xb756('0x37')]));_0x59f7ec[_0xb756('0x38')]=_0x59f7ec['attributes']['length']?_0x59f7ec[_0xb756('0x38')]:_0x3ae574[_0xb756('0x32')];if(_0x2df60b[_0xb756('0x33')]['includeAll']){_0x59f7ec[_0xb756('0x44')]=[{'all':!![]}];}_0x59f7ec=_[_0xb756('0x40')]({},_0x59f7ec,_0x2df60b['options']);return db[_0xb756('0x2f')]['find'](_0x59f7ec)[_0xb756('0x27')](handleEntityNotFound(_0xb47dd1,null))[_0xb756('0x27')](respondWithResult(_0xb47dd1,null))[_0xb756('0x46')](handleError(_0xb47dd1,null));};exports[_0xb756('0x49')]=function(_0x1dd7ef,_0x434ac9){return db['ChatGroup']['create'](_0x1dd7ef['body'],{})[_0xb756('0x27')](respondWithResult(_0x434ac9,0xc9))[_0xb756('0x46')](handleError(_0x434ac9,null));};exports['update']=function(_0x4dc996,_0x19dce3){if(_0x4dc996[_0xb756('0x4a')]['id']){delete _0x4dc996[_0xb756('0x4a')]['id'];}return db[_0xb756('0x2f')][_0xb756('0x4b')]({'where':{'id':_0x4dc996[_0xb756('0x48')]['id']}})['then'](handleEntityNotFound(_0x19dce3,null))[_0xb756('0x27')](saveUpdates(_0x4dc996['body'],null))[_0xb756('0x27')](respondWithResult(_0x19dce3,null))[_0xb756('0x46')](handleError(_0x19dce3,null));};exports[_0xb756('0x28')]=function(_0xe28d36,_0x582061){return db[_0xb756('0x2f')][_0xb756('0x4b')]({'where':{'id':_0xe28d36['params']['id']}})['then'](handleEntityNotFound(_0x582061,null))['then'](removeEntity(_0x582061,null))[_0xb756('0x46')](handleError(_0x582061,null));};exports[_0xb756('0x4c')]=function(_0x5f3579,_0x782234){return db[_0xb756('0x2f')]['describe']()[_0xb756('0x27')](respondWithResult(_0x782234,null))[_0xb756('0x46')](handleError(_0x782234,null));};exports['getUnread']=function(_0x44b7ae,_0x59fad0,_0x44e266){return db[_0xb756('0x4d')][_0xb756('0x23')]({'where':{'ChatGroupId':_0x44b7ae[_0xb756('0x48')]['id'],'ToId':_0x44b7ae[_0xb756('0x4e')]['id'],'read':![]}})[_0xb756('0x27')](function(_0x399a0c){return{'id':_[_0xb756('0x4f')](_0x44b7ae[_0xb756('0x48')]['id']),'count':_0x399a0c};})[_0xb756('0x27')](respondWithResult(_0x59fad0,null))[_0xb756('0x46')](handleError(_0x59fad0,null));};exports[_0xb756('0x50')]=function(_0x4cddd7,_0x269c56,_0x4d9220){return db[_0xb756('0x2f')]['find']({'where':{'id':_0x4cddd7[_0xb756('0x48')]['id']}})['then'](handleEntityNotFound(_0x269c56,null))[_0xb756('0x27')](function(_0x4b202d){if(_0x4b202d){return _0x4b202d[_0xb756('0x50')](_0x4cddd7[_0xb756('0x4a')][_0xb756('0x51')],_[_0xb756('0x52')](_0x4cddd7[_0xb756('0x4a')],[_0xb756('0x51'),'id'])||{});}})['then'](respondWithResult(_0x269c56,null))[_0xb756('0x46')](handleError(_0x269c56,null));};exports[_0xb756('0x53')]=function(_0x49742e,_0x5e987c,_0x3ee036){var _0x2fc756={};var _0x14489c={};var _0x486bb6;var _0x57c8dd;return db[_0xb756('0x2f')]['findOne']({'where':{'id':_0x49742e[_0xb756('0x48')]['id']}})[_0xb756('0x27')](handleEntityNotFound(_0x5e987c,null))['then'](function(_0x204d5c){if(_0x204d5c){_0x486bb6=_0x204d5c;_0x14489c[_0xb756('0x32')]=_[_0xb756('0x34')](db['User'][_0xb756('0x30')]);_0x14489c[_0xb756('0x33')]=_[_0xb756('0x34')](_0x49742e['query']);_0x14489c[_0xb756('0x35')]=_['intersection'](_0x14489c[_0xb756('0x32')],_0x14489c[_0xb756('0x33')]);_0x2fc756['attributes']=_[_0xb756('0x36')](_0x14489c['model'],qs[_0xb756('0x37')](_0x49742e['query'][_0xb756('0x37')]));_0x2fc756[_0xb756('0x38')]=_0x2fc756['attributes'][_0xb756('0x39')]?_0x2fc756[_0xb756('0x38')]:_0x14489c[_0xb756('0x32')];_0x2fc756[_0xb756('0x3b')]=qs[_0xb756('0x3c')](_0x49742e['query'][_0xb756('0x3c')]);_0x2fc756['where']=qs[_0xb756('0x35')](_[_0xb756('0x3e')](_0x49742e[_0xb756('0x33')],_0x14489c[_0xb756('0x35')]));if(_0x49742e['query'][_0xb756('0x3f')]){_0x2fc756[_0xb756('0x3d')]=_[_0xb756('0x40')](_0x2fc756[_0xb756('0x3d')],{'$or':_[_0xb756('0x2e')](_0x2fc756[_0xb756('0x38')],function(_0x36515){var _0x29a065={};_0x29a065[_0x36515]={'$like':'%'+_0x49742e[_0xb756('0x33')][_0xb756('0x3f')]+'%'};return _0x29a065;})});}_0x2fc756=_['merge']({},_0x2fc756,_0x49742e[_0xb756('0x54')]);return _0x486bb6[_0xb756('0x53')](_0x2fc756);}})[_0xb756('0x27')](function(_0x1151f6){if(_0x1151f6){_0x57c8dd=_0x1151f6[_0xb756('0x39')];if(!_0x49742e[_0xb756('0x33')]['hasOwnProperty'](_0xb756('0x55'))){_0x2fc756[_0xb756('0x22')]=qs[_0xb756('0x22')](_0x49742e['query'][_0xb756('0x22')]);_0x2fc756[_0xb756('0x20')]=qs[_0xb756('0x20')](_0x49742e['query'][_0xb756('0x20')]);}return _0x486bb6[_0xb756('0x53')](_0x2fc756);}})[_0xb756('0x27')](function(_0x40687b){if(_0x40687b){return _0x40687b?{'count':_0x57c8dd,'rows':_0x40687b}:null;}})[_0xb756('0x27')](respondWithResult(_0x5e987c,null))[_0xb756('0x46')](handleError(_0x5e987c,null));};exports['removeMembers']=function(_0x1b877e,_0x1c0ccd,_0x1f96cc){return db[_0xb756('0x2f')]['find']({'where':{'id':_0x1b877e[_0xb756('0x48')]['id']}})[_0xb756('0x27')](handleEntityNotFound(_0x1c0ccd,null))[_0xb756('0x27')](function(_0x1c0434){if(_0x1c0434){return _0x1c0434['removeMembers'](_0x1b877e[_0xb756('0x33')][_0xb756('0x51')]);}})[_0xb756('0x27')](respondWithStatusCode(_0x1c0ccd,null))[_0xb756('0x46')](handleError(_0x1c0ccd,null));};exports[_0xb756('0x56')]=function(_0x1b3801,_0x1ea9a7,_0x2602a9){if(_0x1b3801[_0xb756('0x4a')]['id']){delete _0x1b3801[_0xb756('0x4a')]['id'];}return db[_0xb756('0x2f')][_0xb756('0x4b')]({'where':{'id':_0x1b3801['params']['id']}})[_0xb756('0x27')](handleEntityNotFound(_0x1ea9a7,null))[_0xb756('0x27')](function(_0x38f475){if(_0x38f475){_0x1b3801[_0xb756('0x4a')][_0xb756('0x57')]=_0x38f475['id'];return db[_0xb756('0x4d')][_0xb756('0x49')](_0x1b3801['body']);}})[_0xb756('0x27')](respondWithResult(_0x1ea9a7,null))[_0xb756('0x46')](handleError(_0x1ea9a7,null));};exports['getMessages']=function(_0x57c407,_0x2a52a2,_0x4f4d41){var _0x4c299f={};var _0x4e67ad={};var _0x354411;var _0x4afea6;return db[_0xb756('0x2f')]['findOne']({'where':{'id':_0x57c407[_0xb756('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a52a2,null))[_0xb756('0x27')](function(_0xba318a){if(_0xba318a){_0x354411=_0xba318a;_0x4e67ad['model']=_[_0xb756('0x34')](db[_0xb756('0x4d')][_0xb756('0x30')]);_0x4e67ad[_0xb756('0x33')]=_[_0xb756('0x34')](_0x57c407['query']);_0x4e67ad[_0xb756('0x35')]=_[_0xb756('0x36')](_0x4e67ad[_0xb756('0x32')],_0x4e67ad['query']);_0x4c299f[_0xb756('0x38')]=_['intersection'](_0x4e67ad[_0xb756('0x32')],qs[_0xb756('0x37')](_0x57c407[_0xb756('0x33')]['fields']));_0x4c299f['attributes']=_0x4c299f[_0xb756('0x38')][_0xb756('0x39')]?_0x4c299f[_0xb756('0x38')]:_0x4e67ad[_0xb756('0x32')];_0x4c299f['order']=qs['sort'](_0x57c407[_0xb756('0x33')][_0xb756('0x3c')]);_0x4c299f[_0xb756('0x3d')]=qs[_0xb756('0x35')](_[_0xb756('0x3e')](_0x57c407[_0xb756('0x33')],_0x4e67ad['filters']));if(_0x57c407[_0xb756('0x33')][_0xb756('0x3f')]){_0x4c299f[_0xb756('0x3d')]=_[_0xb756('0x40')](_0x4c299f[_0xb756('0x3d')],{'$or':_[_0xb756('0x2e')](_0x4c299f[_0xb756('0x38')],function(_0x49ca2b){var _0xafb7ed={};_0xafb7ed[_0x49ca2b]={'$like':'%'+_0x57c407[_0xb756('0x33')][_0xb756('0x3f')]+'%'};return _0xafb7ed;})});}if(_0x57c407['query'][_0xb756('0x58')]){var _0x22e9b5=_0x57c407[_0xb756('0x33')][_0xb756('0x58')][_0xb756('0x59')](',');var _0x58fe57={};_0x58fe57[_0x22e9b5[0x0]]={'$gte':moment(_0x22e9b5[0x1])[_0xb756('0x5a')](_0xb756('0x5b'))};_0x4c299f[_0xb756('0x3d')]=_[_0xb756('0x40')](_0x4c299f[_0xb756('0x3d')],_0x58fe57);}_0x4c299f=_[_0xb756('0x40')]({},_0x4c299f,_0x57c407[_0xb756('0x54')]);return _0x354411[_0xb756('0x5c')](_0x4c299f);}})[_0xb756('0x27')](function(_0x206883){if(_0x206883){_0x4afea6=_0x206883[_0xb756('0x39')];if(!_0x57c407[_0xb756('0x33')][_0xb756('0x3a')](_0xb756('0x55'))){_0x4c299f[_0xb756('0x22')]=qs['limit'](_0x57c407[_0xb756('0x33')]['limit']);_0x4c299f[_0xb756('0x20')]=qs[_0xb756('0x20')](_0x57c407['query'][_0xb756('0x20')]);}return _0x354411['getMessages'](_0x4c299f);}})['then'](function(_0x2c45ef){if(_0x2c45ef){return _0x2c45ef?{'count':_0x4afea6,'rows':_0x2c45ef}:null;}})[_0xb756('0x27')](respondWithResult(_0x2a52a2,null))[_0xb756('0x46')](handleError(_0x2a52a2,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9b3be34..42ef750 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 _0x58e6=['events','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x4eb83a,_0x41b0e1){var _0x384b59=function(_0x270e6b){while(--_0x270e6b){_0x4eb83a['push'](_0x4eb83a['shift']());}};_0x384b59(++_0x41b0e1);}(_0x58e6,0x1c2));var _0x658e=function(_0x11dc0e,_0x1e53f5){_0x11dc0e=_0x11dc0e-0x0;var _0x5f1d83=_0x58e6[_0x11dc0e];return _0x5f1d83;};'use strict';var EventEmitter=require(_0x658e('0x0'));var ChatGroup=require(_0x658e('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x658e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1bae99){return function(_0x2e8405,_0xdbaf2e,_0x187e6a){ChatGroupEvents[_0x658e('0x3')](_0x1bae99+':'+_0x2e8405['id'],_0x2e8405);ChatGroupEvents[_0x658e('0x3')](_0x1bae99,_0x2e8405);_0x187e6a(null);};}for(var e in events){if(events[_0x658e('0x4')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xd4ad=['hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x1e4417,_0x3529d3){var _0x182a23=function(_0x1e6ec7){while(--_0x1e6ec7){_0x1e4417['push'](_0x1e4417['shift']());}};_0x182a23(++_0x3529d3);}(_0xd4ad,0x158));var _0xdd4a=function(_0x4e9755,_0xc1f77c){_0x4e9755=_0x4e9755-0x0;var _0x1498c7=_0xd4ad[_0x4e9755];return _0x1498c7;};'use strict';var EventEmitter=require(_0xdd4a('0x0'));var ChatGroup=require(_0xdd4a('0x1'))['db'][_0xdd4a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xdd4a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd4a('0x4'),'afterDestroy':_0xdd4a('0x5')};function emitEvent(_0x5911e5){return function(_0x587cf8,_0x13851c,_0x4775aa){ChatGroupEvents['emit'](_0x5911e5+':'+_0x587cf8['id'],_0x587cf8);ChatGroupEvents[_0xdd4a('0x6')](_0x5911e5,_0x587cf8);_0x4775aa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xdd4a('0x7')](e,emitEvent(event));}}module[_0xdd4a('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 872dabd..4ed367f 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 _0x5af3=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups'];(function(_0x58ac3f,_0x190d30){var _0x327bc0=function(_0x595a8c){while(--_0x595a8c){_0x58ac3f['push'](_0x58ac3f['shift']());}};_0x327bc0(++_0x190d30);}(_0x5af3,0x18c));var _0x35af=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x5af3[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x35af('0x0'));var util=require(_0x35af('0x1'));var logger=require(_0x35af('0x2'))(_0x35af('0x3'));var moment=require('moment');var BPromise=require(_0x35af('0x4'));var rp=require(_0x35af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x35af('0x6'));var attributes=require(_0x35af('0x7'));module[_0x35af('0x8')]=function(_0x566176,_0x4ec370){return _0x566176[_0x35af('0x9')](_0x35af('0xa'),attributes,{'tableName':_0x35af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2a=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','util','../../config/logger','api','bluebird','rimraf'];(function(_0x5ccdbf,_0x2a41ee){var _0x1c9691=function(_0x375d9a){while(--_0x375d9a){_0x5ccdbf['push'](_0x5ccdbf['shift']());}};_0x1c9691(++_0x2a41ee);}(_0xda2a,0x69));var _0xada2=function(_0x2057b9,_0x17c1b2){_0x2057b9=_0x2057b9-0x0;var _0x3bdc39=_0xda2a[_0x2057b9];return _0x3bdc39;};'use strict';var _=require('lodash');var util=require(_0xada2('0x0'));var logger=require(_0xada2('0x1'))(_0xada2('0x2'));var moment=require('moment');var BPromise=require(_0xada2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xada2('0x4'));var config=require(_0xada2('0x5'));var attributes=require(_0xada2('0x6'));module[_0xada2('0x7')]=function(_0x5a1f76,_0x4b22bb){return _0x5a1f76[_0xada2('0x8')](_0xada2('0x9'),attributes,{'tableName':_0xada2('0xa'),'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 f5e5bf2..98f0780 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 _0x95f4=['catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xacd1f6,_0x416669){var _0x38fe31=function(_0x5c1d45){while(--_0x5c1d45){_0xacd1f6['push'](_0xacd1f6['shift']());}};_0x38fe31(++_0x416669);}(_0x95f4,0xf1));var _0x495f=function(_0x236935,_0x7072eb){_0x236935=_0x236935-0x0;var _0x41c2fa=_0x95f4[_0x236935];return _0x41c2fa;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var moment=require(_0x495f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x495f('0x3'));var db=require(_0x495f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x495f('0x5'));var config=require(_0x495f('0x6'));var jayson=require(_0x495f('0x7'));var client=jayson['client'][_0x495f('0x8')]({'port':0x232a});config[_0x495f('0x9')]=_[_0x495f('0xa')](config['redis'],{'host':_0x495f('0xb'),'port':0x18eb});var socket=require(_0x495f('0xc'))(new Redis(config[_0x495f('0x9')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x3f5880,_0x48c225,_0x415017){return new BPromise(function(_0x508c3d,_0x2b6d9d){return client[_0x495f('0xd')](_0x3f5880,_0x415017)[_0x495f('0xe')](function(_0x2a90c0){logger['info'](_0x495f('0xf'),_0x48c225,_0x495f('0x10'));logger[_0x495f('0x11')](_0x495f('0x12'),_0x48c225,_0x495f('0x10'),JSON['stringify'](_0x2a90c0));if(_0x2a90c0[_0x495f('0x13')]){if(_0x2a90c0[_0x495f('0x13')][_0x495f('0x14')]===0x1f4){logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x2a90c0[_0x495f('0x13')][_0x495f('0x15')]);return _0x2b6d9d(_0x2a90c0['error'][_0x495f('0x15')]);}logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x2a90c0[_0x495f('0x13')]['message']);return _0x508c3d(_0x2a90c0[_0x495f('0x13')][_0x495f('0x15')]);}else{logger['info'](_0x495f('0xf'),_0x48c225,_0x495f('0x10'));_0x508c3d(_0x2a90c0[_0x495f('0x16')]['message']);}})[_0x495f('0x17')](function(_0x3dc481){logger[_0x495f('0x13')](_0x495f('0xf'),_0x48c225,_0x3dc481);_0x2b6d9d(_0x3dc481);});});} \ No newline at end of file +var _0x535f=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result'];(function(_0x42aef9,_0x421926){var _0xe23e6d=function(_0x4e42bd){while(--_0x4e42bd){_0x42aef9['push'](_0x42aef9['shift']());}};_0xe23e6d(++_0x421926);}(_0x535f,0x160));var _0xf535=function(_0x582ae6,_0x57aa08){_0x582ae6=_0x582ae6-0x0;var _0x303447=_0x535f[_0x582ae6];return _0x303447;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf535('0x0'));var BPromise=require(_0xf535('0x1'));var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require(_0xf535('0x3'));var db=require(_0xf535('0x4'))['db'];var utils=require(_0xf535('0x5'));var logger=require(_0xf535('0x6'))(_0xf535('0x7'));var config=require(_0xf535('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf535('0x9')][_0xf535('0xa')]({'port':0x232a});config[_0xf535('0xb')]=_[_0xf535('0xc')](config[_0xf535('0xb')],{'host':_0xf535('0xd'),'port':0x18eb});var socket=require(_0xf535('0xe'))(new Redis(config[_0xf535('0xb')]));require(_0xf535('0xf'))[_0xf535('0x10')](socket);function respondWithRpcPromise(_0x82b02c,_0x297142,_0x7d35fa){return new BPromise(function(_0xdf7b71,_0x255044){return client['request'](_0x82b02c,_0x7d35fa)[_0xf535('0x11')](function(_0x1f9fda){logger[_0xf535('0x12')]('ChatGroup,\x20%s,\x20%s',_0x297142,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x297142,_0xf535('0x13'),JSON[_0xf535('0x14')](_0x1f9fda));if(_0x1f9fda['error']){if(_0x1f9fda[_0xf535('0x15')][_0xf535('0x16')]===0x1f4){logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1f9fda[_0xf535('0x15')][_0xf535('0x18')]);return _0x255044(_0x1f9fda['error']['message']);}logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1f9fda[_0xf535('0x15')][_0xf535('0x18')]);return _0xdf7b71(_0x1f9fda['error'][_0xf535('0x18')]);}else{logger[_0xf535('0x12')]('ChatGroup,\x20%s,\x20%s',_0x297142,_0xf535('0x13'));_0xdf7b71(_0x1f9fda[_0xf535('0x19')][_0xf535('0x18')]);}})[_0xf535('0x1a')](function(_0x1df29f){logger[_0xf535('0x15')](_0xf535('0x17'),_0x297142,_0x1df29f);_0x255044(_0x1df29f);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e910dca..68f1e15 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 _0x2cb5=['save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x2cb5,0x1b0));var _0x52cb=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x2cb5[_0x51e79c];return _0x2467be;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x52cb('0x0'),_0x52cb('0x1'),_0x52cb('0x2')];function createListener(_0x4578ea,_0x1faed8){return function(_0x5e60bb){_0x1faed8[_0x52cb('0x3')](_0x4578ea,_0x5e60bb);};}function removeListener(_0x5637d8,_0x26f59c){return function(){ChatGroupEvents[_0x52cb('0x4')](_0x5637d8,_0x26f59c);};}exports[_0x52cb('0x5')]=function(_0x5f1188){for(var _0xfc9b54=0x0,_0x212013=events[_0x52cb('0x6')];_0xfc9b54<_0x212013;_0xfc9b54++){var _0x4df8fd=events[_0xfc9b54];var _0x5084e0=createListener(_0x52cb('0x7')+_0x4df8fd,_0x5f1188);ChatGroupEvents['on'](_0x4df8fd,_0x5084e0);}}; \ No newline at end of file +var _0x7e8c=['register','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x1f6245,_0x2a3251){var _0x4abdf7=function(_0x447d72){while(--_0x447d72){_0x1f6245['push'](_0x1f6245['shift']());}};_0x4abdf7(++_0x2a3251);}(_0x7e8c,0x12f));var _0xc7e8=function(_0x53661b,_0x13b52){_0x53661b=_0x53661b-0x0;var _0x141bf1=_0x7e8c[_0x53661b];return _0x141bf1;};'use strict';var ChatGroupEvents=require(_0xc7e8('0x0'));var events=[_0xc7e8('0x1'),_0xc7e8('0x2'),_0xc7e8('0x3')];function createListener(_0x3f21e8,_0x521fa3){return function(_0x692d31){_0x521fa3[_0xc7e8('0x4')](_0x3f21e8,_0x692d31);};}function removeListener(_0xd7c9c8,_0x3f0387){return function(){ChatGroupEvents['removeListener'](_0xd7c9c8,_0x3f0387);};}exports[_0xc7e8('0x5')]=function(_0x267083){for(var _0x1e6533=0x0,_0x46f496=events['length'];_0x1e6533<_0x46f496;_0x1e6533++){var _0x245bfe=events[_0x1e6533];var _0x27da62=createListener(_0xc7e8('0x6')+_0x245bfe,_0x267083);ChatGroupEvents['on'](_0x245bfe,_0x27da62);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 09cafa8..a54bc48 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 _0x8cab=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','describe','/:id','show','isAuthenticated','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','multer'];(function(_0x5d31f3,_0x4239b0){var _0x1cc88c=function(_0x1be8fc){while(--_0x1be8fc){_0x5d31f3['push'](_0x5d31f3['shift']());}};_0x1cc88c(++_0x4239b0);}(_0x8cab,0x1db));var _0xb8ca=function(_0x4a7cff,_0x9f76a5){_0x4a7cff=_0x4a7cff-0x0;var _0x2f2263=_0x8cab[_0x4a7cff];return _0x2f2263;};'use strict';var multer=require(_0xb8ca('0x0'));var util=require(_0xb8ca('0x1'));var path=require(_0xb8ca('0x2'));var timeout=require(_0xb8ca('0x3'));var express=require('express');var router=express[_0xb8ca('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb8ca('0x5'));var interaction=require(_0xb8ca('0x6'));var config=require(_0xb8ca('0x7'));var controller=require(_0xb8ca('0x8'));router[_0xb8ca('0x9')]('/',auth['isAuthenticated'](),controller[_0xb8ca('0xa')]);router[_0xb8ca('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xb8ca('0xb')]);router[_0xb8ca('0x9')](_0xb8ca('0xc'),auth['isAuthenticated'](),controller[_0xb8ca('0xd')]);router[_0xb8ca('0x9')]('/:id/unread',auth[_0xb8ca('0xe')](),controller[_0xb8ca('0xf')]);router['get'](_0xb8ca('0x10'),auth[_0xb8ca('0xe')](),controller[_0xb8ca('0x11')]);router[_0xb8ca('0x9')](_0xb8ca('0x12'),auth[_0xb8ca('0xe')](),controller['getMessages']);router[_0xb8ca('0x13')]('/',auth[_0xb8ca('0xe')](),controller[_0xb8ca('0x14')]);router['post'](_0xb8ca('0x10'),auth[_0xb8ca('0xe')](),controller[_0xb8ca('0x15')]);router['post'](_0xb8ca('0x12'),auth['isAuthenticated'](),controller[_0xb8ca('0x16')]);router['put'](_0xb8ca('0xc'),auth['isAuthenticated'](),controller[_0xb8ca('0x17')]);router[_0xb8ca('0x18')](_0xb8ca('0xc'),auth[_0xb8ca('0xe')](),controller[_0xb8ca('0x19')]);router[_0xb8ca('0x18')](_0xb8ca('0x10'),auth['isAuthenticated'](),controller[_0xb8ca('0x1a')]);module[_0xb8ca('0x1b')]=router; \ No newline at end of file +var _0x6f9b=['fs-extra','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','/:id/members','getMessages','post','create','addMembers','/:id/messages','put','delete','exports','multer','util','path','express','Router'];(function(_0x2108c5,_0x5649ee){var _0x2711ff=function(_0x465b26){while(--_0x465b26){_0x2108c5['push'](_0x2108c5['shift']());}};_0x2711ff(++_0x5649ee);}(_0x6f9b,0x16b));var _0xb6f9=function(_0x2a790f,_0x49a9b9){_0x2a790f=_0x2a790f-0x0;var _0x25ee56=_0x6f9b[_0x2a790f];return _0x25ee56;};'use strict';var multer=require(_0xb6f9('0x0'));var util=require(_0xb6f9('0x1'));var path=require(_0xb6f9('0x2'));var timeout=require('connect-timeout');var express=require(_0xb6f9('0x3'));var router=express[_0xb6f9('0x4')]();var fs_extra=require(_0xb6f9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6f9('0x6'));router[_0xb6f9('0x7')]('/',auth[_0xb6f9('0x8')](),controller[_0xb6f9('0x9')]);router[_0xb6f9('0x7')](_0xb6f9('0xa'),auth['isAuthenticated'](),controller[_0xb6f9('0xb')]);router[_0xb6f9('0x7')]('/:id',auth[_0xb6f9('0x8')](),controller[_0xb6f9('0xc')]);router['get'](_0xb6f9('0xd'),auth[_0xb6f9('0x8')](),controller['getUnread']);router[_0xb6f9('0x7')](_0xb6f9('0xe'),auth[_0xb6f9('0x8')](),controller['getMembers']);router[_0xb6f9('0x7')]('/:id/messages',auth[_0xb6f9('0x8')](),controller[_0xb6f9('0xf')]);router[_0xb6f9('0x10')]('/',auth['isAuthenticated'](),controller[_0xb6f9('0x11')]);router['post'](_0xb6f9('0xe'),auth[_0xb6f9('0x8')](),controller[_0xb6f9('0x12')]);router[_0xb6f9('0x10')](_0xb6f9('0x13'),auth[_0xb6f9('0x8')](),controller['addMessage']);router[_0xb6f9('0x14')]('/:id',auth[_0xb6f9('0x8')](),controller['update']);router[_0xb6f9('0x15')]('/:id',auth[_0xb6f9('0x8')](),controller['destroy']);router[_0xb6f9('0x15')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0xb6f9('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6c858d1..520f212 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 _0xc686=['BOOLEAN','ENUM','thumb','star','TEXT','STRING','DATE','out'];(function(_0x20ab89,_0x530b96){var _0xb456ad=function(_0x5f2bb1){while(--_0x5f2bb1){_0x20ab89['push'](_0x20ab89['shift']());}};_0xb456ad(++_0x530b96);}(_0xc686,0x148));var _0x6c68=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc686[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x6c68('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6c68('0x1')]('star',_0x6c68('0x2')),'defaultValue':_0x6c68('0x3')},'ratingMessage':{'type':Sequelize[_0x6c68('0x4')]},'pathTranscript':{'type':Sequelize[_0x6c68('0x4')]},'mailTranscript':{'type':Sequelize[_0x6c68('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6c68('0x6')]},'disposition':{'type':Sequelize[_0x6c68('0x5')]},'secondDisposition':{'type':Sequelize[_0x6c68('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6c68('0x5')]},'note':{'type':Sequelize[_0x6c68('0x5')]},'browserName':{'type':Sequelize[_0x6c68('0x5')]},'browserVersion':{'type':Sequelize[_0x6c68('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6c68('0x5')]},'deviceModel':{'type':Sequelize[_0x6c68('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x6c68('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6c68('0x5')]},'formData':{'type':Sequelize[_0x6c68('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x6c68('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6c68('0x1')]('in',_0x6c68('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x6c68('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x867f=['sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','out'];(function(_0x170b30,_0xfbeb58){var _0x49f408=function(_0x40d018){while(--_0x40d018){_0x170b30['push'](_0x170b30['shift']());}};_0x49f408(++_0xfbeb58);}(_0x867f,0xdc));var _0xf867=function(_0x547640,_0x579b2a){_0x547640=_0x547640-0x0;var _0x481c2a=_0x867f[_0x547640];return _0x481c2a;};'use strict';var Sequelize=require(_0xf867('0x0'));module[_0xf867('0x1')]={'closed':{'type':Sequelize[_0xf867('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xf867('0x3')](_0xf867('0x4'),_0xf867('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf867('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0xf867('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf867('0x8')]},'disposition':{'type':Sequelize[_0xf867('0x7')]},'secondDisposition':{'type':Sequelize[_0xf867('0x7')]},'thirdDisposition':{'type':Sequelize[_0xf867('0x7')]},'note':{'type':Sequelize[_0xf867('0x7')]},'browserName':{'type':Sequelize[_0xf867('0x7')]},'browserVersion':{'type':Sequelize[_0xf867('0x7')]},'osName':{'type':Sequelize[_0xf867('0x7')]},'osVersion':{'type':Sequelize[_0xf867('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xf867('0x7')]},'referer':{'type':Sequelize[_0xf867('0x6')]},'customerIp':{'type':Sequelize[_0xf867('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xf867('0x8')]},'lastMsgAt':{'type':Sequelize[_0xf867('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf867('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf867('0x7')]},'customerPort':{'type':Sequelize[_0xf867('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xf867('0x6')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7fae4ed..6a91679 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 _0xe0ca=['json','update','destroy','end','stack','name','send','merge','body','agent','interaction','account','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','chat','user','catch','show','params','ChatInteraction','query','keys','filters','intersection','attributes','fields','length','model','include','options','find','describe','createVidaooSession','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooMetadata','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','create','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','Unauthorized','findOne','attachId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','format','%s%d','Visitor','agentIdentifier','website_alias','agentAlias','System','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','MailAccount','MailServerOut','Smtp','CloudProvider','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','getMyMessages','secret','includeAgent','push','rows','addTags','setTags','spread','Tag','color','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','Contact','firstName','Attachment','createdAt','Account','Owner','get','mkdirSync','Chat','closedAt','disposition','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','direction','out','lastName','read','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xe0ca,0xa6));var _0xae0c=function(_0x4361b6,_0x414635){_0x4361b6=_0x4361b6-0x0;var _0x4c6878=_0xe0ca[_0x4361b6];return _0x4c6878;};'use strict';var rimraf=require(_0xae0c('0x0'));var zipdir=require(_0xae0c('0x1'));var rp=require('request-promise');var moment=require(_0xae0c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xae0c('0x3'));var util=require(_0xae0c('0x4'));var path=require(_0xae0c('0x5'));var ejs=require(_0xae0c('0x6'));var fs=require('fs');var _=require(_0xae0c('0x7'));var Redis=require('ioredis');var interaction=require(_0xae0c('0x8'));var qs=require(_0xae0c('0x9'));var pdf=require(_0xae0c('0xa'));var logger=require(_0xae0c('0xb'))(_0xae0c('0xc'));var config=require('../../config/environment');var db=require(_0xae0c('0xd'))['db'];config[_0xae0c('0xe')]=_[_0xae0c('0xf')](config['redis'],{'host':_0xae0c('0x10'),'port':0x18eb});var socket=require(_0xae0c('0x11'))(new Redis(config[_0xae0c('0xe')]));require(_0xae0c('0x12'))[_0xae0c('0x13')](socket);var jayson=require(_0xae0c('0x14'));var client=jayson[_0xae0c('0x15')][_0xae0c('0x16')]({'port':0x232b});var client9004=jayson[_0xae0c('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x787979,_0x2d1f7e,_0x3f2abd,_0x395a26){return new BPromise(function(_0x149a58,_0xb15bfc){var _0x50bd02=_0x395a26||client;return _0x50bd02[_0xae0c('0x17')](_0x787979,_0x3f2abd)[_0xae0c('0x18')](function(_0x4cd957){logger['info'](_0xae0c('0x19'),_0x2d1f7e,'request\x20sent');logger[_0xae0c('0x1a')](_0xae0c('0x1b'),_0x2d1f7e,_0xae0c('0x1c'),JSON[_0xae0c('0x1d')](_0x4cd957));if(_0x4cd957[_0xae0c('0x1e')]){if(_0x4cd957['error'][_0xae0c('0x1f')]===0x1f4){logger[_0xae0c('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x2d1f7e,_0x4cd957['error']['message']);return _0xb15bfc(_0x4cd957[_0xae0c('0x1e')][_0xae0c('0x20')]);}logger[_0xae0c('0x1e')](_0xae0c('0x19'),_0x2d1f7e,_0x4cd957[_0xae0c('0x1e')][_0xae0c('0x20')]);return _0x149a58(_0x4cd957[_0xae0c('0x1e')][_0xae0c('0x20')]);}else{logger[_0xae0c('0x21')](_0xae0c('0x19'),_0x2d1f7e,_0xae0c('0x1c'));_0x149a58(_0x4cd957[_0xae0c('0x22')][_0xae0c('0x20')]);}})['catch'](function(_0x1bd6ef){logger[_0xae0c('0x1e')](_0xae0c('0x19'),_0x2d1f7e,_0x1bd6ef);_0xb15bfc(_0x1bd6ef);});});}function respondWithStatusCode(_0x2f5ade,_0x45c4fd){_0x45c4fd=_0x45c4fd||0xcc;return function(_0x2eee49){if(_0x2eee49){return _0x2f5ade[_0xae0c('0x23')](_0x45c4fd);}return _0x2f5ade['status'](_0x45c4fd)['end']();};}function respondWithResult(_0x3931bf,_0x4e056e){_0x4e056e=_0x4e056e||0xc8;return function(_0x1ea4f0){if(_0x1ea4f0){return _0x3931bf[_0xae0c('0x24')](_0x4e056e)['json'](_0x1ea4f0);}};}function respondWithFilteredResult(_0x5cf888,_0x4dbee0){return function(_0x479e1c){if(_0x479e1c){var _0x6955ac=typeof _0x4dbee0[_0xae0c('0x25')]===_0xae0c('0x26')&&typeof _0x4dbee0[_0xae0c('0x27')]===_0xae0c('0x26');var _0x4f31ef=_0x479e1c[_0xae0c('0x28')];var _0x25a68f=_0x6955ac?0x0:_0x4dbee0['offset'];var _0x4b4d5e=_0x6955ac?_0x479e1c[_0xae0c('0x28')]:_0x4dbee0[_0xae0c('0x25')]+_0x4dbee0[_0xae0c('0x27')];var _0x1d091e;if(_0x4b4d5e>=_0x4f31ef){_0x4b4d5e=_0x4f31ef;_0x1d091e=0xc8;}else{_0x1d091e=0xce;}_0x5cf888[_0xae0c('0x24')](_0x1d091e);return _0x5cf888[_0xae0c('0x29')](_0xae0c('0x2a'),_0x25a68f+'-'+_0x4b4d5e+'/'+_0x4f31ef)[_0xae0c('0x2b')](_0x479e1c);}return null;};}function saveUpdates(_0x3c3484){return function(_0x2cabe){if(_0x2cabe){return _0x2cabe[_0xae0c('0x2c')](_0x3c3484)['then'](function(_0x3769b5){return _0x3769b5;});}return null;};}function removeEntity(_0x4e327){return function(_0x576af4){if(_0x576af4){return _0x576af4[_0xae0c('0x2d')]()[_0xae0c('0x18')](function(){_0x4e327[_0xae0c('0x24')](0xcc)[_0xae0c('0x2e')]();});}};}function handleEntityNotFound(_0x3b0757){return function(_0x2341ac){if(!_0x2341ac){_0x3b0757['sendStatus'](0x194);}return _0x2341ac;};}function handleError(_0x388d79,_0x22335b){_0x22335b=_0x22335b||0x1f4;return function(_0x2f7791){logger[_0xae0c('0x1e')](_0x2f7791[_0xae0c('0x2f')]);if(_0x2f7791['name']){delete _0x2f7791[_0xae0c('0x30')];}_0x388d79[_0xae0c('0x24')](_0x22335b)[_0xae0c('0x31')](_0x2f7791);};}function getMustacheRender(_0x5e59f5,_0x27f34c){return Mustache['render'](_0x5e59f5,_[_0xae0c('0x32')](_0x27f34c[_0xae0c('0x33')],{'contact':_0x27f34c['contact'],'message':_0x27f34c[_0xae0c('0x20')],'agent':_0x27f34c[_0xae0c('0x34')],'interaction':_0x27f34c[_0xae0c('0x35')],'account':_0x27f34c[_0xae0c('0x36')]}))||'';}exports[_0xae0c('0x37')]=function(_0x466006,_0x4d8b9d){var _0x2147c8={};var _0x1eee7b=_[_0xae0c('0x38')](db['ChatInteraction'][_0xae0c('0x39')],function(_0x3b250d){return{'name':_0x3b250d[_0xae0c('0x3a')],'type':_0x3b250d[_0xae0c('0x3b')][_0xae0c('0x3c')]};});_0x2147c8=qs[_0xae0c('0x3d')](_0x1eee7b,_0x466006);return interaction[_0xae0c('0x3e')](_0xae0c('0x3f'),_0x466006['query'],_0x466006[_0xae0c('0x40')],_0x2147c8,_0x1eee7b)['then'](respondWithFilteredResult(_0x4d8b9d,_0x2147c8))[_0xae0c('0x41')](handleError(_0x4d8b9d,null));};exports[_0xae0c('0x42')]=function(_0x13cccb,_0x1f5906){var _0x5753ba={'raw':![],'where':{'id':_0x13cccb[_0xae0c('0x43')]['id']}},_0x28aab6={};_0x28aab6['model']=_['keys'](db[_0xae0c('0x44')][_0xae0c('0x39')]);_0x28aab6[_0xae0c('0x45')]=_[_0xae0c('0x46')](_0x13cccb[_0xae0c('0x45')]);_0x28aab6[_0xae0c('0x47')]=_[_0xae0c('0x48')](_0x28aab6['model'],_0x28aab6[_0xae0c('0x45')]);_0x5753ba[_0xae0c('0x49')]=_['intersection'](_0x28aab6['model'],qs[_0xae0c('0x4a')](_0x13cccb[_0xae0c('0x45')]['fields']));_0x5753ba[_0xae0c('0x49')]=_0x5753ba['attributes'][_0xae0c('0x4b')]?_0x5753ba[_0xae0c('0x49')]:_0x28aab6[_0xae0c('0x4c')];if(_0x13cccb[_0xae0c('0x45')]['includeAll']){_0x5753ba[_0xae0c('0x4d')]=[{'all':!![]}];}_0x5753ba=_[_0xae0c('0x32')]({},_0x5753ba,_0x13cccb[_0xae0c('0x4e')]);return db[_0xae0c('0x44')][_0xae0c('0x4f')](_0x5753ba)[_0xae0c('0x18')](handleEntityNotFound(_0x1f5906,null))[_0xae0c('0x18')](respondWithResult(_0x1f5906,null))['catch'](handleError(_0x1f5906,null));};exports['create']=function(_0x5f365c,_0x3f9fcf){return db['ChatInteraction']['create'](_0x5f365c[_0xae0c('0x33')],{})[_0xae0c('0x18')](respondWithResult(_0x3f9fcf,0xc9))[_0xae0c('0x41')](handleError(_0x3f9fcf,null));};exports['update']=function(_0x339ba7,_0x42d5b2){if(_0x339ba7[_0xae0c('0x33')]['id']){delete _0x339ba7[_0xae0c('0x33')]['id'];}return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x339ba7[_0xae0c('0x43')]['id']}})[_0xae0c('0x18')](handleEntityNotFound(_0x42d5b2,null))[_0xae0c('0x18')](saveUpdates(_0x339ba7['body'],null))['then'](respondWithResult(_0x42d5b2,null))[_0xae0c('0x41')](handleError(_0x42d5b2,null));};exports['destroy']=function(_0x1e0923,_0x4428e3){return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x1e0923[_0xae0c('0x43')]['id']}})[_0xae0c('0x18')](handleEntityNotFound(_0x4428e3,null))[_0xae0c('0x18')](removeEntity(_0x4428e3,null))['catch'](handleError(_0x4428e3,null));};exports[_0xae0c('0x50')]=function(_0x275079,_0x225354){return db[_0xae0c('0x44')]['describe']()[_0xae0c('0x18')](respondWithResult(_0x225354,null))[_0xae0c('0x41')](handleError(_0x225354,null));};exports[_0xae0c('0x51')]=function(_0x1b6ef0,_0x1251da){var _0x3af4e3=_0x1b6ef0[_0xae0c('0x43')]['id'];var _0x4d5214;var _0xde79eb;var _0x35eaad;return db[_0xae0c('0x44')]['findOne']({'where':{'id':_0x3af4e3}})[_0xae0c('0x18')](function(_0x2eeb5f){_0x4d5214=_0x2eeb5f;return db[_0xae0c('0x52')]['findOne']({'where':{'id':_0x2eeb5f[_0xae0c('0x53')]},'attributes':['id',_0xae0c('0x54'),'vidaooEscalation',_0xae0c('0x55'),'vidaooNote',_0xae0c('0x56')],'raw':!![]});})[_0xae0c('0x18')](function(_0x5976f6){if(_0x5976f6&&_0x5976f6[_0xae0c('0x54')]&&_0x5976f6['vidaooEscalation']){_0xde79eb=_0x5976f6;var _0x4364d8={'interaction':{'id':_0x3af4e3},'agent':{'id':_0x1b6ef0['user']['id'],'name':_0x1b6ef0[_0xae0c('0x40')][_0xae0c('0x30')],'fullname':_0x1b6ef0[_0xae0c('0x40')]['fullname'],'email':_0x1b6ef0[_0xae0c('0x40')][_0xae0c('0x57')]},'contact':_0x1b6ef0[_0xae0c('0x33')]['contact'],'account':_0x1b6ef0[_0xae0c('0x33')]['account']};var _0x402751={'rejectUnauthorized':![],'method':'POST','url':_0xae0c('0x58'),'headers':{'X-APIKEY':_0x5976f6[_0xae0c('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x1b6ef0[_0xae0c('0x40')][_0xae0c('0x57')]],'buttons':null,'topic':_0xde79eb['vidaooTopic'],'note':_['isNull'](_0xde79eb[_0xae0c('0x59')])?null:getMustacheRender(_0xde79eb[_0xae0c('0x59')],_0x4364d8),'metadata':null},'redirect':_0xae0c('0x5a'),'json':!![]};try{if(!_[_0xae0c('0x5b')](_0xde79eb['vidaooMetadata'])){var _0x239c89=getMustacheRender(_0xde79eb[_0xae0c('0x56')],_0x4364d8);var _0x1515b1=JSON['parse'](_0x239c89);_0x402751['body']['metadata']=_0x1515b1;}}catch(_0x58401f){throw new db[(_0xae0c('0x5c'))][(_0xae0c('0x5d'))](_0xae0c('0x5e'));}return rp(_0x402751);}else{throw new db[(_0xae0c('0x5c'))][(_0xae0c('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xae0c('0x18')](function(_0xabb524){_0x35eaad=_0xabb524;if(_0x35eaad['id']){var _0x37e8a5={'body':_0x35eaad[_0xae0c('0x5f')],'ChatWebsiteId':_0xde79eb['id'],'ChatInteractionId':_0x4d5214['id'],'direction':'out','UserId':_0x1b6ef0[_0xae0c('0x40')]['id']};return db['ChatMessage'][_0xae0c('0x60')](_0x37e8a5,{});}else{throw new db[(_0xae0c('0x5c'))][(_0xae0c('0x5d'))](_0xae0c('0x61'));}})[_0xae0c('0x18')](function(){return _0x4d5214[_0xae0c('0x62')]({'vidaooSessionId':_0x35eaad['id']});})[_0xae0c('0x18')](respondWithResult(_0x1251da,null))[_0xae0c('0x41')](handleError(_0x1251da,null));};exports['customUpdate']=function(_0x1f13d0,_0x500c24){if(_0x1f13d0[_0xae0c('0x33')]['id']){delete _0x1f13d0[_0xae0c('0x33')]['id'];}return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x1f13d0[_0xae0c('0x43')]['id']},'include':[{'model':db[_0xae0c('0x63')],'as':'Contact'}]})[_0xae0c('0x18')](handleEntityNotFound(_0x500c24,null))[_0xae0c('0x18')](saveUpdates(_0x1f13d0[_0xae0c('0x33')],null))[_0xae0c('0x18')](respondWithResult(_0x500c24,null))['catch'](handleError(_0x500c24,null));};exports[_0xae0c('0x64')]=function(_0x592f80,_0x3abcb9){if(_0x592f80[_0xae0c('0x33')]['id']){delete _0x592f80[_0xae0c('0x33')]['id'];}return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x592f80[_0xae0c('0x43')]['id']}})[_0xae0c('0x18')](function(_0x37f6ba){if(!_0x37f6ba){logger[_0xae0c('0x1e')](_0xae0c('0x65'),_0xae0c('0x64'),0x194,_0xae0c('0x66'));_0x3abcb9[_0xae0c('0x23')](0x194);}else{if(_0x37f6ba[_0xae0c('0x67')]){throw new db['Sequelize']['ValidationError'](_0xae0c('0x68'));}}return _0x37f6ba;})[_0xae0c('0x18')](function(_0x4252a1){if(_0x4252a1){return _0x4252a1[_0xae0c('0x2c')]({'closed':_0x592f80['body'][_0xae0c('0x69')],'disposition':_0x592f80[_0xae0c('0x33')]['disposition']})[_0xae0c('0x18')](function(_0x57e672){return _0x57e672;});}})[_0xae0c('0x18')](function(){return respondWithRpcPromise('AbandonInteraction',_0xae0c('0x64'),_0x592f80[_0xae0c('0x33')],client9004);})['then'](respondWithResult(_0x3abcb9,null))[_0xae0c('0x41')](handleError(_0x3abcb9,null));};exports[_0xae0c('0x6a')]=function(_0x4e21cc,_0x4d941f){_0x4e21cc[_0xae0c('0x33')][_0xae0c('0x30')]=_0x4e21cc['file'][_0xae0c('0x6b')];_0x4e21cc[_0xae0c('0x33')][_0xae0c('0x6c')]=_0x4e21cc[_0xae0c('0x6d')][_0xae0c('0x6e')];_0x4e21cc[_0xae0c('0x33')][_0xae0c('0x3b')]=_0x4e21cc['file'][_0xae0c('0x6f')];return db['Attachment'][_0xae0c('0x60')](_0x4e21cc['body'])[_0xae0c('0x18')](respondWithResult(_0x4d941f,0xc9))['catch'](handleError(_0x4d941f,null));};exports[_0xae0c('0x70')]=function(_0x54df85,_0x254716){return db[_0xae0c('0x44')]['findOne']({'where':{'id':_0x54df85['params']['id']},'raw':!![]})[_0xae0c('0x18')](handleEntityNotFound(_0x254716,null))[_0xae0c('0x18')](function(_0x16efcb){if(_0x16efcb){if(_0x16efcb[_0xae0c('0x69')]){return _0x254716['status'](0x193)[_0xae0c('0x2b')]({'status':0x193,'message':_0xae0c('0x71')});}return db['Attachment'][_0xae0c('0x72')]({'where':{'id':_0x54df85['query'][_0xae0c('0x73')]},'raw':!![]})[_0xae0c('0x18')](handleEntityNotFound(_0x254716,null));}})[_0xae0c('0x18')](function(_0x1943cf){if(_0x1943cf){var _0x22bf3e=_0x1943cf['ChatOfflineMessageId']!==null;var _0x1dff8c=path[_0xae0c('0x74')](config[_0xae0c('0x75')],'server/files/attachments/');if(_0x22bf3e){_0x1dff8c=path['join'](_0x1dff8c,_0xae0c('0x76'));}var _0x230c05=path[_0xae0c('0x74')](_0x1dff8c,_0x1943cf[_0xae0c('0x6c')]);return _0x254716[_0xae0c('0x77')](_0x230c05);}})[_0xae0c('0x41')](handleError(_0x254716,null));};exports['close']=function(_0xc2637e,_0x59c260){var _0x5938e9=null;var _0x200ff5=null;var _0x5f0b7e=null;if(_0xc2637e[_0xae0c('0x33')]['id']){delete _0xc2637e[_0xae0c('0x33')]['id'];}if(_0xc2637e['body'][_0xae0c('0x78')]){_0x5f0b7e=path[_0xae0c('0x74')](config[_0xae0c('0x75')],_0xae0c('0x79'),util['format'](_0xae0c('0x7a'),Date['now']()));_0xc2637e[_0xae0c('0x33')][_0xae0c('0x7b')]=_0x5f0b7e;}return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0xc2637e[_0xae0c('0x43')]['id']},'include':[{'model':db[_0xae0c('0x7c')],'as':_0xae0c('0x7d'),'include':[{'model':db[_0xae0c('0x7e')],'as':_0xae0c('0x7e')}]}]})[_0xae0c('0x18')](handleEntityNotFound(_0x59c260,null))['then'](saveUpdates(_0xc2637e['body'],null))[_0xae0c('0x18')](function(_0x5ca7e7){if(_0x5ca7e7){_0x5938e9=_0x5ca7e7;return db[_0xae0c('0x52')]['find']({'where':{'id':_0x5938e9[_0xae0c('0x53')]}});}})[_0xae0c('0x18')](function(_0x47c56c){if(_0x47c56c){_0x200ff5=_0x47c56c;return db[_0xae0c('0x63')]['find']({'where':{'id':_0x5938e9['ContactId']}});}})[_0xae0c('0x18')](function(_0x12258f){if(_0x12258f){if(_0x5f0b7e){var _0x116399=null;for(var _0x552b56=0x1;_0x552b56<_0x5938e9[_0xae0c('0x7d')][_0xae0c('0x4b')];++_0x552b56){_0x116399=_0x5938e9[_0xae0c('0x7d')][_0x552b56];var _0x4b2940=_0x116399[_0xae0c('0x67')]?util[_0xae0c('0x7f')](_0xae0c('0x80'),_0x200ff5['agentAlias'],_0x116399[_0xae0c('0x67')]):'System';var _0x575cc1=_0xc2637e[_0xae0c('0x33')]['customer']||util[_0xae0c('0x7f')](_0xae0c('0x80'),_0xae0c('0x81'),_0x116399['ContactId']);switch(_0x200ff5[_0xae0c('0x82')]){case _0xae0c('0x83'):_0x4b2940=_0x116399[_0xae0c('0x67')]?util['format'](_0xae0c('0x80'),_0x200ff5[_0xae0c('0x84')],_0x116399['UserId']):_0xae0c('0x85');break;case _0xae0c('0x86'):_0x4b2940=_0x116399[_0xae0c('0x67')]?_0x116399[_0xae0c('0x7e')][_0xae0c('0x87')]||_0x116399[_0xae0c('0x7e')][_0xae0c('0x88')]:_0xae0c('0x85');break;case'agent_fullname':_0x4b2940=_0x116399['UserId']?_0x116399[_0xae0c('0x7e')][_0xae0c('0x88')]:'System';break;default:_0x4b2940=_0x116399[_0xae0c('0x67')]?util[_0xae0c('0x7f')](_0xae0c('0x80'),_0x200ff5[_0xae0c('0x84')],_0x116399['UserId']):_0xae0c('0x85');}var _0x14bec6=util[_0xae0c('0x7f')](_0xae0c('0x89'),moment(_0x116399['createdAt'])[_0xae0c('0x7f')](_0xae0c('0x8a')),_0x116399['direction']==='in'?_0x575cc1:_0x4b2940,_0x116399[_0xae0c('0x33')]);if(!_0x116399['secret']){fs['appendFileSync'](_0x5f0b7e,_0x14bec6);}}return db[_0xae0c('0x8b')][_0xae0c('0x72')]({'where':{'service':!![]},'include':[{'model':db[_0xae0c('0x8c')],'as':_0xae0c('0x8d'),'raw':!![],'include':[{'model':db[_0xae0c('0x8e')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xae0c('0x18')](function(_0x1ac68f){if(!_0x1ac68f||!_0x1ac68f[_0xae0c('0x8d')]||!_0xc2637e['body'])return _0x5938e9;var _0xf63f85=_0x1ac68f['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0xae0c('0x8f'),{'account':_0xf63f85,'message':{'from':util[_0xae0c('0x7f')](_0xae0c('0x90'),_0x1ac68f[_0xae0c('0x30')],_0x1ac68f[_0xae0c('0x57')]||_0x1ac68f[_0xae0c('0x8d')][_0xae0c('0x40')]),'to':_0xc2637e['body'][_0xae0c('0x78')],'subject':'Mail\x20Transcript','text':util[_0xae0c('0x7f')](_0xae0c('0x91'),_0xc2637e[_0xae0c('0x33')]['mailTranscript']),'attachments':[{'path':_0x5f0b7e}]}})[_0xae0c('0x18')](function(){return _0x5938e9;})['catch'](function(_0x1b4fca){logger[_0xae0c('0x1e')](_0x1b4fca);});})['then'](respondWithStatusCode(_0x59c260,0xc8))[_0xae0c('0x41')](handleError(_0x59c260,null));};exports[_0xae0c('0x92')]=function(_0x75738f,_0x18a578){return db['ChatMessage'][_0xae0c('0x4f')]({'where':{'id':_0x75738f['params']['id']}})[_0xae0c('0x18')](handleEntityNotFound(_0x18a578,null))[_0xae0c('0x18')](function(_0x5a416f){if(_0x5a416f){return _0x5a416f[_0xae0c('0x92')](_0x75738f[_0xae0c('0x33')][_0xae0c('0x93')],_[_0xae0c('0x94')](_0x75738f[_0xae0c('0x33')],[_0xae0c('0x93'),'id'])||{});}})[_0xae0c('0x18')](respondWithResult(_0x18a578,null))[_0xae0c('0x41')](handleError(_0x18a578,null));};exports[_0xae0c('0x95')]=function(_0x51733b,_0x318cc8){var _0x13774b={'raw':![],'where':{}};var _0x1bdab1={};var _0x42c47f={'count':0x0,'rows':[]};return db[_0xae0c('0x44')][_0xae0c('0x72')]({'where':{'id':_0x51733b[_0xae0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x318cc8,null))['then'](function(_0x3d5d91){if(_0x3d5d91){_0x1bdab1[_0xae0c('0x4c')]=_[_0xae0c('0x46')](db['ChatMessage'][_0xae0c('0x39')]);_0x1bdab1['query']=_[_0xae0c('0x46')](_0x51733b[_0xae0c('0x45')]);_0x1bdab1['filters']=_['intersection'](_0x1bdab1[_0xae0c('0x4c')],_0x1bdab1['query']);_0x13774b[_0xae0c('0x49')]=_[_0xae0c('0x48')](_0x1bdab1[_0xae0c('0x4c')],qs[_0xae0c('0x4a')](_0x51733b[_0xae0c('0x45')][_0xae0c('0x4a')]));_0x13774b['attributes']=_0x13774b[_0xae0c('0x49')]['length']?_0x13774b[_0xae0c('0x49')]:_0x1bdab1[_0xae0c('0x4c')];if(!_0x51733b[_0xae0c('0x45')][_0xae0c('0x96')]('nolimit')){_0x13774b[_0xae0c('0x27')]=qs[_0xae0c('0x27')](_0x51733b[_0xae0c('0x45')][_0xae0c('0x27')]);_0x13774b[_0xae0c('0x25')]=qs['offset'](_0x51733b[_0xae0c('0x45')][_0xae0c('0x25')]);}_0x13774b[_0xae0c('0x97')]=qs[_0xae0c('0x98')](_0x51733b['query']['sort']);_0x13774b[_0xae0c('0x99')]=qs['filters'](_[_0xae0c('0x9a')](_0x51733b['query'],_0x1bdab1['filters']));_0x13774b[_0xae0c('0x99')][_0xae0c('0x9b')]=_0x3d5d91['id'];if(_0x51733b[_0xae0c('0x45')]['filter']){_0x13774b[_0xae0c('0x99')]=_[_0xae0c('0x32')](_0x13774b['where'],{'$or':_[_0xae0c('0x38')](_0x13774b[_0xae0c('0x49')],function(_0x176ef5){var _0x501049={};_0x501049[_0x176ef5]={'$like':'%'+_0x51733b[_0xae0c('0x45')][_0xae0c('0x9c')]+'%'};return _0x501049;})});}if(_0x51733b[_0xae0c('0x45')][_0xae0c('0x9d')]){var _0x67db73=_0x51733b['query']['$gte']['split'](',');var _0x20d138={};_0x20d138[_0x67db73[0x0]]={'$gte':moment(_0x67db73[0x1])[_0xae0c('0x7f')](_0xae0c('0x9e'))};_0x13774b[_0xae0c('0x99')]=_['merge'](_0x13774b[_0xae0c('0x99')],_0x20d138);}_0x13774b=_[_0xae0c('0x32')]({},_0x13774b,_0x51733b[_0xae0c('0x4e')]);return db[_0xae0c('0x7c')][_0xae0c('0x28')]({'where':_0x13774b[_0xae0c('0x99')]})[_0xae0c('0x18')](function(_0x36228b){_0x42c47f['count']=_0x36228b;if(_0x51733b[_0xae0c('0x45')][_0xae0c('0x9f')]){_0x13774b[_0xae0c('0x4d')]=[{'all':!![]}];}return db[_0xae0c('0x7c')]['findAll'](_0x13774b);})[_0xae0c('0x18')](function(_0x26f83f){_0x42c47f['rows']=_0x26f83f;return _0x42c47f;});}})[_0xae0c('0x18')](respondWithFilteredResult(_0x318cc8,_0x13774b))[_0xae0c('0x41')](handleError(_0x318cc8,null));};exports[_0xae0c('0xa0')]=function(_0x477d34,_0x1c149a){var _0x14f5e9={'where':{}},_0x89b94d={},_0x49c07f={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xae0c('0x72')]({'where':{'id':_0x477d34[_0xae0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x1c149a,null))[_0xae0c('0x18')](function(_0x4f644a){if(_0x4f644a){_0x89b94d['model']=_[_0xae0c('0x46')](db[_0xae0c('0x7c')][_0xae0c('0x39')]);_0x89b94d[_0xae0c('0x45')]=_[_0xae0c('0x46')](_0x477d34['query']);_0x89b94d['filters']=_[_0xae0c('0x48')](_0x89b94d[_0xae0c('0x4c')],_0x89b94d['query']);_0x14f5e9[_0xae0c('0x49')]=_[_0xae0c('0x48')](_0x89b94d[_0xae0c('0x4c')],qs[_0xae0c('0x4a')](_0x477d34[_0xae0c('0x45')][_0xae0c('0x4a')]));_0x14f5e9[_0xae0c('0x49')]=_0x14f5e9['attributes']['length']?_0x14f5e9[_0xae0c('0x49')]:_0x89b94d[_0xae0c('0x4c')];if(!_0x477d34[_0xae0c('0x45')]['hasOwnProperty']('nolimit')){_0x14f5e9['limit']=qs['limit'](_0x477d34[_0xae0c('0x45')]['limit']);_0x14f5e9[_0xae0c('0x25')]=qs['offset'](_0x477d34[_0xae0c('0x45')][_0xae0c('0x25')]);}_0x14f5e9['order']=qs[_0xae0c('0x98')](_0x477d34['query'][_0xae0c('0x98')]);_0x14f5e9['where']=qs[_0xae0c('0x47')](_['pick'](_0x477d34[_0xae0c('0x45')],_0x89b94d[_0xae0c('0x47')]));_0x14f5e9[_0xae0c('0x99')][_0xae0c('0x9b')]=_0x4f644a['id'];if(_0x477d34['query'][_0xae0c('0x9c')]){_0x14f5e9[_0xae0c('0x99')]=_[_0xae0c('0x32')](_0x14f5e9[_0xae0c('0x99')],{'$or':_[_0xae0c('0x38')](_0x14f5e9[_0xae0c('0x49')],function(_0x4af0af){var _0x5f0944={};_0x5f0944[_0x4af0af]={'$like':'%'+_0x477d34[_0xae0c('0x45')]['filter']+'%'};return _0x5f0944;})});}_0x14f5e9[_0xae0c('0x99')][_0xae0c('0xa1')]=![];if(_0x477d34[_0xae0c('0x45')]['id']){_0x14f5e9[_0xae0c('0x99')]['id']={'$gt':_0x477d34['query']['id']};}_0x14f5e9=_[_0xae0c('0x32')]({},_0x14f5e9,_0x477d34[_0xae0c('0x4e')]);return db[_0xae0c('0x7c')]['count']({'where':_0x14f5e9[_0xae0c('0x99')]})[_0xae0c('0x18')](function(_0x4b853e){_0x49c07f[_0xae0c('0x28')]=_0x4b853e;_0x14f5e9['include']=[];if(_0x477d34[_0xae0c('0x45')][_0xae0c('0xa2')]){_0x14f5e9['include'][_0xae0c('0xa3')]({'model':db['User'],'as':_0xae0c('0x7e'),'attributes':['id',_0xae0c('0x88'),'alias']});}if(_0x477d34[_0xae0c('0x45')][_0xae0c('0x9f')]){_0x14f5e9[_0xae0c('0x4d')]=[{'all':!![]}];}return db[_0xae0c('0x7c')][_0xae0c('0x3e')](_0x14f5e9);})[_0xae0c('0x18')](function(_0x58673b){_0x49c07f[_0xae0c('0xa4')]=_0x58673b;return _0x49c07f;});}})[_0xae0c('0x18')](respondWithFilteredResult(_0x1c149a,_0x14f5e9))[_0xae0c('0x41')](handleError(_0x1c149a,null));};exports[_0xae0c('0xa5')]=function(_0x327ec3,_0x273895){return db[_0xae0c('0x44')]['find']({'where':{'id':_0x327ec3[_0xae0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x273895,null))['then'](function(_0x34ab7e){if(_0x34ab7e){return _0x34ab7e[_0xae0c('0xa6')](_0x327ec3['body']['ids'],_[_0xae0c('0x94')](_0x327ec3[_0xae0c('0x33')],[_0xae0c('0x93'),'id'])||{})[_0xae0c('0xa7')](function(){return db[_0xae0c('0xa8')][_0xae0c('0x3e')]({'attributes':['id',_0xae0c('0x30'),_0xae0c('0xa9')],'where':{'id':_0x327ec3[_0xae0c('0x33')][_0xae0c('0x93')]}});})['then'](function(_0x5ba4d5){socket['emit'](_0xae0c('0xaa'),{'id':Number(_0x327ec3[_0xae0c('0x43')]['id']),'tags':_0x5ba4d5||[]});return{'id':Number(_0x327ec3[_0xae0c('0x43')]['id']),'tags':_0x5ba4d5||[]};});}})[_0xae0c('0x18')](respondWithResult(_0x273895,null))['catch'](handleError(_0x273895,null));};exports[_0xae0c('0xab')]=function(_0x453cc8,_0x488f60){return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x453cc8[_0xae0c('0x43')]['id']}})['then'](handleEntityNotFound(_0x488f60,null))[_0xae0c('0x18')](function(_0x407050){if(_0x407050){return _0x407050['removeTags'](_0x453cc8['query'][_0xae0c('0x93')]);}})[_0xae0c('0x18')](respondWithStatusCode(_0x488f60,null))[_0xae0c('0x41')](handleError(_0x488f60,null));};exports[_0xae0c('0x77')]=function(_0x43c5bc,_0x16c435){var _0x5a031b=moment()[_0xae0c('0xac')]()[_0xae0c('0xad')]();var _0x2d0ec8=path['join'](config[_0xae0c('0x75')],_0xae0c('0xae'),_0xae0c('0xaf'),_0xae0c('0xb0'));var _0x4293b6=path[_0xae0c('0x74')](config[_0xae0c('0x75')],_0xae0c('0xae'),'files',_0xae0c('0xb1'));var _0xee9059=path['join'](_0x2d0ec8,_0x5a031b);var _0xa7ffc=util[_0xae0c('0x7f')]('transcript-%d-%s.zip',_0x43c5bc['params']['id'],_0x5a031b);var _0x26a317=path[_0xae0c('0x74')](_0x2d0ec8,_0xa7ffc);var _0x395fa9=[];_0x395fa9[_0xae0c('0xa3')]({'model':db['User'],'as':_0xae0c('0x7e'),'attributes':['id',_0xae0c('0x88')],'raw':!![]});_0x395fa9['push']({'model':db[_0xae0c('0x63')],'as':_0xae0c('0xb2'),'attributes':['id',_0xae0c('0xb3'),'lastName'],'raw':!![]});if(_0x43c5bc['query']['attachments']){_0x395fa9['push']({'model':db[_0xae0c('0xb4')],'as':_0xae0c('0xb4'),'raw':!![]});}var _0x38d743=[{'model':db['ChatMessage'],'as':_0xae0c('0x7d'),'attributes':['id',_0xae0c('0x33'),_0xae0c('0xb5'),'direction',_0xae0c('0xa1'),'read'],'include':_0x395fa9}];_0x38d743[_0xae0c('0xa3')]({'model':db[_0xae0c('0x52')],'as':_0xae0c('0xb6'),'attributes':['id',_0xae0c('0x30')]});_0x38d743[_0xae0c('0xa3')]({'model':db[_0xae0c('0x7e')],'as':_0xae0c('0xb7'),'attributes':['id',_0xae0c('0x88')]});return db[_0xae0c('0x44')][_0xae0c('0x4f')]({'where':{'id':_0x43c5bc[_0xae0c('0x43')]['id']},'include':_0x38d743})[_0xae0c('0x18')](handleEntityNotFound(_0x16c435,null))[_0xae0c('0x18')](function(_0x467c1b){if(_0x467c1b){var _0x1aaf96=_0x467c1b[_0xae0c('0xb8')]({'plain':!![]});fs[_0xae0c('0xb9')](_0xee9059);var _0x4564f2={'channel':_0xae0c('0xba'),'account':_0x1aaf96[_0xae0c('0xb6')][_0xae0c('0x30')],'agent':_0x1aaf96[_0xae0c('0xb7')]?_0x1aaf96['Owner']['fullname']:'N.A.','createdAt':moment(_0x1aaf96[_0xae0c('0xb5')])[_0xae0c('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x1aaf96[_0xae0c('0x69')]?moment(_0x1aaf96[_0xae0c('0xbb')])['format'](_0xae0c('0x9e'))[_0xae0c('0xad')]():'','disposition':_0x1aaf96[_0xae0c('0xbc')],'chatInfo':{'browser':_0x1aaf96['browserName'],'os':_0x1aaf96[_0xae0c('0xbd')],'referer':_0x1aaf96[_0xae0c('0xbe')],'customerIp':_0x1aaf96[_0xae0c('0xbf')],'customerPort':_0x1aaf96[_0xae0c('0xc0')]?_0x1aaf96[_0xae0c('0xc0')]:_0xae0c('0xc1')},'messages':_(_0x1aaf96[_0xae0c('0x7d')])[_0xae0c('0xc2')]()[_0xae0c('0x9c')]({'secret':![]})[_0xae0c('0x38')](function(_0x479d6a){if(_0x479d6a[_0xae0c('0xb4')]){var _0x5ac9a5=path[_0xae0c('0x74')](_0x4293b6,_0x479d6a['Attachment']['basename']);if(fs[_0xae0c('0xc3')](_0x5ac9a5)){fs[_0xae0c('0xc4')](_0x5ac9a5)[_0xae0c('0xc5')](fs[_0xae0c('0xc6')](path[_0xae0c('0x74')](_0xee9059,_0x479d6a[_0xae0c('0xb4')][_0xae0c('0x6c')])));}}return{'date':moment(_0x479d6a[_0xae0c('0xb5')])[_0xae0c('0x7f')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae0c('0xad')](),'sender':_0x479d6a[_0xae0c('0xc7')]===_0xae0c('0xc8')?_0x479d6a[_0xae0c('0x7e')]?_0x479d6a[_0xae0c('0x7e')][_0xae0c('0x88')]:_0xae0c('0x85'):_0x479d6a[_0xae0c('0xb2')][_0xae0c('0xb3')]+(_0x479d6a[_0xae0c('0xb2')][_0xae0c('0xc9')]?'\x20'+_0x479d6a[_0xae0c('0xb2')][_0xae0c('0xc9')]:''),'body':_0x479d6a[_0xae0c('0xb4')]?_0x479d6a[_0xae0c('0xb4')]['basename']:_0x479d6a[_0xae0c('0x33')],'direction':_0x479d6a[_0xae0c('0xc7')]==='out'?'A':'C','secret':_0x479d6a[_0xae0c('0xa1')],'read':_0x479d6a[_0xae0c('0xca')],'attachment':_0x479d6a[_0xae0c('0xb4')]};})['value']()};return ejs[_0xae0c('0xcb')](path[_0xae0c('0x74')](config[_0xae0c('0x75')],_0xae0c('0xae'),'views',_0xae0c('0xcc')),{'interaction':_0x4564f2})[_0xae0c('0x18')](function(_0x37b51f){var _0x327acf=path['join'](_0xee9059,'transcript-'+_0x1aaf96['id']+'-'+_0x5a031b+_0xae0c('0xcd'));var _0x2f89a7={'path':_0x327acf,'channel':_0xae0c('0xba'),'interactionId':_0x1aaf96['id']};return pdf[_0xae0c('0xce')](_0x37b51f,_0x2f89a7);})['then'](function(){return new Promise(function(_0x5312cf,_0x344f0e){zipdir(_0xee9059,{'saveTo':_0x26a317},function(_0x4835cb,_0x14f827){if(_0x4835cb)return _0x344f0e(_0x4835cb);return _0x5312cf(_0x14f827);});})[_0xae0c('0x18')](function(){return new BPromise(function(_0x52d15e,_0x5eb292){rimraf(_0xee9059,function(_0x2739a9){if(_0x2739a9)_0x5eb292(_0x2739a9);return _0x52d15e();});});})['then'](function(){return _0x16c435[_0xae0c('0x77')](_0x26a317,_0xa7ffc,function(_0xf486e7){if(_0xf486e7){logger[_0xae0c('0x1e')](_0xae0c('0xcf'),_0xf486e7);}else{fs[_0xae0c('0xd0')](_0x26a317);}});});});}else{return _0x16c435[_0xae0c('0x23')](0xc8);}})[_0xae0c('0x41')](handleError(_0x16c435,null));}; \ No newline at end of file +var _0x496b=['out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','basename','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','customer','format','Visitor','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','secret','MailAccount','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','findAll','rows','getMyMessages','pick','include','includeAgent','push','addTags','setTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','direction','Account','Owner','mkdirSync','Chat','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','tail','map','createReadStream','read','renderFile','downloadInteraction.ejs','.pdf','err','rimraf','request-promise','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','then','destroy','stack','name','send','render','merge','body','contact','agent','interaction','index','ChatInteraction','rawAttributes','fieldName','type','key','chat','show','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','options','find','create','update','describe','ChatWebsite','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','user','fullname','email','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration'];(function(_0xe50179,_0x27eeee){var _0x54ce23=function(_0x5c1020){while(--_0x5c1020){_0xe50179['push'](_0xe50179['shift']());}};_0x54ce23(++_0x27eeee);}(_0x496b,0x73));var _0xb496=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x496b[_0x13ce0c];return _0x4388fb;};'use strict';var rimraf=require(_0xb496('0x0'));var zipdir=require('zip-dir');var rp=require(_0xb496('0x1'));var moment=require(_0xb496('0x2'));var BPromise=require(_0xb496('0x3'));var Mustache=require('mustache');var util=require(_0xb496('0x4'));var path=require(_0xb496('0x5'));var ejs=require(_0xb496('0x6'));var fs=require('fs');var _=require(_0xb496('0x7'));var Redis=require(_0xb496('0x8'));var interaction=require(_0xb496('0x9'));var qs=require(_0xb496('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0xb496('0xb'))(_0xb496('0xc'));var config=require(_0xb496('0xd'));var db=require(_0xb496('0xe'))['db'];config[_0xb496('0xf')]=_['defaults'](config[_0xb496('0xf')],{'host':_0xb496('0x10'),'port':0x18eb});var socket=require(_0xb496('0x11'))(new Redis(config['redis']));require(_0xb496('0x12'))[_0xb496('0x13')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xb496('0x14')]({'port':0x232b});var client9004=jayson[_0xb496('0x15')][_0xb496('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x312d8f,_0x3ddaa8,_0x5b2b87,_0x46c798){return new BPromise(function(_0x45daf2,_0x35d843){var _0x8c6b90=_0x46c798||client;return _0x8c6b90[_0xb496('0x16')](_0x312d8f,_0x5b2b87)['then'](function(_0x169faa){logger[_0xb496('0x17')](_0xb496('0x18'),_0x3ddaa8,_0xb496('0x19'));logger['debug'](_0xb496('0x1a'),_0x3ddaa8,'request\x20sent',JSON['stringify'](_0x169faa));if(_0x169faa[_0xb496('0x1b')]){if(_0x169faa['error'][_0xb496('0x1c')]===0x1f4){logger[_0xb496('0x1b')](_0xb496('0x18'),_0x3ddaa8,_0x169faa[_0xb496('0x1b')][_0xb496('0x1d')]);return _0x35d843(_0x169faa['error']['message']);}logger[_0xb496('0x1b')](_0xb496('0x18'),_0x3ddaa8,_0x169faa['error'][_0xb496('0x1d')]);return _0x45daf2(_0x169faa[_0xb496('0x1b')][_0xb496('0x1d')]);}else{logger[_0xb496('0x17')](_0xb496('0x18'),_0x3ddaa8,'request\x20sent');_0x45daf2(_0x169faa[_0xb496('0x1e')][_0xb496('0x1d')]);}})[_0xb496('0x1f')](function(_0x500e3d){logger[_0xb496('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x3ddaa8,_0x500e3d);_0x35d843(_0x500e3d);});});}function respondWithStatusCode(_0x40c4c6,_0x2a0c5b){_0x2a0c5b=_0x2a0c5b||0xcc;return function(_0x4bf449){if(_0x4bf449){return _0x40c4c6[_0xb496('0x20')](_0x2a0c5b);}return _0x40c4c6[_0xb496('0x21')](_0x2a0c5b)[_0xb496('0x22')]();};}function respondWithResult(_0x4f06d9,_0x52f142){_0x52f142=_0x52f142||0xc8;return function(_0x4f5e1b){if(_0x4f5e1b){return _0x4f06d9[_0xb496('0x21')](_0x52f142)[_0xb496('0x23')](_0x4f5e1b);}};}function respondWithFilteredResult(_0x2b3eec,_0x2a7a43){return function(_0xfcff08){if(_0xfcff08){var _0x4c360b=typeof _0x2a7a43[_0xb496('0x24')]===_0xb496('0x25')&&typeof _0x2a7a43[_0xb496('0x26')]===_0xb496('0x25');var _0x4d9806=_0xfcff08['count'];var _0x2b7bfd=_0x4c360b?0x0:_0x2a7a43[_0xb496('0x24')];var _0x9d0f5b=_0x4c360b?_0xfcff08['count']:_0x2a7a43[_0xb496('0x24')]+_0x2a7a43[_0xb496('0x26')];var _0x411fb4;if(_0x9d0f5b>=_0x4d9806){_0x9d0f5b=_0x4d9806;_0x411fb4=0xc8;}else{_0x411fb4=0xce;}_0x2b3eec[_0xb496('0x21')](_0x411fb4);return _0x2b3eec[_0xb496('0x27')]('Content-Range',_0x2b7bfd+'-'+_0x9d0f5b+'/'+_0x4d9806)[_0xb496('0x23')](_0xfcff08);}return null;};}function saveUpdates(_0x403ca7){return function(_0xd93643){if(_0xd93643){return _0xd93643['update'](_0x403ca7)[_0xb496('0x28')](function(_0x597e35){return _0x597e35;});}return null;};}function removeEntity(_0x1bcb8a){return function(_0xdd8085){if(_0xdd8085){return _0xdd8085[_0xb496('0x29')]()['then'](function(){_0x1bcb8a[_0xb496('0x21')](0xcc)[_0xb496('0x22')]();});}};}function handleEntityNotFound(_0x125c3f){return function(_0x2a8244){if(!_0x2a8244){_0x125c3f['sendStatus'](0x194);}return _0x2a8244;};}function handleError(_0x53a553,_0x77dac9){_0x77dac9=_0x77dac9||0x1f4;return function(_0x2cb0e3){logger[_0xb496('0x1b')](_0x2cb0e3[_0xb496('0x2a')]);if(_0x2cb0e3[_0xb496('0x2b')]){delete _0x2cb0e3['name'];}_0x53a553['status'](_0x77dac9)[_0xb496('0x2c')](_0x2cb0e3);};}function getMustacheRender(_0x4ee8c4,_0x4c9377){return Mustache[_0xb496('0x2d')](_0x4ee8c4,_[_0xb496('0x2e')](_0x4c9377[_0xb496('0x2f')],{'contact':_0x4c9377[_0xb496('0x30')],'message':_0x4c9377['message'],'agent':_0x4c9377[_0xb496('0x31')],'interaction':_0x4c9377[_0xb496('0x32')],'account':_0x4c9377['account']}))||'';}exports[_0xb496('0x33')]=function(_0x5eaa7f,_0x3be30b){var _0x5a19af={};var _0x591064=_['map'](db[_0xb496('0x34')][_0xb496('0x35')],function(_0x120ec5){return{'name':_0x120ec5[_0xb496('0x36')],'type':_0x120ec5[_0xb496('0x37')][_0xb496('0x38')]};});_0x5a19af=qs['getOptions'](_0x591064,_0x5eaa7f);return interaction['findAll'](_0xb496('0x39'),_0x5eaa7f['query'],_0x5eaa7f['user'],_0x5a19af,_0x591064)[_0xb496('0x28')](respondWithFilteredResult(_0x3be30b,_0x5a19af))[_0xb496('0x1f')](handleError(_0x3be30b,null));};exports[_0xb496('0x3a')]=function(_0x169283,_0x28a14c){var _0x346332={'raw':![],'where':{'id':_0x169283[_0xb496('0x3b')]['id']}},_0x274714={};_0x274714[_0xb496('0x3c')]=_[_0xb496('0x3d')](db[_0xb496('0x34')]['rawAttributes']);_0x274714[_0xb496('0x3e')]=_[_0xb496('0x3d')](_0x169283[_0xb496('0x3e')]);_0x274714[_0xb496('0x3f')]=_['intersection'](_0x274714['model'],_0x274714[_0xb496('0x3e')]);_0x346332[_0xb496('0x40')]=_[_0xb496('0x41')](_0x274714[_0xb496('0x3c')],qs['fields'](_0x169283['query'][_0xb496('0x42')]));_0x346332[_0xb496('0x40')]=_0x346332['attributes'][_0xb496('0x43')]?_0x346332[_0xb496('0x40')]:_0x274714[_0xb496('0x3c')];if(_0x169283[_0xb496('0x3e')][_0xb496('0x44')]){_0x346332['include']=[{'all':!![]}];}_0x346332=_[_0xb496('0x2e')]({},_0x346332,_0x169283[_0xb496('0x45')]);return db[_0xb496('0x34')][_0xb496('0x46')](_0x346332)[_0xb496('0x28')](handleEntityNotFound(_0x28a14c,null))[_0xb496('0x28')](respondWithResult(_0x28a14c,null))[_0xb496('0x1f')](handleError(_0x28a14c,null));};exports['create']=function(_0x576a20,_0x36805b){return db['ChatInteraction'][_0xb496('0x47')](_0x576a20[_0xb496('0x2f')],{})[_0xb496('0x28')](respondWithResult(_0x36805b,0xc9))[_0xb496('0x1f')](handleError(_0x36805b,null));};exports[_0xb496('0x48')]=function(_0x3856a7,_0x23e4ec){if(_0x3856a7['body']['id']){delete _0x3856a7[_0xb496('0x2f')]['id'];}return db[_0xb496('0x34')]['find']({'where':{'id':_0x3856a7[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x23e4ec,null))[_0xb496('0x28')](saveUpdates(_0x3856a7['body'],null))['then'](respondWithResult(_0x23e4ec,null))[_0xb496('0x1f')](handleError(_0x23e4ec,null));};exports['destroy']=function(_0x5e76f2,_0x1fbecb){return db[_0xb496('0x34')]['find']({'where':{'id':_0x5e76f2['params']['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x1fbecb,null))['then'](removeEntity(_0x1fbecb,null))[_0xb496('0x1f')](handleError(_0x1fbecb,null));};exports[_0xb496('0x49')]=function(_0x4a5d1a,_0x3b56b2){return db[_0xb496('0x34')][_0xb496('0x49')]()[_0xb496('0x28')](respondWithResult(_0x3b56b2,null))['catch'](handleError(_0x3b56b2,null));};exports['createVidaooSession']=function(_0x21073d,_0x49e6c8){var _0x27119a=_0x21073d[_0xb496('0x3b')]['id'];var _0x612150;var _0xe55ec0;var _0x486d5f;return db[_0xb496('0x34')]['findOne']({'where':{'id':_0x27119a}})[_0xb496('0x28')](function(_0x8fa863){_0x612150=_0x8fa863;return db[_0xb496('0x4a')][_0xb496('0x4b')]({'where':{'id':_0x8fa863[_0xb496('0x4c')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xb496('0x4d'),_0xb496('0x4e'),_0xb496('0x4f')],'raw':!![]});})[_0xb496('0x28')](function(_0x386562){if(_0x386562&&_0x386562[_0xb496('0x50')]&&_0x386562['vidaooEscalation']){_0xe55ec0=_0x386562;var _0x44be22={'interaction':{'id':_0x27119a},'agent':{'id':_0x21073d[_0xb496('0x51')]['id'],'name':_0x21073d[_0xb496('0x51')][_0xb496('0x2b')],'fullname':_0x21073d['user'][_0xb496('0x52')],'email':_0x21073d[_0xb496('0x51')][_0xb496('0x53')]},'contact':_0x21073d['body']['contact'],'account':_0x21073d[_0xb496('0x2f')][_0xb496('0x54')]};var _0x14a348={'rejectUnauthorized':![],'method':_0xb496('0x55'),'url':_0xb496('0x56'),'headers':{'X-APIKEY':_0x386562[_0xb496('0x50')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x21073d[_0xb496('0x51')][_0xb496('0x53')]],'buttons':null,'topic':_0xe55ec0[_0xb496('0x4d')],'note':_[_0xb496('0x57')](_0xe55ec0['vidaooNote'])?null:getMustacheRender(_0xe55ec0[_0xb496('0x4e')],_0x44be22),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb496('0x57')](_0xe55ec0[_0xb496('0x4f')])){var _0x42d0c9=getMustacheRender(_0xe55ec0['vidaooMetadata'],_0x44be22);var _0x3362ae=JSON[_0xb496('0x58')](_0x42d0c9);_0x14a348['body'][_0xb496('0x59')]=_0x3362ae;}}catch(_0x1500b6){throw new db[(_0xb496('0x5a'))][(_0xb496('0x5b'))](_0xb496('0x5c'));}return rp(_0x14a348);}else{throw new db[(_0xb496('0x5a'))][(_0xb496('0x5b'))](_0xb496('0x5d'));}})[_0xb496('0x28')](function(_0xe070f7){_0x486d5f=_0xe070f7;if(_0x486d5f['id']){var _0x2caebd={'body':_0x486d5f['join_url'],'ChatWebsiteId':_0xe55ec0['id'],'ChatInteractionId':_0x612150['id'],'direction':_0xb496('0x5e'),'UserId':_0x21073d[_0xb496('0x51')]['id']};return db[_0xb496('0x5f')][_0xb496('0x47')](_0x2caebd,{});}else{throw new db[(_0xb496('0x5a'))]['ValidationError'](_0xb496('0x60'));}})[_0xb496('0x28')](function(){return _0x612150[_0xb496('0x61')]({'vidaooSessionId':_0x486d5f['id']});})['then'](respondWithResult(_0x49e6c8,null))[_0xb496('0x1f')](handleError(_0x49e6c8,null));};exports[_0xb496('0x62')]=function(_0x539223,_0x4471de){if(_0x539223[_0xb496('0x2f')]['id']){delete _0x539223['body']['id'];}return db[_0xb496('0x34')][_0xb496('0x46')]({'where':{'id':_0x539223[_0xb496('0x3b')]['id']},'include':[{'model':db['CmContact'],'as':_0xb496('0x63')}]})['then'](handleEntityNotFound(_0x4471de,null))[_0xb496('0x28')](saveUpdates(_0x539223[_0xb496('0x2f')],null))['then'](respondWithResult(_0x4471de,null))['catch'](handleError(_0x4471de,null));};exports['abandon']=function(_0x41d088,_0x2ef38b){if(_0x41d088[_0xb496('0x2f')]['id']){delete _0x41d088['body']['id'];}return db[_0xb496('0x34')][_0xb496('0x46')]({'where':{'id':_0x41d088[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](function(_0x811fbd){if(!_0x811fbd){logger[_0xb496('0x1b')](_0xb496('0x64'),'abandon',0x194,_0xb496('0x65'));_0x2ef38b[_0xb496('0x20')](0x194);}else{if(_0x811fbd[_0xb496('0x66')]){throw new db[(_0xb496('0x5a'))][(_0xb496('0x5b'))](_0xb496('0x67'));}}return _0x811fbd;})['then'](function(_0x41565b){if(_0x41565b){return _0x41565b[_0xb496('0x48')]({'closed':_0x41d088[_0xb496('0x2f')][_0xb496('0x68')],'disposition':_0x41d088[_0xb496('0x2f')]['disposition']})[_0xb496('0x28')](function(_0x4784be){return _0x4784be;});}})['then'](function(){return respondWithRpcPromise(_0xb496('0x69'),'abandon',_0x41d088[_0xb496('0x2f')],client9004);})[_0xb496('0x28')](respondWithResult(_0x2ef38b,null))[_0xb496('0x1f')](handleError(_0x2ef38b,null));};exports['attachmentUpload']=function(_0x57d651,_0x5676f4){_0x57d651['body'][_0xb496('0x2b')]=_0x57d651[_0xb496('0x6a')][_0xb496('0x6b')];_0x57d651[_0xb496('0x2f')]['basename']=_0x57d651[_0xb496('0x6a')][_0xb496('0x6c')];_0x57d651[_0xb496('0x2f')][_0xb496('0x37')]=_0x57d651[_0xb496('0x6a')][_0xb496('0x6d')];return db[_0xb496('0x6e')][_0xb496('0x47')](_0x57d651[_0xb496('0x2f')])[_0xb496('0x28')](respondWithResult(_0x5676f4,0xc9))[_0xb496('0x1f')](handleError(_0x5676f4,null));};exports[_0xb496('0x6f')]=function(_0x2aa5cb,_0x2e217b){return db[_0xb496('0x34')][_0xb496('0x4b')]({'where':{'id':_0x2aa5cb[_0xb496('0x3b')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2e217b,null))[_0xb496('0x28')](function(_0x2aa331){if(_0x2aa331){if(_0x2aa331['closed']){return _0x2e217b['status'](0x193)['json']({'status':0x193,'message':_0xb496('0x70')});}return db[_0xb496('0x6e')][_0xb496('0x4b')]({'where':{'id':_0x2aa5cb[_0xb496('0x3e')][_0xb496('0x71')]},'raw':!![]})[_0xb496('0x28')](handleEntityNotFound(_0x2e217b,null));}})['then'](function(_0x15a11c){if(_0x15a11c){var _0x1435ff=_0x15a11c[_0xb496('0x72')]!==null;var _0x4d1e8a=path[_0xb496('0x73')](config[_0xb496('0x74')],_0xb496('0x75'));if(_0x1435ff){_0x4d1e8a=path['join'](_0x4d1e8a,'offline-chat/');}var _0x18c617=path[_0xb496('0x73')](_0x4d1e8a,_0x15a11c[_0xb496('0x76')]);return _0x2e217b[_0xb496('0x77')](_0x18c617);}})[_0xb496('0x1f')](handleError(_0x2e217b,null));};exports[_0xb496('0x78')]=function(_0xfbcd47,_0x444730){var _0x9d3525=null;var _0x3e568b=null;var _0x1a24f5=null;if(_0xfbcd47[_0xb496('0x2f')]['id']){delete _0xfbcd47[_0xb496('0x2f')]['id'];}if(_0xfbcd47[_0xb496('0x2f')][_0xb496('0x79')]){_0x1a24f5=path['join'](config[_0xb496('0x74')],_0xb496('0x7a'),util['format'](_0xb496('0x7b'),Date[_0xb496('0x7c')]()));_0xfbcd47[_0xb496('0x2f')][_0xb496('0x7d')]=_0x1a24f5;}return db[_0xb496('0x34')]['find']({'where':{'id':_0xfbcd47['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0xb496('0x7e'),'include':[{'model':db[_0xb496('0x7f')],'as':'User'}]}]})[_0xb496('0x28')](handleEntityNotFound(_0x444730,null))[_0xb496('0x28')](saveUpdates(_0xfbcd47[_0xb496('0x2f')],null))[_0xb496('0x28')](function(_0x331485){if(_0x331485){_0x9d3525=_0x331485;return db[_0xb496('0x4a')][_0xb496('0x46')]({'where':{'id':_0x9d3525['ChatWebsiteId']}});}})[_0xb496('0x28')](function(_0x495453){if(_0x495453){_0x3e568b=_0x495453;return db['CmContact'][_0xb496('0x46')]({'where':{'id':_0x9d3525[_0xb496('0x80')]}});}})['then'](function(_0x13e2fb){if(_0x13e2fb){if(_0x1a24f5){var _0x14eae2=null;for(var _0x30dd7a=0x1;_0x30dd7a<_0x9d3525[_0xb496('0x7e')][_0xb496('0x43')];++_0x30dd7a){_0x14eae2=_0x9d3525[_0xb496('0x7e')][_0x30dd7a];var _0xb0bd7=_0x14eae2[_0xb496('0x66')]?util['format'](_0xb496('0x81'),_0x3e568b[_0xb496('0x82')],_0x14eae2[_0xb496('0x66')]):_0xb496('0x83');var _0x53214d=_0xfbcd47[_0xb496('0x2f')][_0xb496('0x84')]||util[_0xb496('0x85')]('%s%d',_0xb496('0x86'),_0x14eae2[_0xb496('0x80')]);switch(_0x3e568b['agentIdentifier']){case _0xb496('0x87'):_0xb0bd7=_0x14eae2[_0xb496('0x66')]?util[_0xb496('0x85')](_0xb496('0x81'),_0x3e568b[_0xb496('0x82')],_0x14eae2[_0xb496('0x66')]):_0xb496('0x83');break;case _0xb496('0x88'):_0xb0bd7=_0x14eae2[_0xb496('0x66')]?_0x14eae2['User'][_0xb496('0x89')]||_0x14eae2[_0xb496('0x7f')][_0xb496('0x52')]:_0xb496('0x83');break;case _0xb496('0x8a'):_0xb0bd7=_0x14eae2[_0xb496('0x66')]?_0x14eae2['User'][_0xb496('0x52')]:_0xb496('0x83');break;default:_0xb0bd7=_0x14eae2[_0xb496('0x66')]?util['format']('%s%d',_0x3e568b[_0xb496('0x82')],_0x14eae2[_0xb496('0x66')]):_0xb496('0x83');}var _0x47c77a=util[_0xb496('0x85')](_0xb496('0x8b'),moment(_0x14eae2[_0xb496('0x8c')])[_0xb496('0x85')]('MM/DD/YYYY\x20HH:mm:ss'),_0x14eae2['direction']==='in'?_0x53214d:_0xb0bd7,_0x14eae2[_0xb496('0x2f')]);if(!_0x14eae2[_0xb496('0x8d')]){fs['appendFileSync'](_0x1a24f5,_0x47c77a);}}return db[_0xb496('0x8e')][_0xb496('0x4b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb496('0x8f'),'raw':!![],'include':[{'model':db[_0xb496('0x90')],'as':_0xb496('0x90'),'raw':!![]}]}]});}}})[_0xb496('0x28')](function(_0x3d2983){if(!_0x3d2983||!_0x3d2983[_0xb496('0x8f')]||!_0xfbcd47['body'])return _0x9d3525;var _0x2e5e4d=_0x3d2983[_0xb496('0x91')]();return respondWithRpcPromise(_0xb496('0x92'),_0xb496('0x93'),{'account':_0x2e5e4d,'message':{'from':util[_0xb496('0x85')]('\x22%s\x22\x20<%s>',_0x3d2983[_0xb496('0x2b')],_0x3d2983['email']||_0x3d2983[_0xb496('0x8f')][_0xb496('0x51')]),'to':_0xfbcd47[_0xb496('0x2f')][_0xb496('0x79')],'subject':_0xb496('0x94'),'text':util['format'](_0xb496('0x95'),_0xfbcd47[_0xb496('0x2f')][_0xb496('0x79')]),'attachments':[{'path':_0x1a24f5}]}})[_0xb496('0x28')](function(){return _0x9d3525;})[_0xb496('0x1f')](function(_0x18e4dd){logger[_0xb496('0x1b')](_0x18e4dd);});})[_0xb496('0x28')](respondWithStatusCode(_0x444730,0xc8))[_0xb496('0x1f')](handleError(_0x444730,null));};exports['addMessage']=function(_0x3b6305,_0x5c9726){return db[_0xb496('0x5f')][_0xb496('0x46')]({'where':{'id':_0x3b6305[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x5c9726,null))[_0xb496('0x28')](function(_0x562eb1){if(_0x562eb1){return _0x562eb1[_0xb496('0x96')](_0x3b6305[_0xb496('0x2f')][_0xb496('0x97')],_['omit'](_0x3b6305[_0xb496('0x2f')],['ids','id'])||{});}})[_0xb496('0x28')](respondWithResult(_0x5c9726,null))[_0xb496('0x1f')](handleError(_0x5c9726,null));};exports[_0xb496('0x98')]=function(_0x263f68,_0x43de3c){var _0x179c5a={'raw':![],'where':{}};var _0x3e5af5={};var _0x1307e3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb496('0x4b')]({'where':{'id':_0x263f68[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x43de3c,null))[_0xb496('0x28')](function(_0x285dbb){if(_0x285dbb){_0x3e5af5[_0xb496('0x3c')]=_['keys'](db[_0xb496('0x5f')][_0xb496('0x35')]);_0x3e5af5[_0xb496('0x3e')]=_[_0xb496('0x3d')](_0x263f68[_0xb496('0x3e')]);_0x3e5af5['filters']=_['intersection'](_0x3e5af5[_0xb496('0x3c')],_0x3e5af5[_0xb496('0x3e')]);_0x179c5a[_0xb496('0x40')]=_[_0xb496('0x41')](_0x3e5af5[_0xb496('0x3c')],qs[_0xb496('0x42')](_0x263f68[_0xb496('0x3e')][_0xb496('0x42')]));_0x179c5a['attributes']=_0x179c5a[_0xb496('0x40')]['length']?_0x179c5a[_0xb496('0x40')]:_0x3e5af5[_0xb496('0x3c')];if(!_0x263f68[_0xb496('0x3e')][_0xb496('0x99')](_0xb496('0x9a'))){_0x179c5a['limit']=qs[_0xb496('0x26')](_0x263f68[_0xb496('0x3e')][_0xb496('0x26')]);_0x179c5a[_0xb496('0x24')]=qs[_0xb496('0x24')](_0x263f68['query'][_0xb496('0x24')]);}_0x179c5a[_0xb496('0x9b')]=qs[_0xb496('0x9c')](_0x263f68[_0xb496('0x3e')][_0xb496('0x9c')]);_0x179c5a[_0xb496('0x9d')]=qs['filters'](_['pick'](_0x263f68[_0xb496('0x3e')],_0x3e5af5[_0xb496('0x3f')]));_0x179c5a['where'][_0xb496('0x9e')]=_0x285dbb['id'];if(_0x263f68[_0xb496('0x3e')][_0xb496('0x9f')]){_0x179c5a[_0xb496('0x9d')]=_[_0xb496('0x2e')](_0x179c5a[_0xb496('0x9d')],{'$or':_['map'](_0x179c5a['attributes'],function(_0x6681b8){var _0x5be0c7={};_0x5be0c7[_0x6681b8]={'$like':'%'+_0x263f68['query'][_0xb496('0x9f')]+'%'};return _0x5be0c7;})});}if(_0x263f68[_0xb496('0x3e')][_0xb496('0xa0')]){var _0x3c4079=_0x263f68[_0xb496('0x3e')][_0xb496('0xa0')][_0xb496('0xa1')](',');var _0x440160={};_0x440160[_0x3c4079[0x0]]={'$gte':moment(_0x3c4079[0x1])[_0xb496('0x85')](_0xb496('0xa2'))};_0x179c5a[_0xb496('0x9d')]=_['merge'](_0x179c5a[_0xb496('0x9d')],_0x440160);}_0x179c5a=_[_0xb496('0x2e')]({},_0x179c5a,_0x263f68[_0xb496('0x45')]);return db[_0xb496('0x5f')]['count']({'where':_0x179c5a[_0xb496('0x9d')]})[_0xb496('0x28')](function(_0x3d40f4){_0x1307e3[_0xb496('0xa3')]=_0x3d40f4;if(_0x263f68[_0xb496('0x3e')][_0xb496('0x44')]){_0x179c5a['include']=[{'all':!![]}];}return db[_0xb496('0x5f')][_0xb496('0xa4')](_0x179c5a);})[_0xb496('0x28')](function(_0x5e398a){_0x1307e3[_0xb496('0xa5')]=_0x5e398a;return _0x1307e3;});}})[_0xb496('0x28')](respondWithFilteredResult(_0x43de3c,_0x179c5a))[_0xb496('0x1f')](handleError(_0x43de3c,null));};exports[_0xb496('0xa6')]=function(_0x5c992d,_0x16c150){var _0x4b0083={'where':{}},_0x5b70f1={},_0x51d08e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xb496('0x4b')]({'where':{'id':_0x5c992d[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x16c150,null))[_0xb496('0x28')](function(_0x202e3f){if(_0x202e3f){_0x5b70f1[_0xb496('0x3c')]=_[_0xb496('0x3d')](db[_0xb496('0x5f')][_0xb496('0x35')]);_0x5b70f1[_0xb496('0x3e')]=_['keys'](_0x5c992d[_0xb496('0x3e')]);_0x5b70f1[_0xb496('0x3f')]=_[_0xb496('0x41')](_0x5b70f1[_0xb496('0x3c')],_0x5b70f1['query']);_0x4b0083[_0xb496('0x40')]=_[_0xb496('0x41')](_0x5b70f1[_0xb496('0x3c')],qs[_0xb496('0x42')](_0x5c992d[_0xb496('0x3e')]['fields']));_0x4b0083[_0xb496('0x40')]=_0x4b0083['attributes']['length']?_0x4b0083['attributes']:_0x5b70f1[_0xb496('0x3c')];if(!_0x5c992d['query'][_0xb496('0x99')]('nolimit')){_0x4b0083[_0xb496('0x26')]=qs['limit'](_0x5c992d[_0xb496('0x3e')][_0xb496('0x26')]);_0x4b0083['offset']=qs[_0xb496('0x24')](_0x5c992d['query'][_0xb496('0x24')]);}_0x4b0083[_0xb496('0x9b')]=qs['sort'](_0x5c992d[_0xb496('0x3e')][_0xb496('0x9c')]);_0x4b0083[_0xb496('0x9d')]=qs[_0xb496('0x3f')](_[_0xb496('0xa7')](_0x5c992d[_0xb496('0x3e')],_0x5b70f1['filters']));_0x4b0083[_0xb496('0x9d')][_0xb496('0x9e')]=_0x202e3f['id'];if(_0x5c992d[_0xb496('0x3e')][_0xb496('0x9f')]){_0x4b0083[_0xb496('0x9d')]=_[_0xb496('0x2e')](_0x4b0083[_0xb496('0x9d')],{'$or':_['map'](_0x4b0083[_0xb496('0x40')],function(_0x594326){var _0xa62510={};_0xa62510[_0x594326]={'$like':'%'+_0x5c992d[_0xb496('0x3e')][_0xb496('0x9f')]+'%'};return _0xa62510;})});}_0x4b0083[_0xb496('0x9d')][_0xb496('0x8d')]=![];if(_0x5c992d[_0xb496('0x3e')]['id']){_0x4b0083[_0xb496('0x9d')]['id']={'$gt':_0x5c992d[_0xb496('0x3e')]['id']};}_0x4b0083=_[_0xb496('0x2e')]({},_0x4b0083,_0x5c992d[_0xb496('0x45')]);return db[_0xb496('0x5f')][_0xb496('0xa3')]({'where':_0x4b0083[_0xb496('0x9d')]})[_0xb496('0x28')](function(_0x552704){_0x51d08e[_0xb496('0xa3')]=_0x552704;_0x4b0083[_0xb496('0xa8')]=[];if(_0x5c992d[_0xb496('0x3e')][_0xb496('0xa9')]){_0x4b0083[_0xb496('0xa8')][_0xb496('0xaa')]({'model':db[_0xb496('0x7f')],'as':_0xb496('0x7f'),'attributes':['id',_0xb496('0x52'),_0xb496('0x89')]});}if(_0x5c992d[_0xb496('0x3e')][_0xb496('0x44')]){_0x4b0083[_0xb496('0xa8')]=[{'all':!![]}];}return db[_0xb496('0x5f')]['findAll'](_0x4b0083);})[_0xb496('0x28')](function(_0x5228c2){_0x51d08e[_0xb496('0xa5')]=_0x5228c2;return _0x51d08e;});}})[_0xb496('0x28')](respondWithFilteredResult(_0x16c150,_0x4b0083))[_0xb496('0x1f')](handleError(_0x16c150,null));};exports[_0xb496('0xab')]=function(_0x1d6ce3,_0x5e76dc){return db['ChatInteraction'][_0xb496('0x46')]({'where':{'id':_0x1d6ce3['params']['id']}})['then'](handleEntityNotFound(_0x5e76dc,null))[_0xb496('0x28')](function(_0x5ba307){if(_0x5ba307){return _0x5ba307[_0xb496('0xac')](_0x1d6ce3[_0xb496('0x2f')][_0xb496('0x97')],_[_0xb496('0xad')](_0x1d6ce3[_0xb496('0x2f')],[_0xb496('0x97'),'id'])||{})[_0xb496('0xae')](function(){return db[_0xb496('0xaf')][_0xb496('0xa4')]({'attributes':['id',_0xb496('0x2b'),_0xb496('0xb0')],'where':{'id':_0x1d6ce3[_0xb496('0x2f')][_0xb496('0x97')]}});})[_0xb496('0x28')](function(_0x4f7b3b){socket[_0xb496('0xb1')](_0xb496('0xb2'),{'id':Number(_0x1d6ce3[_0xb496('0x3b')]['id']),'tags':_0x4f7b3b||[]});return{'id':Number(_0x1d6ce3[_0xb496('0x3b')]['id']),'tags':_0x4f7b3b||[]};});}})[_0xb496('0x28')](respondWithResult(_0x5e76dc,null))['catch'](handleError(_0x5e76dc,null));};exports[_0xb496('0xb3')]=function(_0x48e5fd,_0x3b6fe7){return db[_0xb496('0x34')]['find']({'where':{'id':_0x48e5fd[_0xb496('0x3b')]['id']}})[_0xb496('0x28')](handleEntityNotFound(_0x3b6fe7,null))['then'](function(_0x1aa2aa){if(_0x1aa2aa){return _0x1aa2aa[_0xb496('0xb3')](_0x48e5fd[_0xb496('0x3e')][_0xb496('0x97')]);}})[_0xb496('0x28')](respondWithStatusCode(_0x3b6fe7,null))[_0xb496('0x1f')](handleError(_0x3b6fe7,null));};exports[_0xb496('0x77')]=function(_0x28fb01,_0x5ab8d8){var _0x558077=moment()[_0xb496('0xb4')]()[_0xb496('0xb5')]();var _0x3e5882=path[_0xb496('0x73')](config['root'],_0xb496('0xb6'),_0xb496('0xb7'),'tmp');var _0x538831=path[_0xb496('0x73')](config[_0xb496('0x74')],_0xb496('0xb6'),'files',_0xb496('0xb8'));var _0x4c629b=path['join'](_0x3e5882,_0x558077);var _0xef9757=util[_0xb496('0x85')](_0xb496('0xb9'),_0x28fb01['params']['id'],_0x558077);var _0x484ebf=path[_0xb496('0x73')](_0x3e5882,_0xef9757);var _0x514803=[];_0x514803['push']({'model':db[_0xb496('0x7f')],'as':_0xb496('0x7f'),'attributes':['id','fullname'],'raw':!![]});_0x514803[_0xb496('0xaa')]({'model':db[_0xb496('0xba')],'as':'Contact','attributes':['id',_0xb496('0xbb'),_0xb496('0xbc')],'raw':!![]});if(_0x28fb01[_0xb496('0x3e')][_0xb496('0xb8')]){_0x514803[_0xb496('0xaa')]({'model':db[_0xb496('0x6e')],'as':_0xb496('0x6e'),'raw':!![]});}var _0x28f780=[{'model':db['ChatMessage'],'as':_0xb496('0x7e'),'attributes':['id',_0xb496('0x2f'),_0xb496('0x8c'),_0xb496('0xbd'),_0xb496('0x8d'),'read'],'include':_0x514803}];_0x28f780[_0xb496('0xaa')]({'model':db[_0xb496('0x4a')],'as':_0xb496('0xbe'),'attributes':['id','name']});_0x28f780['push']({'model':db['User'],'as':_0xb496('0xbf'),'attributes':['id',_0xb496('0x52')]});return db[_0xb496('0x34')]['find']({'where':{'id':_0x28fb01[_0xb496('0x3b')]['id']},'include':_0x28f780})[_0xb496('0x28')](handleEntityNotFound(_0x5ab8d8,null))['then'](function(_0x4c3eb8){if(_0x4c3eb8){var _0x5738b8=_0x4c3eb8['get']({'plain':!![]});fs[_0xb496('0xc0')](_0x4c629b);var _0xab1592={'channel':_0xb496('0xc1'),'account':_0x5738b8[_0xb496('0xbe')][_0xb496('0x2b')],'agent':_0x5738b8[_0xb496('0xbf')]?_0x5738b8[_0xb496('0xbf')][_0xb496('0x52')]:'N.A.','createdAt':moment(_0x5738b8[_0xb496('0x8c')])[_0xb496('0x85')](_0xb496('0xa2'))['toString'](),'closedAt':_0x5738b8[_0xb496('0x68')]?moment(_0x5738b8[_0xb496('0xc2')])[_0xb496('0x85')](_0xb496('0xa2'))[_0xb496('0xb5')]():'','disposition':_0x5738b8[_0xb496('0xc3')],'chatInfo':{'browser':_0x5738b8[_0xb496('0xc4')],'os':_0x5738b8[_0xb496('0xc5')],'referer':_0x5738b8[_0xb496('0xc6')],'customerIp':_0x5738b8[_0xb496('0xc7')],'customerPort':_0x5738b8[_0xb496('0xc8')]?_0x5738b8[_0xb496('0xc8')]:'N.A.'},'messages':_(_0x5738b8[_0xb496('0x7e')])[_0xb496('0xc9')]()[_0xb496('0x9f')]({'secret':![]})[_0xb496('0xca')](function(_0x18a945){if(_0x18a945[_0xb496('0x6e')]){var _0x30582a=path[_0xb496('0x73')](_0x538831,_0x18a945['Attachment'][_0xb496('0x76')]);if(fs['existsSync'](_0x30582a)){fs[_0xb496('0xcb')](_0x30582a)['pipe'](fs['createWriteStream'](path[_0xb496('0x73')](_0x4c629b,_0x18a945[_0xb496('0x6e')][_0xb496('0x76')])));}}return{'date':moment(_0x18a945[_0xb496('0x8c')])[_0xb496('0x85')](_0xb496('0xa2'))[_0xb496('0xb5')](),'sender':_0x18a945[_0xb496('0xbd')]==='out'?_0x18a945['User']?_0x18a945['User'][_0xb496('0x52')]:_0xb496('0x83'):_0x18a945[_0xb496('0x63')][_0xb496('0xbb')]+(_0x18a945[_0xb496('0x63')][_0xb496('0xbc')]?'\x20'+_0x18a945['Contact'][_0xb496('0xbc')]:''),'body':_0x18a945[_0xb496('0x6e')]?_0x18a945['Attachment'][_0xb496('0x76')]:_0x18a945['body'],'direction':_0x18a945[_0xb496('0xbd')]===_0xb496('0x5e')?'A':'C','secret':_0x18a945[_0xb496('0x8d')],'read':_0x18a945[_0xb496('0xcc')],'attachment':_0x18a945['Attachment']};})['value']()};return ejs[_0xb496('0xcd')](path[_0xb496('0x73')](config[_0xb496('0x74')],_0xb496('0xb6'),'views',_0xb496('0xce')),{'interaction':_0xab1592})[_0xb496('0x28')](function(_0x20b0c7){var _0x3440bb=path[_0xb496('0x73')](_0x4c629b,'transcript-'+_0x5738b8['id']+'-'+_0x558077+_0xb496('0xcf'));var _0x22eaed={'path':_0x3440bb,'channel':_0xb496('0xc1'),'interactionId':_0x5738b8['id']};return pdf['createPdfFromHTML'](_0x20b0c7,_0x22eaed);})[_0xb496('0x28')](function(){return new Promise(function(_0x249f38,_0xc88199){zipdir(_0x4c629b,{'saveTo':_0x484ebf},function(_0x41d308,_0x29e20b){if(_0x41d308)return _0xc88199(_0x41d308);return _0x249f38(_0x29e20b);});})[_0xb496('0x28')](function(){return new BPromise(function(_0x5e1cb6,_0x4e68e1){rimraf(_0x4c629b,function(_0x15119a){if(_0x15119a)_0x4e68e1(_0x15119a);return _0x5e1cb6();});});})[_0xb496('0x28')](function(){return _0x5ab8d8[_0xb496('0x77')](_0x484ebf,_0xef9757,function(_0x3b0dff){if(_0x3b0dff){logger['error'](_0xb496('0xd0'),_0x3b0dff);}else{fs['unlinkSync'](_0x484ebf);}});});});}else{return _0x5ab8d8[_0xb496('0x20')](0xc8);}})[_0xb496('0x1f')](handleError(_0x5ab8d8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f178ee0..783379b 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 _0xd5c2=['save','update','remove','then','setDataValue','Users','map','findAll','length','emit','catch','exports','events','../../mysqldb','ChatMessage'];(function(_0x37ebaf,_0x4d4ad9){var _0x38a0f5=function(_0x4b305c){while(--_0x4b305c){_0x37ebaf['push'](_0x37ebaf['shift']());}};_0x38a0f5(++_0x4d4ad9);}(_0xd5c2,0x192));var _0x2d5c=function(_0x23f08a,_0x33a9db){_0x23f08a=_0x23f08a-0x0;var _0x4a2440=_0xd5c2[_0x23f08a];return _0x4a2440;};'use strict';var EventEmitter=require(_0x2d5c('0x0'));var ChatInteraction=require(_0x2d5c('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x2d5c('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2d5c('0x3'),'afterUpdate':_0x2d5c('0x4'),'afterDestroy':_0x2d5c('0x5')};function emitEvent(_0x4fa63c){return function(_0xc48ec9,_0x158e3c,_0x2cab5d){_0xc48ec9['getUsers']({'attributes':['id'],'raw':!![]})[_0x2d5c('0x6')](function(_0x339c06){_0xc48ec9[_0x2d5c('0x7')](_0x2d5c('0x8'),_0x339c06[_0x2d5c('0x9')](function(_0x1e2042){return{'id':_0x1e2042['id']};}));return ChatMessage[_0x2d5c('0xa')]({'where':{'ChatInteractionId':_0xc48ec9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d5c('0x6')](function(_0x55683f){_0xc48ec9['setDataValue']('unreadMessages',_0x55683f[_0x2d5c('0xb')]);ChatInteractionEvents[_0x2d5c('0xc')](_0x4fa63c+':'+_0xc48ec9['id'],_0xc48ec9);ChatInteractionEvents[_0x2d5c('0xc')](_0x4fa63c,_0xc48ec9);_0x2cab5d(null);})[_0x2d5c('0xd')](_0x2cab5d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x2d5c('0xe')]=ChatInteractionEvents; \ No newline at end of file +var _0xfb5e=['setMaxListeners','save','update','remove','then','Users','setDataValue','unreadMessages','length','emit','catch','hook','exports','ChatInteraction','../../mysqldb'];(function(_0x174e6b,_0x124a26){var _0x10ab0e=function(_0x704225){while(--_0x704225){_0x174e6b['push'](_0x174e6b['shift']());}};_0x10ab0e(++_0x124a26);}(_0xfb5e,0xee));var _0xefb5=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xfb5e[_0x373dee];return _0x46798f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xefb5('0x0')];var ChatMessage=require(_0xefb5('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xefb5('0x2')](0x0);var events={'afterCreate':_0xefb5('0x3'),'afterUpdate':_0xefb5('0x4'),'afterDestroy':_0xefb5('0x5')};function emitEvent(_0x1882da){return function(_0x45b77f,_0x4a0c8d,_0x48f02e){_0x45b77f['getUsers']({'attributes':['id'],'raw':!![]})[_0xefb5('0x6')](function(_0x5c0a23){_0x45b77f['setDataValue'](_0xefb5('0x7'),_0x5c0a23['map'](function(_0x10bbbb){return{'id':_0x10bbbb['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x45b77f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e179e){_0x45b77f[_0xefb5('0x8')](_0xefb5('0x9'),_0x4e179e[_0xefb5('0xa')]);ChatInteractionEvents['emit'](_0x1882da+':'+_0x45b77f['id'],_0x45b77f);ChatInteractionEvents[_0xefb5('0xb')](_0x1882da,_0x45b77f);_0x48f02e(null);})[_0xefb5('0xc')](_0x48f02e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xefb5('0xd')](e,emitEvent(event));}}module[_0xefb5('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 e4227ef..aa8e3e2 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 _0x8a6b=['chat_interactions','closed','format','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction'];(function(_0x43673a,_0x5dd09e){var _0x1eaff5=function(_0x5d08b7){while(--_0x5d08b7){_0x43673a['push'](_0x43673a['shift']());}};_0x1eaff5(++_0x5dd09e);}(_0x8a6b,0x104));var _0xb8a6=function(_0x4da55a,_0x1f9582){_0x4da55a=_0x4da55a-0x0;var _0x54b68b=_0x8a6b[_0x4da55a];return _0x54b68b;};'use strict';var _=require(_0xb8a6('0x0'));var util=require(_0xb8a6('0x1'));var logger=require(_0xb8a6('0x2'))(_0xb8a6('0x3'));var moment=require(_0xb8a6('0x4'));var BPromise=require(_0xb8a6('0x5'));var rp=require(_0xb8a6('0x6'));var fs=require('fs');var path=require(_0xb8a6('0x7'));var rimraf=require(_0xb8a6('0x8'));var config=require('../../config/environment');var attributes=require(_0xb8a6('0x9'));module[_0xb8a6('0xa')]=function(_0x1ceebf,_0x2471b0){return _0x1ceebf['define'](_0xb8a6('0xb'),attributes,{'tableName':_0xb8a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e9199,_0x21ccb6,_0x4267a5){if(_0x4e9199['changed'](_0xb8a6('0xd'))){_0x4e9199['closedAt']=moment()[_0xb8a6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4267a5(null,_0x4e9199);}},'charset':_0xb8a6('0xf'),'collate':_0xb8a6('0x10')});}; \ No newline at end of file +var _0x9f1c=['request-promise','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird'];(function(_0x211f8f,_0x5e123c){var _0x51b812=function(_0x3c5c81){while(--_0x3c5c81){_0x211f8f['push'](_0x211f8f['shift']());}};_0x51b812(++_0x5e123c);}(_0x9f1c,0x83));var _0xc9f1=function(_0x45927b,_0xd1f41b){_0x45927b=_0x45927b-0x0;var _0x440315=_0x9f1c[_0x45927b];return _0x440315;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc9f1('0x0'))(_0xc9f1('0x1'));var moment=require(_0xc9f1('0x2'));var BPromise=require(_0xc9f1('0x3'));var rp=require(_0xc9f1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9f1('0x5'));var config=require('../../config/environment');var attributes=require(_0xc9f1('0x6'));module[_0xc9f1('0x7')]=function(_0x4b3ad9,_0x2f7dbf){return _0x4b3ad9[_0xc9f1('0x8')](_0xc9f1('0x9'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x162de5,_0xe88652,_0x5d05d3){if(_0x162de5['changed'](_0xc9f1('0xa'))){_0x162de5[_0xc9f1('0xb')]=moment()[_0xc9f1('0xc')](_0xc9f1('0xd'));}_0x5d05d3(null,_0x162de5);}},'charset':'utf8mb4','collate':_0xc9f1('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 5dc947c..e0c1768 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 _0xcd62=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','update','body','options','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis'];(function(_0x1f5abe,_0x64d2b6){var _0x1b2708=function(_0x49d0cb){while(--_0x49d0cb){_0x1f5abe['push'](_0x1f5abe['shift']());}};_0x1b2708(++_0x64d2b6);}(_0xcd62,0x144));var _0x2cd6=function(_0x573773,_0x36caa2){_0x573773=_0x573773-0x0;var _0x2b56af=_0xcd62[_0x573773];return _0x2b56af;};'use strict';var _=require(_0x2cd6('0x0'));var util=require('util');var moment=require(_0x2cd6('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cd6('0x2'));var fs=require('fs');var Redis=require(_0x2cd6('0x3'));var db=require(_0x2cd6('0x4'))['db'];var utils=require(_0x2cd6('0x5'));var logger=require(_0x2cd6('0x6'))(_0x2cd6('0x7'));var config=require(_0x2cd6('0x8'));var jayson=require(_0x2cd6('0x9'));var client=jayson['client'][_0x2cd6('0xa')]({'port':0x232a});config[_0x2cd6('0xb')]=_[_0x2cd6('0xc')](config[_0x2cd6('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2cd6('0xd'))(new Redis(config['redis']));require(_0x2cd6('0xe'))[_0x2cd6('0xf')](socket);function respondWithRpcPromise(_0x3d09f5,_0x583ecd,_0x52f420){return new BPromise(function(_0x99647f,_0x2e63ee){return client[_0x2cd6('0x10')](_0x3d09f5,_0x52f420)[_0x2cd6('0x11')](function(_0x4f9232){logger[_0x2cd6('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x583ecd,_0x2cd6('0x13'));logger[_0x2cd6('0x14')](_0x2cd6('0x15'),_0x583ecd,_0x2cd6('0x13'),JSON[_0x2cd6('0x16')](_0x4f9232));if(_0x4f9232[_0x2cd6('0x17')]){if(_0x4f9232[_0x2cd6('0x17')][_0x2cd6('0x18')]===0x1f4){logger[_0x2cd6('0x17')](_0x2cd6('0x19'),_0x583ecd,_0x4f9232['error']['message']);return _0x2e63ee(_0x4f9232['error'][_0x2cd6('0x1a')]);}logger[_0x2cd6('0x17')](_0x2cd6('0x19'),_0x583ecd,_0x4f9232['error'][_0x2cd6('0x1a')]);return _0x99647f(_0x4f9232['error'][_0x2cd6('0x1a')]);}else{logger[_0x2cd6('0x12')](_0x2cd6('0x19'),_0x583ecd,_0x2cd6('0x13'));_0x99647f(_0x4f9232['result']['message']);}})[_0x2cd6('0x1b')](function(_0x444a7a){logger[_0x2cd6('0x17')](_0x2cd6('0x19'),_0x583ecd,_0x444a7a);_0x2e63ee(_0x444a7a);});});}exports['UpdateChatInteraction']=function(_0x45b6d3){var _0x29029a=this;return new Promise(function(_0x376e4f,_0x4e4aeb){return db['ChatInteraction'][_0x2cd6('0x1c')](_0x45b6d3[_0x2cd6('0x1d')],{'raw':_0x45b6d3[_0x2cd6('0x1e')]?_0x45b6d3[_0x2cd6('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45b6d3[_0x2cd6('0x1e')]?_0x45b6d3[_0x2cd6('0x1e')][_0x2cd6('0x1f')]||null:null,'attributes':_0x45b6d3[_0x2cd6('0x1e')]?_0x45b6d3[_0x2cd6('0x1e')][_0x2cd6('0x20')]||null:null,'limit':_0x45b6d3[_0x2cd6('0x1e')]?_0x45b6d3[_0x2cd6('0x1e')][_0x2cd6('0x21')]||null:null})[_0x2cd6('0x11')](function(_0x34f97f){logger['info'](_0x2cd6('0x22'),_0x45b6d3);logger[_0x2cd6('0x14')](_0x2cd6('0x22'),_0x45b6d3,JSON['stringify'](_0x34f97f));_0x376e4f(_0x34f97f);})[_0x2cd6('0x1b')](function(_0x2dcfa9){logger[_0x2cd6('0x17')](_0x2cd6('0x22'),_0x2dcfa9['message'],_0x45b6d3);_0x4e4aeb(_0x29029a['error'](0x1f4,_0x2dcfa9[_0x2cd6('0x1a')]));});});};exports[_0x2cd6('0x23')]=function(_0x2d1428){return new Promise(function(_0x14dfda,_0x361ec8){return db[_0x2cd6('0x24')]['find']({'where':_0x2d1428[_0x2cd6('0x1e')]?_0x2d1428['options'][_0x2cd6('0x1f')]||null:null})[_0x2cd6('0x11')](function(_0x19faaf){if(_0x19faaf){return _0x19faaf['addTags'](_0x2d1428['body'][_0x2cd6('0x25')],_[_0x2cd6('0x26')](_0x2d1428[_0x2cd6('0x1d')],[_0x2cd6('0x25'),'id'])||{});}})[_0x2cd6('0x27')](function(_0x211e65){logger[_0x2cd6('0x12')](_0x2cd6('0x28'),_0x2d1428);logger[_0x2cd6('0x14')](_0x2cd6('0x28'),_0x2d1428,JSON[_0x2cd6('0x16')](_0x211e65));_0x14dfda(_0x211e65);})['catch'](function(_0x3a1a0f){logger[_0x2cd6('0x17')](_0x2cd6('0x28'),_0x3a1a0f[_0x2cd6('0x1a')],_0x2d1428);_0x361ec8(_this[_0x2cd6('0x17')](0x1f4,_0x3a1a0f[_0x2cd6('0x1a')]));});});}; \ No newline at end of file +var _0xc041=['info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','update','body','options','raw','attributes','limit','UpdateChatInteraction','catch','AddTagsToChatInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then'];(function(_0x388669,_0x439407){var _0x3a7b5c=function(_0x35504a){while(--_0x35504a){_0x388669['push'](_0x388669['shift']());}};_0x3a7b5c(++_0x439407);}(_0xc041,0x13e));var _0x1c04=function(_0x368abc,_0x8bbc6f){_0x368abc=_0x368abc-0x0;var _0x2fd9f0=_0xc041[_0x368abc];return _0x2fd9f0;};'use strict';var _=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var moment=require('moment');var BPromise=require(_0x1c04('0x2'));var rs=require(_0x1c04('0x3'));var fs=require('fs');var Redis=require(_0x1c04('0x4'));var db=require(_0x1c04('0x5'))['db'];var utils=require(_0x1c04('0x6'));var logger=require(_0x1c04('0x7'))(_0x1c04('0x8'));var config=require(_0x1c04('0x9'));var jayson=require(_0x1c04('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x1c04('0xb')]=_[_0x1c04('0xc')](config[_0x1c04('0xb')],{'host':_0x1c04('0xd'),'port':0x18eb});var socket=require(_0x1c04('0xe'))(new Redis(config[_0x1c04('0xb')]));require('./chatInteraction.socket')[_0x1c04('0xf')](socket);function respondWithRpcPromise(_0xb1cda6,_0x5afd49,_0xcb7497){return new BPromise(function(_0x1973a9,_0xce36f9){return client[_0x1c04('0x10')](_0xb1cda6,_0xcb7497)[_0x1c04('0x11')](function(_0x1ac042){logger[_0x1c04('0x12')](_0x1c04('0x13'),_0x5afd49,_0x1c04('0x14'));logger[_0x1c04('0x15')](_0x1c04('0x16'),_0x5afd49,_0x1c04('0x14'),JSON[_0x1c04('0x17')](_0x1ac042));if(_0x1ac042[_0x1c04('0x18')]){if(_0x1ac042[_0x1c04('0x18')]['code']===0x1f4){logger[_0x1c04('0x18')](_0x1c04('0x13'),_0x5afd49,_0x1ac042[_0x1c04('0x18')][_0x1c04('0x19')]);return _0xce36f9(_0x1ac042[_0x1c04('0x18')][_0x1c04('0x19')]);}logger[_0x1c04('0x18')](_0x1c04('0x13'),_0x5afd49,_0x1ac042['error'][_0x1c04('0x19')]);return _0x1973a9(_0x1ac042['error'][_0x1c04('0x19')]);}else{logger[_0x1c04('0x12')](_0x1c04('0x13'),_0x5afd49,_0x1c04('0x14'));_0x1973a9(_0x1ac042[_0x1c04('0x1a')][_0x1c04('0x19')]);}})['catch'](function(_0x134dfe){logger[_0x1c04('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5afd49,_0x134dfe);_0xce36f9(_0x134dfe);});});}exports['UpdateChatInteraction']=function(_0x1c89cd){var _0x3d1e5c=this;return new Promise(function(_0x2e5805,_0xef64ef){return db['ChatInteraction'][_0x1c04('0x1b')](_0x1c89cd[_0x1c04('0x1c')],{'raw':_0x1c89cd[_0x1c04('0x1d')]?_0x1c89cd[_0x1c04('0x1d')][_0x1c04('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c89cd[_0x1c04('0x1d')]?_0x1c89cd[_0x1c04('0x1d')]['where']||null:null,'attributes':_0x1c89cd['options']?_0x1c89cd[_0x1c04('0x1d')][_0x1c04('0x1f')]||null:null,'limit':_0x1c89cd[_0x1c04('0x1d')]?_0x1c89cd[_0x1c04('0x1d')][_0x1c04('0x20')]||null:null})[_0x1c04('0x11')](function(_0x138802){logger[_0x1c04('0x12')](_0x1c04('0x21'),_0x1c89cd);logger[_0x1c04('0x15')](_0x1c04('0x21'),_0x1c89cd,JSON[_0x1c04('0x17')](_0x138802));_0x2e5805(_0x138802);})[_0x1c04('0x22')](function(_0x45ce52){logger[_0x1c04('0x18')](_0x1c04('0x21'),_0x45ce52[_0x1c04('0x19')],_0x1c89cd);_0xef64ef(_0x3d1e5c[_0x1c04('0x18')](0x1f4,_0x45ce52['message']));});});};exports[_0x1c04('0x23')]=function(_0x3e04d5){return new Promise(function(_0x28ee33,_0xd933b){return db['ChatInteraction'][_0x1c04('0x24')]({'where':_0x3e04d5['options']?_0x3e04d5[_0x1c04('0x1d')][_0x1c04('0x25')]||null:null})[_0x1c04('0x11')](function(_0x1bfb34){if(_0x1bfb34){return _0x1bfb34[_0x1c04('0x26')](_0x3e04d5[_0x1c04('0x1c')][_0x1c04('0x27')],_[_0x1c04('0x28')](_0x3e04d5[_0x1c04('0x1c')],[_0x1c04('0x27'),'id'])||{});}})['spread'](function(_0x5da5ea){logger[_0x1c04('0x12')](_0x1c04('0x29'),_0x3e04d5);logger[_0x1c04('0x15')](_0x1c04('0x29'),_0x3e04d5,JSON[_0x1c04('0x17')](_0x5da5ea));_0x28ee33(_0x5da5ea);})[_0x1c04('0x22')](function(_0x3e093e){logger[_0x1c04('0x18')](_0x1c04('0x29'),_0x3e093e['message'],_0x3e04d5);_0xd933b(_this[_0x1c04('0x18')](0x1f4,_0x3e093e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5e1c238..f68c783 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 _0x1703=['length','chatInteraction:','save','update','emit','register'];(function(_0x118588,_0x1fc6e7){var _0x2254b1=function(_0x58a1e5){while(--_0x58a1e5){_0x118588['push'](_0x118588['shift']());}};_0x2254b1(++_0x1fc6e7);}(_0x1703,0x16a));var _0x3170=function(_0x5f078e,_0x273886){_0x5f078e=_0x5f078e-0x0;var _0x2e8f97=_0x1703[_0x5f078e];return _0x2e8f97;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x3170('0x0'),'remove',_0x3170('0x1')];function createListener(_0x40a634,_0x3b4615){return function(_0xfc5f94){_0x3b4615[_0x3170('0x2')](_0x40a634,_0xfc5f94);};}function removeListener(_0x4c3c67,_0x46dead){return function(){ChatInteractionEvents['removeListener'](_0x4c3c67,_0x46dead);};}exports[_0x3170('0x3')]=function(_0x4254a3){for(var _0x119a0d=0x0,_0x5863fd=events[_0x3170('0x4')];_0x119a0d<_0x5863fd;_0x119a0d++){var _0x228153=events[_0x119a0d];var _0x311b54=createListener(_0x3170('0x5')+_0x228153,_0x4254a3);ChatInteractionEvents['on'](_0x228153,_0x311b54);}}; \ No newline at end of file +var _0x649f=['emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x649f,0x8d));var _0xf649=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x649f[_0x51020b];return _0x371e47;};'use strict';var ChatInteractionEvents=require(_0xf649('0x0'));var events=[_0xf649('0x1'),_0xf649('0x2'),'update'];function createListener(_0x59b774,_0x27b25d){return function(_0x3be4a9){_0x27b25d[_0xf649('0x3')](_0x59b774,_0x3be4a9);};}function removeListener(_0x46ff59,_0x52dd05){return function(){ChatInteractionEvents[_0xf649('0x4')](_0x46ff59,_0x52dd05);};}exports[_0xf649('0x5')]=function(_0x38e80d){for(var _0x5e6358=0x0,_0x1eb0af=events[_0xf649('0x6')];_0x5e6358<_0x1eb0af;_0x5e6358++){var _0x205434=events[_0x5e6358];var _0x1c481c=createListener(_0xf649('0x7')+_0x205434,_0x38e80d);ChatInteractionEvents['on'](_0x205434,_0x1c481c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d5f94b5..b8cbbf1 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 _0x066a=['chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','index','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','isAuthenticated','post','/:id/vidaoo','root','format','now','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x066a,0x19f));var _0xa066=function(_0x143c38,_0x592813){_0x143c38=_0x143c38-0x0;var _0x370da3=_0x066a[_0x143c38];return _0x370da3;};'use strict';var multer=require('multer');var util=require(_0xa066('0x0'));var path=require(_0xa066('0x1'));var timeout=require(_0xa066('0x2'));var express=require(_0xa066('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa066('0x4'));var interaction=require(_0xa066('0x5'));var config=require('../../config/environment');var controller=require(_0xa066('0x6'));router[_0xa066('0x7')]('/',auth['isAuthenticated'](),controller[_0xa066('0x8')]);router[_0xa066('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa066('0x7')](_0xa066('0x9'),auth[_0xa066('0xa')](),controller['show']);router[_0xa066('0x7')](_0xa066('0xb'),auth[_0xa066('0xa')](),controller[_0xa066('0xc')]);router[_0xa066('0x7')](_0xa066('0xd'),auth['isAuthenticated'](),controller[_0xa066('0xe')]);router[_0xa066('0x7')](_0xa066('0xf'),auth[_0xa066('0xa')](),controller[_0xa066('0x10')]);router[_0xa066('0x7')](_0xa066('0x11'),auth[_0xa066('0x12')](),controller['download']);router[_0xa066('0x13')]('/',auth[_0xa066('0x12')](),controller['create']);router[_0xa066('0x13')](_0xa066('0x14'),auth[_0xa066('0x12')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5f0485,_0x596117,_0x2f4bb9){_0x2f4bb9(null,path['join'](config[_0xa066('0x15')],'server/files/attachments/'));},'filename':function(_0x28e1a1,_0x164f3c,_0x4de4e2){_0x4de4e2(null,util[_0xa066('0x16')]('%s-%s',Date[_0xa066('0x17')](),_0x164f3c['originalname'][_0xa066('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa066('0x13')](_0xa066('0x19'),upload[_0xa066('0x1a')](_0xa066('0x1b')),controller[_0xa066('0x1c')]);router[_0xa066('0x13')](_0xa066('0xd'),auth['isChatInteractionAuthorized'](),controller[_0xa066('0x1d')]);router[_0xa066('0x13')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xa066('0x1e')](_0xa066('0x1f'),_0xa066('0x20')),controller[_0xa066('0x21')]);router[_0xa066('0x22')](_0xa066('0x9'),auth['isAuthenticated'](),interaction[_0xa066('0x1e')](_0xa066('0x1f'),_0xa066('0x23')),controller[_0xa066('0x24')]);router[_0xa066('0x22')]('/:id/custom_update',controller[_0xa066('0x25')]);router[_0xa066('0x22')](_0xa066('0x26'),auth[_0xa066('0xa')](),controller[_0xa066('0x27')]);router[_0xa066('0x22')](_0xa066('0x28'),controller['close']);router[_0xa066('0x29')](_0xa066('0x9'),auth[_0xa066('0x12')](),interaction[_0xa066('0x1e')](_0xa066('0x1f'),_0xa066('0x2a')),controller['destroy']);router[_0xa066('0x29')]('/:id/tags',auth[_0xa066('0x12')](),controller[_0xa066('0x2b')]);module[_0xa066('0x2c')]=router; \ No newline at end of file +var _0xcf4d=['../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','diskStorage','join','root','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','tracked','chatinteraction:addtags','put','/:id','chatinteraction:update','update','customUpdate','abandon','/:id/close','delete','chat','chatinteraction:destroy','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4f7e0b,_0x12d9ca){var _0x28bd53=function(_0x5abab2){while(--_0x5abab2){_0x4f7e0b['push'](_0x4f7e0b['shift']());}};_0x28bd53(++_0x12d9ca);}(_0xcf4d,0x1b2));var _0xdcf4=function(_0x3973e1,_0x1ed5ae){_0x3973e1=_0x3973e1-0x0;var _0x14a854=_0xcf4d[_0x3973e1];return _0x14a854;};'use strict';var multer=require('multer');var util=require(_0xdcf4('0x0'));var path=require(_0xdcf4('0x1'));var timeout=require(_0xdcf4('0x2'));var express=require(_0xdcf4('0x3'));var router=express[_0xdcf4('0x4')]();var fs_extra=require(_0xdcf4('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcf4('0x6'));var config=require(_0xdcf4('0x7'));var controller=require(_0xdcf4('0x8'));router[_0xdcf4('0x9')]('/',auth[_0xdcf4('0xa')](),controller[_0xdcf4('0xb')]);router[_0xdcf4('0x9')]('/describe',auth[_0xdcf4('0xa')](),controller[_0xdcf4('0xc')]);router['get']('/:id',auth[_0xdcf4('0xd')](),controller[_0xdcf4('0xe')]);router['get']('/:id/attachment_download',auth[_0xdcf4('0xd')](),controller[_0xdcf4('0xf')]);router[_0xdcf4('0x9')]('/:id/messages',auth[_0xdcf4('0xa')](),controller[_0xdcf4('0x10')]);router[_0xdcf4('0x9')](_0xdcf4('0x11'),auth[_0xdcf4('0xd')](),controller[_0xdcf4('0x12')]);router[_0xdcf4('0x9')](_0xdcf4('0x13'),auth[_0xdcf4('0xa')](),controller[_0xdcf4('0x14')]);router['post']('/',auth[_0xdcf4('0xa')](),controller[_0xdcf4('0x15')]);router[_0xdcf4('0x16')]('/:id/vidaoo',auth[_0xdcf4('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xdcf4('0x17')]({'destination':function(_0x3b3039,_0x21800e,_0x48feda){_0x48feda(null,path[_0xdcf4('0x18')](config[_0xdcf4('0x19')],'server/files/attachments/'));},'filename':function(_0x1cf422,_0xf55c02,_0x507737){_0x507737(null,util[_0xdcf4('0x1a')](_0xdcf4('0x1b'),Date['now'](),_0xf55c02[_0xdcf4('0x1c')][_0xdcf4('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdcf4('0x16')](_0xdcf4('0x1e'),upload[_0xdcf4('0x1f')](_0xdcf4('0x20')),controller[_0xdcf4('0x21')]);router[_0xdcf4('0x16')](_0xdcf4('0x22'),auth[_0xdcf4('0xd')](),controller['addMessage']);router[_0xdcf4('0x16')]('/:id/tags',auth[_0xdcf4('0xa')](),interaction[_0xdcf4('0x23')]('chat',_0xdcf4('0x24')),controller['addTags']);router[_0xdcf4('0x25')](_0xdcf4('0x26'),auth[_0xdcf4('0xa')](),interaction[_0xdcf4('0x23')]('chat',_0xdcf4('0x27')),controller[_0xdcf4('0x28')]);router[_0xdcf4('0x25')]('/:id/custom_update',controller[_0xdcf4('0x29')]);router[_0xdcf4('0x25')]('/:id/abandon',auth[_0xdcf4('0xd')](),controller[_0xdcf4('0x2a')]);router['put'](_0xdcf4('0x2b'),controller['close']);router[_0xdcf4('0x2c')](_0xdcf4('0x26'),auth[_0xdcf4('0xa')](),interaction[_0xdcf4('0x23')](_0xdcf4('0x2d'),_0xdcf4('0x2e')),controller[_0xdcf4('0x2f')]);router[_0xdcf4('0x2c')]('/:id/tags',auth[_0xdcf4('0xa')](),controller['removeTags']);module[_0xdcf4('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index f120af0..d58b6c4 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 _0x51d0=['medium','BOOLEAN','sequelize','exports','TEXT'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x51d0,0x101));var _0x051d=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x51d0[_0x4a7631];return _0x1a5a6f;};'use strict';var Sequelize=require(_0x051d('0x0'));module[_0x051d('0x1')]={'body':{'type':Sequelize[_0x051d('0x2')](_0x051d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x051d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7e31=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x5d6e30,_0xc21d51){var _0x3d3f3b=function(_0x33597b){while(--_0x33597b){_0x5d6e30['push'](_0x5d6e30['shift']());}};_0x3d3f3b(++_0xc21d51);}(_0x7e31,0xb0));var _0x17e3=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x7e31[_0x1fc82b];return _0x4c6679;};'use strict';var Sequelize=require(_0x17e3('0x0'));module[_0x17e3('0x1')]={'body':{'type':Sequelize['TEXT'](_0x17e3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x17e3('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d64a558..c2fd26e 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 _0xa7d9=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueues','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty'];(function(_0x4df517,_0xfe4b8a){var _0xd15790=function(_0x1400c0){while(--_0x1400c0){_0x4df517['push'](_0x4df517['shift']());}};_0xd15790(++_0xfe4b8a);}(_0xa7d9,0xa7));var _0x9a7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a7d('0x0'));var rimraf=require(_0x9a7d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a7d('0x2'));var rp=require(_0x9a7d('0x3'));var moment=require(_0x9a7d('0x4'));var BPromise=require(_0x9a7d('0x5'));var Mustache=require('mustache');var util=require(_0x9a7d('0x6'));var path=require(_0x9a7d('0x7'));var sox=require(_0x9a7d('0x8'));var csv=require(_0x9a7d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a7d('0xa'));var _=require('lodash');var squel=require(_0x9a7d('0xb'));var crypto=require(_0x9a7d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a7d('0x9'));var querystring=require(_0x9a7d('0xd'));var Papa=require(_0x9a7d('0xe'));var Redis=require(_0x9a7d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9a7d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a7d('0x11'))(_0x9a7d('0x12'));var utils=require(_0x9a7d('0x13'));var config=require(_0x9a7d('0x14'));var licenseUtil=require(_0x9a7d('0x15'));var db=require(_0x9a7d('0x16'))['db'];config['redis']=_[_0x9a7d('0x17')](config[_0x9a7d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a7d('0x19'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x9a7d('0x1a')](socket);function respondWithStatusCode(_0x4b186b,_0x39cc9c){_0x39cc9c=_0x39cc9c||0xcc;return function(_0x48d7ef){if(_0x48d7ef){return _0x4b186b['sendStatus'](_0x39cc9c);}return _0x4b186b[_0x9a7d('0x1b')](_0x39cc9c)[_0x9a7d('0x1c')]();};}function respondWithResult(_0x326de0,_0x506235){_0x506235=_0x506235||0xc8;return function(_0x31432b){if(_0x31432b){return _0x326de0[_0x9a7d('0x1b')](_0x506235)[_0x9a7d('0x1d')](_0x31432b);}};}function respondWithFilteredResult(_0x15f6da,_0x224520){return function(_0xf18d94){if(_0xf18d94){var _0x307228=typeof _0x224520[_0x9a7d('0x1e')]===_0x9a7d('0x1f')&&typeof _0x224520['limit']===_0x9a7d('0x1f');var _0x2da500=_0xf18d94[_0x9a7d('0x20')];var _0x24af54=_0x307228?0x0:_0x224520[_0x9a7d('0x1e')];var _0x375ae6=_0x307228?_0xf18d94['count']:_0x224520['offset']+_0x224520[_0x9a7d('0x21')];var _0x20bb74;if(_0x375ae6>=_0x2da500){_0x375ae6=_0x2da500;_0x20bb74=0xc8;}else{_0x20bb74=0xce;}_0x15f6da[_0x9a7d('0x1b')](_0x20bb74);return _0x15f6da[_0x9a7d('0x22')](_0x9a7d('0x23'),_0x24af54+'-'+_0x375ae6+'/'+_0x2da500)[_0x9a7d('0x1d')](_0xf18d94);}return null;};}function patchUpdates(_0x1e8275){return function(_0x2ecfd6){try{jsonpatch[_0x9a7d('0x24')](_0x2ecfd6,_0x1e8275,!![]);}catch(_0x3c8342){return BPromise[_0x9a7d('0x25')](_0x3c8342);}return _0x2ecfd6[_0x9a7d('0x26')]();};}function saveUpdates(_0x543af2,_0x43a992){return function(_0x152f58){if(_0x152f58){return _0x152f58['update'](_0x543af2)[_0x9a7d('0x27')](function(_0xf23fa1){return _0xf23fa1;});}return null;};}function removeEntity(_0x12d22c,_0x4da75f){return function(_0x2dc68d){if(_0x2dc68d){return _0x2dc68d['destroy']()['then'](function(){_0x12d22c['status'](0xcc)[_0x9a7d('0x1c')]();});}};}function handleEntityNotFound(_0x1d785d,_0x4336b3){return function(_0x152702){if(!_0x152702){_0x1d785d[_0x9a7d('0x28')](0x194);}return _0x152702;};}function handleError(_0x3df61b,_0x2f6943){_0x2f6943=_0x2f6943||0x1f4;return function(_0x432185){logger[_0x9a7d('0x29')](_0x432185[_0x9a7d('0x2a')]);if(_0x432185[_0x9a7d('0x2b')]){delete _0x432185[_0x9a7d('0x2b')];}_0x3df61b[_0x9a7d('0x1b')](_0x2f6943)[_0x9a7d('0x2c')](_0x432185);};}exports[_0x9a7d('0x2d')]=function(_0x5849ef,_0x3e6407){var _0x4cbcd7={},_0xe1f073={},_0x2b6426={'count':0x0,'rows':[]};var _0x2db4f9=_[_0x9a7d('0x2e')](db[_0x9a7d('0x2f')]['rawAttributes'],function(_0x24cc00){return{'name':_0x24cc00[_0x9a7d('0x30')],'type':_0x24cc00[_0x9a7d('0x31')][_0x9a7d('0x32')]};});_0xe1f073['model']=_[_0x9a7d('0x2e')](_0x2db4f9,_0x9a7d('0x2b'));_0xe1f073[_0x9a7d('0x33')]=_[_0x9a7d('0x34')](_0x5849ef['query']);_0xe1f073[_0x9a7d('0x35')]=_[_0x9a7d('0x36')](_0xe1f073[_0x9a7d('0x37')],_0xe1f073[_0x9a7d('0x33')]);_0x4cbcd7[_0x9a7d('0x38')]=_[_0x9a7d('0x36')](_0xe1f073['model'],qs[_0x9a7d('0x39')](_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x39')]));_0x4cbcd7['attributes']=_0x4cbcd7['attributes']['length']?_0x4cbcd7[_0x9a7d('0x38')]:_0xe1f073[_0x9a7d('0x37')];if(!_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x3a')](_0x9a7d('0x3b'))){_0x4cbcd7[_0x9a7d('0x21')]=qs['limit'](_0x5849ef['query'][_0x9a7d('0x21')]);_0x4cbcd7[_0x9a7d('0x1e')]=qs['offset'](_0x5849ef[_0x9a7d('0x33')]['offset']);}_0x4cbcd7['order']=qs['sort'](_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x3c')]);_0x4cbcd7[_0x9a7d('0x3d')]=qs[_0x9a7d('0x35')](_[_0x9a7d('0x3e')](_0x5849ef[_0x9a7d('0x33')],_0xe1f073['filters']),_0x2db4f9);if(_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x3f')]){_0x4cbcd7['where']=_[_0x9a7d('0x40')](_0x4cbcd7['where'],{'$or':_[_0x9a7d('0x2e')](_0x2db4f9,function(_0x106b04){if(_0x106b04[_0x9a7d('0x31')]!==_0x9a7d('0x41')){var _0x52cc6d={};_0x52cc6d[_0x106b04[_0x9a7d('0x2b')]]={'$like':'%'+_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x3f')]+'%'};return _0x52cc6d;}})});}_0x4cbcd7=_['merge']({},_0x4cbcd7,_0x5849ef[_0x9a7d('0x42')]);var _0x54ac87={'where':_0x4cbcd7[_0x9a7d('0x3d')]};return db['ChatInternalMessage'][_0x9a7d('0x20')](_0x54ac87)[_0x9a7d('0x27')](function(_0x32dd72){_0x2b6426[_0x9a7d('0x20')]=_0x32dd72;if(_0x5849ef[_0x9a7d('0x33')][_0x9a7d('0x43')]){_0x4cbcd7[_0x9a7d('0x44')]=[{'all':!![]}];}return db[_0x9a7d('0x2f')][_0x9a7d('0x45')](_0x4cbcd7);})[_0x9a7d('0x27')](function(_0x3c53c2){_0x2b6426[_0x9a7d('0x46')]=_0x3c53c2;return _0x2b6426;})[_0x9a7d('0x27')](respondWithFilteredResult(_0x3e6407,_0x4cbcd7))[_0x9a7d('0x47')](handleError(_0x3e6407,null));};exports[_0x9a7d('0x48')]=function(_0x5e1b19,_0x4fa7d9){var _0x4212be={'raw':!![],'where':{'id':_0x5e1b19[_0x9a7d('0x49')]['id']}},_0x49325c={};_0x49325c['model']=_[_0x9a7d('0x34')](db[_0x9a7d('0x2f')][_0x9a7d('0x4a')]);_0x49325c[_0x9a7d('0x33')]=_[_0x9a7d('0x34')](_0x5e1b19[_0x9a7d('0x33')]);_0x49325c[_0x9a7d('0x35')]=_[_0x9a7d('0x36')](_0x49325c[_0x9a7d('0x37')],_0x49325c['query']);_0x4212be['attributes']=_[_0x9a7d('0x36')](_0x49325c[_0x9a7d('0x37')],qs[_0x9a7d('0x39')](_0x5e1b19[_0x9a7d('0x33')]['fields']));_0x4212be[_0x9a7d('0x38')]=_0x4212be[_0x9a7d('0x38')][_0x9a7d('0x4b')]?_0x4212be[_0x9a7d('0x38')]:_0x49325c[_0x9a7d('0x37')];if(_0x5e1b19[_0x9a7d('0x33')][_0x9a7d('0x43')]){_0x4212be[_0x9a7d('0x44')]=[{'all':!![]}];}_0x4212be=_[_0x9a7d('0x40')]({},_0x4212be,_0x5e1b19[_0x9a7d('0x42')]);return db[_0x9a7d('0x2f')][_0x9a7d('0x4c')](_0x4212be)[_0x9a7d('0x27')](handleEntityNotFound(_0x4fa7d9,null))[_0x9a7d('0x27')](respondWithResult(_0x4fa7d9,null))[_0x9a7d('0x47')](handleError(_0x4fa7d9,null));};exports[_0x9a7d('0x4d')]=function(_0x37dade,_0x2f97de){return db[_0x9a7d('0x2f')][_0x9a7d('0x4d')](_0x37dade[_0x9a7d('0x4e')],{})['then'](respondWithResult(_0x2f97de,0xc9))['catch'](handleError(_0x2f97de,null));};exports['update']=function(_0x487849,_0x4f23ce){if(_0x487849[_0x9a7d('0x4e')]['id']){delete _0x487849[_0x9a7d('0x4e')]['id'];}return db[_0x9a7d('0x2f')][_0x9a7d('0x4c')]({'where':{'id':_0x487849['params']['id']}})[_0x9a7d('0x27')](handleEntityNotFound(_0x4f23ce,null))[_0x9a7d('0x27')](saveUpdates(_0x487849[_0x9a7d('0x4e')],null))[_0x9a7d('0x27')](respondWithResult(_0x4f23ce,null))[_0x9a7d('0x47')](handleError(_0x4f23ce,null));};exports[_0x9a7d('0x4f')]=function(_0x1df538,_0x295d58){return db[_0x9a7d('0x2f')]['find']({'where':{'id':_0x1df538['params']['id']}})[_0x9a7d('0x27')](handleEntityNotFound(_0x295d58,null))['then'](removeEntity(_0x295d58,null))['catch'](handleError(_0x295d58,null));};exports[_0x9a7d('0x50')]=function(_0x42d7a6,_0x3077a7){return db['ChatInternalMessage'][_0x9a7d('0x50')]()[_0x9a7d('0x27')](respondWithResult(_0x3077a7,null))['catch'](handleError(_0x3077a7,null));};function wrapUser(_0x20ca53){return function(_0xef0445){var _0x5c9b03=_0x20ca53[_0x9a7d('0x51')]({'plain':!![]});_0x5c9b03[_0x9a7d('0x52')]=[];if(_0xef0445){_0x5c9b03['lastMessageAt']=_0xef0445[_0x9a7d('0x53')];_0x5c9b03[_0x9a7d('0x54')]=_0xef0445;}else{_0x5c9b03[_0x9a7d('0x55')]=moment(0x0)[_0x9a7d('0x56')](_0x9a7d('0x57'));_0x5c9b03['lastMessage']={};}return _0x5c9b03;};}exports[_0x9a7d('0x58')]=function(_0x5990fc,_0x20e5ab,_0x2f1c4f){var _0x291165=[];return db[_0x9a7d('0x59')][_0x9a7d('0x45')]({'where':{'role':[_0x9a7d('0x5a'),_0x9a7d('0x5b'),_0x9a7d('0x5c')]},'attributes':['id',_0x9a7d('0x5d'),'name',_0x9a7d('0x5e'),_0x9a7d('0x5f'),_0x9a7d('0x60'),_0x9a7d('0x61'),_0x9a7d('0x62'),'allowmessenger',_0x9a7d('0x63')],'order':qs[_0x9a7d('0x3c')](_0x9a7d('0x64')),'include':[{'model':db['VoiceQueue'],'as':_0x9a7d('0x65'),'attributes':['id','name',_0x9a7d('0x31')],'through':{'attributes':[]}}]})['then'](function(_0x5b91e2){if(_0x5b91e2){var _0xeba205=_0x5990fc['user']['get']({'plain':!![]});if(!_0xeba205)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xeba205['role']===_0x9a7d('0x5c')){return db[_0x9a7d('0x66')][_0x9a7d('0x4c')]({'where':{'name':_0x9a7d('0x67'),'userProfileId':_0xeba205[_0x9a7d('0x68')]},'raw':!![]})[_0x9a7d('0x27')](function(_0x3a1589){if(_0x3a1589){if(_0x3a1589['autoAssociation']===0x0){return db['UserProfileResource'][_0x9a7d('0x45')]({'where':{'sectionId':_0x3a1589['id']},'raw':!![]})['then'](function(_0x540d55){var _0x211244=[];if(_[_0x9a7d('0x69')](_0x540d55)){_0x211244=_['filter'](_0x5b91e2,function(_0x98fc57){if(_0x98fc57[_0x9a7d('0x5e')]!==_0x9a7d('0x5a')){return _0x98fc57;}});return _0x211244;}else{for(var _0x2be19f=0x0;_0x2be19f<_0x5b91e2[_0x9a7d('0x4b')];_0x2be19f++){var _0x577bc3=_0x5b91e2[_0x2be19f];if(_0x577bc3[_0x9a7d('0x5e')]===_0x9a7d('0x5a')){var _0xf4edd0=_['find'](_0x540d55,function(_0x2a8a87){return _0x2a8a87[_0x9a7d('0x6a')]===_0x577bc3['id'];});if(_0xf4edd0)_0x211244[_0x9a7d('0x6b')](_0x577bc3);}else{_0x211244[_0x9a7d('0x6b')](_0x577bc3);}}return _0x211244;}});}else{return _0x5b91e2;}}else{var _0x33a603=_['filter'](_0x5b91e2,function(_0x3d50e5){if(_0x3d50e5[_0x9a7d('0x5e')]!==_0x9a7d('0x5a')){return _0x3d50e5;}});return _0x33a603;}});}else{return _0x5b91e2;}}})[_0x9a7d('0x27')](function(_0x4c9ddc){var _0x5cd20e=[];if(_0x4c9ddc){_0x291165=_0x4c9ddc;for(var _0x400f8f=0x0;_0x400f8f<_0x4c9ddc[_0x9a7d('0x4b')];_0x400f8f+=0x1){_0x291165[_0x400f8f]['messages']=[];_0x5cd20e['push'](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x5990fc['user']['id'],_0x4c9ddc[_0x400f8f]['id']],'ToId':[_0x5990fc[_0x9a7d('0x5c')]['id'],_0x4c9ddc[_0x400f8f]['id']],'ChatGroupId':null},'attributes':['id',_0x9a7d('0x53'),_0x9a7d('0x6c'),_0x9a7d('0x6d'),_0x9a7d('0x6e'),'body'],'order':qs['sort'](_0x9a7d('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9a7d('0x27')](wrapUser(_0x4c9ddc[_0x400f8f])));}return BPromise[_0x9a7d('0x70')](_0x5cd20e);}return[];})[_0x9a7d('0x27')](function(_0x50c32a){return{'rows':_0x50c32a,'count':_0x50c32a[_0x9a7d('0x4b')]};})['then'](respondWithResult(_0x20e5ab,null))[_0x9a7d('0x47')](handleError(_0x20e5ab,null));}; \ No newline at end of file +var _0x52ef=['options','includeAll','include','show','params','create','body','catch','find','describe','get','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','admin','role','userpic','internal','online','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','all','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x580e5f,_0x4e26de){var _0x21f583=function(_0x446cd8){while(--_0x446cd8){_0x580e5f['push'](_0x580e5f['shift']());}};_0x21f583(++_0x4e26de);}(_0x52ef,0x1ba));var _0xf52e=function(_0x1b88ee,_0x3cddfc){_0x1b88ee=_0x1b88ee-0x0;var _0x31dd88=_0x52ef[_0x1b88ee];return _0x31dd88;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf52e('0x0'));var zipdir=require(_0xf52e('0x1'));var jsonpatch=require(_0xf52e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf52e('0x3'));var util=require(_0xf52e('0x4'));var path=require('path');var sox=require(_0xf52e('0x5'));var csv=require(_0xf52e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf52e('0x7'));var _=require(_0xf52e('0x8'));var squel=require(_0xf52e('0x9'));var crypto=require('crypto');var jsforce=require(_0xf52e('0xa'));var deskjs=require(_0xf52e('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf52e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf52e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf52e('0xe'));var as=require(_0xf52e('0xf'));var hardwareService=require(_0xf52e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xf52e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xf52e('0x12'));var db=require('../../mysqldb')['db'];config[_0xf52e('0x13')]=_[_0xf52e('0x14')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf52e('0x15'))(new Redis(config[_0xf52e('0x13')]));require(_0xf52e('0x16'))[_0xf52e('0x17')](socket);function respondWithStatusCode(_0x4b3661,_0x1e300c){_0x1e300c=_0x1e300c||0xcc;return function(_0x52a51d){if(_0x52a51d){return _0x4b3661[_0xf52e('0x18')](_0x1e300c);}return _0x4b3661[_0xf52e('0x19')](_0x1e300c)[_0xf52e('0x1a')]();};}function respondWithResult(_0x5f5508,_0x4e70ed){_0x4e70ed=_0x4e70ed||0xc8;return function(_0x4263fa){if(_0x4263fa){return _0x5f5508['status'](_0x4e70ed)[_0xf52e('0x1b')](_0x4263fa);}};}function respondWithFilteredResult(_0x4def05,_0x512f38){return function(_0x3453f3){if(_0x3453f3){var _0x5e2e00=typeof _0x512f38[_0xf52e('0x1c')]===_0xf52e('0x1d')&&typeof _0x512f38['limit']==='undefined';var _0x3b7938=_0x3453f3[_0xf52e('0x1e')];var _0x52fa07=_0x5e2e00?0x0:_0x512f38[_0xf52e('0x1c')];var _0x3626d7=_0x5e2e00?_0x3453f3[_0xf52e('0x1e')]:_0x512f38[_0xf52e('0x1c')]+_0x512f38[_0xf52e('0x1f')];var _0x57bebe;if(_0x3626d7>=_0x3b7938){_0x3626d7=_0x3b7938;_0x57bebe=0xc8;}else{_0x57bebe=0xce;}_0x4def05['status'](_0x57bebe);return _0x4def05[_0xf52e('0x20')](_0xf52e('0x21'),_0x52fa07+'-'+_0x3626d7+'/'+_0x3b7938)['json'](_0x3453f3);}return null;};}function patchUpdates(_0x4d28ba){return function(_0x5767a7){try{jsonpatch[_0xf52e('0x22')](_0x5767a7,_0x4d28ba,!![]);}catch(_0x3aae04){return BPromise[_0xf52e('0x23')](_0x3aae04);}return _0x5767a7['save']();};}function saveUpdates(_0x28ea0d,_0x16b786){return function(_0x2ae72c){if(_0x2ae72c){return _0x2ae72c['update'](_0x28ea0d)['then'](function(_0x1df65d){return _0x1df65d;});}return null;};}function removeEntity(_0x18ddaa,_0x34c6b6){return function(_0x5c5257){if(_0x5c5257){return _0x5c5257[_0xf52e('0x24')]()[_0xf52e('0x25')](function(){_0x18ddaa[_0xf52e('0x19')](0xcc)[_0xf52e('0x1a')]();});}};}function handleEntityNotFound(_0x1dfc71,_0x7878b7){return function(_0x38d522){if(!_0x38d522){_0x1dfc71[_0xf52e('0x18')](0x194);}return _0x38d522;};}function handleError(_0x184586,_0x4e575c){_0x4e575c=_0x4e575c||0x1f4;return function(_0x27d3f9){logger[_0xf52e('0x26')](_0x27d3f9['stack']);if(_0x27d3f9[_0xf52e('0x27')]){delete _0x27d3f9[_0xf52e('0x27')];}_0x184586['status'](_0x4e575c)[_0xf52e('0x28')](_0x27d3f9);};}exports[_0xf52e('0x29')]=function(_0x136fd4,_0x323123){var _0x533f06={},_0x2aed81={},_0xe7592e={'count':0x0,'rows':[]};var _0x1c37b2=_['map'](db[_0xf52e('0x2a')][_0xf52e('0x2b')],function(_0x46f05f){return{'name':_0x46f05f[_0xf52e('0x2c')],'type':_0x46f05f[_0xf52e('0x2d')][_0xf52e('0x2e')]};});_0x2aed81[_0xf52e('0x2f')]=_['map'](_0x1c37b2,_0xf52e('0x27'));_0x2aed81[_0xf52e('0x30')]=_[_0xf52e('0x31')](_0x136fd4[_0xf52e('0x30')]);_0x2aed81[_0xf52e('0x32')]=_[_0xf52e('0x33')](_0x2aed81[_0xf52e('0x2f')],_0x2aed81[_0xf52e('0x30')]);_0x533f06['attributes']=_['intersection'](_0x2aed81[_0xf52e('0x2f')],qs[_0xf52e('0x34')](_0x136fd4[_0xf52e('0x30')][_0xf52e('0x34')]));_0x533f06[_0xf52e('0x35')]=_0x533f06[_0xf52e('0x35')][_0xf52e('0x36')]?_0x533f06[_0xf52e('0x35')]:_0x2aed81['model'];if(!_0x136fd4[_0xf52e('0x30')][_0xf52e('0x37')]('nolimit')){_0x533f06[_0xf52e('0x1f')]=qs[_0xf52e('0x1f')](_0x136fd4[_0xf52e('0x30')][_0xf52e('0x1f')]);_0x533f06[_0xf52e('0x1c')]=qs[_0xf52e('0x1c')](_0x136fd4[_0xf52e('0x30')]['offset']);}_0x533f06[_0xf52e('0x38')]=qs[_0xf52e('0x39')](_0x136fd4['query']['sort']);_0x533f06[_0xf52e('0x3a')]=qs['filters'](_[_0xf52e('0x3b')](_0x136fd4[_0xf52e('0x30')],_0x2aed81['filters']),_0x1c37b2);if(_0x136fd4[_0xf52e('0x30')][_0xf52e('0x3c')]){_0x533f06['where']=_['merge'](_0x533f06[_0xf52e('0x3a')],{'$or':_['map'](_0x1c37b2,function(_0x31eaf5){if(_0x31eaf5['type']!==_0xf52e('0x3d')){var _0x24d9f5={};_0x24d9f5[_0x31eaf5[_0xf52e('0x27')]]={'$like':'%'+_0x136fd4[_0xf52e('0x30')][_0xf52e('0x3c')]+'%'};return _0x24d9f5;}})});}_0x533f06=_[_0xf52e('0x3e')]({},_0x533f06,_0x136fd4[_0xf52e('0x3f')]);var _0x1827ff={'where':_0x533f06[_0xf52e('0x3a')]};return db['ChatInternalMessage'][_0xf52e('0x1e')](_0x1827ff)[_0xf52e('0x25')](function(_0x24315d){_0xe7592e[_0xf52e('0x1e')]=_0x24315d;if(_0x136fd4[_0xf52e('0x30')][_0xf52e('0x40')]){_0x533f06[_0xf52e('0x41')]=[{'all':!![]}];}return db[_0xf52e('0x2a')]['findAll'](_0x533f06);})[_0xf52e('0x25')](function(_0xc27864){_0xe7592e['rows']=_0xc27864;return _0xe7592e;})[_0xf52e('0x25')](respondWithFilteredResult(_0x323123,_0x533f06))['catch'](handleError(_0x323123,null));};exports[_0xf52e('0x42')]=function(_0x598bb2,_0x3ad3e8){var _0x1a72b4={'raw':!![],'where':{'id':_0x598bb2[_0xf52e('0x43')]['id']}},_0x46a471={};_0x46a471[_0xf52e('0x2f')]=_[_0xf52e('0x31')](db[_0xf52e('0x2a')][_0xf52e('0x2b')]);_0x46a471[_0xf52e('0x30')]=_[_0xf52e('0x31')](_0x598bb2[_0xf52e('0x30')]);_0x46a471['filters']=_[_0xf52e('0x33')](_0x46a471[_0xf52e('0x2f')],_0x46a471[_0xf52e('0x30')]);_0x1a72b4[_0xf52e('0x35')]=_[_0xf52e('0x33')](_0x46a471[_0xf52e('0x2f')],qs[_0xf52e('0x34')](_0x598bb2[_0xf52e('0x30')][_0xf52e('0x34')]));_0x1a72b4[_0xf52e('0x35')]=_0x1a72b4[_0xf52e('0x35')]['length']?_0x1a72b4['attributes']:_0x46a471['model'];if(_0x598bb2[_0xf52e('0x30')][_0xf52e('0x40')]){_0x1a72b4[_0xf52e('0x41')]=[{'all':!![]}];}_0x1a72b4=_[_0xf52e('0x3e')]({},_0x1a72b4,_0x598bb2[_0xf52e('0x3f')]);return db['ChatInternalMessage']['find'](_0x1a72b4)['then'](handleEntityNotFound(_0x3ad3e8,null))['then'](respondWithResult(_0x3ad3e8,null))['catch'](handleError(_0x3ad3e8,null));};exports[_0xf52e('0x44')]=function(_0x2f77f3,_0x5b368d){return db[_0xf52e('0x2a')][_0xf52e('0x44')](_0x2f77f3[_0xf52e('0x45')],{})[_0xf52e('0x25')](respondWithResult(_0x5b368d,0xc9))[_0xf52e('0x46')](handleError(_0x5b368d,null));};exports['update']=function(_0xb3d3a0,_0x3dd6d7){if(_0xb3d3a0[_0xf52e('0x45')]['id']){delete _0xb3d3a0[_0xf52e('0x45')]['id'];}return db[_0xf52e('0x2a')][_0xf52e('0x47')]({'where':{'id':_0xb3d3a0[_0xf52e('0x43')]['id']}})[_0xf52e('0x25')](handleEntityNotFound(_0x3dd6d7,null))['then'](saveUpdates(_0xb3d3a0[_0xf52e('0x45')],null))[_0xf52e('0x25')](respondWithResult(_0x3dd6d7,null))[_0xf52e('0x46')](handleError(_0x3dd6d7,null));};exports[_0xf52e('0x24')]=function(_0x2332c8,_0x16c0f7){return db['ChatInternalMessage']['find']({'where':{'id':_0x2332c8['params']['id']}})['then'](handleEntityNotFound(_0x16c0f7,null))['then'](removeEntity(_0x16c0f7,null))[_0xf52e('0x46')](handleError(_0x16c0f7,null));};exports[_0xf52e('0x48')]=function(_0x215703,_0x4c1629){return db[_0xf52e('0x2a')][_0xf52e('0x48')]()['then'](respondWithResult(_0x4c1629,null))[_0xf52e('0x46')](handleError(_0x4c1629,null));};function wrapUser(_0x53f277){return function(_0xfc7a61){var _0x115f43=_0x53f277[_0xf52e('0x49')]({'plain':!![]});_0x115f43['messages']=[];if(_0xfc7a61){_0x115f43[_0xf52e('0x4a')]=_0xfc7a61[_0xf52e('0x4b')];_0x115f43[_0xf52e('0x4c')]=_0xfc7a61;}else{_0x115f43[_0xf52e('0x4a')]=moment(0x0)[_0xf52e('0x4d')](_0xf52e('0x4e'));_0x115f43['lastMessage']={};}return _0x115f43;};}exports[_0xf52e('0x4f')]=function(_0x2b3ecc,_0x5c6650,_0xe6864d){var _0x6d1a3b=[];return db['User'][_0xf52e('0x50')]({'where':{'role':[_0xf52e('0x51'),_0xf52e('0x52'),'user']},'attributes':['id','fullname',_0xf52e('0x27'),_0xf52e('0x53'),_0xf52e('0x54'),_0xf52e('0x55'),_0xf52e('0x56'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0xf52e('0x39')](_0xf52e('0x57')),'include':[{'model':db[_0xf52e('0x58')],'as':_0xf52e('0x59'),'attributes':['id',_0xf52e('0x27'),'type'],'through':{'attributes':[]}}]})[_0xf52e('0x25')](function(_0x4b5776){if(_0x4b5776){var _0x1645a1=_0x2b3ecc[_0xf52e('0x5a')][_0xf52e('0x49')]({'plain':!![]});if(!_0x1645a1)throw new Error(_0xf52e('0x5b'));if(_0x1645a1['role']===_0xf52e('0x5a')){return db[_0xf52e('0x5c')][_0xf52e('0x47')]({'where':{'name':'Agents','userProfileId':_0x1645a1['userProfileId']},'raw':!![]})['then'](function(_0x4bd281){if(_0x4bd281){if(_0x4bd281[_0xf52e('0x5d')]===0x0){return db[_0xf52e('0x5e')][_0xf52e('0x50')]({'where':{'sectionId':_0x4bd281['id']},'raw':!![]})['then'](function(_0x255cf6){var _0x5ba651=[];if(_[_0xf52e('0x5f')](_0x255cf6)){_0x5ba651=_[_0xf52e('0x3c')](_0x4b5776,function(_0x1b2f42){if(_0x1b2f42['role']!==_0xf52e('0x51')){return _0x1b2f42;}});return _0x5ba651;}else{for(var _0x5dfd7f=0x0;_0x5dfd7f<_0x4b5776[_0xf52e('0x36')];_0x5dfd7f++){var _0x5722be=_0x4b5776[_0x5dfd7f];if(_0x5722be['role']===_0xf52e('0x51')){var _0x1f5d9d=_[_0xf52e('0x47')](_0x255cf6,function(_0x589e35){return _0x589e35[_0xf52e('0x60')]===_0x5722be['id'];});if(_0x1f5d9d)_0x5ba651['push'](_0x5722be);}else{_0x5ba651[_0xf52e('0x61')](_0x5722be);}}return _0x5ba651;}});}else{return _0x4b5776;}}else{var _0x22752e=_['filter'](_0x4b5776,function(_0x338dea){if(_0x338dea[_0xf52e('0x53')]!==_0xf52e('0x51')){return _0x338dea;}});return _0x22752e;}});}else{return _0x4b5776;}}})[_0xf52e('0x25')](function(_0x5ea4b5){var _0x5682a0=[];if(_0x5ea4b5){_0x6d1a3b=_0x5ea4b5;for(var _0x5ea6d5=0x0;_0x5ea6d5<_0x5ea4b5[_0xf52e('0x36')];_0x5ea6d5+=0x1){_0x6d1a3b[_0x5ea6d5]['messages']=[];_0x5682a0['push'](db[_0xf52e('0x2a')][_0xf52e('0x47')]({'where':{'FromId':[_0x2b3ecc[_0xf52e('0x5a')]['id'],_0x5ea4b5[_0x5ea6d5]['id']],'ToId':[_0x2b3ecc['user']['id'],_0x5ea4b5[_0x5ea6d5]['id']],'ChatGroupId':null},'attributes':['id',_0xf52e('0x4b'),_0xf52e('0x62'),'ToId',_0xf52e('0x63'),_0xf52e('0x45')],'order':qs[_0xf52e('0x39')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf52e('0x25')](wrapUser(_0x5ea4b5[_0x5ea6d5])));}return BPromise[_0xf52e('0x64')](_0x5682a0);}return[];})[_0xf52e('0x25')](function(_0x4d4c0d){return{'rows':_0x4d4c0d,'count':_0x4d4c0d['length']};})[_0xf52e('0x25')](respondWithResult(_0x5c6650,null))['catch'](handleError(_0x5c6650,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2aaa1b1..dc7af34 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 _0xa2fa=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x13572d,_0x438764){var _0x258d84=function(_0x58bee2){while(--_0x58bee2){_0x13572d['push'](_0x13572d['shift']());}};_0x258d84(++_0x438764);}(_0xa2fa,0x95));var _0xaa2f=function(_0x350aeb,_0x3d265a){_0x350aeb=_0x350aeb-0x0;var _0x3c5273=_0xa2fa[_0x350aeb];return _0x3c5273;};'use strict';var EventEmitter=require(_0xaa2f('0x0'));var ChatInternalMessage=require(_0xaa2f('0x1'))['db'][_0xaa2f('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xaa2f('0x3')](0x0);var events={'afterCreate':_0xaa2f('0x4'),'afterUpdate':'update','afterDestroy':_0xaa2f('0x5')};function emitEvent(_0x27f41c){return function(_0x35bde4,_0x41bd33,_0x10ac98){ChatInternalMessageEvents[_0xaa2f('0x6')](_0x27f41c+':'+_0x35bde4['id'],_0x35bde4);ChatInternalMessageEvents['emit'](_0x27f41c,_0x35bde4);_0x10ac98(null);};}for(var e in events){if(events[_0xaa2f('0x7')](e)){var event=events[e];ChatInternalMessage[_0xaa2f('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x50d5=['hook','events','ChatInternalMessage','update','remove','emit','hasOwnProperty'];(function(_0x2dab92,_0x2ae201){var _0x30d9ba=function(_0x4c441e){while(--_0x4c441e){_0x2dab92['push'](_0x2dab92['shift']());}};_0x30d9ba(++_0x2ae201);}(_0x50d5,0x166));var _0x550d=function(_0x93ad3e,_0x23366f){_0x93ad3e=_0x93ad3e-0x0;var _0x4c822f=_0x50d5[_0x93ad3e];return _0x4c822f;};'use strict';var EventEmitter=require(_0x550d('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x550d('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x550d('0x2'),'afterDestroy':_0x550d('0x3')};function emitEvent(_0x3e5a56){return function(_0x3a8409,_0x17eb90,_0x342ef2){ChatInternalMessageEvents['emit'](_0x3e5a56+':'+_0x3a8409['id'],_0x3a8409);ChatInternalMessageEvents[_0x550d('0x4')](_0x3e5a56,_0x3a8409);_0x342ef2(null);};}for(var e in events){if(events[_0x550d('0x5')](e)){var event=events[e];ChatInternalMessage[_0x550d('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ba8aa3c..e0df44c 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 _0x5e4c=['./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x5e4c,0x118));var _0xc5e4=function(_0x33029a,_0x57818a){_0x33029a=_0x33029a-0x0;var _0x5c6c86=_0x5e4c[_0x33029a];return _0x5c6c86;};'use strict';var _=require(_0xc5e4('0x0'));var util=require(_0xc5e4('0x1'));var logger=require(_0xc5e4('0x2'))(_0xc5e4('0x3'));var moment=require(_0xc5e4('0x4'));var BPromise=require('bluebird');var rp=require(_0xc5e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5e4('0x6'));var config=require(_0xc5e4('0x7'));var attributes=require(_0xc5e4('0x8'));module[_0xc5e4('0x9')]=function(_0x5322c6,_0x54c22c){return _0x5322c6['define']('ChatInternalMessage',attributes,{'tableName':_0xc5e4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc5e4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc978=['lodash','../../config/logger','api','bluebird','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xc978,0x13f));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(_0x8c97('0x1'))(_0x8c97('0x2'));var moment=require('moment');var BPromise=require(_0x8c97('0x3'));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(_0x8c97('0x4'));module[_0x8c97('0x5')]=function(_0x598bcc,_0x31a968){return _0x598bcc[_0x8c97('0x6')](_0x8c97('0x7'),attributes,{'tableName':_0x8c97('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8c97('0x9'),'collate':_0x8c97('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index f9c40ea..a673da6 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 _0xa915=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x38ebf4,_0x525f97){var _0x11e34f=function(_0x2637e1){while(--_0x2637e1){_0x38ebf4['push'](_0x38ebf4['shift']());}};_0x11e34f(++_0x525f97);}(_0xa915,0x1d7));var _0x5a91=function(_0x19b8a1,_0x349bbb){_0x19b8a1=_0x19b8a1-0x0;var _0x2b9fe3=_0xa915[_0x19b8a1];return _0x2b9fe3;};'use strict';var _=require('lodash');var util=require(_0x5a91('0x0'));var moment=require(_0x5a91('0x1'));var BPromise=require(_0x5a91('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a91('0x3'))['db'];var utils=require(_0x5a91('0x4'));var logger=require('../../config/logger')(_0x5a91('0x5'));var config=require('../../config/environment');var jayson=require(_0x5a91('0x6'));var client=jayson[_0x5a91('0x7')][_0x5a91('0x8')]({'port':0x232a});config[_0x5a91('0x9')]=_[_0x5a91('0xa')](config[_0x5a91('0x9')],{'host':_0x5a91('0xb'),'port':0x18eb});var socket=require(_0x5a91('0xc'))(new Redis(config[_0x5a91('0x9')]));require(_0x5a91('0xd'))[_0x5a91('0xe')](socket);function respondWithRpcPromise(_0x4282ff,_0x1ba686,_0x2abf77){return new BPromise(function(_0x1c6d82,_0x273987){return client[_0x5a91('0xf')](_0x4282ff,_0x2abf77)['then'](function(_0x17ccdf){logger['info'](_0x5a91('0x10'),_0x1ba686,_0x5a91('0x11'));logger[_0x5a91('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x1ba686,_0x5a91('0x11'),JSON['stringify'](_0x17ccdf));if(_0x17ccdf[_0x5a91('0x13')]){if(_0x17ccdf[_0x5a91('0x13')][_0x5a91('0x14')]===0x1f4){logger[_0x5a91('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ba686,_0x17ccdf[_0x5a91('0x13')][_0x5a91('0x15')]);return _0x273987(_0x17ccdf[_0x5a91('0x13')]['message']);}logger[_0x5a91('0x13')](_0x5a91('0x10'),_0x1ba686,_0x17ccdf[_0x5a91('0x13')][_0x5a91('0x15')]);return _0x1c6d82(_0x17ccdf[_0x5a91('0x13')]['message']);}else{logger[_0x5a91('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x1ba686,_0x5a91('0x11'));_0x1c6d82(_0x17ccdf['result'][_0x5a91('0x15')]);}})[_0x5a91('0x17')](function(_0x167b9a){logger[_0x5a91('0x13')](_0x5a91('0x10'),_0x1ba686,_0x167b9a);_0x273987(_0x167b9a);});});} \ No newline at end of file +var _0x3316=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x23e5ce,_0x57584d){var _0x2ce19b=function(_0x318e1f){while(--_0x318e1f){_0x23e5ce['push'](_0x23e5ce['shift']());}};_0x2ce19b(++_0x57584d);}(_0x3316,0x161));var _0x6331=function(_0x514e38,_0x18958d){_0x514e38=_0x514e38-0x0;var _0x57305d=_0x3316[_0x514e38];return _0x57305d;};'use strict';var _=require(_0x6331('0x0'));var util=require('util');var moment=require(_0x6331('0x1'));var BPromise=require('bluebird');var rs=require(_0x6331('0x2'));var fs=require('fs');var Redis=require(_0x6331('0x3'));var db=require(_0x6331('0x4'))['db'];var utils=require(_0x6331('0x5'));var logger=require(_0x6331('0x6'))('rpc');var config=require(_0x6331('0x7'));var jayson=require(_0x6331('0x8'));var client=jayson[_0x6331('0x9')][_0x6331('0xa')]({'port':0x232a});config[_0x6331('0xb')]=_[_0x6331('0xc')](config[_0x6331('0xb')],{'host':_0x6331('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6331('0xb')]));require(_0x6331('0xe'))[_0x6331('0xf')](socket);function respondWithRpcPromise(_0x446524,_0x407303,_0x34065d){return new BPromise(function(_0x15aa07,_0x27a8ef){return client[_0x6331('0x10')](_0x446524,_0x34065d)[_0x6331('0x11')](function(_0x5365b6){logger[_0x6331('0x12')](_0x6331('0x13'),_0x407303,'request\x20sent');logger['debug'](_0x6331('0x14'),_0x407303,_0x6331('0x15'),JSON[_0x6331('0x16')](_0x5365b6));if(_0x5365b6['error']){if(_0x5365b6[_0x6331('0x17')][_0x6331('0x18')]===0x1f4){logger[_0x6331('0x17')](_0x6331('0x13'),_0x407303,_0x5365b6['error'][_0x6331('0x19')]);return _0x27a8ef(_0x5365b6[_0x6331('0x17')][_0x6331('0x19')]);}logger[_0x6331('0x17')](_0x6331('0x13'),_0x407303,_0x5365b6[_0x6331('0x17')][_0x6331('0x19')]);return _0x15aa07(_0x5365b6[_0x6331('0x17')][_0x6331('0x19')]);}else{logger['info'](_0x6331('0x13'),_0x407303,'request\x20sent');_0x15aa07(_0x5365b6[_0x6331('0x1a')][_0x6331('0x19')]);}})['catch'](function(_0x453e20){logger['error'](_0x6331('0x13'),_0x407303,_0x453e20);_0x27a8ef(_0x453e20);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b7472a6..ebad821 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 _0x5a3f=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','update'];(function(_0xf96c0a,_0x28d535){var _0x1cd6a7=function(_0x317dd0){while(--_0x317dd0){_0xf96c0a['push'](_0xf96c0a['shift']());}};_0x1cd6a7(++_0x28d535);}(_0x5a3f,0x101));var _0xf5a3=function(_0x496d59,_0x2839f9){_0x496d59=_0x496d59-0x0;var _0x39f033=_0x5a3f[_0x496d59];return _0x39f033;};'use strict';var ChatInternalMessageEvents=require(_0xf5a3('0x0'));var events=['save','remove',_0xf5a3('0x1')];function createListener(_0x55082c,_0x467c98){return function(_0x19d6ac){_0x467c98[_0xf5a3('0x2')](_0x55082c,_0x19d6ac);};}function removeListener(_0x36d64d,_0x27ae33){return function(){ChatInternalMessageEvents[_0xf5a3('0x3')](_0x36d64d,_0x27ae33);};}exports[_0xf5a3('0x4')]=function(_0x48e459){for(var _0x3e7fa0=0x0,_0x5a45da=events[_0xf5a3('0x5')];_0x3e7fa0<_0x5a45da;_0x3e7fa0++){var _0x41ccdd=events[_0x3e7fa0];var _0x965934=createListener(_0xf5a3('0x6')+_0x41ccdd,_0x48e459);ChatInternalMessageEvents['on'](_0x41ccdd,_0x965934);}}; \ No newline at end of file +var _0x31bc=['save','remove','update','emit','removeListener','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x31bc,0x92));var _0xc31b=function(_0x2abab4,_0x3671f9){_0x2abab4=_0x2abab4-0x0;var _0x21ab3d=_0x31bc[_0x2abab4];return _0x21ab3d;};'use strict';var ChatInternalMessageEvents=require(_0xc31b('0x0'));var events=[_0xc31b('0x1'),_0xc31b('0x2'),_0xc31b('0x3')];function createListener(_0x36a1ca,_0x1be77b){return function(_0x1dbe54){_0x1be77b[_0xc31b('0x4')](_0x36a1ca,_0x1dbe54);};}function removeListener(_0x308135,_0x5805c4){return function(){ChatInternalMessageEvents[_0xc31b('0x5')](_0x308135,_0x5805c4);};}exports['register']=function(_0x11edd4){for(var _0x248da3=0x0,_0x502b09=events['length'];_0x248da3<_0x502b09;_0x248da3++){var _0x15e3d2=events[_0x248da3];var _0x33aa23=createListener(_0xc31b('0x6')+_0x15e3d2,_0x11edd4);ChatInternalMessageEvents['on'](_0x15e3d2,_0x33aa23);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 373e25d..0ee8b56 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 _0xd6d8=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','multer','path'];(function(_0x283013,_0x2c202a){var _0x2e3bc2=function(_0x4eb3e9){while(--_0x4eb3e9){_0x283013['push'](_0x283013['shift']());}};_0x2e3bc2(++_0x2c202a);}(_0xd6d8,0xde));var _0x8d6d=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd6d8[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x8d6d('0x0'));var util=require('util');var path=require(_0x8d6d('0x1'));var timeout=require(_0x8d6d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d6d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8d6d('0x4'));var config=require(_0x8d6d('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x8d6d('0x6')]('/',auth[_0x8d6d('0x7')](),controller['index']);router[_0x8d6d('0x6')](_0x8d6d('0x8'),auth[_0x8d6d('0x7')](),controller[_0x8d6d('0x9')]);router[_0x8d6d('0x6')]('/users',auth[_0x8d6d('0x7')](),controller['getUsers']);router[_0x8d6d('0x6')](_0x8d6d('0xa'),auth[_0x8d6d('0x7')](),controller[_0x8d6d('0xb')]);router[_0x8d6d('0xc')]('/',auth[_0x8d6d('0x7')](),controller['create']);router['put'](_0x8d6d('0xa'),controller[_0x8d6d('0xd')]);router[_0x8d6d('0xe')]('/:id',auth[_0x8d6d('0x7')](),controller[_0x8d6d('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9486=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/users','getUsers','/:id','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x20a048,_0x454df3){var _0x1df9b5=function(_0x25f6aa){while(--_0x25f6aa){_0x20a048['push'](_0x20a048['shift']());}};_0x1df9b5(++_0x454df3);}(_0x9486,0x73));var _0x6948=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9486[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x6948('0x0'));var util=require('util');var path=require(_0x6948('0x1'));var timeout=require(_0x6948('0x2'));var express=require(_0x6948('0x3'));var router=express[_0x6948('0x4')]();var fs_extra=require(_0x6948('0x5'));var auth=require(_0x6948('0x6'));var interaction=require(_0x6948('0x7'));var config=require(_0x6948('0x8'));var controller=require('./chatInternalMessage.controller');router[_0x6948('0x9')]('/',auth['isAuthenticated'](),controller[_0x6948('0xa')]);router['get']('/describe',auth[_0x6948('0xb')](),controller['describe']);router[_0x6948('0x9')](_0x6948('0xc'),auth['isAuthenticated'](),controller[_0x6948('0xd')]);router[_0x6948('0x9')](_0x6948('0xe'),auth[_0x6948('0xb')](),controller['show']);router['post']('/',auth[_0x6948('0xb')](),controller[_0x6948('0xf')]);router[_0x6948('0x10')](_0x6948('0xe'),controller['update']);router[_0x6948('0x11')](_0x6948('0xe'),auth[_0x6948('0xb')](),controller[_0x6948('0x12')]);module[_0x6948('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 437d167..fea7c08 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 _0xa5fa=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x32e33c,_0x2c4cf7){_0x32e33c=_0x32e33c-0x0;var _0x1805a2=_0xa5fa[_0x32e33c];return _0x1805a2;};'use strict';var Sequelize=require('sequelize');module[_0xaa5f('0x0')]={'body':{'type':Sequelize[_0xaa5f('0x1')](_0xaa5f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xaa5f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa5f('0x4')]('in',_0xaa5f('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xaa5f('0x6')]},'providerName':{'type':Sequelize[_0xaa5f('0x7')]},'providerResponse':{'type':Sequelize[_0xaa5f('0x1')]}}; \ No newline at end of file +var _0x7275=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1b773e,_0x37b69c){var _0x44c4a2=function(_0x2eb17d){while(--_0x2eb17d){_0x1b773e['push'](_0x1b773e['shift']());}};_0x44c4a2(++_0x37b69c);}(_0x7275,0x143));var _0x5727=function(_0x10bd19,_0x5d0490){_0x10bd19=_0x10bd19-0x0;var _0xbe5000=_0x7275[_0x10bd19];return _0xbe5000;};'use strict';var Sequelize=require(_0x5727('0x0'));module[_0x5727('0x1')]={'body':{'type':Sequelize[_0x5727('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5727('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5727('0x4')]('in',_0x5727('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x5727('0x6')]},'providerName':{'type':Sequelize[_0x5727('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0042983..0cdd19f 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 _0x7239=['merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','find','create','body','describe','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','parse','formData','null','RejectMessage','rejectMessage','ContactId','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','name','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7239,0x1c3));var _0x9723=function(_0x18aed2,_0x416200){_0x18aed2=_0x18aed2-0x0;var _0x2385e8=_0x7239[_0x18aed2];return _0x2385e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9723('0x0'));var zipdir=require(_0x9723('0x1'));var jsonpatch=require(_0x9723('0x2'));var rp=require(_0x9723('0x3'));var moment=require(_0x9723('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9723('0x5'));var sox=require('sox');var csv=require(_0x9723('0x6'));var ejs=require(_0x9723('0x7'));var fs=require('fs');var fs_extra=require(_0x9723('0x8'));var _=require(_0x9723('0x9'));var squel=require('squel');var crypto=require(_0x9723('0xa'));var jsforce=require(_0x9723('0xb'));var deskjs=require(_0x9723('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9723('0xd'));var Papa=require('papaparse');var Redis=require(_0x9723('0xe'));var authService=require(_0x9723('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9723('0x10'));var logger=require(_0x9723('0x11'))('api');var utils=require(_0x9723('0x12'));var config=require(_0x9723('0x13'));var licenseUtil=require(_0x9723('0x14'));var db=require(_0x9723('0x15'))['db'];config[_0x9723('0x16')]=_[_0x9723('0x17')](config[_0x9723('0x16')],{'host':_0x9723('0x18'),'port':0x18eb});var socket=require(_0x9723('0x19'))(new Redis(config[_0x9723('0x16')]));require(_0x9723('0x1a'))[_0x9723('0x1b')](socket);var jayson=require(_0x9723('0x1c'));var client=jayson[_0x9723('0x1d')][_0x9723('0x1e')]({'port':0x232c});var client9002=jayson[_0x9723('0x1d')][_0x9723('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x499f8d,_0x5b4c66,_0x50555d,_0x4c8f14){return new BPromise(function(_0x19d535,_0x4a4d5b){var _0x103508=_0x4c8f14||client;return _0x103508['request'](_0x499f8d,_0x50555d)['then'](function(_0x164340){logger[_0x9723('0x1f')](_0x9723('0x20'),_0x5b4c66,_0x9723('0x21'));logger[_0x9723('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5b4c66,_0x9723('0x21'),JSON[_0x9723('0x23')](_0x164340));if(_0x164340[_0x9723('0x24')]){if(_0x164340[_0x9723('0x24')][_0x9723('0x25')]===0x1f4){logger[_0x9723('0x24')](_0x9723('0x20'),_0x5b4c66,_0x164340[_0x9723('0x24')][_0x9723('0x26')]);return _0x4a4d5b(_0x164340[_0x9723('0x24')][_0x9723('0x26')]);}logger[_0x9723('0x24')](_0x9723('0x20'),_0x5b4c66,_0x164340[_0x9723('0x24')][_0x9723('0x26')]);return _0x19d535(_0x164340[_0x9723('0x24')][_0x9723('0x26')]);}else{logger[_0x9723('0x1f')]('ChatMessage,\x20%s,\x20%s',_0x5b4c66,_0x9723('0x21'));_0x19d535(_0x164340[_0x9723('0x27')][_0x9723('0x26')]);}})[_0x9723('0x28')](function(_0x113995){logger['error'](_0x9723('0x20'),_0x5b4c66,_0x113995);_0x4a4d5b(_0x113995);});});}function respondWithStatusCode(_0x9de5c,_0x42c432){_0x42c432=_0x42c432||0xcc;return function(_0x2097eb){if(_0x2097eb){return _0x9de5c[_0x9723('0x29')](_0x42c432);}return _0x9de5c[_0x9723('0x2a')](_0x42c432)['end']();};}function respondWithResult(_0x4fb129,_0x43c3f4){_0x43c3f4=_0x43c3f4||0xc8;return function(_0x42e2f6){if(_0x42e2f6){return _0x4fb129[_0x9723('0x2a')](_0x43c3f4)[_0x9723('0x2b')](_0x42e2f6);}};}function respondWithFilteredResult(_0x199201,_0x550734){return function(_0x2ee7bb){if(_0x2ee7bb){var _0x5b6046=typeof _0x550734['offset']===_0x9723('0x2c')&&typeof _0x550734['limit']===_0x9723('0x2c');var _0x19efa7=_0x2ee7bb[_0x9723('0x2d')];var _0x1f3ffb=_0x5b6046?0x0:_0x550734[_0x9723('0x2e')];var _0x3391ae=_0x5b6046?_0x2ee7bb[_0x9723('0x2d')]:_0x550734['offset']+_0x550734[_0x9723('0x2f')];var _0x10cf61;if(_0x3391ae>=_0x19efa7){_0x3391ae=_0x19efa7;_0x10cf61=0xc8;}else{_0x10cf61=0xce;}_0x199201[_0x9723('0x2a')](_0x10cf61);return _0x199201[_0x9723('0x30')](_0x9723('0x31'),_0x1f3ffb+'-'+_0x3391ae+'/'+_0x19efa7)['json'](_0x2ee7bb);}return null;};}function patchUpdates(_0x57aca7){return function(_0x13140e){try{jsonpatch[_0x9723('0x32')](_0x13140e,_0x57aca7,!![]);}catch(_0x30b4a6){return BPromise[_0x9723('0x33')](_0x30b4a6);}return _0x13140e['save']();};}function saveUpdates(_0x14c1fa,_0x3e808e){return function(_0x187168){if(_0x187168){return _0x187168[_0x9723('0x34')](_0x14c1fa)[_0x9723('0x35')](function(_0x195992){return _0x195992;});}return null;};}function removeEntity(_0x3287f1,_0x40133b){return function(_0x5edae5){if(_0x5edae5){return _0x5edae5[_0x9723('0x36')]()[_0x9723('0x35')](function(){_0x3287f1[_0x9723('0x2a')](0xcc)[_0x9723('0x37')]();});}};}function handleEntityNotFound(_0x219fd3,_0x3f1dde){return function(_0x2f7c56){if(!_0x2f7c56){_0x219fd3[_0x9723('0x29')](0x194);}return _0x2f7c56;};}function handleError(_0x30b7c2,_0x309cba){_0x309cba=_0x309cba||0x1f4;return function(_0x308f43){logger['error'](_0x308f43['stack']);if(_0x308f43[_0x9723('0x38')]){delete _0x308f43['name'];}_0x30b7c2[_0x9723('0x2a')](_0x309cba)['send'](_0x308f43);};}exports[_0x9723('0x39')]=function(_0x31f3e0,_0x7cbcdd){var _0x144462={},_0x463cf9={},_0x44e35e={'count':0x0,'rows':[]};var _0x11237a=_[_0x9723('0x3a')](db[_0x9723('0x3b')][_0x9723('0x3c')],function(_0x33dc37){return{'name':_0x33dc37[_0x9723('0x3d')],'type':_0x33dc37[_0x9723('0x3e')][_0x9723('0x3f')]};});_0x463cf9[_0x9723('0x40')]=_[_0x9723('0x3a')](_0x11237a,_0x9723('0x38'));_0x463cf9[_0x9723('0x41')]=_[_0x9723('0x42')](_0x31f3e0[_0x9723('0x41')]);_0x463cf9['filters']=_[_0x9723('0x43')](_0x463cf9[_0x9723('0x40')],_0x463cf9[_0x9723('0x41')]);_0x144462[_0x9723('0x44')]=_[_0x9723('0x43')](_0x463cf9['model'],qs['fields'](_0x31f3e0[_0x9723('0x41')][_0x9723('0x45')]));_0x144462[_0x9723('0x44')]=_0x144462[_0x9723('0x44')][_0x9723('0x46')]?_0x144462[_0x9723('0x44')]:_0x463cf9['model'];if(!_0x31f3e0[_0x9723('0x41')][_0x9723('0x47')]('nolimit')){_0x144462[_0x9723('0x2f')]=qs['limit'](_0x31f3e0[_0x9723('0x41')][_0x9723('0x2f')]);_0x144462[_0x9723('0x2e')]=qs[_0x9723('0x2e')](_0x31f3e0['query'][_0x9723('0x2e')]);}_0x144462[_0x9723('0x48')]=qs[_0x9723('0x49')](_0x31f3e0[_0x9723('0x41')][_0x9723('0x49')]);_0x144462[_0x9723('0x4a')]=qs[_0x9723('0x4b')](_[_0x9723('0x4c')](_0x31f3e0[_0x9723('0x41')],_0x463cf9['filters']),_0x11237a);if(_0x31f3e0['query']['filter']){_0x144462['where']=_[_0x9723('0x4d')](_0x144462[_0x9723('0x4a')],{'$or':_[_0x9723('0x3a')](_0x11237a,function(_0x5368c0){if(_0x5368c0[_0x9723('0x3e')]!==_0x9723('0x4e')){var _0x487117={};_0x487117[_0x5368c0[_0x9723('0x38')]]={'$like':'%'+_0x31f3e0[_0x9723('0x41')][_0x9723('0x4f')]+'%'};return _0x487117;}})});}_0x144462=_[_0x9723('0x4d')]({},_0x144462,_0x31f3e0[_0x9723('0x50')]);var _0x397613={'where':_0x144462[_0x9723('0x4a')]};return db[_0x9723('0x3b')][_0x9723('0x2d')](_0x397613)[_0x9723('0x35')](function(_0x1db6f4){_0x44e35e[_0x9723('0x2d')]=_0x1db6f4;if(_0x31f3e0[_0x9723('0x41')]['includeAll']){_0x144462[_0x9723('0x51')]=[{'all':!![]}];}return db[_0x9723('0x3b')][_0x9723('0x52')](_0x144462);})[_0x9723('0x35')](function(_0x3eb7b4){_0x44e35e[_0x9723('0x53')]=_0x3eb7b4;return _0x44e35e;})[_0x9723('0x35')](respondWithFilteredResult(_0x7cbcdd,_0x144462))[_0x9723('0x28')](handleError(_0x7cbcdd,null));};exports[_0x9723('0x54')]=function(_0x21c5b8,_0x2fafbf){var _0x525213={'raw':!![],'where':{'id':_0x21c5b8[_0x9723('0x55')]['id']}},_0x1d2302={};_0x1d2302[_0x9723('0x40')]=_[_0x9723('0x42')](db['ChatMessage'][_0x9723('0x3c')]);_0x1d2302['query']=_[_0x9723('0x42')](_0x21c5b8[_0x9723('0x41')]);_0x1d2302[_0x9723('0x4b')]=_['intersection'](_0x1d2302['model'],_0x1d2302[_0x9723('0x41')]);_0x525213[_0x9723('0x44')]=_['intersection'](_0x1d2302['model'],qs[_0x9723('0x45')](_0x21c5b8[_0x9723('0x41')][_0x9723('0x45')]));_0x525213[_0x9723('0x44')]=_0x525213['attributes'][_0x9723('0x46')]?_0x525213[_0x9723('0x44')]:_0x1d2302[_0x9723('0x40')];if(_0x21c5b8[_0x9723('0x41')][_0x9723('0x56')]){_0x525213[_0x9723('0x51')]=[{'all':!![]}];}_0x525213=_[_0x9723('0x4d')]({},_0x525213,_0x21c5b8[_0x9723('0x50')]);return db[_0x9723('0x3b')][_0x9723('0x57')](_0x525213)['then'](handleEntityNotFound(_0x2fafbf,null))[_0x9723('0x35')](respondWithResult(_0x2fafbf,null))[_0x9723('0x28')](handleError(_0x2fafbf,null));};exports['create']=function(_0x5106da,_0x2c7c85){return db[_0x9723('0x3b')][_0x9723('0x58')](_0x5106da[_0x9723('0x59')],{})[_0x9723('0x35')](respondWithResult(_0x2c7c85,0xc9))[_0x9723('0x28')](handleError(_0x2c7c85,null));};exports[_0x9723('0x34')]=function(_0x2dcadb,_0x2b1b70){if(_0x2dcadb[_0x9723('0x59')]['id']){delete _0x2dcadb[_0x9723('0x59')]['id'];}return db[_0x9723('0x3b')][_0x9723('0x57')]({'where':{'id':_0x2dcadb[_0x9723('0x55')]['id']}})[_0x9723('0x35')](handleEntityNotFound(_0x2b1b70,null))[_0x9723('0x35')](saveUpdates(_0x2dcadb[_0x9723('0x59')],null))[_0x9723('0x35')](respondWithResult(_0x2b1b70,null))['catch'](handleError(_0x2b1b70,null));};exports[_0x9723('0x36')]=function(_0x5e26ff,_0x4ecb22){return db[_0x9723('0x3b')][_0x9723('0x57')]({'where':{'id':_0x5e26ff['params']['id']}})[_0x9723('0x35')](handleEntityNotFound(_0x4ecb22,null))[_0x9723('0x35')](removeEntity(_0x4ecb22,null))['catch'](handleError(_0x4ecb22,null));};exports[_0x9723('0x5a')]=function(_0x48d7f2,_0x4c6b98){return db[_0x9723('0x3b')]['describe']()['then'](respondWithResult(_0x4c6b98,null))[_0x9723('0x28')](handleError(_0x4c6b98,null));};var interaction_log=require(_0x9723('0x11'))(_0x9723('0x5b'));exports[_0x9723('0x5c')]=function(_0x424ad8,_0x26abf2,_0x16220c){var _0x1bbce5={'agent':{},'channel':_0x9723('0x5d')};if(_0x424ad8[_0x9723('0x59')]['id']){delete _0x424ad8[_0x9723('0x59')]['id'];}_0x424ad8[_0x9723('0x59')]['read']=!![];_0x424ad8['body'][_0x9723('0x5e')]=moment()[_0x9723('0x5f')](_0x9723('0x60'));_0x424ad8[_0x9723('0x59')]['UserId']=_0x424ad8[_0x9723('0x59')][_0x9723('0x61')]||_0x424ad8['user']['id'];_0x1bbce5['agent']['id']=_0x424ad8[_0x9723('0x59')][_0x9723('0x61')];return db[_0x9723('0x3b')]['find']({'where':{'id':_0x424ad8[_0x9723('0x55')]['id'],'UserId':null}})[_0x9723('0x35')](handleEntityNotFound(_0x26abf2,null))[_0x9723('0x35')](saveUpdates(_0x424ad8[_0x9723('0x59')],null))[_0x9723('0x35')](function(_0x34187c){if(_0x34187c){_0x1bbce5[_0x9723('0x26')]=_0x34187c[_0x9723('0x62')]({'plain':!![]});return db[_0x9723('0x63')][_0x9723('0x57')]({'where':{'id':_0x34187c[_0x9723('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x26abf2,null))[_0x9723('0x35')](function(_0x23e258){if(_0x23e258){return _0x23e258['update']({'UserId':_0x424ad8[_0x9723('0x59')]['UserId'],'read1stAt':_[_0x9723('0x65')](_0x23e258[_0x9723('0x66')])?moment()[_0x9723('0x5f')](_0x9723('0x60')):undefined});}return null;})[_0x9723('0x35')](function(_0x584464){if(_0x584464){_0x1bbce5[_0x9723('0x67')]=_0x584464[_0x9723('0x62')]({'plain':!![]});interaction_log[_0x9723('0x1f')](_0x9723('0x68'),_0x424ad8['user']['id'],_0x424ad8['user']['name'],_0x424ad8[_0x9723('0x69')][_0x9723('0x6a')],_0x1bbce5[_0x9723('0x67')]['id'],_0x424ad8[_0x9723('0x59')]?JSON[_0x9723('0x23')](_0x424ad8[_0x9723('0x59')]):'null');return respondWithRpcPromise(_0x9723('0x6b'),'acceptMessage',_0x1bbce5);}return null;})[_0x9723('0x35')](function(_0x47f739){var _0x1d6a8b=_0x9723('0x6c')+_0x47f739['message']['ContactId'];return db[_0x9723('0x6d')][_0x9723('0x41')](_0x1d6a8b,{'type':db[_0x9723('0x6e')][_0x9723('0x6f')][_0x9723('0x70')],'raw':!![]})[_0x9723('0x35')](function(_0x53f9f7){return _0x53f9f7;});})[_0x9723('0x35')](function(_0x6326a){if(_0x6326a){_0x1bbce5[_0x9723('0x26')][_0x9723('0x71')]=_0x6326a[0x0];if(!_0x424ad8[_0x9723('0x59')][_0x9723('0x61')])return;return db['User'][_0x9723('0x57')]({'where':{'id':_0x424ad8[_0x9723('0x59')][_0x9723('0x61')],'role':_0x9723('0x72')},'attributes':['id',_0x9723('0x38'),_0x9723('0x73'),'email',_0x9723('0x74')],'raw':!![]});}return null;})[_0x9723('0x35')](function(_0x2eb0fe){if(!_0x2eb0fe)return null;_0x1bbce5[_0x9723('0x26')][_0x9723('0x72')]=_0x2eb0fe;return _0x1bbce5;})[_0x9723('0x35')](function(_0x52dd42){if(_0x52dd42){if(_0x424ad8['body'][_0x9723('0x75')]){_0x1bbce5[_0x9723('0x26')][_0x9723('0x76')]=util['format'](_0x9723('0x77'),_0x424ad8[_0x9723('0x69')]['name']);_0x1bbce5[_0x9723('0x26')]['channel']=_0x1bbce5['channel'];_0x1bbce5[_0x9723('0x26')][_0x9723('0x78')]=_0x1bbce5[_0x9723('0x79')];_0x1bbce5[_0x9723('0x26')][_0x9723('0x7a')]=_0x9723('0x5c');return respondWithRpcPromise(_0x9723('0x7b'),'EventManager',{'event':_0x9723('0x7c'),'message':_[_0x9723('0x4d')](_0x1bbce5['message'],JSON[_0x9723('0x7d')](_0x1bbce5[_0x9723('0x67')][_0x9723('0x7e')]))},client9002)[_0x9723('0x35')](function(){return _0x1bbce5;});}return _0x1bbce5;}return null;})['then'](respondWithResult(_0x26abf2,null))[_0x9723('0x28')](handleError(_0x26abf2,null));};var interaction_log=require('../../config/logger')(_0x9723('0x5b'));exports[_0x9723('0x33')]=function(_0x35378e,_0x26a004,_0x2397d2){var _0x21035b={'agent':{},'channel':_0x9723('0x5d')};if(_0x35378e[_0x9723('0x59')]['id']){delete _0x35378e[_0x9723('0x59')]['id'];}_0x35378e[_0x9723('0x59')][_0x9723('0x61')]=_0x35378e[_0x9723('0x59')][_0x9723('0x61')]||_0x35378e[_0x9723('0x69')]['id'];_0x21035b[_0x9723('0x72')]['id']=_0x35378e['body']['UserId'];return db[_0x9723('0x3b')][_0x9723('0x57')]({'where':{'id':_0x35378e[_0x9723('0x55')]['id'],'UserId':null}})[_0x9723('0x35')](handleEntityNotFound(_0x26a004,null))[_0x9723('0x35')](function(_0xbbc61){if(_0xbbc61){_0x21035b[_0x9723('0x26')]=_0xbbc61[_0x9723('0x62')]({'plain':!![]});return db[_0x9723('0x63')][_0x9723('0x57')]({'where':{'id':_0xbbc61[_0x9723('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x26a004,null))[_0x9723('0x35')](function(_0x3f12ed){if(_0x3f12ed){_0x21035b[_0x9723('0x67')]=_0x3f12ed[_0x9723('0x62')]({'plain':!![]});interaction_log[_0x9723('0x1f')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x35378e[_0x9723('0x69')]['id'],_0x35378e['user']['name'],_0x35378e[_0x9723('0x69')][_0x9723('0x6a')],_0x21035b[_0x9723('0x67')]['id'],_0x35378e[_0x9723('0x59')]?JSON[_0x9723('0x23')](_0x35378e[_0x9723('0x59')]):_0x9723('0x7f'));return respondWithRpcPromise(_0x9723('0x80'),_0x9723('0x81'),_0x21035b);}return null;})[_0x9723('0x35')](function(_0x1e8d84){var _0x2b9fed=_0x9723('0x6c')+_0x1e8d84[_0x9723('0x26')][_0x9723('0x82')];return db[_0x9723('0x6d')]['query'](_0x2b9fed,{'type':db[_0x9723('0x6e')][_0x9723('0x6f')]['SELECT'],'raw':!![]})[_0x9723('0x35')](function(_0x22327b){return _0x22327b;});})['then'](function(_0x16459d){if(_0x16459d){_0x21035b[_0x9723('0x26')][_0x9723('0x71')]=_0x16459d[0x0];if(!_0x35378e[_0x9723('0x59')]['UserId'])return;return db['User']['find']({'where':{'id':_0x35378e['body']['UserId'],'role':_0x9723('0x72')},'attributes':['id','name',_0x9723('0x73'),'email','internal'],'raw':!![]});}return null;})[_0x9723('0x35')](function(_0x3281f6){if(!_0x3281f6)return null;_0x21035b[_0x9723('0x26')][_0x9723('0x72')]=_0x3281f6;return _0x21035b;})['then'](function(_0x50f2fd){if(_0x50f2fd){_0x50f2fd[_0x9723('0x26')][_0x9723('0x76')]=util[_0x9723('0x5f')](_0x9723('0x77'),_0x35378e[_0x9723('0x69')][_0x9723('0x38')]);_0x50f2fd[_0x9723('0x26')]['channel']=_0x21035b[_0x9723('0x79')];_0x50f2fd[_0x9723('0x26')][_0x9723('0x78')]=_0x21035b['channel'];_0x50f2fd[_0x9723('0x26')][_0x9723('0x7a')]=_0x9723('0x33');respondWithRpcPromise(_0x9723('0x7b'),_0x9723('0x7b'),{'event':_0x9723('0x83'),'message':_[_0x9723('0x4d')](_0x21035b[_0x9723('0x26')],JSON[_0x9723('0x7d')](_0x21035b[_0x9723('0x67')][_0x9723('0x7e')]))},client9002);return _0x21035b;}return null;})[_0x9723('0x35')](respondWithResult(_0x26a004,null))[_0x9723('0x28')](handleError(_0x26a004,null));}; \ No newline at end of file +var _0x5fc0=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','contact','event','rejectmessage','formData','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','find','create','update','body','describe','chat-interactions','accept','chat','read','readAt','format'];(function(_0x433ef7,_0xa04efb){var _0x19174a=function(_0x1436f5){while(--_0x1436f5){_0x433ef7['push'](_0x433ef7['shift']());}};_0x19174a(++_0xa04efb);}(_0x5fc0,0xa8));var _0x05fc=function(_0x4a140f,_0x5522bc){_0x4a140f=_0x4a140f-0x0;var _0x102680=_0x5fc0[_0x4a140f];return _0x102680;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x05fc('0x0'));var zipdir=require(_0x05fc('0x1'));var jsonpatch=require(_0x05fc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x05fc('0x3'));var Mustache=require(_0x05fc('0x4'));var util=require(_0x05fc('0x5'));var path=require(_0x05fc('0x6'));var sox=require(_0x05fc('0x7'));var csv=require(_0x05fc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x05fc('0x9'));var squel=require(_0x05fc('0xa'));var crypto=require(_0x05fc('0xb'));var jsforce=require(_0x05fc('0xc'));var deskjs=require(_0x05fc('0xd'));var toCsv=require(_0x05fc('0x8'));var querystring=require(_0x05fc('0xe'));var Papa=require(_0x05fc('0xf'));var Redis=require(_0x05fc('0x10'));var authService=require(_0x05fc('0x11'));var qs=require(_0x05fc('0x12'));var as=require(_0x05fc('0x13'));var hardwareService=require(_0x05fc('0x14'));var logger=require(_0x05fc('0x15'))(_0x05fc('0x16'));var utils=require(_0x05fc('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x05fc('0x18')]=_['defaults'](config[_0x05fc('0x18')],{'host':_0x05fc('0x19'),'port':0x18eb});var socket=require(_0x05fc('0x1a'))(new Redis(config['redis']));require(_0x05fc('0x1b'))[_0x05fc('0x1c')](socket);var jayson=require(_0x05fc('0x1d'));var client=jayson[_0x05fc('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x05fc('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xad1007,_0xf6472a,_0xcfcbd8,_0x27c6fb){return new BPromise(function(_0x2417ad,_0x270fa4){var _0x4e0258=_0x27c6fb||client;return _0x4e0258[_0x05fc('0x1f')](_0xad1007,_0xcfcbd8)[_0x05fc('0x20')](function(_0xcf059f){logger[_0x05fc('0x21')](_0x05fc('0x22'),_0xf6472a,_0x05fc('0x23'));logger['debug'](_0x05fc('0x24'),_0xf6472a,'request\x20sent',JSON[_0x05fc('0x25')](_0xcf059f));if(_0xcf059f[_0x05fc('0x26')]){if(_0xcf059f[_0x05fc('0x26')][_0x05fc('0x27')]===0x1f4){logger[_0x05fc('0x26')](_0x05fc('0x22'),_0xf6472a,_0xcf059f[_0x05fc('0x26')][_0x05fc('0x28')]);return _0x270fa4(_0xcf059f['error']['message']);}logger['error'](_0x05fc('0x22'),_0xf6472a,_0xcf059f['error']['message']);return _0x2417ad(_0xcf059f['error'][_0x05fc('0x28')]);}else{logger[_0x05fc('0x21')](_0x05fc('0x22'),_0xf6472a,'request\x20sent');_0x2417ad(_0xcf059f[_0x05fc('0x29')][_0x05fc('0x28')]);}})[_0x05fc('0x2a')](function(_0x2a0f83){logger[_0x05fc('0x26')](_0x05fc('0x22'),_0xf6472a,_0x2a0f83);_0x270fa4(_0x2a0f83);});});}function respondWithStatusCode(_0x58b24f,_0x4f2553){_0x4f2553=_0x4f2553||0xcc;return function(_0x595d56){if(_0x595d56){return _0x58b24f['sendStatus'](_0x4f2553);}return _0x58b24f[_0x05fc('0x2b')](_0x4f2553)[_0x05fc('0x2c')]();};}function respondWithResult(_0x3e974b,_0x37d70e){_0x37d70e=_0x37d70e||0xc8;return function(_0x5150d4){if(_0x5150d4){return _0x3e974b[_0x05fc('0x2b')](_0x37d70e)['json'](_0x5150d4);}};}function respondWithFilteredResult(_0x8db9c9,_0x35a132){return function(_0x2fabce){if(_0x2fabce){var _0x22f0cd=typeof _0x35a132[_0x05fc('0x2d')]===_0x05fc('0x2e')&&typeof _0x35a132[_0x05fc('0x2f')]===_0x05fc('0x2e');var _0x490fa8=_0x2fabce['count'];var _0x2c870e=_0x22f0cd?0x0:_0x35a132['offset'];var _0x2bb966=_0x22f0cd?_0x2fabce[_0x05fc('0x30')]:_0x35a132[_0x05fc('0x2d')]+_0x35a132[_0x05fc('0x2f')];var _0x1976fa;if(_0x2bb966>=_0x490fa8){_0x2bb966=_0x490fa8;_0x1976fa=0xc8;}else{_0x1976fa=0xce;}_0x8db9c9[_0x05fc('0x2b')](_0x1976fa);return _0x8db9c9[_0x05fc('0x31')](_0x05fc('0x32'),_0x2c870e+'-'+_0x2bb966+'/'+_0x490fa8)['json'](_0x2fabce);}return null;};}function patchUpdates(_0x2454ef){return function(_0x527ce6){try{jsonpatch[_0x05fc('0x33')](_0x527ce6,_0x2454ef,!![]);}catch(_0xacd51){return BPromise[_0x05fc('0x34')](_0xacd51);}return _0x527ce6['save']();};}function saveUpdates(_0x4586ac,_0x34383b){return function(_0x58ecf0){if(_0x58ecf0){return _0x58ecf0['update'](_0x4586ac)['then'](function(_0x48bbce){return _0x48bbce;});}return null;};}function removeEntity(_0x423054,_0x1872ea){return function(_0x309a15){if(_0x309a15){return _0x309a15[_0x05fc('0x35')]()[_0x05fc('0x20')](function(){_0x423054[_0x05fc('0x2b')](0xcc)[_0x05fc('0x2c')]();});}};}function handleEntityNotFound(_0x17d699,_0x56e123){return function(_0x5b2b96){if(!_0x5b2b96){_0x17d699[_0x05fc('0x36')](0x194);}return _0x5b2b96;};}function handleError(_0x20d482,_0x97ba42){_0x97ba42=_0x97ba42||0x1f4;return function(_0x43ef53){logger[_0x05fc('0x26')](_0x43ef53[_0x05fc('0x37')]);if(_0x43ef53[_0x05fc('0x38')]){delete _0x43ef53[_0x05fc('0x38')];}_0x20d482['status'](_0x97ba42)[_0x05fc('0x39')](_0x43ef53);};}exports[_0x05fc('0x3a')]=function(_0x9e755,_0x1b30db){var _0x254ed7={},_0x5b6d44={},_0x3cc87d={'count':0x0,'rows':[]};var _0x3a5743=_[_0x05fc('0x3b')](db[_0x05fc('0x3c')][_0x05fc('0x3d')],function(_0x4d1012){return{'name':_0x4d1012['fieldName'],'type':_0x4d1012['type'][_0x05fc('0x3e')]};});_0x5b6d44['model']=_[_0x05fc('0x3b')](_0x3a5743,_0x05fc('0x38'));_0x5b6d44[_0x05fc('0x3f')]=_[_0x05fc('0x40')](_0x9e755[_0x05fc('0x3f')]);_0x5b6d44[_0x05fc('0x41')]=_[_0x05fc('0x42')](_0x5b6d44['model'],_0x5b6d44[_0x05fc('0x3f')]);_0x254ed7[_0x05fc('0x43')]=_['intersection'](_0x5b6d44['model'],qs[_0x05fc('0x44')](_0x9e755[_0x05fc('0x3f')][_0x05fc('0x44')]));_0x254ed7[_0x05fc('0x43')]=_0x254ed7['attributes'][_0x05fc('0x45')]?_0x254ed7['attributes']:_0x5b6d44[_0x05fc('0x46')];if(!_0x9e755[_0x05fc('0x3f')][_0x05fc('0x47')](_0x05fc('0x48'))){_0x254ed7[_0x05fc('0x2f')]=qs[_0x05fc('0x2f')](_0x9e755[_0x05fc('0x3f')][_0x05fc('0x2f')]);_0x254ed7[_0x05fc('0x2d')]=qs['offset'](_0x9e755[_0x05fc('0x3f')][_0x05fc('0x2d')]);}_0x254ed7[_0x05fc('0x49')]=qs[_0x05fc('0x4a')](_0x9e755[_0x05fc('0x3f')][_0x05fc('0x4a')]);_0x254ed7[_0x05fc('0x4b')]=qs[_0x05fc('0x41')](_[_0x05fc('0x4c')](_0x9e755[_0x05fc('0x3f')],_0x5b6d44[_0x05fc('0x41')]),_0x3a5743);if(_0x9e755[_0x05fc('0x3f')][_0x05fc('0x4d')]){_0x254ed7['where']=_[_0x05fc('0x4e')](_0x254ed7[_0x05fc('0x4b')],{'$or':_[_0x05fc('0x3b')](_0x3a5743,function(_0x5124b5){if(_0x5124b5[_0x05fc('0x4f')]!==_0x05fc('0x50')){var _0x457dd2={};_0x457dd2[_0x5124b5['name']]={'$like':'%'+_0x9e755[_0x05fc('0x3f')][_0x05fc('0x4d')]+'%'};return _0x457dd2;}})});}_0x254ed7=_['merge']({},_0x254ed7,_0x9e755[_0x05fc('0x51')]);var _0x11ce31={'where':_0x254ed7[_0x05fc('0x4b')]};return db[_0x05fc('0x3c')][_0x05fc('0x30')](_0x11ce31)[_0x05fc('0x20')](function(_0x50ab51){_0x3cc87d[_0x05fc('0x30')]=_0x50ab51;if(_0x9e755['query'][_0x05fc('0x52')]){_0x254ed7[_0x05fc('0x53')]=[{'all':!![]}];}return db[_0x05fc('0x3c')]['findAll'](_0x254ed7);})[_0x05fc('0x20')](function(_0x54747f){_0x3cc87d[_0x05fc('0x54')]=_0x54747f;return _0x3cc87d;})[_0x05fc('0x20')](respondWithFilteredResult(_0x1b30db,_0x254ed7))['catch'](handleError(_0x1b30db,null));};exports[_0x05fc('0x55')]=function(_0x2c0ce7,_0x1be0c2){var _0x8359af={'raw':!![],'where':{'id':_0x2c0ce7[_0x05fc('0x56')]['id']}},_0x44a38d={};_0x44a38d[_0x05fc('0x46')]=_[_0x05fc('0x40')](db[_0x05fc('0x3c')][_0x05fc('0x3d')]);_0x44a38d[_0x05fc('0x3f')]=_[_0x05fc('0x40')](_0x2c0ce7[_0x05fc('0x3f')]);_0x44a38d[_0x05fc('0x41')]=_[_0x05fc('0x42')](_0x44a38d[_0x05fc('0x46')],_0x44a38d[_0x05fc('0x3f')]);_0x8359af['attributes']=_[_0x05fc('0x42')](_0x44a38d[_0x05fc('0x46')],qs['fields'](_0x2c0ce7[_0x05fc('0x3f')]['fields']));_0x8359af[_0x05fc('0x43')]=_0x8359af[_0x05fc('0x43')][_0x05fc('0x45')]?_0x8359af[_0x05fc('0x43')]:_0x44a38d[_0x05fc('0x46')];if(_0x2c0ce7[_0x05fc('0x3f')][_0x05fc('0x52')]){_0x8359af[_0x05fc('0x53')]=[{'all':!![]}];}_0x8359af=_['merge']({},_0x8359af,_0x2c0ce7['options']);return db[_0x05fc('0x3c')][_0x05fc('0x57')](_0x8359af)['then'](handleEntityNotFound(_0x1be0c2,null))[_0x05fc('0x20')](respondWithResult(_0x1be0c2,null))[_0x05fc('0x2a')](handleError(_0x1be0c2,null));};exports[_0x05fc('0x58')]=function(_0x346d11,_0x1a566f){return db[_0x05fc('0x3c')][_0x05fc('0x58')](_0x346d11['body'],{})[_0x05fc('0x20')](respondWithResult(_0x1a566f,0xc9))['catch'](handleError(_0x1a566f,null));};exports[_0x05fc('0x59')]=function(_0x172ad9,_0x340b22){if(_0x172ad9[_0x05fc('0x5a')]['id']){delete _0x172ad9[_0x05fc('0x5a')]['id'];}return db[_0x05fc('0x3c')]['find']({'where':{'id':_0x172ad9['params']['id']}})[_0x05fc('0x20')](handleEntityNotFound(_0x340b22,null))[_0x05fc('0x20')](saveUpdates(_0x172ad9[_0x05fc('0x5a')],null))[_0x05fc('0x20')](respondWithResult(_0x340b22,null))[_0x05fc('0x2a')](handleError(_0x340b22,null));};exports[_0x05fc('0x35')]=function(_0x5bbc0e,_0x51b691){return db[_0x05fc('0x3c')][_0x05fc('0x57')]({'where':{'id':_0x5bbc0e[_0x05fc('0x56')]['id']}})[_0x05fc('0x20')](handleEntityNotFound(_0x51b691,null))['then'](removeEntity(_0x51b691,null))[_0x05fc('0x2a')](handleError(_0x51b691,null));};exports['describe']=function(_0x3c15d1,_0x295328){return db[_0x05fc('0x3c')][_0x05fc('0x5b')]()['then'](respondWithResult(_0x295328,null))['catch'](handleError(_0x295328,null));};var interaction_log=require(_0x05fc('0x15'))(_0x05fc('0x5c'));exports[_0x05fc('0x5d')]=function(_0x7431a5,_0x4f4bf7,_0x2e08f9){var _0x42d65f={'agent':{},'channel':_0x05fc('0x5e')};if(_0x7431a5[_0x05fc('0x5a')]['id']){delete _0x7431a5[_0x05fc('0x5a')]['id'];}_0x7431a5[_0x05fc('0x5a')][_0x05fc('0x5f')]=!![];_0x7431a5[_0x05fc('0x5a')][_0x05fc('0x60')]=moment()[_0x05fc('0x61')](_0x05fc('0x62'));_0x7431a5[_0x05fc('0x5a')][_0x05fc('0x63')]=_0x7431a5['body'][_0x05fc('0x63')]||_0x7431a5[_0x05fc('0x64')]['id'];_0x42d65f[_0x05fc('0x65')]['id']=_0x7431a5[_0x05fc('0x5a')][_0x05fc('0x63')];return db[_0x05fc('0x3c')]['find']({'where':{'id':_0x7431a5[_0x05fc('0x56')]['id'],'UserId':null}})[_0x05fc('0x20')](handleEntityNotFound(_0x4f4bf7,null))[_0x05fc('0x20')](saveUpdates(_0x7431a5['body'],null))[_0x05fc('0x20')](function(_0x572360){if(_0x572360){_0x42d65f['message']=_0x572360[_0x05fc('0x66')]({'plain':!![]});return db[_0x05fc('0x67')][_0x05fc('0x57')]({'where':{'id':_0x572360[_0x05fc('0x68')]}});}return null;})[_0x05fc('0x20')](handleEntityNotFound(_0x4f4bf7,null))['then'](function(_0x3d3621){if(_0x3d3621){return _0x3d3621[_0x05fc('0x59')]({'UserId':_0x7431a5['body'][_0x05fc('0x63')],'read1stAt':_[_0x05fc('0x69')](_0x3d3621[_0x05fc('0x6a')])?moment()[_0x05fc('0x61')](_0x05fc('0x62')):undefined});}return null;})['then'](function(_0x1f4766){if(_0x1f4766){_0x42d65f[_0x05fc('0x6b')]=_0x1f4766[_0x05fc('0x66')]({'plain':!![]});interaction_log[_0x05fc('0x21')](_0x05fc('0x6c'),_0x7431a5[_0x05fc('0x64')]['id'],_0x7431a5['user'][_0x05fc('0x38')],_0x7431a5[_0x05fc('0x64')][_0x05fc('0x6d')],_0x42d65f['interaction']['id'],_0x7431a5['body']?JSON[_0x05fc('0x25')](_0x7431a5[_0x05fc('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x42d65f);}return null;})[_0x05fc('0x20')](function(_0x728d47){var _0x5457cb=_0x05fc('0x6e')+_0x728d47[_0x05fc('0x28')][_0x05fc('0x6f')];return db[_0x05fc('0x70')][_0x05fc('0x3f')](_0x5457cb,{'type':db[_0x05fc('0x71')][_0x05fc('0x72')][_0x05fc('0x73')],'raw':!![]})[_0x05fc('0x20')](function(_0x24c49e){return _0x24c49e;});})[_0x05fc('0x20')](function(_0x1a8165){if(_0x1a8165){_0x42d65f[_0x05fc('0x28')]['contact']=_0x1a8165[0x0];if(!_0x7431a5[_0x05fc('0x5a')]['UserId'])return;return db[_0x05fc('0x74')][_0x05fc('0x57')]({'where':{'id':_0x7431a5['body'][_0x05fc('0x63')],'role':_0x05fc('0x65')},'attributes':['id','name',_0x05fc('0x75'),'email',_0x05fc('0x76')],'raw':!![]});}return null;})[_0x05fc('0x20')](function(_0x2381d4){if(!_0x2381d4)return null;_0x42d65f[_0x05fc('0x28')][_0x05fc('0x65')]=_0x2381d4;return _0x42d65f;})[_0x05fc('0x20')](function(_0xdec83e){if(_0xdec83e){if(_0x7431a5[_0x05fc('0x5a')][_0x05fc('0x77')]){_0x42d65f[_0x05fc('0x28')][_0x05fc('0x78')]=util[_0x05fc('0x61')](_0x05fc('0x79'),_0x7431a5[_0x05fc('0x64')][_0x05fc('0x38')]);_0x42d65f[_0x05fc('0x28')][_0x05fc('0x7a')]=_0x42d65f[_0x05fc('0x7a')];_0x42d65f['message'][_0x05fc('0x7b')]=_0x42d65f[_0x05fc('0x7a')];_0x42d65f[_0x05fc('0x28')]['event']='accept';return respondWithRpcPromise(_0x05fc('0x7c'),'EventManager',{'event':_0x05fc('0x7d'),'message':_[_0x05fc('0x4e')](_0x42d65f[_0x05fc('0x28')],JSON[_0x05fc('0x7e')](_0x42d65f[_0x05fc('0x6b')]['formData']))},client9002)['then'](function(){return _0x42d65f;});}return _0x42d65f;}return null;})[_0x05fc('0x20')](respondWithResult(_0x4f4bf7,null))[_0x05fc('0x2a')](handleError(_0x4f4bf7,null));};var interaction_log=require(_0x05fc('0x15'))('chat-interactions');exports[_0x05fc('0x34')]=function(_0x1404a4,_0x1cbf85,_0x190f47){var _0x52d2c7={'agent':{},'channel':_0x05fc('0x5e')};if(_0x1404a4[_0x05fc('0x5a')]['id']){delete _0x1404a4[_0x05fc('0x5a')]['id'];}_0x1404a4['body']['UserId']=_0x1404a4['body']['UserId']||_0x1404a4[_0x05fc('0x64')]['id'];_0x52d2c7[_0x05fc('0x65')]['id']=_0x1404a4[_0x05fc('0x5a')][_0x05fc('0x63')];return db[_0x05fc('0x3c')][_0x05fc('0x57')]({'where':{'id':_0x1404a4[_0x05fc('0x56')]['id'],'UserId':null}})[_0x05fc('0x20')](handleEntityNotFound(_0x1cbf85,null))[_0x05fc('0x20')](function(_0x330f5c){if(_0x330f5c){_0x52d2c7[_0x05fc('0x28')]=_0x330f5c['get']({'plain':!![]});return db[_0x05fc('0x67')][_0x05fc('0x57')]({'where':{'id':_0x330f5c['ChatInteractionId']}});}return null;})[_0x05fc('0x20')](handleEntityNotFound(_0x1cbf85,null))[_0x05fc('0x20')](function(_0x3d4dc6){if(_0x3d4dc6){_0x52d2c7[_0x05fc('0x6b')]=_0x3d4dc6['get']({'plain':!![]});interaction_log[_0x05fc('0x21')](_0x05fc('0x7f'),_0x1404a4['user']['id'],_0x1404a4['user'][_0x05fc('0x38')],_0x1404a4[_0x05fc('0x64')]['role'],_0x52d2c7[_0x05fc('0x6b')]['id'],_0x1404a4[_0x05fc('0x5a')]?JSON[_0x05fc('0x25')](_0x1404a4[_0x05fc('0x5a')]):_0x05fc('0x80'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x52d2c7);}return null;})[_0x05fc('0x20')](function(_0x2edf3d){var _0x474e3f=_0x05fc('0x6e')+_0x2edf3d[_0x05fc('0x28')][_0x05fc('0x6f')];return db[_0x05fc('0x70')][_0x05fc('0x3f')](_0x474e3f,{'type':db[_0x05fc('0x71')][_0x05fc('0x72')][_0x05fc('0x73')],'raw':!![]})['then'](function(_0x54747e){return _0x54747e;});})[_0x05fc('0x20')](function(_0xd9c2fa){if(_0xd9c2fa){_0x52d2c7[_0x05fc('0x28')][_0x05fc('0x81')]=_0xd9c2fa[0x0];if(!_0x1404a4[_0x05fc('0x5a')]['UserId'])return;return db[_0x05fc('0x74')][_0x05fc('0x57')]({'where':{'id':_0x1404a4[_0x05fc('0x5a')]['UserId'],'role':_0x05fc('0x65')},'attributes':['id','name','fullname','email',_0x05fc('0x76')],'raw':!![]});}return null;})[_0x05fc('0x20')](function(_0x580d11){if(!_0x580d11)return null;_0x52d2c7[_0x05fc('0x28')][_0x05fc('0x65')]=_0x580d11;return _0x52d2c7;})[_0x05fc('0x20')](function(_0x427d74){if(_0x427d74){_0x427d74[_0x05fc('0x28')][_0x05fc('0x78')]=util[_0x05fc('0x61')]('SIP/%s',_0x1404a4['user'][_0x05fc('0x38')]);_0x427d74[_0x05fc('0x28')]['channel']=_0x52d2c7[_0x05fc('0x7a')];_0x427d74[_0x05fc('0x28')][_0x05fc('0x7b')]=_0x52d2c7['channel'];_0x427d74[_0x05fc('0x28')][_0x05fc('0x82')]=_0x05fc('0x34');respondWithRpcPromise('EventManager',_0x05fc('0x7c'),{'event':_0x05fc('0x83'),'message':_[_0x05fc('0x4e')](_0x52d2c7[_0x05fc('0x28')],JSON[_0x05fc('0x7e')](_0x52d2c7['interaction'][_0x05fc('0x84')]))},client9002);return _0x52d2c7;}return null;})[_0x05fc('0x20')](respondWithResult(_0x1cbf85,null))[_0x05fc('0x2a')](handleError(_0x1cbf85,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 00812e6..79e6835 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 _0x6e36=['exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x9360bd,_0x411852){var _0x4f7ccc=function(_0x5b6a02){while(--_0x5b6a02){_0x9360bd['push'](_0x9360bd['shift']());}};_0x4f7ccc(++_0x411852);}(_0x6e36,0x14b));var _0x66e3=function(_0x332a9b,_0x40f785){_0x332a9b=_0x332a9b-0x0;var _0x27c00a=_0x6e36[_0x332a9b];return _0x27c00a;};'use strict';var EventEmitter=require(_0x66e3('0x0'));var ChatMessage=require(_0x66e3('0x1'))['db'][_0x66e3('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x66e3('0x3')](0x0);var events={'afterCreate':_0x66e3('0x4'),'afterUpdate':_0x66e3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x183f3c){return function(_0x2655e6,_0x4c55e6,_0x3b276e){ChatMessageEvents[_0x66e3('0x6')](_0x183f3c+':'+_0x2655e6['id'],_0x2655e6);ChatMessageEvents['emit'](_0x183f3c,_0x2655e6);_0x3b276e(null);};}for(var e in events){if(events[_0x66e3('0x7')](e)){var event=events[e];ChatMessage[_0x66e3('0x8')](e,emitEvent(event));}}module[_0x66e3('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x390a=['../../mysqldb','ChatMessage','setMaxListeners','update','remove','emit','hook'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x390a,0xfc));var _0xa390=function(_0x4355e2,_0x1b7ad3){_0x4355e2=_0x4355e2-0x0;var _0x1993c9=_0x390a[_0x4355e2];return _0x1993c9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xa390('0x0'))['db'][_0xa390('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa390('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa390('0x3'),'afterDestroy':_0xa390('0x4')};function emitEvent(_0x29ead0){return function(_0x4dbbe9,_0x39406e,_0x190163){ChatMessageEvents[_0xa390('0x5')](_0x29ead0+':'+_0x4dbbe9['id'],_0x4dbbe9);ChatMessageEvents[_0xa390('0x5')](_0x29ead0,_0x4dbbe9);_0x190163(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xa390('0x6')](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 e4a66a6..75362af 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 _0x2dd9=['chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x2dd9,0xde));var _0x92dd=function(_0x13ae88,_0x1a5068){_0x13ae88=_0x13ae88-0x0;var _0x40eaf2=_0x2dd9[_0x13ae88];return _0x40eaf2;};'use strict';var _=require(_0x92dd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x92dd('0x1'));var moment=require(_0x92dd('0x2'));var BPromise=require('bluebird');var rp=require(_0x92dd('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92dd('0x4'));var config=require(_0x92dd('0x5'));var attributes=require(_0x92dd('0x6'));module[_0x92dd('0x7')]=function(_0x411044,_0x35373d){return _0x411044[_0x92dd('0x8')](_0x92dd('0x9'),attributes,{'tableName':_0x92dd('0xa'),'paranoid':![],'indexes':[{'name':_0x92dd('0xb'),'fields':[_0x92dd('0xc')],'type':_0x92dd('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b5b82,_0x4856f5,_0x18a7b3){var _0x4167e8=_0x411044[_0x92dd('0xe')];var _0x1f0101=_0x3b5b82['get']({'plain':!![]});if(_0x1f0101[_0x92dd('0xf')][_0x92dd('0x10')]()==='in'||_0x1f0101['direction'][_0x92dd('0x10')]()===_0x92dd('0x11')&&!_0x1f0101['secret']&&!_[_0x92dd('0x12')](_0x1f0101[_0x92dd('0x13')])){_0x4167e8[_0x92dd('0x14')][_0x92dd('0x15')]({'where':{'id':_0x1f0101[_0x92dd('0x16')]}})[_0x92dd('0x17')](function(_0x10c4ee){if(_0x10c4ee){_0x10c4ee[_0x92dd('0x18')]({'lastMsgAt':_0x1f0101[_0x92dd('0x19')],'lastMsgDirection':_0x1f0101['direction'][_0x92dd('0x10')]()});}})['catch'](function(_0x132b2d){console[_0x92dd('0x1a')](_0x132b2d);});}_0x18a7b3();}},'charset':_0x92dd('0x1b'),'collate':_0x92dd('0x1c')});}; \ No newline at end of file +var _0xc96c=['./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','body','models','direction','toLowerCase','out','secret','UserId','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x78fc7d,_0x4caf91){var _0x134aac=function(_0x475ed0){while(--_0x475ed0){_0x78fc7d['push'](_0x78fc7d['shift']());}};_0x134aac(++_0x4caf91);}(_0xc96c,0x14a));var _0xcc96=function(_0x5104ec,_0x11722d){_0x5104ec=_0x5104ec-0x0;var _0x22b805=_0xc96c[_0x5104ec];return _0x22b805;};'use strict';var _=require('lodash');var util=require(_0xcc96('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcc96('0x1'));var BPromise=require(_0xcc96('0x2'));var rp=require(_0xcc96('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc96('0x4'));var config=require(_0xcc96('0x5'));var attributes=require(_0xcc96('0x6'));module[_0xcc96('0x7')]=function(_0x32cba9,_0x5e3ce3){return _0x32cba9['define'](_0xcc96('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xcc96('0x9'),'fields':[_0xcc96('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55726d,_0x2b55ad,_0x2de527){var _0x31ae3f=_0x32cba9[_0xcc96('0xb')];var _0x5351db=_0x55726d['get']({'plain':!![]});if(_0x5351db[_0xcc96('0xc')]['toLowerCase']()==='in'||_0x5351db[_0xcc96('0xc')][_0xcc96('0xd')]()===_0xcc96('0xe')&&!_0x5351db[_0xcc96('0xf')]&&!_['isNil'](_0x5351db[_0xcc96('0x10')])){_0x31ae3f['ChatInteraction'][_0xcc96('0x11')]({'where':{'id':_0x5351db[_0xcc96('0x12')]}})[_0xcc96('0x13')](function(_0x460cdc){if(_0x460cdc){_0x460cdc[_0xcc96('0x14')]({'lastMsgAt':_0x5351db[_0xcc96('0x15')],'lastMsgDirection':_0x5351db[_0xcc96('0xc')][_0xcc96('0xd')]()});}})[_0xcc96('0x16')](function(_0x321ddb){console['error'](_0x321ddb);});}_0x2de527();}},'charset':_0xcc96('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 4beee05..c2d1737 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 _0x095b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','create','options','raw','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3a398e,_0x5d87df){var _0x27a8fa=function(_0x4cdbce){while(--_0x4cdbce){_0x3a398e['push'](_0x3a398e['shift']());}};_0x27a8fa(++_0x5d87df);}(_0x095b,0x17c));var _0xb095=function(_0x305b6a,_0x4d9505){_0x305b6a=_0x305b6a-0x0;var _0x3ce6d7=_0x095b[_0x305b6a];return _0x3ce6d7;};'use strict';var _=require(_0xb095('0x0'));var util=require(_0xb095('0x1'));var moment=require(_0xb095('0x2'));var BPromise=require(_0xb095('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb095('0x4'))['db'];var utils=require(_0xb095('0x5'));var logger=require(_0xb095('0x6'))(_0xb095('0x7'));var config=require(_0xb095('0x8'));var jayson=require(_0xb095('0x9'));var client=jayson[_0xb095('0xa')][_0xb095('0xb')]({'port':0x232a});config['redis']=_[_0xb095('0xc')](config[_0xb095('0xd')],{'host':_0xb095('0xe'),'port':0x18eb});var socket=require(_0xb095('0xf'))(new Redis(config[_0xb095('0xd')]));require(_0xb095('0x10'))[_0xb095('0x11')](socket);function respondWithRpcPromise(_0x2b2603,_0x5030a7,_0x211c27){return new BPromise(function(_0x31c77d,_0x183db2){return client[_0xb095('0x12')](_0x2b2603,_0x211c27)['then'](function(_0x1bbfb5){logger[_0xb095('0x13')](_0xb095('0x14'),_0x5030a7,_0xb095('0x15'));logger[_0xb095('0x16')](_0xb095('0x17'),_0x5030a7,_0xb095('0x15'),JSON[_0xb095('0x18')](_0x1bbfb5));if(_0x1bbfb5['error']){if(_0x1bbfb5[_0xb095('0x19')][_0xb095('0x1a')]===0x1f4){logger[_0xb095('0x19')](_0xb095('0x14'),_0x5030a7,_0x1bbfb5[_0xb095('0x19')][_0xb095('0x1b')]);return _0x183db2(_0x1bbfb5[_0xb095('0x19')]['message']);}logger[_0xb095('0x19')](_0xb095('0x14'),_0x5030a7,_0x1bbfb5['error'][_0xb095('0x1b')]);return _0x31c77d(_0x1bbfb5['error'][_0xb095('0x1b')]);}else{logger[_0xb095('0x13')]('ChatMessage,\x20%s,\x20%s',_0x5030a7,_0xb095('0x15'));_0x31c77d(_0x1bbfb5[_0xb095('0x1c')][_0xb095('0x1b')]);}})[_0xb095('0x1d')](function(_0x455c3d){logger['error'](_0xb095('0x14'),_0x5030a7,_0x455c3d);_0x183db2(_0x455c3d);});});}exports[_0xb095('0x1e')]=function(_0x2b3d6d){var _0x266762=this;return new Promise(function(_0x35a054,_0x20628a){return db[_0xb095('0x1f')][_0xb095('0x20')](_0x2b3d6d['body'],{'raw':_0x2b3d6d[_0xb095('0x21')]?_0x2b3d6d[_0xb095('0x21')][_0xb095('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x4847cb){logger[_0xb095('0x13')]('CreateChatMessage',_0x2b3d6d);logger['debug'](_0xb095('0x1e'),_0x2b3d6d,JSON[_0xb095('0x18')](_0x4847cb));_0x35a054(_0x4847cb);})['catch'](function(_0x8332ad){logger[_0xb095('0x19')](_0xb095('0x1e'),_0x8332ad[_0xb095('0x1b')],_0x2b3d6d);_0x20628a(_0x266762['error'](0x1f4,_0x8332ad[_0xb095('0x1b')]));});});}; \ No newline at end of file +var _0xb44c=['raw','CreateChatMessage','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ChatMessage','options'];(function(_0xeb84b4,_0x38bfa4){var _0x3b49f9=function(_0x569de3){while(--_0x569de3){_0xeb84b4['push'](_0xeb84b4['shift']());}};_0x3b49f9(++_0x38bfa4);}(_0xb44c,0x1b5));var _0xcb44=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0xb44c[_0x2a0738];return _0x159679;};'use strict';var _=require('lodash');var util=require(_0xcb44('0x0'));var moment=require(_0xcb44('0x1'));var BPromise=require(_0xcb44('0x2'));var rs=require(_0xcb44('0x3'));var fs=require('fs');var Redis=require(_0xcb44('0x4'));var db=require(_0xcb44('0x5'))['db'];var utils=require(_0xcb44('0x6'));var logger=require(_0xcb44('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb44('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xcb44('0x9')]=_[_0xcb44('0xa')](config[_0xcb44('0x9')],{'host':_0xcb44('0xb'),'port':0x18eb});var socket=require(_0xcb44('0xc'))(new Redis(config[_0xcb44('0x9')]));require(_0xcb44('0xd'))[_0xcb44('0xe')](socket);function respondWithRpcPromise(_0x2a06fe,_0xda1591,_0x14ab55){return new BPromise(function(_0x101d04,_0x91af72){return client[_0xcb44('0xf')](_0x2a06fe,_0x14ab55)['then'](function(_0x58c8bd){logger[_0xcb44('0x10')](_0xcb44('0x11'),_0xda1591,_0xcb44('0x12'));logger[_0xcb44('0x13')](_0xcb44('0x14'),_0xda1591,'request\x20sent',JSON['stringify'](_0x58c8bd));if(_0x58c8bd[_0xcb44('0x15')]){if(_0x58c8bd[_0xcb44('0x15')][_0xcb44('0x16')]===0x1f4){logger[_0xcb44('0x15')](_0xcb44('0x11'),_0xda1591,_0x58c8bd['error'][_0xcb44('0x17')]);return _0x91af72(_0x58c8bd['error'][_0xcb44('0x17')]);}logger['error'](_0xcb44('0x11'),_0xda1591,_0x58c8bd[_0xcb44('0x15')]['message']);return _0x101d04(_0x58c8bd[_0xcb44('0x15')]['message']);}else{logger[_0xcb44('0x10')](_0xcb44('0x11'),_0xda1591,_0xcb44('0x12'));_0x101d04(_0x58c8bd[_0xcb44('0x18')][_0xcb44('0x17')]);}})[_0xcb44('0x19')](function(_0x53e642){logger[_0xcb44('0x15')](_0xcb44('0x11'),_0xda1591,_0x53e642);_0x91af72(_0x53e642);});});}exports['CreateChatMessage']=function(_0x5e6c73){var _0x530651=this;return new Promise(function(_0x1e53a5,_0x5eae1f){return db[_0xcb44('0x1a')]['create'](_0x5e6c73['body'],{'raw':_0x5e6c73[_0xcb44('0x1b')]?_0x5e6c73['options'][_0xcb44('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1acaf3){logger['info'](_0xcb44('0x1d'),_0x5e6c73);logger[_0xcb44('0x13')](_0xcb44('0x1d'),_0x5e6c73,JSON[_0xcb44('0x1e')](_0x1acaf3));_0x1e53a5(_0x1acaf3);})[_0xcb44('0x19')](function(_0x92e023){logger[_0xcb44('0x15')](_0xcb44('0x1d'),_0x92e023[_0xcb44('0x17')],_0x5e6c73);_0x5eae1f(_0x530651[_0xcb44('0x15')](0x1f4,_0x92e023[_0xcb44('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ffa11f1..638b53b 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 _0x1db9=['remove','update','emit','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x2bac80,_0x501e1e){var _0x4fad20=function(_0x4bf44f){while(--_0x4bf44f){_0x2bac80['push'](_0x2bac80['shift']());}};_0x4fad20(++_0x501e1e);}(_0x1db9,0x176));var _0x91db=function(_0x12a55c,_0x4513c9){_0x12a55c=_0x12a55c-0x0;var _0x4c95b0=_0x1db9[_0x12a55c];return _0x4c95b0;};'use strict';var ChatMessageEvents=require(_0x91db('0x0'));var events=[_0x91db('0x1'),_0x91db('0x2'),_0x91db('0x3')];function createListener(_0xcdfaed,_0xb6de0b){return function(_0x49b8c5){_0xb6de0b[_0x91db('0x4')](_0xcdfaed,_0x49b8c5);};}function removeListener(_0x42ae75,_0x59c944){return function(){ChatMessageEvents['removeListener'](_0x42ae75,_0x59c944);};}exports[_0x91db('0x5')]=function(_0x4b3f5c){for(var _0x5e69d9=0x0,_0x433c75=events[_0x91db('0x6')];_0x5e69d9<_0x433c75;_0x5e69d9++){var _0x45fea0=events[_0x5e69d9];var _0x2330c2=createListener(_0x91db('0x7')+_0x45fea0,_0x4b3f5c);ChatMessageEvents['on'](_0x45fea0,_0x2330c2);}}; \ No newline at end of file +var _0x2975=['update','removeListener','register','length','chatMessage:','save','remove'];(function(_0x1e32f2,_0x3605c2){var _0x1dda0b=function(_0x72fab3){while(--_0x72fab3){_0x1e32f2['push'](_0x1e32f2['shift']());}};_0x1dda0b(++_0x3605c2);}(_0x2975,0x1c5));var _0x5297=function(_0x416906,_0x2fbb3e){_0x416906=_0x416906-0x0;var _0x52bafd=_0x2975[_0x416906];return _0x52bafd;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5297('0x0'),_0x5297('0x1'),_0x5297('0x2')];function createListener(_0x1a511b,_0x115e60){return function(_0x178801){_0x115e60['emit'](_0x1a511b,_0x178801);};}function removeListener(_0x56371f,_0x5e9de3){return function(){ChatMessageEvents[_0x5297('0x3')](_0x56371f,_0x5e9de3);};}exports[_0x5297('0x4')]=function(_0x11a43d){for(var _0x3da9c6=0x0,_0x4d1d2c=events[_0x5297('0x5')];_0x3da9c6<_0x4d1d2c;_0x3da9c6++){var _0x1b72a7=events[_0x3da9c6];var _0x4f12b0=createListener(_0x5297('0x6')+_0x1b72a7,_0x11a43d);ChatMessageEvents['on'](_0x1b72a7,_0x4f12b0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3d15172..59c06ac 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 _0x3eae=['index','/describe','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated'];(function(_0x5579b8,_0x1827bb){var _0x3f41bf=function(_0x46974b){while(--_0x46974b){_0x5579b8['push'](_0x5579b8['shift']());}};_0x3f41bf(++_0x1827bb);}(_0x3eae,0x1d1));var _0xe3ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3eae[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0xe3ea('0x0'));var util=require('util');var path=require(_0xe3ea('0x1'));var timeout=require(_0xe3ea('0x2'));var express=require('express');var router=express[_0xe3ea('0x3')]();var fs_extra=require(_0xe3ea('0x4'));var auth=require(_0xe3ea('0x5'));var interaction=require(_0xe3ea('0x6'));var config=require(_0xe3ea('0x7'));var controller=require(_0xe3ea('0x8'));router[_0xe3ea('0x9')]('/',auth[_0xe3ea('0xa')](),controller[_0xe3ea('0xb')]);router[_0xe3ea('0x9')](_0xe3ea('0xc'),auth[_0xe3ea('0xa')](),controller[_0xe3ea('0xd')]);router[_0xe3ea('0x9')](_0xe3ea('0xe'),auth['isAuthenticated'](),controller[_0xe3ea('0xf')]);router[_0xe3ea('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xe3ea('0x11'),_0xe3ea('0x12')),controller[_0xe3ea('0x13')]);router[_0xe3ea('0x14')](_0xe3ea('0xe'),controller[_0xe3ea('0x15')]);router[_0xe3ea('0x14')](_0xe3ea('0x16'),auth[_0xe3ea('0xa')](),controller[_0xe3ea('0x17')]);router[_0xe3ea('0x14')](_0xe3ea('0x18'),auth[_0xe3ea('0xa')](),controller['reject']);router[_0xe3ea('0x19')](_0xe3ea('0xe'),auth[_0xe3ea('0xa')](),controller[_0xe3ea('0x1a')]);module[_0xe3ea('0x1b')]=router; \ No newline at end of file +var _0xd782=['update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','post','chat','chatmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd782,0x191));var _0x2d78=function(_0x3746bd,_0x4b07a7){_0x3746bd=_0x3746bd-0x0;var _0x569b5f=_0xd782[_0x3746bd];return _0x569b5f;};'use strict';var multer=require(_0x2d78('0x0'));var util=require(_0x2d78('0x1'));var path=require(_0x2d78('0x2'));var timeout=require(_0x2d78('0x3'));var express=require(_0x2d78('0x4'));var router=express[_0x2d78('0x5')]();var fs_extra=require(_0x2d78('0x6'));var auth=require(_0x2d78('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2d78('0x8'));var controller=require('./chatMessage.controller');router[_0x2d78('0x9')]('/',auth['isAuthenticated'](),controller[_0x2d78('0xa')]);router['get'](_0x2d78('0xb'),auth[_0x2d78('0xc')](),controller[_0x2d78('0xd')]);router[_0x2d78('0x9')](_0x2d78('0xe'),auth[_0x2d78('0xc')](),controller['show']);router[_0x2d78('0xf')]('/',auth[_0x2d78('0xc')](),interaction['tracked'](_0x2d78('0x10'),_0x2d78('0x11')),controller[_0x2d78('0x12')]);router['put'](_0x2d78('0xe'),controller[_0x2d78('0x13')]);router['put'](_0x2d78('0x14'),auth[_0x2d78('0xc')](),controller[_0x2d78('0x15')]);router[_0x2d78('0x16')](_0x2d78('0x17'),auth[_0x2d78('0xc')](),controller[_0x2d78('0x18')]);router[_0x2d78('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x2d78('0x1a')]);module[_0x2d78('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 2f8473f..4b6633f 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 _0xadb5=['medium','TEXT','exports'];(function(_0x3edb55,_0x5e9c44){var _0x34c431=function(_0x434b73){while(--_0x434b73){_0x3edb55['push'](_0x3edb55['shift']());}};_0x34c431(++_0x5e9c44);}(_0xadb5,0xad));var _0x5adb=function(_0x1f33b3,_0x218120){_0x1f33b3=_0x1f33b3-0x0;var _0x28a832=_0xadb5[_0x1f33b3];return _0x28a832;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x330bf8,_0x3f1ce1){var _0x10d2fe=function(_0x3ab8a9){while(--_0x3ab8a9){_0x330bf8['push'](_0x330bf8['shift']());}};_0x10d2fe(++_0x3f1ce1);}(_0xb10b,0x12a));var _0xbb10=function(_0x2b8f84,_0x349ee2){_0x2b8f84=_0x2b8f84-0x0;var _0x2927ca=_0xb10b[_0x2b8f84];return _0x2927ca;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index d177b08..690787e 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(_0x1cc5e1,_0x4c7c8b){var _0x26d2f8=function(_0x72d598){while(--_0x72d598){_0x1cc5e1['push'](_0x1cc5e1['shift']());}};_0x26d2f8(++_0x4c7c8b);}(_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 +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(_0x3d10c6,_0x44e047){var _0x367532=function(_0x18ec57){while(--_0x18ec57){_0x3d10c6['push'](_0x3d10c6['shift']());}};_0x367532(++_0x44e047);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 8eacf7e..0f7d85d 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 _0x2815=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x3c5dbe,_0x4af1e7){var _0xb26151=function(_0x3a8279){while(--_0x3a8279){_0x3c5dbe['push'](_0x3c5dbe['shift']());}};_0xb26151(++_0x4af1e7);}(_0x2815,0xce));var _0x5281=function(_0x5886db,_0x4d30d4){_0x5886db=_0x5886db-0x0;var _0x537a05=_0x2815[_0x5886db];return _0x537a05;};'use strict';var EventEmitter=require(_0x5281('0x0'));var ChatOfflineMessage=require(_0x5281('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x5281('0x2')](0x0);var events={'afterCreate':_0x5281('0x3'),'afterUpdate':_0x5281('0x4'),'afterDestroy':_0x5281('0x5')};function emitEvent(_0x222edf){return function(_0x294c48,_0x16eed6,_0x2798f8){ChatOfflineMessageEvents[_0x5281('0x6')](_0x222edf+':'+_0x294c48['id'],_0x294c48);ChatOfflineMessageEvents['emit'](_0x222edf,_0x294c48);_0x2798f8(null);};}for(var e in events){if(events[_0x5281('0x7')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x5281('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x47a8=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2a4d83,_0x2f548c){var _0x1f223d=function(_0x513327){while(--_0x513327){_0x2a4d83['push'](_0x2a4d83['shift']());}};_0x1f223d(++_0x2f548c);}(_0x47a8,0x154));var _0x847a=function(_0x2d6891,_0x1a3fd0){_0x2d6891=_0x2d6891-0x0;var _0x49cdfc=_0x47a8[_0x2d6891];return _0x49cdfc;};'use strict';var EventEmitter=require(_0x847a('0x0'));var ChatOfflineMessage=require(_0x847a('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x847a('0x2')](0x0);var events={'afterCreate':_0x847a('0x3'),'afterUpdate':_0x847a('0x4'),'afterDestroy':_0x847a('0x5')};function emitEvent(_0x1db589){return function(_0x1640ce,_0x1ad94f,_0xbd90b7){ChatOfflineMessageEvents['emit'](_0x1db589+':'+_0x1640ce['id'],_0x1640ce);ChatOfflineMessageEvents[_0x847a('0x6')](_0x1db589,_0x1640ce);_0xbd90b7(null);};}for(var e in events){if(events[_0x847a('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x847a('0x8')](e,emitEvent(event));}}module[_0x847a('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2260b69..4edd6d9 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 _0x5549=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x2c6716,_0x51fd27){var _0x5df511=function(_0x348961){while(--_0x348961){_0x2c6716['push'](_0x2c6716['shift']());}};_0x5df511(++_0x51fd27);}(_0x5549,0xeb));var _0x9554=function(_0x1f408e,_0x590fef){_0x1f408e=_0x1f408e-0x0;var _0x79425f=_0x5549[_0x1f408e];return _0x79425f;};'use strict';var attributes=require(_0x9554('0x0'));module['exports']=function(_0x185633){return _0x185633[_0x9554('0x1')](_0x9554('0x2'),attributes,{'tableName':_0x9554('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9554('0x4'),'collate':_0x9554('0x5')});}; \ No newline at end of file +var _0x4f68=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages'];(function(_0xd54e45,_0x57bddb){var _0xe0a1e7=function(_0x2370c9){while(--_0x2370c9){_0xd54e45['push'](_0xd54e45['shift']());}};_0xe0a1e7(++_0x57bddb);}(_0x4f68,0x71));var _0x84f6=function(_0x127081,_0x4d249e){_0x127081=_0x127081-0x0;var _0x5c54cf=_0x4f68[_0x127081];return _0x5c54cf;};'use strict';var attributes=require(_0x84f6('0x0'));module['exports']=function(_0x7ee596){return _0x7ee596['define'](_0x84f6('0x1'),attributes,{'tableName':_0x84f6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x84f6('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 7b40c33..9a2a570 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 _0x4939=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1461de,_0x4d096a){var _0xb32008=function(_0x1ace1){while(--_0x1ace1){_0x1461de['push'](_0x1461de['shift']());}};_0xb32008(++_0x4d096a);}(_0x4939,0x1a9));var _0x9493=function(_0xc05035,_0x37a7bc){_0xc05035=_0xc05035-0x0;var _0x37bfeb=_0x4939[_0xc05035];return _0x37bfeb;};'use strict';var _=require(_0x9493('0x0'));var util=require(_0x9493('0x1'));var moment=require('moment');var BPromise=require(_0x9493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9493('0x3'));var db=require(_0x9493('0x4'))['db'];var utils=require(_0x9493('0x5'));var logger=require(_0x9493('0x6'))(_0x9493('0x7'));var config=require(_0x9493('0x8'));var jayson=require(_0x9493('0x9'));var client=jayson[_0x9493('0xa')][_0x9493('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c07f,_0x1ac6ac,_0x4518b0){return new BPromise(function(_0x33fa4a,_0x5ada3a){return client[_0x9493('0xc')](_0x36c07f,_0x4518b0)[_0x9493('0xd')](function(_0x53e3ab){logger[_0x9493('0xe')](_0x9493('0xf'),_0x1ac6ac,_0x9493('0x10'));logger['debug'](_0x9493('0x11'),_0x1ac6ac,'request\x20sent',JSON[_0x9493('0x12')](_0x53e3ab));if(_0x53e3ab[_0x9493('0x13')]){if(_0x53e3ab[_0x9493('0x13')][_0x9493('0x14')]===0x1f4){logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x53e3ab[_0x9493('0x13')][_0x9493('0x15')]);return _0x5ada3a(_0x53e3ab['error']['message']);}logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x53e3ab['error'][_0x9493('0x15')]);return _0x33fa4a(_0x53e3ab['error']['message']);}else{logger[_0x9493('0xe')](_0x9493('0xf'),_0x1ac6ac,_0x9493('0x10'));_0x33fa4a(_0x53e3ab[_0x9493('0x16')][_0x9493('0x15')]);}})[_0x9493('0x17')](function(_0x5de73d){logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x5de73d);_0x5ada3a(_0x5de73d);});});} \ No newline at end of file +var _0xd0b1=['request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x3bec86,_0x4484ee){var _0x1fb134=function(_0x9bebba){while(--_0x9bebba){_0x3bec86['push'](_0x3bec86['shift']());}};_0x1fb134(++_0x4484ee);}(_0xd0b1,0x16e));var _0x1d0b=function(_0x1d0cac,_0x36433b){_0x1d0cac=_0x1d0cac-0x0;var _0x54a683=_0xd0b1[_0x1d0cac];return _0x54a683;};'use strict';var _=require(_0x1d0b('0x0'));var util=require(_0x1d0b('0x1'));var moment=require('moment');var BPromise=require(_0x1d0b('0x2'));var rs=require(_0x1d0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d0b('0x4'))['db'];var utils=require(_0x1d0b('0x5'));var logger=require(_0x1d0b('0x6'))(_0x1d0b('0x7'));var config=require(_0x1d0b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1d0b('0x9')][_0x1d0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15786b,_0xf6f132,_0x2954b7){return new BPromise(function(_0x357df1,_0x20c9b8){return client['request'](_0x15786b,_0x2954b7)[_0x1d0b('0xb')](function(_0x1d5ceb){logger[_0x1d0b('0xc')](_0x1d0b('0xd'),_0xf6f132,_0x1d0b('0xe'));logger['debug'](_0x1d0b('0xf'),_0xf6f132,_0x1d0b('0xe'),JSON['stringify'](_0x1d5ceb));if(_0x1d5ceb['error']){if(_0x1d5ceb[_0x1d0b('0x10')]['code']===0x1f4){logger[_0x1d0b('0x10')](_0x1d0b('0xd'),_0xf6f132,_0x1d5ceb[_0x1d0b('0x10')][_0x1d0b('0x11')]);return _0x20c9b8(_0x1d5ceb[_0x1d0b('0x10')]['message']);}logger[_0x1d0b('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0xf6f132,_0x1d5ceb[_0x1d0b('0x10')][_0x1d0b('0x11')]);return _0x357df1(_0x1d5ceb[_0x1d0b('0x10')][_0x1d0b('0x11')]);}else{logger[_0x1d0b('0xc')](_0x1d0b('0xd'),_0xf6f132,_0x1d0b('0xe'));_0x357df1(_0x1d5ceb['result'][_0x1d0b('0x11')]);}})[_0x1d0b('0x12')](function(_0x4bd388){logger[_0x1d0b('0x10')](_0x1d0b('0xd'),_0xf6f132,_0x4bd388);_0x20c9b8(_0x4bd388);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 81925d6..c749397 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 _0xf4a3=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x598980,_0x32bc03){var _0x5e62d0=function(_0x2ec6e6){while(--_0x2ec6e6){_0x598980['push'](_0x598980['shift']());}};_0x5e62d0(++_0x32bc03);}(_0xf4a3,0x10d));var _0x3f4a=function(_0x12a094,_0x4dc6e0){_0x12a094=_0x12a094-0x0;var _0x5bb7c9=_0xf4a3[_0x12a094];return _0x5bb7c9;};'use strict';var multer=require(_0x3f4a('0x0'));var util=require(_0x3f4a('0x1'));var path=require(_0x3f4a('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f4a('0x3'));var router=express[_0x3f4a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f4a('0x5'));var interaction=require(_0x3f4a('0x6'));var config=require(_0x3f4a('0x7'));var controller=require(_0x3f4a('0x8'));router[_0x3f4a('0x9')]('/',auth[_0x3f4a('0xa')](),controller[_0x3f4a('0xb')]);router[_0x3f4a('0x9')]('/describe',auth[_0x3f4a('0xa')](),controller[_0x3f4a('0xc')]);router[_0x3f4a('0x9')](_0x3f4a('0xd'),auth[_0x3f4a('0xa')](),controller['show']);router[_0x3f4a('0xe')]('/',auth[_0x3f4a('0xa')](),controller[_0x3f4a('0xf')]);router[_0x3f4a('0x10')]('/:id',auth[_0x3f4a('0xa')](),controller[_0x3f4a('0x11')]);router[_0x3f4a('0x12')](_0x3f4a('0xd'),auth[_0x3f4a('0xa')](),controller[_0x3f4a('0x13')]);module[_0x3f4a('0x14')]=router; \ No newline at end of file +var _0x481f=['express','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x2bc5a0,_0x594ddb){var _0x4f25a3=function(_0xdd2802){while(--_0xdd2802){_0x2bc5a0['push'](_0x2bc5a0['shift']());}};_0x4f25a3(++_0x594ddb);}(_0x481f,0x18c));var _0xf481=function(_0x45d51e,_0x22b8dd){_0x45d51e=_0x45d51e-0x0;var _0x50436e=_0x481f[_0x45d51e];return _0x50436e;};'use strict';var multer=require('multer');var util=require(_0xf481('0x0'));var path=require(_0xf481('0x1'));var timeout=require(_0xf481('0x2'));var express=require(_0xf481('0x3'));var router=express[_0xf481('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf481('0x5'));var interaction=require(_0xf481('0x6'));var config=require('../../config/environment');var controller=require(_0xf481('0x7'));router['get']('/',auth[_0xf481('0x8')](),controller[_0xf481('0x9')]);router[_0xf481('0xa')](_0xf481('0xb'),auth[_0xf481('0x8')](),controller[_0xf481('0xc')]);router[_0xf481('0xa')](_0xf481('0xd'),auth[_0xf481('0x8')](),controller['show']);router[_0xf481('0xe')]('/',auth[_0xf481('0x8')](),controller[_0xf481('0xf')]);router[_0xf481('0x10')](_0xf481('0xd'),auth['isAuthenticated'](),controller[_0xf481('0x11')]);router[_0xf481('0x12')]('/:id',auth[_0xf481('0x8')](),controller[_0xf481('0x13')]);module[_0xf481('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 210da4c..b395618 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 _0xe1ca=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xe1ca,0x122));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xae1c('0x0'));module[_0xae1c('0x1')]={'name':{'type':Sequelize[_0xae1c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xae1c('0x3')](_0xae1c('0x4'),'timeout'),'defaultValue':_0xae1c('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xae1c('0x5')]}}; \ No newline at end of file +var _0x198b=['STRING','INTEGER','sequelize','timeout','mouseOver'];(function(_0x220134,_0x355b4a){var _0x435d02=function(_0x55f633){while(--_0x55f633){_0x220134['push'](_0x220134['shift']());}};_0x435d02(++_0x355b4a);}(_0x198b,0x165));var _0xb198=function(_0x443175,_0x2d016d){_0x443175=_0x443175-0x0;var _0x6871a3=_0x198b[_0x443175];return _0x6871a3;};'use strict';var Sequelize=require(_0xb198('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xb198('0x1')),'defaultValue':_0xb198('0x2')},'selector':{'type':Sequelize[_0xb198('0x3')]},'timeout':{'type':Sequelize[_0xb198('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d1b2232..a39709e 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 _0xdd0c=['moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','show','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','model','fields','attributes','length','include','merge','find','then','create','body','catch','rimraf','zip-dir','fast-json-patch'];(function(_0x2b3e5d,_0x3c74b7){var _0x4aab0e=function(_0x597206){while(--_0x597206){_0x2b3e5d['push'](_0x2b3e5d['shift']());}};_0x4aab0e(++_0x3c74b7);}(_0xdd0c,0x165));var _0xcdd0=function(_0x1ca307,_0x29a7f8){_0x1ca307=_0x1ca307-0x0;var _0x30a3d8=_0xdd0c[_0x1ca307];return _0x30a3d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdd0('0x0'));var zipdir=require(_0xcdd0('0x1'));var jsonpatch=require(_0xcdd0('0x2'));var rp=require('request-promise');var moment=require(_0xcdd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdd0('0x4'));var util=require(_0xcdd0('0x5'));var path=require(_0xcdd0('0x6'));var sox=require(_0xcdd0('0x7'));var csv=require(_0xcdd0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcdd0('0x9'));var _=require(_0xcdd0('0xa'));var squel=require(_0xcdd0('0xb'));var crypto=require(_0xcdd0('0xc'));var jsforce=require(_0xcdd0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcdd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdd0('0xe'));var authService=require(_0xcdd0('0xf'));var qs=require(_0xcdd0('0x10'));var as=require(_0xcdd0('0x11'));var hardwareService=require(_0xcdd0('0x12'));var logger=require(_0xcdd0('0x13'))(_0xcdd0('0x14'));var utils=require(_0xcdd0('0x15'));var config=require(_0xcdd0('0x16'));var licenseUtil=require(_0xcdd0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a1ff6,_0x356501){_0x356501=_0x356501||0xcc;return function(_0x14c775){if(_0x14c775){return _0x4a1ff6['sendStatus'](_0x356501);}return _0x4a1ff6[_0xcdd0('0x18')](_0x356501)[_0xcdd0('0x19')]();};}function respondWithResult(_0x4f4aa4,_0x1fc89a){_0x1fc89a=_0x1fc89a||0xc8;return function(_0x1d5bff){if(_0x1d5bff){return _0x4f4aa4[_0xcdd0('0x18')](_0x1fc89a)[_0xcdd0('0x1a')](_0x1d5bff);}};}function respondWithFilteredResult(_0xc1c3d5,_0x52aef5){return function(_0x5b5c06){if(_0x5b5c06){var _0x189f54=typeof _0x52aef5[_0xcdd0('0x1b')]===_0xcdd0('0x1c')&&typeof _0x52aef5[_0xcdd0('0x1d')]===_0xcdd0('0x1c');var _0x3b07a1=_0x5b5c06[_0xcdd0('0x1e')];var _0x2c199f=_0x189f54?0x0:_0x52aef5[_0xcdd0('0x1b')];var _0x14d55b=_0x189f54?_0x5b5c06['count']:_0x52aef5[_0xcdd0('0x1b')]+_0x52aef5[_0xcdd0('0x1d')];var _0x5060fa;if(_0x14d55b>=_0x3b07a1){_0x14d55b=_0x3b07a1;_0x5060fa=0xc8;}else{_0x5060fa=0xce;}_0xc1c3d5['status'](_0x5060fa);return _0xc1c3d5[_0xcdd0('0x1f')](_0xcdd0('0x20'),_0x2c199f+'-'+_0x14d55b+'/'+_0x3b07a1)['json'](_0x5b5c06);}return null;};}function patchUpdates(_0x12128e){return function(_0x4f7325){try{jsonpatch['apply'](_0x4f7325,_0x12128e,!![]);}catch(_0x4d038f){return BPromise[_0xcdd0('0x21')](_0x4d038f);}return _0x4f7325[_0xcdd0('0x22')]();};}function saveUpdates(_0x4afcfa,_0x2ab7e4){return function(_0x31a3e6){if(_0x31a3e6){return _0x31a3e6[_0xcdd0('0x23')](_0x4afcfa)['then'](function(_0x9d4727){return _0x9d4727;});}return null;};}function removeEntity(_0x7be0ac,_0x509e9c){return function(_0x3c81b1){if(_0x3c81b1){return _0x3c81b1[_0xcdd0('0x24')]()['then'](function(){_0x7be0ac[_0xcdd0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3797c2,_0x64b52){return function(_0x476018){if(!_0x476018){_0x3797c2['sendStatus'](0x194);}return _0x476018;};}function handleError(_0x22fd47,_0x10cba2){_0x10cba2=_0x10cba2||0x1f4;return function(_0x5e5cc){logger[_0xcdd0('0x25')](_0x5e5cc[_0xcdd0('0x26')]);if(_0x5e5cc[_0xcdd0('0x27')]){delete _0x5e5cc[_0xcdd0('0x27')];}_0x22fd47[_0xcdd0('0x18')](_0x10cba2)[_0xcdd0('0x28')](_0x5e5cc);};}exports[_0xcdd0('0x29')]=function(_0x4074e0,_0x49cfe0){var _0x28084c={'raw':!![],'where':{'id':_0x4074e0[_0xcdd0('0x2a')]['id']}},_0xd6d64f={};_0xd6d64f['model']=_[_0xcdd0('0x2b')](db[_0xcdd0('0x2c')][_0xcdd0('0x2d')]);_0xd6d64f[_0xcdd0('0x2e')]=_[_0xcdd0('0x2b')](_0x4074e0['query']);_0xd6d64f[_0xcdd0('0x2f')]=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],_0xd6d64f['query']);_0x28084c['attributes']=_[_0xcdd0('0x30')](_0xd6d64f[_0xcdd0('0x31')],qs[_0xcdd0('0x32')](_0x4074e0['query'][_0xcdd0('0x32')]));_0x28084c[_0xcdd0('0x33')]=_0x28084c['attributes'][_0xcdd0('0x34')]?_0x28084c[_0xcdd0('0x33')]:_0xd6d64f[_0xcdd0('0x31')];if(_0x4074e0[_0xcdd0('0x2e')]['includeAll']){_0x28084c[_0xcdd0('0x35')]=[{'all':!![]}];}_0x28084c=_[_0xcdd0('0x36')]({},_0x28084c,_0x4074e0['options']);return db[_0xcdd0('0x2c')][_0xcdd0('0x37')](_0x28084c)[_0xcdd0('0x38')](handleEntityNotFound(_0x49cfe0,null))[_0xcdd0('0x38')](respondWithResult(_0x49cfe0,null))['catch'](handleError(_0x49cfe0,null));};exports[_0xcdd0('0x39')]=function(_0x358139,_0x95d87f){return db[_0xcdd0('0x2c')][_0xcdd0('0x39')](_0x358139['body'],{})[_0xcdd0('0x38')](respondWithResult(_0x95d87f,0xc9))['catch'](handleError(_0x95d87f,null));};exports['update']=function(_0x4fd705,_0x407725){if(_0x4fd705[_0xcdd0('0x3a')]['id']){delete _0x4fd705[_0xcdd0('0x3a')]['id'];}return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4fd705[_0xcdd0('0x2a')]['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x407725,null))['then'](saveUpdates(_0x4fd705[_0xcdd0('0x3a')],null))[_0xcdd0('0x38')](respondWithResult(_0x407725,null))[_0xcdd0('0x3b')](handleError(_0x407725,null));};exports[_0xcdd0('0x24')]=function(_0x4e6d31,_0x4934a5){return db[_0xcdd0('0x2c')][_0xcdd0('0x37')]({'where':{'id':_0x4e6d31['params']['id']}})[_0xcdd0('0x38')](handleEntityNotFound(_0x4934a5,null))[_0xcdd0('0x38')](removeEntity(_0x4934a5,null))['catch'](handleError(_0x4934a5,null));}; \ No newline at end of file +var _0x8819=['count','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','params','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','includeAll','include','options','find','catch','create','body','update','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined'];(function(_0xb9a306,_0x48ebcd){var _0x55c163=function(_0x26a8ee){while(--_0x26a8ee){_0xb9a306['push'](_0xb9a306['shift']());}};_0x55c163(++_0x48ebcd);}(_0x8819,0x94));var _0x9881=function(_0x5c9402,_0x2425a9){_0x5c9402=_0x5c9402-0x0;var _0x375199=_0x8819[_0x5c9402];return _0x375199;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9881('0x0'));var jsonpatch=require(_0x9881('0x1'));var rp=require(_0x9881('0x2'));var moment=require(_0x9881('0x3'));var BPromise=require(_0x9881('0x4'));var Mustache=require('mustache');var util=require(_0x9881('0x5'));var path=require(_0x9881('0x6'));var sox=require(_0x9881('0x7'));var csv=require(_0x9881('0x8'));var ejs=require(_0x9881('0x9'));var fs=require('fs');var fs_extra=require(_0x9881('0xa'));var _=require('lodash');var squel=require(_0x9881('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9881('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9881('0xd'));var Redis=require('ioredis');var authService=require(_0x9881('0xe'));var qs=require(_0x9881('0xf'));var as=require(_0x9881('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9881('0x11'))(_0x9881('0x12'));var utils=require(_0x9881('0x13'));var config=require(_0x9881('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9881('0x15'))['db'];function respondWithStatusCode(_0x26ee3f,_0x5c6d2d){_0x5c6d2d=_0x5c6d2d||0xcc;return function(_0x42850e){if(_0x42850e){return _0x26ee3f['sendStatus'](_0x5c6d2d);}return _0x26ee3f['status'](_0x5c6d2d)['end']();};}function respondWithResult(_0x58f526,_0x12794f){_0x12794f=_0x12794f||0xc8;return function(_0x3178d7){if(_0x3178d7){return _0x58f526[_0x9881('0x16')](_0x12794f)[_0x9881('0x17')](_0x3178d7);}};}function respondWithFilteredResult(_0x39d127,_0x1d57ea){return function(_0x4b9d1b){if(_0x4b9d1b){var _0x411513=typeof _0x1d57ea[_0x9881('0x18')]===_0x9881('0x19')&&typeof _0x1d57ea['limit']==='undefined';var _0x4c92c9=_0x4b9d1b[_0x9881('0x1a')];var _0x4c3493=_0x411513?0x0:_0x1d57ea[_0x9881('0x18')];var _0x5a9848=_0x411513?_0x4b9d1b['count']:_0x1d57ea[_0x9881('0x18')]+_0x1d57ea[_0x9881('0x1b')];var _0x1cbac3;if(_0x5a9848>=_0x4c92c9){_0x5a9848=_0x4c92c9;_0x1cbac3=0xc8;}else{_0x1cbac3=0xce;}_0x39d127[_0x9881('0x16')](_0x1cbac3);return _0x39d127[_0x9881('0x1c')](_0x9881('0x1d'),_0x4c3493+'-'+_0x5a9848+'/'+_0x4c92c9)[_0x9881('0x17')](_0x4b9d1b);}return null;};}function patchUpdates(_0x1243cc){return function(_0x1ee450){try{jsonpatch[_0x9881('0x1e')](_0x1ee450,_0x1243cc,!![]);}catch(_0x32ca84){return BPromise[_0x9881('0x1f')](_0x32ca84);}return _0x1ee450[_0x9881('0x20')]();};}function saveUpdates(_0x300fa6,_0x174b39){return function(_0x58485d){if(_0x58485d){return _0x58485d['update'](_0x300fa6)[_0x9881('0x21')](function(_0x513545){return _0x513545;});}return null;};}function removeEntity(_0x499461,_0x1ba558){return function(_0x30ed15){if(_0x30ed15){return _0x30ed15['destroy']()['then'](function(){_0x499461[_0x9881('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bddc1,_0x161f8d){return function(_0x16eeca){if(!_0x16eeca){_0x2bddc1[_0x9881('0x22')](0x194);}return _0x16eeca;};}function handleError(_0x2c3cd1,_0x14e6f9){_0x14e6f9=_0x14e6f9||0x1f4;return function(_0x2f6b7c){logger[_0x9881('0x23')](_0x2f6b7c[_0x9881('0x24')]);if(_0x2f6b7c[_0x9881('0x25')]){delete _0x2f6b7c[_0x9881('0x25')];}_0x2c3cd1[_0x9881('0x16')](_0x14e6f9)[_0x9881('0x26')](_0x2f6b7c);};}exports['show']=function(_0x31956e,_0x41fe0d){var _0x5c2815={'raw':!![],'where':{'id':_0x31956e[_0x9881('0x27')]['id']}},_0x236979={};_0x236979['model']=_[_0x9881('0x28')](db[_0x9881('0x29')][_0x9881('0x2a')]);_0x236979[_0x9881('0x2b')]=_[_0x9881('0x28')](_0x31956e[_0x9881('0x2b')]);_0x236979[_0x9881('0x2c')]=_[_0x9881('0x2d')](_0x236979['model'],_0x236979[_0x9881('0x2b')]);_0x5c2815[_0x9881('0x2e')]=_[_0x9881('0x2d')](_0x236979[_0x9881('0x2f')],qs[_0x9881('0x30')](_0x31956e[_0x9881('0x2b')]['fields']));_0x5c2815[_0x9881('0x2e')]=_0x5c2815[_0x9881('0x2e')]['length']?_0x5c2815[_0x9881('0x2e')]:_0x236979[_0x9881('0x2f')];if(_0x31956e[_0x9881('0x2b')][_0x9881('0x31')]){_0x5c2815[_0x9881('0x32')]=[{'all':!![]}];}_0x5c2815=_['merge']({},_0x5c2815,_0x31956e[_0x9881('0x33')]);return db[_0x9881('0x29')][_0x9881('0x34')](_0x5c2815)[_0x9881('0x21')](handleEntityNotFound(_0x41fe0d,null))[_0x9881('0x21')](respondWithResult(_0x41fe0d,null))[_0x9881('0x35')](handleError(_0x41fe0d,null));};exports[_0x9881('0x36')]=function(_0x250987,_0x2f6aea){return db[_0x9881('0x29')][_0x9881('0x36')](_0x250987[_0x9881('0x37')],{})[_0x9881('0x21')](respondWithResult(_0x2f6aea,0xc9))[_0x9881('0x35')](handleError(_0x2f6aea,null));};exports[_0x9881('0x38')]=function(_0x32aac8,_0x5d902d){if(_0x32aac8[_0x9881('0x37')]['id']){delete _0x32aac8['body']['id'];}return db[_0x9881('0x29')]['find']({'where':{'id':_0x32aac8[_0x9881('0x27')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x5d902d,null))['then'](saveUpdates(_0x32aac8[_0x9881('0x37')],null))['then'](respondWithResult(_0x5d902d,null))[_0x9881('0x35')](handleError(_0x5d902d,null));};exports[_0x9881('0x39')]=function(_0x1cddde,_0x204fc3){return db['ChatProactiveAction'][_0x9881('0x34')]({'where':{'id':_0x1cddde[_0x9881('0x27')]['id']}})[_0x9881('0x21')](handleEntityNotFound(_0x204fc3,null))[_0x9881('0x21')](removeEntity(_0x204fc3,null))[_0x9881('0x35')](handleError(_0x204fc3,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 75ead74..e2f4cff 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 _0x0310=['util','api','bluebird','request-promise','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash'];(function(_0x150533,_0x4d1976){var _0xe51556=function(_0x4ed204){while(--_0x4ed204){_0x150533['push'](_0x150533['shift']());}};_0xe51556(++_0x4d1976);}(_0x0310,0xa9));var _0x0031=function(_0xd650e5,_0x5264c7){_0xd650e5=_0xd650e5-0x0;var _0x8b2a0f=_0x0310[_0xd650e5];return _0x8b2a0f;};'use strict';var _=require(_0x0031('0x0'));var util=require(_0x0031('0x1'));var logger=require('../../config/logger')(_0x0031('0x2'));var moment=require('moment');var BPromise=require(_0x0031('0x3'));var rp=require(_0x0031('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0031('0x5'));var attributes=require(_0x0031('0x6'));module[_0x0031('0x7')]=function(_0x4fe0ac,_0x388000){return _0x4fe0ac['define'](_0x0031('0x8'),attributes,{'tableName':_0x0031('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x717c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x6d85a6,_0x5091fb){var _0x1f0470=function(_0x184f12){while(--_0x184f12){_0x6d85a6['push'](_0x6d85a6['shift']());}};_0x1f0470(++_0x5091fb);}(_0x717c,0x106));var _0xc717=function(_0x478ddb,_0x274168){_0x478ddb=_0x478ddb-0x0;var _0x3adb3c=_0x717c[_0x478ddb];return _0x3adb3c;};'use strict';var _=require(_0xc717('0x0'));var util=require(_0xc717('0x1'));var logger=require(_0xc717('0x2'))(_0xc717('0x3'));var moment=require(_0xc717('0x4'));var BPromise=require(_0xc717('0x5'));var rp=require(_0xc717('0x6'));var fs=require('fs');var path=require(_0xc717('0x7'));var rimraf=require(_0xc717('0x8'));var config=require(_0xc717('0x9'));var attributes=require(_0xc717('0xa'));module['exports']=function(_0x5e611d,_0x49c1bd){return _0x5e611d[_0xc717('0xb')](_0xc717('0xc'),attributes,{'tableName':_0xc717('0xd'),'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 78ad83c..be28b0f 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 _0x5891=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x5891,0xff));var _0x1589=function(_0xa0ad69,_0x386d32){_0xa0ad69=_0xa0ad69-0x0;var _0x40f3ad=_0x5891[_0xa0ad69];return _0x40f3ad;};'use strict';var _=require(_0x1589('0x0'));var util=require(_0x1589('0x1'));var moment=require(_0x1589('0x2'));var BPromise=require('bluebird');var rs=require(_0x1589('0x3'));var fs=require('fs');var Redis=require(_0x1589('0x4'));var db=require(_0x1589('0x5'))['db'];var utils=require(_0x1589('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1589('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6e0ca1,_0x56ec5b,_0x27cccb){return new BPromise(function(_0x952a1c,_0x28160e){return client[_0x1589('0x8')](_0x6e0ca1,_0x27cccb)[_0x1589('0x9')](function(_0x182105){logger[_0x1589('0xa')](_0x1589('0xb'),_0x56ec5b,_0x1589('0xc'));logger[_0x1589('0xd')](_0x1589('0xe'),_0x56ec5b,'request\x20sent',JSON[_0x1589('0xf')](_0x182105));if(_0x182105['error']){if(_0x182105[_0x1589('0x10')][_0x1589('0x11')]===0x1f4){logger[_0x1589('0x10')](_0x1589('0xb'),_0x56ec5b,_0x182105[_0x1589('0x10')][_0x1589('0x12')]);return _0x28160e(_0x182105[_0x1589('0x10')][_0x1589('0x12')]);}logger[_0x1589('0x10')](_0x1589('0xb'),_0x56ec5b,_0x182105[_0x1589('0x10')][_0x1589('0x12')]);return _0x952a1c(_0x182105[_0x1589('0x10')]['message']);}else{logger['info'](_0x1589('0xb'),_0x56ec5b,_0x1589('0xc'));_0x952a1c(_0x182105['result']['message']);}})['catch'](function(_0x901761){logger[_0x1589('0x10')](_0x1589('0xb'),_0x56ec5b,_0x901761);_0x28160e(_0x901761);});});} \ No newline at end of file +var _0x4a7f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x10e672,_0x4dd042){var _0x2a855e=function(_0x54e260){while(--_0x54e260){_0x10e672['push'](_0x10e672['shift']());}};_0x2a855e(++_0x4dd042);}(_0x4a7f,0x11b));var _0xf4a7=function(_0x4b92ae,_0x2d8607){_0x4b92ae=_0x4b92ae-0x0;var _0x5bab64=_0x4a7f[_0x4b92ae];return _0x5bab64;};'use strict';var _=require(_0xf4a7('0x0'));var util=require(_0xf4a7('0x1'));var moment=require('moment');var BPromise=require(_0xf4a7('0x2'));var rs=require(_0xf4a7('0x3'));var fs=require('fs');var Redis=require(_0xf4a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4a7('0x5'));var logger=require(_0xf4a7('0x6'))(_0xf4a7('0x7'));var config=require(_0xf4a7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x154dc3,_0x23b33a,_0xaa0f5b){return new BPromise(function(_0x260daf,_0x52bb2b){return client[_0xf4a7('0x9')](_0x154dc3,_0xaa0f5b)[_0xf4a7('0xa')](function(_0x3b53f2){logger['info'](_0xf4a7('0xb'),_0x23b33a,_0xf4a7('0xc'));logger[_0xf4a7('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x23b33a,_0xf4a7('0xc'),JSON['stringify'](_0x3b53f2));if(_0x3b53f2[_0xf4a7('0xe')]){if(_0x3b53f2[_0xf4a7('0xe')][_0xf4a7('0xf')]===0x1f4){logger['error'](_0xf4a7('0xb'),_0x23b33a,_0x3b53f2[_0xf4a7('0xe')][_0xf4a7('0x10')]);return _0x52bb2b(_0x3b53f2[_0xf4a7('0xe')][_0xf4a7('0x10')]);}logger['error'](_0xf4a7('0xb'),_0x23b33a,_0x3b53f2[_0xf4a7('0xe')][_0xf4a7('0x10')]);return _0x260daf(_0x3b53f2[_0xf4a7('0xe')][_0xf4a7('0x10')]);}else{logger[_0xf4a7('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x23b33a,_0xf4a7('0xc'));_0x260daf(_0x3b53f2['result'][_0xf4a7('0x10')]);}})[_0xf4a7('0x12')](function(_0x46729d){logger[_0xf4a7('0xe')](_0xf4a7('0xb'),_0x23b33a,_0x46729d);_0x52bb2b(_0x46729d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index c28fe1d..58f0084 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c5b46,_0x505354){var _0x5706c2=function(_0x5b3110){while(--_0x5b3110){_0x1c5b46['push'](_0x1c5b46['shift']());}};_0x5706c2(++_0x505354);}(_0x6aa7,0x178));var _0x76aa=function(_0x39d482,_0x203f6f){_0x39d482=_0x39d482-0x0;var _0x13b3c5=_0x6aa7[_0x39d482];return _0x13b3c5;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x3f8a=['/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get'];(function(_0x2db5cb,_0x1101e4){var _0x595ee8=function(_0x227710){while(--_0x227710){_0x2db5cb['push'](_0x2db5cb['shift']());}};_0x595ee8(++_0x1101e4);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x3d1360,_0xfe55ce){_0x3d1360=_0x3d1360-0x0;var _0x3346c5=_0x3f8a[_0x3d1360];return _0x3346c5;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var fs_extra=require(_0xa3f8('0x5'));var auth=require(_0xa3f8('0x6'));var interaction=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var controller=require(_0xa3f8('0x9'));router[_0xa3f8('0xa')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xc')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x11')]);router['delete'](_0xa3f8('0xb'),auth[_0xa3f8('0xc')](),controller[_0xa3f8('0x12')]);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 13d02d7..2e86763 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 _0x6be8=['roundrobin','exports','STRING','name','rrmemory','beepall'];(function(_0x542f27,_0x3dc877){var _0x371fc1=function(_0x34d545){while(--_0x34d545){_0x542f27['push'](_0x542f27['shift']());}};_0x371fc1(++_0x3dc877);}(_0x6be8,0x1bd));var _0x86be=function(_0x39dafb,_0x5e5b0f){_0x39dafb=_0x39dafb-0x0;var _0x597336=_0x6be8[_0x39dafb];return _0x597336;};'use strict';var Sequelize=require('sequelize');module[_0x86be('0x0')]={'name':{'type':Sequelize[_0x86be('0x1')],'unique':_0x86be('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x86be('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x86be('0x3'),_0x86be('0x4'),_0x86be('0x5'))}}; \ No newline at end of file +var _0xe343=['roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x19f3a5,_0x5b94a0){var _0x3984d7=function(_0x3419ae){while(--_0x3419ae){_0x19f3a5['push'](_0x19f3a5['shift']());}};_0x3984d7(++_0x5b94a0);}(_0xe343,0x91));var _0x3e34=function(_0x4dac30,_0x3b1e61){_0x4dac30=_0x4dac30-0x0;var _0x4ae741=_0xe343[_0x4dac30];return _0x4ae741;};'use strict';var Sequelize=require(_0x3e34('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3e34('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3e34('0x2')]},'timeout':{'type':Sequelize[_0x3e34('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3e34('0x4')](_0x3e34('0x5'),_0x3e34('0x6'),_0x3e34('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 72098c5..5ad4d94 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 _0xb334=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','ChatQueues','UserProfileResource','stack','name','send','ChatQueue','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','ChatQueueId','User','chatPause','updatedAt','rows','SIP','createdAt','getTeams','findOne','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','forEach','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','userChatQueue:remove','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x594f72,_0x138c47){var _0x811f78=function(_0x3da7e2){while(--_0x3da7e2){_0x594f72['push'](_0x594f72['shift']());}};_0x811f78(++_0x138c47);}(_0xb334,0x1bd));var _0x4b33=function(_0x5544ee,_0x2b4425){_0x5544ee=_0x5544ee-0x0;var _0x380709=_0xb334[_0x5544ee];return _0x380709;};'use strict';var emlformat=require(_0x4b33('0x0'));var rimraf=require(_0x4b33('0x1'));var zipdir=require(_0x4b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b33('0x3'));var BPromise=require(_0x4b33('0x4'));var Mustache=require(_0x4b33('0x5'));var util=require(_0x4b33('0x6'));var path=require(_0x4b33('0x7'));var sox=require(_0x4b33('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b33('0x9'));var _=require(_0x4b33('0xa'));var squel=require('squel');var crypto=require(_0x4b33('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b33('0xc'));var authService=require(_0x4b33('0xd'));var qs=require(_0x4b33('0xe'));var as=require(_0x4b33('0xf'));var hardwareService=require(_0x4b33('0x10'));var logger=require(_0x4b33('0x11'))(_0x4b33('0x12'));var utils=require(_0x4b33('0x13'));var config=require(_0x4b33('0x14'));var licenseUtil=require(_0x4b33('0x15'));var db=require(_0x4b33('0x16'))['db'];config[_0x4b33('0x17')]=_[_0x4b33('0x18')](config[_0x4b33('0x17')],{'host':_0x4b33('0x19'),'port':0x18eb});var socket=require(_0x4b33('0x1a'))(new Redis(config[_0x4b33('0x17')]));require(_0x4b33('0x1b'))[_0x4b33('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4b33('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53dbc6,_0xbd5f9d,_0x5aeef3,_0x307ec1){return new BPromise(function(_0x568991,_0x166753){var _0x16fa36=_0x307ec1||client;return _0x16fa36[_0x4b33('0x1e')](_0x53dbc6,_0x5aeef3)[_0x4b33('0x1f')](function(_0x5f148e){logger[_0x4b33('0x20')](_0x4b33('0x21'),_0xbd5f9d,_0x4b33('0x22'));logger[_0x4b33('0x23')](_0x4b33('0x24'),_0xbd5f9d,_0x4b33('0x22'),JSON[_0x4b33('0x25')](_0x5f148e));if(_0x5f148e[_0x4b33('0x26')]){if(_0x5f148e[_0x4b33('0x26')][_0x4b33('0x27')]===0x1f4){logger[_0x4b33('0x26')](_0x4b33('0x21'),_0xbd5f9d,_0x5f148e['error'][_0x4b33('0x28')]);return _0x166753(_0x5f148e[_0x4b33('0x26')][_0x4b33('0x28')]);}logger[_0x4b33('0x26')](_0x4b33('0x21'),_0xbd5f9d,_0x5f148e[_0x4b33('0x26')]['message']);return _0x568991(_0x5f148e[_0x4b33('0x26')][_0x4b33('0x28')]);}else{logger[_0x4b33('0x20')](_0x4b33('0x21'),_0xbd5f9d,_0x4b33('0x22'));_0x568991(_0x5f148e['result'][_0x4b33('0x28')]);}})[_0x4b33('0x29')](function(_0x2e4c36){logger[_0x4b33('0x26')]('ChatQueue,\x20%s,\x20%s',_0xbd5f9d,_0x2e4c36);_0x166753(_0x2e4c36);});});}function respondWithStatusCode(_0x456eb2,_0x3d1733){_0x3d1733=_0x3d1733||0xcc;return function(_0x487fd0){if(_0x487fd0){return _0x456eb2[_0x4b33('0x2a')](_0x3d1733);}return _0x456eb2['status'](_0x3d1733)[_0x4b33('0x2b')]();};}function respondWithResult(_0x58d5eb,_0x422e40){_0x422e40=_0x422e40||0xc8;return function(_0x17d99d){if(_0x17d99d){return _0x58d5eb[_0x4b33('0x2c')](_0x422e40)['json'](_0x17d99d);}};}function respondWithFilteredResult(_0x1ce47c,_0x2bf093){return function(_0x5af057){if(_0x5af057){var _0x322df8=typeof _0x2bf093[_0x4b33('0x2d')]===_0x4b33('0x2e')&&typeof _0x2bf093[_0x4b33('0x2f')]==='undefined';var _0x572e35=_0x5af057['count'];var _0x16793d=_0x322df8?0x0:_0x2bf093[_0x4b33('0x2d')];var _0x34a3e2=_0x322df8?_0x5af057[_0x4b33('0x30')]:_0x2bf093[_0x4b33('0x2d')]+_0x2bf093[_0x4b33('0x2f')];var _0x2fced0;if(_0x34a3e2>=_0x572e35){_0x34a3e2=_0x572e35;_0x2fced0=0xc8;}else{_0x2fced0=0xce;}_0x1ce47c[_0x4b33('0x2c')](_0x2fced0);return _0x1ce47c[_0x4b33('0x31')](_0x4b33('0x32'),_0x16793d+'-'+_0x34a3e2+'/'+_0x572e35)[_0x4b33('0x33')](_0x5af057);}return null;};}function patchUpdates(_0x27af0c){return function(_0x18e843){try{jsonpatch[_0x4b33('0x34')](_0x18e843,_0x27af0c,!![]);}catch(_0x7b510b){return BPromise[_0x4b33('0x35')](_0x7b510b);}return _0x18e843[_0x4b33('0x36')]();};}function saveUpdates(_0x27c69d,_0x45ed78){return function(_0x170b60){if(_0x170b60){return _0x170b60[_0x4b33('0x37')](_0x27c69d)['then'](function(_0x16f0da){return _0x16f0da;});}return null;};}function removeEntity(_0x3f01a4,_0x138564){return function(_0x2a3ddb){if(_0x2a3ddb){return _0x2a3ddb[_0x4b33('0x38')]()['then'](function(){var _0x329aff=_0x2a3ddb['get']({'plain':!![]});var _0x3590d7=_0x4b33('0x39');return db[_0x4b33('0x3a')][_0x4b33('0x38')]({'where':{'type':_0x3590d7,'resourceId':_0x329aff['id']}})['then'](function(){return _0x2a3ddb;});})[_0x4b33('0x1f')](function(){_0x3f01a4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x113825,_0x197569){return function(_0x2ef016){if(!_0x2ef016){_0x113825[_0x4b33('0x2a')](0x194);}return _0x2ef016;};}function handleError(_0x5cfc21,_0x2bffc6){_0x2bffc6=_0x2bffc6||0x1f4;return function(_0xf09c83){logger[_0x4b33('0x26')](_0xf09c83[_0x4b33('0x3b')]);if(_0xf09c83[_0x4b33('0x3c')]){delete _0xf09c83[_0x4b33('0x3c')];}_0x5cfc21[_0x4b33('0x2c')](_0x2bffc6)[_0x4b33('0x3d')](_0xf09c83);};}exports['index']=function(_0xedbe2d,_0xe63790){var _0x539d49={},_0x1dd7c9={},_0x145335={'count':0x0,'rows':[]};var _0xd998c8=_['map'](db[_0x4b33('0x3e')]['rawAttributes'],function(_0x177344){return{'name':_0x177344[_0x4b33('0x3f')],'type':_0x177344[_0x4b33('0x40')][_0x4b33('0x41')]};});_0x1dd7c9['model']=_['map'](_0xd998c8,_0x4b33('0x3c'));_0x1dd7c9[_0x4b33('0x42')]=_[_0x4b33('0x43')](_0xedbe2d[_0x4b33('0x42')]);_0x1dd7c9[_0x4b33('0x44')]=_[_0x4b33('0x45')](_0x1dd7c9[_0x4b33('0x46')],_0x1dd7c9['query']);_0x539d49['attributes']=_[_0x4b33('0x45')](_0x1dd7c9[_0x4b33('0x46')],qs[_0x4b33('0x47')](_0xedbe2d[_0x4b33('0x42')]['fields']));_0x539d49[_0x4b33('0x48')]=_0x539d49['attributes'][_0x4b33('0x49')]?_0x539d49['attributes']:_0x1dd7c9[_0x4b33('0x46')];if(!_0xedbe2d[_0x4b33('0x42')]['hasOwnProperty'](_0x4b33('0x4a'))){_0x539d49[_0x4b33('0x2f')]=qs[_0x4b33('0x2f')](_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x2f')]);_0x539d49[_0x4b33('0x2d')]=qs['offset'](_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x2d')]);}_0x539d49[_0x4b33('0x4b')]=qs[_0x4b33('0x4c')](_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x4c')]);_0x539d49[_0x4b33('0x4d')]=qs[_0x4b33('0x44')](_[_0x4b33('0x4e')](_0xedbe2d['query'],_0x1dd7c9[_0x4b33('0x44')]),_0xd998c8);if(_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x4f')]){_0x539d49[_0x4b33('0x4d')]=_[_0x4b33('0x50')](_0x539d49[_0x4b33('0x4d')],{'$or':_[_0x4b33('0x51')](_0xd998c8,function(_0x2db048){if(_0x2db048[_0x4b33('0x40')]!==_0x4b33('0x52')){var _0x323b4c={};_0x323b4c[_0x2db048[_0x4b33('0x3c')]]={'$like':'%'+_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x4f')]+'%'};return _0x323b4c;}})});}_0x539d49=_[_0x4b33('0x50')]({},_0x539d49,_0xedbe2d[_0x4b33('0x53')]);var _0x24520e={'where':_0x539d49['where']};return db[_0x4b33('0x3e')][_0x4b33('0x30')](_0x24520e)[_0x4b33('0x1f')](function(_0x4de59c){_0x145335[_0x4b33('0x30')]=_0x4de59c;if(_0xedbe2d[_0x4b33('0x42')][_0x4b33('0x54')]){_0x539d49[_0x4b33('0x55')]=[{'all':!![]}];}return db[_0x4b33('0x3e')][_0x4b33('0x56')](_0x539d49);})[_0x4b33('0x1f')](function(_0x5ab325){_0x145335['rows']=_0x5ab325;return _0x145335;})[_0x4b33('0x1f')](respondWithFilteredResult(_0xe63790,_0x539d49))[_0x4b33('0x29')](handleError(_0xe63790,null));};exports['show']=function(_0xe1b3a5,_0x2a3402){var _0x33c2a0={'raw':!![],'where':{'id':_0xe1b3a5[_0x4b33('0x57')]['id']}},_0x179d2e={};_0x179d2e['model']=_[_0x4b33('0x43')](db[_0x4b33('0x3e')][_0x4b33('0x58')]);_0x179d2e[_0x4b33('0x42')]=_[_0x4b33('0x43')](_0xe1b3a5[_0x4b33('0x42')]);_0x179d2e[_0x4b33('0x44')]=_[_0x4b33('0x45')](_0x179d2e[_0x4b33('0x46')],_0x179d2e[_0x4b33('0x42')]);_0x33c2a0[_0x4b33('0x48')]=_[_0x4b33('0x45')](_0x179d2e[_0x4b33('0x46')],qs[_0x4b33('0x47')](_0xe1b3a5[_0x4b33('0x42')][_0x4b33('0x47')]));_0x33c2a0[_0x4b33('0x48')]=_0x33c2a0['attributes'][_0x4b33('0x49')]?_0x33c2a0['attributes']:_0x179d2e[_0x4b33('0x46')];if(_0xe1b3a5[_0x4b33('0x42')][_0x4b33('0x54')]){_0x33c2a0[_0x4b33('0x55')]=[{'all':!![]}];}_0x33c2a0=_[_0x4b33('0x50')]({},_0x33c2a0,_0xe1b3a5[_0x4b33('0x53')]);return db[_0x4b33('0x3e')][_0x4b33('0x59')](_0x33c2a0)[_0x4b33('0x1f')](handleEntityNotFound(_0x2a3402,null))[_0x4b33('0x1f')](respondWithResult(_0x2a3402,null))['catch'](handleError(_0x2a3402,null));};exports[_0x4b33('0x5a')]=function(_0x3b2b3f,_0x506ed4){return db[_0x4b33('0x3e')]['create'](_0x3b2b3f[_0x4b33('0x5b')],{})[_0x4b33('0x1f')](function(_0x14179c){var _0x311d16=_0x3b2b3f[_0x4b33('0x5c')][_0x4b33('0x5d')]({'plain':!![]});if(!_0x311d16)throw new Error(_0x4b33('0x5e'));if(_0x311d16[_0x4b33('0x5f')]===_0x4b33('0x5c')){var _0x3b480b=_0x14179c[_0x4b33('0x5d')]({'plain':!![]});var _0x1203e3=_0x4b33('0x39');return db[_0x4b33('0x60')][_0x4b33('0x59')]({'where':{'name':_0x1203e3,'userProfileId':_0x311d16[_0x4b33('0x61')]},'raw':!![]})[_0x4b33('0x1f')](function(_0x3fdf5c){if(_0x3fdf5c&&_0x3fdf5c['autoAssociation']===0x0){return db[_0x4b33('0x3a')]['create']({'name':_0x3b480b[_0x4b33('0x3c')],'resourceId':_0x3b480b['id'],'type':_0x3fdf5c[_0x4b33('0x3c')],'sectionId':_0x3fdf5c['id']},{})[_0x4b33('0x1f')](function(){return _0x14179c;});}else{return _0x14179c;}})[_0x4b33('0x29')](function(_0x214541){logger[_0x4b33('0x26')](_0x4b33('0x62'),_0x214541);throw _0x214541;});}return _0x14179c;})[_0x4b33('0x1f')](respondWithResult(_0x506ed4,0xc9))[_0x4b33('0x29')](handleError(_0x506ed4,null));};exports['update']=function(_0x177655,_0x1a25c7){if(_0x177655[_0x4b33('0x5b')]['id']){delete _0x177655[_0x4b33('0x5b')]['id'];}return db[_0x4b33('0x3e')][_0x4b33('0x59')]({'where':{'id':_0x177655[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0x1a25c7,null))[_0x4b33('0x1f')](saveUpdates(_0x177655[_0x4b33('0x5b')],null))['then'](respondWithResult(_0x1a25c7,null))[_0x4b33('0x29')](handleError(_0x1a25c7,null));};exports[_0x4b33('0x38')]=function(_0x526b81,_0xaa4029){return db[_0x4b33('0x3e')][_0x4b33('0x59')]({'where':{'id':_0x526b81[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0xaa4029,null))['then'](removeEntity(_0xaa4029,null))[_0x4b33('0x29')](handleError(_0xaa4029,null));};exports[_0x4b33('0x63')]=function(_0x20a697,_0x536532){return db['ChatQueue'][_0x4b33('0x63')]()[_0x4b33('0x1f')](respondWithResult(_0x536532,null))[_0x4b33('0x29')](handleError(_0x536532,null));};exports[_0x4b33('0x64')]=function(_0x3c763d,_0x36e673,_0x5556f5){var _0x473d74={'raw':!![],'where':{}},_0x2dc392={},_0x58da5b;return db[_0x4b33('0x3e')]['findOne']({'where':{'id':_0x3c763d[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0x36e673,null))[_0x4b33('0x1f')](function(_0x4fd8a6){if(_0x4fd8a6){_0x58da5b=_0x4fd8a6[_0x4b33('0x5d')]({'plain':!![]});_0x2dc392[_0x4b33('0x46')]=_[_0x4b33('0x43')](db[_0x4b33('0x65')][_0x4b33('0x58')]);_0x2dc392[_0x4b33('0x42')]=_[_0x4b33('0x43')](_0x3c763d[_0x4b33('0x42')]);_0x2dc392[_0x4b33('0x44')]=_['intersection'](_0x2dc392['model'],_0x2dc392[_0x4b33('0x42')]);_0x473d74[_0x4b33('0x48')]=_[_0x4b33('0x45')](_0x2dc392[_0x4b33('0x46')],qs[_0x4b33('0x47')](_0x3c763d[_0x4b33('0x42')][_0x4b33('0x47')]));_0x473d74['attributes']=_0x473d74[_0x4b33('0x48')][_0x4b33('0x49')]?_0x473d74['attributes']:_0x2dc392[_0x4b33('0x46')];if(!_0x3c763d['query']['hasOwnProperty'](_0x4b33('0x4a'))){_0x473d74[_0x4b33('0x2f')]=qs[_0x4b33('0x2f')](_0x3c763d['query'][_0x4b33('0x2f')]);_0x473d74[_0x4b33('0x2d')]=qs['offset'](_0x3c763d[_0x4b33('0x42')][_0x4b33('0x2d')]);}_0x473d74['order']=qs[_0x4b33('0x4c')](_0x3c763d['query'][_0x4b33('0x4c')]);_0x473d74[_0x4b33('0x4d')]=qs[_0x4b33('0x44')](_[_0x4b33('0x4e')](_0x3c763d[_0x4b33('0x42')],_0x2dc392[_0x4b33('0x44')]));_0x473d74[_0x4b33('0x4d')][_0x4b33('0x66')]=_0x4fd8a6['id'];if(_0x3c763d[_0x4b33('0x42')][_0x4b33('0x4f')]){_0x473d74[_0x4b33('0x4d')]=_['merge'](_0x473d74[_0x4b33('0x4d')],{'$or':_[_0x4b33('0x51')](_0x473d74[_0x4b33('0x48')],function(_0x21fddd){var _0x54975d={};_0x54975d[_0x21fddd]={'$like':'%'+_0x3c763d[_0x4b33('0x42')][_0x4b33('0x4f')]+'%'};return _0x54975d;})});}_0x473d74=_[_0x4b33('0x50')]({},_0x473d74,_0x3c763d[_0x4b33('0x53')]);return db[_0x4b33('0x65')][_0x4b33('0x56')](_0x473d74);}})[_0x4b33('0x1f')](function(_0x41d673){if(_0x41d673){return db[_0x4b33('0x67')]['findAndCountAll']({'where':{'id':_[_0x4b33('0x51')](_0x41d673,'UserId'),'role':'agent'},'attributes':['id','name',_0x4b33('0x68'),_0x4b33('0x69'),'createdAt']});}})[_0x4b33('0x1f')](function(_0x155abb){if(_0x155abb){return{'count':_0x155abb[_0x4b33('0x30')],'rows':_[_0x4b33('0x51')](_0x155abb[_0x4b33('0x6a')],function(_0x465ef3){return{'membername':_0x465ef3[_0x4b33('0x3c')],'UserId':_0x465ef3['id'],'queue_name':_0x58da5b['name'],'ChatQueueId':_0x58da5b['id'],'interface':util['format']('%s/%s',_0x4b33('0x6b'),_0x465ef3[_0x4b33('0x3c')]),'penalty':0x0,'paused':_0x465ef3[_0x4b33('0x68')],'createdAt':_0x465ef3[_0x4b33('0x6c')],'updatedAt':_0x465ef3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b33('0x1f')](respondWithFilteredResult(_0x36e673,_0x473d74))[_0x4b33('0x29')](handleError(_0x36e673,null));};exports[_0x4b33('0x6d')]=function(_0x2bc662,_0x2fa0a7,_0xb1f57a){var _0xd10762={};var _0x1486d3={};var _0x4a0f9a;var _0x266783;return db[_0x4b33('0x3e')][_0x4b33('0x6e')]({'where':{'id':_0x2bc662[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0x2fa0a7,null))['then'](function(_0x55c084){if(_0x55c084){_0x4a0f9a=_0x55c084;_0x1486d3['model']=_[_0x4b33('0x43')](db[_0x4b33('0x6f')][_0x4b33('0x58')]);_0x1486d3[_0x4b33('0x42')]=_['keys'](_0x2bc662['query']);_0x1486d3['filters']=_[_0x4b33('0x45')](_0x1486d3[_0x4b33('0x46')],_0x1486d3[_0x4b33('0x42')]);_0xd10762[_0x4b33('0x48')]=_[_0x4b33('0x45')](_0x1486d3['model'],qs[_0x4b33('0x47')](_0x2bc662['query'][_0x4b33('0x47')]));_0xd10762['attributes']=_0xd10762[_0x4b33('0x48')][_0x4b33('0x49')]?_0xd10762[_0x4b33('0x48')]:_0x1486d3[_0x4b33('0x46')];_0xd10762[_0x4b33('0x4b')]=qs[_0x4b33('0x4c')](_0x2bc662[_0x4b33('0x42')][_0x4b33('0x4c')]);_0xd10762[_0x4b33('0x4d')]=qs[_0x4b33('0x44')](_[_0x4b33('0x4e')](_0x2bc662['query'],_0x1486d3[_0x4b33('0x44')]));if(_0x2bc662[_0x4b33('0x42')][_0x4b33('0x4f')]){_0xd10762['where']=_[_0x4b33('0x50')](_0xd10762['where'],{'$or':_[_0x4b33('0x51')](_0xd10762[_0x4b33('0x48')],function(_0x53bb1f){var _0x15e5bf={};_0x15e5bf[_0x53bb1f]={'$like':'%'+_0x2bc662[_0x4b33('0x42')][_0x4b33('0x4f')]+'%'};return _0x15e5bf;})});}_0xd10762=_[_0x4b33('0x50')]({},_0xd10762,_0x2bc662[_0x4b33('0x53')]);return _0x4a0f9a[_0x4b33('0x6d')](_0xd10762);}})[_0x4b33('0x1f')](function(_0x17e096){if(_0x17e096){_0x266783=_0x17e096['length'];if(!_0x2bc662[_0x4b33('0x42')]['hasOwnProperty'](_0x4b33('0x4a'))){_0xd10762[_0x4b33('0x2f')]=qs[_0x4b33('0x2f')](_0x2bc662[_0x4b33('0x42')][_0x4b33('0x2f')]);_0xd10762[_0x4b33('0x2d')]=qs[_0x4b33('0x2d')](_0x2bc662['query'][_0x4b33('0x2d')]);}return _0x4a0f9a[_0x4b33('0x6d')](_0xd10762);}})['then'](function(_0x2ca9cb){if(_0x2ca9cb){return _0x2ca9cb?{'count':_0x266783,'rows':_0x2ca9cb}:null;}})[_0x4b33('0x1f')](respondWithResult(_0x2fa0a7,null))[_0x4b33('0x29')](handleError(_0x2fa0a7,null));};exports['addTeams']=function(_0x219e1f,_0x21a46f,_0x49e36f){var _0x5ac8e5=_0x219e1f[_0x4b33('0x5b')][_0x4b33('0x70')];return db['Team']['findAll']({'where':{'id':_0x5ac8e5},'attributes':['id'],'include':[{'model':db[_0x4b33('0x67')],'as':'Agents','attributes':['id',_0x4b33('0x3c'),_0x4b33('0x71'),_0x4b33('0x72'),_0x4b33('0x73')],'raw':!![]}]})[_0x4b33('0x1f')](function(_0x34cf95){if(_0x34cf95){var _0x3efbe4=_[_0x4b33('0x74')](_0x34cf95,function(_0x3434b3){var _0x3c8a9a=_0x3434b3[_0x4b33('0x5d')]({'plain':!![]});return _0x3c8a9a[_0x4b33('0x75')];});return db[_0x4b33('0x3e')]['find']({'where':{'id':_0x219e1f[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](function(_0x12c365){return db[_0x4b33('0x76')][_0x4b33('0x77')](function(_0x398cc0){return _0x12c365[_0x4b33('0x78')](_0x5ac8e5,{'transaction':_0x398cc0})[_0x4b33('0x1f')](function(){return BPromise[_0x4b33('0x79')](_0x3efbe4,function(_0x4d5bbc){return db[_0x4b33('0x65')]['findOrCreate']({'where':{'UserId':_0x4d5bbc['id'],'ChatQueueId':_0x219e1f[_0x4b33('0x57')]['id']},'transaction':_0x398cc0});});})[_0x4b33('0x1f')](function(){_0x3efbe4[_0x4b33('0x7a')](function(_0x2603d6){socket['emit'](_0x4b33('0x7b'),{'UserId':_0x2603d6['id'],'ChatQueueId':_0x12c365['id']});});});});});}})[_0x4b33('0x1f')](respondWithStatusCode(_0x21a46f,null))[_0x4b33('0x29')](handleError(_0x21a46f,null));};exports[_0x4b33('0x7c')]=function(_0x493d02,_0x3b2adf,_0x20e79f){return db[_0x4b33('0x6f')][_0x4b33('0x56')]({'where':{'id':_0x493d02['query'][_0x4b33('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b33('0x75'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3b2adf,null))['then'](function(_0x12d72a){var _0x274b4d=_[_0x4b33('0x51')](_0x12d72a,'id');var _0xe53079=[];var _0x43e17b=[];var _0x1b4ee5=squel[_0x4b33('0x7d')]();_0x1b4ee5[_0x4b33('0x7e')](_0x4b33('0x7f'))[_0x4b33('0x80')]('team_has_chat_queues','tq')[_0x4b33('0x81')](_0x4b33('0x82'),'ut',_0x4b33('0x83'))[_0x4b33('0x4d')](_0x4b33('0x84'),_0x493d02[_0x4b33('0x57')]['id']);for(var _0x55beb9=0x0;_0x55beb9<_0x12d72a['length'];_0x55beb9+=0x1){let _0x304130=_0x12d72a[_0x55beb9];for(var _0x3bb36d=0x0;_0x3bb36d<_0x304130[_0x4b33('0x75')]['length'];_0x3bb36d+=0x1){let _0x43cc81=_0x304130[_0x4b33('0x75')][_0x3bb36d];var _0x469877=_0x1b4ee5[_0x4b33('0x85')]();_0x469877[_0x4b33('0x4d')](_0x4b33('0x86'),_0x43cc81['id']);_0x43e17b[_0x4b33('0x87')](db[_0x4b33('0x76')][_0x4b33('0x42')](_0x469877[_0x4b33('0x88')](),{'type':db[_0x4b33('0x76')][_0x4b33('0x89')][_0x4b33('0x8a')]})[_0x4b33('0x1f')](function(_0x3278f0){if(_0x3278f0[_0x4b33('0x49')]===0x1){return _0x43cc81['id'];}else{var _0x1df419=_[_0x4b33('0x8b')](_[_0x4b33('0x51')](_0x3278f0,_0x4b33('0x8c')),function(_0x2e051e){return _[_0x4b33('0x8d')](_0x274b4d,_0x2e051e);});if(_0x1df419){return _0x43cc81['id'];}}}));}}return BPromise[_0x4b33('0x8e')](_0x43e17b)[_0x4b33('0x1f')](function(_0x5cfa7c){_0xe53079=_(_0xe53079)[_0x4b33('0x8f')](_0x5cfa7c)[_0x4b33('0x90')]()[_0x4b33('0x91')]();return db[_0x4b33('0x3e')][_0x4b33('0x59')]({'where':{'id':_0x493d02['params']['id']}})[_0x4b33('0x1f')](function(_0x767fe5){return db[_0x4b33('0x76')][_0x4b33('0x77')](function(_0x12fd74){return _0x767fe5['removeTeams'](_0x493d02[_0x4b33('0x42')][_0x4b33('0x70')],{'transaction':_0x12fd74})[_0x4b33('0x1f')](function(){if(!_[_0x4b33('0x92')](_0xe53079)){return _0x767fe5[_0x4b33('0x93')](_0xe53079,{'transaction':_0x12fd74});}})[_0x4b33('0x1f')](function(){_0xe53079[_0x4b33('0x7a')](function(_0x4c9d8e){socket[_0x4b33('0x94')]('userChatQueue:remove',{'UserId':_0x4c9d8e,'ChatQueueId':_0x767fe5['id']});});});});});});})[_0x4b33('0x1f')](respondWithStatusCode(_0x3b2adf,null))[_0x4b33('0x29')](handleError(_0x3b2adf,null));};exports[_0x4b33('0x95')]=function(_0x9289c8,_0x1ff484,_0x53ca72){return db['ChatQueue'][_0x4b33('0x59')]({'where':{'id':_0x9289c8[_0x4b33('0x57')]['id']}})['then'](handleEntityNotFound(_0x1ff484,null))[_0x4b33('0x1f')](function(_0x36e73a){if(_0x36e73a){return _0x36e73a[_0x4b33('0x95')](_0x9289c8[_0x4b33('0x5b')][_0x4b33('0x70')],_[_0x4b33('0x96')](_0x9289c8[_0x4b33('0x5b')],[_0x4b33('0x70'),'id'])||{})[_0x4b33('0x97')](function(_0x49c8c2){for(var _0x26099f=0x0;_0x26099f<_0x9289c8[_0x4b33('0x5b')][_0x4b33('0x70')][_0x4b33('0x49')];_0x26099f+=0x1){socket['emit'](_0x4b33('0x7b'),{'UserId':Number(_0x9289c8[_0x4b33('0x5b')]['ids'][_0x26099f]),'ChatQueueId':Number(_0x9289c8[_0x4b33('0x57')]['id'])});}return _0x49c8c2;});}})[_0x4b33('0x1f')](respondWithResult(_0x1ff484,null))['catch'](handleError(_0x1ff484,null));};exports['removeAgents']=function(_0x4fba3e,_0x3941b4,_0x54d9fd){return db['ChatQueue'][_0x4b33('0x59')]({'where':{'id':_0x4fba3e[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0x3941b4,null))[_0x4b33('0x1f')](function(_0x19bc9b){if(_0x19bc9b){return _0x19bc9b['removeAgents'](_0x4fba3e[_0x4b33('0x42')][_0x4b33('0x70')])[_0x4b33('0x1f')](function(){if(_['isArray'](_0x4fba3e[_0x4b33('0x42')][_0x4b33('0x70')])){for(var _0x19b850=0x0;_0x19b850<_0x4fba3e[_0x4b33('0x42')][_0x4b33('0x70')]['length'];_0x19b850+=0x1){socket[_0x4b33('0x94')](_0x4b33('0x98'),{'UserId':Number(_0x4fba3e[_0x4b33('0x42')]['ids'][_0x19b850]),'ChatQueueId':Number(_0x4fba3e[_0x4b33('0x57')]['id'])});}}else{socket[_0x4b33('0x94')]('userChatQueue:remove',{'UserId':Number(_0x4fba3e['query']['ids']),'ChatQueueId':Number(_0x4fba3e[_0x4b33('0x57')]['id'])});}});}})[_0x4b33('0x1f')](respondWithStatusCode(_0x3941b4,null))[_0x4b33('0x29')](handleError(_0x3941b4,null));};exports['getAgents']=function(_0x42f8c8,_0x28164f,_0x39d162){var _0x368cba={};var _0x359b38={};var _0x3e5ad6;var _0xee19ee;return db[_0x4b33('0x3e')]['findOne']({'where':{'id':_0x42f8c8[_0x4b33('0x57')]['id']}})[_0x4b33('0x1f')](handleEntityNotFound(_0x28164f,null))[_0x4b33('0x1f')](function(_0x3dadc1){if(_0x3dadc1){_0x3e5ad6=_0x3dadc1;_0x359b38[_0x4b33('0x46')]=_[_0x4b33('0x43')](db[_0x4b33('0x67')][_0x4b33('0x58')]);_0x359b38[_0x4b33('0x42')]=_[_0x4b33('0x43')](_0x42f8c8['query']);_0x359b38[_0x4b33('0x44')]=_['intersection'](_0x359b38[_0x4b33('0x46')],_0x359b38[_0x4b33('0x42')]);_0x368cba['attributes']=_[_0x4b33('0x45')](_0x359b38[_0x4b33('0x46')],qs[_0x4b33('0x47')](_0x42f8c8[_0x4b33('0x42')][_0x4b33('0x47')]));_0x368cba[_0x4b33('0x48')]=_0x368cba[_0x4b33('0x48')][_0x4b33('0x49')]?_0x368cba[_0x4b33('0x48')]:_0x359b38[_0x4b33('0x46')];_0x368cba[_0x4b33('0x4b')]=qs[_0x4b33('0x4c')](_0x42f8c8[_0x4b33('0x42')][_0x4b33('0x4c')]);_0x368cba[_0x4b33('0x4d')]=qs[_0x4b33('0x44')](_[_0x4b33('0x4e')](_0x42f8c8[_0x4b33('0x42')],_0x359b38[_0x4b33('0x44')]));if(_0x42f8c8['query'][_0x4b33('0x4f')]){_0x368cba[_0x4b33('0x4d')]=_[_0x4b33('0x50')](_0x368cba[_0x4b33('0x4d')],{'$or':_[_0x4b33('0x51')](_0x368cba[_0x4b33('0x48')],function(_0x247aea){var _0x2600b3={};_0x2600b3[_0x247aea]={'$like':'%'+_0x42f8c8['query'][_0x4b33('0x4f')]+'%'};return _0x2600b3;})});}_0x368cba=_['merge']({},_0x368cba,_0x42f8c8[_0x4b33('0x53')]);return _0x3e5ad6[_0x4b33('0x99')](_0x368cba);}})['then'](function(_0x3db892){if(_0x3db892){_0xee19ee=_0x3db892[_0x4b33('0x49')];if(!_0x42f8c8['query'][_0x4b33('0x9a')](_0x4b33('0x4a'))){_0x368cba[_0x4b33('0x2f')]=qs[_0x4b33('0x2f')](_0x42f8c8[_0x4b33('0x42')]['limit']);_0x368cba[_0x4b33('0x2d')]=qs['offset'](_0x42f8c8[_0x4b33('0x42')][_0x4b33('0x2d')]);}return _0x3e5ad6[_0x4b33('0x99')](_0x368cba);}})['then'](function(_0x37ba46){if(_0x37ba46){return _0x37ba46?{'count':_0xee19ee,'rows':_0x37ba46}:null;}})[_0x4b33('0x1f')](respondWithResult(_0x28164f,null))[_0x4b33('0x29')](handleError(_0x28164f,null));}; \ No newline at end of file +var _0xbd26=['UserChatQueue','pick','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','includes','union','value','removeTeams','forEach','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','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','../../mysqldb','defaults','./chatQueue.socket','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','Content-Range','update','then','get','ChatQueues','destroy','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','params'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0xbd26,0xc6));var _0x6bd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd26[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6bd2('0x0'));var rimraf=require(_0x6bd2('0x1'));var zipdir=require(_0x6bd2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bd2('0x3'));var BPromise=require(_0x6bd2('0x4'));var Mustache=require(_0x6bd2('0x5'));var util=require(_0x6bd2('0x6'));var path=require(_0x6bd2('0x7'));var sox=require('sox');var csv=require(_0x6bd2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bd2('0x9'));var _=require(_0x6bd2('0xa'));var squel=require(_0x6bd2('0xb'));var crypto=require(_0x6bd2('0xc'));var jsforce=require(_0x6bd2('0xd'));var deskjs=require(_0x6bd2('0xe'));var toCsv=require(_0x6bd2('0x8'));var querystring=require('querystring');var Papa=require(_0x6bd2('0xf'));var Redis=require(_0x6bd2('0x10'));var authService=require(_0x6bd2('0x11'));var qs=require(_0x6bd2('0x12'));var as=require(_0x6bd2('0x13'));var hardwareService=require(_0x6bd2('0x14'));var logger=require(_0x6bd2('0x15'))(_0x6bd2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6bd2('0x17'))['db'];config['redis']=_[_0x6bd2('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6bd2('0x19'))[_0x6bd2('0x1a')](socket);var jayson=require(_0x6bd2('0x1b'));var client=jayson[_0x6bd2('0x1c')][_0x6bd2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3be580,_0x10bff8,_0xecb9cb,_0x45b647){return new BPromise(function(_0x180cac,_0x350077){var _0x5b5445=_0x45b647||client;return _0x5b5445[_0x6bd2('0x1e')](_0x3be580,_0xecb9cb)['then'](function(_0x11ff65){logger[_0x6bd2('0x1f')](_0x6bd2('0x20'),_0x10bff8,_0x6bd2('0x21'));logger[_0x6bd2('0x22')](_0x6bd2('0x23'),_0x10bff8,_0x6bd2('0x21'),JSON[_0x6bd2('0x24')](_0x11ff65));if(_0x11ff65['error']){if(_0x11ff65[_0x6bd2('0x25')][_0x6bd2('0x26')]===0x1f4){logger[_0x6bd2('0x25')](_0x6bd2('0x20'),_0x10bff8,_0x11ff65[_0x6bd2('0x25')][_0x6bd2('0x27')]);return _0x350077(_0x11ff65['error']['message']);}logger[_0x6bd2('0x25')]('ChatQueue,\x20%s,\x20%s',_0x10bff8,_0x11ff65[_0x6bd2('0x25')][_0x6bd2('0x27')]);return _0x180cac(_0x11ff65[_0x6bd2('0x25')]['message']);}else{logger['info'](_0x6bd2('0x20'),_0x10bff8,'request\x20sent');_0x180cac(_0x11ff65[_0x6bd2('0x28')][_0x6bd2('0x27')]);}})['catch'](function(_0x3480a5){logger[_0x6bd2('0x25')](_0x6bd2('0x20'),_0x10bff8,_0x3480a5);_0x350077(_0x3480a5);});});}function respondWithStatusCode(_0x69721d,_0x33fb93){_0x33fb93=_0x33fb93||0xcc;return function(_0x3ebe5d){if(_0x3ebe5d){return _0x69721d['sendStatus'](_0x33fb93);}return _0x69721d[_0x6bd2('0x29')](_0x33fb93)[_0x6bd2('0x2a')]();};}function respondWithResult(_0xa3585d,_0x41304b){_0x41304b=_0x41304b||0xc8;return function(_0x3838d2){if(_0x3838d2){return _0xa3585d[_0x6bd2('0x29')](_0x41304b)[_0x6bd2('0x2b')](_0x3838d2);}};}function respondWithFilteredResult(_0x294a9a,_0x3ecf03){return function(_0x2d2267){if(_0x2d2267){var _0x12b00b=typeof _0x3ecf03[_0x6bd2('0x2c')]===_0x6bd2('0x2d')&&typeof _0x3ecf03[_0x6bd2('0x2e')]==='undefined';var _0x2e8272=_0x2d2267[_0x6bd2('0x2f')];var _0x145872=_0x12b00b?0x0:_0x3ecf03[_0x6bd2('0x2c')];var _0x346761=_0x12b00b?_0x2d2267[_0x6bd2('0x2f')]:_0x3ecf03[_0x6bd2('0x2c')]+_0x3ecf03[_0x6bd2('0x2e')];var _0x1af68a;if(_0x346761>=_0x2e8272){_0x346761=_0x2e8272;_0x1af68a=0xc8;}else{_0x1af68a=0xce;}_0x294a9a[_0x6bd2('0x29')](_0x1af68a);return _0x294a9a['set'](_0x6bd2('0x30'),_0x145872+'-'+_0x346761+'/'+_0x2e8272)['json'](_0x2d2267);}return null;};}function patchUpdates(_0x237d23){return function(_0x3b94f6){try{jsonpatch['apply'](_0x3b94f6,_0x237d23,!![]);}catch(_0x3a5041){return BPromise['reject'](_0x3a5041);}return _0x3b94f6['save']();};}function saveUpdates(_0x496fd2,_0x2c902d){return function(_0x5755fe){if(_0x5755fe){return _0x5755fe[_0x6bd2('0x31')](_0x496fd2)[_0x6bd2('0x32')](function(_0x5392d0){return _0x5392d0;});}return null;};}function removeEntity(_0x30e655,_0x5e51eb){return function(_0x56348d){if(_0x56348d){return _0x56348d['destroy']()[_0x6bd2('0x32')](function(){var _0x51cb3a=_0x56348d[_0x6bd2('0x33')]({'plain':!![]});var _0x274aca=_0x6bd2('0x34');return db['UserProfileResource'][_0x6bd2('0x35')]({'where':{'type':_0x274aca,'resourceId':_0x51cb3a['id']}})['then'](function(){return _0x56348d;});})[_0x6bd2('0x32')](function(){_0x30e655[_0x6bd2('0x29')](0xcc)[_0x6bd2('0x2a')]();});}};}function handleEntityNotFound(_0x1e391c,_0x59d4a6){return function(_0xcc38a5){if(!_0xcc38a5){_0x1e391c[_0x6bd2('0x36')](0x194);}return _0xcc38a5;};}function handleError(_0x4bf4ad,_0x24d530){_0x24d530=_0x24d530||0x1f4;return function(_0x26c0a0){logger[_0x6bd2('0x25')](_0x26c0a0[_0x6bd2('0x37')]);if(_0x26c0a0[_0x6bd2('0x38')]){delete _0x26c0a0[_0x6bd2('0x38')];}_0x4bf4ad['status'](_0x24d530)[_0x6bd2('0x39')](_0x26c0a0);};}exports[_0x6bd2('0x3a')]=function(_0x493584,_0x5444d9){var _0x49e58e={},_0x595f7e={},_0x30326d={'count':0x0,'rows':[]};var _0x1129eb=_[_0x6bd2('0x3b')](db[_0x6bd2('0x3c')][_0x6bd2('0x3d')],function(_0x3d9827){return{'name':_0x3d9827[_0x6bd2('0x3e')],'type':_0x3d9827[_0x6bd2('0x3f')]['key']};});_0x595f7e[_0x6bd2('0x40')]=_['map'](_0x1129eb,_0x6bd2('0x38'));_0x595f7e[_0x6bd2('0x41')]=_[_0x6bd2('0x42')](_0x493584[_0x6bd2('0x41')]);_0x595f7e['filters']=_[_0x6bd2('0x43')](_0x595f7e['model'],_0x595f7e[_0x6bd2('0x41')]);_0x49e58e[_0x6bd2('0x44')]=_[_0x6bd2('0x43')](_0x595f7e[_0x6bd2('0x40')],qs['fields'](_0x493584['query'][_0x6bd2('0x45')]));_0x49e58e['attributes']=_0x49e58e['attributes'][_0x6bd2('0x46')]?_0x49e58e['attributes']:_0x595f7e[_0x6bd2('0x40')];if(!_0x493584[_0x6bd2('0x41')][_0x6bd2('0x47')](_0x6bd2('0x48'))){_0x49e58e['limit']=qs['limit'](_0x493584[_0x6bd2('0x41')][_0x6bd2('0x2e')]);_0x49e58e[_0x6bd2('0x2c')]=qs[_0x6bd2('0x2c')](_0x493584[_0x6bd2('0x41')][_0x6bd2('0x2c')]);}_0x49e58e[_0x6bd2('0x49')]=qs[_0x6bd2('0x4a')](_0x493584[_0x6bd2('0x41')][_0x6bd2('0x4a')]);_0x49e58e[_0x6bd2('0x4b')]=qs[_0x6bd2('0x4c')](_['pick'](_0x493584[_0x6bd2('0x41')],_0x595f7e[_0x6bd2('0x4c')]),_0x1129eb);if(_0x493584[_0x6bd2('0x41')]['filter']){_0x49e58e[_0x6bd2('0x4b')]=_[_0x6bd2('0x4d')](_0x49e58e[_0x6bd2('0x4b')],{'$or':_[_0x6bd2('0x3b')](_0x1129eb,function(_0x3cb863){if(_0x3cb863[_0x6bd2('0x3f')]!==_0x6bd2('0x4e')){var _0x5439f5={};_0x5439f5[_0x3cb863[_0x6bd2('0x38')]]={'$like':'%'+_0x493584['query'][_0x6bd2('0x4f')]+'%'};return _0x5439f5;}})});}_0x49e58e=_['merge']({},_0x49e58e,_0x493584['options']);var _0x59f321={'where':_0x49e58e[_0x6bd2('0x4b')]};return db['ChatQueue'][_0x6bd2('0x2f')](_0x59f321)['then'](function(_0x40daa6){_0x30326d[_0x6bd2('0x2f')]=_0x40daa6;if(_0x493584[_0x6bd2('0x41')][_0x6bd2('0x50')]){_0x49e58e[_0x6bd2('0x51')]=[{'all':!![]}];}return db[_0x6bd2('0x3c')][_0x6bd2('0x52')](_0x49e58e);})['then'](function(_0x1a051e){_0x30326d[_0x6bd2('0x53')]=_0x1a051e;return _0x30326d;})[_0x6bd2('0x32')](respondWithFilteredResult(_0x5444d9,_0x49e58e))[_0x6bd2('0x54')](handleError(_0x5444d9,null));};exports[_0x6bd2('0x55')]=function(_0x52d0d0,_0x12048d){var _0x2d0b94={'raw':!![],'where':{'id':_0x52d0d0['params']['id']}},_0x661c2f={};_0x661c2f['model']=_['keys'](db[_0x6bd2('0x3c')][_0x6bd2('0x3d')]);_0x661c2f[_0x6bd2('0x41')]=_['keys'](_0x52d0d0[_0x6bd2('0x41')]);_0x661c2f[_0x6bd2('0x4c')]=_['intersection'](_0x661c2f[_0x6bd2('0x40')],_0x661c2f[_0x6bd2('0x41')]);_0x2d0b94[_0x6bd2('0x44')]=_[_0x6bd2('0x43')](_0x661c2f[_0x6bd2('0x40')],qs[_0x6bd2('0x45')](_0x52d0d0[_0x6bd2('0x41')][_0x6bd2('0x45')]));_0x2d0b94['attributes']=_0x2d0b94[_0x6bd2('0x44')][_0x6bd2('0x46')]?_0x2d0b94[_0x6bd2('0x44')]:_0x661c2f['model'];if(_0x52d0d0[_0x6bd2('0x41')]['includeAll']){_0x2d0b94[_0x6bd2('0x51')]=[{'all':!![]}];}_0x2d0b94=_['merge']({},_0x2d0b94,_0x52d0d0[_0x6bd2('0x56')]);return db[_0x6bd2('0x3c')][_0x6bd2('0x57')](_0x2d0b94)[_0x6bd2('0x32')](handleEntityNotFound(_0x12048d,null))[_0x6bd2('0x32')](respondWithResult(_0x12048d,null))[_0x6bd2('0x54')](handleError(_0x12048d,null));};exports[_0x6bd2('0x58')]=function(_0xed4bde,_0x43d071){return db[_0x6bd2('0x3c')][_0x6bd2('0x58')](_0xed4bde[_0x6bd2('0x59')],{})[_0x6bd2('0x32')](function(_0x43eb64){var _0x289369=_0xed4bde[_0x6bd2('0x5a')][_0x6bd2('0x33')]({'plain':!![]});if(!_0x289369)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x289369[_0x6bd2('0x5b')]==='user'){var _0x109929=_0x43eb64[_0x6bd2('0x33')]({'plain':!![]});var _0x570855='ChatQueues';return db[_0x6bd2('0x5c')][_0x6bd2('0x57')]({'where':{'name':_0x570855,'userProfileId':_0x289369[_0x6bd2('0x5d')]},'raw':!![]})['then'](function(_0x28948a){if(_0x28948a&&_0x28948a[_0x6bd2('0x5e')]===0x0){return db[_0x6bd2('0x5f')]['create']({'name':_0x109929['name'],'resourceId':_0x109929['id'],'type':_0x28948a[_0x6bd2('0x38')],'sectionId':_0x28948a['id']},{})['then'](function(){return _0x43eb64;});}else{return _0x43eb64;}})[_0x6bd2('0x54')](function(_0x462426){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x462426);throw _0x462426;});}return _0x43eb64;})[_0x6bd2('0x32')](respondWithResult(_0x43d071,0xc9))[_0x6bd2('0x54')](handleError(_0x43d071,null));};exports['update']=function(_0x9763f7,_0x5fcf57){if(_0x9763f7['body']['id']){delete _0x9763f7[_0x6bd2('0x59')]['id'];}return db[_0x6bd2('0x3c')][_0x6bd2('0x57')]({'where':{'id':_0x9763f7['params']['id']}})[_0x6bd2('0x32')](handleEntityNotFound(_0x5fcf57,null))[_0x6bd2('0x32')](saveUpdates(_0x9763f7['body'],null))['then'](respondWithResult(_0x5fcf57,null))[_0x6bd2('0x54')](handleError(_0x5fcf57,null));};exports[_0x6bd2('0x35')]=function(_0x5b8ee9,_0x2c36ca){return db[_0x6bd2('0x3c')][_0x6bd2('0x57')]({'where':{'id':_0x5b8ee9['params']['id']}})['then'](handleEntityNotFound(_0x2c36ca,null))[_0x6bd2('0x32')](removeEntity(_0x2c36ca,null))['catch'](handleError(_0x2c36ca,null));};exports[_0x6bd2('0x60')]=function(_0x145d26,_0x35c7d8){return db[_0x6bd2('0x3c')][_0x6bd2('0x60')]()['then'](respondWithResult(_0x35c7d8,null))[_0x6bd2('0x54')](handleError(_0x35c7d8,null));};exports[_0x6bd2('0x61')]=function(_0x1364db,_0x2108c1,_0x35a408){var _0x2b3f52={'raw':!![],'where':{}},_0x4c1825={},_0x45f296;return db[_0x6bd2('0x3c')][_0x6bd2('0x62')]({'where':{'id':_0x1364db[_0x6bd2('0x63')]['id']}})['then'](handleEntityNotFound(_0x2108c1,null))[_0x6bd2('0x32')](function(_0x437bb0){if(_0x437bb0){_0x45f296=_0x437bb0['get']({'plain':!![]});_0x4c1825[_0x6bd2('0x40')]=_[_0x6bd2('0x42')](db[_0x6bd2('0x64')][_0x6bd2('0x3d')]);_0x4c1825[_0x6bd2('0x41')]=_[_0x6bd2('0x42')](_0x1364db[_0x6bd2('0x41')]);_0x4c1825[_0x6bd2('0x4c')]=_[_0x6bd2('0x43')](_0x4c1825[_0x6bd2('0x40')],_0x4c1825[_0x6bd2('0x41')]);_0x2b3f52[_0x6bd2('0x44')]=_[_0x6bd2('0x43')](_0x4c1825['model'],qs['fields'](_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x45')]));_0x2b3f52[_0x6bd2('0x44')]=_0x2b3f52['attributes'][_0x6bd2('0x46')]?_0x2b3f52['attributes']:_0x4c1825[_0x6bd2('0x40')];if(!_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x47')](_0x6bd2('0x48'))){_0x2b3f52[_0x6bd2('0x2e')]=qs['limit'](_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x2e')]);_0x2b3f52[_0x6bd2('0x2c')]=qs[_0x6bd2('0x2c')](_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x2c')]);}_0x2b3f52['order']=qs[_0x6bd2('0x4a')](_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x4a')]);_0x2b3f52[_0x6bd2('0x4b')]=qs[_0x6bd2('0x4c')](_[_0x6bd2('0x65')](_0x1364db[_0x6bd2('0x41')],_0x4c1825[_0x6bd2('0x4c')]));_0x2b3f52[_0x6bd2('0x4b')][_0x6bd2('0x66')]=_0x437bb0['id'];if(_0x1364db['query']['filter']){_0x2b3f52[_0x6bd2('0x4b')]=_[_0x6bd2('0x4d')](_0x2b3f52[_0x6bd2('0x4b')],{'$or':_[_0x6bd2('0x3b')](_0x2b3f52[_0x6bd2('0x44')],function(_0x419206){var _0x5b482d={};_0x5b482d[_0x419206]={'$like':'%'+_0x1364db[_0x6bd2('0x41')][_0x6bd2('0x4f')]+'%'};return _0x5b482d;})});}_0x2b3f52=_['merge']({},_0x2b3f52,_0x1364db[_0x6bd2('0x56')]);return db[_0x6bd2('0x64')]['findAll'](_0x2b3f52);}})[_0x6bd2('0x32')](function(_0x38a880){if(_0x38a880){return db['User'][_0x6bd2('0x67')]({'where':{'id':_['map'](_0x38a880,_0x6bd2('0x68')),'role':_0x6bd2('0x69')},'attributes':['id','name',_0x6bd2('0x6a'),_0x6bd2('0x6b'),_0x6bd2('0x6c')]});}})[_0x6bd2('0x32')](function(_0xa2df7a){if(_0xa2df7a){return{'count':_0xa2df7a[_0x6bd2('0x2f')],'rows':_[_0x6bd2('0x3b')](_0xa2df7a[_0x6bd2('0x53')],function(_0x312f87){return{'membername':_0x312f87['name'],'UserId':_0x312f87['id'],'queue_name':_0x45f296[_0x6bd2('0x38')],'ChatQueueId':_0x45f296['id'],'interface':util[_0x6bd2('0x6d')](_0x6bd2('0x6e'),_0x6bd2('0x6f'),_0x312f87[_0x6bd2('0x38')]),'penalty':0x0,'paused':_0x312f87['chatPause'],'createdAt':_0x312f87[_0x6bd2('0x6c')],'updatedAt':_0x312f87[_0x6bd2('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2108c1,_0x2b3f52))[_0x6bd2('0x54')](handleError(_0x2108c1,null));};exports['getTeams']=function(_0x12ed76,_0x56d981,_0x164445){var _0x82bfd9={};var _0x1655c6={};var _0x5d5dd7;var _0x4b8873;return db[_0x6bd2('0x3c')][_0x6bd2('0x62')]({'where':{'id':_0x12ed76[_0x6bd2('0x63')]['id']}})['then'](handleEntityNotFound(_0x56d981,null))['then'](function(_0x2a1096){if(_0x2a1096){_0x5d5dd7=_0x2a1096;_0x1655c6[_0x6bd2('0x40')]=_[_0x6bd2('0x42')](db[_0x6bd2('0x70')][_0x6bd2('0x3d')]);_0x1655c6[_0x6bd2('0x41')]=_[_0x6bd2('0x42')](_0x12ed76['query']);_0x1655c6[_0x6bd2('0x4c')]=_[_0x6bd2('0x43')](_0x1655c6[_0x6bd2('0x40')],_0x1655c6[_0x6bd2('0x41')]);_0x82bfd9[_0x6bd2('0x44')]=_[_0x6bd2('0x43')](_0x1655c6[_0x6bd2('0x40')],qs['fields'](_0x12ed76[_0x6bd2('0x41')][_0x6bd2('0x45')]));_0x82bfd9['attributes']=_0x82bfd9['attributes'][_0x6bd2('0x46')]?_0x82bfd9[_0x6bd2('0x44')]:_0x1655c6[_0x6bd2('0x40')];_0x82bfd9[_0x6bd2('0x49')]=qs['sort'](_0x12ed76[_0x6bd2('0x41')][_0x6bd2('0x4a')]);_0x82bfd9['where']=qs['filters'](_[_0x6bd2('0x65')](_0x12ed76['query'],_0x1655c6[_0x6bd2('0x4c')]));if(_0x12ed76[_0x6bd2('0x41')][_0x6bd2('0x4f')]){_0x82bfd9['where']=_[_0x6bd2('0x4d')](_0x82bfd9[_0x6bd2('0x4b')],{'$or':_['map'](_0x82bfd9[_0x6bd2('0x44')],function(_0x286e87){var _0x3643c9={};_0x3643c9[_0x286e87]={'$like':'%'+_0x12ed76['query']['filter']+'%'};return _0x3643c9;})});}_0x82bfd9=_[_0x6bd2('0x4d')]({},_0x82bfd9,_0x12ed76[_0x6bd2('0x56')]);return _0x5d5dd7[_0x6bd2('0x71')](_0x82bfd9);}})[_0x6bd2('0x32')](function(_0x3e31c8){if(_0x3e31c8){_0x4b8873=_0x3e31c8['length'];if(!_0x12ed76[_0x6bd2('0x41')]['hasOwnProperty']('nolimit')){_0x82bfd9[_0x6bd2('0x2e')]=qs[_0x6bd2('0x2e')](_0x12ed76[_0x6bd2('0x41')][_0x6bd2('0x2e')]);_0x82bfd9['offset']=qs[_0x6bd2('0x2c')](_0x12ed76[_0x6bd2('0x41')][_0x6bd2('0x2c')]);}return _0x5d5dd7[_0x6bd2('0x71')](_0x82bfd9);}})['then'](function(_0x11477e){if(_0x11477e){return _0x11477e?{'count':_0x4b8873,'rows':_0x11477e}:null;}})[_0x6bd2('0x32')](respondWithResult(_0x56d981,null))[_0x6bd2('0x54')](handleError(_0x56d981,null));};exports[_0x6bd2('0x72')]=function(_0x41d7e9,_0x336a58,_0x73a824){var _0x1827d4=_0x41d7e9['body'][_0x6bd2('0x73')];return db[_0x6bd2('0x70')][_0x6bd2('0x52')]({'where':{'id':_0x1827d4},'attributes':['id'],'include':[{'model':db[_0x6bd2('0x74')],'as':'Agents','attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x6bd2('0x32')](function(_0xe8d54c){if(_0xe8d54c){var _0x4fcde2=_[_0x6bd2('0x75')](_0xe8d54c,function(_0x45f280){var _0x456e37=_0x45f280[_0x6bd2('0x33')]({'plain':!![]});return _0x456e37[_0x6bd2('0x76')];});return db['ChatQueue'][_0x6bd2('0x57')]({'where':{'id':_0x41d7e9[_0x6bd2('0x63')]['id']}})[_0x6bd2('0x32')](function(_0x25cf81){return db[_0x6bd2('0x77')][_0x6bd2('0x78')](function(_0x3b7be4){return _0x25cf81[_0x6bd2('0x72')](_0x1827d4,{'transaction':_0x3b7be4})[_0x6bd2('0x32')](function(){return BPromise[_0x6bd2('0x79')](_0x4fcde2,function(_0x473a2a){return db[_0x6bd2('0x64')][_0x6bd2('0x7a')]({'where':{'UserId':_0x473a2a['id'],'ChatQueueId':_0x41d7e9['params']['id']},'transaction':_0x3b7be4});});})[_0x6bd2('0x32')](function(){_0x4fcde2['forEach'](function(_0x1c39e5){socket[_0x6bd2('0x7b')](_0x6bd2('0x7c'),{'UserId':_0x1c39e5['id'],'ChatQueueId':_0x25cf81['id']});});});});});}})[_0x6bd2('0x32')](respondWithStatusCode(_0x336a58,null))[_0x6bd2('0x54')](handleError(_0x336a58,null));};exports['removeTeams']=function(_0x1a2a31,_0x3c25ba,_0x33265c){return db[_0x6bd2('0x70')][_0x6bd2('0x52')]({'where':{'id':_0x1a2a31[_0x6bd2('0x41')][_0x6bd2('0x73')]},'attributes':['id'],'include':[{'model':db[_0x6bd2('0x74')],'as':_0x6bd2('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c25ba,null))[_0x6bd2('0x32')](function(_0x4845a4){var _0x446cae=_['map'](_0x4845a4,'id');var _0x27b4c8=[];var _0x4130f7=[];var _0x5d8ed7=squel[_0x6bd2('0x7d')]();_0x5d8ed7[_0x6bd2('0x7e')](_0x6bd2('0x7f'))[_0x6bd2('0x80')](_0x6bd2('0x81'),'tq')[_0x6bd2('0x82')](_0x6bd2('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6bd2('0x4b')](_0x6bd2('0x84'),_0x1a2a31[_0x6bd2('0x63')]['id']);for(var _0x144009=0x0;_0x144009<_0x4845a4['length'];_0x144009+=0x1){let _0x4c5eeb=_0x4845a4[_0x144009];for(var _0x11d18a=0x0;_0x11d18a<_0x4c5eeb[_0x6bd2('0x76')][_0x6bd2('0x46')];_0x11d18a+=0x1){let _0x5c59bd=_0x4c5eeb['Agents'][_0x11d18a];var _0x4a66d4=_0x5d8ed7[_0x6bd2('0x85')]();_0x4a66d4['where']('ut.UserId\x20=\x20?',_0x5c59bd['id']);_0x4130f7['push'](db[_0x6bd2('0x77')][_0x6bd2('0x41')](_0x4a66d4[_0x6bd2('0x86')](),{'type':db[_0x6bd2('0x77')][_0x6bd2('0x87')][_0x6bd2('0x88')]})['then'](function(_0x5abf65){if(_0x5abf65[_0x6bd2('0x46')]===0x1){return _0x5c59bd['id'];}else{var _0x50a75=_['every'](_[_0x6bd2('0x3b')](_0x5abf65,'TeamId'),function(_0x338bdb){return _[_0x6bd2('0x89')](_0x446cae,_0x338bdb);});if(_0x50a75){return _0x5c59bd['id'];}}}));}}return BPromise['all'](_0x4130f7)[_0x6bd2('0x32')](function(_0x4271f9){_0x27b4c8=_(_0x27b4c8)[_0x6bd2('0x8a')](_0x4271f9)['compact']()[_0x6bd2('0x8b')]();return db['ChatQueue'][_0x6bd2('0x57')]({'where':{'id':_0x1a2a31['params']['id']}})[_0x6bd2('0x32')](function(_0x4ba121){return db['sequelize'][_0x6bd2('0x78')](function(_0x420673){return _0x4ba121[_0x6bd2('0x8c')](_0x1a2a31[_0x6bd2('0x41')][_0x6bd2('0x73')],{'transaction':_0x420673})[_0x6bd2('0x32')](function(){if(!_['isEmpty'](_0x27b4c8)){return _0x4ba121['removeAgents'](_0x27b4c8,{'transaction':_0x420673});}})[_0x6bd2('0x32')](function(){_0x27b4c8[_0x6bd2('0x8d')](function(_0x68fb73){socket[_0x6bd2('0x7b')](_0x6bd2('0x8e'),{'UserId':_0x68fb73,'ChatQueueId':_0x4ba121['id']});});});});});});})[_0x6bd2('0x32')](respondWithStatusCode(_0x3c25ba,null))[_0x6bd2('0x54')](handleError(_0x3c25ba,null));};exports[_0x6bd2('0x8f')]=function(_0x1903c1,_0x310866,_0x26610d){return db['ChatQueue'][_0x6bd2('0x57')]({'where':{'id':_0x1903c1['params']['id']}})[_0x6bd2('0x32')](handleEntityNotFound(_0x310866,null))[_0x6bd2('0x32')](function(_0x32f2d2){if(_0x32f2d2){return _0x32f2d2[_0x6bd2('0x8f')](_0x1903c1[_0x6bd2('0x59')][_0x6bd2('0x73')],_[_0x6bd2('0x90')](_0x1903c1[_0x6bd2('0x59')],[_0x6bd2('0x73'),'id'])||{})[_0x6bd2('0x91')](function(_0x14495f){for(var _0x2d75ad=0x0;_0x2d75ad<_0x1903c1[_0x6bd2('0x59')][_0x6bd2('0x73')][_0x6bd2('0x46')];_0x2d75ad+=0x1){socket[_0x6bd2('0x7b')]('userChatQueue:save',{'UserId':Number(_0x1903c1['body']['ids'][_0x2d75ad]),'ChatQueueId':Number(_0x1903c1[_0x6bd2('0x63')]['id'])});}return _0x14495f;});}})[_0x6bd2('0x32')](respondWithResult(_0x310866,null))[_0x6bd2('0x54')](handleError(_0x310866,null));};exports[_0x6bd2('0x92')]=function(_0x11ff46,_0x354ddf,_0x528fdf){return db['ChatQueue'][_0x6bd2('0x57')]({'where':{'id':_0x11ff46[_0x6bd2('0x63')]['id']}})[_0x6bd2('0x32')](handleEntityNotFound(_0x354ddf,null))[_0x6bd2('0x32')](function(_0x3bf5b2){if(_0x3bf5b2){return _0x3bf5b2[_0x6bd2('0x92')](_0x11ff46[_0x6bd2('0x41')][_0x6bd2('0x73')])[_0x6bd2('0x32')](function(){if(_[_0x6bd2('0x93')](_0x11ff46[_0x6bd2('0x41')][_0x6bd2('0x73')])){for(var _0x50c977=0x0;_0x50c977<_0x11ff46['query'][_0x6bd2('0x73')][_0x6bd2('0x46')];_0x50c977+=0x1){socket[_0x6bd2('0x7b')](_0x6bd2('0x8e'),{'UserId':Number(_0x11ff46['query'][_0x6bd2('0x73')][_0x50c977]),'ChatQueueId':Number(_0x11ff46['params']['id'])});}}else{socket[_0x6bd2('0x7b')](_0x6bd2('0x8e'),{'UserId':Number(_0x11ff46[_0x6bd2('0x41')]['ids']),'ChatQueueId':Number(_0x11ff46[_0x6bd2('0x63')]['id'])});}});}})[_0x6bd2('0x32')](respondWithStatusCode(_0x354ddf,null))[_0x6bd2('0x54')](handleError(_0x354ddf,null));};exports['getAgents']=function(_0x581581,_0x5da3f7,_0x550405){var _0x2be5b2={};var _0x4616eb={};var _0x3d941c;var _0x8391bf;return db[_0x6bd2('0x3c')][_0x6bd2('0x62')]({'where':{'id':_0x581581[_0x6bd2('0x63')]['id']}})[_0x6bd2('0x32')](handleEntityNotFound(_0x5da3f7,null))['then'](function(_0x1a7b5c){if(_0x1a7b5c){_0x3d941c=_0x1a7b5c;_0x4616eb[_0x6bd2('0x40')]=_[_0x6bd2('0x42')](db[_0x6bd2('0x74')][_0x6bd2('0x3d')]);_0x4616eb[_0x6bd2('0x41')]=_[_0x6bd2('0x42')](_0x581581[_0x6bd2('0x41')]);_0x4616eb['filters']=_['intersection'](_0x4616eb['model'],_0x4616eb[_0x6bd2('0x41')]);_0x2be5b2[_0x6bd2('0x44')]=_[_0x6bd2('0x43')](_0x4616eb[_0x6bd2('0x40')],qs[_0x6bd2('0x45')](_0x581581['query']['fields']));_0x2be5b2[_0x6bd2('0x44')]=_0x2be5b2['attributes'][_0x6bd2('0x46')]?_0x2be5b2[_0x6bd2('0x44')]:_0x4616eb[_0x6bd2('0x40')];_0x2be5b2[_0x6bd2('0x49')]=qs[_0x6bd2('0x4a')](_0x581581[_0x6bd2('0x41')][_0x6bd2('0x4a')]);_0x2be5b2[_0x6bd2('0x4b')]=qs[_0x6bd2('0x4c')](_['pick'](_0x581581[_0x6bd2('0x41')],_0x4616eb['filters']));if(_0x581581[_0x6bd2('0x41')][_0x6bd2('0x4f')]){_0x2be5b2[_0x6bd2('0x4b')]=_[_0x6bd2('0x4d')](_0x2be5b2[_0x6bd2('0x4b')],{'$or':_['map'](_0x2be5b2[_0x6bd2('0x44')],function(_0x531748){var _0x1818f1={};_0x1818f1[_0x531748]={'$like':'%'+_0x581581[_0x6bd2('0x41')][_0x6bd2('0x4f')]+'%'};return _0x1818f1;})});}_0x2be5b2=_[_0x6bd2('0x4d')]({},_0x2be5b2,_0x581581['options']);return _0x3d941c[_0x6bd2('0x94')](_0x2be5b2);}})['then'](function(_0x14d7de){if(_0x14d7de){_0x8391bf=_0x14d7de[_0x6bd2('0x46')];if(!_0x581581[_0x6bd2('0x41')]['hasOwnProperty'](_0x6bd2('0x48'))){_0x2be5b2[_0x6bd2('0x2e')]=qs[_0x6bd2('0x2e')](_0x581581['query'][_0x6bd2('0x2e')]);_0x2be5b2['offset']=qs[_0x6bd2('0x2c')](_0x581581[_0x6bd2('0x41')]['offset']);}return _0x3d941c[_0x6bd2('0x94')](_0x2be5b2);}})['then'](function(_0x56fa83){if(_0x56fa83){return _0x56fa83?{'count':_0x8391bf,'rows':_0x56fa83}:null;}})[_0x6bd2('0x32')](respondWithResult(_0x5da3f7,null))[_0x6bd2('0x54')](handleError(_0x5da3f7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 5ee714d..02198e2 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 _0x5235=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','update'];(function(_0xeed09a,_0x463e45){var _0x4ce84e=function(_0x3a7d5f){while(--_0x3a7d5f){_0xeed09a['push'](_0xeed09a['shift']());}};_0x4ce84e(++_0x463e45);}(_0x5235,0x17f));var _0x5523=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x5235[_0x557fd2];return _0x1b54a2;};'use strict';var EventEmitter=require(_0x5523('0x0'));var ChatQueue=require(_0x5523('0x1'))['db'][_0x5523('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5523('0x3'),'afterDestroy':_0x5523('0x4')};function emitEvent(_0x3010d4){return function(_0x49207,_0x2137e7,_0x380cbc){ChatQueueEvents[_0x5523('0x5')](_0x3010d4+':'+_0x49207['id'],_0x49207);ChatQueueEvents[_0x5523('0x5')](_0x3010d4,_0x49207);_0x380cbc(null);};}for(var e in events){if(events[_0x5523('0x6')](e)){var event=events[e];ChatQueue[_0x5523('0x7')](e,emitEvent(event));}}module[_0x5523('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x0f4a=['hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','update','remove','emit'];(function(_0x454c12,_0x45c282){var _0x7bb4dc=function(_0x585c87){while(--_0x585c87){_0x454c12['push'](_0x454c12['shift']());}};_0x7bb4dc(++_0x45c282);}(_0x0f4a,0x185));var _0xa0f4=function(_0x3c33a8,_0x211e5d){_0x3c33a8=_0x3c33a8-0x0;var _0x155ba4=_0x0f4a[_0x3c33a8];return _0x155ba4;};'use strict';var EventEmitter=require(_0xa0f4('0x0'));var ChatQueue=require(_0xa0f4('0x1'))['db'][_0xa0f4('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa0f4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa0f4('0x4'),'afterDestroy':_0xa0f4('0x5')};function emitEvent(_0x36cfe8){return function(_0x12172a,_0x50ecc5,_0x4ecad8){ChatQueueEvents['emit'](_0x36cfe8+':'+_0x12172a['id'],_0x12172a);ChatQueueEvents[_0xa0f4('0x6')](_0x36cfe8,_0x12172a);_0x4ecad8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xa0f4('0x7')](e,emitEvent(event));}}module[_0xa0f4('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index fca6956..6a4fb34 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 _0x8c3c=['exports','define','ChatQueue','chat_queues','util','../../config/logger','api','moment','request-promise','../../config/environment','./chatQueue.attributes'];(function(_0x157cd0,_0x1d901c){var _0x8db02f=function(_0x3d363e){while(--_0x3d363e){_0x157cd0['push'](_0x157cd0['shift']());}};_0x8db02f(++_0x1d901c);}(_0x8c3c,0xd5));var _0xc8c3=function(_0x3140bf,_0x4e62c9){_0x3140bf=_0x3140bf-0x0;var _0x1e9044=_0x8c3c[_0x3140bf];return _0x1e9044;};'use strict';var _=require('lodash');var util=require(_0xc8c3('0x0'));var logger=require(_0xc8c3('0x1'))(_0xc8c3('0x2'));var moment=require(_0xc8c3('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8c3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc8c3('0x5'));var attributes=require(_0xc8c3('0x6'));module[_0xc8c3('0x7')]=function(_0x3ede0d,_0x216f62){return _0x3ede0d[_0xc8c3('0x8')](_0xc8c3('0x9'),attributes,{'tableName':_0xc8c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb0=['./chatQueue.attributes','exports','define','chat_queues','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x5bfa44,_0x76dacc){var _0x43815f=function(_0x307fca){while(--_0x307fca){_0x5bfa44['push'](_0x5bfa44['shift']());}};_0x43815f(++_0x76dacc);}(_0x2fb0,0x93));var _0x02fb=function(_0x30ae7b,_0x3a718f){_0x30ae7b=_0x30ae7b-0x0;var _0xa9d0cf=_0x2fb0[_0x30ae7b];return _0xa9d0cf;};'use strict';var _=require(_0x02fb('0x0'));var util=require(_0x02fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x02fb('0x2'));var BPromise=require(_0x02fb('0x3'));var rp=require(_0x02fb('0x4'));var fs=require('fs');var path=require(_0x02fb('0x5'));var rimraf=require(_0x02fb('0x6'));var config=require('../../config/environment');var attributes=require(_0x02fb('0x7'));module[_0x02fb('0x8')]=function(_0x2f3e96,_0x3cc74d){return _0x2f3e96[_0x02fb('0x9')]('ChatQueue',attributes,{'tableName':_0x02fb('0xa'),'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 eb125f6..ae66d06 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 _0x8d41=['redis','defaults','localhost','socket.io-emitter','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatQueue','findAll','options','raw','where','include','map','attributes','model','then','ShowChatQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x282fb4,_0x1e51cd){var _0x5cde2f=function(_0x511c5c){while(--_0x511c5c){_0x282fb4['push'](_0x282fb4['shift']());}};_0x5cde2f(++_0x1e51cd);}(_0x8d41,0x12c));var _0x18d4=function(_0x20bc66,_0x2aef37){_0x20bc66=_0x20bc66-0x0;var _0x3c1b3c=_0x8d41[_0x20bc66];return _0x3c1b3c;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var Redis=require(_0x18d4('0x5'));var db=require(_0x18d4('0x6'))['db'];var utils=require(_0x18d4('0x7'));var logger=require(_0x18d4('0x8'))(_0x18d4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});config[_0x18d4('0xc')]=_[_0x18d4('0xd')](config[_0x18d4('0xc')],{'host':_0x18d4('0xe'),'port':0x18eb});var socket=require(_0x18d4('0xf'))(new Redis(config[_0x18d4('0xc')]));require('./chatQueue.socket')[_0x18d4('0x10')](socket);function respondWithRpcPromise(_0x569248,_0x36e753,_0x493bf9){return new BPromise(function(_0x1a6522,_0x4aabf8){return client['request'](_0x569248,_0x493bf9)['then'](function(_0x4e2665){logger[_0x18d4('0x11')](_0x18d4('0x12'),_0x36e753,_0x18d4('0x13'));logger[_0x18d4('0x14')](_0x18d4('0x15'),_0x36e753,_0x18d4('0x13'),JSON['stringify'](_0x4e2665));if(_0x4e2665[_0x18d4('0x16')]){if(_0x4e2665[_0x18d4('0x16')]['code']===0x1f4){logger[_0x18d4('0x16')]('ChatQueue,\x20%s,\x20%s',_0x36e753,_0x4e2665['error'][_0x18d4('0x17')]);return _0x4aabf8(_0x4e2665[_0x18d4('0x16')][_0x18d4('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x36e753,_0x4e2665[_0x18d4('0x16')]['message']);return _0x1a6522(_0x4e2665['error']['message']);}else{logger[_0x18d4('0x11')]('ChatQueue,\x20%s,\x20%s',_0x36e753,_0x18d4('0x13'));_0x1a6522(_0x4e2665[_0x18d4('0x18')][_0x18d4('0x17')]);}})[_0x18d4('0x19')](function(_0x139c5b){logger[_0x18d4('0x16')](_0x18d4('0x12'),_0x36e753,_0x139c5b);_0x4aabf8(_0x139c5b);});});}exports['GetChatQueue']=function(_0x1a5121){var _0x3b58bd=this;return new Promise(function(_0x2d07dd,_0x370fd0){return db[_0x18d4('0x1a')][_0x18d4('0x1b')]({'raw':_0x1a5121[_0x18d4('0x1c')]?_0x1a5121[_0x18d4('0x1c')][_0x18d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a5121['options']?_0x1a5121[_0x18d4('0x1c')][_0x18d4('0x1e')]||null:null,'attributes':_0x1a5121[_0x18d4('0x1c')]?_0x1a5121[_0x18d4('0x1c')]['attributes']||null:null,'limit':_0x1a5121[_0x18d4('0x1c')]?_0x1a5121[_0x18d4('0x1c')]['limit']||null:null,'include':_0x1a5121[_0x18d4('0x1c')]?_0x1a5121[_0x18d4('0x1c')][_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x1a5121[_0x18d4('0x1c')][_0x18d4('0x1f')],function(_0x4bb22a){return{'model':db[_0x4bb22a['model']],'as':_0x4bb22a['as'],'attributes':_0x4bb22a[_0x18d4('0x21')],'include':_0x4bb22a[_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x4bb22a[_0x18d4('0x1f')],function(_0x4de81a){return{'model':db[_0x4de81a[_0x18d4('0x22')]],'as':_0x4de81a['as'],'attributes':_0x4de81a[_0x18d4('0x21')],'include':_0x4de81a[_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x4de81a[_0x18d4('0x1f')],function(_0x43cf79){return{'model':db[_0x43cf79[_0x18d4('0x22')]],'as':_0x43cf79['as'],'attributes':_0x43cf79[_0x18d4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x18d4('0x23')](function(_0x3ff051){logger[_0x18d4('0x11')]('GetChatQueue',_0x1a5121);logger[_0x18d4('0x14')]('GetChatQueue',_0x1a5121,JSON['stringify'](_0x3ff051));_0x2d07dd(_0x3ff051);})[_0x18d4('0x19')](function(_0x23b42e){logger[_0x18d4('0x16')]('GetChatQueue',_0x23b42e[_0x18d4('0x17')],_0x1a5121);_0x370fd0(_0x3b58bd[_0x18d4('0x16')](0x1f4,_0x23b42e[_0x18d4('0x17')]));});});};exports[_0x18d4('0x24')]=function(_0x207870){var _0xce52d5=this;return new Promise(function(_0x520ee4,_0x14672c){return db[_0x18d4('0x1a')][_0x18d4('0x25')]({'raw':_0x207870['options']?_0x207870['options'][_0x18d4('0x1d')]===undefined?!![]:![]:!![],'where':_0x207870[_0x18d4('0x1c')]?_0x207870[_0x18d4('0x1c')]['where']||null:null,'attributes':_0x207870[_0x18d4('0x1c')]?_0x207870[_0x18d4('0x1c')][_0x18d4('0x21')]||null:null,'include':_0x207870['options']?_0x207870[_0x18d4('0x1c')][_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x207870[_0x18d4('0x1c')][_0x18d4('0x1f')],function(_0x4f7444){return{'model':db[_0x4f7444[_0x18d4('0x22')]],'as':_0x4f7444['as'],'attributes':_0x4f7444[_0x18d4('0x21')],'include':_0x4f7444[_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x4f7444[_0x18d4('0x1f')],function(_0x586ba3){return{'model':db[_0x586ba3['model']],'as':_0x586ba3['as'],'attributes':_0x586ba3['attributes'],'include':_0x586ba3[_0x18d4('0x1f')]?_[_0x18d4('0x20')](_0x586ba3[_0x18d4('0x1f')],function(_0x134e07){return{'model':db[_0x134e07[_0x18d4('0x22')]],'as':_0x134e07['as'],'attributes':_0x134e07[_0x18d4('0x21')]};}):[]};}):[]};}):[]:[]})[_0x18d4('0x23')](function(_0x47d534){logger[_0x18d4('0x11')]('ShowChatQueue',_0x207870);logger['debug']('ShowChatQueue',_0x207870,JSON[_0x18d4('0x26')](_0x47d534));_0x520ee4(_0x47d534);})[_0x18d4('0x19')](function(_0x2c5d0b){logger[_0x18d4('0x16')](_0x18d4('0x24'),_0x2c5d0b[_0x18d4('0x17')],_0x207870);_0x14672c(_0xce52d5[_0x18d4('0x16')](0x1f4,_0x2c5d0b['message']));});});}; \ No newline at end of file +var _0x04d5=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetChatQueue','findAll','options','raw','attributes','include','map','ShowChatQueue','ChatQueue','find','where','model','lodash','util','bluebird'];(function(_0x512aa7,_0x2be0d9){var _0x952539=function(_0x2d63d4){while(--_0x2d63d4){_0x512aa7['push'](_0x512aa7['shift']());}};_0x952539(++_0x2be0d9);}(_0x04d5,0xe1));var _0x504d=function(_0x32bc71,_0x485e3e){_0x32bc71=_0x32bc71-0x0;var _0x49141c=_0x04d5[_0x32bc71];return _0x49141c;};'use strict';var _=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var moment=require('moment');var BPromise=require(_0x504d('0x2'));var rs=require(_0x504d('0x3'));var fs=require('fs');var Redis=require(_0x504d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x504d('0x5'));var logger=require(_0x504d('0x6'))(_0x504d('0x7'));var config=require(_0x504d('0x8'));var jayson=require(_0x504d('0x9'));var client=jayson['client'][_0x504d('0xa')]({'port':0x232a});config[_0x504d('0xb')]=_[_0x504d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x504d('0xd'))(new Redis(config[_0x504d('0xb')]));require(_0x504d('0xe'))['register'](socket);function respondWithRpcPromise(_0x155164,_0x3f0070,_0x10a7bd){return new BPromise(function(_0x378754,_0x49eb92){return client[_0x504d('0xf')](_0x155164,_0x10a7bd)[_0x504d('0x10')](function(_0x39a87e){logger[_0x504d('0x11')](_0x504d('0x12'),_0x3f0070,_0x504d('0x13'));logger[_0x504d('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x3f0070,'request\x20sent',JSON[_0x504d('0x15')](_0x39a87e));if(_0x39a87e[_0x504d('0x16')]){if(_0x39a87e[_0x504d('0x16')][_0x504d('0x17')]===0x1f4){logger[_0x504d('0x16')](_0x504d('0x12'),_0x3f0070,_0x39a87e['error'][_0x504d('0x18')]);return _0x49eb92(_0x39a87e['error'][_0x504d('0x18')]);}logger[_0x504d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x3f0070,_0x39a87e[_0x504d('0x16')][_0x504d('0x18')]);return _0x378754(_0x39a87e[_0x504d('0x16')][_0x504d('0x18')]);}else{logger[_0x504d('0x11')]('ChatQueue,\x20%s,\x20%s',_0x3f0070,_0x504d('0x13'));_0x378754(_0x39a87e['result'][_0x504d('0x18')]);}})[_0x504d('0x19')](function(_0x11c9b1){logger['error'](_0x504d('0x12'),_0x3f0070,_0x11c9b1);_0x49eb92(_0x11c9b1);});});}exports[_0x504d('0x1a')]=function(_0x19effc){var _0x35170c=this;return new Promise(function(_0x41771e,_0x5c5374){return db['ChatQueue'][_0x504d('0x1b')]({'raw':_0x19effc['options']?_0x19effc[_0x504d('0x1c')][_0x504d('0x1d')]===undefined?!![]:![]:!![],'where':_0x19effc['options']?_0x19effc[_0x504d('0x1c')]['where']||null:null,'attributes':_0x19effc[_0x504d('0x1c')]?_0x19effc[_0x504d('0x1c')][_0x504d('0x1e')]||null:null,'limit':_0x19effc['options']?_0x19effc[_0x504d('0x1c')]['limit']||null:null,'include':_0x19effc['options']?_0x19effc[_0x504d('0x1c')][_0x504d('0x1f')]?_['map'](_0x19effc['options'][_0x504d('0x1f')],function(_0x251284){return{'model':db[_0x251284['model']],'as':_0x251284['as'],'attributes':_0x251284[_0x504d('0x1e')],'include':_0x251284[_0x504d('0x1f')]?_[_0x504d('0x20')](_0x251284[_0x504d('0x1f')],function(_0x358742){return{'model':db[_0x358742['model']],'as':_0x358742['as'],'attributes':_0x358742[_0x504d('0x1e')],'include':_0x358742[_0x504d('0x1f')]?_[_0x504d('0x20')](_0x358742[_0x504d('0x1f')],function(_0x4a43c7){return{'model':db[_0x4a43c7['model']],'as':_0x4a43c7['as'],'attributes':_0x4a43c7[_0x504d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa4751b){logger['info'](_0x504d('0x1a'),_0x19effc);logger[_0x504d('0x14')](_0x504d('0x1a'),_0x19effc,JSON['stringify'](_0xa4751b));_0x41771e(_0xa4751b);})[_0x504d('0x19')](function(_0x4b0575){logger['error'](_0x504d('0x1a'),_0x4b0575[_0x504d('0x18')],_0x19effc);_0x5c5374(_0x35170c[_0x504d('0x16')](0x1f4,_0x4b0575['message']));});});};exports[_0x504d('0x21')]=function(_0x282976){var _0x56fd2e=this;return new Promise(function(_0x5ea0b7,_0x7ecf47){return db[_0x504d('0x22')][_0x504d('0x23')]({'raw':_0x282976['options']?_0x282976[_0x504d('0x1c')][_0x504d('0x1d')]===undefined?!![]:![]:!![],'where':_0x282976[_0x504d('0x1c')]?_0x282976[_0x504d('0x1c')][_0x504d('0x24')]||null:null,'attributes':_0x282976[_0x504d('0x1c')]?_0x282976[_0x504d('0x1c')][_0x504d('0x1e')]||null:null,'include':_0x282976[_0x504d('0x1c')]?_0x282976['options']['include']?_[_0x504d('0x20')](_0x282976['options'][_0x504d('0x1f')],function(_0x3c881e){return{'model':db[_0x3c881e[_0x504d('0x25')]],'as':_0x3c881e['as'],'attributes':_0x3c881e[_0x504d('0x1e')],'include':_0x3c881e[_0x504d('0x1f')]?_[_0x504d('0x20')](_0x3c881e[_0x504d('0x1f')],function(_0x1f41a1){return{'model':db[_0x1f41a1[_0x504d('0x25')]],'as':_0x1f41a1['as'],'attributes':_0x1f41a1[_0x504d('0x1e')],'include':_0x1f41a1[_0x504d('0x1f')]?_['map'](_0x1f41a1[_0x504d('0x1f')],function(_0x55fbdb){return{'model':db[_0x55fbdb['model']],'as':_0x55fbdb['as'],'attributes':_0x55fbdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x504d('0x10')](function(_0x1e3ee3){logger['info'](_0x504d('0x21'),_0x282976);logger['debug'](_0x504d('0x21'),_0x282976,JSON[_0x504d('0x15')](_0x1e3ee3));_0x5ea0b7(_0x1e3ee3);})['catch'](function(_0x48c3b1){logger[_0x504d('0x16')](_0x504d('0x21'),_0x48c3b1['message'],_0x282976);_0x7ecf47(_0x56fd2e['error'](0x1f4,_0x48c3b1[_0x504d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 9e18513..5e6da75 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 _0xbb53=['length','./chatQueue.events','save','remove','update','emit'];(function(_0x80d433,_0x4b892a){var _0x4f0330=function(_0x3edd78){while(--_0x3edd78){_0x80d433['push'](_0x80d433['shift']());}};_0x4f0330(++_0x4b892a);}(_0xbb53,0x121));var _0x3bb5=function(_0x11a84d,_0x4dbd0e){_0x11a84d=_0x11a84d-0x0;var _0x1e6b48=_0xbb53[_0x11a84d];return _0x1e6b48;};'use strict';var ChatQueueEvents=require(_0x3bb5('0x0'));var events=[_0x3bb5('0x1'),_0x3bb5('0x2'),_0x3bb5('0x3')];function createListener(_0x20c8b6,_0x226d39){return function(_0x414da7){_0x226d39[_0x3bb5('0x4')](_0x20c8b6,_0x414da7);};}function removeListener(_0x83e44b,_0x450d9e){return function(){ChatQueueEvents['removeListener'](_0x83e44b,_0x450d9e);};}exports['register']=function(_0x23f11e){for(var _0x2460b0=0x0,_0x28aa7d=events[_0x3bb5('0x5')];_0x2460b0<_0x28aa7d;_0x2460b0++){var _0x22f92f=events[_0x2460b0];var _0x480f9c=createListener('chatQueue:'+_0x22f92f,_0x23f11e);ChatQueueEvents['on'](_0x22f92f,_0x480f9c);}}; \ No newline at end of file +var _0xc368=['removeListener','register','length','chatQueue:','save','update','emit'];(function(_0x170941,_0x38d105){var _0x50e48d=function(_0x1eb49a){while(--_0x1eb49a){_0x170941['push'](_0x170941['shift']());}};_0x50e48d(++_0x38d105);}(_0xc368,0x7b));var _0x8c36=function(_0x432350,_0x5dcfc0){_0x432350=_0x432350-0x0;var _0x2f5769=_0xc368[_0x432350];return _0x2f5769;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8c36('0x0'),'remove',_0x8c36('0x1')];function createListener(_0x17fa33,_0x20e697){return function(_0x2640c5){_0x20e697[_0x8c36('0x2')](_0x17fa33,_0x2640c5);};}function removeListener(_0x5d3b27,_0x3e9034){return function(){ChatQueueEvents[_0x8c36('0x3')](_0x5d3b27,_0x3e9034);};}exports[_0x8c36('0x4')]=function(_0x1d3660){for(var _0x5ebfc1=0x0,_0x554022=events[_0x8c36('0x5')];_0x5ebfc1<_0x554022;_0x5ebfc1++){var _0x384867=events[_0x5ebfc1];var _0x3e76be=createListener(_0x8c36('0x6')+_0x384867,_0x1d3660);ChatQueueEvents['on'](_0x384867,_0x3e76be);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index d08ee9f..c4a37ce 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x343150,_0x42790d){var _0x2a53bf=function(_0x30918b){while(--_0x30918b){_0x343150['push'](_0x343150['shift']());}};_0x2a53bf(++_0x42790d);}(_0xe14b,0x93));var _0xbe14=function(_0x547cc7,_0x5bc633){_0x547cc7=_0x547cc7-0x0;var _0xe08257=_0xe14b[_0x547cc7];return _0xe08257;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x4c4220,_0x5e8b5d){var _0x244cab=function(_0x3abee8){while(--_0x3abee8){_0x4c4220['push'](_0x4c4220['shift']());}};_0x244cab(++_0x5e8b5d);}(_0x55ca,0x126));var _0xa55c=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x55ca[_0x2d8d69];return _0x39ae22;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index dfc7314..f0c8faa 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 _0xcc20=['moment','sequelize','STRING','DATE'];(function(_0x53f4f5,_0x5bf96c){var _0x151d12=function(_0x4ac5b4){while(--_0x4ac5b4){_0x53f4f5['push'](_0x53f4f5['shift']());}};_0x151d12(++_0x5bf96c);}(_0xcc20,0x108));var _0x0cc2=function(_0x9b3c11,_0x26fe93){_0x9b3c11=_0x9b3c11-0x0;var _0x4354c4=_0xcc20[_0x9b3c11];return _0x4354c4;};'use strict';var moment=require(_0x0cc2('0x0'));var Sequelize=require(_0x0cc2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0cc2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0cc2('0x2')]},'joinAt':{'type':Sequelize[_0x0cc2('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x0cc2('0x3')]},'exitAt':{'type':Sequelize[_0x0cc2('0x3')]},'reason':{'type':Sequelize[_0x0cc2('0x2')]}}; \ No newline at end of file +var _0x7709=['sequelize','exports','STRING','DATE'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x7709,0x190));var _0x9770=function(_0x155638,_0x5ccf77){_0x155638=_0x155638-0x0;var _0xe19618=_0x7709[_0x155638];return _0xe19618;};'use strict';var moment=require('moment');var Sequelize=require(_0x9770('0x0'));module[_0x9770('0x1')]={'uniqueid':{'type':Sequelize[_0x9770('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9770('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9770('0x3')]},'exitAt':{'type':Sequelize[_0x9770('0x3')]},'reason':{'type':Sequelize[_0x9770('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f76f942..c93773d 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 _0xe9e7=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','end','stack','name','index','map','ChatQueueReport','rawAttributes','type','model','keys','query','attributes','intersection','fields','length','nolimit','order','sort','pick','filters','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0xe9c8ff,_0x399465){var _0x8d9747=function(_0x1ce098){while(--_0x1ce098){_0xe9c8ff['push'](_0xe9c8ff['shift']());}};_0x8d9747(++_0x399465);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x548ce3,_0x1b1720){_0x548ce3=_0x548ce3-0x0;var _0x33b85b=_0xe9e7[_0x548ce3];return _0x33b85b;};'use strict';var emlformat=require(_0x7e9e('0x0'));var rimraf=require(_0x7e9e('0x1'));var zipdir=require(_0x7e9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e9e('0x3'));var moment=require(_0x7e9e('0x4'));var BPromise=require(_0x7e9e('0x5'));var Mustache=require(_0x7e9e('0x6'));var util=require(_0x7e9e('0x7'));var path=require(_0x7e9e('0x8'));var sox=require(_0x7e9e('0x9'));var csv=require('to-csv');var ejs=require(_0x7e9e('0xa'));var fs=require('fs');var fs_extra=require(_0x7e9e('0xb'));var _=require(_0x7e9e('0xc'));var squel=require('squel');var crypto=require(_0x7e9e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7e9e('0xe'));var toCsv=require(_0x7e9e('0xf'));var querystring=require(_0x7e9e('0x10'));var Papa=require(_0x7e9e('0x11'));var Redis=require(_0x7e9e('0x12'));var authService=require(_0x7e9e('0x13'));var qs=require(_0x7e9e('0x14'));var as=require(_0x7e9e('0x15'));var hardwareService=require(_0x7e9e('0x16'));var logger=require(_0x7e9e('0x17'))(_0x7e9e('0x18'));var utils=require(_0x7e9e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa5db58,_0x356d5c){_0x356d5c=_0x356d5c||0xcc;return function(_0x245c50){if(_0x245c50){return _0xa5db58[_0x7e9e('0x1a')](_0x356d5c);}return _0xa5db58['status'](_0x356d5c)['end']();};}function respondWithResult(_0x2d8de4,_0x46f30d){_0x46f30d=_0x46f30d||0xc8;return function(_0x1b59d1){if(_0x1b59d1){return _0x2d8de4[_0x7e9e('0x1b')](_0x46f30d)[_0x7e9e('0x1c')](_0x1b59d1);}};}function respondWithFilteredResult(_0x89bb24,_0x2cf803){return function(_0x5bf42b){if(_0x5bf42b){var _0x428312=typeof _0x2cf803['offset']===_0x7e9e('0x1d')&&typeof _0x2cf803[_0x7e9e('0x1e')]===_0x7e9e('0x1d');var _0x1d973c=_0x5bf42b[_0x7e9e('0x1f')];var _0x11f414=_0x428312?0x0:_0x2cf803[_0x7e9e('0x20')];var _0x5a2a77=_0x428312?_0x5bf42b[_0x7e9e('0x1f')]:_0x2cf803[_0x7e9e('0x20')]+_0x2cf803['limit'];var _0x52358b;if(_0x5a2a77>=_0x1d973c){_0x5a2a77=_0x1d973c;_0x52358b=0xc8;}else{_0x52358b=0xce;}_0x89bb24[_0x7e9e('0x1b')](_0x52358b);return _0x89bb24['set']('Content-Range',_0x11f414+'-'+_0x5a2a77+'/'+_0x1d973c)[_0x7e9e('0x1c')](_0x5bf42b);}return null;};}function patchUpdates(_0x5f554d){return function(_0x35914e){try{jsonpatch[_0x7e9e('0x21')](_0x35914e,_0x5f554d,!![]);}catch(_0x2654d3){return BPromise[_0x7e9e('0x22')](_0x2654d3);}return _0x35914e[_0x7e9e('0x23')]();};}function saveUpdates(_0x206062,_0x18c975){return function(_0x5206df){if(_0x5206df){return _0x5206df[_0x7e9e('0x24')](_0x206062)[_0x7e9e('0x25')](function(_0x1dc4c9){return _0x1dc4c9;});}return null;};}function removeEntity(_0x46bc6c,_0x523e5f){return function(_0x15bb40){if(_0x15bb40){return _0x15bb40[_0x7e9e('0x26')]()[_0x7e9e('0x25')](function(){_0x46bc6c[_0x7e9e('0x1b')](0xcc)[_0x7e9e('0x27')]();});}};}function handleEntityNotFound(_0xeaa799,_0x3df586){return function(_0x54f7b5){if(!_0x54f7b5){_0xeaa799[_0x7e9e('0x1a')](0x194);}return _0x54f7b5;};}function handleError(_0x1e1b1d,_0x1eff4d){_0x1eff4d=_0x1eff4d||0x1f4;return function(_0x3ca0b5){logger['error'](_0x3ca0b5[_0x7e9e('0x28')]);if(_0x3ca0b5[_0x7e9e('0x29')]){delete _0x3ca0b5[_0x7e9e('0x29')];}_0x1e1b1d[_0x7e9e('0x1b')](_0x1eff4d)['send'](_0x3ca0b5);};}exports[_0x7e9e('0x2a')]=function(_0x5da39e,_0xe5b8ef){var _0x266b4a={},_0x1726e9={},_0x203415={'count':0x0,'rows':[]};var _0x12de96=_[_0x7e9e('0x2b')](db[_0x7e9e('0x2c')][_0x7e9e('0x2d')],function(_0x52634e){return{'name':_0x52634e['fieldName'],'type':_0x52634e[_0x7e9e('0x2e')]['key']};});_0x1726e9[_0x7e9e('0x2f')]=_[_0x7e9e('0x2b')](_0x12de96,'name');_0x1726e9['query']=_[_0x7e9e('0x30')](_0x5da39e[_0x7e9e('0x31')]);_0x1726e9['filters']=_['intersection'](_0x1726e9[_0x7e9e('0x2f')],_0x1726e9['query']);_0x266b4a[_0x7e9e('0x32')]=_[_0x7e9e('0x33')](_0x1726e9['model'],qs[_0x7e9e('0x34')](_0x5da39e[_0x7e9e('0x31')]['fields']));_0x266b4a[_0x7e9e('0x32')]=_0x266b4a[_0x7e9e('0x32')][_0x7e9e('0x35')]?_0x266b4a[_0x7e9e('0x32')]:_0x1726e9['model'];if(!_0x5da39e[_0x7e9e('0x31')]['hasOwnProperty'](_0x7e9e('0x36'))){_0x266b4a[_0x7e9e('0x1e')]=qs[_0x7e9e('0x1e')](_0x5da39e[_0x7e9e('0x31')][_0x7e9e('0x1e')]);_0x266b4a[_0x7e9e('0x20')]=qs['offset'](_0x5da39e[_0x7e9e('0x31')]['offset']);}_0x266b4a[_0x7e9e('0x37')]=qs[_0x7e9e('0x38')](_0x5da39e[_0x7e9e('0x31')]['sort']);_0x266b4a['where']=qs['filters'](_[_0x7e9e('0x39')](_0x5da39e[_0x7e9e('0x31')],_0x1726e9[_0x7e9e('0x3a')]),_0x12de96);if(_0x5da39e[_0x7e9e('0x31')]['filter']){_0x266b4a[_0x7e9e('0x3b')]=_['merge'](_0x266b4a['where'],{'$or':_[_0x7e9e('0x2b')](_0x12de96,function(_0xf1ae0f){if(_0xf1ae0f[_0x7e9e('0x2e')]!=='VIRTUAL'){var _0x46fe7e={};_0x46fe7e[_0xf1ae0f[_0x7e9e('0x29')]]={'$like':'%'+_0x5da39e[_0x7e9e('0x31')]['filter']+'%'};return _0x46fe7e;}})});}_0x266b4a=_[_0x7e9e('0x3c')]({},_0x266b4a,_0x5da39e[_0x7e9e('0x3d')]);var _0x2651b2={'where':_0x266b4a[_0x7e9e('0x3b')]};return db[_0x7e9e('0x2c')]['count'](_0x2651b2)['then'](function(_0x229ecf){_0x203415[_0x7e9e('0x1f')]=_0x229ecf;if(_0x5da39e['query'][_0x7e9e('0x3e')]){_0x266b4a[_0x7e9e('0x3f')]=[{'all':!![]}];}return db[_0x7e9e('0x2c')][_0x7e9e('0x40')](_0x266b4a);})['then'](function(_0x11af9f){_0x203415[_0x7e9e('0x41')]=_0x11af9f;return _0x203415;})['then'](respondWithFilteredResult(_0xe5b8ef,_0x266b4a))[_0x7e9e('0x42')](handleError(_0xe5b8ef,null));};exports[_0x7e9e('0x43')]=function(_0x65e8cc,_0x1f8c78){var _0x4e8ef3={'raw':!![],'where':{'id':_0x65e8cc[_0x7e9e('0x44')]['id']}},_0x5337a8={};_0x5337a8[_0x7e9e('0x2f')]=_[_0x7e9e('0x30')](db[_0x7e9e('0x2c')]['rawAttributes']);_0x5337a8[_0x7e9e('0x31')]=_[_0x7e9e('0x30')](_0x65e8cc[_0x7e9e('0x31')]);_0x5337a8[_0x7e9e('0x3a')]=_['intersection'](_0x5337a8['model'],_0x5337a8['query']);_0x4e8ef3[_0x7e9e('0x32')]=_[_0x7e9e('0x33')](_0x5337a8[_0x7e9e('0x2f')],qs[_0x7e9e('0x34')](_0x65e8cc[_0x7e9e('0x31')][_0x7e9e('0x34')]));_0x4e8ef3[_0x7e9e('0x32')]=_0x4e8ef3['attributes'][_0x7e9e('0x35')]?_0x4e8ef3[_0x7e9e('0x32')]:_0x5337a8[_0x7e9e('0x2f')];if(_0x65e8cc['query']['includeAll']){_0x4e8ef3[_0x7e9e('0x3f')]=[{'all':!![]}];}_0x4e8ef3=_[_0x7e9e('0x3c')]({},_0x4e8ef3,_0x65e8cc[_0x7e9e('0x3d')]);return db[_0x7e9e('0x2c')][_0x7e9e('0x45')](_0x4e8ef3)[_0x7e9e('0x25')](handleEntityNotFound(_0x1f8c78,null))[_0x7e9e('0x25')](respondWithResult(_0x1f8c78,null))[_0x7e9e('0x42')](handleError(_0x1f8c78,null));};exports[_0x7e9e('0x46')]=function(_0x383f75,_0x27941c){return db[_0x7e9e('0x2c')][_0x7e9e('0x46')](_0x383f75['body'],{})[_0x7e9e('0x25')](respondWithResult(_0x27941c,0xc9))[_0x7e9e('0x42')](handleError(_0x27941c,null));};exports[_0x7e9e('0x24')]=function(_0x26dc29,_0x284750){if(_0x26dc29[_0x7e9e('0x47')]['id']){delete _0x26dc29[_0x7e9e('0x47')]['id'];}return db[_0x7e9e('0x2c')][_0x7e9e('0x45')]({'where':{'id':_0x26dc29[_0x7e9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x284750,null))[_0x7e9e('0x25')](saveUpdates(_0x26dc29[_0x7e9e('0x47')],null))['then'](respondWithResult(_0x284750,null))[_0x7e9e('0x42')](handleError(_0x284750,null));};exports[_0x7e9e('0x26')]=function(_0x23f476,_0x36c782){return db[_0x7e9e('0x2c')][_0x7e9e('0x45')]({'where':{'id':_0x23f476[_0x7e9e('0x44')]['id']}})[_0x7e9e('0x25')](handleEntityNotFound(_0x36c782,null))[_0x7e9e('0x25')](removeEntity(_0x36c782,null))[_0x7e9e('0x42')](handleError(_0x36c782,null));};exports[_0x7e9e('0x48')]=function(_0x568b50,_0x355ad4){return db[_0x7e9e('0x2c')][_0x7e9e('0x48')]()['then'](respondWithResult(_0x355ad4,null))[_0x7e9e('0x42')](handleError(_0x355ad4,null));}; \ No newline at end of file +var _0xfa94=['filter','merge','rows','show','params','length','includeAll','include','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa94,0xef));var _0x4fa9=function(_0x2f92d8,_0x2ef7f4){_0x2f92d8=_0x2f92d8-0x0;var _0x200ef1=_0xfa94[_0x2f92d8];return _0x200ef1;};'use strict';var emlformat=require(_0x4fa9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fa9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fa9('0x2'));var moment=require(_0x4fa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4fa9('0x4'));var util=require(_0x4fa9('0x5'));var path=require(_0x4fa9('0x6'));var sox=require(_0x4fa9('0x7'));var csv=require(_0x4fa9('0x8'));var ejs=require(_0x4fa9('0x9'));var fs=require('fs');var fs_extra=require(_0x4fa9('0xa'));var _=require('lodash');var squel=require(_0x4fa9('0xb'));var crypto=require(_0x4fa9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4fa9('0x8'));var querystring=require('querystring');var Papa=require(_0x4fa9('0xd'));var Redis=require(_0x4fa9('0xe'));var authService=require(_0x4fa9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4fa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fa9('0x11'))(_0x4fa9('0x12'));var utils=require('../../config/utils');var config=require(_0x4fa9('0x13'));var licenseUtil=require(_0x4fa9('0x14'));var db=require(_0x4fa9('0x15'))['db'];function respondWithStatusCode(_0x57df6a,_0x85f1e5){_0x85f1e5=_0x85f1e5||0xcc;return function(_0x54d8c5){if(_0x54d8c5){return _0x57df6a[_0x4fa9('0x16')](_0x85f1e5);}return _0x57df6a[_0x4fa9('0x17')](_0x85f1e5)['end']();};}function respondWithResult(_0x47953e,_0x4279c0){_0x4279c0=_0x4279c0||0xc8;return function(_0x43b71d){if(_0x43b71d){return _0x47953e[_0x4fa9('0x17')](_0x4279c0)[_0x4fa9('0x18')](_0x43b71d);}};}function respondWithFilteredResult(_0x36af3a,_0x438850){return function(_0x2c28be){if(_0x2c28be){var _0x328770=typeof _0x438850['offset']===_0x4fa9('0x19')&&typeof _0x438850[_0x4fa9('0x1a')]==='undefined';var _0x56cf7d=_0x2c28be[_0x4fa9('0x1b')];var _0x4f58bd=_0x328770?0x0:_0x438850[_0x4fa9('0x1c')];var _0x416e08=_0x328770?_0x2c28be['count']:_0x438850[_0x4fa9('0x1c')]+_0x438850['limit'];var _0x3f8036;if(_0x416e08>=_0x56cf7d){_0x416e08=_0x56cf7d;_0x3f8036=0xc8;}else{_0x3f8036=0xce;}_0x36af3a[_0x4fa9('0x17')](_0x3f8036);return _0x36af3a[_0x4fa9('0x1d')](_0x4fa9('0x1e'),_0x4f58bd+'-'+_0x416e08+'/'+_0x56cf7d)[_0x4fa9('0x18')](_0x2c28be);}return null;};}function patchUpdates(_0x5e2576){return function(_0x2e5142){try{jsonpatch[_0x4fa9('0x1f')](_0x2e5142,_0x5e2576,!![]);}catch(_0xa43250){return BPromise['reject'](_0xa43250);}return _0x2e5142[_0x4fa9('0x20')]();};}function saveUpdates(_0x1544b1,_0x31333c){return function(_0x475624){if(_0x475624){return _0x475624[_0x4fa9('0x21')](_0x1544b1)[_0x4fa9('0x22')](function(_0x360262){return _0x360262;});}return null;};}function removeEntity(_0x261db9,_0x185806){return function(_0x1189c6){if(_0x1189c6){return _0x1189c6[_0x4fa9('0x23')]()[_0x4fa9('0x22')](function(){_0x261db9[_0x4fa9('0x17')](0xcc)[_0x4fa9('0x24')]();});}};}function handleEntityNotFound(_0x1d00c9,_0x244c95){return function(_0x1bac66){if(!_0x1bac66){_0x1d00c9[_0x4fa9('0x16')](0x194);}return _0x1bac66;};}function handleError(_0x1fe8ba,_0x31a3fb){_0x31a3fb=_0x31a3fb||0x1f4;return function(_0x498a6f){logger[_0x4fa9('0x25')](_0x498a6f[_0x4fa9('0x26')]);if(_0x498a6f[_0x4fa9('0x27')]){delete _0x498a6f[_0x4fa9('0x27')];}_0x1fe8ba[_0x4fa9('0x17')](_0x31a3fb)[_0x4fa9('0x28')](_0x498a6f);};}exports[_0x4fa9('0x29')]=function(_0x5545b9,_0x384d4e){var _0x1185df={},_0x13cf76={},_0x383d27={'count':0x0,'rows':[]};var _0x112673=_[_0x4fa9('0x2a')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')],function(_0xa9932f){return{'name':_0xa9932f[_0x4fa9('0x2d')],'type':_0xa9932f[_0x4fa9('0x2e')][_0x4fa9('0x2f')]};});_0x13cf76[_0x4fa9('0x30')]=_[_0x4fa9('0x2a')](_0x112673,_0x4fa9('0x27'));_0x13cf76[_0x4fa9('0x31')]=_[_0x4fa9('0x32')](_0x5545b9['query']);_0x13cf76[_0x4fa9('0x33')]=_[_0x4fa9('0x34')](_0x13cf76[_0x4fa9('0x30')],_0x13cf76[_0x4fa9('0x31')]);_0x1185df[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x13cf76['model'],qs[_0x4fa9('0x36')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x1185df['attributes']=_0x1185df[_0x4fa9('0x35')]['length']?_0x1185df['attributes']:_0x13cf76[_0x4fa9('0x30')];if(!_0x5545b9['query'][_0x4fa9('0x37')](_0x4fa9('0x38'))){_0x1185df[_0x4fa9('0x1a')]=qs[_0x4fa9('0x1a')](_0x5545b9['query'][_0x4fa9('0x1a')]);_0x1185df[_0x4fa9('0x1c')]=qs[_0x4fa9('0x1c')](_0x5545b9['query'][_0x4fa9('0x1c')]);}_0x1185df[_0x4fa9('0x39')]=qs[_0x4fa9('0x3a')](_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3a')]);_0x1185df[_0x4fa9('0x3b')]=qs[_0x4fa9('0x33')](_[_0x4fa9('0x3c')](_0x5545b9[_0x4fa9('0x31')],_0x13cf76[_0x4fa9('0x33')]),_0x112673);if(_0x5545b9[_0x4fa9('0x31')][_0x4fa9('0x3d')]){_0x1185df['where']=_[_0x4fa9('0x3e')](_0x1185df['where'],{'$or':_['map'](_0x112673,function(_0x21578d){if(_0x21578d['type']!=='VIRTUAL'){var _0x4b05a6={};_0x4b05a6[_0x21578d[_0x4fa9('0x27')]]={'$like':'%'+_0x5545b9[_0x4fa9('0x31')]['filter']+'%'};return _0x4b05a6;}})});}_0x1185df=_[_0x4fa9('0x3e')]({},_0x1185df,_0x5545b9['options']);var _0x493c4f={'where':_0x1185df[_0x4fa9('0x3b')]};return db[_0x4fa9('0x2b')][_0x4fa9('0x1b')](_0x493c4f)[_0x4fa9('0x22')](function(_0x167112){_0x383d27[_0x4fa9('0x1b')]=_0x167112;if(_0x5545b9[_0x4fa9('0x31')]['includeAll']){_0x1185df['include']=[{'all':!![]}];}return db[_0x4fa9('0x2b')]['findAll'](_0x1185df);})[_0x4fa9('0x22')](function(_0x19fe0f){_0x383d27[_0x4fa9('0x3f')]=_0x19fe0f;return _0x383d27;})[_0x4fa9('0x22')](respondWithFilteredResult(_0x384d4e,_0x1185df))['catch'](handleError(_0x384d4e,null));};exports[_0x4fa9('0x40')]=function(_0x51e105,_0xd28126){var _0x2c39bf={'raw':!![],'where':{'id':_0x51e105[_0x4fa9('0x41')]['id']}},_0x14eb12={};_0x14eb12[_0x4fa9('0x30')]=_[_0x4fa9('0x32')](db[_0x4fa9('0x2b')][_0x4fa9('0x2c')]);_0x14eb12['query']=_[_0x4fa9('0x32')](_0x51e105[_0x4fa9('0x31')]);_0x14eb12[_0x4fa9('0x33')]=_['intersection'](_0x14eb12[_0x4fa9('0x30')],_0x14eb12[_0x4fa9('0x31')]);_0x2c39bf[_0x4fa9('0x35')]=_[_0x4fa9('0x34')](_0x14eb12[_0x4fa9('0x30')],qs[_0x4fa9('0x36')](_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x36')]));_0x2c39bf[_0x4fa9('0x35')]=_0x2c39bf[_0x4fa9('0x35')][_0x4fa9('0x42')]?_0x2c39bf[_0x4fa9('0x35')]:_0x14eb12['model'];if(_0x51e105[_0x4fa9('0x31')][_0x4fa9('0x43')]){_0x2c39bf[_0x4fa9('0x44')]=[{'all':!![]}];}_0x2c39bf=_[_0x4fa9('0x3e')]({},_0x2c39bf,_0x51e105[_0x4fa9('0x45')]);return db[_0x4fa9('0x2b')][_0x4fa9('0x46')](_0x2c39bf)[_0x4fa9('0x22')](handleEntityNotFound(_0xd28126,null))[_0x4fa9('0x22')](respondWithResult(_0xd28126,null))[_0x4fa9('0x47')](handleError(_0xd28126,null));};exports[_0x4fa9('0x48')]=function(_0x5d3b12,_0x5d838c){return db[_0x4fa9('0x2b')]['create'](_0x5d3b12[_0x4fa9('0x49')],{})[_0x4fa9('0x22')](respondWithResult(_0x5d838c,0xc9))[_0x4fa9('0x47')](handleError(_0x5d838c,null));};exports[_0x4fa9('0x21')]=function(_0x306096,_0x12e735){if(_0x306096['body']['id']){delete _0x306096['body']['id'];}return db['ChatQueueReport'][_0x4fa9('0x46')]({'where':{'id':_0x306096['params']['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x12e735,null))[_0x4fa9('0x22')](saveUpdates(_0x306096[_0x4fa9('0x49')],null))[_0x4fa9('0x22')](respondWithResult(_0x12e735,null))['catch'](handleError(_0x12e735,null));};exports[_0x4fa9('0x23')]=function(_0x463bd4,_0x5cd8d1){return db[_0x4fa9('0x2b')][_0x4fa9('0x46')]({'where':{'id':_0x463bd4[_0x4fa9('0x41')]['id']}})[_0x4fa9('0x22')](handleEntityNotFound(_0x5cd8d1,null))[_0x4fa9('0x22')](removeEntity(_0x5cd8d1,null))[_0x4fa9('0x47')](handleError(_0x5cd8d1,null));};exports['describe']=function(_0x4b8399,_0x23953b){return db['ChatQueueReport'][_0x4fa9('0x4a')]()[_0x4fa9('0x22')](respondWithResult(_0x23953b,null))[_0x4fa9('0x47')](handleError(_0x23953b,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 059073f..f4b43c5 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x2cfc8c,_0x5472df){var _0x1de813=function(_0x580f50){while(--_0x580f50){_0x2cfc8c['push'](_0x2cfc8c['shift']());}};_0x1de813(++_0x5472df);}(_0xe706,0xa3));var _0x6e70=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xe706[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5970b2,_0x4404f){var _0x534c6a=function(_0x23ef8c){while(--_0x23ef8c){_0x5970b2['push'](_0x5970b2['shift']());}};_0x534c6a(++_0x4404f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 5e65e0e..b114212 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 _0xd770=['http','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','ChatQueueReport','create','body','options','raw','catch','CreateChatQueueReport','UpdateChatQueueReport','update','attributes','limit','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x2341c6,_0x3af092){var _0x54c34d=function(_0x3091f9){while(--_0x3091f9){_0x2341c6['push'](_0x2341c6['shift']());}};_0x54c34d(++_0x3af092);}(_0xd770,0x1e5));var _0x0d77=function(_0x1f248f,_0x5f1bc9){_0x1f248f=_0x1f248f-0x0;var _0x375a5a=_0xd770[_0x1f248f];return _0x375a5a;};'use strict';var _=require('lodash');var util=require(_0x0d77('0x0'));var moment=require(_0x0d77('0x1'));var BPromise=require(_0x0d77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d77('0x3'));var db=require(_0x0d77('0x4'))['db'];var utils=require(_0x0d77('0x5'));var logger=require(_0x0d77('0x6'))(_0x0d77('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d77('0x8'));var client=jayson[_0x0d77('0x9')][_0x0d77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x556b15,_0x4ad970,_0x18bb0d){return new BPromise(function(_0x3cede5,_0x60076b){return client[_0x0d77('0xb')](_0x556b15,_0x18bb0d)[_0x0d77('0xc')](function(_0x26668d){logger[_0x0d77('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));logger['debug'](_0x0d77('0xf'),_0x4ad970,'request\x20sent',JSON[_0x0d77('0x10')](_0x26668d));if(_0x26668d['error']){if(_0x26668d[_0x0d77('0x11')]['code']===0x1f4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x60076b(_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);}logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x26668d[_0x0d77('0x11')][_0x0d77('0x13')]);return _0x3cede5(_0x26668d['error']['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x4ad970,_0x0d77('0xe'));_0x3cede5(_0x26668d[_0x0d77('0x14')][_0x0d77('0x13')]);}})['catch'](function(_0x1daff4){logger[_0x0d77('0x11')](_0x0d77('0x12'),_0x4ad970,_0x1daff4);_0x60076b(_0x1daff4);});});}exports['CreateChatQueueReport']=function(_0x380282){var _0x12d0f9=this;return new Promise(function(_0x3f12ab,_0x2e0290){return db[_0x0d77('0x15')][_0x0d77('0x16')](_0x380282[_0x0d77('0x17')],{'raw':_0x380282['options']?_0x380282[_0x0d77('0x18')][_0x0d77('0x19')]===undefined?!![]:![]:!![]})[_0x0d77('0xc')](function(_0x52c0c5){logger[_0x0d77('0xd')]('CreateChatQueueReport',_0x380282);logger['debug']('CreateChatQueueReport',_0x380282,JSON['stringify'](_0x52c0c5));_0x3f12ab(_0x52c0c5);})[_0x0d77('0x1a')](function(_0x49c627){logger[_0x0d77('0x11')](_0x0d77('0x1b'),_0x49c627[_0x0d77('0x13')],_0x380282);_0x2e0290(_0x12d0f9['error'](0x1f4,_0x49c627[_0x0d77('0x13')]));});});};exports[_0x0d77('0x1c')]=function(_0x4fe766){var _0x2c8b85=this;return new Promise(function(_0x54f274,_0x47e25a){return db[_0x0d77('0x15')][_0x0d77('0x1d')](_0x4fe766[_0x0d77('0x17')],{'raw':_0x4fe766[_0x0d77('0x18')]?_0x4fe766['options'][_0x0d77('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fe766['options']?_0x4fe766['options']['where']||null:null,'attributes':_0x4fe766[_0x0d77('0x18')]?_0x4fe766['options'][_0x0d77('0x1e')]||null:null,'limit':_0x4fe766[_0x0d77('0x18')]?_0x4fe766[_0x0d77('0x18')][_0x0d77('0x1f')]||null:null})[_0x0d77('0xc')](function(_0x3e66fc){logger[_0x0d77('0xd')](_0x0d77('0x1c'),_0x4fe766);logger[_0x0d77('0x20')](_0x0d77('0x1c'),_0x4fe766,JSON[_0x0d77('0x10')](_0x3e66fc));_0x54f274(_0x3e66fc);})[_0x0d77('0x1a')](function(_0x43f446){logger['error'](_0x0d77('0x1c'),_0x43f446[_0x0d77('0x13')],_0x4fe766);_0x47e25a(_0x2c8b85['error'](0x1f4,_0x43f446[_0x0d77('0x13')]));});});}; \ No newline at end of file +var _0xaded=['request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','UpdateChatQueueReport','update','body','raw','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x6faba5,_0x3786e6){var _0x391f97=function(_0x4f95f0){while(--_0x4f95f0){_0x6faba5['push'](_0x6faba5['shift']());}};_0x391f97(++_0x3786e6);}(_0xaded,0x7a));var _0xdade=function(_0x158ded,_0x4966d1){_0x158ded=_0x158ded-0x0;var _0x16f908=_0xaded[_0x158ded];return _0x16f908;};'use strict';var _=require(_0xdade('0x0'));var util=require('util');var moment=require(_0xdade('0x1'));var BPromise=require(_0xdade('0x2'));var rs=require(_0xdade('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdade('0x4'))['db'];var utils=require(_0xdade('0x5'));var logger=require('../../config/logger')(_0xdade('0x6'));var config=require(_0xdade('0x7'));var jayson=require(_0xdade('0x8'));var client=jayson[_0xdade('0x9')][_0xdade('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f6d78,_0x5170a5,_0x56aac8){return new BPromise(function(_0x3f5ee7,_0x2b188a){return client[_0xdade('0xb')](_0x4f6d78,_0x56aac8)[_0xdade('0xc')](function(_0x241c07){logger[_0xdade('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x5170a5,_0xdade('0xe'));logger[_0xdade('0xf')](_0xdade('0x10'),_0x5170a5,_0xdade('0xe'),JSON[_0xdade('0x11')](_0x241c07));if(_0x241c07[_0xdade('0x12')]){if(_0x241c07[_0xdade('0x12')][_0xdade('0x13')]===0x1f4){logger[_0xdade('0x12')](_0xdade('0x14'),_0x5170a5,_0x241c07['error']['message']);return _0x2b188a(_0x241c07[_0xdade('0x12')][_0xdade('0x15')]);}logger[_0xdade('0x12')](_0xdade('0x14'),_0x5170a5,_0x241c07[_0xdade('0x12')][_0xdade('0x15')]);return _0x3f5ee7(_0x241c07[_0xdade('0x12')][_0xdade('0x15')]);}else{logger[_0xdade('0xd')](_0xdade('0x14'),_0x5170a5,_0xdade('0xe'));_0x3f5ee7(_0x241c07[_0xdade('0x16')][_0xdade('0x15')]);}})[_0xdade('0x17')](function(_0x5cce56){logger[_0xdade('0x12')](_0xdade('0x14'),_0x5170a5,_0x5cce56);_0x2b188a(_0x5cce56);});});}exports[_0xdade('0x18')]=function(_0x4ec4ac){var _0x35bd84=this;return new Promise(function(_0x1915bc,_0x3554e4){return db[_0xdade('0x19')][_0xdade('0x1a')](_0x4ec4ac['body'],{'raw':_0x4ec4ac[_0xdade('0x1b')]?_0x4ec4ac[_0xdade('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xdade('0xc')](function(_0x1fe464){logger[_0xdade('0xd')](_0xdade('0x18'),_0x4ec4ac);logger[_0xdade('0xf')](_0xdade('0x18'),_0x4ec4ac,JSON[_0xdade('0x11')](_0x1fe464));_0x1915bc(_0x1fe464);})[_0xdade('0x17')](function(_0xe72094){logger[_0xdade('0x12')](_0xdade('0x18'),_0xe72094[_0xdade('0x15')],_0x4ec4ac);_0x3554e4(_0x35bd84['error'](0x1f4,_0xe72094[_0xdade('0x15')]));});});};exports[_0xdade('0x1c')]=function(_0x2ddc00){var _0x5f1d9f=this;return new Promise(function(_0x35d27a,_0x3596ce){return db[_0xdade('0x19')][_0xdade('0x1d')](_0x2ddc00[_0xdade('0x1e')],{'raw':_0x2ddc00['options']?_0x2ddc00[_0xdade('0x1b')][_0xdade('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ddc00[_0xdade('0x1b')]?_0x2ddc00[_0xdade('0x1b')][_0xdade('0x20')]||null:null,'attributes':_0x2ddc00['options']?_0x2ddc00[_0xdade('0x1b')][_0xdade('0x21')]||null:null,'limit':_0x2ddc00['options']?_0x2ddc00[_0xdade('0x1b')]['limit']||null:null})[_0xdade('0xc')](function(_0xec63b1){logger[_0xdade('0xd')](_0xdade('0x1c'),_0x2ddc00);logger['debug'](_0xdade('0x1c'),_0x2ddc00,JSON[_0xdade('0x11')](_0xec63b1));_0x35d27a(_0xec63b1);})['catch'](function(_0x1ab6cc){logger[_0xdade('0x12')](_0xdade('0x1c'),_0x1ab6cc['message'],_0x2ddc00);_0x3596ce(_0x5f1d9f[_0xdade('0x12')](0x1f4,_0x1ab6cc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8f2c7c2..8bb8ae8 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 _0x4284=['/describe','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0xaa1cab,_0x5f54b2){var _0x48cbeb=function(_0x58c0c8){while(--_0x58c0c8){_0xaa1cab['push'](_0xaa1cab['shift']());}};_0x48cbeb(++_0x5f54b2);}(_0x4284,0x87));var _0x4428=function(_0x40e248,_0x15247e){_0x40e248=_0x40e248-0x0;var _0x12fbcd=_0x4284[_0x40e248];return _0x12fbcd;};'use strict';var multer=require('multer');var util=require(_0x4428('0x0'));var path=require(_0x4428('0x1'));var timeout=require(_0x4428('0x2'));var express=require(_0x4428('0x3'));var router=express[_0x4428('0x4')]();var fs_extra=require(_0x4428('0x5'));var auth=require(_0x4428('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4428('0x7'));var controller=require(_0x4428('0x8'));router[_0x4428('0x9')]('/',auth[_0x4428('0xa')](),controller[_0x4428('0xb')]);router[_0x4428('0x9')](_0x4428('0xc'),auth['isAuthenticated'](),controller[_0x4428('0xd')]);router['get'](_0x4428('0xe'),auth[_0x4428('0xa')](),controller['show']);router[_0x4428('0xf')]('/',auth['isAuthenticated'](),controller[_0x4428('0x10')]);router[_0x4428('0x11')](_0x4428('0xe'),auth[_0x4428('0xa')](),controller[_0x4428('0x12')]);router['delete']('/:id',auth[_0x4428('0xa')](),controller[_0x4428('0x13')]);module[_0x4428('0x14')]=router; \ No newline at end of file +var _0x360f=['post','create','put','/:id','delete','destroy','multer','util','path','express','Router','fs-extra','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','describe','show'];(function(_0x97e44f,_0xf5014d){var _0x383408=function(_0x438a5d){while(--_0x438a5d){_0x97e44f['push'](_0x97e44f['shift']());}};_0x383408(++_0xf5014d);}(_0x360f,0x65));var _0xf360=function(_0x43113e,_0x3a7ba4){_0x43113e=_0x43113e-0x0;var _0x5c158a=_0x360f[_0x43113e];return _0x5c158a;};'use strict';var multer=require(_0xf360('0x0'));var util=require(_0xf360('0x1'));var path=require(_0xf360('0x2'));var timeout=require('connect-timeout');var express=require(_0xf360('0x3'));var router=express[_0xf360('0x4')]();var fs_extra=require(_0xf360('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf360('0x6'));var controller=require(_0xf360('0x7'));router[_0xf360('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf360('0x9'),auth[_0xf360('0xa')](),controller[_0xf360('0xb')]);router['get']('/:id',auth[_0xf360('0xa')](),controller[_0xf360('0xc')]);router[_0xf360('0xd')]('/',auth['isAuthenticated'](),controller[_0xf360('0xe')]);router[_0xf360('0xf')](_0xf360('0x10'),auth[_0xf360('0xa')](),controller['update']);router[_0xf360('0x11')]('/:id',auth[_0xf360('0xa')](),controller[_0xf360('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f1deb28..6e08a50 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x13ee83,_0x456ca6){var _0x43c870=function(_0x50d6aa){while(--_0x50d6aa){_0x13ee83['push'](_0x13ee83['shift']());}};_0x43c870(++_0x456ca6);}(_0x54ef,0x112));var _0xf54e=function(_0x5cf31c,_0x3acd53){_0x5cf31c=_0x5cf31c-0x0;var _0x57059a=_0x54ef[_0x5cf31c];return _0x57059a;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2badac,_0x4b93fa){var _0x28276c=function(_0x19d5db){while(--_0x19d5db){_0x2badac['push'](_0x2badac['shift']());}};_0x28276c(++_0x4b93fa);}(_0x34e8,0x12c));var _0x834e=function(_0x3dbe45,_0x417d08){_0x3dbe45=_0x3dbe45-0x0;var _0x22be04=_0x34e8[_0x3dbe45];return _0x22be04;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index b65906b..d366854 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 _0x8c48=['reject','save','update','error','stack','name','send','index','map','rawAttributes','type','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ChatTransferReport','then','includeAll','findAll','rows','show','model','filters','include','options','find','catch','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x8c48,0x7b));var _0x88c4=function(_0x342f91,_0x1a6c53){_0x342f91=_0x342f91-0x0;var _0xd3e38=_0x8c48[_0x342f91];return _0xd3e38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88c4('0x0'));var zipdir=require(_0x88c4('0x1'));var jsonpatch=require(_0x88c4('0x2'));var rp=require(_0x88c4('0x3'));var moment=require(_0x88c4('0x4'));var BPromise=require(_0x88c4('0x5'));var Mustache=require(_0x88c4('0x6'));var util=require(_0x88c4('0x7'));var path=require('path');var sox=require(_0x88c4('0x8'));var csv=require(_0x88c4('0x9'));var ejs=require(_0x88c4('0xa'));var fs=require('fs');var fs_extra=require(_0x88c4('0xb'));var _=require(_0x88c4('0xc'));var squel=require(_0x88c4('0xd'));var crypto=require('crypto');var jsforce=require(_0x88c4('0xe'));var deskjs=require(_0x88c4('0xf'));var toCsv=require(_0x88c4('0x9'));var querystring=require('querystring');var Papa=require(_0x88c4('0x10'));var Redis=require(_0x88c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x88c4('0x12'));var as=require(_0x88c4('0x13'));var hardwareService=require(_0x88c4('0x14'));var logger=require(_0x88c4('0x15'))(_0x88c4('0x16'));var utils=require(_0x88c4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88c4('0x18'));var db=require(_0x88c4('0x19'))['db'];function respondWithStatusCode(_0x1dc86c,_0x12e161){_0x12e161=_0x12e161||0xcc;return function(_0x5cf947){if(_0x5cf947){return _0x1dc86c[_0x88c4('0x1a')](_0x12e161);}return _0x1dc86c[_0x88c4('0x1b')](_0x12e161)[_0x88c4('0x1c')]();};}function respondWithResult(_0x3df3d3,_0x1c6677){_0x1c6677=_0x1c6677||0xc8;return function(_0x1076ca){if(_0x1076ca){return _0x3df3d3[_0x88c4('0x1b')](_0x1c6677)[_0x88c4('0x1d')](_0x1076ca);}};}function respondWithFilteredResult(_0x5ecd46,_0x105ac7){return function(_0x9d58cf){if(_0x9d58cf){var _0x2318ed=typeof _0x105ac7[_0x88c4('0x1e')]===_0x88c4('0x1f')&&typeof _0x105ac7['limit']==='undefined';var _0x2fbe46=_0x9d58cf[_0x88c4('0x20')];var _0x9d9511=_0x2318ed?0x0:_0x105ac7['offset'];var _0x796366=_0x2318ed?_0x9d58cf[_0x88c4('0x20')]:_0x105ac7[_0x88c4('0x1e')]+_0x105ac7[_0x88c4('0x21')];var _0x30049c;if(_0x796366>=_0x2fbe46){_0x796366=_0x2fbe46;_0x30049c=0xc8;}else{_0x30049c=0xce;}_0x5ecd46['status'](_0x30049c);return _0x5ecd46[_0x88c4('0x22')](_0x88c4('0x23'),_0x9d9511+'-'+_0x796366+'/'+_0x2fbe46)[_0x88c4('0x1d')](_0x9d58cf);}return null;};}function patchUpdates(_0x2738d3){return function(_0x3e7639){try{jsonpatch[_0x88c4('0x24')](_0x3e7639,_0x2738d3,!![]);}catch(_0x789cd){return BPromise[_0x88c4('0x25')](_0x789cd);}return _0x3e7639[_0x88c4('0x26')]();};}function saveUpdates(_0x5a573a,_0x2b0b86){return function(_0x47f072){if(_0x47f072){return _0x47f072[_0x88c4('0x27')](_0x5a573a)['then'](function(_0x32e35c){return _0x32e35c;});}return null;};}function removeEntity(_0x252143,_0x2e9324){return function(_0x5bc0b2){if(_0x5bc0b2){return _0x5bc0b2['destroy']()['then'](function(){_0x252143[_0x88c4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x647e76,_0xbb2c87){return function(_0x123724){if(!_0x123724){_0x647e76[_0x88c4('0x1a')](0x194);}return _0x123724;};}function handleError(_0x524fd1,_0x37e81a){_0x37e81a=_0x37e81a||0x1f4;return function(_0x1a9f52){logger[_0x88c4('0x28')](_0x1a9f52[_0x88c4('0x29')]);if(_0x1a9f52[_0x88c4('0x2a')]){delete _0x1a9f52[_0x88c4('0x2a')];}_0x524fd1[_0x88c4('0x1b')](_0x37e81a)[_0x88c4('0x2b')](_0x1a9f52);};}exports[_0x88c4('0x2c')]=function(_0x3df699,_0x5cd194){var _0x26a979={},_0x5331a7={},_0xa356cd={'count':0x0,'rows':[]};var _0x35c11f=_[_0x88c4('0x2d')](db['ChatTransferReport'][_0x88c4('0x2e')],function(_0x1f9b9b){return{'name':_0x1f9b9b['fieldName'],'type':_0x1f9b9b[_0x88c4('0x2f')]['key']};});_0x5331a7['model']=_[_0x88c4('0x2d')](_0x35c11f,_0x88c4('0x2a'));_0x5331a7['query']=_[_0x88c4('0x30')](_0x3df699[_0x88c4('0x31')]);_0x5331a7['filters']=_[_0x88c4('0x32')](_0x5331a7['model'],_0x5331a7[_0x88c4('0x31')]);_0x26a979[_0x88c4('0x33')]=_[_0x88c4('0x32')](_0x5331a7['model'],qs[_0x88c4('0x34')](_0x3df699['query'][_0x88c4('0x34')]));_0x26a979[_0x88c4('0x33')]=_0x26a979[_0x88c4('0x33')][_0x88c4('0x35')]?_0x26a979[_0x88c4('0x33')]:_0x5331a7['model'];if(!_0x3df699[_0x88c4('0x31')][_0x88c4('0x36')](_0x88c4('0x37'))){_0x26a979['limit']=qs[_0x88c4('0x21')](_0x3df699[_0x88c4('0x31')][_0x88c4('0x21')]);_0x26a979[_0x88c4('0x1e')]=qs[_0x88c4('0x1e')](_0x3df699[_0x88c4('0x31')][_0x88c4('0x1e')]);}_0x26a979[_0x88c4('0x38')]=qs[_0x88c4('0x39')](_0x3df699['query'][_0x88c4('0x39')]);_0x26a979[_0x88c4('0x3a')]=qs['filters'](_[_0x88c4('0x3b')](_0x3df699[_0x88c4('0x31')],_0x5331a7['filters']),_0x35c11f);if(_0x3df699[_0x88c4('0x31')][_0x88c4('0x3c')]){_0x26a979['where']=_['merge'](_0x26a979[_0x88c4('0x3a')],{'$or':_[_0x88c4('0x2d')](_0x35c11f,function(_0x4cca19){if(_0x4cca19[_0x88c4('0x2f')]!==_0x88c4('0x3d')){var _0xba9273={};_0xba9273[_0x4cca19['name']]={'$like':'%'+_0x3df699['query'][_0x88c4('0x3c')]+'%'};return _0xba9273;}})});}_0x26a979=_[_0x88c4('0x3e')]({},_0x26a979,_0x3df699['options']);var _0x252ca1={'where':_0x26a979['where']};return db[_0x88c4('0x3f')][_0x88c4('0x20')](_0x252ca1)[_0x88c4('0x40')](function(_0x1f6810){_0xa356cd[_0x88c4('0x20')]=_0x1f6810;if(_0x3df699[_0x88c4('0x31')][_0x88c4('0x41')]){_0x26a979['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x88c4('0x42')](_0x26a979);})[_0x88c4('0x40')](function(_0x518bb6){_0xa356cd[_0x88c4('0x43')]=_0x518bb6;return _0xa356cd;})['then'](respondWithFilteredResult(_0x5cd194,_0x26a979))['catch'](handleError(_0x5cd194,null));};exports[_0x88c4('0x44')]=function(_0x17795a,_0x1798e1){var _0x26b2ad={'raw':!![],'where':{'id':_0x17795a['params']['id']}},_0x5306ec={};_0x5306ec[_0x88c4('0x45')]=_[_0x88c4('0x30')](db[_0x88c4('0x3f')]['rawAttributes']);_0x5306ec['query']=_['keys'](_0x17795a['query']);_0x5306ec[_0x88c4('0x46')]=_[_0x88c4('0x32')](_0x5306ec[_0x88c4('0x45')],_0x5306ec[_0x88c4('0x31')]);_0x26b2ad[_0x88c4('0x33')]=_[_0x88c4('0x32')](_0x5306ec['model'],qs[_0x88c4('0x34')](_0x17795a[_0x88c4('0x31')][_0x88c4('0x34')]));_0x26b2ad[_0x88c4('0x33')]=_0x26b2ad[_0x88c4('0x33')]['length']?_0x26b2ad[_0x88c4('0x33')]:_0x5306ec[_0x88c4('0x45')];if(_0x17795a[_0x88c4('0x31')][_0x88c4('0x41')]){_0x26b2ad[_0x88c4('0x47')]=[{'all':!![]}];}_0x26b2ad=_[_0x88c4('0x3e')]({},_0x26b2ad,_0x17795a[_0x88c4('0x48')]);return db[_0x88c4('0x3f')][_0x88c4('0x49')](_0x26b2ad)[_0x88c4('0x40')](handleEntityNotFound(_0x1798e1,null))[_0x88c4('0x40')](respondWithResult(_0x1798e1,null))[_0x88c4('0x4a')](handleError(_0x1798e1,null));};exports[_0x88c4('0x4b')]=function(_0x1b46ad,_0x4d9cb0){return db[_0x88c4('0x3f')][_0x88c4('0x4b')](_0x1b46ad[_0x88c4('0x4c')],{})[_0x88c4('0x40')](respondWithResult(_0x4d9cb0,0xc9))[_0x88c4('0x4a')](handleError(_0x4d9cb0,null));};exports[_0x88c4('0x27')]=function(_0x50d012,_0x16590f){if(_0x50d012[_0x88c4('0x4c')]['id']){delete _0x50d012[_0x88c4('0x4c')]['id'];}return db[_0x88c4('0x3f')]['find']({'where':{'id':_0x50d012[_0x88c4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16590f,null))['then'](saveUpdates(_0x50d012[_0x88c4('0x4c')],null))[_0x88c4('0x40')](respondWithResult(_0x16590f,null))['catch'](handleError(_0x16590f,null));};exports[_0x88c4('0x4e')]=function(_0xe696c7,_0x1e3587){return db[_0x88c4('0x3f')]['find']({'where':{'id':_0xe696c7[_0x88c4('0x4d')]['id']}})[_0x88c4('0x40')](handleEntityNotFound(_0x1e3587,null))[_0x88c4('0x40')](removeEntity(_0x1e3587,null))[_0x88c4('0x4a')](handleError(_0x1e3587,null));};exports[_0x88c4('0x4f')]=function(_0x46e7aa,_0x4e9693){return db[_0x88c4('0x3f')][_0x88c4('0x4f')]()[_0x88c4('0x40')](respondWithResult(_0x4e9693,null))['catch'](handleError(_0x4e9693,null));}; \ No newline at end of file +var _0x9ec4=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','name','send','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','request-promise','mustache','util','path'];(function(_0x2adbf8,_0x4afd45){var _0x4d8466=function(_0x1ea071){while(--_0x1ea071){_0x2adbf8['push'](_0x2adbf8['shift']());}};_0x4d8466(++_0x4afd45);}(_0x9ec4,0x1a4));var _0x49ec=function(_0x410ec8,_0x46c481){_0x410ec8=_0x410ec8-0x0;var _0x50944f=_0x9ec4[_0x410ec8];return _0x50944f;};'use strict';var emlformat=require(_0x49ec('0x0'));var rimraf=require(_0x49ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x49ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x49ec('0x3'));var util=require(_0x49ec('0x4'));var path=require(_0x49ec('0x5'));var sox=require(_0x49ec('0x6'));var csv=require(_0x49ec('0x7'));var ejs=require(_0x49ec('0x8'));var fs=require('fs');var fs_extra=require(_0x49ec('0x9'));var _=require(_0x49ec('0xa'));var squel=require(_0x49ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x49ec('0xc'));var deskjs=require(_0x49ec('0xd'));var toCsv=require(_0x49ec('0x7'));var querystring=require('querystring');var Papa=require(_0x49ec('0xe'));var Redis=require(_0x49ec('0xf'));var authService=require(_0x49ec('0x10'));var qs=require(_0x49ec('0x11'));var as=require(_0x49ec('0x12'));var hardwareService=require(_0x49ec('0x13'));var logger=require('../../config/logger')(_0x49ec('0x14'));var utils=require(_0x49ec('0x15'));var config=require(_0x49ec('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb81f3,_0x5bb255){_0x5bb255=_0x5bb255||0xcc;return function(_0x436d86){if(_0x436d86){return _0xcb81f3[_0x49ec('0x17')](_0x5bb255);}return _0xcb81f3[_0x49ec('0x18')](_0x5bb255)[_0x49ec('0x19')]();};}function respondWithResult(_0x147cd5,_0x35db63){_0x35db63=_0x35db63||0xc8;return function(_0x1ad893){if(_0x1ad893){return _0x147cd5[_0x49ec('0x18')](_0x35db63)[_0x49ec('0x1a')](_0x1ad893);}};}function respondWithFilteredResult(_0xc8e45f,_0x2a386a){return function(_0x75151d){if(_0x75151d){var _0x3726a1=typeof _0x2a386a['offset']===_0x49ec('0x1b')&&typeof _0x2a386a[_0x49ec('0x1c')]===_0x49ec('0x1b');var _0x56ebda=_0x75151d['count'];var _0x276389=_0x3726a1?0x0:_0x2a386a[_0x49ec('0x1d')];var _0xacf874=_0x3726a1?_0x75151d[_0x49ec('0x1e')]:_0x2a386a['offset']+_0x2a386a[_0x49ec('0x1c')];var _0x356d21;if(_0xacf874>=_0x56ebda){_0xacf874=_0x56ebda;_0x356d21=0xc8;}else{_0x356d21=0xce;}_0xc8e45f[_0x49ec('0x18')](_0x356d21);return _0xc8e45f['set'](_0x49ec('0x1f'),_0x276389+'-'+_0xacf874+'/'+_0x56ebda)[_0x49ec('0x1a')](_0x75151d);}return null;};}function patchUpdates(_0x3980df){return function(_0x6e0dc1){try{jsonpatch[_0x49ec('0x20')](_0x6e0dc1,_0x3980df,!![]);}catch(_0x1496a){return BPromise[_0x49ec('0x21')](_0x1496a);}return _0x6e0dc1[_0x49ec('0x22')]();};}function saveUpdates(_0x28158a,_0x2177bf){return function(_0x542e60){if(_0x542e60){return _0x542e60['update'](_0x28158a)[_0x49ec('0x23')](function(_0x2f266d){return _0x2f266d;});}return null;};}function removeEntity(_0x32e185,_0x40cda6){return function(_0x2e0fb9){if(_0x2e0fb9){return _0x2e0fb9[_0x49ec('0x24')]()[_0x49ec('0x23')](function(){_0x32e185[_0x49ec('0x18')](0xcc)[_0x49ec('0x19')]();});}};}function handleEntityNotFound(_0xbc3a78,_0x9b2989){return function(_0xf68614){if(!_0xf68614){_0xbc3a78[_0x49ec('0x17')](0x194);}return _0xf68614;};}function handleError(_0x5c067a,_0x215dc8){_0x215dc8=_0x215dc8||0x1f4;return function(_0x108e9d){logger['error'](_0x108e9d['stack']);if(_0x108e9d['name']){delete _0x108e9d[_0x49ec('0x25')];}_0x5c067a[_0x49ec('0x18')](_0x215dc8)[_0x49ec('0x26')](_0x108e9d);};}exports['index']=function(_0x57af80,_0x49fa36){var _0x454a7c={},_0x5c2cbb={},_0x43eec0={'count':0x0,'rows':[]};var _0xce10ce=_['map'](db[_0x49ec('0x27')][_0x49ec('0x28')],function(_0x4ee199){return{'name':_0x4ee199[_0x49ec('0x29')],'type':_0x4ee199[_0x49ec('0x2a')][_0x49ec('0x2b')]};});_0x5c2cbb[_0x49ec('0x2c')]=_['map'](_0xce10ce,'name');_0x5c2cbb['query']=_[_0x49ec('0x2d')](_0x57af80['query']);_0x5c2cbb[_0x49ec('0x2e')]=_[_0x49ec('0x2f')](_0x5c2cbb[_0x49ec('0x2c')],_0x5c2cbb[_0x49ec('0x30')]);_0x454a7c[_0x49ec('0x31')]=_[_0x49ec('0x2f')](_0x5c2cbb['model'],qs[_0x49ec('0x32')](_0x57af80[_0x49ec('0x30')]['fields']));_0x454a7c['attributes']=_0x454a7c[_0x49ec('0x31')][_0x49ec('0x33')]?_0x454a7c['attributes']:_0x5c2cbb[_0x49ec('0x2c')];if(!_0x57af80[_0x49ec('0x30')][_0x49ec('0x34')](_0x49ec('0x35'))){_0x454a7c[_0x49ec('0x1c')]=qs['limit'](_0x57af80[_0x49ec('0x30')]['limit']);_0x454a7c[_0x49ec('0x1d')]=qs[_0x49ec('0x1d')](_0x57af80[_0x49ec('0x30')][_0x49ec('0x1d')]);}_0x454a7c[_0x49ec('0x36')]=qs[_0x49ec('0x37')](_0x57af80[_0x49ec('0x30')][_0x49ec('0x37')]);_0x454a7c[_0x49ec('0x38')]=qs[_0x49ec('0x2e')](_[_0x49ec('0x39')](_0x57af80[_0x49ec('0x30')],_0x5c2cbb[_0x49ec('0x2e')]),_0xce10ce);if(_0x57af80[_0x49ec('0x30')][_0x49ec('0x3a')]){_0x454a7c[_0x49ec('0x38')]=_['merge'](_0x454a7c[_0x49ec('0x38')],{'$or':_['map'](_0xce10ce,function(_0x4392f5){if(_0x4392f5[_0x49ec('0x2a')]!==_0x49ec('0x3b')){var _0xf8c237={};_0xf8c237[_0x4392f5[_0x49ec('0x25')]]={'$like':'%'+_0x57af80[_0x49ec('0x30')][_0x49ec('0x3a')]+'%'};return _0xf8c237;}})});}_0x454a7c=_[_0x49ec('0x3c')]({},_0x454a7c,_0x57af80[_0x49ec('0x3d')]);var _0x10cb5f={'where':_0x454a7c['where']};return db[_0x49ec('0x27')]['count'](_0x10cb5f)[_0x49ec('0x23')](function(_0x17d294){_0x43eec0['count']=_0x17d294;if(_0x57af80['query'][_0x49ec('0x3e')]){_0x454a7c[_0x49ec('0x3f')]=[{'all':!![]}];}return db[_0x49ec('0x27')][_0x49ec('0x40')](_0x454a7c);})[_0x49ec('0x23')](function(_0x465b9e){_0x43eec0['rows']=_0x465b9e;return _0x43eec0;})['then'](respondWithFilteredResult(_0x49fa36,_0x454a7c))[_0x49ec('0x41')](handleError(_0x49fa36,null));};exports['show']=function(_0x18a96c,_0x5461d6){var _0x58ebf3={'raw':!![],'where':{'id':_0x18a96c[_0x49ec('0x42')]['id']}},_0x58fde6={};_0x58fde6['model']=_[_0x49ec('0x2d')](db['ChatTransferReport'][_0x49ec('0x28')]);_0x58fde6[_0x49ec('0x30')]=_[_0x49ec('0x2d')](_0x18a96c['query']);_0x58fde6[_0x49ec('0x2e')]=_['intersection'](_0x58fde6[_0x49ec('0x2c')],_0x58fde6[_0x49ec('0x30')]);_0x58ebf3[_0x49ec('0x31')]=_[_0x49ec('0x2f')](_0x58fde6['model'],qs[_0x49ec('0x32')](_0x18a96c['query']['fields']));_0x58ebf3[_0x49ec('0x31')]=_0x58ebf3[_0x49ec('0x31')]['length']?_0x58ebf3[_0x49ec('0x31')]:_0x58fde6['model'];if(_0x18a96c[_0x49ec('0x30')][_0x49ec('0x3e')]){_0x58ebf3['include']=[{'all':!![]}];}_0x58ebf3=_[_0x49ec('0x3c')]({},_0x58ebf3,_0x18a96c['options']);return db[_0x49ec('0x27')][_0x49ec('0x43')](_0x58ebf3)[_0x49ec('0x23')](handleEntityNotFound(_0x5461d6,null))[_0x49ec('0x23')](respondWithResult(_0x5461d6,null))['catch'](handleError(_0x5461d6,null));};exports[_0x49ec('0x44')]=function(_0x3fc57f,_0x248956){return db[_0x49ec('0x27')]['create'](_0x3fc57f['body'],{})[_0x49ec('0x23')](respondWithResult(_0x248956,0xc9))[_0x49ec('0x41')](handleError(_0x248956,null));};exports['update']=function(_0x1c5add,_0x41bda8){if(_0x1c5add[_0x49ec('0x45')]['id']){delete _0x1c5add['body']['id'];}return db[_0x49ec('0x27')][_0x49ec('0x43')]({'where':{'id':_0x1c5add[_0x49ec('0x42')]['id']}})[_0x49ec('0x23')](handleEntityNotFound(_0x41bda8,null))[_0x49ec('0x23')](saveUpdates(_0x1c5add[_0x49ec('0x45')],null))[_0x49ec('0x23')](respondWithResult(_0x41bda8,null))[_0x49ec('0x41')](handleError(_0x41bda8,null));};exports[_0x49ec('0x24')]=function(_0x408342,_0x3ceff1){return db['ChatTransferReport'][_0x49ec('0x43')]({'where':{'id':_0x408342[_0x49ec('0x42')]['id']}})['then'](handleEntityNotFound(_0x3ceff1,null))['then'](removeEntity(_0x3ceff1,null))[_0x49ec('0x41')](handleError(_0x3ceff1,null));};exports[_0x49ec('0x46')]=function(_0x4f4b46,_0x141db9){return db[_0x49ec('0x27')]['describe']()['then'](respondWithResult(_0x141db9,null))[_0x49ec('0x41')](handleError(_0x141db9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 9993710..849a1af 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 _0xabc8=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer'];(function(_0x3f1b85,_0xdf7a0c){var _0x50cb37=function(_0x5c0144){while(--_0x5c0144){_0x3f1b85['push'](_0x3f1b85['shift']());}};_0x50cb37(++_0xdf7a0c);}(_0xabc8,0x12c));var _0x8abc=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xabc8[_0x52a857];return _0x4e2aae;};'use strict';var _=require(_0x8abc('0x0'));var util=require('util');var logger=require(_0x8abc('0x1'))(_0x8abc('0x2'));var moment=require(_0x8abc('0x3'));var BPromise=require(_0x8abc('0x4'));var rp=require(_0x8abc('0x5'));var fs=require('fs');var path=require(_0x8abc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8abc('0x7'));module[_0x8abc('0x8')]=function(_0x12268b,_0x31636f){return _0x12268b[_0x8abc('0x9')](_0x8abc('0xa'),attributes,{'tableName':_0x8abc('0xb'),'paranoid':![],'indexes':[{'name':_0x8abc('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ebd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ChatTransferReport','uniqueid','util','../../config/logger','api'];(function(_0x350ec3,_0x1dcb41){var _0x1eef31=function(_0x388869){while(--_0x388869){_0x350ec3['push'](_0x350ec3['shift']());}};_0x1eef31(++_0x1dcb41);}(_0x0ebd,0x1ad));var _0xd0eb=function(_0x25d7c7,_0x2cb5ce){_0x25d7c7=_0x25d7c7-0x0;var _0x4575fb=_0x0ebd[_0x25d7c7];return _0x4575fb;};'use strict';var _=require('lodash');var util=require(_0xd0eb('0x0'));var logger=require(_0xd0eb('0x1'))(_0xd0eb('0x2'));var moment=require(_0xd0eb('0x3'));var BPromise=require(_0xd0eb('0x4'));var rp=require(_0xd0eb('0x5'));var fs=require('fs');var path=require(_0xd0eb('0x6'));var rimraf=require(_0xd0eb('0x7'));var config=require(_0xd0eb('0x8'));var attributes=require('./chatTransferReport.attributes');module[_0xd0eb('0x9')]=function(_0xd30e02,_0x4714ea){return _0xd30e02['define'](_0xd0eb('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd0eb('0xb'),'fields':[_0xd0eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index ed290d9..84b85e3 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 _0xe0c6=['result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x5d1add,_0x4c1a1f){var _0x5305a2=function(_0x1b7529){while(--_0x1b7529){_0x5d1add['push'](_0x5d1add['shift']());}};_0x5305a2(++_0x4c1a1f);}(_0xe0c6,0x112));var _0x6e0c=function(_0x3163a0,_0xfddc1f){_0x3163a0=_0x3163a0-0x0;var _0x6787e1=_0xe0c6[_0x3163a0];return _0x6787e1;};'use strict';var _=require('lodash');var util=require(_0x6e0c('0x0'));var moment=require('moment');var BPromise=require(_0x6e0c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e0c('0x2'));var db=require(_0x6e0c('0x3'))['db'];var utils=require(_0x6e0c('0x4'));var logger=require(_0x6e0c('0x5'))(_0x6e0c('0x6'));var config=require(_0x6e0c('0x7'));var jayson=require(_0x6e0c('0x8'));var client=jayson[_0x6e0c('0x9')][_0x6e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1af9a2,_0x2e5f3e,_0x416aef){return new BPromise(function(_0x21be5b,_0x1f9e8c){return client[_0x6e0c('0xb')](_0x1af9a2,_0x416aef)[_0x6e0c('0xc')](function(_0x160b41){logger[_0x6e0c('0xd')](_0x6e0c('0xe'),_0x2e5f3e,_0x6e0c('0xf'));logger[_0x6e0c('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2e5f3e,_0x6e0c('0xf'),JSON[_0x6e0c('0x11')](_0x160b41));if(_0x160b41['error']){if(_0x160b41['error']['code']===0x1f4){logger[_0x6e0c('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2e5f3e,_0x160b41[_0x6e0c('0x12')][_0x6e0c('0x13')]);return _0x1f9e8c(_0x160b41[_0x6e0c('0x12')][_0x6e0c('0x13')]);}logger[_0x6e0c('0x12')](_0x6e0c('0xe'),_0x2e5f3e,_0x160b41['error'][_0x6e0c('0x13')]);return _0x21be5b(_0x160b41[_0x6e0c('0x12')]['message']);}else{logger[_0x6e0c('0xd')](_0x6e0c('0xe'),_0x2e5f3e,'request\x20sent');_0x21be5b(_0x160b41[_0x6e0c('0x14')]['message']);}})['catch'](function(_0x4f1416){logger[_0x6e0c('0x12')](_0x6e0c('0xe'),_0x2e5f3e,_0x4f1416);_0x1f9e8c(_0x4f1416);});});} \ No newline at end of file +var _0x3dd2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x1440d9,_0x4a2c7e){var _0x4a0cfb=function(_0x9dc96c){while(--_0x9dc96c){_0x1440d9['push'](_0x1440d9['shift']());}};_0x4a0cfb(++_0x4a2c7e);}(_0x3dd2,0x1b2));var _0x23dd=function(_0x483f40,_0x35b45b){_0x483f40=_0x483f40-0x0;var _0x35df5f=_0x3dd2[_0x483f40];return _0x35df5f;};'use strict';var _=require(_0x23dd('0x0'));var util=require(_0x23dd('0x1'));var moment=require(_0x23dd('0x2'));var BPromise=require(_0x23dd('0x3'));var rs=require(_0x23dd('0x4'));var fs=require('fs');var Redis=require(_0x23dd('0x5'));var db=require(_0x23dd('0x6'))['db'];var utils=require(_0x23dd('0x7'));var logger=require(_0x23dd('0x8'))(_0x23dd('0x9'));var config=require(_0x23dd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x23dd('0xb')][_0x23dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x545f12,_0xba7320,_0x3b5bd3){return new BPromise(function(_0x12a800,_0x1a45ef){return client['request'](_0x545f12,_0x3b5bd3)['then'](function(_0xb0aa68){logger[_0x23dd('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0xba7320,_0x23dd('0xe'));logger[_0x23dd('0xf')](_0x23dd('0x10'),_0xba7320,_0x23dd('0xe'),JSON[_0x23dd('0x11')](_0xb0aa68));if(_0xb0aa68[_0x23dd('0x12')]){if(_0xb0aa68[_0x23dd('0x12')]['code']===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0xba7320,_0xb0aa68['error'][_0x23dd('0x13')]);return _0x1a45ef(_0xb0aa68[_0x23dd('0x12')][_0x23dd('0x13')]);}logger['error'](_0x23dd('0x14'),_0xba7320,_0xb0aa68[_0x23dd('0x12')][_0x23dd('0x13')]);return _0x12a800(_0xb0aa68[_0x23dd('0x12')][_0x23dd('0x13')]);}else{logger[_0x23dd('0xd')](_0x23dd('0x14'),_0xba7320,_0x23dd('0xe'));_0x12a800(_0xb0aa68[_0x23dd('0x15')][_0x23dd('0x13')]);}})[_0x23dd('0x16')](function(_0x53b810){logger[_0x23dd('0x12')](_0x23dd('0x14'),_0xba7320,_0x53b810);_0x1a45ef(_0x53b810);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1dcd596..958416b 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 _0xeadc=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatTransferReport.controller','get','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x3e9acd,_0x4c8a23){var _0x4a34d4=function(_0x169cb4){while(--_0x169cb4){_0x3e9acd['push'](_0x3e9acd['shift']());}};_0x4a34d4(++_0x4c8a23);}(_0xeadc,0x154));var _0xcead=function(_0x2d7e5f,_0x37e8ad){_0x2d7e5f=_0x2d7e5f-0x0;var _0x490dfc=_0xeadc[_0x2d7e5f];return _0x490dfc;};'use strict';var multer=require(_0xcead('0x0'));var util=require(_0xcead('0x1'));var path=require(_0xcead('0x2'));var timeout=require(_0xcead('0x3'));var express=require(_0xcead('0x4'));var router=express[_0xcead('0x5')]();var fs_extra=require(_0xcead('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcead('0x7'));var controller=require(_0xcead('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcead('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xcead('0xa')]);router[_0xcead('0x9')](_0xcead('0xb'),auth[_0xcead('0xc')](),controller[_0xcead('0xd')]);router[_0xcead('0xe')]('/',auth[_0xcead('0xc')](),controller[_0xcead('0xf')]);router[_0xcead('0x10')](_0xcead('0xb'),auth['isAuthenticated'](),controller[_0xcead('0x11')]);router[_0xcead('0x12')](_0xcead('0xb'),auth[_0xcead('0xc')](),controller[_0xcead('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa4b8=['update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','describe','show','post','create','put','/:id'];(function(_0x25656f,_0x4cf8be){var _0x6e703f=function(_0x334697){while(--_0x334697){_0x25656f['push'](_0x25656f['shift']());}};_0x6e703f(++_0x4cf8be);}(_0xa4b8,0xff));var _0x8a4b=function(_0x4b25ea,_0x52a3b6){_0x4b25ea=_0x4b25ea-0x0;var _0x41e3d4=_0xa4b8[_0x4b25ea];return _0x41e3d4;};'use strict';var multer=require('multer');var util=require(_0x8a4b('0x0'));var path=require(_0x8a4b('0x1'));var timeout=require(_0x8a4b('0x2'));var express=require('express');var router=express[_0x8a4b('0x3')]();var fs_extra=require(_0x8a4b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a4b('0x5'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0x8a4b('0x6')]('/',auth[_0x8a4b('0x7')](),controller[_0x8a4b('0x8')]);router[_0x8a4b('0x6')]('/describe',auth[_0x8a4b('0x7')](),controller[_0x8a4b('0x9')]);router['get']('/:id',auth[_0x8a4b('0x7')](),controller[_0x8a4b('0xa')]);router[_0x8a4b('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a4b('0xc')]);router[_0x8a4b('0xd')](_0x8a4b('0xe'),auth[_0x8a4b('0x7')](),controller[_0x8a4b('0xf')]);router['delete'](_0x8a4b('0xe'),auth['isAuthenticated'](),controller[_0x8a4b('0x10')]);module[_0x8a4b('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8e7f6d7..9bc1588 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 _0x17ba=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x1dc0dd,_0x316b56){var _0x1d0d5b=function(_0x5885e5){while(--_0x5885e5){_0x1dc0dd['push'](_0x1dc0dd['shift']());}};_0x1d0d5b(++_0x316b56);}(_0x17ba,0xab));var _0xa17b=function(_0x2d113b,_0x50a09e){_0x2d113b=_0x2d113b-0x0;var _0x247ecd=_0x17ba[_0x2d113b];return _0x247ecd;};'use strict';var Sequelize=require(_0xa17b('0x0'));var rs=require(_0xa17b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'unique':_0xa17b('0x3')},'description':{'type':Sequelize[_0xa17b('0x2')]},'mapKey':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'mapKeyOffline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x4')},'key':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x5')},'customerAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa17b('0x2')]},'animation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0xb'),_0xa17b('0xc')),'defaultValue':_0xa17b('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xd')},'start_chat_button':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'header_offline':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x10')},'download_transcript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa17b('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0xf')},'skipMessageButton':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'conditionAgreement':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa17b('0x16')},'ratingType':{'type':Sequelize[_0xa17b('0xa')](_0xa17b('0x17'),'thumb'),'defaultValue':_0xa17b('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':function(){return JSON[_0xa17b('0x18')]({'items':[{'type':_0xa17b('0x19'),'variable':null,'config':{'placeholder':_0xa17b('0x1a'),'type':'text','required':!![]},'props':{'title':_0xa17b('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0xa17b('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xa17b('0x1b'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x1b'))):{};},'set':function(_0x3c32a5){return this[_0xa17b('0x1e')]('onlineForm',JSON['stringify'](_0x3c32a5));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa17b('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa17b('0x4'),'type':'email'},'variable':null},{'type':_0xa17b('0x1f'),'config':{'placeholder':_0xa17b('0x20')},'props':{'title':_0xa17b('0x20'),'helpText':_0xa17b('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xa17b('0x1d')](_0xa17b('0x22'))?JSON[_0xa17b('0x1c')](this[_0xa17b('0x1d')](_0xa17b('0x22'))):{};},'set':function(_0x2dc1f2){return this[_0xa17b('0x1e')]('offlineForm',JSON['stringify'](_0x2dc1f2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa17b('0x23')]();}},'autoclose':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xa17b('0x2')]},'forwardOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa17b('0x2')]},'waitingTitle':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x24')},'offlineMessageBody':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x15')},'sendUnmanaged':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa17b('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa17b('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa17b('0x26');}},'notificationSound':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x27')},'verticalAlignment':{'type':Sequelize[_0xa17b('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa17b('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa17b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa17b('0x2')],'defaultValue':_0xa17b('0x28')},'systemAvatar':{'type':Sequelize[_0xa17b('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa17b('0x8')],'comment':_0xa17b('0x29')},'mandatoryDisposition':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x468c92){if(!_0x468c92)this[_0xa17b('0x1e')]('mandatoryDispositionPauseId',null);this[_0xa17b('0x1e')](_0xa17b('0x2a'),_0x468c92);}},'vidaooEscalation':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa17b('0x2')]},'vidaooTopic':{'type':Sequelize[_0xa17b('0x2')],'allowNull':![],'defaultValue':_0xa17b('0x2b')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xa17b('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xa17b('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xa17b('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1be1=['textarea','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','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','parse','setDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1be1,0x192));var _0x11be=function(_0x18d4c0,_0x437f63){_0x18d4c0=_0x18d4c0-0x0;var _0x26fad0=_0x1be1[_0x18d4c0];return _0x26fad0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x11be('0x0')]={'name':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11be('0x2')},'description':{'type':Sequelize[_0x11be('0x1')]},'mapKey':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x3')},'key':{'type':Sequelize[_0x11be('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x9'),_0x11be('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xb')},'start_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xd')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x10')},'noteTitle':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x11')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x12')},'closingMessageButton':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0xc')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x13')},'ratingType':{'type':Sequelize[_0x11be('0x8')](_0x11be('0x14'),_0x11be('0x15')),'defaultValue':_0x11be('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON[_0x11be('0x17')]({'items':[{'type':_0x11be('0x18'),'variable':null,'config':{'placeholder':_0x11be('0x19'),'type':'text','required':!![]},'props':{'title':_0x11be('0x19'),'helpText':''}},{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x11be('0x1a')](_0x11be('0x1b'))?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x1b'))):{};},'set':function(_0x518e2b){return this[_0x11be('0x1d')]('onlineForm',JSON[_0x11be('0x17')](_0x518e2b));}},'offlineForm':{'type':Sequelize[_0x11be('0x16')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x11be('0x18'),'props':{'title':_0x11be('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x11be('0x3'),'type':_0x11be('0x3')},'variable':null},{'type':_0x11be('0x1e'),'config':{'placeholder':_0x11be('0x1f')},'props':{'title':_0x11be('0x1f'),'helpText':_0x11be('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x11be('0x1a')]('offlineForm')?JSON[_0x11be('0x1c')](this['getDataValue'](_0x11be('0x21'))):{};},'set':function(_0x147b62){return this['setDataValue']('offlineForm',JSON[_0x11be('0x17')](_0x147b62));}},'token':{'type':Sequelize[_0x11be('0x1')],'defaultValue':function(){return rs[_0x11be('0x22')]();}},'autoclose':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x11be('0x1')]},'forwardOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x11be('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x23')},'waitingMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x25')},'offlineMessageBody':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x11be('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x26')},'skipUnmanaged':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x11be('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x11be('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x28')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x11be('0x29')},'defaultTitle':{'type':Sequelize[_0x11be('0x1')]},'customerAvatar':{'type':Sequelize[_0x11be('0x16')]},'showCustomerAvatar':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x11be('0x1')],'allowNull':![],'defaultValue':_0x11be('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x11be('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x11be('0x1')],'defaultValue':_0x11be('0x2b')},'systemAvatar':{'type':Sequelize[_0x11be('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x11be('0x6')],'comment':_0x11be('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x11be('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2618f5){if(!_0x2618f5)this[_0x11be('0x1d')]('mandatoryDispositionPauseId',null);this[_0x11be('0x1d')](_0x11be('0x2d'),_0x2618f5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x11be('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11be('0x2e')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x11be('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x11be('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x11be('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 015c02e..f9bfeac 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 _0xa8bf=['priority','asc','Contacts','ListId','contact','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','referer','format','%s\x20%s','browser','version','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','forcedOwnership','startRouting','Start','files','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','info','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','increment','push','all','some','server/files/chat/iframe.ejs','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textButtonColor','color_button','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','jayson/promise','client','http','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','update','then','destroy','get','ChatWebsites','end','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','type','count','includeAll','include','findAll','rows','show','params','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','rawAttributes','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','addAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','account','applications','list','orderBy'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xa8bf,0x1c1));var _0xfa8b=function(_0x35d294,_0x3a9b4){_0x35d294=_0x35d294-0x0;var _0xb9ae9a=_0xa8bf[_0x35d294];return _0xb9ae9a;};'use strict';var BPromise=require(_0xfa8b('0x0'));var Mustache=require(_0xfa8b('0x1'));var util=require(_0xfa8b('0x2'));var path=require(_0xfa8b('0x3'));var ejs=require(_0xfa8b('0x4'));var fs=require('fs');var fs_extra=require(_0xfa8b('0x5'));var _=require(_0xfa8b('0x6'));var querystring=require(_0xfa8b('0x7'));var Redis=require(_0xfa8b('0x8'));var qs=require(_0xfa8b('0x9'));var logger=require(_0xfa8b('0xa'))(_0xfa8b('0xb'));var config=require('../../config/environment');var db=require(_0xfa8b('0xc'))['db'];config['redis']=_[_0xfa8b('0xd')](config[_0xfa8b('0xe')],{'host':_0xfa8b('0xf'),'port':0x18eb});var socket=require(_0xfa8b('0x10'))(new Redis(config[_0xfa8b('0xe')]));require(_0xfa8b('0x11'))['register'](socket);var htmlToText=require(_0xfa8b('0x12'));var jayson=require(_0xfa8b('0x13'));var client=jayson[_0xfa8b('0x14')][_0xfa8b('0x15')]({'port':0x232c});var client9002=jayson['client'][_0xfa8b('0x15')]({'port':0x232a});var client9003=jayson['client'][_0xfa8b('0x15')]({'port':0x232b});var client9001=jayson[_0xfa8b('0x14')]['http']({'port':0x2329});function respondWithRpcPromise(_0x2f5a02,_0x1c86bd,_0x2cc834,_0x5b457){return new BPromise(function(_0x161bf4,_0x51e5fe){var _0x29945d=_0x5b457||client;return _0x29945d['request'](_0x2f5a02,_0x2cc834)['then'](function(_0x22e883){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1c86bd,_0xfa8b('0x16'));logger[_0xfa8b('0x17')](_0xfa8b('0x18'),_0x1c86bd,_0xfa8b('0x16'),JSON[_0xfa8b('0x19')](_0x22e883));if(_0x22e883[_0xfa8b('0x1a')]){if(_0x22e883['error'][_0xfa8b('0x1b')]===0x1f4){logger[_0xfa8b('0x1a')](_0xfa8b('0x1c'),_0x1c86bd,_0x22e883[_0xfa8b('0x1a')]['message']);return _0x51e5fe(_0x22e883['error'][_0xfa8b('0x1d')]);}logger[_0xfa8b('0x1a')](_0xfa8b('0x1c'),_0x1c86bd,_0x22e883[_0xfa8b('0x1a')]['message']);return _0x161bf4(_0x22e883[_0xfa8b('0x1a')][_0xfa8b('0x1d')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1c86bd,_0xfa8b('0x16'));_0x161bf4(_0x22e883[_0xfa8b('0x1e')][_0xfa8b('0x1d')]);}})[_0xfa8b('0x1f')](function(_0x3216ce){logger[_0xfa8b('0x1a')](_0xfa8b('0x1c'),_0x1c86bd,_0x3216ce);_0x51e5fe(_0x3216ce);});});}function respondWithStatusCode(_0x367d25,_0x59dfbe){_0x59dfbe=_0x59dfbe||0xcc;return function(_0x178f1f){if(_0x178f1f){return _0x367d25[_0xfa8b('0x20')](_0x59dfbe);}return _0x367d25[_0xfa8b('0x21')](_0x59dfbe)['end']();};}function respondWithResult(_0x20d228,_0x29c826){_0x29c826=_0x29c826||0xc8;return function(_0x1e40e9){if(_0x1e40e9){return _0x20d228[_0xfa8b('0x21')](_0x29c826)[_0xfa8b('0x22')](_0x1e40e9);}};}function respondWithFilteredResult(_0x1a0b52,_0x22fcf5){return function(_0x10030a){if(_0x10030a){var _0x36ae73=typeof _0x22fcf5[_0xfa8b('0x23')]===_0xfa8b('0x24')&&typeof _0x22fcf5[_0xfa8b('0x25')]==='undefined';var _0x49046b=_0x10030a['count'];var _0x43abdf=_0x36ae73?0x0:_0x22fcf5[_0xfa8b('0x23')];var _0x571357=_0x36ae73?_0x10030a['count']:_0x22fcf5['offset']+_0x22fcf5[_0xfa8b('0x25')];var _0x4b9ad1;if(_0x571357>=_0x49046b){_0x571357=_0x49046b;_0x4b9ad1=0xc8;}else{_0x4b9ad1=0xce;}_0x1a0b52['status'](_0x4b9ad1);return _0x1a0b52[_0xfa8b('0x26')]('Content-Range',_0x43abdf+'-'+_0x571357+'/'+_0x49046b)[_0xfa8b('0x22')](_0x10030a);}return null;};}function saveUpdates(_0x151f8a){return function(_0x16fccd){if(_0x16fccd){return _0x16fccd[_0xfa8b('0x27')](_0x151f8a)[_0xfa8b('0x28')](function(_0x2238fa){return _0x2238fa;});}return null;};}function removeEntity(_0x315437){return function(_0x46bd32){if(_0x46bd32){return _0x46bd32[_0xfa8b('0x29')]()['then'](function(){var _0xdac368=_0x46bd32[_0xfa8b('0x2a')]({'plain':!![]});var _0x12c27f=_0xfa8b('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x12c27f,'resourceId':_0xdac368['id']}})['then'](function(){return _0x46bd32;});})['then'](function(){_0x315437[_0xfa8b('0x21')](0xcc)[_0xfa8b('0x2c')]();});}};}function handleEntityNotFound(_0x1dee7e){return function(_0x448973){if(!_0x448973){_0x1dee7e['sendStatus'](0x194);}return _0x448973;};}function handleError(_0x35b570,_0x150314){_0x150314=_0x150314||0x1f4;return function(_0x2d3bea){logger[_0xfa8b('0x1a')](_0x2d3bea[_0xfa8b('0x2d')]);if(_0x2d3bea[_0xfa8b('0x2e')]){delete _0x2d3bea[_0xfa8b('0x2e')];}_0x35b570[_0xfa8b('0x21')](_0x150314)['send'](_0x2d3bea);};}exports[_0xfa8b('0x2f')]=function(_0xf7dc99,_0x44201b){var _0x308d07={'include':[{'model':db[_0xfa8b('0x30')],'as':_0xfa8b('0x31')}]},_0x24e7f7={},_0x491e85={'count':0x0,'rows':[]};var _0x5677ad=_['map'](db[_0xfa8b('0x32')]['rawAttributes'],function(_0x6cfea0){return{'name':_0x6cfea0[_0xfa8b('0x33')],'type':_0x6cfea0['type'][_0xfa8b('0x34')]};});_0x24e7f7[_0xfa8b('0x35')]=_['map'](_0x5677ad,_0xfa8b('0x2e'));_0x24e7f7[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0xf7dc99[_0xfa8b('0x36')]);_0x24e7f7[_0xfa8b('0x38')]=_['intersection'](_0x24e7f7['model'],_0x24e7f7[_0xfa8b('0x36')]);_0x308d07[_0xfa8b('0x39')]=_[_0xfa8b('0x3a')](_0x24e7f7[_0xfa8b('0x35')],qs['fields'](_0xf7dc99[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0x308d07['attributes']=_0x308d07[_0xfa8b('0x39')][_0xfa8b('0x3c')]?_0x308d07[_0xfa8b('0x39')]:_0x24e7f7[_0xfa8b('0x35')];if(!_0xf7dc99[_0xfa8b('0x36')][_0xfa8b('0x3d')](_0xfa8b('0x3e'))){_0x308d07['limit']=qs[_0xfa8b('0x25')](_0xf7dc99['query'][_0xfa8b('0x25')]);_0x308d07[_0xfa8b('0x23')]=qs[_0xfa8b('0x23')](_0xf7dc99['query'][_0xfa8b('0x23')]);}_0x308d07[_0xfa8b('0x3f')]=qs[_0xfa8b('0x40')](_0xf7dc99['query'][_0xfa8b('0x40')]);_0x308d07['where']=qs[_0xfa8b('0x38')](_[_0xfa8b('0x41')](_0xf7dc99[_0xfa8b('0x36')],_0x24e7f7[_0xfa8b('0x38')]),_0x5677ad);if(_0xf7dc99[_0xfa8b('0x36')][_0xfa8b('0x42')]){_0x308d07['where']=_[_0xfa8b('0x43')](_0x308d07[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x5677ad,function(_0x25e76e){if(_0x25e76e[_0xfa8b('0x46')]!=='VIRTUAL'){var _0xce5f07={};_0xce5f07[_0x25e76e[_0xfa8b('0x2e')]]={'$like':'%'+_0xf7dc99['query'][_0xfa8b('0x42')]+'%'};return _0xce5f07;}})});}_0x308d07=_[_0xfa8b('0x43')]({},_0x308d07,_0xf7dc99['options']);var _0x195d47={'where':_0x308d07[_0xfa8b('0x44')]};return db['ChatWebsite'][_0xfa8b('0x47')](_0x195d47)[_0xfa8b('0x28')](function(_0x1f6913){_0x491e85[_0xfa8b('0x47')]=_0x1f6913;if(_0xf7dc99['query'][_0xfa8b('0x48')]){_0x308d07[_0xfa8b('0x49')]=[{'all':!![]}];}return db[_0xfa8b('0x32')][_0xfa8b('0x4a')](_0x308d07);})[_0xfa8b('0x28')](function(_0x2b75b6){_0x491e85[_0xfa8b('0x4b')]=_0x2b75b6;return _0x491e85;})[_0xfa8b('0x28')](respondWithFilteredResult(_0x44201b,_0x308d07))[_0xfa8b('0x1f')](handleError(_0x44201b,null));};exports[_0xfa8b('0x4c')]=function(_0x5be8e7,_0x30b7dc){var _0x40c247={'raw':![],'where':{'id':_0x5be8e7[_0xfa8b('0x4d')]['id']},'include':[{'model':db[_0xfa8b('0x30')],'as':'mandatoryDispositionPause'}]},_0x40c962={};_0x40c962[_0xfa8b('0x35')]=_['keys'](db[_0xfa8b('0x32')]['rawAttributes']);_0x40c962['query']=_[_0xfa8b('0x37')](_0x5be8e7[_0xfa8b('0x36')]);_0x40c962[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x40c962[_0xfa8b('0x35')],_0x40c962[_0xfa8b('0x36')]);_0x40c247[_0xfa8b('0x39')]=_['intersection'](_0x40c962[_0xfa8b('0x35')],qs['fields'](_0x5be8e7[_0xfa8b('0x36')]['fields']));_0x40c247[_0xfa8b('0x39')]=_0x40c247[_0xfa8b('0x39')][_0xfa8b('0x3c')]?_0x40c247[_0xfa8b('0x39')]:_0x40c962[_0xfa8b('0x35')];if(_0x5be8e7[_0xfa8b('0x36')][_0xfa8b('0x48')]){_0x40c247['include']=[{'all':!![]}];}_0x40c247=_[_0xfa8b('0x43')]({},_0x40c247,_0x5be8e7[_0xfa8b('0x4e')]);return db['ChatWebsite']['find'](_0x40c247)[_0xfa8b('0x28')](handleEntityNotFound(_0x30b7dc,null))[_0xfa8b('0x28')](respondWithResult(_0x30b7dc,null))[_0xfa8b('0x1f')](handleError(_0x30b7dc,null));};exports[_0xfa8b('0x4f')]=function(_0x3961ba,_0x421a49){return db['ChatWebsite'][_0xfa8b('0x4f')](_0x3961ba[_0xfa8b('0x50')],{})[_0xfa8b('0x28')](function(_0x3bf47a){var _0x55a11d=_0x3961ba[_0xfa8b('0x51')][_0xfa8b('0x2a')]({'plain':!![]});if(!_0x55a11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55a11d[_0xfa8b('0x52')]==='user'){var _0x44c528=_0x3bf47a['get']({'plain':!![]});var _0x289bbb=_0xfa8b('0x2b');return db[_0xfa8b('0x53')][_0xfa8b('0x54')]({'where':{'name':_0x289bbb,'userProfileId':_0x55a11d[_0xfa8b('0x55')]},'raw':!![]})[_0xfa8b('0x28')](function(_0x59dea8){if(_0x59dea8&&_0x59dea8[_0xfa8b('0x56')]===0x0){return db[_0xfa8b('0x57')][_0xfa8b('0x4f')]({'name':_0x44c528[_0xfa8b('0x2e')],'resourceId':_0x44c528['id'],'type':_0x59dea8['name'],'sectionId':_0x59dea8['id']},{})[_0xfa8b('0x28')](function(){return _0x3bf47a;});}else{return _0x3bf47a;}})[_0xfa8b('0x1f')](function(_0x5d1fe8){logger[_0xfa8b('0x1a')](_0xfa8b('0x58'),_0x5d1fe8);throw _0x5d1fe8;});}return _0x3bf47a;})['then'](respondWithResult(_0x421a49,0xc9))[_0xfa8b('0x1f')](handleError(_0x421a49,null));};exports[_0xfa8b('0x27')]=function(_0x1ee247,_0x15b367){if(_0x1ee247[_0xfa8b('0x50')]['id']){delete _0x1ee247[_0xfa8b('0x50')]['id'];}return db['ChatWebsite'][_0xfa8b('0x54')]({'where':{'id':_0x1ee247[_0xfa8b('0x4d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xfa8b('0x28')](handleEntityNotFound(_0x15b367,null))[_0xfa8b('0x28')](saveUpdates(_0x1ee247[_0xfa8b('0x50')],null))[_0xfa8b('0x28')](respondWithResult(_0x15b367,null))[_0xfa8b('0x1f')](handleError(_0x15b367,null));};exports[_0xfa8b('0x29')]=function(_0x4b69e1,_0x84c48d){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x4b69e1['params']['id']}})['then'](handleEntityNotFound(_0x84c48d,null))[_0xfa8b('0x28')](removeEntity(_0x84c48d,null))[_0xfa8b('0x1f')](handleError(_0x84c48d,null));};exports['describe']=function(_0x42dadf,_0x59f3cf){return db[_0xfa8b('0x32')][_0xfa8b('0x59')]()[_0xfa8b('0x28')](respondWithResult(_0x59f3cf,null))[_0xfa8b('0x1f')](handleError(_0x59f3cf,null));};exports[_0xfa8b('0x5a')]=function(_0x12fc6e,_0x53c40a){if(_0x12fc6e['body']['id']){delete _0x12fc6e['body']['id'];}return db['ChatWebsite'][_0xfa8b('0x54')]({'where':{'id':_0x12fc6e['params']['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x53c40a,null))[_0xfa8b('0x28')](function(_0x28fd67){if(_0x28fd67){_0x12fc6e[_0xfa8b('0x50')][_0xfa8b('0x5b')]=_0x28fd67['id'];return db['Disposition']['create'](_0x12fc6e[_0xfa8b('0x50')]);}})[_0xfa8b('0x28')](respondWithResult(_0x53c40a,null))[_0xfa8b('0x1f')](handleError(_0x53c40a,null));};exports[_0xfa8b('0x5c')]=function(_0x47c613,_0x461e16){var _0x23de4b={'raw':![],'where':{}};var _0x45c4ca={};var _0x3eea9c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfa8b('0x5d')]({'where':{'id':_0x47c613[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x461e16,null))['then'](function(_0x34f22e){if(_0x34f22e){_0x45c4ca[_0xfa8b('0x35')]=_[_0xfa8b('0x37')](db[_0xfa8b('0x5e')][_0xfa8b('0x5f')]);_0x45c4ca[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0x47c613[_0xfa8b('0x36')]);_0x45c4ca['filters']=_[_0xfa8b('0x3a')](_0x45c4ca['model'],_0x45c4ca[_0xfa8b('0x36')]);_0x23de4b[_0xfa8b('0x39')]=_[_0xfa8b('0x3a')](_0x45c4ca[_0xfa8b('0x35')],qs['fields'](_0x47c613['query'][_0xfa8b('0x3b')]));_0x23de4b[_0xfa8b('0x39')]=_0x23de4b[_0xfa8b('0x39')]['length']?_0x23de4b[_0xfa8b('0x39')]:_0x45c4ca['model'];if(!_0x47c613[_0xfa8b('0x36')][_0xfa8b('0x3d')](_0xfa8b('0x3e'))){_0x23de4b[_0xfa8b('0x25')]=qs['limit'](_0x47c613[_0xfa8b('0x36')][_0xfa8b('0x25')]);_0x23de4b['offset']=qs[_0xfa8b('0x23')](_0x47c613['query']['offset']);}_0x23de4b[_0xfa8b('0x3f')]=qs[_0xfa8b('0x40')](_0x47c613['query'][_0xfa8b('0x40')]);_0x23de4b['where']=qs[_0xfa8b('0x38')](_[_0xfa8b('0x41')](_0x47c613[_0xfa8b('0x36')],_0x45c4ca[_0xfa8b('0x38')]));_0x23de4b[_0xfa8b('0x44')]['ChatWebsiteId']=_0x34f22e['id'];if(_0x47c613[_0xfa8b('0x36')]['filter']){_0x23de4b['where']=_[_0xfa8b('0x43')](_0x23de4b[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x23de4b[_0xfa8b('0x39')],function(_0x2f726b){var _0x261a75={};_0x261a75[_0x2f726b]={'$like':'%'+_0x47c613[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x261a75;})});}_0x23de4b=_[_0xfa8b('0x43')]({},_0x23de4b,_0x47c613['options']);return db['Disposition'][_0xfa8b('0x47')]({'where':_0x23de4b['where']})['then'](function(_0x1d8de4){_0x3eea9c[_0xfa8b('0x47')]=_0x1d8de4;if(_0x47c613[_0xfa8b('0x36')][_0xfa8b('0x48')]){_0x23de4b[_0xfa8b('0x49')]=[{'all':!![]}];}return db[_0xfa8b('0x5e')][_0xfa8b('0x4a')](_0x23de4b);})[_0xfa8b('0x28')](function(_0x1d8d73){_0x3eea9c[_0xfa8b('0x4b')]=_0x1d8d73;return _0x3eea9c;});}})[_0xfa8b('0x28')](respondWithFilteredResult(_0x461e16,_0x23de4b))[_0xfa8b('0x1f')](handleError(_0x461e16,null));};exports[_0xfa8b('0x60')]=function(_0xb8a0ba,_0x1f1678){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0xb8a0ba[_0xfa8b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1f1678,null))[_0xfa8b('0x28')](function(_0x1e8b97){if(_0x1e8b97){return _0x1e8b97[_0xfa8b('0x60')](_0xb8a0ba['query']['ids']);}})[_0xfa8b('0x28')](respondWithStatusCode(_0x1f1678,null))[_0xfa8b('0x1f')](handleError(_0x1f1678,null));};exports[_0xfa8b('0x61')]=function(_0x29ec9d,_0xcaf4b){if(_0x29ec9d[_0xfa8b('0x50')]['id']){delete _0x29ec9d[_0xfa8b('0x50')]['id'];}return db['ChatWebsite'][_0xfa8b('0x54')]({'where':{'id':_0x29ec9d[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0xcaf4b,null))['then'](function(_0x13b378){if(_0x13b378){_0x29ec9d[_0xfa8b('0x50')][_0xfa8b('0x5b')]=_0x13b378['id'];return db[_0xfa8b('0x62')][_0xfa8b('0x4f')](_0x29ec9d[_0xfa8b('0x50')]);}})[_0xfa8b('0x28')](respondWithResult(_0xcaf4b,null))['catch'](handleError(_0xcaf4b,null));};exports[_0xfa8b('0x63')]=function(_0x2fc45e,_0x334201){var _0x23f492={'raw':![],'where':{}};var _0x1adf10={};var _0x236ff4={'count':0x0,'rows':[]};return db[_0xfa8b('0x32')]['findOne']({'where':{'id':_0x2fc45e[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x334201,null))[_0xfa8b('0x28')](function(_0xd77a72){if(_0xd77a72){_0x1adf10[_0xfa8b('0x35')]=_['keys'](db['CannedAnswer'][_0xfa8b('0x5f')]);_0x1adf10[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0x2fc45e[_0xfa8b('0x36')]);_0x1adf10[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x1adf10['model'],_0x1adf10[_0xfa8b('0x36')]);_0x23f492[_0xfa8b('0x39')]=_[_0xfa8b('0x3a')](_0x1adf10[_0xfa8b('0x35')],qs['fields'](_0x2fc45e[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0x23f492['attributes']=_0x23f492[_0xfa8b('0x39')][_0xfa8b('0x3c')]?_0x23f492['attributes']:_0x1adf10['model'];if(!_0x2fc45e['query'][_0xfa8b('0x3d')](_0xfa8b('0x3e'))){_0x23f492[_0xfa8b('0x25')]=qs['limit'](_0x2fc45e[_0xfa8b('0x36')][_0xfa8b('0x25')]);_0x23f492[_0xfa8b('0x23')]=qs[_0xfa8b('0x23')](_0x2fc45e[_0xfa8b('0x36')][_0xfa8b('0x23')]);}_0x23f492[_0xfa8b('0x3f')]=qs[_0xfa8b('0x40')](_0x2fc45e['query'][_0xfa8b('0x40')]);_0x23f492[_0xfa8b('0x44')]=qs[_0xfa8b('0x38')](_[_0xfa8b('0x41')](_0x2fc45e[_0xfa8b('0x36')],_0x1adf10[_0xfa8b('0x38')]));_0x23f492[_0xfa8b('0x44')][_0xfa8b('0x5b')]=_0xd77a72['id'];if(_0x2fc45e[_0xfa8b('0x36')]['filter']){_0x23f492[_0xfa8b('0x44')]=_['merge'](_0x23f492[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x23f492['attributes'],function(_0xda332b){var _0x1e76fe={};_0x1e76fe[_0xda332b]={'$like':'%'+_0x2fc45e[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x1e76fe;})});}_0x23f492=_[_0xfa8b('0x43')]({},_0x23f492,_0x2fc45e[_0xfa8b('0x4e')]);return db[_0xfa8b('0x62')][_0xfa8b('0x47')]({'where':_0x23f492[_0xfa8b('0x44')]})[_0xfa8b('0x28')](function(_0x37b97b){_0x236ff4[_0xfa8b('0x47')]=_0x37b97b;if(_0x2fc45e['query'][_0xfa8b('0x48')]){_0x23f492[_0xfa8b('0x49')]=[{'all':!![]}];}return db[_0xfa8b('0x62')][_0xfa8b('0x4a')](_0x23f492);})[_0xfa8b('0x28')](function(_0x45ee0f){_0x236ff4['rows']=_0x45ee0f;return _0x236ff4;});}})[_0xfa8b('0x28')](respondWithFilteredResult(_0x334201,_0x23f492))['catch'](handleError(_0x334201,null));};exports[_0xfa8b('0x64')]=function(_0x158a0c,_0x5d6209){return db['ChatWebsite']['find']({'where':{'id':_0x158a0c['params']['id']}})['then'](handleEntityNotFound(_0x5d6209,null))['then'](function(_0x1a693f){if(_0x1a693f){return _0x1a693f[_0xfa8b('0x64')](_0x158a0c[_0xfa8b('0x36')][_0xfa8b('0x65')]);}})[_0xfa8b('0x28')](respondWithStatusCode(_0x5d6209,null))[_0xfa8b('0x1f')](handleError(_0x5d6209,null));};exports[_0xfa8b('0x66')]=function(_0x977977,_0x473b91){_0x977977[_0xfa8b('0x50')][_0xfa8b('0x67')]=_0x977977[_0xfa8b('0x68')]['filename'];return db[_0xfa8b('0x32')]['find']({'where':{'id':_0x977977[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x473b91,null))[_0xfa8b('0x28')](saveUpdates(_0x977977[_0xfa8b('0x50')],null))[_0xfa8b('0x28')](respondWithResult(_0x473b91,null))[_0xfa8b('0x1f')](handleError(_0x473b91,null));};exports[_0xfa8b('0x69')]=function(_0x108be6,_0x1a2c8a){_0x108be6['body']['agentAvatar']=_0x108be6[_0xfa8b('0x68')][_0xfa8b('0x6a')];return db['ChatWebsite'][_0xfa8b('0x54')]({'where':{'id':_0x108be6['params']['id']}})['then'](handleEntityNotFound(_0x1a2c8a,null))[_0xfa8b('0x28')](saveUpdates(_0x108be6[_0xfa8b('0x50')],null))['then'](respondWithResult(_0x1a2c8a,null))[_0xfa8b('0x1f')](handleError(_0x1a2c8a,null));};exports[_0xfa8b('0x6b')]=function(_0x137af7,_0x4679a0){_0x137af7[_0xfa8b('0x50')][_0xfa8b('0x6c')]=_0x137af7[_0xfa8b('0x68')]['filename'];return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x137af7[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x4679a0,null))[_0xfa8b('0x28')](saveUpdates(_0x137af7[_0xfa8b('0x50')],null))[_0xfa8b('0x28')](respondWithResult(_0x4679a0,null))[_0xfa8b('0x1f')](handleError(_0x4679a0,null));};exports[_0xfa8b('0x6d')]=function(_0x1dd0ff,_0x2db0d2){_0x1dd0ff[_0xfa8b('0x50')]['systemAvatar']=_0x1dd0ff[_0xfa8b('0x68')][_0xfa8b('0x6a')];return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x1dd0ff['params']['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x2db0d2,null))[_0xfa8b('0x28')](saveUpdates(_0x1dd0ff[_0xfa8b('0x50')],null))['then'](respondWithResult(_0x2db0d2,null))[_0xfa8b('0x1f')](handleError(_0x2db0d2,null));};exports[_0xfa8b('0x6e')]=function(_0x276636,_0x125747){var _0x568715=path[_0xfa8b('0x6f')](config['root'],_0xfa8b('0x70'));var _0x1e5017={'where':{'id':_0x276636[_0xfa8b('0x4d')]['id']},'attributes':['id',_0xfa8b('0x67')],'raw':!![]};var _0x3a1d14=![];return require(_0xfa8b('0x71'))[_0xfa8b('0x72')]()['then'](function(_0x4a5527){if(_0x4a5527){_0x3a1d14=_0x4a5527[_0xfa8b('0x73')];}})[_0xfa8b('0x28')](function(){return db['ChatWebsite'][_0xfa8b('0x54')](_0x1e5017);})[_0xfa8b('0x28')](handleEntityNotFound(_0x125747,null))[_0xfa8b('0x28')](function(_0x37d9f1){if(_0x37d9f1){if(!_[_0xfa8b('0x74')](_0x37d9f1[_0xfa8b('0x67')])){if(fs['existsSync'](path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],'server/files/images/logos/',_0x37d9f1[_0xfa8b('0x67')]))&&_0x3a1d14){_0x568715=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x76'),_0x37d9f1[_0xfa8b('0x67')]);}}return _0x125747[_0xfa8b('0x77')](_0x568715);}})['catch'](handleError(_0x125747,null));};exports[_0xfa8b('0x78')]=function(_0x44c84a,_0xecfc27){var _0x19fa95=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x79'));var _0x2ee9ea={'where':{'id':_0x44c84a[_0xfa8b('0x4d')]['id']},'attributes':['id',_0xfa8b('0x7a')],'raw':!![]};return db[_0xfa8b('0x32')][_0xfa8b('0x54')](_0x2ee9ea)[_0xfa8b('0x28')](handleEntityNotFound(_0xecfc27,null))[_0xfa8b('0x28')](function(_0x4ecb5c){if(_0x4ecb5c){if(!_[_0xfa8b('0x74')](_0x4ecb5c[_0xfa8b('0x7a')])){if(fs[_0xfa8b('0x7b')](path[_0xfa8b('0x6f')](config['root'],_0xfa8b('0x7c'),_0x4ecb5c[_0xfa8b('0x7a')]))){_0x19fa95=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x7c'),_0x4ecb5c[_0xfa8b('0x7a')]);}}return _0xecfc27[_0xfa8b('0x77')](_0x19fa95);}})[_0xfa8b('0x1f')](handleError(_0xecfc27,null));};exports[_0xfa8b('0x7d')]=function(_0x4599ad,_0x55d6aa){var _0x41c881=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x7e'));var _0xbb8e87={'where':{'id':_0x4599ad[_0xfa8b('0x4d')]['id']},'attributes':['id',_0xfa8b('0x6c'),_0xfa8b('0x7f')],'raw':!![]};return db[_0xfa8b('0x32')][_0xfa8b('0x54')](_0xbb8e87)['then'](handleEntityNotFound(_0x55d6aa,null))['then'](function(_0x3013a0){if(_0x3013a0){if(!_[_0xfa8b('0x74')](_0x3013a0[_0xfa8b('0x6c')])){if(fs[_0xfa8b('0x7b')](path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x7c'),_0x3013a0['customerAvatar']))&&_0x3013a0[_0xfa8b('0x7f')]){_0x41c881=path['join'](config[_0xfa8b('0x75')],'server/files/images/avatars/',_0x3013a0[_0xfa8b('0x6c')]);}}return _0x55d6aa['download'](_0x41c881);}})[_0xfa8b('0x1f')](handleError(_0x55d6aa,null));};exports[_0xfa8b('0x80')]=function(_0x139429,_0x5c5233){var _0x50b1bd=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x81'));var _0x34c903={'where':{'id':_0x139429[_0xfa8b('0x4d')]['id']},'attributes':['id',_0xfa8b('0x82')],'raw':!![]};return db[_0xfa8b('0x32')][_0xfa8b('0x54')](_0x34c903)[_0xfa8b('0x28')](handleEntityNotFound(_0x5c5233,null))[_0xfa8b('0x28')](function(_0x2b71c2){if(_0x2b71c2){if(!_[_0xfa8b('0x74')](_0x2b71c2['systemAvatar'])){if(fs[_0xfa8b('0x7b')](path[_0xfa8b('0x6f')](config['root'],_0xfa8b('0x7c'),_0x2b71c2['systemAvatar']))){_0x50b1bd=path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],'server/files/images/avatars/',_0x2b71c2[_0xfa8b('0x82')]);}}return _0x5c5233['download'](_0x50b1bd);}})[_0xfa8b('0x1f')](handleError(_0x5c5233,null));};exports[_0xfa8b('0x83')]=function(_0x203a83,_0x3803e1){var _0x295a39=require(_0xfa8b('0x84'));var _0x4671d7=new _0x295a39();var _0x56f951=_0x4671d7[_0xfa8b('0x85')](_0x203a83[_0xfa8b('0x86')][_0xfa8b('0x87')])[_0xfa8b('0x88')]();var _0x2a54e6={'body':_0x203a83[_0xfa8b('0x50')],'channel':'chat'};var _0x5c2c50=[];var _0x23d66f=[];var _0x38c4e1={};var _0x4ef82d=![];return db[_0xfa8b('0x89')]['describe']()[_0xfa8b('0x28')](function(_0xe226a2){if(!_0xe226a2){throw new db[(_0xfa8b('0x8a'))][(_0xfa8b('0x8b'))](_0xfa8b('0x8c'));}_0x5c2c50=_[_0xfa8b('0x8d')](_['keys'](_0xe226a2),[_0xfa8b('0x8e'),_0xfa8b('0x8f')]);_0x23d66f=_[_0xfa8b('0x8d')](_[_0xfa8b('0x37')](_0xe226a2),[_0xfa8b('0x8e'),_0xfa8b('0x8f'),_0xfa8b('0x90'),'ListId']);if(_0x203a83['body']['id']){delete _0x203a83[_0xfa8b('0x50')]['id'];}if(_[_0xfa8b('0x74')](_0x203a83[_0xfa8b('0x50')][_0xfa8b('0x91')])){throw new db[(_0xfa8b('0x8a'))][(_0xfa8b('0x8b'))](_0xfa8b('0x92'));}if(_[_0xfa8b('0x74')](_0x203a83[_0xfa8b('0x50')]['body'])||_0x203a83[_0xfa8b('0x50')][_0xfa8b('0x50')]===''){throw new db[(_0xfa8b('0x8a'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfa8b('0x74')](_0x203a83['body'][_0xfa8b('0x93')])){throw new db['Sequelize'][(_0xfa8b('0x8b'))](_0xfa8b('0x94')+_0x23d66f);}if(!_[_0xfa8b('0x95')](_0x23d66f,_0x203a83['body']['mapKey'])){throw new db[(_0xfa8b('0x8a'))][(_0xfa8b('0x8b'))](_0xfa8b('0x96')+_0x23d66f);}_0x38c4e1[_0x203a83[_0xfa8b('0x50')][_0xfa8b('0x93')]]=_0x203a83[_0xfa8b('0x50')][_0xfa8b('0x91')];})[_0xfa8b('0x28')](function(){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x203a83[_0xfa8b('0x4d')]['id']},'include':[{'model':db[_0xfa8b('0x97')],'as':_0xfa8b('0x98'),'include':[{'model':db[_0xfa8b('0x89')],'as':'Contacts','where':_0x38c4e1,'limit':0x1,'order':[[_0xfa8b('0x8f'),_0xfa8b('0x99')]]}]},{'model':db['ChatApplication'],'as':_0xfa8b('0x9a')}]});})[_0xfa8b('0x28')](handleEntityNotFound(_0x3803e1,null))[_0xfa8b('0x28')](function(_0x16cbb9){if(_0x16cbb9&&_0x16cbb9[_0xfa8b('0x98')]){_0x2a54e6[_0xfa8b('0x9b')]=_0x16cbb9;_0x2a54e6[_0xfa8b('0x9c')]=_0x16cbb9[_0xfa8b('0x9a')];_0x2a54e6[_0xfa8b('0x9d')]=_0x16cbb9['List'];_0x2a54e6[_0xfa8b('0x9c')]=_[_0xfa8b('0x9e')](_0x2a54e6[_0xfa8b('0x9c')],[_0xfa8b('0x9f')],[_0xfa8b('0xa0')]);if(_0x2a54e6[_0xfa8b('0x9b')][_0xfa8b('0x9a')]){delete _0x2a54e6['account'][_0xfa8b('0x9a')];}if(_0x2a54e6[_0xfa8b('0x9b')][_0xfa8b('0x98')]&&_0x2a54e6[_0xfa8b('0x9b')][_0xfa8b('0x98')]['Contacts'][_0xfa8b('0x3c')]){return _0x2a54e6[_0xfa8b('0x9b')][_0xfa8b('0x98')][_0xfa8b('0xa1')][0x0];}var _0x219aff=_['defaults'](_0x203a83[_0xfa8b('0x50')],{'firstName':_0x203a83['body'][_0xfa8b('0x91')],'ListId':_0x16cbb9[_0xfa8b('0xa2')]});_0x219aff[_0x203a83['body'][_0xfa8b('0x93')]]=_0x203a83[_0xfa8b('0x50')]['from'];return db[_0xfa8b('0x89')][_0xfa8b('0x4f')](_0x219aff,{'fields':_0x5c2c50,'raw':!![]});}})[_0xfa8b('0x28')](handleEntityNotFound(_0x3803e1,null))[_0xfa8b('0x28')](function(_0x51e040){_0x2a54e6[_0xfa8b('0xa3')]=_0x51e040;var _0x68502f=_0x203a83[_0xfa8b('0x50')]['customerIp'];if(_0x203a83['headers'][_0xfa8b('0xa4')]){_0x68502f=_0x203a83[_0xfa8b('0x86')]['cf-connecting-ip'];}else if(_0x203a83['headers'][_0xfa8b('0xa5')]){_0x68502f=_[_0xfa8b('0xa6')](_0x203a83[_0xfa8b('0x86')][_0xfa8b('0xa5')][_0xfa8b('0xa7')](','));}if(_0x51e040){var _0x3bda43={'ContactId':_0x51e040['id'],'ChatWebsiteId':_0x203a83['params']['id'],'from':(_0x51e040[_0xfa8b('0xa8')]||'')+'\x20'+(_0x51e040[_0xfa8b('0xa9')]||''),'customerIp':_0x68502f,'customerPort':_0x203a83['headers']['x-real-port']?_0x203a83[_0xfa8b('0x86')]['x-real-port']:null,'referer':_0x203a83[_0xfa8b('0x50')][_0xfa8b('0xaa')],'browserName':_0x56f951['browser'][_0xfa8b('0x2e')]&&_0x56f951['browser']['version']?util[_0xfa8b('0xab')](_0xfa8b('0xac'),_0x56f951['browser'][_0xfa8b('0x2e')],_0x56f951[_0xfa8b('0xad')][_0xfa8b('0xae')]):_0xfa8b('0xaf'),'browserVersion':_0x56f951[_0xfa8b('0xad')][_0xfa8b('0xae')]||_0xfa8b('0xaf'),'osName':util['format']('%s\x20%s',_0x56f951['os'][_0xfa8b('0x2e')],_0x56f951['os'][_0xfa8b('0xae')]),'osVersion':_0x56f951['os'][_0xfa8b('0xae')],'deviceModel':_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0x35')]&&_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0xb1')]?util[_0xfa8b('0xab')]('%s\x20%s\x20%s',_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0x35')],_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0xb1')],_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0x46')]):null,'deviceVendor':_0x56f951[_0xfa8b('0xb0')][_0xfa8b('0xb1')],'deviceType':_0x56f951[_0xfa8b('0xb0')]['type'],'formData':JSON[_0xfa8b('0x19')](_0x203a83[_0xfa8b('0x50')])};var _0x2af240={'ChatWebsiteId':_0x203a83[_0xfa8b('0x4d')]['id'],'closed':![]};if(_0x203a83[_0xfa8b('0x50')]['threadId']){_0x2af240[_0xfa8b('0xb2')]=_0x203a83[_0xfa8b('0x50')][_0xfa8b('0xb2')];return db[_0xfa8b('0xb3')]['find']({'where':_0x2af240})[_0xfa8b('0x28')](function(_0x3f80ef){if(_0x3f80ef){return[_0x3f80ef,![]];}_0x3bda43['threadId']=_0x203a83['body']['threadId'];_0x3bda43[_0xfa8b('0xb4')]=_0x203a83[_0xfa8b('0x50')]['externalUrl'];return db[_0xfa8b('0xb3')]['create'](_0x3bda43)[_0xfa8b('0x28')](function(_0x54b7c8){return[_0x54b7c8,!![]];});});}_0x2af240[_0xfa8b('0xb5')]=_0x51e040['id'];if(_0x203a83['body'][_0xfa8b('0xb6')]&&_0x203a83[_0xfa8b('0x50')]['interaction']['id']){_0x2af240['id']=_0x203a83['body'][_0xfa8b('0xb6')]['id'];return db['ChatInteraction'][_0xfa8b('0x54')]({'where':_0x2af240})[_0xfa8b('0x28')](function(_0x1fcdab){if(_0x1fcdab){return[_0x1fcdab,![]];}return db[_0xfa8b('0xb3')]['create'](_0x3bda43)['then'](function(_0x19b2e7){return[_0x19b2e7,!![]];});});}return db[_0xfa8b('0xb3')]['create'](_0x3bda43)[_0xfa8b('0x28')](function(_0x6f005c){return[_0x6f005c,!![]];});}})[_0xfa8b('0xb7')](function(_0x4e6e79,_0x29d891){if(_0x4e6e79){_0x4ef82d=_0x29d891;if(!_0x29d891){var _0x405c13={'from':(_0x2a54e6[_0xfa8b('0xa3')]['firstName']||'')+'\x20'+(_0x2a54e6[_0xfa8b('0xa3')][_0xfa8b('0xa9')]||'')};if(_0x203a83[_0xfa8b('0x50')][_0xfa8b('0xb2')]&&_0x203a83['body'][_0xfa8b('0xb8')]&&_0x203a83[_0xfa8b('0x50')]['threadId']!=_0x203a83['body']['messageId']){_0x405c13[_0xfa8b('0xb2')]=_0x203a83[_0xfa8b('0x50')][_0xfa8b('0xb8')];}return _0x4e6e79[_0xfa8b('0x27')](_0x405c13);}else{return _0x4e6e79;}}})['then'](function(_0x4e7273){_0x2a54e6[_0xfa8b('0xb6')]=_0x4e7273[_0xfa8b('0x2a')]({'plain':!![]});_0x2a54e6[_0xfa8b('0xb6')][_0xfa8b('0xb9')]=_0x4ef82d;if(_0x2a54e6['interaction'][_0xfa8b('0xb9')]){if(_0x2a54e6[_0xfa8b('0x9b')]['autoclose']){_0x2a54e6[_0xfa8b('0x9c')]['push']({'id':0x0,'priority':_0x2a54e6['applications'][_0xfa8b('0x3c')]+0x1,'app':_0xfa8b('0xba'),'appdata':_0xfa8b('0xbb'),'interval':_0xfa8b('0xbc')});}}return db[_0xfa8b('0xbd')]['create']({'body':_0x203a83[_0xfa8b('0x50')][_0xfa8b('0x50')],'ChatWebsiteId':_0x203a83[_0xfa8b('0x4d')]['id'],'ChatInteractionId':_0x4e7273['id'],'direction':'in','ContactId':_0x2a54e6[_0xfa8b('0xa3')]['id'],'AttachmentId':_0x203a83[_0xfa8b('0x50')][_0xfa8b('0xbe')]});})['then'](function(_0x18d255){_0x2a54e6[_0xfa8b('0x1d')]=_0x18d255;if(_0x2a54e6[_0xfa8b('0xb6')][_0xfa8b('0xbf')]){return db[_0xfa8b('0xc0')]['find']({'attributes':['id',_0xfa8b('0x2e')],'where':{'id':_0x2a54e6['interaction'][_0xfa8b('0xbf')]}})['then'](function(_0xdd9018){if(_0xdd9018){_0x2a54e6[_0xfa8b('0x9c')][_0xfa8b('0xc1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xdd9018['name']+','+(_0x2a54e6[_0xfa8b('0x9b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x2a54e6[_0xfa8b('0xc2')]=!![];}return respondWithRpcPromise('Start',_0xfa8b('0xc3'),_0x2a54e6);});}return respondWithRpcPromise(_0xfa8b('0xc4'),'startRouting',_0x2a54e6);})['then'](function(_0x3ce468){respondWithRpcPromise('EventManager','EventManager',{'event':_0xfa8b('0x83'),'message':_0x3ce468},client9002);return _0x3ce468;})[_0xfa8b('0x28')](respondWithResult(_0x3803e1,null))[_0xfa8b('0x1f')](handleError(_0x3803e1,null));};exports['offline']=function(_0x1b6ef8,_0x2c28ec){var _0x6fa660,_0x1e06db,_0x2889b1;var _0x400104=[];var _0x5bae84={};var _0x23252c=_0x1b6ef8[_0xfa8b('0xc5')]||[];var _0x241e25=[];var _0x295ba0;return db[_0xfa8b('0x89')]['describe']()['then'](function(_0x15d913){if(!_0x15d913){throw new db[(_0xfa8b('0x8a'))][(_0xfa8b('0x8b'))](_0xfa8b('0x8c'));}_0x400104=_[_0xfa8b('0x8d')](_[_0xfa8b('0x37')](_0x15d913),[_0xfa8b('0x8e'),'updatedAt',_0xfa8b('0x90'),'ListId']);if(_0x1b6ef8[_0xfa8b('0x50')]['id']){delete _0x1b6ef8[_0xfa8b('0x50')]['id'];}if(_[_0xfa8b('0x74')](_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0x91')])){throw _0x2c28ec[_0xfa8b('0x21')](0x1f4)[_0xfa8b('0xc6')](new db['Sequelize'][(_0xfa8b('0x8b'))](_0xfa8b('0x92')));}if(_[_0xfa8b('0x74')](_0x1b6ef8['body'][_0xfa8b('0x50')])||_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0x50')]===''){throw _0x2c28ec['status'](0x1f4)[_0xfa8b('0xc6')](new db['Sequelize'][(_0xfa8b('0x8b'))](_0xfa8b('0xc7')));}if(_['isNil'](_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0xc8')])){throw _0x2c28ec[_0xfa8b('0x21')](0x1f4)[_0xfa8b('0xc6')](new db['Sequelize'][(_0xfa8b('0x8b'))](_0xfa8b('0xc9')+_0x400104));}if(!_['includes'](_0x400104,_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0xc8')])){throw _0x2c28ec['status'](0x1f4)[_0xfa8b('0xc6')](new db[(_0xfa8b('0x8a'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x400104));}_0x5bae84[_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0xc8')]]=_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0x91')];})[_0xfa8b('0x28')](function(){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x1b6ef8[_0xfa8b('0x4d')]['id']},'include':[{'model':db[_0xfa8b('0x97')],'as':_0xfa8b('0x98')},{'model':db[_0xfa8b('0xca')],'as':_0xfa8b('0xca')}]});})['then'](handleEntityNotFound(_0x2c28ec,null))[_0xfa8b('0x28')](function(_0x1526db){if(_0x1526db&&_0x1526db[_0xfa8b('0x98')]){_0x1e06db=_0x1526db;var _0x4f5c35=_[_0xfa8b('0xd')](_0x1b6ef8['body'],{'firstName':_0x1b6ef8[_0xfa8b('0x50')]['from'],'phone':_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0x91')],'ListId':_0x1526db['ListId']});_0x4f5c35[_0x1b6ef8[_0xfa8b('0x50')]['mapKeyOffline']]=_0x1b6ef8[_0xfa8b('0x50')][_0xfa8b('0x91')];return db['CmContact'][_0xfa8b('0xcb')]({'where':_0x5bae84,'defaults':_0x4f5c35});}})['spread'](function(_0x44c640){if(_0x44c640){_0x2889b1=_0x44c640;var _0xe43d48=fs[_0xfa8b('0xcc')](path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],'server/files/templates/chatOfflineMessage.ejs'),_0xfa8b('0xcd'));var _0xafe54c=ejs[_0xfa8b('0xce')](_0xe43d48,{'body':_[_0xfa8b('0xcf')](_0x1b6ef8['body'][_0xfa8b('0x50')]),'bodyTitle':_0x1e06db[_0xfa8b('0xd0')]});return db['ChatOfflineMessage'][_0xfa8b('0x4f')]({'body':_0xafe54c,'plainBody':htmlToText['fromString'](_0xafe54c),'ContactId':_0x44c640['id'],'ChatWebsiteId':_0x1e06db['id']});}})[_0xfa8b('0x28')](function(_0x4fb0d0){_0x295ba0=_0x4fb0d0;if(_0x23252c[_0xfa8b('0x3c')]){var _0x365034=_0x23252c[_0xfa8b('0x45')](function(_0x336ec0){return{'name':_0x336ec0[_0xfa8b('0xd1')],'basename':_0x336ec0[_0xfa8b('0x6a')],'type':_0x336ec0[_0xfa8b('0xd2')],'ChatOfflineMessageId':_0x4fb0d0['id']};});_0x241e25=_0x365034['map'](_0x386a8d=>{var _0x2265ec={'filename':_0x386a8d[_0xfa8b('0x2e')],'path':path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0xd3'),'files','attachments','offline-chat',_0x386a8d[_0xfa8b('0xd4')])};return _0x2265ec;});if(!_0x1e06db[_0xfa8b('0xd5')]){return db[_0xfa8b('0xd6')][_0xfa8b('0xd7')](function(_0x62d038){return db[_0xfa8b('0xd8')][_0xfa8b('0xd9')](_0x365034,{'transaction':_0x62d038});});}}})['then'](function(){if(_0x295ba0){_0x6fa660=_0x295ba0;return db[_0xfa8b('0xca')][_0xfa8b('0x5d')]({'where':{'service':!![]},'include':[{'model':db[_0xfa8b('0xda')],'as':_0xfa8b('0xdb'),'raw':!![],'include':[{'model':db[_0xfa8b('0xdc')],'as':_0xfa8b('0xdc'),'raw':!![]}]}]});}})[_0xfa8b('0x28')](function(_0x36418e){if(_0x36418e&&_0x36418e[_0xfa8b('0xdb')]&&_0x1e06db[_0xfa8b('0xdd')]&&_0x1e06db['forwardOfflineAddress']){var _0xf0ae83=_0x36418e['getSmtpOptions']();return respondWithRpcPromise(_0xfa8b('0xde'),_0xfa8b('0xdf'),{'account':_0xf0ae83,'message':{'from':util[_0xfa8b('0xab')]('\x22%s\x22\x20<%s>',_0x36418e['name'],_0x36418e[_0xfa8b('0xe0')]||_0x36418e[_0xfa8b('0xdb')]['user']),'to':_0x1e06db[_0xfa8b('0xe1')],'subject':_0x1e06db[_0xfa8b('0xe2')],'html':_0x6fa660[_0xfa8b('0x50')],'attachments':_0x241e25}},client9003)[_0xfa8b('0x28')](function(){return _0x6fa660;})['catch'](function(_0x1eaef4){logger['error'](_0x1eaef4);});}})[_0xfa8b('0x28')](function(){if(_0x1e06db&&_0x1e06db[_0xfa8b('0xd5')]&&_0x1e06db[_0xfa8b('0xe3')]){var _0x54bf21=[];if(_0x23252c[_0xfa8b('0x3c')]){_0x54bf21=_0x23252c[_0xfa8b('0x45')](function(_0x219811){return{'name':_0x219811[_0xfa8b('0xd1')],'basename':_0x219811[_0xfa8b('0x6a')],'type':_0x219811[_0xfa8b('0xd2')],'ChatOfflineMessageId':_0x295ba0['id']};});}var _0x324bf7;if(!_[_0xfa8b('0x74')](_0x1e06db[_0xfa8b('0xe4')])){var _0x357e40=_[_0xfa8b('0x45')](_0x1b6ef8[_0xfa8b('0x50')],function(_0x596137){return _0x596137;});var _0x4e4540=_[_0xfa8b('0xe5')](_0x357e40)[0x0];var _0x2c7222=_[_0xfa8b('0xe6')](_0x4e4540,function(_0x4de100){return _0x4de100;});_0x324bf7=_0x2c7222[0x1][_0x1e06db[_0xfa8b('0xe4')]];}var _0x40bb3b={'from':_0x2889b1[_0xfa8b('0xe0')],'firstName':_0x2889b1['firstName'],'lastName':_0x2889b1[_0xfa8b('0xa9')],'mapKey':_0xfa8b('0xe0'),'message':{'from':_0x2889b1[_0xfa8b('0xe0')],'to':_0x1e06db[_0xfa8b('0xca')][_0xfa8b('0xe0')],'cc':'','subject':_['isNil'](_0x324bf7)?_0x1e06db[_0xfa8b('0xe2')]:_0x324bf7,'messageId':'','sentAt':new Date(),'attach':_0x54bf21['length'],'attachments':_0x54bf21,'originChannel':_0xfa8b('0xe7'),'ChatWebsiteId':_0x1e06db['id'],'ChatOfflineMessageId':_0x6fa660['id'],'originTo':_0x1e06db[_0xfa8b('0xca')][_0xfa8b('0xe0')]},'body':_0x6fa660['body']};var _0x3c1d2e={'account':{'id':_0x1e06db[_0xfa8b('0xe3')]},'body':_0x40bb3b,'log':_0xfa8b('0xe8')};return respondWithRpcPromise(_0xfa8b('0xe8'),_0xfa8b('0xe9'),_0x3c1d2e,client9001)[_0xfa8b('0x28')](function(){return _0x6fa660;})[_0xfa8b('0x1f')](function(_0x2de3e3){logger[_0xfa8b('0x1a')](_0x2de3e3);});}return;})[_0xfa8b('0x28')](function(){if(_0x6fa660){return _0x6fa660;}})['then'](respondWithResult(_0x2c28ec,null))['catch'](function(_0x72f153){logger[_0xfa8b('0x1a')](_0xfa8b('0x1f'),_0x72f153);for(var _0x52ced8 of _0x23252c){var _0x13c964=path['join'](config['root'],_0xfa8b('0xd3'),_0xfa8b('0xc5'),'attachments',_0xfa8b('0xea'),_0x52ced8[_0xfa8b('0x6a')]);fs_extra[_0xfa8b('0xeb')](_0x13c964)[_0xfa8b('0x1f')](function(_0x3d27d4){logger['error'](_0xfa8b('0xec'),_0x13c964,_0x3d27d4);});}});};exports[_0xfa8b('0xed')]=function(_0x4b5f19,_0x1d1f8f){return db['ChatInteraction'][_0xfa8b('0x54')]({'where':{'id':_0x4b5f19['params']['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x1d1f8f,null))[_0xfa8b('0x28')](function(_0x2e7b04){if(_0x2e7b04){return _0x2e7b04[_0xfa8b('0xed')](_0x4b5f19['body']['ids'],_['omit'](_0x4b5f19[_0xfa8b('0x50')],[_0xfa8b('0x65'),'id'])||{});}})['then'](respondWithResult(_0x1d1f8f,null))[_0xfa8b('0x1f')](handleError(_0x1d1f8f,null));};exports[_0xfa8b('0xee')]=function(_0xb46696,_0x485591){var _0xfadb06={'raw':![],'where':{}};var _0x299523={};var _0x5f0f62={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xb46696[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x485591,null))['then'](function(_0x2ad784){if(_0x2ad784){_0x299523[_0xfa8b('0x35')]=_['keys'](db['ChatInteraction'][_0xfa8b('0x5f')]);_0x299523[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0xb46696['query']);_0x299523[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x299523[_0xfa8b('0x35')],_0x299523[_0xfa8b('0x36')]);_0xfadb06['attributes']=_[_0xfa8b('0x3a')](_0x299523[_0xfa8b('0x35')],qs[_0xfa8b('0x3b')](_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0xfadb06[_0xfa8b('0x39')]=_0xfadb06[_0xfa8b('0x39')]['length']?_0xfadb06[_0xfa8b('0x39')]:_0x299523['model'];if(!_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x3d')](_0xfa8b('0x3e'))){_0xfadb06[_0xfa8b('0x25')]=qs[_0xfa8b('0x25')](_0xb46696['query'][_0xfa8b('0x25')]);_0xfadb06[_0xfa8b('0x23')]=qs[_0xfa8b('0x23')](_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x23')]);}_0xfadb06['order']=qs[_0xfa8b('0x40')](_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x40')]);_0xfadb06[_0xfa8b('0x44')]=qs[_0xfa8b('0x38')](_['pick'](_0xb46696[_0xfa8b('0x36')],_0x299523[_0xfa8b('0x38')]));_0xfadb06['where']['ChatWebsiteId']=_0x2ad784['id'];if(_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x42')]){_0xfadb06[_0xfa8b('0x44')]=_['merge'](_0xfadb06[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0xfadb06['attributes'],function(_0x453538){var _0x39ae9a={};_0x39ae9a[_0x453538]={'$like':'%'+_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x39ae9a;})});}_0xfadb06=_[_0xfa8b('0x43')]({},_0xfadb06,_0xb46696[_0xfa8b('0x4e')]);return db['ChatInteraction']['count']({'where':_0xfadb06[_0xfa8b('0x44')]})[_0xfa8b('0x28')](function(_0x1adc84){_0x5f0f62[_0xfa8b('0x47')]=_0x1adc84;if(_0xb46696[_0xfa8b('0x36')][_0xfa8b('0x48')]){_0xfadb06[_0xfa8b('0x49')]=[{'model':db['CmContact'],'as':_0xfa8b('0xef'),'required':![]},{'model':db[_0xfa8b('0xc0')],'as':'Owner','attributes':[_0xfa8b('0x2e'),'fullname',_0xfa8b('0xf0')],'required':![]},{'model':db[_0xfa8b('0xf1')],'as':_0xfa8b('0xf2'),'attributes':['id',_0xfa8b('0x2e'),_0xfa8b('0xf3')],'where':_0xb46696[_0xfa8b('0x36')][_0xfa8b('0xf4')]?{'id':_0xb46696['query'][_0xfa8b('0xf4')]}:undefined,'required':_0xb46696[_0xfa8b('0x36')][_0xfa8b('0xf4')]?!![]:![]}];}return db[_0xfa8b('0xb3')][_0xfa8b('0x4a')](_0xfadb06);})[_0xfa8b('0x28')](function(_0xbfcad5){_0x5f0f62[_0xfa8b('0x4b')]=_0xbfcad5;return _0x5f0f62;});}})[_0xfa8b('0x28')](respondWithFilteredResult(_0x485591,_0xfadb06))[_0xfa8b('0x1f')](handleError(_0x485591,null));};function iftimePromise(_0x2bf98f,_0x4599b6){return respondWithRpcPromise(_0xfa8b('0xf5'),_0xfa8b('0xf6'),{'command':_0x4599b6[_0xfa8b('0xf7')]?util['format'](_0xfa8b('0xf8'),_0x2bf98f[_0xfa8b('0xf9')],_0x4599b6[_0xfa8b('0xf7')]):util['format'](_0xfa8b('0xfa'),_0x2bf98f[_0xfa8b('0xf9')])},client9002)[_0xfa8b('0x28')](function(_0x595f5e){var _0x36acc7=_0x595f5e&&_0x595f5e[_0xfa8b('0xfb')]('true')>=0x0?!![]:![];logger[_0xfa8b('0xfc')](_0xfa8b('0xfd'),_0x4599b6['id'],_0x2bf98f['id'],_0x2bf98f['interval'],_0x36acc7?_0xfa8b('0xfe'):_0xfa8b('0xff'),_0x4599b6[_0xfa8b('0xf7')]?_0x4599b6[_0xfa8b('0xf7')]:_0xfa8b('0x100'));return _0x36acc7;})[_0xfa8b('0x1f')](function(_0x5b28e1){logger[_0xfa8b('0x1a')](_0xfa8b('0xfd'),_0x4599b6['id'],_0x2bf98f['id'],_0x2bf98f[_0xfa8b('0xf9')],util[_0xfa8b('0x101')](_0x5b28e1,{'showHidden':![],'depth':null}),_0x4599b6[_0xfa8b('0xf7')]?_0x4599b6[_0xfa8b('0xf7')]:_0xfa8b('0x100'));return![];});}exports[_0xfa8b('0xf6')]=function(_0x198fd7,_0x3a39c2){var _0x22cf4b=0x0;var _0x320004=0x0;var _0x97b582=![];var _0x309809;var _0x2b2224;return db['ChatWebsite'][_0xfa8b('0x54')]({'where':{'id':_0x198fd7[_0xfa8b('0x4d')]['id']},'include':[{'model':db['Interval'],'as':_0xfa8b('0x102'),'include':[{'model':db[_0xfa8b('0x102')],'as':_0xfa8b('0x103'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3a39c2,null))[_0xfa8b('0x28')](function(_0x34ff19){if(_0x34ff19){_0x309809=_0x34ff19;return _0x34ff19[_0xfa8b('0x104')]({'raw':!![]});}})[_0xfa8b('0x28')](function(_0x5b2286){if(_0x309809){if(_0x5b2286){_0x2b2224=_0x5b2286;}}return require(_0xfa8b('0x71'))[_0xfa8b('0x72')]();})[_0xfa8b('0x28')](function(_0xfc8116){if(_0xfc8116){_0x320004=_0xfc8116[_0xfa8b('0x105')];_0x97b582=_0xfc8116[_0xfa8b('0x73')];}})['then'](function(){return db[_0xfa8b('0xb3')]['count']({'where':{'closed':![]}});})['then'](function(_0x557a91){_0x22cf4b=_0x557a91;if(_0x320004&&_0x557a91>_0x320004){return db[_0xfa8b('0x106')]['findOne']({'where':{'id':0x1}})[_0xfa8b('0x28')](function(_0x5addba){if(_0x5addba){_0x5addba[_0xfa8b('0x107')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x309809[_0xfa8b('0x102')]&&_0x309809[_0xfa8b('0x102')][_0xfa8b('0x103')]){var _0x20c094=[];for(var _0x31de65=0x0;_0x31de65<_0x309809[_0xfa8b('0x102')][_0xfa8b('0x103')][_0xfa8b('0x3c')];_0x31de65++){var _0x40e2df=_0x309809[_0xfa8b('0x102')]['Intervals'][_0x31de65][_0xfa8b('0x2a')]({'plain':!![]});_0x20c094[_0xfa8b('0x108')](iftimePromise(_0x40e2df,_0x309809));}return BPromise[_0xfa8b('0x109')](_0x20c094)[_0xfa8b('0x28')](function(_0x2efa23){return _[_0xfa8b('0x10a')](_0x2efa23);});}else{return!![];}})['then'](function(_0x4f583e){var _0x3ed3b5=fs[_0xfa8b('0xcc')](path[_0xfa8b('0x6f')](config[_0xfa8b('0x75')],_0xfa8b('0x10b')),_0xfa8b('0xcd'));var _0x254e71={'remote':_0x309809['remote'],'query':querystring[_0xfa8b('0x19')](_['merge'](_0x309809[_0xfa8b('0x2a')]({'plain':!![]}),{'customerIp':_0x198fd7['headers'][_0xfa8b('0xa5')]||_0x198fd7[_0xfa8b('0x86')][_0xfa8b('0x10c')]||_0x198fd7[_0xfa8b('0x10d')][_0xfa8b('0x10e')]||_0x198fd7['ip'],'referer':_0x198fd7[_0xfa8b('0x86')][_0xfa8b('0xaa')],'openedInteractions':_0x22cf4b,'maxInteractions':_0x320004,'virtual':_0x97b582[_0xfa8b('0x105')],'online':_0x4f583e,'custom':_0x97b582}))[_0xfa8b('0x10f')](/'/g,'\x5c\x27')};_0x3a39c2[_0xfa8b('0xc6')](ejs[_0xfa8b('0xce')](Mustache['render'](_0x3ed3b5,_0x254e71),{'proactiveActions':_0x2b2224,'alignment':_0x309809[_0xfa8b('0x110')],'verticalAlignment':_0x309809[_0xfa8b('0x111')],'div_color':_0x309809[_0xfa8b('0xf3')],'labelText':_0x309809[_0xfa8b('0x112')],'text_color':_0x309809['textColor'],'text_button_color':_0x309809[_0xfa8b('0x113')],'button_color':_0x309809[_0xfa8b('0x114')],'background_color':_0x309809['backgroundColor'],'hideWhenOffline':_0x309809[_0xfa8b('0x115')],'interval':_0x309809[_0xfa8b('0x116')]}));})[_0xfa8b('0x1f')](handleError(_0x3a39c2,null));};exports['addApplications']=function(_0x40c2e0,_0x44685f){var _0x52e6c2=_0x40c2e0[_0xfa8b('0x4d')]['id'];var _0x22f71e=_0x40c2e0['body'];var _0x4a2adf=0xc8;var _0x541ea5=null;return db[_0xfa8b('0xd6')]['transaction']({'isolationLevel':db[_0xfa8b('0xd6')][_0xfa8b('0x117')][_0xfa8b('0x118')][_0xfa8b('0x119')]},function(_0x1d46e9){return db[_0xfa8b('0x32')]['findOne']({'where':{'id':_0x52e6c2},'transaction':_0x1d46e9})[_0xfa8b('0x28')](function(_0x147213){if(_0x147213){return db[_0xfa8b('0x11a')][_0xfa8b('0x29')]({'where':{'ChatWebsiteId':_0x52e6c2},'transaction':_0x1d46e9})[_0xfa8b('0x28')](function(){var _0x502a1b=_['map'](_0x22f71e,function(_0x3e2aa3){_0x3e2aa3[_0xfa8b('0x5b')]=_0x52e6c2;return _0x3e2aa3;});return db[_0xfa8b('0x11a')][_0xfa8b('0xd9')](_0x502a1b,{'transaction':_0x1d46e9});});}else{_0x4a2adf=0x194;_0x541ea5=[];}});})[_0xfa8b('0x28')](function(){if(_0x4a2adf!==0x194){return db[_0xfa8b('0x11a')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x52e6c2},'order':_0xfa8b('0x9f')})['then'](function(_0x103b38){_0x541ea5=_0x103b38;});}})[_0xfa8b('0x1f')](function(_0xa1e385){_0x4a2adf=0x1f4;logger['error'](_0xa1e385['stack']);if(_0xa1e385[_0xfa8b('0x2e')]){delete _0xa1e385[_0xfa8b('0x2e')];}_0x541ea5=_0xa1e385;})[_0xfa8b('0x11b')](function(){if(_0x541ea5===null){_0x44685f[_0xfa8b('0x20')](_0x4a2adf);}else{if(_0x4a2adf===0x1f4){_0x44685f[_0xfa8b('0x21')](_0x4a2adf)[_0xfa8b('0xc6')](_0x541ea5);}else{_0x44685f[_0xfa8b('0x21')](_0x4a2adf)[_0xfa8b('0x22')](_0x541ea5);}}});};exports[_0xfa8b('0x11c')]=function(_0x5e45dc,_0x24075b){var _0x52c3f2={};var _0x5afa9b={};var _0x444806;var _0x30829d;return db['ChatWebsite'][_0xfa8b('0x5d')]({'where':{'id':_0x5e45dc[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x24075b,null))[_0xfa8b('0x28')](function(_0x12a914){if(_0x12a914){_0x444806=_0x12a914;_0x5afa9b[_0xfa8b('0x35')]=_[_0xfa8b('0x37')](db[_0xfa8b('0x11a')][_0xfa8b('0x5f')]);_0x5afa9b['query']=_[_0xfa8b('0x37')](_0x5e45dc[_0xfa8b('0x36')]);_0x5afa9b[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x5afa9b[_0xfa8b('0x35')],_0x5afa9b[_0xfa8b('0x36')]);_0x52c3f2['attributes']=_[_0xfa8b('0x3a')](_0x5afa9b[_0xfa8b('0x35')],qs['fields'](_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0x52c3f2[_0xfa8b('0x39')]=_0x52c3f2[_0xfa8b('0x39')][_0xfa8b('0x3c')]?_0x52c3f2[_0xfa8b('0x39')]:_0x5afa9b['model'];_0x52c3f2['order']=qs[_0xfa8b('0x40')](_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x40')]);_0x52c3f2['where']=qs[_0xfa8b('0x38')](_[_0xfa8b('0x41')](_0x5e45dc['query'],_0x5afa9b[_0xfa8b('0x38')]));if(_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x42')]){_0x52c3f2[_0xfa8b('0x44')]=_[_0xfa8b('0x43')](_0x52c3f2[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x52c3f2['attributes'],function(_0x182498){var _0x5ba868={};_0x5ba868[_0x182498]={'$like':'%'+_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x5ba868;})});}_0x52c3f2=_['merge']({},_0x52c3f2,_0x5e45dc[_0xfa8b('0x4e')]);return _0x444806[_0xfa8b('0x11c')](_0x52c3f2);}})['then'](function(_0x527429){if(_0x527429){_0x30829d=_0x527429[_0xfa8b('0x3c')];if(!_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x3d')](_0xfa8b('0x3e'))){_0x52c3f2[_0xfa8b('0x25')]=qs[_0xfa8b('0x25')](_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x25')]);_0x52c3f2[_0xfa8b('0x23')]=qs['offset'](_0x5e45dc[_0xfa8b('0x36')][_0xfa8b('0x23')]);}return _0x444806[_0xfa8b('0x11c')](_0x52c3f2);}})[_0xfa8b('0x28')](function(_0x28d7a5){if(_0x28d7a5){return _0x28d7a5?{'count':_0x30829d,'rows':_0x28d7a5}:null;}})[_0xfa8b('0x28')](respondWithResult(_0x24075b,null))[_0xfa8b('0x1f')](handleError(_0x24075b,null));};exports['addProactiveActions']=function(_0x22f6e3,_0x241aee){return db[_0xfa8b('0x11d')][_0xfa8b('0x54')]({'where':{'id':_0x22f6e3['params']['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x241aee,null))[_0xfa8b('0x28')](function(_0x1aa917){if(_0x1aa917){return _0x1aa917[_0xfa8b('0x11e')](_0x22f6e3['body'][_0xfa8b('0x65')],_['omit'](_0x22f6e3[_0xfa8b('0x50')],[_0xfa8b('0x65'),'id'])||{});}})[_0xfa8b('0x28')](respondWithResult(_0x241aee,null))['catch'](handleError(_0x241aee,null));};exports[_0xfa8b('0x104')]=function(_0x85881e,_0x1bb476){var _0x5a3f9e={};var _0x4cef2b={};var _0x1ad926;var _0x9bed1a;return db[_0xfa8b('0x32')][_0xfa8b('0x5d')]({'where':{'id':_0x85881e[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x1bb476,null))['then'](function(_0x2a6185){if(_0x2a6185){_0x1ad926=_0x2a6185;_0x4cef2b['model']=_[_0xfa8b('0x37')](db[_0xfa8b('0x11f')][_0xfa8b('0x5f')]);_0x4cef2b['query']=_[_0xfa8b('0x37')](_0x85881e[_0xfa8b('0x36')]);_0x4cef2b[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x4cef2b[_0xfa8b('0x35')],_0x4cef2b[_0xfa8b('0x36')]);_0x5a3f9e[_0xfa8b('0x39')]=_['intersection'](_0x4cef2b[_0xfa8b('0x35')],qs[_0xfa8b('0x3b')](_0x85881e[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0x5a3f9e[_0xfa8b('0x39')]=_0x5a3f9e['attributes'][_0xfa8b('0x3c')]?_0x5a3f9e[_0xfa8b('0x39')]:_0x4cef2b[_0xfa8b('0x35')];_0x5a3f9e[_0xfa8b('0x3f')]=qs['sort'](_0x85881e[_0xfa8b('0x36')][_0xfa8b('0x40')]);_0x5a3f9e[_0xfa8b('0x44')]=qs['filters'](_[_0xfa8b('0x41')](_0x85881e['query'],_0x4cef2b[_0xfa8b('0x38')]));if(_0x85881e[_0xfa8b('0x36')][_0xfa8b('0x42')]){_0x5a3f9e[_0xfa8b('0x44')]=_[_0xfa8b('0x43')](_0x5a3f9e[_0xfa8b('0x44')],{'$or':_['map'](_0x5a3f9e['attributes'],function(_0x5e32c9){var _0x44033f={};_0x44033f[_0x5e32c9]={'$like':'%'+_0x85881e[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x44033f;})});}_0x5a3f9e=_[_0xfa8b('0x43')]({},_0x5a3f9e,_0x85881e[_0xfa8b('0x4e')]);return _0x1ad926[_0xfa8b('0x104')](_0x5a3f9e);}})['then'](function(_0x2360c0){if(_0x2360c0){_0x9bed1a=_0x2360c0[_0xfa8b('0x3c')];if(!_0x85881e[_0xfa8b('0x36')]['hasOwnProperty'](_0xfa8b('0x3e'))){_0x5a3f9e[_0xfa8b('0x25')]=qs[_0xfa8b('0x25')](_0x85881e[_0xfa8b('0x36')]['limit']);_0x5a3f9e[_0xfa8b('0x23')]=qs[_0xfa8b('0x23')](_0x85881e['query'][_0xfa8b('0x23')]);}return _0x1ad926[_0xfa8b('0x104')](_0x5a3f9e);}})[_0xfa8b('0x28')](function(_0x56e735){if(_0x56e735){return _0x56e735?{'count':_0x9bed1a,'rows':_0x56e735}:null;}})[_0xfa8b('0x28')](respondWithResult(_0x1bb476,null))[_0xfa8b('0x1f')](handleError(_0x1bb476,null));};exports[_0xfa8b('0x120')]=function(_0x235426,_0x4e6dee){var _0x4a4d2d=_0x235426[_0xfa8b('0x36')]['online']===_0xfa8b('0x121')?'offlineForm':_0xfa8b('0x122');return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'attributes':['id',_0x4a4d2d],'where':{'id':_0x235426['params']['id']}})['then'](handleEntityNotFound(_0x4e6dee,null))['then'](function(_0x361c17){if(_0x361c17){var _0x2c63d0=_0x361c17[_0x4a4d2d];var _0x476b38=_0x2c63d0&&_0x2c63d0[_0xfa8b('0x123')]?_0x2c63d0[_0xfa8b('0x123')]:[];_0x4e6dee[_0xfa8b('0xc6')]({'fromKey':_[_0xfa8b('0x74')](_0x2c63d0['fromKey'])?undefined:_0x2c63d0[_0xfa8b('0x124')],'count':_0x476b38[_0xfa8b('0x3c')],'rows':_0x476b38});}})[_0xfa8b('0x1f')](handleError(_0x4e6dee,null));};exports[_0xfa8b('0x125')]=function(_0x468ca1,_0x538d7b){var _0x5d2104={'raw':![],'where':{}};var _0x253e42={};var _0xcf51d5={'count':0x0,'rows':[]};return db[_0xfa8b('0x32')][_0xfa8b('0x5d')]({'where':{'id':_0x468ca1[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x538d7b,null))[_0xfa8b('0x28')](function(_0x521a8c){if(_0x521a8c){_0x253e42[_0xfa8b('0x35')]=_['keys'](db[_0xfa8b('0x126')][_0xfa8b('0x5f')]);_0x253e42[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0x468ca1['query']);_0x253e42[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x253e42[_0xfa8b('0x35')],_0x253e42[_0xfa8b('0x36')]);_0x5d2104[_0xfa8b('0x39')]=_[_0xfa8b('0x3a')](_0x253e42[_0xfa8b('0x35')],qs[_0xfa8b('0x3b')](_0x468ca1[_0xfa8b('0x36')]['fields']));_0x5d2104['attributes']=_0x5d2104[_0xfa8b('0x39')][_0xfa8b('0x3c')]?_0x5d2104[_0xfa8b('0x39')]:_0x253e42[_0xfa8b('0x35')];if(!_0x468ca1['query']['hasOwnProperty'](_0xfa8b('0x3e'))){_0x5d2104['limit']=qs[_0xfa8b('0x25')](_0x468ca1[_0xfa8b('0x36')][_0xfa8b('0x25')]);_0x5d2104['offset']=qs[_0xfa8b('0x23')](_0x468ca1['query'][_0xfa8b('0x23')]);}_0x5d2104[_0xfa8b('0x3f')]=qs[_0xfa8b('0x40')](_0x468ca1['query'][_0xfa8b('0x40')]);_0x5d2104[_0xfa8b('0x44')]=qs[_0xfa8b('0x38')](_['pick'](_0x468ca1['query'],_0x253e42[_0xfa8b('0x38')]));_0x5d2104[_0xfa8b('0x44')][_0xfa8b('0x5b')]=_0x521a8c['id'];if(_0x468ca1['query'][_0xfa8b('0x42')]){_0x5d2104[_0xfa8b('0x44')]=_[_0xfa8b('0x43')](_0x5d2104[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x5d2104['attributes'],function(_0x16e229){var _0x42cf17={};_0x42cf17[_0x16e229]={'$like':'%'+_0x468ca1[_0xfa8b('0x36')]['filter']+'%'};return _0x42cf17;})});}_0x5d2104=_[_0xfa8b('0x43')]({},_0x5d2104,_0x468ca1[_0xfa8b('0x4e')]);return db['ChatOfflineMessage']['count']({'where':_0x5d2104[_0xfa8b('0x44')]})[_0xfa8b('0x28')](function(_0x2d2116){_0xcf51d5['count']=_0x2d2116;if(_0x468ca1[_0xfa8b('0x36')][_0xfa8b('0x48')]){_0x5d2104[_0xfa8b('0x49')]=[{'all':!![]}];}else{_0x5d2104['include']=[{'model':db['CmContact'],'as':_0xfa8b('0xef'),'required':![]},{'model':db[_0xfa8b('0xd8')],'as':_0xfa8b('0x127'),'required':![]}];}return db[_0xfa8b('0x126')][_0xfa8b('0x4a')](_0x5d2104);})[_0xfa8b('0x28')](function(_0x350b73){_0xcf51d5[_0xfa8b('0x4b')]=_0x350b73;return _0xcf51d5;});}})[_0xfa8b('0x28')](respondWithFilteredResult(_0x538d7b,_0x5d2104))[_0xfa8b('0x1f')](handleError(_0x538d7b,null));};exports[_0xfa8b('0x128')]=function(_0x50bf24,_0x56b61d){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x50bf24[_0xfa8b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x56b61d,null))[_0xfa8b('0x28')](function(_0x50d08b){if(_0x50d08b){return _0x50d08b[_0xfa8b('0x128')](_0x50bf24[_0xfa8b('0x50')][_0xfa8b('0x65')],_[_0xfa8b('0x129')](_0x50bf24[_0xfa8b('0x50')],[_0xfa8b('0x65'),'id'])||{})['spread'](function(_0x2a7787){for(var _0x2b51a3=0x0;_0x2b51a3<_0x50bf24[_0xfa8b('0x50')][_0xfa8b('0x65')]['length'];_0x2b51a3+=0x1){socket[_0xfa8b('0x12a')](_0xfa8b('0x12b'),{'UserId':Number(_0x50bf24[_0xfa8b('0x50')][_0xfa8b('0x65')][_0x2b51a3]),'ChatWebsiteId':Number(_0x50bf24['params']['id'])});}return _0x2a7787;});}})[_0xfa8b('0x28')](respondWithResult(_0x56b61d,null))[_0xfa8b('0x1f')](handleError(_0x56b61d,null));};exports[_0xfa8b('0x12c')]=function(_0x4d578e,_0x3d59d6){return db[_0xfa8b('0x32')][_0xfa8b('0x54')]({'where':{'id':_0x4d578e[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x3d59d6,null))[_0xfa8b('0x28')](function(_0xa362d9){if(_0xa362d9){return _0xa362d9['removeAgents'](_0x4d578e['query']['ids'])[_0xfa8b('0x28')](function(){if(_[_0xfa8b('0x12d')](_0x4d578e['query'][_0xfa8b('0x65')])){for(var _0x498c24=0x0;_0x498c24<_0x4d578e[_0xfa8b('0x36')][_0xfa8b('0x65')][_0xfa8b('0x3c')];_0x498c24+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x4d578e['query'][_0xfa8b('0x65')][_0x498c24]),'ChatWebsiteId':Number(_0x4d578e['params']['id'])});}}else{socket['emit'](_0xfa8b('0x12e'),{'UserId':Number(_0x4d578e[_0xfa8b('0x36')][_0xfa8b('0x65')]),'ChatWebsiteId':Number(_0x4d578e[_0xfa8b('0x4d')]['id'])});}});}})[_0xfa8b('0x28')](respondWithStatusCode(_0x3d59d6,null))[_0xfa8b('0x1f')](handleError(_0x3d59d6,null));};exports[_0xfa8b('0x12f')]=function(_0x25fcc1,_0x1c808f){var _0x16929a={};var _0x126850={};var _0x965fcf;var _0x464dad;return db[_0xfa8b('0x32')][_0xfa8b('0x5d')]({'where':{'id':_0x25fcc1[_0xfa8b('0x4d')]['id']}})[_0xfa8b('0x28')](handleEntityNotFound(_0x1c808f,null))['then'](function(_0x30ef5c){if(_0x30ef5c){_0x965fcf=_0x30ef5c;_0x126850[_0xfa8b('0x35')]=_['keys'](db[_0xfa8b('0xc0')][_0xfa8b('0x5f')]);_0x126850[_0xfa8b('0x36')]=_[_0xfa8b('0x37')](_0x25fcc1[_0xfa8b('0x36')]);_0x126850[_0xfa8b('0x38')]=_[_0xfa8b('0x3a')](_0x126850[_0xfa8b('0x35')],_0x126850[_0xfa8b('0x36')]);_0x16929a[_0xfa8b('0x39')]=_[_0xfa8b('0x3a')](_0x126850[_0xfa8b('0x35')],qs[_0xfa8b('0x3b')](_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x3b')]));_0x16929a[_0xfa8b('0x39')]=_0x16929a['attributes']['length']?_0x16929a[_0xfa8b('0x39')]:_0x126850[_0xfa8b('0x35')];_0x16929a[_0xfa8b('0x3f')]=qs[_0xfa8b('0x40')](_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x40')]);_0x16929a[_0xfa8b('0x44')]=qs[_0xfa8b('0x38')](_[_0xfa8b('0x41')](_0x25fcc1[_0xfa8b('0x36')],_0x126850[_0xfa8b('0x38')]));if(_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x42')]){_0x16929a[_0xfa8b('0x44')]=_[_0xfa8b('0x43')](_0x16929a[_0xfa8b('0x44')],{'$or':_[_0xfa8b('0x45')](_0x16929a[_0xfa8b('0x39')],function(_0xfc2697){var _0x2f8036={};_0x2f8036[_0xfc2697]={'$like':'%'+_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x42')]+'%'};return _0x2f8036;})});}_0x16929a=_[_0xfa8b('0x43')]({},_0x16929a,_0x25fcc1[_0xfa8b('0x4e')]);return _0x965fcf[_0xfa8b('0x12f')](_0x16929a);}})[_0xfa8b('0x28')](function(_0xb175f5){if(_0xb175f5){_0x464dad=_0xb175f5[_0xfa8b('0x3c')];if(!_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x3d')]('nolimit')){_0x16929a[_0xfa8b('0x25')]=qs[_0xfa8b('0x25')](_0x25fcc1['query']['limit']);_0x16929a[_0xfa8b('0x23')]=qs[_0xfa8b('0x23')](_0x25fcc1[_0xfa8b('0x36')][_0xfa8b('0x23')]);}return _0x965fcf[_0xfa8b('0x12f')](_0x16929a);}})[_0xfa8b('0x28')](function(_0x248d16){if(_0x248d16){return _0x248d16?{'count':_0x464dad,'rows':_0x248d16}:null;}})[_0xfa8b('0x28')](respondWithResult(_0x1c808f,null))[_0xfa8b('0x1f')](handleError(_0x1c808f,null));}; \ No newline at end of file +var _0x1205=['merge','type','options','includeAll','include','findAll','rows','show','Pause','rawAttributes','intersection','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addLogo','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','existsSync','root','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','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','from','List','Contacts','updatedAt','DESC','ChatApplication','account','applications','Applications','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','version','%s\x20%s','browser','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','autoclose','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','ListId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','basename','transaction','bulkCreate','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','MailAccountId','subjectOffline','mapValues','offlineMessageSubject','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','getProactiveActions','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','some','remote','x-real-ip','remoteAddress','referer','alignment','verticalAlignment','labelText','textColor','color_button','hideWhenOffline','IntervalId','sequelize','Transaction','READ_COMMITTED','priority','finally','json','getApplications','addProactiveActions','chatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','offset','limit','undefined','count','destroy','ChatWebsites','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','ChatWebsite','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x573150,_0xe5b26){var _0xa72f1d=function(_0x4fb6b2){while(--_0x4fb6b2){_0x573150['push'](_0x573150['shift']());}};_0xa72f1d(++_0xe5b26);}(_0x1205,0xe7));var _0x5120=function(_0x213959,_0x4d0ad4){_0x213959=_0x213959-0x0;var _0xb7478f=_0x1205[_0x213959];return _0xb7478f;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x5120('0x0'));var util=require(_0x5120('0x1'));var path=require(_0x5120('0x2'));var ejs=require(_0x5120('0x3'));var fs=require('fs');var fs_extra=require(_0x5120('0x4'));var _=require(_0x5120('0x5'));var querystring=require('querystring');var Redis=require(_0x5120('0x6'));var qs=require(_0x5120('0x7'));var logger=require(_0x5120('0x8'))(_0x5120('0x9'));var config=require(_0x5120('0xa'));var db=require(_0x5120('0xb'))['db'];config[_0x5120('0xc')]=_[_0x5120('0xd')](config['redis'],{'host':_0x5120('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5120('0xc')]));require(_0x5120('0xf'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0x5120('0x10'));var client=jayson[_0x5120('0x11')][_0x5120('0x12')]({'port':0x232c});var client9002=jayson['client'][_0x5120('0x12')]({'port':0x232a});var client9003=jayson[_0x5120('0x11')]['http']({'port':0x232b});var client9001=jayson[_0x5120('0x11')][_0x5120('0x12')]({'port':0x2329});function respondWithRpcPromise(_0x558eaa,_0x234df1,_0x34ad66,_0x66b5e4){return new BPromise(function(_0x22ba1,_0x511e0a){var _0x388365=_0x66b5e4||client;return _0x388365[_0x5120('0x13')](_0x558eaa,_0x34ad66)[_0x5120('0x14')](function(_0x365938){logger[_0x5120('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x234df1,'request\x20sent');logger[_0x5120('0x16')](_0x5120('0x17'),_0x234df1,'request\x20sent',JSON['stringify'](_0x365938));if(_0x365938['error']){if(_0x365938[_0x5120('0x18')]['code']===0x1f4){logger['error'](_0x5120('0x19'),_0x234df1,_0x365938[_0x5120('0x18')]['message']);return _0x511e0a(_0x365938[_0x5120('0x18')][_0x5120('0x1a')]);}logger[_0x5120('0x18')](_0x5120('0x19'),_0x234df1,_0x365938[_0x5120('0x18')][_0x5120('0x1a')]);return _0x22ba1(_0x365938[_0x5120('0x18')][_0x5120('0x1a')]);}else{logger['info'](_0x5120('0x19'),_0x234df1,_0x5120('0x1b'));_0x22ba1(_0x365938[_0x5120('0x1c')][_0x5120('0x1a')]);}})[_0x5120('0x1d')](function(_0x34a0e4){logger['error'](_0x5120('0x19'),_0x234df1,_0x34a0e4);_0x511e0a(_0x34a0e4);});});}function respondWithStatusCode(_0x10fdc3,_0x2bcfbe){_0x2bcfbe=_0x2bcfbe||0xcc;return function(_0xf9a73d){if(_0xf9a73d){return _0x10fdc3[_0x5120('0x1e')](_0x2bcfbe);}return _0x10fdc3[_0x5120('0x1f')](_0x2bcfbe)[_0x5120('0x20')]();};}function respondWithResult(_0x121285,_0x1111a9){_0x1111a9=_0x1111a9||0xc8;return function(_0x246da2){if(_0x246da2){return _0x121285[_0x5120('0x1f')](_0x1111a9)['json'](_0x246da2);}};}function respondWithFilteredResult(_0x4e0ce3,_0x103370){return function(_0x20aa5d){if(_0x20aa5d){var _0x3ba4ca=typeof _0x103370[_0x5120('0x21')]==='undefined'&&typeof _0x103370[_0x5120('0x22')]===_0x5120('0x23');var _0x23bc6d=_0x20aa5d[_0x5120('0x24')];var _0x4121f9=_0x3ba4ca?0x0:_0x103370['offset'];var _0x43861c=_0x3ba4ca?_0x20aa5d[_0x5120('0x24')]:_0x103370[_0x5120('0x21')]+_0x103370['limit'];var _0x4d621c;if(_0x43861c>=_0x23bc6d){_0x43861c=_0x23bc6d;_0x4d621c=0xc8;}else{_0x4d621c=0xce;}_0x4e0ce3['status'](_0x4d621c);return _0x4e0ce3['set']('Content-Range',_0x4121f9+'-'+_0x43861c+'/'+_0x23bc6d)['json'](_0x20aa5d);}return null;};}function saveUpdates(_0x610ad5){return function(_0x5928d4){if(_0x5928d4){return _0x5928d4['update'](_0x610ad5)[_0x5120('0x14')](function(_0x2dd467){return _0x2dd467;});}return null;};}function removeEntity(_0x5b0995){return function(_0x3e474c){if(_0x3e474c){return _0x3e474c[_0x5120('0x25')]()[_0x5120('0x14')](function(){var _0x58ab6c=_0x3e474c['get']({'plain':!![]});var _0x2f624c=_0x5120('0x26');return db[_0x5120('0x27')]['destroy']({'where':{'type':_0x2f624c,'resourceId':_0x58ab6c['id']}})[_0x5120('0x14')](function(){return _0x3e474c;});})[_0x5120('0x14')](function(){_0x5b0995[_0x5120('0x1f')](0xcc)[_0x5120('0x20')]();});}};}function handleEntityNotFound(_0x3d4046){return function(_0x43b837){if(!_0x43b837){_0x3d4046['sendStatus'](0x194);}return _0x43b837;};}function handleError(_0x18cd29,_0xa21a0c){_0xa21a0c=_0xa21a0c||0x1f4;return function(_0x31ff00){logger['error'](_0x31ff00[_0x5120('0x28')]);if(_0x31ff00[_0x5120('0x29')]){delete _0x31ff00['name'];}_0x18cd29['status'](_0xa21a0c)['send'](_0x31ff00);};}exports[_0x5120('0x2a')]=function(_0x58bfdf,_0x29c7cc){var _0x45606e={'include':[{'model':db['Pause'],'as':_0x5120('0x2b')}]},_0x386a0a={},_0x21414b={'count':0x0,'rows':[]};var _0x325ae4=_[_0x5120('0x2c')](db[_0x5120('0x2d')]['rawAttributes'],function(_0x1c8946){return{'name':_0x1c8946['fieldName'],'type':_0x1c8946['type'][_0x5120('0x2e')]};});_0x386a0a['model']=_[_0x5120('0x2c')](_0x325ae4,_0x5120('0x29'));_0x386a0a[_0x5120('0x2f')]=_[_0x5120('0x30')](_0x58bfdf['query']);_0x386a0a[_0x5120('0x31')]=_['intersection'](_0x386a0a[_0x5120('0x32')],_0x386a0a[_0x5120('0x2f')]);_0x45606e[_0x5120('0x33')]=_['intersection'](_0x386a0a[_0x5120('0x32')],qs[_0x5120('0x34')](_0x58bfdf['query'][_0x5120('0x34')]));_0x45606e[_0x5120('0x33')]=_0x45606e[_0x5120('0x33')][_0x5120('0x35')]?_0x45606e['attributes']:_0x386a0a['model'];if(!_0x58bfdf[_0x5120('0x2f')][_0x5120('0x36')](_0x5120('0x37'))){_0x45606e[_0x5120('0x22')]=qs[_0x5120('0x22')](_0x58bfdf[_0x5120('0x2f')][_0x5120('0x22')]);_0x45606e[_0x5120('0x21')]=qs[_0x5120('0x21')](_0x58bfdf[_0x5120('0x2f')][_0x5120('0x21')]);}_0x45606e[_0x5120('0x38')]=qs['sort'](_0x58bfdf[_0x5120('0x2f')][_0x5120('0x39')]);_0x45606e[_0x5120('0x3a')]=qs[_0x5120('0x31')](_[_0x5120('0x3b')](_0x58bfdf[_0x5120('0x2f')],_0x386a0a[_0x5120('0x31')]),_0x325ae4);if(_0x58bfdf[_0x5120('0x2f')][_0x5120('0x3c')]){_0x45606e[_0x5120('0x3a')]=_[_0x5120('0x3d')](_0x45606e[_0x5120('0x3a')],{'$or':_[_0x5120('0x2c')](_0x325ae4,function(_0x4c0067){if(_0x4c0067[_0x5120('0x3e')]!=='VIRTUAL'){var _0x475242={};_0x475242[_0x4c0067[_0x5120('0x29')]]={'$like':'%'+_0x58bfdf['query'][_0x5120('0x3c')]+'%'};return _0x475242;}})});}_0x45606e=_[_0x5120('0x3d')]({},_0x45606e,_0x58bfdf[_0x5120('0x3f')]);var _0x54d088={'where':_0x45606e[_0x5120('0x3a')]};return db['ChatWebsite']['count'](_0x54d088)['then'](function(_0x10c879){_0x21414b[_0x5120('0x24')]=_0x10c879;if(_0x58bfdf[_0x5120('0x2f')][_0x5120('0x40')]){_0x45606e[_0x5120('0x41')]=[{'all':!![]}];}return db[_0x5120('0x2d')][_0x5120('0x42')](_0x45606e);})['then'](function(_0xa58845){_0x21414b[_0x5120('0x43')]=_0xa58845;return _0x21414b;})[_0x5120('0x14')](respondWithFilteredResult(_0x29c7cc,_0x45606e))[_0x5120('0x1d')](handleError(_0x29c7cc,null));};exports[_0x5120('0x44')]=function(_0x2d2c20,_0x4bbc8f){var _0x5210fe={'raw':![],'where':{'id':_0x2d2c20['params']['id']},'include':[{'model':db[_0x5120('0x45')],'as':_0x5120('0x2b')}]},_0x987a54={};_0x987a54[_0x5120('0x32')]=_[_0x5120('0x30')](db['ChatWebsite'][_0x5120('0x46')]);_0x987a54[_0x5120('0x2f')]=_[_0x5120('0x30')](_0x2d2c20[_0x5120('0x2f')]);_0x987a54[_0x5120('0x31')]=_[_0x5120('0x47')](_0x987a54[_0x5120('0x32')],_0x987a54[_0x5120('0x2f')]);_0x5210fe[_0x5120('0x33')]=_['intersection'](_0x987a54['model'],qs[_0x5120('0x34')](_0x2d2c20['query'][_0x5120('0x34')]));_0x5210fe[_0x5120('0x33')]=_0x5210fe[_0x5120('0x33')]['length']?_0x5210fe[_0x5120('0x33')]:_0x987a54[_0x5120('0x32')];if(_0x2d2c20[_0x5120('0x2f')][_0x5120('0x40')]){_0x5210fe[_0x5120('0x41')]=[{'all':!![]}];}_0x5210fe=_['merge']({},_0x5210fe,_0x2d2c20[_0x5120('0x3f')]);return db[_0x5120('0x2d')][_0x5120('0x48')](_0x5210fe)[_0x5120('0x14')](handleEntityNotFound(_0x4bbc8f,null))[_0x5120('0x14')](respondWithResult(_0x4bbc8f,null))[_0x5120('0x1d')](handleError(_0x4bbc8f,null));};exports['create']=function(_0x188b3a,_0x19fae9){return db[_0x5120('0x2d')][_0x5120('0x49')](_0x188b3a['body'],{})[_0x5120('0x14')](function(_0x59cb3d){var _0x4a8ec9=_0x188b3a[_0x5120('0x4a')][_0x5120('0x4b')]({'plain':!![]});if(!_0x4a8ec9)throw new Error(_0x5120('0x4c'));if(_0x4a8ec9['role']===_0x5120('0x4a')){var _0x17aa72=_0x59cb3d[_0x5120('0x4b')]({'plain':!![]});var _0x2a9761=_0x5120('0x26');return db[_0x5120('0x4d')][_0x5120('0x48')]({'where':{'name':_0x2a9761,'userProfileId':_0x4a8ec9[_0x5120('0x4e')]},'raw':!![]})[_0x5120('0x14')](function(_0x5f4f0a){if(_0x5f4f0a&&_0x5f4f0a[_0x5120('0x4f')]===0x0){return db[_0x5120('0x27')][_0x5120('0x49')]({'name':_0x17aa72[_0x5120('0x29')],'resourceId':_0x17aa72['id'],'type':_0x5f4f0a[_0x5120('0x29')],'sectionId':_0x5f4f0a['id']},{})['then'](function(){return _0x59cb3d;});}else{return _0x59cb3d;}})['catch'](function(_0x4e5e86){logger[_0x5120('0x18')](_0x5120('0x50'),_0x4e5e86);throw _0x4e5e86;});}return _0x59cb3d;})[_0x5120('0x14')](respondWithResult(_0x19fae9,0xc9))[_0x5120('0x1d')](handleError(_0x19fae9,null));};exports['update']=function(_0x2cd490,_0xf55ee6){if(_0x2cd490[_0x5120('0x51')]['id']){delete _0x2cd490[_0x5120('0x51')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2cd490['params']['id']},'include':[{'model':db[_0x5120('0x45')],'as':_0x5120('0x2b')}]})[_0x5120('0x14')](handleEntityNotFound(_0xf55ee6,null))['then'](saveUpdates(_0x2cd490[_0x5120('0x51')],null))[_0x5120('0x14')](respondWithResult(_0xf55ee6,null))[_0x5120('0x1d')](handleError(_0xf55ee6,null));};exports[_0x5120('0x25')]=function(_0x2d00e6,_0x54bdac){return db['ChatWebsite'][_0x5120('0x48')]({'where':{'id':_0x2d00e6[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x54bdac,null))[_0x5120('0x14')](removeEntity(_0x54bdac,null))['catch'](handleError(_0x54bdac,null));};exports[_0x5120('0x53')]=function(_0x3745c5,_0x34bdad){return db[_0x5120('0x2d')][_0x5120('0x53')]()[_0x5120('0x14')](respondWithResult(_0x34bdad,null))[_0x5120('0x1d')](handleError(_0x34bdad,null));};exports[_0x5120('0x54')]=function(_0x32bb16,_0x174052){if(_0x32bb16[_0x5120('0x51')]['id']){delete _0x32bb16['body']['id'];}return db[_0x5120('0x2d')]['find']({'where':{'id':_0x32bb16['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x174052,null))[_0x5120('0x14')](function(_0x43b933){if(_0x43b933){_0x32bb16['body'][_0x5120('0x55')]=_0x43b933['id'];return db['Disposition']['create'](_0x32bb16[_0x5120('0x51')]);}})['then'](respondWithResult(_0x174052,null))[_0x5120('0x1d')](handleError(_0x174052,null));};exports['getDispositions']=function(_0xb0bfa,_0x44d28a){var _0x1b2445={'raw':![],'where':{}};var _0x4be643={};var _0x4bb68a={'count':0x0,'rows':[]};return db[_0x5120('0x2d')]['findOne']({'where':{'id':_0xb0bfa[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x44d28a,null))['then'](function(_0x3c0a2a){if(_0x3c0a2a){_0x4be643[_0x5120('0x32')]=_[_0x5120('0x30')](db[_0x5120('0x56')][_0x5120('0x46')]);_0x4be643[_0x5120('0x2f')]=_[_0x5120('0x30')](_0xb0bfa[_0x5120('0x2f')]);_0x4be643[_0x5120('0x31')]=_[_0x5120('0x47')](_0x4be643[_0x5120('0x32')],_0x4be643['query']);_0x1b2445[_0x5120('0x33')]=_[_0x5120('0x47')](_0x4be643[_0x5120('0x32')],qs['fields'](_0xb0bfa[_0x5120('0x2f')][_0x5120('0x34')]));_0x1b2445[_0x5120('0x33')]=_0x1b2445[_0x5120('0x33')]['length']?_0x1b2445[_0x5120('0x33')]:_0x4be643[_0x5120('0x32')];if(!_0xb0bfa['query'][_0x5120('0x36')](_0x5120('0x37'))){_0x1b2445[_0x5120('0x22')]=qs[_0x5120('0x22')](_0xb0bfa[_0x5120('0x2f')]['limit']);_0x1b2445[_0x5120('0x21')]=qs['offset'](_0xb0bfa['query']['offset']);}_0x1b2445['order']=qs[_0x5120('0x39')](_0xb0bfa[_0x5120('0x2f')]['sort']);_0x1b2445[_0x5120('0x3a')]=qs['filters'](_[_0x5120('0x3b')](_0xb0bfa[_0x5120('0x2f')],_0x4be643['filters']));_0x1b2445[_0x5120('0x3a')]['ChatWebsiteId']=_0x3c0a2a['id'];if(_0xb0bfa[_0x5120('0x2f')][_0x5120('0x3c')]){_0x1b2445[_0x5120('0x3a')]=_['merge'](_0x1b2445[_0x5120('0x3a')],{'$or':_['map'](_0x1b2445['attributes'],function(_0x31ce20){var _0xfdf86e={};_0xfdf86e[_0x31ce20]={'$like':'%'+_0xb0bfa[_0x5120('0x2f')][_0x5120('0x3c')]+'%'};return _0xfdf86e;})});}_0x1b2445=_[_0x5120('0x3d')]({},_0x1b2445,_0xb0bfa['options']);return db['Disposition']['count']({'where':_0x1b2445[_0x5120('0x3a')]})['then'](function(_0xbbb0a2){_0x4bb68a[_0x5120('0x24')]=_0xbbb0a2;if(_0xb0bfa[_0x5120('0x2f')][_0x5120('0x40')]){_0x1b2445[_0x5120('0x41')]=[{'all':!![]}];}return db[_0x5120('0x56')]['findAll'](_0x1b2445);})[_0x5120('0x14')](function(_0x46b663){_0x4bb68a['rows']=_0x46b663;return _0x4bb68a;});}})['then'](respondWithFilteredResult(_0x44d28a,_0x1b2445))[_0x5120('0x1d')](handleError(_0x44d28a,null));};exports[_0x5120('0x57')]=function(_0x41678c,_0x4efda6){return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x41678c[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x4efda6,null))[_0x5120('0x14')](function(_0x2b08bc){if(_0x2b08bc){return _0x2b08bc[_0x5120('0x57')](_0x41678c[_0x5120('0x2f')][_0x5120('0x58')]);}})[_0x5120('0x14')](respondWithStatusCode(_0x4efda6,null))[_0x5120('0x1d')](handleError(_0x4efda6,null));};exports[_0x5120('0x59')]=function(_0x216fe9,_0x1aeec0){if(_0x216fe9['body']['id']){delete _0x216fe9[_0x5120('0x51')]['id'];}return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x216fe9[_0x5120('0x52')]['id']}})['then'](handleEntityNotFound(_0x1aeec0,null))['then'](function(_0x28656c){if(_0x28656c){_0x216fe9[_0x5120('0x51')][_0x5120('0x55')]=_0x28656c['id'];return db[_0x5120('0x5a')][_0x5120('0x49')](_0x216fe9[_0x5120('0x51')]);}})[_0x5120('0x14')](respondWithResult(_0x1aeec0,null))[_0x5120('0x1d')](handleError(_0x1aeec0,null));};exports[_0x5120('0x5b')]=function(_0x1c73d9,_0x3ac32f){var _0x57019d={'raw':![],'where':{}};var _0x433dba={};var _0x5a8c19={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5120('0x5c')]({'where':{'id':_0x1c73d9['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x3ac32f,null))[_0x5120('0x14')](function(_0x2cd651){if(_0x2cd651){_0x433dba['model']=_[_0x5120('0x30')](db[_0x5120('0x5a')]['rawAttributes']);_0x433dba[_0x5120('0x2f')]=_['keys'](_0x1c73d9[_0x5120('0x2f')]);_0x433dba[_0x5120('0x31')]=_[_0x5120('0x47')](_0x433dba[_0x5120('0x32')],_0x433dba[_0x5120('0x2f')]);_0x57019d[_0x5120('0x33')]=_[_0x5120('0x47')](_0x433dba[_0x5120('0x32')],qs[_0x5120('0x34')](_0x1c73d9[_0x5120('0x2f')]['fields']));_0x57019d[_0x5120('0x33')]=_0x57019d['attributes'][_0x5120('0x35')]?_0x57019d['attributes']:_0x433dba[_0x5120('0x32')];if(!_0x1c73d9['query'][_0x5120('0x36')]('nolimit')){_0x57019d[_0x5120('0x22')]=qs['limit'](_0x1c73d9[_0x5120('0x2f')][_0x5120('0x22')]);_0x57019d[_0x5120('0x21')]=qs[_0x5120('0x21')](_0x1c73d9[_0x5120('0x2f')][_0x5120('0x21')]);}_0x57019d['order']=qs[_0x5120('0x39')](_0x1c73d9[_0x5120('0x2f')]['sort']);_0x57019d[_0x5120('0x3a')]=qs['filters'](_[_0x5120('0x3b')](_0x1c73d9[_0x5120('0x2f')],_0x433dba[_0x5120('0x31')]));_0x57019d[_0x5120('0x3a')]['ChatWebsiteId']=_0x2cd651['id'];if(_0x1c73d9[_0x5120('0x2f')]['filter']){_0x57019d['where']=_[_0x5120('0x3d')](_0x57019d[_0x5120('0x3a')],{'$or':_['map'](_0x57019d[_0x5120('0x33')],function(_0x99136c){var _0x4a4bc8={};_0x4a4bc8[_0x99136c]={'$like':'%'+_0x1c73d9[_0x5120('0x2f')][_0x5120('0x3c')]+'%'};return _0x4a4bc8;})});}_0x57019d=_[_0x5120('0x3d')]({},_0x57019d,_0x1c73d9['options']);return db[_0x5120('0x5a')]['count']({'where':_0x57019d[_0x5120('0x3a')]})[_0x5120('0x14')](function(_0x1d5019){_0x5a8c19[_0x5120('0x24')]=_0x1d5019;if(_0x1c73d9['query'][_0x5120('0x40')]){_0x57019d[_0x5120('0x41')]=[{'all':!![]}];}return db[_0x5120('0x5a')][_0x5120('0x42')](_0x57019d);})[_0x5120('0x14')](function(_0x36bae4){_0x5a8c19[_0x5120('0x43')]=_0x36bae4;return _0x5a8c19;});}})[_0x5120('0x14')](respondWithFilteredResult(_0x3ac32f,_0x57019d))[_0x5120('0x1d')](handleError(_0x3ac32f,null));};exports['removeAnswers']=function(_0x434b99,_0x25f171){return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x434b99['params']['id']}})['then'](handleEntityNotFound(_0x25f171,null))[_0x5120('0x14')](function(_0x31a5d4){if(_0x31a5d4){return _0x31a5d4['removeAnswers'](_0x434b99['query']['ids']);}})['then'](respondWithStatusCode(_0x25f171,null))[_0x5120('0x1d')](handleError(_0x25f171,null));};exports[_0x5120('0x5d')]=function(_0x4cef8b,_0x1e2b23){_0x4cef8b[_0x5120('0x51')]['sitepic']=_0x4cef8b['file']['filename'];return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x4cef8b[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x1e2b23,null))['then'](saveUpdates(_0x4cef8b[_0x5120('0x51')],null))[_0x5120('0x14')](respondWithResult(_0x1e2b23,null))[_0x5120('0x1d')](handleError(_0x1e2b23,null));};exports[_0x5120('0x5e')]=function(_0x579dab,_0x15027b){_0x579dab['body'][_0x5120('0x5f')]=_0x579dab[_0x5120('0x60')][_0x5120('0x61')];return db['ChatWebsite'][_0x5120('0x48')]({'where':{'id':_0x579dab['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x15027b,null))[_0x5120('0x14')](saveUpdates(_0x579dab[_0x5120('0x51')],null))[_0x5120('0x14')](respondWithResult(_0x15027b,null))['catch'](handleError(_0x15027b,null));};exports[_0x5120('0x62')]=function(_0x2db200,_0x4fd50f){_0x2db200['body'][_0x5120('0x63')]=_0x2db200[_0x5120('0x60')]['filename'];return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x2db200[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x4fd50f,null))[_0x5120('0x14')](saveUpdates(_0x2db200['body'],null))[_0x5120('0x14')](respondWithResult(_0x4fd50f,null))[_0x5120('0x1d')](handleError(_0x4fd50f,null));};exports[_0x5120('0x64')]=function(_0x388410,_0x2e6195){_0x388410[_0x5120('0x51')][_0x5120('0x65')]=_0x388410[_0x5120('0x60')][_0x5120('0x61')];return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x388410[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x2e6195,null))[_0x5120('0x14')](saveUpdates(_0x388410[_0x5120('0x51')],null))['then'](respondWithResult(_0x2e6195,null))[_0x5120('0x1d')](handleError(_0x2e6195,null));};exports[_0x5120('0x66')]=function(_0x1d0664,_0x17bcb3){var _0x80e1f8=path[_0x5120('0x67')](config['root'],_0x5120('0x68'));var _0x1e4799={'where':{'id':_0x1d0664[_0x5120('0x52')]['id']},'attributes':['id',_0x5120('0x69')],'raw':!![]};var _0xee8266=![];return require(_0x5120('0x6a'))[_0x5120('0x6b')]()[_0x5120('0x14')](function(_0x4ba51b){if(_0x4ba51b){_0xee8266=_0x4ba51b[_0x5120('0x6c')];}})[_0x5120('0x14')](function(){return db[_0x5120('0x2d')][_0x5120('0x48')](_0x1e4799);})[_0x5120('0x14')](handleEntityNotFound(_0x17bcb3,null))[_0x5120('0x14')](function(_0x4c495a){if(_0x4c495a){if(!_['isNil'](_0x4c495a[_0x5120('0x69')])){if(fs[_0x5120('0x6d')](path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/images/logos/',_0x4c495a[_0x5120('0x69')]))&&_0xee8266){_0x80e1f8=path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/images/logos/',_0x4c495a[_0x5120('0x69')]);}}return _0x17bcb3[_0x5120('0x6f')](_0x80e1f8);}})[_0x5120('0x1d')](handleError(_0x17bcb3,null));};exports['getAvatar']=function(_0x1147f7,_0x4f94b){var _0x37282d=path[_0x5120('0x67')](config['root'],_0x5120('0x70'));var _0x16490a={'where':{'id':_0x1147f7[_0x5120('0x52')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x5120('0x2d')]['find'](_0x16490a)['then'](handleEntityNotFound(_0x4f94b,null))[_0x5120('0x14')](function(_0x5c0578){if(_0x5c0578){if(!_[_0x5120('0x71')](_0x5c0578[_0x5120('0x5f')])){if(fs[_0x5120('0x6d')](path['join'](config[_0x5120('0x6e')],_0x5120('0x72'),_0x5c0578[_0x5120('0x5f')]))){_0x37282d=path[_0x5120('0x67')](config['root'],_0x5120('0x72'),_0x5c0578[_0x5120('0x5f')]);}}return _0x4f94b[_0x5120('0x6f')](_0x37282d);}})[_0x5120('0x1d')](handleError(_0x4f94b,null));};exports[_0x5120('0x73')]=function(_0x4e2931,_0x41795f){var _0x5f4a9a=path[_0x5120('0x67')](config[_0x5120('0x6e')],_0x5120('0x74'));var _0xc3ff34={'where':{'id':_0x4e2931[_0x5120('0x52')]['id']},'attributes':['id',_0x5120('0x63'),_0x5120('0x75')],'raw':!![]};return db['ChatWebsite']['find'](_0xc3ff34)[_0x5120('0x14')](handleEntityNotFound(_0x41795f,null))[_0x5120('0x14')](function(_0x1c29b3){if(_0x1c29b3){if(!_['isNil'](_0x1c29b3['customerAvatar'])){if(fs[_0x5120('0x6d')](path['join'](config[_0x5120('0x6e')],'server/files/images/avatars/',_0x1c29b3['customerAvatar']))&&_0x1c29b3[_0x5120('0x75')]){_0x5f4a9a=path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/images/avatars/',_0x1c29b3[_0x5120('0x63')]);}}return _0x41795f['download'](_0x5f4a9a);}})['catch'](handleError(_0x41795f,null));};exports[_0x5120('0x76')]=function(_0x4b5c2b,_0x1b1cdf){var _0x456d08=path['join'](config[_0x5120('0x6e')],'server/files/images/avatars/system_avatar.png');var _0x2a39cc={'where':{'id':_0x4b5c2b[_0x5120('0x52')]['id']},'attributes':['id',_0x5120('0x65')],'raw':!![]};return db[_0x5120('0x2d')]['find'](_0x2a39cc)['then'](handleEntityNotFound(_0x1b1cdf,null))[_0x5120('0x14')](function(_0x236435){if(_0x236435){if(!_['isNil'](_0x236435['systemAvatar'])){if(fs[_0x5120('0x6d')](path[_0x5120('0x67')](config[_0x5120('0x6e')],_0x5120('0x72'),_0x236435['systemAvatar']))){_0x456d08=path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/images/avatars/',_0x236435['systemAvatar']);}}return _0x1b1cdf[_0x5120('0x6f')](_0x456d08);}})[_0x5120('0x1d')](handleError(_0x1b1cdf,null));};exports[_0x5120('0x77')]=function(_0x1e981f,_0x1ced65){var _0x1d0995=require(_0x5120('0x78'));var _0x498159=new _0x1d0995();var _0x3a99cb=_0x498159['setUA'](_0x1e981f[_0x5120('0x79')][_0x5120('0x7a')])[_0x5120('0x7b')]();var _0x2391d2={'body':_0x1e981f[_0x5120('0x51')],'channel':_0x5120('0x7c')};var _0x2c3543=[];var _0x18a5cf=[];var _0x448323={};var _0x20fbdf=![];return db[_0x5120('0x7d')]['describe']()['then'](function(_0x2a98d5){if(!_0x2a98d5){throw new db[(_0x5120('0x7e'))][(_0x5120('0x7f'))](_0x5120('0x80'));}_0x2c3543=_[_0x5120('0x81')](_['keys'](_0x2a98d5),[_0x5120('0x82'),'updatedAt']);_0x18a5cf=_['difference'](_[_0x5120('0x30')](_0x2a98d5),['createdAt','updatedAt','CompanyId','ListId']);if(_0x1e981f['body']['id']){delete _0x1e981f[_0x5120('0x51')]['id'];}if(_['isNil'](_0x1e981f['body']['from'])){throw new db['Sequelize']['ValidationError'](_0x5120('0x83'));}if(_[_0x5120('0x71')](_0x1e981f['body'][_0x5120('0x51')])||_0x1e981f['body'][_0x5120('0x51')]===''){throw new db[(_0x5120('0x7e'))]['ValidationError'](_0x5120('0x84'));}if(_['isNil'](_0x1e981f['body'][_0x5120('0x85')])){throw new db[(_0x5120('0x7e'))][(_0x5120('0x7f'))](_0x5120('0x86')+_0x18a5cf);}if(!_[_0x5120('0x87')](_0x18a5cf,_0x1e981f[_0x5120('0x51')]['mapKey'])){throw new db[(_0x5120('0x7e'))][(_0x5120('0x7f'))](_0x5120('0x88')+_0x18a5cf);}_0x448323[_0x1e981f[_0x5120('0x51')][_0x5120('0x85')]]=_0x1e981f[_0x5120('0x51')][_0x5120('0x89')];})[_0x5120('0x14')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x1e981f[_0x5120('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x5120('0x8a'),'include':[{'model':db[_0x5120('0x7d')],'as':_0x5120('0x8b'),'where':_0x448323,'limit':0x1,'order':[[_0x5120('0x8c'),_0x5120('0x8d')]]}]},{'model':db[_0x5120('0x8e')],'as':'Applications'}]});})[_0x5120('0x14')](handleEntityNotFound(_0x1ced65,null))[_0x5120('0x14')](function(_0x307fad){if(_0x307fad&&_0x307fad[_0x5120('0x8a')]){_0x2391d2[_0x5120('0x8f')]=_0x307fad;_0x2391d2[_0x5120('0x90')]=_0x307fad[_0x5120('0x91')];_0x2391d2['list']=_0x307fad[_0x5120('0x8a')];_0x2391d2[_0x5120('0x90')]=_['orderBy'](_0x2391d2[_0x5120('0x90')],['priority'],[_0x5120('0x92')]);if(_0x2391d2['account']['Applications']){delete _0x2391d2[_0x5120('0x8f')]['Applications'];}if(_0x2391d2[_0x5120('0x8f')][_0x5120('0x8a')]&&_0x2391d2['account'][_0x5120('0x8a')][_0x5120('0x8b')][_0x5120('0x35')]){return _0x2391d2[_0x5120('0x8f')][_0x5120('0x8a')][_0x5120('0x8b')][0x0];}var _0x2c62f2=_[_0x5120('0xd')](_0x1e981f[_0x5120('0x51')],{'firstName':_0x1e981f[_0x5120('0x51')][_0x5120('0x89')],'ListId':_0x307fad['ListId']});_0x2c62f2[_0x1e981f[_0x5120('0x51')][_0x5120('0x85')]]=_0x1e981f['body'][_0x5120('0x89')];return db['CmContact'][_0x5120('0x49')](_0x2c62f2,{'fields':_0x2c3543,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ced65,null))[_0x5120('0x14')](function(_0x21434b){_0x2391d2[_0x5120('0x93')]=_0x21434b;var _0x1b4913=_0x1e981f[_0x5120('0x51')][_0x5120('0x94')];if(_0x1e981f[_0x5120('0x79')][_0x5120('0x95')]){_0x1b4913=_0x1e981f[_0x5120('0x79')][_0x5120('0x95')];}else if(_0x1e981f[_0x5120('0x79')][_0x5120('0x96')]){_0x1b4913=_['first'](_0x1e981f[_0x5120('0x79')][_0x5120('0x96')][_0x5120('0x97')](','));}if(_0x21434b){var _0x8b70ca={'ContactId':_0x21434b['id'],'ChatWebsiteId':_0x1e981f['params']['id'],'from':(_0x21434b[_0x5120('0x98')]||'')+'\x20'+(_0x21434b[_0x5120('0x99')]||''),'customerIp':_0x1b4913,'customerPort':_0x1e981f[_0x5120('0x79')][_0x5120('0x9a')]?_0x1e981f['headers'][_0x5120('0x9a')]:null,'referer':_0x1e981f[_0x5120('0x51')]['referer'],'browserName':_0x3a99cb['browser']['name']&&_0x3a99cb['browser'][_0x5120('0x9b')]?util['format'](_0x5120('0x9c'),_0x3a99cb[_0x5120('0x9d')][_0x5120('0x29')],_0x3a99cb['browser'][_0x5120('0x9b')]):'unknown','browserVersion':_0x3a99cb['browser'][_0x5120('0x9b')]||_0x5120('0x9e'),'osName':util[_0x5120('0x9f')](_0x5120('0x9c'),_0x3a99cb['os']['name'],_0x3a99cb['os'][_0x5120('0x9b')]),'osVersion':_0x3a99cb['os'][_0x5120('0x9b')],'deviceModel':_0x3a99cb[_0x5120('0xa0')]['model']&&_0x3a99cb[_0x5120('0xa0')][_0x5120('0xa1')]?util[_0x5120('0x9f')](_0x5120('0xa2'),_0x3a99cb['device'][_0x5120('0x32')],_0x3a99cb['device']['vendor'],_0x3a99cb[_0x5120('0xa0')]['type']):null,'deviceVendor':_0x3a99cb['device'][_0x5120('0xa1')],'deviceType':_0x3a99cb[_0x5120('0xa0')][_0x5120('0x3e')],'formData':JSON[_0x5120('0xa3')](_0x1e981f[_0x5120('0x51')])};var _0x4d19de={'ChatWebsiteId':_0x1e981f[_0x5120('0x52')]['id'],'closed':![]};if(_0x1e981f[_0x5120('0x51')][_0x5120('0xa4')]){_0x4d19de[_0x5120('0xa4')]=_0x1e981f[_0x5120('0x51')]['threadId'];return db[_0x5120('0xa5')][_0x5120('0x48')]({'where':_0x4d19de})[_0x5120('0x14')](function(_0x529643){if(_0x529643){return[_0x529643,![]];}_0x8b70ca['threadId']=_0x1e981f['body'][_0x5120('0xa4')];_0x8b70ca[_0x5120('0xa6')]=_0x1e981f['body'][_0x5120('0xa6')];return db[_0x5120('0xa5')][_0x5120('0x49')](_0x8b70ca)[_0x5120('0x14')](function(_0x32f936){return[_0x32f936,!![]];});});}_0x4d19de[_0x5120('0xa7')]=_0x21434b['id'];if(_0x1e981f[_0x5120('0x51')][_0x5120('0xa8')]&&_0x1e981f['body'][_0x5120('0xa8')]['id']){_0x4d19de['id']=_0x1e981f[_0x5120('0x51')]['interaction']['id'];return db[_0x5120('0xa5')][_0x5120('0x48')]({'where':_0x4d19de})[_0x5120('0x14')](function(_0x1c856d){if(_0x1c856d){return[_0x1c856d,![]];}return db['ChatInteraction']['create'](_0x8b70ca)[_0x5120('0x14')](function(_0x159074){return[_0x159074,!![]];});});}return db[_0x5120('0xa5')]['create'](_0x8b70ca)[_0x5120('0x14')](function(_0x2443b4){return[_0x2443b4,!![]];});}})[_0x5120('0xa9')](function(_0xcfeb52,_0x44adda){if(_0xcfeb52){_0x20fbdf=_0x44adda;if(!_0x44adda){var _0x9be4c7={'from':(_0x2391d2['contact'][_0x5120('0x98')]||'')+'\x20'+(_0x2391d2[_0x5120('0x93')][_0x5120('0x99')]||'')};if(_0x1e981f[_0x5120('0x51')][_0x5120('0xa4')]&&_0x1e981f['body']['messageId']&&_0x1e981f[_0x5120('0x51')][_0x5120('0xa4')]!=_0x1e981f[_0x5120('0x51')][_0x5120('0xaa')]){_0x9be4c7[_0x5120('0xa4')]=_0x1e981f[_0x5120('0x51')]['messageId'];}return _0xcfeb52[_0x5120('0xab')](_0x9be4c7);}else{return _0xcfeb52;}}})['then'](function(_0x177bf){_0x2391d2['interaction']=_0x177bf[_0x5120('0x4b')]({'plain':!![]});_0x2391d2[_0x5120('0xa8')][_0x5120('0xac')]=_0x20fbdf;if(_0x2391d2[_0x5120('0xa8')][_0x5120('0xac')]){if(_0x2391d2[_0x5120('0x8f')][_0x5120('0xad')]){_0x2391d2[_0x5120('0x90')]['push']({'id':0x0,'priority':_0x2391d2[_0x5120('0x90')][_0x5120('0x35')]+0x1,'app':'close','appdata':_0x5120('0xae'),'interval':_0x5120('0xaf')});}}return db[_0x5120('0xb0')][_0x5120('0x49')]({'body':_0x1e981f[_0x5120('0x51')][_0x5120('0x51')],'ChatWebsiteId':_0x1e981f[_0x5120('0x52')]['id'],'ChatInteractionId':_0x177bf['id'],'direction':'in','ContactId':_0x2391d2['contact']['id'],'AttachmentId':_0x1e981f['body'][_0x5120('0xb1')]});})['then'](function(_0x522aea){_0x2391d2[_0x5120('0x1a')]=_0x522aea;if(_0x2391d2[_0x5120('0xa8')][_0x5120('0xb2')]){return db[_0x5120('0xb3')][_0x5120('0x48')]({'attributes':['id',_0x5120('0x29')],'where':{'id':_0x2391d2[_0x5120('0xa8')][_0x5120('0xb2')]}})[_0x5120('0x14')](function(_0x3d066e){if(_0x3d066e){_0x2391d2[_0x5120('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5120('0xb4'),'appdata':_0x3d066e[_0x5120('0x29')]+','+(_0x2391d2['account'][_0x5120('0xb5')]||0xa),'interval':_0x5120('0xaf')});_0x2391d2['forcedOwnership']=!![];}return respondWithRpcPromise(_0x5120('0xb6'),_0x5120('0xb7'),_0x2391d2);});}return respondWithRpcPromise('Start',_0x5120('0xb7'),_0x2391d2);})['then'](function(_0x8dfdc3){respondWithRpcPromise('EventManager',_0x5120('0xb8'),{'event':_0x5120('0x77'),'message':_0x8dfdc3},client9002);return _0x8dfdc3;})[_0x5120('0x14')](respondWithResult(_0x1ced65,null))[_0x5120('0x1d')](handleError(_0x1ced65,null));};exports[_0x5120('0xb9')]=function(_0x4ff6ae,_0x15e521){var _0x4c0b2e,_0x566e97,_0x225e16;var _0x42771c=[];var _0x22dcae={};var _0x4d31ee=_0x4ff6ae[_0x5120('0xba')]||[];var _0x4bfb1d=[];var _0x5e805d;return db['CmContact'][_0x5120('0x53')]()[_0x5120('0x14')](function(_0xe868e6){if(!_0xe868e6){throw new db['Sequelize'][(_0x5120('0x7f'))](_0x5120('0x80'));}_0x42771c=_[_0x5120('0x81')](_['keys'](_0xe868e6),['createdAt','updatedAt','CompanyId',_0x5120('0xbb')]);if(_0x4ff6ae[_0x5120('0x51')]['id']){delete _0x4ff6ae[_0x5120('0x51')]['id'];}if(_[_0x5120('0x71')](_0x4ff6ae[_0x5120('0x51')][_0x5120('0x89')])){throw _0x15e521['status'](0x1f4)[_0x5120('0xbc')](new db['Sequelize'][(_0x5120('0x7f'))](_0x5120('0x83')));}if(_[_0x5120('0x71')](_0x4ff6ae[_0x5120('0x51')][_0x5120('0x51')])||_0x4ff6ae[_0x5120('0x51')][_0x5120('0x51')]===''){throw _0x15e521[_0x5120('0x1f')](0x1f4)['send'](new db[(_0x5120('0x7e'))][(_0x5120('0x7f'))](_0x5120('0x84')));}if(_[_0x5120('0x71')](_0x4ff6ae[_0x5120('0x51')][_0x5120('0xbd')])){throw _0x15e521[_0x5120('0x1f')](0x1f4)[_0x5120('0xbc')](new db['Sequelize'][(_0x5120('0x7f'))](_0x5120('0xbe')+_0x42771c));}if(!_[_0x5120('0x87')](_0x42771c,_0x4ff6ae[_0x5120('0x51')][_0x5120('0xbd')])){throw _0x15e521[_0x5120('0x1f')](0x1f4)['send'](new db['Sequelize'][(_0x5120('0x7f'))](_0x5120('0xbf')+_0x42771c));}_0x22dcae[_0x4ff6ae[_0x5120('0x51')][_0x5120('0xbd')]]=_0x4ff6ae['body'][_0x5120('0x89')];})[_0x5120('0x14')](function(){return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x4ff6ae[_0x5120('0x52')]['id']},'include':[{'model':db[_0x5120('0xc0')],'as':_0x5120('0x8a')},{'model':db[_0x5120('0xc1')],'as':_0x5120('0xc1')}]});})[_0x5120('0x14')](handleEntityNotFound(_0x15e521,null))[_0x5120('0x14')](function(_0x1506c5){if(_0x1506c5&&_0x1506c5['List']){_0x566e97=_0x1506c5;var _0x557e54=_[_0x5120('0xd')](_0x4ff6ae[_0x5120('0x51')],{'firstName':_0x4ff6ae[_0x5120('0x51')][_0x5120('0x89')],'phone':_0x4ff6ae['body']['from'],'ListId':_0x1506c5[_0x5120('0xbb')]});_0x557e54[_0x4ff6ae[_0x5120('0x51')][_0x5120('0xbd')]]=_0x4ff6ae[_0x5120('0x51')]['from'];return db['CmContact'][_0x5120('0xc2')]({'where':_0x22dcae,'defaults':_0x557e54});}})[_0x5120('0xa9')](function(_0x1500f4){if(_0x1500f4){_0x225e16=_0x1500f4;var _0x1eebd7=fs[_0x5120('0xc3')](path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/templates/chatOfflineMessage.ejs'),_0x5120('0xc4'));var _0x4b3b61=ejs[_0x5120('0xc5')](_0x1eebd7,{'body':_[_0x5120('0xc6')](_0x4ff6ae[_0x5120('0x51')][_0x5120('0x51')]),'bodyTitle':_0x566e97[_0x5120('0xc7')]});return db['ChatOfflineMessage'][_0x5120('0x49')]({'body':_0x4b3b61,'plainBody':htmlToText[_0x5120('0xc8')](_0x4b3b61),'ContactId':_0x1500f4['id'],'ChatWebsiteId':_0x566e97['id']});}})[_0x5120('0x14')](function(_0x1e00fe){_0x5e805d=_0x1e00fe;if(_0x4d31ee['length']){var _0x1c12b3=_0x4d31ee[_0x5120('0x2c')](function(_0x4f8f96){return{'name':_0x4f8f96[_0x5120('0xc9')],'basename':_0x4f8f96[_0x5120('0x61')],'type':_0x4f8f96[_0x5120('0xca')],'ChatOfflineMessageId':_0x1e00fe['id']};});_0x4bfb1d=_0x1c12b3[_0x5120('0x2c')](_0x54486a=>{var _0x31ca34={'filename':_0x54486a[_0x5120('0x29')],'path':path[_0x5120('0x67')](config[_0x5120('0x6e')],_0x5120('0xcb'),'files','attachments','offline-chat',_0x54486a[_0x5120('0xcc')])};return _0x31ca34;});if(!_0x566e97['openNewInteraction']){return db['sequelize'][_0x5120('0xcd')](function(_0x51d2be){return db['Attachment'][_0x5120('0xce')](_0x1c12b3,{'transaction':_0x51d2be});});}}})[_0x5120('0x14')](function(){if(_0x5e805d){_0x4c0b2e=_0x5e805d;return db[_0x5120('0xc1')][_0x5120('0x5c')]({'where':{'service':!![]},'include':[{'model':db[_0x5120('0xcf')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x5120('0xd0')],'as':_0x5120('0xd0'),'raw':!![]}]}]});}})[_0x5120('0x14')](function(_0x23d926){if(_0x23d926&&_0x23d926[_0x5120('0xd1')]&&_0x566e97['forwardOffline']&&_0x566e97['forwardOfflineAddress']){var _0x1b4295=_0x23d926[_0x5120('0xd2')]();return respondWithRpcPromise(_0x5120('0xd3'),_0x5120('0xd4'),{'account':_0x1b4295,'message':{'from':util[_0x5120('0x9f')](_0x5120('0xd5'),_0x23d926[_0x5120('0x29')],_0x23d926[_0x5120('0xd6')]||_0x23d926[_0x5120('0xd1')][_0x5120('0x4a')]),'to':_0x566e97[_0x5120('0xd7')],'subject':_0x566e97['offlineMessageSubject'],'html':_0x4c0b2e[_0x5120('0x51')],'attachments':_0x4bfb1d}},client9003)[_0x5120('0x14')](function(){return _0x4c0b2e;})['catch'](function(_0x341bb0){logger[_0x5120('0x18')](_0x341bb0);});}})[_0x5120('0x14')](function(){if(_0x566e97&&_0x566e97['openNewInteraction']&&_0x566e97[_0x5120('0xd8')]){var _0x3bb963=[];if(_0x4d31ee[_0x5120('0x35')]){_0x3bb963=_0x4d31ee[_0x5120('0x2c')](function(_0x9f422a){return{'name':_0x9f422a[_0x5120('0xc9')],'basename':_0x9f422a[_0x5120('0x61')],'type':_0x9f422a['mimetype'],'ChatOfflineMessageId':_0x5e805d['id']};});}var _0x42b789;if(!_['isNil'](_0x566e97[_0x5120('0xd9')])){var _0x58fcb1=_[_0x5120('0x2c')](_0x4ff6ae[_0x5120('0x51')],function(_0x467fe2){return _0x467fe2;});var _0x19aab2=_['toPairsIn'](_0x58fcb1)[0x0];var _0x50239f=_[_0x5120('0xda')](_0x19aab2,function(_0x189cab){return _0x189cab;});_0x42b789=_0x50239f[0x1][_0x566e97[_0x5120('0xd9')]];}var _0x3bd4b4={'from':_0x225e16['email'],'firstName':_0x225e16[_0x5120('0x98')],'lastName':_0x225e16['lastName'],'mapKey':'email','message':{'from':_0x225e16['email'],'to':_0x566e97[_0x5120('0xc1')]['email'],'cc':'','subject':_[_0x5120('0x71')](_0x42b789)?_0x566e97[_0x5120('0xdb')]:_0x42b789,'messageId':'','sentAt':new Date(),'attach':_0x3bb963[_0x5120('0x35')],'attachments':_0x3bb963,'originChannel':_0x5120('0xdc'),'ChatWebsiteId':_0x566e97['id'],'ChatOfflineMessageId':_0x4c0b2e['id'],'originTo':_0x566e97[_0x5120('0xc1')][_0x5120('0xd6')]},'body':_0x4c0b2e[_0x5120('0x51')]};var _0x9c5469={'account':{'id':_0x566e97['MailAccountId']},'body':_0x3bd4b4,'log':_0x5120('0xdd')};return respondWithRpcPromise(_0x5120('0xdd'),_0x5120('0xde'),_0x9c5469,client9001)[_0x5120('0x14')](function(){return _0x4c0b2e;})[_0x5120('0x1d')](function(_0x33eee2){logger['error'](_0x33eee2);});}return;})[_0x5120('0x14')](function(){if(_0x4c0b2e){return _0x4c0b2e;}})[_0x5120('0x14')](respondWithResult(_0x15e521,null))['catch'](function(_0x86297b){logger[_0x5120('0x18')]('catch',_0x86297b);for(var _0x4a87a4 of _0x4d31ee){var _0x4a065d=path[_0x5120('0x67')](config[_0x5120('0x6e')],_0x5120('0xcb'),_0x5120('0xba'),_0x5120('0xdf'),'offline-chat',_0x4a87a4[_0x5120('0x61')]);fs_extra[_0x5120('0xe0')](_0x4a065d)['catch'](function(_0x1b457a){logger[_0x5120('0x18')](_0x5120('0xe1'),_0x4a065d,_0x1b457a);});}});};exports[_0x5120('0xe2')]=function(_0x48109e,_0x4cfa0e){return db[_0x5120('0xa5')]['find']({'where':{'id':_0x48109e['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x4cfa0e,null))['then'](function(_0xb457ea){if(_0xb457ea){return _0xb457ea[_0x5120('0xe2')](_0x48109e['body']['ids'],_[_0x5120('0xe3')](_0x48109e[_0x5120('0x51')],['ids','id'])||{});}})[_0x5120('0x14')](respondWithResult(_0x4cfa0e,null))[_0x5120('0x1d')](handleError(_0x4cfa0e,null));};exports['getInteractions']=function(_0x1ccdf0,_0x54782f){var _0x20e62b={'raw':![],'where':{}};var _0x448de4={};var _0x371ef6={'count':0x0,'rows':[]};return db[_0x5120('0x2d')]['findOne']({'where':{'id':_0x1ccdf0['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x54782f,null))[_0x5120('0x14')](function(_0x3a3aca){if(_0x3a3aca){_0x448de4[_0x5120('0x32')]=_[_0x5120('0x30')](db[_0x5120('0xa5')][_0x5120('0x46')]);_0x448de4[_0x5120('0x2f')]=_['keys'](_0x1ccdf0[_0x5120('0x2f')]);_0x448de4[_0x5120('0x31')]=_[_0x5120('0x47')](_0x448de4[_0x5120('0x32')],_0x448de4[_0x5120('0x2f')]);_0x20e62b[_0x5120('0x33')]=_['intersection'](_0x448de4[_0x5120('0x32')],qs['fields'](_0x1ccdf0['query'][_0x5120('0x34')]));_0x20e62b['attributes']=_0x20e62b[_0x5120('0x33')][_0x5120('0x35')]?_0x20e62b[_0x5120('0x33')]:_0x448de4[_0x5120('0x32')];if(!_0x1ccdf0['query'][_0x5120('0x36')](_0x5120('0x37'))){_0x20e62b[_0x5120('0x22')]=qs[_0x5120('0x22')](_0x1ccdf0[_0x5120('0x2f')][_0x5120('0x22')]);_0x20e62b[_0x5120('0x21')]=qs['offset'](_0x1ccdf0[_0x5120('0x2f')][_0x5120('0x21')]);}_0x20e62b[_0x5120('0x38')]=qs[_0x5120('0x39')](_0x1ccdf0[_0x5120('0x2f')]['sort']);_0x20e62b['where']=qs['filters'](_['pick'](_0x1ccdf0[_0x5120('0x2f')],_0x448de4[_0x5120('0x31')]));_0x20e62b[_0x5120('0x3a')][_0x5120('0x55')]=_0x3a3aca['id'];if(_0x1ccdf0['query'][_0x5120('0x3c')]){_0x20e62b[_0x5120('0x3a')]=_[_0x5120('0x3d')](_0x20e62b[_0x5120('0x3a')],{'$or':_[_0x5120('0x2c')](_0x20e62b[_0x5120('0x33')],function(_0x1e7df4){var _0x1ea29f={};_0x1ea29f[_0x1e7df4]={'$like':'%'+_0x1ccdf0[_0x5120('0x2f')][_0x5120('0x3c')]+'%'};return _0x1ea29f;})});}_0x20e62b=_['merge']({},_0x20e62b,_0x1ccdf0[_0x5120('0x3f')]);return db[_0x5120('0xa5')]['count']({'where':_0x20e62b[_0x5120('0x3a')]})[_0x5120('0x14')](function(_0x14e3e6){_0x371ef6['count']=_0x14e3e6;if(_0x1ccdf0[_0x5120('0x2f')][_0x5120('0x40')]){_0x20e62b[_0x5120('0x41')]=[{'model':db[_0x5120('0x7d')],'as':_0x5120('0xe4'),'required':![]},{'model':db[_0x5120('0xb3')],'as':'Owner','attributes':[_0x5120('0x29'),'fullname',_0x5120('0xe5')],'required':![]},{'model':db['Tag'],'as':_0x5120('0xe6'),'attributes':['id',_0x5120('0x29'),_0x5120('0xe7')],'where':_0x1ccdf0[_0x5120('0x2f')][_0x5120('0xe8')]?{'id':_0x1ccdf0[_0x5120('0x2f')]['tag']}:undefined,'required':_0x1ccdf0[_0x5120('0x2f')]['tag']?!![]:![]}];}return db[_0x5120('0xa5')][_0x5120('0x42')](_0x20e62b);})['then'](function(_0xeb3080){_0x371ef6[_0x5120('0x43')]=_0xeb3080;return _0x371ef6;});}})[_0x5120('0x14')](respondWithFilteredResult(_0x54782f,_0x20e62b))[_0x5120('0x1d')](handleError(_0x54782f,null));};function iftimePromise(_0x480ef6,_0x4f4942){return respondWithRpcPromise(_0x5120('0xe9'),_0x5120('0xea'),{'command':_0x4f4942['timezone']?util[_0x5120('0x9f')](_0x5120('0xeb'),_0x480ef6[_0x5120('0xec')],_0x4f4942['timezone']):util['format'](_0x5120('0xed'),_0x480ef6[_0x5120('0xec')])},client9002)[_0x5120('0x14')](function(_0x37c2e6){var _0x4a00ad=_0x37c2e6&&_0x37c2e6[_0x5120('0xee')](_0x5120('0xef'))>=0x0?!![]:![];logger[_0x5120('0x15')](_0x5120('0xf0'),_0x4f4942['id'],_0x480ef6['id'],_0x480ef6[_0x5120('0xec')],_0x4a00ad?_0x5120('0xf1'):_0x5120('0xf2'),_0x4f4942[_0x5120('0xf3')]?_0x4f4942['timezone']:_0x5120('0xf4'));return _0x4a00ad;})[_0x5120('0x1d')](function(_0x5a7c60){logger[_0x5120('0x18')](_0x5120('0xf0'),_0x4f4942['id'],_0x480ef6['id'],_0x480ef6['interval'],util[_0x5120('0xf5')](_0x5a7c60,{'showHidden':![],'depth':null}),_0x4f4942[_0x5120('0xf3')]?_0x4f4942[_0x5120('0xf3')]:_0x5120('0xf4'));return![];});}exports['getSnippet']=function(_0x411159,_0x373603){var _0x4abd7f=0x0;var _0x40ea67=0x0;var _0x33fa57=![];var _0x458673;var _0x17961e;return db['ChatWebsite'][_0x5120('0x48')]({'where':{'id':_0x411159[_0x5120('0x52')]['id']},'include':[{'model':db[_0x5120('0xf6')],'as':'Interval','include':[{'model':db[_0x5120('0xf6')],'as':'Intervals','attributes':['id',_0x5120('0xec')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x373603,null))[_0x5120('0x14')](function(_0x247e06){if(_0x247e06){_0x458673=_0x247e06;return _0x247e06[_0x5120('0xf7')]({'raw':!![]});}})[_0x5120('0x14')](function(_0x565b22){if(_0x458673){if(_0x565b22){_0x17961e=_0x565b22;}}return require('../../config/license/util')[_0x5120('0x6b')]();})[_0x5120('0x14')](function(_0x52c237){if(_0x52c237){_0x40ea67=_0x52c237[_0x5120('0xf8')];_0x33fa57=_0x52c237[_0x5120('0x6c')];}})['then'](function(){return db[_0x5120('0xa5')][_0x5120('0x24')]({'where':{'closed':![]}});})['then'](function(_0x30b477){_0x4abd7f=_0x30b477;if(_0x40ea67&&_0x30b477>_0x40ea67){return db[_0x5120('0xf9')][_0x5120('0x5c')]({'where':{'id':0x1}})['then'](function(_0x1de1c0){if(_0x1de1c0){_0x1de1c0[_0x5120('0xfa')](_0x5120('0xfb'));}});}})[_0x5120('0x14')](function(){if(_0x458673[_0x5120('0xf6')]&&_0x458673[_0x5120('0xf6')]['Intervals']){var _0xf60abe=[];for(var _0x2d85a5=0x0;_0x2d85a5<_0x458673[_0x5120('0xf6')]['Intervals']['length'];_0x2d85a5++){var _0x14ff0f=_0x458673[_0x5120('0xf6')][_0x5120('0xfc')][_0x2d85a5][_0x5120('0x4b')]({'plain':!![]});_0xf60abe[_0x5120('0xfd')](iftimePromise(_0x14ff0f,_0x458673));}return BPromise[_0x5120('0xfe')](_0xf60abe)[_0x5120('0x14')](function(_0x277737){return _[_0x5120('0xff')](_0x277737);});}else{return!![];}})['then'](function(_0x1c79bc){var _0x573fb1=fs[_0x5120('0xc3')](path[_0x5120('0x67')](config[_0x5120('0x6e')],'server/files/chat/iframe.ejs'),'utf8');var _0x30947d={'remote':_0x458673[_0x5120('0x100')],'query':querystring[_0x5120('0xa3')](_[_0x5120('0x3d')](_0x458673[_0x5120('0x4b')]({'plain':!![]}),{'customerIp':_0x411159[_0x5120('0x79')][_0x5120('0x96')]||_0x411159['headers'][_0x5120('0x101')]||_0x411159['connection'][_0x5120('0x102')]||_0x411159['ip'],'referer':_0x411159[_0x5120('0x79')][_0x5120('0x103')],'openedInteractions':_0x4abd7f,'maxInteractions':_0x40ea67,'virtual':_0x33fa57[_0x5120('0xf8')],'online':_0x1c79bc,'custom':_0x33fa57}))['replace'](/'/g,'\x5c\x27')};_0x373603['send'](ejs[_0x5120('0xc5')](Mustache[_0x5120('0xc5')](_0x573fb1,_0x30947d),{'proactiveActions':_0x17961e,'alignment':_0x458673[_0x5120('0x104')],'verticalAlignment':_0x458673[_0x5120('0x105')],'div_color':_0x458673[_0x5120('0xe7')],'labelText':_0x458673[_0x5120('0x106')],'text_color':_0x458673[_0x5120('0x107')],'text_button_color':_0x458673['textButtonColor'],'button_color':_0x458673[_0x5120('0x108')],'background_color':_0x458673['backgroundColor'],'hideWhenOffline':_0x458673[_0x5120('0x109')],'interval':_0x458673[_0x5120('0x10a')]}));})[_0x5120('0x1d')](handleError(_0x373603,null));};exports['addApplications']=function(_0x508a9f,_0x3f0d37){var _0x2ba348=_0x508a9f[_0x5120('0x52')]['id'];var _0x1e010e=_0x508a9f['body'];var _0x570527=0xc8;var _0x1c4df4=null;return db['sequelize'][_0x5120('0xcd')]({'isolationLevel':db[_0x5120('0x10b')][_0x5120('0x10c')]['ISOLATION_LEVELS'][_0x5120('0x10d')]},function(_0x19e7a1){return db[_0x5120('0x2d')]['findOne']({'where':{'id':_0x2ba348},'transaction':_0x19e7a1})['then'](function(_0x40d387){if(_0x40d387){return db[_0x5120('0x8e')][_0x5120('0x25')]({'where':{'ChatWebsiteId':_0x2ba348},'transaction':_0x19e7a1})[_0x5120('0x14')](function(){var _0x134efe=_['map'](_0x1e010e,function(_0x446199){_0x446199['ChatWebsiteId']=_0x2ba348;return _0x446199;});return db['ChatApplication'][_0x5120('0xce')](_0x134efe,{'transaction':_0x19e7a1});});}else{_0x570527=0x194;_0x1c4df4=[];}});})['then'](function(){if(_0x570527!==0x194){return db[_0x5120('0x8e')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2ba348},'order':_0x5120('0x10e')})['then'](function(_0x2bd012){_0x1c4df4=_0x2bd012;});}})[_0x5120('0x1d')](function(_0xb90b83){_0x570527=0x1f4;logger[_0x5120('0x18')](_0xb90b83[_0x5120('0x28')]);if(_0xb90b83[_0x5120('0x29')]){delete _0xb90b83[_0x5120('0x29')];}_0x1c4df4=_0xb90b83;})[_0x5120('0x10f')](function(){if(_0x1c4df4===null){_0x3f0d37[_0x5120('0x1e')](_0x570527);}else{if(_0x570527===0x1f4){_0x3f0d37[_0x5120('0x1f')](_0x570527)[_0x5120('0xbc')](_0x1c4df4);}else{_0x3f0d37[_0x5120('0x1f')](_0x570527)[_0x5120('0x110')](_0x1c4df4);}}});};exports[_0x5120('0x111')]=function(_0x4803d0,_0x4d3117){var _0x4d0ba1={};var _0x43e33e={};var _0x4b16c7;var _0x395451;return db[_0x5120('0x2d')][_0x5120('0x5c')]({'where':{'id':_0x4803d0[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x4d3117,null))[_0x5120('0x14')](function(_0x14675a){if(_0x14675a){_0x4b16c7=_0x14675a;_0x43e33e[_0x5120('0x32')]=_['keys'](db['ChatApplication'][_0x5120('0x46')]);_0x43e33e[_0x5120('0x2f')]=_['keys'](_0x4803d0[_0x5120('0x2f')]);_0x43e33e[_0x5120('0x31')]=_['intersection'](_0x43e33e[_0x5120('0x32')],_0x43e33e['query']);_0x4d0ba1[_0x5120('0x33')]=_[_0x5120('0x47')](_0x43e33e[_0x5120('0x32')],qs['fields'](_0x4803d0[_0x5120('0x2f')][_0x5120('0x34')]));_0x4d0ba1[_0x5120('0x33')]=_0x4d0ba1[_0x5120('0x33')][_0x5120('0x35')]?_0x4d0ba1['attributes']:_0x43e33e[_0x5120('0x32')];_0x4d0ba1['order']=qs[_0x5120('0x39')](_0x4803d0['query'][_0x5120('0x39')]);_0x4d0ba1[_0x5120('0x3a')]=qs[_0x5120('0x31')](_[_0x5120('0x3b')](_0x4803d0[_0x5120('0x2f')],_0x43e33e[_0x5120('0x31')]));if(_0x4803d0['query']['filter']){_0x4d0ba1[_0x5120('0x3a')]=_[_0x5120('0x3d')](_0x4d0ba1[_0x5120('0x3a')],{'$or':_[_0x5120('0x2c')](_0x4d0ba1[_0x5120('0x33')],function(_0x53f461){var _0x1d622b={};_0x1d622b[_0x53f461]={'$like':'%'+_0x4803d0[_0x5120('0x2f')]['filter']+'%'};return _0x1d622b;})});}_0x4d0ba1=_[_0x5120('0x3d')]({},_0x4d0ba1,_0x4803d0[_0x5120('0x3f')]);return _0x4b16c7[_0x5120('0x111')](_0x4d0ba1);}})['then'](function(_0x327adc){if(_0x327adc){_0x395451=_0x327adc[_0x5120('0x35')];if(!_0x4803d0[_0x5120('0x2f')][_0x5120('0x36')](_0x5120('0x37'))){_0x4d0ba1[_0x5120('0x22')]=qs['limit'](_0x4803d0[_0x5120('0x2f')][_0x5120('0x22')]);_0x4d0ba1[_0x5120('0x21')]=qs[_0x5120('0x21')](_0x4803d0[_0x5120('0x2f')][_0x5120('0x21')]);}return _0x4b16c7[_0x5120('0x111')](_0x4d0ba1);}})[_0x5120('0x14')](function(_0x25188d){if(_0x25188d){return _0x25188d?{'count':_0x395451,'rows':_0x25188d}:null;}})['then'](respondWithResult(_0x4d3117,null))[_0x5120('0x1d')](handleError(_0x4d3117,null));};exports[_0x5120('0x112')]=function(_0x2f62ea,_0x5ad9b4){return db[_0x5120('0x113')]['find']({'where':{'id':_0x2f62ea['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x5ad9b4,null))[_0x5120('0x14')](function(_0x4ff412){if(_0x4ff412){return _0x4ff412['addProactiveActions'](_0x2f62ea[_0x5120('0x51')][_0x5120('0x58')],_['omit'](_0x2f62ea[_0x5120('0x51')],[_0x5120('0x58'),'id'])||{});}})[_0x5120('0x14')](respondWithResult(_0x5ad9b4,null))[_0x5120('0x1d')](handleError(_0x5ad9b4,null));};exports[_0x5120('0xf7')]=function(_0xff4a7c,_0x3de40d){var _0x6c0d78={};var _0xd8293c={};var _0x14a4db;var _0x28ac09;return db[_0x5120('0x2d')]['findOne']({'where':{'id':_0xff4a7c[_0x5120('0x52')]['id']}})['then'](handleEntityNotFound(_0x3de40d,null))[_0x5120('0x14')](function(_0x58eb44){if(_0x58eb44){_0x14a4db=_0x58eb44;_0xd8293c[_0x5120('0x32')]=_[_0x5120('0x30')](db['ChatProactiveAction'][_0x5120('0x46')]);_0xd8293c[_0x5120('0x2f')]=_['keys'](_0xff4a7c[_0x5120('0x2f')]);_0xd8293c[_0x5120('0x31')]=_[_0x5120('0x47')](_0xd8293c[_0x5120('0x32')],_0xd8293c[_0x5120('0x2f')]);_0x6c0d78[_0x5120('0x33')]=_['intersection'](_0xd8293c[_0x5120('0x32')],qs[_0x5120('0x34')](_0xff4a7c[_0x5120('0x2f')][_0x5120('0x34')]));_0x6c0d78[_0x5120('0x33')]=_0x6c0d78[_0x5120('0x33')][_0x5120('0x35')]?_0x6c0d78['attributes']:_0xd8293c[_0x5120('0x32')];_0x6c0d78[_0x5120('0x38')]=qs[_0x5120('0x39')](_0xff4a7c[_0x5120('0x2f')][_0x5120('0x39')]);_0x6c0d78[_0x5120('0x3a')]=qs[_0x5120('0x31')](_['pick'](_0xff4a7c[_0x5120('0x2f')],_0xd8293c[_0x5120('0x31')]));if(_0xff4a7c[_0x5120('0x2f')][_0x5120('0x3c')]){_0x6c0d78[_0x5120('0x3a')]=_['merge'](_0x6c0d78[_0x5120('0x3a')],{'$or':_['map'](_0x6c0d78['attributes'],function(_0x4786dc){var _0x192e47={};_0x192e47[_0x4786dc]={'$like':'%'+_0xff4a7c[_0x5120('0x2f')][_0x5120('0x3c')]+'%'};return _0x192e47;})});}_0x6c0d78=_[_0x5120('0x3d')]({},_0x6c0d78,_0xff4a7c[_0x5120('0x3f')]);return _0x14a4db[_0x5120('0xf7')](_0x6c0d78);}})[_0x5120('0x14')](function(_0x1cba6c){if(_0x1cba6c){_0x28ac09=_0x1cba6c[_0x5120('0x35')];if(!_0xff4a7c[_0x5120('0x2f')]['hasOwnProperty'](_0x5120('0x37'))){_0x6c0d78[_0x5120('0x22')]=qs[_0x5120('0x22')](_0xff4a7c[_0x5120('0x2f')][_0x5120('0x22')]);_0x6c0d78['offset']=qs[_0x5120('0x21')](_0xff4a7c[_0x5120('0x2f')][_0x5120('0x21')]);}return _0x14a4db[_0x5120('0xf7')](_0x6c0d78);}})[_0x5120('0x14')](function(_0x40e58c){if(_0x40e58c){return _0x40e58c?{'count':_0x28ac09,'rows':_0x40e58c}:null;}})[_0x5120('0x14')](respondWithResult(_0x3de40d,null))[_0x5120('0x1d')](handleError(_0x3de40d,null));};exports[_0x5120('0x114')]=function(_0x4b4454,_0x298306){var _0x6a50a6=_0x4b4454[_0x5120('0x2f')][_0x5120('0x115')]===_0x5120('0x116')?_0x5120('0x117'):_0x5120('0x118');return db[_0x5120('0x2d')][_0x5120('0x48')]({'attributes':['id',_0x6a50a6],'where':{'id':_0x4b4454[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x298306,null))[_0x5120('0x14')](function(_0x206fef){if(_0x206fef){var _0xd2770d=_0x206fef[_0x6a50a6];var _0x39f7e4=_0xd2770d&&_0xd2770d[_0x5120('0x119')]?_0xd2770d['items']:[];_0x298306[_0x5120('0xbc')]({'fromKey':_[_0x5120('0x71')](_0xd2770d['fromKey'])?undefined:_0xd2770d[_0x5120('0x11a')],'count':_0x39f7e4[_0x5120('0x35')],'rows':_0x39f7e4});}})['catch'](handleError(_0x298306,null));};exports['getOfflineMessages']=function(_0x589022,_0x39499f){var _0x44c2b0={'raw':![],'where':{}};var _0x17180a={};var _0x355915={'count':0x0,'rows':[]};return db[_0x5120('0x2d')][_0x5120('0x5c')]({'where':{'id':_0x589022[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x39499f,null))[_0x5120('0x14')](function(_0x41bb5b){if(_0x41bb5b){_0x17180a[_0x5120('0x32')]=_['keys'](db[_0x5120('0x11b')][_0x5120('0x46')]);_0x17180a[_0x5120('0x2f')]=_['keys'](_0x589022[_0x5120('0x2f')]);_0x17180a['filters']=_[_0x5120('0x47')](_0x17180a['model'],_0x17180a[_0x5120('0x2f')]);_0x44c2b0[_0x5120('0x33')]=_[_0x5120('0x47')](_0x17180a[_0x5120('0x32')],qs[_0x5120('0x34')](_0x589022['query'][_0x5120('0x34')]));_0x44c2b0[_0x5120('0x33')]=_0x44c2b0[_0x5120('0x33')][_0x5120('0x35')]?_0x44c2b0[_0x5120('0x33')]:_0x17180a[_0x5120('0x32')];if(!_0x589022[_0x5120('0x2f')]['hasOwnProperty'](_0x5120('0x37'))){_0x44c2b0[_0x5120('0x22')]=qs[_0x5120('0x22')](_0x589022[_0x5120('0x2f')][_0x5120('0x22')]);_0x44c2b0[_0x5120('0x21')]=qs[_0x5120('0x21')](_0x589022[_0x5120('0x2f')][_0x5120('0x21')]);}_0x44c2b0[_0x5120('0x38')]=qs[_0x5120('0x39')](_0x589022['query']['sort']);_0x44c2b0[_0x5120('0x3a')]=qs[_0x5120('0x31')](_['pick'](_0x589022[_0x5120('0x2f')],_0x17180a['filters']));_0x44c2b0[_0x5120('0x3a')][_0x5120('0x55')]=_0x41bb5b['id'];if(_0x589022[_0x5120('0x2f')][_0x5120('0x3c')]){_0x44c2b0[_0x5120('0x3a')]=_['merge'](_0x44c2b0[_0x5120('0x3a')],{'$or':_[_0x5120('0x2c')](_0x44c2b0['attributes'],function(_0x11fa9a){var _0x50b2fe={};_0x50b2fe[_0x11fa9a]={'$like':'%'+_0x589022['query'][_0x5120('0x3c')]+'%'};return _0x50b2fe;})});}_0x44c2b0=_[_0x5120('0x3d')]({},_0x44c2b0,_0x589022[_0x5120('0x3f')]);return db[_0x5120('0x11b')][_0x5120('0x24')]({'where':_0x44c2b0[_0x5120('0x3a')]})[_0x5120('0x14')](function(_0x542a0e){_0x355915[_0x5120('0x24')]=_0x542a0e;if(_0x589022['query']['includeAll']){_0x44c2b0[_0x5120('0x41')]=[{'all':!![]}];}else{_0x44c2b0[_0x5120('0x41')]=[{'model':db[_0x5120('0x7d')],'as':_0x5120('0xe4'),'required':![]},{'model':db['Attachment'],'as':_0x5120('0x11c'),'required':![]}];}return db[_0x5120('0x11b')][_0x5120('0x42')](_0x44c2b0);})[_0x5120('0x14')](function(_0x5c503c){_0x355915[_0x5120('0x43')]=_0x5c503c;return _0x355915;});}})[_0x5120('0x14')](respondWithFilteredResult(_0x39499f,_0x44c2b0))[_0x5120('0x1d')](handleError(_0x39499f,null));};exports[_0x5120('0x11d')]=function(_0x5a043f,_0xbe85f3){return db[_0x5120('0x2d')][_0x5120('0x48')]({'where':{'id':_0x5a043f['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0xbe85f3,null))[_0x5120('0x14')](function(_0x46373e){if(_0x46373e){return _0x46373e['addAgents'](_0x5a043f[_0x5120('0x51')][_0x5120('0x58')],_[_0x5120('0xe3')](_0x5a043f[_0x5120('0x51')],['ids','id'])||{})['spread'](function(_0x2947ee){for(var _0x5811d1=0x0;_0x5811d1<_0x5a043f[_0x5120('0x51')][_0x5120('0x58')]['length'];_0x5811d1+=0x1){socket[_0x5120('0x11e')](_0x5120('0x11f'),{'UserId':Number(_0x5a043f[_0x5120('0x51')][_0x5120('0x58')][_0x5811d1]),'ChatWebsiteId':Number(_0x5a043f[_0x5120('0x52')]['id'])});}return _0x2947ee;});}})[_0x5120('0x14')](respondWithResult(_0xbe85f3,null))[_0x5120('0x1d')](handleError(_0xbe85f3,null));};exports[_0x5120('0x120')]=function(_0x468476,_0x313f61){return db['ChatWebsite'][_0x5120('0x48')]({'where':{'id':_0x468476['params']['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x313f61,null))[_0x5120('0x14')](function(_0x1276d7){if(_0x1276d7){return _0x1276d7[_0x5120('0x120')](_0x468476[_0x5120('0x2f')][_0x5120('0x58')])[_0x5120('0x14')](function(){if(_[_0x5120('0x121')](_0x468476[_0x5120('0x2f')][_0x5120('0x58')])){for(var _0x141af7=0x0;_0x141af7<_0x468476[_0x5120('0x2f')][_0x5120('0x58')][_0x5120('0x35')];_0x141af7+=0x1){socket['emit'](_0x5120('0x122'),{'UserId':Number(_0x468476['query'][_0x5120('0x58')][_0x141af7]),'ChatWebsiteId':Number(_0x468476[_0x5120('0x52')]['id'])});}}else{socket['emit'](_0x5120('0x122'),{'UserId':Number(_0x468476[_0x5120('0x2f')]['ids']),'ChatWebsiteId':Number(_0x468476['params']['id'])});}});}})[_0x5120('0x14')](respondWithStatusCode(_0x313f61,null))[_0x5120('0x1d')](handleError(_0x313f61,null));};exports[_0x5120('0x123')]=function(_0x21d198,_0x5bf29e){var _0x349496={};var _0x9a7322={};var _0x52706a;var _0x333cd9;return db[_0x5120('0x2d')][_0x5120('0x5c')]({'where':{'id':_0x21d198[_0x5120('0x52')]['id']}})[_0x5120('0x14')](handleEntityNotFound(_0x5bf29e,null))[_0x5120('0x14')](function(_0x1eee74){if(_0x1eee74){_0x52706a=_0x1eee74;_0x9a7322['model']=_[_0x5120('0x30')](db[_0x5120('0xb3')]['rawAttributes']);_0x9a7322[_0x5120('0x2f')]=_[_0x5120('0x30')](_0x21d198[_0x5120('0x2f')]);_0x9a7322[_0x5120('0x31')]=_['intersection'](_0x9a7322[_0x5120('0x32')],_0x9a7322[_0x5120('0x2f')]);_0x349496[_0x5120('0x33')]=_[_0x5120('0x47')](_0x9a7322[_0x5120('0x32')],qs[_0x5120('0x34')](_0x21d198[_0x5120('0x2f')][_0x5120('0x34')]));_0x349496[_0x5120('0x33')]=_0x349496[_0x5120('0x33')][_0x5120('0x35')]?_0x349496['attributes']:_0x9a7322[_0x5120('0x32')];_0x349496[_0x5120('0x38')]=qs['sort'](_0x21d198['query']['sort']);_0x349496['where']=qs[_0x5120('0x31')](_[_0x5120('0x3b')](_0x21d198[_0x5120('0x2f')],_0x9a7322['filters']));if(_0x21d198[_0x5120('0x2f')][_0x5120('0x3c')]){_0x349496[_0x5120('0x3a')]=_['merge'](_0x349496[_0x5120('0x3a')],{'$or':_[_0x5120('0x2c')](_0x349496[_0x5120('0x33')],function(_0x29642e){var _0x3dca4c={};_0x3dca4c[_0x29642e]={'$like':'%'+_0x21d198[_0x5120('0x2f')]['filter']+'%'};return _0x3dca4c;})});}_0x349496=_[_0x5120('0x3d')]({},_0x349496,_0x21d198[_0x5120('0x3f')]);return _0x52706a[_0x5120('0x123')](_0x349496);}})['then'](function(_0x5897b2){if(_0x5897b2){_0x333cd9=_0x5897b2['length'];if(!_0x21d198[_0x5120('0x2f')]['hasOwnProperty']('nolimit')){_0x349496['limit']=qs[_0x5120('0x22')](_0x21d198[_0x5120('0x2f')][_0x5120('0x22')]);_0x349496[_0x5120('0x21')]=qs[_0x5120('0x21')](_0x21d198[_0x5120('0x2f')]['offset']);}return _0x52706a[_0x5120('0x123')](_0x349496);}})['then'](function(_0x54a159){if(_0x54a159){return _0x54a159?{'count':_0x333cd9,'rows':_0x54a159}:null;}})[_0x5120('0x14')](respondWithResult(_0x5bf29e,null))[_0x5120('0x1d')](handleError(_0x5bf29e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 52b102d..5f273af 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 _0x323b=['emit','hasOwnProperty','events','ChatWebsite','setMaxListeners','save','remove'];(function(_0x210b2e,_0x26e7f9){var _0x47c9d6=function(_0x5d06c1){while(--_0x5d06c1){_0x210b2e['push'](_0x210b2e['shift']());}};_0x47c9d6(++_0x26e7f9);}(_0x323b,0x1ad));var _0xb323=function(_0x94ca50,_0x1dc8f1){_0x94ca50=_0x94ca50-0x0;var _0x3075fb=_0x323b[_0x94ca50];return _0x3075fb;};'use strict';var EventEmitter=require(_0xb323('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xb323('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb323('0x2')](0x0);var events={'afterCreate':_0xb323('0x3'),'afterUpdate':'update','afterDestroy':_0xb323('0x4')};function emitEvent(_0x4532c7){return function(_0x3bcab5,_0x2132bd,_0x38f1d0){ChatWebsiteEvents[_0xb323('0x5')](_0x4532c7+':'+_0x3bcab5['id'],_0x3bcab5);ChatWebsiteEvents[_0xb323('0x5')](_0x4532c7,_0x3bcab5);_0x38f1d0(null);};}for(var e in events){if(events[_0xb323('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xec39=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','hook'];(function(_0x2c4076,_0x2ac9dd){var _0x42535d=function(_0x3701ec){while(--_0x3701ec){_0x2c4076['push'](_0x2c4076['shift']());}};_0x42535d(++_0x2ac9dd);}(_0xec39,0x19f));var _0x9ec3=function(_0x464437,_0x13865f){_0x464437=_0x464437-0x0;var _0x3cb0af=_0xec39[_0x464437];return _0x3cb0af;};'use strict';var EventEmitter=require(_0x9ec3('0x0'));var ChatWebsite=require(_0x9ec3('0x1'))['db'][_0x9ec3('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9ec3('0x3')](0x0);var events={'afterCreate':_0x9ec3('0x4'),'afterUpdate':_0x9ec3('0x5'),'afterDestroy':_0x9ec3('0x6')};function emitEvent(_0x5c0885){return function(_0x1f43fb,_0x1c944d,_0xaff658){ChatWebsiteEvents['emit'](_0x5c0885+':'+_0x1f43fb['id'],_0x1f43fb);ChatWebsiteEvents['emit'](_0x5c0885,_0x1f43fb);_0xaff658(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9ec3('0x7')](e,emitEvent(event));}}module[_0x9ec3('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 08349e6..918430f 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 _0x0307=['../../config/logger','api','rimraf','../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x0307,0xc6));var _0x7030=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x0307[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0x7030('0x0'));var util=require(_0x7030('0x1'));var logger=require(_0x7030('0x2'))(_0x7030('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7030('0x4'));var config=require(_0x7030('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x7030('0x6')]=function(_0x2c2ef8,_0x37819e){return _0x2c2ef8[_0x7030('0x7')](_0x7030('0x8'),attributes,{'tableName':_0x7030('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x295f=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x14665e,_0x52b2ff){var _0x570836=function(_0x4bacb8){while(--_0x4bacb8){_0x14665e['push'](_0x14665e['shift']());}};_0x570836(++_0x52b2ff);}(_0x295f,0x75));var _0xf295=function(_0x22e6b7,_0x39266c){_0x22e6b7=_0x22e6b7-0x0;var _0x2723e5=_0x295f[_0x22e6b7];return _0x2723e5;};'use strict';var _=require(_0xf295('0x0'));var util=require(_0xf295('0x1'));var logger=require(_0xf295('0x2'))(_0xf295('0x3'));var moment=require(_0xf295('0x4'));var BPromise=require(_0xf295('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf295('0x6'));var rimraf=require(_0xf295('0x7'));var config=require('../../config/environment');var attributes=require(_0xf295('0x8'));module[_0xf295('0x9')]=function(_0x4921d3,_0x6e5542){return _0x4921d3[_0xf295('0xa')](_0xf295('0xb'),attributes,{'tableName':_0xf295('0xc'),'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 630c5d6..e91f2a6 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 _0x3215=['../../config/environment','http','redis','defaults','./chatWebsite.socket','register','request','then','request\x20sent','stringify','error','message','ChatWebsite,\x20%s,\x20%s','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4ec960,_0x36d37f){var _0x1e4a72=function(_0x3e9d17){while(--_0x3e9d17){_0x4ec960['push'](_0x4ec960['shift']());}};_0x1e4a72(++_0x36d37f);}(_0x3215,0x1f2));var _0x5321=function(_0x5558d0,_0x41aa10){_0x5558d0=_0x5558d0-0x0;var _0x560fb2=_0x3215[_0x5558d0];return _0x560fb2;};'use strict';var _=require('lodash');var util=require(_0x5321('0x0'));var moment=require(_0x5321('0x1'));var BPromise=require(_0x5321('0x2'));var rs=require(_0x5321('0x3'));var fs=require('fs');var Redis=require(_0x5321('0x4'));var db=require(_0x5321('0x5'))['db'];var utils=require(_0x5321('0x6'));var logger=require('../../config/logger')(_0x5321('0x7'));var config=require(_0x5321('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5321('0x9')]({'port':0x232a});config[_0x5321('0xa')]=_[_0x5321('0xb')](config[_0x5321('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5321('0xc'))[_0x5321('0xd')](socket);function respondWithRpcPromise(_0x483b74,_0x1f8624,_0x53162a){return new BPromise(function(_0x25cf99,_0xf8a097){return client[_0x5321('0xe')](_0x483b74,_0x53162a)[_0x5321('0xf')](function(_0x2b1d21){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1f8624,_0x5321('0x10'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1f8624,'request\x20sent',JSON[_0x5321('0x11')](_0x2b1d21));if(_0x2b1d21['error']){if(_0x2b1d21[_0x5321('0x12')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1f8624,_0x2b1d21['error']['message']);return _0xf8a097(_0x2b1d21['error'][_0x5321('0x13')]);}logger[_0x5321('0x12')](_0x5321('0x14'),_0x1f8624,_0x2b1d21['error'][_0x5321('0x13')]);return _0x25cf99(_0x2b1d21['error']['message']);}else{logger[_0x5321('0x15')](_0x5321('0x14'),_0x1f8624,'request\x20sent');_0x25cf99(_0x2b1d21['result'][_0x5321('0x13')]);}})[_0x5321('0x16')](function(_0x4029ed){logger[_0x5321('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x1f8624,_0x4029ed);_0xf8a097(_0x4029ed);});});} \ No newline at end of file +var _0x324c=['message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x47c971,_0x1d9876){var _0x494edf=function(_0x106843){while(--_0x106843){_0x47c971['push'](_0x47c971['shift']());}};_0x494edf(++_0x1d9876);}(_0x324c,0xca));var _0xc324=function(_0x31d304,_0x2981d1){_0x31d304=_0x31d304-0x0;var _0x4bcadd=_0x324c[_0x31d304];return _0x4bcadd;};'use strict';var _=require(_0xc324('0x0'));var util=require(_0xc324('0x1'));var moment=require(_0xc324('0x2'));var BPromise=require('bluebird');var rs=require(_0xc324('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc324('0x4'))['db'];var utils=require(_0xc324('0x5'));var logger=require(_0xc324('0x6'))(_0xc324('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc324('0x8')][_0xc324('0x9')]({'port':0x232a});config[_0xc324('0xa')]=_[_0xc324('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc324('0xa')]));require(_0xc324('0xc'))[_0xc324('0xd')](socket);function respondWithRpcPromise(_0x197838,_0xb6a45a,_0x3a0b3a){return new BPromise(function(_0x192e72,_0x3672c3){return client['request'](_0x197838,_0x3a0b3a)[_0xc324('0xe')](function(_0x34adae){logger[_0xc324('0xf')](_0xc324('0x10'),_0xb6a45a,_0xc324('0x11'));logger[_0xc324('0x12')](_0xc324('0x13'),_0xb6a45a,_0xc324('0x11'),JSON[_0xc324('0x14')](_0x34adae));if(_0x34adae[_0xc324('0x15')]){if(_0x34adae['error'][_0xc324('0x16')]===0x1f4){logger[_0xc324('0x15')](_0xc324('0x10'),_0xb6a45a,_0x34adae['error'][_0xc324('0x17')]);return _0x3672c3(_0x34adae[_0xc324('0x15')][_0xc324('0x17')]);}logger['error'](_0xc324('0x10'),_0xb6a45a,_0x34adae[_0xc324('0x15')][_0xc324('0x17')]);return _0x192e72(_0x34adae['error'][_0xc324('0x17')]);}else{logger['info'](_0xc324('0x10'),_0xb6a45a,_0xc324('0x11'));_0x192e72(_0x34adae[_0xc324('0x18')][_0xc324('0x17')]);}})['catch'](function(_0x3634b6){logger['error'](_0xc324('0x10'),_0xb6a45a,_0x3634b6);_0x3672c3(_0x3634b6);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 7607aa5..2913889 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 _0xd397=['remove','update','emit','register','length','chatWebsite:','save'];(function(_0x19e0d9,_0x57fdf4){var _0x56e03f=function(_0x24f4e5){while(--_0x24f4e5){_0x19e0d9['push'](_0x19e0d9['shift']());}};_0x56e03f(++_0x57fdf4);}(_0xd397,0x15d));var _0x7d39=function(_0x1507fd,_0x3a4bd3){_0x1507fd=_0x1507fd-0x0;var _0x1ad571=_0xd397[_0x1507fd];return _0x1ad571;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x7d39('0x0'),_0x7d39('0x1'),_0x7d39('0x2')];function createListener(_0x5a0129,_0x511e1e){return function(_0x5ec0f2){_0x511e1e[_0x7d39('0x3')](_0x5a0129,_0x5ec0f2);};}function removeListener(_0x179344,_0xbb0004){return function(){ChatWebsiteEvents['removeListener'](_0x179344,_0xbb0004);};}exports[_0x7d39('0x4')]=function(_0x4ef18e){for(var _0x2c32c5=0x0,_0x1188b8=events[_0x7d39('0x5')];_0x2c32c5<_0x1188b8;_0x2c32c5++){var _0x56149e=events[_0x2c32c5];var _0x2afcbf=createListener(_0x7d39('0x6')+_0x56149e,_0x4ef18e);ChatWebsiteEvents['on'](_0x56149e,_0x2afcbf);}}; \ No newline at end of file +var _0x8496=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0xfcf0a5,_0x220889){var _0x42edb2=function(_0x1331da){while(--_0x1331da){_0xfcf0a5['push'](_0xfcf0a5['shift']());}};_0x42edb2(++_0x220889);}(_0x8496,0xb9));var _0x6849=function(_0x24fd48,_0x450500){_0x24fd48=_0x24fd48-0x0;var _0x4bd480=_0x8496[_0x24fd48];return _0x4bd480;};'use strict';var ChatWebsiteEvents=require(_0x6849('0x0'));var events=[_0x6849('0x1'),_0x6849('0x2'),_0x6849('0x3')];function createListener(_0x3c7a70,_0x100eda){return function(_0x58dbf0){_0x100eda[_0x6849('0x4')](_0x3c7a70,_0x58dbf0);};}function removeListener(_0x3ed58e,_0x147aa2){return function(){ChatWebsiteEvents[_0x6849('0x5')](_0x3ed58e,_0x147aa2);};}exports[_0x6849('0x6')]=function(_0xcfd57f){for(var _0x5b23f8=0x0,_0x2babec=events[_0x6849('0x7')];_0x5b23f8<_0x2babec;_0x5b23f8++){var _0x26fb3e=events[_0x5b23f8];var _0x49db49=createListener(_0x6849('0x8')+_0x26fb3e,_0xcfd57f);ChatWebsiteEvents['on'](_0x26fb3e,_0x49db49);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e809ec2..e45beeb 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 _0xfb73=['extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','put','/:id','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','create','addDisposition','post','/:id/canned_answers','join','root','server/files/images/logos/','%s-%s','now','single','diskStorage','server/files/images/avatars/','format','originalname','addAvatar','file','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace'];(function(_0x41a4af,_0x1dc28e){var _0x394ac0=function(_0x22f56e){while(--_0x22f56e){_0x41a4af['push'](_0x41a4af['shift']());}};_0x394ac0(++_0x1dc28e);}(_0xfb73,0x181));var _0x3fb7=function(_0xa2cf3d,_0x5645e6){_0xa2cf3d=_0xa2cf3d-0x0;var _0x57d36a=_0xfb73[_0xa2cf3d];return _0x57d36a;};'use strict';var multer=require(_0x3fb7('0x0'));var util=require(_0x3fb7('0x1'));var path=require(_0x3fb7('0x2'));var timeout=require(_0x3fb7('0x3'));var express=require(_0x3fb7('0x4'));var router=express[_0x3fb7('0x5')]();var fs_extra=require(_0x3fb7('0x6'));var auth=require(_0x3fb7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3fb7('0x8'));var controller=require('./chatWebsite.controller');router[_0x3fb7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fb7('0xa')]);router[_0x3fb7('0x9')](_0x3fb7('0xb'),auth['isAuthenticated'](),controller[_0x3fb7('0xc')]);router[_0x3fb7('0x9')]('/:id',auth[_0x3fb7('0xd')](),controller[_0x3fb7('0xe')]);router[_0x3fb7('0x9')](_0x3fb7('0xf'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x10')]);router[_0x3fb7('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3fb7('0x11')]);router['get'](_0x3fb7('0x12'),controller[_0x3fb7('0x13')]);router[_0x3fb7('0x9')](_0x3fb7('0x14'),controller[_0x3fb7('0x15')]);router[_0x3fb7('0x9')](_0x3fb7('0x16'),controller[_0x3fb7('0x17')]);router[_0x3fb7('0x9')](_0x3fb7('0x18'),controller[_0x3fb7('0x19')]);router['get'](_0x3fb7('0x1a'),auth[_0x3fb7('0xd')](),controller['getInteractions']);router[_0x3fb7('0x9')](_0x3fb7('0x1b'),controller[_0x3fb7('0x1c')]);router['get']('/:id/applications',auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x1d')]);router[_0x3fb7('0x9')](_0x3fb7('0x1e'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x1f')]);router[_0x3fb7('0x9')](_0x3fb7('0x20'),controller['getFields']);router[_0x3fb7('0x9')](_0x3fb7('0x21'),auth[_0x3fb7('0xd')](),controller['getOfflineMessages']);router[_0x3fb7('0x9')](_0x3fb7('0x22'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x23')]);router['post']('/',auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x24')]);router['post'](_0x3fb7('0xf'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x25')]);router[_0x3fb7('0x26')](_0x3fb7('0x27'),auth[_0x3fb7('0xd')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x150f20,_0x23c2ec,_0x7d6973){_0x7d6973(null,path[_0x3fb7('0x28')](config[_0x3fb7('0x29')],_0x3fb7('0x2a')));},'filename':function(_0x8eae27,_0x3990ec,_0x1c27ed){_0x1c27ed(null,util['format'](_0x3fb7('0x2b'),Date[_0x3fb7('0x2c')](),_0x3990ec['originalname']));}})});router['post']('/:id/logo',upload[_0x3fb7('0x2d')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x3fb7('0x2e')]({'destination':function(_0x595162,_0x50d371,_0x4ec7ba){_0x4ec7ba(null,path[_0x3fb7('0x28')](config['root'],_0x3fb7('0x2f')));},'filename':function(_0x14ec41,_0x466539,_0xe35695){_0xe35695(null,util[_0x3fb7('0x30')](_0x3fb7('0x2b'),Date[_0x3fb7('0x2c')](),_0x466539[_0x3fb7('0x31')]));}})});router[_0x3fb7('0x26')](_0x3fb7('0x14'),upload[_0x3fb7('0x2d')]('file'),controller[_0x3fb7('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42f27b,_0x4b911b,_0x75cfae){_0x75cfae(null,path[_0x3fb7('0x28')](config[_0x3fb7('0x29')],'server/files/images/avatars/'));},'filename':function(_0x554c39,_0x2696d0,_0x5778aa){_0x5778aa(null,util[_0x3fb7('0x30')](_0x3fb7('0x2b'),Date[_0x3fb7('0x2c')](),_0x2696d0[_0x3fb7('0x31')]));}})});router[_0x3fb7('0x26')](_0x3fb7('0x16'),upload[_0x3fb7('0x2d')](_0x3fb7('0x33')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3fb7('0x2e')]({'destination':function(_0x175781,_0x223d53,_0x123e40){_0x123e40(null,path[_0x3fb7('0x28')](config[_0x3fb7('0x29')],'server/files/images/avatars/'));},'filename':function(_0x1235ae,_0x53aeea,_0x303861){_0x303861(null,util[_0x3fb7('0x30')]('%s-%s',Date['now'](),_0x53aeea[_0x3fb7('0x31')]));}})});router[_0x3fb7('0x26')](_0x3fb7('0x18'),upload[_0x3fb7('0x2d')]('file'),controller[_0x3fb7('0x34')]);router['post'](_0x3fb7('0x35'),controller[_0x3fb7('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x3fb7('0x2e')]({'destination':function(_0x380d03,_0x57cc56,_0x5d9654){const _0x174a53=path['join'](config[_0x3fb7('0x29')],_0x3fb7('0x37'),'attachments',_0x3fb7('0x38'));fs_extra[_0x3fb7('0x39')](_0x174a53,function(){_0x5d9654(null,_0x174a53);});},'filename':function(_0x3fc72f,_0x350896,_0x3ce437){const _0x290134=_0x350896[_0x3fb7('0x31')][_0x3fb7('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x457b0c=path[_0x3fb7('0x3b')](_0x290134);const _0x569a8d=Date['now']()+'-'+_0x290134[_0x3fb7('0x3a')](_0x457b0c,'')+_0x457b0c;_0x3ce437(null,_0x569a8d);}})});router[_0x3fb7('0x26')](_0x3fb7('0x3c'),offlineUploadMulter[_0x3fb7('0x3d')](),controller[_0x3fb7('0x3e')]);router['post'](_0x3fb7('0x1a'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x3f')]);router[_0x3fb7('0x26')](_0x3fb7('0x40'),auth['isAuthenticated'](),controller[_0x3fb7('0x41')]);router[_0x3fb7('0x26')](_0x3fb7('0x1e'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x42')]);router[_0x3fb7('0x26')]('/:id/users',auth[_0x3fb7('0xd')](),controller['addAgents']);router[_0x3fb7('0x43')](_0x3fb7('0x44'),auth['isAuthenticated'](),controller['update']);router[_0x3fb7('0x45')](_0x3fb7('0x44'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x46')]);router[_0x3fb7('0x45')](_0x3fb7('0xf'),auth[_0x3fb7('0xd')](),controller[_0x3fb7('0x47')]);router[_0x3fb7('0x45')](_0x3fb7('0x27'),auth['isAuthenticated'](),controller[_0x3fb7('0x48')]);router[_0x3fb7('0x45')](_0x3fb7('0x22'),auth[_0x3fb7('0xd')](),controller['removeAgents']);module[_0x3fb7('0x49')]=router; \ No newline at end of file +var _0xcf3b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','format','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','extname','/:id/offline','any','offline','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','/:id/users','addAgents','put','update','delete','removeDispositions','/:id/canned_answers','exports','multer','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf3b,0x1df));var _0xbcf3=function(_0x29b9b9,_0x11b3d1){_0x29b9b9=_0x29b9b9-0x0;var _0x2f8cc8=_0xcf3b[_0x29b9b9];return _0x2f8cc8;};'use strict';var multer=require(_0xbcf3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbcf3('0x1'));var express=require(_0xbcf3('0x2'));var router=express[_0xbcf3('0x3')]();var fs_extra=require(_0xbcf3('0x4'));var auth=require(_0xbcf3('0x5'));var interaction=require(_0xbcf3('0x6'));var config=require(_0xbcf3('0x7'));var controller=require('./chatWebsite.controller');router[_0xbcf3('0x8')]('/',auth[_0xbcf3('0x9')](),controller[_0xbcf3('0xa')]);router[_0xbcf3('0x8')](_0xbcf3('0xb'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0xc')]);router[_0xbcf3('0x8')](_0xbcf3('0xd'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0xe')]);router[_0xbcf3('0x8')](_0xbcf3('0xf'),auth[_0xbcf3('0x9')](),controller['getDispositions']);router[_0xbcf3('0x8')]('/:id/canned_answers',auth[_0xbcf3('0x9')](),controller['getAnswers']);router[_0xbcf3('0x8')](_0xbcf3('0x10'),controller['getLogo']);router[_0xbcf3('0x8')](_0xbcf3('0x11'),controller[_0xbcf3('0x12')]);router[_0xbcf3('0x8')]('/:id/customer_avatar',controller[_0xbcf3('0x13')]);router[_0xbcf3('0x8')](_0xbcf3('0x14'),controller[_0xbcf3('0x15')]);router['get'](_0xbcf3('0x16'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x17')]);router['get'](_0xbcf3('0x18'),controller['getSnippet']);router['get']('/:id/applications',auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x19')]);router[_0xbcf3('0x8')]('/:id/proactive_actions',auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x1a')]);router[_0xbcf3('0x8')](_0xbcf3('0x1b'),controller[_0xbcf3('0x1c')]);router[_0xbcf3('0x8')]('/:id/offline_messages',auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x1d')]);router[_0xbcf3('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xbcf3('0x1e')]);router[_0xbcf3('0x1f')]('/',auth[_0xbcf3('0x9')](),controller['create']);router['post'](_0xbcf3('0xf'),auth['isAuthenticated'](),controller[_0xbcf3('0x20')]);router[_0xbcf3('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xbcf3('0x21')]);var upload=multer({'storage':multer[_0xbcf3('0x22')]({'destination':function(_0x40f65d,_0x443b1b,_0x4f4f1c){_0x4f4f1c(null,path[_0xbcf3('0x23')](config[_0xbcf3('0x24')],_0xbcf3('0x25')));},'filename':function(_0x2acfce,_0x8f732b,_0x5be8a6){_0x5be8a6(null,util['format'](_0xbcf3('0x26'),Date[_0xbcf3('0x27')](),_0x8f732b[_0xbcf3('0x28')]));}})});router[_0xbcf3('0x1f')](_0xbcf3('0x10'),upload[_0xbcf3('0x29')](_0xbcf3('0x2a')),controller[_0xbcf3('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5738c8,_0x5e553c,_0x294e1d){_0x294e1d(null,path[_0xbcf3('0x23')](config[_0xbcf3('0x24')],'server/files/images/avatars/'));},'filename':function(_0xd9ccf,_0x419dc3,_0xab9f1d){_0xab9f1d(null,util[_0xbcf3('0x2c')](_0xbcf3('0x26'),Date[_0xbcf3('0x27')](),_0x419dc3[_0xbcf3('0x28')]));}})});router['post'](_0xbcf3('0x11'),upload[_0xbcf3('0x29')](_0xbcf3('0x2a')),controller[_0xbcf3('0x2d')]);var upload=multer({'storage':multer[_0xbcf3('0x22')]({'destination':function(_0x40f77e,_0x31f22a,_0x39a3ea){_0x39a3ea(null,path['join'](config[_0xbcf3('0x24')],_0xbcf3('0x2e')));},'filename':function(_0x13279a,_0x1bdc5e,_0x33d182){_0x33d182(null,util[_0xbcf3('0x2c')](_0xbcf3('0x26'),Date['now'](),_0x1bdc5e[_0xbcf3('0x28')]));}})});router['post']('/:id/customer_avatar',upload['single'](_0xbcf3('0x2a')),controller[_0xbcf3('0x2f')]);var upload=multer({'storage':multer[_0xbcf3('0x22')]({'destination':function(_0x2242c0,_0x641e7f,_0x37bdcb){_0x37bdcb(null,path[_0xbcf3('0x23')](config[_0xbcf3('0x24')],_0xbcf3('0x2e')));},'filename':function(_0x4c78dd,_0x1edfe1,_0x698126){_0x698126(null,util[_0xbcf3('0x2c')]('%s-%s',Date[_0xbcf3('0x27')](),_0x1edfe1['originalname']));}})});router[_0xbcf3('0x1f')](_0xbcf3('0x14'),upload[_0xbcf3('0x29')]('file'),controller['addSystemAvatar']);router[_0xbcf3('0x1f')](_0xbcf3('0x30'),controller[_0xbcf3('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xbcf3('0x22')]({'destination':function(_0x37d55e,_0x149396,_0x155785){const _0x11c043=path[_0xbcf3('0x23')](config[_0xbcf3('0x24')],_0xbcf3('0x32'),'attachments',_0xbcf3('0x33'));fs_extra[_0xbcf3('0x34')](_0x11c043,function(){_0x155785(null,_0x11c043);});},'filename':function(_0x86d514,_0x191a66,_0x8f7f6){const _0x587562=_0x191a66['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x438539=path[_0xbcf3('0x35')](_0x587562);const _0x31e983=Date['now']()+'-'+_0x587562['replace'](_0x438539,'')+_0x438539;_0x8f7f6(null,_0x31e983);}})});router[_0xbcf3('0x1f')](_0xbcf3('0x36'),offlineUploadMulter[_0xbcf3('0x37')](),controller[_0xbcf3('0x38')]);router[_0xbcf3('0x1f')](_0xbcf3('0x16'),auth[_0xbcf3('0x9')](),controller['addInteraction']);router[_0xbcf3('0x1f')](_0xbcf3('0x39'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x3a')]);router['post'](_0xbcf3('0x3b'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x3c')]);router[_0xbcf3('0x1f')](_0xbcf3('0x3d'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x3e')]);router[_0xbcf3('0x3f')](_0xbcf3('0xd'),auth[_0xbcf3('0x9')](),controller[_0xbcf3('0x40')]);router[_0xbcf3('0x41')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xbcf3('0x41')](_0xbcf3('0xf'),auth['isAuthenticated'](),controller[_0xbcf3('0x42')]);router[_0xbcf3('0x41')](_0xbcf3('0x43'),auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xbcf3('0x3d'),auth[_0xbcf3('0x9')](),controller['removeAgents']);module[_0xbcf3('0x44')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index f34a807..695b320 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 _0x8fde=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','app','get'];(function(_0x2cb642,_0x248ad5){var _0x346dad=function(_0x1905fb){while(--_0x1905fb){_0x2cb642['push'](_0x2cb642['shift']());}};_0x346dad(++_0x248ad5);}(_0x8fde,0x9d));var _0xe8fd=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8fde[_0x53ccf2];return _0x5a2964;};var beaverLogger=require(_0xe8fd('0x0'));var express=require(_0xe8fd('0x1'));var auth=require(_0xe8fd('0x2'));var config=require(_0xe8fd('0x3'));var router=express[_0xe8fd('0x4')]();var isProduction=config[_0xe8fd('0x5')]==='production'||![];function clientSideLogs(_0x5dae33,_0x420219,_0x53b156){var _0x30e63a=_0x5dae33[_0xe8fd('0x6')][_0xe8fd('0x7')](_0xe8fd('0x8'));if(!_0x30e63a){throw new Error(_0xe8fd('0x9'));}return beaverLogger[_0xe8fd('0xa')]({'uri':_0xe8fd('0xb'),'logger':_0x30e63a,'enableCors':!isProduction})(_0x5dae33,_0x420219,_0x53b156);}router[_0xe8fd('0xc')](auth[_0xe8fd('0xd')](),clientSideLogs);module[_0xe8fd('0xe')]=router; \ No newline at end of file +var _0x404a=['/client-logs','isAuthenticated','../components/auth/service','../config/environment','Router','env','production','app','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1e369d,_0x528360){var _0x3bc381=function(_0x410a3b){while(--_0x410a3b){_0x1e369d['push'](_0x1e369d['shift']());}};_0x3bc381(++_0x528360);}(_0x404a,0x84));var _0xa404=function(_0x3437cf,_0x1cc733){_0x3437cf=_0x3437cf-0x0;var _0x2a7227=_0x404a[_0x3437cf];return _0x2a7227;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xa404('0x0'));var config=require(_0xa404('0x1'));var router=express[_0xa404('0x2')]();var isProduction=config[_0xa404('0x3')]===_0xa404('0x4')||![];function clientSideLogs(_0x282dcb,_0xc3aedd,_0x53d333){var _0x1f3671=_0x282dcb[_0xa404('0x5')]['get']('client-side-logger');if(!_0x1f3671){throw new Error(_0xa404('0x6'));}return beaverLogger[_0xa404('0x7')]({'uri':_0xa404('0x8'),'logger':_0x1f3671,'enableCors':!isProduction})(_0x282dcb,_0xc3aedd,_0x53d333);}router['use'](auth[_0xa404('0x9')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d0c8124..d6d3971 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 _0x6ebc=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6ebc,0x1ba));var _0xc6eb=function(_0x262f0d,_0x51e151){_0x262f0d=_0x262f0d-0x0;var _0x21dc30=_0x6ebc[_0x262f0d];return _0x21dc30;};'use strict';var Sequelize=require(_0xc6eb('0x0'));module['exports']={'name':{'type':Sequelize[_0xc6eb('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc6eb('0x2')](_0xc6eb('0x3'),_0xc6eb('0x4'),_0xc6eb('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc6eb('0x2')](_0xc6eb('0x6'),_0xc6eb('0x7'))},'data1':{'type':Sequelize[_0xc6eb('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xc6eb('0x1')],'comment':_0xc6eb('0x8')},'data3':{'type':Sequelize[_0xc6eb('0x1')],'comment':_0xc6eb('0x9')},'data4':{'type':Sequelize[_0xc6eb('0x1')],'comment':_0xc6eb('0xa')},'data5':{'type':Sequelize[_0xc6eb('0xb')],'comment':_0xc6eb('0xc')},'data6':{'type':Sequelize[_0xc6eb('0xb')],'comment':_0xc6eb('0xd')},'data7':{'type':Sequelize[_0xc6eb('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x9120=['sequelize','STRING','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0x9120,0x140));var _0x0912=function(_0x287684,_0x422d38){_0x287684=_0x287684-0x0;var _0x4c7bbb=_0x9120[_0x287684];return _0x4c7bbb;};'use strict';var Sequelize=require(_0x0912('0x0'));module['exports']={'name':{'type':Sequelize[_0x0912('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x0912('0x2'),'Google',_0x0912('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x0912('0x4'),'Dynamics365')},'data1':{'type':Sequelize[_0x0912('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x0912('0x1')],'comment':_0x0912('0x5')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x0912('0x1')],'comment':_0x0912('0x6')},'data5':{'type':Sequelize['TEXT'],'comment':_0x0912('0x7')},'data6':{'type':Sequelize[_0x0912('0x8')],'comment':_0x0912('0x9')},'data7':{'type':Sequelize[_0x0912('0x8')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 73524e2..a5f52cc 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 _0x4d4e=['name','send','padEnd','slice','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','length','body','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','catch','find','oauth2MicrosoftAuthorize','findOne','user','oauth2MicrosoftCallback','error','get','Invalid\x20state\x20parameter','parse','state','ascii','id_token','oauth2Claims','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack'];(function(_0x3cef4a,_0x5a1e4c){var _0x24121c=function(_0x24842c){while(--_0x24842c){_0x3cef4a['push'](_0x3cef4a['shift']());}};_0x24121c(++_0x5a1e4c);}(_0x4d4e,0x1b9));var _0xe4d4=function(_0x5daeb2,_0x4b007c){_0x5daeb2=_0x5daeb2-0x0;var _0x2dbb9f=_0x4d4e[_0x5daeb2];return _0x2dbb9f;};'use strict';var _=require(_0xe4d4('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xe4d4('0x1'));var config=require(_0xe4d4('0x2'));var logger=require('../../config/logger')(_0xe4d4('0x3'));var db=require(_0xe4d4('0x4'))['db'];var oauth=require(_0xe4d4('0x5'));config[_0xe4d4('0x6')]=_[_0xe4d4('0x7')](config['redis'],{'host':_0xe4d4('0x8'),'port':0x18eb});var socket=require(_0xe4d4('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0xe4d4('0x6')]);function respondWithStatusCode(_0x5b139b,_0xfd171){_0xfd171=_0xfd171||0xcc;return function(_0x250963){if(_0x250963){return _0x5b139b[_0xe4d4('0xa')](_0xfd171);}return _0x5b139b['status'](_0xfd171)[_0xe4d4('0xb')]();};}function respondWithResult(_0x3e31f3,_0x4dbf06){_0x4dbf06=_0x4dbf06||0xc8;return function(_0x2d80f2){if(_0x2d80f2){return _0x3e31f3[_0xe4d4('0xc')](_0x4dbf06)[_0xe4d4('0xd')](_0x2d80f2);}};}function respondWithFilteredResult(_0x15c874,_0x3908ed){return function(_0x44dbce){if(_0x44dbce){var _0x4c2cf2=typeof _0x3908ed[_0xe4d4('0xe')]===_0xe4d4('0xf')&&typeof _0x3908ed['limit']===_0xe4d4('0xf');var _0x1bb08a=_0x44dbce[_0xe4d4('0x10')];var _0x353208=_0x4c2cf2?0x0:_0x3908ed[_0xe4d4('0xe')];var _0xab9f3d=_0x4c2cf2?_0x44dbce[_0xe4d4('0x10')]:_0x3908ed[_0xe4d4('0xe')]+_0x3908ed[_0xe4d4('0x11')];var _0x38b5bc;if(_0xab9f3d>=_0x1bb08a){_0xab9f3d=_0x1bb08a;_0x38b5bc=0xc8;}else{_0x38b5bc=0xce;}_0x15c874[_0xe4d4('0xc')](_0x38b5bc);return _0x15c874[_0xe4d4('0x12')](_0xe4d4('0x13'),_0x353208+'-'+_0xab9f3d+'/'+_0x1bb08a)[_0xe4d4('0xd')](_0x44dbce);}return null;};}function saveUpdates(_0xa70592){return function(_0xfb6f83){if(_0xfb6f83){return _0xfb6f83[_0xe4d4('0x14')](_0xa70592)[_0xe4d4('0x15')](function(_0x5bdf9a){return _0x5bdf9a;});}return null;};}function removeEntity(_0x3a3c62){return function(_0x45f25f){if(_0x45f25f){return _0x45f25f[_0xe4d4('0x16')]()[_0xe4d4('0x15')](function(){_0x3a3c62['status'](0xcc)[_0xe4d4('0xb')]();});}};}function handleEntityNotFound(_0x54ec70){return function(_0x350d67){if(!_0x350d67){_0x54ec70[_0xe4d4('0xa')](0x194);}return _0x350d67;};}function handleError(_0x2ac1de,_0xbe620){_0xbe620=_0xbe620||0x1f4;return function(_0x234873){logger['error'](_0x234873[_0xe4d4('0x17')]);if(_0x234873[_0xe4d4('0x18')]){delete _0x234873['name'];}_0x2ac1de[_0xe4d4('0xc')](_0xbe620)[_0xe4d4('0x19')](_0x234873);};}function maskClientSecret(_0x349805){return _[_0xe4d4('0x1a')](_0x349805[_0xe4d4('0x1b')](0x0,0x3),0x14,'*');}exports[_0xe4d4('0x1c')]=function(_0x5547ca,_0x5baffe){var _0x2028c6={},_0x256e31={},_0x4ec5f1={'count':0x0,'rows':[]};var _0x308466=_[_0xe4d4('0x1d')](db['CloudProvider'][_0xe4d4('0x1e')],function(_0x469b41){return{'name':_0x469b41[_0xe4d4('0x1f')],'type':_0x469b41['type'][_0xe4d4('0x20')]};});_0x256e31[_0xe4d4('0x21')]=_['map'](_0x308466,_0xe4d4('0x18'));_0x256e31[_0xe4d4('0x22')]=_[_0xe4d4('0x23')](_0x5547ca['query']);_0x256e31['filters']=_['intersection'](_0x256e31[_0xe4d4('0x21')],_0x256e31[_0xe4d4('0x22')]);_0x2028c6['attributes']=_[_0xe4d4('0x24')](_0x256e31[_0xe4d4('0x21')],qs['fields'](_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0x25')]));_0x2028c6['attributes']=_0x2028c6['attributes']['length']?_0x2028c6[_0xe4d4('0x26')]:_0x256e31['model'];if(!_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0x27')]('nolimit')){_0x2028c6[_0xe4d4('0x11')]=qs[_0xe4d4('0x11')](_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0x11')]);_0x2028c6[_0xe4d4('0xe')]=qs['offset'](_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0xe')]);}_0x2028c6[_0xe4d4('0x28')]=qs[_0xe4d4('0x29')](_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0x29')]);_0x2028c6[_0xe4d4('0x2a')]=qs[_0xe4d4('0x2b')](_[_0xe4d4('0x2c')](_0x5547ca[_0xe4d4('0x22')],_0x256e31[_0xe4d4('0x2b')]),_0x308466);if(_0x5547ca['query'][_0xe4d4('0x2d')]){_0x2028c6[_0xe4d4('0x2a')]=_[_0xe4d4('0x2e')](_0x2028c6[_0xe4d4('0x2a')],{'$or':_[_0xe4d4('0x1d')](_0x308466,function(_0x259522){if(_0x259522[_0xe4d4('0x2f')]!==_0xe4d4('0x30')){var _0x3e4ba7={};_0x3e4ba7[_0x259522['name']]={'$like':'%'+_0x5547ca[_0xe4d4('0x22')][_0xe4d4('0x2d')]+'%'};return _0x3e4ba7;}})});}_0x2028c6=_[_0xe4d4('0x2e')]({},_0x2028c6,_0x5547ca[_0xe4d4('0x31')]);var _0x419649={'where':_0x2028c6['where']};return db[_0xe4d4('0x32')][_0xe4d4('0x10')](_0x419649)[_0xe4d4('0x15')](function(_0x30729a){_0x4ec5f1[_0xe4d4('0x10')]=_0x30729a;if(_0x5547ca['query'][_0xe4d4('0x33')]){_0x2028c6[_0xe4d4('0x34')]=[{'all':!![]}];}return db[_0xe4d4('0x32')][_0xe4d4('0x35')](_0x2028c6);})[_0xe4d4('0x15')](function(_0x40e063){_0x4ec5f1[_0xe4d4('0x36')]=_[_0xe4d4('0x1d')](_0x40e063,function(_0x2ab3cb){if(_0x2ab3cb[_0xe4d4('0x37')]===_0xe4d4('0x38')){var _0x534c79=encryptor[_0xe4d4('0x39')](_0x2ab3cb['data3']);_0x2ab3cb[_0xe4d4('0x3a')]=maskClientSecret(_0x534c79);}return _0x2ab3cb;});return _0x4ec5f1;})[_0xe4d4('0x15')](respondWithFilteredResult(_0x5baffe,_0x2028c6))['catch'](handleError(_0x5baffe,null));};exports[_0xe4d4('0x3b')]=function(_0x19be81,_0x53c3c1){var _0x318506={'raw':!![],'where':{'id':_0x19be81[_0xe4d4('0x3c')]['id']}},_0x57d183={};_0x57d183[_0xe4d4('0x21')]=_['keys'](db[_0xe4d4('0x32')][_0xe4d4('0x1e')]);_0x57d183[_0xe4d4('0x22')]=_[_0xe4d4('0x23')](_0x19be81[_0xe4d4('0x22')]);_0x57d183[_0xe4d4('0x2b')]=_[_0xe4d4('0x24')](_0x57d183['model'],_0x57d183[_0xe4d4('0x22')]);_0x318506[_0xe4d4('0x26')]=_[_0xe4d4('0x24')](_0x57d183[_0xe4d4('0x21')],qs[_0xe4d4('0x25')](_0x19be81['query']['fields']));_0x318506['attributes']=_0x318506['attributes'][_0xe4d4('0x3d')]?_0x318506[_0xe4d4('0x26')]:_0x57d183[_0xe4d4('0x21')];if(_0x19be81[_0xe4d4('0x22')][_0xe4d4('0x33')]){_0x318506[_0xe4d4('0x34')]=[{'all':!![]}];}_0x318506=_['merge']({},_0x318506,_0x19be81['options']);return db[_0xe4d4('0x32')]['find'](_0x318506)[_0xe4d4('0x15')](handleEntityNotFound(_0x53c3c1,null))[_0xe4d4('0x15')](function(_0x1444f0){if(_0x1444f0[_0xe4d4('0x37')]==='MicrosoftAzure'){var _0x1ebce6=encryptor['decryptString'](_0x1444f0[_0xe4d4('0x3a')]);_0x1444f0['data3']=maskClientSecret(_0x1ebce6);}return _0x1444f0;})['then'](respondWithResult(_0x53c3c1,null))['catch'](handleError(_0x53c3c1,null));};exports['create']=function(_0xe7295d,_0x204dba){if(!_0xe7295d[_0xe4d4('0x3e')]['name'])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0xe7295d[_0xe4d4('0x3e')][_0xe4d4('0x37')])throw new Error(_0xe4d4('0x3f'));var _0x1f4085=db['CloudProvider'][_0xe4d4('0x1e')][_0xe4d4('0x37')][_0xe4d4('0x40')];if(!_0x1f4085[_0xe4d4('0x41')](_0xe7295d[_0xe4d4('0x3e')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x1f4085[_0xe4d4('0x42')](',\x20'));if(_0xe7295d[_0xe4d4('0x3e')][_0xe4d4('0x37')]==='MicrosoftAzure'&&_0xe7295d[_0xe4d4('0x3e')][_0xe4d4('0x3a')]){_0xe7295d['body'][_0xe4d4('0x3a')]=encryptor[_0xe4d4('0x43')](_0xe7295d[_0xe4d4('0x3e')]['data3']);}return db[_0xe4d4('0x32')]['create'](_0xe7295d[_0xe4d4('0x3e')],{})[_0xe4d4('0x15')](respondWithResult(_0x204dba,0xc9))[_0xe4d4('0x44')](handleError(_0x204dba,null));};exports[_0xe4d4('0x14')]=function(_0x2ae786,_0x7df3e4){if(_0x2ae786[_0xe4d4('0x3e')]['id']){delete _0x2ae786[_0xe4d4('0x3e')]['id'];}return db[_0xe4d4('0x32')][_0xe4d4('0x45')]({'where':{'id':_0x2ae786[_0xe4d4('0x3c')]['id']}})[_0xe4d4('0x15')](handleEntityNotFound(_0x7df3e4,null))[_0xe4d4('0x15')](function(_0x285690){if(_0x285690[_0xe4d4('0x37')]===_0xe4d4('0x38')&&_0x2ae786[_0xe4d4('0x3e')][_0xe4d4('0x3a')]){_0x2ae786[_0xe4d4('0x3e')]['data3']=encryptor[_0xe4d4('0x43')](_0x2ae786[_0xe4d4('0x3e')][_0xe4d4('0x3a')]);}return _0x285690;})[_0xe4d4('0x15')](saveUpdates(_0x2ae786[_0xe4d4('0x3e')],null))['then'](respondWithResult(_0x7df3e4,null))[_0xe4d4('0x44')](handleError(_0x7df3e4,null));};exports[_0xe4d4('0x16')]=function(_0x488c81,_0x5baa3d){return db[_0xe4d4('0x32')][_0xe4d4('0x45')]({'where':{'id':_0x488c81[_0xe4d4('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5baa3d,null))[_0xe4d4('0x15')](removeEntity(_0x5baa3d,null))[_0xe4d4('0x44')](handleError(_0x5baa3d,null));};exports[_0xe4d4('0x46')]=function(_0x305dd4,_0x4cca46){return db[_0xe4d4('0x32')][_0xe4d4('0x47')]({'where':{'id':_0x305dd4[_0xe4d4('0x3c')]['id']},'raw':!![]})[_0xe4d4('0x15')](function(_0x390f49){if(!_0x390f49)return _0x4cca46['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x390f49,_0x305dd4[_0xe4d4('0x48')]['id'])};})['then'](respondWithResult(_0x4cca46,null))['catch'](handleError(_0x4cca46,null));};exports[_0xe4d4('0x49')]=function(_0x256d94,_0x2590b9){var _0x5ac188=_0x256d94[_0xe4d4('0x3e')];var _0x1e9bec;var _0x197415;if(_0x5ac188[_0xe4d4('0x4a')])throw _0x5ac188;redis[_0xe4d4('0x4b')](_0x5ac188['state'])['then'](function(_0x3f677b){if(!_0x3f677b)throw new Error(_0xe4d4('0x4c'));_0x1e9bec=JSON[_0xe4d4('0x4d')](_0x3f677b);var _0x1cf2e4=Buffer['from'](_0x5ac188[_0xe4d4('0x4e')],'base64')['toString'](_0xe4d4('0x4f'));_0x197415=JSON[_0xe4d4('0x4d')](_0x1cf2e4);if(!oauth['isValidIdToken'](_0x5ac188[_0xe4d4('0x50')],_0x1e9bec[_0xe4d4('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xe4d4('0x52')](_0x5ac188[_0xe4d4('0x4e')]);return oauth[_0xe4d4('0x53')](_0x5ac188['code'],_0x1e9bec);})[_0xe4d4('0x15')](function(_0xfb5a7b){_0x1e9bec[_0xe4d4('0x54')]=_0xfb5a7b['access_token'];_0x1e9bec[_0xe4d4('0x55')]=_0xfb5a7b[_0xe4d4('0x56')];return db[_0xe4d4('0x32')][_0xe4d4('0x14')]({'data5':_0x1e9bec[_0xe4d4('0x54')],'data6':_0x1e9bec[_0xe4d4('0x55')]},{'where':{'id':_0x1e9bec['id']}});})[_0xe4d4('0x15')](function(){oauth[_0xe4d4('0x57')](_0x1e9bec);socket['emit'](_0xe4d4('0x58'),{'id':_0x197415['id']});return;})[_0xe4d4('0x15')](respondWithStatusCode(_0x2590b9,null))[_0xe4d4('0x44')](function(_0x571ed6){if(_0x197415){socket[_0xe4d4('0x59')]('microsoftAuthorization:error',{'id':_0x197415['id']});}if(!_0x1e9bec){logger[_0xe4d4('0x4a')]('Invalid\x20authentication\x20state\x20parameter',_0x571ed6);return _0x2590b9['status'](0x1f4)[_0xe4d4('0x19')](_0x571ed6[_0xe4d4('0x5a')]);}logger[_0xe4d4('0x4a')](_0xe4d4('0x5b'),_0x1e9bec['id'],JSON[_0xe4d4('0x5c')](_0x571ed6));});}; \ No newline at end of file +var _0x98d4=['hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','decryptString','data3','catch','show','params','rawAttributes','includeAll','find','service','MicrosoftAzure','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','sendStatus','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','localhost','socket.io-emitter','redis','status','end','json','offset','limit','undefined','count','set','update','then','destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x4a1c2d,_0x29b105){var _0x72c75e=function(_0x2f982f){while(--_0x2f982f){_0x4a1c2d['push'](_0x4a1c2d['shift']());}};_0x72c75e(++_0x29b105);}(_0x98d4,0x1c7));var _0x498d=function(_0x61a588,_0x50b482){_0x61a588=_0x61a588-0x0;var _0x3b4b47=_0x98d4[_0x61a588];return _0x3b4b47;};'use strict';var _=require(_0x498d('0x0'));var Redis=require(_0x498d('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0x498d('0x2'))(_0x498d('0x3'));var db=require(_0x498d('0x4'))['db'];var oauth=require(_0x498d('0x5'));config['redis']=_[_0x498d('0x6')](config['redis'],{'host':_0x498d('0x7'),'port':0x18eb});var socket=require(_0x498d('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x498d('0x9')]);function respondWithStatusCode(_0x1ae8c6,_0x35e02b){_0x35e02b=_0x35e02b||0xcc;return function(_0x5e573d){if(_0x5e573d){return _0x1ae8c6['sendStatus'](_0x35e02b);}return _0x1ae8c6[_0x498d('0xa')](_0x35e02b)[_0x498d('0xb')]();};}function respondWithResult(_0x4711f4,_0x3368ff){_0x3368ff=_0x3368ff||0xc8;return function(_0x1c8623){if(_0x1c8623){return _0x4711f4[_0x498d('0xa')](_0x3368ff)[_0x498d('0xc')](_0x1c8623);}};}function respondWithFilteredResult(_0x83bd98,_0xc690b8){return function(_0x388a40){if(_0x388a40){var _0x2181ab=typeof _0xc690b8[_0x498d('0xd')]==='undefined'&&typeof _0xc690b8[_0x498d('0xe')]===_0x498d('0xf');var _0xdf3953=_0x388a40[_0x498d('0x10')];var _0x984590=_0x2181ab?0x0:_0xc690b8['offset'];var _0x2704eb=_0x2181ab?_0x388a40[_0x498d('0x10')]:_0xc690b8[_0x498d('0xd')]+_0xc690b8[_0x498d('0xe')];var _0x383e5b;if(_0x2704eb>=_0xdf3953){_0x2704eb=_0xdf3953;_0x383e5b=0xc8;}else{_0x383e5b=0xce;}_0x83bd98[_0x498d('0xa')](_0x383e5b);return _0x83bd98[_0x498d('0x11')]('Content-Range',_0x984590+'-'+_0x2704eb+'/'+_0xdf3953)['json'](_0x388a40);}return null;};}function saveUpdates(_0x2834a5){return function(_0x257a76){if(_0x257a76){return _0x257a76[_0x498d('0x12')](_0x2834a5)[_0x498d('0x13')](function(_0x2dac2f){return _0x2dac2f;});}return null;};}function removeEntity(_0x4d0989){return function(_0x89623e){if(_0x89623e){return _0x89623e[_0x498d('0x14')]()[_0x498d('0x13')](function(){_0x4d0989[_0x498d('0xa')](0xcc)[_0x498d('0xb')]();});}};}function handleEntityNotFound(_0x262d38){return function(_0xf71b9f){if(!_0xf71b9f){_0x262d38['sendStatus'](0x194);}return _0xf71b9f;};}function handleError(_0x1c8649,_0x71b13b){_0x71b13b=_0x71b13b||0x1f4;return function(_0x1c109f){logger[_0x498d('0x15')](_0x1c109f[_0x498d('0x16')]);if(_0x1c109f[_0x498d('0x17')]){delete _0x1c109f[_0x498d('0x17')];}_0x1c8649[_0x498d('0xa')](_0x71b13b)[_0x498d('0x18')](_0x1c109f);};}function maskClientSecret(_0x4acd06){return _[_0x498d('0x19')](_0x4acd06[_0x498d('0x1a')](0x0,0x3),0x14,'*');}exports[_0x498d('0x1b')]=function(_0x3c1f7e,_0xee9427){var _0x4fad90={},_0x3c3d7c={},_0x565bac={'count':0x0,'rows':[]};var _0x488faa=_[_0x498d('0x1c')](db[_0x498d('0x1d')]['rawAttributes'],function(_0x3f2c77){return{'name':_0x3f2c77[_0x498d('0x1e')],'type':_0x3f2c77[_0x498d('0x1f')][_0x498d('0x20')]};});_0x3c3d7c['model']=_[_0x498d('0x1c')](_0x488faa,'name');_0x3c3d7c['query']=_['keys'](_0x3c1f7e[_0x498d('0x21')]);_0x3c3d7c[_0x498d('0x22')]=_[_0x498d('0x23')](_0x3c3d7c[_0x498d('0x24')],_0x3c3d7c[_0x498d('0x21')]);_0x4fad90[_0x498d('0x25')]=_['intersection'](_0x3c3d7c[_0x498d('0x24')],qs[_0x498d('0x26')](_0x3c1f7e['query']['fields']));_0x4fad90[_0x498d('0x25')]=_0x4fad90[_0x498d('0x25')][_0x498d('0x27')]?_0x4fad90[_0x498d('0x25')]:_0x3c3d7c[_0x498d('0x24')];if(!_0x3c1f7e['query'][_0x498d('0x28')]('nolimit')){_0x4fad90[_0x498d('0xe')]=qs[_0x498d('0xe')](_0x3c1f7e[_0x498d('0x21')][_0x498d('0xe')]);_0x4fad90[_0x498d('0xd')]=qs['offset'](_0x3c1f7e[_0x498d('0x21')][_0x498d('0xd')]);}_0x4fad90[_0x498d('0x29')]=qs['sort'](_0x3c1f7e['query'][_0x498d('0x2a')]);_0x4fad90[_0x498d('0x2b')]=qs['filters'](_[_0x498d('0x2c')](_0x3c1f7e[_0x498d('0x21')],_0x3c3d7c[_0x498d('0x22')]),_0x488faa);if(_0x3c1f7e[_0x498d('0x21')][_0x498d('0x2d')]){_0x4fad90[_0x498d('0x2b')]=_['merge'](_0x4fad90[_0x498d('0x2b')],{'$or':_[_0x498d('0x1c')](_0x488faa,function(_0x489a4a){if(_0x489a4a[_0x498d('0x1f')]!=='VIRTUAL'){var _0x31061d={};_0x31061d[_0x489a4a['name']]={'$like':'%'+_0x3c1f7e[_0x498d('0x21')]['filter']+'%'};return _0x31061d;}})});}_0x4fad90=_[_0x498d('0x2e')]({},_0x4fad90,_0x3c1f7e[_0x498d('0x2f')]);var _0x50c704={'where':_0x4fad90['where']};return db['CloudProvider']['count'](_0x50c704)['then'](function(_0x304ad2){_0x565bac[_0x498d('0x10')]=_0x304ad2;if(_0x3c1f7e[_0x498d('0x21')]['includeAll']){_0x4fad90[_0x498d('0x30')]=[{'all':!![]}];}return db[_0x498d('0x1d')][_0x498d('0x31')](_0x4fad90);})[_0x498d('0x13')](function(_0x3fac92){_0x565bac[_0x498d('0x32')]=_[_0x498d('0x1c')](_0x3fac92,function(_0x300a21){if(_0x300a21['service']==='MicrosoftAzure'){var _0x13dd51=encryptor[_0x498d('0x33')](_0x300a21[_0x498d('0x34')]);_0x300a21[_0x498d('0x34')]=maskClientSecret(_0x13dd51);}return _0x300a21;});return _0x565bac;})[_0x498d('0x13')](respondWithFilteredResult(_0xee9427,_0x4fad90))[_0x498d('0x35')](handleError(_0xee9427,null));};exports[_0x498d('0x36')]=function(_0x2c79c1,_0x5c77ae){var _0x46491c={'raw':!![],'where':{'id':_0x2c79c1[_0x498d('0x37')]['id']}},_0xef943c={};_0xef943c[_0x498d('0x24')]=_['keys'](db[_0x498d('0x1d')][_0x498d('0x38')]);_0xef943c[_0x498d('0x21')]=_['keys'](_0x2c79c1[_0x498d('0x21')]);_0xef943c[_0x498d('0x22')]=_[_0x498d('0x23')](_0xef943c[_0x498d('0x24')],_0xef943c['query']);_0x46491c[_0x498d('0x25')]=_['intersection'](_0xef943c[_0x498d('0x24')],qs[_0x498d('0x26')](_0x2c79c1[_0x498d('0x21')][_0x498d('0x26')]));_0x46491c[_0x498d('0x25')]=_0x46491c['attributes']['length']?_0x46491c[_0x498d('0x25')]:_0xef943c[_0x498d('0x24')];if(_0x2c79c1[_0x498d('0x21')][_0x498d('0x39')]){_0x46491c[_0x498d('0x30')]=[{'all':!![]}];}_0x46491c=_[_0x498d('0x2e')]({},_0x46491c,_0x2c79c1[_0x498d('0x2f')]);return db['CloudProvider'][_0x498d('0x3a')](_0x46491c)[_0x498d('0x13')](handleEntityNotFound(_0x5c77ae,null))[_0x498d('0x13')](function(_0x5a977c){if(_0x5a977c[_0x498d('0x3b')]===_0x498d('0x3c')){var _0x56756c=encryptor['decryptString'](_0x5a977c[_0x498d('0x34')]);_0x5a977c[_0x498d('0x34')]=maskClientSecret(_0x56756c);}return _0x5a977c;})[_0x498d('0x13')](respondWithResult(_0x5c77ae,null))[_0x498d('0x35')](handleError(_0x5c77ae,null));};exports[_0x498d('0x3d')]=function(_0xa90580,_0x192358){if(!_0xa90580[_0x498d('0x3e')]['name'])throw new Error(_0x498d('0x3f'));if(!_0xa90580[_0x498d('0x3e')][_0x498d('0x3b')])throw new Error(_0x498d('0x40'));var _0x9ad724=db[_0x498d('0x1d')][_0x498d('0x38')]['service']['values'];if(!_0x9ad724['includes'](_0xa90580[_0x498d('0x3e')][_0x498d('0x3b')]))throw new Error(_0x498d('0x41')+_0x9ad724[_0x498d('0x42')](',\x20'));if(_0xa90580[_0x498d('0x3e')][_0x498d('0x3b')]===_0x498d('0x3c')&&_0xa90580[_0x498d('0x3e')][_0x498d('0x34')]){_0xa90580[_0x498d('0x3e')][_0x498d('0x34')]=encryptor['encryptString'](_0xa90580['body'][_0x498d('0x34')]);}return db['CloudProvider']['create'](_0xa90580[_0x498d('0x3e')],{})[_0x498d('0x13')](respondWithResult(_0x192358,0xc9))[_0x498d('0x35')](handleError(_0x192358,null));};exports[_0x498d('0x12')]=function(_0x3a6659,_0x14b01c){if(_0x3a6659[_0x498d('0x3e')]['id']){delete _0x3a6659['body']['id'];}return db[_0x498d('0x1d')][_0x498d('0x3a')]({'where':{'id':_0x3a6659['params']['id']}})['then'](handleEntityNotFound(_0x14b01c,null))[_0x498d('0x13')](function(_0x624cf8){if(_0x624cf8['service']==='MicrosoftAzure'&&_0x3a6659[_0x498d('0x3e')]['data3']){_0x3a6659[_0x498d('0x3e')][_0x498d('0x34')]=encryptor[_0x498d('0x43')](_0x3a6659[_0x498d('0x3e')][_0x498d('0x34')]);}return _0x624cf8;})['then'](saveUpdates(_0x3a6659[_0x498d('0x3e')],null))[_0x498d('0x13')](respondWithResult(_0x14b01c,null))[_0x498d('0x35')](handleError(_0x14b01c,null));};exports['destroy']=function(_0x6b89e4,_0x21a5e){return db[_0x498d('0x1d')][_0x498d('0x3a')]({'where':{'id':_0x6b89e4['params']['id']}})[_0x498d('0x13')](handleEntityNotFound(_0x21a5e,null))[_0x498d('0x13')](removeEntity(_0x21a5e,null))[_0x498d('0x35')](handleError(_0x21a5e,null));};exports[_0x498d('0x44')]=function(_0x17877f,_0x4fdd81){return db[_0x498d('0x1d')][_0x498d('0x45')]({'where':{'id':_0x17877f['params']['id']},'raw':!![]})[_0x498d('0x13')](function(_0x1e8b1c){if(!_0x1e8b1c)return _0x4fdd81[_0x498d('0x46')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x1e8b1c,_0x17877f[_0x498d('0x47')]['id'])};})[_0x498d('0x13')](respondWithResult(_0x4fdd81,null))[_0x498d('0x35')](handleError(_0x4fdd81,null));};exports[_0x498d('0x48')]=function(_0x56eeb6,_0x350313){var _0x5cee45=_0x56eeb6[_0x498d('0x3e')];var _0x515323;var _0x45d803;if(_0x5cee45[_0x498d('0x15')])throw _0x5cee45;redis[_0x498d('0x49')](_0x5cee45[_0x498d('0x4a')])[_0x498d('0x13')](function(_0x1c8732){if(!_0x1c8732)throw new Error(_0x498d('0x4b'));_0x515323=JSON['parse'](_0x1c8732);var _0x1dd831=Buffer[_0x498d('0x4c')](_0x5cee45[_0x498d('0x4a')],_0x498d('0x4d'))[_0x498d('0x4e')](_0x498d('0x4f'));_0x45d803=JSON[_0x498d('0x50')](_0x1dd831);if(!oauth[_0x498d('0x51')](_0x5cee45[_0x498d('0x52')],_0x515323[_0x498d('0x53')]))throw new Error(_0x498d('0x54'));redis[_0x498d('0x55')](_0x5cee45[_0x498d('0x4a')]);return oauth[_0x498d('0x56')](_0x5cee45[_0x498d('0x57')],_0x515323);})[_0x498d('0x13')](function(_0x17caa){_0x515323[_0x498d('0x58')]=_0x17caa['access_token'];_0x515323[_0x498d('0x59')]=_0x17caa[_0x498d('0x5a')];return db['CloudProvider'][_0x498d('0x12')]({'data5':_0x515323[_0x498d('0x58')],'data6':_0x515323[_0x498d('0x59')]},{'where':{'id':_0x515323['id']}});})['then'](function(){oauth[_0x498d('0x5b')](_0x515323);socket['emit'](_0x498d('0x5c'),{'id':_0x45d803['id']});return;})[_0x498d('0x13')](respondWithStatusCode(_0x350313,null))[_0x498d('0x35')](function(_0x4d848e){if(_0x45d803){socket[_0x498d('0x5d')](_0x498d('0x5e'),{'id':_0x45d803['id']});}if(!_0x515323){logger[_0x498d('0x15')](_0x498d('0x5f'),_0x4d848e);return _0x350313['status'](0x1f4)[_0x498d('0x18')](_0x4d848e[_0x498d('0x60')]);}logger[_0x498d('0x15')](_0x498d('0x61'),_0x515323['id'],JSON[_0x498d('0x62')](_0x4d848e));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f4b36cd..5d500d9 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 _0xddda=['api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x268a87,_0x5d67e5){var _0x15a28d=function(_0x2f06ea){while(--_0x2f06ea){_0x268a87['push'](_0x268a87['shift']());}};_0x15a28d(++_0x5d67e5);}(_0xddda,0x1de));var _0xaddd=function(_0x4690f1,_0x10f22f){_0x4690f1=_0x4690f1-0x0;var _0x5c2b55=_0xddda[_0x4690f1];return _0x5c2b55;};'use strict';var _=require(_0xaddd('0x0'));var util=require(_0xaddd('0x1'));var logger=require('../../config/logger')(_0xaddd('0x2'));var moment=require('moment');var BPromise=require(_0xaddd('0x3'));var rp=require(_0xaddd('0x4'));var fs=require('fs');var path=require(_0xaddd('0x5'));var rimraf=require('rimraf');var config=require(_0xaddd('0x6'));var attributes=require(_0xaddd('0x7'));module[_0xaddd('0x8')]=function(_0x3627b6,_0x43c97b){return _0x3627b6[_0xaddd('0x9')](_0xaddd('0xa'),attributes,{'tableName':_0xaddd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be6=['moment','bluebird','path','rimraf','./cloudProvider.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x7be6,0xc5));var _0x67be=function(_0x4eec71,_0x22438f){_0x4eec71=_0x4eec71-0x0;var _0x2962b0=_0x7be6[_0x4eec71];return _0x2962b0;};'use strict';var _=require(_0x67be('0x0'));var util=require(_0x67be('0x1'));var logger=require(_0x67be('0x2'))('api');var moment=require(_0x67be('0x3'));var BPromise=require(_0x67be('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67be('0x5'));var rimraf=require(_0x67be('0x6'));var config=require('../../config/environment');var attributes=require(_0x67be('0x7'));module[_0x67be('0x8')]=function(_0xe3e57b,_0x373094){return _0xe3e57b[_0x67be('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','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 5a02ad5..3462007 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 _0x0ee8=['../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/token','map','data7','/.default','type','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from','stringify','toString','randomBytes','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','state','nonce','prompt','login','key','value','join','oauth2/','set','payload','issuer','aud','audience','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor'];(function(_0x30ae77,_0x35a28b){var _0x33c5a3=function(_0x2adbe9){while(--_0x2adbe9){_0x30ae77['push'](_0x30ae77['shift']());}};_0x33c5a3(++_0x35a28b);}(_0x0ee8,0x17e));var _0x80ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ee8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x80ee('0x0'));var crypto=require(_0x80ee('0x1'));var jwt=require(_0x80ee('0x2'));var moment=require(_0x80ee('0x3'));var Redis=require(_0x80ee('0x4'));var rp=require(_0x80ee('0x5'));var util=require(_0x80ee('0x6'));var encryptor=require(_0x80ee('0x7'));var config=require(_0x80ee('0x8'));var logger=require(_0x80ee('0x9'))('api');var schedule=require(_0x80ee('0xa'));var db=require(_0x80ee('0xb'))['db'];config[_0x80ee('0xc')]=_[_0x80ee('0xd')](config[_0x80ee('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x80ee('0xc')]);var MICROSOFT_AUTH_URL=_0x80ee('0xe');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x80ee('0xf'),'email',_0x80ee('0x10'),_0x80ee('0x11'),_0x80ee('0x12'),_0x80ee('0x13')],'Dynamics365':[_0x80ee('0x14'),_0x80ee('0x10')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x80ee('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x3510ae){var _0xd0e333=_[_0x80ee('0x16')](AZURE_AUTH_SCOPES[_0x3510ae['type']]);if(_0x3510ae['type']==='Dynamics365')_0xd0e333['push'](_0x3510ae[_0x80ee('0x17')]+_0x80ee('0x18'));return _0xd0e333['join']('\x20');}function getAccessTokenScope(_0x48e828){if(_0x48e828['type']==='Outlook365')return _0x80ee('0x11');if(_0x48e828[_0x80ee('0x19')]===_0x80ee('0x1a'))return _0x48e828[_0x80ee('0x17')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x118ded,_0x9a055f){var _0x1d364f=MICROSOFT_AUTH_URL[_0x80ee('0x1b')](_0x80ee('0x1c'),_0x118ded[_0x80ee('0x1d')]);var _0x7628ff=[_0x80ee('0x1e'),_0x80ee('0x1f')];var _0x35b8c5=Buffer[_0x80ee('0x20')](JSON[_0x80ee('0x21')]({'id':_0x9a055f}))[_0x80ee('0x22')]('base64');var _0x6efa18=crypto[_0x80ee('0x23')](0x10)[_0x80ee('0x22')]('hex');var _0x216cf1=getAuthorizationScopes(_0x118ded);var _0x2fab0a=[{'key':_0x80ee('0x24'),'value':_0x118ded[_0x80ee('0x25')]},{'key':_0x80ee('0x26'),'value':encodeURIComponent(_0x7628ff['join']('\x20'))},{'key':_0x80ee('0x27'),'value':_0x118ded[_0x80ee('0x28')]},{'key':_0x80ee('0x29'),'value':'form_post'},{'key':_0x80ee('0x2a'),'value':encodeURIComponent(_0x216cf1)},{'key':_0x80ee('0x2b'),'value':_0x35b8c5},{'key':_0x80ee('0x2c'),'value':_0x6efa18},{'key':_0x80ee('0x2d'),'value':_0x80ee('0x2e')}];var _0x15780c=_0x1d364f+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x2fab0a,function(_0xe8d1a7){return _0xe8d1a7[_0x80ee('0x2f')]+'='+_0xe8d1a7[_0x80ee('0x30')];})[_0x80ee('0x31')]('&');_0x118ded['oauth2Claims']={'issuer':_0x1d364f['replace'](_0x80ee('0x32'),''),'audience':_0x118ded[_0x80ee('0x25')],'state':_0x35b8c5,'nonce':_0x6efa18};redis[_0x80ee('0x33')](_0x35b8c5,JSON[_0x80ee('0x21')](_0x118ded));return _0x15780c;}function isValidIdToken(_0xfa3c81,_0x59d9e9){try{var _0x2fb0c1=jwt['decode'](_0xfa3c81,{'complete':!![]});var _0x58caff=_0x2fb0c1[_0x80ee('0x34')];if(_0x58caff['iss']!==_0x59d9e9[_0x80ee('0x35')])return![];if(_0x58caff[_0x80ee('0x36')]!==_0x59d9e9[_0x80ee('0x37')])return![];if(_0x58caff['nonce']!==_0x59d9e9['nonce'])return![];if(moment()['isAfter'](moment['unix'](_0x58caff['exp'])))return![];return!![];}catch(_0x5098b2){throw _0x5098b2;}}function refreshOauth2MicrosoftAccessToken(_0xa63861){return Promise[_0x80ee('0x38')]()[_0x80ee('0x39')](function(){if(_0xa63861[_0x80ee('0x3a')])return _0xa63861;return db[_0x80ee('0x3b')][_0x80ee('0x3c')]({'where':{'id':_0xa63861['id']},'raw':!![]});})[_0x80ee('0x39')](function(_0x5868fe){var _0x5c5ece={'grant_type':_0x80ee('0x3d'),'refresh_token':_0x5868fe[_0x80ee('0x3e')],'scope':getAccessTokenScope(_0x5868fe),'redirect_uri':_0x5868fe[_0x80ee('0x28')],'client_id':_0x5868fe[_0x80ee('0x25')],'client_secret':encryptor[_0x80ee('0x3f')](_0x5868fe['data3'])};var _0x2a8d5d={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x80ee('0x1b')](_0x80ee('0x1c'),_0x5868fe['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5c5ece,'json':!![]};return rp(_0x2a8d5d);})['then'](function(_0x34dd77){_0xa63861[_0x80ee('0x40')]=_0x34dd77[_0x80ee('0x41')];_0xa63861[_0x80ee('0x3e')]=_0x34dd77['refresh_token'];return db[_0x80ee('0x3b')][_0x80ee('0x42')]({'data5':_0xa63861[_0x80ee('0x40')],'data6':_0xa63861[_0x80ee('0x3e')]},{'where':{'id':_0xa63861['id']}});})[_0x80ee('0x39')](function(){return _0xa63861;})[_0x80ee('0x43')](function(_0x5da90){logger[_0x80ee('0x44')](_0x80ee('0x45'),_0xa63861['id'],_0x5da90);});}function getOauth2MicrosoftAccessToken(_0x14a881,_0x4f742e){var _0x87f662={'grant_type':_0x80ee('0x46'),'code':_0x14a881,'scope':getAccessTokenScope(_0x4f742e),'redirect_uri':_0x4f742e[_0x80ee('0x28')],'client_id':_0x4f742e[_0x80ee('0x25')],'client_secret':encryptor['decryptString'](_0x4f742e['data3'])};var _0x206e77={'method':_0x80ee('0x47'),'uri':MICROSOFT_AUTH_URL[_0x80ee('0x1b')](_0x80ee('0x1c'),_0x4f742e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x87f662,'json':!![]};return rp(_0x206e77);}function startRefreshInterval(_0x52ce40){var _0x1ca29e=schedule[_0x80ee('0x48')];if(_0x1ca29e[_0x52ce40['id']])clearInterval(_0x1ca29e[_0x52ce40['id']]);_0x1ca29e[_0x52ce40['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x52ce40['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x80ee('0x48')]=_0x1ca29e;}function startAllRefreshIntervals(){return db[_0x80ee('0x3b')][_0x80ee('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x80ee('0x39')](function(_0x2ac342){var _0x393da2=_0x2ac342[_0x80ee('0x16')](function(_0x49200f){return refreshOauth2MicrosoftAccessToken(_0x49200f)[_0x80ee('0x39')](function(_0x3bb9d9){startRefreshInterval(_0x3bb9d9);});});return Promise[_0x80ee('0x4a')](_0x393da2);})[_0x80ee('0x43')](function(_0x4de776){var _0x433cf8=_0x4de776?util[_0x80ee('0x4b')](_0x4de776,{'showHidden':![],'depth':null}):'';logger[_0x80ee('0x44')](_0x80ee('0x4c'),_0x433cf8);});}module[_0x80ee('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x3d88=['intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','push','data7','/.default','Outlook365','Dynamics365','{TENANT_ID}','data2','stringify','base64','randomBytes','toString','data1','response_type','join','response_mode','form_post','scope','nonce','prompt','login','map','value','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','replace','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','data4'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0x3d88,0x1d4));var _0x83d8=function(_0x226984,_0x3c3eac){_0x226984=_0x226984-0x0;var _0x4cc0f3=_0x3d88[_0x226984];return _0x4cc0f3;};'use strict';var _=require(_0x83d8('0x0'));var crypto=require(_0x83d8('0x1'));var jwt=require(_0x83d8('0x2'));var moment=require('moment');var Redis=require(_0x83d8('0x3'));var rp=require(_0x83d8('0x4'));var util=require(_0x83d8('0x5'));var encryptor=require(_0x83d8('0x6'));var config=require(_0x83d8('0x7'));var logger=require(_0x83d8('0x8'))(_0x83d8('0x9'));var schedule=require(_0x83d8('0xa'));var db=require(_0x83d8('0xb'))['db'];config[_0x83d8('0xc')]=_['defaults'](config[_0x83d8('0xc')],{'host':_0x83d8('0xd'),'port':0x18eb});var redis=new Redis(config[_0x83d8('0xc')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x83d8('0xe'),'email',_0x83d8('0xf'),_0x83d8('0x10'),_0x83d8('0x11'),_0x83d8('0x12')],'Dynamics365':['openid',_0x83d8('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x83d8('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x83d8('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1c491b){var _0x229ebe=_['map'](AZURE_AUTH_SCOPES[_0x1c491b[_0x83d8('0x15')]]);if(_0x1c491b[_0x83d8('0x15')]==='Dynamics365')_0x229ebe[_0x83d8('0x16')](_0x1c491b[_0x83d8('0x17')]+_0x83d8('0x18'));return _0x229ebe['join']('\x20');}function getAccessTokenScope(_0x206bc7){if(_0x206bc7[_0x83d8('0x15')]===_0x83d8('0x19'))return _0x83d8('0x10');if(_0x206bc7[_0x83d8('0x15')]===_0x83d8('0x1a'))return _0x206bc7[_0x83d8('0x17')]+_0x83d8('0x18');}function generateMicrosoftAuthorizationUrl(_0xcb56d3,_0x356d9b){var _0xe8e351=MICROSOFT_AUTH_URL['replace'](_0x83d8('0x1b'),_0xcb56d3[_0x83d8('0x1c')]);var _0x3f4e73=['code','id_token'];var _0x42a7fb=Buffer['from'](JSON[_0x83d8('0x1d')]({'id':_0x356d9b}))['toString'](_0x83d8('0x1e'));var _0x59461d=crypto[_0x83d8('0x1f')](0x10)[_0x83d8('0x20')]('hex');var _0x5ed7c1=getAuthorizationScopes(_0xcb56d3);var _0x4b04de=[{'key':'client_id','value':_0xcb56d3[_0x83d8('0x21')]},{'key':_0x83d8('0x22'),'value':encodeURIComponent(_0x3f4e73[_0x83d8('0x23')]('\x20'))},{'key':'redirect_uri','value':_0xcb56d3['data4']},{'key':_0x83d8('0x24'),'value':_0x83d8('0x25')},{'key':_0x83d8('0x26'),'value':encodeURIComponent(_0x5ed7c1)},{'key':'state','value':_0x42a7fb},{'key':_0x83d8('0x27'),'value':_0x59461d},{'key':_0x83d8('0x28'),'value':_0x83d8('0x29')}];var _0x461ec4=_0xe8e351+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x83d8('0x2a')](_0x4b04de,function(_0x51b7f2){return _0x51b7f2['key']+'='+_0x51b7f2[_0x83d8('0x2b')];})[_0x83d8('0x23')]('&');_0xcb56d3['oauth2Claims']={'issuer':_0xe8e351['replace'](_0x83d8('0x2c'),''),'audience':_0xcb56d3['data1'],'state':_0x42a7fb,'nonce':_0x59461d};redis[_0x83d8('0x2d')](_0x42a7fb,JSON[_0x83d8('0x1d')](_0xcb56d3));return _0x461ec4;}function isValidIdToken(_0x5b67d2,_0x4d6471){try{var _0x303b7d=jwt[_0x83d8('0x2e')](_0x5b67d2,{'complete':!![]});var _0x229981=_0x303b7d[_0x83d8('0x2f')];if(_0x229981[_0x83d8('0x30')]!==_0x4d6471[_0x83d8('0x31')])return![];if(_0x229981[_0x83d8('0x32')]!==_0x4d6471[_0x83d8('0x33')])return![];if(_0x229981[_0x83d8('0x27')]!==_0x4d6471[_0x83d8('0x27')])return![];if(moment()[_0x83d8('0x34')](moment[_0x83d8('0x35')](_0x229981['exp'])))return![];return!![];}catch(_0x5778eb){throw _0x5778eb;}}function refreshOauth2MicrosoftAccessToken(_0x2e3910){return Promise[_0x83d8('0x36')]()[_0x83d8('0x37')](function(){if(_0x2e3910[_0x83d8('0x38')])return _0x2e3910;return db[_0x83d8('0x39')][_0x83d8('0x3a')]({'where':{'id':_0x2e3910['id']},'raw':!![]});})[_0x83d8('0x37')](function(_0x2a6606){var _0x498124={'grant_type':_0x83d8('0x3b'),'refresh_token':_0x2a6606[_0x83d8('0x3c')],'scope':getAccessTokenScope(_0x2a6606),'redirect_uri':_0x2a6606['data4'],'client_id':_0x2a6606[_0x83d8('0x21')],'client_secret':encryptor[_0x83d8('0x3d')](_0x2a6606[_0x83d8('0x38')])};var _0x216305={'method':_0x83d8('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x83d8('0x3f')](_0x83d8('0x1b'),_0x2a6606[_0x83d8('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x498124,'json':!![]};return rp(_0x216305);})['then'](function(_0x2d52d3){_0x2e3910[_0x83d8('0x40')]=_0x2d52d3['access_token'];_0x2e3910[_0x83d8('0x3c')]=_0x2d52d3['refresh_token'];return db[_0x83d8('0x39')][_0x83d8('0x41')]({'data5':_0x2e3910['data5'],'data6':_0x2e3910[_0x83d8('0x3c')]},{'where':{'id':_0x2e3910['id']}});})[_0x83d8('0x37')](function(){return _0x2e3910;})[_0x83d8('0x42')](function(_0x508645){logger[_0x83d8('0x43')](_0x83d8('0x44'),_0x2e3910['id'],_0x508645);});}function getOauth2MicrosoftAccessToken(_0x1cf936,_0x27d87b){var _0x2402d5={'grant_type':_0x83d8('0x45'),'code':_0x1cf936,'scope':getAccessTokenScope(_0x27d87b),'redirect_uri':_0x27d87b[_0x83d8('0x46')],'client_id':_0x27d87b[_0x83d8('0x21')],'client_secret':encryptor[_0x83d8('0x3d')](_0x27d87b[_0x83d8('0x38')])};var _0x985f40={'method':_0x83d8('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x83d8('0x3f')](_0x83d8('0x1b'),_0x27d87b[_0x83d8('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2402d5,'json':!![]};return rp(_0x985f40);}function startRefreshInterval(_0x3298d1){var _0x3220cc=schedule[_0x83d8('0x47')];if(_0x3220cc[_0x3298d1['id']])clearInterval(_0x3220cc[_0x3298d1['id']]);_0x3220cc[_0x3298d1['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x83d8('0x48')](this,{'id':_0x3298d1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x83d8('0x47')]=_0x3220cc;}function startAllRefreshIntervals(){return db[_0x83d8('0x39')][_0x83d8('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x83d8('0x37')](function(_0x160a67){var _0x5d0e95=_0x160a67[_0x83d8('0x2a')](function(_0x2ee152){return refreshOauth2MicrosoftAccessToken(_0x2ee152)[_0x83d8('0x37')](function(_0x33b74c){startRefreshInterval(_0x33b74c);});});return Promise[_0x83d8('0x4a')](_0x5d0e95);})[_0x83d8('0x42')](function(_0x4037dd){var _0x51c7f1=_0x4037dd?util['inspect'](_0x4037dd,{'showHidden':![],'depth':null}):'';logger['error'](_0x83d8('0x4b'),_0x51c7f1);});}module[_0x83d8('0x4c')]={'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 979f8a9..bf72b35 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 _0xf3e2=['rpc','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xf3e2,0x168));var _0x2f3e=function(_0x46c1f5,_0x505b91){_0x46c1f5=_0x46c1f5-0x0;var _0x1a044d=_0xf3e2[_0x46c1f5];return _0x1a044d;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var moment=require(_0x2f3e('0x2'));var BPromise=require(_0x2f3e('0x3'));var rs=require(_0x2f3e('0x4'));var fs=require('fs');var Redis=require(_0x2f3e('0x5'));var db=require(_0x2f3e('0x6'))['db'];var utils=require(_0x2f3e('0x7'));var logger=require('../../config/logger')(_0x2f3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f3e('0x9'));var client=jayson[_0x2f3e('0xa')][_0x2f3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392f91,_0x3b556b,_0x1ac142){return new BPromise(function(_0x30f939,_0x46ec1b){return client['request'](_0x392f91,_0x1ac142)[_0x2f3e('0xc')](function(_0x4d7f7d){logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));logger[_0x2f3e('0x10')](_0x2f3e('0x11'),_0x3b556b,_0x2f3e('0xf'),JSON[_0x2f3e('0x12')](_0x4d7f7d));if(_0x4d7f7d[_0x2f3e('0x13')]){if(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x14')]===0x1f4){logger[_0x2f3e('0x13')](_0x2f3e('0xe'),_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x46ec1b(_0x4d7f7d['error'][_0x2f3e('0x15')]);}logger[_0x2f3e('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x30f939(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x15')]);}else{logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));_0x30f939(_0x4d7f7d['result'][_0x2f3e('0x15')]);}})[_0x2f3e('0x16')](function(_0x15398d){logger[_0x2f3e('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3b556b,_0x15398d);_0x46ec1b(_0x15398d);});});} \ No newline at end of file +var _0x96d8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CloudProvider,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x3499f5,_0x483bdc){var _0x3dd3c6=function(_0x7d50ee){while(--_0x7d50ee){_0x3499f5['push'](_0x3499f5['shift']());}};_0x3dd3c6(++_0x483bdc);}(_0x96d8,0x1e2));var _0x896d=function(_0x4ab400,_0x5dae91){_0x4ab400=_0x4ab400-0x0;var _0x5beeff=_0x96d8[_0x4ab400];return _0x5beeff;};'use strict';var _=require(_0x896d('0x0'));var util=require(_0x896d('0x1'));var moment=require(_0x896d('0x2'));var BPromise=require(_0x896d('0x3'));var rs=require(_0x896d('0x4'));var fs=require('fs');var Redis=require(_0x896d('0x5'));var db=require(_0x896d('0x6'))['db'];var utils=require(_0x896d('0x7'));var logger=require(_0x896d('0x8'))(_0x896d('0x9'));var config=require(_0x896d('0xa'));var jayson=require(_0x896d('0xb'));var client=jayson[_0x896d('0xc')][_0x896d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4b6c03,_0x1303a1,_0x11f45a){return new BPromise(function(_0x1edc92,_0x280171){return client[_0x896d('0xe')](_0x4b6c03,_0x11f45a)[_0x896d('0xf')](function(_0x8d7161){logger[_0x896d('0x10')]('CloudProvider,\x20%s,\x20%s',_0x1303a1,_0x896d('0x11'));logger[_0x896d('0x12')](_0x896d('0x13'),_0x1303a1,_0x896d('0x11'),JSON[_0x896d('0x14')](_0x8d7161));if(_0x8d7161['error']){if(_0x8d7161[_0x896d('0x15')][_0x896d('0x16')]===0x1f4){logger[_0x896d('0x15')]('CloudProvider,\x20%s,\x20%s',_0x1303a1,_0x8d7161['error']['message']);return _0x280171(_0x8d7161[_0x896d('0x15')]['message']);}logger[_0x896d('0x15')]('CloudProvider,\x20%s,\x20%s',_0x1303a1,_0x8d7161['error'][_0x896d('0x17')]);return _0x1edc92(_0x8d7161[_0x896d('0x15')]['message']);}else{logger[_0x896d('0x10')](_0x896d('0x18'),_0x1303a1,_0x896d('0x11'));_0x1edc92(_0x8d7161[_0x896d('0x19')][_0x896d('0x17')]);}})[_0x896d('0x1a')](function(_0x2adb40){logger[_0x896d('0x15')](_0x896d('0x18'),_0x1303a1,_0x2adb40);_0x280171(_0x2adb40);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 21fe198..858692f 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(_0x334169,_0x53940d){var _0x2244f2=function(_0x31712d){while(--_0x31712d){_0x334169['push'](_0x334169['shift']());}};_0x2244f2(++_0x53940d);}(_0xadb5,0xad));var _0x5adb=function(_0x16d2f4,_0x4dda77){_0x16d2f4=_0x16d2f4-0x0;var _0x236b0a=_0xadb5[_0x16d2f4];return _0x236b0a;};'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 _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x38d911,_0x5a0290){var _0x3df38b=function(_0x455e5e){while(--_0x455e5e){_0x38d911['push'](_0x38d911['shift']());}};_0x3df38b(++_0x5a0290);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index cd3d8ab..7e1e4b3 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 _0x5762=['STRING','name','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5762,0xc2));var _0x2576=function(_0x104857,_0x34844c){_0x104857=_0x104857-0x0;var _0x5c7d6d=_0x5762[_0x104857];return _0x5c7d6d;};'use strict';var Sequelize=require(_0x2576('0x0'));module[_0x2576('0x1')]={'name':{'type':Sequelize[_0x2576('0x2')],'unique':_0x2576('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2576('0x2')]},'companyId':{'type':Sequelize[_0x2576('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2576('0x2')]},'fax':{'type':Sequelize[_0x2576('0x2')]},'type':{'type':Sequelize[_0x2576('0x2')]},'street':{'type':Sequelize[_0x2576('0x2')]},'postalCode':{'type':Sequelize[_0x2576('0x2')]},'city':{'type':Sequelize[_0x2576('0x2')]},'country':{'type':Sequelize[_0x2576('0x2')]},'email':{'type':Sequelize[_0x2576('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x2576('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x2576('0x2')]},'sCountry':{'type':Sequelize[_0x2576('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x962c=['exports','STRING'];(function(_0x35a08c,_0x51c89e){var _0x165935=function(_0x811523){while(--_0x811523){_0x35a08c['push'](_0x35a08c['shift']());}};_0x165935(++_0x51c89e);}(_0x962c,0x1a0));var _0xc962=function(_0x49b923,_0x13c9c9){_0x49b923=_0x49b923-0x0;var _0xdf5a28=_0x962c[_0x49b923];return _0xdf5a28;};'use strict';var Sequelize=require('sequelize');module[_0xc962('0x0')]={'name':{'type':Sequelize[_0xc962('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc962('0x1')]},'companyId':{'type':Sequelize[_0xc962('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc962('0x1')]},'fax':{'type':Sequelize[_0xc962('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc962('0x1')]},'postalCode':{'type':Sequelize[_0xc962('0x1')]},'city':{'type':Sequelize[_0xc962('0x1')]},'country':{'type':Sequelize[_0xc962('0x1')]},'email':{'type':Sequelize[_0xc962('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc962('0x1')]},'sStreet':{'type':Sequelize[_0xc962('0x1')]},'sPostalCode':{'type':Sequelize[_0xc962('0x1')]},'sCity':{'type':Sequelize[_0xc962('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc962('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 6318e4e..e65ae4f 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 _0x684b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','get','Companies','UserProfileResource','error','name','index','CmCompany','model','keys','query','filters','intersection','fields','attributes','order','where','filter','merge','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addContacts','ids','omit','getContacts','sort','pick','map','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0x684b,0x1ac));var _0xb684=function(_0x15695c,_0xf9d938){_0x15695c=_0x15695c-0x0;var _0x3b71b4=_0x684b[_0x15695c];return _0x3b71b4;};'use strict';var emlformat=require(_0xb684('0x0'));var rimraf=require(_0xb684('0x1'));var zipdir=require(_0xb684('0x2'));var jsonpatch=require(_0xb684('0x3'));var rp=require(_0xb684('0x4'));var moment=require(_0xb684('0x5'));var BPromise=require(_0xb684('0x6'));var Mustache=require('mustache');var util=require(_0xb684('0x7'));var path=require(_0xb684('0x8'));var sox=require(_0xb684('0x9'));var csv=require(_0xb684('0xa'));var ejs=require(_0xb684('0xb'));var fs=require('fs');var fs_extra=require(_0xb684('0xc'));var _=require('lodash');var squel=require(_0xb684('0xd'));var crypto=require(_0xb684('0xe'));var jsforce=require(_0xb684('0xf'));var deskjs=require(_0xb684('0x10'));var toCsv=require(_0xb684('0xa'));var querystring=require(_0xb684('0x11'));var Papa=require(_0xb684('0x12'));var Redis=require(_0xb684('0x13'));var authService=require(_0xb684('0x14'));var qs=require(_0xb684('0x15'));var as=require(_0xb684('0x16'));var hardwareService=require(_0xb684('0x17'));var logger=require(_0xb684('0x18'))(_0xb684('0x19'));var utils=require(_0xb684('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb684('0x1b'));var db=require(_0xb684('0x1c'))['db'];function respondWithStatusCode(_0x343bbb,_0x2a9c66){_0x2a9c66=_0x2a9c66||0xcc;return function(_0x3e99f0){if(_0x3e99f0){return _0x343bbb[_0xb684('0x1d')](_0x2a9c66);}return _0x343bbb[_0xb684('0x1e')](_0x2a9c66)[_0xb684('0x1f')]();};}function respondWithResult(_0x18886c,_0x3bfe4b){_0x3bfe4b=_0x3bfe4b||0xc8;return function(_0x2028dc){if(_0x2028dc){return _0x18886c[_0xb684('0x1e')](_0x3bfe4b)[_0xb684('0x20')](_0x2028dc);}};}function respondWithFilteredResult(_0x5472e9,_0x44ee65){return function(_0x5c2bbe){if(_0x5c2bbe){var _0xf4edf1=typeof _0x44ee65[_0xb684('0x21')]===_0xb684('0x22')&&typeof _0x44ee65[_0xb684('0x23')]===_0xb684('0x22');var _0x428231=_0x5c2bbe['count'];var _0x26babf=_0xf4edf1?0x0:_0x44ee65[_0xb684('0x21')];var _0x3f23f5=_0xf4edf1?_0x5c2bbe[_0xb684('0x24')]:_0x44ee65[_0xb684('0x21')]+_0x44ee65['limit'];var _0x4b7cbe;if(_0x3f23f5>=_0x428231){_0x3f23f5=_0x428231;_0x4b7cbe=0xc8;}else{_0x4b7cbe=0xce;}_0x5472e9['status'](_0x4b7cbe);return _0x5472e9['set'](_0xb684('0x25'),_0x26babf+'-'+_0x3f23f5+'/'+_0x428231)['json'](_0x5c2bbe);}return null;};}function patchUpdates(_0xf56709){return function(_0x8d2c4c){try{jsonpatch['apply'](_0x8d2c4c,_0xf56709,!![]);}catch(_0x47a508){return BPromise['reject'](_0x47a508);}return _0x8d2c4c[_0xb684('0x26')]();};}function saveUpdates(_0x260553,_0x44ccc4){return function(_0x27c8e5){if(_0x27c8e5){return _0x27c8e5['update'](_0x260553)[_0xb684('0x27')](function(_0x2337c8){return _0x2337c8;});}return null;};}function removeEntity(_0x175ba8,_0x143d08){return function(_0x40f870){if(_0x40f870){return _0x40f870[_0xb684('0x28')]()[_0xb684('0x27')](function(){var _0x2cf9b3=_0x40f870[_0xb684('0x29')]({'plain':!![]});var _0x56a2ce=_0xb684('0x2a');return db[_0xb684('0x2b')][_0xb684('0x28')]({'where':{'type':_0x56a2ce,'resourceId':_0x2cf9b3['id']}})[_0xb684('0x27')](function(){return _0x40f870;});})[_0xb684('0x27')](function(){_0x175ba8[_0xb684('0x1e')](0xcc)[_0xb684('0x1f')]();});}};}function handleEntityNotFound(_0x840ec4,_0x290c49){return function(_0x3e508b){if(!_0x3e508b){_0x840ec4[_0xb684('0x1d')](0x194);}return _0x3e508b;};}function handleError(_0xaccb0,_0x4813d5){_0x4813d5=_0x4813d5||0x1f4;return function(_0x12f11a){logger[_0xb684('0x2c')](_0x12f11a['stack']);if(_0x12f11a[_0xb684('0x2d')]){delete _0x12f11a[_0xb684('0x2d')];}_0xaccb0['status'](_0x4813d5)['send'](_0x12f11a);};}exports[_0xb684('0x2e')]=function(_0x2a0856,_0x4f843f){var _0x344b4f={},_0xb604bb={},_0x2a3914={'count':0x0,'rows':[]};return db[_0xb684('0x2f')]['describe']()[_0xb684('0x27')](function(_0x50dd75){_0xb604bb[_0xb684('0x30')]=_[_0xb684('0x31')](_0x50dd75);_0xb604bb['query']=_[_0xb684('0x31')](_0x2a0856[_0xb684('0x32')]);_0xb604bb[_0xb684('0x33')]=_[_0xb684('0x34')](_0xb604bb['model'],_0xb604bb[_0xb684('0x32')]);_0x344b4f['attributes']=_[_0xb684('0x34')](_0xb604bb[_0xb684('0x30')],qs[_0xb684('0x35')](_0x2a0856[_0xb684('0x32')][_0xb684('0x35')]));_0x344b4f[_0xb684('0x36')]=_0x344b4f[_0xb684('0x36')]['length']?_0x344b4f[_0xb684('0x36')]:_0xb604bb[_0xb684('0x30')];if(!_0x2a0856[_0xb684('0x32')]['hasOwnProperty']('nolimit')){_0x344b4f['limit']=qs[_0xb684('0x23')](_0x2a0856[_0xb684('0x32')][_0xb684('0x23')]);_0x344b4f[_0xb684('0x21')]=qs[_0xb684('0x21')](_0x2a0856[_0xb684('0x32')][_0xb684('0x21')]);}_0x344b4f[_0xb684('0x37')]=qs['sort'](_0x2a0856['query']['sort']);_0x344b4f[_0xb684('0x38')]=qs[_0xb684('0x33')](_['pick'](_0x2a0856['query'],_0xb604bb['filters']),_0x50dd75);if(_0x2a0856[_0xb684('0x32')][_0xb684('0x39')]){_0x344b4f[_0xb684('0x38')]=_[_0xb684('0x3a')](_0x344b4f['where'],{'$or':_['map'](_0x344b4f[_0xb684('0x36')],function(_0x162bd5){var _0x20c461={};_0x20c461[_0x162bd5]={'$like':'%'+_0x2a0856[_0xb684('0x32')][_0xb684('0x39')]+'%'};return _0x20c461;})});}_0x344b4f=_['merge']({},_0x344b4f,_0x2a0856['options']);var _0x366bf4={'where':_0x344b4f[_0xb684('0x38')]};return db[_0xb684('0x2f')][_0xb684('0x24')](_0x366bf4)[_0xb684('0x27')](function(_0x1b1faa){_0x2a3914[_0xb684('0x24')]=_0x1b1faa;if(_0x2a0856[_0xb684('0x32')]['includeAll']){_0x344b4f[_0xb684('0x3b')]=[{'all':!![]}];}return db[_0xb684('0x2f')][_0xb684('0x3c')](_0x344b4f);})[_0xb684('0x27')](function(_0x29295e){_0x2a3914[_0xb684('0x3d')]=_0x29295e;return _0x2a3914;})[_0xb684('0x27')](respondWithFilteredResult(_0x4f843f,_0x344b4f))[_0xb684('0x3e')](handleError(_0x4f843f,null));})[_0xb684('0x3e')](handleError(_0x4f843f,null));};exports[_0xb684('0x3f')]=function(_0x534a16,_0xd244ff){var _0x3a8e84={'raw':![],'where':{'id':_0x534a16[_0xb684('0x40')]['id']}},_0x5c8cfd={};_0x5c8cfd[_0xb684('0x30')]=_[_0xb684('0x31')](db[_0xb684('0x2f')][_0xb684('0x41')]);_0x5c8cfd[_0xb684('0x32')]=_[_0xb684('0x31')](_0x534a16[_0xb684('0x32')]);_0x5c8cfd[_0xb684('0x33')]=_[_0xb684('0x34')](_0x5c8cfd[_0xb684('0x30')],_0x5c8cfd[_0xb684('0x32')]);_0x3a8e84[_0xb684('0x36')]=_[_0xb684('0x34')](_0x5c8cfd[_0xb684('0x30')],qs[_0xb684('0x35')](_0x534a16['query'][_0xb684('0x35')]));_0x3a8e84['attributes']=_0x3a8e84['attributes'][_0xb684('0x42')]?_0x3a8e84['attributes']:_0x5c8cfd[_0xb684('0x30')];if(_0x534a16[_0xb684('0x32')][_0xb684('0x43')]){_0x3a8e84['include']=[{'all':!![]}];}_0x3a8e84=_['merge']({},_0x3a8e84,_0x534a16[_0xb684('0x44')]);return db[_0xb684('0x2f')][_0xb684('0x45')](_0x3a8e84)[_0xb684('0x27')](handleEntityNotFound(_0xd244ff,null))[_0xb684('0x27')](respondWithResult(_0xd244ff,null))[_0xb684('0x3e')](handleError(_0xd244ff,null));};exports['create']=function(_0x33de21,_0x3f17f4){return db[_0xb684('0x2f')][_0xb684('0x46')](_0x33de21['body'],{})[_0xb684('0x27')](function(_0x171efe){var _0x4d6651=_0x33de21['user']['get']({'plain':!![]});if(!_0x4d6651)throw new Error(_0xb684('0x47'));if(_0x4d6651[_0xb684('0x48')]===_0xb684('0x49')){var _0x27f718=_0x171efe[_0xb684('0x29')]({'plain':!![]});var _0x3bda24=_0xb684('0x2a');return db[_0xb684('0x4a')]['find']({'where':{'name':_0x3bda24,'userProfileId':_0x4d6651[_0xb684('0x4b')]},'raw':!![]})[_0xb684('0x27')](function(_0x57f28c){if(_0x57f28c&&_0x57f28c[_0xb684('0x4c')]===0x0){return db[_0xb684('0x2b')][_0xb684('0x46')]({'name':_0x27f718['name'],'resourceId':_0x27f718['id'],'type':_0x57f28c[_0xb684('0x2d')],'sectionId':_0x57f28c['id']},{})[_0xb684('0x27')](function(){return _0x171efe;});}else{return _0x171efe;}})['catch'](function(_0x4785f){logger[_0xb684('0x2c')](_0xb684('0x4d'),_0x4785f);throw _0x4785f;});}return _0x171efe;})[_0xb684('0x27')](respondWithResult(_0x3f17f4,0xc9))[_0xb684('0x3e')](handleError(_0x3f17f4,null));};exports[_0xb684('0x4e')]=function(_0x19d27d,_0x5e53d1){if(_0x19d27d[_0xb684('0x4f')]['id']){delete _0x19d27d['body']['id'];}return db[_0xb684('0x2f')][_0xb684('0x45')]({'where':{'id':_0x19d27d[_0xb684('0x40')]['id']}})[_0xb684('0x27')](handleEntityNotFound(_0x5e53d1,null))['then'](saveUpdates(_0x19d27d[_0xb684('0x4f')],null))[_0xb684('0x27')](respondWithResult(_0x5e53d1,null))['catch'](handleError(_0x5e53d1,null));};exports[_0xb684('0x28')]=function(_0x4f91c8,_0x46a972){return db[_0xb684('0x2f')][_0xb684('0x45')]({'where':{'id':_0x4f91c8[_0xb684('0x40')]['id']}})[_0xb684('0x27')](handleEntityNotFound(_0x46a972,null))[_0xb684('0x27')](removeEntity(_0x46a972,null))[_0xb684('0x3e')](handleError(_0x46a972,null));};exports['describe']=function(_0x5ae1e0,_0x292aa1){return db[_0xb684('0x2f')][_0xb684('0x50')]()[_0xb684('0x27')](respondWithResult(_0x292aa1,null))['catch'](handleError(_0x292aa1,null));};exports['addContacts']=function(_0x2bad55,_0x2cf4c2,_0x5b80ba){return db['CmContact']['find']({'where':{'id':_0x2bad55[_0xb684('0x40')]['id']}})[_0xb684('0x27')](handleEntityNotFound(_0x2cf4c2,null))[_0xb684('0x27')](function(_0x5165ca){if(_0x5165ca){return _0x5165ca[_0xb684('0x51')](_0x2bad55[_0xb684('0x4f')][_0xb684('0x52')],_[_0xb684('0x53')](_0x2bad55[_0xb684('0x4f')],['ids','id'])||{});}})[_0xb684('0x27')](respondWithResult(_0x2cf4c2,null))[_0xb684('0x3e')](handleError(_0x2cf4c2,null));};exports[_0xb684('0x54')]=function(_0x327f73,_0x12617f,_0x594881){var _0x598236={};var _0x4125e7={};var _0x15eb4a;var _0x4c8ea0;return db[_0xb684('0x2f')]['findOne']({'where':{'id':_0x327f73[_0xb684('0x40')]['id']}})['then'](handleEntityNotFound(_0x12617f,null))[_0xb684('0x27')](function(_0x972a71){if(_0x972a71){_0x15eb4a=_0x972a71;_0x4125e7['model']=_[_0xb684('0x31')](db['CmContact'][_0xb684('0x41')]);_0x4125e7[_0xb684('0x32')]=_['keys'](_0x327f73[_0xb684('0x32')]);_0x4125e7[_0xb684('0x33')]=_['intersection'](_0x4125e7['model'],_0x4125e7['query']);_0x598236[_0xb684('0x36')]=_[_0xb684('0x34')](_0x4125e7[_0xb684('0x30')],qs['fields'](_0x327f73[_0xb684('0x32')][_0xb684('0x35')]));_0x598236[_0xb684('0x36')]=_0x598236[_0xb684('0x36')][_0xb684('0x42')]?_0x598236['attributes']:_0x4125e7[_0xb684('0x30')];_0x598236['order']=qs[_0xb684('0x55')](_0x327f73[_0xb684('0x32')][_0xb684('0x55')]);_0x598236[_0xb684('0x38')]=qs[_0xb684('0x33')](_[_0xb684('0x56')](_0x327f73[_0xb684('0x32')],_0x4125e7[_0xb684('0x33')]));if(_0x327f73['query']['filter']){_0x598236[_0xb684('0x38')]=_[_0xb684('0x3a')](_0x598236[_0xb684('0x38')],{'$or':_[_0xb684('0x57')](_0x598236[_0xb684('0x36')],function(_0x10e4a8){var _0x2f281c={};_0x2f281c[_0x10e4a8]={'$like':'%'+_0x327f73[_0xb684('0x32')]['filter']+'%'};return _0x2f281c;})});}_0x598236=_['merge']({},_0x598236,_0x327f73[_0xb684('0x44')]);return _0x15eb4a[_0xb684('0x54')](_0x598236);}})[_0xb684('0x27')](function(_0x5ea8a5){if(_0x5ea8a5){_0x4c8ea0=_0x5ea8a5[_0xb684('0x42')];if(!_0x327f73[_0xb684('0x32')][_0xb684('0x58')](_0xb684('0x59'))){_0x598236['limit']=qs[_0xb684('0x23')](_0x327f73[_0xb684('0x32')][_0xb684('0x23')]);_0x598236[_0xb684('0x21')]=qs[_0xb684('0x21')](_0x327f73['query'][_0xb684('0x21')]);}return _0x15eb4a['getContacts'](_0x598236);}})[_0xb684('0x27')](function(_0x16cc79){if(_0x16cc79){return _0x16cc79?{'count':_0x4c8ea0,'rows':_0x16cc79}:null;}})['then'](respondWithResult(_0x12617f,null))['catch'](handleError(_0x12617f,null));}; \ No newline at end of file +var _0x6534=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','Companies','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','CmContact','rawAttributes','hasOwnProperty','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6534,0x1f4));var _0x4653=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6534[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4653('0x0'));var rimraf=require(_0x4653('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4653('0x2'));var BPromise=require(_0x4653('0x3'));var Mustache=require(_0x4653('0x4'));var util=require(_0x4653('0x5'));var path=require(_0x4653('0x6'));var sox=require(_0x4653('0x7'));var csv=require('to-csv');var ejs=require(_0x4653('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4653('0x9'));var squel=require(_0x4653('0xa'));var crypto=require(_0x4653('0xb'));var jsforce=require(_0x4653('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4653('0xd'));var Papa=require(_0x4653('0xe'));var Redis=require('ioredis');var authService=require(_0x4653('0xf'));var qs=require(_0x4653('0x10'));var as=require(_0x4653('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4653('0x12'));var utils=require(_0x4653('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4653('0x14'));var db=require(_0x4653('0x15'))['db'];function respondWithStatusCode(_0x12268d,_0x308607){_0x308607=_0x308607||0xcc;return function(_0x2f0529){if(_0x2f0529){return _0x12268d[_0x4653('0x16')](_0x308607);}return _0x12268d[_0x4653('0x17')](_0x308607)[_0x4653('0x18')]();};}function respondWithResult(_0x5085ab,_0x2dae73){_0x2dae73=_0x2dae73||0xc8;return function(_0x3d4395){if(_0x3d4395){return _0x5085ab[_0x4653('0x17')](_0x2dae73)['json'](_0x3d4395);}};}function respondWithFilteredResult(_0xbfb318,_0x3412af){return function(_0x48740e){if(_0x48740e){var _0x5d47ad=typeof _0x3412af[_0x4653('0x19')]===_0x4653('0x1a')&&typeof _0x3412af['limit']==='undefined';var _0x52b3c9=_0x48740e[_0x4653('0x1b')];var _0x415784=_0x5d47ad?0x0:_0x3412af['offset'];var _0x462d5a=_0x5d47ad?_0x48740e['count']:_0x3412af[_0x4653('0x19')]+_0x3412af['limit'];var _0x89f6b4;if(_0x462d5a>=_0x52b3c9){_0x462d5a=_0x52b3c9;_0x89f6b4=0xc8;}else{_0x89f6b4=0xce;}_0xbfb318['status'](_0x89f6b4);return _0xbfb318[_0x4653('0x1c')]('Content-Range',_0x415784+'-'+_0x462d5a+'/'+_0x52b3c9)[_0x4653('0x1d')](_0x48740e);}return null;};}function patchUpdates(_0x54c782){return function(_0x5b7fe3){try{jsonpatch[_0x4653('0x1e')](_0x5b7fe3,_0x54c782,!![]);}catch(_0x5abc30){return BPromise[_0x4653('0x1f')](_0x5abc30);}return _0x5b7fe3[_0x4653('0x20')]();};}function saveUpdates(_0x2e56a6,_0x4ead9a){return function(_0x55b972){if(_0x55b972){return _0x55b972[_0x4653('0x21')](_0x2e56a6)[_0x4653('0x22')](function(_0xfe8eb){return _0xfe8eb;});}return null;};}function removeEntity(_0x3deaa8,_0x5b9f2a){return function(_0x1f0faf){if(_0x1f0faf){return _0x1f0faf[_0x4653('0x23')]()[_0x4653('0x22')](function(){var _0x27931a=_0x1f0faf['get']({'plain':!![]});var _0x3591d2=_0x4653('0x24');return db['UserProfileResource'][_0x4653('0x23')]({'where':{'type':_0x3591d2,'resourceId':_0x27931a['id']}})[_0x4653('0x22')](function(){return _0x1f0faf;});})[_0x4653('0x22')](function(){_0x3deaa8[_0x4653('0x17')](0xcc)[_0x4653('0x18')]();});}};}function handleEntityNotFound(_0x488294,_0x2fe1dc){return function(_0x498f95){if(!_0x498f95){_0x488294[_0x4653('0x16')](0x194);}return _0x498f95;};}function handleError(_0xf869e7,_0xa46662){_0xa46662=_0xa46662||0x1f4;return function(_0x174303){logger[_0x4653('0x25')](_0x174303['stack']);if(_0x174303[_0x4653('0x26')]){delete _0x174303[_0x4653('0x26')];}_0xf869e7[_0x4653('0x17')](_0xa46662)[_0x4653('0x27')](_0x174303);};}exports[_0x4653('0x28')]=function(_0x38d497,_0x2c6494){var _0x404528={},_0x1fae3a={},_0x5dcd9f={'count':0x0,'rows':[]};return db[_0x4653('0x29')][_0x4653('0x2a')]()['then'](function(_0x4fbdff){_0x1fae3a[_0x4653('0x2b')]=_[_0x4653('0x2c')](_0x4fbdff);_0x1fae3a['query']=_[_0x4653('0x2c')](_0x38d497[_0x4653('0x2d')]);_0x1fae3a[_0x4653('0x2e')]=_[_0x4653('0x2f')](_0x1fae3a[_0x4653('0x2b')],_0x1fae3a[_0x4653('0x2d')]);_0x404528[_0x4653('0x30')]=_[_0x4653('0x2f')](_0x1fae3a[_0x4653('0x2b')],qs['fields'](_0x38d497[_0x4653('0x2d')][_0x4653('0x31')]));_0x404528[_0x4653('0x30')]=_0x404528['attributes'][_0x4653('0x32')]?_0x404528[_0x4653('0x30')]:_0x1fae3a[_0x4653('0x2b')];if(!_0x38d497['query']['hasOwnProperty'](_0x4653('0x33'))){_0x404528['limit']=qs[_0x4653('0x34')](_0x38d497[_0x4653('0x2d')][_0x4653('0x34')]);_0x404528[_0x4653('0x19')]=qs[_0x4653('0x19')](_0x38d497[_0x4653('0x2d')][_0x4653('0x19')]);}_0x404528[_0x4653('0x35')]=qs[_0x4653('0x36')](_0x38d497[_0x4653('0x2d')][_0x4653('0x36')]);_0x404528[_0x4653('0x37')]=qs[_0x4653('0x2e')](_[_0x4653('0x38')](_0x38d497[_0x4653('0x2d')],_0x1fae3a[_0x4653('0x2e')]),_0x4fbdff);if(_0x38d497[_0x4653('0x2d')][_0x4653('0x39')]){_0x404528[_0x4653('0x37')]=_[_0x4653('0x3a')](_0x404528[_0x4653('0x37')],{'$or':_[_0x4653('0x3b')](_0x404528['attributes'],function(_0xfba4e9){var _0x4633c0={};_0x4633c0[_0xfba4e9]={'$like':'%'+_0x38d497[_0x4653('0x2d')][_0x4653('0x39')]+'%'};return _0x4633c0;})});}_0x404528=_[_0x4653('0x3a')]({},_0x404528,_0x38d497[_0x4653('0x3c')]);var _0x5de91e={'where':_0x404528[_0x4653('0x37')]};return db['CmCompany'][_0x4653('0x1b')](_0x5de91e)[_0x4653('0x22')](function(_0x5e5da){_0x5dcd9f[_0x4653('0x1b')]=_0x5e5da;if(_0x38d497[_0x4653('0x2d')][_0x4653('0x3d')]){_0x404528[_0x4653('0x3e')]=[{'all':!![]}];}return db[_0x4653('0x29')][_0x4653('0x3f')](_0x404528);})[_0x4653('0x22')](function(_0x3145cc){_0x5dcd9f[_0x4653('0x40')]=_0x3145cc;return _0x5dcd9f;})[_0x4653('0x22')](respondWithFilteredResult(_0x2c6494,_0x404528))[_0x4653('0x41')](handleError(_0x2c6494,null));})[_0x4653('0x41')](handleError(_0x2c6494,null));};exports['show']=function(_0x48f957,_0x4c2824){var _0x2b0048={'raw':![],'where':{'id':_0x48f957[_0x4653('0x42')]['id']}},_0xe111d7={};_0xe111d7['model']=_[_0x4653('0x2c')](db['CmCompany']['rawAttributes']);_0xe111d7[_0x4653('0x2d')]=_[_0x4653('0x2c')](_0x48f957[_0x4653('0x2d')]);_0xe111d7['filters']=_[_0x4653('0x2f')](_0xe111d7['model'],_0xe111d7[_0x4653('0x2d')]);_0x2b0048[_0x4653('0x30')]=_[_0x4653('0x2f')](_0xe111d7[_0x4653('0x2b')],qs[_0x4653('0x31')](_0x48f957[_0x4653('0x2d')][_0x4653('0x31')]));_0x2b0048[_0x4653('0x30')]=_0x2b0048[_0x4653('0x30')][_0x4653('0x32')]?_0x2b0048['attributes']:_0xe111d7[_0x4653('0x2b')];if(_0x48f957[_0x4653('0x2d')]['includeAll']){_0x2b0048[_0x4653('0x3e')]=[{'all':!![]}];}_0x2b0048=_[_0x4653('0x3a')]({},_0x2b0048,_0x48f957['options']);return db[_0x4653('0x29')][_0x4653('0x43')](_0x2b0048)[_0x4653('0x22')](handleEntityNotFound(_0x4c2824,null))[_0x4653('0x22')](respondWithResult(_0x4c2824,null))[_0x4653('0x41')](handleError(_0x4c2824,null));};exports['create']=function(_0x22acf8,_0x4006da){return db[_0x4653('0x29')][_0x4653('0x44')](_0x22acf8[_0x4653('0x45')],{})[_0x4653('0x22')](function(_0x4e1459){var _0x2dd15b=_0x22acf8[_0x4653('0x46')][_0x4653('0x47')]({'plain':!![]});if(!_0x2dd15b)throw new Error(_0x4653('0x48'));if(_0x2dd15b[_0x4653('0x49')]===_0x4653('0x46')){var _0x43ea0d=_0x4e1459[_0x4653('0x47')]({'plain':!![]});var _0x8fb784=_0x4653('0x24');return db[_0x4653('0x4a')]['find']({'where':{'name':_0x8fb784,'userProfileId':_0x2dd15b[_0x4653('0x4b')]},'raw':!![]})['then'](function(_0x464bdc){if(_0x464bdc&&_0x464bdc[_0x4653('0x4c')]===0x0){return db[_0x4653('0x4d')][_0x4653('0x44')]({'name':_0x43ea0d['name'],'resourceId':_0x43ea0d['id'],'type':_0x464bdc[_0x4653('0x26')],'sectionId':_0x464bdc['id']},{})[_0x4653('0x22')](function(){return _0x4e1459;});}else{return _0x4e1459;}})[_0x4653('0x41')](function(_0x121dac){logger['error'](_0x4653('0x4e'),_0x121dac);throw _0x121dac;});}return _0x4e1459;})['then'](respondWithResult(_0x4006da,0xc9))['catch'](handleError(_0x4006da,null));};exports[_0x4653('0x21')]=function(_0x2e744a,_0x42c9ce){if(_0x2e744a[_0x4653('0x45')]['id']){delete _0x2e744a[_0x4653('0x45')]['id'];}return db['CmCompany'][_0x4653('0x43')]({'where':{'id':_0x2e744a['params']['id']}})['then'](handleEntityNotFound(_0x42c9ce,null))['then'](saveUpdates(_0x2e744a['body'],null))[_0x4653('0x22')](respondWithResult(_0x42c9ce,null))['catch'](handleError(_0x42c9ce,null));};exports['destroy']=function(_0x429574,_0x273af7){return db[_0x4653('0x29')][_0x4653('0x43')]({'where':{'id':_0x429574['params']['id']}})[_0x4653('0x22')](handleEntityNotFound(_0x273af7,null))[_0x4653('0x22')](removeEntity(_0x273af7,null))['catch'](handleError(_0x273af7,null));};exports['describe']=function(_0x4febd3,_0x13420e){return db[_0x4653('0x29')][_0x4653('0x2a')]()[_0x4653('0x22')](respondWithResult(_0x13420e,null))[_0x4653('0x41')](handleError(_0x13420e,null));};exports[_0x4653('0x4f')]=function(_0x247667,_0x10835f,_0x2a4f0b){return db['CmContact'][_0x4653('0x43')]({'where':{'id':_0x247667[_0x4653('0x42')]['id']}})[_0x4653('0x22')](handleEntityNotFound(_0x10835f,null))[_0x4653('0x22')](function(_0x2f45dd){if(_0x2f45dd){return _0x2f45dd[_0x4653('0x4f')](_0x247667[_0x4653('0x45')][_0x4653('0x50')],_['omit'](_0x247667[_0x4653('0x45')],[_0x4653('0x50'),'id'])||{});}})[_0x4653('0x22')](respondWithResult(_0x10835f,null))[_0x4653('0x41')](handleError(_0x10835f,null));};exports[_0x4653('0x51')]=function(_0x3b74e9,_0x50b74b,_0x2f49e4){var _0x426593={};var _0xf77379={};var _0x477001;var _0x51fd44;return db[_0x4653('0x29')][_0x4653('0x52')]({'where':{'id':_0x3b74e9[_0x4653('0x42')]['id']}})[_0x4653('0x22')](handleEntityNotFound(_0x50b74b,null))[_0x4653('0x22')](function(_0x1fcc04){if(_0x1fcc04){_0x477001=_0x1fcc04;_0xf77379['model']=_[_0x4653('0x2c')](db[_0x4653('0x53')][_0x4653('0x54')]);_0xf77379[_0x4653('0x2d')]=_[_0x4653('0x2c')](_0x3b74e9['query']);_0xf77379[_0x4653('0x2e')]=_[_0x4653('0x2f')](_0xf77379[_0x4653('0x2b')],_0xf77379[_0x4653('0x2d')]);_0x426593[_0x4653('0x30')]=_['intersection'](_0xf77379[_0x4653('0x2b')],qs[_0x4653('0x31')](_0x3b74e9[_0x4653('0x2d')][_0x4653('0x31')]));_0x426593['attributes']=_0x426593['attributes'][_0x4653('0x32')]?_0x426593[_0x4653('0x30')]:_0xf77379[_0x4653('0x2b')];_0x426593[_0x4653('0x35')]=qs[_0x4653('0x36')](_0x3b74e9[_0x4653('0x2d')][_0x4653('0x36')]);_0x426593[_0x4653('0x37')]=qs[_0x4653('0x2e')](_[_0x4653('0x38')](_0x3b74e9[_0x4653('0x2d')],_0xf77379[_0x4653('0x2e')]));if(_0x3b74e9[_0x4653('0x2d')]['filter']){_0x426593['where']=_[_0x4653('0x3a')](_0x426593[_0x4653('0x37')],{'$or':_[_0x4653('0x3b')](_0x426593['attributes'],function(_0x44b2ba){var _0x452345={};_0x452345[_0x44b2ba]={'$like':'%'+_0x3b74e9[_0x4653('0x2d')]['filter']+'%'};return _0x452345;})});}_0x426593=_[_0x4653('0x3a')]({},_0x426593,_0x3b74e9[_0x4653('0x3c')]);return _0x477001['getContacts'](_0x426593);}})[_0x4653('0x22')](function(_0x3ed945){if(_0x3ed945){_0x51fd44=_0x3ed945[_0x4653('0x32')];if(!_0x3b74e9[_0x4653('0x2d')][_0x4653('0x55')]('nolimit')){_0x426593[_0x4653('0x34')]=qs[_0x4653('0x34')](_0x3b74e9[_0x4653('0x2d')]['limit']);_0x426593['offset']=qs['offset'](_0x3b74e9[_0x4653('0x2d')]['offset']);}return _0x477001[_0x4653('0x51')](_0x426593);}})[_0x4653('0x22')](function(_0x3d579d){if(_0x3d579d){return _0x3d579d?{'count':_0x51fd44,'rows':_0x3d579d}:null;}})['then'](respondWithResult(_0x50b74b,null))[_0x4653('0x41')](handleError(_0x50b74b,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4cdd2b5..b426833 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 _0xd640=['exports','cm_companies','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xd640,0x173));var _0x0d64=function(_0x16688d,_0x5c5de6){_0x16688d=_0x16688d-0x0;var _0x5a7473=_0xd640[_0x16688d];return _0x5a7473;};'use strict';var _=require(_0x0d64('0x0'));var util=require(_0x0d64('0x1'));var logger=require(_0x0d64('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0d64('0x3'));var rp=require(_0x0d64('0x4'));var fs=require('fs');var path=require(_0x0d64('0x5'));var rimraf=require(_0x0d64('0x6'));var config=require('../../config/environment');var attributes=require('./cmCompany.attributes');module[_0x0d64('0x7')]=function(_0x2f33e7,_0x5d60c6){return _0x2f33e7['define']('CmCompany',attributes,{'tableName':_0x0d64('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef7b=['define','CmCompany','lodash','../../config/logger','moment','request-promise','path','rimraf','./cmCompany.attributes','exports'];(function(_0x44882a,_0x86a2dd){var _0x473230=function(_0x136c6a){while(--_0x136c6a){_0x44882a['push'](_0x44882a['shift']());}};_0x473230(++_0x86a2dd);}(_0xef7b,0xe8));var _0xbef7=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xef7b[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0xbef7('0x0'));var util=require('util');var logger=require(_0xbef7('0x1'))('api');var moment=require(_0xbef7('0x2'));var BPromise=require('bluebird');var rp=require(_0xbef7('0x3'));var fs=require('fs');var path=require(_0xbef7('0x4'));var rimraf=require(_0xbef7('0x5'));var config=require('../../config/environment');var attributes=require(_0xbef7('0x6'));module[_0xbef7('0x7')]=function(_0xf4bab8,_0x34450b){return _0xf4bab8[_0xbef7('0x8')](_0xbef7('0x9'),attributes,{'tableName':'cm_companies','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 b812341..dc30c4b 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 _0x8d79=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe8e802,_0x3c4832){var _0x347d4b=function(_0x305961){while(--_0x305961){_0xe8e802['push'](_0xe8e802['shift']());}};_0x347d4b(++_0x3c4832);}(_0x8d79,0xb0));var _0x98d7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8d79[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x98d7('0x0'));var util=require(_0x98d7('0x1'));var moment=require(_0x98d7('0x2'));var BPromise=require(_0x98d7('0x3'));var rs=require(_0x98d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98d7('0x5'))(_0x98d7('0x6'));var config=require(_0x98d7('0x7'));var jayson=require(_0x98d7('0x8'));var client=jayson[_0x98d7('0x9')][_0x98d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x137fa5,_0x1b5658,_0x1e9e88){return new BPromise(function(_0x44b0f2,_0x1019a4){return client[_0x98d7('0xb')](_0x137fa5,_0x1e9e88)[_0x98d7('0xc')](function(_0x27cb9f){logger['info'](_0x98d7('0xd'),_0x1b5658,_0x98d7('0xe'));logger[_0x98d7('0xf')](_0x98d7('0x10'),_0x1b5658,_0x98d7('0xe'),JSON[_0x98d7('0x11')](_0x27cb9f));if(_0x27cb9f[_0x98d7('0x12')]){if(_0x27cb9f[_0x98d7('0x12')][_0x98d7('0x13')]===0x1f4){logger[_0x98d7('0x12')](_0x98d7('0xd'),_0x1b5658,_0x27cb9f[_0x98d7('0x12')][_0x98d7('0x14')]);return _0x1019a4(_0x27cb9f['error'][_0x98d7('0x14')]);}logger[_0x98d7('0x12')]('CmCompany,\x20%s,\x20%s',_0x1b5658,_0x27cb9f[_0x98d7('0x12')][_0x98d7('0x14')]);return _0x44b0f2(_0x27cb9f['error'][_0x98d7('0x14')]);}else{logger[_0x98d7('0x15')]('CmCompany,\x20%s,\x20%s',_0x1b5658,'request\x20sent');_0x44b0f2(_0x27cb9f[_0x98d7('0x16')][_0x98d7('0x14')]);}})[_0x98d7('0x17')](function(_0x43be58){logger[_0x98d7('0x12')](_0x98d7('0xd'),_0x1b5658,_0x43be58);_0x1019a4(_0x43be58);});});} \ No newline at end of file +var _0xd5fd=['request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x2304d9,_0x57b715){var _0x4c59a7=function(_0x2fb3e8){while(--_0x2fb3e8){_0x2304d9['push'](_0x2304d9['shift']());}};_0x4c59a7(++_0x57b715);}(_0xd5fd,0x199));var _0xdd5f=function(_0x3041ce,_0x382f98){_0x3041ce=_0x3041ce-0x0;var _0x68a7f9=_0xd5fd[_0x3041ce];return _0x68a7f9;};'use strict';var _=require(_0xdd5f('0x0'));var util=require(_0xdd5f('0x1'));var moment=require('moment');var BPromise=require(_0xdd5f('0x2'));var rs=require(_0xdd5f('0x3'));var fs=require('fs');var Redis=require(_0xdd5f('0x4'));var db=require(_0xdd5f('0x5'))['db'];var utils=require(_0xdd5f('0x6'));var logger=require(_0xdd5f('0x7'))('rpc');var config=require(_0xdd5f('0x8'));var jayson=require(_0xdd5f('0x9'));var client=jayson['client'][_0xdd5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29997c,_0x50adbb,_0x4891d4){return new BPromise(function(_0x17b56e,_0x95b75d){return client[_0xdd5f('0xb')](_0x29997c,_0x4891d4)['then'](function(_0x2f0954){logger['info'](_0xdd5f('0xc'),_0x50adbb,_0xdd5f('0xd'));logger[_0xdd5f('0xe')](_0xdd5f('0xf'),_0x50adbb,_0xdd5f('0xd'),JSON['stringify'](_0x2f0954));if(_0x2f0954[_0xdd5f('0x10')]){if(_0x2f0954[_0xdd5f('0x10')]['code']===0x1f4){logger[_0xdd5f('0x10')]('CmCompany,\x20%s,\x20%s',_0x50adbb,_0x2f0954[_0xdd5f('0x10')][_0xdd5f('0x11')]);return _0x95b75d(_0x2f0954[_0xdd5f('0x10')][_0xdd5f('0x11')]);}logger[_0xdd5f('0x10')](_0xdd5f('0xc'),_0x50adbb,_0x2f0954['error']['message']);return _0x17b56e(_0x2f0954[_0xdd5f('0x10')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x50adbb,'request\x20sent');_0x17b56e(_0x2f0954[_0xdd5f('0x12')][_0xdd5f('0x11')]);}})[_0xdd5f('0x13')](function(_0x10b482){logger[_0xdd5f('0x10')](_0xdd5f('0xc'),_0x50adbb,_0x10b482);_0x95b75d(_0x10b482);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index c28ba2f..0c3693a 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 _0x5fde=['../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x32b75c,_0x33bb45){var _0x2f06a4=function(_0x33b83b){while(--_0x33b83b){_0x32b75c['push'](_0x32b75c['shift']());}};_0x2f06a4(++_0x33bb45);}(_0x5fde,0x9b));var _0xe5fd=function(_0x28a406,_0x5b3425){_0x28a406=_0x28a406-0x0;var _0x4bee69=_0x5fde[_0x28a406];return _0x4bee69;};'use strict';var multer=require('multer');var util=require(_0xe5fd('0x0'));var path=require(_0xe5fd('0x1'));var timeout=require(_0xe5fd('0x2'));var express=require(_0xe5fd('0x3'));var router=express[_0xe5fd('0x4')]();var fs_extra=require(_0xe5fd('0x5'));var auth=require(_0xe5fd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xe5fd('0x7')]('/',auth[_0xe5fd('0x8')](),controller[_0xe5fd('0x9')]);router[_0xe5fd('0x7')](_0xe5fd('0xa'),auth[_0xe5fd('0x8')](),controller[_0xe5fd('0xb')]);router['get'](_0xe5fd('0xc'),auth[_0xe5fd('0x8')](),controller[_0xe5fd('0xd')]);router[_0xe5fd('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xe5fd('0xe')]);router[_0xe5fd('0xf')]('/',auth[_0xe5fd('0x8')](),controller[_0xe5fd('0x10')]);router['post'](_0xe5fd('0x11'),auth[_0xe5fd('0x8')](),controller[_0xe5fd('0x12')]);router[_0xe5fd('0x13')](_0xe5fd('0xc'),auth['isAuthenticated'](),controller[_0xe5fd('0x14')]);router[_0xe5fd('0x15')](_0xe5fd('0xc'),auth[_0xe5fd('0x8')](),controller[_0xe5fd('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcad6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x30c3ca,_0xf8fe7f){var _0x317aad=function(_0x4ad4bc){while(--_0x4ad4bc){_0x30c3ca['push'](_0x30c3ca['shift']());}};_0x317aad(++_0xf8fe7f);}(_0xcad6,0xf3));var _0x6cad=function(_0x154f15,_0x40b088){_0x154f15=_0x154f15-0x0;var _0x36a98a=_0xcad6[_0x154f15];return _0x36a98a;};'use strict';var multer=require(_0x6cad('0x0'));var util=require(_0x6cad('0x1'));var path=require(_0x6cad('0x2'));var timeout=require(_0x6cad('0x3'));var express=require(_0x6cad('0x4'));var router=express[_0x6cad('0x5')]();var fs_extra=require(_0x6cad('0x6'));var auth=require(_0x6cad('0x7'));var interaction=require(_0x6cad('0x8'));var config=require(_0x6cad('0x9'));var controller=require(_0x6cad('0xa'));router[_0x6cad('0xb')]('/',auth['isAuthenticated'](),controller[_0x6cad('0xc')]);router['get'](_0x6cad('0xd'),auth[_0x6cad('0xe')](),controller[_0x6cad('0xf')]);router[_0x6cad('0xb')](_0x6cad('0x10'),auth[_0x6cad('0xe')](),controller[_0x6cad('0x11')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0x6cad('0x12')]);router[_0x6cad('0x13')]('/',auth[_0x6cad('0xe')](),controller[_0x6cad('0x14')]);router['post'](_0x6cad('0x15'),auth[_0x6cad('0xe')](),controller[_0x6cad('0x16')]);router[_0x6cad('0x17')](_0x6cad('0x10'),auth[_0x6cad('0xe')](),controller[_0x6cad('0x18')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x6cad('0x19')]);module[_0x6cad('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5bf4edc..644d456 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 _0x826f=['TEXT','UNSIGNED','DATE','INTEGER','lodash','sequelize','STRING'];(function(_0x37397b,_0x4be175){var _0x241dc5=function(_0x2ef68c){while(--_0x2ef68c){_0x37397b['push'](_0x37397b['shift']());}};_0x241dc5(++_0x4be175);}(_0x826f,0x162));var _0xf826=function(_0x5d271b,_0x4a3ce1){_0x5d271b=_0x5d271b-0x0;var _0x3db947=_0x826f[_0x5d271b];return _0x3db947;};'use strict';var _=require(_0xf826('0x0'));var Sequelize=require(_0xf826('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xf826('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xf826('0x2')]},'street':{'type':Sequelize[_0xf826('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf826('0x2')]},'country':{'type':Sequelize[_0xf826('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf826('0x3')]},'phone':{'type':Sequelize[_0xf826('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xf826('0x2')]},'email':{'type':Sequelize[_0xf826('0x2')]},'url':{'type':Sequelize[_0xf826('0x2')]},'facebook':{'type':Sequelize[_0xf826('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xf826('0x2')]},'skype':{'type':Sequelize[_0xf826('0x2')]},'teams':{'type':Sequelize[_0xf826('0x2')]},'viber':{'type':Sequelize[_0xf826('0x2')]},'line':{'type':Sequelize[_0xf826('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xf826('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0xf826('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf826('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xf826('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xf826('0x6')]}}; \ No newline at end of file +var _0x8aac=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','NOW'];(function(_0x5e6fc9,_0x5bee97){var _0x5aa4c2=function(_0x3c09e3){while(--_0x3c09e3){_0x5e6fc9['push'](_0x5e6fc9['shift']());}};_0x5aa4c2(++_0x5bee97);}(_0x8aac,0x1ce));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Sequelize=require(_0xc8aa('0x0'));module[_0xc8aa('0x1')]={'firstName':{'type':Sequelize[_0xc8aa('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc8aa('0x2')]},'street':{'type':Sequelize[_0xc8aa('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc8aa('0x2')]},'country':{'type':Sequelize[_0xc8aa('0x2')]},'dateOfBirth':{'type':Sequelize[_0xc8aa('0x2')]},'description':{'type':Sequelize[_0xc8aa('0x3')]},'phone':{'type':Sequelize[_0xc8aa('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xc8aa('0x2')]},'email':{'type':Sequelize[_0xc8aa('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xc8aa('0x2')]},'twitter':{'type':Sequelize[_0xc8aa('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0xc8aa('0x2')]},'viber':{'type':Sequelize[_0xc8aa('0x2')]},'line':{'type':Sequelize[_0xc8aa('0x2')]},'wechat':{'type':Sequelize[_0xc8aa('0x2')]},'telegram':{'type':Sequelize[_0xc8aa('0x2')]},'UserId':{'type':Sequelize[_0xc8aa('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc8aa('0x4')](0x2)[_0xc8aa('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xc8aa('0x6')]},'dialTimezone':{'type':Sequelize[_0xc8aa('0x2')]},'utcOffset':{'type':Sequelize[_0xc8aa('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index dd0d2f1..a4ef880 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index bb9996d..de836f7 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 _0xbab6=['save','emit','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x2b5f83,_0x1e7376){var _0x46f60d=function(_0x33e28b){while(--_0x33e28b){_0x2b5f83['push'](_0x2b5f83['shift']());}};_0x46f60d(++_0x1e7376);}(_0xbab6,0x11c));var _0x6bab=function(_0x6bf3dd,_0x57c45d){_0x6bf3dd=_0x6bf3dd-0x0;var _0x494e6d=_0xbab6[_0x6bf3dd];return _0x494e6d;};'use strict';var EventEmitter=require(_0x6bab('0x0'));var CmContact=require(_0x6bab('0x1'))['db'][_0x6bab('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6bab('0x3')](0x0);var events={'afterCreate':_0x6bab('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x56918b){return function(_0x2409f5,_0x56ac83,_0x4bb083){CmContactEvents['emit'](_0x56918b+':'+_0x2409f5['id'],_0x2409f5);CmContactEvents[_0x6bab('0x5')](_0x56918b,_0x2409f5);_0x4bb083(null);};}for(var e in events){if(events[_0x6bab('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x6bab('0x7')]=CmContactEvents; \ No newline at end of file +var _0x0b53=['hook','exports','events','../../mysqldb','CmContact','setMaxListeners','update','remove','emit'];(function(_0x7a639,_0x16ffbf){var _0x4a4b80=function(_0x6cbf15){while(--_0x6cbf15){_0x7a639['push'](_0x7a639['shift']());}};_0x4a4b80(++_0x16ffbf);}(_0x0b53,0xad));var _0x30b5=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x0b53[_0x4fc9e6];return _0x551d28;};'use strict';var EventEmitter=require(_0x30b5('0x0'));var CmContact=require(_0x30b5('0x1'))['db'][_0x30b5('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x30b5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x30b5('0x4'),'afterDestroy':_0x30b5('0x5')};function emitEvent(_0x1a6004){return function(_0x571b94,_0xa58549,_0x521776){CmContactEvents['emit'](_0x1a6004+':'+_0x571b94['id'],_0x571b94);CmContactEvents[_0x30b5('0x6')](_0x1a6004,_0x571b94);_0x521776(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x30b5('0x7')](e,emitEvent(event));}}module[_0x30b5('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index cab3c99..5774c3a 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 _0x1f03=['destroy','ContactId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','api','bluebird','request-promise','path','rimraf','./cmContact.attributes','exports','define','CmContact','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','afterCreate','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','timezones','utcOffset','add','minutes','then','ret','CmHopper','phone','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','create','error','cmContact','inspect','Campaign','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','VoiceQueue','outbound','BlackLists','length','cmContact,\x20%s,\x20%s','CmHopperBlack','message','List\x20not\x20found','isEmpty'];(function(_0x1829f8,_0xe42e3e){var _0x4caa26=function(_0x515230){while(--_0x515230){_0x1829f8['push'](_0x1829f8['shift']());}};_0x4caa26(++_0xe42e3e);}(_0x1f03,0x98));var _0x31f0=function(_0x354de4,_0x268601){_0x354de4=_0x354de4-0x0;var _0x141786=_0x1f03[_0x354de4];return _0x141786;};'use strict';var _=require(_0x31f0('0x0'));var util=require(_0x31f0('0x1'));var logger=require('../../config/logger')(_0x31f0('0x2'));var moment=require('moment');var BPromise=require(_0x31f0('0x3'));var rp=require(_0x31f0('0x4'));var fs=require('fs');var path=require(_0x31f0('0x5'));var rimraf=require(_0x31f0('0x6'));var config=require('../../config/environment');var shared=require('../../config/environment/shared');var attributes=require(_0x31f0('0x7'));module[_0x31f0('0x8')]=function(_0x17e0d3,_0xb51a65){return _0x17e0d3[_0x31f0('0x9')](_0x31f0('0xa'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':'fti_cm_contacts','fields':['firstName',_0x31f0('0xb'),'phone','mobile',_0x31f0('0xc'),_0x31f0('0xd')],'type':_0x31f0('0xe')}],'timestamps':!![],'charset':_0x31f0('0xf'),'collate':_0x31f0('0x10'),'hooks':{'afterCreate':function(_0x46c57f,_0x4dc36e,_0x31ec3e){var _0x4ab890=_0x17e0d3[_0x31f0('0x11')];var _0x291fa9=_0x46c57f[_0x31f0('0x12')]({'plain':!![]});function _0x4b73cc(){return function(_0x270936){logger['error']('cmContact',_0x31f0('0x13'),util['inspect'](_0x270936,{'showHidden':![],'depth':null}));};}function _0x2cde08(_0x281c40,_0x56d1fb){var _0x3c2fd8=_0x56d1fb[_0x31f0('0x14')]?_0x56d1fb[_0x31f0('0x14')]:moment()[_0x31f0('0x15')](_0x31f0('0x16'));return new BPromise(function(_0x2cbe2f,_0x57e8db){if(_[_0x31f0('0x17')](_0x56d1fb[_0x31f0('0x18')])){_0x2cbe2f({'ret':_0x3c2fd8});}else{_0x4ab890['VoiceQueue'][_0x31f0('0x19')]({'where':{'id':_0x281c40['id']}})['then'](function(_0x5c0ae7){if(!_[_0x31f0('0x17')](_0x5c0ae7)){var _0x136ccd=_0x5c0ae7[_0x31f0('0x18')];if(!_[_0x31f0('0x17')](_0x136ccd)){var _0x267966=shared[_0x31f0('0x1a')];var _0x3412a8=_0x267966[_0x136ccd];var _0x4623a9=_0x267966[_0x56d1fb[_0x31f0('0x18')]];if(!_['isNil'](_0x3412a8)&&!_[_0x31f0('0x17')](_0x4623a9)){var _0x21bfef=_0x3412a8[_0x31f0('0x1b')]-_0x4623a9['utcOffset'];_0x3c2fd8=_0x56d1fb[_0x31f0('0x14')]?_0x56d1fb[_0x31f0('0x14')]:moment();var _0x4e8a19=moment(_0x3c2fd8)[_0x31f0('0x1c')](_0x21bfef,_0x31f0('0x1d'));_0x2cbe2f({'ret':_0x4e8a19[_0x31f0('0x15')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x2cbe2f({'ret':_0x3c2fd8});}else _0x2cbe2f({'ret':_0x3c2fd8});}else{_0x2cbe2f({'ret':_0x3c2fd8});}});}});return 0xa;}var _0x47363a=function(_0x5144e5){return new BPromise(function(_0xb5591c,_0x1916ba){_0x2cde08(_0x5144e5,_0x291fa9)[_0x31f0('0x1e')](function(_0xdb276){_0x291fa9[_0x31f0('0x14')]=_0xdb276[_0x31f0('0x1f')];_0x4ab890[_0x31f0('0x20')]['findOne']({'where':{'phone':_0x291fa9[_0x31f0('0x21')],'VoiceQueueId':_0x5144e5['id']}})['then'](function(_0x393459){if(!_[_0x31f0('0x17')](_0x393459)){throw new Error('cmContact,\x20afterCreate\x20'+_0x291fa9[_0x31f0('0x21')]+_0x31f0('0x22')+_0x5144e5['id']);}return _0x4ab890[_0x31f0('0x20')]['create']({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9[_0x31f0('0x23')],'priority':_0x291fa9['priority']?_0x291fa9[_0x31f0('0x24')]:0x2,'scheduledat':_0x291fa9[_0x31f0('0x14')]?_0x291fa9['scheduledat']:moment()[_0x31f0('0x15')](_0x31f0('0x16')),'callback':_0x291fa9[_0x31f0('0x25')]?!![]:![],'callbackuniqueid':_0x291fa9[_0x31f0('0x25')]?_0x291fa9[_0x31f0('0x25')]:undefined,'callbackat':_0x291fa9[_0x31f0('0x25')]?moment()['format'](_0x31f0('0x16')):undefined,'VoiceQueueId':_0x5144e5['id']});})[_0x31f0('0x26')](function(_0x1f67dc){_0x1916ba(_0x1f67dc);});});});};var _0x4b261a=function(_0x2dec96){return new BPromise(function(_0x519095,_0xa320b){_0x2cde08(_0x2dec96,_0x291fa9)['then'](function(_0x2df7ba){_0x291fa9[_0x31f0('0x14')]=_0x2df7ba['ret'];_0x4ab890[_0x31f0('0x20')][_0x31f0('0x19')]({'where':{'phone':_0x291fa9['phone'],'VoiceQueueId':_0x2dec96['id']}})[_0x31f0('0x1e')](function(_0x807aeb){if(!_[_0x31f0('0x17')](_0x807aeb)){throw new Error(_0x31f0('0x27')+_0x291fa9[_0x31f0('0x21')]+_0x31f0('0x28')+_0x2dec96['id']);}return _0x4ab890['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x291fa9[_0x31f0('0x21')],'VoiceQueueId':_0x2dec96['id']}});})[_0x31f0('0x1e')](function(_0x36ad56){if(!_[_0x31f0('0x17')](_0x36ad56)){throw new Error(_0x31f0('0x29')+_0x291fa9[_0x31f0('0x21')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x2dec96['id']);}return _0x4ab890[_0x31f0('0x20')][_0x31f0('0x2a')]({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9['ListId'],'priority':_0x291fa9[_0x31f0('0x24')]?_0x291fa9[_0x31f0('0x24')]:0x2,'scheduledat':_0x291fa9[_0x31f0('0x14')]?_0x291fa9['scheduledat']:moment()[_0x31f0('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x291fa9[_0x31f0('0x25')]?!![]:![],'callbackuniqueid':_0x291fa9[_0x31f0('0x25')]?_0x291fa9[_0x31f0('0x25')]:undefined,'callbackat':_0x291fa9[_0x31f0('0x25')]?moment()[_0x31f0('0x15')](_0x31f0('0x16')):undefined,'VoiceQueueId':_0x2dec96['id']});})[_0x31f0('0x26')](function(_0x4cb0c0){_0xa320b(_0x4cb0c0);});});});};function _0x43fc3b(){return function(_0x2d1439){logger[_0x31f0('0x2b')](_0x31f0('0x2c'),_0x31f0('0x13'),util[_0x31f0('0x2d')](_0x2d1439,{'showHidden':![],'depth':null}));};}function _0x439b3a(_0x48d5ba,_0x16ed65){var _0x210bf6=_0x16ed65[_0x31f0('0x14')]?_0x16ed65['scheduledat']:moment()['format'](_0x31f0('0x16'));return new BPromise(function(_0x136a57,_0xdd8ab9){if(_[_0x31f0('0x17')](_0x16ed65[_0x31f0('0x18')])){_0x136a57({'ret':_0x210bf6});}else{_0x4ab890[_0x31f0('0x2e')][_0x31f0('0x19')]({'where':{'id':_0x48d5ba['id']}})[_0x31f0('0x1e')](function(_0x293dbc){if(!_['isNil'](_0x293dbc)){var _0xddf243=_0x293dbc['dialTimezone'];if(!_[_0x31f0('0x17')](_0xddf243)){var _0x53eec8=shared[_0x31f0('0x1a')];var _0x17adf8=_0x53eec8[_0xddf243];var _0x197ac6=_0x53eec8[_0x16ed65[_0x31f0('0x18')]];if(!_[_0x31f0('0x17')](_0x17adf8)&&!_['isNil'](_0x197ac6)){var _0x59b3a3=_0x17adf8[_0x31f0('0x1b')]-_0x197ac6[_0x31f0('0x1b')];_0x210bf6=_0x16ed65[_0x31f0('0x14')]?_0x16ed65['scheduledat']:moment();var _0xde3efd=moment(_0x210bf6)[_0x31f0('0x1c')](_0x59b3a3,_0x31f0('0x1d'));_0x136a57({'ret':_0xde3efd[_0x31f0('0x15')](_0x31f0('0x16'))});}else _0x136a57({'ret':_0x210bf6});}else _0x136a57({'ret':_0x210bf6});}else{_0x136a57({'ret':_0x210bf6});}});}});return 0xa;}var _0x2ad0ff=function(_0x42b366){return new BPromise(function(_0x7a7b14,_0xa714cd){_0x439b3a(_0x42b366,_0x291fa9)[_0x31f0('0x1e')](function(_0x5b6c47){_0x291fa9[_0x31f0('0x14')]=_0x5b6c47[_0x31f0('0x1f')];_0x4ab890[_0x31f0('0x20')]['findOne']({'where':{'phone':_0x291fa9['phone'],'CampaignId':_0x42b366['id']}})[_0x31f0('0x1e')](function(_0x204148){if(!_[_0x31f0('0x17')](_0x204148)){throw new Error(_0x31f0('0x27')+_0x291fa9[_0x31f0('0x21')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x42b366['id']);}return _0x4ab890[_0x31f0('0x20')][_0x31f0('0x2a')]({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9[_0x31f0('0x23')],'priority':_0x291fa9['priority']?_0x291fa9[_0x31f0('0x24')]:0x2,'scheduledat':_0x291fa9[_0x31f0('0x14')]?_0x291fa9[_0x31f0('0x14')]:moment()['format'](_0x31f0('0x16')),'callback':_0x291fa9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x291fa9['callbackUniqueid']?_0x291fa9['callbackUniqueid']:undefined,'callbackat':_0x291fa9[_0x31f0('0x25')]?moment()[_0x31f0('0x15')](_0x31f0('0x16')):undefined,'CampaignId':_0x42b366['id']});})[_0x31f0('0x26')](function(_0x35ec43){_0xa714cd(_0x35ec43);});});});};var _0x3ebc0d=function(_0x55ccd3){return new BPromise(function(_0x4894fe,_0x25e3ba){_0x439b3a(_0x55ccd3,_0x291fa9)[_0x31f0('0x1e')](function(_0x12a044){_0x291fa9[_0x31f0('0x14')]=_0x12a044[_0x31f0('0x1f')];_0x4ab890[_0x31f0('0x20')][_0x31f0('0x19')]({'where':{'phone':_0x291fa9[_0x31f0('0x21')],'CampaignId':_0x55ccd3['id']}})[_0x31f0('0x1e')](function(_0x19f97a){if(!_['isNil'](_0x19f97a)){throw new Error(_0x31f0('0x27')+_0x291fa9[_0x31f0('0x21')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x55ccd3['id']);}return _0x4ab890[_0x31f0('0x2f')][_0x31f0('0x19')]({'where':{'calleridnum':_0x291fa9[_0x31f0('0x21')],'CampaignId':_0x55ccd3['id']}});})[_0x31f0('0x1e')](function(_0x4b0523){if(!_['isNil'](_0x4b0523)){throw new Error(_0x31f0('0x29')+_0x291fa9[_0x31f0('0x21')]+_0x31f0('0x30')+_0x55ccd3['id']);}return _0x4ab890[_0x31f0('0x20')][_0x31f0('0x2a')]({'phone':_0x291fa9['phone'],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9[_0x31f0('0x23')],'priority':_0x291fa9[_0x31f0('0x24')]?_0x291fa9[_0x31f0('0x24')]:0x2,'scheduledat':_0x291fa9['scheduledat']?_0x291fa9[_0x31f0('0x14')]:moment()[_0x31f0('0x15')](_0x31f0('0x16')),'callback':_0x291fa9['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x291fa9[_0x31f0('0x25')]?_0x291fa9[_0x31f0('0x25')]:undefined,'callbackat':_0x291fa9['callbackUniqueid']?moment()[_0x31f0('0x15')](_0x31f0('0x16')):undefined,'CampaignId':_0x55ccd3['id']});})[_0x31f0('0x26')](function(_0x160cee){_0x25e3ba(_0x160cee);});});});};if(_0x291fa9[_0x31f0('0x23')]){_0x4ab890['VoiceQueue'][_0x31f0('0x31')]({'where':{'type':'outbound'},'attributes':['id',_0x31f0('0x32'),_0x31f0('0x18')],'include':[{'model':_0x4ab890[_0x31f0('0x33')],'as':_0x31f0('0x34'),'where':{'id':_0x291fa9['ListId']}}]})[_0x31f0('0x1e')](function(_0xc0bdf9){if(_0xc0bdf9){var _0x50d201=[];for(var _0x557fa7=0x0,_0x19471b;_0x557fa7<_0xc0bdf9['length'];_0x557fa7+=0x1){_0x19471b=_0xc0bdf9[_0x557fa7][_0x31f0('0x12')]({'plain':!![]});switch(_0x19471b['dialCheckDuplicateType']){case _0x31f0('0x35'):_0x4b261a(_0x19471b)[_0x31f0('0x26')](_0x4b73cc());break;case _0x31f0('0x36'):_0x47363a(_0x19471b)[_0x31f0('0x26')](_0x4b73cc());break;default:_0x439b3a(_0x19471b,_0x291fa9)[_0x31f0('0x1e')](function(_0x19007a){_0x291fa9[_0x31f0('0x14')]=_0x19007a[_0x31f0('0x1f')];_0x4ab890[_0x31f0('0x20')][_0x31f0('0x2a')]({'phone':_0x291fa9['phone'],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9['ListId'],'scheduledat':_0x291fa9['scheduledat']?_0x291fa9['scheduledat']:moment()[_0x31f0('0x15')](_0x31f0('0x16')),'priority':_0x291fa9['priority']?_0x291fa9[_0x31f0('0x24')]:0x2,'callback':_0x291fa9[_0x31f0('0x25')]?!![]:![],'callbackuniqueid':_0x291fa9[_0x31f0('0x25')]?_0x291fa9[_0x31f0('0x25')]:undefined,'callbackat':_0x291fa9[_0x31f0('0x25')]?moment()['format'](_0x31f0('0x16')):undefined,'VoiceQueueId':_0x19471b['id']})[_0x31f0('0x26')](_0x4b73cc());});}}}})[_0x31f0('0x1e')](function(){return _0x4ab890[_0x31f0('0x37')]['findAll']({'where':{'type':_0x31f0('0x38')},'attributes':['id'],'include':[{'model':_0x4ab890[_0x31f0('0x33')],'as':_0x31f0('0x39'),'where':{'id':_0x291fa9[_0x31f0('0x23')]}}]})[_0x31f0('0x1e')](function(_0x150585){if(_0x150585){var _0x22d012=[];for(var _0xbfee10=0x0,_0x45e0ca;_0xbfee10<_0x150585[_0x31f0('0x3a')];_0xbfee10+=0x1){_0x45e0ca=_0x150585[_0xbfee10][_0x31f0('0x12')]({'plain':!![]});_0x4ab890['CmHopperBlack'][_0x31f0('0x2a')]({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9[_0x31f0('0x23')],'VoiceQueueId':_0x45e0ca['id']})[_0x31f0('0x26')](function(_0x45b55b){logger[_0x31f0('0x2b')](_0x31f0('0x3b'),_0x31f0('0x13'),_0x45b55b['message']);});}}});})[_0x31f0('0x1e')](function(){return _0x4ab890[_0x31f0('0x2e')][_0x31f0('0x31')]({'attributes':['id',_0x31f0('0x32'),_0x31f0('0x18')],'include':[{'model':_0x4ab890[_0x31f0('0x33')],'as':'Lists','where':{'id':_0x291fa9[_0x31f0('0x23')]}}]})[_0x31f0('0x1e')](function(_0x538d01){if(_0x538d01){var _0x67c91a=[];for(var _0x3ef9eb=0x0,_0x93d16d;_0x3ef9eb<_0x538d01['length'];_0x3ef9eb+=0x1){_0x93d16d=_0x538d01[_0x3ef9eb][_0x31f0('0x12')]({'plain':!![]});switch(_0x93d16d[_0x31f0('0x32')]){case _0x31f0('0x35'):_0x3ebc0d(_0x93d16d)[_0x31f0('0x26')](_0x43fc3b());break;case'onlyIfOpen':_0x2ad0ff(_0x93d16d)[_0x31f0('0x26')](_0x43fc3b());break;default:_0x4ab890['CmHopper']['create']({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9[_0x31f0('0x23')],'scheduledat':_0x291fa9[_0x31f0('0x14')]?_0x291fa9[_0x31f0('0x14')]:moment()[_0x31f0('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x291fa9['priority']?_0x291fa9['priority']:0x2,'callback':_0x291fa9[_0x31f0('0x25')]?!![]:![],'callbackuniqueid':_0x291fa9[_0x31f0('0x25')]?_0x291fa9[_0x31f0('0x25')]:undefined,'callbackat':_0x291fa9[_0x31f0('0x25')]?moment()[_0x31f0('0x15')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x93d16d['id']})[_0x31f0('0x26')](_0x43fc3b());}}}});})[_0x31f0('0x1e')](function(){return _0x4ab890[_0x31f0('0x2e')]['findAll']({'attributes':['id'],'include':[{'model':_0x4ab890['CmList'],'as':_0x31f0('0x39'),'where':{'id':_0x291fa9[_0x31f0('0x23')]}}]})[_0x31f0('0x1e')](function(_0x3db18d){if(_0x3db18d){var _0xc9edac=[];for(var _0x47a05d=0x0,_0x5c3986;_0x47a05d<_0x3db18d[_0x31f0('0x3a')];_0x47a05d+=0x1){_0x5c3986=_0x3db18d[_0x47a05d]['get']({'plain':!![]});_0x4ab890[_0x31f0('0x3c')][_0x31f0('0x2a')]({'phone':_0x291fa9[_0x31f0('0x21')],'ContactId':_0x291fa9['id'],'ListId':_0x291fa9['ListId'],'CampaignId':_0x5c3986['id']})[_0x31f0('0x26')](function(_0x312fd5){logger[_0x31f0('0x2b')](_0x31f0('0x3b'),_0x31f0('0x13'),_0x312fd5[_0x31f0('0x3d')]);});}}});})['then'](function(){_0x31ec3e();})[_0x31f0('0x26')](function(_0x2fd6ef){logger[_0x31f0('0x2b')](_0x31f0('0x3b'),_0x31f0('0x13'),_0x2fd6ef[_0x31f0('0x3d')]);_0x31ec3e(_0x2fd6ef);});}else{_0x31ec3e(new Error(_0x31f0('0x3e')));}},'afterDestroy':function(_0x3e0817,_0x35534d,_0x18c250){var _0x13ec84=_0x17e0d3[_0x31f0('0x11')];var _0x2b87e8=_0x3e0817[_0x31f0('0x12')]({'plain':!![]});return _0x13ec84[_0x31f0('0x20')]['findAll']({'raw':!![],'where':{'ListId':_0x2b87e8[_0x31f0('0x23')],'ContactId':_0x2b87e8['id']}})[_0x31f0('0x1e')](function(_0x1ef37c){if(!_[_0x31f0('0x3f')](_0x1ef37c)){var _0x325639=[];for(var _0x8aa62a=0x0;_0x8aa62a<_0x1ef37c[_0x31f0('0x3a')];_0x8aa62a+=0x1){var _0x382364=_0x13ec84['CmHopper'][_0x31f0('0x40')]({'where':{'ListId':_0x1ef37c[_0x8aa62a][_0x31f0('0x23')],'ContactId':_0x1ef37c[_0x8aa62a][_0x31f0('0x41')],'VoiceQueueId':_0x1ef37c[_0x8aa62a]['VoiceQueueId'],'CampaignId':_0x1ef37c[_0x8aa62a][_0x31f0('0x42')]}});_0x325639[_0x31f0('0x43')](_0x382364);}return BPromise[_0x31f0('0x44')](_0x325639);}})[_0x31f0('0x1e')](function(_0x4e1f6c){logger[_0x31f0('0x45')](_0x31f0('0x46'),util['inspect'](_0x4e1f6c,{'showHidden':![],'depth':null}));_0x18c250();})[_0x31f0('0x26')](function(_0x5d7673){logger[_0x31f0('0x2b')](_0x31f0('0x47'),util[_0x31f0('0x2d')](_0x5d7673,{'showHidden':![],'depth':null}));_0x18c250(_0x5d7673);});}}});}; \ No newline at end of file +var _0xe703=['scheduledat','add','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','catch','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','CmHopper','utcOffset','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','findAll','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','BlackLists','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment/shared','./cmContact.attributes','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','models','get','error','cmContact','afterCreate','inspect','format','YYYY-MM-DD\x20HH:mm:ss','VoiceQueue','findOne','isNil','timezones','dialTimezone'];(function(_0x510794,_0x120e85){var _0x3bd818=function(_0x34fab5){while(--_0x34fab5){_0x510794['push'](_0x510794['shift']());}};_0x3bd818(++_0x120e85);}(_0xe703,0x1e5));var _0x3e70=function(_0x5ec4eb,_0x2dc478){_0x5ec4eb=_0x5ec4eb-0x0;var _0x1f3253=_0xe703[_0x5ec4eb];return _0x1f3253;};'use strict';var _=require(_0x3e70('0x0'));var util=require(_0x3e70('0x1'));var logger=require(_0x3e70('0x2'))(_0x3e70('0x3'));var moment=require(_0x3e70('0x4'));var BPromise=require(_0x3e70('0x5'));var rp=require(_0x3e70('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0x3e70('0x7'));var attributes=require(_0x3e70('0x8'));module['exports']=function(_0x5888e4,_0x3f5ced){return _0x5888e4[_0x3e70('0x9')](_0x3e70('0xa'),attributes,{'tableName':_0x3e70('0xb'),'paranoid':!![],'indexes':[{'name':_0x3e70('0xc'),'fields':[_0x3e70('0xc')]},{'name':_0x3e70('0xd'),'fields':[_0x3e70('0xe'),_0x3e70('0xf'),_0x3e70('0xc'),_0x3e70('0x10'),_0x3e70('0x11'),_0x3e70('0x12')],'type':_0x3e70('0x13')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x1cf302,_0x5947ac,_0x58ad60){var _0x51dd5e=_0x5888e4[_0x3e70('0x14')];var _0x299fc3=_0x1cf302[_0x3e70('0x15')]({'plain':!![]});function _0x30fed2(){return function(_0x2a49f0){logger[_0x3e70('0x16')](_0x3e70('0x17'),_0x3e70('0x18'),util[_0x3e70('0x19')](_0x2a49f0,{'showHidden':![],'depth':null}));};}function _0x356d2b(_0x28d462,_0x37b3d2){var _0x47600f=_0x37b3d2['scheduledat']?_0x37b3d2['scheduledat']:moment()[_0x3e70('0x1a')](_0x3e70('0x1b'));return new BPromise(function(_0x1cb08f,_0xa663ce){if(_['isNil'](_0x37b3d2['dialTimezone'])){_0x1cb08f({'ret':_0x47600f});}else{_0x51dd5e[_0x3e70('0x1c')][_0x3e70('0x1d')]({'where':{'id':_0x28d462['id']}})['then'](function(_0x23c7e9){if(!_[_0x3e70('0x1e')](_0x23c7e9)){var _0x3677e2=_0x23c7e9['dialTimezone'];if(!_[_0x3e70('0x1e')](_0x3677e2)){var _0x4d7a41=shared[_0x3e70('0x1f')];var _0x3558dd=_0x4d7a41[_0x3677e2];var _0x2122dd=_0x4d7a41[_0x37b3d2[_0x3e70('0x20')]];if(!_[_0x3e70('0x1e')](_0x3558dd)&&!_[_0x3e70('0x1e')](_0x2122dd)){var _0x1f311f=_0x3558dd['utcOffset']-_0x2122dd['utcOffset'];_0x47600f=_0x37b3d2['scheduledat']?_0x37b3d2[_0x3e70('0x21')]:moment();var _0xd834a7=moment(_0x47600f)[_0x3e70('0x22')](_0x1f311f,_0x3e70('0x23'));_0x1cb08f({'ret':_0xd834a7['format'](_0x3e70('0x1b'))});}else _0x1cb08f({'ret':_0x47600f});}else _0x1cb08f({'ret':_0x47600f});}else{_0x1cb08f({'ret':_0x47600f});}});}});return 0xa;}var _0x11f902=function(_0x299bea){return new BPromise(function(_0xdb7672,_0x589fee){_0x356d2b(_0x299bea,_0x299fc3)['then'](function(_0x261dd7){_0x299fc3[_0x3e70('0x21')]=_0x261dd7[_0x3e70('0x24')];_0x51dd5e['CmHopper'][_0x3e70('0x1d')]({'where':{'phone':_0x299fc3[_0x3e70('0xc')],'VoiceQueueId':_0x299bea['id']}})['then'](function(_0x47e029){if(!_[_0x3e70('0x1e')](_0x47e029)){throw new Error(_0x3e70('0x25')+_0x299fc3[_0x3e70('0xc')]+_0x3e70('0x26')+_0x299bea['id']);}return _0x51dd5e['CmHopper'][_0x3e70('0x27')]({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'scheduledat':_0x299fc3[_0x3e70('0x21')]?_0x299fc3[_0x3e70('0x21')]:moment()[_0x3e70('0x1a')](_0x3e70('0x1b')),'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3[_0x3e70('0x2a')]?_0x299fc3['callbackUniqueid']:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()[_0x3e70('0x1a')](_0x3e70('0x1b')):undefined,'VoiceQueueId':_0x299bea['id']});})[_0x3e70('0x2b')](function(_0x6125f9){_0x589fee(_0x6125f9);});});});};var _0x3ea460=function(_0xf858bd){return new BPromise(function(_0x5d2ba9,_0x4062de){_0x356d2b(_0xf858bd,_0x299fc3)[_0x3e70('0x2c')](function(_0x208f27){_0x299fc3['scheduledat']=_0x208f27[_0x3e70('0x24')];_0x51dd5e['CmHopper'][_0x3e70('0x1d')]({'where':{'phone':_0x299fc3[_0x3e70('0xc')],'VoiceQueueId':_0xf858bd['id']}})['then'](function(_0x5908dc){if(!_[_0x3e70('0x1e')](_0x5908dc)){throw new Error(_0x3e70('0x25')+_0x299fc3[_0x3e70('0xc')]+_0x3e70('0x2d')+_0xf858bd['id']);}return _0x51dd5e['CmHopperFinal'][_0x3e70('0x1d')]({'where':{'calleridnum':_0x299fc3[_0x3e70('0xc')],'VoiceQueueId':_0xf858bd['id']}});})[_0x3e70('0x2c')](function(_0x5bbaec){if(!_[_0x3e70('0x1e')](_0x5bbaec)){throw new Error(_0x3e70('0x2e')+_0x299fc3[_0x3e70('0xc')]+_0x3e70('0x2f')+_0xf858bd['id']);}return _0x51dd5e[_0x3e70('0x30')][_0x3e70('0x27')]({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'scheduledat':_0x299fc3[_0x3e70('0x21')]?_0x299fc3['scheduledat']:moment()[_0x3e70('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3[_0x3e70('0x2a')]?_0x299fc3[_0x3e70('0x2a')]:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()[_0x3e70('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xf858bd['id']});})[_0x3e70('0x2b')](function(_0x4d87a7){_0x4062de(_0x4d87a7);});});});};function _0x2f1ba3(){return function(_0x3b24e8){logger[_0x3e70('0x16')](_0x3e70('0x17'),_0x3e70('0x18'),util['inspect'](_0x3b24e8,{'showHidden':![],'depth':null}));};}function _0xb67259(_0x1ad71b,_0x1ec8c6){var _0x9ca542=_0x1ec8c6[_0x3e70('0x21')]?_0x1ec8c6[_0x3e70('0x21')]:moment()[_0x3e70('0x1a')](_0x3e70('0x1b'));return new BPromise(function(_0x519147,_0x35b185){if(_[_0x3e70('0x1e')](_0x1ec8c6[_0x3e70('0x20')])){_0x519147({'ret':_0x9ca542});}else{_0x51dd5e['Campaign']['findOne']({'where':{'id':_0x1ad71b['id']}})[_0x3e70('0x2c')](function(_0x47d94a){if(!_[_0x3e70('0x1e')](_0x47d94a)){var _0x19f4ef=_0x47d94a['dialTimezone'];if(!_[_0x3e70('0x1e')](_0x19f4ef)){var _0x218c32=shared[_0x3e70('0x1f')];var _0x44a3a1=_0x218c32[_0x19f4ef];var _0x5554e5=_0x218c32[_0x1ec8c6[_0x3e70('0x20')]];if(!_[_0x3e70('0x1e')](_0x44a3a1)&&!_[_0x3e70('0x1e')](_0x5554e5)){var _0x4b595b=_0x44a3a1['utcOffset']-_0x5554e5[_0x3e70('0x31')];_0x9ca542=_0x1ec8c6['scheduledat']?_0x1ec8c6[_0x3e70('0x21')]:moment();var _0x430de3=moment(_0x9ca542)[_0x3e70('0x22')](_0x4b595b,_0x3e70('0x23'));_0x519147({'ret':_0x430de3[_0x3e70('0x1a')](_0x3e70('0x1b'))});}else _0x519147({'ret':_0x9ca542});}else _0x519147({'ret':_0x9ca542});}else{_0x519147({'ret':_0x9ca542});}});}});return 0xa;}var _0x95492d=function(_0x5dd018){return new BPromise(function(_0x5a5478,_0x317ac1){_0xb67259(_0x5dd018,_0x299fc3)['then'](function(_0x1374c7){_0x299fc3[_0x3e70('0x21')]=_0x1374c7[_0x3e70('0x24')];_0x51dd5e[_0x3e70('0x30')][_0x3e70('0x1d')]({'where':{'phone':_0x299fc3[_0x3e70('0xc')],'CampaignId':_0x5dd018['id']}})[_0x3e70('0x2c')](function(_0x25a495){if(!_[_0x3e70('0x1e')](_0x25a495)){throw new Error(_0x3e70('0x25')+_0x299fc3['phone']+_0x3e70('0x32')+_0x5dd018['id']);}return _0x51dd5e[_0x3e70('0x30')]['create']({'phone':_0x299fc3['phone'],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'scheduledat':_0x299fc3[_0x3e70('0x21')]?_0x299fc3['scheduledat']:moment()[_0x3e70('0x1a')](_0x3e70('0x1b')),'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3['callbackUniqueid']?_0x299fc3[_0x3e70('0x2a')]:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()[_0x3e70('0x1a')](_0x3e70('0x1b')):undefined,'CampaignId':_0x5dd018['id']});})[_0x3e70('0x2b')](function(_0x139555){_0x317ac1(_0x139555);});});});};var _0x36319d=function(_0x55041f){return new BPromise(function(_0x43adb4,_0x1fe58f){_0xb67259(_0x55041f,_0x299fc3)[_0x3e70('0x2c')](function(_0x47e017){_0x299fc3[_0x3e70('0x21')]=_0x47e017[_0x3e70('0x24')];_0x51dd5e['CmHopper'][_0x3e70('0x1d')]({'where':{'phone':_0x299fc3[_0x3e70('0xc')],'CampaignId':_0x55041f['id']}})[_0x3e70('0x2c')](function(_0x387ccb){if(!_[_0x3e70('0x1e')](_0x387ccb)){throw new Error(_0x3e70('0x25')+_0x299fc3[_0x3e70('0xc')]+_0x3e70('0x33')+_0x55041f['id']);}return _0x51dd5e[_0x3e70('0x34')]['findOne']({'where':{'calleridnum':_0x299fc3[_0x3e70('0xc')],'CampaignId':_0x55041f['id']}});})[_0x3e70('0x2c')](function(_0x5cb04f){if(!_['isNil'](_0x5cb04f)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x299fc3[_0x3e70('0xc')]+_0x3e70('0x35')+_0x55041f['id']);}return _0x51dd5e['CmHopper'][_0x3e70('0x27')]({'phone':_0x299fc3['phone'],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'scheduledat':_0x299fc3[_0x3e70('0x21')]?_0x299fc3[_0x3e70('0x21')]:moment()[_0x3e70('0x1a')](_0x3e70('0x1b')),'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3['callbackUniqueid']?_0x299fc3[_0x3e70('0x2a')]:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()[_0x3e70('0x1a')](_0x3e70('0x1b')):undefined,'CampaignId':_0x55041f['id']});})[_0x3e70('0x2b')](function(_0x1953e1){_0x1fe58f(_0x1953e1);});});});};if(_0x299fc3[_0x3e70('0x28')]){_0x51dd5e[_0x3e70('0x1c')]['findAll']({'where':{'type':_0x3e70('0x36')},'attributes':['id',_0x3e70('0x37'),'dialTimezone'],'include':[{'model':_0x51dd5e[_0x3e70('0x38')],'as':_0x3e70('0x39'),'where':{'id':_0x299fc3['ListId']}}]})[_0x3e70('0x2c')](function(_0x240efa){if(_0x240efa){var _0x30162f=[];for(var _0x428c73=0x0,_0x5d6209;_0x428c73<_0x240efa[_0x3e70('0x3a')];_0x428c73+=0x1){_0x5d6209=_0x240efa[_0x428c73][_0x3e70('0x15')]({'plain':!![]});switch(_0x5d6209[_0x3e70('0x37')]){case _0x3e70('0x3b'):_0x3ea460(_0x5d6209)[_0x3e70('0x2b')](_0x30fed2());break;case _0x3e70('0x3c'):_0x11f902(_0x5d6209)['catch'](_0x30fed2());break;default:_0xb67259(_0x5d6209,_0x299fc3)['then'](function(_0x363170){_0x299fc3[_0x3e70('0x21')]=_0x363170['ret'];_0x51dd5e['CmHopper'][_0x3e70('0x27')]({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'scheduledat':_0x299fc3['scheduledat']?_0x299fc3['scheduledat']:moment()[_0x3e70('0x1a')](_0x3e70('0x1b')),'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3[_0x3e70('0x2a')]?_0x299fc3[_0x3e70('0x2a')]:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()[_0x3e70('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5d6209['id']})['catch'](_0x30fed2());});}}}})[_0x3e70('0x2c')](function(){return _0x51dd5e['VoiceQueue'][_0x3e70('0x3d')]({'where':{'type':_0x3e70('0x36')},'attributes':['id'],'include':[{'model':_0x51dd5e[_0x3e70('0x38')],'as':'BlackLists','where':{'id':_0x299fc3[_0x3e70('0x28')]}}]})[_0x3e70('0x2c')](function(_0x4cd132){if(_0x4cd132){var _0x297c69=[];for(var _0xf38e94=0x0,_0x374d53;_0xf38e94<_0x4cd132[_0x3e70('0x3a')];_0xf38e94+=0x1){_0x374d53=_0x4cd132[_0xf38e94][_0x3e70('0x15')]({'plain':!![]});_0x51dd5e[_0x3e70('0x3e')][_0x3e70('0x27')]({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'VoiceQueueId':_0x374d53['id']})[_0x3e70('0x2b')](function(_0x1d3656){logger[_0x3e70('0x16')](_0x3e70('0x3f'),_0x3e70('0x18'),_0x1d3656[_0x3e70('0x40')]);});}}});})[_0x3e70('0x2c')](function(){return _0x51dd5e[_0x3e70('0x41')]['findAll']({'attributes':['id',_0x3e70('0x37'),_0x3e70('0x20')],'include':[{'model':_0x51dd5e['CmList'],'as':_0x3e70('0x39'),'where':{'id':_0x299fc3[_0x3e70('0x28')]}}]})[_0x3e70('0x2c')](function(_0x4d5ebe){if(_0x4d5ebe){var _0x4fa92e=[];for(var _0x40aea3=0x0,_0x22f191;_0x40aea3<_0x4d5ebe['length'];_0x40aea3+=0x1){_0x22f191=_0x4d5ebe[_0x40aea3][_0x3e70('0x15')]({'plain':!![]});switch(_0x22f191['dialCheckDuplicateType']){case'always':_0x36319d(_0x22f191)['catch'](_0x2f1ba3());break;case'onlyIfOpen':_0x95492d(_0x22f191)[_0x3e70('0x2b')](_0x2f1ba3());break;default:_0x51dd5e['CmHopper']['create']({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'scheduledat':_0x299fc3[_0x3e70('0x21')]?_0x299fc3[_0x3e70('0x21')]:moment()[_0x3e70('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x299fc3[_0x3e70('0x29')]?_0x299fc3[_0x3e70('0x29')]:0x2,'callback':_0x299fc3[_0x3e70('0x2a')]?!![]:![],'callbackuniqueid':_0x299fc3[_0x3e70('0x2a')]?_0x299fc3[_0x3e70('0x2a')]:undefined,'callbackat':_0x299fc3[_0x3e70('0x2a')]?moment()['format'](_0x3e70('0x1b')):undefined,'CampaignId':_0x22f191['id']})[_0x3e70('0x2b')](_0x2f1ba3());}}}});})[_0x3e70('0x2c')](function(){return _0x51dd5e[_0x3e70('0x41')][_0x3e70('0x3d')]({'attributes':['id'],'include':[{'model':_0x51dd5e[_0x3e70('0x38')],'as':_0x3e70('0x42'),'where':{'id':_0x299fc3[_0x3e70('0x28')]}}]})[_0x3e70('0x2c')](function(_0x58ecc7){if(_0x58ecc7){var _0x2e5440=[];for(var _0x10ba17=0x0,_0x2b2854;_0x10ba17<_0x58ecc7[_0x3e70('0x3a')];_0x10ba17+=0x1){_0x2b2854=_0x58ecc7[_0x10ba17][_0x3e70('0x15')]({'plain':!![]});_0x51dd5e[_0x3e70('0x3e')][_0x3e70('0x27')]({'phone':_0x299fc3[_0x3e70('0xc')],'ContactId':_0x299fc3['id'],'ListId':_0x299fc3[_0x3e70('0x28')],'CampaignId':_0x2b2854['id']})[_0x3e70('0x2b')](function(_0x2aa26a){logger[_0x3e70('0x16')]('cmContact,\x20%s,\x20%s',_0x3e70('0x18'),_0x2aa26a[_0x3e70('0x40')]);});}}});})['then'](function(){_0x58ad60();})[_0x3e70('0x2b')](function(_0x2ffc8d){logger[_0x3e70('0x16')]('cmContact,\x20%s,\x20%s',_0x3e70('0x18'),_0x2ffc8d[_0x3e70('0x40')]);_0x58ad60(_0x2ffc8d);});}else{_0x58ad60(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x4349ab,_0xf688fd,_0x2c8299){var _0x44747c=_0x5888e4['models'];var _0x4bd50d=_0x4349ab[_0x3e70('0x15')]({'plain':!![]});return _0x44747c[_0x3e70('0x30')][_0x3e70('0x3d')]({'raw':!![],'where':{'ListId':_0x4bd50d[_0x3e70('0x28')],'ContactId':_0x4bd50d['id']}})['then'](function(_0x4b7957){if(!_[_0x3e70('0x43')](_0x4b7957)){var _0x396b04=[];for(var _0x21bc88=0x0;_0x21bc88<_0x4b7957[_0x3e70('0x3a')];_0x21bc88+=0x1){var _0x9743bd=_0x44747c['CmHopper'][_0x3e70('0x44')]({'where':{'ListId':_0x4b7957[_0x21bc88][_0x3e70('0x28')],'ContactId':_0x4b7957[_0x21bc88][_0x3e70('0x45')],'VoiceQueueId':_0x4b7957[_0x21bc88][_0x3e70('0x46')],'CampaignId':_0x4b7957[_0x21bc88][_0x3e70('0x47')]}});_0x396b04['push'](_0x9743bd);}return BPromise[_0x3e70('0x48')](_0x396b04);}})['then'](function(_0x18e1c6){logger['info']('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x18e1c6,{'showHidden':![],'depth':null}));_0x2c8299();})[_0x3e70('0x2b')](function(_0x4edd94){logger['error'](_0x3e70('0x49'),util[_0x3e70('0x19')](_0x4edd94,{'showHidden':![],'depth':null}));_0x2c8299(_0x4edd94);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4c0d201..654962e 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x46f9b7,_0x37c6e0){var _0x452954=function(_0x40266c){while(--_0x40266c){_0x46f9b7['push'](_0x46f9b7['shift']());}};_0x452954(++_0x37c6e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 1861732..f340675 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 _0xaf5a=['exports','STRING','INTEGER','PHONE'];(function(_0x4564e6,_0x509b2c){var _0xc69df6=function(_0x198a96){while(--_0x198a96){_0x4564e6['push'](_0x4564e6['shift']());}};_0xc69df6(++_0x509b2c);}(_0xaf5a,0x144));var _0xaaf5=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xaf5a[_0x242a4f];return _0x122117;};'use strict';var Sequelize=require('sequelize');module[_0xaaf5('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xaaf5('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xaaf5('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xaaf5('0x1')],'defaultValue':_0xaaf5('0x3')},'OrderBy':{'type':Sequelize[_0xaaf5('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xaaf5('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xe6c1=['exports','INTEGER','STRING','PHONE'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x1e6c('0x0')]={'CmContactId':{'type':Sequelize[_0x1e6c('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1e6c('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x1e6c('0x3')},'OrderBy':{'type':Sequelize[_0x1e6c('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x1e6c('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 dc00e7c..2a877d6 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 _0x7fb8=['Content-Range','json','apply','reject','save','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmContactHasItem','includeAll','include','findAll','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7fb8,0x1eb));var _0x87fb=function(_0xf0c8a,_0x23c1ae){_0xf0c8a=_0xf0c8a-0x0;var _0x5c1be6=_0x7fb8[_0xf0c8a];return _0x5c1be6;};'use strict';var emlformat=require(_0x87fb('0x0'));var rimraf=require(_0x87fb('0x1'));var zipdir=require(_0x87fb('0x2'));var jsonpatch=require(_0x87fb('0x3'));var rp=require(_0x87fb('0x4'));var moment=require(_0x87fb('0x5'));var BPromise=require(_0x87fb('0x6'));var Mustache=require(_0x87fb('0x7'));var util=require(_0x87fb('0x8'));var path=require(_0x87fb('0x9'));var sox=require('sox');var csv=require(_0x87fb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87fb('0xb'));var _=require('lodash');var squel=require(_0x87fb('0xc'));var crypto=require(_0x87fb('0xd'));var jsforce=require(_0x87fb('0xe'));var deskjs=require(_0x87fb('0xf'));var toCsv=require(_0x87fb('0xa'));var querystring=require(_0x87fb('0x10'));var Papa=require(_0x87fb('0x11'));var Redis=require(_0x87fb('0x12'));var authService=require(_0x87fb('0x13'));var qs=require(_0x87fb('0x14'));var as=require(_0x87fb('0x15'));var hardwareService=require(_0x87fb('0x16'));var logger=require(_0x87fb('0x17'))(_0x87fb('0x18'));var utils=require(_0x87fb('0x19'));var config=require(_0x87fb('0x1a'));var licenseUtil=require(_0x87fb('0x1b'));var db=require(_0x87fb('0x1c'))['db'];function respondWithStatusCode(_0x571a7b,_0x35dcae){_0x35dcae=_0x35dcae||0xcc;return function(_0x18074f){if(_0x18074f){return _0x571a7b[_0x87fb('0x1d')](_0x35dcae);}return _0x571a7b[_0x87fb('0x1e')](_0x35dcae)[_0x87fb('0x1f')]();};}function respondWithResult(_0x3ceb30,_0x1101a3){_0x1101a3=_0x1101a3||0xc8;return function(_0x197fab){if(_0x197fab){return _0x3ceb30[_0x87fb('0x1e')](_0x1101a3)['json'](_0x197fab);}};}function respondWithFilteredResult(_0x166a1e,_0xdccd14){return function(_0x14bdc7){if(_0x14bdc7){var _0x76c85d=typeof _0xdccd14[_0x87fb('0x20')]===_0x87fb('0x21')&&typeof _0xdccd14[_0x87fb('0x22')]==='undefined';var _0x510f1f=_0x14bdc7[_0x87fb('0x23')];var _0x4395e0=_0x76c85d?0x0:_0xdccd14['offset'];var _0x144951=_0x76c85d?_0x14bdc7[_0x87fb('0x23')]:_0xdccd14['offset']+_0xdccd14[_0x87fb('0x22')];var _0x7edd8b;if(_0x144951>=_0x510f1f){_0x144951=_0x510f1f;_0x7edd8b=0xc8;}else{_0x7edd8b=0xce;}_0x166a1e[_0x87fb('0x1e')](_0x7edd8b);return _0x166a1e[_0x87fb('0x24')](_0x87fb('0x25'),_0x4395e0+'-'+_0x144951+'/'+_0x510f1f)[_0x87fb('0x26')](_0x14bdc7);}return null;};}function patchUpdates(_0xa88100){return function(_0x7e8dd2){try{jsonpatch[_0x87fb('0x27')](_0x7e8dd2,_0xa88100,!![]);}catch(_0x2a8922){return BPromise[_0x87fb('0x28')](_0x2a8922);}return _0x7e8dd2[_0x87fb('0x29')]();};}function saveUpdates(_0x1b09af,_0x52c428){return function(_0x50e7f5){if(_0x50e7f5){return _0x50e7f5['update'](_0x1b09af)[_0x87fb('0x2a')](function(_0x1fc0ff){return _0x1fc0ff;});}return null;};}function removeEntity(_0x4eea7e,_0x52500a){return function(_0x3bbc77){if(_0x3bbc77){return _0x3bbc77['destroy']()['then'](function(){var _0x1decf4=_0x3bbc77[_0x87fb('0x2b')]({'plain':!![]});var _0x1a94fb=_0x87fb('0x2c');return db[_0x87fb('0x2d')][_0x87fb('0x2e')]({'where':{'type':_0x1a94fb,'resourceId':_0x1decf4['id']}})['then'](function(){return _0x3bbc77;});})[_0x87fb('0x2a')](function(){_0x4eea7e[_0x87fb('0x1e')](0xcc)[_0x87fb('0x1f')]();});}};}function handleEntityNotFound(_0x14ca3a,_0xa3bd69){return function(_0x187f12){if(!_0x187f12){_0x14ca3a[_0x87fb('0x1d')](0x194);}return _0x187f12;};}function handleError(_0x54fa20,_0x19ec4f){_0x19ec4f=_0x19ec4f||0x1f4;return function(_0x1d1b1f){logger[_0x87fb('0x2f')](_0x1d1b1f[_0x87fb('0x30')]);if(_0x1d1b1f[_0x87fb('0x31')]){delete _0x1d1b1f[_0x87fb('0x31')];}_0x54fa20[_0x87fb('0x1e')](_0x19ec4f)['send'](_0x1d1b1f);};}exports[_0x87fb('0x32')]=function(_0x43e489,_0x8f9d5c){var _0x83e845={},_0x4b7b30={},_0x149ba5={'count':0x0,'rows':[]};var _0x4148cf=_[_0x87fb('0x33')](db['CmContactHasItem'][_0x87fb('0x34')],function(_0x19d161){return{'name':_0x19d161[_0x87fb('0x35')],'type':_0x19d161[_0x87fb('0x36')]['key']};});_0x4b7b30[_0x87fb('0x37')]=_[_0x87fb('0x33')](_0x4148cf,_0x87fb('0x31'));_0x4b7b30[_0x87fb('0x38')]=_['keys'](_0x43e489[_0x87fb('0x38')]);_0x4b7b30[_0x87fb('0x39')]=_[_0x87fb('0x3a')](_0x4b7b30[_0x87fb('0x37')],_0x4b7b30[_0x87fb('0x38')]);_0x83e845[_0x87fb('0x3b')]=_[_0x87fb('0x3a')](_0x4b7b30['model'],qs[_0x87fb('0x3c')](_0x43e489['query']['fields']));_0x83e845[_0x87fb('0x3b')]=_0x83e845['attributes'][_0x87fb('0x3d')]?_0x83e845[_0x87fb('0x3b')]:_0x4b7b30['model'];if(!_0x43e489[_0x87fb('0x38')][_0x87fb('0x3e')](_0x87fb('0x3f'))){_0x83e845['limit']=qs['limit'](_0x43e489[_0x87fb('0x38')][_0x87fb('0x22')]);_0x83e845['offset']=qs[_0x87fb('0x20')](_0x43e489[_0x87fb('0x38')][_0x87fb('0x20')]);}_0x83e845[_0x87fb('0x40')]=qs['sort'](_0x43e489[_0x87fb('0x38')][_0x87fb('0x41')]);_0x83e845[_0x87fb('0x42')]=qs[_0x87fb('0x39')](_['pick'](_0x43e489[_0x87fb('0x38')],_0x4b7b30['filters']),_0x4148cf);if(_0x43e489[_0x87fb('0x38')][_0x87fb('0x43')]){_0x83e845['where']=_[_0x87fb('0x44')](_0x83e845[_0x87fb('0x42')],{'$or':_[_0x87fb('0x33')](_0x4148cf,function(_0x3b860d){if(_0x3b860d[_0x87fb('0x36')]!=='VIRTUAL'){var _0x5d447f={};_0x5d447f[_0x3b860d[_0x87fb('0x31')]]={'$like':'%'+_0x43e489[_0x87fb('0x38')]['filter']+'%'};return _0x5d447f;}})});}_0x83e845=_[_0x87fb('0x44')]({},_0x83e845,_0x43e489[_0x87fb('0x45')]);var _0x459ee1={'where':_0x83e845[_0x87fb('0x42')]};return db[_0x87fb('0x46')][_0x87fb('0x23')](_0x459ee1)[_0x87fb('0x2a')](function(_0x46b5cb){_0x149ba5[_0x87fb('0x23')]=_0x46b5cb;if(_0x43e489['query'][_0x87fb('0x47')]){_0x83e845[_0x87fb('0x48')]=[{'all':!![]}];}return db['CmContactHasItem'][_0x87fb('0x49')](_0x83e845);})['then'](function(_0x4dffa5){_0x149ba5['rows']=_0x4dffa5;return _0x149ba5;})[_0x87fb('0x2a')](respondWithFilteredResult(_0x8f9d5c,_0x83e845))[_0x87fb('0x4a')](handleError(_0x8f9d5c,null));};exports[_0x87fb('0x4b')]=function(_0x5b0510,_0x5694cd){var _0x2fcfc1={'raw':!![],'where':{'id':_0x5b0510[_0x87fb('0x4c')]['id']}},_0x267916={};_0x267916[_0x87fb('0x37')]=_[_0x87fb('0x4d')](db[_0x87fb('0x46')][_0x87fb('0x34')]);_0x267916['query']=_['keys'](_0x5b0510[_0x87fb('0x38')]);_0x267916[_0x87fb('0x39')]=_[_0x87fb('0x3a')](_0x267916[_0x87fb('0x37')],_0x267916[_0x87fb('0x38')]);_0x2fcfc1[_0x87fb('0x3b')]=_[_0x87fb('0x3a')](_0x267916[_0x87fb('0x37')],qs[_0x87fb('0x3c')](_0x5b0510['query'][_0x87fb('0x3c')]));_0x2fcfc1[_0x87fb('0x3b')]=_0x2fcfc1[_0x87fb('0x3b')][_0x87fb('0x3d')]?_0x2fcfc1[_0x87fb('0x3b')]:_0x267916['model'];if(_0x5b0510['query'][_0x87fb('0x47')]){_0x2fcfc1['include']=[{'all':!![]}];}_0x2fcfc1=_['merge']({},_0x2fcfc1,_0x5b0510[_0x87fb('0x45')]);return db[_0x87fb('0x46')]['find'](_0x2fcfc1)[_0x87fb('0x2a')](handleEntityNotFound(_0x5694cd,null))[_0x87fb('0x2a')](respondWithResult(_0x5694cd,null))[_0x87fb('0x4a')](handleError(_0x5694cd,null));};exports[_0x87fb('0x4e')]=function(_0x486d85,_0x2a3910){return db[_0x87fb('0x46')][_0x87fb('0x4e')](_0x486d85[_0x87fb('0x4f')],{})[_0x87fb('0x2a')](function(_0x3a2302){var _0x5901a6=_0x486d85[_0x87fb('0x50')]['get']({'plain':!![]});if(!_0x5901a6)throw new Error(_0x87fb('0x51'));if(_0x5901a6[_0x87fb('0x52')]===_0x87fb('0x50')){var _0x95d237=_0x3a2302[_0x87fb('0x2b')]({'plain':!![]});var _0xb6c897='CmContactHasItems';return db[_0x87fb('0x53')][_0x87fb('0x54')]({'where':{'name':_0xb6c897,'userProfileId':_0x5901a6[_0x87fb('0x55')]},'raw':!![]})[_0x87fb('0x2a')](function(_0x1a6c3e){if(_0x1a6c3e&&_0x1a6c3e['autoAssociation']===0x0){return db[_0x87fb('0x2d')][_0x87fb('0x4e')]({'name':_0x95d237[_0x87fb('0x31')],'resourceId':_0x95d237['id'],'type':_0x1a6c3e[_0x87fb('0x31')],'sectionId':_0x1a6c3e['id']},{})[_0x87fb('0x2a')](function(){return _0x3a2302;});}else{return _0x3a2302;}})['catch'](function(_0x4f04b8){logger[_0x87fb('0x2f')](_0x87fb('0x56'),_0x4f04b8);throw _0x4f04b8;});}return _0x3a2302;})[_0x87fb('0x2a')](respondWithResult(_0x2a3910,0xc9))['catch'](handleError(_0x2a3910,null));};exports[_0x87fb('0x57')]=function(_0x375d07,_0x4ae1df){if(_0x375d07[_0x87fb('0x4f')]['id']){delete _0x375d07[_0x87fb('0x4f')]['id'];}return db[_0x87fb('0x46')][_0x87fb('0x54')]({'where':{'id':_0x375d07[_0x87fb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4ae1df,null))['then'](saveUpdates(_0x375d07[_0x87fb('0x4f')],null))[_0x87fb('0x2a')](respondWithResult(_0x4ae1df,null))[_0x87fb('0x4a')](handleError(_0x4ae1df,null));};exports[_0x87fb('0x2e')]=function(_0x542ffa,_0x11ba9c){return db[_0x87fb('0x46')][_0x87fb('0x54')]({'where':{'id':_0x542ffa[_0x87fb('0x4c')]['id']}})[_0x87fb('0x2a')](handleEntityNotFound(_0x11ba9c,null))[_0x87fb('0x2a')](removeEntity(_0x11ba9c,null))['catch'](handleError(_0x11ba9c,null));}; \ No newline at end of file +var _0x18e1=['bluebird','mustache','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','CmContactHasItems','UserProfileResource','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x172c71,_0x52dc36){var _0x340c20=function(_0x414113){while(--_0x414113){_0x172c71['push'](_0x172c71['shift']());}};_0x340c20(++_0x52dc36);}(_0x18e1,0x1f2));var _0x118e=function(_0x49b8b9,_0x41fbd8){_0x49b8b9=_0x49b8b9-0x0;var _0x3bb520=_0x18e1[_0x49b8b9];return _0x3bb520;};'use strict';var emlformat=require(_0x118e('0x0'));var rimraf=require(_0x118e('0x1'));var zipdir=require(_0x118e('0x2'));var jsonpatch=require(_0x118e('0x3'));var rp=require(_0x118e('0x4'));var moment=require(_0x118e('0x5'));var BPromise=require(_0x118e('0x6'));var Mustache=require(_0x118e('0x7'));var util=require('util');var path=require(_0x118e('0x8'));var sox=require(_0x118e('0x9'));var csv=require('to-csv');var ejs=require(_0x118e('0xa'));var fs=require('fs');var fs_extra=require(_0x118e('0xb'));var _=require(_0x118e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x118e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x118e('0xe'));var querystring=require(_0x118e('0xf'));var Papa=require(_0x118e('0x10'));var Redis=require(_0x118e('0x11'));var authService=require(_0x118e('0x12'));var qs=require(_0x118e('0x13'));var as=require(_0x118e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x118e('0x15'))('api');var utils=require(_0x118e('0x16'));var config=require(_0x118e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d797f,_0xea64f6){_0xea64f6=_0xea64f6||0xcc;return function(_0x16f6d4){if(_0x16f6d4){return _0x4d797f[_0x118e('0x18')](_0xea64f6);}return _0x4d797f[_0x118e('0x19')](_0xea64f6)[_0x118e('0x1a')]();};}function respondWithResult(_0x1dd94c,_0x3f9a6f){_0x3f9a6f=_0x3f9a6f||0xc8;return function(_0x566933){if(_0x566933){return _0x1dd94c[_0x118e('0x19')](_0x3f9a6f)[_0x118e('0x1b')](_0x566933);}};}function respondWithFilteredResult(_0xbd18bd,_0x17aad7){return function(_0x1ebaaa){if(_0x1ebaaa){var _0x55d7a4=typeof _0x17aad7[_0x118e('0x1c')]===_0x118e('0x1d')&&typeof _0x17aad7['limit']==='undefined';var _0x3f970c=_0x1ebaaa['count'];var _0x2b1a54=_0x55d7a4?0x0:_0x17aad7[_0x118e('0x1c')];var _0x1979cc=_0x55d7a4?_0x1ebaaa[_0x118e('0x1e')]:_0x17aad7['offset']+_0x17aad7['limit'];var _0x8f1ff0;if(_0x1979cc>=_0x3f970c){_0x1979cc=_0x3f970c;_0x8f1ff0=0xc8;}else{_0x8f1ff0=0xce;}_0xbd18bd[_0x118e('0x19')](_0x8f1ff0);return _0xbd18bd['set'](_0x118e('0x1f'),_0x2b1a54+'-'+_0x1979cc+'/'+_0x3f970c)['json'](_0x1ebaaa);}return null;};}function patchUpdates(_0x399341){return function(_0x3bac85){try{jsonpatch[_0x118e('0x20')](_0x3bac85,_0x399341,!![]);}catch(_0x423e38){return BPromise[_0x118e('0x21')](_0x423e38);}return _0x3bac85['save']();};}function saveUpdates(_0x332a6d,_0x568a8f){return function(_0x38c853){if(_0x38c853){return _0x38c853[_0x118e('0x22')](_0x332a6d)[_0x118e('0x23')](function(_0x1c55fb){return _0x1c55fb;});}return null;};}function removeEntity(_0x27a049,_0x17af41){return function(_0x2eba0c){if(_0x2eba0c){return _0x2eba0c[_0x118e('0x24')]()[_0x118e('0x23')](function(){var _0x320ff5=_0x2eba0c['get']({'plain':!![]});var _0x161dd5=_0x118e('0x25');return db[_0x118e('0x26')][_0x118e('0x24')]({'where':{'type':_0x161dd5,'resourceId':_0x320ff5['id']}})[_0x118e('0x23')](function(){return _0x2eba0c;});})['then'](function(){_0x27a049['status'](0xcc)[_0x118e('0x1a')]();});}};}function handleEntityNotFound(_0x35e6f4,_0x38ca63){return function(_0x16ca49){if(!_0x16ca49){_0x35e6f4[_0x118e('0x18')](0x194);}return _0x16ca49;};}function handleError(_0x5079d1,_0x9f0300){_0x9f0300=_0x9f0300||0x1f4;return function(_0x3ca372){logger['error'](_0x3ca372[_0x118e('0x27')]);if(_0x3ca372['name']){delete _0x3ca372[_0x118e('0x28')];}_0x5079d1[_0x118e('0x19')](_0x9f0300)[_0x118e('0x29')](_0x3ca372);};}exports[_0x118e('0x2a')]=function(_0x25a9ec,_0x317b3c){var _0x2b657b={},_0xbf0565={},_0x4dd2ac={'count':0x0,'rows':[]};var _0x2e4cc0=_['map'](db[_0x118e('0x2b')][_0x118e('0x2c')],function(_0x130155){return{'name':_0x130155[_0x118e('0x2d')],'type':_0x130155[_0x118e('0x2e')][_0x118e('0x2f')]};});_0xbf0565['model']=_[_0x118e('0x30')](_0x2e4cc0,_0x118e('0x28'));_0xbf0565[_0x118e('0x31')]=_[_0x118e('0x32')](_0x25a9ec[_0x118e('0x31')]);_0xbf0565[_0x118e('0x33')]=_[_0x118e('0x34')](_0xbf0565[_0x118e('0x35')],_0xbf0565[_0x118e('0x31')]);_0x2b657b[_0x118e('0x36')]=_[_0x118e('0x34')](_0xbf0565['model'],qs[_0x118e('0x37')](_0x25a9ec['query'][_0x118e('0x37')]));_0x2b657b[_0x118e('0x36')]=_0x2b657b['attributes'][_0x118e('0x38')]?_0x2b657b[_0x118e('0x36')]:_0xbf0565[_0x118e('0x35')];if(!_0x25a9ec[_0x118e('0x31')]['hasOwnProperty'](_0x118e('0x39'))){_0x2b657b[_0x118e('0x3a')]=qs[_0x118e('0x3a')](_0x25a9ec['query']['limit']);_0x2b657b[_0x118e('0x1c')]=qs[_0x118e('0x1c')](_0x25a9ec[_0x118e('0x31')][_0x118e('0x1c')]);}_0x2b657b[_0x118e('0x3b')]=qs['sort'](_0x25a9ec[_0x118e('0x31')][_0x118e('0x3c')]);_0x2b657b[_0x118e('0x3d')]=qs[_0x118e('0x33')](_[_0x118e('0x3e')](_0x25a9ec[_0x118e('0x31')],_0xbf0565['filters']),_0x2e4cc0);if(_0x25a9ec[_0x118e('0x31')]['filter']){_0x2b657b[_0x118e('0x3d')]=_[_0x118e('0x3f')](_0x2b657b[_0x118e('0x3d')],{'$or':_['map'](_0x2e4cc0,function(_0x127d5f){if(_0x127d5f[_0x118e('0x2e')]!==_0x118e('0x40')){var _0xbe5268={};_0xbe5268[_0x127d5f[_0x118e('0x28')]]={'$like':'%'+_0x25a9ec[_0x118e('0x31')][_0x118e('0x41')]+'%'};return _0xbe5268;}})});}_0x2b657b=_['merge']({},_0x2b657b,_0x25a9ec[_0x118e('0x42')]);var _0x2200af={'where':_0x2b657b[_0x118e('0x3d')]};return db[_0x118e('0x2b')][_0x118e('0x1e')](_0x2200af)[_0x118e('0x23')](function(_0xb48731){_0x4dd2ac[_0x118e('0x1e')]=_0xb48731;if(_0x25a9ec[_0x118e('0x31')]['includeAll']){_0x2b657b[_0x118e('0x43')]=[{'all':!![]}];}return db[_0x118e('0x2b')][_0x118e('0x44')](_0x2b657b);})[_0x118e('0x23')](function(_0x3f0e30){_0x4dd2ac[_0x118e('0x45')]=_0x3f0e30;return _0x4dd2ac;})[_0x118e('0x23')](respondWithFilteredResult(_0x317b3c,_0x2b657b))[_0x118e('0x46')](handleError(_0x317b3c,null));};exports[_0x118e('0x47')]=function(_0x370a51,_0x5ed2d5){var _0x1cc64d={'raw':!![],'where':{'id':_0x370a51[_0x118e('0x48')]['id']}},_0x2d18f4={};_0x2d18f4[_0x118e('0x35')]=_[_0x118e('0x32')](db[_0x118e('0x2b')][_0x118e('0x2c')]);_0x2d18f4[_0x118e('0x31')]=_[_0x118e('0x32')](_0x370a51['query']);_0x2d18f4[_0x118e('0x33')]=_[_0x118e('0x34')](_0x2d18f4[_0x118e('0x35')],_0x2d18f4[_0x118e('0x31')]);_0x1cc64d['attributes']=_[_0x118e('0x34')](_0x2d18f4['model'],qs['fields'](_0x370a51[_0x118e('0x31')][_0x118e('0x37')]));_0x1cc64d['attributes']=_0x1cc64d[_0x118e('0x36')][_0x118e('0x38')]?_0x1cc64d[_0x118e('0x36')]:_0x2d18f4[_0x118e('0x35')];if(_0x370a51[_0x118e('0x31')][_0x118e('0x49')]){_0x1cc64d[_0x118e('0x43')]=[{'all':!![]}];}_0x1cc64d=_[_0x118e('0x3f')]({},_0x1cc64d,_0x370a51['options']);return db[_0x118e('0x2b')][_0x118e('0x4a')](_0x1cc64d)[_0x118e('0x23')](handleEntityNotFound(_0x5ed2d5,null))['then'](respondWithResult(_0x5ed2d5,null))['catch'](handleError(_0x5ed2d5,null));};exports[_0x118e('0x4b')]=function(_0x37cfdc,_0x37634d){return db['CmContactHasItem'][_0x118e('0x4b')](_0x37cfdc[_0x118e('0x4c')],{})[_0x118e('0x23')](function(_0x530d4e){var _0x2086f2=_0x37cfdc['user'][_0x118e('0x4d')]({'plain':!![]});if(!_0x2086f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2086f2[_0x118e('0x4e')]===_0x118e('0x4f')){var _0x10f4ea=_0x530d4e['get']({'plain':!![]});var _0x4b3b51=_0x118e('0x25');return db[_0x118e('0x50')][_0x118e('0x4a')]({'where':{'name':_0x4b3b51,'userProfileId':_0x2086f2[_0x118e('0x51')]},'raw':!![]})['then'](function(_0x26f930){if(_0x26f930&&_0x26f930[_0x118e('0x52')]===0x0){return db['UserProfileResource'][_0x118e('0x4b')]({'name':_0x10f4ea[_0x118e('0x28')],'resourceId':_0x10f4ea['id'],'type':_0x26f930['name'],'sectionId':_0x26f930['id']},{})[_0x118e('0x23')](function(){return _0x530d4e;});}else{return _0x530d4e;}})[_0x118e('0x46')](function(_0x52db35){logger[_0x118e('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52db35);throw _0x52db35;});}return _0x530d4e;})[_0x118e('0x23')](respondWithResult(_0x37634d,0xc9))[_0x118e('0x46')](handleError(_0x37634d,null));};exports[_0x118e('0x22')]=function(_0x5a9c28,_0x19e58b){if(_0x5a9c28[_0x118e('0x4c')]['id']){delete _0x5a9c28[_0x118e('0x4c')]['id'];}return db['CmContactHasItem'][_0x118e('0x4a')]({'where':{'id':_0x5a9c28[_0x118e('0x48')]['id']}})[_0x118e('0x23')](handleEntityNotFound(_0x19e58b,null))[_0x118e('0x23')](saveUpdates(_0x5a9c28['body'],null))['then'](respondWithResult(_0x19e58b,null))[_0x118e('0x46')](handleError(_0x19e58b,null));};exports[_0x118e('0x24')]=function(_0x4d4640,_0x1efb4d){return db[_0x118e('0x2b')][_0x118e('0x4a')]({'where':{'id':_0x4d4640[_0x118e('0x48')]['id']}})['then'](handleEntityNotFound(_0x1efb4d,null))[_0x118e('0x23')](removeEntity(_0x1efb4d,null))[_0x118e('0x46')](handleError(_0x1efb4d,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index f25931d..deb1153 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 _0x8127=['./cmContactHasItem.attributes','CmContactHasItem','cm_contact_has_items','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x55d7a2,_0xc77adf){var _0x2e9803=function(_0x4c68ba){while(--_0x4c68ba){_0x55d7a2['push'](_0x55d7a2['shift']());}};_0x2e9803(++_0xc77adf);}(_0x8127,0x1d1));var _0x7812=function(_0x5e9cca,_0x592ae0){_0x5e9cca=_0x5e9cca-0x0;var _0x694aa6=_0x8127[_0x5e9cca];return _0x694aa6;};'use strict';var _=require('lodash');var util=require(_0x7812('0x0'));var logger=require(_0x7812('0x1'))(_0x7812('0x2'));var moment=require(_0x7812('0x3'));var BPromise=require(_0x7812('0x4'));var rp=require(_0x7812('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7812('0x6'));var config=require(_0x7812('0x7'));var attributes=require(_0x7812('0x8'));module['exports']=function(_0x5c4305,_0x2392f5){return _0x5c4305['define'](_0x7812('0x9'),attributes,{'tableName':_0x7812('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccc5=['define','CmContactHasItem','cm_contact_has_items','lodash','api','moment','bluebird','request-promise','./cmContactHasItem.attributes','exports'];(function(_0x3813ad,_0x2eff01){var _0x16ed55=function(_0x406204){while(--_0x406204){_0x3813ad['push'](_0x3813ad['shift']());}};_0x16ed55(++_0x2eff01);}(_0xccc5,0x1bb));var _0x5ccc=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xccc5[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0x5ccc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ccc('0x1'));var moment=require(_0x5ccc('0x2'));var BPromise=require(_0x5ccc('0x3'));var rp=require(_0x5ccc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5ccc('0x5'));module[_0x5ccc('0x6')]=function(_0x437b1c,_0x1b5cfa){return _0x437b1c[_0x5ccc('0x7')](_0x5ccc('0x8'),attributes,{'tableName':_0x5ccc('0x9'),'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 32c208d..11198fb 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 _0xb47a=['http','then','info','request\x20sent','debug','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x23991f,_0x3cf4ee){var _0x536c7b=function(_0x1b9249){while(--_0x1b9249){_0x23991f['push'](_0x23991f['shift']());}};_0x536c7b(++_0x3cf4ee);}(_0xb47a,0xac));var _0xab47=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb47a[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xab47('0x0'));var util=require(_0xab47('0x1'));var moment=require(_0xab47('0x2'));var BPromise=require(_0xab47('0x3'));var rs=require(_0xab47('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab47('0x5'))['db'];var utils=require(_0xab47('0x6'));var logger=require(_0xab47('0x7'))(_0xab47('0x8'));var config=require(_0xab47('0x9'));var jayson=require(_0xab47('0xa'));var client=jayson[_0xab47('0xb')][_0xab47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7e2402,_0x183ac1,_0x150b0e){return new BPromise(function(_0x190597,_0x5ab5f4){return client['request'](_0x7e2402,_0x150b0e)[_0xab47('0xd')](function(_0x50bfdc){logger[_0xab47('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x183ac1,_0xab47('0xf'));logger[_0xab47('0x10')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x183ac1,_0xab47('0xf'),JSON[_0xab47('0x11')](_0x50bfdc));if(_0x50bfdc[_0xab47('0x12')]){if(_0x50bfdc[_0xab47('0x12')][_0xab47('0x13')]===0x1f4){logger[_0xab47('0x12')](_0xab47('0x14'),_0x183ac1,_0x50bfdc['error'][_0xab47('0x15')]);return _0x5ab5f4(_0x50bfdc[_0xab47('0x12')]['message']);}logger[_0xab47('0x12')](_0xab47('0x14'),_0x183ac1,_0x50bfdc[_0xab47('0x12')]['message']);return _0x190597(_0x50bfdc[_0xab47('0x12')][_0xab47('0x15')]);}else{logger[_0xab47('0xe')](_0xab47('0x14'),_0x183ac1,_0xab47('0xf'));_0x190597(_0x50bfdc[_0xab47('0x16')][_0xab47('0x15')]);}})['catch'](function(_0x73f658){logger['error'](_0xab47('0x14'),_0x183ac1,_0x73f658);_0x5ab5f4(_0x73f658);});});} \ No newline at end of file +var _0xc714=['info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x4f576c,_0x21f2ee){var _0x6ddb4f=function(_0x35078c){while(--_0x35078c){_0x4f576c['push'](_0x4f576c['shift']());}};_0x6ddb4f(++_0x21f2ee);}(_0xc714,0x9b));var _0x4c71=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc714[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4c71('0x0'));var util=require(_0x4c71('0x1'));var moment=require('moment');var BPromise=require(_0x4c71('0x2'));var rs=require(_0x4c71('0x3'));var fs=require('fs');var Redis=require(_0x4c71('0x4'));var db=require(_0x4c71('0x5'))['db'];var utils=require(_0x4c71('0x6'));var logger=require(_0x4c71('0x7'))(_0x4c71('0x8'));var config=require(_0x4c71('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c71('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f3afa,_0x42c836,_0x9fa1ef){return new BPromise(function(_0x4e1804,_0x1b7633){return client[_0x4c71('0xb')](_0x3f3afa,_0x9fa1ef)[_0x4c71('0xc')](function(_0x2b064f){logger[_0x4c71('0xd')](_0x4c71('0xe'),_0x42c836,'request\x20sent');logger[_0x4c71('0xf')](_0x4c71('0x10'),_0x42c836,_0x4c71('0x11'),JSON[_0x4c71('0x12')](_0x2b064f));if(_0x2b064f['error']){if(_0x2b064f[_0x4c71('0x13')][_0x4c71('0x14')]===0x1f4){logger[_0x4c71('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x42c836,_0x2b064f[_0x4c71('0x13')]['message']);return _0x1b7633(_0x2b064f[_0x4c71('0x13')][_0x4c71('0x15')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x42c836,_0x2b064f[_0x4c71('0x13')][_0x4c71('0x15')]);return _0x4e1804(_0x2b064f[_0x4c71('0x13')][_0x4c71('0x15')]);}else{logger[_0x4c71('0xd')](_0x4c71('0xe'),_0x42c836,_0x4c71('0x11'));_0x4e1804(_0x2b064f[_0x4c71('0x16')][_0x4c71('0x15')]);}})[_0x4c71('0x17')](function(_0x593f1f){logger[_0x4c71('0x13')](_0x4c71('0xe'),_0x42c836,_0x593f1f);_0x1b7633(_0x593f1f);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 8e83e32..94823b5 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 _0x7740=['index','show','post','create','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x50d583,_0x53e478){var _0x531c1a=function(_0xbb2dab){while(--_0xbb2dab){_0x50d583['push'](_0x50d583['shift']());}};_0x531c1a(++_0x53e478);}(_0x7740,0xbd));var _0x0774=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x7740[_0x3227c1];return _0x31fd48;};'use strict';var multer=require(_0x0774('0x0'));var util=require(_0x0774('0x1'));var path=require(_0x0774('0x2'));var timeout=require(_0x0774('0x3'));var express=require(_0x0774('0x4'));var router=express[_0x0774('0x5')]();var fs_extra=require(_0x0774('0x6'));var auth=require(_0x0774('0x7'));var interaction=require(_0x0774('0x8'));var config=require('../../config/environment');var controller=require('./cmContactHasItem.controller');router[_0x0774('0x9')]('/',auth[_0x0774('0xa')](),controller[_0x0774('0xb')]);router[_0x0774('0x9')]('/:id',auth[_0x0774('0xa')](),controller[_0x0774('0xc')]);router[_0x0774('0xd')]('/',auth['isAuthenticated'](),controller[_0x0774('0xe')]);router[_0x0774('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0774('0x10')](_0x0774('0x11'),auth[_0x0774('0xa')](),controller[_0x0774('0x12')]);module[_0x0774('0x13')]=router; \ No newline at end of file +var _0x76a3=['../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x31d803,_0x159de5){var _0x212ba9=function(_0x5058b4){while(--_0x5058b4){_0x31d803['push'](_0x31d803['shift']());}};_0x212ba9(++_0x159de5);}(_0x76a3,0x1bc));var _0x376a=function(_0x15b399,_0x59db1a){_0x15b399=_0x15b399-0x0;var _0x199f2d=_0x76a3[_0x15b399];return _0x199f2d;};'use strict';var multer=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var path=require(_0x376a('0x2'));var timeout=require(_0x376a('0x3'));var express=require(_0x376a('0x4'));var router=express['Router']();var fs_extra=require(_0x376a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x376a('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x376a('0x7')]('/',auth[_0x376a('0x8')](),controller[_0x376a('0x9')]);router['get'](_0x376a('0xa'),auth[_0x376a('0x8')](),controller[_0x376a('0xb')]);router[_0x376a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x376a('0xa'),auth[_0x376a('0x8')](),controller[_0x376a('0xd')]);router[_0x376a('0xe')](_0x376a('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 4f0e120..62c4cc3 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 _0xa251=['values','BOOLEAN','ENUM','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select'];(function(_0x307b6a,_0x259bb1){var _0x4bbd1c=function(_0x5494a2){while(--_0x5494a2){_0x307b6a['push'](_0x307b6a['shift']());}};_0x4bbd1c(++_0x259bb1);}(_0xa251,0x1d7));var _0x1a25=function(_0x5935ff,_0x3014c3){_0x5935ff=_0x5935ff-0x0;var _0xdb9054=_0xa251[_0x5935ff];return _0xdb9054;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x1a25('0x0')]={'name':{'type':Sequelize[_0x1a25('0x1')],'get':function(_0x26c516){return this[_0x1a25('0x2')](_0x1a25('0x3'));}},'alias':{'type':Sequelize[_0x1a25('0x4')],'allowNull':![],'set':function(_0x1441c9){this[_0x1a25('0x5')](_0x1a25('0x3'),_0x1441c9?_0x1441c9:this[_0x1a25('0x2')](_0x1a25('0x6')));}},'type':{'type':Sequelize[_0x1a25('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1a25('0x7')](_0x1a25('0x8')),'get':function(){if(this[_0x1a25('0x2')]('type')===_0x1a25('0x9')){return JSON['parse'](this[_0x1a25('0x2')](_0x1a25('0xa')));}else{return this[_0x1a25('0x2')]('values');}},'set':function(_0x1cc541){if(Array['isArray'](_0x1cc541)){this[_0x1a25('0x5')](_0x1a25('0xa'),JSON['stringify'](_0x1cc541));}else{this[_0x1a25('0x5')](_0x1a25('0xa'),_0x1cc541);}}},'required':{'type':Sequelize[_0x1a25('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1a25('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1a25('0xc')]('voice')}}; \ No newline at end of file +var _0xfdd8=['stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','STRING','type','select','parse','values','isArray'];(function(_0x2e5ae1,_0x3003ea){var _0x219fc0=function(_0x4db1a3){while(--_0x4db1a3){_0x2e5ae1['push'](_0x2e5ae1['shift']());}};_0x219fc0(++_0x3003ea);}(_0xfdd8,0xe4));var _0x8fdd=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xfdd8[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8fdd('0x0'));module[_0x8fdd('0x1')]={'name':{'type':Sequelize[_0x8fdd('0x2')],'get':function(_0x2630f6){return this[_0x8fdd('0x3')](_0x8fdd('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0xa734ed){this[_0x8fdd('0x5')](_0x8fdd('0x4'),_0xa734ed?_0xa734ed:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x8fdd('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x8fdd('0x7'))===_0x8fdd('0x8')){return JSON[_0x8fdd('0x9')](this[_0x8fdd('0x3')](_0x8fdd('0xa')));}else{return this['getDataValue'](_0x8fdd('0xa'));}},'set':function(_0x5c1682){if(Array[_0x8fdd('0xb')](_0x5c1682)){this[_0x8fdd('0x5')]('values',JSON[_0x8fdd('0xc')](_0x5c1682));}else{this[_0x8fdd('0x5')](_0x8fdd('0xa'),_0x5c1682);}}},'required':{'type':Sequelize[_0x8fdd('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8fdd('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x8fdd('0xe')](_0x8fdd('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6b6ee4b..04c3c26 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 _0x707e=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','differenceBy','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','keys','length','include','find','body','sequelize','transaction','Sequelize','TEXT','text','INTEGER','BOOLEAN','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5a493c,_0x455af1){var _0x5e145d=function(_0x2831a0){while(--_0x2831a0){_0x5a493c['push'](_0x5a493c['shift']());}};_0x5e145d(++_0x455af1);}(_0x707e,0x1e8));var _0xe707=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x707e[_0x381589];return _0x2a075d;};'use strict';var emlformat=require(_0xe707('0x0'));var rimraf=require(_0xe707('0x1'));var zipdir=require(_0xe707('0x2'));var jsonpatch=require(_0xe707('0x3'));var rp=require(_0xe707('0x4'));var moment=require(_0xe707('0x5'));var BPromise=require(_0xe707('0x6'));var Mustache=require('mustache');var util=require(_0xe707('0x7'));var path=require(_0xe707('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe707('0x9'));var fs=require('fs');var fs_extra=require(_0xe707('0xa'));var _=require(_0xe707('0xb'));var squel=require(_0xe707('0xc'));var crypto=require(_0xe707('0xd'));var jsforce=require(_0xe707('0xe'));var deskjs=require(_0xe707('0xf'));var toCsv=require(_0xe707('0x10'));var querystring=require('querystring');var Papa=require(_0xe707('0x11'));var Redis=require(_0xe707('0x12'));var authService=require(_0xe707('0x13'));var qs=require(_0xe707('0x14'));var as=require(_0xe707('0x15'));var hardwareService=require(_0xe707('0x16'));var logger=require(_0xe707('0x17'))(_0xe707('0x18'));var utils=require(_0xe707('0x19'));var config=require(_0xe707('0x1a'));var licenseUtil=require(_0xe707('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x712000,_0x3c676a){_0x3c676a=_0x3c676a||0xcc;return function(_0x50e202){if(_0x50e202){return _0x712000['sendStatus'](_0x3c676a);}return _0x712000[_0xe707('0x1c')](_0x3c676a)[_0xe707('0x1d')]();};}function respondWithResult(_0x1f08b3,_0x11fb76){_0x11fb76=_0x11fb76||0xc8;return function(_0x174ec7){if(_0x174ec7){return _0x1f08b3['status'](_0x11fb76)[_0xe707('0x1e')](_0x174ec7);}};}function respondWithFilteredResult(_0x3380c5,_0x1e3510){return function(_0x4b6025){if(_0x4b6025){var _0x2ccc0d=typeof _0x1e3510[_0xe707('0x1f')]===_0xe707('0x20')&&typeof _0x1e3510[_0xe707('0x21')]===_0xe707('0x20');var _0x1d49af=_0x4b6025[_0xe707('0x22')];var _0x56e6a4=_0x2ccc0d?0x0:_0x1e3510['offset'];var _0x46b52d=_0x2ccc0d?_0x4b6025['count']:_0x1e3510[_0xe707('0x1f')]+_0x1e3510[_0xe707('0x21')];var _0x887ca6;if(_0x46b52d>=_0x1d49af){_0x46b52d=_0x1d49af;_0x887ca6=0xc8;}else{_0x887ca6=0xce;}_0x3380c5[_0xe707('0x1c')](_0x887ca6);return _0x3380c5[_0xe707('0x23')](_0xe707('0x24'),_0x56e6a4+'-'+_0x46b52d+'/'+_0x1d49af)[_0xe707('0x1e')](_0x4b6025);}return null;};}function patchUpdates(_0x16349b){return function(_0xbb2f18){try{jsonpatch[_0xe707('0x25')](_0xbb2f18,_0x16349b,!![]);}catch(_0x7b86a3){return BPromise['reject'](_0x7b86a3);}return _0xbb2f18['save']();};}function saveUpdates(_0x307f19,_0x4c4183){return function(_0x220b65){if(_0x220b65){return _0x220b65[_0xe707('0x26')](_0x307f19)[_0xe707('0x27')](function(_0x45995d){return _0x45995d;});}return null;};}function removeEntity(_0x17673f,_0xb1abe6){return function(_0x44cf7e){if(_0x44cf7e){return _0x44cf7e[_0xe707('0x28')]()['then'](function(){_0x17673f[_0xe707('0x1c')](0xcc)[_0xe707('0x1d')]();});}};}function handleEntityNotFound(_0x1a0881,_0x3134ee){return function(_0x50e450){if(!_0x50e450){_0x1a0881[_0xe707('0x29')](0x194);}return _0x50e450;};}function handleError(_0x43b9bd,_0x2ab00c){_0x2ab00c=_0x2ab00c||0x1f4;return function(_0x2b1c2c){logger[_0xe707('0x2a')](_0x2b1c2c[_0xe707('0x2b')]);if(_0x2b1c2c[_0xe707('0x2c')]){delete _0x2b1c2c[_0xe707('0x2c')];}_0x43b9bd[_0xe707('0x1c')](_0x2ab00c)[_0xe707('0x2d')](_0x2b1c2c);};}exports[_0xe707('0x2e')]=function(_0x2263fd,_0x1aa50c){var _0x225e7d={},_0x395c4b={},_0x1e4dcb={'count':0x0,'rows':[]};var _0x3f8424=_[_0xe707('0x2f')](db[_0xe707('0x30')][_0xe707('0x31')],function(_0x27cffa){return{'name':_0x27cffa[_0xe707('0x32')],'type':_0x27cffa[_0xe707('0x33')]['key']};});_0x395c4b['model']=_[_0xe707('0x34')](_[_0xe707('0x2f')](_0x3f8424,_0xe707('0x2c')),[_0xe707('0x2c')]);_0x395c4b['query']=_['keys'](_0x2263fd[_0xe707('0x35')]);_0x395c4b[_0xe707('0x36')]=_[_0xe707('0x37')](_0x395c4b['model'],_0x395c4b[_0xe707('0x35')]);_0x225e7d[_0xe707('0x38')]=_[_0xe707('0x37')](_0x395c4b[_0xe707('0x39')],qs['fields'](_0x2263fd[_0xe707('0x35')][_0xe707('0x3a')]));_0x225e7d[_0xe707('0x38')]=_0x225e7d['attributes']['length']?_0x225e7d[_0xe707('0x38')]:_0x395c4b[_0xe707('0x39')];if(!_0x2263fd[_0xe707('0x35')][_0xe707('0x3b')](_0xe707('0x3c'))){_0x225e7d[_0xe707('0x21')]=qs[_0xe707('0x21')](_0x2263fd[_0xe707('0x35')][_0xe707('0x21')]);_0x225e7d['offset']=qs['offset'](_0x2263fd[_0xe707('0x35')][_0xe707('0x1f')]);}_0x225e7d[_0xe707('0x3d')]=qs[_0xe707('0x3e')](_0x2263fd['query'][_0xe707('0x3e')]);_0x225e7d[_0xe707('0x3f')]=qs[_0xe707('0x36')](_[_0xe707('0x40')](_0x2263fd['query'],_0x395c4b['filters']),_0x3f8424);if(_0x2263fd[_0xe707('0x35')][_0xe707('0x41')]){_0x225e7d[_0xe707('0x3f')]=_[_0xe707('0x42')](_0x225e7d[_0xe707('0x3f')],{'$or':_[_0xe707('0x2f')](_0x3f8424,function(_0x4e3ec7){if(_0x4e3ec7[_0xe707('0x33')]!=='VIRTUAL'){var _0x43a11a={};_0x43a11a[_0x4e3ec7[_0xe707('0x2c')]]={'$like':'%'+_0x2263fd[_0xe707('0x35')][_0xe707('0x41')]+'%'};return _0x43a11a;}})});}_0x225e7d=_[_0xe707('0x42')]({},_0x225e7d,_0x2263fd[_0xe707('0x43')]);var _0x5f3400={'where':_0x225e7d[_0xe707('0x3f')]};return db['CmCustomField'][_0xe707('0x22')](_0x5f3400)[_0xe707('0x27')](function(_0x279f39){_0x1e4dcb[_0xe707('0x22')]=_0x279f39;if(_0x2263fd[_0xe707('0x35')][_0xe707('0x44')]){_0x225e7d['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x225e7d);})[_0xe707('0x27')](function(_0x5b3d90){_0x1e4dcb[_0xe707('0x45')]=_0x5b3d90;return _0x1e4dcb;})['then'](respondWithFilteredResult(_0x1aa50c,_0x225e7d))[_0xe707('0x46')](handleError(_0x1aa50c,null));};exports[_0xe707('0x47')]=function(_0x30856e,_0xb06378){var _0x3064f0={'raw':!![],'where':{'id':_0x30856e['params']['id']}},_0x2f1c9b={};_0x2f1c9b[_0xe707('0x39')]=_[_0xe707('0x48')](db[_0xe707('0x30')][_0xe707('0x31')]);_0x2f1c9b[_0xe707('0x35')]=_['keys'](_0x30856e[_0xe707('0x35')]);_0x2f1c9b[_0xe707('0x36')]=_[_0xe707('0x37')](_0x2f1c9b['model'],_0x2f1c9b[_0xe707('0x35')]);_0x3064f0[_0xe707('0x38')]=_['intersection'](_0x2f1c9b[_0xe707('0x39')],qs['fields'](_0x30856e[_0xe707('0x35')][_0xe707('0x3a')]));_0x3064f0[_0xe707('0x38')]=_0x3064f0[_0xe707('0x38')][_0xe707('0x49')]?_0x3064f0['attributes']:_0x2f1c9b[_0xe707('0x39')];if(_0x30856e[_0xe707('0x35')][_0xe707('0x44')]){_0x3064f0[_0xe707('0x4a')]=[{'all':!![]}];}_0x3064f0=_['merge']({},_0x3064f0,_0x30856e[_0xe707('0x43')]);return db['CmCustomField'][_0xe707('0x4b')](_0x3064f0)[_0xe707('0x27')](handleEntityNotFound(_0xb06378,null))[_0xe707('0x27')](respondWithResult(_0xb06378,null))[_0xe707('0x46')](handleError(_0xb06378,null));};exports[_0xe707('0x26')]=function(_0x214469,_0x45a046){if(_0x214469['body']['id']){delete _0x214469[_0xe707('0x4c')]['id'];}return db[_0xe707('0x30')][_0xe707('0x4b')]({'where':{'id':_0x214469['params']['id']}})['then'](handleEntityNotFound(_0x45a046,null))['then'](saveUpdates(_0x214469[_0xe707('0x4c')],null))[_0xe707('0x27')](respondWithResult(_0x45a046,null))[_0xe707('0x46')](handleError(_0x45a046,null));};exports[_0xe707('0x28')]=function(_0xb4a52c,_0x220614){return db[_0xe707('0x30')]['find']({'where':{'id':_0xb4a52c['params']['id']}})[_0xe707('0x27')](handleEntityNotFound(_0x220614,null))[_0xe707('0x27')](removeEntity(_0x220614,null))[_0xe707('0x46')](handleError(_0x220614,null));};exports['create']=function(_0x2c90b2,_0xd7cbe){var _0x4e893f;return db[_0xe707('0x4d')][_0xe707('0x4e')](function(_0x7bf2ec){return db['CmCustomField']['create'](_0x2c90b2[_0xe707('0x4c')],{'transaction':_0x7bf2ec})[_0xe707('0x27')](function(_0x4115f6){_0x4e893f=_0x4115f6;var _0x4a70e5={'type':db[_0xe707('0x4f')][_0xe707('0x50')],'transaction':_0x7bf2ec};switch(_0x2c90b2[_0xe707('0x4c')][_0xe707('0x33')]){case _0xe707('0x51'):_0x4a70e5[_0xe707('0x33')]=db['Sequelize']['TEXT'];break;case'number':_0x4a70e5[_0xe707('0x33')]=db[_0xe707('0x4f')][_0xe707('0x52')];break;case'switch':_0x4a70e5['type']=db[_0xe707('0x4f')][_0xe707('0x53')];_0x4a70e5['defaultValue']=![];break;default:}return db[_0xe707('0x4d')]['queryInterface']['addColumn']('cm_contacts',util['format'](_0xe707('0x54'),_0x4e893f['id']),_0x4a70e5);})['then'](function(){return _0x4e893f;});})['then'](respondWithResult(_0xd7cbe,0xc9))[_0xe707('0x46')](handleError(_0xd7cbe,null));}; \ No newline at end of file +var _0x0f45=['lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','CmCustomField','findAll','rows','catch','params','body','find','create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x32f970,_0x1d9774){var _0x225b46=function(_0x5d895b){while(--_0x5d895b){_0x32f970['push'](_0x32f970['shift']());}};_0x225b46(++_0x1d9774);}(_0x0f45,0x1c4));var _0x50f4=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x0f45[_0x5a3cf0];return _0x5a64ee;};'use strict';var emlformat=require(_0x50f4('0x0'));var rimraf=require(_0x50f4('0x1'));var zipdir=require(_0x50f4('0x2'));var jsonpatch=require(_0x50f4('0x3'));var rp=require(_0x50f4('0x4'));var moment=require(_0x50f4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x50f4('0x6'));var util=require(_0x50f4('0x7'));var path=require(_0x50f4('0x8'));var sox=require(_0x50f4('0x9'));var csv=require(_0x50f4('0xa'));var ejs=require(_0x50f4('0xb'));var fs=require('fs');var fs_extra=require(_0x50f4('0xc'));var _=require(_0x50f4('0xd'));var squel=require('squel');var crypto=require(_0x50f4('0xe'));var jsforce=require(_0x50f4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x50f4('0xa'));var querystring=require(_0x50f4('0x10'));var Papa=require(_0x50f4('0x11'));var Redis=require(_0x50f4('0x12'));var authService=require(_0x50f4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50f4('0x14'));var logger=require(_0x50f4('0x15'))(_0x50f4('0x16'));var utils=require('../../config/utils');var config=require(_0x50f4('0x17'));var licenseUtil=require(_0x50f4('0x18'));var db=require(_0x50f4('0x19'))['db'];function respondWithStatusCode(_0x56c726,_0x4de44d){_0x4de44d=_0x4de44d||0xcc;return function(_0x511076){if(_0x511076){return _0x56c726[_0x50f4('0x1a')](_0x4de44d);}return _0x56c726[_0x50f4('0x1b')](_0x4de44d)[_0x50f4('0x1c')]();};}function respondWithResult(_0x4a25a5,_0xc176b2){_0xc176b2=_0xc176b2||0xc8;return function(_0x29d477){if(_0x29d477){return _0x4a25a5[_0x50f4('0x1b')](_0xc176b2)[_0x50f4('0x1d')](_0x29d477);}};}function respondWithFilteredResult(_0x446b9d,_0x54245e){return function(_0x17feae){if(_0x17feae){var _0x1ad902=typeof _0x54245e[_0x50f4('0x1e')]===_0x50f4('0x1f')&&typeof _0x54245e['limit']==='undefined';var _0x2a811c=_0x17feae[_0x50f4('0x20')];var _0x4d8f8b=_0x1ad902?0x0:_0x54245e[_0x50f4('0x1e')];var _0x50706a=_0x1ad902?_0x17feae[_0x50f4('0x20')]:_0x54245e[_0x50f4('0x1e')]+_0x54245e[_0x50f4('0x21')];var _0x285589;if(_0x50706a>=_0x2a811c){_0x50706a=_0x2a811c;_0x285589=0xc8;}else{_0x285589=0xce;}_0x446b9d[_0x50f4('0x1b')](_0x285589);return _0x446b9d[_0x50f4('0x22')](_0x50f4('0x23'),_0x4d8f8b+'-'+_0x50706a+'/'+_0x2a811c)[_0x50f4('0x1d')](_0x17feae);}return null;};}function patchUpdates(_0x19c686){return function(_0x3c8b85){try{jsonpatch[_0x50f4('0x24')](_0x3c8b85,_0x19c686,!![]);}catch(_0x211b54){return BPromise[_0x50f4('0x25')](_0x211b54);}return _0x3c8b85[_0x50f4('0x26')]();};}function saveUpdates(_0x57ca43,_0x118d75){return function(_0x53df90){if(_0x53df90){return _0x53df90[_0x50f4('0x27')](_0x57ca43)[_0x50f4('0x28')](function(_0x5e538a){return _0x5e538a;});}return null;};}function removeEntity(_0x1cb754,_0x460146){return function(_0x3d0197){if(_0x3d0197){return _0x3d0197[_0x50f4('0x29')]()[_0x50f4('0x28')](function(){_0x1cb754[_0x50f4('0x1b')](0xcc)[_0x50f4('0x1c')]();});}};}function handleEntityNotFound(_0x5b3115,_0x51afdd){return function(_0x4f74b5){if(!_0x4f74b5){_0x5b3115['sendStatus'](0x194);}return _0x4f74b5;};}function handleError(_0x13ec39,_0x406732){_0x406732=_0x406732||0x1f4;return function(_0x46925b){logger[_0x50f4('0x2a')](_0x46925b[_0x50f4('0x2b')]);if(_0x46925b[_0x50f4('0x2c')]){delete _0x46925b[_0x50f4('0x2c')];}_0x13ec39[_0x50f4('0x1b')](_0x406732)[_0x50f4('0x2d')](_0x46925b);};}exports[_0x50f4('0x2e')]=function(_0x55c368,_0x1c91a9){var _0x41e7f2={},_0xcd7ca2={},_0x41a0e2={'count':0x0,'rows':[]};var _0x1f71b0=_[_0x50f4('0x2f')](db['CmCustomField'][_0x50f4('0x30')],function(_0x238494){return{'name':_0x238494[_0x50f4('0x31')],'type':_0x238494['type'][_0x50f4('0x32')]};});_0xcd7ca2['model']=_[_0x50f4('0x33')](_[_0x50f4('0x2f')](_0x1f71b0,_0x50f4('0x2c')),[_0x50f4('0x2c')]);_0xcd7ca2['query']=_[_0x50f4('0x34')](_0x55c368[_0x50f4('0x35')]);_0xcd7ca2[_0x50f4('0x36')]=_[_0x50f4('0x37')](_0xcd7ca2[_0x50f4('0x38')],_0xcd7ca2[_0x50f4('0x35')]);_0x41e7f2['attributes']=_[_0x50f4('0x37')](_0xcd7ca2[_0x50f4('0x38')],qs[_0x50f4('0x39')](_0x55c368[_0x50f4('0x35')][_0x50f4('0x39')]));_0x41e7f2[_0x50f4('0x3a')]=_0x41e7f2[_0x50f4('0x3a')][_0x50f4('0x3b')]?_0x41e7f2['attributes']:_0xcd7ca2[_0x50f4('0x38')];if(!_0x55c368[_0x50f4('0x35')][_0x50f4('0x3c')](_0x50f4('0x3d'))){_0x41e7f2[_0x50f4('0x21')]=qs['limit'](_0x55c368[_0x50f4('0x35')][_0x50f4('0x21')]);_0x41e7f2[_0x50f4('0x1e')]=qs['offset'](_0x55c368['query'][_0x50f4('0x1e')]);}_0x41e7f2['order']=qs[_0x50f4('0x3e')](_0x55c368[_0x50f4('0x35')][_0x50f4('0x3e')]);_0x41e7f2[_0x50f4('0x3f')]=qs[_0x50f4('0x36')](_[_0x50f4('0x40')](_0x55c368[_0x50f4('0x35')],_0xcd7ca2[_0x50f4('0x36')]),_0x1f71b0);if(_0x55c368[_0x50f4('0x35')][_0x50f4('0x41')]){_0x41e7f2['where']=_[_0x50f4('0x42')](_0x41e7f2[_0x50f4('0x3f')],{'$or':_[_0x50f4('0x2f')](_0x1f71b0,function(_0x2ab4fe){if(_0x2ab4fe[_0x50f4('0x43')]!=='VIRTUAL'){var _0x1eff6={};_0x1eff6[_0x2ab4fe[_0x50f4('0x2c')]]={'$like':'%'+_0x55c368[_0x50f4('0x35')]['filter']+'%'};return _0x1eff6;}})});}_0x41e7f2=_['merge']({},_0x41e7f2,_0x55c368[_0x50f4('0x44')]);var _0x15d658={'where':_0x41e7f2['where']};return db['CmCustomField'][_0x50f4('0x20')](_0x15d658)[_0x50f4('0x28')](function(_0x24da35){_0x41a0e2[_0x50f4('0x20')]=_0x24da35;if(_0x55c368[_0x50f4('0x35')][_0x50f4('0x45')]){_0x41e7f2[_0x50f4('0x46')]=[{'all':!![]}];}return db[_0x50f4('0x47')][_0x50f4('0x48')](_0x41e7f2);})['then'](function(_0x16bc03){_0x41a0e2[_0x50f4('0x49')]=_0x16bc03;return _0x41a0e2;})[_0x50f4('0x28')](respondWithFilteredResult(_0x1c91a9,_0x41e7f2))[_0x50f4('0x4a')](handleError(_0x1c91a9,null));};exports['show']=function(_0x115f52,_0x4c7330){var _0x5733c3={'raw':!![],'where':{'id':_0x115f52[_0x50f4('0x4b')]['id']}},_0x58e381={};_0x58e381[_0x50f4('0x38')]=_[_0x50f4('0x34')](db[_0x50f4('0x47')]['rawAttributes']);_0x58e381[_0x50f4('0x35')]=_[_0x50f4('0x34')](_0x115f52[_0x50f4('0x35')]);_0x58e381[_0x50f4('0x36')]=_[_0x50f4('0x37')](_0x58e381[_0x50f4('0x38')],_0x58e381[_0x50f4('0x35')]);_0x5733c3['attributes']=_[_0x50f4('0x37')](_0x58e381[_0x50f4('0x38')],qs[_0x50f4('0x39')](_0x115f52[_0x50f4('0x35')][_0x50f4('0x39')]));_0x5733c3[_0x50f4('0x3a')]=_0x5733c3[_0x50f4('0x3a')][_0x50f4('0x3b')]?_0x5733c3['attributes']:_0x58e381[_0x50f4('0x38')];if(_0x115f52[_0x50f4('0x35')][_0x50f4('0x45')]){_0x5733c3[_0x50f4('0x46')]=[{'all':!![]}];}_0x5733c3=_['merge']({},_0x5733c3,_0x115f52[_0x50f4('0x44')]);return db[_0x50f4('0x47')]['find'](_0x5733c3)[_0x50f4('0x28')](handleEntityNotFound(_0x4c7330,null))[_0x50f4('0x28')](respondWithResult(_0x4c7330,null))[_0x50f4('0x4a')](handleError(_0x4c7330,null));};exports[_0x50f4('0x27')]=function(_0x326c67,_0x2c8c09){if(_0x326c67[_0x50f4('0x4c')]['id']){delete _0x326c67[_0x50f4('0x4c')]['id'];}return db['CmCustomField'][_0x50f4('0x4d')]({'where':{'id':_0x326c67[_0x50f4('0x4b')]['id']}})[_0x50f4('0x28')](handleEntityNotFound(_0x2c8c09,null))[_0x50f4('0x28')](saveUpdates(_0x326c67[_0x50f4('0x4c')],null))[_0x50f4('0x28')](respondWithResult(_0x2c8c09,null))[_0x50f4('0x4a')](handleError(_0x2c8c09,null));};exports[_0x50f4('0x29')]=function(_0x1c8b82,_0x5cd22f){return db[_0x50f4('0x47')][_0x50f4('0x4d')]({'where':{'id':_0x1c8b82[_0x50f4('0x4b')]['id']}})[_0x50f4('0x28')](handleEntityNotFound(_0x5cd22f,null))['then'](removeEntity(_0x5cd22f,null))['catch'](handleError(_0x5cd22f,null));};exports[_0x50f4('0x4e')]=function(_0x561359,_0x10057d){var _0x3d5738;return db['sequelize'][_0x50f4('0x4f')](function(_0xbecf61){return db[_0x50f4('0x47')]['create'](_0x561359[_0x50f4('0x4c')],{'transaction':_0xbecf61})[_0x50f4('0x28')](function(_0x4a14e1){_0x3d5738=_0x4a14e1;var _0x448b73={'type':db[_0x50f4('0x50')][_0x50f4('0x51')],'transaction':_0xbecf61};switch(_0x561359[_0x50f4('0x4c')][_0x50f4('0x43')]){case'text':_0x448b73['type']=db[_0x50f4('0x50')][_0x50f4('0x51')];break;case _0x50f4('0x52'):_0x448b73[_0x50f4('0x43')]=db[_0x50f4('0x50')][_0x50f4('0x53')];break;case _0x50f4('0x54'):_0x448b73[_0x50f4('0x43')]=db['Sequelize'][_0x50f4('0x55')];_0x448b73[_0x50f4('0x56')]=![];break;default:}return db[_0x50f4('0x57')][_0x50f4('0x58')][_0x50f4('0x59')](_0x50f4('0x5a'),util[_0x50f4('0x5b')](_0x50f4('0x5c'),_0x3d5738['id']),_0x448b73);})[_0x50f4('0x28')](function(){return _0x3d5738;});})[_0x50f4('0x28')](respondWithResult(_0x10057d,0xc9))['catch'](handleError(_0x10057d,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2ee39be..753ca82 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 _0x1494=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','cm_custom_fields','lodash'];(function(_0x1e750b,_0x16de14){var _0x4d250d=function(_0x106f70){while(--_0x106f70){_0x1e750b['push'](_0x1e750b['shift']());}};_0x4d250d(++_0x16de14);}(_0x1494,0x81));var _0x4149=function(_0x3dfe90,_0x522c7f){_0x3dfe90=_0x3dfe90-0x0;var _0x382e8c=_0x1494[_0x3dfe90];return _0x382e8c;};'use strict';var _=require(_0x4149('0x0'));var util=require('util');var logger=require(_0x4149('0x1'))(_0x4149('0x2'));var moment=require(_0x4149('0x3'));var BPromise=require('bluebird');var rp=require(_0x4149('0x4'));var fs=require('fs');var path=require(_0x4149('0x5'));var rimraf=require(_0x4149('0x6'));var config=require(_0x4149('0x7'));var attributes=require(_0x4149('0x8'));module['exports']=function(_0x11f7f3,_0x577cfc){return _0x11f7f3['define']('CmCustomField',attributes,{'tableName':_0x4149('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95f1=['cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','define','CmCustomField'];(function(_0x2904e4,_0x770b49){var _0x3a67ac=function(_0x6515f){while(--_0x6515f){_0x2904e4['push'](_0x2904e4['shift']());}};_0x3a67ac(++_0x770b49);}(_0x95f1,0x76));var _0x195f=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x95f1[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x195f('0x0'));var util=require('util');var logger=require(_0x195f('0x1'))(_0x195f('0x2'));var moment=require(_0x195f('0x3'));var BPromise=require(_0x195f('0x4'));var rp=require(_0x195f('0x5'));var fs=require('fs');var path=require(_0x195f('0x6'));var rimraf=require(_0x195f('0x7'));var config=require('../../config/environment');var attributes=require(_0x195f('0x8'));module[_0x195f('0x9')]=function(_0x4c7622,_0x41e61e){return _0x4c7622[_0x195f('0xa')](_0x195f('0xb'),attributes,{'tableName':_0x195f('0xc'),'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 86d760a..1f79b34 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 _0xa4ab=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0xa4ab,0xf0));var _0xba4a=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0xa4ab[_0x279ab1];return _0x8ba87c;};'use strict';var _=require('lodash');var util=require(_0xba4a('0x0'));var moment=require(_0xba4a('0x1'));var BPromise=require('bluebird');var rs=require(_0xba4a('0x2'));var fs=require('fs');var Redis=require(_0xba4a('0x3'));var db=require(_0xba4a('0x4'))['db'];var utils=require(_0xba4a('0x5'));var logger=require(_0xba4a('0x6'))('rpc');var config=require(_0xba4a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4051f7,_0x3bfbd1,_0x2336ba){return new BPromise(function(_0x1a5e94,_0xa0109d){return client[_0xba4a('0x8')](_0x4051f7,_0x2336ba)['then'](function(_0x4a8a2a){logger['info'](_0xba4a('0x9'),_0x3bfbd1,_0xba4a('0xa'));logger[_0xba4a('0xb')](_0xba4a('0xc'),_0x3bfbd1,_0xba4a('0xa'),JSON[_0xba4a('0xd')](_0x4a8a2a));if(_0x4a8a2a[_0xba4a('0xe')]){if(_0x4a8a2a['error'][_0xba4a('0xf')]===0x1f4){logger[_0xba4a('0xe')](_0xba4a('0x9'),_0x3bfbd1,_0x4a8a2a[_0xba4a('0xe')][_0xba4a('0x10')]);return _0xa0109d(_0x4a8a2a[_0xba4a('0xe')][_0xba4a('0x10')]);}logger[_0xba4a('0xe')]('CmCustomField,\x20%s,\x20%s',_0x3bfbd1,_0x4a8a2a[_0xba4a('0xe')][_0xba4a('0x10')]);return _0x1a5e94(_0x4a8a2a[_0xba4a('0xe')]['message']);}else{logger['info'](_0xba4a('0x9'),_0x3bfbd1,_0xba4a('0xa'));_0x1a5e94(_0x4a8a2a[_0xba4a('0x11')][_0xba4a('0x10')]);}})['catch'](function(_0x409a3f){logger[_0xba4a('0xe')](_0xba4a('0x9'),_0x3bfbd1,_0x409a3f);_0xa0109d(_0x409a3f);});});} \ No newline at end of file +var _0x9de4=['stringify','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x434783,_0xff395d){var _0x13efcf=function(_0x235dac){while(--_0x235dac){_0x434783['push'](_0x434783['shift']());}};_0x13efcf(++_0xff395d);}(_0x9de4,0xcc));var _0x49de=function(_0x22fbef,_0x4e9e4e){_0x22fbef=_0x22fbef-0x0;var _0x2e519b=_0x9de4[_0x22fbef];return _0x2e519b;};'use strict';var _=require('lodash');var util=require(_0x49de('0x0'));var moment=require('moment');var BPromise=require(_0x49de('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49de('0x2'))['db'];var utils=require(_0x49de('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x49de('0x4'));var jayson=require(_0x49de('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x342d99,_0x26b8c8,_0x4898a9){return new BPromise(function(_0x19deff,_0xdcdbca){return client[_0x49de('0x6')](_0x342d99,_0x4898a9)[_0x49de('0x7')](function(_0x147022){logger[_0x49de('0x8')](_0x49de('0x9'),_0x26b8c8,_0x49de('0xa'));logger['debug'](_0x49de('0xb'),_0x26b8c8,_0x49de('0xa'),JSON[_0x49de('0xc')](_0x147022));if(_0x147022[_0x49de('0xd')]){if(_0x147022[_0x49de('0xd')][_0x49de('0xe')]===0x1f4){logger[_0x49de('0xd')](_0x49de('0x9'),_0x26b8c8,_0x147022[_0x49de('0xd')][_0x49de('0xf')]);return _0xdcdbca(_0x147022[_0x49de('0xd')][_0x49de('0xf')]);}logger[_0x49de('0xd')](_0x49de('0x9'),_0x26b8c8,_0x147022[_0x49de('0xd')][_0x49de('0xf')]);return _0x19deff(_0x147022[_0x49de('0xd')][_0x49de('0xf')]);}else{logger[_0x49de('0x8')](_0x49de('0x9'),_0x26b8c8,'request\x20sent');_0x19deff(_0x147022[_0x49de('0x10')][_0x49de('0xf')]);}})[_0x49de('0x11')](function(_0x4db38c){logger[_0x49de('0xd')](_0x49de('0x9'),_0x26b8c8,_0x4db38c);_0xdcdbca(_0x4db38c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d738812..f3b1ce1 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 _0x370d=['update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x10921a,_0x16bc89){var _0x2c8d0c=function(_0x1ff7c3){while(--_0x1ff7c3){_0x10921a['push'](_0x10921a['shift']());}};_0x2c8d0c(++_0x16bc89);}(_0x370d,0x194));var _0xd370=function(_0x275bb5,_0x519dc9){_0x275bb5=_0x275bb5-0x0;var _0x26d223=_0x370d[_0x275bb5];return _0x26d223;};'use strict';var multer=require(_0xd370('0x0'));var util=require('util');var path=require(_0xd370('0x1'));var timeout=require('connect-timeout');var express=require(_0xd370('0x2'));var router=express[_0xd370('0x3')]();var fs_extra=require(_0xd370('0x4'));var auth=require(_0xd370('0x5'));var interaction=require(_0xd370('0x6'));var config=require(_0xd370('0x7'));var controller=require(_0xd370('0x8'));router[_0xd370('0x9')]('/',auth[_0xd370('0xa')](),controller[_0xd370('0xb')]);router[_0xd370('0x9')](_0xd370('0xc'),auth['isAuthenticated'](),controller[_0xd370('0xd')]);router['post']('/',auth[_0xd370('0xa')](),controller[_0xd370('0xe')]);router[_0xd370('0xf')](_0xd370('0xc'),auth[_0xd370('0xa')](),controller[_0xd370('0x10')]);router[_0xd370('0x11')]('/:id',auth[_0xd370('0xa')](),controller[_0xd370('0x12')]);module[_0xd370('0x13')]=router; \ No newline at end of file +var _0x1c9c=['get','index','isAuthenticated','show','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x878bbc,_0x548a12){var _0x12cd2a=function(_0x4bb213){while(--_0x4bb213){_0x878bbc['push'](_0x878bbc['shift']());}};_0x12cd2a(++_0x548a12);}(_0x1c9c,0xa7));var _0xc1c9=function(_0x71a70,_0x4e1cdd){_0x71a70=_0x71a70-0x0;var _0x3a2b22=_0x1c9c[_0x71a70];return _0x3a2b22;};'use strict';var multer=require('multer');var util=require(_0xc1c9('0x0'));var path=require(_0xc1c9('0x1'));var timeout=require(_0xc1c9('0x2'));var express=require(_0xc1c9('0x3'));var router=express['Router']();var fs_extra=require(_0xc1c9('0x4'));var auth=require(_0xc1c9('0x5'));var interaction=require(_0xc1c9('0x6'));var config=require(_0xc1c9('0x7'));var controller=require(_0xc1c9('0x8'));router[_0xc1c9('0x9')]('/',auth['isAuthenticated'](),controller[_0xc1c9('0xa')]);router['get']('/:id',auth[_0xc1c9('0xb')](),controller[_0xc1c9('0xc')]);router['post']('/',auth[_0xc1c9('0xb')](),controller['create']);router['put'](_0xc1c9('0xd'),auth[_0xc1c9('0xb')](),controller['update']);router['delete'](_0xc1c9('0xd'),auth[_0xc1c9('0xb')](),controller[_0xc1c9('0xe')]);module[_0xc1c9('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7286cbf..3e63bcf 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 _0x3e34=['contactListQueue','sequelize','exports','STRING','BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE'];(function(_0x568e94,_0x3aa72a){var _0x49f530=function(_0x2de179){while(--_0x2de179){_0x568e94['push'](_0x568e94['shift']());}};_0x49f530(++_0x3aa72a);}(_0x3e34,0x1d9));var _0x43e3=function(_0x207e50,_0x52fd80){_0x207e50=_0x207e50-0x0;var _0x5db528=_0x3e34[_0x207e50];return _0x5db528;};'use strict';var moment=require('moment');var Sequelize=require(_0x43e3('0x0'));module[_0x43e3('0x1')]={'phone':{'type':Sequelize[_0x43e3('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x43e3('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x43e3('0x4'))},'countbusyretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x43e3('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x43e3('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x43e3('0x6')]},'priority':{'type':Sequelize[_0x43e3('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x43e3('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x43e3('0x5')],'unique':_0x43e3('0x7')},'ListId':{'type':Sequelize[_0x43e3('0x5')],'unique':_0x43e3('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x43e3('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x43e3('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x43e3('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x43e3('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xce84=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports'];(function(_0x4eeb47,_0x1a36ab){var _0x5eea2d=function(_0x24c70d){while(--_0x24c70d){_0x4eeb47['push'](_0x4eeb47['shift']());}};_0x5eea2d(++_0x1a36ab);}(_0xce84,0x166));var _0x4ce8=function(_0x54d5b7,_0x24e73f){_0x54d5b7=_0x54d5b7-0x0;var _0x5ade77=_0xce84[_0x54d5b7];return _0x5ade77;};'use strict';var moment=require(_0x4ce8('0x0'));var Sequelize=require('sequelize');module[_0x4ce8('0x1')]={'phone':{'type':Sequelize[_0x4ce8('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x4ce8('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x4ce8('0x4')],'defaultValue':moment()[_0x4ce8('0x5')](_0x4ce8('0x6'))},'countbusyretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4ce8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4ce8('0x4')]},'priority':{'type':Sequelize[_0x4ce8('0x7')](0x2)[_0x4ce8('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x4ce8('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x4ce8('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4ce8('0x7')],'unique':_0x4ce8('0x9')},'UserId':{'type':Sequelize[_0x4ce8('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x4ce8('0x7')],'unique':_0x4ce8('0x9')},'CampaignId':{'type':Sequelize[_0x4ce8('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4ce8('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x4ce8('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4ce8('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x4ce8('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 a63c6c3..d0102ea 100644 --- a/server/api/cmHopper/cmHopper.controller.js +++ b/server/api/cmHopper/cmHopper.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf2cb=['transaction','YYYY-MM-DD\x20HH:mm:ss','value','direction','hopperIds','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','DESC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','CmCompany','getOpenContacts','format','isNil','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','lodash','../../config/logger','../../config/environment','json','offset','limit','count','status','set','Content-Range','update','then','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','query','keys','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','statedesc','deleted','campaign','user','deletedat','campaigntype','queue','ivr','CmContact','ContactId','firstName','calleridname','lastName','finally','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2cb,0x130));var _0xbf2c=function(_0x406e73,_0x5d0716){_0x406e73=_0x406e73-0x0;var _0x1b844f=_0xf2cb[_0x406e73];return _0x1b844f;};'use strict';var moment=require('moment');var _=require(_0xbf2c('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0xbf2c('0x1'))('api');var shared=require(_0xbf2c('0x2'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x1ecb79,_0x41c649){_0x41c649=_0x41c649||0xc8;return function(_0x5abeb3){if(_0x5abeb3){return _0x1ecb79['status'](_0x41c649)[_0xbf2c('0x3')](_0x5abeb3);}};}function respondWithFilteredResult(_0x46d282,_0x1fc371){return function(_0xaacd25){if(_0xaacd25){var _0x516715=typeof _0x1fc371[_0xbf2c('0x4')]==='undefined'&&typeof _0x1fc371[_0xbf2c('0x5')]==='undefined';var _0x5f25ea=_0xaacd25[_0xbf2c('0x6')];var _0x16c303=_0x516715?0x0:_0x1fc371[_0xbf2c('0x4')];var _0x5e10f4=_0x516715?_0xaacd25[_0xbf2c('0x6')]:_0x1fc371[_0xbf2c('0x4')]+_0x1fc371[_0xbf2c('0x5')];var _0x27be1c;if(_0x5e10f4>=_0x5f25ea){_0x5e10f4=_0x5f25ea;_0x27be1c=0xc8;}else{_0x27be1c=0xce;}_0x46d282[_0xbf2c('0x7')](_0x27be1c);return _0x46d282[_0xbf2c('0x8')](_0xbf2c('0x9'),_0x16c303+'-'+_0x5e10f4+'/'+_0x5f25ea)[_0xbf2c('0x3')](_0xaacd25);}return null;};}function saveUpdates(_0x52983d,_0x149235){return function(_0x294d0d){if(_0x294d0d){return _0x294d0d[_0xbf2c('0xa')](_0x52983d)[_0xbf2c('0xb')](function(_0x5220e2){return _0x5220e2;});}return null;};}function handleEntityNotFound(_0x7665b1,_0x5a160b){return function(_0x557740){if(!_0x557740){_0x7665b1[_0xbf2c('0xc')](0x194);}return _0x557740;};}function handleError(_0x4f58c7,_0x47df49){_0x47df49=_0x47df49||0x1f4;return function(_0x3ed1c3){logger[_0xbf2c('0xd')](_0x3ed1c3[_0xbf2c('0xe')]);if(_0x3ed1c3[_0xbf2c('0xf')]){delete _0x3ed1c3[_0xbf2c('0xf')];}_0x4f58c7['status'](_0x47df49)[_0xbf2c('0x10')](_0x3ed1c3);};}exports['index']=function(_0x4ced7f,_0x1df2ab){var _0x298329={},_0x32a44d={},_0x266035={'count':0x0,'rows':[]};var _0x57e01a=_[_0xbf2c('0x11')](db[_0xbf2c('0x12')][_0xbf2c('0x13')],function(_0x5353e7){return{'name':_0x5353e7[_0xbf2c('0x14')],'type':_0x5353e7[_0xbf2c('0x15')][_0xbf2c('0x16')]};});_0x32a44d['model']=_[_0xbf2c('0x11')](_0x57e01a,_0xbf2c('0xf'));_0x32a44d[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x4ced7f['query']);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x32a44d['model'],_0x32a44d[_0xbf2c('0x17')]);_0x32a44d[_0xbf2c('0x19')]=_[_0xbf2c('0x1b')](_0x32a44d['filters'],['$and',_0xbf2c('0x1c'),_0xbf2c('0x1d'),_0xbf2c('0x1e'),_0xbf2c('0x1f'),_0xbf2c('0x20'),_0xbf2c('0x21'),_0xbf2c('0x22'),'$not','$between',_0xbf2c('0x23'),_0xbf2c('0x24'),_0xbf2c('0x25'),_0xbf2c('0x26'),_0xbf2c('0x27'),_0xbf2c('0x28'),_0xbf2c('0x29'),_0xbf2c('0x26'),_0xbf2c('0x2a'),'$contains',_0xbf2c('0x2b'),'$any']);_0x298329[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x32a44d[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x4ced7f[_0xbf2c('0x17')]['fields']));_0x298329[_0xbf2c('0x2c')]=_0x298329[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x298329[_0xbf2c('0x2c')]:_0x32a44d[_0xbf2c('0x2d')];if(!_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x30')](_0xbf2c('0x31'))){_0x298329['limit']=qs[_0xbf2c('0x5')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x5')]);_0x298329['offset']=qs['offset'](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x4')]);}_0x298329[_0xbf2c('0x32')]=qs[_0xbf2c('0x33')](_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x33')]);_0x298329[_0xbf2c('0x34')]=qs[_0xbf2c('0x19')](_[_0xbf2c('0x35')](_0x4ced7f['query'],_0x32a44d[_0xbf2c('0x19')]),_0x57e01a);if(_0x4ced7f[_0xbf2c('0x17')][_0xbf2c('0x36')]){_0x298329[_0xbf2c('0x34')]=_[_0xbf2c('0x37')](_0x298329[_0xbf2c('0x34')],{'$or':_[_0xbf2c('0x11')](_0x57e01a,function(_0x4722b3){if(_0x4722b3['type']!==_0xbf2c('0x38')){var _0x475594={};_0x475594[_0x4722b3[_0xbf2c('0xf')]]={'$like':'%'+_0x4ced7f['query'][_0xbf2c('0x36')]+'%'};return _0x475594;}})});}_0x298329=_[_0xbf2c('0x37')]({},_0x298329,_0x4ced7f[_0xbf2c('0x39')]);var _0x5402ff={'where':_0x298329[_0xbf2c('0x34')]};return db[_0xbf2c('0x12')]['count'](_0x5402ff)['then'](function(_0x47ab9a){_0x266035['count']=_0x47ab9a;if(_0x4ced7f['query'][_0xbf2c('0x3a')]){_0x298329[_0xbf2c('0x3b')]=[{'all':!![]}];}return db[_0xbf2c('0x12')][_0xbf2c('0x3c')](_0x298329);})[_0xbf2c('0xb')](function(_0x16fbd5){_0x266035[_0xbf2c('0x3d')]=_0x16fbd5;return _0x266035;})[_0xbf2c('0xb')](respondWithFilteredResult(_0x1df2ab,_0x298329))[_0xbf2c('0x3e')](handleError(_0x1df2ab,null));};exports[_0xbf2c('0x3f')]=function(_0x245eaf,_0x99abc8){var _0x3fbf90={'raw':!![],'where':{'id':_0x245eaf[_0xbf2c('0x40')]['id']}},_0x1eac50={};_0x1eac50[_0xbf2c('0x2d')]=_['keys'](db[_0xbf2c('0x12')][_0xbf2c('0x13')]);_0x1eac50[_0xbf2c('0x17')]=_[_0xbf2c('0x18')](_0x245eaf[_0xbf2c('0x17')]);_0x1eac50[_0xbf2c('0x19')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],_0x1eac50['query']);_0x3fbf90[_0xbf2c('0x2c')]=_[_0xbf2c('0x1a')](_0x1eac50[_0xbf2c('0x2d')],qs[_0xbf2c('0x2e')](_0x245eaf['query'][_0xbf2c('0x2e')]));_0x3fbf90['attributes']=_0x3fbf90[_0xbf2c('0x2c')][_0xbf2c('0x2f')]?_0x3fbf90[_0xbf2c('0x2c')]:_0x1eac50[_0xbf2c('0x2d')];if(_0x245eaf[_0xbf2c('0x17')][_0xbf2c('0x3a')]){_0x3fbf90['include']=[{'all':!![]}];}_0x3fbf90=_[_0xbf2c('0x37')]({},_0x3fbf90,_0x245eaf['options']);return db['CmHopper'][_0xbf2c('0x41')](_0x3fbf90)['then'](handleEntityNotFound(_0x99abc8,null))['then'](respondWithResult(_0x99abc8,null))[_0xbf2c('0x3e')](handleError(_0x99abc8,null));};exports[_0xbf2c('0x42')]=function(_0x56fc01,_0x403568){return db['CmHopper'][_0xbf2c('0x42')](_0x56fc01['body'],{})[_0xbf2c('0xb')](respondWithResult(_0x403568,0xc9))[_0xbf2c('0x3e')](handleError(_0x403568,null));};exports[_0xbf2c('0xa')]=function(_0x343255,_0x222721){if(_0x343255[_0xbf2c('0x43')]['id']){delete _0x343255['body']['id'];}return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x343255[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x222721,null))[_0xbf2c('0xb')](saveUpdates(_0x343255['body'],null))['then'](respondWithResult(_0x222721,null))[_0xbf2c('0x3e')](handleError(_0x222721,null));};exports['describe']=function(_0xa08482,_0x1c64e0){return db[_0xbf2c('0x12')][_0xbf2c('0x44')]()[_0xbf2c('0xb')](respondWithResult(_0x1c64e0,null))[_0xbf2c('0x3e')](handleError(_0x1c64e0,null));};exports[_0xbf2c('0x45')]=function(_0x1c3b78,_0x128e97){var _0x23912d;var _0x31791b=_0x1c3b78['params']['id'];return db[_0xbf2c('0x12')][_0xbf2c('0x41')]({'where':{'id':_0x1c3b78[_0xbf2c('0x40')]['id']}})[_0xbf2c('0xb')](handleEntityNotFound(_0x128e97,null))['then'](function(_0x4edca4){if(_0x4edca4){return _0x4edca4['destroy']()[_0xbf2c('0xb')](function(_0x2451ba){return _0x2451ba;});}})['then'](function(_0x5a0c37){_0x23912d=_0x5a0c37;if(_0x5a0c37){if(_0x5a0c37['VoiceQueueId']||_0x5a0c37[_0xbf2c('0x46')]){return db[_0x5a0c37[_0xbf2c('0x47')]?_0xbf2c('0x48'):_0xbf2c('0x49')][_0xbf2c('0x41')]({'where':{'id':_0x5a0c37[_0xbf2c('0x47')]?_0x5a0c37['VoiceQueueId']:_0x5a0c37[_0xbf2c('0x46')]},'attributes':['id',_0xbf2c('0xf')],'raw':!![]});}}})[_0xbf2c('0xb')](function(_0x3fa07e){var _0x36d1ec={};if(_0x3fa07e){_[_0xbf2c('0x37')](_0x36d1ec,_[_0xbf2c('0x4a')](_0x23912d[_0xbf2c('0x4b')],['createdAt','updatedAt','id']));_0x36d1ec['state']=0x15;_0x36d1ec[_0xbf2c('0x4c')]=_0xbf2c('0x4d');_0x36d1ec[_0xbf2c('0x4e')]=_0x3fa07e[_0xbf2c('0xf')];_0x36d1ec['membername']=_0x1c3b78[_0xbf2c('0x4f')][_0xbf2c('0xf')];_0x36d1ec['UserId']=_0x1c3b78[_0xbf2c('0x4f')]['id'];_0x36d1ec[_0xbf2c('0x4d')]=!![];_0x36d1ec[_0xbf2c('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x36d1ec['calleridnum']=_0x23912d['phone'];_0x36d1ec[_0xbf2c('0x51')]=_0x23912d[_0xbf2c('0x47')]?_0xbf2c('0x52'):_0xbf2c('0x53');return db[_0xbf2c('0x54')]['find']({'where':{'id':_0x36d1ec[_0xbf2c('0x55')]},'attributes':[_0xbf2c('0x56'),'lastName']})[_0xbf2c('0xb')](function(_0x3f0129){if(!_['isNil'](_0x128e97)&&!_['isNil'](_0x3f0129['firstName'])){_0x36d1ec[_0xbf2c('0x57')]=_0x3f0129['firstName'];if(!_['isNil'](_0x3f0129[_0xbf2c('0x58')])){_0x36d1ec[_0xbf2c('0x57')]+='\x20'+_0x3f0129[_0xbf2c('0x58')];}}})[_0xbf2c('0x59')](function(){return db['CmHopperFinal']['create'](_0x36d1ec);});}})[_0xbf2c('0xb')](function(_0xc0b6ff){return db[_0xbf2c('0x5a')][_0xbf2c('0x45')]({'where':{'CmHopperId':_0x31791b}});})[_0xbf2c('0xb')](function(){return _0x128e97['status'](0xcc)['end']();})[_0xbf2c('0x3e')](handleError(_0x128e97,null));};exports[_0xbf2c('0x5b')]=function(_0x40f93e,_0x45b91c){var _0x1f984e=[];return db[_0xbf2c('0x54')]['describe']()['then'](function(_0x47b287){_0x1f984e=_[_0xbf2c('0x18')](_0x47b287);return _0x40f93e[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id',_0xbf2c('0x5f'),_0xbf2c('0x60')],'raw':!![]});})[_0xbf2c('0xb')](function(_0x50d44d){if(_0x50d44d&&_0x50d44d['length']){return db[_0xbf2c('0x61')][_0xbf2c('0x62')](function(_0x38ce66){var _0x42f789={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x50d44d,'id')},'$or':[{'UserId':null},{'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']}]};var _0x4ed155={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d44d)[_0xbf2c('0x36')]([_0xbf2c('0x60'),0x0])[_0xbf2c('0x11')]('id')[_0xbf2c('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x40f93e['user']['id']}]};var _0x3e9448={'$or':[_0x42f789,_0x4ed155]};var _0x12bee7=[];if(_0x40f93e[_0xbf2c('0x43')]['direction']&&_0x40f93e['body'][_0xbf2c('0x65')]==='prev'){if(!_['isEmpty'](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$in':_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),'ASC'],['scheduledAt',_0x50d44d[0x0][_0xbf2c('0x5f')]===_0xbf2c('0x68')?'DESC':_0xbf2c('0x68')],db[_0xbf2c('0x61')]['literal'](_0xbf2c('0x69')),['id','DESC']];}else{if(!_[_0xbf2c('0x6a')](_0x40f93e[_0xbf2c('0x43')][_0xbf2c('0x66')])){_0x3e9448['id']={'$notIn':_0x40f93e['body'][_0xbf2c('0x66')]};}_0x12bee7=[[_0xbf2c('0x67'),_0xbf2c('0x6b')],[_0xbf2c('0x6c'),_0x50d44d[0x0][_0xbf2c('0x5f')]],db[_0xbf2c('0x61')][_0xbf2c('0x6d')](_0xbf2c('0x6e')),['id',_0xbf2c('0x68')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbf2c('0x6f'),_0xbf2c('0x70'),_0xbf2c('0x71')],'where':_0x3e9448,'order':_0x12bee7,'transaction':_0x38ce66,'lock':_0x38ce66[_0xbf2c('0x72')][_0xbf2c('0x73')],'include':[{'model':db[_0xbf2c('0x54')],'as':_0xbf2c('0x74'),'attributes':_0x1f984e,'include':[{'model':db['CmCompany'],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':_0xbf2c('0x77'),'attributes':['id',_0xbf2c('0xf')]},{'model':db['VoiceQueue'],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x4e7b32){if(_0x4e7b32){return _0x4e7b32[_0xbf2c('0xa')]({'UserId':_0x40f93e[_0xbf2c('0x4f')]['id']},{'transaction':_0x38ce66});}});});}})[_0xbf2c('0xb')](handleEntityNotFound(_0x45b91c,null))[_0xbf2c('0xb')](respondWithResult(_0x45b91c,null))[_0xbf2c('0x3e')](handleError(_0x45b91c,null));};exports[_0xbf2c('0x7a')]=function(_0x2029f7,_0x290f8c,_0x51617d){var _0x79cc7=[];var _0x5440a8=_0x2029f7[_0xbf2c('0x40')]['id'];var _0x12b821=_0x2029f7[_0xbf2c('0x4f')]['id'];return db['CmContact'][_0xbf2c('0x44')]()[_0xbf2c('0xb')](function(_0x4ff5c3){_0x79cc7=_[_0xbf2c('0x18')](_0x4ff5c3);return db['sequelize'][_0xbf2c('0x62')](function(_0x357989){const _0x307e46={'id':_0x5440a8};return db[_0xbf2c('0x12')]['findOne']({'attributes':['id','scheduledat',_0xbf2c('0x71')],'where':_0x307e46,'transaction':_0x357989,'lock':_0x357989[_0xbf2c('0x72')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbf2c('0x74'),'attributes':_0x79cc7,'include':[{'model':db[_0xbf2c('0x7b')],'as':_0xbf2c('0x75'),'attributes':['id',_0xbf2c('0xf')]}]},{'model':db[_0xbf2c('0x76')],'as':'List','attributes':['id',_0xbf2c('0xf')]},{'model':db[_0xbf2c('0x48')],'as':_0xbf2c('0x78'),'attributes':['id',_0xbf2c('0xf'),_0xbf2c('0x79')]}]})[_0xbf2c('0xb')](function(_0x26fdee){if(_0x26fdee){return _0x26fdee[_0xbf2c('0xa')]({'UserId':_0x12b821},{'transaction':_0x357989});}});});})[_0xbf2c('0xb')](handleEntityNotFound(_0x290f8c,null))[_0xbf2c('0xb')](respondWithResult(_0x290f8c,null))[_0xbf2c('0x3e')](handleError(_0x290f8c,null));};exports[_0xbf2c('0x7c')]=function(_0x5ecd37,_0x3ab5ac){return _0x5ecd37[_0xbf2c('0x4f')][_0xbf2c('0x5c')]({'where':{'type':_0xbf2c('0x5d'),'dialActive':!![],'dialMethod':_0xbf2c('0x5e')},'attributes':['id'],'raw':!![]})[_0xbf2c('0xb')](function(_0x545447){if(_0x545447&&_0x545447[_0xbf2c('0x2f')]){return db[_0xbf2c('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbf2c('0x7d')](_0xbf2c('0x63'))},'VoiceQueueId':{'$in':_[_0xbf2c('0x11')](_0x545447,'id')},'$or':[{'UserId':null},{'UserId':_0x5ecd37[_0xbf2c('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x2c7cf7){if(!_[_0xbf2c('0x7e')](_0x2c7cf7)&&_['isNumber'](_0x2c7cf7)){return _0x3ab5ac[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'contacts':_0x2c7cf7});}else{logger[_0xbf2c('0xd')](_0xbf2c('0x7f'),_0xbf2c('0x7c'),0x194,_0xbf2c('0x80'));_0x3ab5ac['sendStatus'](0x194);}})[_0xbf2c('0x3e')](handleError(_0x3ab5ac,null));};exports[_0xbf2c('0x81')]=function(_0x1377c1,_0x4fa011){var _0x2aa3c3=shared[_0xbf2c('0x82')];var _0x40681f=[];_[_0xbf2c('0x11')](_0x2aa3c3,function(_0x5f4f90){_0x40681f[_0xbf2c('0x83')]({'id':_0x5f4f90[_0xbf2c('0xf')],'name':_0x5f4f90[_0xbf2c('0xf')],'utcOffset':_0x5f4f90[_0xbf2c('0x84')]});});return _0x4fa011[_0xbf2c('0x7')](0xc8)[_0xbf2c('0x3')]({'tz':_0x40681f});};exports[_0xbf2c('0x85')]=function(_0x31d6f,_0x2fcb0a){var _0x391208=shared[_0xbf2c('0x82')];var _0x560da4={};if(!_[_0xbf2c('0x7e')](_0x391208[_0x31d6f['body']['id']]))_0x560da4=_0x391208[_0x31d6f[_0xbf2c('0x43')]['id']];return _0x2fcb0a[_0xbf2c('0x7')](0xc8)['json'](_0x560da4);}; \ No newline at end of file +var _0x4944=['keys','filters','concat','$and','$gt','$gte','$lte','$ne','$eq','$between','$in','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','getPreviewRecall','recallme','LOCK','List','Queue','dialActive','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','update','sendStatus','error','name','CmHopper','rawAttributes','type','key','model','map','query'];(function(_0x4b8cb9,_0x4aef43){var _0x513573=function(_0x2307a4){while(--_0x2307a4){_0x4b8cb9['push'](_0x4b8cb9['shift']());}};_0x513573(++_0x4aef43);}(_0x4944,0x6d));var _0x4494=function(_0x4d2122,_0xee8861){_0x4d2122=_0x4d2122-0x0;var _0x30a26a=_0x4944[_0x4d2122];return _0x30a26a;};'use strict';var moment=require(_0x4494('0x0'));var _=require('lodash');var qs=require(_0x4494('0x1'));var logger=require(_0x4494('0x2'))(_0x4494('0x3'));var shared=require(_0x4494('0x4'));var db=require(_0x4494('0x5'))['db'];function respondWithResult(_0x5074d9,_0x187098){_0x187098=_0x187098||0xc8;return function(_0x5c7492){if(_0x5c7492){return _0x5074d9[_0x4494('0x6')](_0x187098)[_0x4494('0x7')](_0x5c7492);}};}function respondWithFilteredResult(_0x38480d,_0xb94d02){return function(_0x2a4911){if(_0x2a4911){var _0x1a94d6=typeof _0xb94d02[_0x4494('0x8')]===_0x4494('0x9')&&typeof _0xb94d02[_0x4494('0xa')]==='undefined';var _0x1b6476=_0x2a4911[_0x4494('0xb')];var _0x461525=_0x1a94d6?0x0:_0xb94d02[_0x4494('0x8')];var _0x4acf68=_0x1a94d6?_0x2a4911['count']:_0xb94d02[_0x4494('0x8')]+_0xb94d02[_0x4494('0xa')];var _0xec70eb;if(_0x4acf68>=_0x1b6476){_0x4acf68=_0x1b6476;_0xec70eb=0xc8;}else{_0xec70eb=0xce;}_0x38480d['status'](_0xec70eb);return _0x38480d['set'](_0x4494('0xc'),_0x461525+'-'+_0x4acf68+'/'+_0x1b6476)[_0x4494('0x7')](_0x2a4911);}return null;};}function saveUpdates(_0x221a1d,_0x1c9750){return function(_0x40ee8d){if(_0x40ee8d){return _0x40ee8d[_0x4494('0xd')](_0x221a1d)['then'](function(_0x34959d){return _0x34959d;});}return null;};}function handleEntityNotFound(_0x2325f4,_0x45825c){return function(_0x259e03){if(!_0x259e03){_0x2325f4[_0x4494('0xe')](0x194);}return _0x259e03;};}function handleError(_0x8506a0,_0x3847d6){_0x3847d6=_0x3847d6||0x1f4;return function(_0x53fed5){logger[_0x4494('0xf')](_0x53fed5['stack']);if(_0x53fed5['name']){delete _0x53fed5[_0x4494('0x10')];}_0x8506a0[_0x4494('0x6')](_0x3847d6)['send'](_0x53fed5);};}exports['index']=function(_0xcbe5a4,_0x574fbb){var _0x4655ce={},_0x42880b={},_0x507339={'count':0x0,'rows':[]};var _0x22ed31=_['map'](db[_0x4494('0x11')][_0x4494('0x12')],function(_0x5bedb6){return{'name':_0x5bedb6['fieldName'],'type':_0x5bedb6[_0x4494('0x13')][_0x4494('0x14')]};});_0x42880b[_0x4494('0x15')]=_[_0x4494('0x16')](_0x22ed31,_0x4494('0x10'));_0x42880b[_0x4494('0x17')]=_[_0x4494('0x18')](_0xcbe5a4[_0x4494('0x17')]);_0x42880b['filters']=_['intersection'](_0x42880b['model'],_0x42880b['query']);_0x42880b[_0x4494('0x19')]=_[_0x4494('0x1a')](_0x42880b[_0x4494('0x19')],[_0x4494('0x1b'),'$or',_0x4494('0x1c'),_0x4494('0x1d'),'$lt',_0x4494('0x1e'),_0x4494('0x1f'),_0x4494('0x20'),'$not',_0x4494('0x21'),'$notBetween',_0x4494('0x22'),'$notIn',_0x4494('0x23'),_0x4494('0x24'),_0x4494('0x25'),'$notILike',_0x4494('0x23'),_0x4494('0x26'),'$contains',_0x4494('0x27'),_0x4494('0x28')]);_0x4655ce[_0x4494('0x29')]=_['intersection'](_0x42880b[_0x4494('0x15')],qs[_0x4494('0x2a')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2a')]));_0x4655ce[_0x4494('0x29')]=_0x4655ce[_0x4494('0x29')][_0x4494('0x2b')]?_0x4655ce[_0x4494('0x29')]:_0x42880b['model'];if(!_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2c')](_0x4494('0x2d'))){_0x4655ce['limit']=qs[_0x4494('0xa')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0xa')]);_0x4655ce[_0x4494('0x8')]=qs[_0x4494('0x8')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x8')]);}_0x4655ce['order']=qs[_0x4494('0x2e')](_0xcbe5a4[_0x4494('0x17')][_0x4494('0x2e')]);_0x4655ce[_0x4494('0x2f')]=qs[_0x4494('0x19')](_[_0x4494('0x30')](_0xcbe5a4['query'],_0x42880b[_0x4494('0x19')]),_0x22ed31);if(_0xcbe5a4[_0x4494('0x17')][_0x4494('0x31')]){_0x4655ce[_0x4494('0x2f')]=_[_0x4494('0x32')](_0x4655ce['where'],{'$or':_[_0x4494('0x16')](_0x22ed31,function(_0x4dbe69){if(_0x4dbe69['type']!==_0x4494('0x33')){var _0x49a5c6={};_0x49a5c6[_0x4dbe69['name']]={'$like':'%'+_0xcbe5a4['query'][_0x4494('0x31')]+'%'};return _0x49a5c6;}})});}_0x4655ce=_[_0x4494('0x32')]({},_0x4655ce,_0xcbe5a4[_0x4494('0x34')]);var _0x546133={'where':_0x4655ce['where']};return db[_0x4494('0x11')][_0x4494('0xb')](_0x546133)[_0x4494('0x35')](function(_0x166d29){_0x507339[_0x4494('0xb')]=_0x166d29;if(_0xcbe5a4[_0x4494('0x17')][_0x4494('0x36')]){_0x4655ce[_0x4494('0x37')]=[{'all':!![]}];}return db[_0x4494('0x11')][_0x4494('0x38')](_0x4655ce);})[_0x4494('0x35')](function(_0x14542e){_0x507339[_0x4494('0x39')]=_0x14542e;return _0x507339;})['then'](respondWithFilteredResult(_0x574fbb,_0x4655ce))[_0x4494('0x3a')](handleError(_0x574fbb,null));};exports[_0x4494('0x3b')]=function(_0xdb7757,_0x3bfea6){var _0x20b267={'raw':!![],'where':{'id':_0xdb7757[_0x4494('0x3c')]['id']}},_0x3cd671={};_0x3cd671[_0x4494('0x15')]=_[_0x4494('0x18')](db['CmHopper']['rawAttributes']);_0x3cd671[_0x4494('0x17')]=_['keys'](_0xdb7757[_0x4494('0x17')]);_0x3cd671[_0x4494('0x19')]=_[_0x4494('0x3d')](_0x3cd671[_0x4494('0x15')],_0x3cd671[_0x4494('0x17')]);_0x20b267['attributes']=_['intersection'](_0x3cd671[_0x4494('0x15')],qs['fields'](_0xdb7757[_0x4494('0x17')][_0x4494('0x2a')]));_0x20b267[_0x4494('0x29')]=_0x20b267[_0x4494('0x29')][_0x4494('0x2b')]?_0x20b267[_0x4494('0x29')]:_0x3cd671[_0x4494('0x15')];if(_0xdb7757['query'][_0x4494('0x36')]){_0x20b267[_0x4494('0x37')]=[{'all':!![]}];}_0x20b267=_['merge']({},_0x20b267,_0xdb7757[_0x4494('0x34')]);return db[_0x4494('0x11')][_0x4494('0x3e')](_0x20b267)['then'](handleEntityNotFound(_0x3bfea6,null))[_0x4494('0x35')](respondWithResult(_0x3bfea6,null))[_0x4494('0x3a')](handleError(_0x3bfea6,null));};exports[_0x4494('0x3f')]=function(_0x465f5e,_0x543787){return db['CmHopper'][_0x4494('0x3f')](_0x465f5e[_0x4494('0x40')],{})[_0x4494('0x35')](respondWithResult(_0x543787,0xc9))['catch'](handleError(_0x543787,null));};exports['update']=function(_0x3717ae,_0x79e98c){if(_0x3717ae[_0x4494('0x40')]['id']){delete _0x3717ae['body']['id'];}return db[_0x4494('0x11')][_0x4494('0x3e')]({'where':{'id':_0x3717ae['params']['id']}})[_0x4494('0x35')](handleEntityNotFound(_0x79e98c,null))[_0x4494('0x35')](saveUpdates(_0x3717ae[_0x4494('0x40')],null))[_0x4494('0x35')](respondWithResult(_0x79e98c,null))[_0x4494('0x3a')](handleError(_0x79e98c,null));};exports['describe']=function(_0x802d47,_0x3c5475){return db[_0x4494('0x11')][_0x4494('0x41')]()[_0x4494('0x35')](respondWithResult(_0x3c5475,null))[_0x4494('0x3a')](handleError(_0x3c5475,null));};exports[_0x4494('0x42')]=function(_0x904f3,_0x102010){var _0x157e7c;var _0x4a2d84=_0x904f3[_0x4494('0x3c')]['id'];return db['CmHopper'][_0x4494('0x3e')]({'where':{'id':_0x904f3[_0x4494('0x3c')]['id']}})[_0x4494('0x35')](handleEntityNotFound(_0x102010,null))[_0x4494('0x35')](function(_0x473b00){if(_0x473b00){return _0x473b00['destroy']()[_0x4494('0x35')](function(_0x4eb660){return _0x4eb660;});}})['then'](function(_0x584373){_0x157e7c=_0x584373;if(_0x584373){if(_0x584373['VoiceQueueId']||_0x584373['CampaignId']){return db[_0x584373[_0x4494('0x43')]?_0x4494('0x44'):_0x4494('0x45')][_0x4494('0x3e')]({'where':{'id':_0x584373[_0x4494('0x43')]?_0x584373[_0x4494('0x43')]:_0x584373[_0x4494('0x46')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x49e0d2){var _0x3ad850={};if(_0x49e0d2){_[_0x4494('0x32')](_0x3ad850,_['omit'](_0x157e7c[_0x4494('0x47')],[_0x4494('0x48'),_0x4494('0x49'),'id']));_0x3ad850[_0x4494('0x4a')]=0x15;_0x3ad850[_0x4494('0x4b')]='deleted';_0x3ad850[_0x4494('0x4c')]=_0x49e0d2['name'];_0x3ad850['membername']=_0x904f3[_0x4494('0x4d')]['name'];_0x3ad850[_0x4494('0x4e')]=_0x904f3[_0x4494('0x4d')]['id'];_0x3ad850['deleted']=!![];_0x3ad850['deletedat']=moment()[_0x4494('0x4f')](_0x4494('0x50'));_0x3ad850[_0x4494('0x51')]=_0x157e7c['phone'];_0x3ad850[_0x4494('0x52')]=_0x157e7c[_0x4494('0x43')]?_0x4494('0x53'):_0x4494('0x54');return db[_0x4494('0x55')][_0x4494('0x3e')]({'where':{'id':_0x3ad850['ContactId']},'attributes':['firstName',_0x4494('0x56')]})['then'](function(_0x1d84fe){if(!_[_0x4494('0x57')](_0x102010)&&!_[_0x4494('0x57')](_0x1d84fe['firstName'])){_0x3ad850['calleridname']=_0x1d84fe[_0x4494('0x58')];if(!_[_0x4494('0x57')](_0x1d84fe[_0x4494('0x56')])){_0x3ad850[_0x4494('0x59')]+='\x20'+_0x1d84fe[_0x4494('0x56')];}}})[_0x4494('0x5a')](function(){return db[_0x4494('0x5b')]['create'](_0x3ad850);});}})[_0x4494('0x35')](function(_0x17721d){return db['CmHopperAdditionalPhone'][_0x4494('0x42')]({'where':{'CmHopperId':_0x4a2d84}});})[_0x4494('0x35')](function(){return _0x102010[_0x4494('0x6')](0xcc)[_0x4494('0x5c')]();})[_0x4494('0x3a')](handleError(_0x102010,null));};exports[_0x4494('0x5d')]=function(_0x6a9289,_0x43583a){var _0x3a7d93=[];return db['CmContact'][_0x4494('0x41')]()['then'](function(_0x5ed118){_0x3a7d93=_[_0x4494('0x18')](_0x5ed118);return _0x6a9289[_0x4494('0x4d')]['getVoiceQueues']({'where':{'type':_0x4494('0x5e'),'dialActive':!![],'dialMethod':_0x4494('0x5f')},'attributes':['id',_0x4494('0x60'),_0x4494('0x61')],'raw':!![]});})[_0x4494('0x35')](function(_0x4e6f96){if(_0x4e6f96&&_0x4e6f96[_0x4494('0x2b')]){return db[_0x4494('0x62')][_0x4494('0x63')](function(_0x299b8c){var _0x457d76={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4494('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x4e6f96,'id')},'$or':[{'UserId':null},{'UserId':_0x6a9289[_0x4494('0x4d')]['id']}]};var _0x3722d0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4e6f96)[_0x4494('0x31')]([_0x4494('0x61'),0x0])[_0x4494('0x16')]('id')[_0x4494('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x6a9289[_0x4494('0x4d')]['id']}]};var _0x15c6c1={'$or':[_0x457d76,_0x3722d0]};var _0xa85960=[];if(_0x6a9289[_0x4494('0x40')]['direction']&&_0x6a9289['body']['direction']===_0x4494('0x65')){if(!_[_0x4494('0x66')](_0x6a9289['body'][_0x4494('0x67')])){_0x15c6c1['id']={'$in':_0x6a9289[_0x4494('0x40')][_0x4494('0x67')]};}_0xa85960=[[_0x4494('0x68'),_0x4494('0x69')],[_0x4494('0x6a'),_0x4e6f96[0x0][_0x4494('0x60')]==='ASC'?_0x4494('0x6b'):_0x4494('0x69')],db[_0x4494('0x62')][_0x4494('0x6c')](_0x4494('0x6d')),['id',_0x4494('0x6b')]];}else{if(!_[_0x4494('0x66')](_0x6a9289[_0x4494('0x40')]['hopperIds'])){_0x15c6c1['id']={'$notIn':_0x6a9289[_0x4494('0x40')]['hopperIds']};}_0xa85960=[['priority',_0x4494('0x6b')],[_0x4494('0x6a'),_0x4e6f96[0x0]['dialOrderByScheduledAt']],db['sequelize'][_0x4494('0x6c')](_0x4494('0x6e')),['id','ASC']];}return db[_0x4494('0x11')][_0x4494('0x6f')]({'attributes':['id',_0x4494('0x70'),'phone','recallme'],'where':_0x15c6c1,'order':_0xa85960,'transaction':_0x299b8c,'lock':_0x299b8c['LOCK'][_0x4494('0x71')],'include':[{'model':db[_0x4494('0x55')],'as':_0x4494('0x72'),'attributes':_0x3a7d93,'include':[{'model':db[_0x4494('0x73')],'as':_0x4494('0x74'),'attributes':['id','name']}]},{'model':db[_0x4494('0x75')],'as':'List','attributes':['id','name']},{'model':db[_0x4494('0x44')],'as':'Queue','attributes':['id',_0x4494('0x10'),'dialActive']}]})[_0x4494('0x35')](function(_0x5d580e){if(_0x5d580e){return _0x5d580e['update']({'UserId':_0x6a9289['user']['id']},{'transaction':_0x299b8c});}});});}})['then'](handleEntityNotFound(_0x43583a,null))[_0x4494('0x35')](respondWithResult(_0x43583a,null))[_0x4494('0x3a')](handleError(_0x43583a,null));};exports[_0x4494('0x76')]=function(_0x3a7491,_0x3e7652,_0x19daf1){var _0x6131f6=[];var _0x46ec48=_0x3a7491[_0x4494('0x3c')]['id'];var _0x49dff9=_0x3a7491['user']['id'];return db['CmContact']['describe']()[_0x4494('0x35')](function(_0x38f28c){_0x6131f6=_[_0x4494('0x18')](_0x38f28c);return db['sequelize'][_0x4494('0x63')](function(_0x371baf){const _0x307bb9={'id':_0x46ec48};return db[_0x4494('0x11')][_0x4494('0x6f')]({'attributes':['id','scheduledat',_0x4494('0x77')],'where':_0x307bb9,'transaction':_0x371baf,'lock':_0x371baf[_0x4494('0x78')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x6131f6,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x4494('0x75')],'as':_0x4494('0x79'),'attributes':['id',_0x4494('0x10')]},{'model':db[_0x4494('0x44')],'as':_0x4494('0x7a'),'attributes':['id',_0x4494('0x10'),_0x4494('0x7b')]}]})['then'](function(_0x2a5a2b){if(_0x2a5a2b){return _0x2a5a2b['update']({'UserId':_0x49dff9},{'transaction':_0x371baf});}});});})[_0x4494('0x35')](handleEntityNotFound(_0x3e7652,null))[_0x4494('0x35')](respondWithResult(_0x3e7652,null))[_0x4494('0x3a')](handleError(_0x3e7652,null));};exports[_0x4494('0x7c')]=function(_0x1f18bf,_0x500858){return _0x1f18bf[_0x4494('0x4d')][_0x4494('0x7d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x4494('0x35')](function(_0xe0e497){if(_0xe0e497&&_0xe0e497[_0x4494('0x2b')]){return db[_0x4494('0x11')][_0x4494('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4494('0x4f')](_0x4494('0x50'))},'VoiceQueueId':{'$in':_[_0x4494('0x16')](_0xe0e497,'id')},'$or':[{'UserId':null},{'UserId':_0x1f18bf[_0x4494('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x1e9e8c){if(!_['isNil'](_0x1e9e8c)&&_[_0x4494('0x7e')](_0x1e9e8c)){return _0x500858[_0x4494('0x6')](0xc8)[_0x4494('0x7')]({'contacts':_0x1e9e8c});}else{logger['error'](_0x4494('0x7f'),'getOpenContacts',0x194,_0x4494('0x80'));_0x500858[_0x4494('0xe')](0x194);}})[_0x4494('0x3a')](handleError(_0x500858,null));};exports[_0x4494('0x81')]=function(_0x1796d1,_0x45b340){var _0x4875ee=shared[_0x4494('0x82')];var _0x1005e9=[];_['map'](_0x4875ee,function(_0x3a0787){_0x1005e9['push']({'id':_0x3a0787[_0x4494('0x10')],'name':_0x3a0787[_0x4494('0x10')],'utcOffset':_0x3a0787[_0x4494('0x83')]});});return _0x45b340[_0x4494('0x6')](0xc8)['json']({'tz':_0x1005e9});};exports[_0x4494('0x84')]=function(_0x4cc690,_0x360c65){var _0x1aa889=shared[_0x4494('0x82')];var _0xcc90e9={};if(!_[_0x4494('0x57')](_0x1aa889[_0x4cc690['body']['id']]))_0xcc90e9=_0x1aa889[_0x4cc690['body']['id']];return _0x360c65[_0x4494('0x6')](0xc8)[_0x4494('0x7')](_0xcc90e9);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 6ecbc3f..47a7cbf 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 _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x5254b1,_0x471ede){var _0xfaddd4=function(_0x561207){while(--_0x561207){_0x5254b1['push'](_0x5254b1['shift']());}};_0xfaddd4(++_0x471ede);}(_0x4975,0x86));var _0x5497=function(_0x2c2fa2,_0x4dd14f){_0x2c2fa2=_0x2c2fa2-0x0;var _0x2a9d19=_0x4975[_0x2c2fa2];return _0x2a9d19;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x185de4,_0x3b15ff){var _0x3b4596=function(_0x31ab71){while(--_0x31ab71){_0x185de4['push'](_0x185de4['shift']());}};_0x3b4596(++_0x3b15ff);}(_0xafc4,0x69));var _0x4afc=function(_0xee4dbb,_0x375618){_0xee4dbb=_0xee4dbb-0x0;var _0x191642=_0xafc4[_0xee4dbb];return _0x191642;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 2e78c1b..1eaa8a3 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 _0xa329=['Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','\x20MINUTE','NOW()','CmList','List','lodash','bluebird','../../mysqldb','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetCmHopper','findAll','options','raw','where','attributes','include','model','map','then','catch','ShowCmHopper','find','CmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','limit','order','LOCK','UPDATE'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0xa329,0x174));var _0x9a32=function(_0x1d70e2,_0x14bea1){_0x1d70e2=_0x1d70e2-0x0;var _0x2a3172=_0xa329[_0x1d70e2];return _0x2a3172;};'use strict';var _=require(_0x9a32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9a32('0x1'));var db=require(_0x9a32('0x2'))['db'];var logger=require('../../config/logger')('rpc');var jayson=require(_0x9a32('0x3'));var client=jayson[_0x9a32('0x4')][_0x9a32('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3959e3,_0x3b75b6,_0x4a16cd){return new BPromise(function(_0x467b8e,_0x36956d){return client[_0x9a32('0x6')](_0x3959e3,_0x4a16cd)['then'](function(_0x62ecf9){logger[_0x9a32('0x7')](_0x9a32('0x8'),_0x3b75b6,_0x9a32('0x9'));logger[_0x9a32('0xa')](_0x9a32('0xb'),_0x3b75b6,_0x9a32('0x9'),JSON[_0x9a32('0xc')](_0x62ecf9));if(_0x62ecf9['error']){if(_0x62ecf9[_0x9a32('0xd')][_0x9a32('0xe')]===0x1f4){logger[_0x9a32('0xd')](_0x9a32('0x8'),_0x3b75b6,_0x62ecf9[_0x9a32('0xd')][_0x9a32('0xf')]);return _0x36956d(_0x62ecf9[_0x9a32('0xd')][_0x9a32('0xf')]);}logger['error'](_0x9a32('0x8'),_0x3b75b6,_0x62ecf9[_0x9a32('0xd')][_0x9a32('0xf')]);return _0x467b8e(_0x62ecf9[_0x9a32('0xd')]['message']);}else{logger['info'](_0x9a32('0x8'),_0x3b75b6,'request\x20sent');_0x467b8e(_0x62ecf9['result'][_0x9a32('0xf')]);}})['catch'](function(_0x4bcbad){logger[_0x9a32('0xd')](_0x9a32('0x8'),_0x3b75b6,_0x4bcbad);_0x36956d(_0x4bcbad);});});}exports[_0x9a32('0x10')]=function(_0x3573ed){var _0x77bf63=this;return new Promise(function(_0x1ec257,_0x297c56){return db['CmHopper'][_0x9a32('0x11')]({'raw':_0x3573ed['options']?_0x3573ed[_0x9a32('0x12')][_0x9a32('0x13')]===undefined?!![]:![]:!![],'where':_0x3573ed[_0x9a32('0x12')]?_0x3573ed[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':_0x3573ed[_0x9a32('0x12')]?_0x3573ed[_0x9a32('0x12')][_0x9a32('0x15')]||null:null,'limit':_0x3573ed[_0x9a32('0x12')]?_0x3573ed[_0x9a32('0x12')]['limit']||null:null,'include':_0x3573ed[_0x9a32('0x12')]?_0x3573ed[_0x9a32('0x12')][_0x9a32('0x16')]?_['map'](_0x3573ed['options']['include'],function(_0x4c2aaf){return{'model':db[_0x4c2aaf[_0x9a32('0x17')]],'as':_0x4c2aaf['as'],'attributes':_0x4c2aaf[_0x9a32('0x15')],'include':_0x4c2aaf[_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x4c2aaf[_0x9a32('0x16')],function(_0x18ec18){return{'model':db[_0x18ec18[_0x9a32('0x17')]],'as':_0x18ec18['as'],'attributes':_0x18ec18[_0x9a32('0x15')],'include':_0x18ec18[_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x18ec18[_0x9a32('0x16')],function(_0x435e4e){return{'model':db[_0x435e4e[_0x9a32('0x17')]],'as':_0x435e4e['as'],'attributes':_0x435e4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a32('0x19')](function(_0xce90d7){logger[_0x9a32('0x7')](_0x9a32('0x10'),_0x3573ed);logger[_0x9a32('0xa')](_0x9a32('0x10'),_0x3573ed,JSON[_0x9a32('0xc')](_0xce90d7));_0x1ec257(_0xce90d7);})[_0x9a32('0x1a')](function(_0x3be541){logger[_0x9a32('0xd')]('GetCmHopper',_0x3be541['message'],_0x3573ed);_0x297c56(_0x77bf63[_0x9a32('0xd')](0x1f4,_0x3be541[_0x9a32('0xf')]));});});};exports[_0x9a32('0x1b')]=function(_0x1e61c3){var _0x1c9c7d=this;return new Promise(function(_0x441b7d,_0x2147a7){return db['CmHopper'][_0x9a32('0x1c')]({'raw':_0x1e61c3[_0x9a32('0x12')]?_0x1e61c3[_0x9a32('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x1e61c3[_0x9a32('0x12')]?_0x1e61c3[_0x9a32('0x12')]['where']||null:null,'attributes':_0x1e61c3[_0x9a32('0x12')]?_0x1e61c3[_0x9a32('0x12')][_0x9a32('0x15')]||null:null,'include':_0x1e61c3[_0x9a32('0x12')]?_0x1e61c3[_0x9a32('0x12')][_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x1e61c3[_0x9a32('0x12')][_0x9a32('0x16')],function(_0x679f83){return{'model':db[_0x679f83[_0x9a32('0x17')]],'as':_0x679f83['as'],'attributes':_0x679f83[_0x9a32('0x15')],'include':_0x679f83['include']?_['map'](_0x679f83[_0x9a32('0x16')],function(_0x1b7134){return{'model':db[_0x1b7134[_0x9a32('0x17')]],'as':_0x1b7134['as'],'attributes':_0x1b7134[_0x9a32('0x15')],'include':_0x1b7134[_0x9a32('0x16')]?_['map'](_0x1b7134[_0x9a32('0x16')],function(_0x4db76f){return{'model':db[_0x4db76f[_0x9a32('0x17')]],'as':_0x4db76f['as'],'attributes':_0x4db76f[_0x9a32('0x15')]};}):[]};}):[]};}):[]:[]})[_0x9a32('0x19')](function(_0x1b94e9){logger[_0x9a32('0x7')](_0x9a32('0x1b'),_0x1e61c3);logger[_0x9a32('0xa')](_0x9a32('0x1b'),_0x1e61c3,JSON[_0x9a32('0xc')](_0x1b94e9));_0x441b7d(_0x1b94e9);})[_0x9a32('0x1a')](function(_0x433c1f){logger[_0x9a32('0xd')]('ShowCmHopper',_0x433c1f[_0x9a32('0xf')],_0x1e61c3);_0x2147a7(_0x1c9c7d[_0x9a32('0xd')](0x1f4,_0x433c1f['message']));});});};exports['CreateCmHopper']=function(_0x30a760){var _0x569e15=this;return new Promise(function(_0xf1a621,_0x59ce77){return db[_0x9a32('0x1d')][_0x9a32('0x1e')](_0x30a760[_0x9a32('0x1f')],{'raw':_0x30a760[_0x9a32('0x12')]?_0x30a760['options'][_0x9a32('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x5d1e0c){logger[_0x9a32('0x7')]('CreateCmHopper',_0x30a760);logger[_0x9a32('0xa')](_0x9a32('0x20'),_0x30a760,JSON[_0x9a32('0xc')](_0x5d1e0c));_0xf1a621(_0x5d1e0c);})[_0x9a32('0x1a')](function(_0x3c2626){logger['error'](_0x9a32('0x20'),_0x3c2626['message'],_0x30a760);_0x59ce77(_0x569e15['error'](0x1f4,_0x3c2626['message']));});});};exports[_0x9a32('0x21')]=function(_0x958537){var _0x112dcd=this;return new Promise(function(_0x208069,_0x34d600){return db[_0x9a32('0x1d')][_0x9a32('0x22')](_0x958537[_0x9a32('0x1f')],{'raw':_0x958537[_0x9a32('0x12')]?_0x958537['options'][_0x9a32('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x958537[_0x9a32('0x12')]?_0x958537[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':_0x958537['options']?_0x958537['options'][_0x9a32('0x15')]||null:null,'limit':_0x958537[_0x9a32('0x12')]?_0x958537[_0x9a32('0x12')]['limit']||null:null})['then'](function(_0x4fef4c){logger[_0x9a32('0x7')]('UpdateCmHopper',_0x958537);logger[_0x9a32('0x7')](_0x9a32('0x23'),JSON[_0x9a32('0xc')](_0x958537['options'][_0x9a32('0x14')]),_0x958537[_0x9a32('0x1f')][_0x9a32('0x24')]);logger['debug'](_0x9a32('0x21'),_0x958537,JSON[_0x9a32('0xc')](_0x4fef4c));_0x208069(_0x4fef4c);})[_0x9a32('0x1a')](function(_0x4bba9e){logger[_0x9a32('0xd')]('UpdateCmHopper',_0x4bba9e[_0x9a32('0xf')],_0x958537);_0x34d600(_0x112dcd[_0x9a32('0xd')](0x1f4,_0x4bba9e[_0x9a32('0xf')]));});});};exports['DestroyCmHopper']=function(_0x1bfff8){var _0x15ab06=this;return new Promise(function(_0x535d7e,_0x5ca24e){return db['CmHopper'][_0x9a32('0x25')]({'where':_0x1bfff8[_0x9a32('0x12')]?_0x1bfff8[_0x9a32('0x12')][_0x9a32('0x14')]||null:null})[_0x9a32('0x19')](function(_0x2533b5){logger[_0x9a32('0x7')]('DestroyCmHopper',_0x1bfff8);logger['debug'](_0x9a32('0x26'),_0x1bfff8,JSON[_0x9a32('0xc')](_0x2533b5));_0x535d7e(_0x2533b5);})[_0x9a32('0x1a')](function(_0x4c6488){logger[_0x9a32('0xd')](_0x9a32('0x26'),_0x4c6488[_0x9a32('0xf')],_0x1bfff8);_0x5ca24e(_0x15ab06[_0x9a32('0xd')](0x1f4,_0x4c6488[_0x9a32('0xf')]));});});};exports[_0x9a32('0x27')]=function(_0x40457b){var _0x180609=this;return new Promise(function(_0x20e213,_0x43b02e){return db[_0x9a32('0x28')][_0x9a32('0x29')]()[_0x9a32('0x19')](function(_0x1dbd4c){return db[_0x9a32('0x2a')][_0x9a32('0x2b')](function(_0x4276ab){return db[_0x9a32('0x1d')][_0x9a32('0x11')]({'where':_0x40457b[_0x9a32('0x12')]?_0x40457b[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':_0x40457b[_0x9a32('0x12')]?_0x40457b[_0x9a32('0x12')][_0x9a32('0x15')]||null:null,'limit':_0x40457b['options']?_0x40457b[_0x9a32('0x12')][_0x9a32('0x2c')]||null:null,'order':_0x40457b[_0x9a32('0x12')]?_0x40457b[_0x9a32('0x12')][_0x9a32('0x2d')]||null:null,'transaction':_0x4276ab,'lock':_0x4276ab[_0x9a32('0x2e')][_0x9a32('0x2f')],'include':[{'model':db[_0x9a32('0x28')],'as':_0x9a32('0x30'),'attributes':_[_0x9a32('0x31')](_0x1dbd4c)},{'model':db[_0x9a32('0x32')],'as':_0x9a32('0x33'),'attributes':['id',_0x9a32('0x34'),_0x9a32('0x35')]}]})[_0x9a32('0x19')](function(_0x260362){var _0x33e40e=[];var _0xdaefaf=[];for(var _0x15093e=0x0;_0x15093e<_0x260362[_0x9a32('0x36')];_0x15093e+=0x1){var _0x327164=_0x260362[_0x15093e][_0x9a32('0x37')];if(_0x327164===null){_0x33e40e[_0x9a32('0x38')](_0x260362[_0x15093e][_0x9a32('0x22')](_0x40457b[_0x9a32('0x1f')],{'transaction':_0x4276ab}));}else if(!_0xdaefaf['includes'](_0x327164)){_0xdaefaf[_0x9a32('0x38')](_0x327164);_0x33e40e['push'](_0x260362[_0x15093e][_0x9a32('0x22')](_0x40457b[_0x9a32('0x1f')],{'transaction':_0x4276ab}));}}return BPromise[_0x9a32('0x39')](_0x33e40e);});})[_0x9a32('0x19')](function(_0x5a6382){logger['info'](_0x9a32('0x27'),_0x40457b);if(_0x5a6382[_0x9a32('0x36')]>0x0){logger[_0x9a32('0x7')](_0x9a32('0x3a'),_0x5a6382[0x0]['dataValues']['id'],_0x5a6382[0x0][_0x9a32('0x3b')]['ContactId'],_0x5a6382[0x0][_0x9a32('0x3b')]['active']);}logger['debug'](_0x9a32('0x27'),_0x40457b,JSON[_0x9a32('0xc')](_0x5a6382));_0x20e213(_0x5a6382);})['catch'](function(_0x4eaf98){logger[_0x9a32('0xd')](_0x9a32('0x27'),_0x4eaf98['message'],_0x40457b);_0x43b02e(_0x180609[_0x9a32('0xd')](0x1f4,_0x4eaf98[_0x9a32('0xf')]));});});});};exports['MoveContactManagedDialer']=function(_0x129814){var _0xceb785=this;return new Promise(function(_0x39d842,_0x331e9f){return db[_0x9a32('0x2a')][_0x9a32('0x2b')](function(_0x4dfadc){return db[_0x9a32('0x3c')][_0x9a32('0x1e')](_0x129814[_0x9a32('0x1f')],{'raw':_0x129814[_0x9a32('0x12')]?_0x129814['options'][_0x9a32('0x13')]===undefined?!![]:![]:!![],'transaction':_0x4dfadc})[_0x9a32('0x19')](function(){logger['info'](_0x9a32('0x3d'),JSON[_0x9a32('0xc')](_0x129814[_0x9a32('0x12')]['where']),_0x129814['options'][_0x9a32('0x14')][_0x9a32('0x24')]);return db['CmHopper'][_0x9a32('0x25')]({'where':_0x129814[_0x9a32('0x12')]?_0x129814['options']['where']||null:null,'transaction':_0x4dfadc});});})[_0x9a32('0x19')](function(_0x318d1a){logger['info']('MoveContactManagedDialer',_0x129814);logger['debug'](_0x9a32('0x3e'),_0x129814,JSON[_0x9a32('0xc')](_0x318d1a));_0x39d842(_0x318d1a);})[_0x9a32('0x1a')](function(_0x161d06){logger[_0x9a32('0xd')]('MoveContactManagedDialer',_0x161d06[_0x9a32('0xf')],_0x129814);_0x331e9f(_0xceb785[_0x9a32('0xd')](0x1f4,_0x161d06['message']));});});};exports[_0x9a32('0x3f')]=function(_0x2df9df){var _0x534a63=this;return new Promise(function(_0x175178,_0xd186d){return db['CmHopper']['findAll']({'raw':_0x2df9df[_0x9a32('0x12')]?_0x2df9df[_0x9a32('0x12')][_0x9a32('0x13')]===undefined?!![]:![]:!![],'where':_0x2df9df[_0x9a32('0x12')]?_0x2df9df[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':[[db[_0x9a32('0x2a')]['fn']('COUNT',db[_0x9a32('0x2a')]['fn']('IF',db[_0x9a32('0x2a')][_0x9a32('0x40')](_0x9a32('0x41')+util[_0x9a32('0x42')](_0x9a32('0x43'),moment()[_0x9a32('0x42')](_0x9a32('0x44')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})[_0x9a32('0x19')](function(_0x4812be){logger[_0x9a32('0x7')](_0x9a32('0x3f'),_0x2df9df);logger['debug'](_0x9a32('0x3f'),_0x2df9df,JSON[_0x9a32('0xc')](_0x4812be));_0x175178(_0x4812be);})[_0x9a32('0x1a')](function(_0x469a3e){logger[_0x9a32('0xd')](_0x9a32('0x3f'),_0x469a3e[_0x9a32('0xf')],_0x2df9df);_0xd186d(_0x534a63[_0x9a32('0xd')](0x1f4,_0x469a3e['message']));});});};exports[_0x9a32('0x45')]=function(_0x8f1d5){var _0x1240e3=this;return new Promise(function(_0x4a8ae8,_0x1e8949){return db[_0x9a32('0x28')][_0x9a32('0x29')]()[_0x9a32('0x19')](function(_0x21b102){return db['sequelize'][_0x9a32('0x2b')](function(_0x2dee5f){return db[_0x9a32('0x1d')][_0x9a32('0x11')]({'where':_0x8f1d5['options']?_0x8f1d5[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':_0x8f1d5[_0x9a32('0x12')]?_0x8f1d5[_0x9a32('0x12')][_0x9a32('0x15')]||null:null,'limit':0x1,'order':_0x8f1d5[_0x9a32('0x12')]?_0x8f1d5[_0x9a32('0x12')][_0x9a32('0x2d')]||null:null,'group':db[_0x9a32('0x1d')][_0x9a32('0x37')],'transaction':_0x2dee5f,'lock':_0x2dee5f['LOCK'][_0x9a32('0x2f')],'include':_0x8f1d5[_0x9a32('0x12')]?_0x8f1d5[_0x9a32('0x12')][_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x8f1d5['options'][_0x9a32('0x16')],function(_0x4dda88){return{'model':db[_0x4dda88[_0x9a32('0x17')]],'as':_0x4dda88['as'],'attributes':_0x4dda88['attributes'],'include':_0x4dda88['include']?_['map'](_0x4dda88[_0x9a32('0x16')],function(_0x5ec425){return{'model':db[_0x5ec425[_0x9a32('0x17')]],'as':_0x5ec425['as'],'attributes':_0x5ec425[_0x9a32('0x15')],'include':_0x5ec425[_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x5ec425[_0x9a32('0x16')],function(_0x42651d){return{'model':db[_0x42651d['model']],'as':_0x42651d['as'],'attributes':_0x42651d[_0x9a32('0x15')]};}):[]};}):[]};}):[]:[]})[_0x9a32('0x19')](function(_0x3bd517){var _0x1778a5=[];for(var _0x38d2be=0x0;_0x38d2be<_0x3bd517[_0x9a32('0x36')];_0x38d2be+=0x1){_0x1778a5[_0x9a32('0x38')](_0x3bd517[_0x38d2be]['update'](_0x8f1d5[_0x9a32('0x1f')],{'transaction':_0x2dee5f}));}return BPromise[_0x9a32('0x39')](_0x1778a5);});})['then'](function(_0x1002e4){logger['info'](_0x9a32('0x45'),_0x8f1d5);logger[_0x9a32('0xa')](_0x9a32('0x45'),_0x8f1d5,JSON[_0x9a32('0xc')](_0x1002e4));_0x4a8ae8(_0x1002e4);})['catch'](function(_0x213525){logger[_0x9a32('0xd')](_0x9a32('0x45'),_0x213525[_0x9a32('0xf')],_0x8f1d5);_0x1e8949(_0x1240e3['error'](0x1f4,_0x213525[_0x9a32('0xf')]));});});});};exports[_0x9a32('0x46')]=function(_0x3808f6){var _0x1edfcf=this;return new Promise(function(_0x1e8657,_0x1de8d8){db[_0x9a32('0x28')][_0x9a32('0x29')]()[_0x9a32('0x19')](function(_0x112757){return db[_0x9a32('0x1d')][_0x9a32('0x11')]({'raw':_0x3808f6[_0x9a32('0x12')]?_0x3808f6[_0x9a32('0x12')][_0x9a32('0x13')]===undefined?!![]:![]:!![],'where':_0x3808f6[_0x9a32('0x12')]?_0x3808f6[_0x9a32('0x12')][_0x9a32('0x14')]||null:null,'attributes':_0x3808f6[_0x9a32('0x12')]?_0x3808f6[_0x9a32('0x12')][_0x9a32('0x15')]||null:null,'limit':_0x3808f6[_0x9a32('0x12')]?_0x3808f6[_0x9a32('0x12')][_0x9a32('0x2c')]||null:null,'include':_0x3808f6[_0x9a32('0x12')]?_0x3808f6[_0x9a32('0x12')][_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x3808f6[_0x9a32('0x12')][_0x9a32('0x16')],function(_0x14837a){return{'model':db[_0x14837a['model']],'as':_0x14837a['as'],'attributes':_0x14837a['as']==='Contact'?_[_0x9a32('0x31')](_0x112757):_0x14837a[_0x9a32('0x15')],'include':_0x14837a[_0x9a32('0x16')]?_['map'](_0x14837a[_0x9a32('0x16')],function(_0x4959e9){return{'model':db[_0x4959e9[_0x9a32('0x17')]],'as':_0x4959e9['as'],'attributes':_0x4959e9['attributes'],'include':_0x4959e9[_0x9a32('0x16')]?_[_0x9a32('0x18')](_0x4959e9[_0x9a32('0x16')],function(_0x2bc557){return{'model':db[_0x2bc557[_0x9a32('0x17')]],'as':_0x2bc557['as'],'attributes':_0x2bc557[_0x9a32('0x15')]};}):[]};}):[]};}):[]:[]})[_0x9a32('0x19')](function(_0x156f24){logger['info'](_0x9a32('0x10'),_0x3808f6);logger[_0x9a32('0xa')](_0x9a32('0x10'),_0x3808f6,JSON[_0x9a32('0xc')](_0x156f24));_0x1e8657(_0x156f24);})[_0x9a32('0x1a')](function(_0x3f03b4){logger[_0x9a32('0xd')](_0x9a32('0x10'),_0x3f03b4[_0x9a32('0xf')],_0x3808f6);_0x1de8d8(_0x1edfcf[_0x9a32('0xd')](0x1f4,_0x3f03b4[_0x9a32('0xf')]));});});});};exports[_0x9a32('0x47')]=function(_0x3016e9){var _0x49a8c4=this;return new Promise(function(_0xda557f,_0x6a3ca8){return db[_0x9a32('0x28')][_0x9a32('0x48')]({'raw':!![],'where':{'phone':_0x3016e9[_0x9a32('0x12')]['where'][_0x9a32('0x49')]},'attributes':['id',_0x9a32('0x4a')],'order':[['id','DESC']]})[_0x9a32('0x19')](function(_0x18d4bf){logger[_0x9a32('0x7')](_0x9a32('0x4b'),_0x3016e9);logger[_0x9a32('0xa')](_0x9a32('0x4b'),_0x3016e9,JSON[_0x9a32('0xc')](_0x18d4bf));_0xda557f(_0x18d4bf);})[_0x9a32('0x1a')](function(_0x33c194){logger[_0x9a32('0xd')](_0x9a32('0x4b'),_0x33c194[_0x9a32('0xf')],_0x3016e9);_0x6a3ca8(_0x49a8c4[_0x9a32('0xd')](0x1f4,_0x33c194['message']));});});};exports[_0x9a32('0x4c')]=function(_0x202e7d){var _0x5bd1d9=this;return new Promise(function(_0x212b08,_0x2af06b){return db[_0x9a32('0x2a')][_0x9a32('0x2b')](function(_0x2d572e){return db['CmHopper']['update'](_0x202e7d[_0x9a32('0x1f')],{'where':{},'transaction':_0x2d572e})[_0x9a32('0x19')](function(_0x3cf63e){logger[_0x9a32('0x7')](_0x9a32('0x4c'),_0x202e7d);logger[_0x9a32('0xa')](_0x9a32('0x4c'),_0x202e7d,JSON[_0x9a32('0xc')](_0x3cf63e));_0x212b08(_0x3cf63e);})[_0x9a32('0x1a')](function(_0x4ba10e){logger[_0x9a32('0xd')](_0x9a32('0x4c'),_0x4ba10e[_0x9a32('0xf')],_0x202e7d);_0x2af06b(_0x5bd1d9[_0x9a32('0xd')](0x1f4,_0x4ba10e[_0x9a32('0xf')]));});});});};exports[_0x9a32('0x4d')]=function(_0x473f17){var _0x39bf7c=this;var _0x3688ff=_0x473f17[_0x9a32('0x1f')]['where'][_0x9a32('0x4e')];var _0x44e6ca=_0x473f17[_0x9a32('0x1f')][_0x9a32('0x14')][_0x9a32('0x4f')];var _0x29176c=_0x473f17[_0x9a32('0x1f')][_0x9a32('0x14')]['availableAgentsIds'];return new Promise(function(_0x30a87c,_0xf99b78){return db[_0x9a32('0x1d')][_0x9a32('0x11')]({'where':{'voiceQueueId':{'$in':_0x3688ff},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x9a32('0x2a')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x44e6ca+_0x9a32('0x50')),'$gt':db[_0x9a32('0x2a')]['literal'](_0x9a32('0x51'))}},'UserId':{'$in':_0x29176c}},'include':[{'model':db[_0x9a32('0x28')],'as':'Contact'},{'model':db[_0x9a32('0x32')],'as':_0x9a32('0x33'),'attributes':['id',_0x9a32('0x34'),_0x9a32('0x35')]},{'model':db[_0x9a32('0x52')],'as':_0x9a32('0x53')}]})[_0x9a32('0x19')](function(_0x5ee68b){if(_0x5ee68b[_0x9a32('0x36')]>0x0){return db[_0x9a32('0x2a')][_0x9a32('0x2b')](function(_0x163d4b){return db[_0x9a32('0x1d')]['update']({'recallmeNotifiedDate':db[_0x9a32('0x2a')][_0x9a32('0x40')](_0x9a32('0x51'))},{'where':{'id':{'$in':_[_0x9a32('0x18')](_0x5ee68b,'id')}},'transaction':_0x163d4b})[_0x9a32('0x19')](function(){_0x30a87c(_0x5ee68b);})[_0x9a32('0x1a')](function(_0x161486){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x161486[_0x9a32('0xf')],_0x473f17);_0xf99b78(_0x39bf7c['error'](0x1f4,_0x161486[_0x9a32('0xf')]));});})['catch'](function(_0x2026c4){logger['error'](_0x9a32('0x4d'),_0x2026c4[_0x9a32('0xf')],_0x473f17);_0xf99b78(_0x39bf7c[_0x9a32('0xd')](0x1f4,_0x2026c4[_0x9a32('0xf')]));});}else{_0x30a87c(_0x5ee68b);}});});}; \ No newline at end of file +var _0x0b0a=['findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetCmHopper','CmHopper','findAll','options','raw','where','map','include','model','attributes','debug','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','limit','active','DestroyCmHopper','GetContactDialer','CmContact','transaction','order','Contact','keys','User','Agent','name','voicePause','push','includes','all','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','sequelize','COUNT','literal','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','UPDATE','length','GetCmHopperPreview','GetContactByPhone'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0a,0x1c7));var _0xa0b0=function(_0x141c01,_0x1556f0){_0x141c01=_0x141c01-0x0;var _0x49e963=_0x0b0a[_0x141c01];return _0x49e963;};'use strict';var _=require(_0xa0b0('0x0'));var util=require(_0xa0b0('0x1'));var moment=require(_0xa0b0('0x2'));var BPromise=require(_0xa0b0('0x3'));var db=require(_0xa0b0('0x4'))['db'];var logger=require(_0xa0b0('0x5'))('rpc');var jayson=require(_0xa0b0('0x6'));var client=jayson['client'][_0xa0b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27a5d6,_0x19f036,_0x3105c1){return new BPromise(function(_0x21bb42,_0x246b2b){return client[_0xa0b0('0x8')](_0x27a5d6,_0x3105c1)[_0xa0b0('0x9')](function(_0x4bf19e){logger[_0xa0b0('0xa')](_0xa0b0('0xb'),_0x19f036,'request\x20sent');logger['debug'](_0xa0b0('0xc'),_0x19f036,_0xa0b0('0xd'),JSON[_0xa0b0('0xe')](_0x4bf19e));if(_0x4bf19e[_0xa0b0('0xf')]){if(_0x4bf19e[_0xa0b0('0xf')][_0xa0b0('0x10')]===0x1f4){logger[_0xa0b0('0xf')](_0xa0b0('0xb'),_0x19f036,_0x4bf19e[_0xa0b0('0xf')][_0xa0b0('0x11')]);return _0x246b2b(_0x4bf19e[_0xa0b0('0xf')]['message']);}logger[_0xa0b0('0xf')](_0xa0b0('0xb'),_0x19f036,_0x4bf19e[_0xa0b0('0xf')][_0xa0b0('0x11')]);return _0x21bb42(_0x4bf19e[_0xa0b0('0xf')][_0xa0b0('0x11')]);}else{logger[_0xa0b0('0xa')](_0xa0b0('0xb'),_0x19f036,_0xa0b0('0xd'));_0x21bb42(_0x4bf19e['result']['message']);}})[_0xa0b0('0x12')](function(_0x4c2edb){logger[_0xa0b0('0xf')]('CmHopper,\x20%s,\x20%s',_0x19f036,_0x4c2edb);_0x246b2b(_0x4c2edb);});});}exports[_0xa0b0('0x13')]=function(_0x3fb223){var _0x4974a0=this;return new Promise(function(_0x54e326,_0x214292){return db[_0xa0b0('0x14')][_0xa0b0('0x15')]({'raw':_0x3fb223[_0xa0b0('0x16')]?_0x3fb223[_0xa0b0('0x16')][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'where':_0x3fb223[_0xa0b0('0x16')]?_0x3fb223[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'attributes':_0x3fb223[_0xa0b0('0x16')]?_0x3fb223[_0xa0b0('0x16')]['attributes']||null:null,'limit':_0x3fb223[_0xa0b0('0x16')]?_0x3fb223[_0xa0b0('0x16')]['limit']||null:null,'include':_0x3fb223['options']?_0x3fb223[_0xa0b0('0x16')]['include']?_[_0xa0b0('0x19')](_0x3fb223[_0xa0b0('0x16')][_0xa0b0('0x1a')],function(_0x180c5c){return{'model':db[_0x180c5c[_0xa0b0('0x1b')]],'as':_0x180c5c['as'],'attributes':_0x180c5c[_0xa0b0('0x1c')],'include':_0x180c5c[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x180c5c[_0xa0b0('0x1a')],function(_0x42532c){return{'model':db[_0x42532c[_0xa0b0('0x1b')]],'as':_0x42532c['as'],'attributes':_0x42532c[_0xa0b0('0x1c')],'include':_0x42532c[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x42532c[_0xa0b0('0x1a')],function(_0x38de9e){return{'model':db[_0x38de9e[_0xa0b0('0x1b')]],'as':_0x38de9e['as'],'attributes':_0x38de9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0b0('0x9')](function(_0x30f8cb){logger['info']('GetCmHopper',_0x3fb223);logger[_0xa0b0('0x1d')]('GetCmHopper',_0x3fb223,JSON[_0xa0b0('0xe')](_0x30f8cb));_0x54e326(_0x30f8cb);})[_0xa0b0('0x12')](function(_0x318049){logger[_0xa0b0('0xf')](_0xa0b0('0x13'),_0x318049[_0xa0b0('0x11')],_0x3fb223);_0x214292(_0x4974a0[_0xa0b0('0xf')](0x1f4,_0x318049[_0xa0b0('0x11')]));});});};exports['ShowCmHopper']=function(_0x7c1544){var _0x4f047e=this;return new Promise(function(_0x3732cb,_0x41c945){return db[_0xa0b0('0x14')]['find']({'raw':_0x7c1544['options']?_0x7c1544['options'][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'where':_0x7c1544['options']?_0x7c1544[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'attributes':_0x7c1544[_0xa0b0('0x16')]?_0x7c1544[_0xa0b0('0x16')][_0xa0b0('0x1c')]||null:null,'include':_0x7c1544['options']?_0x7c1544[_0xa0b0('0x16')][_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x7c1544[_0xa0b0('0x16')]['include'],function(_0x26038d){return{'model':db[_0x26038d[_0xa0b0('0x1b')]],'as':_0x26038d['as'],'attributes':_0x26038d[_0xa0b0('0x1c')],'include':_0x26038d[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x26038d[_0xa0b0('0x1a')],function(_0x33bf0d){return{'model':db[_0x33bf0d[_0xa0b0('0x1b')]],'as':_0x33bf0d['as'],'attributes':_0x33bf0d[_0xa0b0('0x1c')],'include':_0x33bf0d[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x33bf0d[_0xa0b0('0x1a')],function(_0x2b0889){return{'model':db[_0x2b0889[_0xa0b0('0x1b')]],'as':_0x2b0889['as'],'attributes':_0x2b0889['attributes']};}):[]};}):[]};}):[]:[]})[_0xa0b0('0x9')](function(_0x57f486){logger['info'](_0xa0b0('0x1e'),_0x7c1544);logger['debug'](_0xa0b0('0x1e'),_0x7c1544,JSON['stringify'](_0x57f486));_0x3732cb(_0x57f486);})['catch'](function(_0x6cfcbd){logger[_0xa0b0('0xf')]('ShowCmHopper',_0x6cfcbd[_0xa0b0('0x11')],_0x7c1544);_0x41c945(_0x4f047e[_0xa0b0('0xf')](0x1f4,_0x6cfcbd[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x1f')]=function(_0x4407ca){var _0x6a7d92=this;return new Promise(function(_0xc870f6,_0x183299){return db[_0xa0b0('0x14')][_0xa0b0('0x20')](_0x4407ca[_0xa0b0('0x21')],{'raw':_0x4407ca[_0xa0b0('0x16')]?_0x4407ca[_0xa0b0('0x16')][_0xa0b0('0x17')]===undefined?!![]:![]:!![]})[_0xa0b0('0x9')](function(_0x214559){logger[_0xa0b0('0xa')]('CreateCmHopper',_0x4407ca);logger[_0xa0b0('0x1d')](_0xa0b0('0x1f'),_0x4407ca,JSON[_0xa0b0('0xe')](_0x214559));_0xc870f6(_0x214559);})[_0xa0b0('0x12')](function(_0x1dfdd7){logger[_0xa0b0('0xf')](_0xa0b0('0x1f'),_0x1dfdd7['message'],_0x4407ca);_0x183299(_0x6a7d92[_0xa0b0('0xf')](0x1f4,_0x1dfdd7['message']));});});};exports[_0xa0b0('0x22')]=function(_0x25f883){var _0x1adc16=this;return new Promise(function(_0x4efef2,_0x31a865){return db[_0xa0b0('0x14')][_0xa0b0('0x23')](_0x25f883[_0xa0b0('0x21')],{'raw':_0x25f883[_0xa0b0('0x16')]?_0x25f883['options'][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25f883[_0xa0b0('0x16')]?_0x25f883[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'attributes':_0x25f883[_0xa0b0('0x16')]?_0x25f883[_0xa0b0('0x16')][_0xa0b0('0x1c')]||null:null,'limit':_0x25f883['options']?_0x25f883['options'][_0xa0b0('0x24')]||null:null})[_0xa0b0('0x9')](function(_0x4597dd){logger[_0xa0b0('0xa')](_0xa0b0('0x22'),_0x25f883);logger[_0xa0b0('0xa')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x25f883['options'][_0xa0b0('0x18')]),_0x25f883[_0xa0b0('0x21')][_0xa0b0('0x25')]);logger[_0xa0b0('0x1d')]('UpdateCmHopper',_0x25f883,JSON[_0xa0b0('0xe')](_0x4597dd));_0x4efef2(_0x4597dd);})['catch'](function(_0x36a36f){logger[_0xa0b0('0xf')](_0xa0b0('0x22'),_0x36a36f[_0xa0b0('0x11')],_0x25f883);_0x31a865(_0x1adc16[_0xa0b0('0xf')](0x1f4,_0x36a36f[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x26')]=function(_0x73e616){var _0xc2f51b=this;return new Promise(function(_0x22084f,_0x6eabf0){return db[_0xa0b0('0x14')]['destroy']({'where':_0x73e616[_0xa0b0('0x16')]?_0x73e616['options'][_0xa0b0('0x18')]||null:null})['then'](function(_0x622be1){logger['info'](_0xa0b0('0x26'),_0x73e616);logger['debug'](_0xa0b0('0x26'),_0x73e616,JSON[_0xa0b0('0xe')](_0x622be1));_0x22084f(_0x622be1);})['catch'](function(_0x28cfeb){logger[_0xa0b0('0xf')](_0xa0b0('0x26'),_0x28cfeb[_0xa0b0('0x11')],_0x73e616);_0x6eabf0(_0xc2f51b[_0xa0b0('0xf')](0x1f4,_0x28cfeb[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x27')]=function(_0x40f833){var _0x51194a=this;return new Promise(function(_0x51f031,_0x39113e){return db[_0xa0b0('0x28')]['describe']()[_0xa0b0('0x9')](function(_0x2d5246){return db['sequelize'][_0xa0b0('0x29')](function(_0x5111d1){return db[_0xa0b0('0x14')][_0xa0b0('0x15')]({'where':_0x40f833[_0xa0b0('0x16')]?_0x40f833[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'attributes':_0x40f833[_0xa0b0('0x16')]?_0x40f833[_0xa0b0('0x16')][_0xa0b0('0x1c')]||null:null,'limit':_0x40f833[_0xa0b0('0x16')]?_0x40f833[_0xa0b0('0x16')][_0xa0b0('0x24')]||null:null,'order':_0x40f833[_0xa0b0('0x16')]?_0x40f833[_0xa0b0('0x16')][_0xa0b0('0x2a')]||null:null,'transaction':_0x5111d1,'lock':_0x5111d1['LOCK']['UPDATE'],'include':[{'model':db[_0xa0b0('0x28')],'as':_0xa0b0('0x2b'),'attributes':_[_0xa0b0('0x2c')](_0x2d5246)},{'model':db[_0xa0b0('0x2d')],'as':_0xa0b0('0x2e'),'attributes':['id',_0xa0b0('0x2f'),_0xa0b0('0x30')]}]})[_0xa0b0('0x9')](function(_0x22fe7b){var _0x4ce7eb=[];var _0x4cf9c0=[];for(var _0x2df3d2=0x0;_0x2df3d2<_0x22fe7b['length'];_0x2df3d2+=0x1){var _0x333a67=_0x22fe7b[_0x2df3d2]['UserId'];if(_0x333a67===null){_0x4ce7eb[_0xa0b0('0x31')](_0x22fe7b[_0x2df3d2]['update'](_0x40f833['body'],{'transaction':_0x5111d1}));}else if(!_0x4cf9c0[_0xa0b0('0x32')](_0x333a67)){_0x4cf9c0[_0xa0b0('0x31')](_0x333a67);_0x4ce7eb[_0xa0b0('0x31')](_0x22fe7b[_0x2df3d2][_0xa0b0('0x23')](_0x40f833[_0xa0b0('0x21')],{'transaction':_0x5111d1}));}}return BPromise[_0xa0b0('0x33')](_0x4ce7eb);});})['then'](function(_0x122dce){logger[_0xa0b0('0xa')]('GetContactDialer',_0x40f833);if(_0x122dce['length']>0x0){logger[_0xa0b0('0xa')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x122dce[0x0][_0xa0b0('0x34')]['id'],_0x122dce[0x0]['dataValues'][_0xa0b0('0x35')],_0x122dce[0x0][_0xa0b0('0x34')][_0xa0b0('0x25')]);}logger[_0xa0b0('0x1d')](_0xa0b0('0x27'),_0x40f833,JSON[_0xa0b0('0xe')](_0x122dce));_0x51f031(_0x122dce);})[_0xa0b0('0x12')](function(_0x770542){logger[_0xa0b0('0xf')](_0xa0b0('0x27'),_0x770542[_0xa0b0('0x11')],_0x40f833);_0x39113e(_0x51194a[_0xa0b0('0xf')](0x1f4,_0x770542[_0xa0b0('0x11')]));});});});};exports[_0xa0b0('0x36')]=function(_0x16358a){var _0x7cfdfc=this;return new Promise(function(_0x5827d7,_0x2cd484){return db['sequelize'][_0xa0b0('0x29')](function(_0x1f2353){return db[_0xa0b0('0x37')]['create'](_0x16358a[_0xa0b0('0x21')],{'raw':_0x16358a['options']?_0x16358a[_0xa0b0('0x16')][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'transaction':_0x1f2353})[_0xa0b0('0x9')](function(){logger[_0xa0b0('0xa')](_0xa0b0('0x38'),JSON[_0xa0b0('0xe')](_0x16358a[_0xa0b0('0x16')][_0xa0b0('0x18')]),_0x16358a['options'][_0xa0b0('0x18')][_0xa0b0('0x25')]);return db[_0xa0b0('0x14')][_0xa0b0('0x39')]({'where':_0x16358a[_0xa0b0('0x16')]?_0x16358a[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'transaction':_0x1f2353});});})[_0xa0b0('0x9')](function(_0x28eb3c){logger['info']('MoveContactManagedDialer',_0x16358a);logger['debug'](_0xa0b0('0x36'),_0x16358a,JSON[_0xa0b0('0xe')](_0x28eb3c));_0x5827d7(_0x28eb3c);})[_0xa0b0('0x12')](function(_0x275f1c){logger[_0xa0b0('0xf')](_0xa0b0('0x36'),_0x275f1c[_0xa0b0('0x11')],_0x16358a);_0x2cd484(_0x7cfdfc[_0xa0b0('0xf')](0x1f4,_0x275f1c[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x3a')]=function(_0x4c9536){var _0x4c8916=this;return new Promise(function(_0x352702,_0x56e9d4){return db[_0xa0b0('0x14')][_0xa0b0('0x15')]({'raw':_0x4c9536['options']?_0x4c9536[_0xa0b0('0x16')][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'where':_0x4c9536[_0xa0b0('0x16')]?_0x4c9536[_0xa0b0('0x16')][_0xa0b0('0x18')]||null:null,'attributes':[[db[_0xa0b0('0x3b')]['fn'](_0xa0b0('0x3c'),db[_0xa0b0('0x3b')]['fn']('IF',db[_0xa0b0('0x3b')][_0xa0b0('0x3d')]('`scheduledat`\x20>=\x20'+util['format'](_0xa0b0('0x3e'),moment()[_0xa0b0('0x3f')](_0xa0b0('0x40')))+_0xa0b0('0x41')))),_0xa0b0('0x42')]]})[_0xa0b0('0x9')](function(_0x1e0043){logger[_0xa0b0('0xa')](_0xa0b0('0x3a'),_0x4c9536);logger[_0xa0b0('0x1d')](_0xa0b0('0x3a'),_0x4c9536,JSON[_0xa0b0('0xe')](_0x1e0043));_0x352702(_0x1e0043);})[_0xa0b0('0x12')](function(_0x5af540){logger[_0xa0b0('0xf')](_0xa0b0('0x3a'),_0x5af540['message'],_0x4c9536);_0x56e9d4(_0x4c8916[_0xa0b0('0xf')](0x1f4,_0x5af540[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x43')]=function(_0x51405b){var _0x5e1ceb=this;return new Promise(function(_0x25dbbf,_0xf897be){return db[_0xa0b0('0x28')][_0xa0b0('0x44')]()[_0xa0b0('0x9')](function(_0x1660a4){return db[_0xa0b0('0x3b')][_0xa0b0('0x29')](function(_0x4f24e7){return db[_0xa0b0('0x14')][_0xa0b0('0x15')]({'where':_0x51405b[_0xa0b0('0x16')]?_0x51405b['options'][_0xa0b0('0x18')]||null:null,'attributes':_0x51405b[_0xa0b0('0x16')]?_0x51405b[_0xa0b0('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x51405b[_0xa0b0('0x16')]?_0x51405b[_0xa0b0('0x16')][_0xa0b0('0x2a')]||null:null,'group':db[_0xa0b0('0x14')]['UserId'],'transaction':_0x4f24e7,'lock':_0x4f24e7['LOCK'][_0xa0b0('0x45')],'include':_0x51405b[_0xa0b0('0x16')]?_0x51405b['options'][_0xa0b0('0x1a')]?_['map'](_0x51405b[_0xa0b0('0x16')][_0xa0b0('0x1a')],function(_0x44a2f2){return{'model':db[_0x44a2f2[_0xa0b0('0x1b')]],'as':_0x44a2f2['as'],'attributes':_0x44a2f2[_0xa0b0('0x1c')],'include':_0x44a2f2[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x44a2f2['include'],function(_0x512d72){return{'model':db[_0x512d72[_0xa0b0('0x1b')]],'as':_0x512d72['as'],'attributes':_0x512d72['attributes'],'include':_0x512d72[_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x512d72[_0xa0b0('0x1a')],function(_0xa1b29a){return{'model':db[_0xa1b29a[_0xa0b0('0x1b')]],'as':_0xa1b29a['as'],'attributes':_0xa1b29a[_0xa0b0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26754d){var _0x2d430f=[];for(var _0x30a934=0x0;_0x30a934<_0x26754d[_0xa0b0('0x46')];_0x30a934+=0x1){_0x2d430f[_0xa0b0('0x31')](_0x26754d[_0x30a934][_0xa0b0('0x23')](_0x51405b[_0xa0b0('0x21')],{'transaction':_0x4f24e7}));}return BPromise['all'](_0x2d430f);});})[_0xa0b0('0x9')](function(_0x13032c){logger[_0xa0b0('0xa')](_0xa0b0('0x43'),_0x51405b);logger[_0xa0b0('0x1d')]('GetContactRecallMe',_0x51405b,JSON['stringify'](_0x13032c));_0x25dbbf(_0x13032c);})['catch'](function(_0x2f3ab9){logger[_0xa0b0('0xf')](_0xa0b0('0x43'),_0x2f3ab9[_0xa0b0('0x11')],_0x51405b);_0xf897be(_0x5e1ceb['error'](0x1f4,_0x2f3ab9[_0xa0b0('0x11')]));});});});};exports[_0xa0b0('0x47')]=function(_0x43527f){var _0x1b793d=this;return new Promise(function(_0x71074d,_0x487ff8){db[_0xa0b0('0x28')][_0xa0b0('0x44')]()['then'](function(_0x1494b4){return db[_0xa0b0('0x14')]['findAll']({'raw':_0x43527f['options']?_0x43527f[_0xa0b0('0x16')][_0xa0b0('0x17')]===undefined?!![]:![]:!![],'where':_0x43527f['options']?_0x43527f['options'][_0xa0b0('0x18')]||null:null,'attributes':_0x43527f['options']?_0x43527f[_0xa0b0('0x16')]['attributes']||null:null,'limit':_0x43527f['options']?_0x43527f[_0xa0b0('0x16')]['limit']||null:null,'include':_0x43527f['options']?_0x43527f[_0xa0b0('0x16')][_0xa0b0('0x1a')]?_[_0xa0b0('0x19')](_0x43527f['options'][_0xa0b0('0x1a')],function(_0xe8a4d0){return{'model':db[_0xe8a4d0[_0xa0b0('0x1b')]],'as':_0xe8a4d0['as'],'attributes':_0xe8a4d0['as']===_0xa0b0('0x2b')?_[_0xa0b0('0x2c')](_0x1494b4):_0xe8a4d0['attributes'],'include':_0xe8a4d0['include']?_['map'](_0xe8a4d0['include'],function(_0x2a77fb){return{'model':db[_0x2a77fb[_0xa0b0('0x1b')]],'as':_0x2a77fb['as'],'attributes':_0x2a77fb['attributes'],'include':_0x2a77fb['include']?_[_0xa0b0('0x19')](_0x2a77fb['include'],function(_0x476b7d){return{'model':db[_0x476b7d[_0xa0b0('0x1b')]],'as':_0x476b7d['as'],'attributes':_0x476b7d[_0xa0b0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa0b0('0x9')](function(_0x441d9a){logger[_0xa0b0('0xa')](_0xa0b0('0x13'),_0x43527f);logger[_0xa0b0('0x1d')](_0xa0b0('0x13'),_0x43527f,JSON[_0xa0b0('0xe')](_0x441d9a));_0x71074d(_0x441d9a);})[_0xa0b0('0x12')](function(_0x465a6a){logger['error'](_0xa0b0('0x13'),_0x465a6a[_0xa0b0('0x11')],_0x43527f);_0x487ff8(_0x1b793d[_0xa0b0('0xf')](0x1f4,_0x465a6a[_0xa0b0('0x11')]));});});});};exports[_0xa0b0('0x48')]=function(_0x4b4532){var _0x179a80=this;return new Promise(function(_0x5dfcad,_0x2a18ed){return db[_0xa0b0('0x28')][_0xa0b0('0x49')]({'raw':!![],'where':{'phone':_0x4b4532[_0xa0b0('0x16')][_0xa0b0('0x18')][_0xa0b0('0x4a')]},'attributes':['id',_0xa0b0('0x4b')],'order':[['id',_0xa0b0('0x4c')]]})[_0xa0b0('0x9')](function(_0x19d274){logger['info'](_0xa0b0('0x4d'),_0x4b4532);logger[_0xa0b0('0x1d')](_0xa0b0('0x4d'),_0x4b4532,JSON[_0xa0b0('0xe')](_0x19d274));_0x5dfcad(_0x19d274);})[_0xa0b0('0x12')](function(_0x35069f){logger[_0xa0b0('0xf')](_0xa0b0('0x4d'),_0x35069f[_0xa0b0('0x11')],_0x4b4532);_0x2a18ed(_0x179a80[_0xa0b0('0xf')](0x1f4,_0x35069f[_0xa0b0('0x11')]));});});};exports[_0xa0b0('0x4e')]=function(_0x2fab51){var _0x3efdd2=this;return new Promise(function(_0x1c98b9,_0x1b91ea){return db[_0xa0b0('0x3b')][_0xa0b0('0x29')](function(_0x3f8200){return db['CmHopper'][_0xa0b0('0x23')](_0x2fab51[_0xa0b0('0x21')],{'where':{},'transaction':_0x3f8200})[_0xa0b0('0x9')](function(_0x4930f7){logger[_0xa0b0('0xa')]('ResetActiveCalls',_0x2fab51);logger['debug'](_0xa0b0('0x4e'),_0x2fab51,JSON['stringify'](_0x4930f7));_0x1c98b9(_0x4930f7);})[_0xa0b0('0x12')](function(_0x2ba06e){logger['error'](_0xa0b0('0x4e'),_0x2ba06e[_0xa0b0('0x11')],_0x2fab51);_0x1b91ea(_0x3efdd2[_0xa0b0('0xf')](0x1f4,_0x2ba06e['message']));});});});};exports[_0xa0b0('0x4f')]=function(_0x27179d){var _0x55815d=this;var _0x406e3e=_0x27179d[_0xa0b0('0x21')]['where'][_0xa0b0('0x50')];var _0x4bf7e1=_0x27179d[_0xa0b0('0x21')]['where'][_0xa0b0('0x51')];var _0x1f9d1c=_0x27179d['body'][_0xa0b0('0x18')][_0xa0b0('0x52')];return new Promise(function(_0x10eefe,_0x59db62){return db['CmHopper'][_0xa0b0('0x15')]({'where':{'voiceQueueId':{'$in':_0x406e3e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xa0b0('0x3b')][_0xa0b0('0x3d')](_0xa0b0('0x53')+_0x4bf7e1+_0xa0b0('0x54')),'$gt':db[_0xa0b0('0x3b')][_0xa0b0('0x3d')](_0xa0b0('0x55'))}},'UserId':{'$in':_0x1f9d1c}},'include':[{'model':db[_0xa0b0('0x28')],'as':_0xa0b0('0x2b')},{'model':db[_0xa0b0('0x2d')],'as':_0xa0b0('0x2e'),'attributes':['id',_0xa0b0('0x2f'),_0xa0b0('0x30')]},{'model':db[_0xa0b0('0x56')],'as':_0xa0b0('0x57')}]})['then'](function(_0x28b9db){if(_0x28b9db['length']>0x0){return db['sequelize'][_0xa0b0('0x29')](function(_0x2b1e84){return db[_0xa0b0('0x14')]['update']({'recallmeNotifiedDate':db[_0xa0b0('0x3b')][_0xa0b0('0x3d')]('NOW()')},{'where':{'id':{'$in':_[_0xa0b0('0x19')](_0x28b9db,'id')}},'transaction':_0x2b1e84})[_0xa0b0('0x9')](function(){_0x10eefe(_0x28b9db);})[_0xa0b0('0x12')](function(_0x18d776){logger[_0xa0b0('0xf')](_0xa0b0('0x4f'),_0x18d776[_0xa0b0('0x11')],_0x27179d);_0x59db62(_0x55815d[_0xa0b0('0xf')](0x1f4,_0x18d776[_0xa0b0('0x11')]));});})[_0xa0b0('0x12')](function(_0x2d3b65){logger['error'](_0xa0b0('0x4f'),_0x2d3b65['message'],_0x27179d);_0x59db62(_0x55815d[_0xa0b0('0xf')](0x1f4,_0x2d3b65[_0xa0b0('0x11')]));});}else{_0x10eefe(_0x28b9db);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 525ff2d..a7cf746 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 _0xb270=['destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0xb270,0x182));var _0x0b27=function(_0x2e3c3a,_0x5e25aa){_0x2e3c3a=_0x2e3c3a-0x0;var _0x182aba=_0xb270[_0x2e3c3a];return _0x182aba;};'use strict';var express=require(_0x0b27('0x0'));var router=express[_0x0b27('0x1')]();var auth=require(_0x0b27('0x2'));var controller=require(_0x0b27('0x3'));router[_0x0b27('0x4')]('/',auth[_0x0b27('0x5')](),controller[_0x0b27('0x6')]);router['get'](_0x0b27('0x7'),auth[_0x0b27('0x5')](),controller[_0x0b27('0x8')]);router[_0x0b27('0x4')]('/opencontacts',auth['isAuthenticated'](),controller[_0x0b27('0x9')]);router[_0x0b27('0x4')]('/timezones',auth[_0x0b27('0x5')](),controller[_0x0b27('0xa')]);router['get'](_0x0b27('0xb'),auth[_0x0b27('0x5')](),controller[_0x0b27('0xc')]);router['get'](_0x0b27('0xd'),auth[_0x0b27('0x5')](),controller[_0x0b27('0xe')]);router[_0x0b27('0xf')]('/',auth[_0x0b27('0x5')](),controller[_0x0b27('0x10')]);router['post'](_0x0b27('0x11'),auth[_0x0b27('0x5')](),controller[_0x0b27('0x12')]);router['post'](_0x0b27('0x13'),auth[_0x0b27('0x5')](),controller[_0x0b27('0x14')]);router[_0x0b27('0x15')]('/:id',auth[_0x0b27('0x5')](),controller['update']);router['delete'](_0x0b27('0xb'),auth['isAuthenticated'](),controller[_0x0b27('0x16')]);module[_0x0b27('0x17')]=router; \ No newline at end of file +var _0x967e=['show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','put','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/opencontacts','/timezones','getTimezones'];(function(_0x40634d,_0x2b64da){var _0x51f357=function(_0x2f6e34){while(--_0x2f6e34){_0x40634d['push'](_0x40634d['shift']());}};_0x51f357(++_0x2b64da);}(_0x967e,0xdd));var _0xe967=function(_0x14dac0,_0x11522f){_0x14dac0=_0x14dac0-0x0;var _0x420f6e=_0x967e[_0x14dac0];return _0x420f6e;};'use strict';var express=require(_0xe967('0x0'));var router=express[_0xe967('0x1')]();var auth=require(_0xe967('0x2'));var controller=require(_0xe967('0x3'));router[_0xe967('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xe967('0x5')](),controller['describe']);router[_0xe967('0x4')](_0xe967('0x6'),auth[_0xe967('0x5')](),controller['getOpenContacts']);router[_0xe967('0x4')](_0xe967('0x7'),auth['isAuthenticated'](),controller[_0xe967('0x8')]);router['get']('/:id',auth[_0xe967('0x5')](),controller[_0xe967('0x9')]);router[_0xe967('0x4')](_0xe967('0xa'),auth['isAuthenticated'](),controller[_0xe967('0xb')]);router[_0xe967('0xc')]('/',auth[_0xe967('0x5')](),controller[_0xe967('0xd')]);router[_0xe967('0xc')](_0xe967('0xe'),auth[_0xe967('0x5')](),controller[_0xe967('0xf')]);router[_0xe967('0xc')](_0xe967('0x10'),auth[_0xe967('0x5')](),controller['getTimezone']);router[_0xe967('0x11')](_0xe967('0x12'),auth[_0xe967('0x5')](),controller[_0xe967('0x13')]);router[_0xe967('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xe967('0x15')]);module[_0xe967('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 f86be73..6509163 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 _0x9add=['INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','STRING'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x9add,0x123));var _0xd9ad=function(_0x729be8,_0x3fdb9f){_0x729be8=_0x729be8-0x0;var _0x2811b3=_0x9add[_0x729be8];return _0x2811b3;};'use strict';var moment=require(_0xd9ad('0x0'));var Sequelize=require(_0xd9ad('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xd9ad('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd9ad('0x4')](_0xd9ad('0x5'))},'countbusyretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd9ad('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9768=['sequelize','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','moment'];(function(_0x4042f9,_0xf0174){var _0x1f7780=function(_0x1efdac){while(--_0x1efdac){_0x4042f9['push'](_0x4042f9['shift']());}};_0x1f7780(++_0xf0174);}(_0x9768,0x77));var _0x8976=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0x9768[_0x54f3e8];return _0x267b37;};'use strict';var moment=require(_0x8976('0x0'));var Sequelize=require(_0x8976('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x8976('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8976('0x3')],'defaultValue':moment()['format'](_0x8976('0x4'))},'countbusyretry':{'type':Sequelize[_0x8976('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8976('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8976('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8976('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8976('0x5')],'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 498ac9c..b6f6b64 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 _0xb71a=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','UserProfileResource','error','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','squel','jsforce'];(function(_0x3a9781,_0x287609){var _0x39d146=function(_0x48d819){while(--_0x48d819){_0x3a9781['push'](_0x3a9781['shift']());}};_0x39d146(++_0x287609);}(_0xb71a,0x197));var _0xab71=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xb71a[_0x12d033];return _0x3b4e80;};'use strict';var emlformat=require(_0xab71('0x0'));var rimraf=require(_0xab71('0x1'));var zipdir=require(_0xab71('0x2'));var jsonpatch=require(_0xab71('0x3'));var rp=require(_0xab71('0x4'));var moment=require('moment');var BPromise=require(_0xab71('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab71('0x6'));var sox=require(_0xab71('0x7'));var csv=require(_0xab71('0x8'));var ejs=require(_0xab71('0x9'));var fs=require('fs');var fs_extra=require(_0xab71('0xa'));var _=require('lodash');var squel=require(_0xab71('0xb'));var crypto=require('crypto');var jsforce=require(_0xab71('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xab71('0x8'));var querystring=require(_0xab71('0xd'));var Papa=require('papaparse');var Redis=require(_0xab71('0xe'));var authService=require(_0xab71('0xf'));var qs=require(_0xab71('0x10'));var as=require(_0xab71('0x11'));var hardwareService=require(_0xab71('0x12'));var logger=require(_0xab71('0x13'))(_0xab71('0x14'));var utils=require(_0xab71('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xab71('0x16'));var db=require(_0xab71('0x17'))['db'];function respondWithStatusCode(_0x2ac796,_0x48b0ef){_0x48b0ef=_0x48b0ef||0xcc;return function(_0x4d3b63){if(_0x4d3b63){return _0x2ac796[_0xab71('0x18')](_0x48b0ef);}return _0x2ac796[_0xab71('0x19')](_0x48b0ef)[_0xab71('0x1a')]();};}function respondWithResult(_0x28beb0,_0x544158){_0x544158=_0x544158||0xc8;return function(_0x56df51){if(_0x56df51){return _0x28beb0[_0xab71('0x19')](_0x544158)['json'](_0x56df51);}};}function respondWithFilteredResult(_0x529302,_0x296c79){return function(_0x2d975f){if(_0x2d975f){var _0x371639=typeof _0x296c79[_0xab71('0x1b')]===_0xab71('0x1c')&&typeof _0x296c79[_0xab71('0x1d')]===_0xab71('0x1c');var _0x409e8f=_0x2d975f['count'];var _0x13fe04=_0x371639?0x0:_0x296c79[_0xab71('0x1b')];var _0x3da742=_0x371639?_0x2d975f[_0xab71('0x1e')]:_0x296c79[_0xab71('0x1b')]+_0x296c79['limit'];var _0x5be73e;if(_0x3da742>=_0x409e8f){_0x3da742=_0x409e8f;_0x5be73e=0xc8;}else{_0x5be73e=0xce;}_0x529302[_0xab71('0x19')](_0x5be73e);return _0x529302[_0xab71('0x1f')](_0xab71('0x20'),_0x13fe04+'-'+_0x3da742+'/'+_0x409e8f)[_0xab71('0x21')](_0x2d975f);}return null;};}function patchUpdates(_0x18c8f5){return function(_0x4d6f4c){try{jsonpatch[_0xab71('0x22')](_0x4d6f4c,_0x18c8f5,!![]);}catch(_0x27ffd9){return BPromise[_0xab71('0x23')](_0x27ffd9);}return _0x4d6f4c[_0xab71('0x24')]();};}function saveUpdates(_0x51cc44,_0x5c0b51){return function(_0x5a1ad4){if(_0x5a1ad4){return _0x5a1ad4[_0xab71('0x25')](_0x51cc44)['then'](function(_0x5b7d33){return _0x5b7d33;});}return null;};}function removeEntity(_0x275893,_0x109d33){return function(_0x2fc0e1){if(_0x2fc0e1){return _0x2fc0e1[_0xab71('0x26')]()[_0xab71('0x27')](function(){var _0x412462=_0x2fc0e1[_0xab71('0x28')]({'plain':!![]});var _0xd5356d=_0xab71('0x29');return db[_0xab71('0x2a')][_0xab71('0x26')]({'where':{'type':_0xd5356d,'resourceId':_0x412462['id']}})[_0xab71('0x27')](function(){return _0x2fc0e1;});})[_0xab71('0x27')](function(){_0x275893['status'](0xcc)[_0xab71('0x1a')]();});}};}function handleEntityNotFound(_0x530187,_0x550fdc){return function(_0x28d4b7){if(!_0x28d4b7){_0x530187['sendStatus'](0x194);}return _0x28d4b7;};}function handleError(_0x1339e4,_0x5bce22){_0x5bce22=_0x5bce22||0x1f4;return function(_0x402651){logger[_0xab71('0x2b')](_0x402651['stack']);if(_0x402651[_0xab71('0x2c')]){delete _0x402651['name'];}_0x1339e4['status'](_0x5bce22)[_0xab71('0x2d')](_0x402651);};}exports[_0xab71('0x2e')]=function(_0x2a975e,_0x1f25b5){var _0x1d6a9d={},_0x1eec7c={},_0xfc3be0={'count':0x0,'rows':[]};var _0x2c74b7=_[_0xab71('0x2f')](db[_0xab71('0x30')][_0xab71('0x31')],function(_0x24ff1c){return{'name':_0x24ff1c[_0xab71('0x32')],'type':_0x24ff1c[_0xab71('0x33')][_0xab71('0x34')]};});_0x1eec7c['model']=_[_0xab71('0x2f')](_0x2c74b7,_0xab71('0x2c'));_0x1eec7c[_0xab71('0x35')]=_[_0xab71('0x36')](_0x2a975e['query']);_0x1eec7c[_0xab71('0x37')]=_[_0xab71('0x38')](_0x1eec7c[_0xab71('0x39')],_0x1eec7c[_0xab71('0x35')]);_0x1d6a9d[_0xab71('0x3a')]=_[_0xab71('0x38')](_0x1eec7c['model'],qs['fields'](_0x2a975e[_0xab71('0x35')]['fields']));_0x1d6a9d['attributes']=_0x1d6a9d[_0xab71('0x3a')][_0xab71('0x3b')]?_0x1d6a9d[_0xab71('0x3a')]:_0x1eec7c[_0xab71('0x39')];if(!_0x2a975e[_0xab71('0x35')][_0xab71('0x3c')](_0xab71('0x3d'))){_0x1d6a9d['limit']=qs['limit'](_0x2a975e[_0xab71('0x35')][_0xab71('0x1d')]);_0x1d6a9d[_0xab71('0x1b')]=qs['offset'](_0x2a975e[_0xab71('0x35')][_0xab71('0x1b')]);}_0x1d6a9d[_0xab71('0x3e')]=qs[_0xab71('0x3f')](_0x2a975e['query'][_0xab71('0x3f')]);_0x1d6a9d[_0xab71('0x40')]=qs[_0xab71('0x37')](_[_0xab71('0x41')](_0x2a975e['query'],_0x1eec7c[_0xab71('0x37')]),_0x2c74b7);if(_0x2a975e[_0xab71('0x35')]['filter']){_0x1d6a9d[_0xab71('0x40')]=_[_0xab71('0x42')](_0x1d6a9d[_0xab71('0x40')],{'$or':_[_0xab71('0x2f')](_0x2c74b7,function(_0x24aff4){if(_0x24aff4[_0xab71('0x33')]!=='VIRTUAL'){var _0x1a56b7={};_0x1a56b7[_0x24aff4[_0xab71('0x2c')]]={'$like':'%'+_0x2a975e['query'][_0xab71('0x43')]+'%'};return _0x1a56b7;}})});}_0x1d6a9d=_[_0xab71('0x42')]({},_0x1d6a9d,_0x2a975e[_0xab71('0x44')]);var _0x46bdd8={'where':_0x1d6a9d[_0xab71('0x40')]};return db['CmHopperAdditionalPhone']['count'](_0x46bdd8)['then'](function(_0x100008){_0xfc3be0[_0xab71('0x1e')]=_0x100008;if(_0x2a975e['query']['includeAll']){_0x1d6a9d[_0xab71('0x45')]=[{'all':!![]}];}return db[_0xab71('0x30')][_0xab71('0x46')](_0x1d6a9d);})[_0xab71('0x27')](function(_0x42796b){_0xfc3be0[_0xab71('0x47')]=_0x42796b;return _0xfc3be0;})['then'](respondWithFilteredResult(_0x1f25b5,_0x1d6a9d))[_0xab71('0x48')](handleError(_0x1f25b5,null));};exports[_0xab71('0x49')]=function(_0x2b4cab,_0x55af43){var _0x560e1a={'raw':!![],'where':{'id':_0x2b4cab[_0xab71('0x4a')]['id']}},_0x186c13={};_0x186c13[_0xab71('0x39')]=_[_0xab71('0x36')](db[_0xab71('0x30')][_0xab71('0x31')]);_0x186c13['query']=_[_0xab71('0x36')](_0x2b4cab[_0xab71('0x35')]);_0x186c13[_0xab71('0x37')]=_[_0xab71('0x38')](_0x186c13[_0xab71('0x39')],_0x186c13[_0xab71('0x35')]);_0x560e1a['attributes']=_['intersection'](_0x186c13['model'],qs[_0xab71('0x4b')](_0x2b4cab['query'][_0xab71('0x4b')]));_0x560e1a[_0xab71('0x3a')]=_0x560e1a[_0xab71('0x3a')]['length']?_0x560e1a['attributes']:_0x186c13[_0xab71('0x39')];if(_0x2b4cab[_0xab71('0x35')][_0xab71('0x4c')]){_0x560e1a[_0xab71('0x45')]=[{'all':!![]}];}_0x560e1a=_['merge']({},_0x560e1a,_0x2b4cab[_0xab71('0x44')]);return db[_0xab71('0x30')][_0xab71('0x4d')](_0x560e1a)['then'](handleEntityNotFound(_0x55af43,null))['then'](respondWithResult(_0x55af43,null))[_0xab71('0x48')](handleError(_0x55af43,null));};exports[_0xab71('0x4e')]=function(_0x47971d,_0x58d95d){return db[_0xab71('0x30')]['create'](_0x47971d['body'],{})['then'](function(_0x32950b){var _0x2f4bc5=_0x47971d[_0xab71('0x4f')][_0xab71('0x28')]({'plain':!![]});if(!_0x2f4bc5)throw new Error(_0xab71('0x50'));if(_0x2f4bc5[_0xab71('0x51')]==='user'){var _0x32ebff=_0x32950b[_0xab71('0x28')]({'plain':!![]});var _0x3be01a='CmHopperAdditionalPhones';return db['UserProfileSection'][_0xab71('0x4d')]({'where':{'name':_0x3be01a,'userProfileId':_0x2f4bc5[_0xab71('0x52')]},'raw':!![]})['then'](function(_0xf52a90){if(_0xf52a90&&_0xf52a90['autoAssociation']===0x0){return db['UserProfileResource'][_0xab71('0x4e')]({'name':_0x32ebff[_0xab71('0x2c')],'resourceId':_0x32ebff['id'],'type':_0xf52a90['name'],'sectionId':_0xf52a90['id']},{})[_0xab71('0x27')](function(){return _0x32950b;});}else{return _0x32950b;}})[_0xab71('0x48')](function(_0x4b2114){logger[_0xab71('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b2114);throw _0x4b2114;});}return _0x32950b;})[_0xab71('0x27')](respondWithResult(_0x58d95d,0xc9))[_0xab71('0x48')](handleError(_0x58d95d,null));};exports[_0xab71('0x25')]=function(_0x4c9df5,_0xf82a9b){if(_0x4c9df5[_0xab71('0x53')]['id']){delete _0x4c9df5[_0xab71('0x53')]['id'];}return db[_0xab71('0x30')][_0xab71('0x4d')]({'where':{'id':_0x4c9df5['params']['id']}})['then'](handleEntityNotFound(_0xf82a9b,null))[_0xab71('0x27')](saveUpdates(_0x4c9df5['body'],null))[_0xab71('0x27')](respondWithResult(_0xf82a9b,null))[_0xab71('0x48')](handleError(_0xf82a9b,null));};exports[_0xab71('0x26')]=function(_0x2e4ae4,_0x5da486){return db[_0xab71('0x30')][_0xab71('0x4d')]({'where':{'id':_0x2e4ae4['params']['id']}})[_0xab71('0x27')](handleEntityNotFound(_0x5da486,null))[_0xab71('0x27')](removeEntity(_0x5da486,null))[_0xab71('0x48')](handleError(_0x5da486,null));}; \ No newline at end of file +var _0xa580=['status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','destroy','end','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa580,0x121));var _0x0a58=function(_0x3e9e8d,_0x50d18c){_0x3e9e8d=_0x3e9e8d-0x0;var _0x1a09a0=_0xa580[_0x3e9e8d];return _0x1a09a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a58('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a58('0x1'));var BPromise=require(_0x0a58('0x2'));var Mustache=require('mustache');var util=require(_0x0a58('0x3'));var path=require(_0x0a58('0x4'));var sox=require(_0x0a58('0x5'));var csv=require(_0x0a58('0x6'));var ejs=require(_0x0a58('0x7'));var fs=require('fs');var fs_extra=require(_0x0a58('0x8'));var _=require('lodash');var squel=require(_0x0a58('0x9'));var crypto=require(_0x0a58('0xa'));var jsforce=require(_0x0a58('0xb'));var deskjs=require(_0x0a58('0xc'));var toCsv=require(_0x0a58('0x6'));var querystring=require(_0x0a58('0xd'));var Papa=require(_0x0a58('0xe'));var Redis=require(_0x0a58('0xf'));var authService=require(_0x0a58('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0a58('0x11'));var hardwareService=require(_0x0a58('0x12'));var logger=require(_0x0a58('0x13'))('api');var utils=require(_0x0a58('0x14'));var config=require(_0x0a58('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a58('0x16'))['db'];function respondWithStatusCode(_0xcde61,_0x3a1db4){_0x3a1db4=_0x3a1db4||0xcc;return function(_0x57a785){if(_0x57a785){return _0xcde61['sendStatus'](_0x3a1db4);}return _0xcde61[_0x0a58('0x17')](_0x3a1db4)['end']();};}function respondWithResult(_0x222df2,_0x346da6){_0x346da6=_0x346da6||0xc8;return function(_0x1cd643){if(_0x1cd643){return _0x222df2[_0x0a58('0x17')](_0x346da6)[_0x0a58('0x18')](_0x1cd643);}};}function respondWithFilteredResult(_0x2f6a9e,_0x2e0898){return function(_0x230250){if(_0x230250){var _0x2c42d7=typeof _0x2e0898[_0x0a58('0x19')]===_0x0a58('0x1a')&&typeof _0x2e0898[_0x0a58('0x1b')]===_0x0a58('0x1a');var _0x58e57d=_0x230250['count'];var _0x2267b9=_0x2c42d7?0x0:_0x2e0898[_0x0a58('0x19')];var _0x7a93ae=_0x2c42d7?_0x230250[_0x0a58('0x1c')]:_0x2e0898['offset']+_0x2e0898[_0x0a58('0x1b')];var _0x20b301;if(_0x7a93ae>=_0x58e57d){_0x7a93ae=_0x58e57d;_0x20b301=0xc8;}else{_0x20b301=0xce;}_0x2f6a9e[_0x0a58('0x17')](_0x20b301);return _0x2f6a9e[_0x0a58('0x1d')](_0x0a58('0x1e'),_0x2267b9+'-'+_0x7a93ae+'/'+_0x58e57d)['json'](_0x230250);}return null;};}function patchUpdates(_0x18ef82){return function(_0x59df7d){try{jsonpatch['apply'](_0x59df7d,_0x18ef82,!![]);}catch(_0x2dfbd2){return BPromise[_0x0a58('0x1f')](_0x2dfbd2);}return _0x59df7d[_0x0a58('0x20')]();};}function saveUpdates(_0x3f8da2,_0x534f63){return function(_0x32259e){if(_0x32259e){return _0x32259e['update'](_0x3f8da2)[_0x0a58('0x21')](function(_0x323085){return _0x323085;});}return null;};}function removeEntity(_0x2ee4af,_0x4ea3bf){return function(_0x2d147d){if(_0x2d147d){return _0x2d147d['destroy']()[_0x0a58('0x21')](function(){var _0x5305c1=_0x2d147d[_0x0a58('0x22')]({'plain':!![]});var _0x48e082='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x0a58('0x23')]({'where':{'type':_0x48e082,'resourceId':_0x5305c1['id']}})['then'](function(){return _0x2d147d;});})[_0x0a58('0x21')](function(){_0x2ee4af[_0x0a58('0x17')](0xcc)[_0x0a58('0x24')]();});}};}function handleEntityNotFound(_0x52c7e5,_0x46a08c){return function(_0x2ab291){if(!_0x2ab291){_0x52c7e5[_0x0a58('0x25')](0x194);}return _0x2ab291;};}function handleError(_0x45fa21,_0x5df835){_0x5df835=_0x5df835||0x1f4;return function(_0x12c788){logger[_0x0a58('0x26')](_0x12c788[_0x0a58('0x27')]);if(_0x12c788[_0x0a58('0x28')]){delete _0x12c788['name'];}_0x45fa21[_0x0a58('0x17')](_0x5df835)[_0x0a58('0x29')](_0x12c788);};}exports[_0x0a58('0x2a')]=function(_0x58a4d9,_0x147d34){var _0x55938b={},_0x868ffc={},_0x55754d={'count':0x0,'rows':[]};var _0x48a56c=_[_0x0a58('0x2b')](db[_0x0a58('0x2c')][_0x0a58('0x2d')],function(_0xaba103){return{'name':_0xaba103['fieldName'],'type':_0xaba103[_0x0a58('0x2e')]['key']};});_0x868ffc[_0x0a58('0x2f')]=_[_0x0a58('0x2b')](_0x48a56c,_0x0a58('0x28'));_0x868ffc[_0x0a58('0x30')]=_['keys'](_0x58a4d9[_0x0a58('0x30')]);_0x868ffc[_0x0a58('0x31')]=_['intersection'](_0x868ffc['model'],_0x868ffc['query']);_0x55938b[_0x0a58('0x32')]=_[_0x0a58('0x33')](_0x868ffc[_0x0a58('0x2f')],qs[_0x0a58('0x34')](_0x58a4d9['query'][_0x0a58('0x34')]));_0x55938b[_0x0a58('0x32')]=_0x55938b[_0x0a58('0x32')][_0x0a58('0x35')]?_0x55938b[_0x0a58('0x32')]:_0x868ffc['model'];if(!_0x58a4d9['query'][_0x0a58('0x36')](_0x0a58('0x37'))){_0x55938b[_0x0a58('0x1b')]=qs[_0x0a58('0x1b')](_0x58a4d9[_0x0a58('0x30')][_0x0a58('0x1b')]);_0x55938b[_0x0a58('0x19')]=qs['offset'](_0x58a4d9[_0x0a58('0x30')][_0x0a58('0x19')]);}_0x55938b['order']=qs['sort'](_0x58a4d9[_0x0a58('0x30')]['sort']);_0x55938b[_0x0a58('0x38')]=qs[_0x0a58('0x31')](_['pick'](_0x58a4d9[_0x0a58('0x30')],_0x868ffc['filters']),_0x48a56c);if(_0x58a4d9['query']['filter']){_0x55938b[_0x0a58('0x38')]=_[_0x0a58('0x39')](_0x55938b[_0x0a58('0x38')],{'$or':_[_0x0a58('0x2b')](_0x48a56c,function(_0x2ed921){if(_0x2ed921['type']!==_0x0a58('0x3a')){var _0x3402ee={};_0x3402ee[_0x2ed921[_0x0a58('0x28')]]={'$like':'%'+_0x58a4d9['query'][_0x0a58('0x3b')]+'%'};return _0x3402ee;}})});}_0x55938b=_['merge']({},_0x55938b,_0x58a4d9['options']);var _0x354b54={'where':_0x55938b['where']};return db[_0x0a58('0x2c')][_0x0a58('0x1c')](_0x354b54)['then'](function(_0x12f1d3){_0x55754d[_0x0a58('0x1c')]=_0x12f1d3;if(_0x58a4d9[_0x0a58('0x30')][_0x0a58('0x3c')]){_0x55938b[_0x0a58('0x3d')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x0a58('0x3e')](_0x55938b);})[_0x0a58('0x21')](function(_0x3b8465){_0x55754d[_0x0a58('0x3f')]=_0x3b8465;return _0x55754d;})['then'](respondWithFilteredResult(_0x147d34,_0x55938b))[_0x0a58('0x40')](handleError(_0x147d34,null));};exports[_0x0a58('0x41')]=function(_0x3c37bc,_0xb9f18e){var _0xd03a33={'raw':!![],'where':{'id':_0x3c37bc[_0x0a58('0x42')]['id']}},_0x489437={};_0x489437['model']=_[_0x0a58('0x43')](db[_0x0a58('0x2c')][_0x0a58('0x2d')]);_0x489437[_0x0a58('0x30')]=_['keys'](_0x3c37bc[_0x0a58('0x30')]);_0x489437[_0x0a58('0x31')]=_[_0x0a58('0x33')](_0x489437[_0x0a58('0x2f')],_0x489437[_0x0a58('0x30')]);_0xd03a33['attributes']=_['intersection'](_0x489437[_0x0a58('0x2f')],qs[_0x0a58('0x34')](_0x3c37bc[_0x0a58('0x30')][_0x0a58('0x34')]));_0xd03a33['attributes']=_0xd03a33[_0x0a58('0x32')][_0x0a58('0x35')]?_0xd03a33[_0x0a58('0x32')]:_0x489437[_0x0a58('0x2f')];if(_0x3c37bc[_0x0a58('0x30')]['includeAll']){_0xd03a33[_0x0a58('0x3d')]=[{'all':!![]}];}_0xd03a33=_['merge']({},_0xd03a33,_0x3c37bc[_0x0a58('0x44')]);return db[_0x0a58('0x2c')][_0x0a58('0x45')](_0xd03a33)[_0x0a58('0x21')](handleEntityNotFound(_0xb9f18e,null))[_0x0a58('0x21')](respondWithResult(_0xb9f18e,null))[_0x0a58('0x40')](handleError(_0xb9f18e,null));};exports[_0x0a58('0x46')]=function(_0x19cd69,_0x417f7f){return db['CmHopperAdditionalPhone'][_0x0a58('0x46')](_0x19cd69[_0x0a58('0x47')],{})[_0x0a58('0x21')](function(_0x19f6cf){var _0x197ed9=_0x19cd69[_0x0a58('0x48')]['get']({'plain':!![]});if(!_0x197ed9)throw new Error(_0x0a58('0x49'));if(_0x197ed9['role']===_0x0a58('0x48')){var _0x5e9f84=_0x19f6cf[_0x0a58('0x22')]({'plain':!![]});var _0x104bc4='CmHopperAdditionalPhones';return db[_0x0a58('0x4a')]['find']({'where':{'name':_0x104bc4,'userProfileId':_0x197ed9[_0x0a58('0x4b')]},'raw':!![]})['then'](function(_0x233c0b){if(_0x233c0b&&_0x233c0b['autoAssociation']===0x0){return db[_0x0a58('0x4c')][_0x0a58('0x46')]({'name':_0x5e9f84['name'],'resourceId':_0x5e9f84['id'],'type':_0x233c0b[_0x0a58('0x28')],'sectionId':_0x233c0b['id']},{})['then'](function(){return _0x19f6cf;});}else{return _0x19f6cf;}})['catch'](function(_0x50f10a){logger['error'](_0x0a58('0x4d'),_0x50f10a);throw _0x50f10a;});}return _0x19f6cf;})['then'](respondWithResult(_0x417f7f,0xc9))['catch'](handleError(_0x417f7f,null));};exports['update']=function(_0x3782cd,_0x2475ab){if(_0x3782cd['body']['id']){delete _0x3782cd['body']['id'];}return db[_0x0a58('0x2c')][_0x0a58('0x45')]({'where':{'id':_0x3782cd[_0x0a58('0x42')]['id']}})['then'](handleEntityNotFound(_0x2475ab,null))[_0x0a58('0x21')](saveUpdates(_0x3782cd[_0x0a58('0x47')],null))['then'](respondWithResult(_0x2475ab,null))['catch'](handleError(_0x2475ab,null));};exports[_0x0a58('0x23')]=function(_0x4b4d09,_0x39226f){return db[_0x0a58('0x2c')][_0x0a58('0x45')]({'where':{'id':_0x4b4d09['params']['id']}})[_0x0a58('0x21')](handleEntityNotFound(_0x39226f,null))[_0x0a58('0x21')](removeEntity(_0x39226f,null))['catch'](handleError(_0x39226f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 06dc87c..9d0be61 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 _0xfd4c=['CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define'];(function(_0x199b7c,_0x287886){var _0x3bb281=function(_0x42c16c){while(--_0x42c16c){_0x199b7c['push'](_0x199b7c['shift']());}};_0x3bb281(++_0x287886);}(_0xfd4c,0x17b));var _0xcfd4=function(_0x182375,_0x57fc9a){_0x182375=_0x182375-0x0;var _0x58cf1a=_0xfd4c[_0x182375];return _0x58cf1a;};'use strict';var _=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var logger=require('../../config/logger')(_0xcfd4('0x2'));var moment=require(_0xcfd4('0x3'));var BPromise=require(_0xcfd4('0x4'));var rp=require(_0xcfd4('0x5'));var fs=require('fs');var path=require(_0xcfd4('0x6'));var rimraf=require('rimraf');var config=require(_0xcfd4('0x7'));var attributes=require(_0xcfd4('0x8'));module[_0xcfd4('0x9')]=function(_0xd1c181,_0x2fddeb){return _0xd1c181[_0xcfd4('0xa')](_0xcfd4('0xb'),attributes,{'tableName':_0xcfd4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5342=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','moment'];(function(_0x153b65,_0x53a3b5){var _0xed12fc=function(_0x49ce5e){while(--_0x49ce5e){_0x153b65['push'](_0x153b65['shift']());}};_0xed12fc(++_0x53a3b5);}(_0x5342,0xb2));var _0x2534=function(_0x451d04,_0x999e7d){_0x451d04=_0x451d04-0x0;var _0x32c6fe=_0x5342[_0x451d04];return _0x32c6fe;};'use strict';var _=require(_0x2534('0x0'));var util=require(_0x2534('0x1'));var logger=require(_0x2534('0x2'))('api');var moment=require(_0x2534('0x3'));var BPromise=require(_0x2534('0x4'));var rp=require(_0x2534('0x5'));var fs=require('fs');var path=require(_0x2534('0x6'));var rimraf=require(_0x2534('0x7'));var config=require(_0x2534('0x8'));var attributes=require(_0x2534('0x9'));module[_0x2534('0xa')]=function(_0x5a424f,_0x4c875d){return _0x5a424f[_0x2534('0xb')](_0x2534('0xc'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 2e1eea6..874f25c 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 _0x6acf=['countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countbusyretry','entity','catch','SwapAdditionalPhones','waitTime','duration','isNil','scheduledat','add','minutes','phone','countnoanswerretry','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','client','http','request','info','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x172004,_0x44fa6e){var _0x5d92b7=function(_0x3d76de){while(--_0x3d76de){_0x172004['push'](_0x172004['shift']());}};_0x5d92b7(++_0x44fa6e);}(_0x6acf,0x1d5));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var util=require(_0xf6ac('0x1'));var moment=require(_0xf6ac('0x2'));var BPromise=require(_0xf6ac('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6ac('0x4'));var db=require(_0xf6ac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6ac('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6ac('0x7')][_0xf6ac('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c93e3,_0x4467f2,_0x59462f){return new BPromise(function(_0x2a4155,_0x554a70){return client[_0xf6ac('0x9')](_0x3c93e3,_0x59462f)['then'](function(_0x466535){logger[_0xf6ac('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4467f2,_0xf6ac('0xb'));logger['debug'](_0xf6ac('0xc'),_0x4467f2,_0xf6ac('0xb'),JSON[_0xf6ac('0xd')](_0x466535));if(_0x466535[_0xf6ac('0xe')]){if(_0x466535['error'][_0xf6ac('0xf')]===0x1f4){logger['error'](_0xf6ac('0x10'),_0x4467f2,_0x466535['error'][_0xf6ac('0x11')]);return _0x554a70(_0x466535[_0xf6ac('0xe')][_0xf6ac('0x11')]);}logger['error'](_0xf6ac('0x10'),_0x4467f2,_0x466535[_0xf6ac('0xe')][_0xf6ac('0x11')]);return _0x2a4155(_0x466535[_0xf6ac('0xe')][_0xf6ac('0x11')]);}else{logger[_0xf6ac('0xa')](_0xf6ac('0x10'),_0x4467f2,_0xf6ac('0xb'));_0x2a4155(_0x466535[_0xf6ac('0x12')]['message']);}})['catch'](function(_0x3edd97){logger[_0xf6ac('0xe')](_0xf6ac('0x10'),_0x4467f2,_0x3edd97);_0x554a70(_0x3edd97);});});}exports[_0xf6ac('0x13')]=function(_0x5f1b22){var _0x32499b=this;return new Promise(function(_0x5d0f85,_0x452e5a){return db[_0xf6ac('0x14')][_0xf6ac('0x15')]({'raw':!![],'where':{'ContactId':_0x5f1b22[_0xf6ac('0x16')][_0xf6ac('0x17')],'ListId':_0x5f1b22[_0xf6ac('0x16')][_0xf6ac('0x18')],'VoiceQueueId':_0x5f1b22[_0xf6ac('0x16')]['VoiceQueueId']===undefined?null:_0x5f1b22[_0xf6ac('0x16')][_0xf6ac('0x19')],'CampaignId':_0x5f1b22[_0xf6ac('0x16')][_0xf6ac('0x1a')]===undefined?null:_0x5f1b22[_0xf6ac('0x16')][_0xf6ac('0x1a')]}})[_0xf6ac('0x1b')](function(_0x550876){if(_0x550876!=null){return db[_0xf6ac('0x1c')][_0xf6ac('0x15')]({'raw':!![],'where':{'CmHopperId':_0x550876['id'],'OrderBy':{'$gt':_0x550876[_0xf6ac('0x1d')]}},'order':[[_0xf6ac('0x1d'),_0xf6ac('0x1e')]]})[_0xf6ac('0x1b')](function(_0x905013){var _0x35a35d=0x0;if(_0x905013){if(_0x905013['countbusyretry']+_0x905013[_0xf6ac('0x1f')]+_0x905013['countnoanswerretry']+_0x905013[_0xf6ac('0x20')]+_0x905013[_0xf6ac('0x21')]+_0x905013[_0xf6ac('0x22')]+_0x905013[_0xf6ac('0x23')]+_0x905013[_0xf6ac('0x24')]<_0x5f1b22['entity'][_0xf6ac('0x25')])_0x35a35d=0x1;_0x5d0f85({'additional':_0x35a35d});}else{return db[_0xf6ac('0x1c')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x550876['id']},'order':[[_0xf6ac('0x1d'),'ASC']]})[_0xf6ac('0x1b')](function(_0x54ea1b){var _0x5dc0ec=0x0;if(_0x54ea1b){if(_0x54ea1b[_0xf6ac('0x26')]+_0x54ea1b[_0xf6ac('0x1f')]+_0x54ea1b['countnoanswerretry']+_0x54ea1b['countnosuchnumberretry']+_0x54ea1b[_0xf6ac('0x21')]+_0x54ea1b[_0xf6ac('0x22')]+_0x54ea1b[_0xf6ac('0x23')]+_0x54ea1b[_0xf6ac('0x24')]<_0x5f1b22[_0xf6ac('0x27')][_0xf6ac('0x25')])_0x5dc0ec=0x1;_0x5d0f85({'additional':_0x5dc0ec});}else{_0x5d0f85({'additional':0x0});}})[_0xf6ac('0x28')](function(_0x115944){logger[_0xf6ac('0xe')](_0xf6ac('0x13'),_0x115944['message']);_0x452e5a(_0x32499b[_0xf6ac('0xe')](0x1f4,_0x115944['message']));});}})[_0xf6ac('0x28')](function(_0x5c33b0){logger[_0xf6ac('0xe')](_0xf6ac('0x13'),_0x5c33b0[_0xf6ac('0x11')]);_0x452e5a(_0x32499b['error'](0x1f4,_0x5c33b0[_0xf6ac('0x11')]));});}else _0x5d0f85({'additional':0x0});});});};exports[_0xf6ac('0x29')]=function(_0x246989){var _0x1da5d7=this;return new Promise(function(_0x1ac01d,_0x57ce6a){return db[_0xf6ac('0x14')][_0xf6ac('0x15')]({'raw':!![],'where':{'ContactId':_0x246989[_0xf6ac('0x16')][_0xf6ac('0x17')],'ListId':_0x246989['body'][_0xf6ac('0x18')],'VoiceQueueId':_0x246989[_0xf6ac('0x16')][_0xf6ac('0x19')]===undefined?null:_0x246989['body']['VoiceQueueId'],'CampaignId':_0x246989[_0xf6ac('0x16')]['CampaignId']===undefined?null:_0x246989['body'][_0xf6ac('0x1a')]}})[_0xf6ac('0x1b')](function(_0x1d899d){if(_0x1d899d!=null){return db[_0xf6ac('0x1c')][_0xf6ac('0x15')]({'raw':!![],'where':{'CmHopperId':_0x1d899d['id'],'OrderBy':{'$gte':_0x1d899d[_0xf6ac('0x1d')]}},'order':[[_0xf6ac('0x1d'),'ASC']]})['then'](function(_0x396b87){if(_0x396b87)return activateAdditionalPhone(_0x1d899d,_0x246989[_0xf6ac('0x16')],_0x396b87,_0x246989['duration'],_0x246989[_0xf6ac('0x2a')])[_0xf6ac('0x1b')](function(_0x396603){_0x1ac01d(_0x396603);});else{return db[_0xf6ac('0x1c')][_0xf6ac('0x15')]({'raw':!![],'where':{'CmHopperId':_0x1d899d['id']},'order':[[_0xf6ac('0x1d'),'ASC']]})[_0xf6ac('0x1b')](function(_0x4e8cc2){if(_0x4e8cc2)return activateAdditionalPhone(_0x1d899d,_0x246989['body'],_0x4e8cc2,_0x246989[_0xf6ac('0x2b')],_0x246989['waitTime'])[_0xf6ac('0x1b')](function(_0x55a9ce){_0x1ac01d(_0x55a9ce);});else{_0x1ac01d({'id':_0x1d899d['id'],'phone':''});}})[_0xf6ac('0x28')](function(_0x799249){logger['error'](_0xf6ac('0x13'),_0x799249[_0xf6ac('0x11')]);_0x57ce6a(_0x1da5d7[_0xf6ac('0xe')](0x1f4,_0x799249[_0xf6ac('0x11')]));});}})[_0xf6ac('0x28')](function(_0x55a76f){logger[_0xf6ac('0xe')](_0xf6ac('0x13'),_0x55a76f[_0xf6ac('0x11')]);_0x57ce6a(_0x1da5d7[_0xf6ac('0xe')](0x1f4,_0x55a76f[_0xf6ac('0x11')]));});}else _0x1ac01d(0x1);});});};function activateAdditionalPhone(_0x30e563,_0x2bf8fd,_0x3b3a12,_0x1c6166,_0x1337c1){return new Promise(function(_0x31d600,_0x1021e4){var _0x3ea863;if(_[_0xf6ac('0x2c')](_0x3b3a12[_0xf6ac('0x2d')])){_0x3b3a12[_0xf6ac('0x2d')]=moment();}if(moment()>moment(_0x3b3a12['scheduledat'])){_0x3ea863=moment()[_0xf6ac('0x2e')](_0x1337c1||0x3,_0xf6ac('0x2f'));}else{if(_0x3b3a12[_0xf6ac('0x1d')]==0x0){_0x3ea863=moment(_0x3b3a12[_0xf6ac('0x2d')]);}else{_0x3ea863=moment()[_0xf6ac('0x2e')](_0x1337c1||0x3,_0xf6ac('0x2f'));}}if(_[_0xf6ac('0x2c')](_0x3ea863)){_0x3ea863=moment()[_0xf6ac('0x2e')](_0x1337c1||0x3,_0xf6ac('0x2f'));}var _0x2e5a70={'phone':_0x30e563[_0xf6ac('0x30')],'active':0x0,'OrderBy':_[_0xf6ac('0x2c')](_0x30e563[_0xf6ac('0x1d')])?0x0:_0x30e563[_0xf6ac('0x1d')],'scheduledat':moment()['add'](_0x1c6166||0x1,_0xf6ac('0x2f')),'countbusyretry':_0x2bf8fd['countbusyretry'],'countcongestionretry':_0x2bf8fd[_0xf6ac('0x1f')],'countnoanswerretry':_0x2bf8fd[_0xf6ac('0x31')],'countnosuchnumberretry':_0x2bf8fd[_0xf6ac('0x20')],'countdropretry':_0x2bf8fd[_0xf6ac('0x21')],'countabandonedretry':_0x2bf8fd[_0xf6ac('0x22')],'countmachineretry':_0x2bf8fd[_0xf6ac('0x23')],'countagentrejectretry':_0x2bf8fd[_0xf6ac('0x24')],'createdAt':_0x2bf8fd[_0xf6ac('0x32')],'updatedAt':_0x2bf8fd[_0xf6ac('0x33')]};var _0x5d161e={'CmHopperId':_0x30e563['id'],'phone':_0x3b3a12[_0xf6ac('0x30')],'active':0x0,'OrderBy':_[_0xf6ac('0x2c')](_0x3b3a12[_0xf6ac('0x1d')])?0x0:_0x3b3a12['OrderBy'],'scheduledat':_0x3ea863,'countbusyretry':_0x3b3a12[_0xf6ac('0x26')],'countcongestionretry':_0x3b3a12['countcongestionretry'],'countnoanswerretry':_0x3b3a12['countnoanswerretry'],'countnosuchnumberretry':_0x3b3a12[_0xf6ac('0x20')],'countdropretry':_0x3b3a12[_0xf6ac('0x21')],'countabandonedretry':_0x3b3a12[_0xf6ac('0x22')],'countmachineretry':_0x3b3a12[_0xf6ac('0x23')],'countagentrejectretry':_0x3b3a12['countagentrejectretry'],'createdAt':_0x3b3a12[_0xf6ac('0x32')],'updatedAt':_0x3b3a12[_0xf6ac('0x33')]};return db[_0xf6ac('0x34')]['transaction'](function(_0x48d504){return db[_0xf6ac('0x1c')][_0xf6ac('0x35')](_0x2e5a70,{'where':{'id':_0x3b3a12['id']}},{'transaction':_0x48d504})['then'](function(){return db[_0xf6ac('0x14')][_0xf6ac('0x35')](_0x5d161e,{'where':{'id':_0x30e563['id']}},{'transaction':_0x48d504});});})[_0xf6ac('0x1b')](function(_0x30aa7f){_0x31d600({'id':_0x30e563['id'],'phone':_0x3b3a12['phone']});})[_0xf6ac('0x28')](function(_0x154897){logger[_0xf6ac('0xe')](_0xf6ac('0x36'),_0x154897[_0xf6ac('0x11')]);_0x1021e4({'error':_0x154897['message']});});});}exports['IncrementPreviewCounters']=function(_0x3513e6){var _0x4fd230=this;return new Promise(function(_0x176dec,_0x40af45){return db['CmHopper'][_0xf6ac('0x35')](_0x3513e6['body'][_0xf6ac('0x37')],{'where':{'id':_0x3513e6['body']['id']}})['then'](function(_0x3c24ae){_0x176dec(_0x3c24ae);})['catch'](function(_0x18206f){logger[_0xf6ac('0xe')]('IncrementPreviewCounters',_0x18206f[_0xf6ac('0x11')]);_0x40af45(_0x4fd230['error'](0x1f4,_0x18206f['message']));});});}; \ No newline at end of file +var _0xde60=['update','field','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','ASC','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','SwapAdditionalPhones','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','activateAdditionalPhone','IncrementPreviewCounters'];(function(_0x35ce18,_0x5947be){var _0x2cf269=function(_0x233fa8){while(--_0x233fa8){_0x35ce18['push'](_0x35ce18['shift']());}};_0x2cf269(++_0x5947be);}(_0xde60,0x18a));var _0x0de6=function(_0x2ae22a,_0x4fe753){_0x2ae22a=_0x2ae22a-0x0;var _0x286a82=_0xde60[_0x2ae22a];return _0x286a82;};'use strict';var _=require(_0x0de6('0x0'));var util=require(_0x0de6('0x1'));var moment=require(_0x0de6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0de6('0x3'));var db=require(_0x0de6('0x4'))['db'];var utils=require(_0x0de6('0x5'));var logger=require(_0x0de6('0x6'))(_0x0de6('0x7'));var config=require(_0x0de6('0x8'));var jayson=require(_0x0de6('0x9'));var client=jayson[_0x0de6('0xa')][_0x0de6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fe487,_0x5ac422,_0x57e453){return new BPromise(function(_0x21a1a9,_0x376fb5){return client[_0x0de6('0xc')](_0x3fe487,_0x57e453)[_0x0de6('0xd')](function(_0x37af48){logger[_0x0de6('0xe')](_0x0de6('0xf'),_0x5ac422,_0x0de6('0x10'));logger[_0x0de6('0x11')](_0x0de6('0x12'),_0x5ac422,'request\x20sent',JSON[_0x0de6('0x13')](_0x37af48));if(_0x37af48['error']){if(_0x37af48[_0x0de6('0x14')]['code']===0x1f4){logger[_0x0de6('0x14')](_0x0de6('0xf'),_0x5ac422,_0x37af48[_0x0de6('0x14')][_0x0de6('0x15')]);return _0x376fb5(_0x37af48[_0x0de6('0x14')][_0x0de6('0x15')]);}logger[_0x0de6('0x14')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5ac422,_0x37af48['error'][_0x0de6('0x15')]);return _0x21a1a9(_0x37af48[_0x0de6('0x14')][_0x0de6('0x15')]);}else{logger['info'](_0x0de6('0xf'),_0x5ac422,_0x0de6('0x10'));_0x21a1a9(_0x37af48['result'][_0x0de6('0x15')]);}})[_0x0de6('0x16')](function(_0xa03d42){logger[_0x0de6('0x14')](_0x0de6('0xf'),_0x5ac422,_0xa03d42);_0x376fb5(_0xa03d42);});});}exports[_0x0de6('0x17')]=function(_0x1c3811){var _0x476c05=this;return new Promise(function(_0x267595,_0x2dd987){return db[_0x0de6('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x1c3811['body'][_0x0de6('0x19')],'ListId':_0x1c3811[_0x0de6('0x1a')][_0x0de6('0x1b')],'VoiceQueueId':_0x1c3811[_0x0de6('0x1a')][_0x0de6('0x1c')]===undefined?null:_0x1c3811['body']['VoiceQueueId'],'CampaignId':_0x1c3811[_0x0de6('0x1a')][_0x0de6('0x1d')]===undefined?null:_0x1c3811[_0x0de6('0x1a')][_0x0de6('0x1d')]}})[_0x0de6('0xd')](function(_0x4e5457){if(_0x4e5457!=null){return db[_0x0de6('0x1e')][_0x0de6('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x4e5457['id'],'OrderBy':{'$gt':_0x4e5457['OrderBy']}},'order':[['OrderBy',_0x0de6('0x20')]]})['then'](function(_0x5cb553){var _0x5816b7=0x0;if(_0x5cb553){if(_0x5cb553['countbusyretry']+_0x5cb553['countcongestionretry']+_0x5cb553['countnoanswerretry']+_0x5cb553[_0x0de6('0x21')]+_0x5cb553[_0x0de6('0x22')]+_0x5cb553[_0x0de6('0x23')]+_0x5cb553[_0x0de6('0x24')]+_0x5cb553['countagentrejectretry']<_0x1c3811['entity'][_0x0de6('0x25')])_0x5816b7=0x1;_0x267595({'additional':_0x5816b7});}else{return db[_0x0de6('0x1e')][_0x0de6('0x1f')]({'raw':!![],'where':{'CmHopperId':_0x4e5457['id']},'order':[[_0x0de6('0x26'),_0x0de6('0x20')]]})['then'](function(_0xfe1ff1){var _0x544dfa=0x0;if(_0xfe1ff1){if(_0xfe1ff1[_0x0de6('0x27')]+_0xfe1ff1[_0x0de6('0x28')]+_0xfe1ff1[_0x0de6('0x29')]+_0xfe1ff1['countnosuchnumberretry']+_0xfe1ff1[_0x0de6('0x22')]+_0xfe1ff1[_0x0de6('0x23')]+_0xfe1ff1[_0x0de6('0x24')]+_0xfe1ff1[_0x0de6('0x2a')]<_0x1c3811['entity'][_0x0de6('0x25')])_0x544dfa=0x1;_0x267595({'additional':_0x544dfa});}else{_0x267595({'additional':0x0});}})['catch'](function(_0x35ba77){logger['error'](_0x0de6('0x17'),_0x35ba77[_0x0de6('0x15')]);_0x2dd987(_0x476c05[_0x0de6('0x14')](0x1f4,_0x35ba77['message']));});}})[_0x0de6('0x16')](function(_0x131046){logger[_0x0de6('0x14')](_0x0de6('0x17'),_0x131046[_0x0de6('0x15')]);_0x2dd987(_0x476c05['error'](0x1f4,_0x131046[_0x0de6('0x15')]));});}else _0x267595({'additional':0x0});});});};exports[_0x0de6('0x2b')]=function(_0x3d5dc7){var _0x1bdc7c=this;return new Promise(function(_0x3960e5,_0x5e6b5c){return db['CmHopper'][_0x0de6('0x1f')]({'raw':!![],'where':{'ContactId':_0x3d5dc7[_0x0de6('0x1a')]['ContactId'],'ListId':_0x3d5dc7[_0x0de6('0x1a')][_0x0de6('0x1b')],'VoiceQueueId':_0x3d5dc7['body']['VoiceQueueId']===undefined?null:_0x3d5dc7[_0x0de6('0x1a')][_0x0de6('0x1c')],'CampaignId':_0x3d5dc7[_0x0de6('0x1a')][_0x0de6('0x1d')]===undefined?null:_0x3d5dc7[_0x0de6('0x1a')][_0x0de6('0x1d')]}})[_0x0de6('0xd')](function(_0x564774){if(_0x564774!=null){return db[_0x0de6('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x564774['id'],'OrderBy':{'$gte':_0x564774[_0x0de6('0x26')]}},'order':[[_0x0de6('0x26'),'ASC']]})['then'](function(_0x4f4edb){if(_0x4f4edb)return activateAdditionalPhone(_0x564774,_0x3d5dc7[_0x0de6('0x1a')],_0x4f4edb,_0x3d5dc7['duration'],_0x3d5dc7['waitTime'])['then'](function(_0x17c6e4){_0x3960e5(_0x17c6e4);});else{return db[_0x0de6('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x564774['id']},'order':[[_0x0de6('0x26'),'ASC']]})[_0x0de6('0xd')](function(_0x1495bd){if(_0x1495bd)return activateAdditionalPhone(_0x564774,_0x3d5dc7[_0x0de6('0x1a')],_0x1495bd,_0x3d5dc7['duration'],_0x3d5dc7[_0x0de6('0x2c')])[_0x0de6('0xd')](function(_0x12b894){_0x3960e5(_0x12b894);});else{_0x3960e5({'id':_0x564774['id'],'phone':''});}})[_0x0de6('0x16')](function(_0x205cfa){logger[_0x0de6('0x14')](_0x0de6('0x17'),_0x205cfa[_0x0de6('0x15')]);_0x5e6b5c(_0x1bdc7c['error'](0x1f4,_0x205cfa[_0x0de6('0x15')]));});}})[_0x0de6('0x16')](function(_0x333ac9){logger[_0x0de6('0x14')]('VerifyAdditionalPhones',_0x333ac9['message']);_0x5e6b5c(_0x1bdc7c[_0x0de6('0x14')](0x1f4,_0x333ac9[_0x0de6('0x15')]));});}else _0x3960e5(0x1);});});};function activateAdditionalPhone(_0x55fe18,_0x1071b7,_0x17e8fc,_0x4229ec,_0x36e5f4){return new Promise(function(_0x4516f1,_0x15d27a){var _0x26d637;if(_[_0x0de6('0x2d')](_0x17e8fc[_0x0de6('0x2e')])){_0x17e8fc['scheduledat']=moment();}if(moment()>moment(_0x17e8fc[_0x0de6('0x2e')])){_0x26d637=moment()['add'](_0x36e5f4||0x3,_0x0de6('0x2f'));}else{if(_0x17e8fc[_0x0de6('0x26')]==0x0){_0x26d637=moment(_0x17e8fc[_0x0de6('0x2e')]);}else{_0x26d637=moment()[_0x0de6('0x30')](_0x36e5f4||0x3,'minutes');}}if(_[_0x0de6('0x2d')](_0x26d637)){_0x26d637=moment()[_0x0de6('0x30')](_0x36e5f4||0x3,_0x0de6('0x2f'));}var _0x3f70c3={'phone':_0x55fe18[_0x0de6('0x31')],'active':0x0,'OrderBy':_[_0x0de6('0x2d')](_0x55fe18[_0x0de6('0x26')])?0x0:_0x55fe18['OrderBy'],'scheduledat':moment()[_0x0de6('0x30')](_0x4229ec||0x1,_0x0de6('0x2f')),'countbusyretry':_0x1071b7[_0x0de6('0x27')],'countcongestionretry':_0x1071b7[_0x0de6('0x28')],'countnoanswerretry':_0x1071b7[_0x0de6('0x29')],'countnosuchnumberretry':_0x1071b7['countnosuchnumberretry'],'countdropretry':_0x1071b7[_0x0de6('0x22')],'countabandonedretry':_0x1071b7[_0x0de6('0x23')],'countmachineretry':_0x1071b7[_0x0de6('0x24')],'countagentrejectretry':_0x1071b7[_0x0de6('0x2a')],'createdAt':_0x1071b7[_0x0de6('0x32')],'updatedAt':_0x1071b7[_0x0de6('0x33')]};var _0xb52597={'CmHopperId':_0x55fe18['id'],'phone':_0x17e8fc['phone'],'active':0x0,'OrderBy':_[_0x0de6('0x2d')](_0x17e8fc['OrderBy'])?0x0:_0x17e8fc['OrderBy'],'scheduledat':_0x26d637,'countbusyretry':_0x17e8fc[_0x0de6('0x27')],'countcongestionretry':_0x17e8fc['countcongestionretry'],'countnoanswerretry':_0x17e8fc[_0x0de6('0x29')],'countnosuchnumberretry':_0x17e8fc[_0x0de6('0x21')],'countdropretry':_0x17e8fc[_0x0de6('0x22')],'countabandonedretry':_0x17e8fc[_0x0de6('0x23')],'countmachineretry':_0x17e8fc[_0x0de6('0x24')],'countagentrejectretry':_0x17e8fc[_0x0de6('0x2a')],'createdAt':_0x17e8fc[_0x0de6('0x32')],'updatedAt':_0x17e8fc[_0x0de6('0x33')]};return db['sequelize']['transaction'](function(_0x27b589){return db['CmHopperAdditionalPhone']['update'](_0x3f70c3,{'where':{'id':_0x17e8fc['id']}},{'transaction':_0x27b589})[_0x0de6('0xd')](function(){return db[_0x0de6('0x18')]['update'](_0xb52597,{'where':{'id':_0x55fe18['id']}},{'transaction':_0x27b589});});})['then'](function(_0x33f94a){_0x4516f1({'id':_0x55fe18['id'],'phone':_0x17e8fc[_0x0de6('0x31')]});})[_0x0de6('0x16')](function(_0x590d51){logger['error'](_0x0de6('0x34'),_0x590d51['message']);_0x15d27a({'error':_0x590d51[_0x0de6('0x15')]});});});}exports[_0x0de6('0x35')]=function(_0x54a804){var _0x8c5463=this;return new Promise(function(_0x27d5a0,_0x2c919b){return db[_0x0de6('0x18')][_0x0de6('0x36')](_0x54a804[_0x0de6('0x1a')][_0x0de6('0x37')],{'where':{'id':_0x54a804[_0x0de6('0x1a')]['id']}})[_0x0de6('0xd')](function(_0x587b67){_0x27d5a0(_0x587b67);})[_0x0de6('0x16')](function(_0x579ce4){logger[_0x0de6('0x14')](_0x0de6('0x35'),_0x579ce4[_0x0de6('0x15')]);_0x2c919b(_0x8c5463[_0x0de6('0x14')](0x1f4,_0x579ce4[_0x0de6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 06e7c61..bb8aa6a 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 _0xf042=['../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x331ce0,_0xe335b9){var _0x31c3c7=function(_0x2bf43c){while(--_0x2bf43c){_0x331ce0['push'](_0x331ce0['shift']());}};_0x31c3c7(++_0xe335b9);}(_0xf042,0xfe));var _0x2f04=function(_0x14a34f,_0x9266f9){_0x14a34f=_0x14a34f-0x0;var _0x25ca7a=_0xf042[_0x14a34f];return _0x25ca7a;};'use strict';var multer=require(_0x2f04('0x0'));var util=require(_0x2f04('0x1'));var path=require(_0x2f04('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f04('0x3'));var router=express['Router']();var fs_extra=require(_0x2f04('0x4'));var auth=require(_0x2f04('0x5'));var interaction=require(_0x2f04('0x6'));var config=require(_0x2f04('0x7'));var controller=require(_0x2f04('0x8'));router['get']('/',auth[_0x2f04('0x9')](),controller[_0x2f04('0xa')]);router[_0x2f04('0xb')]('/:id',auth[_0x2f04('0x9')](),controller[_0x2f04('0xc')]);router[_0x2f04('0xd')]('/',auth[_0x2f04('0x9')](),controller[_0x2f04('0xe')]);router[_0x2f04('0xf')](_0x2f04('0x10'),auth['isAuthenticated'](),controller[_0x2f04('0x11')]);router[_0x2f04('0x12')]('/:id',auth[_0x2f04('0x9')](),controller['destroy']);module[_0x2f04('0x13')]=router; \ No newline at end of file +var _0x7ba8=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x7ba8,0x17d));var _0x87ba=function(_0x2328c9,_0xfd6cce){_0x2328c9=_0x2328c9-0x0;var _0x5e02b4=_0x7ba8[_0x2328c9];return _0x5e02b4;};'use strict';var multer=require('multer');var util=require(_0x87ba('0x0'));var path=require(_0x87ba('0x1'));var timeout=require(_0x87ba('0x2'));var express=require(_0x87ba('0x3'));var router=express[_0x87ba('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x87ba('0x5'));var config=require(_0x87ba('0x6'));var controller=require(_0x87ba('0x7'));router[_0x87ba('0x8')]('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0xa')]);router[_0x87ba('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x87ba('0xb')]);router['post']('/',auth[_0x87ba('0x9')](),controller[_0x87ba('0xc')]);router[_0x87ba('0xd')](_0x87ba('0xe'),auth[_0x87ba('0x9')](),controller[_0x87ba('0xf')]);router[_0x87ba('0x10')](_0x87ba('0xe'),auth['isAuthenticated'](),controller[_0x87ba('0x11')]);module[_0x87ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 3252a2f..7812534 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 _0xbd51=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x53a34b,_0x18c43d){var _0x32cce0=function(_0x33687e){while(--_0x33687e){_0x53a34b['push'](_0x53a34b['shift']());}};_0x32cce0(++_0x18c43d);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x58ae11,_0x1de5a8){_0x58ae11=_0x58ae11-0x0;var _0x1b536b=_0xbd51[_0x58ae11];return _0x1b536b;};'use strict';var moment=require(_0x1bd5('0x0'));var Sequelize=require('sequelize');module[_0x1bd5('0x1')]={'phone':{'type':Sequelize[_0x1bd5('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x1bd5('0x3')],'unique':_0x1bd5('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xa7e6=['INTEGER','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa7e6,0x74));var _0x6a7e=function(_0xb4f240,_0x15f734){_0xb4f240=_0xb4f240-0x0;var _0x30682a=_0xa7e6[_0xb4f240];return _0x30682a;};'use strict';var moment=require(_0x6a7e('0x0'));var Sequelize=require(_0x6a7e('0x1'));module[_0x6a7e('0x2')]={'phone':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6a7e('0x4')],'unique':_0x6a7e('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6a7e('0x5')},'VoiceQueueId':{'type':Sequelize[_0x6a7e('0x4')],'unique':_0x6a7e('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ba5739c..d820549 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 _0xad3e=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','key','model'];(function(_0x3b45e0,_0x391ec4){var _0x1e4796=function(_0x22d2f1){while(--_0x22d2f1){_0x3b45e0['push'](_0x3b45e0['shift']());}};_0x1e4796(++_0x391ec4);}(_0xad3e,0xa9));var _0xead3=function(_0x8e714e,_0x298739){_0x8e714e=_0x8e714e-0x0;var _0x977310=_0xad3e[_0x8e714e];return _0x977310;};'use strict';var emlformat=require(_0xead3('0x0'));var rimraf=require(_0xead3('0x1'));var zipdir=require(_0xead3('0x2'));var jsonpatch=require(_0xead3('0x3'));var rp=require(_0xead3('0x4'));var moment=require(_0xead3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xead3('0x6'));var util=require(_0xead3('0x7'));var path=require(_0xead3('0x8'));var sox=require(_0xead3('0x9'));var csv=require(_0xead3('0xa'));var ejs=require(_0xead3('0xb'));var fs=require('fs');var fs_extra=require(_0xead3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xead3('0xd'));var jsforce=require(_0xead3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xead3('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xead3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xead3('0x10'));var logger=require(_0xead3('0x11'))(_0xead3('0x12'));var utils=require(_0xead3('0x13'));var config=require(_0xead3('0x14'));var licenseUtil=require(_0xead3('0x15'));var db=require(_0xead3('0x16'))['db'];function respondWithStatusCode(_0x5398bb,_0xad2a68){_0xad2a68=_0xad2a68||0xcc;return function(_0x48901b){if(_0x48901b){return _0x5398bb[_0xead3('0x17')](_0xad2a68);}return _0x5398bb['status'](_0xad2a68)[_0xead3('0x18')]();};}function respondWithResult(_0x7b222a,_0x15d266){_0x15d266=_0x15d266||0xc8;return function(_0x5d6051){if(_0x5d6051){return _0x7b222a['status'](_0x15d266)[_0xead3('0x19')](_0x5d6051);}};}function respondWithFilteredResult(_0xcdb70e,_0x39cb20){return function(_0x4fbe41){if(_0x4fbe41){var _0x55cdc3=typeof _0x39cb20[_0xead3('0x1a')]===_0xead3('0x1b')&&typeof _0x39cb20[_0xead3('0x1c')]===_0xead3('0x1b');var _0x1f6743=_0x4fbe41['count'];var _0x4e47d4=_0x55cdc3?0x0:_0x39cb20[_0xead3('0x1a')];var _0xbeaf27=_0x55cdc3?_0x4fbe41[_0xead3('0x1d')]:_0x39cb20[_0xead3('0x1a')]+_0x39cb20[_0xead3('0x1c')];var _0x12e1ea;if(_0xbeaf27>=_0x1f6743){_0xbeaf27=_0x1f6743;_0x12e1ea=0xc8;}else{_0x12e1ea=0xce;}_0xcdb70e['status'](_0x12e1ea);return _0xcdb70e[_0xead3('0x1e')](_0xead3('0x1f'),_0x4e47d4+'-'+_0xbeaf27+'/'+_0x1f6743)[_0xead3('0x19')](_0x4fbe41);}return null;};}function patchUpdates(_0x11b5f1){return function(_0x3a1b88){try{jsonpatch[_0xead3('0x20')](_0x3a1b88,_0x11b5f1,!![]);}catch(_0x68dbe2){return BPromise[_0xead3('0x21')](_0x68dbe2);}return _0x3a1b88[_0xead3('0x22')]();};}function saveUpdates(_0x3997f7,_0x5765a6){return function(_0x12fc81){if(_0x12fc81){return _0x12fc81[_0xead3('0x23')](_0x3997f7)[_0xead3('0x24')](function(_0x3a1cf9){return _0x3a1cf9;});}return null;};}function removeEntity(_0x22bf74,_0x239439){return function(_0x438c29){if(_0x438c29){return _0x438c29[_0xead3('0x25')]()[_0xead3('0x24')](function(){_0x22bf74[_0xead3('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5d2a,_0x5cfe5d){return function(_0x2bc20b){if(!_0x2bc20b){_0x1c5d2a[_0xead3('0x17')](0x194);}return _0x2bc20b;};}function handleError(_0x2d2f08,_0x46c1b2){_0x46c1b2=_0x46c1b2||0x1f4;return function(_0x40ef6a){logger[_0xead3('0x27')](_0x40ef6a[_0xead3('0x28')]);if(_0x40ef6a[_0xead3('0x29')]){delete _0x40ef6a['name'];}_0x2d2f08[_0xead3('0x26')](_0x46c1b2)[_0xead3('0x2a')](_0x40ef6a);};}exports['index']=function(_0x30e690,_0x1a647d){var _0x2d0e94={},_0x359914={},_0x56edbc={'count':0x0,'rows':[]};var _0x9b0e36=_[_0xead3('0x2b')](db[_0xead3('0x2c')][_0xead3('0x2d')],function(_0x9333c5){return{'name':_0x9333c5[_0xead3('0x2e')],'type':_0x9333c5[_0xead3('0x2f')][_0xead3('0x30')]};});_0x359914[_0xead3('0x31')]=_[_0xead3('0x2b')](_0x9b0e36,_0xead3('0x29'));_0x359914[_0xead3('0x32')]=_[_0xead3('0x33')](_0x30e690[_0xead3('0x32')]);_0x359914[_0xead3('0x34')]=_[_0xead3('0x35')](_0x359914[_0xead3('0x31')],_0x359914['query']);_0x2d0e94[_0xead3('0x36')]=_[_0xead3('0x35')](_0x359914[_0xead3('0x31')],qs[_0xead3('0x37')](_0x30e690[_0xead3('0x32')][_0xead3('0x37')]));_0x2d0e94['attributes']=_0x2d0e94[_0xead3('0x36')][_0xead3('0x38')]?_0x2d0e94[_0xead3('0x36')]:_0x359914[_0xead3('0x31')];if(!_0x30e690['query']['hasOwnProperty'](_0xead3('0x39'))){_0x2d0e94['limit']=qs[_0xead3('0x1c')](_0x30e690['query'][_0xead3('0x1c')]);_0x2d0e94[_0xead3('0x1a')]=qs[_0xead3('0x1a')](_0x30e690[_0xead3('0x32')][_0xead3('0x1a')]);}_0x2d0e94[_0xead3('0x3a')]=qs[_0xead3('0x3b')](_0x30e690[_0xead3('0x32')][_0xead3('0x3b')]);_0x2d0e94[_0xead3('0x3c')]=qs[_0xead3('0x34')](_['pick'](_0x30e690[_0xead3('0x32')],_0x359914[_0xead3('0x34')]),_0x9b0e36);if(_0x30e690['query'][_0xead3('0x3d')]){_0x2d0e94[_0xead3('0x3c')]=_[_0xead3('0x3e')](_0x2d0e94[_0xead3('0x3c')],{'$or':_[_0xead3('0x2b')](_0x9b0e36,function(_0xea818){if(_0xea818['type']!=='VIRTUAL'){var _0x4c30e7={};_0x4c30e7[_0xea818[_0xead3('0x29')]]={'$like':'%'+_0x30e690[_0xead3('0x32')][_0xead3('0x3d')]+'%'};return _0x4c30e7;}})});}_0x2d0e94=_['merge']({},_0x2d0e94,_0x30e690[_0xead3('0x3f')]);var _0x182c26={'where':_0x2d0e94[_0xead3('0x3c')]};return db[_0xead3('0x2c')][_0xead3('0x1d')](_0x182c26)[_0xead3('0x24')](function(_0x51a416){_0x56edbc['count']=_0x51a416;if(_0x30e690[_0xead3('0x32')][_0xead3('0x40')]){_0x2d0e94[_0xead3('0x41')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2d0e94);})[_0xead3('0x24')](function(_0x26b599){_0x56edbc[_0xead3('0x42')]=_0x26b599;return _0x56edbc;})['then'](respondWithFilteredResult(_0x1a647d,_0x2d0e94))[_0xead3('0x43')](handleError(_0x1a647d,null));};exports[_0xead3('0x44')]=function(_0x417242,_0x3615c4){var _0x164cbf={'raw':!![],'where':{'id':_0x417242['params']['id']}},_0x3d2e88={};_0x3d2e88['model']=_[_0xead3('0x33')](db['CmHopperBlack'][_0xead3('0x2d')]);_0x3d2e88['query']=_[_0xead3('0x33')](_0x417242[_0xead3('0x32')]);_0x3d2e88['filters']=_[_0xead3('0x35')](_0x3d2e88[_0xead3('0x31')],_0x3d2e88[_0xead3('0x32')]);_0x164cbf[_0xead3('0x36')]=_['intersection'](_0x3d2e88['model'],qs[_0xead3('0x37')](_0x417242[_0xead3('0x32')][_0xead3('0x37')]));_0x164cbf[_0xead3('0x36')]=_0x164cbf[_0xead3('0x36')][_0xead3('0x38')]?_0x164cbf[_0xead3('0x36')]:_0x3d2e88[_0xead3('0x31')];if(_0x417242[_0xead3('0x32')]['includeAll']){_0x164cbf[_0xead3('0x41')]=[{'all':!![]}];}_0x164cbf=_[_0xead3('0x3e')]({},_0x164cbf,_0x417242[_0xead3('0x3f')]);return db['CmHopperBlack'][_0xead3('0x45')](_0x164cbf)[_0xead3('0x24')](handleEntityNotFound(_0x3615c4,null))[_0xead3('0x24')](respondWithResult(_0x3615c4,null))['catch'](handleError(_0x3615c4,null));};exports[_0xead3('0x23')]=function(_0x50bec2,_0xe87928){if(_0x50bec2[_0xead3('0x46')]['id']){delete _0x50bec2[_0xead3('0x46')]['id'];}return db[_0xead3('0x2c')][_0xead3('0x45')]({'where':{'id':_0x50bec2['params']['id']}})[_0xead3('0x24')](handleEntityNotFound(_0xe87928,null))[_0xead3('0x24')](saveUpdates(_0x50bec2[_0xead3('0x46')],null))['then'](respondWithResult(_0xe87928,null))['catch'](handleError(_0xe87928,null));};exports[_0xead3('0x25')]=function(_0x12f646,_0x32c623){return db[_0xead3('0x2c')][_0xead3('0x45')]({'where':{'id':_0x12f646[_0xead3('0x47')]['id']}})[_0xead3('0x24')](handleEntityNotFound(_0x32c623,null))[_0xead3('0x24')](removeEntity(_0x32c623,null))[_0xead3('0x43')](handleError(_0x32c623,null));};exports[_0xead3('0x48')]=function(_0x1ef64f,_0x5a78f3){return db[_0xead3('0x2c')][_0xead3('0x48')]()[_0xead3('0x24')](respondWithResult(_0x5a78f3,null))[_0xead3('0x43')](handleError(_0x5a78f3,null));}; \ No newline at end of file +var _0x8f9f=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','error','stack','name','send','index','CmHopperBlack','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','then','include','findAll','rows','catch','params','includeAll','find','body','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x167144,_0x54bab5){var _0x3b6076=function(_0x1aac0c){while(--_0x1aac0c){_0x167144['push'](_0x167144['shift']());}};_0x3b6076(++_0x54bab5);}(_0x8f9f,0x1be));var _0xf8f9=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8f9f[_0x82129b];return _0x2ae5dc;};'use strict';var emlformat=require(_0xf8f9('0x0'));var rimraf=require(_0xf8f9('0x1'));var zipdir=require(_0xf8f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf8f9('0x3'));var BPromise=require(_0xf8f9('0x4'));var Mustache=require(_0xf8f9('0x5'));var util=require(_0xf8f9('0x6'));var path=require('path');var sox=require(_0xf8f9('0x7'));var csv=require(_0xf8f9('0x8'));var ejs=require(_0xf8f9('0x9'));var fs=require('fs');var fs_extra=require(_0xf8f9('0xa'));var _=require(_0xf8f9('0xb'));var squel=require(_0xf8f9('0xc'));var crypto=require(_0xf8f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf8f9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf8f9('0xf'));var Papa=require(_0xf8f9('0x10'));var Redis=require(_0xf8f9('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf8f9('0x12'));var hardwareService=require(_0xf8f9('0x13'));var logger=require(_0xf8f9('0x14'))(_0xf8f9('0x15'));var utils=require(_0xf8f9('0x16'));var config=require(_0xf8f9('0x17'));var licenseUtil=require(_0xf8f9('0x18'));var db=require(_0xf8f9('0x19'))['db'];function respondWithStatusCode(_0x3027a3,_0x5e0b99){_0x5e0b99=_0x5e0b99||0xcc;return function(_0x331a91){if(_0x331a91){return _0x3027a3[_0xf8f9('0x1a')](_0x5e0b99);}return _0x3027a3['status'](_0x5e0b99)[_0xf8f9('0x1b')]();};}function respondWithResult(_0x5420c8,_0x416c4a){_0x416c4a=_0x416c4a||0xc8;return function(_0x3ccaf4){if(_0x3ccaf4){return _0x5420c8[_0xf8f9('0x1c')](_0x416c4a)[_0xf8f9('0x1d')](_0x3ccaf4);}};}function respondWithFilteredResult(_0x2506b9,_0x563040){return function(_0x4373cb){if(_0x4373cb){var _0x614ccc=typeof _0x563040['offset']===_0xf8f9('0x1e')&&typeof _0x563040[_0xf8f9('0x1f')]===_0xf8f9('0x1e');var _0x42c6da=_0x4373cb[_0xf8f9('0x20')];var _0x84b397=_0x614ccc?0x0:_0x563040[_0xf8f9('0x21')];var _0xa76755=_0x614ccc?_0x4373cb['count']:_0x563040[_0xf8f9('0x21')]+_0x563040[_0xf8f9('0x1f')];var _0x54b3b1;if(_0xa76755>=_0x42c6da){_0xa76755=_0x42c6da;_0x54b3b1=0xc8;}else{_0x54b3b1=0xce;}_0x2506b9[_0xf8f9('0x1c')](_0x54b3b1);return _0x2506b9['set'](_0xf8f9('0x22'),_0x84b397+'-'+_0xa76755+'/'+_0x42c6da)[_0xf8f9('0x1d')](_0x4373cb);}return null;};}function patchUpdates(_0x2cc627){return function(_0x3e2093){try{jsonpatch[_0xf8f9('0x23')](_0x3e2093,_0x2cc627,!![]);}catch(_0x383079){return BPromise[_0xf8f9('0x24')](_0x383079);}return _0x3e2093[_0xf8f9('0x25')]();};}function saveUpdates(_0x1390a9,_0x81cb13){return function(_0x2725da){if(_0x2725da){return _0x2725da[_0xf8f9('0x26')](_0x1390a9)['then'](function(_0x22ff8c){return _0x22ff8c;});}return null;};}function removeEntity(_0x1eeaeb,_0x472eb0){return function(_0x16538e){if(_0x16538e){return _0x16538e['destroy']()['then'](function(){_0x1eeaeb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5798df,_0x34f37b){return function(_0x58dd93){if(!_0x58dd93){_0x5798df[_0xf8f9('0x1a')](0x194);}return _0x58dd93;};}function handleError(_0x1d1dcb,_0x1c0dce){_0x1c0dce=_0x1c0dce||0x1f4;return function(_0x7756eb){logger[_0xf8f9('0x27')](_0x7756eb[_0xf8f9('0x28')]);if(_0x7756eb[_0xf8f9('0x29')]){delete _0x7756eb[_0xf8f9('0x29')];}_0x1d1dcb['status'](_0x1c0dce)[_0xf8f9('0x2a')](_0x7756eb);};}exports[_0xf8f9('0x2b')]=function(_0x4d56bb,_0x2318fe){var _0x145208={},_0x8af9e7={},_0x293381={'count':0x0,'rows':[]};var _0x3d9ff0=_['map'](db[_0xf8f9('0x2c')][_0xf8f9('0x2d')],function(_0x1725af){return{'name':_0x1725af['fieldName'],'type':_0x1725af['type'][_0xf8f9('0x2e')]};});_0x8af9e7[_0xf8f9('0x2f')]=_['map'](_0x3d9ff0,_0xf8f9('0x29'));_0x8af9e7[_0xf8f9('0x30')]=_[_0xf8f9('0x31')](_0x4d56bb['query']);_0x8af9e7['filters']=_[_0xf8f9('0x32')](_0x8af9e7['model'],_0x8af9e7['query']);_0x145208[_0xf8f9('0x33')]=_[_0xf8f9('0x32')](_0x8af9e7[_0xf8f9('0x2f')],qs[_0xf8f9('0x34')](_0x4d56bb[_0xf8f9('0x30')]['fields']));_0x145208['attributes']=_0x145208[_0xf8f9('0x33')][_0xf8f9('0x35')]?_0x145208[_0xf8f9('0x33')]:_0x8af9e7[_0xf8f9('0x2f')];if(!_0x4d56bb[_0xf8f9('0x30')][_0xf8f9('0x36')](_0xf8f9('0x37'))){_0x145208[_0xf8f9('0x1f')]=qs[_0xf8f9('0x1f')](_0x4d56bb[_0xf8f9('0x30')][_0xf8f9('0x1f')]);_0x145208[_0xf8f9('0x21')]=qs['offset'](_0x4d56bb[_0xf8f9('0x30')]['offset']);}_0x145208[_0xf8f9('0x38')]=qs[_0xf8f9('0x39')](_0x4d56bb[_0xf8f9('0x30')][_0xf8f9('0x39')]);_0x145208[_0xf8f9('0x3a')]=qs[_0xf8f9('0x3b')](_[_0xf8f9('0x3c')](_0x4d56bb['query'],_0x8af9e7[_0xf8f9('0x3b')]),_0x3d9ff0);if(_0x4d56bb[_0xf8f9('0x30')][_0xf8f9('0x3d')]){_0x145208['where']=_[_0xf8f9('0x3e')](_0x145208['where'],{'$or':_['map'](_0x3d9ff0,function(_0x317402){if(_0x317402[_0xf8f9('0x3f')]!=='VIRTUAL'){var _0x1e05e8={};_0x1e05e8[_0x317402[_0xf8f9('0x29')]]={'$like':'%'+_0x4d56bb[_0xf8f9('0x30')]['filter']+'%'};return _0x1e05e8;}})});}_0x145208=_[_0xf8f9('0x3e')]({},_0x145208,_0x4d56bb[_0xf8f9('0x40')]);var _0x396b83={'where':_0x145208['where']};return db[_0xf8f9('0x2c')][_0xf8f9('0x20')](_0x396b83)[_0xf8f9('0x41')](function(_0x15b87e){_0x293381[_0xf8f9('0x20')]=_0x15b87e;if(_0x4d56bb['query']['includeAll']){_0x145208[_0xf8f9('0x42')]=[{'all':!![]}];}return db[_0xf8f9('0x2c')][_0xf8f9('0x43')](_0x145208);})[_0xf8f9('0x41')](function(_0x2b67ba){_0x293381[_0xf8f9('0x44')]=_0x2b67ba;return _0x293381;})['then'](respondWithFilteredResult(_0x2318fe,_0x145208))[_0xf8f9('0x45')](handleError(_0x2318fe,null));};exports['show']=function(_0x328345,_0x199231){var _0x175dd1={'raw':!![],'where':{'id':_0x328345[_0xf8f9('0x46')]['id']}},_0x315888={};_0x315888[_0xf8f9('0x2f')]=_[_0xf8f9('0x31')](db[_0xf8f9('0x2c')][_0xf8f9('0x2d')]);_0x315888[_0xf8f9('0x30')]=_[_0xf8f9('0x31')](_0x328345[_0xf8f9('0x30')]);_0x315888[_0xf8f9('0x3b')]=_[_0xf8f9('0x32')](_0x315888[_0xf8f9('0x2f')],_0x315888[_0xf8f9('0x30')]);_0x175dd1[_0xf8f9('0x33')]=_[_0xf8f9('0x32')](_0x315888[_0xf8f9('0x2f')],qs['fields'](_0x328345['query'][_0xf8f9('0x34')]));_0x175dd1['attributes']=_0x175dd1['attributes'][_0xf8f9('0x35')]?_0x175dd1[_0xf8f9('0x33')]:_0x315888['model'];if(_0x328345[_0xf8f9('0x30')][_0xf8f9('0x47')]){_0x175dd1[_0xf8f9('0x42')]=[{'all':!![]}];}_0x175dd1=_[_0xf8f9('0x3e')]({},_0x175dd1,_0x328345['options']);return db[_0xf8f9('0x2c')][_0xf8f9('0x48')](_0x175dd1)['then'](handleEntityNotFound(_0x199231,null))[_0xf8f9('0x41')](respondWithResult(_0x199231,null))[_0xf8f9('0x45')](handleError(_0x199231,null));};exports[_0xf8f9('0x26')]=function(_0x327016,_0x5bcecf){if(_0x327016[_0xf8f9('0x49')]['id']){delete _0x327016[_0xf8f9('0x49')]['id'];}return db[_0xf8f9('0x2c')][_0xf8f9('0x48')]({'where':{'id':_0x327016[_0xf8f9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bcecf,null))[_0xf8f9('0x41')](saveUpdates(_0x327016[_0xf8f9('0x49')],null))[_0xf8f9('0x41')](respondWithResult(_0x5bcecf,null))[_0xf8f9('0x45')](handleError(_0x5bcecf,null));};exports[_0xf8f9('0x4a')]=function(_0x122a07,_0xd988bb){return db[_0xf8f9('0x2c')][_0xf8f9('0x48')]({'where':{'id':_0x122a07[_0xf8f9('0x46')]['id']}})[_0xf8f9('0x41')](handleEntityNotFound(_0xd988bb,null))[_0xf8f9('0x41')](removeEntity(_0xd988bb,null))[_0xf8f9('0x45')](handleError(_0xd988bb,null));};exports[_0xf8f9('0x4b')]=function(_0x2df8d6,_0x1792ae){return db[_0xf8f9('0x2c')][_0xf8f9('0x4b')]()[_0xf8f9('0x41')](respondWithResult(_0x1792ae,null))['catch'](handleError(_0x1792ae,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ec24375..6cadf1a 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 _0x4ab7=['util','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4ab7,0x110));var _0x74ab=function(_0x183d19,_0x2ccd3f){_0x183d19=_0x183d19-0x0;var _0x11be84=_0x4ab7[_0x183d19];return _0x11be84;};'use strict';var _=require(_0x74ab('0x0'));var util=require(_0x74ab('0x1'));var logger=require('../../config/logger')(_0x74ab('0x2'));var moment=require(_0x74ab('0x3'));var BPromise=require(_0x74ab('0x4'));var rp=require(_0x74ab('0x5'));var fs=require('fs');var path=require(_0x74ab('0x6'));var rimraf=require(_0x74ab('0x7'));var config=require('../../config/environment');var attributes=require(_0x74ab('0x8'));module[_0x74ab('0x9')]=function(_0xe42bc2,_0x1dcc89){return _0xe42bc2[_0x74ab('0xa')](_0x74ab('0xb'),attributes,{'tableName':_0x74ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7890=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','../../config/logger','api','moment'];(function(_0x12c4fa,_0x5b04d0){var _0x27f7c7=function(_0x53a763){while(--_0x53a763){_0x12c4fa['push'](_0x12c4fa['shift']());}};_0x27f7c7(++_0x5b04d0);}(_0x7890,0x14d));var _0x0789=function(_0x5d9958,_0x363dc4){_0x5d9958=_0x5d9958-0x0;var _0x33155a=_0x7890[_0x5d9958];return _0x33155a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0789('0x0'))(_0x0789('0x1'));var moment=require(_0x0789('0x2'));var BPromise=require(_0x0789('0x3'));var rp=require(_0x0789('0x4'));var fs=require('fs');var path=require(_0x0789('0x5'));var rimraf=require(_0x0789('0x6'));var config=require(_0x0789('0x7'));var attributes=require(_0x0789('0x8'));module[_0x0789('0x9')]=function(_0x2b17b5,_0xc6514d){return _0x2b17b5[_0x0789('0xa')](_0x0789('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 8181e79..35190b1 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 _0x665c=['map','include','model','GetCmHopperBlack','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CmHopperBlack','options','where','attributes','limit'];(function(_0x27f7b6,_0x2dde24){var _0x22fd91=function(_0x2db13f){while(--_0x2db13f){_0x27f7b6['push'](_0x27f7b6['shift']());}};_0x22fd91(++_0x2dde24);}(_0x665c,0x17d));var _0xc665=function(_0x3402e4,_0x14d465){_0x3402e4=_0x3402e4-0x0;var _0x4e9a8e=_0x665c[_0x3402e4];return _0x4e9a8e;};'use strict';var _=require(_0xc665('0x0'));var util=require('util');var moment=require(_0xc665('0x1'));var BPromise=require(_0xc665('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc665('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc665('0x4'));var logger=require(_0xc665('0x5'))(_0xc665('0x6'));var config=require(_0xc665('0x7'));var jayson=require(_0xc665('0x8'));var client=jayson[_0xc665('0x9')][_0xc665('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x315aa6,_0x1ea0bc,_0x1f67e2){return new BPromise(function(_0x3019a1,_0x233dd3){return client['request'](_0x315aa6,_0x1f67e2)[_0xc665('0xb')](function(_0x2b048e){logger[_0xc665('0xc')](_0xc665('0xd'),_0x1ea0bc,'request\x20sent');logger[_0xc665('0xe')](_0xc665('0xf'),_0x1ea0bc,_0xc665('0x10'),JSON[_0xc665('0x11')](_0x2b048e));if(_0x2b048e[_0xc665('0x12')]){if(_0x2b048e[_0xc665('0x12')]['code']===0x1f4){logger[_0xc665('0x12')](_0xc665('0xd'),_0x1ea0bc,_0x2b048e[_0xc665('0x12')][_0xc665('0x13')]);return _0x233dd3(_0x2b048e[_0xc665('0x12')][_0xc665('0x13')]);}logger[_0xc665('0x12')](_0xc665('0xd'),_0x1ea0bc,_0x2b048e['error']['message']);return _0x3019a1(_0x2b048e[_0xc665('0x12')][_0xc665('0x13')]);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1ea0bc,_0xc665('0x10'));_0x3019a1(_0x2b048e[_0xc665('0x14')][_0xc665('0x13')]);}})[_0xc665('0x15')](function(_0x81a82c){logger[_0xc665('0x12')](_0xc665('0xd'),_0x1ea0bc,_0x81a82c);_0x233dd3(_0x81a82c);});});}exports['GetCmHopperBlack']=function(_0x1bf867){var _0x10e638=this;return new Promise(function(_0x35f95f,_0x457d56){return db[_0xc665('0x16')]['findAll']({'raw':_0x1bf867[_0xc665('0x17')]?_0x1bf867['options']['raw']===undefined?!![]:![]:!![],'where':_0x1bf867['options']?_0x1bf867[_0xc665('0x17')][_0xc665('0x18')]||null:null,'attributes':_0x1bf867[_0xc665('0x17')]?_0x1bf867[_0xc665('0x17')][_0xc665('0x19')]||null:null,'limit':_0x1bf867[_0xc665('0x17')]?_0x1bf867[_0xc665('0x17')][_0xc665('0x1a')]||null:null,'include':_0x1bf867[_0xc665('0x17')]?_0x1bf867[_0xc665('0x17')]['include']?_[_0xc665('0x1b')](_0x1bf867[_0xc665('0x17')][_0xc665('0x1c')],function(_0x46c0c1){return{'model':db[_0x46c0c1['model']],'as':_0x46c0c1['as'],'attributes':_0x46c0c1['attributes'],'include':_0x46c0c1['include']?_[_0xc665('0x1b')](_0x46c0c1['include'],function(_0xd9b64f){return{'model':db[_0xd9b64f[_0xc665('0x1d')]],'as':_0xd9b64f['as'],'attributes':_0xd9b64f[_0xc665('0x19')],'include':_0xd9b64f[_0xc665('0x1c')]?_['map'](_0xd9b64f[_0xc665('0x1c')],function(_0xcf03a1){return{'model':db[_0xcf03a1['model']],'as':_0xcf03a1['as'],'attributes':_0xcf03a1[_0xc665('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc665('0xb')](function(_0x38a3c1){logger[_0xc665('0xc')]('GetCmHopperBlack',_0x1bf867);logger['debug'](_0xc665('0x1e'),_0x1bf867,JSON['stringify'](_0x38a3c1));_0x35f95f(_0x38a3c1);})[_0xc665('0x15')](function(_0x5a2923){logger[_0xc665('0x12')](_0xc665('0x1e'),_0x5a2923[_0xc665('0x13')],_0x1bf867);_0x457d56(_0x10e638[_0xc665('0x12')](0x1f4,_0x5a2923['message']));});});};exports[_0xc665('0x1f')]=function(_0x326320){var _0xfa8e26=this;return new Promise(function(_0x37bc15,_0xbe2480){return db[_0xc665('0x16')]['update'](_0x326320['body'],{'raw':_0x326320['options']?_0x326320[_0xc665('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x326320['options']?_0x326320[_0xc665('0x17')][_0xc665('0x18')]||null:null,'attributes':_0x326320['options']?_0x326320[_0xc665('0x17')][_0xc665('0x19')]||null:null,'limit':_0x326320['options']?_0x326320[_0xc665('0x17')][_0xc665('0x1a')]||null:null})[_0xc665('0xb')](function(_0x23490d){logger[_0xc665('0xc')](_0xc665('0x1f'),_0x326320);logger[_0xc665('0xe')](_0xc665('0x1f'),_0x326320,JSON[_0xc665('0x11')](_0x23490d));_0x37bc15(_0x23490d);})['catch'](function(_0x30114f){logger[_0xc665('0x12')](_0xc665('0x1f'),_0x30114f[_0xc665('0x13')],_0x326320);_0xbe2480(_0xfa8e26[_0xc665('0x12')](0x1f4,_0x30114f[_0xc665('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x290234){var _0x5d12f5=this;return new Promise(function(_0x1df8ff,_0xc8cad){return db[_0xc665('0x16')][_0xc665('0x20')]({'where':_0x290234[_0xc665('0x17')]?_0x290234['options'][_0xc665('0x18')]||null:null})['then'](function(_0x4dc666){logger[_0xc665('0xc')](_0xc665('0x21'),_0x290234);logger[_0xc665('0xe')](_0xc665('0x21'),_0x290234,JSON[_0xc665('0x11')](_0x4dc666));_0x1df8ff(_0x4dc666);})[_0xc665('0x15')](function(_0x1067b7){logger[_0xc665('0x12')](_0xc665('0x21'),_0x1067b7[_0xc665('0x13')],_0x290234);_0xc8cad(_0x5d12f5[_0xc665('0x12')](0x1f4,_0x1067b7[_0xc665('0x13')]));});});}; \ No newline at end of file +var _0x4d6b=['catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','request','info','request\x20sent','debug','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result'];(function(_0xd145c5,_0x30695c){var _0x5baa31=function(_0xa7122f){while(--_0xa7122f){_0xd145c5['push'](_0xd145c5['shift']());}};_0x5baa31(++_0x30695c);}(_0x4d6b,0xff));var _0xb4d6=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0x4d6b[_0x1781de];return _0x48d7fc;};'use strict';var _=require(_0xb4d6('0x0'));var util=require(_0xb4d6('0x1'));var moment=require(_0xb4d6('0x2'));var BPromise=require(_0xb4d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4d6('0x5'));var logger=require(_0xb4d6('0x6'))('rpc');var config=require(_0xb4d6('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x255614,_0x2c6cc0,_0x1c8997){return new BPromise(function(_0x39bf6a,_0x483ae7){return client[_0xb4d6('0x8')](_0x255614,_0x1c8997)['then'](function(_0x19f083){logger[_0xb4d6('0x9')]('CmHopperBlack,\x20%s,\x20%s',_0x2c6cc0,_0xb4d6('0xa'));logger[_0xb4d6('0xb')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2c6cc0,'request\x20sent',JSON[_0xb4d6('0xc')](_0x19f083));if(_0x19f083[_0xb4d6('0xd')]){if(_0x19f083[_0xb4d6('0xd')]['code']===0x1f4){logger[_0xb4d6('0xd')](_0xb4d6('0xe'),_0x2c6cc0,_0x19f083['error'][_0xb4d6('0xf')]);return _0x483ae7(_0x19f083[_0xb4d6('0xd')][_0xb4d6('0xf')]);}logger[_0xb4d6('0xd')](_0xb4d6('0xe'),_0x2c6cc0,_0x19f083[_0xb4d6('0xd')][_0xb4d6('0xf')]);return _0x39bf6a(_0x19f083[_0xb4d6('0xd')][_0xb4d6('0xf')]);}else{logger['info'](_0xb4d6('0xe'),_0x2c6cc0,_0xb4d6('0xa'));_0x39bf6a(_0x19f083[_0xb4d6('0x10')]['message']);}})[_0xb4d6('0x11')](function(_0x49f243){logger[_0xb4d6('0xd')](_0xb4d6('0xe'),_0x2c6cc0,_0x49f243);_0x483ae7(_0x49f243);});});}exports[_0xb4d6('0x12')]=function(_0x2bf10e){var _0x40148d=this;return new Promise(function(_0x43f1ed,_0x3f34a3){return db[_0xb4d6('0x13')][_0xb4d6('0x14')]({'raw':_0x2bf10e['options']?_0x2bf10e[_0xb4d6('0x15')][_0xb4d6('0x16')]===undefined?!![]:![]:!![],'where':_0x2bf10e[_0xb4d6('0x15')]?_0x2bf10e[_0xb4d6('0x15')][_0xb4d6('0x17')]||null:null,'attributes':_0x2bf10e[_0xb4d6('0x15')]?_0x2bf10e[_0xb4d6('0x15')][_0xb4d6('0x18')]||null:null,'limit':_0x2bf10e['options']?_0x2bf10e[_0xb4d6('0x15')]['limit']||null:null,'include':_0x2bf10e[_0xb4d6('0x15')]?_0x2bf10e[_0xb4d6('0x15')][_0xb4d6('0x19')]?_[_0xb4d6('0x1a')](_0x2bf10e[_0xb4d6('0x15')][_0xb4d6('0x19')],function(_0x504c8b){return{'model':db[_0x504c8b[_0xb4d6('0x1b')]],'as':_0x504c8b['as'],'attributes':_0x504c8b['attributes'],'include':_0x504c8b['include']?_['map'](_0x504c8b['include'],function(_0x44176e){return{'model':db[_0x44176e['model']],'as':_0x44176e['as'],'attributes':_0x44176e[_0xb4d6('0x18')],'include':_0x44176e[_0xb4d6('0x19')]?_[_0xb4d6('0x1a')](_0x44176e[_0xb4d6('0x19')],function(_0xe51c0b){return{'model':db[_0xe51c0b['model']],'as':_0xe51c0b['as'],'attributes':_0xe51c0b[_0xb4d6('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb4d6('0x1c')](function(_0x148360){logger[_0xb4d6('0x9')](_0xb4d6('0x12'),_0x2bf10e);logger[_0xb4d6('0xb')](_0xb4d6('0x12'),_0x2bf10e,JSON['stringify'](_0x148360));_0x43f1ed(_0x148360);})[_0xb4d6('0x11')](function(_0x11df59){logger[_0xb4d6('0xd')]('GetCmHopperBlack',_0x11df59[_0xb4d6('0xf')],_0x2bf10e);_0x3f34a3(_0x40148d[_0xb4d6('0xd')](0x1f4,_0x11df59[_0xb4d6('0xf')]));});});};exports[_0xb4d6('0x1d')]=function(_0x18d4bb){var _0x888c11=this;return new Promise(function(_0x35f16e,_0x296ec7){return db[_0xb4d6('0x13')][_0xb4d6('0x1e')](_0x18d4bb[_0xb4d6('0x1f')],{'raw':_0x18d4bb['options']?_0x18d4bb['options'][_0xb4d6('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18d4bb[_0xb4d6('0x15')]?_0x18d4bb[_0xb4d6('0x15')][_0xb4d6('0x17')]||null:null,'attributes':_0x18d4bb[_0xb4d6('0x15')]?_0x18d4bb[_0xb4d6('0x15')][_0xb4d6('0x18')]||null:null,'limit':_0x18d4bb[_0xb4d6('0x15')]?_0x18d4bb[_0xb4d6('0x15')][_0xb4d6('0x20')]||null:null})[_0xb4d6('0x1c')](function(_0x4064da){logger[_0xb4d6('0x9')](_0xb4d6('0x1d'),_0x18d4bb);logger[_0xb4d6('0xb')]('UpdateCmHopperBlack',_0x18d4bb,JSON['stringify'](_0x4064da));_0x35f16e(_0x4064da);})[_0xb4d6('0x11')](function(_0x5b7f4d){logger[_0xb4d6('0xd')]('UpdateCmHopperBlack',_0x5b7f4d[_0xb4d6('0xf')],_0x18d4bb);_0x296ec7(_0x888c11[_0xb4d6('0xd')](0x1f4,_0x5b7f4d['message']));});});};exports[_0xb4d6('0x21')]=function(_0x440a42){var _0x5a7d1b=this;return new Promise(function(_0x4c6469,_0x356da0){return db['CmHopperBlack']['destroy']({'where':_0x440a42['options']?_0x440a42[_0xb4d6('0x15')][_0xb4d6('0x17')]||null:null})['then'](function(_0x294ed9){logger['info']('DestroyCmHopperBlack',_0x440a42);logger[_0xb4d6('0xb')]('DestroyCmHopperBlack',_0x440a42,JSON['stringify'](_0x294ed9));_0x4c6469(_0x294ed9);})[_0xb4d6('0x11')](function(_0x208bc9){logger[_0xb4d6('0xd')](_0xb4d6('0x21'),_0x208bc9[_0xb4d6('0xf')],_0x440a42);_0x356da0(_0x5a7d1b[_0xb4d6('0xd')](0x1f4,_0x208bc9[_0xb4d6('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d085be7..8012a02 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(_0x25cec6,_0x306381){var _0x1132f0=function(_0x56ce35){while(--_0x56ce35){_0x25cec6['push'](_0x25cec6['shift']());}};_0x1132f0(++_0x306381);}(_0x1967,0x173));var _0x7196=function(_0xb09fbd,_0x39bb17){_0xb09fbd=_0xb09fbd-0x0;var _0x249805=_0x1967[_0xb09fbd];return _0x249805;};'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 _0x3831=['get','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x1073ab,_0x467841){var _0x192426=function(_0x6f1731){while(--_0x6f1731){_0x1073ab['push'](_0x1073ab['shift']());}};_0x192426(++_0x467841);}(_0x3831,0x14c));var _0x1383=function(_0x303862,_0x20b5ab){_0x303862=_0x303862-0x0;var _0xe6f228=_0x3831[_0x303862];return _0xe6f228;};'use strict';var multer=require(_0x1383('0x0'));var util=require('util');var path=require(_0x1383('0x1'));var timeout=require(_0x1383('0x2'));var express=require(_0x1383('0x3'));var router=express[_0x1383('0x4')]();var fs_extra=require(_0x1383('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1383('0x6'));var config=require('../../config/environment');var controller=require(_0x1383('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1383('0x8')]('/describe',auth[_0x1383('0x9')](),controller[_0x1383('0xa')]);router[_0x1383('0x8')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0xc')]);router[_0x1383('0xd')](_0x1383('0xb'),auth['isAuthenticated'](),controller[_0x1383('0xe')]);router[_0x1383('0xf')](_0x1383('0xb'),auth[_0x1383('0x9')](),controller[_0x1383('0x10')]);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 c8161a6..278c507 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 _0xa00b=['exports','INTEGER','STRING','DATE','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa00b,0xba));var _0xba00=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa00b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xba00('0x0'));var moment=require('moment');module[_0xba00('0x1')]={'state':{'type':Sequelize[_0xba00('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xba00('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xba00('0x3')]},'originatecalleridname':{'type':Sequelize[_0xba00('0x3')]},'calleridnum':{'type':Sequelize[_0xba00('0x3')]},'calleridname':{'type':Sequelize[_0xba00('0x3')]},'starttime':{'type':Sequelize[_0xba00('0x4')]},'responsetime':{'type':Sequelize[_0xba00('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xba00('0x4')]},'endtime':{'type':Sequelize[_0xba00('0x4')]},'ringtime':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xba00('0x3')]},'campaign':{'type':Sequelize[_0xba00('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xba00('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xba00('0x3')]},'thirdDisposition':{'type':Sequelize[_0xba00('0x3')]},'dispositionat':{'type':Sequelize[_0xba00('0x4')],'set':function(_0x1e632f){var _0x402cef=this['getDataValue'](_0xba00('0x5'));if(_0x402cef&&_0x1e632f){this[_0xba00('0x6')](_0xba00('0x7'),moment(_0x1e632f)[_0xba00('0x8')](moment(_0x402cef),_0xba00('0x9')));}}},'amd':{'type':Sequelize[_0xba00('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xba00('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xba00('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xba00('0x4')]},'callback':{'type':Sequelize[_0xba00('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xba00('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xba00('0x4')]},'recallme':{'type':Sequelize[_0xba00('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xba00('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xba00('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9a7d=['DATE','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING'];(function(_0x36f569,_0x4c2933){var _0x5ba075=function(_0x5c483f){while(--_0x5c483f){_0x36f569['push'](_0x36f569['shift']());}};_0x5ba075(++_0x4c2933);}(_0x9a7d,0xff));var _0xd9a7=function(_0x4f6272,_0x53b79c){_0x4f6272=_0x4f6272-0x0;var _0x1b5ae5=_0x9a7d[_0x4f6272];return _0x1b5ae5;};'use strict';var Sequelize=require(_0xd9a7('0x0'));var moment=require(_0xd9a7('0x1'));module[_0xd9a7('0x2')]={'state':{'type':Sequelize[_0xd9a7('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xd9a7('0x4')]},'scheduledat':{'type':Sequelize[_0xd9a7('0x5')]},'countbusyretry':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xd9a7('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd9a7('0x4')]},'starttime':{'type':Sequelize[_0xd9a7('0x5')]},'responsetime':{'type':Sequelize[_0xd9a7('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xd9a7('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd9a7('0x4')]},'membername':{'type':Sequelize[_0xd9a7('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd9a7('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd9a7('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x23f3c5){var _0x1ca9c5=this['getDataValue']('endtime');if(_0x1ca9c5&&_0x23f3c5){this[_0xd9a7('0x6')]('followuptime',moment(_0x23f3c5)[_0xd9a7('0x7')](moment(_0x1ca9c5),_0xd9a7('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xd9a7('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xd9a7('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xd9a7('0x5')]},'callback':{'type':Sequelize[_0xd9a7('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd9a7('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd9a7('0x5')]},'deleted':{'type':Sequelize[_0xd9a7('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xd9a7('0x5')]},'recallme':{'type':Sequelize[_0xd9a7('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd9a7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 31b8d9f..51b754d 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 _0x1623=['reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','createdAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','from','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','updatedAt','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','CmHopperFinal','findAll','rows','catch','show','params','length','find','describe','body','uniqueid','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','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(_0x33a0d7,_0x2ebb33){var _0x558e02=function(_0x3837ec){while(--_0x3837ec){_0x33a0d7['push'](_0x33a0d7['shift']());}};_0x558e02(++_0x2ebb33);}(_0x1623,0xab));var _0x3162=function(_0x55d3b9,_0x805c49){_0x55d3b9=_0x55d3b9-0x0;var _0x2bcf9e=_0x1623[_0x55d3b9];return _0x2bcf9e;};'use strict';var emlformat=require(_0x3162('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3162('0x1'));var rp=require(_0x3162('0x2'));var moment=require(_0x3162('0x3'));var BPromise=require(_0x3162('0x4'));var Mustache=require(_0x3162('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3162('0x6'));var csv=require('to-csv');var ejs=require(_0x3162('0x7'));var fs=require('fs');var fs_extra=require(_0x3162('0x8'));var _=require('lodash');var squel=require(_0x3162('0x9'));var crypto=require(_0x3162('0xa'));var jsforce=require(_0x3162('0xb'));var deskjs=require(_0x3162('0xc'));var toCsv=require(_0x3162('0xd'));var querystring=require(_0x3162('0xe'));var Papa=require(_0x3162('0xf'));var Redis=require(_0x3162('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3162('0x11'));var hardwareService=require(_0x3162('0x12'));var logger=require(_0x3162('0x13'))(_0x3162('0x14'));var utils=require(_0x3162('0x15'));var config=require(_0x3162('0x16'));var licenseUtil=require(_0x3162('0x17'));var db=require(_0x3162('0x18'))['db'];function respondWithStatusCode(_0x157ab8,_0x4c3625){_0x4c3625=_0x4c3625||0xcc;return function(_0x2d11c5){if(_0x2d11c5){return _0x157ab8['sendStatus'](_0x4c3625);}return _0x157ab8[_0x3162('0x19')](_0x4c3625)[_0x3162('0x1a')]();};}function respondWithResult(_0x49d1ad,_0x4a393a){_0x4a393a=_0x4a393a||0xc8;return function(_0x198764){if(_0x198764){return _0x49d1ad[_0x3162('0x19')](_0x4a393a)[_0x3162('0x1b')](_0x198764);}};}function respondWithFilteredResult(_0x4b8a3b,_0x15e348){return function(_0x3d0bea){if(_0x3d0bea){var _0x2705d1=typeof _0x15e348['offset']===_0x3162('0x1c')&&typeof _0x15e348[_0x3162('0x1d')]===_0x3162('0x1c');var _0xc3ee06=_0x3d0bea[_0x3162('0x1e')];var _0x1eed46=_0x2705d1?0x0:_0x15e348[_0x3162('0x1f')];var _0x4b2bf3=_0x2705d1?_0x3d0bea[_0x3162('0x1e')]:_0x15e348[_0x3162('0x1f')]+_0x15e348[_0x3162('0x1d')];var _0x36ca97;if(_0x4b2bf3>=_0xc3ee06){_0x4b2bf3=_0xc3ee06;_0x36ca97=0xc8;}else{_0x36ca97=0xce;}_0x4b8a3b['status'](_0x36ca97);return _0x4b8a3b[_0x3162('0x20')]('Content-Range',_0x1eed46+'-'+_0x4b2bf3+'/'+_0xc3ee06)['json'](_0x3d0bea);}return null;};}function patchUpdates(_0xa5c62b){return function(_0x3e4d23){try{jsonpatch[_0x3162('0x21')](_0x3e4d23,_0xa5c62b,!![]);}catch(_0x523fab){return BPromise['reject'](_0x523fab);}return _0x3e4d23[_0x3162('0x22')]();};}function saveUpdates(_0x396372,_0x32c051){return function(_0x26c90d){if(_0x26c90d){return _0x26c90d[_0x3162('0x23')](_0x396372)[_0x3162('0x24')](function(_0x52ae25){return _0x52ae25;});}return null;};}function removeEntity(_0x1b2713,_0x5a4994){return function(_0xd283d6){if(_0xd283d6){return _0xd283d6[_0x3162('0x25')]()[_0x3162('0x24')](function(){_0x1b2713[_0x3162('0x19')](0xcc)[_0x3162('0x1a')]();});}};}function handleEntityNotFound(_0x3c543e,_0x30552f){return function(_0x5f8f7){if(!_0x5f8f7){_0x3c543e[_0x3162('0x26')](0x194);}return _0x5f8f7;};}function handleError(_0x356c5d,_0x8fa09f){_0x8fa09f=_0x8fa09f||0x1f4;return function(_0x2f62d7){logger[_0x3162('0x27')](_0x2f62d7['stack']);if(_0x2f62d7[_0x3162('0x28')]){delete _0x2f62d7['name'];}_0x356c5d[_0x3162('0x19')](_0x8fa09f)[_0x3162('0x29')](_0x2f62d7);};}exports[_0x3162('0x2a')]=function(_0x57f567,_0x4903e7){var _0xda0389={},_0xaa1f35={},_0x14df16={'count':0x0,'rows':[]};var _0x399148=_[_0x3162('0x2b')](db['CmHopperFinal'][_0x3162('0x2c')],function(_0x4e3cc2){return{'name':_0x4e3cc2[_0x3162('0x2d')],'type':_0x4e3cc2[_0x3162('0x2e')][_0x3162('0x2f')]};});_0xaa1f35[_0x3162('0x30')]=_[_0x3162('0x2b')](_0x399148,_0x3162('0x28'));_0xaa1f35[_0x3162('0x31')]=_[_0x3162('0x32')](_0x57f567['query']);_0xaa1f35[_0x3162('0x33')]=_[_0x3162('0x34')](_0xaa1f35['model'],_0xaa1f35[_0x3162('0x31')]);_0xda0389[_0x3162('0x35')]=_['intersection'](_0xaa1f35['model'],qs[_0x3162('0x36')](_0x57f567['query'][_0x3162('0x36')]));_0xda0389[_0x3162('0x35')]=_0xda0389[_0x3162('0x35')]['length']?_0xda0389['attributes']:_0xaa1f35[_0x3162('0x30')];if(!_0x57f567[_0x3162('0x31')]['hasOwnProperty'](_0x3162('0x37'))){_0xda0389['limit']=qs[_0x3162('0x1d')](_0x57f567[_0x3162('0x31')][_0x3162('0x1d')]);_0xda0389[_0x3162('0x1f')]=qs[_0x3162('0x1f')](_0x57f567[_0x3162('0x31')][_0x3162('0x1f')]);}_0xda0389[_0x3162('0x38')]=qs[_0x3162('0x39')](_0x57f567[_0x3162('0x31')][_0x3162('0x39')]);_0xda0389['where']=qs[_0x3162('0x33')](_[_0x3162('0x3a')](_0x57f567[_0x3162('0x31')],_0xaa1f35['filters']),_0x399148);if(_0x57f567['query'][_0x3162('0x3b')]){_0xda0389[_0x3162('0x3c')]=_[_0x3162('0x3d')](_0xda0389[_0x3162('0x3c')],{'$or':_['map'](_0x399148,function(_0x4186b6){if(_0x4186b6['type']!=='VIRTUAL'){var _0x5dee49={};_0x5dee49[_0x4186b6[_0x3162('0x28')]]={'$like':'%'+_0x57f567[_0x3162('0x31')][_0x3162('0x3b')]+'%'};return _0x5dee49;}})});}_0xda0389=_['merge']({},_0xda0389,_0x57f567[_0x3162('0x3e')]);var _0x2ce9c6={'where':_0xda0389[_0x3162('0x3c')]};return db[_0x3162('0x3f')][_0x3162('0x1e')](_0x2ce9c6)['then'](function(_0x5447d6){_0x14df16[_0x3162('0x1e')]=_0x5447d6;if(_0x57f567[_0x3162('0x31')]['includeAll']){_0xda0389['include']=[{'all':!![]}];}return db[_0x3162('0x3f')][_0x3162('0x40')](_0xda0389);})[_0x3162('0x24')](function(_0x4883ac){_0x14df16[_0x3162('0x41')]=_0x4883ac;return _0x14df16;})[_0x3162('0x24')](respondWithFilteredResult(_0x4903e7,_0xda0389))[_0x3162('0x42')](handleError(_0x4903e7,null));};exports[_0x3162('0x43')]=function(_0x534708,_0x2617d3){var _0x282e3e={'raw':!![],'where':{'id':_0x534708[_0x3162('0x44')]['id']}},_0x522cce={};_0x522cce[_0x3162('0x30')]=_['keys'](db[_0x3162('0x3f')][_0x3162('0x2c')]);_0x522cce['query']=_[_0x3162('0x32')](_0x534708['query']);_0x522cce[_0x3162('0x33')]=_[_0x3162('0x34')](_0x522cce[_0x3162('0x30')],_0x522cce[_0x3162('0x31')]);_0x282e3e[_0x3162('0x35')]=_[_0x3162('0x34')](_0x522cce['model'],qs[_0x3162('0x36')](_0x534708[_0x3162('0x31')][_0x3162('0x36')]));_0x282e3e['attributes']=_0x282e3e[_0x3162('0x35')][_0x3162('0x45')]?_0x282e3e['attributes']:_0x522cce[_0x3162('0x30')];if(_0x534708['query']['includeAll']){_0x282e3e['include']=[{'all':!![]}];}_0x282e3e=_[_0x3162('0x3d')]({},_0x282e3e,_0x534708[_0x3162('0x3e')]);return db[_0x3162('0x3f')][_0x3162('0x46')](_0x282e3e)[_0x3162('0x24')](handleEntityNotFound(_0x2617d3,null))[_0x3162('0x24')](respondWithResult(_0x2617d3,null))[_0x3162('0x42')](handleError(_0x2617d3,null));};exports[_0x3162('0x47')]=function(_0x3d2958,_0x28865c){return db[_0x3162('0x3f')][_0x3162('0x47')]()[_0x3162('0x24')](respondWithResult(_0x28865c,null))['catch'](handleError(_0x28865c,null));};exports[_0x3162('0x23')]=function(_0x48cb8f,_0x4f1dde){if(_0x48cb8f[_0x3162('0x48')][_0x3162('0x49')]){delete _0x48cb8f[_0x3162('0x48')][_0x3162('0x49')];}return db['CmHopperFinal'][_0x3162('0x46')]({'where':{'uniqueid':_0x48cb8f['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x4f1dde,null))[_0x3162('0x24')](saveUpdates(_0x48cb8f['body'],null))[_0x3162('0x24')](respondWithResult(_0x4f1dde,null))['catch'](handleError(_0x4f1dde,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x13e7c4,_0x22c0a2,_0x160364){return db[_0x3162('0x3f')][_0x3162('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x13e7c4[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x3162('0x4c')))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x203,\x201,\x20null'))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x50')))),_0x3162('0x51')],[db['sequelize']['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db['sequelize'][_0x3162('0x4e')](_0x3162('0x54')))),'dropContacts'],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),_0x3162('0x56')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db['sequelize']['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3162('0x57')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x58')))),_0x3162('0x59')]]})[_0x3162('0x24')](handleEntityNotFound(_0x22c0a2,null))[_0x3162('0x24')](respondWithResult(_0x22c0a2,null))[_0x3162('0x42')](handleError(_0x22c0a2,null));};exports[_0x3162('0x5a')]=function(_0x4b5729,_0x4a42ea,_0x520b1a){return db[_0x3162('0x3f')]['findAll']({'raw':![],'where':{'CampaignId':_0x4b5729[_0x3162('0x44')]['id']},'attributes':[[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x3162('0x4d')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5b')))),_0x3162('0x4f')],[db['sequelize']['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x50')))),'busyContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x52')))),_0x3162('0x53')],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x54')))),_0x3162('0x5c')],[db[_0x3162('0x4a')]['fn']('COUNT',db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')]['literal'](_0x3162('0x55')))),'abandonedContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x5d')))),'reCallContacts'],[db[_0x3162('0x4a')]['fn'](_0x3162('0x4b'),db[_0x3162('0x4a')]['fn']('IF',db[_0x3162('0x4a')][_0x3162('0x4e')](_0x3162('0x58')))),'answeringMachine']]})[_0x3162('0x24')](handleEntityNotFound(_0x4a42ea,null))[_0x3162('0x24')](respondWithResult(_0x4a42ea,null))[_0x3162('0x42')](handleError(_0x4a42ea,null));};exports[_0x3162('0x5e')]=function(_0x8a75ca,_0x33c39d,_0xb3d824){return db['VoiceQueue']['find']({'where':{'id':_0x8a75ca['params']['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x33c39d,null))[_0x3162('0x24')](function(_0x59b3f7){var _0x129005;if(_0x59b3f7){_0x129005=squel[_0x3162('0x5f')]()[_0x3162('0x60')](_0x3162('0x61'))['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'VoiceQueueId',_0x3162('0x65'),'updatedAt'],squel[_0x3162('0x66')]()['field'](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))[_0x3162('0x68')]('ANY_VALUE(ContactId)',_0x3162('0x6a'))[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x6c'),_0x3162('0x6d'))[_0x3162('0x68')](_0x3162('0x69'),'createdAt')[_0x3162('0x68')](_0x3162('0x69'),'updatedAt')['from'](_0x3162('0x6e'))[_0x3162('0x3c')]('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x8a75ca[_0x3162('0x48')][_0x3162('0x71')][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x3162('0x66')]()[_0x3162('0x68')]('phone')[_0x3162('0x73')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x8a75ca[_0x3162('0x44')]['id']['toString']()))[_0x3162('0x3c')](_0x3162('0x74'),squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x76'),_0x8a75ca[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where'](_0x3162('0x77')))[_0x3162('0x78')](_0x3162('0x6a')))[_0x3162('0x6f')]();return db[_0x3162('0x4a')][_0x3162('0x31')](_0x129005);}return[];})[_0x3162('0x24')](respondWithResult(_0x33c39d,null))[_0x3162('0x42')](handleError(_0x33c39d,null));};exports[_0x3162('0x79')]=function(_0x3f37fa,_0x1d242f,_0x190f91){return db['Campaign'][_0x3162('0x46')]({'where':{'id':_0x3f37fa[_0x3162('0x44')]['id']}})[_0x3162('0x24')](handleEntityNotFound(_0x1d242f,null))['then'](function(_0x3d7bd1){var _0x5cdbb0;if(_0x3d7bd1){_0x5cdbb0=squel[_0x3162('0x5f')]()[_0x3162('0x60')]('cm_hopper')['fromQuery']([_0x3162('0x62'),_0x3162('0x63'),'ContactId',_0x3162('0x64'),'CampaignId',_0x3162('0x65'),_0x3162('0x7a')],squel[_0x3162('0x66')]()[_0x3162('0x68')](_0x3162('0x67'),_0x3162('0x62'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x63'))['field'](_0x3162('0x7b'),'ContactId')[_0x3162('0x68')](_0x3162('0x6b'),'ListId')[_0x3162('0x68')](_0x3162('0x7c'),_0x3162('0x7d'))[_0x3162('0x68')](_0x3162('0x69'),_0x3162('0x65'))[_0x3162('0x68')]('NOW()',_0x3162('0x7a'))[_0x3162('0x73')](_0x3162('0x6e'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x70'),_0x3f37fa[_0x3162('0x48')]['state'][_0x3162('0x6f')]())[_0x3162('0x3c')](_0x3162('0x72'))[_0x3162('0x3c')](_0x3162('0x74'),squel['select']()[_0x3162('0x68')]('phone')[_0x3162('0x73')](_0x3162('0x61'))['where'](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]()))['where'](_0x3162('0x74'),squel['select']()['field'](_0x3162('0x75'))[_0x3162('0x73')](_0x3162('0x6e'))[_0x3162('0x3c')](_0x3162('0x7e'),_0x3f37fa[_0x3162('0x44')]['id'][_0x3162('0x6f')]())['where']('state\x20=\x204'))['group'](_0x3162('0x6a')))[_0x3162('0x6f')]();return db['sequelize']['query'](_0x5cdbb0);}return[];})[_0x3162('0x24')](respondWithResult(_0x1d242f,null))['catch'](handleError(_0x1d242f,null));};exports[_0x3162('0x7f')]=function(_0x35d9f0,_0x4408db,_0x377edb){return db['CmHopper'][_0x3162('0x80')]({'where':{'VoiceQueueId':_0x35d9f0[_0x3162('0x48')][_0x3162('0x6d')],'CampaignId':_0x35d9f0['body'][_0x3162('0x7d')],'ContactId':_0x35d9f0['body'][_0x3162('0x6a')]}})['then'](handleEntityNotFound(_0x4408db,null))[_0x3162('0x24')](function(_0x3d414f){if(_0x3d414f){return _0x3d414f;}return null;})[_0x3162('0x24')](respondWithResult(_0x4408db,null))['catch'](handleError(_0x4408db,null));}; \ No newline at end of file +var _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x1f278c,_0x39ad3b){var _0x30feef=function(_0x1fc46d){while(--_0x1fc46d){_0x1f278c['push'](_0x1f278c['shift']());}};_0x30feef(++_0x39ad3b);}(_0x430c,0x1a1));var _0xc430=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0x430c[_0x183b97];return _0x629cf7;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ebffa08..1c57931 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 _0xd161=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./cmHopperFinal.attributes'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd161,0x156));var _0x1d16=function(_0x350bc5,_0x419cf1){_0x350bc5=_0x350bc5-0x0;var _0x480231=_0xd161[_0x350bc5];return _0x480231;};'use strict';var _=require(_0x1d16('0x0'));var util=require(_0x1d16('0x1'));var logger=require(_0x1d16('0x2'))(_0x1d16('0x3'));var moment=require(_0x1d16('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d16('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d16('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d16('0x7'));module[_0x1d16('0x8')]=function(_0x44dcfc,_0x461077){return _0x44dcfc[_0x1d16('0x9')](_0x1d16('0xa'),attributes,{'tableName':_0x1d16('0xb'),'paranoid':![],'indexes':[{'name':_0x1d16('0xc'),'fields':['calleridnum']},{'name':_0x1d16('0xd'),'fields':[_0x1d16('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf598=['request-promise','path','rimraf','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2fb136,_0x31d182){var _0x170aa0=function(_0x573c82){while(--_0x573c82){_0x2fb136['push'](_0x2fb136['shift']());}};_0x170aa0(++_0x31d182);}(_0xf598,0x90));var _0x8f59=function(_0x7531ff,_0x15f80d){_0x7531ff=_0x7531ff-0x0;var _0x43e3d9=_0xf598[_0x7531ff];return _0x43e3d9;};'use strict';var _=require(_0x8f59('0x0'));var util=require(_0x8f59('0x1'));var logger=require(_0x8f59('0x2'))(_0x8f59('0x3'));var moment=require(_0x8f59('0x4'));var BPromise=require(_0x8f59('0x5'));var rp=require(_0x8f59('0x6'));var fs=require('fs');var path=require(_0x8f59('0x7'));var rimraf=require(_0x8f59('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x8f59('0x9')]=function(_0x31dbfb,_0x4909d5){return _0x31dbfb[_0x8f59('0xa')](_0x8f59('0xb'),attributes,{'tableName':_0x8f59('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x8f59('0xd')]},{'name':'uniqueid','fields':[_0x8f59('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8b11de2..9019eeb 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(_0x30ecda,_0x38ab26){var _0x174583=function(_0x31d275){while(--_0x31d275){_0x30ecda['push'](_0x30ecda['shift']());}};_0x174583(++_0x38ab26);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c815e,_0x3d8105){_0x3c815e=_0x3c815e-0x0;var _0xf66654=_0xb10b[_0x3c815e];return _0xf66654;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4fdd86,_0xfa54b1){var _0x4f04b7=function(_0x1e93b7){while(--_0x1e93b7){_0x4fdd86['push'](_0x4fdd86['shift']());}};_0x4f04b7(++_0xfa54b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x20e5c3,_0x41470c){_0x20e5c3=_0x20e5c3-0x0;var _0x401520=_0xb10b[_0x20e5c3];return _0x401520;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 64c5347..ea26a87 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 _0x9149=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id'];(function(_0x43df9e,_0x3861ad){var _0x34af5d=function(_0x4b88ab){while(--_0x4b88ab){_0x43df9e['push'](_0x43df9e['shift']());}};_0x34af5d(++_0x3861ad);}(_0x9149,0x1d7));var _0x9914=function(_0x15ce0b,_0x30d784){_0x15ce0b=_0x15ce0b-0x0;var _0x442f99=_0x9149[_0x15ce0b];return _0x442f99;};'use strict';var multer=require(_0x9914('0x0'));var util=require(_0x9914('0x1'));var path=require(_0x9914('0x2'));var timeout=require(_0x9914('0x3'));var express=require(_0x9914('0x4'));var router=express[_0x9914('0x5')]();var fs_extra=require(_0x9914('0x6'));var auth=require(_0x9914('0x7'));var interaction=require(_0x9914('0x8'));var config=require(_0x9914('0x9'));var controller=require(_0x9914('0xa'));router[_0x9914('0xb')]('/',auth[_0x9914('0xc')](),controller[_0x9914('0xd')]);router[_0x9914('0xb')](_0x9914('0xe'),auth[_0x9914('0xc')](),controller['describe']);router[_0x9914('0xb')]('/:id',auth[_0x9914('0xc')](),controller[_0x9914('0xf')]);router['get'](_0x9914('0x10'),auth[_0x9914('0xc')](),controller[_0x9914('0x11')]);router[_0x9914('0xb')](_0x9914('0x12'),auth[_0x9914('0xc')](),controller[_0x9914('0x13')]);router[_0x9914('0x14')](_0x9914('0x15'),auth[_0x9914('0xc')](),controller[_0x9914('0x16')]);router[_0x9914('0x14')](_0x9914('0x17'),auth['isAuthenticated'](),controller[_0x9914('0x18')]);router[_0x9914('0x14')](_0x9914('0x19'),auth[_0x9914('0xc')](),controller[_0x9914('0x1a')]);router[_0x9914('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x9914('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x7611=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports','multer','path','express','Router','fs-extra'];(function(_0x2a54d1,_0x37a51a){var _0x320511=function(_0x4de10a){while(--_0x4de10a){_0x2a54d1['push'](_0x2a54d1['shift']());}};_0x320511(++_0x37a51a);}(_0x7611,0xb1));var _0x1761=function(_0x444a8b,_0x526b10){_0x444a8b=_0x444a8b-0x0;var _0x2cebf5=_0x7611[_0x444a8b];return _0x2cebf5;};'use strict';var multer=require(_0x1761('0x0'));var util=require('util');var path=require(_0x1761('0x1'));var timeout=require('connect-timeout');var express=require(_0x1761('0x2'));var router=express[_0x1761('0x3')]();var fs_extra=require(_0x1761('0x4'));var auth=require(_0x1761('0x5'));var interaction=require(_0x1761('0x6'));var config=require('../../config/environment');var controller=require(_0x1761('0x7'));router[_0x1761('0x8')]('/',auth['isAuthenticated'](),controller[_0x1761('0x9')]);router[_0x1761('0x8')](_0x1761('0xa'),auth[_0x1761('0xb')](),controller['describe']);router[_0x1761('0x8')](_0x1761('0xc'),auth['isAuthenticated'](),controller[_0x1761('0xd')]);router[_0x1761('0x8')](_0x1761('0xe'),auth['isAuthenticated'](),controller[_0x1761('0xf')]);router[_0x1761('0x8')](_0x1761('0x10'),auth[_0x1761('0xb')](),controller[_0x1761('0x11')]);router['post'](_0x1761('0x12'),auth[_0x1761('0xb')](),controller[_0x1761('0x13')]);router[_0x1761('0x14')](_0x1761('0x15'),auth[_0x1761('0xb')](),controller[_0x1761('0x16')]);router['post'](_0x1761('0x17'),auth[_0x1761('0xb')](),controller[_0x1761('0x18')]);router['put'](_0x1761('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x1761('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e55226b..6cdc45a 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 _0x5923=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x992aca,_0x2d6592){var _0x3f1d2e=function(_0x50710f){while(--_0x50710f){_0x992aca['push'](_0x992aca['shift']());}};_0x3f1d2e(++_0x2d6592);}(_0x5923,0x12b));var _0x3592=function(_0x1af78b,_0x216a77){_0x1af78b=_0x1af78b-0x0;var _0x127c93=_0x5923[_0x1af78b];return _0x127c93;};'use strict';var Sequelize=require(_0x3592('0x0'));module['exports']={'state':{'type':Sequelize[_0x3592('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x3592('0x2')]},'scheduledat':{'type':Sequelize[_0x3592('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3592('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x3592('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x3592('0x2')]},'calleridname':{'type':Sequelize[_0x3592('0x2')]},'starttime':{'type':Sequelize[_0x3592('0x3')]},'responsetime':{'type':Sequelize[_0x3592('0x3')]},'answertime':{'type':Sequelize[_0x3592('0x3')]},'droptime':{'type':Sequelize[_0x3592('0x3')]},'endtime':{'type':Sequelize[_0x3592('0x3')]},'ringtime':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x3592('0x2')]},'membername':{'type':Sequelize[_0x3592('0x2')]},'reason':{'type':Sequelize[_0x3592('0x2')]},'amd':{'type':Sequelize[_0x3592('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3592('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3592('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3592('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3592('0x3')]},'recallme':{'type':Sequelize[_0x3592('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3592('0x3')]},'edited':{'type':Sequelize[_0x3592('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3592('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3592('0x2')]}}; \ No newline at end of file +var _0x4fde=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x3f808a,_0x96109){var _0x2f9fba=function(_0x571821){while(--_0x571821){_0x3f808a['push'](_0x3f808a['shift']());}};_0x2f9fba(++_0x96109);}(_0x4fde,0x10a));var _0xe4fd=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x4fde[_0x7c0074];return _0x13e95b;};'use strict';var Sequelize=require(_0xe4fd('0x0'));module[_0xe4fd('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xe4fd('0x2')]},'scheduledat':{'type':Sequelize[_0xe4fd('0x3')]},'countbusyretry':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe4fd('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xe4fd('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe4fd('0x2')]},'starttime':{'type':Sequelize[_0xe4fd('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xe4fd('0x3')]},'droptime':{'type':Sequelize[_0xe4fd('0x3')]},'endtime':{'type':Sequelize[_0xe4fd('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xe4fd('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xe4fd('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe4fd('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xe4fd('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe4fd('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe4fd('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe4fd('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe4fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 688fe98..8afe9b6 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 _0xd2ab=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','status','send','index','CmHopperHistory','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','find','create','body','catch','describe','uniqueid','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x18ebd7,_0x41aa30){var _0x275b76=function(_0x833409){while(--_0x833409){_0x18ebd7['push'](_0x18ebd7['shift']());}};_0x275b76(++_0x41aa30);}(_0xd2ab,0x91));var _0xbd2a=function(_0x150074,_0x3dfc52){_0x150074=_0x150074-0x0;var _0xafcb2c=_0xd2ab[_0x150074];return _0xafcb2c;};'use strict';var emlformat=require(_0xbd2a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbd2a('0x1'));var rp=require('request-promise');var moment=require(_0xbd2a('0x2'));var BPromise=require(_0xbd2a('0x3'));var Mustache=require(_0xbd2a('0x4'));var util=require(_0xbd2a('0x5'));var path=require(_0xbd2a('0x6'));var sox=require(_0xbd2a('0x7'));var csv=require(_0xbd2a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd2a('0x9'));var _=require(_0xbd2a('0xa'));var squel=require(_0xbd2a('0xb'));var crypto=require(_0xbd2a('0xc'));var jsforce=require(_0xbd2a('0xd'));var deskjs=require(_0xbd2a('0xe'));var toCsv=require(_0xbd2a('0x8'));var querystring=require(_0xbd2a('0xf'));var Papa=require(_0xbd2a('0x10'));var Redis=require(_0xbd2a('0x11'));var authService=require(_0xbd2a('0x12'));var qs=require(_0xbd2a('0x13'));var as=require(_0xbd2a('0x14'));var hardwareService=require(_0xbd2a('0x15'));var logger=require(_0xbd2a('0x16'))(_0xbd2a('0x17'));var utils=require(_0xbd2a('0x18'));var config=require(_0xbd2a('0x19'));var licenseUtil=require(_0xbd2a('0x1a'));var db=require(_0xbd2a('0x1b'))['db'];function respondWithStatusCode(_0x1af9f8,_0x4ce562){_0x4ce562=_0x4ce562||0xcc;return function(_0x84012f){if(_0x84012f){return _0x1af9f8['sendStatus'](_0x4ce562);}return _0x1af9f8['status'](_0x4ce562)[_0xbd2a('0x1c')]();};}function respondWithResult(_0x5406a5,_0x42fed3){_0x42fed3=_0x42fed3||0xc8;return function(_0x4a8f7e){if(_0x4a8f7e){return _0x5406a5['status'](_0x42fed3)[_0xbd2a('0x1d')](_0x4a8f7e);}};}function respondWithFilteredResult(_0x491006,_0x1b7062){return function(_0x501bb2){if(_0x501bb2){var _0x7e1a35=typeof _0x1b7062['offset']==='undefined'&&typeof _0x1b7062['limit']===_0xbd2a('0x1e');var _0x274334=_0x501bb2[_0xbd2a('0x1f')];var _0x484c66=_0x7e1a35?0x0:_0x1b7062['offset'];var _0x26028e=_0x7e1a35?_0x501bb2[_0xbd2a('0x1f')]:_0x1b7062[_0xbd2a('0x20')]+_0x1b7062[_0xbd2a('0x21')];var _0x5efa75;if(_0x26028e>=_0x274334){_0x26028e=_0x274334;_0x5efa75=0xc8;}else{_0x5efa75=0xce;}_0x491006['status'](_0x5efa75);return _0x491006['set'](_0xbd2a('0x22'),_0x484c66+'-'+_0x26028e+'/'+_0x274334)['json'](_0x501bb2);}return null;};}function patchUpdates(_0x3a3fbc){return function(_0x48eb2d){try{jsonpatch[_0xbd2a('0x23')](_0x48eb2d,_0x3a3fbc,!![]);}catch(_0x181be3){return BPromise['reject'](_0x181be3);}return _0x48eb2d[_0xbd2a('0x24')]();};}function saveUpdates(_0x25444f,_0x25c655){return function(_0x237b01){if(_0x237b01){return _0x237b01[_0xbd2a('0x25')](_0x25444f)[_0xbd2a('0x26')](function(_0x1c3783){return _0x1c3783;});}return null;};}function removeEntity(_0x23b434,_0x4eaf76){return function(_0x1e69d5){if(_0x1e69d5){return _0x1e69d5[_0xbd2a('0x27')]()[_0xbd2a('0x26')](function(){_0x23b434['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f91b,_0x4c682e){return function(_0x307b74){if(!_0x307b74){_0x27f91b[_0xbd2a('0x28')](0x194);}return _0x307b74;};}function handleError(_0x12c48b,_0x8f25cc){_0x8f25cc=_0x8f25cc||0x1f4;return function(_0x293102){logger['error'](_0x293102[_0xbd2a('0x29')]);if(_0x293102[_0xbd2a('0x2a')]){delete _0x293102[_0xbd2a('0x2a')];}_0x12c48b[_0xbd2a('0x2b')](_0x8f25cc)[_0xbd2a('0x2c')](_0x293102);};}exports[_0xbd2a('0x2d')]=function(_0x2e7a1a,_0x3b870e){var _0x3e9712={},_0x5a6189={},_0x337528={'count':0x0,'rows':[]};var _0x414f85=_['map'](db[_0xbd2a('0x2e')]['rawAttributes'],function(_0x3d3703){return{'name':_0x3d3703[_0xbd2a('0x2f')],'type':_0x3d3703[_0xbd2a('0x30')]['key']};});_0x5a6189[_0xbd2a('0x31')]=_['map'](_0x414f85,'name');_0x5a6189['query']=_[_0xbd2a('0x32')](_0x2e7a1a[_0xbd2a('0x33')]);_0x5a6189['filters']=_[_0xbd2a('0x34')](_0x5a6189[_0xbd2a('0x31')],_0x5a6189[_0xbd2a('0x33')]);_0x3e9712['attributes']=_[_0xbd2a('0x34')](_0x5a6189[_0xbd2a('0x31')],qs['fields'](_0x2e7a1a[_0xbd2a('0x33')][_0xbd2a('0x35')]));_0x3e9712[_0xbd2a('0x36')]=_0x3e9712[_0xbd2a('0x36')][_0xbd2a('0x37')]?_0x3e9712[_0xbd2a('0x36')]:_0x5a6189['model'];if(!_0x2e7a1a[_0xbd2a('0x33')][_0xbd2a('0x38')]('nolimit')){_0x3e9712['limit']=qs[_0xbd2a('0x21')](_0x2e7a1a['query'][_0xbd2a('0x21')]);_0x3e9712[_0xbd2a('0x20')]=qs[_0xbd2a('0x20')](_0x2e7a1a[_0xbd2a('0x33')][_0xbd2a('0x20')]);}_0x3e9712[_0xbd2a('0x39')]=qs[_0xbd2a('0x3a')](_0x2e7a1a[_0xbd2a('0x33')][_0xbd2a('0x3a')]);_0x3e9712[_0xbd2a('0x3b')]=qs[_0xbd2a('0x3c')](_['pick'](_0x2e7a1a[_0xbd2a('0x33')],_0x5a6189['filters']),_0x414f85);if(_0x2e7a1a[_0xbd2a('0x33')]['filter']){_0x3e9712[_0xbd2a('0x3b')]=_[_0xbd2a('0x3d')](_0x3e9712['where'],{'$or':_['map'](_0x414f85,function(_0x3e55dd){if(_0x3e55dd[_0xbd2a('0x30')]!==_0xbd2a('0x3e')){var _0x57451d={};_0x57451d[_0x3e55dd[_0xbd2a('0x2a')]]={'$like':'%'+_0x2e7a1a[_0xbd2a('0x33')][_0xbd2a('0x3f')]+'%'};return _0x57451d;}})});}_0x3e9712=_[_0xbd2a('0x3d')]({},_0x3e9712,_0x2e7a1a[_0xbd2a('0x40')]);var _0x1fc724={'where':_0x3e9712['where']};return db[_0xbd2a('0x2e')]['count'](_0x1fc724)[_0xbd2a('0x26')](function(_0x4b5241){_0x337528[_0xbd2a('0x1f')]=_0x4b5241;if(_0x2e7a1a['query'][_0xbd2a('0x41')]){_0x3e9712[_0xbd2a('0x42')]=[{'all':!![]}];}return db[_0xbd2a('0x2e')][_0xbd2a('0x43')](_0x3e9712);})[_0xbd2a('0x26')](function(_0x409285){_0x337528['rows']=_0x409285;return _0x337528;})[_0xbd2a('0x26')](respondWithFilteredResult(_0x3b870e,_0x3e9712))['catch'](handleError(_0x3b870e,null));};exports[_0xbd2a('0x44')]=function(_0x358995,_0x1aaa68){var _0x51fa5d={'raw':!![],'where':{'id':_0x358995['params']['id']}},_0x3e4042={};_0x3e4042[_0xbd2a('0x31')]=_[_0xbd2a('0x32')](db[_0xbd2a('0x2e')]['rawAttributes']);_0x3e4042[_0xbd2a('0x33')]=_[_0xbd2a('0x32')](_0x358995[_0xbd2a('0x33')]);_0x3e4042[_0xbd2a('0x3c')]=_[_0xbd2a('0x34')](_0x3e4042[_0xbd2a('0x31')],_0x3e4042[_0xbd2a('0x33')]);_0x51fa5d[_0xbd2a('0x36')]=_['intersection'](_0x3e4042[_0xbd2a('0x31')],qs['fields'](_0x358995[_0xbd2a('0x33')][_0xbd2a('0x35')]));_0x51fa5d[_0xbd2a('0x36')]=_0x51fa5d[_0xbd2a('0x36')][_0xbd2a('0x37')]?_0x51fa5d[_0xbd2a('0x36')]:_0x3e4042[_0xbd2a('0x31')];if(_0x358995[_0xbd2a('0x33')]['includeAll']){_0x51fa5d[_0xbd2a('0x42')]=[{'all':!![]}];}_0x51fa5d=_[_0xbd2a('0x3d')]({},_0x51fa5d,_0x358995[_0xbd2a('0x40')]);return db[_0xbd2a('0x2e')][_0xbd2a('0x45')](_0x51fa5d)[_0xbd2a('0x26')](handleEntityNotFound(_0x1aaa68,null))[_0xbd2a('0x26')](respondWithResult(_0x1aaa68,null))['catch'](handleError(_0x1aaa68,null));};exports[_0xbd2a('0x46')]=function(_0x5b4007,_0x1ea570){return db[_0xbd2a('0x2e')][_0xbd2a('0x46')](_0x5b4007[_0xbd2a('0x47')],{})[_0xbd2a('0x26')](respondWithResult(_0x1ea570,0xc9))[_0xbd2a('0x48')](handleError(_0x1ea570,null));};exports[_0xbd2a('0x49')]=function(_0xfec403,_0x255b03){return db[_0xbd2a('0x2e')][_0xbd2a('0x49')]()[_0xbd2a('0x26')](respondWithResult(_0x255b03,null))['catch'](handleError(_0x255b03,null));};exports[_0xbd2a('0x25')]=function(_0x3036e4,_0x1ce8bf){if(_0x3036e4[_0xbd2a('0x47')][_0xbd2a('0x4a')]){delete _0x3036e4[_0xbd2a('0x47')][_0xbd2a('0x4a')];}return db[_0xbd2a('0x2e')]['find']({'where':{'uniqueid':_0x3036e4[_0xbd2a('0x4b')]['id']}})[_0xbd2a('0x26')](handleEntityNotFound(_0x1ce8bf,null))[_0xbd2a('0x26')](saveUpdates(_0x3036e4[_0xbd2a('0x47')],null))[_0xbd2a('0x26')](respondWithResult(_0x1ce8bf,null))[_0xbd2a('0x48')](handleError(_0x1ce8bf,null));}; \ No newline at end of file +var _0xca82=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','options','includeAll','include','catch','show','params','keys','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xf745d3,_0x2d45a8){var _0x43f070=function(_0x39a3db){while(--_0x39a3db){_0xf745d3['push'](_0xf745d3['shift']());}};_0x43f070(++_0x2d45a8);}(_0xca82,0xca));var _0x2ca8=function(_0x427787,_0xf1abc9){_0x427787=_0x427787-0x0;var _0x4f5f61=_0xca82[_0x427787];return _0x4f5f61;};'use strict';var emlformat=require(_0x2ca8('0x0'));var rimraf=require(_0x2ca8('0x1'));var zipdir=require(_0x2ca8('0x2'));var jsonpatch=require(_0x2ca8('0x3'));var rp=require(_0x2ca8('0x4'));var moment=require(_0x2ca8('0x5'));var BPromise=require(_0x2ca8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2ca8('0x7'));var sox=require(_0x2ca8('0x8'));var csv=require('to-csv');var ejs=require(_0x2ca8('0x9'));var fs=require('fs');var fs_extra=require(_0x2ca8('0xa'));var _=require(_0x2ca8('0xb'));var squel=require(_0x2ca8('0xc'));var crypto=require(_0x2ca8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ca8('0xe'));var querystring=require(_0x2ca8('0xf'));var Papa=require(_0x2ca8('0x10'));var Redis=require(_0x2ca8('0x11'));var authService=require(_0x2ca8('0x12'));var qs=require(_0x2ca8('0x13'));var as=require(_0x2ca8('0x14'));var hardwareService=require(_0x2ca8('0x15'));var logger=require(_0x2ca8('0x16'))('api');var utils=require(_0x2ca8('0x17'));var config=require(_0x2ca8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ca8('0x19'))['db'];function respondWithStatusCode(_0x4ec0a4,_0x44445e){_0x44445e=_0x44445e||0xcc;return function(_0x3c8e63){if(_0x3c8e63){return _0x4ec0a4[_0x2ca8('0x1a')](_0x44445e);}return _0x4ec0a4[_0x2ca8('0x1b')](_0x44445e)['end']();};}function respondWithResult(_0x468e3b,_0x3f44b9){_0x3f44b9=_0x3f44b9||0xc8;return function(_0x109d53){if(_0x109d53){return _0x468e3b[_0x2ca8('0x1b')](_0x3f44b9)[_0x2ca8('0x1c')](_0x109d53);}};}function respondWithFilteredResult(_0x69cbe,_0x1996ad){return function(_0x14fbbc){if(_0x14fbbc){var _0x328ff3=typeof _0x1996ad['offset']===_0x2ca8('0x1d')&&typeof _0x1996ad[_0x2ca8('0x1e')]===_0x2ca8('0x1d');var _0x38bfce=_0x14fbbc[_0x2ca8('0x1f')];var _0x21e4cf=_0x328ff3?0x0:_0x1996ad[_0x2ca8('0x20')];var _0x5c8512=_0x328ff3?_0x14fbbc[_0x2ca8('0x1f')]:_0x1996ad[_0x2ca8('0x20')]+_0x1996ad[_0x2ca8('0x1e')];var _0x2ab8c5;if(_0x5c8512>=_0x38bfce){_0x5c8512=_0x38bfce;_0x2ab8c5=0xc8;}else{_0x2ab8c5=0xce;}_0x69cbe[_0x2ca8('0x1b')](_0x2ab8c5);return _0x69cbe[_0x2ca8('0x21')](_0x2ca8('0x22'),_0x21e4cf+'-'+_0x5c8512+'/'+_0x38bfce)['json'](_0x14fbbc);}return null;};}function patchUpdates(_0x5e179d){return function(_0x154b3a){try{jsonpatch[_0x2ca8('0x23')](_0x154b3a,_0x5e179d,!![]);}catch(_0x646d27){return BPromise[_0x2ca8('0x24')](_0x646d27);}return _0x154b3a['save']();};}function saveUpdates(_0x3d202f,_0x3e6533){return function(_0x51bb67){if(_0x51bb67){return _0x51bb67[_0x2ca8('0x25')](_0x3d202f)[_0x2ca8('0x26')](function(_0x24c146){return _0x24c146;});}return null;};}function removeEntity(_0x3453c3,_0x49931d){return function(_0x509e98){if(_0x509e98){return _0x509e98[_0x2ca8('0x27')]()[_0x2ca8('0x26')](function(){_0x3453c3['status'](0xcc)[_0x2ca8('0x28')]();});}};}function handleEntityNotFound(_0x25307c,_0x891e70){return function(_0x5d177e){if(!_0x5d177e){_0x25307c['sendStatus'](0x194);}return _0x5d177e;};}function handleError(_0x44aa17,_0xdee52b){_0xdee52b=_0xdee52b||0x1f4;return function(_0x47c0ec){logger[_0x2ca8('0x29')](_0x47c0ec[_0x2ca8('0x2a')]);if(_0x47c0ec[_0x2ca8('0x2b')]){delete _0x47c0ec[_0x2ca8('0x2b')];}_0x44aa17['status'](_0xdee52b)[_0x2ca8('0x2c')](_0x47c0ec);};}exports[_0x2ca8('0x2d')]=function(_0x3bd36e,_0x5167cd){var _0x3b1136={},_0xda914e={},_0x2c1e21={'count':0x0,'rows':[]};var _0x57512f=_[_0x2ca8('0x2e')](db[_0x2ca8('0x2f')][_0x2ca8('0x30')],function(_0x558c0e){return{'name':_0x558c0e[_0x2ca8('0x31')],'type':_0x558c0e[_0x2ca8('0x32')][_0x2ca8('0x33')]};});_0xda914e[_0x2ca8('0x34')]=_[_0x2ca8('0x2e')](_0x57512f,_0x2ca8('0x2b'));_0xda914e[_0x2ca8('0x35')]=_['keys'](_0x3bd36e['query']);_0xda914e[_0x2ca8('0x36')]=_['intersection'](_0xda914e[_0x2ca8('0x34')],_0xda914e[_0x2ca8('0x35')]);_0x3b1136[_0x2ca8('0x37')]=_[_0x2ca8('0x38')](_0xda914e['model'],qs[_0x2ca8('0x39')](_0x3bd36e[_0x2ca8('0x35')][_0x2ca8('0x39')]));_0x3b1136['attributes']=_0x3b1136[_0x2ca8('0x37')][_0x2ca8('0x3a')]?_0x3b1136['attributes']:_0xda914e['model'];if(!_0x3bd36e['query']['hasOwnProperty']('nolimit')){_0x3b1136[_0x2ca8('0x1e')]=qs[_0x2ca8('0x1e')](_0x3bd36e[_0x2ca8('0x35')][_0x2ca8('0x1e')]);_0x3b1136['offset']=qs[_0x2ca8('0x20')](_0x3bd36e[_0x2ca8('0x35')][_0x2ca8('0x20')]);}_0x3b1136[_0x2ca8('0x3b')]=qs[_0x2ca8('0x3c')](_0x3bd36e[_0x2ca8('0x35')][_0x2ca8('0x3c')]);_0x3b1136[_0x2ca8('0x3d')]=qs[_0x2ca8('0x36')](_[_0x2ca8('0x3e')](_0x3bd36e[_0x2ca8('0x35')],_0xda914e[_0x2ca8('0x36')]),_0x57512f);if(_0x3bd36e[_0x2ca8('0x35')]['filter']){_0x3b1136[_0x2ca8('0x3d')]=_[_0x2ca8('0x3f')](_0x3b1136['where'],{'$or':_[_0x2ca8('0x2e')](_0x57512f,function(_0x45cecb){if(_0x45cecb[_0x2ca8('0x32')]!=='VIRTUAL'){var _0x40ac7b={};_0x40ac7b[_0x45cecb[_0x2ca8('0x2b')]]={'$like':'%'+_0x3bd36e[_0x2ca8('0x35')]['filter']+'%'};return _0x40ac7b;}})});}_0x3b1136=_[_0x2ca8('0x3f')]({},_0x3b1136,_0x3bd36e[_0x2ca8('0x40')]);var _0x19ef0e={'where':_0x3b1136[_0x2ca8('0x3d')]};return db[_0x2ca8('0x2f')][_0x2ca8('0x1f')](_0x19ef0e)[_0x2ca8('0x26')](function(_0x53bc1b){_0x2c1e21[_0x2ca8('0x1f')]=_0x53bc1b;if(_0x3bd36e['query'][_0x2ca8('0x41')]){_0x3b1136[_0x2ca8('0x42')]=[{'all':!![]}];}return db[_0x2ca8('0x2f')]['findAll'](_0x3b1136);})[_0x2ca8('0x26')](function(_0x508537){_0x2c1e21['rows']=_0x508537;return _0x2c1e21;})[_0x2ca8('0x26')](respondWithFilteredResult(_0x5167cd,_0x3b1136))[_0x2ca8('0x43')](handleError(_0x5167cd,null));};exports[_0x2ca8('0x44')]=function(_0x14bd14,_0x2b739f){var _0xd539e9={'raw':!![],'where':{'id':_0x14bd14[_0x2ca8('0x45')]['id']}},_0x1e8a8a={};_0x1e8a8a[_0x2ca8('0x34')]=_['keys'](db[_0x2ca8('0x2f')]['rawAttributes']);_0x1e8a8a[_0x2ca8('0x35')]=_[_0x2ca8('0x46')](_0x14bd14[_0x2ca8('0x35')]);_0x1e8a8a[_0x2ca8('0x36')]=_[_0x2ca8('0x38')](_0x1e8a8a['model'],_0x1e8a8a[_0x2ca8('0x35')]);_0xd539e9[_0x2ca8('0x37')]=_[_0x2ca8('0x38')](_0x1e8a8a[_0x2ca8('0x34')],qs[_0x2ca8('0x39')](_0x14bd14['query']['fields']));_0xd539e9['attributes']=_0xd539e9[_0x2ca8('0x37')][_0x2ca8('0x3a')]?_0xd539e9[_0x2ca8('0x37')]:_0x1e8a8a[_0x2ca8('0x34')];if(_0x14bd14[_0x2ca8('0x35')]['includeAll']){_0xd539e9[_0x2ca8('0x42')]=[{'all':!![]}];}_0xd539e9=_[_0x2ca8('0x3f')]({},_0xd539e9,_0x14bd14[_0x2ca8('0x40')]);return db[_0x2ca8('0x2f')]['find'](_0xd539e9)[_0x2ca8('0x26')](handleEntityNotFound(_0x2b739f,null))[_0x2ca8('0x26')](respondWithResult(_0x2b739f,null))['catch'](handleError(_0x2b739f,null));};exports['create']=function(_0xb39169,_0x278667){return db[_0x2ca8('0x2f')][_0x2ca8('0x47')](_0xb39169[_0x2ca8('0x48')],{})[_0x2ca8('0x26')](respondWithResult(_0x278667,0xc9))[_0x2ca8('0x43')](handleError(_0x278667,null));};exports[_0x2ca8('0x49')]=function(_0x544425,_0xc373f1){return db[_0x2ca8('0x2f')][_0x2ca8('0x49')]()[_0x2ca8('0x26')](respondWithResult(_0xc373f1,null))[_0x2ca8('0x43')](handleError(_0xc373f1,null));};exports['update']=function(_0x53e772,_0x37f89e){if(_0x53e772[_0x2ca8('0x48')][_0x2ca8('0x4a')]){delete _0x53e772[_0x2ca8('0x48')][_0x2ca8('0x4a')];}return db[_0x2ca8('0x2f')]['find']({'where':{'uniqueid':_0x53e772['params']['id']}})[_0x2ca8('0x26')](handleEntityNotFound(_0x37f89e,null))[_0x2ca8('0x26')](saveUpdates(_0x53e772[_0x2ca8('0x48')],null))['then'](respondWithResult(_0x37f89e,null))[_0x2ca8('0x43')](handleError(_0x37f89e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 13400bf..812ddd2 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 _0x65c9=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','api','moment'];(function(_0x100475,_0x2e0af8){var _0x41c3a3=function(_0x10d9d8){while(--_0x10d9d8){_0x100475['push'](_0x100475['shift']());}};_0x41c3a3(++_0x2e0af8);}(_0x65c9,0x182));var _0x965c=function(_0x205bb8,_0x11a832){_0x205bb8=_0x205bb8-0x0;var _0x140d4b=_0x65c9[_0x205bb8];return _0x140d4b;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var logger=require('../../config/logger')(_0x965c('0x2'));var moment=require(_0x965c('0x3'));var BPromise=require(_0x965c('0x4'));var rp=require(_0x965c('0x5'));var fs=require('fs');var path=require(_0x965c('0x6'));var rimraf=require(_0x965c('0x7'));var config=require(_0x965c('0x8'));var attributes=require(_0x965c('0x9'));module[_0x965c('0xa')]=function(_0xbda9ee,_0xb9c834){return _0xbda9ee[_0x965c('0xb')]('CmHopperHistory',attributes,{'tableName':_0x965c('0xc'),'paranoid':![],'indexes':[{'name':_0x965c('0xd'),'fields':[_0x965c('0xd')]},{'name':_0x965c('0xe'),'fields':[_0x965c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['cm_hopper_history','endtime','uniqueid','lodash','util','api','moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory'];(function(_0x3f418b,_0x11dde5){var _0x5299c8=function(_0x557e79){while(--_0x557e79){_0x3f418b['push'](_0x3f418b['shift']());}};_0x5299c8(++_0x11dde5);}(_0x32b6,0x1d1));var _0x632b=function(_0xc5caa7,_0x4a53df){_0xc5caa7=_0xc5caa7-0x0;var _0x8c81fc=_0x32b6[_0xc5caa7];return _0x8c81fc;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x632b('0xc')]},{'name':_0x632b('0xd'),'fields':[_0x632b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index d142f20..3ca6cf8 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 _0x584a=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateCmHopperHistory','CmHopperHistory','create','options','raw','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout'];(function(_0x533927,_0x1b0905){var _0x46c66a=function(_0x1f0694){while(--_0x1f0694){_0x533927['push'](_0x533927['shift']());}};_0x46c66a(++_0x1b0905);}(_0x584a,0x1c0));var _0xa584=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x584a[_0x1aeda2];return _0x32dc6d;};'use strict';var _=require(_0xa584('0x0'));var util=require(_0xa584('0x1'));var moment=require('moment');var BPromise=require(_0xa584('0x2'));var rs=require(_0xa584('0x3'));var fs=require('fs');var Redis=require(_0xa584('0x4'));var db=require(_0xa584('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa584('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa584('0x7')][_0xa584('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57a475,_0x16ca71,_0x1fada0){return new BPromise(function(_0x56be83,_0x5e72cd){return client['request'](_0x57a475,_0x1fada0)[_0xa584('0x9')](function(_0x34f615){logger[_0xa584('0xa')](_0xa584('0xb'),_0x16ca71,_0xa584('0xc'));logger[_0xa584('0xd')](_0xa584('0xe'),_0x16ca71,_0xa584('0xc'),JSON[_0xa584('0xf')](_0x34f615));if(_0x34f615[_0xa584('0x10')]){if(_0x34f615[_0xa584('0x10')][_0xa584('0x11')]===0x1f4){logger[_0xa584('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x16ca71,_0x34f615[_0xa584('0x10')][_0xa584('0x12')]);return _0x5e72cd(_0x34f615[_0xa584('0x10')][_0xa584('0x12')]);}logger[_0xa584('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x16ca71,_0x34f615[_0xa584('0x10')][_0xa584('0x12')]);return _0x56be83(_0x34f615[_0xa584('0x10')][_0xa584('0x12')]);}else{logger[_0xa584('0xa')]('CmHopperHistory,\x20%s,\x20%s',_0x16ca71,_0xa584('0xc'));_0x56be83(_0x34f615['result'][_0xa584('0x12')]);}})[_0xa584('0x13')](function(_0x28014d){logger['error'](_0xa584('0xb'),_0x16ca71,_0x28014d);_0x5e72cd(_0x28014d);});});}exports[_0xa584('0x14')]=function(_0x245885){var _0x5c0f01=this;return new Promise(function(_0xa510d6,_0x4fb59d){return db[_0xa584('0x15')][_0xa584('0x16')](_0x245885['body'],{'raw':_0x245885[_0xa584('0x17')]?_0x245885[_0xa584('0x17')][_0xa584('0x18')]===undefined?!![]:![]:!![]})[_0xa584('0x9')](function(_0xd6f63c){logger[_0xa584('0xa')](_0xa584('0x14'),_0x245885);logger[_0xa584('0xd')](_0xa584('0x14'),_0x245885,JSON[_0xa584('0xf')](_0xd6f63c));_0xa510d6(_0xd6f63c);})[_0xa584('0x13')](function(_0x58f55a){logger['error'](_0xa584('0x14'),_0x58f55a[_0xa584('0x12')],_0x245885);_0x4fb59d(_0x5c0f01[_0xa584('0x10')](0x1f4,_0x58f55a[_0xa584('0x12')]));});});};exports[_0xa584('0x19')]=function(_0x3c9e92){var _0x33bf24=this;return new Promise(function(_0x326831,_0x22066){return db['CmHopperHistory'][_0xa584('0x1a')]({'raw':_0x3c9e92['options']?_0x3c9e92[_0xa584('0x17')][_0xa584('0x18')]===undefined?!![]:![]:!![],'where':_0x3c9e92[_0xa584('0x17')]?_0x3c9e92[_0xa584('0x17')]['where']||null:null,'attributes':[[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')][_0xa584('0x1c')]('id')),_0xa584('0x1d')],[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xa584('0x1e')))),'predictiveIntervalAnsweredCalls'],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db['sequelize']['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x21')))),_0xa584('0x22')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db['sequelize'][_0xa584('0x20')](_0xa584('0x23')))),_0xa584('0x24')],[db['sequelize']['fn'](_0xa584('0x25'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x26')))),_0xa584('0x27')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x25'),db['sequelize']['fn']('IF',db[_0xa584('0x1b')]['literal'](_0xa584('0x28')))),'predictiveIntervalAvgTalktime']]})[_0xa584('0x9')](function(_0x57742c){logger['info'](_0xa584('0x19'),_0x3c9e92);logger[_0xa584('0xd')]('AvgHandleTime',_0x3c9e92,JSON[_0xa584('0xf')](_0x57742c));_0x326831(_0x57742c);})[_0xa584('0x13')](function(_0x26c517){logger['error']('AvgHandleTime',_0x26c517[_0xa584('0x12')],_0x3c9e92);_0x22066(_0x33bf24[_0xa584('0x10')](0x1f4,_0x26c517[_0xa584('0x12')]));});});};exports[_0xa584('0x29')]=function(_0x22c888){var _0x35f40f=this;return new Promise(function(_0x55e9b2,_0x341699){return db[_0xa584('0x15')][_0xa584('0x1a')]({'raw':_0x22c888[_0xa584('0x17')]?_0x22c888['options'][_0xa584('0x18')]===undefined?!![]:![]:!![],'where':_0x22c888[_0xa584('0x17')]?_0x22c888[_0xa584('0x17')][_0xa584('0x2a')]||null:null,'attributes':[[_0xa584('0x2b'),_0xa584('0x2c')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x2d')))),'outboundNoSuchCallsDay'],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db['sequelize']['literal'](_0xa584('0x2e')))),_0xa584('0x2f')],[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xa584('0x30')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x32')))),'outboundCongestionCallsDay'],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x33')))),_0xa584('0x34')],[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')]['fn']('IF',db['sequelize'][_0xa584('0x20')](_0xa584('0x35')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x36')))),_0xa584('0x37')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')]['literal'](_0xa584('0x38')))),_0xa584('0x39')],[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x3a')))),_0xa584('0x3b')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db['sequelize']['fn']('IF',db[_0xa584('0x1b')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0xa584('0x3c')],[db[_0xa584('0x1b')]['fn']('COUNT',db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x3d')))),_0xa584('0x3e')],[db['sequelize']['fn'](_0xa584('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa584('0x3f')))),_0xa584('0x3c')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x40')))),_0xa584('0x41')]],'group':['campaign']})[_0xa584('0x9')](function(_0x2e03fa){logger[_0xa584('0xa')](_0xa584('0x29'),_0x22c888);logger['debug']('GetVoiceQueueHopperHistory',_0x22c888,JSON['stringify'](_0x2e03fa));_0x55e9b2(_0x2e03fa);})[_0xa584('0x13')](function(_0x2c277e){logger['error']('GetVoiceQueueHopperHistory',_0x2c277e[_0xa584('0x12')],_0x22c888);_0x341699(_0x35f40f['error'](0x1f4,_0x2c277e[_0xa584('0x12')]));});});};exports[_0xa584('0x42')]=function(_0xeec0f4){var _0x29da5c=this;return new Promise(function(_0x26028a,_0x32227c){return db[_0xa584('0x15')]['findAll']({'raw':_0xeec0f4[_0xa584('0x17')]?_0xeec0f4['options'][_0xa584('0x18')]===undefined?!![]:![]:!![],'where':_0xeec0f4[_0xa584('0x17')]?_0xeec0f4[_0xa584('0x17')]['where']||null:null,'attributes':[[_0xa584('0x2b'),_0xa584('0x2c')],[db['sequelize']['fn']('COUNT',db[_0xa584('0x1b')]['col']('id')),_0xa584('0x43')],[db[_0xa584('0x1b')]['fn'](_0xa584('0x1f'),db[_0xa584('0x1b')]['fn']('IF',db[_0xa584('0x1b')][_0xa584('0x20')](_0xa584('0x1e')))),_0xa584('0x44')]],'group':[_0xa584('0x2b')]})[_0xa584('0x9')](function(_0x5eb5f2){logger[_0xa584('0xa')]('GetCampaignHopperHistory',_0xeec0f4);logger['debug'](_0xa584('0x42'),_0xeec0f4,JSON['stringify'](_0x5eb5f2));_0x26028a(_0x5eb5f2);})[_0xa584('0x13')](function(_0xccec56){logger[_0xa584('0x10')](_0xa584('0x42'),_0xccec56[_0xa584('0x12')],_0xeec0f4);_0x32227c(_0x29da5c[_0xa584('0x10')](0x1f4,_0xccec56[_0xa584('0x12')]));});});}; \ No newline at end of file +var _0xa739=['body','options','then','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','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','campaign','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','CreateCmHopperHistory','CmHopperHistory','create'];(function(_0xe5fd3d,_0x5d70e6){var _0x248abe=function(_0x54924f){while(--_0x54924f){_0xe5fd3d['push'](_0xe5fd3d['shift']());}};_0x248abe(++_0x5d70e6);}(_0xa739,0x1e1));var _0x9a73=function(_0x267a82,_0x19c241){_0x267a82=_0x267a82-0x0;var _0x3246e5=_0xa739[_0x267a82];return _0x3246e5;};'use strict';var _=require('lodash');var util=require(_0x9a73('0x0'));var moment=require('moment');var BPromise=require(_0x9a73('0x1'));var rs=require(_0x9a73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a73('0x3'))['db'];var utils=require(_0x9a73('0x4'));var logger=require(_0x9a73('0x5'))('rpc');var config=require(_0x9a73('0x6'));var jayson=require(_0x9a73('0x7'));var client=jayson[_0x9a73('0x8')][_0x9a73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e4c86,_0xd14d4d,_0x3a6506){return new BPromise(function(_0x125177,_0x57f453){return client[_0x9a73('0xa')](_0x3e4c86,_0x3a6506)['then'](function(_0x1078ab){logger[_0x9a73('0xb')](_0x9a73('0xc'),_0xd14d4d,'request\x20sent');logger[_0x9a73('0xd')](_0x9a73('0xe'),_0xd14d4d,'request\x20sent',JSON[_0x9a73('0xf')](_0x1078ab));if(_0x1078ab[_0x9a73('0x10')]){if(_0x1078ab[_0x9a73('0x10')]['code']===0x1f4){logger[_0x9a73('0x10')](_0x9a73('0xc'),_0xd14d4d,_0x1078ab[_0x9a73('0x10')]['message']);return _0x57f453(_0x1078ab[_0x9a73('0x10')][_0x9a73('0x11')]);}logger['error'](_0x9a73('0xc'),_0xd14d4d,_0x1078ab[_0x9a73('0x10')]['message']);return _0x125177(_0x1078ab[_0x9a73('0x10')]['message']);}else{logger[_0x9a73('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0xd14d4d,_0x9a73('0x12'));_0x125177(_0x1078ab['result'][_0x9a73('0x11')]);}})[_0x9a73('0x13')](function(_0x351a67){logger[_0x9a73('0x10')](_0x9a73('0xc'),_0xd14d4d,_0x351a67);_0x57f453(_0x351a67);});});}exports[_0x9a73('0x14')]=function(_0x2e4703){var _0x50c928=this;return new Promise(function(_0x129f3d,_0x5d6d31){return db[_0x9a73('0x15')][_0x9a73('0x16')](_0x2e4703[_0x9a73('0x17')],{'raw':_0x2e4703[_0x9a73('0x18')]?_0x2e4703[_0x9a73('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9a73('0x19')](function(_0x5f00a9){logger[_0x9a73('0xb')](_0x9a73('0x14'),_0x2e4703);logger[_0x9a73('0xd')](_0x9a73('0x14'),_0x2e4703,JSON[_0x9a73('0xf')](_0x5f00a9));_0x129f3d(_0x5f00a9);})[_0x9a73('0x13')](function(_0x385cea){logger[_0x9a73('0x10')](_0x9a73('0x14'),_0x385cea[_0x9a73('0x11')],_0x2e4703);_0x5d6d31(_0x50c928['error'](0x1f4,_0x385cea[_0x9a73('0x11')]));});});};exports[_0x9a73('0x1a')]=function(_0xa65ae9){var _0x18aef7=this;return new Promise(function(_0x43a305,_0x42b4a7){return db[_0x9a73('0x15')][_0x9a73('0x1b')]({'raw':_0xa65ae9[_0x9a73('0x18')]?_0xa65ae9[_0x9a73('0x18')][_0x9a73('0x1c')]===undefined?!![]:![]:!![],'where':_0xa65ae9[_0x9a73('0x18')]?_0xa65ae9[_0x9a73('0x18')][_0x9a73('0x1d')]||null:null,'attributes':[[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')][_0x9a73('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')](_0x9a73('0x22')))),_0x9a73('0x23')],[db[_0x9a73('0x1e')]['fn']('COUNT',db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')](_0x9a73('0x24')))),_0x9a73('0x25')],[db[_0x9a73('0x1e')]['fn']('AVG',db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x9a73('0x26')],[db['sequelize']['fn'](_0x9a73('0x27'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x28')))),_0x9a73('0x29')]]})[_0x9a73('0x19')](function(_0x536e00){logger[_0x9a73('0xb')]('AvgHandleTime',_0xa65ae9);logger[_0x9a73('0xd')]('AvgHandleTime',_0xa65ae9,JSON[_0x9a73('0xf')](_0x536e00));_0x43a305(_0x536e00);})[_0x9a73('0x13')](function(_0x232216){logger[_0x9a73('0x10')](_0x9a73('0x1a'),_0x232216[_0x9a73('0x11')],_0xa65ae9);_0x42b4a7(_0x18aef7[_0x9a73('0x10')](0x1f4,_0x232216[_0x9a73('0x11')]));});});};exports[_0x9a73('0x2a')]=function(_0x6f74d8){var _0x11242a=this;return new Promise(function(_0x4f732e,_0xf9f180){return db[_0x9a73('0x15')][_0x9a73('0x1b')]({'raw':_0x6f74d8[_0x9a73('0x18')]?_0x6f74d8['options']['raw']===undefined?!![]:![]:!![],'where':_0x6f74d8[_0x9a73('0x18')]?_0x6f74d8['options'][_0x9a73('0x1d')]||null:null,'attributes':[['campaign',_0x9a73('0x2b')],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db['sequelize']['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x2c')))),_0x9a73('0x2d')],[db['sequelize']['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db['sequelize']['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x22')))),_0x9a73('0x2e')],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')]('`state`\x20=\x205,\x201,\x20null'))),_0x9a73('0x2f')],[db[_0x9a73('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9a73('0x1e')]['literal'](_0x9a73('0x30')))),'outboundCongestionCallsDay'],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x9a73('0x31')],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')]['literal'](_0x9a73('0x32')))),'outboundUnknownCallsDay'],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')]['literal'](_0x9a73('0x33')))),_0x9a73('0x34')],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0x9a73('0x35')],[db[_0x9a73('0x1e')]['fn'](_0x9a73('0x1f'),db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x36')))),_0x9a73('0x37')],[db[_0x9a73('0x1e')]['fn']('COUNT',db[_0x9a73('0x1e')]['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x38')))),_0x9a73('0x39')],[db[_0x9a73('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9a73('0x1e')][_0x9a73('0x21')](_0x9a73('0x3a')))),_0x9a73('0x37')],[db['sequelize']['fn']('COUNT',db[_0x9a73('0x1e')]['fn']('IF',db['sequelize'][_0x9a73('0x21')](_0x9a73('0x3b')))),'outboundReCallsDay']],'group':[_0x9a73('0x3c')]})[_0x9a73('0x19')](function(_0x3cff91){logger[_0x9a73('0xb')](_0x9a73('0x2a'),_0x6f74d8);logger[_0x9a73('0xd')](_0x9a73('0x2a'),_0x6f74d8,JSON[_0x9a73('0xf')](_0x3cff91));_0x4f732e(_0x3cff91);})[_0x9a73('0x13')](function(_0x1924d0){logger[_0x9a73('0x10')](_0x9a73('0x2a'),_0x1924d0[_0x9a73('0x11')],_0x6f74d8);_0xf9f180(_0x11242a[_0x9a73('0x10')](0x1f4,_0x1924d0[_0x9a73('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x24c068){var _0x37506e=this;return new Promise(function(_0x28ab81,_0x15c317){return db['CmHopperHistory'][_0x9a73('0x1b')]({'raw':_0x24c068[_0x9a73('0x18')]?_0x24c068[_0x9a73('0x18')][_0x9a73('0x1c')]===undefined?!![]:![]:!![],'where':_0x24c068[_0x9a73('0x18')]?_0x24c068[_0x9a73('0x18')][_0x9a73('0x1d')]||null:null,'attributes':[[_0x9a73('0x3c'),_0x9a73('0x2b')],[db['sequelize']['fn'](_0x9a73('0x1f'),db['sequelize'][_0x9a73('0x20')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x9a73('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x9a73('0x21')](_0x9a73('0x22')))),_0x9a73('0x3d')]],'group':['campaign']})[_0x9a73('0x19')](function(_0x11378e){logger[_0x9a73('0xb')](_0x9a73('0x3e'),_0x24c068);logger[_0x9a73('0xd')](_0x9a73('0x3e'),_0x24c068,JSON[_0x9a73('0xf')](_0x11378e));_0x28ab81(_0x11378e);})[_0x9a73('0x13')](function(_0x9c1a87){logger[_0x9a73('0x10')](_0x9a73('0x3e'),_0x9c1a87[_0x9a73('0x11')],_0x24c068);_0x15c317(_0x37506e[_0x9a73('0x10')](0x1f4,_0x9c1a87[_0x9a73('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 623056e..bc4d82c 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 _0x9fe6=['./cmHopperHistory.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x501eb5,_0x12f4a4){var _0x3bad81=function(_0x5b7c21){while(--_0x5b7c21){_0x501eb5['push'](_0x501eb5['shift']());}};_0x3bad81(++_0x12f4a4);}(_0x9fe6,0x13d));var _0x69fe=function(_0x431271,_0xc1d26c){_0x431271=_0x431271-0x0;var _0x3fa6e9=_0x9fe6[_0x431271];return _0x3fa6e9;};'use strict';var multer=require('multer');var util=require(_0x69fe('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x69fe('0x1'));var router=express[_0x69fe('0x2')]();var fs_extra=require(_0x69fe('0x3'));var auth=require(_0x69fe('0x4'));var interaction=require(_0x69fe('0x5'));var config=require(_0x69fe('0x6'));var controller=require(_0x69fe('0x7'));router['get']('/',auth[_0x69fe('0x8')](),controller[_0x69fe('0x9')]);router[_0x69fe('0xa')]('/describe',auth[_0x69fe('0x8')](),controller[_0x69fe('0xb')]);router[_0x69fe('0xa')](_0x69fe('0xc'),auth['isAuthenticated'](),controller[_0x69fe('0xd')]);router[_0x69fe('0xe')]('/',auth[_0x69fe('0x8')](),controller[_0x69fe('0xf')]);router[_0x69fe('0x10')](_0x69fe('0xc'),auth[_0x69fe('0x8')](),controller['update']);module[_0x69fe('0x11')]=router; \ No newline at end of file +var _0xd7c1=['/:id','update','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','show','post'];(function(_0x511d3a,_0x184267){var _0x469385=function(_0x2d4352){while(--_0x2d4352){_0x511d3a['push'](_0x511d3a['shift']());}};_0x469385(++_0x184267);}(_0xd7c1,0x1ab));var _0x1d7c=function(_0x552c4a,_0x13689d){_0x552c4a=_0x552c4a-0x0;var _0x1f444d=_0xd7c1[_0x552c4a];return _0x1f444d;};'use strict';var multer=require(_0x1d7c('0x0'));var util=require('util');var path=require(_0x1d7c('0x1'));var timeout=require(_0x1d7c('0x2'));var express=require(_0x1d7c('0x3'));var router=express['Router']();var fs_extra=require(_0x1d7c('0x4'));var auth=require(_0x1d7c('0x5'));var interaction=require(_0x1d7c('0x6'));var config=require(_0x1d7c('0x7'));var controller=require(_0x1d7c('0x8'));router[_0x1d7c('0x9')]('/',auth[_0x1d7c('0xa')](),controller['index']);router['get'](_0x1d7c('0xb'),auth[_0x1d7c('0xa')](),controller[_0x1d7c('0xc')]);router['get']('/:id',auth[_0x1d7c('0xa')](),controller[_0x1d7c('0xd')]);router[_0x1d7c('0xe')]('/',auth[_0x1d7c('0xa')](),controller['create']);router['put'](_0x1d7c('0xf'),auth[_0x1d7c('0xa')](),controller[_0x1d7c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 1cbd968..558d7e6 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 _0x4677=['STRING','name','sequelize'];(function(_0x51e37b,_0x4fc3a3){var _0x4e5c82=function(_0xd30480){while(--_0xd30480){_0x51e37b['push'](_0x51e37b['shift']());}};_0x4e5c82(++_0x4fc3a3);}(_0x4677,0x155));var _0x7467=function(_0xacf587,_0x3aa8fa){_0xacf587=_0xacf587-0x0;var _0x55cfbb=_0x4677[_0xacf587];return _0x55cfbb;};'use strict';var Sequelize=require(_0x7467('0x0'));module['exports']={'name':{'type':Sequelize[_0x7467('0x1')],'unique':_0x7467('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7467('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x87d3=['STRING','name','sequelize','exports'];(function(_0x3ad56a,_0x2a8d59){var _0x407683=function(_0x37d951){while(--_0x37d951){_0x3ad56a['push'](_0x3ad56a['shift']());}};_0x407683(++_0x2a8d59);}(_0x87d3,0x86));var _0x387d=function(_0x16e5b3,_0x30d91d){_0x16e5b3=_0x16e5b3-0x0;var _0x4d6874=_0x87d3[_0x16e5b3];return _0x4d6874;};'use strict';var Sequelize=require(_0x387d('0x0'));module[_0x387d('0x1')]={'name':{'type':Sequelize[_0x387d('0x2')],'unique':_0x387d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x387d('0x2')]},'dialPrefix':{'type':Sequelize[_0x387d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index f22c3d1..4593d2f 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 _0x89f1=['isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','addCustomField','transaction','CmCustomField','addCustomFields','text','Sequelize','TEXT','number','BOOLEAN','addColumn','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','sequelize','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','CmList','includeAll','include','findAll','catch','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','UserProfileSection','find','autoAssociation','error','describe','addDisposition','ListId','getDispositions','findOne','Disposition','rows','removeDispositions','addContacts','CmContact','tags','isArray','join','each','omit','ids','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString'];(function(_0x2f5b3c,_0x470e3b){var _0x14dd01=function(_0x5e061f){while(--_0x5e061f){_0x2f5b3c['push'](_0x2f5b3c['shift']());}};_0x14dd01(++_0x470e3b);}(_0x89f1,0xbd));var _0x189f=function(_0x172029,_0x1dcd88){_0x172029=_0x172029-0x0;var _0x1e53f2=_0x89f1[_0x172029];return _0x1e53f2;};'use strict';var emlformat=require(_0x189f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x189f('0x1'));var jsonpatch=require(_0x189f('0x2'));var rp=require(_0x189f('0x3'));var moment=require('moment');var BPromise=require(_0x189f('0x4'));var Mustache=require(_0x189f('0x5'));var util=require(_0x189f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x189f('0x7'));var _=require(_0x189f('0x8'));var squel=require(_0x189f('0x9'));var crypto=require(_0x189f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x189f('0xb'));var toCsv=require(_0x189f('0xc'));var querystring=require(_0x189f('0xd'));var Papa=require('papaparse');var Redis=require(_0x189f('0xe'));var authService=require(_0x189f('0xf'));var qs=require(_0x189f('0x10'));var as=require(_0x189f('0x11'));var hardwareService=require(_0x189f('0x12'));var logger=require(_0x189f('0x13'))(_0x189f('0x14'));var utils=require(_0x189f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x189f('0x16'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x189f('0x17')]=_['defaults'](config[_0x189f('0x17')],{'host':_0x189f('0x18'),'port':0x18eb});var socket=require(_0x189f('0x19'))(new Redis(config['redis']));require(_0x189f('0x1a'))[_0x189f('0x1b')](socket);function respondWithStatusCode(_0x323d2d,_0x5a2565){_0x5a2565=_0x5a2565||0xcc;return function(_0x214d64){if(_0x214d64){return _0x323d2d['sendStatus'](_0x5a2565);}return _0x323d2d[_0x189f('0x1c')](_0x5a2565)[_0x189f('0x1d')]();};}function respondWithResult(_0x30f7a1,_0x848e2e){_0x848e2e=_0x848e2e||0xc8;return function(_0x3fbe48){if(_0x3fbe48){return _0x30f7a1[_0x189f('0x1c')](_0x848e2e)[_0x189f('0x1e')](_0x3fbe48);}};}function respondWithFilteredResult(_0x4f58e3,_0x406bed){return function(_0x5bff70){if(_0x5bff70){var _0x2ab57d=typeof _0x406bed[_0x189f('0x1f')]==='undefined'&&typeof _0x406bed[_0x189f('0x20')]===_0x189f('0x21');var _0x57b364=_0x5bff70[_0x189f('0x22')];var _0x1d8b16=_0x2ab57d?0x0:_0x406bed['offset'];var _0xee9e0b=_0x2ab57d?_0x5bff70['count']:_0x406bed['offset']+_0x406bed[_0x189f('0x20')];var _0x218797;if(_0xee9e0b>=_0x57b364){_0xee9e0b=_0x57b364;_0x218797=0xc8;}else{_0x218797=0xce;}_0x4f58e3[_0x189f('0x1c')](_0x218797);return _0x4f58e3[_0x189f('0x23')](_0x189f('0x24'),_0x1d8b16+'-'+_0xee9e0b+'/'+_0x57b364)[_0x189f('0x1e')](_0x5bff70);}return null;};}function patchUpdates(_0x2e27ec){return function(_0x38970c){try{jsonpatch[_0x189f('0x25')](_0x38970c,_0x2e27ec,!![]);}catch(_0x315ae3){return BPromise[_0x189f('0x26')](_0x315ae3);}return _0x38970c[_0x189f('0x27')]();};}function saveUpdates(_0x9b781,_0x1e40b7){return function(_0x41e816){if(_0x41e816){return _0x41e816[_0x189f('0x28')](_0x9b781)[_0x189f('0x29')](function(_0x5bfb15){return _0x5bfb15;});}return null;};}function removeEntity(_0x13363e,_0x2c93b8){return function(_0x84bf3f){if(_0x84bf3f){return _0x84bf3f[_0x189f('0x2a')]()['then'](function(){var _0x1ad43b=_0x84bf3f[_0x189f('0x2b')]({'plain':!![]});var _0x41af09='Lists';return db['UserProfileResource'][_0x189f('0x2a')]({'where':{'type':_0x41af09,'resourceId':_0x1ad43b['id']}})[_0x189f('0x29')](function(){return _0x84bf3f;});})[_0x189f('0x29')](function(){_0x13363e[_0x189f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26dac1,_0x13b42a){return function(_0x171598){if(!_0x171598){_0x26dac1[_0x189f('0x2c')](0x194);}return _0x171598;};}function handleError(_0x7014bf,_0x19316b){_0x19316b=_0x19316b||0x1f4;return function(_0x2c6bde){logger['error'](_0x2c6bde['stack']);if(_0x2c6bde[_0x189f('0x2d')]){delete _0x2c6bde['name'];}_0x7014bf['status'](_0x19316b)['send'](_0x2c6bde);};}exports[_0x189f('0x2e')]=function(_0x34f9ef,_0x4efc05){var _0x12efc6={},_0x56c39a={},_0x17f310={'count':0x0,'rows':[]};var _0x52613a=_[_0x189f('0x2f')](db['CmList'][_0x189f('0x30')],function(_0xfcf461){return{'name':_0xfcf461[_0x189f('0x31')],'type':_0xfcf461[_0x189f('0x32')]['key']};});_0x56c39a[_0x189f('0x33')]=_[_0x189f('0x2f')](_0x52613a,_0x189f('0x2d'));_0x56c39a[_0x189f('0x34')]=_['keys'](_0x34f9ef[_0x189f('0x34')]);_0x56c39a[_0x189f('0x35')]=_[_0x189f('0x36')](_0x56c39a['model'],_0x56c39a[_0x189f('0x34')]);_0x12efc6[_0x189f('0x37')]=_[_0x189f('0x36')](_0x56c39a[_0x189f('0x33')],qs[_0x189f('0x38')](_0x34f9ef[_0x189f('0x34')][_0x189f('0x38')]));_0x12efc6[_0x189f('0x37')]=_0x12efc6[_0x189f('0x37')][_0x189f('0x39')]?_0x12efc6[_0x189f('0x37')]:_0x56c39a[_0x189f('0x33')];if(!_0x34f9ef[_0x189f('0x34')][_0x189f('0x3a')](_0x189f('0x3b'))){_0x12efc6[_0x189f('0x20')]=qs[_0x189f('0x20')](_0x34f9ef[_0x189f('0x34')]['limit']);_0x12efc6['offset']=qs['offset'](_0x34f9ef[_0x189f('0x34')][_0x189f('0x1f')]);}_0x12efc6[_0x189f('0x3c')]=qs[_0x189f('0x3d')](_0x34f9ef[_0x189f('0x34')][_0x189f('0x3d')]);_0x12efc6[_0x189f('0x3e')]=qs[_0x189f('0x35')](_[_0x189f('0x3f')](_0x34f9ef[_0x189f('0x34')],_0x56c39a['filters']),_0x52613a);if(_0x34f9ef['query']['filter']){_0x12efc6[_0x189f('0x3e')]=_['merge'](_0x12efc6[_0x189f('0x3e')],{'$or':_[_0x189f('0x2f')](_0x52613a,function(_0x13665e){if(_0x13665e[_0x189f('0x32')]!==_0x189f('0x40')){var _0x424024={};_0x424024[_0x13665e[_0x189f('0x2d')]]={'$like':'%'+_0x34f9ef[_0x189f('0x34')][_0x189f('0x41')]+'%'};return _0x424024;}})});}_0x12efc6=_[_0x189f('0x42')]({},_0x12efc6,_0x34f9ef[_0x189f('0x43')]);var _0x3cfa7c={'where':_0x12efc6['where']};return db[_0x189f('0x44')][_0x189f('0x22')](_0x3cfa7c)[_0x189f('0x29')](function(_0x4e7094){_0x17f310['count']=_0x4e7094;if(_0x34f9ef[_0x189f('0x34')][_0x189f('0x45')]){_0x12efc6[_0x189f('0x46')]=[{'all':!![]}];}return db[_0x189f('0x44')][_0x189f('0x47')](_0x12efc6);})[_0x189f('0x29')](function(_0x694c7a){_0x17f310['rows']=_0x694c7a;return _0x17f310;})[_0x189f('0x29')](respondWithFilteredResult(_0x4efc05,_0x12efc6))[_0x189f('0x48')](handleError(_0x4efc05,null));};exports['show']=function(_0x59d518,_0x4cc294){var _0x1d3a0b={'raw':![],'where':{'id':_0x59d518[_0x189f('0x49')]['id']}},_0x5e49aa={};_0x5e49aa[_0x189f('0x33')]=_[_0x189f('0x4a')](db['CmList'][_0x189f('0x30')]);_0x5e49aa['query']=_[_0x189f('0x4a')](_0x59d518[_0x189f('0x34')]);_0x5e49aa[_0x189f('0x35')]=_[_0x189f('0x36')](_0x5e49aa[_0x189f('0x33')],_0x5e49aa[_0x189f('0x34')]);_0x1d3a0b['attributes']=_['intersection'](_0x5e49aa[_0x189f('0x33')],qs[_0x189f('0x38')](_0x59d518[_0x189f('0x34')][_0x189f('0x38')]));_0x1d3a0b['attributes']=_0x1d3a0b[_0x189f('0x37')][_0x189f('0x39')]?_0x1d3a0b[_0x189f('0x37')]:_0x5e49aa[_0x189f('0x33')];if(_0x59d518[_0x189f('0x34')][_0x189f('0x45')]){_0x1d3a0b['include']=[{'all':!![]}];}_0x1d3a0b=_[_0x189f('0x42')]({},_0x1d3a0b,_0x59d518[_0x189f('0x43')]);return db[_0x189f('0x44')]['find'](_0x1d3a0b)[_0x189f('0x29')](handleEntityNotFound(_0x4cc294,null))[_0x189f('0x29')](respondWithResult(_0x4cc294,null))[_0x189f('0x48')](handleError(_0x4cc294,null));};exports[_0x189f('0x4b')]=function(_0x1c41c5,_0x1cb557){return db['CmList']['create'](_0x1c41c5[_0x189f('0x4c')],{})['then'](function(_0x5ce6e7){var _0x4deff1=_0x1c41c5[_0x189f('0x4d')][_0x189f('0x2b')]({'plain':!![]});if(!_0x4deff1)throw new Error(_0x189f('0x4e'));if(_0x4deff1['role']===_0x189f('0x4d')){var _0x156b83=_0x5ce6e7[_0x189f('0x2b')]({'plain':!![]});var _0x309c7b=_0x189f('0x4f');return db[_0x189f('0x50')][_0x189f('0x51')]({'where':{'name':_0x309c7b,'userProfileId':_0x4deff1['userProfileId']},'raw':!![]})['then'](function(_0x57946){if(_0x57946&&_0x57946[_0x189f('0x52')]===0x0){return db['UserProfileResource'][_0x189f('0x4b')]({'name':_0x156b83[_0x189f('0x2d')],'resourceId':_0x156b83['id'],'type':_0x57946['name'],'sectionId':_0x57946['id']},{})[_0x189f('0x29')](function(){return _0x5ce6e7;});}else{return _0x5ce6e7;}})[_0x189f('0x48')](function(_0x2c6476){logger[_0x189f('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c6476);throw _0x2c6476;});}return _0x5ce6e7;})[_0x189f('0x29')](respondWithResult(_0x1cb557,0xc9))[_0x189f('0x48')](handleError(_0x1cb557,null));};exports[_0x189f('0x28')]=function(_0xdd91b,_0x588a25){if(_0xdd91b[_0x189f('0x4c')]['id']){delete _0xdd91b[_0x189f('0x4c')]['id'];}return db['CmList'][_0x189f('0x51')]({'where':{'id':_0xdd91b[_0x189f('0x49')]['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x588a25,null))[_0x189f('0x29')](saveUpdates(_0xdd91b[_0x189f('0x4c')],null))[_0x189f('0x29')](respondWithResult(_0x588a25,null))[_0x189f('0x48')](handleError(_0x588a25,null));};exports['destroy']=function(_0x276f9e,_0x32acf8){return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0x276f9e['params']['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x32acf8,null))[_0x189f('0x29')](removeEntity(_0x32acf8,null))[_0x189f('0x48')](handleError(_0x32acf8,null));};exports[_0x189f('0x54')]=function(_0x105732,_0x135e99){return db['CmList'][_0x189f('0x54')]()[_0x189f('0x29')](respondWithResult(_0x135e99,null))[_0x189f('0x48')](handleError(_0x135e99,null));};exports[_0x189f('0x55')]=function(_0xd613e7,_0x54fdc6,_0x1341e1){if(_0xd613e7['body']['id']){delete _0xd613e7[_0x189f('0x4c')]['id'];}return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0xd613e7['params']['id']}})['then'](handleEntityNotFound(_0x54fdc6,null))['then'](function(_0x33499c){if(_0x33499c){_0xd613e7[_0x189f('0x4c')][_0x189f('0x56')]=_0x33499c['id'];return db['Disposition']['create'](_0xd613e7['body']);}})[_0x189f('0x29')](respondWithResult(_0x54fdc6,null))[_0x189f('0x48')](handleError(_0x54fdc6,null));};exports[_0x189f('0x57')]=function(_0x46496f,_0x15585f,_0x51b7f9){var _0xdbaea6={'raw':![],'where':{}};var _0x536c95={};var _0x459089={'count':0x0,'rows':[]};return db['CmList'][_0x189f('0x58')]({'where':{'id':_0x46496f['params']['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x15585f,null))['then'](function(_0x1fa8d6){if(_0x1fa8d6){_0x536c95[_0x189f('0x33')]=_[_0x189f('0x4a')](db['Disposition']['rawAttributes']);_0x536c95[_0x189f('0x34')]=_['keys'](_0x46496f[_0x189f('0x34')]);_0x536c95[_0x189f('0x35')]=_['intersection'](_0x536c95[_0x189f('0x33')],_0x536c95[_0x189f('0x34')]);_0xdbaea6[_0x189f('0x37')]=_['intersection'](_0x536c95['model'],qs[_0x189f('0x38')](_0x46496f[_0x189f('0x34')][_0x189f('0x38')]));_0xdbaea6['attributes']=_0xdbaea6[_0x189f('0x37')]['length']?_0xdbaea6[_0x189f('0x37')]:_0x536c95['model'];if(!_0x46496f[_0x189f('0x34')][_0x189f('0x3a')](_0x189f('0x3b'))){_0xdbaea6[_0x189f('0x20')]=qs[_0x189f('0x20')](_0x46496f[_0x189f('0x34')][_0x189f('0x20')]);_0xdbaea6[_0x189f('0x1f')]=qs['offset'](_0x46496f[_0x189f('0x34')][_0x189f('0x1f')]);}_0xdbaea6[_0x189f('0x3c')]=qs[_0x189f('0x3d')](_0x46496f[_0x189f('0x34')][_0x189f('0x3d')]);_0xdbaea6['where']=qs[_0x189f('0x35')](_['pick'](_0x46496f[_0x189f('0x34')],_0x536c95[_0x189f('0x35')]));_0xdbaea6[_0x189f('0x3e')][_0x189f('0x56')]=_0x1fa8d6['id'];if(_0x46496f[_0x189f('0x34')][_0x189f('0x41')]){_0xdbaea6['where']=_['merge'](_0xdbaea6['where'],{'$or':_[_0x189f('0x2f')](_0xdbaea6[_0x189f('0x37')],function(_0x4b8ccf){var _0x12f381={};_0x12f381[_0x4b8ccf]={'$like':'%'+_0x46496f[_0x189f('0x34')][_0x189f('0x41')]+'%'};return _0x12f381;})});}_0xdbaea6=_[_0x189f('0x42')]({},_0xdbaea6,_0x46496f[_0x189f('0x43')]);return db[_0x189f('0x59')][_0x189f('0x22')]({'where':_0xdbaea6['where']})[_0x189f('0x29')](function(_0x532575){_0x459089[_0x189f('0x22')]=_0x532575;if(_0x46496f[_0x189f('0x34')][_0x189f('0x45')]){_0xdbaea6[_0x189f('0x46')]=[{'all':!![]}];}return db[_0x189f('0x59')]['findAll'](_0xdbaea6);})[_0x189f('0x29')](function(_0x2556fb){_0x459089[_0x189f('0x5a')]=_0x2556fb;return _0x459089;});}})['then'](respondWithFilteredResult(_0x15585f,_0xdbaea6))[_0x189f('0x48')](handleError(_0x15585f,null));};exports[_0x189f('0x5b')]=function(_0x116771,_0x366a13,_0x29cef7){return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0x116771[_0x189f('0x49')]['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x366a13,null))[_0x189f('0x29')](function(_0x47d579){if(_0x47d579){return _0x47d579[_0x189f('0x5b')](_0x116771[_0x189f('0x34')]['ids']);}})[_0x189f('0x29')](respondWithStatusCode(_0x366a13,null))[_0x189f('0x48')](handleError(_0x366a13,null));};exports[_0x189f('0x5c')]=function(_0x45e804,_0x525bab,_0x33751f){return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0x45e804[_0x189f('0x49')]['id']}})['then'](handleEntityNotFound(_0x525bab,null))['then'](function(_0x2640ae){if(_0x2640ae){var _0x23d712=[];var _0x3f773e={'success':[],'errors':[]};return db[_0x189f('0x5d')][_0x189f('0x54')]()[_0x189f('0x29')](function(_0x16cc1c){if(_0x45e804['body'][_0x189f('0x5e')]&&_[_0x189f('0x5f')](_0x45e804[_0x189f('0x4c')]['tags'])){if(_0x45e804[_0x189f('0x4c')]['tags'][_0x189f('0x39')]){_0x45e804['body']['tags']=_0x45e804[_0x189f('0x4c')][_0x189f('0x5e')][_0x189f('0x60')](';')+';';}else{_0x45e804[_0x189f('0x4c')][_0x189f('0x5e')]=null;}}else{_0x45e804[_0x189f('0x4c')][_0x189f('0x5e')]=null;}if(_0x45e804[_0x189f('0x4c')]&&_['isArray'](_0x45e804[_0x189f('0x4c')])){for(var _0x2ae405=0x0;_0x2ae405<_0x45e804[_0x189f('0x4c')][_0x189f('0x39')];_0x2ae405+=0x1){_0x45e804[_0x189f('0x4c')][_0x2ae405]['ListId']=_0x45e804[_0x189f('0x49')]['id'];_0x23d712['push'](_0x45e804['body'][_0x2ae405]);}return BPromise[_0x189f('0x61')](_0x23d712,function(_0x9a0a02){return db['CmContact']['create'](_[_0x189f('0x62')](_0x9a0a02,[_0x189f('0x63'),'id'])||{},{'fields':_['keys'](_0x16cc1c),'raw':!![]})[_0x189f('0x29')](function(_0x55de24){_0x3f773e[_0x189f('0x64')][_0x189f('0x65')](_0x55de24[_0x189f('0x66')]);})[_0x189f('0x48')](function(_0x32fab9){_0x3f773e[_0x189f('0x67')]['push']({'data':_0x9a0a02,'error':_0x32fab9[_0x189f('0x68')]});});})[_0x189f('0x29')](function(_0x4c2008){return _0x3f773e;})[_0x189f('0x48')](function(_0x4d0f5a){return _0x4d0f5a;});}else{_0x525bab[_0x189f('0x1c')](0x190)[_0x189f('0x1e')]({'message':_0x189f('0x69')});}});}})[_0x189f('0x29')](respondWithResult(_0x525bab,null))[_0x189f('0x48')](handleError(_0x525bab,null));};exports[_0x189f('0x6a')]=function(_0x11fe05,_0x52752a,_0x373bd1){var _0x34785b;return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0x11fe05['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x189f('0x6b')}]})['then'](handleEntityNotFound(_0x52752a,null))[_0x189f('0x29')](function(_0x2dc2d7){if(_0x2dc2d7){_0x34785b=_0x2dc2d7;return db[_0x189f('0x5d')][_0x189f('0x30')];}})[_0x189f('0x29')](function(_0x39922d){if(_0x39922d){var _0x4eebf4={};var _0x1c9f8b={};_0x1c9f8b['model']=_[_0x189f('0x6c')](_['keys'](_0x39922d),_[_0x189f('0x2f')](_0x34785b[_0x189f('0x6b')],function(_0x57cb0f){return util[_0x189f('0x6d')]('cf_%d',_0x57cb0f['id']);}));_0x1c9f8b[_0x189f('0x34')]=_['keys'](_0x11fe05[_0x189f('0x34')]);_0x1c9f8b[_0x189f('0x35')]=_['intersection'](_0x1c9f8b[_0x189f('0x33')],_0x1c9f8b[_0x189f('0x34')]);_0x4eebf4[_0x189f('0x37')]=_[_0x189f('0x36')](_0x1c9f8b[_0x189f('0x33')],qs[_0x189f('0x38')](_0x11fe05[_0x189f('0x34')][_0x189f('0x38')]));_0x4eebf4[_0x189f('0x37')]=_0x4eebf4[_0x189f('0x37')]['length']?_0x4eebf4[_0x189f('0x37')]:_0x1c9f8b['model'];if(!_0x11fe05[_0x189f('0x34')][_0x189f('0x3a')](_0x189f('0x3b'))){_0x4eebf4[_0x189f('0x20')]=qs[_0x189f('0x20')](_0x11fe05[_0x189f('0x34')][_0x189f('0x20')]);_0x4eebf4[_0x189f('0x1f')]=qs['offset'](_0x11fe05[_0x189f('0x34')]['offset']);}_0x4eebf4[_0x189f('0x3c')]=qs[_0x189f('0x3d')](_0x11fe05[_0x189f('0x34')][_0x189f('0x3d')]);_0x4eebf4[_0x189f('0x3e')]=qs['filters'](_[_0x189f('0x3f')](_0x11fe05[_0x189f('0x34')],_0x1c9f8b[_0x189f('0x35')]));_0x4eebf4[_0x189f('0x6e')]=!![];if(_0x11fe05[_0x189f('0x34')][_0x189f('0x41')]){_0x4eebf4[_0x189f('0x3e')]=_[_0x189f('0x42')](_0x4eebf4['where'],{'$or':_[_0x189f('0x2f')](_0x4eebf4['attributes'],function(_0x4b5beb){var _0x536f18={};_0x536f18[_0x4b5beb]={'$like':'%'+_0x11fe05[_0x189f('0x34')]['filter']+'%'};return _0x536f18;})});}_0x4eebf4=_[_0x189f('0x42')]({},_0x4eebf4,_0x11fe05[_0x189f('0x43')]);return _0x34785b['getContacts'](_0x4eebf4);}})['then'](respondWithResult(_0x52752a,null))[_0x189f('0x48')](handleError(_0x52752a,null));};exports[_0x189f('0x6f')]=function(_0x306e32,_0x555dbf,_0x294976){var _0x49da19;var _0x4f9efd;var _0x30c30b;var _0x22e316=_0x306e32[_0x189f('0x49')]['id'];csv_results=[];return db[_0x189f('0x70')][_0x189f('0x47')]({'attributes':['id',_0x189f('0x2d')],'raw':!![],'order':[_0x189f('0x71')]})[_0x189f('0x29')](function(_0x29071b){_0x49da19=_0x29071b;var _0x52e4ff=_[_0x189f('0x4a')](db[_0x189f('0x5d')][_0x189f('0x30')]);return db['CmCustomField'][_0x189f('0x47')]({'raw':!![],'attributes':['id',_0x189f('0x72')]})[_0x189f('0x29')](function(_0x2d06a5){_0x4f9efd=_0x2d06a5;var _0x3f5ee1=squel[_0x189f('0x73')]()[_0x189f('0x38')](_0x52e4ff)[_0x189f('0x74')](_0x189f('0x75'),'c')[_0x189f('0x3e')](_0x189f('0x76'),_0x22e316)[_0x189f('0x3e')](_0x189f('0x77'))[_0x189f('0x78')]();for(var _0x1d1b34=0x0;_0x1d1b34<_0x4f9efd[_0x189f('0x39')];_0x1d1b34++){_0x3f5ee1[_0x189f('0x79')](_0x189f('0x7a')+_0x4f9efd[_0x1d1b34]['id'],'customField_'+_0x4f9efd[_0x1d1b34]['alias']);}for(var _0x1d1b34=0x0;_0x1d1b34<_0x49da19['length'];_0x1d1b34++){_0x3f5ee1['field'](squel[_0x189f('0x73')]()[_0x189f('0x79')](_0x189f('0x7b'))['from'](_0x189f('0x7c'))[_0x189f('0x3e')](_0x189f('0x7d'),_0x49da19[_0x1d1b34]['id'])[_0x189f('0x3e')](_0x189f('0x7e')),_0x189f('0x7f')+_0x49da19[_0x1d1b34][_0x189f('0x2d')]);_0x3f5ee1['field'](squel[_0x189f('0x73')]()[_0x189f('0x79')](_0x189f('0x80'))[_0x189f('0x74')](_0x189f('0x7c'))[_0x189f('0x3e')](_0x189f('0x7d'),_0x49da19[_0x1d1b34]['id'])['where'](_0x189f('0x7e')),_0x189f('0x81')+_0x49da19[_0x1d1b34]['name']);}var _0x1a0a8a=[];_0x1a0a8a[_0x189f('0x65')](_0x3f5ee1[_0x189f('0x82')]());BPromise[_0x189f('0x61')](_0x1a0a8a,handleQuery)[_0x189f('0x29')](function(_0x80872b){handleQuery(_0x3f5ee1['toString']());var _0x1d053c=csv_results[0x0];if(!_[_0x189f('0x83')](_0x1d053c)){var _0x435ce4=toCsv(_0x1d053c);var _0x21d11c=Date[_0x189f('0x84')]();fs['writeFileSync'](util[_0x189f('0x6d')]('/tmp/list_%d_%s.csv',_0x22e316,_0x21d11c),_0x435ce4);_0x555dbf[_0x189f('0x85')](_0x189f('0x86'),_0x189f('0x87')+util[_0x189f('0x6d')](_0x189f('0x88'),_0x22e316,_0x21d11c));_0x555dbf['setHeader']('Content-type',_0x189f('0x89'));return _0x555dbf[_0x189f('0x8a')](util[_0x189f('0x6d')]('/tmp/list_%d_%s.csv',_0x22e316,_0x21d11c));}else{return _0x555dbf[_0x189f('0x2c')](0xcc);}});});});};exports[_0x189f('0x8b')]=function(_0x1b0902,_0x128394,_0x428efe){var _0x23d34e;delete _0x1b0902[_0x189f('0x4c')]['id'];return db[_0x189f('0x44')][_0x189f('0x58')]({'where':{'id':_0x1b0902['params']['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x128394,null))[_0x189f('0x29')](function(_0x15b215){if(_0x15b215){return db['sequelize'][_0x189f('0x8c')](function(_0x56590e){return db[_0x189f('0x8d')]['create'](_0x1b0902[_0x189f('0x4c')],{'transaction':_0x56590e})[_0x189f('0x29')](function(_0xde1eb5){_0x23d34e=_0xde1eb5;return _0x15b215[_0x189f('0x8e')](_0xde1eb5,{'transaction':_0x56590e});})[_0x189f('0x29')](function(){var _0x4987bb={'type':db['Sequelize']['TEXT'],'transaction':_0x56590e};switch(_0x1b0902[_0x189f('0x4c')][_0x189f('0x32')]){case _0x189f('0x8f'):_0x4987bb[_0x189f('0x32')]=db[_0x189f('0x90')][_0x189f('0x91')];break;case _0x189f('0x92'):_0x4987bb[_0x189f('0x32')]=db[_0x189f('0x90')]['INTEGER'];break;case'switch':_0x4987bb[_0x189f('0x32')]=db[_0x189f('0x90')][_0x189f('0x93')];_0x4987bb['defaultValue']=![];break;default:}return db['sequelize']['queryInterface'][_0x189f('0x94')](_0x189f('0x75'),util[_0x189f('0x6d')]('cf_%s',_0x23d34e['id']),_0x4987bb);})['then'](function(){return _0x23d34e;});});}})[_0x189f('0x29')](respondWithResult(_0x128394,null))[_0x189f('0x48')](handleError(_0x128394,null));};exports['getCustomFields']=function(_0x41aa0e,_0x35e879,_0x100378){var _0x502f1e={};var _0x592e88={};var _0x114452;var _0x102b35;return db[_0x189f('0x44')]['findOne']({'where':{'id':_0x41aa0e[_0x189f('0x49')]['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x35e879,null))[_0x189f('0x29')](function(_0x29f25a){if(_0x29f25a){_0x114452=_0x29f25a;_0x592e88[_0x189f('0x33')]=_[_0x189f('0x4a')](db[_0x189f('0x8d')][_0x189f('0x30')]);_0x592e88['query']=_[_0x189f('0x4a')](_0x41aa0e[_0x189f('0x34')]);_0x592e88['filters']=_[_0x189f('0x36')](_0x592e88['model'],_0x592e88[_0x189f('0x34')]);_0x502f1e[_0x189f('0x37')]=_[_0x189f('0x36')](_0x592e88[_0x189f('0x33')],qs[_0x189f('0x38')](_0x41aa0e[_0x189f('0x34')][_0x189f('0x38')]));_0x502f1e[_0x189f('0x37')]=_0x502f1e[_0x189f('0x37')]['length']?_0x502f1e[_0x189f('0x37')]:_0x592e88[_0x189f('0x33')];_0x502f1e[_0x189f('0x3c')]=qs[_0x189f('0x3d')](_0x41aa0e[_0x189f('0x34')][_0x189f('0x3d')]);_0x502f1e[_0x189f('0x3e')]=qs[_0x189f('0x35')](_[_0x189f('0x3f')](_0x41aa0e[_0x189f('0x34')],_0x592e88['filters']));_0x502f1e[_0x189f('0x3e')]=_[_0x189f('0x42')](_0x502f1e[_0x189f('0x3e')],{'$or':[{'ListId':_0x29f25a['id']},{'ListId':null}]});if(_0x41aa0e[_0x189f('0x34')][_0x189f('0x41')]){_0x502f1e[_0x189f('0x3e')]=_['merge'](_0x502f1e[_0x189f('0x3e')],{'$or':_['map'](_0x502f1e[_0x189f('0x37')],function(_0x5f00d4){var _0x5ad844={};_0x5ad844[_0x5f00d4]={'$like':'%'+_0x41aa0e['query'][_0x189f('0x41')]+'%'};return _0x5ad844;})});}_0x502f1e=_[_0x189f('0x42')]({},_0x502f1e,_0x41aa0e[_0x189f('0x43')]);return db['CmCustomField'][_0x189f('0x95')](_0x502f1e);}})[_0x189f('0x29')](respondWithResult(_0x35e879,null))[_0x189f('0x48')](handleError(_0x35e879,null));};exports[_0x189f('0x96')]=function(_0x590591,_0x361ea5){return db['CmCustomField'][_0x189f('0x95')]({'where':{'ListId':null}})[_0x189f('0x29')](handleEntityNotFound(_0x361ea5,null))[_0x189f('0x29')](function(_0x118331){return _0x118331;})[_0x189f('0x29')](respondWithResult(_0x361ea5,null))[_0x189f('0x48')](handleError(_0x361ea5,null));};exports[_0x189f('0x97')]=function(_0x69a876,_0x49805d,_0x254338){return db['CmList'][_0x189f('0x51')]({'where':{'id':_0x69a876[_0x189f('0x49')]['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x49805d,null))[_0x189f('0x29')](function(_0xe15478){if(_0xe15478){return _0xe15478[_0x189f('0x97')](_0x69a876['body'][_0x189f('0x63')],_[_0x189f('0x62')](_0x69a876[_0x189f('0x4c')],[_0x189f('0x63'),'id'])||{})[_0x189f('0x98')](function(_0x3ca169){for(var _0x5e9f6c=0x0;_0x5e9f6c<_0x69a876['body'][_0x189f('0x63')][_0x189f('0x39')];_0x5e9f6c+=0x1){socket['emit'](_0x189f('0x99'),{'UserId':Number(_0x69a876[_0x189f('0x4c')][_0x189f('0x63')][_0x5e9f6c]),'CmListId':Number(_0x69a876[_0x189f('0x49')]['id'])});}return _0x3ca169;});}})[_0x189f('0x29')](respondWithResult(_0x49805d,null))[_0x189f('0x48')](handleError(_0x49805d,null));};exports[_0x189f('0x9a')]=function(_0x4e84e1,_0x22662a,_0x3915b9){return db[_0x189f('0x44')][_0x189f('0x51')]({'where':{'id':_0x4e84e1[_0x189f('0x49')]['id']}})['then'](handleEntityNotFound(_0x22662a,null))[_0x189f('0x29')](function(_0x3ffc01){if(_0x3ffc01){return _0x3ffc01[_0x189f('0x9a')](_0x4e84e1['query'][_0x189f('0x63')])['then'](function(){if(_['isArray'](_0x4e84e1[_0x189f('0x34')][_0x189f('0x63')])){for(var _0x49dd13=0x0;_0x49dd13<_0x4e84e1[_0x189f('0x34')][_0x189f('0x63')][_0x189f('0x39')];_0x49dd13+=0x1){socket['emit'](_0x189f('0x9b'),{'UserId':Number(_0x4e84e1['query'][_0x189f('0x63')][_0x49dd13]),'CmListId':Number(_0x4e84e1['params']['id'])});}}else{socket['emit'](_0x189f('0x9b'),{'UserId':Number(_0x4e84e1[_0x189f('0x34')]['ids']),'CmListId':Number(_0x4e84e1['params']['id'])});}});}})[_0x189f('0x29')](respondWithStatusCode(_0x22662a,null))[_0x189f('0x48')](handleError(_0x22662a,null));};exports[_0x189f('0x9c')]=function(_0x53f599,_0x55628e,_0x556df9){var _0x3e073e={};var _0x3dd3b5={};var _0xfa8291;var _0x306d4b;return db[_0x189f('0x44')][_0x189f('0x58')]({'where':{'id':_0x53f599[_0x189f('0x49')]['id']}})[_0x189f('0x29')](handleEntityNotFound(_0x55628e,null))[_0x189f('0x29')](function(_0x4e668d){if(_0x4e668d){_0xfa8291=_0x4e668d;_0x3dd3b5[_0x189f('0x33')]=_[_0x189f('0x4a')](db[_0x189f('0x9d')][_0x189f('0x30')]);_0x3dd3b5[_0x189f('0x34')]=_[_0x189f('0x4a')](_0x53f599[_0x189f('0x34')]);_0x3dd3b5[_0x189f('0x35')]=_[_0x189f('0x36')](_0x3dd3b5[_0x189f('0x33')],_0x3dd3b5[_0x189f('0x34')]);_0x3e073e[_0x189f('0x37')]=_[_0x189f('0x36')](_0x3dd3b5[_0x189f('0x33')],qs['fields'](_0x53f599[_0x189f('0x34')][_0x189f('0x38')]));_0x3e073e[_0x189f('0x37')]=_0x3e073e[_0x189f('0x37')][_0x189f('0x39')]?_0x3e073e[_0x189f('0x37')]:_0x3dd3b5[_0x189f('0x33')];_0x3e073e[_0x189f('0x3c')]=qs[_0x189f('0x3d')](_0x53f599[_0x189f('0x34')][_0x189f('0x3d')]);_0x3e073e[_0x189f('0x3e')]=qs[_0x189f('0x35')](_[_0x189f('0x3f')](_0x53f599[_0x189f('0x34')],_0x3dd3b5['filters']));if(_0x53f599[_0x189f('0x34')][_0x189f('0x41')]){_0x3e073e[_0x189f('0x3e')]=_[_0x189f('0x42')](_0x3e073e[_0x189f('0x3e')],{'$or':_[_0x189f('0x2f')](_0x3e073e['attributes'],function(_0x31f3fb){var _0x120e5b={};_0x120e5b[_0x31f3fb]={'$like':'%'+_0x53f599[_0x189f('0x34')][_0x189f('0x41')]+'%'};return _0x120e5b;})});}_0x3e073e=_[_0x189f('0x42')]({},_0x3e073e,_0x53f599['options']);return _0xfa8291['getAgents'](_0x3e073e);}})[_0x189f('0x29')](function(_0x5f4154){if(_0x5f4154){_0x306d4b=_0x5f4154[_0x189f('0x39')];if(!_0x53f599[_0x189f('0x34')][_0x189f('0x3a')](_0x189f('0x3b'))){_0x3e073e[_0x189f('0x20')]=qs[_0x189f('0x20')](_0x53f599[_0x189f('0x34')]['limit']);_0x3e073e['offset']=qs[_0x189f('0x1f')](_0x53f599[_0x189f('0x34')][_0x189f('0x1f')]);}return _0xfa8291[_0x189f('0x9c')](_0x3e073e);}})[_0x189f('0x29')](function(_0x16d58a){if(_0x16d58a){return _0x16d58a?{'count':_0x306d4b,'rows':_0x16d58a}:null;}})[_0x189f('0x29')](respondWithResult(_0x55628e,null))[_0x189f('0x48')](handleError(_0x55628e,null));};function handleQuery(_0x4f0565){logger[_0x189f('0x9e')](_0x4f0565);return db[_0x189f('0x9f')][_0x189f('0x34')](_0x4f0565)[_0x189f('0x98')](function(_0x42df36){csv_results['push'](_0x42df36);})['catch'](function(_0x472d1d){logger['error'](_0x472d1d[_0x189f('0x68')]);});} \ No newline at end of file +var _0x939d=['CmCustomField','concat','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','toString','isEmpty','now','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','info','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','update','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','CmList','rows','catch','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','body','destroy','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts'];(function(_0x5c6a59,_0x284c5e){var _0x27761a=function(_0x15a75d){while(--_0x15a75d){_0x5c6a59['push'](_0x5c6a59['shift']());}};_0x27761a(++_0x284c5e);}(_0x939d,0x182));var _0xd939=function(_0x39615f,_0x160244){_0x39615f=_0x39615f-0x0;var _0x5c2be5=_0x939d[_0x39615f];return _0x5c2be5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd939('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd939('0x1'));var moment=require(_0xd939('0x2'));var BPromise=require(_0xd939('0x3'));var Mustache=require(_0xd939('0x4'));var util=require(_0xd939('0x5'));var path=require(_0xd939('0x6'));var sox=require(_0xd939('0x7'));var csv=require('to-csv');var ejs=require(_0xd939('0x8'));var fs=require('fs');var fs_extra=require(_0xd939('0x9'));var _=require(_0xd939('0xa'));var squel=require('squel');var crypto=require(_0xd939('0xb'));var jsforce=require(_0xd939('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd939('0xd'));var Papa=require(_0xd939('0xe'));var Redis=require(_0xd939('0xf'));var authService=require(_0xd939('0x10'));var qs=require(_0xd939('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd939('0x12'));var logger=require(_0xd939('0x13'))(_0xd939('0x14'));var utils=require(_0xd939('0x15'));var config=require(_0xd939('0x16'));var licenseUtil=require(_0xd939('0x17'));var db=require(_0xd939('0x18'))['db'];var csv_results;config[_0xd939('0x19')]=_[_0xd939('0x1a')](config['redis'],{'host':_0xd939('0x1b'),'port':0x18eb});var socket=require(_0xd939('0x1c'))(new Redis(config['redis']));require('./cmList.socket')[_0xd939('0x1d')](socket);function respondWithStatusCode(_0x4ec743,_0x56e714){_0x56e714=_0x56e714||0xcc;return function(_0x37c619){if(_0x37c619){return _0x4ec743['sendStatus'](_0x56e714);}return _0x4ec743['status'](_0x56e714)[_0xd939('0x1e')]();};}function respondWithResult(_0x5c1903,_0x55a8bb){_0x55a8bb=_0x55a8bb||0xc8;return function(_0x49af33){if(_0x49af33){return _0x5c1903['status'](_0x55a8bb)['json'](_0x49af33);}};}function respondWithFilteredResult(_0x2e925f,_0x466231){return function(_0x529b68){if(_0x529b68){var _0x5c6e24=typeof _0x466231[_0xd939('0x1f')]===_0xd939('0x20')&&typeof _0x466231[_0xd939('0x21')]==='undefined';var _0x3f1eee=_0x529b68[_0xd939('0x22')];var _0x5f16ef=_0x5c6e24?0x0:_0x466231[_0xd939('0x1f')];var _0x670ec9=_0x5c6e24?_0x529b68[_0xd939('0x22')]:_0x466231[_0xd939('0x1f')]+_0x466231[_0xd939('0x21')];var _0x323a7f;if(_0x670ec9>=_0x3f1eee){_0x670ec9=_0x3f1eee;_0x323a7f=0xc8;}else{_0x323a7f=0xce;}_0x2e925f[_0xd939('0x23')](_0x323a7f);return _0x2e925f[_0xd939('0x24')](_0xd939('0x25'),_0x5f16ef+'-'+_0x670ec9+'/'+_0x3f1eee)[_0xd939('0x26')](_0x529b68);}return null;};}function patchUpdates(_0x34412f){return function(_0x5d5a4c){try{jsonpatch[_0xd939('0x27')](_0x5d5a4c,_0x34412f,!![]);}catch(_0x27dcda){return BPromise[_0xd939('0x28')](_0x27dcda);}return _0x5d5a4c[_0xd939('0x29')]();};}function saveUpdates(_0x753a4f,_0x393563){return function(_0x4cca5c){if(_0x4cca5c){return _0x4cca5c[_0xd939('0x2a')](_0x753a4f)[_0xd939('0x2b')](function(_0x3c5e1b){return _0x3c5e1b;});}return null;};}function removeEntity(_0x282dcb,_0x46ccf5){return function(_0x360f9d){if(_0x360f9d){return _0x360f9d['destroy']()[_0xd939('0x2b')](function(){var _0x2f39ca=_0x360f9d['get']({'plain':!![]});var _0x56afa0=_0xd939('0x2c');return db[_0xd939('0x2d')]['destroy']({'where':{'type':_0x56afa0,'resourceId':_0x2f39ca['id']}})[_0xd939('0x2b')](function(){return _0x360f9d;});})[_0xd939('0x2b')](function(){_0x282dcb[_0xd939('0x23')](0xcc)[_0xd939('0x1e')]();});}};}function handleEntityNotFound(_0x120758,_0x2f0a1e){return function(_0x5e360c){if(!_0x5e360c){_0x120758[_0xd939('0x2e')](0x194);}return _0x5e360c;};}function handleError(_0x4ff916,_0xf2617c){_0xf2617c=_0xf2617c||0x1f4;return function(_0x24fd31){logger[_0xd939('0x2f')](_0x24fd31[_0xd939('0x30')]);if(_0x24fd31[_0xd939('0x31')]){delete _0x24fd31[_0xd939('0x31')];}_0x4ff916[_0xd939('0x23')](_0xf2617c)[_0xd939('0x32')](_0x24fd31);};}exports[_0xd939('0x33')]=function(_0x290796,_0x1ced60){var _0x507d45={},_0x4100f5={},_0x39720e={'count':0x0,'rows':[]};var _0x369fcb=_[_0xd939('0x34')](db['CmList']['rawAttributes'],function(_0x1fd3e4){return{'name':_0x1fd3e4[_0xd939('0x35')],'type':_0x1fd3e4[_0xd939('0x36')][_0xd939('0x37')]};});_0x4100f5[_0xd939('0x38')]=_['map'](_0x369fcb,_0xd939('0x31'));_0x4100f5[_0xd939('0x39')]=_[_0xd939('0x3a')](_0x290796[_0xd939('0x39')]);_0x4100f5[_0xd939('0x3b')]=_['intersection'](_0x4100f5[_0xd939('0x38')],_0x4100f5[_0xd939('0x39')]);_0x507d45['attributes']=_[_0xd939('0x3c')](_0x4100f5[_0xd939('0x38')],qs[_0xd939('0x3d')](_0x290796[_0xd939('0x39')]['fields']));_0x507d45[_0xd939('0x3e')]=_0x507d45[_0xd939('0x3e')][_0xd939('0x3f')]?_0x507d45[_0xd939('0x3e')]:_0x4100f5[_0xd939('0x38')];if(!_0x290796[_0xd939('0x39')][_0xd939('0x40')](_0xd939('0x41'))){_0x507d45[_0xd939('0x21')]=qs[_0xd939('0x21')](_0x290796[_0xd939('0x39')][_0xd939('0x21')]);_0x507d45[_0xd939('0x1f')]=qs['offset'](_0x290796[_0xd939('0x39')][_0xd939('0x1f')]);}_0x507d45[_0xd939('0x42')]=qs['sort'](_0x290796[_0xd939('0x39')][_0xd939('0x43')]);_0x507d45['where']=qs[_0xd939('0x3b')](_['pick'](_0x290796[_0xd939('0x39')],_0x4100f5[_0xd939('0x3b')]),_0x369fcb);if(_0x290796[_0xd939('0x39')][_0xd939('0x44')]){_0x507d45[_0xd939('0x45')]=_[_0xd939('0x46')](_0x507d45[_0xd939('0x45')],{'$or':_[_0xd939('0x34')](_0x369fcb,function(_0x149d1f){if(_0x149d1f[_0xd939('0x36')]!=='VIRTUAL'){var _0x4dd31a={};_0x4dd31a[_0x149d1f[_0xd939('0x31')]]={'$like':'%'+_0x290796[_0xd939('0x39')]['filter']+'%'};return _0x4dd31a;}})});}_0x507d45=_[_0xd939('0x46')]({},_0x507d45,_0x290796[_0xd939('0x47')]);var _0x3c5a20={'where':_0x507d45[_0xd939('0x45')]};return db['CmList'][_0xd939('0x22')](_0x3c5a20)[_0xd939('0x2b')](function(_0x2e8ba4){_0x39720e[_0xd939('0x22')]=_0x2e8ba4;if(_0x290796['query'][_0xd939('0x48')]){_0x507d45[_0xd939('0x49')]=[{'all':!![]}];}return db[_0xd939('0x4a')]['findAll'](_0x507d45);})[_0xd939('0x2b')](function(_0x4dca55){_0x39720e[_0xd939('0x4b')]=_0x4dca55;return _0x39720e;})[_0xd939('0x2b')](respondWithFilteredResult(_0x1ced60,_0x507d45))[_0xd939('0x4c')](handleError(_0x1ced60,null));};exports['show']=function(_0x3b905a,_0x360113){var _0x507dd1={'raw':![],'where':{'id':_0x3b905a[_0xd939('0x4d')]['id']}},_0x1a31b4={};_0x1a31b4[_0xd939('0x38')]=_[_0xd939('0x3a')](db[_0xd939('0x4a')][_0xd939('0x4e')]);_0x1a31b4[_0xd939('0x39')]=_[_0xd939('0x3a')](_0x3b905a[_0xd939('0x39')]);_0x1a31b4[_0xd939('0x3b')]=_[_0xd939('0x3c')](_0x1a31b4[_0xd939('0x38')],_0x1a31b4[_0xd939('0x39')]);_0x507dd1['attributes']=_[_0xd939('0x3c')](_0x1a31b4['model'],qs[_0xd939('0x3d')](_0x3b905a[_0xd939('0x39')][_0xd939('0x3d')]));_0x507dd1[_0xd939('0x3e')]=_0x507dd1['attributes'][_0xd939('0x3f')]?_0x507dd1['attributes']:_0x1a31b4[_0xd939('0x38')];if(_0x3b905a[_0xd939('0x39')][_0xd939('0x48')]){_0x507dd1['include']=[{'all':!![]}];}_0x507dd1=_[_0xd939('0x46')]({},_0x507dd1,_0x3b905a[_0xd939('0x47')]);return db[_0xd939('0x4a')][_0xd939('0x4f')](_0x507dd1)[_0xd939('0x2b')](handleEntityNotFound(_0x360113,null))[_0xd939('0x2b')](respondWithResult(_0x360113,null))['catch'](handleError(_0x360113,null));};exports[_0xd939('0x50')]=function(_0xf004f5,_0x4f1c7c){return db[_0xd939('0x4a')][_0xd939('0x50')](_0xf004f5['body'],{})[_0xd939('0x2b')](function(_0x5df2d1){var _0xdafeb7=_0xf004f5[_0xd939('0x51')]['get']({'plain':!![]});if(!_0xdafeb7)throw new Error(_0xd939('0x52'));if(_0xdafeb7[_0xd939('0x53')]===_0xd939('0x51')){var _0xa05dc=_0x5df2d1[_0xd939('0x54')]({'plain':!![]});var _0x2ff394=_0xd939('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x2ff394,'userProfileId':_0xdafeb7[_0xd939('0x55')]},'raw':!![]})['then'](function(_0x103a9c){if(_0x103a9c&&_0x103a9c[_0xd939('0x56')]===0x0){return db[_0xd939('0x2d')][_0xd939('0x50')]({'name':_0xa05dc[_0xd939('0x31')],'resourceId':_0xa05dc['id'],'type':_0x103a9c[_0xd939('0x31')],'sectionId':_0x103a9c['id']},{})['then'](function(){return _0x5df2d1;});}else{return _0x5df2d1;}})[_0xd939('0x4c')](function(_0x3d3804){logger[_0xd939('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3804);throw _0x3d3804;});}return _0x5df2d1;})[_0xd939('0x2b')](respondWithResult(_0x4f1c7c,0xc9))['catch'](handleError(_0x4f1c7c,null));};exports[_0xd939('0x2a')]=function(_0x3d2531,_0xd37250){if(_0x3d2531[_0xd939('0x57')]['id']){delete _0x3d2531[_0xd939('0x57')]['id'];}return db['CmList'][_0xd939('0x4f')]({'where':{'id':_0x3d2531[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0xd37250,null))[_0xd939('0x2b')](saveUpdates(_0x3d2531['body'],null))[_0xd939('0x2b')](respondWithResult(_0xd37250,null))[_0xd939('0x4c')](handleError(_0xd37250,null));};exports[_0xd939('0x58')]=function(_0x48a48a,_0x20a9d1){return db[_0xd939('0x4a')][_0xd939('0x4f')]({'where':{'id':_0x48a48a[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x20a9d1,null))[_0xd939('0x2b')](removeEntity(_0x20a9d1,null))[_0xd939('0x4c')](handleError(_0x20a9d1,null));};exports['describe']=function(_0x3bff97,_0x4f64a4){return db[_0xd939('0x4a')][_0xd939('0x59')]()['then'](respondWithResult(_0x4f64a4,null))['catch'](handleError(_0x4f64a4,null));};exports[_0xd939('0x5a')]=function(_0x595383,_0x483298,_0x31fc41){if(_0x595383['body']['id']){delete _0x595383['body']['id'];}return db[_0xd939('0x4a')][_0xd939('0x4f')]({'where':{'id':_0x595383['params']['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x483298,null))['then'](function(_0x16303e){if(_0x16303e){_0x595383['body']['ListId']=_0x16303e['id'];return db[_0xd939('0x5b')][_0xd939('0x50')](_0x595383['body']);}})[_0xd939('0x2b')](respondWithResult(_0x483298,null))[_0xd939('0x4c')](handleError(_0x483298,null));};exports[_0xd939('0x5c')]=function(_0xeb76a1,_0x634827,_0x42ca73){var _0x48cbfb={'raw':![],'where':{}};var _0xffeec9={};var _0xda3787={'count':0x0,'rows':[]};return db['CmList'][_0xd939('0x5d')]({'where':{'id':_0xeb76a1[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x634827,null))[_0xd939('0x2b')](function(_0x5a4f72){if(_0x5a4f72){_0xffeec9[_0xd939('0x38')]=_['keys'](db[_0xd939('0x5b')][_0xd939('0x4e')]);_0xffeec9[_0xd939('0x39')]=_[_0xd939('0x3a')](_0xeb76a1['query']);_0xffeec9[_0xd939('0x3b')]=_[_0xd939('0x3c')](_0xffeec9[_0xd939('0x38')],_0xffeec9['query']);_0x48cbfb[_0xd939('0x3e')]=_[_0xd939('0x3c')](_0xffeec9[_0xd939('0x38')],qs['fields'](_0xeb76a1[_0xd939('0x39')][_0xd939('0x3d')]));_0x48cbfb['attributes']=_0x48cbfb[_0xd939('0x3e')][_0xd939('0x3f')]?_0x48cbfb['attributes']:_0xffeec9[_0xd939('0x38')];if(!_0xeb76a1['query'][_0xd939('0x40')]('nolimit')){_0x48cbfb[_0xd939('0x21')]=qs[_0xd939('0x21')](_0xeb76a1[_0xd939('0x39')][_0xd939('0x21')]);_0x48cbfb['offset']=qs[_0xd939('0x1f')](_0xeb76a1['query'][_0xd939('0x1f')]);}_0x48cbfb['order']=qs[_0xd939('0x43')](_0xeb76a1[_0xd939('0x39')]['sort']);_0x48cbfb[_0xd939('0x45')]=qs[_0xd939('0x3b')](_[_0xd939('0x5e')](_0xeb76a1[_0xd939('0x39')],_0xffeec9['filters']));_0x48cbfb[_0xd939('0x45')][_0xd939('0x5f')]=_0x5a4f72['id'];if(_0xeb76a1[_0xd939('0x39')][_0xd939('0x44')]){_0x48cbfb[_0xd939('0x45')]=_[_0xd939('0x46')](_0x48cbfb['where'],{'$or':_[_0xd939('0x34')](_0x48cbfb[_0xd939('0x3e')],function(_0x5d504){var _0xcdcc5a={};_0xcdcc5a[_0x5d504]={'$like':'%'+_0xeb76a1[_0xd939('0x39')]['filter']+'%'};return _0xcdcc5a;})});}_0x48cbfb=_[_0xd939('0x46')]({},_0x48cbfb,_0xeb76a1[_0xd939('0x47')]);return db['Disposition'][_0xd939('0x22')]({'where':_0x48cbfb[_0xd939('0x45')]})[_0xd939('0x2b')](function(_0x4931fe){_0xda3787[_0xd939('0x22')]=_0x4931fe;if(_0xeb76a1[_0xd939('0x39')][_0xd939('0x48')]){_0x48cbfb[_0xd939('0x49')]=[{'all':!![]}];}return db['Disposition'][_0xd939('0x60')](_0x48cbfb);})[_0xd939('0x2b')](function(_0x3073d7){_0xda3787[_0xd939('0x4b')]=_0x3073d7;return _0xda3787;});}})[_0xd939('0x2b')](respondWithFilteredResult(_0x634827,_0x48cbfb))[_0xd939('0x4c')](handleError(_0x634827,null));};exports[_0xd939('0x61')]=function(_0xa6b4fa,_0x2212ce,_0x225802){return db[_0xd939('0x4a')]['find']({'where':{'id':_0xa6b4fa[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x2212ce,null))[_0xd939('0x2b')](function(_0x28731c){if(_0x28731c){return _0x28731c['removeDispositions'](_0xa6b4fa['query'][_0xd939('0x62')]);}})[_0xd939('0x2b')](respondWithStatusCode(_0x2212ce,null))[_0xd939('0x4c')](handleError(_0x2212ce,null));};exports[_0xd939('0x63')]=function(_0xc80bb9,_0xa7f0ac,_0x622d7a){return db['CmList'][_0xd939('0x4f')]({'where':{'id':_0xc80bb9[_0xd939('0x4d')]['id']}})['then'](handleEntityNotFound(_0xa7f0ac,null))[_0xd939('0x2b')](function(_0x18e594){if(_0x18e594){var _0x154bca=[];var _0x13c44b={'success':[],'errors':[]};return db[_0xd939('0x64')][_0xd939('0x59')]()[_0xd939('0x2b')](function(_0x4969fd){if(_0xc80bb9[_0xd939('0x57')][_0xd939('0x65')]&&_[_0xd939('0x66')](_0xc80bb9[_0xd939('0x57')][_0xd939('0x65')])){if(_0xc80bb9['body'][_0xd939('0x65')][_0xd939('0x3f')]){_0xc80bb9[_0xd939('0x57')][_0xd939('0x65')]=_0xc80bb9[_0xd939('0x57')][_0xd939('0x65')][_0xd939('0x67')](';')+';';}else{_0xc80bb9['body'][_0xd939('0x65')]=null;}}else{_0xc80bb9['body'][_0xd939('0x65')]=null;}if(_0xc80bb9[_0xd939('0x57')]&&_[_0xd939('0x66')](_0xc80bb9['body'])){for(var _0x2ce9b6=0x0;_0x2ce9b6<_0xc80bb9[_0xd939('0x57')][_0xd939('0x3f')];_0x2ce9b6+=0x1){_0xc80bb9[_0xd939('0x57')][_0x2ce9b6][_0xd939('0x5f')]=_0xc80bb9[_0xd939('0x4d')]['id'];_0x154bca[_0xd939('0x68')](_0xc80bb9[_0xd939('0x57')][_0x2ce9b6]);}return BPromise[_0xd939('0x69')](_0x154bca,function(_0x3bb5ce){return db[_0xd939('0x64')][_0xd939('0x50')](_[_0xd939('0x6a')](_0x3bb5ce,[_0xd939('0x62'),'id'])||{},{'fields':_[_0xd939('0x3a')](_0x4969fd),'raw':!![]})['then'](function(_0x390c50){_0x13c44b['success'][_0xd939('0x68')](_0x390c50[_0xd939('0x6b')]);})[_0xd939('0x4c')](function(_0x47a99a){_0x13c44b[_0xd939('0x6c')][_0xd939('0x68')]({'data':_0x3bb5ce,'error':_0x47a99a[_0xd939('0x6d')]});});})[_0xd939('0x2b')](function(_0x13be9a){return _0x13c44b;})[_0xd939('0x4c')](function(_0x2e2caa){return _0x2e2caa;});}else{_0xa7f0ac[_0xd939('0x23')](0x190)[_0xd939('0x26')]({'message':_0xd939('0x6e')});}});}})[_0xd939('0x2b')](respondWithResult(_0xa7f0ac,null))[_0xd939('0x4c')](handleError(_0xa7f0ac,null));};exports[_0xd939('0x6f')]=function(_0x1f591a,_0x3710a1,_0x25d388){var _0x4446bf;return db['CmList'][_0xd939('0x4f')]({'where':{'id':_0x1f591a[_0xd939('0x4d')]['id']},'include':[{'model':db[_0xd939('0x70')],'as':'CustomFields'}]})[_0xd939('0x2b')](handleEntityNotFound(_0x3710a1,null))[_0xd939('0x2b')](function(_0x1526dd){if(_0x1526dd){_0x4446bf=_0x1526dd;return db['CmContact'][_0xd939('0x4e')];}})['then'](function(_0x2ea139){if(_0x2ea139){var _0x3d7a9f={};var _0x25bdec={};_0x25bdec[_0xd939('0x38')]=_[_0xd939('0x71')](_[_0xd939('0x3a')](_0x2ea139),_[_0xd939('0x34')](_0x4446bf['CustomFields'],function(_0x12a047){return util['format'](_0xd939('0x72'),_0x12a047['id']);}));_0x25bdec[_0xd939('0x39')]=_[_0xd939('0x3a')](_0x1f591a['query']);_0x25bdec['filters']=_[_0xd939('0x3c')](_0x25bdec[_0xd939('0x38')],_0x25bdec[_0xd939('0x39')]);_0x3d7a9f[_0xd939('0x3e')]=_['intersection'](_0x25bdec[_0xd939('0x38')],qs[_0xd939('0x3d')](_0x1f591a[_0xd939('0x39')]['fields']));_0x3d7a9f['attributes']=_0x3d7a9f[_0xd939('0x3e')][_0xd939('0x3f')]?_0x3d7a9f[_0xd939('0x3e')]:_0x25bdec[_0xd939('0x38')];if(!_0x1f591a[_0xd939('0x39')][_0xd939('0x40')](_0xd939('0x41'))){_0x3d7a9f['limit']=qs['limit'](_0x1f591a['query'][_0xd939('0x21')]);_0x3d7a9f[_0xd939('0x1f')]=qs[_0xd939('0x1f')](_0x1f591a['query'][_0xd939('0x1f')]);}_0x3d7a9f[_0xd939('0x42')]=qs[_0xd939('0x43')](_0x1f591a[_0xd939('0x39')][_0xd939('0x43')]);_0x3d7a9f['where']=qs[_0xd939('0x3b')](_[_0xd939('0x5e')](_0x1f591a['query'],_0x25bdec[_0xd939('0x3b')]));_0x3d7a9f[_0xd939('0x73')]=!![];if(_0x1f591a[_0xd939('0x39')][_0xd939('0x44')]){_0x3d7a9f[_0xd939('0x45')]=_['merge'](_0x3d7a9f[_0xd939('0x45')],{'$or':_[_0xd939('0x34')](_0x3d7a9f[_0xd939('0x3e')],function(_0x1913e8){var _0x36b50a={};_0x36b50a[_0x1913e8]={'$like':'%'+_0x1f591a['query'][_0xd939('0x44')]+'%'};return _0x36b50a;})});}_0x3d7a9f=_[_0xd939('0x46')]({},_0x3d7a9f,_0x1f591a[_0xd939('0x47')]);return _0x4446bf[_0xd939('0x6f')](_0x3d7a9f);}})[_0xd939('0x2b')](respondWithResult(_0x3710a1,null))[_0xd939('0x4c')](handleError(_0x3710a1,null));};exports[_0xd939('0x74')]=function(_0x488bbb,_0x2cc3e9,_0x18ed44){var _0x7ae8ad;var _0x40ede2;var _0x2a941c;var _0x56e5f1=_0x488bbb['params']['id'];csv_results=[];return db[_0xd939('0x75')][_0xd939('0x60')]({'attributes':['id',_0xd939('0x31')],'raw':!![],'order':[_0xd939('0x76')]})['then'](function(_0x2d30f9){_0x7ae8ad=_0x2d30f9;var _0x1939df=_['keys'](db[_0xd939('0x64')][_0xd939('0x4e')]);return db[_0xd939('0x70')]['findAll']({'raw':!![],'attributes':['id','alias']})['then'](function(_0x5437b9){_0x40ede2=_0x5437b9;var _0x581161=squel[_0xd939('0x77')]()[_0xd939('0x3d')](_0x1939df)[_0xd939('0x78')](_0xd939('0x79'),'c')[_0xd939('0x45')]('c.ListId\x20=\x20?',_0x56e5f1)['where'](_0xd939('0x7a'))['distinct']();for(var _0xf7dabf=0x0;_0xf7dabf<_0x40ede2[_0xd939('0x3f')];_0xf7dabf++){_0x581161[_0xd939('0x7b')](_0xd939('0x7c')+_0x40ede2[_0xf7dabf]['id'],_0xd939('0x7d')+_0x40ede2[_0xf7dabf]['alias']);}for(var _0xf7dabf=0x0;_0xf7dabf<_0x7ae8ad[_0xd939('0x3f')];_0xf7dabf++){_0x581161['field'](squel[_0xd939('0x77')]()[_0xd939('0x7b')](_0xd939('0x7e'))[_0xd939('0x78')](_0xd939('0x7f'))['where'](_0xd939('0x80'),_0x7ae8ad[_0xf7dabf]['id'])['where'](_0xd939('0x81')),_0xd939('0x82')+_0x7ae8ad[_0xf7dabf][_0xd939('0x31')]);_0x581161['field'](squel[_0xd939('0x77')]()['field']('description')[_0xd939('0x78')]('cm_contact_has_items')[_0xd939('0x45')](_0xd939('0x80'),_0x7ae8ad[_0xf7dabf]['id'])[_0xd939('0x45')]('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0x7ae8ad[_0xf7dabf][_0xd939('0x31')]);}var _0x3cb34c=[];_0x3cb34c[_0xd939('0x68')](_0x581161[_0xd939('0x83')]());BPromise['each'](_0x3cb34c,handleQuery)['then'](function(_0x429aa0){handleQuery(_0x581161[_0xd939('0x83')]());var _0xe14d3a=csv_results[0x0];if(!_[_0xd939('0x84')](_0xe14d3a)){var _0x4faa19=toCsv(_0xe14d3a);var _0x2d4ed7=Date[_0xd939('0x85')]();fs['writeFileSync'](util[_0xd939('0x86')](_0xd939('0x87'),_0x56e5f1,_0x2d4ed7),_0x4faa19);_0x2cc3e9['setHeader'](_0xd939('0x88'),_0xd939('0x89')+util[_0xd939('0x86')](_0xd939('0x8a'),_0x56e5f1,_0x2d4ed7));_0x2cc3e9['setHeader'](_0xd939('0x8b'),'text/csv');return _0x2cc3e9['download'](util[_0xd939('0x86')](_0xd939('0x87'),_0x56e5f1,_0x2d4ed7));}else{return _0x2cc3e9[_0xd939('0x2e')](0xcc);}});});});};exports[_0xd939('0x8c')]=function(_0x505193,_0xbadc50,_0x17e9a3){var _0x308aa8;delete _0x505193['body']['id'];return db[_0xd939('0x4a')][_0xd939('0x5d')]({'where':{'id':_0x505193[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0xbadc50,null))[_0xd939('0x2b')](function(_0x49f32a){if(_0x49f32a){return db[_0xd939('0x8d')][_0xd939('0x8e')](function(_0x4d9b01){return db['CmCustomField']['create'](_0x505193[_0xd939('0x57')],{'transaction':_0x4d9b01})[_0xd939('0x2b')](function(_0x2464a6){_0x308aa8=_0x2464a6;return _0x49f32a[_0xd939('0x8f')](_0x2464a6,{'transaction':_0x4d9b01});})[_0xd939('0x2b')](function(){var _0x126c96={'type':db[_0xd939('0x90')][_0xd939('0x91')],'transaction':_0x4d9b01};switch(_0x505193['body'][_0xd939('0x36')]){case _0xd939('0x92'):_0x126c96[_0xd939('0x36')]=db[_0xd939('0x90')][_0xd939('0x91')];break;case _0xd939('0x93'):_0x126c96[_0xd939('0x36')]=db[_0xd939('0x90')][_0xd939('0x94')];break;case _0xd939('0x95'):_0x126c96[_0xd939('0x36')]=db['Sequelize'][_0xd939('0x96')];_0x126c96[_0xd939('0x97')]=![];break;default:}return db[_0xd939('0x8d')][_0xd939('0x98')][_0xd939('0x99')](_0xd939('0x79'),util[_0xd939('0x86')](_0xd939('0x9a'),_0x308aa8['id']),_0x126c96);})['then'](function(){return _0x308aa8;});});}})[_0xd939('0x2b')](respondWithResult(_0xbadc50,null))[_0xd939('0x4c')](handleError(_0xbadc50,null));};exports[_0xd939('0x9b')]=function(_0x2c1c70,_0x1aa5bb,_0x3727bb){var _0x5b1d17={};var _0x4d03cb={};var _0x3a2994;var _0x47d078;return db[_0xd939('0x4a')]['findOne']({'where':{'id':_0x2c1c70[_0xd939('0x4d')]['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x1aa5bb,null))[_0xd939('0x2b')](function(_0x510ffa){if(_0x510ffa){_0x3a2994=_0x510ffa;_0x4d03cb['model']=_[_0xd939('0x3a')](db[_0xd939('0x70')][_0xd939('0x4e')]);_0x4d03cb['query']=_[_0xd939('0x3a')](_0x2c1c70[_0xd939('0x39')]);_0x4d03cb[_0xd939('0x3b')]=_[_0xd939('0x3c')](_0x4d03cb[_0xd939('0x38')],_0x4d03cb[_0xd939('0x39')]);_0x5b1d17['attributes']=_[_0xd939('0x3c')](_0x4d03cb['model'],qs['fields'](_0x2c1c70[_0xd939('0x39')]['fields']));_0x5b1d17[_0xd939('0x3e')]=_0x5b1d17['attributes'][_0xd939('0x3f')]?_0x5b1d17['attributes']:_0x4d03cb[_0xd939('0x38')];_0x5b1d17[_0xd939('0x42')]=qs[_0xd939('0x43')](_0x2c1c70[_0xd939('0x39')][_0xd939('0x43')]);_0x5b1d17[_0xd939('0x45')]=qs[_0xd939('0x3b')](_[_0xd939('0x5e')](_0x2c1c70[_0xd939('0x39')],_0x4d03cb['filters']));_0x5b1d17[_0xd939('0x45')]=_['merge'](_0x5b1d17[_0xd939('0x45')],{'$or':[{'ListId':_0x510ffa['id']},{'ListId':null}]});if(_0x2c1c70['query'][_0xd939('0x44')]){_0x5b1d17[_0xd939('0x45')]=_[_0xd939('0x46')](_0x5b1d17[_0xd939('0x45')],{'$or':_[_0xd939('0x34')](_0x5b1d17[_0xd939('0x3e')],function(_0x1d0d33){var _0x3f5607={};_0x3f5607[_0x1d0d33]={'$like':'%'+_0x2c1c70[_0xd939('0x39')][_0xd939('0x44')]+'%'};return _0x3f5607;})});}_0x5b1d17=_['merge']({},_0x5b1d17,_0x2c1c70[_0xd939('0x47')]);return db['CmCustomField'][_0xd939('0x9c')](_0x5b1d17);}})[_0xd939('0x2b')](respondWithResult(_0x1aa5bb,null))['catch'](handleError(_0x1aa5bb,null));};exports[_0xd939('0x9d')]=function(_0x47afd0,_0x3a6aad){return db[_0xd939('0x70')][_0xd939('0x9c')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x3a6aad,null))[_0xd939('0x2b')](function(_0x3e5d11){return _0x3e5d11;})[_0xd939('0x2b')](respondWithResult(_0x3a6aad,null))['catch'](handleError(_0x3a6aad,null));};exports[_0xd939('0x9e')]=function(_0x398441,_0x32cb47,_0x824502){return db['CmList'][_0xd939('0x4f')]({'where':{'id':_0x398441[_0xd939('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32cb47,null))[_0xd939('0x2b')](function(_0x2b0bcf){if(_0x2b0bcf){return _0x2b0bcf[_0xd939('0x9e')](_0x398441[_0xd939('0x57')]['ids'],_[_0xd939('0x6a')](_0x398441[_0xd939('0x57')],[_0xd939('0x62'),'id'])||{})[_0xd939('0x9f')](function(_0x106725){for(var _0x1e0465=0x0;_0x1e0465<_0x398441[_0xd939('0x57')][_0xd939('0x62')][_0xd939('0x3f')];_0x1e0465+=0x1){socket['emit'](_0xd939('0xa0'),{'UserId':Number(_0x398441[_0xd939('0x57')][_0xd939('0x62')][_0x1e0465]),'CmListId':Number(_0x398441[_0xd939('0x4d')]['id'])});}return _0x106725;});}})[_0xd939('0x2b')](respondWithResult(_0x32cb47,null))['catch'](handleError(_0x32cb47,null));};exports[_0xd939('0xa1')]=function(_0x2fa44d,_0x32a013,_0x395df3){return db['CmList'][_0xd939('0x4f')]({'where':{'id':_0x2fa44d[_0xd939('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32a013,null))['then'](function(_0x1fe38f){if(_0x1fe38f){return _0x1fe38f[_0xd939('0xa1')](_0x2fa44d[_0xd939('0x39')][_0xd939('0x62')])[_0xd939('0x2b')](function(){if(_[_0xd939('0x66')](_0x2fa44d['query'][_0xd939('0x62')])){for(var _0xa1445a=0x0;_0xa1445a<_0x2fa44d[_0xd939('0x39')][_0xd939('0x62')][_0xd939('0x3f')];_0xa1445a+=0x1){socket[_0xd939('0xa2')](_0xd939('0xa3'),{'UserId':Number(_0x2fa44d[_0xd939('0x39')][_0xd939('0x62')][_0xa1445a]),'CmListId':Number(_0x2fa44d['params']['id'])});}}else{socket[_0xd939('0xa2')](_0xd939('0xa3'),{'UserId':Number(_0x2fa44d[_0xd939('0x39')][_0xd939('0x62')]),'CmListId':Number(_0x2fa44d[_0xd939('0x4d')]['id'])});}});}})[_0xd939('0x2b')](respondWithStatusCode(_0x32a013,null))[_0xd939('0x4c')](handleError(_0x32a013,null));};exports[_0xd939('0xa4')]=function(_0x444a1b,_0x3dea70,_0x588ad5){var _0x2fbabf={};var _0x3111ac={};var _0x55ec4b;var _0x208006;return db['CmList'][_0xd939('0x5d')]({'where':{'id':_0x444a1b['params']['id']}})[_0xd939('0x2b')](handleEntityNotFound(_0x3dea70,null))[_0xd939('0x2b')](function(_0x2c4150){if(_0x2c4150){_0x55ec4b=_0x2c4150;_0x3111ac[_0xd939('0x38')]=_[_0xd939('0x3a')](db['User']['rawAttributes']);_0x3111ac[_0xd939('0x39')]=_['keys'](_0x444a1b[_0xd939('0x39')]);_0x3111ac[_0xd939('0x3b')]=_[_0xd939('0x3c')](_0x3111ac[_0xd939('0x38')],_0x3111ac['query']);_0x2fbabf[_0xd939('0x3e')]=_['intersection'](_0x3111ac['model'],qs[_0xd939('0x3d')](_0x444a1b[_0xd939('0x39')]['fields']));_0x2fbabf[_0xd939('0x3e')]=_0x2fbabf[_0xd939('0x3e')][_0xd939('0x3f')]?_0x2fbabf[_0xd939('0x3e')]:_0x3111ac[_0xd939('0x38')];_0x2fbabf[_0xd939('0x42')]=qs[_0xd939('0x43')](_0x444a1b['query'][_0xd939('0x43')]);_0x2fbabf[_0xd939('0x45')]=qs['filters'](_[_0xd939('0x5e')](_0x444a1b['query'],_0x3111ac[_0xd939('0x3b')]));if(_0x444a1b[_0xd939('0x39')]['filter']){_0x2fbabf[_0xd939('0x45')]=_['merge'](_0x2fbabf[_0xd939('0x45')],{'$or':_['map'](_0x2fbabf['attributes'],function(_0x43b554){var _0x2e7289={};_0x2e7289[_0x43b554]={'$like':'%'+_0x444a1b[_0xd939('0x39')][_0xd939('0x44')]+'%'};return _0x2e7289;})});}_0x2fbabf=_[_0xd939('0x46')]({},_0x2fbabf,_0x444a1b[_0xd939('0x47')]);return _0x55ec4b['getAgents'](_0x2fbabf);}})[_0xd939('0x2b')](function(_0x45a54e){if(_0x45a54e){_0x208006=_0x45a54e[_0xd939('0x3f')];if(!_0x444a1b[_0xd939('0x39')][_0xd939('0x40')](_0xd939('0x41'))){_0x2fbabf['limit']=qs['limit'](_0x444a1b[_0xd939('0x39')]['limit']);_0x2fbabf[_0xd939('0x1f')]=qs[_0xd939('0x1f')](_0x444a1b[_0xd939('0x39')][_0xd939('0x1f')]);}return _0x55ec4b['getAgents'](_0x2fbabf);}})[_0xd939('0x2b')](function(_0x2f3327){if(_0x2f3327){return _0x2f3327?{'count':_0x208006,'rows':_0x2f3327}:null;}})[_0xd939('0x2b')](respondWithResult(_0x3dea70,null))['catch'](handleError(_0x3dea70,null));};function handleQuery(_0x1b0d44){logger[_0xd939('0xa5')](_0x1b0d44);return db[_0xd939('0x8d')]['query'](_0x1b0d44)[_0xd939('0x9f')](function(_0x5b92be){csv_results[_0xd939('0x68')](_0x5b92be);})[_0xd939('0x4c')](function(_0xb83e0b){logger[_0xd939('0x2f')](_0xb83e0b[_0xd939('0x6d')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1793be1..b8a0a71 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0xb2454d,_0x291753){var _0x5464fb=function(_0x386805){while(--_0x386805){_0xb2454d['push'](_0xb2454d['shift']());}};_0x5464fb(++_0x291753);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x12dc03,_0x3accb8){var _0x46bc57=function(_0x4f4118){while(--_0x4f4118){_0x12dc03['push'](_0x12dc03['shift']());}};_0x46bc57(++_0x3accb8);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 9f31266..26e6fd9 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 _0xfd28=['rimraf','./cmList.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x154732,_0x350082){var _0xfb4860=function(_0x4b21a2){while(--_0x4b21a2){_0x154732['push'](_0x154732['shift']());}};_0xfb4860(++_0x350082);}(_0xfd28,0x148));var _0x8fd2=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xfd28[_0x1d50f2];return _0x3769b8;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x2c1ced,_0x400403){var _0x1b13b0=function(_0xa52a8d){while(--_0xa52a8d){_0x2c1ced['push'](_0x2c1ced['shift']());}};_0x1b13b0(++_0x400403);}(_0x1339,0x1ed));var _0x9133=function(_0x201086,_0x42d3c8){_0x201086=_0x201086-0x0;var _0x24fbd1=_0x1339[_0x201086];return _0x24fbd1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'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 5018a50..eef8ed1 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 _0xa1ff=['rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','debug','request\x20sent','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ca394,_0x3a3b2a){var _0x28544f=function(_0x47f8f6){while(--_0x47f8f6){_0x5ca394['push'](_0x5ca394['shift']());}};_0x28544f(++_0x3a3b2a);}(_0xa1ff,0x1a8));var _0xfa1f=function(_0x4f3c89,_0x51047e){_0x4f3c89=_0x4f3c89-0x0;var _0x9f9ccf=_0xa1ff[_0x4f3c89];return _0x9f9ccf;};'use strict';var _=require(_0xfa1f('0x0'));var util=require(_0xfa1f('0x1'));var moment=require('moment');var BPromise=require(_0xfa1f('0x2'));var rs=require(_0xfa1f('0x3'));var fs=require('fs');var Redis=require(_0xfa1f('0x4'));var db=require(_0xfa1f('0x5'))['db'];var utils=require(_0xfa1f('0x6'));var logger=require(_0xfa1f('0x7'))(_0xfa1f('0x8'));var config=require(_0xfa1f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfa1f('0xa')][_0xfa1f('0xb')]({'port':0x232a});config[_0xfa1f('0xc')]=_[_0xfa1f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfa1f('0xe'))(new Redis(config[_0xfa1f('0xc')]));require('./cmList.socket')[_0xfa1f('0xf')](socket);function respondWithRpcPromise(_0xf1872e,_0x2e54a5,_0xb978a5){return new BPromise(function(_0x3b46fa,_0x235f89){return client['request'](_0xf1872e,_0xb978a5)[_0xfa1f('0x10')](function(_0x35c8d3){logger[_0xfa1f('0x11')](_0xfa1f('0x12'),_0x2e54a5,'request\x20sent');logger[_0xfa1f('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x2e54a5,_0xfa1f('0x14'),JSON['stringify'](_0x35c8d3));if(_0x35c8d3[_0xfa1f('0x15')]){if(_0x35c8d3[_0xfa1f('0x15')][_0xfa1f('0x16')]===0x1f4){logger[_0xfa1f('0x15')](_0xfa1f('0x12'),_0x2e54a5,_0x35c8d3[_0xfa1f('0x15')][_0xfa1f('0x17')]);return _0x235f89(_0x35c8d3[_0xfa1f('0x15')][_0xfa1f('0x17')]);}logger['error'](_0xfa1f('0x12'),_0x2e54a5,_0x35c8d3[_0xfa1f('0x15')][_0xfa1f('0x17')]);return _0x3b46fa(_0x35c8d3[_0xfa1f('0x15')][_0xfa1f('0x17')]);}else{logger[_0xfa1f('0x11')](_0xfa1f('0x12'),_0x2e54a5,_0xfa1f('0x14'));_0x3b46fa(_0x35c8d3['result'][_0xfa1f('0x17')]);}})['catch'](function(_0x4673fe){logger[_0xfa1f('0x15')]('CmList,\x20%s,\x20%s',_0x2e54a5,_0x4673fe);_0x235f89(_0x4673fe);});});} \ No newline at end of file +var _0x9581=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring'];(function(_0x4d7df6,_0x3f6139){var _0x4c0d29=function(_0x12ae02){while(--_0x12ae02){_0x4d7df6['push'](_0x4d7df6['shift']());}};_0x4c0d29(++_0x3f6139);}(_0x9581,0xef));var _0x1958=function(_0x25be10,_0x59ecda){_0x25be10=_0x25be10-0x0;var _0x12a4b0=_0x9581[_0x25be10];return _0x12a4b0;};'use strict';var _=require(_0x1958('0x0'));var util=require(_0x1958('0x1'));var moment=require(_0x1958('0x2'));var BPromise=require('bluebird');var rs=require(_0x1958('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1958('0x4'))['db'];var utils=require(_0x1958('0x5'));var logger=require('../../config/logger')(_0x1958('0x6'));var config=require('../../config/environment');var jayson=require(_0x1958('0x7'));var client=jayson[_0x1958('0x8')][_0x1958('0x9')]({'port':0x232a});config['redis']=_[_0x1958('0xa')](config[_0x1958('0xb')],{'host':_0x1958('0xc'),'port':0x18eb});var socket=require(_0x1958('0xd'))(new Redis(config[_0x1958('0xb')]));require(_0x1958('0xe'))[_0x1958('0xf')](socket);function respondWithRpcPromise(_0xfd0093,_0xd98333,_0x4a7f6b){return new BPromise(function(_0x54796c,_0xb854ca){return client[_0x1958('0x10')](_0xfd0093,_0x4a7f6b)[_0x1958('0x11')](function(_0x48a558){logger['info'](_0x1958('0x12'),_0xd98333,_0x1958('0x13'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0xd98333,_0x1958('0x13'),JSON[_0x1958('0x14')](_0x48a558));if(_0x48a558[_0x1958('0x15')]){if(_0x48a558[_0x1958('0x15')][_0x1958('0x16')]===0x1f4){logger[_0x1958('0x15')](_0x1958('0x12'),_0xd98333,_0x48a558[_0x1958('0x15')][_0x1958('0x17')]);return _0xb854ca(_0x48a558[_0x1958('0x15')]['message']);}logger[_0x1958('0x15')]('CmList,\x20%s,\x20%s',_0xd98333,_0x48a558['error'][_0x1958('0x17')]);return _0x54796c(_0x48a558['error'][_0x1958('0x17')]);}else{logger[_0x1958('0x18')](_0x1958('0x12'),_0xd98333,'request\x20sent');_0x54796c(_0x48a558[_0x1958('0x19')][_0x1958('0x17')]);}})[_0x1958('0x1a')](function(_0x4644f4){logger[_0x1958('0x15')](_0x1958('0x12'),_0xd98333,_0x4644f4);_0xb854ca(_0x4644f4);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4741964..06b1f9b 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 _0x50bd=['update','emit','removeListener','register','length','cmList:','./cmList.events','save'];(function(_0x3708f4,_0x3afe3f){var _0x4e40d9=function(_0x24f33e){while(--_0x24f33e){_0x3708f4['push'](_0x3708f4['shift']());}};_0x4e40d9(++_0x3afe3f);}(_0x50bd,0x186));var _0xd50b=function(_0x2bded2,_0x22495c){_0x2bded2=_0x2bded2-0x0;var _0x3d2be0=_0x50bd[_0x2bded2];return _0x3d2be0;};'use strict';var CmListEvents=require(_0xd50b('0x0'));var events=[_0xd50b('0x1'),'remove',_0xd50b('0x2')];function createListener(_0x28196e,_0x3fa6f2){return function(_0x5ddff1){_0x3fa6f2[_0xd50b('0x3')](_0x28196e,_0x5ddff1);};}function removeListener(_0x33c2bc,_0x5e883a){return function(){CmListEvents[_0xd50b('0x4')](_0x33c2bc,_0x5e883a);};}exports[_0xd50b('0x5')]=function(_0x448903){for(var _0x12ba0e=0x0,_0x165589=events[_0xd50b('0x6')];_0x12ba0e<_0x165589;_0x12ba0e++){var _0xdafd93=events[_0x12ba0e];var _0x3e56b5=createListener(_0xd50b('0x7')+_0xdafd93,_0x448903);CmListEvents['on'](_0xdafd93,_0x3e56b5);}}; \ No newline at end of file +var _0x7da8=['./cmList.events','save','remove','removeListener','register','cmList:'];(function(_0x40029c,_0x3f1765){var _0x31fd78=function(_0x27d18c){while(--_0x27d18c){_0x40029c['push'](_0x40029c['shift']());}};_0x31fd78(++_0x3f1765);}(_0x7da8,0x150));var _0x87da=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7da8[_0x6131cd];return _0x47e916;};'use strict';var CmListEvents=require(_0x87da('0x0'));var events=[_0x87da('0x1'),_0x87da('0x2'),'update'];function createListener(_0x282fc2,_0x5c36d9){return function(_0x4596ae){_0x5c36d9['emit'](_0x282fc2,_0x4596ae);};}function removeListener(_0x4b3db1,_0x22a5f7){return function(){CmListEvents[_0x87da('0x3')](_0x4b3db1,_0x22a5f7);};}exports[_0x87da('0x4')]=function(_0x65bc61){for(var _0x434709=0x0,_0x4bd391=events['length'];_0x434709<_0x4bd391;_0x434709++){var _0x2384d3=events[_0x434709];var _0x1a2f72=createListener(_0x87da('0x5')+_0x2384d3,_0x65bc61);CmListEvents['on'](_0x2384d3,_0x1a2f72);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7f22bc7..0a3965e 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 _0xf930=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x1c274a,_0x2f83e5){var _0x4fe3b1=function(_0x4aa798){while(--_0x4aa798){_0x1c274a['push'](_0x1c274a['shift']());}};_0x4fe3b1(++_0x2f83e5);}(_0xf930,0x15b));var _0x0f93=function(_0xdedd50,_0x228ede){_0xdedd50=_0xdedd50-0x0;var _0x4aada7=_0xf930[_0xdedd50];return _0x4aada7;};'use strict';var multer=require(_0x0f93('0x0'));var util=require(_0x0f93('0x1'));var path=require(_0x0f93('0x2'));var timeout=require(_0x0f93('0x3'));var express=require(_0x0f93('0x4'));var router=express['Router']();var fs_extra=require(_0x0f93('0x5'));var auth=require(_0x0f93('0x6'));var interaction=require(_0x0f93('0x7'));var config=require(_0x0f93('0x8'));var controller=require(_0x0f93('0x9'));router[_0x0f93('0xa')]('/',auth[_0x0f93('0xb')](),controller['index']);router[_0x0f93('0xa')](_0x0f93('0xc'),auth[_0x0f93('0xb')](),controller[_0x0f93('0xd')]);router[_0x0f93('0xa')](_0x0f93('0xe'),auth[_0x0f93('0xb')](),controller[_0x0f93('0xf')]);router[_0x0f93('0xa')](_0x0f93('0x10'),auth['isAuthenticated'](),controller[_0x0f93('0x11')]);router[_0x0f93('0xa')](_0x0f93('0x12'),auth[_0x0f93('0xb')](),controller['getDispositions']);router['get'](_0x0f93('0x13'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x14')]);router[_0x0f93('0xa')](_0x0f93('0x15'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x16')]);router['get'](_0x0f93('0x17'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x18')]);router[_0x0f93('0xa')](_0x0f93('0x19'),auth['isAuthenticated'](),controller[_0x0f93('0x1a')]);router['post']('/',auth[_0x0f93('0xb')](),controller[_0x0f93('0x1b')]);router[_0x0f93('0x1c')](_0x0f93('0x12'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x1d')]);router[_0x0f93('0x1c')](_0x0f93('0x13'),auth['isAuthenticated'](),controller['addContacts']);router[_0x0f93('0x1c')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0f93('0x1e')]);router[_0x0f93('0x1c')](_0x0f93('0x19'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x1f')]);router[_0x0f93('0x20')](_0x0f93('0x10'),auth['isAuthenticated'](),controller[_0x0f93('0x21')]);router[_0x0f93('0x22')](_0x0f93('0x10'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x23')]);router[_0x0f93('0x22')]('/:id/dispositions',auth[_0x0f93('0xb')](),controller[_0x0f93('0x24')]);router[_0x0f93('0x22')](_0x0f93('0x19'),auth[_0x0f93('0xb')](),controller[_0x0f93('0x25')]);module[_0x0f93('0x26')]=router; \ No newline at end of file +var _0x2874=['/:id','/:id/dispositions','getContacts','/:id/contacts/csv','getContactsCsv','getAgents','post','create','/:id/fields','addCustomField','/:id/users','addAgents','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields'];(function(_0x1bfbdb,_0x34ad2b){var _0x7a6811=function(_0x5960f8){while(--_0x5960f8){_0x1bfbdb['push'](_0x1bfbdb['shift']());}};_0x7a6811(++_0x34ad2b);}(_0x2874,0x150));var _0x4287=function(_0x2a5042,_0x307d04){_0x2a5042=_0x2a5042-0x0;var _0x4bc22f=_0x2874[_0x2a5042];return _0x4bc22f;};'use strict';var multer=require(_0x4287('0x0'));var util=require(_0x4287('0x1'));var path=require(_0x4287('0x2'));var timeout=require(_0x4287('0x3'));var express=require(_0x4287('0x4'));var router=express[_0x4287('0x5')]();var fs_extra=require(_0x4287('0x6'));var auth=require(_0x4287('0x7'));var interaction=require(_0x4287('0x8'));var config=require('../../config/environment');var controller=require(_0x4287('0x9'));router[_0x4287('0xa')]('/',auth[_0x4287('0xb')](),controller[_0x4287('0xc')]);router[_0x4287('0xa')](_0x4287('0xd'),auth[_0x4287('0xb')](),controller[_0x4287('0xe')]);router[_0x4287('0xa')](_0x4287('0xf'),auth[_0x4287('0xb')](),controller['getGlobalCustomFields']);router[_0x4287('0xa')](_0x4287('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x4287('0xa')](_0x4287('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x4287('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x4287('0x12')]);router[_0x4287('0xa')](_0x4287('0x13'),auth['isAuthenticated'](),controller[_0x4287('0x14')]);router['get']('/:id/fields',auth[_0x4287('0xb')](),controller['getCustomFields']);router['get']('/:id/users',auth[_0x4287('0xb')](),controller[_0x4287('0x15')]);router[_0x4287('0x16')]('/',auth['isAuthenticated'](),controller[_0x4287('0x17')]);router[_0x4287('0x16')]('/:id/dispositions',auth[_0x4287('0xb')](),controller['addDisposition']);router['post']('/:id/contacts',auth[_0x4287('0xb')](),controller['addContacts']);router[_0x4287('0x16')](_0x4287('0x18'),auth['isAuthenticated'](),controller[_0x4287('0x19')]);router[_0x4287('0x16')](_0x4287('0x1a'),auth[_0x4287('0xb')](),controller[_0x4287('0x1b')]);router['put'](_0x4287('0x10'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4287('0x10'),auth[_0x4287('0xb')](),controller[_0x4287('0x1c')]);router['delete'](_0x4287('0x11'),auth[_0x4287('0xb')](),controller['removeDispositions']);router[_0x4287('0x1d')]('/:id/users',auth[_0x4287('0xb')](),controller[_0x4287('0x1e')]);module[_0x4287('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 69f643a..d55307d 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 _0x395c=['sequelize','getDataValue','STRING'];(function(_0x18b55d,_0x47906b){var _0x125244=function(_0x4a80b0){while(--_0x4a80b0){_0x18b55d['push'](_0x18b55d['shift']());}};_0x125244(++_0x47906b);}(_0x395c,0x1bc));var _0xc395=function(_0x26105f,_0x6708b2){_0x26105f=_0x26105f-0x0;var _0x56453d=_0x395c[_0x26105f];return _0x56453d;};'use strict';var Sequelize=require(_0xc395('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x43eab7){return this[_0xc395('0x1')]('field');}},'field':{'type':Sequelize[_0xc395('0x2')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xe60a=['STRING','sequelize','exports','getDataValue','field'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xe60a,0x1a5));var _0xae60=function(_0x8d3446,_0x2cadaf){_0x8d3446=_0x8d3446-0x0;var _0x5650f3=_0xe60a[_0x8d3446];return _0x5650f3;};'use strict';var Sequelize=require(_0xae60('0x0'));module[_0xae60('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3f7075){return this[_0xae60('0x2')](_0xae60('0x3'));}},'field':{'type':Sequelize[_0xae60('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xae60('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xae60('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 8db82dc..c585127 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1091be,_0x2e4b10){var _0x275a07=function(_0x3b9448){while(--_0x3b9448){_0x1091be['push'](_0x1091be['shift']());}};_0x275a07(++_0x2e4b10);}(_0x7a54,0x106));var _0x47a5=function(_0x83bfcd,_0x2fe380){_0x83bfcd=_0x83bfcd-0x0;var _0x109ecf=_0x7a54[_0x83bfcd];return _0x109ecf;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x208941,_0x27743a){var _0x491a5d=function(_0xe52ebc){while(--_0xe52ebc){_0x208941['push'](_0x208941['shift']());}};_0x491a5d(++_0x27743a);}(_0x7a54,0x106));var _0x47a5=function(_0x407ebe,_0x2e3737){_0x407ebe=_0x407ebe-0x0;var _0x22bdf7=_0x7a54[_0x407ebe];return _0x22bdf7;};'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 4546882..00b1f88 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 _0x8c8a=['api','bluebird','request-promise','rimraf','../../config/environment','./condition.attributes','Condition','tools_conditions','lodash','../../config/logger'];(function(_0x10d3c2,_0x1f5142){var _0x4208aa=function(_0x2e1ff9){while(--_0x2e1ff9){_0x10d3c2['push'](_0x10d3c2['shift']());}};_0x4208aa(++_0x1f5142);}(_0x8c8a,0x102));var _0xa8c8=function(_0x8fb7a4,_0x607700){_0x8fb7a4=_0x8fb7a4-0x0;var _0x1fdca2=_0x8c8a[_0x8fb7a4];return _0x1fdca2;};'use strict';var _=require(_0xa8c8('0x0'));var util=require('util');var logger=require(_0xa8c8('0x1'))(_0xa8c8('0x2'));var moment=require('moment');var BPromise=require(_0xa8c8('0x3'));var rp=require(_0xa8c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa8c8('0x5'));var config=require(_0xa8c8('0x6'));var attributes=require(_0xa8c8('0x7'));module['exports']=function(_0x3841d9,_0x11446e){return _0x3841d9['define'](_0xa8c8('0x8'),attributes,{'tableName':_0xa8c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xceb7=['../../config/environment','exports','define','Condition','tools_conditions','lodash','api','moment','bluebird','path'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xceb7,0x1a9));var _0x7ceb=function(_0x3033b9,_0x56adf4){_0x3033b9=_0x3033b9-0x0;var _0x293f8b=_0xceb7[_0x3033b9];return _0x293f8b;};'use strict';var _=require(_0x7ceb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7ceb('0x1'));var moment=require(_0x7ceb('0x2'));var BPromise=require(_0x7ceb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ceb('0x4'));var rimraf=require('rimraf');var config=require(_0x7ceb('0x5'));var attributes=require('./condition.attributes');module[_0x7ceb('0x6')]=function(_0x44e64d,_0x48325b){return _0x44e64d[_0x7ceb('0x7')](_0x7ceb('0x8'),attributes,{'tableName':_0x7ceb('0x9'),'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 bcb47ab..8f8c3e0 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 _0x81f1=['request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4c3bd1,_0x306f1f){var _0x15d6f8=function(_0x54bce4){while(--_0x54bce4){_0x4c3bd1['push'](_0x4c3bd1['shift']());}};_0x15d6f8(++_0x306f1f);}(_0x81f1,0x1ac));var _0x181f=function(_0x4cb5b5,_0x2b1c28){_0x4cb5b5=_0x4cb5b5-0x0;var _0x58d69f=_0x81f1[_0x4cb5b5];return _0x58d69f;};'use strict';var _=require(_0x181f('0x0'));var util=require(_0x181f('0x1'));var moment=require(_0x181f('0x2'));var BPromise=require(_0x181f('0x3'));var rs=require(_0x181f('0x4'));var fs=require('fs');var Redis=require(_0x181f('0x5'));var db=require(_0x181f('0x6'))['db'];var utils=require(_0x181f('0x7'));var logger=require(_0x181f('0x8'))(_0x181f('0x9'));var config=require(_0x181f('0xa'));var jayson=require(_0x181f('0xb'));var client=jayson['client'][_0x181f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x235340,_0x3b12f7,_0x166c09){return new BPromise(function(_0x18df8e,_0x278887){return client[_0x181f('0xd')](_0x235340,_0x166c09)[_0x181f('0xe')](function(_0xdcaa34){logger[_0x181f('0xf')](_0x181f('0x10'),_0x3b12f7,'request\x20sent');logger[_0x181f('0x11')](_0x181f('0x12'),_0x3b12f7,'request\x20sent',JSON['stringify'](_0xdcaa34));if(_0xdcaa34[_0x181f('0x13')]){if(_0xdcaa34[_0x181f('0x13')][_0x181f('0x14')]===0x1f4){logger['error'](_0x181f('0x10'),_0x3b12f7,_0xdcaa34[_0x181f('0x13')][_0x181f('0x15')]);return _0x278887(_0xdcaa34[_0x181f('0x13')][_0x181f('0x15')]);}logger[_0x181f('0x13')](_0x181f('0x10'),_0x3b12f7,_0xdcaa34['error'][_0x181f('0x15')]);return _0x18df8e(_0xdcaa34[_0x181f('0x13')][_0x181f('0x15')]);}else{logger['info'](_0x181f('0x10'),_0x3b12f7,_0x181f('0x16'));_0x18df8e(_0xdcaa34[_0x181f('0x17')][_0x181f('0x15')]);}})[_0x181f('0x18')](function(_0x48348d){logger[_0x181f('0x13')](_0x181f('0x10'),_0x3b12f7,_0x48348d);_0x278887(_0x48348d);});});} \ No newline at end of file +var _0xd710=['then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x40e13e,_0x376d13){var _0x5db39e=function(_0x2dc3f6){while(--_0x2dc3f6){_0x40e13e['push'](_0x40e13e['shift']());}};_0x5db39e(++_0x376d13);}(_0xd710,0xd4));var _0x0d71=function(_0x27e6ce,_0x179ae4){_0x27e6ce=_0x27e6ce-0x0;var _0x310a3f=_0xd710[_0x27e6ce];return _0x310a3f;};'use strict';var _=require(_0x0d71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0d71('0x1'));var rs=require(_0x0d71('0x2'));var fs=require('fs');var Redis=require(_0x0d71('0x3'));var db=require(_0x0d71('0x4'))['db'];var utils=require(_0x0d71('0x5'));var logger=require(_0x0d71('0x6'))(_0x0d71('0x7'));var config=require(_0x0d71('0x8'));var jayson=require(_0x0d71('0x9'));var client=jayson[_0x0d71('0xa')][_0x0d71('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x55ddce,_0x59d09e,_0x2e0d85){return new BPromise(function(_0x5d799a,_0x408848){return client[_0x0d71('0xc')](_0x55ddce,_0x2e0d85)[_0x0d71('0xd')](function(_0x12ccfa){logger[_0x0d71('0xe')]('Condition,\x20%s,\x20%s',_0x59d09e,_0x0d71('0xf'));logger[_0x0d71('0x10')](_0x0d71('0x11'),_0x59d09e,'request\x20sent',JSON[_0x0d71('0x12')](_0x12ccfa));if(_0x12ccfa[_0x0d71('0x13')]){if(_0x12ccfa[_0x0d71('0x13')][_0x0d71('0x14')]===0x1f4){logger[_0x0d71('0x13')](_0x0d71('0x15'),_0x59d09e,_0x12ccfa['error'][_0x0d71('0x16')]);return _0x408848(_0x12ccfa[_0x0d71('0x13')][_0x0d71('0x16')]);}logger[_0x0d71('0x13')]('Condition,\x20%s,\x20%s',_0x59d09e,_0x12ccfa[_0x0d71('0x13')][_0x0d71('0x16')]);return _0x5d799a(_0x12ccfa[_0x0d71('0x13')][_0x0d71('0x16')]);}else{logger[_0x0d71('0xe')](_0x0d71('0x15'),_0x59d09e,'request\x20sent');_0x5d799a(_0x12ccfa[_0x0d71('0x17')][_0x0d71('0x16')]);}})[_0x0d71('0x18')](function(_0x3e28d7){logger[_0x0d71('0x13')](_0x0d71('0x15'),_0x59d09e,_0x3e28d7);_0x408848(_0x3e28d7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5437a3b..b562933 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 _0x5292=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x5292,0x100));var _0x2529=function(_0x3510c2,_0x396bf6){_0x3510c2=_0x3510c2-0x0;var _0x191fb0=_0x5292[_0x3510c2];return _0x191fb0;};'use strict';var multer=require('multer');var util=require(_0x2529('0x0'));var path=require(_0x2529('0x1'));var timeout=require(_0x2529('0x2'));var express=require(_0x2529('0x3'));var router=express[_0x2529('0x4')]();var fs_extra=require(_0x2529('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2529('0x6'));var config=require(_0x2529('0x7'));var controller=require(_0x2529('0x8'));router[_0x2529('0x9')]('/:id',auth[_0x2529('0xa')](),controller[_0x2529('0xb')]);router[_0x2529('0xc')](_0x2529('0xd'),auth[_0x2529('0xa')](),controller[_0x2529('0xe')]);module[_0x2529('0xf')]=router; \ No newline at end of file +var _0x2f80=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','update','isAuthenticated'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x2f80,0x1f2));var _0x02f8=function(_0x489bc1,_0x31584a){_0x489bc1=_0x489bc1-0x0;var _0x46b045=_0x2f80[_0x489bc1];return _0x46b045;};'use strict';var multer=require(_0x02f8('0x0'));var util=require(_0x02f8('0x1'));var path=require(_0x02f8('0x2'));var timeout=require(_0x02f8('0x3'));var express=require(_0x02f8('0x4'));var router=express[_0x02f8('0x5')]();var fs_extra=require(_0x02f8('0x6'));var auth=require(_0x02f8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x02f8('0x8'));var controller=require(_0x02f8('0x9'));router[_0x02f8('0xa')](_0x02f8('0xb'),auth['isAuthenticated'](),controller[_0x02f8('0xc')]);router['delete']('/:id',auth[_0x02f8('0xd')](),controller[_0x02f8('0xe')]);module[_0x02f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 7a4e5f4..d59656f 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 _0xe444=['STRING','INTEGER','sequelize'];(function(_0x53efdd,_0x1d00ac){var _0xa47459=function(_0x3e76b0){while(--_0x3e76b0){_0x53efdd['push'](_0x53efdd['shift']());}};_0xa47459(++_0x1d00ac);}(_0xe444,0x16a));var _0x4e44=function(_0x448199,_0x179f50){_0x448199=_0x448199-0x0;var _0x551d83=_0xe444[_0x448199];return _0x551d83;};'use strict';var Sequelize=require(_0x4e44('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e44('0x1')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4e44('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4e44('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x1f15=['exports','INTEGER','sequelize'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1f15,0xe6));var _0x51f1=function(_0x60deb6,_0x1e9225){_0x60deb6=_0x60deb6-0x0;var _0x4df963=_0x1f15[_0x60deb6];return _0x4df963;};'use strict';var Sequelize=require(_0x51f1('0x0'));module[_0x51f1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x51f1('0x2')],'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 a4b3493..6d534be 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(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xd914,0x17f));var _0x4d91=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xd914[_0x13b7fd];return _0x32a74a;};'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 _0xfcbb=['find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','index','map','ContactItemType','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes'];(function(_0x23bbe8,_0x4d5924){var _0x4b6111=function(_0x4786c3){while(--_0x4786c3){_0x23bbe8['push'](_0x23bbe8['shift']());}};_0x4b6111(++_0x4d5924);}(_0xfcbb,0x10d));var _0xbfcb=function(_0xc7b21e,_0xdf536f){_0xc7b21e=_0xc7b21e-0x0;var _0x6c013=_0xfcbb[_0xc7b21e];return _0x6c013;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){var _0x11f6f7=_0x19616c[_0xbfcb('0x28')]({'plain':!![]});var _0x1ca8c3=_0xbfcb('0x29');return db[_0xbfcb('0x2a')][_0xbfcb('0x27')]({'where':{'type':_0x1ca8c3,'resourceId':_0x11f6f7['id']}})[_0xbfcb('0x26')](function(){return _0x19616c;});})[_0xbfcb('0x26')](function(){_0xd4d29['status'](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x2881f8,_0x4cf7ca){return function(_0x64a69){if(!_0x64a69){_0x2881f8[_0xbfcb('0x1a')](0x194);}return _0x64a69;};}function handleError(_0x781773,_0xa57d71){_0xa57d71=_0xa57d71||0x1f4;return function(_0xf4b944){logger[_0xbfcb('0x2b')](_0xf4b944[_0xbfcb('0x2c')]);if(_0xf4b944[_0xbfcb('0x2d')]){delete _0xf4b944[_0xbfcb('0x2d')];}_0x781773[_0xbfcb('0x1c')](_0xa57d71)['send'](_0xf4b944);};}exports[_0xbfcb('0x2e')]=function(_0x3aa3cd,_0x43c3c3){var _0x43de3c={},_0x1f45fc={},_0x14f6f5={'count':0x0,'rows':[]};var _0x286fb7=_[_0xbfcb('0x2f')](db[_0xbfcb('0x30')]['rawAttributes'],function(_0x297f72){return{'name':_0x297f72[_0xbfcb('0x31')],'type':_0x297f72[_0xbfcb('0x32')][_0xbfcb('0x33')]};});_0x1f45fc['model']=_['map'](_0x286fb7,_0xbfcb('0x2d'));_0x1f45fc[_0xbfcb('0x34')]=_[_0xbfcb('0x35')](_0x3aa3cd[_0xbfcb('0x34')]);_0x1f45fc[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1f45fc[_0xbfcb('0x38')],_0x1f45fc['query']);_0x43de3c['attributes']=_['intersection'](_0x1f45fc[_0xbfcb('0x38')],qs['fields'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0x43de3c['attributes']=_0x43de3c['attributes'][_0xbfcb('0x3a')]?_0x43de3c[_0xbfcb('0x3b')]:_0x1f45fc[_0xbfcb('0x38')];if(!_0x3aa3cd[_0xbfcb('0x34')]['hasOwnProperty'](_0xbfcb('0x3c'))){_0x43de3c[_0xbfcb('0x20')]=qs['limit'](_0x3aa3cd['query'][_0xbfcb('0x20')]);_0x43de3c['offset']=qs['offset'](_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x1e')]);}_0x43de3c[_0xbfcb('0x3d')]=qs[_0xbfcb('0x3e')](_0x3aa3cd['query'][_0xbfcb('0x3e')]);_0x43de3c[_0xbfcb('0x3f')]=qs[_0xbfcb('0x36')](_[_0xbfcb('0x40')](_0x3aa3cd[_0xbfcb('0x34')],_0x1f45fc[_0xbfcb('0x36')]),_0x286fb7);if(_0x3aa3cd['query'][_0xbfcb('0x41')]){_0x43de3c['where']=_[_0xbfcb('0x42')](_0x43de3c['where'],{'$or':_[_0xbfcb('0x2f')](_0x286fb7,function(_0x2e4406){if(_0x2e4406[_0xbfcb('0x32')]!==_0xbfcb('0x43')){var _0x434fcd={};_0x434fcd[_0x2e4406[_0xbfcb('0x2d')]]={'$like':'%'+_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x41')]+'%'};return _0x434fcd;}})});}_0x43de3c=_[_0xbfcb('0x42')]({},_0x43de3c,_0x3aa3cd[_0xbfcb('0x44')]);var _0x55a95f={'where':_0x43de3c[_0xbfcb('0x3f')]};return db[_0xbfcb('0x30')]['count'](_0x55a95f)[_0xbfcb('0x26')](function(_0x306ea4){_0x14f6f5[_0xbfcb('0x21')]=_0x306ea4;if(_0x3aa3cd[_0xbfcb('0x34')][_0xbfcb('0x45')]){_0x43de3c[_0xbfcb('0x46')]=[{'all':!![]}];}return db['ContactItemType'][_0xbfcb('0x47')](_0x43de3c);})[_0xbfcb('0x26')](function(_0x10ea4f){_0x14f6f5['rows']=_0x10ea4f;return _0x14f6f5;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x43c3c3,_0x43de3c))[_0xbfcb('0x48')](handleError(_0x43c3c3,null));};exports[_0xbfcb('0x49')]=function(_0x542d90,_0x5aa9c9){var _0xd7cb39={'raw':!![],'where':{'id':_0x542d90['params']['id']}},_0x58337d={};_0x58337d[_0xbfcb('0x38')]=_[_0xbfcb('0x35')](db['ContactItemType'][_0xbfcb('0x4a')]);_0x58337d[_0xbfcb('0x34')]=_['keys'](_0x542d90[_0xbfcb('0x34')]);_0x58337d[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],_0x58337d[_0xbfcb('0x34')]);_0xd7cb39[_0xbfcb('0x3b')]=_[_0xbfcb('0x37')](_0x58337d[_0xbfcb('0x38')],qs[_0xbfcb('0x39')](_0x542d90[_0xbfcb('0x34')][_0xbfcb('0x39')]));_0xd7cb39[_0xbfcb('0x3b')]=_0xd7cb39['attributes'][_0xbfcb('0x3a')]?_0xd7cb39[_0xbfcb('0x3b')]:_0x58337d[_0xbfcb('0x38')];if(_0x542d90['query'][_0xbfcb('0x45')]){_0xd7cb39['include']=[{'all':!![]}];}_0xd7cb39=_['merge']({},_0xd7cb39,_0x542d90[_0xbfcb('0x44')]);return db[_0xbfcb('0x30')][_0xbfcb('0x4b')](_0xd7cb39)['then'](handleEntityNotFound(_0x5aa9c9,null))[_0xbfcb('0x26')](respondWithResult(_0x5aa9c9,null))['catch'](handleError(_0x5aa9c9,null));};exports['create']=function(_0x33725a,_0x588d32){return db[_0xbfcb('0x30')][_0xbfcb('0x4c')](_0x33725a['body'],{})[_0xbfcb('0x26')](function(_0x5d942f){var _0x8347be=_0x33725a['user'][_0xbfcb('0x28')]({'plain':!![]});if(!_0x8347be)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8347be[_0xbfcb('0x4d')]===_0xbfcb('0x4e')){var _0x5efbe1=_0x5d942f[_0xbfcb('0x28')]({'plain':!![]});var _0x547169='ContactItemTypes';return db[_0xbfcb('0x4f')][_0xbfcb('0x4b')]({'where':{'name':_0x547169,'userProfileId':_0x8347be[_0xbfcb('0x50')]},'raw':!![]})['then'](function(_0x495c34){if(_0x495c34&&_0x495c34[_0xbfcb('0x51')]===0x0){return db[_0xbfcb('0x2a')][_0xbfcb('0x4c')]({'name':_0x5efbe1[_0xbfcb('0x2d')],'resourceId':_0x5efbe1['id'],'type':_0x495c34[_0xbfcb('0x2d')],'sectionId':_0x495c34['id']},{})['then'](function(){return _0x5d942f;});}else{return _0x5d942f;}})[_0xbfcb('0x48')](function(_0x37a7e8){logger[_0xbfcb('0x2b')](_0xbfcb('0x52'),_0x37a7e8);throw _0x37a7e8;});}return _0x5d942f;})['then'](respondWithResult(_0x588d32,0xc9))['catch'](handleError(_0x588d32,null));};exports[_0xbfcb('0x25')]=function(_0x50f9f7,_0x9cc2bd){if(_0x50f9f7['body']['id']){delete _0x50f9f7['body']['id'];}return db[_0xbfcb('0x30')]['find']({'where':{'id':_0x50f9f7['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x9cc2bd,null))['then'](saveUpdates(_0x50f9f7[_0xbfcb('0x53')],null))['then'](respondWithResult(_0x9cc2bd,null))[_0xbfcb('0x48')](handleError(_0x9cc2bd,null));};exports[_0xbfcb('0x27')]=function(_0x593f4e,_0x35cd27){return db[_0xbfcb('0x30')][_0xbfcb('0x4b')]({'where':{'id':_0x593f4e['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x35cd27,null))[_0xbfcb('0x26')](db[_0xbfcb('0x54')][_0xbfcb('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x593f4e[_0xbfcb('0x55')]['id']}}))[_0xbfcb('0x26')](removeEntity(_0x35cd27,null))[_0xbfcb('0x48')](handleError(_0x35cd27,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index b648a87..5bb3a30 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 _0x2669=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x333398,_0x410dd0){var _0x5ae71f=function(_0x5d9777){while(--_0x5d9777){_0x333398['push'](_0x333398['shift']());}};_0x5ae71f(++_0x410dd0);}(_0x2669,0x1ea));var _0x9266=function(_0x2185f1,_0x540ad2){_0x2185f1=_0x2185f1-0x0;var _0xf85844=_0x2669[_0x2185f1];return _0xf85844;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9266('0x0'))('api');var moment=require(_0x9266('0x1'));var BPromise=require(_0x9266('0x2'));var rp=require(_0x9266('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9266('0x4'));var config=require(_0x9266('0x5'));var attributes=require(_0x9266('0x6'));module[_0x9266('0x7')]=function(_0x312fdb,_0x35d9ab){return _0x312fdb[_0x9266('0x8')](_0x9266('0x9'),attributes,{'tableName':_0x9266('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x42bb=['bluebird','path','rimraf','../../config/environment','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','moment'];(function(_0x3226e8,_0x5ebfcc){var _0x35ef62=function(_0x4a2f31){while(--_0x4a2f31){_0x3226e8['push'](_0x3226e8['shift']());}};_0x35ef62(++_0x5ebfcc);}(_0x42bb,0x129));var _0xb42b=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x42bb[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xb42b('0x0'));var util=require('util');var logger=require(_0xb42b('0x1'))('api');var moment=require(_0xb42b('0x2'));var BPromise=require(_0xb42b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb42b('0x4'));var rimraf=require(_0xb42b('0x5'));var config=require(_0xb42b('0x6'));var attributes=require('./contactItemType.attributes');module['exports']=function(_0x2b3f30,_0x30cd63){return _0x2b3f30[_0xb42b('0x7')](_0xb42b('0x8'),attributes,{'tableName':_0xb42b('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 c10fb52..569a340 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 _0x0cae=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0x0cae,0xa4));var _0xe0ca=function(_0x4b7ea9,_0x37aa4c){_0x4b7ea9=_0x4b7ea9-0x0;var _0x385692=_0x0cae[_0x4b7ea9];return _0x385692;};'use strict';var _=require(_0xe0ca('0x0'));var util=require(_0xe0ca('0x1'));var moment=require('moment');var BPromise=require(_0xe0ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0ca('0x3'));var db=require(_0xe0ca('0x4'))['db'];var utils=require(_0xe0ca('0x5'));var logger=require(_0xe0ca('0x6'))(_0xe0ca('0x7'));var config=require(_0xe0ca('0x8'));var jayson=require(_0xe0ca('0x9'));var client=jayson[_0xe0ca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213b96,_0x5c0a0d,_0xe5b6dc){return new BPromise(function(_0x56fd34,_0x53a0e4){return client[_0xe0ca('0xb')](_0x213b96,_0xe5b6dc)[_0xe0ca('0xc')](function(_0x4f5d86){logger[_0xe0ca('0xd')](_0xe0ca('0xe'),_0x5c0a0d,_0xe0ca('0xf'));logger[_0xe0ca('0x10')](_0xe0ca('0x11'),_0x5c0a0d,'request\x20sent',JSON[_0xe0ca('0x12')](_0x4f5d86));if(_0x4f5d86['error']){if(_0x4f5d86[_0xe0ca('0x13')]['code']===0x1f4){logger['error'](_0xe0ca('0xe'),_0x5c0a0d,_0x4f5d86[_0xe0ca('0x13')]['message']);return _0x53a0e4(_0x4f5d86[_0xe0ca('0x13')][_0xe0ca('0x14')]);}logger['error'](_0xe0ca('0xe'),_0x5c0a0d,_0x4f5d86['error'][_0xe0ca('0x14')]);return _0x56fd34(_0x4f5d86[_0xe0ca('0x13')][_0xe0ca('0x14')]);}else{logger[_0xe0ca('0xd')](_0xe0ca('0xe'),_0x5c0a0d,'request\x20sent');_0x56fd34(_0x4f5d86[_0xe0ca('0x15')][_0xe0ca('0x14')]);}})[_0xe0ca('0x16')](function(_0xe72f04){logger[_0xe0ca('0x13')](_0xe0ca('0xe'),_0x5c0a0d,_0xe72f04);_0x53a0e4(_0xe72f04);});});} \ No newline at end of file +var _0x50c2=['rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x50c2,0x127));var _0x250c=function(_0x418cbb,_0x351848){_0x418cbb=_0x418cbb-0x0;var _0x202f3b=_0x50c2[_0x418cbb];return _0x202f3b;};'use strict';var _=require('lodash');var util=require(_0x250c('0x0'));var moment=require(_0x250c('0x1'));var BPromise=require(_0x250c('0x2'));var rs=require(_0x250c('0x3'));var fs=require('fs');var Redis=require(_0x250c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x250c('0x5'));var config=require('../../config/environment');var jayson=require(_0x250c('0x6'));var client=jayson[_0x250c('0x7')][_0x250c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x488fb1,_0xc59a11,_0x3e2125){return new BPromise(function(_0xe728ba,_0x5a8ed6){return client[_0x250c('0x9')](_0x488fb1,_0x3e2125)[_0x250c('0xa')](function(_0x21b6d4){logger[_0x250c('0xb')](_0x250c('0xc'),_0xc59a11,_0x250c('0xd'));logger[_0x250c('0xe')](_0x250c('0xf'),_0xc59a11,_0x250c('0xd'),JSON['stringify'](_0x21b6d4));if(_0x21b6d4[_0x250c('0x10')]){if(_0x21b6d4['error']['code']===0x1f4){logger[_0x250c('0x10')](_0x250c('0xc'),_0xc59a11,_0x21b6d4['error']['message']);return _0x5a8ed6(_0x21b6d4[_0x250c('0x10')]['message']);}logger[_0x250c('0x10')](_0x250c('0xc'),_0xc59a11,_0x21b6d4['error'][_0x250c('0x11')]);return _0xe728ba(_0x21b6d4[_0x250c('0x10')][_0x250c('0x11')]);}else{logger[_0x250c('0xb')](_0x250c('0xc'),_0xc59a11,_0x250c('0xd'));_0xe728ba(_0x21b6d4[_0x250c('0x12')][_0x250c('0x11')]);}})[_0x250c('0x13')](function(_0x1502d8){logger[_0x250c('0x10')](_0x250c('0xc'),_0xc59a11,_0x1502d8);_0x5a8ed6(_0x1502d8);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index ab792bf..928a9c7 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 _0x5523=['get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./contactItemType.controller'];(function(_0x1b129f,_0x6d1483){var _0x117f95=function(_0x445ad7){while(--_0x445ad7){_0x1b129f['push'](_0x1b129f['shift']());}};_0x117f95(++_0x6d1483);}(_0x5523,0x14e));var _0x3552=function(_0x34523d,_0x6aa65c){_0x34523d=_0x34523d-0x0;var _0x4f2c8f=_0x5523[_0x34523d];return _0x4f2c8f;};'use strict';var multer=require(_0x3552('0x0'));var util=require(_0x3552('0x1'));var path=require(_0x3552('0x2'));var timeout=require('connect-timeout');var express=require(_0x3552('0x3'));var router=express[_0x3552('0x4')]();var fs_extra=require(_0x3552('0x5'));var auth=require(_0x3552('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3552('0x7'));router[_0x3552('0x8')]('/',auth[_0x3552('0x9')](),controller['index']);router['get'](_0x3552('0xa'),auth[_0x3552('0x9')](),controller[_0x3552('0xb')]);router[_0x3552('0xc')]('/',auth['isAuthenticated'](),controller[_0x3552('0xd')]);router[_0x3552('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x3552('0xf')]);router[_0x3552('0x10')](_0x3552('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3552('0x11')]=router; \ No newline at end of file +var _0xdea3=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','create','/:id','update'];(function(_0x5ba84e,_0x262c3f){var _0x140133=function(_0x34c6dc){while(--_0x34c6dc){_0x5ba84e['push'](_0x5ba84e['shift']());}};_0x140133(++_0x262c3f);}(_0xdea3,0x88));var _0x3dea=function(_0x11fd0b,_0x4d9ed3){_0x11fd0b=_0x11fd0b-0x0;var _0x38c0c2=_0xdea3[_0x11fd0b];return _0x38c0c2;};'use strict';var multer=require(_0x3dea('0x0'));var util=require(_0x3dea('0x1'));var path=require('path');var timeout=require(_0x3dea('0x2'));var express=require(_0x3dea('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3dea('0x4'));var interaction=require(_0x3dea('0x5'));var config=require(_0x3dea('0x6'));var controller=require(_0x3dea('0x7'));router[_0x3dea('0x8')]('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xa')]);router[_0x3dea('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3dea('0xb')]);router[_0x3dea('0xc')]('/',auth[_0x3dea('0x9')](),controller[_0x3dea('0xd')]);router['put'](_0x3dea('0xe'),auth[_0x3dea('0x9')](),controller[_0x3dea('0xf')]);router[_0x3dea('0x10')]('/:id',auth[_0x3dea('0x9')](),controller[_0x3dea('0x11')]);module[_0x3dea('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 6862aa1..5fb99fe 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 _0xb7e7=['STRING','sequelize'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xb7e7[_0x369151];return _0x4292d5;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xb7e7[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4fb58e2..3e64f6c 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 _0xf4a8=['sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','index','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','updatedAt','body','omit','createdAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrs','attrPath','clock','attrHourFormat','value','attrTimezone','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','voice','web-report','attrReport','reportType','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./dashboard.socket','register'];(function(_0x19c001,_0x493740){var _0x392dc0=function(_0x3c6e75){while(--_0x3c6e75){_0x19c001['push'](_0x19c001['shift']());}};_0x392dc0(++_0x493740);}(_0xf4a8,0xe3));var _0x8f4a=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xf4a8[_0x2b5513];return _0x578fd2;};'use strict';var emlformat=require(_0x8f4a('0x0'));var rimraf=require(_0x8f4a('0x1'));var zipdir=require(_0x8f4a('0x2'));var jsonpatch=require(_0x8f4a('0x3'));var rp=require(_0x8f4a('0x4'));var moment=require(_0x8f4a('0x5'));var BPromise=require(_0x8f4a('0x6'));var Mustache=require(_0x8f4a('0x7'));var util=require(_0x8f4a('0x8'));var path=require('path');var sox=require(_0x8f4a('0x9'));var csv=require(_0x8f4a('0xa'));var ejs=require(_0x8f4a('0xb'));var fs=require('fs');var fs_extra=require(_0x8f4a('0xc'));var _=require(_0x8f4a('0xd'));var squel=require(_0x8f4a('0xe'));var crypto=require(_0x8f4a('0xf'));var jsforce=require(_0x8f4a('0x10'));var deskjs=require(_0x8f4a('0x11'));var toCsv=require(_0x8f4a('0xa'));var querystring=require(_0x8f4a('0x12'));var Papa=require(_0x8f4a('0x13'));var Redis=require(_0x8f4a('0x14'));var authService=require(_0x8f4a('0x15'));var qs=require(_0x8f4a('0x16'));var as=require(_0x8f4a('0x17'));var hardwareService=require(_0x8f4a('0x18'));var logger=require('../../config/logger')(_0x8f4a('0x19'));var utils=require(_0x8f4a('0x1a'));var config=require(_0x8f4a('0x1b'));var licenseUtil=require(_0x8f4a('0x1c'));var db=require(_0x8f4a('0x1d'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f4a('0x1e')]));require(_0x8f4a('0x1f'))[_0x8f4a('0x20')](socket);function respondWithStatusCode(_0x283c51,_0x268cf6){_0x268cf6=_0x268cf6||0xcc;return function(_0x54ab44){if(_0x54ab44){return _0x283c51[_0x8f4a('0x21')](_0x268cf6);}return _0x283c51[_0x8f4a('0x22')](_0x268cf6)[_0x8f4a('0x23')]();};}function respondWithResult(_0x57b88f,_0x3ffb3c){_0x3ffb3c=_0x3ffb3c||0xc8;return function(_0x5752fd){if(_0x5752fd){return _0x57b88f[_0x8f4a('0x22')](_0x3ffb3c)['json'](_0x5752fd);}};}function respondWithFilteredResult(_0x32a333,_0x581fd1){return function(_0x4bfec0){if(_0x4bfec0){var _0x18ea24=typeof _0x581fd1['offset']===_0x8f4a('0x24')&&typeof _0x581fd1[_0x8f4a('0x25')]==='undefined';var _0x35f326=_0x4bfec0[_0x8f4a('0x26')];var _0x3db195=_0x18ea24?0x0:_0x581fd1[_0x8f4a('0x27')];var _0x180f93=_0x18ea24?_0x4bfec0[_0x8f4a('0x26')]:_0x581fd1[_0x8f4a('0x27')]+_0x581fd1[_0x8f4a('0x25')];var _0x31f32b;if(_0x180f93>=_0x35f326){_0x180f93=_0x35f326;_0x31f32b=0xc8;}else{_0x31f32b=0xce;}_0x32a333[_0x8f4a('0x22')](_0x31f32b);return _0x32a333['set'](_0x8f4a('0x28'),_0x3db195+'-'+_0x180f93+'/'+_0x35f326)[_0x8f4a('0x29')](_0x4bfec0);}return null;};}function patchUpdates(_0x31110e){return function(_0x5741a8){try{jsonpatch[_0x8f4a('0x2a')](_0x5741a8,_0x31110e,!![]);}catch(_0x31ebc1){return BPromise[_0x8f4a('0x2b')](_0x31ebc1);}return _0x5741a8[_0x8f4a('0x2c')]();};}function saveUpdates(_0x15bc6c,_0x9dadf5){return function(_0x13b702){if(_0x13b702){return _0x13b702[_0x8f4a('0x2d')](_0x15bc6c)[_0x8f4a('0x2e')](function(_0x29c55a){return _0x29c55a;});}return null;};}function removeEntity(_0x410ea3,_0x44d1d0){return function(_0x527611){if(_0x527611){return _0x527611['destroy']()[_0x8f4a('0x2e')](function(){var _0xb231aa=_0x527611[_0x8f4a('0x2f')]({'plain':!![]});var _0x15765f=_0x8f4a('0x30');return db[_0x8f4a('0x31')][_0x8f4a('0x32')]({'where':{'type':_0x15765f,'resourceId':_0xb231aa['id']}})[_0x8f4a('0x2e')](function(){return _0x527611;});})['then'](function(){_0x410ea3[_0x8f4a('0x22')](0xcc)[_0x8f4a('0x23')]();});}};}function handleEntityNotFound(_0x421065,_0x18e986){return function(_0x51834c){if(!_0x51834c){_0x421065[_0x8f4a('0x21')](0x194);}return _0x51834c;};}function handleError(_0x45e4a9,_0x321fce){_0x321fce=_0x321fce||0x1f4;return function(_0x16d5cb){logger[_0x8f4a('0x33')](_0x16d5cb[_0x8f4a('0x34')]);if(_0x16d5cb[_0x8f4a('0x35')]){delete _0x16d5cb[_0x8f4a('0x35')];}_0x45e4a9[_0x8f4a('0x22')](_0x321fce)['send'](_0x16d5cb);};}exports[_0x8f4a('0x36')]=function(_0x4ebb86,_0x48ff30){var _0x7f5cec={},_0x41a722={},_0x18b108={'count':0x0,'rows':[]};var _0x32ac54=_['map'](db[_0x8f4a('0x37')][_0x8f4a('0x38')],function(_0x3335f8){return{'name':_0x3335f8[_0x8f4a('0x39')],'type':_0x3335f8[_0x8f4a('0x3a')][_0x8f4a('0x3b')]};});_0x41a722['model']=_['map'](_0x32ac54,_0x8f4a('0x35'));_0x41a722[_0x8f4a('0x3c')]=_[_0x8f4a('0x3d')](_0x4ebb86['query']);_0x41a722[_0x8f4a('0x3e')]=_['intersection'](_0x41a722['model'],_0x41a722[_0x8f4a('0x3c')]);_0x7f5cec[_0x8f4a('0x3f')]=_[_0x8f4a('0x40')](_0x41a722[_0x8f4a('0x41')],qs[_0x8f4a('0x42')](_0x4ebb86['query'][_0x8f4a('0x42')]));_0x7f5cec[_0x8f4a('0x3f')]=_0x7f5cec[_0x8f4a('0x3f')][_0x8f4a('0x43')]?_0x7f5cec[_0x8f4a('0x3f')]:_0x41a722[_0x8f4a('0x41')];if(!_0x4ebb86[_0x8f4a('0x3c')][_0x8f4a('0x44')]('nolimit')){_0x7f5cec[_0x8f4a('0x25')]=qs[_0x8f4a('0x25')](_0x4ebb86[_0x8f4a('0x3c')][_0x8f4a('0x25')]);_0x7f5cec['offset']=qs[_0x8f4a('0x27')](_0x4ebb86[_0x8f4a('0x3c')][_0x8f4a('0x27')]);}_0x7f5cec[_0x8f4a('0x45')]=qs[_0x8f4a('0x46')](_0x4ebb86[_0x8f4a('0x3c')][_0x8f4a('0x46')]);_0x7f5cec['where']=qs[_0x8f4a('0x3e')](_[_0x8f4a('0x47')](_0x4ebb86[_0x8f4a('0x3c')],_0x41a722[_0x8f4a('0x3e')]),_0x32ac54);if(_0x4ebb86[_0x8f4a('0x3c')]['filter']){_0x7f5cec[_0x8f4a('0x48')]=_[_0x8f4a('0x49')](_0x7f5cec[_0x8f4a('0x48')],{'$or':_[_0x8f4a('0x4a')](_0x32ac54,function(_0x24b8f7){if(_0x24b8f7['type']!==_0x8f4a('0x4b')){var _0x94141b={};_0x94141b[_0x24b8f7[_0x8f4a('0x35')]]={'$like':'%'+_0x4ebb86['query'][_0x8f4a('0x4c')]+'%'};return _0x94141b;}})});}_0x7f5cec=_[_0x8f4a('0x49')]({},_0x7f5cec,_0x4ebb86[_0x8f4a('0x4d')]);var _0xfc00a6={'where':_0x7f5cec['where']};return db[_0x8f4a('0x37')][_0x8f4a('0x26')](_0xfc00a6)[_0x8f4a('0x2e')](function(_0x4b0754){_0x18b108['count']=_0x4b0754;if(_0x4ebb86[_0x8f4a('0x3c')][_0x8f4a('0x4e')]){_0x7f5cec[_0x8f4a('0x4f')]=[{'all':!![]}];}return db[_0x8f4a('0x37')][_0x8f4a('0x50')](_0x7f5cec);})['then'](function(_0x12273d){_0x18b108['rows']=_0x12273d;return _0x18b108;})[_0x8f4a('0x2e')](respondWithFilteredResult(_0x48ff30,_0x7f5cec))[_0x8f4a('0x51')](handleError(_0x48ff30,null));};exports[_0x8f4a('0x52')]=function(_0x577dcf,_0x49e435){var _0x17df99={'raw':![],'where':{'id':_0x577dcf[_0x8f4a('0x53')]['id']}},_0x1755be={};_0x1755be['model']=_[_0x8f4a('0x3d')](db[_0x8f4a('0x37')][_0x8f4a('0x38')]);_0x1755be[_0x8f4a('0x3c')]=_[_0x8f4a('0x3d')](_0x577dcf[_0x8f4a('0x3c')]);_0x1755be[_0x8f4a('0x3e')]=_[_0x8f4a('0x40')](_0x1755be['model'],_0x1755be['query']);_0x17df99[_0x8f4a('0x3f')]=_[_0x8f4a('0x40')](_0x1755be[_0x8f4a('0x41')],qs[_0x8f4a('0x42')](_0x577dcf[_0x8f4a('0x3c')]['fields']));_0x17df99[_0x8f4a('0x3f')]=_0x17df99[_0x8f4a('0x3f')][_0x8f4a('0x43')]?_0x17df99['attributes']:_0x1755be[_0x8f4a('0x41')];if(_0x577dcf[_0x8f4a('0x3c')][_0x8f4a('0x4e')]){_0x17df99['include']=[{'all':!![]}];}_0x17df99=_[_0x8f4a('0x49')]({},_0x17df99,_0x577dcf[_0x8f4a('0x4d')]);return db[_0x8f4a('0x37')][_0x8f4a('0x54')](_0x17df99)[_0x8f4a('0x2e')](handleEntityNotFound(_0x49e435,null))[_0x8f4a('0x2e')](respondWithResult(_0x49e435,null))[_0x8f4a('0x51')](handleError(_0x49e435,null));};exports[_0x8f4a('0x55')]=function(_0x761a76,_0x224e1b){return db[_0x8f4a('0x37')][_0x8f4a('0x55')](_0x761a76['body'],{})[_0x8f4a('0x2e')](function(_0x329801){var _0x552b56=_0x761a76[_0x8f4a('0x56')]['get']({'plain':!![]});if(!_0x552b56)throw new Error(_0x8f4a('0x57'));if(_0x552b56['role']===_0x8f4a('0x56')){var _0xa85f55=_0x329801[_0x8f4a('0x2f')]({'plain':!![]});var _0x423f39=_0x8f4a('0x30');return db['UserProfileSection'][_0x8f4a('0x54')]({'where':{'name':_0x423f39,'userProfileId':_0x552b56[_0x8f4a('0x58')]},'raw':!![]})[_0x8f4a('0x2e')](function(_0x3a0614){if(_0x3a0614&&_0x3a0614[_0x8f4a('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0xa85f55[_0x8f4a('0x35')],'resourceId':_0xa85f55['id'],'type':_0x3a0614[_0x8f4a('0x35')],'sectionId':_0x3a0614['id']},{})[_0x8f4a('0x2e')](function(){return _0x329801;});}else{return _0x329801;}})[_0x8f4a('0x51')](function(_0x224a23){logger[_0x8f4a('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x224a23);throw _0x224a23;});}return _0x329801;})[_0x8f4a('0x2e')](respondWithResult(_0x224e1b,0xc9))[_0x8f4a('0x51')](handleError(_0x224e1b,null));};exports[_0x8f4a('0x5a')]=function(_0x423425,_0x5c3dfd){var _0x5c1563={'where':{'id':_0x423425['params']['id']}},_0x5824b5={};_0x5824b5[_0x8f4a('0x41')]=_['keys'](db[_0x8f4a('0x37')][_0x8f4a('0x38')]);_0x5c1563[_0x8f4a('0x3f')]=_['intersection'](_0x5824b5[_0x8f4a('0x41')],qs[_0x8f4a('0x42')](_0x423425[_0x8f4a('0x3c')]['fields']));_0x5c1563[_0x8f4a('0x3f')]=_0x5c1563[_0x8f4a('0x3f')]['length']?_0x5c1563[_0x8f4a('0x3f')]:_0x5824b5[_0x8f4a('0x41')];if(_0x423425['query'][_0x8f4a('0x4e')]){_0x5c1563[_0x8f4a('0x4f')]=[{'all':!![]}];}_0x5c1563=_[_0x8f4a('0x49')]({},_0x5c1563,_0x423425[_0x8f4a('0x4d')]);return db['Dashboard']['find'](_0x5c1563)[_0x8f4a('0x2e')](handleEntityNotFound(_0x5c3dfd,null))[_0x8f4a('0x2e')](function(_0x585ffe){if(_0x585ffe){var _0x2e1187=_0x585ffe[_0x8f4a('0x2f')]({'plain':!![]});_0x2e1187=qs['omit'](_0x2e1187,['id','createdAt',_0x8f4a('0x5b')]);_0x423425[_0x8f4a('0x5c')]=_[_0x8f4a('0x5d')](_0x423425[_0x8f4a('0x5c')],['id',_0x8f4a('0x5e'),_0x8f4a('0x5b')]);return db['Dashboard'][_0x8f4a('0x55')](_['merge'](_0x2e1187,_0x423425[_0x8f4a('0x5c')]),{'include':_0x423425[_0x8f4a('0x3c')][_0x8f4a('0x4e')]?[{'all':!![]}]:undefined})[_0x8f4a('0x2e')](function(_0x35339d){var _0x3a3f4c=_0x423425[_0x8f4a('0x56')][_0x8f4a('0x2f')]({'plain':!![]});if(!_0x3a3f4c)throw new Error(_0x8f4a('0x57'));if(_0x3a3f4c[_0x8f4a('0x5f')]==='user'){var _0x19ceb8=_0x35339d[_0x8f4a('0x2f')]({'plain':!![]});var _0x154662=_0x8f4a('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x154662,'userProfileId':_0x3a3f4c[_0x8f4a('0x58')]},'raw':!![]})['then'](function(_0x58d438){if(_0x58d438&&_0x58d438[_0x8f4a('0x59')]===0x0){return db[_0x8f4a('0x31')]['create']({'name':_0x19ceb8[_0x8f4a('0x35')],'resourceId':_0x19ceb8['id'],'type':_0x58d438[_0x8f4a('0x35')],'sectionId':_0x58d438['id']},{})[_0x8f4a('0x2e')](function(){return _0x35339d;});}else{return _0x35339d;}})[_0x8f4a('0x51')](function(_0x1d8c73){logger[_0x8f4a('0x33')](_0x8f4a('0x60'),_0x1d8c73);throw _0x1d8c73;});}return _0x35339d;});}})[_0x8f4a('0x2e')](respondWithResult(_0x5c3dfd,0xc9))[_0x8f4a('0x51')](handleError(_0x5c3dfd,null));};exports[_0x8f4a('0x2d')]=function(_0x1e7e60,_0x3d012b){if(_0x1e7e60[_0x8f4a('0x5c')]['id']){delete _0x1e7e60['body']['id'];}return db[_0x8f4a('0x37')][_0x8f4a('0x54')]({'where':{'id':_0x1e7e60[_0x8f4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x3d012b,null))['then'](saveUpdates(_0x1e7e60['body'],null))['then'](respondWithResult(_0x3d012b,null))[_0x8f4a('0x51')](handleError(_0x3d012b,null));};exports[_0x8f4a('0x32')]=function(_0x9424c,_0x985328){return db[_0x8f4a('0x37')][_0x8f4a('0x54')]({'where':{'id':_0x9424c[_0x8f4a('0x53')]['id']}})[_0x8f4a('0x2e')](handleEntityNotFound(_0x985328,null))['then'](removeEntity(_0x985328,null))[_0x8f4a('0x51')](handleError(_0x985328,null));};function widgetAttributes(_0x55f36a){try{switch(_0x55f36a['type']){case _0x8f4a('0x61'):return[{'name':'attrUrl','value':_0x55f36a['attrUrl']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x8f4a('0x63'),'value':_0x55f36a['attrPath']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0]['value']:undefined)||''}];case _0x8f4a('0x64'):return[{'name':_0x8f4a('0x65'),'value':_0x55f36a[_0x8f4a('0x65')]||(_0x55f36a['attrs']&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a['attrs'][0x0][_0x8f4a('0x66')]:undefined)||'HH:mm:ss'},{'name':_0x8f4a('0x67'),'value':_0x55f36a[_0x8f4a('0x67')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x1]?_0x55f36a[_0x8f4a('0x62')][0x1]['value']:undefined)||'0.00'},{'name':'attrFontSize','value':_0x55f36a['attrFontSize']||(_0x55f36a['attrs']&&_0x55f36a[_0x8f4a('0x62')][0x2]?_0x55f36a[_0x8f4a('0x62')][0x2][_0x8f4a('0x66')]:undefined)||0xc}];case _0x8f4a('0x68'):return[{'name':'attrMetric','value':_0x55f36a[_0x8f4a('0x69')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0][_0x8f4a('0x66')]:undefined)||_0x8f4a('0x6a')},{'name':_0x8f4a('0x6b'),'value':_0x55f36a[_0x8f4a('0x6b')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x1]?_0x55f36a[_0x8f4a('0x62')][0x1]['value']:undefined)||[]},{'name':_0x8f4a('0x6c'),'value':_0x55f36a['attrFontSize']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x2]?_0x55f36a['attrs'][0x2][_0x8f4a('0x66')]:undefined)||0x14},{'name':_0x8f4a('0x6d'),'value':_0x55f36a['attrChannel']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0x3]?_0x55f36a[_0x8f4a('0x62')][0x3][_0x8f4a('0x66')]:undefined)||'voice'},{'name':_0x8f4a('0x6e'),'value':_0x55f36a[_0x8f4a('0x6e')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x4]?_0x55f36a[_0x8f4a('0x62')][0x4][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x6f'),'value':_0x55f36a['attrFaxAccounts']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x5]?_0x55f36a[_0x8f4a('0x62')][0x5][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x70'),'value':_0x55f36a['attrSmsAccounts']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x6]?_0x55f36a['attrs'][0x6][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x71'),'value':_0x55f36a['attrOpenchannelAccounts']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x7]?_0x55f36a[_0x8f4a('0x62')][0x7]['value']:undefined)||''},{'name':_0x8f4a('0x72'),'value':_0x55f36a[_0x8f4a('0x72')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x8]?_0x55f36a[_0x8f4a('0x62')][0x8][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x73'),'value':_0x55f36a['attrChatWebsites']||(_0x55f36a['attrs']&&_0x55f36a['attrs'][0x9]?_0x55f36a['attrs'][0x9][_0x8f4a('0x66')]:undefined)||''}];case _0x8f4a('0x74'):case _0x8f4a('0x75'):return[{'name':_0x8f4a('0x76'),'value':_0x55f36a[_0x8f4a('0x76')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0]['value']:undefined)||_0x8f4a('0x6a')},{'name':'attrSerie2','value':_0x55f36a['attrSerie2']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x1]?_0x55f36a[_0x8f4a('0x62')][0x1][_0x8f4a('0x66')]:undefined)||null},{'name':_0x8f4a('0x77'),'value':_0x55f36a['attrSerie3']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0x2]?_0x55f36a['attrs'][0x2][_0x8f4a('0x66')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x55f36a[_0x8f4a('0x6b')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x3]?_0x55f36a[_0x8f4a('0x62')][0x3][_0x8f4a('0x66')]:undefined)||[]},{'name':'attrChannel','value':_0x55f36a[_0x8f4a('0x6d')]||(_0x55f36a['attrs']&&_0x55f36a['attrs'][0x4]?_0x55f36a[_0x8f4a('0x62')][0x4][_0x8f4a('0x66')]:undefined)||_0x8f4a('0x78')},{'name':_0x8f4a('0x6e'),'value':_0x55f36a['attrEmailAccounts']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x5]?_0x55f36a['attrs'][0x5][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x6f'),'value':_0x55f36a['attrFaxAccounts']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x6]?_0x55f36a[_0x8f4a('0x62')][0x6][_0x8f4a('0x66')]:undefined)||''},{'name':_0x8f4a('0x70'),'value':_0x55f36a[_0x8f4a('0x70')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0x7]?_0x55f36a[_0x8f4a('0x62')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x55f36a[_0x8f4a('0x71')]||(_0x55f36a['attrs']&&_0x55f36a[_0x8f4a('0x62')][0x8]?_0x55f36a[_0x8f4a('0x62')][0x8][_0x8f4a('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x55f36a[_0x8f4a('0x72')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x9]?_0x55f36a['attrs'][0x9]['value']:undefined)||''},{'name':_0x8f4a('0x73'),'value':_0x55f36a[_0x8f4a('0x73')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0xa]?_0x55f36a['attrs'][0xa][_0x8f4a('0x66')]:undefined)||''}];case _0x8f4a('0x79'):return[{'name':_0x8f4a('0x7a'),'type':_0x55f36a[_0x8f4a('0x7b')]||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0][_0x8f4a('0x3a')]:undefined)||null,'value':_0x55f36a[_0x8f4a('0x7a')]||(_0x55f36a['attrs']&&_0x55f36a[_0x8f4a('0x62')][0x0]?_0x55f36a[_0x8f4a('0x62')][0x0][_0x8f4a('0x66')]:undefined)||null},{'name':'attrRefresh','value':_0x55f36a['attrRefresh']||(_0x55f36a[_0x8f4a('0x62')]&&_0x55f36a['attrs'][0x1]?_0x55f36a['attrs'][0x1][_0x8f4a('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x3c10fc){logger[_0x8f4a('0x33')]('widgetAttributes:\x20%s',JSON[_0x8f4a('0x7c')](_0x3c10fc));return[];}}exports[_0x8f4a('0x7d')]=function(_0x463154,_0x3370b3,_0x576378){if(_0x463154[_0x8f4a('0x5c')]['id']){delete _0x463154[_0x8f4a('0x5c')]['id'];}return db['Dashboard'][_0x8f4a('0x54')]({'where':{'id':_0x463154[_0x8f4a('0x53')]['id']}})['then'](handleEntityNotFound(_0x3370b3,null))[_0x8f4a('0x2e')](function(_0xc80ca9){if(_0xc80ca9){_0x463154[_0x8f4a('0x5c')][_0x8f4a('0x7e')]=_0xc80ca9['id'];_0x463154[_0x8f4a('0x5c')][_0x8f4a('0x62')]=widgetAttributes(_0x463154[_0x8f4a('0x5c')]);return db[_0x8f4a('0x7f')][_0x8f4a('0x55')](_0x463154[_0x8f4a('0x5c')]);}})[_0x8f4a('0x2e')](respondWithResult(_0x3370b3,null))['catch'](handleError(_0x3370b3,null));};exports[_0x8f4a('0x80')]=function(_0x254aff,_0x37dd9f,_0x54a8c5){var _0x5f1b66={};var _0x8cb051={};var _0x112775;var _0x262f76;return db[_0x8f4a('0x37')][_0x8f4a('0x81')]({'where':{'id':_0x254aff['params']['id']}})[_0x8f4a('0x2e')](handleEntityNotFound(_0x37dd9f,null))['then'](function(_0x241b39){if(_0x241b39){_0x112775=_0x241b39;_0x8cb051[_0x8f4a('0x41')]=_[_0x8f4a('0x3d')](db[_0x8f4a('0x7f')][_0x8f4a('0x38')]);_0x8cb051[_0x8f4a('0x3c')]=_[_0x8f4a('0x3d')](_0x254aff[_0x8f4a('0x3c')]);_0x8cb051[_0x8f4a('0x3e')]=_[_0x8f4a('0x40')](_0x8cb051['model'],_0x8cb051[_0x8f4a('0x3c')]);_0x5f1b66[_0x8f4a('0x3f')]=_[_0x8f4a('0x40')](_0x8cb051['model'],qs[_0x8f4a('0x42')](_0x254aff[_0x8f4a('0x3c')][_0x8f4a('0x42')]));_0x5f1b66[_0x8f4a('0x3f')]=_0x5f1b66[_0x8f4a('0x3f')][_0x8f4a('0x43')]?_0x5f1b66[_0x8f4a('0x3f')]:_0x8cb051[_0x8f4a('0x41')];_0x5f1b66[_0x8f4a('0x45')]=qs[_0x8f4a('0x46')](_0x254aff['query'][_0x8f4a('0x46')]);_0x5f1b66['where']=qs[_0x8f4a('0x3e')](_[_0x8f4a('0x47')](_0x254aff[_0x8f4a('0x3c')],_0x8cb051['filters']));if(_0x254aff[_0x8f4a('0x3c')]['filter']){_0x5f1b66[_0x8f4a('0x48')]=_[_0x8f4a('0x49')](_0x5f1b66[_0x8f4a('0x48')],{'$or':_[_0x8f4a('0x4a')](_0x5f1b66[_0x8f4a('0x3f')],function(_0x860d5c){var _0x273d03={};_0x273d03[_0x860d5c]={'$like':'%'+_0x254aff[_0x8f4a('0x3c')][_0x8f4a('0x4c')]+'%'};return _0x273d03;})});}_0x5f1b66=_[_0x8f4a('0x49')]({},_0x5f1b66,_0x254aff[_0x8f4a('0x4d')]);return _0x112775['getItems'](_0x5f1b66);}})[_0x8f4a('0x2e')](function(_0x11d40b){if(_0x11d40b){_0x262f76=_0x11d40b[_0x8f4a('0x43')];if(!_0x254aff['query']['hasOwnProperty']('nolimit')){_0x5f1b66[_0x8f4a('0x25')]=qs[_0x8f4a('0x25')](_0x254aff[_0x8f4a('0x3c')][_0x8f4a('0x25')]);_0x5f1b66[_0x8f4a('0x27')]=qs[_0x8f4a('0x27')](_0x254aff[_0x8f4a('0x3c')]['offset']);}return _0x112775[_0x8f4a('0x80')](_0x5f1b66);}})[_0x8f4a('0x2e')](function(_0x452257){if(_0x452257){return _0x452257?{'count':_0x262f76,'rows':_0x452257}:null;}})['then'](respondWithResult(_0x37dd9f,null))[_0x8f4a('0x51')](handleError(_0x37dd9f,null));}; \ No newline at end of file +var _0x9710=['attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','hasOwnProperty','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','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/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./dashboard.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','CustomDashboards','UserProfileResource','end','name','send','index','map','Dashboard','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','order','sort','where','pick','filter','merge','include','rows','show','params','rawAttributes','fields','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','options','omit','createdAt','updatedAt','body','update','destroy','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss'];(function(_0x70d5a0,_0x282564){var _0x2d7404=function(_0x33576c){while(--_0x33576c){_0x70d5a0['push'](_0x70d5a0['shift']());}};_0x2d7404(++_0x282564);}(_0x9710,0x9c));var _0x0971=function(_0x30cdf8,_0x314211){_0x30cdf8=_0x30cdf8-0x0;var _0x27a2b7=_0x9710[_0x30cdf8];return _0x27a2b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0971('0x0'));var zipdir=require(_0x0971('0x1'));var jsonpatch=require(_0x0971('0x2'));var rp=require(_0x0971('0x3'));var moment=require(_0x0971('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0971('0x5'));var path=require(_0x0971('0x6'));var sox=require('sox');var csv=require(_0x0971('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0971('0x8'));var _=require(_0x0971('0x9'));var squel=require('squel');var crypto=require(_0x0971('0xa'));var jsforce=require(_0x0971('0xb'));var deskjs=require(_0x0971('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0971('0xd'));var authService=require(_0x0971('0xe'));var qs=require(_0x0971('0xf'));var as=require(_0x0971('0x10'));var hardwareService=require(_0x0971('0x11'));var logger=require(_0x0971('0x12'))(_0x0971('0x13'));var utils=require(_0x0971('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0971('0x15'));var db=require(_0x0971('0x16'))['db'];config['redis']=_[_0x0971('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0971('0x18'))(new Redis(config[_0x0971('0x19')]));require(_0x0971('0x1a'))['register'](socket);function respondWithStatusCode(_0x45b9b6,_0xdb5495){_0xdb5495=_0xdb5495||0xcc;return function(_0x13bf7){if(_0x13bf7){return _0x45b9b6['sendStatus'](_0xdb5495);}return _0x45b9b6['status'](_0xdb5495)['end']();};}function respondWithResult(_0x3b4415,_0x244cc2){_0x244cc2=_0x244cc2||0xc8;return function(_0x2060fa){if(_0x2060fa){return _0x3b4415[_0x0971('0x1b')](_0x244cc2)[_0x0971('0x1c')](_0x2060fa);}};}function respondWithFilteredResult(_0x47254a,_0x2f6f33){return function(_0x2302b9){if(_0x2302b9){var _0x3983a8=typeof _0x2f6f33[_0x0971('0x1d')]===_0x0971('0x1e')&&typeof _0x2f6f33[_0x0971('0x1f')]==='undefined';var _0x1e6b5e=_0x2302b9['count'];var _0x400bf6=_0x3983a8?0x0:_0x2f6f33['offset'];var _0x31f44=_0x3983a8?_0x2302b9[_0x0971('0x20')]:_0x2f6f33[_0x0971('0x1d')]+_0x2f6f33['limit'];var _0x34b028;if(_0x31f44>=_0x1e6b5e){_0x31f44=_0x1e6b5e;_0x34b028=0xc8;}else{_0x34b028=0xce;}_0x47254a[_0x0971('0x1b')](_0x34b028);return _0x47254a[_0x0971('0x21')](_0x0971('0x22'),_0x400bf6+'-'+_0x31f44+'/'+_0x1e6b5e)[_0x0971('0x1c')](_0x2302b9);}return null;};}function patchUpdates(_0x3796d2){return function(_0x351486){try{jsonpatch[_0x0971('0x23')](_0x351486,_0x3796d2,!![]);}catch(_0xc0f202){return BPromise[_0x0971('0x24')](_0xc0f202);}return _0x351486['save']();};}function saveUpdates(_0x515fa4,_0x2529a4){return function(_0x1be027){if(_0x1be027){return _0x1be027['update'](_0x515fa4)[_0x0971('0x25')](function(_0x22fb43){return _0x22fb43;});}return null;};}function removeEntity(_0x15435a,_0xde3e58){return function(_0x562e3f){if(_0x562e3f){return _0x562e3f['destroy']()['then'](function(){var _0x2c4d5e=_0x562e3f[_0x0971('0x26')]({'plain':!![]});var _0x5f06f2=_0x0971('0x27');return db[_0x0971('0x28')]['destroy']({'where':{'type':_0x5f06f2,'resourceId':_0x2c4d5e['id']}})['then'](function(){return _0x562e3f;});})[_0x0971('0x25')](function(){_0x15435a['status'](0xcc)[_0x0971('0x29')]();});}};}function handleEntityNotFound(_0x23e59d,_0x2d3218){return function(_0x25e6c5){if(!_0x25e6c5){_0x23e59d['sendStatus'](0x194);}return _0x25e6c5;};}function handleError(_0x1afd62,_0xec68cf){_0xec68cf=_0xec68cf||0x1f4;return function(_0x1bbb67){logger['error'](_0x1bbb67['stack']);if(_0x1bbb67['name']){delete _0x1bbb67[_0x0971('0x2a')];}_0x1afd62[_0x0971('0x1b')](_0xec68cf)[_0x0971('0x2b')](_0x1bbb67);};}exports[_0x0971('0x2c')]=function(_0x4c00cb,_0x2030d9){var _0x44c851={},_0x248283={},_0x370ae4={'count':0x0,'rows':[]};var _0x842ccb=_[_0x0971('0x2d')](db[_0x0971('0x2e')]['rawAttributes'],function(_0x1dab15){return{'name':_0x1dab15[_0x0971('0x2f')],'type':_0x1dab15[_0x0971('0x30')][_0x0971('0x31')]};});_0x248283[_0x0971('0x32')]=_[_0x0971('0x2d')](_0x842ccb,'name');_0x248283['query']=_[_0x0971('0x33')](_0x4c00cb['query']);_0x248283[_0x0971('0x34')]=_[_0x0971('0x35')](_0x248283[_0x0971('0x32')],_0x248283[_0x0971('0x36')]);_0x44c851['attributes']=_[_0x0971('0x35')](_0x248283[_0x0971('0x32')],qs['fields'](_0x4c00cb[_0x0971('0x36')]['fields']));_0x44c851[_0x0971('0x37')]=_0x44c851[_0x0971('0x37')][_0x0971('0x38')]?_0x44c851[_0x0971('0x37')]:_0x248283[_0x0971('0x32')];if(!_0x4c00cb[_0x0971('0x36')]['hasOwnProperty']('nolimit')){_0x44c851[_0x0971('0x1f')]=qs[_0x0971('0x1f')](_0x4c00cb[_0x0971('0x36')]['limit']);_0x44c851['offset']=qs[_0x0971('0x1d')](_0x4c00cb[_0x0971('0x36')][_0x0971('0x1d')]);}_0x44c851[_0x0971('0x39')]=qs[_0x0971('0x3a')](_0x4c00cb[_0x0971('0x36')][_0x0971('0x3a')]);_0x44c851[_0x0971('0x3b')]=qs[_0x0971('0x34')](_[_0x0971('0x3c')](_0x4c00cb[_0x0971('0x36')],_0x248283[_0x0971('0x34')]),_0x842ccb);if(_0x4c00cb[_0x0971('0x36')][_0x0971('0x3d')]){_0x44c851['where']=_[_0x0971('0x3e')](_0x44c851['where'],{'$or':_['map'](_0x842ccb,function(_0x345e3b){if(_0x345e3b[_0x0971('0x30')]!=='VIRTUAL'){var _0x34bf4b={};_0x34bf4b[_0x345e3b[_0x0971('0x2a')]]={'$like':'%'+_0x4c00cb[_0x0971('0x36')]['filter']+'%'};return _0x34bf4b;}})});}_0x44c851=_[_0x0971('0x3e')]({},_0x44c851,_0x4c00cb['options']);var _0x3ab127={'where':_0x44c851[_0x0971('0x3b')]};return db[_0x0971('0x2e')][_0x0971('0x20')](_0x3ab127)[_0x0971('0x25')](function(_0x365064){_0x370ae4[_0x0971('0x20')]=_0x365064;if(_0x4c00cb[_0x0971('0x36')]['includeAll']){_0x44c851[_0x0971('0x3f')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x44c851);})[_0x0971('0x25')](function(_0x1bbda8){_0x370ae4[_0x0971('0x40')]=_0x1bbda8;return _0x370ae4;})[_0x0971('0x25')](respondWithFilteredResult(_0x2030d9,_0x44c851))['catch'](handleError(_0x2030d9,null));};exports[_0x0971('0x41')]=function(_0x10739f,_0x2af1b5){var _0x1bf090={'raw':![],'where':{'id':_0x10739f[_0x0971('0x42')]['id']}},_0x18c554={};_0x18c554[_0x0971('0x32')]=_[_0x0971('0x33')](db[_0x0971('0x2e')][_0x0971('0x43')]);_0x18c554[_0x0971('0x36')]=_[_0x0971('0x33')](_0x10739f[_0x0971('0x36')]);_0x18c554[_0x0971('0x34')]=_[_0x0971('0x35')](_0x18c554[_0x0971('0x32')],_0x18c554[_0x0971('0x36')]);_0x1bf090[_0x0971('0x37')]=_[_0x0971('0x35')](_0x18c554[_0x0971('0x32')],qs[_0x0971('0x44')](_0x10739f[_0x0971('0x36')][_0x0971('0x44')]));_0x1bf090[_0x0971('0x37')]=_0x1bf090['attributes'][_0x0971('0x38')]?_0x1bf090[_0x0971('0x37')]:_0x18c554[_0x0971('0x32')];if(_0x10739f[_0x0971('0x36')][_0x0971('0x45')]){_0x1bf090[_0x0971('0x3f')]=[{'all':!![]}];}_0x1bf090=_[_0x0971('0x3e')]({},_0x1bf090,_0x10739f['options']);return db[_0x0971('0x2e')][_0x0971('0x46')](_0x1bf090)[_0x0971('0x25')](handleEntityNotFound(_0x2af1b5,null))[_0x0971('0x25')](respondWithResult(_0x2af1b5,null))[_0x0971('0x47')](handleError(_0x2af1b5,null));};exports['create']=function(_0x28262,_0x4ce5cb){return db['Dashboard'][_0x0971('0x48')](_0x28262['body'],{})[_0x0971('0x25')](function(_0x17b878){var _0x138f08=_0x28262[_0x0971('0x49')][_0x0971('0x26')]({'plain':!![]});if(!_0x138f08)throw new Error(_0x0971('0x4a'));if(_0x138f08[_0x0971('0x4b')]===_0x0971('0x49')){var _0x4859c0=_0x17b878[_0x0971('0x26')]({'plain':!![]});var _0x387198=_0x0971('0x27');return db[_0x0971('0x4c')]['find']({'where':{'name':_0x387198,'userProfileId':_0x138f08[_0x0971('0x4d')]},'raw':!![]})['then'](function(_0x9c3409){if(_0x9c3409&&_0x9c3409[_0x0971('0x4e')]===0x0){return db['UserProfileResource'][_0x0971('0x48')]({'name':_0x4859c0[_0x0971('0x2a')],'resourceId':_0x4859c0['id'],'type':_0x9c3409[_0x0971('0x2a')],'sectionId':_0x9c3409['id']},{})['then'](function(){return _0x17b878;});}else{return _0x17b878;}})[_0x0971('0x47')](function(_0x4526d9){logger[_0x0971('0x4f')](_0x0971('0x50'),_0x4526d9);throw _0x4526d9;});}return _0x17b878;})[_0x0971('0x25')](respondWithResult(_0x4ce5cb,0xc9))[_0x0971('0x47')](handleError(_0x4ce5cb,null));};exports['clone']=function(_0x168b4e,_0x3384c0){var _0x515fcb={'where':{'id':_0x168b4e['params']['id']}},_0x5b5b31={};_0x5b5b31[_0x0971('0x32')]=_[_0x0971('0x33')](db['Dashboard'][_0x0971('0x43')]);_0x515fcb[_0x0971('0x37')]=_[_0x0971('0x35')](_0x5b5b31[_0x0971('0x32')],qs[_0x0971('0x44')](_0x168b4e[_0x0971('0x36')]['fields']));_0x515fcb[_0x0971('0x37')]=_0x515fcb[_0x0971('0x37')][_0x0971('0x38')]?_0x515fcb[_0x0971('0x37')]:_0x5b5b31[_0x0971('0x32')];if(_0x168b4e[_0x0971('0x36')][_0x0971('0x45')]){_0x515fcb[_0x0971('0x3f')]=[{'all':!![]}];}_0x515fcb=_[_0x0971('0x3e')]({},_0x515fcb,_0x168b4e[_0x0971('0x51')]);return db[_0x0971('0x2e')]['find'](_0x515fcb)[_0x0971('0x25')](handleEntityNotFound(_0x3384c0,null))['then'](function(_0x2d89e0){if(_0x2d89e0){var _0x4c379e=_0x2d89e0[_0x0971('0x26')]({'plain':!![]});_0x4c379e=qs[_0x0971('0x52')](_0x4c379e,['id',_0x0971('0x53'),_0x0971('0x54')]);_0x168b4e[_0x0971('0x55')]=_[_0x0971('0x52')](_0x168b4e[_0x0971('0x55')],['id',_0x0971('0x53'),'updatedAt']);return db['Dashboard'][_0x0971('0x48')](_['merge'](_0x4c379e,_0x168b4e[_0x0971('0x55')]),{'include':_0x168b4e['query'][_0x0971('0x45')]?[{'all':!![]}]:undefined})[_0x0971('0x25')](function(_0x1666f8){var _0x14a929=_0x168b4e[_0x0971('0x49')][_0x0971('0x26')]({'plain':!![]});if(!_0x14a929)throw new Error(_0x0971('0x4a'));if(_0x14a929[_0x0971('0x4b')]===_0x0971('0x49')){var _0x4ae00b=_0x1666f8['get']({'plain':!![]});var _0x48c207=_0x0971('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x48c207,'userProfileId':_0x14a929[_0x0971('0x4d')]},'raw':!![]})[_0x0971('0x25')](function(_0x5097e4){if(_0x5097e4&&_0x5097e4[_0x0971('0x4e')]===0x0){return db[_0x0971('0x28')]['create']({'name':_0x4ae00b[_0x0971('0x2a')],'resourceId':_0x4ae00b['id'],'type':_0x5097e4[_0x0971('0x2a')],'sectionId':_0x5097e4['id']},{})[_0x0971('0x25')](function(){return _0x1666f8;});}else{return _0x1666f8;}})[_0x0971('0x47')](function(_0x26fd4c){logger[_0x0971('0x4f')](_0x0971('0x50'),_0x26fd4c);throw _0x26fd4c;});}return _0x1666f8;});}})[_0x0971('0x25')](respondWithResult(_0x3384c0,0xc9))[_0x0971('0x47')](handleError(_0x3384c0,null));};exports[_0x0971('0x56')]=function(_0x15a2e9,_0x5d75ed){if(_0x15a2e9[_0x0971('0x55')]['id']){delete _0x15a2e9[_0x0971('0x55')]['id'];}return db[_0x0971('0x2e')][_0x0971('0x46')]({'where':{'id':_0x15a2e9[_0x0971('0x42')]['id']}})[_0x0971('0x25')](handleEntityNotFound(_0x5d75ed,null))[_0x0971('0x25')](saveUpdates(_0x15a2e9['body'],null))[_0x0971('0x25')](respondWithResult(_0x5d75ed,null))['catch'](handleError(_0x5d75ed,null));};exports[_0x0971('0x57')]=function(_0x640540,_0x3f36d9){return db['Dashboard'][_0x0971('0x46')]({'where':{'id':_0x640540[_0x0971('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f36d9,null))[_0x0971('0x25')](removeEntity(_0x3f36d9,null))[_0x0971('0x47')](handleError(_0x3f36d9,null));};function widgetAttributes(_0x565088){try{switch(_0x565088[_0x0971('0x30')]){case'iframe':return[{'name':_0x0971('0x58'),'value':_0x565088[_0x0971('0x58')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x5a')]:undefined)||'https://'}];case _0x0971('0x5b'):return[{'name':_0x0971('0x5c'),'value':_0x565088['attrPath']||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x5a')]:undefined)||''}];case _0x0971('0x5d'):return[{'name':_0x0971('0x5e'),'value':_0x565088['attrHourFormat']||(_0x565088['attrs']&&_0x565088[_0x0971('0x59')][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x5a')]:undefined)||_0x0971('0x5f')},{'name':_0x0971('0x60'),'value':_0x565088[_0x0971('0x60')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x1]?_0x565088[_0x0971('0x59')][0x1][_0x0971('0x5a')]:undefined)||_0x0971('0x61')},{'name':_0x0971('0x62'),'value':_0x565088[_0x0971('0x62')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x2]?_0x565088['attrs'][0x2]['value']:undefined)||0xc}];case _0x0971('0x63'):return[{'name':_0x0971('0x64'),'value':_0x565088[_0x0971('0x64')]||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x5a')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x565088[_0x0971('0x65')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x1]?_0x565088[_0x0971('0x59')][0x1][_0x0971('0x5a')]:undefined)||[]},{'name':_0x0971('0x62'),'value':_0x565088[_0x0971('0x62')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x2]?_0x565088[_0x0971('0x59')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x565088['attrChannel']||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x3]?_0x565088[_0x0971('0x59')][0x3][_0x0971('0x5a')]:undefined)||_0x0971('0x66')},{'name':_0x0971('0x67'),'value':_0x565088[_0x0971('0x67')]||(_0x565088['attrs']&&_0x565088[_0x0971('0x59')][0x4]?_0x565088[_0x0971('0x59')][0x4]['value']:undefined)||''},{'name':_0x0971('0x68'),'value':_0x565088[_0x0971('0x68')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x5]?_0x565088[_0x0971('0x59')][0x5][_0x0971('0x5a')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x565088['attrSmsAccounts']||(_0x565088['attrs']&&_0x565088[_0x0971('0x59')][0x6]?_0x565088[_0x0971('0x59')][0x6][_0x0971('0x5a')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x565088['attrOpenchannelAccounts']||(_0x565088['attrs']&&_0x565088[_0x0971('0x59')][0x7]?_0x565088[_0x0971('0x59')][0x7][_0x0971('0x5a')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x565088['attrWhatsappAccounts']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x8]?_0x565088['attrs'][0x8][_0x0971('0x5a')]:undefined)||''},{'name':_0x0971('0x69'),'value':_0x565088[_0x0971('0x69')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x9]?_0x565088[_0x0971('0x59')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x0971('0x6a'):return[{'name':_0x0971('0x6b'),'value':_0x565088[_0x0971('0x6b')]||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x0]?_0x565088[_0x0971('0x59')][0x0]['value']:undefined)||'total'},{'name':_0x0971('0x6c'),'value':_0x565088['attrSerie2']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x1]?_0x565088[_0x0971('0x59')][0x1]['value']:undefined)||null},{'name':_0x0971('0x6d'),'value':_0x565088['attrSerie3']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x2]?_0x565088[_0x0971('0x59')][0x2][_0x0971('0x5a')]:undefined)||null},{'name':_0x0971('0x65'),'value':_0x565088[_0x0971('0x65')]||(_0x565088['attrs']&&_0x565088['attrs'][0x3]?_0x565088[_0x0971('0x59')][0x3][_0x0971('0x5a')]:undefined)||[]},{'name':_0x0971('0x6e'),'value':_0x565088['attrChannel']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x4]?_0x565088['attrs'][0x4][_0x0971('0x5a')]:undefined)||_0x0971('0x66')},{'name':_0x0971('0x67'),'value':_0x565088['attrEmailAccounts']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x5]?_0x565088[_0x0971('0x59')][0x5][_0x0971('0x5a')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x565088[_0x0971('0x68')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x6]?_0x565088[_0x0971('0x59')][0x6][_0x0971('0x5a')]:undefined)||''},{'name':_0x0971('0x6f'),'value':_0x565088[_0x0971('0x6f')]||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x7]?_0x565088[_0x0971('0x59')][0x7][_0x0971('0x5a')]:undefined)||''},{'name':_0x0971('0x70'),'value':_0x565088[_0x0971('0x70')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x8]?_0x565088[_0x0971('0x59')][0x8][_0x0971('0x5a')]:undefined)||''},{'name':_0x0971('0x71'),'value':_0x565088['attrWhatsappAccounts']||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x9]?_0x565088[_0x0971('0x59')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x565088[_0x0971('0x69')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0xa]?_0x565088['attrs'][0xa][_0x0971('0x5a')]:undefined)||''}];case _0x0971('0x72'):return[{'name':'attrReport','type':_0x565088[_0x0971('0x73')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x30')]:undefined)||null,'value':_0x565088[_0x0971('0x74')]||(_0x565088[_0x0971('0x59')]&&_0x565088['attrs'][0x0]?_0x565088[_0x0971('0x59')][0x0][_0x0971('0x5a')]:undefined)||null},{'name':_0x0971('0x75'),'value':_0x565088[_0x0971('0x75')]||(_0x565088[_0x0971('0x59')]&&_0x565088[_0x0971('0x59')][0x1]?_0x565088[_0x0971('0x59')][0x1][_0x0971('0x5a')]:undefined)||0x0}];default:return[];}}catch(_0x3a1bc2){logger[_0x0971('0x4f')]('widgetAttributes:\x20%s',JSON[_0x0971('0x76')](_0x3a1bc2));return[];}}exports[_0x0971('0x77')]=function(_0x39e469,_0x426a4e,_0x46587a){if(_0x39e469[_0x0971('0x55')]['id']){delete _0x39e469[_0x0971('0x55')]['id'];}return db['Dashboard'][_0x0971('0x46')]({'where':{'id':_0x39e469['params']['id']}})[_0x0971('0x25')](handleEntityNotFound(_0x426a4e,null))['then'](function(_0x3b04e0){if(_0x3b04e0){_0x39e469[_0x0971('0x55')][_0x0971('0x78')]=_0x3b04e0['id'];_0x39e469[_0x0971('0x55')][_0x0971('0x59')]=widgetAttributes(_0x39e469[_0x0971('0x55')]);return db['DashboardItem'][_0x0971('0x48')](_0x39e469[_0x0971('0x55')]);}})[_0x0971('0x25')](respondWithResult(_0x426a4e,null))['catch'](handleError(_0x426a4e,null));};exports['getItems']=function(_0x392bf1,_0x392cda,_0x2416d5){var _0x17d1ca={};var _0x4bdbe6={};var _0x3358c6;var _0xbe00ec;return db[_0x0971('0x2e')][_0x0971('0x79')]({'where':{'id':_0x392bf1[_0x0971('0x42')]['id']}})[_0x0971('0x25')](handleEntityNotFound(_0x392cda,null))[_0x0971('0x25')](function(_0x398312){if(_0x398312){_0x3358c6=_0x398312;_0x4bdbe6[_0x0971('0x32')]=_[_0x0971('0x33')](db[_0x0971('0x7a')]['rawAttributes']);_0x4bdbe6[_0x0971('0x36')]=_[_0x0971('0x33')](_0x392bf1[_0x0971('0x36')]);_0x4bdbe6['filters']=_[_0x0971('0x35')](_0x4bdbe6[_0x0971('0x32')],_0x4bdbe6[_0x0971('0x36')]);_0x17d1ca[_0x0971('0x37')]=_[_0x0971('0x35')](_0x4bdbe6[_0x0971('0x32')],qs['fields'](_0x392bf1[_0x0971('0x36')]['fields']));_0x17d1ca[_0x0971('0x37')]=_0x17d1ca[_0x0971('0x37')][_0x0971('0x38')]?_0x17d1ca[_0x0971('0x37')]:_0x4bdbe6[_0x0971('0x32')];_0x17d1ca['order']=qs[_0x0971('0x3a')](_0x392bf1[_0x0971('0x36')][_0x0971('0x3a')]);_0x17d1ca[_0x0971('0x3b')]=qs[_0x0971('0x34')](_[_0x0971('0x3c')](_0x392bf1['query'],_0x4bdbe6['filters']));if(_0x392bf1[_0x0971('0x36')]['filter']){_0x17d1ca[_0x0971('0x3b')]=_['merge'](_0x17d1ca[_0x0971('0x3b')],{'$or':_[_0x0971('0x2d')](_0x17d1ca[_0x0971('0x37')],function(_0x3fe8bd){var _0x5e83c8={};_0x5e83c8[_0x3fe8bd]={'$like':'%'+_0x392bf1['query'][_0x0971('0x3d')]+'%'};return _0x5e83c8;})});}_0x17d1ca=_[_0x0971('0x3e')]({},_0x17d1ca,_0x392bf1[_0x0971('0x51')]);return _0x3358c6[_0x0971('0x7b')](_0x17d1ca);}})[_0x0971('0x25')](function(_0x441d9c){if(_0x441d9c){_0xbe00ec=_0x441d9c[_0x0971('0x38')];if(!_0x392bf1['query'][_0x0971('0x7c')](_0x0971('0x7d'))){_0x17d1ca[_0x0971('0x1f')]=qs[_0x0971('0x1f')](_0x392bf1[_0x0971('0x36')][_0x0971('0x1f')]);_0x17d1ca[_0x0971('0x1d')]=qs[_0x0971('0x1d')](_0x392bf1[_0x0971('0x36')][_0x0971('0x1d')]);}return _0x3358c6[_0x0971('0x7b')](_0x17d1ca);}})[_0x0971('0x25')](function(_0x5a32ce){if(_0x5a32ce){return _0x5a32ce?{'count':_0xbe00ec,'rows':_0x5a32ce}:null;}})[_0x0971('0x25')](respondWithResult(_0x392cda,null))[_0x0971('0x47')](handleError(_0x392cda,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a5676d5..de3cb02 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 _0x6dda=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x43ff3f,_0x54f64c){var _0x4ffe21=function(_0x1ff118){while(--_0x1ff118){_0x43ff3f['push'](_0x43ff3f['shift']());}};_0x4ffe21(++_0x54f64c);}(_0x6dda,0x17a));var _0xa6dd=function(_0x306b1c,_0x5ccb01){_0x306b1c=_0x306b1c-0x0;var _0x2a6f02=_0x6dda[_0x306b1c];return _0x2a6f02;};'use strict';var EventEmitter=require(_0xa6dd('0x0'));var Dashboard=require(_0xa6dd('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa6dd('0x2')](0x0);var events={'afterCreate':_0xa6dd('0x3'),'afterUpdate':_0xa6dd('0x4'),'afterDestroy':_0xa6dd('0x5')};function emitEvent(_0x266862){return function(_0x2edc7f,_0x29cc12,_0x1ccf06){DashboardEvents[_0xa6dd('0x6')](_0x266862+':'+_0x2edc7f['id'],_0x2edc7f);DashboardEvents[_0xa6dd('0x6')](_0x266862,_0x2edc7f);_0x1ccf06(null);};}for(var e in events){if(events[_0xa6dd('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xa6dd('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb6d4=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb6d4,0x16c));var _0x4b6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb6d4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x4b6d('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x4b6d('0x1')](0x0);var events={'afterCreate':_0x4b6d('0x2'),'afterUpdate':_0x4b6d('0x3'),'afterDestroy':_0x4b6d('0x4')};function emitEvent(_0x1914a0){return function(_0x598386,_0x4442c2,_0x201dfe){DashboardEvents[_0x4b6d('0x5')](_0x1914a0+':'+_0x598386['id'],_0x598386);DashboardEvents[_0x4b6d('0x5')](_0x1914a0,_0x598386);_0x201dfe(null);};}for(var e in events){if(events[_0x4b6d('0x6')](e)){var event=events[e];Dashboard[_0x4b6d('0x7')](e,emitEvent(event));}}module[_0x4b6d('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 61b6cbe..0901437 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 _0xf969=['bluebird','path','rimraf','./dashboard.attributes','exports','define','Dashboard','lodash','../../config/logger','api','moment'];(function(_0x23e409,_0x3fb280){var _0x556700=function(_0xf60ecb){while(--_0xf60ecb){_0x23e409['push'](_0x23e409['shift']());}};_0x556700(++_0x3fb280);}(_0xf969,0x1ca));var _0x9f96=function(_0x7b63ea,_0x440094){_0x7b63ea=_0x7b63ea-0x0;var _0xa33637=_0xf969[_0x7b63ea];return _0xa33637;};'use strict';var _=require(_0x9f96('0x0'));var util=require('util');var logger=require(_0x9f96('0x1'))(_0x9f96('0x2'));var moment=require(_0x9f96('0x3'));var BPromise=require(_0x9f96('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f96('0x5'));var rimraf=require(_0x9f96('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f96('0x7'));module[_0x9f96('0x8')]=function(_0x536b71,_0x34de9a){return _0x536b71[_0x9f96('0x9')](_0x9f96('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b09=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x2bfc9c,_0x2866d6){var _0x30db44=function(_0x154a14){while(--_0x154a14){_0x2bfc9c['push'](_0x2bfc9c['shift']());}};_0x30db44(++_0x2866d6);}(_0x8b09,0x153));var _0x98b0=function(_0x34e4c4,_0x1b73cb){_0x34e4c4=_0x34e4c4-0x0;var _0x323bea=_0x8b09[_0x34e4c4];return _0x323bea;};'use strict';var _=require(_0x98b0('0x0'));var util=require(_0x98b0('0x1'));var logger=require(_0x98b0('0x2'))(_0x98b0('0x3'));var moment=require(_0x98b0('0x4'));var BPromise=require(_0x98b0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98b0('0x6'));var rimraf=require('rimraf');var config=require(_0x98b0('0x7'));var attributes=require(_0x98b0('0x8'));module[_0x98b0('0x9')]=function(_0x2c83d7,_0x3ca831){return _0x2c83d7[_0x98b0('0xa')](_0x98b0('0xb'),attributes,{'tableName':_0x98b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 92204ff..83c532d 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 _0x8c22=['result','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8c22,0x1cd));var _0x28c2=function(_0x1612e9,_0x272ff8){_0x1612e9=_0x1612e9-0x0;var _0x5a39fd=_0x8c22[_0x1612e9];return _0x5a39fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x28c2('0x0'));var BPromise=require('bluebird');var rs=require(_0x28c2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x28c2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x28c2('0x3'))('rpc');var config=require(_0x28c2('0x4'));var jayson=require(_0x28c2('0x5'));var client=jayson['client'][_0x28c2('0x6')]({'port':0x232a});config[_0x28c2('0x7')]=_['defaults'](config[_0x28c2('0x7')],{'host':_0x28c2('0x8'),'port':0x18eb});var socket=require(_0x28c2('0x9'))(new Redis(config[_0x28c2('0x7')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x3a2540,_0x53e2f3,_0x4d8b33){return new BPromise(function(_0xb9fa30,_0x3476f2){return client['request'](_0x3a2540,_0x4d8b33)[_0x28c2('0xa')](function(_0x2f8ae8){logger['info'](_0x28c2('0xb'),_0x53e2f3,_0x28c2('0xc'));logger['debug'](_0x28c2('0xd'),_0x53e2f3,'request\x20sent',JSON[_0x28c2('0xe')](_0x2f8ae8));if(_0x2f8ae8['error']){if(_0x2f8ae8[_0x28c2('0xf')][_0x28c2('0x10')]===0x1f4){logger[_0x28c2('0xf')](_0x28c2('0xb'),_0x53e2f3,_0x2f8ae8[_0x28c2('0xf')][_0x28c2('0x11')]);return _0x3476f2(_0x2f8ae8[_0x28c2('0xf')][_0x28c2('0x11')]);}logger[_0x28c2('0xf')](_0x28c2('0xb'),_0x53e2f3,_0x2f8ae8[_0x28c2('0xf')]['message']);return _0xb9fa30(_0x2f8ae8[_0x28c2('0xf')][_0x28c2('0x11')]);}else{logger[_0x28c2('0x12')](_0x28c2('0xb'),_0x53e2f3,_0x28c2('0xc'));_0xb9fa30(_0x2f8ae8[_0x28c2('0x13')][_0x28c2('0x11')]);}})['catch'](function(_0x14e1c9){logger[_0x28c2('0xf')](_0x28c2('0xb'),_0x53e2f3,_0x14e1c9);_0x3476f2(_0x14e1c9);});});} \ No newline at end of file +var _0x61c5=['util','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x61c5,0x12b));var _0x561c=function(_0x271a22,_0xef764b){_0x271a22=_0x271a22-0x0;var _0x26431b=_0x61c5[_0x271a22];return _0x26431b;};'use strict';var _=require(_0x561c('0x0'));var util=require(_0x561c('0x1'));var moment=require('moment');var BPromise=require(_0x561c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x561c('0x3'));var logger=require(_0x561c('0x4'))('rpc');var config=require(_0x561c('0x5'));var jayson=require(_0x561c('0x6'));var client=jayson[_0x561c('0x7')]['http']({'port':0x232a});config['redis']=_[_0x561c('0x8')](config['redis'],{'host':_0x561c('0x9'),'port':0x18eb});var socket=require(_0x561c('0xa'))(new Redis(config[_0x561c('0xb')]));require(_0x561c('0xc'))[_0x561c('0xd')](socket);function respondWithRpcPromise(_0x161c5a,_0x1ac982,_0x3dfcfe){return new BPromise(function(_0x216b42,_0x23ee97){return client['request'](_0x161c5a,_0x3dfcfe)[_0x561c('0xe')](function(_0x7c9322){logger['info'](_0x561c('0xf'),_0x1ac982,_0x561c('0x10'));logger['debug'](_0x561c('0x11'),_0x1ac982,_0x561c('0x10'),JSON[_0x561c('0x12')](_0x7c9322));if(_0x7c9322[_0x561c('0x13')]){if(_0x7c9322[_0x561c('0x13')][_0x561c('0x14')]===0x1f4){logger[_0x561c('0x13')]('Dashboard,\x20%s,\x20%s',_0x1ac982,_0x7c9322['error'][_0x561c('0x15')]);return _0x23ee97(_0x7c9322['error'][_0x561c('0x15')]);}logger[_0x561c('0x13')](_0x561c('0xf'),_0x1ac982,_0x7c9322[_0x561c('0x13')][_0x561c('0x15')]);return _0x216b42(_0x7c9322['error'][_0x561c('0x15')]);}else{logger[_0x561c('0x16')](_0x561c('0xf'),_0x1ac982,_0x561c('0x10'));_0x216b42(_0x7c9322[_0x561c('0x17')][_0x561c('0x15')]);}})[_0x561c('0x18')](function(_0x29ec87){logger[_0x561c('0x13')]('Dashboard,\x20%s,\x20%s',_0x1ac982,_0x29ec87);_0x23ee97(_0x29ec87);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index c12670c..bba6b89 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 _0x986f=['length','./dashboard.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x986f,0x1b1));var _0xf986=function(_0x2a6d80,_0x88a01c){_0x2a6d80=_0x2a6d80-0x0;var _0x355c83=_0x986f[_0x2a6d80];return _0x355c83;};'use strict';var DashboardEvents=require(_0xf986('0x0'));var events=[_0xf986('0x1'),_0xf986('0x2'),_0xf986('0x3')];function createListener(_0x165590,_0x499657){return function(_0x2a70bb){_0x499657[_0xf986('0x4')](_0x165590,_0x2a70bb);};}function removeListener(_0x4c0e43,_0x28cd64){return function(){DashboardEvents[_0xf986('0x5')](_0x4c0e43,_0x28cd64);};}exports[_0xf986('0x6')]=function(_0x48c16a){for(var _0x1100aa=0x0,_0x27a110=events[_0xf986('0x7')];_0x1100aa<_0x27a110;_0x1100aa++){var _0x3b2296=events[_0x1100aa];var _0x2dab97=createListener('dashboard:'+_0x3b2296,_0x48c16a);DashboardEvents['on'](_0x3b2296,_0x2dab97);}}; \ No newline at end of file +var _0xcf47=['register','length','dashboard:','./dashboard.events','save','removeListener'];(function(_0x1465c4,_0x2cde93){var _0x137fc6=function(_0x57ce4e){while(--_0x57ce4e){_0x1465c4['push'](_0x1465c4['shift']());}};_0x137fc6(++_0x2cde93);}(_0xcf47,0x189));var _0x7cf4=function(_0x398dda,_0xa77418){_0x398dda=_0x398dda-0x0;var _0x312bbf=_0xcf47[_0x398dda];return _0x312bbf;};'use strict';var DashboardEvents=require(_0x7cf4('0x0'));var events=[_0x7cf4('0x1'),'remove','update'];function createListener(_0x4df5bf,_0x5a6004){return function(_0x271df6){_0x5a6004['emit'](_0x4df5bf,_0x271df6);};}function removeListener(_0x2b4d8d,_0x3c4f80){return function(){DashboardEvents[_0x7cf4('0x2')](_0x2b4d8d,_0x3c4f80);};}exports[_0x7cf4('0x3')]=function(_0x29e080){for(var _0x7d060d=0x0,_0x2980e5=events[_0x7cf4('0x4')];_0x7d060d<_0x2980e5;_0x7d060d++){var _0x2ef033=events[_0x7d060d];var _0x822684=createListener(_0x7cf4('0x5')+_0x2ef033,_0x29e080);DashboardEvents['on'](_0x2ef033,_0x822684);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index bc99792..8ece3ce 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 _0x4c68=['/:id/items','getItems','create','clone','addItem','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x4c68,0x1ab));var _0x84c6=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x4c68[_0x57975f];return _0x4793b8;};'use strict';var multer=require(_0x84c6('0x0'));var util=require(_0x84c6('0x1'));var path=require(_0x84c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x84c6('0x3'));var router=express[_0x84c6('0x4')]();var fs_extra=require(_0x84c6('0x5'));var auth=require(_0x84c6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x84c6('0x7'));var controller=require(_0x84c6('0x8'));router[_0x84c6('0x9')]('/',auth[_0x84c6('0xa')](),controller[_0x84c6('0xb')]);router['get']('/:id',auth[_0x84c6('0xa')](),controller[_0x84c6('0xc')]);router[_0x84c6('0x9')](_0x84c6('0xd'),auth[_0x84c6('0xa')](),controller[_0x84c6('0xe')]);router['post']('/',auth[_0x84c6('0xa')](),controller[_0x84c6('0xf')]);router['post']('/:id/clone',auth[_0x84c6('0xa')](),controller[_0x84c6('0x10')]);router['post']('/:id/items',auth[_0x84c6('0xa')](),controller[_0x84c6('0x11')]);router['put'](_0x84c6('0x12'),auth[_0x84c6('0xa')](),controller[_0x84c6('0x13')]);router[_0x84c6('0x14')]('/:id',auth[_0x84c6('0xa')](),controller[_0x84c6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd2ec=['/:id/clone','clone','addItem','put','/:id','update','delete','destroy','exports','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/items','post','create'];(function(_0x3b98f6,_0x1ef63e){var _0x39f4b2=function(_0x5cc876){while(--_0x5cc876){_0x3b98f6['push'](_0x3b98f6['shift']());}};_0x39f4b2(++_0x1ef63e);}(_0xd2ec,0xa9));var _0xcd2e=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0xd2ec[_0x4befae];return _0x76c573;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcd2e('0x0'));var timeout=require(_0xcd2e('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcd2e('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xcd2e('0x3'));var controller=require('./dashboard.controller');router[_0xcd2e('0x4')]('/',auth[_0xcd2e('0x5')](),controller[_0xcd2e('0x6')]);router[_0xcd2e('0x4')]('/:id',auth[_0xcd2e('0x5')](),controller[_0xcd2e('0x7')]);router[_0xcd2e('0x4')](_0xcd2e('0x8'),auth[_0xcd2e('0x5')](),controller['getItems']);router[_0xcd2e('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd2e('0xa')]);router['post'](_0xcd2e('0xb'),auth['isAuthenticated'](),controller[_0xcd2e('0xc')]);router[_0xcd2e('0x9')](_0xcd2e('0x8'),auth[_0xcd2e('0x5')](),controller[_0xcd2e('0xd')]);router[_0xcd2e('0xe')](_0xcd2e('0xf'),auth[_0xcd2e('0x5')](),controller[_0xcd2e('0x10')]);router[_0xcd2e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcd2e('0x12')]);module[_0xcd2e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 0a4f7a8..cb6423e 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 _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x170994,_0x5adc66){var _0x3c89a3=function(_0x53e7e1){while(--_0x53e7e1){_0x170994['push'](_0x170994['shift']());}};_0x3c89a3(++_0x5adc66);}(_0x4c60,0xc1));var _0x04c6=function(_0x50eed8,_0x51ce1e){_0x50eed8=_0x50eed8-0x0;var _0x493c13=_0x4c60[_0x50eed8];return _0x493c13;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x84293f,_0x1b4173){var _0x15a611=function(_0x32f46b){while(--_0x32f46b){_0x84293f['push'](_0x84293f['shift']());}};_0x15a611(++_0x1b4173);}(_0xeda8,0x104));var _0x8eda=function(_0x1e11fa,_0x537790){_0x1e11fa=_0x1e11fa-0x0;var _0x3b9b1e=_0xeda8[_0x1e11fa];return _0x3b9b1e;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index eceda37..30e3ae4 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 _0x2678=['0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrChannel','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','query','keys','filters','intersection','attributes','model','fields','length','includeAll','include','options','DashboardItem','find','catch','params','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x2ef529,_0x3fd12e){var _0x119dde=function(_0x50d5f5){while(--_0x50d5f5){_0x2ef529['push'](_0x2ef529['shift']());}};_0x119dde(++_0x3fd12e);}(_0x2678,0x1bb));var _0x8267=function(_0x3a0172,_0x2e73e3){_0x3a0172=_0x3a0172-0x0;var _0x13ea5e=_0x2678[_0x3a0172];return _0x13ea5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8267('0x0'));var zipdir=require(_0x8267('0x1'));var jsonpatch=require(_0x8267('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8267('0x3'));var util=require(_0x8267('0x4'));var path=require(_0x8267('0x5'));var sox=require('sox');var csv=require(_0x8267('0x6'));var ejs=require(_0x8267('0x7'));var fs=require('fs');var fs_extra=require(_0x8267('0x8'));var _=require(_0x8267('0x9'));var squel=require(_0x8267('0xa'));var crypto=require(_0x8267('0xb'));var jsforce=require(_0x8267('0xc'));var deskjs=require(_0x8267('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8267('0xe'));var Papa=require(_0x8267('0xf'));var Redis=require('ioredis');var authService=require(_0x8267('0x10'));var qs=require(_0x8267('0x11'));var as=require(_0x8267('0x12'));var hardwareService=require(_0x8267('0x13'));var logger=require(_0x8267('0x14'))('api');var utils=require(_0x8267('0x15'));var config=require(_0x8267('0x16'));var licenseUtil=require(_0x8267('0x17'));var db=require(_0x8267('0x18'))['db'];config[_0x8267('0x19')]=_[_0x8267('0x1a')](config[_0x8267('0x19')],{'host':_0x8267('0x1b'),'port':0x18eb});var socket=require(_0x8267('0x1c'))(new Redis(config[_0x8267('0x19')]));require(_0x8267('0x1d'))['register'](socket);function respondWithStatusCode(_0x14a8d1,_0x4ef41e){_0x4ef41e=_0x4ef41e||0xcc;return function(_0x39cc14){if(_0x39cc14){return _0x14a8d1[_0x8267('0x1e')](_0x4ef41e);}return _0x14a8d1[_0x8267('0x1f')](_0x4ef41e)[_0x8267('0x20')]();};}function respondWithResult(_0x5b182b,_0x583817){_0x583817=_0x583817||0xc8;return function(_0x59967e){if(_0x59967e){return _0x5b182b[_0x8267('0x1f')](_0x583817)[_0x8267('0x21')](_0x59967e);}};}function respondWithFilteredResult(_0x55b9f9,_0x59685b){return function(_0x2577a5){if(_0x2577a5){var _0x39f8c8=typeof _0x59685b[_0x8267('0x22')]===_0x8267('0x23')&&typeof _0x59685b['limit']===_0x8267('0x23');var _0x5e3542=_0x2577a5[_0x8267('0x24')];var _0x1b725d=_0x39f8c8?0x0:_0x59685b[_0x8267('0x22')];var _0x4ccd45=_0x39f8c8?_0x2577a5[_0x8267('0x24')]:_0x59685b[_0x8267('0x22')]+_0x59685b[_0x8267('0x25')];var _0x1dd8b7;if(_0x4ccd45>=_0x5e3542){_0x4ccd45=_0x5e3542;_0x1dd8b7=0xc8;}else{_0x1dd8b7=0xce;}_0x55b9f9[_0x8267('0x1f')](_0x1dd8b7);return _0x55b9f9[_0x8267('0x26')](_0x8267('0x27'),_0x1b725d+'-'+_0x4ccd45+'/'+_0x5e3542)['json'](_0x2577a5);}return null;};}function patchUpdates(_0x54db81){return function(_0x16cbf1){try{jsonpatch[_0x8267('0x28')](_0x16cbf1,_0x54db81,!![]);}catch(_0x92cac9){return BPromise[_0x8267('0x29')](_0x92cac9);}return _0x16cbf1[_0x8267('0x2a')]();};}function saveUpdates(_0x31b406,_0x55cf32){return function(_0x432f53){if(_0x432f53){return _0x432f53[_0x8267('0x2b')](_0x31b406)[_0x8267('0x2c')](function(_0x2903bb){return _0x2903bb;});}return null;};}function removeEntity(_0x5cb8ba,_0x47ee5a){return function(_0x2e8e7e){if(_0x2e8e7e){return _0x2e8e7e[_0x8267('0x2d')]()[_0x8267('0x2c')](function(){_0x5cb8ba[_0x8267('0x1f')](0xcc)[_0x8267('0x20')]();});}};}function handleEntityNotFound(_0xd6526e,_0x11fef5){return function(_0x59cee3){if(!_0x59cee3){_0xd6526e[_0x8267('0x1e')](0x194);}return _0x59cee3;};}function handleError(_0x31381b,_0x3861c7){_0x3861c7=_0x3861c7||0x1f4;return function(_0x3f2fbe){logger[_0x8267('0x2e')](_0x3f2fbe[_0x8267('0x2f')]);if(_0x3f2fbe[_0x8267('0x30')]){delete _0x3f2fbe[_0x8267('0x30')];}_0x31381b[_0x8267('0x1f')](_0x3861c7)[_0x8267('0x31')](_0x3f2fbe);};}exports[_0x8267('0x32')]=function(_0x5f5b0f,_0x32323b){var _0x4f7377={'raw':![],'where':{'id':_0x5f5b0f['params']['id']}},_0x1e976d={};_0x1e976d['model']=_['keys'](db['DashboardItem']['rawAttributes']);_0x1e976d[_0x8267('0x33')]=_[_0x8267('0x34')](_0x5f5b0f['query']);_0x1e976d[_0x8267('0x35')]=_[_0x8267('0x36')](_0x1e976d['model'],_0x1e976d[_0x8267('0x33')]);_0x4f7377[_0x8267('0x37')]=_[_0x8267('0x36')](_0x1e976d[_0x8267('0x38')],qs['fields'](_0x5f5b0f[_0x8267('0x33')][_0x8267('0x39')]));_0x4f7377[_0x8267('0x37')]=_0x4f7377['attributes'][_0x8267('0x3a')]?_0x4f7377[_0x8267('0x37')]:_0x1e976d[_0x8267('0x38')];if(_0x5f5b0f[_0x8267('0x33')][_0x8267('0x3b')]){_0x4f7377[_0x8267('0x3c')]=[{'all':!![]}];}_0x4f7377=_['merge']({},_0x4f7377,_0x5f5b0f[_0x8267('0x3d')]);return db[_0x8267('0x3e')][_0x8267('0x3f')](_0x4f7377)[_0x8267('0x2c')](handleEntityNotFound(_0x32323b,null))['then'](respondWithResult(_0x32323b,null))[_0x8267('0x40')](handleError(_0x32323b,null));};exports[_0x8267('0x2d')]=function(_0x3f8db6,_0x39d957){return db[_0x8267('0x3e')][_0x8267('0x3f')]({'where':{'id':_0x3f8db6[_0x8267('0x41')]['id']}})['then'](handleEntityNotFound(_0x39d957,null))[_0x8267('0x2c')](removeEntity(_0x39d957,null))[_0x8267('0x40')](handleError(_0x39d957,null));};function widgetAttributes(_0xa87476){try{switch(_0xa87476['type']){case _0x8267('0x42'):return[{'name':_0x8267('0x43'),'value':_0xa87476[_0x8267('0x43')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476[_0x8267('0x44')][0x0]['value']:undefined)||_0x8267('0x45')}];case _0x8267('0x46'):return[{'name':_0x8267('0x47'),'value':_0xa87476[_0x8267('0x47')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476['attrs'][0x0]?_0xa87476[_0x8267('0x44')][0x0][_0x8267('0x48')]:undefined)||''}];case _0x8267('0x49'):return[{'name':_0x8267('0x4a'),'value':_0xa87476[_0x8267('0x4a')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476[_0x8267('0x44')][0x0][_0x8267('0x48')]:undefined)||_0x8267('0x4b')},{'name':'attrTimezone','value':_0xa87476[_0x8267('0x4c')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x1]?_0xa87476['attrs'][0x1][_0x8267('0x48')]:undefined)||_0x8267('0x4d')},{'name':_0x8267('0x4e'),'value':_0xa87476[_0x8267('0x4e')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x2]?_0xa87476[_0x8267('0x44')][0x2][_0x8267('0x48')]:undefined)||0xc}];case _0x8267('0x4f'):return[{'name':_0x8267('0x50'),'value':_0xa87476['attrMetric']||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476[_0x8267('0x44')][0x0][_0x8267('0x48')]:undefined)||'total'},{'name':_0x8267('0x51'),'value':_0xa87476[_0x8267('0x51')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x1]?_0xa87476[_0x8267('0x44')][0x1][_0x8267('0x48')]:undefined)||[]},{'name':_0x8267('0x4e'),'value':_0xa87476[_0x8267('0x4e')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x2]?_0xa87476[_0x8267('0x44')][0x2][_0x8267('0x48')]:undefined)||0x14},{'name':'attrChannel','value':_0xa87476['attrChannel']||(_0xa87476[_0x8267('0x44')]&&_0xa87476['attrs'][0x3]?_0xa87476['attrs'][0x3][_0x8267('0x48')]:undefined)||_0x8267('0x52')},{'name':_0x8267('0x53'),'value':_0xa87476[_0x8267('0x53')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x4]?_0xa87476[_0x8267('0x44')][0x4][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x54'),'value':_0xa87476[_0x8267('0x54')]||(_0xa87476['attrs']&&_0xa87476['attrs'][0x5]?_0xa87476[_0x8267('0x44')][0x5]['value']:undefined)||''},{'name':_0x8267('0x55'),'value':_0xa87476[_0x8267('0x55')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x6]?_0xa87476['attrs'][0x6][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x56'),'value':_0xa87476[_0x8267('0x56')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x7]?_0xa87476[_0x8267('0x44')][0x7][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x57'),'value':_0xa87476[_0x8267('0x57')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x8]?_0xa87476[_0x8267('0x44')][0x8][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x58'),'value':_0xa87476[_0x8267('0x58')]||(_0xa87476['attrs']&&_0xa87476[_0x8267('0x44')][0x9]?_0xa87476[_0x8267('0x44')][0x9][_0x8267('0x48')]:undefined)||''}];case _0x8267('0x59'):case _0x8267('0x5a'):return[{'name':'attrSerie1','value':_0xa87476[_0x8267('0x5b')]||(_0xa87476['attrs']&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476[_0x8267('0x44')][0x0][_0x8267('0x48')]:undefined)||'total'},{'name':_0x8267('0x5c'),'value':_0xa87476[_0x8267('0x5c')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x1]?_0xa87476[_0x8267('0x44')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0xa87476[_0x8267('0x5d')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476['attrs'][0x2]?_0xa87476[_0x8267('0x44')][0x2]['value']:undefined)||null},{'name':_0x8267('0x51'),'value':_0xa87476[_0x8267('0x51')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x3]?_0xa87476[_0x8267('0x44')][0x3][_0x8267('0x48')]:undefined)||[]},{'name':_0x8267('0x5e'),'value':_0xa87476[_0x8267('0x5e')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x4]?_0xa87476[_0x8267('0x44')][0x4][_0x8267('0x48')]:undefined)||_0x8267('0x52')},{'name':_0x8267('0x53'),'value':_0xa87476[_0x8267('0x53')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476['attrs'][0x5]?_0xa87476[_0x8267('0x44')][0x5][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x54'),'value':_0xa87476['attrFaxAccounts']||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x6]?_0xa87476['attrs'][0x6][_0x8267('0x48')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xa87476[_0x8267('0x55')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476['attrs'][0x7]?_0xa87476[_0x8267('0x44')][0x7][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x56'),'value':_0xa87476[_0x8267('0x56')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x8]?_0xa87476[_0x8267('0x44')][0x8]['value']:undefined)||''},{'name':_0x8267('0x57'),'value':_0xa87476[_0x8267('0x57')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x9]?_0xa87476[_0x8267('0x44')][0x9][_0x8267('0x48')]:undefined)||''},{'name':_0x8267('0x58'),'value':_0xa87476[_0x8267('0x58')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0xa]?_0xa87476['attrs'][0xa][_0x8267('0x48')]:undefined)||''}];case _0x8267('0x5f'):return[{'name':_0x8267('0x60'),'type':_0xa87476[_0x8267('0x61')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476[_0x8267('0x44')][0x0][_0x8267('0x62')]:undefined)||null,'value':_0xa87476[_0x8267('0x60')]||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x0]?_0xa87476['attrs'][0x0][_0x8267('0x48')]:undefined)||null},{'name':_0x8267('0x63'),'value':_0xa87476['attrRefresh']||(_0xa87476[_0x8267('0x44')]&&_0xa87476[_0x8267('0x44')][0x1]?_0xa87476[_0x8267('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x827f05){logger[_0x8267('0x2e')](_0x8267('0x64'),JSON[_0x8267('0x65')](_0x827f05));return[];}}exports[_0x8267('0x66')]=function(_0x290a6a,_0x5dcf67){if(_0x290a6a[_0x8267('0x67')]){_0x290a6a[_0x8267('0x67')][_0x8267('0x44')]=widgetAttributes(_0x290a6a[_0x8267('0x67')]);}return db[_0x8267('0x3e')]['create'](_0x290a6a[_0x8267('0x67')],{})['then'](respondWithResult(_0x5dcf67,0xc9))[_0x8267('0x40')](handleError(_0x5dcf67,null));};exports[_0x8267('0x2b')]=function(_0x2822b2,_0x18a4c6){if(_0x2822b2[_0x8267('0x67')]['id']){delete _0x2822b2[_0x8267('0x67')]['id'];}_0x2822b2['body'][_0x8267('0x44')]=widgetAttributes(_0x2822b2[_0x8267('0x67')]);return db['DashboardItem']['find']({'where':{'id':_0x2822b2[_0x8267('0x41')]['id']}})['then'](handleEntityNotFound(_0x18a4c6,null))['then'](saveUpdates(_0x2822b2[_0x8267('0x67')],null))[_0x8267('0x2c')](respondWithResult(_0x18a4c6,null))[_0x8267('0x40')](handleError(_0x18a4c6,null));}; \ No newline at end of file +var _0x5f71=['attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','attrEmailAccounts','attrSmsAccounts','web-report','attrReport','type','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','request-promise','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','name','send','show','params','model','DashboardItem','query','filters','intersection','fields','attributes','length','include','options','find','catch','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x2a3360,_0x4db163){var _0x36a615=function(_0x3cabf0){while(--_0x3cabf0){_0x2a3360['push'](_0x2a3360['shift']());}};_0x36a615(++_0x4db163);}(_0x5f71,0xc9));var _0x15f7=function(_0x4b646d,_0x1c2a50){_0x4b646d=_0x4b646d-0x0;var _0x4935ee=_0x5f71[_0x4b646d];return _0x4935ee;};'use strict';var emlformat=require(_0x15f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15f7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15f7('0x3'));var path=require(_0x15f7('0x4'));var sox=require('sox');var csv=require(_0x15f7('0x5'));var ejs=require(_0x15f7('0x6'));var fs=require('fs');var fs_extra=require(_0x15f7('0x7'));var _=require(_0x15f7('0x8'));var squel=require(_0x15f7('0x9'));var crypto=require(_0x15f7('0xa'));var jsforce=require(_0x15f7('0xb'));var deskjs=require(_0x15f7('0xc'));var toCsv=require(_0x15f7('0x5'));var querystring=require(_0x15f7('0xd'));var Papa=require(_0x15f7('0xe'));var Redis=require(_0x15f7('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x15f7('0x10'));var hardwareService=require(_0x15f7('0x11'));var logger=require('../../config/logger')(_0x15f7('0x12'));var utils=require(_0x15f7('0x13'));var config=require(_0x15f7('0x14'));var licenseUtil=require(_0x15f7('0x15'));var db=require(_0x15f7('0x16'))['db'];config[_0x15f7('0x17')]=_[_0x15f7('0x18')](config['redis'],{'host':_0x15f7('0x19'),'port':0x18eb});var socket=require(_0x15f7('0x1a'))(new Redis(config[_0x15f7('0x17')]));require('./dashboardItem.socket')[_0x15f7('0x1b')](socket);function respondWithStatusCode(_0x40dcb1,_0x52c1be){_0x52c1be=_0x52c1be||0xcc;return function(_0x24b6f5){if(_0x24b6f5){return _0x40dcb1[_0x15f7('0x1c')](_0x52c1be);}return _0x40dcb1[_0x15f7('0x1d')](_0x52c1be)[_0x15f7('0x1e')]();};}function respondWithResult(_0x345892,_0x2c0e67){_0x2c0e67=_0x2c0e67||0xc8;return function(_0x42928d){if(_0x42928d){return _0x345892['status'](_0x2c0e67)[_0x15f7('0x1f')](_0x42928d);}};}function respondWithFilteredResult(_0x385844,_0x4e61c9){return function(_0x2c78ca){if(_0x2c78ca){var _0x333ff8=typeof _0x4e61c9[_0x15f7('0x20')]===_0x15f7('0x21')&&typeof _0x4e61c9[_0x15f7('0x22')]===_0x15f7('0x21');var _0x3ced97=_0x2c78ca['count'];var _0x299fcf=_0x333ff8?0x0:_0x4e61c9[_0x15f7('0x20')];var _0x1362e1=_0x333ff8?_0x2c78ca[_0x15f7('0x23')]:_0x4e61c9[_0x15f7('0x20')]+_0x4e61c9[_0x15f7('0x22')];var _0x3bf068;if(_0x1362e1>=_0x3ced97){_0x1362e1=_0x3ced97;_0x3bf068=0xc8;}else{_0x3bf068=0xce;}_0x385844['status'](_0x3bf068);return _0x385844['set'](_0x15f7('0x24'),_0x299fcf+'-'+_0x1362e1+'/'+_0x3ced97)[_0x15f7('0x1f')](_0x2c78ca);}return null;};}function patchUpdates(_0x370652){return function(_0x35de93){try{jsonpatch[_0x15f7('0x25')](_0x35de93,_0x370652,!![]);}catch(_0x5cab58){return BPromise[_0x15f7('0x26')](_0x5cab58);}return _0x35de93['save']();};}function saveUpdates(_0x292958,_0xe6ec62){return function(_0x49fc13){if(_0x49fc13){return _0x49fc13['update'](_0x292958)[_0x15f7('0x27')](function(_0x5a1e21){return _0x5a1e21;});}return null;};}function removeEntity(_0x53128c,_0x2928fa){return function(_0x5de827){if(_0x5de827){return _0x5de827[_0x15f7('0x28')]()[_0x15f7('0x27')](function(){_0x53128c[_0x15f7('0x1d')](0xcc)[_0x15f7('0x1e')]();});}};}function handleEntityNotFound(_0x2d4d2d,_0x59b9e2){return function(_0x3adf28){if(!_0x3adf28){_0x2d4d2d[_0x15f7('0x1c')](0x194);}return _0x3adf28;};}function handleError(_0x1b50ed,_0x48f27c){_0x48f27c=_0x48f27c||0x1f4;return function(_0x4dd3d6){logger['error'](_0x4dd3d6['stack']);if(_0x4dd3d6[_0x15f7('0x29')]){delete _0x4dd3d6[_0x15f7('0x29')];}_0x1b50ed[_0x15f7('0x1d')](_0x48f27c)[_0x15f7('0x2a')](_0x4dd3d6);};}exports[_0x15f7('0x2b')]=function(_0x477950,_0x5394b6){var _0x521934={'raw':![],'where':{'id':_0x477950[_0x15f7('0x2c')]['id']}},_0x31bf43={};_0x31bf43[_0x15f7('0x2d')]=_['keys'](db[_0x15f7('0x2e')]['rawAttributes']);_0x31bf43[_0x15f7('0x2f')]=_['keys'](_0x477950[_0x15f7('0x2f')]);_0x31bf43[_0x15f7('0x30')]=_[_0x15f7('0x31')](_0x31bf43[_0x15f7('0x2d')],_0x31bf43['query']);_0x521934['attributes']=_[_0x15f7('0x31')](_0x31bf43[_0x15f7('0x2d')],qs[_0x15f7('0x32')](_0x477950[_0x15f7('0x2f')][_0x15f7('0x32')]));_0x521934[_0x15f7('0x33')]=_0x521934[_0x15f7('0x33')][_0x15f7('0x34')]?_0x521934[_0x15f7('0x33')]:_0x31bf43[_0x15f7('0x2d')];if(_0x477950[_0x15f7('0x2f')]['includeAll']){_0x521934[_0x15f7('0x35')]=[{'all':!![]}];}_0x521934=_['merge']({},_0x521934,_0x477950[_0x15f7('0x36')]);return db[_0x15f7('0x2e')][_0x15f7('0x37')](_0x521934)[_0x15f7('0x27')](handleEntityNotFound(_0x5394b6,null))[_0x15f7('0x27')](respondWithResult(_0x5394b6,null))[_0x15f7('0x38')](handleError(_0x5394b6,null));};exports['destroy']=function(_0x1af447,_0x5a2343){return db[_0x15f7('0x2e')][_0x15f7('0x37')]({'where':{'id':_0x1af447[_0x15f7('0x2c')]['id']}})[_0x15f7('0x27')](handleEntityNotFound(_0x5a2343,null))[_0x15f7('0x27')](removeEntity(_0x5a2343,null))['catch'](handleError(_0x5a2343,null));};function widgetAttributes(_0x2c875e){try{switch(_0x2c875e['type']){case'iframe':return[{'name':_0x15f7('0x39'),'value':_0x2c875e['attrUrl']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||_0x15f7('0x3c')}];case _0x15f7('0x3d'):return[{'name':_0x15f7('0x3e'),'value':_0x2c875e['attrPath']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x2c875e[_0x15f7('0x3f')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||_0x15f7('0x40')},{'name':_0x15f7('0x41'),'value':_0x2c875e[_0x15f7('0x41')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||'0.00'},{'name':_0x15f7('0x42'),'value':_0x2c875e[_0x15f7('0x42')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2]['value']:undefined)||0xc}];case _0x15f7('0x43'):return[{'name':_0x15f7('0x44'),'value':_0x2c875e[_0x15f7('0x44')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x3b')]:undefined)||'total'},{'name':_0x15f7('0x45'),'value':_0x2c875e['attrVoiceQueues']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||[]},{'name':_0x15f7('0x42'),'value':_0x2c875e[_0x15f7('0x42')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2][_0x15f7('0x3b')]:undefined)||0x14},{'name':_0x15f7('0x46'),'value':_0x2c875e[_0x15f7('0x46')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x3]?_0x2c875e['attrs'][0x3][_0x15f7('0x3b')]:undefined)||_0x15f7('0x47')},{'name':'attrEmailAccounts','value':_0x2c875e['attrEmailAccounts']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x4]?_0x2c875e[_0x15f7('0x3a')][0x4]['value']:undefined)||''},{'name':_0x15f7('0x48'),'value':_0x2c875e[_0x15f7('0x48')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x5]?_0x2c875e[_0x15f7('0x3a')][0x5][_0x15f7('0x3b')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2c875e['attrSmsAccounts']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x6]?_0x2c875e[_0x15f7('0x3a')][0x6][_0x15f7('0x3b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2c875e[_0x15f7('0x49')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x7]?_0x2c875e[_0x15f7('0x3a')][0x7][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4a'),'value':_0x2c875e[_0x15f7('0x4a')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x8]?_0x2c875e[_0x15f7('0x3a')][0x8][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4b'),'value':_0x2c875e[_0x15f7('0x4b')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x9]?_0x2c875e['attrs'][0x9][_0x15f7('0x3b')]:undefined)||''}];case _0x15f7('0x4c'):case'pie-chart':return[{'name':_0x15f7('0x4d'),'value':_0x2c875e[_0x15f7('0x4d')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0]['value']:undefined)||_0x15f7('0x4e')},{'name':_0x15f7('0x4f'),'value':_0x2c875e[_0x15f7('0x4f')]||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||null},{'name':'attrSerie3','value':_0x2c875e[_0x15f7('0x50')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x2]?_0x2c875e[_0x15f7('0x3a')][0x2][_0x15f7('0x3b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2c875e[_0x15f7('0x45')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x3]?_0x2c875e['attrs'][0x3]['value']:undefined)||[]},{'name':_0x15f7('0x46'),'value':_0x2c875e[_0x15f7('0x46')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x4]?_0x2c875e[_0x15f7('0x3a')][0x4][_0x15f7('0x3b')]:undefined)||'voice'},{'name':_0x15f7('0x51'),'value':_0x2c875e[_0x15f7('0x51')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x5]?_0x2c875e['attrs'][0x5][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x48'),'value':_0x2c875e[_0x15f7('0x48')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e['attrs'][0x6]?_0x2c875e[_0x15f7('0x3a')][0x6][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x52'),'value':_0x2c875e[_0x15f7('0x52')]||(_0x2c875e['attrs']&&_0x2c875e['attrs'][0x7]?_0x2c875e[_0x15f7('0x3a')][0x7][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x49'),'value':_0x2c875e['attrOpenchannelAccounts']||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0x8]?_0x2c875e[_0x15f7('0x3a')][0x8][_0x15f7('0x3b')]:undefined)||''},{'name':_0x15f7('0x4a'),'value':_0x2c875e[_0x15f7('0x4a')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x9]?_0x2c875e[_0x15f7('0x3a')][0x9][_0x15f7('0x3b')]:undefined)||''},{'name':'attrChatWebsites','value':_0x2c875e['attrChatWebsites']||(_0x2c875e['attrs']&&_0x2c875e[_0x15f7('0x3a')][0xa]?_0x2c875e[_0x15f7('0x3a')][0xa][_0x15f7('0x3b')]:undefined)||''}];case _0x15f7('0x53'):return[{'name':_0x15f7('0x54'),'type':_0x2c875e['reportType']||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e[_0x15f7('0x3a')][0x0][_0x15f7('0x55')]:undefined)||null,'value':_0x2c875e[_0x15f7('0x54')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x0]?_0x2c875e['attrs'][0x0][_0x15f7('0x3b')]:undefined)||null},{'name':'attrRefresh','value':_0x2c875e[_0x15f7('0x56')]||(_0x2c875e[_0x15f7('0x3a')]&&_0x2c875e[_0x15f7('0x3a')][0x1]?_0x2c875e[_0x15f7('0x3a')][0x1][_0x15f7('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x1cabc3){logger[_0x15f7('0x57')](_0x15f7('0x58'),JSON['stringify'](_0x1cabc3));return[];}}exports[_0x15f7('0x59')]=function(_0x3e320d,_0x5e0657){if(_0x3e320d[_0x15f7('0x5a')]){_0x3e320d['body'][_0x15f7('0x3a')]=widgetAttributes(_0x3e320d[_0x15f7('0x5a')]);}return db[_0x15f7('0x2e')][_0x15f7('0x59')](_0x3e320d['body'],{})['then'](respondWithResult(_0x5e0657,0xc9))['catch'](handleError(_0x5e0657,null));};exports[_0x15f7('0x5b')]=function(_0x343b44,_0x249087){if(_0x343b44[_0x15f7('0x5a')]['id']){delete _0x343b44[_0x15f7('0x5a')]['id'];}_0x343b44[_0x15f7('0x5a')]['attrs']=widgetAttributes(_0x343b44['body']);return db['DashboardItem'][_0x15f7('0x37')]({'where':{'id':_0x343b44[_0x15f7('0x2c')]['id']}})['then'](handleEntityNotFound(_0x249087,null))[_0x15f7('0x27')](saveUpdates(_0x343b44[_0x15f7('0x5a')],null))[_0x15f7('0x27')](respondWithResult(_0x249087,null))[_0x15f7('0x38')](handleError(_0x249087,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e484746..084fae1 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 _0xab29=['../../mysqldb','DashboardItem','setMaxListeners','emit','hook','events'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xab29,0x11f));var _0x9ab2=function(_0x4ae3b3,_0x5ecb99){_0x4ae3b3=_0x4ae3b3-0x0;var _0x3ab6c7=_0xab29[_0x4ae3b3];return _0x3ab6c7;};'use strict';var EventEmitter=require(_0x9ab2('0x0'));var DashboardItem=require(_0x9ab2('0x1'))['db'][_0x9ab2('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9ab2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x192988){return function(_0x100107,_0x330ff1,_0x56df21){DashboardItemEvents[_0x9ab2('0x4')](_0x192988+':'+_0x100107['id'],_0x100107);DashboardItemEvents[_0x9ab2('0x4')](_0x192988,_0x100107);_0x56df21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x9ab2('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x3f90=['remove','emit','hasOwnProperty','hook','../../mysqldb','DashboardItem','setMaxListeners','save','update'];(function(_0x280ad6,_0x12f2f3){var _0x3db28f=function(_0x468727){while(--_0x468727){_0x280ad6['push'](_0x280ad6['shift']());}};_0x3db28f(++_0x12f2f3);}(_0x3f90,0x175));var _0x03f9=function(_0x86e7ef,_0x2c561e){_0x86e7ef=_0x86e7ef-0x0;var _0x449894=_0x3f90[_0x86e7ef];return _0x449894;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x03f9('0x0'))['db'][_0x03f9('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x03f9('0x2')](0x0);var events={'afterCreate':_0x03f9('0x3'),'afterUpdate':_0x03f9('0x4'),'afterDestroy':_0x03f9('0x5')};function emitEvent(_0x223d3c){return function(_0x230651,_0x1a5fb8,_0x8a9679){DashboardItemEvents[_0x03f9('0x6')](_0x223d3c+':'+_0x230651['id'],_0x230651);DashboardItemEvents[_0x03f9('0x6')](_0x223d3c,_0x230651);_0x8a9679(null);};}for(var e in events){if(events[_0x03f9('0x7')](e)){var event=events[e];DashboardItem[_0x03f9('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d5a789d..ee2f661 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 _0x6a93=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0x96f83c,_0x418974){var _0x184fb3=function(_0x313680){while(--_0x313680){_0x96f83c['push'](_0x96f83c['shift']());}};_0x184fb3(++_0x418974);}(_0x6a93,0x1d7));var _0x36a9=function(_0x3e2dd0,_0x7d4b5f){_0x3e2dd0=_0x3e2dd0-0x0;var _0x25384b=_0x6a93[_0x3e2dd0];return _0x25384b;};'use strict';var _=require(_0x36a9('0x0'));var util=require(_0x36a9('0x1'));var logger=require(_0x36a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x36a9('0x3'));var rp=require(_0x36a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36a9('0x5'));var config=require(_0x36a9('0x6'));var attributes=require(_0x36a9('0x7'));module[_0x36a9('0x8')]=function(_0x2c1be3,_0x6de7d){return _0x2c1be3[_0x36a9('0x9')](_0x36a9('0xa'),attributes,{'tableName':_0x36a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7793=['util','../../config/logger','moment','path','rimraf','./dashboardItem.attributes','exports','define','dashboard_items'];(function(_0x2c9e50,_0x50fc20){var _0x447e2a=function(_0x272c13){while(--_0x272c13){_0x2c9e50['push'](_0x2c9e50['shift']());}};_0x447e2a(++_0x50fc20);}(_0x7793,0x120));var _0x3779=function(_0x91fefb,_0x569400){_0x91fefb=_0x91fefb-0x0;var _0x3a5482=_0x7793[_0x91fefb];return _0x3a5482;};'use strict';var _=require('lodash');var util=require(_0x3779('0x0'));var logger=require(_0x3779('0x1'))('api');var moment=require(_0x3779('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3779('0x3'));var rimraf=require(_0x3779('0x4'));var config=require('../../config/environment');var attributes=require(_0x3779('0x5'));module[_0x3779('0x6')]=function(_0x59dfb7,_0x25b30d){return _0x59dfb7[_0x3779('0x7')]('DashboardItem',attributes,{'tableName':_0x3779('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index fb4f263..208c8bb 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 _0x54b3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x3a55fb,_0x1c26b7){var _0x7ba87e=function(_0x3a4f7a){while(--_0x3a4f7a){_0x3a55fb['push'](_0x3a55fb['shift']());}};_0x7ba87e(++_0x1c26b7);}(_0x54b3,0xc6));var _0x354b=function(_0x37e719,_0x5b83fc){_0x37e719=_0x37e719-0x0;var _0x290e63=_0x54b3[_0x37e719];return _0x290e63;};'use strict';var _=require(_0x354b('0x0'));var util=require('util');var moment=require(_0x354b('0x1'));var BPromise=require(_0x354b('0x2'));var rs=require(_0x354b('0x3'));var fs=require('fs');var Redis=require(_0x354b('0x4'));var db=require(_0x354b('0x5'))['db'];var utils=require(_0x354b('0x6'));var logger=require(_0x354b('0x7'))('rpc');var config=require(_0x354b('0x8'));var jayson=require(_0x354b('0x9'));var client=jayson[_0x354b('0xa')]['http']({'port':0x232a});config[_0x354b('0xb')]=_[_0x354b('0xc')](config[_0x354b('0xb')],{'host':_0x354b('0xd'),'port':0x18eb});var socket=require(_0x354b('0xe'))(new Redis(config[_0x354b('0xb')]));require(_0x354b('0xf'))[_0x354b('0x10')](socket);function respondWithRpcPromise(_0x5890d4,_0x36d6bc,_0x1723e4){return new BPromise(function(_0x1d06c9,_0x938a3c){return client[_0x354b('0x11')](_0x5890d4,_0x1723e4)[_0x354b('0x12')](function(_0x592bbe){logger[_0x354b('0x13')]('DashboardItem,\x20%s,\x20%s',_0x36d6bc,_0x354b('0x14'));logger[_0x354b('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x36d6bc,_0x354b('0x14'),JSON[_0x354b('0x16')](_0x592bbe));if(_0x592bbe['error']){if(_0x592bbe[_0x354b('0x17')][_0x354b('0x18')]===0x1f4){logger[_0x354b('0x17')](_0x354b('0x19'),_0x36d6bc,_0x592bbe['error'][_0x354b('0x1a')]);return _0x938a3c(_0x592bbe[_0x354b('0x17')][_0x354b('0x1a')]);}logger['error'](_0x354b('0x19'),_0x36d6bc,_0x592bbe[_0x354b('0x17')][_0x354b('0x1a')]);return _0x1d06c9(_0x592bbe[_0x354b('0x17')]['message']);}else{logger[_0x354b('0x13')]('DashboardItem,\x20%s,\x20%s',_0x36d6bc,'request\x20sent');_0x1d06c9(_0x592bbe[_0x354b('0x1b')][_0x354b('0x1a')]);}})[_0x354b('0x1c')](function(_0x5a6b78){logger[_0x354b('0x17')](_0x354b('0x19'),_0x36d6bc,_0x5a6b78);_0x938a3c(_0x5a6b78);});});} \ No newline at end of file +var _0x0103=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0103,0x74));var _0x3010=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x0103[_0x3b0c9d];return _0xcfc8d7;};'use strict';var _=require('lodash');var util=require(_0x3010('0x0'));var moment=require(_0x3010('0x1'));var BPromise=require(_0x3010('0x2'));var rs=require(_0x3010('0x3'));var fs=require('fs');var Redis=require(_0x3010('0x4'));var db=require(_0x3010('0x5'))['db'];var utils=require(_0x3010('0x6'));var logger=require(_0x3010('0x7'))(_0x3010('0x8'));var config=require('../../config/environment');var jayson=require(_0x3010('0x9'));var client=jayson[_0x3010('0xa')][_0x3010('0xb')]({'port':0x232a});config[_0x3010('0xc')]=_[_0x3010('0xd')](config[_0x3010('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x3010('0xe'))(new Redis(config[_0x3010('0xc')]));require(_0x3010('0xf'))[_0x3010('0x10')](socket);function respondWithRpcPromise(_0x17c9f2,_0x24f685,_0x230f7e){return new BPromise(function(_0x56e69c,_0x2c7b73){return client[_0x3010('0x11')](_0x17c9f2,_0x230f7e)[_0x3010('0x12')](function(_0x57132b){logger[_0x3010('0x13')](_0x3010('0x14'),_0x24f685,_0x3010('0x15'));logger[_0x3010('0x16')](_0x3010('0x17'),_0x24f685,_0x3010('0x15'),JSON[_0x3010('0x18')](_0x57132b));if(_0x57132b[_0x3010('0x19')]){if(_0x57132b['error'][_0x3010('0x1a')]===0x1f4){logger[_0x3010('0x19')]('DashboardItem,\x20%s,\x20%s',_0x24f685,_0x57132b[_0x3010('0x19')][_0x3010('0x1b')]);return _0x2c7b73(_0x57132b['error'][_0x3010('0x1b')]);}logger[_0x3010('0x19')](_0x3010('0x14'),_0x24f685,_0x57132b[_0x3010('0x19')][_0x3010('0x1b')]);return _0x56e69c(_0x57132b[_0x3010('0x19')][_0x3010('0x1b')]);}else{logger[_0x3010('0x13')]('DashboardItem,\x20%s,\x20%s',_0x24f685,_0x3010('0x15'));_0x56e69c(_0x57132b[_0x3010('0x1c')][_0x3010('0x1b')]);}})[_0x3010('0x1d')](function(_0x1a15c5){logger['error'](_0x3010('0x14'),_0x24f685,_0x1a15c5);_0x2c7b73(_0x1a15c5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index a0ab4b0..7d4637c 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 _0x8081=['./dashboardItem.events','save','emit','removeListener','register','length','dashboardItem:'];(function(_0x22a90a,_0x461cdd){var _0x511604=function(_0x273219){while(--_0x273219){_0x22a90a['push'](_0x22a90a['shift']());}};_0x511604(++_0x461cdd);}(_0x8081,0xb6));var _0x1808=function(_0xb476ce,_0x48d41b){_0xb476ce=_0xb476ce-0x0;var _0x4ec416=_0x8081[_0xb476ce];return _0x4ec416;};'use strict';var DashboardItemEvents=require(_0x1808('0x0'));var events=[_0x1808('0x1'),'remove','update'];function createListener(_0x8b704d,_0x205e5b){return function(_0x2a04b3){_0x205e5b[_0x1808('0x2')](_0x8b704d,_0x2a04b3);};}function removeListener(_0x173417,_0x33dd72){return function(){DashboardItemEvents[_0x1808('0x3')](_0x173417,_0x33dd72);};}exports[_0x1808('0x4')]=function(_0x3d9493){for(var _0xe86097=0x0,_0x39616c=events[_0x1808('0x5')];_0xe86097<_0x39616c;_0xe86097++){var _0x368efd=events[_0xe86097];var _0x34b307=createListener(_0x1808('0x6')+_0x368efd,_0x3d9493);DashboardItemEvents['on'](_0x368efd,_0x34b307);}}; \ No newline at end of file +var _0x1e42=['remove','update','emit','removeListener','dashboardItem:','./dashboardItem.events'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0x1e42,0x1eb));var _0x21e4=function(_0x4a873c,_0x29a35b){_0x4a873c=_0x4a873c-0x0;var _0x4f5762=_0x1e42[_0x4a873c];return _0x4f5762;};'use strict';var DashboardItemEvents=require(_0x21e4('0x0'));var events=['save',_0x21e4('0x1'),_0x21e4('0x2')];function createListener(_0xed8c58,_0x92b882){return function(_0x3aa9cb){_0x92b882[_0x21e4('0x3')](_0xed8c58,_0x3aa9cb);};}function removeListener(_0x147a6c,_0x30f446){return function(){DashboardItemEvents[_0x21e4('0x4')](_0x147a6c,_0x30f446);};}exports['register']=function(_0x5e8397){for(var _0x223ce2=0x0,_0x20e972=events['length'];_0x223ce2<_0x20e972;_0x223ce2++){var _0x2b3d13=events[_0x223ce2];var _0x45142f=createListener(_0x21e4('0x5')+_0x2b3d13,_0x5e8397);DashboardItemEvents['on'](_0x2b3d13,_0x45142f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5deabd9..ddc6331 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 _0xa94c=['/:id','isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x939812,_0x22ac43){var _0x66e389=function(_0x217d1e){while(--_0x217d1e){_0x939812['push'](_0x939812['shift']());}};_0x66e389(++_0x22ac43);}(_0xa94c,0x16d));var _0xca94=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xa94c[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0xca94('0x0'));var util=require(_0xca94('0x1'));var path=require(_0xca94('0x2'));var timeout=require(_0xca94('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xca94('0x4'));var auth=require(_0xca94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xca94('0x6'));var controller=require(_0xca94('0x7'));router[_0xca94('0x8')](_0xca94('0x9'),auth[_0xca94('0xa')](),controller[_0xca94('0xb')]);router[_0xca94('0xc')]('/',auth[_0xca94('0xa')](),controller[_0xca94('0xd')]);router['put'](_0xca94('0x9'),auth['isAuthenticated'](),controller[_0xca94('0xe')]);router[_0xca94('0xf')](_0xca94('0x9'),auth[_0xca94('0xa')](),controller[_0xca94('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1d2f=['fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x5e6d73,_0x6dbce4){var _0x1cd133=function(_0xb2b536){while(--_0xb2b536){_0x5e6d73['push'](_0x5e6d73['shift']());}};_0x1cd133(++_0x6dbce4);}(_0x1d2f,0x96));var _0xf1d2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1d2f[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf1d2('0x0'));var timeout=require(_0xf1d2('0x1'));var express=require(_0xf1d2('0x2'));var router=express['Router']();var fs_extra=require(_0xf1d2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf1d2('0x4'));var config=require(_0xf1d2('0x5'));var controller=require(_0xf1d2('0x6'));router[_0xf1d2('0x7')](_0xf1d2('0x8'),auth['isAuthenticated'](),controller[_0xf1d2('0x9')]);router[_0xf1d2('0xa')]('/',auth[_0xf1d2('0xb')](),controller['create']);router[_0xf1d2('0xc')](_0xf1d2('0x8'),auth['isAuthenticated'](),controller[_0xf1d2('0xd')]);router[_0xf1d2('0xe')](_0xf1d2('0x8'),auth['isAuthenticated'](),controller[_0xf1d2('0xf')]);module[_0xf1d2('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 74096b5..6a1f7d7 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 _0xf999=['second','sequelize','STRING','first'];(function(_0x300c74,_0x2c4ef1){var _0x48903f=function(_0x16f95e){while(--_0x16f95e){_0x300c74['push'](_0x300c74['shift']());}};_0x48903f(++_0x2c4ef1);}(_0xf999,0x1cd));var _0x9f99=function(_0x1f0d02,_0x544507){_0x1f0d02=_0x1f0d02-0x0;var _0x7cb25=_0xf999[_0x1f0d02];return _0x7cb25;};'use strict';var Sequelize=require(_0x9f99('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f99('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x9f99('0x2'),_0x9f99('0x3'),'third'),'allowNull':![],'defaultValue':_0x9f99('0x2')},'description':{'type':Sequelize[_0x9f99('0x1')]}}; \ No newline at end of file +var _0x9fbb=['first','sequelize','exports','STRING','second','third'];(function(_0x5ba6cc,_0x580284){var _0x558a40=function(_0x152bd7){while(--_0x152bd7){_0x5ba6cc['push'](_0x5ba6cc['shift']());}};_0x558a40(++_0x580284);}(_0x9fbb,0x15d));var _0xb9fb=function(_0x5f5c8f,_0x7b5224){_0x5f5c8f=_0x5f5c8f-0x0;var _0x14cf29=_0x9fbb[_0x5f5c8f];return _0x14cf29;};'use strict';var Sequelize=require(_0xb9fb('0x0'));module[_0xb9fb('0x1')]={'name':{'type':Sequelize[_0xb9fb('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xb9fb('0x3'),_0xb9fb('0x4')),'allowNull':![],'defaultValue':_0xb9fb('0x5')},'description':{'type':Sequelize[_0xb9fb('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 67963d0..05ab244 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 _0x9219=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','Dispositions','UserProfileResource','destroy','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','create','role','user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9219,0x1cd));var _0x9921=function(_0xa3a9a3,_0x219211){_0xa3a9a3=_0xa3a9a3-0x0;var _0x52e59e=_0x9219[_0xa3a9a3];return _0x52e59e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9921('0x0'));var zipdir=require(_0x9921('0x1'));var jsonpatch=require(_0x9921('0x2'));var rp=require(_0x9921('0x3'));var moment=require(_0x9921('0x4'));var BPromise=require(_0x9921('0x5'));var Mustache=require(_0x9921('0x6'));var util=require(_0x9921('0x7'));var path=require(_0x9921('0x8'));var sox=require('sox');var csv=require(_0x9921('0x9'));var ejs=require(_0x9921('0xa'));var fs=require('fs');var fs_extra=require(_0x9921('0xb'));var _=require('lodash');var squel=require(_0x9921('0xc'));var crypto=require(_0x9921('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9921('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9921('0xf'));var Redis=require(_0x9921('0x10'));var authService=require(_0x9921('0x11'));var qs=require(_0x9921('0x12'));var as=require(_0x9921('0x13'));var hardwareService=require(_0x9921('0x14'));var logger=require('../../config/logger')(_0x9921('0x15'));var utils=require(_0x9921('0x16'));var config=require(_0x9921('0x17'));var licenseUtil=require(_0x9921('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ccf58,_0x3fee27){_0x3fee27=_0x3fee27||0xcc;return function(_0x36dd9c){if(_0x36dd9c){return _0x2ccf58[_0x9921('0x19')](_0x3fee27);}return _0x2ccf58['status'](_0x3fee27)[_0x9921('0x1a')]();};}function respondWithResult(_0x22f828,_0x430d86){_0x430d86=_0x430d86||0xc8;return function(_0x60c304){if(_0x60c304){return _0x22f828[_0x9921('0x1b')](_0x430d86)[_0x9921('0x1c')](_0x60c304);}};}function respondWithFilteredResult(_0x53531,_0x12315d){return function(_0x1d8e02){if(_0x1d8e02){var _0x2a703c=typeof _0x12315d[_0x9921('0x1d')]===_0x9921('0x1e')&&typeof _0x12315d[_0x9921('0x1f')]===_0x9921('0x1e');var _0x382b1b=_0x1d8e02['count'];var _0x2df4a9=_0x2a703c?0x0:_0x12315d[_0x9921('0x1d')];var _0x68a29b=_0x2a703c?_0x1d8e02[_0x9921('0x20')]:_0x12315d[_0x9921('0x1d')]+_0x12315d[_0x9921('0x1f')];var _0x5bb1a9;if(_0x68a29b>=_0x382b1b){_0x68a29b=_0x382b1b;_0x5bb1a9=0xc8;}else{_0x5bb1a9=0xce;}_0x53531[_0x9921('0x1b')](_0x5bb1a9);return _0x53531[_0x9921('0x21')](_0x9921('0x22'),_0x2df4a9+'-'+_0x68a29b+'/'+_0x382b1b)[_0x9921('0x1c')](_0x1d8e02);}return null;};}function patchUpdates(_0x3cc016){return function(_0x5f0903){try{jsonpatch[_0x9921('0x23')](_0x5f0903,_0x3cc016,!![]);}catch(_0x19f837){return BPromise[_0x9921('0x24')](_0x19f837);}return _0x5f0903['save']();};}function saveUpdates(_0x512e2c,_0x5f3328){return function(_0x5cb87e){if(_0x5cb87e){return _0x5cb87e[_0x9921('0x25')](_0x512e2c)[_0x9921('0x26')](function(_0x3afdbd){return _0x3afdbd;});}return null;};}function removeEntity(_0x684568,_0x15d8bf){return function(_0x2e14c7){if(_0x2e14c7){return _0x2e14c7['destroy']()['then'](function(){var _0x457521=_0x2e14c7['get']({'plain':!![]});var _0x3a8f46=_0x9921('0x27');return db[_0x9921('0x28')][_0x9921('0x29')]({'where':{'type':_0x3a8f46,'resourceId':_0x457521['id']}})[_0x9921('0x26')](function(){return _0x2e14c7;});})[_0x9921('0x26')](function(){_0x684568[_0x9921('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaf4a05,_0x548006){return function(_0x335144){if(!_0x335144){_0xaf4a05[_0x9921('0x19')](0x194);}return _0x335144;};}function handleError(_0x52be6b,_0x4ddc52){_0x4ddc52=_0x4ddc52||0x1f4;return function(_0x42c094){logger['error'](_0x42c094[_0x9921('0x2a')]);if(_0x42c094[_0x9921('0x2b')]){delete _0x42c094[_0x9921('0x2b')];}_0x52be6b['status'](_0x4ddc52)[_0x9921('0x2c')](_0x42c094);};}exports[_0x9921('0x2d')]=function(_0x9bd4db,_0x2ca22b){var _0x316385={},_0x1d4c2f={},_0x3b19f2={'count':0x0,'rows':[]};var _0x446a43=_[_0x9921('0x2e')](db[_0x9921('0x2f')][_0x9921('0x30')],function(_0x3ec975){return{'name':_0x3ec975['fieldName'],'type':_0x3ec975[_0x9921('0x31')][_0x9921('0x32')]};});_0x1d4c2f[_0x9921('0x33')]=_[_0x9921('0x2e')](_0x446a43,_0x9921('0x2b'));_0x1d4c2f['query']=_['keys'](_0x9bd4db[_0x9921('0x34')]);_0x1d4c2f[_0x9921('0x35')]=_[_0x9921('0x36')](_0x1d4c2f[_0x9921('0x33')],_0x1d4c2f['query']);_0x316385[_0x9921('0x37')]=_[_0x9921('0x36')](_0x1d4c2f[_0x9921('0x33')],qs[_0x9921('0x38')](_0x9bd4db['query'][_0x9921('0x38')]));_0x316385['attributes']=_0x316385[_0x9921('0x37')][_0x9921('0x39')]?_0x316385[_0x9921('0x37')]:_0x1d4c2f[_0x9921('0x33')];if(!_0x9bd4db[_0x9921('0x34')]['hasOwnProperty'](_0x9921('0x3a'))){_0x316385[_0x9921('0x1f')]=qs[_0x9921('0x1f')](_0x9bd4db[_0x9921('0x34')][_0x9921('0x1f')]);_0x316385[_0x9921('0x1d')]=qs['offset'](_0x9bd4db['query'][_0x9921('0x1d')]);}_0x316385['order']=qs[_0x9921('0x3b')](_0x9bd4db[_0x9921('0x34')][_0x9921('0x3b')]);_0x316385[_0x9921('0x3c')]=qs[_0x9921('0x35')](_[_0x9921('0x3d')](_0x9bd4db[_0x9921('0x34')],_0x1d4c2f['filters']),_0x446a43);if(_0x9bd4db['query'][_0x9921('0x3e')]){_0x316385['where']=_[_0x9921('0x3f')](_0x316385[_0x9921('0x3c')],{'$or':_[_0x9921('0x2e')](_0x446a43,function(_0x105b03){if(_0x105b03[_0x9921('0x31')]!==_0x9921('0x40')){var _0x377d28={};_0x377d28[_0x105b03[_0x9921('0x2b')]]={'$like':'%'+_0x9bd4db[_0x9921('0x34')][_0x9921('0x3e')]+'%'};return _0x377d28;}})});}_0x316385=_['merge']({},_0x316385,_0x9bd4db[_0x9921('0x41')]);var _0x3573cb={'where':_0x316385[_0x9921('0x3c')]};return db[_0x9921('0x2f')][_0x9921('0x20')](_0x3573cb)[_0x9921('0x26')](function(_0x45be88){_0x3b19f2[_0x9921('0x20')]=_0x45be88;if(_0x9bd4db[_0x9921('0x34')]['includeAll']){_0x316385[_0x9921('0x42')]=[{'all':!![]}];}return db[_0x9921('0x2f')][_0x9921('0x43')](_0x316385);})[_0x9921('0x26')](function(_0x3d4566){_0x3b19f2[_0x9921('0x44')]=_0x3d4566;return _0x3b19f2;})['then'](respondWithFilteredResult(_0x2ca22b,_0x316385))[_0x9921('0x45')](handleError(_0x2ca22b,null));};exports[_0x9921('0x46')]=function(_0x477066,_0x5ea9f9){var _0x375f1f={'raw':!![],'where':{'id':_0x477066[_0x9921('0x47')]['id']}},_0x31be8b={};_0x31be8b[_0x9921('0x33')]=_[_0x9921('0x48')](db['Disposition'][_0x9921('0x30')]);_0x31be8b[_0x9921('0x34')]=_[_0x9921('0x48')](_0x477066[_0x9921('0x34')]);_0x31be8b[_0x9921('0x35')]=_[_0x9921('0x36')](_0x31be8b[_0x9921('0x33')],_0x31be8b[_0x9921('0x34')]);_0x375f1f[_0x9921('0x37')]=_['intersection'](_0x31be8b[_0x9921('0x33')],qs[_0x9921('0x38')](_0x477066['query'][_0x9921('0x38')]));_0x375f1f[_0x9921('0x37')]=_0x375f1f[_0x9921('0x37')][_0x9921('0x39')]?_0x375f1f[_0x9921('0x37')]:_0x31be8b[_0x9921('0x33')];if(_0x477066[_0x9921('0x34')][_0x9921('0x49')]){_0x375f1f[_0x9921('0x42')]=[{'all':!![]}];}_0x375f1f=_[_0x9921('0x3f')]({},_0x375f1f,_0x477066['options']);return db[_0x9921('0x2f')]['find'](_0x375f1f)[_0x9921('0x26')](handleEntityNotFound(_0x5ea9f9,null))['then'](respondWithResult(_0x5ea9f9,null))[_0x9921('0x45')](handleError(_0x5ea9f9,null));};exports[_0x9921('0x4a')]=function(_0x2ca959,_0x2251af){return db['Disposition'][_0x9921('0x4a')](_0x2ca959['body'],{})[_0x9921('0x26')](function(_0x3ec7e9){var _0x4b4371=_0x2ca959['user']['get']({'plain':!![]});if(!_0x4b4371)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b4371[_0x9921('0x4b')]===_0x9921('0x4c')){var _0x34ac06=_0x3ec7e9['get']({'plain':!![]});var _0x17e105=_0x9921('0x27');return db[_0x9921('0x4d')][_0x9921('0x4e')]({'where':{'name':_0x17e105,'userProfileId':_0x4b4371['userProfileId']},'raw':!![]})[_0x9921('0x26')](function(_0x4a8bbf){if(_0x4a8bbf&&_0x4a8bbf['autoAssociation']===0x0){return db[_0x9921('0x28')][_0x9921('0x4a')]({'name':_0x34ac06[_0x9921('0x2b')],'resourceId':_0x34ac06['id'],'type':_0x4a8bbf[_0x9921('0x2b')],'sectionId':_0x4a8bbf['id']},{})[_0x9921('0x26')](function(){return _0x3ec7e9;});}else{return _0x3ec7e9;}})[_0x9921('0x45')](function(_0x355dc6){logger['error'](_0x9921('0x4f'),_0x355dc6);throw _0x355dc6;});}return _0x3ec7e9;})['then'](respondWithResult(_0x2251af,0xc9))['catch'](handleError(_0x2251af,null));};exports[_0x9921('0x25')]=function(_0x136f07,_0x146964){if(_0x136f07[_0x9921('0x50')]['id']){delete _0x136f07[_0x9921('0x50')]['id'];}return db[_0x9921('0x2f')][_0x9921('0x4e')]({'where':{'id':_0x136f07[_0x9921('0x47')]['id']}})[_0x9921('0x26')](handleEntityNotFound(_0x146964,null))['then'](saveUpdates(_0x136f07[_0x9921('0x50')],null))['then'](respondWithResult(_0x146964,null))['catch'](handleError(_0x146964,null));};exports[_0x9921('0x29')]=function(_0x1b3ab6,_0x20b912){return db['Disposition'][_0x9921('0x4e')]({'where':{'id':_0x1b3ab6[_0x9921('0x47')]['id']}})[_0x9921('0x26')](handleEntityNotFound(_0x20b912,null))[_0x9921('0x26')](removeEntity(_0x20b912,null))[_0x9921('0x45')](handleError(_0x20b912,null));}; \ No newline at end of file +var _0x0c48=['../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x2dff50,_0x39b03f){var _0x4c4fe8=function(_0x5bf900){while(--_0x5bf900){_0x2dff50['push'](_0x2dff50['shift']());}};_0x4c4fe8(++_0x39b03f);}(_0x0c48,0xed));var _0x80c4=function(_0x20da91,_0x23089f){_0x20da91=_0x20da91-0x0;var _0xa777ed=_0x0c48[_0x20da91];return _0xa777ed;};'use strict';var emlformat=require(_0x80c4('0x0'));var rimraf=require(_0x80c4('0x1'));var zipdir=require(_0x80c4('0x2'));var jsonpatch=require(_0x80c4('0x3'));var rp=require(_0x80c4('0x4'));var moment=require(_0x80c4('0x5'));var BPromise=require(_0x80c4('0x6'));var Mustache=require(_0x80c4('0x7'));var util=require(_0x80c4('0x8'));var path=require(_0x80c4('0x9'));var sox=require(_0x80c4('0xa'));var csv=require(_0x80c4('0xb'));var ejs=require(_0x80c4('0xc'));var fs=require('fs');var fs_extra=require(_0x80c4('0xd'));var _=require(_0x80c4('0xe'));var squel=require(_0x80c4('0xf'));var crypto=require('crypto');var jsforce=require(_0x80c4('0x10'));var deskjs=require(_0x80c4('0x11'));var toCsv=require(_0x80c4('0xb'));var querystring=require(_0x80c4('0x12'));var Papa=require(_0x80c4('0x13'));var Redis=require(_0x80c4('0x14'));var authService=require(_0x80c4('0x15'));var qs=require(_0x80c4('0x16'));var as=require(_0x80c4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80c4('0x18'));var utils=require('../../config/utils');var config=require(_0x80c4('0x19'));var licenseUtil=require(_0x80c4('0x1a'));var db=require(_0x80c4('0x1b'))['db'];function respondWithStatusCode(_0x9384f7,_0x1e2b05){_0x1e2b05=_0x1e2b05||0xcc;return function(_0x5c6d7a){if(_0x5c6d7a){return _0x9384f7[_0x80c4('0x1c')](_0x1e2b05);}return _0x9384f7[_0x80c4('0x1d')](_0x1e2b05)[_0x80c4('0x1e')]();};}function respondWithResult(_0xa584c1,_0x5849b0){_0x5849b0=_0x5849b0||0xc8;return function(_0xa92a44){if(_0xa92a44){return _0xa584c1[_0x80c4('0x1d')](_0x5849b0)['json'](_0xa92a44);}};}function respondWithFilteredResult(_0x2ee1dc,_0x3b8768){return function(_0x59139b){if(_0x59139b){var _0x22549c=typeof _0x3b8768[_0x80c4('0x1f')]===_0x80c4('0x20')&&typeof _0x3b8768['limit']===_0x80c4('0x20');var _0x9d8302=_0x59139b[_0x80c4('0x21')];var _0x537f42=_0x22549c?0x0:_0x3b8768[_0x80c4('0x1f')];var _0x5b247a=_0x22549c?_0x59139b[_0x80c4('0x21')]:_0x3b8768[_0x80c4('0x1f')]+_0x3b8768[_0x80c4('0x22')];var _0x5aebc9;if(_0x5b247a>=_0x9d8302){_0x5b247a=_0x9d8302;_0x5aebc9=0xc8;}else{_0x5aebc9=0xce;}_0x2ee1dc['status'](_0x5aebc9);return _0x2ee1dc[_0x80c4('0x23')](_0x80c4('0x24'),_0x537f42+'-'+_0x5b247a+'/'+_0x9d8302)['json'](_0x59139b);}return null;};}function patchUpdates(_0x17e644){return function(_0x3e3a32){try{jsonpatch[_0x80c4('0x25')](_0x3e3a32,_0x17e644,!![]);}catch(_0x2b07a1){return BPromise[_0x80c4('0x26')](_0x2b07a1);}return _0x3e3a32[_0x80c4('0x27')]();};}function saveUpdates(_0x24de51,_0x33849a){return function(_0x540909){if(_0x540909){return _0x540909[_0x80c4('0x28')](_0x24de51)[_0x80c4('0x29')](function(_0x2798db){return _0x2798db;});}return null;};}function removeEntity(_0x349579,_0x2f9108){return function(_0x27f9a0){if(_0x27f9a0){return _0x27f9a0[_0x80c4('0x2a')]()['then'](function(){var _0x1e8bed=_0x27f9a0['get']({'plain':!![]});var _0x3c6b79=_0x80c4('0x2b');return db[_0x80c4('0x2c')][_0x80c4('0x2a')]({'where':{'type':_0x3c6b79,'resourceId':_0x1e8bed['id']}})[_0x80c4('0x29')](function(){return _0x27f9a0;});})[_0x80c4('0x29')](function(){_0x349579[_0x80c4('0x1d')](0xcc)[_0x80c4('0x1e')]();});}};}function handleEntityNotFound(_0x4cb408,_0x76b610){return function(_0x4bc391){if(!_0x4bc391){_0x4cb408[_0x80c4('0x1c')](0x194);}return _0x4bc391;};}function handleError(_0x23a08c,_0x27b9f9){_0x27b9f9=_0x27b9f9||0x1f4;return function(_0x23fe5f){logger[_0x80c4('0x2d')](_0x23fe5f[_0x80c4('0x2e')]);if(_0x23fe5f[_0x80c4('0x2f')]){delete _0x23fe5f['name'];}_0x23a08c['status'](_0x27b9f9)[_0x80c4('0x30')](_0x23fe5f);};}exports['index']=function(_0x9043ae,_0x8e7c48){var _0x8f9f2c={},_0x45f20f={},_0x41f279={'count':0x0,'rows':[]};var _0x44d862=_['map'](db[_0x80c4('0x31')][_0x80c4('0x32')],function(_0x4bcb1a){return{'name':_0x4bcb1a[_0x80c4('0x33')],'type':_0x4bcb1a[_0x80c4('0x34')][_0x80c4('0x35')]};});_0x45f20f[_0x80c4('0x36')]=_[_0x80c4('0x37')](_0x44d862,_0x80c4('0x2f'));_0x45f20f[_0x80c4('0x38')]=_[_0x80c4('0x39')](_0x9043ae[_0x80c4('0x38')]);_0x45f20f[_0x80c4('0x3a')]=_['intersection'](_0x45f20f[_0x80c4('0x36')],_0x45f20f['query']);_0x8f9f2c[_0x80c4('0x3b')]=_[_0x80c4('0x3c')](_0x45f20f[_0x80c4('0x36')],qs['fields'](_0x9043ae['query'][_0x80c4('0x3d')]));_0x8f9f2c['attributes']=_0x8f9f2c[_0x80c4('0x3b')]['length']?_0x8f9f2c[_0x80c4('0x3b')]:_0x45f20f[_0x80c4('0x36')];if(!_0x9043ae[_0x80c4('0x38')][_0x80c4('0x3e')](_0x80c4('0x3f'))){_0x8f9f2c[_0x80c4('0x22')]=qs[_0x80c4('0x22')](_0x9043ae[_0x80c4('0x38')]['limit']);_0x8f9f2c[_0x80c4('0x1f')]=qs[_0x80c4('0x1f')](_0x9043ae[_0x80c4('0x38')][_0x80c4('0x1f')]);}_0x8f9f2c[_0x80c4('0x40')]=qs[_0x80c4('0x41')](_0x9043ae[_0x80c4('0x38')][_0x80c4('0x41')]);_0x8f9f2c[_0x80c4('0x42')]=qs[_0x80c4('0x3a')](_[_0x80c4('0x43')](_0x9043ae[_0x80c4('0x38')],_0x45f20f[_0x80c4('0x3a')]),_0x44d862);if(_0x9043ae['query'][_0x80c4('0x44')]){_0x8f9f2c[_0x80c4('0x42')]=_[_0x80c4('0x45')](_0x8f9f2c[_0x80c4('0x42')],{'$or':_[_0x80c4('0x37')](_0x44d862,function(_0x382b60){if(_0x382b60['type']!=='VIRTUAL'){var _0x142736={};_0x142736[_0x382b60['name']]={'$like':'%'+_0x9043ae['query'][_0x80c4('0x44')]+'%'};return _0x142736;}})});}_0x8f9f2c=_[_0x80c4('0x45')]({},_0x8f9f2c,_0x9043ae[_0x80c4('0x46')]);var _0x187982={'where':_0x8f9f2c[_0x80c4('0x42')]};return db[_0x80c4('0x31')][_0x80c4('0x21')](_0x187982)[_0x80c4('0x29')](function(_0x3697eb){_0x41f279[_0x80c4('0x21')]=_0x3697eb;if(_0x9043ae[_0x80c4('0x38')]['includeAll']){_0x8f9f2c[_0x80c4('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x80c4('0x48')](_0x8f9f2c);})[_0x80c4('0x29')](function(_0x472884){_0x41f279[_0x80c4('0x49')]=_0x472884;return _0x41f279;})[_0x80c4('0x29')](respondWithFilteredResult(_0x8e7c48,_0x8f9f2c))[_0x80c4('0x4a')](handleError(_0x8e7c48,null));};exports[_0x80c4('0x4b')]=function(_0x18268a,_0x502553){var _0x27282d={'raw':!![],'where':{'id':_0x18268a['params']['id']}},_0x4950ee={};_0x4950ee[_0x80c4('0x36')]=_['keys'](db['Disposition'][_0x80c4('0x32')]);_0x4950ee[_0x80c4('0x38')]=_['keys'](_0x18268a[_0x80c4('0x38')]);_0x4950ee[_0x80c4('0x3a')]=_[_0x80c4('0x3c')](_0x4950ee['model'],_0x4950ee[_0x80c4('0x38')]);_0x27282d['attributes']=_[_0x80c4('0x3c')](_0x4950ee[_0x80c4('0x36')],qs['fields'](_0x18268a['query'][_0x80c4('0x3d')]));_0x27282d['attributes']=_0x27282d[_0x80c4('0x3b')]['length']?_0x27282d['attributes']:_0x4950ee['model'];if(_0x18268a['query'][_0x80c4('0x4c')]){_0x27282d['include']=[{'all':!![]}];}_0x27282d=_['merge']({},_0x27282d,_0x18268a[_0x80c4('0x46')]);return db[_0x80c4('0x31')]['find'](_0x27282d)['then'](handleEntityNotFound(_0x502553,null))[_0x80c4('0x29')](respondWithResult(_0x502553,null))[_0x80c4('0x4a')](handleError(_0x502553,null));};exports[_0x80c4('0x4d')]=function(_0x4bb619,_0x590580){return db[_0x80c4('0x31')][_0x80c4('0x4d')](_0x4bb619[_0x80c4('0x4e')],{})[_0x80c4('0x29')](function(_0x37bf30){var _0x2962c0=_0x4bb619[_0x80c4('0x4f')][_0x80c4('0x50')]({'plain':!![]});if(!_0x2962c0)throw new Error(_0x80c4('0x51'));if(_0x2962c0[_0x80c4('0x52')]===_0x80c4('0x4f')){var _0x2dff26=_0x37bf30[_0x80c4('0x50')]({'plain':!![]});var _0x4bc930=_0x80c4('0x2b');return db[_0x80c4('0x53')][_0x80c4('0x54')]({'where':{'name':_0x4bc930,'userProfileId':_0x2962c0[_0x80c4('0x55')]},'raw':!![]})[_0x80c4('0x29')](function(_0x165596){if(_0x165596&&_0x165596[_0x80c4('0x56')]===0x0){return db[_0x80c4('0x2c')][_0x80c4('0x4d')]({'name':_0x2dff26[_0x80c4('0x2f')],'resourceId':_0x2dff26['id'],'type':_0x165596[_0x80c4('0x2f')],'sectionId':_0x165596['id']},{})['then'](function(){return _0x37bf30;});}else{return _0x37bf30;}})['catch'](function(_0x3aaff4){logger[_0x80c4('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aaff4);throw _0x3aaff4;});}return _0x37bf30;})['then'](respondWithResult(_0x590580,0xc9))[_0x80c4('0x4a')](handleError(_0x590580,null));};exports[_0x80c4('0x28')]=function(_0x646feb,_0x2ccb59){if(_0x646feb[_0x80c4('0x4e')]['id']){delete _0x646feb[_0x80c4('0x4e')]['id'];}return db['Disposition'][_0x80c4('0x54')]({'where':{'id':_0x646feb['params']['id']}})[_0x80c4('0x29')](handleEntityNotFound(_0x2ccb59,null))[_0x80c4('0x29')](saveUpdates(_0x646feb['body'],null))[_0x80c4('0x29')](respondWithResult(_0x2ccb59,null))[_0x80c4('0x4a')](handleError(_0x2ccb59,null));};exports[_0x80c4('0x2a')]=function(_0x2ecc3d,_0x18366f){return db['Disposition'][_0x80c4('0x54')]({'where':{'id':_0x2ecc3d[_0x80c4('0x57')]['id']}})[_0x80c4('0x29')](handleEntityNotFound(_0x18366f,null))[_0x80c4('0x29')](removeEntity(_0x18366f,null))[_0x80c4('0x4a')](handleError(_0x18366f,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a97793a..e6d3378 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 _0x7cf6=['tools_dispositions','name_voice','name','ListId','name_chat','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x2c02da,_0x1c3eab){var _0x1842fd=function(_0x29d2f5){while(--_0x29d2f5){_0x2c02da['push'](_0x2c02da['shift']());}};_0x1842fd(++_0x1c3eab);}(_0x7cf6,0x143));var _0x67cf=function(_0x319a5a,_0x2e8567){_0x319a5a=_0x319a5a-0x0;var _0x400fdf=_0x7cf6[_0x319a5a];return _0x400fdf;};'use strict';var _=require('lodash');var util=require(_0x67cf('0x0'));var logger=require(_0x67cf('0x1'))(_0x67cf('0x2'));var moment=require(_0x67cf('0x3'));var BPromise=require(_0x67cf('0x4'));var rp=require(_0x67cf('0x5'));var fs=require('fs');var path=require(_0x67cf('0x6'));var rimraf=require(_0x67cf('0x7'));var config=require(_0x67cf('0x8'));var attributes=require(_0x67cf('0x9'));module[_0x67cf('0xa')]=function(_0x2ccf42,_0xfa507){return _0x2ccf42[_0x67cf('0xb')](_0x67cf('0xc'),attributes,{'tableName':_0x67cf('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x67cf('0xe'),'fields':[_0x67cf('0xf'),_0x67cf('0x10')]},{'unique':!![],'name':_0x67cf('0x11'),'fields':[_0x67cf('0xf'),'ChatWebsiteId']},{'unique':!![],'name':_0x67cf('0x12'),'fields':[_0x67cf('0xf'),_0x67cf('0x13')]},{'unique':!![],'name':'name_sms','fields':[_0x67cf('0xf'),_0x67cf('0x14')]},{'unique':!![],'name':_0x67cf('0x15'),'fields':[_0x67cf('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x67cf('0x16'),'fields':[_0x67cf('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x67cf('0xf'),_0x67cf('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0095=['exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_whatsapp','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes'];(function(_0x18063f,_0x3efbaf){var _0x116771=function(_0x366444){while(--_0x366444){_0x18063f['push'](_0x18063f['shift']());}};_0x116771(++_0x3efbaf);}(_0x0095,0x157));var _0x5009=function(_0x53c69a,_0x29c68f){_0x53c69a=_0x53c69a-0x0;var _0x467595=_0x0095[_0x53c69a];return _0x467595;};'use strict';var _=require('lodash');var util=require(_0x5009('0x0'));var logger=require('../../config/logger')(_0x5009('0x1'));var moment=require(_0x5009('0x2'));var BPromise=require(_0x5009('0x3'));var rp=require(_0x5009('0x4'));var fs=require('fs');var path=require(_0x5009('0x5'));var rimraf=require(_0x5009('0x6'));var config=require(_0x5009('0x7'));var attributes=require(_0x5009('0x8'));module[_0x5009('0x9')]=function(_0x7f2a8d,_0xb0ec0d){return _0x7f2a8d[_0x5009('0xa')](_0x5009('0xb'),attributes,{'tableName':_0x5009('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x5009('0xd'),'fields':[_0x5009('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x5009('0xe'),_0x5009('0xf')]},{'unique':!![],'name':_0x5009('0x10'),'fields':['name',_0x5009('0x11')]},{'unique':!![],'name':_0x5009('0x12'),'fields':[_0x5009('0xe'),_0x5009('0x13')]},{'unique':!![],'name':'name_fax','fields':['name',_0x5009('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x5009('0x15'),'fields':[_0x5009('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a457e4e..23958f7 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(_0x1fec62,_0x2404c3){var _0x3f3a45=function(_0x4a8be0){while(--_0x4a8be0){_0x1fec62['push'](_0x1fec62['shift']());}};_0x3f3a45(++_0x2404c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x122575,_0x57af2c){var _0x5de760=function(_0x5cefe4){while(--_0x5cefe4){_0x122575['push'](_0x122575['shift']());}};_0x5de760(++_0x57af2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var 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 d785ac3..a3ddfcd 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 _0x54c6=['isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x48fab2,_0x5af12e){var _0x5c5e98=function(_0x52007d){while(--_0x52007d){_0x48fab2['push'](_0x48fab2['shift']());}};_0x5c5e98(++_0x5af12e);}(_0x54c6,0x195));var _0x654c=function(_0x3bead0,_0x2b7123){_0x3bead0=_0x3bead0-0x0;var _0x129c66=_0x54c6[_0x3bead0];return _0x129c66;};'use strict';var multer=require(_0x654c('0x0'));var util=require(_0x654c('0x1'));var path=require(_0x654c('0x2'));var timeout=require('connect-timeout');var express=require(_0x654c('0x3'));var router=express[_0x654c('0x4')]();var fs_extra=require(_0x654c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x654c('0x6'));var config=require(_0x654c('0x7'));var controller=require('./disposition.controller');router[_0x654c('0x8')]('/',auth[_0x654c('0x9')](),controller[_0x654c('0xa')]);router[_0x654c('0x8')](_0x654c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x654c('0xc')]('/',auth[_0x654c('0x9')](),controller[_0x654c('0xd')]);router[_0x654c('0xe')](_0x654c('0xb'),auth[_0x654c('0x9')](),controller[_0x654c('0xf')]);router[_0x654c('0x10')](_0x654c('0xb'),auth[_0x654c('0x9')](),controller['destroy']);module[_0x654c('0x11')]=router; \ No newline at end of file +var _0x471a=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','get'];(function(_0x49d19d,_0x245cf5){var _0x4ebef1=function(_0xf0a4e6){while(--_0xf0a4e6){_0x49d19d['push'](_0x49d19d['shift']());}};_0x4ebef1(++_0x245cf5);}(_0x471a,0x18d));var _0xa471=function(_0x3f384e,_0x23f615){_0x3f384e=_0x3f384e-0x0;var _0x3fca88=_0x471a[_0x3f384e];return _0x3fca88;};'use strict';var multer=require(_0xa471('0x0'));var util=require(_0xa471('0x1'));var path=require(_0xa471('0x2'));var timeout=require('connect-timeout');var express=require(_0xa471('0x3'));var router=express[_0xa471('0x4')]();var fs_extra=require(_0xa471('0x5'));var auth=require(_0xa471('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xa471('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa471('0x8'),auth[_0xa471('0x9')](),controller[_0xa471('0xa')]);router['post']('/',auth[_0xa471('0x9')](),controller['create']);router['put'](_0xa471('0x8'),auth[_0xa471('0x9')](),controller[_0xa471('0xb')]);router[_0xa471('0xc')]('/:id',auth[_0xa471('0x9')](),controller[_0xa471('0xd')]);module[_0xa471('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d2e220f..079a463 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 _0x2a0f=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','9600','14400','4800','2400','12000','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x2d0bd7,_0x4557f8){var _0x262ffa=function(_0x2f8b0a){while(--_0x2f8b0a){_0x2d0bd7['push'](_0x2d0bd7['shift']());}};_0x262ffa(++_0x4557f8);}(_0x2a0f,0xcd));var _0xf2a0=function(_0x1e52c0,_0x2e95fc){_0x1e52c0=_0x1e52c0-0x0;var _0x3088bd=_0x2a0f[_0x1e52c0];return _0x3088bd;};'use strict';var Sequelize=require(_0xf2a0('0x0'));module[_0xf2a0('0x1')]={'name':{'type':Sequelize[_0xf2a0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf2a0('0x2')]},'ecm':{'type':Sequelize[_0xf2a0('0x3')](_0xf2a0('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xf2a0('0x2')],'defaultValue':_0xf2a0('0x5')},'localstationid':{'type':Sequelize[_0xf2a0('0x2')],'unique':_0xf2a0('0x6')},'minrate':{'type':Sequelize[_0xf2a0('0x3')]('2400','4800',_0xf2a0('0x7'),_0xf2a0('0x8'),'12000',_0xf2a0('0x9')),'defaultValue':_0xf2a0('0xa')},'maxrate':{'type':Sequelize[_0xf2a0('0x3')](_0xf2a0('0xb'),_0xf2a0('0xa'),_0xf2a0('0x7'),_0xf2a0('0x8'),_0xf2a0('0xc'),'14400'),'defaultValue':_0xf2a0('0x9')},'modem':{'type':Sequelize[_0xf2a0('0x2')],'defaultValue':_0xf2a0('0xd')},'gateway':{'type':Sequelize[_0xf2a0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf2a0('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xf2a0('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf2a0('0x3')](_0xf2a0('0xf'),_0xf2a0('0x10'),'DADHI',_0xf2a0('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xf2a0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf2a0('0x12')],'defaultValue':function(){return _0xf2a0('0x13');}},'notificationSound':{'type':Sequelize[_0xf2a0('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf2a0('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf2a0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf2a0('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf2a0('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf2a0('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf2a0('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xf2a0('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x29dea2){if(!_0x29dea2)this[_0xf2a0('0x16')](_0xf2a0('0x17'),null);this[_0xf2a0('0x16')](_0xf2a0('0x18'),_0x29dea2);}}}; \ No newline at end of file +var _0x4836=['ENUM','yes','localstationid','2400','7200','12000','14400','4800','9600','v17,v27,v29','INTEGER','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x1c2aeb,_0x48433c){var _0x783379=function(_0x3e8820){while(--_0x3e8820){_0x1c2aeb['push'](_0x1c2aeb['shift']());}};_0x783379(++_0x48433c);}(_0x4836,0x1e0));var _0x6483=function(_0x33da75,_0x288301){_0x33da75=_0x33da75-0x0;var _0x178762=_0x4836[_0x33da75];return _0x178762;};'use strict';var Sequelize=require(_0x6483('0x0'));module[_0x6483('0x1')]={'name':{'type':Sequelize[_0x6483('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6483('0x2')]},'ecm':{'type':Sequelize[_0x6483('0x3')](_0x6483('0x4'),'no'),'defaultValue':_0x6483('0x4')},'headerinfo':{'type':Sequelize[_0x6483('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x6483('0x2')],'unique':_0x6483('0x5')},'minrate':{'type':Sequelize['ENUM'](_0x6483('0x6'),'4800',_0x6483('0x7'),'9600',_0x6483('0x8'),_0x6483('0x9')),'defaultValue':_0x6483('0xa')},'maxrate':{'type':Sequelize['ENUM'](_0x6483('0x6'),_0x6483('0xa'),_0x6483('0x7'),_0x6483('0xb'),_0x6483('0x8'),_0x6483('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x6483('0x2')],'defaultValue':_0x6483('0xc')},'gateway':{'type':Sequelize[_0x6483('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6483('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6483('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6483('0x3')]('SIP',_0x6483('0xe'),'DADHI',_0x6483('0xf')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6483('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6483('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6483('0xd')],'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[_0x6483('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6483('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x6483('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6483('0x12'),'set':function(_0x15697c){if(!_0x15697c)this[_0x6483('0x13')]('mandatoryDispositionPauseId',null);this[_0x6483('0x13')](_0x6483('0x14'),_0x15697c);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 4dc9b4d..80bd866 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 _0x790c=['out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','http','client','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','offset','undefined','limit','count','status','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','options','include','rows','catch','params','Pause','find','create','body','user','role','UserProfileSection','userProfileId','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','includeAll','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','getApplications','context','localstationid','system','description','push','Answer','CDR(type)=inbound-fax','Set','gateway','minrate','t38timeout','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','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','CmList','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed'];(function(_0x185a5a,_0x19442b){var _0x39bd2d=function(_0xfe0213){while(--_0xfe0213){_0x185a5a['push'](_0x185a5a['shift']());}};_0x39bd2d(++_0x19442b);}(_0x790c,0x17c));var _0xc790=function(_0x1d8350,_0x66653d){_0x1d8350=_0x1d8350-0x0;var _0x4e4dfd=_0x790c[_0x1d8350];return _0x4e4dfd;};'use strict';var emlformat=require(_0xc790('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc790('0x1'));var moment=require(_0xc790('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc790('0x3'));var util=require(_0xc790('0x4'));var path=require(_0xc790('0x5'));var sox=require(_0xc790('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc790('0x7'));var squel=require(_0xc790('0x8'));var crypto=require(_0xc790('0x9'));var jsforce=require(_0xc790('0xa'));var deskjs=require(_0xc790('0xb'));var toCsv=require(_0xc790('0xc'));var querystring=require(_0xc790('0xd'));var Papa=require('papaparse');var Redis=require(_0xc790('0xe'));var authService=require(_0xc790('0xf'));var qs=require(_0xc790('0x10'));var as=require(_0xc790('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc790('0x12'));var utils=require(_0xc790('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc790('0x14'));var db=require(_0xc790('0x15'))['db'];config[_0xc790('0x16')]=_['defaults'](config['redis'],{'host':_0xc790('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc790('0x18'))[_0xc790('0x19')](socket);var jayson=require(_0xc790('0x1a'));var client=jayson['client'][_0xc790('0x1b')]({'port':0x232c});var client9002=jayson[_0xc790('0x1c')][_0xc790('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x20ea7f,_0x4c7a5c,_0x4019d8,_0x140d74){return new BPromise(function(_0x55ba5f,_0x1c97fe){var _0x3d4a03=_0x140d74||client;return _0x3d4a03['request'](_0x20ea7f,_0x4019d8)[_0xc790('0x1d')](function(_0xa266aa){logger[_0xc790('0x1e')](_0xc790('0x1f'),_0x4c7a5c,_0xc790('0x20'));logger['debug'](_0xc790('0x21'),_0x4c7a5c,_0xc790('0x20'),JSON[_0xc790('0x22')](_0xa266aa));if(_0xa266aa[_0xc790('0x23')]){if(_0xa266aa[_0xc790('0x23')][_0xc790('0x24')]===0x1f4){logger[_0xc790('0x23')](_0xc790('0x1f'),_0x4c7a5c,_0xa266aa['error'][_0xc790('0x25')]);return _0x1c97fe(_0xa266aa[_0xc790('0x23')][_0xc790('0x25')]);}logger[_0xc790('0x23')](_0xc790('0x1f'),_0x4c7a5c,_0xa266aa[_0xc790('0x23')][_0xc790('0x25')]);return _0x55ba5f(_0xa266aa[_0xc790('0x23')][_0xc790('0x25')]);}else{logger[_0xc790('0x1e')](_0xc790('0x1f'),_0x4c7a5c,_0xc790('0x20'));_0x55ba5f(_0xa266aa[_0xc790('0x26')]['message']);}})['catch'](function(_0x31a564){logger[_0xc790('0x23')](_0xc790('0x1f'),_0x4c7a5c,_0x31a564);_0x1c97fe(_0x31a564);});});}function respondWithStatusCode(_0x2b6658,_0x5c5bcc){_0x5c5bcc=_0x5c5bcc||0xcc;return function(_0x46fbe7){if(_0x46fbe7){return _0x2b6658[_0xc790('0x27')](_0x5c5bcc);}return _0x2b6658['status'](_0x5c5bcc)[_0xc790('0x28')]();};}function respondWithResult(_0xf3e243,_0xfc2d9d){_0xfc2d9d=_0xfc2d9d||0xc8;return function(_0x9d878f){if(_0x9d878f){return _0xf3e243['status'](_0xfc2d9d)[_0xc790('0x29')](_0x9d878f);}};}function respondWithFilteredResult(_0x3ee0b9,_0x1f40e3){return function(_0x17f731){if(_0x17f731){var _0x6f5234=typeof _0x1f40e3[_0xc790('0x2a')]===_0xc790('0x2b')&&typeof _0x1f40e3[_0xc790('0x2c')]==='undefined';var _0xbc6dfd=_0x17f731[_0xc790('0x2d')];var _0x154f9a=_0x6f5234?0x0:_0x1f40e3[_0xc790('0x2a')];var _0x1b6fec=_0x6f5234?_0x17f731[_0xc790('0x2d')]:_0x1f40e3['offset']+_0x1f40e3[_0xc790('0x2c')];var _0x3e1625;if(_0x1b6fec>=_0xbc6dfd){_0x1b6fec=_0xbc6dfd;_0x3e1625=0xc8;}else{_0x3e1625=0xce;}_0x3ee0b9[_0xc790('0x2e')](_0x3e1625);return _0x3ee0b9['set']('Content-Range',_0x154f9a+'-'+_0x1b6fec+'/'+_0xbc6dfd)['json'](_0x17f731);}return null;};}function patchUpdates(_0x12861e){return function(_0x414608){try{jsonpatch['apply'](_0x414608,_0x12861e,!![]);}catch(_0x52bca8){return BPromise[_0xc790('0x2f')](_0x52bca8);}return _0x414608[_0xc790('0x30')]();};}function saveUpdates(_0x9ccc69,_0xf053f2){return function(_0xea6569){if(_0xea6569){return _0xea6569[_0xc790('0x31')](_0x9ccc69)['then'](function(_0x59f831){return _0x59f831;});}return null;};}function removeEntity(_0x48b07e,_0x3e5aa1){return function(_0x10b96c){if(_0x10b96c){return _0x10b96c[_0xc790('0x32')]()[_0xc790('0x1d')](function(){var _0x179745=_0x10b96c[_0xc790('0x33')]({'plain':!![]});var _0x264df8=_0xc790('0x34');return db[_0xc790('0x35')]['destroy']({'where':{'type':_0x264df8,'resourceId':_0x179745['id']}})[_0xc790('0x1d')](function(){return _0x10b96c;});})[_0xc790('0x1d')](function(){_0x48b07e['status'](0xcc)[_0xc790('0x28')]();});}};}function handleEntityNotFound(_0x57a2f4,_0x24e34c){return function(_0x25b673){if(!_0x25b673){_0x57a2f4[_0xc790('0x27')](0x194);}return _0x25b673;};}function handleError(_0xfb8b85,_0x4374ab){_0x4374ab=_0x4374ab||0x1f4;return function(_0x5dc5d2){logger[_0xc790('0x23')](_0x5dc5d2[_0xc790('0x36')]);if(_0x5dc5d2[_0xc790('0x37')]){delete _0x5dc5d2[_0xc790('0x37')];}_0xfb8b85['status'](_0x4374ab)[_0xc790('0x38')](_0x5dc5d2);};}exports[_0xc790('0x39')]=function(_0x3b4acf,_0x3caa55){var _0x3278fd={'include':[{'model':db['Pause'],'as':_0xc790('0x3a')}]},_0x34a46e={},_0x2026b2={'count':0x0,'rows':[]};var _0x41eadd=_[_0xc790('0x3b')](db[_0xc790('0x3c')][_0xc790('0x3d')],function(_0x1a0edb){return{'name':_0x1a0edb[_0xc790('0x3e')],'type':_0x1a0edb[_0xc790('0x3f')][_0xc790('0x40')]};});_0x34a46e[_0xc790('0x41')]=_['map'](_0x41eadd,_0xc790('0x37'));_0x34a46e[_0xc790('0x42')]=_[_0xc790('0x43')](_0x3b4acf[_0xc790('0x42')]);_0x34a46e[_0xc790('0x44')]=_['intersection'](_0x34a46e[_0xc790('0x41')],_0x34a46e['query']);_0x3278fd[_0xc790('0x45')]=_[_0xc790('0x46')](_0x34a46e[_0xc790('0x41')],qs[_0xc790('0x47')](_0x3b4acf[_0xc790('0x42')][_0xc790('0x47')]));_0x3278fd['attributes']=_0x3278fd['attributes'][_0xc790('0x48')]?_0x3278fd['attributes']:_0x34a46e[_0xc790('0x41')];if(!_0x3b4acf[_0xc790('0x42')]['hasOwnProperty']('nolimit')){_0x3278fd[_0xc790('0x2c')]=qs[_0xc790('0x2c')](_0x3b4acf[_0xc790('0x42')]['limit']);_0x3278fd['offset']=qs[_0xc790('0x2a')](_0x3b4acf[_0xc790('0x42')][_0xc790('0x2a')]);}_0x3278fd[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x3b4acf[_0xc790('0x42')][_0xc790('0x4a')]);_0x3278fd['where']=qs['filters'](_[_0xc790('0x4b')](_0x3b4acf[_0xc790('0x42')],_0x34a46e[_0xc790('0x44')]),_0x41eadd);if(_0x3b4acf['query'][_0xc790('0x4c')]){_0x3278fd[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x3278fd['where'],{'$or':_['map'](_0x41eadd,function(_0x3a57aa){if(_0x3a57aa[_0xc790('0x3f')]!=='VIRTUAL'){var _0x1ea147={};_0x1ea147[_0x3a57aa[_0xc790('0x37')]]={'$like':'%'+_0x3b4acf[_0xc790('0x42')][_0xc790('0x4c')]+'%'};return _0x1ea147;}})});}_0x3278fd=_[_0xc790('0x4e')]({},_0x3278fd,_0x3b4acf[_0xc790('0x4f')]);var _0x3b412a={'where':_0x3278fd[_0xc790('0x4d')]};return db[_0xc790('0x3c')][_0xc790('0x2d')](_0x3b412a)['then'](function(_0x45299e){_0x2026b2[_0xc790('0x2d')]=_0x45299e;if(_0x3b4acf[_0xc790('0x42')]['includeAll']){_0x3278fd[_0xc790('0x50')]=[{'all':!![]}];}return db[_0xc790('0x3c')]['findAll'](_0x3278fd);})[_0xc790('0x1d')](function(_0x54b7ec){_0x2026b2[_0xc790('0x51')]=_0x54b7ec;return _0x2026b2;})['then'](respondWithFilteredResult(_0x3caa55,_0x3278fd))[_0xc790('0x52')](handleError(_0x3caa55,null));};exports['show']=function(_0x117540,_0x1c8221){var _0x5bb576={'raw':![],'where':{'id':_0x117540[_0xc790('0x53')]['id']},'include':[{'model':db[_0xc790('0x54')],'as':_0xc790('0x3a')}]},_0x4118e6={};_0x4118e6['model']=_[_0xc790('0x43')](db[_0xc790('0x3c')][_0xc790('0x3d')]);_0x4118e6[_0xc790('0x42')]=_['keys'](_0x117540[_0xc790('0x42')]);_0x4118e6[_0xc790('0x44')]=_[_0xc790('0x46')](_0x4118e6[_0xc790('0x41')],_0x4118e6['query']);_0x5bb576[_0xc790('0x45')]=_[_0xc790('0x46')](_0x4118e6[_0xc790('0x41')],qs[_0xc790('0x47')](_0x117540['query'][_0xc790('0x47')]));_0x5bb576[_0xc790('0x45')]=_0x5bb576[_0xc790('0x45')]['length']?_0x5bb576['attributes']:_0x4118e6['model'];if(_0x117540[_0xc790('0x42')]['includeAll']){_0x5bb576['include']=[{'all':!![]}];}_0x5bb576=_[_0xc790('0x4e')]({},_0x5bb576,_0x117540[_0xc790('0x4f')]);return db[_0xc790('0x3c')][_0xc790('0x55')](_0x5bb576)[_0xc790('0x1d')](handleEntityNotFound(_0x1c8221,null))[_0xc790('0x1d')](respondWithResult(_0x1c8221,null))[_0xc790('0x52')](handleError(_0x1c8221,null));};exports['create']=function(_0xd97cad,_0x9460d4){return db[_0xc790('0x3c')][_0xc790('0x56')](_0xd97cad[_0xc790('0x57')],{})[_0xc790('0x1d')](function(_0x13bdee){var _0x3ab29a=_0xd97cad[_0xc790('0x58')]['get']({'plain':!![]});if(!_0x3ab29a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ab29a[_0xc790('0x59')]==='user'){var _0x2a4248=_0x13bdee[_0xc790('0x33')]({'plain':!![]});var _0x4c19e0='FaxAccounts';return db[_0xc790('0x5a')]['find']({'where':{'name':_0x4c19e0,'userProfileId':_0x3ab29a[_0xc790('0x5b')]},'raw':!![]})[_0xc790('0x1d')](function(_0xc611e0){if(_0xc611e0&&_0xc611e0['autoAssociation']===0x0){return db[_0xc790('0x35')][_0xc790('0x56')]({'name':_0x2a4248[_0xc790('0x37')],'resourceId':_0x2a4248['id'],'type':_0xc611e0[_0xc790('0x37')],'sectionId':_0xc611e0['id']},{})[_0xc790('0x1d')](function(){return _0x13bdee;});}else{return _0x13bdee;}})[_0xc790('0x52')](function(_0x1f0fe9){logger[_0xc790('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f0fe9);throw _0x1f0fe9;});}return _0x13bdee;})['then'](respondWithResult(_0x9460d4,0xc9))['catch'](handleError(_0x9460d4,null));};exports[_0xc790('0x31')]=function(_0xb91442,_0x1a5c99){if(_0xb91442[_0xc790('0x57')]['id']){delete _0xb91442[_0xc790('0x57')]['id'];}return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0xb91442[_0xc790('0x53')]['id']},'include':[{'model':db[_0xc790('0x54')],'as':_0xc790('0x3a')}]})[_0xc790('0x1d')](handleEntityNotFound(_0x1a5c99,null))[_0xc790('0x1d')](saveUpdates(_0xb91442[_0xc790('0x57')],null))[_0xc790('0x1d')](respondWithResult(_0x1a5c99,null))[_0xc790('0x52')](handleError(_0x1a5c99,null));};exports[_0xc790('0x32')]=function(_0x11a331,_0x5ca2e0){return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0x11a331[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x5ca2e0,null))[_0xc790('0x1d')](removeEntity(_0x5ca2e0,null))[_0xc790('0x52')](handleError(_0x5ca2e0,null));};exports[_0xc790('0x5c')]=function(_0x1d9345,_0x436332){return db[_0xc790('0x3c')]['describe']()[_0xc790('0x1d')](respondWithResult(_0x436332,null))[_0xc790('0x52')](handleError(_0x436332,null));};exports[_0xc790('0x5d')]=function(_0x350436,_0x3bb08b,_0x3808b6){if(_0x350436['body']['id']){delete _0x350436[_0xc790('0x57')]['id'];}return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0x350436['params']['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x3bb08b,null))[_0xc790('0x1d')](function(_0x41ee64){if(_0x41ee64){_0x350436[_0xc790('0x57')][_0xc790('0x5e')]=_0x41ee64['id'];return db[_0xc790('0x5f')][_0xc790('0x56')](_0x350436[_0xc790('0x57')]);}})[_0xc790('0x1d')](respondWithResult(_0x3bb08b,null))[_0xc790('0x52')](handleError(_0x3bb08b,null));};exports[_0xc790('0x60')]=function(_0x3fe8fb,_0x8c5d00,_0x565dbe){var _0x3bd4dd={'raw':![],'where':{}};var _0x5eafd6={};var _0x26b47e={'count':0x0,'rows':[]};return db[_0xc790('0x3c')][_0xc790('0x61')]({'where':{'id':_0x3fe8fb[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x8c5d00,null))[_0xc790('0x1d')](function(_0xa604c8){if(_0xa604c8){_0x5eafd6['model']=_[_0xc790('0x43')](db['Disposition'][_0xc790('0x3d')]);_0x5eafd6['query']=_[_0xc790('0x43')](_0x3fe8fb[_0xc790('0x42')]);_0x5eafd6[_0xc790('0x44')]=_[_0xc790('0x46')](_0x5eafd6['model'],_0x5eafd6['query']);_0x3bd4dd[_0xc790('0x45')]=_[_0xc790('0x46')](_0x5eafd6[_0xc790('0x41')],qs[_0xc790('0x47')](_0x3fe8fb[_0xc790('0x42')][_0xc790('0x47')]));_0x3bd4dd[_0xc790('0x45')]=_0x3bd4dd['attributes'][_0xc790('0x48')]?_0x3bd4dd['attributes']:_0x5eafd6[_0xc790('0x41')];if(!_0x3fe8fb['query'][_0xc790('0x62')](_0xc790('0x63'))){_0x3bd4dd['limit']=qs[_0xc790('0x2c')](_0x3fe8fb[_0xc790('0x42')][_0xc790('0x2c')]);_0x3bd4dd[_0xc790('0x2a')]=qs[_0xc790('0x2a')](_0x3fe8fb[_0xc790('0x42')][_0xc790('0x2a')]);}_0x3bd4dd[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x3fe8fb[_0xc790('0x42')][_0xc790('0x4a')]);_0x3bd4dd[_0xc790('0x4d')]=qs[_0xc790('0x44')](_['pick'](_0x3fe8fb[_0xc790('0x42')],_0x5eafd6[_0xc790('0x44')]));_0x3bd4dd[_0xc790('0x4d')][_0xc790('0x5e')]=_0xa604c8['id'];if(_0x3fe8fb[_0xc790('0x42')]['filter']){_0x3bd4dd[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x3bd4dd[_0xc790('0x4d')],{'$or':_[_0xc790('0x3b')](_0x3bd4dd[_0xc790('0x45')],function(_0x380aa8){var _0xf87c8={};_0xf87c8[_0x380aa8]={'$like':'%'+_0x3fe8fb[_0xc790('0x42')][_0xc790('0x4c')]+'%'};return _0xf87c8;})});}_0x3bd4dd=_[_0xc790('0x4e')]({},_0x3bd4dd,_0x3fe8fb[_0xc790('0x4f')]);return db[_0xc790('0x5f')][_0xc790('0x2d')]({'where':_0x3bd4dd[_0xc790('0x4d')]})[_0xc790('0x1d')](function(_0x432a38){_0x26b47e[_0xc790('0x2d')]=_0x432a38;if(_0x3fe8fb[_0xc790('0x42')][_0xc790('0x64')]){_0x3bd4dd[_0xc790('0x50')]=[{'all':!![]}];}return db[_0xc790('0x5f')][_0xc790('0x65')](_0x3bd4dd);})[_0xc790('0x1d')](function(_0x3ef06c){_0x26b47e[_0xc790('0x51')]=_0x3ef06c;return _0x26b47e;});}})['then'](respondWithFilteredResult(_0x8c5d00,_0x3bd4dd))[_0xc790('0x52')](handleError(_0x8c5d00,null));};exports[_0xc790('0x66')]=function(_0x469bc0,_0x1c7c82,_0x4314cd){return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0x469bc0[_0xc790('0x53')]['id']}})['then'](handleEntityNotFound(_0x1c7c82,null))[_0xc790('0x1d')](function(_0x591046){if(_0x591046){return _0x591046[_0xc790('0x66')](_0x469bc0['query'][_0xc790('0x67')]);}})[_0xc790('0x1d')](respondWithStatusCode(_0x1c7c82,null))[_0xc790('0x52')](handleError(_0x1c7c82,null));};exports[_0xc790('0x68')]=function(_0x579815,_0x311e93,_0x1a180b){if(_0x579815['body']['id']){delete _0x579815['body']['id'];}return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0x579815[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x311e93,null))[_0xc790('0x1d')](function(_0x42eeaa){if(_0x42eeaa){_0x579815[_0xc790('0x57')][_0xc790('0x5e')]=_0x42eeaa['id'];return db[_0xc790('0x69')][_0xc790('0x56')](_0x579815['body']);}})['then'](respondWithResult(_0x311e93,null))[_0xc790('0x52')](handleError(_0x311e93,null));};exports['getAnswers']=function(_0x4570de,_0x206e96,_0x42aee4){var _0x26fea1={'raw':![],'where':{}};var _0xbef499={};var _0xffcc64={'count':0x0,'rows':[]};return db[_0xc790('0x3c')][_0xc790('0x61')]({'where':{'id':_0x4570de[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x206e96,null))[_0xc790('0x1d')](function(_0x434e01){if(_0x434e01){_0xbef499[_0xc790('0x41')]=_[_0xc790('0x43')](db[_0xc790('0x69')][_0xc790('0x3d')]);_0xbef499['query']=_[_0xc790('0x43')](_0x4570de[_0xc790('0x42')]);_0xbef499[_0xc790('0x44')]=_[_0xc790('0x46')](_0xbef499['model'],_0xbef499['query']);_0x26fea1[_0xc790('0x45')]=_[_0xc790('0x46')](_0xbef499[_0xc790('0x41')],qs['fields'](_0x4570de[_0xc790('0x42')][_0xc790('0x47')]));_0x26fea1['attributes']=_0x26fea1[_0xc790('0x45')][_0xc790('0x48')]?_0x26fea1[_0xc790('0x45')]:_0xbef499['model'];if(!_0x4570de[_0xc790('0x42')]['hasOwnProperty'](_0xc790('0x63'))){_0x26fea1[_0xc790('0x2c')]=qs[_0xc790('0x2c')](_0x4570de['query'][_0xc790('0x2c')]);_0x26fea1[_0xc790('0x2a')]=qs[_0xc790('0x2a')](_0x4570de['query']['offset']);}_0x26fea1[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x4570de[_0xc790('0x42')]['sort']);_0x26fea1[_0xc790('0x4d')]=qs[_0xc790('0x44')](_[_0xc790('0x4b')](_0x4570de[_0xc790('0x42')],_0xbef499['filters']));_0x26fea1[_0xc790('0x4d')][_0xc790('0x5e')]=_0x434e01['id'];if(_0x4570de[_0xc790('0x42')][_0xc790('0x4c')]){_0x26fea1['where']=_['merge'](_0x26fea1[_0xc790('0x4d')],{'$or':_[_0xc790('0x3b')](_0x26fea1[_0xc790('0x45')],function(_0x35527c){var _0x3adaa8={};_0x3adaa8[_0x35527c]={'$like':'%'+_0x4570de[_0xc790('0x42')][_0xc790('0x4c')]+'%'};return _0x3adaa8;})});}_0x26fea1=_['merge']({},_0x26fea1,_0x4570de['options']);return db[_0xc790('0x69')][_0xc790('0x2d')]({'where':_0x26fea1['where']})[_0xc790('0x1d')](function(_0x4ba8c0){_0xffcc64[_0xc790('0x2d')]=_0x4ba8c0;if(_0x4570de[_0xc790('0x42')][_0xc790('0x64')]){_0x26fea1['include']=[{'all':!![]}];}return db[_0xc790('0x69')][_0xc790('0x65')](_0x26fea1);})[_0xc790('0x1d')](function(_0x532555){_0xffcc64[_0xc790('0x51')]=_0x532555;return _0xffcc64;});}})[_0xc790('0x1d')](respondWithFilteredResult(_0x206e96,_0x26fea1))['catch'](handleError(_0x206e96,null));};exports[_0xc790('0x6a')]=function(_0x503595,_0x344909,_0x3ae856){return db[_0xc790('0x3c')]['find']({'where':{'id':_0x503595[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x344909,null))[_0xc790('0x1d')](function(_0x2f415e){if(_0x2f415e){return _0x2f415e[_0xc790('0x6a')](_0x503595[_0xc790('0x42')][_0xc790('0x67')]);}})[_0xc790('0x1d')](respondWithStatusCode(_0x344909,null))['catch'](handleError(_0x344909,null));};exports['addInteraction']=function(_0xd021f0,_0x42ccce,_0x5c9f9c){return db['FaxInteraction']['find']({'where':{'id':_0xd021f0[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x42ccce,null))[_0xc790('0x1d')](function(_0x3f5b35){if(_0x3f5b35){return _0x3f5b35['addInteraction'](_0xd021f0[_0xc790('0x57')]['ids'],_[_0xc790('0x6b')](_0xd021f0[_0xc790('0x57')],[_0xc790('0x67'),'id'])||{});}})[_0xc790('0x1d')](respondWithResult(_0x42ccce,null))[_0xc790('0x52')](handleError(_0x42ccce,null));};exports[_0xc790('0x6c')]=function(_0x16f3f0,_0x31dd85,_0x14ca89){var _0x592d9c={'raw':![],'where':{}};var _0x10d000={};var _0x28aec3={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc790('0x61')]({'where':{'id':_0x16f3f0[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x31dd85,null))[_0xc790('0x1d')](function(_0x5b8868){if(_0x5b8868){_0x10d000[_0xc790('0x41')]=_[_0xc790('0x43')](db['FaxInteraction'][_0xc790('0x3d')]);_0x10d000[_0xc790('0x42')]=_[_0xc790('0x43')](_0x16f3f0['query']);_0x10d000[_0xc790('0x44')]=_[_0xc790('0x46')](_0x10d000[_0xc790('0x41')],_0x10d000[_0xc790('0x42')]);_0x592d9c[_0xc790('0x45')]=_[_0xc790('0x46')](_0x10d000['model'],qs[_0xc790('0x47')](_0x16f3f0['query'][_0xc790('0x47')]));_0x592d9c[_0xc790('0x45')]=_0x592d9c[_0xc790('0x45')][_0xc790('0x48')]?_0x592d9c['attributes']:_0x10d000['model'];if(!_0x16f3f0[_0xc790('0x42')][_0xc790('0x62')](_0xc790('0x63'))){_0x592d9c[_0xc790('0x2c')]=qs[_0xc790('0x2c')](_0x16f3f0['query'][_0xc790('0x2c')]);_0x592d9c[_0xc790('0x2a')]=qs[_0xc790('0x2a')](_0x16f3f0['query'][_0xc790('0x2a')]);}_0x592d9c[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x16f3f0[_0xc790('0x42')][_0xc790('0x4a')]);_0x592d9c[_0xc790('0x4d')]=qs[_0xc790('0x44')](_['pick'](_0x16f3f0['query'],_0x10d000[_0xc790('0x44')]));_0x592d9c['where']['FaxAccountId']=_0x5b8868['id'];if(_0x16f3f0['query'][_0xc790('0x4c')]){_0x592d9c[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x592d9c[_0xc790('0x4d')],{'$or':_['map'](_0x592d9c[_0xc790('0x45')],function(_0x317407){var _0x12a779={};_0x12a779[_0x317407]={'$like':'%'+_0x16f3f0[_0xc790('0x42')][_0xc790('0x4c')]+'%'};return _0x12a779;})});}_0x592d9c=_['merge']({},_0x592d9c,_0x16f3f0[_0xc790('0x4f')]);return db[_0xc790('0x6d')][_0xc790('0x2d')]({'where':_0x592d9c[_0xc790('0x4d')]})[_0xc790('0x1d')](function(_0x3ec6f9){_0x28aec3[_0xc790('0x2d')]=_0x3ec6f9;if(_0x16f3f0[_0xc790('0x42')]['includeAll']){_0x592d9c['include']=[{'model':db[_0xc790('0x6e')],'as':_0xc790('0x6f'),'required':![]},{'model':db[_0xc790('0x70')],'as':_0xc790('0x71'),'attributes':[_0xc790('0x37'),_0xc790('0x72'),'internal'],'required':![]},{'model':db[_0xc790('0x73')],'as':_0xc790('0x74'),'attributes':['id',_0xc790('0x37'),_0xc790('0x75')],'where':_0x16f3f0[_0xc790('0x42')]['tag']?{'id':_0x16f3f0['query'][_0xc790('0x76')]}:undefined,'required':_0x16f3f0['query']['tag']?!![]:![]}];}return db[_0xc790('0x6d')][_0xc790('0x65')](_0x592d9c);})['then'](function(_0x401bc5){_0x28aec3[_0xc790('0x51')]=_0x401bc5;return _0x28aec3;});}})[_0xc790('0x1d')](respondWithFilteredResult(_0x31dd85,_0x592d9c))[_0xc790('0x52')](handleError(_0x31dd85,null));};exports[_0xc790('0x77')]=function(_0x8ad0d3,_0x33e00f){var _0x27fec3=_0x8ad0d3[_0xc790('0x53')]['id'];var _0x51b0c6=_0x8ad0d3[_0xc790('0x57')];var _0x5a979e=0xc8;var _0x6123d2=null;return db[_0xc790('0x78')][_0xc790('0x79')]({'isolationLevel':db['sequelize'][_0xc790('0x7a')]['ISOLATION_LEVELS'][_0xc790('0x7b')]},function(_0x5c41b6){return db[_0xc790('0x3c')]['findOne']({'where':{'id':_0x27fec3},'transaction':_0x5c41b6})['then'](function(_0x45fe3d){if(_0x45fe3d){return db[_0xc790('0x7c')][_0xc790('0x32')]({'where':{'FaxAccountId':_0x27fec3},'transaction':_0x5c41b6})[_0xc790('0x1d')](function(){var _0x385e82=_[_0xc790('0x3b')](_0x51b0c6,function(_0x24ad21){_0x24ad21[_0xc790('0x5e')]=_0x27fec3;return _0x24ad21;});return db[_0xc790('0x7c')][_0xc790('0x7d')](_0x385e82,{'transaction':_0x5c41b6});});}else{_0x5a979e=0x194;_0x6123d2=[];}});})[_0xc790('0x1d')](function(){if(_0x5a979e!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x27fec3},'order':_0xc790('0x7e')})[_0xc790('0x1d')](function(_0x4a6a64){_0x6123d2=_0x4a6a64;});}})['catch'](function(_0x22fc6a){_0x5a979e=0x1f4;logger[_0xc790('0x23')](_0x22fc6a['stack']);if(_0x22fc6a[_0xc790('0x37')]){delete _0x22fc6a['name'];}_0x6123d2=_0x22fc6a;})['finally'](function(){if(_0x6123d2===null){_0x33e00f[_0xc790('0x27')](_0x5a979e);}else{if(_0x5a979e===0x1f4){_0x33e00f[_0xc790('0x2e')](_0x5a979e)[_0xc790('0x38')](_0x6123d2);}else{_0x33e00f['status'](_0x5a979e)['json'](_0x6123d2);}}});};exports[_0xc790('0x7f')]=function(_0x2d0f46,_0x228be8,_0x56d3f1){var _0x331a7b={};var _0x5ee998={};var _0x152509;var _0x32e777;return db['FaxAccount'][_0xc790('0x61')]({'where':{'id':_0x2d0f46['params']['id']}})['then'](handleEntityNotFound(_0x228be8,null))[_0xc790('0x1d')](function(_0x5f0671){if(_0x5f0671){_0x152509=_0x5f0671;_0x5ee998[_0xc790('0x41')]=_[_0xc790('0x43')](db[_0xc790('0x7c')][_0xc790('0x3d')]);_0x5ee998[_0xc790('0x42')]=_[_0xc790('0x43')](_0x2d0f46[_0xc790('0x42')]);_0x5ee998[_0xc790('0x44')]=_[_0xc790('0x46')](_0x5ee998[_0xc790('0x41')],_0x5ee998[_0xc790('0x42')]);_0x331a7b[_0xc790('0x45')]=_['intersection'](_0x5ee998[_0xc790('0x41')],qs['fields'](_0x2d0f46[_0xc790('0x42')][_0xc790('0x47')]));_0x331a7b[_0xc790('0x45')]=_0x331a7b[_0xc790('0x45')][_0xc790('0x48')]?_0x331a7b[_0xc790('0x45')]:_0x5ee998[_0xc790('0x41')];_0x331a7b[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x2d0f46[_0xc790('0x42')][_0xc790('0x4a')]);_0x331a7b[_0xc790('0x4d')]=qs[_0xc790('0x44')](_['pick'](_0x2d0f46[_0xc790('0x42')],_0x5ee998[_0xc790('0x44')]));if(_0x2d0f46[_0xc790('0x42')][_0xc790('0x4c')]){_0x331a7b['where']=_['merge'](_0x331a7b[_0xc790('0x4d')],{'$or':_[_0xc790('0x3b')](_0x331a7b[_0xc790('0x45')],function(_0x5bb82d){var _0x3ae428={};_0x3ae428[_0x5bb82d]={'$like':'%'+_0x2d0f46[_0xc790('0x42')][_0xc790('0x4c')]+'%'};return _0x3ae428;})});}_0x331a7b=_[_0xc790('0x4e')]({},_0x331a7b,_0x2d0f46['options']);return _0x152509[_0xc790('0x7f')](_0x331a7b);}})[_0xc790('0x1d')](function(_0x265179){if(_0x265179){_0x32e777=_0x265179[_0xc790('0x48')];if(!_0x2d0f46[_0xc790('0x42')][_0xc790('0x62')](_0xc790('0x63'))){_0x331a7b[_0xc790('0x2c')]=qs['limit'](_0x2d0f46[_0xc790('0x42')][_0xc790('0x2c')]);_0x331a7b[_0xc790('0x2a')]=qs[_0xc790('0x2a')](_0x2d0f46[_0xc790('0x42')]['offset']);}return _0x152509['getApplications'](_0x331a7b);}})[_0xc790('0x1d')](function(_0x2e2b47){if(_0x2e2b47){return _0x2e2b47?{'count':_0x32e777,'rows':_0x2e2b47}:null;}})[_0xc790('0x1d')](respondWithResult(_0x228be8,null))['catch'](handleError(_0x228be8,null));};function Extension(_0x5f6e36,_0x252449,_0x191362,_0x77ff18){this[_0xc790('0x80')]='from-voip-provider';this['exten']=_0x5f6e36[_0xc790('0x81')];this['app']=_0x77ff18;this[_0xc790('0x3f')]=_0xc790('0x82');this[_0xc790('0x83')]='Fax\x20Extension';this[_0xc790('0x5e')]=_0x5f6e36['id'];this[_0xc790('0x7e')]=_0x252449;this['appdata']=_0x191362;}function createExtensionsReciveFax(_0x2df730){var _0x28b664=0x1;var _0x21f818=[];_0x21f818[_0xc790('0x84')](new Extension(_0x2df730,_0x28b664,'',_0xc790('0x85')));_0x28b664+=0x1;_0x21f818[_0xc790('0x84')](new Extension(_0x2df730,_0x28b664,_0xc790('0x86'),_0xc790('0x87')));_0x28b664+=0x1;for(var _0xee8fee in _0x2df730){if(_0x2df730[_0xc790('0x62')](_0xee8fee)&&(_0xee8fee==='ecm'||_0xee8fee===_0xc790('0x81')||_0xee8fee===_0xc790('0x88')||_0xee8fee==='faxdetect'||_0xee8fee==='headerinfo'||_0xee8fee==='maxrate'||_0xee8fee===_0xc790('0x89')||_0xee8fee==='modem'||_0xee8fee===_0xc790('0x8a'))){_0x21f818[_0xc790('0x84')](new Extension(_0x2df730,_0x28b664,'FAXOPT('+_0xee8fee+')='+_0x2df730[_0xee8fee],'Set'));_0x28b664+=0x1;}}_0x21f818[_0xc790('0x84')](new Extension(_0x2df730,_0x28b664,'6',_0xc790('0x8b')));_0x28b664+=0x1;_0x21f818['push'](new Extension(_0x2df730,_0x28b664,_0xc790('0x8c'),'ReceiveFax'));_0x28b664=0x0;return _0x21f818;}exports[_0xc790('0x8d')]=function(_0x11b66f,_0x336862,_0x1c039b){var _0x31569f;return db[_0xc790('0x78')][_0xc790('0x79')](function(_0x21fe40){return db[_0xc790('0x3c')][_0xc790('0x56')](_0x11b66f['body'],{'transaction':_0x21fe40})[_0xc790('0x1d')](function(_0xc6822f){_0x31569f=_0xc6822f[_0xc790('0x33')]({'plain':!![]});return db[_0xc790('0x8e')][_0xc790('0x7d')](createExtensionsReciveFax(_0x31569f),{'transaction':_0x21fe40});});})[_0xc790('0x1d')](function(){return _0x31569f;})['then'](respondWithResult(_0x336862,null))[_0xc790('0x52')](handleError(_0x336862,null));};exports[_0xc790('0x8f')]=function(_0x1f86d9,_0x547e96,_0x1aa8e7){var _0x317f7b;return db[_0xc790('0x78')]['transaction'](function(_0x8b2f13){return db[_0xc790('0x3c')][_0xc790('0x31')](_0x1f86d9[_0xc790('0x57')],{'where':{'id':_0x1f86d9[_0xc790('0x57')]['id']},'transaction':_0x8b2f13})[_0xc790('0x1d')](function(_0x3fd904){return db[_0xc790('0x8e')][_0xc790('0x32')]({'where':{'FaxAccountId':_0x1f86d9[_0xc790('0x57')]['id']},'transaction':_0x8b2f13})[_0xc790('0x1d')](function(_0x1721fc){return db[_0xc790('0x8e')][_0xc790('0x7d')](createExtensionsReciveFax(_['omit'](_0x1f86d9['body'],['tech',_0xc790('0x40'),'createdAt','updatedAt',_0xc790('0x90'),_0xc790('0x91')])),{'transaction':_0x8b2f13});});});})[_0xc790('0x1d')](function(){return db[_0xc790('0x3c')][_0xc790('0x92')](_0x1f86d9[_0xc790('0x57')]['id']);})[_0xc790('0x1d')](respondWithResult(_0x547e96,null))[_0xc790('0x52')](handleError(_0x547e96,null));};exports[_0xc790('0x93')]=function(_0x4dec13,_0x122546,_0xdf1436){var _0x5e0724={'raw':!![],'where':{}};var _0x19ef08={};var _0x3f32da={'count':0x0,'rows':[]};return db[_0xc790('0x3c')][_0xc790('0x61')]({'where':{'id':_0x4dec13[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x122546,null))[_0xc790('0x1d')](function(_0x3c6386){if(_0x3c6386){_0x19ef08[_0xc790('0x41')]=_[_0xc790('0x43')](db['FaxMessage'][_0xc790('0x3d')]);_0x19ef08[_0xc790('0x42')]=_['keys'](_0x4dec13[_0xc790('0x42')]);_0x19ef08[_0xc790('0x44')]=_[_0xc790('0x46')](_0x19ef08[_0xc790('0x41')],_0x19ef08[_0xc790('0x42')]);_0x5e0724[_0xc790('0x45')]=_[_0xc790('0x46')](_0x19ef08['model'],qs[_0xc790('0x47')](_0x4dec13['query'][_0xc790('0x47')]));_0x5e0724[_0xc790('0x45')]=_0x5e0724[_0xc790('0x45')][_0xc790('0x48')]?_0x5e0724[_0xc790('0x45')]:_0x19ef08[_0xc790('0x41')];if(!_0x4dec13['query']['hasOwnProperty'](_0xc790('0x63'))){_0x5e0724['limit']=qs['limit'](_0x4dec13['query']['limit']);_0x5e0724['offset']=qs['offset'](_0x4dec13[_0xc790('0x42')][_0xc790('0x2a')]);}_0x5e0724[_0xc790('0x49')]=qs[_0xc790('0x4a')](_0x4dec13[_0xc790('0x42')][_0xc790('0x4a')]);_0x5e0724[_0xc790('0x4d')]=qs[_0xc790('0x44')](_[_0xc790('0x4b')](_0x4dec13[_0xc790('0x42')],_0x19ef08[_0xc790('0x44')]));_0x5e0724[_0xc790('0x4d')][_0xc790('0x5e')]=_0x3c6386['id'];if(_0x4dec13[_0xc790('0x42')][_0xc790('0x4c')]){_0x5e0724[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x5e0724[_0xc790('0x4d')],{'$or':_[_0xc790('0x3b')](_0x5e0724[_0xc790('0x45')],function(_0x412382){var _0x44bc6f={};_0x44bc6f[_0x412382]={'$like':'%'+_0x4dec13['query'][_0xc790('0x4c')]+'%'};return _0x44bc6f;})});}if(_0x4dec13['query']['$gte']){var _0x48a127=_0x4dec13[_0xc790('0x42')][_0xc790('0x94')][_0xc790('0x95')](',');var _0x3b9e1a={};_0x3b9e1a[_0x48a127[0x0]]={'$gte':moment(_0x48a127[0x1])[_0xc790('0x96')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e0724[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x5e0724[_0xc790('0x4d')],_0x3b9e1a);}_0x5e0724=_[_0xc790('0x4e')]({},_0x5e0724,_0x4dec13['options']);return db[_0xc790('0x97')][_0xc790('0x2d')]({'where':_0x5e0724[_0xc790('0x4d')]})[_0xc790('0x1d')](function(_0xc4d638){_0x3f32da[_0xc790('0x2d')]=_0xc4d638;if(_0x4dec13['query'][_0xc790('0x64')]){_0x5e0724[_0xc790('0x50')]=[{'all':!![]}];}return db[_0xc790('0x97')][_0xc790('0x65')](_0x5e0724);})[_0xc790('0x1d')](function(_0x1abcee){_0x3f32da[_0xc790('0x51')]=_0x1abcee;return _0x3f32da;});}})[_0xc790('0x1d')](respondWithFilteredResult(_0x122546,_0x5e0724))[_0xc790('0x52')](handleError(_0x122546,null));};exports[_0xc790('0x38')]=function(_0x1da850,_0x3a2804,_0x41e87d){var _0x257a38,_0x14d903={},_0x1e0bed;if(_0x1da850[_0xc790('0x57')]['to']){_0x1e0bed=_0x1da850[_0xc790('0x57')]['to'][0x0];}return db[_0xc790('0x3c')][_0xc790('0x55')]({'where':{'id':_0x1da850[_0xc790('0x53')]['id']},'include':[{'model':db[_0xc790('0x98')],'as':'List','include':[{'model':db[_0xc790('0x6e')],'as':'Contacts','where':{'fax':_0x1e0bed},'limit':0x1,'order':[[_0xc790('0x99'),_0xc790('0x9a')]]}]}]})[_0xc790('0x1d')](handleEntityNotFound(_0x3a2804,null))[_0xc790('0x1d')](function(_0x4ed40e){_0x257a38=_0x4ed40e;if(_0x1da850[_0xc790('0x57')][_0xc790('0x9b')]&&_0x1da850[_0xc790('0x57')]['attachments'][_0xc790('0x48')]){for(var _0x1c555c=0x0;_0x1c555c<_0x1da850[_0xc790('0x57')][_0xc790('0x9b')][_0xc790('0x48')];_0x1c555c+=0x1){_0x1da850['body'][_0xc790('0x9b')][_0x1c555c]={'filename':_0x1da850[_0xc790('0x57')][_0xc790('0x9b')][_0x1c555c][_0xc790('0x37')],'id':_0x1da850[_0xc790('0x57')][_0xc790('0x9b')][_0x1c555c]['id'],'path':path[_0xc790('0x9c')](config[_0xc790('0x9d')],_0xc790('0x9e'),_0x1da850[_0xc790('0x57')][_0xc790('0x9b')][_0x1c555c][_0xc790('0x9f')])};}}return respondWithRpcPromise(_0xc790('0xa0'),_0xc790('0xa0'),{'FaxAccountId':_['isNil'](_0x1da850[_0xc790('0x53')]['id'])?undefined:_0x1da850[_0xc790('0x53')]['id'],'path':_['isNil'](_0x1da850['body']['attachments'][0x0]['path'])?undefined:_0x1da850['body'][_0xc790('0x9b')][0x0]['path'],'fax':_[_0xc790('0xa1')](_0x1da850[_0xc790('0x57')]['to'][0x0])?undefined:_0x1da850[_0xc790('0x57')]['to'][0x0]},client9002);})[_0xc790('0x1d')](function(){if(_0x257a38){if(_[_0xc790('0xa1')](_0x1da850[_0xc790('0x57')][_0xc790('0xa2')])){_0x1da850[_0xc790('0x57')][_0xc790('0xa2')]=util[_0xc790('0x96')]('\x22%s\x22\x20<%s>',_0x257a38[_0xc790('0x37')],_0x257a38[_0xc790('0xa3')]);}if(_0x257a38['List']){if(_0x257a38[_0xc790('0xa4')][_0xc790('0xa5')][_0xc790('0x48')]){return _0x257a38['List'][_0xc790('0xa5')][0x0];}else{return db[_0xc790('0x6e')][_0xc790('0x56')](_[_0xc790('0xa6')](_0x1da850[_0xc790('0x57')],{'firstName':_0x1da850['body']['to'][0x0],'phone':_0x1da850['body']['to'][0x0],'fax':_0x1da850['body']['to'][0x0],'ListId':_0x257a38[_0xc790('0x91')]}));}}else{throw new Error(_0xc790('0xa7'));}}else{throw new Error(_0xc790('0xa8'));}})['then'](function(_0x510fd0){if(_0x510fd0){return db[_0xc790('0x6d')]['find']({'where':{'ContactId':_0x510fd0['id'],'closed':![],'FaxAccountId':_0x257a38['id']}})['then'](function(_0xc39de9){if(_0xc39de9){return[_0xc39de9,![]];}return db[_0xc790('0x6d')]['create']({'UserId':_0x1da850['user']['id'],'ContactId':_0x510fd0['id'],'FaxAccountId':_0x257a38['id'],'fax':_0x1da850[_0xc790('0x57')]['to'][0x0],'firstMsgDirection':_0xc790('0xa9'),'Messages':[_[_0xc790('0x4e')](_0x1da850['body'],{'read':![],'body':_0x1da850['body'][_0xc790('0x9b')][0x0][_0xc790('0xaa')],'FaxAccountId':_0x257a38['id'],'UserId':_0x1da850['user']['id'],'ContactId':_0x510fd0['id'],'AttachmentId':_0x1da850['body'][_0xc790('0x9b')][0x0]['id']})]},{'include':[{'model':db[_0xc790('0x97')],'as':_0xc790('0xab')}]})[_0xc790('0x1d')](function(_0x45cf80){return[_0x45cf80,!![]];});});}else{throw new Error(_0xc790('0xac'));}})[_0xc790('0xad')](function(_0x58c18d,_0x11fa51){if(_0x11fa51){return _0x58c18d;}return db[_0xc790('0x97')][_0xc790('0x56')]({'direction':'out','read':![],'body':_0x1da850[_0xc790('0x57')]['attachments'][0x0][_0xc790('0xaa')],'FaxAccountId':_0x257a38['id'],'FaxInteractionId':_0x58c18d['id'],'UserId':_0x1da850['user']['id'],'ContactId':_0x58c18d['ContactId'],'AttachmentId':_0x1da850[_0xc790('0x57')]['attachments'][0x0]['id']})[_0xc790('0x1d')](function(_0xb3c63f){_0x58c18d[_0xc790('0xae')]['Messages']=[];_0x58c18d[_0xc790('0xae')][_0xc790('0xab')]['push'](_0xb3c63f[_0xc790('0xae')]);return _0x58c18d;});})[_0xc790('0x1d')](function(_0x3c14e6){respondWithRpcPromise(_0xc790('0xaf'),_0xc790('0xaf'),{'FaxAccountId':_[_0xc790('0xa1')](_0x1da850[_0xc790('0x53')]['id'])?undefined:_0x1da850['params']['id'],'path':_[_0xc790('0xa1')](_0x1da850[_0xc790('0x57')]['attachments'][0x0][_0xc790('0x5')])?undefined:_0x1da850[_0xc790('0x57')][_0xc790('0x9b')][0x0][_0xc790('0x5')],'fax':_[_0xc790('0xa1')](_0x1da850[_0xc790('0x57')]['to'][0x0])?undefined:_0x1da850[_0xc790('0x57')]['to'][0x0],'AttachmentId':_0x1da850['body'][_0xc790('0x9b')][0x0]['id']},client9002)['then'](function(_0x4f4056){logger[_0xc790('0x1e')]('SendFaxRpc,\x20%s',_0x4f4056);})['catch'](function(_0x93833e){logger[_0xc790('0x1e')](_0xc790('0xb0'),_0x93833e);});return _0x3c14e6;})[_0xc790('0x1d')](respondWithResult(_0x3a2804,null))['catch'](handleError(_0x3a2804,null));};exports[_0xc790('0xb1')]=function(_0xb7587d,_0x145387,_0x1977b9){return db['FaxAccount'][_0xc790('0x55')]({'where':{'id':_0xb7587d['params']['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x145387,null))[_0xc790('0x1d')](function(_0xefdc52){if(_0xefdc52){return _0xefdc52[_0xc790('0xb1')](_0xb7587d['body'][_0xc790('0x67')],_['omit'](_0xb7587d[_0xc790('0x57')],['ids','id'])||{})[_0xc790('0xad')](function(_0x1c2068){for(var _0x282869=0x0;_0x282869<_0xb7587d['body']['ids'][_0xc790('0x48')];_0x282869+=0x1){socket[_0xc790('0xb2')]('userFaxAccount:save',{'UserId':Number(_0xb7587d[_0xc790('0x57')][_0xc790('0x67')][_0x282869]),'FaxAccountId':Number(_0xb7587d[_0xc790('0x53')]['id'])});}return _0x1c2068;});}})['then'](respondWithResult(_0x145387,null))[_0xc790('0x52')](handleError(_0x145387,null));};exports[_0xc790('0xb3')]=function(_0x485e70,_0x57abc0,_0x540dec){return db['FaxAccount'][_0xc790('0x55')]({'where':{'id':_0x485e70[_0xc790('0x53')]['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x57abc0,null))['then'](function(_0x1aac37){if(_0x1aac37){return _0x1aac37[_0xc790('0xb3')](_0x485e70['query'][_0xc790('0x67')])[_0xc790('0x1d')](function(){if(_[_0xc790('0xb4')](_0x485e70[_0xc790('0x42')]['ids'])){for(var _0x224626=0x0;_0x224626<_0x485e70[_0xc790('0x42')][_0xc790('0x67')][_0xc790('0x48')];_0x224626+=0x1){socket[_0xc790('0xb2')](_0xc790('0xb5'),{'UserId':Number(_0x485e70[_0xc790('0x42')][_0xc790('0x67')][_0x224626]),'FaxAccountId':Number(_0x485e70[_0xc790('0x53')]['id'])});}}else{socket[_0xc790('0xb2')](_0xc790('0xb5'),{'UserId':Number(_0x485e70[_0xc790('0x42')][_0xc790('0x67')]),'FaxAccountId':Number(_0x485e70[_0xc790('0x53')]['id'])});}});}})[_0xc790('0x1d')](respondWithStatusCode(_0x57abc0,null))[_0xc790('0x52')](handleError(_0x57abc0,null));};exports['getAgents']=function(_0x136497,_0x59e4b4,_0x333162){var _0x3595fc={};var _0x26727b={};var _0x4847bf;var _0x2ae146;return db[_0xc790('0x3c')][_0xc790('0x61')]({'where':{'id':_0x136497['params']['id']}})[_0xc790('0x1d')](handleEntityNotFound(_0x59e4b4,null))[_0xc790('0x1d')](function(_0x19d191){if(_0x19d191){_0x4847bf=_0x19d191;_0x26727b[_0xc790('0x41')]=_[_0xc790('0x43')](db[_0xc790('0x70')][_0xc790('0x3d')]);_0x26727b[_0xc790('0x42')]=_[_0xc790('0x43')](_0x136497[_0xc790('0x42')]);_0x26727b[_0xc790('0x44')]=_[_0xc790('0x46')](_0x26727b[_0xc790('0x41')],_0x26727b[_0xc790('0x42')]);_0x3595fc['attributes']=_[_0xc790('0x46')](_0x26727b[_0xc790('0x41')],qs[_0xc790('0x47')](_0x136497[_0xc790('0x42')]['fields']));_0x3595fc[_0xc790('0x45')]=_0x3595fc['attributes']['length']?_0x3595fc[_0xc790('0x45')]:_0x26727b['model'];_0x3595fc[_0xc790('0x49')]=qs['sort'](_0x136497[_0xc790('0x42')][_0xc790('0x4a')]);_0x3595fc[_0xc790('0x4d')]=qs[_0xc790('0x44')](_[_0xc790('0x4b')](_0x136497['query'],_0x26727b[_0xc790('0x44')]));if(_0x136497[_0xc790('0x42')][_0xc790('0x4c')]){_0x3595fc[_0xc790('0x4d')]=_[_0xc790('0x4e')](_0x3595fc[_0xc790('0x4d')],{'$or':_[_0xc790('0x3b')](_0x3595fc[_0xc790('0x45')],function(_0x4cb088){var _0x32a925={};_0x32a925[_0x4cb088]={'$like':'%'+_0x136497[_0xc790('0x42')]['filter']+'%'};return _0x32a925;})});}_0x3595fc=_[_0xc790('0x4e')]({},_0x3595fc,_0x136497[_0xc790('0x4f')]);return _0x4847bf[_0xc790('0xb6')](_0x3595fc);}})[_0xc790('0x1d')](function(_0x11b92c){if(_0x11b92c){_0x2ae146=_0x11b92c['length'];if(!_0x136497[_0xc790('0x42')]['hasOwnProperty'](_0xc790('0x63'))){_0x3595fc[_0xc790('0x2c')]=qs[_0xc790('0x2c')](_0x136497[_0xc790('0x42')][_0xc790('0x2c')]);_0x3595fc[_0xc790('0x2a')]=qs[_0xc790('0x2a')](_0x136497[_0xc790('0x42')][_0xc790('0x2a')]);}return _0x4847bf[_0xc790('0xb6')](_0x3595fc);}})[_0xc790('0x1d')](function(_0x3e9772){if(_0x3e9772){return _0x3e9772?{'count':_0x2ae146,'rows':_0x3e9772}:null;}})['then'](respondWithResult(_0x59e4b4,null))[_0xc790('0x52')](handleError(_0x59e4b4,null));}; \ No newline at end of file +var _0x5d49=['Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','params','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','autoAssociation','body','find','describe','addDisposition','getDispositions','Disposition','FaxAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','Transaction','FaxApplication','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','transaction','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','isNil','path','from','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x5d49,0x88));var _0x95d4=function(_0x2160cb,_0x291d26){_0x2160cb=_0x2160cb-0x0;var _0x498603=_0x5d49[_0x2160cb];return _0x498603;};'use strict';var emlformat=require(_0x95d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x95d4('0x1'));var jsonpatch=require(_0x95d4('0x2'));var rp=require('request-promise');var moment=require(_0x95d4('0x3'));var BPromise=require(_0x95d4('0x4'));var Mustache=require(_0x95d4('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x95d4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95d4('0x7'));var _=require(_0x95d4('0x8'));var squel=require(_0x95d4('0x9'));var crypto=require(_0x95d4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x95d4('0xb'));var toCsv=require(_0x95d4('0x6'));var querystring=require(_0x95d4('0xc'));var Papa=require(_0x95d4('0xd'));var Redis=require('ioredis');var authService=require(_0x95d4('0xe'));var qs=require(_0x95d4('0xf'));var as=require(_0x95d4('0x10'));var hardwareService=require(_0x95d4('0x11'));var logger=require(_0x95d4('0x12'))(_0x95d4('0x13'));var utils=require(_0x95d4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x95d4('0x15'));var db=require(_0x95d4('0x16'))['db'];config[_0x95d4('0x17')]=_[_0x95d4('0x18')](config[_0x95d4('0x17')],{'host':_0x95d4('0x19'),'port':0x18eb});var socket=require(_0x95d4('0x1a'))(new Redis(config[_0x95d4('0x17')]));require(_0x95d4('0x1b'))[_0x95d4('0x1c')](socket);var jayson=require(_0x95d4('0x1d'));var client=jayson['client'][_0x95d4('0x1e')]({'port':0x232c});var client9002=jayson[_0x95d4('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31738c,_0x11762c,_0x3d1e36,_0x5bff58){return new BPromise(function(_0x2bbbcb,_0x84ba){var _0xe51766=_0x5bff58||client;return _0xe51766[_0x95d4('0x20')](_0x31738c,_0x3d1e36)[_0x95d4('0x21')](function(_0x496012){logger['info'](_0x95d4('0x22'),_0x11762c,_0x95d4('0x23'));logger[_0x95d4('0x24')](_0x95d4('0x25'),_0x11762c,_0x95d4('0x23'),JSON[_0x95d4('0x26')](_0x496012));if(_0x496012['error']){if(_0x496012[_0x95d4('0x27')][_0x95d4('0x28')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x11762c,_0x496012[_0x95d4('0x27')][_0x95d4('0x29')]);return _0x84ba(_0x496012[_0x95d4('0x27')][_0x95d4('0x29')]);}logger[_0x95d4('0x27')](_0x95d4('0x22'),_0x11762c,_0x496012[_0x95d4('0x27')][_0x95d4('0x29')]);return _0x2bbbcb(_0x496012[_0x95d4('0x27')][_0x95d4('0x29')]);}else{logger[_0x95d4('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x11762c,'request\x20sent');_0x2bbbcb(_0x496012[_0x95d4('0x2b')][_0x95d4('0x29')]);}})[_0x95d4('0x2c')](function(_0x116dc6){logger[_0x95d4('0x27')](_0x95d4('0x22'),_0x11762c,_0x116dc6);_0x84ba(_0x116dc6);});});}function respondWithStatusCode(_0x32681d,_0x5b9f1f){_0x5b9f1f=_0x5b9f1f||0xcc;return function(_0x274f12){if(_0x274f12){return _0x32681d[_0x95d4('0x2d')](_0x5b9f1f);}return _0x32681d['status'](_0x5b9f1f)[_0x95d4('0x2e')]();};}function respondWithResult(_0x4c7d43,_0x9385c8){_0x9385c8=_0x9385c8||0xc8;return function(_0xbc3146){if(_0xbc3146){return _0x4c7d43[_0x95d4('0x2f')](_0x9385c8)[_0x95d4('0x30')](_0xbc3146);}};}function respondWithFilteredResult(_0x10684f,_0x7fd927){return function(_0x10d0ab){if(_0x10d0ab){var _0x5905cb=typeof _0x7fd927[_0x95d4('0x31')]==='undefined'&&typeof _0x7fd927[_0x95d4('0x32')]==='undefined';var _0xc695a2=_0x10d0ab['count'];var _0x2724a7=_0x5905cb?0x0:_0x7fd927[_0x95d4('0x31')];var _0x7064f9=_0x5905cb?_0x10d0ab['count']:_0x7fd927[_0x95d4('0x31')]+_0x7fd927[_0x95d4('0x32')];var _0x29bd8d;if(_0x7064f9>=_0xc695a2){_0x7064f9=_0xc695a2;_0x29bd8d=0xc8;}else{_0x29bd8d=0xce;}_0x10684f[_0x95d4('0x2f')](_0x29bd8d);return _0x10684f[_0x95d4('0x33')](_0x95d4('0x34'),_0x2724a7+'-'+_0x7064f9+'/'+_0xc695a2)[_0x95d4('0x30')](_0x10d0ab);}return null;};}function patchUpdates(_0x31a3f4){return function(_0x3dfb66){try{jsonpatch[_0x95d4('0x35')](_0x3dfb66,_0x31a3f4,!![]);}catch(_0x5b5a27){return BPromise[_0x95d4('0x36')](_0x5b5a27);}return _0x3dfb66[_0x95d4('0x37')]();};}function saveUpdates(_0x3cbc94,_0x2aadff){return function(_0x28ae61){if(_0x28ae61){return _0x28ae61[_0x95d4('0x38')](_0x3cbc94)[_0x95d4('0x21')](function(_0x255f6c){return _0x255f6c;});}return null;};}function removeEntity(_0x1878e1,_0x5af9a5){return function(_0x74c212){if(_0x74c212){return _0x74c212[_0x95d4('0x39')]()['then'](function(){var _0xf7799a=_0x74c212[_0x95d4('0x3a')]({'plain':!![]});var _0x1d55e8='FaxAccounts';return db[_0x95d4('0x3b')][_0x95d4('0x39')]({'where':{'type':_0x1d55e8,'resourceId':_0xf7799a['id']}})[_0x95d4('0x21')](function(){return _0x74c212;});})['then'](function(){_0x1878e1['status'](0xcc)[_0x95d4('0x2e')]();});}};}function handleEntityNotFound(_0x59a4dc,_0x3e55d5){return function(_0x3f09c0){if(!_0x3f09c0){_0x59a4dc[_0x95d4('0x2d')](0x194);}return _0x3f09c0;};}function handleError(_0x3664d5,_0x5b7256){_0x5b7256=_0x5b7256||0x1f4;return function(_0x5d3ceb){logger[_0x95d4('0x27')](_0x5d3ceb[_0x95d4('0x3c')]);if(_0x5d3ceb['name']){delete _0x5d3ceb[_0x95d4('0x3d')];}_0x3664d5['status'](_0x5b7256)[_0x95d4('0x3e')](_0x5d3ceb);};}exports[_0x95d4('0x3f')]=function(_0x1eed47,_0x3b2e2e){var _0x5bcba8={'include':[{'model':db[_0x95d4('0x40')],'as':_0x95d4('0x41')}]},_0x41e385={},_0x261c74={'count':0x0,'rows':[]};var _0x6ac067=_[_0x95d4('0x42')](db[_0x95d4('0x43')][_0x95d4('0x44')],function(_0x560945){return{'name':_0x560945[_0x95d4('0x45')],'type':_0x560945[_0x95d4('0x46')][_0x95d4('0x47')]};});_0x41e385[_0x95d4('0x48')]=_[_0x95d4('0x42')](_0x6ac067,_0x95d4('0x3d'));_0x41e385[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x1eed47[_0x95d4('0x49')]);_0x41e385[_0x95d4('0x4b')]=_[_0x95d4('0x4c')](_0x41e385[_0x95d4('0x48')],_0x41e385[_0x95d4('0x49')]);_0x5bcba8['attributes']=_[_0x95d4('0x4c')](_0x41e385[_0x95d4('0x48')],qs['fields'](_0x1eed47['query'][_0x95d4('0x4d')]));_0x5bcba8[_0x95d4('0x4e')]=_0x5bcba8[_0x95d4('0x4e')]['length']?_0x5bcba8[_0x95d4('0x4e')]:_0x41e385['model'];if(!_0x1eed47['query'][_0x95d4('0x4f')](_0x95d4('0x50'))){_0x5bcba8[_0x95d4('0x32')]=qs['limit'](_0x1eed47['query'][_0x95d4('0x32')]);_0x5bcba8['offset']=qs[_0x95d4('0x31')](_0x1eed47['query'][_0x95d4('0x31')]);}_0x5bcba8[_0x95d4('0x51')]=qs[_0x95d4('0x52')](_0x1eed47[_0x95d4('0x49')][_0x95d4('0x52')]);_0x5bcba8[_0x95d4('0x53')]=qs[_0x95d4('0x4b')](_[_0x95d4('0x54')](_0x1eed47['query'],_0x41e385[_0x95d4('0x4b')]),_0x6ac067);if(_0x1eed47['query'][_0x95d4('0x55')]){_0x5bcba8['where']=_[_0x95d4('0x56')](_0x5bcba8['where'],{'$or':_[_0x95d4('0x42')](_0x6ac067,function(_0xcce02b){if(_0xcce02b[_0x95d4('0x46')]!=='VIRTUAL'){var _0x40b5aa={};_0x40b5aa[_0xcce02b['name']]={'$like':'%'+_0x1eed47[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x40b5aa;}})});}_0x5bcba8=_[_0x95d4('0x56')]({},_0x5bcba8,_0x1eed47[_0x95d4('0x57')]);var _0x4c831c={'where':_0x5bcba8[_0x95d4('0x53')]};return db['FaxAccount'][_0x95d4('0x58')](_0x4c831c)[_0x95d4('0x21')](function(_0x1b3d74){_0x261c74[_0x95d4('0x58')]=_0x1b3d74;if(_0x1eed47[_0x95d4('0x49')][_0x95d4('0x59')]){_0x5bcba8[_0x95d4('0x5a')]=[{'all':!![]}];}return db[_0x95d4('0x43')]['findAll'](_0x5bcba8);})['then'](function(_0x4524d9){_0x261c74[_0x95d4('0x5b')]=_0x4524d9;return _0x261c74;})[_0x95d4('0x21')](respondWithFilteredResult(_0x3b2e2e,_0x5bcba8))[_0x95d4('0x2c')](handleError(_0x3b2e2e,null));};exports['show']=function(_0x3d9587,_0x4e1e91){var _0x1f2a80={'raw':![],'where':{'id':_0x3d9587[_0x95d4('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x95d4('0x41')}]},_0x51b85f={};_0x51b85f[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db['FaxAccount'][_0x95d4('0x44')]);_0x51b85f[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x3d9587[_0x95d4('0x49')]);_0x51b85f['filters']=_['intersection'](_0x51b85f[_0x95d4('0x48')],_0x51b85f[_0x95d4('0x49')]);_0x1f2a80[_0x95d4('0x4e')]=_[_0x95d4('0x4c')](_0x51b85f[_0x95d4('0x48')],qs[_0x95d4('0x4d')](_0x3d9587[_0x95d4('0x49')]['fields']));_0x1f2a80[_0x95d4('0x4e')]=_0x1f2a80[_0x95d4('0x4e')][_0x95d4('0x5d')]?_0x1f2a80['attributes']:_0x51b85f['model'];if(_0x3d9587['query'][_0x95d4('0x59')]){_0x1f2a80[_0x95d4('0x5a')]=[{'all':!![]}];}_0x1f2a80=_[_0x95d4('0x56')]({},_0x1f2a80,_0x3d9587[_0x95d4('0x57')]);return db['FaxAccount']['find'](_0x1f2a80)[_0x95d4('0x21')](handleEntityNotFound(_0x4e1e91,null))[_0x95d4('0x21')](respondWithResult(_0x4e1e91,null))[_0x95d4('0x2c')](handleError(_0x4e1e91,null));};exports[_0x95d4('0x5e')]=function(_0x2a34b7,_0x39d747){return db[_0x95d4('0x43')][_0x95d4('0x5e')](_0x2a34b7['body'],{})[_0x95d4('0x21')](function(_0x3290ae){var _0x17d74f=_0x2a34b7[_0x95d4('0x5f')]['get']({'plain':!![]});if(!_0x17d74f)throw new Error(_0x95d4('0x60'));if(_0x17d74f[_0x95d4('0x61')]===_0x95d4('0x5f')){var _0x4a608b=_0x3290ae[_0x95d4('0x3a')]({'plain':!![]});var _0x5989ec=_0x95d4('0x62');return db['UserProfileSection']['find']({'where':{'name':_0x5989ec,'userProfileId':_0x17d74f['userProfileId']},'raw':!![]})[_0x95d4('0x21')](function(_0x207b27){if(_0x207b27&&_0x207b27[_0x95d4('0x63')]===0x0){return db[_0x95d4('0x3b')]['create']({'name':_0x4a608b[_0x95d4('0x3d')],'resourceId':_0x4a608b['id'],'type':_0x207b27[_0x95d4('0x3d')],'sectionId':_0x207b27['id']},{})[_0x95d4('0x21')](function(){return _0x3290ae;});}else{return _0x3290ae;}})['catch'](function(_0x1e215b){logger[_0x95d4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e215b);throw _0x1e215b;});}return _0x3290ae;})[_0x95d4('0x21')](respondWithResult(_0x39d747,0xc9))[_0x95d4('0x2c')](handleError(_0x39d747,null));};exports['update']=function(_0x506432,_0x499fa1){if(_0x506432[_0x95d4('0x64')]['id']){delete _0x506432[_0x95d4('0x64')]['id'];}return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x506432[_0x95d4('0x5c')]['id']},'include':[{'model':db[_0x95d4('0x40')],'as':_0x95d4('0x41')}]})[_0x95d4('0x21')](handleEntityNotFound(_0x499fa1,null))[_0x95d4('0x21')](saveUpdates(_0x506432[_0x95d4('0x64')],null))[_0x95d4('0x21')](respondWithResult(_0x499fa1,null))[_0x95d4('0x2c')](handleError(_0x499fa1,null));};exports['destroy']=function(_0x2e0e45,_0x1c97ae){return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x2e0e45[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x1c97ae,null))['then'](removeEntity(_0x1c97ae,null))[_0x95d4('0x2c')](handleError(_0x1c97ae,null));};exports['describe']=function(_0x507422,_0x2cc096){return db[_0x95d4('0x43')][_0x95d4('0x66')]()['then'](respondWithResult(_0x2cc096,null))[_0x95d4('0x2c')](handleError(_0x2cc096,null));};exports[_0x95d4('0x67')]=function(_0x129543,_0x569e5d,_0x1b4e3a){if(_0x129543[_0x95d4('0x64')]['id']){delete _0x129543[_0x95d4('0x64')]['id'];}return db['FaxAccount'][_0x95d4('0x65')]({'where':{'id':_0x129543[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x569e5d,null))[_0x95d4('0x21')](function(_0x15649f){if(_0x15649f){_0x129543['body']['FaxAccountId']=_0x15649f['id'];return db['Disposition'][_0x95d4('0x5e')](_0x129543[_0x95d4('0x64')]);}})[_0x95d4('0x21')](respondWithResult(_0x569e5d,null))[_0x95d4('0x2c')](handleError(_0x569e5d,null));};exports[_0x95d4('0x68')]=function(_0x3ba20d,_0x415283,_0x4c9390){var _0x5a055e={'raw':![],'where':{}};var _0x11295c={};var _0x560258={'count':0x0,'rows':[]};return db[_0x95d4('0x43')]['findOne']({'where':{'id':_0x3ba20d['params']['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x415283,null))[_0x95d4('0x21')](function(_0x4e6cc5){if(_0x4e6cc5){_0x11295c[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db[_0x95d4('0x69')][_0x95d4('0x44')]);_0x11295c[_0x95d4('0x49')]=_['keys'](_0x3ba20d['query']);_0x11295c[_0x95d4('0x4b')]=_['intersection'](_0x11295c['model'],_0x11295c[_0x95d4('0x49')]);_0x5a055e[_0x95d4('0x4e')]=_[_0x95d4('0x4c')](_0x11295c[_0x95d4('0x48')],qs['fields'](_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x4d')]));_0x5a055e[_0x95d4('0x4e')]=_0x5a055e[_0x95d4('0x4e')][_0x95d4('0x5d')]?_0x5a055e['attributes']:_0x11295c[_0x95d4('0x48')];if(!_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x4f')](_0x95d4('0x50'))){_0x5a055e[_0x95d4('0x32')]=qs['limit'](_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x32')]);_0x5a055e[_0x95d4('0x31')]=qs[_0x95d4('0x31')](_0x3ba20d[_0x95d4('0x49')]['offset']);}_0x5a055e[_0x95d4('0x51')]=qs['sort'](_0x3ba20d[_0x95d4('0x49')]['sort']);_0x5a055e['where']=qs['filters'](_[_0x95d4('0x54')](_0x3ba20d['query'],_0x11295c[_0x95d4('0x4b')]));_0x5a055e[_0x95d4('0x53')][_0x95d4('0x6a')]=_0x4e6cc5['id'];if(_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x55')]){_0x5a055e['where']=_[_0x95d4('0x56')](_0x5a055e[_0x95d4('0x53')],{'$or':_['map'](_0x5a055e[_0x95d4('0x4e')],function(_0x55a2c8){var _0x5792cc={};_0x5792cc[_0x55a2c8]={'$like':'%'+_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x5792cc;})});}_0x5a055e=_[_0x95d4('0x56')]({},_0x5a055e,_0x3ba20d['options']);return db[_0x95d4('0x69')][_0x95d4('0x58')]({'where':_0x5a055e['where']})[_0x95d4('0x21')](function(_0x38727f){_0x560258['count']=_0x38727f;if(_0x3ba20d[_0x95d4('0x49')][_0x95d4('0x59')]){_0x5a055e[_0x95d4('0x5a')]=[{'all':!![]}];}return db[_0x95d4('0x69')][_0x95d4('0x6b')](_0x5a055e);})[_0x95d4('0x21')](function(_0xfc8604){_0x560258[_0x95d4('0x5b')]=_0xfc8604;return _0x560258;});}})[_0x95d4('0x21')](respondWithFilteredResult(_0x415283,_0x5a055e))[_0x95d4('0x2c')](handleError(_0x415283,null));};exports[_0x95d4('0x6c')]=function(_0x48d993,_0x4dd005,_0x2df75f){return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x48d993[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x4dd005,null))[_0x95d4('0x21')](function(_0x4bee63){if(_0x4bee63){return _0x4bee63[_0x95d4('0x6c')](_0x48d993[_0x95d4('0x49')][_0x95d4('0x6d')]);}})[_0x95d4('0x21')](respondWithStatusCode(_0x4dd005,null))[_0x95d4('0x2c')](handleError(_0x4dd005,null));};exports[_0x95d4('0x6e')]=function(_0x437810,_0x3f078e,_0x587d9b){if(_0x437810[_0x95d4('0x64')]['id']){delete _0x437810[_0x95d4('0x64')]['id'];}return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x437810[_0x95d4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3f078e,null))[_0x95d4('0x21')](function(_0x4222ec){if(_0x4222ec){_0x437810[_0x95d4('0x64')][_0x95d4('0x6a')]=_0x4222ec['id'];return db[_0x95d4('0x6f')]['create'](_0x437810['body']);}})[_0x95d4('0x21')](respondWithResult(_0x3f078e,null))[_0x95d4('0x2c')](handleError(_0x3f078e,null));};exports['getAnswers']=function(_0x489e5f,_0x5f1929,_0x44ba7c){var _0x75615={'raw':![],'where':{}};var _0x163574={};var _0x230b25={'count':0x0,'rows':[]};return db[_0x95d4('0x43')][_0x95d4('0x70')]({'where':{'id':_0x489e5f[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x5f1929,null))[_0x95d4('0x21')](function(_0x21be7){if(_0x21be7){_0x163574[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db['CannedAnswer'][_0x95d4('0x44')]);_0x163574[_0x95d4('0x49')]=_['keys'](_0x489e5f[_0x95d4('0x49')]);_0x163574[_0x95d4('0x4b')]=_[_0x95d4('0x4c')](_0x163574['model'],_0x163574[_0x95d4('0x49')]);_0x75615[_0x95d4('0x4e')]=_['intersection'](_0x163574[_0x95d4('0x48')],qs[_0x95d4('0x4d')](_0x489e5f[_0x95d4('0x49')]['fields']));_0x75615[_0x95d4('0x4e')]=_0x75615[_0x95d4('0x4e')][_0x95d4('0x5d')]?_0x75615['attributes']:_0x163574[_0x95d4('0x48')];if(!_0x489e5f['query'][_0x95d4('0x4f')](_0x95d4('0x50'))){_0x75615[_0x95d4('0x32')]=qs[_0x95d4('0x32')](_0x489e5f[_0x95d4('0x49')]['limit']);_0x75615['offset']=qs['offset'](_0x489e5f[_0x95d4('0x49')]['offset']);}_0x75615['order']=qs[_0x95d4('0x52')](_0x489e5f[_0x95d4('0x49')][_0x95d4('0x52')]);_0x75615['where']=qs[_0x95d4('0x4b')](_[_0x95d4('0x54')](_0x489e5f[_0x95d4('0x49')],_0x163574[_0x95d4('0x4b')]));_0x75615[_0x95d4('0x53')][_0x95d4('0x6a')]=_0x21be7['id'];if(_0x489e5f['query'][_0x95d4('0x55')]){_0x75615[_0x95d4('0x53')]=_['merge'](_0x75615[_0x95d4('0x53')],{'$or':_[_0x95d4('0x42')](_0x75615[_0x95d4('0x4e')],function(_0x518856){var _0x394fb2={};_0x394fb2[_0x518856]={'$like':'%'+_0x489e5f[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x394fb2;})});}_0x75615=_[_0x95d4('0x56')]({},_0x75615,_0x489e5f['options']);return db[_0x95d4('0x6f')][_0x95d4('0x58')]({'where':_0x75615[_0x95d4('0x53')]})[_0x95d4('0x21')](function(_0x23e849){_0x230b25['count']=_0x23e849;if(_0x489e5f[_0x95d4('0x49')][_0x95d4('0x59')]){_0x75615[_0x95d4('0x5a')]=[{'all':!![]}];}return db[_0x95d4('0x6f')][_0x95d4('0x6b')](_0x75615);})[_0x95d4('0x21')](function(_0x1173ad){_0x230b25[_0x95d4('0x5b')]=_0x1173ad;return _0x230b25;});}})[_0x95d4('0x21')](respondWithFilteredResult(_0x5f1929,_0x75615))[_0x95d4('0x2c')](handleError(_0x5f1929,null));};exports[_0x95d4('0x71')]=function(_0x489b94,_0x29936d,_0x5d970e){return db['FaxAccount'][_0x95d4('0x65')]({'where':{'id':_0x489b94['params']['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x29936d,null))[_0x95d4('0x21')](function(_0x4a7f56){if(_0x4a7f56){return _0x4a7f56[_0x95d4('0x71')](_0x489b94[_0x95d4('0x49')][_0x95d4('0x6d')]);}})[_0x95d4('0x21')](respondWithStatusCode(_0x29936d,null))[_0x95d4('0x2c')](handleError(_0x29936d,null));};exports[_0x95d4('0x72')]=function(_0x2561cd,_0x4631da,_0x33d756){return db[_0x95d4('0x73')]['find']({'where':{'id':_0x2561cd['params']['id']}})['then'](handleEntityNotFound(_0x4631da,null))['then'](function(_0x33d0c5){if(_0x33d0c5){return _0x33d0c5[_0x95d4('0x72')](_0x2561cd['body']['ids'],_[_0x95d4('0x74')](_0x2561cd[_0x95d4('0x64')],['ids','id'])||{});}})[_0x95d4('0x21')](respondWithResult(_0x4631da,null))[_0x95d4('0x2c')](handleError(_0x4631da,null));};exports['getInteractions']=function(_0x884e6d,_0x272f4b,_0x566763){var _0x1e19bf={'raw':![],'where':{}};var _0x4ae200={};var _0x50b5d7={'count':0x0,'rows':[]};return db[_0x95d4('0x43')][_0x95d4('0x70')]({'where':{'id':_0x884e6d['params']['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x272f4b,null))[_0x95d4('0x21')](function(_0x4b1063){if(_0x4b1063){_0x4ae200[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db['FaxInteraction'][_0x95d4('0x44')]);_0x4ae200[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x884e6d['query']);_0x4ae200[_0x95d4('0x4b')]=_[_0x95d4('0x4c')](_0x4ae200[_0x95d4('0x48')],_0x4ae200[_0x95d4('0x49')]);_0x1e19bf['attributes']=_['intersection'](_0x4ae200['model'],qs[_0x95d4('0x4d')](_0x884e6d[_0x95d4('0x49')][_0x95d4('0x4d')]));_0x1e19bf[_0x95d4('0x4e')]=_0x1e19bf[_0x95d4('0x4e')][_0x95d4('0x5d')]?_0x1e19bf[_0x95d4('0x4e')]:_0x4ae200[_0x95d4('0x48')];if(!_0x884e6d[_0x95d4('0x49')][_0x95d4('0x4f')](_0x95d4('0x50'))){_0x1e19bf[_0x95d4('0x32')]=qs[_0x95d4('0x32')](_0x884e6d[_0x95d4('0x49')][_0x95d4('0x32')]);_0x1e19bf[_0x95d4('0x31')]=qs[_0x95d4('0x31')](_0x884e6d['query'][_0x95d4('0x31')]);}_0x1e19bf[_0x95d4('0x51')]=qs[_0x95d4('0x52')](_0x884e6d[_0x95d4('0x49')][_0x95d4('0x52')]);_0x1e19bf['where']=qs['filters'](_[_0x95d4('0x54')](_0x884e6d[_0x95d4('0x49')],_0x4ae200[_0x95d4('0x4b')]));_0x1e19bf[_0x95d4('0x53')][_0x95d4('0x6a')]=_0x4b1063['id'];if(_0x884e6d[_0x95d4('0x49')]['filter']){_0x1e19bf[_0x95d4('0x53')]=_[_0x95d4('0x56')](_0x1e19bf['where'],{'$or':_[_0x95d4('0x42')](_0x1e19bf['attributes'],function(_0x3db43d){var _0x471791={};_0x471791[_0x3db43d]={'$like':'%'+_0x884e6d[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x471791;})});}_0x1e19bf=_[_0x95d4('0x56')]({},_0x1e19bf,_0x884e6d[_0x95d4('0x57')]);return db[_0x95d4('0x73')][_0x95d4('0x58')]({'where':_0x1e19bf[_0x95d4('0x53')]})[_0x95d4('0x21')](function(_0x94e84){_0x50b5d7[_0x95d4('0x58')]=_0x94e84;if(_0x884e6d['query'][_0x95d4('0x59')]){_0x1e19bf[_0x95d4('0x5a')]=[{'model':db[_0x95d4('0x75')],'as':'Contact','required':![]},{'model':db[_0x95d4('0x76')],'as':_0x95d4('0x77'),'attributes':[_0x95d4('0x3d'),_0x95d4('0x78'),'internal'],'required':![]},{'model':db[_0x95d4('0x79')],'as':_0x95d4('0x7a'),'attributes':['id',_0x95d4('0x3d'),_0x95d4('0x7b')],'where':_0x884e6d[_0x95d4('0x49')][_0x95d4('0x7c')]?{'id':_0x884e6d['query'][_0x95d4('0x7c')]}:undefined,'required':_0x884e6d['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0x95d4('0x6b')](_0x1e19bf);})[_0x95d4('0x21')](function(_0x3da525){_0x50b5d7['rows']=_0x3da525;return _0x50b5d7;});}})[_0x95d4('0x21')](respondWithFilteredResult(_0x272f4b,_0x1e19bf))['catch'](handleError(_0x272f4b,null));};exports['addApplications']=function(_0x587906,_0x94a89c){var _0x21818a=_0x587906['params']['id'];var _0xd2a491=_0x587906['body'];var _0x367b37=0xc8;var _0x42002e=null;return db[_0x95d4('0x7d')]['transaction']({'isolationLevel':db['sequelize'][_0x95d4('0x7e')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x55404f){return db[_0x95d4('0x43')][_0x95d4('0x70')]({'where':{'id':_0x21818a},'transaction':_0x55404f})['then'](function(_0x106cfb){if(_0x106cfb){return db[_0x95d4('0x7f')]['destroy']({'where':{'FaxAccountId':_0x21818a},'transaction':_0x55404f})[_0x95d4('0x21')](function(){var _0x165af0=_['map'](_0xd2a491,function(_0x1c4650){_0x1c4650[_0x95d4('0x6a')]=_0x21818a;return _0x1c4650;});return db[_0x95d4('0x7f')]['bulkCreate'](_0x165af0,{'transaction':_0x55404f});});}else{_0x367b37=0x194;_0x42002e=[];}});})[_0x95d4('0x21')](function(){if(_0x367b37!==0x194){return db[_0x95d4('0x7f')][_0x95d4('0x80')]({'where':{'FaxAccountId':_0x21818a},'order':_0x95d4('0x81')})['then'](function(_0x48180e){_0x42002e=_0x48180e;});}})[_0x95d4('0x2c')](function(_0x499e78){_0x367b37=0x1f4;logger['error'](_0x499e78[_0x95d4('0x3c')]);if(_0x499e78[_0x95d4('0x3d')]){delete _0x499e78[_0x95d4('0x3d')];}_0x42002e=_0x499e78;})[_0x95d4('0x82')](function(){if(_0x42002e===null){_0x94a89c[_0x95d4('0x2d')](_0x367b37);}else{if(_0x367b37===0x1f4){_0x94a89c[_0x95d4('0x2f')](_0x367b37)[_0x95d4('0x3e')](_0x42002e);}else{_0x94a89c[_0x95d4('0x2f')](_0x367b37)[_0x95d4('0x30')](_0x42002e);}}});};exports[_0x95d4('0x83')]=function(_0x1d4069,_0x50cc4c,_0x3f738c){var _0x2deb3e={};var _0x43490e={};var _0x5551a3;var _0x103dc0;return db[_0x95d4('0x43')][_0x95d4('0x70')]({'where':{'id':_0x1d4069[_0x95d4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x50cc4c,null))['then'](function(_0x1b4ddd){if(_0x1b4ddd){_0x5551a3=_0x1b4ddd;_0x43490e[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db[_0x95d4('0x7f')][_0x95d4('0x44')]);_0x43490e[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x1d4069[_0x95d4('0x49')]);_0x43490e[_0x95d4('0x4b')]=_[_0x95d4('0x4c')](_0x43490e[_0x95d4('0x48')],_0x43490e[_0x95d4('0x49')]);_0x2deb3e['attributes']=_[_0x95d4('0x4c')](_0x43490e[_0x95d4('0x48')],qs[_0x95d4('0x4d')](_0x1d4069[_0x95d4('0x49')][_0x95d4('0x4d')]));_0x2deb3e[_0x95d4('0x4e')]=_0x2deb3e[_0x95d4('0x4e')][_0x95d4('0x5d')]?_0x2deb3e['attributes']:_0x43490e[_0x95d4('0x48')];_0x2deb3e['order']=qs['sort'](_0x1d4069['query']['sort']);_0x2deb3e[_0x95d4('0x53')]=qs[_0x95d4('0x4b')](_['pick'](_0x1d4069[_0x95d4('0x49')],_0x43490e['filters']));if(_0x1d4069['query']['filter']){_0x2deb3e['where']=_[_0x95d4('0x56')](_0x2deb3e['where'],{'$or':_[_0x95d4('0x42')](_0x2deb3e[_0x95d4('0x4e')],function(_0x4082cb){var _0x366524={};_0x366524[_0x4082cb]={'$like':'%'+_0x1d4069['query'][_0x95d4('0x55')]+'%'};return _0x366524;})});}_0x2deb3e=_['merge']({},_0x2deb3e,_0x1d4069[_0x95d4('0x57')]);return _0x5551a3[_0x95d4('0x83')](_0x2deb3e);}})[_0x95d4('0x21')](function(_0x56b954){if(_0x56b954){_0x103dc0=_0x56b954[_0x95d4('0x5d')];if(!_0x1d4069[_0x95d4('0x49')][_0x95d4('0x4f')](_0x95d4('0x50'))){_0x2deb3e['limit']=qs[_0x95d4('0x32')](_0x1d4069[_0x95d4('0x49')][_0x95d4('0x32')]);_0x2deb3e[_0x95d4('0x31')]=qs[_0x95d4('0x31')](_0x1d4069['query']['offset']);}return _0x5551a3[_0x95d4('0x83')](_0x2deb3e);}})['then'](function(_0x1c3f77){if(_0x1c3f77){return _0x1c3f77?{'count':_0x103dc0,'rows':_0x1c3f77}:null;}})['then'](respondWithResult(_0x50cc4c,null))[_0x95d4('0x2c')](handleError(_0x50cc4c,null));};function Extension(_0x37a9a0,_0x801d86,_0x4570aa,_0x1e2661){this[_0x95d4('0x84')]=_0x95d4('0x85');this[_0x95d4('0x86')]=_0x37a9a0['localstationid'];this['app']=_0x1e2661;this[_0x95d4('0x46')]='system';this[_0x95d4('0x87')]=_0x95d4('0x88');this[_0x95d4('0x6a')]=_0x37a9a0['id'];this[_0x95d4('0x81')]=_0x801d86;this['appdata']=_0x4570aa;}function createExtensionsReciveFax(_0x5d9d1e){var _0x1c014e=0x1;var _0x1ad8d9=[];_0x1ad8d9[_0x95d4('0x89')](new Extension(_0x5d9d1e,_0x1c014e,'',_0x95d4('0x8a')));_0x1c014e+=0x1;_0x1ad8d9[_0x95d4('0x89')](new Extension(_0x5d9d1e,_0x1c014e,_0x95d4('0x8b'),_0x95d4('0x8c')));_0x1c014e+=0x1;for(var _0x20ca26 in _0x5d9d1e){if(_0x5d9d1e['hasOwnProperty'](_0x20ca26)&&(_0x20ca26===_0x95d4('0x8d')||_0x20ca26===_0x95d4('0x8e')||_0x20ca26===_0x95d4('0x8f')||_0x20ca26===_0x95d4('0x90')||_0x20ca26===_0x95d4('0x91')||_0x20ca26===_0x95d4('0x92')||_0x20ca26===_0x95d4('0x93')||_0x20ca26===_0x95d4('0x94')||_0x20ca26===_0x95d4('0x95'))){_0x1ad8d9[_0x95d4('0x89')](new Extension(_0x5d9d1e,_0x1c014e,'FAXOPT('+_0x20ca26+')='+_0x5d9d1e[_0x20ca26],_0x95d4('0x8c')));_0x1c014e+=0x1;}}_0x1ad8d9['push'](new Extension(_0x5d9d1e,_0x1c014e,'6',_0x95d4('0x96')));_0x1c014e+=0x1;_0x1ad8d9[_0x95d4('0x89')](new Extension(_0x5d9d1e,_0x1c014e,_0x95d4('0x97'),_0x95d4('0x98')));_0x1c014e=0x0;return _0x1ad8d9;}exports[_0x95d4('0x99')]=function(_0x2b573c,_0x435b0e,_0x3c234e){var _0x149bc1;return db[_0x95d4('0x7d')]['transaction'](function(_0xa965f7){return db['FaxAccount']['create'](_0x2b573c[_0x95d4('0x64')],{'transaction':_0xa965f7})['then'](function(_0x5eae33){_0x149bc1=_0x5eae33[_0x95d4('0x3a')]({'plain':!![]});return db[_0x95d4('0x9a')][_0x95d4('0x9b')](createExtensionsReciveFax(_0x149bc1),{'transaction':_0xa965f7});});})[_0x95d4('0x21')](function(){return _0x149bc1;})[_0x95d4('0x21')](respondWithResult(_0x435b0e,null))[_0x95d4('0x2c')](handleError(_0x435b0e,null));};exports[_0x95d4('0x9c')]=function(_0x127a6c,_0x163f62,_0x4356ee){var _0x379ea4;return db[_0x95d4('0x7d')][_0x95d4('0x9d')](function(_0x2ffcc2){return db[_0x95d4('0x43')][_0x95d4('0x38')](_0x127a6c['body'],{'where':{'id':_0x127a6c[_0x95d4('0x64')]['id']},'transaction':_0x2ffcc2})[_0x95d4('0x21')](function(_0x5d43f6){return db[_0x95d4('0x9a')][_0x95d4('0x39')]({'where':{'FaxAccountId':_0x127a6c[_0x95d4('0x64')]['id']},'transaction':_0x2ffcc2})['then'](function(_0x286b99){return db['VoiceExtension'][_0x95d4('0x9b')](createExtensionsReciveFax(_['omit'](_0x127a6c[_0x95d4('0x64')],[_0x95d4('0x9e'),'key',_0x95d4('0x9f'),_0x95d4('0xa0'),_0x95d4('0xa1'),_0x95d4('0xa2')])),{'transaction':_0x2ffcc2});});});})[_0x95d4('0x21')](function(){return db[_0x95d4('0x43')][_0x95d4('0xa3')](_0x127a6c['body']['id']);})[_0x95d4('0x21')](respondWithResult(_0x163f62,null))[_0x95d4('0x2c')](handleError(_0x163f62,null));};exports[_0x95d4('0xa4')]=function(_0x23056b,_0x4ed131,_0x461758){var _0x3e375f={'raw':!![],'where':{}};var _0xb241c5={};var _0x1b3ffd={'count':0x0,'rows':[]};return db[_0x95d4('0x43')][_0x95d4('0x70')]({'where':{'id':_0x23056b[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x4ed131,null))[_0x95d4('0x21')](function(_0x4c1858){if(_0x4c1858){_0xb241c5[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db[_0x95d4('0xa5')][_0x95d4('0x44')]);_0xb241c5[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x23056b[_0x95d4('0x49')]);_0xb241c5[_0x95d4('0x4b')]=_[_0x95d4('0x4c')](_0xb241c5['model'],_0xb241c5[_0x95d4('0x49')]);_0x3e375f['attributes']=_[_0x95d4('0x4c')](_0xb241c5[_0x95d4('0x48')],qs[_0x95d4('0x4d')](_0x23056b[_0x95d4('0x49')]['fields']));_0x3e375f[_0x95d4('0x4e')]=_0x3e375f[_0x95d4('0x4e')]['length']?_0x3e375f[_0x95d4('0x4e')]:_0xb241c5['model'];if(!_0x23056b[_0x95d4('0x49')][_0x95d4('0x4f')]('nolimit')){_0x3e375f[_0x95d4('0x32')]=qs[_0x95d4('0x32')](_0x23056b['query'][_0x95d4('0x32')]);_0x3e375f[_0x95d4('0x31')]=qs[_0x95d4('0x31')](_0x23056b['query']['offset']);}_0x3e375f['order']=qs[_0x95d4('0x52')](_0x23056b[_0x95d4('0x49')][_0x95d4('0x52')]);_0x3e375f[_0x95d4('0x53')]=qs[_0x95d4('0x4b')](_[_0x95d4('0x54')](_0x23056b['query'],_0xb241c5[_0x95d4('0x4b')]));_0x3e375f[_0x95d4('0x53')]['FaxAccountId']=_0x4c1858['id'];if(_0x23056b[_0x95d4('0x49')][_0x95d4('0x55')]){_0x3e375f[_0x95d4('0x53')]=_['merge'](_0x3e375f[_0x95d4('0x53')],{'$or':_[_0x95d4('0x42')](_0x3e375f['attributes'],function(_0x300d35){var _0x4d8c74={};_0x4d8c74[_0x300d35]={'$like':'%'+_0x23056b[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x4d8c74;})});}if(_0x23056b['query'][_0x95d4('0xa6')]){var _0xa0b2=_0x23056b[_0x95d4('0x49')][_0x95d4('0xa6')][_0x95d4('0xa7')](',');var _0x548a21={};_0x548a21[_0xa0b2[0x0]]={'$gte':moment(_0xa0b2[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3e375f[_0x95d4('0x53')]=_['merge'](_0x3e375f[_0x95d4('0x53')],_0x548a21);}_0x3e375f=_[_0x95d4('0x56')]({},_0x3e375f,_0x23056b['options']);return db['FaxMessage'][_0x95d4('0x58')]({'where':_0x3e375f[_0x95d4('0x53')]})[_0x95d4('0x21')](function(_0x4cbdb5){_0x1b3ffd[_0x95d4('0x58')]=_0x4cbdb5;if(_0x23056b[_0x95d4('0x49')]['includeAll']){_0x3e375f[_0x95d4('0x5a')]=[{'all':!![]}];}return db[_0x95d4('0xa5')]['findAll'](_0x3e375f);})[_0x95d4('0x21')](function(_0x6691bd){_0x1b3ffd['rows']=_0x6691bd;return _0x1b3ffd;});}})[_0x95d4('0x21')](respondWithFilteredResult(_0x4ed131,_0x3e375f))[_0x95d4('0x2c')](handleError(_0x4ed131,null));};exports[_0x95d4('0x3e')]=function(_0x3b3615,_0x4c0884,_0x3337fd){var _0x3b37d3,_0xdf2ce={},_0x51c64e;if(_0x3b3615[_0x95d4('0x64')]['to']){_0x51c64e=_0x3b3615[_0x95d4('0x64')]['to'][0x0];}return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x3b3615[_0x95d4('0x5c')]['id']},'include':[{'model':db[_0x95d4('0xa8')],'as':_0x95d4('0xa9'),'include':[{'model':db[_0x95d4('0x75')],'as':_0x95d4('0xaa'),'where':{'fax':_0x51c64e},'limit':0x1,'order':[[_0x95d4('0xa0'),_0x95d4('0xab')]]}]}]})[_0x95d4('0x21')](handleEntityNotFound(_0x4c0884,null))['then'](function(_0x33ad2d){_0x3b37d3=_0x33ad2d;if(_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')]&&_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')]['length']){for(var _0x3121bd=0x0;_0x3121bd<_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')]['length'];_0x3121bd+=0x1){_0x3b3615[_0x95d4('0x64')]['attachments'][_0x3121bd]={'filename':_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][_0x3121bd][_0x95d4('0x3d')],'id':_0x3b3615[_0x95d4('0x64')]['attachments'][_0x3121bd]['id'],'path':path[_0x95d4('0xad')](config[_0x95d4('0xae')],_0x95d4('0xaf'),_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][_0x3121bd][_0x95d4('0xb0')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x95d4('0xb1')](_0x3b3615[_0x95d4('0x5c')]['id'])?undefined:_0x3b3615['params']['id'],'path':_[_0x95d4('0xb1')](_0x3b3615[_0x95d4('0x64')]['attachments'][0x0][_0x95d4('0xb2')])?undefined:_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0]['path'],'fax':_['isNil'](_0x3b3615[_0x95d4('0x64')]['to'][0x0])?undefined:_0x3b3615[_0x95d4('0x64')]['to'][0x0]},client9002);})[_0x95d4('0x21')](function(){if(_0x3b37d3){if(_['isNil'](_0x3b3615['body'][_0x95d4('0xb3')])){_0x3b3615[_0x95d4('0x64')]['from']=util[_0x95d4('0xb4')](_0x95d4('0xb5'),_0x3b37d3['name'],_0x3b37d3[_0x95d4('0xb6')]);}if(_0x3b37d3['List']){if(_0x3b37d3['List'][_0x95d4('0xaa')][_0x95d4('0x5d')]){return _0x3b37d3['List'][_0x95d4('0xaa')][0x0];}else{return db[_0x95d4('0x75')][_0x95d4('0x5e')](_[_0x95d4('0x18')](_0x3b3615[_0x95d4('0x64')],{'firstName':_0x3b3615[_0x95d4('0x64')]['to'][0x0],'phone':_0x3b3615['body']['to'][0x0],'fax':_0x3b3615[_0x95d4('0x64')]['to'][0x0],'ListId':_0x3b37d3[_0x95d4('0xa2')]}));}}else{throw new Error(_0x95d4('0xb7'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x95d4('0x21')](function(_0x29082c){if(_0x29082c){return db['FaxInteraction'][_0x95d4('0x65')]({'where':{'ContactId':_0x29082c['id'],'closed':![],'FaxAccountId':_0x3b37d3['id']}})[_0x95d4('0x21')](function(_0xaeb33e){if(_0xaeb33e){return[_0xaeb33e,![]];}return db[_0x95d4('0x73')][_0x95d4('0x5e')]({'UserId':_0x3b3615[_0x95d4('0x5f')]['id'],'ContactId':_0x29082c['id'],'FaxAccountId':_0x3b37d3['id'],'fax':_0x3b3615[_0x95d4('0x64')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x3b3615[_0x95d4('0x64')],{'read':![],'body':_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0][_0x95d4('0xb8')],'FaxAccountId':_0x3b37d3['id'],'UserId':_0x3b3615[_0x95d4('0x5f')]['id'],'ContactId':_0x29082c['id'],'AttachmentId':_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x95d4('0xa5')],'as':_0x95d4('0xb9')}]})[_0x95d4('0x21')](function(_0x2d94fa){return[_0x2d94fa,!![]];});});}else{throw new Error(_0x95d4('0xba'));}})[_0x95d4('0xbb')](function(_0x3c1aad,_0x4c17fc){if(_0x4c17fc){return _0x3c1aad;}return db['FaxMessage'][_0x95d4('0x5e')]({'direction':_0x95d4('0xbc'),'read':![],'body':_0x3b3615[_0x95d4('0x64')]['attachments'][0x0]['filename'],'FaxAccountId':_0x3b37d3['id'],'FaxInteractionId':_0x3c1aad['id'],'UserId':_0x3b3615[_0x95d4('0x5f')]['id'],'ContactId':_0x3c1aad[_0x95d4('0xbd')],'AttachmentId':_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0]['id']})[_0x95d4('0x21')](function(_0x5043fb){_0x3c1aad['dataValues'][_0x95d4('0xb9')]=[];_0x3c1aad['dataValues']['Messages'][_0x95d4('0x89')](_0x5043fb[_0x95d4('0xbe')]);return _0x3c1aad;});})[_0x95d4('0x21')](function(_0x4dfb54){respondWithRpcPromise('SendFax',_0x95d4('0xbf'),{'FaxAccountId':_['isNil'](_0x3b3615[_0x95d4('0x5c')]['id'])?undefined:_0x3b3615['params']['id'],'path':_['isNil'](_0x3b3615['body']['attachments'][0x0][_0x95d4('0xb2')])?undefined:_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0][_0x95d4('0xb2')],'fax':_['isNil'](_0x3b3615[_0x95d4('0x64')]['to'][0x0])?undefined:_0x3b3615[_0x95d4('0x64')]['to'][0x0],'AttachmentId':_0x3b3615[_0x95d4('0x64')][_0x95d4('0xac')][0x0]['id']},client9002)[_0x95d4('0x21')](function(_0x5ba0e1){logger[_0x95d4('0x2a')](_0x95d4('0xc0'),_0x5ba0e1);})[_0x95d4('0x2c')](function(_0x5888b2){logger[_0x95d4('0x2a')]('SendFaxRpc,\x20%s',_0x5888b2);});return _0x4dfb54;})[_0x95d4('0x21')](respondWithResult(_0x4c0884,null))[_0x95d4('0x2c')](handleError(_0x4c0884,null));};exports['addAgents']=function(_0x1f1ea1,_0x2882bc,_0x13a0ab){return db['FaxAccount']['find']({'where':{'id':_0x1f1ea1[_0x95d4('0x5c')]['id']}})[_0x95d4('0x21')](handleEntityNotFound(_0x2882bc,null))[_0x95d4('0x21')](function(_0x2e9c83){if(_0x2e9c83){return _0x2e9c83[_0x95d4('0xc1')](_0x1f1ea1['body'][_0x95d4('0x6d')],_[_0x95d4('0x74')](_0x1f1ea1[_0x95d4('0x64')],['ids','id'])||{})[_0x95d4('0xbb')](function(_0x452462){for(var _0xe9bac2=0x0;_0xe9bac2<_0x1f1ea1[_0x95d4('0x64')][_0x95d4('0x6d')][_0x95d4('0x5d')];_0xe9bac2+=0x1){socket['emit'](_0x95d4('0xc2'),{'UserId':Number(_0x1f1ea1[_0x95d4('0x64')]['ids'][_0xe9bac2]),'FaxAccountId':Number(_0x1f1ea1[_0x95d4('0x5c')]['id'])});}return _0x452462;});}})[_0x95d4('0x21')](respondWithResult(_0x2882bc,null))[_0x95d4('0x2c')](handleError(_0x2882bc,null));};exports[_0x95d4('0xc3')]=function(_0x24c44a,_0x5276dc,_0x53c160){return db[_0x95d4('0x43')][_0x95d4('0x65')]({'where':{'id':_0x24c44a[_0x95d4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5276dc,null))[_0x95d4('0x21')](function(_0x177bf0){if(_0x177bf0){return _0x177bf0[_0x95d4('0xc3')](_0x24c44a[_0x95d4('0x49')][_0x95d4('0x6d')])[_0x95d4('0x21')](function(){if(_[_0x95d4('0xc4')](_0x24c44a['query'][_0x95d4('0x6d')])){for(var _0x4b9ee7=0x0;_0x4b9ee7<_0x24c44a[_0x95d4('0x49')][_0x95d4('0x6d')][_0x95d4('0x5d')];_0x4b9ee7+=0x1){socket[_0x95d4('0xc5')](_0x95d4('0xc6'),{'UserId':Number(_0x24c44a[_0x95d4('0x49')][_0x95d4('0x6d')][_0x4b9ee7]),'FaxAccountId':Number(_0x24c44a['params']['id'])});}}else{socket[_0x95d4('0xc5')]('userFaxAccount:remove',{'UserId':Number(_0x24c44a['query'][_0x95d4('0x6d')]),'FaxAccountId':Number(_0x24c44a[_0x95d4('0x5c')]['id'])});}});}})[_0x95d4('0x21')](respondWithStatusCode(_0x5276dc,null))[_0x95d4('0x2c')](handleError(_0x5276dc,null));};exports[_0x95d4('0xc7')]=function(_0x2a1c26,_0x55791a,_0x486f54){var _0x443961={};var _0x17266d={};var _0x240f89;var _0x5cef1f;return db['FaxAccount'][_0x95d4('0x70')]({'where':{'id':_0x2a1c26[_0x95d4('0x5c')]['id']}})['then'](handleEntityNotFound(_0x55791a,null))[_0x95d4('0x21')](function(_0x51b78a){if(_0x51b78a){_0x240f89=_0x51b78a;_0x17266d[_0x95d4('0x48')]=_[_0x95d4('0x4a')](db[_0x95d4('0x76')][_0x95d4('0x44')]);_0x17266d[_0x95d4('0x49')]=_[_0x95d4('0x4a')](_0x2a1c26[_0x95d4('0x49')]);_0x17266d[_0x95d4('0x4b')]=_['intersection'](_0x17266d[_0x95d4('0x48')],_0x17266d['query']);_0x443961['attributes']=_[_0x95d4('0x4c')](_0x17266d['model'],qs[_0x95d4('0x4d')](_0x2a1c26[_0x95d4('0x49')][_0x95d4('0x4d')]));_0x443961[_0x95d4('0x4e')]=_0x443961['attributes'][_0x95d4('0x5d')]?_0x443961[_0x95d4('0x4e')]:_0x17266d['model'];_0x443961[_0x95d4('0x51')]=qs[_0x95d4('0x52')](_0x2a1c26[_0x95d4('0x49')][_0x95d4('0x52')]);_0x443961[_0x95d4('0x53')]=qs[_0x95d4('0x4b')](_[_0x95d4('0x54')](_0x2a1c26['query'],_0x17266d[_0x95d4('0x4b')]));if(_0x2a1c26[_0x95d4('0x49')]['filter']){_0x443961[_0x95d4('0x53')]=_[_0x95d4('0x56')](_0x443961['where'],{'$or':_[_0x95d4('0x42')](_0x443961[_0x95d4('0x4e')],function(_0x2ae7c3){var _0x4d345d={};_0x4d345d[_0x2ae7c3]={'$like':'%'+_0x2a1c26[_0x95d4('0x49')][_0x95d4('0x55')]+'%'};return _0x4d345d;})});}_0x443961=_['merge']({},_0x443961,_0x2a1c26[_0x95d4('0x57')]);return _0x240f89[_0x95d4('0xc7')](_0x443961);}})[_0x95d4('0x21')](function(_0x5adf0f){if(_0x5adf0f){_0x5cef1f=_0x5adf0f[_0x95d4('0x5d')];if(!_0x2a1c26[_0x95d4('0x49')][_0x95d4('0x4f')]('nolimit')){_0x443961[_0x95d4('0x32')]=qs[_0x95d4('0x32')](_0x2a1c26[_0x95d4('0x49')]['limit']);_0x443961['offset']=qs[_0x95d4('0x31')](_0x2a1c26[_0x95d4('0x49')][_0x95d4('0x31')]);}return _0x240f89[_0x95d4('0xc7')](_0x443961);}})[_0x95d4('0x21')](function(_0x4ce1b2){if(_0x4ce1b2){return _0x4ce1b2?{'count':_0x5cef1f,'rows':_0x4ce1b2}:null;}})['then'](respondWithResult(_0x55791a,null))[_0x95d4('0x2c')](handleError(_0x55791a,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e80a407..c962967 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 _0xf0ad=['save','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x3779e6,_0x324e85){var _0x1d73b8=function(_0x10c8df){while(--_0x10c8df){_0x3779e6['push'](_0x3779e6['shift']());}};_0x1d73b8(++_0x324e85);}(_0xf0ad,0x9c));var _0xdf0a=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xf0ad[_0x38537f];return _0x141e23;};'use strict';var EventEmitter=require(_0xdf0a('0x0'));var FaxAccount=require(_0xdf0a('0x1'))['db'][_0xdf0a('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdf0a('0x3')](0x0);var events={'afterCreate':_0xdf0a('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x205285){return function(_0x4fba4b,_0x4de225,_0x55f9cc){FaxAccountEvents[_0xdf0a('0x5')](_0x205285+':'+_0x4fba4b['id'],_0x4fba4b);FaxAccountEvents[_0xdf0a('0x5')](_0x205285,_0x4fba4b);_0x55f9cc(null);};}for(var e in events){if(events[_0xdf0a('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xdf0a('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x847f=['hook','exports','events','../../mysqldb','setMaxListeners','save','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x847f,0xb8));var _0xf847=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0x847f[_0x3ccac1];return _0x10b20b;};'use strict';var EventEmitter=require(_0xf847('0x0'));var FaxAccount=require(_0xf847('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xf847('0x2')](0x0);var events={'afterCreate':_0xf847('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x50e00b){return function(_0x8d0a9c,_0x4fe7b9,_0x3299b1){FaxAccountEvents['emit'](_0x50e00b+':'+_0x8d0a9c['id'],_0x8d0a9c);FaxAccountEvents['emit'](_0x50e00b,_0x8d0a9c);_0x3299b1(null);};}for(var e in events){if(events[_0xf847('0x4')](e)){var event=events[e];FaxAccount[_0xf847('0x5')](e,emitEvent(event));}}module[_0xf847('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9003cf4..acd09ff 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 _0x909d=['api','moment','request-promise','path','./faxAccount.attributes','FaxAccount','fax_accounts','lodash','util'];(function(_0x16dc10,_0x38e533){var _0x4490bd=function(_0x228b54){while(--_0x228b54){_0x16dc10['push'](_0x16dc10['shift']());}};_0x4490bd(++_0x38e533);}(_0x909d,0x15d));var _0xd909=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x909d[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var logger=require('../../config/logger')(_0xd909('0x2'));var moment=require(_0xd909('0x3'));var BPromise=require('bluebird');var rp=require(_0xd909('0x4'));var fs=require('fs');var path=require(_0xd909('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd909('0x6'));module['exports']=function(_0x12a2f7,_0x58eabe){return _0x12a2f7['define'](_0xd909('0x7'),attributes,{'tableName':_0xd909('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4330=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0x4e4d88,_0x34490c){var _0x51bad9=function(_0x2c2142){while(--_0x2c2142){_0x4e4d88['push'](_0x4e4d88['shift']());}};_0x51bad9(++_0x34490c);}(_0x4330,0xde));var _0x0433=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4330[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0433('0x0'));var util=require(_0x0433('0x1'));var logger=require(_0x0433('0x2'))(_0x0433('0x3'));var moment=require(_0x0433('0x4'));var BPromise=require(_0x0433('0x5'));var rp=require(_0x0433('0x6'));var fs=require('fs');var path=require(_0x0433('0x7'));var rimraf=require(_0x0433('0x8'));var config=require(_0x0433('0x9'));var attributes=require(_0x0433('0xa'));module[_0x0433('0xb')]=function(_0x54f867,_0x10e41d){return _0x54f867[_0x0433('0xc')](_0x0433('0xd'),attributes,{'tableName':_0x0433('0xe'),'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 8cf6880..1e79b5c 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 _0xfc72=['from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','account','list','applications','orderBy','priority','asc','ListId','create','contact','fax','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','options','raw','where','attributes','limit','include','map','model','then','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','CompanyId','body','isNil','from','Sequelize'];(function(_0xad53e5,_0x3b18e5){var _0x21fa73=function(_0x6f0607){while(--_0x6f0607){_0xad53e5['push'](_0xad53e5['shift']());}};_0x21fa73(++_0x3b18e5);}(_0xfc72,0x1ed));var _0x2fc7=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0xfc72[_0x5f0501];return _0x3c2c45;};'use strict';var _=require(_0x2fc7('0x0'));var util=require(_0x2fc7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2fc7('0x2'));var fs=require('fs');var Redis=require(_0x2fc7('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fc7('0x4'));var logger=require(_0x2fc7('0x5'))(_0x2fc7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2fc7('0x7')][_0x2fc7('0x8')]({'port':0x232c});config['redis']=_[_0x2fc7('0x9')](config[_0x2fc7('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2fc7('0xb'))(new Redis(config[_0x2fc7('0xa')]));require(_0x2fc7('0xc'))[_0x2fc7('0xd')](socket);function respondWithRpcPromise(_0x15517a,_0x2962df,_0x4a927a){return new BPromise(function(_0x1315f1,_0x43bc41){return client[_0x2fc7('0xe')](_0x15517a,_0x4a927a)['then'](function(_0x326f38){logger[_0x2fc7('0xf')](_0x2fc7('0x10'),_0x2962df,'request\x20sent');logger[_0x2fc7('0x11')](_0x2fc7('0x12'),_0x2962df,_0x2fc7('0x13'),JSON[_0x2fc7('0x14')](_0x326f38));if(_0x326f38[_0x2fc7('0x15')]){if(_0x326f38[_0x2fc7('0x15')][_0x2fc7('0x16')]===0x1f4){logger['error'](_0x2fc7('0x10'),_0x2962df,_0x326f38[_0x2fc7('0x15')][_0x2fc7('0x17')]);return _0x43bc41(_0x326f38['error'][_0x2fc7('0x17')]);}logger[_0x2fc7('0x15')]('FaxAccount,\x20%s,\x20%s',_0x2962df,_0x326f38[_0x2fc7('0x15')][_0x2fc7('0x17')]);return _0x1315f1(_0x326f38[_0x2fc7('0x15')]['message']);}else{logger['info'](_0x2fc7('0x10'),_0x2962df,_0x2fc7('0x13'));_0x1315f1(_0x326f38[_0x2fc7('0x18')][_0x2fc7('0x17')]);}})['catch'](function(_0x532a6b){logger[_0x2fc7('0x15')](_0x2fc7('0x10'),_0x2962df,_0x532a6b);_0x43bc41(_0x532a6b);});});}exports[_0x2fc7('0x19')]=function(_0x1d0a50){var _0x19af55=this;return new Promise(function(_0x1e5379,_0x4f2668){return db['FaxAccount']['findAll']({'raw':_0x1d0a50['options']?_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d0a50[_0x2fc7('0x1a')]?_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1c')]||null:null,'attributes':_0x1d0a50[_0x2fc7('0x1a')]?_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1d')]||null:null,'limit':_0x1d0a50['options']?_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1e')]||null:null,'include':_0x1d0a50['options']?_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1f')]?_[_0x2fc7('0x20')](_0x1d0a50[_0x2fc7('0x1a')][_0x2fc7('0x1f')],function(_0x48e9c8){return{'model':db[_0x48e9c8[_0x2fc7('0x21')]],'as':_0x48e9c8['as'],'attributes':_0x48e9c8[_0x2fc7('0x1d')],'include':_0x48e9c8[_0x2fc7('0x1f')]?_[_0x2fc7('0x20')](_0x48e9c8[_0x2fc7('0x1f')],function(_0x2d0d48){return{'model':db[_0x2d0d48[_0x2fc7('0x21')]],'as':_0x2d0d48['as'],'attributes':_0x2d0d48[_0x2fc7('0x1d')],'include':_0x2d0d48[_0x2fc7('0x1f')]?_[_0x2fc7('0x20')](_0x2d0d48[_0x2fc7('0x1f')],function(_0x2d4f65){return{'model':db[_0x2d4f65[_0x2fc7('0x21')]],'as':_0x2d4f65['as'],'attributes':_0x2d4f65['attributes']};}):[]};}):[]};}):[]:[]})[_0x2fc7('0x22')](function(_0x22808c){logger[_0x2fc7('0xf')](_0x2fc7('0x19'),_0x1d0a50);logger[_0x2fc7('0x11')]('GetFaxAccount',_0x1d0a50,JSON[_0x2fc7('0x14')](_0x22808c));_0x1e5379(_0x22808c);})['catch'](function(_0x12aeda){logger[_0x2fc7('0x15')](_0x2fc7('0x19'),_0x12aeda[_0x2fc7('0x17')],_0x1d0a50);_0x4f2668(_0x19af55[_0x2fc7('0x15')](0x1f4,_0x12aeda[_0x2fc7('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x25af18,_0x103c7e,_0x458003){var _0x102269=this;return new Promise(function(_0x497ea7,_0x1dd09a){var _0x363d5c={'body':_0x25af18['body'],'channel':'fax'};var _0x2fa833=[];var _0x4893bc=[];var _0x210db4={};return db[_0x2fc7('0x23')][_0x2fc7('0x24')]()[_0x2fc7('0x22')](function(_0x498517){if(!_0x498517){throw new db['Sequelize'][(_0x2fc7('0x25'))](_0x2fc7('0x26'));}_0x2fa833=_[_0x2fc7('0x27')](_['keys'](_0x498517),['createdAt','updatedAt']);_0x4893bc=_[_0x2fc7('0x27')](_[_0x2fc7('0x28')](_0x498517),[_0x2fc7('0x29'),'updatedAt',_0x2fc7('0x2a'),'ListId']);if(_0x25af18['body']['id']){delete _0x25af18[_0x2fc7('0x2b')]['id'];}if(_[_0x2fc7('0x2c')](_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2d')])){throw new db[(_0x2fc7('0x2e'))][(_0x2fc7('0x25'))](_0x2fc7('0x2f'));}if(_['isNil'](_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2b')])||_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2b')]===''){throw new db[(_0x2fc7('0x2e'))]['ValidationError'](_0x2fc7('0x30'));}if(_['isNil'](_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x31')])){throw new db[(_0x2fc7('0x2e'))][(_0x2fc7('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4893bc);}if(!_[_0x2fc7('0x32')](_0x4893bc,_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x31')])){throw new db[(_0x2fc7('0x2e'))]['ValidationError'](_0x2fc7('0x33')+_0x4893bc);}_0x210db4[_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x31')]]=_0x25af18[_0x2fc7('0x2b')]['from'];})[_0x2fc7('0x22')](function(){return db[_0x2fc7('0x34')][_0x2fc7('0x35')]({'where':{'id':_0x25af18['account']['id']},'include':[{'model':db['CmList'],'as':_0x2fc7('0x36'),'include':[{'model':db[_0x2fc7('0x23')],'as':_0x2fc7('0x37'),'where':_0x210db4,'limit':0x1,'order':[[_0x2fc7('0x38'),_0x2fc7('0x39')]]}]},{'model':db[_0x2fc7('0x3a')],'as':_0x2fc7('0x3b')}]});})[_0x2fc7('0x22')](function(_0x113978){if(_0x113978&&_0x113978[_0x2fc7('0x36')]){var _0x14c9ba=_0x113978[_0x2fc7('0x3c')]({'plain':!![]});_0x363d5c[_0x2fc7('0x3d')]=_0x14c9ba;_0x363d5c['applications']=_0x14c9ba[_0x2fc7('0x3b')];_0x363d5c[_0x2fc7('0x3e')]=_0x14c9ba[_0x2fc7('0x36')];_0x363d5c[_0x2fc7('0x3f')]=_[_0x2fc7('0x40')](_0x363d5c[_0x2fc7('0x3f')],[_0x2fc7('0x41')],[_0x2fc7('0x42')]);if(_0x363d5c['account'][_0x2fc7('0x3b')]){delete _0x363d5c[_0x2fc7('0x3d')][_0x2fc7('0x3b')];}if(_0x363d5c[_0x2fc7('0x3d')]['List']&&_0x363d5c[_0x2fc7('0x3d')][_0x2fc7('0x36')]['Contacts']['length']){return _0x363d5c[_0x2fc7('0x3d')][_0x2fc7('0x36')]['Contacts'][0x0];}var _0x1998da=_['defaults'](_0x25af18['body'],{'firstName':_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2d')],'ListId':_0x14c9ba[_0x2fc7('0x43')]});_0x1998da[_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x31')]]=_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2d')];return db[_0x2fc7('0x23')][_0x2fc7('0x44')](_0x1998da,{'fields':_0x2fa833,'raw':!![]});}})[_0x2fc7('0x22')](function(_0x474a5d){_0x363d5c[_0x2fc7('0x45')]=_0x474a5d;if(_0x474a5d){var _0xa8ad8f={'ContactId':_0x474a5d['id'],'FaxAccountId':_0x25af18[_0x2fc7('0x3d')]['id'],'fax':_0x474a5d[_0x2fc7('0x46')]};return db[_0x2fc7('0x47')][_0x2fc7('0x35')]({'where':{'ContactId':_0x474a5d['id'],'closed':![],'FaxAccountId':_0x25af18[_0x2fc7('0x3d')]['id']}})['then'](function(_0x1f5ffa){if(_0x1f5ffa){return[_0x1f5ffa,![]];}return db[_0x2fc7('0x47')]['create'](_0xa8ad8f)[_0x2fc7('0x22')](function(_0x2c68f5){return[_0x2c68f5,!![]];});});}else{throw new Error(_0x2fc7('0x48'));}})['spread'](function(_0x1ee50c,_0x1af6c7){var _0x2a760a=_0x1ee50c[_0x2fc7('0x3c')]({'plain':!![]});if(_0x1af6c7){if(_0x363d5c['account'][_0x2fc7('0x49')]){_0x363d5c[_0x2fc7('0x3f')][_0x2fc7('0x4a')]({'id':0x0,'priority':_0x363d5c[_0x2fc7('0x3f')]['length']+0x1,'app':_0x2fc7('0x4b'),'appdata':'unmanaged','interval':_0x2fc7('0x4c')});}_0x2a760a['created']=!![];}else{_0x2a760a[_0x2fc7('0x4d')]=![];}_0x363d5c[_0x2fc7('0x4e')]=_0x2a760a;return db[_0x2fc7('0x4f')]['create']({'body':_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x2b')],'FaxAccountId':_0x25af18[_0x2fc7('0x3d')]['id'],'FaxInteractionId':_0x1ee50c['id'],'direction':'in','ContactId':_0x1ee50c[_0x2fc7('0x50')],'AttachmentId':_0x25af18[_0x2fc7('0x2b')][_0x2fc7('0x51')]});})[_0x2fc7('0x22')](function(_0x3d20ed){_0x363d5c[_0x2fc7('0x17')]=_0x3d20ed;if(_0x363d5c[_0x2fc7('0x4e')][_0x2fc7('0x52')]){return db[_0x2fc7('0x53')]['find']({'attributes':['id',_0x2fc7('0x54')],'where':{'id':_0x363d5c['interaction'][_0x2fc7('0x52')]}})[_0x2fc7('0x22')](function(_0x1025aa){if(_0x1025aa){_0x363d5c[_0x2fc7('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2fc7('0x55'),'appdata':_0x1025aa[_0x2fc7('0x54')]+','+(_0x363d5c[_0x2fc7('0x3d')][_0x2fc7('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2fc7('0x57'),_0x2fc7('0x58'),_0x363d5c);});}return respondWithRpcPromise(_0x2fc7('0x57'),'startRouting',_0x363d5c);})[_0x2fc7('0x22')](function(_0x2fc83b){_0x497ea7(_0x2fc83b);})[_0x2fc7('0x59')](function(_0x5159ba){_0x1dd09a(_0x102269[_0x2fc7('0x15')](0x1f4,_0x5159ba['message']));});});}; \ No newline at end of file +var _0x619d=['map','model','then','GetFaxAccount','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','body','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','DESC','FaxApplication','Applications','List','get','applications','list','orderBy','priority','asc','length','ListId','create','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','name','agent','Start','startRouting','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0x619d,0x1a5));var _0xd619=function(_0x3f17f7,_0x5770fa){_0x3f17f7=_0x3f17f7-0x0;var _0xa3eee8=_0x619d[_0x3f17f7];return _0xa3eee8;};'use strict';var _=require('lodash');var util=require(_0xd619('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd619('0x1'));var db=require(_0xd619('0x2'))['db'];var utils=require(_0xd619('0x3'));var logger=require(_0xd619('0x4'))(_0xd619('0x5'));var config=require(_0xd619('0x6'));var jayson=require(_0xd619('0x7'));var client=jayson['client'][_0xd619('0x8')]({'port':0x232c});config[_0xd619('0x9')]=_[_0xd619('0xa')](config[_0xd619('0x9')],{'host':_0xd619('0xb'),'port':0x18eb});var socket=require(_0xd619('0xc'))(new Redis(config[_0xd619('0x9')]));require(_0xd619('0xd'))[_0xd619('0xe')](socket);function respondWithRpcPromise(_0x12ba33,_0x4c2d29,_0xdc14cf){return new BPromise(function(_0x23d37e,_0x2bc7a9){return client[_0xd619('0xf')](_0x12ba33,_0xdc14cf)['then'](function(_0x32ce24){logger[_0xd619('0x10')](_0xd619('0x11'),_0x4c2d29,'request\x20sent');logger[_0xd619('0x12')](_0xd619('0x13'),_0x4c2d29,'request\x20sent',JSON[_0xd619('0x14')](_0x32ce24));if(_0x32ce24[_0xd619('0x15')]){if(_0x32ce24['error'][_0xd619('0x16')]===0x1f4){logger[_0xd619('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4c2d29,_0x32ce24[_0xd619('0x15')][_0xd619('0x17')]);return _0x2bc7a9(_0x32ce24['error']['message']);}logger[_0xd619('0x15')](_0xd619('0x11'),_0x4c2d29,_0x32ce24[_0xd619('0x15')]['message']);return _0x23d37e(_0x32ce24[_0xd619('0x15')][_0xd619('0x17')]);}else{logger[_0xd619('0x10')](_0xd619('0x11'),_0x4c2d29,_0xd619('0x18'));_0x23d37e(_0x32ce24['result'][_0xd619('0x17')]);}})[_0xd619('0x19')](function(_0x30e2ff){logger[_0xd619('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4c2d29,_0x30e2ff);_0x2bc7a9(_0x30e2ff);});});}exports['GetFaxAccount']=function(_0x4a8ac5){var _0x3dd99d=this;return new Promise(function(_0x356d27,_0x53dbef){return db[_0xd619('0x1a')][_0xd619('0x1b')]({'raw':_0x4a8ac5['options']?_0x4a8ac5[_0xd619('0x1c')][_0xd619('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a8ac5[_0xd619('0x1c')]?_0x4a8ac5[_0xd619('0x1c')][_0xd619('0x1e')]||null:null,'attributes':_0x4a8ac5[_0xd619('0x1c')]?_0x4a8ac5[_0xd619('0x1c')][_0xd619('0x1f')]||null:null,'limit':_0x4a8ac5[_0xd619('0x1c')]?_0x4a8ac5[_0xd619('0x1c')][_0xd619('0x20')]||null:null,'include':_0x4a8ac5[_0xd619('0x1c')]?_0x4a8ac5['options'][_0xd619('0x21')]?_[_0xd619('0x22')](_0x4a8ac5[_0xd619('0x1c')][_0xd619('0x21')],function(_0x5a860f){return{'model':db[_0x5a860f[_0xd619('0x23')]],'as':_0x5a860f['as'],'attributes':_0x5a860f[_0xd619('0x1f')],'include':_0x5a860f[_0xd619('0x21')]?_['map'](_0x5a860f[_0xd619('0x21')],function(_0x5c7b59){return{'model':db[_0x5c7b59[_0xd619('0x23')]],'as':_0x5c7b59['as'],'attributes':_0x5c7b59[_0xd619('0x1f')],'include':_0x5c7b59[_0xd619('0x21')]?_['map'](_0x5c7b59[_0xd619('0x21')],function(_0x27ff76){return{'model':db[_0x27ff76[_0xd619('0x23')]],'as':_0x27ff76['as'],'attributes':_0x27ff76[_0xd619('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd619('0x24')](function(_0x141739){logger['info'](_0xd619('0x25'),_0x4a8ac5);logger['debug'](_0xd619('0x25'),_0x4a8ac5,JSON['stringify'](_0x141739));_0x356d27(_0x141739);})[_0xd619('0x19')](function(_0xf4ec25){logger[_0xd619('0x15')](_0xd619('0x25'),_0xf4ec25[_0xd619('0x17')],_0x4a8ac5);_0x53dbef(_0x3dd99d[_0xd619('0x15')](0x1f4,_0xf4ec25[_0xd619('0x17')]));});});};exports[_0xd619('0x26')]=function(_0xe6c16e,_0x44b9c6,_0x90de99){var _0x388f4a=this;return new Promise(function(_0x33078c,_0x18d80d){var _0x36862c={'body':_0xe6c16e['body'],'channel':_0xd619('0x27')};var _0x4d57b=[];var _0x10c738=[];var _0x3ee401={};return db[_0xd619('0x28')][_0xd619('0x29')]()[_0xd619('0x24')](function(_0x354d35){if(!_0x354d35){throw new db[(_0xd619('0x2a'))]['ValidationError'](_0xd619('0x2b'));}_0x4d57b=_[_0xd619('0x2c')](_['keys'](_0x354d35),[_0xd619('0x2d'),_0xd619('0x2e')]);_0x10c738=_['difference'](_['keys'](_0x354d35),['createdAt','updatedAt',_0xd619('0x2f'),'ListId']);if(_0xe6c16e[_0xd619('0x30')]['id']){delete _0xe6c16e['body']['id'];}if(_['isNil'](_0xe6c16e[_0xd619('0x30')][_0xd619('0x31')])){throw new db[(_0xd619('0x2a'))]['ValidationError'](_0xd619('0x32'));}if(_['isNil'](_0xe6c16e[_0xd619('0x30')][_0xd619('0x30')])||_0xe6c16e['body'][_0xd619('0x30')]===''){throw new db['Sequelize']['ValidationError'](_0xd619('0x33'));}if(_[_0xd619('0x34')](_0xe6c16e[_0xd619('0x30')][_0xd619('0x35')])){throw new db[(_0xd619('0x2a'))][(_0xd619('0x36'))](_0xd619('0x37')+_0x10c738);}if(!_[_0xd619('0x38')](_0x10c738,_0xe6c16e['body']['mapKey'])){throw new db[(_0xd619('0x2a'))][(_0xd619('0x36'))](_0xd619('0x39')+_0x10c738);}_0x3ee401[_0xe6c16e['body']['mapKey']]=_0xe6c16e[_0xd619('0x30')][_0xd619('0x31')];})[_0xd619('0x24')](function(){return db[_0xd619('0x1a')][_0xd619('0x3a')]({'where':{'id':_0xe6c16e[_0xd619('0x3b')]['id']},'include':[{'model':db[_0xd619('0x3c')],'as':'List','include':[{'model':db[_0xd619('0x28')],'as':_0xd619('0x3d'),'where':_0x3ee401,'limit':0x1,'order':[[_0xd619('0x2e'),_0xd619('0x3e')]]}]},{'model':db[_0xd619('0x3f')],'as':_0xd619('0x40')}]});})['then'](function(_0x44cb69){if(_0x44cb69&&_0x44cb69[_0xd619('0x41')]){var _0x16871f=_0x44cb69[_0xd619('0x42')]({'plain':!![]});_0x36862c['account']=_0x16871f;_0x36862c[_0xd619('0x43')]=_0x16871f[_0xd619('0x40')];_0x36862c[_0xd619('0x44')]=_0x16871f['List'];_0x36862c[_0xd619('0x43')]=_[_0xd619('0x45')](_0x36862c[_0xd619('0x43')],[_0xd619('0x46')],[_0xd619('0x47')]);if(_0x36862c[_0xd619('0x3b')]['Applications']){delete _0x36862c[_0xd619('0x3b')][_0xd619('0x40')];}if(_0x36862c[_0xd619('0x3b')][_0xd619('0x41')]&&_0x36862c['account'][_0xd619('0x41')]['Contacts'][_0xd619('0x48')]){return _0x36862c[_0xd619('0x3b')]['List'][_0xd619('0x3d')][0x0];}var _0x148514=_[_0xd619('0xa')](_0xe6c16e['body'],{'firstName':_0xe6c16e[_0xd619('0x30')]['from'],'ListId':_0x16871f[_0xd619('0x49')]});_0x148514[_0xe6c16e[_0xd619('0x30')][_0xd619('0x35')]]=_0xe6c16e[_0xd619('0x30')]['from'];return db[_0xd619('0x28')][_0xd619('0x4a')](_0x148514,{'fields':_0x4d57b,'raw':!![]});}})[_0xd619('0x24')](function(_0x52c791){_0x36862c['contact']=_0x52c791;if(_0x52c791){var _0xfd33c9={'ContactId':_0x52c791['id'],'FaxAccountId':_0xe6c16e[_0xd619('0x3b')]['id'],'fax':_0x52c791[_0xd619('0x27')]};return db['FaxInteraction'][_0xd619('0x3a')]({'where':{'ContactId':_0x52c791['id'],'closed':![],'FaxAccountId':_0xe6c16e[_0xd619('0x3b')]['id']}})[_0xd619('0x24')](function(_0x1f7e74){if(_0x1f7e74){return[_0x1f7e74,![]];}return db['FaxInteraction'][_0xd619('0x4a')](_0xfd33c9)[_0xd619('0x24')](function(_0x542786){return[_0x542786,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd619('0x4b')](function(_0x5bde32,_0x2bfa32){var _0x5b8eff=_0x5bde32[_0xd619('0x42')]({'plain':!![]});if(_0x2bfa32){if(_0x36862c[_0xd619('0x3b')][_0xd619('0x4c')]){_0x36862c[_0xd619('0x43')][_0xd619('0x4d')]({'id':0x0,'priority':_0x36862c[_0xd619('0x43')][_0xd619('0x48')]+0x1,'app':_0xd619('0x4e'),'appdata':_0xd619('0x4f'),'interval':_0xd619('0x50')});}_0x5b8eff[_0xd619('0x51')]=!![];}else{_0x5b8eff['created']=![];}_0x36862c['interaction']=_0x5b8eff;return db[_0xd619('0x52')]['create']({'body':_0xe6c16e[_0xd619('0x30')][_0xd619('0x30')],'FaxAccountId':_0xe6c16e['account']['id'],'FaxInteractionId':_0x5bde32['id'],'direction':'in','ContactId':_0x5bde32['ContactId'],'AttachmentId':_0xe6c16e[_0xd619('0x30')][_0xd619('0x53')]});})[_0xd619('0x24')](function(_0x78d936){_0x36862c[_0xd619('0x17')]=_0x78d936;if(_0x36862c[_0xd619('0x54')][_0xd619('0x55')]){return db[_0xd619('0x56')][_0xd619('0x3a')]({'attributes':['id',_0xd619('0x57')],'where':{'id':_0x36862c[_0xd619('0x54')][_0xd619('0x55')]}})[_0xd619('0x24')](function(_0x21f718){if(_0x21f718){_0x36862c[_0xd619('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd619('0x58'),'appdata':_0x21f718[_0xd619('0x57')]+','+(_0x36862c[_0xd619('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xd619('0x50')});}return respondWithRpcPromise(_0xd619('0x59'),_0xd619('0x5a'),_0x36862c);});}return respondWithRpcPromise(_0xd619('0x59'),_0xd619('0x5a'),_0x36862c);})['then'](function(_0x1ce82a){_0x33078c(_0x1ce82a);})[_0xd619('0x19')](function(_0x352254){_0x18d80d(_0x388f4a[_0xd619('0x15')](0x1f4,_0x352254[_0xd619('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0887866..ab6948d 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 _0xe733=['removeListener','register','faxAccount:','save','remove','update','emit'];(function(_0xc81f5f,_0x181205){var _0x4410dc=function(_0x3cf9a5){while(--_0x3cf9a5){_0xc81f5f['push'](_0xc81f5f['shift']());}};_0x4410dc(++_0x181205);}(_0xe733,0x1bc));var _0x3e73=function(_0xa2a29c,_0x299617){_0xa2a29c=_0xa2a29c-0x0;var _0xe6eabd=_0xe733[_0xa2a29c];return _0xe6eabd;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x3e73('0x0'),_0x3e73('0x1'),_0x3e73('0x2')];function createListener(_0x2d2425,_0x392e01){return function(_0x43cb17){_0x392e01[_0x3e73('0x3')](_0x2d2425,_0x43cb17);};}function removeListener(_0x2dacb3,_0x4e9c77){return function(){FaxAccountEvents[_0x3e73('0x4')](_0x2dacb3,_0x4e9c77);};}exports[_0x3e73('0x5')]=function(_0x4909d1){for(var _0x55544a=0x0,_0x5e8e50=events['length'];_0x55544a<_0x5e8e50;_0x55544a++){var _0x13527f=events[_0x55544a];var _0x2796f5=createListener(_0x3e73('0x6')+_0x13527f,_0x4909d1);FaxAccountEvents['on'](_0x13527f,_0x2796f5);}}; \ No newline at end of file +var _0xfed3=['emit','removeListener','length','faxAccount:','save'];(function(_0x2d1e3b,_0x5daddd){var _0x4735cc=function(_0x48e15d){while(--_0x48e15d){_0x2d1e3b['push'](_0x2d1e3b['shift']());}};_0x4735cc(++_0x5daddd);}(_0xfed3,0x1df));var _0x3fed=function(_0x4480b9,_0x5c2949){_0x4480b9=_0x4480b9-0x0;var _0x3f0f02=_0xfed3[_0x4480b9];return _0x3f0f02;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x3fed('0x0'),'remove','update'];function createListener(_0x1cc714,_0x405454){return function(_0x46da9a){_0x405454[_0x3fed('0x1')](_0x1cc714,_0x46da9a);};}function removeListener(_0x27a29a,_0x907c7d){return function(){FaxAccountEvents[_0x3fed('0x2')](_0x27a29a,_0x907c7d);};}exports['register']=function(_0x11a57f){for(var _0x3d62fd=0x0,_0xdbe2d2=events[_0x3fed('0x3')];_0x3d62fd<_0xdbe2d2;_0x3d62fd++){var _0x379ee0=events[_0x3d62fd];var _0x59667d=createListener(_0x3fed('0x4')+_0x379ee0,_0x11a57f);FaxAccountEvents['on'](_0x379ee0,_0x59667d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9bfd940..d5d41ba 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0xc6146f,_0x2437f3){var _0x31d1a2=function(_0x44f03e){while(--_0x44f03e){_0xc6146f['push'](_0xc6146f['shift']());}};_0x31d1a2(++_0x2437f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5c6b09,_0x1737fc){var _0x10ad1f=function(_0x398e8e){while(--_0x398e8e){_0x5c6b09['push'](_0x5c6b09['shift']());}};_0x10ad1f(++_0x1737fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b063946..acf4a89 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 _0x99c4=['STRING','TEXT','exports'];(function(_0x54a28a,_0x1ba1fe){var _0x3da1f1=function(_0x7231b5){while(--_0x7231b5){_0x54a28a['push'](_0x54a28a['shift']());}};_0x3da1f1(++_0x1ba1fe);}(_0x99c4,0xc5));var _0x499c=function(_0x449cc6,_0x1e7946){_0x449cc6=_0x449cc6-0x0;var _0x32d582=_0x99c4[_0x449cc6];return _0x32d582;};'use strict';var Sequelize=require('sequelize');module[_0x499c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x499c('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x499c('0x2')]()},'description':{'type':Sequelize[_0x499c('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa33b=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x416d38,_0x1e028a){var _0x2343db=function(_0x2e9572){while(--_0x2e9572){_0x416d38['push'](_0x416d38['shift']());}};_0x2343db(++_0x1e028a);}(_0xa33b,0x83));var _0xba33=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xa33b[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0xba33('0x0'));module[_0xba33('0x1')]={'priority':{'type':Sequelize[_0xba33('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xba33('0x3')],'allowNull':![],'defaultValue':_0xba33('0x4')},'appdata':{'type':Sequelize[_0xba33('0x5')]()},'description':{'type':Sequelize[_0xba33('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xba33('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index afd2814..73f9874 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 _0x0471=['filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0471,0xf2));var _0x1047=function(_0x327ff3,_0x3abb21){_0x327ff3=_0x327ff3-0x0;var _0x25af91=_0x0471[_0x327ff3];return _0x25af91;};'use strict';var emlformat=require(_0x1047('0x0'));var rimraf=require(_0x1047('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1047('0x2'));var moment=require('moment');var BPromise=require(_0x1047('0x3'));var Mustache=require(_0x1047('0x4'));var util=require(_0x1047('0x5'));var path=require(_0x1047('0x6'));var sox=require(_0x1047('0x7'));var csv=require(_0x1047('0x8'));var ejs=require(_0x1047('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1047('0xa'));var crypto=require(_0x1047('0xb'));var jsforce=require(_0x1047('0xc'));var deskjs=require(_0x1047('0xd'));var toCsv=require(_0x1047('0x8'));var querystring=require(_0x1047('0xe'));var Papa=require(_0x1047('0xf'));var Redis=require(_0x1047('0x10'));var authService=require(_0x1047('0x11'));var qs=require(_0x1047('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1047('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1047('0x14'));var db=require(_0x1047('0x15'))['db'];function respondWithStatusCode(_0x522687,_0x38b094){_0x38b094=_0x38b094||0xcc;return function(_0x23ab5c){if(_0x23ab5c){return _0x522687[_0x1047('0x16')](_0x38b094);}return _0x522687['status'](_0x38b094)[_0x1047('0x17')]();};}function respondWithResult(_0x2497d9,_0x855b81){_0x855b81=_0x855b81||0xc8;return function(_0x5c53ef){if(_0x5c53ef){return _0x2497d9['status'](_0x855b81)['json'](_0x5c53ef);}};}function respondWithFilteredResult(_0x43d46d,_0x5394d2){return function(_0x43f1b4){if(_0x43f1b4){var _0x29c2f7=typeof _0x5394d2['offset']===_0x1047('0x18')&&typeof _0x5394d2['limit']===_0x1047('0x18');var _0x2caa52=_0x43f1b4[_0x1047('0x19')];var _0x2ce339=_0x29c2f7?0x0:_0x5394d2['offset'];var _0x108547=_0x29c2f7?_0x43f1b4[_0x1047('0x19')]:_0x5394d2[_0x1047('0x1a')]+_0x5394d2[_0x1047('0x1b')];var _0x56953c;if(_0x108547>=_0x2caa52){_0x108547=_0x2caa52;_0x56953c=0xc8;}else{_0x56953c=0xce;}_0x43d46d[_0x1047('0x1c')](_0x56953c);return _0x43d46d[_0x1047('0x1d')](_0x1047('0x1e'),_0x2ce339+'-'+_0x108547+'/'+_0x2caa52)[_0x1047('0x1f')](_0x43f1b4);}return null;};}function patchUpdates(_0x1aba17){return function(_0xcde9de){try{jsonpatch[_0x1047('0x20')](_0xcde9de,_0x1aba17,!![]);}catch(_0x161108){return BPromise[_0x1047('0x21')](_0x161108);}return _0xcde9de['save']();};}function saveUpdates(_0x9f9f4c,_0x5e40d5){return function(_0x1db375){if(_0x1db375){return _0x1db375[_0x1047('0x22')](_0x9f9f4c)[_0x1047('0x23')](function(_0x291059){return _0x291059;});}return null;};}function removeEntity(_0x5d9af6,_0x5f6cf9){return function(_0xc4bee0){if(_0xc4bee0){return _0xc4bee0[_0x1047('0x24')]()[_0x1047('0x23')](function(){_0x5d9af6[_0x1047('0x1c')](0xcc)[_0x1047('0x17')]();});}};}function handleEntityNotFound(_0x5dc074,_0x4c5a2a){return function(_0x11bac9){if(!_0x11bac9){_0x5dc074['sendStatus'](0x194);}return _0x11bac9;};}function handleError(_0xb2b35c,_0x1a88a8){_0x1a88a8=_0x1a88a8||0x1f4;return function(_0x4c9ab5){logger[_0x1047('0x25')](_0x4c9ab5[_0x1047('0x26')]);if(_0x4c9ab5[_0x1047('0x27')]){delete _0x4c9ab5[_0x1047('0x27')];}_0xb2b35c[_0x1047('0x1c')](_0x1a88a8)[_0x1047('0x28')](_0x4c9ab5);};}exports[_0x1047('0x29')]=function(_0x22a3d0,_0x505cd3){var _0x5afe26={},_0x15854f={},_0x536305={'count':0x0,'rows':[]};var _0x339022=_[_0x1047('0x2a')](db[_0x1047('0x2b')][_0x1047('0x2c')],function(_0x2be4c2){return{'name':_0x2be4c2[_0x1047('0x2d')],'type':_0x2be4c2[_0x1047('0x2e')][_0x1047('0x2f')]};});_0x15854f[_0x1047('0x30')]=_['map'](_0x339022,_0x1047('0x27'));_0x15854f[_0x1047('0x31')]=_['keys'](_0x22a3d0[_0x1047('0x31')]);_0x15854f[_0x1047('0x32')]=_['intersection'](_0x15854f[_0x1047('0x30')],_0x15854f['query']);_0x5afe26[_0x1047('0x33')]=_[_0x1047('0x34')](_0x15854f[_0x1047('0x30')],qs[_0x1047('0x35')](_0x22a3d0[_0x1047('0x31')][_0x1047('0x35')]));_0x5afe26['attributes']=_0x5afe26[_0x1047('0x33')][_0x1047('0x36')]?_0x5afe26['attributes']:_0x15854f[_0x1047('0x30')];if(!_0x22a3d0[_0x1047('0x31')][_0x1047('0x37')]('nolimit')){_0x5afe26[_0x1047('0x1b')]=qs['limit'](_0x22a3d0[_0x1047('0x31')][_0x1047('0x1b')]);_0x5afe26['offset']=qs[_0x1047('0x1a')](_0x22a3d0[_0x1047('0x31')][_0x1047('0x1a')]);}_0x5afe26[_0x1047('0x38')]=qs[_0x1047('0x39')](_0x22a3d0['query'][_0x1047('0x39')]);_0x5afe26[_0x1047('0x3a')]=qs[_0x1047('0x32')](_[_0x1047('0x3b')](_0x22a3d0[_0x1047('0x31')],_0x15854f['filters']),_0x339022);if(_0x22a3d0[_0x1047('0x31')]['filter']){_0x5afe26[_0x1047('0x3a')]=_[_0x1047('0x3c')](_0x5afe26[_0x1047('0x3a')],{'$or':_[_0x1047('0x2a')](_0x339022,function(_0x1d8479){if(_0x1d8479[_0x1047('0x2e')]!==_0x1047('0x3d')){var _0x2161ed={};_0x2161ed[_0x1d8479[_0x1047('0x27')]]={'$like':'%'+_0x22a3d0[_0x1047('0x31')]['filter']+'%'};return _0x2161ed;}})});}_0x5afe26=_[_0x1047('0x3c')]({},_0x5afe26,_0x22a3d0[_0x1047('0x3e')]);var _0x5afa4d={'where':_0x5afe26['where']};return db['FaxApplication']['count'](_0x5afa4d)[_0x1047('0x23')](function(_0x3080fb){_0x536305['count']=_0x3080fb;if(_0x22a3d0[_0x1047('0x31')]['includeAll']){_0x5afe26[_0x1047('0x3f')]=[{'all':!![]}];}return db[_0x1047('0x2b')][_0x1047('0x40')](_0x5afe26);})[_0x1047('0x23')](function(_0x26f62d){_0x536305['rows']=_0x26f62d;return _0x536305;})[_0x1047('0x23')](respondWithFilteredResult(_0x505cd3,_0x5afe26))[_0x1047('0x41')](handleError(_0x505cd3,null));};exports[_0x1047('0x42')]=function(_0x551ee3,_0xe18113){var _0x5183e8={'raw':!![],'where':{'id':_0x551ee3[_0x1047('0x43')]['id']}},_0x53c3b6={};_0x53c3b6[_0x1047('0x30')]=_[_0x1047('0x44')](db['FaxApplication']['rawAttributes']);_0x53c3b6[_0x1047('0x31')]=_[_0x1047('0x44')](_0x551ee3['query']);_0x53c3b6[_0x1047('0x32')]=_[_0x1047('0x34')](_0x53c3b6[_0x1047('0x30')],_0x53c3b6['query']);_0x5183e8['attributes']=_[_0x1047('0x34')](_0x53c3b6['model'],qs[_0x1047('0x35')](_0x551ee3['query'][_0x1047('0x35')]));_0x5183e8['attributes']=_0x5183e8[_0x1047('0x33')][_0x1047('0x36')]?_0x5183e8[_0x1047('0x33')]:_0x53c3b6[_0x1047('0x30')];if(_0x551ee3[_0x1047('0x31')][_0x1047('0x45')]){_0x5183e8[_0x1047('0x3f')]=[{'all':!![]}];}_0x5183e8=_[_0x1047('0x3c')]({},_0x5183e8,_0x551ee3[_0x1047('0x3e')]);return db[_0x1047('0x2b')][_0x1047('0x46')](_0x5183e8)['then'](handleEntityNotFound(_0xe18113,null))[_0x1047('0x23')](respondWithResult(_0xe18113,null))[_0x1047('0x41')](handleError(_0xe18113,null));};exports['create']=function(_0x22c205,_0x28df9b){return db[_0x1047('0x2b')][_0x1047('0x47')](_0x22c205['body'],{})[_0x1047('0x23')](respondWithResult(_0x28df9b,0xc9))[_0x1047('0x41')](handleError(_0x28df9b,null));};exports[_0x1047('0x22')]=function(_0x546896,_0x5b69db){if(_0x546896[_0x1047('0x48')]['id']){delete _0x546896[_0x1047('0x48')]['id'];}return db[_0x1047('0x2b')][_0x1047('0x46')]({'where':{'id':_0x546896[_0x1047('0x43')]['id']}})[_0x1047('0x23')](handleEntityNotFound(_0x5b69db,null))[_0x1047('0x23')](saveUpdates(_0x546896[_0x1047('0x48')],null))[_0x1047('0x23')](respondWithResult(_0x5b69db,null))[_0x1047('0x41')](handleError(_0x5b69db,null));};exports['destroy']=function(_0x3216a5,_0x567479){return db[_0x1047('0x2b')][_0x1047('0x46')]({'where':{'id':_0x3216a5[_0x1047('0x43')]['id']}})['then'](handleEntityNotFound(_0x567479,null))['then'](removeEntity(_0x567479,null))[_0x1047('0x41')](handleError(_0x567479,null));}; \ No newline at end of file +var _0x04d1=['Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','map','FaxApplication','rawAttributes','type','key','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','then','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x35b7ba,_0x2df40b){var _0x56e953=function(_0x4a1c2c){while(--_0x4a1c2c){_0x35b7ba['push'](_0x35b7ba['shift']());}};_0x56e953(++_0x2df40b);}(_0x04d1,0x158));var _0x104d=function(_0x3414c7,_0x32395d){_0x3414c7=_0x3414c7-0x0;var _0x4e10ba=_0x04d1[_0x3414c7];return _0x4e10ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x104d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x104d('0x1'));var rp=require('request-promise');var moment=require(_0x104d('0x2'));var BPromise=require(_0x104d('0x3'));var Mustache=require(_0x104d('0x4'));var util=require(_0x104d('0x5'));var path=require(_0x104d('0x6'));var sox=require('sox');var csv=require(_0x104d('0x7'));var ejs=require(_0x104d('0x8'));var fs=require('fs');var fs_extra=require(_0x104d('0x9'));var _=require(_0x104d('0xa'));var squel=require(_0x104d('0xb'));var crypto=require(_0x104d('0xc'));var jsforce=require(_0x104d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x104d('0x7'));var querystring=require(_0x104d('0xe'));var Papa=require(_0x104d('0xf'));var Redis=require(_0x104d('0x10'));var authService=require(_0x104d('0x11'));var qs=require(_0x104d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x104d('0x13'));var logger=require('../../config/logger')(_0x104d('0x14'));var utils=require(_0x104d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x104d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc363d9,_0x308f13){_0x308f13=_0x308f13||0xcc;return function(_0x4cd0db){if(_0x4cd0db){return _0xc363d9[_0x104d('0x17')](_0x308f13);}return _0xc363d9[_0x104d('0x18')](_0x308f13)[_0x104d('0x19')]();};}function respondWithResult(_0x5c373c,_0x2d5749){_0x2d5749=_0x2d5749||0xc8;return function(_0x2b0ddb){if(_0x2b0ddb){return _0x5c373c['status'](_0x2d5749)['json'](_0x2b0ddb);}};}function respondWithFilteredResult(_0x3b0737,_0x3d244b){return function(_0x181d0b){if(_0x181d0b){var _0x1e1755=typeof _0x3d244b[_0x104d('0x1a')]===_0x104d('0x1b')&&typeof _0x3d244b[_0x104d('0x1c')]==='undefined';var _0x372c6f=_0x181d0b[_0x104d('0x1d')];var _0x2067d8=_0x1e1755?0x0:_0x3d244b[_0x104d('0x1a')];var _0x1623e0=_0x1e1755?_0x181d0b[_0x104d('0x1d')]:_0x3d244b[_0x104d('0x1a')]+_0x3d244b[_0x104d('0x1c')];var _0x54b6d4;if(_0x1623e0>=_0x372c6f){_0x1623e0=_0x372c6f;_0x54b6d4=0xc8;}else{_0x54b6d4=0xce;}_0x3b0737[_0x104d('0x18')](_0x54b6d4);return _0x3b0737[_0x104d('0x1e')](_0x104d('0x1f'),_0x2067d8+'-'+_0x1623e0+'/'+_0x372c6f)[_0x104d('0x20')](_0x181d0b);}return null;};}function patchUpdates(_0x316160){return function(_0x3eb199){try{jsonpatch[_0x104d('0x21')](_0x3eb199,_0x316160,!![]);}catch(_0x7a3029){return BPromise[_0x104d('0x22')](_0x7a3029);}return _0x3eb199[_0x104d('0x23')]();};}function saveUpdates(_0x360c72,_0x5cf349){return function(_0x243558){if(_0x243558){return _0x243558[_0x104d('0x24')](_0x360c72)['then'](function(_0x2270cf){return _0x2270cf;});}return null;};}function removeEntity(_0x4793f7,_0x5ba33c){return function(_0x3cd408){if(_0x3cd408){return _0x3cd408[_0x104d('0x25')]()['then'](function(){_0x4793f7[_0x104d('0x18')](0xcc)[_0x104d('0x19')]();});}};}function handleEntityNotFound(_0x1451ac,_0x50398f){return function(_0x4ba410){if(!_0x4ba410){_0x1451ac['sendStatus'](0x194);}return _0x4ba410;};}function handleError(_0x4887e0,_0x56992b){_0x56992b=_0x56992b||0x1f4;return function(_0x26ae39){logger[_0x104d('0x26')](_0x26ae39[_0x104d('0x27')]);if(_0x26ae39[_0x104d('0x28')]){delete _0x26ae39[_0x104d('0x28')];}_0x4887e0[_0x104d('0x18')](_0x56992b)[_0x104d('0x29')](_0x26ae39);};}exports['index']=function(_0x19ed42,_0x4b9aba){var _0x5bd5ac={},_0x3f6c37={},_0x255cce={'count':0x0,'rows':[]};var _0x2b0e99=_[_0x104d('0x2a')](db[_0x104d('0x2b')][_0x104d('0x2c')],function(_0x31f43a){return{'name':_0x31f43a['fieldName'],'type':_0x31f43a[_0x104d('0x2d')][_0x104d('0x2e')]};});_0x3f6c37['model']=_['map'](_0x2b0e99,_0x104d('0x28'));_0x3f6c37['query']=_['keys'](_0x19ed42['query']);_0x3f6c37[_0x104d('0x2f')]=_[_0x104d('0x30')](_0x3f6c37['model'],_0x3f6c37[_0x104d('0x31')]);_0x5bd5ac[_0x104d('0x32')]=_['intersection'](_0x3f6c37['model'],qs[_0x104d('0x33')](_0x19ed42['query'][_0x104d('0x33')]));_0x5bd5ac[_0x104d('0x32')]=_0x5bd5ac['attributes'][_0x104d('0x34')]?_0x5bd5ac[_0x104d('0x32')]:_0x3f6c37[_0x104d('0x35')];if(!_0x19ed42[_0x104d('0x31')][_0x104d('0x36')](_0x104d('0x37'))){_0x5bd5ac[_0x104d('0x1c')]=qs[_0x104d('0x1c')](_0x19ed42['query'][_0x104d('0x1c')]);_0x5bd5ac['offset']=qs['offset'](_0x19ed42[_0x104d('0x31')]['offset']);}_0x5bd5ac[_0x104d('0x38')]=qs[_0x104d('0x39')](_0x19ed42['query'][_0x104d('0x39')]);_0x5bd5ac['where']=qs[_0x104d('0x2f')](_[_0x104d('0x3a')](_0x19ed42[_0x104d('0x31')],_0x3f6c37[_0x104d('0x2f')]),_0x2b0e99);if(_0x19ed42[_0x104d('0x31')][_0x104d('0x3b')]){_0x5bd5ac[_0x104d('0x3c')]=_[_0x104d('0x3d')](_0x5bd5ac[_0x104d('0x3c')],{'$or':_[_0x104d('0x2a')](_0x2b0e99,function(_0x345a7f){if(_0x345a7f[_0x104d('0x2d')]!=='VIRTUAL'){var _0x2a8a90={};_0x2a8a90[_0x345a7f[_0x104d('0x28')]]={'$like':'%'+_0x19ed42[_0x104d('0x31')][_0x104d('0x3b')]+'%'};return _0x2a8a90;}})});}_0x5bd5ac=_['merge']({},_0x5bd5ac,_0x19ed42[_0x104d('0x3e')]);var _0x224ec3={'where':_0x5bd5ac[_0x104d('0x3c')]};return db[_0x104d('0x2b')][_0x104d('0x1d')](_0x224ec3)[_0x104d('0x3f')](function(_0x4ff14b){_0x255cce[_0x104d('0x1d')]=_0x4ff14b;if(_0x19ed42[_0x104d('0x31')][_0x104d('0x40')]){_0x5bd5ac[_0x104d('0x41')]=[{'all':!![]}];}return db[_0x104d('0x2b')][_0x104d('0x42')](_0x5bd5ac);})['then'](function(_0x170565){_0x255cce[_0x104d('0x43')]=_0x170565;return _0x255cce;})['then'](respondWithFilteredResult(_0x4b9aba,_0x5bd5ac))['catch'](handleError(_0x4b9aba,null));};exports[_0x104d('0x44')]=function(_0x6f6c74,_0x5103e0){var _0x717c83={'raw':!![],'where':{'id':_0x6f6c74[_0x104d('0x45')]['id']}},_0x4eadc9={};_0x4eadc9[_0x104d('0x35')]=_[_0x104d('0x46')](db[_0x104d('0x2b')][_0x104d('0x2c')]);_0x4eadc9[_0x104d('0x31')]=_[_0x104d('0x46')](_0x6f6c74[_0x104d('0x31')]);_0x4eadc9[_0x104d('0x2f')]=_[_0x104d('0x30')](_0x4eadc9[_0x104d('0x35')],_0x4eadc9[_0x104d('0x31')]);_0x717c83[_0x104d('0x32')]=_[_0x104d('0x30')](_0x4eadc9['model'],qs[_0x104d('0x33')](_0x6f6c74[_0x104d('0x31')][_0x104d('0x33')]));_0x717c83['attributes']=_0x717c83[_0x104d('0x32')][_0x104d('0x34')]?_0x717c83['attributes']:_0x4eadc9[_0x104d('0x35')];if(_0x6f6c74[_0x104d('0x31')][_0x104d('0x40')]){_0x717c83[_0x104d('0x41')]=[{'all':!![]}];}_0x717c83=_[_0x104d('0x3d')]({},_0x717c83,_0x6f6c74[_0x104d('0x3e')]);return db[_0x104d('0x2b')][_0x104d('0x47')](_0x717c83)[_0x104d('0x3f')](handleEntityNotFound(_0x5103e0,null))[_0x104d('0x3f')](respondWithResult(_0x5103e0,null))['catch'](handleError(_0x5103e0,null));};exports[_0x104d('0x48')]=function(_0x15511a,_0x8ef5ab){return db[_0x104d('0x2b')]['create'](_0x15511a[_0x104d('0x49')],{})[_0x104d('0x3f')](respondWithResult(_0x8ef5ab,0xc9))[_0x104d('0x4a')](handleError(_0x8ef5ab,null));};exports[_0x104d('0x24')]=function(_0x45c0d3,_0x1321e4){if(_0x45c0d3[_0x104d('0x49')]['id']){delete _0x45c0d3[_0x104d('0x49')]['id'];}return db[_0x104d('0x2b')][_0x104d('0x47')]({'where':{'id':_0x45c0d3[_0x104d('0x45')]['id']}})['then'](handleEntityNotFound(_0x1321e4,null))['then'](saveUpdates(_0x45c0d3['body'],null))[_0x104d('0x3f')](respondWithResult(_0x1321e4,null))[_0x104d('0x4a')](handleError(_0x1321e4,null));};exports[_0x104d('0x25')]=function(_0x561982,_0xedc0a3){return db['FaxApplication'][_0x104d('0x47')]({'where':{'id':_0x561982[_0x104d('0x45')]['id']}})['then'](handleEntityNotFound(_0xedc0a3,null))['then'](removeEntity(_0xedc0a3,null))['catch'](handleError(_0xedc0a3,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 35ecd2c..bee132f 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 _0x4b6d=['request-promise','path','../../config/environment','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x26ff3c,_0x519ac4){var _0x125c68=function(_0x25e0a1){while(--_0x25e0a1){_0x26ff3c['push'](_0x26ff3c['shift']());}};_0x125c68(++_0x519ac4);}(_0x4b6d,0xd5));var _0xd4b6=function(_0x4d4382,_0x52ae27){_0x4d4382=_0x4d4382-0x0;var _0xd6afab=_0x4b6d[_0x4d4382];return _0xd6afab;};'use strict';var _=require('lodash');var util=require(_0xd4b6('0x0'));var logger=require(_0xd4b6('0x1'))(_0xd4b6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd4b6('0x3'));var fs=require('fs');var path=require(_0xd4b6('0x4'));var rimraf=require('rimraf');var config=require(_0xd4b6('0x5'));var attributes=require('./faxApplication.attributes');module[_0xd4b6('0x6')]=function(_0x194f5,_0x4fe2e6){return _0x194f5[_0xd4b6('0x7')](_0xd4b6('0x8'),attributes,{'tableName':_0xd4b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4b6('0xa'),'collate':_0xd4b6('0xb')});}; \ No newline at end of file +var _0xa0e2=['api','moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0e2,0x1ae));var _0x2a0e=function(_0x42dbc2,_0x538d22){_0x42dbc2=_0x42dbc2-0x0;var _0x318e4a=_0xa0e2[_0x42dbc2];return _0x318e4a;};'use strict';var _=require('lodash');var util=require(_0x2a0e('0x0'));var logger=require(_0x2a0e('0x1'))(_0x2a0e('0x2'));var moment=require(_0x2a0e('0x3'));var BPromise=require(_0x2a0e('0x4'));var rp=require(_0x2a0e('0x5'));var fs=require('fs');var path=require(_0x2a0e('0x6'));var rimraf=require('rimraf');var config=require(_0x2a0e('0x7'));var attributes=require(_0x2a0e('0x8'));module[_0x2a0e('0x9')]=function(_0x171a6f,_0x17e30a){return _0x171a6f[_0x2a0e('0xa')]('FaxApplication',attributes,{'tableName':_0x2a0e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 e2a1482..fe598d3 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 _0xbdf9=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','stringify'];(function(_0x46dd69,_0x1b2660){var _0x21ad29=function(_0x2f450d){while(--_0x2f450d){_0x46dd69['push'](_0x46dd69['shift']());}};_0x21ad29(++_0x1b2660);}(_0xbdf9,0x1e0));var _0x9bdf=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xbdf9[_0x1c510a];return _0x23cedd;};'use strict';var _=require(_0x9bdf('0x0'));var util=require(_0x9bdf('0x1'));var moment=require(_0x9bdf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9bdf('0x3'));var db=require(_0x9bdf('0x4'))['db'];var utils=require(_0x9bdf('0x5'));var logger=require(_0x9bdf('0x6'))(_0x9bdf('0x7'));var config=require(_0x9bdf('0x8'));var jayson=require(_0x9bdf('0x9'));var client=jayson[_0x9bdf('0xa')][_0x9bdf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5465d3,_0x297f4d,_0x570611){return new BPromise(function(_0x5937c7,_0x303555){return client['request'](_0x5465d3,_0x570611)[_0x9bdf('0xc')](function(_0x4959c1){logger[_0x9bdf('0xd')](_0x9bdf('0xe'),_0x297f4d,'request\x20sent');logger[_0x9bdf('0xf')](_0x9bdf('0x10'),_0x297f4d,'request\x20sent',JSON['stringify'](_0x4959c1));if(_0x4959c1['error']){if(_0x4959c1[_0x9bdf('0x11')]['code']===0x1f4){logger['error'](_0x9bdf('0xe'),_0x297f4d,_0x4959c1[_0x9bdf('0x11')][_0x9bdf('0x12')]);return _0x303555(_0x4959c1[_0x9bdf('0x11')][_0x9bdf('0x12')]);}logger[_0x9bdf('0x11')]('FaxApplication,\x20%s,\x20%s',_0x297f4d,_0x4959c1[_0x9bdf('0x11')][_0x9bdf('0x12')]);return _0x5937c7(_0x4959c1[_0x9bdf('0x11')]['message']);}else{logger[_0x9bdf('0xd')](_0x9bdf('0xe'),_0x297f4d,_0x9bdf('0x13'));_0x5937c7(_0x4959c1[_0x9bdf('0x14')][_0x9bdf('0x12')]);}})[_0x9bdf('0x15')](function(_0x460995){logger[_0x9bdf('0x11')](_0x9bdf('0xe'),_0x297f4d,_0x460995);_0x303555(_0x460995);});});}exports[_0x9bdf('0x16')]=function(_0x366fb7){var _0x2a3dbe=this;return new Promise(function(_0x403bec,_0x3142cc){return db[_0x9bdf('0x17')]['update'](_0x366fb7[_0x9bdf('0x18')],{'raw':_0x366fb7[_0x9bdf('0x19')]?_0x366fb7[_0x9bdf('0x19')][_0x9bdf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x366fb7['options']?_0x366fb7[_0x9bdf('0x19')]['where']||null:null,'attributes':_0x366fb7[_0x9bdf('0x19')]?_0x366fb7[_0x9bdf('0x19')][_0x9bdf('0x1b')]||null:null,'limit':_0x366fb7[_0x9bdf('0x19')]?_0x366fb7[_0x9bdf('0x19')][_0x9bdf('0x1c')]||null:null})[_0x9bdf('0xc')](function(_0x15f317){logger[_0x9bdf('0xd')](_0x9bdf('0x16'),_0x366fb7);logger['debug'](_0x9bdf('0x16'),_0x366fb7,JSON[_0x9bdf('0x1d')](_0x15f317));_0x403bec(_0x15f317);})[_0x9bdf('0x15')](function(_0x3c9ac6){logger[_0x9bdf('0x11')](_0x9bdf('0x16'),_0x3c9ac6['message'],_0x366fb7);_0x3142cc(_0x2a3dbe[_0x9bdf('0x11')](0x1f4,_0x3c9ac6['message']));});});}; \ No newline at end of file +var _0x236f=['body','options','raw','attributes','limit','UpdateFaxApplication','debug','stringify','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0x236f,0xb0));var _0xf236=function(_0x3c37c9,_0x2e6c3a){_0x3c37c9=_0x3c37c9-0x0;var _0x51e91d=_0x236f[_0x3c37c9];return _0x51e91d;};'use strict';var _=require(_0xf236('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf236('0x1'));var rs=require(_0xf236('0x2'));var fs=require('fs');var Redis=require(_0xf236('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf236('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf236('0x5'));var jayson=require(_0xf236('0x6'));var client=jayson[_0xf236('0x7')][_0xf236('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x265cc7,_0x3c4747,_0x135527){return new BPromise(function(_0x216d1f,_0x1634de){return client[_0xf236('0x9')](_0x265cc7,_0x135527)[_0xf236('0xa')](function(_0x3a97c5){logger['info'](_0xf236('0xb'),_0x3c4747,'request\x20sent');logger['debug'](_0xf236('0xc'),_0x3c4747,_0xf236('0xd'),JSON['stringify'](_0x3a97c5));if(_0x3a97c5[_0xf236('0xe')]){if(_0x3a97c5[_0xf236('0xe')][_0xf236('0xf')]===0x1f4){logger['error'](_0xf236('0xb'),_0x3c4747,_0x3a97c5['error']['message']);return _0x1634de(_0x3a97c5[_0xf236('0xe')]['message']);}logger[_0xf236('0xe')](_0xf236('0xb'),_0x3c4747,_0x3a97c5[_0xf236('0xe')][_0xf236('0x10')]);return _0x216d1f(_0x3a97c5[_0xf236('0xe')][_0xf236('0x10')]);}else{logger[_0xf236('0x11')](_0xf236('0xb'),_0x3c4747,_0xf236('0xd'));_0x216d1f(_0x3a97c5[_0xf236('0x12')][_0xf236('0x10')]);}})[_0xf236('0x13')](function(_0x53b7be){logger[_0xf236('0xe')]('FaxApplication,\x20%s,\x20%s',_0x3c4747,_0x53b7be);_0x1634de(_0x53b7be);});});}exports['UpdateFaxApplication']=function(_0x5ca65f){var _0x169816=this;return new Promise(function(_0x2933b2,_0x4520ff){return db['FaxApplication']['update'](_0x5ca65f[_0xf236('0x14')],{'raw':_0x5ca65f[_0xf236('0x15')]?_0x5ca65f[_0xf236('0x15')][_0xf236('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ca65f[_0xf236('0x15')]?_0x5ca65f['options']['where']||null:null,'attributes':_0x5ca65f['options']?_0x5ca65f[_0xf236('0x15')][_0xf236('0x17')]||null:null,'limit':_0x5ca65f[_0xf236('0x15')]?_0x5ca65f[_0xf236('0x15')][_0xf236('0x18')]||null:null})[_0xf236('0xa')](function(_0x29fd06){logger[_0xf236('0x11')](_0xf236('0x19'),_0x5ca65f);logger[_0xf236('0x1a')](_0xf236('0x19'),_0x5ca65f,JSON[_0xf236('0x1b')](_0x29fd06));_0x2933b2(_0x29fd06);})['catch'](function(_0x284fa8){logger[_0xf236('0xe')]('UpdateFaxApplication',_0x284fa8['message'],_0x5ca65f);_0x4520ff(_0x169816[_0xf236('0xe')](0x1f4,_0x284fa8['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 637bd86..98b25b6 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x260b0f,_0x321fdc){var _0xe7c998=function(_0x2ec709){while(--_0x2ec709){_0x260b0f['push'](_0x260b0f['shift']());}};_0xe7c998(++_0x321fdc);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xefda,0x96));var _0xaefd=function(_0x3d2ab5,_0x1a3553){_0x3d2ab5=_0x3d2ab5-0x0;var _0x421623=_0xefda[_0x3d2ab5];return _0x421623;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 9a62666..50efda0 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 _0x92b6=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2c0e1f,_0x469a94){var _0x399117=function(_0x40723f){while(--_0x40723f){_0x2c0e1f['push'](_0x2c0e1f['shift']());}};_0x399117(++_0x469a94);}(_0x92b6,0x1aa));var _0x692b=function(_0x479e1e,_0xd8dcf6){_0x479e1e=_0x479e1e-0x0;var _0x246347=_0x92b6[_0x479e1e];return _0x246347;};'use strict';var Sequelize=require(_0x692b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x692b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x692b('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x692b('0x3')]},'thirdDisposition':{'type':Sequelize[_0x692b('0x3')]},'note':{'type':Sequelize[_0x692b('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x692b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x692b('0x4')]('in',_0x692b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x692b('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x692b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8a3c=['ENUM','out','DATE','STRING'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x8a3c,0x76));var _0xc8a3=function(_0x2a63be,_0x4ad6cf){_0x2a63be=_0x2a63be-0x0;var _0x351bd7=_0x8a3c[_0x2a63be];return _0x351bd7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8a3('0x0')]},'disposition':{'type':Sequelize[_0xc8a3('0x1')]},'secondDisposition':{'type':Sequelize[_0xc8a3('0x1')]},'thirdDisposition':{'type':Sequelize[_0xc8a3('0x1')]},'note':{'type':Sequelize[_0xc8a3('0x1')]},'read1stAt':{'type':Sequelize[_0xc8a3('0x0')]},'fax':{'type':Sequelize[_0xc8a3('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xc8a3('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8a3('0x0')]},'lastMsgDirection':{'type':Sequelize[_0xc8a3('0x2')]('in',_0xc8a3('0x3')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index fcc0bfe..00f23fa 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 _0xbf3e=['where','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','ids','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','Attachment','createdAt','mkdirSync','Messages','basename','createReadStream','createWriteStream','resolve','log','err','rimraf','zip-dir','moment','bluebird','util','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','end','json','offset','undefined','count','limit','then','destroy','sendStatus','error','stack','name','send','map','FaxInteraction','fieldName','type','key','getOptions','findAll','fax','query','show','params','keys','rawAttributes','filters','attributes','intersection','model','fields','length','includeAll','include','merge','options','catch','create','body','find','describe','addMessage','omit','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','sort'];(function(_0x513fe1,_0x372314){var _0x44d915=function(_0x59f00a){while(--_0x59f00a){_0x513fe1['push'](_0x513fe1['shift']());}};_0x44d915(++_0x372314);}(_0xbf3e,0x1bd));var _0xebf3=function(_0x223c09,_0x1b48a0){_0x223c09=_0x223c09-0x0;var _0x572167=_0xbf3e[_0x223c09];return _0x572167;};'use strict';var rimraf=require(_0xebf3('0x0'));var zipdir=require(_0xebf3('0x1'));var moment=require(_0xebf3('0x2'));var BPromise=require(_0xebf3('0x3'));var util=require(_0xebf3('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xebf3('0x5'));var interaction=require(_0xebf3('0x6'));var qs=require(_0xebf3('0x7'));var logger=require('../../config/logger')(_0xebf3('0x8'));var config=require(_0xebf3('0x9'));var db=require(_0xebf3('0xa'))['db'];config['redis']=_['defaults'](config[_0xebf3('0xb')],{'host':_0xebf3('0xc'),'port':0x18eb});var socket=require(_0xebf3('0xd'))(new Redis(config[_0xebf3('0xb')]));require(_0xebf3('0xe'))['register'](socket);function respondWithStatusCode(_0x1c56a9,_0x2de255){_0x2de255=_0x2de255||0xcc;return function(_0x3f2dd9){if(_0x3f2dd9){return _0x1c56a9['sendStatus'](_0x2de255);}return _0x1c56a9[_0xebf3('0xf')](_0x2de255)[_0xebf3('0x10')]();};}function respondWithResult(_0x41b211,_0x5b2b0f){_0x5b2b0f=_0x5b2b0f||0xc8;return function(_0x1322e2){if(_0x1322e2){return _0x41b211[_0xebf3('0xf')](_0x5b2b0f)[_0xebf3('0x11')](_0x1322e2);}};}function respondWithFilteredResult(_0x4da5c5,_0x45f45b){return function(_0x51dd2b){if(_0x51dd2b){var _0x10ba82=typeof _0x45f45b[_0xebf3('0x12')]===_0xebf3('0x13')&&typeof _0x45f45b['limit']===_0xebf3('0x13');var _0x4e669a=_0x51dd2b[_0xebf3('0x14')];var _0x453f94=_0x10ba82?0x0:_0x45f45b[_0xebf3('0x12')];var _0x451f0d=_0x10ba82?_0x51dd2b[_0xebf3('0x14')]:_0x45f45b[_0xebf3('0x12')]+_0x45f45b[_0xebf3('0x15')];var _0x48438e;if(_0x451f0d>=_0x4e669a){_0x451f0d=_0x4e669a;_0x48438e=0xc8;}else{_0x48438e=0xce;}_0x4da5c5['status'](_0x48438e);return _0x4da5c5['set']('Content-Range',_0x453f94+'-'+_0x451f0d+'/'+_0x4e669a)[_0xebf3('0x11')](_0x51dd2b);}return null;};}function saveUpdates(_0x279ff1){return function(_0x8da82a){if(_0x8da82a){return _0x8da82a['update'](_0x279ff1)[_0xebf3('0x16')](function(_0x170550){return _0x170550;});}return null;};}function removeEntity(_0x2b0d66){return function(_0x20c8f4){if(_0x20c8f4){return _0x20c8f4[_0xebf3('0x17')]()[_0xebf3('0x16')](function(){_0x2b0d66['status'](0xcc)[_0xebf3('0x10')]();});}};}function handleEntityNotFound(_0x4d16c1){return function(_0x5d0880){if(!_0x5d0880){_0x4d16c1[_0xebf3('0x18')](0x194);}return _0x5d0880;};}function handleError(_0x1eb295,_0x2941ea){_0x2941ea=_0x2941ea||0x1f4;return function(_0x424905){logger[_0xebf3('0x19')](_0x424905[_0xebf3('0x1a')]);if(_0x424905[_0xebf3('0x1b')]){delete _0x424905['name'];}_0x1eb295[_0xebf3('0xf')](_0x2941ea)[_0xebf3('0x1c')](_0x424905);};}exports['index']=function(_0x401dfe,_0x1fa618){var _0x387772={};var _0x3d72b1=_[_0xebf3('0x1d')](db[_0xebf3('0x1e')]['rawAttributes'],function(_0x115186){return{'name':_0x115186[_0xebf3('0x1f')],'type':_0x115186[_0xebf3('0x20')][_0xebf3('0x21')]};});_0x387772=qs[_0xebf3('0x22')](_0x3d72b1,_0x401dfe);return interaction[_0xebf3('0x23')](_0xebf3('0x24'),_0x401dfe[_0xebf3('0x25')],_0x401dfe['user'],_0x387772,_0x3d72b1)[_0xebf3('0x16')](respondWithFilteredResult(_0x1fa618,_0x387772))['catch'](handleError(_0x1fa618,null));};exports[_0xebf3('0x26')]=function(_0xf8ee29,_0x1add08){var _0x1e4355={'raw':![],'where':{'id':_0xf8ee29[_0xebf3('0x27')]['id']}},_0x5a2484={};_0x5a2484['model']=_[_0xebf3('0x28')](db['FaxInteraction'][_0xebf3('0x29')]);_0x5a2484['query']=_[_0xebf3('0x28')](_0xf8ee29[_0xebf3('0x25')]);_0x5a2484[_0xebf3('0x2a')]=_['intersection'](_0x5a2484['model'],_0x5a2484['query']);_0x1e4355[_0xebf3('0x2b')]=_[_0xebf3('0x2c')](_0x5a2484[_0xebf3('0x2d')],qs[_0xebf3('0x2e')](_0xf8ee29['query'][_0xebf3('0x2e')]));_0x1e4355[_0xebf3('0x2b')]=_0x1e4355['attributes'][_0xebf3('0x2f')]?_0x1e4355[_0xebf3('0x2b')]:_0x5a2484[_0xebf3('0x2d')];if(_0xf8ee29[_0xebf3('0x25')][_0xebf3('0x30')]){_0x1e4355[_0xebf3('0x31')]=[{'all':!![]}];}_0x1e4355=_[_0xebf3('0x32')]({},_0x1e4355,_0xf8ee29[_0xebf3('0x33')]);return db['FaxInteraction']['find'](_0x1e4355)[_0xebf3('0x16')](handleEntityNotFound(_0x1add08,null))[_0xebf3('0x16')](respondWithResult(_0x1add08,null))[_0xebf3('0x34')](handleError(_0x1add08,null));};exports[_0xebf3('0x35')]=function(_0x45e43d,_0xc0630f){return db[_0xebf3('0x1e')]['create'](_0x45e43d[_0xebf3('0x36')],{})['then'](respondWithResult(_0xc0630f,0xc9))['catch'](handleError(_0xc0630f,null));};exports['update']=function(_0x158b92,_0x5dab59){if(_0x158b92[_0xebf3('0x36')]['id']){delete _0x158b92[_0xebf3('0x36')]['id'];}return db[_0xebf3('0x1e')][_0xebf3('0x37')]({'where':{'id':_0x158b92[_0xebf3('0x27')]['id']}})[_0xebf3('0x16')](handleEntityNotFound(_0x5dab59,null))['then'](saveUpdates(_0x158b92[_0xebf3('0x36')],null))[_0xebf3('0x16')](respondWithResult(_0x5dab59,null))['catch'](handleError(_0x5dab59,null));};exports['destroy']=function(_0x2bb1e7,_0x332c2a){return db[_0xebf3('0x1e')][_0xebf3('0x37')]({'where':{'id':_0x2bb1e7[_0xebf3('0x27')]['id']}})[_0xebf3('0x16')](handleEntityNotFound(_0x332c2a,null))[_0xebf3('0x16')](removeEntity(_0x332c2a,null))[_0xebf3('0x34')](handleError(_0x332c2a,null));};exports['describe']=function(_0x2df3a4,_0x578568){return db[_0xebf3('0x1e')][_0xebf3('0x38')]()[_0xebf3('0x16')](respondWithResult(_0x578568,null))[_0xebf3('0x34')](handleError(_0x578568,null));};exports[_0xebf3('0x39')]=function(_0x173f5e,_0x30523f){return db['FaxMessage'][_0xebf3('0x37')]({'where':{'id':_0x173f5e['params']['id']}})['then'](handleEntityNotFound(_0x30523f,null))['then'](function(_0x3a2175){if(_0x3a2175){return _0x3a2175[_0xebf3('0x39')](_0x173f5e[_0xebf3('0x36')]['ids'],_[_0xebf3('0x3a')](_0x173f5e[_0xebf3('0x36')],['ids','id'])||{});}})[_0xebf3('0x16')](respondWithResult(_0x30523f,null))['catch'](handleError(_0x30523f,null));};exports[_0xebf3('0x3b')]=function(_0x12c85b,_0xdb12db){var _0x54693d={'raw':![],'where':{}};var _0x237723={};var _0x310bcf={'count':0x0,'rows':[]};return db[_0xebf3('0x1e')][_0xebf3('0x3c')]({'where':{'id':_0x12c85b[_0xebf3('0x27')]['id']}})[_0xebf3('0x16')](handleEntityNotFound(_0xdb12db,null))[_0xebf3('0x16')](function(_0x3e4222){if(_0x3e4222){_0x237723[_0xebf3('0x2d')]=_['keys'](db[_0xebf3('0x3d')][_0xebf3('0x29')]);_0x237723[_0xebf3('0x25')]=_[_0xebf3('0x28')](_0x12c85b[_0xebf3('0x25')]);_0x237723[_0xebf3('0x2a')]=_[_0xebf3('0x2c')](_0x237723[_0xebf3('0x2d')],_0x237723[_0xebf3('0x25')]);_0x54693d[_0xebf3('0x2b')]=_[_0xebf3('0x2c')](_0x237723[_0xebf3('0x2d')],qs[_0xebf3('0x2e')](_0x12c85b[_0xebf3('0x25')][_0xebf3('0x2e')]));_0x54693d[_0xebf3('0x2b')]=_0x54693d[_0xebf3('0x2b')][_0xebf3('0x2f')]?_0x54693d[_0xebf3('0x2b')]:_0x237723[_0xebf3('0x2d')];if(!_0x12c85b[_0xebf3('0x25')][_0xebf3('0x3e')](_0xebf3('0x3f'))){_0x54693d['limit']=qs['limit'](_0x12c85b['query'][_0xebf3('0x15')]);_0x54693d[_0xebf3('0x12')]=qs[_0xebf3('0x12')](_0x12c85b[_0xebf3('0x25')][_0xebf3('0x12')]);}_0x54693d['order']=qs[_0xebf3('0x40')](_0x12c85b['query'][_0xebf3('0x40')]);_0x54693d[_0xebf3('0x41')]=qs[_0xebf3('0x2a')](_[_0xebf3('0x42')](_0x12c85b[_0xebf3('0x25')],_0x237723[_0xebf3('0x2a')]));_0x54693d[_0xebf3('0x41')][_0xebf3('0x43')]=_0x3e4222['id'];if(_0x12c85b[_0xebf3('0x25')]['filter']){_0x54693d['where']=_[_0xebf3('0x32')](_0x54693d[_0xebf3('0x41')],{'$or':_[_0xebf3('0x1d')](_0x54693d['attributes'],function(_0x524cb1){var _0x58cef2={};_0x58cef2[_0x524cb1]={'$like':'%'+_0x12c85b[_0xebf3('0x25')][_0xebf3('0x44')]+'%'};return _0x58cef2;})});}if(_0x12c85b[_0xebf3('0x25')][_0xebf3('0x45')]){var _0x123dc1=_0x12c85b[_0xebf3('0x25')][_0xebf3('0x45')][_0xebf3('0x46')](',');var _0x324b25={};_0x324b25[_0x123dc1[0x0]]={'$gte':moment(_0x123dc1[0x1])[_0xebf3('0x47')](_0xebf3('0x48'))};_0x54693d['where']=_[_0xebf3('0x32')](_0x54693d[_0xebf3('0x41')],_0x324b25);}_0x54693d=_[_0xebf3('0x32')]({},_0x54693d,_0x12c85b['options']);return db[_0xebf3('0x3d')][_0xebf3('0x14')]({'where':_0x54693d[_0xebf3('0x41')]})['then'](function(_0x340d2b){_0x310bcf[_0xebf3('0x14')]=_0x340d2b;if(_0x12c85b[_0xebf3('0x25')][_0xebf3('0x30')]){_0x54693d[_0xebf3('0x31')]=[{'all':!![]}];}return db[_0xebf3('0x3d')][_0xebf3('0x23')](_0x54693d);})[_0xebf3('0x16')](function(_0x25172e){_0x310bcf['rows']=_0x25172e;return _0x310bcf;});}})[_0xebf3('0x16')](respondWithFilteredResult(_0xdb12db,_0x54693d))[_0xebf3('0x34')](handleError(_0xdb12db,null));};exports[_0xebf3('0x49')]=function(_0x203e33,_0xe1b24f){return db[_0xebf3('0x1e')][_0xebf3('0x37')]({'where':{'id':_0x203e33[_0xebf3('0x27')]['id']}})[_0xebf3('0x16')](handleEntityNotFound(_0xe1b24f,null))[_0xebf3('0x16')](function(_0x38be0f){if(_0x38be0f){return _0x38be0f[_0xebf3('0x4a')](_0x203e33[_0xebf3('0x36')]['ids'],_[_0xebf3('0x3a')](_0x203e33[_0xebf3('0x36')],['ids','id'])||{})['spread'](function(){return db[_0xebf3('0x4b')][_0xebf3('0x23')]({'attributes':['id',_0xebf3('0x1b'),_0xebf3('0x4c')],'where':{'id':_0x203e33[_0xebf3('0x36')]['ids']}});})[_0xebf3('0x16')](function(_0x492ae8){socket[_0xebf3('0x4d')](_0xebf3('0x4e'),{'id':Number(_0x203e33[_0xebf3('0x27')]['id']),'tags':_0x492ae8||[]});return{'id':Number(_0x203e33[_0xebf3('0x27')]['id']),'tags':_0x492ae8||[]};});}})[_0xebf3('0x16')](respondWithResult(_0xe1b24f,null))['catch'](handleError(_0xe1b24f,null));};exports[_0xebf3('0x4f')]=function(_0x1e030a,_0x52858f){return db[_0xebf3('0x1e')][_0xebf3('0x37')]({'where':{'id':_0x1e030a['params']['id']}})['then'](handleEntityNotFound(_0x52858f,null))[_0xebf3('0x16')](function(_0x294e8c){if(_0x294e8c){return _0x294e8c[_0xebf3('0x4f')](_0x1e030a['query'][_0xebf3('0x50')]);}})[_0xebf3('0x16')](respondWithStatusCode(_0x52858f,null))['catch'](handleError(_0x52858f,null));};exports[_0xebf3('0x51')]=function(_0x3f0f88,_0x54e209){var _0x233928=moment()[_0xebf3('0x52')]()[_0xebf3('0x53')]();var _0x3e35bb=path[_0xebf3('0x54')](config[_0xebf3('0x55')],_0xebf3('0x56'),'files',_0xebf3('0x57'));var _0x466614=path[_0xebf3('0x54')](config[_0xebf3('0x55')],_0xebf3('0x56'),_0xebf3('0x58'),_0xebf3('0x59'));var _0x44dd96=path[_0xebf3('0x54')](_0x3e35bb,_0x233928);var _0x259c7c=util[_0xebf3('0x47')](_0xebf3('0x5a'),_0x3f0f88[_0xebf3('0x27')]['id'],_0x233928);var _0x918013=path[_0xebf3('0x54')](_0x3e35bb,_0x259c7c);var _0x1774d1=[];_0x1774d1[_0xebf3('0x5b')]({'model':db[_0xebf3('0x5c')],'as':_0xebf3('0x5c'),'raw':!![]});var _0x101366=[{'model':db[_0xebf3('0x3d')],'as':'Messages','attributes':['id',_0xebf3('0x36'),_0xebf3('0x5d')],'include':_0x1774d1}];return db[_0xebf3('0x1e')][_0xebf3('0x37')]({'where':{'id':_0x3f0f88['params']['id']},'include':_0x101366})[_0xebf3('0x16')](handleEntityNotFound(_0x54e209,null))[_0xebf3('0x16')](function(_0x2cba24){if(_0x2cba24&&_0x2cba24['Messages']){var _0x4da0fa=_0x2cba24['get']({'plain':!![]});fs[_0xebf3('0x5e')](_0x44dd96);for(var _0x3d852c=0x0;_0x3d852c<_0x4da0fa[_0xebf3('0x5f')][_0xebf3('0x2f')];_0x3d852c++){var _0x12e52f=_0x4da0fa[_0xebf3('0x5f')][_0x3d852c]['Attachment'];if(_0x12e52f){var _0x59d6f8=path[_0xebf3('0x54')](_0x466614,_0x12e52f[_0xebf3('0x60')]);if(fs['existsSync'](_0x59d6f8)){fs[_0xebf3('0x61')](_0x59d6f8)['pipe'](fs[_0xebf3('0x62')](path['join'](_0x44dd96,_0x12e52f[_0xebf3('0x60')])));}}}return BPromise[_0xebf3('0x63')]()[_0xebf3('0x16')](function(){return new BPromise(function(_0x3e98d8,_0x45d407){zipdir(_0x44dd96,{'saveTo':_0x918013},function(_0x4e6b16,_0x35bffc){if(_0x4e6b16)return _0x45d407(_0x4e6b16);return _0x3e98d8(_0x35bffc);});})['then'](function(){return new BPromise(function(_0x4e31c6,_0x3b99bc){rimraf(_0x44dd96,function(_0xa115cd){if(_0xa115cd)_0x3b99bc(_0xa115cd);return _0x4e31c6();});});})['then'](function(){return _0x54e209[_0xebf3('0x51')](_0x918013,_0x259c7c,function(_0x3d166d){if(_0x3d166d){console[_0xebf3('0x64')](_0xebf3('0x65'),_0x3d166d);}else{fs['unlinkSync'](_0x918013);}});});});}else{return _0x54e209['sendStatus'](0xc8);}})[_0xebf3('0x34')](handleError(_0x54e209,null));}; \ No newline at end of file +var _0x9b03=['fields','length','model','includeAll','include','merge','options','find','body','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','attachments','join','push','Attachment','Messages','createdAt','get','basename','existsSync','createWriteStream','log','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','../../components/interaction/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','end','status','offset','limit','undefined','count','set','Content-Range','json','update','then','destroy','stack','name','send','index','FaxInteraction','key','getOptions','findAll','fax','query','catch','show','params','keys','rawAttributes','filters','intersection','attributes'];(function(_0x19d1a2,_0x1e6dda){var _0x4abb84=function(_0x183322){while(--_0x183322){_0x19d1a2['push'](_0x19d1a2['shift']());}};_0x4abb84(++_0x1e6dda);}(_0x9b03,0xfd));var _0x39b0=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9b03[_0x2ec461];return _0x28603d;};'use strict';var rimraf=require(_0x39b0('0x0'));var zipdir=require(_0x39b0('0x1'));var moment=require(_0x39b0('0x2'));var BPromise=require(_0x39b0('0x3'));var util=require(_0x39b0('0x4'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x39b0('0x5'));var qs=require(_0x39b0('0x6'));var logger=require('../../config/logger')('api');var config=require(_0x39b0('0x7'));var db=require(_0x39b0('0x8'))['db'];config[_0x39b0('0x9')]=_[_0x39b0('0xa')](config[_0x39b0('0x9')],{'host':_0x39b0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x39b0('0x9')]));require(_0x39b0('0xc'))[_0x39b0('0xd')](socket);function respondWithStatusCode(_0x581c3a,_0x1201ab){_0x1201ab=_0x1201ab||0xcc;return function(_0xe45357){if(_0xe45357){return _0x581c3a['sendStatus'](_0x1201ab);}return _0x581c3a['status'](_0x1201ab)[_0x39b0('0xe')]();};}function respondWithResult(_0x3dc90c,_0x5d0335){_0x5d0335=_0x5d0335||0xc8;return function(_0x60098d){if(_0x60098d){return _0x3dc90c[_0x39b0('0xf')](_0x5d0335)['json'](_0x60098d);}};}function respondWithFilteredResult(_0x4364d3,_0x8ca9d5){return function(_0x40ccaa){if(_0x40ccaa){var _0x2c785c=typeof _0x8ca9d5[_0x39b0('0x10')]==='undefined'&&typeof _0x8ca9d5[_0x39b0('0x11')]===_0x39b0('0x12');var _0x2e5af0=_0x40ccaa[_0x39b0('0x13')];var _0x32b358=_0x2c785c?0x0:_0x8ca9d5['offset'];var _0x274687=_0x2c785c?_0x40ccaa['count']:_0x8ca9d5[_0x39b0('0x10')]+_0x8ca9d5[_0x39b0('0x11')];var _0x53843a;if(_0x274687>=_0x2e5af0){_0x274687=_0x2e5af0;_0x53843a=0xc8;}else{_0x53843a=0xce;}_0x4364d3[_0x39b0('0xf')](_0x53843a);return _0x4364d3[_0x39b0('0x14')](_0x39b0('0x15'),_0x32b358+'-'+_0x274687+'/'+_0x2e5af0)[_0x39b0('0x16')](_0x40ccaa);}return null;};}function saveUpdates(_0x25297b){return function(_0x40dbaf){if(_0x40dbaf){return _0x40dbaf[_0x39b0('0x17')](_0x25297b)[_0x39b0('0x18')](function(_0x7610d8){return _0x7610d8;});}return null;};}function removeEntity(_0x5f2d35){return function(_0x3cbb15){if(_0x3cbb15){return _0x3cbb15[_0x39b0('0x19')]()[_0x39b0('0x18')](function(){_0x5f2d35[_0x39b0('0xf')](0xcc)[_0x39b0('0xe')]();});}};}function handleEntityNotFound(_0x4f62cc){return function(_0x48d902){if(!_0x48d902){_0x4f62cc['sendStatus'](0x194);}return _0x48d902;};}function handleError(_0x2ca9e2,_0x43f1e6){_0x43f1e6=_0x43f1e6||0x1f4;return function(_0x3f0d56){logger['error'](_0x3f0d56[_0x39b0('0x1a')]);if(_0x3f0d56['name']){delete _0x3f0d56[_0x39b0('0x1b')];}_0x2ca9e2[_0x39b0('0xf')](_0x43f1e6)[_0x39b0('0x1c')](_0x3f0d56);};}exports[_0x39b0('0x1d')]=function(_0x2aec83,_0x2bcc40){var _0x3124e1={};var _0x3cb048=_['map'](db[_0x39b0('0x1e')]['rawAttributes'],function(_0x582fe5){return{'name':_0x582fe5['fieldName'],'type':_0x582fe5['type'][_0x39b0('0x1f')]};});_0x3124e1=qs[_0x39b0('0x20')](_0x3cb048,_0x2aec83);return interaction[_0x39b0('0x21')](_0x39b0('0x22'),_0x2aec83[_0x39b0('0x23')],_0x2aec83['user'],_0x3124e1,_0x3cb048)[_0x39b0('0x18')](respondWithFilteredResult(_0x2bcc40,_0x3124e1))[_0x39b0('0x24')](handleError(_0x2bcc40,null));};exports[_0x39b0('0x25')]=function(_0x3778db,_0x531fb1){var _0x3d0b39={'raw':![],'where':{'id':_0x3778db[_0x39b0('0x26')]['id']}},_0x12884e={};_0x12884e['model']=_[_0x39b0('0x27')](db[_0x39b0('0x1e')][_0x39b0('0x28')]);_0x12884e[_0x39b0('0x23')]=_[_0x39b0('0x27')](_0x3778db[_0x39b0('0x23')]);_0x12884e[_0x39b0('0x29')]=_[_0x39b0('0x2a')](_0x12884e['model'],_0x12884e[_0x39b0('0x23')]);_0x3d0b39[_0x39b0('0x2b')]=_[_0x39b0('0x2a')](_0x12884e['model'],qs[_0x39b0('0x2c')](_0x3778db[_0x39b0('0x23')][_0x39b0('0x2c')]));_0x3d0b39[_0x39b0('0x2b')]=_0x3d0b39[_0x39b0('0x2b')][_0x39b0('0x2d')]?_0x3d0b39['attributes']:_0x12884e[_0x39b0('0x2e')];if(_0x3778db[_0x39b0('0x23')][_0x39b0('0x2f')]){_0x3d0b39[_0x39b0('0x30')]=[{'all':!![]}];}_0x3d0b39=_[_0x39b0('0x31')]({},_0x3d0b39,_0x3778db[_0x39b0('0x32')]);return db['FaxInteraction'][_0x39b0('0x33')](_0x3d0b39)['then'](handleEntityNotFound(_0x531fb1,null))[_0x39b0('0x18')](respondWithResult(_0x531fb1,null))['catch'](handleError(_0x531fb1,null));};exports['create']=function(_0x224544,_0x34e52e){return db['FaxInteraction']['create'](_0x224544[_0x39b0('0x34')],{})[_0x39b0('0x18')](respondWithResult(_0x34e52e,0xc9))['catch'](handleError(_0x34e52e,null));};exports[_0x39b0('0x17')]=function(_0x484aba,_0xf0f0e8){if(_0x484aba[_0x39b0('0x34')]['id']){delete _0x484aba[_0x39b0('0x34')]['id'];}return db[_0x39b0('0x1e')][_0x39b0('0x33')]({'where':{'id':_0x484aba['params']['id']}})[_0x39b0('0x18')](handleEntityNotFound(_0xf0f0e8,null))[_0x39b0('0x18')](saveUpdates(_0x484aba[_0x39b0('0x34')],null))[_0x39b0('0x18')](respondWithResult(_0xf0f0e8,null))['catch'](handleError(_0xf0f0e8,null));};exports[_0x39b0('0x19')]=function(_0xfcea29,_0x233462){return db[_0x39b0('0x1e')]['find']({'where':{'id':_0xfcea29[_0x39b0('0x26')]['id']}})[_0x39b0('0x18')](handleEntityNotFound(_0x233462,null))[_0x39b0('0x18')](removeEntity(_0x233462,null))['catch'](handleError(_0x233462,null));};exports[_0x39b0('0x35')]=function(_0x127135,_0x4f2101){return db[_0x39b0('0x1e')][_0x39b0('0x35')]()[_0x39b0('0x18')](respondWithResult(_0x4f2101,null))[_0x39b0('0x24')](handleError(_0x4f2101,null));};exports['addMessage']=function(_0x2c6cd0,_0x19725b){return db[_0x39b0('0x36')]['find']({'where':{'id':_0x2c6cd0[_0x39b0('0x26')]['id']}})['then'](handleEntityNotFound(_0x19725b,null))[_0x39b0('0x18')](function(_0x3daa0f){if(_0x3daa0f){return _0x3daa0f[_0x39b0('0x37')](_0x2c6cd0[_0x39b0('0x34')][_0x39b0('0x38')],_[_0x39b0('0x39')](_0x2c6cd0['body'],['ids','id'])||{});}})[_0x39b0('0x18')](respondWithResult(_0x19725b,null))[_0x39b0('0x24')](handleError(_0x19725b,null));};exports[_0x39b0('0x3a')]=function(_0x5383e0,_0x1330c5){var _0x3c85cb={'raw':![],'where':{}};var _0x3e9b7b={};var _0x3b39f9={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x39b0('0x3b')]({'where':{'id':_0x5383e0['params']['id']}})[_0x39b0('0x18')](handleEntityNotFound(_0x1330c5,null))[_0x39b0('0x18')](function(_0x500890){if(_0x500890){_0x3e9b7b[_0x39b0('0x2e')]=_[_0x39b0('0x27')](db['FaxMessage'][_0x39b0('0x28')]);_0x3e9b7b['query']=_['keys'](_0x5383e0['query']);_0x3e9b7b[_0x39b0('0x29')]=_[_0x39b0('0x2a')](_0x3e9b7b[_0x39b0('0x2e')],_0x3e9b7b['query']);_0x3c85cb[_0x39b0('0x2b')]=_[_0x39b0('0x2a')](_0x3e9b7b[_0x39b0('0x2e')],qs[_0x39b0('0x2c')](_0x5383e0[_0x39b0('0x23')][_0x39b0('0x2c')]));_0x3c85cb[_0x39b0('0x2b')]=_0x3c85cb[_0x39b0('0x2b')][_0x39b0('0x2d')]?_0x3c85cb[_0x39b0('0x2b')]:_0x3e9b7b[_0x39b0('0x2e')];if(!_0x5383e0[_0x39b0('0x23')][_0x39b0('0x3c')](_0x39b0('0x3d'))){_0x3c85cb[_0x39b0('0x11')]=qs[_0x39b0('0x11')](_0x5383e0[_0x39b0('0x23')][_0x39b0('0x11')]);_0x3c85cb[_0x39b0('0x10')]=qs[_0x39b0('0x10')](_0x5383e0['query']['offset']);}_0x3c85cb[_0x39b0('0x3e')]=qs[_0x39b0('0x3f')](_0x5383e0['query']['sort']);_0x3c85cb[_0x39b0('0x40')]=qs[_0x39b0('0x29')](_['pick'](_0x5383e0['query'],_0x3e9b7b[_0x39b0('0x29')]));_0x3c85cb['where']['FaxInteractionId']=_0x500890['id'];if(_0x5383e0[_0x39b0('0x23')][_0x39b0('0x41')]){_0x3c85cb[_0x39b0('0x40')]=_['merge'](_0x3c85cb[_0x39b0('0x40')],{'$or':_[_0x39b0('0x42')](_0x3c85cb['attributes'],function(_0x29118b){var _0x140b4c={};_0x140b4c[_0x29118b]={'$like':'%'+_0x5383e0['query'][_0x39b0('0x41')]+'%'};return _0x140b4c;})});}if(_0x5383e0[_0x39b0('0x23')][_0x39b0('0x43')]){var _0x2e355b=_0x5383e0['query'][_0x39b0('0x43')][_0x39b0('0x44')](',');var _0x2ed2ae={};_0x2ed2ae[_0x2e355b[0x0]]={'$gte':moment(_0x2e355b[0x1])[_0x39b0('0x45')](_0x39b0('0x46'))};_0x3c85cb[_0x39b0('0x40')]=_[_0x39b0('0x31')](_0x3c85cb['where'],_0x2ed2ae);}_0x3c85cb=_['merge']({},_0x3c85cb,_0x5383e0[_0x39b0('0x32')]);return db[_0x39b0('0x36')][_0x39b0('0x13')]({'where':_0x3c85cb['where']})[_0x39b0('0x18')](function(_0x1d2d6c){_0x3b39f9['count']=_0x1d2d6c;if(_0x5383e0[_0x39b0('0x23')][_0x39b0('0x2f')]){_0x3c85cb['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3c85cb);})[_0x39b0('0x18')](function(_0x48a1d1){_0x3b39f9[_0x39b0('0x47')]=_0x48a1d1;return _0x3b39f9;});}})[_0x39b0('0x18')](respondWithFilteredResult(_0x1330c5,_0x3c85cb))['catch'](handleError(_0x1330c5,null));};exports['addTags']=function(_0x2efae8,_0x5bbc6e){return db[_0x39b0('0x1e')][_0x39b0('0x33')]({'where':{'id':_0x2efae8[_0x39b0('0x26')]['id']}})['then'](handleEntityNotFound(_0x5bbc6e,null))[_0x39b0('0x18')](function(_0x34e82e){if(_0x34e82e){return _0x34e82e[_0x39b0('0x48')](_0x2efae8[_0x39b0('0x34')][_0x39b0('0x38')],_['omit'](_0x2efae8[_0x39b0('0x34')],[_0x39b0('0x38'),'id'])||{})['spread'](function(){return db[_0x39b0('0x49')][_0x39b0('0x21')]({'attributes':['id','name',_0x39b0('0x4a')],'where':{'id':_0x2efae8[_0x39b0('0x34')][_0x39b0('0x38')]}});})['then'](function(_0x2804da){socket[_0x39b0('0x4b')](_0x39b0('0x4c'),{'id':Number(_0x2efae8[_0x39b0('0x26')]['id']),'tags':_0x2804da||[]});return{'id':Number(_0x2efae8[_0x39b0('0x26')]['id']),'tags':_0x2804da||[]};});}})[_0x39b0('0x18')](respondWithResult(_0x5bbc6e,null))[_0x39b0('0x24')](handleError(_0x5bbc6e,null));};exports[_0x39b0('0x4d')]=function(_0x5ea077,_0x2556a3){return db[_0x39b0('0x1e')]['find']({'where':{'id':_0x5ea077[_0x39b0('0x26')]['id']}})[_0x39b0('0x18')](handleEntityNotFound(_0x2556a3,null))[_0x39b0('0x18')](function(_0x5ea41f){if(_0x5ea41f){return _0x5ea41f[_0x39b0('0x4d')](_0x5ea077[_0x39b0('0x23')][_0x39b0('0x38')]);}})[_0x39b0('0x18')](respondWithStatusCode(_0x2556a3,null))[_0x39b0('0x24')](handleError(_0x2556a3,null));};exports[_0x39b0('0x4e')]=function(_0x1c3664,_0x2a5194){var _0x150406=moment()[_0x39b0('0x4f')]()[_0x39b0('0x50')]();var _0x3d4b80=path['join'](config[_0x39b0('0x51')],_0x39b0('0x52'),_0x39b0('0x53'),_0x39b0('0x54'));var _0x1fbda7=path['join'](config[_0x39b0('0x51')],_0x39b0('0x52'),_0x39b0('0x53'),_0x39b0('0x55'));var _0x4bf8ed=path[_0x39b0('0x56')](_0x3d4b80,_0x150406);var _0x58e478=util[_0x39b0('0x45')]('transcript-%d-%s.zip',_0x1c3664[_0x39b0('0x26')]['id'],_0x150406);var _0x1aef08=path[_0x39b0('0x56')](_0x3d4b80,_0x58e478);var _0x5dea2a=[];_0x5dea2a[_0x39b0('0x57')]({'model':db[_0x39b0('0x58')],'as':_0x39b0('0x58'),'raw':!![]});var _0x1e36d7=[{'model':db[_0x39b0('0x36')],'as':_0x39b0('0x59'),'attributes':['id',_0x39b0('0x34'),_0x39b0('0x5a')],'include':_0x5dea2a}];return db[_0x39b0('0x1e')]['find']({'where':{'id':_0x1c3664[_0x39b0('0x26')]['id']},'include':_0x1e36d7})[_0x39b0('0x18')](handleEntityNotFound(_0x2a5194,null))[_0x39b0('0x18')](function(_0x158c9b){if(_0x158c9b&&_0x158c9b[_0x39b0('0x59')]){var _0xf46eeb=_0x158c9b[_0x39b0('0x5b')]({'plain':!![]});fs['mkdirSync'](_0x4bf8ed);for(var _0x236569=0x0;_0x236569<_0xf46eeb[_0x39b0('0x59')][_0x39b0('0x2d')];_0x236569++){var _0x2efe31=_0xf46eeb[_0x39b0('0x59')][_0x236569][_0x39b0('0x58')];if(_0x2efe31){var _0x4e883e=path[_0x39b0('0x56')](_0x1fbda7,_0x2efe31[_0x39b0('0x5c')]);if(fs[_0x39b0('0x5d')](_0x4e883e)){fs['createReadStream'](_0x4e883e)['pipe'](fs[_0x39b0('0x5e')](path['join'](_0x4bf8ed,_0x2efe31[_0x39b0('0x5c')])));}}}return BPromise['resolve']()[_0x39b0('0x18')](function(){return new BPromise(function(_0x4d0d03,_0x148d95){zipdir(_0x4bf8ed,{'saveTo':_0x1aef08},function(_0x71244c,_0x1e4d5e){if(_0x71244c)return _0x148d95(_0x71244c);return _0x4d0d03(_0x1e4d5e);});})[_0x39b0('0x18')](function(){return new BPromise(function(_0x115890,_0x3d5f8b){rimraf(_0x4bf8ed,function(_0x4091be){if(_0x4091be)_0x3d5f8b(_0x4091be);return _0x115890();});});})['then'](function(){return _0x2a5194['download'](_0x1aef08,_0x58e478,function(_0x52aebf){if(_0x52aebf){console[_0x39b0('0x5f')](_0x39b0('0x60'),_0x52aebf);}else{fs[_0x39b0('0x61')](_0x1aef08);}});});});}else{return _0x2a5194[_0x39b0('0x62')](0xc8);}})[_0x39b0('0x24')](handleError(_0x2a5194,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 53a845d..084e8df 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 _0xaf8f=['setMaxListeners','update','remove','then','setDataValue','map','findAll','length','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x117228,_0x1f0f4a){var _0x1b2da4=function(_0x5ea2ff){while(--_0x5ea2ff){_0x117228['push'](_0x117228['shift']());}};_0x1b2da4(++_0x1f0f4a);}(_0xaf8f,0x83));var _0xfaf8=function(_0x27de54,_0x2dcfeb){_0x27de54=_0x27de54-0x0;var _0x510fc6=_0xaf8f[_0x27de54];return _0x510fc6;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xfaf8('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xfaf8('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfaf8('0x2'),'afterDestroy':_0xfaf8('0x3')};function emitEvent(_0x2f48e3){return function(_0x4bf275,_0x32a5ab,_0x294b3a){_0x4bf275['getUsers']({'attributes':['id'],'raw':!![]})[_0xfaf8('0x4')](function(_0x10e593){_0x4bf275[_0xfaf8('0x5')]('Users',_0x10e593[_0xfaf8('0x6')](function(_0x33d90e){return{'id':_0x33d90e['id']};}));return FaxMessage[_0xfaf8('0x7')]({'where':{'FaxInteractionId':_0x4bf275['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfaf8('0x4')](function(_0x2f8093){_0x4bf275[_0xfaf8('0x5')]('unreadMessages',_0x2f8093[_0xfaf8('0x8')]);FaxInteractionEvents[_0xfaf8('0x9')](_0x2f48e3+':'+_0x4bf275['id'],_0x4bf275);FaxInteractionEvents[_0xfaf8('0x9')](_0x2f48e3,_0x4bf275);_0x294b3a(null);})['catch'](_0x294b3a(null));};}for(var e in events){if(events[_0xfaf8('0xa')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xfaf8('0xb')]=FaxInteractionEvents; \ No newline at end of file +var _0x4d69=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x5581ba,_0x268887){var _0x1e927f=function(_0x1803b2){while(--_0x1803b2){_0x5581ba['push'](_0x5581ba['shift']());}};_0x1e927f(++_0x268887);}(_0x4d69,0x149));var _0x94d6=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x4d69[_0x725b8e];return _0x43ac45;};'use strict';var EventEmitter=require(_0x94d6('0x0'));var FaxInteraction=require(_0x94d6('0x1'))['db'][_0x94d6('0x2')];var FaxMessage=require(_0x94d6('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x94d6('0x3')](0x0);var events={'afterCreate':_0x94d6('0x4'),'afterUpdate':_0x94d6('0x5'),'afterDestroy':_0x94d6('0x6')};function emitEvent(_0x2b1af9){return function(_0x2f625f,_0x2654c3,_0x5cfb73){_0x2f625f[_0x94d6('0x7')]({'attributes':['id'],'raw':!![]})[_0x94d6('0x8')](function(_0x40f155){_0x2f625f['setDataValue'](_0x94d6('0x9'),_0x40f155[_0x94d6('0xa')](function(_0x24c6de){return{'id':_0x24c6de['id']};}));return FaxMessage[_0x94d6('0xb')]({'where':{'FaxInteractionId':_0x2f625f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x94d6('0x8')](function(_0x4640f2){_0x2f625f[_0x94d6('0xc')](_0x94d6('0xd'),_0x4640f2[_0x94d6('0xe')]);FaxInteractionEvents['emit'](_0x2b1af9+':'+_0x2f625f['id'],_0x2f625f);FaxInteractionEvents[_0x94d6('0xf')](_0x2b1af9,_0x2f625f);_0x5cfb73(null);})[_0x94d6('0x10')](_0x5cfb73(null));};}for(var e in events){if(events[_0x94d6('0x11')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x94d6('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index ae2e4ea..5d83817 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 _0x85e6=['define','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','request-promise','path','rimraf','./faxInteraction.attributes'];(function(_0x48b32f,_0x2053f5){var _0x2af873=function(_0x2de32f){while(--_0x2de32f){_0x48b32f['push'](_0x48b32f['shift']());}};_0x2af873(++_0x2053f5);}(_0x85e6,0x1a5));var _0x685e=function(_0x171524,_0x523ec0){_0x171524=_0x171524-0x0;var _0x1c72b4=_0x85e6[_0x171524];return _0x1c72b4;};'use strict';var _=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var logger=require('../../config/logger')(_0x685e('0x2'));var moment=require(_0x685e('0x3'));var BPromise=require('bluebird');var rp=require(_0x685e('0x4'));var fs=require('fs');var path=require(_0x685e('0x5'));var rimraf=require(_0x685e('0x6'));var config=require('../../config/environment');var attributes=require(_0x685e('0x7'));module['exports']=function(_0x1ea090,_0x41f13f){return _0x1ea090[_0x685e('0x8')]('FaxInteraction',attributes,{'tableName':_0x685e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31543f,_0x3a3035,_0x41b38f){if(_0x31543f[_0x685e('0xa')]('closed')){_0x31543f[_0x685e('0xb')]=moment()['format'](_0x685e('0xc'));}_0x41b38f(null,_0x31543f);}}});}; \ No newline at end of file +var _0x2229=['moment','bluebird','path','rimraf','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0xc4476f,_0x1651ae){var _0x482281=function(_0x5f4a7a){while(--_0x5f4a7a){_0xc4476f['push'](_0xc4476f['shift']());}};_0x482281(++_0x1651ae);}(_0x2229,0xde));var _0x9222=function(_0x115d5b,_0x26aff2){_0x115d5b=_0x115d5b-0x0;var _0x6cfc50=_0x2229[_0x115d5b];return _0x6cfc50;};'use strict';var _=require(_0x9222('0x0'));var util=require(_0x9222('0x1'));var logger=require('../../config/logger')(_0x9222('0x2'));var moment=require(_0x9222('0x3'));var BPromise=require(_0x9222('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9222('0x5'));var rimraf=require(_0x9222('0x6'));var config=require(_0x9222('0x7'));var attributes=require('./faxInteraction.attributes');module[_0x9222('0x8')]=function(_0x139e0b,_0x26d596){return _0x139e0b['define'](_0x9222('0x9'),attributes,{'tableName':_0x9222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x373961,_0x286a56,_0x2ea9b7){if(_0x373961[_0x9222('0xb')](_0x9222('0xc'))){_0x373961['closedAt']=moment()[_0x9222('0xd')](_0x9222('0xe'));}_0x2ea9b7(null,_0x373961);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6d284c8..9ece0cd 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 _0x0342=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','AddTagsToFaxInteraction','FaxInteraction','find','addTags','spread','AddTags'];(function(_0xa9a245,_0x2a0387){var _0x2d0eaa=function(_0x2bba86){while(--_0x2bba86){_0xa9a245['push'](_0xa9a245['shift']());}};_0x2d0eaa(++_0x2a0387);}(_0x0342,0xa8));var _0x2034=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0x0342[_0x364048];return _0x591678;};'use strict';var _=require(_0x2034('0x0'));var util=require(_0x2034('0x1'));var moment=require(_0x2034('0x2'));var BPromise=require(_0x2034('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2034('0x4'));var db=require(_0x2034('0x5'))['db'];var utils=require(_0x2034('0x6'));var logger=require(_0x2034('0x7'))(_0x2034('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2034('0x9')][_0x2034('0xa')]({'port':0x232a});config[_0x2034('0xb')]=_['defaults'](config[_0x2034('0xb')],{'host':_0x2034('0xc'),'port':0x18eb});var socket=require(_0x2034('0xd'))(new Redis(config[_0x2034('0xb')]));require(_0x2034('0xe'))[_0x2034('0xf')](socket);function respondWithRpcPromise(_0x1eab4b,_0x38db43,_0x3268a3){return new BPromise(function(_0x4d1a54,_0x3aa1f2){return client[_0x2034('0x10')](_0x1eab4b,_0x3268a3)[_0x2034('0x11')](function(_0x448135){logger['info'](_0x2034('0x12'),_0x38db43,_0x2034('0x13'));logger[_0x2034('0x14')](_0x2034('0x15'),_0x38db43,_0x2034('0x13'),JSON[_0x2034('0x16')](_0x448135));if(_0x448135[_0x2034('0x17')]){if(_0x448135[_0x2034('0x17')][_0x2034('0x18')]===0x1f4){logger['error'](_0x2034('0x12'),_0x38db43,_0x448135[_0x2034('0x17')][_0x2034('0x19')]);return _0x3aa1f2(_0x448135[_0x2034('0x17')][_0x2034('0x19')]);}logger[_0x2034('0x17')](_0x2034('0x12'),_0x38db43,_0x448135['error'][_0x2034('0x19')]);return _0x4d1a54(_0x448135[_0x2034('0x17')][_0x2034('0x19')]);}else{logger[_0x2034('0x1a')](_0x2034('0x12'),_0x38db43,_0x2034('0x13'));_0x4d1a54(_0x448135[_0x2034('0x1b')][_0x2034('0x19')]);}})[_0x2034('0x1c')](function(_0x4eebfa){logger[_0x2034('0x17')](_0x2034('0x12'),_0x38db43,_0x4eebfa);_0x3aa1f2(_0x4eebfa);});});}exports[_0x2034('0x1d')]=function(_0x424a0f){var _0x43524f=this;return new Promise(function(_0x50bf8a,_0x5ceceb){return db['FaxInteraction'][_0x2034('0x1e')](_0x424a0f[_0x2034('0x1f')],{'raw':_0x424a0f[_0x2034('0x20')]?_0x424a0f[_0x2034('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x424a0f[_0x2034('0x20')]?_0x424a0f[_0x2034('0x20')][_0x2034('0x21')]||null:null,'attributes':_0x424a0f[_0x2034('0x20')]?_0x424a0f[_0x2034('0x20')][_0x2034('0x22')]||null:null,'limit':_0x424a0f[_0x2034('0x20')]?_0x424a0f[_0x2034('0x20')][_0x2034('0x23')]||null:null})[_0x2034('0x11')](function(_0x5274e0){logger[_0x2034('0x1a')](_0x2034('0x1d'),_0x424a0f);logger['debug'](_0x2034('0x1d'),_0x424a0f,JSON[_0x2034('0x16')](_0x5274e0));_0x50bf8a(_0x5274e0);})[_0x2034('0x1c')](function(_0x4d4f52){logger[_0x2034('0x17')]('UpdateFaxInteraction',_0x4d4f52[_0x2034('0x19')],_0x424a0f);_0x5ceceb(_0x43524f[_0x2034('0x17')](0x1f4,_0x4d4f52[_0x2034('0x19')]));});});};exports[_0x2034('0x24')]=function(_0x138445){return new Promise(function(_0x1a72cd,_0x538907){return db[_0x2034('0x25')][_0x2034('0x26')]({'where':_0x138445[_0x2034('0x20')]?_0x138445[_0x2034('0x20')][_0x2034('0x21')]||null:null})['then'](function(_0x632958){if(_0x632958){return _0x632958[_0x2034('0x27')](_0x138445[_0x2034('0x1f')]['ids'],_['omit'](_0x138445['body'],['ids','id'])||{});}})[_0x2034('0x28')](function(_0x460369){logger[_0x2034('0x1a')](_0x2034('0x29'),_0x138445);logger[_0x2034('0x14')](_0x2034('0x29'),_0x138445,JSON['stringify'](_0x460369));_0x1a72cd(_0x460369);})['catch'](function(_0x53bddf){logger[_0x2034('0x17')](_0x2034('0x29'),_0x53bddf['message'],_0x138445);_0x538907(_this[_0x2034('0x17')](0x1f4,_0x53bddf[_0x2034('0x19')]));});});}; \ No newline at end of file +var _0x26f0=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','then','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','update','body','options','raw','where','limit','info','UpdateFaxInteraction','debug','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1e58b4,_0x20e6da){var _0x3ee996=function(_0x554a05){while(--_0x554a05){_0x1e58b4['push'](_0x1e58b4['shift']());}};_0x3ee996(++_0x20e6da);}(_0x26f0,0x125));var _0x026f=function(_0x53f4b5,_0x715509){_0x53f4b5=_0x53f4b5-0x0;var _0x3e291f=_0x26f0[_0x53f4b5];return _0x3e291f;};'use strict';var _=require(_0x026f('0x0'));var util=require(_0x026f('0x1'));var moment=require(_0x026f('0x2'));var BPromise=require(_0x026f('0x3'));var rs=require(_0x026f('0x4'));var fs=require('fs');var Redis=require(_0x026f('0x5'));var db=require(_0x026f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x026f('0x7'))(_0x026f('0x8'));var config=require(_0x026f('0x9'));var jayson=require(_0x026f('0xa'));var client=jayson[_0x026f('0xb')][_0x026f('0xc')]({'port':0x232a});config[_0x026f('0xd')]=_[_0x026f('0xe')](config['redis'],{'host':_0x026f('0xf'),'port':0x18eb});var socket=require(_0x026f('0x10'))(new Redis(config[_0x026f('0xd')]));require(_0x026f('0x11'))[_0x026f('0x12')](socket);function respondWithRpcPromise(_0x24301b,_0x3bb104,_0x3cac11){return new BPromise(function(_0x426d19,_0x5a8cc0){return client['request'](_0x24301b,_0x3cac11)[_0x026f('0x13')](function(_0x3f2b98){logger['info'](_0x026f('0x14'),_0x3bb104,'request\x20sent');logger['debug'](_0x026f('0x15'),_0x3bb104,_0x026f('0x16'),JSON[_0x026f('0x17')](_0x3f2b98));if(_0x3f2b98[_0x026f('0x18')]){if(_0x3f2b98[_0x026f('0x18')]['code']===0x1f4){logger[_0x026f('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x3bb104,_0x3f2b98['error'][_0x026f('0x19')]);return _0x5a8cc0(_0x3f2b98['error'][_0x026f('0x19')]);}logger['error'](_0x026f('0x14'),_0x3bb104,_0x3f2b98['error'][_0x026f('0x19')]);return _0x426d19(_0x3f2b98[_0x026f('0x18')][_0x026f('0x19')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x3bb104,_0x026f('0x16'));_0x426d19(_0x3f2b98[_0x026f('0x1a')][_0x026f('0x19')]);}})['catch'](function(_0x932f){logger[_0x026f('0x18')](_0x026f('0x14'),_0x3bb104,_0x932f);_0x5a8cc0(_0x932f);});});}exports['UpdateFaxInteraction']=function(_0x11f324){var _0x198650=this;return new Promise(function(_0x51550a,_0x4826aa){return db['FaxInteraction'][_0x026f('0x1b')](_0x11f324[_0x026f('0x1c')],{'raw':_0x11f324[_0x026f('0x1d')]?_0x11f324[_0x026f('0x1d')][_0x026f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11f324[_0x026f('0x1d')]?_0x11f324[_0x026f('0x1d')][_0x026f('0x1f')]||null:null,'attributes':_0x11f324[_0x026f('0x1d')]?_0x11f324[_0x026f('0x1d')]['attributes']||null:null,'limit':_0x11f324[_0x026f('0x1d')]?_0x11f324['options'][_0x026f('0x20')]||null:null})[_0x026f('0x13')](function(_0x532295){logger[_0x026f('0x21')](_0x026f('0x22'),_0x11f324);logger[_0x026f('0x23')](_0x026f('0x22'),_0x11f324,JSON['stringify'](_0x532295));_0x51550a(_0x532295);})['catch'](function(_0x347516){logger['error'](_0x026f('0x22'),_0x347516[_0x026f('0x19')],_0x11f324);_0x4826aa(_0x198650[_0x026f('0x18')](0x1f4,_0x347516[_0x026f('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x32ee29){return new Promise(function(_0x3d6c89,_0x13e8af){return db['FaxInteraction'][_0x026f('0x24')]({'where':_0x32ee29[_0x026f('0x1d')]?_0x32ee29['options'][_0x026f('0x1f')]||null:null})[_0x026f('0x13')](function(_0x45f7d8){if(_0x45f7d8){return _0x45f7d8[_0x026f('0x25')](_0x32ee29[_0x026f('0x1c')][_0x026f('0x26')],_[_0x026f('0x27')](_0x32ee29[_0x026f('0x1c')],[_0x026f('0x26'),'id'])||{});}})[_0x026f('0x28')](function(_0x49998f){logger[_0x026f('0x21')](_0x026f('0x29'),_0x32ee29);logger['debug'](_0x026f('0x29'),_0x32ee29,JSON[_0x026f('0x17')](_0x49998f));_0x3d6c89(_0x49998f);})[_0x026f('0x2a')](function(_0x52d082){logger[_0x026f('0x18')](_0x026f('0x29'),_0x52d082[_0x026f('0x19')],_0x32ee29);_0x13e8af(_this[_0x026f('0x18')](0x1f4,_0x52d082[_0x026f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 618c0b5..b34969d 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 _0x9cb6=['./faxInteraction.events','remove','emit','removeListener','register','length','faxInteraction:'];(function(_0x314286,_0x3613e9){var _0x1e9579=function(_0x4219b9){while(--_0x4219b9){_0x314286['push'](_0x314286['shift']());}};_0x1e9579(++_0x3613e9);}(_0x9cb6,0xd2));var _0x69cb=function(_0x12bcea,_0x2e4826){_0x12bcea=_0x12bcea-0x0;var _0x49e2ab=_0x9cb6[_0x12bcea];return _0x49e2ab;};'use strict';var FaxInteractionEvents=require(_0x69cb('0x0'));var events=['save',_0x69cb('0x1'),'update'];function createListener(_0x2e34a0,_0x2af68d){return function(_0x5eed32){_0x2af68d[_0x69cb('0x2')](_0x2e34a0,_0x5eed32);};}function removeListener(_0xc7913,_0x2ac1d0){return function(){FaxInteractionEvents[_0x69cb('0x3')](_0xc7913,_0x2ac1d0);};}exports[_0x69cb('0x4')]=function(_0x16916c){for(var _0x18e696=0x0,_0x3cfda3=events[_0x69cb('0x5')];_0x18e696<_0x3cfda3;_0x18e696++){var _0x3890d2=events[_0x18e696];var _0x1c49bf=createListener(_0x69cb('0x6')+_0x3890d2,_0x16916c);FaxInteractionEvents['on'](_0x3890d2,_0x1c49bf);}}; \ No newline at end of file +var _0x0456=['save','emit','removeListener','register','length','faxInteraction:'];(function(_0x4eb7c0,_0x15c4db){var _0x112866=function(_0xd41728){while(--_0xd41728){_0x4eb7c0['push'](_0x4eb7c0['shift']());}};_0x112866(++_0x15c4db);}(_0x0456,0x150));var _0x6045=function(_0x405426,_0x4c86d3){_0x405426=_0x405426-0x0;var _0x107066=_0x0456[_0x405426];return _0x107066;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x6045('0x0'),'remove','update'];function createListener(_0x178b97,_0x4595ca){return function(_0x1347b4){_0x4595ca[_0x6045('0x1')](_0x178b97,_0x1347b4);};}function removeListener(_0x392eea,_0x557d75){return function(){FaxInteractionEvents[_0x6045('0x2')](_0x392eea,_0x557d75);};}exports[_0x6045('0x3')]=function(_0xd4839a){for(var _0x564d1a=0x0,_0x569658=events[_0x6045('0x4')];_0x564d1a<_0x569658;_0x564d1a++){var _0x5412f9=events[_0x564d1a];var _0x114b80=createListener(_0x6045('0x5')+_0x5412f9,_0xd4839a);FaxInteractionEvents['on'](_0x5412f9,_0x114b80);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index f7a4900..c87e825 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 _0xe273=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','destroy','removeTags','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','/:id/download','download','post','create'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xe273,0x1a9));var _0x3e27=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xe273[_0x427d3a];return _0xe5c521;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3e27('0x0'));var timeout=require('connect-timeout');var express=require(_0x3e27('0x1'));var router=express['Router']();var fs_extra=require(_0x3e27('0x2'));var auth=require(_0x3e27('0x3'));var interaction=require(_0x3e27('0x4'));var config=require(_0x3e27('0x5'));var controller=require('./faxInteraction.controller');router[_0x3e27('0x6')]('/',auth[_0x3e27('0x7')](),controller['index']);router[_0x3e27('0x6')](_0x3e27('0x8'),auth['isAuthenticated'](),controller[_0x3e27('0x9')]);router['get'](_0x3e27('0xa'),auth['isAuthenticated'](),controller[_0x3e27('0xb')]);router[_0x3e27('0x6')](_0x3e27('0xc'),auth[_0x3e27('0x7')](),controller['getMessages']);router['get'](_0x3e27('0xd'),auth[_0x3e27('0x7')](),controller[_0x3e27('0xe')]);router[_0x3e27('0xf')]('/',auth[_0x3e27('0x7')](),controller[_0x3e27('0x10')]);router[_0x3e27('0xf')](_0x3e27('0xc'),auth[_0x3e27('0x7')](),controller[_0x3e27('0x11')]);router['post'](_0x3e27('0x12'),auth[_0x3e27('0x7')](),interaction[_0x3e27('0x13')](_0x3e27('0x14'),_0x3e27('0x15')),controller[_0x3e27('0x16')]);router['put'](_0x3e27('0xa'),auth[_0x3e27('0x7')](),interaction['tracked']('fax','faxinteraction:update'),controller['update']);router['delete'](_0x3e27('0xa'),auth[_0x3e27('0x7')](),interaction[_0x3e27('0x13')](_0x3e27('0x14'),'faxinteraction:destroy'),controller[_0x3e27('0x17')]);router['delete'](_0x3e27('0x12'),auth[_0x3e27('0x7')](),controller[_0x3e27('0x18')]);module[_0x3e27('0x19')]=router; \ No newline at end of file +var _0x055c=['post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','faxinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','download'];(function(_0x500786,_0x336717){var _0x185e08=function(_0x35525c){while(--_0x35525c){_0x500786['push'](_0x500786['shift']());}};_0x185e08(++_0x336717);}(_0x055c,0x1ee));var _0xc055=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0x055c[_0x4a93bb];return _0x208468;};'use strict';var multer=require('multer');var util=require(_0xc055('0x0'));var path=require(_0xc055('0x1'));var timeout=require(_0xc055('0x2'));var express=require(_0xc055('0x3'));var router=express['Router']();var fs_extra=require(_0xc055('0x4'));var auth=require(_0xc055('0x5'));var interaction=require(_0xc055('0x6'));var config=require(_0xc055('0x7'));var controller=require('./faxInteraction.controller');router[_0xc055('0x8')]('/',auth[_0xc055('0x9')](),controller[_0xc055('0xa')]);router['get'](_0xc055('0xb'),auth[_0xc055('0x9')](),controller[_0xc055('0xc')]);router[_0xc055('0x8')](_0xc055('0xd'),auth[_0xc055('0x9')](),controller[_0xc055('0xe')]);router['get']('/:id/messages',auth[_0xc055('0x9')](),controller['getMessages']);router[_0xc055('0x8')]('/:id/download',auth[_0xc055('0x9')](),controller[_0xc055('0xf')]);router[_0xc055('0x10')]('/',auth[_0xc055('0x9')](),controller['create']);router[_0xc055('0x10')]('/:id/messages',auth['isAuthenticated'](),controller[_0xc055('0x11')]);router[_0xc055('0x10')](_0xc055('0x12'),auth[_0xc055('0x9')](),interaction[_0xc055('0x13')](_0xc055('0x14'),_0xc055('0x15')),controller[_0xc055('0x16')]);router[_0xc055('0x17')](_0xc055('0xd'),auth[_0xc055('0x9')](),interaction[_0xc055('0x13')](_0xc055('0x14'),_0xc055('0x18')),controller[_0xc055('0x19')]);router['delete'](_0xc055('0xd'),auth[_0xc055('0x9')](),interaction[_0xc055('0x13')]('fax',_0xc055('0x1a')),controller[_0xc055('0x1b')]);router['delete'](_0xc055('0x12'),auth[_0xc055('0x9')](),controller[_0xc055('0x1c')]);module[_0xc055('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 8eb8a9c..bb847a6 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 _0xb66c=['DATE','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x540f85,_0x565acd){var _0x28e97c=function(_0x314c5b){while(--_0x314c5b){_0x540f85['push'](_0x540f85['shift']());}};_0x28e97c(++_0x565acd);}(_0xb66c,0x175));var _0xcb66=function(_0x3fb5ce,_0x267e9a){_0x3fb5ce=_0x3fb5ce-0x0;var _0x2ab306=_0xb66c[_0x3fb5ce];return _0x2ab306;};'use strict';var Sequelize=require(_0xcb66('0x0'));module['exports']={'body':{'type':Sequelize[_0xcb66('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xcb66('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcb66('0x3')]('in',_0xcb66('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xcb66('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xcb66('0x5')]}}; \ No newline at end of file +var _0x524a=['exports','TEXT','medium','ENUM','out','sequelize'];(function(_0x2b18c9,_0x49659f){var _0x8b913c=function(_0x3e0954){while(--_0x3e0954){_0x2b18c9['push'](_0x2b18c9['shift']());}};_0x8b913c(++_0x49659f);}(_0x524a,0xf5));var _0xa524=function(_0x1b8f28,_0x17b475){_0x1b8f28=_0x1b8f28-0x0;var _0x1c298a=_0x524a[_0x1b8f28];return _0x1c298a;};'use strict';var Sequelize=require(_0xa524('0x0'));module[_0xa524('0x1')]={'body':{'type':Sequelize[_0xa524('0x2')](_0xa524('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xa524('0x4')]('in',_0xa524('0x5')),'defaultValue':_0xa524('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b2ecca1..756c5cf 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 _0x667b=['contact','User','fullname','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','get','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','interface','motionChannel','create','CmContact','findOne','ContactId','fax','Attachment','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','http','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','FaxMessage','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rawAttributes','find','body','params','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage'];(function(_0x483d2a,_0x4bffba){var _0x5ba5d5=function(_0x33e56a){while(--_0x33e56a){_0x483d2a['push'](_0x483d2a['shift']());}};_0x5ba5d5(++_0x4bffba);}(_0x667b,0xb7));var _0xb667=function(_0x2bb66c,_0x36c6c6){_0x2bb66c=_0x2bb66c-0x0;var _0x1e0f98=_0x667b[_0x2bb66c];return _0x1e0f98;};'use strict';var emlformat=require(_0xb667('0x0'));var rimraf=require(_0xb667('0x1'));var zipdir=require(_0xb667('0x2'));var jsonpatch=require(_0xb667('0x3'));var rp=require(_0xb667('0x4'));var moment=require(_0xb667('0x5'));var BPromise=require(_0xb667('0x6'));var Mustache=require('mustache');var util=require(_0xb667('0x7'));var path=require(_0xb667('0x8'));var sox=require(_0xb667('0x9'));var csv=require(_0xb667('0xa'));var ejs=require(_0xb667('0xb'));var fs=require('fs');var fs_extra=require(_0xb667('0xc'));var _=require(_0xb667('0xd'));var squel=require(_0xb667('0xe'));var crypto=require(_0xb667('0xf'));var jsforce=require(_0xb667('0x10'));var deskjs=require(_0xb667('0x11'));var toCsv=require(_0xb667('0xa'));var querystring=require('querystring');var Papa=require(_0xb667('0x12'));var Redis=require(_0xb667('0x13'));var authService=require(_0xb667('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb667('0x15'));var hardwareService=require(_0xb667('0x16'));var logger=require(_0xb667('0x17'))(_0xb667('0x18'));var utils=require(_0xb667('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb667('0x1a'));var db=require(_0xb667('0x1b'))['db'];config[_0xb667('0x1c')]=_['defaults'](config[_0xb667('0x1c')],{'host':_0xb667('0x1d'),'port':0x18eb});var socket=require(_0xb667('0x1e'))(new Redis(config[_0xb667('0x1c')]));require(_0xb667('0x1f'))['register'](socket);var jayson=require(_0xb667('0x20'));var client=jayson[_0xb667('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xb667('0x21')][_0xb667('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x12ec23,_0x36213a,_0x26e3c0,_0x254014){return new BPromise(function(_0x4fea74,_0x5d3ab0){var _0xffac7b=_0x254014||client;return _0xffac7b['request'](_0x12ec23,_0x26e3c0)[_0xb667('0x23')](function(_0x110f5f){logger['info'](_0xb667('0x24'),_0x36213a,_0xb667('0x25'));logger[_0xb667('0x26')](_0xb667('0x27'),_0x36213a,_0xb667('0x25'),JSON[_0xb667('0x28')](_0x110f5f));if(_0x110f5f[_0xb667('0x29')]){if(_0x110f5f[_0xb667('0x29')]['code']===0x1f4){logger[_0xb667('0x29')]('FaxMessage,\x20%s,\x20%s',_0x36213a,_0x110f5f['error'][_0xb667('0x2a')]);return _0x5d3ab0(_0x110f5f[_0xb667('0x29')][_0xb667('0x2a')]);}logger[_0xb667('0x29')](_0xb667('0x24'),_0x36213a,_0x110f5f[_0xb667('0x29')][_0xb667('0x2a')]);return _0x4fea74(_0x110f5f[_0xb667('0x29')][_0xb667('0x2a')]);}else{logger[_0xb667('0x2b')]('FaxMessage,\x20%s,\x20%s',_0x36213a,'request\x20sent');_0x4fea74(_0x110f5f[_0xb667('0x2c')][_0xb667('0x2a')]);}})[_0xb667('0x2d')](function(_0x3c4798){logger[_0xb667('0x29')](_0xb667('0x24'),_0x36213a,_0x3c4798);_0x5d3ab0(_0x3c4798);});});}function respondWithStatusCode(_0x1a9676,_0x33159c){_0x33159c=_0x33159c||0xcc;return function(_0x4c6a48){if(_0x4c6a48){return _0x1a9676[_0xb667('0x2e')](_0x33159c);}return _0x1a9676['status'](_0x33159c)[_0xb667('0x2f')]();};}function respondWithResult(_0x291df9,_0x55f204){_0x55f204=_0x55f204||0xc8;return function(_0x450fc1){if(_0x450fc1){return _0x291df9[_0xb667('0x30')](_0x55f204)[_0xb667('0x31')](_0x450fc1);}};}function respondWithFilteredResult(_0x354e81,_0x39a3c2){return function(_0x1edac4){if(_0x1edac4){var _0x460c74=typeof _0x39a3c2[_0xb667('0x32')]===_0xb667('0x33')&&typeof _0x39a3c2['limit']===_0xb667('0x33');var _0x5258f8=_0x1edac4['count'];var _0x3dd3f7=_0x460c74?0x0:_0x39a3c2[_0xb667('0x32')];var _0x512ead=_0x460c74?_0x1edac4['count']:_0x39a3c2[_0xb667('0x32')]+_0x39a3c2['limit'];var _0x3d78ef;if(_0x512ead>=_0x5258f8){_0x512ead=_0x5258f8;_0x3d78ef=0xc8;}else{_0x3d78ef=0xce;}_0x354e81[_0xb667('0x30')](_0x3d78ef);return _0x354e81[_0xb667('0x34')](_0xb667('0x35'),_0x3dd3f7+'-'+_0x512ead+'/'+_0x5258f8)['json'](_0x1edac4);}return null;};}function patchUpdates(_0x54e073){return function(_0x315caf){try{jsonpatch[_0xb667('0x36')](_0x315caf,_0x54e073,!![]);}catch(_0x425642){return BPromise['reject'](_0x425642);}return _0x315caf[_0xb667('0x37')]();};}function saveUpdates(_0x38c59c,_0x3095ce){return function(_0xd1f5c4){if(_0xd1f5c4){return _0xd1f5c4[_0xb667('0x38')](_0x38c59c)['then'](function(_0x57d79d){return _0x57d79d;});}return null;};}function removeEntity(_0x53005f,_0x41e625){return function(_0x578233){if(_0x578233){return _0x578233[_0xb667('0x39')]()[_0xb667('0x23')](function(){_0x53005f[_0xb667('0x30')](0xcc)[_0xb667('0x2f')]();});}};}function handleEntityNotFound(_0x372dbe,_0x48deb6){return function(_0x31bcb0){if(!_0x31bcb0){_0x372dbe[_0xb667('0x2e')](0x194);}return _0x31bcb0;};}function handleError(_0x452289,_0x3a19e4){_0x3a19e4=_0x3a19e4||0x1f4;return function(_0x4a0713){logger[_0xb667('0x29')](_0x4a0713[_0xb667('0x3a')]);if(_0x4a0713[_0xb667('0x3b')]){delete _0x4a0713[_0xb667('0x3b')];}_0x452289['status'](_0x3a19e4)[_0xb667('0x3c')](_0x4a0713);};}exports[_0xb667('0x3d')]=function(_0x23ecb9,_0x8b2770){var _0x1f99e9={},_0x44c4bf={},_0x4a5c80={'count':0x0,'rows':[]};var _0x51f36d=_[_0xb667('0x3e')](db[_0xb667('0x3f')]['rawAttributes'],function(_0xeaaac9){return{'name':_0xeaaac9[_0xb667('0x40')],'type':_0xeaaac9['type'][_0xb667('0x41')]};});_0x44c4bf[_0xb667('0x42')]=_['map'](_0x51f36d,_0xb667('0x3b'));_0x44c4bf[_0xb667('0x43')]=_[_0xb667('0x44')](_0x23ecb9[_0xb667('0x43')]);_0x44c4bf['filters']=_[_0xb667('0x45')](_0x44c4bf['model'],_0x44c4bf[_0xb667('0x43')]);_0x1f99e9[_0xb667('0x46')]=_['intersection'](_0x44c4bf[_0xb667('0x42')],qs[_0xb667('0x47')](_0x23ecb9[_0xb667('0x43')][_0xb667('0x47')]));_0x1f99e9[_0xb667('0x46')]=_0x1f99e9[_0xb667('0x46')][_0xb667('0x48')]?_0x1f99e9[_0xb667('0x46')]:_0x44c4bf[_0xb667('0x42')];if(!_0x23ecb9[_0xb667('0x43')][_0xb667('0x49')](_0xb667('0x4a'))){_0x1f99e9['limit']=qs[_0xb667('0x4b')](_0x23ecb9[_0xb667('0x43')][_0xb667('0x4b')]);_0x1f99e9[_0xb667('0x32')]=qs['offset'](_0x23ecb9[_0xb667('0x43')][_0xb667('0x32')]);}_0x1f99e9[_0xb667('0x4c')]=qs['sort'](_0x23ecb9[_0xb667('0x43')]['sort']);_0x1f99e9[_0xb667('0x4d')]=qs[_0xb667('0x4e')](_[_0xb667('0x4f')](_0x23ecb9['query'],_0x44c4bf['filters']),_0x51f36d);if(_0x23ecb9[_0xb667('0x43')][_0xb667('0x50')]){_0x1f99e9['where']=_[_0xb667('0x51')](_0x1f99e9[_0xb667('0x4d')],{'$or':_[_0xb667('0x3e')](_0x51f36d,function(_0x517fde){if(_0x517fde[_0xb667('0x52')]!==_0xb667('0x53')){var _0x4cac0e={};_0x4cac0e[_0x517fde['name']]={'$like':'%'+_0x23ecb9[_0xb667('0x43')][_0xb667('0x50')]+'%'};return _0x4cac0e;}})});}_0x1f99e9=_[_0xb667('0x51')]({},_0x1f99e9,_0x23ecb9[_0xb667('0x54')]);var _0xb75675={'where':_0x1f99e9['where']};return db[_0xb667('0x3f')][_0xb667('0x55')](_0xb75675)[_0xb667('0x23')](function(_0x1d9ad6){_0x4a5c80[_0xb667('0x55')]=_0x1d9ad6;if(_0x23ecb9['query'][_0xb667('0x56')]){_0x1f99e9[_0xb667('0x57')]=[{'all':!![]}];}return db[_0xb667('0x3f')][_0xb667('0x58')](_0x1f99e9);})['then'](function(_0x32da4b){_0x4a5c80['rows']=_0x32da4b;return _0x4a5c80;})[_0xb667('0x23')](respondWithFilteredResult(_0x8b2770,_0x1f99e9))[_0xb667('0x2d')](handleError(_0x8b2770,null));};exports['show']=function(_0x3abef1,_0x4141e5){var _0x4225aa={'raw':!![],'where':{'id':_0x3abef1['params']['id']}},_0x405072={};_0x405072[_0xb667('0x42')]=_[_0xb667('0x44')](db[_0xb667('0x3f')][_0xb667('0x59')]);_0x405072[_0xb667('0x43')]=_[_0xb667('0x44')](_0x3abef1[_0xb667('0x43')]);_0x405072[_0xb667('0x4e')]=_[_0xb667('0x45')](_0x405072[_0xb667('0x42')],_0x405072[_0xb667('0x43')]);_0x4225aa[_0xb667('0x46')]=_['intersection'](_0x405072[_0xb667('0x42')],qs[_0xb667('0x47')](_0x3abef1[_0xb667('0x43')]['fields']));_0x4225aa[_0xb667('0x46')]=_0x4225aa[_0xb667('0x46')][_0xb667('0x48')]?_0x4225aa[_0xb667('0x46')]:_0x405072[_0xb667('0x42')];if(_0x3abef1[_0xb667('0x43')][_0xb667('0x56')]){_0x4225aa[_0xb667('0x57')]=[{'all':!![]}];}_0x4225aa=_[_0xb667('0x51')]({},_0x4225aa,_0x3abef1[_0xb667('0x54')]);return db[_0xb667('0x3f')][_0xb667('0x5a')](_0x4225aa)['then'](handleEntityNotFound(_0x4141e5,null))['then'](respondWithResult(_0x4141e5,null))[_0xb667('0x2d')](handleError(_0x4141e5,null));};exports[_0xb667('0x38')]=function(_0x300d86,_0x4bf50b){if(_0x300d86[_0xb667('0x5b')]['id']){delete _0x300d86[_0xb667('0x5b')]['id'];}return db[_0xb667('0x3f')][_0xb667('0x5a')]({'where':{'id':_0x300d86[_0xb667('0x5c')]['id']}})[_0xb667('0x23')](handleEntityNotFound(_0x4bf50b,null))[_0xb667('0x23')](saveUpdates(_0x300d86[_0xb667('0x5b')],null))['then'](respondWithResult(_0x4bf50b,null))[_0xb667('0x2d')](handleError(_0x4bf50b,null));};exports[_0xb667('0x39')]=function(_0x53a009,_0x411f34){return db[_0xb667('0x3f')]['find']({'where':{'id':_0x53a009['params']['id']}})[_0xb667('0x23')](handleEntityNotFound(_0x411f34,null))['then'](removeEntity(_0x411f34,null))[_0xb667('0x2d')](handleError(_0x411f34,null));};exports[_0xb667('0x5d')]=function(_0xc399c4,_0x250229){return db[_0xb667('0x3f')][_0xb667('0x5d')]()['then'](respondWithResult(_0x250229,null))[_0xb667('0x2d')](handleError(_0x250229,null));};var interaction_log=require(_0xb667('0x17'))(_0xb667('0x5e'));exports[_0xb667('0x5f')]=function(_0x1c256c,_0x17c612,_0x599354){var _0x4d69df={'agent':{},'channel':'fax'};if(_0x1c256c[_0xb667('0x5b')]['id']){delete _0x1c256c[_0xb667('0x5b')]['id'];}_0x1c256c[_0xb667('0x5b')][_0xb667('0x60')]=!![];_0x1c256c[_0xb667('0x5b')][_0xb667('0x61')]=moment()[_0xb667('0x62')](_0xb667('0x63'));_0x1c256c[_0xb667('0x5b')][_0xb667('0x64')]=_0x1c256c[_0xb667('0x5b')][_0xb667('0x64')]||_0x1c256c[_0xb667('0x65')]['id'];_0x4d69df[_0xb667('0x66')]['id']=_0x1c256c[_0xb667('0x5b')][_0xb667('0x64')];return db[_0xb667('0x3f')][_0xb667('0x5a')]({'where':{'id':_0x1c256c['params']['id'],'UserId':null}})[_0xb667('0x23')](handleEntityNotFound(_0x17c612,null))['then'](saveUpdates(_0x1c256c[_0xb667('0x5b')],null))[_0xb667('0x23')](function(_0x5c22ca){if(_0x5c22ca){_0x4d69df[_0xb667('0x2a')]=_0x5c22ca['get']({'plain':!![]});return db[_0xb667('0x67')]['find']({'where':{'id':_0x5c22ca[_0xb667('0x68')]}});}return null;})[_0xb667('0x23')](handleEntityNotFound(_0x17c612,null))[_0xb667('0x23')](function(_0x119624){if(_0x119624){return _0x119624[_0xb667('0x38')]({'UserId':_0x1c256c[_0xb667('0x5b')][_0xb667('0x64')],'read1stAt':_[_0xb667('0x69')](_0x119624[_0xb667('0x6a')])?moment()[_0xb667('0x62')](_0xb667('0x63')):undefined});}return null;})[_0xb667('0x23')](function(_0x1b75fd){if(_0x1b75fd){_0x4d69df[_0xb667('0x6b')]=_0x1b75fd['get']({'plain':!![]});interaction_log[_0xb667('0x2b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c256c[_0xb667('0x65')]['id'],_0x1c256c[_0xb667('0x65')]['name'],_0x1c256c[_0xb667('0x65')][_0xb667('0x6c')],_0x4d69df['interaction']['id'],_0x1c256c[_0xb667('0x5b')]?JSON[_0xb667('0x28')](_0x1c256c[_0xb667('0x5b')]):_0xb667('0x6d'));return respondWithRpcPromise(_0xb667('0x6e'),'acceptMessage',_0x4d69df);}return null;})[_0xb667('0x23')](function(_0x497437){var _0x31f08d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x497437[_0xb667('0x2a')]['ContactId'];return db['sequelize'][_0xb667('0x43')](_0x31f08d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xb667('0x23')](function(_0x3a3adb){return _0x3a3adb;});})['then'](function(_0x45732c){if(_0x45732c){_0x4d69df[_0xb667('0x2a')][_0xb667('0x6f')]=_0x45732c[0x0];if(!_0x1c256c[_0xb667('0x5b')]['UserId'])return;return db[_0xb667('0x70')][_0xb667('0x5a')]({'where':{'id':_0x1c256c[_0xb667('0x5b')][_0xb667('0x64')],'role':'agent'},'attributes':['id',_0xb667('0x3b'),_0xb667('0x71'),_0xb667('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2f704d){if(!_0x2f704d)return null;_0x4d69df[_0xb667('0x2a')][_0xb667('0x66')]=_0x2f704d;return _0x4d69df;})[_0xb667('0x23')](function(_0x41340d){if(_0x41340d){if(_0x1c256c[_0xb667('0x5b')][_0xb667('0x73')]){_0x4d69df[_0xb667('0x2a')]['interface']=util['format'](_0xb667('0x74'),_0x1c256c[_0xb667('0x65')]['name']);_0x4d69df[_0xb667('0x2a')]['channel']=_0x4d69df[_0xb667('0x75')];_0x4d69df['message']['motionChannel']=_0x4d69df['channel'];_0x4d69df[_0xb667('0x2a')][_0xb667('0x76')]=_0xb667('0x5f');return respondWithRpcPromise('EventManager',_0xb667('0x77'),{'event':_0xb667('0x78'),'message':_0x4d69df[_0xb667('0x2a')]},client9002)[_0xb667('0x23')](function(){return _0x4d69df;});}return _0x4d69df;}return null;})['then'](respondWithResult(_0x17c612,null))[_0xb667('0x2d')](handleError(_0x17c612,null));};var interaction_log=require(_0xb667('0x17'))(_0xb667('0x5e'));exports[_0xb667('0x79')]=function(_0x2a50e4,_0x31e505,_0x2c2c78){var _0x284883={'agent':{},'channel':'fax'};if(_0x2a50e4[_0xb667('0x5b')]['id']){delete _0x2a50e4[_0xb667('0x5b')]['id'];}_0x2a50e4[_0xb667('0x5b')]['UserId']=_0x2a50e4['body'][_0xb667('0x64')]||_0x2a50e4['user']['id'];_0x284883[_0xb667('0x66')]['id']=_0x2a50e4[_0xb667('0x5b')]['UserId'];return db[_0xb667('0x3f')][_0xb667('0x5a')]({'where':{'id':_0x2a50e4[_0xb667('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31e505,null))[_0xb667('0x23')](function(_0x5b07d1){if(_0x5b07d1){_0x284883['message']=_0x5b07d1[_0xb667('0x7a')]({'plain':!![]});return db[_0xb667('0x67')][_0xb667('0x5a')]({'where':{'id':_0x5b07d1[_0xb667('0x68')]}});}return null;})[_0xb667('0x23')](handleEntityNotFound(_0x31e505,null))[_0xb667('0x23')](function(_0x1ae138){if(_0x1ae138){_0x284883[_0xb667('0x6b')]=_0x1ae138[_0xb667('0x7a')]({'plain':!![]});interaction_log[_0xb667('0x2b')](_0xb667('0x7b'),_0x2a50e4[_0xb667('0x65')]['id'],_0x2a50e4[_0xb667('0x65')]['name'],_0x2a50e4[_0xb667('0x65')][_0xb667('0x6c')],_0x284883[_0xb667('0x6b')]['id'],_0x2a50e4[_0xb667('0x5b')]?JSON[_0xb667('0x28')](_0x2a50e4[_0xb667('0x5b')]):'null');return respondWithRpcPromise(_0xb667('0x7c'),_0xb667('0x7d'),_0x284883);}return null;})[_0xb667('0x23')](function(_0x13b676){var _0x2cce9e=_0xb667('0x7e')+_0x13b676[_0xb667('0x2a')]['ContactId'];return db['sequelize'][_0xb667('0x43')](_0x2cce9e,{'type':db['Sequelize'][_0xb667('0x7f')][_0xb667('0x80')],'raw':!![]})['then'](function(_0x1a4658){return _0x1a4658;});})[_0xb667('0x23')](function(_0x525c55){if(_0x525c55){_0x284883[_0xb667('0x2a')][_0xb667('0x6f')]=_0x525c55[0x0];if(!_0x2a50e4['body'][_0xb667('0x64')])return;return db[_0xb667('0x70')][_0xb667('0x5a')]({'where':{'id':_0x2a50e4[_0xb667('0x5b')][_0xb667('0x64')],'role':_0xb667('0x66')},'attributes':['id','name',_0xb667('0x71'),_0xb667('0x72'),'internal'],'raw':!![]});}return null;})[_0xb667('0x23')](function(_0x186f09){if(!_0x186f09)return null;_0x284883['message'][_0xb667('0x66')]=_0x186f09;return _0x284883;})[_0xb667('0x23')](function(_0x1f6d8e){if(_0x1f6d8e){_0x1f6d8e[_0xb667('0x2a')][_0xb667('0x81')]=util[_0xb667('0x62')](_0xb667('0x74'),_0x2a50e4[_0xb667('0x65')][_0xb667('0x3b')]);_0x1f6d8e[_0xb667('0x2a')][_0xb667('0x75')]=_0x284883[_0xb667('0x75')];_0x1f6d8e['message'][_0xb667('0x82')]=_0x284883[_0xb667('0x75')];_0x1f6d8e[_0xb667('0x2a')][_0xb667('0x76')]=_0xb667('0x79');respondWithRpcPromise(_0xb667('0x77'),_0xb667('0x77'),{'event':'rejectmessage','message':_0x1f6d8e['message']},client9002);return _0x284883;}return null;})[_0xb667('0x23')](respondWithResult(_0x31e505,null))[_0xb667('0x2d')](handleError(_0x31e505,null));};exports[_0xb667('0x83')]=function(_0x3120b9,_0x42b2ad){var _0x20a037;return db[_0xb667('0x3f')][_0xb667('0x83')](_0x3120b9[_0xb667('0x5b')],{})[_0xb667('0x23')](function(_0x5afb4e){_0x20a037=_0x5afb4e;return db[_0xb667('0x84')][_0xb667('0x85')]({'where':{'id':_0x20a037[_0xb667('0x86')]}});})[_0xb667('0x23')](function(_0x1f43fb){if(_[_0xb667('0x69')](_0x1f43fb)){return;}else{_0x20a037['fax']=_0x1f43fb[_0xb667('0x87')];return db[_0xb667('0x88')][_0xb667('0x85')]({'where':{'id':_0x20a037['AttachmentId']}});}})[_0xb667('0x23')](function(_0x5ecc73){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xb667('0x69')](_0x3120b9[_0xb667('0x5b')])?undefined:_0x3120b9['body'][_0xb667('0x89')],'path':_[_0xb667('0x69')](_0x5ecc73)?undefined:util[_0xb667('0x62')](_0xb667('0x8a'),_0x5ecc73[_0xb667('0x8b')]),'fax':_['isNil'](_0x20a037['fax'])?undefined:_0x20a037['fax'],'AttachmentId':_0x20a037[_0xb667('0x8c')]},client9002);})[_0xb667('0x23')](respondWithResult(_0x42b2ad,0xc9))[_0xb667('0x2d')](handleError(_0x42b2ad,null));};exports[_0xb667('0x8d')]=function(_0x5cb328,_0x190f36){var _0x5c7b3b=path['join'](config[_0xb667('0x8e')],_0xb667('0x8f'),_0xb667('0x90'),_0xb667('0x91'));return db[_0xb667('0x3f')][_0xb667('0x5a')]({'where':{'id':_0x5cb328[_0xb667('0x5c')]['id']},'include':[{'model':db[_0xb667('0x88')],'as':_0xb667('0x88')}]})['then'](handleEntityNotFound(_0x190f36,null))[_0xb667('0x23')](function(_0x57ba12){if(_0x57ba12){return _0x190f36['download'](path[_0xb667('0x92')](_0x5c7b3b,_0x57ba12[_0xb667('0x88')]['basename']));}})[_0xb667('0x2d')](handleError(_0x190f36,null));}; \ No newline at end of file +var _0x5d1a=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','then','stack','name','map','FaxMessage','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','update','body','find','describe','../../config/logger','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','get','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT','contact','User','fullname','email','internal','agent','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','QueryTypes','interface','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x52524d,_0x49f8c2){var _0x332e9e=function(_0x57e524){while(--_0x57e524){_0x52524d['push'](_0x52524d['shift']());}};_0x332e9e(++_0x49f8c2);}(_0x5d1a,0x87));var _0xa5d1=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x5d1a[_0x495e9f];return _0xb249d2;};'use strict';var emlformat=require(_0xa5d1('0x0'));var rimraf=require(_0xa5d1('0x1'));var zipdir=require(_0xa5d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5d1('0x3'));var moment=require(_0xa5d1('0x4'));var BPromise=require(_0xa5d1('0x5'));var Mustache=require(_0xa5d1('0x6'));var util=require(_0xa5d1('0x7'));var path=require(_0xa5d1('0x8'));var sox=require(_0xa5d1('0x9'));var csv=require(_0xa5d1('0xa'));var ejs=require(_0xa5d1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5d1('0xc'));var squel=require(_0xa5d1('0xd'));var crypto=require(_0xa5d1('0xe'));var jsforce=require(_0xa5d1('0xf'));var deskjs=require(_0xa5d1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5d1('0x11'));var Redis=require(_0xa5d1('0x12'));var authService=require(_0xa5d1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa5d1('0x14'));var hardwareService=require(_0xa5d1('0x15'));var logger=require('../../config/logger')(_0xa5d1('0x16'));var utils=require(_0xa5d1('0x17'));var config=require(_0xa5d1('0x18'));var licenseUtil=require(_0xa5d1('0x19'));var db=require(_0xa5d1('0x1a'))['db'];config[_0xa5d1('0x1b')]=_['defaults'](config[_0xa5d1('0x1b')],{'host':_0xa5d1('0x1c'),'port':0x18eb});var socket=require(_0xa5d1('0x1d'))(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xa5d1('0x1e'));var client=jayson[_0xa5d1('0x1f')][_0xa5d1('0x20')]({'port':0x232c});var client9002=jayson[_0xa5d1('0x1f')][_0xa5d1('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x254768,_0x54f014,_0x615415,_0x4e4109){return new BPromise(function(_0x2f762e,_0x46ab63){var _0x299752=_0x4e4109||client;return _0x299752[_0xa5d1('0x21')](_0x254768,_0x615415)['then'](function(_0x11ddf0){logger[_0xa5d1('0x22')](_0xa5d1('0x23'),_0x54f014,_0xa5d1('0x24'));logger[_0xa5d1('0x25')](_0xa5d1('0x26'),_0x54f014,_0xa5d1('0x24'),JSON['stringify'](_0x11ddf0));if(_0x11ddf0[_0xa5d1('0x27')]){if(_0x11ddf0[_0xa5d1('0x27')]['code']===0x1f4){logger['error'](_0xa5d1('0x23'),_0x54f014,_0x11ddf0[_0xa5d1('0x27')][_0xa5d1('0x28')]);return _0x46ab63(_0x11ddf0[_0xa5d1('0x27')][_0xa5d1('0x28')]);}logger[_0xa5d1('0x27')]('FaxMessage,\x20%s,\x20%s',_0x54f014,_0x11ddf0[_0xa5d1('0x27')][_0xa5d1('0x28')]);return _0x2f762e(_0x11ddf0[_0xa5d1('0x27')][_0xa5d1('0x28')]);}else{logger[_0xa5d1('0x22')](_0xa5d1('0x23'),_0x54f014,'request\x20sent');_0x2f762e(_0x11ddf0[_0xa5d1('0x29')][_0xa5d1('0x28')]);}})['catch'](function(_0x1dddc7){logger[_0xa5d1('0x27')](_0xa5d1('0x23'),_0x54f014,_0x1dddc7);_0x46ab63(_0x1dddc7);});});}function respondWithStatusCode(_0x29b763,_0x21aab9){_0x21aab9=_0x21aab9||0xcc;return function(_0x5ba036){if(_0x5ba036){return _0x29b763[_0xa5d1('0x2a')](_0x21aab9);}return _0x29b763['status'](_0x21aab9)['end']();};}function respondWithResult(_0x19cfb0,_0x48374a){_0x48374a=_0x48374a||0xc8;return function(_0x1a94f5){if(_0x1a94f5){return _0x19cfb0[_0xa5d1('0x2b')](_0x48374a)[_0xa5d1('0x2c')](_0x1a94f5);}};}function respondWithFilteredResult(_0x194d05,_0xa01a0c){return function(_0x53ca18){if(_0x53ca18){var _0x41b121=typeof _0xa01a0c['offset']===_0xa5d1('0x2d')&&typeof _0xa01a0c[_0xa5d1('0x2e')]===_0xa5d1('0x2d');var _0x34b927=_0x53ca18[_0xa5d1('0x2f')];var _0x4663d7=_0x41b121?0x0:_0xa01a0c[_0xa5d1('0x30')];var _0x399272=_0x41b121?_0x53ca18['count']:_0xa01a0c[_0xa5d1('0x30')]+_0xa01a0c[_0xa5d1('0x2e')];var _0x309c3c;if(_0x399272>=_0x34b927){_0x399272=_0x34b927;_0x309c3c=0xc8;}else{_0x309c3c=0xce;}_0x194d05[_0xa5d1('0x2b')](_0x309c3c);return _0x194d05['set'](_0xa5d1('0x31'),_0x4663d7+'-'+_0x399272+'/'+_0x34b927)['json'](_0x53ca18);}return null;};}function patchUpdates(_0x42302c){return function(_0x2d7d0e){try{jsonpatch[_0xa5d1('0x32')](_0x2d7d0e,_0x42302c,!![]);}catch(_0x4e2b0f){return BPromise['reject'](_0x4e2b0f);}return _0x2d7d0e[_0xa5d1('0x33')]();};}function saveUpdates(_0x457f47,_0x11a74e){return function(_0x12f4e2){if(_0x12f4e2){return _0x12f4e2['update'](_0x457f47)['then'](function(_0x226d81){return _0x226d81;});}return null;};}function removeEntity(_0x31047a,_0x583430){return function(_0x4963ca){if(_0x4963ca){return _0x4963ca[_0xa5d1('0x34')]()[_0xa5d1('0x35')](function(){_0x31047a[_0xa5d1('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x340159,_0x5beb10){return function(_0x37469c){if(!_0x37469c){_0x340159[_0xa5d1('0x2a')](0x194);}return _0x37469c;};}function handleError(_0x36addd,_0x4cd768){_0x4cd768=_0x4cd768||0x1f4;return function(_0x4e32b8){logger[_0xa5d1('0x27')](_0x4e32b8[_0xa5d1('0x36')]);if(_0x4e32b8['name']){delete _0x4e32b8[_0xa5d1('0x37')];}_0x36addd[_0xa5d1('0x2b')](_0x4cd768)['send'](_0x4e32b8);};}exports['index']=function(_0x374cc0,_0xeac68e){var _0x288efc={},_0x2ab84e={},_0x18e58d={'count':0x0,'rows':[]};var _0x728e2d=_[_0xa5d1('0x38')](db[_0xa5d1('0x39')][_0xa5d1('0x3a')],function(_0x4bc018){return{'name':_0x4bc018[_0xa5d1('0x3b')],'type':_0x4bc018['type'][_0xa5d1('0x3c')]};});_0x2ab84e[_0xa5d1('0x3d')]=_['map'](_0x728e2d,_0xa5d1('0x37'));_0x2ab84e[_0xa5d1('0x3e')]=_[_0xa5d1('0x3f')](_0x374cc0[_0xa5d1('0x3e')]);_0x2ab84e['filters']=_['intersection'](_0x2ab84e[_0xa5d1('0x3d')],_0x2ab84e[_0xa5d1('0x3e')]);_0x288efc[_0xa5d1('0x40')]=_[_0xa5d1('0x41')](_0x2ab84e['model'],qs[_0xa5d1('0x42')](_0x374cc0['query'][_0xa5d1('0x42')]));_0x288efc[_0xa5d1('0x40')]=_0x288efc[_0xa5d1('0x40')][_0xa5d1('0x43')]?_0x288efc['attributes']:_0x2ab84e[_0xa5d1('0x3d')];if(!_0x374cc0[_0xa5d1('0x3e')][_0xa5d1('0x44')](_0xa5d1('0x45'))){_0x288efc[_0xa5d1('0x2e')]=qs[_0xa5d1('0x2e')](_0x374cc0[_0xa5d1('0x3e')][_0xa5d1('0x2e')]);_0x288efc[_0xa5d1('0x30')]=qs[_0xa5d1('0x30')](_0x374cc0[_0xa5d1('0x3e')]['offset']);}_0x288efc['order']=qs[_0xa5d1('0x46')](_0x374cc0[_0xa5d1('0x3e')]['sort']);_0x288efc[_0xa5d1('0x47')]=qs[_0xa5d1('0x48')](_[_0xa5d1('0x49')](_0x374cc0[_0xa5d1('0x3e')],_0x2ab84e['filters']),_0x728e2d);if(_0x374cc0['query'][_0xa5d1('0x4a')]){_0x288efc[_0xa5d1('0x47')]=_[_0xa5d1('0x4b')](_0x288efc[_0xa5d1('0x47')],{'$or':_[_0xa5d1('0x38')](_0x728e2d,function(_0x3e02a9){if(_0x3e02a9[_0xa5d1('0x4c')]!=='VIRTUAL'){var _0x5e0a8a={};_0x5e0a8a[_0x3e02a9[_0xa5d1('0x37')]]={'$like':'%'+_0x374cc0[_0xa5d1('0x3e')]['filter']+'%'};return _0x5e0a8a;}})});}_0x288efc=_['merge']({},_0x288efc,_0x374cc0[_0xa5d1('0x4d')]);var _0xa61fa9={'where':_0x288efc[_0xa5d1('0x47')]};return db[_0xa5d1('0x39')][_0xa5d1('0x2f')](_0xa61fa9)[_0xa5d1('0x35')](function(_0x40c42e){_0x18e58d['count']=_0x40c42e;if(_0x374cc0[_0xa5d1('0x3e')][_0xa5d1('0x4e')]){_0x288efc[_0xa5d1('0x4f')]=[{'all':!![]}];}return db[_0xa5d1('0x39')]['findAll'](_0x288efc);})[_0xa5d1('0x35')](function(_0x56da6c){_0x18e58d[_0xa5d1('0x50')]=_0x56da6c;return _0x18e58d;})[_0xa5d1('0x35')](respondWithFilteredResult(_0xeac68e,_0x288efc))[_0xa5d1('0x51')](handleError(_0xeac68e,null));};exports[_0xa5d1('0x52')]=function(_0x3caf54,_0x5a6dd3){var _0x31dded={'raw':!![],'where':{'id':_0x3caf54[_0xa5d1('0x53')]['id']}},_0x39fe27={};_0x39fe27[_0xa5d1('0x3d')]=_[_0xa5d1('0x3f')](db[_0xa5d1('0x39')][_0xa5d1('0x3a')]);_0x39fe27['query']=_[_0xa5d1('0x3f')](_0x3caf54[_0xa5d1('0x3e')]);_0x39fe27[_0xa5d1('0x48')]=_[_0xa5d1('0x41')](_0x39fe27['model'],_0x39fe27['query']);_0x31dded[_0xa5d1('0x40')]=_['intersection'](_0x39fe27[_0xa5d1('0x3d')],qs[_0xa5d1('0x42')](_0x3caf54[_0xa5d1('0x3e')][_0xa5d1('0x42')]));_0x31dded[_0xa5d1('0x40')]=_0x31dded['attributes'][_0xa5d1('0x43')]?_0x31dded[_0xa5d1('0x40')]:_0x39fe27['model'];if(_0x3caf54['query'][_0xa5d1('0x4e')]){_0x31dded[_0xa5d1('0x4f')]=[{'all':!![]}];}_0x31dded=_['merge']({},_0x31dded,_0x3caf54['options']);return db['FaxMessage']['find'](_0x31dded)['then'](handleEntityNotFound(_0x5a6dd3,null))[_0xa5d1('0x35')](respondWithResult(_0x5a6dd3,null))[_0xa5d1('0x51')](handleError(_0x5a6dd3,null));};exports[_0xa5d1('0x54')]=function(_0xa2f255,_0x330ee8){if(_0xa2f255[_0xa5d1('0x55')]['id']){delete _0xa2f255[_0xa5d1('0x55')]['id'];}return db[_0xa5d1('0x39')][_0xa5d1('0x56')]({'where':{'id':_0xa2f255[_0xa5d1('0x53')]['id']}})[_0xa5d1('0x35')](handleEntityNotFound(_0x330ee8,null))[_0xa5d1('0x35')](saveUpdates(_0xa2f255[_0xa5d1('0x55')],null))[_0xa5d1('0x35')](respondWithResult(_0x330ee8,null))[_0xa5d1('0x51')](handleError(_0x330ee8,null));};exports[_0xa5d1('0x34')]=function(_0x2603ca,_0x3eb52c){return db['FaxMessage'][_0xa5d1('0x56')]({'where':{'id':_0x2603ca['params']['id']}})[_0xa5d1('0x35')](handleEntityNotFound(_0x3eb52c,null))[_0xa5d1('0x35')](removeEntity(_0x3eb52c,null))[_0xa5d1('0x51')](handleError(_0x3eb52c,null));};exports['describe']=function(_0x197e64,_0x295837){return db[_0xa5d1('0x39')][_0xa5d1('0x57')]()[_0xa5d1('0x35')](respondWithResult(_0x295837,null))[_0xa5d1('0x51')](handleError(_0x295837,null));};var interaction_log=require(_0xa5d1('0x58'))(_0xa5d1('0x59'));exports[_0xa5d1('0x5a')]=function(_0x1ab94a,_0x299bff,_0x56be08){var _0x376ad3={'agent':{},'channel':'fax'};if(_0x1ab94a[_0xa5d1('0x55')]['id']){delete _0x1ab94a[_0xa5d1('0x55')]['id'];}_0x1ab94a[_0xa5d1('0x55')][_0xa5d1('0x5b')]=!![];_0x1ab94a[_0xa5d1('0x55')][_0xa5d1('0x5c')]=moment()[_0xa5d1('0x5d')](_0xa5d1('0x5e'));_0x1ab94a[_0xa5d1('0x55')]['UserId']=_0x1ab94a['body'][_0xa5d1('0x5f')]||_0x1ab94a['user']['id'];_0x376ad3['agent']['id']=_0x1ab94a[_0xa5d1('0x55')][_0xa5d1('0x5f')];return db[_0xa5d1('0x39')][_0xa5d1('0x56')]({'where':{'id':_0x1ab94a[_0xa5d1('0x53')]['id'],'UserId':null}})[_0xa5d1('0x35')](handleEntityNotFound(_0x299bff,null))[_0xa5d1('0x35')](saveUpdates(_0x1ab94a[_0xa5d1('0x55')],null))[_0xa5d1('0x35')](function(_0x2a1dda){if(_0x2a1dda){_0x376ad3[_0xa5d1('0x28')]=_0x2a1dda['get']({'plain':!![]});return db[_0xa5d1('0x60')][_0xa5d1('0x56')]({'where':{'id':_0x2a1dda[_0xa5d1('0x61')]}});}return null;})[_0xa5d1('0x35')](handleEntityNotFound(_0x299bff,null))[_0xa5d1('0x35')](function(_0x5afee1){if(_0x5afee1){return _0x5afee1[_0xa5d1('0x54')]({'UserId':_0x1ab94a[_0xa5d1('0x55')]['UserId'],'read1stAt':_[_0xa5d1('0x62')](_0x5afee1[_0xa5d1('0x63')])?moment()[_0xa5d1('0x5d')](_0xa5d1('0x5e')):undefined});}return null;})[_0xa5d1('0x35')](function(_0x372b14){if(_0x372b14){_0x376ad3[_0xa5d1('0x64')]=_0x372b14[_0xa5d1('0x65')]({'plain':!![]});interaction_log[_0xa5d1('0x22')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1ab94a[_0xa5d1('0x66')]['id'],_0x1ab94a[_0xa5d1('0x66')]['name'],_0x1ab94a[_0xa5d1('0x66')][_0xa5d1('0x67')],_0x376ad3[_0xa5d1('0x64')]['id'],_0x1ab94a['body']?JSON[_0xa5d1('0x68')](_0x1ab94a[_0xa5d1('0x55')]):_0xa5d1('0x69'));return respondWithRpcPromise(_0xa5d1('0x6a'),_0xa5d1('0x6b'),_0x376ad3);}return null;})[_0xa5d1('0x35')](function(_0x3cfb9b){var _0x56e83d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cfb9b[_0xa5d1('0x28')]['ContactId'];return db['sequelize'][_0xa5d1('0x3e')](_0x56e83d,{'type':db['Sequelize']['QueryTypes'][_0xa5d1('0x6c')],'raw':!![]})['then'](function(_0x545f80){return _0x545f80;});})[_0xa5d1('0x35')](function(_0x4e2bd9){if(_0x4e2bd9){_0x376ad3[_0xa5d1('0x28')][_0xa5d1('0x6d')]=_0x4e2bd9[0x0];if(!_0x1ab94a[_0xa5d1('0x55')][_0xa5d1('0x5f')])return;return db[_0xa5d1('0x6e')][_0xa5d1('0x56')]({'where':{'id':_0x1ab94a[_0xa5d1('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0xa5d1('0x37'),_0xa5d1('0x6f'),_0xa5d1('0x70'),_0xa5d1('0x71')],'raw':!![]});}return null;})[_0xa5d1('0x35')](function(_0xf6aab9){if(!_0xf6aab9)return null;_0x376ad3['message'][_0xa5d1('0x72')]=_0xf6aab9;return _0x376ad3;})['then'](function(_0x2be71e){if(_0x2be71e){if(_0x1ab94a['body']['manual']){_0x376ad3[_0xa5d1('0x28')]['interface']=util[_0xa5d1('0x5d')](_0xa5d1('0x73'),_0x1ab94a[_0xa5d1('0x66')]['name']);_0x376ad3[_0xa5d1('0x28')]['channel']=_0x376ad3[_0xa5d1('0x74')];_0x376ad3[_0xa5d1('0x28')][_0xa5d1('0x75')]=_0x376ad3['channel'];_0x376ad3[_0xa5d1('0x28')][_0xa5d1('0x76')]=_0xa5d1('0x5a');return respondWithRpcPromise(_0xa5d1('0x77'),_0xa5d1('0x77'),{'event':_0xa5d1('0x78'),'message':_0x376ad3[_0xa5d1('0x28')]},client9002)[_0xa5d1('0x35')](function(){return _0x376ad3;});}return _0x376ad3;}return null;})[_0xa5d1('0x35')](respondWithResult(_0x299bff,null))['catch'](handleError(_0x299bff,null));};var interaction_log=require(_0xa5d1('0x58'))(_0xa5d1('0x59'));exports[_0xa5d1('0x79')]=function(_0x13f7d4,_0x39afc9,_0x516657){var _0x2d2bda={'agent':{},'channel':_0xa5d1('0x7a')};if(_0x13f7d4[_0xa5d1('0x55')]['id']){delete _0x13f7d4[_0xa5d1('0x55')]['id'];}_0x13f7d4['body'][_0xa5d1('0x5f')]=_0x13f7d4[_0xa5d1('0x55')][_0xa5d1('0x5f')]||_0x13f7d4[_0xa5d1('0x66')]['id'];_0x2d2bda[_0xa5d1('0x72')]['id']=_0x13f7d4[_0xa5d1('0x55')][_0xa5d1('0x5f')];return db[_0xa5d1('0x39')][_0xa5d1('0x56')]({'where':{'id':_0x13f7d4[_0xa5d1('0x53')]['id'],'UserId':null}})[_0xa5d1('0x35')](handleEntityNotFound(_0x39afc9,null))[_0xa5d1('0x35')](function(_0x3704b4){if(_0x3704b4){_0x2d2bda[_0xa5d1('0x28')]=_0x3704b4[_0xa5d1('0x65')]({'plain':!![]});return db[_0xa5d1('0x60')][_0xa5d1('0x56')]({'where':{'id':_0x3704b4['FaxInteractionId']}});}return null;})[_0xa5d1('0x35')](handleEntityNotFound(_0x39afc9,null))[_0xa5d1('0x35')](function(_0x3969dd){if(_0x3969dd){_0x2d2bda['interaction']=_0x3969dd[_0xa5d1('0x65')]({'plain':!![]});interaction_log['info'](_0xa5d1('0x7b'),_0x13f7d4[_0xa5d1('0x66')]['id'],_0x13f7d4['user'][_0xa5d1('0x37')],_0x13f7d4[_0xa5d1('0x66')][_0xa5d1('0x67')],_0x2d2bda[_0xa5d1('0x64')]['id'],_0x13f7d4['body']?JSON[_0xa5d1('0x68')](_0x13f7d4[_0xa5d1('0x55')]):_0xa5d1('0x69'));return respondWithRpcPromise(_0xa5d1('0x7c'),_0xa5d1('0x7d'),_0x2d2bda);}return null;})[_0xa5d1('0x35')](function(_0x3a01d4){var _0x578b63='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3a01d4['message'][_0xa5d1('0x7e')];return db[_0xa5d1('0x7f')][_0xa5d1('0x3e')](_0x578b63,{'type':db[_0xa5d1('0x80')][_0xa5d1('0x81')]['SELECT'],'raw':!![]})[_0xa5d1('0x35')](function(_0x6bd8be){return _0x6bd8be;});})[_0xa5d1('0x35')](function(_0x574a22){if(_0x574a22){_0x2d2bda[_0xa5d1('0x28')][_0xa5d1('0x6d')]=_0x574a22[0x0];if(!_0x13f7d4['body'][_0xa5d1('0x5f')])return;return db[_0xa5d1('0x6e')][_0xa5d1('0x56')]({'where':{'id':_0x13f7d4[_0xa5d1('0x55')]['UserId'],'role':'agent'},'attributes':['id','name',_0xa5d1('0x6f'),_0xa5d1('0x70'),_0xa5d1('0x71')],'raw':!![]});}return null;})['then'](function(_0x35e301){if(!_0x35e301)return null;_0x2d2bda['message'][_0xa5d1('0x72')]=_0x35e301;return _0x2d2bda;})[_0xa5d1('0x35')](function(_0x560445){if(_0x560445){_0x560445[_0xa5d1('0x28')][_0xa5d1('0x82')]=util['format']('SIP/%s',_0x13f7d4[_0xa5d1('0x66')][_0xa5d1('0x37')]);_0x560445[_0xa5d1('0x28')]['channel']=_0x2d2bda[_0xa5d1('0x74')];_0x560445[_0xa5d1('0x28')][_0xa5d1('0x75')]=_0x2d2bda[_0xa5d1('0x74')];_0x560445[_0xa5d1('0x28')]['event']=_0xa5d1('0x79');respondWithRpcPromise(_0xa5d1('0x77'),_0xa5d1('0x77'),{'event':_0xa5d1('0x83'),'message':_0x560445[_0xa5d1('0x28')]},client9002);return _0x2d2bda;}return null;})[_0xa5d1('0x35')](respondWithResult(_0x39afc9,null))[_0xa5d1('0x51')](handleError(_0x39afc9,null));};exports[_0xa5d1('0x84')]=function(_0x2e7a0e,_0x12a8ef){var _0x2da122;return db[_0xa5d1('0x39')][_0xa5d1('0x84')](_0x2e7a0e[_0xa5d1('0x55')],{})['then'](function(_0x2e166e){_0x2da122=_0x2e166e;return db[_0xa5d1('0x85')][_0xa5d1('0x86')]({'where':{'id':_0x2da122[_0xa5d1('0x7e')]}});})[_0xa5d1('0x35')](function(_0x3f093c){if(_[_0xa5d1('0x62')](_0x3f093c)){return;}else{_0x2da122[_0xa5d1('0x7a')]=_0x3f093c[_0xa5d1('0x7a')];return db[_0xa5d1('0x87')][_0xa5d1('0x86')]({'where':{'id':_0x2da122[_0xa5d1('0x88')]}});}})[_0xa5d1('0x35')](function(_0x3998d6){return respondWithRpcPromise(_0xa5d1('0x89'),_0xa5d1('0x89'),{'FaxAccountId':_[_0xa5d1('0x62')](_0x2e7a0e['body'])?undefined:_0x2e7a0e[_0xa5d1('0x55')][_0xa5d1('0x8a')],'path':_[_0xa5d1('0x62')](_0x3998d6)?undefined:util[_0xa5d1('0x5d')]('/var/opt/motion2/server/files/attachments/%s',_0x3998d6[_0xa5d1('0x8b')]),'fax':_[_0xa5d1('0x62')](_0x2da122[_0xa5d1('0x7a')])?undefined:_0x2da122[_0xa5d1('0x7a')],'AttachmentId':_0x2da122['AttachmentId']},client9002);})[_0xa5d1('0x35')](respondWithResult(_0x12a8ef,0xc9))[_0xa5d1('0x51')](handleError(_0x12a8ef,null));};exports[_0xa5d1('0x8c')]=function(_0x4f2680,_0x2d6180){var _0x193f67=path[_0xa5d1('0x8d')](config[_0xa5d1('0x8e')],_0xa5d1('0x8f'),_0xa5d1('0x90'),'attachments');return db[_0xa5d1('0x39')]['find']({'where':{'id':_0x4f2680[_0xa5d1('0x53')]['id']},'include':[{'model':db[_0xa5d1('0x87')],'as':_0xa5d1('0x87')}]})[_0xa5d1('0x35')](handleEntityNotFound(_0x2d6180,null))[_0xa5d1('0x35')](function(_0x771fd6){if(_0x771fd6){return _0x2d6180[_0xa5d1('0x8c')](path[_0xa5d1('0x8d')](_0x193f67,_0x771fd6['Attachment'][_0xa5d1('0x8b')]));}})[_0xa5d1('0x51')](handleError(_0x2d6180,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 78fa620..55edf0a 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 _0x53ec=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x53ec[_0x2ed8f3];return _0x525a55;};'use strict';var EventEmitter=require(_0xc53e('0x0'));var FaxMessage=require(_0xc53e('0x1'))['db'][_0xc53e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc53e('0x3')](0x0);var events={'afterCreate':_0xc53e('0x4'),'afterUpdate':_0xc53e('0x5'),'afterDestroy':'remove'};function emitEvent(_0x266c42){return function(_0x4e954a,_0x2b90f6,_0x38033d){FaxMessageEvents['emit'](_0x266c42+':'+_0x4e954a['id'],_0x4e954a);FaxMessageEvents[_0xc53e('0x6')](_0x266c42,_0x4e954a);_0x38033d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xc53e('0x7')](e,emitEvent(event));}}module[_0xc53e('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xaa37=['../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x56e063,_0x453233){var _0x766fcf=function(_0x59415a){while(--_0x59415a){_0x56e063['push'](_0x56e063['shift']());}};_0x766fcf(++_0x453233);}(_0xaa37,0x1d3));var _0x7aa3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa37[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x7aa3('0x0'));var FaxMessage=require(_0x7aa3('0x1'))['db'][_0x7aa3('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7aa3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7aa3('0x4'),'afterDestroy':_0x7aa3('0x5')};function emitEvent(_0x27333d){return function(_0x11e64c,_0x334919,_0x2801a2){FaxMessageEvents[_0x7aa3('0x6')](_0x27333d+':'+_0x11e64c['id'],_0x11e64c);FaxMessageEvents['emit'](_0x27333d,_0x11e64c);_0x2801a2(null);};}for(var e in events){if(events[_0x7aa3('0x7')](e)){var event=events[e];FaxMessage[_0x7aa3('0x8')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 95f108c..b77cf9f 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 _0xe340=['then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','../../config/environment','./faxMessage.attributes','exports','FaxMessage','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x32df9c,_0x36341c){var _0x56ee5d=function(_0x148ee6){while(--_0x148ee6){_0x32df9c['push'](_0x32df9c['shift']());}};_0x56ee5d(++_0x36341c);}(_0xe340,0x1d7));var _0x0e34=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe340[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x0e34('0x0'));var util=require(_0x0e34('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0e34('0x2'));var BPromise=require(_0x0e34('0x3'));var rp=require(_0x0e34('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e34('0x5'));var attributes=require(_0x0e34('0x6'));module[_0x0e34('0x7')]=function(_0x5d85f7,_0x477b5a){return _0x5d85f7['define'](_0x0e34('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x0e34('0x9')],'type':_0x0e34('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31d8a6,_0x15be05,_0x37cb33){var _0x3530ac=_0x5d85f7[_0x0e34('0xb')];var _0x1974a2=_0x31d8a6[_0x0e34('0xc')]({'plain':!![]});if(_0x1974a2['direction'][_0x0e34('0xd')]()==='in'||_0x1974a2[_0x0e34('0xe')][_0x0e34('0xd')]()===_0x0e34('0xf')&&!_0x1974a2[_0x0e34('0x10')]&&!_[_0x0e34('0x11')](_0x1974a2[_0x0e34('0x12')])){_0x3530ac[_0x0e34('0x13')][_0x0e34('0x14')]({'where':{'id':_0x1974a2[_0x0e34('0x15')]}})[_0x0e34('0x16')](function(_0x3d2328){if(_0x3d2328){_0x3d2328[_0x0e34('0x17')]({'lastMsgAt':_0x1974a2[_0x0e34('0x18')],'lastMsgDirection':_0x1974a2['direction']['toLowerCase']()});}})[_0x0e34('0x19')](function(_0x57fcb1){console[_0x0e34('0x1a')](_0x57fcb1);});}_0x37cb33();}},'charset':_0x0e34('0x1b'),'collate':_0x0e34('0x1c')});}; \ No newline at end of file +var _0x8ec5=['toLowerCase','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','lodash','util','../../config/logger','moment','path','exports','define','FaxMessage','body','models','get','direction'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x8ec5,0x112));var _0x58ec=function(_0x3245a4,_0xf0bb20){_0x3245a4=_0x3245a4-0x0;var _0x450932=_0x8ec5[_0x3245a4];return _0x450932;};'use strict';var _=require(_0x58ec('0x0'));var util=require(_0x58ec('0x1'));var logger=require(_0x58ec('0x2'))('api');var moment=require(_0x58ec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ec('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x58ec('0x5')]=function(_0x183227,_0x1ada0a){return _0x183227[_0x58ec('0x6')](_0x58ec('0x7'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x58ec('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x111800,_0x2a16bb,_0x40bba3){var _0x269ade=_0x183227[_0x58ec('0x9')];var _0x2c64e0=_0x111800[_0x58ec('0xa')]({'plain':!![]});if(_0x2c64e0[_0x58ec('0xb')][_0x58ec('0xc')]()==='in'||_0x2c64e0['direction'][_0x58ec('0xc')]()==='out'&&!_0x2c64e0[_0x58ec('0xd')]&&!_[_0x58ec('0xe')](_0x2c64e0[_0x58ec('0xf')])){_0x269ade['FaxInteraction'][_0x58ec('0x10')]({'where':{'id':_0x2c64e0['FaxInteractionId']}})[_0x58ec('0x11')](function(_0xae9a1c){if(_0xae9a1c){_0xae9a1c[_0x58ec('0x12')]({'lastMsgAt':_0x2c64e0[_0x58ec('0x13')],'lastMsgDirection':_0x2c64e0['direction'][_0x58ec('0xc')]()});}})[_0x58ec('0x14')](function(_0x3ace5a){console[_0x58ec('0x15')](_0x3ace5a);});}_0x40bba3();}},'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 5a8d8f7..ec52aec 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','CreateFaxMessage','FaxMessage','body','raw','then','debug','catch','UpdateFaxMessage','update','options','where','attributes','limit'];(function(_0x457efd,_0x41a3bd){var _0x2f76de=function(_0xd0d8b){while(--_0xd0d8b){_0x457efd['push'](_0x457efd['shift']());}};_0x2f76de(++_0x41a3bd);}(_0x9f62,0x154));var _0x29f6=function(_0x2ae1f6,_0x2fc00a){_0x2ae1f6=_0x2ae1f6-0x0;var _0x4228f8=_0x9f62[_0x2ae1f6];return _0x4228f8;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});config[_0x29f6('0x9')]=_[_0x29f6('0xa')](config[_0x29f6('0x9')],{'host':_0x29f6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0xe25841,_0x44db16,_0x4fb455){return new BPromise(function(_0x5a0724,_0x29b3f5){return client[_0x29f6('0xc')](_0xe25841,_0x4fb455)['then'](function(_0x17b69c){logger[_0x29f6('0xd')]('FaxMessage,\x20%s,\x20%s',_0x44db16,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'),JSON[_0x29f6('0xf')](_0x17b69c));if(_0x17b69c[_0x29f6('0x10')]){if(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x11')]===0x1f4){logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x29b3f5(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}logger[_0x29f6('0x10')](_0x29f6('0x12'),_0x44db16,_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);return _0x5a0724(_0x17b69c[_0x29f6('0x10')][_0x29f6('0x13')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x44db16,_0x29f6('0xe'));_0x5a0724(_0x17b69c[_0x29f6('0x14')][_0x29f6('0x13')]);}})['catch'](function(_0xcb90){logger[_0x29f6('0x10')]('FaxMessage,\x20%s,\x20%s',_0x44db16,_0xcb90);_0x29b3f5(_0xcb90);});});}exports[_0x29f6('0x15')]=function(_0x3e81af){var _0x42a8fa=this;return new Promise(function(_0x41b9f0,_0xb6e7a9){return db[_0x29f6('0x16')]['create'](_0x3e81af[_0x29f6('0x17')],{'raw':_0x3e81af['options']?_0x3e81af['options'][_0x29f6('0x18')]===undefined?!![]:![]:!![]})[_0x29f6('0x19')](function(_0x39c6b3){logger[_0x29f6('0xd')]('CreateFaxMessage',_0x3e81af);logger[_0x29f6('0x1a')]('CreateFaxMessage',_0x3e81af,JSON[_0x29f6('0xf')](_0x39c6b3));_0x41b9f0(_0x39c6b3);})[_0x29f6('0x1b')](function(_0x4200cc){logger[_0x29f6('0x10')]('CreateFaxMessage',_0x4200cc[_0x29f6('0x13')],_0x3e81af);_0xb6e7a9(_0x42a8fa[_0x29f6('0x10')](0x1f4,_0x4200cc['message']));});});};exports[_0x29f6('0x1c')]=function(_0x45f792){var _0x2519ac=this;return new Promise(function(_0x342038,_0x84ccb7){return db[_0x29f6('0x16')][_0x29f6('0x1d')](_0x45f792['body'],{'raw':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x1f')]||null:null,'attributes':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x20')]||null:null,'limit':_0x45f792[_0x29f6('0x1e')]?_0x45f792[_0x29f6('0x1e')][_0x29f6('0x21')]||null:null})[_0x29f6('0x19')](function(_0x304c28){logger[_0x29f6('0xd')](_0x29f6('0x1c'),_0x45f792);logger[_0x29f6('0x1a')]('UpdateFaxMessage',_0x45f792,JSON['stringify'](_0x304c28));_0x342038(_0x304c28);})[_0x29f6('0x1b')](function(_0x489897){logger[_0x29f6('0x10')](_0x29f6('0x1c'),_0x489897[_0x29f6('0x13')],_0x45f792);_0x84ccb7(_0x2519ac[_0x29f6('0x10')](0x1f4,_0x489897['message']));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x4d9b4c,_0x242b7e){var _0x1ddb17=function(_0x524964){while(--_0x524964){_0x4d9b4c['push'](_0x4d9b4c['shift']());}};_0x1ddb17(++_0x242b7e);}(_0xac31,0xca));var _0x1ac3=function(_0x5b2582,_0x26be0f){_0x5b2582=_0x5b2582-0x0;var _0x14538e=_0xac31[_0x5b2582];return _0x14538e;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 87ab792..5d7c044 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 _0x6d74=['./faxMessage.events','save','removeListener','register','length','faxMessage:'];(function(_0x28e8be,_0x471f71){var _0x758d19=function(_0x4d12dd){while(--_0x4d12dd){_0x28e8be['push'](_0x28e8be['shift']());}};_0x758d19(++_0x471f71);}(_0x6d74,0x192));var _0x46d7=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x6d74[_0x50007c];return _0x5c1ec7;};'use strict';var FaxMessageEvents=require(_0x46d7('0x0'));var events=[_0x46d7('0x1'),'remove','update'];function createListener(_0x3228fe,_0xdd6265){return function(_0x445c4a){_0xdd6265['emit'](_0x3228fe,_0x445c4a);};}function removeListener(_0x5ea490,_0xe01f4d){return function(){FaxMessageEvents[_0x46d7('0x2')](_0x5ea490,_0xe01f4d);};}exports[_0x46d7('0x3')]=function(_0x51ad2a){for(var _0x187230=0x0,_0x5aca8c=events[_0x46d7('0x4')];_0x187230<_0x5aca8c;_0x187230++){var _0x3e184e=events[_0x187230];var _0x61744d=createListener(_0x46d7('0x5')+_0x3e184e,_0x51ad2a);FaxMessageEvents['on'](_0x3e184e,_0x61744d);}}; \ No newline at end of file +var _0xee91=['./faxMessage.events','remove','update','emit','removeListener','length','faxMessage:'];(function(_0x2e250d,_0x547560){var _0x3b71df=function(_0x6b1e9f){while(--_0x6b1e9f){_0x2e250d['push'](_0x2e250d['shift']());}};_0x3b71df(++_0x547560);}(_0xee91,0xfc));var _0x1ee9=function(_0xcd2dad,_0x12e3db){_0xcd2dad=_0xcd2dad-0x0;var _0x3677bd=_0xee91[_0xcd2dad];return _0x3677bd;};'use strict';var FaxMessageEvents=require(_0x1ee9('0x0'));var events=['save',_0x1ee9('0x1'),_0x1ee9('0x2')];function createListener(_0x1e0430,_0x4959d4){return function(_0x1e5cbd){_0x4959d4[_0x1ee9('0x3')](_0x1e0430,_0x1e5cbd);};}function removeListener(_0x2e56fa,_0x2b8b36){return function(){FaxMessageEvents[_0x1ee9('0x4')](_0x2e56fa,_0x2b8b36);};}exports['register']=function(_0x8bb6d6){for(var _0x138edb=0x0,_0x31f08d=events[_0x1ee9('0x5')];_0x138edb<_0x31f08d;_0x138edb++){var _0x472e42=events[_0x138edb];var _0x1e7bfb=createListener(_0x1ee9('0x6')+_0x472e42,_0x8bb6d6);FaxMessageEvents['on'](_0x472e42,_0x1e7bfb);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 845f867..e169249 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 _0x91a7=['isAuthenticated','/:id','show','download','tracked','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','get','index','/describe'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x91a7,0xe7));var _0x791a=function(_0x37acf0,_0x44e56a){_0x37acf0=_0x37acf0-0x0;var _0x4d4c29=_0x91a7[_0x37acf0];return _0x4d4c29;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['describe']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/download',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['post']('/',auth[_0x791a('0x9')](),interaction[_0x791a('0xd')](_0x791a('0xe'),_0x791a('0xf')),controller[_0x791a('0x10')]);router[_0x791a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x791a('0x12')]);router[_0x791a('0x11')]('/:id/accept',auth[_0x791a('0x9')](),controller[_0x791a('0x13')]);router['put'](_0x791a('0x14'),auth[_0x791a('0x9')](),controller[_0x791a('0x15')]);router[_0x791a('0x16')]('/:id',auth[_0x791a('0x9')](),controller['destroy']);module[_0x791a('0x17')]=router; \ No newline at end of file +var _0xb43b=['update','/:id/reject','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','create','put'];(function(_0x334b2d,_0x5fb924){var _0x5f2537=function(_0x5eb786){while(--_0x5eb786){_0x334b2d['push'](_0x334b2d['shift']());}};_0x5f2537(++_0x5fb924);}(_0xb43b,0x1b2));var _0xbb43=function(_0x76d91a,_0xb1761e){_0x76d91a=_0x76d91a-0x0;var _0x5b6b95=_0xb43b[_0x76d91a];return _0x5b6b95;};'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/download',auth[_0xbb43('0xb')](),controller[_0xbb43('0x10')]);router[_0xbb43('0x11')]('/',auth[_0xbb43('0xb')](),interaction[_0xbb43('0x12')](_0xbb43('0x13'),'faxmessage:create'),controller[_0xbb43('0x14')]);router[_0xbb43('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xbb43('0x16')]);router['put']('/:id/accept',auth[_0xbb43('0xb')](),controller['accept']);router[_0xbb43('0x15')](_0xbb43('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xbb43('0xe'),auth[_0xbb43('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 2bc1e1d..f345698 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 _0xc61d=['exports','STRING','name','INTEGER','rrmemory','beepall','sequelize'];(function(_0x3b3933,_0x4a5bd2){var _0x41d2c4=function(_0x4f295d){while(--_0x4f295d){_0x3b3933['push'](_0x3b3933['shift']());}};_0x41d2c4(++_0x4a5bd2);}(_0xc61d,0xfb));var _0xdc61=function(_0x2d5f85,_0x48f855){_0x2d5f85=_0x2d5f85-0x0;var _0x3d7eb8=_0xc61d[_0x2d5f85];return _0x3d7eb8;};'use strict';var Sequelize=require(_0xdc61('0x0'));module[_0xdc61('0x1')]={'name':{'type':Sequelize[_0xdc61('0x2')],'unique':_0xdc61('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdc61('0x2')]},'timeout':{'type':Sequelize[_0xdc61('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdc61('0x5'),_0xdc61('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xdc61('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c1a=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x390bd8,_0x32e2a7){var _0x41fdd8=function(_0x4d9334){while(--_0x4d9334){_0x390bd8['push'](_0x390bd8['shift']());}};_0x41fdd8(++_0x32e2a7);}(_0x1c1a,0x1f1));var _0xa1c1=function(_0x2b0f4a,_0x38b501){_0x2b0f4a=_0x2b0f4a-0x0;var _0x483605=_0x1c1a[_0x2b0f4a];return _0x483605;};'use strict';var Sequelize=require(_0xa1c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c1('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa1c1('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa1c1('0x3')](_0xa1c1('0x4'),_0xa1c1('0x5'),_0xa1c1('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa1c1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 64821e4..4a602c5 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 _0xda18=['field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','TeamId','includes','all','compact','value','removeTeams','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','FaxQueues','UserProfileResource','sendStatus','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','describe','getMembers','findOne','UserFaxQueue','where','FaxQueueId','User','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','length','addTeams','ids','voicePause','interface','flatMap','transaction','findOrCreate','forEach','select'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xda18,0x137));var _0x8da1=function(_0x592f1d,_0x511aac){_0x592f1d=_0x592f1d-0x0;var _0x3696df=_0xda18[_0x592f1d];return _0x3696df;};'use strict';var emlformat=require(_0x8da1('0x0'));var rimraf=require(_0x8da1('0x1'));var zipdir=require(_0x8da1('0x2'));var jsonpatch=require(_0x8da1('0x3'));var rp=require(_0x8da1('0x4'));var moment=require(_0x8da1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8da1('0x6'));var util=require(_0x8da1('0x7'));var path=require('path');var sox=require(_0x8da1('0x8'));var csv=require(_0x8da1('0x9'));var ejs=require(_0x8da1('0xa'));var fs=require('fs');var fs_extra=require(_0x8da1('0xb'));var _=require(_0x8da1('0xc'));var squel=require(_0x8da1('0xd'));var crypto=require('crypto');var jsforce=require(_0x8da1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8da1('0xf'));var Papa=require(_0x8da1('0x10'));var Redis=require('ioredis');var authService=require(_0x8da1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8da1('0x12'));var logger=require(_0x8da1('0x13'))('api');var utils=require(_0x8da1('0x14'));var config=require(_0x8da1('0x15'));var licenseUtil=require(_0x8da1('0x16'));var db=require(_0x8da1('0x17'))['db'];config[_0x8da1('0x18')]=_['defaults'](config[_0x8da1('0x18')],{'host':_0x8da1('0x19'),'port':0x18eb});var socket=require(_0x8da1('0x1a'))(new Redis(config[_0x8da1('0x18')]));require(_0x8da1('0x1b'))[_0x8da1('0x1c')](socket);function respondWithStatusCode(_0x47e341,_0x324caa){_0x324caa=_0x324caa||0xcc;return function(_0x253f96){if(_0x253f96){return _0x47e341['sendStatus'](_0x324caa);}return _0x47e341['status'](_0x324caa)[_0x8da1('0x1d')]();};}function respondWithResult(_0x398caf,_0x5cc1e9){_0x5cc1e9=_0x5cc1e9||0xc8;return function(_0x410fca){if(_0x410fca){return _0x398caf[_0x8da1('0x1e')](_0x5cc1e9)[_0x8da1('0x1f')](_0x410fca);}};}function respondWithFilteredResult(_0x1c482c,_0x4e1288){return function(_0x114881){if(_0x114881){var _0x2c41d5=typeof _0x4e1288[_0x8da1('0x20')]===_0x8da1('0x21')&&typeof _0x4e1288['limit']===_0x8da1('0x21');var _0x352772=_0x114881[_0x8da1('0x22')];var _0x44364d=_0x2c41d5?0x0:_0x4e1288[_0x8da1('0x20')];var _0x517e9b=_0x2c41d5?_0x114881[_0x8da1('0x22')]:_0x4e1288[_0x8da1('0x20')]+_0x4e1288[_0x8da1('0x23')];var _0x18a9a1;if(_0x517e9b>=_0x352772){_0x517e9b=_0x352772;_0x18a9a1=0xc8;}else{_0x18a9a1=0xce;}_0x1c482c[_0x8da1('0x1e')](_0x18a9a1);return _0x1c482c[_0x8da1('0x24')](_0x8da1('0x25'),_0x44364d+'-'+_0x517e9b+'/'+_0x352772)[_0x8da1('0x1f')](_0x114881);}return null;};}function patchUpdates(_0x284382){return function(_0x135fb6){try{jsonpatch[_0x8da1('0x26')](_0x135fb6,_0x284382,!![]);}catch(_0x10d700){return BPromise[_0x8da1('0x27')](_0x10d700);}return _0x135fb6[_0x8da1('0x28')]();};}function saveUpdates(_0x37f62c,_0x96c53d){return function(_0x360eba){if(_0x360eba){return _0x360eba[_0x8da1('0x29')](_0x37f62c)[_0x8da1('0x2a')](function(_0x96ffaf){return _0x96ffaf;});}return null;};}function removeEntity(_0x19a74a,_0x5469e9){return function(_0x493205){if(_0x493205){return _0x493205[_0x8da1('0x2b')]()[_0x8da1('0x2a')](function(){var _0x3f53cb=_0x493205['get']({'plain':!![]});var _0x334d47=_0x8da1('0x2c');return db[_0x8da1('0x2d')][_0x8da1('0x2b')]({'where':{'type':_0x334d47,'resourceId':_0x3f53cb['id']}})[_0x8da1('0x2a')](function(){return _0x493205;});})[_0x8da1('0x2a')](function(){_0x19a74a[_0x8da1('0x1e')](0xcc)[_0x8da1('0x1d')]();});}};}function handleEntityNotFound(_0x485270,_0xf6bd74){return function(_0x4731aa){if(!_0x4731aa){_0x485270[_0x8da1('0x2e')](0x194);}return _0x4731aa;};}function handleError(_0xa33f19,_0x3d86a1){_0x3d86a1=_0x3d86a1||0x1f4;return function(_0x3fe7c4){logger['error'](_0x3fe7c4[_0x8da1('0x2f')]);if(_0x3fe7c4['name']){delete _0x3fe7c4[_0x8da1('0x30')];}_0xa33f19['status'](_0x3d86a1)[_0x8da1('0x31')](_0x3fe7c4);};}exports['index']=function(_0x41d6da,_0x1c38b0){var _0x11908f={},_0x3acf1a={},_0x343def={'count':0x0,'rows':[]};var _0x5cc8b5=_[_0x8da1('0x32')](db[_0x8da1('0x33')][_0x8da1('0x34')],function(_0x52942a){return{'name':_0x52942a[_0x8da1('0x35')],'type':_0x52942a[_0x8da1('0x36')]['key']};});_0x3acf1a[_0x8da1('0x37')]=_['map'](_0x5cc8b5,_0x8da1('0x30'));_0x3acf1a[_0x8da1('0x38')]=_[_0x8da1('0x39')](_0x41d6da[_0x8da1('0x38')]);_0x3acf1a[_0x8da1('0x3a')]=_['intersection'](_0x3acf1a[_0x8da1('0x37')],_0x3acf1a['query']);_0x11908f[_0x8da1('0x3b')]=_[_0x8da1('0x3c')](_0x3acf1a['model'],qs[_0x8da1('0x3d')](_0x41d6da[_0x8da1('0x38')][_0x8da1('0x3d')]));_0x11908f[_0x8da1('0x3b')]=_0x11908f[_0x8da1('0x3b')]['length']?_0x11908f[_0x8da1('0x3b')]:_0x3acf1a[_0x8da1('0x37')];if(!_0x41d6da[_0x8da1('0x38')][_0x8da1('0x3e')](_0x8da1('0x3f'))){_0x11908f[_0x8da1('0x23')]=qs[_0x8da1('0x23')](_0x41d6da[_0x8da1('0x38')][_0x8da1('0x23')]);_0x11908f[_0x8da1('0x20')]=qs[_0x8da1('0x20')](_0x41d6da[_0x8da1('0x38')][_0x8da1('0x20')]);}_0x11908f[_0x8da1('0x40')]=qs[_0x8da1('0x41')](_0x41d6da[_0x8da1('0x38')][_0x8da1('0x41')]);_0x11908f['where']=qs[_0x8da1('0x3a')](_[_0x8da1('0x42')](_0x41d6da[_0x8da1('0x38')],_0x3acf1a[_0x8da1('0x3a')]),_0x5cc8b5);if(_0x41d6da[_0x8da1('0x38')][_0x8da1('0x43')]){_0x11908f['where']=_['merge'](_0x11908f['where'],{'$or':_[_0x8da1('0x32')](_0x5cc8b5,function(_0xac1b9b){if(_0xac1b9b[_0x8da1('0x36')]!==_0x8da1('0x44')){var _0x9ee1d5={};_0x9ee1d5[_0xac1b9b['name']]={'$like':'%'+_0x41d6da[_0x8da1('0x38')][_0x8da1('0x43')]+'%'};return _0x9ee1d5;}})});}_0x11908f=_[_0x8da1('0x45')]({},_0x11908f,_0x41d6da[_0x8da1('0x46')]);var _0x4fe12e={'where':_0x11908f['where']};return db[_0x8da1('0x33')][_0x8da1('0x22')](_0x4fe12e)[_0x8da1('0x2a')](function(_0xc45883){_0x343def[_0x8da1('0x22')]=_0xc45883;if(_0x41d6da[_0x8da1('0x38')][_0x8da1('0x47')]){_0x11908f[_0x8da1('0x48')]=[{'all':!![]}];}return db[_0x8da1('0x33')][_0x8da1('0x49')](_0x11908f);})[_0x8da1('0x2a')](function(_0x5f03fc){_0x343def[_0x8da1('0x4a')]=_0x5f03fc;return _0x343def;})[_0x8da1('0x2a')](respondWithFilteredResult(_0x1c38b0,_0x11908f))[_0x8da1('0x4b')](handleError(_0x1c38b0,null));};exports[_0x8da1('0x4c')]=function(_0x195780,_0x2b2ea8){var _0x2d7f96={'raw':!![],'where':{'id':_0x195780[_0x8da1('0x4d')]['id']}},_0x92d48={};_0x92d48['model']=_[_0x8da1('0x39')](db[_0x8da1('0x33')]['rawAttributes']);_0x92d48['query']=_[_0x8da1('0x39')](_0x195780['query']);_0x92d48[_0x8da1('0x3a')]=_['intersection'](_0x92d48[_0x8da1('0x37')],_0x92d48[_0x8da1('0x38')]);_0x2d7f96[_0x8da1('0x3b')]=_[_0x8da1('0x3c')](_0x92d48[_0x8da1('0x37')],qs[_0x8da1('0x3d')](_0x195780[_0x8da1('0x38')][_0x8da1('0x3d')]));_0x2d7f96[_0x8da1('0x3b')]=_0x2d7f96[_0x8da1('0x3b')]['length']?_0x2d7f96[_0x8da1('0x3b')]:_0x92d48['model'];if(_0x195780[_0x8da1('0x38')][_0x8da1('0x47')]){_0x2d7f96[_0x8da1('0x48')]=[{'all':!![]}];}_0x2d7f96=_[_0x8da1('0x45')]({},_0x2d7f96,_0x195780[_0x8da1('0x46')]);return db[_0x8da1('0x33')][_0x8da1('0x4e')](_0x2d7f96)[_0x8da1('0x2a')](handleEntityNotFound(_0x2b2ea8,null))[_0x8da1('0x2a')](respondWithResult(_0x2b2ea8,null))[_0x8da1('0x4b')](handleError(_0x2b2ea8,null));};exports[_0x8da1('0x4f')]=function(_0xc2294,_0x3267c2){return db[_0x8da1('0x33')]['create'](_0xc2294[_0x8da1('0x50')],{})[_0x8da1('0x2a')](function(_0x9b1459){var _0x4e368c=_0xc2294[_0x8da1('0x51')]['get']({'plain':!![]});if(!_0x4e368c)throw new Error(_0x8da1('0x52'));if(_0x4e368c[_0x8da1('0x53')]===_0x8da1('0x51')){var _0x55f458=_0x9b1459[_0x8da1('0x54')]({'plain':!![]});var _0x16f198=_0x8da1('0x2c');return db[_0x8da1('0x55')]['find']({'where':{'name':_0x16f198,'userProfileId':_0x4e368c[_0x8da1('0x56')]},'raw':!![]})[_0x8da1('0x2a')](function(_0x1f5e4e){if(_0x1f5e4e&&_0x1f5e4e['autoAssociation']===0x0){return db[_0x8da1('0x2d')][_0x8da1('0x4f')]({'name':_0x55f458[_0x8da1('0x30')],'resourceId':_0x55f458['id'],'type':_0x1f5e4e[_0x8da1('0x30')],'sectionId':_0x1f5e4e['id']},{})[_0x8da1('0x2a')](function(){return _0x9b1459;});}else{return _0x9b1459;}})['catch'](function(_0x3d1dc9){logger[_0x8da1('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d1dc9);throw _0x3d1dc9;});}return _0x9b1459;})[_0x8da1('0x2a')](respondWithResult(_0x3267c2,0xc9))[_0x8da1('0x4b')](handleError(_0x3267c2,null));};exports[_0x8da1('0x29')]=function(_0x5e8dfa,_0x4599da){if(_0x5e8dfa[_0x8da1('0x50')]['id']){delete _0x5e8dfa[_0x8da1('0x50')]['id'];}return db[_0x8da1('0x33')][_0x8da1('0x4e')]({'where':{'id':_0x5e8dfa['params']['id']}})['then'](handleEntityNotFound(_0x4599da,null))[_0x8da1('0x2a')](saveUpdates(_0x5e8dfa['body'],null))['then'](respondWithResult(_0x4599da,null))[_0x8da1('0x4b')](handleError(_0x4599da,null));};exports['destroy']=function(_0x4e35fe,_0x1d11ea){return db[_0x8da1('0x33')][_0x8da1('0x4e')]({'where':{'id':_0x4e35fe[_0x8da1('0x4d')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x1d11ea,null))[_0x8da1('0x2a')](removeEntity(_0x1d11ea,null))[_0x8da1('0x4b')](handleError(_0x1d11ea,null));};exports[_0x8da1('0x58')]=function(_0x1dfff0,_0x4de4ab){return db[_0x8da1('0x33')][_0x8da1('0x58')]()[_0x8da1('0x2a')](respondWithResult(_0x4de4ab,null))[_0x8da1('0x4b')](handleError(_0x4de4ab,null));};exports[_0x8da1('0x59')]=function(_0x2ebfbc,_0x57bbb7,_0x49e7b3){var _0x4d30e3={'raw':!![],'where':{}},_0x161e6b={},_0x2bff29;return db['FaxQueue'][_0x8da1('0x5a')]({'where':{'id':_0x2ebfbc[_0x8da1('0x4d')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x57bbb7,null))['then'](function(_0x3ea20b){if(_0x3ea20b){_0x2bff29=_0x3ea20b[_0x8da1('0x54')]({'plain':!![]});_0x161e6b['model']=_[_0x8da1('0x39')](db[_0x8da1('0x5b')][_0x8da1('0x34')]);_0x161e6b[_0x8da1('0x38')]=_[_0x8da1('0x39')](_0x2ebfbc[_0x8da1('0x38')]);_0x161e6b[_0x8da1('0x3a')]=_[_0x8da1('0x3c')](_0x161e6b['model'],_0x161e6b[_0x8da1('0x38')]);_0x4d30e3[_0x8da1('0x3b')]=_['intersection'](_0x161e6b[_0x8da1('0x37')],qs[_0x8da1('0x3d')](_0x2ebfbc['query'][_0x8da1('0x3d')]));_0x4d30e3['attributes']=_0x4d30e3[_0x8da1('0x3b')]['length']?_0x4d30e3[_0x8da1('0x3b')]:_0x161e6b[_0x8da1('0x37')];if(!_0x2ebfbc['query']['hasOwnProperty'](_0x8da1('0x3f'))){_0x4d30e3[_0x8da1('0x23')]=qs['limit'](_0x2ebfbc[_0x8da1('0x38')]['limit']);_0x4d30e3[_0x8da1('0x20')]=qs[_0x8da1('0x20')](_0x2ebfbc[_0x8da1('0x38')][_0x8da1('0x20')]);}_0x4d30e3[_0x8da1('0x40')]=qs[_0x8da1('0x41')](_0x2ebfbc[_0x8da1('0x38')][_0x8da1('0x41')]);_0x4d30e3[_0x8da1('0x5c')]=qs[_0x8da1('0x3a')](_[_0x8da1('0x42')](_0x2ebfbc['query'],_0x161e6b['filters']));_0x4d30e3[_0x8da1('0x5c')][_0x8da1('0x5d')]=_0x3ea20b['id'];if(_0x2ebfbc['query'][_0x8da1('0x43')]){_0x4d30e3[_0x8da1('0x5c')]=_['merge'](_0x4d30e3['where'],{'$or':_['map'](_0x4d30e3['attributes'],function(_0xd60cb){var _0xd50068={};_0xd50068[_0xd60cb]={'$like':'%'+_0x2ebfbc[_0x8da1('0x38')]['filter']+'%'};return _0xd50068;})});}_0x4d30e3=_[_0x8da1('0x45')]({},_0x4d30e3,_0x2ebfbc[_0x8da1('0x46')]);return db[_0x8da1('0x5b')]['findAll'](_0x4d30e3);}})[_0x8da1('0x2a')](function(_0x58d76e){if(_0x58d76e){return db[_0x8da1('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x58d76e,'UserId'),'role':'agent'},'attributes':['id',_0x8da1('0x30'),_0x8da1('0x5f'),'updatedAt',_0x8da1('0x60')]});}})[_0x8da1('0x2a')](function(_0x5a9b72){if(_0x5a9b72){return{'count':_0x5a9b72['count'],'rows':_[_0x8da1('0x32')](_0x5a9b72['rows'],function(_0x3439e1){return{'membername':_0x3439e1[_0x8da1('0x30')],'UserId':_0x3439e1['id'],'queue_name':_0x2bff29['name'],'FaxQueueId':_0x2bff29['id'],'interface':util[_0x8da1('0x61')](_0x8da1('0x62'),_0x8da1('0x63'),_0x3439e1[_0x8da1('0x30')]),'penalty':0x0,'paused':_0x3439e1[_0x8da1('0x5f')],'createdAt':_0x3439e1[_0x8da1('0x60')],'updatedAt':_0x3439e1[_0x8da1('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8da1('0x2a')](respondWithFilteredResult(_0x57bbb7,_0x4d30e3))[_0x8da1('0x4b')](handleError(_0x57bbb7,null));};exports[_0x8da1('0x65')]=function(_0x2bd663,_0x4c1e99,_0x12cd98){var _0x3925c1={};var _0x2a33ed={};var _0x1f784e;var _0x1c6d10;return db[_0x8da1('0x33')][_0x8da1('0x5a')]({'where':{'id':_0x2bd663[_0x8da1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c1e99,null))[_0x8da1('0x2a')](function(_0x356e4c){if(_0x356e4c){_0x1f784e=_0x356e4c;_0x2a33ed[_0x8da1('0x37')]=_['keys'](db['Team'][_0x8da1('0x34')]);_0x2a33ed[_0x8da1('0x38')]=_[_0x8da1('0x39')](_0x2bd663['query']);_0x2a33ed[_0x8da1('0x3a')]=_[_0x8da1('0x3c')](_0x2a33ed[_0x8da1('0x37')],_0x2a33ed[_0x8da1('0x38')]);_0x3925c1[_0x8da1('0x3b')]=_[_0x8da1('0x3c')](_0x2a33ed[_0x8da1('0x37')],qs[_0x8da1('0x3d')](_0x2bd663[_0x8da1('0x38')][_0x8da1('0x3d')]));_0x3925c1[_0x8da1('0x3b')]=_0x3925c1['attributes'][_0x8da1('0x66')]?_0x3925c1['attributes']:_0x2a33ed[_0x8da1('0x37')];_0x3925c1[_0x8da1('0x40')]=qs[_0x8da1('0x41')](_0x2bd663[_0x8da1('0x38')][_0x8da1('0x41')]);_0x3925c1['where']=qs[_0x8da1('0x3a')](_[_0x8da1('0x42')](_0x2bd663['query'],_0x2a33ed[_0x8da1('0x3a')]));if(_0x2bd663[_0x8da1('0x38')][_0x8da1('0x43')]){_0x3925c1[_0x8da1('0x5c')]=_['merge'](_0x3925c1[_0x8da1('0x5c')],{'$or':_[_0x8da1('0x32')](_0x3925c1['attributes'],function(_0x5720dd){var _0x2adfae={};_0x2adfae[_0x5720dd]={'$like':'%'+_0x2bd663[_0x8da1('0x38')]['filter']+'%'};return _0x2adfae;})});}_0x3925c1=_['merge']({},_0x3925c1,_0x2bd663[_0x8da1('0x46')]);return _0x1f784e[_0x8da1('0x65')](_0x3925c1);}})[_0x8da1('0x2a')](function(_0x5415f3){if(_0x5415f3){_0x1c6d10=_0x5415f3[_0x8da1('0x66')];if(!_0x2bd663[_0x8da1('0x38')][_0x8da1('0x3e')](_0x8da1('0x3f'))){_0x3925c1[_0x8da1('0x23')]=qs[_0x8da1('0x23')](_0x2bd663[_0x8da1('0x38')]['limit']);_0x3925c1[_0x8da1('0x20')]=qs[_0x8da1('0x20')](_0x2bd663[_0x8da1('0x38')][_0x8da1('0x20')]);}return _0x1f784e[_0x8da1('0x65')](_0x3925c1);}})['then'](function(_0x246e90){if(_0x246e90){return _0x246e90?{'count':_0x1c6d10,'rows':_0x246e90}:null;}})[_0x8da1('0x2a')](respondWithResult(_0x4c1e99,null))['catch'](handleError(_0x4c1e99,null));};exports[_0x8da1('0x67')]=function(_0x720af1,_0x48638a,_0x48a9a0){var _0x41185c=_0x720af1[_0x8da1('0x50')][_0x8da1('0x68')];return db['Team'][_0x8da1('0x49')]({'where':{'id':_0x41185c},'attributes':['id'],'include':[{'model':db[_0x8da1('0x5e')],'as':'Agents','attributes':['id',_0x8da1('0x30'),'online',_0x8da1('0x69'),_0x8da1('0x6a')],'raw':!![]}]})[_0x8da1('0x2a')](function(_0x1d08cb){if(_0x1d08cb){var _0x933864=_[_0x8da1('0x6b')](_0x1d08cb,function(_0x43e030){var _0x2223ca=_0x43e030['get']({'plain':!![]});return _0x2223ca['Agents'];});return db[_0x8da1('0x33')][_0x8da1('0x4e')]({'where':{'id':_0x720af1['params']['id']}})['then'](function(_0x2bc10){return db['sequelize'][_0x8da1('0x6c')](function(_0x447645){return _0x2bc10[_0x8da1('0x67')](_0x41185c,{'transaction':_0x447645})[_0x8da1('0x2a')](function(){return BPromise['each'](_0x933864,function(_0x56d94b){return db[_0x8da1('0x5b')][_0x8da1('0x6d')]({'where':{'UserId':_0x56d94b['id'],'FaxQueueId':_0x720af1[_0x8da1('0x4d')]['id']},'transaction':_0x447645});});})[_0x8da1('0x2a')](function(){_0x933864[_0x8da1('0x6e')](function(_0x1384e3){socket['emit']('userFaxQueue:save',{'UserId':_0x1384e3['id'],'FaxQueueId':_0x2bc10['id']});});});});});}})[_0x8da1('0x2a')](respondWithStatusCode(_0x48638a,null))['catch'](handleError(_0x48638a,null));};exports['removeTeams']=function(_0x100bc4,_0x4565b4,_0x4af661){return db['Team'][_0x8da1('0x49')]({'where':{'id':_0x100bc4[_0x8da1('0x38')][_0x8da1('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4565b4,null))[_0x8da1('0x2a')](function(_0x37ed5c){var _0x3207fc=_['map'](_0x37ed5c,'id');var _0x4dba78=[];var _0x47279a=[];var _0xee9466=squel[_0x8da1('0x6f')]();_0xee9466[_0x8da1('0x70')](_0x8da1('0x71'))[_0x8da1('0x72')](_0x8da1('0x73'),'tq')[_0x8da1('0x74')](_0x8da1('0x75'),'ut',_0x8da1('0x76'))['where'](_0x8da1('0x77'),_0x100bc4[_0x8da1('0x4d')]['id']);for(var _0x256c02=0x0;_0x256c02<_0x37ed5c['length'];_0x256c02+=0x1){let _0x5b9fa7=_0x37ed5c[_0x256c02];for(var _0x276c05=0x0;_0x276c05<_0x5b9fa7[_0x8da1('0x78')]['length'];_0x276c05+=0x1){let _0x4cb8b7=_0x5b9fa7['Agents'][_0x276c05];var _0x1166d8=_0xee9466[_0x8da1('0x79')]();_0x1166d8[_0x8da1('0x5c')](_0x8da1('0x7a'),_0x4cb8b7['id']);_0x47279a[_0x8da1('0x7b')](db[_0x8da1('0x7c')][_0x8da1('0x38')](_0x1166d8['toString'](),{'type':db[_0x8da1('0x7c')][_0x8da1('0x7d')]['SELECT']})['then'](function(_0x1ffd66){if(_0x1ffd66[_0x8da1('0x66')]===0x1){return _0x4cb8b7['id'];}else{var _0x40ae12=_['every'](_[_0x8da1('0x32')](_0x1ffd66,_0x8da1('0x7e')),function(_0x2e81d3){return _[_0x8da1('0x7f')](_0x3207fc,_0x2e81d3);});if(_0x40ae12){return _0x4cb8b7['id'];}}}));}}return BPromise[_0x8da1('0x80')](_0x47279a)[_0x8da1('0x2a')](function(_0x33eb14){_0x4dba78=_(_0x4dba78)['union'](_0x33eb14)[_0x8da1('0x81')]()[_0x8da1('0x82')]();return db[_0x8da1('0x33')][_0x8da1('0x4e')]({'where':{'id':_0x100bc4[_0x8da1('0x4d')]['id']}})[_0x8da1('0x2a')](function(_0x501a43){return db[_0x8da1('0x7c')][_0x8da1('0x6c')](function(_0x36b5e2){return _0x501a43[_0x8da1('0x83')](_0x100bc4['query'][_0x8da1('0x68')],{'transaction':_0x36b5e2})[_0x8da1('0x2a')](function(){if(!_[_0x8da1('0x84')](_0x4dba78)){return _0x501a43[_0x8da1('0x85')](_0x4dba78,{'transaction':_0x36b5e2});}})[_0x8da1('0x2a')](function(){_0x4dba78[_0x8da1('0x6e')](function(_0x32ca93){socket[_0x8da1('0x86')](_0x8da1('0x87'),{'UserId':_0x32ca93,'FaxQueueId':_0x501a43['id']});});});});});});})['then'](respondWithStatusCode(_0x4565b4,null))[_0x8da1('0x4b')](handleError(_0x4565b4,null));};exports[_0x8da1('0x88')]=function(_0x1798fe,_0x711625,_0x317af1){return db[_0x8da1('0x33')]['find']({'where':{'id':_0x1798fe[_0x8da1('0x4d')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x711625,null))[_0x8da1('0x2a')](function(_0x30d728){if(_0x30d728){return _0x30d728[_0x8da1('0x88')](_0x1798fe[_0x8da1('0x50')][_0x8da1('0x68')],_[_0x8da1('0x89')](_0x1798fe[_0x8da1('0x50')],[_0x8da1('0x68'),'id'])||{})[_0x8da1('0x8a')](function(_0x1919f9){for(var _0x20b386=0x0;_0x20b386<_0x1798fe[_0x8da1('0x50')][_0x8da1('0x68')]['length'];_0x20b386+=0x1){socket['emit'](_0x8da1('0x8b'),{'UserId':Number(_0x1798fe['body'][_0x8da1('0x68')][_0x20b386]),'FaxQueueId':Number(_0x1798fe[_0x8da1('0x4d')]['id'])});}return _0x1919f9;});}})[_0x8da1('0x2a')](respondWithResult(_0x711625,null))[_0x8da1('0x4b')](handleError(_0x711625,null));};exports['removeAgents']=function(_0x234a12,_0x15f2d4,_0x488bcb){return db['FaxQueue'][_0x8da1('0x4e')]({'where':{'id':_0x234a12[_0x8da1('0x4d')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x15f2d4,null))[_0x8da1('0x2a')](function(_0x2f9df4){if(_0x2f9df4){return _0x2f9df4[_0x8da1('0x85')](_0x234a12[_0x8da1('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x234a12[_0x8da1('0x38')][_0x8da1('0x68')])){for(var _0x8e220a=0x0;_0x8e220a<_0x234a12[_0x8da1('0x38')][_0x8da1('0x68')]['length'];_0x8e220a+=0x1){socket['emit'](_0x8da1('0x87'),{'UserId':Number(_0x234a12[_0x8da1('0x38')][_0x8da1('0x68')][_0x8e220a]),'FaxQueueId':Number(_0x234a12[_0x8da1('0x4d')]['id'])});}}else{socket[_0x8da1('0x86')]('userFaxQueue:remove',{'UserId':Number(_0x234a12[_0x8da1('0x38')][_0x8da1('0x68')]),'FaxQueueId':Number(_0x234a12[_0x8da1('0x4d')]['id'])});}});}})[_0x8da1('0x2a')](respondWithStatusCode(_0x15f2d4,null))[_0x8da1('0x4b')](handleError(_0x15f2d4,null));};exports['getAgents']=function(_0x2900d8,_0x4aa146,_0x411f54){var _0x16652c={};var _0x190553={};var _0x169f3a;var _0x2c530b;return db[_0x8da1('0x33')]['findOne']({'where':{'id':_0x2900d8[_0x8da1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4aa146,null))[_0x8da1('0x2a')](function(_0x14bd60){if(_0x14bd60){_0x169f3a=_0x14bd60;_0x190553[_0x8da1('0x37')]=_[_0x8da1('0x39')](db[_0x8da1('0x5e')]['rawAttributes']);_0x190553[_0x8da1('0x38')]=_[_0x8da1('0x39')](_0x2900d8[_0x8da1('0x38')]);_0x190553[_0x8da1('0x3a')]=_[_0x8da1('0x3c')](_0x190553[_0x8da1('0x37')],_0x190553[_0x8da1('0x38')]);_0x16652c[_0x8da1('0x3b')]=_['intersection'](_0x190553[_0x8da1('0x37')],qs[_0x8da1('0x3d')](_0x2900d8['query'][_0x8da1('0x3d')]));_0x16652c[_0x8da1('0x3b')]=_0x16652c[_0x8da1('0x3b')][_0x8da1('0x66')]?_0x16652c[_0x8da1('0x3b')]:_0x190553[_0x8da1('0x37')];_0x16652c[_0x8da1('0x40')]=qs[_0x8da1('0x41')](_0x2900d8[_0x8da1('0x38')]['sort']);_0x16652c[_0x8da1('0x5c')]=qs[_0x8da1('0x3a')](_[_0x8da1('0x42')](_0x2900d8['query'],_0x190553[_0x8da1('0x3a')]));if(_0x2900d8[_0x8da1('0x38')][_0x8da1('0x43')]){_0x16652c[_0x8da1('0x5c')]=_['merge'](_0x16652c[_0x8da1('0x5c')],{'$or':_[_0x8da1('0x32')](_0x16652c['attributes'],function(_0x27a12){var _0xd43363={};_0xd43363[_0x27a12]={'$like':'%'+_0x2900d8['query'][_0x8da1('0x43')]+'%'};return _0xd43363;})});}_0x16652c=_[_0x8da1('0x45')]({},_0x16652c,_0x2900d8[_0x8da1('0x46')]);return _0x169f3a[_0x8da1('0x8c')](_0x16652c);}})[_0x8da1('0x2a')](function(_0x762586){if(_0x762586){_0x2c530b=_0x762586['length'];if(!_0x2900d8[_0x8da1('0x38')][_0x8da1('0x3e')](_0x8da1('0x3f'))){_0x16652c[_0x8da1('0x23')]=qs[_0x8da1('0x23')](_0x2900d8[_0x8da1('0x38')][_0x8da1('0x23')]);_0x16652c[_0x8da1('0x20')]=qs['offset'](_0x2900d8[_0x8da1('0x38')][_0x8da1('0x20')]);}return _0x169f3a[_0x8da1('0x8c')](_0x16652c);}})[_0x8da1('0x2a')](function(_0x2ab2a8){if(_0x2ab2a8){return _0x2ab2a8?{'count':_0x2c530b,'rows':_0x2ab2a8}:null;}})[_0x8da1('0x2a')](respondWithResult(_0x4aa146,null))[_0x8da1('0x4b')](handleError(_0x4aa146,null));}; \ No newline at end of file +var _0x2650=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','get','FaxQueues','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','pick','User','UserId','agent','faxPause','format','%s/%s','createdAt','updatedAt','Team','getTeams','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x167205,_0x233399){var _0x15d96d=function(_0x4b1c){while(--_0x4b1c){_0x167205['push'](_0x167205['shift']());}};_0x15d96d(++_0x233399);}(_0x2650,0x76));var _0x0265=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2650[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x0265('0x0'));var rimraf=require(_0x0265('0x1'));var zipdir=require(_0x0265('0x2'));var jsonpatch=require(_0x0265('0x3'));var rp=require(_0x0265('0x4'));var moment=require(_0x0265('0x5'));var BPromise=require(_0x0265('0x6'));var Mustache=require(_0x0265('0x7'));var util=require(_0x0265('0x8'));var path=require(_0x0265('0x9'));var sox=require(_0x0265('0xa'));var csv=require(_0x0265('0xb'));var ejs=require(_0x0265('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0265('0xd'));var squel=require('squel');var crypto=require(_0x0265('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0265('0xb'));var querystring=require(_0x0265('0xf'));var Papa=require(_0x0265('0x10'));var Redis=require('ioredis');var authService=require(_0x0265('0x11'));var qs=require(_0x0265('0x12'));var as=require(_0x0265('0x13'));var hardwareService=require(_0x0265('0x14'));var logger=require(_0x0265('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x0265('0x16'));var licenseUtil=require(_0x0265('0x17'));var db=require('../../mysqldb')['db'];config[_0x0265('0x18')]=_[_0x0265('0x19')](config[_0x0265('0x18')],{'host':_0x0265('0x1a'),'port':0x18eb});var socket=require(_0x0265('0x1b'))(new Redis(config[_0x0265('0x18')]));require('./faxQueue.socket')[_0x0265('0x1c')](socket);function respondWithStatusCode(_0x43454f,_0x289ab2){_0x289ab2=_0x289ab2||0xcc;return function(_0x16f80c){if(_0x16f80c){return _0x43454f[_0x0265('0x1d')](_0x289ab2);}return _0x43454f[_0x0265('0x1e')](_0x289ab2)[_0x0265('0x1f')]();};}function respondWithResult(_0x40c7a6,_0x43431f){_0x43431f=_0x43431f||0xc8;return function(_0xfc82c0){if(_0xfc82c0){return _0x40c7a6[_0x0265('0x1e')](_0x43431f)[_0x0265('0x20')](_0xfc82c0);}};}function respondWithFilteredResult(_0x3f3e9a,_0x9f523c){return function(_0x30e506){if(_0x30e506){var _0x522bbe=typeof _0x9f523c['offset']===_0x0265('0x21')&&typeof _0x9f523c['limit']===_0x0265('0x21');var _0x4f76b6=_0x30e506['count'];var _0x51dee1=_0x522bbe?0x0:_0x9f523c['offset'];var _0x13b30f=_0x522bbe?_0x30e506[_0x0265('0x22')]:_0x9f523c[_0x0265('0x23')]+_0x9f523c[_0x0265('0x24')];var _0x47ffc3;if(_0x13b30f>=_0x4f76b6){_0x13b30f=_0x4f76b6;_0x47ffc3=0xc8;}else{_0x47ffc3=0xce;}_0x3f3e9a['status'](_0x47ffc3);return _0x3f3e9a[_0x0265('0x25')](_0x0265('0x26'),_0x51dee1+'-'+_0x13b30f+'/'+_0x4f76b6)[_0x0265('0x20')](_0x30e506);}return null;};}function patchUpdates(_0x1aeb78){return function(_0x1c6297){try{jsonpatch['apply'](_0x1c6297,_0x1aeb78,!![]);}catch(_0x34ddce){return BPromise[_0x0265('0x27')](_0x34ddce);}return _0x1c6297[_0x0265('0x28')]();};}function saveUpdates(_0xdca986,_0x257e6b){return function(_0x2f57e8){if(_0x2f57e8){return _0x2f57e8['update'](_0xdca986)[_0x0265('0x29')](function(_0x28673d){return _0x28673d;});}return null;};}function removeEntity(_0x1b3218,_0x3ef3e7){return function(_0x3c224c){if(_0x3c224c){return _0x3c224c[_0x0265('0x2a')]()['then'](function(){var _0x557f20=_0x3c224c[_0x0265('0x2b')]({'plain':!![]});var _0x37dc1b=_0x0265('0x2c');return db[_0x0265('0x2d')]['destroy']({'where':{'type':_0x37dc1b,'resourceId':_0x557f20['id']}})[_0x0265('0x29')](function(){return _0x3c224c;});})[_0x0265('0x29')](function(){_0x1b3218['status'](0xcc)[_0x0265('0x1f')]();});}};}function handleEntityNotFound(_0x3d24db,_0x1ba5eb){return function(_0x391d59){if(!_0x391d59){_0x3d24db['sendStatus'](0x194);}return _0x391d59;};}function handleError(_0x3cbb84,_0x3c901f){_0x3c901f=_0x3c901f||0x1f4;return function(_0x2b8d79){logger['error'](_0x2b8d79['stack']);if(_0x2b8d79[_0x0265('0x2e')]){delete _0x2b8d79[_0x0265('0x2e')];}_0x3cbb84['status'](_0x3c901f)[_0x0265('0x2f')](_0x2b8d79);};}exports[_0x0265('0x30')]=function(_0x3ed438,_0x390eca){var _0xf2865={},_0x3a7413={},_0x73936a={'count':0x0,'rows':[]};var _0x4e8047=_[_0x0265('0x31')](db['FaxQueue'][_0x0265('0x32')],function(_0x4702b2){return{'name':_0x4702b2[_0x0265('0x33')],'type':_0x4702b2[_0x0265('0x34')][_0x0265('0x35')]};});_0x3a7413[_0x0265('0x36')]=_[_0x0265('0x31')](_0x4e8047,_0x0265('0x2e'));_0x3a7413['query']=_['keys'](_0x3ed438[_0x0265('0x37')]);_0x3a7413[_0x0265('0x38')]=_['intersection'](_0x3a7413[_0x0265('0x36')],_0x3a7413[_0x0265('0x37')]);_0xf2865['attributes']=_[_0x0265('0x39')](_0x3a7413['model'],qs[_0x0265('0x3a')](_0x3ed438[_0x0265('0x37')]['fields']));_0xf2865['attributes']=_0xf2865['attributes']['length']?_0xf2865[_0x0265('0x3b')]:_0x3a7413[_0x0265('0x36')];if(!_0x3ed438['query']['hasOwnProperty'](_0x0265('0x3c'))){_0xf2865[_0x0265('0x24')]=qs[_0x0265('0x24')](_0x3ed438[_0x0265('0x37')][_0x0265('0x24')]);_0xf2865[_0x0265('0x23')]=qs[_0x0265('0x23')](_0x3ed438[_0x0265('0x37')][_0x0265('0x23')]);}_0xf2865[_0x0265('0x3d')]=qs[_0x0265('0x3e')](_0x3ed438[_0x0265('0x37')][_0x0265('0x3e')]);_0xf2865[_0x0265('0x3f')]=qs[_0x0265('0x38')](_['pick'](_0x3ed438[_0x0265('0x37')],_0x3a7413['filters']),_0x4e8047);if(_0x3ed438[_0x0265('0x37')][_0x0265('0x40')]){_0xf2865['where']=_[_0x0265('0x41')](_0xf2865[_0x0265('0x3f')],{'$or':_[_0x0265('0x31')](_0x4e8047,function(_0x3cd0c5){if(_0x3cd0c5[_0x0265('0x34')]!==_0x0265('0x42')){var _0x3b17dd={};_0x3b17dd[_0x3cd0c5[_0x0265('0x2e')]]={'$like':'%'+_0x3ed438[_0x0265('0x37')][_0x0265('0x40')]+'%'};return _0x3b17dd;}})});}_0xf2865=_['merge']({},_0xf2865,_0x3ed438[_0x0265('0x43')]);var _0x16d269={'where':_0xf2865[_0x0265('0x3f')]};return db[_0x0265('0x44')][_0x0265('0x22')](_0x16d269)[_0x0265('0x29')](function(_0x2c4b8d){_0x73936a[_0x0265('0x22')]=_0x2c4b8d;if(_0x3ed438[_0x0265('0x37')][_0x0265('0x45')]){_0xf2865[_0x0265('0x46')]=[{'all':!![]}];}return db[_0x0265('0x44')][_0x0265('0x47')](_0xf2865);})['then'](function(_0x2a2aa5){_0x73936a[_0x0265('0x48')]=_0x2a2aa5;return _0x73936a;})['then'](respondWithFilteredResult(_0x390eca,_0xf2865))['catch'](handleError(_0x390eca,null));};exports[_0x0265('0x49')]=function(_0xd991b8,_0x2f34a3){var _0xb47a65={'raw':!![],'where':{'id':_0xd991b8[_0x0265('0x4a')]['id']}},_0x18cde6={};_0x18cde6[_0x0265('0x36')]=_[_0x0265('0x4b')](db[_0x0265('0x44')]['rawAttributes']);_0x18cde6[_0x0265('0x37')]=_[_0x0265('0x4b')](_0xd991b8[_0x0265('0x37')]);_0x18cde6[_0x0265('0x38')]=_['intersection'](_0x18cde6[_0x0265('0x36')],_0x18cde6[_0x0265('0x37')]);_0xb47a65[_0x0265('0x3b')]=_['intersection'](_0x18cde6[_0x0265('0x36')],qs['fields'](_0xd991b8[_0x0265('0x37')]['fields']));_0xb47a65[_0x0265('0x3b')]=_0xb47a65[_0x0265('0x3b')][_0x0265('0x4c')]?_0xb47a65[_0x0265('0x3b')]:_0x18cde6[_0x0265('0x36')];if(_0xd991b8['query']['includeAll']){_0xb47a65[_0x0265('0x46')]=[{'all':!![]}];}_0xb47a65=_[_0x0265('0x41')]({},_0xb47a65,_0xd991b8[_0x0265('0x43')]);return db[_0x0265('0x44')][_0x0265('0x4d')](_0xb47a65)[_0x0265('0x29')](handleEntityNotFound(_0x2f34a3,null))[_0x0265('0x29')](respondWithResult(_0x2f34a3,null))[_0x0265('0x4e')](handleError(_0x2f34a3,null));};exports[_0x0265('0x4f')]=function(_0x17cfd9,_0x43db8b){return db[_0x0265('0x44')][_0x0265('0x4f')](_0x17cfd9[_0x0265('0x50')],{})[_0x0265('0x29')](function(_0x25d445){var _0x7dcee6=_0x17cfd9[_0x0265('0x51')][_0x0265('0x2b')]({'plain':!![]});if(!_0x7dcee6)throw new Error(_0x0265('0x52'));if(_0x7dcee6[_0x0265('0x53')]===_0x0265('0x51')){var _0x5a4f37=_0x25d445[_0x0265('0x2b')]({'plain':!![]});var _0x1dfe5d=_0x0265('0x2c');return db[_0x0265('0x54')][_0x0265('0x4d')]({'where':{'name':_0x1dfe5d,'userProfileId':_0x7dcee6[_0x0265('0x55')]},'raw':!![]})['then'](function(_0x3dc68f){if(_0x3dc68f&&_0x3dc68f['autoAssociation']===0x0){return db['UserProfileResource'][_0x0265('0x4f')]({'name':_0x5a4f37['name'],'resourceId':_0x5a4f37['id'],'type':_0x3dc68f['name'],'sectionId':_0x3dc68f['id']},{})[_0x0265('0x29')](function(){return _0x25d445;});}else{return _0x25d445;}})[_0x0265('0x4e')](function(_0x3e8e66){logger['error'](_0x0265('0x56'),_0x3e8e66);throw _0x3e8e66;});}return _0x25d445;})[_0x0265('0x29')](respondWithResult(_0x43db8b,0xc9))[_0x0265('0x4e')](handleError(_0x43db8b,null));};exports['update']=function(_0x2e25e2,_0x132e35){if(_0x2e25e2['body']['id']){delete _0x2e25e2[_0x0265('0x50')]['id'];}return db[_0x0265('0x44')]['find']({'where':{'id':_0x2e25e2[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](handleEntityNotFound(_0x132e35,null))[_0x0265('0x29')](saveUpdates(_0x2e25e2[_0x0265('0x50')],null))[_0x0265('0x29')](respondWithResult(_0x132e35,null))[_0x0265('0x4e')](handleError(_0x132e35,null));};exports['destroy']=function(_0x40f581,_0x2cebe9){return db[_0x0265('0x44')][_0x0265('0x4d')]({'where':{'id':_0x40f581[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](handleEntityNotFound(_0x2cebe9,null))[_0x0265('0x29')](removeEntity(_0x2cebe9,null))[_0x0265('0x4e')](handleError(_0x2cebe9,null));};exports[_0x0265('0x57')]=function(_0x4554c,_0x2bc869){return db[_0x0265('0x44')][_0x0265('0x57')]()[_0x0265('0x29')](respondWithResult(_0x2bc869,null))[_0x0265('0x4e')](handleError(_0x2bc869,null));};exports[_0x0265('0x58')]=function(_0x5051ac,_0x2a31b7,_0x498fe3){var _0x179ca3={'raw':!![],'where':{}},_0x4143ba={},_0x12019c;return db['FaxQueue'][_0x0265('0x59')]({'where':{'id':_0x5051ac[_0x0265('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a31b7,null))[_0x0265('0x29')](function(_0x368c26){if(_0x368c26){_0x12019c=_0x368c26[_0x0265('0x2b')]({'plain':!![]});_0x4143ba['model']=_[_0x0265('0x4b')](db[_0x0265('0x5a')][_0x0265('0x32')]);_0x4143ba[_0x0265('0x37')]=_[_0x0265('0x4b')](_0x5051ac[_0x0265('0x37')]);_0x4143ba['filters']=_['intersection'](_0x4143ba[_0x0265('0x36')],_0x4143ba[_0x0265('0x37')]);_0x179ca3[_0x0265('0x3b')]=_[_0x0265('0x39')](_0x4143ba['model'],qs[_0x0265('0x3a')](_0x5051ac['query'][_0x0265('0x3a')]));_0x179ca3[_0x0265('0x3b')]=_0x179ca3['attributes'][_0x0265('0x4c')]?_0x179ca3[_0x0265('0x3b')]:_0x4143ba[_0x0265('0x36')];if(!_0x5051ac['query'][_0x0265('0x5b')](_0x0265('0x3c'))){_0x179ca3[_0x0265('0x24')]=qs['limit'](_0x5051ac[_0x0265('0x37')]['limit']);_0x179ca3[_0x0265('0x23')]=qs[_0x0265('0x23')](_0x5051ac[_0x0265('0x37')][_0x0265('0x23')]);}_0x179ca3[_0x0265('0x3d')]=qs[_0x0265('0x3e')](_0x5051ac['query'][_0x0265('0x3e')]);_0x179ca3[_0x0265('0x3f')]=qs[_0x0265('0x38')](_[_0x0265('0x5c')](_0x5051ac['query'],_0x4143ba[_0x0265('0x38')]));_0x179ca3['where']['FaxQueueId']=_0x368c26['id'];if(_0x5051ac[_0x0265('0x37')][_0x0265('0x40')]){_0x179ca3[_0x0265('0x3f')]=_['merge'](_0x179ca3[_0x0265('0x3f')],{'$or':_['map'](_0x179ca3[_0x0265('0x3b')],function(_0x139884){var _0x5c57a4={};_0x5c57a4[_0x139884]={'$like':'%'+_0x5051ac[_0x0265('0x37')][_0x0265('0x40')]+'%'};return _0x5c57a4;})});}_0x179ca3=_[_0x0265('0x41')]({},_0x179ca3,_0x5051ac[_0x0265('0x43')]);return db['UserFaxQueue'][_0x0265('0x47')](_0x179ca3);}})[_0x0265('0x29')](function(_0x23c443){if(_0x23c443){return db[_0x0265('0x5d')]['findAndCountAll']({'where':{'id':_[_0x0265('0x31')](_0x23c443,_0x0265('0x5e')),'role':_0x0265('0x5f')},'attributes':['id','name',_0x0265('0x60'),'updatedAt','createdAt']});}})[_0x0265('0x29')](function(_0x40acb0){if(_0x40acb0){return{'count':_0x40acb0[_0x0265('0x22')],'rows':_[_0x0265('0x31')](_0x40acb0['rows'],function(_0x5ae871){return{'membername':_0x5ae871['name'],'UserId':_0x5ae871['id'],'queue_name':_0x12019c[_0x0265('0x2e')],'FaxQueueId':_0x12019c['id'],'interface':util[_0x0265('0x61')](_0x0265('0x62'),'SIP',_0x5ae871[_0x0265('0x2e')]),'penalty':0x0,'paused':_0x5ae871[_0x0265('0x60')],'createdAt':_0x5ae871[_0x0265('0x63')],'updatedAt':_0x5ae871[_0x0265('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0265('0x29')](respondWithFilteredResult(_0x2a31b7,_0x179ca3))[_0x0265('0x4e')](handleError(_0x2a31b7,null));};exports['getTeams']=function(_0x471873,_0x3273f6,_0x2e4165){var _0x480936={};var _0x54df79={};var _0x4900cc;var _0x59a3a5;return db[_0x0265('0x44')]['findOne']({'where':{'id':_0x471873[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](handleEntityNotFound(_0x3273f6,null))['then'](function(_0x1668d2){if(_0x1668d2){_0x4900cc=_0x1668d2;_0x54df79[_0x0265('0x36')]=_[_0x0265('0x4b')](db[_0x0265('0x65')][_0x0265('0x32')]);_0x54df79[_0x0265('0x37')]=_[_0x0265('0x4b')](_0x471873[_0x0265('0x37')]);_0x54df79[_0x0265('0x38')]=_[_0x0265('0x39')](_0x54df79['model'],_0x54df79[_0x0265('0x37')]);_0x480936[_0x0265('0x3b')]=_[_0x0265('0x39')](_0x54df79[_0x0265('0x36')],qs[_0x0265('0x3a')](_0x471873[_0x0265('0x37')][_0x0265('0x3a')]));_0x480936[_0x0265('0x3b')]=_0x480936['attributes'][_0x0265('0x4c')]?_0x480936['attributes']:_0x54df79[_0x0265('0x36')];_0x480936['order']=qs[_0x0265('0x3e')](_0x471873[_0x0265('0x37')][_0x0265('0x3e')]);_0x480936['where']=qs[_0x0265('0x38')](_['pick'](_0x471873[_0x0265('0x37')],_0x54df79['filters']));if(_0x471873[_0x0265('0x37')][_0x0265('0x40')]){_0x480936['where']=_['merge'](_0x480936['where'],{'$or':_[_0x0265('0x31')](_0x480936[_0x0265('0x3b')],function(_0x577cf1){var _0x1d19f9={};_0x1d19f9[_0x577cf1]={'$like':'%'+_0x471873[_0x0265('0x37')][_0x0265('0x40')]+'%'};return _0x1d19f9;})});}_0x480936=_[_0x0265('0x41')]({},_0x480936,_0x471873[_0x0265('0x43')]);return _0x4900cc[_0x0265('0x66')](_0x480936);}})['then'](function(_0x7d2e29){if(_0x7d2e29){_0x59a3a5=_0x7d2e29[_0x0265('0x4c')];if(!_0x471873['query'][_0x0265('0x5b')](_0x0265('0x3c'))){_0x480936['limit']=qs[_0x0265('0x24')](_0x471873[_0x0265('0x37')][_0x0265('0x24')]);_0x480936[_0x0265('0x23')]=qs[_0x0265('0x23')](_0x471873[_0x0265('0x37')][_0x0265('0x23')]);}return _0x4900cc['getTeams'](_0x480936);}})[_0x0265('0x29')](function(_0x51ad89){if(_0x51ad89){return _0x51ad89?{'count':_0x59a3a5,'rows':_0x51ad89}:null;}})[_0x0265('0x29')](respondWithResult(_0x3273f6,null))[_0x0265('0x4e')](handleError(_0x3273f6,null));};exports[_0x0265('0x67')]=function(_0x3e5f52,_0x210f12,_0x2d00a9){var _0x599967=_0x3e5f52[_0x0265('0x50')]['ids'];return db[_0x0265('0x65')][_0x0265('0x47')]({'where':{'id':_0x599967},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0265('0x68'),'attributes':['id',_0x0265('0x2e'),_0x0265('0x69'),'voicePause',_0x0265('0x6a')],'raw':!![]}]})['then'](function(_0x12baf6){if(_0x12baf6){var _0x3cd670=_[_0x0265('0x6b')](_0x12baf6,function(_0x5f1c21){var _0x57e7fd=_0x5f1c21[_0x0265('0x2b')]({'plain':!![]});return _0x57e7fd[_0x0265('0x68')];});return db[_0x0265('0x44')][_0x0265('0x4d')]({'where':{'id':_0x3e5f52['params']['id']}})[_0x0265('0x29')](function(_0x3b7f2e){return db[_0x0265('0x6c')][_0x0265('0x6d')](function(_0x3c584a){return _0x3b7f2e[_0x0265('0x67')](_0x599967,{'transaction':_0x3c584a})['then'](function(){return BPromise[_0x0265('0x6e')](_0x3cd670,function(_0x35132f){return db[_0x0265('0x5a')][_0x0265('0x6f')]({'where':{'UserId':_0x35132f['id'],'FaxQueueId':_0x3e5f52[_0x0265('0x4a')]['id']},'transaction':_0x3c584a});});})[_0x0265('0x29')](function(){_0x3cd670[_0x0265('0x70')](function(_0x2694d4){socket[_0x0265('0x71')](_0x0265('0x72'),{'UserId':_0x2694d4['id'],'FaxQueueId':_0x3b7f2e['id']});});});});});}})[_0x0265('0x29')](respondWithStatusCode(_0x210f12,null))[_0x0265('0x4e')](handleError(_0x210f12,null));};exports[_0x0265('0x73')]=function(_0x3f51af,_0x2c2e14,_0x4db4e2){return db['Team']['findAll']({'where':{'id':_0x3f51af[_0x0265('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0265('0x29')](handleEntityNotFound(_0x2c2e14,null))[_0x0265('0x29')](function(_0x34b1b4){var _0x42eb77=_[_0x0265('0x31')](_0x34b1b4,'id');var _0x32b4e9=[];var _0x1eb22e=[];var _0x4e2295=squel[_0x0265('0x74')]();_0x4e2295['field'](_0x0265('0x75'))[_0x0265('0x76')]('team_has_fax_queues','tq')[_0x0265('0x77')](_0x0265('0x78'),'ut',_0x0265('0x79'))[_0x0265('0x3f')](_0x0265('0x7a'),_0x3f51af[_0x0265('0x4a')]['id']);for(var _0x339dc2=0x0;_0x339dc2<_0x34b1b4[_0x0265('0x4c')];_0x339dc2+=0x1){let _0x1f7e04=_0x34b1b4[_0x339dc2];for(var _0x583941=0x0;_0x583941<_0x1f7e04['Agents']['length'];_0x583941+=0x1){let _0x54eeac=_0x1f7e04[_0x0265('0x68')][_0x583941];var _0x1281c3=_0x4e2295[_0x0265('0x7b')]();_0x1281c3[_0x0265('0x3f')](_0x0265('0x7c'),_0x54eeac['id']);_0x1eb22e[_0x0265('0x7d')](db['sequelize']['query'](_0x1281c3['toString'](),{'type':db[_0x0265('0x6c')][_0x0265('0x7e')]['SELECT']})[_0x0265('0x29')](function(_0x48d93d){if(_0x48d93d['length']===0x1){return _0x54eeac['id'];}else{var _0x1ce527=_['every'](_['map'](_0x48d93d,_0x0265('0x7f')),function(_0x466476){return _[_0x0265('0x80')](_0x42eb77,_0x466476);});if(_0x1ce527){return _0x54eeac['id'];}}}));}}return BPromise[_0x0265('0x81')](_0x1eb22e)['then'](function(_0x616648){_0x32b4e9=_(_0x32b4e9)[_0x0265('0x82')](_0x616648)[_0x0265('0x83')]()['value']();return db[_0x0265('0x44')][_0x0265('0x4d')]({'where':{'id':_0x3f51af[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](function(_0x4a6004){return db[_0x0265('0x6c')][_0x0265('0x6d')](function(_0x11b264){return _0x4a6004['removeTeams'](_0x3f51af[_0x0265('0x37')][_0x0265('0x84')],{'transaction':_0x11b264})['then'](function(){if(!_[_0x0265('0x85')](_0x32b4e9)){return _0x4a6004[_0x0265('0x86')](_0x32b4e9,{'transaction':_0x11b264});}})[_0x0265('0x29')](function(){_0x32b4e9[_0x0265('0x70')](function(_0x417596){socket['emit']('userFaxQueue:remove',{'UserId':_0x417596,'FaxQueueId':_0x4a6004['id']});});});});});});})[_0x0265('0x29')](respondWithStatusCode(_0x2c2e14,null))[_0x0265('0x4e')](handleError(_0x2c2e14,null));};exports[_0x0265('0x87')]=function(_0x3fa4a2,_0x53eae1,_0x35f384){return db['FaxQueue'][_0x0265('0x4d')]({'where':{'id':_0x3fa4a2[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](handleEntityNotFound(_0x53eae1,null))[_0x0265('0x29')](function(_0x40ad9a){if(_0x40ad9a){return _0x40ad9a[_0x0265('0x87')](_0x3fa4a2[_0x0265('0x50')][_0x0265('0x84')],_[_0x0265('0x88')](_0x3fa4a2[_0x0265('0x50')],[_0x0265('0x84'),'id'])||{})[_0x0265('0x89')](function(_0x4703d1){for(var _0x4f1dca=0x0;_0x4f1dca<_0x3fa4a2[_0x0265('0x50')]['ids'][_0x0265('0x4c')];_0x4f1dca+=0x1){socket[_0x0265('0x71')](_0x0265('0x72'),{'UserId':Number(_0x3fa4a2[_0x0265('0x50')][_0x0265('0x84')][_0x4f1dca]),'FaxQueueId':Number(_0x3fa4a2['params']['id'])});}return _0x4703d1;});}})[_0x0265('0x29')](respondWithResult(_0x53eae1,null))[_0x0265('0x4e')](handleError(_0x53eae1,null));};exports[_0x0265('0x86')]=function(_0x5b9800,_0x5e0f75,_0x1baea8){return db[_0x0265('0x44')][_0x0265('0x4d')]({'where':{'id':_0x5b9800[_0x0265('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5e0f75,null))[_0x0265('0x29')](function(_0x53a065){if(_0x53a065){return _0x53a065['removeAgents'](_0x5b9800['query']['ids'])['then'](function(){if(_[_0x0265('0x8a')](_0x5b9800['query'][_0x0265('0x84')])){for(var _0x5dc677=0x0;_0x5dc677<_0x5b9800['query']['ids']['length'];_0x5dc677+=0x1){socket[_0x0265('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x5b9800['query'][_0x0265('0x84')][_0x5dc677]),'FaxQueueId':Number(_0x5b9800[_0x0265('0x4a')]['id'])});}}else{socket[_0x0265('0x71')](_0x0265('0x8b'),{'UserId':Number(_0x5b9800[_0x0265('0x37')][_0x0265('0x84')]),'FaxQueueId':Number(_0x5b9800['params']['id'])});}});}})[_0x0265('0x29')](respondWithStatusCode(_0x5e0f75,null))[_0x0265('0x4e')](handleError(_0x5e0f75,null));};exports[_0x0265('0x8c')]=function(_0x1d9fcb,_0x599c55,_0x18c4ed){var _0x3145a4={};var _0x25f542={};var _0x406305;var _0x46307e;return db[_0x0265('0x44')][_0x0265('0x59')]({'where':{'id':_0x1d9fcb[_0x0265('0x4a')]['id']}})[_0x0265('0x29')](handleEntityNotFound(_0x599c55,null))[_0x0265('0x29')](function(_0x6bb63){if(_0x6bb63){_0x406305=_0x6bb63;_0x25f542[_0x0265('0x36')]=_[_0x0265('0x4b')](db['User'][_0x0265('0x32')]);_0x25f542[_0x0265('0x37')]=_[_0x0265('0x4b')](_0x1d9fcb[_0x0265('0x37')]);_0x25f542[_0x0265('0x38')]=_[_0x0265('0x39')](_0x25f542[_0x0265('0x36')],_0x25f542[_0x0265('0x37')]);_0x3145a4[_0x0265('0x3b')]=_[_0x0265('0x39')](_0x25f542['model'],qs['fields'](_0x1d9fcb['query'][_0x0265('0x3a')]));_0x3145a4[_0x0265('0x3b')]=_0x3145a4[_0x0265('0x3b')][_0x0265('0x4c')]?_0x3145a4[_0x0265('0x3b')]:_0x25f542['model'];_0x3145a4['order']=qs[_0x0265('0x3e')](_0x1d9fcb[_0x0265('0x37')][_0x0265('0x3e')]);_0x3145a4[_0x0265('0x3f')]=qs[_0x0265('0x38')](_['pick'](_0x1d9fcb[_0x0265('0x37')],_0x25f542['filters']));if(_0x1d9fcb[_0x0265('0x37')]['filter']){_0x3145a4[_0x0265('0x3f')]=_[_0x0265('0x41')](_0x3145a4['where'],{'$or':_[_0x0265('0x31')](_0x3145a4[_0x0265('0x3b')],function(_0x522cd9){var _0x1eee1c={};_0x1eee1c[_0x522cd9]={'$like':'%'+_0x1d9fcb['query']['filter']+'%'};return _0x1eee1c;})});}_0x3145a4=_[_0x0265('0x41')]({},_0x3145a4,_0x1d9fcb[_0x0265('0x43')]);return _0x406305[_0x0265('0x8c')](_0x3145a4);}})[_0x0265('0x29')](function(_0x57dcfa){if(_0x57dcfa){_0x46307e=_0x57dcfa[_0x0265('0x4c')];if(!_0x1d9fcb['query'][_0x0265('0x5b')]('nolimit')){_0x3145a4[_0x0265('0x24')]=qs[_0x0265('0x24')](_0x1d9fcb[_0x0265('0x37')][_0x0265('0x24')]);_0x3145a4[_0x0265('0x23')]=qs[_0x0265('0x23')](_0x1d9fcb['query']['offset']);}return _0x406305['getAgents'](_0x3145a4);}})[_0x0265('0x29')](function(_0x525e1f){if(_0x525e1f){return _0x525e1f?{'count':_0x46307e,'rows':_0x525e1f}:null;}})[_0x0265('0x29')](respondWithResult(_0x599c55,null))[_0x0265('0x4e')](handleError(_0x599c55,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 410b944..5255d53 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 _0x7914=['remove','emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0x7914,0x7b));var _0x4791=function(_0x450497,_0x3081fc){_0x450497=_0x450497-0x0;var _0x577ae0=_0x7914[_0x450497];return _0x577ae0;};'use strict';var EventEmitter=require(_0x4791('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x4791('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4791('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4791('0x3')};function emitEvent(_0x308546){return function(_0x275f99,_0xc2f913,_0x158480){FaxQueueEvents[_0x4791('0x4')](_0x308546+':'+_0x275f99['id'],_0x275f99);FaxQueueEvents[_0x4791('0x4')](_0x308546,_0x275f99);_0x158480(null);};}for(var e in events){if(events[_0x4791('0x5')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4791('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x0191=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue'];(function(_0x576f3b,_0xd7414b){var _0x22307b=function(_0x41d847){while(--_0x41d847){_0x576f3b['push'](_0x576f3b['shift']());}};_0x22307b(++_0xd7414b);}(_0x0191,0x14e));var _0x1019=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x0191[_0x1ad926];return _0x1b81dc;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x1019('0x0'))['db'][_0x1019('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x1019('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1019('0x3')};function emitEvent(_0x4f1e75){return function(_0x19c261,_0x24296d,_0x1d7c29){FaxQueueEvents[_0x1019('0x4')](_0x4f1e75+':'+_0x19c261['id'],_0x19c261);FaxQueueEvents[_0x1019('0x4')](_0x4f1e75,_0x19c261);_0x1d7c29(null);};}for(var e in events){if(events[_0x1019('0x5')](e)){var event=events[e];FaxQueue[_0x1019('0x6')](e,emitEvent(event));}}module[_0x1019('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 46f8123..5eb475d 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 _0xcce1=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','lodash'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0xcce1,0x1e9));var _0x1cce=function(_0x58175c,_0x2d9373){_0x58175c=_0x58175c-0x0;var _0x55b88f=_0xcce1[_0x58175c];return _0x55b88f;};'use strict';var _=require(_0x1cce('0x0'));var util=require('util');var logger=require(_0x1cce('0x1'))(_0x1cce('0x2'));var moment=require(_0x1cce('0x3'));var BPromise=require(_0x1cce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cce('0x5'));var rimraf=require(_0x1cce('0x6'));var config=require(_0x1cce('0x7'));var attributes=require(_0x1cce('0x8'));module['exports']=function(_0x38b89c,_0x427b92){return _0x38b89c[_0x1cce('0x9')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb13=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xdb13,0x1f4));var _0x3db1=function(_0x5efdb7,_0x4f001a){_0x5efdb7=_0x5efdb7-0x0;var _0x48cf75=_0xdb13[_0x5efdb7];return _0x48cf75;};'use strict';var _=require('lodash');var util=require(_0x3db1('0x0'));var logger=require(_0x3db1('0x1'))(_0x3db1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3db1('0x3'));var fs=require('fs');var path=require(_0x3db1('0x4'));var rimraf=require(_0x3db1('0x5'));var config=require('../../config/environment');var attributes=require(_0x3db1('0x6'));module[_0x3db1('0x7')]=function(_0x18688d,_0x560d3b){return _0x18688d[_0x3db1('0x8')](_0x3db1('0x9'),attributes,{'tableName':_0x3db1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ffb2708..bbf54be 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 _0xd1f0=['model','find','raw','ShowFaxQueue','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./faxQueue.socket','register','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','FaxQueue,\x20%s,\x20%s','result','catch','GetFaxQueue','findAll','options','where','attributes','limit','include','map'];(function(_0x2161da,_0x5c6f44){var _0x147c54=function(_0x24da07){while(--_0x24da07){_0x2161da['push'](_0x2161da['shift']());}};_0x147c54(++_0x5c6f44);}(_0xd1f0,0x9c));var _0x0d1f=function(_0x19c860,_0x568e76){_0x19c860=_0x19c860-0x0;var _0x25aa01=_0xd1f0[_0x19c860];return _0x25aa01;};'use strict';var _=require(_0x0d1f('0x0'));var util=require(_0x0d1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d1f('0x2'));var db=require(_0x0d1f('0x3'))['db'];var utils=require(_0x0d1f('0x4'));var logger=require(_0x0d1f('0x5'))('rpc');var config=require(_0x0d1f('0x6'));var jayson=require(_0x0d1f('0x7'));var client=jayson[_0x0d1f('0x8')][_0x0d1f('0x9')]({'port':0x232a});config[_0x0d1f('0xa')]=_[_0x0d1f('0xb')](config[_0x0d1f('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d1f('0xa')]));require(_0x0d1f('0xc'))[_0x0d1f('0xd')](socket);function respondWithRpcPromise(_0x33e59f,_0x80a015,_0x525fd7){return new BPromise(function(_0x5093c3,_0x40e158){return client[_0x0d1f('0xe')](_0x33e59f,_0x525fd7)[_0x0d1f('0xf')](function(_0x5652ee){logger['info']('FaxQueue,\x20%s,\x20%s',_0x80a015,_0x0d1f('0x10'));logger[_0x0d1f('0x11')](_0x0d1f('0x12'),_0x80a015,_0x0d1f('0x10'),JSON[_0x0d1f('0x13')](_0x5652ee));if(_0x5652ee[_0x0d1f('0x14')]){if(_0x5652ee[_0x0d1f('0x14')]['code']===0x1f4){logger[_0x0d1f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x80a015,_0x5652ee['error'][_0x0d1f('0x15')]);return _0x40e158(_0x5652ee[_0x0d1f('0x14')][_0x0d1f('0x15')]);}logger[_0x0d1f('0x14')]('FaxQueue,\x20%s,\x20%s',_0x80a015,_0x5652ee[_0x0d1f('0x14')][_0x0d1f('0x15')]);return _0x5093c3(_0x5652ee[_0x0d1f('0x14')][_0x0d1f('0x15')]);}else{logger[_0x0d1f('0x16')](_0x0d1f('0x17'),_0x80a015,_0x0d1f('0x10'));_0x5093c3(_0x5652ee[_0x0d1f('0x18')][_0x0d1f('0x15')]);}})[_0x0d1f('0x19')](function(_0x580fa9){logger[_0x0d1f('0x14')](_0x0d1f('0x17'),_0x80a015,_0x580fa9);_0x40e158(_0x580fa9);});});}exports[_0x0d1f('0x1a')]=function(_0xbda9d6){var _0x40470e=this;return new Promise(function(_0x4574d9,_0x3c5cb2){return db['FaxQueue'][_0x0d1f('0x1b')]({'raw':_0xbda9d6[_0x0d1f('0x1c')]?_0xbda9d6[_0x0d1f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xbda9d6[_0x0d1f('0x1c')]?_0xbda9d6[_0x0d1f('0x1c')][_0x0d1f('0x1d')]||null:null,'attributes':_0xbda9d6[_0x0d1f('0x1c')]?_0xbda9d6[_0x0d1f('0x1c')][_0x0d1f('0x1e')]||null:null,'limit':_0xbda9d6[_0x0d1f('0x1c')]?_0xbda9d6[_0x0d1f('0x1c')][_0x0d1f('0x1f')]||null:null,'include':_0xbda9d6['options']?_0xbda9d6[_0x0d1f('0x1c')][_0x0d1f('0x20')]?_[_0x0d1f('0x21')](_0xbda9d6[_0x0d1f('0x1c')][_0x0d1f('0x20')],function(_0x40fa78){return{'model':db[_0x40fa78[_0x0d1f('0x22')]],'as':_0x40fa78['as'],'attributes':_0x40fa78[_0x0d1f('0x1e')],'include':_0x40fa78[_0x0d1f('0x20')]?_['map'](_0x40fa78['include'],function(_0x5d9c24){return{'model':db[_0x5d9c24[_0x0d1f('0x22')]],'as':_0x5d9c24['as'],'attributes':_0x5d9c24[_0x0d1f('0x1e')],'include':_0x5d9c24[_0x0d1f('0x20')]?_[_0x0d1f('0x21')](_0x5d9c24[_0x0d1f('0x20')],function(_0x213e4b){return{'model':db[_0x213e4b['model']],'as':_0x213e4b['as'],'attributes':_0x213e4b[_0x0d1f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d1f('0xf')](function(_0x4f360b){logger[_0x0d1f('0x16')]('GetFaxQueue',_0xbda9d6);logger['debug']('GetFaxQueue',_0xbda9d6,JSON[_0x0d1f('0x13')](_0x4f360b));_0x4574d9(_0x4f360b);})[_0x0d1f('0x19')](function(_0x1d4f0f){logger[_0x0d1f('0x14')](_0x0d1f('0x1a'),_0x1d4f0f[_0x0d1f('0x15')],_0xbda9d6);_0x3c5cb2(_0x40470e[_0x0d1f('0x14')](0x1f4,_0x1d4f0f[_0x0d1f('0x15')]));});});};exports['ShowFaxQueue']=function(_0x3664bd){var _0x5e1cd9=this;return new Promise(function(_0x257cbc,_0x1f64b5){return db['FaxQueue'][_0x0d1f('0x23')]({'raw':_0x3664bd[_0x0d1f('0x1c')]?_0x3664bd[_0x0d1f('0x1c')][_0x0d1f('0x24')]===undefined?!![]:![]:!![],'where':_0x3664bd[_0x0d1f('0x1c')]?_0x3664bd[_0x0d1f('0x1c')][_0x0d1f('0x1d')]||null:null,'attributes':_0x3664bd['options']?_0x3664bd[_0x0d1f('0x1c')][_0x0d1f('0x1e')]||null:null,'include':_0x3664bd['options']?_0x3664bd[_0x0d1f('0x1c')][_0x0d1f('0x20')]?_[_0x0d1f('0x21')](_0x3664bd[_0x0d1f('0x1c')]['include'],function(_0x385b6d){return{'model':db[_0x385b6d['model']],'as':_0x385b6d['as'],'attributes':_0x385b6d[_0x0d1f('0x1e')],'include':_0x385b6d[_0x0d1f('0x20')]?_['map'](_0x385b6d['include'],function(_0x594eff){return{'model':db[_0x594eff[_0x0d1f('0x22')]],'as':_0x594eff['as'],'attributes':_0x594eff[_0x0d1f('0x1e')],'include':_0x594eff[_0x0d1f('0x20')]?_[_0x0d1f('0x21')](_0x594eff[_0x0d1f('0x20')],function(_0x23db19){return{'model':db[_0x23db19[_0x0d1f('0x22')]],'as':_0x23db19['as'],'attributes':_0x23db19[_0x0d1f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0d1f('0xf')](function(_0x57bee3){logger['info']('ShowFaxQueue',_0x3664bd);logger[_0x0d1f('0x11')](_0x0d1f('0x25'),_0x3664bd,JSON[_0x0d1f('0x13')](_0x57bee3));_0x257cbc(_0x57bee3);})['catch'](function(_0x1f25ef){logger[_0x0d1f('0x14')](_0x0d1f('0x25'),_0x1f25ef[_0x0d1f('0x15')],_0x3664bd);_0x1f64b5(_0x5e1cd9[_0x0d1f('0x14')](0x1f4,_0x1f25ef[_0x0d1f('0x15')]));});});}; \ No newline at end of file +var _0xa96c=['options','raw','where','limit','include','attributes','model','map','then','catch','ShowFaxQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue'];(function(_0x328b0c,_0x254151){var _0x3e37a4=function(_0x43834f){while(--_0x43834f){_0x328b0c['push'](_0x328b0c['shift']());}};_0x3e37a4(++_0x254151);}(_0xa96c,0xac));var _0xca96=function(_0x2540f2,_0x476eed){_0x2540f2=_0x2540f2-0x0;var _0x1396bc=_0xa96c[_0x2540f2];return _0x1396bc;};'use strict';var _=require(_0xca96('0x0'));var util=require(_0xca96('0x1'));var moment=require(_0xca96('0x2'));var BPromise=require(_0xca96('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca96('0x4'));var db=require(_0xca96('0x5'))['db'];var utils=require(_0xca96('0x6'));var logger=require(_0xca96('0x7'))(_0xca96('0x8'));var config=require('../../config/environment');var jayson=require(_0xca96('0x9'));var client=jayson[_0xca96('0xa')][_0xca96('0xb')]({'port':0x232a});config[_0xca96('0xc')]=_[_0xca96('0xd')](config[_0xca96('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xca96('0xe'))(new Redis(config['redis']));require(_0xca96('0xf'))[_0xca96('0x10')](socket);function respondWithRpcPromise(_0x56acd5,_0x7204ef,_0x5d6f9f){return new BPromise(function(_0x3ad780,_0x54edd1){return client[_0xca96('0x11')](_0x56acd5,_0x5d6f9f)['then'](function(_0xa828ed){logger[_0xca96('0x12')](_0xca96('0x13'),_0x7204ef,'request\x20sent');logger[_0xca96('0x14')](_0xca96('0x15'),_0x7204ef,'request\x20sent',JSON[_0xca96('0x16')](_0xa828ed));if(_0xa828ed[_0xca96('0x17')]){if(_0xa828ed['error'][_0xca96('0x18')]===0x1f4){logger[_0xca96('0x17')](_0xca96('0x13'),_0x7204ef,_0xa828ed[_0xca96('0x17')][_0xca96('0x19')]);return _0x54edd1(_0xa828ed[_0xca96('0x17')][_0xca96('0x19')]);}logger[_0xca96('0x17')](_0xca96('0x13'),_0x7204ef,_0xa828ed[_0xca96('0x17')][_0xca96('0x19')]);return _0x3ad780(_0xa828ed[_0xca96('0x17')]['message']);}else{logger['info'](_0xca96('0x13'),_0x7204ef,'request\x20sent');_0x3ad780(_0xa828ed[_0xca96('0x1a')][_0xca96('0x19')]);}})['catch'](function(_0x2d3496){logger[_0xca96('0x17')](_0xca96('0x13'),_0x7204ef,_0x2d3496);_0x54edd1(_0x2d3496);});});}exports[_0xca96('0x1b')]=function(_0x48d36d){var _0x3b5600=this;return new Promise(function(_0x1dcc9b,_0x31c16c){return db['FaxQueue']['findAll']({'raw':_0x48d36d[_0xca96('0x1c')]?_0x48d36d['options'][_0xca96('0x1d')]===undefined?!![]:![]:!![],'where':_0x48d36d[_0xca96('0x1c')]?_0x48d36d[_0xca96('0x1c')][_0xca96('0x1e')]||null:null,'attributes':_0x48d36d[_0xca96('0x1c')]?_0x48d36d['options']['attributes']||null:null,'limit':_0x48d36d[_0xca96('0x1c')]?_0x48d36d['options'][_0xca96('0x1f')]||null:null,'include':_0x48d36d[_0xca96('0x1c')]?_0x48d36d[_0xca96('0x1c')]['include']?_['map'](_0x48d36d['options'][_0xca96('0x20')],function(_0x141c6c){return{'model':db[_0x141c6c['model']],'as':_0x141c6c['as'],'attributes':_0x141c6c[_0xca96('0x21')],'include':_0x141c6c['include']?_['map'](_0x141c6c[_0xca96('0x20')],function(_0x2cbf1f){return{'model':db[_0x2cbf1f[_0xca96('0x22')]],'as':_0x2cbf1f['as'],'attributes':_0x2cbf1f[_0xca96('0x21')],'include':_0x2cbf1f[_0xca96('0x20')]?_[_0xca96('0x23')](_0x2cbf1f['include'],function(_0x683ab9){return{'model':db[_0x683ab9[_0xca96('0x22')]],'as':_0x683ab9['as'],'attributes':_0x683ab9[_0xca96('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca96('0x24')](function(_0x485fd9){logger['info']('GetFaxQueue',_0x48d36d);logger[_0xca96('0x14')](_0xca96('0x1b'),_0x48d36d,JSON['stringify'](_0x485fd9));_0x1dcc9b(_0x485fd9);})[_0xca96('0x25')](function(_0x5c8b92){logger[_0xca96('0x17')](_0xca96('0x1b'),_0x5c8b92['message'],_0x48d36d);_0x31c16c(_0x3b5600[_0xca96('0x17')](0x1f4,_0x5c8b92[_0xca96('0x19')]));});});};exports[_0xca96('0x26')]=function(_0xa9d655){var _0x487f03=this;return new Promise(function(_0x28250a,_0x24ce35){return db['FaxQueue'][_0xca96('0x27')]({'raw':_0xa9d655[_0xca96('0x1c')]?_0xa9d655[_0xca96('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xa9d655[_0xca96('0x1c')]?_0xa9d655[_0xca96('0x1c')][_0xca96('0x1e')]||null:null,'attributes':_0xa9d655[_0xca96('0x1c')]?_0xa9d655[_0xca96('0x1c')][_0xca96('0x21')]||null:null,'include':_0xa9d655[_0xca96('0x1c')]?_0xa9d655[_0xca96('0x1c')][_0xca96('0x20')]?_[_0xca96('0x23')](_0xa9d655[_0xca96('0x1c')]['include'],function(_0x1c5b98){return{'model':db[_0x1c5b98[_0xca96('0x22')]],'as':_0x1c5b98['as'],'attributes':_0x1c5b98[_0xca96('0x21')],'include':_0x1c5b98[_0xca96('0x20')]?_['map'](_0x1c5b98[_0xca96('0x20')],function(_0x5f1e3d){return{'model':db[_0x5f1e3d['model']],'as':_0x5f1e3d['as'],'attributes':_0x5f1e3d[_0xca96('0x21')],'include':_0x5f1e3d['include']?_[_0xca96('0x23')](_0x5f1e3d[_0xca96('0x20')],function(_0x335a5a){return{'model':db[_0x335a5a['model']],'as':_0x335a5a['as'],'attributes':_0x335a5a[_0xca96('0x21')]};}):[]};}):[]};}):[]:[]})[_0xca96('0x24')](function(_0x12f929){logger[_0xca96('0x12')](_0xca96('0x26'),_0xa9d655);logger[_0xca96('0x14')](_0xca96('0x26'),_0xa9d655,JSON[_0xca96('0x16')](_0x12f929));_0x28250a(_0x12f929);})[_0xca96('0x25')](function(_0x426564){logger[_0xca96('0x17')](_0xca96('0x26'),_0x426564[_0xca96('0x19')],_0xa9d655);_0x24ce35(_0x487f03[_0xca96('0x17')](0x1f4,_0x426564[_0xca96('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 56f9b5e..7ac9ccb 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 _0x775d=['save','remove','update','emit','removeListener','register','length','faxQueue:'];(function(_0x4da40a,_0x45f0e2){var _0x14e270=function(_0x3424cf){while(--_0x3424cf){_0x4da40a['push'](_0x4da40a['shift']());}};_0x14e270(++_0x45f0e2);}(_0x775d,0x188));var _0xd775=function(_0x1e3a21,_0xe74a6b){_0x1e3a21=_0x1e3a21-0x0;var _0x3b77a3=_0x775d[_0x1e3a21];return _0x3b77a3;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xd775('0x0'),_0xd775('0x1'),_0xd775('0x2')];function createListener(_0x32e69b,_0x49e570){return function(_0x2fc289){_0x49e570[_0xd775('0x3')](_0x32e69b,_0x2fc289);};}function removeListener(_0x264a69,_0xac04e2){return function(){FaxQueueEvents[_0xd775('0x4')](_0x264a69,_0xac04e2);};}exports[_0xd775('0x5')]=function(_0x2a65f7){for(var _0x2cf1c2=0x0,_0x4c61dd=events[_0xd775('0x6')];_0x2cf1c2<_0x4c61dd;_0x2cf1c2++){var _0xe8b9bf=events[_0x2cf1c2];var _0x5961b4=createListener(_0xd775('0x7')+_0xe8b9bf,_0x2a65f7);FaxQueueEvents['on'](_0xe8b9bf,_0x5961b4);}}; \ No newline at end of file +var _0x8627=['update','emit','removeListener','register','length','faxQueue:','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8627,0xd1));var _0x7862=function(_0x207889,_0x36ff57){_0x207889=_0x207889-0x0;var _0x37b3f7=_0x8627[_0x207889];return _0x37b3f7;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x7862('0x0'),_0x7862('0x1')];function createListener(_0x39b332,_0x449178){return function(_0x36c098){_0x449178[_0x7862('0x2')](_0x39b332,_0x36c098);};}function removeListener(_0x52c238,_0x27771a){return function(){FaxQueueEvents[_0x7862('0x3')](_0x52c238,_0x27771a);};}exports[_0x7862('0x4')]=function(_0x53eb1b){for(var _0x1966f9=0x0,_0x5f1bb8=events[_0x7862('0x5')];_0x1966f9<_0x5f1bb8;_0x1966f9++){var _0x2d400d=events[_0x1966f9];var _0x6c1ec5=createListener(_0x7862('0x6')+_0x2d400d,_0x53eb1b);FaxQueueEvents['on'](_0x2d400d,_0x6c1ec5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ffc1daf..2cf51ab 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a55=['index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x196044,_0x4fd287){var _0xa07a9=function(_0x4cef82){while(--_0x4cef82){_0x196044['push'](_0x196044['shift']());}};_0xa07a9(++_0x4fd287);}(_0x6a55,0xdb));var _0x56a5=function(_0x1ae78f,_0x122ed2){_0x1ae78f=_0x1ae78f-0x0;var _0x5baf80=_0x6a55[_0x1ae78f];return _0x5baf80;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56a5('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x56a5('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x56a5('0x3'));var controller=require('./faxQueue.controller');router[_0x56a5('0x4')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x6')]);router[_0x56a5('0x4')](_0x56a5('0x7'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x8')]);router[_0x56a5('0x4')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x9')]);router[_0x56a5('0x4')](_0x56a5('0xa'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xb')]);router[_0x56a5('0x4')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller['getTeams']);router['get'](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0xe')]);router[_0x56a5('0xf')]('/',auth[_0x56a5('0x5')](),controller[_0x56a5('0x10')]);router['post']('/:id/teams',auth[_0x56a5('0x5')](),controller[_0x56a5('0x11')]);router[_0x56a5('0xf')](_0x56a5('0xd'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x12')]);router[_0x56a5('0x13')]('/:id',auth[_0x56a5('0x5')](),controller['update']);router[_0x56a5('0x14')]('/:id',auth[_0x56a5('0x5')](),controller[_0x56a5('0x15')]);router[_0x56a5('0x14')](_0x56a5('0xc'),auth[_0x56a5('0x5')](),controller[_0x56a5('0x16')]);router[_0x56a5('0x14')]('/:id/users',auth[_0x56a5('0x5')](),controller[_0x56a5('0x17')]);module[_0x56a5('0x18')]=router; \ No newline at end of file +var _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x4bcfa5,_0x1f7989){var _0x337e7a=function(_0x363a18){while(--_0x363a18){_0x4bcfa5['push'](_0x4bcfa5['shift']());}};_0x337e7a(++_0x1f7989);}(_0x8aad,0x146));var _0xd8aa=function(_0x271b97,_0x48695b){_0x271b97=_0x271b97-0x0;var _0x31366b=_0x8aad[_0x271b97];return _0x31366b;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 94850cd..0587365 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 _0xa80e=['STRING','DATE','moment','sequelize','exports'];(function(_0x3f0042,_0x28f8af){var _0x52554c=function(_0x197e76){while(--_0x197e76){_0x3f0042['push'](_0x3f0042['shift']());}};_0x52554c(++_0x28f8af);}(_0xa80e,0x1a1));var _0xea80=function(_0x15e2af,_0x21c9e0){_0x15e2af=_0x15e2af-0x0;var _0x10242f=_0xa80e[_0x15e2af];return _0x10242f;};'use strict';var moment=require(_0xea80('0x0'));var Sequelize=require(_0xea80('0x1'));module[_0xea80('0x2')]={'uniqueid':{'type':Sequelize[_0xea80('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xea80('0x4')]},'leaveAt':{'type':Sequelize[_0xea80('0x4')]},'acceptAt':{'type':Sequelize[_0xea80('0x4')]},'exitAt':{'type':Sequelize[_0xea80('0x4')]},'reason':{'type':Sequelize[_0xea80('0x3')]}}; \ No newline at end of file +var _0x6bcd=['DATE','sequelize','exports','STRING'];(function(_0x2a1f45,_0xf356f2){var _0x1d7ac5=function(_0x45e704){while(--_0x45e704){_0x2a1f45['push'](_0x2a1f45['shift']());}};_0x1d7ac5(++_0xf356f2);}(_0x6bcd,0x89));var _0xd6bc=function(_0x5960ce,_0x2e8c7c){_0x5960ce=_0x5960ce-0x0;var _0x26d155=_0x6bcd[_0x5960ce];return _0x26d155;};'use strict';var moment=require('moment');var Sequelize=require(_0xd6bc('0x0'));module[_0xd6bc('0x1')]={'uniqueid':{'type':Sequelize[_0xd6bc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd6bc('0x2')]},'joinAt':{'type':Sequelize[_0xd6bc('0x3')]},'leaveAt':{'type':Sequelize[_0xd6bc('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd6bc('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index ac9eca6..75cc474 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 _0x2bdb=['count','set','save','then','destroy','end','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','update','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined'];(function(_0x575aa0,_0x45fc91){var _0x4f488e=function(_0x33fc77){while(--_0x33fc77){_0x575aa0['push'](_0x575aa0['shift']());}};_0x4f488e(++_0x45fc91);}(_0x2bdb,0x105));var _0xb2bd=function(_0xdf7d5f,_0x373e4b){_0xdf7d5f=_0xdf7d5f-0x0;var _0x1c9b74=_0x2bdb[_0xdf7d5f];return _0x1c9b74;};'use strict';var emlformat=require(_0xb2bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb2bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2bd('0x2'));var moment=require(_0xb2bd('0x3'));var BPromise=require(_0xb2bd('0x4'));var Mustache=require('mustache');var util=require(_0xb2bd('0x5'));var path=require(_0xb2bd('0x6'));var sox=require(_0xb2bd('0x7'));var csv=require(_0xb2bd('0x8'));var ejs=require(_0xb2bd('0x9'));var fs=require('fs');var fs_extra=require(_0xb2bd('0xa'));var _=require(_0xb2bd('0xb'));var squel=require('squel');var crypto=require(_0xb2bd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb2bd('0xd'));var toCsv=require(_0xb2bd('0x8'));var querystring=require(_0xb2bd('0xe'));var Papa=require(_0xb2bd('0xf'));var Redis=require(_0xb2bd('0x10'));var authService=require(_0xb2bd('0x11'));var qs=require(_0xb2bd('0x12'));var as=require(_0xb2bd('0x13'));var hardwareService=require(_0xb2bd('0x14'));var logger=require('../../config/logger')(_0xb2bd('0x15'));var utils=require(_0xb2bd('0x16'));var config=require(_0xb2bd('0x17'));var licenseUtil=require(_0xb2bd('0x18'));var db=require(_0xb2bd('0x19'))['db'];function respondWithStatusCode(_0x35f174,_0x6d2212){_0x6d2212=_0x6d2212||0xcc;return function(_0x452cd6){if(_0x452cd6){return _0x35f174['sendStatus'](_0x6d2212);}return _0x35f174[_0xb2bd('0x1a')](_0x6d2212)['end']();};}function respondWithResult(_0x2da8e6,_0x2adda1){_0x2adda1=_0x2adda1||0xc8;return function(_0x17e238){if(_0x17e238){return _0x2da8e6[_0xb2bd('0x1a')](_0x2adda1)[_0xb2bd('0x1b')](_0x17e238);}};}function respondWithFilteredResult(_0x47d679,_0x23c440){return function(_0x315ecc){if(_0x315ecc){var _0x2091d2=typeof _0x23c440[_0xb2bd('0x1c')]==='undefined'&&typeof _0x23c440[_0xb2bd('0x1d')]===_0xb2bd('0x1e');var _0x5b632d=_0x315ecc[_0xb2bd('0x1f')];var _0x380089=_0x2091d2?0x0:_0x23c440[_0xb2bd('0x1c')];var _0x315815=_0x2091d2?_0x315ecc['count']:_0x23c440[_0xb2bd('0x1c')]+_0x23c440[_0xb2bd('0x1d')];var _0x58b3b9;if(_0x315815>=_0x5b632d){_0x315815=_0x5b632d;_0x58b3b9=0xc8;}else{_0x58b3b9=0xce;}_0x47d679[_0xb2bd('0x1a')](_0x58b3b9);return _0x47d679[_0xb2bd('0x20')]('Content-Range',_0x380089+'-'+_0x315815+'/'+_0x5b632d)['json'](_0x315ecc);}return null;};}function patchUpdates(_0x51c595){return function(_0x31a69f){try{jsonpatch['apply'](_0x31a69f,_0x51c595,!![]);}catch(_0x33dfdc){return BPromise['reject'](_0x33dfdc);}return _0x31a69f[_0xb2bd('0x21')]();};}function saveUpdates(_0x25b331,_0x505c35){return function(_0x246f71){if(_0x246f71){return _0x246f71['update'](_0x25b331)[_0xb2bd('0x22')](function(_0x24e202){return _0x24e202;});}return null;};}function removeEntity(_0x2d281c,_0x7517de){return function(_0x5665ae){if(_0x5665ae){return _0x5665ae[_0xb2bd('0x23')]()[_0xb2bd('0x22')](function(){_0x2d281c[_0xb2bd('0x1a')](0xcc)[_0xb2bd('0x24')]();});}};}function handleEntityNotFound(_0x42109f,_0x284da5){return function(_0x5fd563){if(!_0x5fd563){_0x42109f['sendStatus'](0x194);}return _0x5fd563;};}function handleError(_0x2d0bf3,_0x18859a){_0x18859a=_0x18859a||0x1f4;return function(_0xdba731){logger[_0xb2bd('0x25')](_0xdba731[_0xb2bd('0x26')]);if(_0xdba731[_0xb2bd('0x27')]){delete _0xdba731[_0xb2bd('0x27')];}_0x2d0bf3['status'](_0x18859a)[_0xb2bd('0x28')](_0xdba731);};}exports['index']=function(_0x3917e5,_0x5a7a7c){var _0xbfae89={},_0x41ba8f={},_0x65211d={'count':0x0,'rows':[]};var _0x5628c3=_[_0xb2bd('0x29')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')],function(_0x4633e1){return{'name':_0x4633e1[_0xb2bd('0x2c')],'type':_0x4633e1[_0xb2bd('0x2d')]['key']};});_0x41ba8f['model']=_[_0xb2bd('0x29')](_0x5628c3,'name');_0x41ba8f[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x3917e5[_0xb2bd('0x2e')]);_0x41ba8f['filters']=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],_0x41ba8f[_0xb2bd('0x2e')]);_0xbfae89[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x41ba8f[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0xbfae89[_0xb2bd('0x32')]=_0xbfae89['attributes'][_0xb2bd('0x34')]?_0xbfae89[_0xb2bd('0x32')]:_0x41ba8f[_0xb2bd('0x31')];if(!_0x3917e5[_0xb2bd('0x2e')]['hasOwnProperty'](_0xb2bd('0x35'))){_0xbfae89[_0xb2bd('0x1d')]=qs[_0xb2bd('0x1d')](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1d')]);_0xbfae89['offset']=qs['offset'](_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x1c')]);}_0xbfae89[_0xb2bd('0x36')]=qs[_0xb2bd('0x37')](_0x3917e5[_0xb2bd('0x2e')]['sort']);_0xbfae89[_0xb2bd('0x38')]=qs[_0xb2bd('0x39')](_[_0xb2bd('0x3a')](_0x3917e5[_0xb2bd('0x2e')],_0x41ba8f[_0xb2bd('0x39')]),_0x5628c3);if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]){_0xbfae89[_0xb2bd('0x38')]=_[_0xb2bd('0x3c')](_0xbfae89[_0xb2bd('0x38')],{'$or':_[_0xb2bd('0x29')](_0x5628c3,function(_0x6ac71c){if(_0x6ac71c[_0xb2bd('0x2d')]!=='VIRTUAL'){var _0x7bc3b8={};_0x7bc3b8[_0x6ac71c[_0xb2bd('0x27')]]={'$like':'%'+_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3b')]+'%'};return _0x7bc3b8;}})});}_0xbfae89=_[_0xb2bd('0x3c')]({},_0xbfae89,_0x3917e5[_0xb2bd('0x3d')]);var _0x342296={'where':_0xbfae89[_0xb2bd('0x38')]};return db['FaxQueueReport']['count'](_0x342296)[_0xb2bd('0x22')](function(_0x13c541){_0x65211d['count']=_0x13c541;if(_0x3917e5[_0xb2bd('0x2e')][_0xb2bd('0x3e')]){_0xbfae89[_0xb2bd('0x3f')]=[{'all':!![]}];}return db[_0xb2bd('0x2a')]['findAll'](_0xbfae89);})[_0xb2bd('0x22')](function(_0x1a5a4f){_0x65211d[_0xb2bd('0x40')]=_0x1a5a4f;return _0x65211d;})['then'](respondWithFilteredResult(_0x5a7a7c,_0xbfae89))[_0xb2bd('0x41')](handleError(_0x5a7a7c,null));};exports[_0xb2bd('0x42')]=function(_0x514e37,_0xbbfd15){var _0x5c316f={'raw':!![],'where':{'id':_0x514e37[_0xb2bd('0x43')]['id']}},_0x285599={};_0x285599['model']=_[_0xb2bd('0x2f')](db[_0xb2bd('0x2a')][_0xb2bd('0x2b')]);_0x285599[_0xb2bd('0x2e')]=_[_0xb2bd('0x2f')](_0x514e37['query']);_0x285599[_0xb2bd('0x39')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],_0x285599[_0xb2bd('0x2e')]);_0x5c316f[_0xb2bd('0x32')]=_[_0xb2bd('0x30')](_0x285599[_0xb2bd('0x31')],qs[_0xb2bd('0x33')](_0x514e37[_0xb2bd('0x2e')][_0xb2bd('0x33')]));_0x5c316f['attributes']=_0x5c316f[_0xb2bd('0x32')][_0xb2bd('0x34')]?_0x5c316f[_0xb2bd('0x32')]:_0x285599[_0xb2bd('0x31')];if(_0x514e37[_0xb2bd('0x2e')]['includeAll']){_0x5c316f[_0xb2bd('0x3f')]=[{'all':!![]}];}_0x5c316f=_[_0xb2bd('0x3c')]({},_0x5c316f,_0x514e37['options']);return db[_0xb2bd('0x2a')]['find'](_0x5c316f)[_0xb2bd('0x22')](handleEntityNotFound(_0xbbfd15,null))[_0xb2bd('0x22')](respondWithResult(_0xbbfd15,null))[_0xb2bd('0x41')](handleError(_0xbbfd15,null));};exports[_0xb2bd('0x44')]=function(_0x3d4b20,_0x4a35f4){return db[_0xb2bd('0x2a')][_0xb2bd('0x44')](_0x3d4b20['body'],{})[_0xb2bd('0x22')](respondWithResult(_0x4a35f4,0xc9))['catch'](handleError(_0x4a35f4,null));};exports[_0xb2bd('0x45')]=function(_0x4021cb,_0x311ab8){if(_0x4021cb[_0xb2bd('0x46')]['id']){delete _0x4021cb[_0xb2bd('0x46')]['id'];}return db[_0xb2bd('0x2a')][_0xb2bd('0x47')]({'where':{'id':_0x4021cb[_0xb2bd('0x43')]['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x311ab8,null))[_0xb2bd('0x22')](saveUpdates(_0x4021cb[_0xb2bd('0x46')],null))[_0xb2bd('0x22')](respondWithResult(_0x311ab8,null))[_0xb2bd('0x41')](handleError(_0x311ab8,null));};exports[_0xb2bd('0x23')]=function(_0x448f29,_0x5037d4){return db['FaxQueueReport'][_0xb2bd('0x47')]({'where':{'id':_0x448f29['params']['id']}})[_0xb2bd('0x22')](handleEntityNotFound(_0x5037d4,null))['then'](removeEntity(_0x5037d4,null))[_0xb2bd('0x41')](handleError(_0x5037d4,null));};exports[_0xb2bd('0x48')]=function(_0x220144,_0x4b65a9){return db['FaxQueueReport'][_0xb2bd('0x48')]()[_0xb2bd('0x22')](respondWithResult(_0x4b65a9,null))[_0xb2bd('0x41')](handleError(_0x4b65a9,null));}; \ No newline at end of file +var _0x5d31=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','FaxQueueReport','include','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes'];(function(_0x5c325f,_0x3968b1){var _0x12cb72=function(_0xc34b64){while(--_0xc34b64){_0x5c325f['push'](_0x5c325f['shift']());}};_0x12cb72(++_0x3968b1);}(_0x5d31,0xf7));var _0x15d3=function(_0x5a69b5,_0x167340){_0x5a69b5=_0x5a69b5-0x0;var _0x33a7fe=_0x5d31[_0x5a69b5];return _0x33a7fe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15d3('0x0'));var zipdir=require(_0x15d3('0x1'));var jsonpatch=require(_0x15d3('0x2'));var rp=require('request-promise');var moment=require(_0x15d3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x15d3('0x4'));var path=require(_0x15d3('0x5'));var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x15d3('0x8'));var _=require(_0x15d3('0x9'));var squel=require(_0x15d3('0xa'));var crypto=require(_0x15d3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x15d3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x15d3('0xd'));var Redis=require('ioredis');var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d3('0xf'));var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var licenseUtil=require(_0x15d3('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x219867,_0x1397d8){_0x1397d8=_0x1397d8||0xcc;return function(_0x2811b5){if(_0x2811b5){return _0x219867[_0x15d3('0x15')](_0x1397d8);}return _0x219867[_0x15d3('0x16')](_0x1397d8)[_0x15d3('0x17')]();};}function respondWithResult(_0x24eb07,_0x1658cf){_0x1658cf=_0x1658cf||0xc8;return function(_0x44b5a4){if(_0x44b5a4){return _0x24eb07[_0x15d3('0x16')](_0x1658cf)[_0x15d3('0x18')](_0x44b5a4);}};}function respondWithFilteredResult(_0x4af3a7,_0x304a13){return function(_0x17401b){if(_0x17401b){var _0x5bbfef=typeof _0x304a13[_0x15d3('0x19')]===_0x15d3('0x1a')&&typeof _0x304a13[_0x15d3('0x1b')]===_0x15d3('0x1a');var _0x1b7b3f=_0x17401b[_0x15d3('0x1c')];var _0x46f9ce=_0x5bbfef?0x0:_0x304a13[_0x15d3('0x19')];var _0x46e18b=_0x5bbfef?_0x17401b[_0x15d3('0x1c')]:_0x304a13[_0x15d3('0x19')]+_0x304a13['limit'];var _0x41c358;if(_0x46e18b>=_0x1b7b3f){_0x46e18b=_0x1b7b3f;_0x41c358=0xc8;}else{_0x41c358=0xce;}_0x4af3a7[_0x15d3('0x16')](_0x41c358);return _0x4af3a7['set']('Content-Range',_0x46f9ce+'-'+_0x46e18b+'/'+_0x1b7b3f)['json'](_0x17401b);}return null;};}function patchUpdates(_0x4ebc97){return function(_0x39bb05){try{jsonpatch[_0x15d3('0x1d')](_0x39bb05,_0x4ebc97,!![]);}catch(_0x40a327){return BPromise[_0x15d3('0x1e')](_0x40a327);}return _0x39bb05[_0x15d3('0x1f')]();};}function saveUpdates(_0x2fa13c,_0x4da198){return function(_0x49eb89){if(_0x49eb89){return _0x49eb89[_0x15d3('0x20')](_0x2fa13c)[_0x15d3('0x21')](function(_0x444075){return _0x444075;});}return null;};}function removeEntity(_0x72852f,_0x5b06cc){return function(_0x232078){if(_0x232078){return _0x232078[_0x15d3('0x22')]()[_0x15d3('0x21')](function(){_0x72852f[_0x15d3('0x16')](0xcc)[_0x15d3('0x17')]();});}};}function handleEntityNotFound(_0x240cf4,_0x4a499a){return function(_0x514380){if(!_0x514380){_0x240cf4['sendStatus'](0x194);}return _0x514380;};}function handleError(_0x31706f,_0x1cd5bc){_0x1cd5bc=_0x1cd5bc||0x1f4;return function(_0x23e1f8){logger[_0x15d3('0x23')](_0x23e1f8[_0x15d3('0x24')]);if(_0x23e1f8[_0x15d3('0x25')]){delete _0x23e1f8[_0x15d3('0x25')];}_0x31706f[_0x15d3('0x16')](_0x1cd5bc)[_0x15d3('0x26')](_0x23e1f8);};}exports['index']=function(_0x5f445a,_0x164aa1){var _0x4e5840={},_0x6a9c0c={},_0x5a2ccf={'count':0x0,'rows':[]};var _0x314c27=_[_0x15d3('0x27')](db['FaxQueueReport'][_0x15d3('0x28')],function(_0x29a947){return{'name':_0x29a947[_0x15d3('0x29')],'type':_0x29a947[_0x15d3('0x2a')][_0x15d3('0x2b')]};});_0x6a9c0c[_0x15d3('0x2c')]=_[_0x15d3('0x27')](_0x314c27,_0x15d3('0x25'));_0x6a9c0c[_0x15d3('0x2d')]=_[_0x15d3('0x2e')](_0x5f445a['query']);_0x6a9c0c[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x6a9c0c[_0x15d3('0x2c')],_0x6a9c0c[_0x15d3('0x2d')]);_0x4e5840[_0x15d3('0x31')]=_[_0x15d3('0x30')](_0x6a9c0c[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x5f445a['query'][_0x15d3('0x32')]));_0x4e5840['attributes']=_0x4e5840[_0x15d3('0x31')][_0x15d3('0x33')]?_0x4e5840[_0x15d3('0x31')]:_0x6a9c0c[_0x15d3('0x2c')];if(!_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x34')](_0x15d3('0x35'))){_0x4e5840[_0x15d3('0x1b')]=qs[_0x15d3('0x1b')](_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x1b')]);_0x4e5840[_0x15d3('0x19')]=qs[_0x15d3('0x19')](_0x5f445a[_0x15d3('0x2d')][_0x15d3('0x19')]);}_0x4e5840['order']=qs[_0x15d3('0x36')](_0x5f445a[_0x15d3('0x2d')]['sort']);_0x4e5840[_0x15d3('0x37')]=qs[_0x15d3('0x2f')](_[_0x15d3('0x38')](_0x5f445a['query'],_0x6a9c0c[_0x15d3('0x2f')]),_0x314c27);if(_0x5f445a['query'][_0x15d3('0x39')]){_0x4e5840[_0x15d3('0x37')]=_['merge'](_0x4e5840[_0x15d3('0x37')],{'$or':_[_0x15d3('0x27')](_0x314c27,function(_0x357073){if(_0x357073[_0x15d3('0x2a')]!==_0x15d3('0x3a')){var _0x3d1803={};_0x3d1803[_0x357073['name']]={'$like':'%'+_0x5f445a[_0x15d3('0x2d')]['filter']+'%'};return _0x3d1803;}})});}_0x4e5840=_[_0x15d3('0x3b')]({},_0x4e5840,_0x5f445a[_0x15d3('0x3c')]);var _0x1b24c5={'where':_0x4e5840[_0x15d3('0x37')]};return db[_0x15d3('0x3d')][_0x15d3('0x1c')](_0x1b24c5)[_0x15d3('0x21')](function(_0x19749b){_0x5a2ccf[_0x15d3('0x1c')]=_0x19749b;if(_0x5f445a[_0x15d3('0x2d')]['includeAll']){_0x4e5840[_0x15d3('0x3e')]=[{'all':!![]}];}return db[_0x15d3('0x3d')]['findAll'](_0x4e5840);})['then'](function(_0x108254){_0x5a2ccf[_0x15d3('0x3f')]=_0x108254;return _0x5a2ccf;})[_0x15d3('0x21')](respondWithFilteredResult(_0x164aa1,_0x4e5840))[_0x15d3('0x40')](handleError(_0x164aa1,null));};exports[_0x15d3('0x41')]=function(_0x473dae,_0x1240e5){var _0x442faf={'raw':!![],'where':{'id':_0x473dae[_0x15d3('0x42')]['id']}},_0x25fa1d={};_0x25fa1d['model']=_[_0x15d3('0x2e')](db[_0x15d3('0x3d')]['rawAttributes']);_0x25fa1d[_0x15d3('0x2d')]=_['keys'](_0x473dae['query']);_0x25fa1d[_0x15d3('0x2f')]=_[_0x15d3('0x30')](_0x25fa1d[_0x15d3('0x2c')],_0x25fa1d['query']);_0x442faf[_0x15d3('0x31')]=_['intersection'](_0x25fa1d[_0x15d3('0x2c')],qs[_0x15d3('0x32')](_0x473dae[_0x15d3('0x2d')][_0x15d3('0x32')]));_0x442faf[_0x15d3('0x31')]=_0x442faf['attributes']['length']?_0x442faf['attributes']:_0x25fa1d[_0x15d3('0x2c')];if(_0x473dae['query'][_0x15d3('0x43')]){_0x442faf[_0x15d3('0x3e')]=[{'all':!![]}];}_0x442faf=_[_0x15d3('0x3b')]({},_0x442faf,_0x473dae['options']);return db[_0x15d3('0x3d')][_0x15d3('0x44')](_0x442faf)[_0x15d3('0x21')](handleEntityNotFound(_0x1240e5,null))[_0x15d3('0x21')](respondWithResult(_0x1240e5,null))[_0x15d3('0x40')](handleError(_0x1240e5,null));};exports[_0x15d3('0x45')]=function(_0x62ccb9,_0x46a39a){return db[_0x15d3('0x3d')][_0x15d3('0x45')](_0x62ccb9[_0x15d3('0x46')],{})[_0x15d3('0x21')](respondWithResult(_0x46a39a,0xc9))['catch'](handleError(_0x46a39a,null));};exports['update']=function(_0x264487,_0x446929){if(_0x264487[_0x15d3('0x46')]['id']){delete _0x264487['body']['id'];}return db['FaxQueueReport'][_0x15d3('0x44')]({'where':{'id':_0x264487['params']['id']}})[_0x15d3('0x21')](handleEntityNotFound(_0x446929,null))['then'](saveUpdates(_0x264487[_0x15d3('0x46')],null))[_0x15d3('0x21')](respondWithResult(_0x446929,null))['catch'](handleError(_0x446929,null));};exports['destroy']=function(_0x480c9d,_0x5222bf){return db['FaxQueueReport'][_0x15d3('0x44')]({'where':{'id':_0x480c9d[_0x15d3('0x42')]['id']}})['then'](handleEntityNotFound(_0x5222bf,null))[_0x15d3('0x21')](removeEntity(_0x5222bf,null))[_0x15d3('0x40')](handleError(_0x5222bf,null));};exports[_0x15d3('0x47')]=function(_0x51997f,_0x19d713){return db[_0x15d3('0x3d')][_0x15d3('0x47')]()[_0x15d3('0x21')](respondWithResult(_0x19d713,null))[_0x15d3('0x40')](handleError(_0x19d713,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 03a206e..5140a9c 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x43cf07,_0x9db1a1){var _0x13fd6d=function(_0x469747){while(--_0x469747){_0x43cf07['push'](_0x43cf07['shift']());}};_0x13fd6d(++_0x9db1a1);}(_0x7a54,0x106));var _0x47a5=function(_0x110752,_0x3d3a31){_0x110752=_0x110752-0x0;var _0x54427d=_0x7a54[_0x110752];return _0x54427d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1d36b7,_0xd45c71){var _0x3af6aa=function(_0x2af000){while(--_0x2af000){_0x1d36b7['push'](_0x1d36b7['shift']());}};_0x3af6aa(++_0xd45c71);}(_0x4975,0x86));var _0x5497=function(_0x56c3f8,_0x11b6e6){_0x56c3f8=_0x56c3f8-0x0;var _0x2d5a67=_0x4975[_0x56c3f8];return _0x2d5a67;};'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 6f116b4..22a0983 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 _0xb018=['create','options','CreateFaxQueueReport','UpdateFaxQueueReport','body','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueueReport'];(function(_0x351b46,_0x26b265){var _0x1515df=function(_0x22896a){while(--_0x22896a){_0x351b46['push'](_0x351b46['shift']());}};_0x1515df(++_0x26b265);}(_0xb018,0x194));var _0x8b01=function(_0x4cc14b,_0xebaa4b){_0x4cc14b=_0x4cc14b-0x0;var _0x122c98=_0xb018[_0x4cc14b];return _0x122c98;};'use strict';var _=require(_0x8b01('0x0'));var util=require(_0x8b01('0x1'));var moment=require(_0x8b01('0x2'));var BPromise=require(_0x8b01('0x3'));var rs=require(_0x8b01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b01('0x5'))['db'];var utils=require(_0x8b01('0x6'));var logger=require(_0x8b01('0x7'))(_0x8b01('0x8'));var config=require('../../config/environment');var jayson=require(_0x8b01('0x9'));var client=jayson[_0x8b01('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x341026,_0x30045e,_0x49ea15){return new BPromise(function(_0x13f7d9,_0x180914){return client[_0x8b01('0xb')](_0x341026,_0x49ea15)[_0x8b01('0xc')](function(_0x4588f3){logger[_0x8b01('0xd')](_0x8b01('0xe'),_0x30045e,'request\x20sent');logger[_0x8b01('0xf')](_0x8b01('0x10'),_0x30045e,_0x8b01('0x11'),JSON[_0x8b01('0x12')](_0x4588f3));if(_0x4588f3[_0x8b01('0x13')]){if(_0x4588f3[_0x8b01('0x13')][_0x8b01('0x14')]===0x1f4){logger[_0x8b01('0x13')](_0x8b01('0xe'),_0x30045e,_0x4588f3[_0x8b01('0x13')][_0x8b01('0x15')]);return _0x180914(_0x4588f3['error'][_0x8b01('0x15')]);}logger['error'](_0x8b01('0xe'),_0x30045e,_0x4588f3[_0x8b01('0x13')][_0x8b01('0x15')]);return _0x13f7d9(_0x4588f3[_0x8b01('0x13')]['message']);}else{logger[_0x8b01('0xd')](_0x8b01('0xe'),_0x30045e,_0x8b01('0x11'));_0x13f7d9(_0x4588f3[_0x8b01('0x16')][_0x8b01('0x15')]);}})[_0x8b01('0x17')](function(_0xbf3216){logger[_0x8b01('0x13')](_0x8b01('0xe'),_0x30045e,_0xbf3216);_0x180914(_0xbf3216);});});}exports['CreateFaxQueueReport']=function(_0x2176b6){var _0x118b9b=this;return new Promise(function(_0x3a7bd6,_0x4259f4){return db[_0x8b01('0x18')][_0x8b01('0x19')](_0x2176b6['body'],{'raw':_0x2176b6[_0x8b01('0x1a')]?_0x2176b6[_0x8b01('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8b01('0xc')](function(_0xeced0c){logger[_0x8b01('0xd')]('CreateFaxQueueReport',_0x2176b6);logger[_0x8b01('0xf')](_0x8b01('0x1b'),_0x2176b6,JSON[_0x8b01('0x12')](_0xeced0c));_0x3a7bd6(_0xeced0c);})['catch'](function(_0x4d8a7e){logger[_0x8b01('0x13')](_0x8b01('0x1b'),_0x4d8a7e[_0x8b01('0x15')],_0x2176b6);_0x4259f4(_0x118b9b['error'](0x1f4,_0x4d8a7e[_0x8b01('0x15')]));});});};exports[_0x8b01('0x1c')]=function(_0x121e8d){var _0x2d5305=this;return new Promise(function(_0x255f4b,_0x140d78){return db[_0x8b01('0x18')]['update'](_0x121e8d[_0x8b01('0x1d')],{'raw':_0x121e8d['options']?_0x121e8d[_0x8b01('0x1a')][_0x8b01('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x121e8d[_0x8b01('0x1a')]?_0x121e8d['options'][_0x8b01('0x1f')]||null:null,'attributes':_0x121e8d[_0x8b01('0x1a')]?_0x121e8d['options'][_0x8b01('0x20')]||null:null,'limit':_0x121e8d[_0x8b01('0x1a')]?_0x121e8d[_0x8b01('0x1a')]['limit']||null:null})[_0x8b01('0xc')](function(_0x1b40d8){logger[_0x8b01('0xd')](_0x8b01('0x1c'),_0x121e8d);logger[_0x8b01('0xf')](_0x8b01('0x1c'),_0x121e8d,JSON[_0x8b01('0x12')](_0x1b40d8));_0x255f4b(_0x1b40d8);})[_0x8b01('0x17')](function(_0x4c6296){logger['error'](_0x8b01('0x1c'),_0x4c6296['message'],_0x121e8d);_0x140d78(_0x2d5305['error'](0x1f4,_0x4c6296[_0x8b01('0x15')]));});});}; \ No newline at end of file +var _0xb84c=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','catch','UpdateFaxQueueReport','body','where','attributes','limit','debug'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xb84c,0x1f0));var _0xcb84=function(_0x5a8e00,_0x9d3c22){_0x5a8e00=_0x5a8e00-0x0;var _0x41b217=_0xb84c[_0x5a8e00];return _0x41b217;};'use strict';var _=require(_0xcb84('0x0'));var util=require(_0xcb84('0x1'));var moment=require('moment');var BPromise=require(_0xcb84('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb84('0x3'))['db'];var utils=require(_0xcb84('0x4'));var logger=require(_0xcb84('0x5'))(_0xcb84('0x6'));var config=require(_0xcb84('0x7'));var jayson=require(_0xcb84('0x8'));var client=jayson[_0xcb84('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5723c6,_0x5b42e1,_0x5b2bcb){return new BPromise(function(_0x541d75,_0x220993){return client[_0xcb84('0xa')](_0x5723c6,_0x5b2bcb)[_0xcb84('0xb')](function(_0x5b8d2e){logger[_0xcb84('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x5b42e1,_0xcb84('0xd'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x5b42e1,_0xcb84('0xd'),JSON[_0xcb84('0xe')](_0x5b8d2e));if(_0x5b8d2e['error']){if(_0x5b8d2e[_0xcb84('0xf')][_0xcb84('0x10')]===0x1f4){logger[_0xcb84('0xf')](_0xcb84('0x11'),_0x5b42e1,_0x5b8d2e['error'][_0xcb84('0x12')]);return _0x220993(_0x5b8d2e[_0xcb84('0xf')]['message']);}logger['error'](_0xcb84('0x11'),_0x5b42e1,_0x5b8d2e[_0xcb84('0xf')][_0xcb84('0x12')]);return _0x541d75(_0x5b8d2e[_0xcb84('0xf')][_0xcb84('0x12')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x5b42e1,'request\x20sent');_0x541d75(_0x5b8d2e[_0xcb84('0x13')][_0xcb84('0x12')]);}})['catch'](function(_0x5d37b4){logger[_0xcb84('0xf')](_0xcb84('0x11'),_0x5b42e1,_0x5d37b4);_0x220993(_0x5d37b4);});});}exports[_0xcb84('0x14')]=function(_0x2eaf9a){var _0x5727e1=this;return new Promise(function(_0x5735fc,_0x3cc839){return db[_0xcb84('0x15')][_0xcb84('0x16')](_0x2eaf9a['body'],{'raw':_0x2eaf9a[_0xcb84('0x17')]?_0x2eaf9a[_0xcb84('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x39b91d){logger['info'](_0xcb84('0x14'),_0x2eaf9a);logger['debug']('CreateFaxQueueReport',_0x2eaf9a,JSON['stringify'](_0x39b91d));_0x5735fc(_0x39b91d);})[_0xcb84('0x18')](function(_0x5c3798){logger[_0xcb84('0xf')]('CreateFaxQueueReport',_0x5c3798[_0xcb84('0x12')],_0x2eaf9a);_0x3cc839(_0x5727e1[_0xcb84('0xf')](0x1f4,_0x5c3798['message']));});});};exports[_0xcb84('0x19')]=function(_0x1cac08){var _0x3cfc6b=this;return new Promise(function(_0x329ee0,_0x554664){return db['FaxQueueReport']['update'](_0x1cac08[_0xcb84('0x1a')],{'raw':_0x1cac08[_0xcb84('0x17')]?_0x1cac08[_0xcb84('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cac08['options']?_0x1cac08['options'][_0xcb84('0x1b')]||null:null,'attributes':_0x1cac08['options']?_0x1cac08[_0xcb84('0x17')][_0xcb84('0x1c')]||null:null,'limit':_0x1cac08['options']?_0x1cac08[_0xcb84('0x17')][_0xcb84('0x1d')]||null:null})[_0xcb84('0xb')](function(_0x1fee99){logger[_0xcb84('0xc')]('UpdateFaxQueueReport',_0x1cac08);logger[_0xcb84('0x1e')](_0xcb84('0x19'),_0x1cac08,JSON['stringify'](_0x1fee99));_0x329ee0(_0x1fee99);})[_0xcb84('0x18')](function(_0x2ad75a){logger[_0xcb84('0xf')](_0xcb84('0x19'),_0x2ad75a[_0xcb84('0x12')],_0x1cac08);_0x554664(_0x3cfc6b[_0xcb84('0xf')](0x1f4,_0x2ad75a[_0xcb84('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 8e5429b..e889227 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 _0x384e=['destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete'];(function(_0x8d4eb8,_0x3989f5){var _0x5ab65d=function(_0x343058){while(--_0x343058){_0x8d4eb8['push'](_0x8d4eb8['shift']());}};_0x5ab65d(++_0x3989f5);}(_0x384e,0x1a6));var _0xe384=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x384e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe384('0x0'));var util=require(_0xe384('0x1'));var path=require(_0xe384('0x2'));var timeout=require(_0xe384('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe384('0x4'));var config=require(_0xe384('0x5'));var controller=require(_0xe384('0x6'));router[_0xe384('0x7')]('/',auth['isAuthenticated'](),controller[_0xe384('0x8')]);router['get'](_0xe384('0x9'),auth[_0xe384('0xa')](),controller[_0xe384('0xb')]);router[_0xe384('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe384('0xc')]('/',auth['isAuthenticated'](),controller[_0xe384('0xd')]);router[_0xe384('0xe')](_0xe384('0xf'),auth[_0xe384('0xa')](),controller[_0xe384('0x10')]);router[_0xe384('0x11')]('/:id',auth[_0xe384('0xa')](),controller[_0xe384('0x12')]);module[_0xe384('0x13')]=router; \ No newline at end of file +var _0x9f3b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','/:id','show','post','create','delete','util','connect-timeout','express','Router','fs-extra'];(function(_0x91d46c,_0x2ec5cc){var _0x576889=function(_0x486c5c){while(--_0x486c5c){_0x91d46c['push'](_0x91d46c['shift']());}};_0x576889(++_0x2ec5cc);}(_0x9f3b,0x1b5));var _0xb9f3=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x9f3b[_0x11ce46];return _0x368a1e;};'use strict';var multer=require('multer');var util=require(_0xb9f3('0x0'));var path=require('path');var timeout=require(_0xb9f3('0x1'));var express=require(_0xb9f3('0x2'));var router=express[_0xb9f3('0x3')]();var fs_extra=require(_0xb9f3('0x4'));var auth=require(_0xb9f3('0x5'));var interaction=require(_0xb9f3('0x6'));var config=require(_0xb9f3('0x7'));var controller=require(_0xb9f3('0x8'));router[_0xb9f3('0x9')]('/',auth['isAuthenticated'](),controller[_0xb9f3('0xa')]);router[_0xb9f3('0x9')]('/describe',auth[_0xb9f3('0xb')](),controller['describe']);router[_0xb9f3('0x9')](_0xb9f3('0xc'),auth[_0xb9f3('0xb')](),controller[_0xb9f3('0xd')]);router[_0xb9f3('0xe')]('/',auth[_0xb9f3('0xb')](),controller[_0xb9f3('0xf')]);router['put']('/:id',auth[_0xb9f3('0xb')](),controller['update']);router[_0xb9f3('0x10')](_0xb9f3('0xc'),auth[_0xb9f3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 804e83c..9275497 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x594670,_0x4b9fdd){var _0x36a5b7=function(_0x45471e){while(--_0x45471e){_0x594670['push'](_0x594670['shift']());}};_0x36a5b7(++_0x4b9fdd);}(_0x54ef,0x112));var _0xf54e=function(_0x28e322,_0x385abc){_0x28e322=_0x28e322-0x0;var _0x247194=_0x54ef[_0x28e322];return _0x247194;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0xb43b,0x1b2));var _0xbb43=function(_0xd28f4c,_0x13f0df){_0xd28f4c=_0xd28f4c-0x0;var _0x306f8d=_0xb43b[_0xd28f4c];return _0x306f8d;};'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/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5544abf..7f12dad 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 _0x7209=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','FaxTransferReport','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','status','stack','name','send','index','map','fieldName','type','keys','query','filters','model','intersection'];(function(_0x3d267b,_0x2555a1){var _0x3308f3=function(_0x1b8353){while(--_0x1b8353){_0x3d267b['push'](_0x3d267b['shift']());}};_0x3308f3(++_0x2555a1);}(_0x7209,0xf8));var _0x9720=function(_0x2c055f,_0xa95807){_0x2c055f=_0x2c055f-0x0;var _0x1c9564=_0x7209[_0x2c055f];return _0x1c9564;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9720('0x0'));var jsonpatch=require(_0x9720('0x1'));var rp=require(_0x9720('0x2'));var moment=require(_0x9720('0x3'));var BPromise=require(_0x9720('0x4'));var Mustache=require(_0x9720('0x5'));var util=require(_0x9720('0x6'));var path=require(_0x9720('0x7'));var sox=require(_0x9720('0x8'));var csv=require(_0x9720('0x9'));var ejs=require(_0x9720('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9720('0xb'));var crypto=require(_0x9720('0xc'));var jsforce=require(_0x9720('0xd'));var deskjs=require(_0x9720('0xe'));var toCsv=require(_0x9720('0x9'));var querystring=require(_0x9720('0xf'));var Papa=require(_0x9720('0x10'));var Redis=require(_0x9720('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9720('0x12'));var hardwareService=require(_0x9720('0x13'));var logger=require(_0x9720('0x14'))(_0x9720('0x15'));var utils=require(_0x9720('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9720('0x17'));var db=require(_0x9720('0x18'))['db'];function respondWithStatusCode(_0x51d632,_0x46f0d9){_0x46f0d9=_0x46f0d9||0xcc;return function(_0x4abc6a){if(_0x4abc6a){return _0x51d632[_0x9720('0x19')](_0x46f0d9);}return _0x51d632['status'](_0x46f0d9)[_0x9720('0x1a')]();};}function respondWithResult(_0xb063c1,_0xbb3a4c){_0xbb3a4c=_0xbb3a4c||0xc8;return function(_0xff4842){if(_0xff4842){return _0xb063c1['status'](_0xbb3a4c)['json'](_0xff4842);}};}function respondWithFilteredResult(_0x497255,_0x1bd139){return function(_0x366331){if(_0x366331){var _0x9524d5=typeof _0x1bd139['offset']===_0x9720('0x1b')&&typeof _0x1bd139['limit']===_0x9720('0x1b');var _0xb366de=_0x366331[_0x9720('0x1c')];var _0x459695=_0x9524d5?0x0:_0x1bd139['offset'];var _0x33a64d=_0x9524d5?_0x366331[_0x9720('0x1c')]:_0x1bd139[_0x9720('0x1d')]+_0x1bd139[_0x9720('0x1e')];var _0x205eef;if(_0x33a64d>=_0xb366de){_0x33a64d=_0xb366de;_0x205eef=0xc8;}else{_0x205eef=0xce;}_0x497255['status'](_0x205eef);return _0x497255[_0x9720('0x1f')](_0x9720('0x20'),_0x459695+'-'+_0x33a64d+'/'+_0xb366de)['json'](_0x366331);}return null;};}function patchUpdates(_0x374e2b){return function(_0x52f491){try{jsonpatch[_0x9720('0x21')](_0x52f491,_0x374e2b,!![]);}catch(_0x425c83){return BPromise[_0x9720('0x22')](_0x425c83);}return _0x52f491[_0x9720('0x23')]();};}function saveUpdates(_0x5bc6a5,_0x58dd55){return function(_0x439744){if(_0x439744){return _0x439744[_0x9720('0x24')](_0x5bc6a5)[_0x9720('0x25')](function(_0x483278){return _0x483278;});}return null;};}function removeEntity(_0x468598,_0x3b0b83){return function(_0x2ba38a){if(_0x2ba38a){return _0x2ba38a[_0x9720('0x26')]()[_0x9720('0x25')](function(){_0x468598[_0x9720('0x27')](0xcc)[_0x9720('0x1a')]();});}};}function handleEntityNotFound(_0x546af8,_0x39775d){return function(_0x331a91){if(!_0x331a91){_0x546af8[_0x9720('0x19')](0x194);}return _0x331a91;};}function handleError(_0x470f26,_0x458dd3){_0x458dd3=_0x458dd3||0x1f4;return function(_0xa5eefa){logger['error'](_0xa5eefa[_0x9720('0x28')]);if(_0xa5eefa[_0x9720('0x29')]){delete _0xa5eefa[_0x9720('0x29')];}_0x470f26[_0x9720('0x27')](_0x458dd3)[_0x9720('0x2a')](_0xa5eefa);};}exports[_0x9720('0x2b')]=function(_0x5eb09a,_0x13a92a){var _0x2f6d53={},_0x1b9f55={},_0x5adb79={'count':0x0,'rows':[]};var _0x185885=_[_0x9720('0x2c')](db['FaxTransferReport']['rawAttributes'],function(_0x568897){return{'name':_0x568897[_0x9720('0x2d')],'type':_0x568897[_0x9720('0x2e')]['key']};});_0x1b9f55['model']=_['map'](_0x185885,_0x9720('0x29'));_0x1b9f55['query']=_[_0x9720('0x2f')](_0x5eb09a[_0x9720('0x30')]);_0x1b9f55[_0x9720('0x31')]=_['intersection'](_0x1b9f55[_0x9720('0x32')],_0x1b9f55['query']);_0x2f6d53['attributes']=_[_0x9720('0x33')](_0x1b9f55[_0x9720('0x32')],qs[_0x9720('0x34')](_0x5eb09a[_0x9720('0x30')][_0x9720('0x34')]));_0x2f6d53[_0x9720('0x35')]=_0x2f6d53[_0x9720('0x35')][_0x9720('0x36')]?_0x2f6d53[_0x9720('0x35')]:_0x1b9f55[_0x9720('0x32')];if(!_0x5eb09a['query'][_0x9720('0x37')](_0x9720('0x38'))){_0x2f6d53[_0x9720('0x1e')]=qs[_0x9720('0x1e')](_0x5eb09a[_0x9720('0x30')]['limit']);_0x2f6d53['offset']=qs[_0x9720('0x1d')](_0x5eb09a[_0x9720('0x30')][_0x9720('0x1d')]);}_0x2f6d53[_0x9720('0x39')]=qs[_0x9720('0x3a')](_0x5eb09a[_0x9720('0x30')][_0x9720('0x3a')]);_0x2f6d53['where']=qs['filters'](_[_0x9720('0x3b')](_0x5eb09a['query'],_0x1b9f55[_0x9720('0x31')]),_0x185885);if(_0x5eb09a['query']['filter']){_0x2f6d53['where']=_[_0x9720('0x3c')](_0x2f6d53[_0x9720('0x3d')],{'$or':_[_0x9720('0x2c')](_0x185885,function(_0x51b22d){if(_0x51b22d['type']!=='VIRTUAL'){var _0x3933c1={};_0x3933c1[_0x51b22d[_0x9720('0x29')]]={'$like':'%'+_0x5eb09a['query'][_0x9720('0x3e')]+'%'};return _0x3933c1;}})});}_0x2f6d53=_[_0x9720('0x3c')]({},_0x2f6d53,_0x5eb09a['options']);var _0x185d4e={'where':_0x2f6d53[_0x9720('0x3d')]};return db[_0x9720('0x3f')][_0x9720('0x1c')](_0x185d4e)[_0x9720('0x25')](function(_0xa77359){_0x5adb79[_0x9720('0x1c')]=_0xa77359;if(_0x5eb09a['query'][_0x9720('0x40')]){_0x2f6d53['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x9720('0x41')](_0x2f6d53);})[_0x9720('0x25')](function(_0x52a05a){_0x5adb79[_0x9720('0x42')]=_0x52a05a;return _0x5adb79;})['then'](respondWithFilteredResult(_0x13a92a,_0x2f6d53))[_0x9720('0x43')](handleError(_0x13a92a,null));};exports[_0x9720('0x44')]=function(_0x5c2ee6,_0x1c114e){var _0x1c358c={'raw':!![],'where':{'id':_0x5c2ee6[_0x9720('0x45')]['id']}},_0x6b48d9={};_0x6b48d9[_0x9720('0x32')]=_[_0x9720('0x2f')](db['FaxTransferReport']['rawAttributes']);_0x6b48d9[_0x9720('0x30')]=_[_0x9720('0x2f')](_0x5c2ee6[_0x9720('0x30')]);_0x6b48d9[_0x9720('0x31')]=_[_0x9720('0x33')](_0x6b48d9[_0x9720('0x32')],_0x6b48d9[_0x9720('0x30')]);_0x1c358c[_0x9720('0x35')]=_[_0x9720('0x33')](_0x6b48d9[_0x9720('0x32')],qs[_0x9720('0x34')](_0x5c2ee6[_0x9720('0x30')][_0x9720('0x34')]));_0x1c358c['attributes']=_0x1c358c[_0x9720('0x35')][_0x9720('0x36')]?_0x1c358c[_0x9720('0x35')]:_0x6b48d9['model'];if(_0x5c2ee6[_0x9720('0x30')]['includeAll']){_0x1c358c[_0x9720('0x46')]=[{'all':!![]}];}_0x1c358c=_[_0x9720('0x3c')]({},_0x1c358c,_0x5c2ee6['options']);return db[_0x9720('0x3f')][_0x9720('0x47')](_0x1c358c)['then'](handleEntityNotFound(_0x1c114e,null))['then'](respondWithResult(_0x1c114e,null))['catch'](handleError(_0x1c114e,null));};exports[_0x9720('0x48')]=function(_0x1455b5,_0x5a71d0){return db[_0x9720('0x3f')]['create'](_0x1455b5['body'],{})[_0x9720('0x25')](respondWithResult(_0x5a71d0,0xc9))['catch'](handleError(_0x5a71d0,null));};exports[_0x9720('0x24')]=function(_0x3f9dde,_0x4aeadc){if(_0x3f9dde[_0x9720('0x49')]['id']){delete _0x3f9dde[_0x9720('0x49')]['id'];}return db[_0x9720('0x3f')][_0x9720('0x47')]({'where':{'id':_0x3f9dde['params']['id']}})[_0x9720('0x25')](handleEntityNotFound(_0x4aeadc,null))['then'](saveUpdates(_0x3f9dde[_0x9720('0x49')],null))[_0x9720('0x25')](respondWithResult(_0x4aeadc,null))[_0x9720('0x43')](handleError(_0x4aeadc,null));};exports[_0x9720('0x26')]=function(_0x53e0c4,_0x146590){return db[_0x9720('0x3f')][_0x9720('0x47')]({'where':{'id':_0x53e0c4['params']['id']}})[_0x9720('0x25')](handleEntityNotFound(_0x146590,null))['then'](removeEntity(_0x146590,null))[_0x9720('0x43')](handleError(_0x146590,null));};exports['describe']=function(_0x1f1525,_0x25563a){return db[_0x9720('0x3f')][_0x9720('0x4a')]()['then'](respondWithResult(_0x25563a,null))[_0x9720('0x43')](handleError(_0x25563a,null));}; \ No newline at end of file +var _0x6851=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','FaxTransferReport','type','key','model','query','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x15df1e,_0x50d8c4){var _0x6f5df6=function(_0x35ce1d){while(--_0x35ce1d){_0x15df1e['push'](_0x15df1e['shift']());}};_0x6f5df6(++_0x50d8c4);}(_0x6851,0x81));var _0x1685=function(_0xc5b753,_0x10a712){_0xc5b753=_0xc5b753-0x0;var _0x5805bb=_0x6851[_0xc5b753];return _0x5805bb;};'use strict';var emlformat=require(_0x1685('0x0'));var rimraf=require(_0x1685('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1685('0x2'));var moment=require('moment');var BPromise=require(_0x1685('0x3'));var Mustache=require(_0x1685('0x4'));var util=require(_0x1685('0x5'));var path=require('path');var sox=require(_0x1685('0x6'));var csv=require('to-csv');var ejs=require(_0x1685('0x7'));var fs=require('fs');var fs_extra=require(_0x1685('0x8'));var _=require(_0x1685('0x9'));var squel=require('squel');var crypto=require(_0x1685('0xa'));var jsforce=require(_0x1685('0xb'));var deskjs=require(_0x1685('0xc'));var toCsv=require(_0x1685('0xd'));var querystring=require(_0x1685('0xe'));var Papa=require('papaparse');var Redis=require(_0x1685('0xf'));var authService=require(_0x1685('0x10'));var qs=require(_0x1685('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1685('0x12'))(_0x1685('0x13'));var utils=require(_0x1685('0x14'));var config=require(_0x1685('0x15'));var licenseUtil=require(_0x1685('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19318f,_0x24d9c0){_0x24d9c0=_0x24d9c0||0xcc;return function(_0x17ee43){if(_0x17ee43){return _0x19318f[_0x1685('0x17')](_0x24d9c0);}return _0x19318f['status'](_0x24d9c0)[_0x1685('0x18')]();};}function respondWithResult(_0xc63d7b,_0x3449d0){_0x3449d0=_0x3449d0||0xc8;return function(_0x55ff74){if(_0x55ff74){return _0xc63d7b[_0x1685('0x19')](_0x3449d0)['json'](_0x55ff74);}};}function respondWithFilteredResult(_0x339ce0,_0x47d09a){return function(_0x466068){if(_0x466068){var _0x1a7237=typeof _0x47d09a[_0x1685('0x1a')]===_0x1685('0x1b')&&typeof _0x47d09a[_0x1685('0x1c')]==='undefined';var _0x13a90d=_0x466068[_0x1685('0x1d')];var _0xcd9250=_0x1a7237?0x0:_0x47d09a[_0x1685('0x1a')];var _0x48b876=_0x1a7237?_0x466068[_0x1685('0x1d')]:_0x47d09a['offset']+_0x47d09a[_0x1685('0x1c')];var _0x1695a4;if(_0x48b876>=_0x13a90d){_0x48b876=_0x13a90d;_0x1695a4=0xc8;}else{_0x1695a4=0xce;}_0x339ce0[_0x1685('0x19')](_0x1695a4);return _0x339ce0[_0x1685('0x1e')](_0x1685('0x1f'),_0xcd9250+'-'+_0x48b876+'/'+_0x13a90d)[_0x1685('0x20')](_0x466068);}return null;};}function patchUpdates(_0x3788c2){return function(_0xb727b1){try{jsonpatch[_0x1685('0x21')](_0xb727b1,_0x3788c2,!![]);}catch(_0x1c230b){return BPromise[_0x1685('0x22')](_0x1c230b);}return _0xb727b1[_0x1685('0x23')]();};}function saveUpdates(_0x46b8e6,_0x57e7e1){return function(_0x382ad3){if(_0x382ad3){return _0x382ad3[_0x1685('0x24')](_0x46b8e6)[_0x1685('0x25')](function(_0x37f0ae){return _0x37f0ae;});}return null;};}function removeEntity(_0x1a8ff0,_0x1b7be9){return function(_0x41f235){if(_0x41f235){return _0x41f235['destroy']()[_0x1685('0x25')](function(){_0x1a8ff0['status'](0xcc)[_0x1685('0x18')]();});}};}function handleEntityNotFound(_0xc5fb50,_0x15ee23){return function(_0x1302ff){if(!_0x1302ff){_0xc5fb50[_0x1685('0x17')](0x194);}return _0x1302ff;};}function handleError(_0x161a8d,_0x12d0af){_0x12d0af=_0x12d0af||0x1f4;return function(_0x5dc5f0){logger[_0x1685('0x26')](_0x5dc5f0[_0x1685('0x27')]);if(_0x5dc5f0['name']){delete _0x5dc5f0[_0x1685('0x28')];}_0x161a8d[_0x1685('0x19')](_0x12d0af)[_0x1685('0x29')](_0x5dc5f0);};}exports[_0x1685('0x2a')]=function(_0x1c1d3b,_0x4e8e67){var _0x35d017={},_0xda0385={},_0x34b324={'count':0x0,'rows':[]};var _0x28318f=_[_0x1685('0x2b')](db[_0x1685('0x2c')]['rawAttributes'],function(_0x4e358c){return{'name':_0x4e358c['fieldName'],'type':_0x4e358c[_0x1685('0x2d')][_0x1685('0x2e')]};});_0xda0385[_0x1685('0x2f')]=_[_0x1685('0x2b')](_0x28318f,_0x1685('0x28'));_0xda0385[_0x1685('0x30')]=_['keys'](_0x1c1d3b['query']);_0xda0385['filters']=_[_0x1685('0x31')](_0xda0385['model'],_0xda0385['query']);_0x35d017[_0x1685('0x32')]=_[_0x1685('0x31')](_0xda0385[_0x1685('0x2f')],qs['fields'](_0x1c1d3b[_0x1685('0x30')][_0x1685('0x33')]));_0x35d017[_0x1685('0x32')]=_0x35d017[_0x1685('0x32')][_0x1685('0x34')]?_0x35d017[_0x1685('0x32')]:_0xda0385['model'];if(!_0x1c1d3b[_0x1685('0x30')]['hasOwnProperty']('nolimit')){_0x35d017[_0x1685('0x1c')]=qs[_0x1685('0x1c')](_0x1c1d3b['query'][_0x1685('0x1c')]);_0x35d017[_0x1685('0x1a')]=qs[_0x1685('0x1a')](_0x1c1d3b[_0x1685('0x30')][_0x1685('0x1a')]);}_0x35d017[_0x1685('0x35')]=qs[_0x1685('0x36')](_0x1c1d3b[_0x1685('0x30')][_0x1685('0x36')]);_0x35d017[_0x1685('0x37')]=qs['filters'](_[_0x1685('0x38')](_0x1c1d3b['query'],_0xda0385[_0x1685('0x39')]),_0x28318f);if(_0x1c1d3b[_0x1685('0x30')][_0x1685('0x3a')]){_0x35d017[_0x1685('0x37')]=_[_0x1685('0x3b')](_0x35d017[_0x1685('0x37')],{'$or':_[_0x1685('0x2b')](_0x28318f,function(_0x4df0e0){if(_0x4df0e0[_0x1685('0x2d')]!=='VIRTUAL'){var _0x50aa2a={};_0x50aa2a[_0x4df0e0[_0x1685('0x28')]]={'$like':'%'+_0x1c1d3b[_0x1685('0x30')][_0x1685('0x3a')]+'%'};return _0x50aa2a;}})});}_0x35d017=_[_0x1685('0x3b')]({},_0x35d017,_0x1c1d3b[_0x1685('0x3c')]);var _0x484d8c={'where':_0x35d017[_0x1685('0x37')]};return db[_0x1685('0x2c')][_0x1685('0x1d')](_0x484d8c)[_0x1685('0x25')](function(_0x33d6bf){_0x34b324[_0x1685('0x1d')]=_0x33d6bf;if(_0x1c1d3b[_0x1685('0x30')][_0x1685('0x3d')]){_0x35d017[_0x1685('0x3e')]=[{'all':!![]}];}return db[_0x1685('0x2c')]['findAll'](_0x35d017);})['then'](function(_0x5ddb7f){_0x34b324[_0x1685('0x3f')]=_0x5ddb7f;return _0x34b324;})[_0x1685('0x25')](respondWithFilteredResult(_0x4e8e67,_0x35d017))['catch'](handleError(_0x4e8e67,null));};exports[_0x1685('0x40')]=function(_0x4e8250,_0x43014a){var _0x1cd7eb={'raw':!![],'where':{'id':_0x4e8250[_0x1685('0x41')]['id']}},_0x20eccc={};_0x20eccc[_0x1685('0x2f')]=_[_0x1685('0x42')](db[_0x1685('0x2c')]['rawAttributes']);_0x20eccc[_0x1685('0x30')]=_['keys'](_0x4e8250[_0x1685('0x30')]);_0x20eccc[_0x1685('0x39')]=_[_0x1685('0x31')](_0x20eccc[_0x1685('0x2f')],_0x20eccc[_0x1685('0x30')]);_0x1cd7eb[_0x1685('0x32')]=_[_0x1685('0x31')](_0x20eccc[_0x1685('0x2f')],qs[_0x1685('0x33')](_0x4e8250['query']['fields']));_0x1cd7eb['attributes']=_0x1cd7eb['attributes'][_0x1685('0x34')]?_0x1cd7eb[_0x1685('0x32')]:_0x20eccc[_0x1685('0x2f')];if(_0x4e8250[_0x1685('0x30')]['includeAll']){_0x1cd7eb['include']=[{'all':!![]}];}_0x1cd7eb=_[_0x1685('0x3b')]({},_0x1cd7eb,_0x4e8250['options']);return db[_0x1685('0x2c')][_0x1685('0x43')](_0x1cd7eb)['then'](handleEntityNotFound(_0x43014a,null))['then'](respondWithResult(_0x43014a,null))[_0x1685('0x44')](handleError(_0x43014a,null));};exports[_0x1685('0x45')]=function(_0x325ca6,_0x37c997){return db['FaxTransferReport'][_0x1685('0x45')](_0x325ca6[_0x1685('0x46')],{})[_0x1685('0x25')](respondWithResult(_0x37c997,0xc9))['catch'](handleError(_0x37c997,null));};exports[_0x1685('0x24')]=function(_0x42830f,_0x423431){if(_0x42830f[_0x1685('0x46')]['id']){delete _0x42830f[_0x1685('0x46')]['id'];}return db[_0x1685('0x2c')]['find']({'where':{'id':_0x42830f['params']['id']}})[_0x1685('0x25')](handleEntityNotFound(_0x423431,null))[_0x1685('0x25')](saveUpdates(_0x42830f[_0x1685('0x46')],null))['then'](respondWithResult(_0x423431,null))[_0x1685('0x44')](handleError(_0x423431,null));};exports['destroy']=function(_0x1094f4,_0x2f85bf){return db[_0x1685('0x2c')]['find']({'where':{'id':_0x1094f4[_0x1685('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f85bf,null))[_0x1685('0x25')](removeEntity(_0x2f85bf,null))[_0x1685('0x44')](handleError(_0x2f85bf,null));};exports['describe']=function(_0x8f0275,_0x36632e){return db[_0x1685('0x2c')][_0x1685('0x47')]()[_0x1685('0x25')](respondWithResult(_0x36632e,null))[_0x1685('0x44')](handleError(_0x36632e,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 776ad6b..7352c7a 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 _0x8091=['../../config/environment','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x480d93,_0x550984){var _0x187be9=function(_0x2698d8){while(--_0x2698d8){_0x480d93['push'](_0x480d93['shift']());}};_0x187be9(++_0x550984);}(_0x8091,0x124));var _0x1809=function(_0xaada74,_0x2a60ef){_0xaada74=_0xaada74-0x0;var _0x2b2d52=_0x8091[_0xaada74];return _0x2b2d52;};'use strict';var _=require(_0x1809('0x0'));var util=require(_0x1809('0x1'));var logger=require(_0x1809('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1809('0x3'));var rp=require(_0x1809('0x4'));var fs=require('fs');var path=require(_0x1809('0x5'));var rimraf=require(_0x1809('0x6'));var config=require(_0x1809('0x7'));var attributes=require(_0x1809('0x8'));module['exports']=function(_0x24c9d4,_0xbe0df0){return _0x24c9d4[_0x1809('0x9')](_0x1809('0xa'),attributes,{'tableName':_0x1809('0xb'),'paranoid':![],'indexes':[{'name':_0x1809('0xc'),'fields':[_0x1809('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x98d4=['bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x98d4,0xa3));var _0x498d=function(_0x5f27c0,_0x1af6b5){_0x5f27c0=_0x5f27c0-0x0;var _0x4d5a38=_0x98d4[_0x5f27c0];return _0x4d5a38;};'use strict';var _=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var logger=require(_0x498d('0x2'))(_0x498d('0x3'));var moment=require(_0x498d('0x4'));var BPromise=require(_0x498d('0x5'));var rp=require(_0x498d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x498d('0x7'));var config=require(_0x498d('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x498d('0x9')]=function(_0x178e2f,_0x2e7d20){return _0x178e2f[_0x498d('0xa')](_0x498d('0xb'),attributes,{'tableName':_0x498d('0xc'),'paranoid':![],'indexes':[{'name':_0x498d('0xd'),'fields':[_0x498d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 1f9f935..fb56a85 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 _0xde34=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0xfc4ee7,_0x89427a){var _0x22dd89=function(_0xe01e3b){while(--_0xe01e3b){_0xfc4ee7['push'](_0xfc4ee7['shift']());}};_0x22dd89(++_0x89427a);}(_0xde34,0x114));var _0x4de3=function(_0x567a65,_0x221ff3){_0x567a65=_0x567a65-0x0;var _0x52befb=_0xde34[_0x567a65];return _0x52befb;};'use strict';var _=require(_0x4de3('0x0'));var util=require(_0x4de3('0x1'));var moment=require('moment');var BPromise=require(_0x4de3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de3('0x3'));var db=require(_0x4de3('0x4'))['db'];var utils=require(_0x4de3('0x5'));var logger=require('../../config/logger')(_0x4de3('0x6'));var config=require(_0x4de3('0x7'));var jayson=require(_0x4de3('0x8'));var client=jayson[_0x4de3('0x9')][_0x4de3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50328c,_0x51d8d2,_0x3d87da){return new BPromise(function(_0x2f0a37,_0x497c25){return client[_0x4de3('0xb')](_0x50328c,_0x3d87da)['then'](function(_0x5c3167){logger[_0x4de3('0xc')](_0x4de3('0xd'),_0x51d8d2,'request\x20sent');logger[_0x4de3('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x51d8d2,_0x4de3('0xf'),JSON['stringify'](_0x5c3167));if(_0x5c3167[_0x4de3('0x10')]){if(_0x5c3167[_0x4de3('0x10')][_0x4de3('0x11')]===0x1f4){logger['error'](_0x4de3('0xd'),_0x51d8d2,_0x5c3167[_0x4de3('0x10')][_0x4de3('0x12')]);return _0x497c25(_0x5c3167['error'][_0x4de3('0x12')]);}logger[_0x4de3('0x10')](_0x4de3('0xd'),_0x51d8d2,_0x5c3167[_0x4de3('0x10')][_0x4de3('0x12')]);return _0x2f0a37(_0x5c3167[_0x4de3('0x10')][_0x4de3('0x12')]);}else{logger[_0x4de3('0xc')](_0x4de3('0xd'),_0x51d8d2,'request\x20sent');_0x2f0a37(_0x5c3167[_0x4de3('0x13')][_0x4de3('0x12')]);}})[_0x4de3('0x14')](function(_0x2792a2){logger[_0x4de3('0x10')](_0x4de3('0xd'),_0x51d8d2,_0x2792a2);_0x497c25(_0x2792a2);});});} \ No newline at end of file +var _0x7048=['request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s'];(function(_0x1064ab,_0x2c16f3){var _0x49679a=function(_0x39577f){while(--_0x39577f){_0x1064ab['push'](_0x1064ab['shift']());}};_0x49679a(++_0x2c16f3);}(_0x7048,0x1bf));var _0x8704=function(_0x30b615,_0x291ae9){_0x30b615=_0x30b615-0x0;var _0xb190a=_0x7048[_0x30b615];return _0xb190a;};'use strict';var _=require(_0x8704('0x0'));var util=require(_0x8704('0x1'));var moment=require(_0x8704('0x2'));var BPromise=require(_0x8704('0x3'));var rs=require(_0x8704('0x4'));var fs=require('fs');var Redis=require(_0x8704('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8704('0x6'))(_0x8704('0x7'));var config=require('../../config/environment');var jayson=require(_0x8704('0x8'));var client=jayson[_0x8704('0x9')][_0x8704('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dded7,_0x2af523,_0x5c33c1){return new BPromise(function(_0x39bb05,_0x459f1c){return client[_0x8704('0xb')](_0x4dded7,_0x5c33c1)['then'](function(_0x249a15){logger['info'](_0x8704('0xc'),_0x2af523,_0x8704('0xd'));logger['debug'](_0x8704('0xe'),_0x2af523,_0x8704('0xd'),JSON['stringify'](_0x249a15));if(_0x249a15['error']){if(_0x249a15[_0x8704('0xf')][_0x8704('0x10')]===0x1f4){logger[_0x8704('0xf')](_0x8704('0xc'),_0x2af523,_0x249a15[_0x8704('0xf')][_0x8704('0x11')]);return _0x459f1c(_0x249a15['error'][_0x8704('0x11')]);}logger[_0x8704('0xf')](_0x8704('0xc'),_0x2af523,_0x249a15[_0x8704('0xf')][_0x8704('0x11')]);return _0x39bb05(_0x249a15['error'][_0x8704('0x11')]);}else{logger[_0x8704('0x12')](_0x8704('0xc'),_0x2af523,_0x8704('0xd'));_0x39bb05(_0x249a15['result'][_0x8704('0x11')]);}})[_0x8704('0x13')](function(_0x49ed0a){logger[_0x8704('0xf')](_0x8704('0xc'),_0x2af523,_0x49ed0a);_0x459f1c(_0x49ed0a);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0ed8261..79fedc0 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 _0x6ee1=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id'];(function(_0x450868,_0x5d990d){var _0x230a2c=function(_0x352271){while(--_0x352271){_0x450868['push'](_0x450868['shift']());}};_0x230a2c(++_0x5d990d);}(_0x6ee1,0x18b));var _0x16ee=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0x6ee1[_0x1757f2];return _0x5e7212;};'use strict';var multer=require(_0x16ee('0x0'));var util=require(_0x16ee('0x1'));var path=require(_0x16ee('0x2'));var timeout=require(_0x16ee('0x3'));var express=require('express');var router=express[_0x16ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x16ee('0x5'));var interaction=require(_0x16ee('0x6'));var config=require(_0x16ee('0x7'));var controller=require(_0x16ee('0x8'));router[_0x16ee('0x9')]('/',auth[_0x16ee('0xa')](),controller[_0x16ee('0xb')]);router[_0x16ee('0x9')](_0x16ee('0xc'),auth[_0x16ee('0xa')](),controller[_0x16ee('0xd')]);router[_0x16ee('0x9')]('/:id',auth[_0x16ee('0xa')](),controller[_0x16ee('0xe')]);router[_0x16ee('0xf')]('/',auth[_0x16ee('0xa')](),controller[_0x16ee('0x10')]);router[_0x16ee('0x11')](_0x16ee('0x12'),auth[_0x16ee('0xa')](),controller[_0x16ee('0x13')]);router[_0x16ee('0x14')](_0x16ee('0x12'),auth['isAuthenticated'](),controller[_0x16ee('0x15')]);module[_0x16ee('0x16')]=router; \ No newline at end of file +var _0xbd17=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xbd17,0x133));var _0x7bd1=function(_0x231fed,_0x5c5926){_0x231fed=_0x231fed-0x0;var _0x406388=_0xbd17[_0x231fed];return _0x406388;};'use strict';var multer=require(_0x7bd1('0x0'));var util=require(_0x7bd1('0x1'));var path=require(_0x7bd1('0x2'));var timeout=require(_0x7bd1('0x3'));var express=require(_0x7bd1('0x4'));var router=express[_0x7bd1('0x5')]();var fs_extra=require(_0x7bd1('0x6'));var auth=require(_0x7bd1('0x7'));var interaction=require(_0x7bd1('0x8'));var config=require('../../config/environment');var controller=require(_0x7bd1('0x9'));router[_0x7bd1('0xa')]('/',auth['isAuthenticated'](),controller[_0x7bd1('0xb')]);router[_0x7bd1('0xa')]('/describe',auth[_0x7bd1('0xc')](),controller[_0x7bd1('0xd')]);router[_0x7bd1('0xa')](_0x7bd1('0xe'),auth[_0x7bd1('0xc')](),controller[_0x7bd1('0xf')]);router[_0x7bd1('0x10')]('/',auth[_0x7bd1('0xc')](),controller[_0x7bd1('0x11')]);router[_0x7bd1('0x12')](_0x7bd1('0xe'),auth[_0x7bd1('0xc')](),controller[_0x7bd1('0x13')]);router[_0x7bd1('0x14')](_0x7bd1('0xe'),auth[_0x7bd1('0xc')](),controller['destroy']);module[_0x7bd1('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 39d3350..55830c8 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 _0xef96=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x2e19ab,_0x4d527f){var _0x510981=function(_0x808e9){while(--_0x808e9){_0x2e19ab['push'](_0x2e19ab['shift']());}};_0x510981(++_0x4d527f);}(_0xef96,0x150));var _0x6ef9=function(_0x59f74c,_0x1e761b){_0x59f74c=_0x59f74c-0x0;var _0x2fcdb5=_0xef96[_0x59f74c];return _0x2fcdb5;};'use strict';var multer=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var path=require(_0x6ef9('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ef9('0x3'));var router=express[_0x6ef9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ef9('0x5'));var config=require('../../config/environment');var controller=require('./intDeskAccount.controller');router[_0x6ef9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ef9('0x6')](_0x6ef9('0x7'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0x9')]);router['get'](_0x6ef9('0xa'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0xb')]);router['get'](_0x6ef9('0xc'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0xd')]);router[_0x6ef9('0xe')]('/',auth[_0x6ef9('0x8')](),controller[_0x6ef9('0xf')]);router[_0x6ef9('0xe')](_0x6ef9('0xa'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0x10')]);router[_0x6ef9('0x11')](_0x6ef9('0x7'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0x12')]);router[_0x6ef9('0x13')](_0x6ef9('0x7'),auth[_0x6ef9('0x8')](),controller[_0x6ef9('0x14')]);module[_0x6ef9('0x15')]=router; \ No newline at end of file +var _0x50af=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','./intDeskAccount.controller'];(function(_0x334569,_0x280d47){var _0x550b77=function(_0x2bf14a){while(--_0x2bf14a){_0x334569['push'](_0x334569['shift']());}};_0x550b77(++_0x280d47);}(_0x50af,0x1d5));var _0xf50a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50af[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf50a('0x0'));var util=require(_0xf50a('0x1'));var path=require('path');var timeout=require(_0xf50a('0x2'));var express=require(_0xf50a('0x3'));var router=express['Router']();var fs_extra=require(_0xf50a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf50a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xf50a('0x6')]);router['get'](_0xf50a('0x7'),auth['isAuthenticated'](),controller[_0xf50a('0x8')]);router['get'](_0xf50a('0x9'),auth['isAuthenticated'](),controller[_0xf50a('0xa')]);router['get'](_0xf50a('0xb'),auth[_0xf50a('0xc')](),controller[_0xf50a('0xd')]);router[_0xf50a('0xe')]('/',auth[_0xf50a('0xc')](),controller['create']);router['post'](_0xf50a('0x9'),auth[_0xf50a('0xc')](),controller['addConfiguration']);router[_0xf50a('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf50a('0x10')](_0xf50a('0x7'),auth[_0xf50a('0xc')](),controller[_0xf50a('0x11')]);module[_0xf50a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 991cd36..2b4df4a 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 _0xae00=['basic','ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xae00,0x7b));var _0x0ae0=function(_0x54ea7a,_0x19df9b){_0x54ea7a=_0x54ea7a-0x0;var _0x65a10d=_0xae00[_0x54ea7a];return _0x65a10d;};'use strict';var Sequelize=require(_0x0ae0('0x0'));module[_0x0ae0('0x1')]={'name':{'type':Sequelize[_0x0ae0('0x2')]},'description':{'type':Sequelize[_0x0ae0('0x2')]},'username':{'type':Sequelize[_0x0ae0('0x2')]},'remoteUri':{'type':Sequelize[_0x0ae0('0x2')]},'authType':{'type':Sequelize['ENUM'](_0x0ae0('0x3')),'defaultValue':_0x0ae0('0x3')},'password':{'type':Sequelize[_0x0ae0('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x0ae0('0x2')]},'token':{'type':Sequelize[_0x0ae0('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0ae0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0ae0('0x4')](_0x0ae0('0x5'),_0x0ae0('0x6')),'defaultValue':_0x0ae0('0x5')}}; \ No newline at end of file +var _0x9ca4=['sequelize','exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x9ca4,0xe7));var _0x49ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ca4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49ca('0x0'));module[_0x49ca('0x1')]={'name':{'type':Sequelize[_0x49ca('0x2')]},'description':{'type':Sequelize[_0x49ca('0x2')]},'username':{'type':Sequelize[_0x49ca('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x49ca('0x3')](_0x49ca('0x4')),'defaultValue':_0x49ca('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x49ca('0x2')]},'token':{'type':Sequelize[_0x49ca('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x49ca('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x49ca('0x5')),'defaultValue':_0x49ca('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 52c0585..c65e981 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 _0xc22e=['order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','includeAll','options','create','body','find','getConfigurations','findOne','DeskConfiguration','addConfiguration','getSubjects','channel','getDescriptions','DeskField','Subjects','Descriptions','authType','username','password','consumerKey','token','tokenSecret','remoteUri','slice','substring','GET','format','basic','headers','Authorization','Basic\x20%s','toString','base64','concat','_embedded','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../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','reject','save','update','then','end','error','stack','name','send','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x11cc63,_0x282674){var _0x397c95=function(_0x1dc50c){while(--_0x1dc50c){_0x11cc63['push'](_0x11cc63['shift']());}};_0x397c95(++_0x282674);}(_0xc22e,0x10c));var _0xec22=function(_0x521cb8,_0x2e20f3){_0x521cb8=_0x521cb8-0x0;var _0x425b29=_0xc22e[_0x521cb8];return _0x425b29;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec22('0x0'));var zipdir=require(_0xec22('0x1'));var jsonpatch=require(_0xec22('0x2'));var rp=require('request-promise');var moment=require(_0xec22('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xec22('0x4'));var util=require(_0xec22('0x5'));var path=require(_0xec22('0x6'));var sox=require('sox');var csv=require(_0xec22('0x7'));var ejs=require(_0xec22('0x8'));var fs=require('fs');var fs_extra=require(_0xec22('0x9'));var _=require(_0xec22('0xa'));var squel=require(_0xec22('0xb'));var crypto=require('crypto');var jsforce=require(_0xec22('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec22('0x7'));var querystring=require('querystring');var Papa=require(_0xec22('0xd'));var Redis=require('ioredis');var authService=require(_0xec22('0xe'));var qs=require(_0xec22('0xf'));var as=require(_0xec22('0x10'));var hardwareService=require(_0xec22('0x11'));var logger=require(_0xec22('0x12'))(_0xec22('0x13'));var utils=require(_0xec22('0x14'));var config=require(_0xec22('0x15'));var licenseUtil=require(_0xec22('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xec22('0x17'));function respondWithStatusCode(_0x3c92d6,_0x28158d){_0x28158d=_0x28158d||0xcc;return function(_0x4b978d){if(_0x4b978d){return _0x3c92d6[_0xec22('0x18')](_0x28158d);}return _0x3c92d6['status'](_0x28158d)['end']();};}function respondWithResult(_0x2778f0,_0x136bbd){_0x136bbd=_0x136bbd||0xc8;return function(_0x4edd39){if(_0x4edd39){return _0x2778f0[_0xec22('0x19')](_0x136bbd)[_0xec22('0x1a')](_0x4edd39);}};}function respondWithFilteredResult(_0x284cda,_0x7a7a0f){return function(_0x442a1a){if(_0x442a1a){var _0x1c836a=typeof _0x7a7a0f[_0xec22('0x1b')]===_0xec22('0x1c')&&typeof _0x7a7a0f['limit']===_0xec22('0x1c');var _0x44712c=_0x442a1a[_0xec22('0x1d')];var _0x3737dc=_0x1c836a?0x0:_0x7a7a0f[_0xec22('0x1b')];var _0x406b2b=_0x1c836a?_0x442a1a[_0xec22('0x1d')]:_0x7a7a0f['offset']+_0x7a7a0f[_0xec22('0x1e')];var _0x2a658b;if(_0x406b2b>=_0x44712c){_0x406b2b=_0x44712c;_0x2a658b=0xc8;}else{_0x2a658b=0xce;}_0x284cda[_0xec22('0x19')](_0x2a658b);return _0x284cda[_0xec22('0x1f')]('Content-Range',_0x3737dc+'-'+_0x406b2b+'/'+_0x44712c)['json'](_0x442a1a);}return null;};}function patchUpdates(_0x984a8a){return function(_0x53464e){try{jsonpatch['apply'](_0x53464e,_0x984a8a,!![]);}catch(_0x4cfb7c){return BPromise[_0xec22('0x20')](_0x4cfb7c);}return _0x53464e[_0xec22('0x21')]();};}function saveUpdates(_0x2be334,_0x4c5094){return function(_0xe68c54){if(_0xe68c54){return _0xe68c54[_0xec22('0x22')](_0x2be334)[_0xec22('0x23')](function(_0xff94da){return _0xff94da;});}return null;};}function removeEntity(_0x2ce63d,_0x85cfed){return function(_0x8e1ca5){if(_0x8e1ca5){return _0x8e1ca5['destroy']()['then'](function(){_0x2ce63d[_0xec22('0x19')](0xcc)[_0xec22('0x24')]();});}};}function handleEntityNotFound(_0x812933,_0x3ce96d){return function(_0x70722a){if(!_0x70722a){_0x812933[_0xec22('0x18')](0x194);}return _0x70722a;};}function handleError(_0x91ea2,_0x3d20d7){_0x3d20d7=_0x3d20d7||0x1f4;return function(_0x13dbce){logger[_0xec22('0x25')](_0x13dbce[_0xec22('0x26')]);if(_0x13dbce[_0xec22('0x27')]){delete _0x13dbce[_0xec22('0x27')];}_0x91ea2[_0xec22('0x19')](_0x3d20d7)[_0xec22('0x28')](_0x13dbce);};}exports['index']=function(_0x33cd06,_0x3c0510){var _0x361ce5={},_0x2d51f5={},_0x30d741={'count':0x0,'rows':[]};var _0x4ed22a=_[_0xec22('0x29')](db[_0xec22('0x2a')][_0xec22('0x2b')],function(_0x2789b6){return{'name':_0x2789b6['fieldName'],'type':_0x2789b6[_0xec22('0x2c')][_0xec22('0x2d')]};});_0x2d51f5[_0xec22('0x2e')]=_[_0xec22('0x29')](_0x4ed22a,_0xec22('0x27'));_0x2d51f5[_0xec22('0x2f')]=_[_0xec22('0x30')](_0x33cd06['query']);_0x2d51f5[_0xec22('0x31')]=_[_0xec22('0x32')](_0x2d51f5[_0xec22('0x2e')],_0x2d51f5['query']);_0x361ce5[_0xec22('0x33')]=_[_0xec22('0x32')](_0x2d51f5[_0xec22('0x2e')],qs[_0xec22('0x34')](_0x33cd06[_0xec22('0x2f')][_0xec22('0x34')]));_0x361ce5['attributes']=_0x361ce5['attributes'][_0xec22('0x35')]?_0x361ce5['attributes']:_0x2d51f5[_0xec22('0x2e')];if(!_0x33cd06[_0xec22('0x2f')][_0xec22('0x36')](_0xec22('0x37'))){_0x361ce5[_0xec22('0x1e')]=qs[_0xec22('0x1e')](_0x33cd06['query'][_0xec22('0x1e')]);_0x361ce5[_0xec22('0x1b')]=qs[_0xec22('0x1b')](_0x33cd06['query'][_0xec22('0x1b')]);}_0x361ce5[_0xec22('0x38')]=qs[_0xec22('0x39')](_0x33cd06[_0xec22('0x2f')][_0xec22('0x39')]);_0x361ce5[_0xec22('0x3a')]=qs[_0xec22('0x31')](_[_0xec22('0x3b')](_0x33cd06[_0xec22('0x2f')],_0x2d51f5[_0xec22('0x31')]),_0x4ed22a);if(_0x33cd06[_0xec22('0x2f')]['filter']){_0x361ce5[_0xec22('0x3a')]=_[_0xec22('0x3c')](_0x361ce5[_0xec22('0x3a')],{'$or':_['map'](_0x4ed22a,function(_0x292e49){if(_0x292e49['type']!==_0xec22('0x3d')){var _0x252346={};_0x252346[_0x292e49[_0xec22('0x27')]]={'$like':'%'+_0x33cd06['query'][_0xec22('0x3e')]+'%'};return _0x252346;}})});}_0x361ce5=_[_0xec22('0x3c')]({},_0x361ce5,_0x33cd06['options']);var _0x21d189={'where':_0x361ce5[_0xec22('0x3a')]};return db[_0xec22('0x2a')][_0xec22('0x1d')](_0x21d189)['then'](function(_0x4ee2aa){_0x30d741[_0xec22('0x1d')]=_0x4ee2aa;if(_0x33cd06[_0xec22('0x2f')]['includeAll']){_0x361ce5[_0xec22('0x3f')]=[{'all':!![]}];}return db[_0xec22('0x2a')][_0xec22('0x40')](_0x361ce5);})[_0xec22('0x23')](function(_0xab9f48){_0x30d741[_0xec22('0x41')]=_0xab9f48;return _0x30d741;})['then'](respondWithFilteredResult(_0x3c0510,_0x361ce5))[_0xec22('0x42')](handleError(_0x3c0510,null));};exports['show']=function(_0x352442,_0x38eb92){var _0x2415f6={'raw':![],'where':{'id':_0x352442[_0xec22('0x43')]['id']}},_0x4b4995={};_0x4b4995[_0xec22('0x2e')]=_[_0xec22('0x30')](db['DeskAccount'][_0xec22('0x2b')]);_0x4b4995[_0xec22('0x2f')]=_[_0xec22('0x30')](_0x352442['query']);_0x4b4995[_0xec22('0x31')]=_['intersection'](_0x4b4995[_0xec22('0x2e')],_0x4b4995[_0xec22('0x2f')]);_0x2415f6[_0xec22('0x33')]=_[_0xec22('0x32')](_0x4b4995[_0xec22('0x2e')],qs['fields'](_0x352442[_0xec22('0x2f')][_0xec22('0x34')]));_0x2415f6['attributes']=_0x2415f6[_0xec22('0x33')][_0xec22('0x35')]?_0x2415f6[_0xec22('0x33')]:_0x4b4995[_0xec22('0x2e')];if(_0x352442[_0xec22('0x2f')][_0xec22('0x44')]){_0x2415f6[_0xec22('0x3f')]=[{'all':!![]}];}_0x2415f6=_[_0xec22('0x3c')]({},_0x2415f6,_0x352442[_0xec22('0x45')]);return db['DeskAccount']['find'](_0x2415f6)['then'](handleEntityNotFound(_0x38eb92,null))[_0xec22('0x23')](respondWithResult(_0x38eb92,null))[_0xec22('0x42')](handleError(_0x38eb92,null));};exports[_0xec22('0x46')]=function(_0x1f0c1a,_0x4e23ad){return db['DeskAccount'][_0xec22('0x46')](_0x1f0c1a[_0xec22('0x47')],{})[_0xec22('0x23')](respondWithResult(_0x4e23ad,0xc9))[_0xec22('0x42')](handleError(_0x4e23ad,null));};exports[_0xec22('0x22')]=function(_0x2994af,_0x4e944e){if(_0x2994af[_0xec22('0x47')]['id']){delete _0x2994af[_0xec22('0x47')]['id'];}return db[_0xec22('0x2a')][_0xec22('0x48')]({'where':{'id':_0x2994af[_0xec22('0x43')]['id']}})[_0xec22('0x23')](handleEntityNotFound(_0x4e944e,null))['then'](saveUpdates(_0x2994af[_0xec22('0x47')],null))[_0xec22('0x23')](respondWithResult(_0x4e944e,null))[_0xec22('0x42')](handleError(_0x4e944e,null));};exports['destroy']=function(_0x564a45,_0x1b4fbb){return db[_0xec22('0x2a')][_0xec22('0x48')]({'where':{'id':_0x564a45[_0xec22('0x43')]['id']}})[_0xec22('0x23')](handleEntityNotFound(_0x1b4fbb,null))['then'](removeEntity(_0x1b4fbb,null))[_0xec22('0x42')](handleError(_0x1b4fbb,null));};exports[_0xec22('0x49')]=function(_0x433f33,_0x1996dc,_0x1b35af){var _0x107a16={};var _0x36b3ff={};var _0x1b1e24;var _0x48a03a;return db[_0xec22('0x2a')][_0xec22('0x4a')]({'where':{'id':_0x433f33[_0xec22('0x43')]['id']}})[_0xec22('0x23')](handleEntityNotFound(_0x1996dc,null))['then'](function(_0xd2452b){if(_0xd2452b){_0x1b1e24=_0xd2452b;_0x36b3ff[_0xec22('0x2e')]=_[_0xec22('0x30')](db[_0xec22('0x4b')][_0xec22('0x2b')]);_0x36b3ff[_0xec22('0x2f')]=_['keys'](_0x433f33[_0xec22('0x2f')]);_0x36b3ff[_0xec22('0x31')]=_['intersection'](_0x36b3ff['model'],_0x36b3ff[_0xec22('0x2f')]);_0x107a16[_0xec22('0x33')]=_[_0xec22('0x32')](_0x36b3ff[_0xec22('0x2e')],qs[_0xec22('0x34')](_0x433f33[_0xec22('0x2f')][_0xec22('0x34')]));_0x107a16['attributes']=_0x107a16['attributes'][_0xec22('0x35')]?_0x107a16[_0xec22('0x33')]:_0x36b3ff[_0xec22('0x2e')];_0x107a16['order']=qs[_0xec22('0x39')](_0x433f33[_0xec22('0x2f')][_0xec22('0x39')]);_0x107a16[_0xec22('0x3a')]=qs[_0xec22('0x31')](_[_0xec22('0x3b')](_0x433f33[_0xec22('0x2f')],_0x36b3ff[_0xec22('0x31')]));if(_0x433f33['query']['filter']){_0x107a16[_0xec22('0x3a')]=_[_0xec22('0x3c')](_0x107a16['where'],{'$or':_[_0xec22('0x29')](_0x107a16['attributes'],function(_0x97fc1f){var _0x55273c={};_0x55273c[_0x97fc1f]={'$like':'%'+_0x433f33['query']['filter']+'%'};return _0x55273c;})});}_0x107a16=_[_0xec22('0x3c')]({},_0x107a16,_0x433f33['options']);return _0x1b1e24[_0xec22('0x49')](_0x107a16);}})[_0xec22('0x23')](function(_0x4af422){if(_0x4af422){_0x48a03a=_0x4af422[_0xec22('0x35')];if(!_0x433f33[_0xec22('0x2f')][_0xec22('0x36')]('nolimit')){_0x107a16[_0xec22('0x1e')]=qs[_0xec22('0x1e')](_0x433f33[_0xec22('0x2f')]['limit']);_0x107a16[_0xec22('0x1b')]=qs[_0xec22('0x1b')](_0x433f33['query'][_0xec22('0x1b')]);}return _0x1b1e24['getConfigurations'](_0x107a16);}})[_0xec22('0x23')](function(_0x1b87b0){if(_0x1b87b0){return _0x1b87b0?{'count':_0x48a03a,'rows':_0x1b87b0}:null;}})[_0xec22('0x23')](respondWithResult(_0x1996dc,null))[_0xec22('0x42')](handleError(_0x1996dc,null));};exports[_0xec22('0x4c')]=function(_0x486b4e,_0x4f3bee,_0x7103d2){if(_0x486b4e['body']['id']){delete _0x486b4e[_0xec22('0x47')]['id'];}return db[_0xec22('0x2a')]['findOne']({'where':{'id':_0x486b4e[_0xec22('0x43')]['id']}})[_0xec22('0x23')](handleEntityNotFound(_0x4f3bee,null))[_0xec22('0x23')](function(_0x20797d){if(_0x20797d){_0x486b4e[_0xec22('0x47')]['AccountId']=_0x20797d['id'];_0x486b4e['body']['Subjects']=integrations[_0xec22('0x4d')](_0x486b4e[_0xec22('0x47')][_0xec22('0x4e')],_0x486b4e['body'][_0xec22('0x2c')]);_0x486b4e['body']['Descriptions']=integrations[_0xec22('0x4f')](_0x486b4e[_0xec22('0x47')]['channel'],_0x486b4e[_0xec22('0x47')][_0xec22('0x2c')]);return db[_0xec22('0x4b')][_0xec22('0x46')](_0x486b4e['body'],{'include':[{'model':db[_0xec22('0x50')],'as':_0xec22('0x51')},{'model':db[_0xec22('0x50')],'as':_0xec22('0x52')}]});}return null;})[_0xec22('0x23')](respondWithResult(_0x4f3bee,null))['catch'](handleError(_0x4f3bee,null));};exports['getFields']=function(_0x14bafa,_0x400757,_0x5eced6){var _0x32913d=[{'name':'priority','label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1f7560='';return db[_0xec22('0x2a')][_0xec22('0x4a')]({'where':{'id':_0x14bafa[_0xec22('0x43')]['id']},'attributes':['id','remoteUri',_0xec22('0x53'),_0xec22('0x54'),_0xec22('0x55'),_0xec22('0x56'),'consumerSecret',_0xec22('0x57'),_0xec22('0x58')]})[_0xec22('0x23')](handleEntityNotFound(_0x400757,null))[_0xec22('0x23')](function(_0x12edb1){if(_0x12edb1){_0x1f7560=_0x12edb1[_0xec22('0x59')];var _0xdcebe7=_0x1f7560[_0xec22('0x5a')](-0x1);if(_0xdcebe7==='/'){_0x1f7560=_0x1f7560[_0xec22('0x5b')](0x0,_0x1f7560['lastIndexOf'](_0xdcebe7));}var _0x5d6dbc={'method':_0xec22('0x5c'),'uri':util[_0xec22('0x5d')]('%s/custom_fields',_0x1f7560),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x12edb1[_0xec22('0x53')]===_0xec22('0x5e')){_0x5d6dbc[_0xec22('0x5f')][_0xec22('0x60')]=util[_0xec22('0x5d')](_0xec22('0x61'),new Buffer(util['format']('%s:%s',_0x12edb1[_0xec22('0x54')],_0x12edb1[_0xec22('0x55')]))[_0xec22('0x62')](_0xec22('0x63')));}return rp(_0x5d6dbc)[_0xec22('0x23')](function(_0x512658){return _0x32913d[_0xec22('0x64')](_[_0xec22('0x29')](_0x512658[_0xec22('0x65')]['entries'],function(_0x23d358){return{'id':_0x23d358['name'],'name':_0x23d358[_0xec22('0x27')],'type':_0x23d358['type'],'active':_0x23d358[_0xec22('0x66')],'label':_0x23d358['label'],'custom':!![]};}));});}})[_0xec22('0x23')](function(_0x254294){return{'count':_0x254294['length'],'rows':_0x254294};})['then'](respondWithResult(_0x400757,null))['catch'](function(_0x9e9c11){var _0x4f90fc=_0x14bafa[_0xec22('0x2f')][_0xec22('0x67')]?0x1f4:_0x9e9c11[_0xec22('0x68')]||0x1f4;logger[_0xec22('0x25')](_0xec22('0x69'),_0xec22('0x6a'),_0x4f90fc,JSON[_0xec22('0x6b')](_0x9e9c11));delete _0x9e9c11[_0xec22('0x27')];if(_0x4f90fc===0x191){_0x4f90fc=0x190;}_0x400757['status'](_0x4f90fc)[_0xec22('0x28')](_0x14bafa[_0xec22('0x2f')][_0xec22('0x67')]?{'message':'Wrong\x20credentials','statusCode':_0x9e9c11[_0xec22('0x68')]}:_0x9e9c11);});}; \ No newline at end of file +var _0xd60c=['username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','%s:%s','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','rows','catch','show','params','create','body','find','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType'];(function(_0x1fabe9,_0xf66af4){var _0x1f35c6=function(_0x3b691d){while(--_0x3b691d){_0x1fabe9['push'](_0x1fabe9['shift']());}};_0x1f35c6(++_0xf66af4);}(_0xd60c,0x8f));var _0xcd60=function(_0x5b6911,_0x1a55bf){_0x5b6911=_0x5b6911-0x0;var _0x5c5e0c=_0xd60c[_0x5b6911];return _0x5c5e0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd60('0x1'));var rp=require('request-promise');var moment=require(_0xcd60('0x2'));var BPromise=require(_0xcd60('0x3'));var Mustache=require(_0xcd60('0x4'));var util=require(_0xcd60('0x5'));var path=require(_0xcd60('0x6'));var sox=require(_0xcd60('0x7'));var csv=require('to-csv');var ejs=require(_0xcd60('0x8'));var fs=require('fs');var fs_extra=require(_0xcd60('0x9'));var _=require(_0xcd60('0xa'));var squel=require(_0xcd60('0xb'));var crypto=require(_0xcd60('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcd60('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcd60('0xe'));var Papa=require(_0xcd60('0xf'));var Redis=require('ioredis');var authService=require(_0xcd60('0x10'));var qs=require(_0xcd60('0x11'));var as=require(_0xcd60('0x12'));var hardwareService=require(_0xcd60('0x13'));var logger=require(_0xcd60('0x14'))(_0xcd60('0x15'));var utils=require('../../config/utils');var config=require(_0xcd60('0x16'));var licenseUtil=require(_0xcd60('0x17'));var db=require(_0xcd60('0x18'))['db'];var integrations=require(_0xcd60('0x19'));function respondWithStatusCode(_0x58c311,_0x1297d9){_0x1297d9=_0x1297d9||0xcc;return function(_0x12b0b9){if(_0x12b0b9){return _0x58c311[_0xcd60('0x1a')](_0x1297d9);}return _0x58c311[_0xcd60('0x1b')](_0x1297d9)[_0xcd60('0x1c')]();};}function respondWithResult(_0x4a7c34,_0x1457a4){_0x1457a4=_0x1457a4||0xc8;return function(_0xe78d6e){if(_0xe78d6e){return _0x4a7c34['status'](_0x1457a4)[_0xcd60('0x1d')](_0xe78d6e);}};}function respondWithFilteredResult(_0x901506,_0x4e2acd){return function(_0x2bb270){if(_0x2bb270){var _0x1cf51f=typeof _0x4e2acd[_0xcd60('0x1e')]==='undefined'&&typeof _0x4e2acd[_0xcd60('0x1f')]==='undefined';var _0x1d6f55=_0x2bb270[_0xcd60('0x20')];var _0x4ac9ed=_0x1cf51f?0x0:_0x4e2acd[_0xcd60('0x1e')];var _0x599ac4=_0x1cf51f?_0x2bb270[_0xcd60('0x20')]:_0x4e2acd[_0xcd60('0x1e')]+_0x4e2acd['limit'];var _0x2fbeeb;if(_0x599ac4>=_0x1d6f55){_0x599ac4=_0x1d6f55;_0x2fbeeb=0xc8;}else{_0x2fbeeb=0xce;}_0x901506['status'](_0x2fbeeb);return _0x901506['set'](_0xcd60('0x21'),_0x4ac9ed+'-'+_0x599ac4+'/'+_0x1d6f55)[_0xcd60('0x1d')](_0x2bb270);}return null;};}function patchUpdates(_0xf7dcf5){return function(_0x4671b0){try{jsonpatch[_0xcd60('0x22')](_0x4671b0,_0xf7dcf5,!![]);}catch(_0x5864c4){return BPromise[_0xcd60('0x23')](_0x5864c4);}return _0x4671b0['save']();};}function saveUpdates(_0x18defa,_0x1f33db){return function(_0x358a6e){if(_0x358a6e){return _0x358a6e[_0xcd60('0x24')](_0x18defa)['then'](function(_0x5a5399){return _0x5a5399;});}return null;};}function removeEntity(_0x1d2597,_0x94a24f){return function(_0x3cc3aa){if(_0x3cc3aa){return _0x3cc3aa[_0xcd60('0x25')]()[_0xcd60('0x26')](function(){_0x1d2597[_0xcd60('0x1b')](0xcc)[_0xcd60('0x1c')]();});}};}function handleEntityNotFound(_0x3ea6f1,_0x127c5c){return function(_0x426f52){if(!_0x426f52){_0x3ea6f1['sendStatus'](0x194);}return _0x426f52;};}function handleError(_0x11588c,_0x4697b9){_0x4697b9=_0x4697b9||0x1f4;return function(_0x20c2d2){logger[_0xcd60('0x27')](_0x20c2d2['stack']);if(_0x20c2d2[_0xcd60('0x28')]){delete _0x20c2d2[_0xcd60('0x28')];}_0x11588c[_0xcd60('0x1b')](_0x4697b9)[_0xcd60('0x29')](_0x20c2d2);};}exports[_0xcd60('0x2a')]=function(_0x4871c0,_0x1d30a8){var _0x4931a8={},_0x560f93={},_0x47e2dd={'count':0x0,'rows':[]};var _0x37bce9=_[_0xcd60('0x2b')](db['DeskAccount'][_0xcd60('0x2c')],function(_0x45ab11){return{'name':_0x45ab11[_0xcd60('0x2d')],'type':_0x45ab11[_0xcd60('0x2e')][_0xcd60('0x2f')]};});_0x560f93[_0xcd60('0x30')]=_[_0xcd60('0x2b')](_0x37bce9,_0xcd60('0x28'));_0x560f93[_0xcd60('0x31')]=_[_0xcd60('0x32')](_0x4871c0[_0xcd60('0x31')]);_0x560f93['filters']=_[_0xcd60('0x33')](_0x560f93['model'],_0x560f93[_0xcd60('0x31')]);_0x4931a8[_0xcd60('0x34')]=_[_0xcd60('0x33')](_0x560f93[_0xcd60('0x30')],qs[_0xcd60('0x35')](_0x4871c0['query'][_0xcd60('0x35')]));_0x4931a8['attributes']=_0x4931a8['attributes'][_0xcd60('0x36')]?_0x4931a8[_0xcd60('0x34')]:_0x560f93['model'];if(!_0x4871c0[_0xcd60('0x31')][_0xcd60('0x37')](_0xcd60('0x38'))){_0x4931a8[_0xcd60('0x1f')]=qs[_0xcd60('0x1f')](_0x4871c0['query'][_0xcd60('0x1f')]);_0x4931a8['offset']=qs[_0xcd60('0x1e')](_0x4871c0[_0xcd60('0x31')]['offset']);}_0x4931a8['order']=qs[_0xcd60('0x39')](_0x4871c0['query'][_0xcd60('0x39')]);_0x4931a8[_0xcd60('0x3a')]=qs['filters'](_[_0xcd60('0x3b')](_0x4871c0[_0xcd60('0x31')],_0x560f93[_0xcd60('0x3c')]),_0x37bce9);if(_0x4871c0[_0xcd60('0x31')][_0xcd60('0x3d')]){_0x4931a8[_0xcd60('0x3a')]=_[_0xcd60('0x3e')](_0x4931a8[_0xcd60('0x3a')],{'$or':_['map'](_0x37bce9,function(_0x275f27){if(_0x275f27[_0xcd60('0x2e')]!==_0xcd60('0x3f')){var _0x3a5a03={};_0x3a5a03[_0x275f27[_0xcd60('0x28')]]={'$like':'%'+_0x4871c0[_0xcd60('0x31')]['filter']+'%'};return _0x3a5a03;}})});}_0x4931a8=_['merge']({},_0x4931a8,_0x4871c0[_0xcd60('0x40')]);var _0x1c0b21={'where':_0x4931a8[_0xcd60('0x3a')]};return db[_0xcd60('0x41')]['count'](_0x1c0b21)[_0xcd60('0x26')](function(_0x5e70ea){_0x47e2dd[_0xcd60('0x20')]=_0x5e70ea;if(_0x4871c0[_0xcd60('0x31')][_0xcd60('0x42')]){_0x4931a8[_0xcd60('0x43')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x4931a8);})[_0xcd60('0x26')](function(_0x528ba7){_0x47e2dd[_0xcd60('0x44')]=_0x528ba7;return _0x47e2dd;})[_0xcd60('0x26')](respondWithFilteredResult(_0x1d30a8,_0x4931a8))[_0xcd60('0x45')](handleError(_0x1d30a8,null));};exports[_0xcd60('0x46')]=function(_0x571741,_0x309b90){var _0x3209c5={'raw':![],'where':{'id':_0x571741[_0xcd60('0x47')]['id']}},_0x226d55={};_0x226d55['model']=_[_0xcd60('0x32')](db[_0xcd60('0x41')][_0xcd60('0x2c')]);_0x226d55[_0xcd60('0x31')]=_['keys'](_0x571741[_0xcd60('0x31')]);_0x226d55[_0xcd60('0x3c')]=_[_0xcd60('0x33')](_0x226d55[_0xcd60('0x30')],_0x226d55['query']);_0x3209c5['attributes']=_['intersection'](_0x226d55[_0xcd60('0x30')],qs[_0xcd60('0x35')](_0x571741['query'][_0xcd60('0x35')]));_0x3209c5[_0xcd60('0x34')]=_0x3209c5[_0xcd60('0x34')][_0xcd60('0x36')]?_0x3209c5[_0xcd60('0x34')]:_0x226d55[_0xcd60('0x30')];if(_0x571741['query'][_0xcd60('0x42')]){_0x3209c5[_0xcd60('0x43')]=[{'all':!![]}];}_0x3209c5=_[_0xcd60('0x3e')]({},_0x3209c5,_0x571741[_0xcd60('0x40')]);return db[_0xcd60('0x41')]['find'](_0x3209c5)[_0xcd60('0x26')](handleEntityNotFound(_0x309b90,null))['then'](respondWithResult(_0x309b90,null))['catch'](handleError(_0x309b90,null));};exports[_0xcd60('0x48')]=function(_0x24d7e5,_0x52ce46){return db[_0xcd60('0x41')]['create'](_0x24d7e5[_0xcd60('0x49')],{})[_0xcd60('0x26')](respondWithResult(_0x52ce46,0xc9))['catch'](handleError(_0x52ce46,null));};exports[_0xcd60('0x24')]=function(_0x4b6a0b,_0x13530e){if(_0x4b6a0b['body']['id']){delete _0x4b6a0b[_0xcd60('0x49')]['id'];}return db['DeskAccount'][_0xcd60('0x4a')]({'where':{'id':_0x4b6a0b[_0xcd60('0x47')]['id']}})['then'](handleEntityNotFound(_0x13530e,null))[_0xcd60('0x26')](saveUpdates(_0x4b6a0b[_0xcd60('0x49')],null))[_0xcd60('0x26')](respondWithResult(_0x13530e,null))[_0xcd60('0x45')](handleError(_0x13530e,null));};exports[_0xcd60('0x25')]=function(_0x235ee9,_0x757fd){return db[_0xcd60('0x41')][_0xcd60('0x4a')]({'where':{'id':_0x235ee9['params']['id']}})[_0xcd60('0x26')](handleEntityNotFound(_0x757fd,null))[_0xcd60('0x26')](removeEntity(_0x757fd,null))[_0xcd60('0x45')](handleError(_0x757fd,null));};exports['getConfigurations']=function(_0x119b36,_0x447511,_0x426276){var _0x84fe61={};var _0x4ddeac={};var _0x3af113;var _0x2bb8c3;return db[_0xcd60('0x41')][_0xcd60('0x4b')]({'where':{'id':_0x119b36[_0xcd60('0x47')]['id']}})['then'](handleEntityNotFound(_0x447511,null))[_0xcd60('0x26')](function(_0x579fcc){if(_0x579fcc){_0x3af113=_0x579fcc;_0x4ddeac[_0xcd60('0x30')]=_[_0xcd60('0x32')](db[_0xcd60('0x4c')][_0xcd60('0x2c')]);_0x4ddeac[_0xcd60('0x31')]=_[_0xcd60('0x32')](_0x119b36[_0xcd60('0x31')]);_0x4ddeac['filters']=_['intersection'](_0x4ddeac[_0xcd60('0x30')],_0x4ddeac[_0xcd60('0x31')]);_0x84fe61[_0xcd60('0x34')]=_[_0xcd60('0x33')](_0x4ddeac[_0xcd60('0x30')],qs[_0xcd60('0x35')](_0x119b36[_0xcd60('0x31')][_0xcd60('0x35')]));_0x84fe61[_0xcd60('0x34')]=_0x84fe61[_0xcd60('0x34')][_0xcd60('0x36')]?_0x84fe61['attributes']:_0x4ddeac[_0xcd60('0x30')];_0x84fe61['order']=qs[_0xcd60('0x39')](_0x119b36['query']['sort']);_0x84fe61[_0xcd60('0x3a')]=qs[_0xcd60('0x3c')](_[_0xcd60('0x3b')](_0x119b36['query'],_0x4ddeac['filters']));if(_0x119b36[_0xcd60('0x31')][_0xcd60('0x3d')]){_0x84fe61[_0xcd60('0x3a')]=_[_0xcd60('0x3e')](_0x84fe61[_0xcd60('0x3a')],{'$or':_[_0xcd60('0x2b')](_0x84fe61[_0xcd60('0x34')],function(_0x149bec){var _0x4b459b={};_0x4b459b[_0x149bec]={'$like':'%'+_0x119b36['query'][_0xcd60('0x3d')]+'%'};return _0x4b459b;})});}_0x84fe61=_['merge']({},_0x84fe61,_0x119b36[_0xcd60('0x40')]);return _0x3af113[_0xcd60('0x4d')](_0x84fe61);}})[_0xcd60('0x26')](function(_0x11f57e){if(_0x11f57e){_0x2bb8c3=_0x11f57e[_0xcd60('0x36')];if(!_0x119b36[_0xcd60('0x31')][_0xcd60('0x37')](_0xcd60('0x38'))){_0x84fe61['limit']=qs['limit'](_0x119b36[_0xcd60('0x31')][_0xcd60('0x1f')]);_0x84fe61[_0xcd60('0x1e')]=qs['offset'](_0x119b36['query']['offset']);}return _0x3af113[_0xcd60('0x4d')](_0x84fe61);}})['then'](function(_0x1db8f4){if(_0x1db8f4){return _0x1db8f4?{'count':_0x2bb8c3,'rows':_0x1db8f4}:null;}})[_0xcd60('0x26')](respondWithResult(_0x447511,null))[_0xcd60('0x45')](handleError(_0x447511,null));};exports[_0xcd60('0x4e')]=function(_0xfa1d1f,_0x1e059e,_0x368e75){if(_0xfa1d1f[_0xcd60('0x49')]['id']){delete _0xfa1d1f['body']['id'];}return db[_0xcd60('0x41')][_0xcd60('0x4b')]({'where':{'id':_0xfa1d1f[_0xcd60('0x47')]['id']}})[_0xcd60('0x26')](handleEntityNotFound(_0x1e059e,null))[_0xcd60('0x26')](function(_0x438c21){if(_0x438c21){_0xfa1d1f['body'][_0xcd60('0x4f')]=_0x438c21['id'];_0xfa1d1f[_0xcd60('0x49')][_0xcd60('0x50')]=integrations['getSubjects'](_0xfa1d1f[_0xcd60('0x49')][_0xcd60('0x51')],_0xfa1d1f[_0xcd60('0x49')][_0xcd60('0x2e')]);_0xfa1d1f[_0xcd60('0x49')][_0xcd60('0x52')]=integrations[_0xcd60('0x53')](_0xfa1d1f[_0xcd60('0x49')]['channel'],_0xfa1d1f[_0xcd60('0x49')]['type']);return db[_0xcd60('0x4c')]['create'](_0xfa1d1f[_0xcd60('0x49')],{'include':[{'model':db['DeskField'],'as':_0xcd60('0x50')},{'model':db[_0xcd60('0x54')],'as':'Descriptions'}]});}return null;})[_0xcd60('0x26')](respondWithResult(_0x1e059e,null))[_0xcd60('0x45')](handleError(_0x1e059e,null));};exports[_0xcd60('0x55')]=function(_0x22e1c6,_0x3a3f6f,_0x30bba3){var _0x24a470=[{'name':_0xcd60('0x56'),'label':_0xcd60('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3687df='';return db['DeskAccount'][_0xcd60('0x4b')]({'where':{'id':_0x22e1c6[_0xcd60('0x47')]['id']},'attributes':['id',_0xcd60('0x57'),_0xcd60('0x58'),_0xcd60('0x59'),_0xcd60('0x5a'),_0xcd60('0x5b'),_0xcd60('0x5c'),_0xcd60('0x5d'),_0xcd60('0x5e')]})[_0xcd60('0x26')](handleEntityNotFound(_0x3a3f6f,null))[_0xcd60('0x26')](function(_0x46748c){if(_0x46748c){_0x3687df=_0x46748c[_0xcd60('0x57')];var _0x4e9765=_0x3687df[_0xcd60('0x5f')](-0x1);if(_0x4e9765==='/'){_0x3687df=_0x3687df[_0xcd60('0x60')](0x0,_0x3687df[_0xcd60('0x61')](_0x4e9765));}var _0x178c20={'method':_0xcd60('0x62'),'uri':util[_0xcd60('0x63')](_0xcd60('0x64'),_0x3687df),'headers':{'Content-Type':_0xcd60('0x65'),'Accept':'application/json'},'json':!![]};if(_0x46748c['authType']==='basic'){_0x178c20[_0xcd60('0x66')][_0xcd60('0x67')]=util[_0xcd60('0x63')]('Basic\x20%s',new Buffer(util['format'](_0xcd60('0x68'),_0x46748c[_0xcd60('0x59')],_0x46748c['password']))['toString'](_0xcd60('0x69')));}return rp(_0x178c20)[_0xcd60('0x26')](function(_0x185a98){return _0x24a470[_0xcd60('0x6a')](_[_0xcd60('0x2b')](_0x185a98[_0xcd60('0x6b')][_0xcd60('0x6c')],function(_0x37bd35){return{'id':_0x37bd35[_0xcd60('0x28')],'name':_0x37bd35[_0xcd60('0x28')],'type':_0x37bd35[_0xcd60('0x2e')],'active':_0x37bd35[_0xcd60('0x6d')],'label':_0x37bd35[_0xcd60('0x6e')],'custom':!![]};}));});}})['then'](function(_0x36aed7){return{'count':_0x36aed7['length'],'rows':_0x36aed7};})[_0xcd60('0x26')](respondWithResult(_0x3a3f6f,null))[_0xcd60('0x45')](function(_0x44a317){var _0x5ad509=_0x22e1c6['query'][_0xcd60('0x6f')]?0x1f4:_0x44a317[_0xcd60('0x70')]||0x1f4;logger[_0xcd60('0x27')](_0xcd60('0x71'),_0xcd60('0x55'),_0x5ad509,JSON[_0xcd60('0x72')](_0x44a317));delete _0x44a317[_0xcd60('0x28')];if(_0x5ad509===0x191){_0x5ad509=0x190;}_0x3a3f6f[_0xcd60('0x1b')](_0x5ad509)[_0xcd60('0x29')](_0x22e1c6[_0xcd60('0x31')][_0xcd60('0x6f')]?{'message':_0xcd60('0x73'),'statusCode':_0x44a317[_0xcd60('0x70')]}:_0x44a317);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 8cf338c..42b84be 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 _0xf730=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','api','moment','bluebird','request-promise','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf730,0x11d));var _0x0f73=function(_0x2d1371,_0x43aef7){_0x2d1371=_0x2d1371-0x0;var _0xf17680=_0xf730[_0x2d1371];return _0xf17680;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0f73('0x0'));var moment=require(_0x0f73('0x1'));var BPromise=require(_0x0f73('0x2'));var rp=require(_0x0f73('0x3'));var fs=require('fs');var path=require(_0x0f73('0x4'));var rimraf=require(_0x0f73('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f73('0x6'));var integrations=require(_0x0f73('0x7'));module[_0x0f73('0x8')]=function(_0x170cb1,_0x288b3a){return _0x170cb1['define']('DeskAccount',attributes,{'tableName':_0x0f73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc213=['exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x57b5b1,_0x4613d6){var _0x35a6b1=function(_0x1bc5d2){while(--_0x1bc5d2){_0x57b5b1['push'](_0x57b5b1['shift']());}};_0x35a6b1(++_0x4613d6);}(_0xc213,0x8b));var _0x3c21=function(_0x46bc17,_0x4b47d0){_0x46bc17=_0x46bc17-0x0;var _0x175493=_0xc213[_0x46bc17];return _0x175493;};'use strict';var _=require(_0x3c21('0x0'));var util=require(_0x3c21('0x1'));var logger=require(_0x3c21('0x2'))(_0x3c21('0x3'));var moment=require(_0x3c21('0x4'));var BPromise=require(_0x3c21('0x5'));var rp=require(_0x3c21('0x6'));var fs=require('fs');var path=require(_0x3c21('0x7'));var rimraf=require(_0x3c21('0x8'));var config=require(_0x3c21('0x9'));var attributes=require(_0x3c21('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x3c21('0xb')]=function(_0x37eb9d,_0x51c62e){return _0x37eb9d[_0x3c21('0xc')](_0x3c21('0xd'),attributes,{'tableName':_0x3c21('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 eeb01cb..0864760 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 _0xf55a=['jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','DeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','GetDeskAccount','ShowDeskAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d5c31,_0x8d74a3){var _0x26ac4d=function(_0x2b7c07){while(--_0x2b7c07){_0x2d5c31['push'](_0x2d5c31['shift']());}};_0x26ac4d(++_0x8d74a3);}(_0xf55a,0xb9));var _0xaf55=function(_0x1ab8ed,_0x47ec76){_0x1ab8ed=_0x1ab8ed-0x0;var _0x26a30f=_0xf55a[_0x1ab8ed];return _0x26a30f;};'use strict';var _=require(_0xaf55('0x0'));var util=require(_0xaf55('0x1'));var moment=require('moment');var BPromise=require(_0xaf55('0x2'));var rs=require(_0xaf55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf55('0x4'))['db'];var utils=require(_0xaf55('0x5'));var logger=require(_0xaf55('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaf55('0x7'));var client=jayson[_0xaf55('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46e7d3,_0x3cb65c,_0x3ec403){return new BPromise(function(_0x2d8689,_0x404d81){return client['request'](_0x46e7d3,_0x3ec403)['then'](function(_0x3b7597){logger[_0xaf55('0x9')](_0xaf55('0xa'),_0x3cb65c,_0xaf55('0xb'));logger[_0xaf55('0xc')](_0xaf55('0xd'),_0x3cb65c,_0xaf55('0xb'),JSON['stringify'](_0x3b7597));if(_0x3b7597['error']){if(_0x3b7597[_0xaf55('0xe')]['code']===0x1f4){logger[_0xaf55('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3cb65c,_0x3b7597['error']['message']);return _0x404d81(_0x3b7597[_0xaf55('0xe')][_0xaf55('0xf')]);}logger[_0xaf55('0xe')](_0xaf55('0xa'),_0x3cb65c,_0x3b7597[_0xaf55('0xe')][_0xaf55('0xf')]);return _0x2d8689(_0x3b7597[_0xaf55('0xe')][_0xaf55('0xf')]);}else{logger['info'](_0xaf55('0xa'),_0x3cb65c,_0xaf55('0xb'));_0x2d8689(_0x3b7597[_0xaf55('0x10')][_0xaf55('0xf')]);}})[_0xaf55('0x11')](function(_0x266fce){logger[_0xaf55('0xe')]('DeskAccount,\x20%s,\x20%s',_0x3cb65c,_0x266fce);_0x404d81(_0x266fce);});});}exports['GetDeskAccount']=function(_0x15bd62){var _0xa1c3e7=this;return new Promise(function(_0x1a3b5c,_0x56ff26){return db[_0xaf55('0x12')][_0xaf55('0x13')]({'raw':_0x15bd62[_0xaf55('0x14')]?_0x15bd62[_0xaf55('0x14')][_0xaf55('0x15')]===undefined?!![]:![]:!![],'where':_0x15bd62[_0xaf55('0x14')]?_0x15bd62[_0xaf55('0x14')]['where']||null:null,'attributes':_0x15bd62[_0xaf55('0x14')]?_0x15bd62[_0xaf55('0x14')][_0xaf55('0x16')]||null:null,'limit':_0x15bd62['options']?_0x15bd62[_0xaf55('0x14')][_0xaf55('0x17')]||null:null,'include':_0x15bd62[_0xaf55('0x14')]?_0x15bd62[_0xaf55('0x14')][_0xaf55('0x18')]?_['map'](_0x15bd62[_0xaf55('0x14')]['include'],function(_0x5f9fa5){return{'model':db[_0x5f9fa5[_0xaf55('0x19')]],'as':_0x5f9fa5['as'],'attributes':_0x5f9fa5['attributes'],'include':_0x5f9fa5[_0xaf55('0x18')]?_[_0xaf55('0x1a')](_0x5f9fa5[_0xaf55('0x18')],function(_0x416680){return{'model':db[_0x416680[_0xaf55('0x19')]],'as':_0x416680['as'],'attributes':_0x416680[_0xaf55('0x16')],'include':_0x416680['include']?_[_0xaf55('0x1a')](_0x416680[_0xaf55('0x18')],function(_0x3d1d7e){return{'model':db[_0x3d1d7e[_0xaf55('0x19')]],'as':_0x3d1d7e['as'],'attributes':_0x3d1d7e[_0xaf55('0x16')]};}):[]};}):[]};}):[]:[]})[_0xaf55('0x1b')](function(_0x16e10e){logger['info']('GetDeskAccount',_0x15bd62);logger['debug'](_0xaf55('0x1c'),_0x15bd62,JSON['stringify'](_0x16e10e));_0x1a3b5c(_0x16e10e);})[_0xaf55('0x11')](function(_0x117095){logger[_0xaf55('0xe')](_0xaf55('0x1c'),_0x117095[_0xaf55('0xf')],_0x15bd62);_0x56ff26(_0xa1c3e7[_0xaf55('0xe')](0x1f4,_0x117095[_0xaf55('0xf')]));});});};exports[_0xaf55('0x1d')]=function(_0x5120a1){var _0x57e1ad=this;return new Promise(function(_0x3d36b0,_0x4fd518){return db[_0xaf55('0x12')][_0xaf55('0x1e')]({'raw':_0x5120a1[_0xaf55('0x14')]?_0x5120a1['options'][_0xaf55('0x15')]===undefined?!![]:![]:!![],'where':_0x5120a1[_0xaf55('0x14')]?_0x5120a1[_0xaf55('0x14')][_0xaf55('0x1f')]||null:null,'attributes':_0x5120a1[_0xaf55('0x14')]?_0x5120a1[_0xaf55('0x14')][_0xaf55('0x16')]||null:null,'include':_0x5120a1[_0xaf55('0x14')]?_0x5120a1[_0xaf55('0x14')][_0xaf55('0x18')]?_['map'](_0x5120a1[_0xaf55('0x14')]['include'],function(_0x1b37bc){return{'model':db[_0x1b37bc['model']],'as':_0x1b37bc['as'],'attributes':_0x1b37bc[_0xaf55('0x16')],'include':_0x1b37bc[_0xaf55('0x18')]?_[_0xaf55('0x1a')](_0x1b37bc[_0xaf55('0x18')],function(_0x1e582d){return{'model':db[_0x1e582d[_0xaf55('0x19')]],'as':_0x1e582d['as'],'attributes':_0x1e582d[_0xaf55('0x16')],'include':_0x1e582d[_0xaf55('0x18')]?_['map'](_0x1e582d[_0xaf55('0x18')],function(_0x266ad1){return{'model':db[_0x266ad1[_0xaf55('0x19')]],'as':_0x266ad1['as'],'attributes':_0x266ad1[_0xaf55('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449712){logger[_0xaf55('0x9')](_0xaf55('0x1d'),_0x5120a1);logger[_0xaf55('0xc')](_0xaf55('0x1d'),_0x5120a1,JSON['stringify'](_0x449712));_0x3d36b0(_0x449712);})[_0xaf55('0x11')](function(_0x54a699){logger['error'](_0xaf55('0x1d'),_0x54a699[_0xaf55('0xf')],_0x5120a1);_0x4fd518(_0x57e1ad[_0xaf55('0xe')](0x1f4,_0x54a699[_0xaf55('0xf')]));});});}; \ No newline at end of file +var _0xcdc4=['map','model','GetDeskAccount','ShowDeskAccount','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','DeskAccount','findAll','options','where','attributes','limit','include'];(function(_0xce2ee4,_0x3fe1e1){var _0x3fd000=function(_0x554493){while(--_0x554493){_0xce2ee4['push'](_0xce2ee4['shift']());}};_0x3fd000(++_0x3fe1e1);}(_0xcdc4,0xdd));var _0x4cdc=function(_0x39d1b6,_0x5c506a){_0x39d1b6=_0x39d1b6-0x0;var _0x26ad32=_0xcdc4[_0x39d1b6];return _0x26ad32;};'use strict';var _=require(_0x4cdc('0x0'));var util=require(_0x4cdc('0x1'));var moment=require(_0x4cdc('0x2'));var BPromise=require('bluebird');var rs=require(_0x4cdc('0x3'));var fs=require('fs');var Redis=require(_0x4cdc('0x4'));var db=require(_0x4cdc('0x5'))['db'];var utils=require(_0x4cdc('0x6'));var logger=require('../../config/logger')(_0x4cdc('0x7'));var config=require(_0x4cdc('0x8'));var jayson=require(_0x4cdc('0x9'));var client=jayson[_0x4cdc('0xa')][_0x4cdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d702a,_0x1e7e9e,_0x4802b5){return new BPromise(function(_0x1f949f,_0x8e6277){return client[_0x4cdc('0xc')](_0x5d702a,_0x4802b5)[_0x4cdc('0xd')](function(_0x17f517){logger[_0x4cdc('0xe')](_0x4cdc('0xf'),_0x1e7e9e,_0x4cdc('0x10'));logger[_0x4cdc('0x11')](_0x4cdc('0x12'),_0x1e7e9e,_0x4cdc('0x10'),JSON[_0x4cdc('0x13')](_0x17f517));if(_0x17f517['error']){if(_0x17f517[_0x4cdc('0x14')]['code']===0x1f4){logger['error'](_0x4cdc('0xf'),_0x1e7e9e,_0x17f517[_0x4cdc('0x14')]['message']);return _0x8e6277(_0x17f517[_0x4cdc('0x14')]['message']);}logger['error'](_0x4cdc('0xf'),_0x1e7e9e,_0x17f517[_0x4cdc('0x14')][_0x4cdc('0x15')]);return _0x1f949f(_0x17f517[_0x4cdc('0x14')][_0x4cdc('0x15')]);}else{logger[_0x4cdc('0xe')](_0x4cdc('0xf'),_0x1e7e9e,_0x4cdc('0x10'));_0x1f949f(_0x17f517[_0x4cdc('0x16')][_0x4cdc('0x15')]);}})[_0x4cdc('0x17')](function(_0x4c7e2b){logger[_0x4cdc('0x14')](_0x4cdc('0xf'),_0x1e7e9e,_0x4c7e2b);_0x8e6277(_0x4c7e2b);});});}exports['GetDeskAccount']=function(_0x3b4921){var _0x388a5d=this;return new Promise(function(_0x4cd7c5,_0x4bf58f){return db[_0x4cdc('0x18')][_0x4cdc('0x19')]({'raw':_0x3b4921[_0x4cdc('0x1a')]?_0x3b4921[_0x4cdc('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3b4921['options']?_0x3b4921[_0x4cdc('0x1a')][_0x4cdc('0x1b')]||null:null,'attributes':_0x3b4921[_0x4cdc('0x1a')]?_0x3b4921[_0x4cdc('0x1a')][_0x4cdc('0x1c')]||null:null,'limit':_0x3b4921[_0x4cdc('0x1a')]?_0x3b4921[_0x4cdc('0x1a')][_0x4cdc('0x1d')]||null:null,'include':_0x3b4921[_0x4cdc('0x1a')]?_0x3b4921[_0x4cdc('0x1a')][_0x4cdc('0x1e')]?_[_0x4cdc('0x1f')](_0x3b4921[_0x4cdc('0x1a')][_0x4cdc('0x1e')],function(_0x448d5d){return{'model':db[_0x448d5d[_0x4cdc('0x20')]],'as':_0x448d5d['as'],'attributes':_0x448d5d[_0x4cdc('0x1c')],'include':_0x448d5d[_0x4cdc('0x1e')]?_['map'](_0x448d5d[_0x4cdc('0x1e')],function(_0xbefefb){return{'model':db[_0xbefefb[_0x4cdc('0x20')]],'as':_0xbefefb['as'],'attributes':_0xbefefb[_0x4cdc('0x1c')],'include':_0xbefefb['include']?_[_0x4cdc('0x1f')](_0xbefefb[_0x4cdc('0x1e')],function(_0x2a82ab){return{'model':db[_0x2a82ab[_0x4cdc('0x20')]],'as':_0x2a82ab['as'],'attributes':_0x2a82ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x4cdc('0xd')](function(_0xa926e9){logger['info'](_0x4cdc('0x21'),_0x3b4921);logger[_0x4cdc('0x11')](_0x4cdc('0x21'),_0x3b4921,JSON['stringify'](_0xa926e9));_0x4cd7c5(_0xa926e9);})[_0x4cdc('0x17')](function(_0x458c17){logger[_0x4cdc('0x14')](_0x4cdc('0x21'),_0x458c17['message'],_0x3b4921);_0x4bf58f(_0x388a5d[_0x4cdc('0x14')](0x1f4,_0x458c17[_0x4cdc('0x15')]));});});};exports[_0x4cdc('0x22')]=function(_0x8193aa){var _0x40c395=this;return new Promise(function(_0x42ed5d,_0xdfc12c){return db[_0x4cdc('0x18')]['find']({'raw':_0x8193aa[_0x4cdc('0x1a')]?_0x8193aa[_0x4cdc('0x1a')][_0x4cdc('0x23')]===undefined?!![]:![]:!![],'where':_0x8193aa[_0x4cdc('0x1a')]?_0x8193aa[_0x4cdc('0x1a')][_0x4cdc('0x1b')]||null:null,'attributes':_0x8193aa['options']?_0x8193aa[_0x4cdc('0x1a')][_0x4cdc('0x1c')]||null:null,'include':_0x8193aa[_0x4cdc('0x1a')]?_0x8193aa[_0x4cdc('0x1a')]['include']?_[_0x4cdc('0x1f')](_0x8193aa[_0x4cdc('0x1a')][_0x4cdc('0x1e')],function(_0x2be86d){return{'model':db[_0x2be86d['model']],'as':_0x2be86d['as'],'attributes':_0x2be86d[_0x4cdc('0x1c')],'include':_0x2be86d['include']?_[_0x4cdc('0x1f')](_0x2be86d[_0x4cdc('0x1e')],function(_0x180c1f){return{'model':db[_0x180c1f['model']],'as':_0x180c1f['as'],'attributes':_0x180c1f[_0x4cdc('0x1c')],'include':_0x180c1f[_0x4cdc('0x1e')]?_['map'](_0x180c1f[_0x4cdc('0x1e')],function(_0x42a684){return{'model':db[_0x42a684['model']],'as':_0x42a684['as'],'attributes':_0x42a684[_0x4cdc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4cdc('0xd')](function(_0x39a2e6){logger[_0x4cdc('0xe')](_0x4cdc('0x22'),_0x8193aa);logger['debug'](_0x4cdc('0x22'),_0x8193aa,JSON[_0x4cdc('0x13')](_0x39a2e6));_0x42ed5d(_0x39a2e6);})[_0x4cdc('0x17')](function(_0x12bc7c){logger[_0x4cdc('0x14')]('ShowDeskAccount',_0x12bc7c[_0x4cdc('0x15')],_0x8193aa);_0xdfc12c(_0x40c395[_0x4cdc('0x14')](0x1f4,_0x12bc7c['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 02e7afa..c152a3a 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x27f0f6,_0x5d560b){var _0x397f17=function(_0x7b233){while(--_0x7b233){_0x27f0f6['push'](_0x27f0f6['shift']());}};_0x397f17(++_0x5d560b);}(_0xedd9,0xfc));var _0x9edd=function(_0x536267,_0x1a7a96){_0x536267=_0x536267-0x0;var _0x37f5b4=_0xedd9[_0x536267];return _0x37f5b4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0xcdf809,_0x2881f0){var _0x4d4d70=function(_0x277c61){while(--_0x277c61){_0xcdf809['push'](_0xcdf809['shift']());}};_0x4d4d70(++_0x2881f0);}(_0x55ca,0x126));var _0xa55c=function(_0x3f7982,_0x24c737){_0x3f7982=_0x3f7982-0x0;var _0x4e6a0d=_0x55ca[_0x3f7982];return _0x4e6a0d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a368b16..4b356db 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 _0x62e4=['sequelize','exports','STRING'];(function(_0x39f269,_0xb66aeb){var _0x4d0a56=function(_0x20aeeb){while(--_0x20aeeb){_0x39f269['push'](_0x39f269['shift']());}};_0x4d0a56(++_0xb66aeb);}(_0x62e4,0xe4));var _0x462e=function(_0x5f17b8,_0x2086f3){_0x5f17b8=_0x5f17b8-0x0;var _0x4baee6=_0x62e4[_0x5f17b8];return _0x4baee6;};'use strict';var Sequelize=require(_0x462e('0x0'));module[_0x462e('0x1')]={'name':{'type':Sequelize[_0x462e('0x2')]},'description':{'type':Sequelize[_0x462e('0x2')]}}; \ No newline at end of file +var _0x5acf=['exports','STRING'];(function(_0x4b4484,_0x1bc8cc){var _0x38c914=function(_0x2e1bbb){while(--_0x2e1bbb){_0x4b4484['push'](_0x4b4484['shift']());}};_0x38c914(++_0x1bc8cc);}(_0x5acf,0x80));var _0xf5ac=function(_0x4989fe,_0x201e34){_0x4989fe=_0x4989fe-0x0;var _0x4afd24=_0x5acf[_0x4989fe];return _0x4afd24;};'use strict';var Sequelize=require('sequelize');module[_0xf5ac('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf5ac('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index ab74a43..2a4952a 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 _0x3703=['query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','include','DeskConfiguration','findAll','catch','show','params','model','includeAll','find','create','body','update','getFields','DeskField','rawAttributes','hasOwnProperty','getSubjects','getDescriptions','findOne','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key'];(function(_0x411bd1,_0x416106){var _0x320464=function(_0x1b0f91){while(--_0x1b0f91){_0x411bd1['push'](_0x411bd1['shift']());}};_0x320464(++_0x416106);}(_0x3703,0x179));var _0x3370=function(_0x2af053,_0x4f6d28){_0x2af053=_0x2af053-0x0;var _0x4b4001=_0x3703[_0x2af053];return _0x4b4001;};'use strict';var emlformat=require(_0x3370('0x0'));var rimraf=require(_0x3370('0x1'));var zipdir=require(_0x3370('0x2'));var jsonpatch=require(_0x3370('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3370('0x4'));var Mustache=require(_0x3370('0x5'));var util=require(_0x3370('0x6'));var path=require(_0x3370('0x7'));var sox=require(_0x3370('0x8'));var csv=require(_0x3370('0x9'));var ejs=require(_0x3370('0xa'));var fs=require('fs');var fs_extra=require(_0x3370('0xb'));var _=require(_0x3370('0xc'));var squel=require(_0x3370('0xd'));var crypto=require(_0x3370('0xe'));var jsforce=require(_0x3370('0xf'));var deskjs=require(_0x3370('0x10'));var toCsv=require(_0x3370('0x9'));var querystring=require('querystring');var Papa=require(_0x3370('0x11'));var Redis=require(_0x3370('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3370('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3370('0x14'));var logger=require(_0x3370('0x15'))(_0x3370('0x16'));var utils=require('../../config/utils');var config=require(_0x3370('0x17'));var licenseUtil=require(_0x3370('0x18'));var db=require(_0x3370('0x19'))['db'];function respondWithStatusCode(_0x3f995d,_0x22c603){_0x22c603=_0x22c603||0xcc;return function(_0x497257){if(_0x497257){return _0x3f995d[_0x3370('0x1a')](_0x22c603);}return _0x3f995d[_0x3370('0x1b')](_0x22c603)[_0x3370('0x1c')]();};}function respondWithResult(_0x3eecc7,_0x4dec2c){_0x4dec2c=_0x4dec2c||0xc8;return function(_0xb14577){if(_0xb14577){return _0x3eecc7[_0x3370('0x1b')](_0x4dec2c)['json'](_0xb14577);}};}function respondWithFilteredResult(_0x3c2e12,_0x18d7bb){return function(_0x49d603){if(_0x49d603){var _0x567cde=typeof _0x18d7bb['offset']==='undefined'&&typeof _0x18d7bb[_0x3370('0x1d')]===_0x3370('0x1e');var _0x383c98=_0x49d603[_0x3370('0x1f')];var _0x2eced8=_0x567cde?0x0:_0x18d7bb['offset'];var _0x406834=_0x567cde?_0x49d603['count']:_0x18d7bb[_0x3370('0x20')]+_0x18d7bb[_0x3370('0x1d')];var _0x348779;if(_0x406834>=_0x383c98){_0x406834=_0x383c98;_0x348779=0xc8;}else{_0x348779=0xce;}_0x3c2e12[_0x3370('0x1b')](_0x348779);return _0x3c2e12[_0x3370('0x21')](_0x3370('0x22'),_0x2eced8+'-'+_0x406834+'/'+_0x383c98)['json'](_0x49d603);}return null;};}function patchUpdates(_0x403edc){return function(_0x170a9f){try{jsonpatch[_0x3370('0x23')](_0x170a9f,_0x403edc,!![]);}catch(_0x14b885){return BPromise['reject'](_0x14b885);}return _0x170a9f[_0x3370('0x24')]();};}function saveUpdates(_0x563629,_0x2fb0ee){return function(_0x4f3f72){if(_0x4f3f72){return _0x4f3f72['update'](_0x563629)[_0x3370('0x25')](function(_0x18c1a6){return _0x18c1a6;});}return null;};}function removeEntity(_0x45c066,_0x44c15a){return function(_0x2ea4ae){if(_0x2ea4ae){return _0x2ea4ae[_0x3370('0x26')]()[_0x3370('0x25')](function(){_0x45c066['status'](0xcc)[_0x3370('0x1c')]();});}};}function handleEntityNotFound(_0x305a47,_0x57e385){return function(_0x23f7e2){if(!_0x23f7e2){_0x305a47['sendStatus'](0x194);}return _0x23f7e2;};}function handleError(_0x3c1889,_0x33feeb){_0x33feeb=_0x33feeb||0x1f4;return function(_0x54adf3){logger[_0x3370('0x27')](_0x54adf3[_0x3370('0x28')]);if(_0x54adf3[_0x3370('0x29')]){delete _0x54adf3['name'];}_0x3c1889[_0x3370('0x1b')](_0x33feeb)[_0x3370('0x2a')](_0x54adf3);};}exports[_0x3370('0x2b')]=function(_0x4bbf31,_0x15d61c){var _0x2c10a6={},_0x4fc51c={},_0x2015b8={'count':0x0,'rows':[]};var _0x1207b7=_[_0x3370('0x2c')](db['DeskConfiguration']['rawAttributes'],function(_0x5b7454){return{'name':_0x5b7454[_0x3370('0x2d')],'type':_0x5b7454[_0x3370('0x2e')][_0x3370('0x2f')]};});_0x4fc51c['model']=_[_0x3370('0x2c')](_0x1207b7,_0x3370('0x29'));_0x4fc51c[_0x3370('0x30')]=_[_0x3370('0x31')](_0x4bbf31[_0x3370('0x30')]);_0x4fc51c[_0x3370('0x32')]=_[_0x3370('0x33')](_0x4fc51c['model'],_0x4fc51c[_0x3370('0x30')]);_0x2c10a6[_0x3370('0x34')]=_[_0x3370('0x33')](_0x4fc51c['model'],qs[_0x3370('0x35')](_0x4bbf31[_0x3370('0x30')][_0x3370('0x35')]));_0x2c10a6['attributes']=_0x2c10a6[_0x3370('0x34')][_0x3370('0x36')]?_0x2c10a6[_0x3370('0x34')]:_0x4fc51c['model'];if(!_0x4bbf31['query']['hasOwnProperty'](_0x3370('0x37'))){_0x2c10a6[_0x3370('0x1d')]=qs[_0x3370('0x1d')](_0x4bbf31[_0x3370('0x30')]['limit']);_0x2c10a6[_0x3370('0x20')]=qs[_0x3370('0x20')](_0x4bbf31[_0x3370('0x30')][_0x3370('0x20')]);}_0x2c10a6[_0x3370('0x38')]=qs[_0x3370('0x39')](_0x4bbf31[_0x3370('0x30')][_0x3370('0x39')]);_0x2c10a6[_0x3370('0x3a')]=qs[_0x3370('0x32')](_[_0x3370('0x3b')](_0x4bbf31[_0x3370('0x30')],_0x4fc51c[_0x3370('0x32')]),_0x1207b7);if(_0x4bbf31[_0x3370('0x30')]['filter']){_0x2c10a6['where']=_[_0x3370('0x3c')](_0x2c10a6[_0x3370('0x3a')],{'$or':_[_0x3370('0x2c')](_0x1207b7,function(_0x5dd8d2){if(_0x5dd8d2['type']!=='VIRTUAL'){var _0x519148={};_0x519148[_0x5dd8d2[_0x3370('0x29')]]={'$like':'%'+_0x4bbf31[_0x3370('0x30')][_0x3370('0x3d')]+'%'};return _0x519148;}})});}_0x2c10a6=_[_0x3370('0x3c')]({},_0x2c10a6,_0x4bbf31[_0x3370('0x3e')]);var _0x69b152={'where':_0x2c10a6[_0x3370('0x3a')]};return db['DeskConfiguration']['count'](_0x69b152)[_0x3370('0x25')](function(_0x34baa1){_0x2015b8['count']=_0x34baa1;if(_0x4bbf31[_0x3370('0x30')]['includeAll']){_0x2c10a6[_0x3370('0x3f')]=[{'all':!![]}];}return db[_0x3370('0x40')][_0x3370('0x41')](_0x2c10a6);})['then'](function(_0x1b8a9a){_0x2015b8['rows']=_0x1b8a9a;return _0x2015b8;})[_0x3370('0x25')](respondWithFilteredResult(_0x15d61c,_0x2c10a6))[_0x3370('0x42')](handleError(_0x15d61c,null));};exports[_0x3370('0x43')]=function(_0x44f49c,_0x2100c8){var _0x3ce4fb={'raw':![],'where':{'id':_0x44f49c[_0x3370('0x44')]['id']}},_0x1331d5={};_0x1331d5[_0x3370('0x45')]=_[_0x3370('0x31')](db[_0x3370('0x40')]['rawAttributes']);_0x1331d5['query']=_[_0x3370('0x31')](_0x44f49c[_0x3370('0x30')]);_0x1331d5[_0x3370('0x32')]=_[_0x3370('0x33')](_0x1331d5[_0x3370('0x45')],_0x1331d5[_0x3370('0x30')]);_0x3ce4fb[_0x3370('0x34')]=_[_0x3370('0x33')](_0x1331d5[_0x3370('0x45')],qs[_0x3370('0x35')](_0x44f49c[_0x3370('0x30')][_0x3370('0x35')]));_0x3ce4fb[_0x3370('0x34')]=_0x3ce4fb[_0x3370('0x34')]['length']?_0x3ce4fb[_0x3370('0x34')]:_0x1331d5[_0x3370('0x45')];if(_0x44f49c[_0x3370('0x30')][_0x3370('0x46')]){_0x3ce4fb['include']=[{'all':!![]}];}_0x3ce4fb=_[_0x3370('0x3c')]({},_0x3ce4fb,_0x44f49c[_0x3370('0x3e')]);return db[_0x3370('0x40')][_0x3370('0x47')](_0x3ce4fb)['then'](handleEntityNotFound(_0x2100c8,null))[_0x3370('0x25')](respondWithResult(_0x2100c8,null))[_0x3370('0x42')](handleError(_0x2100c8,null));};exports[_0x3370('0x48')]=function(_0x104da1,_0x42f3a6){return db[_0x3370('0x40')][_0x3370('0x48')](_0x104da1[_0x3370('0x49')],{})[_0x3370('0x25')](respondWithResult(_0x42f3a6,0xc9))[_0x3370('0x42')](handleError(_0x42f3a6,null));};exports[_0x3370('0x4a')]=function(_0x1e4f24,_0x3733e6){if(_0x1e4f24['body']['id']){delete _0x1e4f24['body']['id'];}return db[_0x3370('0x40')]['find']({'where':{'id':_0x1e4f24['params']['id']}})['then'](handleEntityNotFound(_0x3733e6,null))['then'](saveUpdates(_0x1e4f24[_0x3370('0x49')],null))[_0x3370('0x25')](respondWithResult(_0x3733e6,null))[_0x3370('0x42')](handleError(_0x3733e6,null));};exports[_0x3370('0x26')]=function(_0x3f7a71,_0x2036de){return db['DeskConfiguration'][_0x3370('0x47')]({'where':{'id':_0x3f7a71[_0x3370('0x44')]['id']}})['then'](handleEntityNotFound(_0x2036de,null))['then'](removeEntity(_0x2036de,null))[_0x3370('0x42')](handleError(_0x2036de,null));};exports[_0x3370('0x4b')]=function(_0x3845f4,_0x39a342,_0x211e7b){var _0x476a6d={};var _0x392073={};var _0x26d521;var _0x35f793;return db[_0x3370('0x40')]['findOne']({'where':{'id':_0x3845f4[_0x3370('0x44')]['id']}})['then'](handleEntityNotFound(_0x39a342,null))[_0x3370('0x25')](function(_0x5cba71){if(_0x5cba71){_0x26d521=_0x5cba71;_0x392073[_0x3370('0x45')]=_[_0x3370('0x31')](db[_0x3370('0x4c')][_0x3370('0x4d')]);_0x392073[_0x3370('0x30')]=_[_0x3370('0x31')](_0x3845f4['query']);_0x392073[_0x3370('0x32')]=_[_0x3370('0x33')](_0x392073['model'],_0x392073[_0x3370('0x30')]);_0x476a6d[_0x3370('0x34')]=_['intersection'](_0x392073[_0x3370('0x45')],qs[_0x3370('0x35')](_0x3845f4['query'][_0x3370('0x35')]));_0x476a6d[_0x3370('0x34')]=_0x476a6d[_0x3370('0x34')][_0x3370('0x36')]?_0x476a6d['attributes']:_0x392073[_0x3370('0x45')];_0x476a6d['order']=qs[_0x3370('0x39')](_0x3845f4[_0x3370('0x30')][_0x3370('0x39')]);_0x476a6d[_0x3370('0x3a')]=qs[_0x3370('0x32')](_[_0x3370('0x3b')](_0x3845f4[_0x3370('0x30')],_0x392073[_0x3370('0x32')]));if(_0x3845f4[_0x3370('0x30')][_0x3370('0x3d')]){_0x476a6d[_0x3370('0x3a')]=_[_0x3370('0x3c')](_0x476a6d['where'],{'$or':_[_0x3370('0x2c')](_0x476a6d[_0x3370('0x34')],function(_0x4bf377){var _0x38df0b={};_0x38df0b[_0x4bf377]={'$like':'%'+_0x3845f4['query'][_0x3370('0x3d')]+'%'};return _0x38df0b;})});}_0x476a6d=_[_0x3370('0x3c')]({},_0x476a6d,_0x3845f4[_0x3370('0x3e')]);return _0x26d521[_0x3370('0x4b')](_0x476a6d);}})[_0x3370('0x25')](function(_0xd38b2c){if(_0xd38b2c){_0x35f793=_0xd38b2c[_0x3370('0x36')];if(!_0x3845f4[_0x3370('0x30')][_0x3370('0x4e')](_0x3370('0x37'))){_0x476a6d[_0x3370('0x1d')]=qs[_0x3370('0x1d')](_0x3845f4[_0x3370('0x30')][_0x3370('0x1d')]);_0x476a6d['offset']=qs[_0x3370('0x20')](_0x3845f4[_0x3370('0x30')][_0x3370('0x20')]);}return _0x26d521[_0x3370('0x4b')](_0x476a6d);}})[_0x3370('0x25')](function(_0x5ec442){if(_0x5ec442){return _0x5ec442?{'count':_0x35f793,'rows':_0x5ec442}:null;}})[_0x3370('0x25')](respondWithResult(_0x39a342,null))[_0x3370('0x42')](handleError(_0x39a342,null));};exports[_0x3370('0x4f')]=function(_0x29c48d,_0x60027c,_0x108caf){var _0x6eef63={};var _0x2a96d6={};var _0xd6a26;var _0x3ec61d;return db['DeskConfiguration']['findOne']({'where':{'id':_0x29c48d[_0x3370('0x44')]['id']}})[_0x3370('0x25')](handleEntityNotFound(_0x60027c,null))[_0x3370('0x25')](function(_0x5e72c4){if(_0x5e72c4){_0xd6a26=_0x5e72c4;_0x2a96d6[_0x3370('0x45')]=_['keys'](db[_0x3370('0x4c')]['rawAttributes']);_0x2a96d6['query']=_[_0x3370('0x31')](_0x29c48d['query']);_0x2a96d6[_0x3370('0x32')]=_[_0x3370('0x33')](_0x2a96d6[_0x3370('0x45')],_0x2a96d6[_0x3370('0x30')]);_0x6eef63[_0x3370('0x34')]=_[_0x3370('0x33')](_0x2a96d6[_0x3370('0x45')],qs['fields'](_0x29c48d[_0x3370('0x30')][_0x3370('0x35')]));_0x6eef63[_0x3370('0x34')]=_0x6eef63[_0x3370('0x34')]['length']?_0x6eef63[_0x3370('0x34')]:_0x2a96d6[_0x3370('0x45')];_0x6eef63[_0x3370('0x38')]=qs[_0x3370('0x39')](_0x29c48d[_0x3370('0x30')][_0x3370('0x39')]);_0x6eef63[_0x3370('0x3a')]=qs[_0x3370('0x32')](_[_0x3370('0x3b')](_0x29c48d[_0x3370('0x30')],_0x2a96d6[_0x3370('0x32')]));if(_0x29c48d[_0x3370('0x30')]['filter']){_0x6eef63[_0x3370('0x3a')]=_[_0x3370('0x3c')](_0x6eef63['where'],{'$or':_[_0x3370('0x2c')](_0x6eef63[_0x3370('0x34')],function(_0x17242e){var _0x3370a0={};_0x3370a0[_0x17242e]={'$like':'%'+_0x29c48d[_0x3370('0x30')][_0x3370('0x3d')]+'%'};return _0x3370a0;})});}_0x6eef63=_[_0x3370('0x3c')]({},_0x6eef63,_0x29c48d[_0x3370('0x3e')]);return _0xd6a26[_0x3370('0x4f')](_0x6eef63);}})[_0x3370('0x25')](function(_0x4ab9f4){if(_0x4ab9f4){_0x3ec61d=_0x4ab9f4[_0x3370('0x36')];if(!_0x29c48d[_0x3370('0x30')]['hasOwnProperty']('nolimit')){_0x6eef63[_0x3370('0x1d')]=qs['limit'](_0x29c48d[_0x3370('0x30')][_0x3370('0x1d')]);_0x6eef63['offset']=qs[_0x3370('0x20')](_0x29c48d[_0x3370('0x30')][_0x3370('0x20')]);}return _0xd6a26[_0x3370('0x4f')](_0x6eef63);}})[_0x3370('0x25')](function(_0x3c0338){if(_0x3c0338){return _0x3c0338?{'count':_0x3ec61d,'rows':_0x3c0338}:null;}})['then'](respondWithResult(_0x60027c,null))[_0x3370('0x42')](handleError(_0x60027c,null));};exports[_0x3370('0x50')]=function(_0x5160f5,_0x3dbe7d,_0x6443ca){var _0x50321f={};var _0x2ab771={};var _0x176c6c;var _0x491d27;return db[_0x3370('0x40')][_0x3370('0x51')]({'where':{'id':_0x5160f5[_0x3370('0x44')]['id']}})[_0x3370('0x25')](handleEntityNotFound(_0x3dbe7d,null))[_0x3370('0x25')](function(_0x2c0f53){if(_0x2c0f53){_0x176c6c=_0x2c0f53;_0x2ab771[_0x3370('0x45')]=_[_0x3370('0x31')](db[_0x3370('0x4c')]['rawAttributes']);_0x2ab771[_0x3370('0x30')]=_[_0x3370('0x31')](_0x5160f5[_0x3370('0x30')]);_0x2ab771['filters']=_[_0x3370('0x33')](_0x2ab771['model'],_0x2ab771[_0x3370('0x30')]);_0x50321f[_0x3370('0x34')]=_[_0x3370('0x33')](_0x2ab771['model'],qs[_0x3370('0x35')](_0x5160f5[_0x3370('0x30')][_0x3370('0x35')]));_0x50321f[_0x3370('0x34')]=_0x50321f[_0x3370('0x34')][_0x3370('0x36')]?_0x50321f['attributes']:_0x2ab771[_0x3370('0x45')];_0x50321f['order']=qs[_0x3370('0x39')](_0x5160f5[_0x3370('0x30')][_0x3370('0x39')]);_0x50321f['where']=qs[_0x3370('0x32')](_[_0x3370('0x3b')](_0x5160f5['query'],_0x2ab771[_0x3370('0x32')]));if(_0x5160f5[_0x3370('0x30')][_0x3370('0x3d')]){_0x50321f['where']=_[_0x3370('0x3c')](_0x50321f[_0x3370('0x3a')],{'$or':_[_0x3370('0x2c')](_0x50321f[_0x3370('0x34')],function(_0x36b69d){var _0x5d3e43={};_0x5d3e43[_0x36b69d]={'$like':'%'+_0x5160f5[_0x3370('0x30')][_0x3370('0x3d')]+'%'};return _0x5d3e43;})});}_0x50321f=_['merge']({},_0x50321f,_0x5160f5[_0x3370('0x3e')]);return _0x176c6c['getDescriptions'](_0x50321f);}})[_0x3370('0x25')](function(_0x16dd4c){if(_0x16dd4c){_0x491d27=_0x16dd4c['length'];if(!_0x5160f5[_0x3370('0x30')][_0x3370('0x4e')](_0x3370('0x37'))){_0x50321f[_0x3370('0x1d')]=qs['limit'](_0x5160f5['query'][_0x3370('0x1d')]);_0x50321f[_0x3370('0x20')]=qs[_0x3370('0x20')](_0x5160f5[_0x3370('0x30')][_0x3370('0x20')]);}return _0x176c6c[_0x3370('0x50')](_0x50321f);}})['then'](function(_0x2a4423){if(_0x2a4423){return _0x2a4423?{'count':_0x491d27,'rows':_0x2a4423}:null;}})[_0x3370('0x25')](respondWithResult(_0x3dbe7d,null))['catch'](handleError(_0x3dbe7d,null));};exports['getTags']=function(_0x1de407,_0x29c610,_0xe3a57a){var _0x54a39c={};var _0x3e9f76={};var _0x559e32;var _0x494b26;return db[_0x3370('0x40')]['findOne']({'where':{'id':_0x1de407['params']['id']}})[_0x3370('0x25')](handleEntityNotFound(_0x29c610,null))[_0x3370('0x25')](function(_0x3a8563){if(_0x3a8563){_0x559e32=_0x3a8563;_0x3e9f76[_0x3370('0x45')]=_[_0x3370('0x31')](db['Tag']['rawAttributes']);_0x3e9f76[_0x3370('0x30')]=_[_0x3370('0x31')](_0x1de407[_0x3370('0x30')]);_0x3e9f76[_0x3370('0x32')]=_[_0x3370('0x33')](_0x3e9f76['model'],_0x3e9f76[_0x3370('0x30')]);_0x54a39c[_0x3370('0x34')]=_[_0x3370('0x33')](_0x3e9f76[_0x3370('0x45')],qs['fields'](_0x1de407[_0x3370('0x30')][_0x3370('0x35')]));_0x54a39c[_0x3370('0x34')]=_0x54a39c[_0x3370('0x34')]['length']?_0x54a39c[_0x3370('0x34')]:_0x3e9f76[_0x3370('0x45')];_0x54a39c[_0x3370('0x38')]=qs[_0x3370('0x39')](_0x1de407[_0x3370('0x30')][_0x3370('0x39')]);_0x54a39c['where']=qs[_0x3370('0x32')](_[_0x3370('0x3b')](_0x1de407[_0x3370('0x30')],_0x3e9f76[_0x3370('0x32')]));if(_0x1de407['query'][_0x3370('0x3d')]){_0x54a39c[_0x3370('0x3a')]=_['merge'](_0x54a39c['where'],{'$or':_[_0x3370('0x2c')](_0x54a39c[_0x3370('0x34')],function(_0x523b45){var _0x7bf5e4={};_0x7bf5e4[_0x523b45]={'$like':'%'+_0x1de407['query'][_0x3370('0x3d')]+'%'};return _0x7bf5e4;})});}_0x54a39c=_[_0x3370('0x3c')]({},_0x54a39c,_0x1de407[_0x3370('0x3e')]);return _0x559e32[_0x3370('0x52')](_0x54a39c);}})[_0x3370('0x25')](function(_0x54b153){if(_0x54b153){_0x494b26=_0x54b153[_0x3370('0x36')];if(!_0x1de407[_0x3370('0x30')]['hasOwnProperty'](_0x3370('0x37'))){_0x54a39c[_0x3370('0x1d')]=qs[_0x3370('0x1d')](_0x1de407[_0x3370('0x30')][_0x3370('0x1d')]);_0x54a39c[_0x3370('0x20')]=qs[_0x3370('0x20')](_0x1de407[_0x3370('0x30')][_0x3370('0x20')]);}return _0x559e32['getTags'](_0x54a39c);}})[_0x3370('0x25')](function(_0x2bde33){if(_0x2bde33){return _0x2bde33?{'count':_0x494b26,'rows':_0x2bde33}:null;}})[_0x3370('0x25')](respondWithResult(_0x29c610,null))[_0x3370('0x42')](handleError(_0x29c610,null));};exports[_0x3370('0x53')]=function(_0x1b9457,_0x3b2852,_0xe6332c){if(_0x1b9457[_0x3370('0x49')]['id']){delete _0x1b9457[_0x3370('0x49')]['id'];}return db[_0x3370('0x40')][_0x3370('0x51')]({'where':{'id':_0x1b9457['params']['id']}})[_0x3370('0x25')](handleEntityNotFound(_0x3b2852,null))[_0x3370('0x25')](function(_0x47fc1e){if(_0x47fc1e){return _0x47fc1e[_0x3370('0x53')](_0x1b9457['body'][_0x3370('0x54')]||[]);}return null;})['then'](respondWithResult(_0x3b2852,null))['catch'](handleError(_0x3b2852,null));}; \ No newline at end of file +var _0xe9c2=['getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','sendStatus','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','create','body','params','destroy','getFields','DeskField','getSubjects','findOne','getDescriptions','Tag'];(function(_0x3a1dc1,_0x3643da){var _0x338096=function(_0x20c467){while(--_0x20c467){_0x3a1dc1['push'](_0x3a1dc1['shift']());}};_0x338096(++_0x3643da);}(_0xe9c2,0x1a7));var _0x2e9c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe9c2[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2e9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e9c('0x1'));var jsonpatch=require(_0x2e9c('0x2'));var rp=require(_0x2e9c('0x3'));var moment=require(_0x2e9c('0x4'));var BPromise=require(_0x2e9c('0x5'));var Mustache=require(_0x2e9c('0x6'));var util=require(_0x2e9c('0x7'));var path=require(_0x2e9c('0x8'));var sox=require(_0x2e9c('0x9'));var csv=require(_0x2e9c('0xa'));var ejs=require(_0x2e9c('0xb'));var fs=require('fs');var fs_extra=require(_0x2e9c('0xc'));var _=require(_0x2e9c('0xd'));var squel=require(_0x2e9c('0xe'));var crypto=require('crypto');var jsforce=require(_0x2e9c('0xf'));var deskjs=require(_0x2e9c('0x10'));var toCsv=require(_0x2e9c('0xa'));var querystring=require(_0x2e9c('0x11'));var Papa=require(_0x2e9c('0x12'));var Redis=require(_0x2e9c('0x13'));var authService=require(_0x2e9c('0x14'));var qs=require(_0x2e9c('0x15'));var as=require(_0x2e9c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e9c('0x17'))(_0x2e9c('0x18'));var utils=require('../../config/utils');var config=require(_0x2e9c('0x19'));var licenseUtil=require(_0x2e9c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6d6111,_0x418328){_0x418328=_0x418328||0xcc;return function(_0x82a03d){if(_0x82a03d){return _0x6d6111['sendStatus'](_0x418328);}return _0x6d6111[_0x2e9c('0x1b')](_0x418328)[_0x2e9c('0x1c')]();};}function respondWithResult(_0x35f0fa,_0x1289ef){_0x1289ef=_0x1289ef||0xc8;return function(_0x490e4a){if(_0x490e4a){return _0x35f0fa[_0x2e9c('0x1b')](_0x1289ef)[_0x2e9c('0x1d')](_0x490e4a);}};}function respondWithFilteredResult(_0x4edddd,_0x2e4720){return function(_0x11d000){if(_0x11d000){var _0x2c97e2=typeof _0x2e4720['offset']===_0x2e9c('0x1e')&&typeof _0x2e4720[_0x2e9c('0x1f')]===_0x2e9c('0x1e');var _0x4313ce=_0x11d000[_0x2e9c('0x20')];var _0x12c601=_0x2c97e2?0x0:_0x2e4720['offset'];var _0x43db02=_0x2c97e2?_0x11d000[_0x2e9c('0x20')]:_0x2e4720[_0x2e9c('0x21')]+_0x2e4720['limit'];var _0x2652b4;if(_0x43db02>=_0x4313ce){_0x43db02=_0x4313ce;_0x2652b4=0xc8;}else{_0x2652b4=0xce;}_0x4edddd[_0x2e9c('0x1b')](_0x2652b4);return _0x4edddd[_0x2e9c('0x22')](_0x2e9c('0x23'),_0x12c601+'-'+_0x43db02+'/'+_0x4313ce)['json'](_0x11d000);}return null;};}function patchUpdates(_0x1b290f){return function(_0x25395d){try{jsonpatch['apply'](_0x25395d,_0x1b290f,!![]);}catch(_0x5f093e){return BPromise[_0x2e9c('0x24')](_0x5f093e);}return _0x25395d[_0x2e9c('0x25')]();};}function saveUpdates(_0x4dcaac,_0x3d0f24){return function(_0x93b0dc){if(_0x93b0dc){return _0x93b0dc['update'](_0x4dcaac)[_0x2e9c('0x26')](function(_0x4d6ce3){return _0x4d6ce3;});}return null;};}function removeEntity(_0x2c09d1,_0x25bf1f){return function(_0xc9403a){if(_0xc9403a){return _0xc9403a['destroy']()[_0x2e9c('0x26')](function(){_0x2c09d1[_0x2e9c('0x1b')](0xcc)[_0x2e9c('0x1c')]();});}};}function handleEntityNotFound(_0x287a1c,_0x175ec8){return function(_0x36712f){if(!_0x36712f){_0x287a1c[_0x2e9c('0x27')](0x194);}return _0x36712f;};}function handleError(_0x47af2f,_0x557fcb){_0x557fcb=_0x557fcb||0x1f4;return function(_0x5dc9f){logger['error'](_0x5dc9f[_0x2e9c('0x28')]);if(_0x5dc9f[_0x2e9c('0x29')]){delete _0x5dc9f['name'];}_0x47af2f[_0x2e9c('0x1b')](_0x557fcb)['send'](_0x5dc9f);};}exports[_0x2e9c('0x2a')]=function(_0x55bfe7,_0x574346){var _0x1e9455={},_0x56e051={},_0x2ddbc7={'count':0x0,'rows':[]};var _0x4b1173=_[_0x2e9c('0x2b')](db[_0x2e9c('0x2c')][_0x2e9c('0x2d')],function(_0x989866){return{'name':_0x989866[_0x2e9c('0x2e')],'type':_0x989866['type']['key']};});_0x56e051[_0x2e9c('0x2f')]=_[_0x2e9c('0x2b')](_0x4b1173,_0x2e9c('0x29'));_0x56e051[_0x2e9c('0x30')]=_[_0x2e9c('0x31')](_0x55bfe7[_0x2e9c('0x30')]);_0x56e051[_0x2e9c('0x32')]=_[_0x2e9c('0x33')](_0x56e051[_0x2e9c('0x2f')],_0x56e051['query']);_0x1e9455['attributes']=_['intersection'](_0x56e051[_0x2e9c('0x2f')],qs[_0x2e9c('0x34')](_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x34')]));_0x1e9455[_0x2e9c('0x35')]=_0x1e9455[_0x2e9c('0x35')]['length']?_0x1e9455[_0x2e9c('0x35')]:_0x56e051[_0x2e9c('0x2f')];if(!_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x36')](_0x2e9c('0x37'))){_0x1e9455[_0x2e9c('0x1f')]=qs['limit'](_0x55bfe7['query'][_0x2e9c('0x1f')]);_0x1e9455[_0x2e9c('0x21')]=qs['offset'](_0x55bfe7['query']['offset']);}_0x1e9455[_0x2e9c('0x38')]=qs[_0x2e9c('0x39')](_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x39')]);_0x1e9455[_0x2e9c('0x3a')]=qs[_0x2e9c('0x32')](_[_0x2e9c('0x3b')](_0x55bfe7['query'],_0x56e051[_0x2e9c('0x32')]),_0x4b1173);if(_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x3c')]){_0x1e9455[_0x2e9c('0x3a')]=_[_0x2e9c('0x3d')](_0x1e9455[_0x2e9c('0x3a')],{'$or':_[_0x2e9c('0x2b')](_0x4b1173,function(_0x4ebee3){if(_0x4ebee3[_0x2e9c('0x3e')]!==_0x2e9c('0x3f')){var _0x5d5569={};_0x5d5569[_0x4ebee3[_0x2e9c('0x29')]]={'$like':'%'+_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x3c')]+'%'};return _0x5d5569;}})});}_0x1e9455=_['merge']({},_0x1e9455,_0x55bfe7[_0x2e9c('0x40')]);var _0x47ca2d={'where':_0x1e9455[_0x2e9c('0x3a')]};return db[_0x2e9c('0x2c')][_0x2e9c('0x20')](_0x47ca2d)[_0x2e9c('0x26')](function(_0x379c29){_0x2ddbc7['count']=_0x379c29;if(_0x55bfe7[_0x2e9c('0x30')][_0x2e9c('0x41')]){_0x1e9455['include']=[{'all':!![]}];}return db[_0x2e9c('0x2c')][_0x2e9c('0x42')](_0x1e9455);})[_0x2e9c('0x26')](function(_0x54580b){_0x2ddbc7[_0x2e9c('0x43')]=_0x54580b;return _0x2ddbc7;})['then'](respondWithFilteredResult(_0x574346,_0x1e9455))[_0x2e9c('0x44')](handleError(_0x574346,null));};exports[_0x2e9c('0x45')]=function(_0x49a608,_0x2c0ad2){var _0x14d110={'raw':![],'where':{'id':_0x49a608['params']['id']}},_0x40b0ff={};_0x40b0ff[_0x2e9c('0x2f')]=_['keys'](db['DeskConfiguration']['rawAttributes']);_0x40b0ff['query']=_[_0x2e9c('0x31')](_0x49a608[_0x2e9c('0x30')]);_0x40b0ff[_0x2e9c('0x32')]=_[_0x2e9c('0x33')](_0x40b0ff[_0x2e9c('0x2f')],_0x40b0ff[_0x2e9c('0x30')]);_0x14d110[_0x2e9c('0x35')]=_['intersection'](_0x40b0ff[_0x2e9c('0x2f')],qs['fields'](_0x49a608[_0x2e9c('0x30')][_0x2e9c('0x34')]));_0x14d110['attributes']=_0x14d110[_0x2e9c('0x35')][_0x2e9c('0x46')]?_0x14d110[_0x2e9c('0x35')]:_0x40b0ff[_0x2e9c('0x2f')];if(_0x49a608['query']['includeAll']){_0x14d110['include']=[{'all':!![]}];}_0x14d110=_[_0x2e9c('0x3d')]({},_0x14d110,_0x49a608[_0x2e9c('0x40')]);return db[_0x2e9c('0x2c')]['find'](_0x14d110)[_0x2e9c('0x26')](handleEntityNotFound(_0x2c0ad2,null))[_0x2e9c('0x26')](respondWithResult(_0x2c0ad2,null))[_0x2e9c('0x44')](handleError(_0x2c0ad2,null));};exports['create']=function(_0x3491c8,_0x18411f){return db[_0x2e9c('0x2c')][_0x2e9c('0x47')](_0x3491c8[_0x2e9c('0x48')],{})[_0x2e9c('0x26')](respondWithResult(_0x18411f,0xc9))[_0x2e9c('0x44')](handleError(_0x18411f,null));};exports['update']=function(_0x4ee707,_0x252248){if(_0x4ee707['body']['id']){delete _0x4ee707['body']['id'];}return db[_0x2e9c('0x2c')]['find']({'where':{'id':_0x4ee707[_0x2e9c('0x49')]['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x252248,null))[_0x2e9c('0x26')](saveUpdates(_0x4ee707[_0x2e9c('0x48')],null))[_0x2e9c('0x26')](respondWithResult(_0x252248,null))[_0x2e9c('0x44')](handleError(_0x252248,null));};exports[_0x2e9c('0x4a')]=function(_0x35c226,_0x4a83f0){return db['DeskConfiguration']['find']({'where':{'id':_0x35c226[_0x2e9c('0x49')]['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x4a83f0,null))['then'](removeEntity(_0x4a83f0,null))['catch'](handleError(_0x4a83f0,null));};exports[_0x2e9c('0x4b')]=function(_0x4d7ae4,_0x20ffbd,_0x573d25){var _0x22440f={};var _0x2928e7={};var _0x25e67c;var _0x251f02;return db[_0x2e9c('0x2c')]['findOne']({'where':{'id':_0x4d7ae4['params']['id']}})['then'](handleEntityNotFound(_0x20ffbd,null))[_0x2e9c('0x26')](function(_0x22d3f9){if(_0x22d3f9){_0x25e67c=_0x22d3f9;_0x2928e7[_0x2e9c('0x2f')]=_[_0x2e9c('0x31')](db[_0x2e9c('0x4c')][_0x2e9c('0x2d')]);_0x2928e7[_0x2e9c('0x30')]=_[_0x2e9c('0x31')](_0x4d7ae4[_0x2e9c('0x30')]);_0x2928e7[_0x2e9c('0x32')]=_[_0x2e9c('0x33')](_0x2928e7[_0x2e9c('0x2f')],_0x2928e7[_0x2e9c('0x30')]);_0x22440f[_0x2e9c('0x35')]=_[_0x2e9c('0x33')](_0x2928e7['model'],qs[_0x2e9c('0x34')](_0x4d7ae4[_0x2e9c('0x30')]['fields']));_0x22440f['attributes']=_0x22440f[_0x2e9c('0x35')][_0x2e9c('0x46')]?_0x22440f[_0x2e9c('0x35')]:_0x2928e7[_0x2e9c('0x2f')];_0x22440f[_0x2e9c('0x38')]=qs['sort'](_0x4d7ae4['query'][_0x2e9c('0x39')]);_0x22440f[_0x2e9c('0x3a')]=qs['filters'](_[_0x2e9c('0x3b')](_0x4d7ae4[_0x2e9c('0x30')],_0x2928e7['filters']));if(_0x4d7ae4[_0x2e9c('0x30')][_0x2e9c('0x3c')]){_0x22440f[_0x2e9c('0x3a')]=_[_0x2e9c('0x3d')](_0x22440f['where'],{'$or':_[_0x2e9c('0x2b')](_0x22440f['attributes'],function(_0x3bdef8){var _0x3e6e95={};_0x3e6e95[_0x3bdef8]={'$like':'%'+_0x4d7ae4[_0x2e9c('0x30')][_0x2e9c('0x3c')]+'%'};return _0x3e6e95;})});}_0x22440f=_[_0x2e9c('0x3d')]({},_0x22440f,_0x4d7ae4[_0x2e9c('0x40')]);return _0x25e67c[_0x2e9c('0x4b')](_0x22440f);}})[_0x2e9c('0x26')](function(_0x3c2461){if(_0x3c2461){_0x251f02=_0x3c2461[_0x2e9c('0x46')];if(!_0x4d7ae4[_0x2e9c('0x30')]['hasOwnProperty'](_0x2e9c('0x37'))){_0x22440f[_0x2e9c('0x1f')]=qs['limit'](_0x4d7ae4['query'][_0x2e9c('0x1f')]);_0x22440f[_0x2e9c('0x21')]=qs['offset'](_0x4d7ae4[_0x2e9c('0x30')][_0x2e9c('0x21')]);}return _0x25e67c[_0x2e9c('0x4b')](_0x22440f);}})['then'](function(_0x1bbd6b){if(_0x1bbd6b){return _0x1bbd6b?{'count':_0x251f02,'rows':_0x1bbd6b}:null;}})[_0x2e9c('0x26')](respondWithResult(_0x20ffbd,null))[_0x2e9c('0x44')](handleError(_0x20ffbd,null));};exports[_0x2e9c('0x4d')]=function(_0x21e737,_0x54fd0f,_0x310372){var _0x562e16={};var _0x9c3bf5={};var _0x5f4732;var _0x3e29ed;return db[_0x2e9c('0x2c')][_0x2e9c('0x4e')]({'where':{'id':_0x21e737['params']['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x54fd0f,null))['then'](function(_0x8ff7bd){if(_0x8ff7bd){_0x5f4732=_0x8ff7bd;_0x9c3bf5[_0x2e9c('0x2f')]=_[_0x2e9c('0x31')](db[_0x2e9c('0x4c')][_0x2e9c('0x2d')]);_0x9c3bf5[_0x2e9c('0x30')]=_[_0x2e9c('0x31')](_0x21e737[_0x2e9c('0x30')]);_0x9c3bf5[_0x2e9c('0x32')]=_['intersection'](_0x9c3bf5[_0x2e9c('0x2f')],_0x9c3bf5[_0x2e9c('0x30')]);_0x562e16['attributes']=_['intersection'](_0x9c3bf5[_0x2e9c('0x2f')],qs[_0x2e9c('0x34')](_0x21e737['query'][_0x2e9c('0x34')]));_0x562e16['attributes']=_0x562e16['attributes']['length']?_0x562e16['attributes']:_0x9c3bf5[_0x2e9c('0x2f')];_0x562e16['order']=qs[_0x2e9c('0x39')](_0x21e737['query'][_0x2e9c('0x39')]);_0x562e16['where']=qs[_0x2e9c('0x32')](_[_0x2e9c('0x3b')](_0x21e737[_0x2e9c('0x30')],_0x9c3bf5[_0x2e9c('0x32')]));if(_0x21e737['query'][_0x2e9c('0x3c')]){_0x562e16[_0x2e9c('0x3a')]=_[_0x2e9c('0x3d')](_0x562e16[_0x2e9c('0x3a')],{'$or':_['map'](_0x562e16['attributes'],function(_0x58edf3){var _0x50b063={};_0x50b063[_0x58edf3]={'$like':'%'+_0x21e737[_0x2e9c('0x30')][_0x2e9c('0x3c')]+'%'};return _0x50b063;})});}_0x562e16=_[_0x2e9c('0x3d')]({},_0x562e16,_0x21e737[_0x2e9c('0x40')]);return _0x5f4732[_0x2e9c('0x4d')](_0x562e16);}})['then'](function(_0x342981){if(_0x342981){_0x3e29ed=_0x342981[_0x2e9c('0x46')];if(!_0x21e737[_0x2e9c('0x30')][_0x2e9c('0x36')](_0x2e9c('0x37'))){_0x562e16[_0x2e9c('0x1f')]=qs[_0x2e9c('0x1f')](_0x21e737[_0x2e9c('0x30')][_0x2e9c('0x1f')]);_0x562e16[_0x2e9c('0x21')]=qs[_0x2e9c('0x21')](_0x21e737[_0x2e9c('0x30')][_0x2e9c('0x21')]);}return _0x5f4732[_0x2e9c('0x4d')](_0x562e16);}})[_0x2e9c('0x26')](function(_0x1b46ed){if(_0x1b46ed){return _0x1b46ed?{'count':_0x3e29ed,'rows':_0x1b46ed}:null;}})['then'](respondWithResult(_0x54fd0f,null))[_0x2e9c('0x44')](handleError(_0x54fd0f,null));};exports[_0x2e9c('0x4f')]=function(_0xd5e041,_0x34178c,_0x116316){var _0x5b5ed5={};var _0x367244={};var _0x33aae8;var _0xed7544;return db['DeskConfiguration'][_0x2e9c('0x4e')]({'where':{'id':_0xd5e041[_0x2e9c('0x49')]['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x34178c,null))[_0x2e9c('0x26')](function(_0x2f6ad6){if(_0x2f6ad6){_0x33aae8=_0x2f6ad6;_0x367244[_0x2e9c('0x2f')]=_['keys'](db[_0x2e9c('0x4c')][_0x2e9c('0x2d')]);_0x367244[_0x2e9c('0x30')]=_[_0x2e9c('0x31')](_0xd5e041['query']);_0x367244[_0x2e9c('0x32')]=_['intersection'](_0x367244[_0x2e9c('0x2f')],_0x367244[_0x2e9c('0x30')]);_0x5b5ed5['attributes']=_['intersection'](_0x367244[_0x2e9c('0x2f')],qs[_0x2e9c('0x34')](_0xd5e041[_0x2e9c('0x30')][_0x2e9c('0x34')]));_0x5b5ed5['attributes']=_0x5b5ed5[_0x2e9c('0x35')]['length']?_0x5b5ed5[_0x2e9c('0x35')]:_0x367244[_0x2e9c('0x2f')];_0x5b5ed5[_0x2e9c('0x38')]=qs[_0x2e9c('0x39')](_0xd5e041['query'][_0x2e9c('0x39')]);_0x5b5ed5[_0x2e9c('0x3a')]=qs['filters'](_[_0x2e9c('0x3b')](_0xd5e041[_0x2e9c('0x30')],_0x367244[_0x2e9c('0x32')]));if(_0xd5e041[_0x2e9c('0x30')]['filter']){_0x5b5ed5['where']=_[_0x2e9c('0x3d')](_0x5b5ed5[_0x2e9c('0x3a')],{'$or':_['map'](_0x5b5ed5[_0x2e9c('0x35')],function(_0x1ce5d0){var _0x34e90b={};_0x34e90b[_0x1ce5d0]={'$like':'%'+_0xd5e041[_0x2e9c('0x30')][_0x2e9c('0x3c')]+'%'};return _0x34e90b;})});}_0x5b5ed5=_[_0x2e9c('0x3d')]({},_0x5b5ed5,_0xd5e041['options']);return _0x33aae8[_0x2e9c('0x4f')](_0x5b5ed5);}})[_0x2e9c('0x26')](function(_0x429702){if(_0x429702){_0xed7544=_0x429702['length'];if(!_0xd5e041[_0x2e9c('0x30')][_0x2e9c('0x36')](_0x2e9c('0x37'))){_0x5b5ed5[_0x2e9c('0x1f')]=qs['limit'](_0xd5e041[_0x2e9c('0x30')][_0x2e9c('0x1f')]);_0x5b5ed5[_0x2e9c('0x21')]=qs['offset'](_0xd5e041['query'][_0x2e9c('0x21')]);}return _0x33aae8[_0x2e9c('0x4f')](_0x5b5ed5);}})['then'](function(_0xa1dbbe){if(_0xa1dbbe){return _0xa1dbbe?{'count':_0xed7544,'rows':_0xa1dbbe}:null;}})[_0x2e9c('0x26')](respondWithResult(_0x34178c,null))[_0x2e9c('0x44')](handleError(_0x34178c,null));};exports['getTags']=function(_0x14b478,_0x762563,_0x2b1e47){var _0x1cfad9={};var _0x21dc0f={};var _0x169399;var _0x29246;return db[_0x2e9c('0x2c')][_0x2e9c('0x4e')]({'where':{'id':_0x14b478[_0x2e9c('0x49')]['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x762563,null))[_0x2e9c('0x26')](function(_0x29df9c){if(_0x29df9c){_0x169399=_0x29df9c;_0x21dc0f[_0x2e9c('0x2f')]=_[_0x2e9c('0x31')](db[_0x2e9c('0x50')][_0x2e9c('0x2d')]);_0x21dc0f[_0x2e9c('0x30')]=_[_0x2e9c('0x31')](_0x14b478[_0x2e9c('0x30')]);_0x21dc0f[_0x2e9c('0x32')]=_['intersection'](_0x21dc0f[_0x2e9c('0x2f')],_0x21dc0f['query']);_0x1cfad9[_0x2e9c('0x35')]=_[_0x2e9c('0x33')](_0x21dc0f[_0x2e9c('0x2f')],qs['fields'](_0x14b478['query']['fields']));_0x1cfad9[_0x2e9c('0x35')]=_0x1cfad9[_0x2e9c('0x35')][_0x2e9c('0x46')]?_0x1cfad9[_0x2e9c('0x35')]:_0x21dc0f[_0x2e9c('0x2f')];_0x1cfad9['order']=qs[_0x2e9c('0x39')](_0x14b478[_0x2e9c('0x30')][_0x2e9c('0x39')]);_0x1cfad9[_0x2e9c('0x3a')]=qs['filters'](_[_0x2e9c('0x3b')](_0x14b478[_0x2e9c('0x30')],_0x21dc0f[_0x2e9c('0x32')]));if(_0x14b478[_0x2e9c('0x30')][_0x2e9c('0x3c')]){_0x1cfad9[_0x2e9c('0x3a')]=_[_0x2e9c('0x3d')](_0x1cfad9['where'],{'$or':_[_0x2e9c('0x2b')](_0x1cfad9['attributes'],function(_0x5091e7){var _0x1891d0={};_0x1891d0[_0x5091e7]={'$like':'%'+_0x14b478[_0x2e9c('0x30')][_0x2e9c('0x3c')]+'%'};return _0x1891d0;})});}_0x1cfad9=_[_0x2e9c('0x3d')]({},_0x1cfad9,_0x14b478[_0x2e9c('0x40')]);return _0x169399[_0x2e9c('0x51')](_0x1cfad9);}})[_0x2e9c('0x26')](function(_0x4b729d){if(_0x4b729d){_0x29246=_0x4b729d['length'];if(!_0x14b478[_0x2e9c('0x30')]['hasOwnProperty'](_0x2e9c('0x37'))){_0x1cfad9[_0x2e9c('0x1f')]=qs[_0x2e9c('0x1f')](_0x14b478[_0x2e9c('0x30')][_0x2e9c('0x1f')]);_0x1cfad9['offset']=qs[_0x2e9c('0x21')](_0x14b478[_0x2e9c('0x30')][_0x2e9c('0x21')]);}return _0x169399['getTags'](_0x1cfad9);}})['then'](function(_0x5dc6d9){if(_0x5dc6d9){return _0x5dc6d9?{'count':_0x29246,'rows':_0x5dc6d9}:null;}})[_0x2e9c('0x26')](respondWithResult(_0x762563,null))[_0x2e9c('0x44')](handleError(_0x762563,null));};exports[_0x2e9c('0x52')]=function(_0x13b26f,_0x3ed74c,_0x2bb4d6){if(_0x13b26f[_0x2e9c('0x48')]['id']){delete _0x13b26f['body']['id'];}return db['DeskConfiguration'][_0x2e9c('0x4e')]({'where':{'id':_0x13b26f[_0x2e9c('0x49')]['id']}})[_0x2e9c('0x26')](handleEntityNotFound(_0x3ed74c,null))['then'](function(_0x4c9eee){if(_0x4c9eee){return _0x4c9eee[_0x2e9c('0x52')](_0x13b26f[_0x2e9c('0x48')][_0x2e9c('0x53')]||[]);}return null;})['then'](respondWithResult(_0x3ed74c,null))[_0x2e9c('0x44')](handleError(_0x3ed74c,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index be390f0..42c66dd 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 _0xd5f1=['int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','define','DeskConfiguration'];(function(_0x2d8be2,_0x209c88){var _0x387d12=function(_0x139e2e){while(--_0x139e2e){_0x2d8be2['push'](_0x2d8be2['shift']());}};_0x387d12(++_0x209c88);}(_0xd5f1,0x91));var _0x1d5f=function(_0x551016,_0xe420f7){_0x551016=_0x551016-0x0;var _0x53dc6e=_0xd5f1[_0x551016];return _0x53dc6e;};'use strict';var _=require(_0x1d5f('0x0'));var util=require(_0x1d5f('0x1'));var logger=require(_0x1d5f('0x2'))(_0x1d5f('0x3'));var moment=require(_0x1d5f('0x4'));var BPromise=require(_0x1d5f('0x5'));var rp=require(_0x1d5f('0x6'));var fs=require('fs');var path=require(_0x1d5f('0x7'));var rimraf=require(_0x1d5f('0x8'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module['exports']=function(_0x443e59,_0x87786d){return _0x443e59[_0x1d5f('0x9')](_0x1d5f('0xa'),attributes,{'tableName':_0x1d5f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51ef=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x51ef,0x1db));var _0xf51e=function(_0x23a28f,_0x480b0e){_0x23a28f=_0x23a28f-0x0;var _0x4d5c8b=_0x51ef[_0x23a28f];return _0x4d5c8b;};'use strict';var _=require(_0xf51e('0x0'));var util=require(_0xf51e('0x1'));var logger=require(_0xf51e('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf51e('0x3'));var rp=require(_0xf51e('0x4'));var fs=require('fs');var path=require(_0xf51e('0x5'));var rimraf=require(_0xf51e('0x6'));var config=require(_0xf51e('0x7'));var attributes=require(_0xf51e('0x8'));module[_0xf51e('0x9')]=function(_0x3ec314,_0x253f22){return _0x3ec314[_0xf51e('0xa')](_0xf51e('0xb'),attributes,{'tableName':_0xf51e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 218832e..3e00fef 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 _0x3249=['message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3249,0xdf));var _0x9324=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x3249[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0x9324('0x0'));var util=require(_0x9324('0x1'));var moment=require(_0x9324('0x2'));var BPromise=require('bluebird');var rs=require(_0x9324('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9324('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9324('0x5'))(_0x9324('0x6'));var config=require('../../config/environment');var jayson=require(_0x9324('0x7'));var client=jayson[_0x9324('0x8')][_0x9324('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb353aa,_0x37957b,_0x445a94){return new BPromise(function(_0x4ea2df,_0x2d5686){return client[_0x9324('0xa')](_0xb353aa,_0x445a94)['then'](function(_0x194f92){logger[_0x9324('0xb')](_0x9324('0xc'),_0x37957b,_0x9324('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x37957b,_0x9324('0xd'),JSON[_0x9324('0xe')](_0x194f92));if(_0x194f92['error']){if(_0x194f92[_0x9324('0xf')][_0x9324('0x10')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x37957b,_0x194f92[_0x9324('0xf')][_0x9324('0x11')]);return _0x2d5686(_0x194f92[_0x9324('0xf')]['message']);}logger[_0x9324('0xf')](_0x9324('0xc'),_0x37957b,_0x194f92[_0x9324('0xf')][_0x9324('0x11')]);return _0x4ea2df(_0x194f92['error'][_0x9324('0x11')]);}else{logger[_0x9324('0xb')](_0x9324('0xc'),_0x37957b,_0x9324('0xd'));_0x4ea2df(_0x194f92[_0x9324('0x12')][_0x9324('0x11')]);}})[_0x9324('0x13')](function(_0x49c0da){logger[_0x9324('0xf')](_0x9324('0xc'),_0x37957b,_0x49c0da);_0x2d5686(_0x49c0da);});});} \ No newline at end of file +var _0xeca8=['../../config/environment','jayson/promise','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeca8,0x1f2));var _0x8eca=function(_0x59bede,_0x1bdca0){_0x59bede=_0x59bede-0x0;var _0x151812=_0xeca8[_0x59bede];return _0x151812;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var moment=require(_0x8eca('0x2'));var BPromise=require(_0x8eca('0x3'));var rs=require(_0x8eca('0x4'));var fs=require('fs');var Redis=require(_0x8eca('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8eca('0x6'));var logger=require('../../config/logger')(_0x8eca('0x7'));var config=require(_0x8eca('0x8'));var jayson=require(_0x8eca('0x9'));var client=jayson['client'][_0x8eca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c679,_0xe6e3f2,_0x39f40a){return new BPromise(function(_0xedaeca,_0x3b901f){return client['request'](_0x12c679,_0x39f40a)[_0x8eca('0xb')](function(_0x19208c){logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));logger[_0x8eca('0xf')](_0x8eca('0x10'),_0xe6e3f2,_0x8eca('0xe'),JSON[_0x8eca('0x11')](_0x19208c));if(_0x19208c[_0x8eca('0x12')]){if(_0x19208c['error'][_0x8eca('0x13')]===0x1f4){logger['error'](_0x8eca('0xd'),_0xe6e3f2,_0x19208c[_0x8eca('0x12')]['message']);return _0x3b901f(_0x19208c[_0x8eca('0x12')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xe6e3f2,_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);return _0xedaeca(_0x19208c[_0x8eca('0x12')][_0x8eca('0x14')]);}else{logger[_0x8eca('0xc')](_0x8eca('0xd'),_0xe6e3f2,_0x8eca('0xe'));_0xedaeca(_0x19208c['result'][_0x8eca('0x14')]);}})[_0x8eca('0x15')](function(_0x4b8c67){logger[_0x8eca('0x12')](_0x8eca('0xd'),_0xe6e3f2,_0x4b8c67);_0x3b901f(_0x4b8c67);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 209466f..2ebd113 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 _0x2558=['index','/:id','isAuthenticated','show','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x2558,0x1a0));var _0x8255=function(_0x107f75,_0x117428){_0x107f75=_0x107f75-0x0;var _0x503a3f=_0x2558[_0x107f75];return _0x503a3f;};'use strict';var multer=require('multer');var util=require(_0x8255('0x0'));var path=require(_0x8255('0x1'));var timeout=require(_0x8255('0x2'));var express=require(_0x8255('0x3'));var router=express[_0x8255('0x4')]();var fs_extra=require(_0x8255('0x5'));var auth=require(_0x8255('0x6'));var interaction=require(_0x8255('0x7'));var config=require(_0x8255('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8255('0x9')]);router['get'](_0x8255('0xa'),auth[_0x8255('0xb')](),controller[_0x8255('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8255('0xd')]);router['put'](_0x8255('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8255('0xe')](_0x8255('0xa'),auth[_0x8255('0xb')](),controller[_0x8255('0xf')]);module[_0x8255('0x10')]=router; \ No newline at end of file +var _0xa469=['Router','fs-extra','../../components/auth/service','./intDeskField.controller','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer','connect-timeout','express'];(function(_0x36cded,_0x5f5afc){var _0x32deda=function(_0x2e6af5){while(--_0x2e6af5){_0x36cded['push'](_0x36cded['shift']());}};_0x32deda(++_0x5f5afc);}(_0xa469,0x9d));var _0x9a46=function(_0x6317fd,_0x57da55){_0x6317fd=_0x6317fd-0x0;var _0x524b3f=_0xa469[_0x6317fd];return _0x524b3f;};'use strict';var multer=require(_0x9a46('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a46('0x1'));var express=require(_0x9a46('0x2'));var router=express[_0x9a46('0x3')]();var fs_extra=require(_0x9a46('0x4'));var auth=require(_0x9a46('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a46('0x6'));router['get']('/',auth[_0x9a46('0x7')](),controller[_0x9a46('0x8')]);router['get'](_0x9a46('0x9'),auth[_0x9a46('0x7')](),controller[_0x9a46('0xa')]);router[_0x9a46('0xb')]('/',auth[_0x9a46('0x7')](),controller[_0x9a46('0xc')]);router['put'](_0x9a46('0x9'),auth[_0x9a46('0x7')](),controller[_0x9a46('0xd')]);router['delete'](_0x9a46('0x9'),auth[_0x9a46('0x7')](),controller[_0x9a46('0xe')]);module[_0x9a46('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 9119493..e93c05a 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 _0xe85d=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x56b5a7,_0x23734d){var _0x5519ec=function(_0x414014){while(--_0x414014){_0x56b5a7['push'](_0x56b5a7['shift']());}};_0x5519ec(++_0x23734d);}(_0xe85d,0xb6));var _0xde85=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xe85d[_0x265aa2];return _0x447a3a;};'use strict';var Sequelize=require(_0xde85('0x0'));module[_0xde85('0x1')]={'type':{'type':Sequelize[_0xde85('0x2')](_0xde85('0x3'),'variable',_0xde85('0x4'),_0xde85('0x5'),_0xde85('0x6')),'defaultValue':_0xde85('0x3')},'content':{'type':Sequelize[_0xde85('0x7')]},'key':{'type':Sequelize[_0xde85('0x7')]},'keyType':{'type':Sequelize[_0xde85('0x2')]('string',_0xde85('0x8'),_0xde85('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xde85('0x7')]},'nameField':{'type':Sequelize[_0xde85('0x7')]},'customField':{'type':Sequelize[_0xde85('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde85('0x7')]}}; \ No newline at end of file +var _0x83bd=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x3ce4db,_0x4d2842){var _0xa541df=function(_0x12ad03){while(--_0x12ad03){_0x3ce4db['push'](_0x3ce4db['shift']());}};_0xa541df(++_0x4d2842);}(_0x83bd,0xa6));var _0xd83b=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0x83bd[_0x5534fe];return _0x3d1dc2;};'use strict';var Sequelize=require(_0xd83b('0x0'));module[_0xd83b('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd83b('0x2'),_0xd83b('0x3'),'customVariable',_0xd83b('0x4'),_0xd83b('0x5')),'defaultValue':_0xd83b('0x2')},'content':{'type':Sequelize[_0xd83b('0x6')]},'key':{'type':Sequelize[_0xd83b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xd83b('0x6')]},'idField':{'type':Sequelize[_0xd83b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd83b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd83b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 86f02f2..ad88a5d 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 _0x9851=['end','error','name','status','send','index','DeskField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','order','sort','where','VIRTUAL','filter','merge','options','rows','show','params','keys','length','includeAll','include','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1f3a89,_0x329ed8){var _0x182632=function(_0x31c314){while(--_0x31c314){_0x1f3a89['push'](_0x1f3a89['shift']());}};_0x182632(++_0x329ed8);}(_0x9851,0x1f1));var _0x1985=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9851[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1985('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1985('0x1'));var jsonpatch=require(_0x1985('0x2'));var rp=require(_0x1985('0x3'));var moment=require(_0x1985('0x4'));var BPromise=require(_0x1985('0x5'));var Mustache=require(_0x1985('0x6'));var util=require(_0x1985('0x7'));var path=require(_0x1985('0x8'));var sox=require(_0x1985('0x9'));var csv=require(_0x1985('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1985('0xb'));var _=require(_0x1985('0xc'));var squel=require(_0x1985('0xd'));var crypto=require('crypto');var jsforce=require(_0x1985('0xe'));var deskjs=require(_0x1985('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1985('0x10'));var Papa=require('papaparse');var Redis=require(_0x1985('0x11'));var authService=require(_0x1985('0x12'));var qs=require(_0x1985('0x13'));var as=require(_0x1985('0x14'));var hardwareService=require(_0x1985('0x15'));var logger=require(_0x1985('0x16'))(_0x1985('0x17'));var utils=require(_0x1985('0x18'));var config=require(_0x1985('0x19'));var licenseUtil=require(_0x1985('0x1a'));var db=require(_0x1985('0x1b'))['db'];function respondWithStatusCode(_0x10e96b,_0x50f28f){_0x50f28f=_0x50f28f||0xcc;return function(_0x262ff9){if(_0x262ff9){return _0x10e96b[_0x1985('0x1c')](_0x50f28f);}return _0x10e96b['status'](_0x50f28f)['end']();};}function respondWithResult(_0x4cdde9,_0xacb40f){_0xacb40f=_0xacb40f||0xc8;return function(_0x3a8db7){if(_0x3a8db7){return _0x4cdde9['status'](_0xacb40f)[_0x1985('0x1d')](_0x3a8db7);}};}function respondWithFilteredResult(_0x324644,_0x131884){return function(_0x49ec6e){if(_0x49ec6e){var _0xbe7245=typeof _0x131884['offset']===_0x1985('0x1e')&&typeof _0x131884['limit']===_0x1985('0x1e');var _0x51b4f4=_0x49ec6e[_0x1985('0x1f')];var _0x2c7279=_0xbe7245?0x0:_0x131884[_0x1985('0x20')];var _0x433a33=_0xbe7245?_0x49ec6e[_0x1985('0x1f')]:_0x131884[_0x1985('0x20')]+_0x131884[_0x1985('0x21')];var _0x112913;if(_0x433a33>=_0x51b4f4){_0x433a33=_0x51b4f4;_0x112913=0xc8;}else{_0x112913=0xce;}_0x324644['status'](_0x112913);return _0x324644[_0x1985('0x22')](_0x1985('0x23'),_0x2c7279+'-'+_0x433a33+'/'+_0x51b4f4)['json'](_0x49ec6e);}return null;};}function patchUpdates(_0x417bf7){return function(_0x17aa33){try{jsonpatch[_0x1985('0x24')](_0x17aa33,_0x417bf7,!![]);}catch(_0x435422){return BPromise[_0x1985('0x25')](_0x435422);}return _0x17aa33[_0x1985('0x26')]();};}function saveUpdates(_0xb73151,_0x290c1a){return function(_0x2e648a){if(_0x2e648a){return _0x2e648a[_0x1985('0x27')](_0xb73151)[_0x1985('0x28')](function(_0x5506a7){return _0x5506a7;});}return null;};}function removeEntity(_0xeac967,_0x6d7358){return function(_0x42889c){if(_0x42889c){return _0x42889c[_0x1985('0x29')]()[_0x1985('0x28')](function(){_0xeac967['status'](0xcc)[_0x1985('0x2a')]();});}};}function handleEntityNotFound(_0x17ffe2,_0x452e15){return function(_0x1ed802){if(!_0x1ed802){_0x17ffe2['sendStatus'](0x194);}return _0x1ed802;};}function handleError(_0xa9578,_0x36e919){_0x36e919=_0x36e919||0x1f4;return function(_0x3ea584){logger[_0x1985('0x2b')](_0x3ea584['stack']);if(_0x3ea584['name']){delete _0x3ea584[_0x1985('0x2c')];}_0xa9578[_0x1985('0x2d')](_0x36e919)[_0x1985('0x2e')](_0x3ea584);};}exports[_0x1985('0x2f')]=function(_0x518449,_0x3ad278){var _0x51a226={},_0x5ed429={},_0x20bd30={'count':0x0,'rows':[]};var _0x488e9c=_['map'](db[_0x1985('0x30')][_0x1985('0x31')],function(_0x1e7701){return{'name':_0x1e7701[_0x1985('0x32')],'type':_0x1e7701['type'][_0x1985('0x33')]};});_0x5ed429[_0x1985('0x34')]=_[_0x1985('0x35')](_0x488e9c,_0x1985('0x2c'));_0x5ed429[_0x1985('0x36')]=_['keys'](_0x518449[_0x1985('0x36')]);_0x5ed429[_0x1985('0x37')]=_[_0x1985('0x38')](_0x5ed429[_0x1985('0x34')],_0x5ed429[_0x1985('0x36')]);_0x51a226[_0x1985('0x39')]=_['intersection'](_0x5ed429[_0x1985('0x34')],qs[_0x1985('0x3a')](_0x518449[_0x1985('0x36')][_0x1985('0x3a')]));_0x51a226['attributes']=_0x51a226[_0x1985('0x39')]['length']?_0x51a226['attributes']:_0x5ed429[_0x1985('0x34')];if(!_0x518449[_0x1985('0x36')]['hasOwnProperty']('nolimit')){_0x51a226[_0x1985('0x21')]=qs[_0x1985('0x21')](_0x518449[_0x1985('0x36')][_0x1985('0x21')]);_0x51a226[_0x1985('0x20')]=qs[_0x1985('0x20')](_0x518449[_0x1985('0x36')][_0x1985('0x20')]);}_0x51a226[_0x1985('0x3b')]=qs[_0x1985('0x3c')](_0x518449[_0x1985('0x36')]['sort']);_0x51a226[_0x1985('0x3d')]=qs['filters'](_['pick'](_0x518449['query'],_0x5ed429[_0x1985('0x37')]),_0x488e9c);if(_0x518449[_0x1985('0x36')]['filter']){_0x51a226[_0x1985('0x3d')]=_['merge'](_0x51a226[_0x1985('0x3d')],{'$or':_[_0x1985('0x35')](_0x488e9c,function(_0x1fc3b3){if(_0x1fc3b3['type']!==_0x1985('0x3e')){var _0x5aecab={};_0x5aecab[_0x1fc3b3[_0x1985('0x2c')]]={'$like':'%'+_0x518449['query'][_0x1985('0x3f')]+'%'};return _0x5aecab;}})});}_0x51a226=_[_0x1985('0x40')]({},_0x51a226,_0x518449[_0x1985('0x41')]);var _0x2ae405={'where':_0x51a226[_0x1985('0x3d')]};return db['DeskField'][_0x1985('0x1f')](_0x2ae405)[_0x1985('0x28')](function(_0x19a114){_0x20bd30[_0x1985('0x1f')]=_0x19a114;if(_0x518449[_0x1985('0x36')]['includeAll']){_0x51a226['include']=[{'all':!![]}];}return db[_0x1985('0x30')]['findAll'](_0x51a226);})[_0x1985('0x28')](function(_0x38fc14){_0x20bd30[_0x1985('0x42')]=_0x38fc14;return _0x20bd30;})['then'](respondWithFilteredResult(_0x3ad278,_0x51a226))['catch'](handleError(_0x3ad278,null));};exports[_0x1985('0x43')]=function(_0x4736ad,_0x181abf){var _0x5486b7={'raw':!![],'where':{'id':_0x4736ad[_0x1985('0x44')]['id']}},_0x537f6e={};_0x537f6e[_0x1985('0x34')]=_[_0x1985('0x45')](db[_0x1985('0x30')][_0x1985('0x31')]);_0x537f6e[_0x1985('0x36')]=_[_0x1985('0x45')](_0x4736ad[_0x1985('0x36')]);_0x537f6e[_0x1985('0x37')]=_[_0x1985('0x38')](_0x537f6e[_0x1985('0x34')],_0x537f6e[_0x1985('0x36')]);_0x5486b7[_0x1985('0x39')]=_[_0x1985('0x38')](_0x537f6e[_0x1985('0x34')],qs[_0x1985('0x3a')](_0x4736ad['query']['fields']));_0x5486b7['attributes']=_0x5486b7[_0x1985('0x39')][_0x1985('0x46')]?_0x5486b7[_0x1985('0x39')]:_0x537f6e['model'];if(_0x4736ad[_0x1985('0x36')][_0x1985('0x47')]){_0x5486b7[_0x1985('0x48')]=[{'all':!![]}];}_0x5486b7=_['merge']({},_0x5486b7,_0x4736ad['options']);return db['DeskField']['find'](_0x5486b7)[_0x1985('0x28')](handleEntityNotFound(_0x181abf,null))[_0x1985('0x28')](respondWithResult(_0x181abf,null))[_0x1985('0x49')](handleError(_0x181abf,null));};exports[_0x1985('0x4a')]=function(_0x26dbee,_0x32cf0c){return db['DeskField']['create'](_0x26dbee['body'],{})[_0x1985('0x28')](respondWithResult(_0x32cf0c,0xc9))[_0x1985('0x49')](handleError(_0x32cf0c,null));};exports[_0x1985('0x27')]=function(_0x3be6b2,_0x434e52){if(_0x3be6b2[_0x1985('0x4b')]['id']){delete _0x3be6b2[_0x1985('0x4b')]['id'];}return db[_0x1985('0x30')][_0x1985('0x4c')]({'where':{'id':_0x3be6b2[_0x1985('0x44')]['id']}})[_0x1985('0x28')](handleEntityNotFound(_0x434e52,null))['then'](saveUpdates(_0x3be6b2[_0x1985('0x4b')],null))['then'](respondWithResult(_0x434e52,null))[_0x1985('0x49')](handleError(_0x434e52,null));};exports[_0x1985('0x29')]=function(_0x4e1e39,_0x423541){return db[_0x1985('0x30')][_0x1985('0x4c')]({'where':{'id':_0x4e1e39[_0x1985('0x44')]['id']}})[_0x1985('0x28')](handleEntityNotFound(_0x423541,null))[_0x1985('0x28')](removeEntity(_0x423541,null))[_0x1985('0x49')](handleError(_0x423541,null));}; \ No newline at end of file +var _0x6011=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','then','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','create','body','update','find','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x255e42,_0x1b8f05){var _0x36151c=function(_0x342cdc){while(--_0x342cdc){_0x255e42['push'](_0x255e42['shift']());}};_0x36151c(++_0x1b8f05);}(_0x6011,0x196));var _0x1601=function(_0x1ff7a1,_0x4b4c5d){_0x1ff7a1=_0x1ff7a1-0x0;var _0x19a883=_0x6011[_0x1ff7a1];return _0x19a883;};'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('request-promise');var moment=require(_0x1601('0x0'));var BPromise=require(_0x1601('0x1'));var Mustache=require('mustache');var util=require(_0x1601('0x2'));var path=require(_0x1601('0x3'));var sox=require(_0x1601('0x4'));var csv=require(_0x1601('0x5'));var ejs=require(_0x1601('0x6'));var fs=require('fs');var fs_extra=require(_0x1601('0x7'));var _=require(_0x1601('0x8'));var squel=require(_0x1601('0x9'));var crypto=require(_0x1601('0xa'));var jsforce=require(_0x1601('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1601('0x5'));var querystring=require(_0x1601('0xc'));var Papa=require(_0x1601('0xd'));var Redis=require(_0x1601('0xe'));var authService=require(_0x1601('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1601('0x10'))('api');var utils=require(_0x1601('0x11'));var config=require(_0x1601('0x12'));var licenseUtil=require(_0x1601('0x13'));var db=require(_0x1601('0x14'))['db'];function respondWithStatusCode(_0x263bef,_0x322025){_0x322025=_0x322025||0xcc;return function(_0x3ac50b){if(_0x3ac50b){return _0x263bef[_0x1601('0x15')](_0x322025);}return _0x263bef['status'](_0x322025)[_0x1601('0x16')]();};}function respondWithResult(_0x555d4f,_0x4705f0){_0x4705f0=_0x4705f0||0xc8;return function(_0x5d642d){if(_0x5d642d){return _0x555d4f[_0x1601('0x17')](_0x4705f0)[_0x1601('0x18')](_0x5d642d);}};}function respondWithFilteredResult(_0x4bb5c1,_0x1b40be){return function(_0x39873a){if(_0x39873a){var _0x12ddb0=typeof _0x1b40be['offset']==='undefined'&&typeof _0x1b40be[_0x1601('0x19')]===_0x1601('0x1a');var _0x3621e2=_0x39873a[_0x1601('0x1b')];var _0x1d8563=_0x12ddb0?0x0:_0x1b40be[_0x1601('0x1c')];var _0x23b992=_0x12ddb0?_0x39873a[_0x1601('0x1b')]:_0x1b40be[_0x1601('0x1c')]+_0x1b40be['limit'];var _0x4d077e;if(_0x23b992>=_0x3621e2){_0x23b992=_0x3621e2;_0x4d077e=0xc8;}else{_0x4d077e=0xce;}_0x4bb5c1[_0x1601('0x17')](_0x4d077e);return _0x4bb5c1[_0x1601('0x1d')](_0x1601('0x1e'),_0x1d8563+'-'+_0x23b992+'/'+_0x3621e2)['json'](_0x39873a);}return null;};}function patchUpdates(_0x2c3b5d){return function(_0x380157){try{jsonpatch[_0x1601('0x1f')](_0x380157,_0x2c3b5d,!![]);}catch(_0x2e2e0d){return BPromise[_0x1601('0x20')](_0x2e2e0d);}return _0x380157['save']();};}function saveUpdates(_0x1b8314,_0x296023){return function(_0x220313){if(_0x220313){return _0x220313['update'](_0x1b8314)[_0x1601('0x21')](function(_0x330033){return _0x330033;});}return null;};}function removeEntity(_0x4f918b,_0x2b01da){return function(_0xa8e856){if(_0xa8e856){return _0xa8e856['destroy']()['then'](function(){_0x4f918b[_0x1601('0x17')](0xcc)[_0x1601('0x16')]();});}};}function handleEntityNotFound(_0x34d021,_0x4919f2){return function(_0x362f51){if(!_0x362f51){_0x34d021[_0x1601('0x15')](0x194);}return _0x362f51;};}function handleError(_0x23a6a9,_0x250fcc){_0x250fcc=_0x250fcc||0x1f4;return function(_0x296c34){logger['error'](_0x296c34['stack']);if(_0x296c34[_0x1601('0x22')]){delete _0x296c34[_0x1601('0x22')];}_0x23a6a9[_0x1601('0x17')](_0x250fcc)['send'](_0x296c34);};}exports[_0x1601('0x23')]=function(_0x57eb42,_0x2dcbc9){var _0x3c6bc1={},_0x389f0f={},_0x4d4d0b={'count':0x0,'rows':[]};var _0x388530=_[_0x1601('0x24')](db[_0x1601('0x25')][_0x1601('0x26')],function(_0x5cdcfb){return{'name':_0x5cdcfb[_0x1601('0x27')],'type':_0x5cdcfb[_0x1601('0x28')][_0x1601('0x29')]};});_0x389f0f[_0x1601('0x2a')]=_[_0x1601('0x24')](_0x388530,_0x1601('0x22'));_0x389f0f[_0x1601('0x2b')]=_[_0x1601('0x2c')](_0x57eb42[_0x1601('0x2b')]);_0x389f0f[_0x1601('0x2d')]=_[_0x1601('0x2e')](_0x389f0f[_0x1601('0x2a')],_0x389f0f[_0x1601('0x2b')]);_0x3c6bc1['attributes']=_[_0x1601('0x2e')](_0x389f0f[_0x1601('0x2a')],qs[_0x1601('0x2f')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x2f')]));_0x3c6bc1['attributes']=_0x3c6bc1[_0x1601('0x30')][_0x1601('0x31')]?_0x3c6bc1['attributes']:_0x389f0f[_0x1601('0x2a')];if(!_0x57eb42['query'][_0x1601('0x32')](_0x1601('0x33'))){_0x3c6bc1['limit']=qs[_0x1601('0x19')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x19')]);_0x3c6bc1[_0x1601('0x1c')]=qs[_0x1601('0x1c')](_0x57eb42[_0x1601('0x2b')][_0x1601('0x1c')]);}_0x3c6bc1['order']=qs[_0x1601('0x34')](_0x57eb42[_0x1601('0x2b')]['sort']);_0x3c6bc1['where']=qs[_0x1601('0x2d')](_[_0x1601('0x35')](_0x57eb42[_0x1601('0x2b')],_0x389f0f[_0x1601('0x2d')]),_0x388530);if(_0x57eb42[_0x1601('0x2b')][_0x1601('0x36')]){_0x3c6bc1[_0x1601('0x37')]=_['merge'](_0x3c6bc1[_0x1601('0x37')],{'$or':_[_0x1601('0x24')](_0x388530,function(_0x482379){if(_0x482379['type']!==_0x1601('0x38')){var _0x52034d={};_0x52034d[_0x482379['name']]={'$like':'%'+_0x57eb42['query'][_0x1601('0x36')]+'%'};return _0x52034d;}})});}_0x3c6bc1=_[_0x1601('0x39')]({},_0x3c6bc1,_0x57eb42[_0x1601('0x3a')]);var _0xb8146e={'where':_0x3c6bc1[_0x1601('0x37')]};return db[_0x1601('0x25')][_0x1601('0x1b')](_0xb8146e)[_0x1601('0x21')](function(_0x388f3b){_0x4d4d0b[_0x1601('0x1b')]=_0x388f3b;if(_0x57eb42[_0x1601('0x2b')][_0x1601('0x3b')]){_0x3c6bc1[_0x1601('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x1601('0x3d')](_0x3c6bc1);})['then'](function(_0x5acf66){_0x4d4d0b['rows']=_0x5acf66;return _0x4d4d0b;})[_0x1601('0x21')](respondWithFilteredResult(_0x2dcbc9,_0x3c6bc1))[_0x1601('0x3e')](handleError(_0x2dcbc9,null));};exports[_0x1601('0x3f')]=function(_0x5a06dc,_0x581941){var _0x3aef1a={'raw':!![],'where':{'id':_0x5a06dc[_0x1601('0x40')]['id']}},_0x3ce65d={};_0x3ce65d['model']=_[_0x1601('0x2c')](db['DeskField'][_0x1601('0x26')]);_0x3ce65d[_0x1601('0x2b')]=_[_0x1601('0x2c')](_0x5a06dc[_0x1601('0x2b')]);_0x3ce65d['filters']=_[_0x1601('0x2e')](_0x3ce65d['model'],_0x3ce65d[_0x1601('0x2b')]);_0x3aef1a[_0x1601('0x30')]=_['intersection'](_0x3ce65d[_0x1601('0x2a')],qs[_0x1601('0x2f')](_0x5a06dc[_0x1601('0x2b')]['fields']));_0x3aef1a[_0x1601('0x30')]=_0x3aef1a['attributes'][_0x1601('0x31')]?_0x3aef1a[_0x1601('0x30')]:_0x3ce65d[_0x1601('0x2a')];if(_0x5a06dc[_0x1601('0x2b')][_0x1601('0x3b')]){_0x3aef1a[_0x1601('0x3c')]=[{'all':!![]}];}_0x3aef1a=_[_0x1601('0x39')]({},_0x3aef1a,_0x5a06dc[_0x1601('0x3a')]);return db[_0x1601('0x25')]['find'](_0x3aef1a)[_0x1601('0x21')](handleEntityNotFound(_0x581941,null))['then'](respondWithResult(_0x581941,null))[_0x1601('0x3e')](handleError(_0x581941,null));};exports[_0x1601('0x41')]=function(_0x4a8039,_0xbaeefc){return db[_0x1601('0x25')]['create'](_0x4a8039[_0x1601('0x42')],{})[_0x1601('0x21')](respondWithResult(_0xbaeefc,0xc9))[_0x1601('0x3e')](handleError(_0xbaeefc,null));};exports[_0x1601('0x43')]=function(_0x30f2bf,_0xf14c98){if(_0x30f2bf[_0x1601('0x42')]['id']){delete _0x30f2bf[_0x1601('0x42')]['id'];}return db[_0x1601('0x25')][_0x1601('0x44')]({'where':{'id':_0x30f2bf['params']['id']}})[_0x1601('0x21')](handleEntityNotFound(_0xf14c98,null))['then'](saveUpdates(_0x30f2bf[_0x1601('0x42')],null))[_0x1601('0x21')](respondWithResult(_0xf14c98,null))[_0x1601('0x3e')](handleError(_0xf14c98,null));};exports['destroy']=function(_0x56b904,_0x26ba09){return db[_0x1601('0x25')]['find']({'where':{'id':_0x56b904['params']['id']}})['then'](handleEntityNotFound(_0x26ba09,null))[_0x1601('0x21')](removeEntity(_0x26ba09,null))['catch'](handleError(_0x26ba09,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d9fb004..4b78266 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 _0x220b=['desk_unique_index','idField','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x30ed7d,_0x4cf76a){var _0x3faa75=function(_0x52191b){while(--_0x52191b){_0x30ed7d['push'](_0x30ed7d['shift']());}};_0x3faa75(++_0x4cf76a);}(_0x220b,0x92));var _0xb220=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x220b[_0xb725be];return _0x2f2424;};'use strict';var _=require(_0xb220('0x0'));var util=require(_0xb220('0x1'));var logger=require(_0xb220('0x2'))(_0xb220('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb220('0x4'));var fs=require('fs');var path=require(_0xb220('0x5'));var rimraf=require(_0xb220('0x6'));var config=require(_0xb220('0x7'));var attributes=require(_0xb220('0x8'));module['exports']=function(_0x7dcfb9,_0x3a1a0e){return _0x7dcfb9[_0xb220('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xb220('0xa'),'fields':[_0xb220('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5165=['path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b7704,_0x20467a){var _0x5bfae9=function(_0x3746a9){while(--_0x3746a9){_0x4b7704['push'](_0x4b7704['shift']());}};_0x5bfae9(++_0x20467a);}(_0x5165,0x10a));var _0x5516=function(_0x3a05ec,_0x243522){_0x3a05ec=_0x3a05ec-0x0;var _0x241c7f=_0x5165[_0x3a05ec];return _0x241c7f;};'use strict';var _=require(_0x5516('0x0'));var util=require('util');var logger=require(_0x5516('0x1'))(_0x5516('0x2'));var moment=require(_0x5516('0x3'));var BPromise=require(_0x5516('0x4'));var rp=require(_0x5516('0x5'));var fs=require('fs');var path=require(_0x5516('0x6'));var rimraf=require(_0x5516('0x7'));var config=require(_0x5516('0x8'));var attributes=require(_0x5516('0x9'));module[_0x5516('0xa')]=function(_0x5ecad2,_0x409da5){return _0x5ecad2['define'](_0x5516('0xb'),attributes,{'tableName':_0x5516('0xc'),'paranoid':![],'indexes':[{'name':_0x5516('0xd'),'fields':[_0x5516('0xe'),_0x5516('0xf')],'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 a96fa0a..61c933a 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 _0x7240=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskField,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7240,0x18e));var _0x0724=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7240[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0724('0x0'));var util=require(_0x0724('0x1'));var moment=require(_0x0724('0x2'));var BPromise=require('bluebird');var rs=require(_0x0724('0x3'));var fs=require('fs');var Redis=require(_0x0724('0x4'));var db=require(_0x0724('0x5'))['db'];var utils=require(_0x0724('0x6'));var logger=require('../../config/logger')(_0x0724('0x7'));var config=require(_0x0724('0x8'));var jayson=require(_0x0724('0x9'));var client=jayson['client'][_0x0724('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8e5da8,_0x3bab3f,_0x41ad80){return new BPromise(function(_0x51d6a0,_0x3ca9a0){return client[_0x0724('0xb')](_0x8e5da8,_0x41ad80)[_0x0724('0xc')](function(_0x5765f2){logger[_0x0724('0xd')]('DeskField,\x20%s,\x20%s',_0x3bab3f,'request\x20sent');logger['debug'](_0x0724('0xe'),_0x3bab3f,_0x0724('0xf'),JSON['stringify'](_0x5765f2));if(_0x5765f2['error']){if(_0x5765f2[_0x0724('0x10')][_0x0724('0x11')]===0x1f4){logger[_0x0724('0x10')](_0x0724('0x12'),_0x3bab3f,_0x5765f2[_0x0724('0x10')][_0x0724('0x13')]);return _0x3ca9a0(_0x5765f2['error'][_0x0724('0x13')]);}logger['error'](_0x0724('0x12'),_0x3bab3f,_0x5765f2['error'][_0x0724('0x13')]);return _0x51d6a0(_0x5765f2[_0x0724('0x10')][_0x0724('0x13')]);}else{logger[_0x0724('0xd')](_0x0724('0x12'),_0x3bab3f,'request\x20sent');_0x51d6a0(_0x5765f2['result'][_0x0724('0x13')]);}})[_0x0724('0x14')](function(_0x100161){logger[_0x0724('0x10')](_0x0724('0x12'),_0x3bab3f,_0x100161);_0x3ca9a0(_0x100161);});});} \ No newline at end of file +var _0x51e8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util'];(function(_0x1944c9,_0x1903c0){var _0x9a7545=function(_0x199b8b){while(--_0x199b8b){_0x1944c9['push'](_0x1944c9['shift']());}};_0x9a7545(++_0x1903c0);}(_0x51e8,0x1a2));var _0x851e=function(_0x345bef,_0x1d8140){_0x345bef=_0x345bef-0x0;var _0x575a2d=_0x51e8[_0x345bef];return _0x575a2d;};'use strict';var _=require(_0x851e('0x0'));var util=require(_0x851e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x851e('0x2'));var fs=require('fs');var Redis=require(_0x851e('0x3'));var db=require(_0x851e('0x4'))['db'];var utils=require(_0x851e('0x5'));var logger=require(_0x851e('0x6'))('rpc');var config=require(_0x851e('0x7'));var jayson=require(_0x851e('0x8'));var client=jayson[_0x851e('0x9')][_0x851e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x509831,_0x51e4ab,_0xad016f){return new BPromise(function(_0x3d616f,_0x4b4639){return client[_0x851e('0xb')](_0x509831,_0xad016f)[_0x851e('0xc')](function(_0x2a1f4c){logger[_0x851e('0xd')](_0x851e('0xe'),_0x51e4ab,_0x851e('0xf'));logger['debug'](_0x851e('0x10'),_0x51e4ab,'request\x20sent',JSON['stringify'](_0x2a1f4c));if(_0x2a1f4c[_0x851e('0x11')]){if(_0x2a1f4c[_0x851e('0x11')][_0x851e('0x12')]===0x1f4){logger[_0x851e('0x11')](_0x851e('0xe'),_0x51e4ab,_0x2a1f4c[_0x851e('0x11')][_0x851e('0x13')]);return _0x4b4639(_0x2a1f4c[_0x851e('0x11')][_0x851e('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x51e4ab,_0x2a1f4c[_0x851e('0x11')][_0x851e('0x13')]);return _0x3d616f(_0x2a1f4c['error']['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x51e4ab,_0x851e('0xf'));_0x3d616f(_0x2a1f4c['result'][_0x851e('0x13')]);}})[_0x851e('0x14')](function(_0x2a0ae7){logger[_0x851e('0x11')](_0x851e('0xe'),_0x51e4ab,_0x2a0ae7);_0x4b4639(_0x2a0ae7);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c358223..929ed78 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 _0x85f9=['isAuthenticated','index','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller'];(function(_0xc298fe,_0x53be01){var _0x2096d3=function(_0x27d6b6){while(--_0x27d6b6){_0xc298fe['push'](_0xc298fe['shift']());}};_0x2096d3(++_0x53be01);}(_0x85f9,0x1c0));var _0x985f=function(_0x13d587,_0xd080b){_0x13d587=_0x13d587-0x0;var _0x34f8c7=_0x85f9[_0x13d587];return _0x34f8c7;};'use strict';var multer=require(_0x985f('0x0'));var util=require(_0x985f('0x1'));var path=require(_0x985f('0x2'));var timeout=require(_0x985f('0x3'));var express=require(_0x985f('0x4'));var router=express[_0x985f('0x5')]();var fs_extra=require(_0x985f('0x6'));var auth=require(_0x985f('0x7'));var interaction=require(_0x985f('0x8'));var config=require(_0x985f('0x9'));var controller=require(_0x985f('0xa'));router['get']('/',auth[_0x985f('0xb')](),controller[_0x985f('0xc')]);router['get']('/:id',auth[_0x985f('0xb')](),controller[_0x985f('0xd')]);router[_0x985f('0xe')](_0x985f('0xf'),auth[_0x985f('0xb')](),controller[_0x985f('0x10')]);router['get'](_0x985f('0x11'),auth[_0x985f('0xb')](),controller[_0x985f('0x12')]);router[_0x985f('0x13')]('/',auth[_0x985f('0xb')](),controller[_0x985f('0x14')]);router[_0x985f('0x13')](_0x985f('0xf'),auth[_0x985f('0xb')](),controller[_0x985f('0x15')]);router[_0x985f('0x16')]('/:id',auth[_0x985f('0xb')](),controller['update']);router[_0x985f('0x17')](_0x985f('0x18'),auth[_0x985f('0xb')](),controller[_0x985f('0x19')]);module[_0x985f('0x1a')]=router; \ No newline at end of file +var _0x603d=['/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x22efab,_0x5e1a4c){var _0x361bab=function(_0x3a16eb){while(--_0x3a16eb){_0x22efab['push'](_0x22efab['shift']());}};_0x361bab(++_0x5e1a4c);}(_0x603d,0x1f1));var _0xd603=function(_0xfb534f,_0x1ea5e7){_0xfb534f=_0xfb534f-0x0;var _0x3c42eb=_0x603d[_0xfb534f];return _0x3c42eb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd603('0x0'));var timeout=require(_0xd603('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd603('0x2'));var interaction=require(_0xd603('0x3'));var config=require(_0xd603('0x4'));var controller=require('./intDynamics365Account.controller');router[_0xd603('0x5')]('/',auth[_0xd603('0x6')](),controller['index']);router[_0xd603('0x5')](_0xd603('0x7'),auth[_0xd603('0x6')](),controller[_0xd603('0x8')]);router[_0xd603('0x5')](_0xd603('0x9'),auth[_0xd603('0x6')](),controller['getConfigurations']);router[_0xd603('0x5')](_0xd603('0xa'),auth[_0xd603('0x6')](),controller[_0xd603('0xb')]);router[_0xd603('0xc')]('/',auth[_0xd603('0x6')](),controller[_0xd603('0xd')]);router[_0xd603('0xc')]('/:id/configurations',auth[_0xd603('0x6')](),controller['addConfiguration']);router[_0xd603('0xe')]('/:id',auth[_0xd603('0x6')](),controller[_0xd603('0xf')]);router['delete']('/:id',auth[_0xd603('0x6')](),controller[_0xd603('0x10')]);module[_0xd603('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 432b4db..ed1f3ea 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 _0x1b69=['STRING','BOOLEAN'];(function(_0x341d5d,_0x18af43){var _0x43aeea=function(_0x12a6ce){while(--_0x12a6ce){_0x341d5d['push'](_0x341d5d['shift']());}};_0x43aeea(++_0x18af43);}(_0x1b69,0x190));var _0x91b6=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x1b69[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x91b6('0x0')]},'password':{'type':Sequelize[_0x91b6('0x0')]},'remoteUri':{'type':Sequelize[_0x91b6('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x91b6('0x0')]},'clientSecret':{'type':Sequelize[_0x91b6('0x0')]},'serverUrl':{'type':Sequelize[_0x91b6('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x91b6('0x0')]},'modernAuthentication':{'type':Sequelize[_0x91b6('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaeab=['BOOLEAN','sequelize','STRING'];(function(_0x5844c6,_0x35eab6){var _0x383ec2=function(_0x124def){while(--_0x124def){_0x5844c6['push'](_0x5844c6['shift']());}};_0x383ec2(++_0x35eab6);}(_0xaeab,0x91));var _0xbaea=function(_0x3d4360,_0x5ca504){_0x3d4360=_0x3d4360-0x0;var _0x2f1095=_0xaeab[_0x3d4360];return _0x2f1095;};'use strict';var Sequelize=require(_0xbaea('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaea('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xbaea('0x1')]},'remoteUri':{'type':Sequelize[_0xbaea('0x1')]},'tenantId':{'type':Sequelize[_0xbaea('0x1')]},'clientId':{'type':Sequelize[_0xbaea('0x1')]},'clientSecret':{'type':Sequelize[_0xbaea('0x1')]},'serverUrl':{'type':Sequelize[_0xbaea('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xbaea('0x1')]},'modernAuthentication':{'type':Sequelize[_0xbaea('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 f3ef2b6..62b14bf 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 _0xc627=['order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','params','keys','options','catch','create','body','find','findOne','Dynamics365Configuration','pick','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','PhoneCall','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyname','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','data5','data7','access_token','CloudProvider','POST','https://login.microsoftonline.com/','/oauth2/token','GET','4.0','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','all','isNil','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','statusCode','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','update','destroy','then','end','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3936b8,_0x3c7bf0){var _0x4a82f6=function(_0x374f78){while(--_0x374f78){_0x3936b8['push'](_0x3936b8['shift']());}};_0x4a82f6(++_0x3c7bf0);}(_0xc627,0x90));var _0x7c62=function(_0x172d64,_0x3a087b){_0x172d64=_0x172d64-0x0;var _0x21f968=_0xc627[_0x172d64];return _0x21f968;};'use strict';var rp=require(_0x7c62('0x0'));var util=require(_0x7c62('0x1'));var _=require(_0x7c62('0x2'));var qs=require(_0x7c62('0x3'));var logger=require(_0x7c62('0x4'))(_0x7c62('0x5'));var db=require(_0x7c62('0x6'))['db'];var integrations=require(_0x7c62('0x7'));function respondWithResult(_0x27229b,_0x63634f){_0x63634f=_0x63634f||0xc8;return function(_0x20e737){if(_0x20e737){return _0x27229b[_0x7c62('0x8')](_0x63634f)[_0x7c62('0x9')](_0x20e737);}};}function respondWithFilteredResult(_0x1a8740,_0x376b5b){return function(_0x4e378a){if(_0x4e378a){var _0x7f9ee4=typeof _0x376b5b[_0x7c62('0xa')]===_0x7c62('0xb')&&typeof _0x376b5b[_0x7c62('0xc')]===_0x7c62('0xb');var _0x3f7683=_0x4e378a[_0x7c62('0xd')];var _0x587d73=_0x7f9ee4?0x0:_0x376b5b['offset'];var _0x26bb16=_0x7f9ee4?_0x4e378a[_0x7c62('0xd')]:_0x376b5b['offset']+_0x376b5b[_0x7c62('0xc')];var _0x413f2d;if(_0x26bb16>=_0x3f7683){_0x26bb16=_0x3f7683;_0x413f2d=0xc8;}else{_0x413f2d=0xce;}_0x1a8740[_0x7c62('0x8')](_0x413f2d);return _0x1a8740['set']('Content-Range',_0x587d73+'-'+_0x26bb16+'/'+_0x3f7683)[_0x7c62('0x9')](_0x4e378a);}return null;};}function saveUpdates(_0x5efd7b){return function(_0x26173d){if(_0x26173d){return _0x26173d[_0x7c62('0xe')](_0x5efd7b)['then'](function(_0x36afcc){return _0x36afcc;});}return null;};}function removeEntity(_0x29dbcd){return function(_0x15f897){if(_0x15f897){return _0x15f897[_0x7c62('0xf')]()[_0x7c62('0x10')](function(){_0x29dbcd[_0x7c62('0x8')](0xcc)[_0x7c62('0x11')]();});}};}function handleEntityNotFound(_0x469dc4){return function(_0x1768da){if(!_0x1768da){_0x469dc4['sendStatus'](0x194);}return _0x1768da;};}function handleError(_0x243ec6,_0xd47f01){_0xd47f01=_0xd47f01||0x1f4;return function(_0x5b80c4){logger['error'](_0x5b80c4[_0x7c62('0x12')]);if(_0x5b80c4[_0x7c62('0x13')]){delete _0x5b80c4['name'];}_0x243ec6[_0x7c62('0x8')](_0xd47f01)['send'](_0x5b80c4);};}exports['index']=function(_0x59e5cd,_0x28c826){var _0xd1c47e={},_0xc2c933={},_0xd2f7c7={'count':0x0,'rows':[]};var _0x415401=_[_0x7c62('0x14')](db[_0x7c62('0x15')][_0x7c62('0x16')],function(_0x1f3a14){return{'name':_0x1f3a14[_0x7c62('0x17')],'type':_0x1f3a14[_0x7c62('0x18')][_0x7c62('0x19')]};});_0xc2c933[_0x7c62('0x1a')]=_[_0x7c62('0x14')](_0x415401,_0x7c62('0x13'));_0xc2c933[_0x7c62('0x1b')]=_['keys'](_0x59e5cd[_0x7c62('0x1b')]);_0xc2c933[_0x7c62('0x1c')]=_[_0x7c62('0x1d')](_0xc2c933[_0x7c62('0x1a')],_0xc2c933[_0x7c62('0x1b')]);_0xd1c47e[_0x7c62('0x1e')]=_[_0x7c62('0x1d')](_0xc2c933[_0x7c62('0x1a')],qs[_0x7c62('0x1f')](_0x59e5cd[_0x7c62('0x1b')]['fields']));_0xd1c47e['attributes']=_0xd1c47e['attributes'][_0x7c62('0x20')]?_0xd1c47e[_0x7c62('0x1e')]:_0xc2c933[_0x7c62('0x1a')];if(!_0x59e5cd[_0x7c62('0x1b')][_0x7c62('0x21')](_0x7c62('0x22'))){_0xd1c47e[_0x7c62('0xc')]=qs[_0x7c62('0xc')](_0x59e5cd['query']['limit']);_0xd1c47e[_0x7c62('0xa')]=qs[_0x7c62('0xa')](_0x59e5cd[_0x7c62('0x1b')]['offset']);}_0xd1c47e[_0x7c62('0x23')]=qs[_0x7c62('0x24')](_0x59e5cd[_0x7c62('0x1b')][_0x7c62('0x24')]);_0xd1c47e[_0x7c62('0x25')]=qs[_0x7c62('0x1c')](_['pick'](_0x59e5cd[_0x7c62('0x1b')],_0xc2c933[_0x7c62('0x1c')]),_0x415401);if(_0x59e5cd[_0x7c62('0x1b')][_0x7c62('0x26')]){_0xd1c47e[_0x7c62('0x25')]=_[_0x7c62('0x27')](_0xd1c47e[_0x7c62('0x25')],{'$or':_[_0x7c62('0x14')](_0x415401,function(_0xefcac7){if(_0xefcac7[_0x7c62('0x18')]!==_0x7c62('0x28')){var _0x1b8fd0={};_0x1b8fd0[_0xefcac7['name']]={'$like':'%'+_0x59e5cd[_0x7c62('0x1b')][_0x7c62('0x26')]+'%'};return _0x1b8fd0;}})});}_0xd1c47e=_[_0x7c62('0x27')]({},_0xd1c47e,_0x59e5cd['options']);var _0x31b803={'where':_0xd1c47e[_0x7c62('0x25')]};return db['Dynamics365Account']['count'](_0x31b803)['then'](function(_0x32b89e){_0xd2f7c7[_0x7c62('0xd')]=_0x32b89e;if(_0x59e5cd[_0x7c62('0x1b')][_0x7c62('0x29')]){_0xd1c47e[_0x7c62('0x2a')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0xd1c47e);})['then'](function(_0x393531){_0xd2f7c7[_0x7c62('0x2b')]=_0x393531;return _0xd2f7c7;})[_0x7c62('0x10')](respondWithFilteredResult(_0x28c826,_0xd1c47e))['catch'](handleError(_0x28c826,null));};exports['show']=function(_0x2f9709,_0x8b7768){var _0x1203bf={'raw':![],'where':{'id':_0x2f9709[_0x7c62('0x2c')]['id']}},_0x2ede8b={};_0x2ede8b[_0x7c62('0x1a')]=_[_0x7c62('0x2d')](db[_0x7c62('0x15')]['rawAttributes']);_0x2ede8b[_0x7c62('0x1b')]=_[_0x7c62('0x2d')](_0x2f9709['query']);_0x2ede8b[_0x7c62('0x1c')]=_['intersection'](_0x2ede8b[_0x7c62('0x1a')],_0x2ede8b[_0x7c62('0x1b')]);_0x1203bf['attributes']=_['intersection'](_0x2ede8b['model'],qs[_0x7c62('0x1f')](_0x2f9709['query'][_0x7c62('0x1f')]));_0x1203bf[_0x7c62('0x1e')]=_0x1203bf['attributes']['length']?_0x1203bf[_0x7c62('0x1e')]:_0x2ede8b[_0x7c62('0x1a')];if(_0x2f9709[_0x7c62('0x1b')][_0x7c62('0x29')]){_0x1203bf[_0x7c62('0x2a')]=[{'all':!![]}];}_0x1203bf=_[_0x7c62('0x27')]({},_0x1203bf,_0x2f9709[_0x7c62('0x2e')]);return db[_0x7c62('0x15')]['find'](_0x1203bf)['then'](handleEntityNotFound(_0x8b7768,null))[_0x7c62('0x10')](respondWithResult(_0x8b7768,null))[_0x7c62('0x2f')](handleError(_0x8b7768,null));};exports[_0x7c62('0x30')]=function(_0x3abbf2,_0x3e4a87){return db[_0x7c62('0x15')][_0x7c62('0x30')](_0x3abbf2[_0x7c62('0x31')],{})['then'](respondWithResult(_0x3e4a87,0xc9))[_0x7c62('0x2f')](handleError(_0x3e4a87,null));};exports[_0x7c62('0xe')]=function(_0x1001c6,_0x3f0b5f){if(_0x1001c6[_0x7c62('0x31')]['id']){delete _0x1001c6[_0x7c62('0x31')]['id'];}return db['Dynamics365Account'][_0x7c62('0x32')]({'where':{'id':_0x1001c6['params']['id']}})[_0x7c62('0x10')](handleEntityNotFound(_0x3f0b5f,null))[_0x7c62('0x10')](saveUpdates(_0x1001c6[_0x7c62('0x31')],null))[_0x7c62('0x10')](respondWithResult(_0x3f0b5f,null))[_0x7c62('0x2f')](handleError(_0x3f0b5f,null));};exports[_0x7c62('0xf')]=function(_0x1301a6,_0x2feec0){return db['Dynamics365Account'][_0x7c62('0x32')]({'where':{'id':_0x1301a6[_0x7c62('0x2c')]['id']}})[_0x7c62('0x10')](handleEntityNotFound(_0x2feec0,null))[_0x7c62('0x10')](removeEntity(_0x2feec0,null))[_0x7c62('0x2f')](handleError(_0x2feec0,null));};exports['getConfigurations']=function(_0x2d52d7,_0x464632){var _0x1eb5ff={};var _0x49e9e5={};var _0x488cd5;var _0x200ab9;return db['Dynamics365Account'][_0x7c62('0x33')]({'where':{'id':_0x2d52d7[_0x7c62('0x2c')]['id']}})[_0x7c62('0x10')](handleEntityNotFound(_0x464632,null))[_0x7c62('0x10')](function(_0x3dd48b){if(_0x3dd48b){_0x488cd5=_0x3dd48b;_0x49e9e5['model']=_['keys'](db[_0x7c62('0x34')][_0x7c62('0x16')]);_0x49e9e5['query']=_[_0x7c62('0x2d')](_0x2d52d7[_0x7c62('0x1b')]);_0x49e9e5[_0x7c62('0x1c')]=_[_0x7c62('0x1d')](_0x49e9e5[_0x7c62('0x1a')],_0x49e9e5[_0x7c62('0x1b')]);_0x1eb5ff[_0x7c62('0x1e')]=_['intersection'](_0x49e9e5['model'],qs[_0x7c62('0x1f')](_0x2d52d7['query']['fields']));_0x1eb5ff['attributes']=_0x1eb5ff[_0x7c62('0x1e')]['length']?_0x1eb5ff['attributes']:_0x49e9e5[_0x7c62('0x1a')];_0x1eb5ff[_0x7c62('0x23')]=qs[_0x7c62('0x24')](_0x2d52d7[_0x7c62('0x1b')][_0x7c62('0x24')]);_0x1eb5ff['where']=qs[_0x7c62('0x1c')](_[_0x7c62('0x35')](_0x2d52d7['query'],_0x49e9e5[_0x7c62('0x1c')]));if(_0x2d52d7[_0x7c62('0x1b')][_0x7c62('0x26')]){_0x1eb5ff['where']=_[_0x7c62('0x27')](_0x1eb5ff[_0x7c62('0x25')],{'$or':_['map'](_0x1eb5ff['attributes'],function(_0xee1024){var _0x4ee884={};_0x4ee884[_0xee1024]={'$like':'%'+_0x2d52d7[_0x7c62('0x1b')]['filter']+'%'};return _0x4ee884;})});}_0x1eb5ff=_[_0x7c62('0x27')]({},_0x1eb5ff,_0x2d52d7[_0x7c62('0x2e')]);return _0x488cd5['getConfigurations'](_0x1eb5ff);}})['then'](function(_0x4b4c3a){if(_0x4b4c3a){_0x200ab9=_0x4b4c3a['length'];if(!_0x2d52d7[_0x7c62('0x1b')][_0x7c62('0x21')](_0x7c62('0x22'))){_0x1eb5ff[_0x7c62('0xc')]=qs[_0x7c62('0xc')](_0x2d52d7[_0x7c62('0x1b')]['limit']);_0x1eb5ff['offset']=qs[_0x7c62('0xa')](_0x2d52d7[_0x7c62('0x1b')]['offset']);}return _0x488cd5['getConfigurations'](_0x1eb5ff);}})['then'](function(_0x313ec5){if(_0x313ec5){return _0x313ec5?{'count':_0x200ab9,'rows':_0x313ec5}:null;}})[_0x7c62('0x10')](respondWithResult(_0x464632,null))[_0x7c62('0x2f')](handleError(_0x464632,null));};exports[_0x7c62('0x36')]=function(_0x3cd5ec,_0x8cf6eb){if(_0x3cd5ec['body']['id']){delete _0x3cd5ec[_0x7c62('0x31')]['id'];}return db['Dynamics365Account'][_0x7c62('0x33')]({'where':{'id':_0x3cd5ec[_0x7c62('0x2c')]['id']}})[_0x7c62('0x10')](handleEntityNotFound(_0x8cf6eb,null))['then'](function(_0x1cd314){if(_0x1cd314){_0x3cd5ec[_0x7c62('0x31')][_0x7c62('0x37')]=_0x1cd314['id'];_0x3cd5ec[_0x7c62('0x31')][_0x7c62('0x38')]=integrations['getSubjects'](_0x3cd5ec['body']['channel'],_0x3cd5ec[_0x7c62('0x31')][_0x7c62('0x18')]);_0x3cd5ec[_0x7c62('0x31')][_0x7c62('0x39')]=integrations[_0x7c62('0x3a')](_0x3cd5ec['body'][_0x7c62('0x3b')],_0x3cd5ec[_0x7c62('0x31')]['type']);return db[_0x7c62('0x34')][_0x7c62('0x30')](_0x3cd5ec[_0x7c62('0x31')],{'include':[{'model':db[_0x7c62('0x3c')],'as':_0x7c62('0x38')},{'model':db[_0x7c62('0x3c')],'as':_0x7c62('0x39')}]});}return null;})[_0x7c62('0x10')](respondWithResult(_0x8cf6eb,null))[_0x7c62('0x2f')](handleError(_0x8cf6eb,null));};function sanitizeRemoteUri(_0x3a4194){var _0x51f0c1=_0x3a4194[_0x7c62('0x3d')](-0x1);if(_0x51f0c1==='/')return _0x3a4194[_0x7c62('0x3e')](0x0,_0x3a4194[_0x7c62('0x3f')](_0x51f0c1));return _0x3a4194;}function getWebApiUrl(_0x395f5b){return util[_0x7c62('0x40')](_0x7c62('0x41'),_0x395f5b);}exports[_0x7c62('0x42')]=function(_0x229239,_0x4d986b){var _0xf5d57=_0x229239[_0x7c62('0x1b')][_0x7c62('0x43')];var _0x1d2180=_0xf5d57===_0x7c62('0x44')?'Incident':_0x7c62('0x45');var _0x4c387b='';var _0x261cd0='';var _0x540859='';var _0x414015='';var _0x538693='';var _0xfb8374='';var _0x2fcd78='';var _0x3418b7='';var _0x3bf139=['title','description','customerid',_0x7c62('0x46'),_0x7c62('0x47'),_0x7c62('0x48'),_0x7c62('0x49'),_0x7c62('0x4a'),'directioncode',_0x7c62('0x4b')];var _0x16b235=['accountidname',_0x7c62('0x4c'),_0x7c62('0x4d'),_0x7c62('0x4e'),'contactidname',_0x7c62('0x4f'),_0x7c62('0x50'),_0x7c62('0x51'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x7c62('0x52'),'createdbyyominame',_0x7c62('0x53'),_0x7c62('0x54'),'createdonbehalfbyyominame',_0x7c62('0x55'),_0x7c62('0x56'),_0x7c62('0x57'),'emailaddress',_0x7c62('0x58'),_0x7c62('0x59'),'entityimage_url',_0x7c62('0x5a'),_0x7c62('0x5b'),_0x7c62('0x5c'),_0x7c62('0x5d'),_0x7c62('0x5e'),_0x7c62('0x5f'),_0x7c62('0x60'),_0x7c62('0x61'),'masteridname','modifiedbyexternalpartyname',_0x7c62('0x62'),'modifiedbyname','modifiedbyyominame',_0x7c62('0x63'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x7c62('0x64'),_0x7c62('0x65'),'numberofchildincidents',_0x7c62('0x66'),'overriddencreatedon',_0x7c62('0x67'),_0x7c62('0x68'),_0x7c62('0x69'),_0x7c62('0x6a'),'primarycontactidname',_0x7c62('0x6b'),_0x7c62('0x6c'),_0x7c62('0x6d'),'productserialnumber',_0x7c62('0x6e'),_0x7c62('0x6f'),_0x7c62('0x70'),'responsiblecontactidname',_0x7c62('0x71'),_0x7c62('0x72'),_0x7c62('0x73'),_0x7c62('0x74'),_0x7c62('0x75'),_0x7c62('0x76'),_0x7c62('0x77'),_0x7c62('0x78'),_0x7c62('0x79'),_0x7c62('0x7a'),_0x7c62('0x7b'),_0x7c62('0x7c'),'utcconversiontimezonecode',_0x7c62('0x7d')];var _0x187e1f=_0x3bf139[_0x7c62('0x7e')](_0x16b235);return db[_0x7c62('0x15')]['findOne']({'where':{'id':_0x229239[_0x7c62('0x2c')]['id']},'attributes':['id',_0x7c62('0x7f'),_0x7c62('0x80'),_0x7c62('0x81'),_0x7c62('0x82'),_0x7c62('0x83'),_0x7c62('0x84'),_0x7c62('0x85')],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','attributes':['id',_0x7c62('0x86'),_0x7c62('0x87')]}]})[_0x7c62('0x10')](handleEntityNotFound(_0x4d986b,null))[_0x7c62('0x10')](function(_0x7e52b2){if(_0x7e52b2){if(_0x7e52b2['modernAuthentication']){_0x7e52b2[_0x7c62('0x88')]=_0x7e52b2[_0x7c62('0x89')][_0x7c62('0x86')];_0x3418b7=sanitizeRemoteUri(_0x7e52b2[_0x7c62('0x89')][_0x7c62('0x87')]);_0x2fcd78=getWebApiUrl(_0x3418b7);return _0x7e52b2;}_0x3418b7=sanitizeRemoteUri(_0x7e52b2['remoteUri']);_0x2fcd78=getWebApiUrl(_0x3418b7);var _0x2efdbe={'method':_0x7c62('0x8a'),'uri':_0x7c62('0x8b')+_0x7e52b2[_0x7c62('0x82')]+_0x7c62('0x8c'),'form':{'client_id':_0x7e52b2[_0x7c62('0x83')],'resource':_0x3418b7,'username':_0x7e52b2[_0x7c62('0x7f')],'password':_0x7e52b2[_0x7c62('0x80')],'grant_type':_0x7c62('0x80'),'client_secret':_0x7e52b2[_0x7c62('0x84')]},'json':!![]};return rp(_0x2efdbe);}})[_0x7c62('0x10')](function(_0x5d3804){_0xfb8374=_0x5d3804[_0x7c62('0x88')];var _0x3ae728={'method':_0x7c62('0x8d'),'uri':encodeURI(_0x2fcd78+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x1d2180+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xfb8374,'If-None-Match':null,'OData-Version':_0x7c62('0x8e')},'json':!![]};return rp(_0x3ae728);})['then'](function(_0x3fd514){var _0x414cb6=_0x3fd514['value'][0x0];var _0x2afb40=_0x414cb6['MetadataId'];var _0x15ab8e={'method':'GET','uri':_0x2fcd78+_0x7c62('0x8f')+_0x2afb40+_0x7c62('0x90'),'headers':{'Authorization':_0x7c62('0x91')+_0xfb8374,'If-None-Match':null,'OData-Version':_0x7c62('0x8e')},'json':!![]};return rp(_0x15ab8e);})[_0x7c62('0x10')](function(_0x2116dd){_0x4c387b=_0x2116dd;_0x261cd0=_0x4c387b['Attributes'];_0x261cd0=_[_0x7c62('0x92')](_0x261cd0,function(_0xdf685){return!_0x187e1f[_0x7c62('0x93')](_0xdf685[_0x7c62('0x94')]);});var _0xe5763a=[];var _0x12103a=[];_0x261cd0['forEach'](function(_0x254a83){if(_0x254a83[_0x7c62('0x95')]){var _0x3d9b5e=_0x254a83[_0x7c62('0x95')][_0x7c62('0x3e')](_0x254a83[_0x7c62('0x95')][_0x7c62('0x3f')]('.')+0x1);if(_0x3d9b5e===_0x7c62('0x96')){_0xe5763a[_0x7c62('0x97')](getSelectList(_0x2fcd78,_0xf5d57,_0x12103a,_0x4c387b[_0x7c62('0x98')],_0x254a83[_0x7c62('0x98')],_0xfb8374));}}});return Promise[_0x7c62('0x99')](_0xe5763a);})['then'](function(_0x16dd94){_0x540859=_0x16dd94[0x0];var _0xa62e9f=[];var _0x2a1b97=[];_0x261cd0['forEach'](function(_0x3261dd){if(!_[_0x7c62('0x9a')](_0x3261dd[_0x7c62('0x95')])){var _0x3d2856=_0x3261dd['@odata.type']['substring'](_0x3261dd[_0x7c62('0x95')][_0x7c62('0x3f')]('.')+0x1);if(_0x3d2856==='BooleanAttributeMetadata'){_0xa62e9f['push'](getBooleanList(_0x2fcd78,_0xf5d57,_0x2a1b97,_0x4c387b[_0x7c62('0x98')],_0x3261dd[_0x7c62('0x98')],_0xfb8374));}}});return Promise[_0x7c62('0x99')](_0xa62e9f);})['then'](function(_0x466ec0){_0x414015=_0x466ec0[0x0];var _0x4efce4=[];var _0x247827=[];_0x261cd0[_0x7c62('0x9b')](function(_0xc4649d){if(_0xc4649d[_0x7c62('0x95')]){var _0x384219=_0xc4649d[_0x7c62('0x95')][_0x7c62('0x3e')](_0xc4649d[_0x7c62('0x95')][_0x7c62('0x3f')]('.')+0x1);if(_0x384219==='StringAttributeMetadata'||_0x384219===_0x7c62('0x9c')||_0x384219===_0x7c62('0x9d')||_0x384219==='IntegerAttributeMetadata'||_0x384219===_0x7c62('0x9e')||_0x384219==='DateTimeAttributeMetadata'||_0x384219===_0x7c62('0x9f')||_0x384219==='EntityNameAttributeMetadata'||_0x384219===_0x7c62('0xa0')||_0x384219==='DecimalAttributeMetadata'){_0x4efce4[_0x7c62('0x97')](getInputList(_0x2fcd78,_0xf5d57,_0x384219,_0x247827,_0x4c387b[_0x7c62('0x98')],_0xc4649d[_0x7c62('0x98')],_0xfb8374));}}});return Promise['all'](_0x4efce4);})[_0x7c62('0x10')](function(_0x3b9c51){_0x538693=_0x3b9c51[0x0];var _0x26a874=_0x540859[_0x7c62('0x7e')](_0x414015)[_0x7c62('0x7e')](_0x538693);var _0x20583d={'count':_0x26a874[_0x7c62('0x20')],'rows':_0x26a874};return _0x20583d;})['then'](respondWithResult(_0x4d986b,null))[_0x7c62('0x2f')](function(_0x51370d){var _0x54fc8a=_0x229239[_0x7c62('0x1b')]['test']?0x1f4:_0x51370d[_0x7c62('0xa1')]||0x1f4;logger['error'](_0x51370d[_0x7c62('0x12')]);delete _0x51370d[_0x7c62('0x13')];if(_0x54fc8a===0x191){_0x54fc8a=0x190;}_0x4d986b[_0x7c62('0x8')](_0x54fc8a)['send'](_0x229239[_0x7c62('0x1b')][_0x7c62('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x51370d[_0x7c62('0xa1')]}:_0x51370d);});};function getSelectList(_0x325a80,_0x2154cf,_0x15c893,_0xd3b70a,_0x15125f,_0x442865){var _0x3dc181={'method':_0x7c62('0x8d'),'uri':_0x325a80+'EntityDefinitions('+_0xd3b70a+')/Attributes('+_0x15125f+_0x7c62('0xa3')+_0x7c62('0xa4'),'headers':{'Authorization':_0x7c62('0x91')+_0x442865,'If-None-Match':null,'OData-Version':_0x7c62('0x8e')},'json':!![]};return rp(_0x3dc181)[_0x7c62('0x10')](function(_0x4ce983){var _0x2323dd=[];var _0x3b7194=_0x4ce983[_0x7c62('0xa5')][_0x7c62('0xa6')];_0x3b7194[_0x7c62('0x9b')](function(_0x1884d1){_0x2323dd[_0x7c62('0x97')]({'name':_0x1884d1[_0x7c62('0xa7')][_0x7c62('0xa8')][_0x7c62('0xa7')],'value':String(_0x1884d1[_0x7c62('0xa9')])});});var _0x171e9b={'id':_0x2154cf+'_'+_0x4ce983[_0x7c62('0x94')],'name':_0x4ce983[_0x7c62('0xaa')][_0x7c62('0xa8')][_0x7c62('0xa7')],'custom':![],'options':_0x2323dd};_0x15c893[_0x7c62('0x97')](_0x171e9b);return _0x15c893;});}function getBooleanList(_0x3304d4,_0x219893,_0x3c24aa,_0x3f3541,_0x34a9d7,_0x385e6f){var _0x18aaa0={'method':_0x7c62('0x8d'),'uri':_0x3304d4+'EntityDefinitions('+_0x3f3541+_0x7c62('0xab')+_0x34a9d7+_0x7c62('0xac'),'headers':{'Authorization':_0x7c62('0x91')+_0x385e6f,'If-None-Match':null,'OData-Version':_0x7c62('0x8e')},'json':!![]};return rp(_0x18aaa0)[_0x7c62('0x10')](function(_0x3cc0c7){var _0x2d42c8=[];_0x2d42c8[_0x7c62('0x97')]({'name':_0x3cc0c7[_0x7c62('0xa5')][_0x7c62('0xad')][_0x7c62('0xa7')][_0x7c62('0xa8')][_0x7c62('0xa7')],'value':_0x7c62('0xae')},{'name':_0x3cc0c7[_0x7c62('0xa5')][_0x7c62('0xaf')][_0x7c62('0xa7')][_0x7c62('0xa8')][_0x7c62('0xa7')],'value':_0x7c62('0xb0')});var _0x173b03={'id':_0x219893+'_'+_0x3cc0c7[_0x7c62('0x94')],'name':_0x3cc0c7['DisplayName']['UserLocalizedLabel'][_0x7c62('0xa7')],'custom':![],'options':_0x2d42c8};_0x3c24aa[_0x7c62('0x97')](_0x173b03);return _0x3c24aa;});}function getInputList(_0x35f234,_0x5b22f0,_0x2a4332,_0x10671f,_0x470c40,_0x1af97e,_0x457f73){var _0x39289f={'method':_0x7c62('0x8d'),'uri':_0x35f234+_0x7c62('0x8f')+_0x470c40+')/Attributes('+_0x1af97e+_0x7c62('0xb1')+_0x2a4332+_0x7c62('0xb2'),'headers':{'Authorization':_0x7c62('0x91')+_0x457f73,'If-None-Match':null,'OData-Version':_0x7c62('0x8e')},'json':!![]};return rp(_0x39289f)[_0x7c62('0x10')](function(_0xb75096){var _0x5a91e7={'id':_0x5b22f0+'_'+_0xb75096[_0x7c62('0x94')],'name':_0xb75096[_0x7c62('0xaa')][_0x7c62('0xa8')]?_0xb75096[_0x7c62('0xaa')]['UserLocalizedLabel'][_0x7c62('0xa7')]:_0xb75096['LogicalName'],'custom':![],'options':[]};_0x10671f['push'](_0x5a91e7);return _0x10671f;});} \ No newline at end of file +var _0xb92a=['json','offset','undefined','count','limit','status','set','update','then','destroy','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','fields','find','catch','create','body','params','getConfigurations','findOne','length','order','pick','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Dynamics365Field','Subjects','slice','lastIndexOf','format','getFields','PhoneCall','description','customerid','subject','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','responseby','responsiblecontactidname','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','UserLocalizedLabel','Label','DisplayName','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration'];(function(_0x5831ec,_0x4fbe49){var _0x4877bf=function(_0x35a5ed){while(--_0x35a5ed){_0x5831ec['push'](_0x5831ec['shift']());}};_0x4877bf(++_0x4fbe49);}(_0xb92a,0xb0));var _0xab92=function(_0x45874c,_0x5dadc4){_0x45874c=_0x45874c-0x0;var _0x55dc8a=_0xb92a[_0x45874c];return _0x55dc8a;};'use strict';var rp=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var _=require(_0xab92('0x2'));var qs=require(_0xab92('0x3'));var logger=require(_0xab92('0x4'))(_0xab92('0x5'));var db=require(_0xab92('0x6'))['db'];var integrations=require(_0xab92('0x7'));function respondWithResult(_0x2fa1bc,_0x5e4eaf){_0x5e4eaf=_0x5e4eaf||0xc8;return function(_0x2c51db){if(_0x2c51db){return _0x2fa1bc['status'](_0x5e4eaf)[_0xab92('0x8')](_0x2c51db);}};}function respondWithFilteredResult(_0x2ddbd8,_0x38f011){return function(_0x54df9c){if(_0x54df9c){var _0x5f39cb=typeof _0x38f011[_0xab92('0x9')]===_0xab92('0xa')&&typeof _0x38f011['limit']===_0xab92('0xa');var _0xe21aa7=_0x54df9c['count'];var _0x471173=_0x5f39cb?0x0:_0x38f011[_0xab92('0x9')];var _0x1c582e=_0x5f39cb?_0x54df9c[_0xab92('0xb')]:_0x38f011[_0xab92('0x9')]+_0x38f011[_0xab92('0xc')];var _0x4dfadf;if(_0x1c582e>=_0xe21aa7){_0x1c582e=_0xe21aa7;_0x4dfadf=0xc8;}else{_0x4dfadf=0xce;}_0x2ddbd8[_0xab92('0xd')](_0x4dfadf);return _0x2ddbd8[_0xab92('0xe')]('Content-Range',_0x471173+'-'+_0x1c582e+'/'+_0xe21aa7)[_0xab92('0x8')](_0x54df9c);}return null;};}function saveUpdates(_0x5ad585){return function(_0x265844){if(_0x265844){return _0x265844[_0xab92('0xf')](_0x5ad585)[_0xab92('0x10')](function(_0x50d46f){return _0x50d46f;});}return null;};}function removeEntity(_0x5793d1){return function(_0x359287){if(_0x359287){return _0x359287[_0xab92('0x11')]()[_0xab92('0x10')](function(){_0x5793d1[_0xab92('0xd')](0xcc)[_0xab92('0x12')]();});}};}function handleEntityNotFound(_0x496d73){return function(_0x41cddf){if(!_0x41cddf){_0x496d73[_0xab92('0x13')](0x194);}return _0x41cddf;};}function handleError(_0xf0c44e,_0x39cac3){_0x39cac3=_0x39cac3||0x1f4;return function(_0xd1d4e9){logger[_0xab92('0x14')](_0xd1d4e9['stack']);if(_0xd1d4e9[_0xab92('0x15')]){delete _0xd1d4e9[_0xab92('0x15')];}_0xf0c44e[_0xab92('0xd')](_0x39cac3)[_0xab92('0x16')](_0xd1d4e9);};}exports[_0xab92('0x17')]=function(_0xc2e8d8,_0x275190){var _0x258397={},_0x4a2d17={},_0x43f249={'count':0x0,'rows':[]};var _0x4f6717=_[_0xab92('0x18')](db[_0xab92('0x19')][_0xab92('0x1a')],function(_0x5a3a7c){return{'name':_0x5a3a7c[_0xab92('0x1b')],'type':_0x5a3a7c[_0xab92('0x1c')][_0xab92('0x1d')]};});_0x4a2d17[_0xab92('0x1e')]=_[_0xab92('0x18')](_0x4f6717,_0xab92('0x15'));_0x4a2d17[_0xab92('0x1f')]=_[_0xab92('0x20')](_0xc2e8d8[_0xab92('0x1f')]);_0x4a2d17['filters']=_[_0xab92('0x21')](_0x4a2d17[_0xab92('0x1e')],_0x4a2d17[_0xab92('0x1f')]);_0x258397[_0xab92('0x22')]=_[_0xab92('0x21')](_0x4a2d17[_0xab92('0x1e')],qs['fields'](_0xc2e8d8[_0xab92('0x1f')]['fields']));_0x258397[_0xab92('0x22')]=_0x258397['attributes']['length']?_0x258397['attributes']:_0x4a2d17[_0xab92('0x1e')];if(!_0xc2e8d8[_0xab92('0x1f')][_0xab92('0x23')](_0xab92('0x24'))){_0x258397[_0xab92('0xc')]=qs[_0xab92('0xc')](_0xc2e8d8[_0xab92('0x1f')][_0xab92('0xc')]);_0x258397['offset']=qs[_0xab92('0x9')](_0xc2e8d8[_0xab92('0x1f')][_0xab92('0x9')]);}_0x258397['order']=qs[_0xab92('0x25')](_0xc2e8d8['query'][_0xab92('0x25')]);_0x258397[_0xab92('0x26')]=qs[_0xab92('0x27')](_['pick'](_0xc2e8d8[_0xab92('0x1f')],_0x4a2d17['filters']),_0x4f6717);if(_0xc2e8d8[_0xab92('0x1f')][_0xab92('0x28')]){_0x258397[_0xab92('0x26')]=_['merge'](_0x258397[_0xab92('0x26')],{'$or':_[_0xab92('0x18')](_0x4f6717,function(_0x153659){if(_0x153659['type']!==_0xab92('0x29')){var _0x51f84c={};_0x51f84c[_0x153659[_0xab92('0x15')]]={'$like':'%'+_0xc2e8d8[_0xab92('0x1f')]['filter']+'%'};return _0x51f84c;}})});}_0x258397=_[_0xab92('0x2a')]({},_0x258397,_0xc2e8d8[_0xab92('0x2b')]);var _0x48f386={'where':_0x258397['where']};return db[_0xab92('0x19')][_0xab92('0xb')](_0x48f386)['then'](function(_0x4aac97){_0x43f249['count']=_0x4aac97;if(_0xc2e8d8['query'][_0xab92('0x2c')]){_0x258397[_0xab92('0x2d')]=[{'all':!![]}];}return db[_0xab92('0x19')][_0xab92('0x2e')](_0x258397);})[_0xab92('0x10')](function(_0x3cfe2f){_0x43f249[_0xab92('0x2f')]=_0x3cfe2f;return _0x43f249;})[_0xab92('0x10')](respondWithFilteredResult(_0x275190,_0x258397))['catch'](handleError(_0x275190,null));};exports[_0xab92('0x30')]=function(_0x20dc97,_0x5c398c){var _0x3014c0={'raw':![],'where':{'id':_0x20dc97['params']['id']}},_0x4b1e35={};_0x4b1e35[_0xab92('0x1e')]=_[_0xab92('0x20')](db[_0xab92('0x19')][_0xab92('0x1a')]);_0x4b1e35[_0xab92('0x1f')]=_['keys'](_0x20dc97['query']);_0x4b1e35[_0xab92('0x27')]=_['intersection'](_0x4b1e35[_0xab92('0x1e')],_0x4b1e35[_0xab92('0x1f')]);_0x3014c0[_0xab92('0x22')]=_['intersection'](_0x4b1e35['model'],qs[_0xab92('0x31')](_0x20dc97[_0xab92('0x1f')][_0xab92('0x31')]));_0x3014c0[_0xab92('0x22')]=_0x3014c0['attributes']['length']?_0x3014c0[_0xab92('0x22')]:_0x4b1e35[_0xab92('0x1e')];if(_0x20dc97[_0xab92('0x1f')][_0xab92('0x2c')]){_0x3014c0[_0xab92('0x2d')]=[{'all':!![]}];}_0x3014c0=_[_0xab92('0x2a')]({},_0x3014c0,_0x20dc97[_0xab92('0x2b')]);return db[_0xab92('0x19')][_0xab92('0x32')](_0x3014c0)['then'](handleEntityNotFound(_0x5c398c,null))[_0xab92('0x10')](respondWithResult(_0x5c398c,null))[_0xab92('0x33')](handleError(_0x5c398c,null));};exports[_0xab92('0x34')]=function(_0x1060ed,_0x3b76bb){return db[_0xab92('0x19')]['create'](_0x1060ed[_0xab92('0x35')],{})[_0xab92('0x10')](respondWithResult(_0x3b76bb,0xc9))[_0xab92('0x33')](handleError(_0x3b76bb,null));};exports['update']=function(_0x1ce7a6,_0x185edf){if(_0x1ce7a6[_0xab92('0x35')]['id']){delete _0x1ce7a6[_0xab92('0x35')]['id'];}return db[_0xab92('0x19')][_0xab92('0x32')]({'where':{'id':_0x1ce7a6['params']['id']}})[_0xab92('0x10')](handleEntityNotFound(_0x185edf,null))['then'](saveUpdates(_0x1ce7a6['body'],null))[_0xab92('0x10')](respondWithResult(_0x185edf,null))['catch'](handleError(_0x185edf,null));};exports['destroy']=function(_0x529048,_0x9db60c){return db[_0xab92('0x19')][_0xab92('0x32')]({'where':{'id':_0x529048[_0xab92('0x36')]['id']}})[_0xab92('0x10')](handleEntityNotFound(_0x9db60c,null))['then'](removeEntity(_0x9db60c,null))[_0xab92('0x33')](handleError(_0x9db60c,null));};exports[_0xab92('0x37')]=function(_0x39534d,_0xc31431){var _0x21b31e={};var _0x3a40ee={};var _0x397fb4;var _0x1f7381;return db[_0xab92('0x19')][_0xab92('0x38')]({'where':{'id':_0x39534d[_0xab92('0x36')]['id']}})[_0xab92('0x10')](handleEntityNotFound(_0xc31431,null))[_0xab92('0x10')](function(_0x1fc3ce){if(_0x1fc3ce){_0x397fb4=_0x1fc3ce;_0x3a40ee['model']=_['keys'](db['Dynamics365Configuration']['rawAttributes']);_0x3a40ee[_0xab92('0x1f')]=_[_0xab92('0x20')](_0x39534d[_0xab92('0x1f')]);_0x3a40ee[_0xab92('0x27')]=_[_0xab92('0x21')](_0x3a40ee[_0xab92('0x1e')],_0x3a40ee[_0xab92('0x1f')]);_0x21b31e[_0xab92('0x22')]=_['intersection'](_0x3a40ee[_0xab92('0x1e')],qs[_0xab92('0x31')](_0x39534d[_0xab92('0x1f')]['fields']));_0x21b31e[_0xab92('0x22')]=_0x21b31e[_0xab92('0x22')][_0xab92('0x39')]?_0x21b31e[_0xab92('0x22')]:_0x3a40ee['model'];_0x21b31e[_0xab92('0x3a')]=qs[_0xab92('0x25')](_0x39534d[_0xab92('0x1f')][_0xab92('0x25')]);_0x21b31e[_0xab92('0x26')]=qs[_0xab92('0x27')](_[_0xab92('0x3b')](_0x39534d[_0xab92('0x1f')],_0x3a40ee[_0xab92('0x27')]));if(_0x39534d[_0xab92('0x1f')][_0xab92('0x28')]){_0x21b31e[_0xab92('0x26')]=_[_0xab92('0x2a')](_0x21b31e[_0xab92('0x26')],{'$or':_['map'](_0x21b31e['attributes'],function(_0x570589){var _0x5657c6={};_0x5657c6[_0x570589]={'$like':'%'+_0x39534d[_0xab92('0x1f')][_0xab92('0x28')]+'%'};return _0x5657c6;})});}_0x21b31e=_[_0xab92('0x2a')]({},_0x21b31e,_0x39534d[_0xab92('0x2b')]);return _0x397fb4[_0xab92('0x37')](_0x21b31e);}})[_0xab92('0x10')](function(_0x11269f){if(_0x11269f){_0x1f7381=_0x11269f['length'];if(!_0x39534d['query']['hasOwnProperty']('nolimit')){_0x21b31e[_0xab92('0xc')]=qs['limit'](_0x39534d[_0xab92('0x1f')][_0xab92('0xc')]);_0x21b31e[_0xab92('0x9')]=qs[_0xab92('0x9')](_0x39534d[_0xab92('0x1f')][_0xab92('0x9')]);}return _0x397fb4[_0xab92('0x37')](_0x21b31e);}})[_0xab92('0x10')](function(_0x43ab91){if(_0x43ab91){return _0x43ab91?{'count':_0x1f7381,'rows':_0x43ab91}:null;}})[_0xab92('0x10')](respondWithResult(_0xc31431,null))['catch'](handleError(_0xc31431,null));};exports[_0xab92('0x3c')]=function(_0x4953de,_0x2bc5f7){if(_0x4953de[_0xab92('0x35')]['id']){delete _0x4953de['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x4953de['params']['id']}})[_0xab92('0x10')](handleEntityNotFound(_0x2bc5f7,null))['then'](function(_0x279170){if(_0x279170){_0x4953de['body'][_0xab92('0x3d')]=_0x279170['id'];_0x4953de['body']['Subjects']=integrations['getSubjects'](_0x4953de[_0xab92('0x35')][_0xab92('0x3e')],_0x4953de[_0xab92('0x35')][_0xab92('0x1c')]);_0x4953de['body'][_0xab92('0x3f')]=integrations[_0xab92('0x40')](_0x4953de['body'][_0xab92('0x3e')],_0x4953de[_0xab92('0x35')][_0xab92('0x1c')]);return db['Dynamics365Configuration']['create'](_0x4953de[_0xab92('0x35')],{'include':[{'model':db[_0xab92('0x41')],'as':_0xab92('0x42')},{'model':db[_0xab92('0x41')],'as':_0xab92('0x3f')}]});}return null;})[_0xab92('0x10')](respondWithResult(_0x2bc5f7,null))[_0xab92('0x33')](handleError(_0x2bc5f7,null));};function sanitizeRemoteUri(_0x2aa48e){var _0x59e844=_0x2aa48e[_0xab92('0x43')](-0x1);if(_0x59e844==='/')return _0x2aa48e['substring'](0x0,_0x2aa48e[_0xab92('0x44')](_0x59e844));return _0x2aa48e;}function getWebApiUrl(_0x3bfaf0){return util[_0xab92('0x45')]('%s/api/data/v9.0/',_0x3bfaf0);}exports[_0xab92('0x46')]=function(_0x2f2010,_0x399f61){var _0xd952a4=_0x2f2010[_0xab92('0x1f')]['ticketType'];var _0x26b092=_0xd952a4==='incident'?'Incident':_0xab92('0x47');var _0x563144='';var _0x17a11a='';var _0x15b3a9='';var _0x54a330='';var _0x871069='';var _0x3df18a='';var _0x581d62='';var _0x3e06d4='';var _0x54d4b5=['title',_0xab92('0x48'),_0xab92('0x49'),'ownerid','caseorigincode',_0xab92('0x4a'),'phonenumber',_0xab92('0x4b'),_0xab92('0x4c'),'phonecall_activity_parties'];var _0x3be0c6=[_0xab92('0x4d'),'accountidyominame',_0xab92('0x4e'),_0xab92('0x4f'),_0xab92('0x50'),_0xab92('0x51'),_0xab92('0x52'),'contractidname',_0xab92('0x53'),_0xab92('0x54'),_0xab92('0x55'),_0xab92('0x56'),_0xab92('0x57'),_0xab92('0x58'),'createdonbehalfbyyominame','customeridname',_0xab92('0x59'),'customeridyominame',_0xab92('0x5a'),_0xab92('0x5b'),_0xab92('0x5c'),'entityimage_url',_0xab92('0x5d'),_0xab92('0x5e'),_0xab92('0x5f'),'followupby',_0xab92('0x60'),'influencescore',_0xab92('0x61'),_0xab92('0x62'),_0xab92('0x63'),_0xab92('0x64'),'modifiedbyexternalpartyyominame',_0xab92('0x65'),_0xab92('0x66'),'modifiedon',_0xab92('0x67'),'modifiedonbehalfbyyominame',_0xab92('0x68'),'msdyn_iotalertname',_0xab92('0x69'),_0xab92('0x6a'),_0xab92('0x6b'),_0xab92('0x6c'),_0xab92('0x6d'),_0xab92('0x6e'),_0xab92('0x6f'),'primarycontactidname',_0xab92('0x70'),_0xab92('0x71'),_0xab92('0x72'),_0xab92('0x73'),'resolveby','resolvebykpiidname',_0xab92('0x74'),_0xab92('0x75'),'responsiblecontactidyominame','sentimentvalue',_0xab92('0x76'),'slaname',_0xab92('0x77'),_0xab92('0x78'),_0xab92('0x79'),_0xab92('0x7a'),_0xab92('0x7b'),_0xab92('0x7c'),_0xab92('0x7d'),_0xab92('0x7e'),'utcconversiontimezonecode',_0xab92('0x7f')];var _0x1b4c72=_0x54d4b5[_0xab92('0x80')](_0x3be0c6);return db[_0xab92('0x19')][_0xab92('0x38')]({'where':{'id':_0x2f2010[_0xab92('0x36')]['id']},'attributes':['id',_0xab92('0x81'),'password',_0xab92('0x82'),_0xab92('0x83'),_0xab92('0x84'),_0xab92('0x85'),_0xab92('0x86')],'include':[{'model':db[_0xab92('0x87')],'as':_0xab92('0x87'),'attributes':['id',_0xab92('0x88'),_0xab92('0x89')]}]})['then'](handleEntityNotFound(_0x399f61,null))[_0xab92('0x10')](function(_0x156ab2){if(_0x156ab2){if(_0x156ab2['modernAuthentication']){_0x156ab2[_0xab92('0x8a')]=_0x156ab2[_0xab92('0x87')][_0xab92('0x88')];_0x3e06d4=sanitizeRemoteUri(_0x156ab2[_0xab92('0x87')]['data7']);_0x581d62=getWebApiUrl(_0x3e06d4);return _0x156ab2;}_0x3e06d4=sanitizeRemoteUri(_0x156ab2[_0xab92('0x82')]);_0x581d62=getWebApiUrl(_0x3e06d4);var _0x2dedd9={'method':'POST','uri':_0xab92('0x8b')+_0x156ab2[_0xab92('0x83')]+_0xab92('0x8c'),'form':{'client_id':_0x156ab2[_0xab92('0x84')],'resource':_0x3e06d4,'username':_0x156ab2['username'],'password':_0x156ab2[_0xab92('0x8d')],'grant_type':_0xab92('0x8d'),'client_secret':_0x156ab2[_0xab92('0x85')]},'json':!![]};return rp(_0x2dedd9);}})['then'](function(_0x595e9c){_0x3df18a=_0x595e9c[_0xab92('0x8a')];var _0x38ccbe={'method':_0xab92('0x8e'),'uri':encodeURI(_0x581d62+_0xab92('0x8f')+_0x26b092+'\x27'),'headers':{'Authorization':_0xab92('0x90')+_0x3df18a,'If-None-Match':null,'OData-Version':_0xab92('0x91')},'json':!![]};return rp(_0x38ccbe);})['then'](function(_0x4e60bd){var _0x3e0453=_0x4e60bd[_0xab92('0x92')][0x0];var _0x177a5f=_0x3e0453['MetadataId'];var _0x57699c={'method':'GET','uri':_0x581d62+_0xab92('0x93')+_0x177a5f+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xab92('0x90')+_0x3df18a,'If-None-Match':null,'OData-Version':_0xab92('0x91')},'json':!![]};return rp(_0x57699c);})[_0xab92('0x10')](function(_0x37cad8){_0x563144=_0x37cad8;_0x17a11a=_0x563144[_0xab92('0x94')];_0x17a11a=_[_0xab92('0x95')](_0x17a11a,function(_0x3e8b85){return!_0x1b4c72[_0xab92('0x96')](_0x3e8b85[_0xab92('0x97')]);});var _0x4f1f25=[];var _0x2b7441=[];_0x17a11a[_0xab92('0x98')](function(_0x50c2bf){if(_0x50c2bf['@odata.type']){var _0x2a34a5=_0x50c2bf[_0xab92('0x99')][_0xab92('0x9a')](_0x50c2bf[_0xab92('0x99')][_0xab92('0x44')]('.')+0x1);if(_0x2a34a5===_0xab92('0x9b')){_0x4f1f25[_0xab92('0x9c')](getSelectList(_0x581d62,_0xd952a4,_0x2b7441,_0x563144[_0xab92('0x9d')],_0x50c2bf[_0xab92('0x9d')],_0x3df18a));}}});return Promise[_0xab92('0x9e')](_0x4f1f25);})['then'](function(_0x5e085a){_0x15b3a9=_0x5e085a[0x0];var _0x54e0b9=[];var _0x4d6a00=[];_0x17a11a[_0xab92('0x98')](function(_0x259596){if(!_[_0xab92('0x9f')](_0x259596[_0xab92('0x99')])){var _0x16140c=_0x259596[_0xab92('0x99')][_0xab92('0x9a')](_0x259596[_0xab92('0x99')]['lastIndexOf']('.')+0x1);if(_0x16140c==='BooleanAttributeMetadata'){_0x54e0b9[_0xab92('0x9c')](getBooleanList(_0x581d62,_0xd952a4,_0x4d6a00,_0x563144['MetadataId'],_0x259596[_0xab92('0x9d')],_0x3df18a));}}});return Promise[_0xab92('0x9e')](_0x54e0b9);})[_0xab92('0x10')](function(_0x3a6d87){_0x54a330=_0x3a6d87[0x0];var _0x27ba68=[];var _0x5331ab=[];_0x17a11a['forEach'](function(_0x3c3a98){if(_0x3c3a98[_0xab92('0x99')]){var _0x4a29fc=_0x3c3a98[_0xab92('0x99')][_0xab92('0x9a')](_0x3c3a98[_0xab92('0x99')][_0xab92('0x44')]('.')+0x1);if(_0x4a29fc===_0xab92('0xa0')||_0x4a29fc===_0xab92('0xa1')||_0x4a29fc===_0xab92('0xa2')||_0x4a29fc===_0xab92('0xa3')||_0x4a29fc===_0xab92('0xa4')||_0x4a29fc==='DateTimeAttributeMetadata'||_0x4a29fc==='StatusAttributeMetadata'||_0x4a29fc===_0xab92('0xa5')||_0x4a29fc===_0xab92('0xa6')||_0x4a29fc===_0xab92('0xa7')){_0x27ba68[_0xab92('0x9c')](getInputList(_0x581d62,_0xd952a4,_0x4a29fc,_0x5331ab,_0x563144[_0xab92('0x9d')],_0x3c3a98['MetadataId'],_0x3df18a));}}});return Promise[_0xab92('0x9e')](_0x27ba68);})['then'](function(_0x3bee3a){_0x871069=_0x3bee3a[0x0];var _0xd0fef8=_0x15b3a9[_0xab92('0x80')](_0x54a330)[_0xab92('0x80')](_0x871069);var _0x10fe83={'count':_0xd0fef8[_0xab92('0x39')],'rows':_0xd0fef8};return _0x10fe83;})[_0xab92('0x10')](respondWithResult(_0x399f61,null))['catch'](function(_0x5c2698){var _0x48279a=_0x2f2010[_0xab92('0x1f')][_0xab92('0xa8')]?0x1f4:_0x5c2698[_0xab92('0xa9')]||0x1f4;logger[_0xab92('0x14')](_0x5c2698[_0xab92('0xaa')]);delete _0x5c2698['name'];if(_0x48279a===0x191){_0x48279a=0x190;}_0x399f61[_0xab92('0xd')](_0x48279a)[_0xab92('0x16')](_0x2f2010['query'][_0xab92('0xa8')]?{'message':_0xab92('0xab'),'statusCode':_0x5c2698[_0xab92('0xa9')]}:_0x5c2698);});};function getSelectList(_0x4037f2,_0x4566ee,_0x1e8ebc,_0x464234,_0x57cc8d,_0x48e60d){var _0x513b3e={'method':_0xab92('0x8e'),'uri':_0x4037f2+_0xab92('0x93')+_0x464234+_0xab92('0xac')+_0x57cc8d+_0xab92('0xad')+_0xab92('0xae'),'headers':{'Authorization':_0xab92('0x90')+_0x48e60d,'If-None-Match':null,'OData-Version':_0xab92('0x91')},'json':!![]};return rp(_0x513b3e)[_0xab92('0x10')](function(_0x3f4604){var _0x59aaf7=[];var _0x2e5db8=_0x3f4604['OptionSet']['Options'];_0x2e5db8[_0xab92('0x98')](function(_0x71a2f0){_0x59aaf7[_0xab92('0x9c')]({'name':_0x71a2f0['Label'][_0xab92('0xaf')][_0xab92('0xb0')],'value':String(_0x71a2f0['Value'])});});var _0x12443e={'id':_0x4566ee+'_'+_0x3f4604[_0xab92('0x97')],'name':_0x3f4604[_0xab92('0xb1')]['UserLocalizedLabel'][_0xab92('0xb0')],'custom':![],'options':_0x59aaf7};_0x1e8ebc[_0xab92('0x9c')](_0x12443e);return _0x1e8ebc;});}function getBooleanList(_0x508630,_0x372565,_0x5d2db6,_0x1e505f,_0x187b80,_0x373205){var _0x3ca398={'method':_0xab92('0x8e'),'uri':_0x508630+_0xab92('0x93')+_0x1e505f+_0xab92('0xac')+_0x187b80+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xab92('0x90')+_0x373205,'If-None-Match':null,'OData-Version':_0xab92('0x91')},'json':!![]};return rp(_0x3ca398)[_0xab92('0x10')](function(_0x2bc03f){var _0x87bea=[];_0x87bea[_0xab92('0x9c')]({'name':_0x2bc03f[_0xab92('0xb2')][_0xab92('0xb3')][_0xab92('0xb0')]['UserLocalizedLabel']['Label'],'value':_0xab92('0xb4')},{'name':_0x2bc03f[_0xab92('0xb2')][_0xab92('0xb5')][_0xab92('0xb0')]['UserLocalizedLabel'][_0xab92('0xb0')],'value':'false'});var _0x4afebb={'id':_0x372565+'_'+_0x2bc03f[_0xab92('0x97')],'name':_0x2bc03f[_0xab92('0xb1')]['UserLocalizedLabel'][_0xab92('0xb0')],'custom':![],'options':_0x87bea};_0x5d2db6[_0xab92('0x9c')](_0x4afebb);return _0x5d2db6;});}function getInputList(_0x25942c,_0x17b399,_0x1c143c,_0x388482,_0x28877a,_0x72d8ea,_0x22ec85){var _0x44f31d={'method':_0xab92('0x8e'),'uri':_0x25942c+'EntityDefinitions('+_0x28877a+_0xab92('0xac')+_0x72d8ea+_0xab92('0xb6')+_0x1c143c+_0xab92('0xb7'),'headers':{'Authorization':_0xab92('0x90')+_0x22ec85,'If-None-Match':null,'OData-Version':_0xab92('0x91')},'json':!![]};return rp(_0x44f31d)[_0xab92('0x10')](function(_0x586a12){var _0x4ed1a={'id':_0x17b399+'_'+_0x586a12[_0xab92('0x97')],'name':_0x586a12[_0xab92('0xb1')][_0xab92('0xaf')]?_0x586a12[_0xab92('0xb1')][_0xab92('0xaf')][_0xab92('0xb0')]:_0x586a12[_0xab92('0x97')],'custom':![],'options':[]};_0x388482[_0xab92('0x9c')](_0x4ed1a);return _0x388482;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 572bc2d..514f55f 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x58e5f5,_0x32faca){var _0x531a9d=function(_0x57abe0){while(--_0x57abe0){_0x58e5f5['push'](_0x58e5f5['shift']());}};_0x531a9d(++_0x32faca);}(_0x757a,0xde));var _0xa757=function(_0x23216b,_0x2aace4){_0x23216b=_0x23216b-0x0;var _0x1b6dfc=_0x757a[_0x23216b];return _0x1b6dfc;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d1249db..68158ab 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 _0x191d=['ShowDynamics365Account','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','GetDynamics365Account','catch','find'];(function(_0x9917f4,_0x3bd1b6){var _0x43ba40=function(_0x4205bf){while(--_0x4205bf){_0x9917f4['push'](_0x9917f4['shift']());}};_0x43ba40(++_0x3bd1b6);}(_0x191d,0x173));var _0xd191=function(_0x39c5bf,_0x30e147){_0x39c5bf=_0x39c5bf-0x0;var _0x415b10=_0x191d[_0x39c5bf];return _0x415b10;};'use strict';var _=require(_0xd191('0x0'));var util=require(_0xd191('0x1'));var moment=require(_0xd191('0x2'));var BPromise=require('bluebird');var rs=require(_0xd191('0x3'));var fs=require('fs');var Redis=require(_0xd191('0x4'));var db=require(_0xd191('0x5'))['db'];var utils=require(_0xd191('0x6'));var logger=require(_0xd191('0x7'))(_0xd191('0x8'));var config=require(_0xd191('0x9'));var jayson=require(_0xd191('0xa'));var client=jayson[_0xd191('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3aad61,_0x4ec6b7,_0x5123c2){return new BPromise(function(_0x215476,_0x573622){return client[_0xd191('0xc')](_0x3aad61,_0x5123c2)[_0xd191('0xd')](function(_0xd63269){logger[_0xd191('0xe')](_0xd191('0xf'),_0x4ec6b7,_0xd191('0x10'));logger[_0xd191('0x11')](_0xd191('0x12'),_0x4ec6b7,_0xd191('0x10'),JSON[_0xd191('0x13')](_0xd63269));if(_0xd63269['error']){if(_0xd63269['error'][_0xd191('0x14')]===0x1f4){logger[_0xd191('0x15')](_0xd191('0xf'),_0x4ec6b7,_0xd63269[_0xd191('0x15')][_0xd191('0x16')]);return _0x573622(_0xd63269[_0xd191('0x15')][_0xd191('0x16')]);}logger[_0xd191('0x15')](_0xd191('0xf'),_0x4ec6b7,_0xd63269[_0xd191('0x15')]['message']);return _0x215476(_0xd63269[_0xd191('0x15')][_0xd191('0x16')]);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4ec6b7,_0xd191('0x10'));_0x215476(_0xd63269[_0xd191('0x17')][_0xd191('0x16')]);}})['catch'](function(_0x554584){logger[_0xd191('0x15')](_0xd191('0xf'),_0x4ec6b7,_0x554584);_0x573622(_0x554584);});});}exports['GetDynamics365Account']=function(_0x1455cd){var _0x42b04e=this;return new Promise(function(_0x27a357,_0x6a6411){return db[_0xd191('0x18')]['findAll']({'raw':_0x1455cd[_0xd191('0x19')]?_0x1455cd['options'][_0xd191('0x1a')]===undefined?!![]:![]:!![],'where':_0x1455cd[_0xd191('0x19')]?_0x1455cd[_0xd191('0x19')][_0xd191('0x1b')]||null:null,'attributes':_0x1455cd[_0xd191('0x19')]?_0x1455cd[_0xd191('0x19')][_0xd191('0x1c')]||null:null,'limit':_0x1455cd[_0xd191('0x19')]?_0x1455cd['options'][_0xd191('0x1d')]||null:null,'include':_0x1455cd[_0xd191('0x19')]?_0x1455cd['options'][_0xd191('0x1e')]?_[_0xd191('0x1f')](_0x1455cd[_0xd191('0x19')][_0xd191('0x1e')],function(_0x131632){return{'model':db[_0x131632['model']],'as':_0x131632['as'],'attributes':_0x131632[_0xd191('0x1c')],'include':_0x131632[_0xd191('0x1e')]?_[_0xd191('0x1f')](_0x131632[_0xd191('0x1e')],function(_0x1e7ab0){return{'model':db[_0x1e7ab0[_0xd191('0x20')]],'as':_0x1e7ab0['as'],'attributes':_0x1e7ab0[_0xd191('0x1c')],'include':_0x1e7ab0[_0xd191('0x1e')]?_['map'](_0x1e7ab0['include'],function(_0x351bc3){return{'model':db[_0x351bc3[_0xd191('0x20')]],'as':_0x351bc3['as'],'attributes':_0x351bc3[_0xd191('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd191('0xd')](function(_0x20ba49){logger[_0xd191('0xe')](_0xd191('0x21'),_0x1455cd);logger['debug'](_0xd191('0x21'),_0x1455cd,JSON[_0xd191('0x13')](_0x20ba49));_0x27a357(_0x20ba49);})[_0xd191('0x22')](function(_0x82575b){logger[_0xd191('0x15')]('GetDynamics365Account',_0x82575b['message'],_0x1455cd);_0x6a6411(_0x42b04e[_0xd191('0x15')](0x1f4,_0x82575b[_0xd191('0x16')]));});});};exports['ShowDynamics365Account']=function(_0x93530){var _0x345b1e=this;return new Promise(function(_0x3378a5,_0x4e6de4){return db[_0xd191('0x18')][_0xd191('0x23')]({'raw':_0x93530[_0xd191('0x19')]?_0x93530['options']['raw']===undefined?!![]:![]:!![],'where':_0x93530['options']?_0x93530[_0xd191('0x19')][_0xd191('0x1b')]||null:null,'attributes':_0x93530[_0xd191('0x19')]?_0x93530[_0xd191('0x19')][_0xd191('0x1c')]||null:null,'include':_0x93530[_0xd191('0x19')]?_0x93530[_0xd191('0x19')][_0xd191('0x1e')]?_[_0xd191('0x1f')](_0x93530[_0xd191('0x19')][_0xd191('0x1e')],function(_0x4207df){return{'model':db[_0x4207df['model']],'as':_0x4207df['as'],'attributes':_0x4207df[_0xd191('0x1c')],'include':_0x4207df[_0xd191('0x1e')]?_[_0xd191('0x1f')](_0x4207df[_0xd191('0x1e')],function(_0x3b909b){return{'model':db[_0x3b909b[_0xd191('0x20')]],'as':_0x3b909b['as'],'attributes':_0x3b909b[_0xd191('0x1c')],'include':_0x3b909b[_0xd191('0x1e')]?_[_0xd191('0x1f')](_0x3b909b['include'],function(_0x3dd5f3){return{'model':db[_0x3dd5f3[_0xd191('0x20')]],'as':_0x3dd5f3['as'],'attributes':_0x3dd5f3[_0xd191('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b055d){logger[_0xd191('0xe')](_0xd191('0x24'),_0x93530);logger['debug'](_0xd191('0x24'),_0x93530,JSON[_0xd191('0x13')](_0x4b055d));_0x3378a5(_0x4b055d);})[_0xd191('0x22')](function(_0x1aa49a){logger['error'](_0xd191('0x24'),_0x1aa49a[_0xd191('0x16')],_0x93530);_0x4e6de4(_0x345b1e['error'](0x1f4,_0x1aa49a[_0xd191('0x16')]));});});}; \ No newline at end of file +var _0x6cff=['raw','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','GetDynamics365Account','Dynamics365Account','findAll','options'];(function(_0x2cb6b8,_0x34e015){var _0x5712d0=function(_0x44d53e){while(--_0x44d53e){_0x2cb6b8['push'](_0x2cb6b8['shift']());}};_0x5712d0(++_0x34e015);}(_0x6cff,0x6c));var _0xf6cf=function(_0x533381,_0x8a69fa){_0x533381=_0x533381-0x0;var _0x2877ed=_0x6cff[_0x533381];return _0x2877ed;};'use strict';var _=require(_0xf6cf('0x0'));var util=require('util');var moment=require(_0xf6cf('0x1'));var BPromise=require(_0xf6cf('0x2'));var rs=require(_0xf6cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6cf('0x4'))['db'];var utils=require(_0xf6cf('0x5'));var logger=require(_0xf6cf('0x6'))(_0xf6cf('0x7'));var config=require('../../config/environment');var jayson=require(_0xf6cf('0x8'));var client=jayson[_0xf6cf('0x9')][_0xf6cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c912b,_0x3a99cd,_0x295308){return new BPromise(function(_0x305ede,_0x3a4382){return client['request'](_0x2c912b,_0x295308)[_0xf6cf('0xb')](function(_0x41cf56){logger['info'](_0xf6cf('0xc'),_0x3a99cd,'request\x20sent');logger[_0xf6cf('0xd')](_0xf6cf('0xe'),_0x3a99cd,_0xf6cf('0xf'),JSON['stringify'](_0x41cf56));if(_0x41cf56[_0xf6cf('0x10')]){if(_0x41cf56[_0xf6cf('0x10')]['code']===0x1f4){logger['error'](_0xf6cf('0xc'),_0x3a99cd,_0x41cf56[_0xf6cf('0x10')]['message']);return _0x3a4382(_0x41cf56[_0xf6cf('0x10')][_0xf6cf('0x11')]);}logger['error'](_0xf6cf('0xc'),_0x3a99cd,_0x41cf56[_0xf6cf('0x10')]['message']);return _0x305ede(_0x41cf56[_0xf6cf('0x10')][_0xf6cf('0x11')]);}else{logger[_0xf6cf('0x12')](_0xf6cf('0xc'),_0x3a99cd,_0xf6cf('0xf'));_0x305ede(_0x41cf56['result'][_0xf6cf('0x11')]);}})[_0xf6cf('0x13')](function(_0x93ea75){logger['error'](_0xf6cf('0xc'),_0x3a99cd,_0x93ea75);_0x3a4382(_0x93ea75);});});}exports[_0xf6cf('0x14')]=function(_0x51cf97){var _0x3fd7a3=this;return new Promise(function(_0x4a29c2,_0x389e88){return db[_0xf6cf('0x15')][_0xf6cf('0x16')]({'raw':_0x51cf97[_0xf6cf('0x17')]?_0x51cf97[_0xf6cf('0x17')][_0xf6cf('0x18')]===undefined?!![]:![]:!![],'where':_0x51cf97[_0xf6cf('0x17')]?_0x51cf97[_0xf6cf('0x17')]['where']||null:null,'attributes':_0x51cf97[_0xf6cf('0x17')]?_0x51cf97[_0xf6cf('0x17')][_0xf6cf('0x19')]||null:null,'limit':_0x51cf97[_0xf6cf('0x17')]?_0x51cf97['options'][_0xf6cf('0x1a')]||null:null,'include':_0x51cf97[_0xf6cf('0x17')]?_0x51cf97['options'][_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x51cf97[_0xf6cf('0x17')][_0xf6cf('0x1b')],function(_0x496c26){return{'model':db[_0x496c26[_0xf6cf('0x1d')]],'as':_0x496c26['as'],'attributes':_0x496c26['attributes'],'include':_0x496c26[_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x496c26[_0xf6cf('0x1b')],function(_0x58de5e){return{'model':db[_0x58de5e[_0xf6cf('0x1d')]],'as':_0x58de5e['as'],'attributes':_0x58de5e['attributes'],'include':_0x58de5e[_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x58de5e[_0xf6cf('0x1b')],function(_0x54a6ea){return{'model':db[_0x54a6ea[_0xf6cf('0x1d')]],'as':_0x54a6ea['as'],'attributes':_0x54a6ea['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x109726){logger[_0xf6cf('0x12')](_0xf6cf('0x14'),_0x51cf97);logger[_0xf6cf('0xd')]('GetDynamics365Account',_0x51cf97,JSON[_0xf6cf('0x1e')](_0x109726));_0x4a29c2(_0x109726);})['catch'](function(_0x3bd7cc){logger['error'](_0xf6cf('0x14'),_0x3bd7cc[_0xf6cf('0x11')],_0x51cf97);_0x389e88(_0x3fd7a3[_0xf6cf('0x10')](0x1f4,_0x3bd7cc[_0xf6cf('0x11')]));});});};exports[_0xf6cf('0x1f')]=function(_0x175e0d){var _0x55b8c6=this;return new Promise(function(_0x3d109d,_0x302d62){return db['Dynamics365Account'][_0xf6cf('0x20')]({'raw':_0x175e0d[_0xf6cf('0x17')]?_0x175e0d[_0xf6cf('0x17')][_0xf6cf('0x18')]===undefined?!![]:![]:!![],'where':_0x175e0d['options']?_0x175e0d[_0xf6cf('0x17')]['where']||null:null,'attributes':_0x175e0d[_0xf6cf('0x17')]?_0x175e0d[_0xf6cf('0x17')]['attributes']||null:null,'include':_0x175e0d[_0xf6cf('0x17')]?_0x175e0d['options'][_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x175e0d[_0xf6cf('0x17')]['include'],function(_0x5c4534){return{'model':db[_0x5c4534[_0xf6cf('0x1d')]],'as':_0x5c4534['as'],'attributes':_0x5c4534[_0xf6cf('0x19')],'include':_0x5c4534[_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x5c4534['include'],function(_0x3ee9f9){return{'model':db[_0x3ee9f9[_0xf6cf('0x1d')]],'as':_0x3ee9f9['as'],'attributes':_0x3ee9f9[_0xf6cf('0x19')],'include':_0x3ee9f9[_0xf6cf('0x1b')]?_[_0xf6cf('0x1c')](_0x3ee9f9[_0xf6cf('0x1b')],function(_0x6268d9){return{'model':db[_0x6268d9[_0xf6cf('0x1d')]],'as':_0x6268d9['as'],'attributes':_0x6268d9[_0xf6cf('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf6cf('0xb')](function(_0x57004f){logger[_0xf6cf('0x12')](_0xf6cf('0x1f'),_0x175e0d);logger['debug'](_0xf6cf('0x1f'),_0x175e0d,JSON[_0xf6cf('0x1e')](_0x57004f));_0x3d109d(_0x57004f);})['catch'](function(_0x3b4426){logger['error'](_0xf6cf('0x1f'),_0x3b4426[_0xf6cf('0x11')],_0x175e0d);_0x302d62(_0x55b8c6[_0xf6cf('0x10')](0x1f4,_0x3b4426[_0xf6cf('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 107f34a..b04b6e1 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 _0x4e6e=['../../config/environment','./intDynamics365Configuration.controller','index','get','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2f8ff6,_0x17d34a){var _0x1a7c02=function(_0x588003){while(--_0x588003){_0x2f8ff6['push'](_0x2f8ff6['shift']());}};_0x1a7c02(++_0x17d34a);}(_0x4e6e,0x70));var _0xe4e6=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x4e6e[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require('multer');var util=require(_0xe4e6('0x0'));var path=require(_0xe4e6('0x1'));var timeout=require(_0xe4e6('0x2'));var express=require(_0xe4e6('0x3'));var router=express[_0xe4e6('0x4')]();var fs_extra=require(_0xe4e6('0x5'));var auth=require(_0xe4e6('0x6'));var interaction=require(_0xe4e6('0x7'));var config=require(_0xe4e6('0x8'));var controller=require(_0xe4e6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe4e6('0xa')]);router[_0xe4e6('0xb')](_0xe4e6('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xe4e6('0xd'),auth[_0xe4e6('0xe')](),controller[_0xe4e6('0xf')]);router[_0xe4e6('0xb')](_0xe4e6('0x10'),auth[_0xe4e6('0xe')](),controller['getSubjects']);router[_0xe4e6('0xb')](_0xe4e6('0x11'),auth[_0xe4e6('0xe')](),controller[_0xe4e6('0x12')]);router[_0xe4e6('0x13')]('/',auth[_0xe4e6('0xe')](),controller[_0xe4e6('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe4e6('0x15')]);router['delete'](_0xe4e6('0xc'),auth[_0xe4e6('0xe')](),controller[_0xe4e6('0x16')]);module[_0xe4e6('0x17')]=router; \ No newline at end of file +var _0x76da=['multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','/:id','update','delete','destroy','exports'];(function(_0x16a4ae,_0x2ee424){var _0x221e7e=function(_0x360acb){while(--_0x360acb){_0x16a4ae['push'](_0x16a4ae['shift']());}};_0x221e7e(++_0x2ee424);}(_0x76da,0x111));var _0xa76d=function(_0x1aa38f,_0x5f3923){_0x1aa38f=_0x1aa38f-0x0;var _0xccc7ee=_0x76da[_0x1aa38f];return _0xccc7ee;};'use strict';var multer=require(_0xa76d('0x0'));var util=require('util');var path=require(_0xa76d('0x1'));var timeout=require(_0xa76d('0x2'));var express=require('express');var router=express[_0xa76d('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa76d('0x4'));var config=require(_0xa76d('0x5'));var controller=require(_0xa76d('0x6'));router['get']('/',auth[_0xa76d('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa76d('0x8')]);router[_0xa76d('0x9')](_0xa76d('0xa'),auth[_0xa76d('0x7')](),controller[_0xa76d('0xb')]);router[_0xa76d('0x9')](_0xa76d('0xc'),auth[_0xa76d('0x7')](),controller[_0xa76d('0xd')]);router[_0xa76d('0x9')]('/:id/descriptions',auth[_0xa76d('0x7')](),controller[_0xa76d('0xe')]);router[_0xa76d('0xf')]('/',auth[_0xa76d('0x7')](),controller['create']);router['put'](_0xa76d('0x10'),auth['isAuthenticated'](),controller[_0xa76d('0x11')]);router[_0xa76d('0x12')](_0xa76d('0x10'),auth[_0xa76d('0x7')](),controller[_0xa76d('0x13')]);module[_0xa76d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index aef8440..6fbfeff 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 _0x88e7=['phonecall','contact','exports','STRING','ENUM','incident'];(function(_0x22369a,_0x100d86){var _0x5d0ae9=function(_0x4c97e7){while(--_0x4c97e7){_0x22369a['push'](_0x22369a['shift']());}};_0x5d0ae9(++_0x100d86);}(_0x88e7,0x176));var _0x788e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x88e7[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require('sequelize');module[_0x788e('0x0')]={'name':{'type':Sequelize[_0x788e('0x1')]},'description':{'type':Sequelize[_0x788e('0x1')]},'ticketType':{'type':Sequelize[_0x788e('0x2')](_0x788e('0x3'),_0x788e('0x4')),'defaultValue':_0x788e('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x788e('0x5'),'nothing'),'defaultValue':_0x788e('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfbc0=['contact','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','nothing'];(function(_0x34be5f,_0x536460){var _0x5d1410=function(_0x128bf8){while(--_0x128bf8){_0x34be5f['push'](_0x34be5f['shift']());}};_0x5d1410(++_0x536460);}(_0xfbc0,0x14f));var _0x0fbc=function(_0x233e28,_0x36e064){_0x233e28=_0x233e28-0x0;var _0x50e055=_0xfbc0[_0x233e28];return _0x50e055;};'use strict';var Sequelize=require(_0x0fbc('0x0'));module[_0x0fbc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0fbc('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x0fbc('0x3'),_0x0fbc('0x4')),'defaultValue':_0x0fbc('0x3')},'moduleCreate':{'type':Sequelize[_0x0fbc('0x5')]('contact',_0x0fbc('0x6')),'defaultValue':_0x0fbc('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0fbc('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1bde4c0..5346834 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 _0xda71=['rows','catch','show','params','include','create','body','find','getFields','Dynamics365Field','length','hasOwnProperty','getSubjects','findOne','order','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','Dynamics365Configuration','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xda71,0x154));var _0x1da7=function(_0x2d88b4,_0xea4286){_0x2d88b4=_0x2d88b4-0x0;var _0x5d82ae=_0xda71[_0x2d88b4];return _0x5d82ae;};'use strict';var emlformat=require(_0x1da7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1da7('0x1'));var jsonpatch=require(_0x1da7('0x2'));var rp=require('request-promise');var moment=require(_0x1da7('0x3'));var BPromise=require(_0x1da7('0x4'));var Mustache=require(_0x1da7('0x5'));var util=require('util');var path=require(_0x1da7('0x6'));var sox=require(_0x1da7('0x7'));var csv=require(_0x1da7('0x8'));var ejs=require(_0x1da7('0x9'));var fs=require('fs');var fs_extra=require(_0x1da7('0xa'));var _=require(_0x1da7('0xb'));var squel=require(_0x1da7('0xc'));var crypto=require(_0x1da7('0xd'));var jsforce=require(_0x1da7('0xe'));var deskjs=require(_0x1da7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1da7('0x10'));var Papa=require(_0x1da7('0x11'));var Redis=require('ioredis');var authService=require(_0x1da7('0x12'));var qs=require(_0x1da7('0x13'));var as=require(_0x1da7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1da7('0x15'))('api');var utils=require(_0x1da7('0x16'));var config=require(_0x1da7('0x17'));var licenseUtil=require(_0x1da7('0x18'));var db=require(_0x1da7('0x19'))['db'];function respondWithStatusCode(_0x56610f,_0x1cb22b){_0x1cb22b=_0x1cb22b||0xcc;return function(_0x5ce0ea){if(_0x5ce0ea){return _0x56610f[_0x1da7('0x1a')](_0x1cb22b);}return _0x56610f[_0x1da7('0x1b')](_0x1cb22b)[_0x1da7('0x1c')]();};}function respondWithResult(_0x190da0,_0x3dd591){_0x3dd591=_0x3dd591||0xc8;return function(_0xa7ff5d){if(_0xa7ff5d){return _0x190da0['status'](_0x3dd591)[_0x1da7('0x1d')](_0xa7ff5d);}};}function respondWithFilteredResult(_0x45c0ad,_0x14e4a6){return function(_0x10c9c4){if(_0x10c9c4){var _0x2faef0=typeof _0x14e4a6[_0x1da7('0x1e')]===_0x1da7('0x1f')&&typeof _0x14e4a6[_0x1da7('0x20')]==='undefined';var _0x463f79=_0x10c9c4[_0x1da7('0x21')];var _0x5d5a53=_0x2faef0?0x0:_0x14e4a6['offset'];var _0x3cade1=_0x2faef0?_0x10c9c4[_0x1da7('0x21')]:_0x14e4a6[_0x1da7('0x1e')]+_0x14e4a6[_0x1da7('0x20')];var _0x25ad30;if(_0x3cade1>=_0x463f79){_0x3cade1=_0x463f79;_0x25ad30=0xc8;}else{_0x25ad30=0xce;}_0x45c0ad['status'](_0x25ad30);return _0x45c0ad[_0x1da7('0x22')]('Content-Range',_0x5d5a53+'-'+_0x3cade1+'/'+_0x463f79)[_0x1da7('0x1d')](_0x10c9c4);}return null;};}function patchUpdates(_0x24fd79){return function(_0x401c23){try{jsonpatch[_0x1da7('0x23')](_0x401c23,_0x24fd79,!![]);}catch(_0x2e43eb){return BPromise[_0x1da7('0x24')](_0x2e43eb);}return _0x401c23[_0x1da7('0x25')]();};}function saveUpdates(_0xc01ca7,_0x4466e3){return function(_0x3c1b4f){if(_0x3c1b4f){return _0x3c1b4f[_0x1da7('0x26')](_0xc01ca7)[_0x1da7('0x27')](function(_0xd8b654){return _0xd8b654;});}return null;};}function removeEntity(_0x454956,_0x5ddddb){return function(_0x4cb657){if(_0x4cb657){return _0x4cb657[_0x1da7('0x28')]()['then'](function(){_0x454956['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x360744,_0x231b91){return function(_0x4e651f){if(!_0x4e651f){_0x360744[_0x1da7('0x1a')](0x194);}return _0x4e651f;};}function handleError(_0x347424,_0x32394d){_0x32394d=_0x32394d||0x1f4;return function(_0x5eea69){logger['error'](_0x5eea69[_0x1da7('0x29')]);if(_0x5eea69['name']){delete _0x5eea69[_0x1da7('0x2a')];}_0x347424[_0x1da7('0x1b')](_0x32394d)['send'](_0x5eea69);};}exports['index']=function(_0x5bc3c6,_0x314518){var _0x54742d={},_0x4df959={},_0x555dc0={'count':0x0,'rows':[]};var _0x2b65ab=_['map'](db[_0x1da7('0x2b')][_0x1da7('0x2c')],function(_0x13fea3){return{'name':_0x13fea3['fieldName'],'type':_0x13fea3['type'][_0x1da7('0x2d')]};});_0x4df959[_0x1da7('0x2e')]=_[_0x1da7('0x2f')](_0x2b65ab,_0x1da7('0x2a'));_0x4df959[_0x1da7('0x30')]=_[_0x1da7('0x31')](_0x5bc3c6['query']);_0x4df959[_0x1da7('0x32')]=_[_0x1da7('0x33')](_0x4df959[_0x1da7('0x2e')],_0x4df959[_0x1da7('0x30')]);_0x54742d[_0x1da7('0x34')]=_['intersection'](_0x4df959[_0x1da7('0x2e')],qs[_0x1da7('0x35')](_0x5bc3c6[_0x1da7('0x30')][_0x1da7('0x35')]));_0x54742d[_0x1da7('0x34')]=_0x54742d[_0x1da7('0x34')]['length']?_0x54742d[_0x1da7('0x34')]:_0x4df959[_0x1da7('0x2e')];if(!_0x5bc3c6['query']['hasOwnProperty'](_0x1da7('0x36'))){_0x54742d[_0x1da7('0x20')]=qs[_0x1da7('0x20')](_0x5bc3c6['query'][_0x1da7('0x20')]);_0x54742d[_0x1da7('0x1e')]=qs['offset'](_0x5bc3c6[_0x1da7('0x30')][_0x1da7('0x1e')]);}_0x54742d['order']=qs[_0x1da7('0x37')](_0x5bc3c6['query']['sort']);_0x54742d['where']=qs[_0x1da7('0x32')](_[_0x1da7('0x38')](_0x5bc3c6[_0x1da7('0x30')],_0x4df959[_0x1da7('0x32')]),_0x2b65ab);if(_0x5bc3c6[_0x1da7('0x30')][_0x1da7('0x39')]){_0x54742d['where']=_['merge'](_0x54742d[_0x1da7('0x3a')],{'$or':_['map'](_0x2b65ab,function(_0x23a8ce){if(_0x23a8ce[_0x1da7('0x3b')]!==_0x1da7('0x3c')){var _0x586743={};_0x586743[_0x23a8ce['name']]={'$like':'%'+_0x5bc3c6[_0x1da7('0x30')]['filter']+'%'};return _0x586743;}})});}_0x54742d=_[_0x1da7('0x3d')]({},_0x54742d,_0x5bc3c6[_0x1da7('0x3e')]);var _0x305c37={'where':_0x54742d[_0x1da7('0x3a')]};return db[_0x1da7('0x2b')][_0x1da7('0x21')](_0x305c37)[_0x1da7('0x27')](function(_0x45dff3){_0x555dc0['count']=_0x45dff3;if(_0x5bc3c6['query'][_0x1da7('0x3f')]){_0x54742d['include']=[{'all':!![]}];}return db[_0x1da7('0x2b')][_0x1da7('0x40')](_0x54742d);})[_0x1da7('0x27')](function(_0x2f2046){_0x555dc0[_0x1da7('0x41')]=_0x2f2046;return _0x555dc0;})[_0x1da7('0x27')](respondWithFilteredResult(_0x314518,_0x54742d))[_0x1da7('0x42')](handleError(_0x314518,null));};exports[_0x1da7('0x43')]=function(_0xfcf414,_0x467ff2){var _0x543f93={'raw':![],'where':{'id':_0xfcf414[_0x1da7('0x44')]['id']}},_0x539a15={};_0x539a15[_0x1da7('0x2e')]=_[_0x1da7('0x31')](db[_0x1da7('0x2b')]['rawAttributes']);_0x539a15[_0x1da7('0x30')]=_[_0x1da7('0x31')](_0xfcf414[_0x1da7('0x30')]);_0x539a15[_0x1da7('0x32')]=_[_0x1da7('0x33')](_0x539a15[_0x1da7('0x2e')],_0x539a15[_0x1da7('0x30')]);_0x543f93['attributes']=_['intersection'](_0x539a15['model'],qs[_0x1da7('0x35')](_0xfcf414[_0x1da7('0x30')][_0x1da7('0x35')]));_0x543f93[_0x1da7('0x34')]=_0x543f93[_0x1da7('0x34')]['length']?_0x543f93['attributes']:_0x539a15[_0x1da7('0x2e')];if(_0xfcf414[_0x1da7('0x30')][_0x1da7('0x3f')]){_0x543f93[_0x1da7('0x45')]=[{'all':!![]}];}_0x543f93=_['merge']({},_0x543f93,_0xfcf414['options']);return db[_0x1da7('0x2b')]['find'](_0x543f93)[_0x1da7('0x27')](handleEntityNotFound(_0x467ff2,null))[_0x1da7('0x27')](respondWithResult(_0x467ff2,null))[_0x1da7('0x42')](handleError(_0x467ff2,null));};exports[_0x1da7('0x46')]=function(_0x1099e5,_0x436134){return db[_0x1da7('0x2b')][_0x1da7('0x46')](_0x1099e5[_0x1da7('0x47')],{})[_0x1da7('0x27')](respondWithResult(_0x436134,0xc9))[_0x1da7('0x42')](handleError(_0x436134,null));};exports[_0x1da7('0x26')]=function(_0x473b26,_0x1b086f){if(_0x473b26[_0x1da7('0x47')]['id']){delete _0x473b26[_0x1da7('0x47')]['id'];}return db[_0x1da7('0x2b')][_0x1da7('0x48')]({'where':{'id':_0x473b26[_0x1da7('0x44')]['id']}})[_0x1da7('0x27')](handleEntityNotFound(_0x1b086f,null))[_0x1da7('0x27')](saveUpdates(_0x473b26[_0x1da7('0x47')],null))[_0x1da7('0x27')](respondWithResult(_0x1b086f,null))[_0x1da7('0x42')](handleError(_0x1b086f,null));};exports[_0x1da7('0x28')]=function(_0x2dd4e5,_0x235395){return db['Dynamics365Configuration'][_0x1da7('0x48')]({'where':{'id':_0x2dd4e5['params']['id']}})[_0x1da7('0x27')](handleEntityNotFound(_0x235395,null))[_0x1da7('0x27')](removeEntity(_0x235395,null))['catch'](handleError(_0x235395,null));};exports[_0x1da7('0x49')]=function(_0x5c8a89,_0x95830,_0x31c4ba){var _0x3b2393={};var _0x112d40={};var _0x31ee91;var _0x545505;return db[_0x1da7('0x2b')]['findOne']({'where':{'id':_0x5c8a89[_0x1da7('0x44')]['id']}})[_0x1da7('0x27')](handleEntityNotFound(_0x95830,null))[_0x1da7('0x27')](function(_0x50b47b){if(_0x50b47b){_0x31ee91=_0x50b47b;_0x112d40['model']=_[_0x1da7('0x31')](db[_0x1da7('0x4a')][_0x1da7('0x2c')]);_0x112d40['query']=_[_0x1da7('0x31')](_0x5c8a89[_0x1da7('0x30')]);_0x112d40[_0x1da7('0x32')]=_[_0x1da7('0x33')](_0x112d40[_0x1da7('0x2e')],_0x112d40[_0x1da7('0x30')]);_0x3b2393[_0x1da7('0x34')]=_[_0x1da7('0x33')](_0x112d40[_0x1da7('0x2e')],qs[_0x1da7('0x35')](_0x5c8a89[_0x1da7('0x30')]['fields']));_0x3b2393[_0x1da7('0x34')]=_0x3b2393[_0x1da7('0x34')][_0x1da7('0x4b')]?_0x3b2393['attributes']:_0x112d40[_0x1da7('0x2e')];_0x3b2393['order']=qs[_0x1da7('0x37')](_0x5c8a89[_0x1da7('0x30')][_0x1da7('0x37')]);_0x3b2393['where']=qs['filters'](_['pick'](_0x5c8a89[_0x1da7('0x30')],_0x112d40[_0x1da7('0x32')]));if(_0x5c8a89[_0x1da7('0x30')]['filter']){_0x3b2393[_0x1da7('0x3a')]=_[_0x1da7('0x3d')](_0x3b2393[_0x1da7('0x3a')],{'$or':_[_0x1da7('0x2f')](_0x3b2393[_0x1da7('0x34')],function(_0x3ea266){var _0x57315d={};_0x57315d[_0x3ea266]={'$like':'%'+_0x5c8a89[_0x1da7('0x30')][_0x1da7('0x39')]+'%'};return _0x57315d;})});}_0x3b2393=_[_0x1da7('0x3d')]({},_0x3b2393,_0x5c8a89[_0x1da7('0x3e')]);return _0x31ee91[_0x1da7('0x49')](_0x3b2393);}})['then'](function(_0x3962af){if(_0x3962af){_0x545505=_0x3962af[_0x1da7('0x4b')];if(!_0x5c8a89[_0x1da7('0x30')][_0x1da7('0x4c')](_0x1da7('0x36'))){_0x3b2393[_0x1da7('0x20')]=qs['limit'](_0x5c8a89[_0x1da7('0x30')]['limit']);_0x3b2393[_0x1da7('0x1e')]=qs['offset'](_0x5c8a89[_0x1da7('0x30')][_0x1da7('0x1e')]);}return _0x31ee91[_0x1da7('0x49')](_0x3b2393);}})[_0x1da7('0x27')](function(_0xac5019){if(_0xac5019){return _0xac5019?{'count':_0x545505,'rows':_0xac5019}:null;}})[_0x1da7('0x27')](respondWithResult(_0x95830,null))[_0x1da7('0x42')](handleError(_0x95830,null));};exports[_0x1da7('0x4d')]=function(_0xdbdf16,_0x24a865,_0x47c477){var _0x2c1d93={};var _0x1e5034={};var _0x2ff99d;var _0x41fe31;return db[_0x1da7('0x2b')][_0x1da7('0x4e')]({'where':{'id':_0xdbdf16['params']['id']}})[_0x1da7('0x27')](handleEntityNotFound(_0x24a865,null))[_0x1da7('0x27')](function(_0x4a82e6){if(_0x4a82e6){_0x2ff99d=_0x4a82e6;_0x1e5034[_0x1da7('0x2e')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x1e5034[_0x1da7('0x30')]=_[_0x1da7('0x31')](_0xdbdf16[_0x1da7('0x30')]);_0x1e5034['filters']=_[_0x1da7('0x33')](_0x1e5034[_0x1da7('0x2e')],_0x1e5034['query']);_0x2c1d93['attributes']=_[_0x1da7('0x33')](_0x1e5034[_0x1da7('0x2e')],qs['fields'](_0xdbdf16[_0x1da7('0x30')]['fields']));_0x2c1d93[_0x1da7('0x34')]=_0x2c1d93[_0x1da7('0x34')][_0x1da7('0x4b')]?_0x2c1d93[_0x1da7('0x34')]:_0x1e5034[_0x1da7('0x2e')];_0x2c1d93[_0x1da7('0x4f')]=qs[_0x1da7('0x37')](_0xdbdf16['query'][_0x1da7('0x37')]);_0x2c1d93[_0x1da7('0x3a')]=qs['filters'](_[_0x1da7('0x38')](_0xdbdf16[_0x1da7('0x30')],_0x1e5034[_0x1da7('0x32')]));if(_0xdbdf16['query']['filter']){_0x2c1d93[_0x1da7('0x3a')]=_[_0x1da7('0x3d')](_0x2c1d93[_0x1da7('0x3a')],{'$or':_[_0x1da7('0x2f')](_0x2c1d93[_0x1da7('0x34')],function(_0x3f13b3){var _0x5f1c50={};_0x5f1c50[_0x3f13b3]={'$like':'%'+_0xdbdf16[_0x1da7('0x30')]['filter']+'%'};return _0x5f1c50;})});}_0x2c1d93=_[_0x1da7('0x3d')]({},_0x2c1d93,_0xdbdf16[_0x1da7('0x3e')]);return _0x2ff99d[_0x1da7('0x4d')](_0x2c1d93);}})[_0x1da7('0x27')](function(_0x13568e){if(_0x13568e){_0x41fe31=_0x13568e[_0x1da7('0x4b')];if(!_0xdbdf16[_0x1da7('0x30')][_0x1da7('0x4c')](_0x1da7('0x36'))){_0x2c1d93[_0x1da7('0x20')]=qs[_0x1da7('0x20')](_0xdbdf16[_0x1da7('0x30')][_0x1da7('0x20')]);_0x2c1d93['offset']=qs[_0x1da7('0x1e')](_0xdbdf16[_0x1da7('0x30')][_0x1da7('0x1e')]);}return _0x2ff99d[_0x1da7('0x4d')](_0x2c1d93);}})[_0x1da7('0x27')](function(_0x1756f0){if(_0x1756f0){return _0x1756f0?{'count':_0x41fe31,'rows':_0x1756f0}:null;}})['then'](respondWithResult(_0x24a865,null))[_0x1da7('0x42')](handleError(_0x24a865,null));};exports[_0x1da7('0x50')]=function(_0xa6c403,_0x4b8d6f,_0x2c764a){var _0x122561={};var _0x11c626={};var _0x4ed7c4;var _0x13b708;return db[_0x1da7('0x2b')][_0x1da7('0x4e')]({'where':{'id':_0xa6c403[_0x1da7('0x44')]['id']}})[_0x1da7('0x27')](handleEntityNotFound(_0x4b8d6f,null))[_0x1da7('0x27')](function(_0x47a707){if(_0x47a707){_0x4ed7c4=_0x47a707;_0x11c626['model']=_[_0x1da7('0x31')](db['Dynamics365Field']['rawAttributes']);_0x11c626[_0x1da7('0x30')]=_[_0x1da7('0x31')](_0xa6c403[_0x1da7('0x30')]);_0x11c626[_0x1da7('0x32')]=_[_0x1da7('0x33')](_0x11c626[_0x1da7('0x2e')],_0x11c626[_0x1da7('0x30')]);_0x122561[_0x1da7('0x34')]=_[_0x1da7('0x33')](_0x11c626[_0x1da7('0x2e')],qs[_0x1da7('0x35')](_0xa6c403['query'][_0x1da7('0x35')]));_0x122561[_0x1da7('0x34')]=_0x122561[_0x1da7('0x34')]['length']?_0x122561[_0x1da7('0x34')]:_0x11c626[_0x1da7('0x2e')];_0x122561[_0x1da7('0x4f')]=qs[_0x1da7('0x37')](_0xa6c403[_0x1da7('0x30')][_0x1da7('0x37')]);_0x122561[_0x1da7('0x3a')]=qs[_0x1da7('0x32')](_[_0x1da7('0x38')](_0xa6c403[_0x1da7('0x30')],_0x11c626[_0x1da7('0x32')]));if(_0xa6c403[_0x1da7('0x30')][_0x1da7('0x39')]){_0x122561['where']=_[_0x1da7('0x3d')](_0x122561[_0x1da7('0x3a')],{'$or':_[_0x1da7('0x2f')](_0x122561[_0x1da7('0x34')],function(_0x38846c){var _0x2bbcab={};_0x2bbcab[_0x38846c]={'$like':'%'+_0xa6c403['query']['filter']+'%'};return _0x2bbcab;})});}_0x122561=_[_0x1da7('0x3d')]({},_0x122561,_0xa6c403['options']);return _0x4ed7c4[_0x1da7('0x50')](_0x122561);}})[_0x1da7('0x27')](function(_0x42b002){if(_0x42b002){_0x13b708=_0x42b002[_0x1da7('0x4b')];if(!_0xa6c403['query']['hasOwnProperty'](_0x1da7('0x36'))){_0x122561[_0x1da7('0x20')]=qs['limit'](_0xa6c403[_0x1da7('0x30')][_0x1da7('0x20')]);_0x122561[_0x1da7('0x1e')]=qs[_0x1da7('0x1e')](_0xa6c403[_0x1da7('0x30')][_0x1da7('0x1e')]);}return _0x4ed7c4[_0x1da7('0x50')](_0x122561);}})[_0x1da7('0x27')](function(_0x28b3d3){if(_0x28b3d3){return _0x28b3d3?{'count':_0x13b708,'rows':_0x28b3d3}:null;}})[_0x1da7('0x27')](respondWithResult(_0x4b8d6f,null))[_0x1da7('0x42')](handleError(_0x4b8d6f,null));}; \ No newline at end of file +var _0xbb5a=['includeAll','include','catch','show','rawAttributes','length','find','create','body','params','getFields','findOne','Dynamics365Field','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','sort','pick','filter','where','merge','options'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbb5a,0x10a));var _0xabb5=function(_0x4d37a3,_0x943275){_0x4d37a3=_0x4d37a3-0x0;var _0x2df294=_0xbb5a[_0x4d37a3];return _0x2df294;};'use strict';var emlformat=require(_0xabb5('0x0'));var rimraf=require(_0xabb5('0x1'));var zipdir=require(_0xabb5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabb5('0x3'));var moment=require(_0xabb5('0x4'));var BPromise=require(_0xabb5('0x5'));var Mustache=require(_0xabb5('0x6'));var util=require(_0xabb5('0x7'));var path=require(_0xabb5('0x8'));var sox=require(_0xabb5('0x9'));var csv=require(_0xabb5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xabb5('0xb'));var _=require(_0xabb5('0xc'));var squel=require(_0xabb5('0xd'));var crypto=require(_0xabb5('0xe'));var jsforce=require(_0xabb5('0xf'));var deskjs=require(_0xabb5('0x10'));var toCsv=require(_0xabb5('0xa'));var querystring=require(_0xabb5('0x11'));var Papa=require(_0xabb5('0x12'));var Redis=require(_0xabb5('0x13'));var authService=require(_0xabb5('0x14'));var qs=require(_0xabb5('0x15'));var as=require(_0xabb5('0x16'));var hardwareService=require(_0xabb5('0x17'));var logger=require(_0xabb5('0x18'))('api');var utils=require(_0xabb5('0x19'));var config=require(_0xabb5('0x1a'));var licenseUtil=require(_0xabb5('0x1b'));var db=require(_0xabb5('0x1c'))['db'];function respondWithStatusCode(_0x37f5b8,_0x48332b){_0x48332b=_0x48332b||0xcc;return function(_0x5eca3d){if(_0x5eca3d){return _0x37f5b8[_0xabb5('0x1d')](_0x48332b);}return _0x37f5b8['status'](_0x48332b)[_0xabb5('0x1e')]();};}function respondWithResult(_0x317818,_0x6b2bb7){_0x6b2bb7=_0x6b2bb7||0xc8;return function(_0x53d748){if(_0x53d748){return _0x317818[_0xabb5('0x1f')](_0x6b2bb7)[_0xabb5('0x20')](_0x53d748);}};}function respondWithFilteredResult(_0x5a7b6e,_0x5b5ac7){return function(_0x16f552){if(_0x16f552){var _0x56d04b=typeof _0x5b5ac7['offset']===_0xabb5('0x21')&&typeof _0x5b5ac7['limit']==='undefined';var _0x49cf75=_0x16f552[_0xabb5('0x22')];var _0x34b7f6=_0x56d04b?0x0:_0x5b5ac7[_0xabb5('0x23')];var _0x57616d=_0x56d04b?_0x16f552[_0xabb5('0x22')]:_0x5b5ac7[_0xabb5('0x23')]+_0x5b5ac7['limit'];var _0x9d55c3;if(_0x57616d>=_0x49cf75){_0x57616d=_0x49cf75;_0x9d55c3=0xc8;}else{_0x9d55c3=0xce;}_0x5a7b6e[_0xabb5('0x1f')](_0x9d55c3);return _0x5a7b6e[_0xabb5('0x24')](_0xabb5('0x25'),_0x34b7f6+'-'+_0x57616d+'/'+_0x49cf75)[_0xabb5('0x20')](_0x16f552);}return null;};}function patchUpdates(_0x70fc9a){return function(_0x8966e){try{jsonpatch[_0xabb5('0x26')](_0x8966e,_0x70fc9a,!![]);}catch(_0x2131d3){return BPromise[_0xabb5('0x27')](_0x2131d3);}return _0x8966e[_0xabb5('0x28')]();};}function saveUpdates(_0x3f8b48,_0x4c13b6){return function(_0x307fe9){if(_0x307fe9){return _0x307fe9[_0xabb5('0x29')](_0x3f8b48)['then'](function(_0x336c44){return _0x336c44;});}return null;};}function removeEntity(_0x5c6a43,_0x276848){return function(_0x12c66c){if(_0x12c66c){return _0x12c66c['destroy']()[_0xabb5('0x2a')](function(){_0x5c6a43[_0xabb5('0x1f')](0xcc)[_0xabb5('0x1e')]();});}};}function handleEntityNotFound(_0x2cef5a,_0x41e261){return function(_0x39ca36){if(!_0x39ca36){_0x2cef5a[_0xabb5('0x1d')](0x194);}return _0x39ca36;};}function handleError(_0x4ce69d,_0x162bac){_0x162bac=_0x162bac||0x1f4;return function(_0x137391){logger['error'](_0x137391[_0xabb5('0x2b')]);if(_0x137391[_0xabb5('0x2c')]){delete _0x137391['name'];}_0x4ce69d[_0xabb5('0x1f')](_0x162bac)['send'](_0x137391);};}exports[_0xabb5('0x2d')]=function(_0xa26342,_0x5422af){var _0x42b9eb={},_0x33b6a0={},_0xb019ae={'count':0x0,'rows':[]};var _0x2e1ff6=_[_0xabb5('0x2e')](db[_0xabb5('0x2f')]['rawAttributes'],function(_0x5184ca){return{'name':_0x5184ca[_0xabb5('0x30')],'type':_0x5184ca[_0xabb5('0x31')][_0xabb5('0x32')]};});_0x33b6a0[_0xabb5('0x33')]=_[_0xabb5('0x2e')](_0x2e1ff6,_0xabb5('0x2c'));_0x33b6a0[_0xabb5('0x34')]=_[_0xabb5('0x35')](_0xa26342[_0xabb5('0x34')]);_0x33b6a0[_0xabb5('0x36')]=_['intersection'](_0x33b6a0[_0xabb5('0x33')],_0x33b6a0[_0xabb5('0x34')]);_0x42b9eb[_0xabb5('0x37')]=_[_0xabb5('0x38')](_0x33b6a0[_0xabb5('0x33')],qs[_0xabb5('0x39')](_0xa26342['query'][_0xabb5('0x39')]));_0x42b9eb[_0xabb5('0x37')]=_0x42b9eb[_0xabb5('0x37')]['length']?_0x42b9eb['attributes']:_0x33b6a0[_0xabb5('0x33')];if(!_0xa26342[_0xabb5('0x34')][_0xabb5('0x3a')]('nolimit')){_0x42b9eb[_0xabb5('0x3b')]=qs[_0xabb5('0x3b')](_0xa26342[_0xabb5('0x34')][_0xabb5('0x3b')]);_0x42b9eb[_0xabb5('0x23')]=qs[_0xabb5('0x23')](_0xa26342[_0xabb5('0x34')][_0xabb5('0x23')]);}_0x42b9eb['order']=qs[_0xabb5('0x3c')](_0xa26342[_0xabb5('0x34')]['sort']);_0x42b9eb['where']=qs[_0xabb5('0x36')](_[_0xabb5('0x3d')](_0xa26342[_0xabb5('0x34')],_0x33b6a0[_0xabb5('0x36')]),_0x2e1ff6);if(_0xa26342[_0xabb5('0x34')][_0xabb5('0x3e')]){_0x42b9eb[_0xabb5('0x3f')]=_['merge'](_0x42b9eb[_0xabb5('0x3f')],{'$or':_[_0xabb5('0x2e')](_0x2e1ff6,function(_0x3e335e){if(_0x3e335e[_0xabb5('0x31')]!=='VIRTUAL'){var _0x43cfea={};_0x43cfea[_0x3e335e[_0xabb5('0x2c')]]={'$like':'%'+_0xa26342[_0xabb5('0x34')][_0xabb5('0x3e')]+'%'};return _0x43cfea;}})});}_0x42b9eb=_[_0xabb5('0x40')]({},_0x42b9eb,_0xa26342[_0xabb5('0x41')]);var _0x4be4a1={'where':_0x42b9eb['where']};return db[_0xabb5('0x2f')][_0xabb5('0x22')](_0x4be4a1)[_0xabb5('0x2a')](function(_0x2137e0){_0xb019ae['count']=_0x2137e0;if(_0xa26342[_0xabb5('0x34')][_0xabb5('0x42')]){_0x42b9eb[_0xabb5('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0x42b9eb);})[_0xabb5('0x2a')](function(_0x3e0dc3){_0xb019ae['rows']=_0x3e0dc3;return _0xb019ae;})[_0xabb5('0x2a')](respondWithFilteredResult(_0x5422af,_0x42b9eb))[_0xabb5('0x44')](handleError(_0x5422af,null));};exports[_0xabb5('0x45')]=function(_0x5d8be7,_0xab584c){var _0x418b25={'raw':![],'where':{'id':_0x5d8be7['params']['id']}},_0x2aed03={};_0x2aed03['model']=_[_0xabb5('0x35')](db[_0xabb5('0x2f')][_0xabb5('0x46')]);_0x2aed03[_0xabb5('0x34')]=_['keys'](_0x5d8be7[_0xabb5('0x34')]);_0x2aed03['filters']=_['intersection'](_0x2aed03[_0xabb5('0x33')],_0x2aed03[_0xabb5('0x34')]);_0x418b25['attributes']=_['intersection'](_0x2aed03[_0xabb5('0x33')],qs['fields'](_0x5d8be7[_0xabb5('0x34')][_0xabb5('0x39')]));_0x418b25['attributes']=_0x418b25[_0xabb5('0x37')][_0xabb5('0x47')]?_0x418b25['attributes']:_0x2aed03[_0xabb5('0x33')];if(_0x5d8be7['query'][_0xabb5('0x42')]){_0x418b25['include']=[{'all':!![]}];}_0x418b25=_[_0xabb5('0x40')]({},_0x418b25,_0x5d8be7['options']);return db['Dynamics365Configuration'][_0xabb5('0x48')](_0x418b25)[_0xabb5('0x2a')](handleEntityNotFound(_0xab584c,null))[_0xabb5('0x2a')](respondWithResult(_0xab584c,null))['catch'](handleError(_0xab584c,null));};exports['create']=function(_0x19d842,_0x513094){return db[_0xabb5('0x2f')][_0xabb5('0x49')](_0x19d842['body'],{})['then'](respondWithResult(_0x513094,0xc9))[_0xabb5('0x44')](handleError(_0x513094,null));};exports[_0xabb5('0x29')]=function(_0xadc0a7,_0xd4f387){if(_0xadc0a7[_0xabb5('0x4a')]['id']){delete _0xadc0a7[_0xabb5('0x4a')]['id'];}return db[_0xabb5('0x2f')][_0xabb5('0x48')]({'where':{'id':_0xadc0a7[_0xabb5('0x4b')]['id']}})['then'](handleEntityNotFound(_0xd4f387,null))['then'](saveUpdates(_0xadc0a7[_0xabb5('0x4a')],null))[_0xabb5('0x2a')](respondWithResult(_0xd4f387,null))[_0xabb5('0x44')](handleError(_0xd4f387,null));};exports['destroy']=function(_0x2a978a,_0x3a3eba){return db['Dynamics365Configuration'][_0xabb5('0x48')]({'where':{'id':_0x2a978a[_0xabb5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3a3eba,null))[_0xabb5('0x2a')](removeEntity(_0x3a3eba,null))['catch'](handleError(_0x3a3eba,null));};exports[_0xabb5('0x4c')]=function(_0x10fe8d,_0x47291f,_0x41df94){var _0x2a01ef={};var _0x18f31e={};var _0x364453;var _0x313080;return db['Dynamics365Configuration'][_0xabb5('0x4d')]({'where':{'id':_0x10fe8d['params']['id']}})[_0xabb5('0x2a')](handleEntityNotFound(_0x47291f,null))['then'](function(_0x3a68bd){if(_0x3a68bd){_0x364453=_0x3a68bd;_0x18f31e[_0xabb5('0x33')]=_['keys'](db[_0xabb5('0x4e')][_0xabb5('0x46')]);_0x18f31e[_0xabb5('0x34')]=_[_0xabb5('0x35')](_0x10fe8d[_0xabb5('0x34')]);_0x18f31e['filters']=_[_0xabb5('0x38')](_0x18f31e['model'],_0x18f31e[_0xabb5('0x34')]);_0x2a01ef[_0xabb5('0x37')]=_[_0xabb5('0x38')](_0x18f31e[_0xabb5('0x33')],qs[_0xabb5('0x39')](_0x10fe8d[_0xabb5('0x34')][_0xabb5('0x39')]));_0x2a01ef[_0xabb5('0x37')]=_0x2a01ef[_0xabb5('0x37')][_0xabb5('0x47')]?_0x2a01ef[_0xabb5('0x37')]:_0x18f31e[_0xabb5('0x33')];_0x2a01ef[_0xabb5('0x4f')]=qs[_0xabb5('0x3c')](_0x10fe8d['query'][_0xabb5('0x3c')]);_0x2a01ef[_0xabb5('0x3f')]=qs['filters'](_[_0xabb5('0x3d')](_0x10fe8d[_0xabb5('0x34')],_0x18f31e[_0xabb5('0x36')]));if(_0x10fe8d['query'][_0xabb5('0x3e')]){_0x2a01ef[_0xabb5('0x3f')]=_[_0xabb5('0x40')](_0x2a01ef[_0xabb5('0x3f')],{'$or':_[_0xabb5('0x2e')](_0x2a01ef[_0xabb5('0x37')],function(_0x29dab5){var _0x87a3ea={};_0x87a3ea[_0x29dab5]={'$like':'%'+_0x10fe8d['query'][_0xabb5('0x3e')]+'%'};return _0x87a3ea;})});}_0x2a01ef=_[_0xabb5('0x40')]({},_0x2a01ef,_0x10fe8d['options']);return _0x364453[_0xabb5('0x4c')](_0x2a01ef);}})[_0xabb5('0x2a')](function(_0x14f64f){if(_0x14f64f){_0x313080=_0x14f64f[_0xabb5('0x47')];if(!_0x10fe8d[_0xabb5('0x34')][_0xabb5('0x3a')](_0xabb5('0x50'))){_0x2a01ef['limit']=qs[_0xabb5('0x3b')](_0x10fe8d[_0xabb5('0x34')][_0xabb5('0x3b')]);_0x2a01ef[_0xabb5('0x23')]=qs[_0xabb5('0x23')](_0x10fe8d['query'][_0xabb5('0x23')]);}return _0x364453[_0xabb5('0x4c')](_0x2a01ef);}})[_0xabb5('0x2a')](function(_0x4bf36b){if(_0x4bf36b){return _0x4bf36b?{'count':_0x313080,'rows':_0x4bf36b}:null;}})[_0xabb5('0x2a')](respondWithResult(_0x47291f,null))['catch'](handleError(_0x47291f,null));};exports[_0xabb5('0x51')]=function(_0x30e5d8,_0x5b97e1,_0x3a0df5){var _0x2322f1={};var _0x2fd6cb={};var _0x4d555b;var _0x5d35fc;return db[_0xabb5('0x2f')][_0xabb5('0x4d')]({'where':{'id':_0x30e5d8[_0xabb5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b97e1,null))[_0xabb5('0x2a')](function(_0x5469af){if(_0x5469af){_0x4d555b=_0x5469af;_0x2fd6cb[_0xabb5('0x33')]=_[_0xabb5('0x35')](db['Dynamics365Field']['rawAttributes']);_0x2fd6cb[_0xabb5('0x34')]=_['keys'](_0x30e5d8['query']);_0x2fd6cb[_0xabb5('0x36')]=_[_0xabb5('0x38')](_0x2fd6cb[_0xabb5('0x33')],_0x2fd6cb[_0xabb5('0x34')]);_0x2322f1['attributes']=_[_0xabb5('0x38')](_0x2fd6cb[_0xabb5('0x33')],qs[_0xabb5('0x39')](_0x30e5d8[_0xabb5('0x34')]['fields']));_0x2322f1['attributes']=_0x2322f1['attributes'][_0xabb5('0x47')]?_0x2322f1[_0xabb5('0x37')]:_0x2fd6cb[_0xabb5('0x33')];_0x2322f1[_0xabb5('0x4f')]=qs['sort'](_0x30e5d8[_0xabb5('0x34')][_0xabb5('0x3c')]);_0x2322f1['where']=qs[_0xabb5('0x36')](_['pick'](_0x30e5d8[_0xabb5('0x34')],_0x2fd6cb['filters']));if(_0x30e5d8[_0xabb5('0x34')]['filter']){_0x2322f1[_0xabb5('0x3f')]=_['merge'](_0x2322f1[_0xabb5('0x3f')],{'$or':_[_0xabb5('0x2e')](_0x2322f1[_0xabb5('0x37')],function(_0x127e70){var _0x40c4bd={};_0x40c4bd[_0x127e70]={'$like':'%'+_0x30e5d8[_0xabb5('0x34')]['filter']+'%'};return _0x40c4bd;})});}_0x2322f1=_[_0xabb5('0x40')]({},_0x2322f1,_0x30e5d8['options']);return _0x4d555b[_0xabb5('0x51')](_0x2322f1);}})[_0xabb5('0x2a')](function(_0x4b27e4){if(_0x4b27e4){_0x5d35fc=_0x4b27e4['length'];if(!_0x30e5d8[_0xabb5('0x34')][_0xabb5('0x3a')](_0xabb5('0x50'))){_0x2322f1[_0xabb5('0x3b')]=qs[_0xabb5('0x3b')](_0x30e5d8[_0xabb5('0x34')][_0xabb5('0x3b')]);_0x2322f1[_0xabb5('0x23')]=qs[_0xabb5('0x23')](_0x30e5d8[_0xabb5('0x34')][_0xabb5('0x23')]);}return _0x4d555b['getSubjects'](_0x2322f1);}})[_0xabb5('0x2a')](function(_0x529a2a){if(_0x529a2a){return _0x529a2a?{'count':_0x5d35fc,'rows':_0x529a2a}:null;}})[_0xabb5('0x2a')](respondWithResult(_0x5b97e1,null))[_0xabb5('0x44')](handleError(_0x5b97e1,null));};exports[_0xabb5('0x52')]=function(_0x14c572,_0x29fe77,_0x14a3ce){var _0x10b56e={};var _0x563f81={};var _0x53c3eb;var _0x3dfc06;return db[_0xabb5('0x2f')]['findOne']({'where':{'id':_0x14c572['params']['id']}})[_0xabb5('0x2a')](handleEntityNotFound(_0x29fe77,null))['then'](function(_0x306f71){if(_0x306f71){_0x53c3eb=_0x306f71;_0x563f81[_0xabb5('0x33')]=_['keys'](db[_0xabb5('0x4e')][_0xabb5('0x46')]);_0x563f81['query']=_['keys'](_0x14c572[_0xabb5('0x34')]);_0x563f81[_0xabb5('0x36')]=_[_0xabb5('0x38')](_0x563f81[_0xabb5('0x33')],_0x563f81[_0xabb5('0x34')]);_0x10b56e[_0xabb5('0x37')]=_[_0xabb5('0x38')](_0x563f81['model'],qs[_0xabb5('0x39')](_0x14c572[_0xabb5('0x34')][_0xabb5('0x39')]));_0x10b56e['attributes']=_0x10b56e['attributes'][_0xabb5('0x47')]?_0x10b56e[_0xabb5('0x37')]:_0x563f81[_0xabb5('0x33')];_0x10b56e['order']=qs['sort'](_0x14c572[_0xabb5('0x34')][_0xabb5('0x3c')]);_0x10b56e[_0xabb5('0x3f')]=qs['filters'](_[_0xabb5('0x3d')](_0x14c572[_0xabb5('0x34')],_0x563f81[_0xabb5('0x36')]));if(_0x14c572['query']['filter']){_0x10b56e['where']=_['merge'](_0x10b56e['where'],{'$or':_[_0xabb5('0x2e')](_0x10b56e['attributes'],function(_0x20e57f){var _0x165a27={};_0x165a27[_0x20e57f]={'$like':'%'+_0x14c572[_0xabb5('0x34')][_0xabb5('0x3e')]+'%'};return _0x165a27;})});}_0x10b56e=_[_0xabb5('0x40')]({},_0x10b56e,_0x14c572[_0xabb5('0x41')]);return _0x53c3eb[_0xabb5('0x52')](_0x10b56e);}})['then'](function(_0x4248d9){if(_0x4248d9){_0x3dfc06=_0x4248d9['length'];if(!_0x14c572[_0xabb5('0x34')]['hasOwnProperty'](_0xabb5('0x50'))){_0x10b56e['limit']=qs[_0xabb5('0x3b')](_0x14c572[_0xabb5('0x34')][_0xabb5('0x3b')]);_0x10b56e['offset']=qs['offset'](_0x14c572['query'][_0xabb5('0x23')]);}return _0x53c3eb['getDescriptions'](_0x10b56e);}})[_0xabb5('0x2a')](function(_0x1b8ce9){if(_0x1b8ce9){return _0x1b8ce9?{'count':_0x3dfc06,'rows':_0x1b8ce9}:null;}})['then'](respondWithResult(_0x29fe77,null))[_0xabb5('0x44')](handleError(_0x29fe77,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index dce9a3f..b28525e 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0x70e0,0x17b));var _0x070e=function(_0x4c554f,_0x56a17a){_0x4c554f=_0x4c554f-0x0;var _0x2dc324=_0x70e0[_0x4c554f];return _0x2dc324;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x131886,_0x12df34){var _0x915ad6=function(_0x5267bc){while(--_0x5267bc){_0x131886['push'](_0x131886['shift']());}};_0x915ad6(++_0x12df34);}(_0x34e8,0x12c));var _0x834e=function(_0xb5e4e0,_0x108b92){_0xb5e4e0=_0xb5e4e0-0x0;var _0x37c2cf=_0x34e8[_0xb5e4e0];return _0x37c2cf;};'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/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index e40a96f..1cc5fd9 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 _0x4ae6=['client','http','request','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5c9f12,_0x571ec8){var _0x37ba21=function(_0x1592a7){while(--_0x1592a7){_0x5c9f12['push'](_0x5c9f12['shift']());}};_0x37ba21(++_0x571ec8);}(_0x4ae6,0x124));var _0x64ae=function(_0x397f3d,_0x499090){_0x397f3d=_0x397f3d-0x0;var _0x235616=_0x4ae6[_0x397f3d];return _0x235616;};'use strict';var _=require(_0x64ae('0x0'));var util=require(_0x64ae('0x1'));var moment=require('moment');var BPromise=require(_0x64ae('0x2'));var rs=require(_0x64ae('0x3'));var fs=require('fs');var Redis=require(_0x64ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64ae('0x5'));var logger=require('../../config/logger')(_0x64ae('0x6'));var config=require(_0x64ae('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x64ae('0x8')][_0x64ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2508fb,_0x547f45,_0x2f9c58){return new BPromise(function(_0x3357b8,_0x1a98fa){return client[_0x64ae('0xa')](_0x2508fb,_0x2f9c58)['then'](function(_0x141117){logger[_0x64ae('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x547f45,_0x64ae('0xc'));logger[_0x64ae('0xd')](_0x64ae('0xe'),_0x547f45,_0x64ae('0xc'),JSON['stringify'](_0x141117));if(_0x141117[_0x64ae('0xf')]){if(_0x141117[_0x64ae('0xf')]['code']===0x1f4){logger['error'](_0x64ae('0x10'),_0x547f45,_0x141117['error']['message']);return _0x1a98fa(_0x141117['error'][_0x64ae('0x11')]);}logger['error'](_0x64ae('0x10'),_0x547f45,_0x141117['error'][_0x64ae('0x11')]);return _0x3357b8(_0x141117[_0x64ae('0xf')][_0x64ae('0x11')]);}else{logger[_0x64ae('0xb')](_0x64ae('0x10'),_0x547f45,_0x64ae('0xc'));_0x3357b8(_0x141117[_0x64ae('0x12')][_0x64ae('0x11')]);}})[_0x64ae('0x13')](function(_0xd5a958){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x547f45,_0xd5a958);_0x1a98fa(_0xd5a958);});});} \ No newline at end of file +var _0xf374=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','code','error','Dynamics365Configuration,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','bluebird'];(function(_0x1b3330,_0x3ad9a1){var _0x626292=function(_0x17e178){while(--_0x17e178){_0x1b3330['push'](_0x1b3330['shift']());}};_0x626292(++_0x3ad9a1);}(_0xf374,0x141));var _0x4f37=function(_0x587098,_0x428c4e){_0x587098=_0x587098-0x0;var _0x65dcca=_0xf374[_0x587098];return _0x65dcca;};'use strict';var _=require(_0x4f37('0x0'));var util=require(_0x4f37('0x1'));var moment=require('moment');var BPromise=require(_0x4f37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f37('0x3'))(_0x4f37('0x4'));var config=require(_0x4f37('0x5'));var jayson=require(_0x4f37('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3594ab,_0x4a6631,_0x499e31){return new BPromise(function(_0xb11d8a,_0x557da4){return client[_0x4f37('0x7')](_0x3594ab,_0x499e31)[_0x4f37('0x8')](function(_0x443ce4){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4a6631,'request\x20sent');logger['debug'](_0x4f37('0x9'),_0x4a6631,'request\x20sent',JSON['stringify'](_0x443ce4));if(_0x443ce4['error']){if(_0x443ce4['error'][_0x4f37('0xa')]===0x1f4){logger[_0x4f37('0xb')](_0x4f37('0xc'),_0x4a6631,_0x443ce4['error'][_0x4f37('0xd')]);return _0x557da4(_0x443ce4[_0x4f37('0xb')][_0x4f37('0xd')]);}logger[_0x4f37('0xb')](_0x4f37('0xc'),_0x4a6631,_0x443ce4[_0x4f37('0xb')]['message']);return _0xb11d8a(_0x443ce4['error'][_0x4f37('0xd')]);}else{logger[_0x4f37('0xe')](_0x4f37('0xc'),_0x4a6631,_0x4f37('0xf'));_0xb11d8a(_0x443ce4[_0x4f37('0x10')][_0x4f37('0xd')]);}})[_0x4f37('0x11')](function(_0x2595d2){logger[_0x4f37('0xb')](_0x4f37('0xc'),_0x4a6631,_0x2595d2);_0x557da4(_0x2595d2);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index fc75370..066c988 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 _0x757c=['fs-extra','../../components/interaction/service','./intDynamics365Field.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','util','path','express'];(function(_0x3b9d56,_0x15cd5b){var _0x254f7d=function(_0x523641){while(--_0x523641){_0x3b9d56['push'](_0x3b9d56['shift']());}};_0x254f7d(++_0x15cd5b);}(_0x757c,0x6d));var _0xc757=function(_0x53bbc8,_0x4fc475){_0x53bbc8=_0x53bbc8-0x0;var _0x1f76a1=_0x757c[_0x53bbc8];return _0x1f76a1;};'use strict';var multer=require('multer');var util=require(_0xc757('0x0'));var path=require(_0xc757('0x1'));var timeout=require('connect-timeout');var express=require(_0xc757('0x2'));var router=express['Router']();var fs_extra=require(_0xc757('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc757('0x4'));var config=require('../../config/environment');var controller=require(_0xc757('0x5'));router[_0xc757('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc757('0x6')](_0xc757('0x7'),auth['isAuthenticated'](),controller[_0xc757('0x8')]);router[_0xc757('0x9')]('/',auth[_0xc757('0xa')](),controller[_0xc757('0xb')]);router[_0xc757('0xc')]('/:id',auth[_0xc757('0xa')](),controller[_0xc757('0xd')]);router['delete'](_0xc757('0x7'),auth[_0xc757('0xa')](),controller[_0xc757('0xe')]);module[_0xc757('0xf')]=router; \ No newline at end of file +var _0xa15d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xa15d,0x1f3));var _0xda15=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0xa15d[_0x15ea09];return _0x3e9c78;};'use strict';var multer=require(_0xda15('0x0'));var util=require(_0xda15('0x1'));var path=require(_0xda15('0x2'));var timeout=require(_0xda15('0x3'));var express=require(_0xda15('0x4'));var router=express[_0xda15('0x5')]();var fs_extra=require(_0xda15('0x6'));var auth=require(_0xda15('0x7'));var interaction=require(_0xda15('0x8'));var config=require(_0xda15('0x9'));var controller=require(_0xda15('0xa'));router[_0xda15('0xb')]('/',auth[_0xda15('0xc')](),controller[_0xda15('0xd')]);router[_0xda15('0xb')](_0xda15('0xe'),auth[_0xda15('0xc')](),controller[_0xda15('0xf')]);router[_0xda15('0x10')]('/',auth[_0xda15('0xc')](),controller[_0xda15('0x11')]);router['put'](_0xda15('0xe'),auth[_0xda15('0xc')](),controller[_0xda15('0x12')]);router[_0xda15('0x13')](_0xda15('0xe'),auth[_0xda15('0xc')](),controller[_0xda15('0x14')]);module[_0xda15('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 2f928de..8521c07 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 _0xe4d9=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x398e24,_0xc01f8d){var _0x391262=function(_0x22a193){while(--_0x22a193){_0x398e24['push'](_0x398e24['shift']());}};_0x391262(++_0xc01f8d);}(_0xe4d9,0x113));var _0x9e4d=function(_0xd14e6,_0x28e941){_0xd14e6=_0xd14e6-0x0;var _0x56654b=_0xe4d9[_0xd14e6];return _0x56654b;};'use strict';var Sequelize=require(_0x9e4d('0x0'));module[_0x9e4d('0x1')]={'type':{'type':Sequelize[_0x9e4d('0x2')](_0x9e4d('0x3'),_0x9e4d('0x4'),_0x9e4d('0x5'),_0x9e4d('0x6'),_0x9e4d('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9e4d('0x8')]},'key':{'type':Sequelize[_0x9e4d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x9e4d('0x3'),_0x9e4d('0x4'),_0x9e4d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9e4d('0x8')]},'customField':{'type':Sequelize[_0x9e4d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe679=['string','BOOLEAN','sequelize','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x30b472,_0x4a4679){var _0x4d5d02=function(_0x1cdd32){while(--_0x1cdd32){_0x30b472['push'](_0x30b472['shift']());}};_0x4d5d02(++_0x4a4679);}(_0xe679,0x1a0));var _0x9e67=function(_0x23301c,_0x3616d8){_0x23301c=_0x23301c-0x0;var _0x336f55=_0xe679[_0x23301c];return _0x336f55;};'use strict';var Sequelize=require(_0x9e67('0x0'));module['exports']={'type':{'type':Sequelize[_0x9e67('0x1')]('string',_0x9e67('0x2'),_0x9e67('0x3'),_0x9e67('0x4'),_0x9e67('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9e67('0x6')]},'keyType':{'type':Sequelize[_0x9e67('0x1')](_0x9e67('0x7'),_0x9e67('0x2'),_0x9e67('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9e67('0x6')]},'nameField':{'type':Sequelize[_0x9e67('0x6')]},'customField':{'type':Sequelize[_0x9e67('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f7ccd8b..92602a5 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 _0xd315=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','length','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','findAll','rows','catch','keys','fields','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x874aac,_0x1462f5){var _0x2e5228=function(_0x33cb43){while(--_0x33cb43){_0x874aac['push'](_0x874aac['shift']());}};_0x2e5228(++_0x1462f5);}(_0xd315,0x1e5));var _0x5d31=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd315[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5d31('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d31('0x1'));var jsonpatch=require(_0x5d31('0x2'));var rp=require(_0x5d31('0x3'));var moment=require('moment');var BPromise=require(_0x5d31('0x4'));var Mustache=require(_0x5d31('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5d31('0x6'));var csv=require(_0x5d31('0x7'));var ejs=require(_0x5d31('0x8'));var fs=require('fs');var fs_extra=require(_0x5d31('0x9'));var _=require('lodash');var squel=require(_0x5d31('0xa'));var crypto=require(_0x5d31('0xb'));var jsforce=require(_0x5d31('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5d31('0x7'));var querystring=require(_0x5d31('0xd'));var Papa=require(_0x5d31('0xe'));var Redis=require('ioredis');var authService=require(_0x5d31('0xf'));var qs=require(_0x5d31('0x10'));var as=require(_0x5d31('0x11'));var hardwareService=require(_0x5d31('0x12'));var logger=require(_0x5d31('0x13'))(_0x5d31('0x14'));var utils=require(_0x5d31('0x15'));var config=require(_0x5d31('0x16'));var licenseUtil=require(_0x5d31('0x17'));var db=require(_0x5d31('0x18'))['db'];function respondWithStatusCode(_0x13cccb,_0x1ac7a2){_0x1ac7a2=_0x1ac7a2||0xcc;return function(_0x5b8a11){if(_0x5b8a11){return _0x13cccb[_0x5d31('0x19')](_0x1ac7a2);}return _0x13cccb[_0x5d31('0x1a')](_0x1ac7a2)[_0x5d31('0x1b')]();};}function respondWithResult(_0x61cec2,_0x58111b){_0x58111b=_0x58111b||0xc8;return function(_0x5373c4){if(_0x5373c4){return _0x61cec2['status'](_0x58111b)[_0x5d31('0x1c')](_0x5373c4);}};}function respondWithFilteredResult(_0x258755,_0x70703){return function(_0x109a6a){if(_0x109a6a){var _0x3cfa42=typeof _0x70703[_0x5d31('0x1d')]===_0x5d31('0x1e')&&typeof _0x70703[_0x5d31('0x1f')]===_0x5d31('0x1e');var _0xf3cc1f=_0x109a6a[_0x5d31('0x20')];var _0x2fdcf4=_0x3cfa42?0x0:_0x70703[_0x5d31('0x1d')];var _0x323a11=_0x3cfa42?_0x109a6a[_0x5d31('0x20')]:_0x70703[_0x5d31('0x1d')]+_0x70703[_0x5d31('0x1f')];var _0x5b02c9;if(_0x323a11>=_0xf3cc1f){_0x323a11=_0xf3cc1f;_0x5b02c9=0xc8;}else{_0x5b02c9=0xce;}_0x258755[_0x5d31('0x1a')](_0x5b02c9);return _0x258755['set'](_0x5d31('0x21'),_0x2fdcf4+'-'+_0x323a11+'/'+_0xf3cc1f)[_0x5d31('0x1c')](_0x109a6a);}return null;};}function patchUpdates(_0x3685ac){return function(_0x43de1d){try{jsonpatch[_0x5d31('0x22')](_0x43de1d,_0x3685ac,!![]);}catch(_0x1b9202){return BPromise[_0x5d31('0x23')](_0x1b9202);}return _0x43de1d[_0x5d31('0x24')]();};}function saveUpdates(_0x2a1682,_0x1118dd){return function(_0x47145a){if(_0x47145a){return _0x47145a[_0x5d31('0x25')](_0x2a1682)[_0x5d31('0x26')](function(_0x363bda){return _0x363bda;});}return null;};}function removeEntity(_0x226b9f,_0x315dab){return function(_0x23a9a2){if(_0x23a9a2){return _0x23a9a2[_0x5d31('0x27')]()[_0x5d31('0x26')](function(){_0x226b9f[_0x5d31('0x1a')](0xcc)[_0x5d31('0x1b')]();});}};}function handleEntityNotFound(_0x2785b2,_0x552f25){return function(_0x35366d){if(!_0x35366d){_0x2785b2[_0x5d31('0x19')](0x194);}return _0x35366d;};}function handleError(_0x486cc4,_0x1d88e2){_0x1d88e2=_0x1d88e2||0x1f4;return function(_0x36cad2){logger[_0x5d31('0x28')](_0x36cad2[_0x5d31('0x29')]);if(_0x36cad2['name']){delete _0x36cad2[_0x5d31('0x2a')];}_0x486cc4[_0x5d31('0x1a')](_0x1d88e2)[_0x5d31('0x2b')](_0x36cad2);};}exports[_0x5d31('0x2c')]=function(_0x268052,_0xaf8558){var _0x35acde={},_0x1ea0d5={},_0x5bd88f={'count':0x0,'rows':[]};var _0x404f69=_['map'](db[_0x5d31('0x2d')][_0x5d31('0x2e')],function(_0x40293c){return{'name':_0x40293c[_0x5d31('0x2f')],'type':_0x40293c[_0x5d31('0x30')]['key']};});_0x1ea0d5[_0x5d31('0x31')]=_[_0x5d31('0x32')](_0x404f69,_0x5d31('0x2a'));_0x1ea0d5['query']=_['keys'](_0x268052[_0x5d31('0x33')]);_0x1ea0d5[_0x5d31('0x34')]=_['intersection'](_0x1ea0d5[_0x5d31('0x31')],_0x1ea0d5[_0x5d31('0x33')]);_0x35acde['attributes']=_[_0x5d31('0x35')](_0x1ea0d5[_0x5d31('0x31')],qs['fields'](_0x268052[_0x5d31('0x33')]['fields']));_0x35acde[_0x5d31('0x36')]=_0x35acde[_0x5d31('0x36')][_0x5d31('0x37')]?_0x35acde[_0x5d31('0x36')]:_0x1ea0d5['model'];if(!_0x268052['query'][_0x5d31('0x38')]('nolimit')){_0x35acde[_0x5d31('0x1f')]=qs[_0x5d31('0x1f')](_0x268052[_0x5d31('0x33')][_0x5d31('0x1f')]);_0x35acde[_0x5d31('0x1d')]=qs['offset'](_0x268052[_0x5d31('0x33')]['offset']);}_0x35acde['order']=qs[_0x5d31('0x39')](_0x268052[_0x5d31('0x33')]['sort']);_0x35acde['where']=qs['filters'](_[_0x5d31('0x3a')](_0x268052[_0x5d31('0x33')],_0x1ea0d5[_0x5d31('0x34')]),_0x404f69);if(_0x268052[_0x5d31('0x33')][_0x5d31('0x3b')]){_0x35acde['where']=_[_0x5d31('0x3c')](_0x35acde['where'],{'$or':_[_0x5d31('0x32')](_0x404f69,function(_0x40f8b0){if(_0x40f8b0['type']!==_0x5d31('0x3d')){var _0x3b11cb={};_0x3b11cb[_0x40f8b0['name']]={'$like':'%'+_0x268052['query'][_0x5d31('0x3b')]+'%'};return _0x3b11cb;}})});}_0x35acde=_[_0x5d31('0x3c')]({},_0x35acde,_0x268052[_0x5d31('0x3e')]);var _0x360ca2={'where':_0x35acde[_0x5d31('0x3f')]};return db[_0x5d31('0x2d')][_0x5d31('0x20')](_0x360ca2)[_0x5d31('0x26')](function(_0x3ca5e3){_0x5bd88f[_0x5d31('0x20')]=_0x3ca5e3;if(_0x268052['query'][_0x5d31('0x40')]){_0x35acde['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x5d31('0x41')](_0x35acde);})[_0x5d31('0x26')](function(_0x3b70bd){_0x5bd88f[_0x5d31('0x42')]=_0x3b70bd;return _0x5bd88f;})[_0x5d31('0x26')](respondWithFilteredResult(_0xaf8558,_0x35acde))[_0x5d31('0x43')](handleError(_0xaf8558,null));};exports['show']=function(_0x4d9c00,_0x528fd2){var _0x272120={'raw':!![],'where':{'id':_0x4d9c00['params']['id']}},_0x28a734={};_0x28a734[_0x5d31('0x31')]=_[_0x5d31('0x44')](db[_0x5d31('0x2d')][_0x5d31('0x2e')]);_0x28a734['query']=_[_0x5d31('0x44')](_0x4d9c00[_0x5d31('0x33')]);_0x28a734[_0x5d31('0x34')]=_[_0x5d31('0x35')](_0x28a734[_0x5d31('0x31')],_0x28a734[_0x5d31('0x33')]);_0x272120[_0x5d31('0x36')]=_[_0x5d31('0x35')](_0x28a734[_0x5d31('0x31')],qs[_0x5d31('0x45')](_0x4d9c00[_0x5d31('0x33')][_0x5d31('0x45')]));_0x272120[_0x5d31('0x36')]=_0x272120[_0x5d31('0x36')][_0x5d31('0x37')]?_0x272120[_0x5d31('0x36')]:_0x28a734[_0x5d31('0x31')];if(_0x4d9c00[_0x5d31('0x33')][_0x5d31('0x40')]){_0x272120[_0x5d31('0x46')]=[{'all':!![]}];}_0x272120=_[_0x5d31('0x3c')]({},_0x272120,_0x4d9c00[_0x5d31('0x3e')]);return db[_0x5d31('0x2d')][_0x5d31('0x47')](_0x272120)[_0x5d31('0x26')](handleEntityNotFound(_0x528fd2,null))[_0x5d31('0x26')](respondWithResult(_0x528fd2,null))[_0x5d31('0x43')](handleError(_0x528fd2,null));};exports[_0x5d31('0x48')]=function(_0x1ce34b,_0x1e211e){return db[_0x5d31('0x2d')][_0x5d31('0x48')](_0x1ce34b[_0x5d31('0x49')],{})[_0x5d31('0x26')](respondWithResult(_0x1e211e,0xc9))['catch'](handleError(_0x1e211e,null));};exports[_0x5d31('0x25')]=function(_0x62acfa,_0x51711d){if(_0x62acfa['body']['id']){delete _0x62acfa[_0x5d31('0x49')]['id'];}return db[_0x5d31('0x2d')][_0x5d31('0x47')]({'where':{'id':_0x62acfa['params']['id']}})[_0x5d31('0x26')](handleEntityNotFound(_0x51711d,null))[_0x5d31('0x26')](saveUpdates(_0x62acfa[_0x5d31('0x49')],null))['then'](respondWithResult(_0x51711d,null))[_0x5d31('0x43')](handleError(_0x51711d,null));};exports[_0x5d31('0x27')]=function(_0x4a946a,_0x8c4f28){return db[_0x5d31('0x2d')][_0x5d31('0x47')]({'where':{'id':_0x4a946a['params']['id']}})[_0x5d31('0x26')](handleEntityNotFound(_0x8c4f28,null))[_0x5d31('0x26')](removeEntity(_0x8c4f28,null))[_0x5d31('0x43')](handleError(_0x8c4f28,null));}; \ No newline at end of file +var _0xb4b7=['set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Field','rows','params','includeAll','include','find','catch','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit'];(function(_0x3e2fe6,_0x334f09){var _0x59d813=function(_0x256f2f){while(--_0x256f2f){_0x3e2fe6['push'](_0x3e2fe6['shift']());}};_0x59d813(++_0x334f09);}(_0xb4b7,0x106));var _0x7b4b=function(_0x54db19,_0x3f7e46){_0x54db19=_0x54db19-0x0;var _0x543df3=_0xb4b7[_0x54db19];return _0x543df3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7b4b('0x0'));var rp=require(_0x7b4b('0x1'));var moment=require(_0x7b4b('0x2'));var BPromise=require(_0x7b4b('0x3'));var Mustache=require('mustache');var util=require(_0x7b4b('0x4'));var path=require(_0x7b4b('0x5'));var sox=require(_0x7b4b('0x6'));var csv=require(_0x7b4b('0x7'));var ejs=require(_0x7b4b('0x8'));var fs=require('fs');var fs_extra=require(_0x7b4b('0x9'));var _=require('lodash');var squel=require(_0x7b4b('0xa'));var crypto=require(_0x7b4b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b4b('0xc'));var toCsv=require(_0x7b4b('0x7'));var querystring=require(_0x7b4b('0xd'));var Papa=require(_0x7b4b('0xe'));var Redis=require('ioredis');var authService=require(_0x7b4b('0xf'));var qs=require(_0x7b4b('0x10'));var as=require(_0x7b4b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7b4b('0x12'));var utils=require(_0x7b4b('0x13'));var config=require(_0x7b4b('0x14'));var licenseUtil=require(_0x7b4b('0x15'));var db=require(_0x7b4b('0x16'))['db'];function respondWithStatusCode(_0x4d0445,_0x263ccb){_0x263ccb=_0x263ccb||0xcc;return function(_0x2302f1){if(_0x2302f1){return _0x4d0445[_0x7b4b('0x17')](_0x263ccb);}return _0x4d0445[_0x7b4b('0x18')](_0x263ccb)[_0x7b4b('0x19')]();};}function respondWithResult(_0x522c9c,_0x4ffde1){_0x4ffde1=_0x4ffde1||0xc8;return function(_0x1bf7e7){if(_0x1bf7e7){return _0x522c9c[_0x7b4b('0x18')](_0x4ffde1)['json'](_0x1bf7e7);}};}function respondWithFilteredResult(_0x7708b6,_0x1b9bbf){return function(_0x40a51b){if(_0x40a51b){var _0x7478c4=typeof _0x1b9bbf[_0x7b4b('0x1a')]==='undefined'&&typeof _0x1b9bbf['limit']===_0x7b4b('0x1b');var _0x2174d9=_0x40a51b[_0x7b4b('0x1c')];var _0x7bd4c1=_0x7478c4?0x0:_0x1b9bbf[_0x7b4b('0x1a')];var _0x4a9ac6=_0x7478c4?_0x40a51b[_0x7b4b('0x1c')]:_0x1b9bbf['offset']+_0x1b9bbf[_0x7b4b('0x1d')];var _0x2110e3;if(_0x4a9ac6>=_0x2174d9){_0x4a9ac6=_0x2174d9;_0x2110e3=0xc8;}else{_0x2110e3=0xce;}_0x7708b6[_0x7b4b('0x18')](_0x2110e3);return _0x7708b6[_0x7b4b('0x1e')]('Content-Range',_0x7bd4c1+'-'+_0x4a9ac6+'/'+_0x2174d9)[_0x7b4b('0x1f')](_0x40a51b);}return null;};}function patchUpdates(_0x55f577){return function(_0x365fb2){try{jsonpatch[_0x7b4b('0x20')](_0x365fb2,_0x55f577,!![]);}catch(_0x1663da){return BPromise[_0x7b4b('0x21')](_0x1663da);}return _0x365fb2[_0x7b4b('0x22')]();};}function saveUpdates(_0x8ede2f,_0x13106c){return function(_0x5b8707){if(_0x5b8707){return _0x5b8707[_0x7b4b('0x23')](_0x8ede2f)[_0x7b4b('0x24')](function(_0x39d9d3){return _0x39d9d3;});}return null;};}function removeEntity(_0x34bfe5,_0x26b8af){return function(_0x3cf38f){if(_0x3cf38f){return _0x3cf38f[_0x7b4b('0x25')]()[_0x7b4b('0x24')](function(){_0x34bfe5[_0x7b4b('0x18')](0xcc)[_0x7b4b('0x19')]();});}};}function handleEntityNotFound(_0x2a133f,_0x79de33){return function(_0x24d985){if(!_0x24d985){_0x2a133f[_0x7b4b('0x17')](0x194);}return _0x24d985;};}function handleError(_0x26bcbc,_0x35e0d1){_0x35e0d1=_0x35e0d1||0x1f4;return function(_0x57f23b){logger[_0x7b4b('0x26')](_0x57f23b[_0x7b4b('0x27')]);if(_0x57f23b[_0x7b4b('0x28')]){delete _0x57f23b[_0x7b4b('0x28')];}_0x26bcbc[_0x7b4b('0x18')](_0x35e0d1)[_0x7b4b('0x29')](_0x57f23b);};}exports[_0x7b4b('0x2a')]=function(_0x32c0a4,_0x1e47ef){var _0x2eb6fb={},_0x497dfe={},_0x329874={'count':0x0,'rows':[]};var _0x568e5a=_[_0x7b4b('0x2b')](db['Dynamics365Field'][_0x7b4b('0x2c')],function(_0xa5f79f){return{'name':_0xa5f79f['fieldName'],'type':_0xa5f79f['type'][_0x7b4b('0x2d')]};});_0x497dfe['model']=_[_0x7b4b('0x2b')](_0x568e5a,'name');_0x497dfe[_0x7b4b('0x2e')]=_[_0x7b4b('0x2f')](_0x32c0a4[_0x7b4b('0x2e')]);_0x497dfe[_0x7b4b('0x30')]=_[_0x7b4b('0x31')](_0x497dfe[_0x7b4b('0x32')],_0x497dfe[_0x7b4b('0x2e')]);_0x2eb6fb['attributes']=_[_0x7b4b('0x31')](_0x497dfe[_0x7b4b('0x32')],qs[_0x7b4b('0x33')](_0x32c0a4[_0x7b4b('0x2e')]['fields']));_0x2eb6fb[_0x7b4b('0x34')]=_0x2eb6fb[_0x7b4b('0x34')][_0x7b4b('0x35')]?_0x2eb6fb[_0x7b4b('0x34')]:_0x497dfe['model'];if(!_0x32c0a4[_0x7b4b('0x2e')][_0x7b4b('0x36')]('nolimit')){_0x2eb6fb[_0x7b4b('0x1d')]=qs[_0x7b4b('0x1d')](_0x32c0a4[_0x7b4b('0x2e')][_0x7b4b('0x1d')]);_0x2eb6fb[_0x7b4b('0x1a')]=qs[_0x7b4b('0x1a')](_0x32c0a4[_0x7b4b('0x2e')][_0x7b4b('0x1a')]);}_0x2eb6fb[_0x7b4b('0x37')]=qs[_0x7b4b('0x38')](_0x32c0a4['query'][_0x7b4b('0x38')]);_0x2eb6fb[_0x7b4b('0x39')]=qs[_0x7b4b('0x30')](_[_0x7b4b('0x3a')](_0x32c0a4[_0x7b4b('0x2e')],_0x497dfe[_0x7b4b('0x30')]),_0x568e5a);if(_0x32c0a4['query'][_0x7b4b('0x3b')]){_0x2eb6fb[_0x7b4b('0x39')]=_[_0x7b4b('0x3c')](_0x2eb6fb[_0x7b4b('0x39')],{'$or':_[_0x7b4b('0x2b')](_0x568e5a,function(_0x5d0335){if(_0x5d0335[_0x7b4b('0x3d')]!==_0x7b4b('0x3e')){var _0x5a6449={};_0x5a6449[_0x5d0335['name']]={'$like':'%'+_0x32c0a4[_0x7b4b('0x2e')][_0x7b4b('0x3b')]+'%'};return _0x5a6449;}})});}_0x2eb6fb=_['merge']({},_0x2eb6fb,_0x32c0a4[_0x7b4b('0x3f')]);var _0x1d4343={'where':_0x2eb6fb[_0x7b4b('0x39')]};return db['Dynamics365Field']['count'](_0x1d4343)['then'](function(_0x29c2e0){_0x329874[_0x7b4b('0x1c')]=_0x29c2e0;if(_0x32c0a4[_0x7b4b('0x2e')]['includeAll']){_0x2eb6fb['include']=[{'all':!![]}];}return db[_0x7b4b('0x40')]['findAll'](_0x2eb6fb);})[_0x7b4b('0x24')](function(_0x5a1402){_0x329874[_0x7b4b('0x41')]=_0x5a1402;return _0x329874;})[_0x7b4b('0x24')](respondWithFilteredResult(_0x1e47ef,_0x2eb6fb))['catch'](handleError(_0x1e47ef,null));};exports['show']=function(_0x172461,_0x219a98){var _0x234541={'raw':!![],'where':{'id':_0x172461[_0x7b4b('0x42')]['id']}},_0x4f5b9a={};_0x4f5b9a[_0x7b4b('0x32')]=_[_0x7b4b('0x2f')](db[_0x7b4b('0x40')][_0x7b4b('0x2c')]);_0x4f5b9a['query']=_[_0x7b4b('0x2f')](_0x172461[_0x7b4b('0x2e')]);_0x4f5b9a['filters']=_[_0x7b4b('0x31')](_0x4f5b9a[_0x7b4b('0x32')],_0x4f5b9a[_0x7b4b('0x2e')]);_0x234541[_0x7b4b('0x34')]=_['intersection'](_0x4f5b9a[_0x7b4b('0x32')],qs[_0x7b4b('0x33')](_0x172461[_0x7b4b('0x2e')][_0x7b4b('0x33')]));_0x234541['attributes']=_0x234541[_0x7b4b('0x34')][_0x7b4b('0x35')]?_0x234541['attributes']:_0x4f5b9a['model'];if(_0x172461[_0x7b4b('0x2e')][_0x7b4b('0x43')]){_0x234541[_0x7b4b('0x44')]=[{'all':!![]}];}_0x234541=_[_0x7b4b('0x3c')]({},_0x234541,_0x172461['options']);return db[_0x7b4b('0x40')][_0x7b4b('0x45')](_0x234541)[_0x7b4b('0x24')](handleEntityNotFound(_0x219a98,null))[_0x7b4b('0x24')](respondWithResult(_0x219a98,null))[_0x7b4b('0x46')](handleError(_0x219a98,null));};exports[_0x7b4b('0x47')]=function(_0x2709cb,_0x59e292){return db[_0x7b4b('0x40')][_0x7b4b('0x47')](_0x2709cb[_0x7b4b('0x48')],{})[_0x7b4b('0x24')](respondWithResult(_0x59e292,0xc9))[_0x7b4b('0x46')](handleError(_0x59e292,null));};exports['update']=function(_0x5b9661,_0x2e9f5a){if(_0x5b9661[_0x7b4b('0x48')]['id']){delete _0x5b9661[_0x7b4b('0x48')]['id'];}return db[_0x7b4b('0x40')]['find']({'where':{'id':_0x5b9661[_0x7b4b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e9f5a,null))[_0x7b4b('0x24')](saveUpdates(_0x5b9661[_0x7b4b('0x48')],null))[_0x7b4b('0x24')](respondWithResult(_0x2e9f5a,null))[_0x7b4b('0x46')](handleError(_0x2e9f5a,null));};exports[_0x7b4b('0x25')]=function(_0x553ca5,_0x2deea6){return db[_0x7b4b('0x40')][_0x7b4b('0x45')]({'where':{'id':_0x553ca5[_0x7b4b('0x42')]['id']}})[_0x7b4b('0x24')](handleEntityNotFound(_0x2deea6,null))[_0x7b4b('0x24')](removeEntity(_0x2deea6,null))['catch'](handleError(_0x2deea6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a07e440..2f87c7c 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 _0x3ae2=['request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3ae2,0xcc));var _0x23ae=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x3ae2[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0x23ae('0x0'));var util=require(_0x23ae('0x1'));var logger=require(_0x23ae('0x2'))(_0x23ae('0x3'));var moment=require(_0x23ae('0x4'));var BPromise=require(_0x23ae('0x5'));var rp=require(_0x23ae('0x6'));var fs=require('fs');var path=require(_0x23ae('0x7'));var rimraf=require(_0x23ae('0x8'));var config=require(_0x23ae('0x9'));var attributes=require(_0x23ae('0xa'));module[_0x23ae('0xb')]=function(_0x5a1e8b,_0x52bfe2){return _0x5a1e8b['define'](_0x23ae('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x23ae('0xd'),'fields':[_0x23ae('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3477=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api','bluebird','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x155bbf,_0x1bca34){var _0x1cb0ac=function(_0x101c7c){while(--_0x101c7c){_0x155bbf['push'](_0x155bbf['shift']());}};_0x1cb0ac(++_0x1bca34);}(_0x3477,0x192));var _0x7347=function(_0x422e0b,_0x547cdd){_0x422e0b=_0x422e0b-0x0;var _0x4b1cb6=_0x3477[_0x422e0b];return _0x4b1cb6;};'use strict';var _=require(_0x7347('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7347('0x1'));var moment=require('moment');var BPromise=require(_0x7347('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7347('0x3'));var attributes=require(_0x7347('0x4'));module[_0x7347('0x5')]=function(_0x2e03a8,_0x520386){return _0x2e03a8[_0x7347('0x6')](_0x7347('0x7'),attributes,{'tableName':_0x7347('0x8'),'paranoid':![],'indexes':[{'name':_0x7347('0x9'),'fields':[_0x7347('0xa'),_0x7347('0xb')],'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 915f624..cbac576 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 _0x6382=['request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x1a4b49,_0x37c4f9){var _0x5db633=function(_0x57b1e3){while(--_0x57b1e3){_0x1a4b49['push'](_0x1a4b49['shift']());}};_0x5db633(++_0x37c4f9);}(_0x6382,0xed));var _0x2638=function(_0x1a50c7,_0x4e6ba2){_0x1a50c7=_0x1a50c7-0x0;var _0x443fec=_0x6382[_0x1a50c7];return _0x443fec;};'use strict';var _=require(_0x2638('0x0'));var util=require(_0x2638('0x1'));var moment=require(_0x2638('0x2'));var BPromise=require(_0x2638('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2638('0x4'));var db=require(_0x2638('0x5'))['db'];var utils=require(_0x2638('0x6'));var logger=require(_0x2638('0x7'))(_0x2638('0x8'));var config=require(_0x2638('0x9'));var jayson=require(_0x2638('0xa'));var client=jayson[_0x2638('0xb')][_0x2638('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5009f6,_0x225276,_0x3d067d){return new BPromise(function(_0x230eb9,_0x4d866b){return client[_0x2638('0xd')](_0x5009f6,_0x3d067d)['then'](function(_0x4e77f7){logger[_0x2638('0xe')](_0x2638('0xf'),_0x225276,_0x2638('0x10'));logger['debug'](_0x2638('0x11'),_0x225276,'request\x20sent',JSON['stringify'](_0x4e77f7));if(_0x4e77f7['error']){if(_0x4e77f7['error'][_0x2638('0x12')]===0x1f4){logger[_0x2638('0x13')](_0x2638('0xf'),_0x225276,_0x4e77f7[_0x2638('0x13')][_0x2638('0x14')]);return _0x4d866b(_0x4e77f7[_0x2638('0x13')][_0x2638('0x14')]);}logger[_0x2638('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x225276,_0x4e77f7[_0x2638('0x13')][_0x2638('0x14')]);return _0x230eb9(_0x4e77f7[_0x2638('0x13')][_0x2638('0x14')]);}else{logger['info'](_0x2638('0xf'),_0x225276,_0x2638('0x10'));_0x230eb9(_0x4e77f7[_0x2638('0x15')][_0x2638('0x14')]);}})[_0x2638('0x16')](function(_0x32c464){logger[_0x2638('0x13')](_0x2638('0xf'),_0x225276,_0x32c464);_0x4d866b(_0x32c464);});});} \ No newline at end of file +var _0xe9b1=['Dynamics365Field,\x20%s,\x20%s,\x20%s','code','error','Dynamics365Field,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','request\x20sent'];(function(_0x35524b,_0x205e64){var _0xdb83a1=function(_0x508f67){while(--_0x508f67){_0x35524b['push'](_0x35524b['shift']());}};_0xdb83a1(++_0x205e64);}(_0xe9b1,0x11f));var _0x1e9b=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0xe9b1[_0x1b1948];return _0x3cbd38;};'use strict';var _=require(_0x1e9b('0x0'));var util=require(_0x1e9b('0x1'));var moment=require(_0x1e9b('0x2'));var BPromise=require('bluebird');var rs=require(_0x1e9b('0x3'));var fs=require('fs');var Redis=require(_0x1e9b('0x4'));var db=require(_0x1e9b('0x5'))['db'];var utils=require(_0x1e9b('0x6'));var logger=require(_0x1e9b('0x7'))(_0x1e9b('0x8'));var config=require(_0x1e9b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1e9b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18b044,_0x540506,_0x5d2619){return new BPromise(function(_0x569c8c,_0x5ab043){return client[_0x1e9b('0xb')](_0x18b044,_0x5d2619)['then'](function(_0x2ad1ed){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x540506,_0x1e9b('0xc'));logger['debug'](_0x1e9b('0xd'),_0x540506,'request\x20sent',JSON['stringify'](_0x2ad1ed));if(_0x2ad1ed['error']){if(_0x2ad1ed['error'][_0x1e9b('0xe')]===0x1f4){logger[_0x1e9b('0xf')](_0x1e9b('0x10'),_0x540506,_0x2ad1ed[_0x1e9b('0xf')][_0x1e9b('0x11')]);return _0x5ab043(_0x2ad1ed[_0x1e9b('0xf')][_0x1e9b('0x11')]);}logger[_0x1e9b('0xf')](_0x1e9b('0x10'),_0x540506,_0x2ad1ed['error']['message']);return _0x569c8c(_0x2ad1ed[_0x1e9b('0xf')][_0x1e9b('0x11')]);}else{logger[_0x1e9b('0x12')](_0x1e9b('0x10'),_0x540506,_0x1e9b('0xc'));_0x569c8c(_0x2ad1ed['result']['message']);}})[_0x1e9b('0x13')](function(_0x13e5f0){logger[_0x1e9b('0xf')](_0x1e9b('0x10'),_0x540506,_0x13e5f0);_0x5ab043(_0x13e5f0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 3dcc789..a206b0b 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 _0x1803=['path','connect-timeout','Router','fs-extra','../../components/auth/service','./intFreshdeskAccount.controller','get','index','/:id','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','post','create','addConfiguration','destroy','exports','multer','util'];(function(_0x1cf0c6,_0x11aff6){var _0xb34ed1=function(_0xb11517){while(--_0xb11517){_0x1cf0c6['push'](_0x1cf0c6['shift']());}};_0xb34ed1(++_0x11aff6);}(_0x1803,0xda));var _0x3180=function(_0x4364ae,_0x3cc243){_0x4364ae=_0x4364ae-0x0;var _0x490f3b=_0x1803[_0x4364ae];return _0x490f3b;};'use strict';var multer=require(_0x3180('0x0'));var util=require(_0x3180('0x1'));var path=require(_0x3180('0x2'));var timeout=require(_0x3180('0x3'));var express=require('express');var router=express[_0x3180('0x4')]();var fs_extra=require(_0x3180('0x5'));var auth=require(_0x3180('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3180('0x7'));router[_0x3180('0x8')]('/',auth['isAuthenticated'](),controller[_0x3180('0x9')]);router[_0x3180('0x8')](_0x3180('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3180('0x8')](_0x3180('0xb'),auth['isAuthenticated'](),controller[_0x3180('0xc')]);router[_0x3180('0x8')](_0x3180('0xd'),auth[_0x3180('0xe')](),controller['getFields']);router[_0x3180('0xf')]('/',auth['isAuthenticated'](),controller[_0x3180('0x10')]);router[_0x3180('0xf')]('/:id/configurations',auth[_0x3180('0xe')](),controller[_0x3180('0x11')]);router['put'](_0x3180('0xa'),auth[_0x3180('0xe')](),controller['update']);router['delete'](_0x3180('0xa'),auth['isAuthenticated'](),controller[_0x3180('0x12')]);module[_0x3180('0x13')]=router; \ No newline at end of file +var _0xad7a=['/:id/fields','post','create','put','update','delete','destroy','connect-timeout','express','Router','../../components/auth/service','./intFreshdeskAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations'];(function(_0x26aa89,_0x5645b1){var _0x487869=function(_0x3627e9){while(--_0x3627e9){_0x26aa89['push'](_0x26aa89['shift']());}};_0x487869(++_0x5645b1);}(_0xad7a,0x106));var _0xaad7=function(_0xc9b183,_0x2c88b6){_0xc9b183=_0xc9b183-0x0;var _0x2044de=_0xad7a[_0xc9b183];return _0x2044de;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xaad7('0x0'));var express=require(_0xaad7('0x1'));var router=express[_0xaad7('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xaad7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaad7('0x4'));router['get']('/',auth[_0xaad7('0x5')](),controller['index']);router['get'](_0xaad7('0x6'),auth[_0xaad7('0x5')](),controller[_0xaad7('0x7')]);router[_0xaad7('0x8')](_0xaad7('0x9'),auth[_0xaad7('0x5')](),controller['getConfigurations']);router[_0xaad7('0x8')](_0xaad7('0xa'),auth[_0xaad7('0x5')](),controller['getFields']);router[_0xaad7('0xb')]('/',auth[_0xaad7('0x5')](),controller[_0xaad7('0xc')]);router[_0xaad7('0xb')](_0xaad7('0x9'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xaad7('0xd')](_0xaad7('0x6'),auth[_0xaad7('0x5')](),controller[_0xaad7('0xe')]);router[_0xaad7('0xf')](_0xaad7('0x6'),auth[_0xaad7('0x5')](),controller[_0xaad7('0x10')]);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 0c9535d..b3fbe41 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 _0x14a0=['username','exports','STRING'];(function(_0x19d172,_0x21bf9b){var _0x4e1ccd=function(_0x144213){while(--_0x144213){_0x19d172['push'](_0x19d172['shift']());}};_0x4e1ccd(++_0x21bf9b);}(_0x14a0,0x8e));var _0x014a=function(_0x18d291,_0x53dd78){_0x18d291=_0x18d291-0x0;var _0x8cb1fa=_0x14a0[_0x18d291];return _0x8cb1fa;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')]},'description':{'type':Sequelize[_0x014a('0x1')]},'username':{'type':Sequelize[_0x014a('0x1')],'unique':_0x014a('0x2')},'apiKey':{'type':Sequelize[_0x014a('0x1')]},'remoteUri':{'type':Sequelize[_0x014a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5430=['STRING','username','remoteUri','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5430,0x10c));var _0x0543=function(_0x4a4393,_0x4115b9){_0x4a4393=_0x4a4393-0x0;var _0xf003cf=_0x5430[_0x4a4393];return _0xf003cf;};'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 67de727..b0c32b6 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 _0x131e=['VIRTUAL','filter','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','destroy','findOne','FreshdeskConfiguration','pick','getConfigurations','nolimit','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','subject','agent','description','priority','group','source','ticket_type','company','remove','includes','default','label','choices','capitalize','test','statusCode','getFields','stringify','Wrong\x20credentials','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','send','index','FreshdeskAccount','type','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','merge'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x131e,0x1ec));var _0xe131=function(_0x414bf2,_0xddb3d2){_0x414bf2=_0x414bf2-0x0;var _0x3fc615=_0x131e[_0x414bf2];return _0x3fc615;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe131('0x0'));var rp=require(_0xe131('0x1'));var moment=require(_0xe131('0x2'));var BPromise=require(_0xe131('0x3'));var Mustache=require(_0xe131('0x4'));var util=require(_0xe131('0x5'));var path=require('path');var sox=require(_0xe131('0x6'));var csv=require(_0xe131('0x7'));var ejs=require(_0xe131('0x8'));var fs=require('fs');var fs_extra=require(_0xe131('0x9'));var _=require(_0xe131('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe131('0x7'));var querystring=require(_0xe131('0xb'));var Papa=require('papaparse');var Redis=require(_0xe131('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe131('0xd'));var as=require(_0xe131('0xe'));var hardwareService=require(_0xe131('0xf'));var logger=require(_0xe131('0x10'))(_0xe131('0x11'));var utils=require(_0xe131('0x12'));var config=require(_0xe131('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5f0434,_0x14ed9a){_0x14ed9a=_0x14ed9a||0xcc;return function(_0x1714db){if(_0x1714db){return _0x5f0434[_0xe131('0x14')](_0x14ed9a);}return _0x5f0434[_0xe131('0x15')](_0x14ed9a)[_0xe131('0x16')]();};}function respondWithResult(_0x420cc2,_0x436549){_0x436549=_0x436549||0xc8;return function(_0x27120f){if(_0x27120f){return _0x420cc2[_0xe131('0x15')](_0x436549)['json'](_0x27120f);}};}function respondWithFilteredResult(_0x4aa1bf,_0x4dfbdf){return function(_0x5a6ca9){if(_0x5a6ca9){var _0x4987dc=typeof _0x4dfbdf[_0xe131('0x17')]===_0xe131('0x18')&&typeof _0x4dfbdf[_0xe131('0x19')]==='undefined';var _0x503e86=_0x5a6ca9[_0xe131('0x1a')];var _0x2e2bf8=_0x4987dc?0x0:_0x4dfbdf[_0xe131('0x17')];var _0x1a1e03=_0x4987dc?_0x5a6ca9[_0xe131('0x1a')]:_0x4dfbdf[_0xe131('0x17')]+_0x4dfbdf['limit'];var _0x4690b0;if(_0x1a1e03>=_0x503e86){_0x1a1e03=_0x503e86;_0x4690b0=0xc8;}else{_0x4690b0=0xce;}_0x4aa1bf[_0xe131('0x15')](_0x4690b0);return _0x4aa1bf[_0xe131('0x1b')](_0xe131('0x1c'),_0x2e2bf8+'-'+_0x1a1e03+'/'+_0x503e86)[_0xe131('0x1d')](_0x5a6ca9);}return null;};}function patchUpdates(_0x49b19e){return function(_0x4c24e5){try{jsonpatch[_0xe131('0x1e')](_0x4c24e5,_0x49b19e,!![]);}catch(_0x41c4e1){return BPromise['reject'](_0x41c4e1);}return _0x4c24e5[_0xe131('0x1f')]();};}function saveUpdates(_0x55b0c5,_0x49f304){return function(_0x19d141){if(_0x19d141){return _0x19d141[_0xe131('0x20')](_0x55b0c5)[_0xe131('0x21')](function(_0xecb533){return _0xecb533;});}return null;};}function removeEntity(_0x166409,_0x225278){return function(_0x2bcb68){if(_0x2bcb68){return _0x2bcb68['destroy']()[_0xe131('0x21')](function(){_0x166409[_0xe131('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7cb8,_0x330638){return function(_0x5b2f47){if(!_0x5b2f47){_0x4e7cb8[_0xe131('0x14')](0x194);}return _0x5b2f47;};}function handleError(_0x3b95bf,_0x51e109){_0x51e109=_0x51e109||0x1f4;return function(_0x44935b){logger[_0xe131('0x22')](_0x44935b[_0xe131('0x23')]);if(_0x44935b['name']){delete _0x44935b[_0xe131('0x24')];}_0x3b95bf[_0xe131('0x15')](_0x51e109)[_0xe131('0x25')](_0x44935b);};}exports[_0xe131('0x26')]=function(_0xb306b4,_0x2fce8c){var _0x1ff557={},_0x3414f1={},_0x9f8c66={'count':0x0,'rows':[]};var _0x341294=_['map'](db[_0xe131('0x27')]['rawAttributes'],function(_0x155c67){return{'name':_0x155c67['fieldName'],'type':_0x155c67[_0xe131('0x28')]['key']};});_0x3414f1[_0xe131('0x29')]=_[_0xe131('0x2a')](_0x341294,_0xe131('0x24'));_0x3414f1['query']=_['keys'](_0xb306b4[_0xe131('0x2b')]);_0x3414f1[_0xe131('0x2c')]=_[_0xe131('0x2d')](_0x3414f1[_0xe131('0x29')],_0x3414f1[_0xe131('0x2b')]);_0x1ff557[_0xe131('0x2e')]=_[_0xe131('0x2d')](_0x3414f1[_0xe131('0x29')],qs['fields'](_0xb306b4['query'][_0xe131('0x2f')]));_0x1ff557[_0xe131('0x2e')]=_0x1ff557[_0xe131('0x2e')][_0xe131('0x30')]?_0x1ff557[_0xe131('0x2e')]:_0x3414f1[_0xe131('0x29')];if(!_0xb306b4[_0xe131('0x2b')]['hasOwnProperty']('nolimit')){_0x1ff557[_0xe131('0x19')]=qs['limit'](_0xb306b4[_0xe131('0x2b')]['limit']);_0x1ff557[_0xe131('0x17')]=qs['offset'](_0xb306b4[_0xe131('0x2b')]['offset']);}_0x1ff557[_0xe131('0x31')]=qs[_0xe131('0x32')](_0xb306b4[_0xe131('0x2b')][_0xe131('0x32')]);_0x1ff557[_0xe131('0x33')]=qs[_0xe131('0x2c')](_['pick'](_0xb306b4[_0xe131('0x2b')],_0x3414f1['filters']),_0x341294);if(_0xb306b4[_0xe131('0x2b')]['filter']){_0x1ff557[_0xe131('0x33')]=_[_0xe131('0x34')](_0x1ff557[_0xe131('0x33')],{'$or':_[_0xe131('0x2a')](_0x341294,function(_0xd8cf9d){if(_0xd8cf9d[_0xe131('0x28')]!==_0xe131('0x35')){var _0x5a5498={};_0x5a5498[_0xd8cf9d[_0xe131('0x24')]]={'$like':'%'+_0xb306b4['query'][_0xe131('0x36')]+'%'};return _0x5a5498;}})});}_0x1ff557=_[_0xe131('0x34')]({},_0x1ff557,_0xb306b4['options']);var _0x5a9a34={'where':_0x1ff557[_0xe131('0x33')]};return db['FreshdeskAccount']['count'](_0x5a9a34)[_0xe131('0x21')](function(_0x5b82e5){_0x9f8c66[_0xe131('0x1a')]=_0x5b82e5;if(_0xb306b4[_0xe131('0x2b')]['includeAll']){_0x1ff557[_0xe131('0x37')]=[{'all':!![]}];}return db[_0xe131('0x27')][_0xe131('0x38')](_0x1ff557);})[_0xe131('0x21')](function(_0xa077dd){_0x9f8c66['rows']=_0xa077dd;return _0x9f8c66;})['then'](respondWithFilteredResult(_0x2fce8c,_0x1ff557))[_0xe131('0x39')](handleError(_0x2fce8c,null));};exports[_0xe131('0x3a')]=function(_0x2a9a07,_0x58fe5c){var _0x34f5ae={'raw':![],'where':{'id':_0x2a9a07[_0xe131('0x3b')]['id']}},_0x112e78={};_0x112e78['model']=_[_0xe131('0x3c')](db[_0xe131('0x27')][_0xe131('0x3d')]);_0x112e78['query']=_[_0xe131('0x3c')](_0x2a9a07[_0xe131('0x2b')]);_0x112e78[_0xe131('0x2c')]=_['intersection'](_0x112e78[_0xe131('0x29')],_0x112e78[_0xe131('0x2b')]);_0x34f5ae[_0xe131('0x2e')]=_[_0xe131('0x2d')](_0x112e78[_0xe131('0x29')],qs[_0xe131('0x2f')](_0x2a9a07[_0xe131('0x2b')]['fields']));_0x34f5ae['attributes']=_0x34f5ae[_0xe131('0x2e')][_0xe131('0x30')]?_0x34f5ae[_0xe131('0x2e')]:_0x112e78[_0xe131('0x29')];if(_0x2a9a07[_0xe131('0x2b')][_0xe131('0x3e')]){_0x34f5ae['include']=[{'all':!![]}];}_0x34f5ae=_[_0xe131('0x34')]({},_0x34f5ae,_0x2a9a07[_0xe131('0x3f')]);return db[_0xe131('0x27')][_0xe131('0x40')](_0x34f5ae)[_0xe131('0x21')](handleEntityNotFound(_0x58fe5c,null))[_0xe131('0x21')](respondWithResult(_0x58fe5c,null))['catch'](handleError(_0x58fe5c,null));};exports[_0xe131('0x41')]=function(_0x1ce9b7,_0x173a71){return db[_0xe131('0x27')][_0xe131('0x41')](_0x1ce9b7[_0xe131('0x42')],{})[_0xe131('0x21')](respondWithResult(_0x173a71,0xc9))[_0xe131('0x39')](handleError(_0x173a71,null));};exports[_0xe131('0x20')]=function(_0x320699,_0x442f06){if(_0x320699['body']['id']){delete _0x320699[_0xe131('0x42')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x320699[_0xe131('0x3b')]['id']}})[_0xe131('0x21')](handleEntityNotFound(_0x442f06,null))[_0xe131('0x21')](saveUpdates(_0x320699[_0xe131('0x42')],null))[_0xe131('0x21')](respondWithResult(_0x442f06,null))[_0xe131('0x39')](handleError(_0x442f06,null));};exports[_0xe131('0x43')]=function(_0x398c39,_0x81206e){return db[_0xe131('0x27')][_0xe131('0x40')]({'where':{'id':_0x398c39['params']['id']}})['then'](handleEntityNotFound(_0x81206e,null))[_0xe131('0x21')](removeEntity(_0x81206e,null))[_0xe131('0x39')](handleError(_0x81206e,null));};exports['getConfigurations']=function(_0x56893d,_0x2b934b,_0x564a29){var _0x5b0ab5={};var _0xe0d786={};var _0x34404e;var _0x32e45d;return db[_0xe131('0x27')][_0xe131('0x44')]({'where':{'id':_0x56893d[_0xe131('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2b934b,null))['then'](function(_0x40d0cb){if(_0x40d0cb){_0x34404e=_0x40d0cb;_0xe0d786[_0xe131('0x29')]=_['keys'](db[_0xe131('0x45')][_0xe131('0x3d')]);_0xe0d786[_0xe131('0x2b')]=_[_0xe131('0x3c')](_0x56893d[_0xe131('0x2b')]);_0xe0d786[_0xe131('0x2c')]=_['intersection'](_0xe0d786[_0xe131('0x29')],_0xe0d786['query']);_0x5b0ab5['attributes']=_[_0xe131('0x2d')](_0xe0d786[_0xe131('0x29')],qs['fields'](_0x56893d['query'][_0xe131('0x2f')]));_0x5b0ab5[_0xe131('0x2e')]=_0x5b0ab5[_0xe131('0x2e')]['length']?_0x5b0ab5[_0xe131('0x2e')]:_0xe0d786[_0xe131('0x29')];_0x5b0ab5[_0xe131('0x31')]=qs[_0xe131('0x32')](_0x56893d[_0xe131('0x2b')]['sort']);_0x5b0ab5[_0xe131('0x33')]=qs['filters'](_[_0xe131('0x46')](_0x56893d[_0xe131('0x2b')],_0xe0d786[_0xe131('0x2c')]));if(_0x56893d[_0xe131('0x2b')]['filter']){_0x5b0ab5['where']=_['merge'](_0x5b0ab5[_0xe131('0x33')],{'$or':_['map'](_0x5b0ab5[_0xe131('0x2e')],function(_0x44f69f){var _0x413b70={};_0x413b70[_0x44f69f]={'$like':'%'+_0x56893d[_0xe131('0x2b')][_0xe131('0x36')]+'%'};return _0x413b70;})});}_0x5b0ab5=_[_0xe131('0x34')]({},_0x5b0ab5,_0x56893d[_0xe131('0x3f')]);return _0x34404e[_0xe131('0x47')](_0x5b0ab5);}})[_0xe131('0x21')](function(_0x14d4b5){if(_0x14d4b5){_0x32e45d=_0x14d4b5['length'];if(!_0x56893d['query']['hasOwnProperty'](_0xe131('0x48'))){_0x5b0ab5[_0xe131('0x19')]=qs[_0xe131('0x19')](_0x56893d[_0xe131('0x2b')]['limit']);_0x5b0ab5[_0xe131('0x17')]=qs[_0xe131('0x17')](_0x56893d[_0xe131('0x2b')][_0xe131('0x17')]);}return _0x34404e[_0xe131('0x47')](_0x5b0ab5);}})[_0xe131('0x21')](function(_0x52143e){if(_0x52143e){return _0x52143e?{'count':_0x32e45d,'rows':_0x52143e}:null;}})['then'](respondWithResult(_0x2b934b,null))[_0xe131('0x39')](handleError(_0x2b934b,null));};exports['addConfiguration']=function(_0x484a2e,_0x537d66,_0x1c194a){if(_0x484a2e['body']['id']){delete _0x484a2e[_0xe131('0x42')]['id'];}return db['FreshdeskAccount'][_0xe131('0x44')]({'where':{'id':_0x484a2e[_0xe131('0x3b')]['id']}})[_0xe131('0x21')](handleEntityNotFound(_0x537d66,null))[_0xe131('0x21')](function(_0x47d96b){if(_0x47d96b){_0x484a2e[_0xe131('0x42')][_0xe131('0x49')]=_0x47d96b['id'];_0x484a2e[_0xe131('0x42')][_0xe131('0x4a')]=integrations[_0xe131('0x4b')](_0x484a2e[_0xe131('0x42')]['channel'],_0x484a2e[_0xe131('0x42')][_0xe131('0x28')]);_0x484a2e['body'][_0xe131('0x4c')]=integrations['getDescriptions'](_0x484a2e['body'][_0xe131('0x4d')],_0x484a2e['body'][_0xe131('0x28')]);return db[_0xe131('0x45')][_0xe131('0x41')](_0x484a2e['body'],{'include':[{'model':db[_0xe131('0x4e')],'as':_0xe131('0x4a')},{'model':db[_0xe131('0x4e')],'as':_0xe131('0x4c')}]});}return null;})[_0xe131('0x21')](respondWithResult(_0x537d66,null))[_0xe131('0x39')](handleError(_0x537d66,null));};exports['getFields']=function(_0x592750,_0x68f7c3,_0x50725b){var _0x10b7b9='';return db['FreshdeskAccount'][_0xe131('0x44')]({'where':{'id':_0x592750[_0xe131('0x3b')]['id']},'attributes':['id',_0xe131('0x4f'),_0xe131('0x50')]})[_0xe131('0x21')](handleEntityNotFound(_0x68f7c3,null))[_0xe131('0x21')](function(_0x59beee){if(_0x59beee){_0x10b7b9=_0x59beee[_0xe131('0x4f')];var _0x1a4bf2=_0x10b7b9[_0xe131('0x51')](-0x1);if(_0x1a4bf2==='/'){_0x10b7b9=_0x10b7b9[_0xe131('0x52')](0x0,_0x10b7b9[_0xe131('0x53')](_0x1a4bf2));}return rp({'method':_0xe131('0x54'),'uri':util[_0xe131('0x55')](_0xe131('0x56'),_0x10b7b9,_0xe131('0x57')),'headers':{'Authorization':util[_0xe131('0x55')](_0xe131('0x58'),new Buffer(util[_0xe131('0x55')]('%s:X',_0x59beee[_0xe131('0x50')]))[_0xe131('0x59')]('base64'))},'json':!![]});}})[_0xe131('0x21')](function(_0x34d77b){if(_0x34d77b){var _0x216901=['requester',_0xe131('0x5a'),_0xe131('0x5b'),_0xe131('0x5c'),_0xe131('0x15'),_0xe131('0x5d'),_0xe131('0x5e'),_0xe131('0x5f'),_0xe131('0x60'),_0xe131('0x5e'),_0xe131('0x61')];_[_0xe131('0x62')](_0x34d77b,function(_0xcc8cd7){return _0x216901[_0xe131('0x63')](_0xcc8cd7[_0xe131('0x24')])||!_0xcc8cd7[_0xe131('0x64')]&&_0xcc8cd7['type']!=='custom_text'&&_0xcc8cd7[_0xe131('0x28')]!=='custom_dropdown';});return{'count':_0x34d77b[_0xe131('0x30')],'rows':_[_0xe131('0x2a')](_0x34d77b,function(_0x885ea7){return{'id':_0x885ea7[_0xe131('0x24')],'name':_0x885ea7[_0xe131('0x65')],'custom':!_0x885ea7['default'],'options':_0x885ea7[_0xe131('0x66')]?_['map'](_0x885ea7[_0xe131('0x66')],function(_0x23f9a8){return{'name':_[_0xe131('0x67')](_0x23f9a8),'value':_0x23f9a8};}):[]};})};}})[_0xe131('0x21')](respondWithResult(_0x68f7c3,null))['catch'](function(_0x1642d6){var _0x2df523=_0x592750[_0xe131('0x2b')][_0xe131('0x68')]?0x1f4:_0x1642d6[_0xe131('0x69')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xe131('0x6a'),_0x2df523,JSON[_0xe131('0x6b')](_0x1642d6));delete _0x1642d6[_0xe131('0x24')];if(_0x2df523===0x191){_0x2df523=0x190;}_0x68f7c3['status'](_0x2df523)['send'](_0x592750[_0xe131('0x2b')][_0xe131('0x68')]?{'message':_0xe131('0x6c'),'statusCode':_0x1642d6[_0xe131('0x69')]}:_0x1642d6);});}; \ No newline at end of file +var _0x3176=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','FreshdeskAccount','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','options','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','apiKey','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode'];(function(_0xd8b89f,_0x6312f4){var _0x3c6e90=function(_0x182d8a){while(--_0x182d8a){_0xd8b89f['push'](_0xd8b89f['shift']());}};_0x3c6e90(++_0x6312f4);}(_0x3176,0x1d8));var _0x6317=function(_0x5b4ec8,_0x147171){_0x5b4ec8=_0x5b4ec8-0x0;var _0x539b1a=_0x3176[_0x5b4ec8];return _0x539b1a;};'use strict';var emlformat=require(_0x6317('0x0'));var rimraf=require(_0x6317('0x1'));var zipdir=require(_0x6317('0x2'));var jsonpatch=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var moment=require(_0x6317('0x5'));var BPromise=require(_0x6317('0x6'));var Mustache=require(_0x6317('0x7'));var util=require(_0x6317('0x8'));var path=require(_0x6317('0x9'));var sox=require(_0x6317('0xa'));var csv=require(_0x6317('0xb'));var ejs=require(_0x6317('0xc'));var fs=require('fs');var fs_extra=require(_0x6317('0xd'));var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xb'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var licenseUtil=require(_0x6317('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6317('0x1a'));function respondWithStatusCode(_0x3f64fb,_0x4aa69f){_0x4aa69f=_0x4aa69f||0xcc;return function(_0x375498){if(_0x375498){return _0x3f64fb[_0x6317('0x1b')](_0x4aa69f);}return _0x3f64fb['status'](_0x4aa69f)[_0x6317('0x1c')]();};}function respondWithResult(_0x1fba31,_0x32ad4a){_0x32ad4a=_0x32ad4a||0xc8;return function(_0x42f2f8){if(_0x42f2f8){return _0x1fba31[_0x6317('0x1d')](_0x32ad4a)['json'](_0x42f2f8);}};}function respondWithFilteredResult(_0x54e857,_0x560b77){return function(_0x1b42b3){if(_0x1b42b3){var _0x55b86a=typeof _0x560b77['offset']===_0x6317('0x1e')&&typeof _0x560b77['limit']==='undefined';var _0x35caff=_0x1b42b3[_0x6317('0x1f')];var _0x4ad386=_0x55b86a?0x0:_0x560b77[_0x6317('0x20')];var _0x519851=_0x55b86a?_0x1b42b3[_0x6317('0x1f')]:_0x560b77[_0x6317('0x20')]+_0x560b77[_0x6317('0x21')];var _0x3e4332;if(_0x519851>=_0x35caff){_0x519851=_0x35caff;_0x3e4332=0xc8;}else{_0x3e4332=0xce;}_0x54e857['status'](_0x3e4332);return _0x54e857[_0x6317('0x22')](_0x6317('0x23'),_0x4ad386+'-'+_0x519851+'/'+_0x35caff)[_0x6317('0x24')](_0x1b42b3);}return null;};}function patchUpdates(_0x3687d1){return function(_0x18e081){try{jsonpatch[_0x6317('0x25')](_0x18e081,_0x3687d1,!![]);}catch(_0x8ba880){return BPromise[_0x6317('0x26')](_0x8ba880);}return _0x18e081[_0x6317('0x27')]();};}function saveUpdates(_0x1e9b7e,_0x4b8b11){return function(_0x2bb861){if(_0x2bb861){return _0x2bb861['update'](_0x1e9b7e)[_0x6317('0x28')](function(_0x4a2e3e){return _0x4a2e3e;});}return null;};}function removeEntity(_0x2b7669,_0x2a36ee){return function(_0x2ef902){if(_0x2ef902){return _0x2ef902[_0x6317('0x29')]()[_0x6317('0x28')](function(){_0x2b7669['status'](0xcc)[_0x6317('0x1c')]();});}};}function handleEntityNotFound(_0x14b136,_0x4db284){return function(_0x57739a){if(!_0x57739a){_0x14b136[_0x6317('0x1b')](0x194);}return _0x57739a;};}function handleError(_0x2b4416,_0x2ca4e7){_0x2ca4e7=_0x2ca4e7||0x1f4;return function(_0x329543){logger[_0x6317('0x2a')](_0x329543[_0x6317('0x2b')]);if(_0x329543[_0x6317('0x2c')]){delete _0x329543['name'];}_0x2b4416[_0x6317('0x1d')](_0x2ca4e7)[_0x6317('0x2d')](_0x329543);};}exports[_0x6317('0x2e')]=function(_0x5538d8,_0x343e56){var _0x1a3f96={},_0x5b3f8f={},_0x4e1a27={'count':0x0,'rows':[]};var _0x642246=_[_0x6317('0x2f')](db['FreshdeskAccount'][_0x6317('0x30')],function(_0x1fd2ff){return{'name':_0x1fd2ff[_0x6317('0x31')],'type':_0x1fd2ff[_0x6317('0x32')][_0x6317('0x33')]};});_0x5b3f8f[_0x6317('0x34')]=_[_0x6317('0x2f')](_0x642246,_0x6317('0x2c'));_0x5b3f8f[_0x6317('0x35')]=_[_0x6317('0x36')](_0x5538d8[_0x6317('0x35')]);_0x5b3f8f[_0x6317('0x37')]=_['intersection'](_0x5b3f8f[_0x6317('0x34')],_0x5b3f8f['query']);_0x1a3f96[_0x6317('0x38')]=_[_0x6317('0x39')](_0x5b3f8f[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x5538d8[_0x6317('0x35')][_0x6317('0x3a')]));_0x1a3f96[_0x6317('0x38')]=_0x1a3f96[_0x6317('0x38')][_0x6317('0x3b')]?_0x1a3f96[_0x6317('0x38')]:_0x5b3f8f[_0x6317('0x34')];if(!_0x5538d8['query'][_0x6317('0x3c')](_0x6317('0x3d'))){_0x1a3f96[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x5538d8[_0x6317('0x35')][_0x6317('0x21')]);_0x1a3f96[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x5538d8['query'][_0x6317('0x20')]);}_0x1a3f96[_0x6317('0x3e')]=qs['sort'](_0x5538d8[_0x6317('0x35')][_0x6317('0x3f')]);_0x1a3f96[_0x6317('0x40')]=qs[_0x6317('0x37')](_['pick'](_0x5538d8[_0x6317('0x35')],_0x5b3f8f[_0x6317('0x37')]),_0x642246);if(_0x5538d8['query'][_0x6317('0x41')]){_0x1a3f96[_0x6317('0x40')]=_[_0x6317('0x42')](_0x1a3f96[_0x6317('0x40')],{'$or':_[_0x6317('0x2f')](_0x642246,function(_0x2296a3){if(_0x2296a3[_0x6317('0x32')]!=='VIRTUAL'){var _0x5336bd={};_0x5336bd[_0x2296a3[_0x6317('0x2c')]]={'$like':'%'+_0x5538d8[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x5336bd;}})});}_0x1a3f96=_[_0x6317('0x42')]({},_0x1a3f96,_0x5538d8['options']);var _0x155669={'where':_0x1a3f96[_0x6317('0x40')]};return db[_0x6317('0x43')][_0x6317('0x1f')](_0x155669)[_0x6317('0x28')](function(_0x4879e6){_0x4e1a27[_0x6317('0x1f')]=_0x4879e6;if(_0x5538d8[_0x6317('0x35')][_0x6317('0x44')]){_0x1a3f96[_0x6317('0x45')]=[{'all':!![]}];}return db[_0x6317('0x43')]['findAll'](_0x1a3f96);})[_0x6317('0x28')](function(_0x9fd484){_0x4e1a27['rows']=_0x9fd484;return _0x4e1a27;})[_0x6317('0x28')](respondWithFilteredResult(_0x343e56,_0x1a3f96))[_0x6317('0x46')](handleError(_0x343e56,null));};exports[_0x6317('0x47')]=function(_0x81bea6,_0x2d3690){var _0x282240={'raw':![],'where':{'id':_0x81bea6[_0x6317('0x48')]['id']}},_0x31a704={};_0x31a704[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x43')]['rawAttributes']);_0x31a704[_0x6317('0x35')]=_['keys'](_0x81bea6[_0x6317('0x35')]);_0x31a704[_0x6317('0x37')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],_0x31a704[_0x6317('0x35')]);_0x282240[_0x6317('0x38')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x81bea6[_0x6317('0x35')][_0x6317('0x3a')]));_0x282240[_0x6317('0x38')]=_0x282240[_0x6317('0x38')][_0x6317('0x3b')]?_0x282240[_0x6317('0x38')]:_0x31a704[_0x6317('0x34')];if(_0x81bea6['query'][_0x6317('0x44')]){_0x282240[_0x6317('0x45')]=[{'all':!![]}];}_0x282240=_[_0x6317('0x42')]({},_0x282240,_0x81bea6['options']);return db['FreshdeskAccount'][_0x6317('0x49')](_0x282240)[_0x6317('0x28')](handleEntityNotFound(_0x2d3690,null))['then'](respondWithResult(_0x2d3690,null))[_0x6317('0x46')](handleError(_0x2d3690,null));};exports[_0x6317('0x4a')]=function(_0x6ff69c,_0x4b3efb){return db[_0x6317('0x43')][_0x6317('0x4a')](_0x6ff69c[_0x6317('0x4b')],{})[_0x6317('0x28')](respondWithResult(_0x4b3efb,0xc9))[_0x6317('0x46')](handleError(_0x4b3efb,null));};exports[_0x6317('0x4c')]=function(_0x238e59,_0x3fe735){if(_0x238e59['body']['id']){delete _0x238e59['body']['id'];}return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x238e59['params']['id']}})['then'](handleEntityNotFound(_0x3fe735,null))['then'](saveUpdates(_0x238e59[_0x6317('0x4b')],null))[_0x6317('0x28')](respondWithResult(_0x3fe735,null))[_0x6317('0x46')](handleError(_0x3fe735,null));};exports[_0x6317('0x29')]=function(_0x37b673,_0x1403a4){return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x37b673[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1403a4,null))[_0x6317('0x28')](removeEntity(_0x1403a4,null))[_0x6317('0x46')](handleError(_0x1403a4,null));};exports[_0x6317('0x4d')]=function(_0x92e80d,_0x27db7b,_0x364700){var _0x3df23d={};var _0x4b2d79={};var _0x34fb93;var _0x55554b;return db[_0x6317('0x43')][_0x6317('0x4e')]({'where':{'id':_0x92e80d['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x27db7b,null))[_0x6317('0x28')](function(_0xdf561f){if(_0xdf561f){_0x34fb93=_0xdf561f;_0x4b2d79[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x4f')]['rawAttributes']);_0x4b2d79['query']=_[_0x6317('0x36')](_0x92e80d[_0x6317('0x35')]);_0x4b2d79[_0x6317('0x37')]=_[_0x6317('0x39')](_0x4b2d79[_0x6317('0x34')],_0x4b2d79[_0x6317('0x35')]);_0x3df23d['attributes']=_['intersection'](_0x4b2d79['model'],qs[_0x6317('0x3a')](_0x92e80d['query'][_0x6317('0x3a')]));_0x3df23d['attributes']=_0x3df23d['attributes'][_0x6317('0x3b')]?_0x3df23d['attributes']:_0x4b2d79[_0x6317('0x34')];_0x3df23d[_0x6317('0x3e')]=qs['sort'](_0x92e80d[_0x6317('0x35')][_0x6317('0x3f')]);_0x3df23d[_0x6317('0x40')]=qs[_0x6317('0x37')](_[_0x6317('0x50')](_0x92e80d[_0x6317('0x35')],_0x4b2d79[_0x6317('0x37')]));if(_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]){_0x3df23d['where']=_['merge'](_0x3df23d[_0x6317('0x40')],{'$or':_['map'](_0x3df23d[_0x6317('0x38')],function(_0x46581b){var _0x17c34c={};_0x17c34c[_0x46581b]={'$like':'%'+_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x17c34c;})});}_0x3df23d=_[_0x6317('0x42')]({},_0x3df23d,_0x92e80d[_0x6317('0x51')]);return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x348265){if(_0x348265){_0x55554b=_0x348265[_0x6317('0x3b')];if(!_0x92e80d[_0x6317('0x35')][_0x6317('0x3c')](_0x6317('0x3d'))){_0x3df23d[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x92e80d[_0x6317('0x35')][_0x6317('0x21')]);_0x3df23d[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x92e80d[_0x6317('0x35')]['offset']);}return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x90ebc){if(_0x90ebc){return _0x90ebc?{'count':_0x55554b,'rows':_0x90ebc}:null;}})[_0x6317('0x28')](respondWithResult(_0x27db7b,null))['catch'](handleError(_0x27db7b,null));};exports['addConfiguration']=function(_0x5f4b35,_0xd9ea92,_0x49df77){if(_0x5f4b35[_0x6317('0x4b')]['id']){delete _0x5f4b35[_0x6317('0x4b')]['id'];}return db['FreshdeskAccount'][_0x6317('0x4e')]({'where':{'id':_0x5f4b35[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0xd9ea92,null))[_0x6317('0x28')](function(_0x4c06cb){if(_0x4c06cb){_0x5f4b35[_0x6317('0x4b')][_0x6317('0x52')]=_0x4c06cb['id'];_0x5f4b35[_0x6317('0x4b')][_0x6317('0x53')]=integrations[_0x6317('0x54')](_0x5f4b35[_0x6317('0x4b')][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);_0x5f4b35[_0x6317('0x4b')]['Descriptions']=integrations[_0x6317('0x56')](_0x5f4b35['body'][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);return db[_0x6317('0x4f')][_0x6317('0x4a')](_0x5f4b35[_0x6317('0x4b')],{'include':[{'model':db[_0x6317('0x57')],'as':_0x6317('0x53')},{'model':db[_0x6317('0x57')],'as':_0x6317('0x58')}]});}return null;})[_0x6317('0x28')](respondWithResult(_0xd9ea92,null))[_0x6317('0x46')](handleError(_0xd9ea92,null));};exports[_0x6317('0x59')]=function(_0x52fada,_0x3b85b1,_0x4f0fea){var _0x460e20='';return db[_0x6317('0x43')]['findOne']({'where':{'id':_0x52fada[_0x6317('0x48')]['id']},'attributes':['id','remoteUri',_0x6317('0x5a')]})[_0x6317('0x28')](handleEntityNotFound(_0x3b85b1,null))[_0x6317('0x28')](function(_0x4495de){if(_0x4495de){_0x460e20=_0x4495de['remoteUri'];var _0x4c17c8=_0x460e20['slice'](-0x1);if(_0x4c17c8==='/'){_0x460e20=_0x460e20[_0x6317('0x5b')](0x0,_0x460e20[_0x6317('0x5c')](_0x4c17c8));}return rp({'method':_0x6317('0x5d'),'uri':util['format']('%s/%s',_0x460e20,_0x6317('0x5e')),'headers':{'Authorization':util[_0x6317('0x5f')](_0x6317('0x60'),new Buffer(util[_0x6317('0x5f')](_0x6317('0x61'),_0x4495de['apiKey']))[_0x6317('0x62')]('base64'))},'json':!![]});}})['then'](function(_0x1ea3b0){if(_0x1ea3b0){var _0x3bf3c0=[_0x6317('0x63'),_0x6317('0x64'),_0x6317('0x65'),_0x6317('0x66'),_0x6317('0x1d'),_0x6317('0x67'),_0x6317('0x68'),_0x6317('0x69'),_0x6317('0x6a'),'group',_0x6317('0x6b')];_['remove'](_0x1ea3b0,function(_0x245582){return _0x3bf3c0[_0x6317('0x6c')](_0x245582[_0x6317('0x2c')])||!_0x245582[_0x6317('0x6d')]&&_0x245582[_0x6317('0x32')]!=='custom_text'&&_0x245582[_0x6317('0x32')]!==_0x6317('0x6e');});return{'count':_0x1ea3b0[_0x6317('0x3b')],'rows':_[_0x6317('0x2f')](_0x1ea3b0,function(_0x396df1){return{'id':_0x396df1['name'],'name':_0x396df1[_0x6317('0x6f')],'custom':!_0x396df1[_0x6317('0x6d')],'options':_0x396df1[_0x6317('0x70')]?_[_0x6317('0x2f')](_0x396df1[_0x6317('0x70')],function(_0xf3fa70){return{'name':_[_0x6317('0x71')](_0xf3fa70),'value':_0xf3fa70};}):[]};})};}})['then'](respondWithResult(_0x3b85b1,null))[_0x6317('0x46')](function(_0x255905){var _0x58b01d=_0x52fada[_0x6317('0x35')]['test']?0x1f4:_0x255905['statusCode']||0x1f4;logger[_0x6317('0x2a')](_0x6317('0x72'),'getFields',_0x58b01d,JSON['stringify'](_0x255905));delete _0x255905[_0x6317('0x2c')];if(_0x58b01d===0x191){_0x58b01d=0x190;}_0x3b85b1[_0x6317('0x1d')](_0x58b01d)[_0x6317('0x2d')](_0x52fada[_0x6317('0x35')][_0x6317('0x73')]?{'message':_0x6317('0x74'),'statusCode':_0x255905[_0x6317('0x75')]}:_0x255905);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 520bfad..f3567cd 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 _0x4ba0=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x57b978,_0x486a01){var _0x31f0b6=function(_0x21de46){while(--_0x21de46){_0x57b978['push'](_0x57b978['shift']());}};_0x31f0b6(++_0x486a01);}(_0x4ba0,0x126));var _0x04ba=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x4ba0[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0x04ba('0x0'));var util=require(_0x04ba('0x1'));var logger=require('../../config/logger')(_0x04ba('0x2'));var moment=require(_0x04ba('0x3'));var BPromise=require(_0x04ba('0x4'));var rp=require(_0x04ba('0x5'));var fs=require('fs');var path=require(_0x04ba('0x6'));var rimraf=require(_0x04ba('0x7'));var config=require(_0x04ba('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x04ba('0x9'));module[_0x04ba('0xa')]=function(_0x4e8cca,_0x54eeec){return _0x4e8cca[_0x04ba('0xb')](_0x04ba('0xc'),attributes,{'tableName':_0x04ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18c0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x122d9f,_0x2c9e5b){var _0x41a09e=function(_0x3d9564){while(--_0x3d9564){_0x122d9f['push'](_0x122d9f['shift']());}};_0x41a09e(++_0x2c9e5b);}(_0x18c0,0x75));var _0x018c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x18c0[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x018c('0x0'));var util=require(_0x018c('0x1'));var logger=require('../../config/logger')(_0x018c('0x2'));var moment=require(_0x018c('0x3'));var BPromise=require(_0x018c('0x4'));var rp=require(_0x018c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x018c('0x6'));var config=require(_0x018c('0x7'));var attributes=require(_0x018c('0x8'));var integrations=require(_0x018c('0x9'));module['exports']=function(_0xe888e7,_0x435547){return _0xe888e7[_0x018c('0xa')](_0x018c('0xb'),attributes,{'tableName':_0x018c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2b40fc2..1c92d31 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 _0xd2bb=['catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','debug','ShowFreshdeskAccount','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x490cd2,_0x313c9c){var _0x5b7c95=function(_0xdc39c6){while(--_0xdc39c6){_0x490cd2['push'](_0x490cd2['shift']());}};_0x5b7c95(++_0x313c9c);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x949fb9,_0x20cd5b){_0x949fb9=_0x949fb9-0x0;var _0x569a91=_0xd2bb[_0x949fb9];return _0x569a91;};'use strict';var _=require('lodash');var util=require(_0xbd2b('0x0'));var moment=require('moment');var BPromise=require(_0xbd2b('0x1'));var rs=require(_0xbd2b('0x2'));var fs=require('fs');var Redis=require(_0xbd2b('0x3'));var db=require(_0xbd2b('0x4'))['db'];var utils=require(_0xbd2b('0x5'));var logger=require(_0xbd2b('0x6'))('rpc');var config=require(_0xbd2b('0x7'));var jayson=require(_0xbd2b('0x8'));var client=jayson[_0xbd2b('0x9')][_0xbd2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x296d68,_0x3751df,_0x42fee1){return new BPromise(function(_0x30cd3f,_0x259bca){return client[_0xbd2b('0xb')](_0x296d68,_0x42fee1)['then'](function(_0x172aef){logger['info'](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));logger['debug'](_0xbd2b('0xe'),_0x3751df,_0xbd2b('0xd'),JSON[_0xbd2b('0xf')](_0x172aef));if(_0x172aef[_0xbd2b('0x10')]){if(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x11')]===0x1f4){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x259bca(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x172aef['error'][_0xbd2b('0x12')]);return _0x30cd3f(_0x172aef[_0xbd2b('0x10')][_0xbd2b('0x12')]);}else{logger[_0xbd2b('0x13')](_0xbd2b('0xc'),_0x3751df,_0xbd2b('0xd'));_0x30cd3f(_0x172aef[_0xbd2b('0x14')][_0xbd2b('0x12')]);}})[_0xbd2b('0x15')](function(_0x571596){logger[_0xbd2b('0x10')](_0xbd2b('0xc'),_0x3751df,_0x571596);_0x259bca(_0x571596);});});}exports[_0xbd2b('0x16')]=function(_0x19ee5c){var _0x3ea01c=this;return new Promise(function(_0x112b5e,_0x13af97){return db[_0xbd2b('0x17')][_0xbd2b('0x18')]({'raw':_0x19ee5c[_0xbd2b('0x19')]?_0x19ee5c['options'][_0xbd2b('0x1a')]===undefined?!![]:![]:!![],'where':_0x19ee5c[_0xbd2b('0x19')]?_0x19ee5c[_0xbd2b('0x19')][_0xbd2b('0x1b')]||null:null,'attributes':_0x19ee5c[_0xbd2b('0x19')]?_0x19ee5c[_0xbd2b('0x19')][_0xbd2b('0x1c')]||null:null,'limit':_0x19ee5c['options']?_0x19ee5c['options']['limit']||null:null,'include':_0x19ee5c[_0xbd2b('0x19')]?_0x19ee5c['options'][_0xbd2b('0x1d')]?_[_0xbd2b('0x1e')](_0x19ee5c['options']['include'],function(_0x1a2b3d){return{'model':db[_0x1a2b3d[_0xbd2b('0x1f')]],'as':_0x1a2b3d['as'],'attributes':_0x1a2b3d['attributes'],'include':_0x1a2b3d['include']?_['map'](_0x1a2b3d[_0xbd2b('0x1d')],function(_0x43a7c5){return{'model':db[_0x43a7c5[_0xbd2b('0x1f')]],'as':_0x43a7c5['as'],'attributes':_0x43a7c5[_0xbd2b('0x1c')],'include':_0x43a7c5[_0xbd2b('0x1d')]?_[_0xbd2b('0x1e')](_0x43a7c5['include'],function(_0x51e091){return{'model':db[_0x51e091[_0xbd2b('0x1f')]],'as':_0x51e091['as'],'attributes':_0x51e091[_0xbd2b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3516bd){logger[_0xbd2b('0x13')](_0xbd2b('0x16'),_0x19ee5c);logger[_0xbd2b('0x20')]('GetFreshdeskAccount',_0x19ee5c,JSON[_0xbd2b('0xf')](_0x3516bd));_0x112b5e(_0x3516bd);})['catch'](function(_0x28ba11){logger[_0xbd2b('0x10')](_0xbd2b('0x16'),_0x28ba11[_0xbd2b('0x12')],_0x19ee5c);_0x13af97(_0x3ea01c[_0xbd2b('0x10')](0x1f4,_0x28ba11[_0xbd2b('0x12')]));});});};exports[_0xbd2b('0x21')]=function(_0x4c7a57){var _0x25aaa5=this;return new Promise(function(_0x483951,_0x74726){return db[_0xbd2b('0x17')]['find']({'raw':_0x4c7a57['options']?_0x4c7a57[_0xbd2b('0x19')][_0xbd2b('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c7a57[_0xbd2b('0x19')]?_0x4c7a57[_0xbd2b('0x19')][_0xbd2b('0x1b')]||null:null,'attributes':_0x4c7a57['options']?_0x4c7a57[_0xbd2b('0x19')][_0xbd2b('0x1c')]||null:null,'include':_0x4c7a57[_0xbd2b('0x19')]?_0x4c7a57[_0xbd2b('0x19')][_0xbd2b('0x1d')]?_[_0xbd2b('0x1e')](_0x4c7a57[_0xbd2b('0x19')]['include'],function(_0x4346d2){return{'model':db[_0x4346d2['model']],'as':_0x4346d2['as'],'attributes':_0x4346d2['attributes'],'include':_0x4346d2[_0xbd2b('0x1d')]?_[_0xbd2b('0x1e')](_0x4346d2[_0xbd2b('0x1d')],function(_0x4a22b0){return{'model':db[_0x4a22b0['model']],'as':_0x4a22b0['as'],'attributes':_0x4a22b0[_0xbd2b('0x1c')],'include':_0x4a22b0[_0xbd2b('0x1d')]?_[_0xbd2b('0x1e')](_0x4a22b0[_0xbd2b('0x1d')],function(_0xdd1383){return{'model':db[_0xdd1383['model']],'as':_0xdd1383['as'],'attributes':_0xdd1383[_0xbd2b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbd2b('0x22')](function(_0x57e663){logger[_0xbd2b('0x13')]('ShowFreshdeskAccount',_0x4c7a57);logger[_0xbd2b('0x20')](_0xbd2b('0x21'),_0x4c7a57,JSON[_0xbd2b('0xf')](_0x57e663));_0x483951(_0x57e663);})[_0xbd2b('0x15')](function(_0x5054b6){logger[_0xbd2b('0x10')](_0xbd2b('0x21'),_0x5054b6[_0xbd2b('0x12')],_0x4c7a57);_0x74726(_0x25aaa5[_0xbd2b('0x10')](0x1f4,_0x5054b6['message']));});});}; \ No newline at end of file +var _0xca6a=['map','attributes','catch','find','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include'];(function(_0x14e9ff,_0x52a5ea){var _0x4cf3cb=function(_0x46e335){while(--_0x46e335){_0x14e9ff['push'](_0x14e9ff['shift']());}};_0x4cf3cb(++_0x52a5ea);}(_0xca6a,0x17c));var _0xaca6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xca6a[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xaca6('0x0'));var util=require(_0xaca6('0x1'));var moment=require(_0xaca6('0x2'));var BPromise=require(_0xaca6('0x3'));var rs=require(_0xaca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaca6('0x5'));var logger=require('../../config/logger')(_0xaca6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaca6('0x7')][_0xaca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c0cb5,_0x17743d,_0x369209){return new BPromise(function(_0x46a10f,_0x21962a){return client['request'](_0x2c0cb5,_0x369209)[_0xaca6('0x9')](function(_0x20059c){logger[_0xaca6('0xa')](_0xaca6('0xb'),_0x17743d,_0xaca6('0xc'));logger[_0xaca6('0xd')](_0xaca6('0xe'),_0x17743d,_0xaca6('0xc'),JSON[_0xaca6('0xf')](_0x20059c));if(_0x20059c[_0xaca6('0x10')]){if(_0x20059c[_0xaca6('0x10')][_0xaca6('0x11')]===0x1f4){logger[_0xaca6('0x10')](_0xaca6('0xb'),_0x17743d,_0x20059c['error'][_0xaca6('0x12')]);return _0x21962a(_0x20059c[_0xaca6('0x10')][_0xaca6('0x12')]);}logger[_0xaca6('0x10')](_0xaca6('0xb'),_0x17743d,_0x20059c[_0xaca6('0x10')]['message']);return _0x46a10f(_0x20059c['error']['message']);}else{logger[_0xaca6('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x17743d,'request\x20sent');_0x46a10f(_0x20059c[_0xaca6('0x13')][_0xaca6('0x12')]);}})['catch'](function(_0x769305){logger[_0xaca6('0x10')](_0xaca6('0xb'),_0x17743d,_0x769305);_0x21962a(_0x769305);});});}exports[_0xaca6('0x14')]=function(_0x35675e){var _0xfb4af3=this;return new Promise(function(_0x35a2cc,_0x5b3671){return db[_0xaca6('0x15')][_0xaca6('0x16')]({'raw':_0x35675e[_0xaca6('0x17')]?_0x35675e[_0xaca6('0x17')][_0xaca6('0x18')]===undefined?!![]:![]:!![],'where':_0x35675e[_0xaca6('0x17')]?_0x35675e[_0xaca6('0x17')][_0xaca6('0x19')]||null:null,'attributes':_0x35675e[_0xaca6('0x17')]?_0x35675e[_0xaca6('0x17')]['attributes']||null:null,'limit':_0x35675e[_0xaca6('0x17')]?_0x35675e[_0xaca6('0x17')][_0xaca6('0x1a')]||null:null,'include':_0x35675e[_0xaca6('0x17')]?_0x35675e[_0xaca6('0x17')][_0xaca6('0x1b')]?_[_0xaca6('0x1c')](_0x35675e[_0xaca6('0x17')][_0xaca6('0x1b')],function(_0x5dd093){return{'model':db[_0x5dd093['model']],'as':_0x5dd093['as'],'attributes':_0x5dd093[_0xaca6('0x1d')],'include':_0x5dd093[_0xaca6('0x1b')]?_[_0xaca6('0x1c')](_0x5dd093[_0xaca6('0x1b')],function(_0x3042d7){return{'model':db[_0x3042d7['model']],'as':_0x3042d7['as'],'attributes':_0x3042d7[_0xaca6('0x1d')],'include':_0x3042d7[_0xaca6('0x1b')]?_[_0xaca6('0x1c')](_0x3042d7[_0xaca6('0x1b')],function(_0x5291c2){return{'model':db[_0x5291c2['model']],'as':_0x5291c2['as'],'attributes':_0x5291c2[_0xaca6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f8215){logger[_0xaca6('0xa')](_0xaca6('0x14'),_0x35675e);logger[_0xaca6('0xd')](_0xaca6('0x14'),_0x35675e,JSON['stringify'](_0x1f8215));_0x35a2cc(_0x1f8215);})[_0xaca6('0x1e')](function(_0xfc4297){logger['error'](_0xaca6('0x14'),_0xfc4297[_0xaca6('0x12')],_0x35675e);_0x5b3671(_0xfb4af3[_0xaca6('0x10')](0x1f4,_0xfc4297['message']));});});};exports['ShowFreshdeskAccount']=function(_0x5f35fe){var _0x4f2fdb=this;return new Promise(function(_0x286830,_0x3953d2){return db[_0xaca6('0x15')][_0xaca6('0x1f')]({'raw':_0x5f35fe['options']?_0x5f35fe[_0xaca6('0x17')][_0xaca6('0x18')]===undefined?!![]:![]:!![],'where':_0x5f35fe[_0xaca6('0x17')]?_0x5f35fe[_0xaca6('0x17')][_0xaca6('0x19')]||null:null,'attributes':_0x5f35fe['options']?_0x5f35fe[_0xaca6('0x17')][_0xaca6('0x1d')]||null:null,'include':_0x5f35fe[_0xaca6('0x17')]?_0x5f35fe[_0xaca6('0x17')][_0xaca6('0x1b')]?_[_0xaca6('0x1c')](_0x5f35fe[_0xaca6('0x17')][_0xaca6('0x1b')],function(_0x30a52a){return{'model':db[_0x30a52a[_0xaca6('0x20')]],'as':_0x30a52a['as'],'attributes':_0x30a52a['attributes'],'include':_0x30a52a[_0xaca6('0x1b')]?_[_0xaca6('0x1c')](_0x30a52a[_0xaca6('0x1b')],function(_0x4e09ba){return{'model':db[_0x4e09ba[_0xaca6('0x20')]],'as':_0x4e09ba['as'],'attributes':_0x4e09ba['attributes'],'include':_0x4e09ba[_0xaca6('0x1b')]?_['map'](_0x4e09ba[_0xaca6('0x1b')],function(_0x31b6ca){return{'model':db[_0x31b6ca[_0xaca6('0x20')]],'as':_0x31b6ca['as'],'attributes':_0x31b6ca['attributes']};}):[]};}):[]};}):[]:[]})[_0xaca6('0x9')](function(_0x40488f){logger[_0xaca6('0xa')]('ShowFreshdeskAccount',_0x5f35fe);logger[_0xaca6('0xd')]('ShowFreshdeskAccount',_0x5f35fe,JSON[_0xaca6('0xf')](_0x40488f));_0x286830(_0x40488f);})[_0xaca6('0x1e')](function(_0x4c2a30){logger[_0xaca6('0x10')](_0xaca6('0x21'),_0x4c2a30[_0xaca6('0x12')],_0x5f35fe);_0x3953d2(_0x4f2fdb[_0xaca6('0x10')](0x1f4,_0x4c2a30['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 373c9d0..d6b4173 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 _0xfe2f=['../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfe2f,0xcb));var _0xffe2=function(_0x5155e0,_0x529c9b){_0x5155e0=_0x5155e0-0x0;var _0x50f278=_0xfe2f[_0x5155e0];return _0x50f278;};'use strict';var multer=require(_0xffe2('0x0'));var util=require(_0xffe2('0x1'));var path=require(_0xffe2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xffe2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xffe2('0x4'));var interaction=require(_0xffe2('0x5'));var config=require(_0xffe2('0x6'));var controller=require(_0xffe2('0x7'));router[_0xffe2('0x8')]('/',auth[_0xffe2('0x9')](),controller[_0xffe2('0xa')]);router[_0xffe2('0x8')](_0xffe2('0xb'),auth[_0xffe2('0x9')](),controller[_0xffe2('0xc')]);router[_0xffe2('0x8')](_0xffe2('0xd'),auth['isAuthenticated'](),controller[_0xffe2('0xe')]);router['get']('/:id/subjects',auth[_0xffe2('0x9')](),controller['getSubjects']);router[_0xffe2('0x8')](_0xffe2('0xf'),auth['isAuthenticated'](),controller[_0xffe2('0x10')]);router[_0xffe2('0x8')](_0xffe2('0x11'),auth[_0xffe2('0x9')](),controller[_0xffe2('0x12')]);router[_0xffe2('0x13')]('/',auth[_0xffe2('0x9')](),controller[_0xffe2('0x14')]);router[_0xffe2('0x13')]('/:id/tags',auth[_0xffe2('0x9')](),controller['setTags']);router[_0xffe2('0x15')](_0xffe2('0xb'),auth[_0xffe2('0x9')](),controller[_0xffe2('0x16')]);router[_0xffe2('0x17')]('/:id',auth[_0xffe2('0x9')](),controller[_0xffe2('0x18')]);module[_0xffe2('0x19')]=router; \ No newline at end of file +var _0x151b=['getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/tags'];(function(_0x6b7cf8,_0x2f5583){var _0x56332e=function(_0x841956){while(--_0x841956){_0x6b7cf8['push'](_0x6b7cf8['shift']());}};_0x56332e(++_0x2f5583);}(_0x151b,0x1dd));var _0xb151=function(_0x418e49,_0x57a47f){_0x418e49=_0x418e49-0x0;var _0x15e209=_0x151b[_0x418e49];return _0x15e209;};'use strict';var multer=require(_0xb151('0x0'));var util=require(_0xb151('0x1'));var path=require(_0xb151('0x2'));var timeout=require(_0xb151('0x3'));var express=require('express');var router=express[_0xb151('0x4')]();var fs_extra=require(_0xb151('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb151('0x6'));var config=require(_0xb151('0x7'));var controller=require(_0xb151('0x8'));router[_0xb151('0x9')]('/',auth[_0xb151('0xa')](),controller[_0xb151('0xb')]);router[_0xb151('0x9')](_0xb151('0xc'),auth['isAuthenticated'](),controller[_0xb151('0xd')]);router['get'](_0xb151('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xb151('0x9')]('/:id/subjects',auth[_0xb151('0xa')](),controller[_0xb151('0xf')]);router[_0xb151('0x9')]('/:id/descriptions',auth[_0xb151('0xa')](),controller['getDescriptions']);router['get'](_0xb151('0x10'),auth[_0xb151('0xa')](),controller[_0xb151('0x11')]);router[_0xb151('0x12')]('/',auth['isAuthenticated'](),controller[_0xb151('0x13')]);router[_0xb151('0x12')]('/:id/tags',auth['isAuthenticated'](),controller[_0xb151('0x14')]);router[_0xb151('0x15')]('/:id',auth[_0xb151('0xa')](),controller[_0xb151('0x16')]);router[_0xb151('0x17')](_0xb151('0xc'),auth[_0xb151('0xa')](),controller[_0xb151('0x18')]);module[_0xb151('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 398fe46..28480ec 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 _0xfd8a=['exports','STRING'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xfd8a,0xb8));var _0xafd8=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0xfd8a[_0x4c05da];return _0x1614db;};'use strict';var Sequelize=require('sequelize');module[_0xafd8('0x0')]={'name':{'type':Sequelize[_0xafd8('0x1')]},'description':{'type':Sequelize[_0xafd8('0x1')]}}; \ No newline at end of file +var _0x07f3=['sequelize'];(function(_0x3f18cf,_0x1de928){var _0x2e140d=function(_0x4eed56){while(--_0x4eed56){_0x3f18cf['push'](_0x3f18cf['shift']());}};_0x2e140d(++_0x1de928);}(_0x07f3,0x125));var _0x307f=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x07f3[_0x5e709a];return _0x57401a;};'use strict';var Sequelize=require(_0x307f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 99057bb..8cb64fb 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 _0xccc6=['send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','include','catch','show','params','includeAll','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xccc6,0x168));var _0x6ccc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xccc6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6ccc('0x0'));var rimraf=require(_0x6ccc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ccc('0x2'));var rp=require('request-promise');var moment=require(_0x6ccc('0x3'));var BPromise=require(_0x6ccc('0x4'));var Mustache=require('mustache');var util=require(_0x6ccc('0x5'));var path=require(_0x6ccc('0x6'));var sox=require(_0x6ccc('0x7'));var csv=require(_0x6ccc('0x8'));var ejs=require(_0x6ccc('0x9'));var fs=require('fs');var fs_extra=require(_0x6ccc('0xa'));var _=require(_0x6ccc('0xb'));var squel=require(_0x6ccc('0xc'));var crypto=require(_0x6ccc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6ccc('0xe'));var Papa=require(_0x6ccc('0xf'));var Redis=require(_0x6ccc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6ccc('0x11'));var as=require(_0x6ccc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6ccc('0x13'));var utils=require(_0x6ccc('0x14'));var config=require(_0x6ccc('0x15'));var licenseUtil=require(_0x6ccc('0x16'));var db=require(_0x6ccc('0x17'))['db'];function respondWithStatusCode(_0x394aeb,_0x49c48d){_0x49c48d=_0x49c48d||0xcc;return function(_0x2d0b06){if(_0x2d0b06){return _0x394aeb['sendStatus'](_0x49c48d);}return _0x394aeb['status'](_0x49c48d)[_0x6ccc('0x18')]();};}function respondWithResult(_0x5d90d6,_0x1c22ce){_0x1c22ce=_0x1c22ce||0xc8;return function(_0x7cdf3a){if(_0x7cdf3a){return _0x5d90d6[_0x6ccc('0x19')](_0x1c22ce)['json'](_0x7cdf3a);}};}function respondWithFilteredResult(_0x39a5d9,_0x12231c){return function(_0x523cbd){if(_0x523cbd){var _0x2ff674=typeof _0x12231c[_0x6ccc('0x1a')]===_0x6ccc('0x1b')&&typeof _0x12231c[_0x6ccc('0x1c')]===_0x6ccc('0x1b');var _0x38d0c7=_0x523cbd[_0x6ccc('0x1d')];var _0x308aa1=_0x2ff674?0x0:_0x12231c[_0x6ccc('0x1a')];var _0x38db28=_0x2ff674?_0x523cbd['count']:_0x12231c[_0x6ccc('0x1a')]+_0x12231c['limit'];var _0x548171;if(_0x38db28>=_0x38d0c7){_0x38db28=_0x38d0c7;_0x548171=0xc8;}else{_0x548171=0xce;}_0x39a5d9[_0x6ccc('0x19')](_0x548171);return _0x39a5d9[_0x6ccc('0x1e')](_0x6ccc('0x1f'),_0x308aa1+'-'+_0x38db28+'/'+_0x38d0c7)['json'](_0x523cbd);}return null;};}function patchUpdates(_0x5c4c22){return function(_0x1023c4){try{jsonpatch[_0x6ccc('0x20')](_0x1023c4,_0x5c4c22,!![]);}catch(_0x462b8d){return BPromise[_0x6ccc('0x21')](_0x462b8d);}return _0x1023c4['save']();};}function saveUpdates(_0x3941fb,_0x13396d){return function(_0x27cbf2){if(_0x27cbf2){return _0x27cbf2[_0x6ccc('0x22')](_0x3941fb)['then'](function(_0x686c9d){return _0x686c9d;});}return null;};}function removeEntity(_0xdbaaac,_0x145ec6){return function(_0x1e24ea){if(_0x1e24ea){return _0x1e24ea[_0x6ccc('0x23')]()[_0x6ccc('0x24')](function(){_0xdbaaac[_0x6ccc('0x19')](0xcc)[_0x6ccc('0x18')]();});}};}function handleEntityNotFound(_0x3dfb11,_0x15cd53){return function(_0x5cbe32){if(!_0x5cbe32){_0x3dfb11[_0x6ccc('0x25')](0x194);}return _0x5cbe32;};}function handleError(_0x266a16,_0x2a48a6){_0x2a48a6=_0x2a48a6||0x1f4;return function(_0x33f716){logger['error'](_0x33f716[_0x6ccc('0x26')]);if(_0x33f716[_0x6ccc('0x27')]){delete _0x33f716[_0x6ccc('0x27')];}_0x266a16['status'](_0x2a48a6)[_0x6ccc('0x28')](_0x33f716);};}exports[_0x6ccc('0x29')]=function(_0xd72c28,_0xbe841d){var _0x15ac5d={},_0xc687be={},_0x6500d6={'count':0x0,'rows':[]};var _0x40d8c0=_[_0x6ccc('0x2a')](db[_0x6ccc('0x2b')][_0x6ccc('0x2c')],function(_0x33e966){return{'name':_0x33e966['fieldName'],'type':_0x33e966['type'][_0x6ccc('0x2d')]};});_0xc687be[_0x6ccc('0x2e')]=_[_0x6ccc('0x2a')](_0x40d8c0,_0x6ccc('0x27'));_0xc687be[_0x6ccc('0x2f')]=_[_0x6ccc('0x30')](_0xd72c28[_0x6ccc('0x2f')]);_0xc687be[_0x6ccc('0x31')]=_[_0x6ccc('0x32')](_0xc687be[_0x6ccc('0x2e')],_0xc687be['query']);_0x15ac5d['attributes']=_['intersection'](_0xc687be[_0x6ccc('0x2e')],qs[_0x6ccc('0x33')](_0xd72c28[_0x6ccc('0x2f')][_0x6ccc('0x33')]));_0x15ac5d[_0x6ccc('0x34')]=_0x15ac5d[_0x6ccc('0x34')][_0x6ccc('0x35')]?_0x15ac5d['attributes']:_0xc687be[_0x6ccc('0x2e')];if(!_0xd72c28['query'][_0x6ccc('0x36')](_0x6ccc('0x37'))){_0x15ac5d['limit']=qs[_0x6ccc('0x1c')](_0xd72c28[_0x6ccc('0x2f')][_0x6ccc('0x1c')]);_0x15ac5d[_0x6ccc('0x1a')]=qs[_0x6ccc('0x1a')](_0xd72c28['query'][_0x6ccc('0x1a')]);}_0x15ac5d[_0x6ccc('0x38')]=qs[_0x6ccc('0x39')](_0xd72c28['query'][_0x6ccc('0x39')]);_0x15ac5d['where']=qs[_0x6ccc('0x31')](_[_0x6ccc('0x3a')](_0xd72c28[_0x6ccc('0x2f')],_0xc687be[_0x6ccc('0x31')]),_0x40d8c0);if(_0xd72c28[_0x6ccc('0x2f')][_0x6ccc('0x3b')]){_0x15ac5d[_0x6ccc('0x3c')]=_[_0x6ccc('0x3d')](_0x15ac5d[_0x6ccc('0x3c')],{'$or':_[_0x6ccc('0x2a')](_0x40d8c0,function(_0x234c7e){if(_0x234c7e[_0x6ccc('0x3e')]!=='VIRTUAL'){var _0x286480={};_0x286480[_0x234c7e[_0x6ccc('0x27')]]={'$like':'%'+_0xd72c28[_0x6ccc('0x2f')][_0x6ccc('0x3b')]+'%'};return _0x286480;}})});}_0x15ac5d=_['merge']({},_0x15ac5d,_0xd72c28[_0x6ccc('0x3f')]);var _0x33d8d7={'where':_0x15ac5d[_0x6ccc('0x3c')]};return db[_0x6ccc('0x2b')][_0x6ccc('0x1d')](_0x33d8d7)[_0x6ccc('0x24')](function(_0xb70dc3){_0x6500d6['count']=_0xb70dc3;if(_0xd72c28[_0x6ccc('0x2f')]['includeAll']){_0x15ac5d[_0x6ccc('0x40')]=[{'all':!![]}];}return db[_0x6ccc('0x2b')]['findAll'](_0x15ac5d);})[_0x6ccc('0x24')](function(_0x5b37d7){_0x6500d6['rows']=_0x5b37d7;return _0x6500d6;})[_0x6ccc('0x24')](respondWithFilteredResult(_0xbe841d,_0x15ac5d))[_0x6ccc('0x41')](handleError(_0xbe841d,null));};exports[_0x6ccc('0x42')]=function(_0x2dbb75,_0x27a3b3){var _0x2ce793={'raw':![],'where':{'id':_0x2dbb75[_0x6ccc('0x43')]['id']}},_0x2224d5={};_0x2224d5['model']=_[_0x6ccc('0x30')](db[_0x6ccc('0x2b')][_0x6ccc('0x2c')]);_0x2224d5[_0x6ccc('0x2f')]=_['keys'](_0x2dbb75['query']);_0x2224d5['filters']=_[_0x6ccc('0x32')](_0x2224d5['model'],_0x2224d5[_0x6ccc('0x2f')]);_0x2ce793['attributes']=_['intersection'](_0x2224d5[_0x6ccc('0x2e')],qs[_0x6ccc('0x33')](_0x2dbb75[_0x6ccc('0x2f')][_0x6ccc('0x33')]));_0x2ce793[_0x6ccc('0x34')]=_0x2ce793[_0x6ccc('0x34')][_0x6ccc('0x35')]?_0x2ce793['attributes']:_0x2224d5[_0x6ccc('0x2e')];if(_0x2dbb75[_0x6ccc('0x2f')][_0x6ccc('0x44')]){_0x2ce793[_0x6ccc('0x40')]=[{'all':!![]}];}_0x2ce793=_[_0x6ccc('0x3d')]({},_0x2ce793,_0x2dbb75['options']);return db['FreshdeskConfiguration'][_0x6ccc('0x45')](_0x2ce793)[_0x6ccc('0x24')](handleEntityNotFound(_0x27a3b3,null))['then'](respondWithResult(_0x27a3b3,null))['catch'](handleError(_0x27a3b3,null));};exports['create']=function(_0x510b24,_0x2bcd81){return db[_0x6ccc('0x2b')][_0x6ccc('0x46')](_0x510b24['body'],{})[_0x6ccc('0x24')](respondWithResult(_0x2bcd81,0xc9))[_0x6ccc('0x41')](handleError(_0x2bcd81,null));};exports[_0x6ccc('0x22')]=function(_0x3afa8d,_0x23646b){if(_0x3afa8d[_0x6ccc('0x47')]['id']){delete _0x3afa8d['body']['id'];}return db[_0x6ccc('0x2b')][_0x6ccc('0x45')]({'where':{'id':_0x3afa8d[_0x6ccc('0x43')]['id']}})[_0x6ccc('0x24')](handleEntityNotFound(_0x23646b,null))[_0x6ccc('0x24')](saveUpdates(_0x3afa8d['body'],null))[_0x6ccc('0x24')](respondWithResult(_0x23646b,null))['catch'](handleError(_0x23646b,null));};exports[_0x6ccc('0x23')]=function(_0x29b868,_0x519dc8){return db[_0x6ccc('0x2b')][_0x6ccc('0x45')]({'where':{'id':_0x29b868[_0x6ccc('0x43')]['id']}})['then'](handleEntityNotFound(_0x519dc8,null))[_0x6ccc('0x24')](removeEntity(_0x519dc8,null))[_0x6ccc('0x41')](handleError(_0x519dc8,null));};exports[_0x6ccc('0x48')]=function(_0x233a6a,_0x4ee5e7,_0x149b27){var _0x317201={};var _0x47af9e={};var _0x329a61;var _0x4c5b89;return db[_0x6ccc('0x2b')][_0x6ccc('0x49')]({'where':{'id':_0x233a6a[_0x6ccc('0x43')]['id']}})[_0x6ccc('0x24')](handleEntityNotFound(_0x4ee5e7,null))[_0x6ccc('0x24')](function(_0x4b1069){if(_0x4b1069){_0x329a61=_0x4b1069;_0x47af9e[_0x6ccc('0x2e')]=_[_0x6ccc('0x30')](db[_0x6ccc('0x4a')][_0x6ccc('0x2c')]);_0x47af9e[_0x6ccc('0x2f')]=_[_0x6ccc('0x30')](_0x233a6a[_0x6ccc('0x2f')]);_0x47af9e[_0x6ccc('0x31')]=_[_0x6ccc('0x32')](_0x47af9e[_0x6ccc('0x2e')],_0x47af9e['query']);_0x317201[_0x6ccc('0x34')]=_[_0x6ccc('0x32')](_0x47af9e['model'],qs[_0x6ccc('0x33')](_0x233a6a[_0x6ccc('0x2f')][_0x6ccc('0x33')]));_0x317201[_0x6ccc('0x34')]=_0x317201[_0x6ccc('0x34')]['length']?_0x317201[_0x6ccc('0x34')]:_0x47af9e[_0x6ccc('0x2e')];_0x317201['order']=qs[_0x6ccc('0x39')](_0x233a6a[_0x6ccc('0x2f')][_0x6ccc('0x39')]);_0x317201['where']=qs[_0x6ccc('0x31')](_[_0x6ccc('0x3a')](_0x233a6a['query'],_0x47af9e[_0x6ccc('0x31')]));if(_0x233a6a[_0x6ccc('0x2f')][_0x6ccc('0x3b')]){_0x317201[_0x6ccc('0x3c')]=_['merge'](_0x317201[_0x6ccc('0x3c')],{'$or':_['map'](_0x317201[_0x6ccc('0x34')],function(_0x46260d){var _0x4d7eeb={};_0x4d7eeb[_0x46260d]={'$like':'%'+_0x233a6a[_0x6ccc('0x2f')][_0x6ccc('0x3b')]+'%'};return _0x4d7eeb;})});}_0x317201=_[_0x6ccc('0x3d')]({},_0x317201,_0x233a6a['options']);return _0x329a61[_0x6ccc('0x48')](_0x317201);}})[_0x6ccc('0x24')](function(_0x5406c0){if(_0x5406c0){_0x4c5b89=_0x5406c0[_0x6ccc('0x35')];if(!_0x233a6a['query'][_0x6ccc('0x36')](_0x6ccc('0x37'))){_0x317201[_0x6ccc('0x1c')]=qs[_0x6ccc('0x1c')](_0x233a6a['query'][_0x6ccc('0x1c')]);_0x317201[_0x6ccc('0x1a')]=qs['offset'](_0x233a6a[_0x6ccc('0x2f')]['offset']);}return _0x329a61[_0x6ccc('0x48')](_0x317201);}})[_0x6ccc('0x24')](function(_0x486917){if(_0x486917){return _0x486917?{'count':_0x4c5b89,'rows':_0x486917}:null;}})[_0x6ccc('0x24')](respondWithResult(_0x4ee5e7,null))['catch'](handleError(_0x4ee5e7,null));};exports[_0x6ccc('0x4b')]=function(_0x4b5455,_0x470aa6,_0x3e4419){var _0x1434e7={};var _0x552572={};var _0x37d87b;var _0x1a8d2f;return db['FreshdeskConfiguration'][_0x6ccc('0x49')]({'where':{'id':_0x4b5455[_0x6ccc('0x43')]['id']}})[_0x6ccc('0x24')](handleEntityNotFound(_0x470aa6,null))['then'](function(_0x1e9c4a){if(_0x1e9c4a){_0x37d87b=_0x1e9c4a;_0x552572[_0x6ccc('0x2e')]=_[_0x6ccc('0x30')](db[_0x6ccc('0x4a')][_0x6ccc('0x2c')]);_0x552572[_0x6ccc('0x2f')]=_[_0x6ccc('0x30')](_0x4b5455['query']);_0x552572['filters']=_[_0x6ccc('0x32')](_0x552572[_0x6ccc('0x2e')],_0x552572['query']);_0x1434e7[_0x6ccc('0x34')]=_[_0x6ccc('0x32')](_0x552572[_0x6ccc('0x2e')],qs['fields'](_0x4b5455['query'][_0x6ccc('0x33')]));_0x1434e7[_0x6ccc('0x34')]=_0x1434e7[_0x6ccc('0x34')][_0x6ccc('0x35')]?_0x1434e7[_0x6ccc('0x34')]:_0x552572['model'];_0x1434e7[_0x6ccc('0x38')]=qs['sort'](_0x4b5455[_0x6ccc('0x2f')][_0x6ccc('0x39')]);_0x1434e7[_0x6ccc('0x3c')]=qs[_0x6ccc('0x31')](_[_0x6ccc('0x3a')](_0x4b5455[_0x6ccc('0x2f')],_0x552572['filters']));if(_0x4b5455[_0x6ccc('0x2f')]['filter']){_0x1434e7[_0x6ccc('0x3c')]=_[_0x6ccc('0x3d')](_0x1434e7['where'],{'$or':_[_0x6ccc('0x2a')](_0x1434e7[_0x6ccc('0x34')],function(_0x31dae3){var _0x116baf={};_0x116baf[_0x31dae3]={'$like':'%'+_0x4b5455['query']['filter']+'%'};return _0x116baf;})});}_0x1434e7=_['merge']({},_0x1434e7,_0x4b5455['options']);return _0x37d87b[_0x6ccc('0x4b')](_0x1434e7);}})[_0x6ccc('0x24')](function(_0x3821e7){if(_0x3821e7){_0x1a8d2f=_0x3821e7[_0x6ccc('0x35')];if(!_0x4b5455['query'][_0x6ccc('0x36')](_0x6ccc('0x37'))){_0x1434e7[_0x6ccc('0x1c')]=qs[_0x6ccc('0x1c')](_0x4b5455[_0x6ccc('0x2f')][_0x6ccc('0x1c')]);_0x1434e7[_0x6ccc('0x1a')]=qs[_0x6ccc('0x1a')](_0x4b5455[_0x6ccc('0x2f')][_0x6ccc('0x1a')]);}return _0x37d87b[_0x6ccc('0x4b')](_0x1434e7);}})[_0x6ccc('0x24')](function(_0x3fe759){if(_0x3fe759){return _0x3fe759?{'count':_0x1a8d2f,'rows':_0x3fe759}:null;}})[_0x6ccc('0x24')](respondWithResult(_0x470aa6,null))['catch'](handleError(_0x470aa6,null));};exports[_0x6ccc('0x4c')]=function(_0x588392,_0x3fc740,_0x3c7c21){var _0x3a25ac={};var _0x5941ad={};var _0x1005de;var _0xb7dc6e;return db['FreshdeskConfiguration'][_0x6ccc('0x49')]({'where':{'id':_0x588392['params']['id']}})[_0x6ccc('0x24')](handleEntityNotFound(_0x3fc740,null))['then'](function(_0x466e8e){if(_0x466e8e){_0x1005de=_0x466e8e;_0x5941ad[_0x6ccc('0x2e')]=_[_0x6ccc('0x30')](db['FreshdeskField'][_0x6ccc('0x2c')]);_0x5941ad[_0x6ccc('0x2f')]=_[_0x6ccc('0x30')](_0x588392[_0x6ccc('0x2f')]);_0x5941ad[_0x6ccc('0x31')]=_[_0x6ccc('0x32')](_0x5941ad['model'],_0x5941ad['query']);_0x3a25ac['attributes']=_[_0x6ccc('0x32')](_0x5941ad['model'],qs['fields'](_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x33')]));_0x3a25ac[_0x6ccc('0x34')]=_0x3a25ac[_0x6ccc('0x34')][_0x6ccc('0x35')]?_0x3a25ac[_0x6ccc('0x34')]:_0x5941ad[_0x6ccc('0x2e')];_0x3a25ac[_0x6ccc('0x38')]=qs[_0x6ccc('0x39')](_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x39')]);_0x3a25ac['where']=qs[_0x6ccc('0x31')](_[_0x6ccc('0x3a')](_0x588392['query'],_0x5941ad[_0x6ccc('0x31')]));if(_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x3b')]){_0x3a25ac['where']=_['merge'](_0x3a25ac['where'],{'$or':_[_0x6ccc('0x2a')](_0x3a25ac[_0x6ccc('0x34')],function(_0xc08dcc){var _0x56578c={};_0x56578c[_0xc08dcc]={'$like':'%'+_0x588392['query']['filter']+'%'};return _0x56578c;})});}_0x3a25ac=_['merge']({},_0x3a25ac,_0x588392[_0x6ccc('0x3f')]);return _0x1005de[_0x6ccc('0x4c')](_0x3a25ac);}})[_0x6ccc('0x24')](function(_0x1891ec){if(_0x1891ec){_0xb7dc6e=_0x1891ec['length'];if(!_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x36')](_0x6ccc('0x37'))){_0x3a25ac[_0x6ccc('0x1c')]=qs[_0x6ccc('0x1c')](_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x1c')]);_0x3a25ac[_0x6ccc('0x1a')]=qs[_0x6ccc('0x1a')](_0x588392[_0x6ccc('0x2f')][_0x6ccc('0x1a')]);}return _0x1005de['getDescriptions'](_0x3a25ac);}})[_0x6ccc('0x24')](function(_0x3d44e3){if(_0x3d44e3){return _0x3d44e3?{'count':_0xb7dc6e,'rows':_0x3d44e3}:null;}})[_0x6ccc('0x24')](respondWithResult(_0x3fc740,null))[_0x6ccc('0x41')](handleError(_0x3fc740,null));};exports[_0x6ccc('0x4d')]=function(_0x3cf9ca,_0x5708a8,_0x3a4b3d){var _0x556ef0={};var _0x44fb53={};var _0x5007a2;var _0x17374a;return db[_0x6ccc('0x2b')]['findOne']({'where':{'id':_0x3cf9ca['params']['id']}})[_0x6ccc('0x24')](handleEntityNotFound(_0x5708a8,null))[_0x6ccc('0x24')](function(_0x5ac01b){if(_0x5ac01b){_0x5007a2=_0x5ac01b;_0x44fb53[_0x6ccc('0x2e')]=_['keys'](db['Tag'][_0x6ccc('0x2c')]);_0x44fb53['query']=_[_0x6ccc('0x30')](_0x3cf9ca['query']);_0x44fb53['filters']=_[_0x6ccc('0x32')](_0x44fb53['model'],_0x44fb53[_0x6ccc('0x2f')]);_0x556ef0['attributes']=_[_0x6ccc('0x32')](_0x44fb53[_0x6ccc('0x2e')],qs[_0x6ccc('0x33')](_0x3cf9ca[_0x6ccc('0x2f')]['fields']));_0x556ef0['attributes']=_0x556ef0[_0x6ccc('0x34')][_0x6ccc('0x35')]?_0x556ef0[_0x6ccc('0x34')]:_0x44fb53[_0x6ccc('0x2e')];_0x556ef0[_0x6ccc('0x38')]=qs[_0x6ccc('0x39')](_0x3cf9ca[_0x6ccc('0x2f')]['sort']);_0x556ef0[_0x6ccc('0x3c')]=qs[_0x6ccc('0x31')](_[_0x6ccc('0x3a')](_0x3cf9ca[_0x6ccc('0x2f')],_0x44fb53[_0x6ccc('0x31')]));if(_0x3cf9ca[_0x6ccc('0x2f')][_0x6ccc('0x3b')]){_0x556ef0[_0x6ccc('0x3c')]=_[_0x6ccc('0x3d')](_0x556ef0[_0x6ccc('0x3c')],{'$or':_[_0x6ccc('0x2a')](_0x556ef0[_0x6ccc('0x34')],function(_0x103059){var _0x4a3c75={};_0x4a3c75[_0x103059]={'$like':'%'+_0x3cf9ca[_0x6ccc('0x2f')][_0x6ccc('0x3b')]+'%'};return _0x4a3c75;})});}_0x556ef0=_[_0x6ccc('0x3d')]({},_0x556ef0,_0x3cf9ca[_0x6ccc('0x3f')]);return _0x5007a2[_0x6ccc('0x4d')](_0x556ef0);}})['then'](function(_0x3a9f92){if(_0x3a9f92){_0x17374a=_0x3a9f92[_0x6ccc('0x35')];if(!_0x3cf9ca[_0x6ccc('0x2f')][_0x6ccc('0x36')](_0x6ccc('0x37'))){_0x556ef0['limit']=qs[_0x6ccc('0x1c')](_0x3cf9ca['query'][_0x6ccc('0x1c')]);_0x556ef0[_0x6ccc('0x1a')]=qs[_0x6ccc('0x1a')](_0x3cf9ca[_0x6ccc('0x2f')][_0x6ccc('0x1a')]);}return _0x5007a2[_0x6ccc('0x4d')](_0x556ef0);}})[_0x6ccc('0x24')](function(_0x1b071b){if(_0x1b071b){return _0x1b071b?{'count':_0x17374a,'rows':_0x1b071b}:null;}})['then'](respondWithResult(_0x5708a8,null))[_0x6ccc('0x41')](handleError(_0x5708a8,null));};exports[_0x6ccc('0x4e')]=function(_0x3abdc0,_0x2ff834,_0x9b7549){if(_0x3abdc0['body']['id']){delete _0x3abdc0[_0x6ccc('0x47')]['id'];}return db[_0x6ccc('0x2b')][_0x6ccc('0x49')]({'where':{'id':_0x3abdc0['params']['id']}})['then'](handleEntityNotFound(_0x2ff834,null))[_0x6ccc('0x24')](function(_0x4466e1){if(_0x4466e1){return _0x4466e1['setTags'](_0x3abdc0[_0x6ccc('0x47')][_0x6ccc('0x4f')]||[]);}return null;})[_0x6ccc('0x24')](respondWithResult(_0x2ff834,null))[_0x6ccc('0x41')](handleError(_0x2ff834,null));}; \ No newline at end of file +var _0x1d4a=['keys','find','catch','create','body','update','params','destroy','findOne','FreshdeskField','order','filter','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','end','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','show'];(function(_0x312abc,_0x17f25c){var _0x314298=function(_0x1d2e48){while(--_0x1d2e48){_0x312abc['push'](_0x312abc['shift']());}};_0x314298(++_0x17f25c);}(_0x1d4a,0x65));var _0xa1d4=function(_0x235703,_0x571b9a){_0x235703=_0x235703-0x0;var _0x940197=_0x1d4a[_0x235703];return _0x940197;};'use strict';var emlformat=require(_0xa1d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1d4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1d4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1d4('0x3'));var path=require(_0xa1d4('0x4'));var sox=require(_0xa1d4('0x5'));var csv=require('to-csv');var ejs=require(_0xa1d4('0x6'));var fs=require('fs');var fs_extra=require(_0xa1d4('0x7'));var _=require(_0xa1d4('0x8'));var squel=require(_0xa1d4('0x9'));var crypto=require(_0xa1d4('0xa'));var jsforce=require(_0xa1d4('0xb'));var deskjs=require(_0xa1d4('0xc'));var toCsv=require(_0xa1d4('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa1d4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1d4('0xf'));var hardwareService=require(_0xa1d4('0x10'));var logger=require('../../config/logger')(_0xa1d4('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa1d4('0x12'));var db=require(_0xa1d4('0x13'))['db'];function respondWithStatusCode(_0x3fe5c6,_0xaafba0){_0xaafba0=_0xaafba0||0xcc;return function(_0x81466a){if(_0x81466a){return _0x3fe5c6[_0xa1d4('0x14')](_0xaafba0);}return _0x3fe5c6['status'](_0xaafba0)['end']();};}function respondWithResult(_0x108af0,_0x2dd457){_0x2dd457=_0x2dd457||0xc8;return function(_0x420421){if(_0x420421){return _0x108af0[_0xa1d4('0x15')](_0x2dd457)[_0xa1d4('0x16')](_0x420421);}};}function respondWithFilteredResult(_0x4d28e6,_0x4604b7){return function(_0x2fda7b){if(_0x2fda7b){var _0x439a9b=typeof _0x4604b7['offset']===_0xa1d4('0x17')&&typeof _0x4604b7[_0xa1d4('0x18')]==='undefined';var _0x45dd9e=_0x2fda7b['count'];var _0x6990db=_0x439a9b?0x0:_0x4604b7['offset'];var _0x3603c1=_0x439a9b?_0x2fda7b[_0xa1d4('0x19')]:_0x4604b7[_0xa1d4('0x1a')]+_0x4604b7[_0xa1d4('0x18')];var _0x2a5872;if(_0x3603c1>=_0x45dd9e){_0x3603c1=_0x45dd9e;_0x2a5872=0xc8;}else{_0x2a5872=0xce;}_0x4d28e6['status'](_0x2a5872);return _0x4d28e6[_0xa1d4('0x1b')](_0xa1d4('0x1c'),_0x6990db+'-'+_0x3603c1+'/'+_0x45dd9e)[_0xa1d4('0x16')](_0x2fda7b);}return null;};}function patchUpdates(_0x424d0f){return function(_0x3e98ab){try{jsonpatch[_0xa1d4('0x1d')](_0x3e98ab,_0x424d0f,!![]);}catch(_0x2e1379){return BPromise[_0xa1d4('0x1e')](_0x2e1379);}return _0x3e98ab['save']();};}function saveUpdates(_0x4d8b8a,_0x2a0f54){return function(_0x1f2c1b){if(_0x1f2c1b){return _0x1f2c1b['update'](_0x4d8b8a)['then'](function(_0x350e7){return _0x350e7;});}return null;};}function removeEntity(_0x434328,_0x18d404){return function(_0x34aebc){if(_0x34aebc){return _0x34aebc['destroy']()[_0xa1d4('0x1f')](function(){_0x434328['status'](0xcc)[_0xa1d4('0x20')]();});}};}function handleEntityNotFound(_0x289688,_0x4a511c){return function(_0x1837c8){if(!_0x1837c8){_0x289688[_0xa1d4('0x14')](0x194);}return _0x1837c8;};}function handleError(_0x2609c5,_0x318c6b){_0x318c6b=_0x318c6b||0x1f4;return function(_0x2cd3dd){logger['error'](_0x2cd3dd[_0xa1d4('0x21')]);if(_0x2cd3dd[_0xa1d4('0x22')]){delete _0x2cd3dd['name'];}_0x2609c5[_0xa1d4('0x15')](_0x318c6b)[_0xa1d4('0x23')](_0x2cd3dd);};}exports[_0xa1d4('0x24')]=function(_0x2c6bd2,_0x5eafaf){var _0x42eb93={},_0x4de562={},_0x47c495={'count':0x0,'rows':[]};var _0x3e5284=_[_0xa1d4('0x25')](db[_0xa1d4('0x26')][_0xa1d4('0x27')],function(_0x589035){return{'name':_0x589035[_0xa1d4('0x28')],'type':_0x589035[_0xa1d4('0x29')][_0xa1d4('0x2a')]};});_0x4de562['model']=_['map'](_0x3e5284,_0xa1d4('0x22'));_0x4de562[_0xa1d4('0x2b')]=_['keys'](_0x2c6bd2[_0xa1d4('0x2b')]);_0x4de562[_0xa1d4('0x2c')]=_[_0xa1d4('0x2d')](_0x4de562[_0xa1d4('0x2e')],_0x4de562['query']);_0x42eb93[_0xa1d4('0x2f')]=_[_0xa1d4('0x2d')](_0x4de562[_0xa1d4('0x2e')],qs['fields'](_0x2c6bd2[_0xa1d4('0x2b')][_0xa1d4('0x30')]));_0x42eb93[_0xa1d4('0x2f')]=_0x42eb93[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0x42eb93[_0xa1d4('0x2f')]:_0x4de562[_0xa1d4('0x2e')];if(!_0x2c6bd2['query'][_0xa1d4('0x32')](_0xa1d4('0x33'))){_0x42eb93[_0xa1d4('0x18')]=qs[_0xa1d4('0x18')](_0x2c6bd2[_0xa1d4('0x2b')][_0xa1d4('0x18')]);_0x42eb93[_0xa1d4('0x1a')]=qs['offset'](_0x2c6bd2[_0xa1d4('0x2b')][_0xa1d4('0x1a')]);}_0x42eb93['order']=qs['sort'](_0x2c6bd2[_0xa1d4('0x2b')][_0xa1d4('0x34')]);_0x42eb93[_0xa1d4('0x35')]=qs[_0xa1d4('0x2c')](_[_0xa1d4('0x36')](_0x2c6bd2[_0xa1d4('0x2b')],_0x4de562[_0xa1d4('0x2c')]),_0x3e5284);if(_0x2c6bd2['query']['filter']){_0x42eb93['where']=_['merge'](_0x42eb93[_0xa1d4('0x35')],{'$or':_['map'](_0x3e5284,function(_0x1daf02){if(_0x1daf02[_0xa1d4('0x29')]!==_0xa1d4('0x37')){var _0x1dd29c={};_0x1dd29c[_0x1daf02['name']]={'$like':'%'+_0x2c6bd2[_0xa1d4('0x2b')]['filter']+'%'};return _0x1dd29c;}})});}_0x42eb93=_[_0xa1d4('0x38')]({},_0x42eb93,_0x2c6bd2[_0xa1d4('0x39')]);var _0x17b63b={'where':_0x42eb93['where']};return db['FreshdeskConfiguration'][_0xa1d4('0x19')](_0x17b63b)[_0xa1d4('0x1f')](function(_0x44ba8b){_0x47c495[_0xa1d4('0x19')]=_0x44ba8b;if(_0x2c6bd2[_0xa1d4('0x2b')][_0xa1d4('0x3a')]){_0x42eb93[_0xa1d4('0x3b')]=[{'all':!![]}];}return db[_0xa1d4('0x26')][_0xa1d4('0x3c')](_0x42eb93);})[_0xa1d4('0x1f')](function(_0x29d8f1){_0x47c495[_0xa1d4('0x3d')]=_0x29d8f1;return _0x47c495;})[_0xa1d4('0x1f')](respondWithFilteredResult(_0x5eafaf,_0x42eb93))['catch'](handleError(_0x5eafaf,null));};exports[_0xa1d4('0x3e')]=function(_0x2a56eb,_0x96274){var _0x23b9d9={'raw':![],'where':{'id':_0x2a56eb['params']['id']}},_0x33e032={};_0x33e032['model']=_[_0xa1d4('0x3f')](db[_0xa1d4('0x26')][_0xa1d4('0x27')]);_0x33e032[_0xa1d4('0x2b')]=_[_0xa1d4('0x3f')](_0x2a56eb[_0xa1d4('0x2b')]);_0x33e032[_0xa1d4('0x2c')]=_[_0xa1d4('0x2d')](_0x33e032[_0xa1d4('0x2e')],_0x33e032[_0xa1d4('0x2b')]);_0x23b9d9['attributes']=_[_0xa1d4('0x2d')](_0x33e032['model'],qs[_0xa1d4('0x30')](_0x2a56eb[_0xa1d4('0x2b')][_0xa1d4('0x30')]));_0x23b9d9[_0xa1d4('0x2f')]=_0x23b9d9[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0x23b9d9['attributes']:_0x33e032[_0xa1d4('0x2e')];if(_0x2a56eb[_0xa1d4('0x2b')]['includeAll']){_0x23b9d9[_0xa1d4('0x3b')]=[{'all':!![]}];}_0x23b9d9=_['merge']({},_0x23b9d9,_0x2a56eb[_0xa1d4('0x39')]);return db[_0xa1d4('0x26')][_0xa1d4('0x40')](_0x23b9d9)['then'](handleEntityNotFound(_0x96274,null))[_0xa1d4('0x1f')](respondWithResult(_0x96274,null))[_0xa1d4('0x41')](handleError(_0x96274,null));};exports[_0xa1d4('0x42')]=function(_0x11ca66,_0x3b246f){return db[_0xa1d4('0x26')]['create'](_0x11ca66[_0xa1d4('0x43')],{})[_0xa1d4('0x1f')](respondWithResult(_0x3b246f,0xc9))['catch'](handleError(_0x3b246f,null));};exports[_0xa1d4('0x44')]=function(_0x26c381,_0x4f14db){if(_0x26c381[_0xa1d4('0x43')]['id']){delete _0x26c381[_0xa1d4('0x43')]['id'];}return db['FreshdeskConfiguration'][_0xa1d4('0x40')]({'where':{'id':_0x26c381[_0xa1d4('0x45')]['id']}})[_0xa1d4('0x1f')](handleEntityNotFound(_0x4f14db,null))[_0xa1d4('0x1f')](saveUpdates(_0x26c381[_0xa1d4('0x43')],null))[_0xa1d4('0x1f')](respondWithResult(_0x4f14db,null))[_0xa1d4('0x41')](handleError(_0x4f14db,null));};exports[_0xa1d4('0x46')]=function(_0x215568,_0x14aaa1){return db[_0xa1d4('0x26')]['find']({'where':{'id':_0x215568[_0xa1d4('0x45')]['id']}})[_0xa1d4('0x1f')](handleEntityNotFound(_0x14aaa1,null))['then'](removeEntity(_0x14aaa1,null))[_0xa1d4('0x41')](handleError(_0x14aaa1,null));};exports['getFields']=function(_0xdb176c,_0x3ded87,_0x1510ab){var _0xb850e5={};var _0x445aaf={};var _0x8c5615;var _0x23ee1a;return db[_0xa1d4('0x26')][_0xa1d4('0x47')]({'where':{'id':_0xdb176c['params']['id']}})[_0xa1d4('0x1f')](handleEntityNotFound(_0x3ded87,null))[_0xa1d4('0x1f')](function(_0x42282f){if(_0x42282f){_0x8c5615=_0x42282f;_0x445aaf[_0xa1d4('0x2e')]=_[_0xa1d4('0x3f')](db[_0xa1d4('0x48')][_0xa1d4('0x27')]);_0x445aaf[_0xa1d4('0x2b')]=_[_0xa1d4('0x3f')](_0xdb176c[_0xa1d4('0x2b')]);_0x445aaf[_0xa1d4('0x2c')]=_[_0xa1d4('0x2d')](_0x445aaf[_0xa1d4('0x2e')],_0x445aaf['query']);_0xb850e5[_0xa1d4('0x2f')]=_[_0xa1d4('0x2d')](_0x445aaf['model'],qs[_0xa1d4('0x30')](_0xdb176c[_0xa1d4('0x2b')][_0xa1d4('0x30')]));_0xb850e5[_0xa1d4('0x2f')]=_0xb850e5[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0xb850e5['attributes']:_0x445aaf['model'];_0xb850e5[_0xa1d4('0x49')]=qs[_0xa1d4('0x34')](_0xdb176c[_0xa1d4('0x2b')][_0xa1d4('0x34')]);_0xb850e5[_0xa1d4('0x35')]=qs[_0xa1d4('0x2c')](_['pick'](_0xdb176c[_0xa1d4('0x2b')],_0x445aaf['filters']));if(_0xdb176c[_0xa1d4('0x2b')]['filter']){_0xb850e5['where']=_[_0xa1d4('0x38')](_0xb850e5[_0xa1d4('0x35')],{'$or':_[_0xa1d4('0x25')](_0xb850e5[_0xa1d4('0x2f')],function(_0x17dede){var _0x3b475a={};_0x3b475a[_0x17dede]={'$like':'%'+_0xdb176c[_0xa1d4('0x2b')][_0xa1d4('0x4a')]+'%'};return _0x3b475a;})});}_0xb850e5=_[_0xa1d4('0x38')]({},_0xb850e5,_0xdb176c[_0xa1d4('0x39')]);return _0x8c5615[_0xa1d4('0x4b')](_0xb850e5);}})['then'](function(_0x5808e5){if(_0x5808e5){_0x23ee1a=_0x5808e5['length'];if(!_0xdb176c[_0xa1d4('0x2b')][_0xa1d4('0x32')](_0xa1d4('0x33'))){_0xb850e5['limit']=qs[_0xa1d4('0x18')](_0xdb176c['query'][_0xa1d4('0x18')]);_0xb850e5[_0xa1d4('0x1a')]=qs['offset'](_0xdb176c[_0xa1d4('0x2b')][_0xa1d4('0x1a')]);}return _0x8c5615[_0xa1d4('0x4b')](_0xb850e5);}})['then'](function(_0x3285b7){if(_0x3285b7){return _0x3285b7?{'count':_0x23ee1a,'rows':_0x3285b7}:null;}})['then'](respondWithResult(_0x3ded87,null))[_0xa1d4('0x41')](handleError(_0x3ded87,null));};exports[_0xa1d4('0x4c')]=function(_0x308e86,_0x553213,_0x311bf5){var _0x23dfde={};var _0x33ed7d={};var _0x26ac09;var _0xc3a9cb;return db[_0xa1d4('0x26')][_0xa1d4('0x47')]({'where':{'id':_0x308e86[_0xa1d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x553213,null))[_0xa1d4('0x1f')](function(_0xf795f3){if(_0xf795f3){_0x26ac09=_0xf795f3;_0x33ed7d['model']=_[_0xa1d4('0x3f')](db[_0xa1d4('0x48')][_0xa1d4('0x27')]);_0x33ed7d[_0xa1d4('0x2b')]=_[_0xa1d4('0x3f')](_0x308e86[_0xa1d4('0x2b')]);_0x33ed7d[_0xa1d4('0x2c')]=_['intersection'](_0x33ed7d[_0xa1d4('0x2e')],_0x33ed7d[_0xa1d4('0x2b')]);_0x23dfde[_0xa1d4('0x2f')]=_[_0xa1d4('0x2d')](_0x33ed7d['model'],qs[_0xa1d4('0x30')](_0x308e86[_0xa1d4('0x2b')]['fields']));_0x23dfde[_0xa1d4('0x2f')]=_0x23dfde[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0x23dfde[_0xa1d4('0x2f')]:_0x33ed7d[_0xa1d4('0x2e')];_0x23dfde['order']=qs[_0xa1d4('0x34')](_0x308e86['query']['sort']);_0x23dfde['where']=qs[_0xa1d4('0x2c')](_['pick'](_0x308e86['query'],_0x33ed7d[_0xa1d4('0x2c')]));if(_0x308e86[_0xa1d4('0x2b')][_0xa1d4('0x4a')]){_0x23dfde[_0xa1d4('0x35')]=_[_0xa1d4('0x38')](_0x23dfde[_0xa1d4('0x35')],{'$or':_[_0xa1d4('0x25')](_0x23dfde['attributes'],function(_0x1dbf19){var _0x5f27f8={};_0x5f27f8[_0x1dbf19]={'$like':'%'+_0x308e86[_0xa1d4('0x2b')][_0xa1d4('0x4a')]+'%'};return _0x5f27f8;})});}_0x23dfde=_[_0xa1d4('0x38')]({},_0x23dfde,_0x308e86[_0xa1d4('0x39')]);return _0x26ac09[_0xa1d4('0x4c')](_0x23dfde);}})[_0xa1d4('0x1f')](function(_0x2f8252){if(_0x2f8252){_0xc3a9cb=_0x2f8252[_0xa1d4('0x31')];if(!_0x308e86[_0xa1d4('0x2b')][_0xa1d4('0x32')](_0xa1d4('0x33'))){_0x23dfde[_0xa1d4('0x18')]=qs['limit'](_0x308e86['query']['limit']);_0x23dfde[_0xa1d4('0x1a')]=qs[_0xa1d4('0x1a')](_0x308e86[_0xa1d4('0x2b')][_0xa1d4('0x1a')]);}return _0x26ac09['getSubjects'](_0x23dfde);}})[_0xa1d4('0x1f')](function(_0x1f513b){if(_0x1f513b){return _0x1f513b?{'count':_0xc3a9cb,'rows':_0x1f513b}:null;}})[_0xa1d4('0x1f')](respondWithResult(_0x553213,null))[_0xa1d4('0x41')](handleError(_0x553213,null));};exports[_0xa1d4('0x4d')]=function(_0x37546c,_0x540242,_0x29f5c5){var _0x23af1b={};var _0x16d091={};var _0x55168f;var _0x37c673;return db[_0xa1d4('0x26')][_0xa1d4('0x47')]({'where':{'id':_0x37546c['params']['id']}})[_0xa1d4('0x1f')](handleEntityNotFound(_0x540242,null))['then'](function(_0x2ac665){if(_0x2ac665){_0x55168f=_0x2ac665;_0x16d091[_0xa1d4('0x2e')]=_[_0xa1d4('0x3f')](db[_0xa1d4('0x48')][_0xa1d4('0x27')]);_0x16d091[_0xa1d4('0x2b')]=_['keys'](_0x37546c[_0xa1d4('0x2b')]);_0x16d091[_0xa1d4('0x2c')]=_[_0xa1d4('0x2d')](_0x16d091['model'],_0x16d091['query']);_0x23af1b[_0xa1d4('0x2f')]=_[_0xa1d4('0x2d')](_0x16d091[_0xa1d4('0x2e')],qs[_0xa1d4('0x30')](_0x37546c[_0xa1d4('0x2b')][_0xa1d4('0x30')]));_0x23af1b[_0xa1d4('0x2f')]=_0x23af1b[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0x23af1b['attributes']:_0x16d091[_0xa1d4('0x2e')];_0x23af1b[_0xa1d4('0x49')]=qs[_0xa1d4('0x34')](_0x37546c[_0xa1d4('0x2b')][_0xa1d4('0x34')]);_0x23af1b[_0xa1d4('0x35')]=qs[_0xa1d4('0x2c')](_[_0xa1d4('0x36')](_0x37546c['query'],_0x16d091[_0xa1d4('0x2c')]));if(_0x37546c[_0xa1d4('0x2b')][_0xa1d4('0x4a')]){_0x23af1b[_0xa1d4('0x35')]=_[_0xa1d4('0x38')](_0x23af1b['where'],{'$or':_[_0xa1d4('0x25')](_0x23af1b['attributes'],function(_0x4a3037){var _0x2d4bf9={};_0x2d4bf9[_0x4a3037]={'$like':'%'+_0x37546c[_0xa1d4('0x2b')]['filter']+'%'};return _0x2d4bf9;})});}_0x23af1b=_[_0xa1d4('0x38')]({},_0x23af1b,_0x37546c['options']);return _0x55168f['getDescriptions'](_0x23af1b);}})[_0xa1d4('0x1f')](function(_0x2da478){if(_0x2da478){_0x37c673=_0x2da478[_0xa1d4('0x31')];if(!_0x37546c[_0xa1d4('0x2b')]['hasOwnProperty']('nolimit')){_0x23af1b[_0xa1d4('0x18')]=qs['limit'](_0x37546c[_0xa1d4('0x2b')][_0xa1d4('0x18')]);_0x23af1b['offset']=qs[_0xa1d4('0x1a')](_0x37546c[_0xa1d4('0x2b')][_0xa1d4('0x1a')]);}return _0x55168f[_0xa1d4('0x4d')](_0x23af1b);}})[_0xa1d4('0x1f')](function(_0x1a071d){if(_0x1a071d){return _0x1a071d?{'count':_0x37c673,'rows':_0x1a071d}:null;}})[_0xa1d4('0x1f')](respondWithResult(_0x540242,null))[_0xa1d4('0x41')](handleError(_0x540242,null));};exports[_0xa1d4('0x4e')]=function(_0x3d4067,_0x2baf39,_0x300c1e){var _0x4374f6={};var _0x421f38={};var _0x431979;var _0x4accce;return db[_0xa1d4('0x26')][_0xa1d4('0x47')]({'where':{'id':_0x3d4067[_0xa1d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2baf39,null))[_0xa1d4('0x1f')](function(_0x47f43d){if(_0x47f43d){_0x431979=_0x47f43d;_0x421f38[_0xa1d4('0x2e')]=_['keys'](db[_0xa1d4('0x4f')][_0xa1d4('0x27')]);_0x421f38[_0xa1d4('0x2b')]=_[_0xa1d4('0x3f')](_0x3d4067['query']);_0x421f38[_0xa1d4('0x2c')]=_['intersection'](_0x421f38[_0xa1d4('0x2e')],_0x421f38['query']);_0x4374f6['attributes']=_[_0xa1d4('0x2d')](_0x421f38[_0xa1d4('0x2e')],qs[_0xa1d4('0x30')](_0x3d4067[_0xa1d4('0x2b')][_0xa1d4('0x30')]));_0x4374f6[_0xa1d4('0x2f')]=_0x4374f6[_0xa1d4('0x2f')][_0xa1d4('0x31')]?_0x4374f6[_0xa1d4('0x2f')]:_0x421f38[_0xa1d4('0x2e')];_0x4374f6['order']=qs[_0xa1d4('0x34')](_0x3d4067[_0xa1d4('0x2b')][_0xa1d4('0x34')]);_0x4374f6['where']=qs[_0xa1d4('0x2c')](_[_0xa1d4('0x36')](_0x3d4067[_0xa1d4('0x2b')],_0x421f38['filters']));if(_0x3d4067[_0xa1d4('0x2b')][_0xa1d4('0x4a')]){_0x4374f6[_0xa1d4('0x35')]=_['merge'](_0x4374f6[_0xa1d4('0x35')],{'$or':_[_0xa1d4('0x25')](_0x4374f6[_0xa1d4('0x2f')],function(_0x35bda7){var _0x5bf121={};_0x5bf121[_0x35bda7]={'$like':'%'+_0x3d4067[_0xa1d4('0x2b')]['filter']+'%'};return _0x5bf121;})});}_0x4374f6=_[_0xa1d4('0x38')]({},_0x4374f6,_0x3d4067['options']);return _0x431979[_0xa1d4('0x4e')](_0x4374f6);}})['then'](function(_0x4b5ec7){if(_0x4b5ec7){_0x4accce=_0x4b5ec7['length'];if(!_0x3d4067['query']['hasOwnProperty'](_0xa1d4('0x33'))){_0x4374f6[_0xa1d4('0x18')]=qs['limit'](_0x3d4067[_0xa1d4('0x2b')][_0xa1d4('0x18')]);_0x4374f6[_0xa1d4('0x1a')]=qs[_0xa1d4('0x1a')](_0x3d4067[_0xa1d4('0x2b')]['offset']);}return _0x431979[_0xa1d4('0x4e')](_0x4374f6);}})[_0xa1d4('0x1f')](function(_0x5733ae){if(_0x5733ae){return _0x5733ae?{'count':_0x4accce,'rows':_0x5733ae}:null;}})['then'](respondWithResult(_0x2baf39,null))[_0xa1d4('0x41')](handleError(_0x2baf39,null));};exports[_0xa1d4('0x50')]=function(_0x7b8427,_0x55e58c,_0x292ad3){if(_0x7b8427['body']['id']){delete _0x7b8427['body']['id'];}return db[_0xa1d4('0x26')][_0xa1d4('0x47')]({'where':{'id':_0x7b8427['params']['id']}})[_0xa1d4('0x1f')](handleEntityNotFound(_0x55e58c,null))[_0xa1d4('0x1f')](function(_0x451cc4){if(_0x451cc4){return _0x451cc4[_0xa1d4('0x50')](_0x7b8427[_0xa1d4('0x43')][_0xa1d4('0x51')]||[]);}return null;})[_0xa1d4('0x1f')](respondWithResult(_0x55e58c,null))[_0xa1d4('0x41')](handleError(_0x55e58c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 521176b..d88f28c 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 _0xafd8=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2f6e30,_0x52b3a5){var _0x3eb6df=function(_0x18246c){while(--_0x18246c){_0x2f6e30['push'](_0x2f6e30['shift']());}};_0x3eb6df(++_0x52b3a5);}(_0xafd8,0x93));var _0x8afd=function(_0x5af812,_0x43d252){_0x5af812=_0x5af812-0x0;var _0x1489f2=_0xafd8[_0x5af812];return _0x1489f2;};'use strict';var _=require(_0x8afd('0x0'));var util=require('util');var logger=require(_0x8afd('0x1'))('api');var moment=require(_0x8afd('0x2'));var BPromise=require(_0x8afd('0x3'));var rp=require(_0x8afd('0x4'));var fs=require('fs');var path=require(_0x8afd('0x5'));var rimraf=require(_0x8afd('0x6'));var config=require(_0x8afd('0x7'));var attributes=require(_0x8afd('0x8'));module[_0x8afd('0x9')]=function(_0x26f227,_0x9f75f3){return _0x26f227[_0x8afd('0xa')](_0x8afd('0xb'),attributes,{'tableName':_0x8afd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d95=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x3f48c8,_0x299d53){var _0x4c7512=function(_0x526393){while(--_0x526393){_0x3f48c8['push'](_0x3f48c8['shift']());}};_0x4c7512(++_0x299d53);}(_0x5d95,0x11d));var _0x55d9=function(_0x5a5fe6,_0x38511d){_0x5a5fe6=_0x5a5fe6-0x0;var _0x343454=_0x5d95[_0x5a5fe6];return _0x343454;};'use strict';var _=require(_0x55d9('0x0'));var util=require(_0x55d9('0x1'));var logger=require(_0x55d9('0x2'))(_0x55d9('0x3'));var moment=require('moment');var BPromise=require(_0x55d9('0x4'));var rp=require(_0x55d9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x55d9('0x6'));var attributes=require(_0x55d9('0x7'));module['exports']=function(_0x39d608,_0x40be38){return _0x39d608[_0x55d9('0x8')](_0x55d9('0x9'),attributes,{'tableName':_0x55d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index a82506e..3922075 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 _0xacda=['request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xacda,0x90));var _0xaacd=function(_0x417ec6,_0x5caecd){_0x417ec6=_0x417ec6-0x0;var _0x42b3f4=_0xacda[_0x417ec6];return _0x42b3f4;};'use strict';var _=require(_0xaacd('0x0'));var util=require(_0xaacd('0x1'));var moment=require('moment');var BPromise=require(_0xaacd('0x2'));var rs=require(_0xaacd('0x3'));var fs=require('fs');var Redis=require(_0xaacd('0x4'));var db=require(_0xaacd('0x5'))['db'];var utils=require(_0xaacd('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xaacd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaacd('0x8')][_0xaacd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5308da,_0x67a38d,_0x2fd4a7){return new BPromise(function(_0x5c1dc5,_0x37755b){return client[_0xaacd('0xa')](_0x5308da,_0x2fd4a7)[_0xaacd('0xb')](function(_0x1506c5){logger[_0xaacd('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x67a38d,_0xaacd('0xd'));logger[_0xaacd('0xe')](_0xaacd('0xf'),_0x67a38d,_0xaacd('0xd'),JSON[_0xaacd('0x10')](_0x1506c5));if(_0x1506c5[_0xaacd('0x11')]){if(_0x1506c5[_0xaacd('0x11')][_0xaacd('0x12')]===0x1f4){logger[_0xaacd('0x11')](_0xaacd('0x13'),_0x67a38d,_0x1506c5[_0xaacd('0x11')][_0xaacd('0x14')]);return _0x37755b(_0x1506c5[_0xaacd('0x11')][_0xaacd('0x14')]);}logger['error'](_0xaacd('0x13'),_0x67a38d,_0x1506c5['error'][_0xaacd('0x14')]);return _0x5c1dc5(_0x1506c5['error'][_0xaacd('0x14')]);}else{logger[_0xaacd('0xc')](_0xaacd('0x13'),_0x67a38d,_0xaacd('0xd'));_0x5c1dc5(_0x1506c5[_0xaacd('0x15')]['message']);}})['catch'](function(_0x3fd1d7){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x67a38d,_0x3fd1d7);_0x37755b(_0x3fd1d7);});});} \ No newline at end of file +var _0xa38c=['result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x3f55b9,_0x1b573f){var _0x45f8de=function(_0x478db9){while(--_0x478db9){_0x3f55b9['push'](_0x3f55b9['shift']());}};_0x45f8de(++_0x1b573f);}(_0xa38c,0x169));var _0xca38=function(_0x40e8e0,_0x4c3b8a){_0x40e8e0=_0x40e8e0-0x0;var _0x5811cc=_0xa38c[_0x40e8e0];return _0x5811cc;};'use strict';var _=require('lodash');var util=require(_0xca38('0x0'));var moment=require(_0xca38('0x1'));var BPromise=require(_0xca38('0x2'));var rs=require(_0xca38('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca38('0x4'))['db'];var utils=require(_0xca38('0x5'));var logger=require(_0xca38('0x6'))(_0xca38('0x7'));var config=require(_0xca38('0x8'));var jayson=require(_0xca38('0x9'));var client=jayson[_0xca38('0xa')][_0xca38('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e2b1a,_0xbbfba5,_0x460d9e){return new BPromise(function(_0xcedc0d,_0x3ea506){return client[_0xca38('0xc')](_0x1e2b1a,_0x460d9e)[_0xca38('0xd')](function(_0x5e5a72){logger[_0xca38('0xe')](_0xca38('0xf'),_0xbbfba5,'request\x20sent');logger[_0xca38('0x10')](_0xca38('0x11'),_0xbbfba5,_0xca38('0x12'),JSON[_0xca38('0x13')](_0x5e5a72));if(_0x5e5a72['error']){if(_0x5e5a72['error'][_0xca38('0x14')]===0x1f4){logger[_0xca38('0x15')](_0xca38('0xf'),_0xbbfba5,_0x5e5a72[_0xca38('0x15')][_0xca38('0x16')]);return _0x3ea506(_0x5e5a72['error']['message']);}logger[_0xca38('0x15')](_0xca38('0xf'),_0xbbfba5,_0x5e5a72[_0xca38('0x15')]['message']);return _0xcedc0d(_0x5e5a72['error'][_0xca38('0x16')]);}else{logger[_0xca38('0xe')](_0xca38('0xf'),_0xbbfba5,'request\x20sent');_0xcedc0d(_0x5e5a72[_0xca38('0x17')]['message']);}})['catch'](function(_0x34c044){logger[_0xca38('0x15')](_0xca38('0xf'),_0xbbfba5,_0x34c044);_0x3ea506(_0x34c044);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 460f374..9b73fe8 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 _0xb5d5=['fs-extra','../../components/auth/service','./intFreshdeskField.controller','index','get','/:id','isAuthenticated','show','post','create','delete','destroy','exports','util','connect-timeout','Router'];(function(_0x1b9cd5,_0x103dc4){var _0x4c74ca=function(_0x460b5e){while(--_0x460b5e){_0x1b9cd5['push'](_0x1b9cd5['shift']());}};_0x4c74ca(++_0x103dc4);}(_0xb5d5,0x7d));var _0x5b5d=function(_0x396764,_0xa1a5d0){_0x396764=_0x396764-0x0;var _0x12f0de=_0xb5d5[_0x396764];return _0x12f0de;};'use strict';var multer=require('multer');var util=require(_0x5b5d('0x0'));var path=require('path');var timeout=require(_0x5b5d('0x1'));var express=require('express');var router=express[_0x5b5d('0x2')]();var fs_extra=require(_0x5b5d('0x3'));var auth=require(_0x5b5d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b5d('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x5b5d('0x6')]);router[_0x5b5d('0x7')](_0x5b5d('0x8'),auth[_0x5b5d('0x9')](),controller[_0x5b5d('0xa')]);router[_0x5b5d('0xb')]('/',auth[_0x5b5d('0x9')](),controller[_0x5b5d('0xc')]);router['put']('/:id',auth[_0x5b5d('0x9')](),controller['update']);router[_0x5b5d('0xd')](_0x5b5d('0x8'),auth[_0x5b5d('0x9')](),controller[_0x5b5d('0xe')]);module[_0x5b5d('0xf')]=router; \ No newline at end of file +var _0xa9ab=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','show','post','isAuthenticated','create','put','/:id','delete','destroy','util','path','express'];(function(_0x13834a,_0x4b6d38){var _0x20050c=function(_0x588874){while(--_0x588874){_0x13834a['push'](_0x13834a['shift']());}};_0x20050c(++_0x4b6d38);}(_0xa9ab,0xbb));var _0xba9a=function(_0xfff265,_0x41f693){_0xfff265=_0xfff265-0x0;var _0x55442d=_0xa9ab[_0xfff265];return _0x55442d;};'use strict';var multer=require('multer');var util=require(_0xba9a('0x0'));var path=require(_0xba9a('0x1'));var timeout=require('connect-timeout');var express=require(_0xba9a('0x2'));var router=express[_0xba9a('0x3')]();var fs_extra=require(_0xba9a('0x4'));var auth=require(_0xba9a('0x5'));var interaction=require(_0xba9a('0x6'));var config=require(_0xba9a('0x7'));var controller=require(_0xba9a('0x8'));router[_0xba9a('0x9')]('/',auth['isAuthenticated'](),controller[_0xba9a('0xa')]);router[_0xba9a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba9a('0xb')]);router[_0xba9a('0xc')]('/',auth[_0xba9a('0xd')](),controller[_0xba9a('0xe')]);router[_0xba9a('0xf')](_0xba9a('0x10'),auth[_0xba9a('0xd')](),controller['update']);router[_0xba9a('0x11')]('/:id',auth[_0xba9a('0xd')](),controller[_0xba9a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 86b1681..31b3cee 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 _0xa578=['variable','BOOLEAN','sequelize','string','customVariable','picklist','STRING'];(function(_0x25a18e,_0x22efae){var _0x31bd81=function(_0x24ed2f){while(--_0x24ed2f){_0x25a18e['push'](_0x25a18e['shift']());}};_0x31bd81(++_0x22efae);}(_0xa578,0x14b));var _0x8a57=function(_0x3c8e38,_0x5901b3){_0x3c8e38=_0x3c8e38-0x0;var _0x488a57=_0xa578[_0x3c8e38];return _0x488a57;};'use strict';var Sequelize=require(_0x8a57('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x8a57('0x1'),'variable',_0x8a57('0x2'),'keyValue',_0x8a57('0x3')),'defaultValue':_0x8a57('0x1')},'content':{'type':Sequelize[_0x8a57('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8a57('0x1'),_0x8a57('0x5'),_0x8a57('0x2'))},'keyContent':{'type':Sequelize[_0x8a57('0x4')]},'idField':{'type':Sequelize[_0x8a57('0x4')]},'nameField':{'type':Sequelize[_0x8a57('0x4')]},'customField':{'type':Sequelize[_0x8a57('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8a57('0x4')]}}; \ No newline at end of file +var _0xf48a=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x1b09d0,_0x1c0a19){var _0x192d12=function(_0x286226){while(--_0x286226){_0x1b09d0['push'](_0x1b09d0['shift']());}};_0x192d12(++_0x1c0a19);}(_0xf48a,0x1e6));var _0xaf48=function(_0x40b898,_0x2fd575){_0x40b898=_0x40b898-0x0;var _0x2ff0bb=_0xf48a[_0x40b898];return _0x2ff0bb;};'use strict';var Sequelize=require('sequelize');module[_0xaf48('0x0')]={'type':{'type':Sequelize[_0xaf48('0x1')](_0xaf48('0x2'),_0xaf48('0x3'),_0xaf48('0x4'),_0xaf48('0x5'),'picklist'),'defaultValue':_0xaf48('0x2')},'content':{'type':Sequelize[_0xaf48('0x6')]},'key':{'type':Sequelize[_0xaf48('0x6')]},'keyType':{'type':Sequelize[_0xaf48('0x1')]('string',_0xaf48('0x3'),_0xaf48('0x4'))},'keyContent':{'type':Sequelize[_0xaf48('0x6')]},'idField':{'type':Sequelize[_0xaf48('0x6')]},'nameField':{'type':Sequelize[_0xaf48('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index f260128..ca1eba4 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 _0xcea2=['undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','FreshdeskField','includeAll','include','findAll','rows','catch','params','length','find','create','body','update','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x4f15df,_0x30a83f){var _0x2d034b=function(_0x7c57e3){while(--_0x7c57e3){_0x4f15df['push'](_0x4f15df['shift']());}};_0x2d034b(++_0x30a83f);}(_0xcea2,0x15a));var _0x2cea=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcea2[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x2cea('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cea('0x2'));var moment=require(_0x2cea('0x3'));var BPromise=require(_0x2cea('0x4'));var Mustache=require('mustache');var util=require(_0x2cea('0x5'));var path=require(_0x2cea('0x6'));var sox=require(_0x2cea('0x7'));var csv=require('to-csv');var ejs=require(_0x2cea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2cea('0x9'));var squel=require(_0x2cea('0xa'));var crypto=require(_0x2cea('0xb'));var jsforce=require(_0x2cea('0xc'));var deskjs=require(_0x2cea('0xd'));var toCsv=require(_0x2cea('0xe'));var querystring=require('querystring');var Papa=require(_0x2cea('0xf'));var Redis=require(_0x2cea('0x10'));var authService=require(_0x2cea('0x11'));var qs=require(_0x2cea('0x12'));var as=require(_0x2cea('0x13'));var hardwareService=require(_0x2cea('0x14'));var logger=require(_0x2cea('0x15'))(_0x2cea('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2cea('0x17'));var db=require(_0x2cea('0x18'))['db'];function respondWithStatusCode(_0x528c1d,_0x4bd265){_0x4bd265=_0x4bd265||0xcc;return function(_0x160eaf){if(_0x160eaf){return _0x528c1d['sendStatus'](_0x4bd265);}return _0x528c1d[_0x2cea('0x19')](_0x4bd265)[_0x2cea('0x1a')]();};}function respondWithResult(_0x4377b1,_0x5cf805){_0x5cf805=_0x5cf805||0xc8;return function(_0x4d7f8b){if(_0x4d7f8b){return _0x4377b1['status'](_0x5cf805)[_0x2cea('0x1b')](_0x4d7f8b);}};}function respondWithFilteredResult(_0x586ad5,_0x3c7130){return function(_0x338669){if(_0x338669){var _0x981e3f=typeof _0x3c7130[_0x2cea('0x1c')]===_0x2cea('0x1d')&&typeof _0x3c7130[_0x2cea('0x1e')]===_0x2cea('0x1d');var _0x1ead4c=_0x338669['count'];var _0x19927a=_0x981e3f?0x0:_0x3c7130[_0x2cea('0x1c')];var _0x20c46c=_0x981e3f?_0x338669[_0x2cea('0x1f')]:_0x3c7130[_0x2cea('0x1c')]+_0x3c7130[_0x2cea('0x1e')];var _0x5d75c4;if(_0x20c46c>=_0x1ead4c){_0x20c46c=_0x1ead4c;_0x5d75c4=0xc8;}else{_0x5d75c4=0xce;}_0x586ad5[_0x2cea('0x19')](_0x5d75c4);return _0x586ad5['set'](_0x2cea('0x20'),_0x19927a+'-'+_0x20c46c+'/'+_0x1ead4c)[_0x2cea('0x1b')](_0x338669);}return null;};}function patchUpdates(_0xa73bea){return function(_0x4fd3d5){try{jsonpatch[_0x2cea('0x21')](_0x4fd3d5,_0xa73bea,!![]);}catch(_0x22249e){return BPromise[_0x2cea('0x22')](_0x22249e);}return _0x4fd3d5[_0x2cea('0x23')]();};}function saveUpdates(_0x3246bc,_0x3f6f0e){return function(_0x10f13a){if(_0x10f13a){return _0x10f13a['update'](_0x3246bc)[_0x2cea('0x24')](function(_0x5e5b46){return _0x5e5b46;});}return null;};}function removeEntity(_0x7d88b9,_0x4926ff){return function(_0x3966d5){if(_0x3966d5){return _0x3966d5[_0x2cea('0x25')]()['then'](function(){_0x7d88b9[_0x2cea('0x19')](0xcc)[_0x2cea('0x1a')]();});}};}function handleEntityNotFound(_0x101314,_0xf0bfbe){return function(_0x3f3ee0){if(!_0x3f3ee0){_0x101314[_0x2cea('0x26')](0x194);}return _0x3f3ee0;};}function handleError(_0x5d032f,_0x4ec9b3){_0x4ec9b3=_0x4ec9b3||0x1f4;return function(_0x32b6a3){logger[_0x2cea('0x27')](_0x32b6a3[_0x2cea('0x28')]);if(_0x32b6a3[_0x2cea('0x29')]){delete _0x32b6a3[_0x2cea('0x29')];}_0x5d032f[_0x2cea('0x19')](_0x4ec9b3)[_0x2cea('0x2a')](_0x32b6a3);};}exports['index']=function(_0xff69ad,_0x128863){var _0x5f3fb4={},_0xfeb8bd={},_0xc398c5={'count':0x0,'rows':[]};var _0x271b2f=_[_0x2cea('0x2b')](db['FreshdeskField'][_0x2cea('0x2c')],function(_0x128934){return{'name':_0x128934['fieldName'],'type':_0x128934[_0x2cea('0x2d')][_0x2cea('0x2e')]};});_0xfeb8bd[_0x2cea('0x2f')]=_[_0x2cea('0x2b')](_0x271b2f,_0x2cea('0x29'));_0xfeb8bd[_0x2cea('0x30')]=_[_0x2cea('0x31')](_0xff69ad[_0x2cea('0x30')]);_0xfeb8bd[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],_0xfeb8bd['query']);_0x5f3fb4[_0x2cea('0x34')]=_[_0x2cea('0x33')](_0xfeb8bd[_0x2cea('0x2f')],qs[_0x2cea('0x35')](_0xff69ad['query']['fields']));_0x5f3fb4[_0x2cea('0x34')]=_0x5f3fb4[_0x2cea('0x34')]['length']?_0x5f3fb4[_0x2cea('0x34')]:_0xfeb8bd['model'];if(!_0xff69ad[_0x2cea('0x30')]['hasOwnProperty'](_0x2cea('0x36'))){_0x5f3fb4['limit']=qs[_0x2cea('0x1e')](_0xff69ad[_0x2cea('0x30')]['limit']);_0x5f3fb4[_0x2cea('0x1c')]=qs[_0x2cea('0x1c')](_0xff69ad['query'][_0x2cea('0x1c')]);}_0x5f3fb4[_0x2cea('0x37')]=qs[_0x2cea('0x38')](_0xff69ad[_0x2cea('0x30')][_0x2cea('0x38')]);_0x5f3fb4['where']=qs[_0x2cea('0x32')](_[_0x2cea('0x39')](_0xff69ad['query'],_0xfeb8bd['filters']),_0x271b2f);if(_0xff69ad[_0x2cea('0x30')]['filter']){_0x5f3fb4['where']=_['merge'](_0x5f3fb4['where'],{'$or':_[_0x2cea('0x2b')](_0x271b2f,function(_0xb5b358){if(_0xb5b358['type']!==_0x2cea('0x3a')){var _0x3e0683={};_0x3e0683[_0xb5b358[_0x2cea('0x29')]]={'$like':'%'+_0xff69ad['query'][_0x2cea('0x3b')]+'%'};return _0x3e0683;}})});}_0x5f3fb4=_[_0x2cea('0x3c')]({},_0x5f3fb4,_0xff69ad[_0x2cea('0x3d')]);var _0x37d175={'where':_0x5f3fb4[_0x2cea('0x3e')]};return db[_0x2cea('0x3f')][_0x2cea('0x1f')](_0x37d175)[_0x2cea('0x24')](function(_0x2cfa0e){_0xc398c5[_0x2cea('0x1f')]=_0x2cfa0e;if(_0xff69ad[_0x2cea('0x30')][_0x2cea('0x40')]){_0x5f3fb4[_0x2cea('0x41')]=[{'all':!![]}];}return db[_0x2cea('0x3f')][_0x2cea('0x42')](_0x5f3fb4);})[_0x2cea('0x24')](function(_0x36efa8){_0xc398c5[_0x2cea('0x43')]=_0x36efa8;return _0xc398c5;})['then'](respondWithFilteredResult(_0x128863,_0x5f3fb4))[_0x2cea('0x44')](handleError(_0x128863,null));};exports['show']=function(_0x29ab58,_0x1afbb9){var _0x22ce6b={'raw':!![],'where':{'id':_0x29ab58[_0x2cea('0x45')]['id']}},_0x5b5d71={};_0x5b5d71[_0x2cea('0x2f')]=_[_0x2cea('0x31')](db[_0x2cea('0x3f')][_0x2cea('0x2c')]);_0x5b5d71[_0x2cea('0x30')]=_['keys'](_0x29ab58['query']);_0x5b5d71[_0x2cea('0x32')]=_[_0x2cea('0x33')](_0x5b5d71['model'],_0x5b5d71[_0x2cea('0x30')]);_0x22ce6b['attributes']=_[_0x2cea('0x33')](_0x5b5d71['model'],qs[_0x2cea('0x35')](_0x29ab58[_0x2cea('0x30')][_0x2cea('0x35')]));_0x22ce6b[_0x2cea('0x34')]=_0x22ce6b[_0x2cea('0x34')][_0x2cea('0x46')]?_0x22ce6b[_0x2cea('0x34')]:_0x5b5d71[_0x2cea('0x2f')];if(_0x29ab58[_0x2cea('0x30')][_0x2cea('0x40')]){_0x22ce6b['include']=[{'all':!![]}];}_0x22ce6b=_[_0x2cea('0x3c')]({},_0x22ce6b,_0x29ab58[_0x2cea('0x3d')]);return db[_0x2cea('0x3f')][_0x2cea('0x47')](_0x22ce6b)['then'](handleEntityNotFound(_0x1afbb9,null))['then'](respondWithResult(_0x1afbb9,null))[_0x2cea('0x44')](handleError(_0x1afbb9,null));};exports[_0x2cea('0x48')]=function(_0xd922c6,_0x510e0f){return db[_0x2cea('0x3f')][_0x2cea('0x48')](_0xd922c6[_0x2cea('0x49')],{})[_0x2cea('0x24')](respondWithResult(_0x510e0f,0xc9))['catch'](handleError(_0x510e0f,null));};exports[_0x2cea('0x4a')]=function(_0x526e92,_0x4d1b77){if(_0x526e92[_0x2cea('0x49')]['id']){delete _0x526e92[_0x2cea('0x49')]['id'];}return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x526e92['params']['id']}})['then'](handleEntityNotFound(_0x4d1b77,null))[_0x2cea('0x24')](saveUpdates(_0x526e92[_0x2cea('0x49')],null))[_0x2cea('0x24')](respondWithResult(_0x4d1b77,null))[_0x2cea('0x44')](handleError(_0x4d1b77,null));};exports['destroy']=function(_0x4ec462,_0x5d7cb6){return db[_0x2cea('0x3f')][_0x2cea('0x47')]({'where':{'id':_0x4ec462[_0x2cea('0x45')]['id']}})[_0x2cea('0x24')](handleEntityNotFound(_0x5d7cb6,null))[_0x2cea('0x24')](removeEntity(_0x5d7cb6,null))[_0x2cea('0x44')](handleError(_0x5d7cb6,null));}; \ No newline at end of file +var _0xdace=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xdace,0xc5));var _0xedac=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdace[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0xedac('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedac('0x1'));var jsonpatch=require(_0xedac('0x2'));var rp=require(_0xedac('0x3'));var moment=require('moment');var BPromise=require(_0xedac('0x4'));var Mustache=require(_0xedac('0x5'));var util=require(_0xedac('0x6'));var path=require(_0xedac('0x7'));var sox=require('sox');var csv=require(_0xedac('0x8'));var ejs=require(_0xedac('0x9'));var fs=require('fs');var fs_extra=require(_0xedac('0xa'));var _=require('lodash');var squel=require(_0xedac('0xb'));var crypto=require(_0xedac('0xc'));var jsforce=require(_0xedac('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xedac('0x8'));var querystring=require(_0xedac('0xe'));var Papa=require(_0xedac('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xedac('0x10'));var as=require(_0xedac('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xedac('0x12'));var utils=require(_0xedac('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xedac('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21c6ae,_0x1b0503){_0x1b0503=_0x1b0503||0xcc;return function(_0x306af5){if(_0x306af5){return _0x21c6ae[_0xedac('0x15')](_0x1b0503);}return _0x21c6ae[_0xedac('0x16')](_0x1b0503)[_0xedac('0x17')]();};}function respondWithResult(_0x28444a,_0x11f0b0){_0x11f0b0=_0x11f0b0||0xc8;return function(_0x593030){if(_0x593030){return _0x28444a[_0xedac('0x16')](_0x11f0b0)[_0xedac('0x18')](_0x593030);}};}function respondWithFilteredResult(_0x2f0c7c,_0x2676c3){return function(_0x15068){if(_0x15068){var _0x590e9b=typeof _0x2676c3[_0xedac('0x19')]==='undefined'&&typeof _0x2676c3[_0xedac('0x1a')]===_0xedac('0x1b');var _0xdad128=_0x15068[_0xedac('0x1c')];var _0x4fb540=_0x590e9b?0x0:_0x2676c3['offset'];var _0x2d02d7=_0x590e9b?_0x15068[_0xedac('0x1c')]:_0x2676c3[_0xedac('0x19')]+_0x2676c3[_0xedac('0x1a')];var _0x5a5438;if(_0x2d02d7>=_0xdad128){_0x2d02d7=_0xdad128;_0x5a5438=0xc8;}else{_0x5a5438=0xce;}_0x2f0c7c['status'](_0x5a5438);return _0x2f0c7c[_0xedac('0x1d')](_0xedac('0x1e'),_0x4fb540+'-'+_0x2d02d7+'/'+_0xdad128)[_0xedac('0x18')](_0x15068);}return null;};}function patchUpdates(_0xcc1605){return function(_0x2f5eee){try{jsonpatch[_0xedac('0x1f')](_0x2f5eee,_0xcc1605,!![]);}catch(_0x160be7){return BPromise[_0xedac('0x20')](_0x160be7);}return _0x2f5eee['save']();};}function saveUpdates(_0x4593e8,_0x510005){return function(_0x29cd40){if(_0x29cd40){return _0x29cd40[_0xedac('0x21')](_0x4593e8)['then'](function(_0x46e09d){return _0x46e09d;});}return null;};}function removeEntity(_0x404b8d,_0x1c87bf){return function(_0x1e5e47){if(_0x1e5e47){return _0x1e5e47[_0xedac('0x22')]()[_0xedac('0x23')](function(){_0x404b8d['status'](0xcc)[_0xedac('0x17')]();});}};}function handleEntityNotFound(_0x87d343,_0x37563f){return function(_0x41ad8d){if(!_0x41ad8d){_0x87d343[_0xedac('0x15')](0x194);}return _0x41ad8d;};}function handleError(_0x453a3c,_0x40ba53){_0x40ba53=_0x40ba53||0x1f4;return function(_0x26c6f7){logger[_0xedac('0x24')](_0x26c6f7[_0xedac('0x25')]);if(_0x26c6f7['name']){delete _0x26c6f7[_0xedac('0x26')];}_0x453a3c[_0xedac('0x16')](_0x40ba53)[_0xedac('0x27')](_0x26c6f7);};}exports['index']=function(_0x313e06,_0x4f81f6){var _0x524514={},_0x3e28bf={},_0x457d81={'count':0x0,'rows':[]};var _0x44ac60=_[_0xedac('0x28')](db['FreshdeskField']['rawAttributes'],function(_0xe813e6){return{'name':_0xe813e6[_0xedac('0x29')],'type':_0xe813e6[_0xedac('0x2a')][_0xedac('0x2b')]};});_0x3e28bf[_0xedac('0x2c')]=_[_0xedac('0x28')](_0x44ac60,_0xedac('0x26'));_0x3e28bf['query']=_[_0xedac('0x2d')](_0x313e06[_0xedac('0x2e')]);_0x3e28bf[_0xedac('0x2f')]=_['intersection'](_0x3e28bf[_0xedac('0x2c')],_0x3e28bf[_0xedac('0x2e')]);_0x524514['attributes']=_[_0xedac('0x30')](_0x3e28bf[_0xedac('0x2c')],qs['fields'](_0x313e06[_0xedac('0x2e')][_0xedac('0x31')]));_0x524514[_0xedac('0x32')]=_0x524514[_0xedac('0x32')][_0xedac('0x33')]?_0x524514[_0xedac('0x32')]:_0x3e28bf[_0xedac('0x2c')];if(!_0x313e06[_0xedac('0x2e')][_0xedac('0x34')](_0xedac('0x35'))){_0x524514['limit']=qs[_0xedac('0x1a')](_0x313e06[_0xedac('0x2e')][_0xedac('0x1a')]);_0x524514[_0xedac('0x19')]=qs[_0xedac('0x19')](_0x313e06[_0xedac('0x2e')][_0xedac('0x19')]);}_0x524514[_0xedac('0x36')]=qs[_0xedac('0x37')](_0x313e06[_0xedac('0x2e')][_0xedac('0x37')]);_0x524514[_0xedac('0x38')]=qs[_0xedac('0x2f')](_[_0xedac('0x39')](_0x313e06[_0xedac('0x2e')],_0x3e28bf['filters']),_0x44ac60);if(_0x313e06[_0xedac('0x2e')][_0xedac('0x3a')]){_0x524514[_0xedac('0x38')]=_[_0xedac('0x3b')](_0x524514['where'],{'$or':_[_0xedac('0x28')](_0x44ac60,function(_0x1cee42){if(_0x1cee42[_0xedac('0x2a')]!=='VIRTUAL'){var _0x159145={};_0x159145[_0x1cee42[_0xedac('0x26')]]={'$like':'%'+_0x313e06[_0xedac('0x2e')]['filter']+'%'};return _0x159145;}})});}_0x524514=_[_0xedac('0x3b')]({},_0x524514,_0x313e06[_0xedac('0x3c')]);var _0x47f7c7={'where':_0x524514[_0xedac('0x38')]};return db[_0xedac('0x3d')]['count'](_0x47f7c7)[_0xedac('0x23')](function(_0x534ad3){_0x457d81[_0xedac('0x1c')]=_0x534ad3;if(_0x313e06[_0xedac('0x2e')][_0xedac('0x3e')]){_0x524514[_0xedac('0x3f')]=[{'all':!![]}];}return db[_0xedac('0x3d')][_0xedac('0x40')](_0x524514);})['then'](function(_0x2370aa){_0x457d81[_0xedac('0x41')]=_0x2370aa;return _0x457d81;})[_0xedac('0x23')](respondWithFilteredResult(_0x4f81f6,_0x524514))[_0xedac('0x42')](handleError(_0x4f81f6,null));};exports[_0xedac('0x43')]=function(_0xa3a919,_0x2e9eef){var _0x6a17a9={'raw':!![],'where':{'id':_0xa3a919[_0xedac('0x44')]['id']}},_0x2dcff4={};_0x2dcff4[_0xedac('0x2c')]=_[_0xedac('0x2d')](db[_0xedac('0x3d')][_0xedac('0x45')]);_0x2dcff4[_0xedac('0x2e')]=_[_0xedac('0x2d')](_0xa3a919['query']);_0x2dcff4[_0xedac('0x2f')]=_[_0xedac('0x30')](_0x2dcff4[_0xedac('0x2c')],_0x2dcff4['query']);_0x6a17a9['attributes']=_['intersection'](_0x2dcff4[_0xedac('0x2c')],qs[_0xedac('0x31')](_0xa3a919['query'][_0xedac('0x31')]));_0x6a17a9['attributes']=_0x6a17a9[_0xedac('0x32')]['length']?_0x6a17a9[_0xedac('0x32')]:_0x2dcff4[_0xedac('0x2c')];if(_0xa3a919[_0xedac('0x2e')][_0xedac('0x3e')]){_0x6a17a9[_0xedac('0x3f')]=[{'all':!![]}];}_0x6a17a9=_['merge']({},_0x6a17a9,_0xa3a919['options']);return db[_0xedac('0x3d')]['find'](_0x6a17a9)[_0xedac('0x23')](handleEntityNotFound(_0x2e9eef,null))[_0xedac('0x23')](respondWithResult(_0x2e9eef,null))[_0xedac('0x42')](handleError(_0x2e9eef,null));};exports['create']=function(_0x29a707,_0x45189f){return db[_0xedac('0x3d')]['create'](_0x29a707[_0xedac('0x46')],{})[_0xedac('0x23')](respondWithResult(_0x45189f,0xc9))[_0xedac('0x42')](handleError(_0x45189f,null));};exports['update']=function(_0x5e6079,_0x2cb3ca){if(_0x5e6079[_0xedac('0x46')]['id']){delete _0x5e6079['body']['id'];}return db['FreshdeskField'][_0xedac('0x47')]({'where':{'id':_0x5e6079[_0xedac('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb3ca,null))[_0xedac('0x23')](saveUpdates(_0x5e6079['body'],null))[_0xedac('0x23')](respondWithResult(_0x2cb3ca,null))[_0xedac('0x42')](handleError(_0x2cb3ca,null));};exports[_0xedac('0x22')]=function(_0x104842,_0x126bd3){return db[_0xedac('0x3d')]['find']({'where':{'id':_0x104842[_0xedac('0x44')]['id']}})[_0xedac('0x23')](handleEntityNotFound(_0x126bd3,null))['then'](removeEntity(_0x126bd3,null))[_0xedac('0x42')](handleError(_0x126bd3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 04bdf36..6e7f302 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 _0x5e53=['util','api','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash'];(function(_0x485468,_0x245533){var _0x2097f9=function(_0x409524){while(--_0x409524){_0x485468['push'](_0x485468['shift']());}};_0x2097f9(++_0x245533);}(_0x5e53,0xa7));var _0x35e5=function(_0x1a2c59,_0x3cdcd6){_0x1a2c59=_0x1a2c59-0x0;var _0x226817=_0x5e53[_0x1a2c59];return _0x226817;};'use strict';var _=require(_0x35e5('0x0'));var util=require(_0x35e5('0x1'));var logger=require('../../config/logger')(_0x35e5('0x2'));var moment=require('moment');var BPromise=require(_0x35e5('0x3'));var rp=require(_0x35e5('0x4'));var fs=require('fs');var path=require(_0x35e5('0x5'));var rimraf=require('rimraf');var config=require(_0x35e5('0x6'));var attributes=require(_0x35e5('0x7'));module[_0x35e5('0x8')]=function(_0x375b07,_0x5bc794){return _0x375b07[_0x35e5('0x9')]('FreshdeskField',attributes,{'tableName':_0x35e5('0xa'),'paranoid':![],'indexes':[{'name':_0x35e5('0xb'),'fields':[_0x35e5('0xc'),_0x35e5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcd45=['FieldId','lodash','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xcd45,0x140));var _0x5cd4=function(_0x425d0d,_0x3c0dab){_0x425d0d=_0x425d0d-0x0;var _0x2d1024=_0xcd45[_0x425d0d];return _0x2d1024;};'use strict';var _=require(_0x5cd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5cd4('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cd4('0x2'));var rimraf=require('rimraf');var config=require(_0x5cd4('0x3'));var attributes=require(_0x5cd4('0x4'));module[_0x5cd4('0x5')]=function(_0x23886d,_0x58410b){return _0x23886d[_0x5cd4('0x6')](_0x5cd4('0x7'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x5cd4('0x8'),'fields':[_0x5cd4('0x9'),_0x5cd4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 09481c7..ec7fada 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 _0xdcb8=['rpc','../../config/environment','client','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','request\x20sent','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x45567c,_0x23ec5c){var _0x463090=function(_0x204672){while(--_0x204672){_0x45567c['push'](_0x45567c['shift']());}};_0x463090(++_0x23ec5c);}(_0xdcb8,0xb7));var _0x8dcb=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcb8[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x8dcb('0x0'));var util=require('util');var moment=require(_0x8dcb('0x1'));var BPromise=require(_0x8dcb('0x2'));var rs=require(_0x8dcb('0x3'));var fs=require('fs');var Redis=require(_0x8dcb('0x4'));var db=require(_0x8dcb('0x5'))['db'];var utils=require(_0x8dcb('0x6'));var logger=require('../../config/logger')(_0x8dcb('0x7'));var config=require(_0x8dcb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8dcb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b78fe,_0x3036cc,_0x504557){return new BPromise(function(_0x48734e,_0xc6b775){return client['request'](_0x3b78fe,_0x504557)['then'](function(_0x2dc43a){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x3036cc,'request\x20sent');logger[_0x8dcb('0xa')](_0x8dcb('0xb'),_0x3036cc,'request\x20sent',JSON[_0x8dcb('0xc')](_0x2dc43a));if(_0x2dc43a[_0x8dcb('0xd')]){if(_0x2dc43a['error'][_0x8dcb('0xe')]===0x1f4){logger[_0x8dcb('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x3036cc,_0x2dc43a[_0x8dcb('0xd')]['message']);return _0xc6b775(_0x2dc43a[_0x8dcb('0xd')][_0x8dcb('0xf')]);}logger[_0x8dcb('0xd')](_0x8dcb('0x10'),_0x3036cc,_0x2dc43a['error'][_0x8dcb('0xf')]);return _0x48734e(_0x2dc43a[_0x8dcb('0xd')][_0x8dcb('0xf')]);}else{logger['info'](_0x8dcb('0x10'),_0x3036cc,_0x8dcb('0x11'));_0x48734e(_0x2dc43a[_0x8dcb('0x12')]['message']);}})['catch'](function(_0x3fe454){logger[_0x8dcb('0xd')](_0x8dcb('0x10'),_0x3036cc,_0x3fe454);_0xc6b775(_0x3fe454);});});} \ No newline at end of file +var _0x239b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x239b,0x1a2));var _0xb239=function(_0x2f6270,_0xe5428d){_0x2f6270=_0x2f6270-0x0;var _0x3e55fb=_0x239b[_0x2f6270];return _0x3e55fb;};'use strict';var _=require('lodash');var util=require(_0xb239('0x0'));var moment=require(_0xb239('0x1'));var BPromise=require(_0xb239('0x2'));var rs=require(_0xb239('0x3'));var fs=require('fs');var Redis=require(_0xb239('0x4'));var db=require(_0xb239('0x5'))['db'];var utils=require(_0xb239('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb239('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb239('0x8')][_0xb239('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6adb,_0x24c2dd,_0xd8ccae){return new BPromise(function(_0x512fad,_0x13a95d){return client[_0xb239('0xa')](_0x3b6adb,_0xd8ccae)[_0xb239('0xb')](function(_0x236ba5){logger[_0xb239('0xc')](_0xb239('0xd'),_0x24c2dd,_0xb239('0xe'));logger[_0xb239('0xf')](_0xb239('0x10'),_0x24c2dd,_0xb239('0xe'),JSON['stringify'](_0x236ba5));if(_0x236ba5[_0xb239('0x11')]){if(_0x236ba5[_0xb239('0x11')][_0xb239('0x12')]===0x1f4){logger[_0xb239('0x11')](_0xb239('0xd'),_0x24c2dd,_0x236ba5[_0xb239('0x11')][_0xb239('0x13')]);return _0x13a95d(_0x236ba5[_0xb239('0x11')][_0xb239('0x13')]);}logger[_0xb239('0x11')](_0xb239('0xd'),_0x24c2dd,_0x236ba5[_0xb239('0x11')][_0xb239('0x13')]);return _0x512fad(_0x236ba5['error'][_0xb239('0x13')]);}else{logger[_0xb239('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x24c2dd,_0xb239('0xe'));_0x512fad(_0x236ba5['result']['message']);}})[_0xb239('0x14')](function(_0x5180b2){logger[_0xb239('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x24c2dd,_0x5180b2);_0x13a95d(_0x5180b2);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ebec10e..ca2b2c1 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 _0xd8b0=['/:id','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put'];(function(_0x19fbb5,_0x2d3a59){var _0x18ca9c=function(_0x1c2f2f){while(--_0x1c2f2f){_0x19fbb5['push'](_0x19fbb5['shift']());}};_0x18ca9c(++_0x2d3a59);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x9')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')]('/',auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x15')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);module[_0x0d8b('0x17')]=router; \ No newline at end of file +var _0xa75b=['post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x4994c1,_0x270a86){var _0x287ee2=function(_0x3de8b8){while(--_0x3de8b8){_0x4994c1['push'](_0x4994c1['shift']());}};_0x287ee2(++_0x270a86);}(_0xa75b,0x170));var _0xba75=function(_0x50580d,_0x2f3b0f){_0x50580d=_0x50580d-0x0;var _0xf9eb79=_0xa75b[_0x50580d];return _0xf9eb79;};'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['show']);router[_0xba75('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x10')](_0xba75('0x12'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);router[_0xba75('0x14')](_0xba75('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xba75('0x15')]('/:id',auth[_0xba75('0xa')](),controller[_0xba75('0x16')]);module[_0xba75('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 833b4e0..701f7a9 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 _0x2ef3=['remoteUri','sequelize','exports','STRING','username'];(function(_0x78337a,_0x24a094){var _0x4baa4f=function(_0x52b885){while(--_0x52b885){_0x78337a['push'](_0x78337a['shift']());}};_0x4baa4f(++_0x24a094);}(_0x2ef3,0xba));var _0x32ef=function(_0x1c25d4,_0xac790b){_0x1c25d4=_0x1c25d4-0x0;var _0x260d90=_0x2ef3[_0x1c25d4];return _0x260d90;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'name':{'type':Sequelize[_0x32ef('0x2')]},'description':{'type':Sequelize[_0x32ef('0x2')]},'username':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x32ef('0x2')],'unique':_0x32ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x236c=['remoteUri','sequelize','STRING','username'];(function(_0xb766e5,_0x475cb3){var _0x16621e=function(_0x4d91f0){while(--_0x4d91f0){_0xb766e5['push'](_0xb766e5['shift']());}};_0x16621e(++_0x475cb3);}(_0x236c,0x155));var _0xc236=function(_0xb5a82,_0xfccfd2){_0xb5a82=_0xb5a82-0x0;var _0xc1d20e=_0x236c[_0xb5a82];return _0xc1d20e;};'use strict';var Sequelize=require(_0xc236('0x0'));module['exports']={'name':{'type':Sequelize[_0xc236('0x1')]},'description':{'type':Sequelize[_0xc236('0x1')]},'username':{'type':Sequelize[_0xc236('0x1')],'unique':_0xc236('0x2')},'apiKey':{'type':Sequelize[_0xc236('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xc236('0x3')},'serverUrl':{'type':Sequelize[_0xc236('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index bff44c4..64ac681 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 _0xcf5a=['email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','model','query','intersection','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','update','body','getConfigurations','findOne','hasOwnProperty','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','apiKey'];(function(_0x30a6d6,_0x603c35){var _0x361ea1=function(_0x4d35a7){while(--_0x4d35a7){_0x30a6d6['push'](_0x30a6d6['shift']());}};_0x361ea1(++_0x603c35);}(_0xcf5a,0xd4));var _0xacf5=function(_0xf00278,_0x582b63){_0xf00278=_0xf00278-0x0;var _0x529582=_0xcf5a[_0xf00278];return _0x529582;};'use strict';var emlformat=require(_0xacf5('0x0'));var rimraf=require(_0xacf5('0x1'));var zipdir=require(_0xacf5('0x2'));var jsonpatch=require(_0xacf5('0x3'));var rp=require(_0xacf5('0x4'));var moment=require(_0xacf5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xacf5('0x6'));var path=require(_0xacf5('0x7'));var sox=require('sox');var csv=require(_0xacf5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xacf5('0x9'));var _=require(_0xacf5('0xa'));var squel=require(_0xacf5('0xb'));var crypto=require(_0xacf5('0xc'));var jsforce=require(_0xacf5('0xd'));var deskjs=require(_0xacf5('0xe'));var toCsv=require(_0xacf5('0x8'));var querystring=require('querystring');var Papa=require(_0xacf5('0xf'));var Redis=require(_0xacf5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xacf5('0x11'));var as=require(_0xacf5('0x12'));var hardwareService=require(_0xacf5('0x13'));var logger=require(_0xacf5('0x14'))('api');var utils=require(_0xacf5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xacf5('0x16'));var db=require(_0xacf5('0x17'))['db'];var integrations=require(_0xacf5('0x18'));function respondWithStatusCode(_0x43de65,_0x67df37){_0x67df37=_0x67df37||0xcc;return function(_0x3c7a07){if(_0x3c7a07){return _0x43de65[_0xacf5('0x19')](_0x67df37);}return _0x43de65[_0xacf5('0x1a')](_0x67df37)[_0xacf5('0x1b')]();};}function respondWithResult(_0x5268fb,_0x523fc9){_0x523fc9=_0x523fc9||0xc8;return function(_0xcf4cb4){if(_0xcf4cb4){return _0x5268fb['status'](_0x523fc9)[_0xacf5('0x1c')](_0xcf4cb4);}};}function respondWithFilteredResult(_0x40ddeb,_0x369d4c){return function(_0x105ae9){if(_0x105ae9){var _0x5e1476=typeof _0x369d4c[_0xacf5('0x1d')]==='undefined'&&typeof _0x369d4c[_0xacf5('0x1e')]===_0xacf5('0x1f');var _0x4c0a0b=_0x105ae9[_0xacf5('0x20')];var _0x22c0ba=_0x5e1476?0x0:_0x369d4c[_0xacf5('0x1d')];var _0x167754=_0x5e1476?_0x105ae9[_0xacf5('0x20')]:_0x369d4c['offset']+_0x369d4c['limit'];var _0x22015e;if(_0x167754>=_0x4c0a0b){_0x167754=_0x4c0a0b;_0x22015e=0xc8;}else{_0x22015e=0xce;}_0x40ddeb[_0xacf5('0x1a')](_0x22015e);return _0x40ddeb[_0xacf5('0x21')]('Content-Range',_0x22c0ba+'-'+_0x167754+'/'+_0x4c0a0b)[_0xacf5('0x1c')](_0x105ae9);}return null;};}function patchUpdates(_0xae281c){return function(_0x57385d){try{jsonpatch[_0xacf5('0x22')](_0x57385d,_0xae281c,!![]);}catch(_0x5d3780){return BPromise[_0xacf5('0x23')](_0x5d3780);}return _0x57385d[_0xacf5('0x24')]();};}function saveUpdates(_0x3e050b,_0x27cf64){return function(_0x180720){if(_0x180720){return _0x180720['update'](_0x3e050b)[_0xacf5('0x25')](function(_0x5618e2){return _0x5618e2;});}return null;};}function removeEntity(_0x166b3d,_0x39271e){return function(_0x13afa5){if(_0x13afa5){return _0x13afa5[_0xacf5('0x26')]()[_0xacf5('0x25')](function(){_0x166b3d[_0xacf5('0x1a')](0xcc)[_0xacf5('0x1b')]();});}};}function handleEntityNotFound(_0x273bfd,_0x33b6e2){return function(_0x578ba0){if(!_0x578ba0){_0x273bfd[_0xacf5('0x19')](0x194);}return _0x578ba0;};}function handleError(_0x28db23,_0x21d64f){_0x21d64f=_0x21d64f||0x1f4;return function(_0x10b615){logger[_0xacf5('0x27')](_0x10b615[_0xacf5('0x28')]);if(_0x10b615[_0xacf5('0x29')]){delete _0x10b615['name'];}_0x28db23[_0xacf5('0x1a')](_0x21d64f)[_0xacf5('0x2a')](_0x10b615);};}exports[_0xacf5('0x2b')]=function(_0x31fa88,_0x54be89){var _0x400fd4={},_0x8add2b={},_0x14f709={'count':0x0,'rows':[]};var _0x5710a6=_[_0xacf5('0x2c')](db[_0xacf5('0x2d')][_0xacf5('0x2e')],function(_0x5caa34){return{'name':_0x5caa34['fieldName'],'type':_0x5caa34[_0xacf5('0x2f')][_0xacf5('0x30')]};});_0x8add2b[_0xacf5('0x31')]=_[_0xacf5('0x2c')](_0x5710a6,_0xacf5('0x29'));_0x8add2b[_0xacf5('0x32')]=_['keys'](_0x31fa88[_0xacf5('0x32')]);_0x8add2b['filters']=_[_0xacf5('0x33')](_0x8add2b[_0xacf5('0x31')],_0x8add2b[_0xacf5('0x32')]);_0x400fd4['attributes']=_[_0xacf5('0x33')](_0x8add2b['model'],qs['fields'](_0x31fa88[_0xacf5('0x32')]['fields']));_0x400fd4[_0xacf5('0x34')]=_0x400fd4[_0xacf5('0x34')]['length']?_0x400fd4[_0xacf5('0x34')]:_0x8add2b[_0xacf5('0x31')];if(!_0x31fa88['query']['hasOwnProperty'](_0xacf5('0x35'))){_0x400fd4['limit']=qs[_0xacf5('0x1e')](_0x31fa88[_0xacf5('0x32')][_0xacf5('0x1e')]);_0x400fd4[_0xacf5('0x1d')]=qs[_0xacf5('0x1d')](_0x31fa88[_0xacf5('0x32')][_0xacf5('0x1d')]);}_0x400fd4[_0xacf5('0x36')]=qs['sort'](_0x31fa88[_0xacf5('0x32')][_0xacf5('0x37')]);_0x400fd4[_0xacf5('0x38')]=qs[_0xacf5('0x39')](_[_0xacf5('0x3a')](_0x31fa88['query'],_0x8add2b['filters']),_0x5710a6);if(_0x31fa88[_0xacf5('0x32')]['filter']){_0x400fd4[_0xacf5('0x38')]=_[_0xacf5('0x3b')](_0x400fd4[_0xacf5('0x38')],{'$or':_['map'](_0x5710a6,function(_0xad8bd9){if(_0xad8bd9[_0xacf5('0x2f')]!==_0xacf5('0x3c')){var _0x478bd9={};_0x478bd9[_0xad8bd9['name']]={'$like':'%'+_0x31fa88[_0xacf5('0x32')][_0xacf5('0x3d')]+'%'};return _0x478bd9;}})});}_0x400fd4=_['merge']({},_0x400fd4,_0x31fa88[_0xacf5('0x3e')]);var _0x294540={'where':_0x400fd4[_0xacf5('0x38')]};return db['FreshsalesAccount'][_0xacf5('0x20')](_0x294540)[_0xacf5('0x25')](function(_0x328eea){_0x14f709[_0xacf5('0x20')]=_0x328eea;if(_0x31fa88[_0xacf5('0x32')][_0xacf5('0x3f')]){_0x400fd4['include']=[{'all':!![]}];}return db[_0xacf5('0x2d')][_0xacf5('0x40')](_0x400fd4);})[_0xacf5('0x25')](function(_0x49c819){_0x14f709[_0xacf5('0x41')]=_0x49c819;return _0x14f709;})[_0xacf5('0x25')](respondWithFilteredResult(_0x54be89,_0x400fd4))[_0xacf5('0x42')](handleError(_0x54be89,null));};exports[_0xacf5('0x43')]=function(_0x160794,_0x31384d){var _0x199525={'raw':![],'where':{'id':_0x160794[_0xacf5('0x44')]['id']}},_0x350da7={};_0x350da7[_0xacf5('0x31')]=_[_0xacf5('0x45')](db[_0xacf5('0x2d')][_0xacf5('0x2e')]);_0x350da7['query']=_['keys'](_0x160794[_0xacf5('0x32')]);_0x350da7['filters']=_[_0xacf5('0x33')](_0x350da7['model'],_0x350da7[_0xacf5('0x32')]);_0x199525[_0xacf5('0x34')]=_[_0xacf5('0x33')](_0x350da7[_0xacf5('0x31')],qs[_0xacf5('0x46')](_0x160794[_0xacf5('0x32')]['fields']));_0x199525['attributes']=_0x199525[_0xacf5('0x34')][_0xacf5('0x47')]?_0x199525[_0xacf5('0x34')]:_0x350da7[_0xacf5('0x31')];if(_0x160794[_0xacf5('0x32')][_0xacf5('0x3f')]){_0x199525[_0xacf5('0x48')]=[{'all':!![]}];}_0x199525=_[_0xacf5('0x3b')]({},_0x199525,_0x160794[_0xacf5('0x3e')]);return db[_0xacf5('0x2d')][_0xacf5('0x49')](_0x199525)[_0xacf5('0x25')](handleEntityNotFound(_0x31384d,null))[_0xacf5('0x25')](respondWithResult(_0x31384d,null))['catch'](handleError(_0x31384d,null));};exports[_0xacf5('0x4a')]=function(_0x36c5fa,_0x3b0eb7){return db['FreshsalesAccount'][_0xacf5('0x4a')](_0x36c5fa['body'],{})[_0xacf5('0x25')](respondWithResult(_0x3b0eb7,0xc9))['catch'](handleError(_0x3b0eb7,null));};exports[_0xacf5('0x4b')]=function(_0x2cd0e7,_0x78f713){if(_0x2cd0e7[_0xacf5('0x4c')]['id']){delete _0x2cd0e7['body']['id'];}return db[_0xacf5('0x2d')][_0xacf5('0x49')]({'where':{'id':_0x2cd0e7['params']['id']}})['then'](handleEntityNotFound(_0x78f713,null))[_0xacf5('0x25')](saveUpdates(_0x2cd0e7[_0xacf5('0x4c')],null))[_0xacf5('0x25')](respondWithResult(_0x78f713,null))[_0xacf5('0x42')](handleError(_0x78f713,null));};exports[_0xacf5('0x26')]=function(_0x995974,_0x490fdb){return db[_0xacf5('0x2d')][_0xacf5('0x49')]({'where':{'id':_0x995974['params']['id']}})['then'](handleEntityNotFound(_0x490fdb,null))['then'](removeEntity(_0x490fdb,null))[_0xacf5('0x42')](handleError(_0x490fdb,null));};exports[_0xacf5('0x4d')]=function(_0x248a73,_0x20959f,_0x45b3eb){var _0x509bbf={};var _0x2346e9={};var _0x11314c;var _0x4f4a53;return db[_0xacf5('0x2d')][_0xacf5('0x4e')]({'where':{'id':_0x248a73[_0xacf5('0x44')]['id']}})['then'](handleEntityNotFound(_0x20959f,null))['then'](function(_0x2a5457){if(_0x2a5457){_0x11314c=_0x2a5457;_0x2346e9['model']=_[_0xacf5('0x45')](db['FreshsalesConfiguration']['rawAttributes']);_0x2346e9[_0xacf5('0x32')]=_[_0xacf5('0x45')](_0x248a73[_0xacf5('0x32')]);_0x2346e9[_0xacf5('0x39')]=_[_0xacf5('0x33')](_0x2346e9['model'],_0x2346e9[_0xacf5('0x32')]);_0x509bbf[_0xacf5('0x34')]=_[_0xacf5('0x33')](_0x2346e9['model'],qs[_0xacf5('0x46')](_0x248a73['query']['fields']));_0x509bbf[_0xacf5('0x34')]=_0x509bbf[_0xacf5('0x34')][_0xacf5('0x47')]?_0x509bbf[_0xacf5('0x34')]:_0x2346e9[_0xacf5('0x31')];_0x509bbf[_0xacf5('0x36')]=qs[_0xacf5('0x37')](_0x248a73[_0xacf5('0x32')][_0xacf5('0x37')]);_0x509bbf[_0xacf5('0x38')]=qs[_0xacf5('0x39')](_['pick'](_0x248a73['query'],_0x2346e9['filters']));if(_0x248a73['query']['filter']){_0x509bbf[_0xacf5('0x38')]=_[_0xacf5('0x3b')](_0x509bbf[_0xacf5('0x38')],{'$or':_[_0xacf5('0x2c')](_0x509bbf[_0xacf5('0x34')],function(_0x50381e){var _0x486c21={};_0x486c21[_0x50381e]={'$like':'%'+_0x248a73['query'][_0xacf5('0x3d')]+'%'};return _0x486c21;})});}_0x509bbf=_[_0xacf5('0x3b')]({},_0x509bbf,_0x248a73[_0xacf5('0x3e')]);return _0x11314c[_0xacf5('0x4d')](_0x509bbf);}})[_0xacf5('0x25')](function(_0x48e39b){if(_0x48e39b){_0x4f4a53=_0x48e39b[_0xacf5('0x47')];if(!_0x248a73[_0xacf5('0x32')][_0xacf5('0x4f')](_0xacf5('0x35'))){_0x509bbf[_0xacf5('0x1e')]=qs[_0xacf5('0x1e')](_0x248a73['query'][_0xacf5('0x1e')]);_0x509bbf[_0xacf5('0x1d')]=qs[_0xacf5('0x1d')](_0x248a73[_0xacf5('0x32')][_0xacf5('0x1d')]);}return _0x11314c[_0xacf5('0x4d')](_0x509bbf);}})[_0xacf5('0x25')](function(_0x207f40){if(_0x207f40){return _0x207f40?{'count':_0x4f4a53,'rows':_0x207f40}:null;}})[_0xacf5('0x25')](respondWithResult(_0x20959f,null))['catch'](handleError(_0x20959f,null));};exports['addConfiguration']=function(_0x444d34,_0x13be51,_0x258deb){if(_0x444d34[_0xacf5('0x4c')]['id']){delete _0x444d34[_0xacf5('0x4c')]['id'];}return db[_0xacf5('0x2d')][_0xacf5('0x4e')]({'where':{'id':_0x444d34[_0xacf5('0x44')]['id']}})['then'](handleEntityNotFound(_0x13be51,null))[_0xacf5('0x25')](function(_0x3e3714){if(_0x3e3714){_0x444d34['body']['AccountId']=_0x3e3714['id'];_0x444d34[_0xacf5('0x4c')][_0xacf5('0x50')]=integrations[_0xacf5('0x51')](_0x444d34['body'][_0xacf5('0x52')],_0x444d34[_0xacf5('0x4c')][_0xacf5('0x2f')]);_0x444d34[_0xacf5('0x4c')][_0xacf5('0x53')]=integrations['getDescriptions'](_0x444d34[_0xacf5('0x4c')][_0xacf5('0x52')],_0x444d34[_0xacf5('0x4c')][_0xacf5('0x2f')]);return db[_0xacf5('0x54')][_0xacf5('0x4a')](_0x444d34[_0xacf5('0x4c')],{'include':[{'model':db[_0xacf5('0x55')],'as':_0xacf5('0x50')},{'model':db[_0xacf5('0x55')],'as':_0xacf5('0x53')}]});}return null;})['then'](respondWithResult(_0x13be51,null))[_0xacf5('0x42')](handleError(_0x13be51,null));};exports[_0xacf5('0x56')]=function(_0x587170,_0x5db1a2,_0x47dc2d){var _0x4447ea='';var _0x36f689='';return db['FreshsalesAccount'][_0xacf5('0x4e')]({'where':{'id':_0x587170['params']['id']},'attributes':['id',_0xacf5('0x57'),_0xacf5('0x58'),'apiKey']})['then'](handleEntityNotFound(_0x5db1a2,null))['then'](function(_0xf1c6ab){if(_0xf1c6ab){_0x36f689=_0xf1c6ab['username'];_0x4447ea=_0xf1c6ab[_0xacf5('0x58')];var _0x5c756a=_0xf1c6ab['remoteUri'][_0xacf5('0x59')](-0x1);if(_0x5c756a==='/'){_0x4447ea=_0x4447ea[_0xacf5('0x5a')](0x0,_0x4447ea[_0xacf5('0x5b')](_0x5c756a));}return rp({'method':_0xacf5('0x5c'),'uri':util[_0xacf5('0x5d')]('%s%s',_0x4447ea,_0xacf5('0x5e')),'headers':{'Authorization':_0xacf5('0x5f')+_0xf1c6ab[_0xacf5('0x60')]},'json':!![]});}})[_0xacf5('0x25')](function(_0x19ecc7){if(_0x19ecc7){var _0xd07c8a=_0x19ecc7['users'];var _0x2349b8=![];var _0x88693b=null;for(_0x88693b=0x0;_0x88693b<_0xd07c8a['length'];_0x88693b++){if(_0xd07c8a[_0x88693b][_0xacf5('0x61')]===_0x36f689){_0x2349b8=!![];}}if(_0x2349b8){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xacf5('0x62')});}}})[_0xacf5('0x25')](respondWithResult(_0x5db1a2,null))[_0xacf5('0x42')](function(_0x15a70a){var _0x3a11d3=_0x587170[_0xacf5('0x32')][_0xacf5('0x63')]?0x1f4:_0x15a70a[_0xacf5('0x64')]||0x1f4;logger[_0xacf5('0x27')](_0xacf5('0x65'),_0xacf5('0x56'),_0x3a11d3,JSON['stringify'](_0x15a70a));delete _0x15a70a['name'];if(_0x3a11d3===0x191){_0x3a11d3=0x190;}_0x5db1a2[_0xacf5('0x1a')](_0x3a11d3)[_0xacf5('0x2a')](_0x587170[_0xacf5('0x32')][_0xacf5('0x63')]?{'message':_0xacf5('0x66'),'statusCode':_0x15a70a[_0xacf5('0x64')]}:_0x15a70a);});}; \ No newline at end of file +var _0x762c=['Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','then','error','stack','name','index','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','catch','rawAttributes','length','create','update','body','find','params','destroy','findOne','FreshsalesConfiguration','filter','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email'];(function(_0x2f4081,_0x4010e7){var _0x14ef33=function(_0x5f57b7){while(--_0x5f57b7){_0x2f4081['push'](_0x2f4081['shift']());}};_0x14ef33(++_0x4010e7);}(_0x762c,0x19b));var _0xc762=function(_0x2296ee,_0xbe696c){_0x2296ee=_0x2296ee-0x0;var _0x52ac35=_0x762c[_0x2296ee];return _0x52ac35;};'use strict';var emlformat=require(_0xc762('0x0'));var rimraf=require(_0xc762('0x1'));var zipdir=require(_0xc762('0x2'));var jsonpatch=require(_0xc762('0x3'));var rp=require(_0xc762('0x4'));var moment=require(_0xc762('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc762('0x6'));var util=require(_0xc762('0x7'));var path=require(_0xc762('0x8'));var sox=require('sox');var csv=require(_0xc762('0x9'));var ejs=require(_0xc762('0xa'));var fs=require('fs');var fs_extra=require(_0xc762('0xb'));var _=require(_0xc762('0xc'));var squel=require('squel');var crypto=require(_0xc762('0xd'));var jsforce=require(_0xc762('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc762('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc762('0xf'));var authService=require(_0xc762('0x10'));var qs=require(_0xc762('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc762('0x12'));var logger=require(_0xc762('0x13'))('api');var utils=require(_0xc762('0x14'));var config=require(_0xc762('0x15'));var licenseUtil=require(_0xc762('0x16'));var db=require(_0xc762('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c06f8,_0x31f70b){_0x31f70b=_0x31f70b||0xcc;return function(_0x1fdcc5){if(_0x1fdcc5){return _0x1c06f8['sendStatus'](_0x31f70b);}return _0x1c06f8['status'](_0x31f70b)[_0xc762('0x18')]();};}function respondWithResult(_0x11dd0d,_0x1da3f2){_0x1da3f2=_0x1da3f2||0xc8;return function(_0x382704){if(_0x382704){return _0x11dd0d[_0xc762('0x19')](_0x1da3f2)[_0xc762('0x1a')](_0x382704);}};}function respondWithFilteredResult(_0x1595ec,_0x33d99f){return function(_0x42b006){if(_0x42b006){var _0x40977d=typeof _0x33d99f[_0xc762('0x1b')]===_0xc762('0x1c')&&typeof _0x33d99f['limit']===_0xc762('0x1c');var _0x446eab=_0x42b006[_0xc762('0x1d')];var _0x402308=_0x40977d?0x0:_0x33d99f[_0xc762('0x1b')];var _0x5ddf43=_0x40977d?_0x42b006['count']:_0x33d99f['offset']+_0x33d99f[_0xc762('0x1e')];var _0x4d1d28;if(_0x5ddf43>=_0x446eab){_0x5ddf43=_0x446eab;_0x4d1d28=0xc8;}else{_0x4d1d28=0xce;}_0x1595ec[_0xc762('0x19')](_0x4d1d28);return _0x1595ec['set']('Content-Range',_0x402308+'-'+_0x5ddf43+'/'+_0x446eab)[_0xc762('0x1a')](_0x42b006);}return null;};}function patchUpdates(_0x19d578){return function(_0x16e1f2){try{jsonpatch[_0xc762('0x1f')](_0x16e1f2,_0x19d578,!![]);}catch(_0x12fc04){return BPromise['reject'](_0x12fc04);}return _0x16e1f2['save']();};}function saveUpdates(_0x487405,_0x1a5f75){return function(_0x7526c){if(_0x7526c){return _0x7526c['update'](_0x487405)[_0xc762('0x20')](function(_0x1ef0a7){return _0x1ef0a7;});}return null;};}function removeEntity(_0xb70f27,_0x436ae0){return function(_0x1c6a1a){if(_0x1c6a1a){return _0x1c6a1a['destroy']()[_0xc762('0x20')](function(){_0xb70f27[_0xc762('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c2231,_0x5070b8){return function(_0x4c8cba){if(!_0x4c8cba){_0x5c2231['sendStatus'](0x194);}return _0x4c8cba;};}function handleError(_0x4ce695,_0x8e13c1){_0x8e13c1=_0x8e13c1||0x1f4;return function(_0x5a5210){logger[_0xc762('0x21')](_0x5a5210[_0xc762('0x22')]);if(_0x5a5210['name']){delete _0x5a5210[_0xc762('0x23')];}_0x4ce695['status'](_0x8e13c1)['send'](_0x5a5210);};}exports[_0xc762('0x24')]=function(_0x1b9c5f,_0x5c0fd9){var _0x7cbaca={},_0x54d724={},_0x38552a={'count':0x0,'rows':[]};var _0x69c00e=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x4dda4a){return{'name':_0x4dda4a[_0xc762('0x25')],'type':_0x4dda4a['type'][_0xc762('0x26')]};});_0x54d724[_0xc762('0x27')]=_[_0xc762('0x28')](_0x69c00e,'name');_0x54d724['query']=_[_0xc762('0x29')](_0x1b9c5f[_0xc762('0x2a')]);_0x54d724[_0xc762('0x2b')]=_[_0xc762('0x2c')](_0x54d724['model'],_0x54d724[_0xc762('0x2a')]);_0x7cbaca[_0xc762('0x2d')]=_[_0xc762('0x2c')](_0x54d724[_0xc762('0x27')],qs[_0xc762('0x2e')](_0x1b9c5f[_0xc762('0x2a')]['fields']));_0x7cbaca[_0xc762('0x2d')]=_0x7cbaca['attributes']['length']?_0x7cbaca['attributes']:_0x54d724[_0xc762('0x27')];if(!_0x1b9c5f[_0xc762('0x2a')][_0xc762('0x2f')](_0xc762('0x30'))){_0x7cbaca['limit']=qs[_0xc762('0x1e')](_0x1b9c5f[_0xc762('0x2a')][_0xc762('0x1e')]);_0x7cbaca[_0xc762('0x1b')]=qs[_0xc762('0x1b')](_0x1b9c5f['query'][_0xc762('0x1b')]);}_0x7cbaca[_0xc762('0x31')]=qs[_0xc762('0x32')](_0x1b9c5f[_0xc762('0x2a')][_0xc762('0x32')]);_0x7cbaca[_0xc762('0x33')]=qs[_0xc762('0x2b')](_[_0xc762('0x34')](_0x1b9c5f['query'],_0x54d724[_0xc762('0x2b')]),_0x69c00e);if(_0x1b9c5f[_0xc762('0x2a')]['filter']){_0x7cbaca[_0xc762('0x33')]=_[_0xc762('0x35')](_0x7cbaca['where'],{'$or':_[_0xc762('0x28')](_0x69c00e,function(_0x1ce721){if(_0x1ce721[_0xc762('0x36')]!==_0xc762('0x37')){var _0x18f12d={};_0x18f12d[_0x1ce721[_0xc762('0x23')]]={'$like':'%'+_0x1b9c5f[_0xc762('0x2a')]['filter']+'%'};return _0x18f12d;}})});}_0x7cbaca=_[_0xc762('0x35')]({},_0x7cbaca,_0x1b9c5f[_0xc762('0x38')]);var _0x185daf={'where':_0x7cbaca[_0xc762('0x33')]};return db[_0xc762('0x39')]['count'](_0x185daf)[_0xc762('0x20')](function(_0x22a997){_0x38552a[_0xc762('0x1d')]=_0x22a997;if(_0x1b9c5f[_0xc762('0x2a')][_0xc762('0x3a')]){_0x7cbaca[_0xc762('0x3b')]=[{'all':!![]}];}return db[_0xc762('0x39')][_0xc762('0x3c')](_0x7cbaca);})[_0xc762('0x20')](function(_0x3408d4){_0x38552a['rows']=_0x3408d4;return _0x38552a;})[_0xc762('0x20')](respondWithFilteredResult(_0x5c0fd9,_0x7cbaca))[_0xc762('0x3d')](handleError(_0x5c0fd9,null));};exports['show']=function(_0x381ad6,_0x3523a4){var _0x3ae74f={'raw':![],'where':{'id':_0x381ad6['params']['id']}},_0x4b4dc9={};_0x4b4dc9[_0xc762('0x27')]=_['keys'](db[_0xc762('0x39')][_0xc762('0x3e')]);_0x4b4dc9[_0xc762('0x2a')]=_[_0xc762('0x29')](_0x381ad6[_0xc762('0x2a')]);_0x4b4dc9[_0xc762('0x2b')]=_[_0xc762('0x2c')](_0x4b4dc9[_0xc762('0x27')],_0x4b4dc9[_0xc762('0x2a')]);_0x3ae74f['attributes']=_['intersection'](_0x4b4dc9[_0xc762('0x27')],qs['fields'](_0x381ad6[_0xc762('0x2a')][_0xc762('0x2e')]));_0x3ae74f[_0xc762('0x2d')]=_0x3ae74f[_0xc762('0x2d')][_0xc762('0x3f')]?_0x3ae74f[_0xc762('0x2d')]:_0x4b4dc9[_0xc762('0x27')];if(_0x381ad6['query'][_0xc762('0x3a')]){_0x3ae74f[_0xc762('0x3b')]=[{'all':!![]}];}_0x3ae74f=_[_0xc762('0x35')]({},_0x3ae74f,_0x381ad6[_0xc762('0x38')]);return db[_0xc762('0x39')]['find'](_0x3ae74f)[_0xc762('0x20')](handleEntityNotFound(_0x3523a4,null))[_0xc762('0x20')](respondWithResult(_0x3523a4,null))[_0xc762('0x3d')](handleError(_0x3523a4,null));};exports[_0xc762('0x40')]=function(_0x2a08f4,_0x3b9214){return db[_0xc762('0x39')]['create'](_0x2a08f4['body'],{})[_0xc762('0x20')](respondWithResult(_0x3b9214,0xc9))[_0xc762('0x3d')](handleError(_0x3b9214,null));};exports[_0xc762('0x41')]=function(_0x275f8d,_0x4a5254){if(_0x275f8d['body']['id']){delete _0x275f8d[_0xc762('0x42')]['id'];}return db[_0xc762('0x39')][_0xc762('0x43')]({'where':{'id':_0x275f8d[_0xc762('0x44')]['id']}})[_0xc762('0x20')](handleEntityNotFound(_0x4a5254,null))[_0xc762('0x20')](saveUpdates(_0x275f8d['body'],null))[_0xc762('0x20')](respondWithResult(_0x4a5254,null))[_0xc762('0x3d')](handleError(_0x4a5254,null));};exports[_0xc762('0x45')]=function(_0x2d46ef,_0x53aa51){return db['FreshsalesAccount'][_0xc762('0x43')]({'where':{'id':_0x2d46ef[_0xc762('0x44')]['id']}})['then'](handleEntityNotFound(_0x53aa51,null))['then'](removeEntity(_0x53aa51,null))[_0xc762('0x3d')](handleError(_0x53aa51,null));};exports['getConfigurations']=function(_0x2b6f36,_0x80c817,_0x2cd811){var _0x5c1e85={};var _0x2bd1cc={};var _0x16a0a7;var _0x459731;return db[_0xc762('0x39')][_0xc762('0x46')]({'where':{'id':_0x2b6f36[_0xc762('0x44')]['id']}})[_0xc762('0x20')](handleEntityNotFound(_0x80c817,null))['then'](function(_0x3d99c4){if(_0x3d99c4){_0x16a0a7=_0x3d99c4;_0x2bd1cc[_0xc762('0x27')]=_[_0xc762('0x29')](db[_0xc762('0x47')][_0xc762('0x3e')]);_0x2bd1cc[_0xc762('0x2a')]=_[_0xc762('0x29')](_0x2b6f36[_0xc762('0x2a')]);_0x2bd1cc['filters']=_[_0xc762('0x2c')](_0x2bd1cc['model'],_0x2bd1cc['query']);_0x5c1e85[_0xc762('0x2d')]=_[_0xc762('0x2c')](_0x2bd1cc[_0xc762('0x27')],qs[_0xc762('0x2e')](_0x2b6f36['query']['fields']));_0x5c1e85[_0xc762('0x2d')]=_0x5c1e85['attributes'][_0xc762('0x3f')]?_0x5c1e85[_0xc762('0x2d')]:_0x2bd1cc[_0xc762('0x27')];_0x5c1e85[_0xc762('0x31')]=qs[_0xc762('0x32')](_0x2b6f36[_0xc762('0x2a')]['sort']);_0x5c1e85['where']=qs[_0xc762('0x2b')](_[_0xc762('0x34')](_0x2b6f36[_0xc762('0x2a')],_0x2bd1cc[_0xc762('0x2b')]));if(_0x2b6f36[_0xc762('0x2a')][_0xc762('0x48')]){_0x5c1e85[_0xc762('0x33')]=_[_0xc762('0x35')](_0x5c1e85['where'],{'$or':_[_0xc762('0x28')](_0x5c1e85['attributes'],function(_0xacc43){var _0x3cf40a={};_0x3cf40a[_0xacc43]={'$like':'%'+_0x2b6f36['query'][_0xc762('0x48')]+'%'};return _0x3cf40a;})});}_0x5c1e85=_[_0xc762('0x35')]({},_0x5c1e85,_0x2b6f36[_0xc762('0x38')]);return _0x16a0a7[_0xc762('0x49')](_0x5c1e85);}})[_0xc762('0x20')](function(_0x5ac225){if(_0x5ac225){_0x459731=_0x5ac225[_0xc762('0x3f')];if(!_0x2b6f36['query'][_0xc762('0x2f')](_0xc762('0x30'))){_0x5c1e85[_0xc762('0x1e')]=qs['limit'](_0x2b6f36['query'][_0xc762('0x1e')]);_0x5c1e85[_0xc762('0x1b')]=qs['offset'](_0x2b6f36[_0xc762('0x2a')][_0xc762('0x1b')]);}return _0x16a0a7[_0xc762('0x49')](_0x5c1e85);}})['then'](function(_0x20a9ce){if(_0x20a9ce){return _0x20a9ce?{'count':_0x459731,'rows':_0x20a9ce}:null;}})['then'](respondWithResult(_0x80c817,null))[_0xc762('0x3d')](handleError(_0x80c817,null));};exports[_0xc762('0x4a')]=function(_0x3e3843,_0xe1e230,_0x19a555){if(_0x3e3843[_0xc762('0x42')]['id']){delete _0x3e3843['body']['id'];}return db['FreshsalesAccount'][_0xc762('0x46')]({'where':{'id':_0x3e3843['params']['id']}})['then'](handleEntityNotFound(_0xe1e230,null))[_0xc762('0x20')](function(_0x3eebe7){if(_0x3eebe7){_0x3e3843[_0xc762('0x42')][_0xc762('0x4b')]=_0x3eebe7['id'];_0x3e3843['body'][_0xc762('0x4c')]=integrations['getSubjects'](_0x3e3843['body'][_0xc762('0x4d')],_0x3e3843[_0xc762('0x42')][_0xc762('0x36')]);_0x3e3843[_0xc762('0x42')]['Descriptions']=integrations[_0xc762('0x4e')](_0x3e3843['body'][_0xc762('0x4d')],_0x3e3843['body']['type']);return db[_0xc762('0x47')][_0xc762('0x40')](_0x3e3843[_0xc762('0x42')],{'include':[{'model':db[_0xc762('0x4f')],'as':'Subjects'},{'model':db[_0xc762('0x4f')],'as':_0xc762('0x50')}]});}return null;})[_0xc762('0x20')](respondWithResult(_0xe1e230,null))[_0xc762('0x3d')](handleError(_0xe1e230,null));};exports[_0xc762('0x51')]=function(_0x2780e9,_0x50126a,_0x156a37){var _0xc3c74b='';var _0x44a5ae='';return db[_0xc762('0x39')]['findOne']({'where':{'id':_0x2780e9[_0xc762('0x44')]['id']},'attributes':['id',_0xc762('0x52'),_0xc762('0x53'),_0xc762('0x54')]})[_0xc762('0x20')](handleEntityNotFound(_0x50126a,null))['then'](function(_0x196c08){if(_0x196c08){_0x44a5ae=_0x196c08['username'];_0xc3c74b=_0x196c08['remoteUri'];var _0x37f211=_0x196c08[_0xc762('0x53')][_0xc762('0x55')](-0x1);if(_0x37f211==='/'){_0xc3c74b=_0xc3c74b[_0xc762('0x56')](0x0,_0xc3c74b[_0xc762('0x57')](_0x37f211));}return rp({'method':_0xc762('0x58'),'uri':util['format'](_0xc762('0x59'),_0xc3c74b,_0xc762('0x5a')),'headers':{'Authorization':_0xc762('0x5b')+_0x196c08['apiKey']},'json':!![]});}})[_0xc762('0x20')](function(_0x415ba5){if(_0x415ba5){var _0x3c938c=_0x415ba5[_0xc762('0x5c')];var _0x5db0d0=![];var _0x3ef8d9=null;for(_0x3ef8d9=0x0;_0x3ef8d9<_0x3c938c[_0xc762('0x3f')];_0x3ef8d9++){if(_0x3c938c[_0x3ef8d9][_0xc762('0x5d')]===_0x44a5ae){_0x5db0d0=!![];}}if(_0x5db0d0){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xc762('0x5e')});}}})[_0xc762('0x20')](respondWithResult(_0x50126a,null))['catch'](function(_0x1f3580){var _0x20debe=_0x2780e9[_0xc762('0x2a')]['test']?0x1f4:_0x1f3580[_0xc762('0x5f')]||0x1f4;logger[_0xc762('0x21')](_0xc762('0x60'),'getFields',_0x20debe,JSON[_0xc762('0x61')](_0x1f3580));delete _0x1f3580[_0xc762('0x23')];if(_0x20debe===0x191){_0x20debe=0x190;}_0x50126a[_0xc762('0x19')](_0x20debe)[_0xc762('0x62')](_0x2780e9[_0xc762('0x2a')][_0xc762('0x63')]?{'message':_0xc762('0x64'),'statusCode':_0x1f3580[_0xc762('0x5f')]}:_0x1f3580);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 9dda7fb..5db3d12 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 _0xadb5=['../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xadb5,0xad));var _0x5adb=function(_0xc3a546,_0x1d58dd){_0xc3a546=_0xc3a546-0x0;var _0x8f3d67=_0xadb5[_0xc3a546];return _0x8f3d67;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5adb('0x7'));module[_0x5adb('0x8')]=function(_0x3e2555,_0x3213e8){return _0x3e2555[_0x5adb('0x9')](_0x5adb('0xa'),attributes,{'tableName':_0x5adb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa456=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x4ecadb,_0x5f4910){var _0xfff923=function(_0x5c2883){while(--_0x5c2883){_0x4ecadb['push'](_0x4ecadb['shift']());}};_0xfff923(++_0x5f4910);}(_0xa456,0x142));var _0x6a45=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0xa456[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var logger=require(_0x6a45('0x2'))(_0x6a45('0x3'));var moment=require('moment');var BPromise=require(_0x6a45('0x4'));var rp=require(_0x6a45('0x5'));var fs=require('fs');var path=require(_0x6a45('0x6'));var rimraf=require('rimraf');var config=require(_0x6a45('0x7'));var attributes=require(_0x6a45('0x8'));var integrations=require(_0x6a45('0x9'));module[_0x6a45('0xa')]=function(_0x4dfbfa,_0x25cf8d){return _0x4dfbfa[_0x6a45('0xb')](_0x6a45('0xc'),attributes,{'tableName':_0x6a45('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index dd09888..b15ff80 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 _0x5496=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','find','ShowFreshsalesAccount','lodash'];(function(_0x10746d,_0x706dc9){var _0x1e8902=function(_0x33f964){while(--_0x33f964){_0x10746d['push'](_0x10746d['shift']());}};_0x1e8902(++_0x706dc9);}(_0x5496,0x175));var _0x6549=function(_0x4ec40d,_0x530fa1){_0x4ec40d=_0x4ec40d-0x0;var _0x5b96e5=_0x5496[_0x4ec40d];return _0x5b96e5;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});}exports[_0x6549('0x15')]=function(_0x53b12b){var _0x5d61a0=this;return new Promise(function(_0x26a212,_0x48f037){return db['FreshsalesAccount'][_0x6549('0x16')]({'raw':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x53b12b[_0x6549('0x17')]?_0x53b12b['options'][_0x6549('0x19')]||null:null,'attributes':_0x53b12b['options']?_0x53b12b[_0x6549('0x17')][_0x6549('0x1a')]||null:null,'limit':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1b')]||null:null,'include':_0x53b12b[_0x6549('0x17')]?_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x53b12b[_0x6549('0x17')][_0x6549('0x1c')],function(_0x1fbfa4){return{'model':db[_0x1fbfa4[_0x6549('0x1e')]],'as':_0x1fbfa4['as'],'attributes':_0x1fbfa4['attributes'],'include':_0x1fbfa4[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x1fbfa4['include'],function(_0x126967){return{'model':db[_0x126967[_0x6549('0x1e')]],'as':_0x126967['as'],'attributes':_0x126967[_0x6549('0x1a')],'include':_0x126967['include']?_[_0x6549('0x1d')](_0x126967[_0x6549('0x1c')],function(_0x14de1f){return{'model':db[_0x14de1f[_0x6549('0x1e')]],'as':_0x14de1f['as'],'attributes':_0x14de1f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x2f58f7){logger[_0x6549('0xb')]('GetFreshsalesAccount',_0x53b12b);logger[_0x6549('0xe')](_0x6549('0x15'),_0x53b12b,JSON[_0x6549('0xf')](_0x2f58f7));_0x26a212(_0x2f58f7);})['catch'](function(_0x3f1502){logger['error']('GetFreshsalesAccount',_0x3f1502['message'],_0x53b12b);_0x48f037(_0x5d61a0[_0x6549('0x10')](0x1f4,_0x3f1502[_0x6549('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x30aac6){var _0x194ae7=this;return new Promise(function(_0x2e481f,_0x102a21){return db[_0x6549('0x1f')][_0x6549('0x20')]({'raw':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x18')]===undefined?!![]:![]:!![],'where':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')][_0x6549('0x19')]||null:null,'attributes':_0x30aac6[_0x6549('0x17')]?_0x30aac6[_0x6549('0x17')]['attributes']||null:null,'include':_0x30aac6[_0x6549('0x17')]?_0x30aac6['options'][_0x6549('0x1c')]?_['map'](_0x30aac6[_0x6549('0x17')][_0x6549('0x1c')],function(_0x3d9e9e){return{'model':db[_0x3d9e9e['model']],'as':_0x3d9e9e['as'],'attributes':_0x3d9e9e[_0x6549('0x1a')],'include':_0x3d9e9e[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x3d9e9e[_0x6549('0x1c')],function(_0x5b8624){return{'model':db[_0x5b8624['model']],'as':_0x5b8624['as'],'attributes':_0x5b8624['attributes'],'include':_0x5b8624[_0x6549('0x1c')]?_[_0x6549('0x1d')](_0x5b8624['include'],function(_0x43220f){return{'model':db[_0x43220f[_0x6549('0x1e')]],'as':_0x43220f['as'],'attributes':_0x43220f[_0x6549('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6549('0xa')](function(_0x3741f5){logger['info']('ShowFreshsalesAccount',_0x30aac6);logger[_0x6549('0xe')](_0x6549('0x21'),_0x30aac6,JSON[_0x6549('0xf')](_0x3741f5));_0x2e481f(_0x3741f5);})[_0x6549('0x14')](function(_0xa96598){logger[_0x6549('0x10')](_0x6549('0x21'),_0xa96598[_0x6549('0x12')],_0x30aac6);_0x102a21(_0x194ae7[_0x6549('0x10')](0x1f4,_0xa96598[_0x6549('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','FreshsalesAccount','lodash','util'];(function(_0x5e7391,_0x3babb0){var _0x1f9374=function(_0x5eefe1){while(--_0x5eefe1){_0x5e7391['push'](_0x5e7391['shift']());}};_0x1f9374(++_0x3babb0);}(_0xdb28,0x106));var _0x8db2=function(_0x427994,_0x2ab2ec){_0x427994=_0x427994-0x0;var _0x34c357=_0xdb28[_0x427994];return _0x34c357;};'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')]('FreshsalesAccount,\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['FreshsalesAccount'][_0x8db2('0x17')]({'raw':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1a')]||null:null,'attributes':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1b')]||null:null,'limit':_0x3fddc2['options']?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1c')]||null:null,'include':_0x3fddc2[_0x8db2('0x18')]?_0x3fddc2[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x3fddc2[_0x8db2('0x18')]['include'],function(_0x256202){return{'model':db[_0x256202['model']],'as':_0x256202['as'],'attributes':_0x256202['attributes'],'include':_0x256202['include']?_['map'](_0x256202[_0x8db2('0x1d')],function(_0x29b5cd){return{'model':db[_0x29b5cd[_0x8db2('0x1f')]],'as':_0x29b5cd['as'],'attributes':_0x29b5cd[_0x8db2('0x1b')],'include':_0x29b5cd[_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x29b5cd['include'],function(_0x3544ba){return{'model':db[_0x3544ba[_0x8db2('0x1f')]],'as':_0x3544ba['as'],'attributes':_0x3544ba[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x483aee){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')](_0x8db2('0x16'),_0x3fddc2,JSON[_0x8db2('0x10')](_0x483aee));_0x46ce14(_0x483aee);})[_0x8db2('0x15')](function(_0xa54ea3){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0xa54ea3['message'],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0xa54ea3['message']));});});};exports['ShowFreshsalesAccount']=function(_0x302188){var _0x25ed2c=this;return new Promise(function(_0xcc8a66,_0x49b2b3){return db[_0x8db2('0x20')]['find']({'raw':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x19')]===undefined?!![]:![]:!![],'where':_0x302188['options']?_0x302188['options'][_0x8db2('0x1a')]||null:null,'attributes':_0x302188[_0x8db2('0x18')]?_0x302188['options']['attributes']||null:null,'include':_0x302188[_0x8db2('0x18')]?_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')]?_[_0x8db2('0x1e')](_0x302188[_0x8db2('0x18')][_0x8db2('0x1d')],function(_0x101711){return{'model':db[_0x101711[_0x8db2('0x1f')]],'as':_0x101711['as'],'attributes':_0x101711[_0x8db2('0x1b')],'include':_0x101711[_0x8db2('0x1d')]?_['map'](_0x101711[_0x8db2('0x1d')],function(_0x304a72){return{'model':db[_0x304a72['model']],'as':_0x304a72['as'],'attributes':_0x304a72[_0x8db2('0x1b')],'include':_0x304a72[_0x8db2('0x1d')]?_['map'](_0x304a72['include'],function(_0x3c1983){return{'model':db[_0x3c1983['model']],'as':_0x3c1983['as'],'attributes':_0x3c1983[_0x8db2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8db2('0xc')](function(_0x26717d){logger[_0x8db2('0x14')]('ShowFreshsalesAccount',_0x302188);logger[_0x8db2('0xf')]('ShowFreshsalesAccount',_0x302188,JSON[_0x8db2('0x10')](_0x26717d));_0xcc8a66(_0x26717d);})[_0x8db2('0x15')](function(_0x2c8bc9){logger[_0x8db2('0x11')]('ShowFreshsalesAccount',_0x2c8bc9['message'],_0x302188);_0x49b2b3(_0x25ed2c[_0x8db2('0x11')](0x1f4,_0x2c8bc9[_0x8db2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a1d5244..18fa8a8 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 _0x4dbb=['destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','update','delete','/:id'];(function(_0x494b4c,_0x30e81e){var _0x1687f5=function(_0x2bf6e6){while(--_0x2bf6e6){_0x494b4c['push'](_0x494b4c['shift']());}};_0x1687f5(++_0x30e81e);}(_0x4dbb,0x14b));var _0xb4db=function(_0xa09242,_0x13dfdc){_0xa09242=_0xa09242-0x0;var _0x411cd0=_0x4dbb[_0xa09242];return _0x411cd0;};'use strict';var multer=require(_0xb4db('0x0'));var util=require('util');var path=require(_0xb4db('0x1'));var timeout=require(_0xb4db('0x2'));var express=require(_0xb4db('0x3'));var router=express['Router']();var fs_extra=require(_0xb4db('0x4'));var auth=require(_0xb4db('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb4db('0x6'));var controller=require(_0xb4db('0x7'));router[_0xb4db('0x8')]('/',auth[_0xb4db('0x9')](),controller[_0xb4db('0xa')]);router[_0xb4db('0x8')]('/:id',auth[_0xb4db('0x9')](),controller[_0xb4db('0xb')]);router[_0xb4db('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xb4db('0xc')]);router[_0xb4db('0x8')](_0xb4db('0xd'),auth['isAuthenticated'](),controller[_0xb4db('0xe')]);router[_0xb4db('0x8')](_0xb4db('0xf'),auth[_0xb4db('0x9')](),controller[_0xb4db('0x10')]);router['post']('/',auth[_0xb4db('0x9')](),controller[_0xb4db('0x11')]);router['put']('/:id',auth[_0xb4db('0x9')](),controller[_0xb4db('0x12')]);router[_0xb4db('0x13')](_0xb4db('0x14'),auth[_0xb4db('0x9')](),controller[_0xb4db('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9233=['get','isAuthenticated','index','/:id','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0x196a19,_0x235769){var _0x3e957a=function(_0x5aa496){while(--_0x5aa496){_0x196a19['push'](_0x196a19['shift']());}};_0x3e957a(++_0x235769);}(_0x9233,0x1ae));var _0x3923=function(_0x3eb8a2,_0x212a08){_0x3eb8a2=_0x3eb8a2-0x0;var _0x1ffdca=_0x9233[_0x3eb8a2];return _0x1ffdca;};'use strict';var multer=require('multer');var util=require(_0x3923('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3923('0x1'));var router=express[_0x3923('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3923('0x3'));var interaction=require(_0x3923('0x4'));var config=require(_0x3923('0x5'));var controller=require(_0x3923('0x6'));router[_0x3923('0x7')]('/',auth[_0x3923('0x8')](),controller[_0x3923('0x9')]);router[_0x3923('0x7')](_0x3923('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x3923('0x7')]('/:id/subjects',auth[_0x3923('0x8')](),controller[_0x3923('0xb')]);router[_0x3923('0x7')](_0x3923('0xc'),auth[_0x3923('0x8')](),controller[_0x3923('0xd')]);router['get'](_0x3923('0xe'),auth[_0x3923('0x8')](),controller[_0x3923('0xf')]);router[_0x3923('0x10')]('/',auth[_0x3923('0x8')](),controller[_0x3923('0x11')]);router[_0x3923('0x12')](_0x3923('0xa'),auth[_0x3923('0x8')](),controller[_0x3923('0x13')]);router[_0x3923('0x14')](_0x3923('0xa'),auth['isAuthenticated'](),controller[_0x3923('0x15')]);module[_0x3923('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 166dd9e..f5ac0d3 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 _0xb99d=['sequelize','exports','STRING'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xb99d,0xb7));var _0xdb99=function(_0x1e79d8,_0x3f2aa7){_0x1e79d8=_0x1e79d8-0x0;var _0x3c2e1c=_0xb99d[_0x1e79d8];return _0x3c2e1c;};'use strict';var Sequelize=require(_0xdb99('0x0'));module[_0xdb99('0x1')]={'name':{'type':Sequelize[_0xdb99('0x2')]},'description':{'type':Sequelize[_0xdb99('0x2')]}}; \ No newline at end of file +var _0xc43c=['exports','STRING'];(function(_0x130081,_0x17f937){var _0x18f2fb=function(_0x3c1303){while(--_0x3c1303){_0x130081['push'](_0x130081['shift']());}};_0x18f2fb(++_0x17f937);}(_0xc43c,0xfa));var _0xcc43=function(_0x5a57a4,_0x31576b){_0x5a57a4=_0x5a57a4-0x0;var _0x1ae310=_0xc43c[_0x5a57a4];return _0x1ae310;};'use strict';var Sequelize=require('sequelize');module[_0xcc43('0x0')]={'name':{'type':Sequelize[_0xcc43('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 43dc974..3ff503a 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 _0x73c1=['fields','pick','order','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','findOne','FreshsalesField'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x73c1,0x195));var _0x173c=function(_0x4210d7,_0x1db32c){_0x4210d7=_0x4210d7-0x0;var _0x299785=_0x73c1[_0x4210d7];return _0x299785;};'use strict';var emlformat=require(_0x173c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x173c('0x1'));var jsonpatch=require(_0x173c('0x2'));var rp=require(_0x173c('0x3'));var moment=require(_0x173c('0x4'));var BPromise=require(_0x173c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x173c('0x6'));var csv=require('to-csv');var ejs=require(_0x173c('0x7'));var fs=require('fs');var fs_extra=require(_0x173c('0x8'));var _=require(_0x173c('0x9'));var squel=require(_0x173c('0xa'));var crypto=require(_0x173c('0xb'));var jsforce=require(_0x173c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x173c('0xd'));var querystring=require(_0x173c('0xe'));var Papa=require('papaparse');var Redis=require(_0x173c('0xf'));var authService=require(_0x173c('0x10'));var qs=require(_0x173c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x173c('0x12'));var logger=require(_0x173c('0x13'))('api');var utils=require(_0x173c('0x14'));var config=require(_0x173c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x173c('0x16'))['db'];function respondWithStatusCode(_0x4b8ca1,_0x5b9b6a){_0x5b9b6a=_0x5b9b6a||0xcc;return function(_0x5a9e81){if(_0x5a9e81){return _0x4b8ca1['sendStatus'](_0x5b9b6a);}return _0x4b8ca1['status'](_0x5b9b6a)[_0x173c('0x17')]();};}function respondWithResult(_0x15afd9,_0xae5005){_0xae5005=_0xae5005||0xc8;return function(_0x255e33){if(_0x255e33){return _0x15afd9[_0x173c('0x18')](_0xae5005)[_0x173c('0x19')](_0x255e33);}};}function respondWithFilteredResult(_0x10abff,_0x33cfdc){return function(_0xfddda0){if(_0xfddda0){var _0x246b62=typeof _0x33cfdc[_0x173c('0x1a')]===_0x173c('0x1b')&&typeof _0x33cfdc[_0x173c('0x1c')]===_0x173c('0x1b');var _0x1fb974=_0xfddda0[_0x173c('0x1d')];var _0x181d80=_0x246b62?0x0:_0x33cfdc['offset'];var _0x5e3c0d=_0x246b62?_0xfddda0['count']:_0x33cfdc[_0x173c('0x1a')]+_0x33cfdc[_0x173c('0x1c')];var _0x113278;if(_0x5e3c0d>=_0x1fb974){_0x5e3c0d=_0x1fb974;_0x113278=0xc8;}else{_0x113278=0xce;}_0x10abff['status'](_0x113278);return _0x10abff[_0x173c('0x1e')](_0x173c('0x1f'),_0x181d80+'-'+_0x5e3c0d+'/'+_0x1fb974)[_0x173c('0x19')](_0xfddda0);}return null;};}function patchUpdates(_0x164b59){return function(_0x493860){try{jsonpatch['apply'](_0x493860,_0x164b59,!![]);}catch(_0x46cad1){return BPromise[_0x173c('0x20')](_0x46cad1);}return _0x493860[_0x173c('0x21')]();};}function saveUpdates(_0x257ea5,_0x5db0a2){return function(_0x16dc27){if(_0x16dc27){return _0x16dc27[_0x173c('0x22')](_0x257ea5)[_0x173c('0x23')](function(_0x23d550){return _0x23d550;});}return null;};}function removeEntity(_0x6958ff,_0x3a30af){return function(_0x33abcc){if(_0x33abcc){return _0x33abcc['destroy']()[_0x173c('0x23')](function(){_0x6958ff['status'](0xcc)[_0x173c('0x17')]();});}};}function handleEntityNotFound(_0x3fd367,_0x57eb20){return function(_0x3e8a00){if(!_0x3e8a00){_0x3fd367[_0x173c('0x24')](0x194);}return _0x3e8a00;};}function handleError(_0x5bc55c,_0x527390){_0x527390=_0x527390||0x1f4;return function(_0x217a48){logger[_0x173c('0x25')](_0x217a48['stack']);if(_0x217a48['name']){delete _0x217a48[_0x173c('0x26')];}_0x5bc55c['status'](_0x527390)[_0x173c('0x27')](_0x217a48);};}exports[_0x173c('0x28')]=function(_0x6b3c16,_0xcdea82){var _0x63993e={},_0xf171ab={},_0x12969c={'count':0x0,'rows':[]};var _0x463237=_[_0x173c('0x29')](db[_0x173c('0x2a')]['rawAttributes'],function(_0x5e3479){return{'name':_0x5e3479[_0x173c('0x2b')],'type':_0x5e3479[_0x173c('0x2c')][_0x173c('0x2d')]};});_0xf171ab[_0x173c('0x2e')]=_[_0x173c('0x29')](_0x463237,_0x173c('0x26'));_0xf171ab[_0x173c('0x2f')]=_[_0x173c('0x30')](_0x6b3c16[_0x173c('0x2f')]);_0xf171ab['filters']=_[_0x173c('0x31')](_0xf171ab[_0x173c('0x2e')],_0xf171ab[_0x173c('0x2f')]);_0x63993e[_0x173c('0x32')]=_[_0x173c('0x31')](_0xf171ab[_0x173c('0x2e')],qs['fields'](_0x6b3c16[_0x173c('0x2f')]['fields']));_0x63993e[_0x173c('0x32')]=_0x63993e['attributes'][_0x173c('0x33')]?_0x63993e['attributes']:_0xf171ab[_0x173c('0x2e')];if(!_0x6b3c16[_0x173c('0x2f')][_0x173c('0x34')](_0x173c('0x35'))){_0x63993e[_0x173c('0x1c')]=qs['limit'](_0x6b3c16[_0x173c('0x2f')][_0x173c('0x1c')]);_0x63993e[_0x173c('0x1a')]=qs['offset'](_0x6b3c16[_0x173c('0x2f')][_0x173c('0x1a')]);}_0x63993e['order']=qs[_0x173c('0x36')](_0x6b3c16[_0x173c('0x2f')][_0x173c('0x36')]);_0x63993e[_0x173c('0x37')]=qs[_0x173c('0x38')](_['pick'](_0x6b3c16[_0x173c('0x2f')],_0xf171ab[_0x173c('0x38')]),_0x463237);if(_0x6b3c16[_0x173c('0x2f')][_0x173c('0x39')]){_0x63993e[_0x173c('0x37')]=_[_0x173c('0x3a')](_0x63993e[_0x173c('0x37')],{'$or':_[_0x173c('0x29')](_0x463237,function(_0x46261a){if(_0x46261a[_0x173c('0x2c')]!==_0x173c('0x3b')){var _0x532fca={};_0x532fca[_0x46261a['name']]={'$like':'%'+_0x6b3c16[_0x173c('0x2f')][_0x173c('0x39')]+'%'};return _0x532fca;}})});}_0x63993e=_[_0x173c('0x3a')]({},_0x63993e,_0x6b3c16[_0x173c('0x3c')]);var _0x53ca8c={'where':_0x63993e[_0x173c('0x37')]};return db[_0x173c('0x2a')][_0x173c('0x1d')](_0x53ca8c)[_0x173c('0x23')](function(_0x5c2af9){_0x12969c[_0x173c('0x1d')]=_0x5c2af9;if(_0x6b3c16[_0x173c('0x2f')][_0x173c('0x3d')]){_0x63993e[_0x173c('0x3e')]=[{'all':!![]}];}return db[_0x173c('0x2a')][_0x173c('0x3f')](_0x63993e);})[_0x173c('0x23')](function(_0x3eae11){_0x12969c[_0x173c('0x40')]=_0x3eae11;return _0x12969c;})[_0x173c('0x23')](respondWithFilteredResult(_0xcdea82,_0x63993e))['catch'](handleError(_0xcdea82,null));};exports[_0x173c('0x41')]=function(_0x4739e2,_0x4958bf){var _0x2b46c1={'raw':![],'where':{'id':_0x4739e2[_0x173c('0x42')]['id']}},_0xc87139={};_0xc87139['model']=_['keys'](db[_0x173c('0x2a')][_0x173c('0x43')]);_0xc87139['query']=_[_0x173c('0x30')](_0x4739e2[_0x173c('0x2f')]);_0xc87139['filters']=_[_0x173c('0x31')](_0xc87139['model'],_0xc87139[_0x173c('0x2f')]);_0x2b46c1[_0x173c('0x32')]=_[_0x173c('0x31')](_0xc87139['model'],qs['fields'](_0x4739e2['query']['fields']));_0x2b46c1[_0x173c('0x32')]=_0x2b46c1['attributes'][_0x173c('0x33')]?_0x2b46c1[_0x173c('0x32')]:_0xc87139[_0x173c('0x2e')];if(_0x4739e2[_0x173c('0x2f')]['includeAll']){_0x2b46c1['include']=[{'all':!![]}];}_0x2b46c1=_[_0x173c('0x3a')]({},_0x2b46c1,_0x4739e2[_0x173c('0x3c')]);return db[_0x173c('0x2a')][_0x173c('0x44')](_0x2b46c1)[_0x173c('0x23')](handleEntityNotFound(_0x4958bf,null))['then'](respondWithResult(_0x4958bf,null))[_0x173c('0x45')](handleError(_0x4958bf,null));};exports[_0x173c('0x46')]=function(_0x21592e,_0x59d9ba){return db[_0x173c('0x2a')][_0x173c('0x46')](_0x21592e['body'],{})[_0x173c('0x23')](respondWithResult(_0x59d9ba,0xc9))[_0x173c('0x45')](handleError(_0x59d9ba,null));};exports[_0x173c('0x22')]=function(_0x39b792,_0x3613cd){if(_0x39b792[_0x173c('0x47')]['id']){delete _0x39b792['body']['id'];}return db[_0x173c('0x2a')]['find']({'where':{'id':_0x39b792[_0x173c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3613cd,null))[_0x173c('0x23')](saveUpdates(_0x39b792[_0x173c('0x47')],null))[_0x173c('0x23')](respondWithResult(_0x3613cd,null))[_0x173c('0x45')](handleError(_0x3613cd,null));};exports[_0x173c('0x48')]=function(_0x457345,_0x435110){return db['FreshsalesConfiguration'][_0x173c('0x44')]({'where':{'id':_0x457345['params']['id']}})[_0x173c('0x23')](handleEntityNotFound(_0x435110,null))[_0x173c('0x23')](removeEntity(_0x435110,null))[_0x173c('0x45')](handleError(_0x435110,null));};exports['getSubjects']=function(_0x1117ac,_0x198fda,_0x11fc3f){var _0x2fb2db={};var _0x5c4863={};var _0x47cec3;var _0xf543e2;return db['FreshsalesConfiguration'][_0x173c('0x49')]({'where':{'id':_0x1117ac[_0x173c('0x42')]['id']}})[_0x173c('0x23')](handleEntityNotFound(_0x198fda,null))[_0x173c('0x23')](function(_0x2247ac){if(_0x2247ac){_0x47cec3=_0x2247ac;_0x5c4863[_0x173c('0x2e')]=_['keys'](db[_0x173c('0x4a')][_0x173c('0x43')]);_0x5c4863['query']=_[_0x173c('0x30')](_0x1117ac[_0x173c('0x2f')]);_0x5c4863[_0x173c('0x38')]=_[_0x173c('0x31')](_0x5c4863[_0x173c('0x2e')],_0x5c4863[_0x173c('0x2f')]);_0x2fb2db[_0x173c('0x32')]=_[_0x173c('0x31')](_0x5c4863[_0x173c('0x2e')],qs[_0x173c('0x4b')](_0x1117ac[_0x173c('0x2f')]['fields']));_0x2fb2db[_0x173c('0x32')]=_0x2fb2db[_0x173c('0x32')][_0x173c('0x33')]?_0x2fb2db[_0x173c('0x32')]:_0x5c4863['model'];_0x2fb2db['order']=qs[_0x173c('0x36')](_0x1117ac[_0x173c('0x2f')][_0x173c('0x36')]);_0x2fb2db['where']=qs[_0x173c('0x38')](_[_0x173c('0x4c')](_0x1117ac[_0x173c('0x2f')],_0x5c4863['filters']));if(_0x1117ac['query'][_0x173c('0x39')]){_0x2fb2db['where']=_[_0x173c('0x3a')](_0x2fb2db[_0x173c('0x37')],{'$or':_[_0x173c('0x29')](_0x2fb2db[_0x173c('0x32')],function(_0x109f22){var _0xfa7845={};_0xfa7845[_0x109f22]={'$like':'%'+_0x1117ac[_0x173c('0x2f')][_0x173c('0x39')]+'%'};return _0xfa7845;})});}_0x2fb2db=_[_0x173c('0x3a')]({},_0x2fb2db,_0x1117ac['options']);return _0x47cec3['getSubjects'](_0x2fb2db);}})[_0x173c('0x23')](function(_0x1b48a6){if(_0x1b48a6){_0xf543e2=_0x1b48a6[_0x173c('0x33')];if(!_0x1117ac[_0x173c('0x2f')][_0x173c('0x34')](_0x173c('0x35'))){_0x2fb2db[_0x173c('0x1c')]=qs[_0x173c('0x1c')](_0x1117ac[_0x173c('0x2f')][_0x173c('0x1c')]);_0x2fb2db[_0x173c('0x1a')]=qs[_0x173c('0x1a')](_0x1117ac['query'][_0x173c('0x1a')]);}return _0x47cec3['getSubjects'](_0x2fb2db);}})['then'](function(_0x5745c7){if(_0x5745c7){return _0x5745c7?{'count':_0xf543e2,'rows':_0x5745c7}:null;}})['then'](respondWithResult(_0x198fda,null))['catch'](handleError(_0x198fda,null));};exports['getDescriptions']=function(_0x14d6e6,_0x1979ca,_0x10cf51){var _0x4d85ea={};var _0x268dd3={};var _0x10a35a;var _0x1a1f42;return db[_0x173c('0x2a')][_0x173c('0x49')]({'where':{'id':_0x14d6e6[_0x173c('0x42')]['id']}})[_0x173c('0x23')](handleEntityNotFound(_0x1979ca,null))[_0x173c('0x23')](function(_0x7b52ae){if(_0x7b52ae){_0x10a35a=_0x7b52ae;_0x268dd3['model']=_[_0x173c('0x30')](db[_0x173c('0x4a')][_0x173c('0x43')]);_0x268dd3['query']=_['keys'](_0x14d6e6['query']);_0x268dd3['filters']=_[_0x173c('0x31')](_0x268dd3[_0x173c('0x2e')],_0x268dd3[_0x173c('0x2f')]);_0x4d85ea[_0x173c('0x32')]=_['intersection'](_0x268dd3[_0x173c('0x2e')],qs[_0x173c('0x4b')](_0x14d6e6[_0x173c('0x2f')]['fields']));_0x4d85ea[_0x173c('0x32')]=_0x4d85ea[_0x173c('0x32')][_0x173c('0x33')]?_0x4d85ea[_0x173c('0x32')]:_0x268dd3[_0x173c('0x2e')];_0x4d85ea[_0x173c('0x4d')]=qs[_0x173c('0x36')](_0x14d6e6['query'][_0x173c('0x36')]);_0x4d85ea[_0x173c('0x37')]=qs[_0x173c('0x38')](_[_0x173c('0x4c')](_0x14d6e6[_0x173c('0x2f')],_0x268dd3[_0x173c('0x38')]));if(_0x14d6e6['query'][_0x173c('0x39')]){_0x4d85ea[_0x173c('0x37')]=_['merge'](_0x4d85ea[_0x173c('0x37')],{'$or':_[_0x173c('0x29')](_0x4d85ea[_0x173c('0x32')],function(_0x513dac){var _0x19fc52={};_0x19fc52[_0x513dac]={'$like':'%'+_0x14d6e6['query'][_0x173c('0x39')]+'%'};return _0x19fc52;})});}_0x4d85ea=_[_0x173c('0x3a')]({},_0x4d85ea,_0x14d6e6[_0x173c('0x3c')]);return _0x10a35a[_0x173c('0x4e')](_0x4d85ea);}})[_0x173c('0x23')](function(_0x58ab55){if(_0x58ab55){_0x1a1f42=_0x58ab55[_0x173c('0x33')];if(!_0x14d6e6[_0x173c('0x2f')][_0x173c('0x34')](_0x173c('0x35'))){_0x4d85ea[_0x173c('0x1c')]=qs[_0x173c('0x1c')](_0x14d6e6[_0x173c('0x2f')][_0x173c('0x1c')]);_0x4d85ea[_0x173c('0x1a')]=qs[_0x173c('0x1a')](_0x14d6e6[_0x173c('0x2f')][_0x173c('0x1a')]);}return _0x10a35a['getDescriptions'](_0x4d85ea);}})[_0x173c('0x23')](function(_0x236622){if(_0x236622){return _0x236622?{'count':_0x1a1f42,'rows':_0x236622}:null;}})[_0x173c('0x23')](respondWithResult(_0x1979ca,null))[_0x173c('0x45')](handleError(_0x1979ca,null));};exports[_0x173c('0x4f')]=function(_0x11692d,_0x7ad9b9,_0x18e586){var _0x332167={};var _0x338bc1={};var _0x4371e3;var _0x427148;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x11692d[_0x173c('0x42')]['id']}})[_0x173c('0x23')](handleEntityNotFound(_0x7ad9b9,null))[_0x173c('0x23')](function(_0x24fdbe){if(_0x24fdbe){_0x4371e3=_0x24fdbe;_0x338bc1[_0x173c('0x2e')]=_['keys'](db[_0x173c('0x4a')][_0x173c('0x43')]);_0x338bc1['query']=_[_0x173c('0x30')](_0x11692d[_0x173c('0x2f')]);_0x338bc1['filters']=_[_0x173c('0x31')](_0x338bc1[_0x173c('0x2e')],_0x338bc1[_0x173c('0x2f')]);_0x332167[_0x173c('0x32')]=_[_0x173c('0x31')](_0x338bc1[_0x173c('0x2e')],qs[_0x173c('0x4b')](_0x11692d[_0x173c('0x2f')][_0x173c('0x4b')]));_0x332167['attributes']=_0x332167['attributes'][_0x173c('0x33')]?_0x332167[_0x173c('0x32')]:_0x338bc1[_0x173c('0x2e')];_0x332167[_0x173c('0x4d')]=qs[_0x173c('0x36')](_0x11692d[_0x173c('0x2f')][_0x173c('0x36')]);_0x332167[_0x173c('0x37')]=qs[_0x173c('0x38')](_['pick'](_0x11692d[_0x173c('0x2f')],_0x338bc1[_0x173c('0x38')]));if(_0x11692d[_0x173c('0x2f')][_0x173c('0x39')]){_0x332167[_0x173c('0x37')]=_[_0x173c('0x3a')](_0x332167[_0x173c('0x37')],{'$or':_[_0x173c('0x29')](_0x332167[_0x173c('0x32')],function(_0x16dd31){var _0x54d404={};_0x54d404[_0x16dd31]={'$like':'%'+_0x11692d['query'][_0x173c('0x39')]+'%'};return _0x54d404;})});}_0x332167=_[_0x173c('0x3a')]({},_0x332167,_0x11692d[_0x173c('0x3c')]);return _0x4371e3[_0x173c('0x4f')](_0x332167);}})['then'](function(_0x1675c8){if(_0x1675c8){_0x427148=_0x1675c8['length'];if(!_0x11692d[_0x173c('0x2f')][_0x173c('0x34')](_0x173c('0x35'))){_0x332167[_0x173c('0x1c')]=qs[_0x173c('0x1c')](_0x11692d[_0x173c('0x2f')][_0x173c('0x1c')]);_0x332167[_0x173c('0x1a')]=qs[_0x173c('0x1a')](_0x11692d['query']['offset']);}return _0x4371e3[_0x173c('0x4f')](_0x332167);}})[_0x173c('0x23')](function(_0x6b9768){if(_0x6b9768){return _0x6b9768?{'count':_0x427148,'rows':_0x6b9768}:null;}})[_0x173c('0x23')](respondWithResult(_0x7ad9b9,null))[_0x173c('0x45')](handleError(_0x7ad9b9,null));}; \ No newline at end of file +var _0xe076=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','FreshsalesConfiguration','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','show','params','keys','length','find','catch','body','getSubjects','findOne','getDescriptions','FreshsalesField','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x54936e,_0x319325){var _0x5cc6a0=function(_0x31a907){while(--_0x31a907){_0x54936e['push'](_0x54936e['shift']());}};_0x5cc6a0(++_0x319325);}(_0xe076,0x1ca));var _0x6e07=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xe076[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e07('0x0'));var zipdir=require(_0x6e07('0x1'));var jsonpatch=require(_0x6e07('0x2'));var rp=require(_0x6e07('0x3'));var moment=require(_0x6e07('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6e07('0x5'));var util=require(_0x6e07('0x6'));var path=require(_0x6e07('0x7'));var sox=require(_0x6e07('0x8'));var csv=require(_0x6e07('0x9'));var ejs=require(_0x6e07('0xa'));var fs=require('fs');var fs_extra=require(_0x6e07('0xb'));var _=require(_0x6e07('0xc'));var squel=require(_0x6e07('0xd'));var crypto=require(_0x6e07('0xe'));var jsforce=require(_0x6e07('0xf'));var deskjs=require(_0x6e07('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6e07('0x11'));var Redis=require(_0x6e07('0x12'));var authService=require(_0x6e07('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6e07('0x14'));var hardwareService=require(_0x6e07('0x15'));var logger=require(_0x6e07('0x16'))(_0x6e07('0x17'));var utils=require(_0x6e07('0x18'));var config=require(_0x6e07('0x19'));var licenseUtil=require(_0x6e07('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b3ef,_0x29bce3){_0x29bce3=_0x29bce3||0xcc;return function(_0x52774a){if(_0x52774a){return _0x52b3ef[_0x6e07('0x1b')](_0x29bce3);}return _0x52b3ef['status'](_0x29bce3)[_0x6e07('0x1c')]();};}function respondWithResult(_0x2a3add,_0x43a548){_0x43a548=_0x43a548||0xc8;return function(_0x2ee73d){if(_0x2ee73d){return _0x2a3add[_0x6e07('0x1d')](_0x43a548)[_0x6e07('0x1e')](_0x2ee73d);}};}function respondWithFilteredResult(_0x2bd11c,_0x234493){return function(_0x373b7c){if(_0x373b7c){var _0x4c35c6=typeof _0x234493[_0x6e07('0x1f')]===_0x6e07('0x20')&&typeof _0x234493['limit']==='undefined';var _0x3b3cd8=_0x373b7c[_0x6e07('0x21')];var _0x177505=_0x4c35c6?0x0:_0x234493[_0x6e07('0x1f')];var _0x4f1a2d=_0x4c35c6?_0x373b7c[_0x6e07('0x21')]:_0x234493[_0x6e07('0x1f')]+_0x234493['limit'];var _0x216bf6;if(_0x4f1a2d>=_0x3b3cd8){_0x4f1a2d=_0x3b3cd8;_0x216bf6=0xc8;}else{_0x216bf6=0xce;}_0x2bd11c[_0x6e07('0x1d')](_0x216bf6);return _0x2bd11c[_0x6e07('0x22')](_0x6e07('0x23'),_0x177505+'-'+_0x4f1a2d+'/'+_0x3b3cd8)[_0x6e07('0x1e')](_0x373b7c);}return null;};}function patchUpdates(_0x3a1147){return function(_0x289636){try{jsonpatch['apply'](_0x289636,_0x3a1147,!![]);}catch(_0x3d32d2){return BPromise[_0x6e07('0x24')](_0x3d32d2);}return _0x289636[_0x6e07('0x25')]();};}function saveUpdates(_0x201daa,_0x4e9666){return function(_0x4db217){if(_0x4db217){return _0x4db217[_0x6e07('0x26')](_0x201daa)[_0x6e07('0x27')](function(_0x173389){return _0x173389;});}return null;};}function removeEntity(_0x3059ad,_0x3879e7){return function(_0x30bdba){if(_0x30bdba){return _0x30bdba[_0x6e07('0x28')]()[_0x6e07('0x27')](function(){_0x3059ad[_0x6e07('0x1d')](0xcc)[_0x6e07('0x1c')]();});}};}function handleEntityNotFound(_0x23ace8,_0x28d11b){return function(_0x39f556){if(!_0x39f556){_0x23ace8[_0x6e07('0x1b')](0x194);}return _0x39f556;};}function handleError(_0x51e97c,_0x2432b5){_0x2432b5=_0x2432b5||0x1f4;return function(_0x292494){logger['error'](_0x292494['stack']);if(_0x292494[_0x6e07('0x29')]){delete _0x292494[_0x6e07('0x29')];}_0x51e97c['status'](_0x2432b5)[_0x6e07('0x2a')](_0x292494);};}exports[_0x6e07('0x2b')]=function(_0x4c66f2,_0x4ed0ee){var _0x1e4771={},_0x42c182={},_0x523bb5={'count':0x0,'rows':[]};var _0x1a825a=_[_0x6e07('0x2c')](db[_0x6e07('0x2d')][_0x6e07('0x2e')],function(_0x39588a){return{'name':_0x39588a['fieldName'],'type':_0x39588a['type'][_0x6e07('0x2f')]};});_0x42c182[_0x6e07('0x30')]=_[_0x6e07('0x2c')](_0x1a825a,_0x6e07('0x29'));_0x42c182[_0x6e07('0x31')]=_['keys'](_0x4c66f2[_0x6e07('0x31')]);_0x42c182[_0x6e07('0x32')]=_[_0x6e07('0x33')](_0x42c182['model'],_0x42c182[_0x6e07('0x31')]);_0x1e4771[_0x6e07('0x34')]=_['intersection'](_0x42c182['model'],qs[_0x6e07('0x35')](_0x4c66f2[_0x6e07('0x31')]['fields']));_0x1e4771[_0x6e07('0x34')]=_0x1e4771[_0x6e07('0x34')]['length']?_0x1e4771['attributes']:_0x42c182['model'];if(!_0x4c66f2[_0x6e07('0x31')][_0x6e07('0x36')](_0x6e07('0x37'))){_0x1e4771[_0x6e07('0x38')]=qs[_0x6e07('0x38')](_0x4c66f2['query']['limit']);_0x1e4771[_0x6e07('0x1f')]=qs[_0x6e07('0x1f')](_0x4c66f2['query'][_0x6e07('0x1f')]);}_0x1e4771[_0x6e07('0x39')]=qs[_0x6e07('0x3a')](_0x4c66f2[_0x6e07('0x31')][_0x6e07('0x3a')]);_0x1e4771['where']=qs[_0x6e07('0x32')](_[_0x6e07('0x3b')](_0x4c66f2['query'],_0x42c182[_0x6e07('0x32')]),_0x1a825a);if(_0x4c66f2[_0x6e07('0x31')][_0x6e07('0x3c')]){_0x1e4771['where']=_[_0x6e07('0x3d')](_0x1e4771[_0x6e07('0x3e')],{'$or':_[_0x6e07('0x2c')](_0x1a825a,function(_0x2718dc){if(_0x2718dc['type']!==_0x6e07('0x3f')){var _0x2852bb={};_0x2852bb[_0x2718dc[_0x6e07('0x29')]]={'$like':'%'+_0x4c66f2['query'][_0x6e07('0x3c')]+'%'};return _0x2852bb;}})});}_0x1e4771=_['merge']({},_0x1e4771,_0x4c66f2[_0x6e07('0x40')]);var _0x5aae7a={'where':_0x1e4771[_0x6e07('0x3e')]};return db[_0x6e07('0x2d')][_0x6e07('0x21')](_0x5aae7a)[_0x6e07('0x27')](function(_0x4c9118){_0x523bb5[_0x6e07('0x21')]=_0x4c9118;if(_0x4c66f2[_0x6e07('0x31')][_0x6e07('0x41')]){_0x1e4771[_0x6e07('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1e4771);})[_0x6e07('0x27')](function(_0x19b9be){_0x523bb5['rows']=_0x19b9be;return _0x523bb5;})[_0x6e07('0x27')](respondWithFilteredResult(_0x4ed0ee,_0x1e4771))['catch'](handleError(_0x4ed0ee,null));};exports[_0x6e07('0x43')]=function(_0x1be917,_0x48aac3){var _0x5902c3={'raw':![],'where':{'id':_0x1be917[_0x6e07('0x44')]['id']}},_0x39ac4b={};_0x39ac4b['model']=_[_0x6e07('0x45')](db[_0x6e07('0x2d')][_0x6e07('0x2e')]);_0x39ac4b['query']=_[_0x6e07('0x45')](_0x1be917[_0x6e07('0x31')]);_0x39ac4b[_0x6e07('0x32')]=_[_0x6e07('0x33')](_0x39ac4b[_0x6e07('0x30')],_0x39ac4b[_0x6e07('0x31')]);_0x5902c3[_0x6e07('0x34')]=_[_0x6e07('0x33')](_0x39ac4b['model'],qs[_0x6e07('0x35')](_0x1be917['query'][_0x6e07('0x35')]));_0x5902c3[_0x6e07('0x34')]=_0x5902c3[_0x6e07('0x34')][_0x6e07('0x46')]?_0x5902c3[_0x6e07('0x34')]:_0x39ac4b[_0x6e07('0x30')];if(_0x1be917[_0x6e07('0x31')]['includeAll']){_0x5902c3[_0x6e07('0x42')]=[{'all':!![]}];}_0x5902c3=_['merge']({},_0x5902c3,_0x1be917[_0x6e07('0x40')]);return db[_0x6e07('0x2d')][_0x6e07('0x47')](_0x5902c3)[_0x6e07('0x27')](handleEntityNotFound(_0x48aac3,null))['then'](respondWithResult(_0x48aac3,null))[_0x6e07('0x48')](handleError(_0x48aac3,null));};exports['create']=function(_0xc50e23,_0x190ee7){return db[_0x6e07('0x2d')]['create'](_0xc50e23['body'],{})['then'](respondWithResult(_0x190ee7,0xc9))[_0x6e07('0x48')](handleError(_0x190ee7,null));};exports[_0x6e07('0x26')]=function(_0x44f0af,_0x553cdd){if(_0x44f0af[_0x6e07('0x49')]['id']){delete _0x44f0af['body']['id'];}return db[_0x6e07('0x2d')][_0x6e07('0x47')]({'where':{'id':_0x44f0af['params']['id']}})[_0x6e07('0x27')](handleEntityNotFound(_0x553cdd,null))[_0x6e07('0x27')](saveUpdates(_0x44f0af[_0x6e07('0x49')],null))[_0x6e07('0x27')](respondWithResult(_0x553cdd,null))[_0x6e07('0x48')](handleError(_0x553cdd,null));};exports[_0x6e07('0x28')]=function(_0x1844ff,_0x532a1e){return db[_0x6e07('0x2d')]['find']({'where':{'id':_0x1844ff['params']['id']}})[_0x6e07('0x27')](handleEntityNotFound(_0x532a1e,null))[_0x6e07('0x27')](removeEntity(_0x532a1e,null))[_0x6e07('0x48')](handleError(_0x532a1e,null));};exports[_0x6e07('0x4a')]=function(_0x49581a,_0x4363df,_0x26f2e6){var _0x1b67f9={};var _0x553618={};var _0x21975d;var _0x424180;return db[_0x6e07('0x2d')][_0x6e07('0x4b')]({'where':{'id':_0x49581a['params']['id']}})[_0x6e07('0x27')](handleEntityNotFound(_0x4363df,null))[_0x6e07('0x27')](function(_0x5584ec){if(_0x5584ec){_0x21975d=_0x5584ec;_0x553618[_0x6e07('0x30')]=_[_0x6e07('0x45')](db['FreshsalesField'][_0x6e07('0x2e')]);_0x553618[_0x6e07('0x31')]=_[_0x6e07('0x45')](_0x49581a['query']);_0x553618[_0x6e07('0x32')]=_[_0x6e07('0x33')](_0x553618['model'],_0x553618[_0x6e07('0x31')]);_0x1b67f9[_0x6e07('0x34')]=_[_0x6e07('0x33')](_0x553618[_0x6e07('0x30')],qs[_0x6e07('0x35')](_0x49581a[_0x6e07('0x31')][_0x6e07('0x35')]));_0x1b67f9[_0x6e07('0x34')]=_0x1b67f9[_0x6e07('0x34')]['length']?_0x1b67f9['attributes']:_0x553618[_0x6e07('0x30')];_0x1b67f9[_0x6e07('0x39')]=qs[_0x6e07('0x3a')](_0x49581a['query'][_0x6e07('0x3a')]);_0x1b67f9[_0x6e07('0x3e')]=qs[_0x6e07('0x32')](_[_0x6e07('0x3b')](_0x49581a['query'],_0x553618[_0x6e07('0x32')]));if(_0x49581a[_0x6e07('0x31')][_0x6e07('0x3c')]){_0x1b67f9['where']=_[_0x6e07('0x3d')](_0x1b67f9[_0x6e07('0x3e')],{'$or':_[_0x6e07('0x2c')](_0x1b67f9[_0x6e07('0x34')],function(_0x286e37){var _0x2b8dbe={};_0x2b8dbe[_0x286e37]={'$like':'%'+_0x49581a[_0x6e07('0x31')]['filter']+'%'};return _0x2b8dbe;})});}_0x1b67f9=_[_0x6e07('0x3d')]({},_0x1b67f9,_0x49581a[_0x6e07('0x40')]);return _0x21975d[_0x6e07('0x4a')](_0x1b67f9);}})[_0x6e07('0x27')](function(_0x11a399){if(_0x11a399){_0x424180=_0x11a399[_0x6e07('0x46')];if(!_0x49581a['query'][_0x6e07('0x36')](_0x6e07('0x37'))){_0x1b67f9[_0x6e07('0x38')]=qs[_0x6e07('0x38')](_0x49581a[_0x6e07('0x31')]['limit']);_0x1b67f9[_0x6e07('0x1f')]=qs[_0x6e07('0x1f')](_0x49581a[_0x6e07('0x31')][_0x6e07('0x1f')]);}return _0x21975d['getSubjects'](_0x1b67f9);}})[_0x6e07('0x27')](function(_0x978ba){if(_0x978ba){return _0x978ba?{'count':_0x424180,'rows':_0x978ba}:null;}})[_0x6e07('0x27')](respondWithResult(_0x4363df,null))['catch'](handleError(_0x4363df,null));};exports[_0x6e07('0x4c')]=function(_0x198901,_0x20d8aa,_0x11dffd){var _0x3c467f={};var _0x4a3a39={};var _0x35f364;var _0x479487;return db[_0x6e07('0x2d')][_0x6e07('0x4b')]({'where':{'id':_0x198901[_0x6e07('0x44')]['id']}})[_0x6e07('0x27')](handleEntityNotFound(_0x20d8aa,null))[_0x6e07('0x27')](function(_0x42475b){if(_0x42475b){_0x35f364=_0x42475b;_0x4a3a39['model']=_['keys'](db[_0x6e07('0x4d')][_0x6e07('0x2e')]);_0x4a3a39[_0x6e07('0x31')]=_['keys'](_0x198901['query']);_0x4a3a39[_0x6e07('0x32')]=_[_0x6e07('0x33')](_0x4a3a39[_0x6e07('0x30')],_0x4a3a39[_0x6e07('0x31')]);_0x3c467f['attributes']=_[_0x6e07('0x33')](_0x4a3a39[_0x6e07('0x30')],qs['fields'](_0x198901['query'][_0x6e07('0x35')]));_0x3c467f['attributes']=_0x3c467f[_0x6e07('0x34')][_0x6e07('0x46')]?_0x3c467f[_0x6e07('0x34')]:_0x4a3a39[_0x6e07('0x30')];_0x3c467f['order']=qs[_0x6e07('0x3a')](_0x198901[_0x6e07('0x31')]['sort']);_0x3c467f['where']=qs[_0x6e07('0x32')](_[_0x6e07('0x3b')](_0x198901[_0x6e07('0x31')],_0x4a3a39[_0x6e07('0x32')]));if(_0x198901['query']['filter']){_0x3c467f[_0x6e07('0x3e')]=_[_0x6e07('0x3d')](_0x3c467f[_0x6e07('0x3e')],{'$or':_[_0x6e07('0x2c')](_0x3c467f[_0x6e07('0x34')],function(_0x1d0787){var _0x4626ad={};_0x4626ad[_0x1d0787]={'$like':'%'+_0x198901[_0x6e07('0x31')][_0x6e07('0x3c')]+'%'};return _0x4626ad;})});}_0x3c467f=_[_0x6e07('0x3d')]({},_0x3c467f,_0x198901['options']);return _0x35f364[_0x6e07('0x4c')](_0x3c467f);}})[_0x6e07('0x27')](function(_0x5888c6){if(_0x5888c6){_0x479487=_0x5888c6[_0x6e07('0x46')];if(!_0x198901[_0x6e07('0x31')][_0x6e07('0x36')]('nolimit')){_0x3c467f['limit']=qs['limit'](_0x198901[_0x6e07('0x31')][_0x6e07('0x38')]);_0x3c467f[_0x6e07('0x1f')]=qs[_0x6e07('0x1f')](_0x198901['query'][_0x6e07('0x1f')]);}return _0x35f364[_0x6e07('0x4c')](_0x3c467f);}})[_0x6e07('0x27')](function(_0x3d0068){if(_0x3d0068){return _0x3d0068?{'count':_0x479487,'rows':_0x3d0068}:null;}})[_0x6e07('0x27')](respondWithResult(_0x20d8aa,null))[_0x6e07('0x48')](handleError(_0x20d8aa,null));};exports[_0x6e07('0x4e')]=function(_0x4d7370,_0x54f4c5,_0x48376c){var _0x5407cd={};var _0x19b4be={};var _0x13d4e2;var _0x34c95;return db['FreshsalesConfiguration'][_0x6e07('0x4b')]({'where':{'id':_0x4d7370[_0x6e07('0x44')]['id']}})[_0x6e07('0x27')](handleEntityNotFound(_0x54f4c5,null))['then'](function(_0x338ef0){if(_0x338ef0){_0x13d4e2=_0x338ef0;_0x19b4be[_0x6e07('0x30')]=_[_0x6e07('0x45')](db[_0x6e07('0x4d')][_0x6e07('0x2e')]);_0x19b4be[_0x6e07('0x31')]=_[_0x6e07('0x45')](_0x4d7370[_0x6e07('0x31')]);_0x19b4be[_0x6e07('0x32')]=_[_0x6e07('0x33')](_0x19b4be['model'],_0x19b4be[_0x6e07('0x31')]);_0x5407cd[_0x6e07('0x34')]=_[_0x6e07('0x33')](_0x19b4be[_0x6e07('0x30')],qs['fields'](_0x4d7370[_0x6e07('0x31')][_0x6e07('0x35')]));_0x5407cd[_0x6e07('0x34')]=_0x5407cd[_0x6e07('0x34')][_0x6e07('0x46')]?_0x5407cd[_0x6e07('0x34')]:_0x19b4be['model'];_0x5407cd[_0x6e07('0x39')]=qs[_0x6e07('0x3a')](_0x4d7370['query'][_0x6e07('0x3a')]);_0x5407cd['where']=qs[_0x6e07('0x32')](_[_0x6e07('0x3b')](_0x4d7370['query'],_0x19b4be['filters']));if(_0x4d7370['query'][_0x6e07('0x3c')]){_0x5407cd[_0x6e07('0x3e')]=_[_0x6e07('0x3d')](_0x5407cd['where'],{'$or':_[_0x6e07('0x2c')](_0x5407cd[_0x6e07('0x34')],function(_0x5f5b18){var _0x1e2c06={};_0x1e2c06[_0x5f5b18]={'$like':'%'+_0x4d7370[_0x6e07('0x31')]['filter']+'%'};return _0x1e2c06;})});}_0x5407cd=_[_0x6e07('0x3d')]({},_0x5407cd,_0x4d7370[_0x6e07('0x40')]);return _0x13d4e2['getFields'](_0x5407cd);}})[_0x6e07('0x27')](function(_0x48304e){if(_0x48304e){_0x34c95=_0x48304e[_0x6e07('0x46')];if(!_0x4d7370['query']['hasOwnProperty'](_0x6e07('0x37'))){_0x5407cd['limit']=qs[_0x6e07('0x38')](_0x4d7370[_0x6e07('0x31')][_0x6e07('0x38')]);_0x5407cd[_0x6e07('0x1f')]=qs[_0x6e07('0x1f')](_0x4d7370[_0x6e07('0x31')][_0x6e07('0x1f')]);}return _0x13d4e2['getFields'](_0x5407cd);}})[_0x6e07('0x27')](function(_0x1eb229){if(_0x1eb229){return _0x1eb229?{'count':_0x34c95,'rows':_0x1eb229}:null;}})[_0x6e07('0x27')](respondWithResult(_0x54f4c5,null))[_0x6e07('0x48')](handleError(_0x54f4c5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 62668f0..ee9a52b 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 _0x0bb2=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3402e0,_0x5f0a44){var _0xb43dd=function(_0x47166f){while(--_0x47166f){_0x3402e0['push'](_0x3402e0['shift']());}};_0xb43dd(++_0x5f0a44);}(_0x0bb2,0x164));var _0x20bb=function(_0x4f4e2b,_0x46ad33){_0x4f4e2b=_0x4f4e2b-0x0;var _0x1a04d3=_0x0bb2[_0x4f4e2b];return _0x1a04d3;};'use strict';var _=require(_0x20bb('0x0'));var util=require(_0x20bb('0x1'));var logger=require(_0x20bb('0x2'))(_0x20bb('0x3'));var moment=require(_0x20bb('0x4'));var BPromise=require(_0x20bb('0x5'));var rp=require(_0x20bb('0x6'));var fs=require('fs');var path=require(_0x20bb('0x7'));var rimraf=require(_0x20bb('0x8'));var config=require(_0x20bb('0x9'));var attributes=require(_0x20bb('0xa'));module[_0x20bb('0xb')]=function(_0x18272c,_0x429c42){return _0x18272c[_0x20bb('0xc')]('FreshsalesConfiguration',attributes,{'tableName':_0x20bb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e54=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6e54,0x136));var _0x46e5=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x6e54[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x46e5('0x0'));var util=require(_0x46e5('0x1'));var logger=require(_0x46e5('0x2'))(_0x46e5('0x3'));var moment=require(_0x46e5('0x4'));var BPromise=require(_0x46e5('0x5'));var rp=require(_0x46e5('0x6'));var fs=require('fs');var path=require(_0x46e5('0x7'));var rimraf=require('rimraf');var config=require(_0x46e5('0x8'));var attributes=require(_0x46e5('0x9'));module[_0x46e5('0xa')]=function(_0x4e0b2c,_0x400986){return _0x4e0b2c[_0x46e5('0xb')](_0x46e5('0xc'),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 3bcc06d..beaa82f 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 _0xf600=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf600,0x95));var _0x0f60=function(_0x531369,_0x125a41){_0x531369=_0x531369-0x0;var _0x21c642=_0xf600[_0x531369];return _0x21c642;};'use strict';var _=require(_0x0f60('0x0'));var util=require(_0x0f60('0x1'));var moment=require(_0x0f60('0x2'));var BPromise=require(_0x0f60('0x3'));var rs=require(_0x0f60('0x4'));var fs=require('fs');var Redis=require(_0x0f60('0x5'));var db=require(_0x0f60('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f60('0x7'))(_0x0f60('0x8'));var config=require(_0x0f60('0x9'));var jayson=require(_0x0f60('0xa'));var client=jayson[_0x0f60('0xb')][_0x0f60('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5aa11f,_0x260829,_0xc72687){return new BPromise(function(_0x2074b3,_0x117a1f){return client['request'](_0x5aa11f,_0xc72687)[_0x0f60('0xd')](function(_0x2fa244){logger['info'](_0x0f60('0xe'),_0x260829,_0x0f60('0xf'));logger[_0x0f60('0x10')](_0x0f60('0x11'),_0x260829,_0x0f60('0xf'),JSON[_0x0f60('0x12')](_0x2fa244));if(_0x2fa244[_0x0f60('0x13')]){if(_0x2fa244['error'][_0x0f60('0x14')]===0x1f4){logger[_0x0f60('0x13')](_0x0f60('0xe'),_0x260829,_0x2fa244['error'][_0x0f60('0x15')]);return _0x117a1f(_0x2fa244[_0x0f60('0x13')][_0x0f60('0x15')]);}logger[_0x0f60('0x13')](_0x0f60('0xe'),_0x260829,_0x2fa244[_0x0f60('0x13')]['message']);return _0x2074b3(_0x2fa244['error'][_0x0f60('0x15')]);}else{logger[_0x0f60('0x16')](_0x0f60('0xe'),_0x260829,_0x0f60('0xf'));_0x2074b3(_0x2fa244[_0x0f60('0x17')]['message']);}})[_0x0f60('0x18')](function(_0x4bcd97){logger[_0x0f60('0x13')](_0x0f60('0xe'),_0x260829,_0x4bcd97);_0x117a1f(_0x4bcd97);});});} \ No newline at end of file +var _0x41f3=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0x41f3,0x151));var _0x341f=function(_0x21e94f,_0x2ad515){_0x21e94f=_0x21e94f-0x0;var _0x303616=_0x41f3[_0x21e94f];return _0x303616;};'use strict';var _=require(_0x341f('0x0'));var util=require(_0x341f('0x1'));var moment=require(_0x341f('0x2'));var BPromise=require(_0x341f('0x3'));var rs=require(_0x341f('0x4'));var fs=require('fs');var Redis=require(_0x341f('0x5'));var db=require(_0x341f('0x6'))['db'];var utils=require(_0x341f('0x7'));var logger=require(_0x341f('0x8'))(_0x341f('0x9'));var config=require('../../config/environment');var jayson=require(_0x341f('0xa'));var client=jayson[_0x341f('0xb')][_0x341f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e2031,_0xed43f7,_0x1e052b){return new BPromise(function(_0x3773a3,_0x5aabc6){return client[_0x341f('0xd')](_0x5e2031,_0x1e052b)[_0x341f('0xe')](function(_0x263a1e){logger[_0x341f('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xed43f7,_0x341f('0x10'));logger[_0x341f('0x11')](_0x341f('0x12'),_0xed43f7,_0x341f('0x10'),JSON['stringify'](_0x263a1e));if(_0x263a1e[_0x341f('0x13')]){if(_0x263a1e[_0x341f('0x13')]['code']===0x1f4){logger[_0x341f('0x13')](_0x341f('0x14'),_0xed43f7,_0x263a1e[_0x341f('0x13')][_0x341f('0x15')]);return _0x5aabc6(_0x263a1e[_0x341f('0x13')][_0x341f('0x15')]);}logger[_0x341f('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xed43f7,_0x263a1e[_0x341f('0x13')][_0x341f('0x15')]);return _0x3773a3(_0x263a1e[_0x341f('0x13')][_0x341f('0x15')]);}else{logger['info'](_0x341f('0x14'),_0xed43f7,'request\x20sent');_0x3773a3(_0x263a1e[_0x341f('0x16')][_0x341f('0x15')]);}})['catch'](function(_0x3bd3d4){logger['error'](_0x341f('0x14'),_0xed43f7,_0x3bd3d4);_0x5aabc6(_0x3bd3d4);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 56ca030..885a222 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 _0x02ef=['../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a401d,_0x345683){var _0x27f495=function(_0x4de8ed){while(--_0x4de8ed){_0x5a401d['push'](_0x5a401d['shift']());}};_0x27f495(++_0x345683);}(_0x02ef,0x11a));var _0xf02e=function(_0x385615,_0x1e98ee){_0x385615=_0x385615-0x0;var _0x511a6b=_0x02ef[_0x385615];return _0x511a6b;};'use strict';var multer=require(_0xf02e('0x0'));var util=require('util');var path=require(_0xf02e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf02e('0x2'));var router=express[_0xf02e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf02e('0x4'));var interaction=require(_0xf02e('0x5'));var config=require(_0xf02e('0x6'));var controller=require(_0xf02e('0x7'));router[_0xf02e('0x8')]('/',auth['isAuthenticated'](),controller[_0xf02e('0x9')]);router[_0xf02e('0x8')](_0xf02e('0xa'),auth[_0xf02e('0xb')](),controller[_0xf02e('0xc')]);router[_0xf02e('0xd')]('/',auth[_0xf02e('0xb')](),controller[_0xf02e('0xe')]);router[_0xf02e('0xf')](_0xf02e('0xa'),auth[_0xf02e('0xb')](),controller[_0xf02e('0x10')]);router['delete']('/:id',auth[_0xf02e('0xb')](),controller[_0xf02e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2029=['isAuthenticated','index','show','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get'];(function(_0x1f2249,_0x1ba555){var _0x5ac00e=function(_0xb88a16){while(--_0xb88a16){_0x1f2249['push'](_0x1f2249['shift']());}};_0x5ac00e(++_0x1ba555);}(_0x2029,0x171));var _0x9202=function(_0x3d78f1,_0x5c5031){_0x3d78f1=_0x3d78f1-0x0;var _0x577949=_0x2029[_0x3d78f1];return _0x577949;};'use strict';var multer=require(_0x9202('0x0'));var util=require(_0x9202('0x1'));var path=require('path');var timeout=require(_0x9202('0x2'));var express=require(_0x9202('0x3'));var router=express[_0x9202('0x4')]();var fs_extra=require(_0x9202('0x5'));var auth=require(_0x9202('0x6'));var interaction=require(_0x9202('0x7'));var config=require(_0x9202('0x8'));var controller=require(_0x9202('0x9'));router[_0x9202('0xa')]('/',auth[_0x9202('0xb')](),controller[_0x9202('0xc')]);router[_0x9202('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9202('0xd')]);router['post']('/',auth[_0x9202('0xb')](),controller[_0x9202('0xe')]);router['put'](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x10')]);router[_0x9202('0x11')](_0x9202('0xf'),auth[_0x9202('0xb')](),controller[_0x9202('0x12')]);module[_0x9202('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index aefe252..ed2ac35 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 _0xc5c8=['sequelize','exports','string','variable','customVariable','picklist','ENUM','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5c8,0x1cb));var _0x8c5c=function(_0xca180e,_0x299152){_0xca180e=_0xca180e-0x0;var _0x491e51=_0xc5c8[_0xca180e];return _0x491e51;};'use strict';var Sequelize=require(_0x8c5c('0x0'));module[_0x8c5c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8c5c('0x2'),_0x8c5c('0x3'),_0x8c5c('0x4'),'keyValue',_0x8c5c('0x5')),'defaultValue':_0x8c5c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8c5c('0x6')](_0x8c5c('0x2'),_0x8c5c('0x3'),_0x8c5c('0x4'))},'keyContent':{'type':Sequelize[_0x8c5c('0x7')]},'idField':{'type':Sequelize[_0x8c5c('0x7')]},'nameField':{'type':Sequelize[_0x8c5c('0x7')]},'customField':{'type':Sequelize[_0x8c5c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c5c('0x7')]}}; \ No newline at end of file +var _0xb085=['picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable'];(function(_0x2d6d5e,_0x214948){var _0x5ea03d=function(_0x3a1be5){while(--_0x3a1be5){_0x2d6d5e['push'](_0x2d6d5e['shift']());}};_0x5ea03d(++_0x214948);}(_0xb085,0xac));var _0x5b08=function(_0x407ad0,_0x2ec890){_0x407ad0=_0x407ad0-0x0;var _0x384e7c=_0xb085[_0x407ad0];return _0x384e7c;};'use strict';var Sequelize=require(_0x5b08('0x0'));module['exports']={'type':{'type':Sequelize[_0x5b08('0x1')]('string',_0x5b08('0x2'),'customVariable','keyValue',_0x5b08('0x3')),'defaultValue':_0x5b08('0x4')},'content':{'type':Sequelize[_0x5b08('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5b08('0x1')](_0x5b08('0x4'),_0x5b08('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x5b08('0x5')]},'idField':{'type':Sequelize[_0x5b08('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5b08('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b08('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 23a1045..1b7c50d 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 _0xa61a=['util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','status','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','FreshsalesField','include','findAll','rows','params','fields','includeAll','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x35b4e3,_0x67ecca){var _0x50f9fd=function(_0x4fb4c5){while(--_0x4fb4c5){_0x35b4e3['push'](_0x35b4e3['shift']());}};_0x50f9fd(++_0x67ecca);}(_0xa61a,0x126));var _0xaa61=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0xa61a[_0x308374];return _0x1f71e0;};'use strict';var emlformat=require(_0xaa61('0x0'));var rimraf=require(_0xaa61('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa61('0x2'));var rp=require(_0xaa61('0x3'));var moment=require(_0xaa61('0x4'));var BPromise=require(_0xaa61('0x5'));var Mustache=require('mustache');var util=require(_0xaa61('0x6'));var path=require(_0xaa61('0x7'));var sox=require('sox');var csv=require(_0xaa61('0x8'));var ejs=require(_0xaa61('0x9'));var fs=require('fs');var fs_extra=require(_0xaa61('0xa'));var _=require(_0xaa61('0xb'));var squel=require(_0xaa61('0xc'));var crypto=require(_0xaa61('0xd'));var jsforce=require(_0xaa61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaa61('0x8'));var querystring=require(_0xaa61('0xf'));var Papa=require(_0xaa61('0x10'));var Redis=require(_0xaa61('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaa61('0x12'));var as=require(_0xaa61('0x13'));var hardwareService=require(_0xaa61('0x14'));var logger=require(_0xaa61('0x15'))(_0xaa61('0x16'));var utils=require(_0xaa61('0x17'));var config=require(_0xaa61('0x18'));var licenseUtil=require(_0xaa61('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cb337,_0x53083e){_0x53083e=_0x53083e||0xcc;return function(_0x141948){if(_0x141948){return _0x5cb337[_0xaa61('0x1a')](_0x53083e);}return _0x5cb337['status'](_0x53083e)[_0xaa61('0x1b')]();};}function respondWithResult(_0x1b2f02,_0x1bd148){_0x1bd148=_0x1bd148||0xc8;return function(_0x3ac6f8){if(_0x3ac6f8){return _0x1b2f02['status'](_0x1bd148)[_0xaa61('0x1c')](_0x3ac6f8);}};}function respondWithFilteredResult(_0x116e2d,_0xd4c977){return function(_0x606db1){if(_0x606db1){var _0x166c52=typeof _0xd4c977[_0xaa61('0x1d')]===_0xaa61('0x1e')&&typeof _0xd4c977[_0xaa61('0x1f')]===_0xaa61('0x1e');var _0x4bd0bb=_0x606db1['count'];var _0x311299=_0x166c52?0x0:_0xd4c977['offset'];var _0x270188=_0x166c52?_0x606db1[_0xaa61('0x20')]:_0xd4c977[_0xaa61('0x1d')]+_0xd4c977[_0xaa61('0x1f')];var _0x3b3eae;if(_0x270188>=_0x4bd0bb){_0x270188=_0x4bd0bb;_0x3b3eae=0xc8;}else{_0x3b3eae=0xce;}_0x116e2d['status'](_0x3b3eae);return _0x116e2d[_0xaa61('0x21')]('Content-Range',_0x311299+'-'+_0x270188+'/'+_0x4bd0bb)[_0xaa61('0x1c')](_0x606db1);}return null;};}function patchUpdates(_0x37a6d8){return function(_0x22283c){try{jsonpatch[_0xaa61('0x22')](_0x22283c,_0x37a6d8,!![]);}catch(_0x1f30cd){return BPromise[_0xaa61('0x23')](_0x1f30cd);}return _0x22283c['save']();};}function saveUpdates(_0x39cc91,_0x2264c1){return function(_0x1e1ce4){if(_0x1e1ce4){return _0x1e1ce4[_0xaa61('0x24')](_0x39cc91)[_0xaa61('0x25')](function(_0x3ddf83){return _0x3ddf83;});}return null;};}function removeEntity(_0x532b8e,_0x277b9b){return function(_0x1a447e){if(_0x1a447e){return _0x1a447e[_0xaa61('0x26')]()[_0xaa61('0x25')](function(){_0x532b8e['status'](0xcc)[_0xaa61('0x1b')]();});}};}function handleEntityNotFound(_0x572819,_0x5b5f74){return function(_0x27a17e){if(!_0x27a17e){_0x572819[_0xaa61('0x1a')](0x194);}return _0x27a17e;};}function handleError(_0x3970c7,_0x48b6f9){_0x48b6f9=_0x48b6f9||0x1f4;return function(_0x157bc5){logger[_0xaa61('0x27')](_0x157bc5[_0xaa61('0x28')]);if(_0x157bc5[_0xaa61('0x29')]){delete _0x157bc5[_0xaa61('0x29')];}_0x3970c7[_0xaa61('0x2a')](_0x48b6f9)[_0xaa61('0x2b')](_0x157bc5);};}exports[_0xaa61('0x2c')]=function(_0x24f4fe,_0x31e765){var _0x2ddc13={},_0x4854a7={},_0x27a449={'count':0x0,'rows':[]};var _0xafe68f=_[_0xaa61('0x2d')](db['FreshsalesField'][_0xaa61('0x2e')],function(_0x14a098){return{'name':_0x14a098['fieldName'],'type':_0x14a098[_0xaa61('0x2f')][_0xaa61('0x30')]};});_0x4854a7[_0xaa61('0x31')]=_['map'](_0xafe68f,_0xaa61('0x29'));_0x4854a7[_0xaa61('0x32')]=_[_0xaa61('0x33')](_0x24f4fe[_0xaa61('0x32')]);_0x4854a7[_0xaa61('0x34')]=_[_0xaa61('0x35')](_0x4854a7['model'],_0x4854a7['query']);_0x2ddc13['attributes']=_[_0xaa61('0x35')](_0x4854a7['model'],qs['fields'](_0x24f4fe[_0xaa61('0x32')]['fields']));_0x2ddc13[_0xaa61('0x36')]=_0x2ddc13[_0xaa61('0x36')][_0xaa61('0x37')]?_0x2ddc13[_0xaa61('0x36')]:_0x4854a7[_0xaa61('0x31')];if(!_0x24f4fe[_0xaa61('0x32')][_0xaa61('0x38')](_0xaa61('0x39'))){_0x2ddc13['limit']=qs[_0xaa61('0x1f')](_0x24f4fe['query'][_0xaa61('0x1f')]);_0x2ddc13[_0xaa61('0x1d')]=qs['offset'](_0x24f4fe['query'][_0xaa61('0x1d')]);}_0x2ddc13[_0xaa61('0x3a')]=qs[_0xaa61('0x3b')](_0x24f4fe[_0xaa61('0x32')][_0xaa61('0x3b')]);_0x2ddc13[_0xaa61('0x3c')]=qs[_0xaa61('0x34')](_['pick'](_0x24f4fe[_0xaa61('0x32')],_0x4854a7[_0xaa61('0x34')]),_0xafe68f);if(_0x24f4fe[_0xaa61('0x32')][_0xaa61('0x3d')]){_0x2ddc13[_0xaa61('0x3c')]=_[_0xaa61('0x3e')](_0x2ddc13[_0xaa61('0x3c')],{'$or':_[_0xaa61('0x2d')](_0xafe68f,function(_0x3f4895){if(_0x3f4895[_0xaa61('0x2f')]!==_0xaa61('0x3f')){var _0x1a7b74={};_0x1a7b74[_0x3f4895[_0xaa61('0x29')]]={'$like':'%'+_0x24f4fe[_0xaa61('0x32')][_0xaa61('0x3d')]+'%'};return _0x1a7b74;}})});}_0x2ddc13=_[_0xaa61('0x3e')]({},_0x2ddc13,_0x24f4fe['options']);var _0x43afa6={'where':_0x2ddc13[_0xaa61('0x3c')]};return db[_0xaa61('0x40')][_0xaa61('0x20')](_0x43afa6)[_0xaa61('0x25')](function(_0x4198b4){_0x27a449[_0xaa61('0x20')]=_0x4198b4;if(_0x24f4fe[_0xaa61('0x32')]['includeAll']){_0x2ddc13[_0xaa61('0x41')]=[{'all':!![]}];}return db[_0xaa61('0x40')][_0xaa61('0x42')](_0x2ddc13);})['then'](function(_0x1c7ac2){_0x27a449[_0xaa61('0x43')]=_0x1c7ac2;return _0x27a449;})[_0xaa61('0x25')](respondWithFilteredResult(_0x31e765,_0x2ddc13))['catch'](handleError(_0x31e765,null));};exports['show']=function(_0xf0e10c,_0x539c46){var _0x4b3778={'raw':!![],'where':{'id':_0xf0e10c[_0xaa61('0x44')]['id']}},_0x5589a0={};_0x5589a0[_0xaa61('0x31')]=_[_0xaa61('0x33')](db[_0xaa61('0x40')][_0xaa61('0x2e')]);_0x5589a0['query']=_[_0xaa61('0x33')](_0xf0e10c[_0xaa61('0x32')]);_0x5589a0[_0xaa61('0x34')]=_[_0xaa61('0x35')](_0x5589a0[_0xaa61('0x31')],_0x5589a0[_0xaa61('0x32')]);_0x4b3778[_0xaa61('0x36')]=_[_0xaa61('0x35')](_0x5589a0[_0xaa61('0x31')],qs[_0xaa61('0x45')](_0xf0e10c['query'][_0xaa61('0x45')]));_0x4b3778[_0xaa61('0x36')]=_0x4b3778[_0xaa61('0x36')][_0xaa61('0x37')]?_0x4b3778[_0xaa61('0x36')]:_0x5589a0[_0xaa61('0x31')];if(_0xf0e10c[_0xaa61('0x32')][_0xaa61('0x46')]){_0x4b3778[_0xaa61('0x41')]=[{'all':!![]}];}_0x4b3778=_['merge']({},_0x4b3778,_0xf0e10c['options']);return db['FreshsalesField']['find'](_0x4b3778)[_0xaa61('0x25')](handleEntityNotFound(_0x539c46,null))[_0xaa61('0x25')](respondWithResult(_0x539c46,null))[_0xaa61('0x47')](handleError(_0x539c46,null));};exports[_0xaa61('0x48')]=function(_0x4cd98f,_0x3bf79c){return db[_0xaa61('0x40')][_0xaa61('0x48')](_0x4cd98f[_0xaa61('0x49')],{})['then'](respondWithResult(_0x3bf79c,0xc9))[_0xaa61('0x47')](handleError(_0x3bf79c,null));};exports[_0xaa61('0x24')]=function(_0x455549,_0x4b4e03){if(_0x455549['body']['id']){delete _0x455549[_0xaa61('0x49')]['id'];}return db['FreshsalesField'][_0xaa61('0x4a')]({'where':{'id':_0x455549[_0xaa61('0x44')]['id']}})[_0xaa61('0x25')](handleEntityNotFound(_0x4b4e03,null))[_0xaa61('0x25')](saveUpdates(_0x455549[_0xaa61('0x49')],null))[_0xaa61('0x25')](respondWithResult(_0x4b4e03,null))[_0xaa61('0x47')](handleError(_0x4b4e03,null));};exports[_0xaa61('0x26')]=function(_0x8edd62,_0x543c77){return db[_0xaa61('0x40')][_0xaa61('0x4a')]({'where':{'id':_0x8edd62[_0xaa61('0x44')]['id']}})[_0xaa61('0x25')](handleEntityNotFound(_0x543c77,null))[_0xaa61('0x25')](removeEntity(_0x543c77,null))['catch'](handleError(_0x543c77,null));}; \ No newline at end of file +var _0x038d=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','rawAttributes','keys','find','catch','create','body','params','eml-format','rimraf','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x038d,0x158));var _0xd038=function(_0x1b431a,_0x2293f0){_0x1b431a=_0x1b431a-0x0;var _0x3c56d9=_0x038d[_0x1b431a];return _0x3c56d9;};'use strict';var emlformat=require(_0xd038('0x0'));var rimraf=require(_0xd038('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd038('0x2'));var moment=require('moment');var BPromise=require(_0xd038('0x3'));var Mustache=require('mustache');var util=require(_0xd038('0x4'));var path=require(_0xd038('0x5'));var sox=require('sox');var csv=require(_0xd038('0x6'));var ejs=require(_0xd038('0x7'));var fs=require('fs');var fs_extra=require(_0xd038('0x8'));var _=require(_0xd038('0x9'));var squel=require('squel');var crypto=require(_0xd038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd038('0x6'));var querystring=require(_0xd038('0xb'));var Papa=require('papaparse');var Redis=require(_0xd038('0xc'));var authService=require(_0xd038('0xd'));var qs=require(_0xd038('0xe'));var as=require(_0xd038('0xf'));var hardwareService=require(_0xd038('0x10'));var logger=require('../../config/logger')(_0xd038('0x11'));var utils=require(_0xd038('0x12'));var config=require(_0xd038('0x13'));var licenseUtil=require(_0xd038('0x14'));var db=require(_0xd038('0x15'))['db'];function respondWithStatusCode(_0x4822f1,_0x593b59){_0x593b59=_0x593b59||0xcc;return function(_0xfb24c7){if(_0xfb24c7){return _0x4822f1[_0xd038('0x16')](_0x593b59);}return _0x4822f1[_0xd038('0x17')](_0x593b59)['end']();};}function respondWithResult(_0x4772d3,_0x3939fd){_0x3939fd=_0x3939fd||0xc8;return function(_0x8f24aa){if(_0x8f24aa){return _0x4772d3[_0xd038('0x17')](_0x3939fd)[_0xd038('0x18')](_0x8f24aa);}};}function respondWithFilteredResult(_0x20be9b,_0x26ed56){return function(_0x9d93c1){if(_0x9d93c1){var _0x322dd8=typeof _0x26ed56[_0xd038('0x19')]==='undefined'&&typeof _0x26ed56[_0xd038('0x1a')]==='undefined';var _0x56f93c=_0x9d93c1[_0xd038('0x1b')];var _0x3466fc=_0x322dd8?0x0:_0x26ed56[_0xd038('0x19')];var _0x5e7881=_0x322dd8?_0x9d93c1[_0xd038('0x1b')]:_0x26ed56[_0xd038('0x19')]+_0x26ed56[_0xd038('0x1a')];var _0x3e0878;if(_0x5e7881>=_0x56f93c){_0x5e7881=_0x56f93c;_0x3e0878=0xc8;}else{_0x3e0878=0xce;}_0x20be9b['status'](_0x3e0878);return _0x20be9b['set'](_0xd038('0x1c'),_0x3466fc+'-'+_0x5e7881+'/'+_0x56f93c)['json'](_0x9d93c1);}return null;};}function patchUpdates(_0xbbabb0){return function(_0x3f7c6c){try{jsonpatch[_0xd038('0x1d')](_0x3f7c6c,_0xbbabb0,!![]);}catch(_0x463be0){return BPromise[_0xd038('0x1e')](_0x463be0);}return _0x3f7c6c[_0xd038('0x1f')]();};}function saveUpdates(_0x306568,_0x43a6a8){return function(_0x3a156a){if(_0x3a156a){return _0x3a156a[_0xd038('0x20')](_0x306568)[_0xd038('0x21')](function(_0x375c0b){return _0x375c0b;});}return null;};}function removeEntity(_0x4c09d8,_0x5eed64){return function(_0x50644e){if(_0x50644e){return _0x50644e[_0xd038('0x22')]()[_0xd038('0x21')](function(){_0x4c09d8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f728,_0x487366){return function(_0xeca00f){if(!_0xeca00f){_0x55f728['sendStatus'](0x194);}return _0xeca00f;};}function handleError(_0x45ce18,_0x1fee60){_0x1fee60=_0x1fee60||0x1f4;return function(_0x58bfbf){logger[_0xd038('0x23')](_0x58bfbf[_0xd038('0x24')]);if(_0x58bfbf[_0xd038('0x25')]){delete _0x58bfbf['name'];}_0x45ce18[_0xd038('0x17')](_0x1fee60)[_0xd038('0x26')](_0x58bfbf);};}exports[_0xd038('0x27')]=function(_0x293320,_0x378be4){var _0x1917f4={},_0x43c525={},_0x5b8831={'count':0x0,'rows':[]};var _0x3cb6c3=_[_0xd038('0x28')](db[_0xd038('0x29')]['rawAttributes'],function(_0x5c60c9){return{'name':_0x5c60c9[_0xd038('0x2a')],'type':_0x5c60c9[_0xd038('0x2b')][_0xd038('0x2c')]};});_0x43c525[_0xd038('0x2d')]=_[_0xd038('0x28')](_0x3cb6c3,_0xd038('0x25'));_0x43c525[_0xd038('0x2e')]=_['keys'](_0x293320[_0xd038('0x2e')]);_0x43c525[_0xd038('0x2f')]=_[_0xd038('0x30')](_0x43c525[_0xd038('0x2d')],_0x43c525[_0xd038('0x2e')]);_0x1917f4['attributes']=_[_0xd038('0x30')](_0x43c525[_0xd038('0x2d')],qs[_0xd038('0x31')](_0x293320['query'][_0xd038('0x31')]));_0x1917f4[_0xd038('0x32')]=_0x1917f4[_0xd038('0x32')][_0xd038('0x33')]?_0x1917f4[_0xd038('0x32')]:_0x43c525['model'];if(!_0x293320[_0xd038('0x2e')][_0xd038('0x34')](_0xd038('0x35'))){_0x1917f4['limit']=qs[_0xd038('0x1a')](_0x293320[_0xd038('0x2e')]['limit']);_0x1917f4[_0xd038('0x19')]=qs[_0xd038('0x19')](_0x293320['query']['offset']);}_0x1917f4[_0xd038('0x36')]=qs[_0xd038('0x37')](_0x293320[_0xd038('0x2e')][_0xd038('0x37')]);_0x1917f4[_0xd038('0x38')]=qs[_0xd038('0x2f')](_[_0xd038('0x39')](_0x293320[_0xd038('0x2e')],_0x43c525['filters']),_0x3cb6c3);if(_0x293320[_0xd038('0x2e')][_0xd038('0x3a')]){_0x1917f4[_0xd038('0x38')]=_[_0xd038('0x3b')](_0x1917f4['where'],{'$or':_[_0xd038('0x28')](_0x3cb6c3,function(_0x46d131){if(_0x46d131[_0xd038('0x2b')]!==_0xd038('0x3c')){var _0x322a8f={};_0x322a8f[_0x46d131[_0xd038('0x25')]]={'$like':'%'+_0x293320['query'][_0xd038('0x3a')]+'%'};return _0x322a8f;}})});}_0x1917f4=_['merge']({},_0x1917f4,_0x293320[_0xd038('0x3d')]);var _0x1d8a67={'where':_0x1917f4[_0xd038('0x38')]};return db[_0xd038('0x29')]['count'](_0x1d8a67)[_0xd038('0x21')](function(_0x2e79d4){_0x5b8831[_0xd038('0x1b')]=_0x2e79d4;if(_0x293320['query'][_0xd038('0x3e')]){_0x1917f4[_0xd038('0x3f')]=[{'all':!![]}];}return db[_0xd038('0x29')]['findAll'](_0x1917f4);})[_0xd038('0x21')](function(_0x44fb91){_0x5b8831['rows']=_0x44fb91;return _0x5b8831;})[_0xd038('0x21')](respondWithFilteredResult(_0x378be4,_0x1917f4))['catch'](handleError(_0x378be4,null));};exports[_0xd038('0x40')]=function(_0x3d7bfe,_0x460963){var _0x4fa9b9={'raw':!![],'where':{'id':_0x3d7bfe['params']['id']}},_0x3b53d6={};_0x3b53d6[_0xd038('0x2d')]=_['keys'](db['FreshsalesField'][_0xd038('0x41')]);_0x3b53d6[_0xd038('0x2e')]=_[_0xd038('0x42')](_0x3d7bfe[_0xd038('0x2e')]);_0x3b53d6[_0xd038('0x2f')]=_[_0xd038('0x30')](_0x3b53d6[_0xd038('0x2d')],_0x3b53d6[_0xd038('0x2e')]);_0x4fa9b9[_0xd038('0x32')]=_[_0xd038('0x30')](_0x3b53d6[_0xd038('0x2d')],qs['fields'](_0x3d7bfe[_0xd038('0x2e')][_0xd038('0x31')]));_0x4fa9b9[_0xd038('0x32')]=_0x4fa9b9['attributes'][_0xd038('0x33')]?_0x4fa9b9[_0xd038('0x32')]:_0x3b53d6[_0xd038('0x2d')];if(_0x3d7bfe[_0xd038('0x2e')][_0xd038('0x3e')]){_0x4fa9b9[_0xd038('0x3f')]=[{'all':!![]}];}_0x4fa9b9=_[_0xd038('0x3b')]({},_0x4fa9b9,_0x3d7bfe[_0xd038('0x3d')]);return db['FreshsalesField'][_0xd038('0x43')](_0x4fa9b9)['then'](handleEntityNotFound(_0x460963,null))[_0xd038('0x21')](respondWithResult(_0x460963,null))[_0xd038('0x44')](handleError(_0x460963,null));};exports[_0xd038('0x45')]=function(_0x5aab1e,_0x13473c){return db[_0xd038('0x29')][_0xd038('0x45')](_0x5aab1e[_0xd038('0x46')],{})[_0xd038('0x21')](respondWithResult(_0x13473c,0xc9))[_0xd038('0x44')](handleError(_0x13473c,null));};exports[_0xd038('0x20')]=function(_0x27c506,_0x54f534){if(_0x27c506[_0xd038('0x46')]['id']){delete _0x27c506[_0xd038('0x46')]['id'];}return db[_0xd038('0x29')]['find']({'where':{'id':_0x27c506['params']['id']}})[_0xd038('0x21')](handleEntityNotFound(_0x54f534,null))[_0xd038('0x21')](saveUpdates(_0x27c506['body'],null))['then'](respondWithResult(_0x54f534,null))[_0xd038('0x44')](handleError(_0x54f534,null));};exports[_0xd038('0x22')]=function(_0x40de76,_0x3b4a85){return db[_0xd038('0x29')]['find']({'where':{'id':_0x40de76[_0xd038('0x47')]['id']}})[_0xd038('0x21')](handleEntityNotFound(_0x3b4a85,null))[_0xd038('0x21')](removeEntity(_0x3b4a85,null))[_0xd038('0x44')](handleError(_0x3b4a85,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 201ad30..2060924 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 _0x5276=['exports','define','int_freshsales_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x5276,0x163));var _0x6527=function(_0x45609e,_0x4a0dac){_0x45609e=_0x45609e-0x0;var _0x11fe1c=_0x5276[_0x45609e];return _0x11fe1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6527('0x0'))(_0x6527('0x1'));var moment=require(_0x6527('0x2'));var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require(_0x6527('0x5'));var rimraf=require(_0x6527('0x6'));var config=require(_0x6527('0x7'));var attributes=require(_0x6527('0x8'));module[_0x6527('0x9')]=function(_0x3deb56,_0x9d7ba2){return _0x3deb56[_0x6527('0xa')]('FreshsalesField',attributes,{'tableName':_0x6527('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x6527('0xc'),_0x6527('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe820=['exports','define','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x57eac3,_0x2e1e30){var _0x4d5418=function(_0x1dd36c){while(--_0x1dd36c){_0x57eac3['push'](_0x57eac3['shift']());}};_0x4d5418(++_0x2e1e30);}(_0xe820,0xd2));var _0x0e82=function(_0x22ede7,_0x4b48fa){_0x22ede7=_0x22ede7-0x0;var _0x2b3c2c=_0xe820[_0x22ede7];return _0x2b3c2c;};'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('./intFreshsalesField.attributes');module[_0x0e82('0x6')]=function(_0x105e3c,_0x69e27f){return _0x105e3c[_0x0e82('0x7')](_0x0e82('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x0e82('0x9'),'fields':[_0x0e82('0xa'),_0x0e82('0xb')],'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 55acf97..8d9c938 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 _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4b72c2,_0x3b31a2){var _0x1db5ef=function(_0x416e8){while(--_0x416e8){_0x4b72c2['push'](_0x4b72c2['shift']());}};_0x1db5ef(++_0x3b31a2);}(_0x187d,0x93));var _0xd187=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x187d[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file +var _0x1623=['../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4e6872,_0x27bf27){var _0x581a8a=function(_0xb27bc){while(--_0xb27bc){_0x4e6872['push'](_0x4e6872['shift']());}};_0x581a8a(++_0x27bf27);}(_0x1623,0xab));var _0x3162=function(_0x3b81b0,_0x3a0670){_0x3b81b0=_0x3b81b0-0x0;var _0x2efa6b=_0x1623[_0x3b81b0];return _0x2efa6b;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesField,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 0f4a112..08e257b 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x454e70,_0x42e6d1){var _0x468ee7=function(_0x42c68f){while(--_0x42c68f){_0x454e70['push'](_0x454e70['shift']());}};_0x468ee7(++_0x42e6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5839d0,_0x5641f2){var _0x5c5815=function(_0xa3827a){while(--_0xa3827a){_0x5839d0['push'](_0x5839d0['shift']());}};_0x5c5815(++_0x5641f2);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index fc1de8b..2400c46 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 _0x86dc=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x124c16,_0x47bf3f){var _0x494926=function(_0x14cbe4){while(--_0x14cbe4){_0x124c16['push'](_0x124c16['shift']());}};_0x494926(++_0x47bf3f);}(_0x86dc,0x13e));var _0xc86d=function(_0x45b36c,_0x7d5d2){_0x45b36c=_0x45b36c-0x0;var _0x3ab416=_0x86dc[_0x45b36c];return _0x3ab416;};'use strict';var Sequelize=require(_0xc86d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc86d('0x1')]},'username':{'type':Sequelize[_0xc86d('0x1')],'unique':_0xc86d('0x2')},'remoteUri':{'type':Sequelize[_0xc86d('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc86d('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xc86d('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc86d('0x3')](_0xc86d('0x4'),_0xc86d('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa6ce=['integrationTab','newTab','sequelize','STRING','username','ENUM'];(function(_0x4723e7,_0x21ad0c){var _0x408562=function(_0x477b6a){while(--_0x477b6a){_0x4723e7['push'](_0x4723e7['shift']());}};_0x408562(++_0x21ad0c);}(_0xa6ce,0x15e));var _0xea6c=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0xa6ce[_0x53fe97];return _0x5c49a2;};'use strict';var Sequelize=require(_0xea6c('0x0'));module['exports']={'name':{'type':Sequelize[_0xea6c('0x1')]},'description':{'type':Sequelize[_0xea6c('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xea6c('0x2')},'remoteUri':{'type':Sequelize[_0xea6c('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xea6c('0x1')]},'securityToken':{'type':Sequelize[_0xea6c('0x1')]},'serverUrl':{'type':Sequelize[_0xea6c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xea6c('0x3')](_0xea6c('0x4'),_0xea6c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3b4b836..b057925 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 _0xc95c=['boolean','textarea','phone','remove','includes','label','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','create','SalesforceField','Task','clientId','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','clientSecret','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xc95c,0x18d));var _0xcc95=function(_0x166baf,_0xa98681){_0x166baf=_0x166baf-0x0;var _0x15ade0=_0xc95c[_0x166baf];return _0x15ade0;};'use strict';var emlformat=require(_0xcc95('0x0'));var rimraf=require(_0xcc95('0x1'));var zipdir=require(_0xcc95('0x2'));var jsonpatch=require(_0xcc95('0x3'));var rp=require(_0xcc95('0x4'));var moment=require('moment');var BPromise=require(_0xcc95('0x5'));var Mustache=require('mustache');var util=require(_0xcc95('0x6'));var path=require(_0xcc95('0x7'));var sox=require(_0xcc95('0x8'));var csv=require(_0xcc95('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc95('0xa'));var _=require(_0xcc95('0xb'));var squel=require(_0xcc95('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc95('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcc95('0xe'));var Papa=require(_0xcc95('0xf'));var Redis=require(_0xcc95('0x10'));var authService=require(_0xcc95('0x11'));var qs=require(_0xcc95('0x12'));var as=require(_0xcc95('0x13'));var hardwareService=require(_0xcc95('0x14'));var logger=require('../../config/logger')(_0xcc95('0x15'));var utils=require(_0xcc95('0x16'));var config=require(_0xcc95('0x17'));var licenseUtil=require(_0xcc95('0x18'));var db=require(_0xcc95('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x51fcc7,_0x4ac052){_0x4ac052=_0x4ac052||0xcc;return function(_0x2e87a5){if(_0x2e87a5){return _0x51fcc7[_0xcc95('0x1a')](_0x4ac052);}return _0x51fcc7[_0xcc95('0x1b')](_0x4ac052)[_0xcc95('0x1c')]();};}function respondWithResult(_0x2c6157,_0x212177){_0x212177=_0x212177||0xc8;return function(_0x2dc63d){if(_0x2dc63d){return _0x2c6157['status'](_0x212177)[_0xcc95('0x1d')](_0x2dc63d);}};}function respondWithFilteredResult(_0x5eee08,_0x2fb561){return function(_0x3a6c5a){if(_0x3a6c5a){var _0x5130f4=typeof _0x2fb561[_0xcc95('0x1e')]==='undefined'&&typeof _0x2fb561[_0xcc95('0x1f')]===_0xcc95('0x20');var _0x43c17f=_0x3a6c5a[_0xcc95('0x21')];var _0x22ace1=_0x5130f4?0x0:_0x2fb561[_0xcc95('0x1e')];var _0x2ed753=_0x5130f4?_0x3a6c5a['count']:_0x2fb561[_0xcc95('0x1e')]+_0x2fb561[_0xcc95('0x1f')];var _0x3eb233;if(_0x2ed753>=_0x43c17f){_0x2ed753=_0x43c17f;_0x3eb233=0xc8;}else{_0x3eb233=0xce;}_0x5eee08[_0xcc95('0x1b')](_0x3eb233);return _0x5eee08[_0xcc95('0x22')](_0xcc95('0x23'),_0x22ace1+'-'+_0x2ed753+'/'+_0x43c17f)[_0xcc95('0x1d')](_0x3a6c5a);}return null;};}function patchUpdates(_0x4f3718){return function(_0x5b72d4){try{jsonpatch['apply'](_0x5b72d4,_0x4f3718,!![]);}catch(_0x1c1362){return BPromise[_0xcc95('0x24')](_0x1c1362);}return _0x5b72d4[_0xcc95('0x25')]();};}function saveUpdates(_0x2e91ee,_0x3b740e){return function(_0x25c99d){if(_0x25c99d){return _0x25c99d[_0xcc95('0x26')](_0x2e91ee)[_0xcc95('0x27')](function(_0x55ca03){return _0x55ca03;});}return null;};}function removeEntity(_0x30ff77,_0x37dbde){return function(_0x5662af){if(_0x5662af){return _0x5662af[_0xcc95('0x28')]()[_0xcc95('0x27')](function(){_0x30ff77['status'](0xcc)[_0xcc95('0x1c')]();});}};}function handleEntityNotFound(_0x538abd,_0x220073){return function(_0x3e4d1f){if(!_0x3e4d1f){_0x538abd[_0xcc95('0x1a')](0x194);}return _0x3e4d1f;};}function handleError(_0x53240f,_0x3609bf){_0x3609bf=_0x3609bf||0x1f4;return function(_0x2d7f5c){logger[_0xcc95('0x29')](_0x2d7f5c['stack']);if(_0x2d7f5c[_0xcc95('0x2a')]){delete _0x2d7f5c['name'];}_0x53240f[_0xcc95('0x1b')](_0x3609bf)['send'](_0x2d7f5c);};}exports[_0xcc95('0x2b')]=function(_0x4fb26b,_0x51c43f){var _0x610d30={},_0x20a33e={},_0x58b53f={'count':0x0,'rows':[]};var _0x32fa47=_[_0xcc95('0x2c')](db[_0xcc95('0x2d')][_0xcc95('0x2e')],function(_0x51c3ec){return{'name':_0x51c3ec[_0xcc95('0x2f')],'type':_0x51c3ec[_0xcc95('0x30')][_0xcc95('0x31')]};});_0x20a33e[_0xcc95('0x32')]=_[_0xcc95('0x2c')](_0x32fa47,_0xcc95('0x2a'));_0x20a33e[_0xcc95('0x33')]=_['keys'](_0x4fb26b[_0xcc95('0x33')]);_0x20a33e['filters']=_[_0xcc95('0x34')](_0x20a33e[_0xcc95('0x32')],_0x20a33e[_0xcc95('0x33')]);_0x610d30[_0xcc95('0x35')]=_[_0xcc95('0x34')](_0x20a33e[_0xcc95('0x32')],qs['fields'](_0x4fb26b[_0xcc95('0x33')][_0xcc95('0x36')]));_0x610d30[_0xcc95('0x35')]=_0x610d30[_0xcc95('0x35')]['length']?_0x610d30[_0xcc95('0x35')]:_0x20a33e[_0xcc95('0x32')];if(!_0x4fb26b[_0xcc95('0x33')]['hasOwnProperty'](_0xcc95('0x37'))){_0x610d30[_0xcc95('0x1f')]=qs[_0xcc95('0x1f')](_0x4fb26b['query'][_0xcc95('0x1f')]);_0x610d30[_0xcc95('0x1e')]=qs[_0xcc95('0x1e')](_0x4fb26b[_0xcc95('0x33')]['offset']);}_0x610d30[_0xcc95('0x38')]=qs[_0xcc95('0x39')](_0x4fb26b['query'][_0xcc95('0x39')]);_0x610d30['where']=qs['filters'](_[_0xcc95('0x3a')](_0x4fb26b[_0xcc95('0x33')],_0x20a33e[_0xcc95('0x3b')]),_0x32fa47);if(_0x4fb26b[_0xcc95('0x33')][_0xcc95('0x3c')]){_0x610d30[_0xcc95('0x3d')]=_[_0xcc95('0x3e')](_0x610d30[_0xcc95('0x3d')],{'$or':_[_0xcc95('0x2c')](_0x32fa47,function(_0x589027){if(_0x589027['type']!=='VIRTUAL'){var _0x2812e1={};_0x2812e1[_0x589027[_0xcc95('0x2a')]]={'$like':'%'+_0x4fb26b[_0xcc95('0x33')][_0xcc95('0x3c')]+'%'};return _0x2812e1;}})});}_0x610d30=_[_0xcc95('0x3e')]({},_0x610d30,_0x4fb26b[_0xcc95('0x3f')]);var _0xaf202={'where':_0x610d30[_0xcc95('0x3d')]};return db['SalesforceAccount'][_0xcc95('0x21')](_0xaf202)[_0xcc95('0x27')](function(_0x1106f3){_0x58b53f[_0xcc95('0x21')]=_0x1106f3;if(_0x4fb26b[_0xcc95('0x33')][_0xcc95('0x40')]){_0x610d30[_0xcc95('0x41')]=[{'all':!![]}];}return db[_0xcc95('0x2d')][_0xcc95('0x42')](_0x610d30);})[_0xcc95('0x27')](function(_0x20c025){_0x58b53f[_0xcc95('0x43')]=_0x20c025;return _0x58b53f;})['then'](respondWithFilteredResult(_0x51c43f,_0x610d30))[_0xcc95('0x44')](handleError(_0x51c43f,null));};exports[_0xcc95('0x45')]=function(_0x108903,_0x3de25){var _0x15af30={'raw':![],'where':{'id':_0x108903[_0xcc95('0x46')]['id']}},_0x5c8fb7={};_0x5c8fb7[_0xcc95('0x32')]=_[_0xcc95('0x47')](db['SalesforceAccount'][_0xcc95('0x2e')]);_0x5c8fb7[_0xcc95('0x33')]=_['keys'](_0x108903[_0xcc95('0x33')]);_0x5c8fb7[_0xcc95('0x3b')]=_['intersection'](_0x5c8fb7['model'],_0x5c8fb7[_0xcc95('0x33')]);_0x15af30['attributes']=_[_0xcc95('0x34')](_0x5c8fb7[_0xcc95('0x32')],qs[_0xcc95('0x36')](_0x108903['query']['fields']));_0x15af30[_0xcc95('0x35')]=_0x15af30[_0xcc95('0x35')][_0xcc95('0x48')]?_0x15af30[_0xcc95('0x35')]:_0x5c8fb7[_0xcc95('0x32')];if(_0x108903[_0xcc95('0x33')][_0xcc95('0x40')]){_0x15af30[_0xcc95('0x41')]=[{'all':!![]}];}_0x15af30=_['merge']({},_0x15af30,_0x108903[_0xcc95('0x3f')]);return db[_0xcc95('0x2d')][_0xcc95('0x49')](_0x15af30)[_0xcc95('0x27')](handleEntityNotFound(_0x3de25,null))['then'](respondWithResult(_0x3de25,null))[_0xcc95('0x44')](handleError(_0x3de25,null));};exports['create']=function(_0x460bd0,_0x1b5b5b){return db[_0xcc95('0x2d')]['create'](_0x460bd0[_0xcc95('0x4a')],{})[_0xcc95('0x27')](respondWithResult(_0x1b5b5b,0xc9))[_0xcc95('0x44')](handleError(_0x1b5b5b,null));};exports[_0xcc95('0x26')]=function(_0x30e553,_0x59c7e6){if(_0x30e553['body']['id']){delete _0x30e553[_0xcc95('0x4a')]['id'];}return db[_0xcc95('0x2d')][_0xcc95('0x49')]({'where':{'id':_0x30e553[_0xcc95('0x46')]['id']}})[_0xcc95('0x27')](handleEntityNotFound(_0x59c7e6,null))[_0xcc95('0x27')](saveUpdates(_0x30e553[_0xcc95('0x4a')],null))[_0xcc95('0x27')](respondWithResult(_0x59c7e6,null))['catch'](handleError(_0x59c7e6,null));};exports['destroy']=function(_0x393e03,_0x1b6989){return db[_0xcc95('0x2d')][_0xcc95('0x49')]({'where':{'id':_0x393e03[_0xcc95('0x46')]['id']}})[_0xcc95('0x27')](handleEntityNotFound(_0x1b6989,null))['then'](removeEntity(_0x1b6989,null))[_0xcc95('0x44')](handleError(_0x1b6989,null));};exports['getConfigurations']=function(_0x5942ec,_0x384017,_0x206892){var _0x5de7c9={};var _0x3b48f7={};var _0x35df8e;var _0xbb4b44;return db[_0xcc95('0x2d')][_0xcc95('0x4b')]({'where':{'id':_0x5942ec['params']['id']}})['then'](handleEntityNotFound(_0x384017,null))[_0xcc95('0x27')](function(_0x204405){if(_0x204405){_0x35df8e=_0x204405;_0x3b48f7['model']=_[_0xcc95('0x47')](db[_0xcc95('0x4c')][_0xcc95('0x2e')]);_0x3b48f7[_0xcc95('0x33')]=_[_0xcc95('0x47')](_0x5942ec[_0xcc95('0x33')]);_0x3b48f7[_0xcc95('0x3b')]=_['intersection'](_0x3b48f7[_0xcc95('0x32')],_0x3b48f7['query']);_0x5de7c9[_0xcc95('0x35')]=_[_0xcc95('0x34')](_0x3b48f7[_0xcc95('0x32')],qs[_0xcc95('0x36')](_0x5942ec[_0xcc95('0x33')]['fields']));_0x5de7c9[_0xcc95('0x35')]=_0x5de7c9[_0xcc95('0x35')][_0xcc95('0x48')]?_0x5de7c9[_0xcc95('0x35')]:_0x3b48f7[_0xcc95('0x32')];_0x5de7c9[_0xcc95('0x38')]=qs['sort'](_0x5942ec[_0xcc95('0x33')][_0xcc95('0x39')]);_0x5de7c9[_0xcc95('0x3d')]=qs['filters'](_[_0xcc95('0x3a')](_0x5942ec[_0xcc95('0x33')],_0x3b48f7[_0xcc95('0x3b')]));if(_0x5942ec[_0xcc95('0x33')][_0xcc95('0x3c')]){_0x5de7c9[_0xcc95('0x3d')]=_[_0xcc95('0x3e')](_0x5de7c9['where'],{'$or':_[_0xcc95('0x2c')](_0x5de7c9[_0xcc95('0x35')],function(_0x47e2ad){var _0x59f0f2={};_0x59f0f2[_0x47e2ad]={'$like':'%'+_0x5942ec['query'][_0xcc95('0x3c')]+'%'};return _0x59f0f2;})});}_0x5de7c9=_[_0xcc95('0x3e')]({},_0x5de7c9,_0x5942ec[_0xcc95('0x3f')]);return _0x35df8e[_0xcc95('0x4d')](_0x5de7c9);}})['then'](function(_0x4787ff){if(_0x4787ff){_0xbb4b44=_0x4787ff[_0xcc95('0x48')];if(!_0x5942ec['query']['hasOwnProperty'](_0xcc95('0x37'))){_0x5de7c9[_0xcc95('0x1f')]=qs['limit'](_0x5942ec['query']['limit']);_0x5de7c9[_0xcc95('0x1e')]=qs['offset'](_0x5942ec[_0xcc95('0x33')]['offset']);}return _0x35df8e[_0xcc95('0x4d')](_0x5de7c9);}})[_0xcc95('0x27')](function(_0x1bd78e){if(_0x1bd78e){return _0x1bd78e?{'count':_0xbb4b44,'rows':_0x1bd78e}:null;}})[_0xcc95('0x27')](respondWithResult(_0x384017,null))[_0xcc95('0x44')](handleError(_0x384017,null));};exports[_0xcc95('0x4e')]=function(_0x410133,_0x4ad5ce,_0x4d35ff){if(_0x410133[_0xcc95('0x4a')]['id']){delete _0x410133[_0xcc95('0x4a')]['id'];}return db['SalesforceAccount'][_0xcc95('0x4b')]({'where':{'id':_0x410133[_0xcc95('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ad5ce,null))[_0xcc95('0x27')](function(_0x312cab){if(_0x312cab){_0x410133[_0xcc95('0x4a')][_0xcc95('0x4f')]=_0x312cab['id'];_0x410133[_0xcc95('0x4a')][_0xcc95('0x50')]=integrations['getSubjects'](_0x410133[_0xcc95('0x4a')][_0xcc95('0x51')],_0x410133[_0xcc95('0x4a')]['type']);_0x410133[_0xcc95('0x4a')][_0xcc95('0x52')]=integrations[_0xcc95('0x53')](_0x410133['body'][_0xcc95('0x51')],_0x410133['body']['type']);return db['SalesforceConfiguration'][_0xcc95('0x54')](_0x410133[_0xcc95('0x4a')],{'include':[{'model':db[_0xcc95('0x55')],'as':_0xcc95('0x50')},{'model':db['SalesforceField'],'as':_0xcc95('0x52')}]});}return null;})['then'](respondWithResult(_0x4ad5ce,null))[_0xcc95('0x44')](handleError(_0x4ad5ce,null));};exports['getFields']=function(_0x129e76,_0x2e7660,_0x34dd45){var _0x2e76d3;var _0x30ca3f='';var _0x2e8b21=_0xcc95('0x56');return db[_0xcc95('0x2d')]['findOne']({'where':{'id':_0x129e76['params']['id']},'attributes':['id','remoteUri',_0xcc95('0x57'),'clientSecret',_0xcc95('0x58'),_0xcc95('0x59'),_0xcc95('0x5a')]})[_0xcc95('0x27')](handleEntityNotFound(_0x2e7660,null))[_0xcc95('0x27')](function(_0x11cce8){if(_0x11cce8){_0x30ca3f=_0x11cce8[_0xcc95('0x5b')];var _0x5a65d5=_0x30ca3f[_0xcc95('0x5c')](-0x1);if(_0x5a65d5==='/'){_0x30ca3f=_0x30ca3f[_0xcc95('0x5d')](0x0,_0x30ca3f[_0xcc95('0x5e')](_0x5a65d5));}_0x2e76d3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x30ca3f,'clientId':_0x11cce8[_0xcc95('0x57')],'clientSecret':_0x11cce8[_0xcc95('0x5f')]}});return _0x2e76d3[_0xcc95('0x60')](_0x11cce8[_0xcc95('0x58')],_0x11cce8[_0xcc95('0x59')][_0xcc95('0x61')](_0x11cce8[_0xcc95('0x5a')]));}})[_0xcc95('0x27')](function(_0x58aabb){if(_0x58aabb){if(!_[_0xcc95('0x62')](_0x129e76[_0xcc95('0x33')][_0xcc95('0x63')])){_0x2e8b21=_0x129e76[_0xcc95('0x33')][_0xcc95('0x63')];}return _0x2e76d3[_0xcc95('0x64')](_0x2e8b21)['describe']();}})[_0xcc95('0x27')](function(_0x1efeca){var _0x49ac68=[_0xcc95('0x65'),_0xcc95('0x66'),_0xcc95('0x67'),_0xcc95('0x68'),_0xcc95('0x69'),'Description'];var _0x51e829=[_0xcc95('0x6a'),'int','picklist',_0xcc95('0x6b'),'email',_0xcc95('0x6c'),_0xcc95('0x6d')];if(_0x1efeca){_[_0xcc95('0x6e')](_0x1efeca[_0xcc95('0x36')],function(_0x49ebd4){return _0x49ac68[_0xcc95('0x6f')](_0x49ebd4[_0xcc95('0x2a')])||!_0x51e829[_0xcc95('0x6f')](_0x49ebd4[_0xcc95('0x30')]);});return{'count':_0x1efeca['fields'][_0xcc95('0x48')],'rows':_[_0xcc95('0x2c')](_0x1efeca[_0xcc95('0x36')],function(_0x2c0c70){return{'id':_0x2c0c70[_0xcc95('0x2a')],'name':_0x2c0c70[_0xcc95('0x70')],'custom':_0x2c0c70['custom'],'options':_0x2c0c70[_0xcc95('0x71')][_0xcc95('0x48')]>0x0?_[_0xcc95('0x2c')](_0x2c0c70[_0xcc95('0x71')],function(_0x3e3fc0){return{'name':_0x3e3fc0[_0xcc95('0x70')],'value':_0x3e3fc0[_0xcc95('0x72')]};}):_0x2c0c70[_0xcc95('0x30')]=='boolean'?[{'name':_0xcc95('0x73'),'value':_0xcc95('0x74')},{'name':_0xcc95('0x75'),'value':_0xcc95('0x76')}]:[]};})};}})[_0xcc95('0x27')](respondWithResult(_0x2e7660,null))['catch'](function(_0x3ede0b){var _0x26d6fa=_0x129e76['query'][_0xcc95('0x77')]?0x1f4:_0x3ede0b[_0xcc95('0x78')]||0x1f4;logger[_0xcc95('0x29')](_0xcc95('0x79'),_0xcc95('0x7a'),_0x26d6fa,JSON[_0xcc95('0x7b')](_0x3ede0b));delete _0x3ede0b[_0xcc95('0x2a')];if(_0x26d6fa===0x191){_0x26d6fa=0x190;}_0x2e7660[_0xcc95('0x1b')](_0x26d6fa)[_0xcc95('0x7c')](_0x129e76[_0xcc95('0x33')]['test']?{'message':_0xcc95('0x7d'),'statusCode':_0x3ede0b[_0xcc95('0x78')]}:_0x3ede0b);});}; \ No newline at end of file +var _0x491d=['clientSecret','username','Connection','login','password','securityToken','isNil','ticketType','sobject','ActivityDate','IsRecurrence','Subject','Description','string','int','email','textarea','phone','remove','includes','custom','picklistValues','label','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','SalesforceAccount','catch','params','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','Subjects','getSubjects','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId'];(function(_0x5b8861,_0x5d74a9){var _0x3dab3e=function(_0x3e7798){while(--_0x3e7798){_0x5b8861['push'](_0x5b8861['shift']());}};_0x3dab3e(++_0x5d74a9);}(_0x491d,0x10e));var _0xd491=function(_0x4dbf63,_0xd10956){_0x4dbf63=_0x4dbf63-0x0;var _0x4feb18=_0x491d[_0x4dbf63];return _0x4feb18;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd491('0x0'));var jsonpatch=require(_0xd491('0x1'));var rp=require(_0xd491('0x2'));var moment=require('moment');var BPromise=require(_0xd491('0x3'));var Mustache=require(_0xd491('0x4'));var util=require(_0xd491('0x5'));var path=require(_0xd491('0x6'));var sox=require(_0xd491('0x7'));var csv=require(_0xd491('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd491('0x9'));var squel=require('squel');var crypto=require(_0xd491('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd491('0xb'));var toCsv=require(_0xd491('0x8'));var querystring=require(_0xd491('0xc'));var Papa=require('papaparse');var Redis=require(_0xd491('0xd'));var authService=require(_0xd491('0xe'));var qs=require(_0xd491('0xf'));var as=require(_0xd491('0x10'));var hardwareService=require(_0xd491('0x11'));var logger=require(_0xd491('0x12'))(_0xd491('0x13'));var utils=require('../../config/utils');var config=require(_0xd491('0x14'));var licenseUtil=require(_0xd491('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xd491('0x16'));function respondWithStatusCode(_0x1f2542,_0x1cb20d){_0x1cb20d=_0x1cb20d||0xcc;return function(_0x18a1f2){if(_0x18a1f2){return _0x1f2542['sendStatus'](_0x1cb20d);}return _0x1f2542[_0xd491('0x17')](_0x1cb20d)[_0xd491('0x18')]();};}function respondWithResult(_0x3eea43,_0x1c43b8){_0x1c43b8=_0x1c43b8||0xc8;return function(_0x126ae1){if(_0x126ae1){return _0x3eea43[_0xd491('0x17')](_0x1c43b8)[_0xd491('0x19')](_0x126ae1);}};}function respondWithFilteredResult(_0x7529d2,_0x19dbf4){return function(_0x441f52){if(_0x441f52){var _0x1388d1=typeof _0x19dbf4[_0xd491('0x1a')]===_0xd491('0x1b')&&typeof _0x19dbf4[_0xd491('0x1c')]===_0xd491('0x1b');var _0x1faae0=_0x441f52['count'];var _0x47d35d=_0x1388d1?0x0:_0x19dbf4['offset'];var _0x13cc19=_0x1388d1?_0x441f52[_0xd491('0x1d')]:_0x19dbf4[_0xd491('0x1a')]+_0x19dbf4[_0xd491('0x1c')];var _0x1bb174;if(_0x13cc19>=_0x1faae0){_0x13cc19=_0x1faae0;_0x1bb174=0xc8;}else{_0x1bb174=0xce;}_0x7529d2[_0xd491('0x17')](_0x1bb174);return _0x7529d2[_0xd491('0x1e')](_0xd491('0x1f'),_0x47d35d+'-'+_0x13cc19+'/'+_0x1faae0)[_0xd491('0x19')](_0x441f52);}return null;};}function patchUpdates(_0x3b28ce){return function(_0x3e807f){try{jsonpatch['apply'](_0x3e807f,_0x3b28ce,!![]);}catch(_0x59c684){return BPromise[_0xd491('0x20')](_0x59c684);}return _0x3e807f[_0xd491('0x21')]();};}function saveUpdates(_0x17672e,_0x22a9fb){return function(_0x4a4ee4){if(_0x4a4ee4){return _0x4a4ee4['update'](_0x17672e)['then'](function(_0x354631){return _0x354631;});}return null;};}function removeEntity(_0x17e1b7,_0x43fd8e){return function(_0x26e81e){if(_0x26e81e){return _0x26e81e[_0xd491('0x22')]()[_0xd491('0x23')](function(){_0x17e1b7['status'](0xcc)[_0xd491('0x18')]();});}};}function handleEntityNotFound(_0x31985c,_0x5b4c75){return function(_0x2bc91a){if(!_0x2bc91a){_0x31985c[_0xd491('0x24')](0x194);}return _0x2bc91a;};}function handleError(_0x33a5ae,_0x510b96){_0x510b96=_0x510b96||0x1f4;return function(_0x34b338){logger[_0xd491('0x25')](_0x34b338[_0xd491('0x26')]);if(_0x34b338['name']){delete _0x34b338[_0xd491('0x27')];}_0x33a5ae[_0xd491('0x17')](_0x510b96)['send'](_0x34b338);};}exports[_0xd491('0x28')]=function(_0x8ba4da,_0x57f526){var _0x5cc4fe={},_0x3666b5={},_0x3f098e={'count':0x0,'rows':[]};var _0xa4d799=_[_0xd491('0x29')](db['SalesforceAccount'][_0xd491('0x2a')],function(_0x2a20bc){return{'name':_0x2a20bc[_0xd491('0x2b')],'type':_0x2a20bc[_0xd491('0x2c')][_0xd491('0x2d')]};});_0x3666b5[_0xd491('0x2e')]=_[_0xd491('0x29')](_0xa4d799,_0xd491('0x27'));_0x3666b5[_0xd491('0x2f')]=_[_0xd491('0x30')](_0x8ba4da[_0xd491('0x2f')]);_0x3666b5[_0xd491('0x31')]=_['intersection'](_0x3666b5['model'],_0x3666b5[_0xd491('0x2f')]);_0x5cc4fe[_0xd491('0x32')]=_[_0xd491('0x33')](_0x3666b5[_0xd491('0x2e')],qs[_0xd491('0x34')](_0x8ba4da['query'][_0xd491('0x34')]));_0x5cc4fe['attributes']=_0x5cc4fe['attributes'][_0xd491('0x35')]?_0x5cc4fe['attributes']:_0x3666b5[_0xd491('0x2e')];if(!_0x8ba4da[_0xd491('0x2f')]['hasOwnProperty'](_0xd491('0x36'))){_0x5cc4fe['limit']=qs[_0xd491('0x1c')](_0x8ba4da[_0xd491('0x2f')][_0xd491('0x1c')]);_0x5cc4fe['offset']=qs['offset'](_0x8ba4da['query'][_0xd491('0x1a')]);}_0x5cc4fe[_0xd491('0x37')]=qs['sort'](_0x8ba4da['query'][_0xd491('0x38')]);_0x5cc4fe[_0xd491('0x39')]=qs[_0xd491('0x31')](_[_0xd491('0x3a')](_0x8ba4da[_0xd491('0x2f')],_0x3666b5[_0xd491('0x31')]),_0xa4d799);if(_0x8ba4da[_0xd491('0x2f')]['filter']){_0x5cc4fe['where']=_[_0xd491('0x3b')](_0x5cc4fe[_0xd491('0x39')],{'$or':_[_0xd491('0x29')](_0xa4d799,function(_0x4bb69c){if(_0x4bb69c[_0xd491('0x2c')]!=='VIRTUAL'){var _0x2ea8c8={};_0x2ea8c8[_0x4bb69c[_0xd491('0x27')]]={'$like':'%'+_0x8ba4da[_0xd491('0x2f')][_0xd491('0x3c')]+'%'};return _0x2ea8c8;}})});}_0x5cc4fe=_[_0xd491('0x3b')]({},_0x5cc4fe,_0x8ba4da[_0xd491('0x3d')]);var _0x3f35d5={'where':_0x5cc4fe[_0xd491('0x39')]};return db['SalesforceAccount']['count'](_0x3f35d5)[_0xd491('0x23')](function(_0x1594d8){_0x3f098e['count']=_0x1594d8;if(_0x8ba4da['query'][_0xd491('0x3e')]){_0x5cc4fe[_0xd491('0x3f')]=[{'all':!![]}];}return db[_0xd491('0x40')]['findAll'](_0x5cc4fe);})[_0xd491('0x23')](function(_0x15c467){_0x3f098e['rows']=_0x15c467;return _0x3f098e;})['then'](respondWithFilteredResult(_0x57f526,_0x5cc4fe))[_0xd491('0x41')](handleError(_0x57f526,null));};exports['show']=function(_0x546915,_0x57b726){var _0x5b975b={'raw':![],'where':{'id':_0x546915[_0xd491('0x42')]['id']}},_0x192030={};_0x192030[_0xd491('0x2e')]=_['keys'](db[_0xd491('0x40')][_0xd491('0x2a')]);_0x192030[_0xd491('0x2f')]=_[_0xd491('0x30')](_0x546915['query']);_0x192030['filters']=_[_0xd491('0x33')](_0x192030[_0xd491('0x2e')],_0x192030[_0xd491('0x2f')]);_0x5b975b['attributes']=_['intersection'](_0x192030[_0xd491('0x2e')],qs[_0xd491('0x34')](_0x546915[_0xd491('0x2f')][_0xd491('0x34')]));_0x5b975b[_0xd491('0x32')]=_0x5b975b[_0xd491('0x32')][_0xd491('0x35')]?_0x5b975b[_0xd491('0x32')]:_0x192030[_0xd491('0x2e')];if(_0x546915[_0xd491('0x2f')][_0xd491('0x3e')]){_0x5b975b['include']=[{'all':!![]}];}_0x5b975b=_['merge']({},_0x5b975b,_0x546915['options']);return db[_0xd491('0x40')][_0xd491('0x43')](_0x5b975b)[_0xd491('0x23')](handleEntityNotFound(_0x57b726,null))['then'](respondWithResult(_0x57b726,null))[_0xd491('0x41')](handleError(_0x57b726,null));};exports[_0xd491('0x44')]=function(_0x17346e,_0xd27c18){return db[_0xd491('0x40')][_0xd491('0x44')](_0x17346e[_0xd491('0x45')],{})[_0xd491('0x23')](respondWithResult(_0xd27c18,0xc9))[_0xd491('0x41')](handleError(_0xd27c18,null));};exports[_0xd491('0x46')]=function(_0x325a19,_0x46ff96){if(_0x325a19[_0xd491('0x45')]['id']){delete _0x325a19[_0xd491('0x45')]['id'];}return db[_0xd491('0x40')][_0xd491('0x43')]({'where':{'id':_0x325a19[_0xd491('0x42')]['id']}})[_0xd491('0x23')](handleEntityNotFound(_0x46ff96,null))['then'](saveUpdates(_0x325a19[_0xd491('0x45')],null))[_0xd491('0x23')](respondWithResult(_0x46ff96,null))[_0xd491('0x41')](handleError(_0x46ff96,null));};exports['destroy']=function(_0x8037a5,_0x4ed6f5){return db[_0xd491('0x40')]['find']({'where':{'id':_0x8037a5[_0xd491('0x42')]['id']}})[_0xd491('0x23')](handleEntityNotFound(_0x4ed6f5,null))[_0xd491('0x23')](removeEntity(_0x4ed6f5,null))[_0xd491('0x41')](handleError(_0x4ed6f5,null));};exports[_0xd491('0x47')]=function(_0x3c5d0d,_0x46bcef,_0x2820e4){var _0x5359a9={};var _0xf7c5e8={};var _0x48724b;var _0xc14201;return db[_0xd491('0x40')][_0xd491('0x48')]({'where':{'id':_0x3c5d0d[_0xd491('0x42')]['id']}})[_0xd491('0x23')](handleEntityNotFound(_0x46bcef,null))[_0xd491('0x23')](function(_0x5df4db){if(_0x5df4db){_0x48724b=_0x5df4db;_0xf7c5e8[_0xd491('0x2e')]=_[_0xd491('0x30')](db[_0xd491('0x49')][_0xd491('0x2a')]);_0xf7c5e8[_0xd491('0x2f')]=_['keys'](_0x3c5d0d[_0xd491('0x2f')]);_0xf7c5e8[_0xd491('0x31')]=_[_0xd491('0x33')](_0xf7c5e8[_0xd491('0x2e')],_0xf7c5e8[_0xd491('0x2f')]);_0x5359a9['attributes']=_[_0xd491('0x33')](_0xf7c5e8[_0xd491('0x2e')],qs[_0xd491('0x34')](_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x34')]));_0x5359a9[_0xd491('0x32')]=_0x5359a9[_0xd491('0x32')][_0xd491('0x35')]?_0x5359a9[_0xd491('0x32')]:_0xf7c5e8[_0xd491('0x2e')];_0x5359a9['order']=qs[_0xd491('0x38')](_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x38')]);_0x5359a9[_0xd491('0x39')]=qs[_0xd491('0x31')](_[_0xd491('0x3a')](_0x3c5d0d[_0xd491('0x2f')],_0xf7c5e8['filters']));if(_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x3c')]){_0x5359a9[_0xd491('0x39')]=_[_0xd491('0x3b')](_0x5359a9['where'],{'$or':_[_0xd491('0x29')](_0x5359a9[_0xd491('0x32')],function(_0x379b21){var _0x196b44={};_0x196b44[_0x379b21]={'$like':'%'+_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x3c')]+'%'};return _0x196b44;})});}_0x5359a9=_[_0xd491('0x3b')]({},_0x5359a9,_0x3c5d0d[_0xd491('0x3d')]);return _0x48724b[_0xd491('0x47')](_0x5359a9);}})[_0xd491('0x23')](function(_0x303d00){if(_0x303d00){_0xc14201=_0x303d00[_0xd491('0x35')];if(!_0x3c5d0d['query'][_0xd491('0x4a')]('nolimit')){_0x5359a9[_0xd491('0x1c')]=qs[_0xd491('0x1c')](_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x1c')]);_0x5359a9[_0xd491('0x1a')]=qs['offset'](_0x3c5d0d[_0xd491('0x2f')][_0xd491('0x1a')]);}return _0x48724b[_0xd491('0x47')](_0x5359a9);}})[_0xd491('0x23')](function(_0x4b3776){if(_0x4b3776){return _0x4b3776?{'count':_0xc14201,'rows':_0x4b3776}:null;}})[_0xd491('0x23')](respondWithResult(_0x46bcef,null))['catch'](handleError(_0x46bcef,null));};exports['addConfiguration']=function(_0x10b722,_0x5d5f7c,_0x418e4e){if(_0x10b722[_0xd491('0x45')]['id']){delete _0x10b722[_0xd491('0x45')]['id'];}return db['SalesforceAccount'][_0xd491('0x48')]({'where':{'id':_0x10b722[_0xd491('0x42')]['id']}})[_0xd491('0x23')](handleEntityNotFound(_0x5d5f7c,null))[_0xd491('0x23')](function(_0x404c64){if(_0x404c64){_0x10b722[_0xd491('0x45')]['AccountId']=_0x404c64['id'];_0x10b722[_0xd491('0x45')][_0xd491('0x4b')]=integrations[_0xd491('0x4c')](_0x10b722[_0xd491('0x45')]['channel'],_0x10b722['body'][_0xd491('0x2c')]);_0x10b722[_0xd491('0x45')]['Descriptions']=integrations[_0xd491('0x4d')](_0x10b722['body'][_0xd491('0x4e')],_0x10b722['body'][_0xd491('0x2c')]);return db['SalesforceConfiguration'][_0xd491('0x44')](_0x10b722[_0xd491('0x45')],{'include':[{'model':db[_0xd491('0x4f')],'as':'Subjects'},{'model':db[_0xd491('0x4f')],'as':'Descriptions'}]});}return null;})[_0xd491('0x23')](respondWithResult(_0x5d5f7c,null))[_0xd491('0x41')](handleError(_0x5d5f7c,null));};exports[_0xd491('0x50')]=function(_0x3f0f97,_0x38f8d3,_0x13f9d1){var _0x235647;var _0x851202='';var _0x5d130f=_0xd491('0x51');return db[_0xd491('0x40')]['findOne']({'where':{'id':_0x3f0f97['params']['id']},'attributes':['id',_0xd491('0x52'),_0xd491('0x53'),_0xd491('0x54'),_0xd491('0x55'),'password','securityToken']})[_0xd491('0x23')](handleEntityNotFound(_0x38f8d3,null))[_0xd491('0x23')](function(_0x1b9040){if(_0x1b9040){_0x851202=_0x1b9040[_0xd491('0x52')];var _0x2f370e=_0x851202['slice'](-0x1);if(_0x2f370e==='/'){_0x851202=_0x851202['substring'](0x0,_0x851202['lastIndexOf'](_0x2f370e));}_0x235647=new jsforce[(_0xd491('0x56'))]({'oauth2':{'loginUrl':_0x851202,'clientId':_0x1b9040[_0xd491('0x53')],'clientSecret':_0x1b9040[_0xd491('0x54')]}});return _0x235647[_0xd491('0x57')](_0x1b9040['username'],_0x1b9040[_0xd491('0x58')]['concat'](_0x1b9040[_0xd491('0x59')]));}})[_0xd491('0x23')](function(_0x3cfaa3){if(_0x3cfaa3){if(!_[_0xd491('0x5a')](_0x3f0f97[_0xd491('0x2f')][_0xd491('0x5b')])){_0x5d130f=_0x3f0f97['query'][_0xd491('0x5b')];}return _0x235647[_0xd491('0x5c')](_0x5d130f)['describe']();}})[_0xd491('0x23')](function(_0x12e832){var _0x59a9e3=['OwnerId',_0xd491('0x5d'),'IsReminderSet',_0xd491('0x5e'),_0xd491('0x5f'),_0xd491('0x60')];var _0x3a45f1=[_0xd491('0x61'),_0xd491('0x62'),'picklist','boolean',_0xd491('0x63'),_0xd491('0x64'),_0xd491('0x65')];if(_0x12e832){_[_0xd491('0x66')](_0x12e832['fields'],function(_0x36d6ea){return _0x59a9e3[_0xd491('0x67')](_0x36d6ea[_0xd491('0x27')])||!_0x3a45f1[_0xd491('0x67')](_0x36d6ea[_0xd491('0x2c')]);});return{'count':_0x12e832[_0xd491('0x34')][_0xd491('0x35')],'rows':_[_0xd491('0x29')](_0x12e832[_0xd491('0x34')],function(_0x169daa){return{'id':_0x169daa[_0xd491('0x27')],'name':_0x169daa['label'],'custom':_0x169daa[_0xd491('0x68')],'options':_0x169daa[_0xd491('0x69')][_0xd491('0x35')]>0x0?_[_0xd491('0x29')](_0x169daa[_0xd491('0x69')],function(_0x44d792){return{'name':_0x44d792[_0xd491('0x6a')],'value':_0x44d792[_0xd491('0x6b')]};}):_0x169daa['type']==_0xd491('0x6c')?[{'name':_0xd491('0x6d'),'value':_0xd491('0x6e')},{'name':_0xd491('0x6f'),'value':_0xd491('0x70')}]:[]};})};}})['then'](respondWithResult(_0x38f8d3,null))[_0xd491('0x41')](function(_0x4ac464){var _0x49eb30=_0x3f0f97[_0xd491('0x2f')][_0xd491('0x71')]?0x1f4:_0x4ac464[_0xd491('0x72')]||0x1f4;logger[_0xd491('0x25')](_0xd491('0x73'),_0xd491('0x50'),_0x49eb30,JSON[_0xd491('0x74')](_0x4ac464));delete _0x4ac464[_0xd491('0x27')];if(_0x49eb30===0x191){_0x49eb30=0x190;}_0x38f8d3[_0xd491('0x17')](_0x49eb30)['send'](_0x3f0f97['query']['test']?{'message':_0xd491('0x75'),'statusCode':_0x4ac464['statusCode']}:_0x4ac464);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 065453f..5b3fd20 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 _0x0b94=['define','SalesforceAccount','lodash','util','../../config/logger','api','moment','bluebird','path','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0xeeb9e,_0x1f0df6){var _0xbf9aa7=function(_0x290991){while(--_0x290991){_0xeeb9e['push'](_0xeeb9e['shift']());}};_0xbf9aa7(++_0x1f0df6);}(_0x0b94,0x91));var _0x40b9=function(_0x2d6bb2,_0x3ca57b){_0x2d6bb2=_0x2d6bb2-0x0;var _0x59e935=_0x0b94[_0x2d6bb2];return _0x59e935;};'use strict';var _=require(_0x40b9('0x0'));var util=require(_0x40b9('0x1'));var logger=require(_0x40b9('0x2'))(_0x40b9('0x3'));var moment=require(_0x40b9('0x4'));var BPromise=require(_0x40b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40b9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40b9('0x7'));var integrations=require(_0x40b9('0x8'));module['exports']=function(_0x104dc5,_0x2ccf26){return _0x104dc5[_0x40b9('0x9')](_0x40b9('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bba=['api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0x3108d9,_0xf08d6){var _0x1455e6=function(_0xfd5906){while(--_0xfd5906){_0x3108d9['push'](_0x3108d9['shift']());}};_0x1455e6(++_0xf08d6);}(_0x0bba,0x143));var _0xa0bb=function(_0x11d8e2,_0x10dea6){_0x11d8e2=_0x11d8e2-0x0;var _0x518a01=_0x0bba[_0x11d8e2];return _0x518a01;};'use strict';var _=require('lodash');var util=require(_0xa0bb('0x0'));var logger=require(_0xa0bb('0x1'))(_0xa0bb('0x2'));var moment=require(_0xa0bb('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0bb('0x4'));var fs=require('fs');var path=require(_0xa0bb('0x5'));var rimraf=require(_0xa0bb('0x6'));var config=require(_0xa0bb('0x7'));var attributes=require(_0xa0bb('0x8'));var integrations=require(_0xa0bb('0x9'));module['exports']=function(_0x3e7459,_0x18461e){return _0x3e7459[_0xa0bb('0xa')](_0xa0bb('0xb'),attributes,{'tableName':_0xa0bb('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 3e89354..37ffd4b 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 _0x204c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','findAll','options','raw','limit','include','map','model','attributes','ShowSalesforceAccount','SalesforceAccount','find','where','lodash','util'];(function(_0x423d5a,_0x52ba40){var _0x1f0f0f=function(_0x15ef29){while(--_0x15ef29){_0x423d5a['push'](_0x423d5a['shift']());}};_0x1f0f0f(++_0x52ba40);}(_0x204c,0xdc));var _0xc204=function(_0x4ef433,_0x234b50){_0x4ef433=_0x4ef433-0x0;var _0x1a517f=_0x204c[_0x4ef433];return _0x1a517f;};'use strict';var _=require(_0xc204('0x0'));var util=require(_0xc204('0x1'));var moment=require(_0xc204('0x2'));var BPromise=require(_0xc204('0x3'));var rs=require(_0xc204('0x4'));var fs=require('fs');var Redis=require(_0xc204('0x5'));var db=require(_0xc204('0x6'))['db'];var utils=require(_0xc204('0x7'));var logger=require(_0xc204('0x8'))(_0xc204('0x9'));var config=require(_0xc204('0xa'));var jayson=require(_0xc204('0xb'));var client=jayson['client'][_0xc204('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34768a,_0x27655b,_0x584a50){return new BPromise(function(_0x44ddcd,_0x4be484){return client[_0xc204('0xd')](_0x34768a,_0x584a50)[_0xc204('0xe')](function(_0x5d0277){logger[_0xc204('0xf')](_0xc204('0x10'),_0x27655b,_0xc204('0x11'));logger[_0xc204('0x12')](_0xc204('0x13'),_0x27655b,'request\x20sent',JSON[_0xc204('0x14')](_0x5d0277));if(_0x5d0277[_0xc204('0x15')]){if(_0x5d0277[_0xc204('0x15')]['code']===0x1f4){logger[_0xc204('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x27655b,_0x5d0277['error'][_0xc204('0x16')]);return _0x4be484(_0x5d0277[_0xc204('0x15')][_0xc204('0x16')]);}logger['error'](_0xc204('0x10'),_0x27655b,_0x5d0277[_0xc204('0x15')][_0xc204('0x16')]);return _0x44ddcd(_0x5d0277[_0xc204('0x15')][_0xc204('0x16')]);}else{logger['info'](_0xc204('0x10'),_0x27655b,_0xc204('0x11'));_0x44ddcd(_0x5d0277['result']['message']);}})[_0xc204('0x17')](function(_0x41d2a4){logger[_0xc204('0x15')](_0xc204('0x10'),_0x27655b,_0x41d2a4);_0x4be484(_0x41d2a4);});});}exports[_0xc204('0x18')]=function(_0x19d847){var _0x3e9ef6=this;return new Promise(function(_0x3b80d5,_0x24473c){return db['SalesforceAccount'][_0xc204('0x19')]({'raw':_0x19d847[_0xc204('0x1a')]?_0x19d847['options'][_0xc204('0x1b')]===undefined?!![]:![]:!![],'where':_0x19d847[_0xc204('0x1a')]?_0x19d847[_0xc204('0x1a')]['where']||null:null,'attributes':_0x19d847[_0xc204('0x1a')]?_0x19d847[_0xc204('0x1a')]['attributes']||null:null,'limit':_0x19d847[_0xc204('0x1a')]?_0x19d847['options'][_0xc204('0x1c')]||null:null,'include':_0x19d847[_0xc204('0x1a')]?_0x19d847[_0xc204('0x1a')][_0xc204('0x1d')]?_[_0xc204('0x1e')](_0x19d847['options'][_0xc204('0x1d')],function(_0x5ae02f){return{'model':db[_0x5ae02f[_0xc204('0x1f')]],'as':_0x5ae02f['as'],'attributes':_0x5ae02f[_0xc204('0x20')],'include':_0x5ae02f[_0xc204('0x1d')]?_['map'](_0x5ae02f['include'],function(_0x195050){return{'model':db[_0x195050[_0xc204('0x1f')]],'as':_0x195050['as'],'attributes':_0x195050[_0xc204('0x20')],'include':_0x195050['include']?_[_0xc204('0x1e')](_0x195050['include'],function(_0x77fb43){return{'model':db[_0x77fb43[_0xc204('0x1f')]],'as':_0x77fb43['as'],'attributes':_0x77fb43[_0xc204('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc204('0xe')](function(_0x316195){logger[_0xc204('0xf')](_0xc204('0x18'),_0x19d847);logger['debug']('GetSalesforceAccount',_0x19d847,JSON[_0xc204('0x14')](_0x316195));_0x3b80d5(_0x316195);})[_0xc204('0x17')](function(_0x387166){logger[_0xc204('0x15')](_0xc204('0x18'),_0x387166[_0xc204('0x16')],_0x19d847);_0x24473c(_0x3e9ef6['error'](0x1f4,_0x387166[_0xc204('0x16')]));});});};exports[_0xc204('0x21')]=function(_0x29c4ef){var _0x4595df=this;return new Promise(function(_0x2f44a8,_0xe41b77){return db[_0xc204('0x22')][_0xc204('0x23')]({'raw':_0x29c4ef[_0xc204('0x1a')]?_0x29c4ef[_0xc204('0x1a')][_0xc204('0x1b')]===undefined?!![]:![]:!![],'where':_0x29c4ef[_0xc204('0x1a')]?_0x29c4ef[_0xc204('0x1a')][_0xc204('0x24')]||null:null,'attributes':_0x29c4ef[_0xc204('0x1a')]?_0x29c4ef[_0xc204('0x1a')][_0xc204('0x20')]||null:null,'include':_0x29c4ef[_0xc204('0x1a')]?_0x29c4ef[_0xc204('0x1a')][_0xc204('0x1d')]?_[_0xc204('0x1e')](_0x29c4ef[_0xc204('0x1a')][_0xc204('0x1d')],function(_0x1cbe74){return{'model':db[_0x1cbe74['model']],'as':_0x1cbe74['as'],'attributes':_0x1cbe74[_0xc204('0x20')],'include':_0x1cbe74['include']?_[_0xc204('0x1e')](_0x1cbe74[_0xc204('0x1d')],function(_0xc9944c){return{'model':db[_0xc9944c['model']],'as':_0xc9944c['as'],'attributes':_0xc9944c['attributes'],'include':_0xc9944c[_0xc204('0x1d')]?_['map'](_0xc9944c[_0xc204('0x1d')],function(_0x23ac73){return{'model':db[_0x23ac73[_0xc204('0x1f')]],'as':_0x23ac73['as'],'attributes':_0x23ac73[_0xc204('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc204('0xe')](function(_0x159086){logger[_0xc204('0xf')](_0xc204('0x21'),_0x29c4ef);logger[_0xc204('0x12')](_0xc204('0x21'),_0x29c4ef,JSON['stringify'](_0x159086));_0x2f44a8(_0x159086);})[_0xc204('0x17')](function(_0x4ade64){logger['error']('ShowSalesforceAccount',_0x4ade64[_0xc204('0x16')],_0x29c4ef);_0xe41b77(_0x4595df[_0xc204('0x15')](0x1f4,_0x4ade64[_0xc204('0x16')]));});});}; \ No newline at end of file +var _0x7d1e=['stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x7d1e,0x111));var _0xe7d1=function(_0x2d284c,_0x59aa64){_0x2d284c=_0x2d284c-0x0;var _0x4f5756=_0x7d1e[_0x2d284c];return _0x4f5756;};'use strict';var _=require(_0xe7d1('0x0'));var util=require(_0xe7d1('0x1'));var moment=require(_0xe7d1('0x2'));var BPromise=require(_0xe7d1('0x3'));var rs=require(_0xe7d1('0x4'));var fs=require('fs');var Redis=require(_0xe7d1('0x5'));var db=require(_0xe7d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe7d1('0x7'))('rpc');var config=require(_0xe7d1('0x8'));var jayson=require(_0xe7d1('0x9'));var client=jayson[_0xe7d1('0xa')][_0xe7d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x357569,_0x2bbaa5,_0x2cadc8){return new BPromise(function(_0x3dabfb,_0x3c2a33){return client['request'](_0x357569,_0x2cadc8)[_0xe7d1('0xc')](function(_0x4b66bf){logger['info'](_0xe7d1('0xd'),_0x2bbaa5,'request\x20sent');logger['debug'](_0xe7d1('0xe'),_0x2bbaa5,'request\x20sent',JSON[_0xe7d1('0xf')](_0x4b66bf));if(_0x4b66bf['error']){if(_0x4b66bf[_0xe7d1('0x10')][_0xe7d1('0x11')]===0x1f4){logger[_0xe7d1('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2bbaa5,_0x4b66bf[_0xe7d1('0x10')]['message']);return _0x3c2a33(_0x4b66bf['error'][_0xe7d1('0x12')]);}logger[_0xe7d1('0x10')](_0xe7d1('0xd'),_0x2bbaa5,_0x4b66bf[_0xe7d1('0x10')]['message']);return _0x3dabfb(_0x4b66bf[_0xe7d1('0x10')][_0xe7d1('0x12')]);}else{logger[_0xe7d1('0x13')](_0xe7d1('0xd'),_0x2bbaa5,'request\x20sent');_0x3dabfb(_0x4b66bf[_0xe7d1('0x14')]['message']);}})[_0xe7d1('0x15')](function(_0x1a8916){logger[_0xe7d1('0x10')](_0xe7d1('0xd'),_0x2bbaa5,_0x1a8916);_0x3c2a33(_0x1a8916);});});}exports[_0xe7d1('0x16')]=function(_0xa819f3){var _0x3a1f98=this;return new Promise(function(_0x5d859d,_0x30cf55){return db[_0xe7d1('0x17')][_0xe7d1('0x18')]({'raw':_0xa819f3[_0xe7d1('0x19')]?_0xa819f3[_0xe7d1('0x19')][_0xe7d1('0x1a')]===undefined?!![]:![]:!![],'where':_0xa819f3[_0xe7d1('0x19')]?_0xa819f3['options'][_0xe7d1('0x1b')]||null:null,'attributes':_0xa819f3[_0xe7d1('0x19')]?_0xa819f3[_0xe7d1('0x19')][_0xe7d1('0x1c')]||null:null,'limit':_0xa819f3['options']?_0xa819f3[_0xe7d1('0x19')][_0xe7d1('0x1d')]||null:null,'include':_0xa819f3['options']?_0xa819f3['options'][_0xe7d1('0x1e')]?_[_0xe7d1('0x1f')](_0xa819f3['options'][_0xe7d1('0x1e')],function(_0x38de5a){return{'model':db[_0x38de5a['model']],'as':_0x38de5a['as'],'attributes':_0x38de5a['attributes'],'include':_0x38de5a[_0xe7d1('0x1e')]?_[_0xe7d1('0x1f')](_0x38de5a[_0xe7d1('0x1e')],function(_0x13e9e3){return{'model':db[_0x13e9e3[_0xe7d1('0x20')]],'as':_0x13e9e3['as'],'attributes':_0x13e9e3[_0xe7d1('0x1c')],'include':_0x13e9e3['include']?_[_0xe7d1('0x1f')](_0x13e9e3[_0xe7d1('0x1e')],function(_0x39c2dd){return{'model':db[_0x39c2dd[_0xe7d1('0x20')]],'as':_0x39c2dd['as'],'attributes':_0x39c2dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7d1('0xc')](function(_0x5d88b6){logger['info']('GetSalesforceAccount',_0xa819f3);logger[_0xe7d1('0x21')](_0xe7d1('0x16'),_0xa819f3,JSON[_0xe7d1('0xf')](_0x5d88b6));_0x5d859d(_0x5d88b6);})[_0xe7d1('0x15')](function(_0x3b33fa){logger[_0xe7d1('0x10')](_0xe7d1('0x16'),_0x3b33fa[_0xe7d1('0x12')],_0xa819f3);_0x30cf55(_0x3a1f98[_0xe7d1('0x10')](0x1f4,_0x3b33fa[_0xe7d1('0x12')]));});});};exports[_0xe7d1('0x22')]=function(_0x1764a4){var _0x52cda1=this;return new Promise(function(_0x589c68,_0x334dcc){return db[_0xe7d1('0x17')][_0xe7d1('0x23')]({'raw':_0x1764a4[_0xe7d1('0x19')]?_0x1764a4[_0xe7d1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1764a4['options']?_0x1764a4[_0xe7d1('0x19')][_0xe7d1('0x1b')]||null:null,'attributes':_0x1764a4[_0xe7d1('0x19')]?_0x1764a4[_0xe7d1('0x19')]['attributes']||null:null,'include':_0x1764a4[_0xe7d1('0x19')]?_0x1764a4['options'][_0xe7d1('0x1e')]?_[_0xe7d1('0x1f')](_0x1764a4[_0xe7d1('0x19')]['include'],function(_0x23fa23){return{'model':db[_0x23fa23[_0xe7d1('0x20')]],'as':_0x23fa23['as'],'attributes':_0x23fa23[_0xe7d1('0x1c')],'include':_0x23fa23[_0xe7d1('0x1e')]?_[_0xe7d1('0x1f')](_0x23fa23[_0xe7d1('0x1e')],function(_0x2e488b){return{'model':db[_0x2e488b['model']],'as':_0x2e488b['as'],'attributes':_0x2e488b[_0xe7d1('0x1c')],'include':_0x2e488b[_0xe7d1('0x1e')]?_[_0xe7d1('0x1f')](_0x2e488b['include'],function(_0xf4cc4e){return{'model':db[_0xf4cc4e['model']],'as':_0xf4cc4e['as'],'attributes':_0xf4cc4e[_0xe7d1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7d1('0xc')](function(_0x57d434){logger[_0xe7d1('0x13')](_0xe7d1('0x22'),_0x1764a4);logger[_0xe7d1('0x21')](_0xe7d1('0x22'),_0x1764a4,JSON[_0xe7d1('0xf')](_0x57d434));_0x589c68(_0x57d434);})[_0xe7d1('0x15')](function(_0x311308){logger['error'](_0xe7d1('0x22'),_0x311308[_0xe7d1('0x12')],_0x1764a4);_0x334dcc(_0x52cda1['error'](0x1f4,_0x311308[_0xe7d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 1229563..f36fe0d 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 _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(_0x118fa1,_0x53f011){var _0xf3c82f=function(_0x400254){while(--_0x400254){_0x118fa1['push'](_0x118fa1['shift']());}};_0xf3c82f(++_0x53f011);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17d0ea,_0x4d9dcc){_0x17d0ea=_0x17d0ea-0x0;var _0x30cb3e=_0x5f2f[_0x17d0ea];return _0x30cb3e;};'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 +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x281839,_0x6fed41){var _0x254f8b=function(_0x2651e5){while(--_0x2651e5){_0x281839['push'](_0x281839['shift']());}};_0x254f8b(++_0x6fed41);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9605282..8ac8852 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 _0xf54a=['lead','STRING','ENUM','Task','Case','contact_lead','contact','account'];(function(_0x3bef2c,_0x5a86fd){var _0x331503=function(_0x463430){while(--_0x463430){_0x3bef2c['push'](_0x3bef2c['shift']());}};_0x331503(++_0x5a86fd);}(_0xf54a,0xa1));var _0xaf54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf54a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf54('0x0')]},'ticketType':{'type':Sequelize[_0xaf54('0x1')](_0xaf54('0x2'),_0xaf54('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xaf54('0x1')](_0xaf54('0x4'),_0xaf54('0x5'),'lead','account_contact_lead',_0xaf54('0x6')),'defaultValue':_0xaf54('0x4')},'moduleCreate':{'type':Sequelize[_0xaf54('0x1')]('nothing','contact',_0xaf54('0x7'),_0xaf54('0x6')),'defaultValue':_0xaf54('0x7')},'leadId':{'type':Sequelize[_0xaf54('0x0')]},'additionalSearchAccount':{'type':Sequelize[_0xaf54('0x0')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b0d=['STRING','ENUM','Task','Case','contact_lead','lead','account_contact_lead','account','nothing','contact','sequelize','exports'];(function(_0x417c2b,_0x597c50){var _0x846a49=function(_0x3c5725){while(--_0x3c5725){_0x417c2b['push'](_0x417c2b['shift']());}};_0x846a49(++_0x597c50);}(_0x5b0d,0x172));var _0xd5b0=function(_0x2f3a72,_0x24fcc2){_0x2f3a72=_0x2f3a72-0x0;var _0x13f974=_0x5b0d[_0x2f3a72];return _0x13f974;};'use strict';var Sequelize=require(_0xd5b0('0x0'));module[_0xd5b0('0x1')]={'name':{'type':Sequelize[_0xd5b0('0x2')]},'description':{'type':Sequelize[_0xd5b0('0x2')]},'ticketType':{'type':Sequelize[_0xd5b0('0x3')](_0xd5b0('0x4'),_0xd5b0('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xd5b0('0x3')](_0xd5b0('0x6'),'contact',_0xd5b0('0x7'),_0xd5b0('0x8'),_0xd5b0('0x9')),'defaultValue':_0xd5b0('0x6')},'moduleCreate':{'type':Sequelize[_0xd5b0('0x3')](_0xd5b0('0xa'),_0xd5b0('0xb'),_0xd5b0('0x7'),'account'),'defaultValue':_0xd5b0('0x7')},'leadId':{'type':Sequelize[_0xd5b0('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xd5b0('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd5b0('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd5b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index de44c64..71f0fc0 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 _0x06fe=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','rows','catch','show','params','include','find','create','update','body','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','reject','save','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type'];(function(_0x2ff20c,_0x13f9cd){var _0x27bf05=function(_0x22a0ec){while(--_0x22a0ec){_0x2ff20c['push'](_0x2ff20c['shift']());}};_0x27bf05(++_0x13f9cd);}(_0x06fe,0xff));var _0xe06f=function(_0x2a7b74,_0x45b0d5){_0x2a7b74=_0x2a7b74-0x0;var _0x114666=_0x06fe[_0x2a7b74];return _0x114666;};'use strict';var emlformat=require(_0xe06f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe06f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe06f('0x2'));var moment=require(_0xe06f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe06f('0x4'));var util=require(_0xe06f('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xe06f('0x6'));var ejs=require(_0xe06f('0x7'));var fs=require('fs');var fs_extra=require(_0xe06f('0x8'));var _=require(_0xe06f('0x9'));var squel=require(_0xe06f('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe06f('0xb'));var toCsv=require(_0xe06f('0x6'));var querystring=require('querystring');var Papa=require(_0xe06f('0xc'));var Redis=require(_0xe06f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe06f('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe06f('0xf'))(_0xe06f('0x10'));var utils=require(_0xe06f('0x11'));var config=require(_0xe06f('0x12'));var licenseUtil=require(_0xe06f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf2100f,_0x109f70){_0x109f70=_0x109f70||0xcc;return function(_0xb87ba4){if(_0xb87ba4){return _0xf2100f[_0xe06f('0x14')](_0x109f70);}return _0xf2100f[_0xe06f('0x15')](_0x109f70)[_0xe06f('0x16')]();};}function respondWithResult(_0x4c2c39,_0x201ee3){_0x201ee3=_0x201ee3||0xc8;return function(_0x579a2f){if(_0x579a2f){return _0x4c2c39['status'](_0x201ee3)[_0xe06f('0x17')](_0x579a2f);}};}function respondWithFilteredResult(_0x4caa18,_0x52fd57){return function(_0x144412){if(_0x144412){var _0x47069=typeof _0x52fd57['offset']===_0xe06f('0x18')&&typeof _0x52fd57[_0xe06f('0x19')]==='undefined';var _0x37b638=_0x144412['count'];var _0x478868=_0x47069?0x0:_0x52fd57[_0xe06f('0x1a')];var _0x45f10c=_0x47069?_0x144412[_0xe06f('0x1b')]:_0x52fd57[_0xe06f('0x1a')]+_0x52fd57[_0xe06f('0x19')];var _0x40fd3b;if(_0x45f10c>=_0x37b638){_0x45f10c=_0x37b638;_0x40fd3b=0xc8;}else{_0x40fd3b=0xce;}_0x4caa18[_0xe06f('0x15')](_0x40fd3b);return _0x4caa18['set']('Content-Range',_0x478868+'-'+_0x45f10c+'/'+_0x37b638)[_0xe06f('0x17')](_0x144412);}return null;};}function patchUpdates(_0x41c1b3){return function(_0x237a9a){try{jsonpatch['apply'](_0x237a9a,_0x41c1b3,!![]);}catch(_0xa70e97){return BPromise[_0xe06f('0x1c')](_0xa70e97);}return _0x237a9a[_0xe06f('0x1d')]();};}function saveUpdates(_0x50e891,_0x48f088){return function(_0x2ce29b){if(_0x2ce29b){return _0x2ce29b['update'](_0x50e891)['then'](function(_0x28886f){return _0x28886f;});}return null;};}function removeEntity(_0x3dc5ee,_0x206308){return function(_0x13b5d8){if(_0x13b5d8){return _0x13b5d8['destroy']()['then'](function(){_0x3dc5ee[_0xe06f('0x15')](0xcc)[_0xe06f('0x16')]();});}};}function handleEntityNotFound(_0x5b0d26,_0x30173c){return function(_0x33645d){if(!_0x33645d){_0x5b0d26[_0xe06f('0x14')](0x194);}return _0x33645d;};}function handleError(_0x274e60,_0x3b50e0){_0x3b50e0=_0x3b50e0||0x1f4;return function(_0x47b32e){logger['error'](_0x47b32e['stack']);if(_0x47b32e[_0xe06f('0x1e')]){delete _0x47b32e[_0xe06f('0x1e')];}_0x274e60['status'](_0x3b50e0)[_0xe06f('0x1f')](_0x47b32e);};}exports['index']=function(_0x4a922c,_0x33c698){var _0x97bd6d={},_0x29eddb={},_0x3c5818={'count':0x0,'rows':[]};var _0x3dd705=_[_0xe06f('0x20')](db[_0xe06f('0x21')][_0xe06f('0x22')],function(_0x4453a9){return{'name':_0x4453a9[_0xe06f('0x23')],'type':_0x4453a9[_0xe06f('0x24')][_0xe06f('0x25')]};});_0x29eddb[_0xe06f('0x26')]=_[_0xe06f('0x20')](_0x3dd705,_0xe06f('0x1e'));_0x29eddb[_0xe06f('0x27')]=_[_0xe06f('0x28')](_0x4a922c[_0xe06f('0x27')]);_0x29eddb['filters']=_[_0xe06f('0x29')](_0x29eddb[_0xe06f('0x26')],_0x29eddb[_0xe06f('0x27')]);_0x97bd6d['attributes']=_[_0xe06f('0x29')](_0x29eddb['model'],qs['fields'](_0x4a922c[_0xe06f('0x27')][_0xe06f('0x2a')]));_0x97bd6d[_0xe06f('0x2b')]=_0x97bd6d[_0xe06f('0x2b')][_0xe06f('0x2c')]?_0x97bd6d['attributes']:_0x29eddb[_0xe06f('0x26')];if(!_0x4a922c[_0xe06f('0x27')][_0xe06f('0x2d')](_0xe06f('0x2e'))){_0x97bd6d['limit']=qs[_0xe06f('0x19')](_0x4a922c['query']['limit']);_0x97bd6d[_0xe06f('0x1a')]=qs[_0xe06f('0x1a')](_0x4a922c['query'][_0xe06f('0x1a')]);}_0x97bd6d[_0xe06f('0x2f')]=qs[_0xe06f('0x30')](_0x4a922c[_0xe06f('0x27')][_0xe06f('0x30')]);_0x97bd6d['where']=qs[_0xe06f('0x31')](_[_0xe06f('0x32')](_0x4a922c[_0xe06f('0x27')],_0x29eddb['filters']),_0x3dd705);if(_0x4a922c[_0xe06f('0x27')][_0xe06f('0x33')]){_0x97bd6d[_0xe06f('0x34')]=_[_0xe06f('0x35')](_0x97bd6d[_0xe06f('0x34')],{'$or':_[_0xe06f('0x20')](_0x3dd705,function(_0xa37f3c){if(_0xa37f3c['type']!==_0xe06f('0x36')){var _0x23b089={};_0x23b089[_0xa37f3c['name']]={'$like':'%'+_0x4a922c[_0xe06f('0x27')][_0xe06f('0x33')]+'%'};return _0x23b089;}})});}_0x97bd6d=_[_0xe06f('0x35')]({},_0x97bd6d,_0x4a922c[_0xe06f('0x37')]);var _0x5f4ee1={'where':_0x97bd6d['where']};return db[_0xe06f('0x21')][_0xe06f('0x1b')](_0x5f4ee1)[_0xe06f('0x38')](function(_0x265514){_0x3c5818[_0xe06f('0x1b')]=_0x265514;if(_0x4a922c['query'][_0xe06f('0x39')]){_0x97bd6d['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x97bd6d);})[_0xe06f('0x38')](function(_0x47d924){_0x3c5818[_0xe06f('0x3a')]=_0x47d924;return _0x3c5818;})[_0xe06f('0x38')](respondWithFilteredResult(_0x33c698,_0x97bd6d))[_0xe06f('0x3b')](handleError(_0x33c698,null));};exports[_0xe06f('0x3c')]=function(_0x8accc5,_0x902f95){var _0x27b1f2={'raw':![],'where':{'id':_0x8accc5[_0xe06f('0x3d')]['id']}},_0x41a02d={};_0x41a02d[_0xe06f('0x26')]=_[_0xe06f('0x28')](db[_0xe06f('0x21')][_0xe06f('0x22')]);_0x41a02d[_0xe06f('0x27')]=_['keys'](_0x8accc5['query']);_0x41a02d[_0xe06f('0x31')]=_[_0xe06f('0x29')](_0x41a02d[_0xe06f('0x26')],_0x41a02d['query']);_0x27b1f2[_0xe06f('0x2b')]=_['intersection'](_0x41a02d[_0xe06f('0x26')],qs[_0xe06f('0x2a')](_0x8accc5[_0xe06f('0x27')][_0xe06f('0x2a')]));_0x27b1f2[_0xe06f('0x2b')]=_0x27b1f2['attributes'][_0xe06f('0x2c')]?_0x27b1f2[_0xe06f('0x2b')]:_0x41a02d['model'];if(_0x8accc5[_0xe06f('0x27')][_0xe06f('0x39')]){_0x27b1f2[_0xe06f('0x3e')]=[{'all':!![]}];}_0x27b1f2=_[_0xe06f('0x35')]({},_0x27b1f2,_0x8accc5[_0xe06f('0x37')]);return db[_0xe06f('0x21')][_0xe06f('0x3f')](_0x27b1f2)['then'](handleEntityNotFound(_0x902f95,null))[_0xe06f('0x38')](respondWithResult(_0x902f95,null))[_0xe06f('0x3b')](handleError(_0x902f95,null));};exports['create']=function(_0x7a0b64,_0x4e56c3){return db[_0xe06f('0x21')][_0xe06f('0x40')](_0x7a0b64['body'],{})[_0xe06f('0x38')](respondWithResult(_0x4e56c3,0xc9))[_0xe06f('0x3b')](handleError(_0x4e56c3,null));};exports[_0xe06f('0x41')]=function(_0x7a0ba3,_0x3d9b00){if(_0x7a0ba3[_0xe06f('0x42')]['id']){delete _0x7a0ba3[_0xe06f('0x42')]['id'];}return db[_0xe06f('0x21')]['find']({'where':{'id':_0x7a0ba3[_0xe06f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3d9b00,null))[_0xe06f('0x38')](saveUpdates(_0x7a0ba3[_0xe06f('0x42')],null))['then'](respondWithResult(_0x3d9b00,null))[_0xe06f('0x3b')](handleError(_0x3d9b00,null));};exports[_0xe06f('0x43')]=function(_0x533037,_0x12d2a7){return db[_0xe06f('0x21')][_0xe06f('0x3f')]({'where':{'id':_0x533037['params']['id']}})[_0xe06f('0x38')](handleEntityNotFound(_0x12d2a7,null))[_0xe06f('0x38')](removeEntity(_0x12d2a7,null))[_0xe06f('0x3b')](handleError(_0x12d2a7,null));};exports[_0xe06f('0x44')]=function(_0x5257f4,_0x44372a,_0x58062a){var _0x1f7e00={};var _0x175d1d={};var _0x422505;var _0x84e4fa;return db[_0xe06f('0x21')][_0xe06f('0x45')]({'where':{'id':_0x5257f4[_0xe06f('0x3d')]['id']}})[_0xe06f('0x38')](handleEntityNotFound(_0x44372a,null))[_0xe06f('0x38')](function(_0x4e1988){if(_0x4e1988){_0x422505=_0x4e1988;_0x175d1d[_0xe06f('0x26')]=_['keys'](db[_0xe06f('0x46')]['rawAttributes']);_0x175d1d[_0xe06f('0x27')]=_[_0xe06f('0x28')](_0x5257f4[_0xe06f('0x27')]);_0x175d1d[_0xe06f('0x31')]=_['intersection'](_0x175d1d[_0xe06f('0x26')],_0x175d1d['query']);_0x1f7e00[_0xe06f('0x2b')]=_['intersection'](_0x175d1d[_0xe06f('0x26')],qs[_0xe06f('0x2a')](_0x5257f4[_0xe06f('0x27')][_0xe06f('0x2a')]));_0x1f7e00[_0xe06f('0x2b')]=_0x1f7e00[_0xe06f('0x2b')][_0xe06f('0x2c')]?_0x1f7e00[_0xe06f('0x2b')]:_0x175d1d[_0xe06f('0x26')];_0x1f7e00[_0xe06f('0x2f')]=qs[_0xe06f('0x30')](_0x5257f4['query']['sort']);_0x1f7e00['where']=qs['filters'](_[_0xe06f('0x32')](_0x5257f4['query'],_0x175d1d[_0xe06f('0x31')]));if(_0x5257f4['query'][_0xe06f('0x33')]){_0x1f7e00[_0xe06f('0x34')]=_['merge'](_0x1f7e00[_0xe06f('0x34')],{'$or':_[_0xe06f('0x20')](_0x1f7e00[_0xe06f('0x2b')],function(_0x194da7){var _0x57971a={};_0x57971a[_0x194da7]={'$like':'%'+_0x5257f4[_0xe06f('0x27')][_0xe06f('0x33')]+'%'};return _0x57971a;})});}_0x1f7e00=_[_0xe06f('0x35')]({},_0x1f7e00,_0x5257f4['options']);return _0x422505[_0xe06f('0x44')](_0x1f7e00);}})[_0xe06f('0x38')](function(_0x2bca98){if(_0x2bca98){_0x84e4fa=_0x2bca98[_0xe06f('0x2c')];if(!_0x5257f4[_0xe06f('0x27')][_0xe06f('0x2d')]('nolimit')){_0x1f7e00[_0xe06f('0x19')]=qs[_0xe06f('0x19')](_0x5257f4[_0xe06f('0x27')][_0xe06f('0x19')]);_0x1f7e00[_0xe06f('0x1a')]=qs[_0xe06f('0x1a')](_0x5257f4[_0xe06f('0x27')][_0xe06f('0x1a')]);}return _0x422505['getFields'](_0x1f7e00);}})['then'](function(_0x14189a){if(_0x14189a){return _0x14189a?{'count':_0x84e4fa,'rows':_0x14189a}:null;}})['then'](respondWithResult(_0x44372a,null))[_0xe06f('0x3b')](handleError(_0x44372a,null));};exports['getSubjects']=function(_0x14977a,_0x28dab6,_0x52eec5){var _0x48759c={};var _0x3f4569={};var _0x5cb67d;var _0x375950;return db[_0xe06f('0x21')][_0xe06f('0x45')]({'where':{'id':_0x14977a[_0xe06f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x28dab6,null))[_0xe06f('0x38')](function(_0x452089){if(_0x452089){_0x5cb67d=_0x452089;_0x3f4569[_0xe06f('0x26')]=_[_0xe06f('0x28')](db[_0xe06f('0x46')]['rawAttributes']);_0x3f4569[_0xe06f('0x27')]=_['keys'](_0x14977a[_0xe06f('0x27')]);_0x3f4569[_0xe06f('0x31')]=_[_0xe06f('0x29')](_0x3f4569[_0xe06f('0x26')],_0x3f4569['query']);_0x48759c[_0xe06f('0x2b')]=_['intersection'](_0x3f4569['model'],qs[_0xe06f('0x2a')](_0x14977a[_0xe06f('0x27')][_0xe06f('0x2a')]));_0x48759c[_0xe06f('0x2b')]=_0x48759c[_0xe06f('0x2b')]['length']?_0x48759c[_0xe06f('0x2b')]:_0x3f4569['model'];_0x48759c[_0xe06f('0x2f')]=qs[_0xe06f('0x30')](_0x14977a[_0xe06f('0x27')][_0xe06f('0x30')]);_0x48759c[_0xe06f('0x34')]=qs[_0xe06f('0x31')](_[_0xe06f('0x32')](_0x14977a[_0xe06f('0x27')],_0x3f4569[_0xe06f('0x31')]));if(_0x14977a[_0xe06f('0x27')][_0xe06f('0x33')]){_0x48759c[_0xe06f('0x34')]=_[_0xe06f('0x35')](_0x48759c[_0xe06f('0x34')],{'$or':_['map'](_0x48759c[_0xe06f('0x2b')],function(_0x5d98b1){var _0x25da06={};_0x25da06[_0x5d98b1]={'$like':'%'+_0x14977a['query'][_0xe06f('0x33')]+'%'};return _0x25da06;})});}_0x48759c=_[_0xe06f('0x35')]({},_0x48759c,_0x14977a[_0xe06f('0x37')]);return _0x5cb67d[_0xe06f('0x47')](_0x48759c);}})['then'](function(_0x2ad548){if(_0x2ad548){_0x375950=_0x2ad548[_0xe06f('0x2c')];if(!_0x14977a[_0xe06f('0x27')]['hasOwnProperty']('nolimit')){_0x48759c['limit']=qs[_0xe06f('0x19')](_0x14977a[_0xe06f('0x27')]['limit']);_0x48759c[_0xe06f('0x1a')]=qs[_0xe06f('0x1a')](_0x14977a['query'][_0xe06f('0x1a')]);}return _0x5cb67d[_0xe06f('0x47')](_0x48759c);}})['then'](function(_0x4eb985){if(_0x4eb985){return _0x4eb985?{'count':_0x375950,'rows':_0x4eb985}:null;}})['then'](respondWithResult(_0x28dab6,null))['catch'](handleError(_0x28dab6,null));};exports[_0xe06f('0x48')]=function(_0x4ae619,_0x44d53b,_0x2d68fc){var _0x16752d={};var _0x5a519a={};var _0x1db6f0;var _0x2e6f10;return db['SalesforceConfiguration'][_0xe06f('0x45')]({'where':{'id':_0x4ae619[_0xe06f('0x3d')]['id']}})[_0xe06f('0x38')](handleEntityNotFound(_0x44d53b,null))['then'](function(_0x371d9c){if(_0x371d9c){_0x1db6f0=_0x371d9c;_0x5a519a[_0xe06f('0x26')]=_[_0xe06f('0x28')](db['SalesforceField'][_0xe06f('0x22')]);_0x5a519a[_0xe06f('0x27')]=_[_0xe06f('0x28')](_0x4ae619[_0xe06f('0x27')]);_0x5a519a[_0xe06f('0x31')]=_[_0xe06f('0x29')](_0x5a519a[_0xe06f('0x26')],_0x5a519a[_0xe06f('0x27')]);_0x16752d[_0xe06f('0x2b')]=_[_0xe06f('0x29')](_0x5a519a[_0xe06f('0x26')],qs['fields'](_0x4ae619[_0xe06f('0x27')][_0xe06f('0x2a')]));_0x16752d[_0xe06f('0x2b')]=_0x16752d['attributes']['length']?_0x16752d[_0xe06f('0x2b')]:_0x5a519a['model'];_0x16752d[_0xe06f('0x2f')]=qs['sort'](_0x4ae619['query']['sort']);_0x16752d[_0xe06f('0x34')]=qs[_0xe06f('0x31')](_['pick'](_0x4ae619['query'],_0x5a519a['filters']));if(_0x4ae619['query'][_0xe06f('0x33')]){_0x16752d[_0xe06f('0x34')]=_[_0xe06f('0x35')](_0x16752d[_0xe06f('0x34')],{'$or':_[_0xe06f('0x20')](_0x16752d[_0xe06f('0x2b')],function(_0x5a109b){var _0x11cacd={};_0x11cacd[_0x5a109b]={'$like':'%'+_0x4ae619['query'][_0xe06f('0x33')]+'%'};return _0x11cacd;})});}_0x16752d=_[_0xe06f('0x35')]({},_0x16752d,_0x4ae619[_0xe06f('0x37')]);return _0x1db6f0[_0xe06f('0x48')](_0x16752d);}})[_0xe06f('0x38')](function(_0x2db88d){if(_0x2db88d){_0x2e6f10=_0x2db88d[_0xe06f('0x2c')];if(!_0x4ae619[_0xe06f('0x27')][_0xe06f('0x2d')](_0xe06f('0x2e'))){_0x16752d[_0xe06f('0x19')]=qs['limit'](_0x4ae619['query'][_0xe06f('0x19')]);_0x16752d[_0xe06f('0x1a')]=qs[_0xe06f('0x1a')](_0x4ae619['query'][_0xe06f('0x1a')]);}return _0x1db6f0[_0xe06f('0x48')](_0x16752d);}})[_0xe06f('0x38')](function(_0x58a222){if(_0x58a222){return _0x58a222?{'count':_0x2e6f10,'rows':_0x58a222}:null;}})[_0xe06f('0x38')](respondWithResult(_0x44d53b,null))['catch'](handleError(_0x44d53b,null));}; \ No newline at end of file +var _0x5977=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','reject','save','destroy','then','end','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','rows','catch','show','merge','find','create','body','params','getFields','findOne','order','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x5977,0xe1));var _0x7597=function(_0x2a848a,_0x307cdf){_0x2a848a=_0x2a848a-0x0;var _0x4b2981=_0x5977[_0x2a848a];return _0x4b2981;};'use strict';var emlformat=require(_0x7597('0x0'));var rimraf=require(_0x7597('0x1'));var zipdir=require(_0x7597('0x2'));var jsonpatch=require(_0x7597('0x3'));var rp=require('request-promise');var moment=require(_0x7597('0x4'));var BPromise=require(_0x7597('0x5'));var Mustache=require(_0x7597('0x6'));var util=require('util');var path=require(_0x7597('0x7'));var sox=require(_0x7597('0x8'));var csv=require(_0x7597('0x9'));var ejs=require(_0x7597('0xa'));var fs=require('fs');var fs_extra=require(_0x7597('0xb'));var _=require(_0x7597('0xc'));var squel=require(_0x7597('0xd'));var crypto=require(_0x7597('0xe'));var jsforce=require(_0x7597('0xf'));var deskjs=require(_0x7597('0x10'));var toCsv=require(_0x7597('0x9'));var querystring=require('querystring');var Papa=require(_0x7597('0x11'));var Redis=require(_0x7597('0x12'));var authService=require(_0x7597('0x13'));var qs=require(_0x7597('0x14'));var as=require(_0x7597('0x15'));var hardwareService=require(_0x7597('0x16'));var logger=require(_0x7597('0x17'))(_0x7597('0x18'));var utils=require(_0x7597('0x19'));var config=require(_0x7597('0x1a'));var licenseUtil=require(_0x7597('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x431724,_0x15b072){_0x15b072=_0x15b072||0xcc;return function(_0x2cfc09){if(_0x2cfc09){return _0x431724[_0x7597('0x1c')](_0x15b072);}return _0x431724[_0x7597('0x1d')](_0x15b072)['end']();};}function respondWithResult(_0x291978,_0x4efc9f){_0x4efc9f=_0x4efc9f||0xc8;return function(_0x4c6cc4){if(_0x4c6cc4){return _0x291978[_0x7597('0x1d')](_0x4efc9f)[_0x7597('0x1e')](_0x4c6cc4);}};}function respondWithFilteredResult(_0x387173,_0xea93e0){return function(_0xec7ea9){if(_0xec7ea9){var _0x3ca8da=typeof _0xea93e0[_0x7597('0x1f')]===_0x7597('0x20')&&typeof _0xea93e0['limit']==='undefined';var _0x24be0d=_0xec7ea9['count'];var _0x2286ee=_0x3ca8da?0x0:_0xea93e0[_0x7597('0x1f')];var _0x476c27=_0x3ca8da?_0xec7ea9[_0x7597('0x21')]:_0xea93e0[_0x7597('0x1f')]+_0xea93e0['limit'];var _0x999219;if(_0x476c27>=_0x24be0d){_0x476c27=_0x24be0d;_0x999219=0xc8;}else{_0x999219=0xce;}_0x387173[_0x7597('0x1d')](_0x999219);return _0x387173[_0x7597('0x22')]('Content-Range',_0x2286ee+'-'+_0x476c27+'/'+_0x24be0d)[_0x7597('0x1e')](_0xec7ea9);}return null;};}function patchUpdates(_0x29b24c){return function(_0x433197){try{jsonpatch['apply'](_0x433197,_0x29b24c,!![]);}catch(_0x53d345){return BPromise[_0x7597('0x23')](_0x53d345);}return _0x433197[_0x7597('0x24')]();};}function saveUpdates(_0x518a82,_0x5c6cfb){return function(_0x373e03){if(_0x373e03){return _0x373e03['update'](_0x518a82)['then'](function(_0x5b406c){return _0x5b406c;});}return null;};}function removeEntity(_0x52acc9,_0x1e7597){return function(_0x323857){if(_0x323857){return _0x323857[_0x7597('0x25')]()[_0x7597('0x26')](function(){_0x52acc9[_0x7597('0x1d')](0xcc)[_0x7597('0x27')]();});}};}function handleEntityNotFound(_0x45bf4f,_0x1e4e01){return function(_0x1b938f){if(!_0x1b938f){_0x45bf4f[_0x7597('0x1c')](0x194);}return _0x1b938f;};}function handleError(_0x5c36ef,_0x39ff19){_0x39ff19=_0x39ff19||0x1f4;return function(_0xb00490){logger[_0x7597('0x28')](_0xb00490[_0x7597('0x29')]);if(_0xb00490[_0x7597('0x2a')]){delete _0xb00490[_0x7597('0x2a')];}_0x5c36ef['status'](_0x39ff19)[_0x7597('0x2b')](_0xb00490);};}exports[_0x7597('0x2c')]=function(_0x51f9d4,_0x33edee){var _0x3dc28c={},_0x2ee6cf={},_0x342519={'count':0x0,'rows':[]};var _0x5aec86=_['map'](db[_0x7597('0x2d')][_0x7597('0x2e')],function(_0x2748b0){return{'name':_0x2748b0['fieldName'],'type':_0x2748b0[_0x7597('0x2f')][_0x7597('0x30')]};});_0x2ee6cf['model']=_[_0x7597('0x31')](_0x5aec86,_0x7597('0x2a'));_0x2ee6cf[_0x7597('0x32')]=_[_0x7597('0x33')](_0x51f9d4[_0x7597('0x32')]);_0x2ee6cf[_0x7597('0x34')]=_['intersection'](_0x2ee6cf[_0x7597('0x35')],_0x2ee6cf[_0x7597('0x32')]);_0x3dc28c[_0x7597('0x36')]=_[_0x7597('0x37')](_0x2ee6cf[_0x7597('0x35')],qs[_0x7597('0x38')](_0x51f9d4['query'][_0x7597('0x38')]));_0x3dc28c[_0x7597('0x36')]=_0x3dc28c[_0x7597('0x36')][_0x7597('0x39')]?_0x3dc28c[_0x7597('0x36')]:_0x2ee6cf[_0x7597('0x35')];if(!_0x51f9d4[_0x7597('0x32')][_0x7597('0x3a')](_0x7597('0x3b'))){_0x3dc28c[_0x7597('0x3c')]=qs[_0x7597('0x3c')](_0x51f9d4['query'][_0x7597('0x3c')]);_0x3dc28c[_0x7597('0x1f')]=qs[_0x7597('0x1f')](_0x51f9d4['query'][_0x7597('0x1f')]);}_0x3dc28c['order']=qs[_0x7597('0x3d')](_0x51f9d4[_0x7597('0x32')]['sort']);_0x3dc28c[_0x7597('0x3e')]=qs[_0x7597('0x34')](_[_0x7597('0x3f')](_0x51f9d4[_0x7597('0x32')],_0x2ee6cf['filters']),_0x5aec86);if(_0x51f9d4[_0x7597('0x32')]['filter']){_0x3dc28c[_0x7597('0x3e')]=_['merge'](_0x3dc28c[_0x7597('0x3e')],{'$or':_[_0x7597('0x31')](_0x5aec86,function(_0x2b577e){if(_0x2b577e[_0x7597('0x2f')]!==_0x7597('0x40')){var _0x272b54={};_0x272b54[_0x2b577e[_0x7597('0x2a')]]={'$like':'%'+_0x51f9d4['query'][_0x7597('0x41')]+'%'};return _0x272b54;}})});}_0x3dc28c=_['merge']({},_0x3dc28c,_0x51f9d4[_0x7597('0x42')]);var _0xd4cf9d={'where':_0x3dc28c[_0x7597('0x3e')]};return db[_0x7597('0x2d')][_0x7597('0x21')](_0xd4cf9d)[_0x7597('0x26')](function(_0x27e158){_0x342519[_0x7597('0x21')]=_0x27e158;if(_0x51f9d4[_0x7597('0x32')][_0x7597('0x43')]){_0x3dc28c[_0x7597('0x44')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x3dc28c);})[_0x7597('0x26')](function(_0x42161a){_0x342519[_0x7597('0x45')]=_0x42161a;return _0x342519;})[_0x7597('0x26')](respondWithFilteredResult(_0x33edee,_0x3dc28c))[_0x7597('0x46')](handleError(_0x33edee,null));};exports[_0x7597('0x47')]=function(_0x3389ae,_0x522f21){var _0x1325f9={'raw':![],'where':{'id':_0x3389ae['params']['id']}},_0x2e36e0={};_0x2e36e0['model']=_[_0x7597('0x33')](db[_0x7597('0x2d')][_0x7597('0x2e')]);_0x2e36e0[_0x7597('0x32')]=_['keys'](_0x3389ae['query']);_0x2e36e0['filters']=_[_0x7597('0x37')](_0x2e36e0[_0x7597('0x35')],_0x2e36e0[_0x7597('0x32')]);_0x1325f9[_0x7597('0x36')]=_[_0x7597('0x37')](_0x2e36e0[_0x7597('0x35')],qs['fields'](_0x3389ae[_0x7597('0x32')][_0x7597('0x38')]));_0x1325f9[_0x7597('0x36')]=_0x1325f9[_0x7597('0x36')]['length']?_0x1325f9[_0x7597('0x36')]:_0x2e36e0['model'];if(_0x3389ae[_0x7597('0x32')]['includeAll']){_0x1325f9['include']=[{'all':!![]}];}_0x1325f9=_[_0x7597('0x48')]({},_0x1325f9,_0x3389ae[_0x7597('0x42')]);return db[_0x7597('0x2d')][_0x7597('0x49')](_0x1325f9)['then'](handleEntityNotFound(_0x522f21,null))['then'](respondWithResult(_0x522f21,null))['catch'](handleError(_0x522f21,null));};exports[_0x7597('0x4a')]=function(_0x35fffd,_0x390f2e){return db['SalesforceConfiguration'][_0x7597('0x4a')](_0x35fffd['body'],{})['then'](respondWithResult(_0x390f2e,0xc9))[_0x7597('0x46')](handleError(_0x390f2e,null));};exports['update']=function(_0x4538a0,_0x2f28f3){if(_0x4538a0[_0x7597('0x4b')]['id']){delete _0x4538a0['body']['id'];}return db[_0x7597('0x2d')][_0x7597('0x49')]({'where':{'id':_0x4538a0[_0x7597('0x4c')]['id']}})[_0x7597('0x26')](handleEntityNotFound(_0x2f28f3,null))[_0x7597('0x26')](saveUpdates(_0x4538a0[_0x7597('0x4b')],null))[_0x7597('0x26')](respondWithResult(_0x2f28f3,null))[_0x7597('0x46')](handleError(_0x2f28f3,null));};exports['destroy']=function(_0x4c2c17,_0x3e659a){return db[_0x7597('0x2d')][_0x7597('0x49')]({'where':{'id':_0x4c2c17['params']['id']}})[_0x7597('0x26')](handleEntityNotFound(_0x3e659a,null))[_0x7597('0x26')](removeEntity(_0x3e659a,null))['catch'](handleError(_0x3e659a,null));};exports[_0x7597('0x4d')]=function(_0x4ca270,_0x3be6c9,_0x526f6f){var _0x2331f4={};var _0x298dba={};var _0x326a0c;var _0x34a330;return db[_0x7597('0x2d')][_0x7597('0x4e')]({'where':{'id':_0x4ca270['params']['id']}})[_0x7597('0x26')](handleEntityNotFound(_0x3be6c9,null))[_0x7597('0x26')](function(_0x57c8b2){if(_0x57c8b2){_0x326a0c=_0x57c8b2;_0x298dba[_0x7597('0x35')]=_[_0x7597('0x33')](db['SalesforceField'][_0x7597('0x2e')]);_0x298dba[_0x7597('0x32')]=_[_0x7597('0x33')](_0x4ca270[_0x7597('0x32')]);_0x298dba[_0x7597('0x34')]=_[_0x7597('0x37')](_0x298dba[_0x7597('0x35')],_0x298dba['query']);_0x2331f4['attributes']=_['intersection'](_0x298dba[_0x7597('0x35')],qs['fields'](_0x4ca270['query'][_0x7597('0x38')]));_0x2331f4[_0x7597('0x36')]=_0x2331f4[_0x7597('0x36')][_0x7597('0x39')]?_0x2331f4[_0x7597('0x36')]:_0x298dba[_0x7597('0x35')];_0x2331f4[_0x7597('0x4f')]=qs[_0x7597('0x3d')](_0x4ca270[_0x7597('0x32')][_0x7597('0x3d')]);_0x2331f4['where']=qs[_0x7597('0x34')](_[_0x7597('0x3f')](_0x4ca270[_0x7597('0x32')],_0x298dba[_0x7597('0x34')]));if(_0x4ca270[_0x7597('0x32')][_0x7597('0x41')]){_0x2331f4[_0x7597('0x3e')]=_[_0x7597('0x48')](_0x2331f4[_0x7597('0x3e')],{'$or':_[_0x7597('0x31')](_0x2331f4[_0x7597('0x36')],function(_0x17e0d6){var _0x3e9f85={};_0x3e9f85[_0x17e0d6]={'$like':'%'+_0x4ca270[_0x7597('0x32')][_0x7597('0x41')]+'%'};return _0x3e9f85;})});}_0x2331f4=_[_0x7597('0x48')]({},_0x2331f4,_0x4ca270[_0x7597('0x42')]);return _0x326a0c[_0x7597('0x4d')](_0x2331f4);}})['then'](function(_0x5c3b02){if(_0x5c3b02){_0x34a330=_0x5c3b02[_0x7597('0x39')];if(!_0x4ca270[_0x7597('0x32')]['hasOwnProperty']('nolimit')){_0x2331f4[_0x7597('0x3c')]=qs['limit'](_0x4ca270[_0x7597('0x32')][_0x7597('0x3c')]);_0x2331f4['offset']=qs[_0x7597('0x1f')](_0x4ca270[_0x7597('0x32')][_0x7597('0x1f')]);}return _0x326a0c['getFields'](_0x2331f4);}})['then'](function(_0x401cfb){if(_0x401cfb){return _0x401cfb?{'count':_0x34a330,'rows':_0x401cfb}:null;}})['then'](respondWithResult(_0x3be6c9,null))[_0x7597('0x46')](handleError(_0x3be6c9,null));};exports[_0x7597('0x50')]=function(_0x24d478,_0x5444b2,_0x28a8fe){var _0x5c766c={};var _0x10c4ff={};var _0x3281f3;var _0x1727bd;return db[_0x7597('0x2d')][_0x7597('0x4e')]({'where':{'id':_0x24d478['params']['id']}})[_0x7597('0x26')](handleEntityNotFound(_0x5444b2,null))['then'](function(_0x290c9c){if(_0x290c9c){_0x3281f3=_0x290c9c;_0x10c4ff[_0x7597('0x35')]=_[_0x7597('0x33')](db[_0x7597('0x51')][_0x7597('0x2e')]);_0x10c4ff[_0x7597('0x32')]=_['keys'](_0x24d478[_0x7597('0x32')]);_0x10c4ff[_0x7597('0x34')]=_[_0x7597('0x37')](_0x10c4ff[_0x7597('0x35')],_0x10c4ff[_0x7597('0x32')]);_0x5c766c[_0x7597('0x36')]=_['intersection'](_0x10c4ff[_0x7597('0x35')],qs[_0x7597('0x38')](_0x24d478[_0x7597('0x32')][_0x7597('0x38')]));_0x5c766c[_0x7597('0x36')]=_0x5c766c['attributes'][_0x7597('0x39')]?_0x5c766c[_0x7597('0x36')]:_0x10c4ff['model'];_0x5c766c[_0x7597('0x4f')]=qs[_0x7597('0x3d')](_0x24d478[_0x7597('0x32')]['sort']);_0x5c766c[_0x7597('0x3e')]=qs[_0x7597('0x34')](_['pick'](_0x24d478[_0x7597('0x32')],_0x10c4ff[_0x7597('0x34')]));if(_0x24d478[_0x7597('0x32')][_0x7597('0x41')]){_0x5c766c['where']=_['merge'](_0x5c766c[_0x7597('0x3e')],{'$or':_[_0x7597('0x31')](_0x5c766c[_0x7597('0x36')],function(_0x11b560){var _0x996012={};_0x996012[_0x11b560]={'$like':'%'+_0x24d478[_0x7597('0x32')]['filter']+'%'};return _0x996012;})});}_0x5c766c=_[_0x7597('0x48')]({},_0x5c766c,_0x24d478[_0x7597('0x42')]);return _0x3281f3[_0x7597('0x50')](_0x5c766c);}})[_0x7597('0x26')](function(_0x4e76af){if(_0x4e76af){_0x1727bd=_0x4e76af[_0x7597('0x39')];if(!_0x24d478[_0x7597('0x32')][_0x7597('0x3a')](_0x7597('0x3b'))){_0x5c766c[_0x7597('0x3c')]=qs[_0x7597('0x3c')](_0x24d478[_0x7597('0x32')][_0x7597('0x3c')]);_0x5c766c['offset']=qs[_0x7597('0x1f')](_0x24d478[_0x7597('0x32')]['offset']);}return _0x3281f3[_0x7597('0x50')](_0x5c766c);}})[_0x7597('0x26')](function(_0x2d925f){if(_0x2d925f){return _0x2d925f?{'count':_0x1727bd,'rows':_0x2d925f}:null;}})['then'](respondWithResult(_0x5444b2,null))[_0x7597('0x46')](handleError(_0x5444b2,null));};exports['getDescriptions']=function(_0x177e93,_0xc0211a,_0x2d94ab){var _0x4e96d3={};var _0x1efd64={};var _0x35556d;var _0x9dbd69;return db['SalesforceConfiguration'][_0x7597('0x4e')]({'where':{'id':_0x177e93['params']['id']}})[_0x7597('0x26')](handleEntityNotFound(_0xc0211a,null))['then'](function(_0x582717){if(_0x582717){_0x35556d=_0x582717;_0x1efd64['model']=_[_0x7597('0x33')](db[_0x7597('0x51')][_0x7597('0x2e')]);_0x1efd64[_0x7597('0x32')]=_['keys'](_0x177e93['query']);_0x1efd64[_0x7597('0x34')]=_[_0x7597('0x37')](_0x1efd64['model'],_0x1efd64['query']);_0x4e96d3[_0x7597('0x36')]=_[_0x7597('0x37')](_0x1efd64['model'],qs[_0x7597('0x38')](_0x177e93[_0x7597('0x32')][_0x7597('0x38')]));_0x4e96d3[_0x7597('0x36')]=_0x4e96d3[_0x7597('0x36')][_0x7597('0x39')]?_0x4e96d3['attributes']:_0x1efd64[_0x7597('0x35')];_0x4e96d3[_0x7597('0x4f')]=qs['sort'](_0x177e93[_0x7597('0x32')][_0x7597('0x3d')]);_0x4e96d3[_0x7597('0x3e')]=qs['filters'](_['pick'](_0x177e93[_0x7597('0x32')],_0x1efd64[_0x7597('0x34')]));if(_0x177e93[_0x7597('0x32')][_0x7597('0x41')]){_0x4e96d3[_0x7597('0x3e')]=_[_0x7597('0x48')](_0x4e96d3[_0x7597('0x3e')],{'$or':_[_0x7597('0x31')](_0x4e96d3['attributes'],function(_0x30e864){var _0x433934={};_0x433934[_0x30e864]={'$like':'%'+_0x177e93[_0x7597('0x32')][_0x7597('0x41')]+'%'};return _0x433934;})});}_0x4e96d3=_[_0x7597('0x48')]({},_0x4e96d3,_0x177e93['options']);return _0x35556d[_0x7597('0x52')](_0x4e96d3);}})[_0x7597('0x26')](function(_0x559b72){if(_0x559b72){_0x9dbd69=_0x559b72['length'];if(!_0x177e93[_0x7597('0x32')][_0x7597('0x3a')]('nolimit')){_0x4e96d3['limit']=qs[_0x7597('0x3c')](_0x177e93[_0x7597('0x32')][_0x7597('0x3c')]);_0x4e96d3['offset']=qs[_0x7597('0x1f')](_0x177e93[_0x7597('0x32')][_0x7597('0x1f')]);}return _0x35556d['getDescriptions'](_0x4e96d3);}})[_0x7597('0x26')](function(_0x3fd0c0){if(_0x3fd0c0){return _0x3fd0c0?{'count':_0x9dbd69,'rows':_0x3fd0c0}:null;}})[_0x7597('0x26')](respondWithResult(_0xc0211a,null))[_0x7597('0x46')](handleError(_0xc0211a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4264c4f..0b3e0c1 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 _0x2330=['../../config/environment','exports','SalesforceConfiguration','lodash','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x2758ff,_0x4895f1){var _0x1b88a8=function(_0x4f94e2){while(--_0x4f94e2){_0x2758ff['push'](_0x2758ff['shift']());}};_0x1b88a8(++_0x4895f1);}(_0x2330,0x11a));var _0x0233=function(_0x4224fb,_0x14a58a){_0x4224fb=_0x4224fb-0x0;var _0x2a4154=_0x2330[_0x4224fb];return _0x2a4154;};'use strict';var _=require(_0x0233('0x0'));var util=require('util');var logger=require(_0x0233('0x1'))('api');var moment=require(_0x0233('0x2'));var BPromise=require('bluebird');var rp=require(_0x0233('0x3'));var fs=require('fs');var path=require(_0x0233('0x4'));var rimraf=require(_0x0233('0x5'));var config=require(_0x0233('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x0233('0x7')]=function(_0x16bef9,_0xabab54){return _0x16bef9['define'](_0x0233('0x8'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a8f=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x16d82f,_0x43a906){var _0xe9d6f2=function(_0x5da40e){while(--_0x5da40e){_0x16d82f['push'](_0x16d82f['shift']());}};_0xe9d6f2(++_0x43a906);}(_0x0a8f,0xe3));var _0xf0a8=function(_0x3be94b,_0x115c2f){_0x3be94b=_0x3be94b-0x0;var _0x1964ec=_0x0a8f[_0x3be94b];return _0x1964ec;};'use strict';var _=require(_0xf0a8('0x0'));var util=require('util');var logger=require(_0xf0a8('0x1'))(_0xf0a8('0x2'));var moment=require(_0xf0a8('0x3'));var BPromise=require(_0xf0a8('0x4'));var rp=require(_0xf0a8('0x5'));var fs=require('fs');var path=require(_0xf0a8('0x6'));var rimraf=require(_0xf0a8('0x7'));var config=require(_0xf0a8('0x8'));var attributes=require(_0xf0a8('0x9'));module['exports']=function(_0x2e32c9,_0x1ae451){return _0x2e32c9['define']('SalesforceConfiguration',attributes,{'tableName':_0xf0a8('0xa'),'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 f5abfa9..80811f1 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 _0xc678=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc678,0x73));var _0x8c67=function(_0x23d606,_0x4fea14){_0x23d606=_0x23d606-0x0;var _0x5bff8f=_0xc678[_0x23d606];return _0x5bff8f;};'use strict';var _=require(_0x8c67('0x0'));var util=require('util');var moment=require(_0x8c67('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require(_0x8c67('0x3'));var db=require(_0x8c67('0x4'))['db'];var utils=require(_0x8c67('0x5'));var logger=require(_0x8c67('0x6'))('rpc');var config=require(_0x8c67('0x7'));var jayson=require(_0x8c67('0x8'));var client=jayson[_0x8c67('0x9')][_0x8c67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5cf01,_0x2f5a2c,_0x3905cb){return new BPromise(function(_0x5341d6,_0x1cd357){return client['request'](_0xe5cf01,_0x3905cb)[_0x8c67('0xb')](function(_0x32877b){logger[_0x8c67('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2f5a2c,'request\x20sent');logger[_0x8c67('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x2f5a2c,_0x8c67('0xe'),JSON['stringify'](_0x32877b));if(_0x32877b[_0x8c67('0xf')]){if(_0x32877b[_0x8c67('0xf')][_0x8c67('0x10')]===0x1f4){logger[_0x8c67('0xf')](_0x8c67('0x11'),_0x2f5a2c,_0x32877b['error'][_0x8c67('0x12')]);return _0x1cd357(_0x32877b[_0x8c67('0xf')][_0x8c67('0x12')]);}logger[_0x8c67('0xf')](_0x8c67('0x11'),_0x2f5a2c,_0x32877b[_0x8c67('0xf')]['message']);return _0x5341d6(_0x32877b[_0x8c67('0xf')][_0x8c67('0x12')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x2f5a2c,_0x8c67('0xe'));_0x5341d6(_0x32877b[_0x8c67('0x13')]['message']);}})['catch'](function(_0x3fa1c0){logger[_0x8c67('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2f5a2c,_0x3fa1c0);_0x1cd357(_0x3fa1c0);});});} \ No newline at end of file +var _0x2828=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0x2828,0x1b6));var _0x8282=function(_0x1ec1b8,_0x4e3651){_0x1ec1b8=_0x1ec1b8-0x0;var _0x4d0f2c=_0x2828[_0x1ec1b8];return _0x4d0f2c;};'use strict';var _=require(_0x8282('0x0'));var util=require(_0x8282('0x1'));var moment=require(_0x8282('0x2'));var BPromise=require(_0x8282('0x3'));var rs=require(_0x8282('0x4'));var fs=require('fs');var Redis=require(_0x8282('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8282('0x6'));var logger=require(_0x8282('0x7'))(_0x8282('0x8'));var config=require(_0x8282('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8282('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7db8,_0x3d08a5,_0x1d5dbc){return new BPromise(function(_0x3fb16f,_0x49b4e2){return client['request'](_0x4d7db8,_0x1d5dbc)[_0x8282('0xb')](function(_0xa0b169){logger[_0x8282('0xc')](_0x8282('0xd'),_0x3d08a5,_0x8282('0xe'));logger[_0x8282('0xf')](_0x8282('0x10'),_0x3d08a5,_0x8282('0xe'),JSON[_0x8282('0x11')](_0xa0b169));if(_0xa0b169[_0x8282('0x12')]){if(_0xa0b169[_0x8282('0x12')]['code']===0x1f4){logger[_0x8282('0x12')](_0x8282('0xd'),_0x3d08a5,_0xa0b169[_0x8282('0x12')][_0x8282('0x13')]);return _0x49b4e2(_0xa0b169[_0x8282('0x12')][_0x8282('0x13')]);}logger['error'](_0x8282('0xd'),_0x3d08a5,_0xa0b169[_0x8282('0x12')]['message']);return _0x3fb16f(_0xa0b169[_0x8282('0x12')]['message']);}else{logger['info'](_0x8282('0xd'),_0x3d08a5,_0x8282('0xe'));_0x3fb16f(_0xa0b169[_0x8282('0x14')][_0x8282('0x13')]);}})['catch'](function(_0x340b0f){logger[_0x8282('0x12')](_0x8282('0xd'),_0x3d08a5,_0x340b0f);_0x49b4e2(_0x340b0f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index acbb4dd..3ccbdf2 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 _0x7271=['./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x25757a,_0x49cfe0){var _0x15caf4=function(_0xc8388a){while(--_0xc8388a){_0x25757a['push'](_0x25757a['shift']());}};_0x15caf4(++_0x49cfe0);}(_0x7271,0x199));var _0x1727=function(_0x1b2b96,_0x306f1e){_0x1b2b96=_0x1b2b96-0x0;var _0x183c84=_0x7271[_0x1b2b96];return _0x183c84;};'use strict';var multer=require(_0x1727('0x0'));var util=require('util');var path=require(_0x1727('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1727('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1727('0x3'));var config=require(_0x1727('0x4'));var controller=require(_0x1727('0x5'));router[_0x1727('0x6')]('/',auth[_0x1727('0x7')](),controller[_0x1727('0x8')]);router[_0x1727('0x6')](_0x1727('0x9'),auth[_0x1727('0x7')](),controller[_0x1727('0xa')]);router[_0x1727('0xb')]('/',auth['isAuthenticated'](),controller[_0x1727('0xc')]);router[_0x1727('0xd')]('/:id',auth[_0x1727('0x7')](),controller[_0x1727('0xe')]);router[_0x1727('0xf')](_0x1727('0x9'),auth[_0x1727('0x7')](),controller[_0x1727('0x10')]);module[_0x1727('0x11')]=router; \ No newline at end of file +var _0x3569=['../../components/auth/service','get','isAuthenticated','index','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xceaf07,_0x1ba898){var _0x379aea=function(_0x1b0032){while(--_0x1b0032){_0xceaf07['push'](_0xceaf07['shift']());}};_0x379aea(++_0x1ba898);}(_0x3569,0xba));var _0x9356=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0x3569[_0x5e6d65];return _0x5e1f75;};'use strict';var multer=require(_0x9356('0x0'));var util=require(_0x9356('0x1'));var path=require(_0x9356('0x2'));var timeout=require(_0x9356('0x3'));var express=require(_0x9356('0x4'));var router=express[_0x9356('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9356('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x9356('0x7')]('/',auth[_0x9356('0x8')](),controller[_0x9356('0x9')]);router[_0x9356('0x7')]('/:id',auth[_0x9356('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9356('0xa')]);router[_0x9356('0xb')](_0x9356('0xc'),auth[_0x9356('0x8')](),controller[_0x9356('0xd')]);router['delete'](_0x9356('0xc'),auth[_0x9356('0x8')](),controller[_0x9356('0xe')]);module[_0x9356('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 03659e2..958d61e 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 _0xcf04=['variable','exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x28d2d2,_0x5723e5){var _0x41a8db=function(_0x54bf80){while(--_0x54bf80){_0x28d2d2['push'](_0x28d2d2['shift']());}};_0x41a8db(++_0x5723e5);}(_0xcf04,0x1a1));var _0x4cf0=function(_0x515306,_0x13149c){_0x515306=_0x515306-0x0;var _0x302173=_0xcf04[_0x515306];return _0x302173;};'use strict';var Sequelize=require('sequelize');module[_0x4cf0('0x0')]={'type':{'type':Sequelize[_0x4cf0('0x1')]('string','variable',_0x4cf0('0x2'),_0x4cf0('0x3'),_0x4cf0('0x4')),'defaultValue':_0x4cf0('0x5')},'content':{'type':Sequelize[_0x4cf0('0x6')]},'key':{'type':Sequelize[_0x4cf0('0x6')]},'keyType':{'type':Sequelize[_0x4cf0('0x1')](_0x4cf0('0x5'),_0x4cf0('0x7'),_0x4cf0('0x2'))},'keyContent':{'type':Sequelize[_0x4cf0('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x4cf0('0x6')]}}; \ No newline at end of file +var _0x07e6=['STRING','sequelize','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3d41ce,_0xef34a8){var _0x170f11=function(_0x2bfd9b){while(--_0x2bfd9b){_0x3d41ce['push'](_0x3d41ce['shift']());}};_0x170f11(++_0xef34a8);}(_0x07e6,0x1a1));var _0x607e=function(_0x4935c9,_0x311de8){_0x4935c9=_0x4935c9-0x0;var _0x155eb5=_0x07e6[_0x4935c9];return _0x155eb5;};'use strict';var Sequelize=require(_0x607e('0x0'));module[_0x607e('0x1')]={'type':{'type':Sequelize[_0x607e('0x2')](_0x607e('0x3'),_0x607e('0x4'),_0x607e('0x5'),'keyValue',_0x607e('0x6')),'defaultValue':_0x607e('0x3')},'content':{'type':Sequelize[_0x607e('0x7')]},'key':{'type':Sequelize[_0x607e('0x7')]},'keyType':{'type':Sequelize[_0x607e('0x2')](_0x607e('0x3'),'variable',_0x607e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x607e('0x7')]},'variableName':{'type':Sequelize[_0x607e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6b6967c..0fbc641 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 _0x8086=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','send','index','rawAttributes','fieldName','type','model','map','filters','attributes','fields','query','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceField','rows','catch','show','params','intersection','length','includeAll','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce'];(function(_0x14b073,_0x2263f3){var _0x269a6=function(_0x559513){while(--_0x559513){_0x14b073['push'](_0x14b073['shift']());}};_0x269a6(++_0x2263f3);}(_0x8086,0x113));var _0x6808=function(_0x1bf173,_0x27a4fe){_0x1bf173=_0x1bf173-0x0;var _0x4eddf2=_0x8086[_0x1bf173];return _0x4eddf2;};'use strict';var emlformat=require(_0x6808('0x0'));var rimraf=require(_0x6808('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6808('0x2'));var rp=require(_0x6808('0x3'));var moment=require('moment');var BPromise=require(_0x6808('0x4'));var Mustache=require(_0x6808('0x5'));var util=require('util');var path=require(_0x6808('0x6'));var sox=require(_0x6808('0x7'));var csv=require(_0x6808('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6808('0x9'));var _=require(_0x6808('0xa'));var squel=require(_0x6808('0xb'));var crypto=require('crypto');var jsforce=require(_0x6808('0xc'));var deskjs=require(_0x6808('0xd'));var toCsv=require(_0x6808('0x8'));var querystring=require(_0x6808('0xe'));var Papa=require(_0x6808('0xf'));var Redis=require(_0x6808('0x10'));var authService=require(_0x6808('0x11'));var qs=require(_0x6808('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6808('0x13'));var logger=require(_0x6808('0x14'))('api');var utils=require(_0x6808('0x15'));var config=require(_0x6808('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6808('0x17'))['db'];function respondWithStatusCode(_0x22828f,_0x49da13){_0x49da13=_0x49da13||0xcc;return function(_0x3e38b6){if(_0x3e38b6){return _0x22828f[_0x6808('0x18')](_0x49da13);}return _0x22828f[_0x6808('0x19')](_0x49da13)[_0x6808('0x1a')]();};}function respondWithResult(_0x5a2dfa,_0xab11b3){_0xab11b3=_0xab11b3||0xc8;return function(_0x42046b){if(_0x42046b){return _0x5a2dfa[_0x6808('0x19')](_0xab11b3)['json'](_0x42046b);}};}function respondWithFilteredResult(_0x2a2036,_0x563d74){return function(_0x4d6e20){if(_0x4d6e20){var _0xaaeb90=typeof _0x563d74[_0x6808('0x1b')]===_0x6808('0x1c')&&typeof _0x563d74[_0x6808('0x1d')]===_0x6808('0x1c');var _0xb98c0d=_0x4d6e20[_0x6808('0x1e')];var _0x13eab6=_0xaaeb90?0x0:_0x563d74[_0x6808('0x1b')];var _0x420667=_0xaaeb90?_0x4d6e20[_0x6808('0x1e')]:_0x563d74[_0x6808('0x1b')]+_0x563d74[_0x6808('0x1d')];var _0xdc643;if(_0x420667>=_0xb98c0d){_0x420667=_0xb98c0d;_0xdc643=0xc8;}else{_0xdc643=0xce;}_0x2a2036['status'](_0xdc643);return _0x2a2036[_0x6808('0x1f')](_0x6808('0x20'),_0x13eab6+'-'+_0x420667+'/'+_0xb98c0d)[_0x6808('0x21')](_0x4d6e20);}return null;};}function patchUpdates(_0x3daa62){return function(_0x540f79){try{jsonpatch[_0x6808('0x22')](_0x540f79,_0x3daa62,!![]);}catch(_0x5955af){return BPromise['reject'](_0x5955af);}return _0x540f79[_0x6808('0x23')]();};}function saveUpdates(_0x193ec8,_0x22927d){return function(_0x176b11){if(_0x176b11){return _0x176b11[_0x6808('0x24')](_0x193ec8)[_0x6808('0x25')](function(_0x5bc84f){return _0x5bc84f;});}return null;};}function removeEntity(_0x4d4369,_0x27a024){return function(_0x2ffdab){if(_0x2ffdab){return _0x2ffdab[_0x6808('0x26')]()[_0x6808('0x25')](function(){_0x4d4369[_0x6808('0x19')](0xcc)[_0x6808('0x1a')]();});}};}function handleEntityNotFound(_0x27cd7f,_0xca0c78){return function(_0x4498a5){if(!_0x4498a5){_0x27cd7f[_0x6808('0x18')](0x194);}return _0x4498a5;};}function handleError(_0x2b190e,_0x493a18){_0x493a18=_0x493a18||0x1f4;return function(_0x1a9e96){logger[_0x6808('0x27')](_0x1a9e96['stack']);if(_0x1a9e96['name']){delete _0x1a9e96['name'];}_0x2b190e[_0x6808('0x19')](_0x493a18)[_0x6808('0x28')](_0x1a9e96);};}exports[_0x6808('0x29')]=function(_0x7ef774,_0x55c97a){var _0x3ccac2={},_0x444642={},_0x20449d={'count':0x0,'rows':[]};var _0x4483e2=_['map'](db['SalesforceField'][_0x6808('0x2a')],function(_0x324b79){return{'name':_0x324b79[_0x6808('0x2b')],'type':_0x324b79[_0x6808('0x2c')]['key']};});_0x444642[_0x6808('0x2d')]=_[_0x6808('0x2e')](_0x4483e2,'name');_0x444642['query']=_['keys'](_0x7ef774['query']);_0x444642[_0x6808('0x2f')]=_['intersection'](_0x444642['model'],_0x444642['query']);_0x3ccac2[_0x6808('0x30')]=_['intersection'](_0x444642[_0x6808('0x2d')],qs[_0x6808('0x31')](_0x7ef774[_0x6808('0x32')][_0x6808('0x31')]));_0x3ccac2[_0x6808('0x30')]=_0x3ccac2[_0x6808('0x30')]['length']?_0x3ccac2['attributes']:_0x444642['model'];if(!_0x7ef774[_0x6808('0x32')][_0x6808('0x33')]('nolimit')){_0x3ccac2[_0x6808('0x1d')]=qs[_0x6808('0x1d')](_0x7ef774['query'][_0x6808('0x1d')]);_0x3ccac2[_0x6808('0x1b')]=qs[_0x6808('0x1b')](_0x7ef774[_0x6808('0x32')]['offset']);}_0x3ccac2[_0x6808('0x34')]=qs[_0x6808('0x35')](_0x7ef774[_0x6808('0x32')][_0x6808('0x35')]);_0x3ccac2[_0x6808('0x36')]=qs[_0x6808('0x2f')](_[_0x6808('0x37')](_0x7ef774['query'],_0x444642['filters']),_0x4483e2);if(_0x7ef774[_0x6808('0x32')]['filter']){_0x3ccac2[_0x6808('0x36')]=_[_0x6808('0x38')](_0x3ccac2[_0x6808('0x36')],{'$or':_[_0x6808('0x2e')](_0x4483e2,function(_0x4aa528){if(_0x4aa528[_0x6808('0x2c')]!==_0x6808('0x39')){var _0x51099d={};_0x51099d[_0x4aa528['name']]={'$like':'%'+_0x7ef774[_0x6808('0x32')][_0x6808('0x3a')]+'%'};return _0x51099d;}})});}_0x3ccac2=_[_0x6808('0x38')]({},_0x3ccac2,_0x7ef774[_0x6808('0x3b')]);var _0xee123={'where':_0x3ccac2[_0x6808('0x36')]};return db[_0x6808('0x3c')][_0x6808('0x1e')](_0xee123)['then'](function(_0x41c93a){_0x20449d['count']=_0x41c93a;if(_0x7ef774['query']['includeAll']){_0x3ccac2['include']=[{'all':!![]}];}return db[_0x6808('0x3c')]['findAll'](_0x3ccac2);})['then'](function(_0x4ce46a){_0x20449d[_0x6808('0x3d')]=_0x4ce46a;return _0x20449d;})[_0x6808('0x25')](respondWithFilteredResult(_0x55c97a,_0x3ccac2))[_0x6808('0x3e')](handleError(_0x55c97a,null));};exports[_0x6808('0x3f')]=function(_0x30a5d7,_0x42d2e9){var _0x3d0e41={'raw':!![],'where':{'id':_0x30a5d7[_0x6808('0x40')]['id']}},_0x4c02b8={};_0x4c02b8[_0x6808('0x2d')]=_['keys'](db[_0x6808('0x3c')]['rawAttributes']);_0x4c02b8[_0x6808('0x32')]=_['keys'](_0x30a5d7[_0x6808('0x32')]);_0x4c02b8[_0x6808('0x2f')]=_[_0x6808('0x41')](_0x4c02b8[_0x6808('0x2d')],_0x4c02b8[_0x6808('0x32')]);_0x3d0e41[_0x6808('0x30')]=_[_0x6808('0x41')](_0x4c02b8[_0x6808('0x2d')],qs[_0x6808('0x31')](_0x30a5d7[_0x6808('0x32')][_0x6808('0x31')]));_0x3d0e41[_0x6808('0x30')]=_0x3d0e41['attributes'][_0x6808('0x42')]?_0x3d0e41[_0x6808('0x30')]:_0x4c02b8['model'];if(_0x30a5d7['query'][_0x6808('0x43')]){_0x3d0e41[_0x6808('0x44')]=[{'all':!![]}];}_0x3d0e41=_[_0x6808('0x38')]({},_0x3d0e41,_0x30a5d7[_0x6808('0x3b')]);return db[_0x6808('0x3c')][_0x6808('0x45')](_0x3d0e41)[_0x6808('0x25')](handleEntityNotFound(_0x42d2e9,null))['then'](respondWithResult(_0x42d2e9,null))['catch'](handleError(_0x42d2e9,null));};exports['create']=function(_0x120ec4,_0x49c130){return db[_0x6808('0x3c')][_0x6808('0x46')](_0x120ec4[_0x6808('0x47')],{})[_0x6808('0x25')](respondWithResult(_0x49c130,0xc9))['catch'](handleError(_0x49c130,null));};exports[_0x6808('0x24')]=function(_0x26a9cd,_0x48d3f2){if(_0x26a9cd[_0x6808('0x47')]['id']){delete _0x26a9cd[_0x6808('0x47')]['id'];}return db[_0x6808('0x3c')][_0x6808('0x45')]({'where':{'id':_0x26a9cd[_0x6808('0x40')]['id']}})[_0x6808('0x25')](handleEntityNotFound(_0x48d3f2,null))[_0x6808('0x25')](saveUpdates(_0x26a9cd[_0x6808('0x47')],null))[_0x6808('0x25')](respondWithResult(_0x48d3f2,null))[_0x6808('0x3e')](handleError(_0x48d3f2,null));};exports[_0x6808('0x26')]=function(_0x2c88a2,_0x21c39b){return db[_0x6808('0x3c')][_0x6808('0x45')]({'where':{'id':_0x2c88a2[_0x6808('0x40')]['id']}})[_0x6808('0x25')](handleEntityNotFound(_0x21c39b,null))[_0x6808('0x25')](removeEntity(_0x21c39b,null))[_0x6808('0x3e')](handleError(_0x21c39b,null));}; \ No newline at end of file +var _0xce98=['filter','type','VIRTUAL','merge','options','SalesforceField','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0xac82c9,_0x5e8331){var _0x459e30=function(_0x58ef89){while(--_0x58ef89){_0xac82c9['push'](_0xac82c9['shift']());}};_0x459e30(++_0x5e8331);}(_0xce98,0x15b));var _0x8ce9=function(_0x5778c7,_0x52acba){_0x5778c7=_0x5778c7-0x0;var _0x5a27d4=_0xce98[_0x5778c7];return _0x5a27d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ce9('0x0'));var zipdir=require(_0x8ce9('0x1'));var jsonpatch=require(_0x8ce9('0x2'));var rp=require(_0x8ce9('0x3'));var moment=require(_0x8ce9('0x4'));var BPromise=require(_0x8ce9('0x5'));var Mustache=require(_0x8ce9('0x6'));var util=require(_0x8ce9('0x7'));var path=require(_0x8ce9('0x8'));var sox=require(_0x8ce9('0x9'));var csv=require(_0x8ce9('0xa'));var ejs=require(_0x8ce9('0xb'));var fs=require('fs');var fs_extra=require(_0x8ce9('0xc'));var _=require('lodash');var squel=require(_0x8ce9('0xd'));var crypto=require(_0x8ce9('0xe'));var jsforce=require(_0x8ce9('0xf'));var deskjs=require(_0x8ce9('0x10'));var toCsv=require(_0x8ce9('0xa'));var querystring=require(_0x8ce9('0x11'));var Papa=require(_0x8ce9('0x12'));var Redis=require(_0x8ce9('0x13'));var authService=require(_0x8ce9('0x14'));var qs=require(_0x8ce9('0x15'));var as=require(_0x8ce9('0x16'));var hardwareService=require(_0x8ce9('0x17'));var logger=require(_0x8ce9('0x18'))(_0x8ce9('0x19'));var utils=require(_0x8ce9('0x1a'));var config=require(_0x8ce9('0x1b'));var licenseUtil=require(_0x8ce9('0x1c'));var db=require(_0x8ce9('0x1d'))['db'];function respondWithStatusCode(_0x3caaff,_0x538cfc){_0x538cfc=_0x538cfc||0xcc;return function(_0xbe503a){if(_0xbe503a){return _0x3caaff[_0x8ce9('0x1e')](_0x538cfc);}return _0x3caaff[_0x8ce9('0x1f')](_0x538cfc)[_0x8ce9('0x20')]();};}function respondWithResult(_0x16c586,_0x2add7b){_0x2add7b=_0x2add7b||0xc8;return function(_0x53eb58){if(_0x53eb58){return _0x16c586[_0x8ce9('0x1f')](_0x2add7b)[_0x8ce9('0x21')](_0x53eb58);}};}function respondWithFilteredResult(_0x51020e,_0x1b2be0){return function(_0x45df80){if(_0x45df80){var _0x5f05b0=typeof _0x1b2be0[_0x8ce9('0x22')]==='undefined'&&typeof _0x1b2be0['limit']===_0x8ce9('0x23');var _0xcf06ee=_0x45df80['count'];var _0x1ca32a=_0x5f05b0?0x0:_0x1b2be0['offset'];var _0x102e08=_0x5f05b0?_0x45df80[_0x8ce9('0x24')]:_0x1b2be0['offset']+_0x1b2be0['limit'];var _0x12188e;if(_0x102e08>=_0xcf06ee){_0x102e08=_0xcf06ee;_0x12188e=0xc8;}else{_0x12188e=0xce;}_0x51020e[_0x8ce9('0x1f')](_0x12188e);return _0x51020e[_0x8ce9('0x25')](_0x8ce9('0x26'),_0x1ca32a+'-'+_0x102e08+'/'+_0xcf06ee)['json'](_0x45df80);}return null;};}function patchUpdates(_0x2f67fc){return function(_0x594fd1){try{jsonpatch['apply'](_0x594fd1,_0x2f67fc,!![]);}catch(_0x56e0e9){return BPromise[_0x8ce9('0x27')](_0x56e0e9);}return _0x594fd1[_0x8ce9('0x28')]();};}function saveUpdates(_0x442cb9,_0x4b259d){return function(_0x1d6acd){if(_0x1d6acd){return _0x1d6acd[_0x8ce9('0x29')](_0x442cb9)[_0x8ce9('0x2a')](function(_0x1336f5){return _0x1336f5;});}return null;};}function removeEntity(_0x4515b5,_0x569e45){return function(_0x1ab9d5){if(_0x1ab9d5){return _0x1ab9d5[_0x8ce9('0x2b')]()[_0x8ce9('0x2a')](function(){_0x4515b5['status'](0xcc)[_0x8ce9('0x20')]();});}};}function handleEntityNotFound(_0x3759f3,_0xa65b19){return function(_0x346376){if(!_0x346376){_0x3759f3[_0x8ce9('0x1e')](0x194);}return _0x346376;};}function handleError(_0x48a23f,_0x33a7d6){_0x33a7d6=_0x33a7d6||0x1f4;return function(_0x3468a5){logger[_0x8ce9('0x2c')](_0x3468a5[_0x8ce9('0x2d')]);if(_0x3468a5[_0x8ce9('0x2e')]){delete _0x3468a5['name'];}_0x48a23f[_0x8ce9('0x1f')](_0x33a7d6)[_0x8ce9('0x2f')](_0x3468a5);};}exports[_0x8ce9('0x30')]=function(_0x5944e8,_0x1192aa){var _0x459e50={},_0x2979de={},_0x370a0a={'count':0x0,'rows':[]};var _0x5e2f9a=_[_0x8ce9('0x31')](db['SalesforceField'][_0x8ce9('0x32')],function(_0x3c291a){return{'name':_0x3c291a[_0x8ce9('0x33')],'type':_0x3c291a['type'][_0x8ce9('0x34')]};});_0x2979de[_0x8ce9('0x35')]=_[_0x8ce9('0x31')](_0x5e2f9a,_0x8ce9('0x2e'));_0x2979de['query']=_[_0x8ce9('0x36')](_0x5944e8[_0x8ce9('0x37')]);_0x2979de[_0x8ce9('0x38')]=_[_0x8ce9('0x39')](_0x2979de[_0x8ce9('0x35')],_0x2979de[_0x8ce9('0x37')]);_0x459e50[_0x8ce9('0x3a')]=_[_0x8ce9('0x39')](_0x2979de[_0x8ce9('0x35')],qs[_0x8ce9('0x3b')](_0x5944e8['query'][_0x8ce9('0x3b')]));_0x459e50[_0x8ce9('0x3a')]=_0x459e50[_0x8ce9('0x3a')][_0x8ce9('0x3c')]?_0x459e50[_0x8ce9('0x3a')]:_0x2979de['model'];if(!_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x3d')](_0x8ce9('0x3e'))){_0x459e50[_0x8ce9('0x3f')]=qs[_0x8ce9('0x3f')](_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x3f')]);_0x459e50[_0x8ce9('0x22')]=qs['offset'](_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x22')]);}_0x459e50[_0x8ce9('0x40')]=qs['sort'](_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x41')]);_0x459e50[_0x8ce9('0x42')]=qs[_0x8ce9('0x38')](_[_0x8ce9('0x43')](_0x5944e8[_0x8ce9('0x37')],_0x2979de['filters']),_0x5e2f9a);if(_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x44')]){_0x459e50[_0x8ce9('0x42')]=_['merge'](_0x459e50['where'],{'$or':_[_0x8ce9('0x31')](_0x5e2f9a,function(_0x3a2656){if(_0x3a2656[_0x8ce9('0x45')]!==_0x8ce9('0x46')){var _0x2913ee={};_0x2913ee[_0x3a2656[_0x8ce9('0x2e')]]={'$like':'%'+_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x44')]+'%'};return _0x2913ee;}})});}_0x459e50=_[_0x8ce9('0x47')]({},_0x459e50,_0x5944e8[_0x8ce9('0x48')]);var _0x262005={'where':_0x459e50[_0x8ce9('0x42')]};return db[_0x8ce9('0x49')]['count'](_0x262005)['then'](function(_0x255a69){_0x370a0a['count']=_0x255a69;if(_0x5944e8[_0x8ce9('0x37')][_0x8ce9('0x4a')]){_0x459e50[_0x8ce9('0x4b')]=[{'all':!![]}];}return db[_0x8ce9('0x49')][_0x8ce9('0x4c')](_0x459e50);})[_0x8ce9('0x2a')](function(_0x2773c2){_0x370a0a[_0x8ce9('0x4d')]=_0x2773c2;return _0x370a0a;})[_0x8ce9('0x2a')](respondWithFilteredResult(_0x1192aa,_0x459e50))[_0x8ce9('0x4e')](handleError(_0x1192aa,null));};exports['show']=function(_0x39d639,_0x55b863){var _0x1c7413={'raw':!![],'where':{'id':_0x39d639[_0x8ce9('0x4f')]['id']}},_0x1b4865={};_0x1b4865[_0x8ce9('0x35')]=_[_0x8ce9('0x36')](db['SalesforceField'][_0x8ce9('0x32')]);_0x1b4865[_0x8ce9('0x37')]=_[_0x8ce9('0x36')](_0x39d639['query']);_0x1b4865[_0x8ce9('0x38')]=_[_0x8ce9('0x39')](_0x1b4865[_0x8ce9('0x35')],_0x1b4865[_0x8ce9('0x37')]);_0x1c7413['attributes']=_[_0x8ce9('0x39')](_0x1b4865[_0x8ce9('0x35')],qs[_0x8ce9('0x3b')](_0x39d639[_0x8ce9('0x37')]['fields']));_0x1c7413['attributes']=_0x1c7413[_0x8ce9('0x3a')]['length']?_0x1c7413['attributes']:_0x1b4865[_0x8ce9('0x35')];if(_0x39d639[_0x8ce9('0x37')][_0x8ce9('0x4a')]){_0x1c7413[_0x8ce9('0x4b')]=[{'all':!![]}];}_0x1c7413=_[_0x8ce9('0x47')]({},_0x1c7413,_0x39d639[_0x8ce9('0x48')]);return db[_0x8ce9('0x49')][_0x8ce9('0x50')](_0x1c7413)[_0x8ce9('0x2a')](handleEntityNotFound(_0x55b863,null))['then'](respondWithResult(_0x55b863,null))[_0x8ce9('0x4e')](handleError(_0x55b863,null));};exports[_0x8ce9('0x51')]=function(_0x365ece,_0x28e91a){return db[_0x8ce9('0x49')]['create'](_0x365ece[_0x8ce9('0x52')],{})[_0x8ce9('0x2a')](respondWithResult(_0x28e91a,0xc9))[_0x8ce9('0x4e')](handleError(_0x28e91a,null));};exports[_0x8ce9('0x29')]=function(_0x1465a6,_0xa55ef){if(_0x1465a6[_0x8ce9('0x52')]['id']){delete _0x1465a6[_0x8ce9('0x52')]['id'];}return db[_0x8ce9('0x49')]['find']({'where':{'id':_0x1465a6[_0x8ce9('0x4f')]['id']}})['then'](handleEntityNotFound(_0xa55ef,null))['then'](saveUpdates(_0x1465a6[_0x8ce9('0x52')],null))[_0x8ce9('0x2a')](respondWithResult(_0xa55ef,null))[_0x8ce9('0x4e')](handleError(_0xa55ef,null));};exports['destroy']=function(_0x1e4ada,_0x208e82){return db['SalesforceField'][_0x8ce9('0x50')]({'where':{'id':_0x1e4ada[_0x8ce9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x208e82,null))[_0x8ce9('0x2a')](removeEntity(_0x208e82,null))[_0x8ce9('0x4e')](handleError(_0x208e82,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 3963a78..39b5801 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 _0xf788=['exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xf788,0x164));var _0x8f78=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xf788[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x8f78('0x0'));var util=require(_0x8f78('0x1'));var logger=require(_0x8f78('0x2'))(_0x8f78('0x3'));var moment=require('moment');var BPromise=require(_0x8f78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f78('0x5'));var rimraf=require(_0x8f78('0x6'));var config=require(_0x8f78('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x8f78('0x8')]=function(_0x4f2329,_0x4adc52){return _0x4f2329[_0x8f78('0x9')](_0x8f78('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x8f78('0xb'),'fields':[_0x8f78('0xc'),_0x8f78('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x48c6=['FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x378467,_0x45a682){var _0x4665b4=function(_0x33a0aa){while(--_0x33a0aa){_0x378467['push'](_0x378467['shift']());}};_0x4665b4(++_0x45a682);}(_0x48c6,0xde));var _0x648c=function(_0x469889,_0x1e640a){_0x469889=_0x469889-0x0;var _0x3e72c1=_0x48c6[_0x469889];return _0x3e72c1;};'use strict';var _=require(_0x648c('0x0'));var util=require(_0x648c('0x1'));var logger=require('../../config/logger')(_0x648c('0x2'));var moment=require(_0x648c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x648c('0x4'));var rimraf=require(_0x648c('0x5'));var config=require(_0x648c('0x6'));var attributes=require(_0x648c('0x7'));module[_0x648c('0x8')]=function(_0x488027,_0x5e281e){return _0x488027['define'](_0x648c('0x9'),attributes,{'tableName':_0x648c('0xa'),'paranoid':![],'indexes':[{'name':_0x648c('0xb'),'fields':['idField',_0x648c('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 1c1dfbb..e6f019e 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 _0x510f=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xb8fddb,_0x4622d9){var _0x2c3009=function(_0x2c900f){while(--_0x2c900f){_0xb8fddb['push'](_0xb8fddb['shift']());}};_0x2c3009(++_0x4622d9);}(_0x510f,0x123));var _0xf510=function(_0x276d59,_0xf8c2e5){_0x276d59=_0x276d59-0x0;var _0xfc7a62=_0x510f[_0x276d59];return _0xfc7a62;};'use strict';var _=require(_0xf510('0x0'));var util=require(_0xf510('0x1'));var moment=require(_0xf510('0x2'));var BPromise=require(_0xf510('0x3'));var rs=require(_0xf510('0x4'));var fs=require('fs');var Redis=require(_0xf510('0x5'));var db=require(_0xf510('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf510('0x7'))(_0xf510('0x8'));var config=require(_0xf510('0x9'));var jayson=require(_0xf510('0xa'));var client=jayson[_0xf510('0xb')][_0xf510('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x453909,_0x4522da,_0x21c514){return new BPromise(function(_0x129208,_0x53c95d){return client['request'](_0x453909,_0x21c514)[_0xf510('0xd')](function(_0x3629db){logger[_0xf510('0xe')](_0xf510('0xf'),_0x4522da,_0xf510('0x10'));logger['debug'](_0xf510('0x11'),_0x4522da,_0xf510('0x10'),JSON[_0xf510('0x12')](_0x3629db));if(_0x3629db[_0xf510('0x13')]){if(_0x3629db[_0xf510('0x13')][_0xf510('0x14')]===0x1f4){logger['error'](_0xf510('0xf'),_0x4522da,_0x3629db[_0xf510('0x13')]['message']);return _0x53c95d(_0x3629db['error'][_0xf510('0x15')]);}logger[_0xf510('0x13')]('SalesforceField,\x20%s,\x20%s',_0x4522da,_0x3629db[_0xf510('0x13')][_0xf510('0x15')]);return _0x129208(_0x3629db['error']['message']);}else{logger[_0xf510('0xe')](_0xf510('0xf'),_0x4522da,_0xf510('0x10'));_0x129208(_0x3629db[_0xf510('0x16')][_0xf510('0x15')]);}})[_0xf510('0x17')](function(_0xa5ac48){logger[_0xf510('0x13')](_0xf510('0xf'),_0x4522da,_0xa5ac48);_0x53c95d(_0xa5ac48);});});} \ No newline at end of file +var _0x0ab2=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x3c4f88,_0x22bad5){var _0x1b8fc2=function(_0x2a1d7a){while(--_0x2a1d7a){_0x3c4f88['push'](_0x3c4f88['shift']());}};_0x1b8fc2(++_0x22bad5);}(_0x0ab2,0x188));var _0x20ab=function(_0x5eb66c,_0x18c1d9){_0x5eb66c=_0x5eb66c-0x0;var _0x7029f5=_0x0ab2[_0x5eb66c];return _0x7029f5;};'use strict';var _=require('lodash');var util=require(_0x20ab('0x0'));var moment=require(_0x20ab('0x1'));var BPromise=require(_0x20ab('0x2'));var rs=require(_0x20ab('0x3'));var fs=require('fs');var Redis=require(_0x20ab('0x4'));var db=require(_0x20ab('0x5'))['db'];var utils=require(_0x20ab('0x6'));var logger=require(_0x20ab('0x7'))('rpc');var config=require(_0x20ab('0x8'));var jayson=require(_0x20ab('0x9'));var client=jayson[_0x20ab('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x208d11,_0x1d4be9,_0x295c83){return new BPromise(function(_0x4db30a,_0x5d5067){return client[_0x20ab('0xb')](_0x208d11,_0x295c83)[_0x20ab('0xc')](function(_0x2b176e){logger[_0x20ab('0xd')](_0x20ab('0xe'),_0x1d4be9,_0x20ab('0xf'));logger[_0x20ab('0x10')](_0x20ab('0x11'),_0x1d4be9,_0x20ab('0xf'),JSON[_0x20ab('0x12')](_0x2b176e));if(_0x2b176e[_0x20ab('0x13')]){if(_0x2b176e[_0x20ab('0x13')]['code']===0x1f4){logger[_0x20ab('0x13')](_0x20ab('0xe'),_0x1d4be9,_0x2b176e[_0x20ab('0x13')]['message']);return _0x5d5067(_0x2b176e['error'][_0x20ab('0x14')]);}logger[_0x20ab('0x13')](_0x20ab('0xe'),_0x1d4be9,_0x2b176e['error'][_0x20ab('0x14')]);return _0x4db30a(_0x2b176e[_0x20ab('0x13')][_0x20ab('0x14')]);}else{logger['info'](_0x20ab('0xe'),_0x1d4be9,'request\x20sent');_0x4db30a(_0x2b176e[_0x20ab('0x15')][_0x20ab('0x14')]);}})[_0x20ab('0x16')](function(_0x458a4f){logger[_0x20ab('0x13')](_0x20ab('0xe'),_0x1d4be9,_0x458a4f);_0x5d5067(_0x458a4f);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ff9f3f1..5f5c98d 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 _0x9831=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x9831,0xfc));var _0x1983=function(_0x305ab2,_0x582cac){_0x305ab2=_0x305ab2-0x0;var _0x39939e=_0x9831[_0x305ab2];return _0x39939e;};'use strict';var multer=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var path=require(_0x1983('0x2'));var timeout=require(_0x1983('0x3'));var express=require(_0x1983('0x4'));var router=express['Router']();var fs_extra=require(_0x1983('0x5'));var auth=require(_0x1983('0x6'));var interaction=require(_0x1983('0x7'));var config=require(_0x1983('0x8'));var controller=require('./intServicenowAccount.controller');router[_0x1983('0x9')]('/',auth[_0x1983('0xa')](),controller[_0x1983('0xb')]);router[_0x1983('0x9')](_0x1983('0xc'),auth[_0x1983('0xa')](),controller[_0x1983('0xd')]);router[_0x1983('0x9')]('/:id/configurations',auth[_0x1983('0xa')](),controller[_0x1983('0xe')]);router[_0x1983('0x9')](_0x1983('0xf'),auth[_0x1983('0xa')](),controller[_0x1983('0x10')]);router[_0x1983('0x11')]('/',auth[_0x1983('0xa')](),controller[_0x1983('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x1983('0x13')]);router['put'](_0x1983('0xc'),auth[_0x1983('0xa')](),controller['update']);router['delete'](_0x1983('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1983('0x14')]=router; \ No newline at end of file +var _0xb544=['/:id/fields','getFields','post','put','/:id','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/configurations','getConfigurations'];(function(_0x170b62,_0xd3886d){var _0x47fb1a=function(_0x3753eb){while(--_0x3753eb){_0x170b62['push'](_0x170b62['shift']());}};_0x47fb1a(++_0xd3886d);}(_0xb544,0xd0));var _0x4b54=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb544[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b54('0x0'));var timeout=require(_0x4b54('0x1'));var express=require(_0x4b54('0x2'));var router=express[_0x4b54('0x3')]();var fs_extra=require(_0x4b54('0x4'));var auth=require(_0x4b54('0x5'));var interaction=require(_0x4b54('0x6'));var config=require(_0x4b54('0x7'));var controller=require('./intServicenowAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4b54('0x8')]('/:id',auth[_0x4b54('0x9')](),controller['show']);router[_0x4b54('0x8')](_0x4b54('0xa'),auth['isAuthenticated'](),controller[_0x4b54('0xb')]);router[_0x4b54('0x8')](_0x4b54('0xc'),auth[_0x4b54('0x9')](),controller[_0x4b54('0xd')]);router[_0x4b54('0xe')]('/',auth[_0x4b54('0x9')](),controller['create']);router[_0x4b54('0xe')](_0x4b54('0xa'),auth[_0x4b54('0x9')](),controller['addConfiguration']);router[_0x4b54('0xf')](_0x4b54('0x10'),auth['isAuthenticated'](),controller[_0x4b54('0x11')]);router[_0x4b54('0x12')]('/:id',auth[_0x4b54('0x9')](),controller[_0x4b54('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 9542362..811fa2b 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 _0xdce5=['exports','STRING','username'];(function(_0x25ce24,_0x172ee2){var _0x666692=function(_0x36d385){while(--_0x36d385){_0x25ce24['push'](_0x25ce24['shift']());}};_0x666692(++_0x172ee2);}(_0xdce5,0x1a7));var _0x5dce=function(_0x44524d,_0x1f82f7){_0x44524d=_0x44524d-0x0;var _0x535978=_0xdce5[_0x44524d];return _0x535978;};'use strict';var Sequelize=require('sequelize');module[_0x5dce('0x0')]={'name':{'type':Sequelize[_0x5dce('0x1')]},'description':{'type':Sequelize[_0x5dce('0x1')]},'username':{'type':Sequelize[_0x5dce('0x1')],'unique':_0x5dce('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5dce('0x1')]},'remoteUri':{'type':Sequelize[_0x5dce('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x5dce('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x8b8a=['exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b8a,0x1b6));var _0xa8b8=function(_0x42967b,_0x3f503b){_0x42967b=_0x42967b-0x0;var _0x175420=_0x8b8a[_0x42967b];return _0x175420;};'use strict';var Sequelize=require('sequelize');module[_0xa8b8('0x0')]={'name':{'type':Sequelize[_0xa8b8('0x1')]},'description':{'type':Sequelize[_0xa8b8('0x1')]},'username':{'type':Sequelize[_0xa8b8('0x1')],'unique':_0xa8b8('0x2')},'password':{'type':Sequelize[_0xa8b8('0x1')]},'email':{'type':Sequelize[_0xa8b8('0x1')]},'remoteUri':{'type':Sequelize[_0xa8b8('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa8b8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index a8be503..4ea9d59 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 _0x94d1=['assigned_to','sla_due','reopen_count','escalation','upon_approval','correlation_id','location','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ServicenowAccount','rows','catch','show','params','length','includeAll','include','create','body','find','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','approval_history','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','close_code','correlation_display','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency','problem_id','company','activity_due'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94d1,0xe6));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x194d('0x0'));var rimraf=require(_0x194d('0x1'));var zipdir=require(_0x194d('0x2'));var jsonpatch=require(_0x194d('0x3'));var rp=require(_0x194d('0x4'));var moment=require('moment');var BPromise=require(_0x194d('0x5'));var Mustache=require(_0x194d('0x6'));var util=require('util');var path=require(_0x194d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x194d('0x8'));var fs=require('fs');var fs_extra=require(_0x194d('0x9'));var _=require('lodash');var squel=require(_0x194d('0xa'));var crypto=require(_0x194d('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x194d('0xc'));var toCsv=require(_0x194d('0xd'));var querystring=require('querystring');var Papa=require(_0x194d('0xe'));var Redis=require(_0x194d('0xf'));var authService=require(_0x194d('0x10'));var qs=require(_0x194d('0x11'));var as=require(_0x194d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x194d('0x13'))(_0x194d('0x14'));var utils=require(_0x194d('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x194d('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x58105e,_0xbafa04){_0xbafa04=_0xbafa04||0xcc;return function(_0x10410f){if(_0x10410f){return _0x58105e[_0x194d('0x17')](_0xbafa04);}return _0x58105e[_0x194d('0x18')](_0xbafa04)[_0x194d('0x19')]();};}function respondWithResult(_0x259fe3,_0x3cd63c){_0x3cd63c=_0x3cd63c||0xc8;return function(_0x2893cf){if(_0x2893cf){return _0x259fe3['status'](_0x3cd63c)[_0x194d('0x1a')](_0x2893cf);}};}function respondWithFilteredResult(_0x4c639d,_0x1029ba){return function(_0x21b2b6){if(_0x21b2b6){var _0x45d4d6=typeof _0x1029ba[_0x194d('0x1b')]==='undefined'&&typeof _0x1029ba[_0x194d('0x1c')]===_0x194d('0x1d');var _0x5619a2=_0x21b2b6[_0x194d('0x1e')];var _0x1391de=_0x45d4d6?0x0:_0x1029ba[_0x194d('0x1b')];var _0x58fa69=_0x45d4d6?_0x21b2b6[_0x194d('0x1e')]:_0x1029ba[_0x194d('0x1b')]+_0x1029ba['limit'];var _0x2064a6;if(_0x58fa69>=_0x5619a2){_0x58fa69=_0x5619a2;_0x2064a6=0xc8;}else{_0x2064a6=0xce;}_0x4c639d['status'](_0x2064a6);return _0x4c639d[_0x194d('0x1f')](_0x194d('0x20'),_0x1391de+'-'+_0x58fa69+'/'+_0x5619a2)[_0x194d('0x1a')](_0x21b2b6);}return null;};}function patchUpdates(_0xbd379c){return function(_0x5a7dd9){try{jsonpatch['apply'](_0x5a7dd9,_0xbd379c,!![]);}catch(_0x4f9b35){return BPromise[_0x194d('0x21')](_0x4f9b35);}return _0x5a7dd9[_0x194d('0x22')]();};}function saveUpdates(_0x45863d,_0x29d023){return function(_0x34190e){if(_0x34190e){return _0x34190e[_0x194d('0x23')](_0x45863d)[_0x194d('0x24')](function(_0x28477f){return _0x28477f;});}return null;};}function removeEntity(_0x3fe7d0,_0x360d78){return function(_0x2f9740){if(_0x2f9740){return _0x2f9740[_0x194d('0x25')]()['then'](function(){_0x3fe7d0[_0x194d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb106,_0x2edf0d){return function(_0x554bd8){if(!_0x554bd8){_0x2eb106['sendStatus'](0x194);}return _0x554bd8;};}function handleError(_0x1408a9,_0xb60dc2){_0xb60dc2=_0xb60dc2||0x1f4;return function(_0x2f5ace){logger[_0x194d('0x26')](_0x2f5ace[_0x194d('0x27')]);if(_0x2f5ace[_0x194d('0x28')]){delete _0x2f5ace['name'];}_0x1408a9[_0x194d('0x18')](_0xb60dc2)[_0x194d('0x29')](_0x2f5ace);};}exports[_0x194d('0x2a')]=function(_0x1549c3,_0x522577){var _0x4684bb={},_0x51c278={},_0x1d6fbe={'count':0x0,'rows':[]};var _0x497901=_[_0x194d('0x2b')](db['ServicenowAccount'][_0x194d('0x2c')],function(_0x1683e5){return{'name':_0x1683e5[_0x194d('0x2d')],'type':_0x1683e5[_0x194d('0x2e')][_0x194d('0x2f')]};});_0x51c278['model']=_[_0x194d('0x2b')](_0x497901,'name');_0x51c278[_0x194d('0x30')]=_[_0x194d('0x31')](_0x1549c3['query']);_0x51c278[_0x194d('0x32')]=_[_0x194d('0x33')](_0x51c278['model'],_0x51c278[_0x194d('0x30')]);_0x4684bb[_0x194d('0x34')]=_[_0x194d('0x33')](_0x51c278[_0x194d('0x35')],qs[_0x194d('0x36')](_0x1549c3[_0x194d('0x30')][_0x194d('0x36')]));_0x4684bb[_0x194d('0x34')]=_0x4684bb[_0x194d('0x34')]['length']?_0x4684bb[_0x194d('0x34')]:_0x51c278['model'];if(!_0x1549c3[_0x194d('0x30')][_0x194d('0x37')](_0x194d('0x38'))){_0x4684bb[_0x194d('0x1c')]=qs[_0x194d('0x1c')](_0x1549c3[_0x194d('0x30')]['limit']);_0x4684bb[_0x194d('0x1b')]=qs['offset'](_0x1549c3[_0x194d('0x30')][_0x194d('0x1b')]);}_0x4684bb[_0x194d('0x39')]=qs['sort'](_0x1549c3[_0x194d('0x30')][_0x194d('0x3a')]);_0x4684bb[_0x194d('0x3b')]=qs[_0x194d('0x32')](_[_0x194d('0x3c')](_0x1549c3[_0x194d('0x30')],_0x51c278[_0x194d('0x32')]),_0x497901);if(_0x1549c3[_0x194d('0x30')][_0x194d('0x3d')]){_0x4684bb[_0x194d('0x3b')]=_[_0x194d('0x3e')](_0x4684bb[_0x194d('0x3b')],{'$or':_[_0x194d('0x2b')](_0x497901,function(_0x3f3979){if(_0x3f3979[_0x194d('0x2e')]!=='VIRTUAL'){var _0x3159fb={};_0x3159fb[_0x3f3979['name']]={'$like':'%'+_0x1549c3[_0x194d('0x30')]['filter']+'%'};return _0x3159fb;}})});}_0x4684bb=_[_0x194d('0x3e')]({},_0x4684bb,_0x1549c3[_0x194d('0x3f')]);var _0x3de09f={'where':_0x4684bb['where']};return db[_0x194d('0x40')][_0x194d('0x1e')](_0x3de09f)[_0x194d('0x24')](function(_0x46aed7){_0x1d6fbe[_0x194d('0x1e')]=_0x46aed7;if(_0x1549c3['query']['includeAll']){_0x4684bb['include']=[{'all':!![]}];}return db[_0x194d('0x40')]['findAll'](_0x4684bb);})[_0x194d('0x24')](function(_0x466ae1){_0x1d6fbe[_0x194d('0x41')]=_0x466ae1;return _0x1d6fbe;})[_0x194d('0x24')](respondWithFilteredResult(_0x522577,_0x4684bb))[_0x194d('0x42')](handleError(_0x522577,null));};exports[_0x194d('0x43')]=function(_0x460aea,_0x39fc3){var _0x310abc={'raw':![],'where':{'id':_0x460aea[_0x194d('0x44')]['id']}},_0x1d42f5={};_0x1d42f5['model']=_['keys'](db['ServicenowAccount'][_0x194d('0x2c')]);_0x1d42f5[_0x194d('0x30')]=_[_0x194d('0x31')](_0x460aea[_0x194d('0x30')]);_0x1d42f5[_0x194d('0x32')]=_[_0x194d('0x33')](_0x1d42f5[_0x194d('0x35')],_0x1d42f5['query']);_0x310abc[_0x194d('0x34')]=_[_0x194d('0x33')](_0x1d42f5[_0x194d('0x35')],qs[_0x194d('0x36')](_0x460aea[_0x194d('0x30')][_0x194d('0x36')]));_0x310abc['attributes']=_0x310abc[_0x194d('0x34')][_0x194d('0x45')]?_0x310abc[_0x194d('0x34')]:_0x1d42f5['model'];if(_0x460aea[_0x194d('0x30')][_0x194d('0x46')]){_0x310abc[_0x194d('0x47')]=[{'all':!![]}];}_0x310abc=_[_0x194d('0x3e')]({},_0x310abc,_0x460aea[_0x194d('0x3f')]);return db['ServicenowAccount']['find'](_0x310abc)[_0x194d('0x24')](handleEntityNotFound(_0x39fc3,null))[_0x194d('0x24')](respondWithResult(_0x39fc3,null))['catch'](handleError(_0x39fc3,null));};exports[_0x194d('0x48')]=function(_0x327e9e,_0x574514){return db['ServicenowAccount'][_0x194d('0x48')](_0x327e9e[_0x194d('0x49')],{})['then'](respondWithResult(_0x574514,0xc9))['catch'](handleError(_0x574514,null));};exports['update']=function(_0x6b5908,_0x187c60){if(_0x6b5908['body']['id']){delete _0x6b5908[_0x194d('0x49')]['id'];}return db[_0x194d('0x40')]['find']({'where':{'id':_0x6b5908[_0x194d('0x44')]['id']}})[_0x194d('0x24')](handleEntityNotFound(_0x187c60,null))[_0x194d('0x24')](saveUpdates(_0x6b5908[_0x194d('0x49')],null))[_0x194d('0x24')](respondWithResult(_0x187c60,null))[_0x194d('0x42')](handleError(_0x187c60,null));};exports[_0x194d('0x25')]=function(_0x19de30,_0x4e1c2e){return db['ServicenowAccount'][_0x194d('0x4a')]({'where':{'id':_0x19de30[_0x194d('0x44')]['id']}})[_0x194d('0x24')](handleEntityNotFound(_0x4e1c2e,null))[_0x194d('0x24')](removeEntity(_0x4e1c2e,null))['catch'](handleError(_0x4e1c2e,null));};exports['getConfigurations']=function(_0x20abe3,_0x161742,_0x26fe97){var _0x44060e={};var _0x47a754={};var _0x4d8043;var _0x4f411d;return db[_0x194d('0x40')][_0x194d('0x4b')]({'where':{'id':_0x20abe3['params']['id']}})[_0x194d('0x24')](handleEntityNotFound(_0x161742,null))[_0x194d('0x24')](function(_0x2d51eb){if(_0x2d51eb){_0x4d8043=_0x2d51eb;_0x47a754[_0x194d('0x35')]=_[_0x194d('0x31')](db[_0x194d('0x4c')][_0x194d('0x2c')]);_0x47a754[_0x194d('0x30')]=_[_0x194d('0x31')](_0x20abe3[_0x194d('0x30')]);_0x47a754['filters']=_[_0x194d('0x33')](_0x47a754[_0x194d('0x35')],_0x47a754[_0x194d('0x30')]);_0x44060e['attributes']=_[_0x194d('0x33')](_0x47a754[_0x194d('0x35')],qs[_0x194d('0x36')](_0x20abe3[_0x194d('0x30')][_0x194d('0x36')]));_0x44060e[_0x194d('0x34')]=_0x44060e['attributes'][_0x194d('0x45')]?_0x44060e[_0x194d('0x34')]:_0x47a754[_0x194d('0x35')];_0x44060e[_0x194d('0x39')]=qs[_0x194d('0x3a')](_0x20abe3['query'][_0x194d('0x3a')]);_0x44060e[_0x194d('0x3b')]=qs[_0x194d('0x32')](_['pick'](_0x20abe3[_0x194d('0x30')],_0x47a754[_0x194d('0x32')]));if(_0x20abe3[_0x194d('0x30')][_0x194d('0x3d')]){_0x44060e[_0x194d('0x3b')]=_[_0x194d('0x3e')](_0x44060e[_0x194d('0x3b')],{'$or':_[_0x194d('0x2b')](_0x44060e[_0x194d('0x34')],function(_0x30e3ce){var _0x324c3e={};_0x324c3e[_0x30e3ce]={'$like':'%'+_0x20abe3[_0x194d('0x30')][_0x194d('0x3d')]+'%'};return _0x324c3e;})});}_0x44060e=_[_0x194d('0x3e')]({},_0x44060e,_0x20abe3[_0x194d('0x3f')]);return _0x4d8043[_0x194d('0x4d')](_0x44060e);}})['then'](function(_0x54d708){if(_0x54d708){_0x4f411d=_0x54d708['length'];if(!_0x20abe3[_0x194d('0x30')][_0x194d('0x37')]('nolimit')){_0x44060e['limit']=qs[_0x194d('0x1c')](_0x20abe3['query']['limit']);_0x44060e[_0x194d('0x1b')]=qs[_0x194d('0x1b')](_0x20abe3[_0x194d('0x30')][_0x194d('0x1b')]);}return _0x4d8043[_0x194d('0x4d')](_0x44060e);}})['then'](function(_0x1eb506){if(_0x1eb506){return _0x1eb506?{'count':_0x4f411d,'rows':_0x1eb506}:null;}})[_0x194d('0x24')](respondWithResult(_0x161742,null))['catch'](handleError(_0x161742,null));};exports[_0x194d('0x4e')]=function(_0x3fffd8,_0x4a796c,_0x1ff823){if(_0x3fffd8[_0x194d('0x49')]['id']){delete _0x3fffd8[_0x194d('0x49')]['id'];}return db[_0x194d('0x40')][_0x194d('0x4b')]({'where':{'id':_0x3fffd8[_0x194d('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a796c,null))[_0x194d('0x24')](function(_0x4b1217){if(_0x4b1217){_0x3fffd8[_0x194d('0x49')][_0x194d('0x4f')]=_0x4b1217['id'];_0x3fffd8[_0x194d('0x49')][_0x194d('0x50')]=integrations[_0x194d('0x51')](_0x3fffd8[_0x194d('0x49')][_0x194d('0x52')],_0x3fffd8[_0x194d('0x49')][_0x194d('0x2e')]);_0x3fffd8['body']['Descriptions']=integrations['getDescriptions'](_0x3fffd8[_0x194d('0x49')]['channel'],_0x3fffd8[_0x194d('0x49')]['type']);return db[_0x194d('0x4c')][_0x194d('0x48')](_0x3fffd8['body'],{'include':[{'model':db[_0x194d('0x53')],'as':_0x194d('0x50')},{'model':db[_0x194d('0x53')],'as':_0x194d('0x54')}]});}return null;})[_0x194d('0x24')](respondWithResult(_0x4a796c,null))[_0x194d('0x42')](handleError(_0x4a796c,null));};exports[_0x194d('0x55')]=function(_0x49ecaa,_0xaac1bc,_0x594c93){var _0x2d8104=[_0x194d('0x56'),_0x194d('0x57'),_0x194d('0x58'),'subcategory','close_code',_0x194d('0x59'),_0x194d('0x5a'),_0x194d('0x5b'),_0x194d('0x5c')];var _0x3f3257=[_0x194d('0x5d'),_0x194d('0x56'),_0x194d('0x5e'),_0x194d('0x5f'),_0x194d('0x60'),'sys_updated_on','child_incidents',_0x194d('0x57'),_0x194d('0x61'),'number',_0x194d('0x62'),_0x194d('0x63'),'opened_by',_0x194d('0x64'),_0x194d('0x65'),_0x194d('0x66'),_0x194d('0x67'),_0x194d('0x68'),'knowledge',_0x194d('0x39'),_0x194d('0x69'),_0x194d('0x6a'),_0x194d('0x6b'),_0x194d('0x6c'),_0x194d('0x6d'),_0x194d('0x6e'),_0x194d('0x6f'),_0x194d('0x70'),'priority',_0x194d('0x71'),_0x194d('0x72'),_0x194d('0x73'),'expected_start',_0x194d('0x74'),_0x194d('0x75'),_0x194d('0x76'),'work_end','reopened_time',_0x194d('0x77'),_0x194d('0x78'),_0x194d('0x79'),_0x194d('0x7a'),_0x194d('0x7b'),_0x194d('0x7c'),_0x194d('0x7d'),_0x194d('0x7e'),_0x194d('0x7f'),'work_start',_0x194d('0x80'),_0x194d('0x81'),'additional_assignee_list',_0x194d('0x82'),_0x194d('0x83'),'notify',_0x194d('0x84'),_0x194d('0x85'),_0x194d('0x86'),_0x194d('0x87'),'parent_incident',_0x194d('0x88'),'contact_type',_0x194d('0x89'),'incident_state',_0x194d('0x8a'),_0x194d('0x8b'),_0x194d('0x8c'),'reassignment_count',_0x194d('0x8d'),_0x194d('0x8e'),'severity','comments',_0x194d('0x8f'),'approval','comments_and_work_notes','due_date','sys_mod_count',_0x194d('0x90'),'sys_tags',_0x194d('0x91'),_0x194d('0x92'),_0x194d('0x93'),_0x194d('0x94'),_0x194d('0x5c')];var _0x54736e='';var _0xc44a78='';var _0x43dc5c=[];var _0x4d2725='';var _0x16ddb4='';var _0x114869=[];var _0x44086a='';var _0x38fdf6='';var _0x1d24e8={};var _0x1c5ac1='';return db[_0x194d('0x40')][_0x194d('0x4b')]({'where':{'id':_0x49ecaa[_0x194d('0x44')]['id']},'attributes':['id','username','password',_0x194d('0x95'),_0x194d('0x96'),_0x194d('0x97')]})['then'](handleEntityNotFound(_0xaac1bc,null))[_0x194d('0x24')](function(_0x4aa958){if(_0x4aa958){_0x1c5ac1=_0x4aa958[_0x194d('0x96')];var _0x36a07d=_0x1c5ac1[_0x194d('0x98')](-0x1);if(_0x36a07d==='/'){_0x1c5ac1=_0x1c5ac1[_0x194d('0x99')](0x0,_0x1c5ac1[_0x194d('0x9a')](_0x36a07d));}_0x38fdf6=util[_0x194d('0x9b')](_0x194d('0x9c'),_0x1c5ac1);_0x44086a=util[_0x194d('0x9b')](_0x194d('0x9d'),_0x1c5ac1);_0x1d24e8={'user':_0x4aa958[_0x194d('0x9e')],'pass':_0x4aa958[_0x194d('0x9f')]};var _0x43d547={'method':_0x194d('0xa0'),'uri':_0x38fdf6+_0x194d('0xa1'),'auth':_0x1d24e8,'json':!![]};return rp(_0x43d547);}})[_0x194d('0x24')](function(_0x39c139){if(_0x39c139[_0x194d('0xa2')]['length']>0x0){_0x54736e=_0x39c139[_0x194d('0xa2')];}console[_0x194d('0xa3')](_0x194d('0xa4'),_0x54736e);_0x114869=[];_0xc44a78=Object[_0x194d('0xa5')]([],_0x54736e);_[_0x194d('0xa6')](_0xc44a78,function(_0x3ecd3d){return!_0x2d8104[_0x194d('0xa7')](_0x3ecd3d[_0x194d('0x28')]);});_0xc44a78[_0x194d('0xa8')](function(_0x44369c){var _0x28fddc=createFieldObject(_0x44086a,_0x1d24e8,_0x44369c['internalType'],_0x44369c[_0x194d('0x28')],_0x44369c[_0x194d('0xa9')],![]);_0x114869['push'](_0x28fddc);});return Promise[_0x194d('0xaa')](_0x114869);})[_0x194d('0x24')](function(_0x2ea188){_0x43dc5c=_0x2ea188;_0x4d2725=Object[_0x194d('0xa5')]([],_0x54736e);console['log'](_0x194d('0xab'),_0x54736e);_['remove'](_0x4d2725,function(_0x1fed52){return _0x3f3257[_0x194d('0xa7')](_0x1fed52[_0x194d('0x28')]);});console[_0x194d('0xa3')](_0x194d('0xac'),_0x4d2725);_0x114869=[];_0x4d2725[_0x194d('0xa8')](function(_0x3b128a){var _0xc712e8=createFieldObject(_0x44086a,_0x1d24e8,_0x3b128a[_0x194d('0xad')],_0x3b128a[_0x194d('0x28')],_0x3b128a['label'],!![]);_0x114869[_0x194d('0xae')](_0xc712e8);});return Promise[_0x194d('0xaa')](_0x114869);})['then'](function(_0x6255f0){_0x16ddb4=_0x6255f0;var _0x4c258e=_0x43dc5c[_0x194d('0xaf')](_0x16ddb4);return{'count':_0x4c258e['length'],'rows':_0x4c258e};})[_0x194d('0x24')](respondWithResult(_0xaac1bc,null))[_0x194d('0x42')](function(_0x56c333){console[_0x194d('0xa3')](_0x194d('0xb0')+_0x56c333);var _0x2f275b=_0x49ecaa[_0x194d('0x30')][_0x194d('0xb1')]?0x1f4:_0x56c333[_0x194d('0xb2')]||0x1f4;logger[_0x194d('0x26')](_0x56c333['stack']);delete _0x56c333['name'];if(_0x2f275b===0x191){_0x2f275b=0x190;}_0xaac1bc[_0x194d('0x18')](_0x2f275b)['send'](_0x49ecaa['query'][_0x194d('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x56c333[_0x194d('0xb2')]}:_0x56c333);});};function createFieldObject(_0x34e36a,_0x37f775,_0x11bc72,_0x1457fb,_0x8a5275,_0x2ae0de){return new Promise(function(_0x48011b,_0x46a28e){var _0x3f6bd4={'id':_0x1457fb,'name':_0x8a5275,'custom':_0x2ae0de};if(_0x11bc72===_0x194d('0xb3')){_0x3f6bd4[_0x194d('0x3f')]=[{'name':'True','value':_0x194d('0xb4')},{'name':_0x194d('0xb5'),'value':_0x194d('0xb6')}];_0x48011b(_0x3f6bd4);}else{var _0x240b22={'method':_0x194d('0xa0'),'uri':_0x34e36a+_0x194d('0xb7')+_0x1457fb,'auth':_0x37f775,'json':!![]};return rp(_0x240b22)[_0x194d('0x24')](function(_0x65db6){var _0x381251=[];if(_0x65db6[_0x194d('0xa2')]['length']>0x0){_0x65db6[_0x194d('0xa2')][_0x194d('0xa8')](function(_0x3d13ca){if(_0x3d13ca[_0x194d('0xb8')]===_0x194d('0xb6')){var _0x3dd619={'name':_0x3d13ca[_0x194d('0xa9')],'value':_0x3d13ca[_0x194d('0xb9')]};_0x381251[_0x194d('0xae')](_0x3dd619);}});}_0x3f6bd4[_0x194d('0x3f')]=_0x381251;if(_0x3f6bd4[_0x194d('0x3f')]['length']>0x0){_0x48011b(_0x3f6bd4);}else{if(_0x2ae0de==![]){_0x48011b();}else{_0x48011b(_0x3f6bd4);}}});}});} \ No newline at end of file +var _0x62f0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','ServicenowConfiguration','rawAttributes','length','nolimit','AccountId','getSubjects','Descriptions','channel','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','opened_by','user_input','sys_created_on','state','sys_created_by','knowledge','calendar_stc','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','reopened_by','problem_id','company','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','findOne','username','password','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x126977,_0x25df7f){var _0x15e83e=function(_0xcaa3b9){while(--_0xcaa3b9){_0x126977['push'](_0x126977['shift']());}};_0x15e83e(++_0x25df7f);}(_0x62f0,0xa7));var _0x062f=function(_0x397f34,_0x3ac328){_0x397f34=_0x397f34-0x0;var _0x272cda=_0x62f0[_0x397f34];return _0x272cda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x062f('0x0'));var zipdir=require(_0x062f('0x1'));var jsonpatch=require(_0x062f('0x2'));var rp=require(_0x062f('0x3'));var moment=require('moment');var BPromise=require(_0x062f('0x4'));var Mustache=require('mustache');var util=require(_0x062f('0x5'));var path=require(_0x062f('0x6'));var sox=require('sox');var csv=require(_0x062f('0x7'));var ejs=require(_0x062f('0x8'));var fs=require('fs');var fs_extra=require(_0x062f('0x9'));var _=require(_0x062f('0xa'));var squel=require(_0x062f('0xb'));var crypto=require('crypto');var jsforce=require(_0x062f('0xc'));var deskjs=require(_0x062f('0xd'));var toCsv=require(_0x062f('0x7'));var querystring=require(_0x062f('0xe'));var Papa=require(_0x062f('0xf'));var Redis=require(_0x062f('0x10'));var authService=require(_0x062f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x062f('0x12'));var hardwareService=require(_0x062f('0x13'));var logger=require(_0x062f('0x14'))(_0x062f('0x15'));var utils=require(_0x062f('0x16'));var config=require(_0x062f('0x17'));var licenseUtil=require(_0x062f('0x18'));var db=require(_0x062f('0x19'))['db'];var integrations=require(_0x062f('0x1a'));function respondWithStatusCode(_0x21972b,_0x2970b4){_0x2970b4=_0x2970b4||0xcc;return function(_0xcca613){if(_0xcca613){return _0x21972b[_0x062f('0x1b')](_0x2970b4);}return _0x21972b[_0x062f('0x1c')](_0x2970b4)['end']();};}function respondWithResult(_0x1692b6,_0x551181){_0x551181=_0x551181||0xc8;return function(_0x4e84b7){if(_0x4e84b7){return _0x1692b6['status'](_0x551181)[_0x062f('0x1d')](_0x4e84b7);}};}function respondWithFilteredResult(_0x213755,_0x399f02){return function(_0xb09b83){if(_0xb09b83){var _0xc3ae52=typeof _0x399f02['offset']==='undefined'&&typeof _0x399f02[_0x062f('0x1e')]===_0x062f('0x1f');var _0x24a8a7=_0xb09b83[_0x062f('0x20')];var _0x25d95f=_0xc3ae52?0x0:_0x399f02['offset'];var _0x2231d6=_0xc3ae52?_0xb09b83[_0x062f('0x20')]:_0x399f02[_0x062f('0x21')]+_0x399f02[_0x062f('0x1e')];var _0x31e278;if(_0x2231d6>=_0x24a8a7){_0x2231d6=_0x24a8a7;_0x31e278=0xc8;}else{_0x31e278=0xce;}_0x213755[_0x062f('0x1c')](_0x31e278);return _0x213755[_0x062f('0x22')](_0x062f('0x23'),_0x25d95f+'-'+_0x2231d6+'/'+_0x24a8a7)['json'](_0xb09b83);}return null;};}function patchUpdates(_0x4467d1){return function(_0x45b8d0){try{jsonpatch[_0x062f('0x24')](_0x45b8d0,_0x4467d1,!![]);}catch(_0x4705fe){return BPromise[_0x062f('0x25')](_0x4705fe);}return _0x45b8d0[_0x062f('0x26')]();};}function saveUpdates(_0x3613c3,_0x4cd971){return function(_0xcf9ef9){if(_0xcf9ef9){return _0xcf9ef9[_0x062f('0x27')](_0x3613c3)[_0x062f('0x28')](function(_0x181368){return _0x181368;});}return null;};}function removeEntity(_0x216a7c,_0x929c75){return function(_0x2db404){if(_0x2db404){return _0x2db404[_0x062f('0x29')]()['then'](function(){_0x216a7c['status'](0xcc)[_0x062f('0x2a')]();});}};}function handleEntityNotFound(_0x207eda,_0x2bd6be){return function(_0x36da08){if(!_0x36da08){_0x207eda[_0x062f('0x1b')](0x194);}return _0x36da08;};}function handleError(_0x1c471d,_0x578ca5){_0x578ca5=_0x578ca5||0x1f4;return function(_0x5e1010){logger[_0x062f('0x2b')](_0x5e1010[_0x062f('0x2c')]);if(_0x5e1010['name']){delete _0x5e1010[_0x062f('0x2d')];}_0x1c471d[_0x062f('0x1c')](_0x578ca5)['send'](_0x5e1010);};}exports[_0x062f('0x2e')]=function(_0x4448df,_0x4ba127){var _0x443aef={},_0x24c8a4={},_0x21f842={'count':0x0,'rows':[]};var _0x5effe3=_['map'](db['ServicenowAccount']['rawAttributes'],function(_0x5b057a){return{'name':_0x5b057a[_0x062f('0x2f')],'type':_0x5b057a[_0x062f('0x30')][_0x062f('0x31')]};});_0x24c8a4['model']=_[_0x062f('0x32')](_0x5effe3,_0x062f('0x2d'));_0x24c8a4[_0x062f('0x33')]=_[_0x062f('0x34')](_0x4448df['query']);_0x24c8a4[_0x062f('0x35')]=_[_0x062f('0x36')](_0x24c8a4[_0x062f('0x37')],_0x24c8a4[_0x062f('0x33')]);_0x443aef['attributes']=_['intersection'](_0x24c8a4[_0x062f('0x37')],qs[_0x062f('0x38')](_0x4448df[_0x062f('0x33')][_0x062f('0x38')]));_0x443aef[_0x062f('0x39')]=_0x443aef[_0x062f('0x39')]['length']?_0x443aef[_0x062f('0x39')]:_0x24c8a4[_0x062f('0x37')];if(!_0x4448df[_0x062f('0x33')][_0x062f('0x3a')]('nolimit')){_0x443aef[_0x062f('0x1e')]=qs[_0x062f('0x1e')](_0x4448df[_0x062f('0x33')][_0x062f('0x1e')]);_0x443aef['offset']=qs[_0x062f('0x21')](_0x4448df[_0x062f('0x33')][_0x062f('0x21')]);}_0x443aef[_0x062f('0x3b')]=qs[_0x062f('0x3c')](_0x4448df[_0x062f('0x33')][_0x062f('0x3c')]);_0x443aef[_0x062f('0x3d')]=qs[_0x062f('0x35')](_[_0x062f('0x3e')](_0x4448df[_0x062f('0x33')],_0x24c8a4[_0x062f('0x35')]),_0x5effe3);if(_0x4448df[_0x062f('0x33')][_0x062f('0x3f')]){_0x443aef[_0x062f('0x3d')]=_[_0x062f('0x40')](_0x443aef['where'],{'$or':_[_0x062f('0x32')](_0x5effe3,function(_0x6f6ec1){if(_0x6f6ec1[_0x062f('0x30')]!==_0x062f('0x41')){var _0x31c2b5={};_0x31c2b5[_0x6f6ec1['name']]={'$like':'%'+_0x4448df['query'][_0x062f('0x3f')]+'%'};return _0x31c2b5;}})});}_0x443aef=_[_0x062f('0x40')]({},_0x443aef,_0x4448df[_0x062f('0x42')]);var _0x4bd5c1={'where':_0x443aef[_0x062f('0x3d')]};return db[_0x062f('0x43')][_0x062f('0x20')](_0x4bd5c1)[_0x062f('0x28')](function(_0x5bbf22){_0x21f842['count']=_0x5bbf22;if(_0x4448df[_0x062f('0x33')][_0x062f('0x44')]){_0x443aef[_0x062f('0x45')]=[{'all':!![]}];}return db[_0x062f('0x43')][_0x062f('0x46')](_0x443aef);})[_0x062f('0x28')](function(_0x24a396){_0x21f842[_0x062f('0x47')]=_0x24a396;return _0x21f842;})[_0x062f('0x28')](respondWithFilteredResult(_0x4ba127,_0x443aef))[_0x062f('0x48')](handleError(_0x4ba127,null));};exports['show']=function(_0xcce76e,_0x47a948){var _0x221ac5={'raw':![],'where':{'id':_0xcce76e[_0x062f('0x49')]['id']}},_0x399739={};_0x399739[_0x062f('0x37')]=_[_0x062f('0x34')](db[_0x062f('0x43')]['rawAttributes']);_0x399739[_0x062f('0x33')]=_[_0x062f('0x34')](_0xcce76e[_0x062f('0x33')]);_0x399739[_0x062f('0x35')]=_[_0x062f('0x36')](_0x399739[_0x062f('0x37')],_0x399739[_0x062f('0x33')]);_0x221ac5[_0x062f('0x39')]=_[_0x062f('0x36')](_0x399739[_0x062f('0x37')],qs[_0x062f('0x38')](_0xcce76e['query'][_0x062f('0x38')]));_0x221ac5[_0x062f('0x39')]=_0x221ac5[_0x062f('0x39')]['length']?_0x221ac5[_0x062f('0x39')]:_0x399739[_0x062f('0x37')];if(_0xcce76e[_0x062f('0x33')][_0x062f('0x44')]){_0x221ac5['include']=[{'all':!![]}];}_0x221ac5=_[_0x062f('0x40')]({},_0x221ac5,_0xcce76e[_0x062f('0x42')]);return db[_0x062f('0x43')]['find'](_0x221ac5)[_0x062f('0x28')](handleEntityNotFound(_0x47a948,null))[_0x062f('0x28')](respondWithResult(_0x47a948,null))['catch'](handleError(_0x47a948,null));};exports[_0x062f('0x4a')]=function(_0x277ca3,_0x15a5eb){return db[_0x062f('0x43')]['create'](_0x277ca3[_0x062f('0x4b')],{})[_0x062f('0x28')](respondWithResult(_0x15a5eb,0xc9))[_0x062f('0x48')](handleError(_0x15a5eb,null));};exports[_0x062f('0x27')]=function(_0x38ec05,_0x5373de){if(_0x38ec05[_0x062f('0x4b')]['id']){delete _0x38ec05[_0x062f('0x4b')]['id'];}return db[_0x062f('0x43')][_0x062f('0x4c')]({'where':{'id':_0x38ec05[_0x062f('0x49')]['id']}})['then'](handleEntityNotFound(_0x5373de,null))[_0x062f('0x28')](saveUpdates(_0x38ec05[_0x062f('0x4b')],null))[_0x062f('0x28')](respondWithResult(_0x5373de,null))[_0x062f('0x48')](handleError(_0x5373de,null));};exports['destroy']=function(_0x43ded0,_0x5910f2){return db[_0x062f('0x43')][_0x062f('0x4c')]({'where':{'id':_0x43ded0[_0x062f('0x49')]['id']}})[_0x062f('0x28')](handleEntityNotFound(_0x5910f2,null))[_0x062f('0x28')](removeEntity(_0x5910f2,null))[_0x062f('0x48')](handleError(_0x5910f2,null));};exports[_0x062f('0x4d')]=function(_0x41128e,_0x153609,_0x5063bf){var _0x1b9bd2={};var _0x54f600={};var _0x434050;var _0x3a6dcd;return db[_0x062f('0x43')]['findOne']({'where':{'id':_0x41128e['params']['id']}})['then'](handleEntityNotFound(_0x153609,null))[_0x062f('0x28')](function(_0x78d7d5){if(_0x78d7d5){_0x434050=_0x78d7d5;_0x54f600[_0x062f('0x37')]=_[_0x062f('0x34')](db[_0x062f('0x4e')][_0x062f('0x4f')]);_0x54f600['query']=_['keys'](_0x41128e[_0x062f('0x33')]);_0x54f600[_0x062f('0x35')]=_[_0x062f('0x36')](_0x54f600[_0x062f('0x37')],_0x54f600[_0x062f('0x33')]);_0x1b9bd2[_0x062f('0x39')]=_[_0x062f('0x36')](_0x54f600[_0x062f('0x37')],qs[_0x062f('0x38')](_0x41128e[_0x062f('0x33')][_0x062f('0x38')]));_0x1b9bd2['attributes']=_0x1b9bd2[_0x062f('0x39')]['length']?_0x1b9bd2['attributes']:_0x54f600[_0x062f('0x37')];_0x1b9bd2['order']=qs['sort'](_0x41128e[_0x062f('0x33')]['sort']);_0x1b9bd2[_0x062f('0x3d')]=qs[_0x062f('0x35')](_[_0x062f('0x3e')](_0x41128e['query'],_0x54f600[_0x062f('0x35')]));if(_0x41128e['query'][_0x062f('0x3f')]){_0x1b9bd2[_0x062f('0x3d')]=_[_0x062f('0x40')](_0x1b9bd2['where'],{'$or':_[_0x062f('0x32')](_0x1b9bd2[_0x062f('0x39')],function(_0x5c2f87){var _0xe4f3e={};_0xe4f3e[_0x5c2f87]={'$like':'%'+_0x41128e[_0x062f('0x33')][_0x062f('0x3f')]+'%'};return _0xe4f3e;})});}_0x1b9bd2=_[_0x062f('0x40')]({},_0x1b9bd2,_0x41128e[_0x062f('0x42')]);return _0x434050[_0x062f('0x4d')](_0x1b9bd2);}})[_0x062f('0x28')](function(_0x5c8260){if(_0x5c8260){_0x3a6dcd=_0x5c8260[_0x062f('0x50')];if(!_0x41128e[_0x062f('0x33')]['hasOwnProperty'](_0x062f('0x51'))){_0x1b9bd2['limit']=qs['limit'](_0x41128e[_0x062f('0x33')][_0x062f('0x1e')]);_0x1b9bd2[_0x062f('0x21')]=qs[_0x062f('0x21')](_0x41128e[_0x062f('0x33')][_0x062f('0x21')]);}return _0x434050[_0x062f('0x4d')](_0x1b9bd2);}})[_0x062f('0x28')](function(_0xb0d46b){if(_0xb0d46b){return _0xb0d46b?{'count':_0x3a6dcd,'rows':_0xb0d46b}:null;}})[_0x062f('0x28')](respondWithResult(_0x153609,null))[_0x062f('0x48')](handleError(_0x153609,null));};exports['addConfiguration']=function(_0x3281e6,_0x37537b,_0x4d85ab){if(_0x3281e6[_0x062f('0x4b')]['id']){delete _0x3281e6[_0x062f('0x4b')]['id'];}return db[_0x062f('0x43')]['findOne']({'where':{'id':_0x3281e6[_0x062f('0x49')]['id']}})[_0x062f('0x28')](handleEntityNotFound(_0x37537b,null))[_0x062f('0x28')](function(_0x5b5bdd){if(_0x5b5bdd){_0x3281e6[_0x062f('0x4b')][_0x062f('0x52')]=_0x5b5bdd['id'];_0x3281e6[_0x062f('0x4b')]['Subjects']=integrations[_0x062f('0x53')](_0x3281e6[_0x062f('0x4b')]['channel'],_0x3281e6[_0x062f('0x4b')][_0x062f('0x30')]);_0x3281e6[_0x062f('0x4b')][_0x062f('0x54')]=integrations['getDescriptions'](_0x3281e6['body'][_0x062f('0x55')],_0x3281e6[_0x062f('0x4b')][_0x062f('0x30')]);return db[_0x062f('0x4e')][_0x062f('0x4a')](_0x3281e6['body'],{'include':[{'model':db[_0x062f('0x56')],'as':'Subjects'},{'model':db[_0x062f('0x56')],'as':_0x062f('0x54')}]});}return null;})['then'](respondWithResult(_0x37537b,null))[_0x062f('0x48')](handleError(_0x37537b,null));};exports[_0x062f('0x57')]=function(_0x5bc56d,_0x33b886,_0x358cf7){var _0x55da14=['made_sla',_0x062f('0x58'),'knowledge',_0x062f('0x59'),_0x062f('0x5a'),_0x062f('0x5b'),_0x062f('0x5c'),_0x062f('0x5d'),_0x062f('0x5e')];var _0x41aa93=[_0x062f('0x5f'),'made_sla',_0x062f('0x60'),'watch_list',_0x062f('0x61'),_0x062f('0x62'),_0x062f('0x63'),'hold_reason',_0x062f('0x64'),'number','resolved_by','sys_updated_by',_0x062f('0x65'),_0x062f('0x66'),_0x062f('0x67'),'sys_domain',_0x062f('0x68'),_0x062f('0x69'),_0x062f('0x6a'),_0x062f('0x3b'),_0x062f('0x6b'),'closed_at','cmdb_ci',_0x062f('0x6c'),_0x062f('0x6d'),'active',_0x062f('0x6e'),_0x062f('0x6f'),'priority',_0x062f('0x70'),_0x062f('0x71'),_0x062f('0x72'),_0x062f('0x73'),_0x062f('0x74'),_0x062f('0x75'),_0x062f('0x76'),_0x062f('0x77'),_0x062f('0x78'),_0x062f('0x79'),'caller_id',_0x062f('0x7a'),_0x062f('0x59'),_0x062f('0x7b'),_0x062f('0x7c'),'close_code',_0x062f('0x7d'),_0x062f('0x7e'),_0x062f('0x7f'),_0x062f('0x80'),_0x062f('0x81'),'additional_assignee_list',_0x062f('0x82'),_0x062f('0x83'),_0x062f('0x5b'),_0x062f('0x84'),'close_notes',_0x062f('0x85'),_0x062f('0x86'),_0x062f('0x87'),_0x062f('0x88'),'contact_type',_0x062f('0x89'),_0x062f('0x5c'),'urgency',_0x062f('0x8a'),_0x062f('0x8b'),'reassignment_count','activity_due',_0x062f('0x8c'),'severity',_0x062f('0x8d'),'sla_due',_0x062f('0x8e'),_0x062f('0x8f'),_0x062f('0x90'),_0x062f('0x91'),_0x062f('0x92'),_0x062f('0x93'),_0x062f('0x94'),_0x062f('0x95'),_0x062f('0x96'),_0x062f('0x97'),_0x062f('0x5e')];var _0x236019='';var _0x29fb4b='';var _0x5cb4f3=[];var _0x437777='';var _0x7dedcf='';var _0x2edbd5=[];var _0x267ecd='';var _0x2bc81f='';var _0x398848={};var _0x1749b0='';return db[_0x062f('0x43')][_0x062f('0x98')]({'where':{'id':_0x5bc56d['params']['id']},'attributes':['id',_0x062f('0x99'),_0x062f('0x9a'),'email',_0x062f('0x9b'),'serverUrl']})['then'](handleEntityNotFound(_0x33b886,null))[_0x062f('0x28')](function(_0x1d0ea4){if(_0x1d0ea4){_0x1749b0=_0x1d0ea4['remoteUri'];var _0x53d09d=_0x1749b0[_0x062f('0x9c')](-0x1);if(_0x53d09d==='/'){_0x1749b0=_0x1749b0['substring'](0x0,_0x1749b0[_0x062f('0x9d')](_0x53d09d));}_0x2bc81f=util[_0x062f('0x9e')](_0x062f('0x9f'),_0x1749b0);_0x267ecd=util[_0x062f('0x9e')]('%s/api/now/table/',_0x1749b0);_0x398848={'user':_0x1d0ea4['username'],'pass':_0x1d0ea4['password']};var _0x2c3545={'method':_0x062f('0xa0'),'uri':_0x2bc81f+_0x062f('0xa1'),'auth':_0x398848,'json':!![]};return rp(_0x2c3545);}})[_0x062f('0x28')](function(_0xc608c){if(_0xc608c[_0x062f('0xa2')][_0x062f('0x50')]>0x0){_0x236019=_0xc608c[_0x062f('0xa2')];}console[_0x062f('0xa3')](_0x062f('0xa4'),_0x236019);_0x2edbd5=[];_0x29fb4b=Object[_0x062f('0xa5')]([],_0x236019);_[_0x062f('0xa6')](_0x29fb4b,function(_0x494c4c){return!_0x55da14[_0x062f('0xa7')](_0x494c4c[_0x062f('0x2d')]);});_0x29fb4b[_0x062f('0xa8')](function(_0x238c1d){var _0x32031c=createFieldObject(_0x267ecd,_0x398848,_0x238c1d['internalType'],_0x238c1d[_0x062f('0x2d')],_0x238c1d[_0x062f('0xa9')],![]);_0x2edbd5[_0x062f('0xaa')](_0x32031c);});return Promise[_0x062f('0xab')](_0x2edbd5);})[_0x062f('0x28')](function(_0x267cb5){_0x5cb4f3=_0x267cb5;_0x437777=Object[_0x062f('0xa5')]([],_0x236019);console[_0x062f('0xa3')](_0x062f('0xac'),_0x236019);_[_0x062f('0xa6')](_0x437777,function(_0x943c2f){return _0x41aa93[_0x062f('0xa7')](_0x943c2f[_0x062f('0x2d')]);});console['log'](_0x062f('0xad'),_0x437777);_0x2edbd5=[];_0x437777[_0x062f('0xa8')](function(_0x42b216){var _0x2b1f33=createFieldObject(_0x267ecd,_0x398848,_0x42b216[_0x062f('0xae')],_0x42b216[_0x062f('0x2d')],_0x42b216[_0x062f('0xa9')],!![]);_0x2edbd5[_0x062f('0xaa')](_0x2b1f33);});return Promise[_0x062f('0xab')](_0x2edbd5);})[_0x062f('0x28')](function(_0x5d00c5){_0x7dedcf=_0x5d00c5;var _0x5d6d2b=_0x5cb4f3[_0x062f('0xaf')](_0x7dedcf);return{'count':_0x5d6d2b[_0x062f('0x50')],'rows':_0x5d6d2b};})[_0x062f('0x28')](respondWithResult(_0x33b886,null))[_0x062f('0x48')](function(_0x32145c){console[_0x062f('0xa3')](_0x062f('0xb0')+_0x32145c);var _0xdb5d60=_0x5bc56d[_0x062f('0x33')]['test']?0x1f4:_0x32145c[_0x062f('0xb1')]||0x1f4;logger['error'](_0x32145c[_0x062f('0x2c')]);delete _0x32145c[_0x062f('0x2d')];if(_0xdb5d60===0x191){_0xdb5d60=0x190;}_0x33b886['status'](_0xdb5d60)['send'](_0x5bc56d['query'][_0x062f('0xb2')]?{'message':_0x062f('0xb3'),'statusCode':_0x32145c['statusCode']}:_0x32145c);});};function createFieldObject(_0x4253c9,_0x597379,_0x1f6343,_0x130557,_0x449149,_0x5b32fa){return new Promise(function(_0x353719,_0x52c488){var _0x1ea172={'id':_0x130557,'name':_0x449149,'custom':_0x5b32fa};if(_0x1f6343==='boolean'){_0x1ea172[_0x062f('0x42')]=[{'name':'True','value':'true'},{'name':_0x062f('0xb4'),'value':_0x062f('0xb5')}];_0x353719(_0x1ea172);}else{var _0x2770c7={'method':_0x062f('0xa0'),'uri':_0x4253c9+_0x062f('0xb6')+_0x130557,'auth':_0x597379,'json':!![]};return rp(_0x2770c7)[_0x062f('0x28')](function(_0x4b6237){var _0x4052a5=[];if(_0x4b6237['result'][_0x062f('0x50')]>0x0){_0x4b6237['result'][_0x062f('0xa8')](function(_0x5d6ad2){if(_0x5d6ad2[_0x062f('0xb7')]===_0x062f('0xb5')){var _0x2511db={'name':_0x5d6ad2['label'],'value':_0x5d6ad2[_0x062f('0xb8')]};_0x4052a5[_0x062f('0xaa')](_0x2511db);}});}_0x1ea172['options']=_0x4052a5;if(_0x1ea172[_0x062f('0x42')]['length']>0x0){_0x353719(_0x1ea172);}else{if(_0x5b32fa==![]){_0x353719();}else{_0x353719(_0x1ea172);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index b45baad..af60add 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 _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x37b75c,_0x3c9493){var _0x22207b=function(_0x40f504){while(--_0x40f504){_0x37b75c['push'](_0x37b75c['shift']());}};_0x22207b(++_0x3c9493);}(_0xb138,0x1dd));var _0x8b13=function(_0x1ff44d,_0x5ca0cc){_0x1ff44d=_0x1ff44d-0x0;var _0x24e958=_0xb138[_0x1ff44d];return _0x24e958;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0xf2ca[_0x266ddc];return _0x39c1d7;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index d319834..4e250c9 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 _0xd3ed=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','then','find','ShowServicenowAccount','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4a5959,_0xcf0ae0){var _0x118218=function(_0x5a1838){while(--_0x5a1838){_0x4a5959['push'](_0x4a5959['shift']());}};_0x118218(++_0xcf0ae0);}(_0xd3ed,0x104));var _0xdd3e=function(_0x251100,_0x1072a8){_0x251100=_0x251100-0x0;var _0x2d034e=_0xd3ed[_0x251100];return _0x2d034e;};'use strict';var _=require(_0xdd3e('0x0'));var util=require(_0xdd3e('0x1'));var moment=require(_0xdd3e('0x2'));var BPromise=require(_0xdd3e('0x3'));var rs=require(_0xdd3e('0x4'));var fs=require('fs');var Redis=require(_0xdd3e('0x5'));var db=require(_0xdd3e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd3e('0x7'))(_0xdd3e('0x8'));var config=require(_0xdd3e('0x9'));var jayson=require(_0xdd3e('0xa'));var client=jayson[_0xdd3e('0xb')][_0xdd3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46acfe,_0xc8a672,_0x3ce911){return new BPromise(function(_0x592600,_0x35ed56){return client[_0xdd3e('0xd')](_0x46acfe,_0x3ce911)['then'](function(_0x47f2b1){logger[_0xdd3e('0xe')](_0xdd3e('0xf'),_0xc8a672,'request\x20sent');logger[_0xdd3e('0x10')](_0xdd3e('0x11'),_0xc8a672,'request\x20sent',JSON[_0xdd3e('0x12')](_0x47f2b1));if(_0x47f2b1[_0xdd3e('0x13')]){if(_0x47f2b1[_0xdd3e('0x13')][_0xdd3e('0x14')]===0x1f4){logger[_0xdd3e('0x13')](_0xdd3e('0xf'),_0xc8a672,_0x47f2b1['error']['message']);return _0x35ed56(_0x47f2b1['error'][_0xdd3e('0x15')]);}logger[_0xdd3e('0x13')](_0xdd3e('0xf'),_0xc8a672,_0x47f2b1[_0xdd3e('0x13')]['message']);return _0x592600(_0x47f2b1[_0xdd3e('0x13')][_0xdd3e('0x15')]);}else{logger[_0xdd3e('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0xc8a672,_0xdd3e('0x16'));_0x592600(_0x47f2b1[_0xdd3e('0x17')]['message']);}})[_0xdd3e('0x18')](function(_0x564330){logger[_0xdd3e('0x13')](_0xdd3e('0xf'),_0xc8a672,_0x564330);_0x35ed56(_0x564330);});});}exports[_0xdd3e('0x19')]=function(_0x349e1a){var _0x3fee71=this;return new Promise(function(_0x27b334,_0x5700f8){return db[_0xdd3e('0x1a')][_0xdd3e('0x1b')]({'raw':_0x349e1a['options']?_0x349e1a[_0xdd3e('0x1c')][_0xdd3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x349e1a['options']?_0x349e1a[_0xdd3e('0x1c')][_0xdd3e('0x1e')]||null:null,'attributes':_0x349e1a[_0xdd3e('0x1c')]?_0x349e1a['options']['attributes']||null:null,'limit':_0x349e1a[_0xdd3e('0x1c')]?_0x349e1a['options']['limit']||null:null,'include':_0x349e1a[_0xdd3e('0x1c')]?_0x349e1a[_0xdd3e('0x1c')][_0xdd3e('0x1f')]?_[_0xdd3e('0x20')](_0x349e1a['options'][_0xdd3e('0x1f')],function(_0x1f16ef){return{'model':db[_0x1f16ef[_0xdd3e('0x21')]],'as':_0x1f16ef['as'],'attributes':_0x1f16ef[_0xdd3e('0x22')],'include':_0x1f16ef['include']?_[_0xdd3e('0x20')](_0x1f16ef[_0xdd3e('0x1f')],function(_0x15d031){return{'model':db[_0x15d031[_0xdd3e('0x21')]],'as':_0x15d031['as'],'attributes':_0x15d031['attributes'],'include':_0x15d031[_0xdd3e('0x1f')]?_['map'](_0x15d031[_0xdd3e('0x1f')],function(_0x55a9b3){return{'model':db[_0x55a9b3[_0xdd3e('0x21')]],'as':_0x55a9b3['as'],'attributes':_0x55a9b3[_0xdd3e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xdd3e('0x23')](function(_0xe10119){logger['info'](_0xdd3e('0x19'),_0x349e1a);logger['debug']('GetServicenowAccount',_0x349e1a,JSON[_0xdd3e('0x12')](_0xe10119));_0x27b334(_0xe10119);})[_0xdd3e('0x18')](function(_0x2c1015){logger['error']('GetServicenowAccount',_0x2c1015[_0xdd3e('0x15')],_0x349e1a);_0x5700f8(_0x3fee71['error'](0x1f4,_0x2c1015[_0xdd3e('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x4e1f34){var _0x39328f=this;return new Promise(function(_0x326c37,_0x47d733){return db[_0xdd3e('0x1a')][_0xdd3e('0x24')]({'raw':_0x4e1f34[_0xdd3e('0x1c')]?_0x4e1f34[_0xdd3e('0x1c')][_0xdd3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e1f34['options']?_0x4e1f34[_0xdd3e('0x1c')][_0xdd3e('0x1e')]||null:null,'attributes':_0x4e1f34[_0xdd3e('0x1c')]?_0x4e1f34[_0xdd3e('0x1c')]['attributes']||null:null,'include':_0x4e1f34['options']?_0x4e1f34[_0xdd3e('0x1c')][_0xdd3e('0x1f')]?_[_0xdd3e('0x20')](_0x4e1f34[_0xdd3e('0x1c')][_0xdd3e('0x1f')],function(_0x3c6136){return{'model':db[_0x3c6136[_0xdd3e('0x21')]],'as':_0x3c6136['as'],'attributes':_0x3c6136[_0xdd3e('0x22')],'include':_0x3c6136['include']?_[_0xdd3e('0x20')](_0x3c6136['include'],function(_0x2361d4){return{'model':db[_0x2361d4[_0xdd3e('0x21')]],'as':_0x2361d4['as'],'attributes':_0x2361d4[_0xdd3e('0x22')],'include':_0x2361d4[_0xdd3e('0x1f')]?_['map'](_0x2361d4[_0xdd3e('0x1f')],function(_0x40cc78){return{'model':db[_0x40cc78[_0xdd3e('0x21')]],'as':_0x40cc78['as'],'attributes':_0x40cc78['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe348cd){logger[_0xdd3e('0xe')]('ShowServicenowAccount',_0x4e1f34);logger[_0xdd3e('0x10')](_0xdd3e('0x25'),_0x4e1f34,JSON[_0xdd3e('0x12')](_0xe348cd));_0x326c37(_0xe348cd);})['catch'](function(_0xd1e569){logger[_0xdd3e('0x13')](_0xdd3e('0x25'),_0xd1e569[_0xdd3e('0x15')],_0x4e1f34);_0x47d733(_0x39328f[_0xdd3e('0x13')](0x1f4,_0xd1e569['message']));});});}; \ No newline at end of file +var _0xb332=['ShowServicenowAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','include','map','model','attributes','find'];(function(_0x4fd271,_0x33a070){var _0x4543c7=function(_0x55c1f7){while(--_0x55c1f7){_0x4fd271['push'](_0x4fd271['shift']());}};_0x4543c7(++_0x33a070);}(_0xb332,0xda));var _0x2b33=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0xb332[_0xf168d3];return _0x17fb54;};'use strict';var _=require('lodash');var util=require(_0x2b33('0x0'));var moment=require('moment');var BPromise=require(_0x2b33('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b33('0x2'));var db=require(_0x2b33('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b33('0x4'))(_0x2b33('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b33('0x6'));var client=jayson['client'][_0x2b33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x215e1b,_0x3edcde,_0x3a52f7){return new BPromise(function(_0x5181dd,_0xcfd2ea){return client[_0x2b33('0x8')](_0x215e1b,_0x3a52f7)[_0x2b33('0x9')](function(_0x2213b3){logger[_0x2b33('0xa')](_0x2b33('0xb'),_0x3edcde,_0x2b33('0xc'));logger[_0x2b33('0xd')](_0x2b33('0xe'),_0x3edcde,_0x2b33('0xc'),JSON[_0x2b33('0xf')](_0x2213b3));if(_0x2213b3[_0x2b33('0x10')]){if(_0x2213b3[_0x2b33('0x10')]['code']===0x1f4){logger[_0x2b33('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x3edcde,_0x2213b3[_0x2b33('0x10')][_0x2b33('0x11')]);return _0xcfd2ea(_0x2213b3['error']['message']);}logger[_0x2b33('0x10')](_0x2b33('0xb'),_0x3edcde,_0x2213b3[_0x2b33('0x10')][_0x2b33('0x11')]);return _0x5181dd(_0x2213b3[_0x2b33('0x10')][_0x2b33('0x11')]);}else{logger[_0x2b33('0xa')](_0x2b33('0xb'),_0x3edcde,_0x2b33('0xc'));_0x5181dd(_0x2213b3['result'][_0x2b33('0x11')]);}})[_0x2b33('0x12')](function(_0x24e10f){logger[_0x2b33('0x10')](_0x2b33('0xb'),_0x3edcde,_0x24e10f);_0xcfd2ea(_0x24e10f);});});}exports[_0x2b33('0x13')]=function(_0x1b8942){var _0x2cb8c5=this;return new Promise(function(_0x489bf0,_0x30fd5b){return db[_0x2b33('0x14')][_0x2b33('0x15')]({'raw':_0x1b8942[_0x2b33('0x16')]?_0x1b8942[_0x2b33('0x16')][_0x2b33('0x17')]===undefined?!![]:![]:!![],'where':_0x1b8942[_0x2b33('0x16')]?_0x1b8942[_0x2b33('0x16')][_0x2b33('0x18')]||null:null,'attributes':_0x1b8942[_0x2b33('0x16')]?_0x1b8942['options']['attributes']||null:null,'limit':_0x1b8942['options']?_0x1b8942[_0x2b33('0x16')]['limit']||null:null,'include':_0x1b8942[_0x2b33('0x16')]?_0x1b8942[_0x2b33('0x16')][_0x2b33('0x19')]?_[_0x2b33('0x1a')](_0x1b8942[_0x2b33('0x16')][_0x2b33('0x19')],function(_0x2c0e64){return{'model':db[_0x2c0e64[_0x2b33('0x1b')]],'as':_0x2c0e64['as'],'attributes':_0x2c0e64[_0x2b33('0x1c')],'include':_0x2c0e64['include']?_['map'](_0x2c0e64[_0x2b33('0x19')],function(_0x561548){return{'model':db[_0x561548[_0x2b33('0x1b')]],'as':_0x561548['as'],'attributes':_0x561548[_0x2b33('0x1c')],'include':_0x561548[_0x2b33('0x19')]?_[_0x2b33('0x1a')](_0x561548[_0x2b33('0x19')],function(_0x25adab){return{'model':db[_0x25adab[_0x2b33('0x1b')]],'as':_0x25adab['as'],'attributes':_0x25adab['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x438ceb){logger['info']('GetServicenowAccount',_0x1b8942);logger[_0x2b33('0xd')]('GetServicenowAccount',_0x1b8942,JSON[_0x2b33('0xf')](_0x438ceb));_0x489bf0(_0x438ceb);})[_0x2b33('0x12')](function(_0x53cd59){logger['error'](_0x2b33('0x13'),_0x53cd59[_0x2b33('0x11')],_0x1b8942);_0x30fd5b(_0x2cb8c5['error'](0x1f4,_0x53cd59[_0x2b33('0x11')]));});});};exports['ShowServicenowAccount']=function(_0x5cd77a){var _0x4eed6c=this;return new Promise(function(_0x4b343a,_0x3ed20f){return db[_0x2b33('0x14')][_0x2b33('0x1d')]({'raw':_0x5cd77a[_0x2b33('0x16')]?_0x5cd77a[_0x2b33('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5cd77a[_0x2b33('0x16')]?_0x5cd77a[_0x2b33('0x16')][_0x2b33('0x18')]||null:null,'attributes':_0x5cd77a[_0x2b33('0x16')]?_0x5cd77a[_0x2b33('0x16')][_0x2b33('0x1c')]||null:null,'include':_0x5cd77a[_0x2b33('0x16')]?_0x5cd77a['options'][_0x2b33('0x19')]?_[_0x2b33('0x1a')](_0x5cd77a[_0x2b33('0x16')]['include'],function(_0x3a18bb){return{'model':db[_0x3a18bb['model']],'as':_0x3a18bb['as'],'attributes':_0x3a18bb[_0x2b33('0x1c')],'include':_0x3a18bb[_0x2b33('0x19')]?_['map'](_0x3a18bb[_0x2b33('0x19')],function(_0x16a671){return{'model':db[_0x16a671[_0x2b33('0x1b')]],'as':_0x16a671['as'],'attributes':_0x16a671['attributes'],'include':_0x16a671[_0x2b33('0x19')]?_[_0x2b33('0x1a')](_0x16a671[_0x2b33('0x19')],function(_0x216dba){return{'model':db[_0x216dba[_0x2b33('0x1b')]],'as':_0x216dba['as'],'attributes':_0x216dba['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b33('0x9')](function(_0x418a72){logger[_0x2b33('0xa')]('ShowServicenowAccount',_0x5cd77a);logger[_0x2b33('0xd')](_0x2b33('0x1e'),_0x5cd77a,JSON[_0x2b33('0xf')](_0x418a72));_0x4b343a(_0x418a72);})['catch'](function(_0x2ee4d4){logger[_0x2b33('0x10')](_0x2b33('0x1e'),_0x2ee4d4[_0x2b33('0x11')],_0x5cd77a);_0x3ed20f(_0x4eed6c[_0x2b33('0x10')](0x1f4,_0x2ee4d4[_0x2b33('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 54cce7c..207fd86 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 _0x9068=['post','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x4755ca,_0x2a6334){var _0x3bc24f=function(_0x281260){while(--_0x281260){_0x4755ca['push'](_0x4755ca['shift']());}};_0x3bc24f(++_0x2a6334);}(_0x9068,0xce));var _0x8906=function(_0x13b3f2,_0x1f230e){_0x13b3f2=_0x13b3f2-0x0;var _0x476495=_0x9068[_0x13b3f2];return _0x476495;};'use strict';var multer=require(_0x8906('0x0'));var util=require(_0x8906('0x1'));var path=require(_0x8906('0x2'));var timeout=require(_0x8906('0x3'));var express=require(_0x8906('0x4'));var router=express[_0x8906('0x5')]();var fs_extra=require(_0x8906('0x6'));var auth=require(_0x8906('0x7'));var interaction=require(_0x8906('0x8'));var config=require(_0x8906('0x9'));var controller=require(_0x8906('0xa'));router[_0x8906('0xb')]('/',auth[_0x8906('0xc')](),controller[_0x8906('0xd')]);router['get']('/:id',auth[_0x8906('0xc')](),controller[_0x8906('0xe')]);router[_0x8906('0xb')](_0x8906('0xf'),auth[_0x8906('0xc')](),controller[_0x8906('0x10')]);router[_0x8906('0xb')](_0x8906('0x11'),auth['isAuthenticated'](),controller[_0x8906('0x12')]);router[_0x8906('0xb')]('/:id/descriptions',auth[_0x8906('0xc')](),controller['getDescriptions']);router[_0x8906('0x13')]('/',auth['isAuthenticated'](),controller[_0x8906('0x14')]);router['put'](_0x8906('0x15'),auth['isAuthenticated'](),controller[_0x8906('0x16')]);router[_0x8906('0x17')](_0x8906('0x15'),auth['isAuthenticated'](),controller['destroy']);module[_0x8906('0x18')]=router; \ No newline at end of file +var _0x2f9f=['update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0x2f9f,0x17e));var _0xf2f9=function(_0x5db322,_0x3693ad){_0x5db322=_0x5db322-0x0;var _0x92d27=_0x2f9f[_0x5db322];return _0x92d27;};'use strict';var multer=require(_0xf2f9('0x0'));var util=require('util');var path=require(_0xf2f9('0x1'));var timeout=require(_0xf2f9('0x2'));var express=require(_0xf2f9('0x3'));var router=express[_0xf2f9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2f9('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0xf2f9('0x6')]('/',auth[_0xf2f9('0x7')](),controller[_0xf2f9('0x8')]);router[_0xf2f9('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xf2f9('0x9'),auth[_0xf2f9('0x7')](),controller[_0xf2f9('0xa')]);router[_0xf2f9('0x6')](_0xf2f9('0xb'),auth[_0xf2f9('0x7')](),controller['getSubjects']);router[_0xf2f9('0x6')](_0xf2f9('0xc'),auth[_0xf2f9('0x7')](),controller[_0xf2f9('0xd')]);router[_0xf2f9('0xe')]('/',auth[_0xf2f9('0x7')](),controller[_0xf2f9('0xf')]);router[_0xf2f9('0x10')](_0xf2f9('0x11'),auth[_0xf2f9('0x7')](),controller[_0xf2f9('0x12')]);router['delete'](_0xf2f9('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xf2f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d34f2af..5f6ee5c 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 _0xe960=['STRING','sequelize','exports'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xe960,0x17b));var _0x0e96=function(_0x3a8113,_0x166d75){_0x3a8113=_0x3a8113-0x0;var _0x2a52b5=_0xe960[_0x3a8113];return _0x2a52b5;};'use strict';var Sequelize=require(_0x0e96('0x0'));module[_0x0e96('0x1')]={'name':{'type':Sequelize[_0x0e96('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e48=['STRING','sequelize','exports'];(function(_0x33fad9,_0x2437ec){var _0x3e9f29=function(_0x774c78){while(--_0x774c78){_0x33fad9['push'](_0x33fad9['shift']());}};_0x3e9f29(++_0x2437ec);}(_0x8e48,0xdc));var _0x88e4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8e48[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x88e4('0x0'));module[_0x88e4('0x1')]={'name':{'type':Sequelize[_0x88e4('0x2')]},'description':{'type':Sequelize[_0x88e4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ae26853..66c2e8f 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 _0xdf7f=['ServicenowConfiguration','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','fields','find','create','body','params','destroy','findOne','ServicenowField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','name','index'];(function(_0x2f2a6f,_0xe63e10){var _0x14441d=function(_0x3ab031){while(--_0x3ab031){_0x2f2a6f['push'](_0x2f2a6f['shift']());}};_0x14441d(++_0xe63e10);}(_0xdf7f,0x1bc));var _0xfdf7=function(_0xc6d019,_0x4efcd3){_0xc6d019=_0xc6d019-0x0;var _0x775ffb=_0xdf7f[_0xc6d019];return _0x775ffb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdf7('0x0'));var zipdir=require(_0xfdf7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdf7('0x2'));var moment=require('moment');var BPromise=require(_0xfdf7('0x3'));var Mustache=require(_0xfdf7('0x4'));var util=require(_0xfdf7('0x5'));var path=require('path');var sox=require(_0xfdf7('0x6'));var csv=require(_0xfdf7('0x7'));var ejs=require(_0xfdf7('0x8'));var fs=require('fs');var fs_extra=require(_0xfdf7('0x9'));var _=require(_0xfdf7('0xa'));var squel=require(_0xfdf7('0xb'));var crypto=require(_0xfdf7('0xc'));var jsforce=require(_0xfdf7('0xd'));var deskjs=require(_0xfdf7('0xe'));var toCsv=require(_0xfdf7('0x7'));var querystring=require(_0xfdf7('0xf'));var Papa=require(_0xfdf7('0x10'));var Redis=require(_0xfdf7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdf7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdf7('0x13'));var logger=require(_0xfdf7('0x14'))(_0xfdf7('0x15'));var utils=require(_0xfdf7('0x16'));var config=require(_0xfdf7('0x17'));var licenseUtil=require(_0xfdf7('0x18'));var db=require(_0xfdf7('0x19'))['db'];function respondWithStatusCode(_0x5e0ab2,_0x21f2f2){_0x21f2f2=_0x21f2f2||0xcc;return function(_0x6921b2){if(_0x6921b2){return _0x5e0ab2[_0xfdf7('0x1a')](_0x21f2f2);}return _0x5e0ab2['status'](_0x21f2f2)[_0xfdf7('0x1b')]();};}function respondWithResult(_0x5b6fe0,_0x5ced3c){_0x5ced3c=_0x5ced3c||0xc8;return function(_0x4cb7d7){if(_0x4cb7d7){return _0x5b6fe0[_0xfdf7('0x1c')](_0x5ced3c)[_0xfdf7('0x1d')](_0x4cb7d7);}};}function respondWithFilteredResult(_0x3d4528,_0x3a138d){return function(_0x25b849){if(_0x25b849){var _0x257c50=typeof _0x3a138d[_0xfdf7('0x1e')]===_0xfdf7('0x1f')&&typeof _0x3a138d[_0xfdf7('0x20')]===_0xfdf7('0x1f');var _0x30f197=_0x25b849['count'];var _0x1211bb=_0x257c50?0x0:_0x3a138d[_0xfdf7('0x1e')];var _0x232cd=_0x257c50?_0x25b849[_0xfdf7('0x21')]:_0x3a138d[_0xfdf7('0x1e')]+_0x3a138d['limit'];var _0x3da4a4;if(_0x232cd>=_0x30f197){_0x232cd=_0x30f197;_0x3da4a4=0xc8;}else{_0x3da4a4=0xce;}_0x3d4528[_0xfdf7('0x1c')](_0x3da4a4);return _0x3d4528['set'](_0xfdf7('0x22'),_0x1211bb+'-'+_0x232cd+'/'+_0x30f197)['json'](_0x25b849);}return null;};}function patchUpdates(_0x318d84){return function(_0x4cf9c0){try{jsonpatch[_0xfdf7('0x23')](_0x4cf9c0,_0x318d84,!![]);}catch(_0x3e9b7e){return BPromise[_0xfdf7('0x24')](_0x3e9b7e);}return _0x4cf9c0[_0xfdf7('0x25')]();};}function saveUpdates(_0x5f1f2b,_0x2465e6){return function(_0x19efe7){if(_0x19efe7){return _0x19efe7[_0xfdf7('0x26')](_0x5f1f2b)[_0xfdf7('0x27')](function(_0x436595){return _0x436595;});}return null;};}function removeEntity(_0x19696a,_0x1a2f0c){return function(_0x1dd0d0){if(_0x1dd0d0){return _0x1dd0d0['destroy']()[_0xfdf7('0x27')](function(){_0x19696a[_0xfdf7('0x1c')](0xcc)[_0xfdf7('0x1b')]();});}};}function handleEntityNotFound(_0x4f9f6b,_0x46c59c){return function(_0x5878a2){if(!_0x5878a2){_0x4f9f6b[_0xfdf7('0x1a')](0x194);}return _0x5878a2;};}function handleError(_0x11ea9b,_0x2d9e86){_0x2d9e86=_0x2d9e86||0x1f4;return function(_0x49e2c7){logger['error'](_0x49e2c7['stack']);if(_0x49e2c7['name']){delete _0x49e2c7[_0xfdf7('0x28')];}_0x11ea9b[_0xfdf7('0x1c')](_0x2d9e86)['send'](_0x49e2c7);};}exports[_0xfdf7('0x29')]=function(_0x4dd773,_0x1e8acb){var _0x4e2a75={},_0x390242={},_0x267c21={'count':0x0,'rows':[]};var _0x57a42f=_['map'](db[_0xfdf7('0x2a')]['rawAttributes'],function(_0x3a5b40){return{'name':_0x3a5b40[_0xfdf7('0x2b')],'type':_0x3a5b40[_0xfdf7('0x2c')][_0xfdf7('0x2d')]};});_0x390242[_0xfdf7('0x2e')]=_[_0xfdf7('0x2f')](_0x57a42f,_0xfdf7('0x28'));_0x390242[_0xfdf7('0x30')]=_[_0xfdf7('0x31')](_0x4dd773['query']);_0x390242[_0xfdf7('0x32')]=_['intersection'](_0x390242[_0xfdf7('0x2e')],_0x390242[_0xfdf7('0x30')]);_0x4e2a75[_0xfdf7('0x33')]=_[_0xfdf7('0x34')](_0x390242['model'],qs['fields'](_0x4dd773[_0xfdf7('0x30')]['fields']));_0x4e2a75[_0xfdf7('0x33')]=_0x4e2a75['attributes'][_0xfdf7('0x35')]?_0x4e2a75[_0xfdf7('0x33')]:_0x390242[_0xfdf7('0x2e')];if(!_0x4dd773[_0xfdf7('0x30')][_0xfdf7('0x36')](_0xfdf7('0x37'))){_0x4e2a75['limit']=qs['limit'](_0x4dd773[_0xfdf7('0x30')][_0xfdf7('0x20')]);_0x4e2a75[_0xfdf7('0x1e')]=qs[_0xfdf7('0x1e')](_0x4dd773['query'][_0xfdf7('0x1e')]);}_0x4e2a75[_0xfdf7('0x38')]=qs['sort'](_0x4dd773[_0xfdf7('0x30')][_0xfdf7('0x39')]);_0x4e2a75[_0xfdf7('0x3a')]=qs['filters'](_[_0xfdf7('0x3b')](_0x4dd773[_0xfdf7('0x30')],_0x390242[_0xfdf7('0x32')]),_0x57a42f);if(_0x4dd773['query'][_0xfdf7('0x3c')]){_0x4e2a75[_0xfdf7('0x3a')]=_[_0xfdf7('0x3d')](_0x4e2a75[_0xfdf7('0x3a')],{'$or':_['map'](_0x57a42f,function(_0x575090){if(_0x575090[_0xfdf7('0x2c')]!==_0xfdf7('0x3e')){var _0x29c093={};_0x29c093[_0x575090[_0xfdf7('0x28')]]={'$like':'%'+_0x4dd773[_0xfdf7('0x30')][_0xfdf7('0x3c')]+'%'};return _0x29c093;}})});}_0x4e2a75=_['merge']({},_0x4e2a75,_0x4dd773[_0xfdf7('0x3f')]);var _0x2b0510={'where':_0x4e2a75[_0xfdf7('0x3a')]};return db['ServicenowConfiguration']['count'](_0x2b0510)[_0xfdf7('0x27')](function(_0x3d3f6d){_0x267c21[_0xfdf7('0x21')]=_0x3d3f6d;if(_0x4dd773[_0xfdf7('0x30')][_0xfdf7('0x40')]){_0x4e2a75[_0xfdf7('0x41')]=[{'all':!![]}];}return db[_0xfdf7('0x2a')]['findAll'](_0x4e2a75);})[_0xfdf7('0x27')](function(_0x32facf){_0x267c21[_0xfdf7('0x42')]=_0x32facf;return _0x267c21;})[_0xfdf7('0x27')](respondWithFilteredResult(_0x1e8acb,_0x4e2a75))[_0xfdf7('0x43')](handleError(_0x1e8acb,null));};exports[_0xfdf7('0x44')]=function(_0x25f5b3,_0x4054a6){var _0x3897f8={'raw':![],'where':{'id':_0x25f5b3['params']['id']}},_0x36e220={};_0x36e220[_0xfdf7('0x2e')]=_[_0xfdf7('0x31')](db[_0xfdf7('0x2a')][_0xfdf7('0x45')]);_0x36e220[_0xfdf7('0x30')]=_[_0xfdf7('0x31')](_0x25f5b3['query']);_0x36e220['filters']=_['intersection'](_0x36e220[_0xfdf7('0x2e')],_0x36e220[_0xfdf7('0x30')]);_0x3897f8[_0xfdf7('0x33')]=_[_0xfdf7('0x34')](_0x36e220['model'],qs['fields'](_0x25f5b3[_0xfdf7('0x30')][_0xfdf7('0x46')]));_0x3897f8[_0xfdf7('0x33')]=_0x3897f8[_0xfdf7('0x33')][_0xfdf7('0x35')]?_0x3897f8[_0xfdf7('0x33')]:_0x36e220[_0xfdf7('0x2e')];if(_0x25f5b3['query'][_0xfdf7('0x40')]){_0x3897f8[_0xfdf7('0x41')]=[{'all':!![]}];}_0x3897f8=_[_0xfdf7('0x3d')]({},_0x3897f8,_0x25f5b3[_0xfdf7('0x3f')]);return db['ServicenowConfiguration'][_0xfdf7('0x47')](_0x3897f8)[_0xfdf7('0x27')](handleEntityNotFound(_0x4054a6,null))[_0xfdf7('0x27')](respondWithResult(_0x4054a6,null))[_0xfdf7('0x43')](handleError(_0x4054a6,null));};exports[_0xfdf7('0x48')]=function(_0x46309a,_0x33d631){return db[_0xfdf7('0x2a')][_0xfdf7('0x48')](_0x46309a[_0xfdf7('0x49')],{})[_0xfdf7('0x27')](respondWithResult(_0x33d631,0xc9))['catch'](handleError(_0x33d631,null));};exports[_0xfdf7('0x26')]=function(_0x49f74b,_0x26b1eb){if(_0x49f74b[_0xfdf7('0x49')]['id']){delete _0x49f74b[_0xfdf7('0x49')]['id'];}return db[_0xfdf7('0x2a')][_0xfdf7('0x47')]({'where':{'id':_0x49f74b[_0xfdf7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x26b1eb,null))[_0xfdf7('0x27')](saveUpdates(_0x49f74b[_0xfdf7('0x49')],null))[_0xfdf7('0x27')](respondWithResult(_0x26b1eb,null))[_0xfdf7('0x43')](handleError(_0x26b1eb,null));};exports[_0xfdf7('0x4b')]=function(_0x4fd645,_0x458f7e){return db[_0xfdf7('0x2a')][_0xfdf7('0x47')]({'where':{'id':_0x4fd645[_0xfdf7('0x4a')]['id']}})[_0xfdf7('0x27')](handleEntityNotFound(_0x458f7e,null))[_0xfdf7('0x27')](removeEntity(_0x458f7e,null))[_0xfdf7('0x43')](handleError(_0x458f7e,null));};exports['getFields']=function(_0x4cce7c,_0x1ba33a,_0x5e8201){var _0x4c7d38={};var _0x5409a8={};var _0x5364f5;var _0x51f73d;return db[_0xfdf7('0x2a')][_0xfdf7('0x4c')]({'where':{'id':_0x4cce7c[_0xfdf7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ba33a,null))[_0xfdf7('0x27')](function(_0x2bf8be){if(_0x2bf8be){_0x5364f5=_0x2bf8be;_0x5409a8[_0xfdf7('0x2e')]=_[_0xfdf7('0x31')](db[_0xfdf7('0x4d')][_0xfdf7('0x45')]);_0x5409a8['query']=_['keys'](_0x4cce7c['query']);_0x5409a8[_0xfdf7('0x32')]=_[_0xfdf7('0x34')](_0x5409a8['model'],_0x5409a8[_0xfdf7('0x30')]);_0x4c7d38[_0xfdf7('0x33')]=_[_0xfdf7('0x34')](_0x5409a8[_0xfdf7('0x2e')],qs[_0xfdf7('0x46')](_0x4cce7c[_0xfdf7('0x30')][_0xfdf7('0x46')]));_0x4c7d38['attributes']=_0x4c7d38[_0xfdf7('0x33')][_0xfdf7('0x35')]?_0x4c7d38[_0xfdf7('0x33')]:_0x5409a8[_0xfdf7('0x2e')];_0x4c7d38[_0xfdf7('0x38')]=qs[_0xfdf7('0x39')](_0x4cce7c[_0xfdf7('0x30')][_0xfdf7('0x39')]);_0x4c7d38[_0xfdf7('0x3a')]=qs[_0xfdf7('0x32')](_[_0xfdf7('0x3b')](_0x4cce7c[_0xfdf7('0x30')],_0x5409a8[_0xfdf7('0x32')]));if(_0x4cce7c[_0xfdf7('0x30')][_0xfdf7('0x3c')]){_0x4c7d38[_0xfdf7('0x3a')]=_[_0xfdf7('0x3d')](_0x4c7d38[_0xfdf7('0x3a')],{'$or':_[_0xfdf7('0x2f')](_0x4c7d38['attributes'],function(_0xa88c51){var _0x121282={};_0x121282[_0xa88c51]={'$like':'%'+_0x4cce7c[_0xfdf7('0x30')][_0xfdf7('0x3c')]+'%'};return _0x121282;})});}_0x4c7d38=_[_0xfdf7('0x3d')]({},_0x4c7d38,_0x4cce7c['options']);return _0x5364f5[_0xfdf7('0x4e')](_0x4c7d38);}})['then'](function(_0x2c6d48){if(_0x2c6d48){_0x51f73d=_0x2c6d48['length'];if(!_0x4cce7c['query'][_0xfdf7('0x36')]('nolimit')){_0x4c7d38['limit']=qs['limit'](_0x4cce7c[_0xfdf7('0x30')]['limit']);_0x4c7d38[_0xfdf7('0x1e')]=qs['offset'](_0x4cce7c[_0xfdf7('0x30')][_0xfdf7('0x1e')]);}return _0x5364f5[_0xfdf7('0x4e')](_0x4c7d38);}})[_0xfdf7('0x27')](function(_0x52c0b4){if(_0x52c0b4){return _0x52c0b4?{'count':_0x51f73d,'rows':_0x52c0b4}:null;}})[_0xfdf7('0x27')](respondWithResult(_0x1ba33a,null))[_0xfdf7('0x43')](handleError(_0x1ba33a,null));};exports[_0xfdf7('0x4f')]=function(_0x3e59d7,_0x455767,_0xbbf1f9){var _0x41e505={};var _0x5c7d6b={};var _0x1dd236;var _0x143448;return db[_0xfdf7('0x2a')][_0xfdf7('0x4c')]({'where':{'id':_0x3e59d7[_0xfdf7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x455767,null))[_0xfdf7('0x27')](function(_0x1213bb){if(_0x1213bb){_0x1dd236=_0x1213bb;_0x5c7d6b[_0xfdf7('0x2e')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5c7d6b['query']=_[_0xfdf7('0x31')](_0x3e59d7[_0xfdf7('0x30')]);_0x5c7d6b[_0xfdf7('0x32')]=_['intersection'](_0x5c7d6b[_0xfdf7('0x2e')],_0x5c7d6b[_0xfdf7('0x30')]);_0x41e505[_0xfdf7('0x33')]=_['intersection'](_0x5c7d6b[_0xfdf7('0x2e')],qs[_0xfdf7('0x46')](_0x3e59d7[_0xfdf7('0x30')][_0xfdf7('0x46')]));_0x41e505[_0xfdf7('0x33')]=_0x41e505[_0xfdf7('0x33')][_0xfdf7('0x35')]?_0x41e505[_0xfdf7('0x33')]:_0x5c7d6b[_0xfdf7('0x2e')];_0x41e505[_0xfdf7('0x38')]=qs[_0xfdf7('0x39')](_0x3e59d7[_0xfdf7('0x30')]['sort']);_0x41e505[_0xfdf7('0x3a')]=qs[_0xfdf7('0x32')](_[_0xfdf7('0x3b')](_0x3e59d7[_0xfdf7('0x30')],_0x5c7d6b[_0xfdf7('0x32')]));if(_0x3e59d7[_0xfdf7('0x30')]['filter']){_0x41e505[_0xfdf7('0x3a')]=_[_0xfdf7('0x3d')](_0x41e505[_0xfdf7('0x3a')],{'$or':_[_0xfdf7('0x2f')](_0x41e505[_0xfdf7('0x33')],function(_0x3d2beb){var _0x8542fb={};_0x8542fb[_0x3d2beb]={'$like':'%'+_0x3e59d7[_0xfdf7('0x30')][_0xfdf7('0x3c')]+'%'};return _0x8542fb;})});}_0x41e505=_[_0xfdf7('0x3d')]({},_0x41e505,_0x3e59d7[_0xfdf7('0x3f')]);return _0x1dd236[_0xfdf7('0x4f')](_0x41e505);}})['then'](function(_0xcd3277){if(_0xcd3277){_0x143448=_0xcd3277['length'];if(!_0x3e59d7['query'][_0xfdf7('0x36')](_0xfdf7('0x37'))){_0x41e505[_0xfdf7('0x20')]=qs[_0xfdf7('0x20')](_0x3e59d7['query'][_0xfdf7('0x20')]);_0x41e505[_0xfdf7('0x1e')]=qs['offset'](_0x3e59d7[_0xfdf7('0x30')]['offset']);}return _0x1dd236[_0xfdf7('0x4f')](_0x41e505);}})[_0xfdf7('0x27')](function(_0x3e0ba5){if(_0x3e0ba5){return _0x3e0ba5?{'count':_0x143448,'rows':_0x3e0ba5}:null;}})[_0xfdf7('0x27')](respondWithResult(_0x455767,null))[_0xfdf7('0x43')](handleError(_0x455767,null));};exports[_0xfdf7('0x50')]=function(_0x5ac77b,_0x1b858f,_0x3ed44e){var _0x484e51={};var _0x250ad8={};var _0x419dd8;var _0x1a7fbd;return db[_0xfdf7('0x2a')][_0xfdf7('0x4c')]({'where':{'id':_0x5ac77b['params']['id']}})[_0xfdf7('0x27')](handleEntityNotFound(_0x1b858f,null))['then'](function(_0x3636a4){if(_0x3636a4){_0x419dd8=_0x3636a4;_0x250ad8[_0xfdf7('0x2e')]=_[_0xfdf7('0x31')](db['ServicenowField'][_0xfdf7('0x45')]);_0x250ad8[_0xfdf7('0x30')]=_[_0xfdf7('0x31')](_0x5ac77b[_0xfdf7('0x30')]);_0x250ad8[_0xfdf7('0x32')]=_[_0xfdf7('0x34')](_0x250ad8[_0xfdf7('0x2e')],_0x250ad8[_0xfdf7('0x30')]);_0x484e51[_0xfdf7('0x33')]=_[_0xfdf7('0x34')](_0x250ad8[_0xfdf7('0x2e')],qs[_0xfdf7('0x46')](_0x5ac77b[_0xfdf7('0x30')][_0xfdf7('0x46')]));_0x484e51[_0xfdf7('0x33')]=_0x484e51['attributes'][_0xfdf7('0x35')]?_0x484e51[_0xfdf7('0x33')]:_0x250ad8['model'];_0x484e51[_0xfdf7('0x38')]=qs['sort'](_0x5ac77b[_0xfdf7('0x30')][_0xfdf7('0x39')]);_0x484e51['where']=qs['filters'](_[_0xfdf7('0x3b')](_0x5ac77b['query'],_0x250ad8[_0xfdf7('0x32')]));if(_0x5ac77b[_0xfdf7('0x30')][_0xfdf7('0x3c')]){_0x484e51['where']=_[_0xfdf7('0x3d')](_0x484e51['where'],{'$or':_['map'](_0x484e51[_0xfdf7('0x33')],function(_0xea3a49){var _0x4261c7={};_0x4261c7[_0xea3a49]={'$like':'%'+_0x5ac77b['query'][_0xfdf7('0x3c')]+'%'};return _0x4261c7;})});}_0x484e51=_[_0xfdf7('0x3d')]({},_0x484e51,_0x5ac77b[_0xfdf7('0x3f')]);return _0x419dd8[_0xfdf7('0x50')](_0x484e51);}})[_0xfdf7('0x27')](function(_0x7c2452){if(_0x7c2452){_0x1a7fbd=_0x7c2452['length'];if(!_0x5ac77b[_0xfdf7('0x30')][_0xfdf7('0x36')](_0xfdf7('0x37'))){_0x484e51[_0xfdf7('0x20')]=qs['limit'](_0x5ac77b['query'][_0xfdf7('0x20')]);_0x484e51[_0xfdf7('0x1e')]=qs['offset'](_0x5ac77b['query'][_0xfdf7('0x1e')]);}return _0x419dd8['getDescriptions'](_0x484e51);}})['then'](function(_0x421730){if(_0x421730){return _0x421730?{'count':_0x1a7fbd,'rows':_0x421730}:null;}})[_0xfdf7('0x27')](respondWithResult(_0x1b858f,null))[_0xfdf7('0x43')](handleError(_0x1b858f,null));}; \ No newline at end of file +var _0xa256=['params','rawAttributes','includeAll','include','options','find','create','body','getFields','ServicenowField','order','filter','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','ServicenowConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','findAll','rows','catch','show'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0xa256,0x1ef));var _0x6a25=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa256[_0x5b561d];return _0x431060;};'use strict';var emlformat=require(_0x6a25('0x0'));var rimraf=require(_0x6a25('0x1'));var zipdir=require(_0x6a25('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6a25('0x3'));var BPromise=require(_0x6a25('0x4'));var Mustache=require('mustache');var util=require(_0x6a25('0x5'));var path=require(_0x6a25('0x6'));var sox=require(_0x6a25('0x7'));var csv=require(_0x6a25('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a25('0x9'));var _=require(_0x6a25('0xa'));var squel=require('squel');var crypto=require(_0x6a25('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6a25('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6a25('0xd'));var Papa=require('papaparse');var Redis=require(_0x6a25('0xe'));var authService=require(_0x6a25('0xf'));var qs=require(_0x6a25('0x10'));var as=require(_0x6a25('0x11'));var hardwareService=require(_0x6a25('0x12'));var logger=require('../../config/logger')(_0x6a25('0x13'));var utils=require(_0x6a25('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a25('0x15'))['db'];function respondWithStatusCode(_0x435fb8,_0x372136){_0x372136=_0x372136||0xcc;return function(_0x3f7eda){if(_0x3f7eda){return _0x435fb8[_0x6a25('0x16')](_0x372136);}return _0x435fb8['status'](_0x372136)['end']();};}function respondWithResult(_0x1b88e5,_0x238aae){_0x238aae=_0x238aae||0xc8;return function(_0x18b39f){if(_0x18b39f){return _0x1b88e5[_0x6a25('0x17')](_0x238aae)[_0x6a25('0x18')](_0x18b39f);}};}function respondWithFilteredResult(_0x3566d2,_0x149414){return function(_0x16a839){if(_0x16a839){var _0x3ec427=typeof _0x149414[_0x6a25('0x19')]==='undefined'&&typeof _0x149414['limit']===_0x6a25('0x1a');var _0x1d2974=_0x16a839['count'];var _0x39ff5f=_0x3ec427?0x0:_0x149414[_0x6a25('0x19')];var _0x57c445=_0x3ec427?_0x16a839[_0x6a25('0x1b')]:_0x149414[_0x6a25('0x19')]+_0x149414[_0x6a25('0x1c')];var _0x3fae1b;if(_0x57c445>=_0x1d2974){_0x57c445=_0x1d2974;_0x3fae1b=0xc8;}else{_0x3fae1b=0xce;}_0x3566d2['status'](_0x3fae1b);return _0x3566d2[_0x6a25('0x1d')](_0x6a25('0x1e'),_0x39ff5f+'-'+_0x57c445+'/'+_0x1d2974)[_0x6a25('0x18')](_0x16a839);}return null;};}function patchUpdates(_0x2e7773){return function(_0x2ff57a){try{jsonpatch[_0x6a25('0x1f')](_0x2ff57a,_0x2e7773,!![]);}catch(_0x33ad30){return BPromise[_0x6a25('0x20')](_0x33ad30);}return _0x2ff57a[_0x6a25('0x21')]();};}function saveUpdates(_0x5da878,_0x51ca35){return function(_0x22235a){if(_0x22235a){return _0x22235a['update'](_0x5da878)[_0x6a25('0x22')](function(_0x3c486d){return _0x3c486d;});}return null;};}function removeEntity(_0x707c3f,_0x3c99bc){return function(_0x5c071a){if(_0x5c071a){return _0x5c071a[_0x6a25('0x23')]()['then'](function(){_0x707c3f['status'](0xcc)[_0x6a25('0x24')]();});}};}function handleEntityNotFound(_0x81c68b,_0x52e8a1){return function(_0x45ccab){if(!_0x45ccab){_0x81c68b[_0x6a25('0x16')](0x194);}return _0x45ccab;};}function handleError(_0x26ba8d,_0x449643){_0x449643=_0x449643||0x1f4;return function(_0xbf4b09){logger[_0x6a25('0x25')](_0xbf4b09[_0x6a25('0x26')]);if(_0xbf4b09[_0x6a25('0x27')]){delete _0xbf4b09['name'];}_0x26ba8d[_0x6a25('0x17')](_0x449643)[_0x6a25('0x28')](_0xbf4b09);};}exports[_0x6a25('0x29')]=function(_0x3e6e47,_0x3733db){var _0x1e7e10={},_0x21ba5a={},_0x1f995d={'count':0x0,'rows':[]};var _0x560803=_[_0x6a25('0x2a')](db[_0x6a25('0x2b')]['rawAttributes'],function(_0x3bcbd4){return{'name':_0x3bcbd4['fieldName'],'type':_0x3bcbd4[_0x6a25('0x2c')][_0x6a25('0x2d')]};});_0x21ba5a[_0x6a25('0x2e')]=_[_0x6a25('0x2a')](_0x560803,_0x6a25('0x27'));_0x21ba5a[_0x6a25('0x2f')]=_[_0x6a25('0x30')](_0x3e6e47['query']);_0x21ba5a[_0x6a25('0x31')]=_[_0x6a25('0x32')](_0x21ba5a[_0x6a25('0x2e')],_0x21ba5a['query']);_0x1e7e10['attributes']=_[_0x6a25('0x32')](_0x21ba5a['model'],qs[_0x6a25('0x33')](_0x3e6e47[_0x6a25('0x2f')][_0x6a25('0x33')]));_0x1e7e10[_0x6a25('0x34')]=_0x1e7e10[_0x6a25('0x34')][_0x6a25('0x35')]?_0x1e7e10[_0x6a25('0x34')]:_0x21ba5a[_0x6a25('0x2e')];if(!_0x3e6e47[_0x6a25('0x2f')][_0x6a25('0x36')](_0x6a25('0x37'))){_0x1e7e10['limit']=qs[_0x6a25('0x1c')](_0x3e6e47[_0x6a25('0x2f')]['limit']);_0x1e7e10[_0x6a25('0x19')]=qs[_0x6a25('0x19')](_0x3e6e47[_0x6a25('0x2f')][_0x6a25('0x19')]);}_0x1e7e10['order']=qs[_0x6a25('0x38')](_0x3e6e47[_0x6a25('0x2f')][_0x6a25('0x38')]);_0x1e7e10[_0x6a25('0x39')]=qs[_0x6a25('0x31')](_[_0x6a25('0x3a')](_0x3e6e47[_0x6a25('0x2f')],_0x21ba5a[_0x6a25('0x31')]),_0x560803);if(_0x3e6e47[_0x6a25('0x2f')]['filter']){_0x1e7e10[_0x6a25('0x39')]=_[_0x6a25('0x3b')](_0x1e7e10[_0x6a25('0x39')],{'$or':_['map'](_0x560803,function(_0x1dd947){if(_0x1dd947[_0x6a25('0x2c')]!==_0x6a25('0x3c')){var _0x5c0317={};_0x5c0317[_0x1dd947[_0x6a25('0x27')]]={'$like':'%'+_0x3e6e47[_0x6a25('0x2f')]['filter']+'%'};return _0x5c0317;}})});}_0x1e7e10=_[_0x6a25('0x3b')]({},_0x1e7e10,_0x3e6e47['options']);var _0x1c9026={'where':_0x1e7e10[_0x6a25('0x39')]};return db['ServicenowConfiguration'][_0x6a25('0x1b')](_0x1c9026)[_0x6a25('0x22')](function(_0x33afd7){_0x1f995d[_0x6a25('0x1b')]=_0x33afd7;if(_0x3e6e47[_0x6a25('0x2f')]['includeAll']){_0x1e7e10['include']=[{'all':!![]}];}return db[_0x6a25('0x2b')][_0x6a25('0x3d')](_0x1e7e10);})['then'](function(_0x45e5d1){_0x1f995d[_0x6a25('0x3e')]=_0x45e5d1;return _0x1f995d;})['then'](respondWithFilteredResult(_0x3733db,_0x1e7e10))[_0x6a25('0x3f')](handleError(_0x3733db,null));};exports[_0x6a25('0x40')]=function(_0x314c15,_0x5dcec4){var _0x29b150={'raw':![],'where':{'id':_0x314c15[_0x6a25('0x41')]['id']}},_0x292a35={};_0x292a35['model']=_['keys'](db[_0x6a25('0x2b')][_0x6a25('0x42')]);_0x292a35[_0x6a25('0x2f')]=_[_0x6a25('0x30')](_0x314c15['query']);_0x292a35[_0x6a25('0x31')]=_[_0x6a25('0x32')](_0x292a35[_0x6a25('0x2e')],_0x292a35['query']);_0x29b150['attributes']=_[_0x6a25('0x32')](_0x292a35['model'],qs[_0x6a25('0x33')](_0x314c15[_0x6a25('0x2f')][_0x6a25('0x33')]));_0x29b150[_0x6a25('0x34')]=_0x29b150[_0x6a25('0x34')][_0x6a25('0x35')]?_0x29b150['attributes']:_0x292a35[_0x6a25('0x2e')];if(_0x314c15[_0x6a25('0x2f')][_0x6a25('0x43')]){_0x29b150[_0x6a25('0x44')]=[{'all':!![]}];}_0x29b150=_['merge']({},_0x29b150,_0x314c15[_0x6a25('0x45')]);return db[_0x6a25('0x2b')][_0x6a25('0x46')](_0x29b150)[_0x6a25('0x22')](handleEntityNotFound(_0x5dcec4,null))[_0x6a25('0x22')](respondWithResult(_0x5dcec4,null))[_0x6a25('0x3f')](handleError(_0x5dcec4,null));};exports['create']=function(_0x4f8094,_0x54ac5d){return db['ServicenowConfiguration'][_0x6a25('0x47')](_0x4f8094[_0x6a25('0x48')],{})['then'](respondWithResult(_0x54ac5d,0xc9))['catch'](handleError(_0x54ac5d,null));};exports['update']=function(_0x36ec2b,_0x3618c1){if(_0x36ec2b['body']['id']){delete _0x36ec2b[_0x6a25('0x48')]['id'];}return db[_0x6a25('0x2b')][_0x6a25('0x46')]({'where':{'id':_0x36ec2b[_0x6a25('0x41')]['id']}})[_0x6a25('0x22')](handleEntityNotFound(_0x3618c1,null))[_0x6a25('0x22')](saveUpdates(_0x36ec2b[_0x6a25('0x48')],null))['then'](respondWithResult(_0x3618c1,null))['catch'](handleError(_0x3618c1,null));};exports[_0x6a25('0x23')]=function(_0x5cfeaf,_0x49bb38){return db[_0x6a25('0x2b')][_0x6a25('0x46')]({'where':{'id':_0x5cfeaf[_0x6a25('0x41')]['id']}})[_0x6a25('0x22')](handleEntityNotFound(_0x49bb38,null))[_0x6a25('0x22')](removeEntity(_0x49bb38,null))[_0x6a25('0x3f')](handleError(_0x49bb38,null));};exports[_0x6a25('0x49')]=function(_0x40c8b1,_0x380cf0,_0x51ff42){var _0xefe564={};var _0x3f7fbd={};var _0x577f2c;var _0x20693d;return db[_0x6a25('0x2b')]['findOne']({'where':{'id':_0x40c8b1[_0x6a25('0x41')]['id']}})[_0x6a25('0x22')](handleEntityNotFound(_0x380cf0,null))[_0x6a25('0x22')](function(_0x4e225c){if(_0x4e225c){_0x577f2c=_0x4e225c;_0x3f7fbd[_0x6a25('0x2e')]=_[_0x6a25('0x30')](db[_0x6a25('0x4a')][_0x6a25('0x42')]);_0x3f7fbd[_0x6a25('0x2f')]=_[_0x6a25('0x30')](_0x40c8b1[_0x6a25('0x2f')]);_0x3f7fbd[_0x6a25('0x31')]=_['intersection'](_0x3f7fbd[_0x6a25('0x2e')],_0x3f7fbd[_0x6a25('0x2f')]);_0xefe564[_0x6a25('0x34')]=_[_0x6a25('0x32')](_0x3f7fbd[_0x6a25('0x2e')],qs[_0x6a25('0x33')](_0x40c8b1[_0x6a25('0x2f')][_0x6a25('0x33')]));_0xefe564[_0x6a25('0x34')]=_0xefe564[_0x6a25('0x34')][_0x6a25('0x35')]?_0xefe564[_0x6a25('0x34')]:_0x3f7fbd[_0x6a25('0x2e')];_0xefe564[_0x6a25('0x4b')]=qs[_0x6a25('0x38')](_0x40c8b1[_0x6a25('0x2f')][_0x6a25('0x38')]);_0xefe564[_0x6a25('0x39')]=qs[_0x6a25('0x31')](_[_0x6a25('0x3a')](_0x40c8b1['query'],_0x3f7fbd[_0x6a25('0x31')]));if(_0x40c8b1['query'][_0x6a25('0x4c')]){_0xefe564[_0x6a25('0x39')]=_['merge'](_0xefe564[_0x6a25('0x39')],{'$or':_[_0x6a25('0x2a')](_0xefe564[_0x6a25('0x34')],function(_0x487fd8){var _0x15d406={};_0x15d406[_0x487fd8]={'$like':'%'+_0x40c8b1[_0x6a25('0x2f')][_0x6a25('0x4c')]+'%'};return _0x15d406;})});}_0xefe564=_['merge']({},_0xefe564,_0x40c8b1[_0x6a25('0x45')]);return _0x577f2c[_0x6a25('0x49')](_0xefe564);}})[_0x6a25('0x22')](function(_0x36f977){if(_0x36f977){_0x20693d=_0x36f977['length'];if(!_0x40c8b1[_0x6a25('0x2f')]['hasOwnProperty']('nolimit')){_0xefe564['limit']=qs[_0x6a25('0x1c')](_0x40c8b1[_0x6a25('0x2f')][_0x6a25('0x1c')]);_0xefe564[_0x6a25('0x19')]=qs[_0x6a25('0x19')](_0x40c8b1[_0x6a25('0x2f')][_0x6a25('0x19')]);}return _0x577f2c[_0x6a25('0x49')](_0xefe564);}})[_0x6a25('0x22')](function(_0x470dc8){if(_0x470dc8){return _0x470dc8?{'count':_0x20693d,'rows':_0x470dc8}:null;}})[_0x6a25('0x22')](respondWithResult(_0x380cf0,null))[_0x6a25('0x3f')](handleError(_0x380cf0,null));};exports[_0x6a25('0x4d')]=function(_0x34a4bf,_0x53fb62,_0x585ede){var _0x2404f9={};var _0x1f6f14={};var _0x319085;var _0xaf5ad5;return db[_0x6a25('0x2b')][_0x6a25('0x4e')]({'where':{'id':_0x34a4bf['params']['id']}})['then'](handleEntityNotFound(_0x53fb62,null))[_0x6a25('0x22')](function(_0x203b55){if(_0x203b55){_0x319085=_0x203b55;_0x1f6f14[_0x6a25('0x2e')]=_[_0x6a25('0x30')](db[_0x6a25('0x4a')]['rawAttributes']);_0x1f6f14[_0x6a25('0x2f')]=_[_0x6a25('0x30')](_0x34a4bf['query']);_0x1f6f14['filters']=_[_0x6a25('0x32')](_0x1f6f14[_0x6a25('0x2e')],_0x1f6f14[_0x6a25('0x2f')]);_0x2404f9[_0x6a25('0x34')]=_[_0x6a25('0x32')](_0x1f6f14[_0x6a25('0x2e')],qs[_0x6a25('0x33')](_0x34a4bf[_0x6a25('0x2f')]['fields']));_0x2404f9[_0x6a25('0x34')]=_0x2404f9[_0x6a25('0x34')][_0x6a25('0x35')]?_0x2404f9[_0x6a25('0x34')]:_0x1f6f14[_0x6a25('0x2e')];_0x2404f9[_0x6a25('0x4b')]=qs[_0x6a25('0x38')](_0x34a4bf[_0x6a25('0x2f')]['sort']);_0x2404f9['where']=qs[_0x6a25('0x31')](_['pick'](_0x34a4bf[_0x6a25('0x2f')],_0x1f6f14[_0x6a25('0x31')]));if(_0x34a4bf[_0x6a25('0x2f')][_0x6a25('0x4c')]){_0x2404f9[_0x6a25('0x39')]=_[_0x6a25('0x3b')](_0x2404f9['where'],{'$or':_[_0x6a25('0x2a')](_0x2404f9[_0x6a25('0x34')],function(_0x30febd){var _0x59d566={};_0x59d566[_0x30febd]={'$like':'%'+_0x34a4bf[_0x6a25('0x2f')][_0x6a25('0x4c')]+'%'};return _0x59d566;})});}_0x2404f9=_['merge']({},_0x2404f9,_0x34a4bf[_0x6a25('0x45')]);return _0x319085[_0x6a25('0x4d')](_0x2404f9);}})[_0x6a25('0x22')](function(_0x43746b){if(_0x43746b){_0xaf5ad5=_0x43746b['length'];if(!_0x34a4bf[_0x6a25('0x2f')][_0x6a25('0x36')]('nolimit')){_0x2404f9[_0x6a25('0x1c')]=qs[_0x6a25('0x1c')](_0x34a4bf[_0x6a25('0x2f')]['limit']);_0x2404f9['offset']=qs[_0x6a25('0x19')](_0x34a4bf[_0x6a25('0x2f')][_0x6a25('0x19')]);}return _0x319085[_0x6a25('0x4d')](_0x2404f9);}})['then'](function(_0x24f1e7){if(_0x24f1e7){return _0x24f1e7?{'count':_0xaf5ad5,'rows':_0x24f1e7}:null;}})['then'](respondWithResult(_0x53fb62,null))[_0x6a25('0x3f')](handleError(_0x53fb62,null));};exports[_0x6a25('0x4f')]=function(_0x1f8219,_0x4b803e,_0x5f1225){var _0x3f553d={};var _0x318543={};var _0x23a8be;var _0x17c79c;return db[_0x6a25('0x2b')]['findOne']({'where':{'id':_0x1f8219['params']['id']}})[_0x6a25('0x22')](handleEntityNotFound(_0x4b803e,null))[_0x6a25('0x22')](function(_0x29f793){if(_0x29f793){_0x23a8be=_0x29f793;_0x318543[_0x6a25('0x2e')]=_['keys'](db[_0x6a25('0x4a')][_0x6a25('0x42')]);_0x318543[_0x6a25('0x2f')]=_[_0x6a25('0x30')](_0x1f8219[_0x6a25('0x2f')]);_0x318543[_0x6a25('0x31')]=_[_0x6a25('0x32')](_0x318543[_0x6a25('0x2e')],_0x318543['query']);_0x3f553d[_0x6a25('0x34')]=_[_0x6a25('0x32')](_0x318543[_0x6a25('0x2e')],qs[_0x6a25('0x33')](_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x33')]));_0x3f553d[_0x6a25('0x34')]=_0x3f553d['attributes']['length']?_0x3f553d[_0x6a25('0x34')]:_0x318543[_0x6a25('0x2e')];_0x3f553d[_0x6a25('0x4b')]=qs[_0x6a25('0x38')](_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x38')]);_0x3f553d[_0x6a25('0x39')]=qs['filters'](_[_0x6a25('0x3a')](_0x1f8219[_0x6a25('0x2f')],_0x318543[_0x6a25('0x31')]));if(_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x4c')]){_0x3f553d[_0x6a25('0x39')]=_[_0x6a25('0x3b')](_0x3f553d[_0x6a25('0x39')],{'$or':_[_0x6a25('0x2a')](_0x3f553d[_0x6a25('0x34')],function(_0x26f33a){var _0x3974f9={};_0x3974f9[_0x26f33a]={'$like':'%'+_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x4c')]+'%'};return _0x3974f9;})});}_0x3f553d=_[_0x6a25('0x3b')]({},_0x3f553d,_0x1f8219[_0x6a25('0x45')]);return _0x23a8be[_0x6a25('0x4f')](_0x3f553d);}})['then'](function(_0x3dfbec){if(_0x3dfbec){_0x17c79c=_0x3dfbec[_0x6a25('0x35')];if(!_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x36')](_0x6a25('0x37'))){_0x3f553d[_0x6a25('0x1c')]=qs[_0x6a25('0x1c')](_0x1f8219['query'][_0x6a25('0x1c')]);_0x3f553d[_0x6a25('0x19')]=qs[_0x6a25('0x19')](_0x1f8219[_0x6a25('0x2f')][_0x6a25('0x19')]);}return _0x23a8be[_0x6a25('0x4f')](_0x3f553d);}})[_0x6a25('0x22')](function(_0x29f6f2){if(_0x29f6f2){return _0x29f6f2?{'count':_0x17c79c,'rows':_0x29f6f2}:null;}})['then'](respondWithResult(_0x4b803e,null))[_0x6a25('0x3f')](handleError(_0x4b803e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e5e839b..51ac311 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 _0x082b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','int_servicenow_configurations','lodash','util','../../config/logger'];(function(_0x46e2ea,_0x513d20){var _0x25aeb4=function(_0x265413){while(--_0x265413){_0x46e2ea['push'](_0x46e2ea['shift']());}};_0x25aeb4(++_0x513d20);}(_0x082b,0x1ec));var _0xb082=function(_0x5c1a46,_0x321067){_0x5c1a46=_0x5c1a46-0x0;var _0x10572f=_0x082b[_0x5c1a46];return _0x10572f;};'use strict';var _=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var logger=require(_0xb082('0x2'))(_0xb082('0x3'));var moment=require('moment');var BPromise=require(_0xb082('0x4'));var rp=require(_0xb082('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb082('0x6'));var config=require(_0xb082('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0xb082('0x8')]=function(_0x37b715,_0x16e0b8){return _0x37b715[_0xb082('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0xb082('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7382=['define','int_servicenow_configurations','util','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0xf167c9,_0x492c62){var _0x3c7a2e=function(_0x2cb7e0){while(--_0x2cb7e0){_0xf167c9['push'](_0xf167c9['shift']());}};_0x3c7a2e(++_0x492c62);}(_0x7382,0x1f2));var _0x2738=function(_0x5be73b,_0x2a05a){_0x5be73b=_0x5be73b-0x0;var _0x16d1f6=_0x7382[_0x5be73b];return _0x16d1f6;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2738('0x1'));var BPromise=require('bluebird');var rp=require(_0x2738('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2738('0x3'));var config=require(_0x2738('0x4'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x2738('0x5')]=function(_0x267a1a,_0x457c61){return _0x267a1a[_0x2738('0x6')]('ServicenowConfiguration',attributes,{'tableName':_0x2738('0x7'),'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 eeae9c7..c6118ba 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 _0x9a2d=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x1113d8,_0x3f2fdc){var _0x5ddf17=function(_0x26cb9d){while(--_0x26cb9d){_0x1113d8['push'](_0x1113d8['shift']());}};_0x5ddf17(++_0x3f2fdc);}(_0x9a2d,0x6d));var _0xd9a2=function(_0x2aaf99,_0x4e338e){_0x2aaf99=_0x2aaf99-0x0;var _0x45f362=_0x9a2d[_0x2aaf99];return _0x45f362;};'use strict';var _=require(_0xd9a2('0x0'));var util=require(_0xd9a2('0x1'));var moment=require('moment');var BPromise=require(_0xd9a2('0x2'));var rs=require(_0xd9a2('0x3'));var fs=require('fs');var Redis=require(_0xd9a2('0x4'));var db=require(_0xd9a2('0x5'))['db'];var utils=require(_0xd9a2('0x6'));var logger=require(_0xd9a2('0x7'))('rpc');var config=require(_0xd9a2('0x8'));var jayson=require(_0xd9a2('0x9'));var client=jayson['client'][_0xd9a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40441a,_0xc305b0,_0x567226){return new BPromise(function(_0x1ec241,_0x2d8116){return client[_0xd9a2('0xb')](_0x40441a,_0x567226)[_0xd9a2('0xc')](function(_0x57cf31){logger['info'](_0xd9a2('0xd'),_0xc305b0,_0xd9a2('0xe'));logger['debug'](_0xd9a2('0xf'),_0xc305b0,_0xd9a2('0xe'),JSON[_0xd9a2('0x10')](_0x57cf31));if(_0x57cf31['error']){if(_0x57cf31[_0xd9a2('0x11')]['code']===0x1f4){logger[_0xd9a2('0x11')](_0xd9a2('0xd'),_0xc305b0,_0x57cf31[_0xd9a2('0x11')][_0xd9a2('0x12')]);return _0x2d8116(_0x57cf31[_0xd9a2('0x11')]['message']);}logger[_0xd9a2('0x11')](_0xd9a2('0xd'),_0xc305b0,_0x57cf31[_0xd9a2('0x11')][_0xd9a2('0x12')]);return _0x1ec241(_0x57cf31[_0xd9a2('0x11')][_0xd9a2('0x12')]);}else{logger[_0xd9a2('0x13')](_0xd9a2('0xd'),_0xc305b0,_0xd9a2('0xe'));_0x1ec241(_0x57cf31[_0xd9a2('0x14')][_0xd9a2('0x12')]);}})[_0xd9a2('0x15')](function(_0x284ab6){logger[_0xd9a2('0x11')](_0xd9a2('0xd'),_0xc305b0,_0x284ab6);_0x2d8116(_0x284ab6);});});} \ No newline at end of file +var _0x1486=['../../config/utils','../../config/logger','rpc','jayson/promise','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x58facd,_0x11b5d6){var _0x361786=function(_0x3d31be){while(--_0x3d31be){_0x58facd['push'](_0x58facd['shift']());}};_0x361786(++_0x11b5d6);}(_0x1486,0x1b4));var _0x6148=function(_0x4ae257,_0xfffc24){_0x4ae257=_0x4ae257-0x0;var _0x43f778=_0x1486[_0x4ae257];return _0x43f778;};'use strict';var _=require(_0x6148('0x0'));var util=require(_0x6148('0x1'));var moment=require(_0x6148('0x2'));var BPromise=require(_0x6148('0x3'));var rs=require(_0x6148('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6148('0x5'));var logger=require(_0x6148('0x6'))(_0x6148('0x7'));var config=require('../../config/environment');var jayson=require(_0x6148('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x481fb6,_0x41ac0b,_0x522271){return new BPromise(function(_0x11e99b,_0x21a336){return client['request'](_0x481fb6,_0x522271)[_0x6148('0x9')](function(_0x24bed3){logger[_0x6148('0xa')](_0x6148('0xb'),_0x41ac0b,_0x6148('0xc'));logger[_0x6148('0xd')](_0x6148('0xe'),_0x41ac0b,_0x6148('0xc'),JSON[_0x6148('0xf')](_0x24bed3));if(_0x24bed3[_0x6148('0x10')]){if(_0x24bed3['error'][_0x6148('0x11')]===0x1f4){logger[_0x6148('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x41ac0b,_0x24bed3['error'][_0x6148('0x12')]);return _0x21a336(_0x24bed3[_0x6148('0x10')][_0x6148('0x12')]);}logger[_0x6148('0x10')](_0x6148('0xb'),_0x41ac0b,_0x24bed3[_0x6148('0x10')]['message']);return _0x11e99b(_0x24bed3[_0x6148('0x10')][_0x6148('0x12')]);}else{logger[_0x6148('0xa')](_0x6148('0xb'),_0x41ac0b,_0x6148('0xc'));_0x11e99b(_0x24bed3[_0x6148('0x13')][_0x6148('0x12')]);}})[_0x6148('0x14')](function(_0x5838ed){logger['error'](_0x6148('0xb'),_0x41ac0b,_0x5838ed);_0x21a336(_0x5838ed);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 3e77b57..ed1e966 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 _0x817a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','/:id','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x216e72,_0x5cd161){var _0x2ff28d=function(_0x29a533){while(--_0x29a533){_0x216e72['push'](_0x216e72['shift']());}};_0x2ff28d(++_0x5cd161);}(_0x817a,0x11a));var _0xa817=function(_0x4d0de9,_0x50d3cf){_0x4d0de9=_0x4d0de9-0x0;var _0x22e1f8=_0x817a[_0x4d0de9];return _0x22e1f8;};'use strict';var multer=require(_0xa817('0x0'));var util=require(_0xa817('0x1'));var path=require('path');var timeout=require(_0xa817('0x2'));var express=require('express');var router=express[_0xa817('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa817('0x4'));var interaction=require(_0xa817('0x5'));var config=require(_0xa817('0x6'));var controller=require(_0xa817('0x7'));router['get']('/',auth[_0xa817('0x8')](),controller['index']);router['get'](_0xa817('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa817('0x8')](),controller[_0xa817('0xa')]);router[_0xa817('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa817('0xc')]);router[_0xa817('0xd')](_0xa817('0x9'),auth[_0xa817('0x8')](),controller[_0xa817('0xe')]);module['exports']=router; \ No newline at end of file +var _0x565a=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path'];(function(_0x315293,_0x305859){var _0x2dbda6=function(_0xd87786){while(--_0xd87786){_0x315293['push'](_0x315293['shift']());}};_0x2dbda6(++_0x305859);}(_0x565a,0x154));var _0xa565=function(_0x155571,_0x140f7f){_0x155571=_0x155571-0x0;var _0x1960da=_0x565a[_0x155571];return _0x1960da;};'use strict';var multer=require('multer');var util=require(_0xa565('0x0'));var path=require(_0xa565('0x1'));var timeout=require(_0xa565('0x2'));var express=require('express');var router=express[_0xa565('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa565('0x4'));var interaction=require(_0xa565('0x5'));var config=require(_0xa565('0x6'));var controller=require(_0xa565('0x7'));router[_0xa565('0x8')]('/',auth[_0xa565('0x9')](),controller[_0xa565('0xa')]);router[_0xa565('0x8')](_0xa565('0xb'),auth[_0xa565('0x9')](),controller[_0xa565('0xc')]);router[_0xa565('0xd')]('/',auth[_0xa565('0x9')](),controller[_0xa565('0xe')]);router[_0xa565('0xf')](_0xa565('0xb'),auth[_0xa565('0x9')](),controller[_0xa565('0x10')]);router[_0xa565('0x11')](_0xa565('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b225c41..fb3303a 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 _0x25c6=['ENUM','BOOLEAN','sequelize','exports','string','customVariable','STRING'];(function(_0x3f5e05,_0x249692){var _0x2790e5=function(_0x2c6c3d){while(--_0x2c6c3d){_0x3f5e05['push'](_0x3f5e05['shift']());}};_0x2790e5(++_0x249692);}(_0x25c6,0xb1));var _0x625c=function(_0x9aca10,_0x5463b5){_0x9aca10=_0x9aca10-0x0;var _0x499dcf=_0x25c6[_0x9aca10];return _0x499dcf;};'use strict';var Sequelize=require(_0x625c('0x0'));module[_0x625c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x625c('0x2'),'variable',_0x625c('0x3'),'keyValue','picklist'),'defaultValue':_0x625c('0x2')},'content':{'type':Sequelize[_0x625c('0x4')]},'key':{'type':Sequelize[_0x625c('0x4')]},'keyType':{'type':Sequelize[_0x625c('0x5')]('string','variable',_0x625c('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x625c('0x4')]},'nameField':{'type':Sequelize[_0x625c('0x4')]},'customField':{'type':Sequelize[_0x625c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x625c('0x4')]}}; \ No newline at end of file +var _0x7b05=['string','variable','keyValue','picklist','STRING','customVariable','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b05,0x1de));var _0x57b0=function(_0x318410,_0x451962){_0x318410=_0x318410-0x0;var _0x2898a3=_0x7b05[_0x318410];return _0x2898a3;};'use strict';var Sequelize=require('sequelize');module[_0x57b0('0x0')]={'type':{'type':Sequelize[_0x57b0('0x1')](_0x57b0('0x2'),_0x57b0('0x3'),'customVariable',_0x57b0('0x4'),_0x57b0('0x5')),'defaultValue':_0x57b0('0x2')},'content':{'type':Sequelize[_0x57b0('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x57b0('0x1')]('string',_0x57b0('0x3'),_0x57b0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x57b0('0x6')]},'nameField':{'type':Sequelize[_0x57b0('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57b0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f104ff5..83fe794 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 _0x82ce=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','keys','options','find','create','body','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x5208fa,_0x2e0115){var _0x340255=function(_0x243db1){while(--_0x243db1){_0x5208fa['push'](_0x5208fa['shift']());}};_0x340255(++_0x2e0115);}(_0x82ce,0xc6));var _0xe82c=function(_0x3cf02e,_0x488ad5){_0x3cf02e=_0x3cf02e-0x0;var _0x280c3d=_0x82ce[_0x3cf02e];return _0x280c3d;};'use strict';var emlformat=require(_0xe82c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe82c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe82c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe82c('0x3'));var util=require(_0xe82c('0x4'));var path=require(_0xe82c('0x5'));var sox=require(_0xe82c('0x6'));var csv=require(_0xe82c('0x7'));var ejs=require(_0xe82c('0x8'));var fs=require('fs');var fs_extra=require(_0xe82c('0x9'));var _=require(_0xe82c('0xa'));var squel=require(_0xe82c('0xb'));var crypto=require(_0xe82c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe82c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe82c('0xe'));var Redis=require(_0xe82c('0xf'));var authService=require(_0xe82c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe82c('0x11'));var hardwareService=require(_0xe82c('0x12'));var logger=require('../../config/logger')(_0xe82c('0x13'));var utils=require(_0xe82c('0x14'));var config=require(_0xe82c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe82c('0x16'))['db'];function respondWithStatusCode(_0x2cd1d2,_0x3eb86d){_0x3eb86d=_0x3eb86d||0xcc;return function(_0x1bee8a){if(_0x1bee8a){return _0x2cd1d2[_0xe82c('0x17')](_0x3eb86d);}return _0x2cd1d2[_0xe82c('0x18')](_0x3eb86d)[_0xe82c('0x19')]();};}function respondWithResult(_0x1f85f1,_0x32d23f){_0x32d23f=_0x32d23f||0xc8;return function(_0x248b5c){if(_0x248b5c){return _0x1f85f1[_0xe82c('0x18')](_0x32d23f)[_0xe82c('0x1a')](_0x248b5c);}};}function respondWithFilteredResult(_0x58db39,_0x42c1a9){return function(_0x343163){if(_0x343163){var _0x2be4ca=typeof _0x42c1a9['offset']==='undefined'&&typeof _0x42c1a9[_0xe82c('0x1b')]===_0xe82c('0x1c');var _0x2ad21a=_0x343163[_0xe82c('0x1d')];var _0xcc1437=_0x2be4ca?0x0:_0x42c1a9[_0xe82c('0x1e')];var _0x386144=_0x2be4ca?_0x343163[_0xe82c('0x1d')]:_0x42c1a9[_0xe82c('0x1e')]+_0x42c1a9['limit'];var _0x4fe98a;if(_0x386144>=_0x2ad21a){_0x386144=_0x2ad21a;_0x4fe98a=0xc8;}else{_0x4fe98a=0xce;}_0x58db39[_0xe82c('0x18')](_0x4fe98a);return _0x58db39[_0xe82c('0x1f')](_0xe82c('0x20'),_0xcc1437+'-'+_0x386144+'/'+_0x2ad21a)[_0xe82c('0x1a')](_0x343163);}return null;};}function patchUpdates(_0x58a10f){return function(_0x478b7a){try{jsonpatch['apply'](_0x478b7a,_0x58a10f,!![]);}catch(_0x3b6811){return BPromise[_0xe82c('0x21')](_0x3b6811);}return _0x478b7a[_0xe82c('0x22')]();};}function saveUpdates(_0x37862b,_0x171a09){return function(_0x2dd414){if(_0x2dd414){return _0x2dd414[_0xe82c('0x23')](_0x37862b)[_0xe82c('0x24')](function(_0x3582c5){return _0x3582c5;});}return null;};}function removeEntity(_0x427986,_0xd3d90f){return function(_0x504184){if(_0x504184){return _0x504184[_0xe82c('0x25')]()[_0xe82c('0x24')](function(){_0x427986[_0xe82c('0x18')](0xcc)[_0xe82c('0x19')]();});}};}function handleEntityNotFound(_0xa27f4a,_0x310b65){return function(_0x89e458){if(!_0x89e458){_0xa27f4a[_0xe82c('0x17')](0x194);}return _0x89e458;};}function handleError(_0x2563e8,_0x4f0304){_0x4f0304=_0x4f0304||0x1f4;return function(_0x58e35d){logger[_0xe82c('0x26')](_0x58e35d[_0xe82c('0x27')]);if(_0x58e35d[_0xe82c('0x28')]){delete _0x58e35d[_0xe82c('0x28')];}_0x2563e8['status'](_0x4f0304)[_0xe82c('0x29')](_0x58e35d);};}exports[_0xe82c('0x2a')]=function(_0x34e039,_0x106888){var _0x47fc5b={},_0x3a91cc={},_0x91399e={'count':0x0,'rows':[]};var _0x617b45=_[_0xe82c('0x2b')](db[_0xe82c('0x2c')][_0xe82c('0x2d')],function(_0x4d3038){return{'name':_0x4d3038['fieldName'],'type':_0x4d3038['type'][_0xe82c('0x2e')]};});_0x3a91cc[_0xe82c('0x2f')]=_['map'](_0x617b45,_0xe82c('0x28'));_0x3a91cc['query']=_['keys'](_0x34e039[_0xe82c('0x30')]);_0x3a91cc['filters']=_[_0xe82c('0x31')](_0x3a91cc[_0xe82c('0x2f')],_0x3a91cc['query']);_0x47fc5b[_0xe82c('0x32')]=_['intersection'](_0x3a91cc[_0xe82c('0x2f')],qs[_0xe82c('0x33')](_0x34e039[_0xe82c('0x30')]['fields']));_0x47fc5b[_0xe82c('0x32')]=_0x47fc5b[_0xe82c('0x32')][_0xe82c('0x34')]?_0x47fc5b[_0xe82c('0x32')]:_0x3a91cc[_0xe82c('0x2f')];if(!_0x34e039['query'][_0xe82c('0x35')](_0xe82c('0x36'))){_0x47fc5b[_0xe82c('0x1b')]=qs[_0xe82c('0x1b')](_0x34e039[_0xe82c('0x30')]['limit']);_0x47fc5b[_0xe82c('0x1e')]=qs[_0xe82c('0x1e')](_0x34e039['query'][_0xe82c('0x1e')]);}_0x47fc5b['order']=qs['sort'](_0x34e039[_0xe82c('0x30')]['sort']);_0x47fc5b[_0xe82c('0x37')]=qs[_0xe82c('0x38')](_[_0xe82c('0x39')](_0x34e039[_0xe82c('0x30')],_0x3a91cc[_0xe82c('0x38')]),_0x617b45);if(_0x34e039[_0xe82c('0x30')][_0xe82c('0x3a')]){_0x47fc5b[_0xe82c('0x37')]=_[_0xe82c('0x3b')](_0x47fc5b[_0xe82c('0x37')],{'$or':_['map'](_0x617b45,function(_0x12ffc5){if(_0x12ffc5[_0xe82c('0x3c')]!==_0xe82c('0x3d')){var _0x2017cf={};_0x2017cf[_0x12ffc5[_0xe82c('0x28')]]={'$like':'%'+_0x34e039[_0xe82c('0x30')][_0xe82c('0x3a')]+'%'};return _0x2017cf;}})});}_0x47fc5b=_[_0xe82c('0x3b')]({},_0x47fc5b,_0x34e039['options']);var _0x5583de={'where':_0x47fc5b['where']};return db['ServicenowField'][_0xe82c('0x1d')](_0x5583de)[_0xe82c('0x24')](function(_0x3f3505){_0x91399e[_0xe82c('0x1d')]=_0x3f3505;if(_0x34e039[_0xe82c('0x30')][_0xe82c('0x3e')]){_0x47fc5b['include']=[{'all':!![]}];}return db[_0xe82c('0x2c')][_0xe82c('0x3f')](_0x47fc5b);})['then'](function(_0x59d570){_0x91399e['rows']=_0x59d570;return _0x91399e;})[_0xe82c('0x24')](respondWithFilteredResult(_0x106888,_0x47fc5b))[_0xe82c('0x40')](handleError(_0x106888,null));};exports[_0xe82c('0x41')]=function(_0x44cdc9,_0x3d64ff){var _0x5d4e89={'raw':!![],'where':{'id':_0x44cdc9[_0xe82c('0x42')]['id']}},_0x5901d2={};_0x5901d2[_0xe82c('0x2f')]=_[_0xe82c('0x43')](db[_0xe82c('0x2c')][_0xe82c('0x2d')]);_0x5901d2[_0xe82c('0x30')]=_['keys'](_0x44cdc9[_0xe82c('0x30')]);_0x5901d2[_0xe82c('0x38')]=_['intersection'](_0x5901d2[_0xe82c('0x2f')],_0x5901d2[_0xe82c('0x30')]);_0x5d4e89[_0xe82c('0x32')]=_['intersection'](_0x5901d2[_0xe82c('0x2f')],qs[_0xe82c('0x33')](_0x44cdc9['query']['fields']));_0x5d4e89[_0xe82c('0x32')]=_0x5d4e89[_0xe82c('0x32')][_0xe82c('0x34')]?_0x5d4e89[_0xe82c('0x32')]:_0x5901d2['model'];if(_0x44cdc9[_0xe82c('0x30')][_0xe82c('0x3e')]){_0x5d4e89['include']=[{'all':!![]}];}_0x5d4e89=_[_0xe82c('0x3b')]({},_0x5d4e89,_0x44cdc9[_0xe82c('0x44')]);return db[_0xe82c('0x2c')][_0xe82c('0x45')](_0x5d4e89)[_0xe82c('0x24')](handleEntityNotFound(_0x3d64ff,null))[_0xe82c('0x24')](respondWithResult(_0x3d64ff,null))[_0xe82c('0x40')](handleError(_0x3d64ff,null));};exports[_0xe82c('0x46')]=function(_0x1484d6,_0x16a65c){return db[_0xe82c('0x2c')][_0xe82c('0x46')](_0x1484d6['body'],{})['then'](respondWithResult(_0x16a65c,0xc9))[_0xe82c('0x40')](handleError(_0x16a65c,null));};exports['update']=function(_0xfb18a3,_0x45d945){if(_0xfb18a3[_0xe82c('0x47')]['id']){delete _0xfb18a3[_0xe82c('0x47')]['id'];}return db[_0xe82c('0x2c')][_0xe82c('0x45')]({'where':{'id':_0xfb18a3[_0xe82c('0x42')]['id']}})[_0xe82c('0x24')](handleEntityNotFound(_0x45d945,null))[_0xe82c('0x24')](saveUpdates(_0xfb18a3['body'],null))[_0xe82c('0x24')](respondWithResult(_0x45d945,null))[_0xe82c('0x40')](handleError(_0x45d945,null));};exports[_0xe82c('0x25')]=function(_0x40731e,_0x539ebf){return db[_0xe82c('0x2c')][_0xe82c('0x45')]({'where':{'id':_0x40731e[_0xe82c('0x42')]['id']}})[_0xe82c('0x24')](handleEntityNotFound(_0x539ebf,null))[_0xe82c('0x24')](removeEntity(_0x539ebf,null))[_0xe82c('0x40')](handleError(_0x539ebf,null));}; \ No newline at end of file +var _0x75f8=['intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','ServicenowField','findAll','rows','params','keys','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes'];(function(_0x11d6da,_0x4862ec){var _0x5293ef=function(_0x5488e4){while(--_0x5488e4){_0x11d6da['push'](_0x11d6da['shift']());}};_0x5293ef(++_0x4862ec);}(_0x75f8,0x18e));var _0x875f=function(_0x40cb7a,_0x505484){_0x40cb7a=_0x40cb7a-0x0;var _0x246f9c=_0x75f8[_0x40cb7a];return _0x246f9c;};'use strict';var emlformat=require(_0x875f('0x0'));var rimraf=require(_0x875f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x875f('0x2'));var rp=require(_0x875f('0x3'));var moment=require(_0x875f('0x4'));var BPromise=require(_0x875f('0x5'));var Mustache=require(_0x875f('0x6'));var util=require(_0x875f('0x7'));var path=require(_0x875f('0x8'));var sox=require(_0x875f('0x9'));var csv=require(_0x875f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x875f('0xb'));var _=require(_0x875f('0xc'));var squel=require('squel');var crypto=require(_0x875f('0xd'));var jsforce=require(_0x875f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x875f('0xf'));var Papa=require(_0x875f('0x10'));var Redis=require(_0x875f('0x11'));var authService=require(_0x875f('0x12'));var qs=require(_0x875f('0x13'));var as=require(_0x875f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x875f('0x15'))(_0x875f('0x16'));var utils=require(_0x875f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x875f('0x18'));var db=require(_0x875f('0x19'))['db'];function respondWithStatusCode(_0x15558c,_0x317307){_0x317307=_0x317307||0xcc;return function(_0x559c87){if(_0x559c87){return _0x15558c[_0x875f('0x1a')](_0x317307);}return _0x15558c[_0x875f('0x1b')](_0x317307)['end']();};}function respondWithResult(_0x1dad41,_0x56f658){_0x56f658=_0x56f658||0xc8;return function(_0x3e454f){if(_0x3e454f){return _0x1dad41[_0x875f('0x1b')](_0x56f658)[_0x875f('0x1c')](_0x3e454f);}};}function respondWithFilteredResult(_0x29707b,_0x1b6394){return function(_0x37f8e2){if(_0x37f8e2){var _0x3b7062=typeof _0x1b6394['offset']===_0x875f('0x1d')&&typeof _0x1b6394[_0x875f('0x1e')]===_0x875f('0x1d');var _0x4cfd51=_0x37f8e2[_0x875f('0x1f')];var _0x2cb5bc=_0x3b7062?0x0:_0x1b6394[_0x875f('0x20')];var _0x3b9a8a=_0x3b7062?_0x37f8e2[_0x875f('0x1f')]:_0x1b6394['offset']+_0x1b6394[_0x875f('0x1e')];var _0x25be6e;if(_0x3b9a8a>=_0x4cfd51){_0x3b9a8a=_0x4cfd51;_0x25be6e=0xc8;}else{_0x25be6e=0xce;}_0x29707b['status'](_0x25be6e);return _0x29707b[_0x875f('0x21')]('Content-Range',_0x2cb5bc+'-'+_0x3b9a8a+'/'+_0x4cfd51)[_0x875f('0x1c')](_0x37f8e2);}return null;};}function patchUpdates(_0x56e2dc){return function(_0x11d29e){try{jsonpatch[_0x875f('0x22')](_0x11d29e,_0x56e2dc,!![]);}catch(_0x27671c){return BPromise[_0x875f('0x23')](_0x27671c);}return _0x11d29e['save']();};}function saveUpdates(_0x30d209,_0x1c51dc){return function(_0x3b131c){if(_0x3b131c){return _0x3b131c[_0x875f('0x24')](_0x30d209)[_0x875f('0x25')](function(_0x56e32b){return _0x56e32b;});}return null;};}function removeEntity(_0x2913d1,_0xc80ab2){return function(_0x1be375){if(_0x1be375){return _0x1be375[_0x875f('0x26')]()[_0x875f('0x25')](function(){_0x2913d1[_0x875f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31a672,_0x5ef890){return function(_0x3d3ddb){if(!_0x3d3ddb){_0x31a672[_0x875f('0x1a')](0x194);}return _0x3d3ddb;};}function handleError(_0xa0d9b2,_0x593ca8){_0x593ca8=_0x593ca8||0x1f4;return function(_0x2ad5f3){logger[_0x875f('0x27')](_0x2ad5f3['stack']);if(_0x2ad5f3['name']){delete _0x2ad5f3['name'];}_0xa0d9b2[_0x875f('0x1b')](_0x593ca8)[_0x875f('0x28')](_0x2ad5f3);};}exports[_0x875f('0x29')]=function(_0x3a36fd,_0x3d4760){var _0x3dec98={},_0x6362db={},_0x5eb752={'count':0x0,'rows':[]};var _0x2799d8=_[_0x875f('0x2a')](db['ServicenowField'][_0x875f('0x2b')],function(_0x30aeb8){return{'name':_0x30aeb8[_0x875f('0x2c')],'type':_0x30aeb8[_0x875f('0x2d')][_0x875f('0x2e')]};});_0x6362db[_0x875f('0x2f')]=_['map'](_0x2799d8,_0x875f('0x30'));_0x6362db['query']=_['keys'](_0x3a36fd[_0x875f('0x31')]);_0x6362db[_0x875f('0x32')]=_['intersection'](_0x6362db[_0x875f('0x2f')],_0x6362db[_0x875f('0x31')]);_0x3dec98[_0x875f('0x33')]=_[_0x875f('0x34')](_0x6362db[_0x875f('0x2f')],qs[_0x875f('0x35')](_0x3a36fd[_0x875f('0x31')][_0x875f('0x35')]));_0x3dec98[_0x875f('0x33')]=_0x3dec98[_0x875f('0x33')]['length']?_0x3dec98[_0x875f('0x33')]:_0x6362db[_0x875f('0x2f')];if(!_0x3a36fd[_0x875f('0x31')][_0x875f('0x36')](_0x875f('0x37'))){_0x3dec98[_0x875f('0x1e')]=qs[_0x875f('0x1e')](_0x3a36fd[_0x875f('0x31')][_0x875f('0x1e')]);_0x3dec98[_0x875f('0x20')]=qs[_0x875f('0x20')](_0x3a36fd[_0x875f('0x31')][_0x875f('0x20')]);}_0x3dec98[_0x875f('0x38')]=qs[_0x875f('0x39')](_0x3a36fd['query']['sort']);_0x3dec98[_0x875f('0x3a')]=qs[_0x875f('0x32')](_[_0x875f('0x3b')](_0x3a36fd[_0x875f('0x31')],_0x6362db[_0x875f('0x32')]),_0x2799d8);if(_0x3a36fd['query']['filter']){_0x3dec98[_0x875f('0x3a')]=_['merge'](_0x3dec98[_0x875f('0x3a')],{'$or':_['map'](_0x2799d8,function(_0x530502){if(_0x530502[_0x875f('0x2d')]!=='VIRTUAL'){var _0x3f832e={};_0x3f832e[_0x530502[_0x875f('0x30')]]={'$like':'%'+_0x3a36fd[_0x875f('0x31')][_0x875f('0x3c')]+'%'};return _0x3f832e;}})});}_0x3dec98=_[_0x875f('0x3d')]({},_0x3dec98,_0x3a36fd[_0x875f('0x3e')]);var _0x2fecab={'where':_0x3dec98['where']};return db['ServicenowField'][_0x875f('0x1f')](_0x2fecab)[_0x875f('0x25')](function(_0x2e5704){_0x5eb752['count']=_0x2e5704;if(_0x3a36fd['query'][_0x875f('0x3f')]){_0x3dec98[_0x875f('0x40')]=[{'all':!![]}];}return db[_0x875f('0x41')][_0x875f('0x42')](_0x3dec98);})[_0x875f('0x25')](function(_0x2af38b){_0x5eb752[_0x875f('0x43')]=_0x2af38b;return _0x5eb752;})['then'](respondWithFilteredResult(_0x3d4760,_0x3dec98))['catch'](handleError(_0x3d4760,null));};exports['show']=function(_0x21c159,_0x57c1d6){var _0x1fb275={'raw':!![],'where':{'id':_0x21c159[_0x875f('0x44')]['id']}},_0xf494d={};_0xf494d[_0x875f('0x2f')]=_[_0x875f('0x45')](db[_0x875f('0x41')]['rawAttributes']);_0xf494d['query']=_[_0x875f('0x45')](_0x21c159[_0x875f('0x31')]);_0xf494d[_0x875f('0x32')]=_[_0x875f('0x34')](_0xf494d[_0x875f('0x2f')],_0xf494d['query']);_0x1fb275[_0x875f('0x33')]=_['intersection'](_0xf494d['model'],qs[_0x875f('0x35')](_0x21c159['query'][_0x875f('0x35')]));_0x1fb275['attributes']=_0x1fb275[_0x875f('0x33')][_0x875f('0x46')]?_0x1fb275['attributes']:_0xf494d[_0x875f('0x2f')];if(_0x21c159[_0x875f('0x31')][_0x875f('0x3f')]){_0x1fb275[_0x875f('0x40')]=[{'all':!![]}];}_0x1fb275=_[_0x875f('0x3d')]({},_0x1fb275,_0x21c159[_0x875f('0x3e')]);return db[_0x875f('0x41')][_0x875f('0x47')](_0x1fb275)['then'](handleEntityNotFound(_0x57c1d6,null))[_0x875f('0x25')](respondWithResult(_0x57c1d6,null))[_0x875f('0x48')](handleError(_0x57c1d6,null));};exports['create']=function(_0xdb2096,_0x502316){return db[_0x875f('0x41')][_0x875f('0x49')](_0xdb2096[_0x875f('0x4a')],{})[_0x875f('0x25')](respondWithResult(_0x502316,0xc9))[_0x875f('0x48')](handleError(_0x502316,null));};exports[_0x875f('0x24')]=function(_0x2326a2,_0x198fd8){if(_0x2326a2[_0x875f('0x4a')]['id']){delete _0x2326a2[_0x875f('0x4a')]['id'];}return db[_0x875f('0x41')][_0x875f('0x47')]({'where':{'id':_0x2326a2[_0x875f('0x44')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x198fd8,null))[_0x875f('0x25')](saveUpdates(_0x2326a2[_0x875f('0x4a')],null))[_0x875f('0x25')](respondWithResult(_0x198fd8,null))['catch'](handleError(_0x198fd8,null));};exports[_0x875f('0x26')]=function(_0x1da151,_0x14d238){return db['ServicenowField'][_0x875f('0x47')]({'where':{'id':_0x1da151[_0x875f('0x44')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x14d238,null))['then'](removeEntity(_0x14d238,null))[_0x875f('0x48')](handleError(_0x14d238,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b3b89e1..25f76ac 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 _0x802d=['servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x3d78,_0x110435){var _0x126059=function(_0x988e73){while(--_0x988e73){_0x3d78['push'](_0x3d78['shift']());}};_0x126059(++_0x110435);}(_0x802d,0x1d7));var _0xd802=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x802d[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require('lodash');var util=require(_0xd802('0x0'));var logger=require(_0xd802('0x1'))(_0xd802('0x2'));var moment=require(_0xd802('0x3'));var BPromise=require(_0xd802('0x4'));var rp=require(_0xd802('0x5'));var fs=require('fs');var path=require(_0xd802('0x6'));var rimraf=require(_0xd802('0x7'));var config=require(_0xd802('0x8'));var attributes=require(_0xd802('0x9'));module['exports']=function(_0x35cffa,_0xf4ad39){return _0x35cffa['define']('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xd802('0xa'),'fields':[_0xd802('0xb'),_0xd802('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9409=['FieldId','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x5d56a3,_0x318239){var _0x55cc75=function(_0x367285){while(--_0x367285){_0x5d56a3['push'](_0x5d56a3['shift']());}};_0x55cc75(++_0x318239);}(_0x9409,0xf8));var _0x9940=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x9409[_0x2525f1];return _0x13c1b5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9940('0x0'))('api');var moment=require(_0x9940('0x1'));var BPromise=require(_0x9940('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9940('0x3'));var config=require(_0x9940('0x4'));var attributes=require(_0x9940('0x5'));module[_0x9940('0x6')]=function(_0x3e82fe,_0x76ddbd){return _0x3e82fe[_0x9940('0x7')](_0x9940('0x8'),attributes,{'tableName':_0x9940('0x9'),'paranoid':![],'indexes':[{'name':_0x9940('0xa'),'fields':[_0x9940('0xb'),_0x9940('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 296b8f5..1a37fdd 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\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(_0x59adc7,_0x333f2b){var _0x277950=function(_0x32f4ec){while(--_0x32f4ec){_0x59adc7['push'](_0x59adc7['shift']());}};_0x277950(++_0x333f2b);}(_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')]('ServicenowField,\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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\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(_0x32978c,_0x1fd267){var _0x2421b2=function(_0x26ba4e){while(--_0x26ba4e){_0x32978c['push'](_0x32978c['shift']());}};_0x2421b2(++_0x1fd267);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'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')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b1e81aa..bcd69dd 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(_0x538ffd,_0x145008){var _0x5b5aaa=function(_0x2ed3f3){while(--_0x2ed3f3){_0x538ffd['push'](_0x538ffd['shift']());}};_0x5b5aaa(++_0x145008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x2200ab,_0x5b9c92){var _0x21c40c=function(_0x5ca00d){while(--_0x5ca00d){_0x2200ab['push'](_0x2200ab['shift']());}};_0x21c40c(++_0x5b9c92);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 f5d72ac..42e6318 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(_0xc0bc4b,_0x3f2099){var _0x580b88=function(_0x2e7563){while(--_0x2e7563){_0xc0bc4b['push'](_0xc0bc4b['shift']());}};_0x580b88(++_0x3f2099);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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(_0x833443,_0x12da5f){var _0x247810=function(_0x146e46){while(--_0x146e46){_0x833443['push'](_0x833443['shift']());}};_0x247810(++_0x12da5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 ff2af90..81154fd 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 _0x1be2=['JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','format','get_module_fields','stringify','Calls','values','module_fields','remove','includes','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','%s%s','/service/v4_1/rest.php','login'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x1be2,0x181));var _0x21be=function(_0x171484,_0x10c8f5){_0x171484=_0x171484-0x0;var _0x423561=_0x1be2[_0x171484];return _0x423561;};'use strict';var emlformat=require(_0x21be('0x0'));var rimraf=require(_0x21be('0x1'));var zipdir=require(_0x21be('0x2'));var jsonpatch=require(_0x21be('0x3'));var rp=require(_0x21be('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x21be('0x5'));var path=require('path');var sox=require(_0x21be('0x6'));var csv=require(_0x21be('0x7'));var ejs=require(_0x21be('0x8'));var fs=require('fs');var fs_extra=require(_0x21be('0x9'));var _=require('lodash');var squel=require(_0x21be('0xa'));var crypto=require('crypto');var jsforce=require(_0x21be('0xb'));var deskjs=require(_0x21be('0xc'));var toCsv=require(_0x21be('0x7'));var querystring=require(_0x21be('0xd'));var Papa=require(_0x21be('0xe'));var Redis=require(_0x21be('0xf'));var authService=require(_0x21be('0x10'));var qs=require(_0x21be('0x11'));var as=require(_0x21be('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x21be('0x13'));var utils=require(_0x21be('0x14'));var config=require(_0x21be('0x15'));var licenseUtil=require(_0x21be('0x16'));var db=require(_0x21be('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e46f3,_0x21e7d8){_0x21e7d8=_0x21e7d8||0xcc;return function(_0xc2ad0f){if(_0xc2ad0f){return _0x2e46f3[_0x21be('0x18')](_0x21e7d8);}return _0x2e46f3[_0x21be('0x19')](_0x21e7d8)[_0x21be('0x1a')]();};}function respondWithResult(_0x2adb43,_0x3d210e){_0x3d210e=_0x3d210e||0xc8;return function(_0x308934){if(_0x308934){return _0x2adb43[_0x21be('0x19')](_0x3d210e)['json'](_0x308934);}};}function respondWithFilteredResult(_0x501f7b,_0x1e6cda){return function(_0x2290bd){if(_0x2290bd){var _0x5b19a9=typeof _0x1e6cda[_0x21be('0x1b')]===_0x21be('0x1c')&&typeof _0x1e6cda[_0x21be('0x1d')]===_0x21be('0x1c');var _0x9ebe6a=_0x2290bd[_0x21be('0x1e')];var _0x21bb5e=_0x5b19a9?0x0:_0x1e6cda[_0x21be('0x1b')];var _0x46b626=_0x5b19a9?_0x2290bd[_0x21be('0x1e')]:_0x1e6cda[_0x21be('0x1b')]+_0x1e6cda['limit'];var _0x2b215d;if(_0x46b626>=_0x9ebe6a){_0x46b626=_0x9ebe6a;_0x2b215d=0xc8;}else{_0x2b215d=0xce;}_0x501f7b['status'](_0x2b215d);return _0x501f7b['set'](_0x21be('0x1f'),_0x21bb5e+'-'+_0x46b626+'/'+_0x9ebe6a)[_0x21be('0x20')](_0x2290bd);}return null;};}function patchUpdates(_0x102591){return function(_0x28a465){try{jsonpatch[_0x21be('0x21')](_0x28a465,_0x102591,!![]);}catch(_0x3b7edc){return BPromise[_0x21be('0x22')](_0x3b7edc);}return _0x28a465[_0x21be('0x23')]();};}function saveUpdates(_0x49d125,_0x559ec){return function(_0x23a2e0){if(_0x23a2e0){return _0x23a2e0[_0x21be('0x24')](_0x49d125)[_0x21be('0x25')](function(_0xc19fba){return _0xc19fba;});}return null;};}function removeEntity(_0xad177a,_0x578f7d){return function(_0x10cc29){if(_0x10cc29){return _0x10cc29[_0x21be('0x26')]()[_0x21be('0x25')](function(){_0xad177a[_0x21be('0x19')](0xcc)[_0x21be('0x1a')]();});}};}function handleEntityNotFound(_0x3e280d,_0x35fb7c){return function(_0x24956a){if(!_0x24956a){_0x3e280d[_0x21be('0x18')](0x194);}return _0x24956a;};}function handleError(_0x3e63b4,_0x403832){_0x403832=_0x403832||0x1f4;return function(_0xa791c1){logger[_0x21be('0x27')](_0xa791c1[_0x21be('0x28')]);if(_0xa791c1[_0x21be('0x29')]){delete _0xa791c1[_0x21be('0x29')];}_0x3e63b4['status'](_0x403832)['send'](_0xa791c1);};}exports[_0x21be('0x2a')]=function(_0x541818,_0x57c512){var _0x575baa={},_0x3ff693={},_0x3bb300={'count':0x0,'rows':[]};var _0x164b30=_[_0x21be('0x2b')](db[_0x21be('0x2c')][_0x21be('0x2d')],function(_0x1aed95){return{'name':_0x1aed95[_0x21be('0x2e')],'type':_0x1aed95['type'][_0x21be('0x2f')]};});_0x3ff693[_0x21be('0x30')]=_[_0x21be('0x2b')](_0x164b30,_0x21be('0x29'));_0x3ff693[_0x21be('0x31')]=_[_0x21be('0x32')](_0x541818[_0x21be('0x31')]);_0x3ff693[_0x21be('0x33')]=_[_0x21be('0x34')](_0x3ff693[_0x21be('0x30')],_0x3ff693[_0x21be('0x31')]);_0x575baa[_0x21be('0x35')]=_[_0x21be('0x34')](_0x3ff693[_0x21be('0x30')],qs[_0x21be('0x36')](_0x541818[_0x21be('0x31')][_0x21be('0x36')]));_0x575baa[_0x21be('0x35')]=_0x575baa[_0x21be('0x35')][_0x21be('0x37')]?_0x575baa[_0x21be('0x35')]:_0x3ff693[_0x21be('0x30')];if(!_0x541818[_0x21be('0x31')][_0x21be('0x38')](_0x21be('0x39'))){_0x575baa[_0x21be('0x1d')]=qs[_0x21be('0x1d')](_0x541818[_0x21be('0x31')][_0x21be('0x1d')]);_0x575baa[_0x21be('0x1b')]=qs['offset'](_0x541818[_0x21be('0x31')][_0x21be('0x1b')]);}_0x575baa[_0x21be('0x3a')]=qs['sort'](_0x541818[_0x21be('0x31')][_0x21be('0x3b')]);_0x575baa[_0x21be('0x3c')]=qs[_0x21be('0x33')](_[_0x21be('0x3d')](_0x541818[_0x21be('0x31')],_0x3ff693[_0x21be('0x33')]),_0x164b30);if(_0x541818[_0x21be('0x31')][_0x21be('0x3e')]){_0x575baa[_0x21be('0x3c')]=_[_0x21be('0x3f')](_0x575baa[_0x21be('0x3c')],{'$or':_['map'](_0x164b30,function(_0x3ab087){if(_0x3ab087[_0x21be('0x40')]!==_0x21be('0x41')){var _0x5741c2={};_0x5741c2[_0x3ab087[_0x21be('0x29')]]={'$like':'%'+_0x541818[_0x21be('0x31')][_0x21be('0x3e')]+'%'};return _0x5741c2;}})});}_0x575baa=_[_0x21be('0x3f')]({},_0x575baa,_0x541818[_0x21be('0x42')]);var _0x8c9216={'where':_0x575baa[_0x21be('0x3c')]};return db[_0x21be('0x2c')][_0x21be('0x1e')](_0x8c9216)['then'](function(_0xbbaff6){_0x3bb300['count']=_0xbbaff6;if(_0x541818[_0x21be('0x31')][_0x21be('0x43')]){_0x575baa[_0x21be('0x44')]=[{'all':!![]}];}return db[_0x21be('0x2c')][_0x21be('0x45')](_0x575baa);})[_0x21be('0x25')](function(_0x4a128f){_0x3bb300['rows']=_0x4a128f;return _0x3bb300;})[_0x21be('0x25')](respondWithFilteredResult(_0x57c512,_0x575baa))[_0x21be('0x46')](handleError(_0x57c512,null));};exports['show']=function(_0x301724,_0x14ac1d){var _0xc4720d={'raw':![],'where':{'id':_0x301724['params']['id']}},_0x4c7422={};_0x4c7422['model']=_[_0x21be('0x32')](db[_0x21be('0x2c')][_0x21be('0x2d')]);_0x4c7422[_0x21be('0x31')]=_['keys'](_0x301724[_0x21be('0x31')]);_0x4c7422[_0x21be('0x33')]=_[_0x21be('0x34')](_0x4c7422[_0x21be('0x30')],_0x4c7422[_0x21be('0x31')]);_0xc4720d['attributes']=_['intersection'](_0x4c7422['model'],qs[_0x21be('0x36')](_0x301724['query'][_0x21be('0x36')]));_0xc4720d[_0x21be('0x35')]=_0xc4720d[_0x21be('0x35')][_0x21be('0x37')]?_0xc4720d[_0x21be('0x35')]:_0x4c7422[_0x21be('0x30')];if(_0x301724['query'][_0x21be('0x43')]){_0xc4720d['include']=[{'all':!![]}];}_0xc4720d=_[_0x21be('0x3f')]({},_0xc4720d,_0x301724['options']);return db[_0x21be('0x2c')]['find'](_0xc4720d)['then'](handleEntityNotFound(_0x14ac1d,null))[_0x21be('0x25')](respondWithResult(_0x14ac1d,null))[_0x21be('0x46')](handleError(_0x14ac1d,null));};exports[_0x21be('0x47')]=function(_0x51f60b,_0x4d876d){return db[_0x21be('0x2c')][_0x21be('0x47')](_0x51f60b[_0x21be('0x48')],{})[_0x21be('0x25')](respondWithResult(_0x4d876d,0xc9))[_0x21be('0x46')](handleError(_0x4d876d,null));};exports[_0x21be('0x24')]=function(_0x12d586,_0x25991d){if(_0x12d586[_0x21be('0x48')]['id']){delete _0x12d586[_0x21be('0x48')]['id'];}return db[_0x21be('0x2c')][_0x21be('0x49')]({'where':{'id':_0x12d586[_0x21be('0x4a')]['id']}})[_0x21be('0x25')](handleEntityNotFound(_0x25991d,null))[_0x21be('0x25')](saveUpdates(_0x12d586[_0x21be('0x48')],null))[_0x21be('0x25')](respondWithResult(_0x25991d,null))[_0x21be('0x46')](handleError(_0x25991d,null));};exports[_0x21be('0x26')]=function(_0x1c35e3,_0x156f54){return db[_0x21be('0x2c')][_0x21be('0x49')]({'where':{'id':_0x1c35e3[_0x21be('0x4a')]['id']}})[_0x21be('0x25')](handleEntityNotFound(_0x156f54,null))[_0x21be('0x25')](removeEntity(_0x156f54,null))['catch'](handleError(_0x156f54,null));};exports['getConfigurations']=function(_0x1c1624,_0x33a9f8,_0x4f462a){var _0x215883={};var _0x23727f={};var _0x4ae2d7;var _0x56ff95;return db[_0x21be('0x2c')][_0x21be('0x4b')]({'where':{'id':_0x1c1624[_0x21be('0x4a')]['id']}})[_0x21be('0x25')](handleEntityNotFound(_0x33a9f8,null))[_0x21be('0x25')](function(_0x387d4b){if(_0x387d4b){_0x4ae2d7=_0x387d4b;_0x23727f[_0x21be('0x30')]=_['keys'](db['SugarcrmConfiguration']['rawAttributes']);_0x23727f[_0x21be('0x31')]=_[_0x21be('0x32')](_0x1c1624[_0x21be('0x31')]);_0x23727f[_0x21be('0x33')]=_['intersection'](_0x23727f['model'],_0x23727f['query']);_0x215883[_0x21be('0x35')]=_[_0x21be('0x34')](_0x23727f['model'],qs['fields'](_0x1c1624[_0x21be('0x31')][_0x21be('0x36')]));_0x215883[_0x21be('0x35')]=_0x215883['attributes']['length']?_0x215883[_0x21be('0x35')]:_0x23727f[_0x21be('0x30')];_0x215883[_0x21be('0x3a')]=qs['sort'](_0x1c1624['query'][_0x21be('0x3b')]);_0x215883[_0x21be('0x3c')]=qs[_0x21be('0x33')](_['pick'](_0x1c1624[_0x21be('0x31')],_0x23727f[_0x21be('0x33')]));if(_0x1c1624[_0x21be('0x31')]['filter']){_0x215883[_0x21be('0x3c')]=_[_0x21be('0x3f')](_0x215883[_0x21be('0x3c')],{'$or':_['map'](_0x215883[_0x21be('0x35')],function(_0xcc1999){var _0xf74e36={};_0xf74e36[_0xcc1999]={'$like':'%'+_0x1c1624[_0x21be('0x31')][_0x21be('0x3e')]+'%'};return _0xf74e36;})});}_0x215883=_[_0x21be('0x3f')]({},_0x215883,_0x1c1624['options']);return _0x4ae2d7[_0x21be('0x4c')](_0x215883);}})[_0x21be('0x25')](function(_0x29d344){if(_0x29d344){_0x56ff95=_0x29d344['length'];if(!_0x1c1624[_0x21be('0x31')]['hasOwnProperty']('nolimit')){_0x215883['limit']=qs['limit'](_0x1c1624[_0x21be('0x31')][_0x21be('0x1d')]);_0x215883['offset']=qs['offset'](_0x1c1624[_0x21be('0x31')][_0x21be('0x1b')]);}return _0x4ae2d7[_0x21be('0x4c')](_0x215883);}})['then'](function(_0x163ba0){if(_0x163ba0){return _0x163ba0?{'count':_0x56ff95,'rows':_0x163ba0}:null;}})[_0x21be('0x25')](respondWithResult(_0x33a9f8,null))[_0x21be('0x46')](handleError(_0x33a9f8,null));};exports[_0x21be('0x4d')]=function(_0x3a9e49,_0x27bd96,_0x1e3b73){if(_0x3a9e49[_0x21be('0x48')]['id']){delete _0x3a9e49[_0x21be('0x48')]['id'];}return db['SugarcrmAccount'][_0x21be('0x4b')]({'where':{'id':_0x3a9e49[_0x21be('0x4a')]['id']}})[_0x21be('0x25')](handleEntityNotFound(_0x27bd96,null))[_0x21be('0x25')](function(_0x53e3a5){if(_0x53e3a5){_0x3a9e49[_0x21be('0x48')][_0x21be('0x4e')]=_0x53e3a5['id'];_0x3a9e49['body'][_0x21be('0x4f')]=integrations[_0x21be('0x50')](_0x3a9e49['body'][_0x21be('0x51')],_0x3a9e49['body'][_0x21be('0x40')]);_0x3a9e49[_0x21be('0x48')][_0x21be('0x52')]=integrations['getDescriptions'](_0x3a9e49[_0x21be('0x48')][_0x21be('0x51')],_0x3a9e49[_0x21be('0x48')][_0x21be('0x40')]);return db[_0x21be('0x53')][_0x21be('0x47')](_0x3a9e49[_0x21be('0x48')],{'include':[{'model':db[_0x21be('0x54')],'as':_0x21be('0x4f')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0x21be('0x25')](respondWithResult(_0x27bd96,null))[_0x21be('0x46')](handleError(_0x27bd96,null));};exports[_0x21be('0x55')]=function(_0x536496,_0x3b75a6,_0x4c709a){var _0x1ef4ce='';var _0x4e9895=['id','name',_0x21be('0x56'),_0x21be('0x57'),_0x21be('0x58'),_0x21be('0x59'),_0x21be('0x5a'),_0x21be('0x5b'),_0x21be('0x5c'),_0x21be('0x5d'),_0x21be('0x5e'),_0x21be('0x5f')];return db[_0x21be('0x2c')]['findOne']({'where':{'id':_0x536496[_0x21be('0x4a')]['id']},'attributes':['id',_0x21be('0x60'),_0x21be('0x61'),_0x21be('0x62')]})['then'](handleEntityNotFound(_0x3b75a6,null))[_0x21be('0x25')](function(_0x384034){if(_0x384034){_0x1ef4ce=_0x384034[_0x21be('0x62')];var _0x29c3e2=_0x1ef4ce['slice'](-0x1);if(_0x29c3e2==='/'){_0x1ef4ce=_0x1ef4ce[_0x21be('0x63')](0x0,_0x1ef4ce['lastIndexOf'](_0x29c3e2));}return rp({'method':'POST','uri':util['format'](_0x21be('0x64'),_0x1ef4ce,_0x21be('0x65')),'json':!![],'form':{'method':_0x21be('0x66'),'input_type':_0x21be('0x67'),'response_type':_0x21be('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x384034['username'],'password':_0x384034['password'],'encryption':_0x21be('0x68')},'application':_0x21be('0x69')})}});}})[_0x21be('0x25')](function(_0x263de2){if(_0x263de2&&_0x263de2[_0x21be('0x29')]!==_0x21be('0x6a')&&_0x263de2[_0x21be('0x29')]!=='Password\x20Expired'){return rp({'method':_0x21be('0x6b'),'uri':util[_0x21be('0x6c')](_0x21be('0x64'),_0x1ef4ce,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x21be('0x6d'),'input_type':_0x21be('0x67'),'response_type':_0x21be('0x67'),'rest_data':JSON[_0x21be('0x6e')]({'session':_0x263de2['id'],'module_name':_0x21be('0x6f')})}})[_0x21be('0x25')](function(_0x42d0ce){if(_0x42d0ce){var _0x35aa37=_[_0x21be('0x70')](_0x42d0ce[_0x21be('0x71')]);_[_0x21be('0x72')](_0x35aa37,function(_0x1b759f){return _0x4e9895[_0x21be('0x73')](_0x1b759f[_0x21be('0x29')]);});return{'count':_0x35aa37[_0x21be('0x37')],'rows':_[_0x21be('0x2b')](_0x35aa37,function(_0x4e337e){return{'id':_0x4e337e['name'],'name':_0x4e337e['label'],'custom':_[_0x21be('0x74')](_0x4e337e[_0x21be('0x29')],'_c')?!![]:![],'options':_0x4e337e[_0x21be('0x42')]?_['map'](_[_0x21be('0x70')](_0x4e337e[_0x21be('0x42')]),function(_0x1aef20){return{'name':_0x1aef20['value'],'value':_0x1aef20[_0x21be('0x29')]};}):[]};})};}})[_0x21be('0x25')](respondWithResult(_0x3b75a6,null))[_0x21be('0x46')](function(_0x30cadf){var _0x5f03a5=_0x536496['query'][_0x21be('0x75')]?0x1f4:_0x30cadf['statusCode']||0x1f4;logger[_0x21be('0x27')](_0x21be('0x76'),_0x21be('0x55'),_0x5f03a5,JSON[_0x21be('0x6e')](_0x30cadf));delete _0x30cadf[_0x21be('0x29')];if(_0x5f03a5===0x191){_0x5f03a5=0x190;}_0x3b75a6[_0x21be('0x19')](_0x5f03a5)[_0x21be('0x77')](_0x536496[_0x21be('0x31')][_0x21be('0x75')]?{'message':_0x21be('0x78'),'statusCode':_0x30cadf[_0x21be('0x79')]}:_0x30cadf);});}else{var _0x539824=0x1f4;_0x3b75a6['status'](_0x539824)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0x427a=['getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../components/integrations/configuration','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','remove','includes','label','endsWith','value','test'];(function(_0x5a01e7,_0x56c3f7){var _0x3cf168=function(_0x1a34c7){while(--_0x1a34c7){_0x5a01e7['push'](_0x5a01e7['shift']());}};_0x3cf168(++_0x56c3f7);}(_0x427a,0x174));var _0xa427=function(_0x393592,_0x2c2c00){_0x393592=_0x393592-0x0;var _0x2eed2d=_0x427a[_0x393592];return _0x2eed2d;};'use strict';var emlformat=require(_0xa427('0x0'));var rimraf=require(_0xa427('0x1'));var zipdir=require(_0xa427('0x2'));var jsonpatch=require(_0xa427('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa427('0x4'));var Mustache=require('mustache');var util=require(_0xa427('0x5'));var path=require('path');var sox=require(_0xa427('0x6'));var csv=require('to-csv');var ejs=require(_0xa427('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa427('0x8'));var squel=require(_0xa427('0x9'));var crypto=require(_0xa427('0xa'));var jsforce=require(_0xa427('0xb'));var deskjs=require(_0xa427('0xc'));var toCsv=require(_0xa427('0xd'));var querystring=require(_0xa427('0xe'));var Papa=require(_0xa427('0xf'));var Redis=require(_0xa427('0x10'));var authService=require(_0xa427('0x11'));var qs=require(_0xa427('0x12'));var as=require(_0xa427('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa427('0x14'))('api');var utils=require(_0xa427('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa427('0x16'));function respondWithStatusCode(_0x408e87,_0x1fc320){_0x1fc320=_0x1fc320||0xcc;return function(_0x234013){if(_0x234013){return _0x408e87['sendStatus'](_0x1fc320);}return _0x408e87[_0xa427('0x17')](_0x1fc320)[_0xa427('0x18')]();};}function respondWithResult(_0x21dae6,_0x2e401a){_0x2e401a=_0x2e401a||0xc8;return function(_0x2708af){if(_0x2708af){return _0x21dae6[_0xa427('0x17')](_0x2e401a)['json'](_0x2708af);}};}function respondWithFilteredResult(_0x4c775d,_0x376f1b){return function(_0x35891d){if(_0x35891d){var _0x58a80e=typeof _0x376f1b[_0xa427('0x19')]===_0xa427('0x1a')&&typeof _0x376f1b['limit']===_0xa427('0x1a');var _0xa51917=_0x35891d[_0xa427('0x1b')];var _0x5214f1=_0x58a80e?0x0:_0x376f1b['offset'];var _0x2ff0a3=_0x58a80e?_0x35891d[_0xa427('0x1b')]:_0x376f1b[_0xa427('0x19')]+_0x376f1b[_0xa427('0x1c')];var _0x427477;if(_0x2ff0a3>=_0xa51917){_0x2ff0a3=_0xa51917;_0x427477=0xc8;}else{_0x427477=0xce;}_0x4c775d[_0xa427('0x17')](_0x427477);return _0x4c775d[_0xa427('0x1d')]('Content-Range',_0x5214f1+'-'+_0x2ff0a3+'/'+_0xa51917)[_0xa427('0x1e')](_0x35891d);}return null;};}function patchUpdates(_0x3fd17e){return function(_0x27d155){try{jsonpatch[_0xa427('0x1f')](_0x27d155,_0x3fd17e,!![]);}catch(_0xb2e8e1){return BPromise[_0xa427('0x20')](_0xb2e8e1);}return _0x27d155[_0xa427('0x21')]();};}function saveUpdates(_0x30d9b5,_0x292f2e){return function(_0x1e53b5){if(_0x1e53b5){return _0x1e53b5[_0xa427('0x22')](_0x30d9b5)[_0xa427('0x23')](function(_0x23ab08){return _0x23ab08;});}return null;};}function removeEntity(_0x4f154d,_0x4667b3){return function(_0x4fcf34){if(_0x4fcf34){return _0x4fcf34[_0xa427('0x24')]()[_0xa427('0x23')](function(){_0x4f154d[_0xa427('0x17')](0xcc)[_0xa427('0x18')]();});}};}function handleEntityNotFound(_0x1e8db9,_0x52ad){return function(_0x4ab061){if(!_0x4ab061){_0x1e8db9[_0xa427('0x25')](0x194);}return _0x4ab061;};}function handleError(_0xb95a2,_0x35b5a7){_0x35b5a7=_0x35b5a7||0x1f4;return function(_0x1d05d4){logger[_0xa427('0x26')](_0x1d05d4[_0xa427('0x27')]);if(_0x1d05d4[_0xa427('0x28')]){delete _0x1d05d4[_0xa427('0x28')];}_0xb95a2[_0xa427('0x17')](_0x35b5a7)[_0xa427('0x29')](_0x1d05d4);};}exports[_0xa427('0x2a')]=function(_0x3638e3,_0x58b297){var _0x137583={},_0x27d537={},_0x103352={'count':0x0,'rows':[]};var _0x11221a=_[_0xa427('0x2b')](db[_0xa427('0x2c')]['rawAttributes'],function(_0x126404){return{'name':_0x126404[_0xa427('0x2d')],'type':_0x126404[_0xa427('0x2e')][_0xa427('0x2f')]};});_0x27d537[_0xa427('0x30')]=_[_0xa427('0x2b')](_0x11221a,_0xa427('0x28'));_0x27d537[_0xa427('0x31')]=_[_0xa427('0x32')](_0x3638e3['query']);_0x27d537[_0xa427('0x33')]=_[_0xa427('0x34')](_0x27d537[_0xa427('0x30')],_0x27d537[_0xa427('0x31')]);_0x137583[_0xa427('0x35')]=_[_0xa427('0x34')](_0x27d537[_0xa427('0x30')],qs[_0xa427('0x36')](_0x3638e3[_0xa427('0x31')][_0xa427('0x36')]));_0x137583[_0xa427('0x35')]=_0x137583['attributes']['length']?_0x137583['attributes']:_0x27d537['model'];if(!_0x3638e3[_0xa427('0x31')]['hasOwnProperty']('nolimit')){_0x137583['limit']=qs[_0xa427('0x1c')](_0x3638e3[_0xa427('0x31')]['limit']);_0x137583[_0xa427('0x19')]=qs['offset'](_0x3638e3[_0xa427('0x31')]['offset']);}_0x137583[_0xa427('0x37')]=qs[_0xa427('0x38')](_0x3638e3[_0xa427('0x31')][_0xa427('0x38')]);_0x137583['where']=qs['filters'](_[_0xa427('0x39')](_0x3638e3[_0xa427('0x31')],_0x27d537[_0xa427('0x33')]),_0x11221a);if(_0x3638e3[_0xa427('0x31')][_0xa427('0x3a')]){_0x137583[_0xa427('0x3b')]=_[_0xa427('0x3c')](_0x137583[_0xa427('0x3b')],{'$or':_[_0xa427('0x2b')](_0x11221a,function(_0x2039a0){if(_0x2039a0[_0xa427('0x2e')]!==_0xa427('0x3d')){var _0x1fc088={};_0x1fc088[_0x2039a0[_0xa427('0x28')]]={'$like':'%'+_0x3638e3['query'][_0xa427('0x3a')]+'%'};return _0x1fc088;}})});}_0x137583=_['merge']({},_0x137583,_0x3638e3[_0xa427('0x3e')]);var _0x1b387d={'where':_0x137583[_0xa427('0x3b')]};return db[_0xa427('0x2c')]['count'](_0x1b387d)[_0xa427('0x23')](function(_0x1efc0b){_0x103352[_0xa427('0x1b')]=_0x1efc0b;if(_0x3638e3['query'][_0xa427('0x3f')]){_0x137583[_0xa427('0x40')]=[{'all':!![]}];}return db[_0xa427('0x2c')][_0xa427('0x41')](_0x137583);})[_0xa427('0x23')](function(_0x22b3d3){_0x103352[_0xa427('0x42')]=_0x22b3d3;return _0x103352;})[_0xa427('0x23')](respondWithFilteredResult(_0x58b297,_0x137583))[_0xa427('0x43')](handleError(_0x58b297,null));};exports['show']=function(_0x57b50b,_0xdce4ef){var _0x450490={'raw':![],'where':{'id':_0x57b50b[_0xa427('0x44')]['id']}},_0x16332b={};_0x16332b['model']=_[_0xa427('0x32')](db['SugarcrmAccount'][_0xa427('0x45')]);_0x16332b['query']=_[_0xa427('0x32')](_0x57b50b['query']);_0x16332b[_0xa427('0x33')]=_[_0xa427('0x34')](_0x16332b[_0xa427('0x30')],_0x16332b['query']);_0x450490['attributes']=_[_0xa427('0x34')](_0x16332b[_0xa427('0x30')],qs['fields'](_0x57b50b[_0xa427('0x31')]['fields']));_0x450490[_0xa427('0x35')]=_0x450490['attributes'][_0xa427('0x46')]?_0x450490[_0xa427('0x35')]:_0x16332b[_0xa427('0x30')];if(_0x57b50b[_0xa427('0x31')][_0xa427('0x3f')]){_0x450490['include']=[{'all':!![]}];}_0x450490=_[_0xa427('0x3c')]({},_0x450490,_0x57b50b[_0xa427('0x3e')]);return db['SugarcrmAccount'][_0xa427('0x47')](_0x450490)[_0xa427('0x23')](handleEntityNotFound(_0xdce4ef,null))[_0xa427('0x23')](respondWithResult(_0xdce4ef,null))[_0xa427('0x43')](handleError(_0xdce4ef,null));};exports[_0xa427('0x48')]=function(_0x10a2ce,_0xbb569a){return db[_0xa427('0x2c')]['create'](_0x10a2ce[_0xa427('0x49')],{})[_0xa427('0x23')](respondWithResult(_0xbb569a,0xc9))[_0xa427('0x43')](handleError(_0xbb569a,null));};exports[_0xa427('0x22')]=function(_0x1360e2,_0x211d7b){if(_0x1360e2['body']['id']){delete _0x1360e2[_0xa427('0x49')]['id'];}return db['SugarcrmAccount'][_0xa427('0x47')]({'where':{'id':_0x1360e2[_0xa427('0x44')]['id']}})[_0xa427('0x23')](handleEntityNotFound(_0x211d7b,null))['then'](saveUpdates(_0x1360e2[_0xa427('0x49')],null))[_0xa427('0x23')](respondWithResult(_0x211d7b,null))[_0xa427('0x43')](handleError(_0x211d7b,null));};exports[_0xa427('0x24')]=function(_0x33f5a1,_0x4dce3c){return db[_0xa427('0x2c')]['find']({'where':{'id':_0x33f5a1['params']['id']}})[_0xa427('0x23')](handleEntityNotFound(_0x4dce3c,null))[_0xa427('0x23')](removeEntity(_0x4dce3c,null))[_0xa427('0x43')](handleError(_0x4dce3c,null));};exports[_0xa427('0x4a')]=function(_0x1d0d59,_0x1107d6,_0x185ecc){var _0x478f41={};var _0x2f42af={};var _0x3573c7;var _0x3ab1eb;return db[_0xa427('0x2c')][_0xa427('0x4b')]({'where':{'id':_0x1d0d59['params']['id']}})[_0xa427('0x23')](handleEntityNotFound(_0x1107d6,null))[_0xa427('0x23')](function(_0x477b97){if(_0x477b97){_0x3573c7=_0x477b97;_0x2f42af[_0xa427('0x30')]=_[_0xa427('0x32')](db[_0xa427('0x4c')][_0xa427('0x45')]);_0x2f42af['query']=_[_0xa427('0x32')](_0x1d0d59['query']);_0x2f42af[_0xa427('0x33')]=_[_0xa427('0x34')](_0x2f42af[_0xa427('0x30')],_0x2f42af['query']);_0x478f41[_0xa427('0x35')]=_['intersection'](_0x2f42af[_0xa427('0x30')],qs[_0xa427('0x36')](_0x1d0d59[_0xa427('0x31')]['fields']));_0x478f41[_0xa427('0x35')]=_0x478f41[_0xa427('0x35')][_0xa427('0x46')]?_0x478f41[_0xa427('0x35')]:_0x2f42af[_0xa427('0x30')];_0x478f41['order']=qs[_0xa427('0x38')](_0x1d0d59[_0xa427('0x31')]['sort']);_0x478f41['where']=qs[_0xa427('0x33')](_[_0xa427('0x39')](_0x1d0d59['query'],_0x2f42af[_0xa427('0x33')]));if(_0x1d0d59['query'][_0xa427('0x3a')]){_0x478f41[_0xa427('0x3b')]=_[_0xa427('0x3c')](_0x478f41['where'],{'$or':_[_0xa427('0x2b')](_0x478f41[_0xa427('0x35')],function(_0x26514b){var _0x11cb27={};_0x11cb27[_0x26514b]={'$like':'%'+_0x1d0d59[_0xa427('0x31')][_0xa427('0x3a')]+'%'};return _0x11cb27;})});}_0x478f41=_[_0xa427('0x3c')]({},_0x478f41,_0x1d0d59[_0xa427('0x3e')]);return _0x3573c7['getConfigurations'](_0x478f41);}})[_0xa427('0x23')](function(_0x7882a){if(_0x7882a){_0x3ab1eb=_0x7882a['length'];if(!_0x1d0d59[_0xa427('0x31')][_0xa427('0x4d')](_0xa427('0x4e'))){_0x478f41[_0xa427('0x1c')]=qs[_0xa427('0x1c')](_0x1d0d59[_0xa427('0x31')][_0xa427('0x1c')]);_0x478f41['offset']=qs[_0xa427('0x19')](_0x1d0d59[_0xa427('0x31')][_0xa427('0x19')]);}return _0x3573c7['getConfigurations'](_0x478f41);}})[_0xa427('0x23')](function(_0x4bb0a9){if(_0x4bb0a9){return _0x4bb0a9?{'count':_0x3ab1eb,'rows':_0x4bb0a9}:null;}})['then'](respondWithResult(_0x1107d6,null))[_0xa427('0x43')](handleError(_0x1107d6,null));};exports[_0xa427('0x4f')]=function(_0x17c21f,_0x2f7630,_0x1bacfe){if(_0x17c21f[_0xa427('0x49')]['id']){delete _0x17c21f[_0xa427('0x49')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x17c21f['params']['id']}})['then'](handleEntityNotFound(_0x2f7630,null))['then'](function(_0x41a8dc){if(_0x41a8dc){_0x17c21f['body'][_0xa427('0x50')]=_0x41a8dc['id'];_0x17c21f[_0xa427('0x49')][_0xa427('0x51')]=integrations[_0xa427('0x52')](_0x17c21f['body'][_0xa427('0x53')],_0x17c21f['body'][_0xa427('0x2e')]);_0x17c21f[_0xa427('0x49')][_0xa427('0x54')]=integrations[_0xa427('0x55')](_0x17c21f[_0xa427('0x49')][_0xa427('0x53')],_0x17c21f[_0xa427('0x49')][_0xa427('0x2e')]);return db[_0xa427('0x4c')]['create'](_0x17c21f['body'],{'include':[{'model':db[_0xa427('0x56')],'as':_0xa427('0x51')},{'model':db[_0xa427('0x56')],'as':_0xa427('0x54')}]});}return null;})[_0xa427('0x23')](respondWithResult(_0x2f7630,null))[_0xa427('0x43')](handleError(_0x2f7630,null));};exports[_0xa427('0x57')]=function(_0x26a044,_0x28a2f1,_0x16936e){var _0x27cbd0='';var _0x249b6f=['id','name',_0xa427('0x58'),_0xa427('0x59'),_0xa427('0x5a'),_0xa427('0x5b'),_0xa427('0x5c'),_0xa427('0x5d'),_0xa427('0x5e'),'parent_type',_0xa427('0x5f'),'direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x26a044[_0xa427('0x44')]['id']},'attributes':['id',_0xa427('0x60'),_0xa427('0x61'),_0xa427('0x62')]})[_0xa427('0x23')](handleEntityNotFound(_0x28a2f1,null))[_0xa427('0x23')](function(_0x562000){if(_0x562000){_0x27cbd0=_0x562000[_0xa427('0x62')];var _0x260e0a=_0x27cbd0[_0xa427('0x63')](-0x1);if(_0x260e0a==='/'){_0x27cbd0=_0x27cbd0[_0xa427('0x64')](0x0,_0x27cbd0[_0xa427('0x65')](_0x260e0a));}return rp({'method':_0xa427('0x66'),'uri':util[_0xa427('0x67')](_0xa427('0x68'),_0x27cbd0,_0xa427('0x69')),'json':!![],'form':{'method':'login','input_type':_0xa427('0x6a'),'response_type':'JSON','rest_data':JSON[_0xa427('0x6b')]({'user_auth':{'user_name':_0x562000[_0xa427('0x60')],'password':_0x562000[_0xa427('0x61')],'encryption':_0xa427('0x6c')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xa427('0x23')](function(_0x347735){if(_0x347735&&_0x347735['name']!==_0xa427('0x6d')&&_0x347735[_0xa427('0x28')]!==_0xa427('0x6e')){return rp({'method':'POST','uri':util[_0xa427('0x67')]('%s%s',_0x27cbd0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa427('0x6f'),'input_type':_0xa427('0x6a'),'response_type':_0xa427('0x6a'),'rest_data':JSON[_0xa427('0x6b')]({'session':_0x347735['id'],'module_name':_0xa427('0x70')})}})[_0xa427('0x23')](function(_0x4951f2){if(_0x4951f2){var _0x1bf69c=_[_0xa427('0x71')](_0x4951f2['module_fields']);_[_0xa427('0x72')](_0x1bf69c,function(_0x10e0d0){return _0x249b6f[_0xa427('0x73')](_0x10e0d0['name']);});return{'count':_0x1bf69c[_0xa427('0x46')],'rows':_[_0xa427('0x2b')](_0x1bf69c,function(_0x3011f2){return{'id':_0x3011f2[_0xa427('0x28')],'name':_0x3011f2[_0xa427('0x74')],'custom':_[_0xa427('0x75')](_0x3011f2['name'],'_c')?!![]:![],'options':_0x3011f2[_0xa427('0x3e')]?_[_0xa427('0x2b')](_['values'](_0x3011f2[_0xa427('0x3e')]),function(_0x582246){return{'name':_0x582246[_0xa427('0x76')],'value':_0x582246['name']};}):[]};})};}})[_0xa427('0x23')](respondWithResult(_0x28a2f1,null))['catch'](function(_0x42a47b){var _0x32564c=_0x26a044[_0xa427('0x31')][_0xa427('0x77')]?0x1f4:_0x42a47b['statusCode']||0x1f4;logger[_0xa427('0x26')](_0xa427('0x78'),_0xa427('0x57'),_0x32564c,JSON['stringify'](_0x42a47b));delete _0x42a47b[_0xa427('0x28')];if(_0x32564c===0x191){_0x32564c=0x190;}_0x28a2f1['status'](_0x32564c)[_0xa427('0x29')](_0x26a044[_0xa427('0x31')][_0xa427('0x77')]?{'message':_0xa427('0x79'),'statusCode':_0x42a47b[_0xa427('0x7a')]}:_0x42a47b);});}else{var _0x4ee39b=0x1f4;_0x28a2f1[_0xa427('0x17')](_0x4ee39b)[_0xa427('0x29')]({'message':_0xa427('0x79'),'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 326a166..6011240 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 _0x0121=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts'];(function(_0x4af0ee,_0x4ee461){var _0x507cd=function(_0x189f3f){while(--_0x189f3f){_0x4af0ee['push'](_0x4af0ee['shift']());}};_0x507cd(++_0x4ee461);}(_0x0121,0xf0));var _0x1012=function(_0x46207e,_0x18f70a){_0x46207e=_0x46207e-0x0;var _0x42c079=_0x0121[_0x46207e];return _0x42c079;};'use strict';var _=require(_0x1012('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1012('0x1'));var moment=require('moment');var BPromise=require(_0x1012('0x2'));var rp=require(_0x1012('0x3'));var fs=require('fs');var path=require(_0x1012('0x4'));var rimraf=require(_0x1012('0x5'));var config=require(_0x1012('0x6'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x1012('0x7'));module[_0x1012('0x8')]=function(_0x2aa9a1,_0x3cd288){return _0x2aa9a1[_0x1012('0x9')](_0x1012('0xa'),attributes,{'tableName':_0x1012('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6755=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_sugarcrm_accounts','lodash','util','api','moment'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0x6755,0x193));var _0x5675=function(_0x5c3041,_0x52423f){_0x5c3041=_0x5c3041-0x0;var _0x512168=_0x6755[_0x5c3041];return _0x512168;};'use strict';var _=require(_0x5675('0x0'));var util=require(_0x5675('0x1'));var logger=require('../../config/logger')(_0x5675('0x2'));var moment=require(_0x5675('0x3'));var BPromise=require('bluebird');var rp=require(_0x5675('0x4'));var fs=require('fs');var path=require(_0x5675('0x5'));var rimraf=require(_0x5675('0x6'));var config=require(_0x5675('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x5675('0x8'));module[_0x5675('0x9')]=function(_0x425a6c,_0x323b58){return _0x425a6c['define']('SugarcrmAccount',attributes,{'tableName':_0x5675('0xa'),'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 aef0401..601c0a7 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 _0xf57c=['code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','include','map','model','ShowSugarcrmAccount','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x49d2d7,_0x3762e4){var _0x27fdd6=function(_0x199049){while(--_0x199049){_0x49d2d7['push'](_0x49d2d7['shift']());}};_0x27fdd6(++_0x3762e4);}(_0xf57c,0x1eb));var _0xcf57=function(_0x1a7b8b,_0xe53a61){_0x1a7b8b=_0x1a7b8b-0x0;var _0x4e55f4=_0xf57c[_0x1a7b8b];return _0x4e55f4;};'use strict';var _=require('lodash');var util=require(_0xcf57('0x0'));var moment=require(_0xcf57('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf57('0x2'));var fs=require('fs');var Redis=require(_0xcf57('0x3'));var db=require(_0xcf57('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf57('0x5'))(_0xcf57('0x6'));var config=require(_0xcf57('0x7'));var jayson=require(_0xcf57('0x8'));var client=jayson[_0xcf57('0x9')][_0xcf57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f749d,_0x1f1a1b,_0x29adfe){return new BPromise(function(_0x4e9b25,_0x27384e){return client['request'](_0x3f749d,_0x29adfe)[_0xcf57('0xb')](function(_0x5c660f){logger[_0xcf57('0xc')](_0xcf57('0xd'),_0x1f1a1b,'request\x20sent');logger[_0xcf57('0xe')](_0xcf57('0xf'),_0x1f1a1b,_0xcf57('0x10'),JSON[_0xcf57('0x11')](_0x5c660f));if(_0x5c660f[_0xcf57('0x12')]){if(_0x5c660f['error'][_0xcf57('0x13')]===0x1f4){logger[_0xcf57('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f1a1b,_0x5c660f[_0xcf57('0x12')][_0xcf57('0x14')]);return _0x27384e(_0x5c660f['error'][_0xcf57('0x14')]);}logger[_0xcf57('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f1a1b,_0x5c660f[_0xcf57('0x12')][_0xcf57('0x14')]);return _0x4e9b25(_0x5c660f[_0xcf57('0x12')][_0xcf57('0x14')]);}else{logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1f1a1b,_0xcf57('0x10'));_0x4e9b25(_0x5c660f[_0xcf57('0x15')]['message']);}})[_0xcf57('0x16')](function(_0x163b5a){logger[_0xcf57('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x1f1a1b,_0x163b5a);_0x27384e(_0x163b5a);});});}exports[_0xcf57('0x17')]=function(_0x2c2721){var _0x5bd072=this;return new Promise(function(_0x519f4d,_0x1a0b5b){return db[_0xcf57('0x18')][_0xcf57('0x19')]({'raw':_0x2c2721[_0xcf57('0x1a')]?_0x2c2721[_0xcf57('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2c2721[_0xcf57('0x1a')]?_0x2c2721['options'][_0xcf57('0x1b')]||null:null,'attributes':_0x2c2721[_0xcf57('0x1a')]?_0x2c2721['options'][_0xcf57('0x1c')]||null:null,'limit':_0x2c2721[_0xcf57('0x1a')]?_0x2c2721[_0xcf57('0x1a')]['limit']||null:null,'include':_0x2c2721[_0xcf57('0x1a')]?_0x2c2721[_0xcf57('0x1a')][_0xcf57('0x1d')]?_[_0xcf57('0x1e')](_0x2c2721[_0xcf57('0x1a')][_0xcf57('0x1d')],function(_0x581646){return{'model':db[_0x581646[_0xcf57('0x1f')]],'as':_0x581646['as'],'attributes':_0x581646[_0xcf57('0x1c')],'include':_0x581646[_0xcf57('0x1d')]?_[_0xcf57('0x1e')](_0x581646[_0xcf57('0x1d')],function(_0x3b98c2){return{'model':db[_0x3b98c2[_0xcf57('0x1f')]],'as':_0x3b98c2['as'],'attributes':_0x3b98c2[_0xcf57('0x1c')],'include':_0x3b98c2['include']?_['map'](_0x3b98c2[_0xcf57('0x1d')],function(_0x2edce8){return{'model':db[_0x2edce8[_0xcf57('0x1f')]],'as':_0x2edce8['as'],'attributes':_0x2edce8[_0xcf57('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcf57('0xb')](function(_0x2d234a){logger['info'](_0xcf57('0x17'),_0x2c2721);logger[_0xcf57('0xe')]('GetSugarcrmAccount',_0x2c2721,JSON[_0xcf57('0x11')](_0x2d234a));_0x519f4d(_0x2d234a);})[_0xcf57('0x16')](function(_0x13b69a){logger[_0xcf57('0x12')](_0xcf57('0x17'),_0x13b69a[_0xcf57('0x14')],_0x2c2721);_0x1a0b5b(_0x5bd072[_0xcf57('0x12')](0x1f4,_0x13b69a[_0xcf57('0x14')]));});});};exports[_0xcf57('0x20')]=function(_0x589f16){var _0x5799d7=this;return new Promise(function(_0x2f49e1,_0x2d29bd){return db[_0xcf57('0x18')][_0xcf57('0x21')]({'raw':_0x589f16[_0xcf57('0x1a')]?_0x589f16[_0xcf57('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x589f16[_0xcf57('0x1a')]?_0x589f16[_0xcf57('0x1a')][_0xcf57('0x1b')]||null:null,'attributes':_0x589f16[_0xcf57('0x1a')]?_0x589f16['options'][_0xcf57('0x1c')]||null:null,'include':_0x589f16['options']?_0x589f16[_0xcf57('0x1a')]['include']?_[_0xcf57('0x1e')](_0x589f16[_0xcf57('0x1a')][_0xcf57('0x1d')],function(_0x4f4348){return{'model':db[_0x4f4348[_0xcf57('0x1f')]],'as':_0x4f4348['as'],'attributes':_0x4f4348[_0xcf57('0x1c')],'include':_0x4f4348['include']?_[_0xcf57('0x1e')](_0x4f4348[_0xcf57('0x1d')],function(_0x1f631d){return{'model':db[_0x1f631d[_0xcf57('0x1f')]],'as':_0x1f631d['as'],'attributes':_0x1f631d[_0xcf57('0x1c')],'include':_0x1f631d[_0xcf57('0x1d')]?_[_0xcf57('0x1e')](_0x1f631d[_0xcf57('0x1d')],function(_0x1b5193){return{'model':db[_0x1b5193[_0xcf57('0x1f')]],'as':_0x1b5193['as'],'attributes':_0x1b5193[_0xcf57('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xcf57('0xb')](function(_0x587060){logger[_0xcf57('0xc')]('ShowSugarcrmAccount',_0x589f16);logger[_0xcf57('0xe')]('ShowSugarcrmAccount',_0x589f16,JSON['stringify'](_0x587060));_0x2f49e1(_0x587060);})[_0xcf57('0x16')](function(_0xd44c4c){logger[_0xcf57('0x12')](_0xcf57('0x20'),_0xd44c4c[_0xcf57('0x14')],_0x589f16);_0x2d29bd(_0x5799d7[_0xcf57('0x12')](0x1f4,_0xd44c4c[_0xcf57('0x14')]));});});}; \ No newline at end of file +var _0x0899=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','include','map','model','debug','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x942de4,_0x4a08d5){var _0x25a6e9=function(_0x53d88a){while(--_0x53d88a){_0x942de4['push'](_0x942de4['shift']());}};_0x25a6e9(++_0x4a08d5);}(_0x0899,0x1b3));var _0x9089=function(_0x544362,_0xc31c04){_0x544362=_0x544362-0x0;var _0x5c12f9=_0x0899[_0x544362];return _0x5c12f9;};'use strict';var _=require(_0x9089('0x0'));var util=require(_0x9089('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9089('0x2'));var fs=require('fs');var Redis=require(_0x9089('0x3'));var db=require(_0x9089('0x4'))['db'];var utils=require(_0x9089('0x5'));var logger=require(_0x9089('0x6'))(_0x9089('0x7'));var config=require(_0x9089('0x8'));var jayson=require(_0x9089('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x366d65,_0x42cf13,_0x8f07ae){return new BPromise(function(_0x5e90cd,_0x41aa69){return client[_0x9089('0xa')](_0x366d65,_0x8f07ae)[_0x9089('0xb')](function(_0x419188){logger[_0x9089('0xc')](_0x9089('0xd'),_0x42cf13,_0x9089('0xe'));logger['debug'](_0x9089('0xf'),_0x42cf13,_0x9089('0xe'),JSON[_0x9089('0x10')](_0x419188));if(_0x419188[_0x9089('0x11')]){if(_0x419188['error']['code']===0x1f4){logger[_0x9089('0x11')](_0x9089('0xd'),_0x42cf13,_0x419188[_0x9089('0x11')]['message']);return _0x41aa69(_0x419188[_0x9089('0x11')]['message']);}logger[_0x9089('0x11')](_0x9089('0xd'),_0x42cf13,_0x419188[_0x9089('0x11')][_0x9089('0x12')]);return _0x5e90cd(_0x419188[_0x9089('0x11')][_0x9089('0x12')]);}else{logger[_0x9089('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x42cf13,_0x9089('0xe'));_0x5e90cd(_0x419188[_0x9089('0x13')]['message']);}})[_0x9089('0x14')](function(_0x3a753f){logger[_0x9089('0x11')](_0x9089('0xd'),_0x42cf13,_0x3a753f);_0x41aa69(_0x3a753f);});});}exports[_0x9089('0x15')]=function(_0x1af891){var _0x34dd69=this;return new Promise(function(_0x277385,_0x5a4e01){return db[_0x9089('0x16')]['findAll']({'raw':_0x1af891[_0x9089('0x17')]?_0x1af891[_0x9089('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1af891[_0x9089('0x17')]?_0x1af891[_0x9089('0x17')][_0x9089('0x18')]||null:null,'attributes':_0x1af891[_0x9089('0x17')]?_0x1af891[_0x9089('0x17')][_0x9089('0x19')]||null:null,'limit':_0x1af891[_0x9089('0x17')]?_0x1af891[_0x9089('0x17')]['limit']||null:null,'include':_0x1af891['options']?_0x1af891[_0x9089('0x17')][_0x9089('0x1a')]?_[_0x9089('0x1b')](_0x1af891[_0x9089('0x17')][_0x9089('0x1a')],function(_0x5ad254){return{'model':db[_0x5ad254[_0x9089('0x1c')]],'as':_0x5ad254['as'],'attributes':_0x5ad254[_0x9089('0x19')],'include':_0x5ad254['include']?_['map'](_0x5ad254[_0x9089('0x1a')],function(_0x1b73f0){return{'model':db[_0x1b73f0[_0x9089('0x1c')]],'as':_0x1b73f0['as'],'attributes':_0x1b73f0[_0x9089('0x19')],'include':_0x1b73f0[_0x9089('0x1a')]?_[_0x9089('0x1b')](_0x1b73f0[_0x9089('0x1a')],function(_0x1ac687){return{'model':db[_0x1ac687[_0x9089('0x1c')]],'as':_0x1ac687['as'],'attributes':_0x1ac687['attributes']};}):[]};}):[]};}):[]:[]})[_0x9089('0xb')](function(_0x58d177){logger[_0x9089('0xc')](_0x9089('0x15'),_0x1af891);logger[_0x9089('0x1d')](_0x9089('0x15'),_0x1af891,JSON[_0x9089('0x10')](_0x58d177));_0x277385(_0x58d177);})['catch'](function(_0x794a24){logger[_0x9089('0x11')](_0x9089('0x15'),_0x794a24[_0x9089('0x12')],_0x1af891);_0x5a4e01(_0x34dd69[_0x9089('0x11')](0x1f4,_0x794a24[_0x9089('0x12')]));});});};exports[_0x9089('0x1e')]=function(_0x519335){var _0x1d6c4c=this;return new Promise(function(_0x279dc9,_0x5c683a){return db['SugarcrmAccount'][_0x9089('0x1f')]({'raw':_0x519335['options']?_0x519335[_0x9089('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x519335['options']?_0x519335[_0x9089('0x17')][_0x9089('0x18')]||null:null,'attributes':_0x519335[_0x9089('0x17')]?_0x519335[_0x9089('0x17')][_0x9089('0x19')]||null:null,'include':_0x519335['options']?_0x519335['options']['include']?_[_0x9089('0x1b')](_0x519335[_0x9089('0x17')][_0x9089('0x1a')],function(_0x2a1689){return{'model':db[_0x2a1689['model']],'as':_0x2a1689['as'],'attributes':_0x2a1689[_0x9089('0x19')],'include':_0x2a1689[_0x9089('0x1a')]?_[_0x9089('0x1b')](_0x2a1689[_0x9089('0x1a')],function(_0x420b09){return{'model':db[_0x420b09[_0x9089('0x1c')]],'as':_0x420b09['as'],'attributes':_0x420b09[_0x9089('0x19')],'include':_0x420b09[_0x9089('0x1a')]?_[_0x9089('0x1b')](_0x420b09['include'],function(_0x168ea2){return{'model':db[_0x168ea2[_0x9089('0x1c')]],'as':_0x168ea2['as'],'attributes':_0x168ea2[_0x9089('0x19')]};}):[]};}):[]};}):[]:[]})[_0x9089('0xb')](function(_0x5195ac){logger[_0x9089('0xc')](_0x9089('0x1e'),_0x519335);logger['debug'](_0x9089('0x1e'),_0x519335,JSON['stringify'](_0x5195ac));_0x279dc9(_0x5195ac);})[_0x9089('0x14')](function(_0x303026){logger[_0x9089('0x11')](_0x9089('0x1e'),_0x303026[_0x9089('0x12')],_0x519335);_0x5c683a(_0x1d6c4c['error'](0x1f4,_0x303026[_0x9089('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index dca263d..e7f2a22 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 _0x6a73=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete'];(function(_0x786e9,_0x1a029){var _0x1f891b=function(_0x31ad7c){while(--_0x31ad7c){_0x786e9['push'](_0x786e9['shift']());}};_0x1f891b(++_0x1a029);}(_0x6a73,0xda));var _0x36a7=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x6a73[_0x560448];return _0x550276;};'use strict';var multer=require(_0x36a7('0x0'));var util=require('util');var path=require(_0x36a7('0x1'));var timeout=require(_0x36a7('0x2'));var express=require(_0x36a7('0x3'));var router=express[_0x36a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x36a7('0x5'));var interaction=require(_0x36a7('0x6'));var config=require('../../config/environment');var controller=require(_0x36a7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x36a7('0x8')](_0x36a7('0x9'),auth[_0x36a7('0xa')](),controller[_0x36a7('0xb')]);router[_0x36a7('0x8')](_0x36a7('0xc'),auth[_0x36a7('0xa')](),controller[_0x36a7('0xd')]);router[_0x36a7('0x8')](_0x36a7('0xe'),auth['isAuthenticated'](),controller[_0x36a7('0xf')]);router['get'](_0x36a7('0x10'),auth[_0x36a7('0xa')](),controller[_0x36a7('0x11')]);router[_0x36a7('0x12')]('/',auth[_0x36a7('0xa')](),controller['create']);router[_0x36a7('0x13')]('/:id',auth[_0x36a7('0xa')](),controller[_0x36a7('0x14')]);router[_0x36a7('0x15')](_0x36a7('0x9'),auth['isAuthenticated'](),controller[_0x36a7('0x16')]);module[_0x36a7('0x17')]=router; \ No newline at end of file +var _0xdafe=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','put','delete'];(function(_0x3333bb,_0x1df222){var _0x273d39=function(_0x5c411b){while(--_0x5c411b){_0x3333bb['push'](_0x3333bb['shift']());}};_0x273d39(++_0x1df222);}(_0xdafe,0xf2));var _0xedaf=function(_0x45f833,_0x3230e8){_0x45f833=_0x45f833-0x0;var _0x51a075=_0xdafe[_0x45f833];return _0x51a075;};'use strict';var multer=require(_0xedaf('0x0'));var util=require('util');var path=require(_0xedaf('0x1'));var timeout=require('connect-timeout');var express=require(_0xedaf('0x2'));var router=express[_0xedaf('0x3')]();var fs_extra=require(_0xedaf('0x4'));var auth=require(_0xedaf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xedaf('0x6'));var controller=require(_0xedaf('0x7'));router[_0xedaf('0x8')]('/',auth[_0xedaf('0x9')](),controller[_0xedaf('0xa')]);router[_0xedaf('0x8')](_0xedaf('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xedaf('0x8')](_0xedaf('0xc'),auth[_0xedaf('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xedaf('0xd')]);router[_0xedaf('0x8')](_0xedaf('0xe'),auth['isAuthenticated'](),controller[_0xedaf('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xedaf('0x10')]('/:id',auth[_0xedaf('0x9')](),controller['update']);router[_0xedaf('0x11')](_0xedaf('0xb'),auth[_0xedaf('0x9')](),controller[_0xedaf('0x12')]);module[_0xedaf('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e3c382e..580dbb1 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 _0x7ea1=['sequelize','exports','STRING'];(function(_0x6173fc,_0x32aadf){var _0x965fbe=function(_0x50d5b3){while(--_0x50d5b3){_0x6173fc['push'](_0x6173fc['shift']());}};_0x965fbe(++_0x32aadf);}(_0x7ea1,0x1cb));var _0x17ea=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x7ea1[_0x585133];return _0x18254a;};'use strict';var Sequelize=require(_0x17ea('0x0'));module[_0x17ea('0x1')]={'name':{'type':Sequelize[_0x17ea('0x2')]},'description':{'type':Sequelize[_0x17ea('0x2')]}}; \ No newline at end of file +var _0xdddd=['exports','STRING','sequelize'];(function(_0x43b601,_0x1fd0de){var _0x1384e6=function(_0x3464b3){while(--_0x3464b3){_0x43b601['push'](_0x43b601['shift']());}};_0x1384e6(++_0x1fd0de);}(_0xdddd,0x182));var _0xdddd=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xdddd[_0x4c260a];return _0x17bbdd;};'use strict';var Sequelize=require(_0xdddd('0x0'));module[_0xdddd('0x1')]={'name':{'type':Sequelize[_0xdddd('0x2')]},'description':{'type':Sequelize[_0xdddd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2034642..874730d 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 _0x9870=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','SugarcrmField','filter','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x9870,0x9d));var _0x0987=function(_0x14f397,_0x4d3e41){_0x14f397=_0x14f397-0x0;var _0x115696=_0x9870[_0x14f397];return _0x115696;};'use strict';var emlformat=require(_0x0987('0x0'));var rimraf=require(_0x0987('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0987('0x2'));var rp=require(_0x0987('0x3'));var moment=require(_0x0987('0x4'));var BPromise=require(_0x0987('0x5'));var Mustache=require('mustache');var util=require(_0x0987('0x6'));var path=require(_0x0987('0x7'));var sox=require(_0x0987('0x8'));var csv=require(_0x0987('0x9'));var ejs=require(_0x0987('0xa'));var fs=require('fs');var fs_extra=require(_0x0987('0xb'));var _=require(_0x0987('0xc'));var squel=require('squel');var crypto=require(_0x0987('0xd'));var jsforce=require(_0x0987('0xe'));var deskjs=require(_0x0987('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0987('0x10'));var Papa=require(_0x0987('0x11'));var Redis=require(_0x0987('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0987('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0987('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0987('0x15'));var config=require(_0x0987('0x16'));var licenseUtil=require(_0x0987('0x17'));var db=require(_0x0987('0x18'))['db'];function respondWithStatusCode(_0x2037c6,_0x450ac9){_0x450ac9=_0x450ac9||0xcc;return function(_0x102cc8){if(_0x102cc8){return _0x2037c6[_0x0987('0x19')](_0x450ac9);}return _0x2037c6[_0x0987('0x1a')](_0x450ac9)[_0x0987('0x1b')]();};}function respondWithResult(_0x2907c4,_0x4513d1){_0x4513d1=_0x4513d1||0xc8;return function(_0x1bdf2a){if(_0x1bdf2a){return _0x2907c4[_0x0987('0x1a')](_0x4513d1)[_0x0987('0x1c')](_0x1bdf2a);}};}function respondWithFilteredResult(_0x5ea91e,_0x5d0d16){return function(_0x1a4b96){if(_0x1a4b96){var _0x2e1e6a=typeof _0x5d0d16[_0x0987('0x1d')]===_0x0987('0x1e')&&typeof _0x5d0d16[_0x0987('0x1f')]==='undefined';var _0x44f698=_0x1a4b96[_0x0987('0x20')];var _0x4b780b=_0x2e1e6a?0x0:_0x5d0d16[_0x0987('0x1d')];var _0x4e479f=_0x2e1e6a?_0x1a4b96[_0x0987('0x20')]:_0x5d0d16[_0x0987('0x1d')]+_0x5d0d16[_0x0987('0x1f')];var _0x88982c;if(_0x4e479f>=_0x44f698){_0x4e479f=_0x44f698;_0x88982c=0xc8;}else{_0x88982c=0xce;}_0x5ea91e[_0x0987('0x1a')](_0x88982c);return _0x5ea91e['set'](_0x0987('0x21'),_0x4b780b+'-'+_0x4e479f+'/'+_0x44f698)['json'](_0x1a4b96);}return null;};}function patchUpdates(_0x35f070){return function(_0x1d0ed5){try{jsonpatch[_0x0987('0x22')](_0x1d0ed5,_0x35f070,!![]);}catch(_0x3577aa){return BPromise[_0x0987('0x23')](_0x3577aa);}return _0x1d0ed5['save']();};}function saveUpdates(_0xbd4c7,_0x35c3c1){return function(_0x314552){if(_0x314552){return _0x314552[_0x0987('0x24')](_0xbd4c7)[_0x0987('0x25')](function(_0x1a957c){return _0x1a957c;});}return null;};}function removeEntity(_0x572e48,_0x5aac14){return function(_0x5201c0){if(_0x5201c0){return _0x5201c0[_0x0987('0x26')]()['then'](function(){_0x572e48[_0x0987('0x1a')](0xcc)[_0x0987('0x1b')]();});}};}function handleEntityNotFound(_0x27bc98,_0x152a7){return function(_0x31c14a){if(!_0x31c14a){_0x27bc98[_0x0987('0x19')](0x194);}return _0x31c14a;};}function handleError(_0x277f70,_0x5667de){_0x5667de=_0x5667de||0x1f4;return function(_0x19976c){logger['error'](_0x19976c[_0x0987('0x27')]);if(_0x19976c[_0x0987('0x28')]){delete _0x19976c[_0x0987('0x28')];}_0x277f70['status'](_0x5667de)[_0x0987('0x29')](_0x19976c);};}exports[_0x0987('0x2a')]=function(_0x177b77,_0x4fa30c){var _0x1b29b1={},_0x4f586f={},_0x4be436={'count':0x0,'rows':[]};var _0x4be965=_['map'](db[_0x0987('0x2b')][_0x0987('0x2c')],function(_0x2d8d00){return{'name':_0x2d8d00[_0x0987('0x2d')],'type':_0x2d8d00[_0x0987('0x2e')][_0x0987('0x2f')]};});_0x4f586f[_0x0987('0x30')]=_['map'](_0x4be965,_0x0987('0x28'));_0x4f586f[_0x0987('0x31')]=_[_0x0987('0x32')](_0x177b77[_0x0987('0x31')]);_0x4f586f[_0x0987('0x33')]=_[_0x0987('0x34')](_0x4f586f[_0x0987('0x30')],_0x4f586f[_0x0987('0x31')]);_0x1b29b1[_0x0987('0x35')]=_['intersection'](_0x4f586f[_0x0987('0x30')],qs[_0x0987('0x36')](_0x177b77['query']['fields']));_0x1b29b1[_0x0987('0x35')]=_0x1b29b1[_0x0987('0x35')][_0x0987('0x37')]?_0x1b29b1[_0x0987('0x35')]:_0x4f586f[_0x0987('0x30')];if(!_0x177b77['query']['hasOwnProperty'](_0x0987('0x38'))){_0x1b29b1[_0x0987('0x1f')]=qs[_0x0987('0x1f')](_0x177b77['query'][_0x0987('0x1f')]);_0x1b29b1['offset']=qs[_0x0987('0x1d')](_0x177b77[_0x0987('0x31')][_0x0987('0x1d')]);}_0x1b29b1[_0x0987('0x39')]=qs[_0x0987('0x3a')](_0x177b77['query']['sort']);_0x1b29b1[_0x0987('0x3b')]=qs[_0x0987('0x33')](_[_0x0987('0x3c')](_0x177b77[_0x0987('0x31')],_0x4f586f[_0x0987('0x33')]),_0x4be965);if(_0x177b77['query']['filter']){_0x1b29b1[_0x0987('0x3b')]=_[_0x0987('0x3d')](_0x1b29b1[_0x0987('0x3b')],{'$or':_[_0x0987('0x3e')](_0x4be965,function(_0xb30854){if(_0xb30854['type']!==_0x0987('0x3f')){var _0x2a8aa9={};_0x2a8aa9[_0xb30854[_0x0987('0x28')]]={'$like':'%'+_0x177b77[_0x0987('0x31')]['filter']+'%'};return _0x2a8aa9;}})});}_0x1b29b1=_[_0x0987('0x3d')]({},_0x1b29b1,_0x177b77[_0x0987('0x40')]);var _0x5cf73f={'where':_0x1b29b1[_0x0987('0x3b')]};return db[_0x0987('0x2b')][_0x0987('0x20')](_0x5cf73f)['then'](function(_0x302bca){_0x4be436[_0x0987('0x20')]=_0x302bca;if(_0x177b77['query'][_0x0987('0x41')]){_0x1b29b1['include']=[{'all':!![]}];}return db[_0x0987('0x2b')][_0x0987('0x42')](_0x1b29b1);})['then'](function(_0x13e7fa){_0x4be436[_0x0987('0x43')]=_0x13e7fa;return _0x4be436;})['then'](respondWithFilteredResult(_0x4fa30c,_0x1b29b1))[_0x0987('0x44')](handleError(_0x4fa30c,null));};exports[_0x0987('0x45')]=function(_0xd4bd34,_0x43326f){var _0x71e2a1={'raw':![],'where':{'id':_0xd4bd34[_0x0987('0x46')]['id']}},_0x5e52b2={};_0x5e52b2[_0x0987('0x30')]=_['keys'](db['SugarcrmConfiguration'][_0x0987('0x2c')]);_0x5e52b2[_0x0987('0x31')]=_[_0x0987('0x32')](_0xd4bd34['query']);_0x5e52b2[_0x0987('0x33')]=_[_0x0987('0x34')](_0x5e52b2[_0x0987('0x30')],_0x5e52b2[_0x0987('0x31')]);_0x71e2a1[_0x0987('0x35')]=_['intersection'](_0x5e52b2[_0x0987('0x30')],qs['fields'](_0xd4bd34[_0x0987('0x31')][_0x0987('0x36')]));_0x71e2a1[_0x0987('0x35')]=_0x71e2a1[_0x0987('0x35')]['length']?_0x71e2a1[_0x0987('0x35')]:_0x5e52b2[_0x0987('0x30')];if(_0xd4bd34['query'][_0x0987('0x41')]){_0x71e2a1[_0x0987('0x47')]=[{'all':!![]}];}_0x71e2a1=_['merge']({},_0x71e2a1,_0xd4bd34['options']);return db[_0x0987('0x2b')][_0x0987('0x48')](_0x71e2a1)[_0x0987('0x25')](handleEntityNotFound(_0x43326f,null))[_0x0987('0x25')](respondWithResult(_0x43326f,null))[_0x0987('0x44')](handleError(_0x43326f,null));};exports[_0x0987('0x49')]=function(_0x1d56a9,_0x4a0327){return db[_0x0987('0x2b')][_0x0987('0x49')](_0x1d56a9[_0x0987('0x4a')],{})['then'](respondWithResult(_0x4a0327,0xc9))['catch'](handleError(_0x4a0327,null));};exports[_0x0987('0x24')]=function(_0x4fc99b,_0x2a0c3f){if(_0x4fc99b['body']['id']){delete _0x4fc99b['body']['id'];}return db[_0x0987('0x2b')][_0x0987('0x48')]({'where':{'id':_0x4fc99b[_0x0987('0x46')]['id']}})[_0x0987('0x25')](handleEntityNotFound(_0x2a0c3f,null))['then'](saveUpdates(_0x4fc99b[_0x0987('0x4a')],null))[_0x0987('0x25')](respondWithResult(_0x2a0c3f,null))[_0x0987('0x44')](handleError(_0x2a0c3f,null));};exports[_0x0987('0x26')]=function(_0x53fe6a,_0x263148){return db[_0x0987('0x2b')][_0x0987('0x48')]({'where':{'id':_0x53fe6a[_0x0987('0x46')]['id']}})['then'](handleEntityNotFound(_0x263148,null))['then'](removeEntity(_0x263148,null))[_0x0987('0x44')](handleError(_0x263148,null));};exports[_0x0987('0x4b')]=function(_0x389bbe,_0x412812,_0x54db2f){var _0x49ec97={};var _0x26c3d8={};var _0x835dc8;var _0x635de4;return db['SugarcrmConfiguration'][_0x0987('0x4c')]({'where':{'id':_0x389bbe[_0x0987('0x46')]['id']}})[_0x0987('0x25')](handleEntityNotFound(_0x412812,null))[_0x0987('0x25')](function(_0x4c9ef7){if(_0x4c9ef7){_0x835dc8=_0x4c9ef7;_0x26c3d8[_0x0987('0x30')]=_[_0x0987('0x32')](db[_0x0987('0x4d')][_0x0987('0x2c')]);_0x26c3d8['query']=_['keys'](_0x389bbe['query']);_0x26c3d8[_0x0987('0x33')]=_[_0x0987('0x34')](_0x26c3d8['model'],_0x26c3d8[_0x0987('0x31')]);_0x49ec97[_0x0987('0x35')]=_['intersection'](_0x26c3d8[_0x0987('0x30')],qs['fields'](_0x389bbe[_0x0987('0x31')]['fields']));_0x49ec97[_0x0987('0x35')]=_0x49ec97[_0x0987('0x35')][_0x0987('0x37')]?_0x49ec97[_0x0987('0x35')]:_0x26c3d8[_0x0987('0x30')];_0x49ec97[_0x0987('0x39')]=qs[_0x0987('0x3a')](_0x389bbe['query']['sort']);_0x49ec97[_0x0987('0x3b')]=qs[_0x0987('0x33')](_[_0x0987('0x3c')](_0x389bbe[_0x0987('0x31')],_0x26c3d8[_0x0987('0x33')]));if(_0x389bbe[_0x0987('0x31')][_0x0987('0x4e')]){_0x49ec97['where']=_[_0x0987('0x3d')](_0x49ec97[_0x0987('0x3b')],{'$or':_['map'](_0x49ec97[_0x0987('0x35')],function(_0x5b47f8){var _0x2777c8={};_0x2777c8[_0x5b47f8]={'$like':'%'+_0x389bbe[_0x0987('0x31')]['filter']+'%'};return _0x2777c8;})});}_0x49ec97=_['merge']({},_0x49ec97,_0x389bbe[_0x0987('0x40')]);return _0x835dc8[_0x0987('0x4b')](_0x49ec97);}})[_0x0987('0x25')](function(_0x47dcce){if(_0x47dcce){_0x635de4=_0x47dcce[_0x0987('0x37')];if(!_0x389bbe[_0x0987('0x31')][_0x0987('0x4f')](_0x0987('0x38'))){_0x49ec97[_0x0987('0x1f')]=qs['limit'](_0x389bbe[_0x0987('0x31')][_0x0987('0x1f')]);_0x49ec97[_0x0987('0x1d')]=qs['offset'](_0x389bbe[_0x0987('0x31')][_0x0987('0x1d')]);}return _0x835dc8[_0x0987('0x4b')](_0x49ec97);}})[_0x0987('0x25')](function(_0x182d64){if(_0x182d64){return _0x182d64?{'count':_0x635de4,'rows':_0x182d64}:null;}})[_0x0987('0x25')](respondWithResult(_0x412812,null))[_0x0987('0x44')](handleError(_0x412812,null));};exports[_0x0987('0x50')]=function(_0x2627ed,_0x20c832,_0x50f2f6){var _0x49cdf6={};var _0x5a3ada={};var _0x28372e;var _0x7783d0;return db[_0x0987('0x2b')][_0x0987('0x4c')]({'where':{'id':_0x2627ed['params']['id']}})[_0x0987('0x25')](handleEntityNotFound(_0x20c832,null))[_0x0987('0x25')](function(_0x25d36b){if(_0x25d36b){_0x28372e=_0x25d36b;_0x5a3ada['model']=_[_0x0987('0x32')](db[_0x0987('0x4d')][_0x0987('0x2c')]);_0x5a3ada[_0x0987('0x31')]=_[_0x0987('0x32')](_0x2627ed['query']);_0x5a3ada['filters']=_['intersection'](_0x5a3ada[_0x0987('0x30')],_0x5a3ada[_0x0987('0x31')]);_0x49cdf6['attributes']=_[_0x0987('0x34')](_0x5a3ada[_0x0987('0x30')],qs[_0x0987('0x36')](_0x2627ed[_0x0987('0x31')]['fields']));_0x49cdf6[_0x0987('0x35')]=_0x49cdf6[_0x0987('0x35')][_0x0987('0x37')]?_0x49cdf6['attributes']:_0x5a3ada[_0x0987('0x30')];_0x49cdf6['order']=qs[_0x0987('0x3a')](_0x2627ed[_0x0987('0x31')]['sort']);_0x49cdf6[_0x0987('0x3b')]=qs[_0x0987('0x33')](_[_0x0987('0x3c')](_0x2627ed[_0x0987('0x31')],_0x5a3ada['filters']));if(_0x2627ed[_0x0987('0x31')][_0x0987('0x4e')]){_0x49cdf6[_0x0987('0x3b')]=_[_0x0987('0x3d')](_0x49cdf6[_0x0987('0x3b')],{'$or':_['map'](_0x49cdf6[_0x0987('0x35')],function(_0x2582b6){var _0x5a2b5b={};_0x5a2b5b[_0x2582b6]={'$like':'%'+_0x2627ed[_0x0987('0x31')]['filter']+'%'};return _0x5a2b5b;})});}_0x49cdf6=_[_0x0987('0x3d')]({},_0x49cdf6,_0x2627ed[_0x0987('0x40')]);return _0x28372e[_0x0987('0x50')](_0x49cdf6);}})['then'](function(_0x21852c){if(_0x21852c){_0x7783d0=_0x21852c[_0x0987('0x37')];if(!_0x2627ed[_0x0987('0x31')][_0x0987('0x4f')](_0x0987('0x38'))){_0x49cdf6[_0x0987('0x1f')]=qs[_0x0987('0x1f')](_0x2627ed['query'][_0x0987('0x1f')]);_0x49cdf6[_0x0987('0x1d')]=qs[_0x0987('0x1d')](_0x2627ed[_0x0987('0x31')][_0x0987('0x1d')]);}return _0x28372e['getSubjects'](_0x49cdf6);}})['then'](function(_0x17fc1e){if(_0x17fc1e){return _0x17fc1e?{'count':_0x7783d0,'rows':_0x17fc1e}:null;}})[_0x0987('0x25')](respondWithResult(_0x20c832,null))[_0x0987('0x44')](handleError(_0x20c832,null));};exports[_0x0987('0x51')]=function(_0x5b7d55,_0x353ef3,_0x228f04){var _0x5c4179={};var _0x1f8f08={};var _0x3dfef5;var _0x1366ff;return db[_0x0987('0x2b')][_0x0987('0x4c')]({'where':{'id':_0x5b7d55['params']['id']}})[_0x0987('0x25')](handleEntityNotFound(_0x353ef3,null))[_0x0987('0x25')](function(_0x1e7714){if(_0x1e7714){_0x3dfef5=_0x1e7714;_0x1f8f08[_0x0987('0x30')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x1f8f08[_0x0987('0x31')]=_[_0x0987('0x32')](_0x5b7d55[_0x0987('0x31')]);_0x1f8f08[_0x0987('0x33')]=_[_0x0987('0x34')](_0x1f8f08[_0x0987('0x30')],_0x1f8f08[_0x0987('0x31')]);_0x5c4179[_0x0987('0x35')]=_['intersection'](_0x1f8f08[_0x0987('0x30')],qs[_0x0987('0x36')](_0x5b7d55[_0x0987('0x31')][_0x0987('0x36')]));_0x5c4179['attributes']=_0x5c4179[_0x0987('0x35')]['length']?_0x5c4179[_0x0987('0x35')]:_0x1f8f08['model'];_0x5c4179[_0x0987('0x39')]=qs[_0x0987('0x3a')](_0x5b7d55[_0x0987('0x31')][_0x0987('0x3a')]);_0x5c4179[_0x0987('0x3b')]=qs['filters'](_[_0x0987('0x3c')](_0x5b7d55[_0x0987('0x31')],_0x1f8f08[_0x0987('0x33')]));if(_0x5b7d55[_0x0987('0x31')][_0x0987('0x4e')]){_0x5c4179[_0x0987('0x3b')]=_[_0x0987('0x3d')](_0x5c4179[_0x0987('0x3b')],{'$or':_['map'](_0x5c4179[_0x0987('0x35')],function(_0x2e8f6b){var _0x238fa7={};_0x238fa7[_0x2e8f6b]={'$like':'%'+_0x5b7d55[_0x0987('0x31')][_0x0987('0x4e')]+'%'};return _0x238fa7;})});}_0x5c4179=_[_0x0987('0x3d')]({},_0x5c4179,_0x5b7d55[_0x0987('0x40')]);return _0x3dfef5[_0x0987('0x51')](_0x5c4179);}})[_0x0987('0x25')](function(_0x4d0053){if(_0x4d0053){_0x1366ff=_0x4d0053['length'];if(!_0x5b7d55[_0x0987('0x31')][_0x0987('0x4f')]('nolimit')){_0x5c4179[_0x0987('0x1f')]=qs[_0x0987('0x1f')](_0x5b7d55['query'][_0x0987('0x1f')]);_0x5c4179[_0x0987('0x1d')]=qs['offset'](_0x5b7d55['query']['offset']);}return _0x3dfef5[_0x0987('0x51')](_0x5c4179);}})[_0x0987('0x25')](function(_0x4a8eb5){if(_0x4a8eb5){return _0x4a8eb5?{'count':_0x1366ff,'rows':_0x4a8eb5}:null;}})['then'](respondWithResult(_0x353ef3,null))[_0x0987('0x44')](handleError(_0x353ef3,null));}; \ No newline at end of file +var _0x76d8=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','update','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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(_0x5af81e,_0x3a0d0b){var _0x198f7c=function(_0x39269c){while(--_0x39269c){_0x5af81e['push'](_0x5af81e['shift']());}};_0x198f7c(++_0x3a0d0b);}(_0x76d8,0x8c));var _0x876d=function(_0x65a3fe,_0xaec92e){_0x65a3fe=_0x65a3fe-0x0;var _0xc27db8=_0x76d8[_0x65a3fe];return _0xc27db8;};'use strict';var emlformat=require(_0x876d('0x0'));var rimraf=require(_0x876d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x876d('0x2'));var rp=require(_0x876d('0x3'));var moment=require(_0x876d('0x4'));var BPromise=require(_0x876d('0x5'));var Mustache=require(_0x876d('0x6'));var util=require(_0x876d('0x7'));var path=require('path');var sox=require(_0x876d('0x8'));var csv=require(_0x876d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x876d('0xa'));var crypto=require(_0x876d('0xb'));var jsforce=require(_0x876d('0xc'));var deskjs=require(_0x876d('0xd'));var toCsv=require(_0x876d('0x9'));var querystring=require(_0x876d('0xe'));var Papa=require(_0x876d('0xf'));var Redis=require(_0x876d('0x10'));var authService=require(_0x876d('0x11'));var qs=require(_0x876d('0x12'));var as=require(_0x876d('0x13'));var hardwareService=require(_0x876d('0x14'));var logger=require(_0x876d('0x15'))(_0x876d('0x16'));var utils=require(_0x876d('0x17'));var config=require(_0x876d('0x18'));var licenseUtil=require(_0x876d('0x19'));var db=require(_0x876d('0x1a'))['db'];function respondWithStatusCode(_0x12dda5,_0x2778bd){_0x2778bd=_0x2778bd||0xcc;return function(_0x4b04e7){if(_0x4b04e7){return _0x12dda5[_0x876d('0x1b')](_0x2778bd);}return _0x12dda5[_0x876d('0x1c')](_0x2778bd)[_0x876d('0x1d')]();};}function respondWithResult(_0x4604d5,_0x348755){_0x348755=_0x348755||0xc8;return function(_0x355153){if(_0x355153){return _0x4604d5[_0x876d('0x1c')](_0x348755)[_0x876d('0x1e')](_0x355153);}};}function respondWithFilteredResult(_0x33cdbb,_0x3eea70){return function(_0x261a8e){if(_0x261a8e){var _0x392b35=typeof _0x3eea70['offset']===_0x876d('0x1f')&&typeof _0x3eea70[_0x876d('0x20')]===_0x876d('0x1f');var _0x13ac31=_0x261a8e[_0x876d('0x21')];var _0x2c6be2=_0x392b35?0x0:_0x3eea70[_0x876d('0x22')];var _0x52f392=_0x392b35?_0x261a8e['count']:_0x3eea70[_0x876d('0x22')]+_0x3eea70[_0x876d('0x20')];var _0x3efa19;if(_0x52f392>=_0x13ac31){_0x52f392=_0x13ac31;_0x3efa19=0xc8;}else{_0x3efa19=0xce;}_0x33cdbb[_0x876d('0x1c')](_0x3efa19);return _0x33cdbb[_0x876d('0x23')]('Content-Range',_0x2c6be2+'-'+_0x52f392+'/'+_0x13ac31)[_0x876d('0x1e')](_0x261a8e);}return null;};}function patchUpdates(_0x582cfe){return function(_0x44cfbc){try{jsonpatch['apply'](_0x44cfbc,_0x582cfe,!![]);}catch(_0x21e951){return BPromise[_0x876d('0x24')](_0x21e951);}return _0x44cfbc['save']();};}function saveUpdates(_0x142eea,_0x1a9373){return function(_0x4764c6){if(_0x4764c6){return _0x4764c6[_0x876d('0x25')](_0x142eea)['then'](function(_0x11ff0b){return _0x11ff0b;});}return null;};}function removeEntity(_0x10b00c,_0x45e877){return function(_0x5883b4){if(_0x5883b4){return _0x5883b4[_0x876d('0x26')]()[_0x876d('0x27')](function(){_0x10b00c['status'](0xcc)[_0x876d('0x1d')]();});}};}function handleEntityNotFound(_0x4ee368,_0x31671d){return function(_0x58dd38){if(!_0x58dd38){_0x4ee368[_0x876d('0x1b')](0x194);}return _0x58dd38;};}function handleError(_0x22c727,_0x1d3a11){_0x1d3a11=_0x1d3a11||0x1f4;return function(_0x58ff92){logger[_0x876d('0x28')](_0x58ff92[_0x876d('0x29')]);if(_0x58ff92[_0x876d('0x2a')]){delete _0x58ff92[_0x876d('0x2a')];}_0x22c727['status'](_0x1d3a11)[_0x876d('0x2b')](_0x58ff92);};}exports[_0x876d('0x2c')]=function(_0x1b8bda,_0x5bfbc7){var _0x4da7ae={},_0x25e0e6={},_0x2fda9c={'count':0x0,'rows':[]};var _0x44cf44=_[_0x876d('0x2d')](db[_0x876d('0x2e')]['rawAttributes'],function(_0x2134bb){return{'name':_0x2134bb['fieldName'],'type':_0x2134bb[_0x876d('0x2f')][_0x876d('0x30')]};});_0x25e0e6[_0x876d('0x31')]=_[_0x876d('0x2d')](_0x44cf44,_0x876d('0x2a'));_0x25e0e6[_0x876d('0x32')]=_[_0x876d('0x33')](_0x1b8bda[_0x876d('0x32')]);_0x25e0e6[_0x876d('0x34')]=_[_0x876d('0x35')](_0x25e0e6[_0x876d('0x31')],_0x25e0e6['query']);_0x4da7ae['attributes']=_[_0x876d('0x35')](_0x25e0e6[_0x876d('0x31')],qs['fields'](_0x1b8bda[_0x876d('0x32')][_0x876d('0x36')]));_0x4da7ae[_0x876d('0x37')]=_0x4da7ae[_0x876d('0x37')][_0x876d('0x38')]?_0x4da7ae[_0x876d('0x37')]:_0x25e0e6[_0x876d('0x31')];if(!_0x1b8bda[_0x876d('0x32')][_0x876d('0x39')](_0x876d('0x3a'))){_0x4da7ae[_0x876d('0x20')]=qs[_0x876d('0x20')](_0x1b8bda[_0x876d('0x32')][_0x876d('0x20')]);_0x4da7ae[_0x876d('0x22')]=qs[_0x876d('0x22')](_0x1b8bda[_0x876d('0x32')]['offset']);}_0x4da7ae[_0x876d('0x3b')]=qs[_0x876d('0x3c')](_0x1b8bda[_0x876d('0x32')][_0x876d('0x3c')]);_0x4da7ae[_0x876d('0x3d')]=qs[_0x876d('0x34')](_[_0x876d('0x3e')](_0x1b8bda[_0x876d('0x32')],_0x25e0e6[_0x876d('0x34')]),_0x44cf44);if(_0x1b8bda[_0x876d('0x32')]['filter']){_0x4da7ae['where']=_[_0x876d('0x3f')](_0x4da7ae[_0x876d('0x3d')],{'$or':_[_0x876d('0x2d')](_0x44cf44,function(_0x3a7a96){if(_0x3a7a96['type']!==_0x876d('0x40')){var _0x1d2334={};_0x1d2334[_0x3a7a96[_0x876d('0x2a')]]={'$like':'%'+_0x1b8bda[_0x876d('0x32')][_0x876d('0x41')]+'%'};return _0x1d2334;}})});}_0x4da7ae=_[_0x876d('0x3f')]({},_0x4da7ae,_0x1b8bda[_0x876d('0x42')]);var _0x50700b={'where':_0x4da7ae[_0x876d('0x3d')]};return db[_0x876d('0x2e')][_0x876d('0x21')](_0x50700b)[_0x876d('0x27')](function(_0x558662){_0x2fda9c[_0x876d('0x21')]=_0x558662;if(_0x1b8bda[_0x876d('0x32')][_0x876d('0x43')]){_0x4da7ae['include']=[{'all':!![]}];}return db[_0x876d('0x2e')][_0x876d('0x44')](_0x4da7ae);})[_0x876d('0x27')](function(_0x48887c){_0x2fda9c[_0x876d('0x45')]=_0x48887c;return _0x2fda9c;})[_0x876d('0x27')](respondWithFilteredResult(_0x5bfbc7,_0x4da7ae))[_0x876d('0x46')](handleError(_0x5bfbc7,null));};exports[_0x876d('0x47')]=function(_0x1ee245,_0x51b5b8){var _0x36b0f4={'raw':![],'where':{'id':_0x1ee245[_0x876d('0x48')]['id']}},_0x560d2b={};_0x560d2b[_0x876d('0x31')]=_['keys'](db[_0x876d('0x2e')][_0x876d('0x49')]);_0x560d2b[_0x876d('0x32')]=_['keys'](_0x1ee245[_0x876d('0x32')]);_0x560d2b[_0x876d('0x34')]=_[_0x876d('0x35')](_0x560d2b[_0x876d('0x31')],_0x560d2b[_0x876d('0x32')]);_0x36b0f4[_0x876d('0x37')]=_[_0x876d('0x35')](_0x560d2b[_0x876d('0x31')],qs[_0x876d('0x36')](_0x1ee245[_0x876d('0x32')][_0x876d('0x36')]));_0x36b0f4[_0x876d('0x37')]=_0x36b0f4[_0x876d('0x37')][_0x876d('0x38')]?_0x36b0f4[_0x876d('0x37')]:_0x560d2b['model'];if(_0x1ee245['query'][_0x876d('0x43')]){_0x36b0f4[_0x876d('0x4a')]=[{'all':!![]}];}_0x36b0f4=_[_0x876d('0x3f')]({},_0x36b0f4,_0x1ee245[_0x876d('0x42')]);return db[_0x876d('0x2e')][_0x876d('0x4b')](_0x36b0f4)['then'](handleEntityNotFound(_0x51b5b8,null))[_0x876d('0x27')](respondWithResult(_0x51b5b8,null))[_0x876d('0x46')](handleError(_0x51b5b8,null));};exports[_0x876d('0x4c')]=function(_0x5ef73a,_0x574fe2){return db['SugarcrmConfiguration'][_0x876d('0x4c')](_0x5ef73a[_0x876d('0x4d')],{})[_0x876d('0x27')](respondWithResult(_0x574fe2,0xc9))[_0x876d('0x46')](handleError(_0x574fe2,null));};exports['update']=function(_0xb725cc,_0x31afee){if(_0xb725cc[_0x876d('0x4d')]['id']){delete _0xb725cc['body']['id'];}return db[_0x876d('0x2e')][_0x876d('0x4b')]({'where':{'id':_0xb725cc[_0x876d('0x48')]['id']}})[_0x876d('0x27')](handleEntityNotFound(_0x31afee,null))[_0x876d('0x27')](saveUpdates(_0xb725cc[_0x876d('0x4d')],null))[_0x876d('0x27')](respondWithResult(_0x31afee,null))[_0x876d('0x46')](handleError(_0x31afee,null));};exports[_0x876d('0x26')]=function(_0x2dd1cb,_0x17f922){return db[_0x876d('0x2e')]['find']({'where':{'id':_0x2dd1cb['params']['id']}})['then'](handleEntityNotFound(_0x17f922,null))[_0x876d('0x27')](removeEntity(_0x17f922,null))['catch'](handleError(_0x17f922,null));};exports[_0x876d('0x4e')]=function(_0x598e92,_0x7f267,_0x2ddf58){var _0x30db9f={};var _0x1ecc20={};var _0x30dfdc;var _0x4c55ea;return db[_0x876d('0x2e')][_0x876d('0x4f')]({'where':{'id':_0x598e92['params']['id']}})[_0x876d('0x27')](handleEntityNotFound(_0x7f267,null))[_0x876d('0x27')](function(_0x32ac61){if(_0x32ac61){_0x30dfdc=_0x32ac61;_0x1ecc20[_0x876d('0x31')]=_[_0x876d('0x33')](db[_0x876d('0x50')][_0x876d('0x49')]);_0x1ecc20[_0x876d('0x32')]=_[_0x876d('0x33')](_0x598e92[_0x876d('0x32')]);_0x1ecc20[_0x876d('0x34')]=_['intersection'](_0x1ecc20[_0x876d('0x31')],_0x1ecc20[_0x876d('0x32')]);_0x30db9f[_0x876d('0x37')]=_['intersection'](_0x1ecc20['model'],qs[_0x876d('0x36')](_0x598e92[_0x876d('0x32')][_0x876d('0x36')]));_0x30db9f[_0x876d('0x37')]=_0x30db9f[_0x876d('0x37')]['length']?_0x30db9f[_0x876d('0x37')]:_0x1ecc20[_0x876d('0x31')];_0x30db9f[_0x876d('0x3b')]=qs['sort'](_0x598e92[_0x876d('0x32')]['sort']);_0x30db9f[_0x876d('0x3d')]=qs[_0x876d('0x34')](_[_0x876d('0x3e')](_0x598e92[_0x876d('0x32')],_0x1ecc20[_0x876d('0x34')]));if(_0x598e92[_0x876d('0x32')][_0x876d('0x41')]){_0x30db9f['where']=_[_0x876d('0x3f')](_0x30db9f['where'],{'$or':_[_0x876d('0x2d')](_0x30db9f[_0x876d('0x37')],function(_0x43d7f4){var _0x53b173={};_0x53b173[_0x43d7f4]={'$like':'%'+_0x598e92[_0x876d('0x32')][_0x876d('0x41')]+'%'};return _0x53b173;})});}_0x30db9f=_[_0x876d('0x3f')]({},_0x30db9f,_0x598e92[_0x876d('0x42')]);return _0x30dfdc[_0x876d('0x4e')](_0x30db9f);}})['then'](function(_0x5f16f6){if(_0x5f16f6){_0x4c55ea=_0x5f16f6[_0x876d('0x38')];if(!_0x598e92['query']['hasOwnProperty'](_0x876d('0x3a'))){_0x30db9f[_0x876d('0x20')]=qs[_0x876d('0x20')](_0x598e92[_0x876d('0x32')][_0x876d('0x20')]);_0x30db9f[_0x876d('0x22')]=qs[_0x876d('0x22')](_0x598e92[_0x876d('0x32')][_0x876d('0x22')]);}return _0x30dfdc[_0x876d('0x4e')](_0x30db9f);}})[_0x876d('0x27')](function(_0xa7cfce){if(_0xa7cfce){return _0xa7cfce?{'count':_0x4c55ea,'rows':_0xa7cfce}:null;}})[_0x876d('0x27')](respondWithResult(_0x7f267,null))[_0x876d('0x46')](handleError(_0x7f267,null));};exports[_0x876d('0x51')]=function(_0x2f5533,_0x354df2,_0x54ff5b){var _0x493c22={};var _0x3cc7da={};var _0xecfd22;var _0x4e10cd;return db[_0x876d('0x2e')][_0x876d('0x4f')]({'where':{'id':_0x2f5533[_0x876d('0x48')]['id']}})[_0x876d('0x27')](handleEntityNotFound(_0x354df2,null))[_0x876d('0x27')](function(_0x5495e4){if(_0x5495e4){_0xecfd22=_0x5495e4;_0x3cc7da[_0x876d('0x31')]=_[_0x876d('0x33')](db[_0x876d('0x50')][_0x876d('0x49')]);_0x3cc7da[_0x876d('0x32')]=_[_0x876d('0x33')](_0x2f5533[_0x876d('0x32')]);_0x3cc7da['filters']=_['intersection'](_0x3cc7da[_0x876d('0x31')],_0x3cc7da[_0x876d('0x32')]);_0x493c22['attributes']=_[_0x876d('0x35')](_0x3cc7da[_0x876d('0x31')],qs[_0x876d('0x36')](_0x2f5533['query'][_0x876d('0x36')]));_0x493c22['attributes']=_0x493c22[_0x876d('0x37')][_0x876d('0x38')]?_0x493c22['attributes']:_0x3cc7da[_0x876d('0x31')];_0x493c22[_0x876d('0x3b')]=qs['sort'](_0x2f5533[_0x876d('0x32')][_0x876d('0x3c')]);_0x493c22[_0x876d('0x3d')]=qs[_0x876d('0x34')](_[_0x876d('0x3e')](_0x2f5533[_0x876d('0x32')],_0x3cc7da[_0x876d('0x34')]));if(_0x2f5533[_0x876d('0x32')][_0x876d('0x41')]){_0x493c22['where']=_[_0x876d('0x3f')](_0x493c22['where'],{'$or':_['map'](_0x493c22[_0x876d('0x37')],function(_0x2a6b78){var _0x3f9838={};_0x3f9838[_0x2a6b78]={'$like':'%'+_0x2f5533[_0x876d('0x32')][_0x876d('0x41')]+'%'};return _0x3f9838;})});}_0x493c22=_[_0x876d('0x3f')]({},_0x493c22,_0x2f5533[_0x876d('0x42')]);return _0xecfd22[_0x876d('0x51')](_0x493c22);}})[_0x876d('0x27')](function(_0x4f4615){if(_0x4f4615){_0x4e10cd=_0x4f4615[_0x876d('0x38')];if(!_0x2f5533[_0x876d('0x32')]['hasOwnProperty'](_0x876d('0x3a'))){_0x493c22[_0x876d('0x20')]=qs['limit'](_0x2f5533[_0x876d('0x32')][_0x876d('0x20')]);_0x493c22[_0x876d('0x22')]=qs[_0x876d('0x22')](_0x2f5533[_0x876d('0x32')][_0x876d('0x22')]);}return _0xecfd22['getSubjects'](_0x493c22);}})[_0x876d('0x27')](function(_0x1466da){if(_0x1466da){return _0x1466da?{'count':_0x4e10cd,'rows':_0x1466da}:null;}})[_0x876d('0x27')](respondWithResult(_0x354df2,null))[_0x876d('0x46')](handleError(_0x354df2,null));};exports[_0x876d('0x52')]=function(_0x541748,_0x542d7b,_0x1b5390){var _0x409e17={};var _0x3be47a={};var _0x293f30;var _0x11778a;return db[_0x876d('0x2e')][_0x876d('0x4f')]({'where':{'id':_0x541748[_0x876d('0x48')]['id']}})[_0x876d('0x27')](handleEntityNotFound(_0x542d7b,null))[_0x876d('0x27')](function(_0x2c78c1){if(_0x2c78c1){_0x293f30=_0x2c78c1;_0x3be47a[_0x876d('0x31')]=_[_0x876d('0x33')](db[_0x876d('0x50')][_0x876d('0x49')]);_0x3be47a[_0x876d('0x32')]=_[_0x876d('0x33')](_0x541748[_0x876d('0x32')]);_0x3be47a['filters']=_[_0x876d('0x35')](_0x3be47a[_0x876d('0x31')],_0x3be47a[_0x876d('0x32')]);_0x409e17['attributes']=_[_0x876d('0x35')](_0x3be47a['model'],qs[_0x876d('0x36')](_0x541748[_0x876d('0x32')][_0x876d('0x36')]));_0x409e17[_0x876d('0x37')]=_0x409e17[_0x876d('0x37')]['length']?_0x409e17['attributes']:_0x3be47a[_0x876d('0x31')];_0x409e17[_0x876d('0x3b')]=qs['sort'](_0x541748['query'][_0x876d('0x3c')]);_0x409e17['where']=qs[_0x876d('0x34')](_[_0x876d('0x3e')](_0x541748[_0x876d('0x32')],_0x3be47a[_0x876d('0x34')]));if(_0x541748[_0x876d('0x32')][_0x876d('0x41')]){_0x409e17[_0x876d('0x3d')]=_[_0x876d('0x3f')](_0x409e17[_0x876d('0x3d')],{'$or':_['map'](_0x409e17[_0x876d('0x37')],function(_0x1f370f){var _0x219971={};_0x219971[_0x1f370f]={'$like':'%'+_0x541748['query'][_0x876d('0x41')]+'%'};return _0x219971;})});}_0x409e17=_['merge']({},_0x409e17,_0x541748[_0x876d('0x42')]);return _0x293f30[_0x876d('0x52')](_0x409e17);}})[_0x876d('0x27')](function(_0x4ee991){if(_0x4ee991){_0x11778a=_0x4ee991[_0x876d('0x38')];if(!_0x541748['query'][_0x876d('0x39')](_0x876d('0x3a'))){_0x409e17[_0x876d('0x20')]=qs[_0x876d('0x20')](_0x541748[_0x876d('0x32')][_0x876d('0x20')]);_0x409e17[_0x876d('0x22')]=qs['offset'](_0x541748[_0x876d('0x32')][_0x876d('0x22')]);}return _0x293f30[_0x876d('0x52')](_0x409e17);}})['then'](function(_0x494e53){if(_0x494e53){return _0x494e53?{'count':_0x11778a,'rows':_0x494e53}:null;}})[_0x876d('0x27')](respondWithResult(_0x542d7b,null))['catch'](handleError(_0x542d7b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 623a266..e4f24f8 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 _0x0124=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','api'];(function(_0x142236,_0xbde10b){var _0x2b75ce=function(_0x34eb49){while(--_0x34eb49){_0x142236['push'](_0x142236['shift']());}};_0x2b75ce(++_0xbde10b);}(_0x0124,0x196));var _0x4012=function(_0x12df52,_0x4dddf5){_0x12df52=_0x12df52-0x0;var _0x228658=_0x0124[_0x12df52];return _0x228658;};'use strict';var _=require(_0x4012('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4012('0x1'));var moment=require(_0x4012('0x2'));var BPromise=require(_0x4012('0x3'));var rp=require(_0x4012('0x4'));var fs=require('fs');var path=require(_0x4012('0x5'));var rimraf=require(_0x4012('0x6'));var config=require('../../config/environment');var attributes=require(_0x4012('0x7'));module[_0x4012('0x8')]=function(_0x1f0671,_0x4f5268){return _0x1f0671[_0x4012('0x9')](_0x4012('0xa'),attributes,{'tableName':_0x4012('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc10f=['int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','define','SugarcrmConfiguration'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc10f,0xa1));var _0xfc10=function(_0xcf25ce,_0xbab315){_0xcf25ce=_0xcf25ce-0x0;var _0x31fb66=_0xc10f[_0xcf25ce];return _0x31fb66;};'use strict';var _=require(_0xfc10('0x0'));var util=require(_0xfc10('0x1'));var logger=require('../../config/logger')(_0xfc10('0x2'));var moment=require(_0xfc10('0x3'));var BPromise=require(_0xfc10('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc10('0x5'));var rimraf=require('rimraf');var config=require(_0xfc10('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x1c5211,_0x3d3315){return _0x1c5211[_0xfc10('0x7')](_0xfc10('0x8'),attributes,{'tableName':_0xfc10('0x9'),'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 d2a8b7f..64a3244 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 _0xa579=['jayson/promise','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0xa579,0x9e));var _0x9a57=function(_0x39fd13,_0x14a809){_0x39fd13=_0x39fd13-0x0;var _0x26fe50=_0xa579[_0x39fd13];return _0x26fe50;};'use strict';var _=require(_0x9a57('0x0'));var util=require(_0x9a57('0x1'));var moment=require(_0x9a57('0x2'));var BPromise=require(_0x9a57('0x3'));var rs=require(_0x9a57('0x4'));var fs=require('fs');var Redis=require(_0x9a57('0x5'));var db=require(_0x9a57('0x6'))['db'];var utils=require(_0x9a57('0x7'));var logger=require(_0x9a57('0x8'))(_0x9a57('0x9'));var config=require('../../config/environment');var jayson=require(_0x9a57('0xa'));var client=jayson[_0x9a57('0xb')][_0x9a57('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x759610,_0x431407,_0x6cb084){return new BPromise(function(_0x57c65b,_0x440ea5){return client[_0x9a57('0xd')](_0x759610,_0x6cb084)['then'](function(_0x4723f3){logger[_0x9a57('0xe')](_0x9a57('0xf'),_0x431407,_0x9a57('0x10'));logger[_0x9a57('0x11')](_0x9a57('0x12'),_0x431407,_0x9a57('0x10'),JSON[_0x9a57('0x13')](_0x4723f3));if(_0x4723f3['error']){if(_0x4723f3[_0x9a57('0x14')][_0x9a57('0x15')]===0x1f4){logger[_0x9a57('0x14')](_0x9a57('0xf'),_0x431407,_0x4723f3[_0x9a57('0x14')]['message']);return _0x440ea5(_0x4723f3[_0x9a57('0x14')][_0x9a57('0x16')]);}logger[_0x9a57('0x14')](_0x9a57('0xf'),_0x431407,_0x4723f3[_0x9a57('0x14')][_0x9a57('0x16')]);return _0x57c65b(_0x4723f3[_0x9a57('0x14')]['message']);}else{logger[_0x9a57('0xe')](_0x9a57('0xf'),_0x431407,'request\x20sent');_0x57c65b(_0x4723f3['result'][_0x9a57('0x16')]);}})[_0x9a57('0x17')](function(_0x5f1824){logger[_0x9a57('0x14')](_0x9a57('0xf'),_0x431407,_0x5f1824);_0x440ea5(_0x5f1824);});});} \ No newline at end of file +var _0x209e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','request\x20sent','debug','stringify','code','error','message','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x4ba4f0,_0x24f5d5){var _0x44f544=function(_0x154132){while(--_0x154132){_0x4ba4f0['push'](_0x4ba4f0['shift']());}};_0x44f544(++_0x24f5d5);}(_0x209e,0x1d0));var _0xe209=function(_0x2edfe8,_0x7f92fc){_0x2edfe8=_0x2edfe8-0x0;var _0x4de55a=_0x209e[_0x2edfe8];return _0x4de55a;};'use strict';var _=require(_0xe209('0x0'));var util=require(_0xe209('0x1'));var moment=require(_0xe209('0x2'));var BPromise=require(_0xe209('0x3'));var rs=require(_0xe209('0x4'));var fs=require('fs');var Redis=require(_0xe209('0x5'));var db=require(_0xe209('0x6'))['db'];var utils=require(_0xe209('0x7'));var logger=require(_0xe209('0x8'))('rpc');var config=require(_0xe209('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe209('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x719c5a,_0x4c53dd,_0x178b56){return new BPromise(function(_0x1c269e,_0x1d3bce){return client[_0xe209('0xb')](_0x719c5a,_0x178b56)['then'](function(_0x30d9f0){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c53dd,_0xe209('0xc'));logger[_0xe209('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4c53dd,'request\x20sent',JSON[_0xe209('0xe')](_0x30d9f0));if(_0x30d9f0['error']){if(_0x30d9f0['error'][_0xe209('0xf')]===0x1f4){logger[_0xe209('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c53dd,_0x30d9f0[_0xe209('0x10')][_0xe209('0x11')]);return _0x1d3bce(_0x30d9f0[_0xe209('0x10')]['message']);}logger[_0xe209('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c53dd,_0x30d9f0['error'][_0xe209('0x11')]);return _0x1c269e(_0x30d9f0['error'][_0xe209('0x11')]);}else{logger[_0xe209('0x12')](_0xe209('0x13'),_0x4c53dd,_0xe209('0xc'));_0x1c269e(_0x30d9f0[_0xe209('0x14')][_0xe209('0x11')]);}})[_0xe209('0x15')](function(_0x19d4ea){logger[_0xe209('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4c53dd,_0x19d4ea);_0x1d3bce(_0x19d4ea);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 076318d..258f4cc 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 _0x911b=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create'];(function(_0x240890,_0x4dd373){var _0x4de2f3=function(_0x321d6d){while(--_0x321d6d){_0x240890['push'](_0x240890['shift']());}};_0x4de2f3(++_0x4dd373);}(_0x911b,0x12b));var _0xb911=function(_0x1ca7bc,_0x2038b5){_0x1ca7bc=_0x1ca7bc-0x0;var _0x1d03d7=_0x911b[_0x1ca7bc];return _0x1d03d7;};'use strict';var multer=require(_0xb911('0x0'));var util=require(_0xb911('0x1'));var path=require(_0xb911('0x2'));var timeout=require('connect-timeout');var express=require(_0xb911('0x3'));var router=express[_0xb911('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb911('0x5'));var interaction=require(_0xb911('0x6'));var config=require(_0xb911('0x7'));var controller=require(_0xb911('0x8'));router['get']('/',auth[_0xb911('0x9')](),controller[_0xb911('0xa')]);router[_0xb911('0xb')](_0xb911('0xc'),auth[_0xb911('0x9')](),controller[_0xb911('0xd')]);router[_0xb911('0xe')]('/',auth['isAuthenticated'](),controller[_0xb911('0xf')]);router[_0xb911('0x10')](_0xb911('0xc'),auth['isAuthenticated'](),controller[_0xb911('0x11')]);router[_0xb911('0x12')](_0xb911('0xc'),auth[_0xb911('0x9')](),controller[_0xb911('0x13')]);module[_0xb911('0x14')]=router; \ No newline at end of file +var _0xca6b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca6b,0x18c));var _0xbca6=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xca6b[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0xbca6('0x0'));var path=require(_0xbca6('0x1'));var timeout=require(_0xbca6('0x2'));var express=require(_0xbca6('0x3'));var router=express[_0xbca6('0x4')]();var fs_extra=require(_0xbca6('0x5'));var auth=require(_0xbca6('0x6'));var interaction=require(_0xbca6('0x7'));var config=require('../../config/environment');var controller=require(_0xbca6('0x8'));router[_0xbca6('0x9')]('/',auth[_0xbca6('0xa')](),controller[_0xbca6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbca6('0xc')]);router[_0xbca6('0xd')]('/',auth[_0xbca6('0xa')](),controller['create']);router[_0xbca6('0xe')](_0xbca6('0xf'),auth['isAuthenticated'](),controller[_0xbca6('0x10')]);router[_0xbca6('0x11')](_0xbca6('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xbca6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 37d2500..6a3ae02 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 _0xb1dc=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3385d6,_0xed7d89){var _0x52c88f=function(_0x2fdf2b){while(--_0x2fdf2b){_0x3385d6['push'](_0x3385d6['shift']());}};_0x52c88f(++_0xed7d89);}(_0xb1dc,0x136));var _0xcb1d=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xb1dc[_0x1d87fc];return _0x492b56;};'use strict';var Sequelize=require(_0xcb1d('0x0'));module[_0xcb1d('0x1')]={'type':{'type':Sequelize[_0xcb1d('0x2')](_0xcb1d('0x3'),'variable',_0xcb1d('0x4'),_0xcb1d('0x5'),_0xcb1d('0x6')),'defaultValue':_0xcb1d('0x3')},'content':{'type':Sequelize[_0xcb1d('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcb1d('0x2')]('string',_0xcb1d('0x8'),_0xcb1d('0x4'))},'keyContent':{'type':Sequelize[_0xcb1d('0x7')]},'idField':{'type':Sequelize[_0xcb1d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcb1d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb1d('0x7')]}}; \ No newline at end of file +var _0xf659=['BOOLEAN','sequelize','exports','customVariable','keyValue','picklist','STRING','ENUM','string','variable'];(function(_0x108122,_0x56abc4){var _0x2ad479=function(_0x2d05ba){while(--_0x2d05ba){_0x108122['push'](_0x108122['shift']());}};_0x2ad479(++_0x56abc4);}(_0xf659,0xa1));var _0x9f65=function(_0x1bbc82,_0xe5f9e1){_0x1bbc82=_0x1bbc82-0x0;var _0xa4e7d2=_0xf659[_0x1bbc82];return _0xa4e7d2;};'use strict';var Sequelize=require(_0x9f65('0x0'));module[_0x9f65('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x9f65('0x2'),_0x9f65('0x3'),_0x9f65('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9f65('0x5')]},'key':{'type':Sequelize[_0x9f65('0x5')]},'keyType':{'type':Sequelize[_0x9f65('0x6')](_0x9f65('0x7'),_0x9f65('0x8'),_0x9f65('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9f65('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9f65('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9f65('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 6816d50..417c894 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 _0x1ba3=['index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SugarcrmField','includeAll','include','rows','catch','show','keys','length','options','create','body','find','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send'];(function(_0x6b5ef6,_0xcb431a){var _0x2aaf2c=function(_0x4fefc8){while(--_0x4fefc8){_0x6b5ef6['push'](_0x6b5ef6['shift']());}};_0x2aaf2c(++_0xcb431a);}(_0x1ba3,0x1a7));var _0x31ba=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x1ba3[_0x2f62aa];return _0x1a341f;};'use strict';var emlformat=require(_0x31ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31ba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31ba('0x2'));var moment=require(_0x31ba('0x3'));var BPromise=require(_0x31ba('0x4'));var Mustache=require(_0x31ba('0x5'));var util=require(_0x31ba('0x6'));var path=require(_0x31ba('0x7'));var sox=require(_0x31ba('0x8'));var csv=require(_0x31ba('0x9'));var ejs=require(_0x31ba('0xa'));var fs=require('fs');var fs_extra=require(_0x31ba('0xb'));var _=require(_0x31ba('0xc'));var squel=require('squel');var crypto=require(_0x31ba('0xd'));var jsforce=require(_0x31ba('0xe'));var deskjs=require(_0x31ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0x31ba('0x10'));var Papa=require(_0x31ba('0x11'));var Redis=require(_0x31ba('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x31ba('0x13'));var as=require(_0x31ba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31ba('0x15'))(_0x31ba('0x16'));var utils=require(_0x31ba('0x17'));var config=require(_0x31ba('0x18'));var licenseUtil=require(_0x31ba('0x19'));var db=require(_0x31ba('0x1a'))['db'];function respondWithStatusCode(_0x35b2c8,_0x22401b){_0x22401b=_0x22401b||0xcc;return function(_0x37f9b2){if(_0x37f9b2){return _0x35b2c8[_0x31ba('0x1b')](_0x22401b);}return _0x35b2c8[_0x31ba('0x1c')](_0x22401b)[_0x31ba('0x1d')]();};}function respondWithResult(_0xc5f81f,_0x2f8c0b){_0x2f8c0b=_0x2f8c0b||0xc8;return function(_0x99a627){if(_0x99a627){return _0xc5f81f[_0x31ba('0x1c')](_0x2f8c0b)[_0x31ba('0x1e')](_0x99a627);}};}function respondWithFilteredResult(_0x4e74b9,_0x44e2ed){return function(_0x117ff6){if(_0x117ff6){var _0x1b7fd0=typeof _0x44e2ed[_0x31ba('0x1f')]===_0x31ba('0x20')&&typeof _0x44e2ed[_0x31ba('0x21')]===_0x31ba('0x20');var _0x47ab25=_0x117ff6[_0x31ba('0x22')];var _0x5123b3=_0x1b7fd0?0x0:_0x44e2ed[_0x31ba('0x1f')];var _0x225088=_0x1b7fd0?_0x117ff6[_0x31ba('0x22')]:_0x44e2ed[_0x31ba('0x1f')]+_0x44e2ed[_0x31ba('0x21')];var _0x5c313b;if(_0x225088>=_0x47ab25){_0x225088=_0x47ab25;_0x5c313b=0xc8;}else{_0x5c313b=0xce;}_0x4e74b9[_0x31ba('0x1c')](_0x5c313b);return _0x4e74b9['set'](_0x31ba('0x23'),_0x5123b3+'-'+_0x225088+'/'+_0x47ab25)[_0x31ba('0x1e')](_0x117ff6);}return null;};}function patchUpdates(_0x4683b0){return function(_0x3cfd44){try{jsonpatch[_0x31ba('0x24')](_0x3cfd44,_0x4683b0,!![]);}catch(_0x47cb56){return BPromise[_0x31ba('0x25')](_0x47cb56);}return _0x3cfd44[_0x31ba('0x26')]();};}function saveUpdates(_0x3de98c,_0x2f21e0){return function(_0x4d7e2b){if(_0x4d7e2b){return _0x4d7e2b[_0x31ba('0x27')](_0x3de98c)[_0x31ba('0x28')](function(_0x37f1d1){return _0x37f1d1;});}return null;};}function removeEntity(_0x597f5b,_0x482617){return function(_0x937784){if(_0x937784){return _0x937784[_0x31ba('0x29')]()[_0x31ba('0x28')](function(){_0x597f5b[_0x31ba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c548a,_0xcb0557){return function(_0x274cfb){if(!_0x274cfb){_0x1c548a[_0x31ba('0x1b')](0x194);}return _0x274cfb;};}function handleError(_0x27650d,_0x4a0a9c){_0x4a0a9c=_0x4a0a9c||0x1f4;return function(_0x74e4c){logger[_0x31ba('0x2a')](_0x74e4c['stack']);if(_0x74e4c[_0x31ba('0x2b')]){delete _0x74e4c[_0x31ba('0x2b')];}_0x27650d['status'](_0x4a0a9c)[_0x31ba('0x2c')](_0x74e4c);};}exports[_0x31ba('0x2d')]=function(_0x40f0e9,_0x52caad){var _0x1217b8={},_0x5258e3={},_0x1318f0={'count':0x0,'rows':[]};var _0xd1e6ca=_[_0x31ba('0x2e')](db['SugarcrmField'][_0x31ba('0x2f')],function(_0x380db4){return{'name':_0x380db4[_0x31ba('0x30')],'type':_0x380db4['type'][_0x31ba('0x31')]};});_0x5258e3[_0x31ba('0x32')]=_['map'](_0xd1e6ca,_0x31ba('0x2b'));_0x5258e3[_0x31ba('0x33')]=_['keys'](_0x40f0e9[_0x31ba('0x33')]);_0x5258e3[_0x31ba('0x34')]=_[_0x31ba('0x35')](_0x5258e3[_0x31ba('0x32')],_0x5258e3[_0x31ba('0x33')]);_0x1217b8['attributes']=_[_0x31ba('0x35')](_0x5258e3[_0x31ba('0x32')],qs[_0x31ba('0x36')](_0x40f0e9['query'][_0x31ba('0x36')]));_0x1217b8[_0x31ba('0x37')]=_0x1217b8[_0x31ba('0x37')]['length']?_0x1217b8[_0x31ba('0x37')]:_0x5258e3[_0x31ba('0x32')];if(!_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x38')](_0x31ba('0x39'))){_0x1217b8[_0x31ba('0x21')]=qs[_0x31ba('0x21')](_0x40f0e9[_0x31ba('0x33')]['limit']);_0x1217b8['offset']=qs['offset'](_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x1f')]);}_0x1217b8[_0x31ba('0x3a')]=qs[_0x31ba('0x3b')](_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x3b')]);_0x1217b8[_0x31ba('0x3c')]=qs[_0x31ba('0x34')](_['pick'](_0x40f0e9[_0x31ba('0x33')],_0x5258e3[_0x31ba('0x34')]),_0xd1e6ca);if(_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x3d')]){_0x1217b8[_0x31ba('0x3c')]=_[_0x31ba('0x3e')](_0x1217b8[_0x31ba('0x3c')],{'$or':_[_0x31ba('0x2e')](_0xd1e6ca,function(_0x31e42a){if(_0x31e42a[_0x31ba('0x3f')]!==_0x31ba('0x40')){var _0x590100={};_0x590100[_0x31e42a[_0x31ba('0x2b')]]={'$like':'%'+_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x3d')]+'%'};return _0x590100;}})});}_0x1217b8=_[_0x31ba('0x3e')]({},_0x1217b8,_0x40f0e9['options']);var _0x5460a2={'where':_0x1217b8[_0x31ba('0x3c')]};return db[_0x31ba('0x41')]['count'](_0x5460a2)['then'](function(_0xe68eaf){_0x1318f0['count']=_0xe68eaf;if(_0x40f0e9[_0x31ba('0x33')][_0x31ba('0x42')]){_0x1217b8[_0x31ba('0x43')]=[{'all':!![]}];}return db[_0x31ba('0x41')]['findAll'](_0x1217b8);})[_0x31ba('0x28')](function(_0x4b09a2){_0x1318f0[_0x31ba('0x44')]=_0x4b09a2;return _0x1318f0;})[_0x31ba('0x28')](respondWithFilteredResult(_0x52caad,_0x1217b8))[_0x31ba('0x45')](handleError(_0x52caad,null));};exports[_0x31ba('0x46')]=function(_0x5d5b3b,_0x1f6f5e){var _0x336883={'raw':!![],'where':{'id':_0x5d5b3b['params']['id']}},_0x37d600={};_0x37d600['model']=_['keys'](db[_0x31ba('0x41')][_0x31ba('0x2f')]);_0x37d600[_0x31ba('0x33')]=_[_0x31ba('0x47')](_0x5d5b3b[_0x31ba('0x33')]);_0x37d600[_0x31ba('0x34')]=_[_0x31ba('0x35')](_0x37d600[_0x31ba('0x32')],_0x37d600[_0x31ba('0x33')]);_0x336883['attributes']=_['intersection'](_0x37d600['model'],qs[_0x31ba('0x36')](_0x5d5b3b[_0x31ba('0x33')]['fields']));_0x336883['attributes']=_0x336883[_0x31ba('0x37')][_0x31ba('0x48')]?_0x336883[_0x31ba('0x37')]:_0x37d600[_0x31ba('0x32')];if(_0x5d5b3b[_0x31ba('0x33')][_0x31ba('0x42')]){_0x336883['include']=[{'all':!![]}];}_0x336883=_[_0x31ba('0x3e')]({},_0x336883,_0x5d5b3b[_0x31ba('0x49')]);return db[_0x31ba('0x41')]['find'](_0x336883)[_0x31ba('0x28')](handleEntityNotFound(_0x1f6f5e,null))[_0x31ba('0x28')](respondWithResult(_0x1f6f5e,null))[_0x31ba('0x45')](handleError(_0x1f6f5e,null));};exports['create']=function(_0xa384a,_0x2d3242){return db[_0x31ba('0x41')][_0x31ba('0x4a')](_0xa384a[_0x31ba('0x4b')],{})[_0x31ba('0x28')](respondWithResult(_0x2d3242,0xc9))[_0x31ba('0x45')](handleError(_0x2d3242,null));};exports[_0x31ba('0x27')]=function(_0x266e17,_0x2a2c67){if(_0x266e17[_0x31ba('0x4b')]['id']){delete _0x266e17[_0x31ba('0x4b')]['id'];}return db[_0x31ba('0x41')][_0x31ba('0x4c')]({'where':{'id':_0x266e17[_0x31ba('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2a2c67,null))[_0x31ba('0x28')](saveUpdates(_0x266e17[_0x31ba('0x4b')],null))[_0x31ba('0x28')](respondWithResult(_0x2a2c67,null))[_0x31ba('0x45')](handleError(_0x2a2c67,null));};exports[_0x31ba('0x29')]=function(_0x54f067,_0x4668dc){return db[_0x31ba('0x41')]['find']({'where':{'id':_0x54f067[_0x31ba('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4668dc,null))[_0x31ba('0x28')](removeEntity(_0x4668dc,null))[_0x31ba('0x45')](handleError(_0x4668dc,null));}; \ No newline at end of file +var _0x2f13=['order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','SugarcrmField','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','limit','undefined','count','offset','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x3c9fcf,_0x4f639f){var _0x26d6a5=function(_0x352d4c){while(--_0x352d4c){_0x3c9fcf['push'](_0x3c9fcf['shift']());}};_0x26d6a5(++_0x4f639f);}(_0x2f13,0xee));var _0x32f1=function(_0x244cef,_0x32c413){_0x244cef=_0x244cef-0x0;var _0x304d32=_0x2f13[_0x244cef];return _0x304d32;};'use strict';var emlformat=require(_0x32f1('0x0'));var rimraf=require(_0x32f1('0x1'));var zipdir=require(_0x32f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x32f1('0x3'));var moment=require(_0x32f1('0x4'));var BPromise=require(_0x32f1('0x5'));var Mustache=require(_0x32f1('0x6'));var util=require(_0x32f1('0x7'));var path=require('path');var sox=require(_0x32f1('0x8'));var csv=require(_0x32f1('0x9'));var ejs=require(_0x32f1('0xa'));var fs=require('fs');var fs_extra=require(_0x32f1('0xb'));var _=require(_0x32f1('0xc'));var squel=require(_0x32f1('0xd'));var crypto=require('crypto');var jsforce=require(_0x32f1('0xe'));var deskjs=require(_0x32f1('0xf'));var toCsv=require(_0x32f1('0x9'));var querystring=require(_0x32f1('0x10'));var Papa=require('papaparse');var Redis=require(_0x32f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x32f1('0x12'));var as=require(_0x32f1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x32f1('0x14'));var utils=require('../../config/utils');var config=require(_0x32f1('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b9d85,_0x1279ca){_0x1279ca=_0x1279ca||0xcc;return function(_0x8e3362){if(_0x8e3362){return _0x2b9d85['sendStatus'](_0x1279ca);}return _0x2b9d85[_0x32f1('0x16')](_0x1279ca)[_0x32f1('0x17')]();};}function respondWithResult(_0x35bbee,_0x39f6e1){_0x39f6e1=_0x39f6e1||0xc8;return function(_0x3ac758){if(_0x3ac758){return _0x35bbee[_0x32f1('0x16')](_0x39f6e1)['json'](_0x3ac758);}};}function respondWithFilteredResult(_0x3ece00,_0x30552d){return function(_0x439548){if(_0x439548){var _0x1fa32e=typeof _0x30552d['offset']==='undefined'&&typeof _0x30552d[_0x32f1('0x18')]===_0x32f1('0x19');var _0x10e0aa=_0x439548[_0x32f1('0x1a')];var _0x58bdc2=_0x1fa32e?0x0:_0x30552d[_0x32f1('0x1b')];var _0x44c224=_0x1fa32e?_0x439548[_0x32f1('0x1a')]:_0x30552d[_0x32f1('0x1b')]+_0x30552d[_0x32f1('0x18')];var _0x2b6864;if(_0x44c224>=_0x10e0aa){_0x44c224=_0x10e0aa;_0x2b6864=0xc8;}else{_0x2b6864=0xce;}_0x3ece00['status'](_0x2b6864);return _0x3ece00[_0x32f1('0x1c')]('Content-Range',_0x58bdc2+'-'+_0x44c224+'/'+_0x10e0aa)['json'](_0x439548);}return null;};}function patchUpdates(_0x37841){return function(_0x4ddf57){try{jsonpatch[_0x32f1('0x1d')](_0x4ddf57,_0x37841,!![]);}catch(_0x41a83b){return BPromise[_0x32f1('0x1e')](_0x41a83b);}return _0x4ddf57[_0x32f1('0x1f')]();};}function saveUpdates(_0x3c48dc,_0x10bca5){return function(_0x417aab){if(_0x417aab){return _0x417aab[_0x32f1('0x20')](_0x3c48dc)['then'](function(_0x1f9dae){return _0x1f9dae;});}return null;};}function removeEntity(_0x432097,_0x3218a8){return function(_0x50c89d){if(_0x50c89d){return _0x50c89d[_0x32f1('0x21')]()[_0x32f1('0x22')](function(){_0x432097[_0x32f1('0x16')](0xcc)[_0x32f1('0x17')]();});}};}function handleEntityNotFound(_0x30ef76,_0x1c496c){return function(_0x57eaf4){if(!_0x57eaf4){_0x30ef76[_0x32f1('0x23')](0x194);}return _0x57eaf4;};}function handleError(_0x48c57e,_0x4afbdf){_0x4afbdf=_0x4afbdf||0x1f4;return function(_0x1ad822){logger[_0x32f1('0x24')](_0x1ad822[_0x32f1('0x25')]);if(_0x1ad822[_0x32f1('0x26')]){delete _0x1ad822[_0x32f1('0x26')];}_0x48c57e['status'](_0x4afbdf)[_0x32f1('0x27')](_0x1ad822);};}exports[_0x32f1('0x28')]=function(_0x738a4e,_0x19b5e4){var _0x1dda73={},_0x532f81={},_0x465e90={'count':0x0,'rows':[]};var _0x1fe88e=_[_0x32f1('0x29')](db['SugarcrmField']['rawAttributes'],function(_0x4818ba){return{'name':_0x4818ba[_0x32f1('0x2a')],'type':_0x4818ba[_0x32f1('0x2b')]['key']};});_0x532f81[_0x32f1('0x2c')]=_[_0x32f1('0x29')](_0x1fe88e,_0x32f1('0x26'));_0x532f81[_0x32f1('0x2d')]=_[_0x32f1('0x2e')](_0x738a4e[_0x32f1('0x2d')]);_0x532f81[_0x32f1('0x2f')]=_[_0x32f1('0x30')](_0x532f81[_0x32f1('0x2c')],_0x532f81[_0x32f1('0x2d')]);_0x1dda73['attributes']=_[_0x32f1('0x30')](_0x532f81[_0x32f1('0x2c')],qs[_0x32f1('0x31')](_0x738a4e[_0x32f1('0x2d')]['fields']));_0x1dda73[_0x32f1('0x32')]=_0x1dda73['attributes'][_0x32f1('0x33')]?_0x1dda73[_0x32f1('0x32')]:_0x532f81[_0x32f1('0x2c')];if(!_0x738a4e[_0x32f1('0x2d')][_0x32f1('0x34')](_0x32f1('0x35'))){_0x1dda73[_0x32f1('0x18')]=qs[_0x32f1('0x18')](_0x738a4e[_0x32f1('0x2d')][_0x32f1('0x18')]);_0x1dda73[_0x32f1('0x1b')]=qs['offset'](_0x738a4e['query'][_0x32f1('0x1b')]);}_0x1dda73[_0x32f1('0x36')]=qs[_0x32f1('0x37')](_0x738a4e[_0x32f1('0x2d')][_0x32f1('0x37')]);_0x1dda73[_0x32f1('0x38')]=qs[_0x32f1('0x2f')](_[_0x32f1('0x39')](_0x738a4e[_0x32f1('0x2d')],_0x532f81[_0x32f1('0x2f')]),_0x1fe88e);if(_0x738a4e[_0x32f1('0x2d')]['filter']){_0x1dda73[_0x32f1('0x38')]=_[_0x32f1('0x3a')](_0x1dda73[_0x32f1('0x38')],{'$or':_[_0x32f1('0x29')](_0x1fe88e,function(_0x5470c1){if(_0x5470c1[_0x32f1('0x2b')]!==_0x32f1('0x3b')){var _0x5b4cfb={};_0x5b4cfb[_0x5470c1[_0x32f1('0x26')]]={'$like':'%'+_0x738a4e[_0x32f1('0x2d')][_0x32f1('0x3c')]+'%'};return _0x5b4cfb;}})});}_0x1dda73=_['merge']({},_0x1dda73,_0x738a4e[_0x32f1('0x3d')]);var _0x251677={'where':_0x1dda73[_0x32f1('0x38')]};return db['SugarcrmField'][_0x32f1('0x1a')](_0x251677)[_0x32f1('0x22')](function(_0x2d2c7c){_0x465e90['count']=_0x2d2c7c;if(_0x738a4e['query'][_0x32f1('0x3e')]){_0x1dda73[_0x32f1('0x3f')]=[{'all':!![]}];}return db[_0x32f1('0x40')][_0x32f1('0x41')](_0x1dda73);})[_0x32f1('0x22')](function(_0x2fbba2){_0x465e90[_0x32f1('0x42')]=_0x2fbba2;return _0x465e90;})[_0x32f1('0x22')](respondWithFilteredResult(_0x19b5e4,_0x1dda73))[_0x32f1('0x43')](handleError(_0x19b5e4,null));};exports[_0x32f1('0x44')]=function(_0x573128,_0x1619ca){var _0xcc5fbe={'raw':!![],'where':{'id':_0x573128[_0x32f1('0x45')]['id']}},_0x573877={};_0x573877[_0x32f1('0x2c')]=_[_0x32f1('0x2e')](db[_0x32f1('0x40')]['rawAttributes']);_0x573877[_0x32f1('0x2d')]=_['keys'](_0x573128[_0x32f1('0x2d')]);_0x573877[_0x32f1('0x2f')]=_['intersection'](_0x573877['model'],_0x573877[_0x32f1('0x2d')]);_0xcc5fbe[_0x32f1('0x32')]=_[_0x32f1('0x30')](_0x573877['model'],qs[_0x32f1('0x31')](_0x573128[_0x32f1('0x2d')]['fields']));_0xcc5fbe[_0x32f1('0x32')]=_0xcc5fbe[_0x32f1('0x32')][_0x32f1('0x33')]?_0xcc5fbe[_0x32f1('0x32')]:_0x573877[_0x32f1('0x2c')];if(_0x573128[_0x32f1('0x2d')][_0x32f1('0x3e')]){_0xcc5fbe[_0x32f1('0x3f')]=[{'all':!![]}];}_0xcc5fbe=_[_0x32f1('0x3a')]({},_0xcc5fbe,_0x573128[_0x32f1('0x3d')]);return db[_0x32f1('0x40')][_0x32f1('0x46')](_0xcc5fbe)['then'](handleEntityNotFound(_0x1619ca,null))['then'](respondWithResult(_0x1619ca,null))[_0x32f1('0x43')](handleError(_0x1619ca,null));};exports[_0x32f1('0x47')]=function(_0x28fa47,_0xdd0cb7){return db[_0x32f1('0x40')][_0x32f1('0x47')](_0x28fa47[_0x32f1('0x48')],{})[_0x32f1('0x22')](respondWithResult(_0xdd0cb7,0xc9))[_0x32f1('0x43')](handleError(_0xdd0cb7,null));};exports['update']=function(_0x3e83fa,_0x276b7f){if(_0x3e83fa[_0x32f1('0x48')]['id']){delete _0x3e83fa[_0x32f1('0x48')]['id'];}return db['SugarcrmField'][_0x32f1('0x46')]({'where':{'id':_0x3e83fa[_0x32f1('0x45')]['id']}})[_0x32f1('0x22')](handleEntityNotFound(_0x276b7f,null))[_0x32f1('0x22')](saveUpdates(_0x3e83fa[_0x32f1('0x48')],null))[_0x32f1('0x22')](respondWithResult(_0x276b7f,null))[_0x32f1('0x43')](handleError(_0x276b7f,null));};exports['destroy']=function(_0x4787bf,_0x4cd8db){return db[_0x32f1('0x40')]['find']({'where':{'id':_0x4787bf[_0x32f1('0x45')]['id']}})[_0x32f1('0x22')](handleEntityNotFound(_0x4cd8db,null))[_0x32f1('0x22')](removeEntity(_0x4cd8db,null))['catch'](handleError(_0x4cd8db,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 982ce13..46d61bd 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 _0x4862=['bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x2d1462,_0x20c52a){var _0x43a92e=function(_0x5a75d3){while(--_0x5a75d3){_0x2d1462['push'](_0x2d1462['shift']());}};_0x43a92e(++_0x20c52a);}(_0x4862,0x127));var _0x2486=function(_0x3cc34a,_0x13e2db){_0x3cc34a=_0x3cc34a-0x0;var _0x5ca5a1=_0x4862[_0x3cc34a];return _0x5ca5a1;};'use strict';var _=require(_0x2486('0x0'));var util=require(_0x2486('0x1'));var logger=require(_0x2486('0x2'))(_0x2486('0x3'));var moment=require(_0x2486('0x4'));var BPromise=require(_0x2486('0x5'));var rp=require(_0x2486('0x6'));var fs=require('fs');var path=require(_0x2486('0x7'));var rimraf=require(_0x2486('0x8'));var config=require('../../config/environment');var attributes=require(_0x2486('0x9'));module[_0x2486('0xa')]=function(_0x6f0a5d,_0x407620){return _0x6f0a5d[_0x2486('0xb')]('SugarcrmField',attributes,{'tableName':_0x2486('0xc'),'paranoid':![],'indexes':[{'name':_0x2486('0xd'),'fields':[_0x2486('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb07d=['request-promise','path','rimraf','exports','define','SugarcrmField','int_sugarcrm_fields','idField','FieldId','util','../../config/logger','api'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xb07d,0x165));var _0xdb07=function(_0x1d950b,_0x51a309){_0x1d950b=_0x1d950b-0x0;var _0x4f9169=_0xb07d[_0x1d950b];return _0x4f9169;};'use strict';var _=require('lodash');var util=require(_0xdb07('0x0'));var logger=require(_0xdb07('0x1'))(_0xdb07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdb07('0x3'));var fs=require('fs');var path=require(_0xdb07('0x4'));var rimraf=require(_0xdb07('0x5'));var config=require('../../config/environment');var attributes=require('./intSugarcrmField.attributes');module[_0xdb07('0x6')]=function(_0x59717c,_0x5468fb){return _0x59717c[_0xdb07('0x7')](_0xdb07('0x8'),attributes,{'tableName':_0xdb07('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xdb07('0xa'),_0xdb07('0xb')],'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 7abb9be..3537df6 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 _0x5b3e=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmField,\x20%s,\x20%s','result','lodash','util'];(function(_0x432a21,_0x43dc03){var _0x28fc32=function(_0x7c9a91){while(--_0x7c9a91){_0x432a21['push'](_0x432a21['shift']());}};_0x28fc32(++_0x43dc03);}(_0x5b3e,0x124));var _0xe5b3=function(_0x279b49,_0x1a4f17){_0x279b49=_0x279b49-0x0;var _0x57041d=_0x5b3e[_0x279b49];return _0x57041d;};'use strict';var _=require(_0xe5b3('0x0'));var util=require(_0xe5b3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe5b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5b3('0x3'))['db'];var utils=require(_0xe5b3('0x4'));var logger=require(_0xe5b3('0x5'))(_0xe5b3('0x6'));var config=require(_0xe5b3('0x7'));var jayson=require(_0xe5b3('0x8'));var client=jayson['client'][_0xe5b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1995e8,_0x53f230,_0x3b0624){return new BPromise(function(_0x5d8119,_0x39b1ac){return client[_0xe5b3('0xa')](_0x1995e8,_0x3b0624)[_0xe5b3('0xb')](function(_0xf35013){logger[_0xe5b3('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x53f230,_0xe5b3('0xd'));logger['debug'](_0xe5b3('0xe'),_0x53f230,'request\x20sent',JSON[_0xe5b3('0xf')](_0xf35013));if(_0xf35013[_0xe5b3('0x10')]){if(_0xf35013['error'][_0xe5b3('0x11')]===0x1f4){logger[_0xe5b3('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x53f230,_0xf35013[_0xe5b3('0x10')][_0xe5b3('0x12')]);return _0x39b1ac(_0xf35013[_0xe5b3('0x10')][_0xe5b3('0x12')]);}logger[_0xe5b3('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x53f230,_0xf35013[_0xe5b3('0x10')][_0xe5b3('0x12')]);return _0x5d8119(_0xf35013[_0xe5b3('0x10')]['message']);}else{logger[_0xe5b3('0xc')](_0xe5b3('0x13'),_0x53f230,_0xe5b3('0xd'));_0x5d8119(_0xf35013[_0xe5b3('0x14')][_0xe5b3('0x12')]);}})['catch'](function(_0x281fff){logger['error'](_0xe5b3('0x13'),_0x53f230,_0x281fff);_0x39b1ac(_0x281fff);});});} \ No newline at end of file +var _0xae3a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird'];(function(_0x29e17f,_0x400f03){var _0x25da87=function(_0x3331f3){while(--_0x3331f3){_0x29e17f['push'](_0x29e17f['shift']());}};_0x25da87(++_0x400f03);}(_0xae3a,0x18b));var _0xaae3=function(_0x4cbde1,_0x5785ec){_0x4cbde1=_0x4cbde1-0x0;var _0x37d42=_0xae3a[_0x4cbde1];return _0x37d42;};'use strict';var _=require(_0xaae3('0x0'));var util=require(_0xaae3('0x1'));var moment=require(_0xaae3('0x2'));var BPromise=require(_0xaae3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaae3('0x4'));var db=require(_0xaae3('0x5'))['db'];var utils=require(_0xaae3('0x6'));var logger=require(_0xaae3('0x7'))(_0xaae3('0x8'));var config=require(_0xaae3('0x9'));var jayson=require(_0xaae3('0xa'));var client=jayson[_0xaae3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x194eea,_0x3d0362,_0x2dd439){return new BPromise(function(_0x2a6d37,_0x511bd6){return client[_0xaae3('0xc')](_0x194eea,_0x2dd439)['then'](function(_0x9b5772){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x3d0362,_0xaae3('0xd'));logger[_0xaae3('0xe')](_0xaae3('0xf'),_0x3d0362,_0xaae3('0xd'),JSON['stringify'](_0x9b5772));if(_0x9b5772[_0xaae3('0x10')]){if(_0x9b5772[_0xaae3('0x10')][_0xaae3('0x11')]===0x1f4){logger[_0xaae3('0x10')](_0xaae3('0x12'),_0x3d0362,_0x9b5772[_0xaae3('0x10')][_0xaae3('0x13')]);return _0x511bd6(_0x9b5772[_0xaae3('0x10')][_0xaae3('0x13')]);}logger[_0xaae3('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x3d0362,_0x9b5772['error'][_0xaae3('0x13')]);return _0x2a6d37(_0x9b5772[_0xaae3('0x10')][_0xaae3('0x13')]);}else{logger[_0xaae3('0x14')](_0xaae3('0x12'),_0x3d0362,_0xaae3('0xd'));_0x2a6d37(_0x9b5772['result']['message']);}})['catch'](function(_0x57b44a){logger['error'](_0xaae3('0x12'),_0x3d0362,_0x57b44a);_0x511bd6(_0x57b44a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 917c056..4d33094 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 _0x63e4=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','delete','destroy','multer'];(function(_0x1f3ed0,_0x4b526a){var _0x5ba4ff=function(_0x3ee47a){while(--_0x3ee47a){_0x1f3ed0['push'](_0x1f3ed0['shift']());}};_0x5ba4ff(++_0x4b526a);}(_0x63e4,0x12a));var _0x463e=function(_0x591c5a,_0x371588){_0x591c5a=_0x591c5a-0x0;var _0x1c0992=_0x63e4[_0x591c5a];return _0x1c0992;};'use strict';var multer=require(_0x463e('0x0'));var util=require(_0x463e('0x1'));var path=require(_0x463e('0x2'));var timeout=require(_0x463e('0x3'));var express=require(_0x463e('0x4'));var router=express[_0x463e('0x5')]();var fs_extra=require(_0x463e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x463e('0x7'));var config=require(_0x463e('0x8'));var controller=require(_0x463e('0x9'));router[_0x463e('0xa')]('/',auth[_0x463e('0xb')](),controller[_0x463e('0xc')]);router[_0x463e('0xa')](_0x463e('0xd'),auth[_0x463e('0xb')](),controller[_0x463e('0xe')]);router[_0x463e('0xa')](_0x463e('0xf'),auth[_0x463e('0xb')](),controller[_0x463e('0x10')]);router[_0x463e('0xa')]('/:id/fields',auth[_0x463e('0xb')](),controller[_0x463e('0x11')]);router[_0x463e('0x12')]('/',auth[_0x463e('0xb')](),controller['create']);router[_0x463e('0x12')](_0x463e('0xf'),auth['isAuthenticated'](),controller[_0x463e('0x13')]);router[_0x463e('0x14')](_0x463e('0xd'),auth[_0x463e('0xb')](),controller['update']);router[_0x463e('0x15')](_0x463e('0xd'),auth[_0x463e('0xb')](),controller[_0x463e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0b8f=['/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put'];(function(_0x285800,_0x26765e){var _0x4b809e=function(_0x12c58b){while(--_0x12c58b){_0x285800['push'](_0x285800['shift']());}};_0x4b809e(++_0x26765e);}(_0x0b8f,0x174));var _0xf0b8=function(_0x4122ba,_0x4d6f24){_0x4122ba=_0x4122ba-0x0;var _0x3d6980=_0x0b8f[_0x4122ba];return _0x3d6980;};'use strict';var multer=require(_0xf0b8('0x0'));var util=require('util');var path=require(_0xf0b8('0x1'));var timeout=require(_0xf0b8('0x2'));var express=require(_0xf0b8('0x3'));var router=express[_0xf0b8('0x4')]();var fs_extra=require(_0xf0b8('0x5'));var auth=require(_0xf0b8('0x6'));var interaction=require(_0xf0b8('0x7'));var config=require(_0xf0b8('0x8'));var controller=require(_0xf0b8('0x9'));router[_0xf0b8('0xa')]('/',auth[_0xf0b8('0xb')](),controller['index']);router[_0xf0b8('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0xf0b8('0xb')](),controller[_0xf0b8('0xc')]);router[_0xf0b8('0xa')]('/:id/fields',auth[_0xf0b8('0xb')](),controller[_0xf0b8('0xd')]);router[_0xf0b8('0xe')]('/',auth['isAuthenticated'](),controller[_0xf0b8('0xf')]);router['post'](_0xf0b8('0x10'),auth[_0xf0b8('0xb')](),controller[_0xf0b8('0x11')]);router[_0xf0b8('0x12')](_0xf0b8('0x13'),auth['isAuthenticated'](),controller[_0xf0b8('0x14')]);router['delete'](_0xf0b8('0x13'),auth[_0xf0b8('0xb')](),controller[_0xf0b8('0x15')]);module[_0xf0b8('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a2ce69e..f7fe641 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 _0xedc7=['STRING','HelpDesk','sequelize'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xedc7,0x134));var _0x7edc=function(_0x596ce6,_0x4042fb){_0x596ce6=_0x596ce6-0x0;var _0x452d51=_0xedc7[_0x596ce6];return _0x452d51;};'use strict';var Sequelize=require(_0x7edc('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7edc('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7edc('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7edc('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xde67=['STRING','HelpDesk','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xde67,0xd6));var _0x7de6=function(_0x22b70f,_0x4c853f){_0x22b70f=_0x22b70f-0x0;var _0x100985=_0xde67[_0x22b70f];return _0x100985;};'use strict';var Sequelize=require(_0x7de6('0x0'));module[_0x7de6('0x1')]={'name':{'type':Sequelize[_0x7de6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7de6('0x2')]},'username':{'type':Sequelize[_0x7de6('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7de6('0x3')},'remoteUri':{'type':Sequelize[_0x7de6('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7de6('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index e461e2d..816ba03 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 _0x7c8f=['undefined','count','offset','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','VIRTUAL','VtigerAccount','includeAll','include','findAll','rows','catch','merge','options','create','body','update','find','params','getConfigurations','findOne','rawAttributes','order','filter','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','moduleName','remoteUri','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','sessionName','success','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','limit'];(function(_0x42a914,_0x30d193){var _0x46d50e=function(_0x24c96c){while(--_0x24c96c){_0x42a914['push'](_0x42a914['shift']());}};_0x46d50e(++_0x30d193);}(_0x7c8f,0x1d0));var _0xf7c8=function(_0x40563e,_0x1bf458){_0x40563e=_0x40563e-0x0;var _0x26c732=_0x7c8f[_0x40563e];return _0x26c732;};'use strict';var emlformat=require(_0xf7c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c8('0x1'));var moment=require(_0xf7c8('0x2'));var BPromise=require(_0xf7c8('0x3'));var Mustache=require(_0xf7c8('0x4'));var util=require('util');var path=require(_0xf7c8('0x5'));var sox=require(_0xf7c8('0x6'));var csv=require('to-csv');var ejs=require(_0xf7c8('0x7'));var fs=require('fs');var fs_extra=require(_0xf7c8('0x8'));var _=require(_0xf7c8('0x9'));var squel=require(_0xf7c8('0xa'));var crypto=require(_0xf7c8('0xb'));var jsforce=require(_0xf7c8('0xc'));var deskjs=require(_0xf7c8('0xd'));var toCsv=require(_0xf7c8('0xe'));var querystring=require(_0xf7c8('0xf'));var Papa=require(_0xf7c8('0x10'));var Redis=require(_0xf7c8('0x11'));var authService=require(_0xf7c8('0x12'));var qs=require(_0xf7c8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7c8('0x14'));var logger=require(_0xf7c8('0x15'))(_0xf7c8('0x16'));var utils=require(_0xf7c8('0x17'));var config=require(_0xf7c8('0x18'));var licenseUtil=require(_0xf7c8('0x19'));var db=require(_0xf7c8('0x1a'))['db'];var integrations=require(_0xf7c8('0x1b'));function respondWithStatusCode(_0x5a2b23,_0x57eadb){_0x57eadb=_0x57eadb||0xcc;return function(_0x3d940d){if(_0x3d940d){return _0x5a2b23['sendStatus'](_0x57eadb);}return _0x5a2b23['status'](_0x57eadb)[_0xf7c8('0x1c')]();};}function respondWithResult(_0x12a471,_0x306d49){_0x306d49=_0x306d49||0xc8;return function(_0x5478d8){if(_0x5478d8){return _0x12a471[_0xf7c8('0x1d')](_0x306d49)[_0xf7c8('0x1e')](_0x5478d8);}};}function respondWithFilteredResult(_0x386dd,_0x445915){return function(_0x7ab4d3){if(_0x7ab4d3){var _0x4fde46=typeof _0x445915['offset']==='undefined'&&typeof _0x445915[_0xf7c8('0x1f')]===_0xf7c8('0x20');var _0x58b83d=_0x7ab4d3[_0xf7c8('0x21')];var _0x1a9ff6=_0x4fde46?0x0:_0x445915[_0xf7c8('0x22')];var _0x1992bf=_0x4fde46?_0x7ab4d3[_0xf7c8('0x21')]:_0x445915[_0xf7c8('0x22')]+_0x445915[_0xf7c8('0x1f')];var _0x294446;if(_0x1992bf>=_0x58b83d){_0x1992bf=_0x58b83d;_0x294446=0xc8;}else{_0x294446=0xce;}_0x386dd['status'](_0x294446);return _0x386dd[_0xf7c8('0x23')]('Content-Range',_0x1a9ff6+'-'+_0x1992bf+'/'+_0x58b83d)['json'](_0x7ab4d3);}return null;};}function patchUpdates(_0xebc2ff){return function(_0x2d835e){try{jsonpatch[_0xf7c8('0x24')](_0x2d835e,_0xebc2ff,!![]);}catch(_0x301828){return BPromise[_0xf7c8('0x25')](_0x301828);}return _0x2d835e[_0xf7c8('0x26')]();};}function saveUpdates(_0x2e5ad4,_0x41a48a){return function(_0x1a4de2){if(_0x1a4de2){return _0x1a4de2['update'](_0x2e5ad4)[_0xf7c8('0x27')](function(_0x23c862){return _0x23c862;});}return null;};}function removeEntity(_0x4ababd,_0x3ca8de){return function(_0x1261eb){if(_0x1261eb){return _0x1261eb[_0xf7c8('0x28')]()['then'](function(){_0x4ababd[_0xf7c8('0x1d')](0xcc)[_0xf7c8('0x1c')]();});}};}function handleEntityNotFound(_0x50f616,_0x319ee2){return function(_0x1a5fde){if(!_0x1a5fde){_0x50f616[_0xf7c8('0x29')](0x194);}return _0x1a5fde;};}function handleError(_0x1ff270,_0x99aac5){_0x99aac5=_0x99aac5||0x1f4;return function(_0x4b3fa9){logger[_0xf7c8('0x2a')](_0x4b3fa9[_0xf7c8('0x2b')]);if(_0x4b3fa9[_0xf7c8('0x2c')]){delete _0x4b3fa9[_0xf7c8('0x2c')];}_0x1ff270[_0xf7c8('0x1d')](_0x99aac5)[_0xf7c8('0x2d')](_0x4b3fa9);};}exports['index']=function(_0x2f6df7,_0x55b6a9){var _0x204dae={},_0x3a3052={},_0x1b9a09={'count':0x0,'rows':[]};var _0x3974f6=_[_0xf7c8('0x2e')](db['VtigerAccount']['rawAttributes'],function(_0x5eae16){return{'name':_0x5eae16[_0xf7c8('0x2f')],'type':_0x5eae16[_0xf7c8('0x30')]['key']};});_0x3a3052[_0xf7c8('0x31')]=_['map'](_0x3974f6,_0xf7c8('0x2c'));_0x3a3052[_0xf7c8('0x32')]=_[_0xf7c8('0x33')](_0x2f6df7[_0xf7c8('0x32')]);_0x3a3052[_0xf7c8('0x34')]=_[_0xf7c8('0x35')](_0x3a3052[_0xf7c8('0x31')],_0x3a3052['query']);_0x204dae[_0xf7c8('0x36')]=_[_0xf7c8('0x35')](_0x3a3052[_0xf7c8('0x31')],qs[_0xf7c8('0x37')](_0x2f6df7[_0xf7c8('0x32')][_0xf7c8('0x37')]));_0x204dae[_0xf7c8('0x36')]=_0x204dae[_0xf7c8('0x36')][_0xf7c8('0x38')]?_0x204dae['attributes']:_0x3a3052['model'];if(!_0x2f6df7[_0xf7c8('0x32')]['hasOwnProperty'](_0xf7c8('0x39'))){_0x204dae[_0xf7c8('0x1f')]=qs[_0xf7c8('0x1f')](_0x2f6df7['query'][_0xf7c8('0x1f')]);_0x204dae[_0xf7c8('0x22')]=qs[_0xf7c8('0x22')](_0x2f6df7[_0xf7c8('0x32')][_0xf7c8('0x22')]);}_0x204dae['order']=qs[_0xf7c8('0x3a')](_0x2f6df7[_0xf7c8('0x32')][_0xf7c8('0x3a')]);_0x204dae[_0xf7c8('0x3b')]=qs[_0xf7c8('0x34')](_['pick'](_0x2f6df7[_0xf7c8('0x32')],_0x3a3052[_0xf7c8('0x34')]),_0x3974f6);if(_0x2f6df7[_0xf7c8('0x32')]['filter']){_0x204dae[_0xf7c8('0x3b')]=_['merge'](_0x204dae[_0xf7c8('0x3b')],{'$or':_[_0xf7c8('0x2e')](_0x3974f6,function(_0x561fe4){if(_0x561fe4[_0xf7c8('0x30')]!==_0xf7c8('0x3c')){var _0xbf73ea={};_0xbf73ea[_0x561fe4[_0xf7c8('0x2c')]]={'$like':'%'+_0x2f6df7[_0xf7c8('0x32')]['filter']+'%'};return _0xbf73ea;}})});}_0x204dae=_['merge']({},_0x204dae,_0x2f6df7['options']);var _0x36f71b={'where':_0x204dae[_0xf7c8('0x3b')]};return db[_0xf7c8('0x3d')]['count'](_0x36f71b)['then'](function(_0x3fa1d6){_0x1b9a09[_0xf7c8('0x21')]=_0x3fa1d6;if(_0x2f6df7[_0xf7c8('0x32')][_0xf7c8('0x3e')]){_0x204dae[_0xf7c8('0x3f')]=[{'all':!![]}];}return db[_0xf7c8('0x3d')][_0xf7c8('0x40')](_0x204dae);})[_0xf7c8('0x27')](function(_0x170b80){_0x1b9a09[_0xf7c8('0x41')]=_0x170b80;return _0x1b9a09;})[_0xf7c8('0x27')](respondWithFilteredResult(_0x55b6a9,_0x204dae))[_0xf7c8('0x42')](handleError(_0x55b6a9,null));};exports['show']=function(_0x281b45,_0xf1f73e){var _0x1bc5f4={'raw':![],'where':{'id':_0x281b45['params']['id']}},_0x3e1fff={};_0x3e1fff[_0xf7c8('0x31')]=_[_0xf7c8('0x33')](db[_0xf7c8('0x3d')]['rawAttributes']);_0x3e1fff['query']=_[_0xf7c8('0x33')](_0x281b45[_0xf7c8('0x32')]);_0x3e1fff[_0xf7c8('0x34')]=_[_0xf7c8('0x35')](_0x3e1fff[_0xf7c8('0x31')],_0x3e1fff[_0xf7c8('0x32')]);_0x1bc5f4[_0xf7c8('0x36')]=_[_0xf7c8('0x35')](_0x3e1fff['model'],qs[_0xf7c8('0x37')](_0x281b45[_0xf7c8('0x32')][_0xf7c8('0x37')]));_0x1bc5f4['attributes']=_0x1bc5f4[_0xf7c8('0x36')][_0xf7c8('0x38')]?_0x1bc5f4[_0xf7c8('0x36')]:_0x3e1fff[_0xf7c8('0x31')];if(_0x281b45[_0xf7c8('0x32')][_0xf7c8('0x3e')]){_0x1bc5f4['include']=[{'all':!![]}];}_0x1bc5f4=_[_0xf7c8('0x43')]({},_0x1bc5f4,_0x281b45[_0xf7c8('0x44')]);return db['VtigerAccount']['find'](_0x1bc5f4)['then'](handleEntityNotFound(_0xf1f73e,null))[_0xf7c8('0x27')](respondWithResult(_0xf1f73e,null))[_0xf7c8('0x42')](handleError(_0xf1f73e,null));};exports[_0xf7c8('0x45')]=function(_0x5b1111,_0x481121){return db[_0xf7c8('0x3d')][_0xf7c8('0x45')](_0x5b1111[_0xf7c8('0x46')],{})['then'](respondWithResult(_0x481121,0xc9))[_0xf7c8('0x42')](handleError(_0x481121,null));};exports[_0xf7c8('0x47')]=function(_0x498661,_0x44ac9d){if(_0x498661[_0xf7c8('0x46')]['id']){delete _0x498661['body']['id'];}return db[_0xf7c8('0x3d')][_0xf7c8('0x48')]({'where':{'id':_0x498661['params']['id']}})[_0xf7c8('0x27')](handleEntityNotFound(_0x44ac9d,null))[_0xf7c8('0x27')](saveUpdates(_0x498661[_0xf7c8('0x46')],null))[_0xf7c8('0x27')](respondWithResult(_0x44ac9d,null))[_0xf7c8('0x42')](handleError(_0x44ac9d,null));};exports[_0xf7c8('0x28')]=function(_0x1105e6,_0x288144){return db[_0xf7c8('0x3d')][_0xf7c8('0x48')]({'where':{'id':_0x1105e6[_0xf7c8('0x49')]['id']}})[_0xf7c8('0x27')](handleEntityNotFound(_0x288144,null))['then'](removeEntity(_0x288144,null))[_0xf7c8('0x42')](handleError(_0x288144,null));};exports[_0xf7c8('0x4a')]=function(_0x4a573c,_0xdb39a5,_0x54900f){var _0x2a5d1c={};var _0x4e642b={};var _0x3055ee;var _0x1fb7c8;return db[_0xf7c8('0x3d')][_0xf7c8('0x4b')]({'where':{'id':_0x4a573c[_0xf7c8('0x49')]['id']}})[_0xf7c8('0x27')](handleEntityNotFound(_0xdb39a5,null))[_0xf7c8('0x27')](function(_0x39ebf9){if(_0x39ebf9){_0x3055ee=_0x39ebf9;_0x4e642b[_0xf7c8('0x31')]=_[_0xf7c8('0x33')](db['VtigerConfiguration'][_0xf7c8('0x4c')]);_0x4e642b[_0xf7c8('0x32')]=_['keys'](_0x4a573c[_0xf7c8('0x32')]);_0x4e642b['filters']=_[_0xf7c8('0x35')](_0x4e642b[_0xf7c8('0x31')],_0x4e642b[_0xf7c8('0x32')]);_0x2a5d1c[_0xf7c8('0x36')]=_[_0xf7c8('0x35')](_0x4e642b['model'],qs[_0xf7c8('0x37')](_0x4a573c[_0xf7c8('0x32')][_0xf7c8('0x37')]));_0x2a5d1c[_0xf7c8('0x36')]=_0x2a5d1c[_0xf7c8('0x36')][_0xf7c8('0x38')]?_0x2a5d1c[_0xf7c8('0x36')]:_0x4e642b[_0xf7c8('0x31')];_0x2a5d1c[_0xf7c8('0x4d')]=qs[_0xf7c8('0x3a')](_0x4a573c[_0xf7c8('0x32')][_0xf7c8('0x3a')]);_0x2a5d1c[_0xf7c8('0x3b')]=qs[_0xf7c8('0x34')](_['pick'](_0x4a573c[_0xf7c8('0x32')],_0x4e642b[_0xf7c8('0x34')]));if(_0x4a573c[_0xf7c8('0x32')][_0xf7c8('0x4e')]){_0x2a5d1c[_0xf7c8('0x3b')]=_[_0xf7c8('0x43')](_0x2a5d1c[_0xf7c8('0x3b')],{'$or':_['map'](_0x2a5d1c['attributes'],function(_0x49a1af){var _0x43f2e3={};_0x43f2e3[_0x49a1af]={'$like':'%'+_0x4a573c[_0xf7c8('0x32')][_0xf7c8('0x4e')]+'%'};return _0x43f2e3;})});}_0x2a5d1c=_[_0xf7c8('0x43')]({},_0x2a5d1c,_0x4a573c['options']);return _0x3055ee[_0xf7c8('0x4a')](_0x2a5d1c);}})[_0xf7c8('0x27')](function(_0x2e85f5){if(_0x2e85f5){_0x1fb7c8=_0x2e85f5[_0xf7c8('0x38')];if(!_0x4a573c['query'][_0xf7c8('0x4f')](_0xf7c8('0x39'))){_0x2a5d1c[_0xf7c8('0x1f')]=qs[_0xf7c8('0x1f')](_0x4a573c[_0xf7c8('0x32')][_0xf7c8('0x1f')]);_0x2a5d1c['offset']=qs[_0xf7c8('0x22')](_0x4a573c['query']['offset']);}return _0x3055ee[_0xf7c8('0x4a')](_0x2a5d1c);}})[_0xf7c8('0x27')](function(_0x469720){if(_0x469720){return _0x469720?{'count':_0x1fb7c8,'rows':_0x469720}:null;}})[_0xf7c8('0x27')](respondWithResult(_0xdb39a5,null))[_0xf7c8('0x42')](handleError(_0xdb39a5,null));};exports[_0xf7c8('0x50')]=function(_0x435f6d,_0x2fa66c,_0x5efa8b){if(_0x435f6d['body']['id']){delete _0x435f6d[_0xf7c8('0x46')]['id'];}return db[_0xf7c8('0x3d')][_0xf7c8('0x4b')]({'where':{'id':_0x435f6d[_0xf7c8('0x49')]['id']}})[_0xf7c8('0x27')](handleEntityNotFound(_0x2fa66c,null))[_0xf7c8('0x27')](function(_0x1ad223){if(_0x1ad223){_0x435f6d[_0xf7c8('0x46')]['AccountId']=_0x1ad223['id'];_0x435f6d[_0xf7c8('0x46')][_0xf7c8('0x51')]=integrations[_0xf7c8('0x52')](_0x435f6d['body'][_0xf7c8('0x53')],_0x435f6d['body']['type']);_0x435f6d[_0xf7c8('0x46')][_0xf7c8('0x54')]=integrations[_0xf7c8('0x55')](_0x435f6d[_0xf7c8('0x46')][_0xf7c8('0x53')],_0x435f6d[_0xf7c8('0x46')][_0xf7c8('0x30')]);return db[_0xf7c8('0x56')]['create'](_0x435f6d[_0xf7c8('0x46')],{'include':[{'model':db[_0xf7c8('0x57')],'as':_0xf7c8('0x51')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xf7c8('0x27')](respondWithResult(_0x2fa66c,null))['catch'](handleError(_0x2fa66c,null));};var md5=require(_0xf7c8('0x58'));exports['getFields']=function(_0x3916d7,_0x5695a0,_0x3bad8b){var _0x2d38ff=null;var _0x1da4ea=null;var _0x4fe51d=null;var _0x3bc09d=null;var _0x531c0d='';return db['VtigerAccount'][_0xf7c8('0x4b')]({'where':{'id':_0x3916d7[_0xf7c8('0x49')]['id']},'attributes':['id','name','username','description',_0xf7c8('0x59'),_0xf7c8('0x5a'),'serverUrl',_0xf7c8('0x5b')]})[_0xf7c8('0x27')](handleEntityNotFound(_0x5695a0,null))[_0xf7c8('0x27')](function(_0x2b1774){if(_0x2b1774){_0x2d38ff=_0x2b1774[_0xf7c8('0x5c')];_0x1da4ea=_0x2b1774['accessKey'];_0x4fe51d=_0x2b1774[_0xf7c8('0x59')];_0x531c0d=_0x2b1774[_0xf7c8('0x5a')];var _0x53538e=_0x531c0d[_0xf7c8('0x5d')](-0x1);if(_0x53538e==='/'){_0x531c0d=_0x531c0d[_0xf7c8('0x5e')](0x0,_0x531c0d[_0xf7c8('0x5f')](_0x53538e));}_0x3bc09d=util[_0xf7c8('0x60')](_0xf7c8('0x61'),_0x531c0d);var _0x15b0f0={'method':_0xf7c8('0x62'),'uri':_0x3bc09d,'qs':{'operation':_0xf7c8('0x63'),'username':_0x2b1774[_0xf7c8('0x5c')]},'json':!![]};return rp(_0x15b0f0);}})[_0xf7c8('0x27')](function(_0x334a17){if(_0x334a17['success']){var _0x122447={'method':_0xf7c8('0x64'),'uri':_0x3bc09d,'form':{'operation':'login','username':_0x2d38ff,'accessKey':md5(_0x334a17[_0xf7c8('0x65')][_0xf7c8('0x66')]+_0x1da4ea)},'json':!![]};return rp(_0x122447);}})[_0xf7c8('0x27')](function(_0x4102d0){if(_0x4102d0['success']){var _0x2b34c8={'method':'GET','uri':_0x3bc09d,'qs':{'operation':'describe','username':_0x2d38ff,'sessionName':_0x4102d0['result'][_0xf7c8('0x67')],'elementType':_0x4fe51d},'json':!![]};return rp(_0x2b34c8);}})['then'](function(_0x333ca0){if(_0x333ca0[_0xf7c8('0x68')]){var _0x581ed8=[_0xf7c8('0x69'),'reference',_0xf7c8('0x6a')];_[_0xf7c8('0x6b')](_0x333ca0['result'][_0xf7c8('0x37')],function(_0x1b783e){return _0x581ed8[_0xf7c8('0x6c')](_0x1b783e[_0xf7c8('0x30')][_0xf7c8('0x2c')]);});_[_0xf7c8('0x6b')](_0x333ca0[_0xf7c8('0x65')][_0xf7c8('0x37')],function(_0x3eb3af){return _0x3eb3af[_0xf7c8('0x6d')]===_0xf7c8('0x6e');});return{'count':_0x333ca0[_0xf7c8('0x65')][_0xf7c8('0x37')][_0xf7c8('0x38')],'rows':_['map'](_0x333ca0[_0xf7c8('0x65')]['fields'],function(_0x2066df){return{'id':_0x2066df['name'],'name':_0x2066df[_0xf7c8('0x6f')],'custom':_[_0xf7c8('0x70')](_0x2066df[_0xf7c8('0x2c')],_0xf7c8('0x71'))?!![]:![],'options':_0x2066df['type'][_0xf7c8('0x2c')]===_0xf7c8('0x72')&&_0x2066df[_0xf7c8('0x30')][_0xf7c8('0x73')][_0xf7c8('0x38')]>0x0?_[_0xf7c8('0x2e')](_0x2066df[_0xf7c8('0x30')][_0xf7c8('0x73')],function(_0x268c58){return{'name':_0x268c58[_0xf7c8('0x6f')],'value':_0x268c58[_0xf7c8('0x74')]};}):[]};})};}})[_0xf7c8('0x27')](respondWithResult(_0x5695a0,null))['catch'](function(_0x3b2298){console[_0xf7c8('0x75')](_0xf7c8('0x76')+_0x3b2298);var _0x1a59ad=_0x3916d7[_0xf7c8('0x32')][_0xf7c8('0x77')]?0x1f4:_0x3b2298[_0xf7c8('0x78')]||0x1f4;logger['error'](_0xf7c8('0x79'),_0xf7c8('0x7a'),_0x1a59ad,JSON['stringify'](_0x3b2298));delete _0x3b2298[_0xf7c8('0x2c')];if(_0x1a59ad===0x191){_0x1a59ad=0x190;}_0x5695a0[_0xf7c8('0x1d')](_0x1a59ad)['send'](_0x3916d7[_0xf7c8('0x32')][_0xf7c8('0x77')]?{'message':_0xf7c8('0x7b'),'statusCode':_0x3b2298['statusCode']}:_0x3b2298);});}; \ No newline at end of file +var _0x16b9=['where','merge','VIRTUAL','options','VtigerAccount','findAll','rows','catch','intersection','fields','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','addConfiguration','AccountId','Descriptions','getDescriptions','channel','VtigerField','Subjects','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','reference','remove','includes','editable','startsWith','picklist','picklistValues','label','log','vTiger\x20error:\x20','test','statusCode','getFields','stringify','send','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','nolimit','order','sort','filter'];(function(_0x56bd49,_0x4c54a8){var _0x40d52e=function(_0x607222){while(--_0x607222){_0x56bd49['push'](_0x56bd49['shift']());}};_0x40d52e(++_0x4c54a8);}(_0x16b9,0x182));var _0x916b=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x16b9[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x916b('0x0'));var jsonpatch=require(_0x916b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x916b('0x2'));var Mustache=require(_0x916b('0x3'));var util=require('util');var path=require(_0x916b('0x4'));var sox=require(_0x916b('0x5'));var csv=require(_0x916b('0x6'));var ejs=require(_0x916b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x916b('0x8'));var crypto=require(_0x916b('0x9'));var jsforce=require(_0x916b('0xa'));var deskjs=require(_0x916b('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x916b('0xc'));var Redis=require(_0x916b('0xd'));var authService=require(_0x916b('0xe'));var qs=require(_0x916b('0xf'));var as=require(_0x916b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x916b('0x11'));var utils=require(_0x916b('0x12'));var config=require(_0x916b('0x13'));var licenseUtil=require(_0x916b('0x14'));var db=require(_0x916b('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x35f36b,_0x5d849d){_0x5d849d=_0x5d849d||0xcc;return function(_0x1d70bb){if(_0x1d70bb){return _0x35f36b[_0x916b('0x16')](_0x5d849d);}return _0x35f36b['status'](_0x5d849d)[_0x916b('0x17')]();};}function respondWithResult(_0x1358d6,_0xff2e3f){_0xff2e3f=_0xff2e3f||0xc8;return function(_0x3085ea){if(_0x3085ea){return _0x1358d6[_0x916b('0x18')](_0xff2e3f)[_0x916b('0x19')](_0x3085ea);}};}function respondWithFilteredResult(_0x29428c,_0x514b16){return function(_0x11400d){if(_0x11400d){var _0x182fac=typeof _0x514b16[_0x916b('0x1a')]===_0x916b('0x1b')&&typeof _0x514b16[_0x916b('0x1c')]===_0x916b('0x1b');var _0x45d513=_0x11400d['count'];var _0x309b8c=_0x182fac?0x0:_0x514b16[_0x916b('0x1a')];var _0x320311=_0x182fac?_0x11400d[_0x916b('0x1d')]:_0x514b16[_0x916b('0x1a')]+_0x514b16['limit'];var _0x3dc31c;if(_0x320311>=_0x45d513){_0x320311=_0x45d513;_0x3dc31c=0xc8;}else{_0x3dc31c=0xce;}_0x29428c['status'](_0x3dc31c);return _0x29428c['set']('Content-Range',_0x309b8c+'-'+_0x320311+'/'+_0x45d513)[_0x916b('0x19')](_0x11400d);}return null;};}function patchUpdates(_0x510670){return function(_0x3ad6fa){try{jsonpatch[_0x916b('0x1e')](_0x3ad6fa,_0x510670,!![]);}catch(_0x22dc44){return BPromise[_0x916b('0x1f')](_0x22dc44);}return _0x3ad6fa[_0x916b('0x20')]();};}function saveUpdates(_0x222fe8,_0x33254a){return function(_0x1fec60){if(_0x1fec60){return _0x1fec60[_0x916b('0x21')](_0x222fe8)[_0x916b('0x22')](function(_0x115486){return _0x115486;});}return null;};}function removeEntity(_0x2bedba,_0x575b57){return function(_0x3a3000){if(_0x3a3000){return _0x3a3000[_0x916b('0x23')]()['then'](function(){_0x2bedba[_0x916b('0x18')](0xcc)[_0x916b('0x17')]();});}};}function handleEntityNotFound(_0x2e9978,_0x36d71d){return function(_0x3b2d1b){if(!_0x3b2d1b){_0x2e9978[_0x916b('0x16')](0x194);}return _0x3b2d1b;};}function handleError(_0x391c93,_0x3d69d6){_0x3d69d6=_0x3d69d6||0x1f4;return function(_0x3785a5){logger[_0x916b('0x24')](_0x3785a5[_0x916b('0x25')]);if(_0x3785a5['name']){delete _0x3785a5[_0x916b('0x26')];}_0x391c93['status'](_0x3d69d6)['send'](_0x3785a5);};}exports['index']=function(_0x20da84,_0x2cc7ec){var _0x303060={},_0x37ac59={},_0x148e03={'count':0x0,'rows':[]};var _0x39d599=_[_0x916b('0x27')](db['VtigerAccount'][_0x916b('0x28')],function(_0x456e49){return{'name':_0x456e49[_0x916b('0x29')],'type':_0x456e49[_0x916b('0x2a')][_0x916b('0x2b')]};});_0x37ac59[_0x916b('0x2c')]=_[_0x916b('0x27')](_0x39d599,_0x916b('0x26'));_0x37ac59[_0x916b('0x2d')]=_[_0x916b('0x2e')](_0x20da84[_0x916b('0x2d')]);_0x37ac59[_0x916b('0x2f')]=_['intersection'](_0x37ac59[_0x916b('0x2c')],_0x37ac59[_0x916b('0x2d')]);_0x303060[_0x916b('0x30')]=_['intersection'](_0x37ac59[_0x916b('0x2c')],qs['fields'](_0x20da84[_0x916b('0x2d')]['fields']));_0x303060['attributes']=_0x303060[_0x916b('0x30')][_0x916b('0x31')]?_0x303060['attributes']:_0x37ac59[_0x916b('0x2c')];if(!_0x20da84[_0x916b('0x2d')]['hasOwnProperty'](_0x916b('0x32'))){_0x303060[_0x916b('0x1c')]=qs[_0x916b('0x1c')](_0x20da84[_0x916b('0x2d')]['limit']);_0x303060[_0x916b('0x1a')]=qs['offset'](_0x20da84[_0x916b('0x2d')]['offset']);}_0x303060[_0x916b('0x33')]=qs[_0x916b('0x34')](_0x20da84[_0x916b('0x2d')][_0x916b('0x34')]);_0x303060['where']=qs[_0x916b('0x2f')](_['pick'](_0x20da84[_0x916b('0x2d')],_0x37ac59['filters']),_0x39d599);if(_0x20da84['query'][_0x916b('0x35')]){_0x303060[_0x916b('0x36')]=_[_0x916b('0x37')](_0x303060[_0x916b('0x36')],{'$or':_[_0x916b('0x27')](_0x39d599,function(_0x4eec97){if(_0x4eec97[_0x916b('0x2a')]!==_0x916b('0x38')){var _0x396e00={};_0x396e00[_0x4eec97['name']]={'$like':'%'+_0x20da84[_0x916b('0x2d')]['filter']+'%'};return _0x396e00;}})});}_0x303060=_[_0x916b('0x37')]({},_0x303060,_0x20da84[_0x916b('0x39')]);var _0xf1b6d6={'where':_0x303060[_0x916b('0x36')]};return db[_0x916b('0x3a')][_0x916b('0x1d')](_0xf1b6d6)['then'](function(_0x4b6845){_0x148e03['count']=_0x4b6845;if(_0x20da84['query']['includeAll']){_0x303060['include']=[{'all':!![]}];}return db[_0x916b('0x3a')][_0x916b('0x3b')](_0x303060);})['then'](function(_0x47d998){_0x148e03[_0x916b('0x3c')]=_0x47d998;return _0x148e03;})['then'](respondWithFilteredResult(_0x2cc7ec,_0x303060))[_0x916b('0x3d')](handleError(_0x2cc7ec,null));};exports['show']=function(_0x479dfe,_0x22c0c8){var _0x40ac85={'raw':![],'where':{'id':_0x479dfe['params']['id']}},_0x215ecc={};_0x215ecc[_0x916b('0x2c')]=_[_0x916b('0x2e')](db[_0x916b('0x3a')]['rawAttributes']);_0x215ecc[_0x916b('0x2d')]=_[_0x916b('0x2e')](_0x479dfe[_0x916b('0x2d')]);_0x215ecc[_0x916b('0x2f')]=_[_0x916b('0x3e')](_0x215ecc['model'],_0x215ecc[_0x916b('0x2d')]);_0x40ac85[_0x916b('0x30')]=_[_0x916b('0x3e')](_0x215ecc['model'],qs['fields'](_0x479dfe['query'][_0x916b('0x3f')]));_0x40ac85[_0x916b('0x30')]=_0x40ac85[_0x916b('0x30')][_0x916b('0x31')]?_0x40ac85[_0x916b('0x30')]:_0x215ecc[_0x916b('0x2c')];if(_0x479dfe['query']['includeAll']){_0x40ac85['include']=[{'all':!![]}];}_0x40ac85=_[_0x916b('0x37')]({},_0x40ac85,_0x479dfe[_0x916b('0x39')]);return db['VtigerAccount'][_0x916b('0x40')](_0x40ac85)['then'](handleEntityNotFound(_0x22c0c8,null))['then'](respondWithResult(_0x22c0c8,null))[_0x916b('0x3d')](handleError(_0x22c0c8,null));};exports['create']=function(_0x4075ed,_0x2c10da){return db['VtigerAccount'][_0x916b('0x41')](_0x4075ed[_0x916b('0x42')],{})[_0x916b('0x22')](respondWithResult(_0x2c10da,0xc9))[_0x916b('0x3d')](handleError(_0x2c10da,null));};exports[_0x916b('0x21')]=function(_0x1e7da4,_0x1104d9){if(_0x1e7da4[_0x916b('0x42')]['id']){delete _0x1e7da4[_0x916b('0x42')]['id'];}return db[_0x916b('0x3a')][_0x916b('0x40')]({'where':{'id':_0x1e7da4[_0x916b('0x43')]['id']}})[_0x916b('0x22')](handleEntityNotFound(_0x1104d9,null))[_0x916b('0x22')](saveUpdates(_0x1e7da4['body'],null))[_0x916b('0x22')](respondWithResult(_0x1104d9,null))['catch'](handleError(_0x1104d9,null));};exports['destroy']=function(_0x516bf4,_0x4a98f7){return db[_0x916b('0x3a')][_0x916b('0x40')]({'where':{'id':_0x516bf4[_0x916b('0x43')]['id']}})[_0x916b('0x22')](handleEntityNotFound(_0x4a98f7,null))[_0x916b('0x22')](removeEntity(_0x4a98f7,null))[_0x916b('0x3d')](handleError(_0x4a98f7,null));};exports[_0x916b('0x44')]=function(_0x50cf5a,_0x270c16,_0x2d0fb5){var _0x354dca={};var _0x383c03={};var _0x1c120b;var _0x304994;return db[_0x916b('0x3a')][_0x916b('0x45')]({'where':{'id':_0x50cf5a[_0x916b('0x43')]['id']}})['then'](handleEntityNotFound(_0x270c16,null))[_0x916b('0x22')](function(_0x55620d){if(_0x55620d){_0x1c120b=_0x55620d;_0x383c03[_0x916b('0x2c')]=_['keys'](db[_0x916b('0x46')]['rawAttributes']);_0x383c03[_0x916b('0x2d')]=_[_0x916b('0x2e')](_0x50cf5a[_0x916b('0x2d')]);_0x383c03[_0x916b('0x2f')]=_[_0x916b('0x3e')](_0x383c03[_0x916b('0x2c')],_0x383c03['query']);_0x354dca[_0x916b('0x30')]=_[_0x916b('0x3e')](_0x383c03[_0x916b('0x2c')],qs[_0x916b('0x3f')](_0x50cf5a[_0x916b('0x2d')]['fields']));_0x354dca['attributes']=_0x354dca[_0x916b('0x30')][_0x916b('0x31')]?_0x354dca[_0x916b('0x30')]:_0x383c03[_0x916b('0x2c')];_0x354dca[_0x916b('0x33')]=qs[_0x916b('0x34')](_0x50cf5a['query']['sort']);_0x354dca['where']=qs[_0x916b('0x2f')](_['pick'](_0x50cf5a[_0x916b('0x2d')],_0x383c03[_0x916b('0x2f')]));if(_0x50cf5a[_0x916b('0x2d')][_0x916b('0x35')]){_0x354dca[_0x916b('0x36')]=_['merge'](_0x354dca['where'],{'$or':_['map'](_0x354dca[_0x916b('0x30')],function(_0x257f80){var _0x4b48dd={};_0x4b48dd[_0x257f80]={'$like':'%'+_0x50cf5a['query']['filter']+'%'};return _0x4b48dd;})});}_0x354dca=_[_0x916b('0x37')]({},_0x354dca,_0x50cf5a[_0x916b('0x39')]);return _0x1c120b[_0x916b('0x44')](_0x354dca);}})[_0x916b('0x22')](function(_0x248127){if(_0x248127){_0x304994=_0x248127[_0x916b('0x31')];if(!_0x50cf5a['query'][_0x916b('0x47')]('nolimit')){_0x354dca[_0x916b('0x1c')]=qs[_0x916b('0x1c')](_0x50cf5a['query'][_0x916b('0x1c')]);_0x354dca['offset']=qs[_0x916b('0x1a')](_0x50cf5a[_0x916b('0x2d')][_0x916b('0x1a')]);}return _0x1c120b[_0x916b('0x44')](_0x354dca);}})[_0x916b('0x22')](function(_0xaeb466){if(_0xaeb466){return _0xaeb466?{'count':_0x304994,'rows':_0xaeb466}:null;}})[_0x916b('0x22')](respondWithResult(_0x270c16,null))[_0x916b('0x3d')](handleError(_0x270c16,null));};exports[_0x916b('0x48')]=function(_0xd597b5,_0x3a5ae8,_0x478762){if(_0xd597b5[_0x916b('0x42')]['id']){delete _0xd597b5['body']['id'];}return db[_0x916b('0x3a')][_0x916b('0x45')]({'where':{'id':_0xd597b5['params']['id']}})['then'](handleEntityNotFound(_0x3a5ae8,null))['then'](function(_0x16700a){if(_0x16700a){_0xd597b5['body'][_0x916b('0x49')]=_0x16700a['id'];_0xd597b5[_0x916b('0x42')]['Subjects']=integrations['getSubjects'](_0xd597b5[_0x916b('0x42')]['channel'],_0xd597b5[_0x916b('0x42')][_0x916b('0x2a')]);_0xd597b5['body'][_0x916b('0x4a')]=integrations[_0x916b('0x4b')](_0xd597b5[_0x916b('0x42')][_0x916b('0x4c')],_0xd597b5[_0x916b('0x42')][_0x916b('0x2a')]);return db[_0x916b('0x46')]['create'](_0xd597b5['body'],{'include':[{'model':db[_0x916b('0x4d')],'as':_0x916b('0x4e')},{'model':db[_0x916b('0x4d')],'as':_0x916b('0x4a')}]});}return null;})[_0x916b('0x22')](respondWithResult(_0x3a5ae8,null))[_0x916b('0x3d')](handleError(_0x3a5ae8,null));};var md5=require('md5');exports['getFields']=function(_0x4429d7,_0x2dcbd0,_0x163a4c){var _0xa22d1e=null;var _0xe73463=null;var _0x84dcd7=null;var _0x21d29c=null;var _0x36df28='';return db[_0x916b('0x3a')][_0x916b('0x45')]({'where':{'id':_0x4429d7[_0x916b('0x43')]['id']},'attributes':['id',_0x916b('0x26'),_0x916b('0x4f'),_0x916b('0x50'),'moduleName',_0x916b('0x51'),_0x916b('0x52'),_0x916b('0x53')]})[_0x916b('0x22')](handleEntityNotFound(_0x2dcbd0,null))[_0x916b('0x22')](function(_0x479d0e){if(_0x479d0e){_0xa22d1e=_0x479d0e[_0x916b('0x4f')];_0xe73463=_0x479d0e[_0x916b('0x53')];_0x84dcd7=_0x479d0e[_0x916b('0x54')];_0x36df28=_0x479d0e[_0x916b('0x51')];var _0x1bfaee=_0x36df28['slice'](-0x1);if(_0x1bfaee==='/'){_0x36df28=_0x36df28[_0x916b('0x55')](0x0,_0x36df28['lastIndexOf'](_0x1bfaee));}_0x21d29c=util['format'](_0x916b('0x56'),_0x36df28);var _0xee168f={'method':_0x916b('0x57'),'uri':_0x21d29c,'qs':{'operation':_0x916b('0x58'),'username':_0x479d0e[_0x916b('0x4f')]},'json':!![]};return rp(_0xee168f);}})['then'](function(_0x3ecf27){if(_0x3ecf27[_0x916b('0x59')]){var _0x149c58={'method':_0x916b('0x5a'),'uri':_0x21d29c,'form':{'operation':_0x916b('0x5b'),'username':_0xa22d1e,'accessKey':md5(_0x3ecf27[_0x916b('0x5c')][_0x916b('0x5d')]+_0xe73463)},'json':!![]};return rp(_0x149c58);}})[_0x916b('0x22')](function(_0x45e650){if(_0x45e650[_0x916b('0x59')]){var _0x3c12b6={'method':_0x916b('0x57'),'uri':_0x21d29c,'qs':{'operation':_0x916b('0x5e'),'username':_0xa22d1e,'sessionName':_0x45e650['result']['sessionName'],'elementType':_0x84dcd7},'json':!![]};return rp(_0x3c12b6);}})[_0x916b('0x22')](function(_0x451f0a){if(_0x451f0a['success']){var _0x5b49f7=['autogenerated',_0x916b('0x5f'),'owner'];_[_0x916b('0x60')](_0x451f0a['result'][_0x916b('0x3f')],function(_0x3aaa52){return _0x5b49f7[_0x916b('0x61')](_0x3aaa52[_0x916b('0x2a')][_0x916b('0x26')]);});_[_0x916b('0x60')](_0x451f0a['result']['fields'],function(_0x32c3df){return _0x32c3df[_0x916b('0x62')]==='false';});return{'count':_0x451f0a[_0x916b('0x5c')]['fields'][_0x916b('0x31')],'rows':_[_0x916b('0x27')](_0x451f0a['result'][_0x916b('0x3f')],function(_0x528a0e){return{'id':_0x528a0e[_0x916b('0x26')],'name':_0x528a0e['label'],'custom':_[_0x916b('0x63')](_0x528a0e[_0x916b('0x26')],'cf_')?!![]:![],'options':_0x528a0e[_0x916b('0x2a')][_0x916b('0x26')]===_0x916b('0x64')&&_0x528a0e['type'][_0x916b('0x65')][_0x916b('0x31')]>0x0?_[_0x916b('0x27')](_0x528a0e[_0x916b('0x2a')]['picklistValues'],function(_0x2ed267){return{'name':_0x2ed267[_0x916b('0x66')],'value':_0x2ed267['value']};}):[]};})};}})[_0x916b('0x22')](respondWithResult(_0x2dcbd0,null))['catch'](function(_0x14a06f){console[_0x916b('0x67')](_0x916b('0x68')+_0x14a06f);var _0x183881=_0x4429d7[_0x916b('0x2d')][_0x916b('0x69')]?0x1f4:_0x14a06f[_0x916b('0x6a')]||0x1f4;logger[_0x916b('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x916b('0x6b'),_0x183881,JSON[_0x916b('0x6c')](_0x14a06f));delete _0x14a06f[_0x916b('0x26')];if(_0x183881===0x191){_0x183881=0x190;}_0x2dcbd0['status'](_0x183881)[_0x916b('0x6d')](_0x4429d7[_0x916b('0x2d')][_0x916b('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x14a06f[_0x916b('0x6a')]}:_0x14a06f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 7d9a4f7..9793bf3 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 _0x5986=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts'];(function(_0x285444,_0x4c088d){var _0x3e218b=function(_0x32d09e){while(--_0x32d09e){_0x285444['push'](_0x285444['shift']());}};_0x3e218b(++_0x4c088d);}(_0x5986,0x1ad));var _0x6598=function(_0x132700,_0x121c2e){_0x132700=_0x132700-0x0;var _0x19bc9f=_0x5986[_0x132700];return _0x19bc9f;};'use strict';var _=require(_0x6598('0x0'));var util=require(_0x6598('0x1'));var logger=require(_0x6598('0x2'))(_0x6598('0x3'));var moment=require(_0x6598('0x4'));var BPromise=require(_0x6598('0x5'));var rp=require(_0x6598('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6598('0x7'));var config=require(_0x6598('0x8'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x6598('0x9'));module[_0x6598('0xa')]=function(_0xbbb091,_0xb0fcc0){return _0xbbb091['define'](_0x6598('0xb'),attributes,{'tableName':_0x6598('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd572=['VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xd572,0xd4));var _0x2d57=function(_0x221fa6,_0x41696b){_0x221fa6=_0x221fa6-0x0;var _0x486a0d=_0xd572[_0x221fa6];return _0x486a0d;};'use strict';var _=require(_0x2d57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2d57('0x1'));var moment=require(_0x2d57('0x2'));var BPromise=require(_0x2d57('0x3'));var rp=require(_0x2d57('0x4'));var fs=require('fs');var path=require(_0x2d57('0x5'));var rimraf=require(_0x2d57('0x6'));var config=require(_0x2d57('0x7'));var attributes=require(_0x2d57('0x8'));var integrations=require(_0x2d57('0x9'));module[_0x2d57('0xa')]=function(_0x2a524d,_0x13cce4){return _0x2a524d[_0x2d57('0xb')](_0x2d57('0xc'),attributes,{'tableName':_0x2d57('0xd'),'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 dfdcddc..3a195a8 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 _0x76dc=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent'];(function(_0xbdfde1,_0x5402fe){var _0x3e5d47=function(_0xda3b97){while(--_0xda3b97){_0xbdfde1['push'](_0xbdfde1['shift']());}};_0x3e5d47(++_0x5402fe);}(_0x76dc,0x1f2));var _0xc76d=function(_0x469b9b,_0x1b33e5){_0x469b9b=_0x469b9b-0x0;var _0x43a76f=_0x76dc[_0x469b9b];return _0x43a76f;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});}exports[_0xc76d('0x14')]=function(_0x339623){var _0x23f3ca=this;return new Promise(function(_0xd1d16f,_0x4b0402){return db[_0xc76d('0x15')][_0xc76d('0x16')]({'raw':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x19')]||null:null,'attributes':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'limit':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1b')]||null:null,'include':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')],function(_0x5de11f){return{'model':db[_0x5de11f[_0xc76d('0x1e')]],'as':_0x5de11f['as'],'attributes':_0x5de11f[_0xc76d('0x1a')],'include':_0x5de11f['include']?_[_0xc76d('0x1d')](_0x5de11f[_0xc76d('0x1c')],function(_0x55ca79){return{'model':db[_0x55ca79[_0xc76d('0x1e')]],'as':_0x55ca79['as'],'attributes':_0x55ca79[_0xc76d('0x1a')],'include':_0x55ca79[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x55ca79[_0xc76d('0x1c')],function(_0x1949c4){return{'model':db[_0x1949c4[_0xc76d('0x1e')]],'as':_0x1949c4['as'],'attributes':_0x1949c4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x285430){logger[_0xc76d('0xa')]('GetVtigerAccount',_0x339623);logger[_0xc76d('0x1f')](_0xc76d('0x14'),_0x339623,JSON[_0xc76d('0xd')](_0x285430));_0xd1d16f(_0x285430);})['catch'](function(_0x2039f4){logger['error'](_0xc76d('0x14'),_0x2039f4[_0xc76d('0x11')],_0x339623);_0x4b0402(_0x23f3ca['error'](0x1f4,_0x2039f4[_0xc76d('0x11')]));});});};exports[_0xc76d('0x20')]=function(_0x9ab96c){var _0x2cf501=this;return new Promise(function(_0x4feeda,_0x283e16){return db['VtigerAccount'][_0xc76d('0x21')]({'raw':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x9ab96c['options']?_0x9ab96c['options']['where']||null:null,'attributes':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'include':_0x9ab96c[_0xc76d('0x17')]?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1c')]?_['map'](_0x9ab96c[_0xc76d('0x17')]['include'],function(_0x854920){return{'model':db[_0x854920['model']],'as':_0x854920['as'],'attributes':_0x854920[_0xc76d('0x1a')],'include':_0x854920[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x854920[_0xc76d('0x1c')],function(_0x2aa24d){return{'model':db[_0x2aa24d['model']],'as':_0x2aa24d['as'],'attributes':_0x2aa24d[_0xc76d('0x1a')],'include':_0x2aa24d[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x2aa24d['include'],function(_0x2f69c1){return{'model':db[_0x2f69c1[_0xc76d('0x1e')]],'as':_0x2f69c1['as'],'attributes':_0x2f69c1[_0xc76d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9cbf1e){logger[_0xc76d('0xa')](_0xc76d('0x20'),_0x9ab96c);logger[_0xc76d('0x1f')](_0xc76d('0x20'),_0x9ab96c,JSON[_0xc76d('0xd')](_0x9cbf1e));_0x4feeda(_0x9cbf1e);})['catch'](function(_0x518945){logger[_0xc76d('0xe')]('ShowVtigerAccount',_0x518945[_0xc76d('0x11')],_0x9ab96c);_0x283e16(_0x2cf501[_0xc76d('0xe')](0x1f4,_0x518945[_0xc76d('0x11')]));});});}; \ No newline at end of file +var _0x4024=['attributes','include','map','model','then','debug','ShowVtigerAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x59cbfc,_0x847b60){var _0x7253c9=function(_0x5b8734){while(--_0x5b8734){_0x59cbfc['push'](_0x59cbfc['shift']());}};_0x7253c9(++_0x847b60);}(_0x4024,0x89));var _0x4402=function(_0x3033b9,_0x56adf4){_0x3033b9=_0x3033b9-0x0;var _0x293f8b=_0x4024[_0x3033b9];return _0x293f8b;};'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});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['findAll']({'raw':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x231382[_0x4402('0x16')]?_0x231382['options']['where']||null:null,'attributes':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')][_0x4402('0x17')]||null:null,'limit':_0x231382['options']?_0x231382[_0x4402('0x16')]['limit']||null:null,'include':_0x231382['options']?_0x231382[_0x4402('0x16')][_0x4402('0x18')]?_[_0x4402('0x19')](_0x231382[_0x4402('0x16')][_0x4402('0x18')],function(_0x2e6fee){return{'model':db[_0x2e6fee[_0x4402('0x1a')]],'as':_0x2e6fee['as'],'attributes':_0x2e6fee[_0x4402('0x17')],'include':_0x2e6fee[_0x4402('0x18')]?_['map'](_0x2e6fee[_0x4402('0x18')],function(_0x4e1c04){return{'model':db[_0x4e1c04[_0x4402('0x1a')]],'as':_0x4e1c04['as'],'attributes':_0x4e1c04[_0x4402('0x17')],'include':_0x4e1c04[_0x4402('0x18')]?_[_0x4402('0x19')](_0x4e1c04['include'],function(_0x15c19f){return{'model':db[_0x15c19f['model']],'as':_0x15c19f['as'],'attributes':_0x15c19f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x395e49){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x1c')]('GetVtigerAccount',_0x231382,JSON[_0x4402('0xd')](_0x395e49));_0x494389(_0x395e49);})['catch'](function(_0x71da2f){logger[_0x4402('0xe')](_0x4402('0x14'),_0x71da2f['message'],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x71da2f[_0x4402('0x11')]));});});};exports[_0x4402('0x1d')]=function(_0x3f4bcb){var _0x2526d1=this;return new Promise(function(_0x605702,_0x1189b8){return db[_0x4402('0x15')][_0x4402('0x1e')]({'raw':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb['options'][_0x4402('0x1f')]||null:null,'attributes':_0x3f4bcb['options']?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x17')]||null:null,'include':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')]?_['map'](_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')],function(_0x169340){return{'model':db[_0x169340['model']],'as':_0x169340['as'],'attributes':_0x169340[_0x4402('0x17')],'include':_0x169340[_0x4402('0x18')]?_['map'](_0x169340[_0x4402('0x18')],function(_0x437e83){return{'model':db[_0x437e83[_0x4402('0x1a')]],'as':_0x437e83['as'],'attributes':_0x437e83[_0x4402('0x17')],'include':_0x437e83[_0x4402('0x18')]?_[_0x4402('0x19')](_0x437e83[_0x4402('0x18')],function(_0x6e9fb7){return{'model':db[_0x6e9fb7[_0x4402('0x1a')]],'as':_0x6e9fb7['as'],'attributes':_0x6e9fb7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x28fee8){logger[_0x4402('0xa')]('ShowVtigerAccount',_0x3f4bcb);logger[_0x4402('0x1c')](_0x4402('0x1d'),_0x3f4bcb,JSON['stringify'](_0x28fee8));_0x605702(_0x28fee8);})['catch'](function(_0x2b9d51){logger[_0x4402('0xe')](_0x4402('0x1d'),_0x2b9d51[_0x4402('0x11')],_0x3f4bcb);_0x1189b8(_0x2526d1['error'](0x1f4,_0x2b9d51['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a7a8afc..9da944f 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 _0x015e=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3e8f4f,_0x3acc55){var _0x47c779=function(_0x26d10d){while(--_0x26d10d){_0x3e8f4f['push'](_0x3e8f4f['shift']());}};_0x47c779(++_0x3acc55);}(_0x015e,0x1d6));var _0xe015=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x015e[_0x51c819];return _0x15c5d2;};'use strict';var multer=require(_0xe015('0x0'));var util=require(_0xe015('0x1'));var path=require('path');var timeout=require(_0xe015('0x2'));var express=require(_0xe015('0x3'));var router=express['Router']();var fs_extra=require(_0xe015('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe015('0x5'));var controller=require(_0xe015('0x6'));router[_0xe015('0x7')]('/',auth[_0xe015('0x8')](),controller[_0xe015('0x9')]);router[_0xe015('0x7')](_0xe015('0xa'),auth[_0xe015('0x8')](),controller[_0xe015('0xb')]);router[_0xe015('0x7')](_0xe015('0xc'),auth[_0xe015('0x8')](),controller[_0xe015('0xd')]);router[_0xe015('0x7')]('/:id/subjects',auth[_0xe015('0x8')](),controller[_0xe015('0xe')]);router[_0xe015('0x7')](_0xe015('0xf'),auth['isAuthenticated'](),controller[_0xe015('0x10')]);router[_0xe015('0x11')]('/',auth[_0xe015('0x8')](),controller[_0xe015('0x12')]);router[_0xe015('0x13')](_0xe015('0xa'),auth[_0xe015('0x8')](),controller[_0xe015('0x14')]);router['delete'](_0xe015('0xa'),auth[_0xe015('0x8')](),controller[_0xe015('0x15')]);module[_0xe015('0x16')]=router; \ No newline at end of file +var _0x2605=['/:id/fields','getSubjects','/:id/descriptions','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x10d2e3,_0x31ddd9){var _0x43332c=function(_0x4b4549){while(--_0x4b4549){_0x10d2e3['push'](_0x10d2e3['shift']());}};_0x43332c(++_0x31ddd9);}(_0x2605,0x142));var _0x5260=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0x2605[_0x57fa7e];return _0x320671;};'use strict';var multer=require(_0x5260('0x0'));var util=require('util');var path=require(_0x5260('0x1'));var timeout=require(_0x5260('0x2'));var express=require(_0x5260('0x3'));var router=express[_0x5260('0x4')]();var fs_extra=require(_0x5260('0x5'));var auth=require(_0x5260('0x6'));var interaction=require(_0x5260('0x7'));var config=require(_0x5260('0x8'));var controller=require('./intVtigerConfiguration.controller');router[_0x5260('0x9')]('/',auth[_0x5260('0xa')](),controller[_0x5260('0xb')]);router[_0x5260('0x9')](_0x5260('0xc'),auth[_0x5260('0xa')](),controller[_0x5260('0xd')]);router[_0x5260('0x9')](_0x5260('0xe'),auth[_0x5260('0xa')](),controller['getFields']);router[_0x5260('0x9')]('/:id/subjects',auth[_0x5260('0xa')](),controller[_0x5260('0xf')]);router[_0x5260('0x9')](_0x5260('0x10'),auth[_0x5260('0xa')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x5260('0x11')]);router[_0x5260('0x12')](_0x5260('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x5260('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x5260('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 56a76c0..a86c998 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 _0x18a5=['STRING','sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x18a5,0x19c));var _0x518a=function(_0x26d41f,_0x431275){_0x26d41f=_0x26d41f-0x0;var _0xb5e53f=_0x18a5[_0x26d41f];return _0xb5e53f;};'use strict';var Sequelize=require(_0x518a('0x0'));module[_0x518a('0x1')]={'name':{'type':Sequelize[_0x518a('0x2')]},'description':{'type':Sequelize[_0x518a('0x2')]}}; \ No newline at end of file +var _0x6ad3=['STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6ad3,0x106));var _0x36ad=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0x6ad3[_0x4e7c1c];return _0x47adb2;};'use strict';var Sequelize=require(_0x36ad('0x0'));module[_0x36ad('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x36ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 849ed65..e9cae55 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 _0x0c87=['Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','VtigerConfiguration','include','findAll','show','params','keys','includeAll','find','catch','create','update','body','getFields','findOne','options','nolimit','getSubjects','VtigerField','pick','getDescriptions','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set'];(function(_0x5d07a8,_0x383775){var _0x37401c=function(_0x5a2e33){while(--_0x5a2e33){_0x5d07a8['push'](_0x5d07a8['shift']());}};_0x37401c(++_0x383775);}(_0x0c87,0x1d5));var _0x70c8=function(_0xc932e7,_0x40e588){_0xc932e7=_0xc932e7-0x0;var _0x59fecc=_0x0c87[_0xc932e7];return _0x59fecc;};'use strict';var emlformat=require(_0x70c8('0x0'));var rimraf=require(_0x70c8('0x1'));var zipdir=require(_0x70c8('0x2'));var jsonpatch=require(_0x70c8('0x3'));var rp=require(_0x70c8('0x4'));var moment=require(_0x70c8('0x5'));var BPromise=require(_0x70c8('0x6'));var Mustache=require(_0x70c8('0x7'));var util=require(_0x70c8('0x8'));var path=require('path');var sox=require(_0x70c8('0x9'));var csv=require(_0x70c8('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x70c8('0xb'));var _=require(_0x70c8('0xc'));var squel=require(_0x70c8('0xd'));var crypto=require(_0x70c8('0xe'));var jsforce=require(_0x70c8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x70c8('0xa'));var querystring=require(_0x70c8('0x10'));var Papa=require(_0x70c8('0x11'));var Redis=require(_0x70c8('0x12'));var authService=require(_0x70c8('0x13'));var qs=require(_0x70c8('0x14'));var as=require(_0x70c8('0x15'));var hardwareService=require(_0x70c8('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x70c8('0x17'));var config=require(_0x70c8('0x18'));var licenseUtil=require(_0x70c8('0x19'));var db=require(_0x70c8('0x1a'))['db'];function respondWithStatusCode(_0x332daf,_0x2cbbef){_0x2cbbef=_0x2cbbef||0xcc;return function(_0x522653){if(_0x522653){return _0x332daf[_0x70c8('0x1b')](_0x2cbbef);}return _0x332daf['status'](_0x2cbbef)[_0x70c8('0x1c')]();};}function respondWithResult(_0xca91ac,_0x43ad67){_0x43ad67=_0x43ad67||0xc8;return function(_0xf4bd1a){if(_0xf4bd1a){return _0xca91ac[_0x70c8('0x1d')](_0x43ad67)['json'](_0xf4bd1a);}};}function respondWithFilteredResult(_0x3a4d6c,_0x372c20){return function(_0x12dfef){if(_0x12dfef){var _0x3d7a12=typeof _0x372c20[_0x70c8('0x1e')]==='undefined'&&typeof _0x372c20[_0x70c8('0x1f')]===_0x70c8('0x20');var _0x11b298=_0x12dfef[_0x70c8('0x21')];var _0x3db296=_0x3d7a12?0x0:_0x372c20[_0x70c8('0x1e')];var _0xf22a97=_0x3d7a12?_0x12dfef[_0x70c8('0x21')]:_0x372c20[_0x70c8('0x1e')]+_0x372c20['limit'];var _0x4c0f58;if(_0xf22a97>=_0x11b298){_0xf22a97=_0x11b298;_0x4c0f58=0xc8;}else{_0x4c0f58=0xce;}_0x3a4d6c[_0x70c8('0x1d')](_0x4c0f58);return _0x3a4d6c[_0x70c8('0x22')](_0x70c8('0x23'),_0x3db296+'-'+_0xf22a97+'/'+_0x11b298)[_0x70c8('0x24')](_0x12dfef);}return null;};}function patchUpdates(_0x159e6d){return function(_0x3c7881){try{jsonpatch[_0x70c8('0x25')](_0x3c7881,_0x159e6d,!![]);}catch(_0xcb599f){return BPromise[_0x70c8('0x26')](_0xcb599f);}return _0x3c7881['save']();};}function saveUpdates(_0x3eff17,_0x390258){return function(_0x1e8d8d){if(_0x1e8d8d){return _0x1e8d8d['update'](_0x3eff17)[_0x70c8('0x27')](function(_0x16b110){return _0x16b110;});}return null;};}function removeEntity(_0x37abec,_0x3adedd){return function(_0x118f0d){if(_0x118f0d){return _0x118f0d[_0x70c8('0x28')]()['then'](function(){_0x37abec['status'](0xcc)[_0x70c8('0x1c')]();});}};}function handleEntityNotFound(_0x550009,_0x41a168){return function(_0xd0da8b){if(!_0xd0da8b){_0x550009[_0x70c8('0x1b')](0x194);}return _0xd0da8b;};}function handleError(_0x1e1554,_0x2e9ed5){_0x2e9ed5=_0x2e9ed5||0x1f4;return function(_0x502cc7){logger[_0x70c8('0x29')](_0x502cc7[_0x70c8('0x2a')]);if(_0x502cc7['name']){delete _0x502cc7[_0x70c8('0x2b')];}_0x1e1554[_0x70c8('0x1d')](_0x2e9ed5)['send'](_0x502cc7);};}exports[_0x70c8('0x2c')]=function(_0x3e9d15,_0x31f0cc){var _0x124f35={},_0x4d0cb5={},_0x595a83={'count':0x0,'rows':[]};var _0x511e0d=_[_0x70c8('0x2d')](db['VtigerConfiguration'][_0x70c8('0x2e')],function(_0x1bba62){return{'name':_0x1bba62[_0x70c8('0x2f')],'type':_0x1bba62[_0x70c8('0x30')][_0x70c8('0x31')]};});_0x4d0cb5[_0x70c8('0x32')]=_[_0x70c8('0x2d')](_0x511e0d,_0x70c8('0x2b'));_0x4d0cb5[_0x70c8('0x33')]=_['keys'](_0x3e9d15[_0x70c8('0x33')]);_0x4d0cb5[_0x70c8('0x34')]=_[_0x70c8('0x35')](_0x4d0cb5[_0x70c8('0x32')],_0x4d0cb5[_0x70c8('0x33')]);_0x124f35[_0x70c8('0x36')]=_[_0x70c8('0x35')](_0x4d0cb5[_0x70c8('0x32')],qs[_0x70c8('0x37')](_0x3e9d15['query'][_0x70c8('0x37')]));_0x124f35[_0x70c8('0x36')]=_0x124f35[_0x70c8('0x36')][_0x70c8('0x38')]?_0x124f35[_0x70c8('0x36')]:_0x4d0cb5[_0x70c8('0x32')];if(!_0x3e9d15[_0x70c8('0x33')][_0x70c8('0x39')]('nolimit')){_0x124f35['limit']=qs[_0x70c8('0x1f')](_0x3e9d15[_0x70c8('0x33')][_0x70c8('0x1f')]);_0x124f35['offset']=qs['offset'](_0x3e9d15['query'][_0x70c8('0x1e')]);}_0x124f35['order']=qs[_0x70c8('0x3a')](_0x3e9d15[_0x70c8('0x33')][_0x70c8('0x3a')]);_0x124f35[_0x70c8('0x3b')]=qs['filters'](_['pick'](_0x3e9d15[_0x70c8('0x33')],_0x4d0cb5[_0x70c8('0x34')]),_0x511e0d);if(_0x3e9d15['query'][_0x70c8('0x3c')]){_0x124f35[_0x70c8('0x3b')]=_[_0x70c8('0x3d')](_0x124f35['where'],{'$or':_[_0x70c8('0x2d')](_0x511e0d,function(_0x52d36d){if(_0x52d36d[_0x70c8('0x30')]!==_0x70c8('0x3e')){var _0x264efe={};_0x264efe[_0x52d36d['name']]={'$like':'%'+_0x3e9d15[_0x70c8('0x33')][_0x70c8('0x3c')]+'%'};return _0x264efe;}})});}_0x124f35=_['merge']({},_0x124f35,_0x3e9d15['options']);var _0x4daf20={'where':_0x124f35[_0x70c8('0x3b')]};return db[_0x70c8('0x3f')]['count'](_0x4daf20)[_0x70c8('0x27')](function(_0x14c3d9){_0x595a83[_0x70c8('0x21')]=_0x14c3d9;if(_0x3e9d15[_0x70c8('0x33')]['includeAll']){_0x124f35[_0x70c8('0x40')]=[{'all':!![]}];}return db[_0x70c8('0x3f')][_0x70c8('0x41')](_0x124f35);})[_0x70c8('0x27')](function(_0x3659e1){_0x595a83['rows']=_0x3659e1;return _0x595a83;})[_0x70c8('0x27')](respondWithFilteredResult(_0x31f0cc,_0x124f35))['catch'](handleError(_0x31f0cc,null));};exports[_0x70c8('0x42')]=function(_0x2d18e9,_0x11c8fb){var _0x4f94f7={'raw':![],'where':{'id':_0x2d18e9[_0x70c8('0x43')]['id']}},_0x1ab1b0={};_0x1ab1b0[_0x70c8('0x32')]=_[_0x70c8('0x44')](db['VtigerConfiguration'][_0x70c8('0x2e')]);_0x1ab1b0[_0x70c8('0x33')]=_[_0x70c8('0x44')](_0x2d18e9[_0x70c8('0x33')]);_0x1ab1b0[_0x70c8('0x34')]=_[_0x70c8('0x35')](_0x1ab1b0[_0x70c8('0x32')],_0x1ab1b0[_0x70c8('0x33')]);_0x4f94f7[_0x70c8('0x36')]=_[_0x70c8('0x35')](_0x1ab1b0['model'],qs[_0x70c8('0x37')](_0x2d18e9[_0x70c8('0x33')][_0x70c8('0x37')]));_0x4f94f7['attributes']=_0x4f94f7[_0x70c8('0x36')][_0x70c8('0x38')]?_0x4f94f7[_0x70c8('0x36')]:_0x1ab1b0[_0x70c8('0x32')];if(_0x2d18e9[_0x70c8('0x33')][_0x70c8('0x45')]){_0x4f94f7[_0x70c8('0x40')]=[{'all':!![]}];}_0x4f94f7=_[_0x70c8('0x3d')]({},_0x4f94f7,_0x2d18e9['options']);return db[_0x70c8('0x3f')][_0x70c8('0x46')](_0x4f94f7)[_0x70c8('0x27')](handleEntityNotFound(_0x11c8fb,null))[_0x70c8('0x27')](respondWithResult(_0x11c8fb,null))[_0x70c8('0x47')](handleError(_0x11c8fb,null));};exports['create']=function(_0x5442eb,_0x15c506){return db[_0x70c8('0x3f')][_0x70c8('0x48')](_0x5442eb['body'],{})[_0x70c8('0x27')](respondWithResult(_0x15c506,0xc9))[_0x70c8('0x47')](handleError(_0x15c506,null));};exports[_0x70c8('0x49')]=function(_0x3fd106,_0x408f2c){if(_0x3fd106[_0x70c8('0x4a')]['id']){delete _0x3fd106[_0x70c8('0x4a')]['id'];}return db[_0x70c8('0x3f')][_0x70c8('0x46')]({'where':{'id':_0x3fd106[_0x70c8('0x43')]['id']}})[_0x70c8('0x27')](handleEntityNotFound(_0x408f2c,null))['then'](saveUpdates(_0x3fd106[_0x70c8('0x4a')],null))[_0x70c8('0x27')](respondWithResult(_0x408f2c,null))[_0x70c8('0x47')](handleError(_0x408f2c,null));};exports[_0x70c8('0x28')]=function(_0x4f5bfd,_0x3baa7d){return db[_0x70c8('0x3f')][_0x70c8('0x46')]({'where':{'id':_0x4f5bfd[_0x70c8('0x43')]['id']}})[_0x70c8('0x27')](handleEntityNotFound(_0x3baa7d,null))['then'](removeEntity(_0x3baa7d,null))[_0x70c8('0x47')](handleError(_0x3baa7d,null));};exports[_0x70c8('0x4b')]=function(_0x152b13,_0x4590c8,_0x377279){var _0x29521d={};var _0x2140e9={};var _0x242789;var _0x228d16;return db[_0x70c8('0x3f')][_0x70c8('0x4c')]({'where':{'id':_0x152b13[_0x70c8('0x43')]['id']}})[_0x70c8('0x27')](handleEntityNotFound(_0x4590c8,null))[_0x70c8('0x27')](function(_0x23a804){if(_0x23a804){_0x242789=_0x23a804;_0x2140e9[_0x70c8('0x32')]=_[_0x70c8('0x44')](db['VtigerField'][_0x70c8('0x2e')]);_0x2140e9['query']=_[_0x70c8('0x44')](_0x152b13[_0x70c8('0x33')]);_0x2140e9[_0x70c8('0x34')]=_[_0x70c8('0x35')](_0x2140e9[_0x70c8('0x32')],_0x2140e9[_0x70c8('0x33')]);_0x29521d[_0x70c8('0x36')]=_[_0x70c8('0x35')](_0x2140e9[_0x70c8('0x32')],qs[_0x70c8('0x37')](_0x152b13[_0x70c8('0x33')][_0x70c8('0x37')]));_0x29521d[_0x70c8('0x36')]=_0x29521d[_0x70c8('0x36')]['length']?_0x29521d['attributes']:_0x2140e9[_0x70c8('0x32')];_0x29521d['order']=qs[_0x70c8('0x3a')](_0x152b13[_0x70c8('0x33')][_0x70c8('0x3a')]);_0x29521d[_0x70c8('0x3b')]=qs[_0x70c8('0x34')](_['pick'](_0x152b13['query'],_0x2140e9[_0x70c8('0x34')]));if(_0x152b13['query'][_0x70c8('0x3c')]){_0x29521d['where']=_['merge'](_0x29521d['where'],{'$or':_['map'](_0x29521d[_0x70c8('0x36')],function(_0xf1676){var _0x389b40={};_0x389b40[_0xf1676]={'$like':'%'+_0x152b13[_0x70c8('0x33')][_0x70c8('0x3c')]+'%'};return _0x389b40;})});}_0x29521d=_[_0x70c8('0x3d')]({},_0x29521d,_0x152b13[_0x70c8('0x4d')]);return _0x242789['getFields'](_0x29521d);}})['then'](function(_0x1897f9){if(_0x1897f9){_0x228d16=_0x1897f9[_0x70c8('0x38')];if(!_0x152b13['query'][_0x70c8('0x39')](_0x70c8('0x4e'))){_0x29521d['limit']=qs[_0x70c8('0x1f')](_0x152b13[_0x70c8('0x33')][_0x70c8('0x1f')]);_0x29521d[_0x70c8('0x1e')]=qs[_0x70c8('0x1e')](_0x152b13['query'][_0x70c8('0x1e')]);}return _0x242789[_0x70c8('0x4b')](_0x29521d);}})[_0x70c8('0x27')](function(_0x2569f6){if(_0x2569f6){return _0x2569f6?{'count':_0x228d16,'rows':_0x2569f6}:null;}})[_0x70c8('0x27')](respondWithResult(_0x4590c8,null))[_0x70c8('0x47')](handleError(_0x4590c8,null));};exports[_0x70c8('0x4f')]=function(_0x3f30d3,_0x4d398,_0x5b7a99){var _0x42d756={};var _0x2e17af={};var _0x263556;var _0x3f9f65;return db['VtigerConfiguration'][_0x70c8('0x4c')]({'where':{'id':_0x3f30d3[_0x70c8('0x43')]['id']}})[_0x70c8('0x27')](handleEntityNotFound(_0x4d398,null))['then'](function(_0x36cfd5){if(_0x36cfd5){_0x263556=_0x36cfd5;_0x2e17af[_0x70c8('0x32')]=_[_0x70c8('0x44')](db[_0x70c8('0x50')][_0x70c8('0x2e')]);_0x2e17af['query']=_[_0x70c8('0x44')](_0x3f30d3['query']);_0x2e17af[_0x70c8('0x34')]=_[_0x70c8('0x35')](_0x2e17af[_0x70c8('0x32')],_0x2e17af[_0x70c8('0x33')]);_0x42d756[_0x70c8('0x36')]=_[_0x70c8('0x35')](_0x2e17af[_0x70c8('0x32')],qs['fields'](_0x3f30d3[_0x70c8('0x33')]['fields']));_0x42d756[_0x70c8('0x36')]=_0x42d756[_0x70c8('0x36')][_0x70c8('0x38')]?_0x42d756[_0x70c8('0x36')]:_0x2e17af['model'];_0x42d756['order']=qs[_0x70c8('0x3a')](_0x3f30d3[_0x70c8('0x33')][_0x70c8('0x3a')]);_0x42d756[_0x70c8('0x3b')]=qs[_0x70c8('0x34')](_[_0x70c8('0x51')](_0x3f30d3['query'],_0x2e17af[_0x70c8('0x34')]));if(_0x3f30d3[_0x70c8('0x33')][_0x70c8('0x3c')]){_0x42d756[_0x70c8('0x3b')]=_[_0x70c8('0x3d')](_0x42d756[_0x70c8('0x3b')],{'$or':_[_0x70c8('0x2d')](_0x42d756[_0x70c8('0x36')],function(_0xc0e23b){var _0x301809={};_0x301809[_0xc0e23b]={'$like':'%'+_0x3f30d3['query'][_0x70c8('0x3c')]+'%'};return _0x301809;})});}_0x42d756=_['merge']({},_0x42d756,_0x3f30d3[_0x70c8('0x4d')]);return _0x263556[_0x70c8('0x4f')](_0x42d756);}})[_0x70c8('0x27')](function(_0x5751fd){if(_0x5751fd){_0x3f9f65=_0x5751fd[_0x70c8('0x38')];if(!_0x3f30d3[_0x70c8('0x33')][_0x70c8('0x39')]('nolimit')){_0x42d756[_0x70c8('0x1f')]=qs[_0x70c8('0x1f')](_0x3f30d3[_0x70c8('0x33')][_0x70c8('0x1f')]);_0x42d756[_0x70c8('0x1e')]=qs[_0x70c8('0x1e')](_0x3f30d3[_0x70c8('0x33')][_0x70c8('0x1e')]);}return _0x263556['getSubjects'](_0x42d756);}})[_0x70c8('0x27')](function(_0x41204c){if(_0x41204c){return _0x41204c?{'count':_0x3f9f65,'rows':_0x41204c}:null;}})[_0x70c8('0x27')](respondWithResult(_0x4d398,null))['catch'](handleError(_0x4d398,null));};exports[_0x70c8('0x52')]=function(_0x1fad1c,_0x4fd563,_0x256637){var _0x427443={};var _0x453189={};var _0x5be8ba;var _0x50c620;return db[_0x70c8('0x3f')][_0x70c8('0x4c')]({'where':{'id':_0x1fad1c['params']['id']}})[_0x70c8('0x27')](handleEntityNotFound(_0x4fd563,null))[_0x70c8('0x27')](function(_0xc54a72){if(_0xc54a72){_0x5be8ba=_0xc54a72;_0x453189[_0x70c8('0x32')]=_[_0x70c8('0x44')](db[_0x70c8('0x50')][_0x70c8('0x2e')]);_0x453189['query']=_[_0x70c8('0x44')](_0x1fad1c[_0x70c8('0x33')]);_0x453189[_0x70c8('0x34')]=_[_0x70c8('0x35')](_0x453189[_0x70c8('0x32')],_0x453189['query']);_0x427443[_0x70c8('0x36')]=_['intersection'](_0x453189['model'],qs[_0x70c8('0x37')](_0x1fad1c[_0x70c8('0x33')]['fields']));_0x427443['attributes']=_0x427443[_0x70c8('0x36')]['length']?_0x427443[_0x70c8('0x36')]:_0x453189[_0x70c8('0x32')];_0x427443[_0x70c8('0x53')]=qs[_0x70c8('0x3a')](_0x1fad1c[_0x70c8('0x33')]['sort']);_0x427443[_0x70c8('0x3b')]=qs[_0x70c8('0x34')](_['pick'](_0x1fad1c[_0x70c8('0x33')],_0x453189[_0x70c8('0x34')]));if(_0x1fad1c[_0x70c8('0x33')]['filter']){_0x427443[_0x70c8('0x3b')]=_['merge'](_0x427443[_0x70c8('0x3b')],{'$or':_[_0x70c8('0x2d')](_0x427443['attributes'],function(_0xf98f51){var _0xe854c={};_0xe854c[_0xf98f51]={'$like':'%'+_0x1fad1c[_0x70c8('0x33')][_0x70c8('0x3c')]+'%'};return _0xe854c;})});}_0x427443=_[_0x70c8('0x3d')]({},_0x427443,_0x1fad1c[_0x70c8('0x4d')]);return _0x5be8ba[_0x70c8('0x52')](_0x427443);}})['then'](function(_0x3d5c23){if(_0x3d5c23){_0x50c620=_0x3d5c23['length'];if(!_0x1fad1c['query'][_0x70c8('0x39')](_0x70c8('0x4e'))){_0x427443[_0x70c8('0x1f')]=qs[_0x70c8('0x1f')](_0x1fad1c[_0x70c8('0x33')][_0x70c8('0x1f')]);_0x427443[_0x70c8('0x1e')]=qs[_0x70c8('0x1e')](_0x1fad1c[_0x70c8('0x33')][_0x70c8('0x1e')]);}return _0x5be8ba[_0x70c8('0x52')](_0x427443);}})['then'](function(_0x4cb982){if(_0x4cb982){return _0x4cb982?{'count':_0x50c620,'rows':_0x4cb982}:null;}})['then'](respondWithResult(_0x4fd563,null))[_0x70c8('0x47')](handleError(_0x4fd563,null));}; \ No newline at end of file +var _0x9734=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','update','then','destroy','error','name','index','map','VtigerConfiguration','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','catch','findOne','VtigerField','getFields','getSubjects','getDescriptions','order','nolimit','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x348652,_0x1ab849){var _0x18a9ea=function(_0x3fd540){while(--_0x3fd540){_0x348652['push'](_0x348652['shift']());}};_0x18a9ea(++_0x1ab849);}(_0x9734,0xe0));var _0x4973=function(_0x494795,_0x3345fe){_0x494795=_0x494795-0x0;var _0x22730b=_0x9734[_0x494795];return _0x22730b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4973('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4973('0x1'));var rp=require(_0x4973('0x2'));var moment=require(_0x4973('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4973('0x4'));var util=require(_0x4973('0x5'));var path=require(_0x4973('0x6'));var sox=require(_0x4973('0x7'));var csv=require(_0x4973('0x8'));var ejs=require(_0x4973('0x9'));var fs=require('fs');var fs_extra=require(_0x4973('0xa'));var _=require(_0x4973('0xb'));var squel=require(_0x4973('0xc'));var crypto=require(_0x4973('0xd'));var jsforce=require(_0x4973('0xe'));var deskjs=require(_0x4973('0xf'));var toCsv=require(_0x4973('0x8'));var querystring=require(_0x4973('0x10'));var Papa=require('papaparse');var Redis=require(_0x4973('0x11'));var authService=require(_0x4973('0x12'));var qs=require(_0x4973('0x13'));var as=require(_0x4973('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4973('0x15'))(_0x4973('0x16'));var utils=require(_0x4973('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4973('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4053a1,_0x105ffd){_0x105ffd=_0x105ffd||0xcc;return function(_0x11a717){if(_0x11a717){return _0x4053a1[_0x4973('0x19')](_0x105ffd);}return _0x4053a1[_0x4973('0x1a')](_0x105ffd)[_0x4973('0x1b')]();};}function respondWithResult(_0x54c4ec,_0x448c3b){_0x448c3b=_0x448c3b||0xc8;return function(_0x25a85e){if(_0x25a85e){return _0x54c4ec['status'](_0x448c3b)[_0x4973('0x1c')](_0x25a85e);}};}function respondWithFilteredResult(_0x3a826c,_0x31debc){return function(_0x37be18){if(_0x37be18){var _0x59ff66=typeof _0x31debc['offset']==='undefined'&&typeof _0x31debc[_0x4973('0x1d')]===_0x4973('0x1e');var _0x523b0c=_0x37be18[_0x4973('0x1f')];var _0x35d50c=_0x59ff66?0x0:_0x31debc[_0x4973('0x20')];var _0x37f364=_0x59ff66?_0x37be18[_0x4973('0x1f')]:_0x31debc[_0x4973('0x20')]+_0x31debc[_0x4973('0x1d')];var _0x40a30f;if(_0x37f364>=_0x523b0c){_0x37f364=_0x523b0c;_0x40a30f=0xc8;}else{_0x40a30f=0xce;}_0x3a826c[_0x4973('0x1a')](_0x40a30f);return _0x3a826c[_0x4973('0x21')]('Content-Range',_0x35d50c+'-'+_0x37f364+'/'+_0x523b0c)[_0x4973('0x1c')](_0x37be18);}return null;};}function patchUpdates(_0x445941){return function(_0x2896d9){try{jsonpatch[_0x4973('0x22')](_0x2896d9,_0x445941,!![]);}catch(_0x106405){return BPromise[_0x4973('0x23')](_0x106405);}return _0x2896d9['save']();};}function saveUpdates(_0x253a3d,_0x2e4a8c){return function(_0x50a75c){if(_0x50a75c){return _0x50a75c[_0x4973('0x24')](_0x253a3d)[_0x4973('0x25')](function(_0x206fce){return _0x206fce;});}return null;};}function removeEntity(_0x35b51b,_0x165d85){return function(_0x1e9cc1){if(_0x1e9cc1){return _0x1e9cc1[_0x4973('0x26')]()['then'](function(){_0x35b51b[_0x4973('0x1a')](0xcc)[_0x4973('0x1b')]();});}};}function handleEntityNotFound(_0x551c0f,_0x5ccd73){return function(_0x114d01){if(!_0x114d01){_0x551c0f[_0x4973('0x19')](0x194);}return _0x114d01;};}function handleError(_0x4fa33d,_0x2a5f82){_0x2a5f82=_0x2a5f82||0x1f4;return function(_0x4dee9f){logger[_0x4973('0x27')](_0x4dee9f['stack']);if(_0x4dee9f[_0x4973('0x28')]){delete _0x4dee9f['name'];}_0x4fa33d['status'](_0x2a5f82)['send'](_0x4dee9f);};}exports[_0x4973('0x29')]=function(_0x4b3424,_0x4a40d1){var _0x4835ab={},_0x558f80={},_0x58ace2={'count':0x0,'rows':[]};var _0x5e1606=_[_0x4973('0x2a')](db[_0x4973('0x2b')][_0x4973('0x2c')],function(_0x4bd191){return{'name':_0x4bd191['fieldName'],'type':_0x4bd191['type'][_0x4973('0x2d')]};});_0x558f80[_0x4973('0x2e')]=_[_0x4973('0x2a')](_0x5e1606,_0x4973('0x28'));_0x558f80['query']=_[_0x4973('0x2f')](_0x4b3424[_0x4973('0x30')]);_0x558f80['filters']=_['intersection'](_0x558f80[_0x4973('0x2e')],_0x558f80[_0x4973('0x30')]);_0x4835ab[_0x4973('0x31')]=_[_0x4973('0x32')](_0x558f80[_0x4973('0x2e')],qs[_0x4973('0x33')](_0x4b3424[_0x4973('0x30')][_0x4973('0x33')]));_0x4835ab[_0x4973('0x31')]=_0x4835ab['attributes'][_0x4973('0x34')]?_0x4835ab[_0x4973('0x31')]:_0x558f80['model'];if(!_0x4b3424['query'][_0x4973('0x35')]('nolimit')){_0x4835ab[_0x4973('0x1d')]=qs[_0x4973('0x1d')](_0x4b3424[_0x4973('0x30')][_0x4973('0x1d')]);_0x4835ab['offset']=qs[_0x4973('0x20')](_0x4b3424[_0x4973('0x30')][_0x4973('0x20')]);}_0x4835ab['order']=qs['sort'](_0x4b3424[_0x4973('0x30')][_0x4973('0x36')]);_0x4835ab[_0x4973('0x37')]=qs['filters'](_[_0x4973('0x38')](_0x4b3424[_0x4973('0x30')],_0x558f80[_0x4973('0x39')]),_0x5e1606);if(_0x4b3424['query']['filter']){_0x4835ab[_0x4973('0x37')]=_[_0x4973('0x3a')](_0x4835ab['where'],{'$or':_[_0x4973('0x2a')](_0x5e1606,function(_0x1573a3){if(_0x1573a3[_0x4973('0x3b')]!==_0x4973('0x3c')){var _0x2059a0={};_0x2059a0[_0x1573a3[_0x4973('0x28')]]={'$like':'%'+_0x4b3424[_0x4973('0x30')][_0x4973('0x3d')]+'%'};return _0x2059a0;}})});}_0x4835ab=_[_0x4973('0x3a')]({},_0x4835ab,_0x4b3424[_0x4973('0x3e')]);var _0x58a738={'where':_0x4835ab[_0x4973('0x37')]};return db[_0x4973('0x2b')]['count'](_0x58a738)[_0x4973('0x25')](function(_0x18d315){_0x58ace2[_0x4973('0x1f')]=_0x18d315;if(_0x4b3424[_0x4973('0x30')][_0x4973('0x3f')]){_0x4835ab[_0x4973('0x40')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x4973('0x41')](_0x4835ab);})[_0x4973('0x25')](function(_0x5b7a3e){_0x58ace2[_0x4973('0x42')]=_0x5b7a3e;return _0x58ace2;})['then'](respondWithFilteredResult(_0x4a40d1,_0x4835ab))['catch'](handleError(_0x4a40d1,null));};exports[_0x4973('0x43')]=function(_0x23c165,_0x5a75c8){var _0x26527e={'raw':![],'where':{'id':_0x23c165[_0x4973('0x44')]['id']}},_0x1373bb={};_0x1373bb[_0x4973('0x2e')]=_[_0x4973('0x2f')](db[_0x4973('0x2b')][_0x4973('0x2c')]);_0x1373bb['query']=_[_0x4973('0x2f')](_0x23c165[_0x4973('0x30')]);_0x1373bb[_0x4973('0x39')]=_[_0x4973('0x32')](_0x1373bb['model'],_0x1373bb[_0x4973('0x30')]);_0x26527e['attributes']=_[_0x4973('0x32')](_0x1373bb[_0x4973('0x2e')],qs['fields'](_0x23c165['query'][_0x4973('0x33')]));_0x26527e[_0x4973('0x31')]=_0x26527e['attributes']['length']?_0x26527e[_0x4973('0x31')]:_0x1373bb[_0x4973('0x2e')];if(_0x23c165['query'][_0x4973('0x3f')]){_0x26527e[_0x4973('0x40')]=[{'all':!![]}];}_0x26527e=_['merge']({},_0x26527e,_0x23c165[_0x4973('0x3e')]);return db[_0x4973('0x2b')]['find'](_0x26527e)[_0x4973('0x25')](handleEntityNotFound(_0x5a75c8,null))[_0x4973('0x25')](respondWithResult(_0x5a75c8,null))['catch'](handleError(_0x5a75c8,null));};exports[_0x4973('0x45')]=function(_0x37361f,_0x3489a7){return db[_0x4973('0x2b')][_0x4973('0x45')](_0x37361f[_0x4973('0x46')],{})[_0x4973('0x25')](respondWithResult(_0x3489a7,0xc9))[_0x4973('0x47')](handleError(_0x3489a7,null));};exports[_0x4973('0x24')]=function(_0xf5beba,_0x4f4f34){if(_0xf5beba[_0x4973('0x46')]['id']){delete _0xf5beba[_0x4973('0x46')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0xf5beba['params']['id']}})[_0x4973('0x25')](handleEntityNotFound(_0x4f4f34,null))[_0x4973('0x25')](saveUpdates(_0xf5beba[_0x4973('0x46')],null))['then'](respondWithResult(_0x4f4f34,null))['catch'](handleError(_0x4f4f34,null));};exports[_0x4973('0x26')]=function(_0x5259a9,_0x439524){return db[_0x4973('0x2b')]['find']({'where':{'id':_0x5259a9['params']['id']}})['then'](handleEntityNotFound(_0x439524,null))['then'](removeEntity(_0x439524,null))['catch'](handleError(_0x439524,null));};exports['getFields']=function(_0x15e97d,_0x138bca,_0x51f360){var _0x2183b2={};var _0x36d342={};var _0x2a6a50;var _0x780bf5;return db['VtigerConfiguration'][_0x4973('0x48')]({'where':{'id':_0x15e97d[_0x4973('0x44')]['id']}})['then'](handleEntityNotFound(_0x138bca,null))['then'](function(_0x8279c2){if(_0x8279c2){_0x2a6a50=_0x8279c2;_0x36d342[_0x4973('0x2e')]=_[_0x4973('0x2f')](db[_0x4973('0x49')][_0x4973('0x2c')]);_0x36d342['query']=_['keys'](_0x15e97d[_0x4973('0x30')]);_0x36d342[_0x4973('0x39')]=_[_0x4973('0x32')](_0x36d342[_0x4973('0x2e')],_0x36d342[_0x4973('0x30')]);_0x2183b2['attributes']=_[_0x4973('0x32')](_0x36d342[_0x4973('0x2e')],qs[_0x4973('0x33')](_0x15e97d[_0x4973('0x30')][_0x4973('0x33')]));_0x2183b2[_0x4973('0x31')]=_0x2183b2[_0x4973('0x31')][_0x4973('0x34')]?_0x2183b2[_0x4973('0x31')]:_0x36d342[_0x4973('0x2e')];_0x2183b2['order']=qs[_0x4973('0x36')](_0x15e97d[_0x4973('0x30')][_0x4973('0x36')]);_0x2183b2['where']=qs['filters'](_[_0x4973('0x38')](_0x15e97d['query'],_0x36d342[_0x4973('0x39')]));if(_0x15e97d[_0x4973('0x30')]['filter']){_0x2183b2[_0x4973('0x37')]=_[_0x4973('0x3a')](_0x2183b2[_0x4973('0x37')],{'$or':_[_0x4973('0x2a')](_0x2183b2[_0x4973('0x31')],function(_0x260f22){var _0x5a157d={};_0x5a157d[_0x260f22]={'$like':'%'+_0x15e97d[_0x4973('0x30')][_0x4973('0x3d')]+'%'};return _0x5a157d;})});}_0x2183b2=_[_0x4973('0x3a')]({},_0x2183b2,_0x15e97d[_0x4973('0x3e')]);return _0x2a6a50[_0x4973('0x4a')](_0x2183b2);}})[_0x4973('0x25')](function(_0x217057){if(_0x217057){_0x780bf5=_0x217057['length'];if(!_0x15e97d[_0x4973('0x30')][_0x4973('0x35')]('nolimit')){_0x2183b2[_0x4973('0x1d')]=qs[_0x4973('0x1d')](_0x15e97d[_0x4973('0x30')][_0x4973('0x1d')]);_0x2183b2['offset']=qs[_0x4973('0x20')](_0x15e97d[_0x4973('0x30')][_0x4973('0x20')]);}return _0x2a6a50['getFields'](_0x2183b2);}})[_0x4973('0x25')](function(_0x414345){if(_0x414345){return _0x414345?{'count':_0x780bf5,'rows':_0x414345}:null;}})[_0x4973('0x25')](respondWithResult(_0x138bca,null))[_0x4973('0x47')](handleError(_0x138bca,null));};exports[_0x4973('0x4b')]=function(_0x1c5a4c,_0x4ce2fe,_0x202d1d){var _0x5a51f6={};var _0x5f4054={};var _0x5845f8;var _0x516bad;return db[_0x4973('0x2b')]['findOne']({'where':{'id':_0x1c5a4c[_0x4973('0x44')]['id']}})[_0x4973('0x25')](handleEntityNotFound(_0x4ce2fe,null))[_0x4973('0x25')](function(_0x35b4a9){if(_0x35b4a9){_0x5845f8=_0x35b4a9;_0x5f4054[_0x4973('0x2e')]=_[_0x4973('0x2f')](db[_0x4973('0x49')][_0x4973('0x2c')]);_0x5f4054[_0x4973('0x30')]=_['keys'](_0x1c5a4c['query']);_0x5f4054[_0x4973('0x39')]=_[_0x4973('0x32')](_0x5f4054[_0x4973('0x2e')],_0x5f4054['query']);_0x5a51f6['attributes']=_['intersection'](_0x5f4054[_0x4973('0x2e')],qs[_0x4973('0x33')](_0x1c5a4c[_0x4973('0x30')][_0x4973('0x33')]));_0x5a51f6[_0x4973('0x31')]=_0x5a51f6['attributes'][_0x4973('0x34')]?_0x5a51f6['attributes']:_0x5f4054[_0x4973('0x2e')];_0x5a51f6['order']=qs[_0x4973('0x36')](_0x1c5a4c[_0x4973('0x30')][_0x4973('0x36')]);_0x5a51f6['where']=qs[_0x4973('0x39')](_[_0x4973('0x38')](_0x1c5a4c['query'],_0x5f4054[_0x4973('0x39')]));if(_0x1c5a4c['query'][_0x4973('0x3d')]){_0x5a51f6[_0x4973('0x37')]=_[_0x4973('0x3a')](_0x5a51f6[_0x4973('0x37')],{'$or':_[_0x4973('0x2a')](_0x5a51f6[_0x4973('0x31')],function(_0x3be33a){var _0x3fb791={};_0x3fb791[_0x3be33a]={'$like':'%'+_0x1c5a4c['query']['filter']+'%'};return _0x3fb791;})});}_0x5a51f6=_[_0x4973('0x3a')]({},_0x5a51f6,_0x1c5a4c['options']);return _0x5845f8[_0x4973('0x4b')](_0x5a51f6);}})[_0x4973('0x25')](function(_0x6801d){if(_0x6801d){_0x516bad=_0x6801d[_0x4973('0x34')];if(!_0x1c5a4c[_0x4973('0x30')]['hasOwnProperty']('nolimit')){_0x5a51f6[_0x4973('0x1d')]=qs[_0x4973('0x1d')](_0x1c5a4c[_0x4973('0x30')][_0x4973('0x1d')]);_0x5a51f6['offset']=qs['offset'](_0x1c5a4c[_0x4973('0x30')][_0x4973('0x20')]);}return _0x5845f8[_0x4973('0x4b')](_0x5a51f6);}})[_0x4973('0x25')](function(_0x3e46be){if(_0x3e46be){return _0x3e46be?{'count':_0x516bad,'rows':_0x3e46be}:null;}})[_0x4973('0x25')](respondWithResult(_0x4ce2fe,null))[_0x4973('0x47')](handleError(_0x4ce2fe,null));};exports[_0x4973('0x4c')]=function(_0x79e1be,_0x1b4a31,_0x17cf62){var _0x55b44b={};var _0x27f028={};var _0x535df9;var _0x3a55a8;return db[_0x4973('0x2b')][_0x4973('0x48')]({'where':{'id':_0x79e1be[_0x4973('0x44')]['id']}})[_0x4973('0x25')](handleEntityNotFound(_0x1b4a31,null))[_0x4973('0x25')](function(_0x525734){if(_0x525734){_0x535df9=_0x525734;_0x27f028[_0x4973('0x2e')]=_[_0x4973('0x2f')](db[_0x4973('0x49')][_0x4973('0x2c')]);_0x27f028[_0x4973('0x30')]=_[_0x4973('0x2f')](_0x79e1be[_0x4973('0x30')]);_0x27f028['filters']=_[_0x4973('0x32')](_0x27f028[_0x4973('0x2e')],_0x27f028[_0x4973('0x30')]);_0x55b44b[_0x4973('0x31')]=_['intersection'](_0x27f028['model'],qs[_0x4973('0x33')](_0x79e1be[_0x4973('0x30')][_0x4973('0x33')]));_0x55b44b[_0x4973('0x31')]=_0x55b44b[_0x4973('0x31')][_0x4973('0x34')]?_0x55b44b[_0x4973('0x31')]:_0x27f028[_0x4973('0x2e')];_0x55b44b[_0x4973('0x4d')]=qs['sort'](_0x79e1be[_0x4973('0x30')][_0x4973('0x36')]);_0x55b44b[_0x4973('0x37')]=qs[_0x4973('0x39')](_[_0x4973('0x38')](_0x79e1be[_0x4973('0x30')],_0x27f028[_0x4973('0x39')]));if(_0x79e1be[_0x4973('0x30')][_0x4973('0x3d')]){_0x55b44b['where']=_[_0x4973('0x3a')](_0x55b44b[_0x4973('0x37')],{'$or':_[_0x4973('0x2a')](_0x55b44b[_0x4973('0x31')],function(_0x4c2bff){var _0x5e2323={};_0x5e2323[_0x4c2bff]={'$like':'%'+_0x79e1be[_0x4973('0x30')][_0x4973('0x3d')]+'%'};return _0x5e2323;})});}_0x55b44b=_[_0x4973('0x3a')]({},_0x55b44b,_0x79e1be[_0x4973('0x3e')]);return _0x535df9[_0x4973('0x4c')](_0x55b44b);}})[_0x4973('0x25')](function(_0x1e86fa){if(_0x1e86fa){_0x3a55a8=_0x1e86fa['length'];if(!_0x79e1be['query'][_0x4973('0x35')](_0x4973('0x4e'))){_0x55b44b['limit']=qs['limit'](_0x79e1be[_0x4973('0x30')][_0x4973('0x1d')]);_0x55b44b['offset']=qs[_0x4973('0x20')](_0x79e1be['query'][_0x4973('0x20')]);}return _0x535df9[_0x4973('0x4c')](_0x55b44b);}})['then'](function(_0x217323){if(_0x217323){return _0x217323?{'count':_0x3a55a8,'rows':_0x217323}:null;}})['then'](respondWithResult(_0x1b4a31,null))[_0x4973('0x47')](handleError(_0x1b4a31,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index f6f937c..538a45e 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 _0x4465=['exports','VtigerConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x217023,_0x14bdae){var _0x5687c8=function(_0x387777){while(--_0x387777){_0x217023['push'](_0x217023['shift']());}};_0x5687c8(++_0x14bdae);}(_0x4465,0xa7));var _0x5446=function(_0x26f747,_0x4093f5){_0x26f747=_0x26f747-0x0;var _0x409ed3=_0x4465[_0x26f747];return _0x409ed3;};'use strict';var _=require('lodash');var util=require(_0x5446('0x0'));var logger=require(_0x5446('0x1'))(_0x5446('0x2'));var moment=require(_0x5446('0x3'));var BPromise=require(_0x5446('0x4'));var rp=require(_0x5446('0x5'));var fs=require('fs');var path=require(_0x5446('0x6'));var rimraf=require('rimraf');var config=require(_0x5446('0x7'));var attributes=require(_0x5446('0x8'));module[_0x5446('0x9')]=function(_0x14c340,_0x4700eb){return _0x14c340['define'](_0x5446('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82b7=['int_vtiger_configurations','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration'];(function(_0x3574a8,_0x1518f6){var _0x39e71b=function(_0x184661){while(--_0x184661){_0x3574a8['push'](_0x3574a8['shift']());}};_0x39e71b(++_0x1518f6);}(_0x82b7,0xd2));var _0x782b=function(_0x1eeec1,_0x5ac663){_0x1eeec1=_0x1eeec1-0x0;var _0x23ba86=_0x82b7[_0x1eeec1];return _0x23ba86;};'use strict';var _=require(_0x782b('0x0'));var util=require(_0x782b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x782b('0x2'));var BPromise=require('bluebird');var rp=require(_0x782b('0x3'));var fs=require('fs');var path=require(_0x782b('0x4'));var rimraf=require(_0x782b('0x5'));var config=require(_0x782b('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x782b('0x7')]=function(_0x288d61,_0x25a028){return _0x288d61[_0x782b('0x8')](_0x782b('0x9'),attributes,{'tableName':_0x782b('0xa'),'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 7418f70..f6e2843 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 _0x808d=['http','request','then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x22ebfe,_0x4c7433){var _0x2d916c=function(_0x37e9aa){while(--_0x37e9aa){_0x22ebfe['push'](_0x22ebfe['shift']());}};_0x2d916c(++_0x4c7433);}(_0x808d,0x11e));var _0xd808=function(_0x4b8b57,_0x2b283f){_0x4b8b57=_0x4b8b57-0x0;var _0x2509b6=_0x808d[_0x4b8b57];return _0x2509b6;};'use strict';var _=require('lodash');var util=require(_0xd808('0x0'));var moment=require('moment');var BPromise=require(_0xd808('0x1'));var rs=require(_0xd808('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd808('0x3'))['db'];var utils=require(_0xd808('0x4'));var logger=require(_0xd808('0x5'))(_0xd808('0x6'));var config=require('../../config/environment');var jayson=require(_0xd808('0x7'));var client=jayson['client'][_0xd808('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26ea9e,_0xaa3feb,_0x56a5cb){return new BPromise(function(_0x45d2e3,_0x2da023){return client[_0xd808('0x9')](_0x26ea9e,_0x56a5cb)[_0xd808('0xa')](function(_0x4cb9c7){logger[_0xd808('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0xaa3feb,_0xd808('0xc'));logger[_0xd808('0xd')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xaa3feb,'request\x20sent',JSON[_0xd808('0xe')](_0x4cb9c7));if(_0x4cb9c7[_0xd808('0xf')]){if(_0x4cb9c7[_0xd808('0xf')][_0xd808('0x10')]===0x1f4){logger['error'](_0xd808('0x11'),_0xaa3feb,_0x4cb9c7[_0xd808('0xf')][_0xd808('0x12')]);return _0x2da023(_0x4cb9c7[_0xd808('0xf')][_0xd808('0x12')]);}logger[_0xd808('0xf')](_0xd808('0x11'),_0xaa3feb,_0x4cb9c7['error'][_0xd808('0x12')]);return _0x45d2e3(_0x4cb9c7[_0xd808('0xf')][_0xd808('0x12')]);}else{logger[_0xd808('0xb')](_0xd808('0x11'),_0xaa3feb,_0xd808('0xc'));_0x45d2e3(_0x4cb9c7[_0xd808('0x13')][_0xd808('0x12')]);}})[_0xd808('0x14')](function(_0x55cc50){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xaa3feb,_0x55cc50);_0x2da023(_0x55cc50);});});} \ No newline at end of file +var _0x1f23=['stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x28f775,_0x2f4a03){var _0x154aa1=function(_0x9f89d1){while(--_0x9f89d1){_0x28f775['push'](_0x28f775['shift']());}};_0x154aa1(++_0x2f4a03);}(_0x1f23,0x167));var _0x31f2=function(_0x45932f,_0x2e05f6){_0x45932f=_0x45932f-0x0;var _0x4fbce9=_0x1f23[_0x45932f];return _0x4fbce9;};'use strict';var _=require(_0x31f2('0x0'));var util=require(_0x31f2('0x1'));var moment=require('moment');var BPromise=require(_0x31f2('0x2'));var rs=require(_0x31f2('0x3'));var fs=require('fs');var Redis=require(_0x31f2('0x4'));var db=require(_0x31f2('0x5'))['db'];var utils=require(_0x31f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x31f2('0x7'));var jayson=require(_0x31f2('0x8'));var client=jayson[_0x31f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5497a4,_0x2ff2aa,_0x357b1d){return new BPromise(function(_0x576224,_0x462746){return client[_0x31f2('0xa')](_0x5497a4,_0x357b1d)[_0x31f2('0xb')](function(_0x410524){logger[_0x31f2('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x2ff2aa,_0x31f2('0xd'));logger['debug'](_0x31f2('0xe'),_0x2ff2aa,_0x31f2('0xd'),JSON[_0x31f2('0xf')](_0x410524));if(_0x410524[_0x31f2('0x10')]){if(_0x410524[_0x31f2('0x10')][_0x31f2('0x11')]===0x1f4){logger[_0x31f2('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x2ff2aa,_0x410524['error']['message']);return _0x462746(_0x410524['error'][_0x31f2('0x12')]);}logger['error'](_0x31f2('0x13'),_0x2ff2aa,_0x410524[_0x31f2('0x10')]['message']);return _0x576224(_0x410524[_0x31f2('0x10')][_0x31f2('0x12')]);}else{logger['info'](_0x31f2('0x13'),_0x2ff2aa,_0x31f2('0xd'));_0x576224(_0x410524[_0x31f2('0x14')][_0x31f2('0x12')]);}})[_0x31f2('0x15')](function(_0x4f7d0a){logger[_0x31f2('0x10')](_0x31f2('0x13'),_0x2ff2aa,_0x4f7d0a);_0x462746(_0x4f7d0a);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0ef07b1..03c6d9c 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 _0x5590=['../../components/interaction/service','./intVtigerField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x1ac95b,_0x451f78){var _0x1057ee=function(_0x6fbbb7){while(--_0x6fbbb7){_0x1ac95b['push'](_0x1ac95b['shift']());}};_0x1057ee(++_0x451f78);}(_0x5590,0x11a));var _0x0559=function(_0x218df8,_0x2fa3e0){_0x218df8=_0x218df8-0x0;var _0x556886=_0x5590[_0x218df8];return _0x556886;};'use strict';var multer=require(_0x0559('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0559('0x1'));var express=require('express');var router=express[_0x0559('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0559('0x3'));var config=require('../../config/environment');var controller=require(_0x0559('0x4'));router[_0x0559('0x5')]('/',auth['isAuthenticated'](),controller[_0x0559('0x6')]);router[_0x0559('0x5')](_0x0559('0x7'),auth[_0x0559('0x8')](),controller['show']);router[_0x0559('0x9')]('/',auth['isAuthenticated'](),controller[_0x0559('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0559('0xb')]);router[_0x0559('0xc')](_0x0559('0x7'),auth[_0x0559('0x8')](),controller[_0x0559('0xd')]);module[_0x0559('0xe')]=router; \ No newline at end of file +var _0xc615=['multer','util','path','Router','fs-extra','../../config/environment','./intVtigerField.controller','isAuthenticated','/:id','show','create','put','delete','exports'];(function(_0xdac0c6,_0x10dd44){var _0x2fe97d=function(_0x5d622d){while(--_0x5d622d){_0xdac0c6['push'](_0xdac0c6['shift']());}};_0x2fe97d(++_0x10dd44);}(_0xc615,0x1ce));var _0x5c61=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0xc615[_0x38ff1e];return _0x3755d4;};'use strict';var multer=require(_0x5c61('0x0'));var util=require(_0x5c61('0x1'));var path=require(_0x5c61('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5c61('0x3')]();var fs_extra=require(_0x5c61('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5c61('0x5'));var controller=require(_0x5c61('0x6'));router['get']('/',auth[_0x5c61('0x7')](),controller['index']);router['get'](_0x5c61('0x8'),auth[_0x5c61('0x7')](),controller[_0x5c61('0x9')]);router['post']('/',auth[_0x5c61('0x7')](),controller[_0x5c61('0xa')]);router[_0x5c61('0xb')](_0x5c61('0x8'),auth[_0x5c61('0x7')](),controller['update']);router[_0x5c61('0xc')]('/:id',auth[_0x5c61('0x7')](),controller['destroy']);module[_0x5c61('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a7fe1e9..2e019d0 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 _0x5f0e=['string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','exports'];(function(_0x129a14,_0xe95f00){var _0x2b21a8=function(_0x9fe843){while(--_0x9fe843){_0x129a14['push'](_0x129a14['shift']());}};_0x2b21a8(++_0xe95f00);}(_0x5f0e,0x13f));var _0xe5f0=function(_0x445373,_0x1866a2){_0x445373=_0x445373-0x0;var _0x59ddd5=_0x5f0e[_0x445373];return _0x59ddd5;};'use strict';var Sequelize=require('sequelize');module[_0xe5f0('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe5f0('0x1'),_0xe5f0('0x2'),_0xe5f0('0x3'),_0xe5f0('0x4'),'picklist'),'defaultValue':_0xe5f0('0x1')},'content':{'type':Sequelize[_0xe5f0('0x5')]},'key':{'type':Sequelize[_0xe5f0('0x5')]},'keyType':{'type':Sequelize[_0xe5f0('0x6')](_0xe5f0('0x1'),'variable',_0xe5f0('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe5f0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe5f0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe5f0('0x5')]}}; \ No newline at end of file +var _0xb142=['customVariable','picklist','STRING','ENUM','string','variable'];(function(_0x25860e,_0x50d2a5){var _0x4232ae=function(_0x322923){while(--_0x322923){_0x25860e['push'](_0x25860e['shift']());}};_0x4232ae(++_0x50d2a5);}(_0xb142,0x19b));var _0x2b14=function(_0x18049e,_0x1e2c36){_0x18049e=_0x18049e-0x0;var _0x57ee91=_0xb142[_0x18049e];return _0x57ee91;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x2b14('0x0')](_0x2b14('0x1'),_0x2b14('0x2'),_0x2b14('0x3'),'keyValue',_0x2b14('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2b14('0x5')]},'key':{'type':Sequelize[_0x2b14('0x5')]},'keyType':{'type':Sequelize[_0x2b14('0x0')](_0x2b14('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2b14('0x5')]},'idField':{'type':Sequelize[_0x2b14('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2b14('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 20d7a2b..36aa872 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 _0xf168=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x5d0207,_0x4000c4){var _0xf3e249=function(_0x1a1fd9){while(--_0x1a1fd9){_0x5d0207['push'](_0x5d0207['shift']());}};_0xf3e249(++_0x4000c4);}(_0xf168,0x94));var _0x8f16=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xf168[_0x202c61];return _0x540691;};'use strict';var emlformat=require(_0x8f16('0x0'));var rimraf=require(_0x8f16('0x1'));var zipdir=require(_0x8f16('0x2'));var jsonpatch=require(_0x8f16('0x3'));var rp=require(_0x8f16('0x4'));var moment=require('moment');var BPromise=require(_0x8f16('0x5'));var Mustache=require(_0x8f16('0x6'));var util=require('util');var path=require(_0x8f16('0x7'));var sox=require(_0x8f16('0x8'));var csv=require(_0x8f16('0x9'));var ejs=require(_0x8f16('0xa'));var fs=require('fs');var fs_extra=require(_0x8f16('0xb'));var _=require('lodash');var squel=require(_0x8f16('0xc'));var crypto=require(_0x8f16('0xd'));var jsforce=require(_0x8f16('0xe'));var deskjs=require(_0x8f16('0xf'));var toCsv=require(_0x8f16('0x9'));var querystring=require(_0x8f16('0x10'));var Papa=require(_0x8f16('0x11'));var Redis=require(_0x8f16('0x12'));var authService=require(_0x8f16('0x13'));var qs=require(_0x8f16('0x14'));var as=require(_0x8f16('0x15'));var hardwareService=require(_0x8f16('0x16'));var logger=require(_0x8f16('0x17'))(_0x8f16('0x18'));var utils=require(_0x8f16('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd850,_0x16d19c){_0x16d19c=_0x16d19c||0xcc;return function(_0x3fd381){if(_0x3fd381){return _0x3fd850[_0x8f16('0x1a')](_0x16d19c);}return _0x3fd850[_0x8f16('0x1b')](_0x16d19c)[_0x8f16('0x1c')]();};}function respondWithResult(_0x1bf4ab,_0x443701){_0x443701=_0x443701||0xc8;return function(_0x2769fd){if(_0x2769fd){return _0x1bf4ab[_0x8f16('0x1b')](_0x443701)[_0x8f16('0x1d')](_0x2769fd);}};}function respondWithFilteredResult(_0x57284f,_0x21d53e){return function(_0x181ad2){if(_0x181ad2){var _0x1074bd=typeof _0x21d53e[_0x8f16('0x1e')]===_0x8f16('0x1f')&&typeof _0x21d53e[_0x8f16('0x20')]===_0x8f16('0x1f');var _0x5df03e=_0x181ad2[_0x8f16('0x21')];var _0x415d48=_0x1074bd?0x0:_0x21d53e[_0x8f16('0x1e')];var _0x529010=_0x1074bd?_0x181ad2[_0x8f16('0x21')]:_0x21d53e[_0x8f16('0x1e')]+_0x21d53e[_0x8f16('0x20')];var _0x4ca2a1;if(_0x529010>=_0x5df03e){_0x529010=_0x5df03e;_0x4ca2a1=0xc8;}else{_0x4ca2a1=0xce;}_0x57284f[_0x8f16('0x1b')](_0x4ca2a1);return _0x57284f[_0x8f16('0x22')](_0x8f16('0x23'),_0x415d48+'-'+_0x529010+'/'+_0x5df03e)[_0x8f16('0x1d')](_0x181ad2);}return null;};}function patchUpdates(_0x2bbdd5){return function(_0x1c1e76){try{jsonpatch[_0x8f16('0x24')](_0x1c1e76,_0x2bbdd5,!![]);}catch(_0x74c3e6){return BPromise[_0x8f16('0x25')](_0x74c3e6);}return _0x1c1e76[_0x8f16('0x26')]();};}function saveUpdates(_0x33b5e2,_0x333afb){return function(_0x260de9){if(_0x260de9){return _0x260de9[_0x8f16('0x27')](_0x33b5e2)[_0x8f16('0x28')](function(_0x466abd){return _0x466abd;});}return null;};}function removeEntity(_0x36a934,_0x23c77b){return function(_0x35d73a){if(_0x35d73a){return _0x35d73a[_0x8f16('0x29')]()[_0x8f16('0x28')](function(){_0x36a934[_0x8f16('0x1b')](0xcc)[_0x8f16('0x1c')]();});}};}function handleEntityNotFound(_0x1be2a1,_0x33d174){return function(_0xb872cf){if(!_0xb872cf){_0x1be2a1[_0x8f16('0x1a')](0x194);}return _0xb872cf;};}function handleError(_0x1f9a1e,_0x29f0b7){_0x29f0b7=_0x29f0b7||0x1f4;return function(_0x78a303){logger[_0x8f16('0x2a')](_0x78a303[_0x8f16('0x2b')]);if(_0x78a303[_0x8f16('0x2c')]){delete _0x78a303['name'];}_0x1f9a1e[_0x8f16('0x1b')](_0x29f0b7)[_0x8f16('0x2d')](_0x78a303);};}exports[_0x8f16('0x2e')]=function(_0x154b46,_0x3e0b9b){var _0x44ee9d={},_0x61fc94={},_0x77dd06={'count':0x0,'rows':[]};var _0x3a7317=_[_0x8f16('0x2f')](db[_0x8f16('0x30')][_0x8f16('0x31')],function(_0x5b5ab1){return{'name':_0x5b5ab1[_0x8f16('0x32')],'type':_0x5b5ab1[_0x8f16('0x33')][_0x8f16('0x34')]};});_0x61fc94[_0x8f16('0x35')]=_[_0x8f16('0x2f')](_0x3a7317,_0x8f16('0x2c'));_0x61fc94[_0x8f16('0x36')]=_['keys'](_0x154b46[_0x8f16('0x36')]);_0x61fc94['filters']=_[_0x8f16('0x37')](_0x61fc94['model'],_0x61fc94[_0x8f16('0x36')]);_0x44ee9d[_0x8f16('0x38')]=_['intersection'](_0x61fc94[_0x8f16('0x35')],qs['fields'](_0x154b46[_0x8f16('0x36')][_0x8f16('0x39')]));_0x44ee9d[_0x8f16('0x38')]=_0x44ee9d[_0x8f16('0x38')]['length']?_0x44ee9d[_0x8f16('0x38')]:_0x61fc94['model'];if(!_0x154b46[_0x8f16('0x36')][_0x8f16('0x3a')](_0x8f16('0x3b'))){_0x44ee9d[_0x8f16('0x20')]=qs[_0x8f16('0x20')](_0x154b46[_0x8f16('0x36')][_0x8f16('0x20')]);_0x44ee9d[_0x8f16('0x1e')]=qs[_0x8f16('0x1e')](_0x154b46[_0x8f16('0x36')][_0x8f16('0x1e')]);}_0x44ee9d[_0x8f16('0x3c')]=qs[_0x8f16('0x3d')](_0x154b46[_0x8f16('0x36')][_0x8f16('0x3d')]);_0x44ee9d[_0x8f16('0x3e')]=qs[_0x8f16('0x3f')](_[_0x8f16('0x40')](_0x154b46[_0x8f16('0x36')],_0x61fc94[_0x8f16('0x3f')]),_0x3a7317);if(_0x154b46[_0x8f16('0x36')][_0x8f16('0x41')]){_0x44ee9d[_0x8f16('0x3e')]=_[_0x8f16('0x42')](_0x44ee9d[_0x8f16('0x3e')],{'$or':_[_0x8f16('0x2f')](_0x3a7317,function(_0x4ca202){if(_0x4ca202[_0x8f16('0x33')]!=='VIRTUAL'){var _0x1ba790={};_0x1ba790[_0x4ca202[_0x8f16('0x2c')]]={'$like':'%'+_0x154b46[_0x8f16('0x36')][_0x8f16('0x41')]+'%'};return _0x1ba790;}})});}_0x44ee9d=_[_0x8f16('0x42')]({},_0x44ee9d,_0x154b46[_0x8f16('0x43')]);var _0x35f437={'where':_0x44ee9d[_0x8f16('0x3e')]};return db['VtigerField'][_0x8f16('0x21')](_0x35f437)[_0x8f16('0x28')](function(_0x28ff09){_0x77dd06[_0x8f16('0x21')]=_0x28ff09;if(_0x154b46[_0x8f16('0x36')][_0x8f16('0x44')]){_0x44ee9d[_0x8f16('0x45')]=[{'all':!![]}];}return db[_0x8f16('0x30')][_0x8f16('0x46')](_0x44ee9d);})[_0x8f16('0x28')](function(_0x27b252){_0x77dd06[_0x8f16('0x47')]=_0x27b252;return _0x77dd06;})[_0x8f16('0x28')](respondWithFilteredResult(_0x3e0b9b,_0x44ee9d))[_0x8f16('0x48')](handleError(_0x3e0b9b,null));};exports['show']=function(_0x1edaf7,_0x2c3859){var _0x19eb42={'raw':!![],'where':{'id':_0x1edaf7[_0x8f16('0x49')]['id']}},_0x15d181={};_0x15d181[_0x8f16('0x35')]=_['keys'](db[_0x8f16('0x30')]['rawAttributes']);_0x15d181[_0x8f16('0x36')]=_[_0x8f16('0x4a')](_0x1edaf7[_0x8f16('0x36')]);_0x15d181[_0x8f16('0x3f')]=_[_0x8f16('0x37')](_0x15d181['model'],_0x15d181[_0x8f16('0x36')]);_0x19eb42[_0x8f16('0x38')]=_[_0x8f16('0x37')](_0x15d181[_0x8f16('0x35')],qs[_0x8f16('0x39')](_0x1edaf7[_0x8f16('0x36')]['fields']));_0x19eb42[_0x8f16('0x38')]=_0x19eb42[_0x8f16('0x38')]['length']?_0x19eb42['attributes']:_0x15d181['model'];if(_0x1edaf7[_0x8f16('0x36')]['includeAll']){_0x19eb42[_0x8f16('0x45')]=[{'all':!![]}];}_0x19eb42=_[_0x8f16('0x42')]({},_0x19eb42,_0x1edaf7[_0x8f16('0x43')]);return db['VtigerField']['find'](_0x19eb42)[_0x8f16('0x28')](handleEntityNotFound(_0x2c3859,null))['then'](respondWithResult(_0x2c3859,null))['catch'](handleError(_0x2c3859,null));};exports[_0x8f16('0x4b')]=function(_0x2d5fdf,_0x34138b){return db[_0x8f16('0x30')][_0x8f16('0x4b')](_0x2d5fdf[_0x8f16('0x4c')],{})[_0x8f16('0x28')](respondWithResult(_0x34138b,0xc9))[_0x8f16('0x48')](handleError(_0x34138b,null));};exports[_0x8f16('0x27')]=function(_0x1972f3,_0x1fe51e){if(_0x1972f3[_0x8f16('0x4c')]['id']){delete _0x1972f3[_0x8f16('0x4c')]['id'];}return db[_0x8f16('0x30')][_0x8f16('0x4d')]({'where':{'id':_0x1972f3[_0x8f16('0x49')]['id']}})['then'](handleEntityNotFound(_0x1fe51e,null))['then'](saveUpdates(_0x1972f3[_0x8f16('0x4c')],null))['then'](respondWithResult(_0x1fe51e,null))['catch'](handleError(_0x1fe51e,null));};exports[_0x8f16('0x29')]=function(_0x1ea357,_0x1804bc){return db[_0x8f16('0x30')]['find']({'where':{'id':_0x1ea357['params']['id']}})['then'](handleEntityNotFound(_0x1804bc,null))['then'](removeEntity(_0x1804bc,null))[_0x8f16('0x48')](handleError(_0x1804bc,null));}; \ No newline at end of file +var _0xb39b=['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','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','then','end','error','stack','send','index','map','VtigerField','rawAttributes','fieldName','key','model','name','intersection','query','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','type','VIRTUAL','merge','options','include','findAll','show','params','length','includeAll','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0xab35e1,_0x48b46b){var _0x1dbb70=function(_0x155600){while(--_0x155600){_0xab35e1['push'](_0xab35e1['shift']());}};_0x1dbb70(++_0x48b46b);}(_0xb39b,0x16c));var _0xbb39=function(_0x2201f3,_0x298319){_0x2201f3=_0x2201f3-0x0;var _0xff133=_0xb39b[_0x2201f3];return _0xff133;};'use strict';var emlformat=require(_0xbb39('0x0'));var rimraf=require(_0xbb39('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb39('0x2'));var rp=require(_0xbb39('0x3'));var moment=require(_0xbb39('0x4'));var BPromise=require(_0xbb39('0x5'));var Mustache=require(_0xbb39('0x6'));var util=require(_0xbb39('0x7'));var path=require(_0xbb39('0x8'));var sox=require(_0xbb39('0x9'));var csv=require(_0xbb39('0xa'));var ejs=require(_0xbb39('0xb'));var fs=require('fs');var fs_extra=require(_0xbb39('0xc'));var _=require(_0xbb39('0xd'));var squel=require(_0xbb39('0xe'));var crypto=require(_0xbb39('0xf'));var jsforce=require(_0xbb39('0x10'));var deskjs=require(_0xbb39('0x11'));var toCsv=require(_0xbb39('0xa'));var querystring=require(_0xbb39('0x12'));var Papa=require(_0xbb39('0x13'));var Redis=require(_0xbb39('0x14'));var authService=require(_0xbb39('0x15'));var qs=require(_0xbb39('0x16'));var as=require(_0xbb39('0x17'));var hardwareService=require(_0xbb39('0x18'));var logger=require('../../config/logger')(_0xbb39('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbb39('0x1a'))['db'];function respondWithStatusCode(_0x31f88c,_0x3aefff){_0x3aefff=_0x3aefff||0xcc;return function(_0x160e5a){if(_0x160e5a){return _0x31f88c[_0xbb39('0x1b')](_0x3aefff);}return _0x31f88c[_0xbb39('0x1c')](_0x3aefff)['end']();};}function respondWithResult(_0x10d37f,_0x2a2329){_0x2a2329=_0x2a2329||0xc8;return function(_0xc2b2e0){if(_0xc2b2e0){return _0x10d37f['status'](_0x2a2329)[_0xbb39('0x1d')](_0xc2b2e0);}};}function respondWithFilteredResult(_0x58c5fa,_0x2df871){return function(_0x259d7c){if(_0x259d7c){var _0x300535=typeof _0x2df871[_0xbb39('0x1e')]==='undefined'&&typeof _0x2df871[_0xbb39('0x1f')]==='undefined';var _0x5e876e=_0x259d7c[_0xbb39('0x20')];var _0x525929=_0x300535?0x0:_0x2df871['offset'];var _0xb7d5a9=_0x300535?_0x259d7c[_0xbb39('0x20')]:_0x2df871[_0xbb39('0x1e')]+_0x2df871[_0xbb39('0x1f')];var _0x1edb4b;if(_0xb7d5a9>=_0x5e876e){_0xb7d5a9=_0x5e876e;_0x1edb4b=0xc8;}else{_0x1edb4b=0xce;}_0x58c5fa['status'](_0x1edb4b);return _0x58c5fa[_0xbb39('0x21')](_0xbb39('0x22'),_0x525929+'-'+_0xb7d5a9+'/'+_0x5e876e)[_0xbb39('0x1d')](_0x259d7c);}return null;};}function patchUpdates(_0x4b4c70){return function(_0x2b0187){try{jsonpatch[_0xbb39('0x23')](_0x2b0187,_0x4b4c70,!![]);}catch(_0x385c2a){return BPromise['reject'](_0x385c2a);}return _0x2b0187[_0xbb39('0x24')]();};}function saveUpdates(_0x333a84,_0x347098){return function(_0x4086d2){if(_0x4086d2){return _0x4086d2['update'](_0x333a84)[_0xbb39('0x25')](function(_0x554864){return _0x554864;});}return null;};}function removeEntity(_0x31c89e,_0xe302d3){return function(_0x1a23fc){if(_0x1a23fc){return _0x1a23fc['destroy']()[_0xbb39('0x25')](function(){_0x31c89e['status'](0xcc)[_0xbb39('0x26')]();});}};}function handleEntityNotFound(_0x2e5036,_0x5513b7){return function(_0x486f16){if(!_0x486f16){_0x2e5036[_0xbb39('0x1b')](0x194);}return _0x486f16;};}function handleError(_0x2563ea,_0x4cee34){_0x4cee34=_0x4cee34||0x1f4;return function(_0x46dfe0){logger[_0xbb39('0x27')](_0x46dfe0[_0xbb39('0x28')]);if(_0x46dfe0['name']){delete _0x46dfe0['name'];}_0x2563ea[_0xbb39('0x1c')](_0x4cee34)[_0xbb39('0x29')](_0x46dfe0);};}exports[_0xbb39('0x2a')]=function(_0x12a3c1,_0x2a19f2){var _0x2f99ad={},_0x337f58={},_0x4ebd3d={'count':0x0,'rows':[]};var _0x2d8e77=_[_0xbb39('0x2b')](db[_0xbb39('0x2c')][_0xbb39('0x2d')],function(_0x16000f){return{'name':_0x16000f[_0xbb39('0x2e')],'type':_0x16000f['type'][_0xbb39('0x2f')]};});_0x337f58[_0xbb39('0x30')]=_[_0xbb39('0x2b')](_0x2d8e77,_0xbb39('0x31'));_0x337f58['query']=_['keys'](_0x12a3c1['query']);_0x337f58['filters']=_[_0xbb39('0x32')](_0x337f58[_0xbb39('0x30')],_0x337f58[_0xbb39('0x33')]);_0x2f99ad['attributes']=_[_0xbb39('0x32')](_0x337f58[_0xbb39('0x30')],qs['fields'](_0x12a3c1['query'][_0xbb39('0x34')]));_0x2f99ad[_0xbb39('0x35')]=_0x2f99ad['attributes']['length']?_0x2f99ad[_0xbb39('0x35')]:_0x337f58['model'];if(!_0x12a3c1[_0xbb39('0x33')][_0xbb39('0x36')]('nolimit')){_0x2f99ad[_0xbb39('0x1f')]=qs['limit'](_0x12a3c1[_0xbb39('0x33')][_0xbb39('0x1f')]);_0x2f99ad['offset']=qs[_0xbb39('0x1e')](_0x12a3c1['query'][_0xbb39('0x1e')]);}_0x2f99ad[_0xbb39('0x37')]=qs[_0xbb39('0x38')](_0x12a3c1['query'][_0xbb39('0x38')]);_0x2f99ad[_0xbb39('0x39')]=qs[_0xbb39('0x3a')](_['pick'](_0x12a3c1['query'],_0x337f58[_0xbb39('0x3a')]),_0x2d8e77);if(_0x12a3c1['query'][_0xbb39('0x3b')]){_0x2f99ad[_0xbb39('0x39')]=_['merge'](_0x2f99ad[_0xbb39('0x39')],{'$or':_[_0xbb39('0x2b')](_0x2d8e77,function(_0xc90daf){if(_0xc90daf[_0xbb39('0x3c')]!==_0xbb39('0x3d')){var _0x4980f7={};_0x4980f7[_0xc90daf[_0xbb39('0x31')]]={'$like':'%'+_0x12a3c1[_0xbb39('0x33')][_0xbb39('0x3b')]+'%'};return _0x4980f7;}})});}_0x2f99ad=_[_0xbb39('0x3e')]({},_0x2f99ad,_0x12a3c1[_0xbb39('0x3f')]);var _0x9991c7={'where':_0x2f99ad[_0xbb39('0x39')]};return db[_0xbb39('0x2c')][_0xbb39('0x20')](_0x9991c7)[_0xbb39('0x25')](function(_0x13fa06){_0x4ebd3d['count']=_0x13fa06;if(_0x12a3c1[_0xbb39('0x33')]['includeAll']){_0x2f99ad[_0xbb39('0x40')]=[{'all':!![]}];}return db[_0xbb39('0x2c')][_0xbb39('0x41')](_0x2f99ad);})[_0xbb39('0x25')](function(_0x59f460){_0x4ebd3d['rows']=_0x59f460;return _0x4ebd3d;})[_0xbb39('0x25')](respondWithFilteredResult(_0x2a19f2,_0x2f99ad))['catch'](handleError(_0x2a19f2,null));};exports[_0xbb39('0x42')]=function(_0x18cccd,_0x290fa2){var _0x1e99cb={'raw':!![],'where':{'id':_0x18cccd[_0xbb39('0x43')]['id']}},_0x1c74c5={};_0x1c74c5[_0xbb39('0x30')]=_['keys'](db[_0xbb39('0x2c')][_0xbb39('0x2d')]);_0x1c74c5[_0xbb39('0x33')]=_['keys'](_0x18cccd[_0xbb39('0x33')]);_0x1c74c5[_0xbb39('0x3a')]=_[_0xbb39('0x32')](_0x1c74c5['model'],_0x1c74c5[_0xbb39('0x33')]);_0x1e99cb[_0xbb39('0x35')]=_[_0xbb39('0x32')](_0x1c74c5[_0xbb39('0x30')],qs[_0xbb39('0x34')](_0x18cccd[_0xbb39('0x33')][_0xbb39('0x34')]));_0x1e99cb[_0xbb39('0x35')]=_0x1e99cb[_0xbb39('0x35')][_0xbb39('0x44')]?_0x1e99cb[_0xbb39('0x35')]:_0x1c74c5['model'];if(_0x18cccd['query'][_0xbb39('0x45')]){_0x1e99cb[_0xbb39('0x40')]=[{'all':!![]}];}_0x1e99cb=_[_0xbb39('0x3e')]({},_0x1e99cb,_0x18cccd[_0xbb39('0x3f')]);return db[_0xbb39('0x2c')][_0xbb39('0x46')](_0x1e99cb)[_0xbb39('0x25')](handleEntityNotFound(_0x290fa2,null))[_0xbb39('0x25')](respondWithResult(_0x290fa2,null))[_0xbb39('0x47')](handleError(_0x290fa2,null));};exports[_0xbb39('0x48')]=function(_0x4e5262,_0x13a669){return db[_0xbb39('0x2c')][_0xbb39('0x48')](_0x4e5262['body'],{})['then'](respondWithResult(_0x13a669,0xc9))[_0xbb39('0x47')](handleError(_0x13a669,null));};exports['update']=function(_0x59e902,_0x23e45b){if(_0x59e902[_0xbb39('0x49')]['id']){delete _0x59e902[_0xbb39('0x49')]['id'];}return db[_0xbb39('0x2c')][_0xbb39('0x46')]({'where':{'id':_0x59e902['params']['id']}})[_0xbb39('0x25')](handleEntityNotFound(_0x23e45b,null))[_0xbb39('0x25')](saveUpdates(_0x59e902[_0xbb39('0x49')],null))[_0xbb39('0x25')](respondWithResult(_0x23e45b,null))[_0xbb39('0x47')](handleError(_0x23e45b,null));};exports[_0xbb39('0x4a')]=function(_0x2958ce,_0x57a6af){return db[_0xbb39('0x2c')][_0xbb39('0x46')]({'where':{'id':_0x2958ce[_0xbb39('0x43')]['id']}})[_0xbb39('0x25')](handleEntityNotFound(_0x57a6af,null))['then'](removeEntity(_0x57a6af,null))['catch'](handleError(_0x57a6af,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 4f6698b..99fb955 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 _0x8ff8=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerField.attributes','VtigerField','int_vtiger_fields','idField'];(function(_0x2589d2,_0x5578aa){var _0x2f2a02=function(_0x586610){while(--_0x586610){_0x2589d2['push'](_0x2589d2['shift']());}};_0x2f2a02(++_0x5578aa);}(_0x8ff8,0x194));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x88ff('0x0'));var util=require(_0x88ff('0x1'));var logger=require(_0x88ff('0x2'))(_0x88ff('0x3'));var moment=require(_0x88ff('0x4'));var BPromise=require(_0x88ff('0x5'));var rp=require(_0x88ff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88ff('0x7'));var config=require('../../config/environment');var attributes=require(_0x88ff('0x8'));module['exports']=function(_0x50c92c,_0x1ca82e){return _0x50c92c['define'](_0x88ff('0x9'),attributes,{'tableName':_0x88ff('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x88ff('0xb'),_0x88ff('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4946=['request-promise','path','rimraf','./intVtigerField.attributes','define','VtigerField','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x4946,0x1c9));var _0x6494=function(_0xc3804e,_0x5e5938){_0xc3804e=_0xc3804e-0x0;var _0xd13ff=_0x4946[_0xc3804e];return _0xd13ff;};'use strict';var _=require('lodash');var util=require(_0x6494('0x0'));var logger=require(_0x6494('0x1'))(_0x6494('0x2'));var moment=require(_0x6494('0x3'));var BPromise=require(_0x6494('0x4'));var rp=require(_0x6494('0x5'));var fs=require('fs');var path=require(_0x6494('0x6'));var rimraf=require(_0x6494('0x7'));var config=require('../../config/environment');var attributes=require(_0x6494('0x8'));module['exports']=function(_0x188238,_0x32746d){return _0x188238[_0x6494('0x9')](_0x6494('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6494('0xb'),'fields':[_0x6494('0xc'),_0x6494('0xd')],'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 4b05e4f..6ba5e7c 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 _0xa014=['http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a6807,_0x44b34f){var _0xa2acb0=function(_0x531372){while(--_0x531372){_0x4a6807['push'](_0x4a6807['shift']());}};_0xa2acb0(++_0x44b34f);}(_0xa014,0x1ad));var _0x4a01=function(_0x36e873,_0x16a325){_0x36e873=_0x36e873-0x0;var _0x194a4f=_0xa014[_0x36e873];return _0x194a4f;};'use strict';var _=require(_0x4a01('0x0'));var util=require(_0x4a01('0x1'));var moment=require(_0x4a01('0x2'));var BPromise=require(_0x4a01('0x3'));var rs=require(_0x4a01('0x4'));var fs=require('fs');var Redis=require(_0x4a01('0x5'));var db=require(_0x4a01('0x6'))['db'];var utils=require(_0x4a01('0x7'));var logger=require(_0x4a01('0x8'))(_0x4a01('0x9'));var config=require(_0x4a01('0xa'));var jayson=require(_0x4a01('0xb'));var client=jayson[_0x4a01('0xc')][_0x4a01('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2c869e,_0x226d2a,_0x98a74b){return new BPromise(function(_0x3205c5,_0x37c0d9){return client['request'](_0x2c869e,_0x98a74b)[_0x4a01('0xe')](function(_0x4ded2b){logger[_0x4a01('0xf')](_0x4a01('0x10'),_0x226d2a,_0x4a01('0x11'));logger[_0x4a01('0x12')](_0x4a01('0x13'),_0x226d2a,_0x4a01('0x11'),JSON[_0x4a01('0x14')](_0x4ded2b));if(_0x4ded2b[_0x4a01('0x15')]){if(_0x4ded2b['error'][_0x4a01('0x16')]===0x1f4){logger['error'](_0x4a01('0x10'),_0x226d2a,_0x4ded2b[_0x4a01('0x15')]['message']);return _0x37c0d9(_0x4ded2b[_0x4a01('0x15')][_0x4a01('0x17')]);}logger[_0x4a01('0x15')](_0x4a01('0x10'),_0x226d2a,_0x4ded2b[_0x4a01('0x15')][_0x4a01('0x17')]);return _0x3205c5(_0x4ded2b[_0x4a01('0x15')][_0x4a01('0x17')]);}else{logger[_0x4a01('0xf')](_0x4a01('0x10'),_0x226d2a,_0x4a01('0x11'));_0x3205c5(_0x4ded2b[_0x4a01('0x18')][_0x4a01('0x17')]);}})[_0x4a01('0x19')](function(_0x1c8073){logger['error']('VtigerField,\x20%s,\x20%s',_0x226d2a,_0x1c8073);_0x37c0d9(_0x1c8073);});});} \ No newline at end of file +var _0xa19c=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result'];(function(_0xb3d3b7,_0x208f98){var _0x3c4980=function(_0x20ee97){while(--_0x20ee97){_0xb3d3b7['push'](_0xb3d3b7['shift']());}};_0x3c4980(++_0x208f98);}(_0xa19c,0x114));var _0xca19=function(_0x48165a,_0x52099e){_0x48165a=_0x48165a-0x0;var _0x3702bb=_0xa19c[_0x48165a];return _0x3702bb;};'use strict';var _=require(_0xca19('0x0'));var util=require(_0xca19('0x1'));var moment=require('moment');var BPromise=require(_0xca19('0x2'));var rs=require(_0xca19('0x3'));var fs=require('fs');var Redis=require(_0xca19('0x4'));var db=require(_0xca19('0x5'))['db'];var utils=require(_0xca19('0x6'));var logger=require(_0xca19('0x7'))(_0xca19('0x8'));var config=require(_0xca19('0x9'));var jayson=require(_0xca19('0xa'));var client=jayson[_0xca19('0xb')][_0xca19('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37ace4,_0x356d03,_0x272cd0){return new BPromise(function(_0x2bf5fc,_0x4e6066){return client[_0xca19('0xd')](_0x37ace4,_0x272cd0)[_0xca19('0xe')](function(_0x104041){logger[_0xca19('0xf')]('VtigerField,\x20%s,\x20%s',_0x356d03,'request\x20sent');logger[_0xca19('0x10')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x356d03,_0xca19('0x11'),JSON[_0xca19('0x12')](_0x104041));if(_0x104041['error']){if(_0x104041[_0xca19('0x13')][_0xca19('0x14')]===0x1f4){logger[_0xca19('0x13')](_0xca19('0x15'),_0x356d03,_0x104041[_0xca19('0x13')][_0xca19('0x16')]);return _0x4e6066(_0x104041[_0xca19('0x13')][_0xca19('0x16')]);}logger[_0xca19('0x13')](_0xca19('0x15'),_0x356d03,_0x104041[_0xca19('0x13')][_0xca19('0x16')]);return _0x2bf5fc(_0x104041[_0xca19('0x13')][_0xca19('0x16')]);}else{logger[_0xca19('0xf')](_0xca19('0x15'),_0x356d03,_0xca19('0x11'));_0x2bf5fc(_0x104041[_0xca19('0x17')][_0xca19('0x16')]);}})[_0xca19('0x18')](function(_0x7820c2){logger[_0xca19('0x13')]('VtigerField,\x20%s,\x20%s',_0x356d03,_0x7820c2);_0x4e6066(_0x7820c2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0c21aff..50fb214 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 _0xa6a9=['fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x128a09,_0x2fc8e9){var _0x449203=function(_0x13c929){while(--_0x13c929){_0x128a09['push'](_0x128a09['shift']());}};_0x449203(++_0x2fc8e9);}(_0xa6a9,0x102));var _0x9a6a=function(_0x50f17d,_0x260de1){_0x50f17d=_0x50f17d-0x0;var _0x207fb8=_0xa6a9[_0x50f17d];return _0x207fb8;};'use strict';var multer=require(_0x9a6a('0x0'));var util=require(_0x9a6a('0x1'));var path=require(_0x9a6a('0x2'));var timeout=require(_0x9a6a('0x3'));var express=require(_0x9a6a('0x4'));var router=express[_0x9a6a('0x5')]();var fs_extra=require(_0x9a6a('0x6'));var auth=require(_0x9a6a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9a6a('0x8'));var controller=require(_0x9a6a('0x9'));router[_0x9a6a('0xa')]('/',auth[_0x9a6a('0xb')](),controller[_0x9a6a('0xc')]);router['get'](_0x9a6a('0xd'),auth[_0x9a6a('0xb')](),controller[_0x9a6a('0xe')]);router['get'](_0x9a6a('0xf'),auth[_0x9a6a('0xb')](),controller['getConfigurations']);router[_0x9a6a('0xa')](_0x9a6a('0x10'),auth[_0x9a6a('0xb')](),controller[_0x9a6a('0x11')]);router[_0x9a6a('0x12')]('/',auth[_0x9a6a('0xb')](),controller[_0x9a6a('0x13')]);router[_0x9a6a('0x12')](_0x9a6a('0xf'),auth[_0x9a6a('0xb')](),controller['addConfiguration']);router[_0x9a6a('0x14')](_0x9a6a('0xd'),auth[_0x9a6a('0xb')](),controller[_0x9a6a('0x15')]);router['delete']('/:id',auth[_0x9a6a('0xb')](),controller[_0x9a6a('0x16')]);module[_0x9a6a('0x17')]=router; \ No newline at end of file +var _0xdfdb=['./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','put','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xdfdb,0xa4));var _0xbdfd=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0xdfdb[_0x28fbe3];return _0x45db6a;};'use strict';var multer=require(_0xbdfd('0x0'));var util=require('util');var path=require(_0xbdfd('0x1'));var timeout=require('connect-timeout');var express=require(_0xbdfd('0x2'));var router=express['Router']();var fs_extra=require(_0xbdfd('0x3'));var auth=require(_0xbdfd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbdfd('0x5'));var controller=require(_0xbdfd('0x6'));router[_0xbdfd('0x7')]('/',auth[_0xbdfd('0x8')](),controller['index']);router[_0xbdfd('0x7')](_0xbdfd('0x9'),auth[_0xbdfd('0x8')](),controller[_0xbdfd('0xa')]);router[_0xbdfd('0x7')](_0xbdfd('0xb'),auth[_0xbdfd('0x8')](),controller['getConfigurations']);router[_0xbdfd('0x7')](_0xbdfd('0xc'),auth[_0xbdfd('0x8')](),controller[_0xbdfd('0xd')]);router[_0xbdfd('0xe')]('/',auth[_0xbdfd('0x8')](),controller['create']);router['post'](_0xbdfd('0xb'),auth[_0xbdfd('0x8')](),controller['addConfiguration']);router[_0xbdfd('0xf')]('/:id',auth[_0xbdfd('0x8')](),controller['update']);router['delete'](_0xbdfd('0x9'),auth[_0xbdfd('0x8')](),controller[_0xbdfd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 752339b..ac0bbdd 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 _0xa6b0=['ENUM','password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3ef21a,_0x80e93a){_0x3ef21a=_0x3ef21a-0x0;var _0x11dc4b=_0xa6b0[_0x3ef21a];return _0x11dc4b;};'use strict';var Sequelize=require(_0x0a6b('0x0'));module[_0x0a6b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0a6b('0x2')],'unique':_0x0a6b('0x3')},'password':{'type':Sequelize[_0x0a6b('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a6b('0x2')],'unique':_0x0a6b('0x4')},'authType':{'type':Sequelize[_0x0a6b('0x5')](_0x0a6b('0x6'),_0x0a6b('0x7')),'defaultValue':_0x0a6b('0x6')},'serverUrl':{'type':Sequelize[_0x0a6b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0a6b('0x5')](_0x0a6b('0x8'),_0x0a6b('0x9')),'defaultValue':_0x0a6b('0x8')}}; \ No newline at end of file +var _0x9b09=['integrationTab','newTab','sequelize','exports','STRING','ENUM','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b09,0x1ad));var _0x99b0=function(_0x230639,_0x20f428){_0x230639=_0x230639-0x0;var _0x5248d7=_0x9b09[_0x230639];return _0x5248d7;};'use strict';var Sequelize=require(_0x99b0('0x0'));module[_0x99b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x99b0('0x2')]},'username':{'type':Sequelize[_0x99b0('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x99b0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x99b0('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x99b0('0x3')](_0x99b0('0x4'),'token'),'defaultValue':_0x99b0('0x4')},'serverUrl':{'type':Sequelize[_0x99b0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x99b0('0x5'),_0x99b0('0x6')),'defaultValue':_0x99b0('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index e337f5f..57dd82f 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 _0x96cc=['includes','position','title','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','ZendeskAccount','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','options','find','create','body','ZendeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','Descriptions','channel','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers','%s:%s','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','group','assignee'];(function(_0x2aee6f,_0x383893){var _0x2a565b=function(_0x16a4fa){while(--_0x16a4fa){_0x2aee6f['push'](_0x2aee6f['shift']());}};_0x2a565b(++_0x383893);}(_0x96cc,0x16c));var _0xc96c=function(_0x36abfd,_0x32068a){_0x36abfd=_0x36abfd-0x0;var _0x14ab00=_0x96cc[_0x36abfd];return _0x14ab00;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];var integrations=require(_0xc96c('0x19'));function respondWithStatusCode(_0x5f27f3,_0x3fe3d5){_0x3fe3d5=_0x3fe3d5||0xcc;return function(_0x43fcaa){if(_0x43fcaa){return _0x5f27f3[_0xc96c('0x1a')](_0x3fe3d5);}return _0x5f27f3[_0xc96c('0x1b')](_0x3fe3d5)['end']();};}function respondWithResult(_0x35da94,_0xbed0c9){_0xbed0c9=_0xbed0c9||0xc8;return function(_0x399267){if(_0x399267){return _0x35da94[_0xc96c('0x1b')](_0xbed0c9)[_0xc96c('0x1c')](_0x399267);}};}function respondWithFilteredResult(_0x46455a,_0x1765d9){return function(_0x23e357){if(_0x23e357){var _0x174852=typeof _0x1765d9[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x1765d9['limit']==='undefined';var _0x406791=_0x23e357[_0xc96c('0x1f')];var _0x16b6ce=_0x174852?0x0:_0x1765d9[_0xc96c('0x1d')];var _0x4aa6a3=_0x174852?_0x23e357[_0xc96c('0x1f')]:_0x1765d9[_0xc96c('0x1d')]+_0x1765d9[_0xc96c('0x20')];var _0x3c0864;if(_0x4aa6a3>=_0x406791){_0x4aa6a3=_0x406791;_0x3c0864=0xc8;}else{_0x3c0864=0xce;}_0x46455a[_0xc96c('0x1b')](_0x3c0864);return _0x46455a[_0xc96c('0x21')](_0xc96c('0x22'),_0x16b6ce+'-'+_0x4aa6a3+'/'+_0x406791)[_0xc96c('0x1c')](_0x23e357);}return null;};}function patchUpdates(_0x28d762){return function(_0x2f25a3){try{jsonpatch[_0xc96c('0x23')](_0x2f25a3,_0x28d762,!![]);}catch(_0x1203a1){return BPromise[_0xc96c('0x24')](_0x1203a1);}return _0x2f25a3[_0xc96c('0x25')]();};}function saveUpdates(_0x325c54,_0x3b5c6c){return function(_0x3e2615){if(_0x3e2615){return _0x3e2615['update'](_0x325c54)[_0xc96c('0x26')](function(_0x4be783){return _0x4be783;});}return null;};}function removeEntity(_0x4456bf,_0x10ae21){return function(_0x2b1df9){if(_0x2b1df9){return _0x2b1df9[_0xc96c('0x27')]()[_0xc96c('0x26')](function(){_0x4456bf[_0xc96c('0x1b')](0xcc)[_0xc96c('0x28')]();});}};}function handleEntityNotFound(_0x14f171,_0x50fc07){return function(_0x3a23cb){if(!_0x3a23cb){_0x14f171[_0xc96c('0x1a')](0x194);}return _0x3a23cb;};}function handleError(_0x3f87cc,_0x294fee){_0x294fee=_0x294fee||0x1f4;return function(_0x58fab3){logger['error'](_0x58fab3[_0xc96c('0x29')]);if(_0x58fab3[_0xc96c('0x2a')]){delete _0x58fab3[_0xc96c('0x2a')];}_0x3f87cc[_0xc96c('0x1b')](_0x294fee)[_0xc96c('0x2b')](_0x58fab3);};}exports[_0xc96c('0x2c')]=function(_0x427cb2,_0x1c911b){var _0xa0efbc={},_0x27925f={},_0x325cda={'count':0x0,'rows':[]};var _0x40c72b=_[_0xc96c('0x2d')](db[_0xc96c('0x2e')]['rawAttributes'],function(_0x3aa436){return{'name':_0x3aa436['fieldName'],'type':_0x3aa436[_0xc96c('0x2f')][_0xc96c('0x30')]};});_0x27925f[_0xc96c('0x31')]=_['map'](_0x40c72b,_0xc96c('0x2a'));_0x27925f[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x427cb2[_0xc96c('0x32')]);_0x27925f['filters']=_['intersection'](_0x27925f[_0xc96c('0x31')],_0x27925f[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0x27925f[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x35')]));_0xa0efbc['attributes']=_0xa0efbc[_0xc96c('0x34')][_0xc96c('0x36')]?_0xa0efbc['attributes']:_0x27925f[_0xc96c('0x31')];if(!_0x427cb2[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0xa0efbc[_0xc96c('0x20')]=qs[_0xc96c('0x20')](_0x427cb2['query'][_0xc96c('0x20')]);_0xa0efbc[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x427cb2[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0xa0efbc[_0xc96c('0x39')]=qs['sort'](_0x427cb2['query'][_0xc96c('0x3a')]);_0xa0efbc[_0xc96c('0x3b')]=qs['filters'](_['pick'](_0x427cb2[_0xc96c('0x32')],_0x27925f[_0xc96c('0x3c')]),_0x40c72b);if(_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]){_0xa0efbc[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0xa0efbc[_0xc96c('0x3b')],{'$or':_[_0xc96c('0x2d')](_0x40c72b,function(_0x3fc40d){if(_0x3fc40d[_0xc96c('0x2f')]!==_0xc96c('0x3f')){var _0x5ed343={};_0x5ed343[_0x3fc40d[_0xc96c('0x2a')]]={'$like':'%'+_0x427cb2[_0xc96c('0x32')][_0xc96c('0x3d')]+'%'};return _0x5ed343;}})});}_0xa0efbc=_[_0xc96c('0x3e')]({},_0xa0efbc,_0x427cb2['options']);var _0x167671={'where':_0xa0efbc[_0xc96c('0x3b')]};return db[_0xc96c('0x2e')]['count'](_0x167671)['then'](function(_0x311a9e){_0x325cda[_0xc96c('0x1f')]=_0x311a9e;if(_0x427cb2[_0xc96c('0x32')]['includeAll']){_0xa0efbc[_0xc96c('0x40')]=[{'all':!![]}];}return db[_0xc96c('0x2e')][_0xc96c('0x41')](_0xa0efbc);})[_0xc96c('0x26')](function(_0x1790a8){_0x325cda[_0xc96c('0x42')]=_0x1790a8;return _0x325cda;})[_0xc96c('0x26')](respondWithFilteredResult(_0x1c911b,_0xa0efbc))[_0xc96c('0x43')](handleError(_0x1c911b,null));};exports[_0xc96c('0x44')]=function(_0x4d5a1b,_0x4c3088){var _0x30b3ac={'raw':![],'where':{'id':_0x4d5a1b[_0xc96c('0x45')]['id']}},_0x2199c4={};_0x2199c4[_0xc96c('0x31')]=_['keys'](db['ZendeskAccount'][_0xc96c('0x46')]);_0x2199c4[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x4d5a1b[_0xc96c('0x32')]);_0x2199c4[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],_0x2199c4['query']);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x2199c4[_0xc96c('0x31')],qs[_0xc96c('0x35')](_0x4d5a1b['query']['fields']));_0x30b3ac[_0xc96c('0x34')]=_0x30b3ac[_0xc96c('0x34')][_0xc96c('0x36')]?_0x30b3ac[_0xc96c('0x34')]:_0x2199c4[_0xc96c('0x31')];if(_0x4d5a1b[_0xc96c('0x32')][_0xc96c('0x48')]){_0x30b3ac[_0xc96c('0x40')]=[{'all':!![]}];}_0x30b3ac=_[_0xc96c('0x3e')]({},_0x30b3ac,_0x4d5a1b[_0xc96c('0x49')]);return db[_0xc96c('0x2e')][_0xc96c('0x4a')](_0x30b3ac)[_0xc96c('0x26')](handleEntityNotFound(_0x4c3088,null))['then'](respondWithResult(_0x4c3088,null))[_0xc96c('0x43')](handleError(_0x4c3088,null));};exports[_0xc96c('0x4b')]=function(_0x307d58,_0x305ebd){return db['ZendeskAccount'][_0xc96c('0x4b')](_0x307d58['body'],{})[_0xc96c('0x26')](respondWithResult(_0x305ebd,0xc9))[_0xc96c('0x43')](handleError(_0x305ebd,null));};exports['update']=function(_0x2581ae,_0x400fe6){if(_0x2581ae[_0xc96c('0x4c')]['id']){delete _0x2581ae[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x2581ae['params']['id']}})['then'](handleEntityNotFound(_0x400fe6,null))['then'](saveUpdates(_0x2581ae[_0xc96c('0x4c')],null))['then'](respondWithResult(_0x400fe6,null))[_0xc96c('0x43')](handleError(_0x400fe6,null));};exports[_0xc96c('0x27')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x2e')][_0xc96c('0x4a')]({'where':{'id':_0x65a0a7[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x17c764,null))[_0xc96c('0x26')](removeEntity(_0x17c764,null))[_0xc96c('0x43')](handleError(_0x17c764,null));};exports['getConfigurations']=function(_0x3adefb,_0x15367d,_0x2b58c1){var _0x215cad={};var _0x1c7ea7={};var _0xcde9;var _0xad88c3;return db[_0xc96c('0x2e')]['findOne']({'where':{'id':_0x3adefb['params']['id']}})['then'](handleEntityNotFound(_0x15367d,null))['then'](function(_0x356ef3){if(_0x356ef3){_0xcde9=_0x356ef3;_0x1c7ea7[_0xc96c('0x31')]=_[_0xc96c('0x33')](db[_0xc96c('0x4d')][_0xc96c('0x46')]);_0x1c7ea7[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x3adefb['query']);_0x1c7ea7[_0xc96c('0x3c')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],_0x1c7ea7[_0xc96c('0x32')]);_0x215cad[_0xc96c('0x34')]=_[_0xc96c('0x47')](_0x1c7ea7[_0xc96c('0x31')],qs['fields'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x35')]));_0x215cad[_0xc96c('0x34')]=_0x215cad[_0xc96c('0x34')][_0xc96c('0x36')]?_0x215cad[_0xc96c('0x34')]:_0x1c7ea7[_0xc96c('0x31')];_0x215cad[_0xc96c('0x39')]=qs[_0xc96c('0x3a')](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3a')]);_0x215cad[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_[_0xc96c('0x4e')](_0x3adefb['query'],_0x1c7ea7[_0xc96c('0x3c')]));if(_0x3adefb[_0xc96c('0x32')][_0xc96c('0x3d')]){_0x215cad[_0xc96c('0x3b')]=_[_0xc96c('0x3e')](_0x215cad['where'],{'$or':_[_0xc96c('0x2d')](_0x215cad[_0xc96c('0x34')],function(_0x9cd1fd){var _0x12bf27={};_0x12bf27[_0x9cd1fd]={'$like':'%'+_0x3adefb['query'][_0xc96c('0x3d')]+'%'};return _0x12bf27;})});}_0x215cad=_[_0xc96c('0x3e')]({},_0x215cad,_0x3adefb['options']);return _0xcde9['getConfigurations'](_0x215cad);}})['then'](function(_0x46de63){if(_0x46de63){_0xad88c3=_0x46de63[_0xc96c('0x36')];if(!_0x3adefb[_0xc96c('0x32')][_0xc96c('0x37')](_0xc96c('0x38'))){_0x215cad['limit']=qs['limit'](_0x3adefb[_0xc96c('0x32')][_0xc96c('0x20')]);_0x215cad[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x3adefb[_0xc96c('0x32')]['offset']);}return _0xcde9[_0xc96c('0x4f')](_0x215cad);}})[_0xc96c('0x26')](function(_0x3a31bd){if(_0x3a31bd){return _0x3a31bd?{'count':_0xad88c3,'rows':_0x3a31bd}:null;}})[_0xc96c('0x26')](respondWithResult(_0x15367d,null))['catch'](handleError(_0x15367d,null));};exports['addConfiguration']=function(_0x443ed5,_0x229fae,_0x55bab7){if(_0x443ed5[_0xc96c('0x4c')]['id']){delete _0x443ed5['body']['id'];}return db[_0xc96c('0x2e')][_0xc96c('0x50')]({'where':{'id':_0x443ed5[_0xc96c('0x45')]['id']}})[_0xc96c('0x26')](handleEntityNotFound(_0x229fae,null))[_0xc96c('0x26')](function(_0x296e7d){if(_0x296e7d){_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x51')]=_0x296e7d['id'];_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x52')]=integrations['getSubjects'](_0x443ed5[_0xc96c('0x4c')]['channel'],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);_0x443ed5['body'][_0xc96c('0x53')]=integrations['getDescriptions'](_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x54')],_0x443ed5[_0xc96c('0x4c')][_0xc96c('0x2f')]);return db[_0xc96c('0x4d')][_0xc96c('0x4b')](_0x443ed5[_0xc96c('0x4c')],{'include':[{'model':db[_0xc96c('0x55')],'as':_0xc96c('0x52')},{'model':db['ZendeskField'],'as':_0xc96c('0x53')}]});}return null;})[_0xc96c('0x26')](respondWithResult(_0x229fae,null))[_0xc96c('0x43')](handleError(_0x229fae,null));};exports[_0xc96c('0x56')]=function(_0x5282cb,_0x4667f6,_0x1e927d){var _0x54f3fe='';return db['ZendeskAccount'][_0xc96c('0x50')]({'where':{'id':_0x5282cb['params']['id']},'attributes':['id',_0xc96c('0x57'),_0xc96c('0x58'),_0xc96c('0x59'),_0xc96c('0x5a'),_0xc96c('0x5b')]})[_0xc96c('0x26')](handleEntityNotFound(_0x4667f6,null))[_0xc96c('0x26')](function(_0x3fb9b9){if(_0x3fb9b9){_0x54f3fe=_0x3fb9b9[_0xc96c('0x5b')];var _0x54e2d3=_0x54f3fe[_0xc96c('0x5c')](-0x1);if(_0x54e2d3==='/'){_0x54f3fe=_0x54f3fe[_0xc96c('0x5d')](0x0,_0x54f3fe[_0xc96c('0x5e')](_0x54e2d3));}var _0x4831d3={'method':'GET','uri':util[_0xc96c('0x5f')](_0xc96c('0x60'),_0x54f3fe,_0xc96c('0x61')),'json':!![]};switch(_0x3fb9b9[_0xc96c('0x5a')]){case _0xc96c('0x58'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')]('Basic\x20%s',new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x63'),_0x3fb9b9['username'],_0x3fb9b9[_0xc96c('0x58')]))['toString'](_0xc96c('0x64')))};break;case _0xc96c('0x59'):_0x4831d3[_0xc96c('0x62')]={'Authorization':util[_0xc96c('0x5f')](_0xc96c('0x65'),new Buffer(util[_0xc96c('0x5f')](_0xc96c('0x66'),_0x3fb9b9[_0xc96c('0x57')],_0x3fb9b9[_0xc96c('0x59')]))['toString'](_0xc96c('0x64')))};break;default:throw new db[(_0xc96c('0x67'))]['ValidationError'](_0xc96c('0x68'));}return rp(_0x4831d3);}})['then'](function(_0x3c0363){if(_0x3c0363){var _0x669dec=[_0xc96c('0x69'),'description',_0xc96c('0x6a'),_0xc96c('0x6b')];_['remove'](_0x3c0363[_0xc96c('0x61')],function(_0x46bf83){return _0x669dec[_0xc96c('0x6c')](_0x46bf83['type']);});return{'count':_0x3c0363[_0xc96c('0x61')][_0xc96c('0x36')],'rows':_[_0xc96c('0x2d')](_0x3c0363[_0xc96c('0x61')],function(_0x2f4254){return{'id':_0x2f4254['id'],'name':_0x2f4254[_0xc96c('0x6d')]>0x7?_0x2f4254[_0xc96c('0x6e')]:_0x2f4254[_0xc96c('0x2f')],'custom':_0x2f4254[_0xc96c('0x6d')]>0x7?!![]:![],'options':_0x2f4254[_0xc96c('0x6f')]?_0x2f4254[_0xc96c('0x6f')]:_0x2f4254[_0xc96c('0x70')]?_0x2f4254[_0xc96c('0x70')]:[]};})};}})[_0xc96c('0x26')](respondWithResult(_0x4667f6,null))[_0xc96c('0x43')](function(_0x54c9ad){var _0x2c5134=_0x5282cb[_0xc96c('0x32')][_0xc96c('0x71')]?0x1f4:_0x54c9ad[_0xc96c('0x72')]||0x1f4;logger[_0xc96c('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0xc96c('0x56'),_0x2c5134,JSON[_0xc96c('0x74')](_0x54c9ad));delete _0x54c9ad[_0xc96c('0x2a')];if(_0x2c5134===0x191){_0x2c5134=0x190;}_0x4667f6[_0xc96c('0x1b')](_0x2c5134)[_0xc96c('0x2b')](_0x5282cb['query']['test']?{'message':_0xc96c('0x75'),'statusCode':_0x54c9ad[_0xc96c('0x72')]}:_0x54c9ad);});}; \ No newline at end of file +var _0xbee3=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','limit','set','reject','save','update','then','error','name','index','map','ZendeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','findOne','ZendeskConfiguration','rawAttributes','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x52a06a,_0x183d02){var _0x1a8e0f=function(_0x58f6a2){while(--_0x58f6a2){_0x52a06a['push'](_0x52a06a['shift']());}};_0x1a8e0f(++_0x183d02);}(_0xbee3,0xd5));var _0x3bee=function(_0x33cf20,_0x1ca335){_0x33cf20=_0x33cf20-0x0;var _0x500a5b=_0xbee3[_0x33cf20];return _0x500a5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3bee('0x1'));var moment=require(_0x3bee('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3bee('0x3'));var util=require(_0x3bee('0x4'));var path=require(_0x3bee('0x5'));var sox=require('sox');var csv=require(_0x3bee('0x6'));var ejs=require(_0x3bee('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bee('0x8'));var squel=require(_0x3bee('0x9'));var crypto=require(_0x3bee('0xa'));var jsforce=require(_0x3bee('0xb'));var deskjs=require(_0x3bee('0xc'));var toCsv=require(_0x3bee('0x6'));var querystring=require(_0x3bee('0xd'));var Papa=require('papaparse');var Redis=require(_0x3bee('0xe'));var authService=require(_0x3bee('0xf'));var qs=require(_0x3bee('0x10'));var as=require(_0x3bee('0x11'));var hardwareService=require(_0x3bee('0x12'));var logger=require(_0x3bee('0x13'))('api');var utils=require(_0x3bee('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3bee('0x15'));var db=require(_0x3bee('0x16'))['db'];var integrations=require(_0x3bee('0x17'));function respondWithStatusCode(_0x6950d0,_0x410124){_0x410124=_0x410124||0xcc;return function(_0x459129){if(_0x459129){return _0x6950d0[_0x3bee('0x18')](_0x410124);}return _0x6950d0['status'](_0x410124)[_0x3bee('0x19')]();};}function respondWithResult(_0x33504d,_0x31ac52){_0x31ac52=_0x31ac52||0xc8;return function(_0x237110){if(_0x237110){return _0x33504d[_0x3bee('0x1a')](_0x31ac52)['json'](_0x237110);}};}function respondWithFilteredResult(_0x558436,_0x346767){return function(_0x515397){if(_0x515397){var _0x2cfba7=typeof _0x346767[_0x3bee('0x1b')]==='undefined'&&typeof _0x346767['limit']===_0x3bee('0x1c');var _0x36c5aa=_0x515397[_0x3bee('0x1d')];var _0x631ff8=_0x2cfba7?0x0:_0x346767['offset'];var _0x30a1de=_0x2cfba7?_0x515397[_0x3bee('0x1d')]:_0x346767[_0x3bee('0x1b')]+_0x346767[_0x3bee('0x1e')];var _0x33d812;if(_0x30a1de>=_0x36c5aa){_0x30a1de=_0x36c5aa;_0x33d812=0xc8;}else{_0x33d812=0xce;}_0x558436[_0x3bee('0x1a')](_0x33d812);return _0x558436[_0x3bee('0x1f')]('Content-Range',_0x631ff8+'-'+_0x30a1de+'/'+_0x36c5aa)['json'](_0x515397);}return null;};}function patchUpdates(_0x1afd0f){return function(_0x30bba2){try{jsonpatch['apply'](_0x30bba2,_0x1afd0f,!![]);}catch(_0x471027){return BPromise[_0x3bee('0x20')](_0x471027);}return _0x30bba2[_0x3bee('0x21')]();};}function saveUpdates(_0x179e62,_0x28c248){return function(_0x26e92e){if(_0x26e92e){return _0x26e92e[_0x3bee('0x22')](_0x179e62)['then'](function(_0x8ae4ca){return _0x8ae4ca;});}return null;};}function removeEntity(_0x1ed0c1,_0x1fed5a){return function(_0x3bb884){if(_0x3bb884){return _0x3bb884['destroy']()[_0x3bee('0x23')](function(){_0x1ed0c1[_0x3bee('0x1a')](0xcc)[_0x3bee('0x19')]();});}};}function handleEntityNotFound(_0x4b4cd4,_0x5ed022){return function(_0x13181e){if(!_0x13181e){_0x4b4cd4[_0x3bee('0x18')](0x194);}return _0x13181e;};}function handleError(_0x5341e2,_0x2c0e50){_0x2c0e50=_0x2c0e50||0x1f4;return function(_0x1b4ce0){logger[_0x3bee('0x24')](_0x1b4ce0['stack']);if(_0x1b4ce0[_0x3bee('0x25')]){delete _0x1b4ce0[_0x3bee('0x25')];}_0x5341e2[_0x3bee('0x1a')](_0x2c0e50)['send'](_0x1b4ce0);};}exports[_0x3bee('0x26')]=function(_0xf08fb3,_0x3a3d92){var _0x496abd={},_0x1115ed={},_0x24d523={'count':0x0,'rows':[]};var _0x27ed99=_[_0x3bee('0x27')](db[_0x3bee('0x28')]['rawAttributes'],function(_0x564e45){return{'name':_0x564e45[_0x3bee('0x29')],'type':_0x564e45[_0x3bee('0x2a')][_0x3bee('0x2b')]};});_0x1115ed[_0x3bee('0x2c')]=_['map'](_0x27ed99,'name');_0x1115ed[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0xf08fb3['query']);_0x1115ed['filters']=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],_0x1115ed[_0x3bee('0x2d')]);_0x496abd[_0x3bee('0x30')]=_[_0x3bee('0x2f')](_0x1115ed[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x31')]));_0x496abd[_0x3bee('0x30')]=_0x496abd['attributes']['length']?_0x496abd[_0x3bee('0x30')]:_0x1115ed['model'];if(!_0xf08fb3['query'][_0x3bee('0x32')](_0x3bee('0x33'))){_0x496abd[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x496abd[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0xf08fb3['query'][_0x3bee('0x1b')]);}_0x496abd[_0x3bee('0x34')]=qs['sort'](_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x496abd[_0x3bee('0x36')]=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0xf08fb3['query'],_0x1115ed['filters']),_0x27ed99);if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x39')]){_0x496abd[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x496abd[_0x3bee('0x36')],{'$or':_[_0x3bee('0x27')](_0x27ed99,function(_0x2c6ca3){if(_0x2c6ca3[_0x3bee('0x2a')]!==_0x3bee('0x3b')){var _0x2591f1={};_0x2591f1[_0x2c6ca3[_0x3bee('0x25')]]={'$like':'%'+_0xf08fb3[_0x3bee('0x2d')]['filter']+'%'};return _0x2591f1;}})});}_0x496abd=_[_0x3bee('0x3a')]({},_0x496abd,_0xf08fb3[_0x3bee('0x3c')]);var _0x25158b={'where':_0x496abd[_0x3bee('0x36')]};return db[_0x3bee('0x28')][_0x3bee('0x1d')](_0x25158b)[_0x3bee('0x23')](function(_0x6195a3){_0x24d523[_0x3bee('0x1d')]=_0x6195a3;if(_0xf08fb3[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x496abd[_0x3bee('0x3e')]=[{'all':!![]}];}return db[_0x3bee('0x28')]['findAll'](_0x496abd);})[_0x3bee('0x23')](function(_0x2f30d7){_0x24d523[_0x3bee('0x3f')]=_0x2f30d7;return _0x24d523;})[_0x3bee('0x23')](respondWithFilteredResult(_0x3a3d92,_0x496abd))[_0x3bee('0x40')](handleError(_0x3a3d92,null));};exports[_0x3bee('0x41')]=function(_0x13dd72,_0xd1140d){var _0x5d9e1b={'raw':![],'where':{'id':_0x13dd72[_0x3bee('0x42')]['id']}},_0x10a59d={};_0x10a59d[_0x3bee('0x2c')]=_['keys'](db[_0x3bee('0x28')]['rawAttributes']);_0x10a59d[_0x3bee('0x2d')]=_['keys'](_0x13dd72['query']);_0x10a59d[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x10a59d[_0x3bee('0x2c')],_0x10a59d[_0x3bee('0x2d')]);_0x5d9e1b[_0x3bee('0x30')]=_['intersection'](_0x10a59d['model'],qs[_0x3bee('0x31')](_0x13dd72['query'][_0x3bee('0x31')]));_0x5d9e1b['attributes']=_0x5d9e1b[_0x3bee('0x30')]['length']?_0x5d9e1b[_0x3bee('0x30')]:_0x10a59d[_0x3bee('0x2c')];if(_0x13dd72[_0x3bee('0x2d')][_0x3bee('0x3d')]){_0x5d9e1b['include']=[{'all':!![]}];}_0x5d9e1b=_['merge']({},_0x5d9e1b,_0x13dd72[_0x3bee('0x3c')]);return db['ZendeskAccount']['find'](_0x5d9e1b)['then'](handleEntityNotFound(_0xd1140d,null))[_0x3bee('0x23')](respondWithResult(_0xd1140d,null))['catch'](handleError(_0xd1140d,null));};exports[_0x3bee('0x43')]=function(_0x33d615,_0xd87fd2){return db['ZendeskAccount'][_0x3bee('0x43')](_0x33d615['body'],{})[_0x3bee('0x23')](respondWithResult(_0xd87fd2,0xc9))['catch'](handleError(_0xd87fd2,null));};exports[_0x3bee('0x22')]=function(_0x16b096,_0x15a96a){if(_0x16b096['body']['id']){delete _0x16b096[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')][_0x3bee('0x45')]({'where':{'id':_0x16b096['params']['id']}})['then'](handleEntityNotFound(_0x15a96a,null))[_0x3bee('0x23')](saveUpdates(_0x16b096[_0x3bee('0x44')],null))[_0x3bee('0x23')](respondWithResult(_0x15a96a,null))[_0x3bee('0x40')](handleError(_0x15a96a,null));};exports[_0x3bee('0x46')]=function(_0x21ab40,_0x4005a3){return db['ZendeskAccount'][_0x3bee('0x45')]({'where':{'id':_0x21ab40[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x4005a3,null))['then'](removeEntity(_0x4005a3,null))[_0x3bee('0x40')](handleError(_0x4005a3,null));};exports['getConfigurations']=function(_0x1cb54e,_0x2162ce,_0x1f0f23){var _0x4fb836={};var _0x1a13fd={};var _0x3beac9;var _0x127cb8;return db['ZendeskAccount'][_0x3bee('0x47')]({'where':{'id':_0x1cb54e[_0x3bee('0x42')]['id']}})['then'](handleEntityNotFound(_0x2162ce,null))[_0x3bee('0x23')](function(_0x14940e){if(_0x14940e){_0x3beac9=_0x14940e;_0x1a13fd['model']=_[_0x3bee('0x2e')](db[_0x3bee('0x48')][_0x3bee('0x49')]);_0x1a13fd[_0x3bee('0x2d')]=_[_0x3bee('0x2e')](_0x1cb54e[_0x3bee('0x2d')]);_0x1a13fd[_0x3bee('0x37')]=_[_0x3bee('0x2f')](_0x1a13fd['model'],_0x1a13fd['query']);_0x4fb836[_0x3bee('0x30')]=_['intersection'](_0x1a13fd[_0x3bee('0x2c')],qs[_0x3bee('0x31')](_0x1cb54e[_0x3bee('0x2d')]['fields']));_0x4fb836[_0x3bee('0x30')]=_0x4fb836[_0x3bee('0x30')][_0x3bee('0x4a')]?_0x4fb836['attributes']:_0x1a13fd[_0x3bee('0x2c')];_0x4fb836['order']=qs[_0x3bee('0x35')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x35')]);_0x4fb836['where']=qs[_0x3bee('0x37')](_[_0x3bee('0x38')](_0x1cb54e[_0x3bee('0x2d')],_0x1a13fd['filters']));if(_0x1cb54e['query'][_0x3bee('0x39')]){_0x4fb836[_0x3bee('0x36')]=_[_0x3bee('0x3a')](_0x4fb836['where'],{'$or':_['map'](_0x4fb836[_0x3bee('0x30')],function(_0x572fa6){var _0x5cd620={};_0x5cd620[_0x572fa6]={'$like':'%'+_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x39')]+'%'};return _0x5cd620;})});}_0x4fb836=_[_0x3bee('0x3a')]({},_0x4fb836,_0x1cb54e['options']);return _0x3beac9['getConfigurations'](_0x4fb836);}})[_0x3bee('0x23')](function(_0x1f4eb9){if(_0x1f4eb9){_0x127cb8=_0x1f4eb9['length'];if(!_0x1cb54e[_0x3bee('0x2d')]['hasOwnProperty'](_0x3bee('0x33'))){_0x4fb836[_0x3bee('0x1e')]=qs[_0x3bee('0x1e')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1e')]);_0x4fb836[_0x3bee('0x1b')]=qs[_0x3bee('0x1b')](_0x1cb54e[_0x3bee('0x2d')][_0x3bee('0x1b')]);}return _0x3beac9[_0x3bee('0x4b')](_0x4fb836);}})[_0x3bee('0x23')](function(_0x5647c8){if(_0x5647c8){return _0x5647c8?{'count':_0x127cb8,'rows':_0x5647c8}:null;}})['then'](respondWithResult(_0x2162ce,null))['catch'](handleError(_0x2162ce,null));};exports[_0x3bee('0x4c')]=function(_0xb5a685,_0x4acba2,_0x9828ad){if(_0xb5a685['body']['id']){delete _0xb5a685[_0x3bee('0x44')]['id'];}return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0xb5a685['params']['id']}})[_0x3bee('0x23')](handleEntityNotFound(_0x4acba2,null))[_0x3bee('0x23')](function(_0x20be01){if(_0x20be01){_0xb5a685['body'][_0x3bee('0x4d')]=_0x20be01['id'];_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4e')]=integrations['getSubjects'](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);_0xb5a685['body']['Descriptions']=integrations[_0x3bee('0x50')](_0xb5a685[_0x3bee('0x44')][_0x3bee('0x4f')],_0xb5a685[_0x3bee('0x44')][_0x3bee('0x2a')]);return db['ZendeskConfiguration'][_0x3bee('0x43')](_0xb5a685['body'],{'include':[{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x4e')},{'model':db[_0x3bee('0x51')],'as':_0x3bee('0x52')}]});}return null;})[_0x3bee('0x23')](respondWithResult(_0x4acba2,null))[_0x3bee('0x40')](handleError(_0x4acba2,null));};exports[_0x3bee('0x53')]=function(_0x4d52f3,_0x25f936,_0x28c16e){var _0x42045d='';return db[_0x3bee('0x28')]['findOne']({'where':{'id':_0x4d52f3[_0x3bee('0x42')]['id']},'attributes':['id',_0x3bee('0x54'),_0x3bee('0x55'),_0x3bee('0x56'),_0x3bee('0x57'),_0x3bee('0x58')]})[_0x3bee('0x23')](handleEntityNotFound(_0x25f936,null))[_0x3bee('0x23')](function(_0x519efb){if(_0x519efb){_0x42045d=_0x519efb[_0x3bee('0x58')];var _0x110575=_0x42045d[_0x3bee('0x59')](-0x1);if(_0x110575==='/'){_0x42045d=_0x42045d['substring'](0x0,_0x42045d[_0x3bee('0x5a')](_0x110575));}var _0x479ee2={'method':_0x3bee('0x5b'),'uri':util[_0x3bee('0x5c')](_0x3bee('0x5d'),_0x42045d,_0x3bee('0x5e')),'json':!![]};switch(_0x519efb[_0x3bee('0x57')]){case _0x3bee('0x55'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x61'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x55')]))[_0x3bee('0x62')](_0x3bee('0x63')))};break;case _0x3bee('0x56'):_0x479ee2[_0x3bee('0x5f')]={'Authorization':util[_0x3bee('0x5c')](_0x3bee('0x60'),new Buffer(util[_0x3bee('0x5c')](_0x3bee('0x64'),_0x519efb[_0x3bee('0x54')],_0x519efb[_0x3bee('0x56')]))['toString'](_0x3bee('0x63')))};break;default:throw new db[(_0x3bee('0x65'))][(_0x3bee('0x66'))](_0x3bee('0x67'));}return rp(_0x479ee2);}})[_0x3bee('0x23')](function(_0x4be1c8){if(_0x4be1c8){var _0x2d6a3d=[_0x3bee('0x68'),_0x3bee('0x69'),'group',_0x3bee('0x6a')];_[_0x3bee('0x6b')](_0x4be1c8['ticket_fields'],function(_0xbfb4af){return _0x2d6a3d['includes'](_0xbfb4af[_0x3bee('0x2a')]);});return{'count':_0x4be1c8[_0x3bee('0x5e')][_0x3bee('0x4a')],'rows':_['map'](_0x4be1c8['ticket_fields'],function(_0x29a2ea){return{'id':_0x29a2ea['id'],'name':_0x29a2ea[_0x3bee('0x6c')]>0x7?_0x29a2ea[_0x3bee('0x6d')]:_0x29a2ea[_0x3bee('0x2a')],'custom':_0x29a2ea[_0x3bee('0x6c')]>0x7?!![]:![],'options':_0x29a2ea[_0x3bee('0x6e')]?_0x29a2ea[_0x3bee('0x6e')]:_0x29a2ea[_0x3bee('0x6f')]?_0x29a2ea['custom_field_options']:[]};})};}})[_0x3bee('0x23')](respondWithResult(_0x25f936,null))[_0x3bee('0x40')](function(_0x22d336){var _0x470ea8=_0x4d52f3[_0x3bee('0x2d')][_0x3bee('0x70')]?0x1f4:_0x22d336[_0x3bee('0x71')]||0x1f4;logger['error'](_0x3bee('0x72'),_0x3bee('0x53'),_0x470ea8,JSON['stringify'](_0x22d336));delete _0x22d336[_0x3bee('0x25')];if(_0x470ea8===0x191){_0x470ea8=0x190;}_0x25f936[_0x3bee('0x1a')](_0x470ea8)['send'](_0x4d52f3[_0x3bee('0x2d')]['test']?{'message':_0x3bee('0x73'),'statusCode':_0x22d336[_0x3bee('0x71')]}:_0x22d336);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 4b1f9d4..2522000 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 _0x3b1a=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x445971,_0x432a07){var _0x3e5e23=function(_0x4f91ee){while(--_0x4f91ee){_0x445971['push'](_0x445971['shift']());}};_0x3e5e23(++_0x432a07);}(_0x3b1a,0x9e));var _0xa3b1=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x3b1a[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require(_0xa3b1('0x0'));var util=require(_0xa3b1('0x1'));var logger=require(_0xa3b1('0x2'))(_0xa3b1('0x3'));var moment=require(_0xa3b1('0x4'));var BPromise=require(_0xa3b1('0x5'));var rp=require(_0xa3b1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3b1('0x7'));var config=require(_0xa3b1('0x8'));var attributes=require(_0xa3b1('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xa3b1('0xa')]=function(_0x1c2c61,_0x17f30e){return _0x1c2c61[_0xa3b1('0xb')](_0xa3b1('0xc'),attributes,{'tableName':_0xa3b1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91f7=['moment','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x91f7,0x1e9));var _0x791f=function(_0xb05193,_0x14ac4a){_0xb05193=_0xb05193-0x0;var _0x52b6fb=_0x91f7[_0xb05193];return _0x52b6fb;};'use strict';var _=require(_0x791f('0x0'));var util=require(_0x791f('0x1'));var logger=require(_0x791f('0x2'))('api');var moment=require(_0x791f('0x3'));var BPromise=require('bluebird');var rp=require(_0x791f('0x4'));var fs=require('fs');var path=require(_0x791f('0x5'));var rimraf=require(_0x791f('0x6'));var config=require(_0x791f('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x791f('0x8'));module[_0x791f('0x9')]=function(_0x28e4ce,_0x30034e){return _0x28e4ce['define'](_0x791f('0xa'),attributes,{'tableName':_0x791f('0xb'),'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 c137397..808d2d7 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 _0x6d6b=['code','ZendeskAccount,\x20%s,\x20%s','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','include','map','model','debug','find','ShowZendeskAccount','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x2e63f0,_0x9bda70){var _0x2b5050=function(_0xb82fbc){while(--_0xb82fbc){_0x2e63f0['push'](_0x2e63f0['shift']());}};_0x2b5050(++_0x9bda70);}(_0x6d6b,0x7d));var _0xb6d6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6d6b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb6d6('0x0'));var util=require('util');var moment=require(_0xb6d6('0x1'));var BPromise=require('bluebird');var rs=require(_0xb6d6('0x2'));var fs=require('fs');var Redis=require(_0xb6d6('0x3'));var db=require(_0xb6d6('0x4'))['db'];var utils=require(_0xb6d6('0x5'));var logger=require(_0xb6d6('0x6'))(_0xb6d6('0x7'));var config=require(_0xb6d6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb6d6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5406,_0x2d1c84,_0x18224d){return new BPromise(function(_0x4bcdd4,_0x23d5ae){return client[_0xb6d6('0xa')](_0x5d5406,_0x18224d)[_0xb6d6('0xb')](function(_0x4b0b55){logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2d1c84,_0xb6d6('0xc'));logger['debug'](_0xb6d6('0xd'),_0x2d1c84,_0xb6d6('0xc'),JSON['stringify'](_0x4b0b55));if(_0x4b0b55[_0xb6d6('0xe')]){if(_0x4b0b55[_0xb6d6('0xe')][_0xb6d6('0xf')]===0x1f4){logger[_0xb6d6('0xe')](_0xb6d6('0x10'),_0x2d1c84,_0x4b0b55['error'][_0xb6d6('0x11')]);return _0x23d5ae(_0x4b0b55[_0xb6d6('0xe')][_0xb6d6('0x11')]);}logger[_0xb6d6('0xe')](_0xb6d6('0x10'),_0x2d1c84,_0x4b0b55[_0xb6d6('0xe')][_0xb6d6('0x11')]);return _0x4bcdd4(_0x4b0b55[_0xb6d6('0xe')][_0xb6d6('0x11')]);}else{logger[_0xb6d6('0x12')](_0xb6d6('0x10'),_0x2d1c84,_0xb6d6('0xc'));_0x4bcdd4(_0x4b0b55[_0xb6d6('0x13')][_0xb6d6('0x11')]);}})[_0xb6d6('0x14')](function(_0x2f1f5b){logger['error'](_0xb6d6('0x10'),_0x2d1c84,_0x2f1f5b);_0x23d5ae(_0x2f1f5b);});});}exports[_0xb6d6('0x15')]=function(_0x427a48){var _0x591b35=this;return new Promise(function(_0x3f907b,_0x3413a2){return db[_0xb6d6('0x16')]['findAll']({'raw':_0x427a48[_0xb6d6('0x17')]?_0x427a48[_0xb6d6('0x17')][_0xb6d6('0x18')]===undefined?!![]:![]:!![],'where':_0x427a48[_0xb6d6('0x17')]?_0x427a48[_0xb6d6('0x17')][_0xb6d6('0x19')]||null:null,'attributes':_0x427a48[_0xb6d6('0x17')]?_0x427a48[_0xb6d6('0x17')][_0xb6d6('0x1a')]||null:null,'limit':_0x427a48['options']?_0x427a48['options'][_0xb6d6('0x1b')]||null:null,'include':_0x427a48[_0xb6d6('0x17')]?_0x427a48[_0xb6d6('0x17')][_0xb6d6('0x1c')]?_[_0xb6d6('0x1d')](_0x427a48[_0xb6d6('0x17')]['include'],function(_0x78d6a0){return{'model':db[_0x78d6a0[_0xb6d6('0x1e')]],'as':_0x78d6a0['as'],'attributes':_0x78d6a0[_0xb6d6('0x1a')],'include':_0x78d6a0[_0xb6d6('0x1c')]?_[_0xb6d6('0x1d')](_0x78d6a0[_0xb6d6('0x1c')],function(_0x47abad){return{'model':db[_0x47abad[_0xb6d6('0x1e')]],'as':_0x47abad['as'],'attributes':_0x47abad[_0xb6d6('0x1a')],'include':_0x47abad[_0xb6d6('0x1c')]?_[_0xb6d6('0x1d')](_0x47abad[_0xb6d6('0x1c')],function(_0x1ff5fa){return{'model':db[_0x1ff5fa['model']],'as':_0x1ff5fa['as'],'attributes':_0x1ff5fa[_0xb6d6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb6d6('0xb')](function(_0x4a8c3c){logger[_0xb6d6('0x12')](_0xb6d6('0x15'),_0x427a48);logger[_0xb6d6('0x1f')](_0xb6d6('0x15'),_0x427a48,JSON['stringify'](_0x4a8c3c));_0x3f907b(_0x4a8c3c);})[_0xb6d6('0x14')](function(_0x737ef3){logger['error']('GetZendeskAccount',_0x737ef3[_0xb6d6('0x11')],_0x427a48);_0x3413a2(_0x591b35[_0xb6d6('0xe')](0x1f4,_0x737ef3[_0xb6d6('0x11')]));});});};exports['ShowZendeskAccount']=function(_0x49c064){var _0x35dee6=this;return new Promise(function(_0x182fb1,_0x2c81eb){return db[_0xb6d6('0x16')][_0xb6d6('0x20')]({'raw':_0x49c064[_0xb6d6('0x17')]?_0x49c064['options']['raw']===undefined?!![]:![]:!![],'where':_0x49c064['options']?_0x49c064[_0xb6d6('0x17')]['where']||null:null,'attributes':_0x49c064[_0xb6d6('0x17')]?_0x49c064[_0xb6d6('0x17')][_0xb6d6('0x1a')]||null:null,'include':_0x49c064[_0xb6d6('0x17')]?_0x49c064['options'][_0xb6d6('0x1c')]?_['map'](_0x49c064[_0xb6d6('0x17')][_0xb6d6('0x1c')],function(_0xbe2410){return{'model':db[_0xbe2410[_0xb6d6('0x1e')]],'as':_0xbe2410['as'],'attributes':_0xbe2410['attributes'],'include':_0xbe2410[_0xb6d6('0x1c')]?_[_0xb6d6('0x1d')](_0xbe2410[_0xb6d6('0x1c')],function(_0x3a90f3){return{'model':db[_0x3a90f3[_0xb6d6('0x1e')]],'as':_0x3a90f3['as'],'attributes':_0x3a90f3['attributes'],'include':_0x3a90f3[_0xb6d6('0x1c')]?_[_0xb6d6('0x1d')](_0x3a90f3[_0xb6d6('0x1c')],function(_0xce9c12){return{'model':db[_0xce9c12[_0xb6d6('0x1e')]],'as':_0xce9c12['as'],'attributes':_0xce9c12['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6d6('0xb')](function(_0x4e6f76){logger[_0xb6d6('0x12')](_0xb6d6('0x21'),_0x49c064);logger[_0xb6d6('0x1f')](_0xb6d6('0x21'),_0x49c064,JSON[_0xb6d6('0x22')](_0x4e6f76));_0x182fb1(_0x4e6f76);})['catch'](function(_0x2e866a){logger[_0xb6d6('0xe')]('ShowZendeskAccount',_0x2e866a[_0xb6d6('0x11')],_0x49c064);_0x2c81eb(_0x35dee6[_0xb6d6('0xe')](0x1f4,_0x2e866a[_0xb6d6('0x11')]));});});}; \ No newline at end of file +var _0xc991=['ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','request\x20sent','result','GetZendeskAccount','ZendeskAccount','options','where','attributes','include','map','model','then','catch','ShowZendeskAccount','find','raw','stringify','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug'];(function(_0x1da196,_0x4b4bc4){var _0x597847=function(_0x1aa142){while(--_0x1aa142){_0x1da196['push'](_0x1da196['shift']());}};_0x597847(++_0x4b4bc4);}(_0xc991,0xfc));var _0x1c99=function(_0x4b0c9c,_0x156e17){_0x4b0c9c=_0x4b0c9c-0x0;var _0x188541=_0xc991[_0x4b0c9c];return _0x188541;};'use strict';var _=require(_0x1c99('0x0'));var util=require(_0x1c99('0x1'));var moment=require('moment');var BPromise=require(_0x1c99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c99('0x3'));var db=require(_0x1c99('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1c99('0x5'));var config=require(_0x1c99('0x6'));var jayson=require(_0x1c99('0x7'));var client=jayson['client'][_0x1c99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x561f40,_0x2d714e,_0x216821){return new BPromise(function(_0x43a2fb,_0x24bab7){return client[_0x1c99('0x9')](_0x561f40,_0x216821)['then'](function(_0x170cbd){logger[_0x1c99('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x2d714e,'request\x20sent');logger[_0x1c99('0xb')](_0x1c99('0xc'),_0x2d714e,'request\x20sent',JSON['stringify'](_0x170cbd));if(_0x170cbd[_0x1c99('0xd')]){if(_0x170cbd[_0x1c99('0xd')][_0x1c99('0xe')]===0x1f4){logger[_0x1c99('0xd')](_0x1c99('0xf'),_0x2d714e,_0x170cbd[_0x1c99('0xd')][_0x1c99('0x10')]);return _0x24bab7(_0x170cbd[_0x1c99('0xd')][_0x1c99('0x10')]);}logger[_0x1c99('0xd')](_0x1c99('0xf'),_0x2d714e,_0x170cbd['error'][_0x1c99('0x10')]);return _0x43a2fb(_0x170cbd['error'][_0x1c99('0x10')]);}else{logger[_0x1c99('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0x2d714e,_0x1c99('0x11'));_0x43a2fb(_0x170cbd[_0x1c99('0x12')][_0x1c99('0x10')]);}})['catch'](function(_0x3216a7){logger[_0x1c99('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2d714e,_0x3216a7);_0x24bab7(_0x3216a7);});});}exports[_0x1c99('0x13')]=function(_0x1ff07f){var _0x505e6d=this;return new Promise(function(_0x223e4b,_0x39a8a6){return db[_0x1c99('0x14')]['findAll']({'raw':_0x1ff07f['options']?_0x1ff07f[_0x1c99('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff07f[_0x1c99('0x15')]?_0x1ff07f['options'][_0x1c99('0x16')]||null:null,'attributes':_0x1ff07f[_0x1c99('0x15')]?_0x1ff07f[_0x1c99('0x15')][_0x1c99('0x17')]||null:null,'limit':_0x1ff07f['options']?_0x1ff07f['options']['limit']||null:null,'include':_0x1ff07f[_0x1c99('0x15')]?_0x1ff07f[_0x1c99('0x15')][_0x1c99('0x18')]?_[_0x1c99('0x19')](_0x1ff07f[_0x1c99('0x15')][_0x1c99('0x18')],function(_0x2504a9){return{'model':db[_0x2504a9[_0x1c99('0x1a')]],'as':_0x2504a9['as'],'attributes':_0x2504a9['attributes'],'include':_0x2504a9[_0x1c99('0x18')]?_[_0x1c99('0x19')](_0x2504a9[_0x1c99('0x18')],function(_0x4764b5){return{'model':db[_0x4764b5['model']],'as':_0x4764b5['as'],'attributes':_0x4764b5[_0x1c99('0x17')],'include':_0x4764b5['include']?_[_0x1c99('0x19')](_0x4764b5[_0x1c99('0x18')],function(_0x510f77){return{'model':db[_0x510f77[_0x1c99('0x1a')]],'as':_0x510f77['as'],'attributes':_0x510f77['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c99('0x1b')](function(_0x47ccb5){logger['info'](_0x1c99('0x13'),_0x1ff07f);logger['debug'](_0x1c99('0x13'),_0x1ff07f,JSON['stringify'](_0x47ccb5));_0x223e4b(_0x47ccb5);})[_0x1c99('0x1c')](function(_0x392b5d){logger[_0x1c99('0xd')](_0x1c99('0x13'),_0x392b5d[_0x1c99('0x10')],_0x1ff07f);_0x39a8a6(_0x505e6d[_0x1c99('0xd')](0x1f4,_0x392b5d[_0x1c99('0x10')]));});});};exports[_0x1c99('0x1d')]=function(_0x2b93e4){var _0x51eace=this;return new Promise(function(_0xa479d0,_0x57eb06){return db[_0x1c99('0x14')][_0x1c99('0x1e')]({'raw':_0x2b93e4[_0x1c99('0x15')]?_0x2b93e4[_0x1c99('0x15')][_0x1c99('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b93e4['options']?_0x2b93e4[_0x1c99('0x15')][_0x1c99('0x16')]||null:null,'attributes':_0x2b93e4[_0x1c99('0x15')]?_0x2b93e4[_0x1c99('0x15')][_0x1c99('0x17')]||null:null,'include':_0x2b93e4['options']?_0x2b93e4[_0x1c99('0x15')][_0x1c99('0x18')]?_[_0x1c99('0x19')](_0x2b93e4[_0x1c99('0x15')]['include'],function(_0x5cbd4a){return{'model':db[_0x5cbd4a[_0x1c99('0x1a')]],'as':_0x5cbd4a['as'],'attributes':_0x5cbd4a[_0x1c99('0x17')],'include':_0x5cbd4a[_0x1c99('0x18')]?_[_0x1c99('0x19')](_0x5cbd4a[_0x1c99('0x18')],function(_0x3eb857){return{'model':db[_0x3eb857[_0x1c99('0x1a')]],'as':_0x3eb857['as'],'attributes':_0x3eb857[_0x1c99('0x17')],'include':_0x3eb857[_0x1c99('0x18')]?_['map'](_0x3eb857[_0x1c99('0x18')],function(_0x17a5e7){return{'model':db[_0x17a5e7[_0x1c99('0x1a')]],'as':_0x17a5e7['as'],'attributes':_0x17a5e7[_0x1c99('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1c99('0x1b')](function(_0x14a852){logger['info'](_0x1c99('0x1d'),_0x2b93e4);logger['debug'](_0x1c99('0x1d'),_0x2b93e4,JSON[_0x1c99('0x20')](_0x14a852));_0xa479d0(_0x14a852);})[_0x1c99('0x1c')](function(_0x480eb7){logger['error'](_0x1c99('0x1d'),_0x480eb7[_0x1c99('0x10')],_0x2b93e4);_0x57eb06(_0x51eace[_0x1c99('0xd')](0x1f4,_0x480eb7['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index b4cf8d3..f0e5026 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 _0x7916=['getDescriptions','get','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x33d73d,_0x33a4ab){var _0x1d8fd0=function(_0xec3916){while(--_0xec3916){_0x33d73d['push'](_0x33d73d['shift']());}};_0x1d8fd0(++_0x33a4ab);}(_0x7916,0x128));var _0x6791=function(_0x113dd1,_0x15aaa1){_0x113dd1=_0x113dd1-0x0;var _0x1605e0=_0x7916[_0x113dd1];return _0x1605e0;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id/fields',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')](_0x6791('0x12'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x14')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x15')]);router[_0x6791('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6791('0x16')]);router['put'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0x17')]);router[_0x6791('0x18')]('/:id',auth[_0x6791('0x8')](),controller['destroy']);module[_0x6791('0x19')]=router; \ No newline at end of file +var _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x3a081b,_0x516437){_0x3a081b=_0x3a081b-0x0;var _0xb166c4=_0xbdb7[_0x3a081b];return _0xb166c4;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6fa3d1e..14252b0 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 _0x25a3=['STRING','sequelize'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x25a3,0x10f));var _0x325a=function(_0x5995d2,_0x3c9886){_0x5995d2=_0x5995d2-0x0;var _0x20590c=_0x25a3[_0x5995d2];return _0x20590c;};'use strict';var Sequelize=require(_0x325a('0x0'));module['exports']={'name':{'type':Sequelize[_0x325a('0x1')]},'description':{'type':Sequelize[_0x325a('0x1')]}}; \ No newline at end of file +var _0xf513=['sequelize','STRING'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xf513,0x1f2));var _0x3f51=function(_0x543ee4,_0x127b27){_0x543ee4=_0x543ee4-0x0;var _0x20c772=_0xf513[_0x543ee4];return _0x20c772;};'use strict';var Sequelize=require(_0x3f51('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f51('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1a2797e..8895c25 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 _0x27e3=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','include','find','create','body','destroy','getFields','findOne','params','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x27e3,0xf1));var _0x327e=function(_0xb1a1c,_0x251bf9){_0xb1a1c=_0xb1a1c-0x0;var _0x5dcf39=_0x27e3[_0xb1a1c];return _0x5dcf39;};'use strict';var emlformat=require(_0x327e('0x0'));var rimraf=require(_0x327e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x327e('0x2'));var moment=require(_0x327e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x327e('0x4'));var util=require(_0x327e('0x5'));var path=require(_0x327e('0x6'));var sox=require(_0x327e('0x7'));var csv=require(_0x327e('0x8'));var ejs=require(_0x327e('0x9'));var fs=require('fs');var fs_extra=require(_0x327e('0xa'));var _=require('lodash');var squel=require(_0x327e('0xb'));var crypto=require(_0x327e('0xc'));var jsforce=require(_0x327e('0xd'));var deskjs=require(_0x327e('0xe'));var toCsv=require(_0x327e('0x8'));var querystring=require('querystring');var Papa=require(_0x327e('0xf'));var Redis=require(_0x327e('0x10'));var authService=require(_0x327e('0x11'));var qs=require(_0x327e('0x12'));var as=require(_0x327e('0x13'));var hardwareService=require(_0x327e('0x14'));var logger=require(_0x327e('0x15'))(_0x327e('0x16'));var utils=require(_0x327e('0x17'));var config=require(_0x327e('0x18'));var licenseUtil=require(_0x327e('0x19'));var db=require(_0x327e('0x1a'))['db'];function respondWithStatusCode(_0x364bea,_0x1d7505){_0x1d7505=_0x1d7505||0xcc;return function(_0x14bc77){if(_0x14bc77){return _0x364bea[_0x327e('0x1b')](_0x1d7505);}return _0x364bea[_0x327e('0x1c')](_0x1d7505)[_0x327e('0x1d')]();};}function respondWithResult(_0x3a5f12,_0x5d828e){_0x5d828e=_0x5d828e||0xc8;return function(_0x7e8ef3){if(_0x7e8ef3){return _0x3a5f12[_0x327e('0x1c')](_0x5d828e)[_0x327e('0x1e')](_0x7e8ef3);}};}function respondWithFilteredResult(_0xd99de0,_0x16f419){return function(_0x23eb76){if(_0x23eb76){var _0x5b378b=typeof _0x16f419['offset']===_0x327e('0x1f')&&typeof _0x16f419[_0x327e('0x20')]===_0x327e('0x1f');var _0x2264cd=_0x23eb76[_0x327e('0x21')];var _0x518786=_0x5b378b?0x0:_0x16f419[_0x327e('0x22')];var _0x275035=_0x5b378b?_0x23eb76['count']:_0x16f419[_0x327e('0x22')]+_0x16f419[_0x327e('0x20')];var _0x295479;if(_0x275035>=_0x2264cd){_0x275035=_0x2264cd;_0x295479=0xc8;}else{_0x295479=0xce;}_0xd99de0['status'](_0x295479);return _0xd99de0[_0x327e('0x23')](_0x327e('0x24'),_0x518786+'-'+_0x275035+'/'+_0x2264cd)[_0x327e('0x1e')](_0x23eb76);}return null;};}function patchUpdates(_0x2020ef){return function(_0x4055fd){try{jsonpatch[_0x327e('0x25')](_0x4055fd,_0x2020ef,!![]);}catch(_0xd79c96){return BPromise[_0x327e('0x26')](_0xd79c96);}return _0x4055fd[_0x327e('0x27')]();};}function saveUpdates(_0xd2f17c,_0x4d3ab2){return function(_0x437785){if(_0x437785){return _0x437785[_0x327e('0x28')](_0xd2f17c)[_0x327e('0x29')](function(_0x28bc1e){return _0x28bc1e;});}return null;};}function removeEntity(_0x2bd717,_0x16dc2d){return function(_0x4fb618){if(_0x4fb618){return _0x4fb618['destroy']()['then'](function(){_0x2bd717[_0x327e('0x1c')](0xcc)[_0x327e('0x1d')]();});}};}function handleEntityNotFound(_0x3edf0a,_0x359bb4){return function(_0x14f8c5){if(!_0x14f8c5){_0x3edf0a['sendStatus'](0x194);}return _0x14f8c5;};}function handleError(_0x4eb0f1,_0x503f79){_0x503f79=_0x503f79||0x1f4;return function(_0x56a786){logger[_0x327e('0x2a')](_0x56a786[_0x327e('0x2b')]);if(_0x56a786[_0x327e('0x2c')]){delete _0x56a786[_0x327e('0x2c')];}_0x4eb0f1[_0x327e('0x1c')](_0x503f79)[_0x327e('0x2d')](_0x56a786);};}exports['index']=function(_0x28f549,_0x2718ac){var _0x140e7a={},_0xe9ff68={},_0x5a8f29={'count':0x0,'rows':[]};var _0xe0a22b=_[_0x327e('0x2e')](db[_0x327e('0x2f')][_0x327e('0x30')],function(_0x53c204){return{'name':_0x53c204['fieldName'],'type':_0x53c204[_0x327e('0x31')][_0x327e('0x32')]};});_0xe9ff68['model']=_['map'](_0xe0a22b,_0x327e('0x2c'));_0xe9ff68[_0x327e('0x33')]=_[_0x327e('0x34')](_0x28f549[_0x327e('0x33')]);_0xe9ff68[_0x327e('0x35')]=_[_0x327e('0x36')](_0xe9ff68[_0x327e('0x37')],_0xe9ff68[_0x327e('0x33')]);_0x140e7a[_0x327e('0x38')]=_[_0x327e('0x36')](_0xe9ff68[_0x327e('0x37')],qs[_0x327e('0x39')](_0x28f549[_0x327e('0x33')][_0x327e('0x39')]));_0x140e7a[_0x327e('0x38')]=_0x140e7a[_0x327e('0x38')][_0x327e('0x3a')]?_0x140e7a[_0x327e('0x38')]:_0xe9ff68[_0x327e('0x37')];if(!_0x28f549['query'][_0x327e('0x3b')](_0x327e('0x3c'))){_0x140e7a[_0x327e('0x20')]=qs['limit'](_0x28f549[_0x327e('0x33')][_0x327e('0x20')]);_0x140e7a['offset']=qs['offset'](_0x28f549[_0x327e('0x33')][_0x327e('0x22')]);}_0x140e7a[_0x327e('0x3d')]=qs['sort'](_0x28f549[_0x327e('0x33')][_0x327e('0x3e')]);_0x140e7a[_0x327e('0x3f')]=qs['filters'](_['pick'](_0x28f549[_0x327e('0x33')],_0xe9ff68[_0x327e('0x35')]),_0xe0a22b);if(_0x28f549[_0x327e('0x33')]['filter']){_0x140e7a['where']=_[_0x327e('0x40')](_0x140e7a[_0x327e('0x3f')],{'$or':_[_0x327e('0x2e')](_0xe0a22b,function(_0x5eb9c6){if(_0x5eb9c6[_0x327e('0x31')]!==_0x327e('0x41')){var _0x487cd4={};_0x487cd4[_0x5eb9c6[_0x327e('0x2c')]]={'$like':'%'+_0x28f549[_0x327e('0x33')][_0x327e('0x42')]+'%'};return _0x487cd4;}})});}_0x140e7a=_[_0x327e('0x40')]({},_0x140e7a,_0x28f549[_0x327e('0x43')]);var _0x5e7271={'where':_0x140e7a['where']};return db[_0x327e('0x2f')][_0x327e('0x21')](_0x5e7271)[_0x327e('0x29')](function(_0xc738df){_0x5a8f29['count']=_0xc738df;if(_0x28f549[_0x327e('0x33')][_0x327e('0x44')]){_0x140e7a['include']=[{'all':!![]}];}return db[_0x327e('0x2f')][_0x327e('0x45')](_0x140e7a);})[_0x327e('0x29')](function(_0x2873d5){_0x5a8f29[_0x327e('0x46')]=_0x2873d5;return _0x5a8f29;})[_0x327e('0x29')](respondWithFilteredResult(_0x2718ac,_0x140e7a))[_0x327e('0x47')](handleError(_0x2718ac,null));};exports[_0x327e('0x48')]=function(_0x3da6f8,_0x53d623){var _0x3d7707={'raw':![],'where':{'id':_0x3da6f8['params']['id']}},_0xd04fb5={};_0xd04fb5['model']=_[_0x327e('0x34')](db['ZendeskConfiguration']['rawAttributes']);_0xd04fb5['query']=_[_0x327e('0x34')](_0x3da6f8[_0x327e('0x33')]);_0xd04fb5['filters']=_['intersection'](_0xd04fb5[_0x327e('0x37')],_0xd04fb5[_0x327e('0x33')]);_0x3d7707[_0x327e('0x38')]=_['intersection'](_0xd04fb5['model'],qs[_0x327e('0x39')](_0x3da6f8[_0x327e('0x33')][_0x327e('0x39')]));_0x3d7707[_0x327e('0x38')]=_0x3d7707[_0x327e('0x38')][_0x327e('0x3a')]?_0x3d7707[_0x327e('0x38')]:_0xd04fb5[_0x327e('0x37')];if(_0x3da6f8['query'][_0x327e('0x44')]){_0x3d7707[_0x327e('0x49')]=[{'all':!![]}];}_0x3d7707=_[_0x327e('0x40')]({},_0x3d7707,_0x3da6f8[_0x327e('0x43')]);return db['ZendeskConfiguration'][_0x327e('0x4a')](_0x3d7707)[_0x327e('0x29')](handleEntityNotFound(_0x53d623,null))[_0x327e('0x29')](respondWithResult(_0x53d623,null))[_0x327e('0x47')](handleError(_0x53d623,null));};exports[_0x327e('0x4b')]=function(_0xeaab4f,_0x33a006){return db['ZendeskConfiguration'][_0x327e('0x4b')](_0xeaab4f[_0x327e('0x4c')],{})[_0x327e('0x29')](respondWithResult(_0x33a006,0xc9))[_0x327e('0x47')](handleError(_0x33a006,null));};exports[_0x327e('0x28')]=function(_0x3a1b6b,_0x230652){if(_0x3a1b6b[_0x327e('0x4c')]['id']){delete _0x3a1b6b[_0x327e('0x4c')]['id'];}return db[_0x327e('0x2f')][_0x327e('0x4a')]({'where':{'id':_0x3a1b6b['params']['id']}})['then'](handleEntityNotFound(_0x230652,null))['then'](saveUpdates(_0x3a1b6b[_0x327e('0x4c')],null))[_0x327e('0x29')](respondWithResult(_0x230652,null))[_0x327e('0x47')](handleError(_0x230652,null));};exports[_0x327e('0x4d')]=function(_0xbff3c1,_0x1c7201){return db[_0x327e('0x2f')]['find']({'where':{'id':_0xbff3c1['params']['id']}})['then'](handleEntityNotFound(_0x1c7201,null))['then'](removeEntity(_0x1c7201,null))['catch'](handleError(_0x1c7201,null));};exports[_0x327e('0x4e')]=function(_0x2b9b4a,_0x4d9a1f,_0x38bfaf){var _0x4853c5={};var _0x28e3f0={};var _0x38ac8c;var _0xb1962c;return db['ZendeskConfiguration'][_0x327e('0x4f')]({'where':{'id':_0x2b9b4a[_0x327e('0x50')]['id']}})[_0x327e('0x29')](handleEntityNotFound(_0x4d9a1f,null))[_0x327e('0x29')](function(_0x23beb5){if(_0x23beb5){_0x38ac8c=_0x23beb5;_0x28e3f0[_0x327e('0x37')]=_[_0x327e('0x34')](db[_0x327e('0x51')]['rawAttributes']);_0x28e3f0['query']=_[_0x327e('0x34')](_0x2b9b4a[_0x327e('0x33')]);_0x28e3f0[_0x327e('0x35')]=_[_0x327e('0x36')](_0x28e3f0[_0x327e('0x37')],_0x28e3f0[_0x327e('0x33')]);_0x4853c5[_0x327e('0x38')]=_[_0x327e('0x36')](_0x28e3f0['model'],qs[_0x327e('0x39')](_0x2b9b4a[_0x327e('0x33')]['fields']));_0x4853c5[_0x327e('0x38')]=_0x4853c5[_0x327e('0x38')][_0x327e('0x3a')]?_0x4853c5[_0x327e('0x38')]:_0x28e3f0[_0x327e('0x37')];_0x4853c5['order']=qs[_0x327e('0x3e')](_0x2b9b4a['query'][_0x327e('0x3e')]);_0x4853c5[_0x327e('0x3f')]=qs[_0x327e('0x35')](_[_0x327e('0x52')](_0x2b9b4a[_0x327e('0x33')],_0x28e3f0[_0x327e('0x35')]));if(_0x2b9b4a[_0x327e('0x33')][_0x327e('0x42')]){_0x4853c5['where']=_[_0x327e('0x40')](_0x4853c5[_0x327e('0x3f')],{'$or':_[_0x327e('0x2e')](_0x4853c5[_0x327e('0x38')],function(_0x1c2863){var _0x5728c1={};_0x5728c1[_0x1c2863]={'$like':'%'+_0x2b9b4a[_0x327e('0x33')][_0x327e('0x42')]+'%'};return _0x5728c1;})});}_0x4853c5=_[_0x327e('0x40')]({},_0x4853c5,_0x2b9b4a[_0x327e('0x43')]);return _0x38ac8c[_0x327e('0x4e')](_0x4853c5);}})['then'](function(_0x4e25a2){if(_0x4e25a2){_0xb1962c=_0x4e25a2[_0x327e('0x3a')];if(!_0x2b9b4a['query'][_0x327e('0x3b')](_0x327e('0x3c'))){_0x4853c5['limit']=qs[_0x327e('0x20')](_0x2b9b4a[_0x327e('0x33')][_0x327e('0x20')]);_0x4853c5[_0x327e('0x22')]=qs[_0x327e('0x22')](_0x2b9b4a[_0x327e('0x33')]['offset']);}return _0x38ac8c[_0x327e('0x4e')](_0x4853c5);}})[_0x327e('0x29')](function(_0x434aa0){if(_0x434aa0){return _0x434aa0?{'count':_0xb1962c,'rows':_0x434aa0}:null;}})['then'](respondWithResult(_0x4d9a1f,null))[_0x327e('0x47')](handleError(_0x4d9a1f,null));};exports[_0x327e('0x53')]=function(_0x4984b0,_0x2830ec,_0x10fba7){var _0x5dd959={};var _0x14d49e={};var _0x328e9b;var _0x39dbd3;return db[_0x327e('0x2f')][_0x327e('0x4f')]({'where':{'id':_0x4984b0[_0x327e('0x50')]['id']}})[_0x327e('0x29')](handleEntityNotFound(_0x2830ec,null))[_0x327e('0x29')](function(_0x18d12d){if(_0x18d12d){_0x328e9b=_0x18d12d;_0x14d49e['model']=_[_0x327e('0x34')](db[_0x327e('0x51')][_0x327e('0x30')]);_0x14d49e[_0x327e('0x33')]=_['keys'](_0x4984b0[_0x327e('0x33')]);_0x14d49e[_0x327e('0x35')]=_[_0x327e('0x36')](_0x14d49e[_0x327e('0x37')],_0x14d49e[_0x327e('0x33')]);_0x5dd959[_0x327e('0x38')]=_[_0x327e('0x36')](_0x14d49e[_0x327e('0x37')],qs[_0x327e('0x39')](_0x4984b0[_0x327e('0x33')][_0x327e('0x39')]));_0x5dd959['attributes']=_0x5dd959[_0x327e('0x38')][_0x327e('0x3a')]?_0x5dd959[_0x327e('0x38')]:_0x14d49e[_0x327e('0x37')];_0x5dd959['order']=qs[_0x327e('0x3e')](_0x4984b0['query'][_0x327e('0x3e')]);_0x5dd959[_0x327e('0x3f')]=qs[_0x327e('0x35')](_[_0x327e('0x52')](_0x4984b0[_0x327e('0x33')],_0x14d49e[_0x327e('0x35')]));if(_0x4984b0[_0x327e('0x33')]['filter']){_0x5dd959[_0x327e('0x3f')]=_[_0x327e('0x40')](_0x5dd959[_0x327e('0x3f')],{'$or':_[_0x327e('0x2e')](_0x5dd959[_0x327e('0x38')],function(_0x42cba9){var _0x3065bb={};_0x3065bb[_0x42cba9]={'$like':'%'+_0x4984b0['query'][_0x327e('0x42')]+'%'};return _0x3065bb;})});}_0x5dd959=_[_0x327e('0x40')]({},_0x5dd959,_0x4984b0[_0x327e('0x43')]);return _0x328e9b['getSubjects'](_0x5dd959);}})[_0x327e('0x29')](function(_0x3e0808){if(_0x3e0808){_0x39dbd3=_0x3e0808[_0x327e('0x3a')];if(!_0x4984b0[_0x327e('0x33')][_0x327e('0x3b')](_0x327e('0x3c'))){_0x5dd959[_0x327e('0x20')]=qs[_0x327e('0x20')](_0x4984b0[_0x327e('0x33')]['limit']);_0x5dd959[_0x327e('0x22')]=qs[_0x327e('0x22')](_0x4984b0[_0x327e('0x33')][_0x327e('0x22')]);}return _0x328e9b[_0x327e('0x53')](_0x5dd959);}})['then'](function(_0x19adc7){if(_0x19adc7){return _0x19adc7?{'count':_0x39dbd3,'rows':_0x19adc7}:null;}})[_0x327e('0x29')](respondWithResult(_0x2830ec,null))[_0x327e('0x47')](handleError(_0x2830ec,null));};exports[_0x327e('0x54')]=function(_0x576ee3,_0x5a0cc3,_0x322cb8){var _0x171f84={};var _0x3a7d30={};var _0x492382;var _0x482c84;return db[_0x327e('0x2f')][_0x327e('0x4f')]({'where':{'id':_0x576ee3[_0x327e('0x50')]['id']}})[_0x327e('0x29')](handleEntityNotFound(_0x5a0cc3,null))[_0x327e('0x29')](function(_0x2c59f9){if(_0x2c59f9){_0x492382=_0x2c59f9;_0x3a7d30['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x3a7d30['query']=_['keys'](_0x576ee3[_0x327e('0x33')]);_0x3a7d30[_0x327e('0x35')]=_[_0x327e('0x36')](_0x3a7d30[_0x327e('0x37')],_0x3a7d30[_0x327e('0x33')]);_0x171f84[_0x327e('0x38')]=_['intersection'](_0x3a7d30[_0x327e('0x37')],qs[_0x327e('0x39')](_0x576ee3[_0x327e('0x33')]['fields']));_0x171f84[_0x327e('0x38')]=_0x171f84[_0x327e('0x38')][_0x327e('0x3a')]?_0x171f84['attributes']:_0x3a7d30['model'];_0x171f84[_0x327e('0x3d')]=qs[_0x327e('0x3e')](_0x576ee3[_0x327e('0x33')][_0x327e('0x3e')]);_0x171f84[_0x327e('0x3f')]=qs[_0x327e('0x35')](_[_0x327e('0x52')](_0x576ee3[_0x327e('0x33')],_0x3a7d30['filters']));if(_0x576ee3[_0x327e('0x33')][_0x327e('0x42')]){_0x171f84[_0x327e('0x3f')]=_[_0x327e('0x40')](_0x171f84['where'],{'$or':_[_0x327e('0x2e')](_0x171f84[_0x327e('0x38')],function(_0x1003be){var _0x26281e={};_0x26281e[_0x1003be]={'$like':'%'+_0x576ee3[_0x327e('0x33')]['filter']+'%'};return _0x26281e;})});}_0x171f84=_['merge']({},_0x171f84,_0x576ee3['options']);return _0x492382['getDescriptions'](_0x171f84);}})[_0x327e('0x29')](function(_0x5a6978){if(_0x5a6978){_0x482c84=_0x5a6978[_0x327e('0x3a')];if(!_0x576ee3['query']['hasOwnProperty'](_0x327e('0x3c'))){_0x171f84[_0x327e('0x20')]=qs[_0x327e('0x20')](_0x576ee3[_0x327e('0x33')][_0x327e('0x20')]);_0x171f84[_0x327e('0x22')]=qs[_0x327e('0x22')](_0x576ee3['query'][_0x327e('0x22')]);}return _0x492382[_0x327e('0x54')](_0x171f84);}})[_0x327e('0x29')](function(_0x4ebdf3){if(_0x4ebdf3){return _0x4ebdf3?{'count':_0x482c84,'rows':_0x4ebdf3}:null;}})['then'](respondWithResult(_0x5a0cc3,null))[_0x327e('0x47')](handleError(_0x5a0cc3,null));};exports[_0x327e('0x55')]=function(_0x5cc63d,_0x5d994d,_0x50711f){var _0xbbc773={};var _0x2c316e={};var _0x4c7c69;var _0xd933cf;return db[_0x327e('0x2f')][_0x327e('0x4f')]({'where':{'id':_0x5cc63d[_0x327e('0x50')]['id']}})[_0x327e('0x29')](handleEntityNotFound(_0x5d994d,null))[_0x327e('0x29')](function(_0x2d6399){if(_0x2d6399){_0x4c7c69=_0x2d6399;_0x2c316e[_0x327e('0x37')]=_['keys'](db[_0x327e('0x56')][_0x327e('0x30')]);_0x2c316e[_0x327e('0x33')]=_[_0x327e('0x34')](_0x5cc63d[_0x327e('0x33')]);_0x2c316e[_0x327e('0x35')]=_[_0x327e('0x36')](_0x2c316e[_0x327e('0x37')],_0x2c316e['query']);_0xbbc773[_0x327e('0x38')]=_[_0x327e('0x36')](_0x2c316e[_0x327e('0x37')],qs['fields'](_0x5cc63d['query']['fields']));_0xbbc773[_0x327e('0x38')]=_0xbbc773[_0x327e('0x38')]['length']?_0xbbc773[_0x327e('0x38')]:_0x2c316e[_0x327e('0x37')];_0xbbc773[_0x327e('0x3d')]=qs['sort'](_0x5cc63d[_0x327e('0x33')][_0x327e('0x3e')]);_0xbbc773[_0x327e('0x3f')]=qs[_0x327e('0x35')](_[_0x327e('0x52')](_0x5cc63d[_0x327e('0x33')],_0x2c316e[_0x327e('0x35')]));if(_0x5cc63d[_0x327e('0x33')][_0x327e('0x42')]){_0xbbc773[_0x327e('0x3f')]=_[_0x327e('0x40')](_0xbbc773[_0x327e('0x3f')],{'$or':_[_0x327e('0x2e')](_0xbbc773[_0x327e('0x38')],function(_0x4e56ac){var _0x15854e={};_0x15854e[_0x4e56ac]={'$like':'%'+_0x5cc63d[_0x327e('0x33')]['filter']+'%'};return _0x15854e;})});}_0xbbc773=_[_0x327e('0x40')]({},_0xbbc773,_0x5cc63d[_0x327e('0x43')]);return _0x4c7c69[_0x327e('0x55')](_0xbbc773);}})[_0x327e('0x29')](function(_0x2bbefb){if(_0x2bbefb){_0xd933cf=_0x2bbefb['length'];if(!_0x5cc63d[_0x327e('0x33')][_0x327e('0x3b')](_0x327e('0x3c'))){_0xbbc773[_0x327e('0x20')]=qs['limit'](_0x5cc63d[_0x327e('0x33')][_0x327e('0x20')]);_0xbbc773['offset']=qs['offset'](_0x5cc63d[_0x327e('0x33')]['offset']);}return _0x4c7c69['getTags'](_0xbbc773);}})['then'](function(_0x14ec9b){if(_0x14ec9b){return _0x14ec9b?{'count':_0xd933cf,'rows':_0x14ec9b}:null;}})[_0x327e('0x29')](respondWithResult(_0x5d994d,null))[_0x327e('0x47')](handleError(_0x5d994d,null));};exports[_0x327e('0x57')]=function(_0x574173,_0x110bba,_0x300021){if(_0x574173['body']['id']){delete _0x574173[_0x327e('0x4c')]['id'];}return db[_0x327e('0x2f')][_0x327e('0x4f')]({'where':{'id':_0x574173[_0x327e('0x50')]['id']}})[_0x327e('0x29')](handleEntityNotFound(_0x110bba,null))[_0x327e('0x29')](function(_0x1551f0){if(_0x1551f0){return _0x1551f0[_0x327e('0x57')](_0x574173[_0x327e('0x4c')][_0x327e('0x58')]||[]);}return null;})[_0x327e('0x29')](respondWithResult(_0x110bba,null))['catch'](handleError(_0x110bba,null));}; \ No newline at end of file +var _0x1222=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','end','name','map','ZendeskConfiguration','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','ZendeskField','pick','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','moment','bluebird','util'];(function(_0x36f6e4,_0x4b0186){var _0x13f9b8=function(_0x85eb52){while(--_0x85eb52){_0x36f6e4['push'](_0x36f6e4['shift']());}};_0x13f9b8(++_0x4b0186);}(_0x1222,0x1d4));var _0x2122=function(_0x50924e,_0x275475){_0x50924e=_0x50924e-0x0;var _0x331605=_0x1222[_0x50924e];return _0x331605;};'use strict';var emlformat=require(_0x2122('0x0'));var rimraf=require(_0x2122('0x1'));var zipdir=require(_0x2122('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2122('0x3'));var BPromise=require(_0x2122('0x4'));var Mustache=require('mustache');var util=require(_0x2122('0x5'));var path=require(_0x2122('0x6'));var sox=require(_0x2122('0x7'));var csv=require(_0x2122('0x8'));var ejs=require(_0x2122('0x9'));var fs=require('fs');var fs_extra=require(_0x2122('0xa'));var _=require(_0x2122('0xb'));var squel=require('squel');var crypto=require(_0x2122('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2122('0x8'));var querystring=require('querystring');var Papa=require(_0x2122('0xd'));var Redis=require(_0x2122('0xe'));var authService=require(_0x2122('0xf'));var qs=require(_0x2122('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2122('0x11'));var logger=require(_0x2122('0x12'))(_0x2122('0x13'));var utils=require(_0x2122('0x14'));var config=require(_0x2122('0x15'));var licenseUtil=require(_0x2122('0x16'));var db=require(_0x2122('0x17'))['db'];function respondWithStatusCode(_0x377392,_0xb07e5b){_0xb07e5b=_0xb07e5b||0xcc;return function(_0x2cdef5){if(_0x2cdef5){return _0x377392[_0x2122('0x18')](_0xb07e5b);}return _0x377392['status'](_0xb07e5b)['end']();};}function respondWithResult(_0x4c2318,_0x4febda){_0x4febda=_0x4febda||0xc8;return function(_0x5a618f){if(_0x5a618f){return _0x4c2318['status'](_0x4febda)[_0x2122('0x19')](_0x5a618f);}};}function respondWithFilteredResult(_0x124aab,_0x2fba43){return function(_0x463dbc){if(_0x463dbc){var _0xa81da8=typeof _0x2fba43[_0x2122('0x1a')]===_0x2122('0x1b')&&typeof _0x2fba43[_0x2122('0x1c')]===_0x2122('0x1b');var _0xa5535a=_0x463dbc[_0x2122('0x1d')];var _0xfe037b=_0xa81da8?0x0:_0x2fba43['offset'];var _0x3c4c75=_0xa81da8?_0x463dbc['count']:_0x2fba43[_0x2122('0x1a')]+_0x2fba43[_0x2122('0x1c')];var _0x22605c;if(_0x3c4c75>=_0xa5535a){_0x3c4c75=_0xa5535a;_0x22605c=0xc8;}else{_0x22605c=0xce;}_0x124aab[_0x2122('0x1e')](_0x22605c);return _0x124aab[_0x2122('0x1f')]('Content-Range',_0xfe037b+'-'+_0x3c4c75+'/'+_0xa5535a)['json'](_0x463dbc);}return null;};}function patchUpdates(_0x5ea81d){return function(_0x44d291){try{jsonpatch[_0x2122('0x20')](_0x44d291,_0x5ea81d,!![]);}catch(_0x374e1f){return BPromise['reject'](_0x374e1f);}return _0x44d291[_0x2122('0x21')]();};}function saveUpdates(_0x48e90f,_0x5a28e1){return function(_0xf86f28){if(_0xf86f28){return _0xf86f28[_0x2122('0x22')](_0x48e90f)[_0x2122('0x23')](function(_0x4d6ea0){return _0x4d6ea0;});}return null;};}function removeEntity(_0x383c69,_0x5a9cda){return function(_0x5b4b49){if(_0x5b4b49){return _0x5b4b49[_0x2122('0x24')]()[_0x2122('0x23')](function(){_0x383c69[_0x2122('0x1e')](0xcc)[_0x2122('0x25')]();});}};}function handleEntityNotFound(_0x266154,_0x5b461e){return function(_0x38223d){if(!_0x38223d){_0x266154['sendStatus'](0x194);}return _0x38223d;};}function handleError(_0x57e1ae,_0x5a066b){_0x5a066b=_0x5a066b||0x1f4;return function(_0x5697ab){logger['error'](_0x5697ab['stack']);if(_0x5697ab[_0x2122('0x26')]){delete _0x5697ab[_0x2122('0x26')];}_0x57e1ae[_0x2122('0x1e')](_0x5a066b)['send'](_0x5697ab);};}exports['index']=function(_0x3b6e80,_0xccc72a){var _0x516baf={},_0x9bc013={},_0x3e0572={'count':0x0,'rows':[]};var _0x31e36a=_[_0x2122('0x27')](db[_0x2122('0x28')]['rawAttributes'],function(_0x3d706d){return{'name':_0x3d706d[_0x2122('0x29')],'type':_0x3d706d[_0x2122('0x2a')][_0x2122('0x2b')]};});_0x9bc013[_0x2122('0x2c')]=_['map'](_0x31e36a,_0x2122('0x26'));_0x9bc013['query']=_[_0x2122('0x2d')](_0x3b6e80[_0x2122('0x2e')]);_0x9bc013['filters']=_[_0x2122('0x2f')](_0x9bc013[_0x2122('0x2c')],_0x9bc013[_0x2122('0x2e')]);_0x516baf[_0x2122('0x30')]=_['intersection'](_0x9bc013[_0x2122('0x2c')],qs[_0x2122('0x31')](_0x3b6e80[_0x2122('0x2e')][_0x2122('0x31')]));_0x516baf[_0x2122('0x30')]=_0x516baf[_0x2122('0x30')][_0x2122('0x32')]?_0x516baf[_0x2122('0x30')]:_0x9bc013[_0x2122('0x2c')];if(!_0x3b6e80[_0x2122('0x2e')][_0x2122('0x33')](_0x2122('0x34'))){_0x516baf[_0x2122('0x1c')]=qs[_0x2122('0x1c')](_0x3b6e80[_0x2122('0x2e')]['limit']);_0x516baf['offset']=qs[_0x2122('0x1a')](_0x3b6e80[_0x2122('0x2e')][_0x2122('0x1a')]);}_0x516baf[_0x2122('0x35')]=qs[_0x2122('0x36')](_0x3b6e80['query'][_0x2122('0x36')]);_0x516baf['where']=qs[_0x2122('0x37')](_['pick'](_0x3b6e80['query'],_0x9bc013[_0x2122('0x37')]),_0x31e36a);if(_0x3b6e80[_0x2122('0x2e')][_0x2122('0x38')]){_0x516baf['where']=_['merge'](_0x516baf[_0x2122('0x39')],{'$or':_[_0x2122('0x27')](_0x31e36a,function(_0x1d48f7){if(_0x1d48f7['type']!==_0x2122('0x3a')){var _0x33099a={};_0x33099a[_0x1d48f7['name']]={'$like':'%'+_0x3b6e80[_0x2122('0x2e')][_0x2122('0x38')]+'%'};return _0x33099a;}})});}_0x516baf=_[_0x2122('0x3b')]({},_0x516baf,_0x3b6e80[_0x2122('0x3c')]);var _0x12a287={'where':_0x516baf[_0x2122('0x39')]};return db[_0x2122('0x28')][_0x2122('0x1d')](_0x12a287)[_0x2122('0x23')](function(_0x4d523d){_0x3e0572[_0x2122('0x1d')]=_0x4d523d;if(_0x3b6e80[_0x2122('0x2e')]['includeAll']){_0x516baf['include']=[{'all':!![]}];}return db[_0x2122('0x28')][_0x2122('0x3d')](_0x516baf);})[_0x2122('0x23')](function(_0x18f004){_0x3e0572[_0x2122('0x3e')]=_0x18f004;return _0x3e0572;})['then'](respondWithFilteredResult(_0xccc72a,_0x516baf))[_0x2122('0x3f')](handleError(_0xccc72a,null));};exports['show']=function(_0x388354,_0x340129){var _0x40d472={'raw':![],'where':{'id':_0x388354[_0x2122('0x40')]['id']}},_0x950023={};_0x950023[_0x2122('0x2c')]=_[_0x2122('0x2d')](db[_0x2122('0x28')][_0x2122('0x41')]);_0x950023['query']=_['keys'](_0x388354[_0x2122('0x2e')]);_0x950023[_0x2122('0x37')]=_[_0x2122('0x2f')](_0x950023[_0x2122('0x2c')],_0x950023['query']);_0x40d472[_0x2122('0x30')]=_[_0x2122('0x2f')](_0x950023['model'],qs['fields'](_0x388354['query'][_0x2122('0x31')]));_0x40d472[_0x2122('0x30')]=_0x40d472[_0x2122('0x30')][_0x2122('0x32')]?_0x40d472[_0x2122('0x30')]:_0x950023[_0x2122('0x2c')];if(_0x388354[_0x2122('0x2e')][_0x2122('0x42')]){_0x40d472['include']=[{'all':!![]}];}_0x40d472=_[_0x2122('0x3b')]({},_0x40d472,_0x388354[_0x2122('0x3c')]);return db[_0x2122('0x28')][_0x2122('0x43')](_0x40d472)[_0x2122('0x23')](handleEntityNotFound(_0x340129,null))[_0x2122('0x23')](respondWithResult(_0x340129,null))['catch'](handleError(_0x340129,null));};exports[_0x2122('0x44')]=function(_0x4c1592,_0x14aaaf){return db[_0x2122('0x28')][_0x2122('0x44')](_0x4c1592[_0x2122('0x45')],{})[_0x2122('0x23')](respondWithResult(_0x14aaaf,0xc9))[_0x2122('0x3f')](handleError(_0x14aaaf,null));};exports[_0x2122('0x22')]=function(_0x6b38a6,_0x1382e6){if(_0x6b38a6[_0x2122('0x45')]['id']){delete _0x6b38a6['body']['id'];}return db[_0x2122('0x28')][_0x2122('0x43')]({'where':{'id':_0x6b38a6[_0x2122('0x40')]['id']}})[_0x2122('0x23')](handleEntityNotFound(_0x1382e6,null))[_0x2122('0x23')](saveUpdates(_0x6b38a6[_0x2122('0x45')],null))[_0x2122('0x23')](respondWithResult(_0x1382e6,null))['catch'](handleError(_0x1382e6,null));};exports[_0x2122('0x24')]=function(_0x181223,_0x314236){return db[_0x2122('0x28')][_0x2122('0x43')]({'where':{'id':_0x181223[_0x2122('0x40')]['id']}})[_0x2122('0x23')](handleEntityNotFound(_0x314236,null))[_0x2122('0x23')](removeEntity(_0x314236,null))[_0x2122('0x3f')](handleError(_0x314236,null));};exports['getFields']=function(_0x4267f8,_0x36d94e,_0x1981a7){var _0x3db544={};var _0x26f92a={};var _0x466859;var _0x4fa448;return db[_0x2122('0x28')]['findOne']({'where':{'id':_0x4267f8[_0x2122('0x40')]['id']}})[_0x2122('0x23')](handleEntityNotFound(_0x36d94e,null))[_0x2122('0x23')](function(_0x38e839){if(_0x38e839){_0x466859=_0x38e839;_0x26f92a['model']=_[_0x2122('0x2d')](db[_0x2122('0x46')][_0x2122('0x41')]);_0x26f92a[_0x2122('0x2e')]=_[_0x2122('0x2d')](_0x4267f8['query']);_0x26f92a[_0x2122('0x37')]=_[_0x2122('0x2f')](_0x26f92a[_0x2122('0x2c')],_0x26f92a[_0x2122('0x2e')]);_0x3db544[_0x2122('0x30')]=_[_0x2122('0x2f')](_0x26f92a[_0x2122('0x2c')],qs[_0x2122('0x31')](_0x4267f8['query'][_0x2122('0x31')]));_0x3db544[_0x2122('0x30')]=_0x3db544[_0x2122('0x30')]['length']?_0x3db544['attributes']:_0x26f92a[_0x2122('0x2c')];_0x3db544[_0x2122('0x35')]=qs['sort'](_0x4267f8['query'][_0x2122('0x36')]);_0x3db544[_0x2122('0x39')]=qs[_0x2122('0x37')](_[_0x2122('0x47')](_0x4267f8['query'],_0x26f92a['filters']));if(_0x4267f8[_0x2122('0x2e')][_0x2122('0x38')]){_0x3db544[_0x2122('0x39')]=_[_0x2122('0x3b')](_0x3db544['where'],{'$or':_[_0x2122('0x27')](_0x3db544[_0x2122('0x30')],function(_0x3c8622){var _0x4ecb41={};_0x4ecb41[_0x3c8622]={'$like':'%'+_0x4267f8['query'][_0x2122('0x38')]+'%'};return _0x4ecb41;})});}_0x3db544=_[_0x2122('0x3b')]({},_0x3db544,_0x4267f8[_0x2122('0x3c')]);return _0x466859['getFields'](_0x3db544);}})['then'](function(_0x5751c2){if(_0x5751c2){_0x4fa448=_0x5751c2[_0x2122('0x32')];if(!_0x4267f8[_0x2122('0x2e')]['hasOwnProperty'](_0x2122('0x34'))){_0x3db544[_0x2122('0x1c')]=qs[_0x2122('0x1c')](_0x4267f8['query'][_0x2122('0x1c')]);_0x3db544[_0x2122('0x1a')]=qs['offset'](_0x4267f8[_0x2122('0x2e')][_0x2122('0x1a')]);}return _0x466859['getFields'](_0x3db544);}})[_0x2122('0x23')](function(_0x1640a9){if(_0x1640a9){return _0x1640a9?{'count':_0x4fa448,'rows':_0x1640a9}:null;}})['then'](respondWithResult(_0x36d94e,null))[_0x2122('0x3f')](handleError(_0x36d94e,null));};exports[_0x2122('0x48')]=function(_0x2df02b,_0x17ffc4,_0x3d2de7){var _0x3d46af={};var _0x4c22a7={};var _0x29ac25;var _0x24497e;return db[_0x2122('0x28')]['findOne']({'where':{'id':_0x2df02b[_0x2122('0x40')]['id']}})['then'](handleEntityNotFound(_0x17ffc4,null))['then'](function(_0x4ca88a){if(_0x4ca88a){_0x29ac25=_0x4ca88a;_0x4c22a7['model']=_['keys'](db['ZendeskField'][_0x2122('0x41')]);_0x4c22a7[_0x2122('0x2e')]=_[_0x2122('0x2d')](_0x2df02b[_0x2122('0x2e')]);_0x4c22a7[_0x2122('0x37')]=_[_0x2122('0x2f')](_0x4c22a7['model'],_0x4c22a7[_0x2122('0x2e')]);_0x3d46af['attributes']=_[_0x2122('0x2f')](_0x4c22a7[_0x2122('0x2c')],qs['fields'](_0x2df02b[_0x2122('0x2e')][_0x2122('0x31')]));_0x3d46af[_0x2122('0x30')]=_0x3d46af['attributes']['length']?_0x3d46af[_0x2122('0x30')]:_0x4c22a7['model'];_0x3d46af[_0x2122('0x35')]=qs[_0x2122('0x36')](_0x2df02b[_0x2122('0x2e')][_0x2122('0x36')]);_0x3d46af[_0x2122('0x39')]=qs['filters'](_[_0x2122('0x47')](_0x2df02b[_0x2122('0x2e')],_0x4c22a7[_0x2122('0x37')]));if(_0x2df02b[_0x2122('0x2e')][_0x2122('0x38')]){_0x3d46af[_0x2122('0x39')]=_[_0x2122('0x3b')](_0x3d46af[_0x2122('0x39')],{'$or':_[_0x2122('0x27')](_0x3d46af['attributes'],function(_0x39eb5f){var _0x14751b={};_0x14751b[_0x39eb5f]={'$like':'%'+_0x2df02b['query'][_0x2122('0x38')]+'%'};return _0x14751b;})});}_0x3d46af=_[_0x2122('0x3b')]({},_0x3d46af,_0x2df02b['options']);return _0x29ac25[_0x2122('0x48')](_0x3d46af);}})[_0x2122('0x23')](function(_0x2886cf){if(_0x2886cf){_0x24497e=_0x2886cf['length'];if(!_0x2df02b[_0x2122('0x2e')][_0x2122('0x33')](_0x2122('0x34'))){_0x3d46af[_0x2122('0x1c')]=qs[_0x2122('0x1c')](_0x2df02b['query'][_0x2122('0x1c')]);_0x3d46af[_0x2122('0x1a')]=qs[_0x2122('0x1a')](_0x2df02b[_0x2122('0x2e')]['offset']);}return _0x29ac25[_0x2122('0x48')](_0x3d46af);}})[_0x2122('0x23')](function(_0x2a096c){if(_0x2a096c){return _0x2a096c?{'count':_0x24497e,'rows':_0x2a096c}:null;}})['then'](respondWithResult(_0x17ffc4,null))[_0x2122('0x3f')](handleError(_0x17ffc4,null));};exports[_0x2122('0x49')]=function(_0x1291c5,_0x2c64c9,_0x1f4945){var _0x3fdc56={};var _0x4fea30={};var _0x228840;var _0x56f43d;return db[_0x2122('0x28')][_0x2122('0x4a')]({'where':{'id':_0x1291c5['params']['id']}})[_0x2122('0x23')](handleEntityNotFound(_0x2c64c9,null))[_0x2122('0x23')](function(_0x574622){if(_0x574622){_0x228840=_0x574622;_0x4fea30[_0x2122('0x2c')]=_['keys'](db[_0x2122('0x46')]['rawAttributes']);_0x4fea30[_0x2122('0x2e')]=_[_0x2122('0x2d')](_0x1291c5[_0x2122('0x2e')]);_0x4fea30[_0x2122('0x37')]=_[_0x2122('0x2f')](_0x4fea30['model'],_0x4fea30['query']);_0x3fdc56[_0x2122('0x30')]=_[_0x2122('0x2f')](_0x4fea30[_0x2122('0x2c')],qs[_0x2122('0x31')](_0x1291c5['query'][_0x2122('0x31')]));_0x3fdc56['attributes']=_0x3fdc56[_0x2122('0x30')][_0x2122('0x32')]?_0x3fdc56[_0x2122('0x30')]:_0x4fea30[_0x2122('0x2c')];_0x3fdc56[_0x2122('0x35')]=qs[_0x2122('0x36')](_0x1291c5[_0x2122('0x2e')][_0x2122('0x36')]);_0x3fdc56['where']=qs[_0x2122('0x37')](_[_0x2122('0x47')](_0x1291c5[_0x2122('0x2e')],_0x4fea30['filters']));if(_0x1291c5[_0x2122('0x2e')][_0x2122('0x38')]){_0x3fdc56[_0x2122('0x39')]=_[_0x2122('0x3b')](_0x3fdc56['where'],{'$or':_[_0x2122('0x27')](_0x3fdc56[_0x2122('0x30')],function(_0x401e09){var _0x831318={};_0x831318[_0x401e09]={'$like':'%'+_0x1291c5[_0x2122('0x2e')][_0x2122('0x38')]+'%'};return _0x831318;})});}_0x3fdc56=_[_0x2122('0x3b')]({},_0x3fdc56,_0x1291c5[_0x2122('0x3c')]);return _0x228840['getDescriptions'](_0x3fdc56);}})[_0x2122('0x23')](function(_0x32fc2c){if(_0x32fc2c){_0x56f43d=_0x32fc2c[_0x2122('0x32')];if(!_0x1291c5[_0x2122('0x2e')]['hasOwnProperty']('nolimit')){_0x3fdc56[_0x2122('0x1c')]=qs[_0x2122('0x1c')](_0x1291c5[_0x2122('0x2e')][_0x2122('0x1c')]);_0x3fdc56[_0x2122('0x1a')]=qs[_0x2122('0x1a')](_0x1291c5[_0x2122('0x2e')][_0x2122('0x1a')]);}return _0x228840[_0x2122('0x49')](_0x3fdc56);}})[_0x2122('0x23')](function(_0x44a50b){if(_0x44a50b){return _0x44a50b?{'count':_0x56f43d,'rows':_0x44a50b}:null;}})[_0x2122('0x23')](respondWithResult(_0x2c64c9,null))['catch'](handleError(_0x2c64c9,null));};exports[_0x2122('0x4b')]=function(_0x2b768c,_0x4865bc,_0x37aad1){var _0x342d67={};var _0xed23c4={};var _0x254c90;var _0x305590;return db[_0x2122('0x28')]['findOne']({'where':{'id':_0x2b768c['params']['id']}})[_0x2122('0x23')](handleEntityNotFound(_0x4865bc,null))[_0x2122('0x23')](function(_0x141df7){if(_0x141df7){_0x254c90=_0x141df7;_0xed23c4[_0x2122('0x2c')]=_['keys'](db[_0x2122('0x4c')][_0x2122('0x41')]);_0xed23c4[_0x2122('0x2e')]=_[_0x2122('0x2d')](_0x2b768c[_0x2122('0x2e')]);_0xed23c4[_0x2122('0x37')]=_[_0x2122('0x2f')](_0xed23c4[_0x2122('0x2c')],_0xed23c4['query']);_0x342d67[_0x2122('0x30')]=_['intersection'](_0xed23c4[_0x2122('0x2c')],qs[_0x2122('0x31')](_0x2b768c['query'][_0x2122('0x31')]));_0x342d67[_0x2122('0x30')]=_0x342d67[_0x2122('0x30')]['length']?_0x342d67['attributes']:_0xed23c4[_0x2122('0x2c')];_0x342d67[_0x2122('0x35')]=qs[_0x2122('0x36')](_0x2b768c[_0x2122('0x2e')][_0x2122('0x36')]);_0x342d67[_0x2122('0x39')]=qs[_0x2122('0x37')](_[_0x2122('0x47')](_0x2b768c[_0x2122('0x2e')],_0xed23c4[_0x2122('0x37')]));if(_0x2b768c['query'][_0x2122('0x38')]){_0x342d67[_0x2122('0x39')]=_[_0x2122('0x3b')](_0x342d67[_0x2122('0x39')],{'$or':_[_0x2122('0x27')](_0x342d67[_0x2122('0x30')],function(_0x1e2109){var _0x2e4bc6={};_0x2e4bc6[_0x1e2109]={'$like':'%'+_0x2b768c[_0x2122('0x2e')]['filter']+'%'};return _0x2e4bc6;})});}_0x342d67=_[_0x2122('0x3b')]({},_0x342d67,_0x2b768c[_0x2122('0x3c')]);return _0x254c90[_0x2122('0x4b')](_0x342d67);}})[_0x2122('0x23')](function(_0x1ba5f2){if(_0x1ba5f2){_0x305590=_0x1ba5f2[_0x2122('0x32')];if(!_0x2b768c[_0x2122('0x2e')][_0x2122('0x33')]('nolimit')){_0x342d67[_0x2122('0x1c')]=qs[_0x2122('0x1c')](_0x2b768c[_0x2122('0x2e')][_0x2122('0x1c')]);_0x342d67[_0x2122('0x1a')]=qs[_0x2122('0x1a')](_0x2b768c[_0x2122('0x2e')][_0x2122('0x1a')]);}return _0x254c90[_0x2122('0x4b')](_0x342d67);}})['then'](function(_0x24d572){if(_0x24d572){return _0x24d572?{'count':_0x305590,'rows':_0x24d572}:null;}})[_0x2122('0x23')](respondWithResult(_0x4865bc,null))['catch'](handleError(_0x4865bc,null));};exports[_0x2122('0x4d')]=function(_0x4e2b3e,_0x44dbd5,_0x2d4eb1){if(_0x4e2b3e['body']['id']){delete _0x4e2b3e[_0x2122('0x45')]['id'];}return db[_0x2122('0x28')][_0x2122('0x4a')]({'where':{'id':_0x4e2b3e[_0x2122('0x40')]['id']}})['then'](handleEntityNotFound(_0x44dbd5,null))[_0x2122('0x23')](function(_0x437409){if(_0x437409){return _0x437409[_0x2122('0x4d')](_0x4e2b3e[_0x2122('0x45')][_0x2122('0x4e')]||[]);}return null;})[_0x2122('0x23')](respondWithResult(_0x44dbd5,null))['catch'](handleError(_0x44dbd5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 748dde8..ddf82dd 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 _0xfcbb=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x532e26,_0x46f622){var _0x51059f=function(_0x1de788){while(--_0x1de788){_0x532e26['push'](_0x532e26['shift']());}};_0x51059f(++_0x46f622);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x588f0b,_0x1919de){_0x588f0b=_0x588f0b-0x0;var _0x1cb37a=_0xfcbb[_0x588f0b];return _0x1cb37a;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x18f82b,_0x3ea7a0){var _0x5d8128=function(_0x16a009){while(--_0x16a009){_0x18f82b['push'](_0x18f82b['shift']());}};_0x5d8128(++_0x3ea7a0);}(_0x5423,0xe3));var _0x3542=function(_0x12f861,_0x5b518f){_0x12f861=_0x12f861-0x0;var _0x4960d4=_0x5423[_0x12f861];return _0x4960d4;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 9d8d43f..2d1b7d0 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 _0x9429=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x7fbee,_0x31f6d6){var _0x4fe1b5=function(_0xb868f4){while(--_0xb868f4){_0x7fbee['push'](_0x7fbee['shift']());}};_0x4fe1b5(++_0x31f6d6);}(_0x9429,0x1a1));var _0x9942=function(_0x2defec,_0x319c11){_0x2defec=_0x2defec-0x0;var _0x153c1d=_0x9429[_0x2defec];return _0x153c1d;};'use strict';var _=require('lodash');var util=require(_0x9942('0x0'));var moment=require(_0x9942('0x1'));var BPromise=require(_0x9942('0x2'));var rs=require(_0x9942('0x3'));var fs=require('fs');var Redis=require(_0x9942('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9942('0x5'))(_0x9942('0x6'));var config=require(_0x9942('0x7'));var jayson=require(_0x9942('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5082b9,_0x4a1cbc,_0x4d65af){return new BPromise(function(_0x675e3c,_0x45b61d){return client['request'](_0x5082b9,_0x4d65af)[_0x9942('0x9')](function(_0x39f83e){logger[_0x9942('0xa')](_0x9942('0xb'),_0x4a1cbc,_0x9942('0xc'));logger['debug'](_0x9942('0xd'),_0x4a1cbc,_0x9942('0xc'),JSON[_0x9942('0xe')](_0x39f83e));if(_0x39f83e[_0x9942('0xf')]){if(_0x39f83e[_0x9942('0xf')][_0x9942('0x10')]===0x1f4){logger[_0x9942('0xf')](_0x9942('0xb'),_0x4a1cbc,_0x39f83e['error'][_0x9942('0x11')]);return _0x45b61d(_0x39f83e[_0x9942('0xf')][_0x9942('0x11')]);}logger['error'](_0x9942('0xb'),_0x4a1cbc,_0x39f83e['error'][_0x9942('0x11')]);return _0x675e3c(_0x39f83e['error']['message']);}else{logger['info'](_0x9942('0xb'),_0x4a1cbc,'request\x20sent');_0x675e3c(_0x39f83e[_0x9942('0x12')][_0x9942('0x11')]);}})[_0x9942('0x13')](function(_0x559888){logger[_0x9942('0xf')](_0x9942('0xb'),_0x4a1cbc,_0x559888);_0x45b61d(_0x559888);});});} \ No newline at end of file +var _0xd781=['../../config/utils','../../config/logger','rpc','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x131d15,_0x4b592a){var _0x34e888=function(_0x3de207){while(--_0x3de207){_0x131d15['push'](_0x131d15['shift']());}};_0x34e888(++_0x4b592a);}(_0xd781,0x16f));var _0x1d78=function(_0x21fc4f,_0x1dda3b){_0x21fc4f=_0x21fc4f-0x0;var _0x98abf1=_0xd781[_0x21fc4f];return _0x98abf1;};'use strict';var _=require(_0x1d78('0x0'));var util=require(_0x1d78('0x1'));var moment=require(_0x1d78('0x2'));var BPromise=require(_0x1d78('0x3'));var rs=require(_0x1d78('0x4'));var fs=require('fs');var Redis=require(_0x1d78('0x5'));var db=require(_0x1d78('0x6'))['db'];var utils=require(_0x1d78('0x7'));var logger=require(_0x1d78('0x8'))(_0x1d78('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1d78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244f6d,_0x554106,_0x2a6b0c){return new BPromise(function(_0x2ff63c,_0x6fa497){return client[_0x1d78('0xb')](_0x244f6d,_0x2a6b0c)[_0x1d78('0xc')](function(_0x210392){logger[_0x1d78('0xd')](_0x1d78('0xe'),_0x554106,_0x1d78('0xf'));logger[_0x1d78('0x10')](_0x1d78('0x11'),_0x554106,_0x1d78('0xf'),JSON['stringify'](_0x210392));if(_0x210392[_0x1d78('0x12')]){if(_0x210392[_0x1d78('0x12')][_0x1d78('0x13')]===0x1f4){logger[_0x1d78('0x12')](_0x1d78('0xe'),_0x554106,_0x210392[_0x1d78('0x12')][_0x1d78('0x14')]);return _0x6fa497(_0x210392[_0x1d78('0x12')]['message']);}logger[_0x1d78('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x554106,_0x210392['error'][_0x1d78('0x14')]);return _0x2ff63c(_0x210392[_0x1d78('0x12')][_0x1d78('0x14')]);}else{logger[_0x1d78('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x554106,_0x1d78('0xf'));_0x2ff63c(_0x210392[_0x1d78('0x15')][_0x1d78('0x14')]);}})['catch'](function(_0x3d0181){logger[_0x1d78('0x12')](_0x1d78('0xe'),_0x554106,_0x3d0181);_0x6fa497(_0x3d0181);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index ce323e1..bfca126 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 _0x2e52=['fs-extra','../../components/interaction/service','./intZendeskField.controller','index','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','util','express','Router'];(function(_0x337a13,_0x39554e){var _0x21fbd8=function(_0x30e5cf){while(--_0x30e5cf){_0x337a13['push'](_0x337a13['shift']());}};_0x21fbd8(++_0x39554e);}(_0x2e52,0x10c));var _0x22e5=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2e52[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x22e5('0x0'));var util=require(_0x22e5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x22e5('0x2'));var router=express[_0x22e5('0x3')]();var fs_extra=require(_0x22e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x22e5('0x5'));var config=require('../../config/environment');var controller=require(_0x22e5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x22e5('0x7')]);router[_0x22e5('0x8')](_0x22e5('0x9'),auth[_0x22e5('0xa')](),controller[_0x22e5('0xb')]);router['post']('/',auth[_0x22e5('0xa')](),controller['create']);router[_0x22e5('0xc')]('/:id',auth[_0x22e5('0xa')](),controller['update']);router[_0x22e5('0xd')](_0x22e5('0x9'),auth[_0x22e5('0xa')](),controller[_0x22e5('0xe')]);module[_0x22e5('0xf')]=router; \ No newline at end of file +var _0x73c4=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x73c4,0x115));var _0x473c=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x73c4[_0x397cfb];return _0x15fed9;};'use strict';var multer=require(_0x473c('0x0'));var util=require(_0x473c('0x1'));var path=require(_0x473c('0x2'));var timeout=require('connect-timeout');var express=require(_0x473c('0x3'));var router=express[_0x473c('0x4')]();var fs_extra=require(_0x473c('0x5'));var auth=require(_0x473c('0x6'));var interaction=require(_0x473c('0x7'));var config=require(_0x473c('0x8'));var controller=require('./intZendeskField.controller');router[_0x473c('0x9')]('/',auth[_0x473c('0xa')](),controller[_0x473c('0xb')]);router[_0x473c('0x9')](_0x473c('0xc'),auth[_0x473c('0xa')](),controller[_0x473c('0xd')]);router[_0x473c('0xe')]('/',auth[_0x473c('0xa')](),controller[_0x473c('0xf')]);router['put'](_0x473c('0xc'),auth['isAuthenticated'](),controller[_0x473c('0x10')]);router[_0x473c('0x11')](_0x473c('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x473c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 7577c50..06ad257 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 _0x3163=['STRING','BOOLEAN','exports','string','variable','picklist'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x3163,0x182));var _0x3316=function(_0x4d9b62,_0x1a8b3e){_0x4d9b62=_0x4d9b62-0x0;var _0x80c89a=_0x3163[_0x4d9b62];return _0x80c89a;};'use strict';var Sequelize=require('sequelize');module[_0x3316('0x0')]={'type':{'type':Sequelize['ENUM'](_0x3316('0x1'),_0x3316('0x2'),'customVariable','keyValue',_0x3316('0x3')),'defaultValue':_0x3316('0x1')},'content':{'type':Sequelize[_0x3316('0x4')]},'key':{'type':Sequelize[_0x3316('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x3316('0x1'),_0x3316('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x3316('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3316('0x4')]},'customField':{'type':Sequelize[_0x3316('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3316('0x4')]}}; \ No newline at end of file +var _0x22f0=['sequelize','ENUM','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x22f0,0xaf));var _0x022f=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0x22f0[_0x4db46b];return _0x565be8;};'use strict';var Sequelize=require(_0x022f('0x0'));module['exports']={'type':{'type':Sequelize[_0x022f('0x1')]('string',_0x022f('0x2'),_0x022f('0x3'),_0x022f('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x022f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x022f('0x2'),_0x022f('0x3'))},'keyContent':{'type':Sequelize[_0x022f('0x5')]},'idField':{'type':Sequelize[_0x022f('0x5')]},'nameField':{'type':Sequelize[_0x022f('0x5')]},'customField':{'type':Sequelize[_0x022f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x022f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 636b33a..3af9a1d 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 _0x62e9=['index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','ZendeskField','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send'];(function(_0xcbb8b3,_0x1d7484){var _0x53a275=function(_0x2ee8c2){while(--_0x2ee8c2){_0xcbb8b3['push'](_0xcbb8b3['shift']());}};_0x53a275(++_0x1d7484);}(_0x62e9,0x1e6));var _0x962e=function(_0x363418,_0x5c41f4){_0x363418=_0x363418-0x0;var _0xb5746c=_0x62e9[_0x363418];return _0xb5746c;};'use strict';var emlformat=require(_0x962e('0x0'));var rimraf=require(_0x962e('0x1'));var zipdir=require(_0x962e('0x2'));var jsonpatch=require(_0x962e('0x3'));var rp=require(_0x962e('0x4'));var moment=require('moment');var BPromise=require(_0x962e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x962e('0x6'));var sox=require(_0x962e('0x7'));var csv=require(_0x962e('0x8'));var ejs=require(_0x962e('0x9'));var fs=require('fs');var fs_extra=require(_0x962e('0xa'));var _=require(_0x962e('0xb'));var squel=require(_0x962e('0xc'));var crypto=require(_0x962e('0xd'));var jsforce=require(_0x962e('0xe'));var deskjs=require(_0x962e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x962e('0x10'));var Redis=require(_0x962e('0x11'));var authService=require(_0x962e('0x12'));var qs=require(_0x962e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x962e('0x14'));var logger=require(_0x962e('0x15'))(_0x962e('0x16'));var utils=require(_0x962e('0x17'));var config=require(_0x962e('0x18'));var licenseUtil=require(_0x962e('0x19'));var db=require(_0x962e('0x1a'))['db'];function respondWithStatusCode(_0x433bb9,_0x4bc4bb){_0x4bc4bb=_0x4bc4bb||0xcc;return function(_0x168b97){if(_0x168b97){return _0x433bb9[_0x962e('0x1b')](_0x4bc4bb);}return _0x433bb9[_0x962e('0x1c')](_0x4bc4bb)[_0x962e('0x1d')]();};}function respondWithResult(_0x1204b8,_0x3aea09){_0x3aea09=_0x3aea09||0xc8;return function(_0x1d1f6d){if(_0x1d1f6d){return _0x1204b8[_0x962e('0x1c')](_0x3aea09)[_0x962e('0x1e')](_0x1d1f6d);}};}function respondWithFilteredResult(_0x3549ca,_0x3aa693){return function(_0x2b87bb){if(_0x2b87bb){var _0x5cc51b=typeof _0x3aa693[_0x962e('0x1f')]===_0x962e('0x20')&&typeof _0x3aa693[_0x962e('0x21')]===_0x962e('0x20');var _0x533006=_0x2b87bb[_0x962e('0x22')];var _0xad5ced=_0x5cc51b?0x0:_0x3aa693[_0x962e('0x1f')];var _0x3bedff=_0x5cc51b?_0x2b87bb[_0x962e('0x22')]:_0x3aa693['offset']+_0x3aa693[_0x962e('0x21')];var _0x4c325b;if(_0x3bedff>=_0x533006){_0x3bedff=_0x533006;_0x4c325b=0xc8;}else{_0x4c325b=0xce;}_0x3549ca[_0x962e('0x1c')](_0x4c325b);return _0x3549ca[_0x962e('0x23')](_0x962e('0x24'),_0xad5ced+'-'+_0x3bedff+'/'+_0x533006)['json'](_0x2b87bb);}return null;};}function patchUpdates(_0x10f1ed){return function(_0x35bfd6){try{jsonpatch[_0x962e('0x25')](_0x35bfd6,_0x10f1ed,!![]);}catch(_0xb89c6){return BPromise[_0x962e('0x26')](_0xb89c6);}return _0x35bfd6[_0x962e('0x27')]();};}function saveUpdates(_0xe563ac,_0x5fdba2){return function(_0x15fabd){if(_0x15fabd){return _0x15fabd[_0x962e('0x28')](_0xe563ac)[_0x962e('0x29')](function(_0x2d7555){return _0x2d7555;});}return null;};}function removeEntity(_0x14297b,_0x4c2f79){return function(_0x2e27ac){if(_0x2e27ac){return _0x2e27ac[_0x962e('0x2a')]()[_0x962e('0x29')](function(){_0x14297b[_0x962e('0x1c')](0xcc)[_0x962e('0x1d')]();});}};}function handleEntityNotFound(_0x3095fe,_0x1aeb78){return function(_0x1098b2){if(!_0x1098b2){_0x3095fe[_0x962e('0x1b')](0x194);}return _0x1098b2;};}function handleError(_0x4939f1,_0xf411ae){_0xf411ae=_0xf411ae||0x1f4;return function(_0x202e12){logger['error'](_0x202e12[_0x962e('0x2b')]);if(_0x202e12[_0x962e('0x2c')]){delete _0x202e12['name'];}_0x4939f1[_0x962e('0x1c')](_0xf411ae)[_0x962e('0x2d')](_0x202e12);};}exports[_0x962e('0x2e')]=function(_0x197698,_0x4e739d){var _0x3933da={},_0x4a669f={},_0x67c136={'count':0x0,'rows':[]};var _0x5eb366=_['map'](db['ZendeskField'][_0x962e('0x2f')],function(_0xc91cbb){return{'name':_0xc91cbb['fieldName'],'type':_0xc91cbb[_0x962e('0x30')][_0x962e('0x31')]};});_0x4a669f[_0x962e('0x32')]=_[_0x962e('0x33')](_0x5eb366,_0x962e('0x2c'));_0x4a669f[_0x962e('0x34')]=_['keys'](_0x197698[_0x962e('0x34')]);_0x4a669f[_0x962e('0x35')]=_[_0x962e('0x36')](_0x4a669f[_0x962e('0x32')],_0x4a669f[_0x962e('0x34')]);_0x3933da['attributes']=_[_0x962e('0x36')](_0x4a669f[_0x962e('0x32')],qs[_0x962e('0x37')](_0x197698[_0x962e('0x34')][_0x962e('0x37')]));_0x3933da[_0x962e('0x38')]=_0x3933da[_0x962e('0x38')][_0x962e('0x39')]?_0x3933da[_0x962e('0x38')]:_0x4a669f[_0x962e('0x32')];if(!_0x197698['query'][_0x962e('0x3a')](_0x962e('0x3b'))){_0x3933da[_0x962e('0x21')]=qs['limit'](_0x197698[_0x962e('0x34')]['limit']);_0x3933da[_0x962e('0x1f')]=qs['offset'](_0x197698[_0x962e('0x34')][_0x962e('0x1f')]);}_0x3933da['order']=qs['sort'](_0x197698['query'][_0x962e('0x3c')]);_0x3933da[_0x962e('0x3d')]=qs['filters'](_['pick'](_0x197698[_0x962e('0x34')],_0x4a669f[_0x962e('0x35')]),_0x5eb366);if(_0x197698[_0x962e('0x34')]['filter']){_0x3933da[_0x962e('0x3d')]=_['merge'](_0x3933da[_0x962e('0x3d')],{'$or':_[_0x962e('0x33')](_0x5eb366,function(_0x5044fe){if(_0x5044fe[_0x962e('0x30')]!==_0x962e('0x3e')){var _0x115411={};_0x115411[_0x5044fe[_0x962e('0x2c')]]={'$like':'%'+_0x197698[_0x962e('0x34')][_0x962e('0x3f')]+'%'};return _0x115411;}})});}_0x3933da=_[_0x962e('0x40')]({},_0x3933da,_0x197698[_0x962e('0x41')]);var _0x320042={'where':_0x3933da['where']};return db[_0x962e('0x42')]['count'](_0x320042)['then'](function(_0x3586bc){_0x67c136[_0x962e('0x22')]=_0x3586bc;if(_0x197698[_0x962e('0x34')][_0x962e('0x43')]){_0x3933da[_0x962e('0x44')]=[{'all':!![]}];}return db[_0x962e('0x42')]['findAll'](_0x3933da);})[_0x962e('0x29')](function(_0x312967){_0x67c136[_0x962e('0x45')]=_0x312967;return _0x67c136;})[_0x962e('0x29')](respondWithFilteredResult(_0x4e739d,_0x3933da))[_0x962e('0x46')](handleError(_0x4e739d,null));};exports['show']=function(_0x5407a6,_0x169630){var _0x2f23ba={'raw':!![],'where':{'id':_0x5407a6[_0x962e('0x47')]['id']}},_0x3b1d0a={};_0x3b1d0a['model']=_[_0x962e('0x48')](db[_0x962e('0x42')][_0x962e('0x2f')]);_0x3b1d0a[_0x962e('0x34')]=_[_0x962e('0x48')](_0x5407a6['query']);_0x3b1d0a['filters']=_['intersection'](_0x3b1d0a[_0x962e('0x32')],_0x3b1d0a['query']);_0x2f23ba[_0x962e('0x38')]=_[_0x962e('0x36')](_0x3b1d0a[_0x962e('0x32')],qs[_0x962e('0x37')](_0x5407a6[_0x962e('0x34')][_0x962e('0x37')]));_0x2f23ba[_0x962e('0x38')]=_0x2f23ba[_0x962e('0x38')][_0x962e('0x39')]?_0x2f23ba['attributes']:_0x3b1d0a[_0x962e('0x32')];if(_0x5407a6[_0x962e('0x34')]['includeAll']){_0x2f23ba[_0x962e('0x44')]=[{'all':!![]}];}_0x2f23ba=_[_0x962e('0x40')]({},_0x2f23ba,_0x5407a6[_0x962e('0x41')]);return db[_0x962e('0x42')][_0x962e('0x49')](_0x2f23ba)[_0x962e('0x29')](handleEntityNotFound(_0x169630,null))[_0x962e('0x29')](respondWithResult(_0x169630,null))[_0x962e('0x46')](handleError(_0x169630,null));};exports[_0x962e('0x4a')]=function(_0x13764f,_0x378f1f){return db[_0x962e('0x42')][_0x962e('0x4a')](_0x13764f[_0x962e('0x4b')],{})[_0x962e('0x29')](respondWithResult(_0x378f1f,0xc9))[_0x962e('0x46')](handleError(_0x378f1f,null));};exports['update']=function(_0x52a00b,_0x382920){if(_0x52a00b[_0x962e('0x4b')]['id']){delete _0x52a00b['body']['id'];}return db[_0x962e('0x42')]['find']({'where':{'id':_0x52a00b[_0x962e('0x47')]['id']}})['then'](handleEntityNotFound(_0x382920,null))[_0x962e('0x29')](saveUpdates(_0x52a00b[_0x962e('0x4b')],null))[_0x962e('0x29')](respondWithResult(_0x382920,null))[_0x962e('0x46')](handleError(_0x382920,null));};exports[_0x962e('0x2a')]=function(_0xcd107f,_0x4684cc){return db['ZendeskField'][_0x962e('0x49')]({'where':{'id':_0xcd107f[_0x962e('0x47')]['id']}})[_0x962e('0x29')](handleEntityNotFound(_0x4684cc,null))[_0x962e('0x29')](removeEntity(_0x4684cc,null))[_0x962e('0x46')](handleError(_0x4684cc,null));}; \ No newline at end of file +var _0x47e8=['end','error','stack','name','send','index','map','ZendeskField','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','keys','options','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x47e8,0x6e));var _0x847e=function(_0x113a6c,_0x10df30){_0x113a6c=_0x113a6c-0x0;var _0x1ac632=_0x47e8[_0x113a6c];return _0x1ac632;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x847e('0x0'));var zipdir=require(_0x847e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x847e('0x2'));var moment=require(_0x847e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x847e('0x4'));var util=require(_0x847e('0x5'));var path=require(_0x847e('0x6'));var sox=require(_0x847e('0x7'));var csv=require(_0x847e('0x8'));var ejs=require(_0x847e('0x9'));var fs=require('fs');var fs_extra=require(_0x847e('0xa'));var _=require(_0x847e('0xb'));var squel=require(_0x847e('0xc'));var crypto=require(_0x847e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x847e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x847e('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x847e('0x10'));var hardwareService=require(_0x847e('0x11'));var logger=require(_0x847e('0x12'))(_0x847e('0x13'));var utils=require(_0x847e('0x14'));var config=require(_0x847e('0x15'));var licenseUtil=require(_0x847e('0x16'));var db=require(_0x847e('0x17'))['db'];function respondWithStatusCode(_0x38ac18,_0x2c9a00){_0x2c9a00=_0x2c9a00||0xcc;return function(_0x3f9880){if(_0x3f9880){return _0x38ac18[_0x847e('0x18')](_0x2c9a00);}return _0x38ac18[_0x847e('0x19')](_0x2c9a00)['end']();};}function respondWithResult(_0x15563e,_0x43b05){_0x43b05=_0x43b05||0xc8;return function(_0x43bb5d){if(_0x43bb5d){return _0x15563e['status'](_0x43b05)[_0x847e('0x1a')](_0x43bb5d);}};}function respondWithFilteredResult(_0x45d562,_0x3bc55e){return function(_0x511750){if(_0x511750){var _0xcda990=typeof _0x3bc55e[_0x847e('0x1b')]===_0x847e('0x1c')&&typeof _0x3bc55e['limit']===_0x847e('0x1c');var _0x3eb976=_0x511750[_0x847e('0x1d')];var _0xe1f148=_0xcda990?0x0:_0x3bc55e[_0x847e('0x1b')];var _0x5a1107=_0xcda990?_0x511750[_0x847e('0x1d')]:_0x3bc55e[_0x847e('0x1b')]+_0x3bc55e['limit'];var _0x315230;if(_0x5a1107>=_0x3eb976){_0x5a1107=_0x3eb976;_0x315230=0xc8;}else{_0x315230=0xce;}_0x45d562[_0x847e('0x19')](_0x315230);return _0x45d562[_0x847e('0x1e')](_0x847e('0x1f'),_0xe1f148+'-'+_0x5a1107+'/'+_0x3eb976)[_0x847e('0x1a')](_0x511750);}return null;};}function patchUpdates(_0x272356){return function(_0x157b99){try{jsonpatch['apply'](_0x157b99,_0x272356,!![]);}catch(_0x961341){return BPromise['reject'](_0x961341);}return _0x157b99[_0x847e('0x20')]();};}function saveUpdates(_0x3d252a,_0x58f78b){return function(_0x5826a2){if(_0x5826a2){return _0x5826a2[_0x847e('0x21')](_0x3d252a)[_0x847e('0x22')](function(_0x2db475){return _0x2db475;});}return null;};}function removeEntity(_0x240e05,_0x2a2ec1){return function(_0x5d707e){if(_0x5d707e){return _0x5d707e[_0x847e('0x23')]()[_0x847e('0x22')](function(){_0x240e05['status'](0xcc)[_0x847e('0x24')]();});}};}function handleEntityNotFound(_0x225f3f,_0x3ca452){return function(_0x5abe5a){if(!_0x5abe5a){_0x225f3f[_0x847e('0x18')](0x194);}return _0x5abe5a;};}function handleError(_0x3991e5,_0x1fbf70){_0x1fbf70=_0x1fbf70||0x1f4;return function(_0xd8fd15){logger[_0x847e('0x25')](_0xd8fd15[_0x847e('0x26')]);if(_0xd8fd15[_0x847e('0x27')]){delete _0xd8fd15['name'];}_0x3991e5[_0x847e('0x19')](_0x1fbf70)[_0x847e('0x28')](_0xd8fd15);};}exports[_0x847e('0x29')]=function(_0x3b2fb0,_0x32973a){var _0x55d06a={},_0x4bb4ce={},_0x34dea0={'count':0x0,'rows':[]};var _0x40470c=_[_0x847e('0x2a')](db[_0x847e('0x2b')]['rawAttributes'],function(_0x13d408){return{'name':_0x13d408[_0x847e('0x2c')],'type':_0x13d408['type'][_0x847e('0x2d')]};});_0x4bb4ce[_0x847e('0x2e')]=_[_0x847e('0x2a')](_0x40470c,'name');_0x4bb4ce[_0x847e('0x2f')]=_['keys'](_0x3b2fb0[_0x847e('0x2f')]);_0x4bb4ce[_0x847e('0x30')]=_[_0x847e('0x31')](_0x4bb4ce[_0x847e('0x2e')],_0x4bb4ce[_0x847e('0x2f')]);_0x55d06a[_0x847e('0x32')]=_[_0x847e('0x31')](_0x4bb4ce['model'],qs[_0x847e('0x33')](_0x3b2fb0['query'][_0x847e('0x33')]));_0x55d06a[_0x847e('0x32')]=_0x55d06a[_0x847e('0x32')][_0x847e('0x34')]?_0x55d06a[_0x847e('0x32')]:_0x4bb4ce[_0x847e('0x2e')];if(!_0x3b2fb0[_0x847e('0x2f')][_0x847e('0x35')]('nolimit')){_0x55d06a[_0x847e('0x36')]=qs['limit'](_0x3b2fb0[_0x847e('0x2f')][_0x847e('0x36')]);_0x55d06a['offset']=qs[_0x847e('0x1b')](_0x3b2fb0[_0x847e('0x2f')][_0x847e('0x1b')]);}_0x55d06a[_0x847e('0x37')]=qs['sort'](_0x3b2fb0[_0x847e('0x2f')]['sort']);_0x55d06a[_0x847e('0x38')]=qs[_0x847e('0x30')](_[_0x847e('0x39')](_0x3b2fb0[_0x847e('0x2f')],_0x4bb4ce['filters']),_0x40470c);if(_0x3b2fb0[_0x847e('0x2f')]['filter']){_0x55d06a[_0x847e('0x38')]=_[_0x847e('0x3a')](_0x55d06a[_0x847e('0x38')],{'$or':_[_0x847e('0x2a')](_0x40470c,function(_0x3bb45c){if(_0x3bb45c[_0x847e('0x3b')]!==_0x847e('0x3c')){var _0x40c70f={};_0x40c70f[_0x3bb45c[_0x847e('0x27')]]={'$like':'%'+_0x3b2fb0['query'][_0x847e('0x3d')]+'%'};return _0x40c70f;}})});}_0x55d06a=_[_0x847e('0x3a')]({},_0x55d06a,_0x3b2fb0['options']);var _0x70d1f8={'where':_0x55d06a['where']};return db['ZendeskField'][_0x847e('0x1d')](_0x70d1f8)['then'](function(_0x1d2f36){_0x34dea0[_0x847e('0x1d')]=_0x1d2f36;if(_0x3b2fb0[_0x847e('0x2f')][_0x847e('0x3e')]){_0x55d06a[_0x847e('0x3f')]=[{'all':!![]}];}return db[_0x847e('0x2b')]['findAll'](_0x55d06a);})[_0x847e('0x22')](function(_0x28c4bc){_0x34dea0[_0x847e('0x40')]=_0x28c4bc;return _0x34dea0;})[_0x847e('0x22')](respondWithFilteredResult(_0x32973a,_0x55d06a))[_0x847e('0x41')](handleError(_0x32973a,null));};exports[_0x847e('0x42')]=function(_0x352fc8,_0x55d26f){var _0x110fec={'raw':!![],'where':{'id':_0x352fc8['params']['id']}},_0x5da463={};_0x5da463[_0x847e('0x2e')]=_['keys'](db[_0x847e('0x2b')][_0x847e('0x43')]);_0x5da463[_0x847e('0x2f')]=_[_0x847e('0x44')](_0x352fc8[_0x847e('0x2f')]);_0x5da463[_0x847e('0x30')]=_[_0x847e('0x31')](_0x5da463[_0x847e('0x2e')],_0x5da463[_0x847e('0x2f')]);_0x110fec[_0x847e('0x32')]=_[_0x847e('0x31')](_0x5da463[_0x847e('0x2e')],qs[_0x847e('0x33')](_0x352fc8[_0x847e('0x2f')][_0x847e('0x33')]));_0x110fec[_0x847e('0x32')]=_0x110fec[_0x847e('0x32')]['length']?_0x110fec['attributes']:_0x5da463[_0x847e('0x2e')];if(_0x352fc8[_0x847e('0x2f')][_0x847e('0x3e')]){_0x110fec[_0x847e('0x3f')]=[{'all':!![]}];}_0x110fec=_['merge']({},_0x110fec,_0x352fc8[_0x847e('0x45')]);return db[_0x847e('0x2b')][_0x847e('0x46')](_0x110fec)[_0x847e('0x22')](handleEntityNotFound(_0x55d26f,null))['then'](respondWithResult(_0x55d26f,null))[_0x847e('0x41')](handleError(_0x55d26f,null));};exports['create']=function(_0x4f26ef,_0x368814){return db[_0x847e('0x2b')][_0x847e('0x47')](_0x4f26ef['body'],{})[_0x847e('0x22')](respondWithResult(_0x368814,0xc9))[_0x847e('0x41')](handleError(_0x368814,null));};exports[_0x847e('0x21')]=function(_0x3044dd,_0x47323b){if(_0x3044dd[_0x847e('0x48')]['id']){delete _0x3044dd[_0x847e('0x48')]['id'];}return db[_0x847e('0x2b')][_0x847e('0x46')]({'where':{'id':_0x3044dd['params']['id']}})['then'](handleEntityNotFound(_0x47323b,null))[_0x847e('0x22')](saveUpdates(_0x3044dd[_0x847e('0x48')],null))[_0x847e('0x22')](respondWithResult(_0x47323b,null))[_0x847e('0x41')](handleError(_0x47323b,null));};exports[_0x847e('0x23')]=function(_0x34dc67,_0x4f8d07){return db[_0x847e('0x2b')][_0x847e('0x46')]({'where':{'id':_0x34dc67['params']['id']}})['then'](handleEntityNotFound(_0x4f8d07,null))[_0x847e('0x22')](removeEntity(_0x4f8d07,null))['catch'](handleError(_0x4f8d07,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3767246..f6a23f6 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 _0x953e=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0x953e,0xcc));var _0xe953=function(_0x1f5aed,_0x412771){_0x1f5aed=_0x1f5aed-0x0;var _0x502e0f=_0x953e[_0x1f5aed];return _0x502e0f;};'use strict';var _=require(_0xe953('0x0'));var util=require(_0xe953('0x1'));var logger=require(_0xe953('0x2'))(_0xe953('0x3'));var moment=require(_0xe953('0x4'));var BPromise=require('bluebird');var rp=require(_0xe953('0x5'));var fs=require('fs');var path=require(_0xe953('0x6'));var rimraf=require(_0xe953('0x7'));var config=require(_0xe953('0x8'));var attributes=require(_0xe953('0x9'));module[_0xe953('0xa')]=function(_0x443b37,_0x27d6f1){return _0x443b37[_0xe953('0xb')](_0xe953('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xe953('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9514=['idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','zendesk_unique_index'];(function(_0x3f9809,_0x14d72d){var _0x1fb162=function(_0x447fa0){while(--_0x447fa0){_0x3f9809['push'](_0x3f9809['shift']());}};_0x1fb162(++_0x14d72d);}(_0x9514,0xb8));var _0x4951=function(_0x550d8c,_0x1ebc1f){_0x550d8c=_0x550d8c-0x0;var _0x2ff952=_0x9514[_0x550d8c];return _0x2ff952;};'use strict';var _=require('lodash');var util=require(_0x4951('0x0'));var logger=require(_0x4951('0x1'))(_0x4951('0x2'));var moment=require('moment');var BPromise=require(_0x4951('0x3'));var rp=require(_0x4951('0x4'));var fs=require('fs');var path=require(_0x4951('0x5'));var rimraf=require(_0x4951('0x6'));var config=require(_0x4951('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x4951('0x8')]=function(_0x48aba8,_0xb7b526){return _0x48aba8[_0x4951('0x9')](_0x4951('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4951('0xb'),'fields':[_0x4951('0xc'),_0x4951('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 0fbf1c2..7adbd8a 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 _0x572d=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x3c4087,_0x5c764b){var _0x23ad1f=function(_0x39bf1c){while(--_0x39bf1c){_0x3c4087['push'](_0x3c4087['shift']());}};_0x23ad1f(++_0x5c764b);}(_0x572d,0xef));var _0xd572=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x572d[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require('lodash');var util=require(_0xd572('0x0'));var moment=require(_0xd572('0x1'));var BPromise=require(_0xd572('0x2'));var rs=require(_0xd572('0x3'));var fs=require('fs');var Redis=require(_0xd572('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd572('0x5'));var logger=require(_0xd572('0x6'))('rpc');var config=require(_0xd572('0x7'));var jayson=require(_0xd572('0x8'));var client=jayson[_0xd572('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdc3c,_0x187d47,_0x4712cd){return new BPromise(function(_0x92213f,_0x4cecb7){return client[_0xd572('0xa')](_0x1cdc3c,_0x4712cd)[_0xd572('0xb')](function(_0x16e109){logger[_0xd572('0xc')]('ZendeskField,\x20%s,\x20%s',_0x187d47,_0xd572('0xd'));logger[_0xd572('0xe')](_0xd572('0xf'),_0x187d47,_0xd572('0xd'),JSON[_0xd572('0x10')](_0x16e109));if(_0x16e109[_0xd572('0x11')]){if(_0x16e109[_0xd572('0x11')][_0xd572('0x12')]===0x1f4){logger[_0xd572('0x11')](_0xd572('0x13'),_0x187d47,_0x16e109[_0xd572('0x11')][_0xd572('0x14')]);return _0x4cecb7(_0x16e109[_0xd572('0x11')]['message']);}logger[_0xd572('0x11')](_0xd572('0x13'),_0x187d47,_0x16e109[_0xd572('0x11')][_0xd572('0x14')]);return _0x92213f(_0x16e109[_0xd572('0x11')][_0xd572('0x14')]);}else{logger[_0xd572('0xc')]('ZendeskField,\x20%s,\x20%s',_0x187d47,_0xd572('0xd'));_0x92213f(_0x16e109[_0xd572('0x15')][_0xd572('0x14')]);}})[_0xd572('0x16')](function(_0x176a22){logger[_0xd572('0x11')](_0xd572('0x13'),_0x187d47,_0x176a22);_0x4cecb7(_0x176a22);});});} \ No newline at end of file +var _0xed69=['../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x287301,_0x100fd0){var _0x5d0d67=function(_0x1f4ba4){while(--_0x1f4ba4){_0x287301['push'](_0x287301['shift']());}};_0x5d0d67(++_0x100fd0);}(_0xed69,0x11f));var _0x9ed6=function(_0x4bfcbe,_0x4630f5){_0x4bfcbe=_0x4bfcbe-0x0;var _0x5b65e6=_0xed69[_0x4bfcbe];return _0x5b65e6;};'use strict';var _=require(_0x9ed6('0x0'));var util=require(_0x9ed6('0x1'));var moment=require(_0x9ed6('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ed6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ed6('0x4'))['db'];var utils=require(_0x9ed6('0x5'));var logger=require(_0x9ed6('0x6'))('rpc');var config=require(_0x9ed6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ed6('0x8')][_0x9ed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46e148,_0x4641ff,_0x9a178c){return new BPromise(function(_0x5b9451,_0x397962){return client[_0x9ed6('0xa')](_0x46e148,_0x9a178c)[_0x9ed6('0xb')](function(_0x1342ce){logger[_0x9ed6('0xc')](_0x9ed6('0xd'),_0x4641ff,_0x9ed6('0xe'));logger[_0x9ed6('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4641ff,_0x9ed6('0xe'),JSON[_0x9ed6('0x10')](_0x1342ce));if(_0x1342ce['error']){if(_0x1342ce['error'][_0x9ed6('0x11')]===0x1f4){logger[_0x9ed6('0x12')](_0x9ed6('0xd'),_0x4641ff,_0x1342ce[_0x9ed6('0x12')]['message']);return _0x397962(_0x1342ce[_0x9ed6('0x12')]['message']);}logger[_0x9ed6('0x12')](_0x9ed6('0xd'),_0x4641ff,_0x1342ce[_0x9ed6('0x12')][_0x9ed6('0x13')]);return _0x5b9451(_0x1342ce[_0x9ed6('0x12')]['message']);}else{logger[_0x9ed6('0xc')](_0x9ed6('0xd'),_0x4641ff,_0x9ed6('0xe'));_0x5b9451(_0x1342ce['result'][_0x9ed6('0x13')]);}})[_0x9ed6('0x14')](function(_0x46ad83){logger['error'](_0x9ed6('0xd'),_0x4641ff,_0x46ad83);_0x397962(_0x46ad83);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index e5f4673..264e99b 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 _0x3013=['delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update'];(function(_0x313c38,_0x72599e){var _0x37b778=function(_0x560009){while(--_0x560009){_0x313c38['push'](_0x313c38['shift']());}};_0x37b778(++_0x72599e);}(_0x3013,0x116));var _0x3301=function(_0x5a789f,_0x112ad1){_0x5a789f=_0x5a789f-0x0;var _0x5e8af6=_0x3013[_0x5a789f];return _0x5e8af6;};'use strict';var multer=require('multer');var util=require(_0x3301('0x0'));var path=require(_0x3301('0x1'));var timeout=require(_0x3301('0x2'));var express=require(_0x3301('0x3'));var router=express[_0x3301('0x4')]();var fs_extra=require(_0x3301('0x5'));var auth=require(_0x3301('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3301('0x7'));var controller=require(_0x3301('0x8'));router[_0x3301('0x9')]('/',auth[_0x3301('0xa')](),controller[_0x3301('0xb')]);router[_0x3301('0x9')](_0x3301('0xc'),auth[_0x3301('0xa')](),controller[_0x3301('0xd')]);router[_0x3301('0x9')](_0x3301('0xe'),auth[_0x3301('0xa')](),controller['getConfigurations']);router[_0x3301('0x9')](_0x3301('0xf'),auth[_0x3301('0xa')](),controller[_0x3301('0x10')]);router[_0x3301('0x11')]('/',auth[_0x3301('0xa')](),controller[_0x3301('0x12')]);router['post'](_0x3301('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3301('0x13')](_0x3301('0xc'),auth[_0x3301('0xa')](),controller[_0x3301('0x14')]);router[_0x3301('0x15')](_0x3301('0xc'),auth[_0x3301('0xa')](),controller[_0x3301('0x16')]);module['exports']=router; \ No newline at end of file +var _0xbec5=['addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x56887f,_0x924860){var _0x1dfe61=function(_0x20834f){while(--_0x20834f){_0x56887f['push'](_0x56887f['shift']());}};_0x1dfe61(++_0x924860);}(_0xbec5,0x147));var _0x5bec=function(_0x5a6961,_0xd41ca6){_0x5a6961=_0x5a6961-0x0;var _0x4af0a6=_0xbec5[_0x5a6961];return _0x4af0a6;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require(_0x5bec('0x2'));var timeout=require(_0x5bec('0x3'));var express=require(_0x5bec('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require(_0x5bec('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0x9'),auth[_0x5bec('0xa')](),controller['show']);router[_0x5bec('0x8')](_0x5bec('0xb'),auth[_0x5bec('0xa')](),controller[_0x5bec('0xc')]);router[_0x5bec('0x8')](_0x5bec('0xd'),auth[_0x5bec('0xa')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5bec('0xe')]('/:id/configurations',auth[_0x5bec('0xa')](),controller[_0x5bec('0xf')]);router['put'](_0x5bec('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x5bec('0x10')](_0x5bec('0x9'),auth['isAuthenticated'](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 76ff554..32c05c9 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 _0x008c=['exports','STRING','sequelize'];(function(_0x39edc2,_0x15dbd7){var _0x201c43=function(_0xc1ecfd){while(--_0xc1ecfd){_0x39edc2['push'](_0x39edc2['shift']());}};_0x201c43(++_0x15dbd7);}(_0x008c,0x188));var _0xc008=function(_0x31c6ca,_0x5b37b3){_0x31c6ca=_0x31c6ca-0x0;var _0x1b5088=_0x008c[_0x31c6ca];return _0x1b5088;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize[_0xc008('0x2')]},'description':{'type':Sequelize[_0xc008('0x2')]},'host':{'type':Sequelize[_0xc008('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc008('0x2')]},'clientSecret':{'type':Sequelize[_0xc008('0x2')]},'serverUrl':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xc008('0x2')]},'refreshToken':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','STRING'];(function(_0x211f5f,_0xc6daac){var _0x4feb86=function(_0x30c168){while(--_0x30c168){_0x211f5f['push'](_0x211f5f['shift']());}};_0x4feb86(++_0xc6daac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x0a9e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0a9e('0x2')]},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x0a9e('0x2')]},'refreshToken':{'type':Sequelize[_0x0a9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 34b0732..1ca1167 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 _0xac71=['jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ZohoAccount','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','catch','create','body','find','getConfigurations','findOne','ZohoConfiguration','rawAttributes','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','format','response','Owner','Subject','Description','Call_Duration','Call_Type','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x225b6b,_0x5e1f3b){var _0x3fc3ef=function(_0x4a18ed){while(--_0x4a18ed){_0x225b6b['push'](_0x225b6b['shift']());}};_0x3fc3ef(++_0x5e1f3b);}(_0xac71,0x16e));var _0x1ac7=function(_0x558097,_0x5a6cc2){_0x558097=_0x558097-0x0;var _0xe80464=_0xac71[_0x558097];return _0xe80464;};'use strict';var emlformat=require(_0x1ac7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ac7('0x1'));var jsonpatch=require(_0x1ac7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1ac7('0x3'));var Mustache=require(_0x1ac7('0x4'));var util=require(_0x1ac7('0x5'));var path=require(_0x1ac7('0x6'));var sox=require(_0x1ac7('0x7'));var csv=require(_0x1ac7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ac7('0x9'));var squel=require(_0x1ac7('0xa'));var crypto=require(_0x1ac7('0xb'));var jsforce=require(_0x1ac7('0xc'));var deskjs=require(_0x1ac7('0xd'));var toCsv=require(_0x1ac7('0x8'));var querystring=require(_0x1ac7('0xe'));var Papa=require(_0x1ac7('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1ac7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac7('0x11'));var logger=require('../../config/logger')(_0x1ac7('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1ac7('0x13'));var db=require(_0x1ac7('0x14'))['db'];var integrations=require(_0x1ac7('0x15'));function respondWithStatusCode(_0x410ef4,_0x274879){_0x274879=_0x274879||0xcc;return function(_0x225df6){if(_0x225df6){return _0x410ef4[_0x1ac7('0x16')](_0x274879);}return _0x410ef4[_0x1ac7('0x17')](_0x274879)[_0x1ac7('0x18')]();};}function respondWithResult(_0x35f87b,_0x53df78){_0x53df78=_0x53df78||0xc8;return function(_0x2b712d){if(_0x2b712d){return _0x35f87b[_0x1ac7('0x17')](_0x53df78)[_0x1ac7('0x19')](_0x2b712d);}};}function respondWithFilteredResult(_0x49125b,_0x431033){return function(_0x479ba5){if(_0x479ba5){var _0x1cfb02=typeof _0x431033['offset']===_0x1ac7('0x1a')&&typeof _0x431033['limit']===_0x1ac7('0x1a');var _0x53428d=_0x479ba5['count'];var _0x5557f7=_0x1cfb02?0x0:_0x431033[_0x1ac7('0x1b')];var _0x2e9d8e=_0x1cfb02?_0x479ba5[_0x1ac7('0x1c')]:_0x431033[_0x1ac7('0x1b')]+_0x431033[_0x1ac7('0x1d')];var _0x32bb50;if(_0x2e9d8e>=_0x53428d){_0x2e9d8e=_0x53428d;_0x32bb50=0xc8;}else{_0x32bb50=0xce;}_0x49125b[_0x1ac7('0x17')](_0x32bb50);return _0x49125b[_0x1ac7('0x1e')]('Content-Range',_0x5557f7+'-'+_0x2e9d8e+'/'+_0x53428d)[_0x1ac7('0x19')](_0x479ba5);}return null;};}function patchUpdates(_0x320a15){return function(_0x12174a){try{jsonpatch[_0x1ac7('0x1f')](_0x12174a,_0x320a15,!![]);}catch(_0x1bc8d4){return BPromise[_0x1ac7('0x20')](_0x1bc8d4);}return _0x12174a[_0x1ac7('0x21')]();};}function saveUpdates(_0x28f5a8,_0x42a4ed){return function(_0x4478e1){if(_0x4478e1){return _0x4478e1[_0x1ac7('0x22')](_0x28f5a8)[_0x1ac7('0x23')](function(_0x486acc){return _0x486acc;});}return null;};}function removeEntity(_0x23a4dc,_0x4d812c){return function(_0x2e7656){if(_0x2e7656){return _0x2e7656[_0x1ac7('0x24')]()[_0x1ac7('0x23')](function(){_0x23a4dc['status'](0xcc)[_0x1ac7('0x18')]();});}};}function handleEntityNotFound(_0x7967c2,_0x154f44){return function(_0x938bc9){if(!_0x938bc9){_0x7967c2[_0x1ac7('0x16')](0x194);}return _0x938bc9;};}function handleError(_0x1a9c04,_0x2dcc9a){_0x2dcc9a=_0x2dcc9a||0x1f4;return function(_0x3a83a3){logger[_0x1ac7('0x25')](_0x3a83a3[_0x1ac7('0x26')]);if(_0x3a83a3[_0x1ac7('0x27')]){delete _0x3a83a3[_0x1ac7('0x27')];}_0x1a9c04[_0x1ac7('0x17')](_0x2dcc9a)[_0x1ac7('0x28')](_0x3a83a3);};}exports[_0x1ac7('0x29')]=function(_0x29c87d,_0x19a185){var _0x264440={},_0x4e95bc={},_0x363328={'count':0x0,'rows':[]};var _0x5c2a8c=_[_0x1ac7('0x2a')](db[_0x1ac7('0x2b')]['rawAttributes'],function(_0x5a9c40){return{'name':_0x5a9c40[_0x1ac7('0x2c')],'type':_0x5a9c40['type'][_0x1ac7('0x2d')]};});_0x4e95bc['model']=_['map'](_0x5c2a8c,_0x1ac7('0x27'));_0x4e95bc['query']=_[_0x1ac7('0x2e')](_0x29c87d['query']);_0x4e95bc['filters']=_[_0x1ac7('0x2f')](_0x4e95bc[_0x1ac7('0x30')],_0x4e95bc[_0x1ac7('0x31')]);_0x264440[_0x1ac7('0x32')]=_[_0x1ac7('0x2f')](_0x4e95bc['model'],qs[_0x1ac7('0x33')](_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x33')]));_0x264440[_0x1ac7('0x32')]=_0x264440[_0x1ac7('0x32')][_0x1ac7('0x34')]?_0x264440[_0x1ac7('0x32')]:_0x4e95bc['model'];if(!_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x35')](_0x1ac7('0x36'))){_0x264440[_0x1ac7('0x1d')]=qs[_0x1ac7('0x1d')](_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x1d')]);_0x264440[_0x1ac7('0x1b')]=qs[_0x1ac7('0x1b')](_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x1b')]);}_0x264440['order']=qs['sort'](_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x37')]);_0x264440[_0x1ac7('0x38')]=qs[_0x1ac7('0x39')](_[_0x1ac7('0x3a')](_0x29c87d[_0x1ac7('0x31')],_0x4e95bc['filters']),_0x5c2a8c);if(_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x3b')]){_0x264440[_0x1ac7('0x38')]=_[_0x1ac7('0x3c')](_0x264440[_0x1ac7('0x38')],{'$or':_[_0x1ac7('0x2a')](_0x5c2a8c,function(_0x1910b0){if(_0x1910b0[_0x1ac7('0x3d')]!==_0x1ac7('0x3e')){var _0x4d660d={};_0x4d660d[_0x1910b0[_0x1ac7('0x27')]]={'$like':'%'+_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x3b')]+'%'};return _0x4d660d;}})});}_0x264440=_[_0x1ac7('0x3c')]({},_0x264440,_0x29c87d['options']);var _0x28a7af={'where':_0x264440[_0x1ac7('0x38')]};return db['ZohoAccount']['count'](_0x28a7af)[_0x1ac7('0x23')](function(_0x2f7733){_0x363328[_0x1ac7('0x1c')]=_0x2f7733;if(_0x29c87d[_0x1ac7('0x31')][_0x1ac7('0x3f')]){_0x264440[_0x1ac7('0x40')]=[{'all':!![]}];}return db[_0x1ac7('0x2b')][_0x1ac7('0x41')](_0x264440);})[_0x1ac7('0x23')](function(_0x39944e){_0x363328[_0x1ac7('0x42')]=_0x39944e;return _0x363328;})[_0x1ac7('0x23')](respondWithFilteredResult(_0x19a185,_0x264440))['catch'](handleError(_0x19a185,null));};exports[_0x1ac7('0x43')]=function(_0x10f83e,_0x40f3e2){var _0x38c28d={'raw':![],'where':{'id':_0x10f83e[_0x1ac7('0x44')]['id']}},_0x41b3af={};_0x41b3af[_0x1ac7('0x30')]=_[_0x1ac7('0x2e')](db[_0x1ac7('0x2b')]['rawAttributes']);_0x41b3af[_0x1ac7('0x31')]=_['keys'](_0x10f83e[_0x1ac7('0x31')]);_0x41b3af['filters']=_['intersection'](_0x41b3af['model'],_0x41b3af[_0x1ac7('0x31')]);_0x38c28d['attributes']=_['intersection'](_0x41b3af[_0x1ac7('0x30')],qs[_0x1ac7('0x33')](_0x10f83e[_0x1ac7('0x31')]['fields']));_0x38c28d['attributes']=_0x38c28d[_0x1ac7('0x32')][_0x1ac7('0x34')]?_0x38c28d[_0x1ac7('0x32')]:_0x41b3af[_0x1ac7('0x30')];if(_0x10f83e[_0x1ac7('0x31')]['includeAll']){_0x38c28d[_0x1ac7('0x40')]=[{'all':!![]}];}_0x38c28d=_[_0x1ac7('0x3c')]({},_0x38c28d,_0x10f83e[_0x1ac7('0x45')]);return db[_0x1ac7('0x2b')]['find'](_0x38c28d)[_0x1ac7('0x23')](handleEntityNotFound(_0x40f3e2,null))['then'](respondWithResult(_0x40f3e2,null))[_0x1ac7('0x46')](handleError(_0x40f3e2,null));};exports[_0x1ac7('0x47')]=function(_0x12dad6,_0x3c8382){return db[_0x1ac7('0x2b')][_0x1ac7('0x47')](_0x12dad6['body'],{})['then'](respondWithResult(_0x3c8382,0xc9))[_0x1ac7('0x46')](handleError(_0x3c8382,null));};exports[_0x1ac7('0x22')]=function(_0x353100,_0x53cb0c){if(_0x353100[_0x1ac7('0x48')]['id']){delete _0x353100[_0x1ac7('0x48')]['id'];}return db[_0x1ac7('0x2b')][_0x1ac7('0x49')]({'where':{'id':_0x353100[_0x1ac7('0x44')]['id']}})[_0x1ac7('0x23')](handleEntityNotFound(_0x53cb0c,null))[_0x1ac7('0x23')](saveUpdates(_0x353100[_0x1ac7('0x48')],null))['then'](respondWithResult(_0x53cb0c,null))[_0x1ac7('0x46')](handleError(_0x53cb0c,null));};exports['destroy']=function(_0x47cefa,_0xfb37b2){return db[_0x1ac7('0x2b')][_0x1ac7('0x49')]({'where':{'id':_0x47cefa[_0x1ac7('0x44')]['id']}})[_0x1ac7('0x23')](handleEntityNotFound(_0xfb37b2,null))[_0x1ac7('0x23')](removeEntity(_0xfb37b2,null))[_0x1ac7('0x46')](handleError(_0xfb37b2,null));};exports[_0x1ac7('0x4a')]=function(_0x1407da,_0xd4bb03,_0xdf5dfa){var _0x18766e={};var _0x1a4540={};var _0xe4106f;var _0x3df1fa;return db[_0x1ac7('0x2b')][_0x1ac7('0x4b')]({'where':{'id':_0x1407da[_0x1ac7('0x44')]['id']}})['then'](handleEntityNotFound(_0xd4bb03,null))['then'](function(_0x13bda3){if(_0x13bda3){_0xe4106f=_0x13bda3;_0x1a4540[_0x1ac7('0x30')]=_[_0x1ac7('0x2e')](db[_0x1ac7('0x4c')][_0x1ac7('0x4d')]);_0x1a4540['query']=_[_0x1ac7('0x2e')](_0x1407da[_0x1ac7('0x31')]);_0x1a4540[_0x1ac7('0x39')]=_['intersection'](_0x1a4540[_0x1ac7('0x30')],_0x1a4540[_0x1ac7('0x31')]);_0x18766e[_0x1ac7('0x32')]=_[_0x1ac7('0x2f')](_0x1a4540[_0x1ac7('0x30')],qs[_0x1ac7('0x33')](_0x1407da['query'][_0x1ac7('0x33')]));_0x18766e['attributes']=_0x18766e[_0x1ac7('0x32')][_0x1ac7('0x34')]?_0x18766e['attributes']:_0x1a4540[_0x1ac7('0x30')];_0x18766e[_0x1ac7('0x4e')]=qs[_0x1ac7('0x37')](_0x1407da[_0x1ac7('0x31')][_0x1ac7('0x37')]);_0x18766e[_0x1ac7('0x38')]=qs[_0x1ac7('0x39')](_[_0x1ac7('0x3a')](_0x1407da[_0x1ac7('0x31')],_0x1a4540[_0x1ac7('0x39')]));if(_0x1407da[_0x1ac7('0x31')]['filter']){_0x18766e['where']=_[_0x1ac7('0x3c')](_0x18766e[_0x1ac7('0x38')],{'$or':_[_0x1ac7('0x2a')](_0x18766e['attributes'],function(_0x32f8a8){var _0x48f223={};_0x48f223[_0x32f8a8]={'$like':'%'+_0x1407da[_0x1ac7('0x31')][_0x1ac7('0x3b')]+'%'};return _0x48f223;})});}_0x18766e=_['merge']({},_0x18766e,_0x1407da[_0x1ac7('0x45')]);return _0xe4106f[_0x1ac7('0x4a')](_0x18766e);}})[_0x1ac7('0x23')](function(_0x2ed206){if(_0x2ed206){_0x3df1fa=_0x2ed206[_0x1ac7('0x34')];if(!_0x1407da['query'][_0x1ac7('0x35')](_0x1ac7('0x36'))){_0x18766e['limit']=qs['limit'](_0x1407da[_0x1ac7('0x31')][_0x1ac7('0x1d')]);_0x18766e['offset']=qs['offset'](_0x1407da[_0x1ac7('0x31')]['offset']);}return _0xe4106f['getConfigurations'](_0x18766e);}})['then'](function(_0x206b3a){if(_0x206b3a){return _0x206b3a?{'count':_0x3df1fa,'rows':_0x206b3a}:null;}})[_0x1ac7('0x23')](respondWithResult(_0xd4bb03,null))[_0x1ac7('0x46')](handleError(_0xd4bb03,null));};exports[_0x1ac7('0x4f')]=function(_0x12518e,_0x33206b,_0x347c5c){if(_0x12518e[_0x1ac7('0x48')]['id']){delete _0x12518e[_0x1ac7('0x48')]['id'];}return db[_0x1ac7('0x2b')][_0x1ac7('0x4b')]({'where':{'id':_0x12518e['params']['id']}})[_0x1ac7('0x23')](handleEntityNotFound(_0x33206b,null))['then'](function(_0x4b4c25){if(_0x4b4c25){_0x12518e[_0x1ac7('0x48')]['AccountId']=_0x4b4c25['id'];_0x12518e['body'][_0x1ac7('0x50')]=integrations[_0x1ac7('0x51')](_0x12518e[_0x1ac7('0x48')][_0x1ac7('0x52')],_0x12518e[_0x1ac7('0x48')][_0x1ac7('0x3d')]);_0x12518e['body'][_0x1ac7('0x53')]=integrations[_0x1ac7('0x54')](_0x12518e[_0x1ac7('0x48')][_0x1ac7('0x52')],_0x12518e[_0x1ac7('0x48')][_0x1ac7('0x3d')]);return db[_0x1ac7('0x4c')][_0x1ac7('0x47')](_0x12518e[_0x1ac7('0x48')],{'include':[{'model':db[_0x1ac7('0x55')],'as':'Subjects'},{'model':db[_0x1ac7('0x55')],'as':_0x1ac7('0x53')}]});}return null;})['then'](respondWithResult(_0x33206b,null))[_0x1ac7('0x46')](handleError(_0x33206b,null));};function getAccessToken(_0x43c8a3){return new Promise(function(_0xd8aeaa,_0x48e7ad){var _0x1fba01;switch(_0x43c8a3[_0x1ac7('0x56')]){case'US':_0x1fba01=_0x1ac7('0x57');break;case'AU':_0x1fba01=_0x1ac7('0x58');break;case'EU':_0x1fba01=_0x1ac7('0x59');break;case'IN':_0x1fba01=_0x1ac7('0x5a');break;case'CN':_0x1fba01=_0x1ac7('0x5b');break;default:_0x1fba01=_0x1ac7('0x59');break;}var _0x27674b={'method':_0x1ac7('0x5c'),'uri':_0x1fba01+_0x1ac7('0x5d'),'qs':{'refresh_token':_0x43c8a3[_0x1ac7('0x5e')],'client_id':_0x43c8a3[_0x1ac7('0x5f')],'client_secret':_0x43c8a3[_0x1ac7('0x60')],'grant_type':_0x1ac7('0x61')},'json':!![]};return rp(_0x27674b)[_0x1ac7('0x23')](function(_0x8bf388){if(_0x8bf388[_0x1ac7('0x62')]){_0xd8aeaa(_0x8bf388['access_token']);}else{_0x48e7ad('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1ac7('0x46')](function(_0xeb3258){_0x48e7ad(_0xeb3258);});});}exports[_0x1ac7('0x63')]=function(_0x50e0f7,_0x844a89,_0x430730){var _0x555207,_0x343dc5,_0x2a4ff1,_0x14f162,_0x2e7c13;return db[_0x1ac7('0x2b')][_0x1ac7('0x4b')]({'where':{'id':_0x50e0f7['params']['id']},'attributes':['id',_0x1ac7('0x64'),_0x1ac7('0x56'),'clientId',_0x1ac7('0x60'),_0x1ac7('0x65'),_0x1ac7('0x66'),_0x1ac7('0x5e')]})[_0x1ac7('0x23')](handleEntityNotFound(_0x844a89,null))[_0x1ac7('0x23')](function(_0x4b2e58){_0x2e7c13=_0x4b2e58;_0x555207=_0x2e7c13[_0x1ac7('0x64')];_0x343dc5=_0x555207===_0x1ac7('0x67')?'eu':_0x1ac7('0x68');_0x2a4ff1=_0x2e7c13['serverUrl'];var _0x312f51=_0x2a4ff1[_0x1ac7('0x69')](-0x1);if(_0x312f51==='/'||_0x312f51==='\x5c'||_0x312f51===':'){_0x2a4ff1=_0x2a4ff1[_0x1ac7('0x6a')](0x0,_0x2a4ff1[_0x1ac7('0x6b')](_0x312f51));}if(!_0x2e7c13[_0x1ac7('0x5e')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2e7c13);})[_0x1ac7('0x23')](function(_0x155072){if(_0x155072){return rp({'method':'GET','uri':util[_0x1ac7('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x343dc5),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x155072},'json':!![]});}})['then'](function(_0x45e538){if(_0x45e538){if(_0x45e538[_0x1ac7('0x6d')]&&_0x45e538[_0x1ac7('0x6d')]['error']){throw new Error(_0x45e538['response'][_0x1ac7('0x25')]['message']);}var _0x49a82c=[];var _0x17cfc8=[];var _0x16b27b=[_0x1ac7('0x6e'),_0x1ac7('0x6f'),_0x1ac7('0x70'),'WhoId',_0x1ac7('0x71'),'Call_Result','Call_Start_Time',_0x1ac7('0x72')];_0x17cfc8=_['remove'](_0x45e538[_0x1ac7('0x33')],function(_0x258607){return _0x16b27b[_0x1ac7('0x73')](_0x258607[_0x1ac7('0x74')]);});for(var _0x20fd3e=0x0;_0x20fd3e<_0x17cfc8['length'];_0x20fd3e++){if(_0x17cfc8[_0x20fd3e][_0x1ac7('0x75')]===![]){_0x49a82c['push']({'id':_0x17cfc8[_0x20fd3e]['id'],'name':_0x17cfc8[_0x20fd3e][_0x1ac7('0x76')],'custom':_0x17cfc8[_0x20fd3e][_0x1ac7('0x77')],'options':_0x17cfc8[_0x20fd3e][_0x1ac7('0x78')]===_0x1ac7('0x79')&&_0x17cfc8[_0x20fd3e][_0x1ac7('0x7a')][_0x1ac7('0x34')]>-0x1?_[_0x1ac7('0x2a')](_0x17cfc8[_0x20fd3e][_0x1ac7('0x7a')],function(_0x150808){return{'name':_0x150808,'value':_0x150808};}):[]});}}return{'count':_0x49a82c['length'],'rows':_0x49a82c};}else{return{'count':0x0,'rows':[]};}})[_0x1ac7('0x23')](respondWithResult(_0x844a89,null))[_0x1ac7('0x46')](function(_0x5668af){var _0x601849=_0x50e0f7[_0x1ac7('0x31')][_0x1ac7('0x7b')]?0x1f4:_0x5668af[_0x1ac7('0x7c')]||0x1f4;logger[_0x1ac7('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x1ac7('0x63'),_0x601849,JSON['stringify'](_0x5668af));delete _0x5668af[_0x1ac7('0x27')];if(_0x601849===0x191){_0x601849=0x190;}_0x844a89['status'](_0x601849)[_0x1ac7('0x28')](_0x50e0f7['query']['test']?{'message':_0x1ac7('0x7d'),'statusCode':_0x5668af[_0x1ac7('0x7c')]}:_0x5668af);});}; \ No newline at end of file +var _0x485b=['com','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','ZohoAccount','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','rows','catch','params','rawAttributes','options','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','Subjects','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','host','zone','clientId','serverUrl','zoho.eu'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x485b,0x99));var _0xb485=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x485b[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xb485('0x0'));var rimraf=require(_0xb485('0x1'));var zipdir=require(_0xb485('0x2'));var jsonpatch=require(_0xb485('0x3'));var rp=require('request-promise');var moment=require(_0xb485('0x4'));var BPromise=require(_0xb485('0x5'));var Mustache=require('mustache');var util=require(_0xb485('0x6'));var path=require(_0xb485('0x7'));var sox=require(_0xb485('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb485('0x9'));var _=require(_0xb485('0xa'));var squel=require(_0xb485('0xb'));var crypto=require(_0xb485('0xc'));var jsforce=require(_0xb485('0xd'));var deskjs=require(_0xb485('0xe'));var toCsv=require(_0xb485('0xf'));var querystring=require(_0xb485('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb485('0x11'));var as=require(_0xb485('0x12'));var hardwareService=require(_0xb485('0x13'));var logger=require('../../config/logger')(_0xb485('0x14'));var utils=require(_0xb485('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb485('0x16'))['db'];var integrations=require(_0xb485('0x17'));function respondWithStatusCode(_0x2b99d6,_0x262795){_0x262795=_0x262795||0xcc;return function(_0x11e826){if(_0x11e826){return _0x2b99d6[_0xb485('0x18')](_0x262795);}return _0x2b99d6[_0xb485('0x19')](_0x262795)['end']();};}function respondWithResult(_0x35b333,_0x27af5f){_0x27af5f=_0x27af5f||0xc8;return function(_0x207890){if(_0x207890){return _0x35b333['status'](_0x27af5f)[_0xb485('0x1a')](_0x207890);}};}function respondWithFilteredResult(_0xf316be,_0x13c5a9){return function(_0x10a367){if(_0x10a367){var _0x173800=typeof _0x13c5a9[_0xb485('0x1b')]==='undefined'&&typeof _0x13c5a9[_0xb485('0x1c')]===_0xb485('0x1d');var _0x142c23=_0x10a367[_0xb485('0x1e')];var _0x5690f8=_0x173800?0x0:_0x13c5a9['offset'];var _0x117843=_0x173800?_0x10a367['count']:_0x13c5a9[_0xb485('0x1b')]+_0x13c5a9[_0xb485('0x1c')];var _0x36faa3;if(_0x117843>=_0x142c23){_0x117843=_0x142c23;_0x36faa3=0xc8;}else{_0x36faa3=0xce;}_0xf316be[_0xb485('0x19')](_0x36faa3);return _0xf316be[_0xb485('0x1f')]('Content-Range',_0x5690f8+'-'+_0x117843+'/'+_0x142c23)[_0xb485('0x1a')](_0x10a367);}return null;};}function patchUpdates(_0x35b65f){return function(_0x1a41a9){try{jsonpatch[_0xb485('0x20')](_0x1a41a9,_0x35b65f,!![]);}catch(_0x4861ec){return BPromise[_0xb485('0x21')](_0x4861ec);}return _0x1a41a9[_0xb485('0x22')]();};}function saveUpdates(_0x188b79,_0x462a0b){return function(_0x167070){if(_0x167070){return _0x167070[_0xb485('0x23')](_0x188b79)['then'](function(_0x45411c){return _0x45411c;});}return null;};}function removeEntity(_0x2468c9,_0x3615ee){return function(_0x4e2453){if(_0x4e2453){return _0x4e2453[_0xb485('0x24')]()[_0xb485('0x25')](function(){_0x2468c9[_0xb485('0x19')](0xcc)[_0xb485('0x26')]();});}};}function handleEntityNotFound(_0x2ecb68,_0x136e03){return function(_0xc1946d){if(!_0xc1946d){_0x2ecb68[_0xb485('0x18')](0x194);}return _0xc1946d;};}function handleError(_0x265a04,_0x48cfdc){_0x48cfdc=_0x48cfdc||0x1f4;return function(_0xa5c141){logger[_0xb485('0x27')](_0xa5c141[_0xb485('0x28')]);if(_0xa5c141[_0xb485('0x29')]){delete _0xa5c141['name'];}_0x265a04[_0xb485('0x19')](_0x48cfdc)[_0xb485('0x2a')](_0xa5c141);};}exports[_0xb485('0x2b')]=function(_0x32e5b5,_0x41fc5c){var _0x38adc3={},_0x4dbc57={},_0x397e50={'count':0x0,'rows':[]};var _0x199b99=_[_0xb485('0x2c')](db[_0xb485('0x2d')]['rawAttributes'],function(_0x89e1d){return{'name':_0x89e1d['fieldName'],'type':_0x89e1d[_0xb485('0x2e')]['key']};});_0x4dbc57['model']=_[_0xb485('0x2c')](_0x199b99,'name');_0x4dbc57[_0xb485('0x2f')]=_[_0xb485('0x30')](_0x32e5b5[_0xb485('0x2f')]);_0x4dbc57[_0xb485('0x31')]=_[_0xb485('0x32')](_0x4dbc57[_0xb485('0x33')],_0x4dbc57[_0xb485('0x2f')]);_0x38adc3[_0xb485('0x34')]=_['intersection'](_0x4dbc57[_0xb485('0x33')],qs[_0xb485('0x35')](_0x32e5b5['query']['fields']));_0x38adc3[_0xb485('0x34')]=_0x38adc3[_0xb485('0x34')][_0xb485('0x36')]?_0x38adc3[_0xb485('0x34')]:_0x4dbc57[_0xb485('0x33')];if(!_0x32e5b5[_0xb485('0x2f')][_0xb485('0x37')]('nolimit')){_0x38adc3[_0xb485('0x1c')]=qs[_0xb485('0x1c')](_0x32e5b5[_0xb485('0x2f')][_0xb485('0x1c')]);_0x38adc3[_0xb485('0x1b')]=qs['offset'](_0x32e5b5['query'][_0xb485('0x1b')]);}_0x38adc3[_0xb485('0x38')]=qs['sort'](_0x32e5b5[_0xb485('0x2f')][_0xb485('0x39')]);_0x38adc3['where']=qs[_0xb485('0x31')](_['pick'](_0x32e5b5[_0xb485('0x2f')],_0x4dbc57[_0xb485('0x31')]),_0x199b99);if(_0x32e5b5[_0xb485('0x2f')][_0xb485('0x3a')]){_0x38adc3['where']=_[_0xb485('0x3b')](_0x38adc3[_0xb485('0x3c')],{'$or':_[_0xb485('0x2c')](_0x199b99,function(_0x5bb7a5){if(_0x5bb7a5[_0xb485('0x2e')]!==_0xb485('0x3d')){var _0x37ef7a={};_0x37ef7a[_0x5bb7a5[_0xb485('0x29')]]={'$like':'%'+_0x32e5b5[_0xb485('0x2f')][_0xb485('0x3a')]+'%'};return _0x37ef7a;}})});}_0x38adc3=_[_0xb485('0x3b')]({},_0x38adc3,_0x32e5b5['options']);var _0x261e79={'where':_0x38adc3[_0xb485('0x3c')]};return db[_0xb485('0x2d')][_0xb485('0x1e')](_0x261e79)[_0xb485('0x25')](function(_0x7c18ce){_0x397e50[_0xb485('0x1e')]=_0x7c18ce;if(_0x32e5b5[_0xb485('0x2f')][_0xb485('0x3e')]){_0x38adc3['include']=[{'all':!![]}];}return db[_0xb485('0x2d')]['findAll'](_0x38adc3);})[_0xb485('0x25')](function(_0x2223ae){_0x397e50[_0xb485('0x3f')]=_0x2223ae;return _0x397e50;})['then'](respondWithFilteredResult(_0x41fc5c,_0x38adc3))[_0xb485('0x40')](handleError(_0x41fc5c,null));};exports['show']=function(_0x87f8f5,_0x32d507){var _0x3d66e4={'raw':![],'where':{'id':_0x87f8f5[_0xb485('0x41')]['id']}},_0xf02666={};_0xf02666[_0xb485('0x33')]=_[_0xb485('0x30')](db[_0xb485('0x2d')][_0xb485('0x42')]);_0xf02666[_0xb485('0x2f')]=_[_0xb485('0x30')](_0x87f8f5['query']);_0xf02666['filters']=_[_0xb485('0x32')](_0xf02666[_0xb485('0x33')],_0xf02666[_0xb485('0x2f')]);_0x3d66e4[_0xb485('0x34')]=_[_0xb485('0x32')](_0xf02666['model'],qs[_0xb485('0x35')](_0x87f8f5[_0xb485('0x2f')]['fields']));_0x3d66e4[_0xb485('0x34')]=_0x3d66e4[_0xb485('0x34')][_0xb485('0x36')]?_0x3d66e4['attributes']:_0xf02666[_0xb485('0x33')];if(_0x87f8f5['query'][_0xb485('0x3e')]){_0x3d66e4['include']=[{'all':!![]}];}_0x3d66e4=_[_0xb485('0x3b')]({},_0x3d66e4,_0x87f8f5[_0xb485('0x43')]);return db[_0xb485('0x2d')][_0xb485('0x44')](_0x3d66e4)[_0xb485('0x25')](handleEntityNotFound(_0x32d507,null))[_0xb485('0x25')](respondWithResult(_0x32d507,null))['catch'](handleError(_0x32d507,null));};exports[_0xb485('0x45')]=function(_0x2a7f9f,_0x47043a){return db['ZohoAccount'][_0xb485('0x45')](_0x2a7f9f['body'],{})[_0xb485('0x25')](respondWithResult(_0x47043a,0xc9))[_0xb485('0x40')](handleError(_0x47043a,null));};exports[_0xb485('0x23')]=function(_0x440c9b,_0x5b9a5d){if(_0x440c9b[_0xb485('0x46')]['id']){delete _0x440c9b['body']['id'];}return db[_0xb485('0x2d')]['find']({'where':{'id':_0x440c9b['params']['id']}})[_0xb485('0x25')](handleEntityNotFound(_0x5b9a5d,null))[_0xb485('0x25')](saveUpdates(_0x440c9b[_0xb485('0x46')],null))[_0xb485('0x25')](respondWithResult(_0x5b9a5d,null))[_0xb485('0x40')](handleError(_0x5b9a5d,null));};exports[_0xb485('0x24')]=function(_0x4d3ec4,_0x5bd3ee){return db[_0xb485('0x2d')][_0xb485('0x44')]({'where':{'id':_0x4d3ec4[_0xb485('0x41')]['id']}})[_0xb485('0x25')](handleEntityNotFound(_0x5bd3ee,null))['then'](removeEntity(_0x5bd3ee,null))[_0xb485('0x40')](handleError(_0x5bd3ee,null));};exports['getConfigurations']=function(_0x322ead,_0x33f433,_0x18dcc3){var _0x55d522={};var _0x5eff7f={};var _0x22ee3a;var _0x38d2c6;return db[_0xb485('0x2d')][_0xb485('0x47')]({'where':{'id':_0x322ead['params']['id']}})[_0xb485('0x25')](handleEntityNotFound(_0x33f433,null))['then'](function(_0x58c75b){if(_0x58c75b){_0x22ee3a=_0x58c75b;_0x5eff7f[_0xb485('0x33')]=_[_0xb485('0x30')](db['ZohoConfiguration']['rawAttributes']);_0x5eff7f[_0xb485('0x2f')]=_[_0xb485('0x30')](_0x322ead['query']);_0x5eff7f[_0xb485('0x31')]=_[_0xb485('0x32')](_0x5eff7f[_0xb485('0x33')],_0x5eff7f['query']);_0x55d522[_0xb485('0x34')]=_[_0xb485('0x32')](_0x5eff7f['model'],qs[_0xb485('0x35')](_0x322ead[_0xb485('0x2f')][_0xb485('0x35')]));_0x55d522[_0xb485('0x34')]=_0x55d522[_0xb485('0x34')][_0xb485('0x36')]?_0x55d522['attributes']:_0x5eff7f[_0xb485('0x33')];_0x55d522['order']=qs[_0xb485('0x39')](_0x322ead[_0xb485('0x2f')][_0xb485('0x39')]);_0x55d522[_0xb485('0x3c')]=qs[_0xb485('0x31')](_[_0xb485('0x48')](_0x322ead['query'],_0x5eff7f[_0xb485('0x31')]));if(_0x322ead[_0xb485('0x2f')][_0xb485('0x3a')]){_0x55d522[_0xb485('0x3c')]=_[_0xb485('0x3b')](_0x55d522['where'],{'$or':_['map'](_0x55d522[_0xb485('0x34')],function(_0x156721){var _0x578ae4={};_0x578ae4[_0x156721]={'$like':'%'+_0x322ead[_0xb485('0x2f')][_0xb485('0x3a')]+'%'};return _0x578ae4;})});}_0x55d522=_[_0xb485('0x3b')]({},_0x55d522,_0x322ead['options']);return _0x22ee3a[_0xb485('0x49')](_0x55d522);}})[_0xb485('0x25')](function(_0x5380bf){if(_0x5380bf){_0x38d2c6=_0x5380bf[_0xb485('0x36')];if(!_0x322ead[_0xb485('0x2f')][_0xb485('0x37')]('nolimit')){_0x55d522[_0xb485('0x1c')]=qs[_0xb485('0x1c')](_0x322ead['query'][_0xb485('0x1c')]);_0x55d522['offset']=qs[_0xb485('0x1b')](_0x322ead[_0xb485('0x2f')][_0xb485('0x1b')]);}return _0x22ee3a['getConfigurations'](_0x55d522);}})[_0xb485('0x25')](function(_0x1e716c){if(_0x1e716c){return _0x1e716c?{'count':_0x38d2c6,'rows':_0x1e716c}:null;}})[_0xb485('0x25')](respondWithResult(_0x33f433,null))[_0xb485('0x40')](handleError(_0x33f433,null));};exports[_0xb485('0x4a')]=function(_0x5c8717,_0x49be8e,_0x4b7ced){if(_0x5c8717[_0xb485('0x46')]['id']){delete _0x5c8717['body']['id'];}return db[_0xb485('0x2d')][_0xb485('0x47')]({'where':{'id':_0x5c8717[_0xb485('0x41')]['id']}})[_0xb485('0x25')](handleEntityNotFound(_0x49be8e,null))['then'](function(_0x22c814){if(_0x22c814){_0x5c8717[_0xb485('0x46')][_0xb485('0x4b')]=_0x22c814['id'];_0x5c8717['body']['Subjects']=integrations[_0xb485('0x4c')](_0x5c8717[_0xb485('0x46')][_0xb485('0x4d')],_0x5c8717[_0xb485('0x46')][_0xb485('0x2e')]);_0x5c8717[_0xb485('0x46')][_0xb485('0x4e')]=integrations[_0xb485('0x4f')](_0x5c8717['body']['channel'],_0x5c8717[_0xb485('0x46')]['type']);return db[_0xb485('0x50')][_0xb485('0x45')](_0x5c8717['body'],{'include':[{'model':db[_0xb485('0x51')],'as':_0xb485('0x52')},{'model':db['ZohoField'],'as':_0xb485('0x4e')}]});}return null;})[_0xb485('0x25')](respondWithResult(_0x49be8e,null))[_0xb485('0x40')](handleError(_0x49be8e,null));};function getAccessToken(_0x40cae1){return new Promise(function(_0x15f740,_0x27f6f8){var _0x5c234d;switch(_0x40cae1['zone']){case'US':_0x5c234d='https://accounts.zoho.com';break;case'AU':_0x5c234d='https://accounts.zoho.com.au';break;case'EU':_0x5c234d=_0xb485('0x53');break;case'IN':_0x5c234d=_0xb485('0x54');break;case'CN':_0x5c234d=_0xb485('0x55');break;default:_0x5c234d=_0xb485('0x53');break;}var _0x3988a7={'method':_0xb485('0x56'),'uri':_0x5c234d+_0xb485('0x57'),'qs':{'refresh_token':_0x40cae1[_0xb485('0x58')],'client_id':_0x40cae1['clientId'],'client_secret':_0x40cae1[_0xb485('0x59')],'grant_type':_0xb485('0x5a')},'json':!![]};return rp(_0x3988a7)[_0xb485('0x25')](function(_0x98e99d){if(_0x98e99d[_0xb485('0x5b')]){_0x15f740(_0x98e99d['access_token']);}else{_0x27f6f8('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xb485('0x40')](function(_0x438a95){_0x27f6f8(_0x438a95);});});}exports['getFields']=function(_0x4cb8f6,_0x3812d9,_0x1e3e25){var _0x4dfe32,_0x2abb75,_0x3e1ebe,_0x594fc8,_0x1bc977;return db[_0xb485('0x2d')][_0xb485('0x47')]({'where':{'id':_0x4cb8f6[_0xb485('0x41')]['id']},'attributes':['id',_0xb485('0x5c'),_0xb485('0x5d'),_0xb485('0x5e'),_0xb485('0x59'),_0xb485('0x5f'),'code','refreshToken']})[_0xb485('0x25')](handleEntityNotFound(_0x3812d9,null))[_0xb485('0x25')](function(_0x415f41){_0x1bc977=_0x415f41;_0x4dfe32=_0x1bc977[_0xb485('0x5c')];_0x2abb75=_0x4dfe32===_0xb485('0x60')?'eu':_0xb485('0x61');_0x3e1ebe=_0x1bc977[_0xb485('0x5f')];var _0x4d3a95=_0x3e1ebe['slice'](-0x1);if(_0x4d3a95==='/'||_0x4d3a95==='\x5c'||_0x4d3a95===':'){_0x3e1ebe=_0x3e1ebe[_0xb485('0x62')](0x0,_0x3e1ebe[_0xb485('0x63')](_0x4d3a95));}if(!_0x1bc977[_0xb485('0x58')]){throw new Error(_0xb485('0x64'));}return getAccessToken(_0x1bc977);})[_0xb485('0x25')](function(_0x28ea5d){if(_0x28ea5d){return rp({'method':_0xb485('0x65'),'uri':util['format'](_0xb485('0x66'),_0x2abb75),'qs':{'module':'Calls'},'headers':{'Authorization':_0xb485('0x67')+_0x28ea5d},'json':!![]});}})[_0xb485('0x25')](function(_0x1c9b2c){if(_0x1c9b2c){if(_0x1c9b2c[_0xb485('0x68')]&&_0x1c9b2c[_0xb485('0x68')][_0xb485('0x27')]){throw new Error(_0x1c9b2c[_0xb485('0x68')][_0xb485('0x27')][_0xb485('0x69')]);}var _0x1f8fad=[];var _0x3c1296=[];var _0x7c5265=[_0xb485('0x6a'),_0xb485('0x6b'),_0xb485('0x6c'),_0xb485('0x6d'),_0xb485('0x6e'),'Call_Result',_0xb485('0x6f'),_0xb485('0x70')];_0x3c1296=_['remove'](_0x1c9b2c[_0xb485('0x35')],function(_0x41b280){return _0x7c5265[_0xb485('0x71')](_0x41b280[_0xb485('0x72')]);});for(var _0x2991f1=0x0;_0x2991f1<_0x3c1296['length'];_0x2991f1++){if(_0x3c1296[_0x2991f1][_0xb485('0x73')]===![]){_0x1f8fad[_0xb485('0x74')]({'id':_0x3c1296[_0x2991f1]['id'],'name':_0x3c1296[_0x2991f1][_0xb485('0x75')],'custom':_0x3c1296[_0x2991f1]['custom_field'],'options':_0x3c1296[_0x2991f1][_0xb485('0x76')]===_0xb485('0x77')&&_0x3c1296[_0x2991f1][_0xb485('0x78')][_0xb485('0x36')]>-0x1?_[_0xb485('0x2c')](_0x3c1296[_0x2991f1]['pick_list_values'],function(_0x65a0ee){return{'name':_0x65a0ee,'value':_0x65a0ee};}):[]});}}return{'count':_0x1f8fad[_0xb485('0x36')],'rows':_0x1f8fad};}else{return{'count':0x0,'rows':[]};}})[_0xb485('0x25')](respondWithResult(_0x3812d9,null))[_0xb485('0x40')](function(_0x4d9713){var _0x3c88dd=_0x4cb8f6['query'][_0xb485('0x79')]?0x1f4:_0x4d9713[_0xb485('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3c88dd,JSON[_0xb485('0x7b')](_0x4d9713));delete _0x4d9713[_0xb485('0x29')];if(_0x3c88dd===0x191){_0x3c88dd=0x190;}_0x3812d9[_0xb485('0x19')](_0x3c88dd)['send'](_0x4cb8f6[_0xb485('0x2f')]['test']?{'message':_0xb485('0x7c'),'statusCode':_0x4d9713[_0xb485('0x7a')]}:_0x4d9713);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index bfb1c10..39f5b06 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 _0xf0cf=['refresh_token','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','slice','lastIndexOf','https://accounts.zoho.in','application/x-www-form-urlencoded','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','serverUrl','then','parse'];(function(_0x2c7726,_0x34b7c8){var _0x4a0776=function(_0x4a4f12){while(--_0x4a4f12){_0x2c7726['push'](_0x2c7726['shift']());}};_0x4a0776(++_0x34b7c8);}(_0xf0cf,0x104));var _0xff0c=function(_0x4fb6ff,_0x1c5f59){_0x4fb6ff=_0x4fb6ff-0x0;var _0x1140c8=_0xf0cf[_0x4fb6ff];return _0x1140c8;};'use strict';var _=require(_0xff0c('0x0'));var util=require(_0xff0c('0x1'));var logger=require(_0xff0c('0x2'))('api');var moment=require(_0xff0c('0x3'));var BPromise=require(_0xff0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xff0c('0x5'));var attributes=require(_0xff0c('0x6'));var integrations=require(_0xff0c('0x7'));module[_0xff0c('0x8')]=function(_0x2c9dc2,_0x15dae0){return _0x2c9dc2[_0xff0c('0x9')](_0xff0c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1dba32,_0x1cd6ed,_0xff4a0d){if(_0x1dba32[_0xff0c('0xb')](_0xff0c('0xc'))||_0x1dba32['changed']('serverUrl')||_0x1dba32[_0xff0c('0xb')](_0xff0c('0xd'))||_0x1dba32[_0xff0c('0xb')](_0xff0c('0xe'))||_0x1dba32[_0xff0c('0xb')]('code')||_0x1dba32['changed'](_0xff0c('0xf'))){var _0x8cc10,_0x521414;_0x8cc10=_0x1dba32['serverUrl'];var _0x5b6038=_0x8cc10['slice'](-0x1);if(_0x5b6038==='/'||_0x5b6038==='\x5c'||_0x5b6038===':'){_0x8cc10=_0x8cc10[_0xff0c('0x10')](0x0,_0x8cc10['lastIndexOf'](_0x5b6038));}switch(_0x1dba32[_0xff0c('0xc')]){case'US':_0x521414=_0xff0c('0x11');break;case'AU':_0x521414=_0xff0c('0x12');break;case'IN':_0x521414='https://accounts.zoho.in';break;case'CN':_0x521414=_0xff0c('0x13');break;default:_0x521414=_0xff0c('0x14');break;}var _0x41b4bf={'method':_0xff0c('0x15'),'uri':_0x521414+_0xff0c('0x16'),'form':{'grant_type':_0xff0c('0x17'),'client_id':_0x1dba32[_0xff0c('0xd')],'client_secret':_0x1dba32[_0xff0c('0xe')],'redirect_uri':_0x1dba32[_0xff0c('0x18')],'code':_0x1dba32['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x41b4bf)[_0xff0c('0x19')](function(_0x10b7c9){var _0x1071d8=JSON[_0xff0c('0x1a')](_0x10b7c9);if(_0x1071d8[_0xff0c('0x1b')]){_0x1dba32[_0xff0c('0x1c')]=_0x1071d8[_0xff0c('0x1b')];logger['info'](util['format'](_0xff0c('0x1d'),_0x1dba32[_0xff0c('0x1e')],_0x1dba32['id']));}else{logger[_0xff0c('0x1f')](util[_0xff0c('0x20')](_0xff0c('0x21'),_0x1dba32[_0xff0c('0x1e')],_0x1dba32['id']),util[_0xff0c('0x22')](_0x1071d8,{'showHidden':![],'depth':null}));}return _0xff4a0d(null,_0x1cd6ed);})[_0xff0c('0x23')](function(_0x4079f5){logger[_0xff0c('0x1f')](util[_0xff0c('0x20')](_0xff0c('0x21'),_0x1dba32[_0xff0c('0x1e')],_0x1dba32['id']),util[_0xff0c('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0xff4a0d(_0x4079f5);});}else{return _0xff4a0d(null,_0x1cd6ed);}},'beforeUpdate':function(_0x377412,_0x39782b,_0x1b04a1){if(_0x377412[_0xff0c('0xb')](_0xff0c('0xc'))||_0x377412['changed'](_0xff0c('0x18'))||_0x377412[_0xff0c('0xb')](_0xff0c('0xd'))||_0x377412[_0xff0c('0xb')](_0xff0c('0xe'))||_0x377412[_0xff0c('0xb')](_0xff0c('0x24'))||_0x377412[_0xff0c('0xb')](_0xff0c('0xf'))){var _0x10a0d0,_0x1bf7aa;_0x10a0d0=_0x377412[_0xff0c('0x18')];var _0x2ff44c=_0x10a0d0[_0xff0c('0x25')](-0x1);if(_0x2ff44c==='/'||_0x2ff44c==='\x5c'||_0x2ff44c===':'){_0x10a0d0=_0x10a0d0[_0xff0c('0x10')](0x0,_0x10a0d0[_0xff0c('0x26')](_0x2ff44c));}switch(_0x377412[_0xff0c('0xc')]){case'US':_0x1bf7aa=_0xff0c('0x11');break;case'AU':_0x1bf7aa='https://accounts.zoho.com.au';break;case'IN':_0x1bf7aa=_0xff0c('0x27');break;case'CN':_0x1bf7aa='https://accounts.zoho.com.cn';break;default:_0x1bf7aa=_0xff0c('0x14');break;}var _0x56b600={'method':_0xff0c('0x15'),'uri':_0x1bf7aa+_0xff0c('0x16'),'form':{'grant_type':_0xff0c('0x17'),'client_id':_0x377412[_0xff0c('0xd')],'client_secret':_0x377412[_0xff0c('0xe')],'redirect_uri':_0x377412[_0xff0c('0x18')],'code':_0x377412[_0xff0c('0x24')]},'headers':{'Content-Type':_0xff0c('0x28')}};return rp(_0x56b600)[_0xff0c('0x19')](function(_0x5b5705){var _0x25ee41=JSON[_0xff0c('0x1a')](_0x5b5705);if(_0x25ee41['refresh_token']){_0x377412[_0xff0c('0x1c')]=_0x25ee41[_0xff0c('0x1b')];logger['info'](util[_0xff0c('0x20')](_0xff0c('0x1d'),_0x377412['name'],_0x377412['id']));}else{logger[_0xff0c('0x1f')](util[_0xff0c('0x20')](_0xff0c('0x21'),_0x377412[_0xff0c('0x1e')],_0x377412['id']),util[_0xff0c('0x22')](_0x25ee41,{'showHidden':![],'depth':null}));}return _0x1b04a1(null,_0x39782b);})[_0xff0c('0x23')](function(_0x3f2204){logger[_0xff0c('0x1f')](util[_0xff0c('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x377412[_0xff0c('0x1e')],_0x377412['id']),util[_0xff0c('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x1b04a1(_0x3f2204);});}else{return _0x1b04a1(null,_0x39782b);}}}});}; \ No newline at end of file +var _0x5fa1=['path','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','serverUrl','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','catch','error','inspect','host','https://accounts.zoho.com','POST','then','format','lodash','util','api','bluebird','request-promise'];(function(_0x17f993,_0x139c73){var _0x4784fb=function(_0x11b0cc){while(--_0x11b0cc){_0x17f993['push'](_0x17f993['shift']());}};_0x4784fb(++_0x139c73);}(_0x5fa1,0xd2));var _0x15fa=function(_0x3bec3c,_0x4fbd9b){_0x3bec3c=_0x3bec3c-0x0;var _0x38b63e=_0x5fa1[_0x3bec3c];return _0x38b63e;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var logger=require('../../config/logger')(_0x15fa('0x2'));var moment=require('moment');var BPromise=require(_0x15fa('0x3'));var rp=require(_0x15fa('0x4'));var fs=require('fs');var path=require(_0x15fa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x15fa('0x6'));var integrations=require(_0x15fa('0x7'));module[_0x15fa('0x8')]=function(_0x43870f,_0x5eba46){return _0x43870f[_0x15fa('0x9')](_0x15fa('0xa'),attributes,{'tableName':_0x15fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x557013,_0xa2d547,_0x3a8e1d){if(_0x557013['changed'](_0x15fa('0xc'))||_0x557013['changed']('serverUrl')||_0x557013[_0x15fa('0xd')](_0x15fa('0xe'))||_0x557013[_0x15fa('0xd')](_0x15fa('0xf'))||_0x557013[_0x15fa('0xd')](_0x15fa('0x10'))||_0x557013[_0x15fa('0xd')]('host')){var _0x2293bb,_0x488e1a;_0x2293bb=_0x557013['serverUrl'];var _0x403a32=_0x2293bb[_0x15fa('0x11')](-0x1);if(_0x403a32==='/'||_0x403a32==='\x5c'||_0x403a32===':'){_0x2293bb=_0x2293bb[_0x15fa('0x12')](0x0,_0x2293bb[_0x15fa('0x13')](_0x403a32));}switch(_0x557013['zone']){case'US':_0x488e1a='https://accounts.zoho.com';break;case'AU':_0x488e1a=_0x15fa('0x14');break;case'IN':_0x488e1a=_0x15fa('0x15');break;case'CN':_0x488e1a=_0x15fa('0x16');break;default:_0x488e1a=_0x15fa('0x17');break;}var _0x52ffda={'method':'POST','uri':_0x488e1a+_0x15fa('0x18'),'form':{'grant_type':_0x15fa('0x19'),'client_id':_0x557013[_0x15fa('0xe')],'client_secret':_0x557013['clientSecret'],'redirect_uri':_0x557013[_0x15fa('0x1a')],'code':_0x557013['code']},'headers':{'Content-Type':_0x15fa('0x1b')}};return rp(_0x52ffda)['then'](function(_0x52a8b8){var _0x142a13=JSON[_0x15fa('0x1c')](_0x52a8b8);if(_0x142a13[_0x15fa('0x1d')]){_0x557013[_0x15fa('0x1e')]=_0x142a13['refresh_token'];logger[_0x15fa('0x1f')](util['format'](_0x15fa('0x20'),_0x557013['name'],_0x557013['id']));}else{logger['error'](util['format'](_0x15fa('0x21'),_0x557013[_0x15fa('0x22')],_0x557013['id']),util['inspect'](_0x142a13,{'showHidden':![],'depth':null}));}return _0x3a8e1d(null,_0xa2d547);})[_0x15fa('0x23')](function(_0x1e33eb){logger[_0x15fa('0x24')](util['format'](_0x15fa('0x21'),_0x557013[_0x15fa('0x22')],_0x557013['id']),util[_0x15fa('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3a8e1d(_0x1e33eb);});}else{return _0x3a8e1d(null,_0xa2d547);}},'beforeUpdate':function(_0x46dd2d,_0x545757,_0x47c965){if(_0x46dd2d[_0x15fa('0xd')](_0x15fa('0xc'))||_0x46dd2d[_0x15fa('0xd')](_0x15fa('0x1a'))||_0x46dd2d['changed']('clientId')||_0x46dd2d[_0x15fa('0xd')]('clientSecret')||_0x46dd2d['changed']('code')||_0x46dd2d[_0x15fa('0xd')](_0x15fa('0x26'))){var _0x4385c8,_0xb5a4c8;_0x4385c8=_0x46dd2d[_0x15fa('0x1a')];var _0x5618ee=_0x4385c8[_0x15fa('0x11')](-0x1);if(_0x5618ee==='/'||_0x5618ee==='\x5c'||_0x5618ee===':'){_0x4385c8=_0x4385c8['substring'](0x0,_0x4385c8['lastIndexOf'](_0x5618ee));}switch(_0x46dd2d['zone']){case'US':_0xb5a4c8=_0x15fa('0x27');break;case'AU':_0xb5a4c8=_0x15fa('0x14');break;case'IN':_0xb5a4c8=_0x15fa('0x15');break;case'CN':_0xb5a4c8=_0x15fa('0x16');break;default:_0xb5a4c8=_0x15fa('0x17');break;}var _0x54aef9={'method':_0x15fa('0x28'),'uri':_0xb5a4c8+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x46dd2d[_0x15fa('0xe')],'client_secret':_0x46dd2d['clientSecret'],'redirect_uri':_0x46dd2d['serverUrl'],'code':_0x46dd2d[_0x15fa('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x54aef9)[_0x15fa('0x29')](function(_0x464473){var _0x399493=JSON[_0x15fa('0x1c')](_0x464473);if(_0x399493[_0x15fa('0x1d')]){_0x46dd2d[_0x15fa('0x1e')]=_0x399493[_0x15fa('0x1d')];logger['info'](util[_0x15fa('0x2a')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46dd2d[_0x15fa('0x22')],_0x46dd2d['id']));}else{logger[_0x15fa('0x24')](util[_0x15fa('0x2a')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x46dd2d[_0x15fa('0x22')],_0x46dd2d['id']),util[_0x15fa('0x25')](_0x399493,{'showHidden':![],'depth':null}));}return _0x47c965(null,_0x545757);})[_0x15fa('0x23')](function(_0x2598bb){logger[_0x15fa('0x24')](util[_0x15fa('0x2a')](_0x15fa('0x21'),_0x46dd2d[_0x15fa('0x22')],_0x46dd2d['id']),util[_0x15fa('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x47c965(_0x2598bb);});}else{return _0x47c965(null,_0x545757);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 05924d5..1f3e3cb 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 _0x7d8a=['../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','ShowZohoAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4f284e,_0x484d06){var _0x51bf70=function(_0x1469ec){while(--_0x1469ec){_0x4f284e['push'](_0x4f284e['shift']());}};_0x51bf70(++_0x484d06);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x7d8a[_0xdd2bfa];return _0x55397e;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var moment=require(_0xa7d8('0x2'));var BPromise=require(_0xa7d8('0x3'));var rs=require(_0xa7d8('0x4'));var fs=require('fs');var Redis=require(_0xa7d8('0x5'));var db=require(_0xa7d8('0x6'))['db'];var utils=require(_0xa7d8('0x7'));var logger=require(_0xa7d8('0x8'))(_0xa7d8('0x9'));var config=require(_0xa7d8('0xa'));var jayson=require(_0xa7d8('0xb'));var client=jayson[_0xa7d8('0xc')][_0xa7d8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55bb66,_0x410b09,_0x2e1955){return new BPromise(function(_0x1807cc,_0x455082){return client[_0xa7d8('0xe')](_0x55bb66,_0x2e1955)['then'](function(_0x40f419){logger['info'](_0xa7d8('0xf'),_0x410b09,'request\x20sent');logger[_0xa7d8('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x410b09,_0xa7d8('0x11'),JSON[_0xa7d8('0x12')](_0x40f419));if(_0x40f419['error']){if(_0x40f419[_0xa7d8('0x13')]['code']===0x1f4){logger[_0xa7d8('0x13')](_0xa7d8('0xf'),_0x410b09,_0x40f419[_0xa7d8('0x13')]['message']);return _0x455082(_0x40f419[_0xa7d8('0x13')][_0xa7d8('0x14')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x410b09,_0x40f419['error'][_0xa7d8('0x14')]);return _0x1807cc(_0x40f419[_0xa7d8('0x13')][_0xa7d8('0x14')]);}else{logger[_0xa7d8('0x15')](_0xa7d8('0xf'),_0x410b09,_0xa7d8('0x11'));_0x1807cc(_0x40f419[_0xa7d8('0x16')][_0xa7d8('0x14')]);}})[_0xa7d8('0x17')](function(_0xfc0284){logger[_0xa7d8('0x13')](_0xa7d8('0xf'),_0x410b09,_0xfc0284);_0x455082(_0xfc0284);});});}exports[_0xa7d8('0x18')]=function(_0x50d6a6){var _0x34eac8=this;return new Promise(function(_0x3af212,_0x50dd47){return db[_0xa7d8('0x19')][_0xa7d8('0x1a')]({'raw':_0x50d6a6[_0xa7d8('0x1b')]?_0x50d6a6[_0xa7d8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x50d6a6[_0xa7d8('0x1b')]?_0x50d6a6['options'][_0xa7d8('0x1c')]||null:null,'attributes':_0x50d6a6[_0xa7d8('0x1b')]?_0x50d6a6['options'][_0xa7d8('0x1d')]||null:null,'limit':_0x50d6a6[_0xa7d8('0x1b')]?_0x50d6a6[_0xa7d8('0x1b')][_0xa7d8('0x1e')]||null:null,'include':_0x50d6a6[_0xa7d8('0x1b')]?_0x50d6a6['options'][_0xa7d8('0x1f')]?_[_0xa7d8('0x20')](_0x50d6a6['options'][_0xa7d8('0x1f')],function(_0x31afb8){return{'model':db[_0x31afb8['model']],'as':_0x31afb8['as'],'attributes':_0x31afb8[_0xa7d8('0x1d')],'include':_0x31afb8[_0xa7d8('0x1f')]?_[_0xa7d8('0x20')](_0x31afb8[_0xa7d8('0x1f')],function(_0x1f49f6){return{'model':db[_0x1f49f6[_0xa7d8('0x21')]],'as':_0x1f49f6['as'],'attributes':_0x1f49f6[_0xa7d8('0x1d')],'include':_0x1f49f6['include']?_[_0xa7d8('0x20')](_0x1f49f6['include'],function(_0x1dcb71){return{'model':db[_0x1dcb71['model']],'as':_0x1dcb71['as'],'attributes':_0x1dcb71['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x491fa0){logger[_0xa7d8('0x15')](_0xa7d8('0x18'),_0x50d6a6);logger['debug'](_0xa7d8('0x18'),_0x50d6a6,JSON[_0xa7d8('0x12')](_0x491fa0));_0x3af212(_0x491fa0);})[_0xa7d8('0x17')](function(_0x54676b){logger[_0xa7d8('0x13')](_0xa7d8('0x18'),_0x54676b[_0xa7d8('0x14')],_0x50d6a6);_0x50dd47(_0x34eac8['error'](0x1f4,_0x54676b[_0xa7d8('0x14')]));});});};exports[_0xa7d8('0x22')]=function(_0x541508){var _0x5f1b22=this;return new Promise(function(_0x1f56d2,_0x3d31fa){return db[_0xa7d8('0x19')]['find']({'raw':_0x541508['options']?_0x541508['options'][_0xa7d8('0x23')]===undefined?!![]:![]:!![],'where':_0x541508[_0xa7d8('0x1b')]?_0x541508['options'][_0xa7d8('0x1c')]||null:null,'attributes':_0x541508['options']?_0x541508[_0xa7d8('0x1b')]['attributes']||null:null,'include':_0x541508[_0xa7d8('0x1b')]?_0x541508[_0xa7d8('0x1b')][_0xa7d8('0x1f')]?_['map'](_0x541508[_0xa7d8('0x1b')][_0xa7d8('0x1f')],function(_0x3025b0){return{'model':db[_0x3025b0[_0xa7d8('0x21')]],'as':_0x3025b0['as'],'attributes':_0x3025b0[_0xa7d8('0x1d')],'include':_0x3025b0[_0xa7d8('0x1f')]?_[_0xa7d8('0x20')](_0x3025b0[_0xa7d8('0x1f')],function(_0xb3e677){return{'model':db[_0xb3e677[_0xa7d8('0x21')]],'as':_0xb3e677['as'],'attributes':_0xb3e677[_0xa7d8('0x1d')],'include':_0xb3e677['include']?_[_0xa7d8('0x20')](_0xb3e677[_0xa7d8('0x1f')],function(_0x2073bc){return{'model':db[_0x2073bc[_0xa7d8('0x21')]],'as':_0x2073bc['as'],'attributes':_0x2073bc[_0xa7d8('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x202be8){logger[_0xa7d8('0x15')](_0xa7d8('0x22'),_0x541508);logger[_0xa7d8('0x10')](_0xa7d8('0x22'),_0x541508,JSON[_0xa7d8('0x12')](_0x202be8));_0x1f56d2(_0x202be8);})[_0xa7d8('0x17')](function(_0x2e1357){logger[_0xa7d8('0x13')](_0xa7d8('0x22'),_0x2e1357[_0xa7d8('0x14')],_0x541508);_0x3d31fa(_0x5f1b22[_0xa7d8('0x13')](0x1f4,_0x2e1357['message']));});});}; \ No newline at end of file +var _0xdf5d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','options','raw','attributes','limit','include','model','map','debug','where','ShowZohoAccount','lodash','util'];(function(_0x537f6f,_0x10b756){var _0x212d3f=function(_0x22f172){while(--_0x22f172){_0x537f6f['push'](_0x537f6f['shift']());}};_0x212d3f(++_0x10b756);}(_0xdf5d,0x126));var _0xddf5=function(_0x11c3dd,_0x63b372){_0x11c3dd=_0x11c3dd-0x0;var _0x118cb2=_0xdf5d[_0x11c3dd];return _0x118cb2;};'use strict';var _=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var moment=require(_0xddf5('0x2'));var BPromise=require(_0xddf5('0x3'));var rs=require(_0xddf5('0x4'));var fs=require('fs');var Redis=require(_0xddf5('0x5'));var db=require(_0xddf5('0x6'))['db'];var utils=require(_0xddf5('0x7'));var logger=require('../../config/logger')(_0xddf5('0x8'));var config=require(_0xddf5('0x9'));var jayson=require(_0xddf5('0xa'));var client=jayson[_0xddf5('0xb')][_0xddf5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x228fd4,_0xf3a209,_0xa029d2){return new BPromise(function(_0x3a1e13,_0x3df89){return client[_0xddf5('0xd')](_0x228fd4,_0xa029d2)[_0xddf5('0xe')](function(_0x36b306){logger[_0xddf5('0xf')](_0xddf5('0x10'),_0xf3a209,_0xddf5('0x11'));logger['debug'](_0xddf5('0x12'),_0xf3a209,_0xddf5('0x11'),JSON[_0xddf5('0x13')](_0x36b306));if(_0x36b306[_0xddf5('0x14')]){if(_0x36b306[_0xddf5('0x14')][_0xddf5('0x15')]===0x1f4){logger[_0xddf5('0x14')](_0xddf5('0x10'),_0xf3a209,_0x36b306['error']['message']);return _0x3df89(_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);}logger[_0xddf5('0x14')](_0xddf5('0x10'),_0xf3a209,_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);return _0x3a1e13(_0x36b306[_0xddf5('0x14')][_0xddf5('0x16')]);}else{logger['info'](_0xddf5('0x10'),_0xf3a209,_0xddf5('0x11'));_0x3a1e13(_0x36b306[_0xddf5('0x17')][_0xddf5('0x16')]);}})[_0xddf5('0x18')](function(_0x5ef952){logger[_0xddf5('0x14')]('ZohoAccount,\x20%s,\x20%s',_0xf3a209,_0x5ef952);_0x3df89(_0x5ef952);});});}exports[_0xddf5('0x19')]=function(_0x50c1ed){var _0x4b4f9a=this;return new Promise(function(_0x3d61df,_0x44db09){return db[_0xddf5('0x1a')]['findAll']({'raw':_0x50c1ed['options']?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1c')]===undefined?!![]:![]:!![],'where':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed[_0xddf5('0x1b')]['where']||null:null,'attributes':_0x50c1ed['options']?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1d')]||null:null,'limit':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed['options'][_0xddf5('0x1e')]||null:null,'include':_0x50c1ed[_0xddf5('0x1b')]?_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1f')]?_['map'](_0x50c1ed[_0xddf5('0x1b')][_0xddf5('0x1f')],function(_0x496e16){return{'model':db[_0x496e16[_0xddf5('0x20')]],'as':_0x496e16['as'],'attributes':_0x496e16[_0xddf5('0x1d')],'include':_0x496e16[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0x496e16['include'],function(_0x497382){return{'model':db[_0x497382[_0xddf5('0x20')]],'as':_0x497382['as'],'attributes':_0x497382[_0xddf5('0x1d')],'include':_0x497382[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0x497382['include'],function(_0x2caa8f){return{'model':db[_0x2caa8f[_0xddf5('0x20')]],'as':_0x2caa8f['as'],'attributes':_0x2caa8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x984d22){logger[_0xddf5('0xf')](_0xddf5('0x19'),_0x50c1ed);logger[_0xddf5('0x22')](_0xddf5('0x19'),_0x50c1ed,JSON[_0xddf5('0x13')](_0x984d22));_0x3d61df(_0x984d22);})['catch'](function(_0x26f43c){logger[_0xddf5('0x14')]('GetZohoAccount',_0x26f43c[_0xddf5('0x16')],_0x50c1ed);_0x44db09(_0x4b4f9a[_0xddf5('0x14')](0x1f4,_0x26f43c[_0xddf5('0x16')]));});});};exports['ShowZohoAccount']=function(_0x4b352b){var _0x4d1632=this;return new Promise(function(_0xdc764b,_0x25e11e){return db[_0xddf5('0x1a')]['find']({'raw':_0x4b352b[_0xddf5('0x1b')]?_0x4b352b['options']['raw']===undefined?!![]:![]:!![],'where':_0x4b352b['options']?_0x4b352b[_0xddf5('0x1b')][_0xddf5('0x23')]||null:null,'attributes':_0x4b352b[_0xddf5('0x1b')]?_0x4b352b[_0xddf5('0x1b')][_0xddf5('0x1d')]||null:null,'include':_0x4b352b['options']?_0x4b352b[_0xddf5('0x1b')]['include']?_[_0xddf5('0x21')](_0x4b352b[_0xddf5('0x1b')]['include'],function(_0xf355f4){return{'model':db[_0xf355f4[_0xddf5('0x20')]],'as':_0xf355f4['as'],'attributes':_0xf355f4[_0xddf5('0x1d')],'include':_0xf355f4[_0xddf5('0x1f')]?_[_0xddf5('0x21')](_0xf355f4['include'],function(_0x873d16){return{'model':db[_0x873d16['model']],'as':_0x873d16['as'],'attributes':_0x873d16[_0xddf5('0x1d')],'include':_0x873d16[_0xddf5('0x1f')]?_['map'](_0x873d16[_0xddf5('0x1f')],function(_0x5bf8f2){return{'model':db[_0x5bf8f2[_0xddf5('0x20')]],'as':_0x5bf8f2['as'],'attributes':_0x5bf8f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b4cde){logger['info'](_0xddf5('0x24'),_0x4b352b);logger[_0xddf5('0x22')](_0xddf5('0x24'),_0x4b352b,JSON[_0xddf5('0x13')](_0x1b4cde));_0xdc764b(_0x1b4cde);})[_0xddf5('0x18')](function(_0x3ff650){logger[_0xddf5('0x14')](_0xddf5('0x24'),_0x3ff650[_0xddf5('0x16')],_0x4b352b);_0x25e11e(_0x4d1632[_0xddf5('0x14')](0x1f4,_0x3ff650[_0xddf5('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 4b048ce..0a5042d 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 _0xba45=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x1b97f3,_0xce63f3){var _0x32d818=function(_0x9671b7){while(--_0x9671b7){_0x1b97f3['push'](_0x1b97f3['shift']());}};_0x32d818(++_0xce63f3);}(_0xba45,0x1d6));var _0x5ba4=function(_0x535a31,_0x13ed3c){_0x535a31=_0x535a31-0x0;var _0x499f20=_0xba45[_0x535a31];return _0x499f20;};'use strict';var multer=require(_0x5ba4('0x0'));var util=require(_0x5ba4('0x1'));var path=require(_0x5ba4('0x2'));var timeout=require(_0x5ba4('0x3'));var express=require(_0x5ba4('0x4'));var router=express[_0x5ba4('0x5')]();var fs_extra=require(_0x5ba4('0x6'));var auth=require(_0x5ba4('0x7'));var interaction=require(_0x5ba4('0x8'));var config=require('../../config/environment');var controller=require(_0x5ba4('0x9'));router['get']('/',auth[_0x5ba4('0xa')](),controller[_0x5ba4('0xb')]);router[_0x5ba4('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x5ba4('0xd')]);router['get'](_0x5ba4('0xe'),auth['isAuthenticated'](),controller[_0x5ba4('0xf')]);router[_0x5ba4('0xc')]('/:id/subjects',auth[_0x5ba4('0xa')](),controller[_0x5ba4('0x10')]);router[_0x5ba4('0xc')](_0x5ba4('0x11'),auth[_0x5ba4('0xa')](),controller[_0x5ba4('0x12')]);router[_0x5ba4('0x13')]('/',auth['isAuthenticated'](),controller[_0x5ba4('0x14')]);router[_0x5ba4('0x15')](_0x5ba4('0x16'),auth[_0x5ba4('0xa')](),controller[_0x5ba4('0x17')]);router['delete'](_0x5ba4('0x16'),auth[_0x5ba4('0xa')](),controller[_0x5ba4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x85eb=['/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x5d0f03,_0x1bd340){var _0x2ed3f9=function(_0xa35707){while(--_0xa35707){_0x5d0f03['push'](_0x5d0f03['shift']());}};_0x2ed3f9(++_0x1bd340);}(_0x85eb,0xa7));var _0xb85e=function(_0x594f81,_0x3ca069){_0x594f81=_0x594f81-0x0;var _0x31ae51=_0x85eb[_0x594f81];return _0x31ae51;};'use strict';var multer=require(_0xb85e('0x0'));var util=require('util');var path=require(_0xb85e('0x1'));var timeout=require(_0xb85e('0x2'));var express=require('express');var router=express[_0xb85e('0x3')]();var fs_extra=require(_0xb85e('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb85e('0x5'));var controller=require(_0xb85e('0x6'));router[_0xb85e('0x7')]('/',auth[_0xb85e('0x8')](),controller[_0xb85e('0x9')]);router['get'](_0xb85e('0xa'),auth[_0xb85e('0x8')](),controller[_0xb85e('0xb')]);router[_0xb85e('0x7')]('/:id/fields',auth[_0xb85e('0x8')](),controller[_0xb85e('0xc')]);router[_0xb85e('0x7')](_0xb85e('0xd'),auth[_0xb85e('0x8')](),controller['getSubjects']);router[_0xb85e('0x7')](_0xb85e('0xe'),auth['isAuthenticated'](),controller[_0xb85e('0xf')]);router['post']('/',auth[_0xb85e('0x8')](),controller[_0xb85e('0x10')]);router[_0xb85e('0x11')](_0xb85e('0xa'),auth[_0xb85e('0x8')](),controller[_0xb85e('0x12')]);router[_0xb85e('0x13')](_0xb85e('0xa'),auth[_0xb85e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index ec34df6..f044180 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 _0x7331=['lead','contact_lead','STRING','ENUM','contact'];(function(_0x11c951,_0x57e8ea){var _0x3c239a=function(_0x21edcd){while(--_0x21edcd){_0x11c951['push'](_0x11c951['shift']());}};_0x3c239a(++_0x57e8ea);}(_0x7331,0xe3));var _0x1733=function(_0x308084,_0x356417){_0x308084=_0x308084-0x0;var _0x4424f1=_0x7331[_0x308084];return _0x4424f1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1733('0x0')]},'moduleCreate':{'type':Sequelize[_0x1733('0x1')]('lead',_0x1733('0x2'),'nothing'),'defaultValue':_0x1733('0x3')},'moduleSearch':{'type':Sequelize[_0x1733('0x1')](_0x1733('0x4'),_0x1733('0x2'),_0x1733('0x3')),'defaultValue':_0x1733('0x4')},'description':{'type':Sequelize[_0x1733('0x0')]}}; \ No newline at end of file +var _0x677f=['contact_lead','contact','sequelize','exports','STRING','ENUM','lead','nothing'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x677f,0x8a));var _0xf677=function(_0xc9cf6f,_0x25d56c){_0xc9cf6f=_0xc9cf6f-0x0;var _0x5dcfad=_0x677f[_0xc9cf6f];return _0x5dcfad;};'use strict';var Sequelize=require(_0xf677('0x0'));module[_0xf677('0x1')]={'name':{'type':Sequelize[_0xf677('0x2')]},'moduleCreate':{'type':Sequelize[_0xf677('0x3')](_0xf677('0x4'),'contact',_0xf677('0x5')),'defaultValue':_0xf677('0x4')},'moduleSearch':{'type':Sequelize[_0xf677('0x3')](_0xf677('0x6'),_0xf677('0x7'),'lead'),'defaultValue':_0xf677('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 2be6d4c..c75a236 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 _0x2332=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','show','params','keys','find','create','body','catch','ZohoField','getFields','getSubjects','findOne','getDescriptions','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','filters','model','query','intersection','fields'];(function(_0x5ae691,_0x22413d){var _0x31a46a=function(_0x4cca8f){while(--_0x4cca8f){_0x5ae691['push'](_0x5ae691['shift']());}};_0x31a46a(++_0x22413d);}(_0x2332,0x6b));var _0x2233=function(_0xf34a21,_0x10b1d7){_0xf34a21=_0xf34a21-0x0;var _0x5439ac=_0x2332[_0xf34a21];return _0x5439ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2233('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2233('0x1'));var rp=require('request-promise');var moment=require(_0x2233('0x2'));var BPromise=require(_0x2233('0x3'));var Mustache=require(_0x2233('0x4'));var util=require('util');var path=require(_0x2233('0x5'));var sox=require(_0x2233('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2233('0x7'));var _=require(_0x2233('0x8'));var squel=require(_0x2233('0x9'));var crypto=require(_0x2233('0xa'));var jsforce=require(_0x2233('0xb'));var deskjs=require(_0x2233('0xc'));var toCsv=require(_0x2233('0xd'));var querystring=require('querystring');var Papa=require(_0x2233('0xe'));var Redis=require(_0x2233('0xf'));var authService=require(_0x2233('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2233('0x11'));var logger=require('../../config/logger')(_0x2233('0x12'));var utils=require(_0x2233('0x13'));var config=require(_0x2233('0x14'));var licenseUtil=require(_0x2233('0x15'));var db=require(_0x2233('0x16'))['db'];function respondWithStatusCode(_0x5421be,_0x2ac4ac){_0x2ac4ac=_0x2ac4ac||0xcc;return function(_0x55e816){if(_0x55e816){return _0x5421be[_0x2233('0x17')](_0x2ac4ac);}return _0x5421be[_0x2233('0x18')](_0x2ac4ac)[_0x2233('0x19')]();};}function respondWithResult(_0x5d755e,_0x357f59){_0x357f59=_0x357f59||0xc8;return function(_0x268a3d){if(_0x268a3d){return _0x5d755e[_0x2233('0x18')](_0x357f59)[_0x2233('0x1a')](_0x268a3d);}};}function respondWithFilteredResult(_0x163863,_0x5953e5){return function(_0x552345){if(_0x552345){var _0x4e5022=typeof _0x5953e5[_0x2233('0x1b')]===_0x2233('0x1c')&&typeof _0x5953e5[_0x2233('0x1d')]===_0x2233('0x1c');var _0x29806c=_0x552345['count'];var _0x3eb956=_0x4e5022?0x0:_0x5953e5['offset'];var _0x186d44=_0x4e5022?_0x552345['count']:_0x5953e5['offset']+_0x5953e5[_0x2233('0x1d')];var _0x205bb4;if(_0x186d44>=_0x29806c){_0x186d44=_0x29806c;_0x205bb4=0xc8;}else{_0x205bb4=0xce;}_0x163863[_0x2233('0x18')](_0x205bb4);return _0x163863[_0x2233('0x1e')](_0x2233('0x1f'),_0x3eb956+'-'+_0x186d44+'/'+_0x29806c)['json'](_0x552345);}return null;};}function patchUpdates(_0x4e3323){return function(_0x2e5e28){try{jsonpatch[_0x2233('0x20')](_0x2e5e28,_0x4e3323,!![]);}catch(_0x475fab){return BPromise[_0x2233('0x21')](_0x475fab);}return _0x2e5e28[_0x2233('0x22')]();};}function saveUpdates(_0x4d9a4d,_0x581a13){return function(_0x434d76){if(_0x434d76){return _0x434d76['update'](_0x4d9a4d)[_0x2233('0x23')](function(_0x2716a3){return _0x2716a3;});}return null;};}function removeEntity(_0x4e8254,_0x28cdaa){return function(_0x462710){if(_0x462710){return _0x462710[_0x2233('0x24')]()[_0x2233('0x23')](function(){_0x4e8254['status'](0xcc)[_0x2233('0x19')]();});}};}function handleEntityNotFound(_0x4208b6,_0x22d84c){return function(_0x274fe4){if(!_0x274fe4){_0x4208b6[_0x2233('0x17')](0x194);}return _0x274fe4;};}function handleError(_0x2ce5b3,_0x256891){_0x256891=_0x256891||0x1f4;return function(_0x3dd504){logger[_0x2233('0x25')](_0x3dd504[_0x2233('0x26')]);if(_0x3dd504[_0x2233('0x27')]){delete _0x3dd504[_0x2233('0x27')];}_0x2ce5b3['status'](_0x256891)[_0x2233('0x28')](_0x3dd504);};}exports[_0x2233('0x29')]=function(_0x4cc428,_0x14e00a){var _0xd5c9d6={},_0x345e67={},_0x270307={'count':0x0,'rows':[]};var _0x2c73b7=_[_0x2233('0x2a')](db[_0x2233('0x2b')][_0x2233('0x2c')],function(_0x123e42){return{'name':_0x123e42[_0x2233('0x2d')],'type':_0x123e42[_0x2233('0x2e')][_0x2233('0x2f')]};});_0x345e67['model']=_['map'](_0x2c73b7,_0x2233('0x27'));_0x345e67['query']=_['keys'](_0x4cc428['query']);_0x345e67[_0x2233('0x30')]=_['intersection'](_0x345e67[_0x2233('0x31')],_0x345e67[_0x2233('0x32')]);_0xd5c9d6['attributes']=_[_0x2233('0x33')](_0x345e67[_0x2233('0x31')],qs[_0x2233('0x34')](_0x4cc428[_0x2233('0x32')][_0x2233('0x34')]));_0xd5c9d6[_0x2233('0x35')]=_0xd5c9d6['attributes'][_0x2233('0x36')]?_0xd5c9d6[_0x2233('0x35')]:_0x345e67[_0x2233('0x31')];if(!_0x4cc428[_0x2233('0x32')][_0x2233('0x37')](_0x2233('0x38'))){_0xd5c9d6[_0x2233('0x1d')]=qs[_0x2233('0x1d')](_0x4cc428['query'][_0x2233('0x1d')]);_0xd5c9d6[_0x2233('0x1b')]=qs[_0x2233('0x1b')](_0x4cc428[_0x2233('0x32')][_0x2233('0x1b')]);}_0xd5c9d6[_0x2233('0x39')]=qs[_0x2233('0x3a')](_0x4cc428['query'][_0x2233('0x3a')]);_0xd5c9d6[_0x2233('0x3b')]=qs['filters'](_[_0x2233('0x3c')](_0x4cc428[_0x2233('0x32')],_0x345e67[_0x2233('0x30')]),_0x2c73b7);if(_0x4cc428['query'][_0x2233('0x3d')]){_0xd5c9d6[_0x2233('0x3b')]=_[_0x2233('0x3e')](_0xd5c9d6[_0x2233('0x3b')],{'$or':_[_0x2233('0x2a')](_0x2c73b7,function(_0x59d790){if(_0x59d790[_0x2233('0x2e')]!=='VIRTUAL'){var _0x42533e={};_0x42533e[_0x59d790[_0x2233('0x27')]]={'$like':'%'+_0x4cc428[_0x2233('0x32')]['filter']+'%'};return _0x42533e;}})});}_0xd5c9d6=_[_0x2233('0x3e')]({},_0xd5c9d6,_0x4cc428[_0x2233('0x3f')]);var _0x2523d6={'where':_0xd5c9d6[_0x2233('0x3b')]};return db[_0x2233('0x2b')][_0x2233('0x40')](_0x2523d6)[_0x2233('0x23')](function(_0xe86827){_0x270307['count']=_0xe86827;if(_0x4cc428['query'][_0x2233('0x41')]){_0xd5c9d6[_0x2233('0x42')]=[{'all':!![]}];}return db[_0x2233('0x2b')][_0x2233('0x43')](_0xd5c9d6);})['then'](function(_0x38eef9){_0x270307['rows']=_0x38eef9;return _0x270307;})[_0x2233('0x23')](respondWithFilteredResult(_0x14e00a,_0xd5c9d6))['catch'](handleError(_0x14e00a,null));};exports[_0x2233('0x44')]=function(_0x33a852,_0x139b32){var _0xb8e4f1={'raw':![],'where':{'id':_0x33a852[_0x2233('0x45')]['id']}},_0x4dacd6={};_0x4dacd6['model']=_[_0x2233('0x46')](db[_0x2233('0x2b')][_0x2233('0x2c')]);_0x4dacd6['query']=_[_0x2233('0x46')](_0x33a852[_0x2233('0x32')]);_0x4dacd6[_0x2233('0x30')]=_['intersection'](_0x4dacd6[_0x2233('0x31')],_0x4dacd6[_0x2233('0x32')]);_0xb8e4f1['attributes']=_['intersection'](_0x4dacd6[_0x2233('0x31')],qs[_0x2233('0x34')](_0x33a852[_0x2233('0x32')]['fields']));_0xb8e4f1[_0x2233('0x35')]=_0xb8e4f1[_0x2233('0x35')][_0x2233('0x36')]?_0xb8e4f1[_0x2233('0x35')]:_0x4dacd6[_0x2233('0x31')];if(_0x33a852[_0x2233('0x32')][_0x2233('0x41')]){_0xb8e4f1['include']=[{'all':!![]}];}_0xb8e4f1=_[_0x2233('0x3e')]({},_0xb8e4f1,_0x33a852[_0x2233('0x3f')]);return db[_0x2233('0x2b')][_0x2233('0x47')](_0xb8e4f1)[_0x2233('0x23')](handleEntityNotFound(_0x139b32,null))[_0x2233('0x23')](respondWithResult(_0x139b32,null))['catch'](handleError(_0x139b32,null));};exports[_0x2233('0x48')]=function(_0x360f57,_0x161ae0){return db[_0x2233('0x2b')][_0x2233('0x48')](_0x360f57[_0x2233('0x49')],{})['then'](respondWithResult(_0x161ae0,0xc9))[_0x2233('0x4a')](handleError(_0x161ae0,null));};exports['update']=function(_0x4cdeab,_0x12e584){if(_0x4cdeab[_0x2233('0x49')]['id']){delete _0x4cdeab[_0x2233('0x49')]['id'];}return db['ZohoConfiguration'][_0x2233('0x47')]({'where':{'id':_0x4cdeab[_0x2233('0x45')]['id']}})['then'](handleEntityNotFound(_0x12e584,null))[_0x2233('0x23')](saveUpdates(_0x4cdeab[_0x2233('0x49')],null))['then'](respondWithResult(_0x12e584,null))['catch'](handleError(_0x12e584,null));};exports['destroy']=function(_0x308042,_0x409ae4){return db['ZohoConfiguration'][_0x2233('0x47')]({'where':{'id':_0x308042[_0x2233('0x45')]['id']}})[_0x2233('0x23')](handleEntityNotFound(_0x409ae4,null))['then'](removeEntity(_0x409ae4,null))[_0x2233('0x4a')](handleError(_0x409ae4,null));};exports['getFields']=function(_0x225528,_0x59a3a4,_0x3fb172){var _0x2be91e={};var _0x4c035b={};var _0x58c3d5;var _0x5f4326;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x225528[_0x2233('0x45')]['id']}})[_0x2233('0x23')](handleEntityNotFound(_0x59a3a4,null))[_0x2233('0x23')](function(_0x1ee299){if(_0x1ee299){_0x58c3d5=_0x1ee299;_0x4c035b[_0x2233('0x31')]=_['keys'](db[_0x2233('0x4b')][_0x2233('0x2c')]);_0x4c035b['query']=_['keys'](_0x225528['query']);_0x4c035b['filters']=_['intersection'](_0x4c035b[_0x2233('0x31')],_0x4c035b[_0x2233('0x32')]);_0x2be91e[_0x2233('0x35')]=_[_0x2233('0x33')](_0x4c035b[_0x2233('0x31')],qs[_0x2233('0x34')](_0x225528['query'][_0x2233('0x34')]));_0x2be91e[_0x2233('0x35')]=_0x2be91e[_0x2233('0x35')][_0x2233('0x36')]?_0x2be91e['attributes']:_0x4c035b[_0x2233('0x31')];_0x2be91e['order']=qs[_0x2233('0x3a')](_0x225528[_0x2233('0x32')][_0x2233('0x3a')]);_0x2be91e[_0x2233('0x3b')]=qs[_0x2233('0x30')](_[_0x2233('0x3c')](_0x225528[_0x2233('0x32')],_0x4c035b[_0x2233('0x30')]));if(_0x225528['query']['filter']){_0x2be91e['where']=_[_0x2233('0x3e')](_0x2be91e[_0x2233('0x3b')],{'$or':_[_0x2233('0x2a')](_0x2be91e[_0x2233('0x35')],function(_0x5609e5){var _0x2cc04b={};_0x2cc04b[_0x5609e5]={'$like':'%'+_0x225528[_0x2233('0x32')][_0x2233('0x3d')]+'%'};return _0x2cc04b;})});}_0x2be91e=_[_0x2233('0x3e')]({},_0x2be91e,_0x225528['options']);return _0x58c3d5[_0x2233('0x4c')](_0x2be91e);}})[_0x2233('0x23')](function(_0x1ad8f6){if(_0x1ad8f6){_0x5f4326=_0x1ad8f6['length'];if(!_0x225528[_0x2233('0x32')]['hasOwnProperty']('nolimit')){_0x2be91e[_0x2233('0x1d')]=qs['limit'](_0x225528['query'][_0x2233('0x1d')]);_0x2be91e['offset']=qs[_0x2233('0x1b')](_0x225528[_0x2233('0x32')]['offset']);}return _0x58c3d5[_0x2233('0x4c')](_0x2be91e);}})[_0x2233('0x23')](function(_0x2e5307){if(_0x2e5307){return _0x2e5307?{'count':_0x5f4326,'rows':_0x2e5307}:null;}})[_0x2233('0x23')](respondWithResult(_0x59a3a4,null))[_0x2233('0x4a')](handleError(_0x59a3a4,null));};exports[_0x2233('0x4d')]=function(_0x364c85,_0x281899,_0x31216e){var _0x28d277={};var _0x2e748f={};var _0x4f9701;var _0x4adc43;return db['ZohoConfiguration'][_0x2233('0x4e')]({'where':{'id':_0x364c85[_0x2233('0x45')]['id']}})[_0x2233('0x23')](handleEntityNotFound(_0x281899,null))[_0x2233('0x23')](function(_0x464718){if(_0x464718){_0x4f9701=_0x464718;_0x2e748f['model']=_[_0x2233('0x46')](db[_0x2233('0x4b')][_0x2233('0x2c')]);_0x2e748f[_0x2233('0x32')]=_[_0x2233('0x46')](_0x364c85[_0x2233('0x32')]);_0x2e748f[_0x2233('0x30')]=_[_0x2233('0x33')](_0x2e748f[_0x2233('0x31')],_0x2e748f[_0x2233('0x32')]);_0x28d277[_0x2233('0x35')]=_['intersection'](_0x2e748f[_0x2233('0x31')],qs[_0x2233('0x34')](_0x364c85['query'][_0x2233('0x34')]));_0x28d277[_0x2233('0x35')]=_0x28d277['attributes']['length']?_0x28d277[_0x2233('0x35')]:_0x2e748f[_0x2233('0x31')];_0x28d277[_0x2233('0x39')]=qs['sort'](_0x364c85[_0x2233('0x32')]['sort']);_0x28d277[_0x2233('0x3b')]=qs[_0x2233('0x30')](_[_0x2233('0x3c')](_0x364c85[_0x2233('0x32')],_0x2e748f[_0x2233('0x30')]));if(_0x364c85[_0x2233('0x32')][_0x2233('0x3d')]){_0x28d277['where']=_[_0x2233('0x3e')](_0x28d277[_0x2233('0x3b')],{'$or':_['map'](_0x28d277[_0x2233('0x35')],function(_0xadaf1){var _0x26c08b={};_0x26c08b[_0xadaf1]={'$like':'%'+_0x364c85['query'][_0x2233('0x3d')]+'%'};return _0x26c08b;})});}_0x28d277=_[_0x2233('0x3e')]({},_0x28d277,_0x364c85[_0x2233('0x3f')]);return _0x4f9701[_0x2233('0x4d')](_0x28d277);}})['then'](function(_0x3e0cc4){if(_0x3e0cc4){_0x4adc43=_0x3e0cc4['length'];if(!_0x364c85[_0x2233('0x32')][_0x2233('0x37')]('nolimit')){_0x28d277[_0x2233('0x1d')]=qs['limit'](_0x364c85[_0x2233('0x32')][_0x2233('0x1d')]);_0x28d277[_0x2233('0x1b')]=qs[_0x2233('0x1b')](_0x364c85[_0x2233('0x32')]['offset']);}return _0x4f9701[_0x2233('0x4d')](_0x28d277);}})[_0x2233('0x23')](function(_0x46bf0e){if(_0x46bf0e){return _0x46bf0e?{'count':_0x4adc43,'rows':_0x46bf0e}:null;}})['then'](respondWithResult(_0x281899,null))[_0x2233('0x4a')](handleError(_0x281899,null));};exports[_0x2233('0x4f')]=function(_0x5c3588,_0x1bab91,_0x307a52){var _0x44c87c={};var _0x1c5287={};var _0x4a861d;var _0x3a9e13;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5c3588[_0x2233('0x45')]['id']}})['then'](handleEntityNotFound(_0x1bab91,null))[_0x2233('0x23')](function(_0x1009f6){if(_0x1009f6){_0x4a861d=_0x1009f6;_0x1c5287[_0x2233('0x31')]=_[_0x2233('0x46')](db[_0x2233('0x4b')]['rawAttributes']);_0x1c5287['query']=_[_0x2233('0x46')](_0x5c3588['query']);_0x1c5287[_0x2233('0x30')]=_[_0x2233('0x33')](_0x1c5287['model'],_0x1c5287[_0x2233('0x32')]);_0x44c87c[_0x2233('0x35')]=_[_0x2233('0x33')](_0x1c5287[_0x2233('0x31')],qs[_0x2233('0x34')](_0x5c3588[_0x2233('0x32')]['fields']));_0x44c87c[_0x2233('0x35')]=_0x44c87c[_0x2233('0x35')][_0x2233('0x36')]?_0x44c87c['attributes']:_0x1c5287[_0x2233('0x31')];_0x44c87c[_0x2233('0x39')]=qs[_0x2233('0x3a')](_0x5c3588[_0x2233('0x32')]['sort']);_0x44c87c[_0x2233('0x3b')]=qs['filters'](_[_0x2233('0x3c')](_0x5c3588[_0x2233('0x32')],_0x1c5287[_0x2233('0x30')]));if(_0x5c3588[_0x2233('0x32')][_0x2233('0x3d')]){_0x44c87c[_0x2233('0x3b')]=_['merge'](_0x44c87c[_0x2233('0x3b')],{'$or':_[_0x2233('0x2a')](_0x44c87c[_0x2233('0x35')],function(_0x5a69b4){var _0x33bf01={};_0x33bf01[_0x5a69b4]={'$like':'%'+_0x5c3588['query'][_0x2233('0x3d')]+'%'};return _0x33bf01;})});}_0x44c87c=_[_0x2233('0x3e')]({},_0x44c87c,_0x5c3588[_0x2233('0x3f')]);return _0x4a861d[_0x2233('0x4f')](_0x44c87c);}})[_0x2233('0x23')](function(_0x1863a6){if(_0x1863a6){_0x3a9e13=_0x1863a6[_0x2233('0x36')];if(!_0x5c3588[_0x2233('0x32')][_0x2233('0x37')](_0x2233('0x38'))){_0x44c87c[_0x2233('0x1d')]=qs[_0x2233('0x1d')](_0x5c3588[_0x2233('0x32')][_0x2233('0x1d')]);_0x44c87c[_0x2233('0x1b')]=qs[_0x2233('0x1b')](_0x5c3588[_0x2233('0x32')]['offset']);}return _0x4a861d[_0x2233('0x4f')](_0x44c87c);}})[_0x2233('0x23')](function(_0x2e2bc0){if(_0x2e2bc0){return _0x2e2bc0?{'count':_0x3a9e13,'rows':_0x2e2bc0}:null;}})['then'](respondWithResult(_0x1bab91,null))[_0x2233('0x4a')](handleError(_0x1bab91,null));}; \ No newline at end of file +var _0x76e1=['getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','ZohoConfiguration','key','model','keys','query','filters','attributes','intersection','length','nolimit','order','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','destroy','getFields','findOne','sort','hasOwnProperty','getSubjects'];(function(_0x2f3b22,_0x3210a2){var _0x5de4ad=function(_0x5c1d3d){while(--_0x5c1d3d){_0x2f3b22['push'](_0x2f3b22['shift']());}};_0x5de4ad(++_0x3210a2);}(_0x76e1,0x1e7));var _0x176e=function(_0x518091,_0x12d42d){_0x518091=_0x518091-0x0;var _0x2b122=_0x76e1[_0x518091];return _0x2b122;};'use strict';var emlformat=require(_0x176e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x176e('0x1'));var jsonpatch=require(_0x176e('0x2'));var rp=require(_0x176e('0x3'));var moment=require(_0x176e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x176e('0x5'));var path=require(_0x176e('0x6'));var sox=require(_0x176e('0x7'));var csv=require(_0x176e('0x8'));var ejs=require(_0x176e('0x9'));var fs=require('fs');var fs_extra=require(_0x176e('0xa'));var _=require('lodash');var squel=require(_0x176e('0xb'));var crypto=require(_0x176e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x176e('0x8'));var querystring=require(_0x176e('0xd'));var Papa=require(_0x176e('0xe'));var Redis=require('ioredis');var authService=require(_0x176e('0xf'));var qs=require(_0x176e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x176e('0x11'));var logger=require(_0x176e('0x12'))(_0x176e('0x13'));var utils=require(_0x176e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x176e('0x15'));var db=require(_0x176e('0x16'))['db'];function respondWithStatusCode(_0x461187,_0x1c503f){_0x1c503f=_0x1c503f||0xcc;return function(_0x38f749){if(_0x38f749){return _0x461187[_0x176e('0x17')](_0x1c503f);}return _0x461187[_0x176e('0x18')](_0x1c503f)['end']();};}function respondWithResult(_0x3778bc,_0xebf751){_0xebf751=_0xebf751||0xc8;return function(_0x3bf2c2){if(_0x3bf2c2){return _0x3778bc[_0x176e('0x18')](_0xebf751)[_0x176e('0x19')](_0x3bf2c2);}};}function respondWithFilteredResult(_0x50fb4e,_0x21b5df){return function(_0x3fd98c){if(_0x3fd98c){var _0x26acc8=typeof _0x21b5df[_0x176e('0x1a')]===_0x176e('0x1b')&&typeof _0x21b5df[_0x176e('0x1c')]===_0x176e('0x1b');var _0x242eca=_0x3fd98c[_0x176e('0x1d')];var _0x1af956=_0x26acc8?0x0:_0x21b5df[_0x176e('0x1a')];var _0x13d1a4=_0x26acc8?_0x3fd98c['count']:_0x21b5df['offset']+_0x21b5df[_0x176e('0x1c')];var _0x2a714b;if(_0x13d1a4>=_0x242eca){_0x13d1a4=_0x242eca;_0x2a714b=0xc8;}else{_0x2a714b=0xce;}_0x50fb4e['status'](_0x2a714b);return _0x50fb4e[_0x176e('0x1e')](_0x176e('0x1f'),_0x1af956+'-'+_0x13d1a4+'/'+_0x242eca)[_0x176e('0x19')](_0x3fd98c);}return null;};}function patchUpdates(_0x3142d2){return function(_0x4703a6){try{jsonpatch[_0x176e('0x20')](_0x4703a6,_0x3142d2,!![]);}catch(_0x2e53c7){return BPromise[_0x176e('0x21')](_0x2e53c7);}return _0x4703a6[_0x176e('0x22')]();};}function saveUpdates(_0x4ff2a8,_0x9c47d6){return function(_0x31cf24){if(_0x31cf24){return _0x31cf24[_0x176e('0x23')](_0x4ff2a8)[_0x176e('0x24')](function(_0x70e02e){return _0x70e02e;});}return null;};}function removeEntity(_0x226b29,_0x1092b4){return function(_0x29afb8){if(_0x29afb8){return _0x29afb8['destroy']()['then'](function(){_0x226b29[_0x176e('0x18')](0xcc)[_0x176e('0x25')]();});}};}function handleEntityNotFound(_0x212aee,_0x107b47){return function(_0x4c2d01){if(!_0x4c2d01){_0x212aee[_0x176e('0x17')](0x194);}return _0x4c2d01;};}function handleError(_0x34d2ea,_0xd5f14e){_0xd5f14e=_0xd5f14e||0x1f4;return function(_0x11df77){logger[_0x176e('0x26')](_0x11df77[_0x176e('0x27')]);if(_0x11df77[_0x176e('0x28')]){delete _0x11df77[_0x176e('0x28')];}_0x34d2ea[_0x176e('0x18')](_0xd5f14e)[_0x176e('0x29')](_0x11df77);};}exports[_0x176e('0x2a')]=function(_0x366a4e,_0x42a2c3){var _0x58e66f={},_0x229f42={},_0xb0ca7d={'count':0x0,'rows':[]};var _0x413d09=_['map'](db[_0x176e('0x2b')]['rawAttributes'],function(_0x2b1e53){return{'name':_0x2b1e53['fieldName'],'type':_0x2b1e53['type'][_0x176e('0x2c')]};});_0x229f42[_0x176e('0x2d')]=_['map'](_0x413d09,_0x176e('0x28'));_0x229f42['query']=_[_0x176e('0x2e')](_0x366a4e[_0x176e('0x2f')]);_0x229f42[_0x176e('0x30')]=_['intersection'](_0x229f42[_0x176e('0x2d')],_0x229f42['query']);_0x58e66f[_0x176e('0x31')]=_[_0x176e('0x32')](_0x229f42[_0x176e('0x2d')],qs['fields'](_0x366a4e[_0x176e('0x2f')]['fields']));_0x58e66f[_0x176e('0x31')]=_0x58e66f[_0x176e('0x31')][_0x176e('0x33')]?_0x58e66f['attributes']:_0x229f42[_0x176e('0x2d')];if(!_0x366a4e[_0x176e('0x2f')]['hasOwnProperty'](_0x176e('0x34'))){_0x58e66f[_0x176e('0x1c')]=qs[_0x176e('0x1c')](_0x366a4e['query'][_0x176e('0x1c')]);_0x58e66f[_0x176e('0x1a')]=qs['offset'](_0x366a4e['query'][_0x176e('0x1a')]);}_0x58e66f[_0x176e('0x35')]=qs['sort'](_0x366a4e[_0x176e('0x2f')]['sort']);_0x58e66f[_0x176e('0x36')]=qs[_0x176e('0x30')](_[_0x176e('0x37')](_0x366a4e[_0x176e('0x2f')],_0x229f42[_0x176e('0x30')]),_0x413d09);if(_0x366a4e['query'][_0x176e('0x38')]){_0x58e66f[_0x176e('0x36')]=_[_0x176e('0x39')](_0x58e66f['where'],{'$or':_[_0x176e('0x3a')](_0x413d09,function(_0x49e1be){if(_0x49e1be[_0x176e('0x3b')]!==_0x176e('0x3c')){var _0x24df76={};_0x24df76[_0x49e1be['name']]={'$like':'%'+_0x366a4e['query'][_0x176e('0x38')]+'%'};return _0x24df76;}})});}_0x58e66f=_[_0x176e('0x39')]({},_0x58e66f,_0x366a4e[_0x176e('0x3d')]);var _0x457b96={'where':_0x58e66f['where']};return db[_0x176e('0x2b')][_0x176e('0x1d')](_0x457b96)[_0x176e('0x24')](function(_0x36e128){_0xb0ca7d['count']=_0x36e128;if(_0x366a4e[_0x176e('0x2f')][_0x176e('0x3e')]){_0x58e66f[_0x176e('0x3f')]=[{'all':!![]}];}return db[_0x176e('0x2b')][_0x176e('0x40')](_0x58e66f);})[_0x176e('0x24')](function(_0x190504){_0xb0ca7d[_0x176e('0x41')]=_0x190504;return _0xb0ca7d;})[_0x176e('0x24')](respondWithFilteredResult(_0x42a2c3,_0x58e66f))[_0x176e('0x42')](handleError(_0x42a2c3,null));};exports[_0x176e('0x43')]=function(_0x44d3fb,_0xdf6dfe){var _0x3cef97={'raw':![],'where':{'id':_0x44d3fb[_0x176e('0x44')]['id']}},_0x2e5c75={};_0x2e5c75[_0x176e('0x2d')]=_[_0x176e('0x2e')](db[_0x176e('0x2b')][_0x176e('0x45')]);_0x2e5c75[_0x176e('0x2f')]=_[_0x176e('0x2e')](_0x44d3fb['query']);_0x2e5c75[_0x176e('0x30')]=_[_0x176e('0x32')](_0x2e5c75[_0x176e('0x2d')],_0x2e5c75['query']);_0x3cef97[_0x176e('0x31')]=_[_0x176e('0x32')](_0x2e5c75[_0x176e('0x2d')],qs[_0x176e('0x46')](_0x44d3fb[_0x176e('0x2f')][_0x176e('0x46')]));_0x3cef97['attributes']=_0x3cef97[_0x176e('0x31')]['length']?_0x3cef97[_0x176e('0x31')]:_0x2e5c75[_0x176e('0x2d')];if(_0x44d3fb['query'][_0x176e('0x3e')]){_0x3cef97[_0x176e('0x3f')]=[{'all':!![]}];}_0x3cef97=_[_0x176e('0x39')]({},_0x3cef97,_0x44d3fb['options']);return db[_0x176e('0x2b')][_0x176e('0x47')](_0x3cef97)[_0x176e('0x24')](handleEntityNotFound(_0xdf6dfe,null))[_0x176e('0x24')](respondWithResult(_0xdf6dfe,null))['catch'](handleError(_0xdf6dfe,null));};exports['create']=function(_0x72e597,_0x52b5a8){return db[_0x176e('0x2b')][_0x176e('0x48')](_0x72e597[_0x176e('0x49')],{})[_0x176e('0x24')](respondWithResult(_0x52b5a8,0xc9))[_0x176e('0x42')](handleError(_0x52b5a8,null));};exports['update']=function(_0x22af2c,_0x37afcd){if(_0x22af2c[_0x176e('0x49')]['id']){delete _0x22af2c[_0x176e('0x49')]['id'];}return db['ZohoConfiguration'][_0x176e('0x47')]({'where':{'id':_0x22af2c[_0x176e('0x44')]['id']}})[_0x176e('0x24')](handleEntityNotFound(_0x37afcd,null))[_0x176e('0x24')](saveUpdates(_0x22af2c[_0x176e('0x49')],null))[_0x176e('0x24')](respondWithResult(_0x37afcd,null))['catch'](handleError(_0x37afcd,null));};exports[_0x176e('0x4a')]=function(_0x30abaf,_0x48fc4f){return db[_0x176e('0x2b')][_0x176e('0x47')]({'where':{'id':_0x30abaf[_0x176e('0x44')]['id']}})[_0x176e('0x24')](handleEntityNotFound(_0x48fc4f,null))[_0x176e('0x24')](removeEntity(_0x48fc4f,null))['catch'](handleError(_0x48fc4f,null));};exports[_0x176e('0x4b')]=function(_0x362c82,_0x310eba,_0x180cac){var _0x21f855={};var _0x5e8ea4={};var _0x170474;var _0x1c3121;return db[_0x176e('0x2b')][_0x176e('0x4c')]({'where':{'id':_0x362c82['params']['id']}})[_0x176e('0x24')](handleEntityNotFound(_0x310eba,null))[_0x176e('0x24')](function(_0x1f0704){if(_0x1f0704){_0x170474=_0x1f0704;_0x5e8ea4['model']=_[_0x176e('0x2e')](db['ZohoField'][_0x176e('0x45')]);_0x5e8ea4[_0x176e('0x2f')]=_[_0x176e('0x2e')](_0x362c82[_0x176e('0x2f')]);_0x5e8ea4['filters']=_[_0x176e('0x32')](_0x5e8ea4[_0x176e('0x2d')],_0x5e8ea4['query']);_0x21f855[_0x176e('0x31')]=_[_0x176e('0x32')](_0x5e8ea4[_0x176e('0x2d')],qs[_0x176e('0x46')](_0x362c82[_0x176e('0x2f')][_0x176e('0x46')]));_0x21f855['attributes']=_0x21f855[_0x176e('0x31')]['length']?_0x21f855[_0x176e('0x31')]:_0x5e8ea4[_0x176e('0x2d')];_0x21f855[_0x176e('0x35')]=qs[_0x176e('0x4d')](_0x362c82[_0x176e('0x2f')]['sort']);_0x21f855[_0x176e('0x36')]=qs[_0x176e('0x30')](_['pick'](_0x362c82[_0x176e('0x2f')],_0x5e8ea4[_0x176e('0x30')]));if(_0x362c82[_0x176e('0x2f')][_0x176e('0x38')]){_0x21f855[_0x176e('0x36')]=_[_0x176e('0x39')](_0x21f855[_0x176e('0x36')],{'$or':_[_0x176e('0x3a')](_0x21f855[_0x176e('0x31')],function(_0x43f636){var _0x40db2e={};_0x40db2e[_0x43f636]={'$like':'%'+_0x362c82[_0x176e('0x2f')][_0x176e('0x38')]+'%'};return _0x40db2e;})});}_0x21f855=_[_0x176e('0x39')]({},_0x21f855,_0x362c82[_0x176e('0x3d')]);return _0x170474[_0x176e('0x4b')](_0x21f855);}})[_0x176e('0x24')](function(_0x52014a){if(_0x52014a){_0x1c3121=_0x52014a[_0x176e('0x33')];if(!_0x362c82[_0x176e('0x2f')][_0x176e('0x4e')](_0x176e('0x34'))){_0x21f855[_0x176e('0x1c')]=qs[_0x176e('0x1c')](_0x362c82[_0x176e('0x2f')][_0x176e('0x1c')]);_0x21f855[_0x176e('0x1a')]=qs[_0x176e('0x1a')](_0x362c82[_0x176e('0x2f')][_0x176e('0x1a')]);}return _0x170474[_0x176e('0x4b')](_0x21f855);}})[_0x176e('0x24')](function(_0x2b6a37){if(_0x2b6a37){return _0x2b6a37?{'count':_0x1c3121,'rows':_0x2b6a37}:null;}})['then'](respondWithResult(_0x310eba,null))[_0x176e('0x42')](handleError(_0x310eba,null));};exports[_0x176e('0x4f')]=function(_0x1f3017,_0x3a535a,_0x10f872){var _0x4f892e={};var _0x138bdd={};var _0x58014b;var _0x5f2ff2;return db[_0x176e('0x2b')][_0x176e('0x4c')]({'where':{'id':_0x1f3017[_0x176e('0x44')]['id']}})[_0x176e('0x24')](handleEntityNotFound(_0x3a535a,null))['then'](function(_0x3ac30f){if(_0x3ac30f){_0x58014b=_0x3ac30f;_0x138bdd['model']=_[_0x176e('0x2e')](db['ZohoField'][_0x176e('0x45')]);_0x138bdd[_0x176e('0x2f')]=_[_0x176e('0x2e')](_0x1f3017[_0x176e('0x2f')]);_0x138bdd[_0x176e('0x30')]=_[_0x176e('0x32')](_0x138bdd[_0x176e('0x2d')],_0x138bdd['query']);_0x4f892e[_0x176e('0x31')]=_[_0x176e('0x32')](_0x138bdd['model'],qs[_0x176e('0x46')](_0x1f3017[_0x176e('0x2f')][_0x176e('0x46')]));_0x4f892e[_0x176e('0x31')]=_0x4f892e[_0x176e('0x31')][_0x176e('0x33')]?_0x4f892e[_0x176e('0x31')]:_0x138bdd[_0x176e('0x2d')];_0x4f892e[_0x176e('0x35')]=qs['sort'](_0x1f3017['query'][_0x176e('0x4d')]);_0x4f892e[_0x176e('0x36')]=qs['filters'](_[_0x176e('0x37')](_0x1f3017[_0x176e('0x2f')],_0x138bdd[_0x176e('0x30')]));if(_0x1f3017[_0x176e('0x2f')][_0x176e('0x38')]){_0x4f892e[_0x176e('0x36')]=_[_0x176e('0x39')](_0x4f892e[_0x176e('0x36')],{'$or':_['map'](_0x4f892e['attributes'],function(_0x5a722f){var _0x11fbef={};_0x11fbef[_0x5a722f]={'$like':'%'+_0x1f3017[_0x176e('0x2f')][_0x176e('0x38')]+'%'};return _0x11fbef;})});}_0x4f892e=_[_0x176e('0x39')]({},_0x4f892e,_0x1f3017['options']);return _0x58014b[_0x176e('0x4f')](_0x4f892e);}})[_0x176e('0x24')](function(_0x16d8ac){if(_0x16d8ac){_0x5f2ff2=_0x16d8ac[_0x176e('0x33')];if(!_0x1f3017[_0x176e('0x2f')][_0x176e('0x4e')](_0x176e('0x34'))){_0x4f892e[_0x176e('0x1c')]=qs[_0x176e('0x1c')](_0x1f3017[_0x176e('0x2f')][_0x176e('0x1c')]);_0x4f892e[_0x176e('0x1a')]=qs[_0x176e('0x1a')](_0x1f3017[_0x176e('0x2f')]['offset']);}return _0x58014b['getSubjects'](_0x4f892e);}})['then'](function(_0x828a0){if(_0x828a0){return _0x828a0?{'count':_0x5f2ff2,'rows':_0x828a0}:null;}})['then'](respondWithResult(_0x3a535a,null))['catch'](handleError(_0x3a535a,null));};exports[_0x176e('0x50')]=function(_0x5e2835,_0xf68756,_0x15f5dc){var _0x5eb229={};var _0x44dbe1={};var _0x17d6e6;var _0x593494;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x5e2835[_0x176e('0x44')]['id']}})['then'](handleEntityNotFound(_0xf68756,null))['then'](function(_0x3e0207){if(_0x3e0207){_0x17d6e6=_0x3e0207;_0x44dbe1[_0x176e('0x2d')]=_['keys'](db['ZohoField']['rawAttributes']);_0x44dbe1[_0x176e('0x2f')]=_[_0x176e('0x2e')](_0x5e2835[_0x176e('0x2f')]);_0x44dbe1[_0x176e('0x30')]=_[_0x176e('0x32')](_0x44dbe1[_0x176e('0x2d')],_0x44dbe1[_0x176e('0x2f')]);_0x5eb229['attributes']=_[_0x176e('0x32')](_0x44dbe1['model'],qs[_0x176e('0x46')](_0x5e2835[_0x176e('0x2f')][_0x176e('0x46')]));_0x5eb229[_0x176e('0x31')]=_0x5eb229[_0x176e('0x31')]['length']?_0x5eb229[_0x176e('0x31')]:_0x44dbe1['model'];_0x5eb229['order']=qs[_0x176e('0x4d')](_0x5e2835[_0x176e('0x2f')][_0x176e('0x4d')]);_0x5eb229[_0x176e('0x36')]=qs[_0x176e('0x30')](_[_0x176e('0x37')](_0x5e2835[_0x176e('0x2f')],_0x44dbe1[_0x176e('0x30')]));if(_0x5e2835['query']['filter']){_0x5eb229[_0x176e('0x36')]=_[_0x176e('0x39')](_0x5eb229[_0x176e('0x36')],{'$or':_[_0x176e('0x3a')](_0x5eb229[_0x176e('0x31')],function(_0x2c35b5){var _0x1358bc={};_0x1358bc[_0x2c35b5]={'$like':'%'+_0x5e2835[_0x176e('0x2f')][_0x176e('0x38')]+'%'};return _0x1358bc;})});}_0x5eb229=_[_0x176e('0x39')]({},_0x5eb229,_0x5e2835['options']);return _0x17d6e6['getDescriptions'](_0x5eb229);}})['then'](function(_0x2297ae){if(_0x2297ae){_0x593494=_0x2297ae[_0x176e('0x33')];if(!_0x5e2835[_0x176e('0x2f')]['hasOwnProperty'](_0x176e('0x34'))){_0x5eb229[_0x176e('0x1c')]=qs['limit'](_0x5e2835[_0x176e('0x2f')][_0x176e('0x1c')]);_0x5eb229[_0x176e('0x1a')]=qs[_0x176e('0x1a')](_0x5e2835[_0x176e('0x2f')]['offset']);}return _0x17d6e6['getDescriptions'](_0x5eb229);}})[_0x176e('0x24')](function(_0x15787a){if(_0x15787a){return _0x15787a?{'count':_0x593494,'rows':_0x15787a}:null;}})[_0x176e('0x24')](respondWithResult(_0xf68756,null))[_0x176e('0x42')](handleError(_0xf68756,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3b04823..38bd1ae 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 _0x6f25=['rimraf','./intZohoConfiguration.attributes','exports','ZohoConfiguration','lodash','../../config/logger','api','moment','request-promise'];(function(_0x5642bc,_0xa3e199){var _0x27c05e=function(_0x58c200){while(--_0x58c200){_0x5642bc['push'](_0x5642bc['shift']());}};_0x27c05e(++_0xa3e199);}(_0x6f25,0x12d));var _0x56f2=function(_0x1abaf2,_0x204cb8){_0x1abaf2=_0x1abaf2-0x0;var _0x54b6b1=_0x6f25[_0x1abaf2];return _0x54b6b1;};'use strict';var _=require(_0x56f2('0x0'));var util=require('util');var logger=require(_0x56f2('0x1'))(_0x56f2('0x2'));var moment=require(_0x56f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x56f2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56f2('0x5'));var config=require('../../config/environment');var attributes=require(_0x56f2('0x6'));module[_0x56f2('0x7')]=function(_0x919bcf,_0x10e5cc){return _0x919bcf['define'](_0x56f2('0x8'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x03ed=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x416cdc,_0x213b87){var _0x1931ce=function(_0x1dc762){while(--_0x1dc762){_0x416cdc['push'](_0x416cdc['shift']());}};_0x1931ce(++_0x213b87);}(_0x03ed,0xed));var _0xd03e=function(_0x3ad510,_0x106da2){_0x3ad510=_0x3ad510-0x0;var _0x2d9d2a=_0x03ed[_0x3ad510];return _0x2d9d2a;};'use strict';var _=require(_0xd03e('0x0'));var util=require(_0xd03e('0x1'));var logger=require(_0xd03e('0x2'))(_0xd03e('0x3'));var moment=require('moment');var BPromise=require(_0xd03e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd03e('0x5'));var rimraf=require(_0xd03e('0x6'));var config=require(_0xd03e('0x7'));var attributes=require(_0xd03e('0x8'));module['exports']=function(_0x219f58,_0x3f5811){return _0x219f58['define'](_0xd03e('0x9'),attributes,{'tableName':_0xd03e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index ab1c8f7..80b2090 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 _0x1eba=['http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment'];(function(_0x2bd8af,_0x536238){var _0x23c336=function(_0x1fc29d){while(--_0x1fc29d){_0x2bd8af['push'](_0x2bd8af['shift']());}};_0x23c336(++_0x536238);}(_0x1eba,0x1d4));var _0xa1eb=function(_0xba1760,_0x191969){_0xba1760=_0xba1760-0x0;var _0x1f3143=_0x1eba[_0xba1760];return _0x1f3143;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa1eb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa1eb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x27f466,_0x195609,_0x30d51){return new BPromise(function(_0x4fb72b,_0x5ab82c){return client[_0xa1eb('0x8')](_0x27f466,_0x30d51)[_0xa1eb('0x9')](function(_0x428c94){logger[_0xa1eb('0xa')](_0xa1eb('0xb'),_0x195609,'request\x20sent');logger['debug'](_0xa1eb('0xc'),_0x195609,'request\x20sent',JSON[_0xa1eb('0xd')](_0x428c94));if(_0x428c94['error']){if(_0x428c94[_0xa1eb('0xe')][_0xa1eb('0xf')]===0x1f4){logger[_0xa1eb('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x195609,_0x428c94[_0xa1eb('0xe')][_0xa1eb('0x10')]);return _0x5ab82c(_0x428c94['error'][_0xa1eb('0x10')]);}logger['error'](_0xa1eb('0xb'),_0x195609,_0x428c94[_0xa1eb('0xe')][_0xa1eb('0x10')]);return _0x4fb72b(_0x428c94[_0xa1eb('0xe')][_0xa1eb('0x10')]);}else{logger['info'](_0xa1eb('0xb'),_0x195609,'request\x20sent');_0x4fb72b(_0x428c94[_0xa1eb('0x11')]['message']);}})[_0xa1eb('0x12')](function(_0x2493d4){logger[_0xa1eb('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x195609,_0x2493d4);_0x5ab82c(_0x2493d4);});});} \ No newline at end of file +var _0xc53d=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x58b983,_0x426a5c){var _0x83da04=function(_0x1c2d4d){while(--_0x1c2d4d){_0x58b983['push'](_0x58b983['shift']());}};_0x83da04(++_0x426a5c);}(_0xc53d,0x89));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdc53('0x0'));var util=require('util');var moment=require(_0xdc53('0x1'));var BPromise=require(_0xdc53('0x2'));var rs=require(_0xdc53('0x3'));var fs=require('fs');var Redis=require(_0xdc53('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdc53('0x5'));var logger=require(_0xdc53('0x6'))(_0xdc53('0x7'));var config=require(_0xdc53('0x8'));var jayson=require(_0xdc53('0x9'));var client=jayson[_0xdc53('0xa')][_0xdc53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x274e84,_0x3152bc,_0x2015a3){return new BPromise(function(_0x5e1543,_0x751480){return client[_0xdc53('0xc')](_0x274e84,_0x2015a3)[_0xdc53('0xd')](function(_0x2f68f3){logger[_0xdc53('0xe')](_0xdc53('0xf'),_0x3152bc,_0xdc53('0x10'));logger[_0xdc53('0x11')](_0xdc53('0x12'),_0x3152bc,_0xdc53('0x10'),JSON['stringify'](_0x2f68f3));if(_0x2f68f3[_0xdc53('0x13')]){if(_0x2f68f3[_0xdc53('0x13')]['code']===0x1f4){logger[_0xdc53('0x13')](_0xdc53('0xf'),_0x3152bc,_0x2f68f3['error'][_0xdc53('0x14')]);return _0x751480(_0x2f68f3[_0xdc53('0x13')][_0xdc53('0x14')]);}logger[_0xdc53('0x13')](_0xdc53('0xf'),_0x3152bc,_0x2f68f3[_0xdc53('0x13')][_0xdc53('0x14')]);return _0x5e1543(_0x2f68f3[_0xdc53('0x13')]['message']);}else{logger[_0xdc53('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x3152bc,_0xdc53('0x10'));_0x5e1543(_0x2f68f3[_0xdc53('0x15')][_0xdc53('0x14')]);}})['catch'](function(_0x57bf1b){logger[_0xdc53('0x13')](_0xdc53('0xf'),_0x3152bc,_0x57bf1b);_0x751480(_0x57bf1b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e7d7bc9..c5f119f 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 _0x1086=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x1086,0x1ad));var _0x6108=function(_0x315785,_0x1b7632){_0x315785=_0x315785-0x0;var _0x40d868=_0x1086[_0x315785];return _0x40d868;};'use strict';var multer=require(_0x6108('0x0'));var util=require(_0x6108('0x1'));var path=require(_0x6108('0x2'));var timeout=require('connect-timeout');var express=require(_0x6108('0x3'));var router=express[_0x6108('0x4')]();var fs_extra=require(_0x6108('0x5'));var auth=require(_0x6108('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6108('0x7'));var controller=require(_0x6108('0x8'));router[_0x6108('0x9')]('/',auth[_0x6108('0xa')](),controller['index']);router['get'](_0x6108('0xb'),auth[_0x6108('0xa')](),controller[_0x6108('0xc')]);router[_0x6108('0xd')]('/',auth[_0x6108('0xa')](),controller[_0x6108('0xe')]);router[_0x6108('0xf')](_0x6108('0xb'),auth['isAuthenticated'](),controller[_0x6108('0x10')]);router[_0x6108('0x11')](_0x6108('0xb'),auth[_0x6108('0xa')](),controller[_0x6108('0x12')]);module[_0x6108('0x13')]=router; \ No newline at end of file +var _0x5e25=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3a233c,_0x4f3100){var _0x53fa7f=function(_0x2667ac){while(--_0x2667ac){_0x3a233c['push'](_0x3a233c['shift']());}};_0x53fa7f(++_0x4f3100);}(_0x5e25,0x152));var _0x55e2=function(_0x500deb,_0x2b5571){_0x500deb=_0x500deb-0x0;var _0x206c46=_0x5e25[_0x500deb];return _0x206c46;};'use strict';var multer=require(_0x55e2('0x0'));var util=require('util');var path=require(_0x55e2('0x1'));var timeout=require(_0x55e2('0x2'));var express=require(_0x55e2('0x3'));var router=express[_0x55e2('0x4')]();var fs_extra=require(_0x55e2('0x5'));var auth=require(_0x55e2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x55e2('0x7'));var controller=require(_0x55e2('0x8'));router[_0x55e2('0x9')]('/',auth[_0x55e2('0xa')](),controller['index']);router['get'](_0x55e2('0xb'),auth[_0x55e2('0xa')](),controller[_0x55e2('0xc')]);router['post']('/',auth[_0x55e2('0xa')](),controller[_0x55e2('0xd')]);router['put'](_0x55e2('0xb'),auth['isAuthenticated'](),controller[_0x55e2('0xe')]);router[_0x55e2('0xf')](_0x55e2('0xb'),auth['isAuthenticated'](),controller[_0x55e2('0x10')]);module[_0x55e2('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d85deaf..db06773 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 _0x1736=['keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0x1736,0x163));var _0x6173=function(_0x223cdc,_0x398541){_0x223cdc=_0x223cdc-0x0;var _0x351da4=_0x1736[_0x223cdc];return _0x351da4;};'use strict';var Sequelize=require(_0x6173('0x0'));module[_0x6173('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6173('0x2'),_0x6173('0x3'),_0x6173('0x4'),_0x6173('0x5'),_0x6173('0x6')),'defaultValue':_0x6173('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6173('0x7')]},'keyType':{'type':Sequelize[_0x6173('0x8')](_0x6173('0x2'),_0x6173('0x3'),_0x6173('0x4'))},'keyContent':{'type':Sequelize[_0x6173('0x7')]},'idField':{'type':Sequelize[_0x6173('0x7')]},'nameField':{'type':Sequelize[_0x6173('0x7')]},'customField':{'type':Sequelize[_0x6173('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6173('0x7')]}}; \ No newline at end of file +var _0x6b43=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6b43,0x1ea));var _0x36b4=function(_0x4e6bb1,_0xe26bba){_0x4e6bb1=_0x4e6bb1-0x0;var _0x535aa3=_0x6b43[_0x4e6bb1];return _0x535aa3;};'use strict';var Sequelize=require(_0x36b4('0x0'));module[_0x36b4('0x1')]={'type':{'type':Sequelize[_0x36b4('0x2')](_0x36b4('0x3'),_0x36b4('0x4'),_0x36b4('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x36b4('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x36b4('0x4'),_0x36b4('0x5'))},'keyContent':{'type':Sequelize[_0x36b4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x36b4('0x6')]},'customField':{'type':Sequelize[_0x36b4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36b4('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ab5c4f7..135f6f6 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 _0xe4a2=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','find','create','body','rimraf','zip-dir'];(function(_0x4e0fb8,_0x4961cf){var _0x43a548=function(_0x4f23d4){while(--_0x4f23d4){_0x4e0fb8['push'](_0x4e0fb8['shift']());}};_0x43a548(++_0x4961cf);}(_0xe4a2,0x161));var _0x2e4a=function(_0x4a5ae3,_0x55fc14){_0x4a5ae3=_0x4a5ae3-0x0;var _0x3204da=_0xe4a2[_0x4a5ae3];return _0x3204da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e4a('0x0'));var zipdir=require(_0x2e4a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e4a('0x2'));var moment=require(_0x2e4a('0x3'));var BPromise=require(_0x2e4a('0x4'));var Mustache=require(_0x2e4a('0x5'));var util=require(_0x2e4a('0x6'));var path=require(_0x2e4a('0x7'));var sox=require(_0x2e4a('0x8'));var csv=require(_0x2e4a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e4a('0xa'));var _=require(_0x2e4a('0xb'));var squel=require('squel');var crypto=require(_0x2e4a('0xc'));var jsforce=require(_0x2e4a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2e4a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e4a('0xe'));var hardwareService=require(_0x2e4a('0xf'));var logger=require(_0x2e4a('0x10'))(_0x2e4a('0x11'));var utils=require('../../config/utils');var config=require(_0x2e4a('0x12'));var licenseUtil=require(_0x2e4a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1af8c1,_0xe79602){_0xe79602=_0xe79602||0xcc;return function(_0x5b9cc8){if(_0x5b9cc8){return _0x1af8c1[_0x2e4a('0x14')](_0xe79602);}return _0x1af8c1[_0x2e4a('0x15')](_0xe79602)[_0x2e4a('0x16')]();};}function respondWithResult(_0x554fc3,_0x342bac){_0x342bac=_0x342bac||0xc8;return function(_0x3c9ff0){if(_0x3c9ff0){return _0x554fc3['status'](_0x342bac)[_0x2e4a('0x17')](_0x3c9ff0);}};}function respondWithFilteredResult(_0x54fdd2,_0x440310){return function(_0x1bd255){if(_0x1bd255){var _0x461384=typeof _0x440310[_0x2e4a('0x18')]==='undefined'&&typeof _0x440310[_0x2e4a('0x19')]===_0x2e4a('0x1a');var _0x1cdaf0=_0x1bd255[_0x2e4a('0x1b')];var _0x4c3a5d=_0x461384?0x0:_0x440310[_0x2e4a('0x18')];var _0x4b16ca=_0x461384?_0x1bd255['count']:_0x440310[_0x2e4a('0x18')]+_0x440310[_0x2e4a('0x19')];var _0x507b91;if(_0x4b16ca>=_0x1cdaf0){_0x4b16ca=_0x1cdaf0;_0x507b91=0xc8;}else{_0x507b91=0xce;}_0x54fdd2[_0x2e4a('0x15')](_0x507b91);return _0x54fdd2['set'](_0x2e4a('0x1c'),_0x4c3a5d+'-'+_0x4b16ca+'/'+_0x1cdaf0)[_0x2e4a('0x17')](_0x1bd255);}return null;};}function patchUpdates(_0x570a7c){return function(_0x5e06a6){try{jsonpatch[_0x2e4a('0x1d')](_0x5e06a6,_0x570a7c,!![]);}catch(_0x4e781d){return BPromise[_0x2e4a('0x1e')](_0x4e781d);}return _0x5e06a6[_0x2e4a('0x1f')]();};}function saveUpdates(_0x3112d0,_0x214f9a){return function(_0x5daf0a){if(_0x5daf0a){return _0x5daf0a[_0x2e4a('0x20')](_0x3112d0)[_0x2e4a('0x21')](function(_0x33a53b){return _0x33a53b;});}return null;};}function removeEntity(_0x20b969,_0x799055){return function(_0x4f8189){if(_0x4f8189){return _0x4f8189[_0x2e4a('0x22')]()[_0x2e4a('0x21')](function(){_0x20b969['status'](0xcc)[_0x2e4a('0x16')]();});}};}function handleEntityNotFound(_0x379821,_0x3a715c){return function(_0x571516){if(!_0x571516){_0x379821[_0x2e4a('0x14')](0x194);}return _0x571516;};}function handleError(_0x42f156,_0x13d909){_0x13d909=_0x13d909||0x1f4;return function(_0x396202){logger[_0x2e4a('0x23')](_0x396202['stack']);if(_0x396202[_0x2e4a('0x24')]){delete _0x396202[_0x2e4a('0x24')];}_0x42f156[_0x2e4a('0x15')](_0x13d909)[_0x2e4a('0x25')](_0x396202);};}exports[_0x2e4a('0x26')]=function(_0x4bed0f,_0x152503){var _0xe183ff={},_0x51e79a={},_0x282c47={'count':0x0,'rows':[]};var _0x46e83f=_[_0x2e4a('0x27')](db['ZohoField']['rawAttributes'],function(_0x5092ff){return{'name':_0x5092ff['fieldName'],'type':_0x5092ff[_0x2e4a('0x28')][_0x2e4a('0x29')]};});_0x51e79a[_0x2e4a('0x2a')]=_['map'](_0x46e83f,_0x2e4a('0x24'));_0x51e79a[_0x2e4a('0x2b')]=_[_0x2e4a('0x2c')](_0x4bed0f['query']);_0x51e79a[_0x2e4a('0x2d')]=_['intersection'](_0x51e79a[_0x2e4a('0x2a')],_0x51e79a[_0x2e4a('0x2b')]);_0xe183ff['attributes']=_[_0x2e4a('0x2e')](_0x51e79a[_0x2e4a('0x2a')],qs['fields'](_0x4bed0f[_0x2e4a('0x2b')]['fields']));_0xe183ff['attributes']=_0xe183ff[_0x2e4a('0x2f')][_0x2e4a('0x30')]?_0xe183ff['attributes']:_0x51e79a[_0x2e4a('0x2a')];if(!_0x4bed0f['query'][_0x2e4a('0x31')](_0x2e4a('0x32'))){_0xe183ff['limit']=qs[_0x2e4a('0x19')](_0x4bed0f[_0x2e4a('0x2b')][_0x2e4a('0x19')]);_0xe183ff[_0x2e4a('0x18')]=qs['offset'](_0x4bed0f[_0x2e4a('0x2b')][_0x2e4a('0x18')]);}_0xe183ff[_0x2e4a('0x33')]=qs[_0x2e4a('0x34')](_0x4bed0f[_0x2e4a('0x2b')][_0x2e4a('0x34')]);_0xe183ff[_0x2e4a('0x35')]=qs[_0x2e4a('0x2d')](_[_0x2e4a('0x36')](_0x4bed0f['query'],_0x51e79a[_0x2e4a('0x2d')]),_0x46e83f);if(_0x4bed0f['query'][_0x2e4a('0x37')]){_0xe183ff[_0x2e4a('0x35')]=_[_0x2e4a('0x38')](_0xe183ff[_0x2e4a('0x35')],{'$or':_['map'](_0x46e83f,function(_0xe67808){if(_0xe67808[_0x2e4a('0x28')]!==_0x2e4a('0x39')){var _0x27d22a={};_0x27d22a[_0xe67808[_0x2e4a('0x24')]]={'$like':'%'+_0x4bed0f[_0x2e4a('0x2b')][_0x2e4a('0x37')]+'%'};return _0x27d22a;}})});}_0xe183ff=_[_0x2e4a('0x38')]({},_0xe183ff,_0x4bed0f[_0x2e4a('0x3a')]);var _0x2ff9ef={'where':_0xe183ff[_0x2e4a('0x35')]};return db[_0x2e4a('0x3b')]['count'](_0x2ff9ef)[_0x2e4a('0x21')](function(_0x22bec2){_0x282c47[_0x2e4a('0x1b')]=_0x22bec2;if(_0x4bed0f[_0x2e4a('0x2b')][_0x2e4a('0x3c')]){_0xe183ff[_0x2e4a('0x3d')]=[{'all':!![]}];}return db[_0x2e4a('0x3b')][_0x2e4a('0x3e')](_0xe183ff);})[_0x2e4a('0x21')](function(_0x175898){_0x282c47[_0x2e4a('0x3f')]=_0x175898;return _0x282c47;})[_0x2e4a('0x21')](respondWithFilteredResult(_0x152503,_0xe183ff))[_0x2e4a('0x40')](handleError(_0x152503,null));};exports['show']=function(_0x671791,_0xfb8011){var _0x1230de={'raw':!![],'where':{'id':_0x671791[_0x2e4a('0x41')]['id']}},_0x31373e={};_0x31373e[_0x2e4a('0x2a')]=_[_0x2e4a('0x2c')](db[_0x2e4a('0x3b')][_0x2e4a('0x42')]);_0x31373e['query']=_[_0x2e4a('0x2c')](_0x671791[_0x2e4a('0x2b')]);_0x31373e['filters']=_[_0x2e4a('0x2e')](_0x31373e[_0x2e4a('0x2a')],_0x31373e[_0x2e4a('0x2b')]);_0x1230de[_0x2e4a('0x2f')]=_[_0x2e4a('0x2e')](_0x31373e[_0x2e4a('0x2a')],qs['fields'](_0x671791[_0x2e4a('0x2b')][_0x2e4a('0x43')]));_0x1230de[_0x2e4a('0x2f')]=_0x1230de[_0x2e4a('0x2f')][_0x2e4a('0x30')]?_0x1230de[_0x2e4a('0x2f')]:_0x31373e[_0x2e4a('0x2a')];if(_0x671791['query']['includeAll']){_0x1230de[_0x2e4a('0x3d')]=[{'all':!![]}];}_0x1230de=_[_0x2e4a('0x38')]({},_0x1230de,_0x671791[_0x2e4a('0x3a')]);return db['ZohoField'][_0x2e4a('0x44')](_0x1230de)[_0x2e4a('0x21')](handleEntityNotFound(_0xfb8011,null))[_0x2e4a('0x21')](respondWithResult(_0xfb8011,null))[_0x2e4a('0x40')](handleError(_0xfb8011,null));};exports[_0x2e4a('0x45')]=function(_0x184329,_0x50c4d1){return db[_0x2e4a('0x3b')][_0x2e4a('0x45')](_0x184329['body'],{})[_0x2e4a('0x21')](respondWithResult(_0x50c4d1,0xc9))['catch'](handleError(_0x50c4d1,null));};exports[_0x2e4a('0x20')]=function(_0x5e7945,_0x3768ec){if(_0x5e7945[_0x2e4a('0x46')]['id']){delete _0x5e7945['body']['id'];}return db[_0x2e4a('0x3b')][_0x2e4a('0x44')]({'where':{'id':_0x5e7945[_0x2e4a('0x41')]['id']}})[_0x2e4a('0x21')](handleEntityNotFound(_0x3768ec,null))['then'](saveUpdates(_0x5e7945[_0x2e4a('0x46')],null))[_0x2e4a('0x21')](respondWithResult(_0x3768ec,null))[_0x2e4a('0x40')](handleError(_0x3768ec,null));};exports[_0x2e4a('0x22')]=function(_0x5e9eec,_0x15832b){return db['ZohoField'][_0x2e4a('0x44')]({'where':{'id':_0x5e9eec[_0x2e4a('0x41')]['id']}})[_0x2e4a('0x21')](handleEntityNotFound(_0x15832b,null))[_0x2e4a('0x21')](removeEntity(_0x15832b,null))[_0x2e4a('0x40')](handleError(_0x15832b,null));}; \ No newline at end of file +var _0xeb18=['sox','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','ZohoField','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1bf301,_0x1ae475){var _0x46c700=function(_0x4eb3f3){while(--_0x4eb3f3){_0x1bf301['push'](_0x1bf301['shift']());}};_0x46c700(++_0x1ae475);}(_0xeb18,0xd8));var _0x8eb1=function(_0x4a11a9,_0x292eb6){_0x4a11a9=_0x4a11a9-0x0;var _0x3b2e98=_0xeb18[_0x4a11a9];return _0x3b2e98;};'use strict';var emlformat=require(_0x8eb1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8eb1('0x1'));var jsonpatch=require(_0x8eb1('0x2'));var rp=require(_0x8eb1('0x3'));var moment=require(_0x8eb1('0x4'));var BPromise=require(_0x8eb1('0x5'));var Mustache=require(_0x8eb1('0x6'));var util=require(_0x8eb1('0x7'));var path=require(_0x8eb1('0x8'));var sox=require(_0x8eb1('0x9'));var csv=require('to-csv');var ejs=require(_0x8eb1('0xa'));var fs=require('fs');var fs_extra=require(_0x8eb1('0xb'));var _=require(_0x8eb1('0xc'));var squel=require(_0x8eb1('0xd'));var crypto=require(_0x8eb1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8eb1('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eb1('0x10'));var qs=require(_0x8eb1('0x11'));var as=require(_0x8eb1('0x12'));var hardwareService=require(_0x8eb1('0x13'));var logger=require('../../config/logger')(_0x8eb1('0x14'));var utils=require(_0x8eb1('0x15'));var config=require(_0x8eb1('0x16'));var licenseUtil=require(_0x8eb1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24953e,_0x75b4dc){_0x75b4dc=_0x75b4dc||0xcc;return function(_0x1c08e9){if(_0x1c08e9){return _0x24953e[_0x8eb1('0x18')](_0x75b4dc);}return _0x24953e['status'](_0x75b4dc)['end']();};}function respondWithResult(_0x4af56d,_0x1cb315){_0x1cb315=_0x1cb315||0xc8;return function(_0x3f9142){if(_0x3f9142){return _0x4af56d[_0x8eb1('0x19')](_0x1cb315)[_0x8eb1('0x1a')](_0x3f9142);}};}function respondWithFilteredResult(_0x40dc96,_0x282ef4){return function(_0xf3a7a4){if(_0xf3a7a4){var _0x55adc7=typeof _0x282ef4[_0x8eb1('0x1b')]===_0x8eb1('0x1c')&&typeof _0x282ef4['limit']===_0x8eb1('0x1c');var _0x36cc11=_0xf3a7a4[_0x8eb1('0x1d')];var _0x40e1f0=_0x55adc7?0x0:_0x282ef4[_0x8eb1('0x1b')];var _0x3915dd=_0x55adc7?_0xf3a7a4[_0x8eb1('0x1d')]:_0x282ef4[_0x8eb1('0x1b')]+_0x282ef4[_0x8eb1('0x1e')];var _0x1cfea7;if(_0x3915dd>=_0x36cc11){_0x3915dd=_0x36cc11;_0x1cfea7=0xc8;}else{_0x1cfea7=0xce;}_0x40dc96[_0x8eb1('0x19')](_0x1cfea7);return _0x40dc96['set'](_0x8eb1('0x1f'),_0x40e1f0+'-'+_0x3915dd+'/'+_0x36cc11)['json'](_0xf3a7a4);}return null;};}function patchUpdates(_0x21f2a5){return function(_0x4d2df5){try{jsonpatch[_0x8eb1('0x20')](_0x4d2df5,_0x21f2a5,!![]);}catch(_0x52fe01){return BPromise[_0x8eb1('0x21')](_0x52fe01);}return _0x4d2df5[_0x8eb1('0x22')]();};}function saveUpdates(_0x882323,_0x11483a){return function(_0x523567){if(_0x523567){return _0x523567[_0x8eb1('0x23')](_0x882323)[_0x8eb1('0x24')](function(_0x58fcbe){return _0x58fcbe;});}return null;};}function removeEntity(_0x474ee8,_0x282243){return function(_0x577d0a){if(_0x577d0a){return _0x577d0a[_0x8eb1('0x25')]()[_0x8eb1('0x24')](function(){_0x474ee8['status'](0xcc)[_0x8eb1('0x26')]();});}};}function handleEntityNotFound(_0x525d43,_0x46eb4e){return function(_0x27fec8){if(!_0x27fec8){_0x525d43['sendStatus'](0x194);}return _0x27fec8;};}function handleError(_0x5890d5,_0x2aa78c){_0x2aa78c=_0x2aa78c||0x1f4;return function(_0x20d093){logger[_0x8eb1('0x27')](_0x20d093[_0x8eb1('0x28')]);if(_0x20d093[_0x8eb1('0x29')]){delete _0x20d093[_0x8eb1('0x29')];}_0x5890d5[_0x8eb1('0x19')](_0x2aa78c)['send'](_0x20d093);};}exports['index']=function(_0xef661a,_0x10d038){var _0x427f11={},_0x2bf3e3={},_0xc8625={'count':0x0,'rows':[]};var _0x36236f=_[_0x8eb1('0x2a')](db['ZohoField'][_0x8eb1('0x2b')],function(_0x35c070){return{'name':_0x35c070[_0x8eb1('0x2c')],'type':_0x35c070[_0x8eb1('0x2d')][_0x8eb1('0x2e')]};});_0x2bf3e3[_0x8eb1('0x2f')]=_['map'](_0x36236f,_0x8eb1('0x29'));_0x2bf3e3[_0x8eb1('0x30')]=_['keys'](_0xef661a[_0x8eb1('0x30')]);_0x2bf3e3['filters']=_['intersection'](_0x2bf3e3[_0x8eb1('0x2f')],_0x2bf3e3[_0x8eb1('0x30')]);_0x427f11[_0x8eb1('0x31')]=_[_0x8eb1('0x32')](_0x2bf3e3['model'],qs[_0x8eb1('0x33')](_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x33')]));_0x427f11[_0x8eb1('0x31')]=_0x427f11['attributes'][_0x8eb1('0x34')]?_0x427f11[_0x8eb1('0x31')]:_0x2bf3e3['model'];if(!_0xef661a[_0x8eb1('0x30')]['hasOwnProperty'](_0x8eb1('0x35'))){_0x427f11['limit']=qs[_0x8eb1('0x1e')](_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x1e')]);_0x427f11['offset']=qs[_0x8eb1('0x1b')](_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x1b')]);}_0x427f11[_0x8eb1('0x36')]=qs[_0x8eb1('0x37')](_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x37')]);_0x427f11[_0x8eb1('0x38')]=qs[_0x8eb1('0x39')](_[_0x8eb1('0x3a')](_0xef661a[_0x8eb1('0x30')],_0x2bf3e3[_0x8eb1('0x39')]),_0x36236f);if(_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x3b')]){_0x427f11[_0x8eb1('0x38')]=_[_0x8eb1('0x3c')](_0x427f11['where'],{'$or':_[_0x8eb1('0x2a')](_0x36236f,function(_0xc4eddf){if(_0xc4eddf[_0x8eb1('0x2d')]!==_0x8eb1('0x3d')){var _0x54de75={};_0x54de75[_0xc4eddf[_0x8eb1('0x29')]]={'$like':'%'+_0xef661a[_0x8eb1('0x30')][_0x8eb1('0x3b')]+'%'};return _0x54de75;}})});}_0x427f11=_['merge']({},_0x427f11,_0xef661a[_0x8eb1('0x3e')]);var _0x595ea7={'where':_0x427f11[_0x8eb1('0x38')]};return db['ZohoField']['count'](_0x595ea7)[_0x8eb1('0x24')](function(_0x4dc5cd){_0xc8625[_0x8eb1('0x1d')]=_0x4dc5cd;if(_0xef661a['query'][_0x8eb1('0x3f')]){_0x427f11[_0x8eb1('0x40')]=[{'all':!![]}];}return db[_0x8eb1('0x41')][_0x8eb1('0x42')](_0x427f11);})[_0x8eb1('0x24')](function(_0x19db12){_0xc8625[_0x8eb1('0x43')]=_0x19db12;return _0xc8625;})[_0x8eb1('0x24')](respondWithFilteredResult(_0x10d038,_0x427f11))[_0x8eb1('0x44')](handleError(_0x10d038,null));};exports[_0x8eb1('0x45')]=function(_0x4a6a0f,_0x468a18){var _0x5a0a52={'raw':!![],'where':{'id':_0x4a6a0f[_0x8eb1('0x46')]['id']}},_0x5af070={};_0x5af070[_0x8eb1('0x2f')]=_[_0x8eb1('0x47')](db[_0x8eb1('0x41')][_0x8eb1('0x2b')]);_0x5af070['query']=_[_0x8eb1('0x47')](_0x4a6a0f[_0x8eb1('0x30')]);_0x5af070[_0x8eb1('0x39')]=_[_0x8eb1('0x32')](_0x5af070[_0x8eb1('0x2f')],_0x5af070['query']);_0x5a0a52[_0x8eb1('0x31')]=_[_0x8eb1('0x32')](_0x5af070[_0x8eb1('0x2f')],qs[_0x8eb1('0x33')](_0x4a6a0f[_0x8eb1('0x30')]['fields']));_0x5a0a52[_0x8eb1('0x31')]=_0x5a0a52[_0x8eb1('0x31')][_0x8eb1('0x34')]?_0x5a0a52[_0x8eb1('0x31')]:_0x5af070[_0x8eb1('0x2f')];if(_0x4a6a0f['query']['includeAll']){_0x5a0a52[_0x8eb1('0x40')]=[{'all':!![]}];}_0x5a0a52=_[_0x8eb1('0x3c')]({},_0x5a0a52,_0x4a6a0f[_0x8eb1('0x3e')]);return db[_0x8eb1('0x41')][_0x8eb1('0x48')](_0x5a0a52)[_0x8eb1('0x24')](handleEntityNotFound(_0x468a18,null))[_0x8eb1('0x24')](respondWithResult(_0x468a18,null))[_0x8eb1('0x44')](handleError(_0x468a18,null));};exports[_0x8eb1('0x49')]=function(_0x2ae5ba,_0x164e08){return db['ZohoField'][_0x8eb1('0x49')](_0x2ae5ba[_0x8eb1('0x4a')],{})[_0x8eb1('0x24')](respondWithResult(_0x164e08,0xc9))['catch'](handleError(_0x164e08,null));};exports[_0x8eb1('0x23')]=function(_0x2f6cba,_0x2e8872){if(_0x2f6cba[_0x8eb1('0x4a')]['id']){delete _0x2f6cba[_0x8eb1('0x4a')]['id'];}return db[_0x8eb1('0x41')]['find']({'where':{'id':_0x2f6cba[_0x8eb1('0x46')]['id']}})[_0x8eb1('0x24')](handleEntityNotFound(_0x2e8872,null))[_0x8eb1('0x24')](saveUpdates(_0x2f6cba[_0x8eb1('0x4a')],null))['then'](respondWithResult(_0x2e8872,null))[_0x8eb1('0x44')](handleError(_0x2e8872,null));};exports[_0x8eb1('0x25')]=function(_0x55236c,_0xa15e4e){return db[_0x8eb1('0x41')][_0x8eb1('0x48')]({'where':{'id':_0x55236c[_0x8eb1('0x46')]['id']}})[_0x8eb1('0x24')](handleEntityNotFound(_0xa15e4e,null))[_0x8eb1('0x24')](removeEntity(_0xa15e4e,null))[_0x8eb1('0x44')](handleError(_0xa15e4e,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4ed18bf..8f97c46 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 _0x2d72=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x2d72,0xa8));var _0x22d7=function(_0x4ae1b0,_0x3bc8b9){_0x4ae1b0=_0x4ae1b0-0x0;var _0xb17ee8=_0x2d72[_0x4ae1b0];return _0xb17ee8;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x22d7('0xe'),_0x22d7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b84=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x561737,_0x5902e4){var _0x2bbf6f=function(_0x282fb8){while(--_0x282fb8){_0x561737['push'](_0x561737['shift']());}};_0x2bbf6f(++_0x5902e4);}(_0x7b84,0x17c));var _0x47b8=function(_0x5019ad,_0x5002aa){_0x5019ad=_0x5019ad-0x0;var _0xd76908=_0x7b84[_0x5019ad];return _0xd76908;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var logger=require(_0x47b8('0x2'))(_0x47b8('0x3'));var moment=require(_0x47b8('0x4'));var BPromise=require(_0x47b8('0x5'));var rp=require(_0x47b8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var attributes=require(_0x47b8('0x9'));module[_0x47b8('0xa')]=function(_0x2e6853,_0xafe88a){return _0x2e6853['define'](_0x47b8('0xb'),attributes,{'tableName':_0x47b8('0xc'),'paranoid':![],'indexes':[{'name':_0x47b8('0xd'),'fields':[_0x47b8('0xe'),_0x47b8('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c3b1fc6..c5741f0 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 _0x7278=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7278,0x10c));var _0x8727=function(_0xc57d67,_0x57fcea){_0xc57d67=_0xc57d67-0x0;var _0x1a5c5c=_0x7278[_0xc57d67];return _0x1a5c5c;};'use strict';var _=require(_0x8727('0x0'));var util=require('util');var moment=require(_0x8727('0x1'));var BPromise=require(_0x8727('0x2'));var rs=require(_0x8727('0x3'));var fs=require('fs');var Redis=require(_0x8727('0x4'));var db=require(_0x8727('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8727('0x6'))(_0x8727('0x7'));var config=require(_0x8727('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8727('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x533792,_0x965e5d,_0x4ace44){return new BPromise(function(_0x41d1a9,_0x1661de){return client[_0x8727('0xa')](_0x533792,_0x4ace44)[_0x8727('0xb')](function(_0x4cf884){logger[_0x8727('0xc')](_0x8727('0xd'),_0x965e5d,_0x8727('0xe'));logger['debug'](_0x8727('0xf'),_0x965e5d,_0x8727('0xe'),JSON[_0x8727('0x10')](_0x4cf884));if(_0x4cf884[_0x8727('0x11')]){if(_0x4cf884[_0x8727('0x11')][_0x8727('0x12')]===0x1f4){logger['error'](_0x8727('0xd'),_0x965e5d,_0x4cf884[_0x8727('0x11')]['message']);return _0x1661de(_0x4cf884[_0x8727('0x11')][_0x8727('0x13')]);}logger[_0x8727('0x11')](_0x8727('0xd'),_0x965e5d,_0x4cf884[_0x8727('0x11')][_0x8727('0x13')]);return _0x41d1a9(_0x4cf884[_0x8727('0x11')][_0x8727('0x13')]);}else{logger[_0x8727('0xc')](_0x8727('0xd'),_0x965e5d,'request\x20sent');_0x41d1a9(_0x4cf884[_0x8727('0x14')]['message']);}})[_0x8727('0x15')](function(_0x239ef1){logger[_0x8727('0x11')](_0x8727('0xd'),_0x965e5d,_0x239ef1);_0x1661de(_0x239ef1);});});} \ No newline at end of file +var _0xfb85=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','ZohoField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xfb85,0x1ea));var _0x5fb8=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xfb85[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x5fb8('0x0'));var util=require(_0x5fb8('0x1'));var moment=require(_0x5fb8('0x2'));var BPromise=require(_0x5fb8('0x3'));var rs=require(_0x5fb8('0x4'));var fs=require('fs');var Redis=require(_0x5fb8('0x5'));var db=require(_0x5fb8('0x6'))['db'];var utils=require(_0x5fb8('0x7'));var logger=require(_0x5fb8('0x8'))(_0x5fb8('0x9'));var config=require(_0x5fb8('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5fb8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x577ce2,_0x480f3b,_0x5c2ea3){return new BPromise(function(_0x3583f9,_0x28db8c){return client['request'](_0x577ce2,_0x5c2ea3)[_0x5fb8('0xc')](function(_0x16ea15){logger[_0x5fb8('0xd')]('ZohoField,\x20%s,\x20%s',_0x480f3b,_0x5fb8('0xe'));logger[_0x5fb8('0xf')](_0x5fb8('0x10'),_0x480f3b,_0x5fb8('0xe'),JSON[_0x5fb8('0x11')](_0x16ea15));if(_0x16ea15['error']){if(_0x16ea15[_0x5fb8('0x12')]['code']===0x1f4){logger[_0x5fb8('0x12')](_0x5fb8('0x13'),_0x480f3b,_0x16ea15[_0x5fb8('0x12')][_0x5fb8('0x14')]);return _0x28db8c(_0x16ea15['error'][_0x5fb8('0x14')]);}logger[_0x5fb8('0x12')](_0x5fb8('0x13'),_0x480f3b,_0x16ea15[_0x5fb8('0x12')][_0x5fb8('0x14')]);return _0x3583f9(_0x16ea15[_0x5fb8('0x12')][_0x5fb8('0x14')]);}else{logger[_0x5fb8('0xd')](_0x5fb8('0x13'),_0x480f3b,_0x5fb8('0xe'));_0x3583f9(_0x16ea15['result']['message']);}})[_0x5fb8('0x15')](function(_0x19399b){logger['error'](_0x5fb8('0x13'),_0x480f3b,_0x19399b);_0x28db8c(_0x19399b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c541e9e..84dc39c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ec3b8,_0x255801){var _0x13f773=function(_0x2881b5){while(--_0x2881b5){_0x2ec3b8['push'](_0x2ec3b8['shift']());}};_0x13f773(++_0x255801);}(_0xe706,0xa3));var _0x6e70=function(_0x18dd15,_0x252692){_0x18dd15=_0x18dd15-0x0;var _0x46719e=_0xe706[_0x18dd15];return _0x46719e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x47faab,_0x2f0254){var _0x392a8b=function(_0xdbe4f5){while(--_0xdbe4f5){_0x47faab['push'](_0x47faab['shift']());}};_0x392a8b(++_0x2f0254);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index c1e3a79..9533267 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 _0x7dad=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x30e2b1,_0x248f08){var _0x4724e9=function(_0x1d6750){while(--_0x1d6750){_0x30e2b1['push'](_0x30e2b1['shift']());}};_0x4724e9(++_0x248f08);}(_0x7dad,0x174));var _0xd7da=function(_0x31e149,_0x282ed2){_0x31e149=_0x31e149-0x0;var _0x241286=_0x7dad[_0x31e149];return _0x241286;};'use strict';var Sequelize=require(_0xd7da('0x0'));module['exports']={'name':{'type':Sequelize[_0xd7da('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xd7da('0x1')],'allowNull':![],'unique':_0xd7da('0x2')},'main':{'type':Sequelize[_0xd7da('0x1')],'defaultValue':_0xd7da('0x3')},'filename':{'type':Sequelize[_0xd7da('0x1')]},'path':{'type':Sequelize[_0xd7da('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xd7da('0x4')]},'active':{'type':Sequelize[_0xd7da('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd7da('0x1')]},'logo':{'type':Sequelize[_0xd7da('0x1')]},'state':{'type':Sequelize[_0xd7da('0x1')],'unique':_0xd7da('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xd7da('0x1')]},'remoteUri':{'type':Sequelize[_0xd7da('0x1')]},'link':{'type':Sequelize[_0xd7da('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x9071=['BOOLEAN','state','sequelize','STRING','unique_name_and_version'];(function(_0x567943,_0x4991f4){var _0x5cfd0e=function(_0x26f78c){while(--_0x26f78c){_0x567943['push'](_0x567943['shift']());}};_0x5cfd0e(++_0x4991f4);}(_0x9071,0x6b));var _0x1907=function(_0x3986a5,_0x13354f){_0x3986a5=_0x3986a5-0x0;var _0x43c135=_0x9071[_0x3986a5];return _0x43c135;};'use strict';var Sequelize=require(_0x1907('0x0'));module['exports']={'name':{'type':Sequelize[_0x1907('0x1')],'allowNull':![],'unique':_0x1907('0x2')},'version':{'type':Sequelize[_0x1907('0x1')],'allowNull':![],'unique':_0x1907('0x2')},'main':{'type':Sequelize[_0x1907('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x1907('0x1')]},'path':{'type':Sequelize[_0x1907('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x1907('0x3')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x1907('0x1')]},'state':{'type':Sequelize[_0x1907('0x1')],'unique':_0x1907('0x4')},'description':{'type':Sequelize[_0x1907('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1907('0x1')]},'link':{'type':Sequelize[_0x1907('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0d00150..d195947 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e245c,_0x3fac96){_0x1e245c=_0x1e245c-0x0;var _0x294b0c=_0x5f2f[_0x1e245c];return _0x294b0c;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x5ebe5f,_0x38b557){var _0x4b1e13=function(_0x2a89e3){while(--_0x2a89e3){_0x5ebe5f['push'](_0x5ebe5f['shift']());}};_0x4b1e13(++_0x38b557);}(_0x1a85,0x178));var _0x51a8=function(_0x320c90,_0x515e0a){_0x320c90=_0x320c90-0x0;var _0x4b8824=_0x1a85[_0x320c90];return _0x4b8824;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 5762325..5689d92 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 _0xb5d2=['util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','Integration','integrations','lodash'];(function(_0x5bf956,_0x33de99){var _0xc0325=function(_0x154ce3){while(--_0x154ce3){_0x5bf956['push'](_0x5bf956['shift']());}};_0xc0325(++_0x33de99);}(_0xb5d2,0xf1));var _0x2b5d=function(_0x3aba7b,_0x1b71ad){_0x3aba7b=_0x3aba7b-0x0;var _0x412f91=_0xb5d2[_0x3aba7b];return _0x412f91;};'use strict';var _=require(_0x2b5d('0x0'));var util=require(_0x2b5d('0x1'));var logger=require(_0x2b5d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2b5d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b5d('0x4'));var rimraf=require(_0x2b5d('0x5'));var config=require(_0x2b5d('0x6'));var attributes=require('./integration.attributes');module[_0x2b5d('0x7')]=function(_0x5ed048,_0x17a09e){return _0x5ed048[_0x2b5d('0x8')](_0x2b5d('0x9'),attributes,{'tableName':_0x2b5d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf58a=['./integration.attributes','exports','define','integrations','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x448f50,_0x5587ba){var _0x2af4c3=function(_0x5f2616){while(--_0x5f2616){_0x448f50['push'](_0x448f50['shift']());}};_0x2af4c3(++_0x5587ba);}(_0xf58a,0x159));var _0xaf58=function(_0xad55e2,_0x4ed37e){_0xad55e2=_0xad55e2-0x0;var _0x1973ce=_0xf58a[_0xad55e2];return _0x1973ce;};'use strict';var _=require(_0xaf58('0x0'));var util=require('util');var logger=require(_0xaf58('0x1'))(_0xaf58('0x2'));var moment=require('moment');var BPromise=require(_0xaf58('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf58('0x4'));var rimraf=require(_0xaf58('0x5'));var config=require(_0xaf58('0x6'));var attributes=require(_0xaf58('0x7'));module[_0xaf58('0x8')]=function(_0x5750e3,_0x4b6b13){return _0x5750e3[_0xaf58('0x9')]('Integration',attributes,{'tableName':_0xaf58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 69170a1..e3b08ea 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x36f241,_0xeb3472){var _0x5118e2=function(_0x3065a0){while(--_0x3065a0){_0x36f241['push'](_0x36f241['shift']());}};_0x5118e2(++_0xeb3472);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x488358,_0x211c55){var _0x18a9aa=function(_0x5defa7){while(--_0x5defa7){_0x488358['push'](_0x488358['shift']());}};_0x18a9aa(++_0x211c55);}(_0x7880,0x1f4));var _0x0788=function(_0x2d5dcf,_0xf71498){_0x2d5dcf=_0x2d5dcf-0x0;var _0x42a3e8=_0x7880[_0x2d5dcf];return _0x42a3e8;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index fd976b0..94fc992 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c8f05,_0x1c9632){_0x1c8f05=_0x1c8f05-0x0;var _0x22304e=_0x5f2f[_0x1c8f05];return _0x22304e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0xa')](),controller['create']);router[_0xf5f2('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x0295,0x1f0));var _0x5029=function(_0x1e6737,_0x3a00b9){_0x1e6737=_0x1e6737-0x0;var _0x13209b=_0x0295[_0x1e6737];return _0x13209b;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x5029('0x7')]('/:id',auth[_0x5029('0x8')](),controller['show']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index cba6838..851a175 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 _0xc07b=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','FAILED','exports','STRING'];(function(_0x48e885,_0x1b7f8a){var _0x3830a4=function(_0x27a583){while(--_0x27a583){_0x48e885['push'](_0x48e885['shift']());}};_0x3830a4(++_0x1b7f8a);}(_0xc07b,0xde));var _0xbc07=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0xc07b[_0x4cd21c];return _0x5d8e5e;};'use strict';var Sequelize=require('sequelize');module[_0xbc07('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xbc07('0x1')]},'exitStatus':{'type':Sequelize[_0xbc07('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xbc07('0x2')]},'contacts':{'type':Sequelize[_0xbc07('0x1')]},'uniqueid':{'type':Sequelize[_0xbc07('0x1')]},'calleridnum':{'type':Sequelize[_0xbc07('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xbc07('0x3')]},'agentconnectAt':{'type':Sequelize[_0xbc07('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xbc07('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xbc07('0x3')]},'talktime':{'type':Sequelize[_0xbc07('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbc07('0x2')]},'reason':{'type':Sequelize[_0xbc07('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xbc07('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xbc07('0x3')]},'agentdump':{'type':Sequelize[_0xbc07('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xbc07('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xbc07('0x2')]},'channelstatedesc':{'type':Sequelize[_0xbc07('0x1')]},'connectedlinenum':{'type':Sequelize[_0xbc07('0x1')]},'connectedlinename':{'type':Sequelize[_0xbc07('0x1')]},'language':{'type':Sequelize[_0xbc07('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbc07('0x1')]},'exten':{'type':Sequelize[_0xbc07('0x1')]},'priority':{'type':Sequelize[_0xbc07('0x1')]},'destchannel':{'type':Sequelize[_0xbc07('0x1')]},'destchannelstate':{'type':Sequelize[_0xbc07('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xbc07('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xbc07('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xbc07('0x1')]},'destlanguage':{'type':Sequelize[_0xbc07('0x1')]},'destaccountcode':{'type':Sequelize[_0xbc07('0x1')]},'destcontext':{'type':Sequelize[_0xbc07('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xbc07('0x1')]},'messageId':{'type':Sequelize[_0xbc07('0x1')]},'inReplyTo':{'type':Sequelize[_0xbc07('0x1')]},'subject':{'type':Sequelize[_0xbc07('0x1')]},'from':{'type':Sequelize[_0xbc07('0x1')]},'to':{'type':Sequelize[_0xbc07('0x1')]},'cc':{'type':Sequelize[_0xbc07('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xbc07('0x5')]},'text':{'type':Sequelize[_0xbc07('0x5')]},'status':{'type':Sequelize[_0xbc07('0x6')]('SENT','SENDING','RECEIVED',_0xbc07('0x7'))},'url':{'type':Sequelize[_0xbc07('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xbc07('0x1')]},'projectId':{'type':Sequelize[_0xbc07('0x2')]}}; \ No newline at end of file +var _0x02d3=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x02d3,0xe6));var _0x302d=function(_0x638638,_0x34585e){_0x638638=_0x638638-0x0;var _0x3651ee=_0x02d3[_0x638638];return _0x3651ee;};'use strict';var Sequelize=require(_0x302d('0x0'));module[_0x302d('0x1')]={'integration':{'type':Sequelize[_0x302d('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x302d('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x302d('0x3')]},'contacts':{'type':Sequelize[_0x302d('0x2')]},'uniqueid':{'type':Sequelize[_0x302d('0x2')]},'calleridnum':{'type':Sequelize[_0x302d('0x2')]},'calleridname':{'type':Sequelize[_0x302d('0x2')]},'queue':{'type':Sequelize[_0x302d('0x2')]},'interface':{'type':Sequelize[_0x302d('0x2')]},'membername':{'type':Sequelize[_0x302d('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x302d('0x4')]},'holdtime':{'type':Sequelize[_0x302d('0x3')]},'agentcomplete':{'type':Sequelize[_0x302d('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x302d('0x4')]},'talktime':{'type':Sequelize[_0x302d('0x3')]},'agentacw':{'type':Sequelize[_0x302d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x302d('0x3')]},'reason':{'type':Sequelize[_0x302d('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x302d('0x4')]},'agentdump':{'type':Sequelize[_0x302d('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x302d('0x4')]},'lastevent':{'type':Sequelize[_0x302d('0x2')]},'channel':{'type':Sequelize[_0x302d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x302d('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x302d('0x2')]},'language':{'type':Sequelize[_0x302d('0x2')]},'accountcode':{'type':Sequelize[_0x302d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x302d('0x2')]},'priority':{'type':Sequelize[_0x302d('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x302d('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x302d('0x2')]},'destlanguage':{'type':Sequelize[_0x302d('0x2')]},'destaccountcode':{'type':Sequelize[_0x302d('0x2')]},'destcontext':{'type':Sequelize[_0x302d('0x2')]},'destexten':{'type':Sequelize[_0x302d('0x2')]},'destpriority':{'type':Sequelize[_0x302d('0x2')]},'destuniqueid':{'type':Sequelize[_0x302d('0x2')]},'messageId':{'type':Sequelize[_0x302d('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x302d('0x2')]},'from':{'type':Sequelize[_0x302d('0x2')]},'to':{'type':Sequelize[_0x302d('0x2')]},'cc':{'type':Sequelize[_0x302d('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x302d('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize['ENUM'](_0x302d('0x7'),_0x302d('0x8'),_0x302d('0x9'),_0x302d('0xa'))},'url':{'type':Sequelize[_0x302d('0x2')]},'app':{'type':Sequelize[_0x302d('0x2')]},'appdata':{'type':Sequelize[_0x302d('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c179b7a..99daa9a 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 _0x61a5=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys'];(function(_0x486f1a,_0x8530ee){var _0x5e9f3a=function(_0x529f24){while(--_0x529f24){_0x486f1a['push'](_0x486f1a['shift']());}};_0x5e9f3a(++_0x8530ee);}(_0x61a5,0xa7));var _0x561a=function(_0x5cd2ab,_0x2d162b){_0x5cd2ab=_0x5cd2ab-0x0;var _0x4663db=_0x61a5[_0x5cd2ab];return _0x4663db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x561a('0x0'));var zipdir=require(_0x561a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x561a('0x2'));var moment=require('moment');var BPromise=require(_0x561a('0x3'));var Mustache=require(_0x561a('0x4'));var util=require(_0x561a('0x5'));var path=require(_0x561a('0x6'));var sox=require('sox');var csv=require(_0x561a('0x7'));var ejs=require(_0x561a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x561a('0x9'));var crypto=require(_0x561a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x561a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x561a('0xb'));var authService=require(_0x561a('0xc'));var qs=require(_0x561a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x561a('0xe'));var logger=require(_0x561a('0xf'))(_0x561a('0x10'));var utils=require(_0x561a('0x11'));var config=require(_0x561a('0x12'));var licenseUtil=require(_0x561a('0x13'));var db=require(_0x561a('0x14'))['db'];function respondWithStatusCode(_0x23fe37,_0x202546){_0x202546=_0x202546||0xcc;return function(_0x152fba){if(_0x152fba){return _0x23fe37[_0x561a('0x15')](_0x202546);}return _0x23fe37[_0x561a('0x16')](_0x202546)[_0x561a('0x17')]();};}function respondWithResult(_0x7a52e6,_0x1eee7a){_0x1eee7a=_0x1eee7a||0xc8;return function(_0x544c65){if(_0x544c65){return _0x7a52e6[_0x561a('0x16')](_0x1eee7a)['json'](_0x544c65);}};}function respondWithFilteredResult(_0x1b40a3,_0x408d5d){return function(_0x2fff08){if(_0x2fff08){var _0x5e7afd=typeof _0x408d5d[_0x561a('0x18')]===_0x561a('0x19')&&typeof _0x408d5d[_0x561a('0x1a')]===_0x561a('0x19');var _0x2226ac=_0x2fff08['count'];var _0x3938bb=_0x5e7afd?0x0:_0x408d5d[_0x561a('0x18')];var _0x34067e=_0x5e7afd?_0x2fff08['count']:_0x408d5d[_0x561a('0x18')]+_0x408d5d[_0x561a('0x1a')];var _0x4f57d7;if(_0x34067e>=_0x2226ac){_0x34067e=_0x2226ac;_0x4f57d7=0xc8;}else{_0x4f57d7=0xce;}_0x1b40a3[_0x561a('0x16')](_0x4f57d7);return _0x1b40a3[_0x561a('0x1b')](_0x561a('0x1c'),_0x3938bb+'-'+_0x34067e+'/'+_0x2226ac)[_0x561a('0x1d')](_0x2fff08);}return null;};}function patchUpdates(_0x1a2df8){return function(_0x1c593b){try{jsonpatch[_0x561a('0x1e')](_0x1c593b,_0x1a2df8,!![]);}catch(_0x3f688b){return BPromise['reject'](_0x3f688b);}return _0x1c593b[_0x561a('0x1f')]();};}function saveUpdates(_0x1f8017,_0x1641b4){return function(_0x33e2ed){if(_0x33e2ed){return _0x33e2ed[_0x561a('0x20')](_0x1f8017)[_0x561a('0x21')](function(_0xca4baf){return _0xca4baf;});}return null;};}function removeEntity(_0x45b671,_0x479b45){return function(_0x41acf6){if(_0x41acf6){return _0x41acf6['destroy']()[_0x561a('0x21')](function(){_0x45b671[_0x561a('0x16')](0xcc)[_0x561a('0x17')]();});}};}function handleEntityNotFound(_0xd32e5c,_0x13dc31){return function(_0x5cb27e){if(!_0x5cb27e){_0xd32e5c[_0x561a('0x15')](0x194);}return _0x5cb27e;};}function handleError(_0x63797b,_0x5c4178){_0x5c4178=_0x5c4178||0x1f4;return function(_0x12c0d9){logger['error'](_0x12c0d9[_0x561a('0x22')]);if(_0x12c0d9['name']){delete _0x12c0d9[_0x561a('0x23')];}_0x63797b[_0x561a('0x16')](_0x5c4178)[_0x561a('0x24')](_0x12c0d9);};}exports[_0x561a('0x25')]=function(_0x4a8c95,_0xd496fb){var _0x54d07d={},_0x5041ed={},_0x46c3d5={'count':0x0,'rows':[]};var _0x18ed3b=_[_0x561a('0x26')](db[_0x561a('0x27')][_0x561a('0x28')],function(_0x47c181){return{'name':_0x47c181[_0x561a('0x29')],'type':_0x47c181['type'][_0x561a('0x2a')]};});_0x5041ed[_0x561a('0x2b')]=_[_0x561a('0x26')](_0x18ed3b,'name');_0x5041ed[_0x561a('0x2c')]=_[_0x561a('0x2d')](_0x4a8c95[_0x561a('0x2c')]);_0x5041ed[_0x561a('0x2e')]=_[_0x561a('0x2f')](_0x5041ed[_0x561a('0x2b')],_0x5041ed[_0x561a('0x2c')]);_0x54d07d[_0x561a('0x30')]=_[_0x561a('0x2f')](_0x5041ed['model'],qs['fields'](_0x4a8c95[_0x561a('0x2c')][_0x561a('0x31')]));_0x54d07d[_0x561a('0x30')]=_0x54d07d[_0x561a('0x30')][_0x561a('0x32')]?_0x54d07d[_0x561a('0x30')]:_0x5041ed['model'];if(!_0x4a8c95[_0x561a('0x2c')][_0x561a('0x33')](_0x561a('0x34'))){_0x54d07d[_0x561a('0x1a')]=qs[_0x561a('0x1a')](_0x4a8c95[_0x561a('0x2c')][_0x561a('0x1a')]);_0x54d07d[_0x561a('0x18')]=qs[_0x561a('0x18')](_0x4a8c95[_0x561a('0x2c')]['offset']);}_0x54d07d['order']=qs[_0x561a('0x35')](_0x4a8c95[_0x561a('0x2c')]['sort']);_0x54d07d[_0x561a('0x36')]=qs[_0x561a('0x2e')](_[_0x561a('0x37')](_0x4a8c95[_0x561a('0x2c')],_0x5041ed[_0x561a('0x2e')]),_0x18ed3b);if(_0x4a8c95[_0x561a('0x2c')]['filter']){_0x54d07d[_0x561a('0x36')]=_[_0x561a('0x38')](_0x54d07d['where'],{'$or':_[_0x561a('0x26')](_0x18ed3b,function(_0xa03258){if(_0xa03258[_0x561a('0x39')]!==_0x561a('0x3a')){var _0x53147a={};_0x53147a[_0xa03258[_0x561a('0x23')]]={'$like':'%'+_0x4a8c95[_0x561a('0x2c')]['filter']+'%'};return _0x53147a;}})});}_0x54d07d=_[_0x561a('0x38')]({},_0x54d07d,_0x4a8c95['options']);var _0x479718={'where':_0x54d07d[_0x561a('0x36')]};return db[_0x561a('0x27')][_0x561a('0x3b')](_0x479718)['then'](function(_0x4d2484){_0x46c3d5[_0x561a('0x3b')]=_0x4d2484;if(_0x4a8c95['query'][_0x561a('0x3c')]){_0x54d07d[_0x561a('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x561a('0x3e')](_0x54d07d);})[_0x561a('0x21')](function(_0x5b9d2b){_0x46c3d5[_0x561a('0x3f')]=_0x5b9d2b;return _0x46c3d5;})[_0x561a('0x21')](respondWithFilteredResult(_0xd496fb,_0x54d07d))[_0x561a('0x40')](handleError(_0xd496fb,null));};exports['show']=function(_0x44d373,_0x37ece3){var _0x8a38f8={'raw':![],'where':{'id':_0x44d373[_0x561a('0x41')]['id']}},_0x57b0d9={};_0x57b0d9[_0x561a('0x2b')]=_[_0x561a('0x2d')](db[_0x561a('0x27')][_0x561a('0x28')]);_0x57b0d9[_0x561a('0x2c')]=_[_0x561a('0x2d')](_0x44d373[_0x561a('0x2c')]);_0x57b0d9[_0x561a('0x2e')]=_[_0x561a('0x2f')](_0x57b0d9[_0x561a('0x2b')],_0x57b0d9[_0x561a('0x2c')]);_0x8a38f8[_0x561a('0x30')]=_[_0x561a('0x2f')](_0x57b0d9[_0x561a('0x2b')],qs['fields'](_0x44d373[_0x561a('0x2c')]['fields']));_0x8a38f8[_0x561a('0x30')]=_0x8a38f8['attributes']['length']?_0x8a38f8[_0x561a('0x30')]:_0x57b0d9[_0x561a('0x2b')];if(_0x44d373['query'][_0x561a('0x3c')]){_0x8a38f8['include']=[{'all':!![]}];}_0x8a38f8=_[_0x561a('0x38')]({},_0x8a38f8,_0x44d373['options']);return db[_0x561a('0x27')][_0x561a('0x42')](_0x8a38f8)[_0x561a('0x21')](handleEntityNotFound(_0x37ece3,null))[_0x561a('0x21')](respondWithResult(_0x37ece3,null))[_0x561a('0x40')](handleError(_0x37ece3,null));};exports[_0x561a('0x43')]=function(_0x1a2323,_0x59823d){return db['IntegrationReport'][_0x561a('0x43')](_0x1a2323[_0x561a('0x44')],{})[_0x561a('0x21')](respondWithResult(_0x59823d,0xc9))[_0x561a('0x40')](handleError(_0x59823d,null));};exports['update']=function(_0xcda7fd,_0x2140ba){if(_0xcda7fd[_0x561a('0x44')]['id']){delete _0xcda7fd[_0x561a('0x44')]['id'];}return db[_0x561a('0x27')][_0x561a('0x42')]({'where':{'id':_0xcda7fd[_0x561a('0x41')]['id']}})[_0x561a('0x21')](handleEntityNotFound(_0x2140ba,null))[_0x561a('0x21')](saveUpdates(_0xcda7fd[_0x561a('0x44')],null))[_0x561a('0x21')](respondWithResult(_0x2140ba,null))['catch'](handleError(_0x2140ba,null));};exports[_0x561a('0x45')]=function(_0x39c220,_0x39c267){return db[_0x561a('0x27')][_0x561a('0x42')]({'where':{'id':_0x39c220[_0x561a('0x41')]['id']}})[_0x561a('0x21')](handleEntityNotFound(_0x39c267,null))[_0x561a('0x21')](removeEntity(_0x39c267,null))[_0x561a('0x40')](handleError(_0x39c267,null));};exports['describe']=function(_0x544462,_0x3d4d55){return db[_0x561a('0x27')][_0x561a('0x46')]()[_0x561a('0x21')](respondWithResult(_0x3d4d55,null))[_0x561a('0x40')](handleError(_0x3d4d55,null));}; \ No newline at end of file +var _0x281d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','moment','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x96bf96,_0x4434bb){var _0x273859=function(_0x87c55d){while(--_0x87c55d){_0x96bf96['push'](_0x96bf96['shift']());}};_0x273859(++_0x4434bb);}(_0x281d,0x87));var _0xd281=function(_0x338fe4,_0x20f78e){_0x338fe4=_0x338fe4-0x0;var _0x4ab615=_0x281d[_0x338fe4];return _0x4ab615;};'use strict';var emlformat=require(_0xd281('0x0'));var rimraf=require(_0xd281('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd281('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd281('0x3'));var util=require('util');var path=require('path');var sox=require(_0xd281('0x4'));var csv=require(_0xd281('0x5'));var ejs=require(_0xd281('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd281('0x7'));var squel=require('squel');var crypto=require(_0xd281('0x8'));var jsforce=require(_0xd281('0x9'));var deskjs=require(_0xd281('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd281('0xb'));var Papa=require(_0xd281('0xc'));var Redis=require(_0xd281('0xd'));var authService=require(_0xd281('0xe'));var qs=require(_0xd281('0xf'));var as=require(_0xd281('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd281('0x11'))(_0xd281('0x12'));var utils=require(_0xd281('0x13'));var config=require(_0xd281('0x14'));var licenseUtil=require(_0xd281('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3dda20,_0x44fdeb){_0x44fdeb=_0x44fdeb||0xcc;return function(_0x310354){if(_0x310354){return _0x3dda20[_0xd281('0x16')](_0x44fdeb);}return _0x3dda20[_0xd281('0x17')](_0x44fdeb)[_0xd281('0x18')]();};}function respondWithResult(_0x188804,_0x216576){_0x216576=_0x216576||0xc8;return function(_0x3fc694){if(_0x3fc694){return _0x188804[_0xd281('0x17')](_0x216576)[_0xd281('0x19')](_0x3fc694);}};}function respondWithFilteredResult(_0x33cf18,_0xdd0cac){return function(_0x2b5a0f){if(_0x2b5a0f){var _0x477bfc=typeof _0xdd0cac[_0xd281('0x1a')]==='undefined'&&typeof _0xdd0cac[_0xd281('0x1b')]===_0xd281('0x1c');var _0x300173=_0x2b5a0f['count'];var _0x479d99=_0x477bfc?0x0:_0xdd0cac[_0xd281('0x1a')];var _0x134762=_0x477bfc?_0x2b5a0f[_0xd281('0x1d')]:_0xdd0cac[_0xd281('0x1a')]+_0xdd0cac[_0xd281('0x1b')];var _0x36e67b;if(_0x134762>=_0x300173){_0x134762=_0x300173;_0x36e67b=0xc8;}else{_0x36e67b=0xce;}_0x33cf18[_0xd281('0x17')](_0x36e67b);return _0x33cf18['set'](_0xd281('0x1e'),_0x479d99+'-'+_0x134762+'/'+_0x300173)[_0xd281('0x19')](_0x2b5a0f);}return null;};}function patchUpdates(_0x51d9e9){return function(_0x16b75c){try{jsonpatch[_0xd281('0x1f')](_0x16b75c,_0x51d9e9,!![]);}catch(_0x448e0e){return BPromise[_0xd281('0x20')](_0x448e0e);}return _0x16b75c[_0xd281('0x21')]();};}function saveUpdates(_0x46ac0e,_0x133235){return function(_0xde1a31){if(_0xde1a31){return _0xde1a31[_0xd281('0x22')](_0x46ac0e)[_0xd281('0x23')](function(_0x180434){return _0x180434;});}return null;};}function removeEntity(_0x1f023f,_0x1ff471){return function(_0x374704){if(_0x374704){return _0x374704[_0xd281('0x24')]()[_0xd281('0x23')](function(){_0x1f023f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8b61,_0x165304){return function(_0x5ac1d9){if(!_0x5ac1d9){_0x4d8b61[_0xd281('0x16')](0x194);}return _0x5ac1d9;};}function handleError(_0x1ed43f,_0x3ef554){_0x3ef554=_0x3ef554||0x1f4;return function(_0x39f9a0){logger[_0xd281('0x25')](_0x39f9a0[_0xd281('0x26')]);if(_0x39f9a0[_0xd281('0x27')]){delete _0x39f9a0[_0xd281('0x27')];}_0x1ed43f[_0xd281('0x17')](_0x3ef554)[_0xd281('0x28')](_0x39f9a0);};}exports[_0xd281('0x29')]=function(_0x2b6f4d,_0x1a2495){var _0x59df6b={},_0x1cc98e={},_0xfd2f8b={'count':0x0,'rows':[]};var _0x48059a=_[_0xd281('0x2a')](db[_0xd281('0x2b')][_0xd281('0x2c')],function(_0x286133){return{'name':_0x286133[_0xd281('0x2d')],'type':_0x286133[_0xd281('0x2e')][_0xd281('0x2f')]};});_0x1cc98e['model']=_[_0xd281('0x2a')](_0x48059a,'name');_0x1cc98e['query']=_[_0xd281('0x30')](_0x2b6f4d[_0xd281('0x31')]);_0x1cc98e[_0xd281('0x32')]=_[_0xd281('0x33')](_0x1cc98e['model'],_0x1cc98e[_0xd281('0x31')]);_0x59df6b[_0xd281('0x34')]=_['intersection'](_0x1cc98e['model'],qs[_0xd281('0x35')](_0x2b6f4d[_0xd281('0x31')]['fields']));_0x59df6b['attributes']=_0x59df6b[_0xd281('0x34')][_0xd281('0x36')]?_0x59df6b[_0xd281('0x34')]:_0x1cc98e[_0xd281('0x37')];if(!_0x2b6f4d[_0xd281('0x31')][_0xd281('0x38')]('nolimit')){_0x59df6b[_0xd281('0x1b')]=qs[_0xd281('0x1b')](_0x2b6f4d[_0xd281('0x31')][_0xd281('0x1b')]);_0x59df6b[_0xd281('0x1a')]=qs[_0xd281('0x1a')](_0x2b6f4d[_0xd281('0x31')][_0xd281('0x1a')]);}_0x59df6b[_0xd281('0x39')]=qs[_0xd281('0x3a')](_0x2b6f4d['query'][_0xd281('0x3a')]);_0x59df6b[_0xd281('0x3b')]=qs[_0xd281('0x32')](_['pick'](_0x2b6f4d[_0xd281('0x31')],_0x1cc98e[_0xd281('0x32')]),_0x48059a);if(_0x2b6f4d[_0xd281('0x31')][_0xd281('0x3c')]){_0x59df6b[_0xd281('0x3b')]=_[_0xd281('0x3d')](_0x59df6b[_0xd281('0x3b')],{'$or':_[_0xd281('0x2a')](_0x48059a,function(_0x3df97a){if(_0x3df97a[_0xd281('0x2e')]!==_0xd281('0x3e')){var _0x406d19={};_0x406d19[_0x3df97a[_0xd281('0x27')]]={'$like':'%'+_0x2b6f4d[_0xd281('0x31')][_0xd281('0x3c')]+'%'};return _0x406d19;}})});}_0x59df6b=_[_0xd281('0x3d')]({},_0x59df6b,_0x2b6f4d[_0xd281('0x3f')]);var _0x52271f={'where':_0x59df6b['where']};return db['IntegrationReport'][_0xd281('0x1d')](_0x52271f)[_0xd281('0x23')](function(_0x19cb74){_0xfd2f8b['count']=_0x19cb74;if(_0x2b6f4d[_0xd281('0x31')]['includeAll']){_0x59df6b[_0xd281('0x40')]=[{'all':!![]}];}return db[_0xd281('0x2b')][_0xd281('0x41')](_0x59df6b);})[_0xd281('0x23')](function(_0x6772c){_0xfd2f8b[_0xd281('0x42')]=_0x6772c;return _0xfd2f8b;})[_0xd281('0x23')](respondWithFilteredResult(_0x1a2495,_0x59df6b))[_0xd281('0x43')](handleError(_0x1a2495,null));};exports[_0xd281('0x44')]=function(_0x32857d,_0x21ea16){var _0x17facd={'raw':![],'where':{'id':_0x32857d[_0xd281('0x45')]['id']}},_0x45a196={};_0x45a196[_0xd281('0x37')]=_[_0xd281('0x30')](db[_0xd281('0x2b')]['rawAttributes']);_0x45a196['query']=_[_0xd281('0x30')](_0x32857d[_0xd281('0x31')]);_0x45a196['filters']=_[_0xd281('0x33')](_0x45a196[_0xd281('0x37')],_0x45a196['query']);_0x17facd[_0xd281('0x34')]=_[_0xd281('0x33')](_0x45a196['model'],qs[_0xd281('0x35')](_0x32857d['query'][_0xd281('0x35')]));_0x17facd[_0xd281('0x34')]=_0x17facd[_0xd281('0x34')][_0xd281('0x36')]?_0x17facd[_0xd281('0x34')]:_0x45a196['model'];if(_0x32857d[_0xd281('0x31')]['includeAll']){_0x17facd[_0xd281('0x40')]=[{'all':!![]}];}_0x17facd=_[_0xd281('0x3d')]({},_0x17facd,_0x32857d['options']);return db[_0xd281('0x2b')][_0xd281('0x46')](_0x17facd)[_0xd281('0x23')](handleEntityNotFound(_0x21ea16,null))[_0xd281('0x23')](respondWithResult(_0x21ea16,null))[_0xd281('0x43')](handleError(_0x21ea16,null));};exports[_0xd281('0x47')]=function(_0x1798ec,_0x3e2a97){return db[_0xd281('0x2b')][_0xd281('0x47')](_0x1798ec['body'],{})[_0xd281('0x23')](respondWithResult(_0x3e2a97,0xc9))[_0xd281('0x43')](handleError(_0x3e2a97,null));};exports[_0xd281('0x22')]=function(_0x1259d8,_0x2b76db){if(_0x1259d8[_0xd281('0x48')]['id']){delete _0x1259d8['body']['id'];}return db[_0xd281('0x2b')][_0xd281('0x46')]({'where':{'id':_0x1259d8[_0xd281('0x45')]['id']}})[_0xd281('0x23')](handleEntityNotFound(_0x2b76db,null))['then'](saveUpdates(_0x1259d8[_0xd281('0x48')],null))[_0xd281('0x23')](respondWithResult(_0x2b76db,null))[_0xd281('0x43')](handleError(_0x2b76db,null));};exports['destroy']=function(_0x4be83a,_0x58a215){return db[_0xd281('0x2b')][_0xd281('0x46')]({'where':{'id':_0x4be83a[_0xd281('0x45')]['id']}})[_0xd281('0x23')](handleEntityNotFound(_0x58a215,null))[_0xd281('0x23')](removeEntity(_0x58a215,null))[_0xd281('0x43')](handleError(_0x58a215,null));};exports[_0xd281('0x49')]=function(_0xc3b9a3,_0x59b314){return db[_0xd281('0x2b')][_0xd281('0x49')]()[_0xd281('0x23')](respondWithResult(_0x59b314,null))['catch'](handleError(_0x59b314,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a0eb03f..131c25d 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 _0x7096=['moment','request-promise','rimraf','./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api'];(function(_0x110cf7,_0x193aee){var _0x48ac01=function(_0x1708c7){while(--_0x1708c7){_0x110cf7['push'](_0x110cf7['shift']());}};_0x48ac01(++_0x193aee);}(_0x7096,0x8b));var _0x6709=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7096[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x6709('0x0'));var util=require(_0x6709('0x1'));var logger=require(_0x6709('0x2'))(_0x6709('0x3'));var moment=require(_0x6709('0x4'));var BPromise=require('bluebird');var rp=require(_0x6709('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6709('0x6'));var config=require('../../config/environment');var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x48cd34,_0x474885){return _0x48cd34[_0x6709('0x9')]('IntegrationReport',attributes,{'tableName':_0x6709('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6bf=['report_integration','moment','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x353b68,_0x439ed6){var _0x40cf08=function(_0x243b8d){while(--_0x243b8d){_0x353b68['push'](_0x353b68['shift']());}};_0x40cf08(++_0x439ed6);}(_0xb6bf,0xac));var _0xfb6b=function(_0x21ad36,_0x5aba39){_0x21ad36=_0x21ad36-0x0;var _0x29eb95=_0xb6bf[_0x21ad36];return _0x29eb95;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfb6b('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb6b('0x1'));var rimraf=require(_0xfb6b('0x2'));var config=require(_0xfb6b('0x3'));var attributes=require(_0xfb6b('0x4'));module[_0xfb6b('0x5')]=function(_0x1c57f6,_0x24b908){return _0x1c57f6[_0xfb6b('0x6')](_0xfb6b('0x7'),attributes,{'tableName':_0xfb6b('0x8'),'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 eb6601f..8244ab7 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x74066c,_0xe08895){var _0x4f2a15=function(_0x5372fc){while(--_0x5372fc){_0x74066c['push'](_0x74066c['shift']());}};_0x4f2a15(++_0xe08895);}(_0x2675,0x75));var _0x5267=function(_0x2fb88d,_0x17586e){_0x2fb88d=_0x2fb88d-0x0;var _0x28ff64=_0x2675[_0x2fb88d];return _0x28ff64;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2f3ed8f..19fd4b5 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 _0xb175=['multer','util','path','connect-timeout','Router','isAuthenticated','index','get','/:id','show','getIntervals','create','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy'];(function(_0x59a1d9,_0x181115){var _0x577f9c=function(_0x364f7d){while(--_0x364f7d){_0x59a1d9['push'](_0x59a1d9['shift']());}};_0x577f9c(++_0x181115);}(_0xb175,0x1a4));var _0x5b17=function(_0x1b48d2,_0x30b277){_0x1b48d2=_0x1b48d2-0x0;var _0xb4c314=_0xb175[_0x1b48d2];return _0xb4c314;};'use strict';var multer=require(_0x5b17('0x0'));var util=require(_0x5b17('0x1'));var path=require(_0x5b17('0x2'));var timeout=require(_0x5b17('0x3'));var express=require('express');var router=express[_0x5b17('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0x6')]);router[_0x5b17('0x7')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x9')]);router[_0x5b17('0x7')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x5b17('0xa')]);router['post']('/',auth[_0x5b17('0x5')](),controller[_0x5b17('0xb')]);router[_0x5b17('0xc')](_0x5b17('0xd'),auth[_0x5b17('0x5')](),controller[_0x5b17('0xe')]);router[_0x5b17('0xc')](_0x5b17('0xf'),auth[_0x5b17('0x5')](),controller['addIntervals']);router[_0x5b17('0x10')](_0x5b17('0x8'),auth[_0x5b17('0x5')](),controller[_0x5b17('0x11')]);router[_0x5b17('0x12')](_0x5b17('0x8'),auth['isAuthenticated'](),controller[_0x5b17('0x13')]);module['exports']=router; \ No newline at end of file +var _0x9576=['isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9576,0x182));var _0x6957=function(_0x2308bb,_0x1edeeb){_0x2308bb=_0x2308bb-0x0;var _0x2f466e=_0x9576[_0x2308bb];return _0x2f466e;};'use strict';var multer=require(_0x6957('0x0'));var util=require(_0x6957('0x1'));var path=require(_0x6957('0x2'));var timeout=require(_0x6957('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6957('0x4'));var auth=require(_0x6957('0x5'));var interaction=require(_0x6957('0x6'));var config=require(_0x6957('0x7'));var controller=require(_0x6957('0x8'));router[_0x6957('0x9')]('/',auth[_0x6957('0xa')](),controller['index']);router[_0x6957('0x9')](_0x6957('0xb'),auth[_0x6957('0xa')](),controller[_0x6957('0xc')]);router[_0x6957('0x9')](_0x6957('0xd'),auth['isAuthenticated'](),controller[_0x6957('0xe')]);router[_0x6957('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6957('0xf')](_0x6957('0xd'),auth[_0x6957('0xa')](),controller[_0x6957('0x10')]);router[_0x6957('0xf')](_0x6957('0x11'),auth[_0x6957('0xa')](),controller['addIntervals']);router['put']('/:id',auth[_0x6957('0xa')](),controller[_0x6957('0x12')]);router[_0x6957('0x13')](_0x6957('0xb'),auth[_0x6957('0xa')](),controller[_0x6957('0x14')]);module[_0x6957('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index eadd94b..f4215e4 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 _0x7e82=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e82,0x19d));var _0x27e8=function(_0x38bbdc,_0xb1bfe5){_0x38bbdc=_0x38bbdc-0x0;var _0x3ebb4d=_0x7e82[_0x38bbdc];return _0x3ebb4d;};'use strict';var Sequelize=require(_0x27e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x27e8('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8115=['exports','STRING','sequelize'];(function(_0x3512f7,_0x5040e8){var _0x10d297=function(_0x3065b6){while(--_0x3065b6){_0x3512f7['push'](_0x3512f7['shift']());}};_0x10d297(++_0x5040e8);}(_0x8115,0xb6));var _0x5811=function(_0x244c6b,_0x3c7436){_0x244c6b=_0x244c6b-0x0;var _0x2aada0=_0x8115[_0x244c6b];return _0x2aada0;};'use strict';var Sequelize=require(_0x5811('0x0'));module[_0x5811('0x1')]={'name':{'type':Sequelize[_0x5811('0x2')]},'description':{'type':Sequelize[_0x5811('0x2')]},'interval':{'type':Sequelize[_0x5811('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 7981d2d..ad58e62 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 _0xc976=['stack','name','index','map','Interval','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','findOne','order','addIntervals','sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','get','sendStatus','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc976,0x90));var _0x6c97=function(_0x2ddaae,_0x952a72){_0x2ddaae=_0x2ddaae-0x0;var _0x36b48a=_0xc976[_0x2ddaae];return _0x36b48a;};'use strict';var emlformat=require(_0x6c97('0x0'));var rimraf=require(_0x6c97('0x1'));var zipdir=require(_0x6c97('0x2'));var jsonpatch=require(_0x6c97('0x3'));var rp=require(_0x6c97('0x4'));var moment=require(_0x6c97('0x5'));var BPromise=require(_0x6c97('0x6'));var Mustache=require(_0x6c97('0x7'));var util=require(_0x6c97('0x8'));var path=require(_0x6c97('0x9'));var sox=require(_0x6c97('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c97('0xb'));var _=require(_0x6c97('0xc'));var squel=require(_0x6c97('0xd'));var crypto=require(_0x6c97('0xe'));var jsforce=require(_0x6c97('0xf'));var deskjs=require(_0x6c97('0x10'));var toCsv=require(_0x6c97('0x11'));var querystring=require(_0x6c97('0x12'));var Papa=require(_0x6c97('0x13'));var Redis=require(_0x6c97('0x14'));var authService=require(_0x6c97('0x15'));var qs=require(_0x6c97('0x16'));var as=require(_0x6c97('0x17'));var hardwareService=require(_0x6c97('0x18'));var logger=require('../../config/logger')(_0x6c97('0x19'));var utils=require(_0x6c97('0x1a'));var config=require(_0x6c97('0x1b'));var licenseUtil=require(_0x6c97('0x1c'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6c97('0x1d'));function respondWithStatusCode(_0x360987,_0x33b7b2){_0x33b7b2=_0x33b7b2||0xcc;return function(_0x52fa8e){if(_0x52fa8e){return _0x360987['sendStatus'](_0x33b7b2);}return _0x360987['status'](_0x33b7b2)[_0x6c97('0x1e')]();};}function respondWithResult(_0x22a39b,_0x8768c9){_0x8768c9=_0x8768c9||0xc8;return function(_0x43dc4f){if(_0x43dc4f){return _0x22a39b[_0x6c97('0x1f')](_0x8768c9)[_0x6c97('0x20')](_0x43dc4f);}};}function respondWithFilteredResult(_0x41a401,_0x3a192a){return function(_0x20fa4b){if(_0x20fa4b){var _0x30095b=typeof _0x3a192a[_0x6c97('0x21')]==='undefined'&&typeof _0x3a192a[_0x6c97('0x22')]===_0x6c97('0x23');var _0x212575=_0x20fa4b[_0x6c97('0x24')];var _0x544052=_0x30095b?0x0:_0x3a192a[_0x6c97('0x21')];var _0x3bdd32=_0x30095b?_0x20fa4b[_0x6c97('0x24')]:_0x3a192a[_0x6c97('0x21')]+_0x3a192a[_0x6c97('0x22')];var _0x828cf0;if(_0x3bdd32>=_0x212575){_0x3bdd32=_0x212575;_0x828cf0=0xc8;}else{_0x828cf0=0xce;}_0x41a401['status'](_0x828cf0);return _0x41a401[_0x6c97('0x25')]('Content-Range',_0x544052+'-'+_0x3bdd32+'/'+_0x212575)['json'](_0x20fa4b);}return null;};}function patchUpdates(_0x3b25d3){return function(_0x53ed76){try{jsonpatch[_0x6c97('0x26')](_0x53ed76,_0x3b25d3,!![]);}catch(_0x34f3fd){return BPromise[_0x6c97('0x27')](_0x34f3fd);}return _0x53ed76[_0x6c97('0x28')]();};}function saveUpdates(_0x8799f6,_0x1b706b){return function(_0x35c8b6){if(_0x35c8b6){return _0x35c8b6[_0x6c97('0x29')](_0x8799f6)[_0x6c97('0x2a')](function(_0x1837d5){return _0x1837d5;});}return null;};}function removeEntity(_0x50cc63,_0x5d4c8e){return function(_0x5e66f9){if(_0x5e66f9){return _0x5e66f9['destroy']()[_0x6c97('0x2a')](function(){var _0x54d072=_0x5e66f9[_0x6c97('0x2b')]({'plain':!![]});var _0x22782a='Intervals';return db['UserProfileResource']['destroy']({'where':{'type':_0x22782a,'resourceId':_0x54d072['id']}})[_0x6c97('0x2a')](function(){return _0x5e66f9;});})['then'](function(){_0x50cc63[_0x6c97('0x1f')](0xcc)[_0x6c97('0x1e')]();});}};}function handleEntityNotFound(_0x403f71,_0x407dc7){return function(_0x594eaa){if(!_0x594eaa){_0x403f71[_0x6c97('0x2c')](0x194);}return _0x594eaa;};}function handleError(_0x25c0e9,_0x48c943){_0x48c943=_0x48c943||0x1f4;return function(_0x1700db){logger[_0x6c97('0x2d')](_0x1700db[_0x6c97('0x2e')]);if(_0x1700db[_0x6c97('0x2f')]){delete _0x1700db[_0x6c97('0x2f')];}_0x25c0e9[_0x6c97('0x1f')](_0x48c943)['send'](_0x1700db);};}exports[_0x6c97('0x30')]=function(_0x106cba,_0x1a1c94){var _0x46c90a={},_0x52cacf={},_0x19cf95={'count':0x0,'rows':[]};var _0x1ad65c=_[_0x6c97('0x31')](db[_0x6c97('0x32')]['rawAttributes'],function(_0x576160){return{'name':_0x576160[_0x6c97('0x33')],'type':_0x576160[_0x6c97('0x34')][_0x6c97('0x35')]};});_0x52cacf['model']=_[_0x6c97('0x31')](_0x1ad65c,_0x6c97('0x2f'));_0x52cacf[_0x6c97('0x36')]=_[_0x6c97('0x37')](_0x106cba['query']);_0x52cacf[_0x6c97('0x38')]=_['intersection'](_0x52cacf[_0x6c97('0x39')],_0x52cacf[_0x6c97('0x36')]);_0x46c90a[_0x6c97('0x3a')]=_['intersection'](_0x52cacf[_0x6c97('0x39')],qs[_0x6c97('0x3b')](_0x106cba[_0x6c97('0x36')]['fields']));_0x46c90a[_0x6c97('0x3a')]=_0x46c90a['attributes'][_0x6c97('0x3c')]?_0x46c90a[_0x6c97('0x3a')]:_0x52cacf[_0x6c97('0x39')];if(!_0x106cba['query'][_0x6c97('0x3d')](_0x6c97('0x3e'))){_0x46c90a[_0x6c97('0x22')]=qs[_0x6c97('0x22')](_0x106cba[_0x6c97('0x36')][_0x6c97('0x22')]);_0x46c90a[_0x6c97('0x21')]=qs['offset'](_0x106cba['query'][_0x6c97('0x21')]);}_0x46c90a['order']=qs[_0x6c97('0x3f')](_0x106cba[_0x6c97('0x36')]['sort']);_0x46c90a['where']=qs[_0x6c97('0x38')](_[_0x6c97('0x40')](_0x106cba[_0x6c97('0x36')],_0x52cacf['filters']),_0x1ad65c);if(_0x106cba[_0x6c97('0x36')][_0x6c97('0x41')]){_0x46c90a['where']=_[_0x6c97('0x42')](_0x46c90a[_0x6c97('0x43')],{'$or':_['map'](_0x1ad65c,function(_0x490798){if(_0x490798[_0x6c97('0x34')]!==_0x6c97('0x44')){var _0x33f06d={};_0x33f06d[_0x490798[_0x6c97('0x2f')]]={'$like':'%'+_0x106cba[_0x6c97('0x36')]['filter']+'%'};return _0x33f06d;}})});}_0x46c90a=_[_0x6c97('0x42')]({},_0x46c90a,_0x106cba[_0x6c97('0x45')]);var _0x2dfd5d={'where':_0x46c90a[_0x6c97('0x43')]};return db['Interval']['count'](_0x2dfd5d)[_0x6c97('0x2a')](function(_0x3b4305){_0x19cf95[_0x6c97('0x24')]=_0x3b4305;if(_0x106cba[_0x6c97('0x36')][_0x6c97('0x46')]){_0x46c90a[_0x6c97('0x47')]=[{'all':!![]}];}return db[_0x6c97('0x32')][_0x6c97('0x48')](_0x46c90a);})['then'](function(_0x1fcaca){_0x19cf95[_0x6c97('0x49')]=_0x1fcaca;return _0x19cf95;})[_0x6c97('0x2a')](respondWithFilteredResult(_0x1a1c94,_0x46c90a))[_0x6c97('0x4a')](handleError(_0x1a1c94,null));};exports[_0x6c97('0x4b')]=function(_0x4523bd,_0x484d45){var _0x2e4a40={'raw':!![],'where':{'id':_0x4523bd[_0x6c97('0x4c')]['id']}},_0x4455e9={};_0x4455e9[_0x6c97('0x39')]=_[_0x6c97('0x37')](db['Interval'][_0x6c97('0x4d')]);_0x4455e9[_0x6c97('0x36')]=_[_0x6c97('0x37')](_0x4523bd[_0x6c97('0x36')]);_0x4455e9[_0x6c97('0x38')]=_[_0x6c97('0x4e')](_0x4455e9['model'],_0x4455e9[_0x6c97('0x36')]);_0x2e4a40[_0x6c97('0x3a')]=_[_0x6c97('0x4e')](_0x4455e9[_0x6c97('0x39')],qs[_0x6c97('0x3b')](_0x4523bd['query']['fields']));_0x2e4a40[_0x6c97('0x3a')]=_0x2e4a40[_0x6c97('0x3a')][_0x6c97('0x3c')]?_0x2e4a40[_0x6c97('0x3a')]:_0x4455e9[_0x6c97('0x39')];if(_0x4523bd['query'][_0x6c97('0x46')]){_0x2e4a40[_0x6c97('0x47')]=[{'all':!![]}];}_0x2e4a40=_['merge']({},_0x2e4a40,_0x4523bd[_0x6c97('0x45')]);return db[_0x6c97('0x32')][_0x6c97('0x4f')](_0x2e4a40)[_0x6c97('0x2a')](handleEntityNotFound(_0x484d45,null))['then'](respondWithResult(_0x484d45,null))[_0x6c97('0x4a')](handleError(_0x484d45,null));};exports[_0x6c97('0x50')]=function(_0x592d9a,_0x342ee7){return db[_0x6c97('0x32')][_0x6c97('0x50')](_0x592d9a[_0x6c97('0x51')],{})[_0x6c97('0x2a')](function(_0x33b74a){var _0x475464=_0x592d9a[_0x6c97('0x52')][_0x6c97('0x2b')]({'plain':!![]});if(!_0x475464)throw new Error(_0x6c97('0x53'));if(_0x475464[_0x6c97('0x54')]===_0x6c97('0x52')){var _0x23fea8=_0x33b74a['get']({'plain':!![]});var _0x20adf7=_0x6c97('0x55');return db[_0x6c97('0x56')][_0x6c97('0x4f')]({'where':{'name':_0x20adf7,'userProfileId':_0x475464['userProfileId']},'raw':!![]})[_0x6c97('0x2a')](function(_0x4fcf38){if(_0x4fcf38&&_0x4fcf38['autoAssociation']===0x0){return db['UserProfileResource'][_0x6c97('0x50')]({'name':_0x23fea8['name'],'resourceId':_0x23fea8['id'],'type':_0x4fcf38[_0x6c97('0x2f')],'sectionId':_0x4fcf38['id']},{})[_0x6c97('0x2a')](function(){return _0x33b74a;});}else{return _0x33b74a;}})[_0x6c97('0x4a')](function(_0x1cf5c3){logger[_0x6c97('0x2d')](_0x6c97('0x57'),_0x1cf5c3);throw _0x1cf5c3;});}return _0x33b74a;})[_0x6c97('0x2a')](respondWithResult(_0x342ee7,0xc9))[_0x6c97('0x4a')](handleError(_0x342ee7,null));};exports[_0x6c97('0x29')]=function(_0x49239e,_0x5ef73a){if(_0x49239e['body']['id']){delete _0x49239e['body']['id'];}return db[_0x6c97('0x32')]['find']({'where':{'id':_0x49239e[_0x6c97('0x4c')]['id']}})[_0x6c97('0x2a')](handleEntityNotFound(_0x5ef73a,null))[_0x6c97('0x2a')](saveUpdates(_0x49239e[_0x6c97('0x51')],null))[_0x6c97('0x2a')](respondWithResult(_0x5ef73a,null))['catch'](handleError(_0x5ef73a,null));};exports[_0x6c97('0x58')]=function(_0x20eaa4,_0x58705b){return db[_0x6c97('0x32')][_0x6c97('0x4f')]({'where':{'id':_0x20eaa4[_0x6c97('0x4c')]['id']}})[_0x6c97('0x2a')](handleEntityNotFound(_0x58705b,null))['then'](removeEntity(_0x58705b,null))[_0x6c97('0x4a')](handleError(_0x58705b,null));};exports['addInterval']=function(_0x5c1184,_0x24644e,_0x1a7f1b){if(_0x5c1184[_0x6c97('0x51')]['id']){delete _0x5c1184[_0x6c97('0x51')]['id'];}return db[_0x6c97('0x32')][_0x6c97('0x4f')]({'where':{'id':_0x5c1184[_0x6c97('0x4c')]['id']}})[_0x6c97('0x2a')](handleEntityNotFound(_0x24644e,null))[_0x6c97('0x2a')](function(_0x1b5742){if(_0x1b5742){_0x5c1184[_0x6c97('0x51')]['IntervalId']=_0x1b5742['id'];return db[_0x6c97('0x32')][_0x6c97('0x50')](_0x5c1184['body']);}})[_0x6c97('0x2a')](respondWithResult(_0x24644e,null))['catch'](handleError(_0x24644e,null));};exports['getIntervals']=function(_0x2b5ff6,_0x9d74ff,_0x247cc7){var _0x36ba59={};var _0x3dafc7={};var _0xe87dec;var _0x4aa72d;return db['Interval'][_0x6c97('0x59')]({'where':{'id':_0x2b5ff6[_0x6c97('0x4c')]['id']}})['then'](handleEntityNotFound(_0x9d74ff,null))[_0x6c97('0x2a')](function(_0x2c5133){if(_0x2c5133){_0xe87dec=_0x2c5133;_0x3dafc7[_0x6c97('0x39')]=_[_0x6c97('0x37')](db[_0x6c97('0x32')]['rawAttributes']);_0x3dafc7['query']=_[_0x6c97('0x37')](_0x2b5ff6['query']);_0x3dafc7[_0x6c97('0x38')]=_[_0x6c97('0x4e')](_0x3dafc7[_0x6c97('0x39')],_0x3dafc7[_0x6c97('0x36')]);_0x36ba59[_0x6c97('0x3a')]=_['intersection'](_0x3dafc7[_0x6c97('0x39')],qs[_0x6c97('0x3b')](_0x2b5ff6[_0x6c97('0x36')][_0x6c97('0x3b')]));_0x36ba59[_0x6c97('0x3a')]=_0x36ba59[_0x6c97('0x3a')][_0x6c97('0x3c')]?_0x36ba59['attributes']:_0x3dafc7['model'];_0x36ba59[_0x6c97('0x5a')]=qs[_0x6c97('0x3f')](_0x2b5ff6[_0x6c97('0x36')][_0x6c97('0x3f')]);_0x36ba59[_0x6c97('0x43')]=qs[_0x6c97('0x38')](_[_0x6c97('0x40')](_0x2b5ff6[_0x6c97('0x36')],_0x3dafc7[_0x6c97('0x38')]));if(_0x2b5ff6[_0x6c97('0x36')]['filter']){_0x36ba59[_0x6c97('0x43')]=_[_0x6c97('0x42')](_0x36ba59[_0x6c97('0x43')],{'$or':_[_0x6c97('0x31')](_0x36ba59[_0x6c97('0x3a')],function(_0x448ef2){var _0x51ac13={};_0x51ac13[_0x448ef2]={'$like':'%'+_0x2b5ff6[_0x6c97('0x36')]['filter']+'%'};return _0x51ac13;})});}_0x36ba59=_[_0x6c97('0x42')]({},_0x36ba59,_0x2b5ff6[_0x6c97('0x45')]);return _0xe87dec['getIntervals'](_0x36ba59);}})[_0x6c97('0x2a')](function(_0x3d267e){if(_0x3d267e){_0x4aa72d=_0x3d267e[_0x6c97('0x3c')];if(!_0x2b5ff6[_0x6c97('0x36')]['hasOwnProperty'](_0x6c97('0x3e'))){_0x36ba59[_0x6c97('0x22')]=qs[_0x6c97('0x22')](_0x2b5ff6[_0x6c97('0x36')][_0x6c97('0x22')]);_0x36ba59[_0x6c97('0x21')]=qs['offset'](_0x2b5ff6['query'][_0x6c97('0x21')]);}return _0xe87dec['getIntervals'](_0x36ba59);}})['then'](function(_0x323266){if(_0x323266){return _0x323266?{'count':_0x4aa72d,'rows':_0x323266}:null;}})[_0x6c97('0x2a')](respondWithResult(_0x9d74ff,null))[_0x6c97('0x4a')](handleError(_0x9d74ff,null));};exports[_0x6c97('0x5b')]=function(_0x5c63b9,_0x13f68c,_0x496068){return db[_0x6c97('0x32')]['findOne']({'where':{'id':_0x5c63b9['params']['id']}})['then'](handleEntityNotFound(_0x13f68c,null))['then'](function(_0x1e83ca){if(_0x1e83ca){return db[_0x6c97('0x5c')]['transaction'](function(_0x528ffb){return db[_0x6c97('0x32')]['destroy']({'where':{'IntervalId':_0x5c63b9[_0x6c97('0x4c')]['id']},'transaction':_0x528ffb})['then'](function(_0x505ddf){var _0x106263=_['map'](_0x5c63b9[_0x6c97('0x51')],function(_0x12153f){delete _0x12153f['id'];_0x12153f[_0x6c97('0x5d')]=_0x5c63b9[_0x6c97('0x4c')]['id'];return _0x12153f;});return db[_0x6c97('0x32')][_0x6c97('0x5e')](_0x106263,{'transaction':_0x528ffb});});})['then'](function(){return db[_0x6c97('0x32')]['findAll']({'where':{'IntervalId':_0x5c63b9[_0x6c97('0x4c')]['id']}});});}})['then'](respondWithResult(_0x13f68c,null))['catch'](handleError(_0x13f68c,null));}; \ No newline at end of file +var _0x2953=['query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','params','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','findOne','hasOwnProperty','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','reject','save','update','destroy','then','Intervals','end','error','name','send','index','map','Interval','rawAttributes','fieldName','type'];(function(_0x194874,_0x564793){var _0x5af986=function(_0x317556){while(--_0x317556){_0x194874['push'](_0x194874['shift']());}};_0x5af986(++_0x564793);}(_0x2953,0x1ec));var _0x3295=function(_0x535f43,_0x59611f){_0x535f43=_0x535f43-0x0;var _0x34b84a=_0x2953[_0x535f43];return _0x34b84a;};'use strict';var emlformat=require(_0x3295('0x0'));var rimraf=require(_0x3295('0x1'));var zipdir=require(_0x3295('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3295('0x3'));var BPromise=require(_0x3295('0x4'));var Mustache=require(_0x3295('0x5'));var util=require('util');var path=require(_0x3295('0x6'));var sox=require(_0x3295('0x7'));var csv=require(_0x3295('0x8'));var ejs=require(_0x3295('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3295('0xa'));var squel=require(_0x3295('0xb'));var crypto=require(_0x3295('0xc'));var jsforce=require(_0x3295('0xd'));var deskjs=require(_0x3295('0xe'));var toCsv=require(_0x3295('0x8'));var querystring=require(_0x3295('0xf'));var Papa=require(_0x3295('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3295('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3295('0x12'))(_0x3295('0x13'));var utils=require(_0x3295('0x14'));var config=require(_0x3295('0x15'));var licenseUtil=require(_0x3295('0x16'));var db=require(_0x3295('0x17'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x2d8bf4,_0x529923){_0x529923=_0x529923||0xcc;return function(_0x2ae702){if(_0x2ae702){return _0x2d8bf4[_0x3295('0x18')](_0x529923);}return _0x2d8bf4[_0x3295('0x19')](_0x529923)['end']();};}function respondWithResult(_0x29afae,_0x37a5a4){_0x37a5a4=_0x37a5a4||0xc8;return function(_0x23cb8e){if(_0x23cb8e){return _0x29afae[_0x3295('0x19')](_0x37a5a4)['json'](_0x23cb8e);}};}function respondWithFilteredResult(_0x3927ec,_0x526ab0){return function(_0x258b6f){if(_0x258b6f){var _0x5d033d=typeof _0x526ab0[_0x3295('0x1a')]===_0x3295('0x1b')&&typeof _0x526ab0[_0x3295('0x1c')]===_0x3295('0x1b');var _0x258124=_0x258b6f[_0x3295('0x1d')];var _0x324746=_0x5d033d?0x0:_0x526ab0['offset'];var _0x3864c6=_0x5d033d?_0x258b6f[_0x3295('0x1d')]:_0x526ab0[_0x3295('0x1a')]+_0x526ab0[_0x3295('0x1c')];var _0x55095e;if(_0x3864c6>=_0x258124){_0x3864c6=_0x258124;_0x55095e=0xc8;}else{_0x55095e=0xce;}_0x3927ec['status'](_0x55095e);return _0x3927ec[_0x3295('0x1e')]('Content-Range',_0x324746+'-'+_0x3864c6+'/'+_0x258124)[_0x3295('0x1f')](_0x258b6f);}return null;};}function patchUpdates(_0x2780f8){return function(_0x116885){try{jsonpatch['apply'](_0x116885,_0x2780f8,!![]);}catch(_0x31eecf){return BPromise[_0x3295('0x20')](_0x31eecf);}return _0x116885[_0x3295('0x21')]();};}function saveUpdates(_0x42735b,_0x11b31f){return function(_0x3ea0f4){if(_0x3ea0f4){return _0x3ea0f4[_0x3295('0x22')](_0x42735b)['then'](function(_0x309877){return _0x309877;});}return null;};}function removeEntity(_0x5b4e35,_0x19b8f){return function(_0x2a71d4){if(_0x2a71d4){return _0x2a71d4[_0x3295('0x23')]()[_0x3295('0x24')](function(){var _0x2d2fc1=_0x2a71d4['get']({'plain':!![]});var _0x4bc9eb=_0x3295('0x25');return db['UserProfileResource'][_0x3295('0x23')]({'where':{'type':_0x4bc9eb,'resourceId':_0x2d2fc1['id']}})[_0x3295('0x24')](function(){return _0x2a71d4;});})[_0x3295('0x24')](function(){_0x5b4e35[_0x3295('0x19')](0xcc)[_0x3295('0x26')]();});}};}function handleEntityNotFound(_0x404898,_0x4f00eb){return function(_0x1bc64a){if(!_0x1bc64a){_0x404898[_0x3295('0x18')](0x194);}return _0x1bc64a;};}function handleError(_0x5604d9,_0x35c277){_0x35c277=_0x35c277||0x1f4;return function(_0x1c8c07){logger[_0x3295('0x27')](_0x1c8c07['stack']);if(_0x1c8c07['name']){delete _0x1c8c07[_0x3295('0x28')];}_0x5604d9['status'](_0x35c277)[_0x3295('0x29')](_0x1c8c07);};}exports[_0x3295('0x2a')]=function(_0x37870c,_0x4c76dc){var _0x1e2dd5={},_0x415e3a={},_0x4482b1={'count':0x0,'rows':[]};var _0xcb761e=_[_0x3295('0x2b')](db[_0x3295('0x2c')][_0x3295('0x2d')],function(_0x4ef16a){return{'name':_0x4ef16a[_0x3295('0x2e')],'type':_0x4ef16a[_0x3295('0x2f')]['key']};});_0x415e3a['model']=_[_0x3295('0x2b')](_0xcb761e,_0x3295('0x28'));_0x415e3a[_0x3295('0x30')]=_[_0x3295('0x31')](_0x37870c[_0x3295('0x30')]);_0x415e3a['filters']=_[_0x3295('0x32')](_0x415e3a[_0x3295('0x33')],_0x415e3a[_0x3295('0x30')]);_0x1e2dd5['attributes']=_['intersection'](_0x415e3a[_0x3295('0x33')],qs[_0x3295('0x34')](_0x37870c[_0x3295('0x30')][_0x3295('0x34')]));_0x1e2dd5[_0x3295('0x35')]=_0x1e2dd5[_0x3295('0x35')][_0x3295('0x36')]?_0x1e2dd5[_0x3295('0x35')]:_0x415e3a[_0x3295('0x33')];if(!_0x37870c[_0x3295('0x30')]['hasOwnProperty'](_0x3295('0x37'))){_0x1e2dd5[_0x3295('0x1c')]=qs['limit'](_0x37870c[_0x3295('0x30')][_0x3295('0x1c')]);_0x1e2dd5[_0x3295('0x1a')]=qs[_0x3295('0x1a')](_0x37870c['query'][_0x3295('0x1a')]);}_0x1e2dd5[_0x3295('0x38')]=qs[_0x3295('0x39')](_0x37870c[_0x3295('0x30')][_0x3295('0x39')]);_0x1e2dd5[_0x3295('0x3a')]=qs['filters'](_[_0x3295('0x3b')](_0x37870c['query'],_0x415e3a[_0x3295('0x3c')]),_0xcb761e);if(_0x37870c[_0x3295('0x30')]['filter']){_0x1e2dd5[_0x3295('0x3a')]=_['merge'](_0x1e2dd5[_0x3295('0x3a')],{'$or':_[_0x3295('0x2b')](_0xcb761e,function(_0x5f2a5c){if(_0x5f2a5c['type']!=='VIRTUAL'){var _0xdc7189={};_0xdc7189[_0x5f2a5c[_0x3295('0x28')]]={'$like':'%'+_0x37870c['query'][_0x3295('0x3d')]+'%'};return _0xdc7189;}})});}_0x1e2dd5=_[_0x3295('0x3e')]({},_0x1e2dd5,_0x37870c['options']);var _0x4129db={'where':_0x1e2dd5[_0x3295('0x3a')]};return db[_0x3295('0x2c')][_0x3295('0x1d')](_0x4129db)[_0x3295('0x24')](function(_0x3338dd){_0x4482b1[_0x3295('0x1d')]=_0x3338dd;if(_0x37870c[_0x3295('0x30')][_0x3295('0x3f')]){_0x1e2dd5[_0x3295('0x40')]=[{'all':!![]}];}return db[_0x3295('0x2c')][_0x3295('0x41')](_0x1e2dd5);})[_0x3295('0x24')](function(_0x53b6af){_0x4482b1[_0x3295('0x42')]=_0x53b6af;return _0x4482b1;})[_0x3295('0x24')](respondWithFilteredResult(_0x4c76dc,_0x1e2dd5))['catch'](handleError(_0x4c76dc,null));};exports['show']=function(_0xea5f78,_0x463ee6){var _0x4e534c={'raw':!![],'where':{'id':_0xea5f78[_0x3295('0x43')]['id']}},_0x17bf45={};_0x17bf45[_0x3295('0x33')]=_[_0x3295('0x31')](db['Interval']['rawAttributes']);_0x17bf45[_0x3295('0x30')]=_[_0x3295('0x31')](_0xea5f78[_0x3295('0x30')]);_0x17bf45[_0x3295('0x3c')]=_[_0x3295('0x32')](_0x17bf45[_0x3295('0x33')],_0x17bf45[_0x3295('0x30')]);_0x4e534c['attributes']=_[_0x3295('0x32')](_0x17bf45[_0x3295('0x33')],qs[_0x3295('0x34')](_0xea5f78[_0x3295('0x30')][_0x3295('0x34')]));_0x4e534c[_0x3295('0x35')]=_0x4e534c[_0x3295('0x35')][_0x3295('0x36')]?_0x4e534c[_0x3295('0x35')]:_0x17bf45[_0x3295('0x33')];if(_0xea5f78[_0x3295('0x30')]['includeAll']){_0x4e534c[_0x3295('0x40')]=[{'all':!![]}];}_0x4e534c=_['merge']({},_0x4e534c,_0xea5f78[_0x3295('0x44')]);return db[_0x3295('0x2c')][_0x3295('0x45')](_0x4e534c)['then'](handleEntityNotFound(_0x463ee6,null))[_0x3295('0x24')](respondWithResult(_0x463ee6,null))[_0x3295('0x46')](handleError(_0x463ee6,null));};exports[_0x3295('0x47')]=function(_0x43b586,_0x1cd106){return db[_0x3295('0x2c')][_0x3295('0x47')](_0x43b586[_0x3295('0x48')],{})[_0x3295('0x24')](function(_0xcb50ae){var _0x47581=_0x43b586['user']['get']({'plain':!![]});if(!_0x47581)throw new Error(_0x3295('0x49'));if(_0x47581[_0x3295('0x4a')]===_0x3295('0x4b')){var _0x4be244=_0xcb50ae[_0x3295('0x4c')]({'plain':!![]});var _0x4890b4=_0x3295('0x25');return db[_0x3295('0x4d')][_0x3295('0x45')]({'where':{'name':_0x4890b4,'userProfileId':_0x47581[_0x3295('0x4e')]},'raw':!![]})[_0x3295('0x24')](function(_0xed0fb6){if(_0xed0fb6&&_0xed0fb6[_0x3295('0x4f')]===0x0){return db[_0x3295('0x50')]['create']({'name':_0x4be244['name'],'resourceId':_0x4be244['id'],'type':_0xed0fb6['name'],'sectionId':_0xed0fb6['id']},{})[_0x3295('0x24')](function(){return _0xcb50ae;});}else{return _0xcb50ae;}})[_0x3295('0x46')](function(_0x1a52fa){logger[_0x3295('0x27')](_0x3295('0x51'),_0x1a52fa);throw _0x1a52fa;});}return _0xcb50ae;})['then'](respondWithResult(_0x1cd106,0xc9))[_0x3295('0x46')](handleError(_0x1cd106,null));};exports['update']=function(_0x156f6a,_0x225389){if(_0x156f6a['body']['id']){delete _0x156f6a[_0x3295('0x48')]['id'];}return db[_0x3295('0x2c')]['find']({'where':{'id':_0x156f6a[_0x3295('0x43')]['id']}})[_0x3295('0x24')](handleEntityNotFound(_0x225389,null))[_0x3295('0x24')](saveUpdates(_0x156f6a[_0x3295('0x48')],null))['then'](respondWithResult(_0x225389,null))['catch'](handleError(_0x225389,null));};exports[_0x3295('0x23')]=function(_0x26340,_0x1580b6){return db[_0x3295('0x2c')][_0x3295('0x45')]({'where':{'id':_0x26340[_0x3295('0x43')]['id']}})[_0x3295('0x24')](handleEntityNotFound(_0x1580b6,null))['then'](removeEntity(_0x1580b6,null))['catch'](handleError(_0x1580b6,null));};exports[_0x3295('0x52')]=function(_0x20c7a1,_0x22b471,_0x42ca39){if(_0x20c7a1[_0x3295('0x48')]['id']){delete _0x20c7a1[_0x3295('0x48')]['id'];}return db[_0x3295('0x2c')][_0x3295('0x45')]({'where':{'id':_0x20c7a1[_0x3295('0x43')]['id']}})['then'](handleEntityNotFound(_0x22b471,null))[_0x3295('0x24')](function(_0x7ba171){if(_0x7ba171){_0x20c7a1[_0x3295('0x48')]['IntervalId']=_0x7ba171['id'];return db['Interval'][_0x3295('0x47')](_0x20c7a1[_0x3295('0x48')]);}})[_0x3295('0x24')](respondWithResult(_0x22b471,null))[_0x3295('0x46')](handleError(_0x22b471,null));};exports[_0x3295('0x53')]=function(_0xf1479f,_0x5557e4,_0x5f9db4){var _0x270e00={};var _0x42c177={};var _0x2eb0ae;var _0x58aee1;return db['Interval'][_0x3295('0x54')]({'where':{'id':_0xf1479f[_0x3295('0x43')]['id']}})['then'](handleEntityNotFound(_0x5557e4,null))[_0x3295('0x24')](function(_0xe7f0ea){if(_0xe7f0ea){_0x2eb0ae=_0xe7f0ea;_0x42c177[_0x3295('0x33')]=_[_0x3295('0x31')](db[_0x3295('0x2c')]['rawAttributes']);_0x42c177[_0x3295('0x30')]=_[_0x3295('0x31')](_0xf1479f[_0x3295('0x30')]);_0x42c177['filters']=_[_0x3295('0x32')](_0x42c177[_0x3295('0x33')],_0x42c177[_0x3295('0x30')]);_0x270e00[_0x3295('0x35')]=_['intersection'](_0x42c177[_0x3295('0x33')],qs[_0x3295('0x34')](_0xf1479f['query'][_0x3295('0x34')]));_0x270e00[_0x3295('0x35')]=_0x270e00['attributes'][_0x3295('0x36')]?_0x270e00[_0x3295('0x35')]:_0x42c177[_0x3295('0x33')];_0x270e00[_0x3295('0x38')]=qs[_0x3295('0x39')](_0xf1479f[_0x3295('0x30')][_0x3295('0x39')]);_0x270e00[_0x3295('0x3a')]=qs[_0x3295('0x3c')](_[_0x3295('0x3b')](_0xf1479f[_0x3295('0x30')],_0x42c177[_0x3295('0x3c')]));if(_0xf1479f[_0x3295('0x30')]['filter']){_0x270e00[_0x3295('0x3a')]=_[_0x3295('0x3e')](_0x270e00[_0x3295('0x3a')],{'$or':_['map'](_0x270e00[_0x3295('0x35')],function(_0x35ec7b){var _0x59dab5={};_0x59dab5[_0x35ec7b]={'$like':'%'+_0xf1479f['query'][_0x3295('0x3d')]+'%'};return _0x59dab5;})});}_0x270e00=_['merge']({},_0x270e00,_0xf1479f[_0x3295('0x44')]);return _0x2eb0ae['getIntervals'](_0x270e00);}})[_0x3295('0x24')](function(_0x1d931b){if(_0x1d931b){_0x58aee1=_0x1d931b['length'];if(!_0xf1479f[_0x3295('0x30')][_0x3295('0x55')]('nolimit')){_0x270e00['limit']=qs[_0x3295('0x1c')](_0xf1479f['query']['limit']);_0x270e00[_0x3295('0x1a')]=qs['offset'](_0xf1479f['query'][_0x3295('0x1a')]);}return _0x2eb0ae[_0x3295('0x53')](_0x270e00);}})[_0x3295('0x24')](function(_0x438155){if(_0x438155){return _0x438155?{'count':_0x58aee1,'rows':_0x438155}:null;}})['then'](respondWithResult(_0x5557e4,null))[_0x3295('0x46')](handleError(_0x5557e4,null));};exports['addIntervals']=function(_0x44670d,_0x383545,_0x563346){return db[_0x3295('0x2c')][_0x3295('0x54')]({'where':{'id':_0x44670d[_0x3295('0x43')]['id']}})['then'](handleEntityNotFound(_0x383545,null))[_0x3295('0x24')](function(_0x24cb95){if(_0x24cb95){return db[_0x3295('0x56')][_0x3295('0x57')](function(_0x33c003){return db[_0x3295('0x2c')][_0x3295('0x23')]({'where':{'IntervalId':_0x44670d['params']['id']},'transaction':_0x33c003})['then'](function(_0x10dc4e){var _0x2b6c19=_[_0x3295('0x2b')](_0x44670d[_0x3295('0x48')],function(_0x26a4cd){delete _0x26a4cd['id'];_0x26a4cd[_0x3295('0x58')]=_0x44670d[_0x3295('0x43')]['id'];return _0x26a4cd;});return db['Interval'][_0x3295('0x59')](_0x2b6c19,{'transaction':_0x33c003});});})[_0x3295('0x24')](function(){return db[_0x3295('0x2c')][_0x3295('0x41')]({'where':{'IntervalId':_0x44670d[_0x3295('0x43')]['id']}});});}})['then'](respondWithResult(_0x383545,null))['catch'](handleError(_0x383545,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3749b71..3160fd5 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 _0x4a3a=['tools_intervals','rewrite','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval'];(function(_0x5798ac,_0x1a2333){var _0x2c8754=function(_0x51c18f){while(--_0x51c18f){_0x5798ac['push'](_0x5798ac['shift']());}};_0x2c8754(++_0x1a2333);}(_0x4a3a,0x72));var _0xa4a3=function(_0x563f2d,_0x26c6a5){_0x563f2d=_0x563f2d-0x0;var _0x5e6968=_0x4a3a[_0x563f2d];return _0x5e6968;};'use strict';var _=require(_0xa4a3('0x0'));var util=require(_0xa4a3('0x1'));var logger=require('../../config/logger')(_0xa4a3('0x2'));var moment=require(_0xa4a3('0x3'));var BPromise=require(_0xa4a3('0x4'));var rp=require(_0xa4a3('0x5'));var fs=require('fs');var path=require(_0xa4a3('0x6'));var rimraf=require(_0xa4a3('0x7'));var config=require(_0xa4a3('0x8'));var attributes=require(_0xa4a3('0x9'));var extensions=require(_0xa4a3('0xa'));module[_0xa4a3('0xb')]=function(_0x386474,_0x13ab69){return _0x386474[_0xa4a3('0xc')](_0xa4a3('0xd'),attributes,{'tableName':_0xa4a3('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1bb262,_0x159a28){extensions[_0xa4a3('0xf')](_0x386474,_0x1bb262);},'afterBulkCreate':function(_0x1ee67a,_0x10e4f6,_0x451a41){_0x451a41();extensions[_0xa4a3('0xf')](_0x386474,_0x1ee67a[0x0]);},'afterUpdate':function(_0x487465,_0x10ad4a){extensions[_0xa4a3('0xf')](_0x386474,_0x487465);},'afterDestroy':function(_0x445d3e,_0x4e7a14){extensions[_0xa4a3('0xf')](_0x386474,_0x445d3e);}}});}; \ No newline at end of file +var _0x4f8b=['Interval','tools_intervals','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define'];(function(_0x3daa8c,_0x388a87){var _0x2b1bd7=function(_0xdb2963){while(--_0xdb2963){_0x3daa8c['push'](_0x3daa8c['shift']());}};_0x2b1bd7(++_0x388a87);}(_0x4f8b,0xb3));var _0xb4f8=function(_0x4c73ec,_0x156ea3){_0x4c73ec=_0x4c73ec-0x0;var _0x4d0ac8=_0x4f8b[_0x4c73ec];return _0x4d0ac8;};'use strict';var _=require('lodash');var util=require(_0xb4f8('0x0'));var logger=require(_0xb4f8('0x1'))(_0xb4f8('0x2'));var moment=require(_0xb4f8('0x3'));var BPromise=require(_0xb4f8('0x4'));var rp=require(_0xb4f8('0x5'));var fs=require('fs');var path=require(_0xb4f8('0x6'));var rimraf=require(_0xb4f8('0x7'));var config=require(_0xb4f8('0x8'));var attributes=require(_0xb4f8('0x9'));var extensions=require(_0xb4f8('0xa'));module[_0xb4f8('0xb')]=function(_0x109217,_0x27e8b4){return _0x109217[_0xb4f8('0xc')](_0xb4f8('0xd'),attributes,{'tableName':_0xb4f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5841df,_0x1b72e4){extensions[_0xb4f8('0xf')](_0x109217,_0x5841df);},'afterBulkCreate':function(_0x4bdd57,_0x18d77c,_0x40da6b){_0x40da6b();extensions[_0xb4f8('0xf')](_0x109217,_0x4bdd57[0x0]);},'afterUpdate':function(_0x53b34a,_0x29e8d1){extensions[_0xb4f8('0xf')](_0x109217,_0x53b34a);},'afterDestroy':function(_0xf08095,_0x4da50a){extensions['rewrite'](_0x109217,_0xf08095);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 096dc56..e332022 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x228ac9,_0x42f065){var _0x69fe02=function(_0x210551){while(--_0x210551){_0x228ac9['push'](_0x228ac9['shift']());}};_0x69fe02(++_0x42f065);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e75542a..de25750 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x7321db,_0x35f841){var _0x427dab=function(_0x57855f){while(--_0x57855f){_0x7321db['push'](_0x7321db['shift']());}};_0x427dab(++_0x35f841);}(_0xdb28,0x106));var _0x8db2=function(_0x1357cf,_0x26ca28){_0x1357cf=_0x1357cf-0x0;var _0x461703=_0xdb28[_0x1357cf];return _0x461703;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0xe4b339,_0x3bd58f){var _0x2689e2=function(_0x533fe3){while(--_0x533fe3){_0xe4b339['push'](_0xe4b339['shift']());}};_0x2689e2(++_0x3bd58f);}(_0x2032,0xd9));var _0x2203=function(_0x16cc93,_0x3f6729){_0x16cc93=_0x16cc93-0x0;var _0x30c79f=_0x2032[_0x16cc93];return _0x30c79f;};'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 b934e8e..6297413 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 _0x4898=['stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','connection','socket','remoteAddress','bluebird','https','../../config/logger','support','key','MOTGUI','summary','Report','description'];(function(_0x5814fd,_0x5b8925){var _0x24a7cd=function(_0x2f5a56){while(--_0x2f5a56){_0x5814fd['push'](_0x5814fd['shift']());}};_0x24a7cd(++_0x5b8925);}(_0x4898,0x1e6));var _0x8489=function(_0x1faf7b,_0x21e15f){_0x1faf7b=_0x1faf7b-0x0;var _0x34c2a6=_0x4898[_0x1faf7b];return _0x34c2a6;};'use strict';var BPromise=require(_0x8489('0x0'));var https=require(_0x8489('0x1'));var logger=require(_0x8489('0x2'))('api');var USERNAME=_0x8489('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2a09c2,_0x211306){var _0xd3642b={'fields':{'project':{'key':_0x2a09c2[_0x8489('0x4')]||_0x8489('0x5')},'summary':(_0x2a09c2[_0x8489('0x6')]||_0x8489('0x7'))+'\x20from\x20'+_0x2a09c2['ip'],'description':_0x2a09c2[_0x8489('0x8')]||JSON[_0x8489('0x9')](_0x2a09c2),'issuetype':{'name':_0x2a09c2[_0x8489('0xa')]||_0x8489('0xb')}}};_0xd3642b[_0x8489('0xc')][_0x8489('0xd')]=_0x2a09c2[_0x8489('0xe')];_0xd3642b[_0x8489('0xc')][_0x8489('0xf')]=_0x2a09c2['oldToken'];_0xd3642b[_0x8489('0xc')][_0x8489('0x10')]=_0x2a09c2[_0x8489('0x11')];_0xd3642b['fields'][_0x8489('0x12')]=_0x2a09c2[_0x8489('0x13')];_0xd3642b[_0x8489('0xc')][_0x8489('0x14')]=_0x2a09c2[_0x8489('0x15')];_0xd3642b[_0x8489('0xc')][_0x8489('0x16')]=_0x2a09c2['ip'];var _0x461b4d={'host':_0x8489('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x8489('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x8489('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x8489('0x1a')](_0x8489('0x1b'))}};var _0x3ef74d=JSON['stringify'](_0xd3642b);var _0x1ffbc3=https[_0x8489('0x1c')](_0x461b4d,function(_0x259335){_0x259335[_0x8489('0x1d')](_0x8489('0x1e'));var _0x366b2c='';_0x259335['on'](_0x8489('0x1f'),function(_0x3473c8){_0x366b2c+=_0x3473c8;});_0x259335['on'](_0x8489('0x20'),function(){if(_0x211306){return _0x211306[_0x8489('0x21')](_0x259335[_0x8489('0x22')])[_0x8489('0x23')](JSON['parse'](_0x366b2c));}});});_0x1ffbc3['on']('error',function(_0x36e4ac){if(_0x211306){return _0x211306[_0x8489('0x21')](0x1f4)[_0x8489('0x23')]({'errors':[{'message':_0x8489('0x24'),'type':_0x8489('0x25')}]});}});_0x1ffbc3[_0x8489('0x26')](_0x3ef74d);_0x1ffbc3[_0x8489('0x20')]();}exports[_0x8489('0x27')]=openIssue;exports[_0x8489('0x28')]=function(_0x44806f,_0x5bc1d4){_0x44806f[_0x8489('0x29')]['ip']=_0x44806f['headers']['x-forwarded-for']||_0x44806f[_0x8489('0x2a')]['remoteAddress']||_0x44806f[_0x8489('0x2b')][_0x8489('0x2c')]||_0x44806f[_0x8489('0x2a')]['socket']['remoteAddress'];return openIssue(_0x44806f[_0x8489('0x29')],_0x5bc1d4);}; \ No newline at end of file +var _0x0b1a=['issuetype','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','POST','toString','stringify','request','utf8','end','status','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','description'];(function(_0x22a084,_0x4ce0e7){var _0x1f9964=function(_0x34e633){while(--_0x34e633){_0x22a084['push'](_0x22a084['shift']());}};_0x1f9964(++_0x4ce0e7);}(_0x0b1a,0x115));var _0xa0b1=function(_0x12fe36,_0x5cde20){_0x12fe36=_0x12fe36-0x0;var _0x18f1c9=_0x0b1a[_0x12fe36];return _0x18f1c9;};'use strict';var BPromise=require(_0xa0b1('0x0'));var https=require(_0xa0b1('0x1'));var logger=require(_0xa0b1('0x2'))(_0xa0b1('0x3'));var USERNAME=_0xa0b1('0x4');var PASSWORD=_0xa0b1('0x5');function openIssue(_0x298259,_0x10bae9){var _0x516daa={'fields':{'project':{'key':_0x298259[_0xa0b1('0x6')]||_0xa0b1('0x7')},'summary':(_0x298259['summary']||_0xa0b1('0x8'))+'\x20from\x20'+_0x298259['ip'],'description':_0x298259[_0xa0b1('0x9')]||JSON['stringify'](_0x298259),'issuetype':{'name':_0x298259[_0xa0b1('0xa')]||'Bug'}}};_0x516daa[_0xa0b1('0xb')][_0xa0b1('0xc')]=_0x298259[_0xa0b1('0xd')];_0x516daa[_0xa0b1('0xb')][_0xa0b1('0xe')]=_0x298259[_0xa0b1('0xf')];_0x516daa[_0xa0b1('0xb')][_0xa0b1('0x10')]=_0x298259['newToken'];_0x516daa[_0xa0b1('0xb')][_0xa0b1('0x11')]=_0x298259[_0xa0b1('0x12')];_0x516daa[_0xa0b1('0xb')]['customfield_11504']=_0x298259[_0xa0b1('0x13')];_0x516daa[_0xa0b1('0xb')][_0xa0b1('0x14')]=_0x298259['ip'];var _0x57c1cf={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xa0b1('0x15'),'method':_0xa0b1('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa0b1('0x17')]('base64')}};var _0x441a20=JSON[_0xa0b1('0x18')](_0x516daa);var _0x42625=https[_0xa0b1('0x19')](_0x57c1cf,function(_0x10053f){_0x10053f['setEncoding'](_0xa0b1('0x1a'));var _0x551634='';_0x10053f['on']('data',function(_0x21c2eb){_0x551634+=_0x21c2eb;});_0x10053f['on'](_0xa0b1('0x1b'),function(){if(_0x10bae9){return _0x10bae9[_0xa0b1('0x1c')](_0x10053f['statusCode'])['json'](JSON[_0xa0b1('0x1d')](_0x551634));}});});_0x42625['on'](_0xa0b1('0x1e'),function(_0x354bc9){if(_0x10bae9){return _0x10bae9[_0xa0b1('0x1c')](0x1f4)['json']({'errors':[{'message':_0xa0b1('0x1f'),'type':_0xa0b1('0x20')}]});}});_0x42625[_0xa0b1('0x21')](_0x441a20);_0x42625['end']();}exports[_0xa0b1('0x22')]=openIssue;exports[_0xa0b1('0x23')]=function(_0x1ea0e9,_0x5e9177){_0x1ea0e9[_0xa0b1('0x24')]['ip']=_0x1ea0e9['headers'][_0xa0b1('0x25')]||_0x1ea0e9[_0xa0b1('0x26')]['remoteAddress']||_0x1ea0e9[_0xa0b1('0x27')][_0xa0b1('0x28')]||_0x1ea0e9[_0xa0b1('0x26')][_0xa0b1('0x27')]['remoteAddress'];return openIssue(_0x1ea0e9[_0xa0b1('0x24')],_0x5e9177);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d100287..9f7e1b3 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 _0x6c76=['express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c76,0x184));var _0x66c7=function(_0x277a46,_0xc10c0){_0x277a46=_0x277a46-0x0;var _0x299fe6=_0x6c76[_0x277a46];return _0x299fe6;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0xc')]('/',auth[_0x66c7('0x8')](),controller[_0x66c7('0xd')]);router['put'](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0xe')]);router[_0x66c7('0xf')](_0x66c7('0xa'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb903=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','isAuthenticated','describe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5a5ca9,_0x30bcd3){var _0x421a14=function(_0x55096d){while(--_0x55096d){_0x5a5ca9['push'](_0x5a5ca9['shift']());}};_0x421a14(++_0x30bcd3);}(_0xb903,0x185));var _0x3b90=function(_0xe8fd3c,_0x26e374){_0xe8fd3c=_0xe8fd3c-0x0;var _0xd2e240=_0xb903[_0xe8fd3c];return _0xd2e240;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller['update']);router[_0x3b90('0xf')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);module[_0x3b90('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6104c81..ad31f66 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(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x7a54,0x106));var _0x47a5=function(_0x4a60d6,_0x2fcede){_0x4a60d6=_0x4a60d6-0x0;var _0x101cd1=_0x7a54[_0x4a60d6];return _0x101cd1;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0xda5502,_0x5d75eb){_0xda5502=_0xda5502-0x0;var _0x3c9a46=_0x7a54[_0xda5502];return _0x3c9a46;};'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 1203b4f..b8d8d77 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 _0x6bac=['destroy','end','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','JscriptyAnswerReport','count','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then'];(function(_0x5d46af,_0x580f64){var _0x45ebf2=function(_0x34fcff){while(--_0x34fcff){_0x5d46af['push'](_0x5d46af['shift']());}};_0x45ebf2(++_0x580f64);}(_0x6bac,0xa5));var _0xc6ba=function(_0x175ebe,_0x50334f){_0x175ebe=_0x175ebe-0x0;var _0x520c6b=_0x6bac[_0x175ebe];return _0x520c6b;};'use strict';var emlformat=require(_0xc6ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6ba('0x1'));var jsonpatch=require(_0xc6ba('0x2'));var rp=require(_0xc6ba('0x3'));var moment=require(_0xc6ba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc6ba('0x5'));var sox=require(_0xc6ba('0x6'));var csv=require('to-csv');var ejs=require(_0xc6ba('0x7'));var fs=require('fs');var fs_extra=require(_0xc6ba('0x8'));var _=require(_0xc6ba('0x9'));var squel=require(_0xc6ba('0xa'));var crypto=require(_0xc6ba('0xb'));var jsforce=require(_0xc6ba('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc6ba('0xd'));var Papa=require('papaparse');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(_0xc6ba('0xe'));var logger=require(_0xc6ba('0xf'))(_0xc6ba('0x10'));var utils=require(_0xc6ba('0x11'));var config=require(_0xc6ba('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e7642,_0x2cfa3d){_0x2cfa3d=_0x2cfa3d||0xcc;return function(_0x31def2){if(_0x31def2){return _0x3e7642[_0xc6ba('0x13')](_0x2cfa3d);}return _0x3e7642[_0xc6ba('0x14')](_0x2cfa3d)['end']();};}function respondWithResult(_0x498aa1,_0x595561){_0x595561=_0x595561||0xc8;return function(_0x2f6e76){if(_0x2f6e76){return _0x498aa1[_0xc6ba('0x14')](_0x595561)[_0xc6ba('0x15')](_0x2f6e76);}};}function respondWithFilteredResult(_0x342007,_0x425cec){return function(_0x29f0b7){if(_0x29f0b7){var _0x1be8ef=typeof _0x425cec[_0xc6ba('0x16')]==='undefined'&&typeof _0x425cec['limit']==='undefined';var _0x488fb4=_0x29f0b7['count'];var _0x494d17=_0x1be8ef?0x0:_0x425cec[_0xc6ba('0x16')];var _0x15a135=_0x1be8ef?_0x29f0b7['count']:_0x425cec['offset']+_0x425cec[_0xc6ba('0x17')];var _0x5d1f4e;if(_0x15a135>=_0x488fb4){_0x15a135=_0x488fb4;_0x5d1f4e=0xc8;}else{_0x5d1f4e=0xce;}_0x342007[_0xc6ba('0x14')](_0x5d1f4e);return _0x342007[_0xc6ba('0x18')]('Content-Range',_0x494d17+'-'+_0x15a135+'/'+_0x488fb4)[_0xc6ba('0x15')](_0x29f0b7);}return null;};}function patchUpdates(_0x362f68){return function(_0x4a463e){try{jsonpatch[_0xc6ba('0x19')](_0x4a463e,_0x362f68,!![]);}catch(_0x459dfa){return BPromise[_0xc6ba('0x1a')](_0x459dfa);}return _0x4a463e[_0xc6ba('0x1b')]();};}function saveUpdates(_0x28f8ba,_0x3f7082){return function(_0xc2de63){if(_0xc2de63){return _0xc2de63[_0xc6ba('0x1c')](_0x28f8ba)[_0xc6ba('0x1d')](function(_0x3c7edd){return _0x3c7edd;});}return null;};}function removeEntity(_0x280ab0,_0xf326f9){return function(_0x4a2082){if(_0x4a2082){return _0x4a2082[_0xc6ba('0x1e')]()[_0xc6ba('0x1d')](function(){_0x280ab0['status'](0xcc)[_0xc6ba('0x1f')]();});}};}function handleEntityNotFound(_0x29a175,_0x2946f0){return function(_0xcfb503){if(!_0xcfb503){_0x29a175[_0xc6ba('0x13')](0x194);}return _0xcfb503;};}function handleError(_0x3b5ed7,_0x47998c){_0x47998c=_0x47998c||0x1f4;return function(_0x447407){logger[_0xc6ba('0x20')](_0x447407['stack']);if(_0x447407[_0xc6ba('0x21')]){delete _0x447407[_0xc6ba('0x21')];}_0x3b5ed7['status'](_0x47998c)[_0xc6ba('0x22')](_0x447407);};}exports['index']=function(_0x3fea76,_0x2dd085){var _0x111ce4={},_0x393d4d={},_0x5ac5dd={'count':0x0,'rows':[]};var _0x4fe380=_[_0xc6ba('0x23')](db['JscriptyAnswerReport'][_0xc6ba('0x24')],function(_0x5d5ebe){return{'name':_0x5d5ebe[_0xc6ba('0x25')],'type':_0x5d5ebe[_0xc6ba('0x26')]['key']};});_0x393d4d[_0xc6ba('0x27')]=_[_0xc6ba('0x23')](_0x4fe380,_0xc6ba('0x21'));_0x393d4d[_0xc6ba('0x28')]=_[_0xc6ba('0x29')](_0x3fea76[_0xc6ba('0x28')]);_0x393d4d['filters']=_[_0xc6ba('0x2a')](_0x393d4d[_0xc6ba('0x27')],_0x393d4d['query']);_0x111ce4[_0xc6ba('0x2b')]=_[_0xc6ba('0x2a')](_0x393d4d['model'],qs[_0xc6ba('0x2c')](_0x3fea76[_0xc6ba('0x28')]['fields']));_0x111ce4[_0xc6ba('0x2b')]=_0x111ce4[_0xc6ba('0x2b')][_0xc6ba('0x2d')]?_0x111ce4[_0xc6ba('0x2b')]:_0x393d4d[_0xc6ba('0x27')];if(!_0x3fea76[_0xc6ba('0x28')]['hasOwnProperty'](_0xc6ba('0x2e'))){_0x111ce4[_0xc6ba('0x17')]=qs[_0xc6ba('0x17')](_0x3fea76[_0xc6ba('0x28')][_0xc6ba('0x17')]);_0x111ce4[_0xc6ba('0x16')]=qs[_0xc6ba('0x16')](_0x3fea76[_0xc6ba('0x28')][_0xc6ba('0x16')]);}_0x111ce4[_0xc6ba('0x2f')]=qs[_0xc6ba('0x30')](_0x3fea76[_0xc6ba('0x28')][_0xc6ba('0x30')]);_0x111ce4[_0xc6ba('0x31')]=qs['filters'](_[_0xc6ba('0x32')](_0x3fea76[_0xc6ba('0x28')],_0x393d4d[_0xc6ba('0x33')]),_0x4fe380);if(_0x3fea76['query'][_0xc6ba('0x34')]){_0x111ce4['where']=_[_0xc6ba('0x35')](_0x111ce4['where'],{'$or':_[_0xc6ba('0x23')](_0x4fe380,function(_0x57d2fb){if(_0x57d2fb[_0xc6ba('0x26')]!=='VIRTUAL'){var _0x4d92cf={};_0x4d92cf[_0x57d2fb[_0xc6ba('0x21')]]={'$like':'%'+_0x3fea76[_0xc6ba('0x28')][_0xc6ba('0x34')]+'%'};return _0x4d92cf;}})});}_0x111ce4=_[_0xc6ba('0x35')]({},_0x111ce4,_0x3fea76['options']);var _0x2f8c39={'where':_0x111ce4[_0xc6ba('0x31')]};return db[_0xc6ba('0x36')][_0xc6ba('0x37')](_0x2f8c39)[_0xc6ba('0x1d')](function(_0x3273f4){_0x5ac5dd[_0xc6ba('0x37')]=_0x3273f4;if(_0x3fea76['query'][_0xc6ba('0x38')]){_0x111ce4[_0xc6ba('0x39')]=[{'all':!![]}];}return db[_0xc6ba('0x36')][_0xc6ba('0x3a')](_0x111ce4);})[_0xc6ba('0x1d')](function(_0x4985f8){_0x5ac5dd['rows']=_0x4985f8;return _0x5ac5dd;})[_0xc6ba('0x1d')](respondWithFilteredResult(_0x2dd085,_0x111ce4))[_0xc6ba('0x3b')](handleError(_0x2dd085,null));};exports['show']=function(_0x2d3d5a,_0x23e2d1){var _0x35f1fc={'raw':!![],'where':{'id':_0x2d3d5a[_0xc6ba('0x3c')]['id']}},_0x279d89={};_0x279d89[_0xc6ba('0x27')]=_['keys'](db['JscriptyAnswerReport'][_0xc6ba('0x24')]);_0x279d89[_0xc6ba('0x28')]=_[_0xc6ba('0x29')](_0x2d3d5a['query']);_0x279d89['filters']=_[_0xc6ba('0x2a')](_0x279d89[_0xc6ba('0x27')],_0x279d89[_0xc6ba('0x28')]);_0x35f1fc[_0xc6ba('0x2b')]=_[_0xc6ba('0x2a')](_0x279d89['model'],qs[_0xc6ba('0x2c')](_0x2d3d5a[_0xc6ba('0x28')][_0xc6ba('0x2c')]));_0x35f1fc[_0xc6ba('0x2b')]=_0x35f1fc[_0xc6ba('0x2b')][_0xc6ba('0x2d')]?_0x35f1fc[_0xc6ba('0x2b')]:_0x279d89[_0xc6ba('0x27')];if(_0x2d3d5a['query'][_0xc6ba('0x38')]){_0x35f1fc[_0xc6ba('0x39')]=[{'all':!![]}];}_0x35f1fc=_[_0xc6ba('0x35')]({},_0x35f1fc,_0x2d3d5a['options']);return db[_0xc6ba('0x36')][_0xc6ba('0x3d')](_0x35f1fc)[_0xc6ba('0x1d')](handleEntityNotFound(_0x23e2d1,null))['then'](respondWithResult(_0x23e2d1,null))['catch'](handleError(_0x23e2d1,null));};exports[_0xc6ba('0x3e')]=function(_0xe4747e,_0x56add1){return db[_0xc6ba('0x36')][_0xc6ba('0x3e')](_0xe4747e[_0xc6ba('0x3f')],{})[_0xc6ba('0x1d')](respondWithResult(_0x56add1,0xc9))[_0xc6ba('0x3b')](handleError(_0x56add1,null));};exports[_0xc6ba('0x1c')]=function(_0x36e159,_0x283dac){if(_0x36e159['body']['id']){delete _0x36e159[_0xc6ba('0x3f')]['id'];}return db['JscriptyAnswerReport'][_0xc6ba('0x3d')]({'where':{'id':_0x36e159[_0xc6ba('0x3c')]['id']}})[_0xc6ba('0x1d')](handleEntityNotFound(_0x283dac,null))[_0xc6ba('0x1d')](saveUpdates(_0x36e159[_0xc6ba('0x3f')],null))['then'](respondWithResult(_0x283dac,null))['catch'](handleError(_0x283dac,null));};exports['destroy']=function(_0x47a4ee,_0x2c71f7){return db['JscriptyAnswerReport'][_0xc6ba('0x3d')]({'where':{'id':_0x47a4ee[_0xc6ba('0x3c')]['id']}})[_0xc6ba('0x1d')](handleEntityNotFound(_0x2c71f7,null))[_0xc6ba('0x1d')](removeEntity(_0x2c71f7,null))['catch'](handleError(_0x2c71f7,null));};exports['describe']=function(_0x121fa6,_0x2ab774){return db['JscriptyAnswerReport'][_0xc6ba('0x40')]()[_0xc6ba('0x1d')](respondWithResult(_0x2ab774,null))[_0xc6ba('0x3b')](handleError(_0x2ab774,null));}; \ No newline at end of file +var _0x3baf=['filter','where','merge','options','includeAll','JscriptyAnswerReport','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','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','then','error','stack','name','rawAttributes','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x11e6f,_0x26f26a){var _0x29b33f=function(_0xb1e474){while(--_0xb1e474){_0x11e6f['push'](_0x11e6f['shift']());}};_0x29b33f(++_0x26f26a);}(_0x3baf,0xf7));var _0xf3ba=function(_0x13e42f,_0x3296e5){_0x13e42f=_0x13e42f-0x0;var _0x415720=_0x3baf[_0x13e42f];return _0x415720;};'use strict';var emlformat=require(_0xf3ba('0x0'));var rimraf=require(_0xf3ba('0x1'));var zipdir=require(_0xf3ba('0x2'));var jsonpatch=require(_0xf3ba('0x3'));var rp=require(_0xf3ba('0x4'));var moment=require(_0xf3ba('0x5'));var BPromise=require(_0xf3ba('0x6'));var Mustache=require(_0xf3ba('0x7'));var util=require(_0xf3ba('0x8'));var path=require(_0xf3ba('0x9'));var sox=require(_0xf3ba('0xa'));var csv=require(_0xf3ba('0xb'));var ejs=require(_0xf3ba('0xc'));var fs=require('fs');var fs_extra=require(_0xf3ba('0xd'));var _=require(_0xf3ba('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf3ba('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3ba('0x10'));var Papa=require(_0xf3ba('0x11'));var Redis=require(_0xf3ba('0x12'));var authService=require(_0xf3ba('0x13'));var qs=require(_0xf3ba('0x14'));var as=require(_0xf3ba('0x15'));var hardwareService=require(_0xf3ba('0x16'));var logger=require(_0xf3ba('0x17'))(_0xf3ba('0x18'));var utils=require(_0xf3ba('0x19'));var config=require(_0xf3ba('0x1a'));var licenseUtil=require(_0xf3ba('0x1b'));var db=require(_0xf3ba('0x1c'))['db'];function respondWithStatusCode(_0x85939e,_0x26cefe){_0x26cefe=_0x26cefe||0xcc;return function(_0x17673a){if(_0x17673a){return _0x85939e[_0xf3ba('0x1d')](_0x26cefe);}return _0x85939e[_0xf3ba('0x1e')](_0x26cefe)['end']();};}function respondWithResult(_0x327675,_0x56816b){_0x56816b=_0x56816b||0xc8;return function(_0x815037){if(_0x815037){return _0x327675[_0xf3ba('0x1e')](_0x56816b)[_0xf3ba('0x1f')](_0x815037);}};}function respondWithFilteredResult(_0x1e2969,_0x235c8a){return function(_0x53f848){if(_0x53f848){var _0x301856=typeof _0x235c8a[_0xf3ba('0x20')]===_0xf3ba('0x21')&&typeof _0x235c8a['limit']===_0xf3ba('0x21');var _0x11fbd2=_0x53f848[_0xf3ba('0x22')];var _0x44de40=_0x301856?0x0:_0x235c8a['offset'];var _0x1e18ed=_0x301856?_0x53f848[_0xf3ba('0x22')]:_0x235c8a['offset']+_0x235c8a['limit'];var _0x35a03c;if(_0x1e18ed>=_0x11fbd2){_0x1e18ed=_0x11fbd2;_0x35a03c=0xc8;}else{_0x35a03c=0xce;}_0x1e2969[_0xf3ba('0x1e')](_0x35a03c);return _0x1e2969[_0xf3ba('0x23')]('Content-Range',_0x44de40+'-'+_0x1e18ed+'/'+_0x11fbd2)[_0xf3ba('0x1f')](_0x53f848);}return null;};}function patchUpdates(_0x327723){return function(_0x35d6d4){try{jsonpatch[_0xf3ba('0x24')](_0x35d6d4,_0x327723,!![]);}catch(_0x23a744){return BPromise[_0xf3ba('0x25')](_0x23a744);}return _0x35d6d4[_0xf3ba('0x26')]();};}function saveUpdates(_0x4caf74,_0x4e94a7){return function(_0x4a065a){if(_0x4a065a){return _0x4a065a[_0xf3ba('0x27')](_0x4caf74)[_0xf3ba('0x28')](function(_0x6f538f){return _0x6f538f;});}return null;};}function removeEntity(_0x3b6404,_0x2cc01a){return function(_0x545ee1){if(_0x545ee1){return _0x545ee1['destroy']()[_0xf3ba('0x28')](function(){_0x3b6404[_0xf3ba('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9d6a,_0x37cba1){return function(_0x59ce48){if(!_0x59ce48){_0x1c9d6a['sendStatus'](0x194);}return _0x59ce48;};}function handleError(_0x396089,_0x7effa1){_0x7effa1=_0x7effa1||0x1f4;return function(_0x5f1709){logger[_0xf3ba('0x29')](_0x5f1709[_0xf3ba('0x2a')]);if(_0x5f1709[_0xf3ba('0x2b')]){delete _0x5f1709['name'];}_0x396089[_0xf3ba('0x1e')](_0x7effa1)['send'](_0x5f1709);};}exports['index']=function(_0x7c1a60,_0x19ef2c){var _0x5b4e0d={},_0x41c4b1={},_0x118aeb={'count':0x0,'rows':[]};var _0x5081aa=_['map'](db['JscriptyAnswerReport'][_0xf3ba('0x2c')],function(_0x6423f){return{'name':_0x6423f['fieldName'],'type':_0x6423f[_0xf3ba('0x2d')]['key']};});_0x41c4b1['model']=_[_0xf3ba('0x2e')](_0x5081aa,_0xf3ba('0x2b'));_0x41c4b1[_0xf3ba('0x2f')]=_[_0xf3ba('0x30')](_0x7c1a60[_0xf3ba('0x2f')]);_0x41c4b1[_0xf3ba('0x31')]=_['intersection'](_0x41c4b1[_0xf3ba('0x32')],_0x41c4b1['query']);_0x5b4e0d[_0xf3ba('0x33')]=_[_0xf3ba('0x34')](_0x41c4b1['model'],qs[_0xf3ba('0x35')](_0x7c1a60[_0xf3ba('0x2f')][_0xf3ba('0x35')]));_0x5b4e0d[_0xf3ba('0x33')]=_0x5b4e0d['attributes'][_0xf3ba('0x36')]?_0x5b4e0d['attributes']:_0x41c4b1['model'];if(!_0x7c1a60['query'][_0xf3ba('0x37')](_0xf3ba('0x38'))){_0x5b4e0d[_0xf3ba('0x39')]=qs[_0xf3ba('0x39')](_0x7c1a60[_0xf3ba('0x2f')]['limit']);_0x5b4e0d[_0xf3ba('0x20')]=qs['offset'](_0x7c1a60[_0xf3ba('0x2f')]['offset']);}_0x5b4e0d[_0xf3ba('0x3a')]=qs[_0xf3ba('0x3b')](_0x7c1a60[_0xf3ba('0x2f')][_0xf3ba('0x3b')]);_0x5b4e0d['where']=qs[_0xf3ba('0x31')](_[_0xf3ba('0x3c')](_0x7c1a60['query'],_0x41c4b1[_0xf3ba('0x31')]),_0x5081aa);if(_0x7c1a60[_0xf3ba('0x2f')][_0xf3ba('0x3d')]){_0x5b4e0d[_0xf3ba('0x3e')]=_[_0xf3ba('0x3f')](_0x5b4e0d[_0xf3ba('0x3e')],{'$or':_[_0xf3ba('0x2e')](_0x5081aa,function(_0x4d4f3d){if(_0x4d4f3d[_0xf3ba('0x2d')]!=='VIRTUAL'){var _0x4307db={};_0x4307db[_0x4d4f3d['name']]={'$like':'%'+_0x7c1a60[_0xf3ba('0x2f')][_0xf3ba('0x3d')]+'%'};return _0x4307db;}})});}_0x5b4e0d=_[_0xf3ba('0x3f')]({},_0x5b4e0d,_0x7c1a60[_0xf3ba('0x40')]);var _0x2cbfca={'where':_0x5b4e0d['where']};return db['JscriptyAnswerReport'][_0xf3ba('0x22')](_0x2cbfca)[_0xf3ba('0x28')](function(_0x417911){_0x118aeb[_0xf3ba('0x22')]=_0x417911;if(_0x7c1a60[_0xf3ba('0x2f')][_0xf3ba('0x41')]){_0x5b4e0d['include']=[{'all':!![]}];}return db[_0xf3ba('0x42')]['findAll'](_0x5b4e0d);})[_0xf3ba('0x28')](function(_0x239e2a){_0x118aeb[_0xf3ba('0x43')]=_0x239e2a;return _0x118aeb;})[_0xf3ba('0x28')](respondWithFilteredResult(_0x19ef2c,_0x5b4e0d))[_0xf3ba('0x44')](handleError(_0x19ef2c,null));};exports[_0xf3ba('0x45')]=function(_0x26f640,_0x3e5411){var _0x5b9a0c={'raw':!![],'where':{'id':_0x26f640[_0xf3ba('0x46')]['id']}},_0xd15662={};_0xd15662[_0xf3ba('0x32')]=_[_0xf3ba('0x30')](db[_0xf3ba('0x42')][_0xf3ba('0x2c')]);_0xd15662[_0xf3ba('0x2f')]=_['keys'](_0x26f640[_0xf3ba('0x2f')]);_0xd15662[_0xf3ba('0x31')]=_['intersection'](_0xd15662[_0xf3ba('0x32')],_0xd15662[_0xf3ba('0x2f')]);_0x5b9a0c[_0xf3ba('0x33')]=_[_0xf3ba('0x34')](_0xd15662[_0xf3ba('0x32')],qs[_0xf3ba('0x35')](_0x26f640[_0xf3ba('0x2f')][_0xf3ba('0x35')]));_0x5b9a0c[_0xf3ba('0x33')]=_0x5b9a0c[_0xf3ba('0x33')][_0xf3ba('0x36')]?_0x5b9a0c[_0xf3ba('0x33')]:_0xd15662[_0xf3ba('0x32')];if(_0x26f640[_0xf3ba('0x2f')][_0xf3ba('0x41')]){_0x5b9a0c[_0xf3ba('0x47')]=[{'all':!![]}];}_0x5b9a0c=_[_0xf3ba('0x3f')]({},_0x5b9a0c,_0x26f640[_0xf3ba('0x40')]);return db['JscriptyAnswerReport'][_0xf3ba('0x48')](_0x5b9a0c)[_0xf3ba('0x28')](handleEntityNotFound(_0x3e5411,null))['then'](respondWithResult(_0x3e5411,null))[_0xf3ba('0x44')](handleError(_0x3e5411,null));};exports[_0xf3ba('0x49')]=function(_0x188d88,_0x36f476){return db['JscriptyAnswerReport']['create'](_0x188d88[_0xf3ba('0x4a')],{})[_0xf3ba('0x28')](respondWithResult(_0x36f476,0xc9))[_0xf3ba('0x44')](handleError(_0x36f476,null));};exports[_0xf3ba('0x27')]=function(_0x502483,_0x2d3a0d){if(_0x502483[_0xf3ba('0x4a')]['id']){delete _0x502483[_0xf3ba('0x4a')]['id'];}return db['JscriptyAnswerReport'][_0xf3ba('0x48')]({'where':{'id':_0x502483[_0xf3ba('0x46')]['id']}})[_0xf3ba('0x28')](handleEntityNotFound(_0x2d3a0d,null))[_0xf3ba('0x28')](saveUpdates(_0x502483[_0xf3ba('0x4a')],null))[_0xf3ba('0x28')](respondWithResult(_0x2d3a0d,null))[_0xf3ba('0x44')](handleError(_0x2d3a0d,null));};exports[_0xf3ba('0x4b')]=function(_0x4620c0,_0x23c2c6){return db['JscriptyAnswerReport'][_0xf3ba('0x48')]({'where':{'id':_0x4620c0[_0xf3ba('0x46')]['id']}})[_0xf3ba('0x28')](handleEntityNotFound(_0x23c2c6,null))[_0xf3ba('0x28')](removeEntity(_0x23c2c6,null))['catch'](handleError(_0x23c2c6,null));};exports[_0xf3ba('0x4c')]=function(_0x5e275b,_0x5b5242){return db[_0xf3ba('0x42')][_0xf3ba('0x4c')]()[_0xf3ba('0x28')](respondWithResult(_0x5b5242,null))[_0xf3ba('0x44')](handleError(_0x5b5242,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index fb67242..c15d24e 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 _0x08ad=['path','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x2c072b,_0x6c4449){var _0x167ee3=function(_0x33ef93){while(--_0x33ef93){_0x2c072b['push'](_0x2c072b['shift']());}};_0x167ee3(++_0x6c4449);}(_0x08ad,0x1e5));var _0xd08a=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x08ad[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xd08a('0x0'));var util=require('util');var logger=require(_0xd08a('0x1'))(_0xd08a('0x2'));var moment=require('moment');var BPromise=require(_0xd08a('0x3'));var rp=require(_0xd08a('0x4'));var fs=require('fs');var path=require(_0xd08a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd08a('0x6'));module[_0xd08a('0x7')]=function(_0x2bb51b,_0x5f42bc){return _0x2bb51b[_0xd08a('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xd08a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e28=['report_jscripty_answers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x5e2aa4,_0x2a3c0c){var _0x7bac53=function(_0xc78180){while(--_0xc78180){_0x5e2aa4['push'](_0x5e2aa4['shift']());}};_0x7bac53(++_0x2a3c0c);}(_0x2e28,0x139));var _0x82e2=function(_0x4807ce,_0x5108dc){_0x4807ce=_0x4807ce-0x0;var _0x5afe28=_0x2e28[_0x4807ce];return _0x5afe28;};'use strict';var _=require(_0x82e2('0x0'));var util=require(_0x82e2('0x1'));var logger=require(_0x82e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x82e2('0x3'));var rp=require(_0x82e2('0x4'));var fs=require('fs');var path=require(_0x82e2('0x5'));var rimraf=require(_0x82e2('0x6'));var config=require(_0x82e2('0x7'));var attributes=require(_0x82e2('0x8'));module[_0x82e2('0x9')]=function(_0x227d87,_0x1d00fd){return _0x227d87[_0x82e2('0xa')](_0x82e2('0xb'),attributes,{'tableName':_0x82e2('0xc'),'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 4578f62..d2ee538 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 _0xc1e3=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0x10c6a5,_0x28851d){var _0x25b0d0=function(_0x614a4e){while(--_0x614a4e){_0x10c6a5['push'](_0x10c6a5['shift']());}};_0x25b0d0(++_0x28851d);}(_0xc1e3,0x1b1));var _0x3c1e=function(_0x51b5cf,_0x50a3bc){_0x51b5cf=_0x51b5cf-0x0;var _0x1d7d78=_0xc1e3[_0x51b5cf];return _0x1d7d78;};'use strict';var _=require(_0x3c1e('0x0'));var util=require(_0x3c1e('0x1'));var moment=require(_0x3c1e('0x2'));var BPromise=require(_0x3c1e('0x3'));var rs=require(_0x3c1e('0x4'));var fs=require('fs');var Redis=require(_0x3c1e('0x5'));var db=require(_0x3c1e('0x6'))['db'];var utils=require(_0x3c1e('0x7'));var logger=require(_0x3c1e('0x8'))(_0x3c1e('0x9'));var config=require(_0x3c1e('0xa'));var jayson=require(_0x3c1e('0xb'));var client=jayson[_0x3c1e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x195e3a,_0x14830b,_0x40640a){return new BPromise(function(_0x4e4707,_0x2a868a){return client[_0x3c1e('0xd')](_0x195e3a,_0x40640a)[_0x3c1e('0xe')](function(_0x3e5fc8){logger[_0x3c1e('0xf')](_0x3c1e('0x10'),_0x14830b,'request\x20sent');logger[_0x3c1e('0x11')](_0x3c1e('0x12'),_0x14830b,'request\x20sent',JSON['stringify'](_0x3e5fc8));if(_0x3e5fc8[_0x3c1e('0x13')]){if(_0x3e5fc8[_0x3c1e('0x13')][_0x3c1e('0x14')]===0x1f4){logger[_0x3c1e('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14830b,_0x3e5fc8[_0x3c1e('0x13')][_0x3c1e('0x15')]);return _0x2a868a(_0x3e5fc8[_0x3c1e('0x13')][_0x3c1e('0x15')]);}logger[_0x3c1e('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14830b,_0x3e5fc8[_0x3c1e('0x13')][_0x3c1e('0x15')]);return _0x4e4707(_0x3e5fc8[_0x3c1e('0x13')][_0x3c1e('0x15')]);}else{logger[_0x3c1e('0xf')](_0x3c1e('0x10'),_0x14830b,_0x3c1e('0x16'));_0x4e4707(_0x3e5fc8[_0x3c1e('0x17')][_0x3c1e('0x15')]);}})[_0x3c1e('0x18')](function(_0x4988d3){logger[_0x3c1e('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x14830b,_0x4988d3);_0x2a868a(_0x4988d3);});});} \ No newline at end of file +var _0x0a48=['stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0xea26ce,_0x3a66f6){var _0x535908=function(_0x56a621){while(--_0x56a621){_0xea26ce['push'](_0xea26ce['shift']());}};_0x535908(++_0x3a66f6);}(_0x0a48,0x157));var _0x80a4=function(_0x2dfd68,_0x2fa790){_0x2dfd68=_0x2dfd68-0x0;var _0x4a2a63=_0x0a48[_0x2dfd68];return _0x4a2a63;};'use strict';var _=require(_0x80a4('0x0'));var util=require('util');var moment=require(_0x80a4('0x1'));var BPromise=require(_0x80a4('0x2'));var rs=require(_0x80a4('0x3'));var fs=require('fs');var Redis=require(_0x80a4('0x4'));var db=require(_0x80a4('0x5'))['db'];var utils=require(_0x80a4('0x6'));var logger=require(_0x80a4('0x7'))(_0x80a4('0x8'));var config=require(_0x80a4('0x9'));var jayson=require(_0x80a4('0xa'));var client=jayson[_0x80a4('0xb')][_0x80a4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x403d7f,_0x2a0ee7,_0x22c71b){return new BPromise(function(_0x488b49,_0x30e9d4){return client['request'](_0x403d7f,_0x22c71b)[_0x80a4('0xd')](function(_0x36d26f){logger[_0x80a4('0xe')](_0x80a4('0xf'),_0x2a0ee7,'request\x20sent');logger['debug'](_0x80a4('0x10'),_0x2a0ee7,'request\x20sent',JSON[_0x80a4('0x11')](_0x36d26f));if(_0x36d26f[_0x80a4('0x12')]){if(_0x36d26f['error'][_0x80a4('0x13')]===0x1f4){logger[_0x80a4('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2a0ee7,_0x36d26f[_0x80a4('0x12')][_0x80a4('0x14')]);return _0x30e9d4(_0x36d26f[_0x80a4('0x12')][_0x80a4('0x14')]);}logger[_0x80a4('0x12')](_0x80a4('0xf'),_0x2a0ee7,_0x36d26f[_0x80a4('0x12')][_0x80a4('0x14')]);return _0x488b49(_0x36d26f[_0x80a4('0x12')][_0x80a4('0x14')]);}else{logger[_0x80a4('0xe')](_0x80a4('0xf'),_0x2a0ee7,_0x80a4('0x15'));_0x488b49(_0x36d26f[_0x80a4('0x16')]['message']);}})[_0x80a4('0x17')](function(_0x567b20){logger[_0x80a4('0x12')](_0x80a4('0xf'),_0x2a0ee7,_0x567b20);_0x30e9d4(_0x567b20);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 96a264f..8f75e83 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 _0x2211=['getAnswers','post','/:id/clone','clone','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','/:id/answers'];(function(_0x5708aa,_0x1aef25){var _0x43df8a=function(_0x2a21a1){while(--_0x2a21a1){_0x5708aa['push'](_0x5708aa['shift']());}};_0x43df8a(++_0x1aef25);}(_0x2211,0x7a));var _0x1221=function(_0x4a8227,_0x27ab19){_0x4a8227=_0x4a8227-0x0;var _0x403b2c=_0x2211[_0x4a8227];return _0x403b2c;};'use strict';var multer=require(_0x1221('0x0'));var util=require(_0x1221('0x1'));var path=require(_0x1221('0x2'));var timeout=require(_0x1221('0x3'));var express=require(_0x1221('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1221('0x5'));var interaction=require(_0x1221('0x6'));var config=require(_0x1221('0x7'));var controller=require(_0x1221('0x8'));router[_0x1221('0x9')]('/',auth[_0x1221('0xa')](),controller[_0x1221('0xb')]);router[_0x1221('0x9')](_0x1221('0xc'),auth['isAuthenticated'](),controller[_0x1221('0xd')]);router['get'](_0x1221('0xe'),auth[_0x1221('0xa')](),controller['getSessions']);router[_0x1221('0x9')](_0x1221('0xf'),auth['isAuthenticated'](),controller[_0x1221('0x10')]);router[_0x1221('0x9')]('/:id/summary',auth[_0x1221('0xa')](),timeout('30s'),controller['getSummary']);router[_0x1221('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1221('0x11')](_0x1221('0x12'),auth[_0x1221('0xa')](),controller[_0x1221('0x13')]);router[_0x1221('0x14')]('/:id',auth[_0x1221('0xa')](),controller['update']);router[_0x1221('0x15')](_0x1221('0xc'),auth[_0x1221('0xa')](),controller[_0x1221('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa279=['isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0xa279,0x1c5));var _0x9a27=function(_0xe1e7f5,_0x34da23){_0xe1e7f5=_0xe1e7f5-0x0;var _0x3d4154=_0xa279[_0xe1e7f5];return _0x3d4154;};'use strict';var multer=require(_0x9a27('0x0'));var util=require(_0x9a27('0x1'));var path=require('path');var timeout=require(_0x9a27('0x2'));var express=require(_0x9a27('0x3'));var router=express[_0x9a27('0x4')]();var fs_extra=require(_0x9a27('0x5'));var auth=require(_0x9a27('0x6'));var interaction=require(_0x9a27('0x7'));var config=require(_0x9a27('0x8'));var controller=require(_0x9a27('0x9'));router[_0x9a27('0xa')]('/',auth[_0x9a27('0xb')](),controller[_0x9a27('0xc')]);router[_0x9a27('0xa')](_0x9a27('0xd'),auth[_0x9a27('0xb')](),controller[_0x9a27('0xe')]);router['get'](_0x9a27('0xf'),auth['isAuthenticated'](),controller[_0x9a27('0x10')]);router[_0x9a27('0xa')](_0x9a27('0x11'),auth['isAuthenticated'](),controller[_0x9a27('0x12')]);router['get'](_0x9a27('0x13'),auth[_0x9a27('0xb')](),timeout(_0x9a27('0x14')),controller['getSummary']);router[_0x9a27('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9a27('0x16'),auth[_0x9a27('0xb')](),controller[_0x9a27('0x17')]);router[_0x9a27('0x18')](_0x9a27('0xd'),auth[_0x9a27('0xb')](),controller[_0x9a27('0x19')]);router[_0x9a27('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x9a27('0x1b')]);module[_0x9a27('0x1c')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 8d3c018..fab2a11 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 _0xcd06=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0xcd06,0x1ca));var _0x6cd0=function(_0x57222a,_0x5a8fd6){_0x57222a=_0x57222a-0x0;var _0x25a006=_0xcd06[_0x57222a];return _0x25a006;};'use strict';var Sequelize=require(_0x6cd0('0x0'));var _=require(_0x6cd0('0x1'));var util=require(_0x6cd0('0x2'));module[_0x6cd0('0x3')]={'name':{'type':Sequelize[_0x6cd0('0x4')],'unique':_0x6cd0('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6cd0('0x6')](_0x6cd0('0x7')),'set':function(_0x4eef81){if(_[_0x6cd0('0x8')](_0x4eef81)){this[_0x6cd0('0x9')](_0x6cd0('0xa'),JSON[_0x6cd0('0xb')](_0x4eef81));}else if(_[_0x6cd0('0xc')](_0x4eef81)){this[_0x6cd0('0x9')](_0x6cd0('0xa'),_0x4eef81);}else{this[_0x6cd0('0x9')](_0x6cd0('0xa'),util[_0x6cd0('0xd')](_0x6cd0('0xe'),this[_0x6cd0('0xf')](_0x6cd0('0x5'))||'',this[_0x6cd0('0xf')](_0x6cd0('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6cd0('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3130=['setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','sequelize','util','STRING','name','TEXT','long','isObjectLike','formData','stringify','isString'];(function(_0x1de2bd,_0x953fb){var _0x595960=function(_0xea260b){while(--_0xea260b){_0x1de2bd['push'](_0x1de2bd['shift']());}};_0x595960(++_0x953fb);}(_0x3130,0xed));var _0x0313=function(_0x35837d,_0x1c3711){_0x35837d=_0x35837d-0x0;var _0x192bec=_0x3130[_0x35837d];return _0x192bec;};'use strict';var Sequelize=require(_0x0313('0x0'));var _=require('lodash');var util=require(_0x0313('0x1'));module['exports']={'name':{'type':Sequelize[_0x0313('0x2')],'unique':_0x0313('0x3')},'description':{'type':Sequelize[_0x0313('0x2')]},'formData':{'type':Sequelize[_0x0313('0x4')](_0x0313('0x5')),'set':function(_0x142459){if(_[_0x0313('0x6')](_0x142459)){this['setDataValue'](_0x0313('0x7'),JSON[_0x0313('0x8')](_0x142459));}else if(_[_0x0313('0x9')](_0x142459)){this[_0x0313('0xa')](_0x0313('0x7'),_0x142459);}else{this[_0x0313('0xa')](_0x0313('0x7'),util['format'](_0x0313('0xb'),this[_0x0313('0xc')](_0x0313('0x3'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 9e80285..8b76200 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 _0x6ea9=['YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','Projects','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','userProfileId','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x6ea9,0x89));var _0x96ea=function(_0x37f64a,_0x20dbe2){_0x37f64a=_0x37f64a-0x0;var _0x3748d5=_0x6ea9[_0x37f64a];return _0x3748d5;};'use strict';var emlformat=require(_0x96ea('0x0'));var rimraf=require(_0x96ea('0x1'));var zipdir=require(_0x96ea('0x2'));var jsonpatch=require(_0x96ea('0x3'));var rp=require(_0x96ea('0x4'));var moment=require('moment');var BPromise=require(_0x96ea('0x5'));var Mustache=require(_0x96ea('0x6'));var util=require(_0x96ea('0x7'));var path=require('path');var sox=require(_0x96ea('0x8'));var csv=require('to-csv');var ejs=require(_0x96ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96ea('0xa'));var squel=require('squel');var crypto=require(_0x96ea('0xb'));var jsforce=require(_0x96ea('0xc'));var deskjs=require(_0x96ea('0xd'));var toCsv=require(_0x96ea('0xe'));var querystring=require(_0x96ea('0xf'));var Papa=require(_0x96ea('0x10'));var Redis=require('ioredis');var authService=require(_0x96ea('0x11'));var qs=require(_0x96ea('0x12'));var as=require(_0x96ea('0x13'));var hardwareService=require(_0x96ea('0x14'));var logger=require(_0x96ea('0x15'))(_0x96ea('0x16'));var utils=require(_0x96ea('0x17'));var config=require(_0x96ea('0x18'));var licenseUtil=require(_0x96ea('0x19'));var db=require(_0x96ea('0x1a'))['db'];function respondWithStatusCode(_0x593f80,_0x2384b1){_0x2384b1=_0x2384b1||0xcc;return function(_0x5f4c12){if(_0x5f4c12){return _0x593f80[_0x96ea('0x1b')](_0x2384b1);}return _0x593f80[_0x96ea('0x1c')](_0x2384b1)['end']();};}function respondWithResult(_0x1df101,_0x1ce6e9){_0x1ce6e9=_0x1ce6e9||0xc8;return function(_0xc1059e){if(_0xc1059e){return _0x1df101[_0x96ea('0x1c')](_0x1ce6e9)[_0x96ea('0x1d')](_0xc1059e);}};}function respondWithFilteredResult(_0x19308f,_0x1dd4f1){return function(_0x237f2c){if(_0x237f2c){var _0x4a847d=typeof _0x1dd4f1[_0x96ea('0x1e')]==='undefined'&&typeof _0x1dd4f1['limit']===_0x96ea('0x1f');var _0x3cb1e0=_0x237f2c['count'];var _0x47444c=_0x4a847d?0x0:_0x1dd4f1[_0x96ea('0x1e')];var _0x24c940=_0x4a847d?_0x237f2c[_0x96ea('0x20')]:_0x1dd4f1[_0x96ea('0x1e')]+_0x1dd4f1[_0x96ea('0x21')];var _0x43dd6f;if(_0x24c940>=_0x3cb1e0){_0x24c940=_0x3cb1e0;_0x43dd6f=0xc8;}else{_0x43dd6f=0xce;}_0x19308f['status'](_0x43dd6f);return _0x19308f['set'](_0x96ea('0x22'),_0x47444c+'-'+_0x24c940+'/'+_0x3cb1e0)[_0x96ea('0x1d')](_0x237f2c);}return null;};}function patchUpdates(_0xfaec11){return function(_0x1e1bcd){try{jsonpatch[_0x96ea('0x23')](_0x1e1bcd,_0xfaec11,!![]);}catch(_0xa3941){return BPromise[_0x96ea('0x24')](_0xa3941);}return _0x1e1bcd[_0x96ea('0x25')]();};}function saveUpdates(_0x2235e7,_0x3a618c){return function(_0x3a99f6){if(_0x3a99f6){return _0x3a99f6['update'](_0x2235e7)[_0x96ea('0x26')](function(_0x22cdc4){return _0x22cdc4;});}return null;};}function removeEntity(_0x3dc8bd,_0x3634e7){return function(_0x396117){if(_0x396117){return _0x396117[_0x96ea('0x27')]()['then'](function(){var _0x33e05b=_0x396117['get']({'plain':!![]});var _0x36143a=_0x96ea('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x36143a,'resourceId':_0x33e05b['id']}})[_0x96ea('0x26')](function(){return _0x396117;});})[_0x96ea('0x26')](function(){_0x3dc8bd[_0x96ea('0x1c')](0xcc)[_0x96ea('0x29')]();});}};}function handleEntityNotFound(_0x197af7,_0x49a7bd){return function(_0xf31340){if(!_0xf31340){_0x197af7[_0x96ea('0x1b')](0x194);}return _0xf31340;};}function handleError(_0x108043,_0x247c8c){_0x247c8c=_0x247c8c||0x1f4;return function(_0x2aa9e9){logger[_0x96ea('0x2a')](_0x2aa9e9[_0x96ea('0x2b')]);if(_0x2aa9e9[_0x96ea('0x2c')]){delete _0x2aa9e9[_0x96ea('0x2c')];}_0x108043[_0x96ea('0x1c')](_0x247c8c)[_0x96ea('0x2d')](_0x2aa9e9);};}exports[_0x96ea('0x2e')]=function(_0x91a2a2,_0x30ec3f){var _0x1c6f08={},_0x5a73a2={},_0x114450={'count':0x0,'rows':[]};var _0x13be02=_[_0x96ea('0x2f')](db['JscriptyProject'][_0x96ea('0x30')],function(_0x4e60e8){return{'name':_0x4e60e8['fieldName'],'type':_0x4e60e8[_0x96ea('0x31')][_0x96ea('0x32')]};});_0x5a73a2['model']=_[_0x96ea('0x2f')](_0x13be02,_0x96ea('0x2c'));_0x5a73a2[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x91a2a2[_0x96ea('0x33')]);_0x5a73a2[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x5a73a2[_0x96ea('0x37')],_0x5a73a2['query']);_0x1c6f08[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x5a73a2['model'],qs[_0x96ea('0x39')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x39')]));_0x1c6f08[_0x96ea('0x38')]=_0x1c6f08[_0x96ea('0x38')][_0x96ea('0x3a')]?_0x1c6f08[_0x96ea('0x38')]:_0x5a73a2['model'];if(!_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3b')](_0x96ea('0x3c'))){_0x1c6f08[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x1c6f08[_0x96ea('0x1e')]=qs[_0x96ea('0x1e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x1e')]);}_0x1c6f08[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x1c6f08[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x91a2a2[_0x96ea('0x33')],_0x5a73a2['filters']),_0x13be02);if(_0x91a2a2[_0x96ea('0x33')]['filter']){_0x1c6f08[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x1c6f08[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x13be02,function(_0x2b9966){if(_0x2b9966['type']!==_0x96ea('0x42')){var _0x35266f={};_0x35266f[_0x2b9966[_0x96ea('0x2c')]]={'$like':'%'+_0x91a2a2['query'][_0x96ea('0x43')]+'%'};return _0x35266f;}})});}_0x1c6f08=_['merge']({},_0x1c6f08,_0x91a2a2[_0x96ea('0x44')]);var _0x47ed8e={'where':_0x1c6f08['where']};return db[_0x96ea('0x45')][_0x96ea('0x20')](_0x47ed8e)[_0x96ea('0x26')](function(_0x249456){_0x114450['count']=_0x249456;if(_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x1c6f08[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x45')][_0x96ea('0x48')](_0x1c6f08);})['then'](function(_0x5a346a){_0x114450[_0x96ea('0x49')]=_0x5a346a;return _0x114450;})[_0x96ea('0x26')](respondWithFilteredResult(_0x30ec3f,_0x1c6f08))[_0x96ea('0x4a')](handleError(_0x30ec3f,null));};exports['show']=function(_0x3d46ec,_0x2430b8){var _0x496dd9={'raw':![],'where':{'id':_0x3d46ec[_0x96ea('0x4b')]['id']}},_0x48d9be={};_0x48d9be[_0x96ea('0x37')]=_['keys'](db['JscriptyProject'][_0x96ea('0x30')]);_0x48d9be[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x3d46ec['query']);_0x48d9be[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],_0x48d9be[_0x96ea('0x33')]);_0x496dd9['attributes']=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x3d46ec['query'][_0x96ea('0x39')]));_0x496dd9[_0x96ea('0x38')]=_0x496dd9[_0x96ea('0x38')]['length']?_0x496dd9[_0x96ea('0x38')]:_0x48d9be[_0x96ea('0x37')];if(_0x3d46ec[_0x96ea('0x33')][_0x96ea('0x46')]){_0x496dd9[_0x96ea('0x47')]=[{'all':!![]}];}_0x496dd9=_[_0x96ea('0x41')]({},_0x496dd9,_0x3d46ec[_0x96ea('0x44')]);return db['JscriptyProject']['find'](_0x496dd9)[_0x96ea('0x26')](handleEntityNotFound(_0x2430b8,null))[_0x96ea('0x26')](respondWithResult(_0x2430b8,null))[_0x96ea('0x4a')](handleError(_0x2430b8,null));};exports[_0x96ea('0x4c')]=function(_0x31a8af,_0xf921c5){return db[_0x96ea('0x45')]['create'](_0x31a8af['body'],{})[_0x96ea('0x26')](function(_0x131395){var _0x351440=_0x31a8af[_0x96ea('0x4d')][_0x96ea('0x4e')]({'plain':!![]});if(!_0x351440)throw new Error(_0x96ea('0x4f'));if(_0x351440[_0x96ea('0x50')]==='user'){var _0x440b35=_0x131395[_0x96ea('0x4e')]({'plain':!![]});var _0x5dc96a=_0x96ea('0x28');return db[_0x96ea('0x51')][_0x96ea('0x52')]({'where':{'name':_0x5dc96a,'userProfileId':_0x351440['userProfileId']},'raw':!![]})['then'](function(_0x4b15af){if(_0x4b15af&&_0x4b15af[_0x96ea('0x53')]===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x440b35[_0x96ea('0x2c')],'resourceId':_0x440b35['id'],'type':_0x4b15af[_0x96ea('0x2c')],'sectionId':_0x4b15af['id']},{})[_0x96ea('0x26')](function(){return _0x131395;});}else{return _0x131395;}})['catch'](function(_0x3ef29b){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x3ef29b);throw _0x3ef29b;});}return _0x131395;})['then'](respondWithResult(_0xf921c5,0xc9))[_0x96ea('0x4a')](handleError(_0xf921c5,null));};exports[_0x96ea('0x56')]=function(_0x9e64c4,_0x28db59){var _0x2faa1f={'where':{'id':_0x9e64c4['params']['id']}},_0x26e92f={};_0x26e92f['model']=_['keys'](db[_0x96ea('0x45')]['rawAttributes']);_0x2faa1f[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x26e92f[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x9e64c4[_0x96ea('0x33')]['fields']));_0x2faa1f[_0x96ea('0x38')]=_0x2faa1f['attributes'][_0x96ea('0x3a')]?_0x2faa1f['attributes']:_0x26e92f[_0x96ea('0x37')];if(_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]){_0x2faa1f[_0x96ea('0x47')]=[{'all':!![]}];}_0x2faa1f=_[_0x96ea('0x41')]({},_0x2faa1f,_0x9e64c4[_0x96ea('0x44')]);return db['JscriptyProject'][_0x96ea('0x52')](_0x2faa1f)[_0x96ea('0x26')](handleEntityNotFound(_0x28db59,null))[_0x96ea('0x26')](function(_0x31a532){if(_0x31a532){var _0x3ed8eb=_0x31a532[_0x96ea('0x4e')]({'plain':!![]});_0x3ed8eb=qs['omit'](_0x3ed8eb,['id',_0x96ea('0x57'),_0x96ea('0x58')]);_0x9e64c4[_0x96ea('0x59')]=_[_0x96ea('0x5a')](_0x9e64c4['body'],['id',_0x96ea('0x57'),_0x96ea('0x58')]);return db[_0x96ea('0x45')][_0x96ea('0x4c')](_[_0x96ea('0x41')](_0x3ed8eb,_0x9e64c4[_0x96ea('0x59')]),{'include':_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x5744b7){var _0x3d9461=_0x9e64c4[_0x96ea('0x4d')]['get']({'plain':!![]});if(!_0x3d9461)throw new Error(_0x96ea('0x4f'));if(_0x3d9461[_0x96ea('0x50')]===_0x96ea('0x4d')){var _0x34cc52=_0x5744b7['get']({'plain':!![]});var _0x73a0f6=_0x96ea('0x28');return db['UserProfileSection'][_0x96ea('0x52')]({'where':{'name':_0x73a0f6,'userProfileId':_0x3d9461[_0x96ea('0x5b')]},'raw':!![]})['then'](function(_0x246392){if(_0x246392&&_0x246392['autoAssociation']===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x34cc52[_0x96ea('0x2c')],'resourceId':_0x34cc52['id'],'type':_0x246392[_0x96ea('0x2c')],'sectionId':_0x246392['id']},{})[_0x96ea('0x26')](function(){return _0x5744b7;});}else{return _0x5744b7;}})[_0x96ea('0x4a')](function(_0x1d199f){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x1d199f);throw _0x1d199f;});}return _0x5744b7;});}})[_0x96ea('0x26')](respondWithResult(_0x28db59,0xc9))['catch'](handleError(_0x28db59,null));};exports[_0x96ea('0x5c')]=function(_0x2536ff,_0x38e94f){if(_0x2536ff[_0x96ea('0x59')]['id']){delete _0x2536ff['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x2536ff[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x38e94f,null))['then'](saveUpdates(_0x2536ff[_0x96ea('0x59')],null))['then'](respondWithResult(_0x38e94f,null))['catch'](handleError(_0x38e94f,null));};exports[_0x96ea('0x27')]=function(_0x42fd19,_0x37756d){return db[_0x96ea('0x45')][_0x96ea('0x52')]({'where':{'id':_0x42fd19[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x37756d,null))['then'](removeEntity(_0x37756d,null))[_0x96ea('0x4a')](handleError(_0x37756d,null));};exports[_0x96ea('0x5d')]=function(_0x22a4d2,_0x4960ea,_0x4f6831){var _0x3701b5={'raw':!![],'where':{}};var _0x1737d3={};var _0x25f8ee={'count':0x0,'rows':[]};return db[_0x96ea('0x45')][_0x96ea('0x5e')]({'where':{'id':_0x22a4d2[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x4960ea,null))[_0x96ea('0x26')](function(_0xd56ef0){if(_0xd56ef0){_0x1737d3['model']=_[_0x96ea('0x34')](db[_0x96ea('0x5f')][_0x96ea('0x30')]);_0x1737d3['query']=_[_0x96ea('0x34')](_0x22a4d2['query']);_0x1737d3[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],_0x1737d3[_0x96ea('0x33')]);_0x3701b5[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],qs['fields'](_0x22a4d2[_0x96ea('0x33')]['fields']));_0x3701b5[_0x96ea('0x38')]=_0x3701b5['attributes'][_0x96ea('0x3a')]?_0x3701b5['attributes']:_0x1737d3['model'];if(!_0x22a4d2[_0x96ea('0x33')]['hasOwnProperty'](_0x96ea('0x3c'))){_0x3701b5[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x3701b5['offset']=qs['offset'](_0x22a4d2['query']['offset']);}_0x3701b5['order']=qs[_0x96ea('0x3e')](_0x22a4d2['query'][_0x96ea('0x3e')]);_0x3701b5[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_['pick'](_0x22a4d2[_0x96ea('0x33')],_0x1737d3[_0x96ea('0x35')]));_0x3701b5[_0x96ea('0x3f')]['ProjectId']=_0xd56ef0['id'];if(_0x22a4d2['query'][_0x96ea('0x43')]){_0x3701b5[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x3701b5[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x3701b5['attributes'],function(_0x35401a){var _0x566692={};_0x566692[_0x35401a]={'$like':'%'+_0x22a4d2['query'][_0x96ea('0x43')]+'%'};return _0x566692;})});}_0x3701b5=_['merge']({},_0x3701b5,_0x22a4d2['options']);return db[_0x96ea('0x5f')]['count']({'where':_0x3701b5[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3f2eab){_0x25f8ee[_0x96ea('0x20')]=_0x3f2eab;if(_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x3701b5[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x3701b5);})['then'](function(_0x33534b){_0x25f8ee['rows']=_0x33534b;return _0x25f8ee;});}})[_0x96ea('0x26')](respondWithFilteredResult(_0x4960ea,_0x3701b5))[_0x96ea('0x4a')](handleError(_0x4960ea,null));};exports['getAnswers']=function(_0x25ed8a,_0x53ab95,_0x2f5434){var _0x2612c3={'raw':!![],'where':{}};var _0x123936={};var _0x33f9ef={'count':0x0,'rows':[]};return db[_0x96ea('0x45')]['findOne']({'where':{'id':_0x25ed8a[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x53ab95,null))[_0x96ea('0x26')](function(_0x2d8098){if(_0x2d8098){_0x123936[_0x96ea('0x37')]=_[_0x96ea('0x34')](db[_0x96ea('0x60')][_0x96ea('0x30')]);_0x123936[_0x96ea('0x33')]=_['keys'](_0x25ed8a[_0x96ea('0x33')]);_0x123936[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x123936['model'],_0x123936[_0x96ea('0x33')]);_0x2612c3[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x123936[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x25ed8a['query'][_0x96ea('0x39')]));_0x2612c3[_0x96ea('0x38')]=_0x2612c3['attributes'][_0x96ea('0x3a')]?_0x2612c3['attributes']:_0x123936['model'];if(!_0x25ed8a['query']['hasOwnProperty'](_0x96ea('0x3c'))){_0x2612c3[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x25ed8a['query'][_0x96ea('0x21')]);_0x2612c3['offset']=qs['offset'](_0x25ed8a[_0x96ea('0x33')]['offset']);}_0x2612c3[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x25ed8a[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x2612c3[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x25ed8a[_0x96ea('0x33')],_0x123936[_0x96ea('0x35')]));_0x2612c3['where'][_0x96ea('0x61')]=_0x2d8098['id'];if(_0x25ed8a[_0x96ea('0x33')]['filter']){_0x2612c3[_0x96ea('0x3f')]=_['merge'](_0x2612c3[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x2612c3[_0x96ea('0x38')],function(_0x3419bf){var _0xdba9dd={};_0xdba9dd[_0x3419bf]={'$like':'%'+_0x25ed8a[_0x96ea('0x33')]['filter']+'%'};return _0xdba9dd;})});}_0x2612c3=_[_0x96ea('0x41')]({},_0x2612c3,_0x25ed8a[_0x96ea('0x44')]);return db[_0x96ea('0x60')][_0x96ea('0x20')]({'where':_0x2612c3[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3b06e7){_0x33f9ef['count']=_0x3b06e7;if(_0x25ed8a[_0x96ea('0x33')]['includeAll']){_0x2612c3['include']=[{'all':!![]}];}return db[_0x96ea('0x60')][_0x96ea('0x48')](_0x2612c3);})[_0x96ea('0x26')](function(_0x53833a){_0x33f9ef[_0x96ea('0x49')]=_0x53833a;return _0x33f9ef;});}})['then'](respondWithFilteredResult(_0x53ab95,_0x2612c3))[_0x96ea('0x4a')](handleError(_0x53ab95,null));};function char(_0x171e94){return _0x96ea('0x62')===typeof _0x171e94?String[_0x96ea('0x63')][_0x96ea('0x23')](null,arguments):_0x171e94;}function needsEncapsulation(_0x15da1b){return!!_0x15da1b&&(_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0xd))>=0x0||_0x15da1b['toString']()[_0x96ea('0x65')](char(0xa))>=0x0||_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0x2c))>=0x0||_0x15da1b['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1baced){var _0x426ec2=char(0x22),_0x50f372='\x5c'+char(0x22),_0x917222=_0x1baced[_0x96ea('0x64')]()[_0x96ea('0x66')](new RegExp(_0x426ec2,'g'),_0x50f372);return _0x426ec2+_0x917222+_0x426ec2;}exports['getSummary']=function(_0x1906c0,_0x2691c4,_0x4691ec){var _0x125773,_0x362eeb;var _0x1601cc={'where':{'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id']}};if(_0x1906c0['query'][_0x96ea('0x67')]){_0x1601cc[_0x96ea('0x3f')][_0x96ea('0x68')]=JSON[_0x96ea('0x69')](_0x1906c0[_0x96ea('0x33')][_0x96ea('0x67')]);}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x1601cc)[_0x96ea('0x26')](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x1977d5){if(_0x1977d5){_0x125773=_0x1977d5;return db['JscriptyQuestionReport'][_0x96ea('0x48')]({'where':{'SessionId':{'$in':_['map'](_0x125773,'id')},'ProjectId':_0x1906c0['params']['id']},'order':_0x96ea('0x6a')});}})['then'](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x21a30e){if(_0x21a30e){_0x362eeb=_0x21a30e;var _0x468643={};for(var _0x3678d0=0x0,_0x551348=_0x362eeb['length'];_0x3678d0<_0x551348;_0x3678d0++){if(!_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x3678d0][_0x96ea('0x6b')])){_0x468643[_0x362eeb[_0x3678d0][_0x96ea('0x6b')]]=needsEncapsulation(_0x362eeb[_0x3678d0][_0x96ea('0x6c')])?encapsulate(_0x362eeb[_0x3678d0][_0x96ea('0x6c')]):_0x362eeb[_0x3678d0][_0x96ea('0x6c')];}}var _0x467740=[],_0x2d0f41={};for(var _0x5cb296=0x0,_0x105ddb=_0x125773[_0x96ea('0x3a')];_0x5cb296<_0x105ddb;_0x5cb296++){_0x2d0f41={'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id'],'SessionId':_0x125773[_0x5cb296]['id'],'StartTime':moment(_0x125773[_0x5cb296][_0x96ea('0x68')])['format'](_0x96ea('0x6d'))};for(var _0x295b10=0x0,_0x14e08c=_0x362eeb['length'];_0x295b10<_0x14e08c;_0x295b10++){if(_0x362eeb[_0x295b10][_0x96ea('0x6e')]==_0x125773[_0x5cb296]['id']&&_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x295b10][_0x96ea('0x6b')])){_0x2d0f41[_0x468643[_0x362eeb[_0x295b10][_0x96ea('0x6b')]]]=_0x362eeb[_0x295b10][_0x96ea('0x6f')];}}for(var _0x5ecf7f in _0x468643){if(!_0x2d0f41[_0x96ea('0x3b')](_0x468643[_0x5ecf7f])){_0x2d0f41[_0x468643[_0x5ecf7f]]=null;}}_0x467740[_0x96ea('0x70')](_0x2d0f41);}return _0x467740;}})['then'](function(_0x42a085){if(!_[_0x96ea('0x71')](_0x42a085)){var _0x5ef086=toCsv(_0x42a085);var _0x370cbe=Date[_0x96ea('0x72')]();fs[_0x96ea('0x73')](util[_0x96ea('0x74')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe),_0x5ef086);_0x2691c4[_0x96ea('0x75')](_0x96ea('0x76'),_0x96ea('0x77')+util[_0x96ea('0x74')](_0x96ea('0x78'),_0x1906c0['params']['id'],_0x370cbe));_0x2691c4[_0x96ea('0x75')]('Content-type','text/csv');return _0x2691c4[_0x96ea('0x79')](util[_0x96ea('0x74')](_0x96ea('0x7a'),_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe));}else{return _0x2691c4['sendStatus'](0xcc);}})['catch'](handleError(_0x2691c4,null));}; \ No newline at end of file +var _0xb1a4=['writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','get','Projects','UserProfileResource','sendStatus','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','destroy','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','getAnswers','order','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now'];(function(_0x25d4b7,_0x1139fe){var _0x2ef539=function(_0xb581cf){while(--_0xb581cf){_0x25d4b7['push'](_0x25d4b7['shift']());}};_0x2ef539(++_0x1139fe);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x3a68e9,_0x3ef131){_0x3a68e9=_0x3a68e9-0x0;var _0x1fe113=_0xb1a4[_0x3a68e9];return _0x1fe113;};'use strict';var emlformat=require(_0x4b1a('0x0'));var rimraf=require(_0x4b1a('0x1'));var zipdir=require(_0x4b1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4b1a('0x3'));var Mustache=require(_0x4b1a('0x4'));var util=require('util');var path=require(_0x4b1a('0x5'));var sox=require('sox');var csv=require(_0x4b1a('0x6'));var ejs=require(_0x4b1a('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b1a('0x8'));var squel=require(_0x4b1a('0x9'));var crypto=require(_0x4b1a('0xa'));var jsforce=require(_0x4b1a('0xb'));var deskjs=require(_0x4b1a('0xc'));var toCsv=require(_0x4b1a('0x6'));var querystring=require('querystring');var Papa=require(_0x4b1a('0xd'));var Redis=require(_0x4b1a('0xe'));var authService=require(_0x4b1a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b1a('0x10'));var logger=require('../../config/logger')(_0x4b1a('0x11'));var utils=require(_0x4b1a('0x12'));var config=require(_0x4b1a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b1a('0x14'))['db'];function respondWithStatusCode(_0x51b5ac,_0x5e7f0c){_0x5e7f0c=_0x5e7f0c||0xcc;return function(_0x5d47ef){if(_0x5d47ef){return _0x51b5ac['sendStatus'](_0x5e7f0c);}return _0x51b5ac['status'](_0x5e7f0c)[_0x4b1a('0x15')]();};}function respondWithResult(_0x5bfdaa,_0x1bad04){_0x1bad04=_0x1bad04||0xc8;return function(_0x470cc1){if(_0x470cc1){return _0x5bfdaa['status'](_0x1bad04)['json'](_0x470cc1);}};}function respondWithFilteredResult(_0x54abe5,_0x1920e8){return function(_0x3350b8){if(_0x3350b8){var _0x438092=typeof _0x1920e8[_0x4b1a('0x16')]===_0x4b1a('0x17')&&typeof _0x1920e8['limit']==='undefined';var _0x173139=_0x3350b8[_0x4b1a('0x18')];var _0x5887ae=_0x438092?0x0:_0x1920e8[_0x4b1a('0x16')];var _0xa77f53=_0x438092?_0x3350b8[_0x4b1a('0x18')]:_0x1920e8[_0x4b1a('0x16')]+_0x1920e8['limit'];var _0x4cdbc0;if(_0xa77f53>=_0x173139){_0xa77f53=_0x173139;_0x4cdbc0=0xc8;}else{_0x4cdbc0=0xce;}_0x54abe5[_0x4b1a('0x19')](_0x4cdbc0);return _0x54abe5[_0x4b1a('0x1a')](_0x4b1a('0x1b'),_0x5887ae+'-'+_0xa77f53+'/'+_0x173139)['json'](_0x3350b8);}return null;};}function patchUpdates(_0x501ae1){return function(_0x2cb261){try{jsonpatch[_0x4b1a('0x1c')](_0x2cb261,_0x501ae1,!![]);}catch(_0x170e4c){return BPromise[_0x4b1a('0x1d')](_0x170e4c);}return _0x2cb261['save']();};}function saveUpdates(_0x1156b5,_0x33ef81){return function(_0xbfd042){if(_0xbfd042){return _0xbfd042[_0x4b1a('0x1e')](_0x1156b5)[_0x4b1a('0x1f')](function(_0x2250ed){return _0x2250ed;});}return null;};}function removeEntity(_0x462c8a,_0x5bbd70){return function(_0x368a9e){if(_0x368a9e){return _0x368a9e['destroy']()[_0x4b1a('0x1f')](function(){var _0x1becd5=_0x368a9e[_0x4b1a('0x20')]({'plain':!![]});var _0x4342d4=_0x4b1a('0x21');return db[_0x4b1a('0x22')]['destroy']({'where':{'type':_0x4342d4,'resourceId':_0x1becd5['id']}})[_0x4b1a('0x1f')](function(){return _0x368a9e;});})[_0x4b1a('0x1f')](function(){_0x462c8a[_0x4b1a('0x19')](0xcc)[_0x4b1a('0x15')]();});}};}function handleEntityNotFound(_0x368626,_0xa516){return function(_0x448da3){if(!_0x448da3){_0x368626[_0x4b1a('0x23')](0x194);}return _0x448da3;};}function handleError(_0x317923,_0x114413){_0x114413=_0x114413||0x1f4;return function(_0x35f399){logger[_0x4b1a('0x24')](_0x35f399[_0x4b1a('0x25')]);if(_0x35f399[_0x4b1a('0x26')]){delete _0x35f399[_0x4b1a('0x26')];}_0x317923[_0x4b1a('0x19')](_0x114413)[_0x4b1a('0x27')](_0x35f399);};}exports[_0x4b1a('0x28')]=function(_0x5893e0,_0x4bd38c){var _0xed54b1={},_0x2cc0ce={},_0x215045={'count':0x0,'rows':[]};var _0x220058=_[_0x4b1a('0x29')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')],function(_0x34cfe0){return{'name':_0x34cfe0['fieldName'],'type':_0x34cfe0[_0x4b1a('0x2c')][_0x4b1a('0x2d')]};});_0x2cc0ce['model']=_[_0x4b1a('0x29')](_0x220058,_0x4b1a('0x26'));_0x2cc0ce[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x5893e0[_0x4b1a('0x2e')]);_0x2cc0ce['filters']=_[_0x4b1a('0x30')](_0x2cc0ce[_0x4b1a('0x31')],_0x2cc0ce[_0x4b1a('0x2e')]);_0xed54b1[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x2cc0ce[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x5893e0[_0x4b1a('0x2e')]['fields']));_0xed54b1[_0x4b1a('0x32')]=_0xed54b1[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0xed54b1['attributes']:_0x2cc0ce['model'];if(!_0x5893e0[_0x4b1a('0x2e')]['hasOwnProperty'](_0x4b1a('0x35'))){_0xed54b1[_0x4b1a('0x36')]=qs[_0x4b1a('0x36')](_0x5893e0[_0x4b1a('0x2e')]['limit']);_0xed54b1[_0x4b1a('0x16')]=qs[_0x4b1a('0x16')](_0x5893e0['query'][_0x4b1a('0x16')]);}_0xed54b1['order']=qs[_0x4b1a('0x37')](_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x37')]);_0xed54b1['where']=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x5893e0[_0x4b1a('0x2e')],_0x2cc0ce[_0x4b1a('0x38')]),_0x220058);if(_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x3a')]){_0xed54b1[_0x4b1a('0x3b')]=_[_0x4b1a('0x3c')](_0xed54b1[_0x4b1a('0x3b')],{'$or':_['map'](_0x220058,function(_0x2f493d){if(_0x2f493d[_0x4b1a('0x2c')]!==_0x4b1a('0x3d')){var _0xeb70c={};_0xeb70c[_0x2f493d[_0x4b1a('0x26')]]={'$like':'%'+_0x5893e0[_0x4b1a('0x2e')][_0x4b1a('0x3a')]+'%'};return _0xeb70c;}})});}_0xed54b1=_[_0x4b1a('0x3c')]({},_0xed54b1,_0x5893e0[_0x4b1a('0x3e')]);var _0x4d4747={'where':_0xed54b1[_0x4b1a('0x3b')]};return db[_0x4b1a('0x2a')][_0x4b1a('0x18')](_0x4d4747)[_0x4b1a('0x1f')](function(_0x5d00c0){_0x215045['count']=_0x5d00c0;if(_0x5893e0['query'][_0x4b1a('0x3f')]){_0xed54b1[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x2a')][_0x4b1a('0x41')](_0xed54b1);})[_0x4b1a('0x1f')](function(_0x4f4c77){_0x215045[_0x4b1a('0x42')]=_0x4f4c77;return _0x215045;})[_0x4b1a('0x1f')](respondWithFilteredResult(_0x4bd38c,_0xed54b1))[_0x4b1a('0x43')](handleError(_0x4bd38c,null));};exports[_0x4b1a('0x44')]=function(_0x46bf77,_0x161543){var _0x3db7a9={'raw':![],'where':{'id':_0x46bf77[_0x4b1a('0x45')]['id']}},_0x1a863e={};_0x1a863e[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db[_0x4b1a('0x2a')][_0x4b1a('0x2b')]);_0x1a863e['query']=_[_0x4b1a('0x2f')](_0x46bf77['query']);_0x1a863e[_0x4b1a('0x38')]=_[_0x4b1a('0x30')](_0x1a863e[_0x4b1a('0x31')],_0x1a863e[_0x4b1a('0x2e')]);_0x3db7a9[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x1a863e['model'],qs[_0x4b1a('0x33')](_0x46bf77[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x3db7a9[_0x4b1a('0x32')]=_0x3db7a9[_0x4b1a('0x32')]['length']?_0x3db7a9['attributes']:_0x1a863e['model'];if(_0x46bf77[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x3db7a9[_0x4b1a('0x40')]=[{'all':!![]}];}_0x3db7a9=_[_0x4b1a('0x3c')]({},_0x3db7a9,_0x46bf77[_0x4b1a('0x3e')]);return db[_0x4b1a('0x2a')][_0x4b1a('0x46')](_0x3db7a9)['then'](handleEntityNotFound(_0x161543,null))[_0x4b1a('0x1f')](respondWithResult(_0x161543,null))[_0x4b1a('0x43')](handleError(_0x161543,null));};exports[_0x4b1a('0x47')]=function(_0x601ecd,_0x4c3b46){return db[_0x4b1a('0x2a')][_0x4b1a('0x47')](_0x601ecd[_0x4b1a('0x48')],{})[_0x4b1a('0x1f')](function(_0x257e24){var _0x35966f=_0x601ecd[_0x4b1a('0x49')][_0x4b1a('0x20')]({'plain':!![]});if(!_0x35966f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35966f[_0x4b1a('0x4a')]===_0x4b1a('0x49')){var _0x1facd9=_0x257e24[_0x4b1a('0x20')]({'plain':!![]});var _0x42d686=_0x4b1a('0x21');return db[_0x4b1a('0x4b')][_0x4b1a('0x46')]({'where':{'name':_0x42d686,'userProfileId':_0x35966f[_0x4b1a('0x4c')]},'raw':!![]})[_0x4b1a('0x1f')](function(_0x3aa309){if(_0x3aa309&&_0x3aa309[_0x4b1a('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x1facd9[_0x4b1a('0x26')],'resourceId':_0x1facd9['id'],'type':_0x3aa309['name'],'sectionId':_0x3aa309['id']},{})['then'](function(){return _0x257e24;});}else{return _0x257e24;}})[_0x4b1a('0x43')](function(_0x1b897c){logger[_0x4b1a('0x24')](_0x4b1a('0x4e'),_0x1b897c);throw _0x1b897c;});}return _0x257e24;})[_0x4b1a('0x1f')](respondWithResult(_0x4c3b46,0xc9))[_0x4b1a('0x43')](handleError(_0x4c3b46,null));};exports[_0x4b1a('0x4f')]=function(_0x3866a4,_0x1668b6){var _0x371ccf={'where':{'id':_0x3866a4[_0x4b1a('0x45')]['id']}},_0x208100={};_0x208100['model']=_[_0x4b1a('0x2f')](db['JscriptyProject'][_0x4b1a('0x2b')]);_0x371ccf['attributes']=_[_0x4b1a('0x30')](_0x208100[_0x4b1a('0x31')],qs['fields'](_0x3866a4[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x371ccf['attributes']=_0x371ccf[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x371ccf[_0x4b1a('0x32')]:_0x208100[_0x4b1a('0x31')];if(_0x3866a4[_0x4b1a('0x2e')]['includeAll']){_0x371ccf['include']=[{'all':!![]}];}_0x371ccf=_[_0x4b1a('0x3c')]({},_0x371ccf,_0x3866a4['options']);return db[_0x4b1a('0x2a')][_0x4b1a('0x46')](_0x371ccf)[_0x4b1a('0x1f')](handleEntityNotFound(_0x1668b6,null))[_0x4b1a('0x1f')](function(_0x4950ab){if(_0x4950ab){var _0x48976d=_0x4950ab[_0x4b1a('0x20')]({'plain':!![]});_0x48976d=qs[_0x4b1a('0x50')](_0x48976d,['id',_0x4b1a('0x51'),_0x4b1a('0x52')]);_0x3866a4[_0x4b1a('0x48')]=_[_0x4b1a('0x50')](_0x3866a4[_0x4b1a('0x48')],['id',_0x4b1a('0x51'),'updatedAt']);return db[_0x4b1a('0x2a')][_0x4b1a('0x47')](_[_0x4b1a('0x3c')](_0x48976d,_0x3866a4[_0x4b1a('0x48')]),{'include':_0x3866a4[_0x4b1a('0x2e')]['includeAll']?[{'all':!![]}]:undefined})[_0x4b1a('0x1f')](function(_0x1eff9f){var _0x30ce51=_0x3866a4['user'][_0x4b1a('0x20')]({'plain':!![]});if(!_0x30ce51)throw new Error(_0x4b1a('0x53'));if(_0x30ce51[_0x4b1a('0x4a')]===_0x4b1a('0x49')){var _0x2180cc=_0x1eff9f[_0x4b1a('0x20')]({'plain':!![]});var _0xc65a46=_0x4b1a('0x21');return db[_0x4b1a('0x4b')][_0x4b1a('0x46')]({'where':{'name':_0xc65a46,'userProfileId':_0x30ce51[_0x4b1a('0x4c')]},'raw':!![]})[_0x4b1a('0x1f')](function(_0x54ebed){if(_0x54ebed&&_0x54ebed['autoAssociation']===0x0){return db[_0x4b1a('0x22')][_0x4b1a('0x47')]({'name':_0x2180cc[_0x4b1a('0x26')],'resourceId':_0x2180cc['id'],'type':_0x54ebed[_0x4b1a('0x26')],'sectionId':_0x54ebed['id']},{})[_0x4b1a('0x1f')](function(){return _0x1eff9f;});}else{return _0x1eff9f;}})[_0x4b1a('0x43')](function(_0x33d038){logger[_0x4b1a('0x24')](_0x4b1a('0x4e'),_0x33d038);throw _0x33d038;});}return _0x1eff9f;});}})[_0x4b1a('0x1f')](respondWithResult(_0x1668b6,0xc9))[_0x4b1a('0x43')](handleError(_0x1668b6,null));};exports[_0x4b1a('0x1e')]=function(_0x2b8891,_0x1e72bc){if(_0x2b8891['body']['id']){delete _0x2b8891[_0x4b1a('0x48')]['id'];}return db[_0x4b1a('0x2a')][_0x4b1a('0x46')]({'where':{'id':_0x2b8891['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x1e72bc,null))[_0x4b1a('0x1f')](saveUpdates(_0x2b8891[_0x4b1a('0x48')],null))[_0x4b1a('0x1f')](respondWithResult(_0x1e72bc,null))[_0x4b1a('0x43')](handleError(_0x1e72bc,null));};exports[_0x4b1a('0x54')]=function(_0x5d7841,_0x4cceb8){return db[_0x4b1a('0x2a')][_0x4b1a('0x46')]({'where':{'id':_0x5d7841['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x4cceb8,null))['then'](removeEntity(_0x4cceb8,null))[_0x4b1a('0x43')](handleError(_0x4cceb8,null));};exports['getSessions']=function(_0x45a2a4,_0x166302,_0x4ee029){var _0x46be0e={'raw':!![],'where':{}};var _0x206d04={};var _0x33f33c={'count':0x0,'rows':[]};return db[_0x4b1a('0x2a')][_0x4b1a('0x55')]({'where':{'id':_0x45a2a4['params']['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x166302,null))[_0x4b1a('0x1f')](function(_0x49a649){if(_0x49a649){_0x206d04[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db[_0x4b1a('0x56')][_0x4b1a('0x2b')]);_0x206d04[_0x4b1a('0x2e')]=_[_0x4b1a('0x2f')](_0x45a2a4[_0x4b1a('0x2e')]);_0x206d04[_0x4b1a('0x38')]=_[_0x4b1a('0x30')](_0x206d04['model'],_0x206d04[_0x4b1a('0x2e')]);_0x46be0e[_0x4b1a('0x32')]=_[_0x4b1a('0x30')](_0x206d04[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x46be0e['attributes']=_0x46be0e[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x46be0e[_0x4b1a('0x32')]:_0x206d04[_0x4b1a('0x31')];if(!_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x57')](_0x4b1a('0x35'))){_0x46be0e[_0x4b1a('0x36')]=qs[_0x4b1a('0x36')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x36')]);_0x46be0e[_0x4b1a('0x16')]=qs[_0x4b1a('0x16')](_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x16')]);}_0x46be0e['order']=qs[_0x4b1a('0x37')](_0x45a2a4['query']['sort']);_0x46be0e[_0x4b1a('0x3b')]=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x45a2a4[_0x4b1a('0x2e')],_0x206d04[_0x4b1a('0x38')]));_0x46be0e[_0x4b1a('0x3b')][_0x4b1a('0x58')]=_0x49a649['id'];if(_0x45a2a4['query'][_0x4b1a('0x3a')]){_0x46be0e[_0x4b1a('0x3b')]=_['merge'](_0x46be0e['where'],{'$or':_[_0x4b1a('0x29')](_0x46be0e[_0x4b1a('0x32')],function(_0x3fc193){var _0x203194={};_0x203194[_0x3fc193]={'$like':'%'+_0x45a2a4[_0x4b1a('0x2e')]['filter']+'%'};return _0x203194;})});}_0x46be0e=_[_0x4b1a('0x3c')]({},_0x46be0e,_0x45a2a4[_0x4b1a('0x3e')]);return db['JscriptySessionReport'][_0x4b1a('0x18')]({'where':_0x46be0e['where']})['then'](function(_0x55af1d){_0x33f33c['count']=_0x55af1d;if(_0x45a2a4[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x46be0e[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x56')][_0x4b1a('0x41')](_0x46be0e);})[_0x4b1a('0x1f')](function(_0x552cbe){_0x33f33c['rows']=_0x552cbe;return _0x33f33c;});}})[_0x4b1a('0x1f')](respondWithFilteredResult(_0x166302,_0x46be0e))['catch'](handleError(_0x166302,null));};exports[_0x4b1a('0x59')]=function(_0x3dbc75,_0x1d6728,_0x462c54){var _0x4f8c2b={'raw':!![],'where':{}};var _0x538f77={};var _0x5b85d8={'count':0x0,'rows':[]};return db[_0x4b1a('0x2a')][_0x4b1a('0x55')]({'where':{'id':_0x3dbc75[_0x4b1a('0x45')]['id']}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x1d6728,null))['then'](function(_0x5306f1){if(_0x5306f1){_0x538f77[_0x4b1a('0x31')]=_[_0x4b1a('0x2f')](db['JscriptyAnswerReport'][_0x4b1a('0x2b')]);_0x538f77[_0x4b1a('0x2e')]=_['keys'](_0x3dbc75[_0x4b1a('0x2e')]);_0x538f77['filters']=_[_0x4b1a('0x30')](_0x538f77[_0x4b1a('0x31')],_0x538f77[_0x4b1a('0x2e')]);_0x4f8c2b[_0x4b1a('0x32')]=_['intersection'](_0x538f77[_0x4b1a('0x31')],qs[_0x4b1a('0x33')](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x33')]));_0x4f8c2b[_0x4b1a('0x32')]=_0x4f8c2b[_0x4b1a('0x32')][_0x4b1a('0x34')]?_0x4f8c2b[_0x4b1a('0x32')]:_0x538f77['model'];if(!_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x57')](_0x4b1a('0x35'))){_0x4f8c2b[_0x4b1a('0x36')]=qs['limit'](_0x3dbc75['query'][_0x4b1a('0x36')]);_0x4f8c2b['offset']=qs[_0x4b1a('0x16')](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x16')]);}_0x4f8c2b[_0x4b1a('0x5a')]=qs['sort'](_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x37')]);_0x4f8c2b['where']=qs[_0x4b1a('0x38')](_[_0x4b1a('0x39')](_0x3dbc75[_0x4b1a('0x2e')],_0x538f77[_0x4b1a('0x38')]));_0x4f8c2b['where'][_0x4b1a('0x58')]=_0x5306f1['id'];if(_0x3dbc75['query'][_0x4b1a('0x3a')]){_0x4f8c2b[_0x4b1a('0x3b')]=_[_0x4b1a('0x3c')](_0x4f8c2b['where'],{'$or':_[_0x4b1a('0x29')](_0x4f8c2b[_0x4b1a('0x32')],function(_0x25afc3){var _0x3f9be8={};_0x3f9be8[_0x25afc3]={'$like':'%'+_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x3a')]+'%'};return _0x3f9be8;})});}_0x4f8c2b=_[_0x4b1a('0x3c')]({},_0x4f8c2b,_0x3dbc75[_0x4b1a('0x3e')]);return db[_0x4b1a('0x5b')][_0x4b1a('0x18')]({'where':_0x4f8c2b[_0x4b1a('0x3b')]})[_0x4b1a('0x1f')](function(_0x46f4a9){_0x5b85d8[_0x4b1a('0x18')]=_0x46f4a9;if(_0x3dbc75[_0x4b1a('0x2e')][_0x4b1a('0x3f')]){_0x4f8c2b[_0x4b1a('0x40')]=[{'all':!![]}];}return db[_0x4b1a('0x5b')]['findAll'](_0x4f8c2b);})[_0x4b1a('0x1f')](function(_0x3501b2){_0x5b85d8[_0x4b1a('0x42')]=_0x3501b2;return _0x5b85d8;});}})['then'](respondWithFilteredResult(_0x1d6728,_0x4f8c2b))[_0x4b1a('0x43')](handleError(_0x1d6728,null));};function char(_0x58978f){return _0x4b1a('0x5c')===typeof _0x58978f?String[_0x4b1a('0x5d')][_0x4b1a('0x1c')](null,arguments):_0x58978f;}function needsEncapsulation(_0x1f8f5a){return!!_0x1f8f5a&&(_0x1f8f5a['toString']()[_0x4b1a('0x5e')](char(0xd))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()[_0x4b1a('0x5e')](char(0xa))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x1f8f5a[_0x4b1a('0x5f')]()[_0x4b1a('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x587a7e){var _0x467dbf=char(0x22),_0x37c1b4='\x5c'+char(0x22),_0x47b966=_0x587a7e[_0x4b1a('0x5f')]()[_0x4b1a('0x60')](new RegExp(_0x467dbf,'g'),_0x37c1b4);return _0x467dbf+_0x47b966+_0x467dbf;}exports[_0x4b1a('0x61')]=function(_0x177875,_0x255c5d,_0x2ec680){var _0x32ae84,_0x1f159c;var _0x15c4eb={'where':{'ProjectId':_0x177875[_0x4b1a('0x45')]['id']}};if(_0x177875[_0x4b1a('0x2e')][_0x4b1a('0x62')]){_0x15c4eb[_0x4b1a('0x3b')][_0x4b1a('0x63')]=JSON[_0x4b1a('0x64')](_0x177875[_0x4b1a('0x2e')][_0x4b1a('0x62')]);}return db[_0x4b1a('0x56')][_0x4b1a('0x41')](_0x15c4eb)[_0x4b1a('0x1f')](handleEntityNotFound(_0x255c5d,null))[_0x4b1a('0x1f')](function(_0x578677){if(_0x578677){_0x32ae84=_0x578677;return db[_0x4b1a('0x65')][_0x4b1a('0x41')]({'where':{'SessionId':{'$in':_[_0x4b1a('0x29')](_0x32ae84,'id')},'ProjectId':_0x177875['params']['id']},'order':_0x4b1a('0x66')});}})[_0x4b1a('0x1f')](handleEntityNotFound(_0x255c5d,null))['then'](function(_0x3eb66d){if(_0x3eb66d){_0x1f159c=_0x3eb66d;var _0x4e05de={};for(var _0x5ca08c=0x0,_0x3a9263=_0x1f159c[_0x4b1a('0x34')];_0x5ca08c<_0x3a9263;_0x5ca08c++){if(!_0x4e05de['hasOwnProperty'](_0x1f159c[_0x5ca08c][_0x4b1a('0x67')])){_0x4e05de[_0x1f159c[_0x5ca08c][_0x4b1a('0x67')]]=needsEncapsulation(_0x1f159c[_0x5ca08c][_0x4b1a('0x68')])?encapsulate(_0x1f159c[_0x5ca08c][_0x4b1a('0x68')]):_0x1f159c[_0x5ca08c][_0x4b1a('0x68')];}}var _0xbf276a=[],_0x520e39={};for(var _0x2918e5=0x0,_0x1e3908=_0x32ae84[_0x4b1a('0x34')];_0x2918e5<_0x1e3908;_0x2918e5++){_0x520e39={'ProjectId':_0x177875[_0x4b1a('0x45')]['id'],'SessionId':_0x32ae84[_0x2918e5]['id'],'StartTime':moment(_0x32ae84[_0x2918e5]['starttime'])[_0x4b1a('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3b6f46=0x0,_0x61b5d2=_0x1f159c[_0x4b1a('0x34')];_0x3b6f46<_0x61b5d2;_0x3b6f46++){if(_0x1f159c[_0x3b6f46][_0x4b1a('0x6a')]==_0x32ae84[_0x2918e5]['id']&&_0x4e05de[_0x4b1a('0x57')](_0x1f159c[_0x3b6f46][_0x4b1a('0x67')])){_0x520e39[_0x4e05de[_0x1f159c[_0x3b6f46][_0x4b1a('0x67')]]]=_0x1f159c[_0x3b6f46][_0x4b1a('0x6b')];}}for(var _0x285d78 in _0x4e05de){if(!_0x520e39[_0x4b1a('0x57')](_0x4e05de[_0x285d78])){_0x520e39[_0x4e05de[_0x285d78]]=null;}}_0xbf276a['push'](_0x520e39);}return _0xbf276a;}})['then'](function(_0x4a200b){if(!_[_0x4b1a('0x6c')](_0x4a200b)){var _0x2b8402=toCsv(_0x4a200b);var _0x48b389=Date[_0x4b1a('0x6d')]();fs[_0x4b1a('0x6e')](util[_0x4b1a('0x69')](_0x4b1a('0x6f'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389),_0x2b8402);_0x255c5d[_0x4b1a('0x70')]('Content-disposition',_0x4b1a('0x71')+util[_0x4b1a('0x69')](_0x4b1a('0x72'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389));_0x255c5d[_0x4b1a('0x70')](_0x4b1a('0x73'),_0x4b1a('0x74'));return _0x255c5d[_0x4b1a('0x75')](util[_0x4b1a('0x69')](_0x4b1a('0x6f'),_0x177875[_0x4b1a('0x45')]['id'],_0x48b389));}else{return _0x255c5d[_0x4b1a('0x23')](0xcc);}})[_0x4b1a('0x43')](handleError(_0x255c5d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 5398844..a0bee04 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 _0xb7a7=['JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x386b03,_0x5d0000){var _0xd3d524=function(_0x474754){while(--_0x474754){_0x386b03['push'](_0x386b03['shift']());}};_0xd3d524(++_0x5d0000);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x2d3541,_0x37563d){_0x2d3541=_0x2d3541-0x0;var _0x12e736=_0xb7a7[_0x2d3541];return _0x12e736;};'use strict';var _=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var logger=require(_0x7b7a('0x2'))(_0x7b7a('0x3'));var moment=require(_0x7b7a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b7a('0x5'));var rimraf=require(_0x7b7a('0x6'));var config=require(_0x7b7a('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x7b7a('0x8')]=function(_0x6e7b3c,_0x3739f9){return _0x6e7b3c[_0x7b7a('0x9')](_0x7b7a('0xa'),attributes,{'tableName':_0x7b7a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f63=['JscriptyProject','jscripty_projects','lodash','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x5f4cc6,_0x3fe04f){var _0x1aff75=function(_0x3aca8b){while(--_0x3aca8b){_0x5f4cc6['push'](_0x5f4cc6['shift']());}};_0x1aff75(++_0x3fe04f);}(_0x1f63,0x7a));var _0x31f6=function(_0x377e6e,_0x3d52e9){_0x377e6e=_0x377e6e-0x0;var _0x45f12e=_0x1f63[_0x377e6e];return _0x45f12e;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require('../../config/logger')(_0x31f6('0x2'));var moment=require(_0x31f6('0x3'));var BPromise=require(_0x31f6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31f6('0x5'));var rimraf=require(_0x31f6('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0x31f6('0x7')]=function(_0x11250b,_0xe8437e){return _0x11250b['define'](_0x31f6('0x8'),attributes,{'tableName':_0x31f6('0x9'),'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 85135a6..1328b30 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x18b7fd,_0x2cbcb3){var _0x5b059a=function(_0x15608c){while(--_0x15608c){_0x18b7fd['push'](_0x18b7fd['shift']());}};_0x5b059a(++_0x2cbcb3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xcb91[_0x4327fe];return _0x138651;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x497a4a,_0x21c42a){var _0x36545a=function(_0x365a64){while(--_0x365a64){_0x497a4a['push'](_0x497a4a['shift']());}};_0x36545a(++_0x21c42a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7f6abc,_0x3c2718){_0x7f6abc=_0x7f6abc-0x0;var _0x53d546=_0xb43b[_0x7f6abc];return _0x53d546;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 00d0801..5ca6dc5 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 _0x94a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2306af,_0xdb1c14){var _0x2cda67=function(_0x37ecb5){while(--_0x37ecb5){_0x2306af['push'](_0x2306af['shift']());}};_0x2cda67(++_0xdb1c14);}(_0x94a4,0x78));var _0x494a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x94a4[_0x8a969d];return _0x1d8dc7;};'use strict';var multer=require(_0x494a('0x0'));var util=require(_0x494a('0x1'));var path=require(_0x494a('0x2'));var timeout=require('connect-timeout');var express=require(_0x494a('0x3'));var router=express[_0x494a('0x4')]();var fs_extra=require(_0x494a('0x5'));var auth=require(_0x494a('0x6'));var interaction=require(_0x494a('0x7'));var config=require(_0x494a('0x8'));var controller=require(_0x494a('0x9'));router[_0x494a('0xa')]('/',auth['isAuthenticated'](),controller[_0x494a('0xb')]);router['get']('/describe',auth[_0x494a('0xc')](),controller[_0x494a('0xd')]);router[_0x494a('0xa')](_0x494a('0xe'),auth[_0x494a('0xc')](),controller[_0x494a('0xf')]);router[_0x494a('0x10')]('/',auth[_0x494a('0xc')](),controller['create']);router[_0x494a('0x11')](_0x494a('0xe'),auth[_0x494a('0xc')](),controller['update']);router[_0x494a('0x12')](_0x494a('0xe'),auth[_0x494a('0xc')](),controller[_0x494a('0x13')]);module[_0x494a('0x14')]=router; \ No newline at end of file +var _0xc0d1=['show','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x518e54,_0x4c00cb){var _0x41b891=function(_0x6d8be4){while(--_0x6d8be4){_0x518e54['push'](_0x518e54['shift']());}};_0x41b891(++_0x4c00cb);}(_0xc0d1,0x6f));var _0x1c0d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc0d1[_0x27af45];return _0x18df21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1c0d('0x0'));var timeout=require(_0x1c0d('0x1'));var express=require(_0x1c0d('0x2'));var router=express[_0x1c0d('0x3')]();var fs_extra=require(_0x1c0d('0x4'));var auth=require(_0x1c0d('0x5'));var interaction=require(_0x1c0d('0x6'));var config=require(_0x1c0d('0x7'));var controller=require(_0x1c0d('0x8'));router[_0x1c0d('0x9')]('/',auth[_0x1c0d('0xa')](),controller[_0x1c0d('0xb')]);router[_0x1c0d('0x9')](_0x1c0d('0xc'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0xd')]);router[_0x1c0d('0x9')](_0x1c0d('0xe'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0xf')]);router[_0x1c0d('0x10')]('/',auth[_0x1c0d('0xa')](),controller['create']);router[_0x1c0d('0x11')](_0x1c0d('0xe'),auth[_0x1c0d('0xa')](),controller[_0x1c0d('0x12')]);router[_0x1c0d('0x13')]('/:id',auth[_0x1c0d('0xa')](),controller['destroy']);module[_0x1c0d('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 22b76e5..ba29368 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(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7a54,0x106));var _0x47a5=function(_0x1f9ca1,_0x4013e6){_0x1f9ca1=_0x1f9ca1-0x0;var _0x3fa02e=_0x7a54[_0x1f9ca1];return _0x3fa02e;};'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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x16cbfc,_0x5b0582){_0x16cbfc=_0x16cbfc-0x0;var _0x588de6=_0x7a54[_0x16cbfc];return _0x588de6;};'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 a634716..916496d 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 _0x410f=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','model','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','lodash','crypto','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x410f,0x7b));var _0xf410=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x410f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf410('0x0'));var rp=require(_0xf410('0x1'));var moment=require(_0xf410('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf410('0x3'));var sox=require('sox');var csv=require(_0xf410('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf410('0x5'));var _=require(_0xf410('0x6'));var squel=require('squel');var crypto=require(_0xf410('0x7'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf410('0x4'));var querystring=require(_0xf410('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf410('0x9'));var qs=require('../../components/parsers/qs');var as=require(_0xf410('0xa'));var hardwareService=require(_0xf410('0xb'));var logger=require('../../config/logger')(_0xf410('0xc'));var utils=require('../../config/utils');var config=require(_0xf410('0xd'));var licenseUtil=require(_0xf410('0xe'));var db=require(_0xf410('0xf'))['db'];function respondWithStatusCode(_0x1aac14,_0x156d90){_0x156d90=_0x156d90||0xcc;return function(_0x21a815){if(_0x21a815){return _0x1aac14[_0xf410('0x10')](_0x156d90);}return _0x1aac14['status'](_0x156d90)['end']();};}function respondWithResult(_0x475b8e,_0x118689){_0x118689=_0x118689||0xc8;return function(_0x2d397b){if(_0x2d397b){return _0x475b8e[_0xf410('0x11')](_0x118689)[_0xf410('0x12')](_0x2d397b);}};}function respondWithFilteredResult(_0x1b20e1,_0x23a419){return function(_0x2d4fef){if(_0x2d4fef){var _0x5293c9=typeof _0x23a419[_0xf410('0x13')]===_0xf410('0x14')&&typeof _0x23a419[_0xf410('0x15')]==='undefined';var _0x302cae=_0x2d4fef[_0xf410('0x16')];var _0xbee1b8=_0x5293c9?0x0:_0x23a419[_0xf410('0x13')];var _0x1b3fc1=_0x5293c9?_0x2d4fef[_0xf410('0x16')]:_0x23a419['offset']+_0x23a419[_0xf410('0x15')];var _0x48df63;if(_0x1b3fc1>=_0x302cae){_0x1b3fc1=_0x302cae;_0x48df63=0xc8;}else{_0x48df63=0xce;}_0x1b20e1[_0xf410('0x11')](_0x48df63);return _0x1b20e1[_0xf410('0x17')](_0xf410('0x18'),_0xbee1b8+'-'+_0x1b3fc1+'/'+_0x302cae)[_0xf410('0x12')](_0x2d4fef);}return null;};}function patchUpdates(_0x4a52ef){return function(_0x121f95){try{jsonpatch[_0xf410('0x19')](_0x121f95,_0x4a52ef,!![]);}catch(_0x11c0f3){return BPromise['reject'](_0x11c0f3);}return _0x121f95[_0xf410('0x1a')]();};}function saveUpdates(_0x535aa8,_0x565570){return function(_0x5e976c){if(_0x5e976c){return _0x5e976c[_0xf410('0x1b')](_0x535aa8)[_0xf410('0x1c')](function(_0x23eb9c){return _0x23eb9c;});}return null;};}function removeEntity(_0x4fdb1f,_0x7c8e8){return function(_0x3a7196){if(_0x3a7196){return _0x3a7196[_0xf410('0x1d')]()[_0xf410('0x1c')](function(){_0x4fdb1f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22071f,_0x1e0abc){return function(_0x151dff){if(!_0x151dff){_0x22071f[_0xf410('0x10')](0x194);}return _0x151dff;};}function handleError(_0x3fe487,_0x2cc931){_0x2cc931=_0x2cc931||0x1f4;return function(_0x15b4ac){logger[_0xf410('0x1e')](_0x15b4ac[_0xf410('0x1f')]);if(_0x15b4ac[_0xf410('0x20')]){delete _0x15b4ac['name'];}_0x3fe487[_0xf410('0x11')](_0x2cc931)[_0xf410('0x21')](_0x15b4ac);};}exports[_0xf410('0x22')]=function(_0x7ff8c1,_0x50701a){var _0xc1f74={},_0x4ec2ba={},_0x44f8d9={'count':0x0,'rows':[]};var _0x25b56c=_[_0xf410('0x23')](db[_0xf410('0x24')][_0xf410('0x25')],function(_0x411f73){return{'name':_0x411f73[_0xf410('0x26')],'type':_0x411f73['type'][_0xf410('0x27')]};});_0x4ec2ba[_0xf410('0x28')]=_['map'](_0x25b56c,_0xf410('0x20'));_0x4ec2ba['query']=_[_0xf410('0x29')](_0x7ff8c1[_0xf410('0x2a')]);_0x4ec2ba['filters']=_[_0xf410('0x2b')](_0x4ec2ba[_0xf410('0x28')],_0x4ec2ba[_0xf410('0x2a')]);_0xc1f74['attributes']=_[_0xf410('0x2b')](_0x4ec2ba['model'],qs[_0xf410('0x2c')](_0x7ff8c1[_0xf410('0x2a')]['fields']));_0xc1f74['attributes']=_0xc1f74['attributes'][_0xf410('0x2d')]?_0xc1f74[_0xf410('0x2e')]:_0x4ec2ba['model'];if(!_0x7ff8c1['query'][_0xf410('0x2f')](_0xf410('0x30'))){_0xc1f74[_0xf410('0x15')]=qs[_0xf410('0x15')](_0x7ff8c1[_0xf410('0x2a')][_0xf410('0x15')]);_0xc1f74[_0xf410('0x13')]=qs['offset'](_0x7ff8c1[_0xf410('0x2a')][_0xf410('0x13')]);}_0xc1f74[_0xf410('0x31')]=qs[_0xf410('0x32')](_0x7ff8c1[_0xf410('0x2a')][_0xf410('0x32')]);_0xc1f74[_0xf410('0x33')]=qs[_0xf410('0x34')](_[_0xf410('0x35')](_0x7ff8c1[_0xf410('0x2a')],_0x4ec2ba['filters']),_0x25b56c);if(_0x7ff8c1['query'][_0xf410('0x36')]){_0xc1f74[_0xf410('0x33')]=_[_0xf410('0x37')](_0xc1f74['where'],{'$or':_[_0xf410('0x23')](_0x25b56c,function(_0x1eb4a1){if(_0x1eb4a1['type']!==_0xf410('0x38')){var _0x139e40={};_0x139e40[_0x1eb4a1[_0xf410('0x20')]]={'$like':'%'+_0x7ff8c1[_0xf410('0x2a')][_0xf410('0x36')]+'%'};return _0x139e40;}})});}_0xc1f74=_['merge']({},_0xc1f74,_0x7ff8c1[_0xf410('0x39')]);var _0x524bb4={'where':_0xc1f74[_0xf410('0x33')]};return db['JscriptyQuestionReport'][_0xf410('0x16')](_0x524bb4)[_0xf410('0x1c')](function(_0x172e65){_0x44f8d9[_0xf410('0x16')]=_0x172e65;if(_0x7ff8c1[_0xf410('0x2a')][_0xf410('0x3a')]){_0xc1f74[_0xf410('0x3b')]=[{'all':!![]}];}return db[_0xf410('0x24')][_0xf410('0x3c')](_0xc1f74);})[_0xf410('0x1c')](function(_0x19018d){_0x44f8d9[_0xf410('0x3d')]=_0x19018d;return _0x44f8d9;})[_0xf410('0x1c')](respondWithFilteredResult(_0x50701a,_0xc1f74))[_0xf410('0x3e')](handleError(_0x50701a,null));};exports[_0xf410('0x3f')]=function(_0x34a0a7,_0x37d95e){var _0x4a5674={'raw':!![],'where':{'id':_0x34a0a7[_0xf410('0x40')]['id']}},_0x167ede={};_0x167ede[_0xf410('0x28')]=_[_0xf410('0x29')](db[_0xf410('0x24')]['rawAttributes']);_0x167ede['query']=_[_0xf410('0x29')](_0x34a0a7['query']);_0x167ede['filters']=_['intersection'](_0x167ede[_0xf410('0x28')],_0x167ede[_0xf410('0x2a')]);_0x4a5674[_0xf410('0x2e')]=_[_0xf410('0x2b')](_0x167ede['model'],qs['fields'](_0x34a0a7['query'][_0xf410('0x2c')]));_0x4a5674[_0xf410('0x2e')]=_0x4a5674[_0xf410('0x2e')][_0xf410('0x2d')]?_0x4a5674[_0xf410('0x2e')]:_0x167ede[_0xf410('0x28')];if(_0x34a0a7[_0xf410('0x2a')][_0xf410('0x3a')]){_0x4a5674[_0xf410('0x3b')]=[{'all':!![]}];}_0x4a5674=_[_0xf410('0x37')]({},_0x4a5674,_0x34a0a7[_0xf410('0x39')]);return db['JscriptyQuestionReport']['find'](_0x4a5674)[_0xf410('0x1c')](handleEntityNotFound(_0x37d95e,null))[_0xf410('0x1c')](respondWithResult(_0x37d95e,null))['catch'](handleError(_0x37d95e,null));};exports[_0xf410('0x41')]=function(_0x2f3e91,_0x1edfe1){return db['JscriptyQuestionReport'][_0xf410('0x41')](_0x2f3e91[_0xf410('0x42')],{})[_0xf410('0x1c')](respondWithResult(_0x1edfe1,0xc9))[_0xf410('0x3e')](handleError(_0x1edfe1,null));};exports[_0xf410('0x1b')]=function(_0xe75d71,_0x114cd7){if(_0xe75d71[_0xf410('0x42')]['id']){delete _0xe75d71[_0xf410('0x42')]['id'];}return db[_0xf410('0x24')][_0xf410('0x43')]({'where':{'id':_0xe75d71[_0xf410('0x40')]['id']}})[_0xf410('0x1c')](handleEntityNotFound(_0x114cd7,null))[_0xf410('0x1c')](saveUpdates(_0xe75d71['body'],null))[_0xf410('0x1c')](respondWithResult(_0x114cd7,null))['catch'](handleError(_0x114cd7,null));};exports[_0xf410('0x1d')]=function(_0x217859,_0x25b802){return db[_0xf410('0x24')]['find']({'where':{'id':_0x217859[_0xf410('0x40')]['id']}})[_0xf410('0x1c')](handleEntityNotFound(_0x25b802,null))[_0xf410('0x1c')](removeEntity(_0x25b802,null))[_0xf410('0x3e')](handleError(_0x25b802,null));};exports[_0xf410('0x44')]=function(_0x2363c1,_0x228cec){return db[_0xf410('0x24')]['describe']()[_0xf410('0x1c')](respondWithResult(_0x228cec,null))[_0xf410('0x3e')](handleError(_0x228cec,null));}; \ No newline at end of file +var _0x7b55=['JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','then','includeAll','include','findAll','rows','catch','merge','find','create','body','params','destroy','describe','eml-format','zip-dir','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map'];(function(_0x5eeb19,_0x3ab1d5){var _0x28194e=function(_0x2a6a36){while(--_0x2a6a36){_0x5eeb19['push'](_0x5eeb19['shift']());}};_0x28194e(++_0x3ab1d5);}(_0x7b55,0xb5));var _0x57b5=function(_0x3544b3,_0x44debb){_0x3544b3=_0x3544b3-0x0;var _0x4a7cc1=_0x7b55[_0x3544b3];return _0x4a7cc1;};'use strict';var emlformat=require(_0x57b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x57b5('0x2'));var util=require(_0x57b5('0x3'));var path=require(_0x57b5('0x4'));var sox=require('sox');var csv=require(_0x57b5('0x5'));var ejs=require(_0x57b5('0x6'));var fs=require('fs');var fs_extra=require(_0x57b5('0x7'));var _=require(_0x57b5('0x8'));var squel=require(_0x57b5('0x9'));var crypto=require(_0x57b5('0xa'));var jsforce=require(_0x57b5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x57b5('0x5'));var querystring=require(_0x57b5('0xc'));var Papa=require(_0x57b5('0xd'));var Redis=require(_0x57b5('0xe'));var authService=require(_0x57b5('0xf'));var qs=require(_0x57b5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57b5('0x11'))(_0x57b5('0x12'));var utils=require('../../config/utils');var config=require(_0x57b5('0x13'));var licenseUtil=require(_0x57b5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35a293,_0x21193a){_0x21193a=_0x21193a||0xcc;return function(_0x26161c){if(_0x26161c){return _0x35a293[_0x57b5('0x15')](_0x21193a);}return _0x35a293['status'](_0x21193a)[_0x57b5('0x16')]();};}function respondWithResult(_0x301e71,_0x5ceb7f){_0x5ceb7f=_0x5ceb7f||0xc8;return function(_0x197326){if(_0x197326){return _0x301e71[_0x57b5('0x17')](_0x5ceb7f)[_0x57b5('0x18')](_0x197326);}};}function respondWithFilteredResult(_0x3a7a30,_0x249533){return function(_0x4a1832){if(_0x4a1832){var _0x46c0fe=typeof _0x249533[_0x57b5('0x19')]==='undefined'&&typeof _0x249533[_0x57b5('0x1a')]===_0x57b5('0x1b');var _0x3eb3ce=_0x4a1832[_0x57b5('0x1c')];var _0xffef72=_0x46c0fe?0x0:_0x249533[_0x57b5('0x19')];var _0xccd83c=_0x46c0fe?_0x4a1832['count']:_0x249533[_0x57b5('0x19')]+_0x249533['limit'];var _0x170d9e;if(_0xccd83c>=_0x3eb3ce){_0xccd83c=_0x3eb3ce;_0x170d9e=0xc8;}else{_0x170d9e=0xce;}_0x3a7a30['status'](_0x170d9e);return _0x3a7a30[_0x57b5('0x1d')](_0x57b5('0x1e'),_0xffef72+'-'+_0xccd83c+'/'+_0x3eb3ce)['json'](_0x4a1832);}return null;};}function patchUpdates(_0x52951d){return function(_0x1fcfd9){try{jsonpatch[_0x57b5('0x1f')](_0x1fcfd9,_0x52951d,!![]);}catch(_0x689c6d){return BPromise[_0x57b5('0x20')](_0x689c6d);}return _0x1fcfd9[_0x57b5('0x21')]();};}function saveUpdates(_0xd1a568,_0x488b82){return function(_0x5ccef6){if(_0x5ccef6){return _0x5ccef6[_0x57b5('0x22')](_0xd1a568)['then'](function(_0x11f154){return _0x11f154;});}return null;};}function removeEntity(_0x460d49,_0x4c2e0e){return function(_0x2f0f25){if(_0x2f0f25){return _0x2f0f25['destroy']()['then'](function(){_0x460d49[_0x57b5('0x17')](0xcc)[_0x57b5('0x16')]();});}};}function handleEntityNotFound(_0x2812c1,_0x19e323){return function(_0x34cd48){if(!_0x34cd48){_0x2812c1[_0x57b5('0x15')](0x194);}return _0x34cd48;};}function handleError(_0x3bd66a,_0x18e9d2){_0x18e9d2=_0x18e9d2||0x1f4;return function(_0x47ae44){logger[_0x57b5('0x23')](_0x47ae44[_0x57b5('0x24')]);if(_0x47ae44[_0x57b5('0x25')]){delete _0x47ae44[_0x57b5('0x25')];}_0x3bd66a[_0x57b5('0x17')](_0x18e9d2)[_0x57b5('0x26')](_0x47ae44);};}exports[_0x57b5('0x27')]=function(_0x1edb6d,_0x5095d6){var _0x729e5f={},_0x28a86f={},_0x3494c1={'count':0x0,'rows':[]};var _0x148d5f=_[_0x57b5('0x28')](db[_0x57b5('0x29')][_0x57b5('0x2a')],function(_0x533764){return{'name':_0x533764[_0x57b5('0x2b')],'type':_0x533764['type'][_0x57b5('0x2c')]};});_0x28a86f['model']=_[_0x57b5('0x28')](_0x148d5f,'name');_0x28a86f[_0x57b5('0x2d')]=_[_0x57b5('0x2e')](_0x1edb6d[_0x57b5('0x2d')]);_0x28a86f[_0x57b5('0x2f')]=_['intersection'](_0x28a86f[_0x57b5('0x30')],_0x28a86f['query']);_0x729e5f[_0x57b5('0x31')]=_[_0x57b5('0x32')](_0x28a86f[_0x57b5('0x30')],qs[_0x57b5('0x33')](_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x33')]));_0x729e5f['attributes']=_0x729e5f[_0x57b5('0x31')][_0x57b5('0x34')]?_0x729e5f['attributes']:_0x28a86f[_0x57b5('0x30')];if(!_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x35')]('nolimit')){_0x729e5f[_0x57b5('0x1a')]=qs[_0x57b5('0x1a')](_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x1a')]);_0x729e5f['offset']=qs['offset'](_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x19')]);}_0x729e5f[_0x57b5('0x36')]=qs[_0x57b5('0x37')](_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x37')]);_0x729e5f[_0x57b5('0x38')]=qs[_0x57b5('0x2f')](_[_0x57b5('0x39')](_0x1edb6d[_0x57b5('0x2d')],_0x28a86f[_0x57b5('0x2f')]),_0x148d5f);if(_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x3a')]){_0x729e5f[_0x57b5('0x38')]=_['merge'](_0x729e5f[_0x57b5('0x38')],{'$or':_[_0x57b5('0x28')](_0x148d5f,function(_0x551487){if(_0x551487[_0x57b5('0x3b')]!=='VIRTUAL'){var _0x2731af={};_0x2731af[_0x551487[_0x57b5('0x25')]]={'$like':'%'+_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x3a')]+'%'};return _0x2731af;}})});}_0x729e5f=_['merge']({},_0x729e5f,_0x1edb6d[_0x57b5('0x3c')]);var _0x33d59f={'where':_0x729e5f[_0x57b5('0x38')]};return db[_0x57b5('0x29')][_0x57b5('0x1c')](_0x33d59f)[_0x57b5('0x3d')](function(_0x3b6900){_0x3494c1[_0x57b5('0x1c')]=_0x3b6900;if(_0x1edb6d[_0x57b5('0x2d')][_0x57b5('0x3e')]){_0x729e5f[_0x57b5('0x3f')]=[{'all':!![]}];}return db[_0x57b5('0x29')][_0x57b5('0x40')](_0x729e5f);})[_0x57b5('0x3d')](function(_0x2b6e78){_0x3494c1[_0x57b5('0x41')]=_0x2b6e78;return _0x3494c1;})[_0x57b5('0x3d')](respondWithFilteredResult(_0x5095d6,_0x729e5f))[_0x57b5('0x42')](handleError(_0x5095d6,null));};exports['show']=function(_0x28ebc7,_0x45f05a){var _0x4e9b85={'raw':!![],'where':{'id':_0x28ebc7['params']['id']}},_0x5f13d9={};_0x5f13d9['model']=_['keys'](db[_0x57b5('0x29')][_0x57b5('0x2a')]);_0x5f13d9[_0x57b5('0x2d')]=_[_0x57b5('0x2e')](_0x28ebc7['query']);_0x5f13d9[_0x57b5('0x2f')]=_[_0x57b5('0x32')](_0x5f13d9['model'],_0x5f13d9['query']);_0x4e9b85[_0x57b5('0x31')]=_[_0x57b5('0x32')](_0x5f13d9[_0x57b5('0x30')],qs['fields'](_0x28ebc7['query'][_0x57b5('0x33')]));_0x4e9b85[_0x57b5('0x31')]=_0x4e9b85[_0x57b5('0x31')][_0x57b5('0x34')]?_0x4e9b85[_0x57b5('0x31')]:_0x5f13d9[_0x57b5('0x30')];if(_0x28ebc7[_0x57b5('0x2d')]['includeAll']){_0x4e9b85['include']=[{'all':!![]}];}_0x4e9b85=_[_0x57b5('0x43')]({},_0x4e9b85,_0x28ebc7[_0x57b5('0x3c')]);return db[_0x57b5('0x29')][_0x57b5('0x44')](_0x4e9b85)[_0x57b5('0x3d')](handleEntityNotFound(_0x45f05a,null))[_0x57b5('0x3d')](respondWithResult(_0x45f05a,null))[_0x57b5('0x42')](handleError(_0x45f05a,null));};exports['create']=function(_0x399bbb,_0x573547){return db[_0x57b5('0x29')][_0x57b5('0x45')](_0x399bbb[_0x57b5('0x46')],{})[_0x57b5('0x3d')](respondWithResult(_0x573547,0xc9))[_0x57b5('0x42')](handleError(_0x573547,null));};exports[_0x57b5('0x22')]=function(_0x513d27,_0x420017){if(_0x513d27[_0x57b5('0x46')]['id']){delete _0x513d27[_0x57b5('0x46')]['id'];}return db['JscriptyQuestionReport'][_0x57b5('0x44')]({'where':{'id':_0x513d27[_0x57b5('0x47')]['id']}})[_0x57b5('0x3d')](handleEntityNotFound(_0x420017,null))[_0x57b5('0x3d')](saveUpdates(_0x513d27[_0x57b5('0x46')],null))[_0x57b5('0x3d')](respondWithResult(_0x420017,null))[_0x57b5('0x42')](handleError(_0x420017,null));};exports[_0x57b5('0x48')]=function(_0x4c40a9,_0x13cc95){return db[_0x57b5('0x29')]['find']({'where':{'id':_0x4c40a9[_0x57b5('0x47')]['id']}})[_0x57b5('0x3d')](handleEntityNotFound(_0x13cc95,null))[_0x57b5('0x3d')](removeEntity(_0x13cc95,null))[_0x57b5('0x42')](handleError(_0x13cc95,null));};exports['describe']=function(_0x45d2f9,_0x160df3){return db['JscriptyQuestionReport'][_0x57b5('0x49')]()[_0x57b5('0x3d')](respondWithResult(_0x160df3,null))['catch'](handleError(_0x160df3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 592d991..3c6de16 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 _0x634f=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x634f,0x163));var _0xf634=function(_0x33ac94,_0x1629dd){_0x33ac94=_0x33ac94-0x0;var _0x1eb138=_0x634f[_0x33ac94];return _0x1eb138;};'use strict';var _=require(_0xf634('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf634('0x1'));var moment=require(_0xf634('0x2'));var BPromise=require(_0xf634('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf634('0x4'));var rimraf=require(_0xf634('0x5'));var config=require(_0xf634('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xf634('0x7')]=function(_0x366dfb,_0x52345f){return _0x366dfb[_0xf634('0x8')](_0xf634('0x9'),attributes,{'tableName':_0xf634('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ecc=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x4ecc,0x67));var _0xc4ec=function(_0x5396d4,_0x86297a){_0x5396d4=_0x5396d4-0x0;var _0x9fa122=_0x4ecc[_0x5396d4];return _0x9fa122;};'use strict';var _=require(_0xc4ec('0x0'));var util=require(_0xc4ec('0x1'));var logger=require(_0xc4ec('0x2'))(_0xc4ec('0x3'));var moment=require(_0xc4ec('0x4'));var BPromise=require(_0xc4ec('0x5'));var rp=require(_0xc4ec('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc4ec('0x7'));var config=require(_0xc4ec('0x8'));var attributes=require(_0xc4ec('0x9'));module['exports']=function(_0x5cdfee,_0x3248c7){return _0x5cdfee[_0xc4ec('0xa')](_0xc4ec('0xb'),attributes,{'tableName':_0xc4ec('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 ef8ecba..682c4d9 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 _0x2226=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x2226,0xe2));var _0x6222=function(_0xb99421,_0xaab133){_0xb99421=_0xb99421-0x0;var _0x4b3ec7=_0x2226[_0xb99421];return _0x4b3ec7;};'use strict';var _=require(_0x6222('0x0'));var util=require(_0x6222('0x1'));var moment=require(_0x6222('0x2'));var BPromise=require(_0x6222('0x3'));var rs=require(_0x6222('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6222('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6222('0x6'))(_0x6222('0x7'));var config=require(_0x6222('0x8'));var jayson=require(_0x6222('0x9'));var client=jayson[_0x6222('0xa')][_0x6222('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x431367,_0x43ee71,_0xc34229){return new BPromise(function(_0x2afc17,_0x2eda95){return client['request'](_0x431367,_0xc34229)[_0x6222('0xc')](function(_0x25d3f4){logger[_0x6222('0xd')](_0x6222('0xe'),_0x43ee71,_0x6222('0xf'));logger[_0x6222('0x10')](_0x6222('0x11'),_0x43ee71,_0x6222('0xf'),JSON[_0x6222('0x12')](_0x25d3f4));if(_0x25d3f4['error']){if(_0x25d3f4['error'][_0x6222('0x13')]===0x1f4){logger[_0x6222('0x14')](_0x6222('0xe'),_0x43ee71,_0x25d3f4[_0x6222('0x14')][_0x6222('0x15')]);return _0x2eda95(_0x25d3f4['error']['message']);}logger[_0x6222('0x14')](_0x6222('0xe'),_0x43ee71,_0x25d3f4[_0x6222('0x14')]['message']);return _0x2afc17(_0x25d3f4[_0x6222('0x14')][_0x6222('0x15')]);}else{logger['info'](_0x6222('0xe'),_0x43ee71,_0x6222('0xf'));_0x2afc17(_0x25d3f4['result']['message']);}})[_0x6222('0x16')](function(_0x2270c9){logger[_0x6222('0x14')](_0x6222('0xe'),_0x43ee71,_0x2270c9);_0x2eda95(_0x2270c9);});});} \ No newline at end of file +var _0x8de2=['message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e5067,_0x43a001){var _0x96d596=function(_0xd5d09){while(--_0xd5d09){_0x5e5067['push'](_0x5e5067['shift']());}};_0x96d596(++_0x43a001);}(_0x8de2,0x168));var _0x28de=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0x8de2[_0x1a6363];return _0xd22157;};'use strict';var _=require(_0x28de('0x0'));var util=require(_0x28de('0x1'));var moment=require(_0x28de('0x2'));var BPromise=require('bluebird');var rs=require(_0x28de('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x28de('0x4'));var logger=require(_0x28de('0x5'))(_0x28de('0x6'));var config=require(_0x28de('0x7'));var jayson=require(_0x28de('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24e2f4,_0x46c63b,_0x5d20fa){return new BPromise(function(_0x556465,_0x2bd566){return client[_0x28de('0x9')](_0x24e2f4,_0x5d20fa)['then'](function(_0x4774c9){logger[_0x28de('0xa')](_0x28de('0xb'),_0x46c63b,_0x28de('0xc'));logger[_0x28de('0xd')](_0x28de('0xe'),_0x46c63b,_0x28de('0xc'),JSON[_0x28de('0xf')](_0x4774c9));if(_0x4774c9[_0x28de('0x10')]){if(_0x4774c9['error'][_0x28de('0x11')]===0x1f4){logger[_0x28de('0x10')](_0x28de('0xb'),_0x46c63b,_0x4774c9[_0x28de('0x10')][_0x28de('0x12')]);return _0x2bd566(_0x4774c9[_0x28de('0x10')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x46c63b,_0x4774c9['error'][_0x28de('0x12')]);return _0x556465(_0x4774c9['error'][_0x28de('0x12')]);}else{logger[_0x28de('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x46c63b,_0x28de('0xc'));_0x556465(_0x4774c9[_0x28de('0x13')][_0x28de('0x12')]);}})[_0x28de('0x14')](function(_0x51c9d5){logger[_0x28de('0x10')](_0x28de('0xb'),_0x46c63b,_0x51c9d5);_0x2bd566(_0x51c9d5);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index dc5a0ed..5a369fb 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 _0xf26d=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x25de58,_0x2db32c){var _0x333a2d=function(_0x37d575){while(--_0x37d575){_0x25de58['push'](_0x25de58['shift']());}};_0x333a2d(++_0x2db32c);}(_0xf26d,0x90));var _0xdf26=function(_0x21bf74,_0x2dc69f){_0x21bf74=_0x21bf74-0x0;var _0x503057=_0xf26d[_0x21bf74];return _0x503057;};'use strict';var multer=require(_0xdf26('0x0'));var util=require(_0xdf26('0x1'));var path=require('path');var timeout=require(_0xdf26('0x2'));var express=require(_0xdf26('0x3'));var router=express[_0xdf26('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf26('0x5'));var config=require(_0xdf26('0x6'));var controller=require(_0xdf26('0x7'));router[_0xdf26('0x8')]('/',auth[_0xdf26('0x9')](),controller[_0xdf26('0xa')]);router[_0xdf26('0x8')](_0xdf26('0xb'),auth['isAuthenticated'](),controller[_0xdf26('0xc')]);router[_0xdf26('0x8')](_0xdf26('0xd'),auth[_0xdf26('0x9')](),controller[_0xdf26('0xe')]);router[_0xdf26('0x8')](_0xdf26('0xf'),auth[_0xdf26('0x9')](),controller[_0xdf26('0x10')]);router[_0xdf26('0x11')]('/',auth['isAuthenticated'](),controller[_0xdf26('0x12')]);router[_0xdf26('0x13')](_0xdf26('0xd'),auth[_0xdf26('0x9')](),controller[_0xdf26('0x14')]);router[_0xdf26('0x15')](_0xdf26('0xd'),auth['isAuthenticated'](),controller[_0xdf26('0x16')]);module[_0xdf26('0x17')]=router; \ No newline at end of file +var _0x6048=['update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','/describe','describe','get','getQuestions','post','put','/:id'];(function(_0x116d16,_0xaa138d){var _0x2c6405=function(_0x28524d){while(--_0x28524d){_0x116d16['push'](_0x116d16['shift']());}};_0x2c6405(++_0xaa138d);}(_0x6048,0x6c));var _0x8604=function(_0xabe340,_0x1c0b0c){_0xabe340=_0xabe340-0x0;var _0x29edb5=_0x6048[_0xabe340];return _0x29edb5;};'use strict';var multer=require(_0x8604('0x0'));var util=require('util');var path=require(_0x8604('0x1'));var timeout=require(_0x8604('0x2'));var express=require(_0x8604('0x3'));var router=express[_0x8604('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8604('0x5'));var interaction=require(_0x8604('0x6'));var config=require(_0x8604('0x7'));var controller=require(_0x8604('0x8'));router['get']('/',auth[_0x8604('0x9')](),controller[_0x8604('0xa')]);router['get'](_0x8604('0xb'),auth[_0x8604('0x9')](),controller[_0x8604('0xc')]);router[_0x8604('0xd')]('/:id',auth[_0x8604('0x9')](),controller['show']);router[_0x8604('0xd')]('/:id/questions',auth[_0x8604('0x9')](),controller[_0x8604('0xe')]);router[_0x8604('0xf')]('/',auth[_0x8604('0x9')](),controller['create']);router[_0x8604('0x10')](_0x8604('0x11'),auth[_0x8604('0x9')](),controller[_0x8604('0x12')]);router[_0x8604('0x13')](_0x8604('0x11'),auth[_0x8604('0x9')](),controller['destroy']);module[_0x8604('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 277e024..aad5a56 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 _0xe0e2=['sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x278046,_0x5c276c){var _0x108ce3=function(_0x367a10){while(--_0x367a10){_0x278046['push'](_0x278046['shift']());}};_0x108ce3(++_0x5c276c);}(_0xe0e2,0x17c));var _0x2e0e=function(_0x4ad003,_0x133d12){_0x4ad003=_0x4ad003-0x0;var _0x1aab2f=_0xe0e2[_0x4ad003];return _0x1aab2f;};'use strict';var moment=require('moment');var Sequelize=require(_0x2e0e('0x0'));module[_0x2e0e('0x1')]={'starttime':{'type':Sequelize[_0x2e0e('0x2')],'set':function(_0x2fd748){this[_0x2e0e('0x3')](_0x2e0e('0x4'),_0x2fd748);this[_0x2e0e('0x3')](_0x2e0e('0x5'),moment()[_0x2e0e('0x6')](_0x2e0e('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x2e0e('0x8')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2e0e('0x8')]},'calleridname':{'type':Sequelize[_0x2e0e('0x8')]},'calleridnum':{'type':Sequelize[_0x2e0e('0x8')]},'completed':{'type':Sequelize[_0x2e0e('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xeccc=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','exports'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xeccc,0x17a));var _0xcecc=function(_0x868611,_0x1a176e){_0x868611=_0x868611-0x0;var _0x143a08=_0xeccc[_0x868611];return _0x143a08;};'use strict';var moment=require(_0xcecc('0x0'));var Sequelize=require('sequelize');module[_0xcecc('0x1')]={'starttime':{'type':Sequelize[_0xcecc('0x2')],'set':function(_0x40baca){this[_0xcecc('0x3')](_0xcecc('0x4'),_0x40baca);this['setDataValue'](_0xcecc('0x5'),moment()[_0xcecc('0x6')](_0xcecc('0x7')));}},'endtime':{'type':Sequelize[_0xcecc('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xcecc('0x8')]},'queue':{'type':Sequelize[_0xcecc('0x8')]},'uniqueid':{'type':Sequelize[_0xcecc('0x8')]},'calleridname':{'type':Sequelize[_0xcecc('0x8')]},'calleridnum':{'type':Sequelize[_0xcecc('0x8')]},'completed':{'type':Sequelize[_0xcecc('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 3a7691b..a51ad66 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 _0xea95=['apply','save','then','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','fields','find','create','body','destroy','describe','getQuestions','JscriptyQuestionReport','nolimit','pick','findAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xea95,0xc9));var _0x5ea9=function(_0x5d7ec2,_0x44d906){_0x5d7ec2=_0x5d7ec2-0x0;var _0x446088=_0xea95[_0x5d7ec2];return _0x446088;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ea9('0x0'));var zipdir=require(_0x5ea9('0x1'));var jsonpatch=require(_0x5ea9('0x2'));var rp=require('request-promise');var moment=require(_0x5ea9('0x3'));var BPromise=require(_0x5ea9('0x4'));var Mustache=require(_0x5ea9('0x5'));var util=require(_0x5ea9('0x6'));var path=require(_0x5ea9('0x7'));var sox=require(_0x5ea9('0x8'));var csv=require(_0x5ea9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5ea9('0xa'));var _=require(_0x5ea9('0xb'));var squel=require(_0x5ea9('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ea9('0xd'));var deskjs=require(_0x5ea9('0xe'));var toCsv=require(_0x5ea9('0x9'));var querystring=require('querystring');var Papa=require(_0x5ea9('0xf'));var Redis=require('ioredis');var authService=require(_0x5ea9('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ea9('0x11'));var logger=require(_0x5ea9('0x12'))(_0x5ea9('0x13'));var utils=require(_0x5ea9('0x14'));var config=require(_0x5ea9('0x15'));var licenseUtil=require(_0x5ea9('0x16'));var db=require(_0x5ea9('0x17'))['db'];function respondWithStatusCode(_0x1f558e,_0x2ddab6){_0x2ddab6=_0x2ddab6||0xcc;return function(_0x4c23c2){if(_0x4c23c2){return _0x1f558e['sendStatus'](_0x2ddab6);}return _0x1f558e['status'](_0x2ddab6)[_0x5ea9('0x18')]();};}function respondWithResult(_0x3899c4,_0x47a94d){_0x47a94d=_0x47a94d||0xc8;return function(_0x2a658c){if(_0x2a658c){return _0x3899c4[_0x5ea9('0x19')](_0x47a94d)[_0x5ea9('0x1a')](_0x2a658c);}};}function respondWithFilteredResult(_0x43c15b,_0x222f8c){return function(_0x295631){if(_0x295631){var _0x245c63=typeof _0x222f8c['offset']===_0x5ea9('0x1b')&&typeof _0x222f8c['limit']==='undefined';var _0xd0c473=_0x295631[_0x5ea9('0x1c')];var _0x4fa184=_0x245c63?0x0:_0x222f8c[_0x5ea9('0x1d')];var _0x3ca707=_0x245c63?_0x295631[_0x5ea9('0x1c')]:_0x222f8c[_0x5ea9('0x1d')]+_0x222f8c[_0x5ea9('0x1e')];var _0x319997;if(_0x3ca707>=_0xd0c473){_0x3ca707=_0xd0c473;_0x319997=0xc8;}else{_0x319997=0xce;}_0x43c15b[_0x5ea9('0x19')](_0x319997);return _0x43c15b[_0x5ea9('0x1f')](_0x5ea9('0x20'),_0x4fa184+'-'+_0x3ca707+'/'+_0xd0c473)[_0x5ea9('0x1a')](_0x295631);}return null;};}function patchUpdates(_0x353fb4){return function(_0x492104){try{jsonpatch[_0x5ea9('0x21')](_0x492104,_0x353fb4,!![]);}catch(_0x44409b){return BPromise['reject'](_0x44409b);}return _0x492104[_0x5ea9('0x22')]();};}function saveUpdates(_0x39ba0a,_0x38aca5){return function(_0x3ef5d2){if(_0x3ef5d2){return _0x3ef5d2['update'](_0x39ba0a)[_0x5ea9('0x23')](function(_0x59c9db){return _0x59c9db;});}return null;};}function removeEntity(_0x52691e,_0x5cf45){return function(_0x6a557e){if(_0x6a557e){return _0x6a557e['destroy']()['then'](function(){_0x52691e[_0x5ea9('0x19')](0xcc)[_0x5ea9('0x18')]();});}};}function handleEntityNotFound(_0x3bb9f2,_0x484a14){return function(_0x880cb5){if(!_0x880cb5){_0x3bb9f2['sendStatus'](0x194);}return _0x880cb5;};}function handleError(_0x536feb,_0x3b0422){_0x3b0422=_0x3b0422||0x1f4;return function(_0x1b380d){logger[_0x5ea9('0x24')](_0x1b380d[_0x5ea9('0x25')]);if(_0x1b380d[_0x5ea9('0x26')]){delete _0x1b380d['name'];}_0x536feb[_0x5ea9('0x19')](_0x3b0422)[_0x5ea9('0x27')](_0x1b380d);};}exports[_0x5ea9('0x28')]=function(_0x3bcca8,_0x44c007){var _0x53a387={},_0x434cbe={},_0x211cbe={'count':0x0,'rows':[]};var _0x2efbf5=_[_0x5ea9('0x29')](db[_0x5ea9('0x2a')][_0x5ea9('0x2b')],function(_0x1cd235){return{'name':_0x1cd235[_0x5ea9('0x2c')],'type':_0x1cd235[_0x5ea9('0x2d')][_0x5ea9('0x2e')]};});_0x434cbe[_0x5ea9('0x2f')]=_['map'](_0x2efbf5,_0x5ea9('0x26'));_0x434cbe[_0x5ea9('0x30')]=_[_0x5ea9('0x31')](_0x3bcca8[_0x5ea9('0x30')]);_0x434cbe[_0x5ea9('0x32')]=_[_0x5ea9('0x33')](_0x434cbe[_0x5ea9('0x2f')],_0x434cbe[_0x5ea9('0x30')]);_0x53a387[_0x5ea9('0x34')]=_[_0x5ea9('0x33')](_0x434cbe[_0x5ea9('0x2f')],qs['fields'](_0x3bcca8[_0x5ea9('0x30')]['fields']));_0x53a387[_0x5ea9('0x34')]=_0x53a387[_0x5ea9('0x34')][_0x5ea9('0x35')]?_0x53a387[_0x5ea9('0x34')]:_0x434cbe[_0x5ea9('0x2f')];if(!_0x3bcca8[_0x5ea9('0x30')][_0x5ea9('0x36')]('nolimit')){_0x53a387[_0x5ea9('0x1e')]=qs[_0x5ea9('0x1e')](_0x3bcca8['query'][_0x5ea9('0x1e')]);_0x53a387[_0x5ea9('0x1d')]=qs[_0x5ea9('0x1d')](_0x3bcca8[_0x5ea9('0x30')][_0x5ea9('0x1d')]);}_0x53a387[_0x5ea9('0x37')]=qs[_0x5ea9('0x38')](_0x3bcca8[_0x5ea9('0x30')][_0x5ea9('0x38')]);_0x53a387['where']=qs[_0x5ea9('0x32')](_['pick'](_0x3bcca8[_0x5ea9('0x30')],_0x434cbe[_0x5ea9('0x32')]),_0x2efbf5);if(_0x3bcca8[_0x5ea9('0x30')][_0x5ea9('0x39')]){_0x53a387[_0x5ea9('0x3a')]=_[_0x5ea9('0x3b')](_0x53a387[_0x5ea9('0x3a')],{'$or':_[_0x5ea9('0x29')](_0x2efbf5,function(_0x22faa0){if(_0x22faa0[_0x5ea9('0x2d')]!==_0x5ea9('0x3c')){var _0x3cc0d7={};_0x3cc0d7[_0x22faa0[_0x5ea9('0x26')]]={'$like':'%'+_0x3bcca8['query'][_0x5ea9('0x39')]+'%'};return _0x3cc0d7;}})});}_0x53a387=_[_0x5ea9('0x3b')]({},_0x53a387,_0x3bcca8[_0x5ea9('0x3d')]);var _0x1a47ad={'where':_0x53a387[_0x5ea9('0x3a')]};return db['JscriptySessionReport'][_0x5ea9('0x1c')](_0x1a47ad)['then'](function(_0x1f5a4f){_0x211cbe[_0x5ea9('0x1c')]=_0x1f5a4f;if(_0x3bcca8[_0x5ea9('0x30')][_0x5ea9('0x3e')]){_0x53a387[_0x5ea9('0x3f')]=[{'all':!![]}];}return db[_0x5ea9('0x2a')]['findAll'](_0x53a387);})['then'](function(_0x3fc9db){_0x211cbe[_0x5ea9('0x40')]=_0x3fc9db;return _0x211cbe;})[_0x5ea9('0x23')](respondWithFilteredResult(_0x44c007,_0x53a387))[_0x5ea9('0x41')](handleError(_0x44c007,null));};exports['show']=function(_0x4872b3,_0x13c644){var _0x17b95e={'raw':!![],'where':{'id':_0x4872b3[_0x5ea9('0x42')]['id']}},_0x56a7f6={};_0x56a7f6[_0x5ea9('0x2f')]=_[_0x5ea9('0x31')](db[_0x5ea9('0x2a')][_0x5ea9('0x2b')]);_0x56a7f6[_0x5ea9('0x30')]=_[_0x5ea9('0x31')](_0x4872b3['query']);_0x56a7f6[_0x5ea9('0x32')]=_['intersection'](_0x56a7f6['model'],_0x56a7f6['query']);_0x17b95e[_0x5ea9('0x34')]=_[_0x5ea9('0x33')](_0x56a7f6[_0x5ea9('0x2f')],qs['fields'](_0x4872b3['query'][_0x5ea9('0x43')]));_0x17b95e['attributes']=_0x17b95e[_0x5ea9('0x34')][_0x5ea9('0x35')]?_0x17b95e[_0x5ea9('0x34')]:_0x56a7f6[_0x5ea9('0x2f')];if(_0x4872b3[_0x5ea9('0x30')][_0x5ea9('0x3e')]){_0x17b95e['include']=[{'all':!![]}];}_0x17b95e=_[_0x5ea9('0x3b')]({},_0x17b95e,_0x4872b3[_0x5ea9('0x3d')]);return db[_0x5ea9('0x2a')][_0x5ea9('0x44')](_0x17b95e)['then'](handleEntityNotFound(_0x13c644,null))[_0x5ea9('0x23')](respondWithResult(_0x13c644,null))[_0x5ea9('0x41')](handleError(_0x13c644,null));};exports[_0x5ea9('0x45')]=function(_0x22cea5,_0x3411ea){return db[_0x5ea9('0x2a')][_0x5ea9('0x45')](_0x22cea5[_0x5ea9('0x46')],{})['then'](respondWithResult(_0x3411ea,0xc9))[_0x5ea9('0x41')](handleError(_0x3411ea,null));};exports['update']=function(_0x545290,_0x55de85){if(_0x545290[_0x5ea9('0x46')]['id']){delete _0x545290[_0x5ea9('0x46')]['id'];}return db[_0x5ea9('0x2a')][_0x5ea9('0x44')]({'where':{'id':_0x545290[_0x5ea9('0x42')]['id']}})[_0x5ea9('0x23')](handleEntityNotFound(_0x55de85,null))[_0x5ea9('0x23')](saveUpdates(_0x545290[_0x5ea9('0x46')],null))[_0x5ea9('0x23')](respondWithResult(_0x55de85,null))[_0x5ea9('0x41')](handleError(_0x55de85,null));};exports[_0x5ea9('0x47')]=function(_0x1bf3d6,_0x4cca85){return db[_0x5ea9('0x2a')]['find']({'where':{'id':_0x1bf3d6[_0x5ea9('0x42')]['id']}})[_0x5ea9('0x23')](handleEntityNotFound(_0x4cca85,null))[_0x5ea9('0x23')](removeEntity(_0x4cca85,null))['catch'](handleError(_0x4cca85,null));};exports[_0x5ea9('0x48')]=function(_0x398f3e,_0x1e4a07){return db[_0x5ea9('0x2a')][_0x5ea9('0x48')]()['then'](respondWithResult(_0x1e4a07,null))['catch'](handleError(_0x1e4a07,null));};exports[_0x5ea9('0x49')]=function(_0x2d7e08,_0xefd572,_0x147f9a){var _0x52fffb={'raw':!![],'where':{}};var _0x111c56={};var _0x1f11bc={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x2d7e08[_0x5ea9('0x42')]['id']}})[_0x5ea9('0x23')](handleEntityNotFound(_0xefd572,null))[_0x5ea9('0x23')](function(_0x2e5483){if(_0x2e5483){_0x111c56['model']=_[_0x5ea9('0x31')](db[_0x5ea9('0x4a')][_0x5ea9('0x2b')]);_0x111c56[_0x5ea9('0x30')]=_['keys'](_0x2d7e08[_0x5ea9('0x30')]);_0x111c56[_0x5ea9('0x32')]=_[_0x5ea9('0x33')](_0x111c56['model'],_0x111c56[_0x5ea9('0x30')]);_0x52fffb['attributes']=_['intersection'](_0x111c56[_0x5ea9('0x2f')],qs[_0x5ea9('0x43')](_0x2d7e08[_0x5ea9('0x30')][_0x5ea9('0x43')]));_0x52fffb[_0x5ea9('0x34')]=_0x52fffb[_0x5ea9('0x34')][_0x5ea9('0x35')]?_0x52fffb[_0x5ea9('0x34')]:_0x111c56[_0x5ea9('0x2f')];if(!_0x2d7e08['query']['hasOwnProperty'](_0x5ea9('0x4b'))){_0x52fffb['limit']=qs['limit'](_0x2d7e08['query'][_0x5ea9('0x1e')]);_0x52fffb['offset']=qs['offset'](_0x2d7e08[_0x5ea9('0x30')]['offset']);}_0x52fffb['order']=qs[_0x5ea9('0x38')](_0x2d7e08['query'][_0x5ea9('0x38')]);_0x52fffb['where']=qs[_0x5ea9('0x32')](_[_0x5ea9('0x4c')](_0x2d7e08['query'],_0x111c56['filters']));_0x52fffb[_0x5ea9('0x3a')]['SessionId']=_0x2e5483['id'];if(_0x2d7e08[_0x5ea9('0x30')][_0x5ea9('0x39')]){_0x52fffb['where']=_[_0x5ea9('0x3b')](_0x52fffb[_0x5ea9('0x3a')],{'$or':_['map'](_0x52fffb[_0x5ea9('0x34')],function(_0x52ee9b){var _0x5b37ed={};_0x5b37ed[_0x52ee9b]={'$like':'%'+_0x2d7e08[_0x5ea9('0x30')][_0x5ea9('0x39')]+'%'};return _0x5b37ed;})});}_0x52fffb=_['merge']({},_0x52fffb,_0x2d7e08[_0x5ea9('0x3d')]);return db[_0x5ea9('0x4a')]['count']({'where':_0x52fffb[_0x5ea9('0x3a')]})[_0x5ea9('0x23')](function(_0x3ff8ee){_0x1f11bc[_0x5ea9('0x1c')]=_0x3ff8ee;if(_0x2d7e08[_0x5ea9('0x30')][_0x5ea9('0x3e')]){_0x52fffb['include']=[{'all':!![]}];}return db[_0x5ea9('0x4a')][_0x5ea9('0x4d')](_0x52fffb);})[_0x5ea9('0x23')](function(_0x3180c1){_0x1f11bc['rows']=_0x3180c1;return _0x1f11bc;});}})[_0x5ea9('0x23')](respondWithFilteredResult(_0xefd572,_0x52fffb))[_0x5ea9('0x41')](handleError(_0xefd572,null));}; \ No newline at end of file +var _0xa1e0=['includeAll','rows','catch','show','params','include','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','filter','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x3a259b,_0x3bf3d1){var _0x56dc4f=function(_0xc9a1f){while(--_0xc9a1f){_0x3a259b['push'](_0x3a259b['shift']());}};_0x56dc4f(++_0x3bf3d1);}(_0xa1e0,0x117));var _0x0a1e=function(_0x136ff3,_0x5020dd){_0x136ff3=_0x136ff3-0x0;var _0x1570bf=_0xa1e0[_0x136ff3];return _0x1570bf;};'use strict';var emlformat=require(_0x0a1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a1e('0x1'));var jsonpatch=require(_0x0a1e('0x2'));var rp=require(_0x0a1e('0x3'));var moment=require('moment');var BPromise=require(_0x0a1e('0x4'));var Mustache=require(_0x0a1e('0x5'));var util=require(_0x0a1e('0x6'));var path=require(_0x0a1e('0x7'));var sox=require(_0x0a1e('0x8'));var csv=require(_0x0a1e('0x9'));var ejs=require(_0x0a1e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a1e('0xb'));var squel=require(_0x0a1e('0xc'));var crypto=require(_0x0a1e('0xd'));var jsforce=require(_0x0a1e('0xe'));var deskjs=require(_0x0a1e('0xf'));var toCsv=require(_0x0a1e('0x9'));var querystring=require(_0x0a1e('0x10'));var Papa=require(_0x0a1e('0x11'));var Redis=require(_0x0a1e('0x12'));var authService=require(_0x0a1e('0x13'));var qs=require(_0x0a1e('0x14'));var as=require(_0x0a1e('0x15'));var hardwareService=require(_0x0a1e('0x16'));var logger=require(_0x0a1e('0x17'))(_0x0a1e('0x18'));var utils=require(_0x0a1e('0x19'));var config=require(_0x0a1e('0x1a'));var licenseUtil=require(_0x0a1e('0x1b'));var db=require(_0x0a1e('0x1c'))['db'];function respondWithStatusCode(_0x1939e5,_0x10f452){_0x10f452=_0x10f452||0xcc;return function(_0x30aa6d){if(_0x30aa6d){return _0x1939e5['sendStatus'](_0x10f452);}return _0x1939e5[_0x0a1e('0x1d')](_0x10f452)[_0x0a1e('0x1e')]();};}function respondWithResult(_0x3b9559,_0x1a6544){_0x1a6544=_0x1a6544||0xc8;return function(_0x134bdc){if(_0x134bdc){return _0x3b9559[_0x0a1e('0x1d')](_0x1a6544)[_0x0a1e('0x1f')](_0x134bdc);}};}function respondWithFilteredResult(_0x435d3d,_0x2630cf){return function(_0x56bac5){if(_0x56bac5){var _0x2c3e8c=typeof _0x2630cf[_0x0a1e('0x20')]==='undefined'&&typeof _0x2630cf[_0x0a1e('0x21')]==='undefined';var _0x5b3206=_0x56bac5['count'];var _0x2dc1ef=_0x2c3e8c?0x0:_0x2630cf[_0x0a1e('0x20')];var _0x4efec1=_0x2c3e8c?_0x56bac5[_0x0a1e('0x22')]:_0x2630cf[_0x0a1e('0x20')]+_0x2630cf[_0x0a1e('0x21')];var _0xcde029;if(_0x4efec1>=_0x5b3206){_0x4efec1=_0x5b3206;_0xcde029=0xc8;}else{_0xcde029=0xce;}_0x435d3d['status'](_0xcde029);return _0x435d3d[_0x0a1e('0x23')](_0x0a1e('0x24'),_0x2dc1ef+'-'+_0x4efec1+'/'+_0x5b3206)[_0x0a1e('0x1f')](_0x56bac5);}return null;};}function patchUpdates(_0x5092ca){return function(_0x1f9f7d){try{jsonpatch[_0x0a1e('0x25')](_0x1f9f7d,_0x5092ca,!![]);}catch(_0x5674b5){return BPromise[_0x0a1e('0x26')](_0x5674b5);}return _0x1f9f7d[_0x0a1e('0x27')]();};}function saveUpdates(_0x5a373a,_0x53ca0d){return function(_0x404b1e){if(_0x404b1e){return _0x404b1e[_0x0a1e('0x28')](_0x5a373a)[_0x0a1e('0x29')](function(_0x1c06b6){return _0x1c06b6;});}return null;};}function removeEntity(_0xe875f4,_0x20dd05){return function(_0x4176c9){if(_0x4176c9){return _0x4176c9[_0x0a1e('0x2a')]()[_0x0a1e('0x29')](function(){_0xe875f4[_0x0a1e('0x1d')](0xcc)[_0x0a1e('0x1e')]();});}};}function handleEntityNotFound(_0x2269a0,_0x4fec2b){return function(_0x20c32a){if(!_0x20c32a){_0x2269a0[_0x0a1e('0x2b')](0x194);}return _0x20c32a;};}function handleError(_0x597ad3,_0x62ab05){_0x62ab05=_0x62ab05||0x1f4;return function(_0x289b66){logger[_0x0a1e('0x2c')](_0x289b66[_0x0a1e('0x2d')]);if(_0x289b66['name']){delete _0x289b66[_0x0a1e('0x2e')];}_0x597ad3[_0x0a1e('0x1d')](_0x62ab05)[_0x0a1e('0x2f')](_0x289b66);};}exports[_0x0a1e('0x30')]=function(_0x117309,_0xae163a){var _0x25e81f={},_0xb7001b={},_0x3ea1a6={'count':0x0,'rows':[]};var _0x5be11a=_[_0x0a1e('0x31')](db[_0x0a1e('0x32')][_0x0a1e('0x33')],function(_0x245681){return{'name':_0x245681[_0x0a1e('0x34')],'type':_0x245681[_0x0a1e('0x35')][_0x0a1e('0x36')]};});_0xb7001b[_0x0a1e('0x37')]=_[_0x0a1e('0x31')](_0x5be11a,'name');_0xb7001b[_0x0a1e('0x38')]=_[_0x0a1e('0x39')](_0x117309[_0x0a1e('0x38')]);_0xb7001b[_0x0a1e('0x3a')]=_[_0x0a1e('0x3b')](_0xb7001b[_0x0a1e('0x37')],_0xb7001b[_0x0a1e('0x38')]);_0x25e81f['attributes']=_[_0x0a1e('0x3b')](_0xb7001b['model'],qs['fields'](_0x117309[_0x0a1e('0x38')][_0x0a1e('0x3c')]));_0x25e81f[_0x0a1e('0x3d')]=_0x25e81f[_0x0a1e('0x3d')][_0x0a1e('0x3e')]?_0x25e81f[_0x0a1e('0x3d')]:_0xb7001b[_0x0a1e('0x37')];if(!_0x117309[_0x0a1e('0x38')]['hasOwnProperty'](_0x0a1e('0x3f'))){_0x25e81f[_0x0a1e('0x21')]=qs[_0x0a1e('0x21')](_0x117309['query'][_0x0a1e('0x21')]);_0x25e81f[_0x0a1e('0x20')]=qs[_0x0a1e('0x20')](_0x117309[_0x0a1e('0x38')]['offset']);}_0x25e81f[_0x0a1e('0x40')]=qs['sort'](_0x117309[_0x0a1e('0x38')][_0x0a1e('0x41')]);_0x25e81f[_0x0a1e('0x42')]=qs[_0x0a1e('0x3a')](_['pick'](_0x117309['query'],_0xb7001b[_0x0a1e('0x3a')]),_0x5be11a);if(_0x117309[_0x0a1e('0x38')]['filter']){_0x25e81f['where']=_[_0x0a1e('0x43')](_0x25e81f[_0x0a1e('0x42')],{'$or':_['map'](_0x5be11a,function(_0x9ab414){if(_0x9ab414['type']!==_0x0a1e('0x44')){var _0x119ec2={};_0x119ec2[_0x9ab414[_0x0a1e('0x2e')]]={'$like':'%'+_0x117309[_0x0a1e('0x38')]['filter']+'%'};return _0x119ec2;}})});}_0x25e81f=_[_0x0a1e('0x43')]({},_0x25e81f,_0x117309['options']);var _0x505ada={'where':_0x25e81f[_0x0a1e('0x42')]};return db[_0x0a1e('0x32')][_0x0a1e('0x22')](_0x505ada)[_0x0a1e('0x29')](function(_0x457b3d){_0x3ea1a6[_0x0a1e('0x22')]=_0x457b3d;if(_0x117309[_0x0a1e('0x38')][_0x0a1e('0x45')]){_0x25e81f['include']=[{'all':!![]}];}return db[_0x0a1e('0x32')]['findAll'](_0x25e81f);})['then'](function(_0x27ae78){_0x3ea1a6[_0x0a1e('0x46')]=_0x27ae78;return _0x3ea1a6;})[_0x0a1e('0x29')](respondWithFilteredResult(_0xae163a,_0x25e81f))[_0x0a1e('0x47')](handleError(_0xae163a,null));};exports[_0x0a1e('0x48')]=function(_0xc8a163,_0x4175a4){var _0x86d64e={'raw':!![],'where':{'id':_0xc8a163[_0x0a1e('0x49')]['id']}},_0x2c90cc={};_0x2c90cc[_0x0a1e('0x37')]=_[_0x0a1e('0x39')](db[_0x0a1e('0x32')]['rawAttributes']);_0x2c90cc[_0x0a1e('0x38')]=_['keys'](_0xc8a163[_0x0a1e('0x38')]);_0x2c90cc[_0x0a1e('0x3a')]=_[_0x0a1e('0x3b')](_0x2c90cc[_0x0a1e('0x37')],_0x2c90cc['query']);_0x86d64e[_0x0a1e('0x3d')]=_[_0x0a1e('0x3b')](_0x2c90cc['model'],qs['fields'](_0xc8a163[_0x0a1e('0x38')][_0x0a1e('0x3c')]));_0x86d64e[_0x0a1e('0x3d')]=_0x86d64e['attributes'][_0x0a1e('0x3e')]?_0x86d64e[_0x0a1e('0x3d')]:_0x2c90cc[_0x0a1e('0x37')];if(_0xc8a163[_0x0a1e('0x38')][_0x0a1e('0x45')]){_0x86d64e[_0x0a1e('0x4a')]=[{'all':!![]}];}_0x86d64e=_['merge']({},_0x86d64e,_0xc8a163[_0x0a1e('0x4b')]);return db['JscriptySessionReport'][_0x0a1e('0x4c')](_0x86d64e)[_0x0a1e('0x29')](handleEntityNotFound(_0x4175a4,null))[_0x0a1e('0x29')](respondWithResult(_0x4175a4,null))['catch'](handleError(_0x4175a4,null));};exports[_0x0a1e('0x4d')]=function(_0x2fba98,_0x2090a9){return db[_0x0a1e('0x32')]['create'](_0x2fba98['body'],{})[_0x0a1e('0x29')](respondWithResult(_0x2090a9,0xc9))['catch'](handleError(_0x2090a9,null));};exports[_0x0a1e('0x28')]=function(_0x431b90,_0x1a1c60){if(_0x431b90[_0x0a1e('0x4e')]['id']){delete _0x431b90[_0x0a1e('0x4e')]['id'];}return db[_0x0a1e('0x32')]['find']({'where':{'id':_0x431b90['params']['id']}})[_0x0a1e('0x29')](handleEntityNotFound(_0x1a1c60,null))[_0x0a1e('0x29')](saveUpdates(_0x431b90[_0x0a1e('0x4e')],null))[_0x0a1e('0x29')](respondWithResult(_0x1a1c60,null))['catch'](handleError(_0x1a1c60,null));};exports['destroy']=function(_0x51e490,_0x44d918){return db[_0x0a1e('0x32')][_0x0a1e('0x4c')]({'where':{'id':_0x51e490[_0x0a1e('0x49')]['id']}})[_0x0a1e('0x29')](handleEntityNotFound(_0x44d918,null))['then'](removeEntity(_0x44d918,null))['catch'](handleError(_0x44d918,null));};exports['describe']=function(_0x1c317a,_0x570c2a){return db[_0x0a1e('0x32')][_0x0a1e('0x4f')]()[_0x0a1e('0x29')](respondWithResult(_0x570c2a,null))[_0x0a1e('0x47')](handleError(_0x570c2a,null));};exports[_0x0a1e('0x50')]=function(_0x4de810,_0x1e7df7,_0xdcd589){var _0x43252a={'raw':!![],'where':{}};var _0x4d1bb8={};var _0x4356ae={'count':0x0,'rows':[]};return db[_0x0a1e('0x32')][_0x0a1e('0x51')]({'where':{'id':_0x4de810[_0x0a1e('0x49')]['id']}})['then'](handleEntityNotFound(_0x1e7df7,null))['then'](function(_0x2c07df){if(_0x2c07df){_0x4d1bb8[_0x0a1e('0x37')]=_['keys'](db[_0x0a1e('0x52')][_0x0a1e('0x33')]);_0x4d1bb8[_0x0a1e('0x38')]=_[_0x0a1e('0x39')](_0x4de810[_0x0a1e('0x38')]);_0x4d1bb8[_0x0a1e('0x3a')]=_[_0x0a1e('0x3b')](_0x4d1bb8['model'],_0x4d1bb8[_0x0a1e('0x38')]);_0x43252a[_0x0a1e('0x3d')]=_[_0x0a1e('0x3b')](_0x4d1bb8['model'],qs[_0x0a1e('0x3c')](_0x4de810['query'][_0x0a1e('0x3c')]));_0x43252a['attributes']=_0x43252a['attributes'][_0x0a1e('0x3e')]?_0x43252a[_0x0a1e('0x3d')]:_0x4d1bb8[_0x0a1e('0x37')];if(!_0x4de810[_0x0a1e('0x38')][_0x0a1e('0x53')]('nolimit')){_0x43252a[_0x0a1e('0x21')]=qs[_0x0a1e('0x21')](_0x4de810[_0x0a1e('0x38')][_0x0a1e('0x21')]);_0x43252a[_0x0a1e('0x20')]=qs[_0x0a1e('0x20')](_0x4de810[_0x0a1e('0x38')]['offset']);}_0x43252a[_0x0a1e('0x40')]=qs[_0x0a1e('0x41')](_0x4de810[_0x0a1e('0x38')]['sort']);_0x43252a['where']=qs[_0x0a1e('0x3a')](_[_0x0a1e('0x54')](_0x4de810['query'],_0x4d1bb8[_0x0a1e('0x3a')]));_0x43252a[_0x0a1e('0x42')][_0x0a1e('0x55')]=_0x2c07df['id'];if(_0x4de810[_0x0a1e('0x38')][_0x0a1e('0x56')]){_0x43252a[_0x0a1e('0x42')]=_[_0x0a1e('0x43')](_0x43252a[_0x0a1e('0x42')],{'$or':_[_0x0a1e('0x31')](_0x43252a['attributes'],function(_0x34fcf8){var _0x305237={};_0x305237[_0x34fcf8]={'$like':'%'+_0x4de810['query'][_0x0a1e('0x56')]+'%'};return _0x305237;})});}_0x43252a=_['merge']({},_0x43252a,_0x4de810[_0x0a1e('0x4b')]);return db[_0x0a1e('0x52')]['count']({'where':_0x43252a['where']})[_0x0a1e('0x29')](function(_0x12c3ff){_0x4356ae[_0x0a1e('0x22')]=_0x12c3ff;if(_0x4de810['query'][_0x0a1e('0x45')]){_0x43252a[_0x0a1e('0x4a')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x43252a);})[_0x0a1e('0x29')](function(_0x136bf2){_0x4356ae[_0x0a1e('0x46')]=_0x136bf2;return _0x4356ae;});}})[_0x0a1e('0x29')](respondWithFilteredResult(_0x1e7df7,_0x43252a))[_0x0a1e('0x47')](handleError(_0x1e7df7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4c19004..2db2f52 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 _0xdbf5=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x30be39,_0xfb49ad){var _0x4d99d6=function(_0x1e7665){while(--_0x1e7665){_0x30be39['push'](_0x30be39['shift']());}};_0x4d99d6(++_0xfb49ad);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x4644c8,_0x4cf5c2){_0x4644c8=_0x4644c8-0x0;var _0x24f8d1=_0xdbf5[_0x4644c8];return _0x24f8d1;};'use strict';var _=require('lodash');var util=require(_0x5dbf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x5dbf('0x1'));var BPromise=require(_0x5dbf('0x2'));var rp=require(_0x5dbf('0x3'));var fs=require('fs');var path=require(_0x5dbf('0x4'));var rimraf=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var attributes=require(_0x5dbf('0x7'));module[_0x5dbf('0x8')]=function(_0x3f8628,_0x3f8222){return _0x3f8628[_0x5dbf('0x9')](_0x5dbf('0xa'),attributes,{'tableName':_0x5dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c7=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2000db,_0x5d8751){_0x2000db=_0x2000db-0x0;var _0x42a6bc=_0xb4c7[_0x2000db];return _0x42a6bc;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));module['exports']=function(_0x1b0f57,_0x10e197){return _0x1b0f57[_0x7b4c('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x7b4c('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 ac66e75..c4fcc07 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 _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch'];(function(_0x36853b,_0x8b52f9){var _0x345d43=function(_0x44667d){while(--_0x44667d){_0x36853b['push'](_0x36853b['shift']());}};_0x345d43(++_0x8b52f9);}(_0xb44a,0x1c2));var _0xab44=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xb44a[_0x587fb5];return _0x551105;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});} \ No newline at end of file +var _0x7ee1=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0x7ee1,0x8d));var _0x17ee=function(_0x4a8f76,_0x5e85c0){_0x4a8f76=_0x4a8f76-0x0;var _0x489610=_0x7ee1[_0x4a8f76];return _0x489610;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index ac0d913..bd193f1 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 _0x6e82=['/download_log_file','downloadLogFile','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./license.controller','get','put','isAuthenticated'];(function(_0x2c635b,_0x3a0465){var _0x418953=function(_0x3bf598){while(--_0x3bf598){_0x2c635b['push'](_0x2c635b['shift']());}};_0x418953(++_0x3a0465);}(_0x6e82,0x13a));var _0x26e8=function(_0x599c44,_0x2fb16e){_0x599c44=_0x599c44-0x0;var _0x1d6cf6=_0x6e82[_0x599c44];return _0x1d6cf6;};'use strict';var multer=require(_0x26e8('0x0'));var util=require(_0x26e8('0x1'));var path=require(_0x26e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x26e8('0x3'));var router=express['Router']();var fs_extra=require(_0x26e8('0x4'));var auth=require(_0x26e8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x26e8('0x6'));var controller=require(_0x26e8('0x7'));router[_0x26e8('0x8')]('/',controller['index']);router[_0x26e8('0x9')]('/:id',auth[_0x26e8('0xa')](),controller['update']);router[_0x26e8('0x8')](_0x26e8('0xb'),auth[_0x26e8('0xa')](),controller[_0x26e8('0xc')]);module['exports']=router; \ No newline at end of file +var _0xceb5=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','put','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','multer'];(function(_0x5e1f02,_0x3333f3){var _0xe2e013=function(_0x1e389b){while(--_0x1e389b){_0x5e1f02['push'](_0x5e1f02['shift']());}};_0xe2e013(++_0x3333f3);}(_0xceb5,0x76));var _0x5ceb=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xceb5[_0x4b91c4];return _0x25cb80;};'use strict';var multer=require(_0x5ceb('0x0'));var util=require(_0x5ceb('0x1'));var path=require(_0x5ceb('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ceb('0x3'));var router=express[_0x5ceb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5ceb('0x5'));var interaction=require(_0x5ceb('0x6'));var config=require(_0x5ceb('0x7'));var controller=require('./license.controller');router['get']('/',controller[_0x5ceb('0x8')]);router[_0x5ceb('0x9')](_0x5ceb('0xa'),auth[_0x5ceb('0xb')](),controller[_0x5ceb('0xc')]);router[_0x5ceb('0xd')](_0x5ceb('0xe'),auth[_0x5ceb('0xb')](),controller[_0x5ceb('0xf')]);module[_0x5ceb('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 d88d171..7d11231 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 _0xa87e=['sequelize','TEXT','STRING'];(function(_0x35fc62,_0x2b5f7){var _0xd54e91=function(_0x18d215){while(--_0x18d215){_0x35fc62['push'](_0x35fc62['shift']());}};_0xd54e91(++_0x2b5f7);}(_0xa87e,0x1ce));var _0xea87=function(_0x1c1567,_0x363ba9){_0x1c1567=_0x1c1567-0x0;var _0x5bec2f=_0xa87e[_0x1c1567];return _0x5bec2f;};'use strict';var Sequelize=require(_0xea87('0x0'));module['exports']={'license':{'type':Sequelize[_0xea87('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xea87('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7aa4=['STRING','exports'];(function(_0xa37af5,_0x21aa07){var _0x2e8809=function(_0x2a5f11){while(--_0x2a5f11){_0xa37af5['push'](_0xa37af5['shift']());}};_0x2e8809(++_0x21aa07);}(_0x7aa4,0x1af));var _0x47aa=function(_0x2a78de,_0x596565){_0x2a78de=_0x2a78de-0x0;var _0x4cbfbf=_0x7aa4[_0x2a78de];return _0x4cbfbf;};'use strict';var Sequelize=require('sequelize');module[_0x47aa('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x47aa('0x1')]},'data2':{'type':Sequelize[_0x47aa('0x1')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 51ad7a6..7a22b09 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 _0x5471=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','merge','options','catch','body','find','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0xe9cc31,_0x26a7f1){var _0x27f708=function(_0x3345cf){while(--_0x3345cf){_0xe9cc31['push'](_0xe9cc31['shift']());}};_0x27f708(++_0x26a7f1);}(_0x5471,0xcd));var _0x1547=function(_0x3d674d,_0x1376e7){_0x3d674d=_0x3d674d-0x0;var _0x160f79=_0x5471[_0x3d674d];return _0x160f79;};'use strict';var emlformat=require(_0x1547('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1547('0x1'));var jsonpatch=require(_0x1547('0x2'));var rp=require(_0x1547('0x3'));var moment=require(_0x1547('0x4'));var BPromise=require(_0x1547('0x5'));var Mustache=require(_0x1547('0x6'));var util=require(_0x1547('0x7'));var path=require(_0x1547('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1547('0x9'));var _=require(_0x1547('0xa'));var squel=require(_0x1547('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1547('0xc'));var toCsv=require(_0x1547('0xd'));var querystring=require(_0x1547('0xe'));var Papa=require(_0x1547('0xf'));var Redis=require(_0x1547('0x10'));var authService=require(_0x1547('0x11'));var qs=require(_0x1547('0x12'));var as=require(_0x1547('0x13'));var hardwareService=require(_0x1547('0x14'));var logger=require(_0x1547('0x15'))('api');var utils=require(_0x1547('0x16'));var config=require(_0x1547('0x17'));var licenseUtil=require(_0x1547('0x18'));var db=require(_0x1547('0x19'))['db'];function respondWithStatusCode(_0x2cbc7c,_0x4dee5d){_0x4dee5d=_0x4dee5d||0xcc;return function(_0xefccbf){if(_0xefccbf){return _0x2cbc7c[_0x1547('0x1a')](_0x4dee5d);}return _0x2cbc7c['status'](_0x4dee5d)['end']();};}function respondWithResult(_0x1800a6,_0x4a8348){_0x4a8348=_0x4a8348||0xc8;return function(_0x165dbd){if(_0x165dbd){return _0x1800a6[_0x1547('0x1b')](_0x4a8348)[_0x1547('0x1c')](_0x165dbd);}};}function respondWithFilteredResult(_0xb40bb9,_0x51137b){return function(_0x27bd39){if(_0x27bd39){var _0x4688fb=typeof _0x51137b[_0x1547('0x1d')]===_0x1547('0x1e')&&typeof _0x51137b['limit']===_0x1547('0x1e');var _0x5217fb=_0x27bd39[_0x1547('0x1f')];var _0x5ade7e=_0x4688fb?0x0:_0x51137b[_0x1547('0x1d')];var _0x383635=_0x4688fb?_0x27bd39[_0x1547('0x1f')]:_0x51137b[_0x1547('0x1d')]+_0x51137b[_0x1547('0x20')];var _0x851a3;if(_0x383635>=_0x5217fb){_0x383635=_0x5217fb;_0x851a3=0xc8;}else{_0x851a3=0xce;}_0xb40bb9[_0x1547('0x1b')](_0x851a3);return _0xb40bb9[_0x1547('0x21')](_0x1547('0x22'),_0x5ade7e+'-'+_0x383635+'/'+_0x5217fb)['json'](_0x27bd39);}return null;};}function patchUpdates(_0xbadb2a){return function(_0x4b757c){try{jsonpatch[_0x1547('0x23')](_0x4b757c,_0xbadb2a,!![]);}catch(_0x350927){return BPromise[_0x1547('0x24')](_0x350927);}return _0x4b757c[_0x1547('0x25')]();};}function saveUpdates(_0x2ab15d,_0x2e0340){return function(_0xe06000){if(_0xe06000){return _0xe06000[_0x1547('0x26')](_0x2ab15d)[_0x1547('0x27')](function(_0xccb810){return _0xccb810;});}return null;};}function removeEntity(_0x5e688c,_0x1b537c){return function(_0x252a66){if(_0x252a66){return _0x252a66['destroy']()[_0x1547('0x27')](function(){_0x5e688c[_0x1547('0x1b')](0xcc)[_0x1547('0x28')]();});}};}function handleEntityNotFound(_0x2b8171,_0x2c9199){return function(_0x1289ef){if(!_0x1289ef){_0x2b8171['sendStatus'](0x194);}return _0x1289ef;};}function handleError(_0x1ca9b3,_0x48c840){_0x48c840=_0x48c840||0x1f4;return function(_0x27aac6){logger[_0x1547('0x29')](_0x27aac6[_0x1547('0x2a')]);if(_0x27aac6['name']){delete _0x27aac6['name'];}_0x1ca9b3['status'](_0x48c840)['send'](_0x27aac6);};}var utilLicense=require(_0x1547('0x18'));exports[_0x1547('0x2b')]=function(_0x5bf1bb,_0x1d5259){var _0x3f8acb={'raw':!![],'where':{'id':0x1}},_0x223cab={};_0x223cab[_0x1547('0x2c')]=_['keys'](db[_0x1547('0x2d')][_0x1547('0x2e')]);_0x223cab[_0x1547('0x2f')]=_[_0x1547('0x30')](_0x5bf1bb[_0x1547('0x2f')]);_0x223cab[_0x1547('0x31')]=_[_0x1547('0x32')](_0x223cab['model'],_0x223cab[_0x1547('0x2f')]);_0x3f8acb[_0x1547('0x33')]=_[_0x1547('0x32')](_0x223cab[_0x1547('0x2c')],qs[_0x1547('0x34')](_0x5bf1bb[_0x1547('0x2f')][_0x1547('0x34')]));_0x3f8acb[_0x1547('0x33')]=_0x3f8acb[_0x1547('0x33')]['length']?_0x3f8acb['attributes']:_0x223cab[_0x1547('0x2c')];_0x3f8acb=_[_0x1547('0x35')]({},_0x3f8acb,_0x5bf1bb[_0x1547('0x36')]);return utilLicense['getLicense'](_0x3f8acb)[_0x1547('0x27')](respondWithResult(_0x1d5259,null))[_0x1547('0x37')](handleError(_0x1d5259,null));};exports[_0x1547('0x26')]=function(_0x37af56,_0x29fcdf){if(_0x37af56[_0x1547('0x38')]['id']){delete _0x37af56[_0x1547('0x38')]['id'];}return db[_0x1547('0x2d')][_0x1547('0x39')]({'where':{'id':_0x37af56[_0x1547('0x3a')]['id']}})['then'](handleEntityNotFound(_0x29fcdf,null))[_0x1547('0x27')](function(_0x575215){var _0x2e6e04=_0x575215[_0x1547('0x3b')]({'plain':!![]});return utilLicense[_0x1547('0x3c')](_0x2e6e04,_0x37af56[_0x1547('0x38')][_0x1547('0x3d')]);})[_0x1547('0x27')](function(_0x4ed7bc){if(!_0x4ed7bc[_0x1547('0x3e')]){return saveUpdates(_0x37af56[_0x1547('0x38')],null);}return _0x4ed7bc;})[_0x1547('0x27')](respondWithResult(_0x29fcdf,null))['catch'](handleError(_0x29fcdf,null));};exports[_0x1547('0x3f')]=function(_0x10950c,_0x4e870f){var _0x129df9=_0x1547('0x40');var _0x580505=path[_0x1547('0x41')](_0x1547('0x42'),_0x1547('0x43'),_0x1547('0x44'),_0x129df9);_0x4e870f[_0x1547('0x45')](_0x1547('0x46'),_0x1547('0x47')+_0x129df9);_0x4e870f['set']('Content-Type',_0x1547('0x48'));_0x4e870f[_0x1547('0x49')](_0x580505);}; \ No newline at end of file +var _0xe262=['rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','error','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','intersection','attributes','fields','length','merge','getLicense','catch','body','find','params','get','key','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','download','eml-format'];(function(_0x2d239f,_0x167856){var _0x1ca993=function(_0x277d5f){while(--_0x277d5f){_0x2d239f['push'](_0x2d239f['shift']());}};_0x1ca993(++_0x167856);}(_0xe262,0x1e2));var _0x2e26=function(_0x306284,_0x5ae322){_0x306284=_0x306284-0x0;var _0x568a1c=_0xe262[_0x306284];return _0x568a1c;};'use strict';var emlformat=require(_0x2e26('0x0'));var rimraf=require(_0x2e26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2e26('0x2'));var moment=require(_0x2e26('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2e26('0x4'));var util=require(_0x2e26('0x5'));var path=require(_0x2e26('0x6'));var sox=require(_0x2e26('0x7'));var csv=require(_0x2e26('0x8'));var ejs=require(_0x2e26('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2e26('0xa'));var crypto=require(_0x2e26('0xb'));var jsforce=require(_0x2e26('0xc'));var deskjs=require(_0x2e26('0xd'));var toCsv=require(_0x2e26('0x8'));var querystring=require(_0x2e26('0xe'));var Papa=require(_0x2e26('0xf'));var Redis=require('ioredis');var authService=require(_0x2e26('0x10'));var qs=require(_0x2e26('0x11'));var as=require(_0x2e26('0x12'));var hardwareService=require(_0x2e26('0x13'));var logger=require('../../config/logger')(_0x2e26('0x14'));var utils=require(_0x2e26('0x15'));var config=require(_0x2e26('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bacf0,_0x3b8f5d){_0x3b8f5d=_0x3b8f5d||0xcc;return function(_0x4d09a2){if(_0x4d09a2){return _0x1bacf0[_0x2e26('0x17')](_0x3b8f5d);}return _0x1bacf0[_0x2e26('0x18')](_0x3b8f5d)[_0x2e26('0x19')]();};}function respondWithResult(_0x4c33eb,_0x5d447d){_0x5d447d=_0x5d447d||0xc8;return function(_0x3c7fd3){if(_0x3c7fd3){return _0x4c33eb['status'](_0x5d447d)[_0x2e26('0x1a')](_0x3c7fd3);}};}function respondWithFilteredResult(_0x1f1c87,_0x13fc3b){return function(_0x1e2f71){if(_0x1e2f71){var _0x3588bd=typeof _0x13fc3b[_0x2e26('0x1b')]===_0x2e26('0x1c')&&typeof _0x13fc3b['limit']===_0x2e26('0x1c');var _0x58246d=_0x1e2f71['count'];var _0x552ba1=_0x3588bd?0x0:_0x13fc3b[_0x2e26('0x1b')];var _0xf424f4=_0x3588bd?_0x1e2f71[_0x2e26('0x1d')]:_0x13fc3b[_0x2e26('0x1b')]+_0x13fc3b[_0x2e26('0x1e')];var _0x5600ac;if(_0xf424f4>=_0x58246d){_0xf424f4=_0x58246d;_0x5600ac=0xc8;}else{_0x5600ac=0xce;}_0x1f1c87[_0x2e26('0x18')](_0x5600ac);return _0x1f1c87[_0x2e26('0x1f')]('Content-Range',_0x552ba1+'-'+_0xf424f4+'/'+_0x58246d)[_0x2e26('0x1a')](_0x1e2f71);}return null;};}function patchUpdates(_0xa2bbc8){return function(_0x43306e){try{jsonpatch[_0x2e26('0x20')](_0x43306e,_0xa2bbc8,!![]);}catch(_0x292c90){return BPromise['reject'](_0x292c90);}return _0x43306e['save']();};}function saveUpdates(_0x558b6c,_0x505628){return function(_0x4133c5){if(_0x4133c5){return _0x4133c5[_0x2e26('0x21')](_0x558b6c)[_0x2e26('0x22')](function(_0x5a9fed){return _0x5a9fed;});}return null;};}function removeEntity(_0x5ea7aa,_0x4ae75c){return function(_0x3d9ec4){if(_0x3d9ec4){return _0x3d9ec4[_0x2e26('0x23')]()['then'](function(){_0x5ea7aa[_0x2e26('0x18')](0xcc)[_0x2e26('0x19')]();});}};}function handleEntityNotFound(_0x38eff1,_0x132321){return function(_0x4e0bab){if(!_0x4e0bab){_0x38eff1[_0x2e26('0x17')](0x194);}return _0x4e0bab;};}function handleError(_0x332b27,_0x3de3b6){_0x3de3b6=_0x3de3b6||0x1f4;return function(_0x3910aa){logger[_0x2e26('0x24')](_0x3910aa[_0x2e26('0x25')]);if(_0x3910aa[_0x2e26('0x26')]){delete _0x3910aa[_0x2e26('0x26')];}_0x332b27[_0x2e26('0x18')](_0x3de3b6)[_0x2e26('0x27')](_0x3910aa);};}var utilLicense=require(_0x2e26('0x28'));exports[_0x2e26('0x29')]=function(_0x2e9f32,_0x8c468b){var _0x1d8c73={'raw':!![],'where':{'id':0x1}},_0x158e10={};_0x158e10[_0x2e26('0x2a')]=_[_0x2e26('0x2b')](db[_0x2e26('0x2c')][_0x2e26('0x2d')]);_0x158e10[_0x2e26('0x2e')]=_[_0x2e26('0x2b')](_0x2e9f32['query']);_0x158e10['filters']=_[_0x2e26('0x2f')](_0x158e10['model'],_0x158e10[_0x2e26('0x2e')]);_0x1d8c73[_0x2e26('0x30')]=_['intersection'](_0x158e10[_0x2e26('0x2a')],qs[_0x2e26('0x31')](_0x2e9f32[_0x2e26('0x2e')][_0x2e26('0x31')]));_0x1d8c73['attributes']=_0x1d8c73[_0x2e26('0x30')][_0x2e26('0x32')]?_0x1d8c73[_0x2e26('0x30')]:_0x158e10[_0x2e26('0x2a')];_0x1d8c73=_[_0x2e26('0x33')]({},_0x1d8c73,_0x2e9f32['options']);return utilLicense[_0x2e26('0x34')](_0x1d8c73)[_0x2e26('0x22')](respondWithResult(_0x8c468b,null))[_0x2e26('0x35')](handleError(_0x8c468b,null));};exports[_0x2e26('0x21')]=function(_0x4b1c6e,_0x352beb){if(_0x4b1c6e[_0x2e26('0x36')]['id']){delete _0x4b1c6e[_0x2e26('0x36')]['id'];}return db['License'][_0x2e26('0x37')]({'where':{'id':_0x4b1c6e[_0x2e26('0x38')]['id']}})[_0x2e26('0x22')](handleEntityNotFound(_0x352beb,null))[_0x2e26('0x22')](function(_0x440839){var _0x12c788=_0x440839[_0x2e26('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0x12c788,_0x4b1c6e[_0x2e26('0x36')][_0x2e26('0x3a')]);})[_0x2e26('0x22')](function(_0x442a74){if(!_0x442a74['demo']){return saveUpdates(_0x4b1c6e[_0x2e26('0x36')],null);}return _0x442a74;})[_0x2e26('0x22')](respondWithResult(_0x352beb,null))[_0x2e26('0x35')](handleError(_0x352beb,null));};exports[_0x2e26('0x3b')]=function(_0x133c6e,_0x70ccfb){var _0x21aa31=_0x2e26('0x3c');var _0x3d521f=path[_0x2e26('0x3d')](_0x2e26('0x3e'),'log',_0x2e26('0x3f'),_0x21aa31);_0x70ccfb[_0x2e26('0x40')](_0x2e26('0x41'),_0x2e26('0x42')+_0x21aa31);_0x70ccfb[_0x2e26('0x1f')]('Content-Type',_0x2e26('0x43'));_0x70ccfb[_0x2e26('0x44')](_0x3d521f);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index e0d2f6f..32fea20 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 _0xc0a9=['exports','define','License','license','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xc0a9,0x72));var _0x9c0a=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xc0a9[_0xf73c09];return _0xa8923c;};'use strict';var _=require(_0x9c0a('0x0'));var util=require(_0x9c0a('0x1'));var logger=require(_0x9c0a('0x2'))('api');var moment=require(_0x9c0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x9c0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c0a('0x5'));var config=require(_0x9c0a('0x6'));var attributes=require('./license.attributes');module[_0x9c0a('0x7')]=function(_0x945385,_0x5d7ab4){return _0x945385[_0x9c0a('0x8')](_0x9c0a('0x9'),attributes,{'tableName':_0x9c0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ea=['../../config/logger','api','moment','path','../../config/environment','exports','License','license','lodash','util'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x54ea,0x80));var _0xa54e=function(_0x3d63f6,_0x8cd7e4){_0x3d63f6=_0x3d63f6-0x0;var _0x2ac67b=_0x54ea[_0x3d63f6];return _0x2ac67b;};'use strict';var _=require(_0xa54e('0x0'));var util=require(_0xa54e('0x1'));var logger=require(_0xa54e('0x2'))(_0xa54e('0x3'));var moment=require(_0xa54e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa54e('0x5'));var rimraf=require('rimraf');var config=require(_0xa54e('0x6'));var attributes=require('./license.attributes');module[_0xa54e('0x7')]=function(_0x5b9624,_0x1af5ed){return _0x5b9624['define'](_0xa54e('0x8'),attributes,{'tableName':_0xa54e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 88c73a7..5f7367b 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 _0x35e4=['License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','client','then'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x35e4,0xac));var _0x435e=function(_0x3c232b,_0x3503e6){_0x3c232b=_0x3c232b-0x0;var _0x999eb3=_0x35e4[_0x3c232b];return _0x999eb3;};'use strict';var _=require(_0x435e('0x0'));var util=require(_0x435e('0x1'));var moment=require(_0x435e('0x2'));var BPromise=require(_0x435e('0x3'));var rs=require(_0x435e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x435e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x435e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ffea0,_0x578bcc,_0x4610cf){return new BPromise(function(_0x9843c,_0x35ae41){return client['request'](_0x1ffea0,_0x4610cf)[_0x435e('0x7')](function(_0x43ea3c){logger['info'](_0x435e('0x8'),_0x578bcc,_0x435e('0x9'));logger['debug'](_0x435e('0xa'),_0x578bcc,'request\x20sent',JSON['stringify'](_0x43ea3c));if(_0x43ea3c['error']){if(_0x43ea3c['error'][_0x435e('0xb')]===0x1f4){logger['error'](_0x435e('0x8'),_0x578bcc,_0x43ea3c[_0x435e('0xc')][_0x435e('0xd')]);return _0x35ae41(_0x43ea3c['error'][_0x435e('0xd')]);}logger[_0x435e('0xc')](_0x435e('0x8'),_0x578bcc,_0x43ea3c['error'][_0x435e('0xd')]);return _0x9843c(_0x43ea3c[_0x435e('0xc')][_0x435e('0xd')]);}else{logger['info'](_0x435e('0x8'),_0x578bcc,'request\x20sent');_0x9843c(_0x43ea3c['result']['message']);}})[_0x435e('0xe')](function(_0x3b7104){logger[_0x435e('0xc')](_0x435e('0x8'),_0x578bcc,_0x3b7104);_0x35ae41(_0x3b7104);});});} \ No newline at end of file +var _0xd687=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x17257b,_0x5c1043){var _0x348b3f=function(_0x136ca4){while(--_0x136ca4){_0x17257b['push'](_0x17257b['shift']());}};_0x348b3f(++_0x5c1043);}(_0xd687,0x156));var _0x7d68=function(_0x1f5ab3,_0x2d2473){_0x1f5ab3=_0x1f5ab3-0x0;var _0x2bd0d7=_0xd687[_0x1f5ab3];return _0x2bd0d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d68('0x0'));var BPromise=require('bluebird');var rs=require(_0x7d68('0x1'));var fs=require('fs');var Redis=require(_0x7d68('0x2'));var db=require(_0x7d68('0x3'))['db'];var utils=require(_0x7d68('0x4'));var logger=require('../../config/logger')(_0x7d68('0x5'));var config=require(_0x7d68('0x6'));var jayson=require(_0x7d68('0x7'));var client=jayson['client'][_0x7d68('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x65feb7,_0x32ef22,_0x3f745d){return new BPromise(function(_0x561316,_0x201700){return client['request'](_0x65feb7,_0x3f745d)[_0x7d68('0x9')](function(_0x5c6905){logger[_0x7d68('0xa')](_0x7d68('0xb'),_0x32ef22,'request\x20sent');logger[_0x7d68('0xc')]('License,\x20%s,\x20%s,\x20%s',_0x32ef22,_0x7d68('0xd'),JSON[_0x7d68('0xe')](_0x5c6905));if(_0x5c6905[_0x7d68('0xf')]){if(_0x5c6905['error'][_0x7d68('0x10')]===0x1f4){logger[_0x7d68('0xf')](_0x7d68('0xb'),_0x32ef22,_0x5c6905['error'][_0x7d68('0x11')]);return _0x201700(_0x5c6905[_0x7d68('0xf')][_0x7d68('0x11')]);}logger[_0x7d68('0xf')](_0x7d68('0xb'),_0x32ef22,_0x5c6905[_0x7d68('0xf')][_0x7d68('0x11')]);return _0x561316(_0x5c6905[_0x7d68('0xf')]['message']);}else{logger[_0x7d68('0xa')]('License,\x20%s,\x20%s',_0x32ef22,_0x7d68('0xd'));_0x561316(_0x5c6905[_0x7d68('0x12')]['message']);}})[_0x7d68('0x13')](function(_0x351f3d){logger[_0x7d68('0xf')]('License,\x20%s,\x20%s',_0x32ef22,_0x351f3d);_0x201700(_0x351f3d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 609b22f..3757c40 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 _0xead1=['removeAgents','exports','util','path','express','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeSmtp','destroy'];(function(_0x5431bd,_0x19d955){var _0x54c402=function(_0x3d2a44){while(--_0x3d2a44){_0x5431bd['push'](_0x5431bd['shift']());}};_0x54c402(++_0x19d955);}(_0xead1,0x10a));var _0x1ead=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xead1[_0x92c450];return _0x2a9599;};'use strict';var multer=require('multer');var util=require(_0x1ead('0x0'));var path=require(_0x1ead('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ead('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ead('0x3'));var interaction=require(_0x1ead('0x4'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0x1ead('0x5')]('/',auth['isAuthenticated'](),controller[_0x1ead('0x6')]);router['get'](_0x1ead('0x7'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x9')]);router['get'](_0x1ead('0xa'),auth[_0x1ead('0x8')](),controller['show']);router[_0x1ead('0x5')](_0x1ead('0xb'),auth[_0x1ead('0x8')](),controller['getDispositions']);router[_0x1ead('0x5')](_0x1ead('0xc'),auth[_0x1ead('0x8')](),controller[_0x1ead('0xd')]);router[_0x1ead('0x5')](_0x1ead('0xe'),auth[_0x1ead('0x8')](),controller[_0x1ead('0xf')]);router['get'](_0x1ead('0x10'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x11')]);router[_0x1ead('0x5')](_0x1ead('0x12'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x13')]);router[_0x1ead('0x5')](_0x1ead('0x14'),auth[_0x1ead('0x8')](),controller['getApplications']);router[_0x1ead('0x5')](_0x1ead('0x15'),auth[_0x1ead('0x8')](),controller['getMessages']);router[_0x1ead('0x5')](_0x1ead('0x16'),auth['isAuthenticated'](),controller[_0x1ead('0x17')]);router[_0x1ead('0x5')](_0x1ead('0x18'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x19')]);router[_0x1ead('0x1a')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x1ead('0x1a')](_0x1ead('0xc'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x1b')]);router[_0x1ead('0x1a')]('/',auth[_0x1ead('0x8')](),controller[_0x1ead('0x1c')]);router[_0x1ead('0x1a')](_0x1ead('0xe'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x1d')]);router[_0x1ead('0x1a')](_0x1ead('0x10'),auth['isAuthenticated'](),controller[_0x1ead('0x1e')]);router[_0x1ead('0x1a')](_0x1ead('0x12'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x1f')]);router[_0x1ead('0x1a')](_0x1ead('0x14'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x20')]);router['post'](_0x1ead('0x21'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x22')]);router[_0x1ead('0x1a')](_0x1ead('0x18'),auth[_0x1ead('0x8')](),controller[_0x1ead('0x23')]);router[_0x1ead('0x24')]('/:id',auth[_0x1ead('0x8')](),controller[_0x1ead('0x25')]);router[_0x1ead('0x26')]('/:id/dispositions',auth[_0x1ead('0x8')](),controller[_0x1ead('0x27')]);router['delete']('/:id/canned_answers',auth[_0x1ead('0x8')](),controller['removeAnswers']);router[_0x1ead('0x26')](_0x1ead('0xe'),auth[_0x1ead('0x8')](),controller['removeImap']);router[_0x1ead('0x26')]('/:id/out_servers',auth[_0x1ead('0x8')](),controller[_0x1ead('0x28')]);router[_0x1ead('0x26')](_0x1ead('0xa'),auth['isAuthenticated'](),controller[_0x1ead('0x29')]);router[_0x1ead('0x26')](_0x1ead('0x18'),auth['isAuthenticated'](),controller[_0x1ead('0x2a')]);module[_0x1ead('0x2b')]=router; \ No newline at end of file +var _0xe7b8=['addApplications','/:id/send','send','addAgents','put','delete','removeAnswers','removeSmtp','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','/:id/applications'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe7b8,0xb6));var _0x8e7b=function(_0x32a7b8,_0x120934){_0x32a7b8=_0x32a7b8-0x0;var _0x5310bd=_0xe7b8[_0x32a7b8];return _0x5310bd;};'use strict';var multer=require(_0x8e7b('0x0'));var util=require(_0x8e7b('0x1'));var path=require(_0x8e7b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8e7b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8e7b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8e7b('0x5'));var controller=require(_0x8e7b('0x6'));router[_0x8e7b('0x7')]('/',auth[_0x8e7b('0x8')](),controller['index']);router[_0x8e7b('0x7')]('/describe',auth[_0x8e7b('0x8')](),controller['describe']);router[_0x8e7b('0x7')](_0x8e7b('0x9'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0xa')]);router['get'](_0x8e7b('0xb'),auth['isAuthenticated'](),controller[_0x8e7b('0xc')]);router[_0x8e7b('0x7')](_0x8e7b('0xd'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0xe')]);router[_0x8e7b('0x7')](_0x8e7b('0xf'),auth[_0x8e7b('0x8')](),controller['getImap']);router[_0x8e7b('0x7')](_0x8e7b('0x10'),auth['isAuthenticated'](),controller[_0x8e7b('0x11')]);router[_0x8e7b('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x8e7b('0x12')]);router[_0x8e7b('0x7')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8e7b('0x13')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x8e7b('0x14')]);router[_0x8e7b('0x7')](_0x8e7b('0x15'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x16')]);router[_0x8e7b('0x7')](_0x8e7b('0x17'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x18')]);router['post'](_0x8e7b('0xb'),auth[_0x8e7b('0x8')](),controller['addDisposition']);router[_0x8e7b('0x19')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8e7b('0x1a')]);router[_0x8e7b('0x19')]('/',auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x1b')]);router[_0x8e7b('0x19')](_0x8e7b('0xf'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x1c')]);router['post'](_0x8e7b('0x10'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x1d')]);router['post'](_0x8e7b('0x1e'),auth['isAuthenticated'](),controller[_0x8e7b('0x1f')]);router[_0x8e7b('0x19')](_0x8e7b('0x20'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x21')]);router[_0x8e7b('0x19')](_0x8e7b('0x22'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x23')]);router[_0x8e7b('0x19')]('/:id/users',auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x24')]);router[_0x8e7b('0x25')](_0x8e7b('0x9'),auth[_0x8e7b('0x8')](),controller['update']);router[_0x8e7b('0x26')](_0x8e7b('0xb'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x27')]);router[_0x8e7b('0x26')](_0x8e7b('0xf'),auth['isAuthenticated'](),controller['removeImap']);router[_0x8e7b('0x26')](_0x8e7b('0x10'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x28')]);router[_0x8e7b('0x26')]('/:id',auth[_0x8e7b('0x8')](),controller['destroy']);router[_0x8e7b('0x26')](_0x8e7b('0x17'),auth[_0x8e7b('0x8')](),controller[_0x8e7b('0x29')]);module[_0x8e7b('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bd02f8b..8c88656 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 _0x25c2=['mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','setDataValue'];(function(_0x16df4e,_0x5cc4e0){var _0x3f1692=function(_0x204ac1){while(--_0x204ac1){_0x16df4e['push'](_0x16df4e['shift']());}};_0x3f1692(++_0x5cc4e0);}(_0x25c2,0x98));var _0x225c=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x25c2[_0x9729d7];return _0x3c4ac6;};'use strict';var Sequelize=require(_0x225c('0x0'));module['exports']={'description':{'type':Sequelize[_0x225c('0x1')]},'name':{'type':Sequelize[_0x225c('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x225c('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x225c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x225c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x225c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x225c('0x3')]},'markAsUnread':{'type':Sequelize[_0x225c('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x225c('0x4')},'fontSize':{'type':Sequelize[_0x225c('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x225c('0x6');}},'notificationSound':{'type':Sequelize[_0x225c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x225c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x225c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x225c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x225c('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x225c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x460f26){if(!_0x460f26)this[_0x225c('0x7')](_0x225c('0x8'),null);this[_0x225c('0x7')](_0x225c('0x9'),_0x460f26);}},'provider':{'type':Sequelize[_0x225c('0xa')]('gmail',_0x225c('0xb'),_0x225c('0xc'),_0x225c('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x225c('0xe')))return'custom';return this['getDataValue'](_0x225c('0xe'));},'set':function(_0x2176ef){if(_0x2176ef===_0x225c('0xf'))_0x2176ef=null;return this[_0x225c('0x7')]('provider',_0x2176ef);}}}; \ No newline at end of file +var _0xdc43=['mandatoryDisposition','ENUM','gmail','yahoo','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x5cc0a5,_0x5d1c1a){var _0x1818cf=function(_0x337065){while(--_0x337065){_0x5cc0a5['push'](_0x5cc0a5['shift']());}};_0x1818cf(++_0x5d1c1a);}(_0xdc43,0x1db));var _0x3dc4=function(_0x4d8381,_0x341897){_0x4d8381=_0x4d8381-0x0;var _0x2576cc=_0xdc43[_0x4d8381];return _0x2576cc;};'use strict';var Sequelize=require(_0x3dc4('0x0'));module[_0x3dc4('0x1')]={'description':{'type':Sequelize[_0x3dc4('0x2')]},'name':{'type':Sequelize[_0x3dc4('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x3dc4('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x3dc4('0x4')]},'markAsUnread':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3dc4('0x2')],'allowNull':![],'defaultValue':_0x3dc4('0x5')},'fontSize':{'type':Sequelize[_0x3dc4('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3dc4('0x4')],'defaultValue':function(){return _0x3dc4('0x7');}},'notificationSound':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3dc4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3dc4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3dc4('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x3dc4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x3dc4('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x517349){if(!_0x517349)this[_0x3dc4('0x9')](_0x3dc4('0xa'),null);this[_0x3dc4('0x9')](_0x3dc4('0xb'),_0x517349);}},'provider':{'type':Sequelize[_0x3dc4('0xc')](_0x3dc4('0xd'),'hotmail',_0x3dc4('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x3dc4('0xf')](_0x3dc4('0x10')))return _0x3dc4('0x11');return this['getDataValue'](_0x3dc4('0x10'));},'set':function(_0x4f8026){if(_0x4f8026===_0x3dc4('0x11'))_0x4f8026=null;return this[_0x3dc4('0x9')](_0x3dc4('0x10'),_0x4f8026);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 83231f2..8f01630 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 _0x9818=['secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','params','find','body','provider','custom','MailServerOut','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','pick','includeAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','create','removeAnswers','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','email','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List','ListId','attach','messageId','format','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','defaults','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','UserProfileResource','status','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x9818,0x80));var _0x8981=function(_0x3a8f6b,_0x2d5ab9){_0x3a8f6b=_0x3a8f6b-0x0;var _0xe0f679=_0x9818[_0x3a8f6b];return _0xe0f679;};'use strict';var moment=require('moment');var BPromise=require(_0x8981('0x0'));var util=require(_0x8981('0x1'));var path=require(_0x8981('0x2'));var _=require(_0x8981('0x3'));var juice=require(_0x8981('0x4'));var Redis=require(_0x8981('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x8981('0x6'))(_0x8981('0x7'));var config=require(_0x8981('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8981('0x9')](config[_0x8981('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8981('0xb'))(new Redis(config[_0x8981('0xa')]));require(_0x8981('0xc'))[_0x8981('0xd')](socket);var jayson=require(_0x8981('0xe'));var client=jayson[_0x8981('0xf')][_0x8981('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3441ca,_0x1ec77e,_0x213049,_0x163c44){return new BPromise(function(_0x12c40e,_0x52a151){var _0x5f55ff=_0x163c44||client;return _0x5f55ff[_0x8981('0x11')](_0x3441ca,_0x213049)[_0x8981('0x12')](function(_0x35d9ad){logger['info'](_0x8981('0x13'),_0x1ec77e,_0x8981('0x14'));logger[_0x8981('0x15')](_0x8981('0x16'),_0x1ec77e,_0x8981('0x14'),JSON[_0x8981('0x17')](_0x35d9ad));if(_0x35d9ad['error']){if(_0x35d9ad[_0x8981('0x18')][_0x8981('0x19')]===0x1f4){logger[_0x8981('0x18')](_0x8981('0x13'),_0x1ec77e,_0x35d9ad['error'][_0x8981('0x1a')]);return _0x52a151(_0x35d9ad[_0x8981('0x18')]['message']);}logger[_0x8981('0x18')](_0x8981('0x13'),_0x1ec77e,_0x35d9ad['error'][_0x8981('0x1a')]);return _0x12c40e(_0x35d9ad[_0x8981('0x18')][_0x8981('0x1a')]);}else{logger[_0x8981('0x1b')](_0x8981('0x13'),_0x1ec77e,'request\x20sent');_0x12c40e(_0x35d9ad[_0x8981('0x1c')][_0x8981('0x1a')]);}})[_0x8981('0x1d')](function(_0x5b3db5){logger[_0x8981('0x18')](_0x8981('0x13'),_0x1ec77e,_0x5b3db5);_0x52a151(_0x5b3db5);});});}function respondWithStatusCode(_0x241946,_0x2f1737){_0x2f1737=_0x2f1737||0xcc;return function(_0x2dc7a2){if(_0x2dc7a2){return _0x241946[_0x8981('0x1e')](_0x2f1737);}return _0x241946['status'](_0x2f1737)[_0x8981('0x1f')]();};}function respondWithResult(_0x36de52,_0xa145f4){_0xa145f4=_0xa145f4||0xc8;return function(_0x4145e4){if(_0x4145e4){return _0x36de52['status'](_0xa145f4)[_0x8981('0x20')](_0x4145e4);}};}function respondWithFilteredResult(_0x16404f,_0x5d531d){return function(_0x1303f5){if(_0x1303f5){var _0x29b64f=typeof _0x5d531d['offset']===_0x8981('0x21')&&typeof _0x5d531d[_0x8981('0x22')]==='undefined';var _0x2e7491=_0x1303f5[_0x8981('0x23')];var _0x384714=_0x29b64f?0x0:_0x5d531d[_0x8981('0x24')];var _0x3ca09c=_0x29b64f?_0x1303f5[_0x8981('0x23')]:_0x5d531d[_0x8981('0x24')]+_0x5d531d[_0x8981('0x22')];var _0x38afe6;if(_0x3ca09c>=_0x2e7491){_0x3ca09c=_0x2e7491;_0x38afe6=0xc8;}else{_0x38afe6=0xce;}_0x16404f['status'](_0x38afe6);return _0x16404f[_0x8981('0x25')](_0x8981('0x26'),_0x384714+'-'+_0x3ca09c+'/'+_0x2e7491)[_0x8981('0x20')](_0x1303f5);}return null;};}function saveUpdates(_0x2ecbbf){return function(_0x5cf064){if(_0x5cf064){return _0x5cf064[_0x8981('0x27')](_0x2ecbbf)[_0x8981('0x12')](function(_0x3e1e95){return _0x3e1e95;});}return null;};}function removeEntity(_0x30df5a){return function(_0x418766){if(_0x418766){return _0x418766[_0x8981('0x28')]()[_0x8981('0x12')](function(){var _0x3be163=_0x418766['get']({'plain':!![]});var _0x16ba57='MailAccounts';return db[_0x8981('0x29')][_0x8981('0x28')]({'where':{'type':_0x16ba57,'resourceId':_0x3be163['id']}})[_0x8981('0x12')](function(){return _0x418766;});})[_0x8981('0x12')](function(){_0x30df5a[_0x8981('0x2a')](0xcc)[_0x8981('0x1f')]();});}};}function handleEntityNotFound(_0x359097){return function(_0x33181b){if(!_0x33181b){_0x359097[_0x8981('0x1e')](0x194);}return _0x33181b;};}function handleError(_0x1ffe48,_0x4cdfe1){_0x4cdfe1=_0x4cdfe1||0x1f4;return function(_0x2196e4){logger['error'](_0x2196e4[_0x8981('0x2b')]);if(_0x2196e4[_0x8981('0x2c')]){delete _0x2196e4['name'];}_0x1ffe48[_0x8981('0x2a')](_0x4cdfe1)[_0x8981('0x2d')](_0x2196e4);};}function getImapHost(_0x155fd6){switch(_0x155fd6){case _0x8981('0x2e'):return _0x8981('0x2f');case _0x8981('0x30'):return _0x8981('0x31');case _0x8981('0x32'):return _0x8981('0x33');case'outlook365':return _0x8981('0x34');}throw new Error(_0x8981('0x35'),_0x155fd6);}function getSmtpHost(_0x345ab6){switch(_0x345ab6){case _0x8981('0x2e'):return _0x8981('0x36');case _0x8981('0x30'):return _0x8981('0x37');case _0x8981('0x32'):return _0x8981('0x38');case'outlook365':return _0x8981('0x39');}throw new Error(_0x8981('0x35'),_0x345ab6);}function getAuthenticationOptions(_0x76a1ab,_0x16820f){var _0x47835a={};var _0x478866={};if(_0x76a1ab){_0x47835a[_0x8981('0x3a')]=_0x478866[_0x8981('0x3a')]=_0x16820f['username'];_0x47835a[_0x8981('0x3b')]=_0x478866[_0x8981('0x3c')]=_0x16820f[_0x8981('0x3b')];if(_0x16820f[_0x8981('0x3d')]){_0x47835a[_0x8981('0x3d')]=_0x478866[_0x8981('0x3d')]=!![];_0x47835a[_0x8981('0x3e')]=_0x478866['CloudProviderId']=_0x16820f[_0x8981('0x3e')];_0x47835a['password']=_0x478866[_0x8981('0x3c')]=null;}else{_0x47835a[_0x8981('0x3e')]=_0x478866[_0x8981('0x3e')]=null;}_0x47835a[_0x8981('0x3f')]=getImapHost(_0x76a1ab);_0x47835a['port']=0x3e1;_0x478866[_0x8981('0x3f')]=getSmtpHost(_0x76a1ab);_0x478866[_0x8981('0x40')]=0x24b;_0x478866[_0x8981('0x41')]=![];_0x47835a[_0x8981('0x42')]=_0x478866[_0x8981('0x42')]=null;}else{if(_0x16820f[_0x8981('0x43')]){_0x47835a[_0x8981('0x3a')]=_0x478866[_0x8981('0x3a')]=_0x16820f['username'];_0x47835a[_0x8981('0x3b')]=_0x478866[_0x8981('0x3c')]=_0x16820f[_0x8981('0x3b')];}else{_0x47835a[_0x8981('0x43')]=_0x478866['authentication']=![];_0x47835a[_0x8981('0x3a')]=_0x478866[_0x8981('0x3a')]=null;_0x47835a['password']=_0x478866['pass']=null;}_0x47835a['host']=_0x16820f['Imap'][_0x8981('0x3f')];_0x47835a[_0x8981('0x40')]=_0x16820f[_0x8981('0x44')][_0x8981('0x40')];_0x478866[_0x8981('0x3f')]=_0x16820f[_0x8981('0x45')]['host'];_0x478866['port']=_0x16820f[_0x8981('0x45')][_0x8981('0x40')];}return{'Imap':_0x47835a,'Smtp':_0x478866};}exports[_0x8981('0x46')]=function(_0xc954ee,_0x2a75dc){var _0x547052={'include':[{'model':db[_0x8981('0x47')],'as':_0x8981('0x44')},{'model':db['MailServerOut'],'as':_0x8981('0x45')},{'model':db[_0x8981('0x48')],'as':_0x8981('0x49')}]},_0x477062={},_0xd31d36={'count':0x0,'rows':[]};var _0x3f8acd=_[_0x8981('0x4a')](db[_0x8981('0x4b')][_0x8981('0x4c')],function(_0x2267d2){return{'name':_0x2267d2[_0x8981('0x4d')],'type':_0x2267d2[_0x8981('0x4e')]['key']};});_0x477062[_0x8981('0x4f')]=_['map'](_0x3f8acd,_0x8981('0x2c'));_0x477062[_0x8981('0x50')]=_[_0x8981('0x51')](_0xc954ee[_0x8981('0x50')]);_0x477062[_0x8981('0x52')]=_[_0x8981('0x53')](_0x477062[_0x8981('0x4f')],_0x477062[_0x8981('0x50')]);_0x547052['attributes']=_['intersection'](_0x477062[_0x8981('0x4f')],qs[_0x8981('0x54')](_0xc954ee[_0x8981('0x50')][_0x8981('0x54')]));_0x547052[_0x8981('0x55')]=_0x547052['attributes'][_0x8981('0x56')]?_0x547052[_0x8981('0x55')]:_0x477062[_0x8981('0x4f')];if(!_0xc954ee[_0x8981('0x50')][_0x8981('0x57')](_0x8981('0x58'))){_0x547052['limit']=qs[_0x8981('0x22')](_0xc954ee['query']['limit']);_0x547052['offset']=qs[_0x8981('0x24')](_0xc954ee[_0x8981('0x50')][_0x8981('0x24')]);}_0x547052[_0x8981('0x59')]=qs[_0x8981('0x5a')](_0xc954ee['query']['sort']);_0x547052['where']=qs[_0x8981('0x52')](_['pick'](_0xc954ee[_0x8981('0x50')],_0x477062[_0x8981('0x52')]),_0x3f8acd);if(_0xc954ee[_0x8981('0x50')][_0x8981('0x5b')]){_0x547052[_0x8981('0x5c')]=_[_0x8981('0x5d')](_0x547052[_0x8981('0x5c')],{'$or':_[_0x8981('0x4a')](_0x3f8acd,function(_0x377df2){if(_0x377df2[_0x8981('0x4e')]!==_0x8981('0x5e')){var _0x72fc75={};_0x72fc75[_0x377df2[_0x8981('0x2c')]]={'$like':'%'+_0xc954ee[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x72fc75;}})});}_0x547052=_[_0x8981('0x5d')]({},_0x547052,_0xc954ee[_0x8981('0x5f')]);var _0x369411={'where':_0x547052[_0x8981('0x5c')]};return db[_0x8981('0x4b')]['count'](_0x369411)['then'](function(_0x5c7066){_0xd31d36[_0x8981('0x23')]=_0x5c7066;if(_0xc954ee[_0x8981('0x50')]['includeAll']){_0x547052[_0x8981('0x60')]=[{'all':!![]}];}return db['MailAccount'][_0x8981('0x61')](_0x547052);})[_0x8981('0x12')](function(_0x15d0bd){_0xd31d36['rows']=_0x15d0bd;return _0xd31d36;})[_0x8981('0x12')](respondWithFilteredResult(_0x2a75dc,_0x547052))[_0x8981('0x1d')](handleError(_0x2a75dc,null));};exports['show']=function(_0x28c71d,_0x2163e8){var _0x267a52={'raw':![],'where':{'id':_0x28c71d[_0x8981('0x62')]['id']},'include':[{'model':db[_0x8981('0x47')],'as':_0x8981('0x44')},{'model':db['MailServerOut'],'as':_0x8981('0x45')},{'model':db['Pause'],'as':_0x8981('0x49')}]},_0x5a691c={};_0x5a691c[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x4b')][_0x8981('0x4c')]);_0x5a691c[_0x8981('0x50')]=_[_0x8981('0x51')](_0x28c71d[_0x8981('0x50')]);_0x5a691c['filters']=_[_0x8981('0x53')](_0x5a691c[_0x8981('0x4f')],_0x5a691c[_0x8981('0x50')]);_0x267a52[_0x8981('0x55')]=_[_0x8981('0x53')](_0x5a691c['model'],qs[_0x8981('0x54')](_0x28c71d['query'][_0x8981('0x54')]));_0x267a52[_0x8981('0x55')]=_0x267a52['attributes'][_0x8981('0x56')]?_0x267a52['attributes']:_0x5a691c[_0x8981('0x4f')];if(_0x28c71d[_0x8981('0x50')]['includeAll']){_0x267a52[_0x8981('0x60')]=[{'all':!![]}];}_0x267a52=_['merge']({},_0x267a52,_0x28c71d[_0x8981('0x5f')]);return db['MailAccount'][_0x8981('0x63')](_0x267a52)[_0x8981('0x12')](handleEntityNotFound(_0x2163e8,null))['then'](respondWithResult(_0x2163e8,null))['catch'](handleError(_0x2163e8,null));};exports[_0x8981('0x27')]=function(_0xd5e716,_0x2c8c7b){if(_0xd5e716[_0x8981('0x64')]['id']){delete _0xd5e716[_0x8981('0x64')]['id'];}var _0x421483=_0xd5e716['body'][_0x8981('0x65')]===_0x8981('0x66')?null:_0xd5e716[_0x8981('0x64')][_0x8981('0x65')];var _0x399460=_0xd5e716[_0x8981('0x64')][_0x8981('0x44')]||{};var _0x4377bd=_0xd5e716['body'][_0x8981('0x45')]||{};if(_0x421483){_0x399460[_0x8981('0x3f')]=getImapHost(_0x421483);_0x399460[_0x8981('0x40')]=0x3e1;_0x4377bd[_0x8981('0x3f')]=getSmtpHost(_0x421483);_0x4377bd['port']=0x24b;_0x4377bd[_0x8981('0x41')]=![];}if(_0x4377bd[_0x8981('0x3d')]){_0x4377bd[_0x8981('0x41')]=![];}else{_0x4377bd['CloudProviderId']=null;}if(!_0x399460[_0x8981('0x3d')])_0x399460['CloudProviderId']=null;_0xd5e716[_0x8981('0x64')][_0x8981('0x44')]=_0x399460;_0xd5e716[_0x8981('0x64')][_0x8981('0x45')]=_0x4377bd;return db['MailAccount'][_0x8981('0x63')]({'where':{'id':_0xd5e716[_0x8981('0x62')]['id']},'include':[{'model':db[_0x8981('0x47')],'as':_0x8981('0x44')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8981('0x48')],'as':_0x8981('0x49')}]})[_0x8981('0x12')](handleEntityNotFound(_0x2c8c7b,null))[_0x8981('0x12')](function(_0x5c60bc){if(!_0x5c60bc)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5c60bc[_0x8981('0x42')])delete _0xd5e716['body'][_0x8981('0x44')];return _0x5c60bc;})[_0x8981('0x12')](saveUpdates(_0xd5e716[_0x8981('0x64')],null))['then'](function(_0x2517ee){if(!_0xd5e716[_0x8981('0x64')][_0x8981('0x44')])return _0x2517ee;return db['MailServerIn'][_0x8981('0x27')](_0xd5e716[_0x8981('0x64')][_0x8981('0x44')],{'where':{'MailAccountId':_0x2517ee['id']}})[_0x8981('0x12')](function(){return _0x2517ee;});})['then'](function(_0x334ab0){if(!_0xd5e716[_0x8981('0x64')][_0x8981('0x45')])return _0x334ab0;return db[_0x8981('0x67')][_0x8981('0x27')](_0xd5e716[_0x8981('0x64')][_0x8981('0x45')],{'where':{'MailAccountId':_0x334ab0['id']}})[_0x8981('0x12')](function(){return _0x334ab0;});})[_0x8981('0x12')](respondWithResult(_0x2c8c7b,null))[_0x8981('0x1d')](handleError(_0x2c8c7b,null));};exports['describe']=function(_0x183f6e,_0x46eb80){return db[_0x8981('0x4b')][_0x8981('0x68')]()[_0x8981('0x12')](respondWithResult(_0x46eb80,null))['catch'](handleError(_0x46eb80,null));};exports[_0x8981('0x69')]=function(_0xf2cbfa,_0x1c305f){if(_0xf2cbfa['body']['id']){delete _0xf2cbfa[_0x8981('0x64')]['id'];}return db[_0x8981('0x4b')]['find']({'where':{'id':_0xf2cbfa[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x1c305f,null))[_0x8981('0x12')](function(_0x15db4a){if(_0x15db4a){_0xf2cbfa[_0x8981('0x64')][_0x8981('0x6a')]=_0x15db4a['id'];return db['Disposition']['create'](_0xf2cbfa[_0x8981('0x64')]);}})[_0x8981('0x12')](respondWithResult(_0x1c305f,null))[_0x8981('0x1d')](handleError(_0x1c305f,null));};exports[_0x8981('0x6b')]=function(_0x427710,_0xe7b659){var _0x19e432={'raw':![],'where':{}};var _0x427cea={};var _0xc6eb62={'count':0x0,'rows':[]};return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x427710[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0xe7b659,null))[_0x8981('0x12')](function(_0x10cdfb){if(_0x10cdfb){_0x427cea[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x6d')][_0x8981('0x4c')]);_0x427cea['query']=_[_0x8981('0x51')](_0x427710[_0x8981('0x50')]);_0x427cea[_0x8981('0x52')]=_['intersection'](_0x427cea[_0x8981('0x4f')],_0x427cea[_0x8981('0x50')]);_0x19e432[_0x8981('0x55')]=_[_0x8981('0x53')](_0x427cea[_0x8981('0x4f')],qs[_0x8981('0x54')](_0x427710[_0x8981('0x50')]['fields']));_0x19e432[_0x8981('0x55')]=_0x19e432[_0x8981('0x55')]['length']?_0x19e432[_0x8981('0x55')]:_0x427cea[_0x8981('0x4f')];if(!_0x427710[_0x8981('0x50')]['hasOwnProperty']('nolimit')){_0x19e432[_0x8981('0x22')]=qs[_0x8981('0x22')](_0x427710[_0x8981('0x50')]['limit']);_0x19e432[_0x8981('0x24')]=qs[_0x8981('0x24')](_0x427710[_0x8981('0x50')][_0x8981('0x24')]);}_0x19e432['order']=qs['sort'](_0x427710['query'][_0x8981('0x5a')]);_0x19e432[_0x8981('0x5c')]=qs[_0x8981('0x52')](_[_0x8981('0x6e')](_0x427710[_0x8981('0x50')],_0x427cea[_0x8981('0x52')]));_0x19e432[_0x8981('0x5c')][_0x8981('0x6a')]=_0x10cdfb['id'];if(_0x427710[_0x8981('0x50')][_0x8981('0x5b')]){_0x19e432['where']=_[_0x8981('0x5d')](_0x19e432['where'],{'$or':_[_0x8981('0x4a')](_0x19e432[_0x8981('0x55')],function(_0x11fb1e){var _0x5ea7aa={};_0x5ea7aa[_0x11fb1e]={'$like':'%'+_0x427710[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x5ea7aa;})});}_0x19e432=_[_0x8981('0x5d')]({},_0x19e432,_0x427710[_0x8981('0x5f')]);return db[_0x8981('0x6d')][_0x8981('0x23')]({'where':_0x19e432[_0x8981('0x5c')]})[_0x8981('0x12')](function(_0x3d6fd8){_0xc6eb62[_0x8981('0x23')]=_0x3d6fd8;if(_0x427710[_0x8981('0x50')][_0x8981('0x6f')]){_0x19e432[_0x8981('0x60')]=[{'all':!![]}];}return db[_0x8981('0x6d')]['findAll'](_0x19e432);})['then'](function(_0x1e7dd3){_0xc6eb62[_0x8981('0x70')]=_0x1e7dd3;return _0xc6eb62;});}})[_0x8981('0x12')](respondWithFilteredResult(_0xe7b659,_0x19e432))['catch'](handleError(_0xe7b659,null));};exports[_0x8981('0x71')]=function(_0x5223a2,_0x3131ca){return db['MailAccount']['find']({'where':{'id':_0x5223a2[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x3131ca,null))['then'](function(_0x81158e){if(_0x81158e){return _0x81158e[_0x8981('0x71')](_0x5223a2[_0x8981('0x50')][_0x8981('0x72')]);}})[_0x8981('0x12')](respondWithStatusCode(_0x3131ca,null))[_0x8981('0x1d')](handleError(_0x3131ca,null));};exports[_0x8981('0x73')]=function(_0x1af056,_0x41248d){if(_0x1af056[_0x8981('0x64')]['id']){delete _0x1af056[_0x8981('0x64')]['id'];}return db[_0x8981('0x4b')][_0x8981('0x63')]({'where':{'id':_0x1af056['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x41248d,null))[_0x8981('0x12')](function(_0x3b87b0){if(_0x3b87b0){_0x1af056[_0x8981('0x64')][_0x8981('0x6a')]=_0x3b87b0['id'];return db[_0x8981('0x74')][_0x8981('0x75')](_0x1af056[_0x8981('0x64')]);}})[_0x8981('0x12')](respondWithResult(_0x41248d,null))['catch'](handleError(_0x41248d,null));};exports['getAnswers']=function(_0x24a3fd,_0x99d0bd){var _0x683508={'raw':![],'where':{}};var _0x385a9f={};var _0x1ac358={'count':0x0,'rows':[]};return db['MailAccount'][_0x8981('0x6c')]({'where':{'id':_0x24a3fd[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x99d0bd,null))[_0x8981('0x12')](function(_0xa49cb9){if(_0xa49cb9){_0x385a9f[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x74')]['rawAttributes']);_0x385a9f[_0x8981('0x50')]=_[_0x8981('0x51')](_0x24a3fd[_0x8981('0x50')]);_0x385a9f[_0x8981('0x52')]=_[_0x8981('0x53')](_0x385a9f['model'],_0x385a9f[_0x8981('0x50')]);_0x683508[_0x8981('0x55')]=_['intersection'](_0x385a9f[_0x8981('0x4f')],qs[_0x8981('0x54')](_0x24a3fd[_0x8981('0x50')][_0x8981('0x54')]));_0x683508[_0x8981('0x55')]=_0x683508[_0x8981('0x55')]['length']?_0x683508[_0x8981('0x55')]:_0x385a9f['model'];if(!_0x24a3fd[_0x8981('0x50')]['hasOwnProperty'](_0x8981('0x58'))){_0x683508[_0x8981('0x22')]=qs['limit'](_0x24a3fd[_0x8981('0x50')][_0x8981('0x22')]);_0x683508[_0x8981('0x24')]=qs['offset'](_0x24a3fd[_0x8981('0x50')][_0x8981('0x24')]);}_0x683508[_0x8981('0x59')]=qs[_0x8981('0x5a')](_0x24a3fd[_0x8981('0x50')][_0x8981('0x5a')]);_0x683508['where']=qs[_0x8981('0x52')](_['pick'](_0x24a3fd[_0x8981('0x50')],_0x385a9f['filters']));_0x683508[_0x8981('0x5c')][_0x8981('0x6a')]=_0xa49cb9['id'];if(_0x24a3fd[_0x8981('0x50')][_0x8981('0x5b')]){_0x683508[_0x8981('0x5c')]=_[_0x8981('0x5d')](_0x683508['where'],{'$or':_[_0x8981('0x4a')](_0x683508[_0x8981('0x55')],function(_0x1eda65){var _0x5f2d24={};_0x5f2d24[_0x1eda65]={'$like':'%'+_0x24a3fd[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x5f2d24;})});}_0x683508=_['merge']({},_0x683508,_0x24a3fd[_0x8981('0x5f')]);return db[_0x8981('0x74')][_0x8981('0x23')]({'where':_0x683508[_0x8981('0x5c')]})[_0x8981('0x12')](function(_0x1a43a3){_0x1ac358['count']=_0x1a43a3;if(_0x24a3fd[_0x8981('0x50')][_0x8981('0x6f')]){_0x683508[_0x8981('0x60')]=[{'all':!![]}];}return db[_0x8981('0x74')][_0x8981('0x61')](_0x683508);})['then'](function(_0x2dbfe0){_0x1ac358[_0x8981('0x70')]=_0x2dbfe0;return _0x1ac358;});}})[_0x8981('0x12')](respondWithFilteredResult(_0x99d0bd,_0x683508))[_0x8981('0x1d')](handleError(_0x99d0bd,null));};exports[_0x8981('0x76')]=function(_0x21ffbb,_0x21d4a3){return db['MailAccount']['find']({'where':{'id':_0x21ffbb['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x21d4a3,null))[_0x8981('0x12')](function(_0x3d90ef){if(_0x3d90ef){return _0x3d90ef[_0x8981('0x76')](_0x21ffbb[_0x8981('0x50')][_0x8981('0x72')]);}})[_0x8981('0x12')](respondWithStatusCode(_0x21d4a3,null))[_0x8981('0x1d')](handleError(_0x21d4a3,null));};exports[_0x8981('0x75')]=function(_0x1c8407,_0x47e480){var _0x206ee3={'name':_0x1c8407[_0x8981('0x64')]['name'],'key':_0x1c8407[_0x8981('0x64')]['key'],'provider':_0x1c8407[_0x8981('0x64')][_0x8981('0x65')]===_0x8981('0x66')?null:_0x1c8407[_0x8981('0x64')]['provider'],'email':_0x1c8407[_0x8981('0x64')]['email'],'ListId':_0x1c8407[_0x8981('0x64')]['ListId'],'active':!_[_0x8981('0x77')](_0x1c8407[_0x8981('0x64')][_0x8981('0x78')])?_0x1c8407[_0x8981('0x64')][_0x8981('0x78')]:!![],'description':_0x1c8407[_0x8981('0x64')]['description']||null};var _0x4f8e4a=getAuthenticationOptions(_0x206ee3[_0x8981('0x65')],_0x1c8407[_0x8981('0x64')]);_0x206ee3[_0x8981('0x44')]=_0x4f8e4a['Imap'];_0x206ee3[_0x8981('0x45')]=_0x4f8e4a[_0x8981('0x45')];return db[_0x8981('0x4b')][_0x8981('0x75')](_0x206ee3,{'include':[{'model':db['MailServerOut'],'as':_0x8981('0x45')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x8981('0x12')](function(_0x2d51e0){var _0x39f60d=_0x1c8407[_0x8981('0x3a')]['get']({'plain':!![]});if(!_0x39f60d)throw new Error(_0x8981('0x79'));if(_0x39f60d[_0x8981('0x7a')]===_0x8981('0x3a')){var _0x248e69=_0x2d51e0[_0x8981('0x7b')]({'plain':!![]});return db[_0x8981('0x7c')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x39f60d[_0x8981('0x7d')]},'raw':!![]})['then'](function(_0xf4f74b){if(_0xf4f74b&&_0xf4f74b[_0x8981('0x7e')]===0x0){return db['UserProfileResource'][_0x8981('0x75')]({'name':_0x248e69[_0x8981('0x2c')],'resourceId':_0x248e69['id'],'type':_0xf4f74b[_0x8981('0x2c')],'sectionId':_0xf4f74b['id']},{})[_0x8981('0x12')](function(){return _0x2d51e0;});}else{return _0x2d51e0;}})[_0x8981('0x1d')](function(_0x1f0726){logger[_0x8981('0x18')](_0x8981('0x7f'),_0x1f0726);throw _0x1f0726;});}return _0x2d51e0;})['then'](respondWithResult(_0x47e480,0xc9))[_0x8981('0x1d')](handleError(_0x47e480,null));};exports[_0x8981('0x80')]=function(_0x23f2a2,_0x302043){return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x23f2a2[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x302043,null))['then'](function(_0x45c060){if(_0x45c060){return _0x45c060[_0x8981('0x80')]();}return null;})['then'](respondWithResult(_0x302043,null))[_0x8981('0x1d')](handleError(_0x302043,null));};exports[_0x8981('0x81')]=function(_0x430963,_0x4f33bd){if(_0x430963[_0x8981('0x64')]['id']){delete _0x430963['body']['id'];}return db[_0x8981('0x4b')][_0x8981('0x63')]({'where':{'id':_0x430963[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x4f33bd,null))[_0x8981('0x12')](function(_0x186525){if(_0x186525){_0x430963[_0x8981('0x64')][_0x8981('0x6a')]=_0x186525['id'];return db['MailServerIn']['create'](_0x430963[_0x8981('0x64')]);}})[_0x8981('0x12')](respondWithResult(_0x4f33bd,null))['catch'](handleError(_0x4f33bd,null));};exports[_0x8981('0x82')]=function(_0xc22b51,_0x40072e){return db[_0x8981('0x4b')]['findOne']({'where':{'id':_0xc22b51[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x40072e,null))['then'](function(_0x14652a){if(_0x14652a){return _0x14652a['setImap'](null);}return null;})[_0x8981('0x12')](respondWithStatusCode(_0x40072e,null))[_0x8981('0x1d')](handleError(_0x40072e,null));};exports[_0x8981('0x83')]=function(_0x34b2fb,_0x35087f){return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x34b2fb[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x35087f,null))[_0x8981('0x12')](function(_0x39a56d){if(_0x39a56d){return _0x39a56d[_0x8981('0x83')]();}return null;})[_0x8981('0x12')](respondWithResult(_0x35087f,null))['catch'](handleError(_0x35087f,null));};exports[_0x8981('0x84')]=function(_0xc71171,_0x58e71f){if(_0xc71171[_0x8981('0x64')]['id']){delete _0xc71171['body']['id'];}return db[_0x8981('0x4b')]['find']({'where':{'id':_0xc71171['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x58e71f,null))['then'](function(_0x1deca9){if(_0x1deca9){_0xc71171['body'][_0x8981('0x6a')]=_0x1deca9['id'];return db[_0x8981('0x67')][_0x8981('0x75')](_0xc71171[_0x8981('0x64')]);}})[_0x8981('0x12')](respondWithResult(_0x58e71f,null))['catch'](handleError(_0x58e71f,null));};exports['removeSmtp']=function(_0x34d855,_0x2eeffe){return db[_0x8981('0x4b')]['findOne']({'where':{'id':_0x34d855['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x2eeffe,null))['then'](function(_0x429d0d){if(_0x429d0d){return _0x429d0d[_0x8981('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x2eeffe,null))['catch'](handleError(_0x2eeffe,null));};exports[_0x8981('0x86')]=function(_0x287faf,_0x4ceb6f){return db[_0x8981('0x87')][_0x8981('0x63')]({'where':{'id':_0x287faf['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x4ceb6f,null))[_0x8981('0x12')](function(_0x3d3b47){if(_0x3d3b47){return _0x3d3b47['addInteraction'](_0x287faf[_0x8981('0x64')][_0x8981('0x72')],_[_0x8981('0x88')](_0x287faf[_0x8981('0x64')],[_0x8981('0x72'),'id'])||{});}})[_0x8981('0x12')](respondWithResult(_0x4ceb6f,null))[_0x8981('0x1d')](handleError(_0x4ceb6f,null));};exports[_0x8981('0x89')]=function(_0xcec084,_0x4d7af7){var _0x593573={'raw':![],'where':{}};var _0x4713be={};var _0x537557={'count':0x0,'rows':[]};return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0xcec084[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x4d7af7,null))['then'](function(_0x3ae953){if(_0x3ae953){_0x4713be[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x87')][_0x8981('0x4c')]);_0x4713be[_0x8981('0x50')]=_[_0x8981('0x51')](_0xcec084['query']);_0x4713be[_0x8981('0x52')]=_[_0x8981('0x53')](_0x4713be[_0x8981('0x4f')],_0x4713be[_0x8981('0x50')]);_0x593573[_0x8981('0x55')]=_['intersection'](_0x4713be[_0x8981('0x4f')],qs[_0x8981('0x54')](_0xcec084[_0x8981('0x50')]['fields']));_0x593573[_0x8981('0x55')]=_0x593573[_0x8981('0x55')][_0x8981('0x56')]?_0x593573[_0x8981('0x55')]:_0x4713be['model'];if(!_0xcec084[_0x8981('0x50')][_0x8981('0x57')]('nolimit')){_0x593573[_0x8981('0x22')]=qs['limit'](_0xcec084[_0x8981('0x50')]['limit']);_0x593573[_0x8981('0x24')]=qs[_0x8981('0x24')](_0xcec084[_0x8981('0x50')][_0x8981('0x24')]);}_0x593573['order']=qs[_0x8981('0x5a')](_0xcec084[_0x8981('0x50')][_0x8981('0x5a')]);_0x593573[_0x8981('0x5c')]=qs['filters'](_[_0x8981('0x6e')](_0xcec084[_0x8981('0x50')],_0x4713be[_0x8981('0x52')]));_0x593573[_0x8981('0x5c')][_0x8981('0x6a')]=_0x3ae953['id'];if(_0xcec084['query'][_0x8981('0x5b')]){_0x593573[_0x8981('0x5c')]=_[_0x8981('0x5d')](_0x593573[_0x8981('0x5c')],{'$or':_[_0x8981('0x4a')](_0x593573[_0x8981('0x55')],function(_0x5afae4){var _0x4ed7a8={};_0x4ed7a8[_0x5afae4]={'$like':'%'+_0xcec084[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x4ed7a8;})});}_0x593573=_[_0x8981('0x5d')]({},_0x593573,_0xcec084[_0x8981('0x5f')]);return db['MailInteraction'][_0x8981('0x23')]({'where':_0x593573['where']})[_0x8981('0x12')](function(_0x3c1923){_0x537557[_0x8981('0x23')]=_0x3c1923;if(_0xcec084[_0x8981('0x50')][_0x8981('0x6f')]){_0x593573[_0x8981('0x60')]=[{'model':db[_0x8981('0x8a')],'as':_0x8981('0x8b'),'required':![]},{'model':db[_0x8981('0x8c')],'as':'Owner','attributes':['name',_0x8981('0x8d'),'internal'],'required':![]},{'model':db[_0x8981('0x8e')],'as':_0x8981('0x8f'),'attributes':['id','name',_0x8981('0x90')],'where':_0xcec084[_0x8981('0x50')]['tag']?{'id':_0xcec084[_0x8981('0x50')][_0x8981('0x91')]}:undefined,'required':_0xcec084['query']['tag']?!![]:![]}];}return db['MailInteraction']['findAll'](_0x593573);})[_0x8981('0x12')](function(_0x5dbaa7){_0x537557[_0x8981('0x70')]=_0x5dbaa7;return _0x537557;});}})[_0x8981('0x12')](respondWithFilteredResult(_0x4d7af7,_0x593573))['catch'](handleError(_0x4d7af7,null));};exports[_0x8981('0x92')]=function addApplications(_0x5ee6a1,_0x424690){var _0x49a5b8=_0x5ee6a1[_0x8981('0x62')]['id'];var _0x2fd6e4=_0x5ee6a1['body'];var _0x150a39=0xc8;var _0x28cf2d=null;return db[_0x8981('0x93')]['transaction']({'isolationLevel':db[_0x8981('0x93')][_0x8981('0x94')][_0x8981('0x95')][_0x8981('0x96')]},function(_0x19c19c){return db[_0x8981('0x4b')]['findOne']({'where':{'id':_0x49a5b8},'transaction':_0x19c19c})['then'](function(_0x22276c){if(_0x22276c){return db[_0x8981('0x97')]['destroy']({'where':{'MailAccountId':_0x49a5b8},'transaction':_0x19c19c})['then'](function(){var _0x3c96a9=_[_0x8981('0x4a')](_0x2fd6e4,function(_0x4a8a70){_0x4a8a70[_0x8981('0x6a')]=_0x49a5b8;return _0x4a8a70;});return db[_0x8981('0x97')]['bulkCreate'](_0x3c96a9,{'transaction':_0x19c19c});});}else{_0x150a39=0x194;_0x28cf2d=[];}});})[_0x8981('0x12')](function(){if(_0x150a39!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x49a5b8},'order':_0x8981('0x98')})[_0x8981('0x12')](function(_0x4b14aa){_0x28cf2d=_0x4b14aa;});}})['catch'](function(_0x31bbbd){_0x150a39=0x1f4;logger[_0x8981('0x18')](_0x31bbbd[_0x8981('0x2b')]);if(_0x31bbbd[_0x8981('0x2c')]){delete _0x31bbbd[_0x8981('0x2c')];}_0x28cf2d=_0x31bbbd;})['finally'](function(){if(_0x28cf2d===null){_0x424690[_0x8981('0x1e')](_0x150a39);}else{if(_0x150a39===0x1f4){_0x424690['status'](_0x150a39)['send'](_0x28cf2d);}else{_0x424690['status'](_0x150a39)[_0x8981('0x20')](_0x28cf2d);}}});};exports['getApplications']=function(_0x3fb5e0,_0x1731b6){var _0x1e1809={};var _0x1a39d6={};var _0x2ac45b;var _0x2bd780;return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x3fb5e0[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x1731b6,null))[_0x8981('0x12')](function(_0x4b71fa){if(_0x4b71fa){_0x2ac45b=_0x4b71fa;_0x1a39d6[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x97')][_0x8981('0x4c')]);_0x1a39d6[_0x8981('0x50')]=_[_0x8981('0x51')](_0x3fb5e0[_0x8981('0x50')]);_0x1a39d6['filters']=_[_0x8981('0x53')](_0x1a39d6[_0x8981('0x4f')],_0x1a39d6[_0x8981('0x50')]);_0x1e1809[_0x8981('0x55')]=_[_0x8981('0x53')](_0x1a39d6[_0x8981('0x4f')],qs['fields'](_0x3fb5e0['query'][_0x8981('0x54')]));_0x1e1809['attributes']=_0x1e1809[_0x8981('0x55')][_0x8981('0x56')]?_0x1e1809[_0x8981('0x55')]:_0x1a39d6['model'];_0x1e1809[_0x8981('0x59')]=qs[_0x8981('0x5a')](_0x3fb5e0[_0x8981('0x50')]['sort']);_0x1e1809[_0x8981('0x5c')]=qs[_0x8981('0x52')](_['pick'](_0x3fb5e0[_0x8981('0x50')],_0x1a39d6[_0x8981('0x52')]));if(_0x3fb5e0['query'][_0x8981('0x5b')]){_0x1e1809[_0x8981('0x5c')]=_[_0x8981('0x5d')](_0x1e1809['where'],{'$or':_['map'](_0x1e1809[_0x8981('0x55')],function(_0x17b04c){var _0x4362f6={};_0x4362f6[_0x17b04c]={'$like':'%'+_0x3fb5e0[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x4362f6;})});}_0x1e1809=_[_0x8981('0x5d')]({},_0x1e1809,_0x3fb5e0[_0x8981('0x5f')]);return _0x2ac45b[_0x8981('0x99')](_0x1e1809);}})[_0x8981('0x12')](function(_0x4313b5){if(_0x4313b5){_0x2bd780=_0x4313b5['length'];if(!_0x3fb5e0['query']['hasOwnProperty'](_0x8981('0x58'))){_0x1e1809[_0x8981('0x22')]=qs[_0x8981('0x22')](_0x3fb5e0[_0x8981('0x50')][_0x8981('0x22')]);_0x1e1809[_0x8981('0x24')]=qs['offset'](_0x3fb5e0[_0x8981('0x50')][_0x8981('0x24')]);}return _0x2ac45b['getApplications'](_0x1e1809);}})[_0x8981('0x12')](function(_0x2bd1f6){if(_0x2bd1f6){return _0x2bd1f6?{'count':_0x2bd780,'rows':_0x2bd1f6}:null;}})['then'](respondWithResult(_0x1731b6,null))['catch'](handleError(_0x1731b6,null));};exports[_0x8981('0x9a')]=function(_0x593f77,_0x1e2330){var _0x533d3d={'raw':!![],'where':{}};var _0x179cf8={};var _0x37a020={'count':0x0,'rows':[]};return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x593f77[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x1e2330,null))['then'](function(_0x3cf2ad){if(_0x3cf2ad){_0x179cf8[_0x8981('0x4f')]=_[_0x8981('0x51')](db[_0x8981('0x9b')]['rawAttributes']);_0x179cf8['query']=_[_0x8981('0x51')](_0x593f77[_0x8981('0x50')]);_0x179cf8['filters']=_[_0x8981('0x53')](_0x179cf8[_0x8981('0x4f')],_0x179cf8[_0x8981('0x50')]);_0x533d3d['attributes']=_['intersection'](_0x179cf8['model'],qs[_0x8981('0x54')](_0x593f77[_0x8981('0x50')][_0x8981('0x54')]));_0x533d3d[_0x8981('0x55')]=_0x533d3d['attributes'][_0x8981('0x56')]?_0x533d3d[_0x8981('0x55')]:_0x179cf8['model'];if(!_0x593f77['query'][_0x8981('0x57')](_0x8981('0x58'))){_0x533d3d[_0x8981('0x22')]=qs[_0x8981('0x22')](_0x593f77[_0x8981('0x50')]['limit']);_0x533d3d[_0x8981('0x24')]=qs[_0x8981('0x24')](_0x593f77[_0x8981('0x50')]['offset']);}_0x533d3d[_0x8981('0x59')]=qs[_0x8981('0x5a')](_0x593f77[_0x8981('0x50')]['sort']);_0x533d3d[_0x8981('0x5c')]=qs[_0x8981('0x52')](_[_0x8981('0x6e')](_0x593f77[_0x8981('0x50')],_0x179cf8['filters']));_0x533d3d['where'][_0x8981('0x6a')]=_0x3cf2ad['id'];if(_0x593f77[_0x8981('0x50')][_0x8981('0x5b')]){_0x533d3d[_0x8981('0x5c')]=_['merge'](_0x533d3d[_0x8981('0x5c')],{'$or':_[_0x8981('0x4a')](_0x533d3d[_0x8981('0x55')],function(_0x26a386){var _0x1cde40={};_0x1cde40[_0x26a386]={'$like':'%'+_0x593f77[_0x8981('0x50')][_0x8981('0x5b')]+'%'};return _0x1cde40;})});}if(_0x593f77['query'][_0x8981('0x9c')]){var _0x152918=_0x593f77[_0x8981('0x50')]['$gte'][_0x8981('0x9d')](',');var _0x100a4b={};_0x100a4b[_0x152918[0x0]]={'$gte':moment(_0x152918[0x1])['format'](_0x8981('0x9e'))};_0x533d3d[_0x8981('0x5c')]=_['merge'](_0x533d3d['where'],_0x100a4b);}_0x533d3d=_['merge']({},_0x533d3d,_0x593f77[_0x8981('0x5f')]);return db[_0x8981('0x9b')][_0x8981('0x23')]({'where':_0x533d3d[_0x8981('0x5c')]})[_0x8981('0x12')](function(_0x4c70ab){_0x37a020[_0x8981('0x23')]=_0x4c70ab;if(_0x593f77['query'][_0x8981('0x6f')]){_0x533d3d[_0x8981('0x60')]=[{'all':!![]}];}return db[_0x8981('0x9b')][_0x8981('0x61')](_0x533d3d);})[_0x8981('0x12')](function(_0x4a2f39){if(_0x593f77[_0x8981('0x50')]['inlineCss']===_0x8981('0x9f')){for(var _0x24c758=0x0;_0x24c758<_0x4a2f39[_0x8981('0x56')];_0x24c758++){_0x4a2f39[_0x24c758][_0x8981('0x64')]=juice(_0x4a2f39[_0x24c758][_0x8981('0x64')]);}}_0x37a020['rows']=_0x4a2f39;return _0x37a020;});}})[_0x8981('0x12')](respondWithFilteredResult(_0x1e2330,_0x533d3d))['catch'](handleError(_0x1e2330,null));};exports[_0x8981('0x2d')]=function(_0x438935,_0x460282){var _0x2074d4,_0x50daa9={},_0x3e299f;if(_0x438935[_0x8981('0x64')]['to']){_0x3e299f=_0x438935[_0x8981('0x64')]['to'][_0x8981('0x9d')](',')[0x0];}return db[_0x8981('0x4b')]['find']({'where':{'id':_0x438935[_0x8981('0x62')]['id']},'include':[{'model':db[_0x8981('0xa0')],'as':'List','include':[{'model':db[_0x8981('0x8a')],'as':_0x8981('0xa1'),'where':{'email':_0x3e299f},'limit':0x1,'order':[[_0x8981('0xa2'),_0x8981('0xa3')]]}]},{'model':db['MailServerOut'],'as':_0x8981('0x45'),'raw':!![],'include':[{'model':db[_0x8981('0xa4')],'as':'CloudProvider','raw':!![]}]}]})[_0x8981('0x12')](handleEntityNotFound(_0x460282,null))[_0x8981('0x12')](function(_0x5ece02){if(!_0x5ece02)return;_0x2074d4=_0x5ece02;if(!_0x5ece02['Smtp'])throw new Error(_0x8981('0xa5'));if(_['isNil'](_0x438935['body']['from'])){_0x438935[_0x8981('0x64')][_0x8981('0xa6')]=util['format']('%s\x20<%s>',_0x5ece02[_0x8981('0x2c')],_0x5ece02[_0x8981('0xa7')]||_0x5ece02['Smtp'][_0x8981('0x3a')]);}if(_0x438935['body'][_0x8981('0xa8')]&&_0x438935['body']['attachments'][_0x8981('0x56')]){for(var _0x45854b=0x0;_0x45854b<_0x438935[_0x8981('0x64')][_0x8981('0xa8')][_0x8981('0x56')];_0x45854b+=0x1){_0x438935[_0x8981('0x64')][_0x8981('0xa8')][_0x45854b]={'filename':_0x438935['body'][_0x8981('0xa8')][_0x45854b]['name'],'path':path[_0x8981('0xa9')](config[_0x8981('0xaa')],_0x8981('0xab'),_0x438935[_0x8981('0x64')]['attachments'][_0x45854b][_0x8981('0xac')])};}}var _0x513372=_0x5ece02['getSmtpOptions']();return respondWithRpcPromise(_0x8981('0xad'),_0x8981('0xae'),{'account':_0x513372,'message':_0x438935[_0x8981('0x64')]});})[_0x8981('0x12')](function(_0x55a918){if(!_0x55a918)return;_0x50daa9=_0x55a918;if(!_0x2074d4['List'])throw new Error('List\x20not\x20found');if(_0x2074d4[_0x8981('0xaf')][_0x8981('0xa1')][_0x8981('0x56')])return _0x2074d4[_0x8981('0xaf')][_0x8981('0xa1')][0x0];return db[_0x8981('0x8a')][_0x8981('0x75')](_['defaults'](_0x438935[_0x8981('0x64')],{'firstName':_0x438935[_0x8981('0x64')]['to'],'email':_0x438935[_0x8981('0x64')]['to'],'phone':_0x438935[_0x8981('0x64')]['to'],'ListId':_0x2074d4[_0x8981('0xb0')]}));})[_0x8981('0x12')](function(_0x20ca2d){if(!_0x20ca2d)return;var _0x1664b5={'UserId':_0x438935[_0x8981('0x3a')]['id'],'ContactId':_0x20ca2d['id'],'MailAccountId':_0x2074d4['id'],'inReplyTo':_0x50daa9['messageId'],'to':_0x438935[_0x8981('0x64')][_0x8981('0xa6')],'cc':_0x438935[_0x8981('0x64')]['cc'],'subject':_0x438935[_0x8981('0x64')]['subject'],'attach':_0x438935[_0x8981('0x64')][_0x8981('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x8981('0x9e')),'lastMsgDirection':'out','Messages':[_[_0x8981('0x5d')](_0x438935['body'],{'messageId':_0x50daa9[_0x8981('0xb2')],'sentAt':moment()[_0x8981('0xb3')](_0x8981('0x9e')),'read':!![],'MailAccountId':_0x2074d4['id'],'UserId':_0x438935['user']['id'],'ContactId':_0x20ca2d['id']})]};if(_0x438935[_0x8981('0x64')][_0x8981('0xb4')]){_0x1664b5=_['merge'](_0x1664b5,_0x438935['body'][_0x8981('0xb4')]);}return db[_0x8981('0x87')][_0x8981('0x75')](_0x1664b5,{'include':[{'model':db[_0x8981('0x9b')],'as':_0x8981('0xb5')}]});})[_0x8981('0x12')](respondWithResult(_0x460282,null))[_0x8981('0x1d')](handleError(_0x460282,null));};exports[_0x8981('0xb6')]=function(_0x30760f,_0x540832){return db['MailAccount'][_0x8981('0x63')]({'where':{'id':_0x30760f[_0x8981('0x62')]['id']},'include':[{'model':db[_0x8981('0x67')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x8981('0xa4'),'raw':!![]}]}]})[_0x8981('0x12')](handleEntityNotFound(_0x540832,null))[_0x8981('0x12')](function(_0x59df52){if(!_0x59df52[_0x8981('0x45')])return;var _0x34e5df=_0x59df52[_0x8981('0xb7')]();return respondWithRpcPromise(_0x8981('0xb8'),_0x8981('0xb6'),{'account':_0x34e5df});})[_0x8981('0x12')](respondWithResult(_0x540832,null))[_0x8981('0x1d')](handleError(_0x540832,null));};exports[_0x8981('0x28')]=function(_0x616fe1,_0x44ceb9){return db[_0x8981('0x4b')][_0x8981('0x63')]({'where':{'id':_0x616fe1[_0x8981('0x62')]['id']}})['then'](handleEntityNotFound(_0x44ceb9,null))[_0x8981('0x12')](function(_0x212fe5){if(_0x212fe5&&_0x212fe5[_0x8981('0x42')]){throw new db['Sequelize'][(_0x8981('0xb9'))](_0x8981('0xba'));}return _0x212fe5;})['then'](removeEntity(_0x44ceb9,null))[_0x8981('0x1d')](handleError(_0x44ceb9,null));};exports['addAgents']=function(_0x36bf57,_0x20a63a){return db[_0x8981('0x4b')]['find']({'where':{'id':_0x36bf57[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x20a63a,null))[_0x8981('0x12')](function(_0x5895bf){if(_0x5895bf){return _0x5895bf[_0x8981('0xbb')](_0x36bf57[_0x8981('0x64')][_0x8981('0x72')],_[_0x8981('0x88')](_0x36bf57['body'],[_0x8981('0x72'),'id'])||{})[_0x8981('0xbc')](function(_0x424b6e){for(var _0x14a329=0x0;_0x14a329<_0x36bf57[_0x8981('0x64')]['ids'][_0x8981('0x56')];_0x14a329+=0x1){socket[_0x8981('0xbd')]('userMailAccount:save',{'UserId':Number(_0x36bf57['body'][_0x8981('0x72')][_0x14a329]),'MailAccountId':Number(_0x36bf57[_0x8981('0x62')]['id'])});}return _0x424b6e;});}})['then'](respondWithResult(_0x20a63a,null))[_0x8981('0x1d')](handleError(_0x20a63a,null));};exports[_0x8981('0xbe')]=function(_0x17ab38,_0x4d6998){return db[_0x8981('0x4b')][_0x8981('0x63')]({'where':{'id':_0x17ab38['params']['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x4d6998,null))[_0x8981('0x12')](function(_0x5dadd9){if(_0x5dadd9){return _0x5dadd9[_0x8981('0xbe')](_0x17ab38[_0x8981('0x50')][_0x8981('0x72')])[_0x8981('0x12')](function(){if(_['isArray'](_0x17ab38[_0x8981('0x50')]['ids'])){for(var _0xf53df7=0x0;_0xf53df7<_0x17ab38['query'][_0x8981('0x72')]['length'];_0xf53df7+=0x1){socket[_0x8981('0xbd')](_0x8981('0xbf'),{'UserId':Number(_0x17ab38['query'][_0x8981('0x72')][_0xf53df7]),'MailAccountId':Number(_0x17ab38[_0x8981('0x62')]['id'])});}}else{socket[_0x8981('0xbd')](_0x8981('0xbf'),{'UserId':Number(_0x17ab38[_0x8981('0x50')][_0x8981('0x72')]),'MailAccountId':Number(_0x17ab38[_0x8981('0x62')]['id'])});}});}})[_0x8981('0x12')](respondWithStatusCode(_0x4d6998,null))[_0x8981('0x1d')](handleError(_0x4d6998,null));};exports[_0x8981('0xc0')]=function(_0x576a09,_0x540e2b){var _0x39438f={};var _0x37a0d3={};var _0x1f0486;var _0x4470b8;return db[_0x8981('0x4b')][_0x8981('0x6c')]({'where':{'id':_0x576a09[_0x8981('0x62')]['id']}})[_0x8981('0x12')](handleEntityNotFound(_0x540e2b,null))[_0x8981('0x12')](function(_0x49ba6d){if(_0x49ba6d){_0x1f0486=_0x49ba6d;_0x37a0d3[_0x8981('0x4f')]=_[_0x8981('0x51')](db['User'][_0x8981('0x4c')]);_0x37a0d3[_0x8981('0x50')]=_[_0x8981('0x51')](_0x576a09[_0x8981('0x50')]);_0x37a0d3['filters']=_[_0x8981('0x53')](_0x37a0d3[_0x8981('0x4f')],_0x37a0d3[_0x8981('0x50')]);_0x39438f[_0x8981('0x55')]=_['intersection'](_0x37a0d3[_0x8981('0x4f')],qs[_0x8981('0x54')](_0x576a09['query']['fields']));_0x39438f[_0x8981('0x55')]=_0x39438f['attributes'][_0x8981('0x56')]?_0x39438f['attributes']:_0x37a0d3[_0x8981('0x4f')];_0x39438f[_0x8981('0x59')]=qs[_0x8981('0x5a')](_0x576a09[_0x8981('0x50')][_0x8981('0x5a')]);_0x39438f['where']=qs[_0x8981('0x52')](_['pick'](_0x576a09[_0x8981('0x50')],_0x37a0d3[_0x8981('0x52')]));if(_0x576a09[_0x8981('0x50')][_0x8981('0x5b')]){_0x39438f[_0x8981('0x5c')]=_['merge'](_0x39438f[_0x8981('0x5c')],{'$or':_[_0x8981('0x4a')](_0x39438f['attributes'],function(_0x30e866){var _0x41c31e={};_0x41c31e[_0x30e866]={'$like':'%'+_0x576a09['query'][_0x8981('0x5b')]+'%'};return _0x41c31e;})});}_0x39438f=_[_0x8981('0x5d')]({},_0x39438f,_0x576a09['options']);return _0x1f0486['getAgents'](_0x39438f);}})[_0x8981('0x12')](function(_0x32bf49){if(_0x32bf49){_0x4470b8=_0x32bf49[_0x8981('0x56')];if(!_0x576a09[_0x8981('0x50')]['hasOwnProperty'](_0x8981('0x58'))){_0x39438f[_0x8981('0x22')]=qs['limit'](_0x576a09[_0x8981('0x50')][_0x8981('0x22')]);_0x39438f[_0x8981('0x24')]=qs[_0x8981('0x24')](_0x576a09[_0x8981('0x50')]['offset']);}return _0x1f0486[_0x8981('0xc0')](_0x39438f);}})['then'](function(_0x30b7ab){if(_0x30b7ab){return _0x30b7ab?{'count':_0x4470b8,'rows':_0x30b7ab}:null;}})[_0x8981('0x12')](respondWithResult(_0x540e2b,null))[_0x8981('0x1d')](handleError(_0x540e2b,null));}; \ No newline at end of file +var _0x37e5=['find','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','CmList','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','List','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','get','MailAccounts','UserProfileResource','destroy','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','secure','service','authentication','port','Imap','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','MailServerIn','MailServerOut','keys','intersection','length','include','update','body','provider','custom'];(function(_0x4383e9,_0xa4b307){var _0x355405=function(_0x545b5b){while(--_0x545b5b){_0x4383e9['push'](_0x4383e9['shift']());}};_0x355405(++_0xa4b307);}(_0x37e5,0x124));var _0x537e=function(_0x4bfedd,_0xddfbf8){_0x4bfedd=_0x4bfedd-0x0;var _0x2e925c=_0x37e5[_0x4bfedd];return _0x2e925c;};'use strict';var moment=require(_0x537e('0x0'));var BPromise=require(_0x537e('0x1'));var util=require(_0x537e('0x2'));var path=require(_0x537e('0x3'));var _=require(_0x537e('0x4'));var juice=require(_0x537e('0x5'));var Redis=require('ioredis');var qs=require(_0x537e('0x6'));var logger=require('../../config/logger')(_0x537e('0x7'));var config=require(_0x537e('0x8'));var db=require(_0x537e('0x9'))['db'];config[_0x537e('0xa')]=_['defaults'](config[_0x537e('0xa')],{'host':_0x537e('0xb'),'port':0x18eb});var socket=require(_0x537e('0xc'))(new Redis(config[_0x537e('0xa')]));require(_0x537e('0xd'))[_0x537e('0xe')](socket);var jayson=require(_0x537e('0xf'));var client=jayson[_0x537e('0x10')][_0x537e('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x441852,_0x2d0a02,_0x146429,_0x443ea4){return new BPromise(function(_0x3c8591,_0x2be06c){var _0x345fc0=_0x443ea4||client;return _0x345fc0[_0x537e('0x12')](_0x441852,_0x146429)[_0x537e('0x13')](function(_0x56074a){logger[_0x537e('0x14')]('MailAccount,\x20%s,\x20%s',_0x2d0a02,_0x537e('0x15'));logger[_0x537e('0x16')](_0x537e('0x17'),_0x2d0a02,_0x537e('0x15'),JSON[_0x537e('0x18')](_0x56074a));if(_0x56074a[_0x537e('0x19')]){if(_0x56074a[_0x537e('0x19')][_0x537e('0x1a')]===0x1f4){logger[_0x537e('0x19')](_0x537e('0x1b'),_0x2d0a02,_0x56074a[_0x537e('0x19')][_0x537e('0x1c')]);return _0x2be06c(_0x56074a[_0x537e('0x19')][_0x537e('0x1c')]);}logger[_0x537e('0x19')](_0x537e('0x1b'),_0x2d0a02,_0x56074a[_0x537e('0x19')][_0x537e('0x1c')]);return _0x3c8591(_0x56074a[_0x537e('0x19')][_0x537e('0x1c')]);}else{logger[_0x537e('0x14')](_0x537e('0x1b'),_0x2d0a02,_0x537e('0x15'));_0x3c8591(_0x56074a[_0x537e('0x1d')][_0x537e('0x1c')]);}})['catch'](function(_0xd49137){logger[_0x537e('0x19')]('MailAccount,\x20%s,\x20%s',_0x2d0a02,_0xd49137);_0x2be06c(_0xd49137);});});}function respondWithStatusCode(_0x9e561f,_0x2d5513){_0x2d5513=_0x2d5513||0xcc;return function(_0x3fe5be){if(_0x3fe5be){return _0x9e561f[_0x537e('0x1e')](_0x2d5513);}return _0x9e561f['status'](_0x2d5513)['end']();};}function respondWithResult(_0x5e2d40,_0x233b51){_0x233b51=_0x233b51||0xc8;return function(_0x3085f7){if(_0x3085f7){return _0x5e2d40[_0x537e('0x1f')](_0x233b51)['json'](_0x3085f7);}};}function respondWithFilteredResult(_0x93a7a9,_0x5d0410){return function(_0x3f9a9b){if(_0x3f9a9b){var _0x387c3f=typeof _0x5d0410[_0x537e('0x20')]===_0x537e('0x21')&&typeof _0x5d0410[_0x537e('0x22')]===_0x537e('0x21');var _0x186d1d=_0x3f9a9b[_0x537e('0x23')];var _0x42a888=_0x387c3f?0x0:_0x5d0410[_0x537e('0x20')];var _0x2bd745=_0x387c3f?_0x3f9a9b['count']:_0x5d0410[_0x537e('0x20')]+_0x5d0410[_0x537e('0x22')];var _0x315893;if(_0x2bd745>=_0x186d1d){_0x2bd745=_0x186d1d;_0x315893=0xc8;}else{_0x315893=0xce;}_0x93a7a9[_0x537e('0x1f')](_0x315893);return _0x93a7a9[_0x537e('0x24')](_0x537e('0x25'),_0x42a888+'-'+_0x2bd745+'/'+_0x186d1d)[_0x537e('0x26')](_0x3f9a9b);}return null;};}function saveUpdates(_0x38d119){return function(_0x4c77af){if(_0x4c77af){return _0x4c77af['update'](_0x38d119)[_0x537e('0x13')](function(_0x5a3961){return _0x5a3961;});}return null;};}function removeEntity(_0xabab59){return function(_0x2299f1){if(_0x2299f1){return _0x2299f1['destroy']()['then'](function(){var _0x22c5a5=_0x2299f1[_0x537e('0x27')]({'plain':!![]});var _0x3e7894=_0x537e('0x28');return db[_0x537e('0x29')][_0x537e('0x2a')]({'where':{'type':_0x3e7894,'resourceId':_0x22c5a5['id']}})[_0x537e('0x13')](function(){return _0x2299f1;});})[_0x537e('0x13')](function(){_0xabab59['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e2c1){return function(_0xf812c8){if(!_0xf812c8){_0x26e2c1[_0x537e('0x1e')](0x194);}return _0xf812c8;};}function handleError(_0x3aea3b,_0x30d8ce){_0x30d8ce=_0x30d8ce||0x1f4;return function(_0x2ef933){logger[_0x537e('0x19')](_0x2ef933[_0x537e('0x2b')]);if(_0x2ef933[_0x537e('0x2c')]){delete _0x2ef933[_0x537e('0x2c')];}_0x3aea3b[_0x537e('0x1f')](_0x30d8ce)[_0x537e('0x2d')](_0x2ef933);};}function getImapHost(_0x46d50b){switch(_0x46d50b){case _0x537e('0x2e'):return _0x537e('0x2f');case _0x537e('0x30'):return _0x537e('0x31');case _0x537e('0x32'):return _0x537e('0x33');case'outlook365':return _0x537e('0x34');}throw new Error(_0x537e('0x35'),_0x46d50b);}function getSmtpHost(_0x4fe838){switch(_0x4fe838){case'gmail':return'smtp.gmail.com';case _0x537e('0x30'):return _0x537e('0x36');case _0x537e('0x32'):return _0x537e('0x37');case _0x537e('0x38'):return _0x537e('0x39');}throw new Error(_0x537e('0x35'),_0x4fe838);}function getAuthenticationOptions(_0xa3c821,_0x4474ae){var _0x4f281f={};var _0x1838dd={};if(_0xa3c821){_0x4f281f[_0x537e('0x3a')]=_0x1838dd[_0x537e('0x3a')]=_0x4474ae[_0x537e('0x3b')];_0x4f281f[_0x537e('0x3c')]=_0x1838dd['pass']=_0x4474ae['password'];if(_0x4474ae[_0x537e('0x3d')]){_0x4f281f[_0x537e('0x3d')]=_0x1838dd['modernAuthentication']=!![];_0x4f281f['CloudProviderId']=_0x1838dd['CloudProviderId']=_0x4474ae[_0x537e('0x3e')];_0x4f281f[_0x537e('0x3c')]=_0x1838dd[_0x537e('0x3f')]=null;}else{_0x4f281f[_0x537e('0x3e')]=_0x1838dd[_0x537e('0x3e')]=null;}_0x4f281f[_0x537e('0x40')]=getImapHost(_0xa3c821);_0x4f281f['port']=0x3e1;_0x1838dd[_0x537e('0x40')]=getSmtpHost(_0xa3c821);_0x1838dd['port']=0x24b;_0x1838dd[_0x537e('0x41')]=![];_0x4f281f[_0x537e('0x42')]=_0x1838dd[_0x537e('0x42')]=null;}else{if(_0x4474ae[_0x537e('0x43')]){_0x4f281f['user']=_0x1838dd['user']=_0x4474ae[_0x537e('0x3b')];_0x4f281f['password']=_0x1838dd[_0x537e('0x3f')]=_0x4474ae[_0x537e('0x3c')];}else{_0x4f281f[_0x537e('0x43')]=_0x1838dd[_0x537e('0x43')]=![];_0x4f281f[_0x537e('0x3a')]=_0x1838dd['user']=null;_0x4f281f[_0x537e('0x3c')]=_0x1838dd[_0x537e('0x3f')]=null;}_0x4f281f[_0x537e('0x40')]=_0x4474ae['Imap']['host'];_0x4f281f[_0x537e('0x44')]=_0x4474ae[_0x537e('0x45')][_0x537e('0x44')];_0x1838dd[_0x537e('0x40')]=_0x4474ae[_0x537e('0x46')]['host'];_0x1838dd[_0x537e('0x44')]=_0x4474ae['Smtp']['port'];}return{'Imap':_0x4f281f,'Smtp':_0x1838dd};}exports['index']=function(_0x32c059,_0xe64c0c){var _0x5ea469={'include':[{'model':db['MailServerIn'],'as':_0x537e('0x45')},{'model':db['MailServerOut'],'as':_0x537e('0x46')},{'model':db[_0x537e('0x47')],'as':_0x537e('0x48')}]},_0x47a0d5={},_0x53120d={'count':0x0,'rows':[]};var _0x78b228=_[_0x537e('0x49')](db[_0x537e('0x4a')][_0x537e('0x4b')],function(_0x3f98fd){return{'name':_0x3f98fd[_0x537e('0x4c')],'type':_0x3f98fd[_0x537e('0x4d')][_0x537e('0x4e')]};});_0x47a0d5[_0x537e('0x4f')]=_[_0x537e('0x49')](_0x78b228,'name');_0x47a0d5['query']=_['keys'](_0x32c059[_0x537e('0x50')]);_0x47a0d5[_0x537e('0x51')]=_['intersection'](_0x47a0d5['model'],_0x47a0d5[_0x537e('0x50')]);_0x5ea469[_0x537e('0x52')]=_['intersection'](_0x47a0d5[_0x537e('0x4f')],qs[_0x537e('0x53')](_0x32c059[_0x537e('0x50')][_0x537e('0x53')]));_0x5ea469['attributes']=_0x5ea469['attributes']['length']?_0x5ea469[_0x537e('0x52')]:_0x47a0d5['model'];if(!_0x32c059[_0x537e('0x50')]['hasOwnProperty'](_0x537e('0x54'))){_0x5ea469['limit']=qs[_0x537e('0x22')](_0x32c059[_0x537e('0x50')][_0x537e('0x22')]);_0x5ea469['offset']=qs[_0x537e('0x20')](_0x32c059[_0x537e('0x50')]['offset']);}_0x5ea469['order']=qs[_0x537e('0x55')](_0x32c059['query'][_0x537e('0x55')]);_0x5ea469[_0x537e('0x56')]=qs[_0x537e('0x51')](_[_0x537e('0x57')](_0x32c059[_0x537e('0x50')],_0x47a0d5[_0x537e('0x51')]),_0x78b228);if(_0x32c059[_0x537e('0x50')][_0x537e('0x58')]){_0x5ea469['where']=_[_0x537e('0x59')](_0x5ea469[_0x537e('0x56')],{'$or':_['map'](_0x78b228,function(_0x352708){if(_0x352708[_0x537e('0x4d')]!==_0x537e('0x5a')){var _0x544bd9={};_0x544bd9[_0x352708[_0x537e('0x2c')]]={'$like':'%'+_0x32c059[_0x537e('0x50')][_0x537e('0x58')]+'%'};return _0x544bd9;}})});}_0x5ea469=_[_0x537e('0x59')]({},_0x5ea469,_0x32c059[_0x537e('0x5b')]);var _0x4eaa54={'where':_0x5ea469[_0x537e('0x56')]};return db[_0x537e('0x4a')][_0x537e('0x23')](_0x4eaa54)['then'](function(_0x55ef66){_0x53120d[_0x537e('0x23')]=_0x55ef66;if(_0x32c059[_0x537e('0x50')][_0x537e('0x5c')]){_0x5ea469['include']=[{'all':!![]}];}return db[_0x537e('0x4a')][_0x537e('0x5d')](_0x5ea469);})[_0x537e('0x13')](function(_0x3ff869){_0x53120d[_0x537e('0x5e')]=_0x3ff869;return _0x53120d;})['then'](respondWithFilteredResult(_0xe64c0c,_0x5ea469))[_0x537e('0x5f')](handleError(_0xe64c0c,null));};exports[_0x537e('0x60')]=function(_0x3bf884,_0x4686b6){var _0x1f150f={'raw':![],'where':{'id':_0x3bf884[_0x537e('0x61')]['id']},'include':[{'model':db[_0x537e('0x62')],'as':_0x537e('0x45')},{'model':db[_0x537e('0x63')],'as':_0x537e('0x46')},{'model':db[_0x537e('0x47')],'as':_0x537e('0x48')}]},_0x1ffabc={};_0x1ffabc[_0x537e('0x4f')]=_[_0x537e('0x64')](db[_0x537e('0x4a')][_0x537e('0x4b')]);_0x1ffabc['query']=_['keys'](_0x3bf884[_0x537e('0x50')]);_0x1ffabc[_0x537e('0x51')]=_[_0x537e('0x65')](_0x1ffabc[_0x537e('0x4f')],_0x1ffabc[_0x537e('0x50')]);_0x1f150f[_0x537e('0x52')]=_['intersection'](_0x1ffabc[_0x537e('0x4f')],qs['fields'](_0x3bf884[_0x537e('0x50')][_0x537e('0x53')]));_0x1f150f[_0x537e('0x52')]=_0x1f150f['attributes'][_0x537e('0x66')]?_0x1f150f[_0x537e('0x52')]:_0x1ffabc[_0x537e('0x4f')];if(_0x3bf884[_0x537e('0x50')][_0x537e('0x5c')]){_0x1f150f[_0x537e('0x67')]=[{'all':!![]}];}_0x1f150f=_['merge']({},_0x1f150f,_0x3bf884['options']);return db[_0x537e('0x4a')]['find'](_0x1f150f)[_0x537e('0x13')](handleEntityNotFound(_0x4686b6,null))[_0x537e('0x13')](respondWithResult(_0x4686b6,null))[_0x537e('0x5f')](handleError(_0x4686b6,null));};exports[_0x537e('0x68')]=function(_0x141e7e,_0x128fa3){if(_0x141e7e[_0x537e('0x69')]['id']){delete _0x141e7e[_0x537e('0x69')]['id'];}var _0x54b768=_0x141e7e['body'][_0x537e('0x6a')]===_0x537e('0x6b')?null:_0x141e7e['body']['provider'];var _0x34c307=_0x141e7e[_0x537e('0x69')][_0x537e('0x45')]||{};var _0x45013c=_0x141e7e[_0x537e('0x69')][_0x537e('0x46')]||{};if(_0x54b768){_0x34c307[_0x537e('0x40')]=getImapHost(_0x54b768);_0x34c307[_0x537e('0x44')]=0x3e1;_0x45013c['host']=getSmtpHost(_0x54b768);_0x45013c[_0x537e('0x44')]=0x24b;_0x45013c[_0x537e('0x41')]=![];}if(_0x45013c['modernAuthentication']){_0x45013c['secure']=![];}else{_0x45013c[_0x537e('0x3e')]=null;}if(!_0x34c307[_0x537e('0x3d')])_0x34c307[_0x537e('0x3e')]=null;_0x141e7e[_0x537e('0x69')][_0x537e('0x45')]=_0x34c307;_0x141e7e['body']['Smtp']=_0x45013c;return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x141e7e[_0x537e('0x61')]['id']},'include':[{'model':db[_0x537e('0x62')],'as':_0x537e('0x45')},{'model':db[_0x537e('0x63')],'as':_0x537e('0x46')},{'model':db[_0x537e('0x47')],'as':_0x537e('0x48')}]})[_0x537e('0x13')](handleEntityNotFound(_0x128fa3,null))['then'](function(_0x40c7c5){if(!_0x40c7c5)throw new Error(_0x537e('0x6d'));if(_0x40c7c5[_0x537e('0x42')])delete _0x141e7e['body']['Imap'];return _0x40c7c5;})[_0x537e('0x13')](saveUpdates(_0x141e7e[_0x537e('0x69')],null))[_0x537e('0x13')](function(_0xafac52){if(!_0x141e7e[_0x537e('0x69')][_0x537e('0x45')])return _0xafac52;return db[_0x537e('0x62')][_0x537e('0x68')](_0x141e7e['body'][_0x537e('0x45')],{'where':{'MailAccountId':_0xafac52['id']}})['then'](function(){return _0xafac52;});})['then'](function(_0x1fcc00){if(!_0x141e7e[_0x537e('0x69')][_0x537e('0x46')])return _0x1fcc00;return db[_0x537e('0x63')][_0x537e('0x68')](_0x141e7e[_0x537e('0x69')][_0x537e('0x46')],{'where':{'MailAccountId':_0x1fcc00['id']}})['then'](function(){return _0x1fcc00;});})[_0x537e('0x13')](respondWithResult(_0x128fa3,null))[_0x537e('0x5f')](handleError(_0x128fa3,null));};exports[_0x537e('0x6e')]=function(_0x42b7f3,_0x2f9848){return db[_0x537e('0x4a')][_0x537e('0x6e')]()[_0x537e('0x13')](respondWithResult(_0x2f9848,null))['catch'](handleError(_0x2f9848,null));};exports[_0x537e('0x6f')]=function(_0x4ed19c,_0x27603c){if(_0x4ed19c[_0x537e('0x69')]['id']){delete _0x4ed19c['body']['id'];}return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x4ed19c[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x27603c,null))[_0x537e('0x13')](function(_0x5458b8){if(_0x5458b8){_0x4ed19c[_0x537e('0x69')][_0x537e('0x70')]=_0x5458b8['id'];return db[_0x537e('0x71')][_0x537e('0x72')](_0x4ed19c[_0x537e('0x69')]);}})[_0x537e('0x13')](respondWithResult(_0x27603c,null))[_0x537e('0x5f')](handleError(_0x27603c,null));};exports['getDispositions']=function(_0x7ae18d,_0x37b472){var _0x281217={'raw':![],'where':{}};var _0x9d257={};var _0x17ab04={'count':0x0,'rows':[]};return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x7ae18d[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x37b472,null))['then'](function(_0x559419){if(_0x559419){_0x9d257[_0x537e('0x4f')]=_[_0x537e('0x64')](db['Disposition'][_0x537e('0x4b')]);_0x9d257[_0x537e('0x50')]=_['keys'](_0x7ae18d[_0x537e('0x50')]);_0x9d257[_0x537e('0x51')]=_[_0x537e('0x65')](_0x9d257['model'],_0x9d257['query']);_0x281217[_0x537e('0x52')]=_['intersection'](_0x9d257['model'],qs[_0x537e('0x53')](_0x7ae18d[_0x537e('0x50')][_0x537e('0x53')]));_0x281217[_0x537e('0x52')]=_0x281217[_0x537e('0x52')][_0x537e('0x66')]?_0x281217['attributes']:_0x9d257[_0x537e('0x4f')];if(!_0x7ae18d[_0x537e('0x50')][_0x537e('0x74')](_0x537e('0x54'))){_0x281217['limit']=qs[_0x537e('0x22')](_0x7ae18d[_0x537e('0x50')][_0x537e('0x22')]);_0x281217['offset']=qs[_0x537e('0x20')](_0x7ae18d[_0x537e('0x50')][_0x537e('0x20')]);}_0x281217['order']=qs['sort'](_0x7ae18d[_0x537e('0x50')][_0x537e('0x55')]);_0x281217[_0x537e('0x56')]=qs['filters'](_['pick'](_0x7ae18d[_0x537e('0x50')],_0x9d257[_0x537e('0x51')]));_0x281217[_0x537e('0x56')][_0x537e('0x70')]=_0x559419['id'];if(_0x7ae18d[_0x537e('0x50')][_0x537e('0x58')]){_0x281217[_0x537e('0x56')]=_[_0x537e('0x59')](_0x281217[_0x537e('0x56')],{'$or':_[_0x537e('0x49')](_0x281217[_0x537e('0x52')],function(_0x324acd){var _0x362986={};_0x362986[_0x324acd]={'$like':'%'+_0x7ae18d['query'][_0x537e('0x58')]+'%'};return _0x362986;})});}_0x281217=_[_0x537e('0x59')]({},_0x281217,_0x7ae18d['options']);return db['Disposition'][_0x537e('0x23')]({'where':_0x281217[_0x537e('0x56')]})['then'](function(_0x357f1c){_0x17ab04[_0x537e('0x23')]=_0x357f1c;if(_0x7ae18d[_0x537e('0x50')][_0x537e('0x5c')]){_0x281217[_0x537e('0x67')]=[{'all':!![]}];}return db[_0x537e('0x71')][_0x537e('0x5d')](_0x281217);})[_0x537e('0x13')](function(_0x52acae){_0x17ab04[_0x537e('0x5e')]=_0x52acae;return _0x17ab04;});}})[_0x537e('0x13')](respondWithFilteredResult(_0x37b472,_0x281217))['catch'](handleError(_0x37b472,null));};exports[_0x537e('0x75')]=function(_0x57ab41,_0x432314){return db[_0x537e('0x4a')]['find']({'where':{'id':_0x57ab41[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x432314,null))[_0x537e('0x13')](function(_0x465d67){if(_0x465d67){return _0x465d67[_0x537e('0x75')](_0x57ab41[_0x537e('0x50')][_0x537e('0x76')]);}})[_0x537e('0x13')](respondWithStatusCode(_0x432314,null))[_0x537e('0x5f')](handleError(_0x432314,null));};exports['addAnswer']=function(_0x555122,_0x54eb20){if(_0x555122[_0x537e('0x69')]['id']){delete _0x555122['body']['id'];}return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x555122['params']['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x54eb20,null))[_0x537e('0x13')](function(_0x34b41d){if(_0x34b41d){_0x555122['body']['MailAccountId']=_0x34b41d['id'];return db[_0x537e('0x77')]['create'](_0x555122['body']);}})[_0x537e('0x13')](respondWithResult(_0x54eb20,null))[_0x537e('0x5f')](handleError(_0x54eb20,null));};exports[_0x537e('0x78')]=function(_0x403539,_0x282dfc){var _0x41c32b={'raw':![],'where':{}};var _0x8bd6f8={};var _0x100d9b={'count':0x0,'rows':[]};return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x403539[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x282dfc,null))[_0x537e('0x13')](function(_0x4f85dd){if(_0x4f85dd){_0x8bd6f8[_0x537e('0x4f')]=_[_0x537e('0x64')](db[_0x537e('0x77')][_0x537e('0x4b')]);_0x8bd6f8[_0x537e('0x50')]=_['keys'](_0x403539[_0x537e('0x50')]);_0x8bd6f8[_0x537e('0x51')]=_[_0x537e('0x65')](_0x8bd6f8['model'],_0x8bd6f8[_0x537e('0x50')]);_0x41c32b[_0x537e('0x52')]=_[_0x537e('0x65')](_0x8bd6f8[_0x537e('0x4f')],qs[_0x537e('0x53')](_0x403539[_0x537e('0x50')]['fields']));_0x41c32b[_0x537e('0x52')]=_0x41c32b['attributes']['length']?_0x41c32b['attributes']:_0x8bd6f8[_0x537e('0x4f')];if(!_0x403539[_0x537e('0x50')][_0x537e('0x74')]('nolimit')){_0x41c32b[_0x537e('0x22')]=qs[_0x537e('0x22')](_0x403539[_0x537e('0x50')]['limit']);_0x41c32b[_0x537e('0x20')]=qs['offset'](_0x403539[_0x537e('0x50')][_0x537e('0x20')]);}_0x41c32b[_0x537e('0x79')]=qs[_0x537e('0x55')](_0x403539[_0x537e('0x50')]['sort']);_0x41c32b[_0x537e('0x56')]=qs[_0x537e('0x51')](_['pick'](_0x403539[_0x537e('0x50')],_0x8bd6f8[_0x537e('0x51')]));_0x41c32b[_0x537e('0x56')][_0x537e('0x70')]=_0x4f85dd['id'];if(_0x403539[_0x537e('0x50')][_0x537e('0x58')]){_0x41c32b['where']=_['merge'](_0x41c32b[_0x537e('0x56')],{'$or':_['map'](_0x41c32b[_0x537e('0x52')],function(_0x49d19a){var _0x3e89b6={};_0x3e89b6[_0x49d19a]={'$like':'%'+_0x403539[_0x537e('0x50')][_0x537e('0x58')]+'%'};return _0x3e89b6;})});}_0x41c32b=_[_0x537e('0x59')]({},_0x41c32b,_0x403539[_0x537e('0x5b')]);return db[_0x537e('0x77')]['count']({'where':_0x41c32b[_0x537e('0x56')]})[_0x537e('0x13')](function(_0x381395){_0x100d9b[_0x537e('0x23')]=_0x381395;if(_0x403539[_0x537e('0x50')][_0x537e('0x5c')]){_0x41c32b[_0x537e('0x67')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x41c32b);})[_0x537e('0x13')](function(_0x568b20){_0x100d9b['rows']=_0x568b20;return _0x100d9b;});}})[_0x537e('0x13')](respondWithFilteredResult(_0x282dfc,_0x41c32b))['catch'](handleError(_0x282dfc,null));};exports[_0x537e('0x7a')]=function(_0xff44c3,_0x1cf724){return db[_0x537e('0x4a')]['find']({'where':{'id':_0xff44c3['params']['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x1cf724,null))[_0x537e('0x13')](function(_0x35514b){if(_0x35514b){return _0x35514b['removeAnswers'](_0xff44c3[_0x537e('0x50')][_0x537e('0x76')]);}})[_0x537e('0x13')](respondWithStatusCode(_0x1cf724,null))[_0x537e('0x5f')](handleError(_0x1cf724,null));};exports[_0x537e('0x72')]=function(_0x1bfa2b,_0x37fcee){var _0x425331={'name':_0x1bfa2b[_0x537e('0x69')]['name'],'key':_0x1bfa2b['body'][_0x537e('0x4e')],'provider':_0x1bfa2b[_0x537e('0x69')][_0x537e('0x6a')]===_0x537e('0x6b')?null:_0x1bfa2b[_0x537e('0x69')][_0x537e('0x6a')],'email':_0x1bfa2b[_0x537e('0x69')]['email'],'ListId':_0x1bfa2b['body'][_0x537e('0x7b')],'active':!_[_0x537e('0x7c')](_0x1bfa2b[_0x537e('0x69')][_0x537e('0x7d')])?_0x1bfa2b[_0x537e('0x69')][_0x537e('0x7d')]:!![],'description':_0x1bfa2b[_0x537e('0x69')][_0x537e('0x7e')]||null};var _0x17f5d6=getAuthenticationOptions(_0x425331[_0x537e('0x6a')],_0x1bfa2b[_0x537e('0x69')]);_0x425331['Imap']=_0x17f5d6[_0x537e('0x45')];_0x425331[_0x537e('0x46')]=_0x17f5d6[_0x537e('0x46')];return db['MailAccount'][_0x537e('0x72')](_0x425331,{'include':[{'model':db['MailServerOut'],'as':_0x537e('0x46')},{'model':db[_0x537e('0x62')],'as':_0x537e('0x45')}]})[_0x537e('0x13')](function(_0x15d412){var _0x2261fc=_0x1bfa2b[_0x537e('0x3a')][_0x537e('0x27')]({'plain':!![]});if(!_0x2261fc)throw new Error(_0x537e('0x7f'));if(_0x2261fc[_0x537e('0x80')]===_0x537e('0x3a')){var _0x3987db=_0x15d412[_0x537e('0x27')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x537e('0x28'),'userProfileId':_0x2261fc['userProfileId']},'raw':!![]})[_0x537e('0x13')](function(_0x1b17ae){if(_0x1b17ae&&_0x1b17ae[_0x537e('0x81')]===0x0){return db[_0x537e('0x29')][_0x537e('0x72')]({'name':_0x3987db[_0x537e('0x2c')],'resourceId':_0x3987db['id'],'type':_0x1b17ae['name'],'sectionId':_0x1b17ae['id']},{})[_0x537e('0x13')](function(){return _0x15d412;});}else{return _0x15d412;}})['catch'](function(_0x43b118){logger['error'](_0x537e('0x82'),_0x43b118);throw _0x43b118;});}return _0x15d412;})[_0x537e('0x13')](respondWithResult(_0x37fcee,0xc9))[_0x537e('0x5f')](handleError(_0x37fcee,null));};exports[_0x537e('0x83')]=function(_0x1d34c3,_0x3b18db){return db['MailAccount']['findOne']({'where':{'id':_0x1d34c3[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x3b18db,null))[_0x537e('0x13')](function(_0x2d7a3d){if(_0x2d7a3d){return _0x2d7a3d[_0x537e('0x83')]();}return null;})['then'](respondWithResult(_0x3b18db,null))[_0x537e('0x5f')](handleError(_0x3b18db,null));};exports['addImap']=function(_0x479a92,_0x13e14e){if(_0x479a92[_0x537e('0x69')]['id']){delete _0x479a92[_0x537e('0x69')]['id'];}return db[_0x537e('0x4a')]['find']({'where':{'id':_0x479a92[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x13e14e,null))[_0x537e('0x13')](function(_0x3db23d){if(_0x3db23d){_0x479a92['body']['MailAccountId']=_0x3db23d['id'];return db[_0x537e('0x62')][_0x537e('0x72')](_0x479a92[_0x537e('0x69')]);}})[_0x537e('0x13')](respondWithResult(_0x13e14e,null))[_0x537e('0x5f')](handleError(_0x13e14e,null));};exports[_0x537e('0x84')]=function(_0x3b3332,_0xb56140){return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x3b3332[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0xb56140,null))[_0x537e('0x13')](function(_0x10199b){if(_0x10199b){return _0x10199b['setImap'](null);}return null;})[_0x537e('0x13')](respondWithStatusCode(_0xb56140,null))[_0x537e('0x5f')](handleError(_0xb56140,null));};exports[_0x537e('0x85')]=function(_0x2d1234,_0x59f63c){return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x2d1234['params']['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x59f63c,null))[_0x537e('0x13')](function(_0x1b780d){if(_0x1b780d){return _0x1b780d['getSmtp']();}return null;})[_0x537e('0x13')](respondWithResult(_0x59f63c,null))[_0x537e('0x5f')](handleError(_0x59f63c,null));};exports[_0x537e('0x86')]=function(_0xfb6f35,_0x5d2300){if(_0xfb6f35[_0x537e('0x69')]['id']){delete _0xfb6f35[_0x537e('0x69')]['id'];}return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0xfb6f35[_0x537e('0x61')]['id']}})['then'](handleEntityNotFound(_0x5d2300,null))[_0x537e('0x13')](function(_0x58c29b){if(_0x58c29b){_0xfb6f35[_0x537e('0x69')]['MailAccountId']=_0x58c29b['id'];return db['MailServerOut'][_0x537e('0x72')](_0xfb6f35['body']);}})[_0x537e('0x13')](respondWithResult(_0x5d2300,null))[_0x537e('0x5f')](handleError(_0x5d2300,null));};exports['removeSmtp']=function(_0x46f183,_0x4a45b1){return db['MailAccount'][_0x537e('0x73')]({'where':{'id':_0x46f183[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x4a45b1,null))[_0x537e('0x13')](function(_0x54304b){if(_0x54304b){return _0x54304b[_0x537e('0x87')](null);}return null;})[_0x537e('0x13')](respondWithStatusCode(_0x4a45b1,null))[_0x537e('0x5f')](handleError(_0x4a45b1,null));};exports[_0x537e('0x88')]=function(_0xaeea7b,_0x2f8de3){return db[_0x537e('0x89')]['find']({'where':{'id':_0xaeea7b[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x2f8de3,null))[_0x537e('0x13')](function(_0x251a08){if(_0x251a08){return _0x251a08[_0x537e('0x88')](_0xaeea7b[_0x537e('0x69')][_0x537e('0x76')],_['omit'](_0xaeea7b[_0x537e('0x69')],['ids','id'])||{});}})['then'](respondWithResult(_0x2f8de3,null))[_0x537e('0x5f')](handleError(_0x2f8de3,null));};exports[_0x537e('0x8a')]=function(_0x31b8f7,_0x6ac877){var _0x51a7b4={'raw':![],'where':{}};var _0x164a23={};var _0x417fda={'count':0x0,'rows':[]};return db['MailAccount'][_0x537e('0x73')]({'where':{'id':_0x31b8f7[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x6ac877,null))[_0x537e('0x13')](function(_0x158f3d){if(_0x158f3d){_0x164a23[_0x537e('0x4f')]=_[_0x537e('0x64')](db[_0x537e('0x89')][_0x537e('0x4b')]);_0x164a23[_0x537e('0x50')]=_[_0x537e('0x64')](_0x31b8f7[_0x537e('0x50')]);_0x164a23[_0x537e('0x51')]=_[_0x537e('0x65')](_0x164a23[_0x537e('0x4f')],_0x164a23[_0x537e('0x50')]);_0x51a7b4[_0x537e('0x52')]=_[_0x537e('0x65')](_0x164a23[_0x537e('0x4f')],qs[_0x537e('0x53')](_0x31b8f7[_0x537e('0x50')][_0x537e('0x53')]));_0x51a7b4[_0x537e('0x52')]=_0x51a7b4[_0x537e('0x52')][_0x537e('0x66')]?_0x51a7b4[_0x537e('0x52')]:_0x164a23[_0x537e('0x4f')];if(!_0x31b8f7[_0x537e('0x50')][_0x537e('0x74')](_0x537e('0x54'))){_0x51a7b4[_0x537e('0x22')]=qs[_0x537e('0x22')](_0x31b8f7[_0x537e('0x50')][_0x537e('0x22')]);_0x51a7b4[_0x537e('0x20')]=qs[_0x537e('0x20')](_0x31b8f7['query'][_0x537e('0x20')]);}_0x51a7b4[_0x537e('0x79')]=qs['sort'](_0x31b8f7['query']['sort']);_0x51a7b4[_0x537e('0x56')]=qs['filters'](_[_0x537e('0x57')](_0x31b8f7[_0x537e('0x50')],_0x164a23['filters']));_0x51a7b4[_0x537e('0x56')][_0x537e('0x70')]=_0x158f3d['id'];if(_0x31b8f7[_0x537e('0x50')][_0x537e('0x58')]){_0x51a7b4['where']=_[_0x537e('0x59')](_0x51a7b4[_0x537e('0x56')],{'$or':_[_0x537e('0x49')](_0x51a7b4[_0x537e('0x52')],function(_0x53aaa0){var _0x3b37cc={};_0x3b37cc[_0x53aaa0]={'$like':'%'+_0x31b8f7[_0x537e('0x50')]['filter']+'%'};return _0x3b37cc;})});}_0x51a7b4=_['merge']({},_0x51a7b4,_0x31b8f7[_0x537e('0x5b')]);return db[_0x537e('0x89')][_0x537e('0x23')]({'where':_0x51a7b4[_0x537e('0x56')]})[_0x537e('0x13')](function(_0x134d7c){_0x417fda['count']=_0x134d7c;if(_0x31b8f7[_0x537e('0x50')][_0x537e('0x5c')]){_0x51a7b4[_0x537e('0x67')]=[{'model':db['CmContact'],'as':_0x537e('0x8b'),'required':![]},{'model':db[_0x537e('0x8c')],'as':_0x537e('0x8d'),'attributes':[_0x537e('0x2c'),_0x537e('0x8e'),_0x537e('0x8f')],'required':![]},{'model':db[_0x537e('0x90')],'as':'Tags','attributes':['id',_0x537e('0x2c'),'color'],'where':_0x31b8f7[_0x537e('0x50')][_0x537e('0x91')]?{'id':_0x31b8f7['query'][_0x537e('0x91')]}:undefined,'required':_0x31b8f7[_0x537e('0x50')][_0x537e('0x91')]?!![]:![]}];}return db[_0x537e('0x89')][_0x537e('0x5d')](_0x51a7b4);})['then'](function(_0x5cce8f){_0x417fda[_0x537e('0x5e')]=_0x5cce8f;return _0x417fda;});}})[_0x537e('0x13')](respondWithFilteredResult(_0x6ac877,_0x51a7b4))[_0x537e('0x5f')](handleError(_0x6ac877,null));};exports[_0x537e('0x92')]=function addApplications(_0x42fe88,_0x490fc8){var _0x1f9c80=_0x42fe88[_0x537e('0x61')]['id'];var _0x741710=_0x42fe88[_0x537e('0x69')];var _0xdc049a=0xc8;var _0x27b227=null;return db[_0x537e('0x93')][_0x537e('0x94')]({'isolationLevel':db[_0x537e('0x93')][_0x537e('0x95')][_0x537e('0x96')][_0x537e('0x97')]},function(_0x17188e){return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x1f9c80},'transaction':_0x17188e})[_0x537e('0x13')](function(_0x3a1b48){if(_0x3a1b48){return db[_0x537e('0x98')][_0x537e('0x2a')]({'where':{'MailAccountId':_0x1f9c80},'transaction':_0x17188e})[_0x537e('0x13')](function(){var _0x4897b3=_[_0x537e('0x49')](_0x741710,function(_0x4be4b2){_0x4be4b2[_0x537e('0x70')]=_0x1f9c80;return _0x4be4b2;});return db[_0x537e('0x98')][_0x537e('0x99')](_0x4897b3,{'transaction':_0x17188e});});}else{_0xdc049a=0x194;_0x27b227=[];}});})[_0x537e('0x13')](function(){if(_0xdc049a!==0x194){return db[_0x537e('0x98')][_0x537e('0x9a')]({'where':{'MailAccountId':_0x1f9c80},'order':_0x537e('0x9b')})['then'](function(_0x267d3f){_0x27b227=_0x267d3f;});}})[_0x537e('0x5f')](function(_0x4e3480){_0xdc049a=0x1f4;logger[_0x537e('0x19')](_0x4e3480[_0x537e('0x2b')]);if(_0x4e3480[_0x537e('0x2c')]){delete _0x4e3480[_0x537e('0x2c')];}_0x27b227=_0x4e3480;})['finally'](function(){if(_0x27b227===null){_0x490fc8[_0x537e('0x1e')](_0xdc049a);}else{if(_0xdc049a===0x1f4){_0x490fc8[_0x537e('0x1f')](_0xdc049a)[_0x537e('0x2d')](_0x27b227);}else{_0x490fc8['status'](_0xdc049a)['json'](_0x27b227);}}});};exports['getApplications']=function(_0x2c56d4,_0x265153){var _0x506931={};var _0x141403={};var _0x4da0cb;var _0xb7e2b9;return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x2c56d4[_0x537e('0x61')]['id']}})['then'](handleEntityNotFound(_0x265153,null))[_0x537e('0x13')](function(_0x481dbd){if(_0x481dbd){_0x4da0cb=_0x481dbd;_0x141403['model']=_[_0x537e('0x64')](db[_0x537e('0x98')][_0x537e('0x4b')]);_0x141403[_0x537e('0x50')]=_[_0x537e('0x64')](_0x2c56d4[_0x537e('0x50')]);_0x141403[_0x537e('0x51')]=_['intersection'](_0x141403[_0x537e('0x4f')],_0x141403[_0x537e('0x50')]);_0x506931[_0x537e('0x52')]=_[_0x537e('0x65')](_0x141403[_0x537e('0x4f')],qs['fields'](_0x2c56d4[_0x537e('0x50')][_0x537e('0x53')]));_0x506931[_0x537e('0x52')]=_0x506931['attributes']['length']?_0x506931[_0x537e('0x52')]:_0x141403[_0x537e('0x4f')];_0x506931[_0x537e('0x79')]=qs['sort'](_0x2c56d4[_0x537e('0x50')][_0x537e('0x55')]);_0x506931[_0x537e('0x56')]=qs[_0x537e('0x51')](_['pick'](_0x2c56d4[_0x537e('0x50')],_0x141403[_0x537e('0x51')]));if(_0x2c56d4[_0x537e('0x50')][_0x537e('0x58')]){_0x506931[_0x537e('0x56')]=_[_0x537e('0x59')](_0x506931[_0x537e('0x56')],{'$or':_[_0x537e('0x49')](_0x506931['attributes'],function(_0x4c72f3){var _0x54bb81={};_0x54bb81[_0x4c72f3]={'$like':'%'+_0x2c56d4[_0x537e('0x50')]['filter']+'%'};return _0x54bb81;})});}_0x506931=_[_0x537e('0x59')]({},_0x506931,_0x2c56d4[_0x537e('0x5b')]);return _0x4da0cb['getApplications'](_0x506931);}})[_0x537e('0x13')](function(_0x67b9f1){if(_0x67b9f1){_0xb7e2b9=_0x67b9f1['length'];if(!_0x2c56d4[_0x537e('0x50')][_0x537e('0x74')](_0x537e('0x54'))){_0x506931[_0x537e('0x22')]=qs[_0x537e('0x22')](_0x2c56d4[_0x537e('0x50')][_0x537e('0x22')]);_0x506931[_0x537e('0x20')]=qs[_0x537e('0x20')](_0x2c56d4[_0x537e('0x50')][_0x537e('0x20')]);}return _0x4da0cb[_0x537e('0x9c')](_0x506931);}})[_0x537e('0x13')](function(_0x434411){if(_0x434411){return _0x434411?{'count':_0xb7e2b9,'rows':_0x434411}:null;}})['then'](respondWithResult(_0x265153,null))[_0x537e('0x5f')](handleError(_0x265153,null));};exports[_0x537e('0x9d')]=function(_0x1c3385,_0x185a0c){var _0x282051={'raw':!![],'where':{}};var _0x394885={};var _0x4b1f0c={'count':0x0,'rows':[]};return db[_0x537e('0x4a')]['findOne']({'where':{'id':_0x1c3385[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x185a0c,null))[_0x537e('0x13')](function(_0x44b310){if(_0x44b310){_0x394885['model']=_[_0x537e('0x64')](db['MailMessage']['rawAttributes']);_0x394885[_0x537e('0x50')]=_[_0x537e('0x64')](_0x1c3385[_0x537e('0x50')]);_0x394885[_0x537e('0x51')]=_[_0x537e('0x65')](_0x394885[_0x537e('0x4f')],_0x394885[_0x537e('0x50')]);_0x282051[_0x537e('0x52')]=_[_0x537e('0x65')](_0x394885[_0x537e('0x4f')],qs[_0x537e('0x53')](_0x1c3385['query'][_0x537e('0x53')]));_0x282051[_0x537e('0x52')]=_0x282051['attributes'][_0x537e('0x66')]?_0x282051[_0x537e('0x52')]:_0x394885[_0x537e('0x4f')];if(!_0x1c3385[_0x537e('0x50')][_0x537e('0x74')](_0x537e('0x54'))){_0x282051[_0x537e('0x22')]=qs[_0x537e('0x22')](_0x1c3385['query']['limit']);_0x282051[_0x537e('0x20')]=qs[_0x537e('0x20')](_0x1c3385[_0x537e('0x50')]['offset']);}_0x282051[_0x537e('0x79')]=qs[_0x537e('0x55')](_0x1c3385[_0x537e('0x50')][_0x537e('0x55')]);_0x282051['where']=qs[_0x537e('0x51')](_[_0x537e('0x57')](_0x1c3385[_0x537e('0x50')],_0x394885[_0x537e('0x51')]));_0x282051[_0x537e('0x56')][_0x537e('0x70')]=_0x44b310['id'];if(_0x1c3385[_0x537e('0x50')][_0x537e('0x58')]){_0x282051[_0x537e('0x56')]=_[_0x537e('0x59')](_0x282051[_0x537e('0x56')],{'$or':_['map'](_0x282051[_0x537e('0x52')],function(_0xd17718){var _0x5fc59e={};_0x5fc59e[_0xd17718]={'$like':'%'+_0x1c3385[_0x537e('0x50')][_0x537e('0x58')]+'%'};return _0x5fc59e;})});}if(_0x1c3385[_0x537e('0x50')]['$gte']){var _0x296f75=_0x1c3385['query'][_0x537e('0x9e')][_0x537e('0x9f')](',');var _0x5bfad1={};_0x5bfad1[_0x296f75[0x0]]={'$gte':moment(_0x296f75[0x1])[_0x537e('0xa0')](_0x537e('0xa1'))};_0x282051['where']=_['merge'](_0x282051[_0x537e('0x56')],_0x5bfad1);}_0x282051=_[_0x537e('0x59')]({},_0x282051,_0x1c3385[_0x537e('0x5b')]);return db['MailMessage'][_0x537e('0x23')]({'where':_0x282051[_0x537e('0x56')]})[_0x537e('0x13')](function(_0x10f4ec){_0x4b1f0c[_0x537e('0x23')]=_0x10f4ec;if(_0x1c3385[_0x537e('0x50')][_0x537e('0x5c')]){_0x282051[_0x537e('0x67')]=[{'all':!![]}];}return db[_0x537e('0xa2')][_0x537e('0x5d')](_0x282051);})[_0x537e('0x13')](function(_0x32ef7d){if(_0x1c3385[_0x537e('0x50')][_0x537e('0xa3')]==='true'){for(var _0x1d2622=0x0;_0x1d2622<_0x32ef7d['length'];_0x1d2622++){_0x32ef7d[_0x1d2622][_0x537e('0x69')]=juice(_0x32ef7d[_0x1d2622][_0x537e('0x69')]);}}_0x4b1f0c[_0x537e('0x5e')]=_0x32ef7d;return _0x4b1f0c;});}})[_0x537e('0x13')](respondWithFilteredResult(_0x185a0c,_0x282051))['catch'](handleError(_0x185a0c,null));};exports['send']=function(_0x29eabf,_0x3e5263){var _0x4e482a,_0x3e9861={},_0x5db5a1;if(_0x29eabf[_0x537e('0x69')]['to']){_0x5db5a1=_0x29eabf[_0x537e('0x69')]['to'][_0x537e('0x9f')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x29eabf[_0x537e('0x61')]['id']},'include':[{'model':db[_0x537e('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x537e('0xa5'),'where':{'email':_0x5db5a1},'limit':0x1,'order':[[_0x537e('0xa6'),_0x537e('0xa7')]]}]},{'model':db[_0x537e('0x63')],'as':_0x537e('0x46'),'raw':!![],'include':[{'model':db[_0x537e('0xa8')],'as':'CloudProvider','raw':!![]}]}]})[_0x537e('0x13')](handleEntityNotFound(_0x3e5263,null))[_0x537e('0x13')](function(_0x39654d){if(!_0x39654d)return;_0x4e482a=_0x39654d;if(!_0x39654d[_0x537e('0x46')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x537e('0x7c')](_0x29eabf[_0x537e('0x69')][_0x537e('0xa9')])){_0x29eabf[_0x537e('0x69')][_0x537e('0xa9')]=util[_0x537e('0xa0')](_0x537e('0xaa'),_0x39654d[_0x537e('0x2c')],_0x39654d[_0x537e('0xab')]||_0x39654d['Smtp'][_0x537e('0x3a')]);}if(_0x29eabf[_0x537e('0x69')][_0x537e('0xac')]&&_0x29eabf[_0x537e('0x69')][_0x537e('0xac')]['length']){for(var _0x5a25a5=0x0;_0x5a25a5<_0x29eabf['body'][_0x537e('0xac')][_0x537e('0x66')];_0x5a25a5+=0x1){_0x29eabf[_0x537e('0x69')][_0x537e('0xac')][_0x5a25a5]={'filename':_0x29eabf[_0x537e('0x69')]['attachments'][_0x5a25a5][_0x537e('0x2c')],'path':path['join'](config[_0x537e('0xad')],_0x537e('0xae'),_0x29eabf[_0x537e('0x69')]['attachments'][_0x5a25a5][_0x537e('0xaf')])};}}var _0x2b5563=_0x39654d['getSmtpOptions']();return respondWithRpcPromise(_0x537e('0xb0'),_0x537e('0xb1'),{'account':_0x2b5563,'message':_0x29eabf['body']});})[_0x537e('0x13')](function(_0xf40fcd){if(!_0xf40fcd)return;_0x3e9861=_0xf40fcd;if(!_0x4e482a['List'])throw new Error(_0x537e('0xb2'));if(_0x4e482a[_0x537e('0xb3')][_0x537e('0xa5')][_0x537e('0x66')])return _0x4e482a[_0x537e('0xb3')][_0x537e('0xa5')][0x0];return db['CmContact'][_0x537e('0x72')](_[_0x537e('0xb4')](_0x29eabf['body'],{'firstName':_0x29eabf[_0x537e('0x69')]['to'],'email':_0x29eabf['body']['to'],'phone':_0x29eabf[_0x537e('0x69')]['to'],'ListId':_0x4e482a[_0x537e('0x7b')]}));})[_0x537e('0x13')](function(_0x5c9ae9){if(!_0x5c9ae9)return;var _0x1fbe01={'UserId':_0x29eabf[_0x537e('0x3a')]['id'],'ContactId':_0x5c9ae9['id'],'MailAccountId':_0x4e482a['id'],'inReplyTo':_0x3e9861[_0x537e('0xb5')],'to':_0x29eabf[_0x537e('0x69')][_0x537e('0xa9')],'cc':_0x29eabf['body']['cc'],'subject':_0x29eabf[_0x537e('0x69')][_0x537e('0xb6')],'attach':_0x29eabf[_0x537e('0x69')][_0x537e('0xb7')],'firstMsgDirection':_0x537e('0xb8'),'lastMsgAt':moment()['format'](_0x537e('0xa1')),'lastMsgDirection':_0x537e('0xb8'),'Messages':[_[_0x537e('0x59')](_0x29eabf[_0x537e('0x69')],{'messageId':_0x3e9861[_0x537e('0xb5')],'sentAt':moment()['format'](_0x537e('0xa1')),'read':!![],'MailAccountId':_0x4e482a['id'],'UserId':_0x29eabf[_0x537e('0x3a')]['id'],'ContactId':_0x5c9ae9['id']})]};if(_0x29eabf[_0x537e('0x69')][_0x537e('0xb9')]){_0x1fbe01=_[_0x537e('0x59')](_0x1fbe01,_0x29eabf[_0x537e('0x69')][_0x537e('0xb9')]);}return db[_0x537e('0x89')]['create'](_0x1fbe01,{'include':[{'model':db[_0x537e('0xa2')],'as':_0x537e('0xba')}]});})[_0x537e('0x13')](respondWithResult(_0x3e5263,null))[_0x537e('0x5f')](handleError(_0x3e5263,null));};exports[_0x537e('0xbb')]=function(_0x4aae63,_0x4bb47a){return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x4aae63[_0x537e('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x537e('0x46'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0x537e('0x13')](handleEntityNotFound(_0x4bb47a,null))[_0x537e('0x13')](function(_0x459187){if(!_0x459187[_0x537e('0x46')])return;var _0x47429b=_0x459187[_0x537e('0xbc')]();return respondWithRpcPromise(_0x537e('0xbd'),_0x537e('0xbb'),{'account':_0x47429b});})[_0x537e('0x13')](respondWithResult(_0x4bb47a,null))[_0x537e('0x5f')](handleError(_0x4bb47a,null));};exports[_0x537e('0x2a')]=function(_0x168a3f,_0xb42e68){return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x168a3f[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0xb42e68,null))[_0x537e('0x13')](function(_0x23b024){if(_0x23b024&&_0x23b024[_0x537e('0x42')]){throw new db[(_0x537e('0xbe'))][(_0x537e('0xbf'))](_0x537e('0xc0'));}return _0x23b024;})[_0x537e('0x13')](removeEntity(_0xb42e68,null))[_0x537e('0x5f')](handleError(_0xb42e68,null));};exports[_0x537e('0xc1')]=function(_0x1d78ac,_0x5d9158){return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x1d78ac[_0x537e('0x61')]['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x5d9158,null))['then'](function(_0x58da19){if(_0x58da19){return _0x58da19[_0x537e('0xc1')](_0x1d78ac[_0x537e('0x69')]['ids'],_[_0x537e('0xc2')](_0x1d78ac[_0x537e('0x69')],[_0x537e('0x76'),'id'])||{})['spread'](function(_0xf671f0){for(var _0x13797a=0x0;_0x13797a<_0x1d78ac['body'][_0x537e('0x76')]['length'];_0x13797a+=0x1){socket['emit'](_0x537e('0xc3'),{'UserId':Number(_0x1d78ac[_0x537e('0x69')][_0x537e('0x76')][_0x13797a]),'MailAccountId':Number(_0x1d78ac[_0x537e('0x61')]['id'])});}return _0xf671f0;});}})[_0x537e('0x13')](respondWithResult(_0x5d9158,null))[_0x537e('0x5f')](handleError(_0x5d9158,null));};exports[_0x537e('0xc4')]=function(_0x42f313,_0x358942){return db[_0x537e('0x4a')][_0x537e('0x6c')]({'where':{'id':_0x42f313['params']['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x358942,null))[_0x537e('0x13')](function(_0x4c1892){if(_0x4c1892){return _0x4c1892['removeAgents'](_0x42f313[_0x537e('0x50')][_0x537e('0x76')])['then'](function(){if(_['isArray'](_0x42f313[_0x537e('0x50')][_0x537e('0x76')])){for(var _0x13fe9c=0x0;_0x13fe9c<_0x42f313['query'][_0x537e('0x76')][_0x537e('0x66')];_0x13fe9c+=0x1){socket[_0x537e('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x42f313[_0x537e('0x50')][_0x537e('0x76')][_0x13fe9c]),'MailAccountId':Number(_0x42f313[_0x537e('0x61')]['id'])});}}else{socket[_0x537e('0xc5')](_0x537e('0xc6'),{'UserId':Number(_0x42f313['query']['ids']),'MailAccountId':Number(_0x42f313[_0x537e('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x358942,null))['catch'](handleError(_0x358942,null));};exports[_0x537e('0xc7')]=function(_0x146f40,_0x1dbf70){var _0xe195fe={};var _0x89b380={};var _0x246aa7;var _0x4f0a7b;return db[_0x537e('0x4a')][_0x537e('0x73')]({'where':{'id':_0x146f40['params']['id']}})[_0x537e('0x13')](handleEntityNotFound(_0x1dbf70,null))[_0x537e('0x13')](function(_0x354ec0){if(_0x354ec0){_0x246aa7=_0x354ec0;_0x89b380[_0x537e('0x4f')]=_[_0x537e('0x64')](db[_0x537e('0x8c')][_0x537e('0x4b')]);_0x89b380['query']=_[_0x537e('0x64')](_0x146f40['query']);_0x89b380[_0x537e('0x51')]=_['intersection'](_0x89b380['model'],_0x89b380[_0x537e('0x50')]);_0xe195fe[_0x537e('0x52')]=_['intersection'](_0x89b380[_0x537e('0x4f')],qs[_0x537e('0x53')](_0x146f40[_0x537e('0x50')]['fields']));_0xe195fe[_0x537e('0x52')]=_0xe195fe[_0x537e('0x52')][_0x537e('0x66')]?_0xe195fe['attributes']:_0x89b380['model'];_0xe195fe[_0x537e('0x79')]=qs[_0x537e('0x55')](_0x146f40['query'][_0x537e('0x55')]);_0xe195fe[_0x537e('0x56')]=qs[_0x537e('0x51')](_[_0x537e('0x57')](_0x146f40[_0x537e('0x50')],_0x89b380[_0x537e('0x51')]));if(_0x146f40[_0x537e('0x50')][_0x537e('0x58')]){_0xe195fe[_0x537e('0x56')]=_[_0x537e('0x59')](_0xe195fe[_0x537e('0x56')],{'$or':_[_0x537e('0x49')](_0xe195fe['attributes'],function(_0x42f99a){var _0x557461={};_0x557461[_0x42f99a]={'$like':'%'+_0x146f40['query']['filter']+'%'};return _0x557461;})});}_0xe195fe=_[_0x537e('0x59')]({},_0xe195fe,_0x146f40[_0x537e('0x5b')]);return _0x246aa7['getAgents'](_0xe195fe);}})[_0x537e('0x13')](function(_0xbe8b0b){if(_0xbe8b0b){_0x4f0a7b=_0xbe8b0b['length'];if(!_0x146f40[_0x537e('0x50')][_0x537e('0x74')](_0x537e('0x54'))){_0xe195fe[_0x537e('0x22')]=qs[_0x537e('0x22')](_0x146f40['query'][_0x537e('0x22')]);_0xe195fe[_0x537e('0x20')]=qs[_0x537e('0x20')](_0x146f40['query']['offset']);}return _0x246aa7[_0x537e('0xc7')](_0xe195fe);}})[_0x537e('0x13')](function(_0x1e1593){if(_0x1e1593){return _0x1e1593?{'count':_0x4f0a7b,'rows':_0x1e1593}:null;}})['then'](respondWithResult(_0x1dbf70,null))[_0x537e('0x5f')](handleError(_0x1dbf70,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index b0d59b2..49de20f 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 _0x8b30=['exports','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x8b30,0xc1));var _0x08b3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8b30[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x08b3('0x0'));var MailAccount=require(_0x08b3('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x08b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1fd558){return function(_0x124b24,_0x1ec9ca,_0x1aa4f8){MailAccountEvents[_0x08b3('0x3')](_0x1fd558+':'+_0x124b24['id'],_0x124b24);MailAccountEvents['emit'](_0x1fd558,_0x124b24);_0x1aa4f8(null);};}for(var e in events){if(events[_0x08b3('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x08b3('0x5')]=MailAccountEvents; \ No newline at end of file +var _0xb46f=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb46f,0xb6));var _0xfb46=function(_0x526579,_0x51c0eb){_0x526579=_0x526579-0x0;var _0x4c748a=_0xb46f[_0x526579];return _0x4c748a;};'use strict';var EventEmitter=require(_0xfb46('0x0'));var MailAccount=require(_0xfb46('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfb46('0x2')](0x0);var events={'afterCreate':_0xfb46('0x3'),'afterUpdate':_0xfb46('0x4'),'afterDestroy':_0xfb46('0x5')};function emitEvent(_0x37cc0f){return function(_0x4fb0bb,_0x95533e,_0x544ae9){MailAccountEvents[_0xfb46('0x6')](_0x37cc0f+':'+_0x4fb0bb['id'],_0x4fb0bb);MailAccountEvents[_0xfb46('0x6')](_0x37cc0f,_0x4fb0bb);_0x544ae9(null);};}for(var e in events){if(events[_0xfb46('0x7')](e)){var event=events[e];MailAccount[_0xfb46('0x8')](e,emitEvent(event));}}module[_0xfb46('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 354e66a..35eb49e 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 _0xb090=['auth','user','data5','pass','./mailAccount.attributes','exports','MailAccount','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x305c93,_0x3421dc){var _0x5bae39=function(_0x59ff63){while(--_0x59ff63){_0x305c93['push'](_0x305c93['shift']());}};_0x5bae39(++_0x3421dc);}(_0xb090,0x15a));var _0x0b09=function(_0x534e29,_0x44e544){_0x534e29=_0x534e29-0x0;var _0x12a7c8=_0xb090[_0x534e29];return _0x12a7c8;};'use strict';var attributes=require(_0x0b09('0x0'));module[_0x0b09('0x1')]=function(_0x2e476e){return _0x2e476e['define'](_0x0b09('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x135a99=this;var _0x1fc9a4={'id':_0x135a99['id'],'tls':{'rejectUnauthorized':![]}};if(_0x135a99[_0x0b09('0x3')]!==_0x0b09('0x4')){_0x1fc9a4[_0x0b09('0x5')]=_0x135a99[_0x0b09('0x3')];}else{_0x1fc9a4['host']=_0x135a99[_0x0b09('0x6')][_0x0b09('0x7')];_0x1fc9a4[_0x0b09('0x8')]=_0x135a99[_0x0b09('0x6')][_0x0b09('0x8')];_0x1fc9a4[_0x0b09('0x9')]=_0x135a99[_0x0b09('0x6')][_0x0b09('0x9')];}if(_0x135a99[_0x0b09('0x6')][_0x0b09('0xa')]){if(_0x135a99[_0x0b09('0x6')][_0x0b09('0xb')]){if(!_0x135a99[_0x0b09('0x6')][_0x0b09('0xc')])throw new Error(_0x0b09('0xd'));_0x1fc9a4[_0x0b09('0xe')]={'type':'OAuth2','user':_0x135a99[_0x0b09('0x6')][_0x0b09('0xf')],'accessToken':_0x135a99[_0x0b09('0x6')][_0x0b09('0xc')][_0x0b09('0x10')]};}else{_0x1fc9a4[_0x0b09('0xe')]={'user':_0x135a99[_0x0b09('0x6')][_0x0b09('0xf')],'pass':_0x135a99[_0x0b09('0x6')][_0x0b09('0x11')]};}}return _0x1fc9a4;}}});}; \ No newline at end of file +var _0x7391=['host','port','Smtp','secure','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','custom','service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7391,0xa3));var _0x1739=function(_0x558099,_0x4be744){_0x558099=_0x558099-0x0;var _0x18ac2e=_0x7391[_0x558099];return _0x18ac2e;};'use strict';var attributes=require(_0x1739('0x0'));module[_0x1739('0x1')]=function(_0x2ba100){return _0x2ba100['define'](_0x1739('0x2'),attributes,{'tableName':_0x1739('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xb525e3=this;var _0x4925c1={'id':_0xb525e3['id'],'tls':{'rejectUnauthorized':![]}};if(_0xb525e3[_0x1739('0x4')]!==_0x1739('0x5')){_0x4925c1[_0x1739('0x6')]=_0xb525e3[_0x1739('0x4')];}else{_0x4925c1[_0x1739('0x7')]=_0xb525e3['Smtp'][_0x1739('0x7')];_0x4925c1[_0x1739('0x8')]=_0xb525e3[_0x1739('0x9')]['port'];_0x4925c1[_0x1739('0xa')]=_0xb525e3[_0x1739('0x9')][_0x1739('0xa')];}if(_0xb525e3[_0x1739('0x9')]['authentication']){if(_0xb525e3[_0x1739('0x9')][_0x1739('0xb')]){if(!_0xb525e3[_0x1739('0x9')][_0x1739('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4925c1[_0x1739('0xd')]={'type':'OAuth2','user':_0xb525e3[_0x1739('0x9')][_0x1739('0xe')],'accessToken':_0xb525e3[_0x1739('0x9')][_0x1739('0xc')][_0x1739('0xf')]};}else{_0x4925c1['auth']={'user':_0xb525e3[_0x1739('0x9')]['user'],'pass':_0xb525e3[_0x1739('0x9')][_0x1739('0x10')]};}}return _0x4925c1;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 02ed87b..9f7d34c 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 _0xc2c7=['defaults','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','findAll','raw','options','where','attributes','include','map','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','CmContact','rawAttributes','updatedAt','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','account','CmList','List','DESC','MailApplication','Smtp','CloudProvider','get','omit','Applications','applications','orderBy','asc','autoclose','push','close','Contacts','length','List\x20not\x20found','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x2a4021,_0x4e3e79){var _0xc875e0=function(_0x198071){while(--_0x198071){_0x2a4021['push'](_0x2a4021['shift']());}};_0xc875e0(++_0x4e3e79);}(_0xc2c7,0x134));var _0x7c2c=function(_0x25e297,_0x3fd659){_0x25e297=_0x25e297-0x0;var _0xbd2ab9=_0xc2c7[_0x25e297];return _0xbd2ab9;};'use strict';var _=require('lodash');var moment=require(_0x7c2c('0x0'));var BPromise=require(_0x7c2c('0x1'));var rs=require(_0x7c2c('0x2'));var Redis=require(_0x7c2c('0x3'));var db=require(_0x7c2c('0x4'))['db'];var logger=require(_0x7c2c('0x5'))(_0x7c2c('0x6'));var config=require(_0x7c2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c2c('0x8')]({'port':0x232c});config[_0x7c2c('0x9')]=_[_0x7c2c('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2c('0x9')]));require(_0x7c2c('0xb'))[_0x7c2c('0xc')](socket);function respondWithRpcPromise(_0x3b780b,_0x279cff,_0x57b107){return new BPromise(function(_0x3093d2,_0x307bec){return client[_0x7c2c('0xd')](_0x3b780b,_0x57b107)[_0x7c2c('0xe')](function(_0x2587ec){logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x279cff,_0x7c2c('0x11'));logger[_0x7c2c('0x12')](_0x7c2c('0x13'),_0x279cff,_0x7c2c('0x11'),JSON[_0x7c2c('0x14')](_0x2587ec));if(_0x2587ec[_0x7c2c('0x15')]){if(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x16')]===0x1f4){logger[_0x7c2c('0x15')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x2587ec['error'][_0x7c2c('0x17')]);return _0x307bec(_0x2587ec[_0x7c2c('0x15')][_0x7c2c('0x17')]);}logger['error'](_0x7c2c('0x10'),_0x279cff,_0x2587ec[_0x7c2c('0x15')]['message']);return _0x3093d2(_0x2587ec[_0x7c2c('0x15')]['message']);}else{logger[_0x7c2c('0xf')]('MailAccount,\x20%s,\x20%s',_0x279cff,_0x7c2c('0x11'));_0x3093d2(_0x2587ec[_0x7c2c('0x18')][_0x7c2c('0x17')]);}})[_0x7c2c('0x19')](function(_0x17df4a){logger[_0x7c2c('0x15')](_0x7c2c('0x10'),_0x279cff,_0x17df4a);_0x307bec(_0x17df4a);});});}exports[_0x7c2c('0x1a')]=function(_0x2d356e){var _0x39c5f3=this;return new Promise(function(_0x40eaef,_0x2381b4){return db['MailAccount'][_0x7c2c('0x1b')]({'raw':_0x2d356e['options']?_0x2d356e['options'][_0x7c2c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1e')]||null:null,'attributes':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'limit':_0x2d356e['options']?_0x2d356e[_0x7c2c('0x1d')]['limit']||null:null,'include':_0x2d356e[_0x7c2c('0x1d')]?_0x2d356e['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x2d356e[_0x7c2c('0x1d')]['include'],function(_0x4d6ec7){return{'model':db[_0x4d6ec7[_0x7c2c('0x22')]],'as':_0x4d6ec7['as'],'attributes':_0x4d6ec7[_0x7c2c('0x1f')],'include':_0x4d6ec7[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x4d6ec7[_0x7c2c('0x20')],function(_0xa8e145){return{'model':db[_0xa8e145[_0x7c2c('0x22')]],'as':_0xa8e145['as'],'attributes':_0xa8e145['attributes'],'include':_0xa8e145[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0xa8e145[_0x7c2c('0x20')],function(_0x22d03f){return{'model':db[_0x22d03f[_0x7c2c('0x22')]],'as':_0x22d03f['as'],'attributes':_0x22d03f[_0x7c2c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0x26f472){logger[_0x7c2c('0xf')]('GetMailAccount',_0x2d356e);logger[_0x7c2c('0x12')](_0x7c2c('0x1a'),_0x2d356e,JSON[_0x7c2c('0x14')](_0x26f472));_0x40eaef(_0x26f472);})[_0x7c2c('0x19')](function(_0x53ad23){logger[_0x7c2c('0x15')](_0x7c2c('0x1a'),_0x53ad23[_0x7c2c('0x17')],_0x2d356e);_0x2381b4(_0x39c5f3[_0x7c2c('0x15')](0x1f4,_0x53ad23[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x23')]=function(_0x463ef7){var _0x57af44=this;return new Promise(function(_0x1969f4,_0x1acf75){return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'raw':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['raw']===undefined?!![]:![]:!![],'where':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options']['where']||null:null,'attributes':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x1f')]||null:null,'include':_0x463ef7[_0x7c2c('0x1d')]?_0x463ef7['options'][_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x20')],function(_0x204968){return{'model':db[_0x204968[_0x7c2c('0x22')]],'as':_0x204968['as'],'attributes':_0x204968[_0x7c2c('0x1f')],'include':_0x204968[_0x7c2c('0x20')]?_[_0x7c2c('0x21')](_0x204968[_0x7c2c('0x20')],function(_0x3230a1){return{'model':db[_0x3230a1[_0x7c2c('0x22')]],'as':_0x3230a1['as'],'attributes':_0x3230a1[_0x7c2c('0x1f')],'include':_0x3230a1['include']?_['map'](_0x3230a1[_0x7c2c('0x20')],function(_0x4acc5d){return{'model':db[_0x4acc5d['model']],'as':_0x4acc5d['as'],'attributes':_0x4acc5d['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c2c('0xe')](function(_0xc77f11){if(_0x463ef7[_0x7c2c('0x1d')][_0x7c2c('0x26')]===!![])_0xc77f11[_0x7c2c('0x27')](_0x7c2c('0x28'),_0xc77f11[_0x7c2c('0x29')]());logger[_0x7c2c('0xf')](_0x7c2c('0x23'),_0x463ef7);logger[_0x7c2c('0x12')](_0x7c2c('0x23'),_0x463ef7,JSON['stringify'](_0xc77f11));_0x1969f4(_0xc77f11);})['catch'](function(_0x3920b6){logger[_0x7c2c('0x15')](_0x7c2c('0x23'),_0x3920b6[_0x7c2c('0x17')],_0x463ef7);_0x1acf75(_0x57af44['error'](0x1f4,_0x3920b6[_0x7c2c('0x17')]));});});};exports[_0x7c2c('0x2a')]=function(_0x93e2a8){var _0x45fddf=this;return new Promise(function(_0x18e288,_0x8b0dc9){var _0x12c9cd={'body':_0x93e2a8[_0x7c2c('0x2b')],'channel':_0x7c2c('0x2c')};var _0x4e1f79=_[_0x7c2c('0x2d')](_['keys'](db[_0x7c2c('0x2e')][_0x7c2c('0x2f')]),['createdAt',_0x7c2c('0x30'),'CompanyId',_0x7c2c('0x31')]);var _0x33b2be=![];if(_0x93e2a8[_0x7c2c('0x2b')]['id']){delete _0x93e2a8[_0x7c2c('0x2b')]['id'];}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')]['from'])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x32')));}if(_[_0x7c2c('0x33')](_0x93e2a8[_0x7c2c('0x2b')]['body'])||_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x2b')]===''){return _0x8b0dc9(_0x45fddf['error'](0x1f4,_0x7c2c('0x34')));}if(_['isNil'](_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')])){return _0x8b0dc9(_0x45fddf['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}if(!_[_0x7c2c('0x36')](_0x4e1f79,_0x93e2a8[_0x7c2c('0x2b')]['mapKey'])){return _0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e1f79));}var _0x51e3b7={};_0x51e3b7[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x24')][_0x7c2c('0x25')]({'where':{'id':_0x93e2a8[_0x7c2c('0x38')]['id']},'include':[{'model':db[_0x7c2c('0x39')],'as':_0x7c2c('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x51e3b7,'limit':0x1,'order':[[_0x7c2c('0x30'),_0x7c2c('0x3b')]]}]},{'model':db[_0x7c2c('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x7c2c('0x3d'),'include':[{'model':db[_0x7c2c('0x3e')],'as':_0x7c2c('0x3e')}]}]})[_0x7c2c('0xe')](function(_0x5f3de8){if(_0x5f3de8&&_0x5f3de8['List']){var _0x587667=_0x5f3de8[_0x7c2c('0x3f')]({'plain':!![]});_0x12c9cd[_0x7c2c('0x38')]=_[_0x7c2c('0x40')](_0x587667,[_0x7c2c('0x41'),_0x7c2c('0x3a')]);_0x12c9cd['account'][_0x7c2c('0x28')]=_0x5f3de8[_0x7c2c('0x29')]();_0x12c9cd['applications']=_0x587667[_0x7c2c('0x41')];_0x12c9cd['list']=_0x587667[_0x7c2c('0x3a')];_0x12c9cd[_0x7c2c('0x42')]=_[_0x7c2c('0x43')](_0x12c9cd['applications'],['priority'],[_0x7c2c('0x44')]);if(_0x12c9cd['account']&&_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x45')]){_0x12c9cd['applications'][_0x7c2c('0x46')]({'id':0x0,'priority':_0x12c9cd[_0x7c2c('0x42')]['length']+0x1,'app':_0x7c2c('0x47'),'appdata':_0x7c2c('0x45'),'interval':'*,*,*,*'});}if(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x41')]){delete _0x12c9cd[_0x7c2c('0x38')]['Applications'];}if(_0x12c9cd[_0x7c2c('0x38')]['List']){delete _0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x3a')];}if(_0x587667['List'][_0x7c2c('0x48')][_0x7c2c('0x49')]){return _0x587667[_0x7c2c('0x3a')][_0x7c2c('0x48')][0x0];}var _0x481b9e=_[_0x7c2c('0xa')](_0x93e2a8[_0x7c2c('0x2b')],{'firstName':_0x93e2a8['body'][_0x7c2c('0x37')],'ListId':_0x587667['ListId']});_0x481b9e[_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x35')]]=_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x37')];return db[_0x7c2c('0x2e')]['create'](_0x481b9e);}else{throw new Error(_0x7c2c('0x4a'));}})[_0x7c2c('0xe')](function(_0x4c4661){_0x12c9cd['contact']=_0x4c4661;if(_0x4c4661){if(!_0x93e2a8['body'][_0x7c2c('0x17')]['messageId']){_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x4b')]=rs[_0x7c2c('0x4c')]()+'\x20'+_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x37')];}var _0x1ee34d={'ContactId':_0x4c4661['id'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'inReplyTo':_0x93e2a8[_0x7c2c('0x2b')]['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8[_0x7c2c('0x2b')]['message']['attach'],'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x7c2c('0x25')]({'where':{'closed':![],'MailAccountId':_0x93e2a8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x7c2c('0x50'),'attributes':[_0x7c2c('0x4b')],'where':{'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x51')]}}]})[_0x7c2c('0xe')](function(_0x2d4459){if(_0x2d4459){return[_0x2d4459,![]];}return db[_0x7c2c('0x52')][_0x7c2c('0x53')](_0x1ee34d)[_0x7c2c('0xe')](function(_0xd01d59){return[_0xd01d59,!![]];});});}else{throw new Error(_0x7c2c('0x54'));}})[_0x7c2c('0x55')](function(_0x3d44f8,_0x559005){if(_0x3d44f8){_0x33b2be=_0x559005;if(!_0x559005){return _0x3d44f8[_0x7c2c('0x56')]({'inReplyTo':_0x93e2a8['body']['message']['messageId'],'to':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x37')],'cc':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['subject'],'attach':_0x3d44f8[_0x7c2c('0x57')]?_0x3d44f8[_0x7c2c('0x57')]:_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x57')],'substatus':null,'substatusAt':moment()[_0x7c2c('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x7c2c('0x4e')](_0x7c2c('0x4f')),'lastMsgDirection':'in'});}else{return _0x3d44f8;}}})['then'](function(_0x39d319){_0x12c9cd[_0x7c2c('0x58')]=_0x39d319['get']({'plain':!![]});_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x59')]=_0x33b2be;return db['MailMessage']['create']({'body':_0x93e2a8[_0x7c2c('0x2b')]['body'],'MailAccountId':_0x93e2a8[_0x7c2c('0x38')]['id'],'MailInteractionId':_0x39d319['id'],'direction':'in','ContactId':_0x12c9cd['contact']['id'],'messageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['messageId'],'from':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x37')],'to':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['to'],'cc':_0x93e2a8['body'][_0x7c2c('0x17')]['cc'],'subject':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x4d')],'attach':_0x93e2a8['body'][_0x7c2c('0x17')][_0x7c2c('0x57')],'Attachments':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5a')],'originTo':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')][_0x7c2c('0x5b')],'originCc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5c')],'bcc':_0x93e2a8[_0x7c2c('0x2b')]['message'][_0x7c2c('0x5d')],'ChatWebsiteId':_0x93e2a8['body']['message'][_0x7c2c('0x5e')]||null,'originChannel':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['originChannel']||_0x7c2c('0x5f'),'ChatOfflineMessageId':_0x93e2a8[_0x7c2c('0x2b')][_0x7c2c('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x7c2c('0x60')],'as':_0x7c2c('0x61')}]});})[_0x7c2c('0xe')](function(_0x8f8b42){_0x12c9cd['message']=_0x8f8b42;if(_0x12c9cd[_0x7c2c('0x58')]['UserId']){return db[_0x7c2c('0x62')]['find']({'attributes':['id',_0x7c2c('0x63')],'where':{'id':_0x12c9cd[_0x7c2c('0x58')][_0x7c2c('0x64')]}})[_0x7c2c('0xe')](function(_0x43eb9d){if(_0x43eb9d){_0x12c9cd[_0x7c2c('0x42')][_0x7c2c('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x43eb9d[_0x7c2c('0x63')]+','+(_0x12c9cd[_0x7c2c('0x38')][_0x7c2c('0x66')]||0xa),'interval':_0x7c2c('0x67')});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);});}return respondWithRpcPromise(_0x7c2c('0x68'),_0x7c2c('0x69'),_0x12c9cd);})['then'](function(_0x2d75b8){_0x18e288(_0x2d75b8);})[_0x7c2c('0x19')](function(_0x2391a7){_0x8b0dc9(_0x45fddf[_0x7c2c('0x15')](0x1f4,_0x2391a7[_0x7c2c('0x17')]));});});}; \ No newline at end of file +var _0x57ca=['setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','List','omit','applications','list','orderBy','asc','push','length','close','*,*,*,*','ListId','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','get','created','originCc','bcc','Email','Attachment','Attachments','UserId','User','unshift','name','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','ShowMailAccount','MailAccount','find'];(function(_0x4e68c9,_0x5136e5){var _0xad312=function(_0x2873a5){while(--_0x2873a5){_0x4e68c9['push'](_0x4e68c9['shift']());}};_0xad312(++_0x5136e5);}(_0x57ca,0x108));var _0xa57c=function(_0x561bdd,_0x1bcbb8){_0x561bdd=_0x561bdd-0x0;var _0x137b13=_0x57ca[_0x561bdd];return _0x137b13;};'use strict';var _=require('lodash');var moment=require(_0xa57c('0x0'));var BPromise=require(_0xa57c('0x1'));var rs=require('randomstring');var Redis=require(_0xa57c('0x2'));var db=require(_0xa57c('0x3'))['db'];var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa57c('0x7')][_0xa57c('0x8')]({'port':0x232c});config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));require('./mailAccount.socket')[_0xa57c('0xd')](socket);function respondWithRpcPromise(_0x4b51d8,_0x46ba92,_0x932dcc){return new BPromise(function(_0x4fa5ed,_0x156bca){return client['request'](_0x4b51d8,_0x932dcc)[_0xa57c('0xe')](function(_0x44b221){logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');logger[_0xa57c('0x10')](_0xa57c('0x11'),_0x46ba92,_0xa57c('0x12'),JSON[_0xa57c('0x13')](_0x44b221));if(_0x44b221[_0xa57c('0x14')]){if(_0x44b221['error'][_0xa57c('0x15')]===0x1f4){logger['error'](_0xa57c('0xf'),_0x46ba92,_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x156bca(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0x44b221['error'][_0xa57c('0x16')]);return _0x4fa5ed(_0x44b221[_0xa57c('0x14')][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0xf'),_0x46ba92,'request\x20sent');_0x4fa5ed(_0x44b221[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0xe3d505){logger[_0xa57c('0x14')](_0xa57c('0xf'),_0x46ba92,_0xe3d505);_0x156bca(_0xe3d505);});});}exports[_0xa57c('0x19')]=function(_0x595c7a){var _0x4e4399=this;return new Promise(function(_0x8a8856,_0x4a53ab){return db['MailAccount'][_0xa57c('0x1a')]({'raw':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1c')]===undefined?!![]:![]:!![],'where':_0x595c7a['options']?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1d')]||null:null,'attributes':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1e')]||null:null,'limit':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x1f')]||null:null,'include':_0x595c7a[_0xa57c('0x1b')]?_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x595c7a[_0xa57c('0x1b')][_0xa57c('0x20')],function(_0x431bec){return{'model':db[_0x431bec['model']],'as':_0x431bec['as'],'attributes':_0x431bec[_0xa57c('0x1e')],'include':_0x431bec[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x431bec[_0xa57c('0x20')],function(_0x315ad7){return{'model':db[_0x315ad7[_0xa57c('0x22')]],'as':_0x315ad7['as'],'attributes':_0x315ad7[_0xa57c('0x1e')],'include':_0x315ad7[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x315ad7[_0xa57c('0x20')],function(_0x57ebe0){return{'model':db[_0x57ebe0[_0xa57c('0x22')]],'as':_0x57ebe0['as'],'attributes':_0x57ebe0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x257661){logger[_0xa57c('0x23')]('GetMailAccount',_0x595c7a);logger[_0xa57c('0x10')](_0xa57c('0x19'),_0x595c7a,JSON[_0xa57c('0x13')](_0x257661));_0x8a8856(_0x257661);})['catch'](function(_0xd779f1){logger['error'](_0xa57c('0x19'),_0xd779f1['message'],_0x595c7a);_0x4a53ab(_0x4e4399[_0xa57c('0x14')](0x1f4,_0xd779f1['message']));});});};exports[_0xa57c('0x24')]=function(_0x532164){var _0x9e02bb=this;return new Promise(function(_0x1d82d9,_0x43c8f3){return db[_0xa57c('0x25')][_0xa57c('0x26')]({'raw':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x1d')]||null:null,'attributes':_0x532164[_0xa57c('0x1b')]?_0x532164[_0xa57c('0x1b')]['attributes']||null:null,'include':_0x532164[_0xa57c('0x1b')]?_0x532164['options'][_0xa57c('0x20')]?_['map'](_0x532164[_0xa57c('0x1b')]['include'],function(_0x433116){return{'model':db[_0x433116[_0xa57c('0x22')]],'as':_0x433116['as'],'attributes':_0x433116['attributes'],'include':_0x433116[_0xa57c('0x20')]?_['map'](_0x433116[_0xa57c('0x20')],function(_0x5c56d3){return{'model':db[_0x5c56d3[_0xa57c('0x22')]],'as':_0x5c56d3['as'],'attributes':_0x5c56d3[_0xa57c('0x1e')],'include':_0x5c56d3[_0xa57c('0x20')]?_[_0xa57c('0x21')](_0x5c56d3[_0xa57c('0x20')],function(_0x44350f){return{'model':db[_0x44350f['model']],'as':_0x44350f['as'],'attributes':_0x44350f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa57c('0xe')](function(_0x13e390){if(_0x532164[_0xa57c('0x1b')]['smtp']===!![])_0x13e390[_0xa57c('0x27')]('smtpOptions',_0x13e390[_0xa57c('0x28')]());logger[_0xa57c('0x23')]('ShowMailAccount',_0x532164);logger['debug']('ShowMailAccount',_0x532164,JSON[_0xa57c('0x13')](_0x13e390));_0x1d82d9(_0x13e390);})[_0xa57c('0x18')](function(_0x269a19){logger[_0xa57c('0x14')](_0xa57c('0x24'),_0x269a19[_0xa57c('0x16')],_0x532164);_0x43c8f3(_0x9e02bb['error'](0x1f4,_0x269a19[_0xa57c('0x16')]));});});};exports[_0xa57c('0x29')]=function(_0x5a5490){var _0x5ed42d=this;return new Promise(function(_0x5e10b,_0x203375){var _0x5af5e9={'body':_0x5a5490[_0xa57c('0x2a')],'channel':_0xa57c('0x2b')};var _0x2112b7=_[_0xa57c('0x2c')](_[_0xa57c('0x2d')](db[_0xa57c('0x2e')]['rawAttributes']),[_0xa57c('0x2f'),'updatedAt','CompanyId','ListId']);var _0x520383=![];if(_0x5a5490['body']['id']){delete _0x5a5490[_0xa57c('0x2a')]['id'];}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')]['from'])){return _0x203375(_0x5ed42d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')])||_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x2a')]===''){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa57c('0x30')](_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x32')+_0x2112b7));}if(!_[_0xa57c('0x33')](_0x2112b7,_0x5a5490['body'][_0xa57c('0x31')])){return _0x203375(_0x5ed42d[_0xa57c('0x14')](0x1f4,_0xa57c('0x34')+_0x2112b7));}var _0x14e943={};_0x14e943[_0x5a5490[_0xa57c('0x2a')]['mapKey']]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x25')][_0xa57c('0x26')]({'where':{'id':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x37')],'as':'List','include':[{'model':db[_0xa57c('0x2e')],'as':_0xa57c('0x38'),'where':_0x14e943,'limit':0x1,'order':[[_0xa57c('0x39'),_0xa57c('0x3a')]]}]},{'model':db[_0xa57c('0x3b')],'as':_0xa57c('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})[_0xa57c('0xe')](function(_0x49492f){if(_0x49492f&&_0x49492f[_0xa57c('0x3d')]){var _0xae87=_0x49492f['get']({'plain':!![]});_0x5af5e9[_0xa57c('0x36')]=_[_0xa57c('0x3e')](_0xae87,[_0xa57c('0x3c'),_0xa57c('0x3d')]);_0x5af5e9[_0xa57c('0x36')]['smtpOptions']=_0x49492f[_0xa57c('0x28')]();_0x5af5e9[_0xa57c('0x3f')]=_0xae87[_0xa57c('0x3c')];_0x5af5e9[_0xa57c('0x40')]=_0xae87[_0xa57c('0x3d')];_0x5af5e9['applications']=_[_0xa57c('0x41')](_0x5af5e9['applications'],['priority'],[_0xa57c('0x42')]);if(_0x5af5e9[_0xa57c('0x36')]&&_0x5af5e9[_0xa57c('0x36')]['autoclose']){_0x5af5e9['applications'][_0xa57c('0x43')]({'id':0x0,'priority':_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x44')]+0x1,'app':_0xa57c('0x45'),'appdata':'autoclose','interval':_0xa57c('0x46')});}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3c')]){delete _0x5af5e9['account']['Applications'];}if(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x3d')]){delete _0x5af5e9['account'][_0xa57c('0x3d')];}if(_0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][_0xa57c('0x44')]){return _0xae87[_0xa57c('0x3d')][_0xa57c('0x38')][0x0];}var _0x4fc413=_['defaults'](_0x5a5490['body'],{'firstName':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')],'ListId':_0xae87[_0xa57c('0x47')]});_0x4fc413[_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x31')]]=_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x35')];return db[_0xa57c('0x2e')]['create'](_0x4fc413);}else{throw new Error('List\x20not\x20found');}})[_0xa57c('0xe')](function(_0x4e18ad){_0x5af5e9[_0xa57c('0x48')]=_0x4e18ad;if(_0x4e18ad){if(!_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['messageId']){_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x49')]=rs['generate']()+'\x20'+_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x35')];}var _0x26a8e1={'ContactId':_0x4e18ad['id'],'MailAccountId':_0x5a5490['account']['id'],'inReplyTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'to':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['from'],'cc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa57c('0x26')]({'where':{'closed':![],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id']},'include':[{'model':db[_0xa57c('0x4e')],'as':_0xa57c('0x4f'),'attributes':[_0xa57c('0x49')],'where':{'messageId':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x50')]}}]})[_0xa57c('0xe')](function(_0x521acc){if(_0x521acc){return[_0x521acc,![]];}return db[_0xa57c('0x51')][_0xa57c('0x52')](_0x26a8e1)[_0xa57c('0xe')](function(_0xa78a75){return[_0xa78a75,!![]];});});}else{throw new Error(_0xa57c('0x53'));}})[_0xa57c('0x54')](function(_0x24efa0,_0x5e1103){if(_0x24efa0){_0x520383=_0x5e1103;if(!_0x5e1103){return _0x24efa0[_0xa57c('0x55')]({'inReplyTo':_0x5a5490['body'][_0xa57c('0x16')]['messageId'],'to':_0x5a5490[_0xa57c('0x2a')]['message'][_0xa57c('0x35')],'cc':_0x5a5490[_0xa57c('0x2a')]['message']['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x24efa0[_0xa57c('0x4b')]?_0x24efa0['attach']:_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'substatus':null,'substatusAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgAt':moment()[_0xa57c('0x4c')](_0xa57c('0x4d')),'lastMsgDirection':'in'});}else{return _0x24efa0;}}})[_0xa57c('0xe')](function(_0x11c13e){_0x5af5e9[_0xa57c('0x56')]=_0x11c13e[_0xa57c('0x57')]({'plain':!![]});_0x5af5e9[_0xa57c('0x56')][_0xa57c('0x58')]=_0x520383;return db[_0xa57c('0x4e')][_0xa57c('0x52')]({'body':_0x5a5490[_0xa57c('0x2a')]['body'],'MailAccountId':_0x5a5490[_0xa57c('0x36')]['id'],'MailInteractionId':_0x11c13e['id'],'direction':'in','ContactId':_0x5af5e9['contact']['id'],'messageId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x49')],'from':_0x5a5490['body'][_0xa57c('0x16')][_0xa57c('0x35')],'to':_0x5a5490[_0xa57c('0x2a')]['message']['to'],'cc':_0x5a5490['body'][_0xa57c('0x16')]['cc'],'subject':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4a')],'attach':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x4b')],'Attachments':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['attachments'],'originTo':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originTo'],'originCc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x59')],'bcc':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')][_0xa57c('0x5a')],'ChatWebsiteId':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['ChatWebsiteId']||null,'originChannel':_0x5a5490[_0xa57c('0x2a')][_0xa57c('0x16')]['originChannel']||_0xa57c('0x5b'),'ChatOfflineMessageId':_0x5a5490[_0xa57c('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xa57c('0x5c')],'as':_0xa57c('0x5d')}]});})[_0xa57c('0xe')](function(_0x1604d6){_0x5af5e9[_0xa57c('0x16')]=_0x1604d6;if(_0x5af5e9['interaction'][_0xa57c('0x5e')]){return db[_0xa57c('0x5f')][_0xa57c('0x26')]({'attributes':['id','name'],'where':{'id':_0x5af5e9[_0xa57c('0x56')]['UserId']}})[_0xa57c('0xe')](function(_0x2963cb){if(_0x2963cb){_0x5af5e9[_0xa57c('0x3f')][_0xa57c('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2963cb[_0xa57c('0x61')]+','+(_0x5af5e9[_0xa57c('0x36')][_0xa57c('0x62')]||0xa),'interval':_0xa57c('0x46')});}return respondWithRpcPromise('Start',_0xa57c('0x63'),_0x5af5e9);});}return respondWithRpcPromise(_0xa57c('0x64'),_0xa57c('0x63'),_0x5af5e9);})['then'](function(_0x3da413){_0x5e10b(_0x3da413);})[_0xa57c('0x18')](function(_0x2ed4f4){_0x203375(_0x5ed42d['error'](0x1f4,_0x2ed4f4[_0xa57c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 878da47..55db739 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 _0x0d8b=['save','remove','update','emit','length','mailAccount:'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x0d8b,0x1e6));var _0xb0d8=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0x0d8b[_0x1a7550];return _0x426e22;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xb0d8('0x0'),_0xb0d8('0x1'),_0xb0d8('0x2')];function createListener(_0x2f2842,_0x208ffd){return function(_0x3846a2){_0x208ffd[_0xb0d8('0x3')](_0x2f2842,_0x3846a2);};}function removeListener(_0x4d48fe,_0x3bf0a2){return function(){MailAccountEvents['removeListener'](_0x4d48fe,_0x3bf0a2);};}exports['register']=function(_0x15089b){for(var _0x35f5f7=0x0,_0x2c13be=events[_0xb0d8('0x4')];_0x35f5f7<_0x2c13be;_0x35f5f7++){var _0x326bad=events[_0x35f5f7];var _0x24b91d=createListener(_0xb0d8('0x5')+_0x326bad,_0x15089b);MailAccountEvents['on'](_0x326bad,_0x24b91d);}}; \ No newline at end of file +var _0x50a8=['removeListener','register','length','save','update'];(function(_0x4a6934,_0x1237f4){var _0x532acf=function(_0x5f49fe){while(--_0x5f49fe){_0x4a6934['push'](_0x4a6934['shift']());}};_0x532acf(++_0x1237f4);}(_0x50a8,0x193));var _0x850a=function(_0x307c57,_0x2ff9e5){_0x307c57=_0x307c57-0x0;var _0x232faa=_0x50a8[_0x307c57];return _0x232faa;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x850a('0x0'),'remove',_0x850a('0x1')];function createListener(_0xd71f18,_0x11c233){return function(_0x2c4e88){_0x11c233['emit'](_0xd71f18,_0x2c4e88);};}function removeListener(_0x5458e6,_0x5ca0f6){return function(){MailAccountEvents[_0x850a('0x2')](_0x5458e6,_0x5ca0f6);};}exports[_0x850a('0x3')]=function(_0x530b92){for(var _0x31c037=0x0,_0x4d74c5=events[_0x850a('0x4')];_0x31c037<_0x4d74c5;_0x31c037++){var _0x2cfc90=events[_0x31c037];var _0x245f43=createListener('mailAccount:'+_0x2cfc90,_0x530b92);MailAccountEvents['on'](_0x2cfc90,_0x245f43);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 11a1dc7..5606ecd 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 _0xf771=['./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xf771,0x129));var _0x1f77=function(_0x30b998,_0x1a2398){_0x30b998=_0x30b998-0x0;var _0x2d55d7=_0xf771[_0x30b998];return _0x2d55d7;};'use strict';var multer=require(_0x1f77('0x0'));var util=require(_0x1f77('0x1'));var path=require(_0x1f77('0x2'));var timeout=require(_0x1f77('0x3'));var express=require(_0x1f77('0x4'));var router=express['Router']();var fs_extra=require(_0x1f77('0x5'));var auth=require(_0x1f77('0x6'));var interaction=require(_0x1f77('0x7'));var config=require(_0x1f77('0x8'));var controller=require(_0x1f77('0x9'));router[_0x1f77('0xa')](_0x1f77('0xb'),auth[_0x1f77('0xc')](),controller[_0x1f77('0xd')]);router[_0x1f77('0xe')](_0x1f77('0xb'),auth[_0x1f77('0xc')](),controller['update']);router[_0x1f77('0xf')](_0x1f77('0xb'),auth[_0x1f77('0xc')](),controller['destroy']);module[_0x1f77('0x10')]=router; \ No newline at end of file +var _0xae4b=['put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xae4b,0x1a9));var _0xbae4=function(_0x5553db,_0x3d3077){_0x5553db=_0x5553db-0x0;var _0xd7ec63=_0xae4b[_0x5553db];return _0xd7ec63;};'use strict';var multer=require(_0xbae4('0x0'));var util=require(_0xbae4('0x1'));var path=require(_0xbae4('0x2'));var timeout=require('connect-timeout');var express=require(_0xbae4('0x3'));var router=express['Router']();var fs_extra=require(_0xbae4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbae4('0x5'));var controller=require(_0xbae4('0x6'));router['get'](_0xbae4('0x7'),auth[_0xbae4('0x8')](),controller[_0xbae4('0x9')]);router[_0xbae4('0xa')]('/:id',auth[_0xbae4('0x8')](),controller[_0xbae4('0xb')]);router[_0xbae4('0xc')]('/:id',auth[_0xbae4('0x8')](),controller[_0xbae4('0xd')]);module[_0xbae4('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 6798e33..a9374b3 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 _0xa3f0=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x151ae3,_0x3a9195){var _0x564680=function(_0x244bf7){while(--_0x244bf7){_0x151ae3['push'](_0x151ae3['shift']());}};_0x564680(++_0x3a9195);}(_0xa3f0,0x7f));var _0x0a3f=function(_0x27ee2c,_0x3ee14d){_0x27ee2c=_0x27ee2c-0x0;var _0x50eeb9=_0xa3f0[_0x27ee2c];return _0x50eeb9;};'use strict';var Sequelize=require(_0x0a3f('0x0'));module[_0x0a3f('0x1')]={'priority':{'type':Sequelize[_0x0a3f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0a3f('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a3f('0x3')],'defaultValue':_0x0a3f('0x4')}}; \ No newline at end of file +var _0xaa01=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0xfad6b,_0x1c93a3){var _0x214ae5=function(_0x34059a){while(--_0x34059a){_0xfad6b['push'](_0xfad6b['shift']());}};_0x214ae5(++_0x1c93a3);}(_0xaa01,0x1dd));var _0x1aa0=function(_0x1e3963,_0x5abd8f){_0x1e3963=_0x1e3963-0x0;var _0x5d9385=_0xaa01[_0x1e3963];return _0x5d9385;};'use strict';var Sequelize=require(_0x1aa0('0x0'));module['exports']={'priority':{'type':Sequelize[_0x1aa0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1aa0('0x2')],'allowNull':![],'defaultValue':_0x1aa0('0x3')},'appdata':{'type':Sequelize[_0x1aa0('0x4')]()},'description':{'type':Sequelize[_0x1aa0('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1aa0('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index fb48cd2..05e69ca 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 _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x1f32b6,_0x213fb7){var _0x10743f=function(_0x10be64){while(--_0x10be64){_0x1f32b6['push'](_0x1f32b6['shift']());}};_0x10743f(++_0x213fb7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xcb91[_0x5cb1af];return _0x8d7940;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x2be6d9,_0xd31df5){var _0x45e38b=function(_0x1237b0){while(--_0x1237b0){_0x2be6d9['push'](_0x2be6d9['shift']());}};_0x45e38b(++_0xd31df5);}(_0x70e0,0x17b));var _0x070e=function(_0x37e6d8,_0x319512){_0x37e6d8=_0x37e6d8-0x0;var _0x15712f=_0x70e0[_0x37e6d8];return _0x15712f;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 69bc6fd..1affe2d 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 _0x27fa=['api','moment','bluebird','request-promise','path','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x27fa,0x1ad));var _0xa27f=function(_0x1fd8bb,_0x72921a){_0x1fd8bb=_0x1fd8bb-0x0;var _0x5689ef=_0x27fa[_0x1fd8bb];return _0x5689ef;};'use strict';var _=require('lodash');var util=require(_0xa27f('0x0'));var logger=require('../../config/logger')(_0xa27f('0x1'));var moment=require(_0xa27f('0x2'));var BPromise=require(_0xa27f('0x3'));var rp=require(_0xa27f('0x4'));var fs=require('fs');var path=require(_0xa27f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x407342,_0x1cbb32){return _0x407342[_0xa27f('0x6')]('MailApplication',attributes,{'tableName':_0xa27f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa27f('0x8'),'collate':_0xa27f('0x9')});}; \ No newline at end of file +var _0x1193=['exports','MailApplication','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1f459f,_0x21ac07){var _0x4a555b=function(_0x10a4ca){while(--_0x10a4ca){_0x1f459f['push'](_0x1f459f['shift']());}};_0x4a555b(++_0x21ac07);}(_0x1193,0x1cd));var _0x3119=function(_0x20ca86,_0x4140be){_0x20ca86=_0x20ca86-0x0;var _0x39d146=_0x1193[_0x20ca86];return _0x39d146;};'use strict';var _=require('lodash');var util=require(_0x3119('0x0'));var logger=require(_0x3119('0x1'))('api');var moment=require(_0x3119('0x2'));var BPromise=require(_0x3119('0x3'));var rp=require(_0x3119('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3119('0x5'));var config=require(_0x3119('0x6'));var attributes=require('./mailApplication.attributes');module[_0x3119('0x7')]=function(_0x18c358,_0x12034e){return _0x18c358['define'](_0x3119('0x8'),attributes,{'tableName':'mail_applications','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 736f3e3..ca04ce7 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 _0xe86f=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe86f,0x1de));var _0xfe86=function(_0x4cb14b,_0x557a0a){_0x4cb14b=_0x4cb14b-0x0;var _0x378c2f=_0xe86f[_0x4cb14b];return _0x378c2f;};'use strict';var _=require(_0xfe86('0x0'));var util=require('util');var moment=require(_0xfe86('0x1'));var BPromise=require(_0xfe86('0x2'));var rs=require(_0xfe86('0x3'));var fs=require('fs');var Redis=require(_0xfe86('0x4'));var db=require(_0xfe86('0x5'))['db'];var utils=require(_0xfe86('0x6'));var logger=require(_0xfe86('0x7'))(_0xfe86('0x8'));var config=require(_0xfe86('0x9'));var jayson=require(_0xfe86('0xa'));var client=jayson[_0xfe86('0xb')][_0xfe86('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x515897,_0x1621c9,_0x5202f6){return new BPromise(function(_0x2b46b9,_0x27ca7c){return client[_0xfe86('0xd')](_0x515897,_0x5202f6)[_0xfe86('0xe')](function(_0x2e055c){logger[_0xfe86('0xf')](_0xfe86('0x10'),_0x1621c9,_0xfe86('0x11'));logger[_0xfe86('0x12')](_0xfe86('0x13'),_0x1621c9,_0xfe86('0x11'),JSON[_0xfe86('0x14')](_0x2e055c));if(_0x2e055c[_0xfe86('0x15')]){if(_0x2e055c['error']['code']===0x1f4){logger[_0xfe86('0x15')]('MailApplication,\x20%s,\x20%s',_0x1621c9,_0x2e055c[_0xfe86('0x15')][_0xfe86('0x16')]);return _0x27ca7c(_0x2e055c[_0xfe86('0x15')][_0xfe86('0x16')]);}logger[_0xfe86('0x15')]('MailApplication,\x20%s,\x20%s',_0x1621c9,_0x2e055c[_0xfe86('0x15')][_0xfe86('0x16')]);return _0x2b46b9(_0x2e055c['error'][_0xfe86('0x16')]);}else{logger[_0xfe86('0xf')]('MailApplication,\x20%s,\x20%s',_0x1621c9,_0xfe86('0x11'));_0x2b46b9(_0x2e055c[_0xfe86('0x17')][_0xfe86('0x16')]);}})[_0xfe86('0x18')](function(_0x2096c0){logger[_0xfe86('0x15')]('MailApplication,\x20%s,\x20%s',_0x1621c9,_0x2096c0);_0x27ca7c(_0x2096c0);});});}exports[_0xfe86('0x19')]=function(_0x3f3089){var _0x4e219f=this;return new Promise(function(_0x30ab97,_0x2272ba){return db['MailApplication'][_0xfe86('0x1a')](_0x3f3089[_0xfe86('0x1b')],{'raw':_0x3f3089['options']?_0x3f3089[_0xfe86('0x1c')][_0xfe86('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f3089[_0xfe86('0x1c')]?_0x3f3089[_0xfe86('0x1c')][_0xfe86('0x1e')]||null:null,'attributes':_0x3f3089[_0xfe86('0x1c')]?_0x3f3089[_0xfe86('0x1c')]['attributes']||null:null,'limit':_0x3f3089[_0xfe86('0x1c')]?_0x3f3089[_0xfe86('0x1c')]['limit']||null:null})[_0xfe86('0xe')](function(_0x4a3061){logger[_0xfe86('0xf')](_0xfe86('0x19'),_0x3f3089);logger['debug'](_0xfe86('0x19'),_0x3f3089,JSON[_0xfe86('0x14')](_0x4a3061));_0x30ab97(_0x4a3061);})[_0xfe86('0x18')](function(_0x3d679d){logger[_0xfe86('0x15')]('UpdateMailApplication',_0x3d679d[_0xfe86('0x16')],_0x3f3089);_0x2272ba(_0x4e219f[_0xfe86('0x15')](0x1f4,_0x3d679d['message']));});});}; \ No newline at end of file +var _0xe0ce=['body','options','raw','where','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update'];(function(_0x558838,_0x38c6da){var _0x337d6b=function(_0x1b48be){while(--_0x1b48be){_0x558838['push'](_0x558838['shift']());}};_0x337d6b(++_0x38c6da);}(_0xe0ce,0x198));var _0xee0c=function(_0x36d221,_0x268765){_0x36d221=_0x36d221-0x0;var _0x15cb44=_0xe0ce[_0x36d221];return _0x15cb44;};'use strict';var _=require(_0xee0c('0x0'));var util=require('util');var moment=require(_0xee0c('0x1'));var BPromise=require('bluebird');var rs=require(_0xee0c('0x2'));var fs=require('fs');var Redis=require(_0xee0c('0x3'));var db=require(_0xee0c('0x4'))['db'];var utils=require(_0xee0c('0x5'));var logger=require(_0xee0c('0x6'))('rpc');var config=require(_0xee0c('0x7'));var jayson=require(_0xee0c('0x8'));var client=jayson['client'][_0xee0c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1430f5,_0xb28f0f,_0x5a821b){return new BPromise(function(_0x216472,_0x1ad57f){return client[_0xee0c('0xa')](_0x1430f5,_0x5a821b)[_0xee0c('0xb')](function(_0x2f5364){logger[_0xee0c('0xc')](_0xee0c('0xd'),_0xb28f0f,_0xee0c('0xe'));logger[_0xee0c('0xf')](_0xee0c('0x10'),_0xb28f0f,'request\x20sent',JSON[_0xee0c('0x11')](_0x2f5364));if(_0x2f5364[_0xee0c('0x12')]){if(_0x2f5364['error'][_0xee0c('0x13')]===0x1f4){logger[_0xee0c('0x12')](_0xee0c('0xd'),_0xb28f0f,_0x2f5364['error'][_0xee0c('0x14')]);return _0x1ad57f(_0x2f5364[_0xee0c('0x12')][_0xee0c('0x14')]);}logger['error'](_0xee0c('0xd'),_0xb28f0f,_0x2f5364[_0xee0c('0x12')][_0xee0c('0x14')]);return _0x216472(_0x2f5364[_0xee0c('0x12')][_0xee0c('0x14')]);}else{logger['info'](_0xee0c('0xd'),_0xb28f0f,_0xee0c('0xe'));_0x216472(_0x2f5364[_0xee0c('0x15')]['message']);}})[_0xee0c('0x16')](function(_0x4f1539){logger[_0xee0c('0x12')](_0xee0c('0xd'),_0xb28f0f,_0x4f1539);_0x1ad57f(_0x4f1539);});});}exports[_0xee0c('0x17')]=function(_0x135787){var _0x4cebd6=this;return new Promise(function(_0x373c6c,_0x45b56f){return db[_0xee0c('0x18')][_0xee0c('0x19')](_0x135787[_0xee0c('0x1a')],{'raw':_0x135787[_0xee0c('0x1b')]?_0x135787['options'][_0xee0c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x135787[_0xee0c('0x1b')]?_0x135787[_0xee0c('0x1b')][_0xee0c('0x1d')]||null:null,'attributes':_0x135787[_0xee0c('0x1b')]?_0x135787[_0xee0c('0x1b')][_0xee0c('0x1e')]||null:null,'limit':_0x135787[_0xee0c('0x1b')]?_0x135787[_0xee0c('0x1b')]['limit']||null:null})[_0xee0c('0xb')](function(_0x1c2f79){logger['info'](_0xee0c('0x17'),_0x135787);logger['debug'](_0xee0c('0x17'),_0x135787,JSON['stringify'](_0x1c2f79));_0x373c6c(_0x1c2f79);})[_0xee0c('0x16')](function(_0x3c5e32){logger[_0xee0c('0x12')](_0xee0c('0x17'),_0x3c5e32[_0xee0c('0x14')],_0x135787);_0x45b56f(_0x4cebd6['error'](0x1f4,_0x3c5e32[_0xee0c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index b2ba177..aedd082 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 _0xa74a=['show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','mail','addTags','put','tracked','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','get','index','/describe','isAuthenticated','/:id'];(function(_0x5c6914,_0x2b1d0c){var _0x5356ff=function(_0x478cc3){while(--_0x478cc3){_0x5c6914['push'](_0x5c6914['shift']());}};_0x5356ff(++_0x2b1d0c);}(_0xa74a,0xc8));var _0xaa74=function(_0x3c5ca1,_0x509d31){_0x3c5ca1=_0x3c5ca1-0x0;var _0x1898c6=_0xa74a[_0x3c5ca1];return _0x1898c6;};'use strict';var express=require(_0xaa74('0x0'));var router=express[_0xaa74('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0xaa74('0x2')]('/',auth['isAuthenticated'](),controller[_0xaa74('0x3')]);router[_0xaa74('0x2')](_0xaa74('0x4'),auth[_0xaa74('0x5')](),controller['describe']);router[_0xaa74('0x2')](_0xaa74('0x6'),auth[_0xaa74('0x5')](),controller[_0xaa74('0x7')]);router[_0xaa74('0x2')](_0xaa74('0x8'),auth[_0xaa74('0x5')](),controller[_0xaa74('0x9')]);router['get'](_0xaa74('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xaa74('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaa74('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xaa74('0xc')]);router[_0xaa74('0xb')](_0xaa74('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0xaa74('0xe'),'mailinteraction:addtags'),controller[_0xaa74('0xf')]);router[_0xaa74('0x10')]('/:id',auth[_0xaa74('0x5')](),interaction[_0xaa74('0x11')](_0xaa74('0xe'),'mailinteraction:update'),controller['update']);router[_0xaa74('0x12')](_0xaa74('0x6'),auth[_0xaa74('0x5')](),interaction[_0xaa74('0x11')]('mail',_0xaa74('0x13')),controller[_0xaa74('0x14')]);router[_0xaa74('0x12')](_0xaa74('0xd'),auth['isAuthenticated'](),controller[_0xaa74('0x15')]);module[_0xaa74('0x16')]=router; \ No newline at end of file +var _0x944f=['getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','put','mailinteraction:update','update','tracked','destroy','delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x944f,0x154));var _0xf944=function(_0x49ca6b,_0x3ba842){_0x49ca6b=_0x49ca6b-0x0;var _0x1d957f=_0x944f[_0x49ca6b];return _0x1d957f;};'use strict';var express=require(_0xf944('0x0'));var router=express['Router']();var auth=require(_0xf944('0x1'));var interaction=require(_0xf944('0x2'));var controller=require(_0xf944('0x3'));router[_0xf944('0x4')]('/',auth[_0xf944('0x5')](),controller['index']);router[_0xf944('0x4')](_0xf944('0x6'),auth[_0xf944('0x5')](),controller[_0xf944('0x7')]);router[_0xf944('0x4')](_0xf944('0x8'),auth[_0xf944('0x5')](),controller[_0xf944('0x9')]);router[_0xf944('0x4')](_0xf944('0xa'),auth[_0xf944('0x5')](),controller[_0xf944('0xb')]);router['get'](_0xf944('0xc'),auth[_0xf944('0x5')](),controller[_0xf944('0xd')]);router[_0xf944('0xe')]('/',auth['isAuthenticated'](),controller[_0xf944('0xf')]);router['post'](_0xf944('0xa'),auth[_0xf944('0x5')](),controller[_0xf944('0x10')]);router[_0xf944('0xe')](_0xf944('0x11'),auth[_0xf944('0x5')](),interaction['tracked'](_0xf944('0x12'),'mailinteraction:addtags'),controller['addTags']);router[_0xf944('0x13')]('/:id',auth[_0xf944('0x5')](),interaction['tracked'](_0xf944('0x12'),_0xf944('0x14')),controller[_0xf944('0x15')]);router['delete'](_0xf944('0x8'),auth[_0xf944('0x5')](),interaction[_0xf944('0x16')]('mail','mailinteraction:destroy'),controller[_0xf944('0x17')]);router[_0xf944('0x18')]('/:id/tags',auth[_0xf944('0x5')](),controller[_0xf944('0x19')]);module[_0xf944('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 8176a94..16deb56 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 _0x407d=['iconv','DATE','STRING','TEXT','long','ENUM','out','BOOLEAN','sequelize'];(function(_0x5d7caf,_0x32cb40){var _0x5f09f3=function(_0x2f2fd7){while(--_0x2f2fd7){_0x5d7caf['push'](_0x5d7caf['shift']());}};_0x5f09f3(++_0x32cb40);}(_0x407d,0x19d));var _0xd407=function(_0x11e1a8,_0x3b2830){_0x11e1a8=_0x11e1a8-0x0;var _0x33e768=_0x407d[_0x11e1a8];return _0x33e768;};'use strict';var Sequelize=require(_0xd407('0x0'));var iconv=require(_0xd407('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd407('0x2')]},'disposition':{'type':Sequelize[_0xd407('0x3')]},'secondDisposition':{'type':Sequelize[_0xd407('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd407('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd407('0x4')](_0xd407('0x5'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd407('0x2')]},'substatus':{'type':Sequelize[_0xd407('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd407('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd407('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd407('0x6')]('in',_0xd407('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd407('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x4dd1=['out','DATE','sequelize','exports','BOOLEAN','STRING','TEXT','long','ENUM'];(function(_0x30ed24,_0x1d037d){var _0x50cdb1=function(_0x4ebd67){while(--_0x4ebd67){_0x30ed24['push'](_0x30ed24['shift']());}};_0x50cdb1(++_0x1d037d);}(_0x4dd1,0xbf));var _0x14dd=function(_0x2bfa25,_0x51fb43){_0x2bfa25=_0x2bfa25-0x0;var _0x1bc227=_0x4dd1[_0x2bfa25];return _0x1bc227;};'use strict';var Sequelize=require(_0x14dd('0x0'));var iconv=require('iconv');module[_0x14dd('0x1')]={'closed':{'type':Sequelize[_0x14dd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x14dd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x14dd('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x14dd('0x3')](0x1fe)},'to':{'type':Sequelize[_0x14dd('0x3')]},'cc':{'type':Sequelize[_0x14dd('0x4')](_0x14dd('0x5'))},'subject':{'type':Sequelize[_0x14dd('0x4')]()},'attach':{'type':Sequelize[_0x14dd('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x14dd('0x6')]('in',_0x14dd('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x14dd('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x14dd('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x14dd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5931b2b..3624899 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 _0x737d=['findAll','mail','user','catch','show','params','model','query','keys','filters','attributes','intersection','includeAll','merge','options','find','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','fields','length','hasOwnProperty','nolimit','sort','pick','where','MailInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','from','createdAt','headers','Bcc','basename','existsSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','path','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','then','stack','name','send','index','MailInteraction','rawAttributes','fieldName','type','key','getOptions'];(function(_0x17031a,_0x1fc6dc){var _0x1656fc=function(_0x5be7c5){while(--_0x5be7c5){_0x17031a['push'](_0x17031a['shift']());}};_0x1656fc(++_0x1fc6dc);}(_0x737d,0xbc));var _0xd737=function(_0x357cd3,_0x3cb5ed){_0x357cd3=_0x357cd3-0x0;var _0x15e6fb=_0x737d[_0x357cd3];return _0x15e6fb;};'use strict';var emlformat=require(_0xd737('0x0'));var rimraf=require(_0xd737('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xd737('0x2'));var fs=require('fs');var _=require('lodash');var juice=require(_0xd737('0x3'));var Redis=require('ioredis');var interaction=require(_0xd737('0x4'));var qs=require(_0xd737('0x5'));var logger=require(_0xd737('0x6'))(_0xd737('0x7'));var config=require(_0xd737('0x8'));var db=require(_0xd737('0x9'))['db'];var htmlEntities=require(_0xd737('0xa'));config[_0xd737('0xb')]=_[_0xd737('0xc')](config[_0xd737('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd737('0xd'))(new Redis(config[_0xd737('0xb')]));require('./mailInteraction.socket')[_0xd737('0xe')](socket);function respondWithStatusCode(_0x42afa9,_0x4f8018){_0x4f8018=_0x4f8018||0xcc;return function(_0x2d035c){if(_0x2d035c){return _0x42afa9[_0xd737('0xf')](_0x4f8018);}return _0x42afa9['status'](_0x4f8018)[_0xd737('0x10')]();};}function respondWithResult(_0x516dc8,_0xb79870){_0xb79870=_0xb79870||0xc8;return function(_0x326f9c){if(_0x326f9c){return _0x516dc8['status'](_0xb79870)['json'](_0x326f9c);}};}function respondWithFilteredResult(_0x34e5c9,_0x9586da){return function(_0x540b2d){if(_0x540b2d){var _0x11c3ed=typeof _0x9586da[_0xd737('0x11')]===_0xd737('0x12')&&typeof _0x9586da[_0xd737('0x13')]===_0xd737('0x12');var _0x1b1fc1=_0x540b2d[_0xd737('0x14')];var _0x24e8b6=_0x11c3ed?0x0:_0x9586da['offset'];var _0x5cdee8=_0x11c3ed?_0x540b2d[_0xd737('0x14')]:_0x9586da[_0xd737('0x11')]+_0x9586da[_0xd737('0x13')];var _0x3d15ba;if(_0x5cdee8>=_0x1b1fc1){_0x5cdee8=_0x1b1fc1;_0x3d15ba=0xc8;}else{_0x3d15ba=0xce;}_0x34e5c9[_0xd737('0x15')](_0x3d15ba);return _0x34e5c9[_0xd737('0x16')](_0xd737('0x17'),_0x24e8b6+'-'+_0x5cdee8+'/'+_0x1b1fc1)[_0xd737('0x18')](_0x540b2d);}return null;};}function saveUpdates(_0x508e0b){return function(_0x5901da){if(_0x5901da){return _0x5901da[_0xd737('0x19')](_0x508e0b)['then'](function(_0x4f16d7){return _0x4f16d7;});}return null;};}function removeEntity(_0x4df39d){return function(_0x50327b){if(_0x50327b){return _0x50327b[_0xd737('0x1a')]()[_0xd737('0x1b')](function(){_0x4df39d[_0xd737('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45ac85){return function(_0x4c9fa9){if(!_0x4c9fa9){_0x45ac85[_0xd737('0xf')](0x194);}return _0x4c9fa9;};}function handleError(_0xaba5de,_0x187bad){_0x187bad=_0x187bad||0x1f4;return function(_0x2056ae){logger['error'](_0x2056ae[_0xd737('0x1c')]);if(_0x2056ae['name']){delete _0x2056ae[_0xd737('0x1d')];}_0xaba5de['status'](_0x187bad)[_0xd737('0x1e')](_0x2056ae);};}exports[_0xd737('0x1f')]=function(_0x1cb9af,_0x3da698){var _0x44c974={};var _0x507029=_['map'](db[_0xd737('0x20')][_0xd737('0x21')],function(_0x500c68){return{'name':_0x500c68[_0xd737('0x22')],'type':_0x500c68[_0xd737('0x23')][_0xd737('0x24')]};});_0x44c974=qs[_0xd737('0x25')](_0x507029,_0x1cb9af);return interaction[_0xd737('0x26')](_0xd737('0x27'),_0x1cb9af['query'],_0x1cb9af[_0xd737('0x28')],_0x44c974,_0x507029)[_0xd737('0x1b')](respondWithFilteredResult(_0x3da698,_0x44c974))[_0xd737('0x29')](handleError(_0x3da698,null));};exports[_0xd737('0x2a')]=function(_0x5b6bf7,_0x53029a){var _0x286c94={'raw':![],'where':{'id':_0x5b6bf7[_0xd737('0x2b')]['id']}},_0x484cb4={};_0x484cb4[_0xd737('0x2c')]=_['keys'](db[_0xd737('0x20')][_0xd737('0x21')]);_0x484cb4[_0xd737('0x2d')]=_[_0xd737('0x2e')](_0x5b6bf7[_0xd737('0x2d')]);_0x484cb4[_0xd737('0x2f')]=_['intersection'](_0x484cb4[_0xd737('0x2c')],_0x484cb4[_0xd737('0x2d')]);_0x286c94[_0xd737('0x30')]=_[_0xd737('0x31')](_0x484cb4[_0xd737('0x2c')],qs['fields'](_0x5b6bf7['query']['fields']));_0x286c94['attributes']=_0x286c94[_0xd737('0x30')]['length']?_0x286c94[_0xd737('0x30')]:_0x484cb4[_0xd737('0x2c')];if(_0x5b6bf7['query'][_0xd737('0x32')]){_0x286c94['include']=[{'all':!![]}];}_0x286c94=_[_0xd737('0x33')]({},_0x286c94,_0x5b6bf7[_0xd737('0x34')]);return db[_0xd737('0x20')][_0xd737('0x35')](_0x286c94)[_0xd737('0x1b')](handleEntityNotFound(_0x53029a,null))[_0xd737('0x1b')](respondWithResult(_0x53029a,null))['catch'](handleError(_0x53029a,null));};exports[_0xd737('0x36')]=function(_0x161ede,_0x3032a1){return db[_0xd737('0x20')][_0xd737('0x36')](_0x161ede[_0xd737('0x37')],{})[_0xd737('0x1b')](respondWithResult(_0x3032a1,0xc9))[_0xd737('0x29')](handleError(_0x3032a1,null));};exports['update']=function(_0x17251e,_0x5a0018){if(_0x17251e['body']['id']){delete _0x17251e[_0xd737('0x37')]['id'];}return db[_0xd737('0x20')][_0xd737('0x35')]({'where':{'id':_0x17251e[_0xd737('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5a0018,null))[_0xd737('0x1b')](saveUpdates(_0x17251e[_0xd737('0x37')],null))[_0xd737('0x1b')](respondWithResult(_0x5a0018,null))[_0xd737('0x29')](handleError(_0x5a0018,null));};exports[_0xd737('0x1a')]=function(_0x2e1d53,_0xf2000e){return db['MailInteraction'][_0xd737('0x35')]({'where':{'id':_0x2e1d53['params']['id']}})['then'](handleEntityNotFound(_0xf2000e,null))['then'](removeEntity(_0xf2000e,null))[_0xd737('0x29')](handleError(_0xf2000e,null));};exports[_0xd737('0x38')]=function(_0x3f2430,_0x4f12aa){return db['MailInteraction'][_0xd737('0x38')]()[_0xd737('0x1b')](respondWithResult(_0x4f12aa,null))[_0xd737('0x29')](handleError(_0x4f12aa,null));};exports[_0xd737('0x39')]=function(_0x29aa2d,_0x3f523d){return db[_0xd737('0x3a')][_0xd737('0x35')]({'where':{'id':_0x29aa2d[_0xd737('0x2b')]['id']}})[_0xd737('0x1b')](handleEntityNotFound(_0x3f523d,null))[_0xd737('0x1b')](function(_0x3f4e54){if(_0x3f4e54){return _0x3f4e54[_0xd737('0x39')](_0x29aa2d['body'][_0xd737('0x3b')],_[_0xd737('0x3c')](_0x29aa2d[_0xd737('0x37')],['ids','id'])||{});}})[_0xd737('0x1b')](respondWithResult(_0x3f523d,null))[_0xd737('0x29')](handleError(_0x3f523d,null));};exports[_0xd737('0x3d')]=function(_0x27ab92,_0x59a813){var _0x4a345d={'raw':![],'where':{}};var _0x23d914={};var _0x37d152={'count':0x0,'rows':[]};return db[_0xd737('0x20')]['findOne']({'where':{'id':_0x27ab92[_0xd737('0x2b')]['id']}})[_0xd737('0x1b')](handleEntityNotFound(_0x59a813,null))[_0xd737('0x1b')](function(_0x143f26){if(_0x143f26){_0x23d914[_0xd737('0x2c')]=_[_0xd737('0x2e')](db[_0xd737('0x3a')]['rawAttributes']);_0x23d914['query']=_[_0xd737('0x2e')](_0x27ab92['query']);_0x23d914[_0xd737('0x2f')]=_[_0xd737('0x31')](_0x23d914[_0xd737('0x2c')],_0x23d914['query']);_0x4a345d[_0xd737('0x30')]=_['intersection'](_0x23d914[_0xd737('0x2c')],qs['fields'](_0x27ab92[_0xd737('0x2d')][_0xd737('0x3e')]));_0x4a345d['attributes']=_0x4a345d['attributes'][_0xd737('0x3f')]?_0x4a345d[_0xd737('0x30')]:_0x23d914[_0xd737('0x2c')];if(!_0x27ab92[_0xd737('0x2d')][_0xd737('0x40')](_0xd737('0x41'))){_0x4a345d['limit']=qs[_0xd737('0x13')](_0x27ab92[_0xd737('0x2d')][_0xd737('0x13')]);_0x4a345d[_0xd737('0x11')]=qs[_0xd737('0x11')](_0x27ab92['query'][_0xd737('0x11')]);}_0x4a345d['order']=qs[_0xd737('0x42')](_0x27ab92['query'][_0xd737('0x42')]);_0x4a345d['where']=qs[_0xd737('0x2f')](_[_0xd737('0x43')](_0x27ab92[_0xd737('0x2d')],_0x23d914[_0xd737('0x2f')]));_0x4a345d[_0xd737('0x44')][_0xd737('0x45')]=_0x143f26['id'];if(_0x27ab92[_0xd737('0x2d')][_0xd737('0x46')]){_0x4a345d[_0xd737('0x44')]=_[_0xd737('0x33')](_0x4a345d[_0xd737('0x44')],{'$or':_[_0xd737('0x47')](_0x4a345d[_0xd737('0x30')],function(_0x5e1d1f){var _0x38a332={};_0x38a332[_0x5e1d1f]={'$like':'%'+_0x27ab92['query']['filter']+'%'};return _0x38a332;})});}if(_0x27ab92['query'][_0xd737('0x48')]){var _0x6cf40e=_0x27ab92[_0xd737('0x2d')][_0xd737('0x48')][_0xd737('0x49')](',');var _0x9b6cc3={};_0x9b6cc3[_0x6cf40e[0x0]]={'$gte':moment(_0x6cf40e[0x1])[_0xd737('0x4a')](_0xd737('0x4b'))};_0x4a345d[_0xd737('0x44')]=_[_0xd737('0x33')](_0x4a345d[_0xd737('0x44')],_0x9b6cc3);}_0x4a345d=_[_0xd737('0x33')]({},_0x4a345d,_0x27ab92[_0xd737('0x34')]);return db[_0xd737('0x3a')][_0xd737('0x14')]({'where':_0x4a345d[_0xd737('0x44')]})['then'](function(_0x2d4206){_0x37d152[_0xd737('0x14')]=_0x2d4206;if(_0x27ab92[_0xd737('0x2d')][_0xd737('0x32')]){_0x4a345d[_0xd737('0x4c')]=[{'all':!![]}];}return db[_0xd737('0x3a')]['findAll'](_0x4a345d);})['then'](function(_0x1e9ce8){if(_0x27ab92['query'][_0xd737('0x4d')]===_0xd737('0x4e')){for(var _0xd93951=0x0;_0xd93951<_0x1e9ce8['length'];_0xd93951++){_0x1e9ce8[_0xd93951][_0xd737('0x37')]=juice(_0x1e9ce8[_0xd93951]['body']);}}_0x37d152[_0xd737('0x4f')]=_0x1e9ce8;return _0x37d152;});}})[_0xd737('0x1b')](respondWithFilteredResult(_0x59a813,_0x4a345d))['catch'](handleError(_0x59a813,null));};exports[_0xd737('0x50')]=function(_0x315197,_0x4076ba){return db[_0xd737('0x20')]['find']({'where':{'id':_0x315197[_0xd737('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4076ba,null))[_0xd737('0x1b')](function(_0x2c28c8){if(_0x2c28c8){return _0x2c28c8[_0xd737('0x51')](_0x315197['body'][_0xd737('0x3b')],_['omit'](_0x315197[_0xd737('0x37')],[_0xd737('0x3b'),'id'])||{})[_0xd737('0x52')](function(){return db[_0xd737('0x53')][_0xd737('0x26')]({'attributes':['id',_0xd737('0x1d'),_0xd737('0x54')],'where':{'id':_0x315197[_0xd737('0x37')][_0xd737('0x3b')]}});})['then'](function(_0xde79ee){socket[_0xd737('0x55')]('mailInteractionTags:save',{'id':Number(_0x315197[_0xd737('0x2b')]['id']),'tags':_0xde79ee||[]});return{'id':Number(_0x315197[_0xd737('0x2b')]['id']),'tags':_0xde79ee||[]};});}})['then'](respondWithResult(_0x4076ba,null))[_0xd737('0x29')](handleError(_0x4076ba,null));};exports[_0xd737('0x56')]=function(_0x465ec1,_0x1ce511){return db['MailInteraction']['find']({'where':{'id':_0x465ec1[_0xd737('0x2b')]['id']}})[_0xd737('0x1b')](handleEntityNotFound(_0x1ce511,null))[_0xd737('0x1b')](function(_0x2003ad){if(_0x2003ad){return _0x2003ad[_0xd737('0x56')](_0x465ec1[_0xd737('0x2d')][_0xd737('0x3b')]);}})[_0xd737('0x1b')](respondWithStatusCode(_0x1ce511,null))[_0xd737('0x29')](handleError(_0x1ce511,null));};exports[_0xd737('0x57')]=function(_0x4e5475,_0x2b8a90){var _0x32045f=moment()[_0xd737('0x58')]()['toString']();var _0xc69025=path[_0xd737('0x59')](config[_0xd737('0x5a')],_0xd737('0x5b'),'files',_0xd737('0x5c'));var _0x5e65c0=path[_0xd737('0x59')](config[_0xd737('0x5a')],_0xd737('0x5b'),_0xd737('0x5d'),_0xd737('0x5e'));var _0x4e66b9=path['join'](_0xc69025,_0x32045f);var _0x1876e3=util[_0xd737('0x4a')](_0xd737('0x5f'),_0x4e5475[_0xd737('0x2b')]['id'],_0x32045f);var _0x1a1196=path['join'](_0xc69025,_0x1876e3);var _0x69eee2=[];if(_0x4e5475[_0xd737('0x2d')][_0xd737('0x5e')]){_0x69eee2['push']({'model':db[_0xd737('0x60')],'as':_0xd737('0x61'),'raw':!![]});}var _0x597f4e=[{'model':db[_0xd737('0x3a')],'as':_0xd737('0x62'),'attributes':['id','body','from','to','cc',_0xd737('0x63'),_0xd737('0x64'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x69eee2}];return db[_0xd737('0x20')][_0xd737('0x35')]({'where':{'id':_0x4e5475['params']['id']},'include':_0x597f4e})[_0xd737('0x1b')](handleEntityNotFound(_0x2b8a90,null))[_0xd737('0x1b')](function(_0x4020df){if(_0x4020df&&_0x4020df['Messages']){var _0x179823=_0x4020df[_0xd737('0x65')]({'plain':!![]});fs[_0xd737('0x66')](_0x4e66b9);return BPromise[_0xd737('0x67')](_0x179823[_0xd737('0x62')],function(_0xd18b4d,_0x55e235){var _0x46d2c8={'from':_0xd18b4d[_0xd737('0x68')],'to':_0xd18b4d['to'],'subject':_0xd18b4d[_0xd737('0x64')],'html':htmlEntities['decode'](_0xd18b4d[_0xd737('0x37')]),'headers':{'Date':moment(_0xd18b4d[_0xd737('0x69')])[_0xd737('0x4a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xd18b4d['cc']){_0x46d2c8[_0xd737('0x6a')]['Cc']=_0xd18b4d['cc'];}if(_0xd18b4d[_0xd737('0x63')]){_0x46d2c8['headers'][_0xd737('0x6b')]=_0xd18b4d[_0xd737('0x63')];}return new BPromise(function(_0x33eeaf,_0x4bcee0){if(_0xd18b4d[_0xd737('0x61')]){for(var _0x380257=0x0;_0x380257<_0xd18b4d['Attachments'][_0xd737('0x3f')];_0x380257++){var _0x22441a=_0xd18b4d[_0xd737('0x61')][_0x380257];var _0x41e985=path['join'](_0x5e65c0,_0x22441a[_0xd737('0x6c')]);if(fs[_0xd737('0x6d')](_0x41e985)){_0x46d2c8['attachments']['push']({'name':_0x22441a[_0xd737('0x1d')],'contentType':_0x22441a['type'],'data':fs['readFileSync'](_0x41e985)});}}}emlformat['build'](_0x46d2c8,function(_0x11c9f1,_0x53f796){if(_0x11c9f1)return _0x4bcee0(_0x11c9f1);fs[_0xd737('0x6e')](path[_0xd737('0x59')](_0x4e66b9,util[_0xd737('0x4a')](_0xd737('0x6f'),_0x55e235)),_0x53f796);return _0x33eeaf(_0x53f796);});});})['then'](function(){return new BPromise(function(_0x47138f,_0x291ca2){zipdir(_0x4e66b9,{'saveTo':_0x1a1196},function(_0x18aa98,_0x2e39f9){if(_0x18aa98)return _0x291ca2(_0x18aa98);return _0x47138f(_0x2e39f9);});})[_0xd737('0x1b')](function(){return new BPromise(function(_0x315d96,_0x27902d){rimraf(_0x4e66b9,function(_0x4e8cf8){if(_0x4e8cf8)_0x27902d(_0x4e8cf8);return _0x315d96();});});})[_0xd737('0x1b')](function(){return _0x2b8a90['download'](_0x1a1196,_0x1876e3,function(_0xb88eb5){if(!_0xb88eb5)fs[_0xd737('0x70')](_0x1a1196);});});});}else{return _0x2b8a90[_0xd737('0xf')](0xc8);}})[_0xd737('0x29')](handleError(_0x2b8a90,null));}; \ No newline at end of file +var _0xd8ee=['options','find','create','body','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','filters','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','Tag','color','removeTags','download','unix','toString','join','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','then','status','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','mail','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge'];(function(_0x176d14,_0x3984ea){var _0x89522c=function(_0x3aba48){while(--_0x3aba48){_0x176d14['push'](_0x176d14['shift']());}};_0x89522c(++_0x3984ea);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x47fa5b,_0x31323c){_0x47fa5b=_0x47fa5b-0x0;var _0x3b10ca=_0xd8ee[_0x47fa5b];return _0x3b10ca;};'use strict';var emlformat=require(_0xed8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed8e('0x1'));var moment=require(_0xed8e('0x2'));var BPromise=require(_0xed8e('0x3'));var util=require('util');var path=require(_0xed8e('0x4'));var fs=require('fs');var _=require(_0xed8e('0x5'));var juice=require(_0xed8e('0x6'));var Redis=require(_0xed8e('0x7'));var interaction=require(_0xed8e('0x8'));var qs=require(_0xed8e('0x9'));var logger=require('../../config/logger')(_0xed8e('0xa'));var config=require(_0xed8e('0xb'));var db=require(_0xed8e('0xc'))['db'];var htmlEntities=require(_0xed8e('0xd'));config[_0xed8e('0xe')]=_[_0xed8e('0xf')](config[_0xed8e('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed8e('0xe')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3edaee,_0x5b9066){_0x5b9066=_0x5b9066||0xcc;return function(_0x7357ad){if(_0x7357ad){return _0x3edaee[_0xed8e('0x10')](_0x5b9066);}return _0x3edaee['status'](_0x5b9066)[_0xed8e('0x11')]();};}function respondWithResult(_0x128b6e,_0x5aa728){_0x5aa728=_0x5aa728||0xc8;return function(_0x409f8f){if(_0x409f8f){return _0x128b6e['status'](_0x5aa728)[_0xed8e('0x12')](_0x409f8f);}};}function respondWithFilteredResult(_0x20f34b,_0x2d9925){return function(_0xd4559b){if(_0xd4559b){var _0x35a6db=typeof _0x2d9925[_0xed8e('0x13')]===_0xed8e('0x14')&&typeof _0x2d9925[_0xed8e('0x15')]===_0xed8e('0x14');var _0x17b3c7=_0xd4559b[_0xed8e('0x16')];var _0x28dd7b=_0x35a6db?0x0:_0x2d9925[_0xed8e('0x13')];var _0x4cefe4=_0x35a6db?_0xd4559b[_0xed8e('0x16')]:_0x2d9925['offset']+_0x2d9925[_0xed8e('0x15')];var _0xec2257;if(_0x4cefe4>=_0x17b3c7){_0x4cefe4=_0x17b3c7;_0xec2257=0xc8;}else{_0xec2257=0xce;}_0x20f34b['status'](_0xec2257);return _0x20f34b[_0xed8e('0x17')](_0xed8e('0x18'),_0x28dd7b+'-'+_0x4cefe4+'/'+_0x17b3c7)[_0xed8e('0x12')](_0xd4559b);}return null;};}function saveUpdates(_0x51d6a2){return function(_0x4a19d9){if(_0x4a19d9){return _0x4a19d9['update'](_0x51d6a2)[_0xed8e('0x19')](function(_0x1c8ceb){return _0x1c8ceb;});}return null;};}function removeEntity(_0x1ff8d9){return function(_0x421e50){if(_0x421e50){return _0x421e50['destroy']()['then'](function(){_0x1ff8d9[_0xed8e('0x1a')](0xcc)[_0xed8e('0x11')]();});}};}function handleEntityNotFound(_0x29e6ca){return function(_0x2a4c3f){if(!_0x2a4c3f){_0x29e6ca[_0xed8e('0x10')](0x194);}return _0x2a4c3f;};}function handleError(_0x5a042a,_0x5619b2){_0x5619b2=_0x5619b2||0x1f4;return function(_0xe2f3da){logger['error'](_0xe2f3da[_0xed8e('0x1b')]);if(_0xe2f3da[_0xed8e('0x1c')]){delete _0xe2f3da['name'];}_0x5a042a[_0xed8e('0x1a')](_0x5619b2)[_0xed8e('0x1d')](_0xe2f3da);};}exports['index']=function(_0x65fe20,_0x4986cf){var _0x53f9d0={};var _0x26c644=_[_0xed8e('0x1e')](db[_0xed8e('0x1f')][_0xed8e('0x20')],function(_0x177e05){return{'name':_0x177e05[_0xed8e('0x21')],'type':_0x177e05[_0xed8e('0x22')][_0xed8e('0x23')]};});_0x53f9d0=qs[_0xed8e('0x24')](_0x26c644,_0x65fe20);return interaction[_0xed8e('0x25')](_0xed8e('0x26'),_0x65fe20['query'],_0x65fe20['user'],_0x53f9d0,_0x26c644)['then'](respondWithFilteredResult(_0x4986cf,_0x53f9d0))[_0xed8e('0x27')](handleError(_0x4986cf,null));};exports[_0xed8e('0x28')]=function(_0x56ca88,_0x112f4b){var _0x518537={'raw':![],'where':{'id':_0x56ca88[_0xed8e('0x29')]['id']}},_0x3531ce={};_0x3531ce[_0xed8e('0x2a')]=_[_0xed8e('0x2b')](db[_0xed8e('0x1f')][_0xed8e('0x20')]);_0x3531ce[_0xed8e('0x2c')]=_[_0xed8e('0x2b')](_0x56ca88[_0xed8e('0x2c')]);_0x3531ce['filters']=_[_0xed8e('0x2d')](_0x3531ce[_0xed8e('0x2a')],_0x3531ce[_0xed8e('0x2c')]);_0x518537[_0xed8e('0x2e')]=_[_0xed8e('0x2d')](_0x3531ce[_0xed8e('0x2a')],qs[_0xed8e('0x2f')](_0x56ca88[_0xed8e('0x2c')][_0xed8e('0x2f')]));_0x518537[_0xed8e('0x2e')]=_0x518537[_0xed8e('0x2e')][_0xed8e('0x30')]?_0x518537[_0xed8e('0x2e')]:_0x3531ce[_0xed8e('0x2a')];if(_0x56ca88[_0xed8e('0x2c')][_0xed8e('0x31')]){_0x518537[_0xed8e('0x32')]=[{'all':!![]}];}_0x518537=_[_0xed8e('0x33')]({},_0x518537,_0x56ca88[_0xed8e('0x34')]);return db[_0xed8e('0x1f')][_0xed8e('0x35')](_0x518537)[_0xed8e('0x19')](handleEntityNotFound(_0x112f4b,null))[_0xed8e('0x19')](respondWithResult(_0x112f4b,null))[_0xed8e('0x27')](handleError(_0x112f4b,null));};exports[_0xed8e('0x36')]=function(_0x49623c,_0x2b2e3a){return db[_0xed8e('0x1f')][_0xed8e('0x36')](_0x49623c[_0xed8e('0x37')],{})[_0xed8e('0x19')](respondWithResult(_0x2b2e3a,0xc9))['catch'](handleError(_0x2b2e3a,null));};exports['update']=function(_0x1b9f9e,_0x529e45){if(_0x1b9f9e[_0xed8e('0x37')]['id']){delete _0x1b9f9e[_0xed8e('0x37')]['id'];}return db[_0xed8e('0x1f')][_0xed8e('0x35')]({'where':{'id':_0x1b9f9e[_0xed8e('0x29')]['id']}})[_0xed8e('0x19')](handleEntityNotFound(_0x529e45,null))[_0xed8e('0x19')](saveUpdates(_0x1b9f9e[_0xed8e('0x37')],null))[_0xed8e('0x19')](respondWithResult(_0x529e45,null))['catch'](handleError(_0x529e45,null));};exports['destroy']=function(_0x2f80cd,_0x2760ca){return db[_0xed8e('0x1f')][_0xed8e('0x35')]({'where':{'id':_0x2f80cd[_0xed8e('0x29')]['id']}})['then'](handleEntityNotFound(_0x2760ca,null))['then'](removeEntity(_0x2760ca,null))[_0xed8e('0x27')](handleError(_0x2760ca,null));};exports[_0xed8e('0x38')]=function(_0x273a6f,_0x158d82){return db[_0xed8e('0x1f')][_0xed8e('0x38')]()[_0xed8e('0x19')](respondWithResult(_0x158d82,null))[_0xed8e('0x27')](handleError(_0x158d82,null));};exports[_0xed8e('0x39')]=function(_0x1e15c9,_0x4afea6){return db[_0xed8e('0x3a')]['find']({'where':{'id':_0x1e15c9[_0xed8e('0x29')]['id']}})[_0xed8e('0x19')](handleEntityNotFound(_0x4afea6,null))[_0xed8e('0x19')](function(_0x36ae79){if(_0x36ae79){return _0x36ae79[_0xed8e('0x39')](_0x1e15c9['body']['ids'],_[_0xed8e('0x3b')](_0x1e15c9['body'],[_0xed8e('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x4afea6,null))[_0xed8e('0x27')](handleError(_0x4afea6,null));};exports[_0xed8e('0x3d')]=function(_0x3d3a7a,_0x353c3e){var _0x329b89={'raw':![],'where':{}};var _0x16f14a={};var _0x47d211={'count':0x0,'rows':[]};return db['MailInteraction'][_0xed8e('0x3e')]({'where':{'id':_0x3d3a7a[_0xed8e('0x29')]['id']}})['then'](handleEntityNotFound(_0x353c3e,null))[_0xed8e('0x19')](function(_0x29c279){if(_0x29c279){_0x16f14a[_0xed8e('0x2a')]=_['keys'](db['MailMessage'][_0xed8e('0x20')]);_0x16f14a[_0xed8e('0x2c')]=_['keys'](_0x3d3a7a[_0xed8e('0x2c')]);_0x16f14a[_0xed8e('0x3f')]=_[_0xed8e('0x2d')](_0x16f14a[_0xed8e('0x2a')],_0x16f14a[_0xed8e('0x2c')]);_0x329b89[_0xed8e('0x2e')]=_[_0xed8e('0x2d')](_0x16f14a[_0xed8e('0x2a')],qs[_0xed8e('0x2f')](_0x3d3a7a[_0xed8e('0x2c')][_0xed8e('0x2f')]));_0x329b89['attributes']=_0x329b89[_0xed8e('0x2e')][_0xed8e('0x30')]?_0x329b89[_0xed8e('0x2e')]:_0x16f14a[_0xed8e('0x2a')];if(!_0x3d3a7a[_0xed8e('0x2c')]['hasOwnProperty'](_0xed8e('0x40'))){_0x329b89['limit']=qs[_0xed8e('0x15')](_0x3d3a7a['query'][_0xed8e('0x15')]);_0x329b89[_0xed8e('0x13')]=qs[_0xed8e('0x13')](_0x3d3a7a[_0xed8e('0x2c')][_0xed8e('0x13')]);}_0x329b89[_0xed8e('0x41')]=qs[_0xed8e('0x42')](_0x3d3a7a[_0xed8e('0x2c')]['sort']);_0x329b89['where']=qs[_0xed8e('0x3f')](_[_0xed8e('0x43')](_0x3d3a7a['query'],_0x16f14a[_0xed8e('0x3f')]));_0x329b89[_0xed8e('0x44')][_0xed8e('0x45')]=_0x29c279['id'];if(_0x3d3a7a[_0xed8e('0x2c')][_0xed8e('0x46')]){_0x329b89['where']=_[_0xed8e('0x33')](_0x329b89[_0xed8e('0x44')],{'$or':_[_0xed8e('0x1e')](_0x329b89['attributes'],function(_0x3c4a0c){var _0x107860={};_0x107860[_0x3c4a0c]={'$like':'%'+_0x3d3a7a[_0xed8e('0x2c')][_0xed8e('0x46')]+'%'};return _0x107860;})});}if(_0x3d3a7a['query'][_0xed8e('0x47')]){var _0x195943=_0x3d3a7a[_0xed8e('0x2c')]['$gte']['split'](',');var _0x4b139e={};_0x4b139e[_0x195943[0x0]]={'$gte':moment(_0x195943[0x1])[_0xed8e('0x48')](_0xed8e('0x49'))};_0x329b89[_0xed8e('0x44')]=_[_0xed8e('0x33')](_0x329b89[_0xed8e('0x44')],_0x4b139e);}_0x329b89=_['merge']({},_0x329b89,_0x3d3a7a[_0xed8e('0x34')]);return db[_0xed8e('0x3a')]['count']({'where':_0x329b89[_0xed8e('0x44')]})[_0xed8e('0x19')](function(_0x59164a){_0x47d211['count']=_0x59164a;if(_0x3d3a7a['query']['includeAll']){_0x329b89[_0xed8e('0x32')]=[{'all':!![]}];}return db[_0xed8e('0x3a')][_0xed8e('0x25')](_0x329b89);})[_0xed8e('0x19')](function(_0x9fa426){if(_0x3d3a7a[_0xed8e('0x2c')][_0xed8e('0x4a')]===_0xed8e('0x4b')){for(var _0x5ae27f=0x0;_0x5ae27f<_0x9fa426['length'];_0x5ae27f++){_0x9fa426[_0x5ae27f][_0xed8e('0x37')]=juice(_0x9fa426[_0x5ae27f]['body']);}}_0x47d211[_0xed8e('0x4c')]=_0x9fa426;return _0x47d211;});}})[_0xed8e('0x19')](respondWithFilteredResult(_0x353c3e,_0x329b89))[_0xed8e('0x27')](handleError(_0x353c3e,null));};exports[_0xed8e('0x4d')]=function(_0x3da66b,_0x40e7b0){return db[_0xed8e('0x1f')]['find']({'where':{'id':_0x3da66b[_0xed8e('0x29')]['id']}})[_0xed8e('0x19')](handleEntityNotFound(_0x40e7b0,null))[_0xed8e('0x19')](function(_0x36147f){if(_0x36147f){return _0x36147f[_0xed8e('0x4e')](_0x3da66b[_0xed8e('0x37')][_0xed8e('0x3c')],_[_0xed8e('0x3b')](_0x3da66b[_0xed8e('0x37')],[_0xed8e('0x3c'),'id'])||{})['spread'](function(){return db[_0xed8e('0x4f')]['findAll']({'attributes':['id',_0xed8e('0x1c'),_0xed8e('0x50')],'where':{'id':_0x3da66b[_0xed8e('0x37')][_0xed8e('0x3c')]}});})[_0xed8e('0x19')](function(_0x2681ef){socket['emit']('mailInteractionTags:save',{'id':Number(_0x3da66b[_0xed8e('0x29')]['id']),'tags':_0x2681ef||[]});return{'id':Number(_0x3da66b['params']['id']),'tags':_0x2681ef||[]};});}})['then'](respondWithResult(_0x40e7b0,null))[_0xed8e('0x27')](handleError(_0x40e7b0,null));};exports[_0xed8e('0x51')]=function(_0x5ece7e,_0x32d05c){return db['MailInteraction']['find']({'where':{'id':_0x5ece7e['params']['id']}})[_0xed8e('0x19')](handleEntityNotFound(_0x32d05c,null))[_0xed8e('0x19')](function(_0x3c7f77){if(_0x3c7f77){return _0x3c7f77[_0xed8e('0x51')](_0x5ece7e[_0xed8e('0x2c')][_0xed8e('0x3c')]);}})[_0xed8e('0x19')](respondWithStatusCode(_0x32d05c,null))['catch'](handleError(_0x32d05c,null));};exports[_0xed8e('0x52')]=function(_0x3aec9e,_0x4bf2e2){var _0x3252cf=moment()[_0xed8e('0x53')]()[_0xed8e('0x54')]();var _0x5ac94c=path[_0xed8e('0x55')](config['root'],'server',_0xed8e('0x56'),_0xed8e('0x57'));var _0x276cc0=path[_0xed8e('0x55')](config[_0xed8e('0x58')],'server',_0xed8e('0x56'),_0xed8e('0x59'));var _0x51eb53=path[_0xed8e('0x55')](_0x5ac94c,_0x3252cf);var _0x2e00e4=util[_0xed8e('0x48')](_0xed8e('0x5a'),_0x3aec9e[_0xed8e('0x29')]['id'],_0x3252cf);var _0x24807d=path[_0xed8e('0x55')](_0x5ac94c,_0x2e00e4);var _0x5eff5=[];if(_0x3aec9e[_0xed8e('0x2c')]['attachments']){_0x5eff5[_0xed8e('0x5b')]({'model':db[_0xed8e('0x5c')],'as':_0xed8e('0x5d'),'raw':!![]});}var _0x5541c5=[{'model':db[_0xed8e('0x3a')],'as':_0xed8e('0x5e'),'attributes':['id',_0xed8e('0x37'),_0xed8e('0x5f'),'to','cc',_0xed8e('0x60'),_0xed8e('0x61'),_0xed8e('0x62')],'where':{'secret':![]},'order':qs[_0xed8e('0x42')]('id'),'include':_0x5eff5}];return db[_0xed8e('0x1f')][_0xed8e('0x35')]({'where':{'id':_0x3aec9e[_0xed8e('0x29')]['id']},'include':_0x5541c5})['then'](handleEntityNotFound(_0x4bf2e2,null))['then'](function(_0x627dcc){if(_0x627dcc&&_0x627dcc[_0xed8e('0x5e')]){var _0x548571=_0x627dcc['get']({'plain':!![]});fs[_0xed8e('0x63')](_0x51eb53);return BPromise['each'](_0x548571[_0xed8e('0x5e')],function(_0x59fbce,_0x16dce7){var _0x34813c={'from':_0x59fbce['from'],'to':_0x59fbce['to'],'subject':_0x59fbce[_0xed8e('0x61')],'html':htmlEntities[_0xed8e('0x64')](_0x59fbce[_0xed8e('0x37')]),'headers':{'Date':moment(_0x59fbce[_0xed8e('0x62')])[_0xed8e('0x48')](_0xed8e('0x65'))},'attachments':[]};if(_0x59fbce['cc']){_0x34813c[_0xed8e('0x66')]['Cc']=_0x59fbce['cc'];}if(_0x59fbce[_0xed8e('0x60')]){_0x34813c[_0xed8e('0x66')]['Bcc']=_0x59fbce['bcc'];}return new BPromise(function(_0x41cba5,_0x371093){if(_0x59fbce[_0xed8e('0x5d')]){for(var _0x2b0b9a=0x0;_0x2b0b9a<_0x59fbce['Attachments']['length'];_0x2b0b9a++){var _0x4188d=_0x59fbce['Attachments'][_0x2b0b9a];var _0x1927f8=path['join'](_0x276cc0,_0x4188d[_0xed8e('0x67')]);if(fs[_0xed8e('0x68')](_0x1927f8)){_0x34813c[_0xed8e('0x59')][_0xed8e('0x5b')]({'name':_0x4188d[_0xed8e('0x1c')],'contentType':_0x4188d['type'],'data':fs[_0xed8e('0x69')](_0x1927f8)});}}}emlformat[_0xed8e('0x6a')](_0x34813c,function(_0xbe684c,_0x3aef4f){if(_0xbe684c)return _0x371093(_0xbe684c);fs[_0xed8e('0x6b')](path[_0xed8e('0x55')](_0x51eb53,util['format'](_0xed8e('0x6c'),_0x16dce7)),_0x3aef4f);return _0x41cba5(_0x3aef4f);});});})[_0xed8e('0x19')](function(){return new BPromise(function(_0x3a975d,_0x54ae51){zipdir(_0x51eb53,{'saveTo':_0x24807d},function(_0x3da324,_0x226f06){if(_0x3da324)return _0x54ae51(_0x3da324);return _0x3a975d(_0x226f06);});})[_0xed8e('0x19')](function(){return new BPromise(function(_0x1eb26b,_0x3a7960){rimraf(_0x51eb53,function(_0x50a78f){if(_0x50a78f)_0x3a7960(_0x50a78f);return _0x1eb26b();});});})['then'](function(){return _0x4bf2e2[_0xed8e('0x52')](_0x24807d,_0x2e00e4,function(_0x3756a3){if(!_0x3756a3)fs[_0xed8e('0x6d')](_0x24807d);});});});}else{return _0x4bf2e2[_0xed8e('0x10')](0xc8);}})[_0xed8e('0x27')](handleError(_0x4bf2e2,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3e0c1ab..a2d4f29 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 _0x90ac=['../../mysqldb','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','length','emit','hasOwnProperty','hook','exports','MailInteraction'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x90ac,0x6f));var _0xc90a=function(_0x4c6cab,_0x4bd5dc){_0x4c6cab=_0x4c6cab-0x0;var _0xbab0c4=_0x90ac[_0x4c6cab];return _0xbab0c4;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0xc90a('0x0')];var MailMessage=require(_0xc90a('0x1'))['db'][_0xc90a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc90a('0x3'),'afterUpdate':_0xc90a('0x4'),'afterDestroy':_0xc90a('0x5')};function emitEvent(_0x251a39){return function(_0x36dcfc,_0x1066e7,_0x236e64){_0x36dcfc[_0xc90a('0x6')]({'attributes':['id'],'raw':!![]})[_0xc90a('0x7')](function(_0x4eb18a){_0x36dcfc[_0xc90a('0x8')](_0xc90a('0x9'),_0x4eb18a[_0xc90a('0xa')](function(_0x2e1b14){return{'id':_0x2e1b14['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x36dcfc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc90a('0x7')](function(_0x4b3f89){_0x36dcfc[_0xc90a('0x8')]('unreadMessages',_0x4b3f89[_0xc90a('0xb')]);MailInteractionEvents[_0xc90a('0xc')](_0x251a39+':'+_0x36dcfc['id'],_0x36dcfc);MailInteractionEvents[_0xc90a('0xc')](_0x251a39,_0x36dcfc);_0x236e64(null);})['catch'](_0x236e64(null));};}for(var e in events){if(events[_0xc90a('0xd')](e)){var event=events[e];MailInteraction[_0xc90a('0xe')](e,emitEvent(event));}}module[_0xc90a('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x8362=['save','update','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x8362,0x132));var _0x2836=function(_0x208601,_0x4d1d65){_0x208601=_0x208601-0x0;var _0x522326=_0x8362[_0x208601];return _0x522326;};'use strict';var EventEmitter=require(_0x2836('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x2836('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2836('0x2'),'afterUpdate':_0x2836('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c7f14){return function(_0x380dcf,_0x465901,_0x4f88d4){_0x380dcf[_0x2836('0x4')]({'attributes':['id'],'raw':!![]})[_0x2836('0x5')](function(_0x3be521){_0x380dcf[_0x2836('0x6')](_0x2836('0x7'),_0x3be521[_0x2836('0x8')](function(_0x13a379){return{'id':_0x13a379['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x380dcf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2836('0x5')](function(_0x1e63e7){_0x380dcf[_0x2836('0x6')]('unreadMessages',_0x1e63e7[_0x2836('0x9')]);MailInteractionEvents[_0x2836('0xa')](_0x3c7f14+':'+_0x380dcf['id'],_0x380dcf);MailInteractionEvents[_0x2836('0xa')](_0x3c7f14,_0x380dcf);_0x4f88d4(null);})[_0x2836('0xb')](_0x4f88d4(null));};}for(var e in events){if(events[_0x2836('0xc')](e)){var event=events[e];MailInteraction[_0x2836('0xd')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 9bc72bc..f23a0fe 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 _0xfa58=['MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','substatusAt','closedAt','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa58,0x195));var _0x8fa5=function(_0x29f730,_0x23d7ed){_0x29f730=_0x29f730-0x0;var _0x189806=_0xfa58[_0x29f730];return _0x189806;};'use strict';var _=require(_0x8fa5('0x0'));var util=require(_0x8fa5('0x1'));var logger=require(_0x8fa5('0x2'))(_0x8fa5('0x3'));var moment=require(_0x8fa5('0x4'));var BPromise=require(_0x8fa5('0x5'));var rp=require(_0x8fa5('0x6'));var fs=require('fs');var path=require(_0x8fa5('0x7'));var rimraf=require(_0x8fa5('0x8'));var config=require('../../config/environment');var attributes=require(_0x8fa5('0x9'));module[_0x8fa5('0xa')]=function(_0x306244,_0x2e00cf){return _0x306244['define'](_0x8fa5('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x8fa5('0xc'),'fields':[_0x8fa5('0xd'),'to'],'type':_0x8fa5('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7894c6,_0x29e656,_0x242e8d){if(_0x7894c6[_0x8fa5('0xf')]){_0x7894c6['substatusAt']=moment()[_0x8fa5('0x10')](_0x8fa5('0x11'));}if(_0x7894c6[_0x8fa5('0x12')]){_0x7894c6['closedAt']=moment()[_0x8fa5('0x10')](_0x8fa5('0x11'));}_0x242e8d(null,_0x29e656);},'beforeUpdate':function(_0x5498bd,_0x275f27,_0x5512c8){if(_0x5498bd[_0x8fa5('0x13')](_0x8fa5('0xf'))){_0x5498bd[_0x8fa5('0x14')]=_0x5498bd[_0x8fa5('0xf')]?moment()[_0x8fa5('0x10')](_0x8fa5('0x11')):null;}if(_0x5498bd[_0x8fa5('0x13')](_0x8fa5('0x12'))){_0x5498bd[_0x8fa5('0x15')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5498bd[_0x8fa5('0xf')]=null;_0x5498bd[_0x8fa5('0x14')]=null;}_0x5512c8(null,_0x5498bd);},'afterUpdate':function(_0xcb7f7e,_0x544755,_0x1ab9f9){var _0x2e7bc1=_0x306244['models'];var _0x4b6cb2=_0xcb7f7e['get']({'plain':!![]});if(_0x4b6cb2[_0x8fa5('0x12')]){return _0x2e7bc1[_0x8fa5('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x4b6cb2['id']}})['then'](function(){_0x1ab9f9();})[_0x8fa5('0x17')](function(_0x58d13f){_0x1ab9f9(_0x58d13f);});}else{_0x1ab9f9();}}},'charset':_0x8fa5('0x18'),'collate':_0x8fa5('0x19')});}; \ No newline at end of file +var _0xbcd8=['format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','models','get','closed','update','then','utf8mb4_unicode_ci','lodash','util','api','moment','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xbcd8,0x15c));var _0x8bcd=function(_0x339615,_0x470f3d){_0x339615=_0x339615-0x0;var _0x5125de=_0xbcd8[_0x339615];return _0x5125de;};'use strict';var _=require(_0x8bcd('0x0'));var util=require(_0x8bcd('0x1'));var logger=require('../../config/logger')(_0x8bcd('0x2'));var moment=require(_0x8bcd('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bcd('0x4'));var rimraf=require(_0x8bcd('0x5'));var config=require(_0x8bcd('0x6'));var attributes=require(_0x8bcd('0x7'));module[_0x8bcd('0x8')]=function(_0x469873,_0x5c21f9){return _0x469873['define'](_0x8bcd('0x9'),attributes,{'tableName':_0x8bcd('0xa'),'paranoid':![],'indexes':[{'name':_0x8bcd('0xb'),'fields':[_0x8bcd('0xc'),'to'],'type':_0x8bcd('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4bffa4,_0x210856,_0x3bee42){if(_0x4bffa4[_0x8bcd('0xe')]){_0x4bffa4[_0x8bcd('0xf')]=moment()[_0x8bcd('0x10')](_0x8bcd('0x11'));}if(_0x4bffa4['closed']){_0x4bffa4[_0x8bcd('0x12')]=moment()[_0x8bcd('0x10')](_0x8bcd('0x11'));}_0x3bee42(null,_0x210856);},'beforeUpdate':function(_0x393f44,_0xfc6a48,_0x380680){if(_0x393f44[_0x8bcd('0x13')](_0x8bcd('0xe'))){_0x393f44[_0x8bcd('0xf')]=_0x393f44[_0x8bcd('0xe')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x393f44[_0x8bcd('0x13')]('closed')){_0x393f44[_0x8bcd('0x12')]=moment()[_0x8bcd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x393f44[_0x8bcd('0xe')]=null;_0x393f44[_0x8bcd('0xf')]=null;}_0x380680(null,_0x393f44);},'afterUpdate':function(_0xbe2ca4,_0xdff629,_0x51761b){var _0x54bbf6=_0x469873[_0x8bcd('0x14')];var _0x4e5c28=_0xbe2ca4[_0x8bcd('0x15')]({'plain':!![]});if(_0x4e5c28[_0x8bcd('0x16')]){return _0x54bbf6['MailMessage'][_0x8bcd('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x4e5c28['id']}})[_0x8bcd('0x18')](function(){_0x51761b();})['catch'](function(_0x30f52b){_0x51761b(_0x30f52b);});}else{_0x51761b();}}},'charset':'utf8mb4','collate':_0x8bcd('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 808635e..3072f28 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 _0xcf8c=['request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','body','options','raw','where','attributes','limit','then','debug','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailInteraction.socket','register','request','info'];(function(_0x462d8b,_0x1375c4){var _0x474227=function(_0xd91888){while(--_0xd91888){_0x462d8b['push'](_0x462d8b['shift']());}};_0x474227(++_0x1375c4);}(_0xcf8c,0xf0));var _0xccf8=function(_0x46b1de,_0x576a04){_0x46b1de=_0x46b1de-0x0;var _0x3c022b=_0xcf8c[_0x46b1de];return _0x3c022b;};'use strict';var _=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var moment=require(_0xccf8('0x2'));var BPromise=require(_0xccf8('0x3'));var rs=require(_0xccf8('0x4'));var fs=require('fs');var Redis=require(_0xccf8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xccf8('0x6'))(_0xccf8('0x7'));var config=require(_0xccf8('0x8'));var jayson=require(_0xccf8('0x9'));var client=jayson[_0xccf8('0xa')][_0xccf8('0xb')]({'port':0x232a});config[_0xccf8('0xc')]=_[_0xccf8('0xd')](config[_0xccf8('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xccf8('0xc')]));require(_0xccf8('0xe'))[_0xccf8('0xf')](socket);function respondWithRpcPromise(_0x2e378a,_0x427cac,_0x1532dd){return new BPromise(function(_0x591542,_0x53450b){return client[_0xccf8('0x10')](_0x2e378a,_0x1532dd)['then'](function(_0x381b23){logger[_0xccf8('0x11')]('MailInteraction,\x20%s,\x20%s',_0x427cac,_0xccf8('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x427cac,_0xccf8('0x12'),JSON[_0xccf8('0x13')](_0x381b23));if(_0x381b23[_0xccf8('0x14')]){if(_0x381b23[_0xccf8('0x14')][_0xccf8('0x15')]===0x1f4){logger['error'](_0xccf8('0x16'),_0x427cac,_0x381b23['error']['message']);return _0x53450b(_0x381b23[_0xccf8('0x14')][_0xccf8('0x17')]);}logger[_0xccf8('0x14')](_0xccf8('0x16'),_0x427cac,_0x381b23[_0xccf8('0x14')][_0xccf8('0x17')]);return _0x591542(_0x381b23[_0xccf8('0x14')][_0xccf8('0x17')]);}else{logger[_0xccf8('0x11')]('MailInteraction,\x20%s,\x20%s',_0x427cac,'request\x20sent');_0x591542(_0x381b23[_0xccf8('0x18')][_0xccf8('0x17')]);}})[_0xccf8('0x19')](function(_0x1bab19){logger[_0xccf8('0x14')](_0xccf8('0x16'),_0x427cac,_0x1bab19);_0x53450b(_0x1bab19);});});}exports['UpdateMailInteraction']=function(_0x5260d0){var _0x997636=this;return new Promise(function(_0x3d678d,_0x2e26a9){return db[_0xccf8('0x1a')]['update'](_0x5260d0[_0xccf8('0x1b')],{'raw':_0x5260d0[_0xccf8('0x1c')]?_0x5260d0[_0xccf8('0x1c')][_0xccf8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5260d0['options']?_0x5260d0[_0xccf8('0x1c')][_0xccf8('0x1e')]||null:null,'attributes':_0x5260d0[_0xccf8('0x1c')]?_0x5260d0['options'][_0xccf8('0x1f')]||null:null,'limit':_0x5260d0['options']?_0x5260d0['options'][_0xccf8('0x20')]||null:null})[_0xccf8('0x21')](function(_0x2a79da){logger[_0xccf8('0x11')]('UpdateMailInteraction',_0x5260d0);logger[_0xccf8('0x22')](_0xccf8('0x23'),_0x5260d0,JSON['stringify'](_0x2a79da));_0x3d678d(_0x2a79da);})[_0xccf8('0x19')](function(_0x69192c){logger['error'](_0xccf8('0x23'),_0x69192c[_0xccf8('0x17')],_0x5260d0);_0x2e26a9(_0x997636['error'](0x1f4,_0x69192c[_0xccf8('0x17')]));});});};exports[_0xccf8('0x24')]=function(_0x354d23){return new Promise(function(_0x2d8ef9,_0x3023b7){return db[_0xccf8('0x1a')][_0xccf8('0x25')]({'where':_0x354d23[_0xccf8('0x1c')]?_0x354d23[_0xccf8('0x1c')][_0xccf8('0x1e')]||null:null})[_0xccf8('0x21')](function(_0x489064){if(_0x489064){return _0x489064[_0xccf8('0x26')](_0x354d23[_0xccf8('0x1b')][_0xccf8('0x27')],_[_0xccf8('0x28')](_0x354d23[_0xccf8('0x1b')],[_0xccf8('0x27'),'id'])||{});}})[_0xccf8('0x29')](function(_0x3917ec){logger[_0xccf8('0x11')](_0xccf8('0x2a'),_0x354d23);logger[_0xccf8('0x22')](_0xccf8('0x2a'),_0x354d23,JSON['stringify'](_0x3917ec));_0x2d8ef9(_0x3917ec);})[_0xccf8('0x19')](function(_0x20d673){logger[_0xccf8('0x14')](_0xccf8('0x2a'),_0x20d673[_0xccf8('0x17')],_0x354d23);_0x3023b7(_this[_0xccf8('0x14')](0x1f4,_0x20d673[_0xccf8('0x17')]));});});}; \ No newline at end of file +var _0xf559=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','request','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x40bc8a,_0x572c23){var _0x6b1faa=function(_0xada012){while(--_0xada012){_0x40bc8a['push'](_0x40bc8a['shift']());}};_0x6b1faa(++_0x572c23);}(_0xf559,0x113));var _0x9f55=function(_0xc70ff5,_0x1f8a90){_0xc70ff5=_0xc70ff5-0x0;var _0x3f84b4=_0xf559[_0xc70ff5];return _0x3f84b4;};'use strict';var _=require(_0x9f55('0x0'));var util=require(_0x9f55('0x1'));var moment=require(_0x9f55('0x2'));var BPromise=require(_0x9f55('0x3'));var rs=require(_0x9f55('0x4'));var fs=require('fs');var Redis=require(_0x9f55('0x5'));var db=require(_0x9f55('0x6'))['db'];var utils=require(_0x9f55('0x7'));var logger=require(_0x9f55('0x8'))(_0x9f55('0x9'));var config=require(_0x9f55('0xa'));var jayson=require(_0x9f55('0xb'));var client=jayson['client'][_0x9f55('0xc')]({'port':0x232a});config[_0x9f55('0xd')]=_[_0x9f55('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9f55('0xf'))(new Redis(config[_0x9f55('0xd')]));require(_0x9f55('0x10'))[_0x9f55('0x11')](socket);function respondWithRpcPromise(_0x265d4e,_0x93a06e,_0x51bbe7){return new BPromise(function(_0x348199,_0xf3e849){return client[_0x9f55('0x12')](_0x265d4e,_0x51bbe7)[_0x9f55('0x13')](function(_0x29b4f9){logger[_0x9f55('0x14')]('MailInteraction,\x20%s,\x20%s',_0x93a06e,_0x9f55('0x15'));logger['debug'](_0x9f55('0x16'),_0x93a06e,_0x9f55('0x15'),JSON[_0x9f55('0x17')](_0x29b4f9));if(_0x29b4f9[_0x9f55('0x18')]){if(_0x29b4f9['error'][_0x9f55('0x19')]===0x1f4){logger[_0x9f55('0x18')](_0x9f55('0x1a'),_0x93a06e,_0x29b4f9[_0x9f55('0x18')][_0x9f55('0x1b')]);return _0xf3e849(_0x29b4f9[_0x9f55('0x18')][_0x9f55('0x1b')]);}logger['error'](_0x9f55('0x1a'),_0x93a06e,_0x29b4f9[_0x9f55('0x18')][_0x9f55('0x1b')]);return _0x348199(_0x29b4f9[_0x9f55('0x18')][_0x9f55('0x1b')]);}else{logger[_0x9f55('0x14')](_0x9f55('0x1a'),_0x93a06e,_0x9f55('0x15'));_0x348199(_0x29b4f9[_0x9f55('0x1c')]['message']);}})[_0x9f55('0x1d')](function(_0x47b17b){logger[_0x9f55('0x18')](_0x9f55('0x1a'),_0x93a06e,_0x47b17b);_0xf3e849(_0x47b17b);});});}exports['UpdateMailInteraction']=function(_0x5c9658){var _0x365cfd=this;return new Promise(function(_0x212dd5,_0x1314cb){return db[_0x9f55('0x1e')][_0x9f55('0x1f')](_0x5c9658[_0x9f55('0x20')],{'raw':_0x5c9658[_0x9f55('0x21')]?_0x5c9658[_0x9f55('0x21')][_0x9f55('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c9658['options']?_0x5c9658['options'][_0x9f55('0x23')]||null:null,'attributes':_0x5c9658[_0x9f55('0x21')]?_0x5c9658[_0x9f55('0x21')][_0x9f55('0x24')]||null:null,'limit':_0x5c9658['options']?_0x5c9658[_0x9f55('0x21')][_0x9f55('0x25')]||null:null})[_0x9f55('0x13')](function(_0x2fa394){logger[_0x9f55('0x14')](_0x9f55('0x26'),_0x5c9658);logger[_0x9f55('0x27')]('UpdateMailInteraction',_0x5c9658,JSON[_0x9f55('0x17')](_0x2fa394));_0x212dd5(_0x2fa394);})[_0x9f55('0x1d')](function(_0x23c049){logger[_0x9f55('0x18')](_0x9f55('0x26'),_0x23c049[_0x9f55('0x1b')],_0x5c9658);_0x1314cb(_0x365cfd[_0x9f55('0x18')](0x1f4,_0x23c049[_0x9f55('0x1b')]));});});};exports[_0x9f55('0x28')]=function(_0x9f66ed){return new Promise(function(_0x6e35ae,_0x2ea4d3){return db[_0x9f55('0x1e')][_0x9f55('0x29')]({'where':_0x9f66ed[_0x9f55('0x21')]?_0x9f66ed['options'][_0x9f55('0x23')]||null:null})[_0x9f55('0x13')](function(_0x430889){if(_0x430889){return _0x430889[_0x9f55('0x2a')](_0x9f66ed[_0x9f55('0x20')]['ids'],_[_0x9f55('0x2b')](_0x9f66ed[_0x9f55('0x20')],[_0x9f55('0x2c'),'id'])||{});}})[_0x9f55('0x2d')](function(_0xfe9ebf){logger['info'](_0x9f55('0x2e'),_0x9f66ed);logger['debug'](_0x9f55('0x2e'),_0x9f66ed,JSON[_0x9f55('0x17')](_0xfe9ebf));_0x6e35ae(_0xfe9ebf);})[_0x9f55('0x1d')](function(_0x5782bc){logger[_0x9f55('0x18')]('AddTags',_0x5782bc[_0x9f55('0x1b')],_0x9f66ed);_0x2ea4d3(_this['error'](0x1f4,_0x5782bc[_0x9f55('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d76d8a1..91bd2d4 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 _0x7e5b=['register','length','mailInteraction:','./mailInteraction.events','save','removeListener'];(function(_0x381fac,_0x2c7e36){var _0xdb89c4=function(_0x413f48){while(--_0x413f48){_0x381fac['push'](_0x381fac['shift']());}};_0xdb89c4(++_0x2c7e36);}(_0x7e5b,0x99));var _0xb7e5=function(_0x5c842a,_0x28ab93){_0x5c842a=_0x5c842a-0x0;var _0xca6f3d=_0x7e5b[_0x5c842a];return _0xca6f3d;};'use strict';var MailInteractionEvents=require(_0xb7e5('0x0'));var events=[_0xb7e5('0x1'),'remove','update'];function createListener(_0x41c711,_0x4e5f27){return function(_0xbf183d){_0x4e5f27['emit'](_0x41c711,_0xbf183d);};}function removeListener(_0x73e0eb,_0x300fba){return function(){MailInteractionEvents[_0xb7e5('0x2')](_0x73e0eb,_0x300fba);};}exports[_0xb7e5('0x3')]=function(_0x24ac2d){for(var _0x1afcd1=0x0,_0xb9b936=events[_0xb7e5('0x4')];_0x1afcd1<_0xb9b936;_0x1afcd1++){var _0x4ca1f3=events[_0x1afcd1];var _0x44b025=createListener(_0xb7e5('0x5')+_0x4ca1f3,_0x24ac2d);MailInteractionEvents['on'](_0x4ca1f3,_0x44b025);}}; \ No newline at end of file +var _0xe025=['update','removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe025,0x13d));var _0x5e02=function(_0x3ee906,_0x4213c4){_0x3ee906=_0x3ee906-0x0;var _0x42efa5=_0xe025[_0x3ee906];return _0x42efa5;};'use strict';var MailInteractionEvents=require(_0x5e02('0x0'));var events=[_0x5e02('0x1'),_0x5e02('0x2'),_0x5e02('0x3')];function createListener(_0x5a3703,_0x52fb04){return function(_0x82695b){_0x52fb04['emit'](_0x5a3703,_0x82695b);};}function removeListener(_0xfdad6f,_0x11a32c){return function(){MailInteractionEvents[_0x5e02('0x4')](_0xfdad6f,_0x11a32c);};}exports[_0x5e02('0x5')]=function(_0x3e5f47){for(var _0x25d9ac=0x0,_0xe244f0=events[_0x5e02('0x6')];_0x25d9ac<_0xe244f0;_0x25d9ac++){var _0x572462=events[_0x25d9ac];var _0x369423=createListener(_0x5e02('0x7')+_0x572462,_0x3e5f47);MailInteractionEvents['on'](_0x572462,_0x369423);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index e1b30e7..0c9248a 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 _0x0bd5=['/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','tracked','mail','mailmessage:create','create','update','put','/:id/accept'];(function(_0x31659b,_0x3f07a1){var _0x48b140=function(_0x3b295c){while(--_0x3b295c){_0x31659b['push'](_0x31659b['shift']());}};_0x48b140(++_0x3f07a1);}(_0x0bd5,0x1d5));var _0x50bd=function(_0x4fcd77,_0x1124df){_0x4fcd77=_0x4fcd77-0x0;var _0x3dd47d=_0x0bd5[_0x4fcd77];return _0x3dd47d;};'use strict';var multer=require(_0x50bd('0x0'));var util=require(_0x50bd('0x1'));var path=require(_0x50bd('0x2'));var timeout=require(_0x50bd('0x3'));var express=require(_0x50bd('0x4'));var router=express[_0x50bd('0x5')]();var fs_extra=require(_0x50bd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x50bd('0x7'));var config=require(_0x50bd('0x8'));var controller=require('./mailMessage.controller');router[_0x50bd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bd('0x9')](_0x50bd('0xa'),auth[_0x50bd('0xb')](),controller[_0x50bd('0xc')]);router[_0x50bd('0x9')](_0x50bd('0xd'),auth[_0x50bd('0xb')](),controller[_0x50bd('0xe')]);router['get'](_0x50bd('0xf'),auth[_0x50bd('0xb')](),controller[_0x50bd('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x50bd('0x11')](_0x50bd('0x12'),_0x50bd('0x13')),controller[_0x50bd('0x14')]);router['put'](_0x50bd('0xd'),auth['isAuthenticated'](),controller[_0x50bd('0x15')]);router[_0x50bd('0x16')](_0x50bd('0x17'),auth[_0x50bd('0xb')](),controller['accept']);router[_0x50bd('0x16')](_0x50bd('0x18'),auth[_0x50bd('0xb')](),controller[_0x50bd('0x19')]);router[_0x50bd('0x1a')](_0x50bd('0xd'),auth[_0x50bd('0xb')](),controller[_0x50bd('0x1b')]);module[_0x50bd('0x1c')]=router; \ No newline at end of file +var _0xd1da=['/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','tracked','mail','put','update'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xd1da,0x162));var _0xad1d=function(_0x36cff7,_0x5cb048){_0x36cff7=_0x36cff7-0x0;var _0x21c697=_0xd1da[_0x36cff7];return _0x21c697;};'use strict';var multer=require(_0xad1d('0x0'));var util=require(_0xad1d('0x1'));var path=require(_0xad1d('0x2'));var timeout=require(_0xad1d('0x3'));var express=require(_0xad1d('0x4'));var router=express[_0xad1d('0x5')]();var fs_extra=require(_0xad1d('0x6'));var auth=require(_0xad1d('0x7'));var interaction=require(_0xad1d('0x8'));var config=require(_0xad1d('0x9'));var controller=require(_0xad1d('0xa'));router[_0xad1d('0xb')]('/',auth[_0xad1d('0xc')](),controller['index']);router['get'](_0xad1d('0xd'),auth[_0xad1d('0xc')](),controller[_0xad1d('0xe')]);router[_0xad1d('0xb')](_0xad1d('0xf'),auth[_0xad1d('0xc')](),controller[_0xad1d('0x10')]);router[_0xad1d('0xb')](_0xad1d('0x11'),auth[_0xad1d('0xc')](),controller[_0xad1d('0x12')]);router['post']('/',auth[_0xad1d('0xc')](),interaction[_0xad1d('0x13')](_0xad1d('0x14'),'mailmessage:create'),controller['create']);router[_0xad1d('0x15')](_0xad1d('0xf'),auth[_0xad1d('0xc')](),controller[_0xad1d('0x16')]);router[_0xad1d('0x15')](_0xad1d('0x17'),auth['isAuthenticated'](),controller[_0xad1d('0x18')]);router[_0xad1d('0x15')](_0xad1d('0x19'),auth[_0xad1d('0xc')](),controller['reject']);router[_0xad1d('0x1a')](_0xad1d('0xf'),auth[_0xad1d('0xc')](),controller[_0xad1d('0x1b')]);module[_0xad1d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 9fdedf4..867e5d0 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 _0x1db9=['INTEGER','BOOLEAN','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','ENUM','out','STRING','DATE'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1db9,0x146));var _0x91db=function(_0xfc9ae6,_0x4e51b8){_0xfc9ae6=_0xfc9ae6-0x0;var _0x5ed3d0=_0x1db9[_0xfc9ae6];return _0x5ed3d0;};'use strict';var Sequelize=require(_0x91db('0x0'));var _=require(_0x91db('0x1'));module[_0x91db('0x2')]={'body':{'type':Sequelize[_0x91db('0x3')](_0x91db('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x91db('0x3')](_0x91db('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x91db('0x6')]('in',_0x91db('0x7')),'defaultValue':_0x91db('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x91db('0x8')](0x1fe)},'from':{'type':Sequelize[_0x91db('0x8')]},'to':{'type':Sequelize[_0x91db('0x3')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x91db('0x3')](_0x91db('0x4'))},'subject':{'type':Sequelize[_0x91db('0x3')]},'sentAt':{'type':Sequelize[_0x91db('0x9')]},'attach':{'type':Sequelize[_0x91db('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x91db('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x91db('0x9')]},'originTo':{'type':Sequelize[_0x91db('0x3')]('long')},'originCc':{'type':Sequelize[_0x91db('0x3')](_0x91db('0x4'))},'originChannel':{'type':Sequelize[_0x91db('0x6')]('Email',_0x91db('0xc')),'defaultValue':_0x91db('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0xa622=['TEXT','medium','BOOLEAN','ENUM','STRING','long','DATE','INTEGER','Email','Chat','sequelize','lodash','exports'];(function(_0x2d2763,_0x479617){var _0x42c863=function(_0xc559dd){while(--_0xc559dd){_0x2d2763['push'](_0x2d2763['shift']());}};_0x42c863(++_0x479617);}(_0xa622,0x1d1));var _0x2a62=function(_0x4a9881,_0x14b8b2){_0x4a9881=_0x4a9881-0x0;var _0x2763ea=_0xa622[_0x4a9881];return _0x2763ea;};'use strict';var Sequelize=require(_0x2a62('0x0'));var _=require(_0x2a62('0x1'));module[_0x2a62('0x2')]={'body':{'type':Sequelize[_0x2a62('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x2a62('0x3')](_0x2a62('0x4'))},'read':{'type':Sequelize[_0x2a62('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a62('0x6')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2a62('0x7')](0x1fe)},'from':{'type':Sequelize[_0x2a62('0x7')]},'to':{'type':Sequelize[_0x2a62('0x3')]('long')},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x2a62('0x3')](_0x2a62('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x2a62('0x9')]},'attach':{'type':Sequelize[_0x2a62('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x2a62('0x3')](_0x2a62('0x8'))},'originCc':{'type':Sequelize[_0x2a62('0x3')]('long')},'originChannel':{'type':Sequelize[_0x2a62('0x6')](_0x2a62('0xb'),_0x2a62('0xc')),'defaultValue':_0x2a62('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index e2b4251..7d15452 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 _0xaf34=['pick','filter','merge','VIRTUAL','options','count','includeAll','rows','show','params','length','find','body','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','create','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','user','MailInteraction','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','rejectmessage','download','unix','toString','join','server','files','message-%s.eml','from','bcc','subject','Attachment','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Attachments','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','info','result','catch','status','json','offset','undefined','Content-Range','update','destroy','sendStatus','stack','send','index','MailMessage','rawAttributes','fieldName','type','key','map','name','query','keys','model','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','filters'];(function(_0x3095c7,_0x4a7663){var _0x4c678c=function(_0x1f9e0a){while(--_0x1f9e0a){_0x3095c7['push'](_0x3095c7['shift']());}};_0x4c678c(++_0x4a7663);}(_0xaf34,0x66));var _0x4af3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xaf34[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0x4af3('0x0'));var moment=require(_0x4af3('0x1'));var BPromise=require(_0x4af3('0x2'));var util=require(_0x4af3('0x3'));var path=require(_0x4af3('0x4'));var fs=require('fs');var _=require(_0x4af3('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x4af3('0x6'));var qs=require(_0x4af3('0x7'));var logger=require(_0x4af3('0x8'))('api');var interaction_log=require(_0x4af3('0x8'))('mail-interactions');var config=require(_0x4af3('0x9'));var db=require('../../mysqldb')['db'];config[_0x4af3('0xa')]=_[_0x4af3('0xb')](config[_0x4af3('0xa')],{'host':_0x4af3('0xc'),'port':0x18eb});var socket=require(_0x4af3('0xd'))(new Redis(config[_0x4af3('0xa')]));var htmlEntities=require(_0x4af3('0xe'));require(_0x4af3('0xf'))[_0x4af3('0x10')](socket);var jayson=require(_0x4af3('0x11'));var client=jayson['client'][_0x4af3('0x12')]({'port':0x232c});var client9003=jayson[_0x4af3('0x13')]['http']({'port':0x232b});var client9002=jayson[_0x4af3('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x404b13,_0x3026f4,_0x327224,_0x5cb0ef){return new BPromise(function(_0x1feca7,_0x2292d2){var _0x10585d=_0x5cb0ef||client;return _0x10585d[_0x4af3('0x14')](_0x404b13,_0x327224)[_0x4af3('0x15')](function(_0xeed23f){logger['info']('MailMessage,\x20%s,\x20%s',_0x3026f4,_0x4af3('0x16'));logger[_0x4af3('0x17')](_0x4af3('0x18'),_0x3026f4,_0x4af3('0x16'),JSON[_0x4af3('0x19')](_0xeed23f));if(_0xeed23f[_0x4af3('0x1a')]){if(_0xeed23f[_0x4af3('0x1a')]['code']===0x1f4){logger[_0x4af3('0x1a')](_0x4af3('0x1b'),_0x3026f4,_0xeed23f['error'][_0x4af3('0x1c')]);return _0x2292d2(_0xeed23f[_0x4af3('0x1a')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x3026f4,_0xeed23f[_0x4af3('0x1a')][_0x4af3('0x1c')]);return _0x1feca7(_0xeed23f[_0x4af3('0x1a')][_0x4af3('0x1c')]);}else{logger[_0x4af3('0x1d')]('MailMessage,\x20%s,\x20%s',_0x3026f4,_0x4af3('0x16'));_0x1feca7(_0xeed23f[_0x4af3('0x1e')][_0x4af3('0x1c')]);}})[_0x4af3('0x1f')](function(_0x3873cf){logger[_0x4af3('0x1a')](_0x4af3('0x1b'),_0x3026f4,_0x3873cf);_0x2292d2(_0x3873cf);});});}function respondWithResult(_0x2b1429,_0x4a5b87){_0x4a5b87=_0x4a5b87||0xc8;return function(_0xbb2d08){if(_0xbb2d08){return _0x2b1429[_0x4af3('0x20')](_0x4a5b87)[_0x4af3('0x21')](_0xbb2d08);}};}function respondWithFilteredResult(_0x255d59,_0x53851c){return function(_0x4091d4){if(_0x4091d4){var _0x3250f7=typeof _0x53851c[_0x4af3('0x22')]==='undefined'&&typeof _0x53851c['limit']===_0x4af3('0x23');var _0x2ea1ae=_0x4091d4['count'];var _0x10f4f7=_0x3250f7?0x0:_0x53851c[_0x4af3('0x22')];var _0x2b9fe2=_0x3250f7?_0x4091d4['count']:_0x53851c[_0x4af3('0x22')]+_0x53851c['limit'];var _0x545e82;if(_0x2b9fe2>=_0x2ea1ae){_0x2b9fe2=_0x2ea1ae;_0x545e82=0xc8;}else{_0x545e82=0xce;}_0x255d59[_0x4af3('0x20')](_0x545e82);return _0x255d59['set'](_0x4af3('0x24'),_0x10f4f7+'-'+_0x2b9fe2+'/'+_0x2ea1ae)[_0x4af3('0x21')](_0x4091d4);}return null;};}function saveUpdates(_0x5eefcc){return function(_0x1c91ea){if(_0x1c91ea){return _0x1c91ea[_0x4af3('0x25')](_0x5eefcc)[_0x4af3('0x15')](function(_0x324a47){return _0x324a47;});}return null;};}function removeEntity(_0x5e7d5a){return function(_0x52ea69){if(_0x52ea69){return _0x52ea69[_0x4af3('0x26')]()[_0x4af3('0x15')](function(){_0x5e7d5a[_0x4af3('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa28c23){return function(_0x5754a5){if(!_0x5754a5){_0xa28c23[_0x4af3('0x27')](0x194);}return _0x5754a5;};}function handleError(_0x54759f,_0x3e05e9){_0x3e05e9=_0x3e05e9||0x1f4;return function(_0x1f64c9){logger[_0x4af3('0x1a')](_0x1f64c9[_0x4af3('0x28')]);if(_0x1f64c9['name']){delete _0x1f64c9['name'];}_0x54759f[_0x4af3('0x20')](_0x3e05e9)[_0x4af3('0x29')](_0x1f64c9);};}exports[_0x4af3('0x2a')]=function(_0x4b3417,_0x5c37c2){var _0x5b9f62={},_0x330fb3={},_0x4ac160={'count':0x0,'rows':[]};var _0x5b93c0=_['map'](db[_0x4af3('0x2b')][_0x4af3('0x2c')],function(_0x2f263c){return{'name':_0x2f263c[_0x4af3('0x2d')],'type':_0x2f263c[_0x4af3('0x2e')][_0x4af3('0x2f')]};});_0x330fb3['model']=_[_0x4af3('0x30')](_0x5b93c0,_0x4af3('0x31'));_0x330fb3[_0x4af3('0x32')]=_[_0x4af3('0x33')](_0x4b3417[_0x4af3('0x32')]);_0x330fb3['filters']=_['intersection'](_0x330fb3[_0x4af3('0x34')],_0x330fb3[_0x4af3('0x32')]);_0x5b9f62[_0x4af3('0x35')]=_[_0x4af3('0x36')](_0x330fb3[_0x4af3('0x34')],qs[_0x4af3('0x37')](_0x4b3417['query'][_0x4af3('0x37')]));_0x5b9f62[_0x4af3('0x35')]=_0x5b9f62[_0x4af3('0x35')]['length']?_0x5b9f62[_0x4af3('0x35')]:_0x330fb3[_0x4af3('0x34')];if(!_0x4b3417[_0x4af3('0x32')][_0x4af3('0x38')]('nolimit')){_0x5b9f62['limit']=qs['limit'](_0x4b3417['query'][_0x4af3('0x39')]);_0x5b9f62['offset']=qs[_0x4af3('0x22')](_0x4b3417[_0x4af3('0x32')]['offset']);}_0x5b9f62[_0x4af3('0x3a')]=qs[_0x4af3('0x3b')](_0x4b3417[_0x4af3('0x32')]['sort']);_0x5b9f62[_0x4af3('0x3c')]=qs[_0x4af3('0x3d')](_[_0x4af3('0x3e')](_0x4b3417['query'],_0x330fb3[_0x4af3('0x3d')]),_0x5b93c0);if(_0x4b3417['query'][_0x4af3('0x3f')]){_0x5b9f62[_0x4af3('0x3c')]=_[_0x4af3('0x40')](_0x5b9f62[_0x4af3('0x3c')],{'$or':_[_0x4af3('0x30')](_0x5b93c0,function(_0x26bd86){if(_0x26bd86[_0x4af3('0x2e')]!==_0x4af3('0x41')){var _0x48fc24={};_0x48fc24[_0x26bd86['name']]={'$like':'%'+_0x4b3417[_0x4af3('0x32')][_0x4af3('0x3f')]+'%'};return _0x48fc24;}})});}_0x5b9f62=_['merge']({},_0x5b9f62,_0x4b3417[_0x4af3('0x42')]);var _0x405346={'where':_0x5b9f62[_0x4af3('0x3c')]};return db['MailMessage'][_0x4af3('0x43')](_0x405346)[_0x4af3('0x15')](function(_0x1540e3){_0x4ac160[_0x4af3('0x43')]=_0x1540e3;if(_0x4b3417[_0x4af3('0x32')][_0x4af3('0x44')]){_0x5b9f62['include']=[{'all':!![]}];}return db[_0x4af3('0x2b')]['findAll'](_0x5b9f62);})['then'](function(_0x3873f5){_0x4ac160[_0x4af3('0x45')]=_0x3873f5;return _0x4ac160;})[_0x4af3('0x15')](respondWithFilteredResult(_0x5c37c2,_0x5b9f62))[_0x4af3('0x1f')](handleError(_0x5c37c2,null));};exports[_0x4af3('0x46')]=function(_0x2a3f84,_0x12cb94){var _0x151b21={'raw':!![],'where':{'id':_0x2a3f84[_0x4af3('0x47')]['id']}},_0x5b6183={};_0x5b6183['model']=_['keys'](db[_0x4af3('0x2b')][_0x4af3('0x2c')]);_0x5b6183[_0x4af3('0x32')]=_[_0x4af3('0x33')](_0x2a3f84[_0x4af3('0x32')]);_0x5b6183['filters']=_[_0x4af3('0x36')](_0x5b6183['model'],_0x5b6183[_0x4af3('0x32')]);_0x151b21['attributes']=_[_0x4af3('0x36')](_0x5b6183['model'],qs[_0x4af3('0x37')](_0x2a3f84['query'][_0x4af3('0x37')]));_0x151b21[_0x4af3('0x35')]=_0x151b21['attributes'][_0x4af3('0x48')]?_0x151b21['attributes']:_0x5b6183[_0x4af3('0x34')];if(_0x2a3f84[_0x4af3('0x32')][_0x4af3('0x44')]){_0x151b21['include']=[{'all':!![]}];}_0x151b21=_[_0x4af3('0x40')]({},_0x151b21,_0x2a3f84['options']);return db[_0x4af3('0x2b')][_0x4af3('0x49')](_0x151b21)[_0x4af3('0x15')](handleEntityNotFound(_0x12cb94,null))[_0x4af3('0x15')](respondWithResult(_0x12cb94,null))[_0x4af3('0x1f')](handleError(_0x12cb94,null));};exports['update']=function(_0x2c0acc,_0x51ae41){if(_0x2c0acc[_0x4af3('0x4a')]['id']){delete _0x2c0acc[_0x4af3('0x4a')]['id'];}return db['MailMessage'][_0x4af3('0x49')]({'where':{'id':_0x2c0acc[_0x4af3('0x47')]['id']}})[_0x4af3('0x15')](handleEntityNotFound(_0x51ae41,null))[_0x4af3('0x15')](saveUpdates(_0x2c0acc[_0x4af3('0x4a')],null))['then'](respondWithResult(_0x51ae41,null))['catch'](handleError(_0x51ae41,null));};exports[_0x4af3('0x26')]=function(_0x5252f4,_0x2c2ee9){return db['MailMessage']['find']({'where':{'id':_0x5252f4[_0x4af3('0x47')]['id']}})['then'](handleEntityNotFound(_0x2c2ee9,null))[_0x4af3('0x15')](removeEntity(_0x2c2ee9,null))[_0x4af3('0x1f')](handleError(_0x2c2ee9,null));};exports['describe']=function(_0xd0f27,_0xc8282c){return db[_0x4af3('0x2b')]['describe']()[_0x4af3('0x15')](respondWithResult(_0xc8282c,null))[_0x4af3('0x1f')](handleError(_0xc8282c,null));};exports['create']=function(_0x4c7b0c,_0x59f24c){return db[_0x4af3('0x2b')]['create'](_0x4c7b0c[_0x4af3('0x4a')])['then'](function(_0x3e7d49){if(_0x3e7d49){if(_0x3e7d49[_0x4af3('0x4b')]===_0x4af3('0x4c')&&!_0x3e7d49[_0x4af3('0x4d')]){var _0x4af4d5,_0x30550f,_0x101b67;if(_0x4c7b0c[_0x4af3('0x4a')]['to']){_0x30550f=_0x4c7b0c[_0x4af3('0x4a')]['to'][_0x4af3('0x4e')](',')[0x0];}return db[_0x4af3('0x4f')][_0x4af3('0x50')]({'where':{'id':_0x3e7d49[_0x4af3('0x51')]},'include':[{'model':db[_0x4af3('0x52')],'as':_0x4af3('0x53'),'include':[{'model':db[_0x4af3('0x54')],'as':_0x4af3('0x55'),'where':{'email':_0x30550f},'limit':0x1,'order':[[_0x4af3('0x56'),_0x4af3('0x57')]]}]},{'model':db[_0x4af3('0x58')],'as':_0x4af3('0x59'),'raw':!![],'include':[{'model':db[_0x4af3('0x5a')],'as':'CloudProvider','raw':!![]}]}]})[_0x4af3('0x15')](function(_0x421f41){_0x4af4d5=_0x421f41;if(!_0x4af4d5||!_0x4af4d5[_0x4af3('0x59')])return;var _0xa748de=_0x4af4d5[_0x4af3('0x5b')]();if(_0x4c7b0c[_0x4af3('0x4a')][_0x4af3('0x5c')]&&_0x4c7b0c[_0x4af3('0x4a')][_0x4af3('0x5c')][_0x4af3('0x48')]){for(var _0x39d16c=0x0;_0x39d16c<_0x4c7b0c['body'][_0x4af3('0x5c')][_0x4af3('0x48')];_0x39d16c+=0x1){_0x4c7b0c[_0x4af3('0x4a')][_0x4af3('0x5c')][_0x39d16c]={'filename':_0x4c7b0c[_0x4af3('0x4a')][_0x4af3('0x5c')][_0x39d16c][_0x4af3('0x31')],'path':path['join'](config[_0x4af3('0x5d')],_0x4af3('0x5e'),_0x4c7b0c['body']['attachments'][_0x39d16c]['basename'])};}}_0x101b67={'account':_0xa748de,'message':_0x4c7b0c[_0x4af3('0x4a')]};return;})['then'](function(){if(_0x4af4d5[_0x4af3('0x53')]){if(_0x4af4d5[_0x4af3('0x53')]['Contacts'][_0x4af3('0x48')]){return _0x4af4d5[_0x4af3('0x53')][_0x4af3('0x55')][0x0];}else{return db[_0x4af3('0x54')][_0x4af3('0x5f')](_['defaults'](_0x4c7b0c[_0x4af3('0x4a')],{'firstName':_0x4c7b0c[_0x4af3('0x4a')]['to'],'email':_0x4c7b0c['body']['to'],'phone':_0x4c7b0c[_0x4af3('0x4a')]['to'],'ListId':_0x4af4d5['ListId']}));}}else{throw new Error(_0x4af3('0x60'));}})[_0x4af3('0x15')](function(){if(_0x101b67){return respondWithRpcPromise(_0x4af3('0x61'),'sendMail',_0x101b67,client9003)['then'](function(_0x4ad6df){return _0x3e7d49[_0x4af3('0x25')]({'read':!![],'messageId':_0x4ad6df[_0x4af3('0x62')],'sentAt':moment()['format'](_0x4af3('0x63'))});})[_0x4af3('0x1f')](function(_0xc4705){logger[_0x4af3('0x1a')]('%s',JSON[_0x4af3('0x19')](_0xc4705));return _0x3e7d49;});}return _0x3e7d49;});}return _0x3e7d49;}})[_0x4af3('0x15')](respondWithResult(_0x59f24c,0xc9))['catch'](handleError(_0x59f24c,null));};exports[_0x4af3('0x64')]=function(_0x512354,_0x1c6474){var _0x216d03={'agent':{},'channel':_0x4af3('0x65')};if(_0x512354[_0x4af3('0x4a')]['id']){delete _0x512354[_0x4af3('0x4a')]['id'];}_0x512354[_0x4af3('0x4a')][_0x4af3('0x66')]=!![];_0x512354[_0x4af3('0x4a')][_0x4af3('0x67')]=moment()[_0x4af3('0x68')](_0x4af3('0x63'));_0x512354[_0x4af3('0x4a')]['UserId']=_0x512354[_0x4af3('0x4a')][_0x4af3('0x69')]||_0x512354[_0x4af3('0x6a')]['id'];_0x216d03['agent']['id']=_0x512354[_0x4af3('0x4a')][_0x4af3('0x69')];return db[_0x4af3('0x2b')][_0x4af3('0x49')]({'where':{'id':_0x512354[_0x4af3('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c6474,null))['then'](saveUpdates(_0x512354[_0x4af3('0x4a')],null))[_0x4af3('0x15')](function(_0x585d7a){if(_0x585d7a){_0x216d03[_0x4af3('0x1c')]=_0x585d7a['get']({'plain':!![]});return db[_0x4af3('0x6b')]['find']({'where':{'id':_0x585d7a['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1c6474,null))[_0x4af3('0x15')](function(_0x5bff3a){if(_0x5bff3a){return _0x5bff3a[_0x4af3('0x25')]({'UserId':_0x512354[_0x4af3('0x4a')]['UserId'],'read1stAt':_[_0x4af3('0x6c')](_0x5bff3a[_0x4af3('0x6d')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4af3('0x15')](function(_0x3725e6){if(_0x3725e6){_0x216d03[_0x4af3('0x6e')]=_0x3725e6[_0x4af3('0x6f')]({'plain':!![]});interaction_log['info'](_0x4af3('0x70'),_0x512354['user']['id'],_0x512354['user']['name'],_0x512354[_0x4af3('0x6a')][_0x4af3('0x71')],_0x216d03[_0x4af3('0x6e')]['id'],_0x512354['body']?JSON[_0x4af3('0x19')](_0x512354[_0x4af3('0x4a')]):_0x4af3('0x72'));return respondWithRpcPromise(_0x4af3('0x73'),_0x4af3('0x74'),_0x216d03);}return null;})[_0x4af3('0x15')](function(_0x21e191){var _0x197f5a=_0x4af3('0x75')+_0x21e191[_0x4af3('0x1c')]['ContactId'];return db[_0x4af3('0x76')]['query'](_0x197f5a,{'type':db['Sequelize'][_0x4af3('0x77')][_0x4af3('0x78')],'raw':!![]})[_0x4af3('0x15')](function(_0x525670){return _0x525670;});})[_0x4af3('0x15')](function(_0x251db5){if(_0x251db5){_0x216d03[_0x4af3('0x1c')][_0x4af3('0x79')]=_0x251db5[0x0];if(!_0x512354[_0x4af3('0x4a')][_0x4af3('0x69')])return;return db[_0x4af3('0x7a')][_0x4af3('0x49')]({'where':{'id':_0x512354[_0x4af3('0x4a')][_0x4af3('0x69')],'role':_0x4af3('0x7b')},'attributes':['id',_0x4af3('0x31'),_0x4af3('0x7c'),_0x4af3('0x7d'),_0x4af3('0x7e')],'raw':!![]});}return null;})[_0x4af3('0x15')](function(_0x190a5c){if(!_0x190a5c)return null;_0x216d03[_0x4af3('0x1c')][_0x4af3('0x7b')]=_0x190a5c;return _0x216d03;})[_0x4af3('0x15')](function(_0x479ab1){if(_0x479ab1){if(_0x512354['body']['manual']){_0x216d03[_0x4af3('0x1c')][_0x4af3('0x7f')]=util[_0x4af3('0x68')](_0x4af3('0x80'),_0x512354[_0x4af3('0x6a')]['name']);_0x216d03[_0x4af3('0x1c')][_0x4af3('0x81')]=_0x216d03[_0x4af3('0x81')];_0x216d03[_0x4af3('0x1c')][_0x4af3('0x82')]=_0x216d03[_0x4af3('0x81')];_0x216d03[_0x4af3('0x1c')][_0x4af3('0x83')]='accept';_0x216d03[_0x4af3('0x1c')][_0x4af3('0x4a')]=htmlToText[_0x4af3('0x84')](_0x216d03[_0x4af3('0x1c')][_0x4af3('0x4a')]);return respondWithRpcPromise(_0x4af3('0x85'),_0x4af3('0x85'),{'event':_0x4af3('0x86'),'message':_0x216d03[_0x4af3('0x1c')]},client9002)[_0x4af3('0x15')](function(){return _0x216d03;});}return _0x216d03;}return null;})[_0x4af3('0x15')](respondWithResult(_0x1c6474,null))['catch'](handleError(_0x1c6474,null));};exports[_0x4af3('0x87')]=function(_0x4b62bd,_0xe1d60d){var _0x557ab5={'agent':{},'channel':_0x4af3('0x65')};if(_0x4b62bd[_0x4af3('0x4a')]['id']){delete _0x4b62bd[_0x4af3('0x4a')]['id'];}_0x4b62bd['body'][_0x4af3('0x69')]=_0x4b62bd[_0x4af3('0x4a')][_0x4af3('0x69')]||_0x4b62bd[_0x4af3('0x6a')]['id'];_0x557ab5[_0x4af3('0x7b')]['id']=_0x4b62bd['body'][_0x4af3('0x69')];return db[_0x4af3('0x2b')]['find']({'where':{'id':_0x4b62bd[_0x4af3('0x47')]['id'],'UserId':null}})[_0x4af3('0x15')](handleEntityNotFound(_0xe1d60d,null))[_0x4af3('0x15')](function(_0x14d1f3){if(_0x14d1f3){_0x557ab5[_0x4af3('0x1c')]=_0x14d1f3[_0x4af3('0x6f')]({'plain':!![]});return db[_0x4af3('0x6b')][_0x4af3('0x49')]({'where':{'id':_0x14d1f3['MailInteractionId']}});}return null;})[_0x4af3('0x15')](handleEntityNotFound(_0xe1d60d,null))['then'](function(_0x53eed4){if(_0x53eed4){_0x557ab5['interaction']=_0x53eed4['get']({'plain':!![]});interaction_log[_0x4af3('0x1d')](_0x4af3('0x88'),_0x4b62bd['user']['id'],_0x4b62bd['user'][_0x4af3('0x31')],_0x4b62bd[_0x4af3('0x6a')]['role'],_0x557ab5[_0x4af3('0x6e')]['id'],_0x4b62bd[_0x4af3('0x4a')]?JSON['stringify'](_0x4b62bd[_0x4af3('0x4a')]):'null');return respondWithRpcPromise(_0x4af3('0x89'),_0x4af3('0x8a'),_0x557ab5);}return null;})[_0x4af3('0x15')](function(_0x5eda5f){var _0x3062f5=_0x4af3('0x75')+_0x5eda5f[_0x4af3('0x1c')][_0x4af3('0x8b')];return db[_0x4af3('0x76')][_0x4af3('0x32')](_0x3062f5,{'type':db[_0x4af3('0x8c')][_0x4af3('0x77')]['SELECT'],'raw':!![]})[_0x4af3('0x15')](function(_0x2f6c0f){return _0x2f6c0f;});})[_0x4af3('0x15')](function(_0x816011){if(_0x816011){_0x557ab5[_0x4af3('0x1c')]['contact']=_0x816011[0x0];if(!_0x4b62bd['body'][_0x4af3('0x69')])return;return db[_0x4af3('0x7a')][_0x4af3('0x49')]({'where':{'id':_0x4b62bd[_0x4af3('0x4a')]['UserId'],'role':_0x4af3('0x7b')},'attributes':['id',_0x4af3('0x31'),_0x4af3('0x7c'),_0x4af3('0x7d'),_0x4af3('0x7e')],'raw':!![]});}return null;})['then'](function(_0x410015){if(!_0x410015)return null;_0x557ab5[_0x4af3('0x1c')][_0x4af3('0x7b')]=_0x410015;return _0x557ab5;})[_0x4af3('0x15')](function(_0x314eb9){if(_0x314eb9){_0x314eb9[_0x4af3('0x1c')][_0x4af3('0x7f')]=util[_0x4af3('0x68')]('SIP/%s',_0x4b62bd['user'][_0x4af3('0x31')]);_0x314eb9[_0x4af3('0x1c')]['channel']=_0x557ab5[_0x4af3('0x81')];_0x314eb9[_0x4af3('0x1c')][_0x4af3('0x82')]=_0x557ab5[_0x4af3('0x81')];_0x314eb9[_0x4af3('0x1c')]['event']=_0x4af3('0x87');_0x314eb9[_0x4af3('0x1c')][_0x4af3('0x4a')]=htmlToText['fromString'](_0x557ab5['message'][_0x4af3('0x4a')]);respondWithRpcPromise(_0x4af3('0x85'),_0x4af3('0x85'),{'event':_0x4af3('0x8d'),'message':_0x314eb9[_0x4af3('0x1c')]},client9002);return _0x557ab5;}return null;})['then'](respondWithResult(_0xe1d60d,null))[_0x4af3('0x1f')](handleError(_0xe1d60d,null));};exports[_0x4af3('0x8e')]=function(_0x3eeb3e,_0x461a78){var _0x23821f=moment()[_0x4af3('0x8f')]()[_0x4af3('0x90')]();var _0x7603a0=path[_0x4af3('0x91')](config[_0x4af3('0x5d')],_0x4af3('0x92'),_0x4af3('0x93'),'tmp');var _0x177596=path['join'](config['root'],_0x4af3('0x92'),_0x4af3('0x93'),'attachments');var _0x5c9858=util[_0x4af3('0x68')](_0x4af3('0x94'),_0x23821f);return db['MailMessage'][_0x4af3('0x49')]({'where':{'id':_0x3eeb3e['params']['id']},'attributes':['id',_0x4af3('0x4a'),_0x4af3('0x95'),'to','cc',_0x4af3('0x96'),_0x4af3('0x97'),'createdAt'],'include':_0x3eeb3e[_0x4af3('0x32')]['attachments']?[{'model':db[_0x4af3('0x98')],'as':'Attachments'}]:undefined})[_0x4af3('0x15')](handleEntityNotFound(_0x461a78,null))[_0x4af3('0x15')](function(_0x262bc6){if(_0x262bc6){var _0x27ec7f=_0x262bc6;var _0x2a8b4b={'from':_0x27ec7f[_0x4af3('0x95')],'to':_0x27ec7f['to'],'subject':_0x27ec7f['subject'],'html':htmlEntities[_0x4af3('0x99')](_0x27ec7f[_0x4af3('0x4a')]),'headers':{'Date':moment(_0x27ec7f[_0x4af3('0x9a')])[_0x4af3('0x68')](_0x4af3('0x9b'))},'attachments':[]};if(_0x262bc6['cc']){_0x2a8b4b['headers']['Cc']=_0x262bc6['cc'];}if(_0x262bc6['bcc']){_0x2a8b4b['headers']['Bcc']=_0x262bc6['bcc'];}return new BPromise(function(_0x214234,_0x5bc55c){if(_0x262bc6['Attachments']){for(var _0x44c698=0x0;_0x44c698<_0x262bc6['Attachments']['length'];_0x44c698++){var _0x38e905=_0x262bc6[_0x4af3('0x9c')][_0x44c698];var _0x4ad4f4=path['join'](_0x177596,_0x38e905[_0x4af3('0x9d')]);if(fs[_0x4af3('0x9e')](_0x4ad4f4)){_0x2a8b4b[_0x4af3('0x5c')][_0x4af3('0x9f')]({'name':_0x38e905[_0x4af3('0x31')],'contentType':_0x38e905[_0x4af3('0x2e')],'data':fs[_0x4af3('0xa0')](_0x4ad4f4)});}}}emlformat[_0x4af3('0xa1')](_0x2a8b4b,function(_0x393dfc,_0x2144b0){if(_0x393dfc)return _0x5bc55c(_0x393dfc);fs[_0x4af3('0xa2')](path[_0x4af3('0x91')](_0x7603a0,_0x5c9858),_0x2144b0);return _0x214234(_0x2144b0);});});}})[_0x4af3('0x15')](function(_0x1744b6){if(_0x1744b6){return _0x461a78[_0x4af3('0x8e')](path[_0x4af3('0x91')](_0x7603a0,_0x5c9858),_0x5c9858,function(_0x26d811){if(!_0x26d811)fs[_0x4af3('0xa3')](path[_0x4af3('0x91')](_0x7603a0,_0x5c9858));});}})[_0x4af3('0x1f')](handleError(_0x461a78,null));}; \ No newline at end of file +var _0x63f1=['ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','attributes','length','find','body','destroy','describe','create','out','secret','split','MailAccount','findOne','MailAccountId','CmList','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','List','CmContact','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','rejectmessage','download','unix','server','files','tmp','message-%s.eml','from','subject','createdAt','Attachment','headers','bcc','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','eml-format','moment','util','path'];(function(_0x5379d0,_0x49a1fb){var _0xb9120f=function(_0x572e9d){while(--_0x572e9d){_0x5379d0['push'](_0x5379d0['shift']());}};_0xb9120f(++_0x49a1fb);}(_0x63f1,0x9d));var _0x163f=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x63f1[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0x163f('0x0'));var moment=require(_0x163f('0x1'));var BPromise=require('bluebird');var util=require(_0x163f('0x2'));var path=require(_0x163f('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x163f('0x4'));var htmlToText=require(_0x163f('0x5'));var qs=require(_0x163f('0x6'));var logger=require(_0x163f('0x7'))(_0x163f('0x8'));var interaction_log=require(_0x163f('0x7'))(_0x163f('0x9'));var config=require(_0x163f('0xa'));var db=require(_0x163f('0xb'))['db'];config['redis']=_[_0x163f('0xc')](config[_0x163f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x163f('0xe'))(new Redis(config[_0x163f('0xd')]));var htmlEntities=require(_0x163f('0xf'));require('./mailMessage.socket')[_0x163f('0x10')](socket);var jayson=require(_0x163f('0x11'));var client=jayson[_0x163f('0x12')][_0x163f('0x13')]({'port':0x232c});var client9003=jayson[_0x163f('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x163f('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2102a1,_0xa42971,_0x483d63,_0x1c36ac){return new BPromise(function(_0x14c423,_0x2e631d){var _0x48273e=_0x1c36ac||client;return _0x48273e[_0x163f('0x14')](_0x2102a1,_0x483d63)[_0x163f('0x15')](function(_0x2a1a77){logger[_0x163f('0x16')](_0x163f('0x17'),_0xa42971,'request\x20sent');logger[_0x163f('0x18')](_0x163f('0x19'),_0xa42971,_0x163f('0x1a'),JSON[_0x163f('0x1b')](_0x2a1a77));if(_0x2a1a77[_0x163f('0x1c')]){if(_0x2a1a77[_0x163f('0x1c')]['code']===0x1f4){logger[_0x163f('0x1c')](_0x163f('0x17'),_0xa42971,_0x2a1a77['error'][_0x163f('0x1d')]);return _0x2e631d(_0x2a1a77[_0x163f('0x1c')][_0x163f('0x1d')]);}logger[_0x163f('0x1c')]('MailMessage,\x20%s,\x20%s',_0xa42971,_0x2a1a77['error']['message']);return _0x14c423(_0x2a1a77[_0x163f('0x1c')][_0x163f('0x1d')]);}else{logger[_0x163f('0x16')](_0x163f('0x17'),_0xa42971,'request\x20sent');_0x14c423(_0x2a1a77[_0x163f('0x1e')][_0x163f('0x1d')]);}})[_0x163f('0x1f')](function(_0x3d0eb6){logger[_0x163f('0x1c')](_0x163f('0x17'),_0xa42971,_0x3d0eb6);_0x2e631d(_0x3d0eb6);});});}function respondWithResult(_0x2f9e2e,_0x2d2f7a){_0x2d2f7a=_0x2d2f7a||0xc8;return function(_0x5d9b75){if(_0x5d9b75){return _0x2f9e2e['status'](_0x2d2f7a)[_0x163f('0x20')](_0x5d9b75);}};}function respondWithFilteredResult(_0x579168,_0x21e2df){return function(_0x2e52eb){if(_0x2e52eb){var _0x48a3cf=typeof _0x21e2df['offset']===_0x163f('0x21')&&typeof _0x21e2df[_0x163f('0x22')]===_0x163f('0x21');var _0x17e6f3=_0x2e52eb[_0x163f('0x23')];var _0x368c96=_0x48a3cf?0x0:_0x21e2df['offset'];var _0x53f6ab=_0x48a3cf?_0x2e52eb[_0x163f('0x23')]:_0x21e2df[_0x163f('0x24')]+_0x21e2df[_0x163f('0x22')];var _0x3d5096;if(_0x53f6ab>=_0x17e6f3){_0x53f6ab=_0x17e6f3;_0x3d5096=0xc8;}else{_0x3d5096=0xce;}_0x579168[_0x163f('0x25')](_0x3d5096);return _0x579168[_0x163f('0x26')](_0x163f('0x27'),_0x368c96+'-'+_0x53f6ab+'/'+_0x17e6f3)[_0x163f('0x20')](_0x2e52eb);}return null;};}function saveUpdates(_0x380c55){return function(_0x5df28f){if(_0x5df28f){return _0x5df28f[_0x163f('0x28')](_0x380c55)[_0x163f('0x15')](function(_0xfb5f5b){return _0xfb5f5b;});}return null;};}function removeEntity(_0xc0877a){return function(_0x504136){if(_0x504136){return _0x504136['destroy']()['then'](function(){_0xc0877a[_0x163f('0x25')](0xcc)[_0x163f('0x29')]();});}};}function handleEntityNotFound(_0x4ccb5a){return function(_0x544037){if(!_0x544037){_0x4ccb5a[_0x163f('0x2a')](0x194);}return _0x544037;};}function handleError(_0x13244d,_0x472aa0){_0x472aa0=_0x472aa0||0x1f4;return function(_0x433367){logger['error'](_0x433367[_0x163f('0x2b')]);if(_0x433367[_0x163f('0x2c')]){delete _0x433367[_0x163f('0x2c')];}_0x13244d['status'](_0x472aa0)[_0x163f('0x2d')](_0x433367);};}exports[_0x163f('0x2e')]=function(_0x2bd38b,_0x2812c1){var _0x134c1f={},_0x5c272d={},_0x20ef1b={'count':0x0,'rows':[]};var _0x2cf25c=_[_0x163f('0x2f')](db[_0x163f('0x30')][_0x163f('0x31')],function(_0x460f29){return{'name':_0x460f29[_0x163f('0x32')],'type':_0x460f29[_0x163f('0x33')][_0x163f('0x34')]};});_0x5c272d[_0x163f('0x35')]=_[_0x163f('0x2f')](_0x2cf25c,_0x163f('0x2c'));_0x5c272d['query']=_[_0x163f('0x36')](_0x2bd38b['query']);_0x5c272d[_0x163f('0x37')]=_[_0x163f('0x38')](_0x5c272d[_0x163f('0x35')],_0x5c272d[_0x163f('0x39')]);_0x134c1f['attributes']=_[_0x163f('0x38')](_0x5c272d[_0x163f('0x35')],qs[_0x163f('0x3a')](_0x2bd38b[_0x163f('0x39')][_0x163f('0x3a')]));_0x134c1f['attributes']=_0x134c1f['attributes']['length']?_0x134c1f['attributes']:_0x5c272d[_0x163f('0x35')];if(!_0x2bd38b['query'][_0x163f('0x3b')](_0x163f('0x3c'))){_0x134c1f[_0x163f('0x22')]=qs['limit'](_0x2bd38b[_0x163f('0x39')][_0x163f('0x22')]);_0x134c1f['offset']=qs[_0x163f('0x24')](_0x2bd38b[_0x163f('0x39')]['offset']);}_0x134c1f[_0x163f('0x3d')]=qs[_0x163f('0x3e')](_0x2bd38b[_0x163f('0x39')][_0x163f('0x3e')]);_0x134c1f[_0x163f('0x3f')]=qs[_0x163f('0x37')](_[_0x163f('0x40')](_0x2bd38b[_0x163f('0x39')],_0x5c272d[_0x163f('0x37')]),_0x2cf25c);if(_0x2bd38b[_0x163f('0x39')][_0x163f('0x41')]){_0x134c1f[_0x163f('0x3f')]=_[_0x163f('0x42')](_0x134c1f[_0x163f('0x3f')],{'$or':_[_0x163f('0x2f')](_0x2cf25c,function(_0x6cd0d6){if(_0x6cd0d6[_0x163f('0x33')]!==_0x163f('0x43')){var _0x3abe3e={};_0x3abe3e[_0x6cd0d6[_0x163f('0x2c')]]={'$like':'%'+_0x2bd38b[_0x163f('0x39')][_0x163f('0x41')]+'%'};return _0x3abe3e;}})});}_0x134c1f=_[_0x163f('0x42')]({},_0x134c1f,_0x2bd38b[_0x163f('0x44')]);var _0x572e6a={'where':_0x134c1f[_0x163f('0x3f')]};return db[_0x163f('0x30')][_0x163f('0x23')](_0x572e6a)[_0x163f('0x15')](function(_0x386c03){_0x20ef1b['count']=_0x386c03;if(_0x2bd38b[_0x163f('0x39')][_0x163f('0x45')]){_0x134c1f[_0x163f('0x46')]=[{'all':!![]}];}return db['MailMessage'][_0x163f('0x47')](_0x134c1f);})[_0x163f('0x15')](function(_0x4389cc){_0x20ef1b['rows']=_0x4389cc;return _0x20ef1b;})['then'](respondWithFilteredResult(_0x2812c1,_0x134c1f))[_0x163f('0x1f')](handleError(_0x2812c1,null));};exports[_0x163f('0x48')]=function(_0x167987,_0x2b4a8f){var _0x221700={'raw':!![],'where':{'id':_0x167987[_0x163f('0x49')]['id']}},_0x5276c2={};_0x5276c2[_0x163f('0x35')]=_['keys'](db[_0x163f('0x30')][_0x163f('0x31')]);_0x5276c2[_0x163f('0x39')]=_[_0x163f('0x36')](_0x167987['query']);_0x5276c2['filters']=_[_0x163f('0x38')](_0x5276c2[_0x163f('0x35')],_0x5276c2[_0x163f('0x39')]);_0x221700[_0x163f('0x4a')]=_[_0x163f('0x38')](_0x5276c2[_0x163f('0x35')],qs[_0x163f('0x3a')](_0x167987['query'][_0x163f('0x3a')]));_0x221700['attributes']=_0x221700[_0x163f('0x4a')][_0x163f('0x4b')]?_0x221700['attributes']:_0x5276c2[_0x163f('0x35')];if(_0x167987[_0x163f('0x39')][_0x163f('0x45')]){_0x221700[_0x163f('0x46')]=[{'all':!![]}];}_0x221700=_[_0x163f('0x42')]({},_0x221700,_0x167987[_0x163f('0x44')]);return db[_0x163f('0x30')][_0x163f('0x4c')](_0x221700)[_0x163f('0x15')](handleEntityNotFound(_0x2b4a8f,null))[_0x163f('0x15')](respondWithResult(_0x2b4a8f,null))[_0x163f('0x1f')](handleError(_0x2b4a8f,null));};exports[_0x163f('0x28')]=function(_0x461efd,_0x42eeec){if(_0x461efd[_0x163f('0x4d')]['id']){delete _0x461efd['body']['id'];}return db[_0x163f('0x30')][_0x163f('0x4c')]({'where':{'id':_0x461efd[_0x163f('0x49')]['id']}})['then'](handleEntityNotFound(_0x42eeec,null))[_0x163f('0x15')](saveUpdates(_0x461efd[_0x163f('0x4d')],null))[_0x163f('0x15')](respondWithResult(_0x42eeec,null))[_0x163f('0x1f')](handleError(_0x42eeec,null));};exports[_0x163f('0x4e')]=function(_0x2e857a,_0x63ea50){return db[_0x163f('0x30')][_0x163f('0x4c')]({'where':{'id':_0x2e857a[_0x163f('0x49')]['id']}})[_0x163f('0x15')](handleEntityNotFound(_0x63ea50,null))[_0x163f('0x15')](removeEntity(_0x63ea50,null))[_0x163f('0x1f')](handleError(_0x63ea50,null));};exports[_0x163f('0x4f')]=function(_0x3968e8,_0x1e58de){return db[_0x163f('0x30')][_0x163f('0x4f')]()[_0x163f('0x15')](respondWithResult(_0x1e58de,null))[_0x163f('0x1f')](handleError(_0x1e58de,null));};exports[_0x163f('0x50')]=function(_0x3b87ea,_0x4d482d){return db['MailMessage'][_0x163f('0x50')](_0x3b87ea[_0x163f('0x4d')])[_0x163f('0x15')](function(_0x561060){if(_0x561060){if(_0x561060['direction']===_0x163f('0x51')&&!_0x561060[_0x163f('0x52')]){var _0x4c0c7b,_0x398f35,_0x71ea40;if(_0x3b87ea[_0x163f('0x4d')]['to']){_0x398f35=_0x3b87ea[_0x163f('0x4d')]['to'][_0x163f('0x53')](',')[0x0];}return db[_0x163f('0x54')][_0x163f('0x55')]({'where':{'id':_0x561060[_0x163f('0x56')]},'include':[{'model':db[_0x163f('0x57')],'as':'List','include':[{'model':db['CmContact'],'as':_0x163f('0x58'),'where':{'email':_0x398f35},'limit':0x1,'order':[['updatedAt',_0x163f('0x59')]]}]},{'model':db['MailServerOut'],'as':_0x163f('0x5a'),'raw':!![],'include':[{'model':db[_0x163f('0x5b')],'as':_0x163f('0x5b'),'raw':!![]}]}]})[_0x163f('0x15')](function(_0x48c7d8){_0x4c0c7b=_0x48c7d8;if(!_0x4c0c7b||!_0x4c0c7b[_0x163f('0x5a')])return;var _0x2ec109=_0x4c0c7b[_0x163f('0x5c')]();if(_0x3b87ea[_0x163f('0x4d')][_0x163f('0x5d')]&&_0x3b87ea['body'][_0x163f('0x5d')]['length']){for(var _0x22e37e=0x0;_0x22e37e<_0x3b87ea[_0x163f('0x4d')][_0x163f('0x5d')][_0x163f('0x4b')];_0x22e37e+=0x1){_0x3b87ea['body'][_0x163f('0x5d')][_0x22e37e]={'filename':_0x3b87ea[_0x163f('0x4d')][_0x163f('0x5d')][_0x22e37e][_0x163f('0x2c')],'path':path[_0x163f('0x5e')](config['root'],_0x163f('0x5f'),_0x3b87ea[_0x163f('0x4d')][_0x163f('0x5d')][_0x22e37e][_0x163f('0x60')])};}}_0x71ea40={'account':_0x2ec109,'message':_0x3b87ea[_0x163f('0x4d')]};return;})['then'](function(){if(_0x4c0c7b['List']){if(_0x4c0c7b[_0x163f('0x61')][_0x163f('0x58')][_0x163f('0x4b')]){return _0x4c0c7b[_0x163f('0x61')][_0x163f('0x58')][0x0];}else{return db[_0x163f('0x62')][_0x163f('0x50')](_[_0x163f('0xc')](_0x3b87ea[_0x163f('0x4d')],{'firstName':_0x3b87ea[_0x163f('0x4d')]['to'],'email':_0x3b87ea['body']['to'],'phone':_0x3b87ea[_0x163f('0x4d')]['to'],'ListId':_0x4c0c7b['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x163f('0x15')](function(){if(_0x71ea40){return respondWithRpcPromise('SendMail',_0x163f('0x63'),_0x71ea40,client9003)['then'](function(_0x3b0054){return _0x561060[_0x163f('0x28')]({'read':!![],'messageId':_0x3b0054['messageId'],'sentAt':moment()[_0x163f('0x64')](_0x163f('0x65'))});})[_0x163f('0x1f')](function(_0x4a2457){logger[_0x163f('0x1c')]('%s',JSON[_0x163f('0x1b')](_0x4a2457));return _0x561060;});}return _0x561060;});}return _0x561060;}})[_0x163f('0x15')](respondWithResult(_0x4d482d,0xc9))['catch'](handleError(_0x4d482d,null));};exports[_0x163f('0x66')]=function(_0x31a44c,_0x5d5e96){var _0x356b3c={'agent':{},'channel':_0x163f('0x67')};if(_0x31a44c[_0x163f('0x4d')]['id']){delete _0x31a44c[_0x163f('0x4d')]['id'];}_0x31a44c[_0x163f('0x4d')][_0x163f('0x68')]=!![];_0x31a44c['body'][_0x163f('0x69')]=moment()['format'](_0x163f('0x65'));_0x31a44c[_0x163f('0x4d')][_0x163f('0x6a')]=_0x31a44c['body'][_0x163f('0x6a')]||_0x31a44c[_0x163f('0x6b')]['id'];_0x356b3c['agent']['id']=_0x31a44c[_0x163f('0x4d')][_0x163f('0x6a')];return db[_0x163f('0x30')]['find']({'where':{'id':_0x31a44c[_0x163f('0x49')]['id'],'UserId':null}})[_0x163f('0x15')](handleEntityNotFound(_0x5d5e96,null))[_0x163f('0x15')](saveUpdates(_0x31a44c[_0x163f('0x4d')],null))[_0x163f('0x15')](function(_0x15cf08){if(_0x15cf08){_0x356b3c[_0x163f('0x1d')]=_0x15cf08['get']({'plain':!![]});return db[_0x163f('0x6c')][_0x163f('0x4c')]({'where':{'id':_0x15cf08['MailInteractionId']}});}return null;})[_0x163f('0x15')](handleEntityNotFound(_0x5d5e96,null))[_0x163f('0x15')](function(_0x54a4b7){if(_0x54a4b7){return _0x54a4b7[_0x163f('0x28')]({'UserId':_0x31a44c[_0x163f('0x4d')][_0x163f('0x6a')],'read1stAt':_[_0x163f('0x6d')](_0x54a4b7[_0x163f('0x6e')])?moment()[_0x163f('0x64')](_0x163f('0x65')):undefined});}return null;})[_0x163f('0x15')](function(_0x493abc){if(_0x493abc){_0x356b3c[_0x163f('0x6f')]=_0x493abc['get']({'plain':!![]});interaction_log['info'](_0x163f('0x70'),_0x31a44c[_0x163f('0x6b')]['id'],_0x31a44c[_0x163f('0x6b')][_0x163f('0x2c')],_0x31a44c[_0x163f('0x6b')][_0x163f('0x71')],_0x356b3c[_0x163f('0x6f')]['id'],_0x31a44c[_0x163f('0x4d')]?JSON[_0x163f('0x1b')](_0x31a44c[_0x163f('0x4d')]):_0x163f('0x72'));return respondWithRpcPromise(_0x163f('0x73'),_0x163f('0x74'),_0x356b3c);}return null;})[_0x163f('0x15')](function(_0xc463ad){var _0x578b72=_0x163f('0x75')+_0xc463ad[_0x163f('0x1d')][_0x163f('0x76')];return db[_0x163f('0x77')]['query'](_0x578b72,{'type':db[_0x163f('0x78')][_0x163f('0x79')]['SELECT'],'raw':!![]})[_0x163f('0x15')](function(_0x3a392b){return _0x3a392b;});})[_0x163f('0x15')](function(_0x64f73c){if(_0x64f73c){_0x356b3c[_0x163f('0x1d')][_0x163f('0x7a')]=_0x64f73c[0x0];if(!_0x31a44c['body'][_0x163f('0x6a')])return;return db[_0x163f('0x7b')][_0x163f('0x4c')]({'where':{'id':_0x31a44c[_0x163f('0x4d')][_0x163f('0x6a')],'role':_0x163f('0x7c')},'attributes':['id',_0x163f('0x2c'),_0x163f('0x7d'),_0x163f('0x7e'),_0x163f('0x7f')],'raw':!![]});}return null;})['then'](function(_0x2ab8db){if(!_0x2ab8db)return null;_0x356b3c[_0x163f('0x1d')][_0x163f('0x7c')]=_0x2ab8db;return _0x356b3c;})['then'](function(_0x2f535e){if(_0x2f535e){if(_0x31a44c[_0x163f('0x4d')][_0x163f('0x80')]){_0x356b3c[_0x163f('0x1d')][_0x163f('0x81')]=util[_0x163f('0x64')](_0x163f('0x82'),_0x31a44c['user']['name']);_0x356b3c[_0x163f('0x1d')][_0x163f('0x83')]=_0x356b3c[_0x163f('0x83')];_0x356b3c['message'][_0x163f('0x84')]=_0x356b3c['channel'];_0x356b3c[_0x163f('0x1d')][_0x163f('0x85')]='accept';_0x356b3c[_0x163f('0x1d')][_0x163f('0x4d')]=htmlToText[_0x163f('0x86')](_0x356b3c[_0x163f('0x1d')][_0x163f('0x4d')]);return respondWithRpcPromise('EventManager',_0x163f('0x87'),{'event':_0x163f('0x88'),'message':_0x356b3c[_0x163f('0x1d')]},client9002)[_0x163f('0x15')](function(){return _0x356b3c;});}return _0x356b3c;}return null;})['then'](respondWithResult(_0x5d5e96,null))['catch'](handleError(_0x5d5e96,null));};exports['reject']=function(_0x25633e,_0x2ba034){var _0x556e4f={'agent':{},'channel':_0x163f('0x67')};if(_0x25633e[_0x163f('0x4d')]['id']){delete _0x25633e[_0x163f('0x4d')]['id'];}_0x25633e[_0x163f('0x4d')][_0x163f('0x6a')]=_0x25633e[_0x163f('0x4d')][_0x163f('0x6a')]||_0x25633e[_0x163f('0x6b')]['id'];_0x556e4f['agent']['id']=_0x25633e[_0x163f('0x4d')]['UserId'];return db['MailMessage'][_0x163f('0x4c')]({'where':{'id':_0x25633e[_0x163f('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2ba034,null))[_0x163f('0x15')](function(_0x3ba591){if(_0x3ba591){_0x556e4f[_0x163f('0x1d')]=_0x3ba591['get']({'plain':!![]});return db[_0x163f('0x6c')][_0x163f('0x4c')]({'where':{'id':_0x3ba591[_0x163f('0x89')]}});}return null;})['then'](handleEntityNotFound(_0x2ba034,null))[_0x163f('0x15')](function(_0x2f84e2){if(_0x2f84e2){_0x556e4f[_0x163f('0x6f')]=_0x2f84e2['get']({'plain':!![]});interaction_log['info'](_0x163f('0x8a'),_0x25633e[_0x163f('0x6b')]['id'],_0x25633e[_0x163f('0x6b')][_0x163f('0x2c')],_0x25633e[_0x163f('0x6b')][_0x163f('0x71')],_0x556e4f['interaction']['id'],_0x25633e[_0x163f('0x4d')]?JSON[_0x163f('0x1b')](_0x25633e[_0x163f('0x4d')]):_0x163f('0x72'));return respondWithRpcPromise('RejectMessage',_0x163f('0x8b'),_0x556e4f);}return null;})[_0x163f('0x15')](function(_0x130883){var _0x74193f=_0x163f('0x75')+_0x130883[_0x163f('0x1d')][_0x163f('0x76')];return db[_0x163f('0x77')][_0x163f('0x39')](_0x74193f,{'type':db[_0x163f('0x78')][_0x163f('0x79')][_0x163f('0x8c')],'raw':!![]})[_0x163f('0x15')](function(_0x53b761){return _0x53b761;});})[_0x163f('0x15')](function(_0x2fd7fc){if(_0x2fd7fc){_0x556e4f[_0x163f('0x1d')][_0x163f('0x7a')]=_0x2fd7fc[0x0];if(!_0x25633e[_0x163f('0x4d')][_0x163f('0x6a')])return;return db[_0x163f('0x7b')][_0x163f('0x4c')]({'where':{'id':_0x25633e[_0x163f('0x4d')]['UserId'],'role':_0x163f('0x7c')},'attributes':['id',_0x163f('0x2c'),_0x163f('0x7d'),_0x163f('0x7e'),_0x163f('0x7f')],'raw':!![]});}return null;})['then'](function(_0x4960b6){if(!_0x4960b6)return null;_0x556e4f[_0x163f('0x1d')][_0x163f('0x7c')]=_0x4960b6;return _0x556e4f;})[_0x163f('0x15')](function(_0x2f66d){if(_0x2f66d){_0x2f66d['message']['interface']=util[_0x163f('0x64')]('SIP/%s',_0x25633e[_0x163f('0x6b')][_0x163f('0x2c')]);_0x2f66d['message'][_0x163f('0x83')]=_0x556e4f[_0x163f('0x83')];_0x2f66d['message'][_0x163f('0x84')]=_0x556e4f['channel'];_0x2f66d[_0x163f('0x1d')][_0x163f('0x85')]='reject';_0x2f66d['message'][_0x163f('0x4d')]=htmlToText[_0x163f('0x86')](_0x556e4f[_0x163f('0x1d')]['body']);respondWithRpcPromise(_0x163f('0x87'),_0x163f('0x87'),{'event':_0x163f('0x8d'),'message':_0x2f66d[_0x163f('0x1d')]},client9002);return _0x556e4f;}return null;})[_0x163f('0x15')](respondWithResult(_0x2ba034,null))[_0x163f('0x1f')](handleError(_0x2ba034,null));};exports[_0x163f('0x8e')]=function(_0x1d795c,_0xcc7c36){var _0x2cd449=moment()[_0x163f('0x8f')]()['toString']();var _0x34d0f3=path[_0x163f('0x5e')](config['root'],_0x163f('0x90'),_0x163f('0x91'),_0x163f('0x92'));var _0x1430c0=path[_0x163f('0x5e')](config['root'],_0x163f('0x90'),'files','attachments');var _0x599033=util['format'](_0x163f('0x93'),_0x2cd449);return db[_0x163f('0x30')][_0x163f('0x4c')]({'where':{'id':_0x1d795c['params']['id']},'attributes':['id','body',_0x163f('0x94'),'to','cc','bcc',_0x163f('0x95'),_0x163f('0x96')],'include':_0x1d795c[_0x163f('0x39')][_0x163f('0x5d')]?[{'model':db[_0x163f('0x97')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0xcc7c36,null))['then'](function(_0xe1cb1d){if(_0xe1cb1d){var _0x4416a7=_0xe1cb1d;var _0x544eea={'from':_0x4416a7[_0x163f('0x94')],'to':_0x4416a7['to'],'subject':_0x4416a7['subject'],'html':htmlEntities['decode'](_0x4416a7[_0x163f('0x4d')]),'headers':{'Date':moment(_0x4416a7[_0x163f('0x96')])[_0x163f('0x64')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xe1cb1d['cc']){_0x544eea[_0x163f('0x98')]['Cc']=_0xe1cb1d['cc'];}if(_0xe1cb1d[_0x163f('0x99')]){_0x544eea[_0x163f('0x98')][_0x163f('0x9a')]=_0xe1cb1d[_0x163f('0x99')];}return new BPromise(function(_0x55f4a8,_0x205204){if(_0xe1cb1d[_0x163f('0x9b')]){for(var _0x13e86f=0x0;_0x13e86f<_0xe1cb1d['Attachments'][_0x163f('0x4b')];_0x13e86f++){var _0x2f340e=_0xe1cb1d[_0x163f('0x9b')][_0x13e86f];var _0x3ea55f=path['join'](_0x1430c0,_0x2f340e[_0x163f('0x60')]);if(fs[_0x163f('0x9c')](_0x3ea55f)){_0x544eea[_0x163f('0x5d')][_0x163f('0x9d')]({'name':_0x2f340e[_0x163f('0x2c')],'contentType':_0x2f340e[_0x163f('0x33')],'data':fs[_0x163f('0x9e')](_0x3ea55f)});}}}emlformat[_0x163f('0x9f')](_0x544eea,function(_0x1ad5ab,_0x5874af){if(_0x1ad5ab)return _0x205204(_0x1ad5ab);fs[_0x163f('0xa0')](path[_0x163f('0x5e')](_0x34d0f3,_0x599033),_0x5874af);return _0x55f4a8(_0x5874af);});});}})[_0x163f('0x15')](function(_0x40c4a6){if(_0x40c4a6){return _0xcc7c36['download'](path[_0x163f('0x5e')](_0x34d0f3,_0x599033),_0x599033,function(_0x46b432){if(!_0x46b432)fs['unlinkSync'](path['join'](_0x34d0f3,_0x599033));});}})[_0x163f('0x1f')](handleError(_0xcc7c36,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 523c051..abbdc83 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 _0x32c5=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32c5,0xff));var _0x532c=function(_0xc68d60,_0x37565e){_0xc68d60=_0xc68d60-0x0;var _0x3623be=_0x32c5[_0xc68d60];return _0x3623be;};'use strict';var EventEmitter=require(_0x532c('0x0'));var MailMessage=require(_0x532c('0x1'))['db'][_0x532c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x532c('0x3')](0x0);var events={'afterCreate':_0x532c('0x4'),'afterUpdate':_0x532c('0x5'),'afterDestroy':_0x532c('0x6')};function emitEvent(_0x1e2ba3){return function(_0x146ae,_0x45f031,_0x549acd){MailMessageEvents['emit'](_0x1e2ba3+':'+_0x146ae['id'],_0x146ae);MailMessageEvents['emit'](_0x1e2ba3,_0x146ae);_0x549acd(null);};}for(var e in events){if(events[_0x532c('0x7')](e)){var event=events[e];MailMessage[_0x532c('0x8')](e,emitEvent(event));}}module[_0x532c('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x3a26=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x10a563,_0x3b91fc){var _0x2cfc5d=function(_0x343cdc){while(--_0x343cdc){_0x10a563['push'](_0x10a563['shift']());}};_0x2cfc5d(++_0x3b91fc);}(_0x3a26,0x1cb));var _0x63a2=function(_0x3a87e8,_0x5dd8bf){_0x3a87e8=_0x3a87e8-0x0;var _0x4c7055=_0x3a26[_0x3a87e8];return _0x4c7055;};'use strict';var EventEmitter=require(_0x63a2('0x0'));var MailMessage=require(_0x63a2('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x63a2('0x2')](0x0);var events={'afterCreate':_0x63a2('0x3'),'afterUpdate':_0x63a2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x187b9a){return function(_0x2251ec,_0x17380c,_0x58db58){MailMessageEvents[_0x63a2('0x5')](_0x187b9a+':'+_0x2251ec['id'],_0x2251ec);MailMessageEvents['emit'](_0x187b9a,_0x2251ec);_0x58db58(null);};}for(var e in events){if(events[_0x63a2('0x6')](e)){var event=events[e];MailMessage[_0x63a2('0x7')](e,emitEvent(event));}}module[_0x63a2('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 15f6f2d..1465605 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 _0x7059=['toLowerCase','direction','out','secret','isNil','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','plainBody','subject','fromString','body','models','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7059,0x162));var _0x9705=function(_0x36e5f1,_0x94558d){_0x36e5f1=_0x36e5f1-0x0;var _0x18c8a3=_0x7059[_0x36e5f1];return _0x18c8a3;};'use strict';var _=require('lodash');var util=require(_0x9705('0x0'));var logger=require(_0x9705('0x1'))(_0x9705('0x2'));var moment=require(_0x9705('0x3'));var BPromise=require('bluebird');var rp=require(_0x9705('0x4'));var htmlToText=require(_0x9705('0x5'));var fs=require('fs');var path=require(_0x9705('0x6'));var rimraf=require(_0x9705('0x7'));var config=require(_0x9705('0x8'));var attributes=require(_0x9705('0x9'));module[_0x9705('0xa')]=function(_0x3e4c1f,_0x54a323){return _0x3e4c1f[_0x9705('0xb')](_0x9705('0xc'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x9705('0xd'),'fields':[_0x9705('0xd')]},{'name':'fti_mail_messages','fields':[_0x9705('0xe'),_0x9705('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2686b1,_0x24f062,_0x4ecdd5){if(_0x2686b1['body']){_0x2686b1[_0x9705('0xe')]=htmlToText[_0x9705('0x10')](_0x2686b1[_0x9705('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4ecdd5(null,_0x24f062);},'afterCreate':function(_0x3da1ea,_0x11164f,_0x5799a4){var _0x1b3db5=_0x3e4c1f[_0x9705('0x12')];var _0x6f46af=_0x3da1ea[_0x9705('0x13')]({'plain':!![]});if(_0x6f46af['direction'][_0x9705('0x14')]()==='in'||_0x6f46af[_0x9705('0x15')]['toLowerCase']()===_0x9705('0x16')&&!_0x6f46af[_0x9705('0x17')]&&!_[_0x9705('0x18')](_0x6f46af['UserId'])){_0x1b3db5['MailInteraction'][_0x9705('0x19')]({'where':{'id':_0x6f46af[_0x9705('0x1a')]}})[_0x9705('0x1b')](function(_0x24555f){if(_0x24555f){_0x24555f[_0x9705('0x1c')]({'lastMsgAt':_0x6f46af[_0x9705('0x1d')],'lastMsgDirection':_0x6f46af[_0x9705('0x15')]['toLowerCase']()});}})[_0x9705('0x1e')](function(_0x380ea7){console[_0x9705('0x1f')](_0x380ea7);});}_0x5799a4();}},'charset':_0x9705('0x20'),'collate':_0x9705('0x21')});}; \ No newline at end of file +var _0xbcef=['moment','bluebird','request-promise','path','./mailMessage.attributes','define','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','out','isNil','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x321106,_0x464618){var _0x42f1d6=function(_0x57a0e1){while(--_0x57a0e1){_0x321106['push'](_0x321106['shift']());}};_0x42f1d6(++_0x464618);}(_0xbcef,0x13c));var _0xfbce=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbcef[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfbce('0x0'));var util=require('util');var logger=require(_0xfbce('0x1'))(_0xfbce('0x2'));var moment=require(_0xfbce('0x3'));var BPromise=require(_0xfbce('0x4'));var rp=require(_0xfbce('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xfbce('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfbce('0x7'));module['exports']=function(_0x2db547,_0x512390){return _0x2db547[_0xfbce('0x8')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfbce('0x9')]},{'name':'fti_mail_messages','fields':[_0xfbce('0xa'),_0xfbce('0xb')],'type':_0xfbce('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x31a711,_0x56a40b,_0x3be22a){if(_0x31a711[_0xfbce('0xd')]){_0x31a711['plainBody']=htmlToText[_0xfbce('0xe')](_0x31a711[_0xfbce('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3be22a(null,_0x56a40b);},'afterCreate':function(_0x44da4c,_0x1a92ba,_0x1a8720){var _0x4d0bba=_0x2db547[_0xfbce('0xf')];var _0x570342=_0x44da4c[_0xfbce('0x10')]({'plain':!![]});if(_0x570342['direction'][_0xfbce('0x11')]()==='in'||_0x570342['direction']['toLowerCase']()===_0xfbce('0x12')&&!_0x570342['secret']&&!_[_0xfbce('0x13')](_0x570342['UserId'])){_0x4d0bba[_0xfbce('0x14')]['findOne']({'where':{'id':_0x570342[_0xfbce('0x15')]}})[_0xfbce('0x16')](function(_0x17744f){if(_0x17744f){_0x17744f[_0xfbce('0x17')]({'lastMsgAt':_0x570342[_0xfbce('0x18')],'lastMsgDirection':_0x570342['direction'][_0xfbce('0x11')]()});}})[_0xfbce('0x19')](function(_0xec500b){console[_0xfbce('0x1a')](_0xec500b);});}_0x1a8720();}},'charset':_0xfbce('0x1b'),'collate':_0xfbce('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fcb5b37..bfeed9a 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 _0xf4f4=['message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3acfa8,_0x41be03){var _0x323497=function(_0xbc8e3e){while(--_0xbc8e3e){_0x3acfa8['push'](_0x3acfa8['shift']());}};_0x323497(++_0x41be03);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x1adfab,_0x57bc5b){_0x1adfab=_0x1adfab-0x0;var _0x4f145d=_0xf4f4[_0x1adfab];return _0x4f145d;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});config[_0x4f4f('0xb')]=_[_0x4f4f('0xc')](config[_0x4f4f('0xb')],{'host':_0x4f4f('0xd'),'port':0x18eb});var socket=require(_0x4f4f('0xe'))(new Redis(config['redis']));require(_0x4f4f('0xf'))[_0x4f4f('0x10')](socket);function respondWithRpcPromise(_0x39e36b,_0x2d86d1,_0x116f22){return new BPromise(function(_0x11940f,_0x87a9a2){return client[_0x4f4f('0x11')](_0x39e36b,_0x116f22)['then'](function(_0x5956c6){logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));logger[_0x4f4f('0x15')](_0x4f4f('0x16'),_0x2d86d1,_0x4f4f('0x14'),JSON['stringify'](_0x5956c6));if(_0x5956c6[_0x4f4f('0x17')]){if(_0x5956c6['error'][_0x4f4f('0x18')]===0x1f4){logger[_0x4f4f('0x17')](_0x4f4f('0x13'),_0x2d86d1,_0x5956c6[_0x4f4f('0x17')]['message']);return _0x87a9a2(_0x5956c6[_0x4f4f('0x17')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);return _0x11940f(_0x5956c6[_0x4f4f('0x17')][_0x4f4f('0x19')]);}else{logger[_0x4f4f('0x12')](_0x4f4f('0x13'),_0x2d86d1,_0x4f4f('0x14'));_0x11940f(_0x5956c6[_0x4f4f('0x1a')][_0x4f4f('0x19')]);}})[_0x4f4f('0x1b')](function(_0x32b549){logger[_0x4f4f('0x17')]('MailMessage,\x20%s,\x20%s',_0x2d86d1,_0x32b549);_0x87a9a2(_0x32b549);});});}exports[_0x4f4f('0x1c')]=function(_0x4622c2){var _0x2f84e5=this;return new Promise(function(_0x201c60,_0x302a79){return db[_0x4f4f('0x1d')][_0x4f4f('0x1e')](_0x4622c2[_0x4f4f('0x1f')],{'raw':_0x4622c2[_0x4f4f('0x20')]?_0x4622c2[_0x4f4f('0x20')][_0x4f4f('0x21')]===undefined?!![]:![]:!![]})[_0x4f4f('0x22')](function(_0x17984d){logger[_0x4f4f('0x12')]('CreateMailMessage',_0x4622c2);logger['debug']('CreateMailMessage',_0x4622c2,JSON[_0x4f4f('0x23')](_0x17984d));_0x201c60(_0x17984d);})[_0x4f4f('0x1b')](function(_0x5186ac){logger[_0x4f4f('0x17')](_0x4f4f('0x1c'),_0x5186ac[_0x4f4f('0x19')],_0x4622c2);_0x302a79(_0x2f84e5[_0x4f4f('0x17')](0x1f4,_0x5186ac[_0x4f4f('0x19')]));});});}; \ No newline at end of file +var _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x35560c,_0x5832af){var _0x162b5a=function(_0x108a94){while(--_0x108a94){_0x35560c['push'](_0x35560c['shift']());}};_0x162b5a(++_0x5832af);}(_0x958a,0x128));var _0xa958=function(_0x455ba5,_0x4f0c86){_0x455ba5=_0x455ba5-0x0;var _0x51a9be=_0x958a[_0x455ba5];return _0x51a9be;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7ffd7ca..99666db 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 _0x9378=['mailMessage:','./mailMessage.events','update','emit','removeListener','register','length'];(function(_0x59c549,_0x40ba1b){var _0x594ba4=function(_0x56b4ce){while(--_0x56b4ce){_0x59c549['push'](_0x59c549['shift']());}};_0x594ba4(++_0x40ba1b);}(_0x9378,0x14a));var _0x8937=function(_0x4d27b3,_0x334fe0){_0x4d27b3=_0x4d27b3-0x0;var _0x17967c=_0x9378[_0x4d27b3];return _0x17967c;};'use strict';var MailMessageEvents=require(_0x8937('0x0'));var events=['save','remove',_0x8937('0x1')];function createListener(_0x351920,_0x28236a){return function(_0x5c0dfd){_0x28236a[_0x8937('0x2')](_0x351920,_0x5c0dfd);};}function removeListener(_0x4e7f5d,_0x159530){return function(){MailMessageEvents[_0x8937('0x3')](_0x4e7f5d,_0x159530);};}exports[_0x8937('0x4')]=function(_0x5e0750){for(var _0x2c6655=0x0,_0x2c5620=events[_0x8937('0x5')];_0x2c6655<_0x2c5620;_0x2c6655++){var _0x2559bd=events[_0x2c6655];var _0x4e5aab=createListener(_0x8937('0x6')+_0x2559bd,_0x5e0750);MailMessageEvents['on'](_0x2559bd,_0x4e5aab);}}; \ No newline at end of file +var _0x0f0c=['mailMessage:','./mailMessage.events','remove','update','removeListener','length'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x0f0c,0xaf));var _0xc0f0=function(_0x3d5a37,_0x2ac2f8){_0x3d5a37=_0x3d5a37-0x0;var _0x28723f=_0x0f0c[_0x3d5a37];return _0x28723f;};'use strict';var MailMessageEvents=require(_0xc0f0('0x0'));var events=['save',_0xc0f0('0x1'),_0xc0f0('0x2')];function createListener(_0x183f4e,_0x13aa40){return function(_0x561fe5){_0x13aa40['emit'](_0x183f4e,_0x561fe5);};}function removeListener(_0x1fc24d,_0xe24a3f){return function(){MailMessageEvents[_0xc0f0('0x3')](_0x1fc24d,_0xe24a3f);};}exports['register']=function(_0x471a2f){for(var _0x57a5d3=0x0,_0x1a6ca6=events[_0xc0f0('0x4')];_0x57a5d3<_0x1a6ca6;_0x57a5d3++){var _0x41e8da=events[_0x57a5d3];var _0x2e520c=createListener(_0xc0f0('0x5')+_0x41e8da,_0x471a2f);MailMessageEvents['on'](_0x41e8da,_0x2e520c);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 193114f..5bab310 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 _0x11ca=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','destroy','removeTeams','multer','util','path','connect-timeout','express','Router'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x11ca,0x76));var _0xa11c=function(_0x47288c,_0x12ec50){_0x47288c=_0x47288c-0x0;var _0x530d98=_0x11ca[_0x47288c];return _0x530d98;};'use strict';var multer=require(_0xa11c('0x0'));var util=require(_0xa11c('0x1'));var path=require(_0xa11c('0x2'));var timeout=require(_0xa11c('0x3'));var express=require(_0xa11c('0x4'));var router=express[_0xa11c('0x5')]();var fs_extra=require(_0xa11c('0x6'));var auth=require(_0xa11c('0x7'));var interaction=require(_0xa11c('0x8'));var config=require(_0xa11c('0x9'));var controller=require(_0xa11c('0xa'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa11c('0xb')](_0xa11c('0xc'),auth[_0xa11c('0xd')](),controller[_0xa11c('0xe')]);router['get'](_0xa11c('0xf'),auth[_0xa11c('0xd')](),controller[_0xa11c('0x10')]);router[_0xa11c('0xb')](_0xa11c('0x11'),auth['isAuthenticated'](),controller[_0xa11c('0x12')]);router[_0xa11c('0xb')]('/:id/teams',auth[_0xa11c('0xd')](),controller[_0xa11c('0x13')]);router[_0xa11c('0xb')](_0xa11c('0x14'),auth[_0xa11c('0xd')](),controller[_0xa11c('0x15')]);router['post']('/',auth[_0xa11c('0xd')](),controller[_0xa11c('0x16')]);router[_0xa11c('0x17')](_0xa11c('0x18'),auth[_0xa11c('0xd')](),controller[_0xa11c('0x19')]);router[_0xa11c('0x17')](_0xa11c('0x14'),auth['isAuthenticated'](),controller[_0xa11c('0x1a')]);router[_0xa11c('0x1b')]('/:id',auth[_0xa11c('0xd')](),controller[_0xa11c('0x1c')]);router['delete'](_0xa11c('0xf'),auth[_0xa11c('0xd')](),controller[_0xa11c('0x1d')]);router['delete'](_0xa11c('0x18'),auth[_0xa11c('0xd')](),controller[_0xa11c('0x1e')]);router['delete'](_0xa11c('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2e10=['removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getAgents','create','post','/:id/teams','addTeams','/:id/users','addAgents','/:id','delete','removeTeams'];(function(_0x47e3f5,_0x1a3360){var _0x54947a=function(_0x122348){while(--_0x122348){_0x47e3f5['push'](_0x47e3f5['shift']());}};_0x54947a(++_0x1a3360);}(_0x2e10,0x8e));var _0x02e1=function(_0x14c5f3,_0x2131fa){_0x14c5f3=_0x14c5f3-0x0;var _0x90549=_0x2e10[_0x14c5f3];return _0x90549;};'use strict';var multer=require('multer');var util=require(_0x02e1('0x0'));var path=require(_0x02e1('0x1'));var timeout=require(_0x02e1('0x2'));var express=require(_0x02e1('0x3'));var router=express[_0x02e1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x02e1('0x5'));var interaction=require(_0x02e1('0x6'));var config=require(_0x02e1('0x7'));var controller=require('./mailQueue.controller');router[_0x02e1('0x8')]('/',auth[_0x02e1('0x9')](),controller[_0x02e1('0xa')]);router[_0x02e1('0x8')](_0x02e1('0xb'),auth[_0x02e1('0x9')](),controller[_0x02e1('0xc')]);router[_0x02e1('0x8')]('/:id',auth[_0x02e1('0x9')](),controller[_0x02e1('0xd')]);router[_0x02e1('0x8')](_0x02e1('0xe'),auth[_0x02e1('0x9')](),controller[_0x02e1('0xf')]);router[_0x02e1('0x8')]('/:id/teams',auth[_0x02e1('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x02e1('0x9')](),controller[_0x02e1('0x10')]);router['post']('/',auth[_0x02e1('0x9')](),controller[_0x02e1('0x11')]);router[_0x02e1('0x12')](_0x02e1('0x13'),auth[_0x02e1('0x9')](),controller[_0x02e1('0x14')]);router[_0x02e1('0x12')](_0x02e1('0x15'),auth[_0x02e1('0x9')](),controller[_0x02e1('0x16')]);router['put']('/:id',auth[_0x02e1('0x9')](),controller['update']);router['delete'](_0x02e1('0x17'),auth[_0x02e1('0x9')](),controller['destroy']);router[_0x02e1('0x18')]('/:id/teams',auth[_0x02e1('0x9')](),controller[_0x02e1('0x19')]);router[_0x02e1('0x18')](_0x02e1('0x15'),auth[_0x02e1('0x9')](),controller[_0x02e1('0x1a')]);module[_0x02e1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 725a9e2..4bec282 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 _0x17a7=['rrmemory','name'];(function(_0x132832,_0x1f8c56){var _0x509e9f=function(_0x4af561){while(--_0x4af561){_0x132832['push'](_0x132832['shift']());}};_0x509e9f(++_0x1f8c56);}(_0x17a7,0x1af));var _0x717a=function(_0x6af388,_0x3f22c1){_0x6af388=_0x6af388-0x0;var _0x3397bb=_0x17a7[_0x6af388];return _0x3397bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x717a('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x717a('0x1'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x2f96=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f96,0x1cd));var _0x62f9=function(_0xb1f138,_0x44ec54){_0xb1f138=_0xb1f138-0x0;var _0x1688c9=_0x2f96[_0xb1f138];return _0x1688c9;};'use strict';var Sequelize=require(_0x62f9('0x0'));module[_0x62f9('0x1')]={'name':{'type':Sequelize[_0x62f9('0x2')],'unique':_0x62f9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x62f9('0x2')]},'timeout':{'type':Sequelize[_0x62f9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x62f9('0x5')](_0x62f9('0x6'),_0x62f9('0x7'),_0x62f9('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4f00181..2ebad0f 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 _0xed65=['VIRTUAL','options','includeAll','findAll','rows','show','params','fields','find','catch','create','body','role','user','userProfileId','autoAssociation','error','describe','findOne','UserMailQueue','sort','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','online','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','addAgents','omit','spread','removeAgents','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','stack','name','send','map','MailQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0xed65,0xd6));var _0x5ed6=function(_0x4de586,_0x183427){_0x4de586=_0x4de586-0x0;var _0x46baf5=_0xed65[_0x4de586];return _0x46baf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ed6('0x0'));var zipdir=require(_0x5ed6('0x1'));var jsonpatch=require(_0x5ed6('0x2'));var rp=require(_0x5ed6('0x3'));var moment=require(_0x5ed6('0x4'));var BPromise=require(_0x5ed6('0x5'));var Mustache=require(_0x5ed6('0x6'));var util=require(_0x5ed6('0x7'));var path=require(_0x5ed6('0x8'));var sox=require(_0x5ed6('0x9'));var csv=require(_0x5ed6('0xa'));var ejs=require(_0x5ed6('0xb'));var fs=require('fs');var fs_extra=require(_0x5ed6('0xc'));var _=require(_0x5ed6('0xd'));var squel=require(_0x5ed6('0xe'));var crypto=require(_0x5ed6('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5ed6('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5ed6('0x11'));var Papa=require(_0x5ed6('0x12'));var Redis=require(_0x5ed6('0x13'));var authService=require(_0x5ed6('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ed6('0x15'));var logger=require(_0x5ed6('0x16'))('api');var utils=require(_0x5ed6('0x17'));var config=require(_0x5ed6('0x18'));var licenseUtil=require(_0x5ed6('0x19'));var db=require(_0x5ed6('0x1a'))['db'];config[_0x5ed6('0x1b')]=_[_0x5ed6('0x1c')](config[_0x5ed6('0x1b')],{'host':_0x5ed6('0x1d'),'port':0x18eb});var socket=require(_0x5ed6('0x1e'))(new Redis(config[_0x5ed6('0x1b')]));require('./mailQueue.socket')[_0x5ed6('0x1f')](socket);function respondWithStatusCode(_0x1f1c11,_0x2b4cac){_0x2b4cac=_0x2b4cac||0xcc;return function(_0x420ca6){if(_0x420ca6){return _0x1f1c11['sendStatus'](_0x2b4cac);}return _0x1f1c11[_0x5ed6('0x20')](_0x2b4cac)[_0x5ed6('0x21')]();};}function respondWithResult(_0x2ce6d3,_0x479045){_0x479045=_0x479045||0xc8;return function(_0x2da062){if(_0x2da062){return _0x2ce6d3['status'](_0x479045)[_0x5ed6('0x22')](_0x2da062);}};}function respondWithFilteredResult(_0x4c6d56,_0x4a8e9c){return function(_0x11988b){if(_0x11988b){var _0x145e41=typeof _0x4a8e9c[_0x5ed6('0x23')]===_0x5ed6('0x24')&&typeof _0x4a8e9c[_0x5ed6('0x25')]===_0x5ed6('0x24');var _0x128780=_0x11988b[_0x5ed6('0x26')];var _0x39c7a8=_0x145e41?0x0:_0x4a8e9c[_0x5ed6('0x23')];var _0x39f2a8=_0x145e41?_0x11988b[_0x5ed6('0x26')]:_0x4a8e9c['offset']+_0x4a8e9c[_0x5ed6('0x25')];var _0x2e6bcb;if(_0x39f2a8>=_0x128780){_0x39f2a8=_0x128780;_0x2e6bcb=0xc8;}else{_0x2e6bcb=0xce;}_0x4c6d56['status'](_0x2e6bcb);return _0x4c6d56[_0x5ed6('0x27')](_0x5ed6('0x28'),_0x39c7a8+'-'+_0x39f2a8+'/'+_0x128780)[_0x5ed6('0x22')](_0x11988b);}return null;};}function patchUpdates(_0x44a7e7){return function(_0x40ad0b){try{jsonpatch[_0x5ed6('0x29')](_0x40ad0b,_0x44a7e7,!![]);}catch(_0x2115de){return BPromise[_0x5ed6('0x2a')](_0x2115de);}return _0x40ad0b[_0x5ed6('0x2b')]();};}function saveUpdates(_0x12f615,_0x3d1954){return function(_0x3f4083){if(_0x3f4083){return _0x3f4083[_0x5ed6('0x2c')](_0x12f615)[_0x5ed6('0x2d')](function(_0x1511ae){return _0x1511ae;});}return null;};}function removeEntity(_0x2bae9d,_0x5f0fcd){return function(_0xfc0e91){if(_0xfc0e91){return _0xfc0e91[_0x5ed6('0x2e')]()[_0x5ed6('0x2d')](function(){var _0x2785a4=_0xfc0e91[_0x5ed6('0x2f')]({'plain':!![]});var _0x11a961=_0x5ed6('0x30');return db[_0x5ed6('0x31')]['destroy']({'where':{'type':_0x11a961,'resourceId':_0x2785a4['id']}})['then'](function(){return _0xfc0e91;});})[_0x5ed6('0x2d')](function(){_0x2bae9d[_0x5ed6('0x20')](0xcc)[_0x5ed6('0x21')]();});}};}function handleEntityNotFound(_0x29ba46,_0x3b6349){return function(_0x428b28){if(!_0x428b28){_0x29ba46[_0x5ed6('0x32')](0x194);}return _0x428b28;};}function handleError(_0x1062c3,_0x314f21){_0x314f21=_0x314f21||0x1f4;return function(_0x48cc3e){logger['error'](_0x48cc3e[_0x5ed6('0x33')]);if(_0x48cc3e[_0x5ed6('0x34')]){delete _0x48cc3e[_0x5ed6('0x34')];}_0x1062c3[_0x5ed6('0x20')](_0x314f21)[_0x5ed6('0x35')](_0x48cc3e);};}exports['index']=function(_0x4aba5f,_0x259a1e){var _0x2a64a3={},_0x134ace={},_0x5bc042={'count':0x0,'rows':[]};var _0x3da4db=_[_0x5ed6('0x36')](db[_0x5ed6('0x37')][_0x5ed6('0x38')],function(_0x34d854){return{'name':_0x34d854[_0x5ed6('0x39')],'type':_0x34d854[_0x5ed6('0x3a')][_0x5ed6('0x3b')]};});_0x134ace[_0x5ed6('0x3c')]=_[_0x5ed6('0x36')](_0x3da4db,'name');_0x134ace[_0x5ed6('0x3d')]=_[_0x5ed6('0x3e')](_0x4aba5f[_0x5ed6('0x3d')]);_0x134ace[_0x5ed6('0x3f')]=_[_0x5ed6('0x40')](_0x134ace[_0x5ed6('0x3c')],_0x134ace[_0x5ed6('0x3d')]);_0x2a64a3[_0x5ed6('0x41')]=_['intersection'](_0x134ace['model'],qs['fields'](_0x4aba5f[_0x5ed6('0x3d')]['fields']));_0x2a64a3[_0x5ed6('0x41')]=_0x2a64a3[_0x5ed6('0x41')][_0x5ed6('0x42')]?_0x2a64a3[_0x5ed6('0x41')]:_0x134ace[_0x5ed6('0x3c')];if(!_0x4aba5f[_0x5ed6('0x3d')][_0x5ed6('0x43')](_0x5ed6('0x44'))){_0x2a64a3[_0x5ed6('0x25')]=qs[_0x5ed6('0x25')](_0x4aba5f[_0x5ed6('0x3d')][_0x5ed6('0x25')]);_0x2a64a3[_0x5ed6('0x23')]=qs[_0x5ed6('0x23')](_0x4aba5f[_0x5ed6('0x3d')][_0x5ed6('0x23')]);}_0x2a64a3[_0x5ed6('0x45')]=qs['sort'](_0x4aba5f[_0x5ed6('0x3d')]['sort']);_0x2a64a3[_0x5ed6('0x46')]=qs[_0x5ed6('0x3f')](_[_0x5ed6('0x47')](_0x4aba5f[_0x5ed6('0x3d')],_0x134ace[_0x5ed6('0x3f')]),_0x3da4db);if(_0x4aba5f[_0x5ed6('0x3d')][_0x5ed6('0x48')]){_0x2a64a3[_0x5ed6('0x46')]=_[_0x5ed6('0x49')](_0x2a64a3[_0x5ed6('0x46')],{'$or':_[_0x5ed6('0x36')](_0x3da4db,function(_0x198297){if(_0x198297['type']!==_0x5ed6('0x4a')){var _0x4a89ea={};_0x4a89ea[_0x198297[_0x5ed6('0x34')]]={'$like':'%'+_0x4aba5f[_0x5ed6('0x3d')][_0x5ed6('0x48')]+'%'};return _0x4a89ea;}})});}_0x2a64a3=_[_0x5ed6('0x49')]({},_0x2a64a3,_0x4aba5f[_0x5ed6('0x4b')]);var _0x246e4b={'where':_0x2a64a3['where']};return db['MailQueue'][_0x5ed6('0x26')](_0x246e4b)[_0x5ed6('0x2d')](function(_0x4ae36a){_0x5bc042[_0x5ed6('0x26')]=_0x4ae36a;if(_0x4aba5f['query'][_0x5ed6('0x4c')]){_0x2a64a3['include']=[{'all':!![]}];}return db['MailQueue'][_0x5ed6('0x4d')](_0x2a64a3);})[_0x5ed6('0x2d')](function(_0x4a015d){_0x5bc042[_0x5ed6('0x4e')]=_0x4a015d;return _0x5bc042;})['then'](respondWithFilteredResult(_0x259a1e,_0x2a64a3))['catch'](handleError(_0x259a1e,null));};exports[_0x5ed6('0x4f')]=function(_0x39d476,_0x10afba){var _0x5f3460={'raw':!![],'where':{'id':_0x39d476[_0x5ed6('0x50')]['id']}},_0x67dac6={};_0x67dac6[_0x5ed6('0x3c')]=_[_0x5ed6('0x3e')](db[_0x5ed6('0x37')]['rawAttributes']);_0x67dac6[_0x5ed6('0x3d')]=_[_0x5ed6('0x3e')](_0x39d476[_0x5ed6('0x3d')]);_0x67dac6[_0x5ed6('0x3f')]=_['intersection'](_0x67dac6[_0x5ed6('0x3c')],_0x67dac6[_0x5ed6('0x3d')]);_0x5f3460['attributes']=_[_0x5ed6('0x40')](_0x67dac6[_0x5ed6('0x3c')],qs[_0x5ed6('0x51')](_0x39d476['query']['fields']));_0x5f3460[_0x5ed6('0x41')]=_0x5f3460['attributes'][_0x5ed6('0x42')]?_0x5f3460[_0x5ed6('0x41')]:_0x67dac6['model'];if(_0x39d476[_0x5ed6('0x3d')][_0x5ed6('0x4c')]){_0x5f3460['include']=[{'all':!![]}];}_0x5f3460=_[_0x5ed6('0x49')]({},_0x5f3460,_0x39d476[_0x5ed6('0x4b')]);return db[_0x5ed6('0x37')][_0x5ed6('0x52')](_0x5f3460)['then'](handleEntityNotFound(_0x10afba,null))[_0x5ed6('0x2d')](respondWithResult(_0x10afba,null))[_0x5ed6('0x53')](handleError(_0x10afba,null));};exports[_0x5ed6('0x54')]=function(_0x498de9,_0x50f3af){return db[_0x5ed6('0x37')]['create'](_0x498de9[_0x5ed6('0x55')],{})[_0x5ed6('0x2d')](function(_0x10da80){var _0x48813b=_0x498de9['user'][_0x5ed6('0x2f')]({'plain':!![]});if(!_0x48813b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48813b[_0x5ed6('0x56')]===_0x5ed6('0x57')){var _0x208626=_0x10da80[_0x5ed6('0x2f')]({'plain':!![]});var _0x497f4b=_0x5ed6('0x30');return db['UserProfileSection']['find']({'where':{'name':_0x497f4b,'userProfileId':_0x48813b[_0x5ed6('0x58')]},'raw':!![]})['then'](function(_0xf8f45b){if(_0xf8f45b&&_0xf8f45b[_0x5ed6('0x59')]===0x0){return db[_0x5ed6('0x31')][_0x5ed6('0x54')]({'name':_0x208626[_0x5ed6('0x34')],'resourceId':_0x208626['id'],'type':_0xf8f45b[_0x5ed6('0x34')],'sectionId':_0xf8f45b['id']},{})[_0x5ed6('0x2d')](function(){return _0x10da80;});}else{return _0x10da80;}})[_0x5ed6('0x53')](function(_0x2d1fe5){logger[_0x5ed6('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1fe5);throw _0x2d1fe5;});}return _0x10da80;})[_0x5ed6('0x2d')](respondWithResult(_0x50f3af,0xc9))[_0x5ed6('0x53')](handleError(_0x50f3af,null));};exports[_0x5ed6('0x2c')]=function(_0x22fbfa,_0x21c181){if(_0x22fbfa['body']['id']){delete _0x22fbfa[_0x5ed6('0x55')]['id'];}return db[_0x5ed6('0x37')][_0x5ed6('0x52')]({'where':{'id':_0x22fbfa[_0x5ed6('0x50')]['id']}})['then'](handleEntityNotFound(_0x21c181,null))['then'](saveUpdates(_0x22fbfa[_0x5ed6('0x55')],null))[_0x5ed6('0x2d')](respondWithResult(_0x21c181,null))[_0x5ed6('0x53')](handleError(_0x21c181,null));};exports[_0x5ed6('0x2e')]=function(_0x504623,_0x1ecfc0){return db[_0x5ed6('0x37')][_0x5ed6('0x52')]({'where':{'id':_0x504623[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](handleEntityNotFound(_0x1ecfc0,null))['then'](removeEntity(_0x1ecfc0,null))[_0x5ed6('0x53')](handleError(_0x1ecfc0,null));};exports[_0x5ed6('0x5b')]=function(_0x46f62e,_0x2927d9){return db[_0x5ed6('0x37')][_0x5ed6('0x5b')]()[_0x5ed6('0x2d')](respondWithResult(_0x2927d9,null))[_0x5ed6('0x53')](handleError(_0x2927d9,null));};exports['getMembers']=function(_0x5004be,_0x3c54d6,_0x37772d){var _0x3cc3d7={'raw':!![],'where':{}},_0x27f9e5={},_0x176280;return db[_0x5ed6('0x37')][_0x5ed6('0x5c')]({'where':{'id':_0x5004be[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](handleEntityNotFound(_0x3c54d6,null))[_0x5ed6('0x2d')](function(_0x36cc2e){if(_0x36cc2e){_0x176280=_0x36cc2e['get']({'plain':!![]});_0x27f9e5['model']=_[_0x5ed6('0x3e')](db[_0x5ed6('0x5d')][_0x5ed6('0x38')]);_0x27f9e5[_0x5ed6('0x3d')]=_[_0x5ed6('0x3e')](_0x5004be['query']);_0x27f9e5[_0x5ed6('0x3f')]=_['intersection'](_0x27f9e5[_0x5ed6('0x3c')],_0x27f9e5[_0x5ed6('0x3d')]);_0x3cc3d7[_0x5ed6('0x41')]=_[_0x5ed6('0x40')](_0x27f9e5['model'],qs[_0x5ed6('0x51')](_0x5004be['query'][_0x5ed6('0x51')]));_0x3cc3d7[_0x5ed6('0x41')]=_0x3cc3d7['attributes'][_0x5ed6('0x42')]?_0x3cc3d7[_0x5ed6('0x41')]:_0x27f9e5[_0x5ed6('0x3c')];if(!_0x5004be['query'][_0x5ed6('0x43')](_0x5ed6('0x44'))){_0x3cc3d7[_0x5ed6('0x25')]=qs[_0x5ed6('0x25')](_0x5004be['query'][_0x5ed6('0x25')]);_0x3cc3d7[_0x5ed6('0x23')]=qs[_0x5ed6('0x23')](_0x5004be[_0x5ed6('0x3d')][_0x5ed6('0x23')]);}_0x3cc3d7[_0x5ed6('0x45')]=qs[_0x5ed6('0x5e')](_0x5004be[_0x5ed6('0x3d')][_0x5ed6('0x5e')]);_0x3cc3d7[_0x5ed6('0x46')]=qs['filters'](_['pick'](_0x5004be[_0x5ed6('0x3d')],_0x27f9e5[_0x5ed6('0x3f')]));_0x3cc3d7[_0x5ed6('0x46')][_0x5ed6('0x5f')]=_0x36cc2e['id'];if(_0x5004be[_0x5ed6('0x3d')]['filter']){_0x3cc3d7[_0x5ed6('0x46')]=_[_0x5ed6('0x49')](_0x3cc3d7[_0x5ed6('0x46')],{'$or':_['map'](_0x3cc3d7[_0x5ed6('0x41')],function(_0x33ebcf){var _0x51cbc5={};_0x51cbc5[_0x33ebcf]={'$like':'%'+_0x5004be[_0x5ed6('0x3d')][_0x5ed6('0x48')]+'%'};return _0x51cbc5;})});}_0x3cc3d7=_['merge']({},_0x3cc3d7,_0x5004be[_0x5ed6('0x4b')]);return db[_0x5ed6('0x5d')]['findAll'](_0x3cc3d7);}})['then'](function(_0x332371){if(_0x332371){return db[_0x5ed6('0x60')][_0x5ed6('0x61')]({'where':{'id':_[_0x5ed6('0x36')](_0x332371,'UserId'),'role':_0x5ed6('0x62')},'attributes':['id',_0x5ed6('0x34'),_0x5ed6('0x63'),_0x5ed6('0x64'),_0x5ed6('0x65')]});}})[_0x5ed6('0x2d')](function(_0x46e69f){if(_0x46e69f){return{'count':_0x46e69f['count'],'rows':_[_0x5ed6('0x36')](_0x46e69f[_0x5ed6('0x4e')],function(_0x16da29){return{'membername':_0x16da29[_0x5ed6('0x34')],'UserId':_0x16da29['id'],'queue_name':_0x176280['name'],'MailQueueId':_0x176280['id'],'interface':util[_0x5ed6('0x66')]('%s/%s','SIP',_0x16da29[_0x5ed6('0x34')]),'penalty':0x0,'paused':_0x16da29[_0x5ed6('0x63')],'createdAt':_0x16da29['createdAt'],'updatedAt':_0x16da29[_0x5ed6('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5ed6('0x2d')](respondWithFilteredResult(_0x3c54d6,_0x3cc3d7))['catch'](handleError(_0x3c54d6,null));};exports[_0x5ed6('0x67')]=function(_0x22cb22,_0x22c416,_0x3d7411){var _0x21f675={};var _0x178477={};var _0x433d28;var _0x4a16d3;return db[_0x5ed6('0x37')][_0x5ed6('0x5c')]({'where':{'id':_0x22cb22[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](handleEntityNotFound(_0x22c416,null))['then'](function(_0x4fc81e){if(_0x4fc81e){_0x433d28=_0x4fc81e;_0x178477['model']=_[_0x5ed6('0x3e')](db[_0x5ed6('0x68')][_0x5ed6('0x38')]);_0x178477[_0x5ed6('0x3d')]=_[_0x5ed6('0x3e')](_0x22cb22[_0x5ed6('0x3d')]);_0x178477['filters']=_['intersection'](_0x178477['model'],_0x178477['query']);_0x21f675[_0x5ed6('0x41')]=_[_0x5ed6('0x40')](_0x178477['model'],qs[_0x5ed6('0x51')](_0x22cb22['query'][_0x5ed6('0x51')]));_0x21f675[_0x5ed6('0x41')]=_0x21f675[_0x5ed6('0x41')][_0x5ed6('0x42')]?_0x21f675[_0x5ed6('0x41')]:_0x178477[_0x5ed6('0x3c')];_0x21f675[_0x5ed6('0x45')]=qs[_0x5ed6('0x5e')](_0x22cb22[_0x5ed6('0x3d')]['sort']);_0x21f675['where']=qs[_0x5ed6('0x3f')](_[_0x5ed6('0x47')](_0x22cb22[_0x5ed6('0x3d')],_0x178477[_0x5ed6('0x3f')]));if(_0x22cb22[_0x5ed6('0x3d')][_0x5ed6('0x48')]){_0x21f675[_0x5ed6('0x46')]=_['merge'](_0x21f675[_0x5ed6('0x46')],{'$or':_[_0x5ed6('0x36')](_0x21f675['attributes'],function(_0x500e52){var _0x52774c={};_0x52774c[_0x500e52]={'$like':'%'+_0x22cb22[_0x5ed6('0x3d')][_0x5ed6('0x48')]+'%'};return _0x52774c;})});}_0x21f675=_[_0x5ed6('0x49')]({},_0x21f675,_0x22cb22[_0x5ed6('0x4b')]);return _0x433d28[_0x5ed6('0x67')](_0x21f675);}})[_0x5ed6('0x2d')](function(_0xa658ea){if(_0xa658ea){_0x4a16d3=_0xa658ea[_0x5ed6('0x42')];if(!_0x22cb22[_0x5ed6('0x3d')][_0x5ed6('0x43')]('nolimit')){_0x21f675[_0x5ed6('0x25')]=qs[_0x5ed6('0x25')](_0x22cb22[_0x5ed6('0x3d')][_0x5ed6('0x25')]);_0x21f675['offset']=qs[_0x5ed6('0x23')](_0x22cb22[_0x5ed6('0x3d')][_0x5ed6('0x23')]);}return _0x433d28[_0x5ed6('0x67')](_0x21f675);}})[_0x5ed6('0x2d')](function(_0x15a1eb){if(_0x15a1eb){return _0x15a1eb?{'count':_0x4a16d3,'rows':_0x15a1eb}:null;}})[_0x5ed6('0x2d')](respondWithResult(_0x22c416,null))[_0x5ed6('0x53')](handleError(_0x22c416,null));};exports[_0x5ed6('0x69')]=function(_0x1924f6,_0x151cbb,_0x447794){var _0x46e441=_0x1924f6[_0x5ed6('0x55')][_0x5ed6('0x6a')];return db['Team'][_0x5ed6('0x4d')]({'where':{'id':_0x46e441},'attributes':['id'],'include':[{'model':db[_0x5ed6('0x60')],'as':'Agents','attributes':['id',_0x5ed6('0x34'),_0x5ed6('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0x5ed6('0x2d')](function(_0x2a2b64){if(_0x2a2b64){var _0x2eaf76=_[_0x5ed6('0x6c')](_0x2a2b64,function(_0x1e3f5d){var _0x5bf507=_0x1e3f5d[_0x5ed6('0x2f')]({'plain':!![]});return _0x5bf507[_0x5ed6('0x6d')];});return db[_0x5ed6('0x37')][_0x5ed6('0x52')]({'where':{'id':_0x1924f6[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](function(_0x131d86){return db[_0x5ed6('0x6e')][_0x5ed6('0x6f')](function(_0x4e9898){return _0x131d86[_0x5ed6('0x69')](_0x46e441,{'transaction':_0x4e9898})[_0x5ed6('0x2d')](function(){return BPromise['each'](_0x2eaf76,function(_0x21db8b){return db['UserMailQueue'][_0x5ed6('0x70')]({'where':{'UserId':_0x21db8b['id'],'MailQueueId':_0x1924f6[_0x5ed6('0x50')]['id']},'transaction':_0x4e9898});});})['then'](function(){_0x2eaf76[_0x5ed6('0x71')](function(_0x3d2a92){socket[_0x5ed6('0x72')](_0x5ed6('0x73'),{'UserId':_0x3d2a92['id'],'MailQueueId':_0x131d86['id']});});});});});}})[_0x5ed6('0x2d')](respondWithStatusCode(_0x151cbb,null))[_0x5ed6('0x53')](handleError(_0x151cbb,null));};exports[_0x5ed6('0x74')]=function(_0x3d0657,_0x4fbd07,_0x461e12){return db[_0x5ed6('0x68')][_0x5ed6('0x4d')]({'where':{'id':_0x3d0657['query'][_0x5ed6('0x6a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5ed6('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4fbd07,null))[_0x5ed6('0x2d')](function(_0x27273a){var _0x1729a2=_['map'](_0x27273a,'id');var _0x3392ab=[];var _0x22915f=[];var _0x416f6b=squel[_0x5ed6('0x75')]();_0x416f6b[_0x5ed6('0x76')]('tq.TeamId')[_0x5ed6('0x77')](_0x5ed6('0x78'),'tq')[_0x5ed6('0x79')](_0x5ed6('0x7a'),'ut',_0x5ed6('0x7b'))[_0x5ed6('0x46')](_0x5ed6('0x7c'),_0x3d0657['params']['id']);for(var _0x4e2d3a=0x0;_0x4e2d3a<_0x27273a[_0x5ed6('0x42')];_0x4e2d3a+=0x1){let _0x1d9c75=_0x27273a[_0x4e2d3a];for(var _0x5cd969=0x0;_0x5cd969<_0x1d9c75[_0x5ed6('0x6d')]['length'];_0x5cd969+=0x1){let _0x56cdad=_0x1d9c75['Agents'][_0x5cd969];var _0x4c2a68=_0x416f6b[_0x5ed6('0x7d')]();_0x4c2a68[_0x5ed6('0x46')](_0x5ed6('0x7e'),_0x56cdad['id']);_0x22915f[_0x5ed6('0x7f')](db['sequelize'][_0x5ed6('0x3d')](_0x4c2a68[_0x5ed6('0x80')](),{'type':db[_0x5ed6('0x6e')][_0x5ed6('0x81')][_0x5ed6('0x82')]})[_0x5ed6('0x2d')](function(_0x44f3f3){if(_0x44f3f3[_0x5ed6('0x42')]===0x1){return _0x56cdad['id'];}else{var _0x7dde17=_[_0x5ed6('0x83')](_[_0x5ed6('0x36')](_0x44f3f3,_0x5ed6('0x84')),function(_0x3a95cf){return _[_0x5ed6('0x85')](_0x1729a2,_0x3a95cf);});if(_0x7dde17){return _0x56cdad['id'];}}}));}}return BPromise[_0x5ed6('0x86')](_0x22915f)[_0x5ed6('0x2d')](function(_0x2647b5){_0x3392ab=_(_0x3392ab)['union'](_0x2647b5)[_0x5ed6('0x87')]()['value']();return db[_0x5ed6('0x37')][_0x5ed6('0x52')]({'where':{'id':_0x3d0657['params']['id']}})[_0x5ed6('0x2d')](function(_0x34f4ed){return db[_0x5ed6('0x6e')][_0x5ed6('0x6f')](function(_0x524080){return _0x34f4ed[_0x5ed6('0x74')](_0x3d0657[_0x5ed6('0x3d')][_0x5ed6('0x6a')],{'transaction':_0x524080})[_0x5ed6('0x2d')](function(){if(!_[_0x5ed6('0x88')](_0x3392ab)){return _0x34f4ed['removeAgents'](_0x3392ab,{'transaction':_0x524080});}})[_0x5ed6('0x2d')](function(){_0x3392ab['forEach'](function(_0x505084){socket[_0x5ed6('0x72')]('userMailQueue:remove',{'UserId':_0x505084,'MailQueueId':_0x34f4ed['id']});});});});});});})[_0x5ed6('0x2d')](respondWithStatusCode(_0x4fbd07,null))[_0x5ed6('0x53')](handleError(_0x4fbd07,null));};exports[_0x5ed6('0x89')]=function(_0x4d12f6,_0x5f30bc,_0x45f011){return db[_0x5ed6('0x37')][_0x5ed6('0x52')]({'where':{'id':_0x4d12f6[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](handleEntityNotFound(_0x5f30bc,null))['then'](function(_0x9f68e7){if(_0x9f68e7){return _0x9f68e7[_0x5ed6('0x89')](_0x4d12f6[_0x5ed6('0x55')][_0x5ed6('0x6a')],_[_0x5ed6('0x8a')](_0x4d12f6[_0x5ed6('0x55')],['ids','id'])||{})[_0x5ed6('0x8b')](function(_0x38581a){for(var _0x57e2d5=0x0;_0x57e2d5<_0x4d12f6[_0x5ed6('0x55')]['ids'][_0x5ed6('0x42')];_0x57e2d5+=0x1){socket['emit'](_0x5ed6('0x73'),{'UserId':Number(_0x4d12f6[_0x5ed6('0x55')][_0x5ed6('0x6a')][_0x57e2d5]),'MailQueueId':Number(_0x4d12f6[_0x5ed6('0x50')]['id'])});}return _0x38581a;});}})[_0x5ed6('0x2d')](respondWithResult(_0x5f30bc,null))[_0x5ed6('0x53')](handleError(_0x5f30bc,null));};exports[_0x5ed6('0x8c')]=function(_0x3e1835,_0x6dd99e,_0x2f3605){return db['MailQueue']['find']({'where':{'id':_0x3e1835[_0x5ed6('0x50')]['id']}})[_0x5ed6('0x2d')](handleEntityNotFound(_0x6dd99e,null))['then'](function(_0x435599){if(_0x435599){return _0x435599['removeAgents'](_0x3e1835[_0x5ed6('0x3d')][_0x5ed6('0x6a')])[_0x5ed6('0x2d')](function(){if(_[_0x5ed6('0x8d')](_0x3e1835[_0x5ed6('0x3d')]['ids'])){for(var _0x3ea27d=0x0;_0x3ea27d<_0x3e1835['query']['ids'][_0x5ed6('0x42')];_0x3ea27d+=0x1){socket[_0x5ed6('0x72')](_0x5ed6('0x8e'),{'UserId':Number(_0x3e1835['query'][_0x5ed6('0x6a')][_0x3ea27d]),'MailQueueId':Number(_0x3e1835[_0x5ed6('0x50')]['id'])});}}else{socket[_0x5ed6('0x72')]('userMailQueue:remove',{'UserId':Number(_0x3e1835[_0x5ed6('0x3d')]['ids']),'MailQueueId':Number(_0x3e1835['params']['id'])});}});}})['then'](respondWithStatusCode(_0x6dd99e,null))[_0x5ed6('0x53')](handleError(_0x6dd99e,null));};exports[_0x5ed6('0x8f')]=function(_0x19d8c1,_0x197a0e,_0x294161){var _0x4c812d={};var _0x2c30d9={};var _0x51bfe3;var _0x2cf460;return db[_0x5ed6('0x37')][_0x5ed6('0x5c')]({'where':{'id':_0x19d8c1[_0x5ed6('0x50')]['id']}})['then'](handleEntityNotFound(_0x197a0e,null))[_0x5ed6('0x2d')](function(_0x2ccebf){if(_0x2ccebf){_0x51bfe3=_0x2ccebf;_0x2c30d9[_0x5ed6('0x3c')]=_['keys'](db[_0x5ed6('0x60')][_0x5ed6('0x38')]);_0x2c30d9['query']=_['keys'](_0x19d8c1[_0x5ed6('0x3d')]);_0x2c30d9[_0x5ed6('0x3f')]=_[_0x5ed6('0x40')](_0x2c30d9['model'],_0x2c30d9[_0x5ed6('0x3d')]);_0x4c812d['attributes']=_['intersection'](_0x2c30d9[_0x5ed6('0x3c')],qs[_0x5ed6('0x51')](_0x19d8c1[_0x5ed6('0x3d')][_0x5ed6('0x51')]));_0x4c812d[_0x5ed6('0x41')]=_0x4c812d[_0x5ed6('0x41')][_0x5ed6('0x42')]?_0x4c812d[_0x5ed6('0x41')]:_0x2c30d9[_0x5ed6('0x3c')];_0x4c812d[_0x5ed6('0x45')]=qs[_0x5ed6('0x5e')](_0x19d8c1['query'][_0x5ed6('0x5e')]);_0x4c812d['where']=qs[_0x5ed6('0x3f')](_[_0x5ed6('0x47')](_0x19d8c1[_0x5ed6('0x3d')],_0x2c30d9[_0x5ed6('0x3f')]));if(_0x19d8c1['query'][_0x5ed6('0x48')]){_0x4c812d['where']=_[_0x5ed6('0x49')](_0x4c812d[_0x5ed6('0x46')],{'$or':_[_0x5ed6('0x36')](_0x4c812d['attributes'],function(_0x490e7e){var _0x19f98a={};_0x19f98a[_0x490e7e]={'$like':'%'+_0x19d8c1['query'][_0x5ed6('0x48')]+'%'};return _0x19f98a;})});}_0x4c812d=_[_0x5ed6('0x49')]({},_0x4c812d,_0x19d8c1[_0x5ed6('0x4b')]);return _0x51bfe3[_0x5ed6('0x8f')](_0x4c812d);}})[_0x5ed6('0x2d')](function(_0x4c85c0){if(_0x4c85c0){_0x2cf460=_0x4c85c0[_0x5ed6('0x42')];if(!_0x19d8c1['query'][_0x5ed6('0x43')](_0x5ed6('0x44'))){_0x4c812d[_0x5ed6('0x25')]=qs[_0x5ed6('0x25')](_0x19d8c1[_0x5ed6('0x3d')][_0x5ed6('0x25')]);_0x4c812d['offset']=qs[_0x5ed6('0x23')](_0x19d8c1['query']['offset']);}return _0x51bfe3[_0x5ed6('0x8f')](_0x4c812d);}})['then'](function(_0x138779){if(_0x138779){return _0x138779?{'count':_0x2cf460,'rows':_0x138779}:null;}})[_0x5ed6('0x2d')](respondWithResult(_0x197a0e,null))[_0x5ed6('0x53')](handleError(_0x197a0e,null));}; \ No newline at end of file +var _0xdb46=['create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','nolimit','MailQueueId','findAndCountAll','agent','mailPause','%s/%s','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','MailQueue','findAll','rows','catch','show','params','attributes','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','MailQueues','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3ebfae,_0x40b4c0){var _0x234222=function(_0x36a9a1){while(--_0x36a9a1){_0x3ebfae['push'](_0x3ebfae['shift']());}};_0x234222(++_0x40b4c0);}(_0xdb46,0x158));var _0x6db4=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xdb46[_0x23b655];return _0x364b32;};'use strict';var emlformat=require(_0x6db4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6db4('0x1'));var rp=require(_0x6db4('0x2'));var moment=require(_0x6db4('0x3'));var BPromise=require(_0x6db4('0x4'));var Mustache=require('mustache');var util=require(_0x6db4('0x5'));var path=require(_0x6db4('0x6'));var sox=require('sox');var csv=require(_0x6db4('0x7'));var ejs=require(_0x6db4('0x8'));var fs=require('fs');var fs_extra=require(_0x6db4('0x9'));var _=require(_0x6db4('0xa'));var squel=require('squel');var crypto=require(_0x6db4('0xb'));var jsforce=require(_0x6db4('0xc'));var deskjs=require(_0x6db4('0xd'));var toCsv=require(_0x6db4('0x7'));var querystring=require(_0x6db4('0xe'));var Papa=require(_0x6db4('0xf'));var Redis=require(_0x6db4('0x10'));var authService=require(_0x6db4('0x11'));var qs=require(_0x6db4('0x12'));var as=require(_0x6db4('0x13'));var hardwareService=require(_0x6db4('0x14'));var logger=require('../../config/logger')(_0x6db4('0x15'));var utils=require('../../config/utils');var config=require(_0x6db4('0x16'));var licenseUtil=require(_0x6db4('0x17'));var db=require(_0x6db4('0x18'))['db'];config['redis']=_[_0x6db4('0x19')](config[_0x6db4('0x1a')],{'host':_0x6db4('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x913dde,_0x26d148){_0x26d148=_0x26d148||0xcc;return function(_0x3f261d){if(_0x3f261d){return _0x913dde[_0x6db4('0x1c')](_0x26d148);}return _0x913dde['status'](_0x26d148)[_0x6db4('0x1d')]();};}function respondWithResult(_0x1f6981,_0x21fe35){_0x21fe35=_0x21fe35||0xc8;return function(_0x4a675e){if(_0x4a675e){return _0x1f6981[_0x6db4('0x1e')](_0x21fe35)[_0x6db4('0x1f')](_0x4a675e);}};}function respondWithFilteredResult(_0x27fc2e,_0xa889ac){return function(_0x4c8602){if(_0x4c8602){var _0xf9906b=typeof _0xa889ac[_0x6db4('0x20')]===_0x6db4('0x21')&&typeof _0xa889ac[_0x6db4('0x22')]===_0x6db4('0x21');var _0xb1d812=_0x4c8602[_0x6db4('0x23')];var _0x1367e3=_0xf9906b?0x0:_0xa889ac['offset'];var _0x27cfc8=_0xf9906b?_0x4c8602[_0x6db4('0x23')]:_0xa889ac[_0x6db4('0x20')]+_0xa889ac[_0x6db4('0x22')];var _0x25d039;if(_0x27cfc8>=_0xb1d812){_0x27cfc8=_0xb1d812;_0x25d039=0xc8;}else{_0x25d039=0xce;}_0x27fc2e[_0x6db4('0x1e')](_0x25d039);return _0x27fc2e[_0x6db4('0x24')](_0x6db4('0x25'),_0x1367e3+'-'+_0x27cfc8+'/'+_0xb1d812)[_0x6db4('0x1f')](_0x4c8602);}return null;};}function patchUpdates(_0x7a1d68){return function(_0x2cdee8){try{jsonpatch[_0x6db4('0x26')](_0x2cdee8,_0x7a1d68,!![]);}catch(_0x54f802){return BPromise[_0x6db4('0x27')](_0x54f802);}return _0x2cdee8['save']();};}function saveUpdates(_0x28cec0,_0x4da8ad){return function(_0xc33556){if(_0xc33556){return _0xc33556[_0x6db4('0x28')](_0x28cec0)[_0x6db4('0x29')](function(_0x296c15){return _0x296c15;});}return null;};}function removeEntity(_0x5d7b45,_0x5552e2){return function(_0x15d96b){if(_0x15d96b){return _0x15d96b[_0x6db4('0x2a')]()[_0x6db4('0x29')](function(){var _0x277e46=_0x15d96b[_0x6db4('0x2b')]({'plain':!![]});var _0x11d1b9='MailQueues';return db[_0x6db4('0x2c')][_0x6db4('0x2a')]({'where':{'type':_0x11d1b9,'resourceId':_0x277e46['id']}})[_0x6db4('0x29')](function(){return _0x15d96b;});})[_0x6db4('0x29')](function(){_0x5d7b45[_0x6db4('0x1e')](0xcc)[_0x6db4('0x1d')]();});}};}function handleEntityNotFound(_0x5f3995,_0x5057){return function(_0x327be0){if(!_0x327be0){_0x5f3995[_0x6db4('0x1c')](0x194);}return _0x327be0;};}function handleError(_0x369bf7,_0x4896f3){_0x4896f3=_0x4896f3||0x1f4;return function(_0x59be79){logger[_0x6db4('0x2d')](_0x59be79['stack']);if(_0x59be79[_0x6db4('0x2e')]){delete _0x59be79[_0x6db4('0x2e')];}_0x369bf7['status'](_0x4896f3)[_0x6db4('0x2f')](_0x59be79);};}exports[_0x6db4('0x30')]=function(_0x43f512,_0x2e5167){var _0x1830ab={},_0x1eba23={},_0x5259cc={'count':0x0,'rows':[]};var _0x4954fd=_['map'](db['MailQueue'][_0x6db4('0x31')],function(_0x161801){return{'name':_0x161801[_0x6db4('0x32')],'type':_0x161801['type'][_0x6db4('0x33')]};});_0x1eba23[_0x6db4('0x34')]=_[_0x6db4('0x35')](_0x4954fd,_0x6db4('0x2e'));_0x1eba23[_0x6db4('0x36')]=_[_0x6db4('0x37')](_0x43f512[_0x6db4('0x36')]);_0x1eba23[_0x6db4('0x38')]=_['intersection'](_0x1eba23[_0x6db4('0x34')],_0x1eba23[_0x6db4('0x36')]);_0x1830ab['attributes']=_[_0x6db4('0x39')](_0x1eba23[_0x6db4('0x34')],qs[_0x6db4('0x3a')](_0x43f512[_0x6db4('0x36')][_0x6db4('0x3a')]));_0x1830ab['attributes']=_0x1830ab['attributes'][_0x6db4('0x3b')]?_0x1830ab['attributes']:_0x1eba23[_0x6db4('0x34')];if(!_0x43f512[_0x6db4('0x36')][_0x6db4('0x3c')]('nolimit')){_0x1830ab[_0x6db4('0x22')]=qs[_0x6db4('0x22')](_0x43f512[_0x6db4('0x36')]['limit']);_0x1830ab[_0x6db4('0x20')]=qs[_0x6db4('0x20')](_0x43f512[_0x6db4('0x36')][_0x6db4('0x20')]);}_0x1830ab[_0x6db4('0x3d')]=qs[_0x6db4('0x3e')](_0x43f512[_0x6db4('0x36')][_0x6db4('0x3e')]);_0x1830ab['where']=qs[_0x6db4('0x38')](_[_0x6db4('0x3f')](_0x43f512[_0x6db4('0x36')],_0x1eba23[_0x6db4('0x38')]),_0x4954fd);if(_0x43f512['query'][_0x6db4('0x40')]){_0x1830ab[_0x6db4('0x41')]=_[_0x6db4('0x42')](_0x1830ab[_0x6db4('0x41')],{'$or':_[_0x6db4('0x35')](_0x4954fd,function(_0x277ebc){if(_0x277ebc[_0x6db4('0x43')]!==_0x6db4('0x44')){var _0x1c0932={};_0x1c0932[_0x277ebc[_0x6db4('0x2e')]]={'$like':'%'+_0x43f512[_0x6db4('0x36')][_0x6db4('0x40')]+'%'};return _0x1c0932;}})});}_0x1830ab=_[_0x6db4('0x42')]({},_0x1830ab,_0x43f512[_0x6db4('0x45')]);var _0x1b54a8={'where':_0x1830ab['where']};return db['MailQueue'][_0x6db4('0x23')](_0x1b54a8)[_0x6db4('0x29')](function(_0x2c6193){_0x5259cc['count']=_0x2c6193;if(_0x43f512[_0x6db4('0x36')][_0x6db4('0x46')]){_0x1830ab[_0x6db4('0x47')]=[{'all':!![]}];}return db[_0x6db4('0x48')][_0x6db4('0x49')](_0x1830ab);})[_0x6db4('0x29')](function(_0x36ee08){_0x5259cc[_0x6db4('0x4a')]=_0x36ee08;return _0x5259cc;})[_0x6db4('0x29')](respondWithFilteredResult(_0x2e5167,_0x1830ab))[_0x6db4('0x4b')](handleError(_0x2e5167,null));};exports[_0x6db4('0x4c')]=function(_0x3cc899,_0x5b1e01){var _0x16c3ee={'raw':!![],'where':{'id':_0x3cc899[_0x6db4('0x4d')]['id']}},_0x3547b0={};_0x3547b0[_0x6db4('0x34')]=_[_0x6db4('0x37')](db[_0x6db4('0x48')][_0x6db4('0x31')]);_0x3547b0[_0x6db4('0x36')]=_[_0x6db4('0x37')](_0x3cc899[_0x6db4('0x36')]);_0x3547b0[_0x6db4('0x38')]=_[_0x6db4('0x39')](_0x3547b0[_0x6db4('0x34')],_0x3547b0[_0x6db4('0x36')]);_0x16c3ee[_0x6db4('0x4e')]=_['intersection'](_0x3547b0[_0x6db4('0x34')],qs[_0x6db4('0x3a')](_0x3cc899['query']['fields']));_0x16c3ee['attributes']=_0x16c3ee[_0x6db4('0x4e')][_0x6db4('0x3b')]?_0x16c3ee['attributes']:_0x3547b0['model'];if(_0x3cc899[_0x6db4('0x36')][_0x6db4('0x46')]){_0x16c3ee[_0x6db4('0x47')]=[{'all':!![]}];}_0x16c3ee=_['merge']({},_0x16c3ee,_0x3cc899[_0x6db4('0x45')]);return db['MailQueue'][_0x6db4('0x4f')](_0x16c3ee)['then'](handleEntityNotFound(_0x5b1e01,null))[_0x6db4('0x29')](respondWithResult(_0x5b1e01,null))[_0x6db4('0x4b')](handleError(_0x5b1e01,null));};exports['create']=function(_0x55f07d,_0x3f64eb){return db['MailQueue']['create'](_0x55f07d[_0x6db4('0x50')],{})[_0x6db4('0x29')](function(_0x518b11){var _0x56eb18=_0x55f07d['user'][_0x6db4('0x2b')]({'plain':!![]});if(!_0x56eb18)throw new Error(_0x6db4('0x51'));if(_0x56eb18[_0x6db4('0x52')]===_0x6db4('0x53')){var _0x2418c3=_0x518b11[_0x6db4('0x2b')]({'plain':!![]});var _0x5ed332=_0x6db4('0x54');return db[_0x6db4('0x55')]['find']({'where':{'name':_0x5ed332,'userProfileId':_0x56eb18[_0x6db4('0x56')]},'raw':!![]})[_0x6db4('0x29')](function(_0x3933b1){if(_0x3933b1&&_0x3933b1[_0x6db4('0x57')]===0x0){return db[_0x6db4('0x2c')][_0x6db4('0x58')]({'name':_0x2418c3[_0x6db4('0x2e')],'resourceId':_0x2418c3['id'],'type':_0x3933b1[_0x6db4('0x2e')],'sectionId':_0x3933b1['id']},{})[_0x6db4('0x29')](function(){return _0x518b11;});}else{return _0x518b11;}})[_0x6db4('0x4b')](function(_0x481428){logger[_0x6db4('0x2d')](_0x6db4('0x59'),_0x481428);throw _0x481428;});}return _0x518b11;})['then'](respondWithResult(_0x3f64eb,0xc9))[_0x6db4('0x4b')](handleError(_0x3f64eb,null));};exports[_0x6db4('0x28')]=function(_0x416528,_0x32b630){if(_0x416528[_0x6db4('0x50')]['id']){delete _0x416528[_0x6db4('0x50')]['id'];}return db[_0x6db4('0x48')]['find']({'where':{'id':_0x416528['params']['id']}})['then'](handleEntityNotFound(_0x32b630,null))[_0x6db4('0x29')](saveUpdates(_0x416528['body'],null))[_0x6db4('0x29')](respondWithResult(_0x32b630,null))['catch'](handleError(_0x32b630,null));};exports['destroy']=function(_0x4daf5a,_0x176b95){return db[_0x6db4('0x48')][_0x6db4('0x4f')]({'where':{'id':_0x4daf5a[_0x6db4('0x4d')]['id']}})[_0x6db4('0x29')](handleEntityNotFound(_0x176b95,null))[_0x6db4('0x29')](removeEntity(_0x176b95,null))['catch'](handleError(_0x176b95,null));};exports[_0x6db4('0x5a')]=function(_0x4e8a4e,_0x506c8b){return db['MailQueue'][_0x6db4('0x5a')]()['then'](respondWithResult(_0x506c8b,null))[_0x6db4('0x4b')](handleError(_0x506c8b,null));};exports['getMembers']=function(_0x110ae1,_0x34bf6f,_0x28ab6b){var _0x4c82e7={'raw':!![],'where':{}},_0x36586c={},_0x6e26ed;return db[_0x6db4('0x48')][_0x6db4('0x5b')]({'where':{'id':_0x110ae1['params']['id']}})['then'](handleEntityNotFound(_0x34bf6f,null))[_0x6db4('0x29')](function(_0x4c31f7){if(_0x4c31f7){_0x6e26ed=_0x4c31f7[_0x6db4('0x2b')]({'plain':!![]});_0x36586c['model']=_['keys'](db[_0x6db4('0x5c')][_0x6db4('0x31')]);_0x36586c[_0x6db4('0x36')]=_[_0x6db4('0x37')](_0x110ae1['query']);_0x36586c[_0x6db4('0x38')]=_[_0x6db4('0x39')](_0x36586c[_0x6db4('0x34')],_0x36586c['query']);_0x4c82e7[_0x6db4('0x4e')]=_[_0x6db4('0x39')](_0x36586c[_0x6db4('0x34')],qs['fields'](_0x110ae1[_0x6db4('0x36')][_0x6db4('0x3a')]));_0x4c82e7[_0x6db4('0x4e')]=_0x4c82e7['attributes']['length']?_0x4c82e7[_0x6db4('0x4e')]:_0x36586c[_0x6db4('0x34')];if(!_0x110ae1[_0x6db4('0x36')][_0x6db4('0x3c')](_0x6db4('0x5d'))){_0x4c82e7[_0x6db4('0x22')]=qs[_0x6db4('0x22')](_0x110ae1[_0x6db4('0x36')][_0x6db4('0x22')]);_0x4c82e7[_0x6db4('0x20')]=qs['offset'](_0x110ae1['query']['offset']);}_0x4c82e7[_0x6db4('0x3d')]=qs[_0x6db4('0x3e')](_0x110ae1[_0x6db4('0x36')][_0x6db4('0x3e')]);_0x4c82e7[_0x6db4('0x41')]=qs[_0x6db4('0x38')](_[_0x6db4('0x3f')](_0x110ae1[_0x6db4('0x36')],_0x36586c[_0x6db4('0x38')]));_0x4c82e7[_0x6db4('0x41')][_0x6db4('0x5e')]=_0x4c31f7['id'];if(_0x110ae1[_0x6db4('0x36')][_0x6db4('0x40')]){_0x4c82e7[_0x6db4('0x41')]=_[_0x6db4('0x42')](_0x4c82e7[_0x6db4('0x41')],{'$or':_[_0x6db4('0x35')](_0x4c82e7[_0x6db4('0x4e')],function(_0x34f7dc){var _0x179e3a={};_0x179e3a[_0x34f7dc]={'$like':'%'+_0x110ae1[_0x6db4('0x36')][_0x6db4('0x40')]+'%'};return _0x179e3a;})});}_0x4c82e7=_['merge']({},_0x4c82e7,_0x110ae1['options']);return db[_0x6db4('0x5c')][_0x6db4('0x49')](_0x4c82e7);}})[_0x6db4('0x29')](function(_0x4d5d6e){if(_0x4d5d6e){return db['User'][_0x6db4('0x5f')]({'where':{'id':_[_0x6db4('0x35')](_0x4d5d6e,'UserId'),'role':_0x6db4('0x60')},'attributes':['id',_0x6db4('0x2e'),_0x6db4('0x61'),'updatedAt','createdAt']});}})[_0x6db4('0x29')](function(_0x2687cd){if(_0x2687cd){return{'count':_0x2687cd[_0x6db4('0x23')],'rows':_[_0x6db4('0x35')](_0x2687cd['rows'],function(_0x566ef1){return{'membername':_0x566ef1[_0x6db4('0x2e')],'UserId':_0x566ef1['id'],'queue_name':_0x6e26ed[_0x6db4('0x2e')],'MailQueueId':_0x6e26ed['id'],'interface':util['format'](_0x6db4('0x62'),'SIP',_0x566ef1['name']),'penalty':0x0,'paused':_0x566ef1[_0x6db4('0x61')],'createdAt':_0x566ef1[_0x6db4('0x63')],'updatedAt':_0x566ef1['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6db4('0x29')](respondWithFilteredResult(_0x34bf6f,_0x4c82e7))[_0x6db4('0x4b')](handleError(_0x34bf6f,null));};exports[_0x6db4('0x64')]=function(_0x5d3367,_0x22047a,_0x1f6c86){var _0x5465f9={};var _0x47e66e={};var _0x29c17f;var _0x49368d;return db[_0x6db4('0x48')]['findOne']({'where':{'id':_0x5d3367[_0x6db4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22047a,null))[_0x6db4('0x29')](function(_0x192b59){if(_0x192b59){_0x29c17f=_0x192b59;_0x47e66e[_0x6db4('0x34')]=_['keys'](db[_0x6db4('0x65')][_0x6db4('0x31')]);_0x47e66e[_0x6db4('0x36')]=_['keys'](_0x5d3367[_0x6db4('0x36')]);_0x47e66e[_0x6db4('0x38')]=_['intersection'](_0x47e66e[_0x6db4('0x34')],_0x47e66e[_0x6db4('0x36')]);_0x5465f9[_0x6db4('0x4e')]=_[_0x6db4('0x39')](_0x47e66e[_0x6db4('0x34')],qs[_0x6db4('0x3a')](_0x5d3367[_0x6db4('0x36')][_0x6db4('0x3a')]));_0x5465f9[_0x6db4('0x4e')]=_0x5465f9[_0x6db4('0x4e')][_0x6db4('0x3b')]?_0x5465f9[_0x6db4('0x4e')]:_0x47e66e[_0x6db4('0x34')];_0x5465f9[_0x6db4('0x3d')]=qs['sort'](_0x5d3367[_0x6db4('0x36')][_0x6db4('0x3e')]);_0x5465f9[_0x6db4('0x41')]=qs[_0x6db4('0x38')](_[_0x6db4('0x3f')](_0x5d3367[_0x6db4('0x36')],_0x47e66e[_0x6db4('0x38')]));if(_0x5d3367[_0x6db4('0x36')][_0x6db4('0x40')]){_0x5465f9[_0x6db4('0x41')]=_['merge'](_0x5465f9[_0x6db4('0x41')],{'$or':_[_0x6db4('0x35')](_0x5465f9[_0x6db4('0x4e')],function(_0x2787c6){var _0x28f78c={};_0x28f78c[_0x2787c6]={'$like':'%'+_0x5d3367[_0x6db4('0x36')][_0x6db4('0x40')]+'%'};return _0x28f78c;})});}_0x5465f9=_[_0x6db4('0x42')]({},_0x5465f9,_0x5d3367['options']);return _0x29c17f['getTeams'](_0x5465f9);}})[_0x6db4('0x29')](function(_0x16fcba){if(_0x16fcba){_0x49368d=_0x16fcba[_0x6db4('0x3b')];if(!_0x5d3367[_0x6db4('0x36')][_0x6db4('0x3c')]('nolimit')){_0x5465f9['limit']=qs[_0x6db4('0x22')](_0x5d3367[_0x6db4('0x36')][_0x6db4('0x22')]);_0x5465f9[_0x6db4('0x20')]=qs[_0x6db4('0x20')](_0x5d3367[_0x6db4('0x36')][_0x6db4('0x20')]);}return _0x29c17f['getTeams'](_0x5465f9);}})[_0x6db4('0x29')](function(_0x2a73f3){if(_0x2a73f3){return _0x2a73f3?{'count':_0x49368d,'rows':_0x2a73f3}:null;}})[_0x6db4('0x29')](respondWithResult(_0x22047a,null))[_0x6db4('0x4b')](handleError(_0x22047a,null));};exports[_0x6db4('0x66')]=function(_0x55434e,_0x2c3d24,_0x3243e2){var _0x38a44b=_0x55434e[_0x6db4('0x50')][_0x6db4('0x67')];return db[_0x6db4('0x65')][_0x6db4('0x49')]({'where':{'id':_0x38a44b},'attributes':['id'],'include':[{'model':db[_0x6db4('0x68')],'as':_0x6db4('0x69'),'attributes':['id',_0x6db4('0x2e'),_0x6db4('0x6a'),_0x6db4('0x6b'),_0x6db4('0x6c')],'raw':!![]}]})[_0x6db4('0x29')](function(_0x28eda6){if(_0x28eda6){var _0x534716=_[_0x6db4('0x6d')](_0x28eda6,function(_0x1500bb){var _0x35a858=_0x1500bb[_0x6db4('0x2b')]({'plain':!![]});return _0x35a858[_0x6db4('0x69')];});return db[_0x6db4('0x48')][_0x6db4('0x4f')]({'where':{'id':_0x55434e[_0x6db4('0x4d')]['id']}})[_0x6db4('0x29')](function(_0x8ca110){return db['sequelize'][_0x6db4('0x6e')](function(_0x31576e){return _0x8ca110['addTeams'](_0x38a44b,{'transaction':_0x31576e})[_0x6db4('0x29')](function(){return BPromise[_0x6db4('0x6f')](_0x534716,function(_0x51bc4e){return db[_0x6db4('0x5c')][_0x6db4('0x70')]({'where':{'UserId':_0x51bc4e['id'],'MailQueueId':_0x55434e[_0x6db4('0x4d')]['id']},'transaction':_0x31576e});});})[_0x6db4('0x29')](function(){_0x534716[_0x6db4('0x71')](function(_0x30641e){socket['emit']('userMailQueue:save',{'UserId':_0x30641e['id'],'MailQueueId':_0x8ca110['id']});});});});});}})[_0x6db4('0x29')](respondWithStatusCode(_0x2c3d24,null))['catch'](handleError(_0x2c3d24,null));};exports[_0x6db4('0x72')]=function(_0x583a29,_0x4b0386,_0x48119c){return db[_0x6db4('0x65')]['findAll']({'where':{'id':_0x583a29[_0x6db4('0x36')][_0x6db4('0x67')]},'attributes':['id'],'include':[{'model':db[_0x6db4('0x68')],'as':_0x6db4('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4b0386,null))[_0x6db4('0x29')](function(_0x44c0ed){var _0x5000f9=_[_0x6db4('0x35')](_0x44c0ed,'id');var _0x643233=[];var _0x1aa5c3=[];var _0x43c3db=squel[_0x6db4('0x73')]();_0x43c3db[_0x6db4('0x74')]('tq.TeamId')['from'](_0x6db4('0x75'),'tq')[_0x6db4('0x76')](_0x6db4('0x77'),'ut',_0x6db4('0x78'))[_0x6db4('0x41')](_0x6db4('0x79'),_0x583a29['params']['id']);for(var _0x2a0d33=0x0;_0x2a0d33<_0x44c0ed[_0x6db4('0x3b')];_0x2a0d33+=0x1){let _0x1b6b6d=_0x44c0ed[_0x2a0d33];for(var _0xb34da3=0x0;_0xb34da3<_0x1b6b6d['Agents'][_0x6db4('0x3b')];_0xb34da3+=0x1){let _0x5ebd51=_0x1b6b6d[_0x6db4('0x69')][_0xb34da3];var _0x4f8eaf=_0x43c3db[_0x6db4('0x7a')]();_0x4f8eaf[_0x6db4('0x41')]('ut.UserId\x20=\x20?',_0x5ebd51['id']);_0x1aa5c3[_0x6db4('0x7b')](db[_0x6db4('0x7c')]['query'](_0x4f8eaf[_0x6db4('0x7d')](),{'type':db[_0x6db4('0x7c')][_0x6db4('0x7e')][_0x6db4('0x7f')]})[_0x6db4('0x29')](function(_0x4ff034){if(_0x4ff034[_0x6db4('0x3b')]===0x1){return _0x5ebd51['id'];}else{var _0x3230e2=_[_0x6db4('0x80')](_['map'](_0x4ff034,_0x6db4('0x81')),function(_0xdd076){return _[_0x6db4('0x82')](_0x5000f9,_0xdd076);});if(_0x3230e2){return _0x5ebd51['id'];}}}));}}return BPromise[_0x6db4('0x83')](_0x1aa5c3)[_0x6db4('0x29')](function(_0x47ecbf){_0x643233=_(_0x643233)['union'](_0x47ecbf)[_0x6db4('0x84')]()[_0x6db4('0x85')]();return db[_0x6db4('0x48')]['find']({'where':{'id':_0x583a29[_0x6db4('0x4d')]['id']}})[_0x6db4('0x29')](function(_0x1bfdda){return db['sequelize'][_0x6db4('0x6e')](function(_0x5ccb68){return _0x1bfdda[_0x6db4('0x72')](_0x583a29[_0x6db4('0x36')]['ids'],{'transaction':_0x5ccb68})[_0x6db4('0x29')](function(){if(!_[_0x6db4('0x86')](_0x643233)){return _0x1bfdda[_0x6db4('0x87')](_0x643233,{'transaction':_0x5ccb68});}})[_0x6db4('0x29')](function(){_0x643233['forEach'](function(_0x116b6f){socket[_0x6db4('0x88')](_0x6db4('0x89'),{'UserId':_0x116b6f,'MailQueueId':_0x1bfdda['id']});});});});});});})[_0x6db4('0x29')](respondWithStatusCode(_0x4b0386,null))[_0x6db4('0x4b')](handleError(_0x4b0386,null));};exports[_0x6db4('0x8a')]=function(_0x585ab9,_0x3f8d62,_0x3502b3){return db['MailQueue'][_0x6db4('0x4f')]({'where':{'id':_0x585ab9[_0x6db4('0x4d')]['id']}})[_0x6db4('0x29')](handleEntityNotFound(_0x3f8d62,null))[_0x6db4('0x29')](function(_0x26179c){if(_0x26179c){return _0x26179c[_0x6db4('0x8a')](_0x585ab9[_0x6db4('0x50')]['ids'],_[_0x6db4('0x8b')](_0x585ab9[_0x6db4('0x50')],[_0x6db4('0x67'),'id'])||{})[_0x6db4('0x8c')](function(_0x93f64a){for(var _0xa10c83=0x0;_0xa10c83<_0x585ab9[_0x6db4('0x50')][_0x6db4('0x67')][_0x6db4('0x3b')];_0xa10c83+=0x1){socket[_0x6db4('0x88')](_0x6db4('0x8d'),{'UserId':Number(_0x585ab9['body'][_0x6db4('0x67')][_0xa10c83]),'MailQueueId':Number(_0x585ab9[_0x6db4('0x4d')]['id'])});}return _0x93f64a;});}})['then'](respondWithResult(_0x3f8d62,null))['catch'](handleError(_0x3f8d62,null));};exports[_0x6db4('0x87')]=function(_0x57c9c7,_0x2e91d4,_0x5f157f){return db[_0x6db4('0x48')][_0x6db4('0x4f')]({'where':{'id':_0x57c9c7[_0x6db4('0x4d')]['id']}})[_0x6db4('0x29')](handleEntityNotFound(_0x2e91d4,null))[_0x6db4('0x29')](function(_0x1ca508){if(_0x1ca508){return _0x1ca508[_0x6db4('0x87')](_0x57c9c7['query']['ids'])[_0x6db4('0x29')](function(){if(_[_0x6db4('0x8e')](_0x57c9c7[_0x6db4('0x36')][_0x6db4('0x67')])){for(var _0x2401d3=0x0;_0x2401d3<_0x57c9c7[_0x6db4('0x36')]['ids'][_0x6db4('0x3b')];_0x2401d3+=0x1){socket[_0x6db4('0x88')](_0x6db4('0x89'),{'UserId':Number(_0x57c9c7[_0x6db4('0x36')][_0x6db4('0x67')][_0x2401d3]),'MailQueueId':Number(_0x57c9c7['params']['id'])});}}else{socket[_0x6db4('0x88')]('userMailQueue:remove',{'UserId':Number(_0x57c9c7['query'][_0x6db4('0x67')]),'MailQueueId':Number(_0x57c9c7[_0x6db4('0x4d')]['id'])});}});}})[_0x6db4('0x29')](respondWithStatusCode(_0x2e91d4,null))[_0x6db4('0x4b')](handleError(_0x2e91d4,null));};exports[_0x6db4('0x8f')]=function(_0x2c1e1c,_0x236e8f,_0x4b4767){var _0x4bf049={};var _0x5acc1d={};var _0x3ffc1e;var _0x4d170f;return db['MailQueue']['findOne']({'where':{'id':_0x2c1e1c[_0x6db4('0x4d')]['id']}})['then'](handleEntityNotFound(_0x236e8f,null))['then'](function(_0x232eb1){if(_0x232eb1){_0x3ffc1e=_0x232eb1;_0x5acc1d[_0x6db4('0x34')]=_[_0x6db4('0x37')](db[_0x6db4('0x68')][_0x6db4('0x31')]);_0x5acc1d[_0x6db4('0x36')]=_['keys'](_0x2c1e1c['query']);_0x5acc1d[_0x6db4('0x38')]=_[_0x6db4('0x39')](_0x5acc1d['model'],_0x5acc1d[_0x6db4('0x36')]);_0x4bf049[_0x6db4('0x4e')]=_['intersection'](_0x5acc1d['model'],qs[_0x6db4('0x3a')](_0x2c1e1c[_0x6db4('0x36')][_0x6db4('0x3a')]));_0x4bf049[_0x6db4('0x4e')]=_0x4bf049[_0x6db4('0x4e')][_0x6db4('0x3b')]?_0x4bf049[_0x6db4('0x4e')]:_0x5acc1d[_0x6db4('0x34')];_0x4bf049[_0x6db4('0x3d')]=qs[_0x6db4('0x3e')](_0x2c1e1c[_0x6db4('0x36')][_0x6db4('0x3e')]);_0x4bf049[_0x6db4('0x41')]=qs[_0x6db4('0x38')](_[_0x6db4('0x3f')](_0x2c1e1c[_0x6db4('0x36')],_0x5acc1d[_0x6db4('0x38')]));if(_0x2c1e1c[_0x6db4('0x36')]['filter']){_0x4bf049[_0x6db4('0x41')]=_[_0x6db4('0x42')](_0x4bf049[_0x6db4('0x41')],{'$or':_[_0x6db4('0x35')](_0x4bf049[_0x6db4('0x4e')],function(_0x787d59){var _0x4668e3={};_0x4668e3[_0x787d59]={'$like':'%'+_0x2c1e1c[_0x6db4('0x36')][_0x6db4('0x40')]+'%'};return _0x4668e3;})});}_0x4bf049=_[_0x6db4('0x42')]({},_0x4bf049,_0x2c1e1c[_0x6db4('0x45')]);return _0x3ffc1e['getAgents'](_0x4bf049);}})[_0x6db4('0x29')](function(_0x2b8134){if(_0x2b8134){_0x4d170f=_0x2b8134['length'];if(!_0x2c1e1c['query'][_0x6db4('0x3c')](_0x6db4('0x5d'))){_0x4bf049['limit']=qs[_0x6db4('0x22')](_0x2c1e1c['query']['limit']);_0x4bf049[_0x6db4('0x20')]=qs[_0x6db4('0x20')](_0x2c1e1c[_0x6db4('0x36')][_0x6db4('0x20')]);}return _0x3ffc1e[_0x6db4('0x8f')](_0x4bf049);}})['then'](function(_0x465eca){if(_0x465eca){return _0x465eca?{'count':_0x4d170f,'rows':_0x465eca}:null;}})[_0x6db4('0x29')](respondWithResult(_0x236e8f,null))[_0x6db4('0x4b')](handleError(_0x236e8f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ec4923f..2591f19 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 _0xbc9a=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x27335d,_0x4369b9){var _0x4c8db6=function(_0x2c0dd2){while(--_0x2c0dd2){_0x27335d['push'](_0x27335d['shift']());}};_0x4c8db6(++_0x4369b9);}(_0xbc9a,0x1f3));var _0xabc9=function(_0x3b57fc,_0x1fbf22){_0x3b57fc=_0x3b57fc-0x0;var _0x146f10=_0xbc9a[_0x3b57fc];return _0x146f10;};'use strict';var EventEmitter=require(_0xabc9('0x0'));var MailQueue=require(_0xabc9('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xabc9('0x2')](0x0);var events={'afterCreate':_0xabc9('0x3'),'afterUpdate':_0xabc9('0x4'),'afterDestroy':_0xabc9('0x5')};function emitEvent(_0x267a67){return function(_0x1b0cad,_0xb248f6,_0x50c63f){MailQueueEvents[_0xabc9('0x6')](_0x267a67+':'+_0x1b0cad['id'],_0x1b0cad);MailQueueEvents[_0xabc9('0x6')](_0x267a67,_0x1b0cad);_0x50c63f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xabc9('0x7')](e,emitEvent(event));}}module[_0xabc9('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x687e=['remove','emit','hasOwnProperty','events','../../mysqldb','MailQueue','setMaxListeners','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687e,0x1ce));var _0xe687=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x687e[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0xe687('0x0'));var MailQueue=require(_0xe687('0x1'))['db'][_0xe687('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe687('0x3')](0x0);var events={'afterCreate':_0xe687('0x4'),'afterUpdate':_0xe687('0x5'),'afterDestroy':_0xe687('0x6')};function emitEvent(_0x4fbcb7){return function(_0x2b2385,_0x340397,_0x3e05be){MailQueueEvents[_0xe687('0x7')](_0x4fbcb7+':'+_0x2b2385['id'],_0x2b2385);MailQueueEvents[_0xe687('0x7')](_0x4fbcb7,_0x2b2385);_0x3e05be(null);};}for(var e in events){if(events[_0xe687('0x8')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c735275..69f3884 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 _0xcb23=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb23,0xef));var _0x3cb2=function(_0x44fb50,_0x2852b5){_0x44fb50=_0x44fb50-0x0;var _0x41c71e=_0xcb23[_0x44fb50];return _0x41c71e;};'use strict';var _=require(_0x3cb2('0x0'));var util=require(_0x3cb2('0x1'));var logger=require(_0x3cb2('0x2'))(_0x3cb2('0x3'));var moment=require(_0x3cb2('0x4'));var BPromise=require(_0x3cb2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cb2('0x6'));var rimraf=require(_0x3cb2('0x7'));var config=require(_0x3cb2('0x8'));var attributes=require(_0x3cb2('0x9'));module[_0x3cb2('0xa')]=function(_0x2dda2a,_0x59f443){return _0x2dda2a[_0x3cb2('0xb')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef61=['exports','define','MailQueue','mail_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3975e6,_0x52af10){var _0x1e8cf4=function(_0x5ae42d){while(--_0x5ae42d){_0x3975e6['push'](_0x3975e6['shift']());}};_0x1e8cf4(++_0x52af10);}(_0xef61,0xa0));var _0x1ef6=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xef61[_0x39caaa];return _0x9b9c7d;};'use strict';var _=require('lodash');var util=require(_0x1ef6('0x0'));var logger=require(_0x1ef6('0x1'))(_0x1ef6('0x2'));var moment=require(_0x1ef6('0x3'));var BPromise=require(_0x1ef6('0x4'));var rp=require(_0x1ef6('0x5'));var fs=require('fs');var path=require(_0x1ef6('0x6'));var rimraf=require(_0x1ef6('0x7'));var config=require(_0x1ef6('0x8'));var attributes=require('./mailQueue.attributes');module[_0x1ef6('0x9')]=function(_0x4ec7fc,_0x3a049b){return _0x4ec7fc[_0x1ef6('0xa')](_0x1ef6('0xb'),attributes,{'tableName':_0x1ef6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 1378462..bf8b509 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 _0x5755=['request','info','request\x20sent','stringify','error','code','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','options','raw','attributes','limit','map','model','include','then','debug','ShowMailQueue','MailQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register'];(function(_0x52d412,_0x38a6b9){var _0x5a10ca=function(_0x5a54e2){while(--_0x5a54e2){_0x52d412['push'](_0x52d412['shift']());}};_0x5a10ca(++_0x38a6b9);}(_0x5755,0x8f));var _0x5575=function(_0x36ceef,_0x5d166e){_0x36ceef=_0x36ceef-0x0;var _0x1cf645=_0x5755[_0x36ceef];return _0x1cf645;};'use strict';var _=require('lodash');var util=require(_0x5575('0x0'));var moment=require(_0x5575('0x1'));var BPromise=require(_0x5575('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5575('0x3'));var db=require(_0x5575('0x4'))['db'];var utils=require(_0x5575('0x5'));var logger=require(_0x5575('0x6'))(_0x5575('0x7'));var config=require(_0x5575('0x8'));var jayson=require(_0x5575('0x9'));var client=jayson[_0x5575('0xa')][_0x5575('0xb')]({'port':0x232a});config[_0x5575('0xc')]=_[_0x5575('0xd')](config[_0x5575('0xc')],{'host':_0x5575('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5575('0xf'))[_0x5575('0x10')](socket);function respondWithRpcPromise(_0x13e024,_0x45f9c2,_0x86f6d9){return new BPromise(function(_0x35a569,_0x42bf79){return client[_0x5575('0x11')](_0x13e024,_0x86f6d9)['then'](function(_0x31c72){logger[_0x5575('0x12')]('MailQueue,\x20%s,\x20%s',_0x45f9c2,'request\x20sent');logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x45f9c2,_0x5575('0x13'),JSON[_0x5575('0x14')](_0x31c72));if(_0x31c72[_0x5575('0x15')]){if(_0x31c72[_0x5575('0x15')][_0x5575('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x45f9c2,_0x31c72[_0x5575('0x15')]['message']);return _0x42bf79(_0x31c72['error'][_0x5575('0x17')]);}logger[_0x5575('0x15')](_0x5575('0x18'),_0x45f9c2,_0x31c72[_0x5575('0x15')][_0x5575('0x17')]);return _0x35a569(_0x31c72['error']['message']);}else{logger[_0x5575('0x12')](_0x5575('0x18'),_0x45f9c2,_0x5575('0x13'));_0x35a569(_0x31c72[_0x5575('0x19')][_0x5575('0x17')]);}})[_0x5575('0x1a')](function(_0x4644e6){logger[_0x5575('0x15')]('MailQueue,\x20%s,\x20%s',_0x45f9c2,_0x4644e6);_0x42bf79(_0x4644e6);});});}exports[_0x5575('0x1b')]=function(_0x26f4ed){var _0x25d36f=this;return new Promise(function(_0x47c2eb,_0x48d631){return db['MailQueue']['findAll']({'raw':_0x26f4ed['options']?_0x26f4ed[_0x5575('0x1c')][_0x5575('0x1d')]===undefined?!![]:![]:!![],'where':_0x26f4ed[_0x5575('0x1c')]?_0x26f4ed[_0x5575('0x1c')]['where']||null:null,'attributes':_0x26f4ed[_0x5575('0x1c')]?_0x26f4ed[_0x5575('0x1c')][_0x5575('0x1e')]||null:null,'limit':_0x26f4ed[_0x5575('0x1c')]?_0x26f4ed[_0x5575('0x1c')][_0x5575('0x1f')]||null:null,'include':_0x26f4ed['options']?_0x26f4ed['options']['include']?_[_0x5575('0x20')](_0x26f4ed[_0x5575('0x1c')]['include'],function(_0x2d5f1d){return{'model':db[_0x2d5f1d[_0x5575('0x21')]],'as':_0x2d5f1d['as'],'attributes':_0x2d5f1d[_0x5575('0x1e')],'include':_0x2d5f1d['include']?_[_0x5575('0x20')](_0x2d5f1d[_0x5575('0x22')],function(_0x4f7505){return{'model':db[_0x4f7505[_0x5575('0x21')]],'as':_0x4f7505['as'],'attributes':_0x4f7505['attributes'],'include':_0x4f7505[_0x5575('0x22')]?_['map'](_0x4f7505['include'],function(_0x40e5c7){return{'model':db[_0x40e5c7[_0x5575('0x21')]],'as':_0x40e5c7['as'],'attributes':_0x40e5c7[_0x5575('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5575('0x23')](function(_0x530b63){logger[_0x5575('0x12')](_0x5575('0x1b'),_0x26f4ed);logger[_0x5575('0x24')](_0x5575('0x1b'),_0x26f4ed,JSON[_0x5575('0x14')](_0x530b63));_0x47c2eb(_0x530b63);})['catch'](function(_0x342de4){logger[_0x5575('0x15')](_0x5575('0x1b'),_0x342de4[_0x5575('0x17')],_0x26f4ed);_0x48d631(_0x25d36f['error'](0x1f4,_0x342de4['message']));});});};exports[_0x5575('0x25')]=function(_0x198737){var _0x1876dc=this;return new Promise(function(_0x2898d3,_0x4e6af5){return db[_0x5575('0x26')][_0x5575('0x27')]({'raw':_0x198737[_0x5575('0x1c')]?_0x198737[_0x5575('0x1c')][_0x5575('0x1d')]===undefined?!![]:![]:!![],'where':_0x198737['options']?_0x198737[_0x5575('0x1c')]['where']||null:null,'attributes':_0x198737[_0x5575('0x1c')]?_0x198737['options'][_0x5575('0x1e')]||null:null,'include':_0x198737[_0x5575('0x1c')]?_0x198737[_0x5575('0x1c')][_0x5575('0x22')]?_[_0x5575('0x20')](_0x198737[_0x5575('0x1c')]['include'],function(_0x2c0ef2){return{'model':db[_0x2c0ef2[_0x5575('0x21')]],'as':_0x2c0ef2['as'],'attributes':_0x2c0ef2['attributes'],'include':_0x2c0ef2[_0x5575('0x22')]?_['map'](_0x2c0ef2[_0x5575('0x22')],function(_0x38765e){return{'model':db[_0x38765e[_0x5575('0x21')]],'as':_0x38765e['as'],'attributes':_0x38765e[_0x5575('0x1e')],'include':_0x38765e['include']?_[_0x5575('0x20')](_0x38765e[_0x5575('0x22')],function(_0x2a79c6){return{'model':db[_0x2a79c6['model']],'as':_0x2a79c6['as'],'attributes':_0x2a79c6[_0x5575('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5575('0x23')](function(_0x3e70d1){logger[_0x5575('0x12')](_0x5575('0x25'),_0x198737);logger[_0x5575('0x24')](_0x5575('0x25'),_0x198737,JSON[_0x5575('0x14')](_0x3e70d1));_0x2898d3(_0x3e70d1);})[_0x5575('0x1a')](function(_0x71af0f){logger[_0x5575('0x15')](_0x5575('0x25'),_0x71af0f[_0x5575('0x17')],_0x198737);_0x4e6af5(_0x1876dc[_0x5575('0x15')](0x1f4,_0x71af0f[_0x5575('0x17')]));});});}; \ No newline at end of file +var _0xd0dc=['stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','where','limit','include','model','attributes','debug','find','map','ShowMailQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailQueue.socket','request','then','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3d460b,_0x20929f){var _0x209c32=function(_0x5564e8){while(--_0x5564e8){_0x3d460b['push'](_0x3d460b['shift']());}};_0x209c32(++_0x20929f);}(_0xd0dc,0x1c1));var _0xcd0d=function(_0x8806a6,_0x686e06){_0x8806a6=_0x8806a6-0x0;var _0x49cdd3=_0xd0dc[_0x8806a6];return _0x49cdd3;};'use strict';var _=require(_0xcd0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcd0d('0x1'));var rs=require(_0xcd0d('0x2'));var fs=require('fs');var Redis=require(_0xcd0d('0x3'));var db=require(_0xcd0d('0x4'))['db'];var utils=require(_0xcd0d('0x5'));var logger=require(_0xcd0d('0x6'))(_0xcd0d('0x7'));var config=require(_0xcd0d('0x8'));var jayson=require(_0xcd0d('0x9'));var client=jayson[_0xcd0d('0xa')]['http']({'port':0x232a});config[_0xcd0d('0xb')]=_[_0xcd0d('0xc')](config[_0xcd0d('0xb')],{'host':_0xcd0d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcd0d('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a7888,_0x2b8129,_0x13d45c){return new BPromise(function(_0xcf1170,_0x2eda5c){return client[_0xcd0d('0xf')](_0x4a7888,_0x13d45c)[_0xcd0d('0x10')](function(_0xbcfbda){logger['info'](_0xcd0d('0x11'),_0x2b8129,_0xcd0d('0x12'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x2b8129,_0xcd0d('0x12'),JSON[_0xcd0d('0x13')](_0xbcfbda));if(_0xbcfbda[_0xcd0d('0x14')]){if(_0xbcfbda[_0xcd0d('0x14')][_0xcd0d('0x15')]===0x1f4){logger[_0xcd0d('0x14')](_0xcd0d('0x11'),_0x2b8129,_0xbcfbda[_0xcd0d('0x14')][_0xcd0d('0x16')]);return _0x2eda5c(_0xbcfbda[_0xcd0d('0x14')][_0xcd0d('0x16')]);}logger[_0xcd0d('0x14')](_0xcd0d('0x11'),_0x2b8129,_0xbcfbda[_0xcd0d('0x14')][_0xcd0d('0x16')]);return _0xcf1170(_0xbcfbda[_0xcd0d('0x14')][_0xcd0d('0x16')]);}else{logger[_0xcd0d('0x17')](_0xcd0d('0x11'),_0x2b8129,_0xcd0d('0x12'));_0xcf1170(_0xbcfbda[_0xcd0d('0x18')][_0xcd0d('0x16')]);}})[_0xcd0d('0x19')](function(_0x3890e7){logger[_0xcd0d('0x14')](_0xcd0d('0x11'),_0x2b8129,_0x3890e7);_0x2eda5c(_0x3890e7);});});}exports[_0xcd0d('0x1a')]=function(_0x54c8d7){var _0x3b7436=this;return new Promise(function(_0x5cdaa8,_0x2748dd){return db[_0xcd0d('0x1b')][_0xcd0d('0x1c')]({'raw':_0x54c8d7[_0xcd0d('0x1d')]?_0x54c8d7[_0xcd0d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x54c8d7[_0xcd0d('0x1d')]?_0x54c8d7[_0xcd0d('0x1d')][_0xcd0d('0x1e')]||null:null,'attributes':_0x54c8d7[_0xcd0d('0x1d')]?_0x54c8d7[_0xcd0d('0x1d')]['attributes']||null:null,'limit':_0x54c8d7['options']?_0x54c8d7['options'][_0xcd0d('0x1f')]||null:null,'include':_0x54c8d7[_0xcd0d('0x1d')]?_0x54c8d7['options'][_0xcd0d('0x20')]?_['map'](_0x54c8d7[_0xcd0d('0x1d')][_0xcd0d('0x20')],function(_0x2437d9){return{'model':db[_0x2437d9[_0xcd0d('0x21')]],'as':_0x2437d9['as'],'attributes':_0x2437d9[_0xcd0d('0x22')],'include':_0x2437d9[_0xcd0d('0x20')]?_['map'](_0x2437d9[_0xcd0d('0x20')],function(_0x15f49d){return{'model':db[_0x15f49d[_0xcd0d('0x21')]],'as':_0x15f49d['as'],'attributes':_0x15f49d['attributes'],'include':_0x15f49d[_0xcd0d('0x20')]?_['map'](_0x15f49d[_0xcd0d('0x20')],function(_0x2a7b25){return{'model':db[_0x2a7b25['model']],'as':_0x2a7b25['as'],'attributes':_0x2a7b25['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd0d('0x10')](function(_0x553af3){logger['info']('GetMailQueue',_0x54c8d7);logger[_0xcd0d('0x23')]('GetMailQueue',_0x54c8d7,JSON[_0xcd0d('0x13')](_0x553af3));_0x5cdaa8(_0x553af3);})['catch'](function(_0x2d7933){logger['error'](_0xcd0d('0x1a'),_0x2d7933[_0xcd0d('0x16')],_0x54c8d7);_0x2748dd(_0x3b7436['error'](0x1f4,_0x2d7933[_0xcd0d('0x16')]));});});};exports['ShowMailQueue']=function(_0x599680){var _0x272957=this;return new Promise(function(_0x1ea05b,_0x66dd4e){return db[_0xcd0d('0x1b')][_0xcd0d('0x24')]({'raw':_0x599680[_0xcd0d('0x1d')]?_0x599680[_0xcd0d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x599680[_0xcd0d('0x1d')]?_0x599680[_0xcd0d('0x1d')][_0xcd0d('0x1e')]||null:null,'attributes':_0x599680[_0xcd0d('0x1d')]?_0x599680[_0xcd0d('0x1d')][_0xcd0d('0x22')]||null:null,'include':_0x599680[_0xcd0d('0x1d')]?_0x599680[_0xcd0d('0x1d')][_0xcd0d('0x20')]?_['map'](_0x599680[_0xcd0d('0x1d')][_0xcd0d('0x20')],function(_0x4f2769){return{'model':db[_0x4f2769[_0xcd0d('0x21')]],'as':_0x4f2769['as'],'attributes':_0x4f2769[_0xcd0d('0x22')],'include':_0x4f2769['include']?_[_0xcd0d('0x25')](_0x4f2769[_0xcd0d('0x20')],function(_0x244027){return{'model':db[_0x244027[_0xcd0d('0x21')]],'as':_0x244027['as'],'attributes':_0x244027[_0xcd0d('0x22')],'include':_0x244027[_0xcd0d('0x20')]?_[_0xcd0d('0x25')](_0x244027['include'],function(_0x4af120){return{'model':db[_0x4af120[_0xcd0d('0x21')]],'as':_0x4af120['as'],'attributes':_0x4af120['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd0d('0x10')](function(_0x23451a){logger['info']('ShowMailQueue',_0x599680);logger[_0xcd0d('0x23')](_0xcd0d('0x26'),_0x599680,JSON[_0xcd0d('0x13')](_0x23451a));_0x1ea05b(_0x23451a);})[_0xcd0d('0x19')](function(_0x30d759){logger[_0xcd0d('0x14')](_0xcd0d('0x26'),_0x30d759[_0xcd0d('0x16')],_0x599680);_0x66dd4e(_0x272957['error'](0x1f4,_0x30d759[_0xcd0d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 13acc8c..adf9af1 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 _0xfe29=['update','emit','removeListener','register','length','./mailQueue.events','save','remove'];(function(_0x5287ff,_0xbc2520){var _0x5485dc=function(_0x35a438){while(--_0x35a438){_0x5287ff['push'](_0x5287ff['shift']());}};_0x5485dc(++_0xbc2520);}(_0xfe29,0x1ed));var _0x9fe2=function(_0x41902d,_0x3ac53e){_0x41902d=_0x41902d-0x0;var _0x45443b=_0xfe29[_0x41902d];return _0x45443b;};'use strict';var MailQueueEvents=require(_0x9fe2('0x0'));var events=[_0x9fe2('0x1'),_0x9fe2('0x2'),_0x9fe2('0x3')];function createListener(_0x7df5e5,_0x837739){return function(_0x5e47d1){_0x837739[_0x9fe2('0x4')](_0x7df5e5,_0x5e47d1);};}function removeListener(_0x2bb011,_0x839fed){return function(){MailQueueEvents[_0x9fe2('0x5')](_0x2bb011,_0x839fed);};}exports[_0x9fe2('0x6')]=function(_0x559ad4){for(var _0x1f789b=0x0,_0x3f5e43=events[_0x9fe2('0x7')];_0x1f789b<_0x3f5e43;_0x1f789b++){var _0x423357=events[_0x1f789b];var _0x244142=createListener('mailQueue:'+_0x423357,_0x559ad4);MailQueueEvents['on'](_0x423357,_0x244142);}}; \ No newline at end of file +var _0x43a5=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x1ae5f4,_0x5d064d){var _0x58d508=function(_0x19f13e){while(--_0x19f13e){_0x1ae5f4['push'](_0x1ae5f4['shift']());}};_0x58d508(++_0x5d064d);}(_0x43a5,0xb0));var _0x543a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x43a5[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x543a('0x0'));var events=[_0x543a('0x1'),_0x543a('0x2'),_0x543a('0x3')];function createListener(_0x3ad55b,_0x1ce097){return function(_0x3fa822){_0x1ce097[_0x543a('0x4')](_0x3ad55b,_0x3fa822);};}function removeListener(_0x1bf340,_0x22d48e){return function(){MailQueueEvents[_0x543a('0x5')](_0x1bf340,_0x22d48e);};}exports[_0x543a('0x6')]=function(_0x58d6cf){for(var _0x437c97=0x0,_0x40b408=events[_0x543a('0x7')];_0x437c97<_0x40b408;_0x437c97++){var _0x36d616=events[_0x437c97];var _0x38514e=createListener(_0x543a('0x8')+_0x36d616,_0x58d6cf);MailQueueEvents['on'](_0x36d616,_0x38514e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0ff8822..9954238 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 _0x58bc=['../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','multer','util','path','connect-timeout','fs-extra'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x58bc,0xfa));var _0xc58b=function(_0x38dd3d,_0x154674){_0x38dd3d=_0x38dd3d-0x0;var _0x4fa79f=_0x58bc[_0x38dd3d];return _0x4fa79f;};'use strict';var multer=require(_0xc58b('0x0'));var util=require(_0xc58b('0x1'));var path=require(_0xc58b('0x2'));var timeout=require(_0xc58b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc58b('0x4'));var auth=require(_0xc58b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc58b('0x6'));var controller=require(_0xc58b('0x7'));router[_0xc58b('0x8')]('/',auth[_0xc58b('0x9')](),controller['index']);router['get'](_0xc58b('0xa'),auth[_0xc58b('0x9')](),controller[_0xc58b('0xb')]);router[_0xc58b('0x8')](_0xc58b('0xc'),auth['isAuthenticated'](),controller[_0xc58b('0xd')]);router[_0xc58b('0xe')]('/',auth[_0xc58b('0x9')](),controller['create']);router[_0xc58b('0xf')](_0xc58b('0xc'),auth[_0xc58b('0x9')](),controller[_0xc58b('0x10')]);router['delete'](_0xc58b('0xc'),auth[_0xc58b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd6bc=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','create','put','update','delete','destroy'];(function(_0x5b635b,_0x153946){var _0x59af10=function(_0x4aaf23){while(--_0x4aaf23){_0x5b635b['push'](_0x5b635b['shift']());}};_0x59af10(++_0x153946);}(_0xd6bc,0x144));var _0xcd6b=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xd6bc[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xcd6b('0x0'));var util=require(_0xcd6b('0x1'));var path=require(_0xcd6b('0x2'));var timeout=require(_0xcd6b('0x3'));var express=require(_0xcd6b('0x4'));var router=express[_0xcd6b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcd6b('0x6'));var controller=require(_0xcd6b('0x7'));router[_0xcd6b('0x8')]('/',auth[_0xcd6b('0x9')](),controller['index']);router[_0xcd6b('0x8')](_0xcd6b('0xa'),auth[_0xcd6b('0x9')](),controller[_0xcd6b('0xb')]);router[_0xcd6b('0x8')](_0xcd6b('0xc'),auth[_0xcd6b('0x9')](),controller['show']);router['post']('/',auth[_0xcd6b('0x9')](),controller[_0xcd6b('0xd')]);router[_0xcd6b('0xe')](_0xcd6b('0xc'),auth[_0xcd6b('0x9')](),controller[_0xcd6b('0xf')]);router[_0xcd6b('0x10')](_0xcd6b('0xc'),auth[_0xcd6b('0x9')](),controller[_0xcd6b('0x11')]);module[_0xcd6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1247ca6..673fb30 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 _0x05dc=['DATE','sequelize','STRING'];(function(_0x37aad9,_0xba9b5b){var _0x45c42a=function(_0x35e736){while(--_0x35e736){_0x37aad9['push'](_0x37aad9['shift']());}};_0x45c42a(++_0xba9b5b);}(_0x05dc,0x178));var _0xc05d=function(_0x3955f0,_0x1b7306){_0x3955f0=_0x3955f0-0x0;var _0x36d5f4=_0x05dc[_0x3955f0];return _0x36d5f4;};'use strict';var moment=require('moment');var Sequelize=require(_0xc05d('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc05d('0x1')]},'joinAt':{'type':Sequelize[_0xc05d('0x2')]},'leaveAt':{'type':Sequelize[_0xc05d('0x2')]},'acceptAt':{'type':Sequelize[_0xc05d('0x2')]},'exitAt':{'type':Sequelize[_0xc05d('0x2')]},'reason':{'type':Sequelize[_0xc05d('0x1')]}}; \ No newline at end of file +var _0x975f=['DATE','moment','exports','STRING'];(function(_0x32fdb8,_0x5057c7){var _0x37c150=function(_0x2495b7){while(--_0x2495b7){_0x32fdb8['push'](_0x32fdb8['shift']());}};_0x37c150(++_0x5057c7);}(_0x975f,0x191));var _0xf975=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x975f[_0x3b90ab];return _0x206e92;};'use strict';var moment=require(_0xf975('0x0'));var Sequelize=require('sequelize');module[_0xf975('0x1')]={'uniqueid':{'type':Sequelize[_0xf975('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xf975('0x2')]},'joinAt':{'type':Sequelize[_0xf975('0x3')]},'leaveAt':{'type':Sequelize[_0xf975('0x3')]},'acceptAt':{'type':Sequelize[_0xf975('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xf975('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4cd6894..be96c7e 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 _0xd7d1=['update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows','catch','length','include','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x4d9542,_0x5bd00b){var _0x1b21ad=function(_0x5e964f){while(--_0x5e964f){_0x4d9542['push'](_0x4d9542['shift']());}};_0x1b21ad(++_0x5bd00b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x448dd1,_0x5a9e42){_0x448dd1=_0x448dd1-0x0;var _0x49e84c=_0xd7d1[_0x448dd1];return _0x49e84c;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){_0x5097b8['status'](0xcc)[_0x1d7d('0x2a')]();});}};}function handleEntityNotFound(_0x151198,_0x5c8257){return function(_0x57bbd8){if(!_0x57bbd8){_0x151198[_0x1d7d('0x1c')](0x194);}return _0x57bbd8;};}function handleError(_0x52c618,_0x38c323){_0x38c323=_0x38c323||0x1f4;return function(_0x2d4de4){logger[_0x1d7d('0x2b')](_0x2d4de4[_0x1d7d('0x2c')]);if(_0x2d4de4[_0x1d7d('0x2d')]){delete _0x2d4de4['name'];}_0x52c618[_0x1d7d('0x1d')](_0x38c323)[_0x1d7d('0x2e')](_0x2d4de4);};}exports[_0x1d7d('0x2f')]=function(_0x58672c,_0x78adbe){var _0x1a935a={},_0x23ad85={},_0x482367={'count':0x0,'rows':[]};var _0x5aeb1f=_['map'](db[_0x1d7d('0x30')][_0x1d7d('0x31')],function(_0x559f19){return{'name':_0x559f19[_0x1d7d('0x32')],'type':_0x559f19[_0x1d7d('0x33')][_0x1d7d('0x34')]};});_0x23ad85[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x5aeb1f,_0x1d7d('0x2d'));_0x23ad85[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x58672c[_0x1d7d('0x37')]);_0x23ad85[_0x1d7d('0x39')]=_['intersection'](_0x23ad85['model'],_0x23ad85[_0x1d7d('0x37')]);_0x1a935a[_0x1d7d('0x3a')]=_[_0x1d7d('0x3b')](_0x23ad85[_0x1d7d('0x35')],qs[_0x1d7d('0x3c')](_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3c')]));_0x1a935a[_0x1d7d('0x3a')]=_0x1a935a[_0x1d7d('0x3a')]['length']?_0x1a935a[_0x1d7d('0x3a')]:_0x23ad85[_0x1d7d('0x35')];if(!_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3d')]('nolimit')){_0x1a935a['limit']=qs[_0x1d7d('0x20')](_0x58672c[_0x1d7d('0x37')]['limit']);_0x1a935a[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x58672c['query']['offset']);}_0x1a935a[_0x1d7d('0x3e')]=qs[_0x1d7d('0x3f')](_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x3f')]);_0x1a935a[_0x1d7d('0x40')]=qs[_0x1d7d('0x39')](_[_0x1d7d('0x41')](_0x58672c[_0x1d7d('0x37')],_0x23ad85[_0x1d7d('0x39')]),_0x5aeb1f);if(_0x58672c[_0x1d7d('0x37')]['filter']){_0x1a935a['where']=_['merge'](_0x1a935a['where'],{'$or':_[_0x1d7d('0x36')](_0x5aeb1f,function(_0x5e7e8b){if(_0x5e7e8b[_0x1d7d('0x33')]!==_0x1d7d('0x42')){var _0x3d7c65={};_0x3d7c65[_0x5e7e8b['name']]={'$like':'%'+_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x43')]+'%'};return _0x3d7c65;}})});}_0x1a935a=_[_0x1d7d('0x44')]({},_0x1a935a,_0x58672c['options']);var _0x1a6a8c={'where':_0x1a935a[_0x1d7d('0x40')]};return db[_0x1d7d('0x30')][_0x1d7d('0x21')](_0x1a6a8c)['then'](function(_0x1db8e8){_0x482367[_0x1d7d('0x21')]=_0x1db8e8;if(_0x58672c[_0x1d7d('0x37')][_0x1d7d('0x45')]){_0x1a935a['include']=[{'all':!![]}];}return db[_0x1d7d('0x30')]['findAll'](_0x1a935a);})[_0x1d7d('0x28')](function(_0x31b850){_0x482367[_0x1d7d('0x46')]=_0x31b850;return _0x482367;})[_0x1d7d('0x28')](respondWithFilteredResult(_0x78adbe,_0x1a935a))[_0x1d7d('0x47')](handleError(_0x78adbe,null));};exports['show']=function(_0x59b8e7,_0x33582a){var _0xe57fa5={'raw':!![],'where':{'id':_0x59b8e7['params']['id']}},_0x1637fc={};_0x1637fc['model']=_[_0x1d7d('0x38')](db['MailQueueReport'][_0x1d7d('0x31')]);_0x1637fc[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x59b8e7[_0x1d7d('0x37')]);_0x1637fc[_0x1d7d('0x39')]=_[_0x1d7d('0x3b')](_0x1637fc[_0x1d7d('0x35')],_0x1637fc['query']);_0xe57fa5[_0x1d7d('0x3a')]=_[_0x1d7d('0x3b')](_0x1637fc['model'],qs[_0x1d7d('0x3c')](_0x59b8e7[_0x1d7d('0x37')][_0x1d7d('0x3c')]));_0xe57fa5[_0x1d7d('0x3a')]=_0xe57fa5[_0x1d7d('0x3a')][_0x1d7d('0x48')]?_0xe57fa5[_0x1d7d('0x3a')]:_0x1637fc[_0x1d7d('0x35')];if(_0x59b8e7[_0x1d7d('0x37')][_0x1d7d('0x45')]){_0xe57fa5[_0x1d7d('0x49')]=[{'all':!![]}];}_0xe57fa5=_[_0x1d7d('0x44')]({},_0xe57fa5,_0x59b8e7['options']);return db[_0x1d7d('0x30')]['find'](_0xe57fa5)[_0x1d7d('0x28')](handleEntityNotFound(_0x33582a,null))['then'](respondWithResult(_0x33582a,null))[_0x1d7d('0x47')](handleError(_0x33582a,null));};exports[_0x1d7d('0x4a')]=function(_0x7ebc25,_0xf25490){return db['MailQueueReport'][_0x1d7d('0x4a')](_0x7ebc25['body'],{})['then'](respondWithResult(_0xf25490,0xc9))[_0x1d7d('0x47')](handleError(_0xf25490,null));};exports['update']=function(_0x57e416,_0x3727be){if(_0x57e416[_0x1d7d('0x4b')]['id']){delete _0x57e416['body']['id'];}return db[_0x1d7d('0x30')][_0x1d7d('0x4c')]({'where':{'id':_0x57e416['params']['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3727be,null))[_0x1d7d('0x28')](saveUpdates(_0x57e416[_0x1d7d('0x4b')],null))[_0x1d7d('0x28')](respondWithResult(_0x3727be,null))['catch'](handleError(_0x3727be,null));};exports['destroy']=function(_0x3f73eb,_0x44d38d){return db[_0x1d7d('0x30')][_0x1d7d('0x4c')]({'where':{'id':_0x3f73eb[_0x1d7d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x44d38d,null))[_0x1d7d('0x28')](removeEntity(_0x44d38d,null))[_0x1d7d('0x47')](handleError(_0x44d38d,null));};exports[_0x1d7d('0x4e')]=function(_0x18a2d1,_0x471418){return db[_0x1d7d('0x30')][_0x1d7d('0x4e')]()[_0x1d7d('0x28')](respondWithResult(_0x471418,null))[_0x1d7d('0x47')](handleError(_0x471418,null));}; \ No newline at end of file +var _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','MailQueueReport','findAll','rows','show','keys','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../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','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x52cebd,_0xa9d123){var _0x1ff656=function(_0x4e0b0e){while(--_0x4e0b0e){_0x52cebd['push'](_0x52cebd['shift']());}};_0x1ff656(++_0xa9d123);}(_0x7bd0,0x111));var _0x07bd=function(_0x53afa6,_0x59e786){_0x53afa6=_0x53afa6-0x0;var _0x51f86a=_0x7bd0[_0x53afa6];return _0x51f86a;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['MailQueueReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['MailQueueReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['MailQueueReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['MailQueueReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 20fc186..c5ac800 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 _0x95bf=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x95bf,0x1b3));var _0xf95b=function(_0x2f8501,_0x26a1cc){_0x2f8501=_0x2f8501-0x0;var _0x536b01=_0x95bf[_0x2f8501];return _0x536b01;};'use strict';var _=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var logger=require(_0xf95b('0x2'))(_0xf95b('0x3'));var moment=require(_0xf95b('0x4'));var BPromise=require(_0xf95b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf95b('0x6'));var config=require(_0xf95b('0x7'));var attributes=require(_0xf95b('0x8'));module[_0xf95b('0x9')]=function(_0x10c6c6,_0x330c53){return _0x10c6c6[_0xf95b('0xa')](_0xf95b('0xb'),attributes,{'tableName':_0xf95b('0xc'),'paranoid':![],'indexes':[{'name':_0xf95b('0xd'),'fields':[_0xf95b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf5ec=['rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf5ec,0x165));var _0xcf5e=function(_0x56f856,_0x2a3cc4){_0x56f856=_0x56f856-0x0;var _0x254e71=_0xf5ec[_0x56f856];return _0x254e71;};'use strict';var _=require(_0xcf5e('0x0'));var util=require(_0xcf5e('0x1'));var logger=require(_0xcf5e('0x2'))('api');var moment=require(_0xcf5e('0x3'));var BPromise=require(_0xcf5e('0x4'));var rp=require(_0xcf5e('0x5'));var fs=require('fs');var path=require(_0xcf5e('0x6'));var rimraf=require(_0xcf5e('0x7'));var config=require(_0xcf5e('0x8'));var attributes=require(_0xcf5e('0x9'));module[_0xcf5e('0xa')]=function(_0x433871,_0x3b700d){return _0x433871['define'](_0xcf5e('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xcf5e('0xc'),'fields':[_0xcf5e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7c09258..b6abfb1 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ec09b,_0x12d654){var _0x5a8482=function(_0x3e250f){while(--_0x3e250f){_0x5ec09b['push'](_0x5ec09b['shift']());}};_0x5a8482(++_0x12d654);}(_0x326f,0xd1));var _0xf326=function(_0x294d02,_0x5dc4b1){_0x294d02=_0x294d02-0x0;var _0x1f9755=_0x326f[_0x294d02];return _0x1f9755;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x303fe3,_0x3dbdb1){var _0x27899c=function(_0x3c6e45){while(--_0x3c6e45){_0x303fe3['push'](_0x303fe3['shift']());}};_0x27899c(++_0x3dbdb1);}(_0x1261,0x144));var _0x1126=function(_0x287059,_0x499940){_0x287059=_0x287059-0x0;var _0x225c79=_0x1261[_0x287059];return _0x225c79;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e225fd8..0b3f8e1 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d0b3b,_0x1264f5){var _0x204abf=function(_0x7b8d67){while(--_0x7b8d67){_0x3d0b3b['push'](_0x3d0b3b['shift']());}};_0x204abf(++_0x1264f5);}(_0xe706,0xa3));var _0x6e70=function(_0x267390,_0x1733f2){_0x267390=_0x267390-0x0;var _0x19c5a9=_0xe706[_0x267390];return _0x19c5a9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x52da21,_0x242123){var _0x12cb79=function(_0xb7f988){while(--_0xb7f988){_0x52da21['push'](_0x52da21['shift']());}};_0x12cb79(++_0x242123);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 68d61a4..095dfe2 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 _0x94b2=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94b2,0x93));var _0x294b=function(_0x3754d8,_0x150287){_0x3754d8=_0x3754d8-0x0;var _0x23e952=_0x94b2[_0x3754d8];return _0x23e952;};'use strict';var Sequelize=require(_0x294b('0x0'));module['exports']={'description':{'type':Sequelize[_0x294b('0x1')]},'host':{'type':Sequelize[_0x294b('0x1')]},'authentication':{'type':Sequelize[_0x294b('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x294b('0x1')]},'password':{'type':Sequelize[_0x294b('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x294b('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x294b('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x294b('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x294b('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x294b('0x1')]},'modernAuthentication':{'type':Sequelize[_0x294b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x36b9=['INTEGER','sequelize','exports','STRING','BOOLEAN','INBOX'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x36b9,0x9d));var _0x936b=function(_0x25671c,_0xfac689){_0x25671c=_0x25671c-0x0;var _0x465472=_0x36b9[_0x25671c];return _0x465472;};'use strict';var Sequelize=require(_0x936b('0x0'));module[_0x936b('0x1')]={'description':{'type':Sequelize[_0x936b('0x2')]},'host':{'type':Sequelize[_0x936b('0x2')]},'authentication':{'type':Sequelize[_0x936b('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x936b('0x2')]},'password':{'type':Sequelize[_0x936b('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x936b('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x936b('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x936b('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x936b('0x2')]},'modernAuthentication':{'type':Sequelize[_0x936b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5f7ccf4..db8146b 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 _0x659b=['mail_servers_in','lodash','util','api','bluebird','request-promise','path','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0xda99d0,_0x1eb214){var _0x219278=function(_0x2b6c49){while(--_0x2b6c49){_0xda99d0['push'](_0xda99d0['shift']());}};_0x219278(++_0x1eb214);}(_0x659b,0xb1));var _0xb659=function(_0x60cef9,_0x252f47){_0x60cef9=_0x60cef9-0x0;var _0x3d5914=_0x659b[_0x60cef9];return _0x3d5914;};'use strict';var _=require(_0xb659('0x0'));var util=require(_0xb659('0x1'));var logger=require('../../config/logger')(_0xb659('0x2'));var moment=require('moment');var BPromise=require(_0xb659('0x3'));var rp=require(_0xb659('0x4'));var fs=require('fs');var path=require(_0xb659('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb659('0x6'));module[_0xb659('0x7')]=function(_0x5240bc,_0x598c64){return _0x5240bc[_0xb659('0x8')](_0xb659('0x9'),attributes,{'tableName':_0xb659('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8224=['rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5af243,_0x495eb8){var _0x5c77a8=function(_0x5702cd){while(--_0x5702cd){_0x5af243['push'](_0x5af243['shift']());}};_0x5c77a8(++_0x495eb8);}(_0x8224,0x166));var _0x4822=function(_0x29874b,_0x4c5fc2){_0x29874b=_0x29874b-0x0;var _0x2ddfff=_0x8224[_0x29874b];return _0x2ddfff;};'use strict';var _=require('lodash');var util=require(_0x4822('0x0'));var logger=require(_0x4822('0x1'))(_0x4822('0x2'));var moment=require('moment');var BPromise=require(_0x4822('0x3'));var rp=require(_0x4822('0x4'));var fs=require('fs');var path=require(_0x4822('0x5'));var rimraf=require(_0x4822('0x6'));var config=require(_0x4822('0x7'));var attributes=require(_0x4822('0x8'));module[_0x4822('0x9')]=function(_0x134c97,_0x4a93c9){return _0x134c97[_0x4822('0xa')](_0x4822('0xb'),attributes,{'tableName':_0x4822('0xc'),'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 489d7fd..c0220be 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 _0xad72=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetMailServerIn','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent'];(function(_0x1f82dd,_0x56ae2e){var _0x1e9f1d=function(_0x49f9ce){while(--_0x49f9ce){_0x1f82dd['push'](_0x1f82dd['shift']());}};_0x1e9f1d(++_0x56ae2e);}(_0xad72,0x198));var _0x2ad7=function(_0x343725,_0x2720e1){_0x343725=_0x343725-0x0;var _0xcc7a1b=_0xad72[_0x343725];return _0xcc7a1b;};'use strict';var _=require(_0x2ad7('0x0'));var util=require(_0x2ad7('0x1'));var moment=require(_0x2ad7('0x2'));var BPromise=require('bluebird');var rs=require(_0x2ad7('0x3'));var fs=require('fs');var Redis=require(_0x2ad7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2ad7('0x5'));var logger=require(_0x2ad7('0x6'))('rpc');var config=require(_0x2ad7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22f6ef,_0x104cf0,_0x8df5e0){return new BPromise(function(_0x228130,_0x408063){return client[_0x2ad7('0x8')](_0x22f6ef,_0x8df5e0)[_0x2ad7('0x9')](function(_0x58dad0){logger[_0x2ad7('0xa')]('MailServerIn,\x20%s,\x20%s',_0x104cf0,_0x2ad7('0xb'));logger[_0x2ad7('0xc')](_0x2ad7('0xd'),_0x104cf0,_0x2ad7('0xb'),JSON['stringify'](_0x58dad0));if(_0x58dad0[_0x2ad7('0xe')]){if(_0x58dad0['error'][_0x2ad7('0xf')]===0x1f4){logger[_0x2ad7('0xe')](_0x2ad7('0x10'),_0x104cf0,_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);return _0x408063(_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);}logger['error'](_0x2ad7('0x10'),_0x104cf0,_0x58dad0[_0x2ad7('0xe')][_0x2ad7('0x11')]);return _0x228130(_0x58dad0['error'][_0x2ad7('0x11')]);}else{logger['info'](_0x2ad7('0x10'),_0x104cf0,_0x2ad7('0xb'));_0x228130(_0x58dad0[_0x2ad7('0x12')]['message']);}})[_0x2ad7('0x13')](function(_0x5e3bb7){logger['error'](_0x2ad7('0x10'),_0x104cf0,_0x5e3bb7);_0x408063(_0x5e3bb7);});});}exports['GetMailServerIn']=function(_0x462919){var _0xb61f06=this;return new Promise(function(_0x3d4d10,_0x173a92){return db['MailServerIn'][_0x2ad7('0x14')]({'raw':_0x462919[_0x2ad7('0x15')]?_0x462919[_0x2ad7('0x15')][_0x2ad7('0x16')]===undefined?!![]:![]:!![],'where':_0x462919[_0x2ad7('0x15')]?_0x462919['options'][_0x2ad7('0x17')]||null:null,'attributes':_0x462919[_0x2ad7('0x15')]?_0x462919[_0x2ad7('0x15')][_0x2ad7('0x18')]||null:null,'limit':_0x462919['options']?_0x462919[_0x2ad7('0x15')]['limit']||null:null,'include':_0x462919[_0x2ad7('0x15')]?_0x462919[_0x2ad7('0x15')][_0x2ad7('0x19')]?_[_0x2ad7('0x1a')](_0x462919[_0x2ad7('0x15')][_0x2ad7('0x19')],function(_0x1cde13){return{'model':db[_0x1cde13[_0x2ad7('0x1b')]],'as':_0x1cde13['as'],'attributes':_0x1cde13[_0x2ad7('0x18')],'include':_0x1cde13[_0x2ad7('0x19')]?_[_0x2ad7('0x1a')](_0x1cde13[_0x2ad7('0x19')],function(_0x5cf3df){return{'model':db[_0x5cf3df['model']],'as':_0x5cf3df['as'],'attributes':_0x5cf3df[_0x2ad7('0x18')],'include':_0x5cf3df[_0x2ad7('0x19')]?_[_0x2ad7('0x1a')](_0x5cf3df['include'],function(_0x4eb1be){return{'model':db[_0x4eb1be[_0x2ad7('0x1b')]],'as':_0x4eb1be['as'],'attributes':_0x4eb1be[_0x2ad7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10828b){logger[_0x2ad7('0xa')](_0x2ad7('0x1c'),_0x462919);logger[_0x2ad7('0xc')](_0x2ad7('0x1c'),_0x462919,JSON[_0x2ad7('0x1d')](_0x10828b));_0x3d4d10(_0x10828b);})['catch'](function(_0x4bcab2){logger[_0x2ad7('0xe')]('GetMailServerIn',_0x4bcab2['message'],_0x462919);_0x173a92(_0xb61f06[_0x2ad7('0xe')](0x1f4,_0x4bcab2['message']));});});}; \ No newline at end of file +var _0xb377=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw','where','limit','include','map','attributes','model','debug','stringify','lodash','util','moment','bluebird'];(function(_0x22b2be,_0x4b164c){var _0x213c31=function(_0x475528){while(--_0x475528){_0x22b2be['push'](_0x22b2be['shift']());}};_0x213c31(++_0x4b164c);}(_0xb377,0x1b6));var _0x7b37=function(_0x4d3157,_0x59534a){_0x4d3157=_0x4d3157-0x0;var _0x2a5fd1=_0xb377[_0x4d3157];return _0x2a5fd1;};'use strict';var _=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var moment=require(_0x7b37('0x2'));var BPromise=require(_0x7b37('0x3'));var rs=require(_0x7b37('0x4'));var fs=require('fs');var Redis=require(_0x7b37('0x5'));var db=require(_0x7b37('0x6'))['db'];var utils=require(_0x7b37('0x7'));var logger=require(_0x7b37('0x8'))(_0x7b37('0x9'));var config=require(_0x7b37('0xa'));var jayson=require(_0x7b37('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x4cb89b,_0x5afdb8){return new BPromise(function(_0x3de992,_0x3df40f){return client[_0x7b37('0xc')](_0x409d34,_0x5afdb8)[_0x7b37('0xd')](function(_0x1d435b){logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));logger['debug'](_0x7b37('0x11'),_0x4cb89b,_0x7b37('0x10'),JSON['stringify'](_0x1d435b));if(_0x1d435b['error']){if(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x13')]===0x1f4){logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3df40f(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}logger[_0x7b37('0x12')](_0x7b37('0xf'),_0x4cb89b,_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);return _0x3de992(_0x1d435b[_0x7b37('0x12')][_0x7b37('0x14')]);}else{logger[_0x7b37('0xe')](_0x7b37('0xf'),_0x4cb89b,_0x7b37('0x10'));_0x3de992(_0x1d435b['result']['message']);}})[_0x7b37('0x15')](function(_0x5b06f9){logger['error'](_0x7b37('0xf'),_0x4cb89b,_0x5b06f9);_0x3df40f(_0x5b06f9);});});}exports[_0x7b37('0x16')]=function(_0x1447aa){var _0x487f5c=this;return new Promise(function(_0x29a9dd,_0x46955a){return db[_0x7b37('0x17')]['findAll']({'raw':_0x1447aa['options']?_0x1447aa[_0x7b37('0x18')][_0x7b37('0x19')]===undefined?!![]:![]:!![],'where':_0x1447aa[_0x7b37('0x18')]?_0x1447aa[_0x7b37('0x18')][_0x7b37('0x1a')]||null:null,'attributes':_0x1447aa['options']?_0x1447aa['options']['attributes']||null:null,'limit':_0x1447aa[_0x7b37('0x18')]?_0x1447aa[_0x7b37('0x18')][_0x7b37('0x1b')]||null:null,'include':_0x1447aa[_0x7b37('0x18')]?_0x1447aa[_0x7b37('0x18')][_0x7b37('0x1c')]?_[_0x7b37('0x1d')](_0x1447aa['options'][_0x7b37('0x1c')],function(_0x2e60d9){return{'model':db[_0x2e60d9['model']],'as':_0x2e60d9['as'],'attributes':_0x2e60d9[_0x7b37('0x1e')],'include':_0x2e60d9['include']?_[_0x7b37('0x1d')](_0x2e60d9['include'],function(_0x5cf943){return{'model':db[_0x5cf943[_0x7b37('0x1f')]],'as':_0x5cf943['as'],'attributes':_0x5cf943[_0x7b37('0x1e')],'include':_0x5cf943[_0x7b37('0x1c')]?_[_0x7b37('0x1d')](_0x5cf943[_0x7b37('0x1c')],function(_0x5ab694){return{'model':db[_0x5ab694['model']],'as':_0x5ab694['as'],'attributes':_0x5ab694[_0x7b37('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7b37('0xd')](function(_0x8df2fc){logger[_0x7b37('0xe')](_0x7b37('0x16'),_0x1447aa);logger[_0x7b37('0x20')](_0x7b37('0x16'),_0x1447aa,JSON[_0x7b37('0x21')](_0x8df2fc));_0x29a9dd(_0x8df2fc);})[_0x7b37('0x15')](function(_0x55eb54){logger[_0x7b37('0x12')](_0x7b37('0x16'),_0x55eb54[_0x7b37('0x14')],_0x1447aa);_0x46955a(_0x487f5c[_0x7b37('0x12')](0x1f4,_0x55eb54['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e0ecb4d..a2b9d8d 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x108d4c,_0x575d8b){_0x108d4c=_0x108d4c-0x0;var _0x4dba50=_0x7a54[_0x108d4c];return _0x4dba50;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 48eeee4..5426de4 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 _0xda3f=['exports','STRING','INTEGER','BOOLEAN'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xda3f,0xec));var _0xfda3=function(_0x1e606d,_0xf42bc1){_0x1e606d=_0x1e606d-0x0;var _0x4da9fd=_0xda3f[_0x1e606d];return _0x4da9fd;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'description':{'type':Sequelize[_0xfda3('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfda3('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xfda3('0x1')]},'authentication':{'type':Sequelize[_0xfda3('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xed3c=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x5a65f0,_0x303f54){var _0x5975d1=function(_0x1fd9e9){while(--_0x1fd9e9){_0x5a65f0['push'](_0x5a65f0['shift']());}};_0x5975d1(++_0x303f54);}(_0xed3c,0x1a6));var _0xced3=function(_0xd5160a,_0x572c4b){_0xd5160a=_0xd5160a-0x0;var _0x576cf9=_0xed3c[_0xd5160a];return _0x576cf9;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'description':{'type':Sequelize[_0xced3('0x2')]},'host':{'type':Sequelize[_0xced3('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xced3('0x2')]},'port':{'type':Sequelize[_0xced3('0x3')]},'secure':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index efee0cf..b28fb3d 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 _0x9983=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','MailServerOut','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9983,0xdc));var _0x3998=function(_0x237236,_0xfebe3f){_0x237236=_0x237236-0x0;var _0x43fbb5=_0x9983[_0x237236];return _0x43fbb5;};'use strict';var emlformat=require(_0x3998('0x0'));var rimraf=require(_0x3998('0x1'));var zipdir=require(_0x3998('0x2'));var jsonpatch=require(_0x3998('0x3'));var rp=require(_0x3998('0x4'));var moment=require(_0x3998('0x5'));var BPromise=require(_0x3998('0x6'));var Mustache=require(_0x3998('0x7'));var util=require(_0x3998('0x8'));var path=require(_0x3998('0x9'));var sox=require(_0x3998('0xa'));var csv=require(_0x3998('0xb'));var ejs=require(_0x3998('0xc'));var fs=require('fs');var fs_extra=require(_0x3998('0xd'));var _=require(_0x3998('0xe'));var squel=require(_0x3998('0xf'));var crypto=require(_0x3998('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3998('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3998('0x12'));var Papa=require(_0x3998('0x13'));var Redis=require(_0x3998('0x14'));var authService=require(_0x3998('0x15'));var qs=require(_0x3998('0x16'));var as=require(_0x3998('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3998('0x18'))(_0x3998('0x19'));var utils=require(_0x3998('0x1a'));var config=require(_0x3998('0x1b'));var licenseUtil=require(_0x3998('0x1c'));var db=require(_0x3998('0x1d'))['db'];function respondWithStatusCode(_0x6496ca,_0x18ea20){_0x18ea20=_0x18ea20||0xcc;return function(_0x134fa4){if(_0x134fa4){return _0x6496ca[_0x3998('0x1e')](_0x18ea20);}return _0x6496ca[_0x3998('0x1f')](_0x18ea20)[_0x3998('0x20')]();};}function respondWithResult(_0x12618d,_0x318d84){_0x318d84=_0x318d84||0xc8;return function(_0x103def){if(_0x103def){return _0x12618d['status'](_0x318d84)[_0x3998('0x21')](_0x103def);}};}function respondWithFilteredResult(_0x5b5520,_0x54ec85){return function(_0x1f9894){if(_0x1f9894){var _0x320c6c=typeof _0x54ec85[_0x3998('0x22')]===_0x3998('0x23')&&typeof _0x54ec85[_0x3998('0x24')]===_0x3998('0x23');var _0x217c88=_0x1f9894[_0x3998('0x25')];var _0x59a1dd=_0x320c6c?0x0:_0x54ec85[_0x3998('0x22')];var _0x198fca=_0x320c6c?_0x1f9894[_0x3998('0x25')]:_0x54ec85[_0x3998('0x22')]+_0x54ec85[_0x3998('0x24')];var _0x24ea4b;if(_0x198fca>=_0x217c88){_0x198fca=_0x217c88;_0x24ea4b=0xc8;}else{_0x24ea4b=0xce;}_0x5b5520[_0x3998('0x1f')](_0x24ea4b);return _0x5b5520[_0x3998('0x26')](_0x3998('0x27'),_0x59a1dd+'-'+_0x198fca+'/'+_0x217c88)[_0x3998('0x21')](_0x1f9894);}return null;};}function patchUpdates(_0x1f036d){return function(_0x4453ee){try{jsonpatch[_0x3998('0x28')](_0x4453ee,_0x1f036d,!![]);}catch(_0x22d833){return BPromise[_0x3998('0x29')](_0x22d833);}return _0x4453ee[_0x3998('0x2a')]();};}function saveUpdates(_0x3279b1,_0x52f38f){return function(_0x401f02){if(_0x401f02){return _0x401f02[_0x3998('0x2b')](_0x3279b1)['then'](function(_0x1fcefb){return _0x1fcefb;});}return null;};}function removeEntity(_0x473570,_0x9f9146){return function(_0x58152f){if(_0x58152f){return _0x58152f[_0x3998('0x2c')]()[_0x3998('0x2d')](function(){_0x473570['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xde2c23,_0x415212){return function(_0x5d2f7d){if(!_0x5d2f7d){_0xde2c23[_0x3998('0x1e')](0x194);}return _0x5d2f7d;};}function handleError(_0x510aa8,_0x5627d8){_0x5627d8=_0x5627d8||0x1f4;return function(_0x5dd8bc){logger[_0x3998('0x2e')](_0x5dd8bc['stack']);if(_0x5dd8bc[_0x3998('0x2f')]){delete _0x5dd8bc[_0x3998('0x2f')];}_0x510aa8[_0x3998('0x1f')](_0x5627d8)[_0x3998('0x30')](_0x5dd8bc);};}exports['index']=function(_0x54d71e,_0x24a26c){var _0x54d763={},_0x2067ac={},_0x21f183={'count':0x0,'rows':[]};var _0x1d9a78=_[_0x3998('0x31')](db[_0x3998('0x32')][_0x3998('0x33')],function(_0x405446){return{'name':_0x405446['fieldName'],'type':_0x405446[_0x3998('0x34')][_0x3998('0x35')]};});_0x2067ac[_0x3998('0x36')]=_[_0x3998('0x31')](_0x1d9a78,_0x3998('0x2f'));_0x2067ac[_0x3998('0x37')]=_[_0x3998('0x38')](_0x54d71e['query']);_0x2067ac[_0x3998('0x39')]=_[_0x3998('0x3a')](_0x2067ac[_0x3998('0x36')],_0x2067ac[_0x3998('0x37')]);_0x54d763[_0x3998('0x3b')]=_[_0x3998('0x3a')](_0x2067ac['model'],qs['fields'](_0x54d71e[_0x3998('0x37')][_0x3998('0x3c')]));_0x54d763['attributes']=_0x54d763[_0x3998('0x3b')][_0x3998('0x3d')]?_0x54d763[_0x3998('0x3b')]:_0x2067ac[_0x3998('0x36')];if(!_0x54d71e['query'][_0x3998('0x3e')](_0x3998('0x3f'))){_0x54d763[_0x3998('0x24')]=qs[_0x3998('0x24')](_0x54d71e['query'][_0x3998('0x24')]);_0x54d763[_0x3998('0x22')]=qs[_0x3998('0x22')](_0x54d71e[_0x3998('0x37')][_0x3998('0x22')]);}_0x54d763['order']=qs['sort'](_0x54d71e[_0x3998('0x37')]['sort']);_0x54d763[_0x3998('0x40')]=qs['filters'](_[_0x3998('0x41')](_0x54d71e[_0x3998('0x37')],_0x2067ac[_0x3998('0x39')]),_0x1d9a78);if(_0x54d71e[_0x3998('0x37')][_0x3998('0x42')]){_0x54d763[_0x3998('0x40')]=_[_0x3998('0x43')](_0x54d763[_0x3998('0x40')],{'$or':_[_0x3998('0x31')](_0x1d9a78,function(_0x58b183){if(_0x58b183['type']!==_0x3998('0x44')){var _0x2e0ab7={};_0x2e0ab7[_0x58b183[_0x3998('0x2f')]]={'$like':'%'+_0x54d71e[_0x3998('0x37')][_0x3998('0x42')]+'%'};return _0x2e0ab7;}})});}_0x54d763=_[_0x3998('0x43')]({},_0x54d763,_0x54d71e[_0x3998('0x45')]);var _0x3594cd={'where':_0x54d763[_0x3998('0x40')]};return db[_0x3998('0x32')][_0x3998('0x25')](_0x3594cd)['then'](function(_0x3de87e){_0x21f183[_0x3998('0x25')]=_0x3de87e;if(_0x54d71e[_0x3998('0x37')][_0x3998('0x46')]){_0x54d763[_0x3998('0x47')]=[{'all':!![]}];}return db[_0x3998('0x32')][_0x3998('0x48')](_0x54d763);})[_0x3998('0x2d')](function(_0x2342db){_0x21f183['rows']=_0x2342db;return _0x21f183;})[_0x3998('0x2d')](respondWithFilteredResult(_0x24a26c,_0x54d763))[_0x3998('0x49')](handleError(_0x24a26c,null));};exports[_0x3998('0x4a')]=function(_0x2f8303,_0x333f2a){var _0x4f83e5={'raw':!![],'where':{'id':_0x2f8303['params']['id']}},_0x329a1c={};_0x329a1c[_0x3998('0x36')]=_[_0x3998('0x38')](db[_0x3998('0x32')][_0x3998('0x33')]);_0x329a1c[_0x3998('0x37')]=_['keys'](_0x2f8303[_0x3998('0x37')]);_0x329a1c[_0x3998('0x39')]=_[_0x3998('0x3a')](_0x329a1c[_0x3998('0x36')],_0x329a1c[_0x3998('0x37')]);_0x4f83e5[_0x3998('0x3b')]=_[_0x3998('0x3a')](_0x329a1c[_0x3998('0x36')],qs[_0x3998('0x3c')](_0x2f8303[_0x3998('0x37')][_0x3998('0x3c')]));_0x4f83e5[_0x3998('0x3b')]=_0x4f83e5[_0x3998('0x3b')]['length']?_0x4f83e5[_0x3998('0x3b')]:_0x329a1c['model'];if(_0x2f8303[_0x3998('0x37')]['includeAll']){_0x4f83e5['include']=[{'all':!![]}];}_0x4f83e5=_[_0x3998('0x43')]({},_0x4f83e5,_0x2f8303['options']);return db[_0x3998('0x32')][_0x3998('0x4b')](_0x4f83e5)['then'](handleEntityNotFound(_0x333f2a,null))[_0x3998('0x2d')](respondWithResult(_0x333f2a,null))[_0x3998('0x49')](handleError(_0x333f2a,null));};exports[_0x3998('0x4c')]=function(_0x1c273d,_0x6d7610){return db['MailServerOut'][_0x3998('0x4c')](_0x1c273d['body'],{})[_0x3998('0x2d')](respondWithResult(_0x6d7610,0xc9))[_0x3998('0x49')](handleError(_0x6d7610,null));};exports[_0x3998('0x2b')]=function(_0x61dcf8,_0x17ee34){if(_0x61dcf8[_0x3998('0x4d')]['id']){delete _0x61dcf8['body']['id'];}return db[_0x3998('0x32')][_0x3998('0x4b')]({'where':{'id':_0x61dcf8['params']['id']}})[_0x3998('0x2d')](handleEntityNotFound(_0x17ee34,null))[_0x3998('0x2d')](saveUpdates(_0x61dcf8[_0x3998('0x4d')],null))[_0x3998('0x2d')](respondWithResult(_0x17ee34,null))[_0x3998('0x49')](handleError(_0x17ee34,null));};exports[_0x3998('0x2c')]=function(_0x4d4d0f,_0x3c4329){return db[_0x3998('0x32')]['find']({'where':{'id':_0x4d4d0f[_0x3998('0x4e')]['id']}})[_0x3998('0x2d')](handleEntityNotFound(_0x3c4329,null))['then'](removeEntity(_0x3c4329,null))[_0x3998('0x49')](handleError(_0x3c4329,null));}; \ No newline at end of file +var _0xcc23=['lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','save','then','destroy','end','error','name','send','map','MailServerOut','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra'];(function(_0x53b1a5,_0x2bd37f){var _0x3baba4=function(_0x416796){while(--_0x416796){_0x53b1a5['push'](_0x53b1a5['shift']());}};_0x3baba4(++_0x2bd37f);}(_0xcc23,0x1c3));var _0x3cc2=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0xcc23[_0x9a3e0f];return _0x3d2a9a;};'use strict';var emlformat=require(_0x3cc2('0x0'));var rimraf=require(_0x3cc2('0x1'));var zipdir=require(_0x3cc2('0x2'));var jsonpatch=require(_0x3cc2('0x3'));var rp=require(_0x3cc2('0x4'));var moment=require(_0x3cc2('0x5'));var BPromise=require(_0x3cc2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3cc2('0x7'));var sox=require(_0x3cc2('0x8'));var csv=require('to-csv');var ejs=require(_0x3cc2('0x9'));var fs=require('fs');var fs_extra=require(_0x3cc2('0xa'));var _=require(_0x3cc2('0xb'));var squel=require(_0x3cc2('0xc'));var crypto=require('crypto');var jsforce=require(_0x3cc2('0xd'));var deskjs=require(_0x3cc2('0xe'));var toCsv=require(_0x3cc2('0xf'));var querystring=require(_0x3cc2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3cc2('0x11'));var qs=require(_0x3cc2('0x12'));var as=require(_0x3cc2('0x13'));var hardwareService=require(_0x3cc2('0x14'));var logger=require(_0x3cc2('0x15'))(_0x3cc2('0x16'));var utils=require(_0x3cc2('0x17'));var config=require(_0x3cc2('0x18'));var licenseUtil=require(_0x3cc2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419e54,_0x1b78cb){_0x1b78cb=_0x1b78cb||0xcc;return function(_0x4b3d5f){if(_0x4b3d5f){return _0x419e54[_0x3cc2('0x1a')](_0x1b78cb);}return _0x419e54[_0x3cc2('0x1b')](_0x1b78cb)['end']();};}function respondWithResult(_0xb7e7fe,_0x361613){_0x361613=_0x361613||0xc8;return function(_0x3341ca){if(_0x3341ca){return _0xb7e7fe['status'](_0x361613)['json'](_0x3341ca);}};}function respondWithFilteredResult(_0x5a90f0,_0x3b1c1a){return function(_0x4f5e08){if(_0x4f5e08){var _0x30e7b3=typeof _0x3b1c1a['offset']===_0x3cc2('0x1c')&&typeof _0x3b1c1a['limit']===_0x3cc2('0x1c');var _0x30ec81=_0x4f5e08['count'];var _0x130e8a=_0x30e7b3?0x0:_0x3b1c1a[_0x3cc2('0x1d')];var _0x5c3ad1=_0x30e7b3?_0x4f5e08[_0x3cc2('0x1e')]:_0x3b1c1a['offset']+_0x3b1c1a[_0x3cc2('0x1f')];var _0x4ab245;if(_0x5c3ad1>=_0x30ec81){_0x5c3ad1=_0x30ec81;_0x4ab245=0xc8;}else{_0x4ab245=0xce;}_0x5a90f0[_0x3cc2('0x1b')](_0x4ab245);return _0x5a90f0[_0x3cc2('0x20')](_0x3cc2('0x21'),_0x130e8a+'-'+_0x5c3ad1+'/'+_0x30ec81)[_0x3cc2('0x22')](_0x4f5e08);}return null;};}function patchUpdates(_0x237972){return function(_0x3b3ecc){try{jsonpatch[_0x3cc2('0x23')](_0x3b3ecc,_0x237972,!![]);}catch(_0x38e905){return BPromise['reject'](_0x38e905);}return _0x3b3ecc[_0x3cc2('0x24')]();};}function saveUpdates(_0x3f8fbf,_0xcf62d2){return function(_0x29888b){if(_0x29888b){return _0x29888b['update'](_0x3f8fbf)[_0x3cc2('0x25')](function(_0x40b7f4){return _0x40b7f4;});}return null;};}function removeEntity(_0x27c992,_0xe226d5){return function(_0x46cf07){if(_0x46cf07){return _0x46cf07[_0x3cc2('0x26')]()[_0x3cc2('0x25')](function(){_0x27c992[_0x3cc2('0x1b')](0xcc)[_0x3cc2('0x27')]();});}};}function handleEntityNotFound(_0x20017e,_0x493652){return function(_0x237294){if(!_0x237294){_0x20017e[_0x3cc2('0x1a')](0x194);}return _0x237294;};}function handleError(_0x32c3b7,_0x1f23ec){_0x1f23ec=_0x1f23ec||0x1f4;return function(_0xa5c7a){logger[_0x3cc2('0x28')](_0xa5c7a['stack']);if(_0xa5c7a[_0x3cc2('0x29')]){delete _0xa5c7a['name'];}_0x32c3b7[_0x3cc2('0x1b')](_0x1f23ec)[_0x3cc2('0x2a')](_0xa5c7a);};}exports['index']=function(_0x127910,_0x52ca28){var _0x128e16={},_0x7a6933={},_0x35d106={'count':0x0,'rows':[]};var _0x23380a=_[_0x3cc2('0x2b')](db[_0x3cc2('0x2c')]['rawAttributes'],function(_0x733ef){return{'name':_0x733ef[_0x3cc2('0x2d')],'type':_0x733ef[_0x3cc2('0x2e')][_0x3cc2('0x2f')]};});_0x7a6933[_0x3cc2('0x30')]=_[_0x3cc2('0x2b')](_0x23380a,_0x3cc2('0x29'));_0x7a6933[_0x3cc2('0x31')]=_[_0x3cc2('0x32')](_0x127910[_0x3cc2('0x31')]);_0x7a6933[_0x3cc2('0x33')]=_['intersection'](_0x7a6933['model'],_0x7a6933['query']);_0x128e16[_0x3cc2('0x34')]=_[_0x3cc2('0x35')](_0x7a6933[_0x3cc2('0x30')],qs[_0x3cc2('0x36')](_0x127910['query']['fields']));_0x128e16[_0x3cc2('0x34')]=_0x128e16[_0x3cc2('0x34')][_0x3cc2('0x37')]?_0x128e16[_0x3cc2('0x34')]:_0x7a6933['model'];if(!_0x127910[_0x3cc2('0x31')][_0x3cc2('0x38')](_0x3cc2('0x39'))){_0x128e16[_0x3cc2('0x1f')]=qs['limit'](_0x127910[_0x3cc2('0x31')][_0x3cc2('0x1f')]);_0x128e16[_0x3cc2('0x1d')]=qs[_0x3cc2('0x1d')](_0x127910['query']['offset']);}_0x128e16[_0x3cc2('0x3a')]=qs[_0x3cc2('0x3b')](_0x127910[_0x3cc2('0x31')][_0x3cc2('0x3b')]);_0x128e16[_0x3cc2('0x3c')]=qs[_0x3cc2('0x33')](_[_0x3cc2('0x3d')](_0x127910[_0x3cc2('0x31')],_0x7a6933[_0x3cc2('0x33')]),_0x23380a);if(_0x127910['query'][_0x3cc2('0x3e')]){_0x128e16['where']=_[_0x3cc2('0x3f')](_0x128e16[_0x3cc2('0x3c')],{'$or':_['map'](_0x23380a,function(_0x6d7a43){if(_0x6d7a43['type']!==_0x3cc2('0x40')){var _0xb4714f={};_0xb4714f[_0x6d7a43[_0x3cc2('0x29')]]={'$like':'%'+_0x127910[_0x3cc2('0x31')][_0x3cc2('0x3e')]+'%'};return _0xb4714f;}})});}_0x128e16=_['merge']({},_0x128e16,_0x127910[_0x3cc2('0x41')]);var _0x59e388={'where':_0x128e16[_0x3cc2('0x3c')]};return db[_0x3cc2('0x2c')]['count'](_0x59e388)[_0x3cc2('0x25')](function(_0x18eb14){_0x35d106[_0x3cc2('0x1e')]=_0x18eb14;if(_0x127910[_0x3cc2('0x31')][_0x3cc2('0x42')]){_0x128e16[_0x3cc2('0x43')]=[{'all':!![]}];}return db[_0x3cc2('0x2c')][_0x3cc2('0x44')](_0x128e16);})[_0x3cc2('0x25')](function(_0x241cac){_0x35d106[_0x3cc2('0x45')]=_0x241cac;return _0x35d106;})['then'](respondWithFilteredResult(_0x52ca28,_0x128e16))[_0x3cc2('0x46')](handleError(_0x52ca28,null));};exports[_0x3cc2('0x47')]=function(_0x2d4919,_0x53291b){var _0x1dddba={'raw':!![],'where':{'id':_0x2d4919[_0x3cc2('0x48')]['id']}},_0x410c44={};_0x410c44['model']=_[_0x3cc2('0x32')](db[_0x3cc2('0x2c')][_0x3cc2('0x49')]);_0x410c44[_0x3cc2('0x31')]=_[_0x3cc2('0x32')](_0x2d4919['query']);_0x410c44['filters']=_[_0x3cc2('0x35')](_0x410c44[_0x3cc2('0x30')],_0x410c44[_0x3cc2('0x31')]);_0x1dddba['attributes']=_[_0x3cc2('0x35')](_0x410c44['model'],qs['fields'](_0x2d4919['query']['fields']));_0x1dddba['attributes']=_0x1dddba[_0x3cc2('0x34')][_0x3cc2('0x37')]?_0x1dddba[_0x3cc2('0x34')]:_0x410c44[_0x3cc2('0x30')];if(_0x2d4919['query'][_0x3cc2('0x42')]){_0x1dddba[_0x3cc2('0x43')]=[{'all':!![]}];}_0x1dddba=_[_0x3cc2('0x3f')]({},_0x1dddba,_0x2d4919[_0x3cc2('0x41')]);return db['MailServerOut']['find'](_0x1dddba)[_0x3cc2('0x25')](handleEntityNotFound(_0x53291b,null))[_0x3cc2('0x25')](respondWithResult(_0x53291b,null))[_0x3cc2('0x46')](handleError(_0x53291b,null));};exports[_0x3cc2('0x4a')]=function(_0x366552,_0x29277a){return db[_0x3cc2('0x2c')][_0x3cc2('0x4a')](_0x366552[_0x3cc2('0x4b')],{})['then'](respondWithResult(_0x29277a,0xc9))[_0x3cc2('0x46')](handleError(_0x29277a,null));};exports[_0x3cc2('0x4c')]=function(_0x52063c,_0xd96b93){if(_0x52063c[_0x3cc2('0x4b')]['id']){delete _0x52063c[_0x3cc2('0x4b')]['id'];}return db[_0x3cc2('0x2c')]['find']({'where':{'id':_0x52063c['params']['id']}})[_0x3cc2('0x25')](handleEntityNotFound(_0xd96b93,null))[_0x3cc2('0x25')](saveUpdates(_0x52063c[_0x3cc2('0x4b')],null))[_0x3cc2('0x25')](respondWithResult(_0xd96b93,null))[_0x3cc2('0x46')](handleError(_0xd96b93,null));};exports[_0x3cc2('0x26')]=function(_0x594c78,_0x4fe8db){return db['MailServerOut']['find']({'where':{'id':_0x594c78[_0x3cc2('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fe8db,null))[_0x3cc2('0x25')](removeEntity(_0x4fe8db,null))[_0x3cc2('0x46')](handleError(_0x4fe8db,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 7411f09..94bb72e 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 _0x065d=['api','moment','bluebird','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x065d,0x13e));var _0xd065=function(_0x537421,_0x215f2e){_0x537421=_0x537421-0x0;var _0x4522de=_0x065d[_0x537421];return _0x4522de;};'use strict';var _=require(_0xd065('0x0'));var util=require('util');var logger=require(_0xd065('0x1'))(_0xd065('0x2'));var moment=require(_0xd065('0x3'));var BPromise=require(_0xd065('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd065('0x5'));var attributes=require(_0xd065('0x6'));module[_0xd065('0x7')]=function(_0x292da8,_0x103748){return _0x292da8[_0xd065('0x8')]('MailServerOut',attributes,{'tableName':_0xd065('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14db=['bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x14db,0x1d5));var _0xb14d=function(_0x595389,_0x23c02e){_0x595389=_0x595389-0x0;var _0x372d02=_0x14db[_0x595389];return _0x372d02;};'use strict';var _=require(_0xb14d('0x0'));var util=require(_0xb14d('0x1'));var logger=require(_0xb14d('0x2'))(_0xb14d('0x3'));var moment=require('moment');var BPromise=require(_0xb14d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb14d('0x5'));var rimraf=require('rimraf');var config=require(_0xb14d('0x6'));var attributes=require(_0xb14d('0x7'));module[_0xb14d('0x8')]=function(_0x3734c4,_0xfe0ba5){return _0x3734c4[_0xb14d('0x9')]('MailServerOut',attributes,{'tableName':_0xb14d('0xa'),'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 2d7a1f1..c42cbcf 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x13d5bc,_0x1fd024){var _0x419695=function(_0x3f1c06){while(--_0x3f1c06){_0x13d5bc['push'](_0x13d5bc['shift']());}};_0x419695(++_0x1fd024);}(_0x1261,0x144));var _0x1126=function(_0x5f5c34,_0x23e89){_0x5f5c34=_0x5f5c34-0x0;var _0x48c0a7=_0x1261[_0x5f5c34];return _0x48c0a7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x28d673,_0x489832){_0x28d673=_0x28d673-0x0;var _0x982321=_0x7a54[_0x28d673];return _0x982321;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f5e168b..eeccecf 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 _0x553e=['post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4f51dd,_0x575e71){var _0x28cb57=function(_0x2df597){while(--_0x2df597){_0x4f51dd['push'](_0x4f51dd['shift']());}};_0x28cb57(++_0x575e71);}(_0x553e,0x16b));var _0xe553=function(_0x180e80,_0x555ae1){_0x180e80=_0x180e80-0x0;var _0x836a3e=_0x553e[_0x180e80];return _0x836a3e;};'use strict';var multer=require('multer');var util=require(_0xe553('0x0'));var path=require(_0xe553('0x1'));var timeout=require(_0xe553('0x2'));var express=require(_0xe553('0x3'));var router=express[_0xe553('0x4')]();var fs_extra=require(_0xe553('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe553('0x6'));var config=require(_0xe553('0x7'));var controller=require('./mailSubstatus.controller');router[_0xe553('0x8')]('/',auth[_0xe553('0x9')](),controller[_0xe553('0xa')]);router['get'](_0xe553('0xb'),auth[_0xe553('0x9')](),controller[_0xe553('0xc')]);router[_0xe553('0x8')](_0xe553('0xd'),auth[_0xe553('0x9')](),controller[_0xe553('0xe')]);router[_0xe553('0xf')]('/',auth[_0xe553('0x9')](),controller[_0xe553('0x10')]);router['put']('/:id',auth[_0xe553('0x9')](),controller[_0xe553('0x11')]);router[_0xe553('0x12')](_0xe553('0xd'),auth[_0xe553('0x9')](),controller[_0xe553('0x13')]);module[_0xe553('0x14')]=router; \ No newline at end of file +var _0x83c1=['create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x149aeb,_0x48893c){var _0x88583b=function(_0x3e3e26){while(--_0x3e3e26){_0x149aeb['push'](_0x149aeb['shift']());}};_0x88583b(++_0x48893c);}(_0x83c1,0xa4));var _0x183c=function(_0xe7f3f7,_0x4c7c3c){_0xe7f3f7=_0xe7f3f7-0x0;var _0x526e64=_0x83c1[_0xe7f3f7];return _0x526e64;};'use strict';var multer=require(_0x183c('0x0'));var util=require(_0x183c('0x1'));var path=require('path');var timeout=require(_0x183c('0x2'));var express=require(_0x183c('0x3'));var router=express[_0x183c('0x4')]();var fs_extra=require(_0x183c('0x5'));var auth=require(_0x183c('0x6'));var interaction=require(_0x183c('0x7'));var config=require('../../config/environment');var controller=require(_0x183c('0x8'));router[_0x183c('0x9')]('/',auth['isAuthenticated'](),controller[_0x183c('0xa')]);router[_0x183c('0x9')](_0x183c('0xb'),auth['isAuthenticated'](),controller[_0x183c('0xc')]);router[_0x183c('0x9')](_0x183c('0xd'),auth[_0x183c('0xe')](),controller[_0x183c('0xf')]);router['post']('/',auth[_0x183c('0xe')](),controller[_0x183c('0x10')]);router[_0x183c('0x11')](_0x183c('0xd'),auth[_0x183c('0xe')](),controller['update']);router[_0x183c('0x12')](_0x183c('0xd'),auth[_0x183c('0xe')](),controller['destroy']);module[_0x183c('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 55d0f20..5dec161 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 _0x8d0a=['STRING','name','sequelize'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x8d0a,0x65));var _0xa8d0=function(_0x31b0f3,_0x1b8b9b){_0x31b0f3=_0x31b0f3-0x0;var _0x50fe39=_0x8d0a[_0x31b0f3];return _0x50fe39;};'use strict';var Sequelize=require(_0xa8d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa8d0('0x1')],'unique':_0xa8d0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa8d0('0x1')]}}; \ No newline at end of file +var _0x7278=['name','sequelize','exports','STRING'];(function(_0x3c7a73,_0x3cd0f5){var _0xd0e2b6=function(_0x5df90d){while(--_0x5df90d){_0x3c7a73['push'](_0x3c7a73['shift']());}};_0xd0e2b6(++_0x3cd0f5);}(_0x7278,0x161));var _0x8727=function(_0x462069,_0x4f11a8){_0x462069=_0x462069-0x0;var _0x26bf39=_0x7278[_0x462069];return _0x26bf39;};'use strict';var Sequelize=require(_0x8727('0x0'));module[_0x8727('0x1')]={'name':{'type':Sequelize[_0x8727('0x2')],'unique':_0x8727('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8727('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 08c6151..9740e17 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 _0x5d81=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','show','params','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x1c55f1,_0x3669ca){var _0x44dd27=function(_0x531d3e){while(--_0x531d3e){_0x1c55f1['push'](_0x1c55f1['shift']());}};_0x44dd27(++_0x3669ca);}(_0x5d81,0xd3));var _0x15d8=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x5d81[_0x486f4a];return _0x135d99;};'use strict';var emlformat=require(_0x15d8('0x0'));var rimraf=require(_0x15d8('0x1'));var zipdir=require(_0x15d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d8('0x3'));var moment=require('moment');var BPromise=require(_0x15d8('0x4'));var Mustache=require(_0x15d8('0x5'));var util=require(_0x15d8('0x6'));var path=require(_0x15d8('0x7'));var sox=require(_0x15d8('0x8'));var csv=require(_0x15d8('0x9'));var ejs=require(_0x15d8('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(_0x15d8('0xb'));var deskjs=require(_0x15d8('0xc'));var toCsv=require(_0x15d8('0x9'));var querystring=require('querystring');var Papa=require(_0x15d8('0xd'));var Redis=require(_0x15d8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x15d8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d8('0x10'));var logger=require(_0x15d8('0x11'))(_0x15d8('0x12'));var utils=require(_0x15d8('0x13'));var config=require(_0x15d8('0x14'));var licenseUtil=require(_0x15d8('0x15'));var db=require(_0x15d8('0x16'))['db'];function respondWithStatusCode(_0x23d784,_0x51ff36){_0x51ff36=_0x51ff36||0xcc;return function(_0x5189c9){if(_0x5189c9){return _0x23d784[_0x15d8('0x17')](_0x51ff36);}return _0x23d784[_0x15d8('0x18')](_0x51ff36)[_0x15d8('0x19')]();};}function respondWithResult(_0x1ca120,_0x4aa692){_0x4aa692=_0x4aa692||0xc8;return function(_0x4695f5){if(_0x4695f5){return _0x1ca120[_0x15d8('0x18')](_0x4aa692)[_0x15d8('0x1a')](_0x4695f5);}};}function respondWithFilteredResult(_0x32cdbd,_0x12c405){return function(_0x3a6d98){if(_0x3a6d98){var _0x24ec0c=typeof _0x12c405[_0x15d8('0x1b')]===_0x15d8('0x1c')&&typeof _0x12c405[_0x15d8('0x1d')]==='undefined';var _0x39b0c5=_0x3a6d98[_0x15d8('0x1e')];var _0x47e538=_0x24ec0c?0x0:_0x12c405[_0x15d8('0x1b')];var _0x19b1e1=_0x24ec0c?_0x3a6d98['count']:_0x12c405['offset']+_0x12c405['limit'];var _0x20ca44;if(_0x19b1e1>=_0x39b0c5){_0x19b1e1=_0x39b0c5;_0x20ca44=0xc8;}else{_0x20ca44=0xce;}_0x32cdbd[_0x15d8('0x18')](_0x20ca44);return _0x32cdbd[_0x15d8('0x1f')](_0x15d8('0x20'),_0x47e538+'-'+_0x19b1e1+'/'+_0x39b0c5)['json'](_0x3a6d98);}return null;};}function patchUpdates(_0x1f5e8f){return function(_0x59ebb1){try{jsonpatch[_0x15d8('0x21')](_0x59ebb1,_0x1f5e8f,!![]);}catch(_0x3e7457){return BPromise[_0x15d8('0x22')](_0x3e7457);}return _0x59ebb1[_0x15d8('0x23')]();};}function saveUpdates(_0x1c50cc,_0x54067f){return function(_0x257794){if(_0x257794){return _0x257794[_0x15d8('0x24')](_0x1c50cc)[_0x15d8('0x25')](function(_0x541afe){return _0x541afe;});}return null;};}function removeEntity(_0xd8193d,_0x183d0f){return function(_0x60cc85){if(_0x60cc85){return _0x60cc85[_0x15d8('0x26')]()[_0x15d8('0x25')](function(){_0xd8193d[_0x15d8('0x18')](0xcc)[_0x15d8('0x19')]();});}};}function handleEntityNotFound(_0x309c60,_0x28f8d5){return function(_0x2fa8ab){if(!_0x2fa8ab){_0x309c60[_0x15d8('0x17')](0x194);}return _0x2fa8ab;};}function handleError(_0x5881ad,_0xf920b0){_0xf920b0=_0xf920b0||0x1f4;return function(_0x1478e8){logger['error'](_0x1478e8[_0x15d8('0x27')]);if(_0x1478e8[_0x15d8('0x28')]){delete _0x1478e8[_0x15d8('0x28')];}_0x5881ad[_0x15d8('0x18')](_0xf920b0)[_0x15d8('0x29')](_0x1478e8);};}exports[_0x15d8('0x2a')]=function(_0x3ae1bb,_0x3960a7){var _0x1fa027={},_0xfea1ea={},_0x19d305={'count':0x0,'rows':[]};var _0x578770=_['map'](db[_0x15d8('0x2b')][_0x15d8('0x2c')],function(_0x2be9d1){return{'name':_0x2be9d1[_0x15d8('0x2d')],'type':_0x2be9d1[_0x15d8('0x2e')]['key']};});_0xfea1ea[_0x15d8('0x2f')]=_['map'](_0x578770,'name');_0xfea1ea[_0x15d8('0x30')]=_[_0x15d8('0x31')](_0x3ae1bb[_0x15d8('0x30')]);_0xfea1ea[_0x15d8('0x32')]=_[_0x15d8('0x33')](_0xfea1ea[_0x15d8('0x2f')],_0xfea1ea[_0x15d8('0x30')]);_0x1fa027[_0x15d8('0x34')]=_[_0x15d8('0x33')](_0xfea1ea[_0x15d8('0x2f')],qs[_0x15d8('0x35')](_0x3ae1bb[_0x15d8('0x30')][_0x15d8('0x35')]));_0x1fa027[_0x15d8('0x34')]=_0x1fa027['attributes']['length']?_0x1fa027['attributes']:_0xfea1ea[_0x15d8('0x2f')];if(!_0x3ae1bb['query'][_0x15d8('0x36')](_0x15d8('0x37'))){_0x1fa027[_0x15d8('0x1d')]=qs[_0x15d8('0x1d')](_0x3ae1bb[_0x15d8('0x30')]['limit']);_0x1fa027['offset']=qs[_0x15d8('0x1b')](_0x3ae1bb[_0x15d8('0x30')]['offset']);}_0x1fa027[_0x15d8('0x38')]=qs[_0x15d8('0x39')](_0x3ae1bb[_0x15d8('0x30')][_0x15d8('0x39')]);_0x1fa027[_0x15d8('0x3a')]=qs[_0x15d8('0x32')](_[_0x15d8('0x3b')](_0x3ae1bb['query'],_0xfea1ea[_0x15d8('0x32')]),_0x578770);if(_0x3ae1bb['query'][_0x15d8('0x3c')]){_0x1fa027[_0x15d8('0x3a')]=_[_0x15d8('0x3d')](_0x1fa027['where'],{'$or':_[_0x15d8('0x3e')](_0x578770,function(_0xf1366d){if(_0xf1366d[_0x15d8('0x2e')]!==_0x15d8('0x3f')){var _0xb01e8a={};_0xb01e8a[_0xf1366d[_0x15d8('0x28')]]={'$like':'%'+_0x3ae1bb[_0x15d8('0x30')][_0x15d8('0x3c')]+'%'};return _0xb01e8a;}})});}_0x1fa027=_[_0x15d8('0x3d')]({},_0x1fa027,_0x3ae1bb[_0x15d8('0x40')]);var _0x23dde4={'where':_0x1fa027[_0x15d8('0x3a')]};return db[_0x15d8('0x2b')][_0x15d8('0x1e')](_0x23dde4)[_0x15d8('0x25')](function(_0x1c90e6){_0x19d305[_0x15d8('0x1e')]=_0x1c90e6;if(_0x3ae1bb[_0x15d8('0x30')]['includeAll']){_0x1fa027[_0x15d8('0x41')]=[{'all':!![]}];}return db[_0x15d8('0x2b')]['findAll'](_0x1fa027);})[_0x15d8('0x25')](function(_0xa88d19){_0x19d305[_0x15d8('0x42')]=_0xa88d19;return _0x19d305;})['then'](respondWithFilteredResult(_0x3960a7,_0x1fa027))['catch'](handleError(_0x3960a7,null));};exports[_0x15d8('0x43')]=function(_0x2c2fc4,_0x490813){var _0x13b902={'raw':!![],'where':{'id':_0x2c2fc4[_0x15d8('0x44')]['id']}},_0x583f00={};_0x583f00[_0x15d8('0x2f')]=_[_0x15d8('0x31')](db[_0x15d8('0x2b')][_0x15d8('0x2c')]);_0x583f00['query']=_[_0x15d8('0x31')](_0x2c2fc4[_0x15d8('0x30')]);_0x583f00[_0x15d8('0x32')]=_[_0x15d8('0x33')](_0x583f00[_0x15d8('0x2f')],_0x583f00[_0x15d8('0x30')]);_0x13b902[_0x15d8('0x34')]=_[_0x15d8('0x33')](_0x583f00[_0x15d8('0x2f')],qs[_0x15d8('0x35')](_0x2c2fc4[_0x15d8('0x30')][_0x15d8('0x35')]));_0x13b902[_0x15d8('0x34')]=_0x13b902[_0x15d8('0x34')][_0x15d8('0x45')]?_0x13b902[_0x15d8('0x34')]:_0x583f00['model'];if(_0x2c2fc4[_0x15d8('0x30')][_0x15d8('0x46')]){_0x13b902[_0x15d8('0x41')]=[{'all':!![]}];}_0x13b902=_['merge']({},_0x13b902,_0x2c2fc4['options']);return db[_0x15d8('0x2b')][_0x15d8('0x47')](_0x13b902)['then'](handleEntityNotFound(_0x490813,null))['then'](respondWithResult(_0x490813,null))[_0x15d8('0x48')](handleError(_0x490813,null));};exports[_0x15d8('0x49')]=function(_0x54ad20,_0x3eef7b){return db['MailSubstatus']['create'](_0x54ad20['body'],{})['then'](respondWithResult(_0x3eef7b,0xc9))[_0x15d8('0x48')](handleError(_0x3eef7b,null));};exports[_0x15d8('0x24')]=function(_0x51c868,_0x37603f){if(_0x51c868['body']['id']){delete _0x51c868[_0x15d8('0x4a')]['id'];}return db[_0x15d8('0x2b')][_0x15d8('0x47')]({'where':{'id':_0x51c868['params']['id']}})[_0x15d8('0x25')](handleEntityNotFound(_0x37603f,null))['then'](saveUpdates(_0x51c868[_0x15d8('0x4a')],null))['then'](respondWithResult(_0x37603f,null))[_0x15d8('0x48')](handleError(_0x37603f,null));};exports[_0x15d8('0x26')]=function(_0x4e9768,_0x491f5c){return db[_0x15d8('0x2b')]['find']({'where':{'id':_0x4e9768[_0x15d8('0x44')]['id']}})[_0x15d8('0x25')](handleEntityNotFound(_0x491f5c,null))[_0x15d8('0x25')](removeEntity(_0x491f5c,null))['catch'](handleError(_0x491f5c,null));};exports[_0x15d8('0x4b')]=function(_0x219dde,_0x35bf6a){return db[_0x15d8('0x2b')][_0x15d8('0x4b')]()[_0x15d8('0x25')](respondWithResult(_0x35bf6a,null))['catch'](handleError(_0x35bf6a,null));}; \ No newline at end of file +var _0x2641=['model','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','rows','show','params','rawAttributes','create','body','catch','destroy','describe','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','name','send','index','map','MailSubstatus','fieldName','type','key','keys','query','filters','intersection','attributes'];(function(_0x55d726,_0x3f25f0){var _0x2a463e=function(_0x39f745){while(--_0x39f745){_0x55d726['push'](_0x55d726['shift']());}};_0x2a463e(++_0x3f25f0);}(_0x2641,0x1a2));var _0x1264=function(_0x3d710e,_0x482838){_0x3d710e=_0x3d710e-0x0;var _0x7d1373=_0x2641[_0x3d710e];return _0x7d1373;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1264('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1264('0x1'));var moment=require(_0x1264('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1264('0x3'));var path=require('path');var sox=require(_0x1264('0x4'));var csv=require(_0x1264('0x5'));var ejs=require(_0x1264('0x6'));var fs=require('fs');var fs_extra=require(_0x1264('0x7'));var _=require('lodash');var squel=require(_0x1264('0x8'));var crypto=require(_0x1264('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1264('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1264('0xb'));var as=require(_0x1264('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1264('0xd'))(_0x1264('0xe'));var utils=require('../../config/utils');var config=require(_0x1264('0xf'));var licenseUtil=require(_0x1264('0x10'));var db=require(_0x1264('0x11'))['db'];function respondWithStatusCode(_0x2fcbed,_0x2985f4){_0x2985f4=_0x2985f4||0xcc;return function(_0x52917a){if(_0x52917a){return _0x2fcbed[_0x1264('0x12')](_0x2985f4);}return _0x2fcbed[_0x1264('0x13')](_0x2985f4)['end']();};}function respondWithResult(_0x33a301,_0x402d9c){_0x402d9c=_0x402d9c||0xc8;return function(_0x2bf9d6){if(_0x2bf9d6){return _0x33a301['status'](_0x402d9c)[_0x1264('0x14')](_0x2bf9d6);}};}function respondWithFilteredResult(_0x14ecaf,_0x91b3ad){return function(_0x1a2b65){if(_0x1a2b65){var _0x3eebcf=typeof _0x91b3ad[_0x1264('0x15')]===_0x1264('0x16')&&typeof _0x91b3ad[_0x1264('0x17')]===_0x1264('0x16');var _0x327afd=_0x1a2b65[_0x1264('0x18')];var _0x217510=_0x3eebcf?0x0:_0x91b3ad[_0x1264('0x15')];var _0xca05ed=_0x3eebcf?_0x1a2b65[_0x1264('0x18')]:_0x91b3ad[_0x1264('0x15')]+_0x91b3ad[_0x1264('0x17')];var _0x6abd6;if(_0xca05ed>=_0x327afd){_0xca05ed=_0x327afd;_0x6abd6=0xc8;}else{_0x6abd6=0xce;}_0x14ecaf[_0x1264('0x13')](_0x6abd6);return _0x14ecaf[_0x1264('0x19')](_0x1264('0x1a'),_0x217510+'-'+_0xca05ed+'/'+_0x327afd)[_0x1264('0x14')](_0x1a2b65);}return null;};}function patchUpdates(_0x1a66a4){return function(_0xcd611){try{jsonpatch[_0x1264('0x1b')](_0xcd611,_0x1a66a4,!![]);}catch(_0x49a03f){return BPromise['reject'](_0x49a03f);}return _0xcd611['save']();};}function saveUpdates(_0xce629d,_0x1a389e){return function(_0x1111e1){if(_0x1111e1){return _0x1111e1[_0x1264('0x1c')](_0xce629d)[_0x1264('0x1d')](function(_0x332c34){return _0x332c34;});}return null;};}function removeEntity(_0x26b8b1,_0x3ac7a0){return function(_0x1c6421){if(_0x1c6421){return _0x1c6421['destroy']()[_0x1264('0x1d')](function(){_0x26b8b1[_0x1264('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e8036,_0x90f87b){return function(_0xd089b1){if(!_0xd089b1){_0x2e8036[_0x1264('0x12')](0x194);}return _0xd089b1;};}function handleError(_0x231fcf,_0x5b07ad){_0x5b07ad=_0x5b07ad||0x1f4;return function(_0x3993c4){logger[_0x1264('0x1e')](_0x3993c4['stack']);if(_0x3993c4[_0x1264('0x1f')]){delete _0x3993c4[_0x1264('0x1f')];}_0x231fcf[_0x1264('0x13')](_0x5b07ad)[_0x1264('0x20')](_0x3993c4);};}exports[_0x1264('0x21')]=function(_0xa9b146,_0x52912b){var _0x42c6a7={},_0x2ae6e9={},_0x4c07c0={'count':0x0,'rows':[]};var _0x47645d=_[_0x1264('0x22')](db[_0x1264('0x23')]['rawAttributes'],function(_0x1b91b5){return{'name':_0x1b91b5[_0x1264('0x24')],'type':_0x1b91b5[_0x1264('0x25')][_0x1264('0x26')]};});_0x2ae6e9['model']=_[_0x1264('0x22')](_0x47645d,_0x1264('0x1f'));_0x2ae6e9['query']=_[_0x1264('0x27')](_0xa9b146[_0x1264('0x28')]);_0x2ae6e9[_0x1264('0x29')]=_[_0x1264('0x2a')](_0x2ae6e9['model'],_0x2ae6e9['query']);_0x42c6a7[_0x1264('0x2b')]=_[_0x1264('0x2a')](_0x2ae6e9[_0x1264('0x2c')],qs[_0x1264('0x2d')](_0xa9b146[_0x1264('0x28')][_0x1264('0x2d')]));_0x42c6a7[_0x1264('0x2b')]=_0x42c6a7[_0x1264('0x2b')][_0x1264('0x2e')]?_0x42c6a7['attributes']:_0x2ae6e9[_0x1264('0x2c')];if(!_0xa9b146[_0x1264('0x28')][_0x1264('0x2f')](_0x1264('0x30'))){_0x42c6a7[_0x1264('0x17')]=qs[_0x1264('0x17')](_0xa9b146[_0x1264('0x28')][_0x1264('0x17')]);_0x42c6a7['offset']=qs[_0x1264('0x15')](_0xa9b146[_0x1264('0x28')]['offset']);}_0x42c6a7['order']=qs['sort'](_0xa9b146[_0x1264('0x28')][_0x1264('0x31')]);_0x42c6a7['where']=qs[_0x1264('0x29')](_[_0x1264('0x32')](_0xa9b146[_0x1264('0x28')],_0x2ae6e9[_0x1264('0x29')]),_0x47645d);if(_0xa9b146[_0x1264('0x28')][_0x1264('0x33')]){_0x42c6a7[_0x1264('0x34')]=_[_0x1264('0x35')](_0x42c6a7[_0x1264('0x34')],{'$or':_[_0x1264('0x22')](_0x47645d,function(_0x233b77){if(_0x233b77[_0x1264('0x25')]!=='VIRTUAL'){var _0xe586d3={};_0xe586d3[_0x233b77[_0x1264('0x1f')]]={'$like':'%'+_0xa9b146[_0x1264('0x28')][_0x1264('0x33')]+'%'};return _0xe586d3;}})});}_0x42c6a7=_[_0x1264('0x35')]({},_0x42c6a7,_0xa9b146[_0x1264('0x36')]);var _0x2561af={'where':_0x42c6a7[_0x1264('0x34')]};return db[_0x1264('0x23')][_0x1264('0x18')](_0x2561af)[_0x1264('0x1d')](function(_0xbb957f){_0x4c07c0[_0x1264('0x18')]=_0xbb957f;if(_0xa9b146[_0x1264('0x28')][_0x1264('0x37')]){_0x42c6a7[_0x1264('0x38')]=[{'all':!![]}];}return db[_0x1264('0x23')]['findAll'](_0x42c6a7);})['then'](function(_0x30bd6a){_0x4c07c0[_0x1264('0x39')]=_0x30bd6a;return _0x4c07c0;})[_0x1264('0x1d')](respondWithFilteredResult(_0x52912b,_0x42c6a7))['catch'](handleError(_0x52912b,null));};exports[_0x1264('0x3a')]=function(_0x16e190,_0x4b9f3f){var _0x36b7fe={'raw':!![],'where':{'id':_0x16e190[_0x1264('0x3b')]['id']}},_0x3fdee0={};_0x3fdee0[_0x1264('0x2c')]=_['keys'](db[_0x1264('0x23')][_0x1264('0x3c')]);_0x3fdee0[_0x1264('0x28')]=_[_0x1264('0x27')](_0x16e190['query']);_0x3fdee0[_0x1264('0x29')]=_[_0x1264('0x2a')](_0x3fdee0[_0x1264('0x2c')],_0x3fdee0[_0x1264('0x28')]);_0x36b7fe[_0x1264('0x2b')]=_[_0x1264('0x2a')](_0x3fdee0[_0x1264('0x2c')],qs[_0x1264('0x2d')](_0x16e190['query'][_0x1264('0x2d')]));_0x36b7fe[_0x1264('0x2b')]=_0x36b7fe[_0x1264('0x2b')][_0x1264('0x2e')]?_0x36b7fe[_0x1264('0x2b')]:_0x3fdee0[_0x1264('0x2c')];if(_0x16e190['query'][_0x1264('0x37')]){_0x36b7fe['include']=[{'all':!![]}];}_0x36b7fe=_[_0x1264('0x35')]({},_0x36b7fe,_0x16e190['options']);return db['MailSubstatus']['find'](_0x36b7fe)['then'](handleEntityNotFound(_0x4b9f3f,null))[_0x1264('0x1d')](respondWithResult(_0x4b9f3f,null))['catch'](handleError(_0x4b9f3f,null));};exports['create']=function(_0x43d386,_0x3a8903){return db['MailSubstatus'][_0x1264('0x3d')](_0x43d386[_0x1264('0x3e')],{})[_0x1264('0x1d')](respondWithResult(_0x3a8903,0xc9))[_0x1264('0x3f')](handleError(_0x3a8903,null));};exports[_0x1264('0x1c')]=function(_0x27fb80,_0x440dba){if(_0x27fb80[_0x1264('0x3e')]['id']){delete _0x27fb80[_0x1264('0x3e')]['id'];}return db[_0x1264('0x23')]['find']({'where':{'id':_0x27fb80[_0x1264('0x3b')]['id']}})[_0x1264('0x1d')](handleEntityNotFound(_0x440dba,null))['then'](saveUpdates(_0x27fb80[_0x1264('0x3e')],null))['then'](respondWithResult(_0x440dba,null))['catch'](handleError(_0x440dba,null));};exports[_0x1264('0x40')]=function(_0x4ed78c,_0x5d494f){return db[_0x1264('0x23')]['find']({'where':{'id':_0x4ed78c[_0x1264('0x3b')]['id']}})[_0x1264('0x1d')](handleEntityNotFound(_0x5d494f,null))['then'](removeEntity(_0x5d494f,null))[_0x1264('0x3f')](handleError(_0x5d494f,null));};exports['describe']=function(_0x36a017,_0x52943d){return db[_0x1264('0x23')][_0x1264('0x41')]()[_0x1264('0x1d')](respondWithResult(_0x52943d,null))[_0x1264('0x3f')](handleError(_0x52943d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d2d2d3c..7be2437 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 _0x6bfd=['events','../../mysqldb','update','emit','hook'];(function(_0xa3bebd,_0x3d2fa4){var _0x1b4154=function(_0x29b668){while(--_0x29b668){_0xa3bebd['push'](_0xa3bebd['shift']());}};_0x1b4154(++_0x3d2fa4);}(_0x6bfd,0x64));var _0xd6bf=function(_0x42096f,_0x45ad21){_0x42096f=_0x42096f-0x0;var _0x404a12=_0x6bfd[_0x42096f];return _0x404a12;};'use strict';var EventEmitter=require(_0xd6bf('0x0'));var MailSubstatus=require(_0xd6bf('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xd6bf('0x2')};function emitEvent(_0x189930){return function(_0x4796be,_0x1fcadf,_0x39d1a3){MailSubstatusEvents[_0xd6bf('0x3')](_0x189930+':'+_0x4796be['id'],_0x4796be);MailSubstatusEvents[_0xd6bf('0x3')](_0x189930,_0x4796be);_0x39d1a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xd6bf('0x4')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0xc81c=['update','emit','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0x24a48c,_0x42844c){var _0x24bab6=function(_0x55f7f9){while(--_0x55f7f9){_0x24a48c['push'](_0x24a48c['shift']());}};_0x24bab6(++_0x42844c);}(_0xc81c,0x17c));var _0xcc81=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc81c[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xcc81('0x0'));var MailSubstatus=require(_0xcc81('0x1'))['db'][_0xcc81('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xcc81('0x3')](0x0);var events={'afterUpdate':_0xcc81('0x4')};function emitEvent(_0x46ff77){return function(_0x2917f7,_0x4c73b1,_0x489a4a){MailSubstatusEvents[_0xcc81('0x5')](_0x46ff77+':'+_0x2917f7['id'],_0x2917f7);MailSubstatusEvents[_0xcc81('0x5')](_0x46ff77,_0x2917f7);_0x489a4a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xcc81('0x6')](e,emitEvent(event));}}module[_0xcc81('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f89823e..9eee034 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 _0x3c16=['MailSubstatus','mail_substatuses','update','name','mailSubstatus','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0x536fd3,_0x4e7e84){var _0x2df190=function(_0x12edf5){while(--_0x12edf5){_0x536fd3['push'](_0x536fd3['shift']());}};_0x2df190(++_0x4e7e84);}(_0x3c16,0x1dc));var _0x63c1=function(_0x38c961,_0x5f2c2c){_0x38c961=_0x38c961-0x0;var _0x49b840=_0x3c16[_0x38c961];return _0x49b840;};'use strict';var attributes=require(_0x63c1('0x0'));module[_0x63c1('0x1')]=function(_0x540b29){var _0x1dc2e2=_0x540b29[_0x63c1('0x2')];return _0x540b29[_0x63c1('0x3')](_0x63c1('0x4'),attributes,{'tableName':_0x63c1('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3778a9,_0x45a8c9,_0x4aec1d){return _0x1dc2e2['Condition'][_0x63c1('0x6')]({'value':_0x3778a9[_0x63c1('0x7')]},{'where':{'field':_0x63c1('0x8'),'value':_0x3778a9['_previousDataValues'][_0x63c1('0x7')]}})['then'](function(){_0x4aec1d();})[_0x63c1('0x9')](function(_0x26c938){_0x4aec1d(_0x26c938);});}}});}; \ No newline at end of file +var _0x5dca=['MailSubstatus','Condition','update','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5dca,0x101));var _0xa5dc=function(_0x52aec0,_0xe1a1eb){_0x52aec0=_0x52aec0-0x0;var _0x423b14=_0x5dca[_0x52aec0];return _0x423b14;};'use strict';var attributes=require(_0xa5dc('0x0'));module[_0xa5dc('0x1')]=function(_0xa18cac){var _0x69db7f=_0xa18cac[_0xa5dc('0x2')];return _0xa18cac['define'](_0xa5dc('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5baa54,_0x1575e2,_0x52f068){return _0x69db7f[_0xa5dc('0x4')][_0xa5dc('0x5')]({'value':_0x5baa54['name']},{'where':{'field':_0xa5dc('0x6'),'value':_0x5baa54[_0xa5dc('0x7')]['name']}})[_0xa5dc('0x8')](function(){_0x52f068();})[_0xa5dc('0x9')](function(_0x2126c1){_0x52f068(_0x2126c1);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index b9030c3..ce06c97 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 _0x4c96=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','util','moment','bluebird','randomstring','ioredis'];(function(_0x249011,_0x4e05d2){var _0x474004=function(_0xf76ceb){while(--_0xf76ceb){_0x249011['push'](_0x249011['shift']());}};_0x474004(++_0x4e05d2);}(_0x4c96,0x10c));var _0x64c9=function(_0x3702fd,_0x133f1e){_0x3702fd=_0x3702fd-0x0;var _0x221f1f=_0x4c96[_0x3702fd];return _0x221f1f;};'use strict';var _=require('lodash');var util=require(_0x64c9('0x0'));var moment=require(_0x64c9('0x1'));var BPromise=require(_0x64c9('0x2'));var rs=require(_0x64c9('0x3'));var fs=require('fs');var Redis=require(_0x64c9('0x4'));var db=require(_0x64c9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x64c9('0x6'));var config=require(_0x64c9('0x7'));var jayson=require(_0x64c9('0x8'));var client=jayson[_0x64c9('0x9')][_0x64c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e466,_0x1f65f8,_0x395caa){return new BPromise(function(_0x51f1d2,_0x14c38e){return client[_0x64c9('0xb')](_0x45e466,_0x395caa)[_0x64c9('0xc')](function(_0x3b4574){logger[_0x64c9('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x1f65f8,_0x64c9('0xe'));logger['debug'](_0x64c9('0xf'),_0x1f65f8,_0x64c9('0xe'),JSON[_0x64c9('0x10')](_0x3b4574));if(_0x3b4574[_0x64c9('0x11')]){if(_0x3b4574[_0x64c9('0x11')][_0x64c9('0x12')]===0x1f4){logger[_0x64c9('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x1f65f8,_0x3b4574[_0x64c9('0x11')][_0x64c9('0x13')]);return _0x14c38e(_0x3b4574[_0x64c9('0x11')][_0x64c9('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x1f65f8,_0x3b4574[_0x64c9('0x11')][_0x64c9('0x13')]);return _0x51f1d2(_0x3b4574['error'][_0x64c9('0x13')]);}else{logger[_0x64c9('0xd')](_0x64c9('0x14'),_0x1f65f8,_0x64c9('0xe'));_0x51f1d2(_0x3b4574['result']['message']);}})['catch'](function(_0x35b172){logger[_0x64c9('0x11')](_0x64c9('0x14'),_0x1f65f8,_0x35b172);_0x14c38e(_0x35b172);});});} \ No newline at end of file +var _0x344a=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x344a,0xd0));var _0xa344=function(_0xa573a7,_0x43ec2d){_0xa573a7=_0xa573a7-0x0;var _0x23d29e=_0x344a[_0xa573a7];return _0x23d29e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa344('0x0'));var BPromise=require(_0xa344('0x1'));var rs=require(_0xa344('0x2'));var fs=require('fs');var Redis=require(_0xa344('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa344('0x4'))(_0xa344('0x5'));var config=require(_0xa344('0x6'));var jayson=require(_0xa344('0x7'));var client=jayson[_0xa344('0x8')][_0xa344('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37d211,_0x5871a8,_0x5e90a2){return new BPromise(function(_0x298d1a,_0x20fd49){return client['request'](_0x37d211,_0x5e90a2)[_0xa344('0xa')](function(_0x25fab5){logger['info'](_0xa344('0xb'),_0x5871a8,_0xa344('0xc'));logger['debug'](_0xa344('0xd'),_0x5871a8,_0xa344('0xc'),JSON[_0xa344('0xe')](_0x25fab5));if(_0x25fab5[_0xa344('0xf')]){if(_0x25fab5['error']['code']===0x1f4){logger[_0xa344('0xf')](_0xa344('0xb'),_0x5871a8,_0x25fab5[_0xa344('0xf')]['message']);return _0x20fd49(_0x25fab5[_0xa344('0xf')][_0xa344('0x10')]);}logger[_0xa344('0xf')](_0xa344('0xb'),_0x5871a8,_0x25fab5[_0xa344('0xf')]['message']);return _0x298d1a(_0x25fab5['error'][_0xa344('0x10')]);}else{logger[_0xa344('0x11')](_0xa344('0xb'),_0x5871a8,'request\x20sent');_0x298d1a(_0x25fab5[_0xa344('0x12')]['message']);}})[_0xa344('0x13')](function(_0xa028f2){logger[_0xa344('0xf')](_0xa344('0xb'),_0x5871a8,_0xa028f2);_0x20fd49(_0xa028f2);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 39eefcc..b69ba37 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 _0x37ad=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x37ad,0x187));var _0xd37a=function(_0x8d610d,_0x22e149){_0x8d610d=_0x8d610d-0x0;var _0x46418e=_0x37ad[_0x8d610d];return _0x46418e;};'use strict';var multer=require(_0xd37a('0x0'));var util=require('util');var path=require(_0xd37a('0x1'));var timeout=require(_0xd37a('0x2'));var express=require(_0xd37a('0x3'));var router=express['Router']();var fs_extra=require(_0xd37a('0x4'));var auth=require(_0xd37a('0x5'));var interaction=require(_0xd37a('0x6'));var config=require('../../config/environment');var controller=require(_0xd37a('0x7'));router[_0xd37a('0x8')]('/',auth[_0xd37a('0x9')](),controller[_0xd37a('0xa')]);router['get'](_0xd37a('0xb'),auth[_0xd37a('0x9')](),controller[_0xd37a('0xc')]);router['get'](_0xd37a('0xd'),auth[_0xd37a('0x9')](),controller[_0xd37a('0xe')]);router[_0xd37a('0xf')]('/',auth[_0xd37a('0x9')](),controller[_0xd37a('0x10')]);router[_0xd37a('0x11')](_0xd37a('0xd'),auth[_0xd37a('0x9')](),controller[_0xd37a('0x12')]);router[_0xd37a('0x13')](_0xd37a('0xd'),auth[_0xd37a('0x9')](),controller[_0xd37a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5ca7=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete','destroy'];(function(_0x3f1fbe,_0x105460){var _0x210fe5=function(_0x56a790){while(--_0x56a790){_0x3f1fbe['push'](_0x3f1fbe['shift']());}};_0x210fe5(++_0x105460);}(_0x5ca7,0xf3));var _0x75ca=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x5ca7[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x75ca('0x0'));var util=require(_0x75ca('0x1'));var path=require('path');var timeout=require(_0x75ca('0x2'));var express=require(_0x75ca('0x3'));var router=express[_0x75ca('0x4')]();var fs_extra=require(_0x75ca('0x5'));var auth=require(_0x75ca('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x75ca('0x7'));var controller=require(_0x75ca('0x8'));router[_0x75ca('0x9')]('/',auth[_0x75ca('0xa')](),controller['index']);router[_0x75ca('0x9')](_0x75ca('0xb'),auth[_0x75ca('0xa')](),controller[_0x75ca('0xc')]);router[_0x75ca('0x9')]('/:id',auth[_0x75ca('0xa')](),controller[_0x75ca('0xd')]);router[_0x75ca('0xe')]('/',auth[_0x75ca('0xa')](),controller[_0x75ca('0xf')]);router[_0x75ca('0x10')](_0x75ca('0x11'),auth['isAuthenticated'](),controller[_0x75ca('0x12')]);router[_0x75ca('0x13')](_0x75ca('0x11'),auth[_0x75ca('0xa')](),controller[_0x75ca('0x14')]);module[_0x75ca('0x15')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 788a834..616f5c8 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x530c78,_0x3e9345){var _0x155f17=function(_0x3141ce){while(--_0x3141ce){_0x530c78['push'](_0x530c78['shift']());}};_0x155f17(++_0x3e9345);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0xf3cd[_0xb24fad];return _0x173226;};'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(_0x1c5189,_0x532702){var _0x3caaab=function(_0x3a8c16){while(--_0x3a8c16){_0x1c5189['push'](_0x1c5189['shift']());}};_0x3caaab(++_0x532702);}(_0xf4eb,0xec));var _0xbf4e=function(_0x459a62,_0x5f5c95){_0x459a62=_0x459a62-0x0;var _0x23e451=_0xf4eb[_0x459a62];return _0x23e451;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0b7d809..6fb1da2 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 _0x0058=['to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x0058,0x160));var _0x8005=function(_0x4817c9,_0x530a89){_0x4817c9=_0x4817c9-0x0;var _0x3fce2e=_0x0058[_0x4817c9];return _0x3fce2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8005('0x0'));var zipdir=require(_0x8005('0x1'));var jsonpatch=require(_0x8005('0x2'));var rp=require(_0x8005('0x3'));var moment=require(_0x8005('0x4'));var BPromise=require(_0x8005('0x5'));var Mustache=require(_0x8005('0x6'));var util=require(_0x8005('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x8005('0x8'));var ejs=require(_0x8005('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8005('0xa'));var squel=require('squel');var crypto=require(_0x8005('0xb'));var jsforce=require(_0x8005('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8005('0xd'));var Redis=require(_0x8005('0xe'));var authService=require(_0x8005('0xf'));var qs=require(_0x8005('0x10'));var as=require(_0x8005('0x11'));var hardwareService=require(_0x8005('0x12'));var logger=require('../../config/logger')(_0x8005('0x13'));var utils=require(_0x8005('0x14'));var config=require(_0x8005('0x15'));var licenseUtil=require(_0x8005('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560741,_0x2dfbb1){_0x2dfbb1=_0x2dfbb1||0xcc;return function(_0x153828){if(_0x153828){return _0x560741['sendStatus'](_0x2dfbb1);}return _0x560741[_0x8005('0x17')](_0x2dfbb1)[_0x8005('0x18')]();};}function respondWithResult(_0x345002,_0x294342){_0x294342=_0x294342||0xc8;return function(_0x4d396c){if(_0x4d396c){return _0x345002['status'](_0x294342)[_0x8005('0x19')](_0x4d396c);}};}function respondWithFilteredResult(_0x203577,_0x5b2df2){return function(_0x59b396){if(_0x59b396){var _0x40169d=typeof _0x5b2df2[_0x8005('0x1a')]===_0x8005('0x1b')&&typeof _0x5b2df2[_0x8005('0x1c')]==='undefined';var _0xe9b97f=_0x59b396[_0x8005('0x1d')];var _0x342e5b=_0x40169d?0x0:_0x5b2df2['offset'];var _0x375806=_0x40169d?_0x59b396['count']:_0x5b2df2[_0x8005('0x1a')]+_0x5b2df2[_0x8005('0x1c')];var _0x1ad1b0;if(_0x375806>=_0xe9b97f){_0x375806=_0xe9b97f;_0x1ad1b0=0xc8;}else{_0x1ad1b0=0xce;}_0x203577[_0x8005('0x17')](_0x1ad1b0);return _0x203577[_0x8005('0x1e')](_0x8005('0x1f'),_0x342e5b+'-'+_0x375806+'/'+_0xe9b97f)[_0x8005('0x19')](_0x59b396);}return null;};}function patchUpdates(_0x2a4ad6){return function(_0x409ee7){try{jsonpatch['apply'](_0x409ee7,_0x2a4ad6,!![]);}catch(_0x499407){return BPromise[_0x8005('0x20')](_0x499407);}return _0x409ee7[_0x8005('0x21')]();};}function saveUpdates(_0x713915,_0x1bfd55){return function(_0xa10cf7){if(_0xa10cf7){return _0xa10cf7['update'](_0x713915)[_0x8005('0x22')](function(_0x34ab08){return _0x34ab08;});}return null;};}function removeEntity(_0x11da55,_0x20872e){return function(_0x43fd95){if(_0x43fd95){return _0x43fd95[_0x8005('0x23')]()[_0x8005('0x22')](function(){_0x11da55[_0x8005('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x146bda,_0x3e2f4c){return function(_0x2c28da){if(!_0x2c28da){_0x146bda[_0x8005('0x24')](0x194);}return _0x2c28da;};}function handleError(_0x4c58e7,_0x19ca68){_0x19ca68=_0x19ca68||0x1f4;return function(_0x2f3a29){logger['error'](_0x2f3a29[_0x8005('0x25')]);if(_0x2f3a29[_0x8005('0x26')]){delete _0x2f3a29[_0x8005('0x26')];}_0x4c58e7[_0x8005('0x17')](_0x19ca68)[_0x8005('0x27')](_0x2f3a29);};}exports[_0x8005('0x28')]=function(_0x21cd31,_0x4f641e){var _0x4f5ea4={},_0x4059cb={},_0x219ee4={'count':0x0,'rows':[]};var _0x21ed8c=_[_0x8005('0x29')](db['MailTransferReport'][_0x8005('0x2a')],function(_0x15585d){return{'name':_0x15585d['fieldName'],'type':_0x15585d[_0x8005('0x2b')]['key']};});_0x4059cb['model']=_['map'](_0x21ed8c,_0x8005('0x26'));_0x4059cb[_0x8005('0x2c')]=_[_0x8005('0x2d')](_0x21cd31[_0x8005('0x2c')]);_0x4059cb[_0x8005('0x2e')]=_[_0x8005('0x2f')](_0x4059cb[_0x8005('0x30')],_0x4059cb[_0x8005('0x2c')]);_0x4f5ea4[_0x8005('0x31')]=_[_0x8005('0x2f')](_0x4059cb[_0x8005('0x30')],qs[_0x8005('0x32')](_0x21cd31[_0x8005('0x2c')][_0x8005('0x32')]));_0x4f5ea4['attributes']=_0x4f5ea4[_0x8005('0x31')][_0x8005('0x33')]?_0x4f5ea4[_0x8005('0x31')]:_0x4059cb[_0x8005('0x30')];if(!_0x21cd31[_0x8005('0x2c')][_0x8005('0x34')](_0x8005('0x35'))){_0x4f5ea4[_0x8005('0x1c')]=qs[_0x8005('0x1c')](_0x21cd31['query']['limit']);_0x4f5ea4[_0x8005('0x1a')]=qs[_0x8005('0x1a')](_0x21cd31[_0x8005('0x2c')]['offset']);}_0x4f5ea4[_0x8005('0x36')]=qs[_0x8005('0x37')](_0x21cd31[_0x8005('0x2c')]['sort']);_0x4f5ea4[_0x8005('0x38')]=qs[_0x8005('0x2e')](_[_0x8005('0x39')](_0x21cd31[_0x8005('0x2c')],_0x4059cb[_0x8005('0x2e')]),_0x21ed8c);if(_0x21cd31['query']['filter']){_0x4f5ea4[_0x8005('0x38')]=_[_0x8005('0x3a')](_0x4f5ea4[_0x8005('0x38')],{'$or':_[_0x8005('0x29')](_0x21ed8c,function(_0x3caf00){if(_0x3caf00['type']!==_0x8005('0x3b')){var _0x26988f={};_0x26988f[_0x3caf00[_0x8005('0x26')]]={'$like':'%'+_0x21cd31[_0x8005('0x2c')]['filter']+'%'};return _0x26988f;}})});}_0x4f5ea4=_[_0x8005('0x3a')]({},_0x4f5ea4,_0x21cd31[_0x8005('0x3c')]);var _0x4c5d9d={'where':_0x4f5ea4[_0x8005('0x38')]};return db['MailTransferReport'][_0x8005('0x1d')](_0x4c5d9d)[_0x8005('0x22')](function(_0x5bf394){_0x219ee4['count']=_0x5bf394;if(_0x21cd31[_0x8005('0x2c')][_0x8005('0x3d')]){_0x4f5ea4[_0x8005('0x3e')]=[{'all':!![]}];}return db[_0x8005('0x3f')][_0x8005('0x40')](_0x4f5ea4);})['then'](function(_0x1097f3){_0x219ee4[_0x8005('0x41')]=_0x1097f3;return _0x219ee4;})[_0x8005('0x22')](respondWithFilteredResult(_0x4f641e,_0x4f5ea4))['catch'](handleError(_0x4f641e,null));};exports['show']=function(_0x707f80,_0x4734df){var _0x2b8ac9={'raw':!![],'where':{'id':_0x707f80[_0x8005('0x42')]['id']}},_0x38366b={};_0x38366b['model']=_['keys'](db[_0x8005('0x3f')][_0x8005('0x2a')]);_0x38366b[_0x8005('0x2c')]=_[_0x8005('0x2d')](_0x707f80['query']);_0x38366b[_0x8005('0x2e')]=_[_0x8005('0x2f')](_0x38366b[_0x8005('0x30')],_0x38366b['query']);_0x2b8ac9[_0x8005('0x31')]=_[_0x8005('0x2f')](_0x38366b['model'],qs[_0x8005('0x32')](_0x707f80[_0x8005('0x2c')][_0x8005('0x32')]));_0x2b8ac9['attributes']=_0x2b8ac9[_0x8005('0x31')]['length']?_0x2b8ac9[_0x8005('0x31')]:_0x38366b[_0x8005('0x30')];if(_0x707f80[_0x8005('0x2c')][_0x8005('0x3d')]){_0x2b8ac9[_0x8005('0x3e')]=[{'all':!![]}];}_0x2b8ac9=_[_0x8005('0x3a')]({},_0x2b8ac9,_0x707f80[_0x8005('0x3c')]);return db[_0x8005('0x3f')][_0x8005('0x43')](_0x2b8ac9)[_0x8005('0x22')](handleEntityNotFound(_0x4734df,null))['then'](respondWithResult(_0x4734df,null))[_0x8005('0x44')](handleError(_0x4734df,null));};exports[_0x8005('0x45')]=function(_0x447102,_0x3cd891){return db[_0x8005('0x3f')]['create'](_0x447102['body'],{})[_0x8005('0x22')](respondWithResult(_0x3cd891,0xc9))[_0x8005('0x44')](handleError(_0x3cd891,null));};exports['update']=function(_0x327f7c,_0xf4a1c7){if(_0x327f7c[_0x8005('0x46')]['id']){delete _0x327f7c['body']['id'];}return db['MailTransferReport'][_0x8005('0x43')]({'where':{'id':_0x327f7c[_0x8005('0x42')]['id']}})[_0x8005('0x22')](handleEntityNotFound(_0xf4a1c7,null))[_0x8005('0x22')](saveUpdates(_0x327f7c[_0x8005('0x46')],null))[_0x8005('0x22')](respondWithResult(_0xf4a1c7,null))[_0x8005('0x44')](handleError(_0xf4a1c7,null));};exports['destroy']=function(_0x34aebe,_0x158b25){return db[_0x8005('0x3f')]['find']({'where':{'id':_0x34aebe[_0x8005('0x42')]['id']}})[_0x8005('0x22')](handleEntityNotFound(_0x158b25,null))[_0x8005('0x22')](removeEntity(_0x158b25,null))['catch'](handleError(_0x158b25,null));};exports['describe']=function(_0x48bdaa,_0x413913){return db['MailTransferReport'][_0x8005('0x47')]()[_0x8005('0x22')](respondWithResult(_0x413913,null))[_0x8005('0x44')](handleError(_0x413913,null));}; \ No newline at end of file +var _0x4983=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','MailTransferReport','includeAll','include','rows','show','params','length','catch','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment'];(function(_0x5584cb,_0x5b4f35){var _0x36f3f5=function(_0x54b2bc){while(--_0x54b2bc){_0x5584cb['push'](_0x5584cb['shift']());}};_0x36f3f5(++_0x5b4f35);}(_0x4983,0x153));var _0x3498=function(_0x2b4a74,_0x491088){_0x2b4a74=_0x2b4a74-0x0;var _0x4a6f44=_0x4983[_0x2b4a74];return _0x4a6f44;};'use strict';var emlformat=require(_0x3498('0x0'));var rimraf=require(_0x3498('0x1'));var zipdir=require(_0x3498('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3498('0x3'));var BPromise=require(_0x3498('0x4'));var Mustache=require(_0x3498('0x5'));var util=require(_0x3498('0x6'));var path=require(_0x3498('0x7'));var sox=require(_0x3498('0x8'));var csv=require(_0x3498('0x9'));var ejs=require(_0x3498('0xa'));var fs=require('fs');var fs_extra=require(_0x3498('0xb'));var _=require(_0x3498('0xc'));var squel=require(_0x3498('0xd'));var crypto=require('crypto');var jsforce=require(_0x3498('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3498('0x9'));var querystring=require('querystring');var Papa=require(_0x3498('0xf'));var Redis=require(_0x3498('0x10'));var authService=require(_0x3498('0x11'));var qs=require(_0x3498('0x12'));var as=require(_0x3498('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3498('0x14'));var licenseUtil=require(_0x3498('0x15'));var db=require(_0x3498('0x16'))['db'];function respondWithStatusCode(_0x26d323,_0x17233e){_0x17233e=_0x17233e||0xcc;return function(_0x4cea59){if(_0x4cea59){return _0x26d323[_0x3498('0x17')](_0x17233e);}return _0x26d323['status'](_0x17233e)[_0x3498('0x18')]();};}function respondWithResult(_0x2fe5f0,_0x1a7d7d){_0x1a7d7d=_0x1a7d7d||0xc8;return function(_0x28e72e){if(_0x28e72e){return _0x2fe5f0[_0x3498('0x19')](_0x1a7d7d)[_0x3498('0x1a')](_0x28e72e);}};}function respondWithFilteredResult(_0x430674,_0x3839c1){return function(_0x316fb4){if(_0x316fb4){var _0x479414=typeof _0x3839c1['offset']==='undefined'&&typeof _0x3839c1[_0x3498('0x1b')]==='undefined';var _0x4c9c60=_0x316fb4[_0x3498('0x1c')];var _0x252204=_0x479414?0x0:_0x3839c1['offset'];var _0x44710b=_0x479414?_0x316fb4[_0x3498('0x1c')]:_0x3839c1[_0x3498('0x1d')]+_0x3839c1[_0x3498('0x1b')];var _0x3d1d01;if(_0x44710b>=_0x4c9c60){_0x44710b=_0x4c9c60;_0x3d1d01=0xc8;}else{_0x3d1d01=0xce;}_0x430674[_0x3498('0x19')](_0x3d1d01);return _0x430674[_0x3498('0x1e')](_0x3498('0x1f'),_0x252204+'-'+_0x44710b+'/'+_0x4c9c60)[_0x3498('0x1a')](_0x316fb4);}return null;};}function patchUpdates(_0x1a1353){return function(_0x449ce0){try{jsonpatch[_0x3498('0x20')](_0x449ce0,_0x1a1353,!![]);}catch(_0x33b70b){return BPromise[_0x3498('0x21')](_0x33b70b);}return _0x449ce0[_0x3498('0x22')]();};}function saveUpdates(_0x465f29,_0x341808){return function(_0x207795){if(_0x207795){return _0x207795[_0x3498('0x23')](_0x465f29)[_0x3498('0x24')](function(_0x29c7ee){return _0x29c7ee;});}return null;};}function removeEntity(_0x22703c,_0x105d96){return function(_0x3463b1){if(_0x3463b1){return _0x3463b1[_0x3498('0x25')]()[_0x3498('0x24')](function(){_0x22703c[_0x3498('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513b66,_0x46a6ef){return function(_0x3ccdd7){if(!_0x3ccdd7){_0x513b66['sendStatus'](0x194);}return _0x3ccdd7;};}function handleError(_0x4da76d,_0x49ddec){_0x49ddec=_0x49ddec||0x1f4;return function(_0x51a1e4){logger['error'](_0x51a1e4['stack']);if(_0x51a1e4[_0x3498('0x26')]){delete _0x51a1e4[_0x3498('0x26')];}_0x4da76d[_0x3498('0x19')](_0x49ddec)[_0x3498('0x27')](_0x51a1e4);};}exports['index']=function(_0x21523a,_0x4d6be4){var _0x2c93c8={},_0x3ded3c={},_0x372fb2={'count':0x0,'rows':[]};var _0x4b7c7a=_['map'](db['MailTransferReport'][_0x3498('0x28')],function(_0x52131d){return{'name':_0x52131d[_0x3498('0x29')],'type':_0x52131d[_0x3498('0x2a')][_0x3498('0x2b')]};});_0x3ded3c[_0x3498('0x2c')]=_[_0x3498('0x2d')](_0x4b7c7a,'name');_0x3ded3c[_0x3498('0x2e')]=_[_0x3498('0x2f')](_0x21523a['query']);_0x3ded3c['filters']=_[_0x3498('0x30')](_0x3ded3c[_0x3498('0x2c')],_0x3ded3c[_0x3498('0x2e')]);_0x2c93c8[_0x3498('0x31')]=_[_0x3498('0x30')](_0x3ded3c[_0x3498('0x2c')],qs[_0x3498('0x32')](_0x21523a[_0x3498('0x2e')]['fields']));_0x2c93c8['attributes']=_0x2c93c8['attributes']['length']?_0x2c93c8[_0x3498('0x31')]:_0x3ded3c['model'];if(!_0x21523a[_0x3498('0x2e')][_0x3498('0x33')](_0x3498('0x34'))){_0x2c93c8[_0x3498('0x1b')]=qs['limit'](_0x21523a[_0x3498('0x2e')][_0x3498('0x1b')]);_0x2c93c8[_0x3498('0x1d')]=qs[_0x3498('0x1d')](_0x21523a[_0x3498('0x2e')][_0x3498('0x1d')]);}_0x2c93c8['order']=qs[_0x3498('0x35')](_0x21523a['query'][_0x3498('0x35')]);_0x2c93c8['where']=qs['filters'](_[_0x3498('0x36')](_0x21523a[_0x3498('0x2e')],_0x3ded3c[_0x3498('0x37')]),_0x4b7c7a);if(_0x21523a[_0x3498('0x2e')][_0x3498('0x38')]){_0x2c93c8[_0x3498('0x39')]=_['merge'](_0x2c93c8[_0x3498('0x39')],{'$or':_[_0x3498('0x2d')](_0x4b7c7a,function(_0x2ec0bf){if(_0x2ec0bf[_0x3498('0x2a')]!=='VIRTUAL'){var _0x5179e8={};_0x5179e8[_0x2ec0bf['name']]={'$like':'%'+_0x21523a[_0x3498('0x2e')][_0x3498('0x38')]+'%'};return _0x5179e8;}})});}_0x2c93c8=_[_0x3498('0x3a')]({},_0x2c93c8,_0x21523a[_0x3498('0x3b')]);var _0x1dd331={'where':_0x2c93c8[_0x3498('0x39')]};return db[_0x3498('0x3c')][_0x3498('0x1c')](_0x1dd331)[_0x3498('0x24')](function(_0x8776db){_0x372fb2['count']=_0x8776db;if(_0x21523a[_0x3498('0x2e')][_0x3498('0x3d')]){_0x2c93c8[_0x3498('0x3e')]=[{'all':!![]}];}return db[_0x3498('0x3c')]['findAll'](_0x2c93c8);})[_0x3498('0x24')](function(_0x356332){_0x372fb2[_0x3498('0x3f')]=_0x356332;return _0x372fb2;})[_0x3498('0x24')](respondWithFilteredResult(_0x4d6be4,_0x2c93c8))['catch'](handleError(_0x4d6be4,null));};exports[_0x3498('0x40')]=function(_0x5f2cad,_0x5e458c){var _0x5effe4={'raw':!![],'where':{'id':_0x5f2cad[_0x3498('0x41')]['id']}},_0x49474c={};_0x49474c[_0x3498('0x2c')]=_[_0x3498('0x2f')](db[_0x3498('0x3c')]['rawAttributes']);_0x49474c[_0x3498('0x2e')]=_['keys'](_0x5f2cad[_0x3498('0x2e')]);_0x49474c['filters']=_[_0x3498('0x30')](_0x49474c['model'],_0x49474c[_0x3498('0x2e')]);_0x5effe4[_0x3498('0x31')]=_['intersection'](_0x49474c[_0x3498('0x2c')],qs['fields'](_0x5f2cad[_0x3498('0x2e')]['fields']));_0x5effe4[_0x3498('0x31')]=_0x5effe4[_0x3498('0x31')][_0x3498('0x42')]?_0x5effe4[_0x3498('0x31')]:_0x49474c[_0x3498('0x2c')];if(_0x5f2cad[_0x3498('0x2e')]['includeAll']){_0x5effe4['include']=[{'all':!![]}];}_0x5effe4=_[_0x3498('0x3a')]({},_0x5effe4,_0x5f2cad[_0x3498('0x3b')]);return db[_0x3498('0x3c')]['find'](_0x5effe4)[_0x3498('0x24')](handleEntityNotFound(_0x5e458c,null))[_0x3498('0x24')](respondWithResult(_0x5e458c,null))[_0x3498('0x43')](handleError(_0x5e458c,null));};exports['create']=function(_0x562014,_0x3d59cd){return db[_0x3498('0x3c')][_0x3498('0x44')](_0x562014['body'],{})[_0x3498('0x24')](respondWithResult(_0x3d59cd,0xc9))['catch'](handleError(_0x3d59cd,null));};exports[_0x3498('0x23')]=function(_0x14685c,_0x20e2d4){if(_0x14685c[_0x3498('0x45')]['id']){delete _0x14685c['body']['id'];}return db[_0x3498('0x3c')][_0x3498('0x46')]({'where':{'id':_0x14685c[_0x3498('0x41')]['id']}})[_0x3498('0x24')](handleEntityNotFound(_0x20e2d4,null))[_0x3498('0x24')](saveUpdates(_0x14685c[_0x3498('0x45')],null))[_0x3498('0x24')](respondWithResult(_0x20e2d4,null))['catch'](handleError(_0x20e2d4,null));};exports[_0x3498('0x25')]=function(_0x2d9693,_0x125e8e){return db[_0x3498('0x3c')][_0x3498('0x46')]({'where':{'id':_0x2d9693[_0x3498('0x41')]['id']}})[_0x3498('0x24')](handleEntityNotFound(_0x125e8e,null))['then'](removeEntity(_0x125e8e,null))[_0x3498('0x43')](handleError(_0x125e8e,null));};exports['describe']=function(_0x407aa7,_0x1f1555){return db['MailTransferReport'][_0x3498('0x47')]()[_0x3498('0x24')](respondWithResult(_0x1f1555,null))['catch'](handleError(_0x1f1555,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 667381f..41077e8 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 _0xadf0=['../../config/environment','define','MailTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xe2ff2,_0x32951c){var _0x4d8980=function(_0x5927f5){while(--_0x5927f5){_0xe2ff2['push'](_0xe2ff2['shift']());}};_0x4d8980(++_0x32951c);}(_0xadf0,0x12d));var _0x0adf=function(_0x32ee43,_0x19c33b){_0x32ee43=_0x32ee43-0x0;var _0x54a9ea=_0xadf0[_0x32ee43];return _0x54a9ea;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var logger=require(_0x0adf('0x1'))(_0x0adf('0x2'));var moment=require(_0x0adf('0x3'));var BPromise=require(_0x0adf('0x4'));var rp=require(_0x0adf('0x5'));var fs=require('fs');var path=require(_0x0adf('0x6'));var rimraf=require('rimraf');var config=require(_0x0adf('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x5b01b9,_0x516b05){return _0x5b01b9[_0x0adf('0x8')](_0x0adf('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0adf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x22f6=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x22f6,0x10e));var _0x622f=function(_0x3efe7a,_0x30aba7){_0x3efe7a=_0x3efe7a-0x0;var _0x121ad6=_0x22f6[_0x3efe7a];return _0x121ad6;};'use strict';var _=require(_0x622f('0x0'));var util=require('util');var logger=require(_0x622f('0x1'))('api');var moment=require(_0x622f('0x2'));var BPromise=require(_0x622f('0x3'));var rp=require(_0x622f('0x4'));var fs=require('fs');var path=require(_0x622f('0x5'));var rimraf=require(_0x622f('0x6'));var config=require(_0x622f('0x7'));var attributes=require(_0x622f('0x8'));module[_0x622f('0x9')]=function(_0x659c64,_0x342d96){return _0x659c64['define'](_0x622f('0xa'),attributes,{'tableName':_0x622f('0xb'),'paranoid':![],'indexes':[{'name':_0x622f('0xc'),'fields':[_0x622f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4185b38..2b2d977 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 _0x5dad=['http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5dad,0x160));var _0xd5da=function(_0x4ff4e4,_0x51d615){_0x4ff4e4=_0x4ff4e4-0x0;var _0x64f777=_0x5dad[_0x4ff4e4];return _0x64f777;};'use strict';var _=require(_0xd5da('0x0'));var util=require(_0xd5da('0x1'));var moment=require('moment');var BPromise=require(_0xd5da('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5da('0x3'))['db'];var utils=require(_0xd5da('0x4'));var logger=require('../../config/logger')(_0xd5da('0x5'));var config=require(_0xd5da('0x6'));var jayson=require(_0xd5da('0x7'));var client=jayson['client'][_0xd5da('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3654ac,_0x87dfa4,_0xbc6a6f){return new BPromise(function(_0x8ccb59,_0x58cea0){return client[_0xd5da('0x9')](_0x3654ac,_0xbc6a6f)[_0xd5da('0xa')](function(_0x1304e6){logger[_0xd5da('0xb')](_0xd5da('0xc'),_0x87dfa4,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x87dfa4,_0xd5da('0xd'),JSON[_0xd5da('0xe')](_0x1304e6));if(_0x1304e6[_0xd5da('0xf')]){if(_0x1304e6[_0xd5da('0xf')][_0xd5da('0x10')]===0x1f4){logger[_0xd5da('0xf')](_0xd5da('0xc'),_0x87dfa4,_0x1304e6[_0xd5da('0xf')][_0xd5da('0x11')]);return _0x58cea0(_0x1304e6[_0xd5da('0xf')][_0xd5da('0x11')]);}logger[_0xd5da('0xf')](_0xd5da('0xc'),_0x87dfa4,_0x1304e6[_0xd5da('0xf')][_0xd5da('0x11')]);return _0x8ccb59(_0x1304e6[_0xd5da('0xf')][_0xd5da('0x11')]);}else{logger[_0xd5da('0xb')](_0xd5da('0xc'),_0x87dfa4,_0xd5da('0xd'));_0x8ccb59(_0x1304e6[_0xd5da('0x12')][_0xd5da('0x11')]);}})[_0xd5da('0x13')](function(_0x4b9e01){logger[_0xd5da('0xf')](_0xd5da('0xc'),_0x87dfa4,_0x4b9e01);_0x58cea0(_0x4b9e01);});});} \ No newline at end of file +var _0x414a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','error','code','MailTransferReport,\x20%s,\x20%s','message','catch','lodash'];(function(_0x4009fe,_0x28c869){var _0x3a73a1=function(_0xfe3a59){while(--_0xfe3a59){_0x4009fe['push'](_0x4009fe['shift']());}};_0x3a73a1(++_0x28c869);}(_0x414a,0x1e2));var _0xa414=function(_0x55aa15,_0x203620){_0x55aa15=_0x55aa15-0x0;var _0x3d7314=_0x414a[_0x55aa15];return _0x3d7314;};'use strict';var _=require(_0xa414('0x0'));var util=require(_0xa414('0x1'));var moment=require('moment');var BPromise=require(_0xa414('0x2'));var rs=require(_0xa414('0x3'));var fs=require('fs');var Redis=require(_0xa414('0x4'));var db=require(_0xa414('0x5'))['db'];var utils=require(_0xa414('0x6'));var logger=require(_0xa414('0x7'))(_0xa414('0x8'));var config=require(_0xa414('0x9'));var jayson=require(_0xa414('0xa'));var client=jayson['client'][_0xa414('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8827,_0x24d088,_0x39630a){return new BPromise(function(_0x3e70e7,_0x16eff0){return client['request'](_0x3b8827,_0x39630a)[_0xa414('0xc')](function(_0x284eda){logger[_0xa414('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x24d088,_0xa414('0xe'));logger[_0xa414('0xf')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x24d088,_0xa414('0xe'),JSON['stringify'](_0x284eda));if(_0x284eda['error']){if(_0x284eda[_0xa414('0x10')][_0xa414('0x11')]===0x1f4){logger[_0xa414('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x24d088,_0x284eda['error']['message']);return _0x16eff0(_0x284eda[_0xa414('0x10')]['message']);}logger[_0xa414('0x10')](_0xa414('0x12'),_0x24d088,_0x284eda['error'][_0xa414('0x13')]);return _0x3e70e7(_0x284eda[_0xa414('0x10')][_0xa414('0x13')]);}else{logger[_0xa414('0xd')](_0xa414('0x12'),_0x24d088,_0xa414('0xe'));_0x3e70e7(_0x284eda['result']['message']);}})[_0xa414('0x14')](function(_0x4f1d54){logger[_0xa414('0x10')]('MailTransferReport,\x20%s,\x20%s',_0x24d088,_0x4f1d54);_0x16eff0(_0x4f1d54);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 9ccf84c..85dcd63 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 _0x064b=['express','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x147656,_0x205a15){var _0x37e1e9=function(_0xea78b){while(--_0xea78b){_0x147656['push'](_0x147656['shift']());}};_0x37e1e9(++_0x205a15);}(_0x064b,0xa8));var _0xb064=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x064b[_0x2deac4];return _0x1c0bda;};'use strict';var multer=require(_0xb064('0x0'));var util=require('util');var path=require(_0xb064('0x1'));var timeout=require(_0xb064('0x2'));var express=require(_0xb064('0x3'));var router=express['Router']();var fs_extra=require(_0xb064('0x4'));var auth=require(_0xb064('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb064('0x6'));var controller=require(_0xb064('0x7'));router[_0xb064('0x8')]('/',auth['isAuthenticated'](),controller[_0xb064('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xb064('0xa')]);router[_0xb064('0x8')](_0xb064('0xb'),auth[_0xb064('0xc')](),controller[_0xb064('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb064('0xe')]);router[_0xb064('0xf')]('/:id',auth[_0xb064('0xc')](),controller[_0xb064('0x10')]);router[_0xb064('0x11')]('/:id',auth[_0xb064('0xc')](),controller[_0xb064('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7e1f=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete'];(function(_0x377b8d,_0x3e14fb){var _0x2f467a=function(_0x549e73){while(--_0x549e73){_0x377b8d['push'](_0x377b8d['shift']());}};_0x2f467a(++_0x3e14fb);}(_0x7e1f,0x156));var _0xf7e1=function(_0x2ce4d9,_0x47173f){_0x2ce4d9=_0x2ce4d9-0x0;var _0x3a802c=_0x7e1f[_0x2ce4d9];return _0x3a802c;};'use strict';var multer=require(_0xf7e1('0x0'));var util=require(_0xf7e1('0x1'));var path=require(_0xf7e1('0x2'));var timeout=require(_0xf7e1('0x3'));var express=require('express');var router=express[_0xf7e1('0x4')]();var fs_extra=require(_0xf7e1('0x5'));var auth=require(_0xf7e1('0x6'));var interaction=require(_0xf7e1('0x7'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xf7e1('0x8')]('/',auth[_0xf7e1('0x9')](),controller['index']);router['get'](_0xf7e1('0xa'),auth[_0xf7e1('0x9')](),controller[_0xf7e1('0xb')]);router[_0xf7e1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf7e1('0xc')]);router[_0xf7e1('0xd')]('/',auth[_0xf7e1('0x9')](),controller[_0xf7e1('0xe')]);router['put'](_0xf7e1('0xf'),auth[_0xf7e1('0x9')](),controller[_0xf7e1('0x10')]);router[_0xf7e1('0x11')](_0xf7e1('0xf'),auth['isAuthenticated'](),controller[_0xf7e1('0x12')]);module[_0xf7e1('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index cdfbe3e..44bcdba 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 _0x3556=['exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x3556,0xfb));var _0x6355=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x3556[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x6355('0x0'));var moment=require('moment');module[_0x6355('0x1')]={'channel':{'type':Sequelize[_0x6355('0x2')]},'membername':{'type':Sequelize[_0x6355('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x6355('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x6355('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6355('0x5')],'set':function(_0x315946){var _0x581d4e=moment(_0x315946);var _0x203461=moment(this[_0x6355('0x6')]('enterAt'));var _0x341387=_0x581d4e['diff'](_0x203461,_0x6355('0x7'));this[_0x6355('0x8')]('exitAt',_0x315946);this[_0x6355('0x8')](_0x6355('0x9'),_0x341387>=0x0?_0x341387:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x6355('0xa')},'data2':{'type':Sequelize[_0x6355('0x2')],'comment':_0x6355('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0x6355('0xc')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x6355('0x2')],'comment':_0x6355('0xd')},'role':{'type':Sequelize[_0x6355('0x2')]},'internal':{'type':Sequelize[_0x6355('0x4')]},'uniqueid':{'type':Sequelize[_0x6355('0x2')]}}; \ No newline at end of file +var _0x3c39=['enterAt','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x3c39,0x1a7));var _0x93c3=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x3c39[_0x1bc013];return _0x55df36;};'use strict';var Sequelize=require(_0x93c3('0x0'));var moment=require(_0x93c3('0x1'));module[_0x93c3('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x93c3('0x3')]},'interface':{'type':Sequelize[_0x93c3('0x3')]},'type':{'type':Sequelize[_0x93c3('0x3')],'defaultValue':_0x93c3('0x4'),'comment':_0x93c3('0x5')},'duration':{'type':Sequelize[_0x93c3('0x6')]},'enterAt':{'type':Sequelize[_0x93c3('0x7')]},'exitAt':{'type':Sequelize[_0x93c3('0x7')],'set':function(_0x307852){var _0x21ce82=moment(_0x307852);var _0x26a9a0=moment(this[_0x93c3('0x8')](_0x93c3('0x9')));var _0x2898ef=_0x21ce82['diff'](_0x26a9a0,'seconds');this[_0x93c3('0xa')](_0x93c3('0xb'),_0x307852);this[_0x93c3('0xa')](_0x93c3('0xc'),_0x2898ef>=0x0?_0x2898ef:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x93c3('0x3')],'comment':_0x93c3('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x93c3('0xe')},'data4':{'type':Sequelize[_0x93c3('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x93c3('0x3')],'comment':_0x93c3('0xf')},'role':{'type':Sequelize[_0x93c3('0x3')]},'internal':{'type':Sequelize[_0x93c3('0x6')]},'uniqueid':{'type':Sequelize[_0x93c3('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 0f5b07a..34c8446 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x14f54a,_0x42536b){var _0x122b3a=function(_0x420d13){while(--_0x420d13){_0x14f54a['push'](_0x14f54a['shift']());}};_0x122b3a(++_0x42536b);}(_0x008c,0x188));var _0xc008=function(_0x15a099,_0x4eb0c1){_0x15a099=_0x15a099-0x0;var _0x8f248c=_0x008c[_0x15a099];return _0x8f248c;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xedd9,0xfc));var _0x9edd=function(_0x19df30,_0x59a15e){_0x19df30=_0x19df30-0x0;var _0x5ae3ca=_0xedd9[_0x19df30];return _0x5ae3ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 37002ba..27db29d 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 _0xd7ca=['api','moment','bluebird','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash','util','../../config/logger'];(function(_0xacbcdf,_0x22acb3){var _0x43cb24=function(_0x585962){while(--_0x585962){_0xacbcdf['push'](_0xacbcdf['shift']());}};_0x43cb24(++_0x22acb3);}(_0xd7ca,0xfd));var _0xad7c=function(_0x40efb8,_0x2a2080){_0x40efb8=_0x40efb8-0x0;var _0x5468d3=_0xd7ca[_0x40efb8];return _0x5468d3;};'use strict';var _=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var logger=require(_0xad7c('0x2'))(_0xad7c('0x3'));var moment=require(_0xad7c('0x4'));var BPromise=require(_0xad7c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad7c('0x6'));var rimraf=require(_0xad7c('0x7'));var config=require(_0xad7c('0x8'));var attributes=require(_0xad7c('0x9'));module[_0xad7c('0xa')]=function(_0xb0ce8b,_0x25b263){return _0xb0ce8b[_0xad7c('0xb')](_0xad7c('0xc'),attributes,{'tableName':_0xad7c('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xad7c('0xe'),_0xad7c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1059=['moment','bluebird','path','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername','interface','lodash','util','api'];(function(_0x33b627,_0xcd64e0){var _0x531df0=function(_0x46db94){while(--_0x46db94){_0x33b627['push'](_0x33b627['shift']());}};_0x531df0(++_0xcd64e0);}(_0x1059,0x176));var _0x9105=function(_0x3980d7,_0x15692a){_0x3980d7=_0x3980d7-0x0;var _0xa47c89=_0x1059[_0x3980d7];return _0xa47c89;};'use strict';var _=require(_0x9105('0x0'));var util=require(_0x9105('0x1'));var logger=require('../../config/logger')(_0x9105('0x2'));var moment=require(_0x9105('0x3'));var BPromise=require(_0x9105('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9105('0x5'));var rimraf=require('rimraf');var config=require(_0x9105('0x6'));var attributes=require(_0x9105('0x7'));module['exports']=function(_0x3a0f94,_0x4c573d){return _0x3a0f94[_0x9105('0x8')](_0x9105('0x9'),attributes,{'tableName':_0x9105('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x9105('0xb'),_0x9105('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 6445d07..2b2cfd2 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 _0x4cff=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','MemberReport','options','raw','attributes','limit','include','map','model','GetMemberReport','CreateMemberReport','create','body','update','UpdateMemberReport','lodash','util','bluebird'];(function(_0x3a49ed,_0x5942c0){var _0xfc681=function(_0x11d26b){while(--_0x11d26b){_0x3a49ed['push'](_0x3a49ed['shift']());}};_0xfc681(++_0x5942c0);}(_0x4cff,0x14a));var _0xf4cf=function(_0x408ded,_0x1b2d82){_0x408ded=_0x408ded-0x0;var _0x5c4e78=_0x4cff[_0x408ded];return _0x5c4e78;};'use strict';var _=require(_0xf4cf('0x0'));var util=require(_0xf4cf('0x1'));var moment=require('moment');var BPromise=require(_0xf4cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4cf('0x3'));var db=require(_0xf4cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cf('0x5'))(_0xf4cf('0x6'));var config=require(_0xf4cf('0x7'));var jayson=require(_0xf4cf('0x8'));var client=jayson[_0xf4cf('0x9')][_0xf4cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a3e6,_0x25d0cf,_0x125a37){return new BPromise(function(_0x1f06c6,_0x3882b2){return client['request'](_0x53a3e6,_0x125a37)[_0xf4cf('0xb')](function(_0x36b238){logger[_0xf4cf('0xc')](_0xf4cf('0xd'),_0x25d0cf,'request\x20sent');logger[_0xf4cf('0xe')](_0xf4cf('0xf'),_0x25d0cf,_0xf4cf('0x10'),JSON[_0xf4cf('0x11')](_0x36b238));if(_0x36b238['error']){if(_0x36b238['error'][_0xf4cf('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0x36b238['error'][_0xf4cf('0x13')]);return _0x3882b2(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);return _0x1f06c6(_0x36b238[_0xf4cf('0x14')][_0xf4cf('0x13')]);}else{logger[_0xf4cf('0xc')]('MemberReport,\x20%s,\x20%s',_0x25d0cf,_0xf4cf('0x10'));_0x1f06c6(_0x36b238[_0xf4cf('0x15')][_0xf4cf('0x13')]);}})[_0xf4cf('0x16')](function(_0x5260aa){logger[_0xf4cf('0x14')](_0xf4cf('0xd'),_0x25d0cf,_0x5260aa);_0x3882b2(_0x5260aa);});});}exports['GetMemberReport']=function(_0x3999e7){var _0x2aa048=this;return new Promise(function(_0x329347,_0x5469e2){return db[_0xf4cf('0x17')]['findAll']({'raw':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'where':_0x3999e7['options']?_0x3999e7['options']['where']||null:null,'attributes':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1a')]||null:null,'limit':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1b')]||null:null,'include':_0x3999e7[_0xf4cf('0x18')]?_0x3999e7['options'][_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x3999e7[_0xf4cf('0x18')][_0xf4cf('0x1c')],function(_0xba64fe){return{'model':db[_0xba64fe[_0xf4cf('0x1e')]],'as':_0xba64fe['as'],'attributes':_0xba64fe['attributes'],'include':_0xba64fe[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0xba64fe['include'],function(_0x1d26b0){return{'model':db[_0x1d26b0['model']],'as':_0x1d26b0['as'],'attributes':_0x1d26b0['attributes'],'include':_0x1d26b0[_0xf4cf('0x1c')]?_[_0xf4cf('0x1d')](_0x1d26b0['include'],function(_0x230a18){return{'model':db[_0x230a18['model']],'as':_0x230a18['as'],'attributes':_0x230a18[_0xf4cf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf4cf('0xb')](function(_0x97e3e4){logger['info']('GetMemberReport',_0x3999e7);logger[_0xf4cf('0xe')](_0xf4cf('0x1f'),_0x3999e7,JSON[_0xf4cf('0x11')](_0x97e3e4));_0x329347(_0x97e3e4);})[_0xf4cf('0x16')](function(_0x164ee8){logger[_0xf4cf('0x14')](_0xf4cf('0x1f'),_0x164ee8['message'],_0x3999e7);_0x5469e2(_0x2aa048[_0xf4cf('0x14')](0x1f4,_0x164ee8[_0xf4cf('0x13')]));});});};exports[_0xf4cf('0x20')]=function(_0x471a0f){var _0x33b5c2=this;return new Promise(function(_0x47de20,_0x5d1dc0){return db[_0xf4cf('0x17')][_0xf4cf('0x21')](_0x471a0f[_0xf4cf('0x22')],{'raw':_0x471a0f[_0xf4cf('0x18')]?_0x471a0f[_0xf4cf('0x18')][_0xf4cf('0x19')]===undefined?!![]:![]:!![]})[_0xf4cf('0xb')](function(_0xe3524d){logger[_0xf4cf('0xc')]('CreateMemberReport',_0x471a0f);logger['debug'](_0xf4cf('0x20'),_0x471a0f,JSON[_0xf4cf('0x11')](_0xe3524d));_0x47de20(_0xe3524d);})[_0xf4cf('0x16')](function(_0x23ca65){logger[_0xf4cf('0x14')]('CreateMemberReport',_0x23ca65[_0xf4cf('0x13')],_0x471a0f);_0x5d1dc0(_0x33b5c2['error'](0x1f4,_0x23ca65[_0xf4cf('0x13')]));});});};exports['UpdateMemberReport']=function(_0x2ef5fe){var _0x22de0d=this;return new Promise(function(_0x28b524,_0x4590ec){return db['MemberReport'][_0xf4cf('0x23')](_0x2ef5fe['body'],{'raw':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options'][_0xf4cf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe['options']['where']||null:null,'attributes':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['attributes']||null:null,'limit':_0x2ef5fe[_0xf4cf('0x18')]?_0x2ef5fe[_0xf4cf('0x18')]['limit']||null:null})['then'](function(_0x33fe63){logger['info'](_0xf4cf('0x24'),_0x2ef5fe);logger[_0xf4cf('0xe')](_0xf4cf('0x24'),_0x2ef5fe,JSON[_0xf4cf('0x11')](_0x33fe63));_0x28b524(_0x33fe63);})[_0xf4cf('0x16')](function(_0xbf80dc){logger[_0xf4cf('0x14')](_0xf4cf('0x24'),_0xbf80dc[_0xf4cf('0x13')],_0x2ef5fe);_0x4590ec(_0x22de0d[_0xf4cf('0x14')](0x1f4,_0xbf80dc[_0xf4cf('0x13')]));});});}; \ No newline at end of file +var _0x7dfd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetMemberReport','findAll','options','where','attributes','limit','include','map','model','info','CreateMemberReport','create','body','raw','MemberReport','update','UpdateMemberReport','lodash'];(function(_0x42445c,_0x270af9){var _0x584642=function(_0x4f4514){while(--_0x4f4514){_0x42445c['push'](_0x42445c['shift']());}};_0x584642(++_0x270af9);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x354ea7,_0x16e50,_0x2c48a4){return new BPromise(function(_0x5c220a,_0xab6742){return client[_0xd7df('0xe')](_0x354ea7,_0x2c48a4)[_0xd7df('0xf')](function(_0x3dee59){logger['info'](_0xd7df('0x10'),_0x16e50,'request\x20sent');logger[_0xd7df('0x11')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x16e50,_0xd7df('0x12'),JSON[_0xd7df('0x13')](_0x3dee59));if(_0x3dee59[_0xd7df('0x14')]){if(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x15')]===0x1f4){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0xab6742(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);return _0x5c220a(_0x3dee59[_0xd7df('0x14')][_0xd7df('0x16')]);}else{logger['info'](_0xd7df('0x10'),_0x16e50,_0xd7df('0x12'));_0x5c220a(_0x3dee59['result'][_0xd7df('0x16')]);}})[_0xd7df('0x17')](function(_0x5d3beb){logger[_0xd7df('0x14')](_0xd7df('0x10'),_0x16e50,_0x5d3beb);_0xab6742(_0x5d3beb);});});}exports[_0xd7df('0x18')]=function(_0x5210e5){var _0x40167d=this;return new Promise(function(_0x471621,_0x3cea3){return db['MemberReport'][_0xd7df('0x19')]({'raw':_0x5210e5[_0xd7df('0x1a')]?_0x5210e5[_0xd7df('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5210e5[_0xd7df('0x1a')]?_0x5210e5['options'][_0xd7df('0x1b')]||null:null,'attributes':_0x5210e5['options']?_0x5210e5[_0xd7df('0x1a')][_0xd7df('0x1c')]||null:null,'limit':_0x5210e5[_0xd7df('0x1a')]?_0x5210e5['options'][_0xd7df('0x1d')]||null:null,'include':_0x5210e5['options']?_0x5210e5[_0xd7df('0x1a')][_0xd7df('0x1e')]?_[_0xd7df('0x1f')](_0x5210e5[_0xd7df('0x1a')][_0xd7df('0x1e')],function(_0xa80cbf){return{'model':db[_0xa80cbf[_0xd7df('0x20')]],'as':_0xa80cbf['as'],'attributes':_0xa80cbf['attributes'],'include':_0xa80cbf['include']?_[_0xd7df('0x1f')](_0xa80cbf[_0xd7df('0x1e')],function(_0x26047f){return{'model':db[_0x26047f[_0xd7df('0x20')]],'as':_0x26047f['as'],'attributes':_0x26047f[_0xd7df('0x1c')],'include':_0x26047f[_0xd7df('0x1e')]?_[_0xd7df('0x1f')](_0x26047f[_0xd7df('0x1e')],function(_0x163904){return{'model':db[_0x163904['model']],'as':_0x163904['as'],'attributes':_0x163904[_0xd7df('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd7df('0xf')](function(_0x46c0db){logger[_0xd7df('0x21')](_0xd7df('0x18'),_0x5210e5);logger[_0xd7df('0x11')](_0xd7df('0x18'),_0x5210e5,JSON[_0xd7df('0x13')](_0x46c0db));_0x471621(_0x46c0db);})['catch'](function(_0x4ba779){logger['error']('GetMemberReport',_0x4ba779['message'],_0x5210e5);_0x3cea3(_0x40167d[_0xd7df('0x14')](0x1f4,_0x4ba779['message']));});});};exports[_0xd7df('0x22')]=function(_0x156612){var _0x503a90=this;return new Promise(function(_0x3ef553,_0x2887db){return db['MemberReport'][_0xd7df('0x23')](_0x156612[_0xd7df('0x24')],{'raw':_0x156612[_0xd7df('0x1a')]?_0x156612[_0xd7df('0x1a')][_0xd7df('0x25')]===undefined?!![]:![]:!![]})[_0xd7df('0xf')](function(_0x5a658f){logger[_0xd7df('0x21')](_0xd7df('0x22'),_0x156612);logger[_0xd7df('0x11')](_0xd7df('0x22'),_0x156612,JSON[_0xd7df('0x13')](_0x5a658f));_0x3ef553(_0x5a658f);})[_0xd7df('0x17')](function(_0x141206){logger[_0xd7df('0x14')](_0xd7df('0x22'),_0x141206[_0xd7df('0x16')],_0x156612);_0x2887db(_0x503a90[_0xd7df('0x14')](0x1f4,_0x141206['message']));});});};exports['UpdateMemberReport']=function(_0x4051fb){var _0x564562=this;return new Promise(function(_0x2a3bcf,_0xab3dd8){return db[_0xd7df('0x26')][_0xd7df('0x27')](_0x4051fb['body'],{'raw':_0x4051fb['options']?_0x4051fb['options'][_0xd7df('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4051fb[_0xd7df('0x1a')]?_0x4051fb['options'][_0xd7df('0x1b')]||null:null,'attributes':_0x4051fb[_0xd7df('0x1a')]?_0x4051fb[_0xd7df('0x1a')][_0xd7df('0x1c')]||null:null,'limit':_0x4051fb['options']?_0x4051fb[_0xd7df('0x1a')][_0xd7df('0x1d')]||null:null})['then'](function(_0x52933f){logger['info'](_0xd7df('0x28'),_0x4051fb);logger[_0xd7df('0x11')](_0xd7df('0x28'),_0x4051fb,JSON['stringify'](_0x52933f));_0x2a3bcf(_0x52933f);})[_0xd7df('0x17')](function(_0x2a7252){logger[_0xd7df('0x14')](_0xd7df('0x28'),_0x2a7252['message'],_0x4051fb);_0xab3dd8(_0x564562[_0xd7df('0x14')](0x1f4,_0x2a7252[_0xd7df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 29bee60..1e640b4 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 _0x7e89=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','exports','path','connect-timeout'];(function(_0x49bf8b,_0x5ec7a2){var _0x5ca041=function(_0x4177e6){while(--_0x4177e6){_0x49bf8b['push'](_0x49bf8b['shift']());}};_0x5ca041(++_0x5ec7a2);}(_0x7e89,0x181));var _0x97e8=function(_0x185ce6,_0x80b049){_0x185ce6=_0x185ce6-0x0;var _0xb2b554=_0x7e89[_0x185ce6];return _0xb2b554;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x97e8('0x0'));var timeout=require(_0x97e8('0x1'));var express=require(_0x97e8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x97e8('0x3'));var interaction=require(_0x97e8('0x4'));var config=require(_0x97e8('0x5'));var controller=require(_0x97e8('0x6'));router['get']('/',controller[_0x97e8('0x7')]);module[_0x97e8('0x8')]=router; \ No newline at end of file +var _0xfbd8=['get','index','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xfbd8,0x1ba));var _0x8fbd=function(_0x584cba,_0x58414c){_0x584cba=_0x584cba-0x0;var _0x5e636f=_0xfbd8[_0x584cba];return _0x5e636f;};'use strict';var multer=require(_0x8fbd('0x0'));var util=require(_0x8fbd('0x1'));var path=require(_0x8fbd('0x2'));var timeout=require(_0x8fbd('0x3'));var express=require(_0x8fbd('0x4'));var router=express[_0x8fbd('0x5')]();var fs_extra=require(_0x8fbd('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8fbd('0x7'));var config=require(_0x8fbd('0x8'));var controller=require('./migration.controller');router[_0x8fbd('0x9')]('/',controller[_0x8fbd('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e716ef5..27f16cb 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 _0xf3bb=['sequelize','exports','STRING','version'];(function(_0x2db12d,_0x46ae16){var _0x4b17db=function(_0x376f9a){while(--_0x376f9a){_0x2db12d['push'](_0x2db12d['shift']());}};_0x4b17db(++_0x46ae16);}(_0xf3bb,0x118));var _0xbf3b=function(_0x24d399,_0x5c17c0){_0x24d399=_0x24d399-0x0;var _0x128e76=_0xf3bb[_0x24d399];return _0x128e76;};'use strict';var Sequelize=require(_0xbf3b('0x0'));module[_0xbf3b('0x1')]={'version':{'type':Sequelize[_0xbf3b('0x2')],'unique':_0xbf3b('0x3')}}; \ No newline at end of file +var _0x3b27=['sequelize','STRING','version'];(function(_0x4173c4,_0x95e680){var _0xa004a8=function(_0x3d85c2){while(--_0x3d85c2){_0x4173c4['push'](_0x4173c4['shift']());}};_0xa004a8(++_0x95e680);}(_0x3b27,0x198));var _0x73b2=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x3b27[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0x73b2('0x0'));module['exports']={'version':{'type':Sequelize[_0x73b2('0x1')],'unique':_0x73b2('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 18a9c1d..cf8440a 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 _0x4c7d=['fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','error','name','send','map','Migration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','count','include','findAll','catch','rimraf','zip-dir'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x4c7d,0x1ce));var _0xd4c7=function(_0x31cab0,_0xa2695e){_0x31cab0=_0x31cab0-0x0;var _0x16afd9=_0x4c7d[_0x31cab0];return _0x16afd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd4c7('0x0'));var zipdir=require(_0xd4c7('0x1'));var jsonpatch=require(_0xd4c7('0x2'));var rp=require('request-promise');var moment=require(_0xd4c7('0x3'));var BPromise=require(_0xd4c7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd4c7('0x5'));var csv=require(_0xd4c7('0x6'));var ejs=require(_0xd4c7('0x7'));var fs=require('fs');var fs_extra=require(_0xd4c7('0x8'));var _=require(_0xd4c7('0x9'));var squel=require(_0xd4c7('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd4c7('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd4c7('0xb'));var authService=require(_0xd4c7('0xc'));var qs=require(_0xd4c7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4c7('0xe'));var logger=require('../../config/logger')(_0xd4c7('0xf'));var utils=require(_0xd4c7('0x10'));var config=require(_0xd4c7('0x11'));var licenseUtil=require(_0xd4c7('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186874,_0x5b93ec){_0x5b93ec=_0x5b93ec||0xcc;return function(_0xe26837){if(_0xe26837){return _0x186874[_0xd4c7('0x13')](_0x5b93ec);}return _0x186874['status'](_0x5b93ec)['end']();};}function respondWithResult(_0x303672,_0x47a245){_0x47a245=_0x47a245||0xc8;return function(_0x2b24b0){if(_0x2b24b0){return _0x303672[_0xd4c7('0x14')](_0x47a245)[_0xd4c7('0x15')](_0x2b24b0);}};}function respondWithFilteredResult(_0x34dca7,_0x5112a0){return function(_0x5eaafc){if(_0x5eaafc){var _0x25ea21=typeof _0x5112a0[_0xd4c7('0x16')]==='undefined'&&typeof _0x5112a0[_0xd4c7('0x17')]===_0xd4c7('0x18');var _0x375ff5=_0x5eaafc['count'];var _0x45fbec=_0x25ea21?0x0:_0x5112a0[_0xd4c7('0x16')];var _0x3fafee=_0x25ea21?_0x5eaafc['count']:_0x5112a0[_0xd4c7('0x16')]+_0x5112a0[_0xd4c7('0x17')];var _0x267c31;if(_0x3fafee>=_0x375ff5){_0x3fafee=_0x375ff5;_0x267c31=0xc8;}else{_0x267c31=0xce;}_0x34dca7[_0xd4c7('0x14')](_0x267c31);return _0x34dca7[_0xd4c7('0x19')](_0xd4c7('0x1a'),_0x45fbec+'-'+_0x3fafee+'/'+_0x375ff5)[_0xd4c7('0x15')](_0x5eaafc);}return null;};}function patchUpdates(_0x2154c1){return function(_0xeb5728){try{jsonpatch[_0xd4c7('0x1b')](_0xeb5728,_0x2154c1,!![]);}catch(_0x24d29f){return BPromise[_0xd4c7('0x1c')](_0x24d29f);}return _0xeb5728[_0xd4c7('0x1d')]();};}function saveUpdates(_0x128878,_0x5a8c27){return function(_0xeeee0e){if(_0xeeee0e){return _0xeeee0e['update'](_0x128878)[_0xd4c7('0x1e')](function(_0x440245){return _0x440245;});}return null;};}function removeEntity(_0x36d5a1,_0xfe5b4d){return function(_0x5f0f45){if(_0x5f0f45){return _0x5f0f45['destroy']()[_0xd4c7('0x1e')](function(){_0x36d5a1[_0xd4c7('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40ba94,_0x52a766){return function(_0x14cfbd){if(!_0x14cfbd){_0x40ba94[_0xd4c7('0x13')](0x194);}return _0x14cfbd;};}function handleError(_0x21ce29,_0x1143c7){_0x1143c7=_0x1143c7||0x1f4;return function(_0x1079b8){logger[_0xd4c7('0x1f')](_0x1079b8['stack']);if(_0x1079b8['name']){delete _0x1079b8[_0xd4c7('0x20')];}_0x21ce29['status'](_0x1143c7)[_0xd4c7('0x21')](_0x1079b8);};}exports['index']=function(_0x4732dd,_0x44b72e){var _0x10ea03={},_0x39333b={},_0x45ce85={'count':0x0,'rows':[]};var _0x4dde41=_[_0xd4c7('0x22')](db[_0xd4c7('0x23')][_0xd4c7('0x24')],function(_0x176b63){return{'name':_0x176b63[_0xd4c7('0x25')],'type':_0x176b63[_0xd4c7('0x26')]['key']};});_0x39333b[_0xd4c7('0x27')]=_['map'](_0x4dde41,_0xd4c7('0x20'));_0x39333b[_0xd4c7('0x28')]=_[_0xd4c7('0x29')](_0x4732dd[_0xd4c7('0x28')]);_0x39333b[_0xd4c7('0x2a')]=_[_0xd4c7('0x2b')](_0x39333b[_0xd4c7('0x27')],_0x39333b[_0xd4c7('0x28')]);_0x10ea03[_0xd4c7('0x2c')]=_[_0xd4c7('0x2b')](_0x39333b['model'],qs[_0xd4c7('0x2d')](_0x4732dd[_0xd4c7('0x28')]['fields']));_0x10ea03['attributes']=_0x10ea03[_0xd4c7('0x2c')][_0xd4c7('0x2e')]?_0x10ea03[_0xd4c7('0x2c')]:_0x39333b[_0xd4c7('0x27')];if(!_0x4732dd[_0xd4c7('0x28')]['hasOwnProperty']('nolimit')){_0x10ea03[_0xd4c7('0x17')]=qs[_0xd4c7('0x17')](_0x4732dd[_0xd4c7('0x28')]['limit']);_0x10ea03[_0xd4c7('0x16')]=qs[_0xd4c7('0x16')](_0x4732dd[_0xd4c7('0x28')]['offset']);}_0x10ea03[_0xd4c7('0x2f')]=qs[_0xd4c7('0x30')](_0x4732dd['query'][_0xd4c7('0x30')]);_0x10ea03[_0xd4c7('0x31')]=qs[_0xd4c7('0x2a')](_[_0xd4c7('0x32')](_0x4732dd['query'],_0x39333b[_0xd4c7('0x2a')]),_0x4dde41);if(_0x4732dd[_0xd4c7('0x28')][_0xd4c7('0x33')]){_0x10ea03[_0xd4c7('0x31')]=_['merge'](_0x10ea03[_0xd4c7('0x31')],{'$or':_[_0xd4c7('0x22')](_0x4dde41,function(_0x1ce264){if(_0x1ce264[_0xd4c7('0x26')]!==_0xd4c7('0x34')){var _0x4ec754={};_0x4ec754[_0x1ce264[_0xd4c7('0x20')]]={'$like':'%'+_0x4732dd[_0xd4c7('0x28')][_0xd4c7('0x33')]+'%'};return _0x4ec754;}})});}_0x10ea03=_[_0xd4c7('0x35')]({},_0x10ea03,_0x4732dd['options']);var _0x4bee6d={'where':_0x10ea03['where']};return db[_0xd4c7('0x23')][_0xd4c7('0x36')](_0x4bee6d)['then'](function(_0x1ad4c0){_0x45ce85[_0xd4c7('0x36')]=_0x1ad4c0;if(_0x4732dd[_0xd4c7('0x28')]['includeAll']){_0x10ea03[_0xd4c7('0x37')]=[{'all':!![]}];}return db[_0xd4c7('0x23')][_0xd4c7('0x38')](_0x10ea03);})['then'](function(_0x559e30){_0x45ce85['rows']=_0x559e30;return _0x45ce85;})[_0xd4c7('0x1e')](respondWithFilteredResult(_0x44b72e,_0x10ea03))[_0xd4c7('0x39')](handleError(_0x44b72e,null));}; \ No newline at end of file +var _0x4796=['VIRTUAL','options','includeAll','include','findAll','rows','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Migration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge'];(function(_0x1c666a,_0x21e9fc){var _0x507f85=function(_0x5f1f4e){while(--_0x5f1f4e){_0x1c666a['push'](_0x1c666a['shift']());}};_0x507f85(++_0x21e9fc);}(_0x4796,0x8e));var _0x6479=function(_0x3f537d,_0x113978){_0x3f537d=_0x3f537d-0x0;var _0x176091=_0x4796[_0x3f537d];return _0x176091;};'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(_0x6479('0x0'));var moment=require(_0x6479('0x1'));var BPromise=require(_0x6479('0x2'));var Mustache=require('mustache');var util=require(_0x6479('0x3'));var path=require(_0x6479('0x4'));var sox=require(_0x6479('0x5'));var csv=require(_0x6479('0x6'));var ejs=require(_0x6479('0x7'));var fs=require('fs');var fs_extra=require(_0x6479('0x8'));var _=require(_0x6479('0x9'));var squel=require(_0x6479('0xa'));var crypto=require(_0x6479('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6479('0xc'));var toCsv=require(_0x6479('0x6'));var querystring=require(_0x6479('0xd'));var Papa=require('papaparse');var Redis=require(_0x6479('0xe'));var authService=require(_0x6479('0xf'));var qs=require(_0x6479('0x10'));var as=require(_0x6479('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6479('0x12'))(_0x6479('0x13'));var utils=require(_0x6479('0x14'));var config=require(_0x6479('0x15'));var licenseUtil=require(_0x6479('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18adf1,_0x9e8d84){_0x9e8d84=_0x9e8d84||0xcc;return function(_0x36f7a2){if(_0x36f7a2){return _0x18adf1[_0x6479('0x17')](_0x9e8d84);}return _0x18adf1[_0x6479('0x18')](_0x9e8d84)['end']();};}function respondWithResult(_0x496ad2,_0xadd536){_0xadd536=_0xadd536||0xc8;return function(_0x20d3b8){if(_0x20d3b8){return _0x496ad2[_0x6479('0x18')](_0xadd536)[_0x6479('0x19')](_0x20d3b8);}};}function respondWithFilteredResult(_0x256cbe,_0x473a21){return function(_0x4657c8){if(_0x4657c8){var _0xd675ff=typeof _0x473a21[_0x6479('0x1a')]===_0x6479('0x1b')&&typeof _0x473a21[_0x6479('0x1c')]===_0x6479('0x1b');var _0x196443=_0x4657c8[_0x6479('0x1d')];var _0x36d87c=_0xd675ff?0x0:_0x473a21[_0x6479('0x1a')];var _0x268071=_0xd675ff?_0x4657c8['count']:_0x473a21['offset']+_0x473a21['limit'];var _0x1e25b2;if(_0x268071>=_0x196443){_0x268071=_0x196443;_0x1e25b2=0xc8;}else{_0x1e25b2=0xce;}_0x256cbe[_0x6479('0x18')](_0x1e25b2);return _0x256cbe[_0x6479('0x1e')](_0x6479('0x1f'),_0x36d87c+'-'+_0x268071+'/'+_0x196443)[_0x6479('0x19')](_0x4657c8);}return null;};}function patchUpdates(_0x317b4e){return function(_0xa90227){try{jsonpatch[_0x6479('0x20')](_0xa90227,_0x317b4e,!![]);}catch(_0xd7767d){return BPromise[_0x6479('0x21')](_0xd7767d);}return _0xa90227[_0x6479('0x22')]();};}function saveUpdates(_0x399697,_0x296377){return function(_0x17f00c){if(_0x17f00c){return _0x17f00c[_0x6479('0x23')](_0x399697)[_0x6479('0x24')](function(_0x152622){return _0x152622;});}return null;};}function removeEntity(_0x3c1eb7,_0xa96bce){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b[_0x6479('0x25')]()['then'](function(){_0x3c1eb7[_0x6479('0x18')](0xcc)[_0x6479('0x26')]();});}};}function handleEntityNotFound(_0x465e69,_0x2ceeb1){return function(_0x253992){if(!_0x253992){_0x465e69['sendStatus'](0x194);}return _0x253992;};}function handleError(_0x3b5ba4,_0x462cc1){_0x462cc1=_0x462cc1||0x1f4;return function(_0x4d94e6){logger['error'](_0x4d94e6[_0x6479('0x27')]);if(_0x4d94e6[_0x6479('0x28')]){delete _0x4d94e6[_0x6479('0x28')];}_0x3b5ba4[_0x6479('0x18')](_0x462cc1)[_0x6479('0x29')](_0x4d94e6);};}exports[_0x6479('0x2a')]=function(_0x1612a3,_0x58f5e7){var _0x5bf44b={},_0x3adccf={},_0x2d2739={'count':0x0,'rows':[]};var _0x221ce2=_[_0x6479('0x2b')](db[_0x6479('0x2c')][_0x6479('0x2d')],function(_0x7505db){return{'name':_0x7505db['fieldName'],'type':_0x7505db[_0x6479('0x2e')][_0x6479('0x2f')]};});_0x3adccf[_0x6479('0x30')]=_[_0x6479('0x2b')](_0x221ce2,'name');_0x3adccf[_0x6479('0x31')]=_[_0x6479('0x32')](_0x1612a3['query']);_0x3adccf[_0x6479('0x33')]=_[_0x6479('0x34')](_0x3adccf[_0x6479('0x30')],_0x3adccf[_0x6479('0x31')]);_0x5bf44b[_0x6479('0x35')]=_[_0x6479('0x34')](_0x3adccf['model'],qs[_0x6479('0x36')](_0x1612a3[_0x6479('0x31')]['fields']));_0x5bf44b['attributes']=_0x5bf44b[_0x6479('0x35')]['length']?_0x5bf44b[_0x6479('0x35')]:_0x3adccf['model'];if(!_0x1612a3[_0x6479('0x31')][_0x6479('0x37')](_0x6479('0x38'))){_0x5bf44b[_0x6479('0x1c')]=qs['limit'](_0x1612a3[_0x6479('0x31')][_0x6479('0x1c')]);_0x5bf44b[_0x6479('0x1a')]=qs[_0x6479('0x1a')](_0x1612a3['query']['offset']);}_0x5bf44b['order']=qs[_0x6479('0x39')](_0x1612a3['query'][_0x6479('0x39')]);_0x5bf44b['where']=qs[_0x6479('0x33')](_[_0x6479('0x3a')](_0x1612a3[_0x6479('0x31')],_0x3adccf['filters']),_0x221ce2);if(_0x1612a3[_0x6479('0x31')][_0x6479('0x3b')]){_0x5bf44b[_0x6479('0x3c')]=_[_0x6479('0x3d')](_0x5bf44b[_0x6479('0x3c')],{'$or':_[_0x6479('0x2b')](_0x221ce2,function(_0x4f315e){if(_0x4f315e[_0x6479('0x2e')]!==_0x6479('0x3e')){var _0x8a5ea5={};_0x8a5ea5[_0x4f315e[_0x6479('0x28')]]={'$like':'%'+_0x1612a3[_0x6479('0x31')][_0x6479('0x3b')]+'%'};return _0x8a5ea5;}})});}_0x5bf44b=_[_0x6479('0x3d')]({},_0x5bf44b,_0x1612a3[_0x6479('0x3f')]);var _0x58eaa3={'where':_0x5bf44b[_0x6479('0x3c')]};return db[_0x6479('0x2c')]['count'](_0x58eaa3)[_0x6479('0x24')](function(_0x45aac1){_0x2d2739[_0x6479('0x1d')]=_0x45aac1;if(_0x1612a3[_0x6479('0x31')][_0x6479('0x40')]){_0x5bf44b[_0x6479('0x41')]=[{'all':!![]}];}return db[_0x6479('0x2c')][_0x6479('0x42')](_0x5bf44b);})[_0x6479('0x24')](function(_0x4492fb){_0x2d2739[_0x6479('0x43')]=_0x4492fb;return _0x2d2739;})[_0x6479('0x24')](respondWithFilteredResult(_0x58f5e7,_0x5bf44b))['catch'](handleError(_0x58f5e7,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 92fdd34..e0beeac 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 _0x35dd=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x35dd,0xb0));var _0xd35d=function(_0x5e3426,_0x3f3635){_0x5e3426=_0x5e3426-0x0;var _0x19ad05=_0x35dd[_0x5e3426];return _0x19ad05;};'use strict';var _=require(_0xd35d('0x0'));var util=require(_0xd35d('0x1'));var logger=require('../../config/logger')(_0xd35d('0x2'));var moment=require(_0xd35d('0x3'));var BPromise=require(_0xd35d('0x4'));var rp=require(_0xd35d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd35d('0x6'));var config=require(_0xd35d('0x7'));var attributes=require(_0xd35d('0x8'));module[_0xd35d('0x9')]=function(_0x21437c,_0x3ce365){return _0x21437c[_0xd35d('0xa')](_0xd35d('0xb'),attributes,{'tableName':_0xd35d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa5=['exports','define','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aa5,0xec));var _0x53aa=function(_0x4f7b5b,_0x4b77c2){_0x4f7b5b=_0x4f7b5b-0x0;var _0x51d9cb=_0x3aa5[_0x4f7b5b];return _0x51d9cb;};'use strict';var _=require(_0x53aa('0x0'));var util=require(_0x53aa('0x1'));var logger=require('../../config/logger')(_0x53aa('0x2'));var moment=require(_0x53aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x53aa('0x4'));var fs=require('fs');var path=require(_0x53aa('0x5'));var rimraf=require(_0x53aa('0x6'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x53aa('0x7')]=function(_0x236ee4,_0x1d8a1a){return _0x236ee4[_0x53aa('0x8')]('Migration',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 d49505b..4b796d4 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 _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x57d865,_0x5095fa){var _0x324d2a=function(_0x3cb6a4){while(--_0x3cb6a4){_0x57d865['push'](_0x57d865['shift']());}};_0x324d2a(++_0x5095fa);}(_0x7980,0xab));var _0x0798=function(_0x3b43ff,_0x5b243d){_0x3b43ff=_0x3b43ff-0x0;var _0x13ba43=_0x7980[_0x3b43ff];return _0x13ba43;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('Migration,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file +var _0x43c8=['client','http','then','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x43c8,0xaf));var _0x843c=function(_0x382cfb,_0x523777){_0x382cfb=_0x382cfb-0x0;var _0x39fcde=_0x43c8[_0x382cfb];return _0x39fcde;};'use strict';var _=require('lodash');var util=require(_0x843c('0x0'));var moment=require('moment');var BPromise=require(_0x843c('0x1'));var rs=require(_0x843c('0x2'));var fs=require('fs');var Redis=require(_0x843c('0x3'));var db=require(_0x843c('0x4'))['db'];var utils=require(_0x843c('0x5'));var logger=require(_0x843c('0x6'))(_0x843c('0x7'));var config=require('../../config/environment');var jayson=require(_0x843c('0x8'));var client=jayson[_0x843c('0x9')][_0x843c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15bb1f,_0xd198e5,_0x49aee7){return new BPromise(function(_0x327327,_0x41f56d){return client['request'](_0x15bb1f,_0x49aee7)[_0x843c('0xb')](function(_0x566777){logger['info'](_0x843c('0xc'),_0xd198e5,'request\x20sent');logger[_0x843c('0xd')](_0x843c('0xe'),_0xd198e5,_0x843c('0xf'),JSON[_0x843c('0x10')](_0x566777));if(_0x566777['error']){if(_0x566777[_0x843c('0x11')][_0x843c('0x12')]===0x1f4){logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x41f56d(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}logger[_0x843c('0x11')](_0x843c('0xc'),_0xd198e5,_0x566777[_0x843c('0x11')][_0x843c('0x13')]);return _0x327327(_0x566777[_0x843c('0x11')][_0x843c('0x13')]);}else{logger[_0x843c('0x14')]('Migration,\x20%s,\x20%s',_0xd198e5,_0x843c('0xf'));_0x327327(_0x566777[_0x843c('0x15')][_0x843c('0x13')]);}})[_0x843c('0x16')](function(_0x16e8f6){logger['error'](_0x843c('0xc'),_0xd198e5,_0x16e8f6);_0x41f56d(_0x16e8f6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 19c921a..4645b60 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 _0x5ae9=['/:id','post','create','put','update','delete','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1a4fb1,_0x1c92d2){var _0x2bda04=function(_0x11ce23){while(--_0x11ce23){_0x1a4fb1['push'](_0x1a4fb1['shift']());}};_0x2bda04(++_0x1c92d2);}(_0x5ae9,0x19b));var _0x95ae=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x5ae9[_0x55cdc5];return _0x29acd5;};'use strict';var multer=require(_0x95ae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x95ae('0x1'));var express=require(_0x95ae('0x2'));var router=express['Router']();var fs_extra=require(_0x95ae('0x3'));var auth=require(_0x95ae('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x95ae('0x5'));var controller=require('./network.controller');router[_0x95ae('0x6')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0x8')]);router[_0x95ae('0x6')](_0x95ae('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x95ae('0xa')]('/',auth[_0x95ae('0x7')](),controller[_0x95ae('0xb')]);router[_0x95ae('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x95ae('0xd')]);router[_0x95ae('0xe')](_0x95ae('0x9'),auth[_0x95ae('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x14a0=['../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14a0,0x109));var _0x014a=function(_0x3857b2,_0x5c0294){_0x3857b2=_0x3857b2-0x0;var _0x137759=_0x14a0[_0x3857b2];return _0x137759;};'use strict';var multer=require(_0x014a('0x0'));var util=require(_0x014a('0x1'));var path=require(_0x014a('0x2'));var timeout=require(_0x014a('0x3'));var express=require(_0x014a('0x4'));var router=express[_0x014a('0x5')]();var fs_extra=require(_0x014a('0x6'));var auth=require(_0x014a('0x7'));var interaction=require(_0x014a('0x8'));var config=require('../../config/environment');var controller=require(_0x014a('0x9'));router[_0x014a('0xa')]('/',auth['isAuthenticated'](),controller[_0x014a('0xb')]);router[_0x014a('0xa')](_0x014a('0xc'),auth[_0x014a('0xd')](),controller[_0x014a('0xe')]);router['post']('/',auth[_0x014a('0xd')](),controller[_0x014a('0xf')]);router[_0x014a('0x10')](_0x014a('0xc'),auth[_0x014a('0xd')](),controller[_0x014a('0x11')]);router[_0x014a('0x12')](_0x014a('0xc'),auth[_0x014a('0xd')](),controller[_0x014a('0x13')]);module[_0x014a('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 9389e7e..31cdb3e 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 _0x343c=['ENUM','externip','turn','STRING','sequelize','exports'];(function(_0xef0ce4,_0x5c2cba){var _0x4193c3=function(_0x3aebe9){while(--_0x3aebe9){_0xef0ce4['push'](_0xef0ce4['shift']());}};_0x4193c3(++_0x5c2cba);}(_0x343c,0x130));var _0xc343=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x343c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc343('0x0'));module[_0xc343('0x1')]={'type':{'type':Sequelize[_0xc343('0x2')]('localnet',_0xc343('0x3'),'stun',_0xc343('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc343('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf15=['ENUM','stun','turn','STRING','sequelize','exports'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xcf15,0x6a));var _0x5cf1=function(_0x2f706c,_0x2b5f9b){_0x2f706c=_0x2f706c-0x0;var _0x32b562=_0xcf15[_0x2f706c];return _0x32b562;};'use strict';var Sequelize=require(_0x5cf1('0x0'));module[_0x5cf1('0x1')]={'type':{'type':Sequelize[_0x5cf1('0x2')]('localnet','externip',_0x5cf1('0x3'),_0x5cf1('0x4'))},'value':{'type':Sequelize[_0x5cf1('0x5')]},'username':{'type':Sequelize[_0x5cf1('0x5')]},'password':{'type':Sequelize[_0x5cf1('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f81e507..c5e6984 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 _0x7f2b=['rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','show','params','includeAll','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toLowerCase','TURN','util','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','json','update','then','destroy','sendStatus','name','send','map','Network'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7f2b,0x1dc));var _0xb7f2=function(_0x20003e,_0x1aeb29){_0x20003e=_0x20003e-0x0;var _0x33b4d1=_0x7f2b[_0x20003e];return _0x33b4d1;};'use strict';var util=require(_0xb7f2('0x0'));var path=require('path');var ejs=require(_0xb7f2('0x1'));var fs=require('fs');var _=require(_0xb7f2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xb7f2('0x3'))(_0xb7f2('0x4'));var config=require(_0xb7f2('0x5'));var db=require(_0xb7f2('0x6'))['db'];var jayson=require(_0xb7f2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1dd4d9,_0x453e7b,_0x24ee4f,_0x31a6a3){return new Promise(function(_0x144770,_0x3515cb){var _0x4ad8e1=_0x31a6a3||client;return _0x4ad8e1[_0xb7f2('0x8')](_0x1dd4d9,_0x24ee4f)['then'](function(_0x12455a){logger[_0xb7f2('0x9')](_0xb7f2('0xa'),_0x453e7b,_0xb7f2('0xb'));logger[_0xb7f2('0xc')](_0xb7f2('0xd'),_0x453e7b,'request\x20sent',JSON[_0xb7f2('0xe')](_0x12455a));if(_0x12455a['error']){if(_0x12455a[_0xb7f2('0xf')][_0xb7f2('0x10')]===0x1f4){logger[_0xb7f2('0xf')](_0xb7f2('0xa'),_0x453e7b,_0x12455a[_0xb7f2('0xf')][_0xb7f2('0x11')]);return _0x3515cb(_0x12455a[_0xb7f2('0xf')]['message']);}logger['error'](_0xb7f2('0xa'),_0x453e7b,_0x12455a[_0xb7f2('0xf')][_0xb7f2('0x11')]);return _0x144770(_0x12455a[_0xb7f2('0xf')][_0xb7f2('0x11')]);}else{logger[_0xb7f2('0x9')](_0xb7f2('0xa'),_0x453e7b,_0xb7f2('0xb'));_0x144770(_0x12455a[_0xb7f2('0x12')][_0xb7f2('0x11')]);}})[_0xb7f2('0x13')](function(_0x368c69){logger[_0xb7f2('0xf')](_0xb7f2('0xa'),_0x453e7b,_0x368c69);_0x3515cb(_0x368c69);});});}function respondWithResult(_0x497308,_0x18c125){_0x18c125=_0x18c125||0xc8;return function(_0x577439){if(_0x577439){return _0x497308[_0xb7f2('0x14')](_0x18c125)['json'](_0x577439);}};}function respondWithFilteredResult(_0x5d8514,_0x315df4){return function(_0x4d7c9c){if(_0x4d7c9c){var _0x4a3dd6=typeof _0x315df4[_0xb7f2('0x15')]==='undefined'&&typeof _0x315df4[_0xb7f2('0x16')]===_0xb7f2('0x17');var _0x22c847=_0x4d7c9c[_0xb7f2('0x18')];var _0x1550dd=_0x4a3dd6?0x0:_0x315df4[_0xb7f2('0x15')];var _0x4493a0=_0x4a3dd6?_0x4d7c9c[_0xb7f2('0x18')]:_0x315df4[_0xb7f2('0x15')]+_0x315df4[_0xb7f2('0x16')];var _0xd6acb5;if(_0x4493a0>=_0x22c847){_0x4493a0=_0x22c847;_0xd6acb5=0xc8;}else{_0xd6acb5=0xce;}_0x5d8514[_0xb7f2('0x14')](_0xd6acb5);return _0x5d8514['set']('Content-Range',_0x1550dd+'-'+_0x4493a0+'/'+_0x22c847)[_0xb7f2('0x19')](_0x4d7c9c);}return null;};}function saveUpdates(_0x1b1000){return function(_0x4423df){if(_0x4423df){return _0x4423df[_0xb7f2('0x1a')](_0x1b1000)[_0xb7f2('0x1b')](function(_0x3779ae){return _0x3779ae;});}return null;};}function removeEntity(_0x5cdd52){return function(_0x50191b){if(_0x50191b){return _0x50191b[_0xb7f2('0x1c')]()[_0xb7f2('0x1b')](function(){_0x5cdd52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55f247){return function(_0x42132a){if(!_0x42132a){_0x55f247[_0xb7f2('0x1d')](0x194);}return _0x42132a;};}function handleError(_0x20b4a4,_0x2402d3){_0x2402d3=_0x2402d3||0x1f4;return function(_0x2bdd2c){logger[_0xb7f2('0xf')](_0x2bdd2c['stack']);if(_0x2bdd2c[_0xb7f2('0x1e')]){delete _0x2bdd2c['name'];}_0x20b4a4[_0xb7f2('0x14')](_0x2402d3)[_0xb7f2('0x1f')](_0x2bdd2c);};}exports['index']=function(_0x2a786d,_0x13091c){var _0x14c343={},_0x256f67={},_0x2376a6={'count':0x0,'rows':[]};var _0x1ec19a=_[_0xb7f2('0x20')](db[_0xb7f2('0x21')][_0xb7f2('0x22')],function(_0xc47383){return{'name':_0xc47383[_0xb7f2('0x23')],'type':_0xc47383[_0xb7f2('0x24')][_0xb7f2('0x25')]};});_0x256f67[_0xb7f2('0x26')]=_[_0xb7f2('0x20')](_0x1ec19a,'name');_0x256f67[_0xb7f2('0x27')]=_[_0xb7f2('0x28')](_0x2a786d['query']);_0x256f67[_0xb7f2('0x29')]=_['intersection'](_0x256f67[_0xb7f2('0x26')],_0x256f67[_0xb7f2('0x27')]);_0x14c343[_0xb7f2('0x2a')]=_[_0xb7f2('0x2b')](_0x256f67[_0xb7f2('0x26')],qs['fields'](_0x2a786d[_0xb7f2('0x27')][_0xb7f2('0x2c')]));_0x14c343[_0xb7f2('0x2a')]=_0x14c343[_0xb7f2('0x2a')][_0xb7f2('0x2d')]?_0x14c343['attributes']:_0x256f67[_0xb7f2('0x26')];if(!_0x2a786d[_0xb7f2('0x27')][_0xb7f2('0x2e')](_0xb7f2('0x2f'))){_0x14c343['limit']=qs[_0xb7f2('0x16')](_0x2a786d['query'][_0xb7f2('0x16')]);_0x14c343[_0xb7f2('0x15')]=qs[_0xb7f2('0x15')](_0x2a786d[_0xb7f2('0x27')][_0xb7f2('0x15')]);}_0x14c343[_0xb7f2('0x30')]=qs[_0xb7f2('0x31')](_0x2a786d[_0xb7f2('0x27')][_0xb7f2('0x31')]);_0x14c343['where']=qs[_0xb7f2('0x29')](_[_0xb7f2('0x32')](_0x2a786d[_0xb7f2('0x27')],_0x256f67[_0xb7f2('0x29')]),_0x1ec19a);if(_0x2a786d['query'][_0xb7f2('0x33')]){_0x14c343['where']=_[_0xb7f2('0x34')](_0x14c343['where'],{'$or':_[_0xb7f2('0x20')](_0x1ec19a,function(_0x8dc6f0){if(_0x8dc6f0[_0xb7f2('0x24')]!==_0xb7f2('0x35')){var _0x13312e={};_0x13312e[_0x8dc6f0[_0xb7f2('0x1e')]]={'$like':'%'+_0x2a786d[_0xb7f2('0x27')][_0xb7f2('0x33')]+'%'};return _0x13312e;}})});}_0x14c343=_[_0xb7f2('0x34')]({},_0x14c343,_0x2a786d[_0xb7f2('0x36')]);var _0x5c2b68={'where':_0x14c343[_0xb7f2('0x37')]};return db[_0xb7f2('0x21')][_0xb7f2('0x18')](_0x5c2b68)['then'](function(_0x9c460c){_0x2376a6['count']=_0x9c460c;if(_0x2a786d[_0xb7f2('0x27')]['includeAll']){_0x14c343[_0xb7f2('0x38')]=[{'all':!![]}];}return db[_0xb7f2('0x21')][_0xb7f2('0x39')](_0x14c343);})[_0xb7f2('0x1b')](function(_0x349508){_0x2376a6[_0xb7f2('0x3a')]=_0x349508;return _0x2376a6;})[_0xb7f2('0x1b')](respondWithFilteredResult(_0x13091c,_0x14c343))[_0xb7f2('0x13')](handleError(_0x13091c,null));};exports[_0xb7f2('0x3b')]=function(_0x147e02,_0x592364){var _0x51f39c={'raw':!![],'where':{'id':_0x147e02[_0xb7f2('0x3c')]['id']}},_0x2591eb={};_0x2591eb[_0xb7f2('0x26')]=_[_0xb7f2('0x28')](db[_0xb7f2('0x21')][_0xb7f2('0x22')]);_0x2591eb['query']=_['keys'](_0x147e02[_0xb7f2('0x27')]);_0x2591eb[_0xb7f2('0x29')]=_[_0xb7f2('0x2b')](_0x2591eb[_0xb7f2('0x26')],_0x2591eb[_0xb7f2('0x27')]);_0x51f39c[_0xb7f2('0x2a')]=_[_0xb7f2('0x2b')](_0x2591eb[_0xb7f2('0x26')],qs[_0xb7f2('0x2c')](_0x147e02['query'][_0xb7f2('0x2c')]));_0x51f39c[_0xb7f2('0x2a')]=_0x51f39c[_0xb7f2('0x2a')][_0xb7f2('0x2d')]?_0x51f39c[_0xb7f2('0x2a')]:_0x2591eb[_0xb7f2('0x26')];if(_0x147e02[_0xb7f2('0x27')][_0xb7f2('0x3d')]){_0x51f39c['include']=[{'all':!![]}];}_0x51f39c=_[_0xb7f2('0x34')]({},_0x51f39c,_0x147e02['options']);return db['Network'][_0xb7f2('0x3e')](_0x51f39c)[_0xb7f2('0x1b')](handleEntityNotFound(_0x592364,null))[_0xb7f2('0x1b')](respondWithResult(_0x592364,null))['catch'](handleError(_0x592364,null));};exports['create']=function(_0x5d631b,_0x16019e){var _0x1ef1da;return db[_0xb7f2('0x21')][_0xb7f2('0x3f')](_0x5d631b[_0xb7f2('0x40')],{'raw':!![]})[_0xb7f2('0x1b')](function(_0x55764){_0x1ef1da=_0x55764;return db[_0xb7f2('0x21')][_0xb7f2('0x39')]({'where':{'type':_0x5d631b[_0xb7f2('0x40')][_0xb7f2('0x24')]},'raw':!![]});})[_0xb7f2('0x1b')](function(_0x2ad419){if(_0x1ef1da['type'][_0xb7f2('0x41')]()==_0xb7f2('0x42')){var _0x1db74c=fs[_0xb7f2('0x43')](path[_0xb7f2('0x44')](config[_0xb7f2('0x45')],_0xb7f2('0x46')),_0xb7f2('0x47'));var _0x35332f=ejs['render'](_0x1db74c,{'networks':_0x2ad419||[]});fs['writeFileSync'](_0xb7f2('0x48'),_0x35332f);return respondWithRpcPromise(_0xb7f2('0x49'),_0xb7f2('0x3f'),{'module':_0xb7f2('0x4a')});}else if(_0x1ef1da[_0xb7f2('0x24')]['toUpperCase']()=='TURN'){var _0x4ac9d2=fs[_0xb7f2('0x43')](path[_0xb7f2('0x44')](config[_0xb7f2('0x45')],_0xb7f2('0x4b')),_0xb7f2('0x47'));var _0x486daf=ejs[_0xb7f2('0x4c')](_0x4ac9d2,{'networks':_0x2ad419||[]});fs['writeFileSync'](_0xb7f2('0x4d'),_0x486daf);return respondWithRpcPromise(_0xb7f2('0x49'),'create',{'module':_0xb7f2('0x4a')});}else{var _0x4a6a7b=fs['readFileSync'](path['join'](config['root'],_0xb7f2('0x4e')),_0xb7f2('0x47'));var _0xb73558=ejs[_0xb7f2('0x4c')](_0x4a6a7b,{'networks':_0x2ad419||[]});fs[_0xb7f2('0x4f')](util[_0xb7f2('0x50')](_0xb7f2('0x51'),_0x5d631b[_0xb7f2('0x40')]['type']['toLowerCase']()),_0xb73558);return respondWithRpcPromise('Reload',_0xb7f2('0x3f'),{'module':_0xb7f2('0x52')});}})['then'](function(){return _0x1ef1da;})[_0xb7f2('0x1b')](respondWithResult(_0x16019e,0xc9))[_0xb7f2('0x13')](handleError(_0x16019e,null));};exports[_0xb7f2('0x1a')]=function(_0x5c9070,_0x55ee52){var _0x5e1488;return db[_0xb7f2('0x21')][_0xb7f2('0x3e')]({'where':{'id':_0x5c9070[_0xb7f2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x55ee52,null))[_0xb7f2('0x1b')](saveUpdates(_0x5c9070[_0xb7f2('0x40')],null))[_0xb7f2('0x1b')](function(_0x72102b){if(_0x72102b){_0x5e1488=_0x72102b;return db[_0xb7f2('0x21')][_0xb7f2('0x39')]({'where':{'type':_0x5e1488[_0xb7f2('0x24')]},'raw':!![]});}return null;})[_0xb7f2('0x1b')](function(_0x408e4d){if(_0x5e1488['type']['toUpperCase']()==_0xb7f2('0x42')){var _0x1cc5df=fs[_0xb7f2('0x43')](path[_0xb7f2('0x44')](config[_0xb7f2('0x45')],_0xb7f2('0x46')),_0xb7f2('0x47'));var _0x283cd0=ejs[_0xb7f2('0x4c')](_0x1cc5df,{'networks':_0x408e4d||[]});fs['writeFileSync'](_0xb7f2('0x48'),_0x283cd0);return respondWithRpcPromise(_0xb7f2('0x49'),_0xb7f2('0x1a'),{'module':'res_stun_monitor.so'});}else if(_0x5e1488[_0xb7f2('0x24')]['toUpperCase']()=='TURN'){var _0x5b8719=fs[_0xb7f2('0x43')](path[_0xb7f2('0x44')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xb7f2('0x47'));var _0x85dc94=ejs[_0xb7f2('0x4c')](_0x5b8719,{'networks':_0x408e4d||[]});fs[_0xb7f2('0x4f')](_0xb7f2('0x4d'),_0x85dc94);return respondWithRpcPromise(_0xb7f2('0x49'),_0xb7f2('0x1a'),{'module':_0xb7f2('0x4a')});}else{var _0x1d6035=fs['readFileSync'](path[_0xb7f2('0x44')](config[_0xb7f2('0x45')],'server/files/templates/network.ejs'),'utf8');var _0x29c994=ejs[_0xb7f2('0x4c')](_0x1d6035,{'networks':_0x408e4d||[]});fs[_0xb7f2('0x4f')](util[_0xb7f2('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x5c9070[_0xb7f2('0x40')][_0xb7f2('0x24')][_0xb7f2('0x53')]()),_0x29c994);return respondWithRpcPromise(_0xb7f2('0x49'),_0xb7f2('0x1a'),{'module':_0xb7f2('0x52')});}})[_0xb7f2('0x1b')](function(_0x4b696a){if(_0x4b696a){return _0x5e1488;}return null;})[_0xb7f2('0x1b')](respondWithResult(_0x55ee52,null))[_0xb7f2('0x13')](handleError(_0x55ee52,null));};exports[_0xb7f2('0x1c')]=function(_0x25f216,_0x3e099c){var _0x4ad5f9;return db[_0xb7f2('0x21')]['find']({'where':{'id':_0x25f216['params']['id']}})[_0xb7f2('0x1b')](function(_0x35ef0e){_0x4ad5f9=_0x35ef0e;return _0x35ef0e;})[_0xb7f2('0x1b')](handleEntityNotFound(_0x3e099c,null))['then'](removeEntity(_0x3e099c,null))['then'](function(){if(_0x4ad5f9){return db[_0xb7f2('0x21')][_0xb7f2('0x39')]({'where':{'type':_0x4ad5f9[_0xb7f2('0x24')]},'raw':!![]});}})[_0xb7f2('0x1b')](function(_0x5021f9){if(_0x4ad5f9[_0xb7f2('0x24')][_0xb7f2('0x41')]()==_0xb7f2('0x42')){var _0x1f2eb8=fs['readFileSync'](path['join'](config[_0xb7f2('0x45')],_0xb7f2('0x46')),_0xb7f2('0x47'));var _0x43d06c=ejs['render'](_0x1f2eb8,{'networks':_0x5021f9||[]});fs[_0xb7f2('0x4f')](_0xb7f2('0x48'),_0x43d06c);return respondWithRpcPromise(_0xb7f2('0x49'),_0xb7f2('0x1c'),{'module':_0xb7f2('0x4a')});}else if(_0x4ad5f9[_0xb7f2('0x24')][_0xb7f2('0x41')]()==_0xb7f2('0x54')){var _0x34104e=fs[_0xb7f2('0x43')](path[_0xb7f2('0x44')](config[_0xb7f2('0x45')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x54a490=ejs['render'](_0x34104e,{'networks':_0x5021f9||[]});fs[_0xb7f2('0x4f')](_0xb7f2('0x4d'),_0x54a490);return respondWithRpcPromise('Reload',_0xb7f2('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x1e8a26=fs[_0xb7f2('0x43')](path['join'](config[_0xb7f2('0x45')],'server/files/templates/network.ejs'),_0xb7f2('0x47'));var _0x26433d=ejs[_0xb7f2('0x4c')](_0x1e8a26,{'networks':_0x5021f9||[]});fs[_0xb7f2('0x4f')](util[_0xb7f2('0x50')](_0xb7f2('0x51'),_0x4ad5f9['type'][_0xb7f2('0x53')]()),_0x26433d);return respondWithRpcPromise('Reload','destroy',{'module':'chan_sip.so'});}})[_0xb7f2('0x13')](handleError(_0x3e099c,null));}; \ No newline at end of file +var _0x90ab=['request','then','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','status','json','undefined','limit','count','offset','set','Content-Range','destroy','end','sendStatus','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','include','Network','catch','show','params','rawAttributes','create','body','findAll','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','update','server/files/templates/turn_multiple.ejs','util','path','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http'];(function(_0x53fea5,_0x114ca5){var _0x46372f=function(_0x5b02c2){while(--_0x5b02c2){_0x53fea5['push'](_0x53fea5['shift']());}};_0x46372f(++_0x114ca5);}(_0x90ab,0xa4));var _0xb90a=function(_0x498c78,_0x2eab48){_0x498c78=_0x498c78-0x0;var _0xb7697f=_0x90ab[_0x498c78];return _0xb7697f;};'use strict';var util=require(_0xb90a('0x0'));var path=require(_0xb90a('0x1'));var ejs=require(_0xb90a('0x2'));var fs=require('fs');var _=require(_0xb90a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xb90a('0x4'))(_0xb90a('0x5'));var config=require(_0xb90a('0x6'));var db=require(_0xb90a('0x7'))['db'];var jayson=require(_0xb90a('0x8'));var client=jayson['client'][_0xb90a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d767c,_0x52de80,_0xb621c,_0x2bac79){return new Promise(function(_0x38324e,_0x4f7fbf){var _0x5a7f1d=_0x2bac79||client;return _0x5a7f1d[_0xb90a('0xa')](_0x8d767c,_0xb621c)[_0xb90a('0xb')](function(_0x3e41fd){logger['info']('Network,\x20%s,\x20%s',_0x52de80,_0xb90a('0xc'));logger[_0xb90a('0xd')](_0xb90a('0xe'),_0x52de80,_0xb90a('0xc'),JSON[_0xb90a('0xf')](_0x3e41fd));if(_0x3e41fd[_0xb90a('0x10')]){if(_0x3e41fd[_0xb90a('0x10')][_0xb90a('0x11')]===0x1f4){logger[_0xb90a('0x10')](_0xb90a('0x12'),_0x52de80,_0x3e41fd['error']['message']);return _0x4f7fbf(_0x3e41fd['error'][_0xb90a('0x13')]);}logger['error'](_0xb90a('0x12'),_0x52de80,_0x3e41fd[_0xb90a('0x10')][_0xb90a('0x13')]);return _0x38324e(_0x3e41fd['error']['message']);}else{logger[_0xb90a('0x14')]('Network,\x20%s,\x20%s',_0x52de80,_0xb90a('0xc'));_0x38324e(_0x3e41fd[_0xb90a('0x15')][_0xb90a('0x13')]);}})['catch'](function(_0x59a560){logger['error'](_0xb90a('0x12'),_0x52de80,_0x59a560);_0x4f7fbf(_0x59a560);});});}function respondWithResult(_0x14f8b2,_0x113d58){_0x113d58=_0x113d58||0xc8;return function(_0x287295){if(_0x287295){return _0x14f8b2[_0xb90a('0x16')](_0x113d58)[_0xb90a('0x17')](_0x287295);}};}function respondWithFilteredResult(_0x46904b,_0x2d3b51){return function(_0x4f06b6){if(_0x4f06b6){var _0x30644c=typeof _0x2d3b51['offset']===_0xb90a('0x18')&&typeof _0x2d3b51[_0xb90a('0x19')]===_0xb90a('0x18');var _0x64d326=_0x4f06b6[_0xb90a('0x1a')];var _0x372d89=_0x30644c?0x0:_0x2d3b51[_0xb90a('0x1b')];var _0x3c2662=_0x30644c?_0x4f06b6[_0xb90a('0x1a')]:_0x2d3b51['offset']+_0x2d3b51[_0xb90a('0x19')];var _0x35656b;if(_0x3c2662>=_0x64d326){_0x3c2662=_0x64d326;_0x35656b=0xc8;}else{_0x35656b=0xce;}_0x46904b[_0xb90a('0x16')](_0x35656b);return _0x46904b[_0xb90a('0x1c')](_0xb90a('0x1d'),_0x372d89+'-'+_0x3c2662+'/'+_0x64d326)[_0xb90a('0x17')](_0x4f06b6);}return null;};}function saveUpdates(_0x4ad57b){return function(_0x55b4dc){if(_0x55b4dc){return _0x55b4dc['update'](_0x4ad57b)[_0xb90a('0xb')](function(_0x2a9de6){return _0x2a9de6;});}return null;};}function removeEntity(_0x2b9129){return function(_0x417a90){if(_0x417a90){return _0x417a90[_0xb90a('0x1e')]()[_0xb90a('0xb')](function(){_0x2b9129[_0xb90a('0x16')](0xcc)[_0xb90a('0x1f')]();});}};}function handleEntityNotFound(_0x145c70){return function(_0x51643e){if(!_0x51643e){_0x145c70[_0xb90a('0x20')](0x194);}return _0x51643e;};}function handleError(_0x2428cb,_0x2dd9d0){_0x2dd9d0=_0x2dd9d0||0x1f4;return function(_0x379674){logger[_0xb90a('0x10')](_0x379674[_0xb90a('0x21')]);if(_0x379674['name']){delete _0x379674[_0xb90a('0x22')];}_0x2428cb[_0xb90a('0x16')](_0x2dd9d0)[_0xb90a('0x23')](_0x379674);};}exports['index']=function(_0x26be28,_0x4ca654){var _0x1e1db4={},_0xc0d594={},_0x1b88ab={'count':0x0,'rows':[]};var _0x5be761=_[_0xb90a('0x24')](db['Network']['rawAttributes'],function(_0x36e0a9){return{'name':_0x36e0a9[_0xb90a('0x25')],'type':_0x36e0a9[_0xb90a('0x26')][_0xb90a('0x27')]};});_0xc0d594[_0xb90a('0x28')]=_[_0xb90a('0x24')](_0x5be761,'name');_0xc0d594[_0xb90a('0x29')]=_[_0xb90a('0x2a')](_0x26be28[_0xb90a('0x29')]);_0xc0d594[_0xb90a('0x2b')]=_['intersection'](_0xc0d594[_0xb90a('0x28')],_0xc0d594['query']);_0x1e1db4[_0xb90a('0x2c')]=_[_0xb90a('0x2d')](_0xc0d594[_0xb90a('0x28')],qs[_0xb90a('0x2e')](_0x26be28[_0xb90a('0x29')]['fields']));_0x1e1db4[_0xb90a('0x2c')]=_0x1e1db4[_0xb90a('0x2c')][_0xb90a('0x2f')]?_0x1e1db4['attributes']:_0xc0d594[_0xb90a('0x28')];if(!_0x26be28[_0xb90a('0x29')]['hasOwnProperty'](_0xb90a('0x30'))){_0x1e1db4[_0xb90a('0x19')]=qs[_0xb90a('0x19')](_0x26be28[_0xb90a('0x29')][_0xb90a('0x19')]);_0x1e1db4['offset']=qs[_0xb90a('0x1b')](_0x26be28[_0xb90a('0x29')][_0xb90a('0x1b')]);}_0x1e1db4[_0xb90a('0x31')]=qs[_0xb90a('0x32')](_0x26be28[_0xb90a('0x29')][_0xb90a('0x32')]);_0x1e1db4[_0xb90a('0x33')]=qs[_0xb90a('0x2b')](_['pick'](_0x26be28[_0xb90a('0x29')],_0xc0d594['filters']),_0x5be761);if(_0x26be28[_0xb90a('0x29')]['filter']){_0x1e1db4['where']=_[_0xb90a('0x34')](_0x1e1db4[_0xb90a('0x33')],{'$or':_['map'](_0x5be761,function(_0x3cad25){if(_0x3cad25[_0xb90a('0x26')]!=='VIRTUAL'){var _0x452f82={};_0x452f82[_0x3cad25['name']]={'$like':'%'+_0x26be28['query'][_0xb90a('0x35')]+'%'};return _0x452f82;}})});}_0x1e1db4=_[_0xb90a('0x34')]({},_0x1e1db4,_0x26be28[_0xb90a('0x36')]);var _0x11c8c1={'where':_0x1e1db4[_0xb90a('0x33')]};return db['Network'][_0xb90a('0x1a')](_0x11c8c1)['then'](function(_0x45802a){_0x1b88ab[_0xb90a('0x1a')]=_0x45802a;if(_0x26be28[_0xb90a('0x29')][_0xb90a('0x37')]){_0x1e1db4[_0xb90a('0x38')]=[{'all':!![]}];}return db[_0xb90a('0x39')]['findAll'](_0x1e1db4);})['then'](function(_0x30f06f){_0x1b88ab['rows']=_0x30f06f;return _0x1b88ab;})[_0xb90a('0xb')](respondWithFilteredResult(_0x4ca654,_0x1e1db4))[_0xb90a('0x3a')](handleError(_0x4ca654,null));};exports[_0xb90a('0x3b')]=function(_0x82190f,_0x4ed055){var _0x2d8ab9={'raw':!![],'where':{'id':_0x82190f[_0xb90a('0x3c')]['id']}},_0x2fd0cf={};_0x2fd0cf[_0xb90a('0x28')]=_[_0xb90a('0x2a')](db[_0xb90a('0x39')][_0xb90a('0x3d')]);_0x2fd0cf[_0xb90a('0x29')]=_[_0xb90a('0x2a')](_0x82190f[_0xb90a('0x29')]);_0x2fd0cf[_0xb90a('0x2b')]=_['intersection'](_0x2fd0cf[_0xb90a('0x28')],_0x2fd0cf['query']);_0x2d8ab9[_0xb90a('0x2c')]=_[_0xb90a('0x2d')](_0x2fd0cf[_0xb90a('0x28')],qs[_0xb90a('0x2e')](_0x82190f['query'][_0xb90a('0x2e')]));_0x2d8ab9[_0xb90a('0x2c')]=_0x2d8ab9[_0xb90a('0x2c')][_0xb90a('0x2f')]?_0x2d8ab9['attributes']:_0x2fd0cf[_0xb90a('0x28')];if(_0x82190f[_0xb90a('0x29')][_0xb90a('0x37')]){_0x2d8ab9[_0xb90a('0x38')]=[{'all':!![]}];}_0x2d8ab9=_[_0xb90a('0x34')]({},_0x2d8ab9,_0x82190f[_0xb90a('0x36')]);return db[_0xb90a('0x39')]['find'](_0x2d8ab9)[_0xb90a('0xb')](handleEntityNotFound(_0x4ed055,null))[_0xb90a('0xb')](respondWithResult(_0x4ed055,null))['catch'](handleError(_0x4ed055,null));};exports['create']=function(_0x20f83f,_0x2c8d4f){var _0x4dddae;return db[_0xb90a('0x39')][_0xb90a('0x3e')](_0x20f83f[_0xb90a('0x3f')],{'raw':!![]})[_0xb90a('0xb')](function(_0x57cec6){_0x4dddae=_0x57cec6;return db[_0xb90a('0x39')][_0xb90a('0x40')]({'where':{'type':_0x20f83f[_0xb90a('0x3f')][_0xb90a('0x26')]},'raw':!![]});})['then'](function(_0x52a65e){if(_0x4dddae[_0xb90a('0x26')][_0xb90a('0x41')]()==_0xb90a('0x42')){var _0x25891d=fs[_0xb90a('0x43')](path[_0xb90a('0x44')](config[_0xb90a('0x45')],_0xb90a('0x46')),_0xb90a('0x47'));var _0x358f1c=ejs[_0xb90a('0x48')](_0x25891d,{'networks':_0x52a65e||[]});fs[_0xb90a('0x49')](_0xb90a('0x4a'),_0x358f1c);return respondWithRpcPromise(_0xb90a('0x4b'),_0xb90a('0x3e'),{'module':_0xb90a('0x4c')});}else if(_0x4dddae[_0xb90a('0x26')][_0xb90a('0x41')]()==_0xb90a('0x4d')){var _0x2ae2b8=fs[_0xb90a('0x43')](path['join'](config[_0xb90a('0x45')],'server/files/templates/turn_multiple.ejs'),_0xb90a('0x47'));var _0x4c94bd=ejs[_0xb90a('0x48')](_0x2ae2b8,{'networks':_0x52a65e||[]});fs['writeFileSync'](_0xb90a('0x4e'),_0x4c94bd);return respondWithRpcPromise('Reload','create',{'module':_0xb90a('0x4c')});}else{var _0x53b3a3=fs[_0xb90a('0x43')](path['join'](config[_0xb90a('0x45')],_0xb90a('0x4f')),_0xb90a('0x47'));var _0xcfae18=ejs['render'](_0x53b3a3,{'networks':_0x52a65e||[]});fs[_0xb90a('0x49')](util[_0xb90a('0x50')](_0xb90a('0x51'),_0x20f83f[_0xb90a('0x3f')][_0xb90a('0x26')][_0xb90a('0x52')]()),_0xcfae18);return respondWithRpcPromise(_0xb90a('0x4b'),'create',{'module':_0xb90a('0x53')});}})[_0xb90a('0xb')](function(){return _0x4dddae;})[_0xb90a('0xb')](respondWithResult(_0x2c8d4f,0xc9))[_0xb90a('0x3a')](handleError(_0x2c8d4f,null));};exports['update']=function(_0x5f19ab,_0x4ecc26){var _0x142597;return db[_0xb90a('0x39')][_0xb90a('0x54')]({'where':{'id':_0x5f19ab['params']['id']}})[_0xb90a('0xb')](handleEntityNotFound(_0x4ecc26,null))['then'](saveUpdates(_0x5f19ab[_0xb90a('0x3f')],null))[_0xb90a('0xb')](function(_0x191428){if(_0x191428){_0x142597=_0x191428;return db[_0xb90a('0x39')][_0xb90a('0x40')]({'where':{'type':_0x142597[_0xb90a('0x26')]},'raw':!![]});}return null;})[_0xb90a('0xb')](function(_0x3f84a7){if(_0x142597[_0xb90a('0x26')][_0xb90a('0x41')]()==_0xb90a('0x42')){var _0x3442ed=fs[_0xb90a('0x43')](path[_0xb90a('0x44')](config['root'],_0xb90a('0x46')),_0xb90a('0x47'));var _0x13b70f=ejs[_0xb90a('0x48')](_0x3442ed,{'networks':_0x3f84a7||[]});fs[_0xb90a('0x49')]('/etc/asterisk/stun_xcally.conf',_0x13b70f);return respondWithRpcPromise(_0xb90a('0x4b'),_0xb90a('0x55'),{'module':_0xb90a('0x4c')});}else if(_0x142597['type'][_0xb90a('0x41')]()==_0xb90a('0x4d')){var _0x627be2=fs['readFileSync'](path['join'](config[_0xb90a('0x45')],_0xb90a('0x56')),_0xb90a('0x47'));var _0x377661=ejs[_0xb90a('0x48')](_0x627be2,{'networks':_0x3f84a7||[]});fs[_0xb90a('0x49')]('/etc/asterisk/turn_xcally.conf',_0x377661);return respondWithRpcPromise(_0xb90a('0x4b'),'update',{'module':'res_stun_monitor.so'});}else{var _0x1aa4c6=fs['readFileSync'](path[_0xb90a('0x44')](config[_0xb90a('0x45')],'server/files/templates/network.ejs'),_0xb90a('0x47'));var _0x375411=ejs[_0xb90a('0x48')](_0x1aa4c6,{'networks':_0x3f84a7||[]});fs[_0xb90a('0x49')](util[_0xb90a('0x50')](_0xb90a('0x51'),_0x5f19ab[_0xb90a('0x3f')]['type']['toLowerCase']()),_0x375411);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}})['then'](function(_0x13e7cd){if(_0x13e7cd){return _0x142597;}return null;})[_0xb90a('0xb')](respondWithResult(_0x4ecc26,null))[_0xb90a('0x3a')](handleError(_0x4ecc26,null));};exports[_0xb90a('0x1e')]=function(_0x341116,_0x39de8a){var _0x44eda9;return db[_0xb90a('0x39')][_0xb90a('0x54')]({'where':{'id':_0x341116[_0xb90a('0x3c')]['id']}})['then'](function(_0x1bd57d){_0x44eda9=_0x1bd57d;return _0x1bd57d;})[_0xb90a('0xb')](handleEntityNotFound(_0x39de8a,null))[_0xb90a('0xb')](removeEntity(_0x39de8a,null))[_0xb90a('0xb')](function(){if(_0x44eda9){return db[_0xb90a('0x39')][_0xb90a('0x40')]({'where':{'type':_0x44eda9['type']},'raw':!![]});}})[_0xb90a('0xb')](function(_0x440da3){if(_0x44eda9[_0xb90a('0x26')][_0xb90a('0x41')]()=='STUN'){var _0x390a1f=fs[_0xb90a('0x43')](path[_0xb90a('0x44')](config[_0xb90a('0x45')],_0xb90a('0x46')),_0xb90a('0x47'));var _0x3ba41b=ejs[_0xb90a('0x48')](_0x390a1f,{'networks':_0x440da3||[]});fs[_0xb90a('0x49')](_0xb90a('0x4a'),_0x3ba41b);return respondWithRpcPromise(_0xb90a('0x4b'),_0xb90a('0x1e'),{'module':_0xb90a('0x4c')});}else if(_0x44eda9[_0xb90a('0x26')][_0xb90a('0x41')]()==_0xb90a('0x4d')){var _0x19b138=fs[_0xb90a('0x43')](path['join'](config[_0xb90a('0x45')],_0xb90a('0x56')),'utf8');var _0x3b9ad5=ejs['render'](_0x19b138,{'networks':_0x440da3||[]});fs[_0xb90a('0x49')]('/etc/asterisk/turn_xcally.conf',_0x3b9ad5);return respondWithRpcPromise(_0xb90a('0x4b'),_0xb90a('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x376f50=fs['readFileSync'](path[_0xb90a('0x44')](config[_0xb90a('0x45')],_0xb90a('0x4f')),_0xb90a('0x47'));var _0x311347=ejs[_0xb90a('0x48')](_0x376f50,{'networks':_0x440da3||[]});fs[_0xb90a('0x49')](util[_0xb90a('0x50')]('/etc/asterisk/sip_xcally_%s.conf',_0x44eda9[_0xb90a('0x26')]['toLowerCase']()),_0x311347);return respondWithRpcPromise('Reload',_0xb90a('0x1e'),{'module':'chan_sip.so'});}})[_0xb90a('0x3a')](handleError(_0x39de8a,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ea979bc..2c2e529 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 _0x87ae=['define','Network','../../config/logger','bluebird','request-promise','path','../../config/environment','./network.attributes','exports'];(function(_0x4a9b0b,_0x2cd1aa){var _0xac05be=function(_0x46e423){while(--_0x46e423){_0x4a9b0b['push'](_0x4a9b0b['shift']());}};_0xac05be(++_0x2cd1aa);}(_0x87ae,0xf5));var _0xe87a=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0x87ae[_0x469a3c];return _0x968f4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe87a('0x0'))('api');var moment=require('moment');var BPromise=require(_0xe87a('0x1'));var rp=require(_0xe87a('0x2'));var fs=require('fs');var path=require(_0xe87a('0x3'));var rimraf=require('rimraf');var config=require(_0xe87a('0x4'));var attributes=require(_0xe87a('0x5'));module[_0xe87a('0x6')]=function(_0x5ef978,_0x4b9934){return _0x5ef978[_0xe87a('0x7')](_0xe87a('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf6e=['./network.attributes','exports','define','Network','network','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b9041,_0x3516ee){var _0x38094e=function(_0x127c4b){while(--_0x127c4b){_0x5b9041['push'](_0x5b9041['shift']());}};_0x38094e(++_0x3516ee);}(_0xbf6e,0x149));var _0xebf6=function(_0x17e88d,_0x5330f7){_0x17e88d=_0x17e88d-0x0;var _0x52137a=_0xbf6e[_0x17e88d];return _0x52137a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xebf6('0x0'))(_0xebf6('0x1'));var moment=require(_0xebf6('0x2'));var BPromise=require(_0xebf6('0x3'));var rp=require(_0xebf6('0x4'));var fs=require('fs');var path=require(_0xebf6('0x5'));var rimraf=require(_0xebf6('0x6'));var config=require('../../config/environment');var attributes=require(_0xebf6('0x7'));module[_0xebf6('0x8')]=function(_0x3b2bb6,_0x1e15cf){return _0x3b2bb6[_0xebf6('0x9')](_0xebf6('0xa'),attributes,{'tableName':_0xebf6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index e6b82ff..015d5cd 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1f1020,_0x166ed7){var _0x36bda0=function(_0x14b530){while(--_0x14b530){_0x1f1020['push'](_0x1f1020['shift']());}};_0x36bda0(++_0x166ed7);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e2725,_0x505fd1){var _0x32b9be=function(_0x166954){while(--_0x166954){_0x1e2725['push'](_0x1e2725['shift']());}};_0x32b9be(++_0x505fd1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index b414bb3..31a764e 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 _0x1382=['describe','/:id','/:id/dispositions','getDispositions','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','put','update','destroy','removeDispositions','delete','removeAnswers','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5099db,_0x40d4d1){var _0x19fab9=function(_0x4b4172){while(--_0x4b4172){_0x5099db['push'](_0x5099db['shift']());}};_0x19fab9(++_0x40d4d1);}(_0x1382,0x1e5));var _0x2138=function(_0x126c43,_0x4844fd){_0x126c43=_0x126c43-0x0;var _0x58141c=_0x1382[_0x126c43];return _0x58141c;};'use strict';var multer=require(_0x2138('0x0'));var util=require('util');var path=require(_0x2138('0x1'));var timeout=require(_0x2138('0x2'));var express=require(_0x2138('0x3'));var router=express[_0x2138('0x4')]();var fs_extra=require(_0x2138('0x5'));var auth=require(_0x2138('0x6'));var interaction=require(_0x2138('0x7'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x2138('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x2138('0x9')](),controller[_0x2138('0xa')]);router[_0x2138('0x8')](_0x2138('0xb'),auth[_0x2138('0x9')](),controller['show']);router[_0x2138('0x8')](_0x2138('0xc'),auth['isAuthenticated'](),controller[_0x2138('0xd')]);router[_0x2138('0x8')]('/:id/canned_answers',auth[_0x2138('0x9')](),controller['getAnswers']);router[_0x2138('0x8')](_0x2138('0xe'),auth[_0x2138('0x9')](),controller['getApplications']);router[_0x2138('0x8')](_0x2138('0xf'),auth[_0x2138('0x9')](),controller[_0x2138('0x10')]);router['get'](_0x2138('0x11'),auth[_0x2138('0x9')](),controller[_0x2138('0x12')]);router[_0x2138('0x13')]('/',auth[_0x2138('0x9')](),controller[_0x2138('0x14')]);router['post'](_0x2138('0xc'),auth['isAuthenticated'](),controller[_0x2138('0x15')]);router[_0x2138('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x2138('0x13')](_0x2138('0x16'),controller['notify']);router['post'](_0x2138('0xe'),auth[_0x2138('0x9')](),controller[_0x2138('0x17')]);router['post'](_0x2138('0x11'),auth[_0x2138('0x9')](),controller[_0x2138('0x18')]);router[_0x2138('0x13')](_0x2138('0x19'),auth[_0x2138('0x9')](),controller['send']);router[_0x2138('0x1a')](_0x2138('0xb'),auth['isAuthenticated'](),controller[_0x2138('0x1b')]);router['delete']('/:id',auth[_0x2138('0x9')](),controller[_0x2138('0x1c')]);router['delete']('/:id/dispositions',auth[_0x2138('0x9')](),controller[_0x2138('0x1d')]);router[_0x2138('0x1e')]('/:id/canned_answers',auth[_0x2138('0x9')](),controller[_0x2138('0x1f')]);router[_0x2138('0x1e')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x2138('0x20')]=router; \ No newline at end of file +var _0xccf9=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','getAgents','post','create','addDisposition','/:id/notify','addApplications','/:id/users','addAgents','/:id/send','send','delete','destroy','removeAgents'];(function(_0xe2206b,_0x158dbd){var _0x3ebe97=function(_0x4b88a6){while(--_0x4b88a6){_0xe2206b['push'](_0xe2206b['shift']());}};_0x3ebe97(++_0x158dbd);}(_0xccf9,0x1c7));var _0x9ccf=function(_0x5138ee,_0x9eb4b9){_0x5138ee=_0x5138ee-0x0;var _0x138e1a=_0xccf9[_0x5138ee];return _0x138e1a;};'use strict';var multer=require(_0x9ccf('0x0'));var util=require(_0x9ccf('0x1'));var path=require(_0x9ccf('0x2'));var timeout=require(_0x9ccf('0x3'));var express=require(_0x9ccf('0x4'));var router=express['Router']();var fs_extra=require(_0x9ccf('0x5'));var auth=require(_0x9ccf('0x6'));var interaction=require(_0x9ccf('0x7'));var config=require(_0x9ccf('0x8'));var controller=require(_0x9ccf('0x9'));router[_0x9ccf('0xa')]('/',auth['isAuthenticated'](),controller[_0x9ccf('0xb')]);router['get'](_0x9ccf('0xc'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0xe')]);router[_0x9ccf('0xa')](_0x9ccf('0xf'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x10')]);router[_0x9ccf('0xa')](_0x9ccf('0x11'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x12')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x9ccf('0x13'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x14')]);router[_0x9ccf('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9ccf('0x15')]);router[_0x9ccf('0xa')]('/:id/users',auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x16')]);router[_0x9ccf('0x17')]('/',auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x18')]);router[_0x9ccf('0x17')]('/:id/dispositions',auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x19')]);router[_0x9ccf('0x17')]('/:id/canned_answers',auth[_0x9ccf('0xd')](),controller['addAnswer']);router[_0x9ccf('0x17')](_0x9ccf('0x1a'),controller['notify']);router[_0x9ccf('0x17')](_0x9ccf('0x13'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x1b')]);router[_0x9ccf('0x17')](_0x9ccf('0x1c'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x1d')]);router[_0x9ccf('0x17')](_0x9ccf('0x1e'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x1f')]);router['put'](_0x9ccf('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x9ccf('0x20')](_0x9ccf('0xf'),auth[_0x9ccf('0xd')](),controller[_0x9ccf('0x21')]);router[_0x9ccf('0x20')](_0x9ccf('0x11'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x9ccf('0x20')]('/:id/canned_answers',auth[_0x9ccf('0xd')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9ccf('0x22')]);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 82550ca..eb51d22 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 _0xaf01=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','TEXT','BOOLEAN','INTEGER'];(function(_0x1fea7e,_0x17d57e){var _0x270ee5=function(_0x5eb548){while(--_0x5eb548){_0x1fea7e['push'](_0x1fea7e['shift']());}};_0x270ee5(++_0x17d57e);}(_0xaf01,0x142));var _0x1af0=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xaf01[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x1af0('0x0'));var rs=require(_0x1af0('0x1'));module[_0x1af0('0x2')]={'name':{'type':Sequelize[_0x1af0('0x3')],'unique':_0x1af0('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x1af0('0x3')]},'token':{'type':Sequelize[_0x1af0('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x1af0('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1af0('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1af0('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1af0('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1af0('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1af0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1af0('0x3')]},'queueTransfer':{'type':Sequelize[_0x1af0('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1af0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1af0('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1af0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1af0('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1af0('0x9'),'set':function(_0x2162d3){if(!_0x2162d3)this['setDataValue'](_0x1af0('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x2162d3);}}}; \ No newline at end of file +var _0x8a4d=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','randomstring','STRING','name','generate','TEXT','BOOLEAN'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x8a4d,0x14f));var _0xd8a4=function(_0x4f8f3b,_0x43281b){_0x4f8f3b=_0x4f8f3b-0x0;var _0x4c250c=_0x8a4d[_0x4f8f3b];return _0x4c250c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xd8a4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd8a4('0x1')],'unique':_0xd8a4('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xd8a4('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd8a4('0x3')]();}},'replyUri':{'type':Sequelize[_0xd8a4('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xd8a4('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd8a4('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd8a4('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xd8a4('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd8a4('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8a4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8a4('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xd8a4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xd8a4('0x5')],'defaultValue':![],'comment':_0xd8a4('0x8'),'set':function(_0x5b2946){if(!_0x5b2946)this['setDataValue'](_0xd8a4('0x9'),null);this[_0xd8a4('0xa')]('mandatoryDisposition',_0x5b2946);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index bd4e78e..8f1fbc7 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 _0x3164=['getAgents','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','get','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','keys','query','filters','model','intersection','fields','attributes','length','nolimit','sort','pick','where','merge','options','include','findAll','rows','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','OpenchannelAccountId','filter','removeDispositions','addAnswer','CannedAnswer','order','includeAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','List','account','applications','orderBy','Applications','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','Contact','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x3164,0x182));var _0x4316=function(_0x48245e,_0x178e51){_0x48245e=_0x48245e-0x0;var _0x4e5e30=_0x3164[_0x48245e];return _0x4e5e30;};'use strict';var emlformat=require(_0x4316('0x0'));var rimraf=require(_0x4316('0x1'));var zipdir=require(_0x4316('0x2'));var jsonpatch=require(_0x4316('0x3'));var rp=require(_0x4316('0x4'));var moment=require('moment');var BPromise=require(_0x4316('0x5'));var Mustache=require(_0x4316('0x6'));var util=require(_0x4316('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4316('0x8'));var ejs=require(_0x4316('0x9'));var fs=require('fs');var fs_extra=require(_0x4316('0xa'));var _=require(_0x4316('0xb'));var squel=require(_0x4316('0xc'));var crypto=require(_0x4316('0xd'));var jsforce=require(_0x4316('0xe'));var deskjs=require(_0x4316('0xf'));var toCsv=require(_0x4316('0x8'));var querystring=require(_0x4316('0x10'));var Papa=require(_0x4316('0x11'));var Redis=require(_0x4316('0x12'));var authService=require(_0x4316('0x13'));var qs=require(_0x4316('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4316('0x15'));var logger=require(_0x4316('0x16'))(_0x4316('0x17'));var utils=require(_0x4316('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4316('0x19'));var db=require(_0x4316('0x1a'))['db'];config[_0x4316('0x1b')]=_[_0x4316('0x1c')](config['redis'],{'host':_0x4316('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x4316('0x1e')](socket);var jayson=require(_0x4316('0x1f'));var client=jayson['client'][_0x4316('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x4316('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3e9ab8,_0x211d87,_0x1caa59,_0x2e1923){return new BPromise(function(_0x2d579f,_0x9f47fc){var _0x38e68c=_0x2e1923||client;return _0x38e68c[_0x4316('0x21')](_0x3e9ab8,_0x1caa59)[_0x4316('0x22')](function(_0x5a414f){logger[_0x4316('0x23')](_0x4316('0x24'),_0x211d87,'request\x20sent');logger['debug'](_0x4316('0x25'),_0x211d87,_0x4316('0x26'),JSON[_0x4316('0x27')](_0x5a414f));if(_0x5a414f[_0x4316('0x28')]){if(_0x5a414f[_0x4316('0x28')]['code']===0x1f4){logger[_0x4316('0x28')](_0x4316('0x24'),_0x211d87,_0x5a414f['error'][_0x4316('0x29')]);return _0x9f47fc(_0x5a414f[_0x4316('0x28')][_0x4316('0x29')]);}logger['error'](_0x4316('0x24'),_0x211d87,_0x5a414f[_0x4316('0x28')][_0x4316('0x29')]);return _0x2d579f(_0x5a414f['error'][_0x4316('0x29')]);}else{logger[_0x4316('0x23')](_0x4316('0x24'),_0x211d87,_0x4316('0x26'));_0x2d579f(_0x5a414f[_0x4316('0x2a')][_0x4316('0x29')]);}})[_0x4316('0x2b')](function(_0x46bd61){logger[_0x4316('0x28')](_0x4316('0x24'),_0x211d87,_0x46bd61);_0x9f47fc(_0x46bd61);});});}function respondWithStatusCode(_0x2c8944,_0x40ca68){_0x40ca68=_0x40ca68||0xcc;return function(_0x89e0d7){if(_0x89e0d7){return _0x2c8944[_0x4316('0x2c')](_0x40ca68);}return _0x2c8944[_0x4316('0x2d')](_0x40ca68)[_0x4316('0x2e')]();};}function respondWithResult(_0x28e2a2,_0x4cdb10){_0x4cdb10=_0x4cdb10||0xc8;return function(_0x522ced){if(_0x522ced){return _0x28e2a2[_0x4316('0x2d')](_0x4cdb10)[_0x4316('0x2f')](_0x522ced);}};}function respondWithFilteredResult(_0xa8dd01,_0x334f61){return function(_0xa1cb87){if(_0xa1cb87){var _0x55cfb2=typeof _0x334f61[_0x4316('0x30')]==='undefined'&&typeof _0x334f61[_0x4316('0x31')]==='undefined';var _0x46df48=_0xa1cb87['count'];var _0x205e3e=_0x55cfb2?0x0:_0x334f61[_0x4316('0x30')];var _0x4f88a2=_0x55cfb2?_0xa1cb87[_0x4316('0x32')]:_0x334f61['offset']+_0x334f61[_0x4316('0x31')];var _0x1b3db9;if(_0x4f88a2>=_0x46df48){_0x4f88a2=_0x46df48;_0x1b3db9=0xc8;}else{_0x1b3db9=0xce;}_0xa8dd01[_0x4316('0x2d')](_0x1b3db9);return _0xa8dd01[_0x4316('0x33')](_0x4316('0x34'),_0x205e3e+'-'+_0x4f88a2+'/'+_0x46df48)[_0x4316('0x2f')](_0xa1cb87);}return null;};}function patchUpdates(_0x3bcbee){return function(_0x9790b8){try{jsonpatch['apply'](_0x9790b8,_0x3bcbee,!![]);}catch(_0x9bf1ff){return BPromise[_0x4316('0x35')](_0x9bf1ff);}return _0x9790b8['save']();};}function saveUpdates(_0x48bba6,_0x5f3ff9){return function(_0x147ca0){if(_0x147ca0){return _0x147ca0[_0x4316('0x36')](_0x48bba6)[_0x4316('0x22')](function(_0x1aa5ae){return _0x1aa5ae;});}return null;};}function removeEntity(_0x552cd6,_0x67db3a){return function(_0x1a9bc7){if(_0x1a9bc7){return _0x1a9bc7[_0x4316('0x37')]()[_0x4316('0x22')](function(){var _0x221e73=_0x1a9bc7[_0x4316('0x38')]({'plain':!![]});var _0x4a7813=_0x4316('0x39');return db['UserProfileResource'][_0x4316('0x37')]({'where':{'type':_0x4a7813,'resourceId':_0x221e73['id']}})['then'](function(){return _0x1a9bc7;});})[_0x4316('0x22')](function(){_0x552cd6[_0x4316('0x2d')](0xcc)[_0x4316('0x2e')]();});}};}function handleEntityNotFound(_0x28491d,_0x4c880f){return function(_0x556276){if(!_0x556276){_0x28491d[_0x4316('0x2c')](0x194);}return _0x556276;};}function handleError(_0x5d9305,_0x2007bc){_0x2007bc=_0x2007bc||0x1f4;return function(_0x41208c){logger[_0x4316('0x28')](_0x41208c['stack']);if(_0x41208c[_0x4316('0x3a')]){delete _0x41208c[_0x4316('0x3a')];}_0x5d9305[_0x4316('0x2d')](_0x2007bc)[_0x4316('0x3b')](_0x41208c);};}exports[_0x4316('0x3c')]=function(_0xe93e4,_0xb05f2){var _0x12a47b={'include':[{'model':db[_0x4316('0x3d')],'as':_0x4316('0x3e')}]},_0x37c46d={},_0x23b02b={'count':0x0,'rows':[]};var _0x12402c=_[_0x4316('0x3f')](db[_0x4316('0x40')][_0x4316('0x41')],function(_0x29555b){return{'name':_0x29555b[_0x4316('0x42')],'type':_0x29555b[_0x4316('0x43')][_0x4316('0x44')]};});_0x37c46d['model']=_[_0x4316('0x3f')](_0x12402c,'name');_0x37c46d['query']=_[_0x4316('0x45')](_0xe93e4[_0x4316('0x46')]);_0x37c46d[_0x4316('0x47')]=_['intersection'](_0x37c46d[_0x4316('0x48')],_0x37c46d[_0x4316('0x46')]);_0x12a47b['attributes']=_[_0x4316('0x49')](_0x37c46d['model'],qs[_0x4316('0x4a')](_0xe93e4[_0x4316('0x46')][_0x4316('0x4a')]));_0x12a47b[_0x4316('0x4b')]=_0x12a47b['attributes'][_0x4316('0x4c')]?_0x12a47b[_0x4316('0x4b')]:_0x37c46d[_0x4316('0x48')];if(!_0xe93e4[_0x4316('0x46')]['hasOwnProperty'](_0x4316('0x4d'))){_0x12a47b[_0x4316('0x31')]=qs[_0x4316('0x31')](_0xe93e4[_0x4316('0x46')]['limit']);_0x12a47b['offset']=qs['offset'](_0xe93e4[_0x4316('0x46')][_0x4316('0x30')]);}_0x12a47b['order']=qs[_0x4316('0x4e')](_0xe93e4[_0x4316('0x46')][_0x4316('0x4e')]);_0x12a47b['where']=qs['filters'](_[_0x4316('0x4f')](_0xe93e4[_0x4316('0x46')],_0x37c46d['filters']),_0x12402c);if(_0xe93e4['query']['filter']){_0x12a47b[_0x4316('0x50')]=_[_0x4316('0x51')](_0x12a47b[_0x4316('0x50')],{'$or':_[_0x4316('0x3f')](_0x12402c,function(_0x414d33){if(_0x414d33[_0x4316('0x43')]!=='VIRTUAL'){var _0x475267={};_0x475267[_0x414d33[_0x4316('0x3a')]]={'$like':'%'+_0xe93e4[_0x4316('0x46')]['filter']+'%'};return _0x475267;}})});}_0x12a47b=_[_0x4316('0x51')]({},_0x12a47b,_0xe93e4[_0x4316('0x52')]);var _0x3ceb88={'where':_0x12a47b['where']};return db[_0x4316('0x40')][_0x4316('0x32')](_0x3ceb88)[_0x4316('0x22')](function(_0x2572e4){_0x23b02b[_0x4316('0x32')]=_0x2572e4;if(_0xe93e4[_0x4316('0x46')]['includeAll']){_0x12a47b[_0x4316('0x53')]=[{'all':!![]}];}return db[_0x4316('0x40')][_0x4316('0x54')](_0x12a47b);})[_0x4316('0x22')](function(_0x56d541){_0x23b02b[_0x4316('0x55')]=_0x56d541;return _0x23b02b;})['then'](respondWithFilteredResult(_0xb05f2,_0x12a47b))['catch'](handleError(_0xb05f2,null));};exports['show']=function(_0x102cb4,_0x48d01f){var _0x3c0d28={'raw':![],'where':{'id':_0x102cb4[_0x4316('0x56')]['id']},'include':[{'model':db[_0x4316('0x3d')],'as':_0x4316('0x3e')}]},_0x1df4d6={};_0x1df4d6[_0x4316('0x48')]=_[_0x4316('0x45')](db[_0x4316('0x40')][_0x4316('0x41')]);_0x1df4d6[_0x4316('0x46')]=_['keys'](_0x102cb4[_0x4316('0x46')]);_0x1df4d6['filters']=_[_0x4316('0x49')](_0x1df4d6[_0x4316('0x48')],_0x1df4d6[_0x4316('0x46')]);_0x3c0d28[_0x4316('0x4b')]=_[_0x4316('0x49')](_0x1df4d6[_0x4316('0x48')],qs['fields'](_0x102cb4[_0x4316('0x46')][_0x4316('0x4a')]));_0x3c0d28[_0x4316('0x4b')]=_0x3c0d28['attributes']['length']?_0x3c0d28[_0x4316('0x4b')]:_0x1df4d6[_0x4316('0x48')];if(_0x102cb4['query']['includeAll']){_0x3c0d28['include']=[{'all':!![]}];}_0x3c0d28=_[_0x4316('0x51')]({},_0x3c0d28,_0x102cb4[_0x4316('0x52')]);return db[_0x4316('0x40')][_0x4316('0x57')](_0x3c0d28)[_0x4316('0x22')](handleEntityNotFound(_0x48d01f,null))[_0x4316('0x22')](respondWithResult(_0x48d01f,null))[_0x4316('0x2b')](handleError(_0x48d01f,null));};exports['create']=function(_0x1155a7,_0x4b361f){return db['OpenchannelAccount'][_0x4316('0x58')](_0x1155a7[_0x4316('0x59')],{})[_0x4316('0x22')](function(_0x4c6f1c){var _0x2a0df6=_0x1155a7[_0x4316('0x5a')][_0x4316('0x38')]({'plain':!![]});if(!_0x2a0df6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a0df6[_0x4316('0x5b')]==='user'){var _0x23339c=_0x4c6f1c[_0x4316('0x38')]({'plain':!![]});var _0x3a9726='OpenchannelAccounts';return db[_0x4316('0x5c')]['find']({'where':{'name':_0x3a9726,'userProfileId':_0x2a0df6[_0x4316('0x5d')]},'raw':!![]})[_0x4316('0x22')](function(_0x10dd7c){if(_0x10dd7c&&_0x10dd7c[_0x4316('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x23339c[_0x4316('0x3a')],'resourceId':_0x23339c['id'],'type':_0x10dd7c[_0x4316('0x3a')],'sectionId':_0x10dd7c['id']},{})[_0x4316('0x22')](function(){return _0x4c6f1c;});}else{return _0x4c6f1c;}})[_0x4316('0x2b')](function(_0x344751){logger['error'](_0x4316('0x5f'),_0x344751);throw _0x344751;});}return _0x4c6f1c;})['then'](respondWithResult(_0x4b361f,0xc9))[_0x4316('0x2b')](handleError(_0x4b361f,null));};exports[_0x4316('0x36')]=function(_0xdbf006,_0xba5934){if(_0xdbf006['body']['id']){delete _0xdbf006[_0x4316('0x59')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xdbf006['params']['id']},'include':[{'model':db['Pause'],'as':_0x4316('0x3e')}]})[_0x4316('0x22')](handleEntityNotFound(_0xba5934,null))[_0x4316('0x22')](saveUpdates(_0xdbf006['body'],null))['then'](respondWithResult(_0xba5934,null))[_0x4316('0x2b')](handleError(_0xba5934,null));};exports[_0x4316('0x37')]=function(_0x28b5e3,_0x4b0b3a){return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x28b5e3[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x4b0b3a,null))[_0x4316('0x22')](removeEntity(_0x4b0b3a,null))[_0x4316('0x2b')](handleError(_0x4b0b3a,null));};exports['describe']=function(_0xc3ed86,_0x59de75){return db[_0x4316('0x40')][_0x4316('0x60')]()[_0x4316('0x22')](respondWithResult(_0x59de75,null))[_0x4316('0x2b')](handleError(_0x59de75,null));};exports[_0x4316('0x61')]=function(_0x4c7cc1,_0x3d918c,_0x1f370b){if(_0x4c7cc1['body']['id']){delete _0x4c7cc1[_0x4316('0x59')]['id'];}return db['OpenchannelAccount'][_0x4316('0x57')]({'where':{'id':_0x4c7cc1[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x3d918c,null))[_0x4316('0x22')](function(_0x3d380d){if(_0x3d380d){_0x4c7cc1[_0x4316('0x59')]['OpenchannelAccountId']=_0x3d380d['id'];return db[_0x4316('0x62')]['create'](_0x4c7cc1[_0x4316('0x59')]);}})[_0x4316('0x22')](respondWithResult(_0x3d918c,null))[_0x4316('0x2b')](handleError(_0x3d918c,null));};exports[_0x4316('0x63')]=function(_0x3b3da4,_0xd0e9c4,_0x5e76e7){var _0x36749a={'raw':![],'where':{}};var _0x269d4b={};var _0x21c199={'count':0x0,'rows':[]};return db[_0x4316('0x40')][_0x4316('0x64')]({'where':{'id':_0x3b3da4['params']['id']}})[_0x4316('0x22')](handleEntityNotFound(_0xd0e9c4,null))[_0x4316('0x22')](function(_0x54df95){if(_0x54df95){_0x269d4b[_0x4316('0x48')]=_['keys'](db[_0x4316('0x62')][_0x4316('0x41')]);_0x269d4b[_0x4316('0x46')]=_[_0x4316('0x45')](_0x3b3da4[_0x4316('0x46')]);_0x269d4b[_0x4316('0x47')]=_[_0x4316('0x49')](_0x269d4b['model'],_0x269d4b[_0x4316('0x46')]);_0x36749a[_0x4316('0x4b')]=_[_0x4316('0x49')](_0x269d4b['model'],qs[_0x4316('0x4a')](_0x3b3da4[_0x4316('0x46')][_0x4316('0x4a')]));_0x36749a['attributes']=_0x36749a['attributes'][_0x4316('0x4c')]?_0x36749a[_0x4316('0x4b')]:_0x269d4b[_0x4316('0x48')];if(!_0x3b3da4[_0x4316('0x46')][_0x4316('0x65')]('nolimit')){_0x36749a[_0x4316('0x31')]=qs[_0x4316('0x31')](_0x3b3da4[_0x4316('0x46')][_0x4316('0x31')]);_0x36749a[_0x4316('0x30')]=qs['offset'](_0x3b3da4[_0x4316('0x46')]['offset']);}_0x36749a['order']=qs[_0x4316('0x4e')](_0x3b3da4[_0x4316('0x46')][_0x4316('0x4e')]);_0x36749a[_0x4316('0x50')]=qs['filters'](_[_0x4316('0x4f')](_0x3b3da4['query'],_0x269d4b[_0x4316('0x47')]));_0x36749a['where'][_0x4316('0x66')]=_0x54df95['id'];if(_0x3b3da4[_0x4316('0x46')]['filter']){_0x36749a[_0x4316('0x50')]=_[_0x4316('0x51')](_0x36749a[_0x4316('0x50')],{'$or':_[_0x4316('0x3f')](_0x36749a[_0x4316('0x4b')],function(_0x2b60df){var _0x103e99={};_0x103e99[_0x2b60df]={'$like':'%'+_0x3b3da4[_0x4316('0x46')][_0x4316('0x67')]+'%'};return _0x103e99;})});}_0x36749a=_['merge']({},_0x36749a,_0x3b3da4[_0x4316('0x52')]);return db[_0x4316('0x62')][_0x4316('0x32')]({'where':_0x36749a['where']})['then'](function(_0x5bb974){_0x21c199['count']=_0x5bb974;if(_0x3b3da4[_0x4316('0x46')]['includeAll']){_0x36749a['include']=[{'all':!![]}];}return db['Disposition'][_0x4316('0x54')](_0x36749a);})[_0x4316('0x22')](function(_0x2d3560){_0x21c199[_0x4316('0x55')]=_0x2d3560;return _0x21c199;});}})[_0x4316('0x22')](respondWithFilteredResult(_0xd0e9c4,_0x36749a))[_0x4316('0x2b')](handleError(_0xd0e9c4,null));};exports['removeDispositions']=function(_0x102729,_0x3ce6df,_0x1b421a){return db['OpenchannelAccount'][_0x4316('0x57')]({'where':{'id':_0x102729['params']['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x3ce6df,null))[_0x4316('0x22')](function(_0x68a21a){if(_0x68a21a){return _0x68a21a[_0x4316('0x68')](_0x102729[_0x4316('0x46')]['ids']);}})[_0x4316('0x22')](respondWithStatusCode(_0x3ce6df,null))[_0x4316('0x2b')](handleError(_0x3ce6df,null));};exports[_0x4316('0x69')]=function(_0x52421d,_0x3e6e15,_0x5f3921){if(_0x52421d[_0x4316('0x59')]['id']){delete _0x52421d['body']['id'];}return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x52421d[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x3e6e15,null))[_0x4316('0x22')](function(_0x469547){if(_0x469547){_0x52421d['body']['OpenchannelAccountId']=_0x469547['id'];return db[_0x4316('0x6a')]['create'](_0x52421d[_0x4316('0x59')]);}})[_0x4316('0x22')](respondWithResult(_0x3e6e15,null))[_0x4316('0x2b')](handleError(_0x3e6e15,null));};exports['getAnswers']=function(_0x5e70fc,_0x2d61ad,_0x444637){var _0x236904={'raw':![],'where':{}};var _0x2bf04f={};var _0x1aa3da={'count':0x0,'rows':[]};return db[_0x4316('0x40')]['findOne']({'where':{'id':_0x5e70fc[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x2d61ad,null))['then'](function(_0x5270ef){if(_0x5270ef){_0x2bf04f[_0x4316('0x48')]=_['keys'](db[_0x4316('0x6a')]['rawAttributes']);_0x2bf04f[_0x4316('0x46')]=_[_0x4316('0x45')](_0x5e70fc[_0x4316('0x46')]);_0x2bf04f[_0x4316('0x47')]=_['intersection'](_0x2bf04f[_0x4316('0x48')],_0x2bf04f[_0x4316('0x46')]);_0x236904[_0x4316('0x4b')]=_[_0x4316('0x49')](_0x2bf04f[_0x4316('0x48')],qs[_0x4316('0x4a')](_0x5e70fc[_0x4316('0x46')]['fields']));_0x236904['attributes']=_0x236904[_0x4316('0x4b')][_0x4316('0x4c')]?_0x236904[_0x4316('0x4b')]:_0x2bf04f[_0x4316('0x48')];if(!_0x5e70fc['query'][_0x4316('0x65')]('nolimit')){_0x236904['limit']=qs[_0x4316('0x31')](_0x5e70fc[_0x4316('0x46')][_0x4316('0x31')]);_0x236904['offset']=qs[_0x4316('0x30')](_0x5e70fc[_0x4316('0x46')][_0x4316('0x30')]);}_0x236904[_0x4316('0x6b')]=qs['sort'](_0x5e70fc['query'][_0x4316('0x4e')]);_0x236904[_0x4316('0x50')]=qs[_0x4316('0x47')](_['pick'](_0x5e70fc[_0x4316('0x46')],_0x2bf04f[_0x4316('0x47')]));_0x236904[_0x4316('0x50')][_0x4316('0x66')]=_0x5270ef['id'];if(_0x5e70fc[_0x4316('0x46')][_0x4316('0x67')]){_0x236904[_0x4316('0x50')]=_[_0x4316('0x51')](_0x236904[_0x4316('0x50')],{'$or':_[_0x4316('0x3f')](_0x236904['attributes'],function(_0x2fff8e){var _0x1f7ca4={};_0x1f7ca4[_0x2fff8e]={'$like':'%'+_0x5e70fc['query']['filter']+'%'};return _0x1f7ca4;})});}_0x236904=_[_0x4316('0x51')]({},_0x236904,_0x5e70fc[_0x4316('0x52')]);return db[_0x4316('0x6a')]['count']({'where':_0x236904[_0x4316('0x50')]})[_0x4316('0x22')](function(_0x3757c3){_0x1aa3da[_0x4316('0x32')]=_0x3757c3;if(_0x5e70fc[_0x4316('0x46')][_0x4316('0x6c')]){_0x236904[_0x4316('0x53')]=[{'all':!![]}];}return db[_0x4316('0x6a')][_0x4316('0x54')](_0x236904);})[_0x4316('0x22')](function(_0x48de16){_0x1aa3da[_0x4316('0x55')]=_0x48de16;return _0x1aa3da;});}})[_0x4316('0x22')](respondWithFilteredResult(_0x2d61ad,_0x236904))['catch'](handleError(_0x2d61ad,null));};exports[_0x4316('0x6d')]=function(_0x27fa8f,_0x52ce2b,_0x1ab37b){return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x27fa8f[_0x4316('0x56')]['id']}})['then'](handleEntityNotFound(_0x52ce2b,null))['then'](function(_0x514795){if(_0x514795){return _0x514795[_0x4316('0x6d')](_0x27fa8f[_0x4316('0x46')][_0x4316('0x6e')]);}})[_0x4316('0x22')](respondWithStatusCode(_0x52ce2b,null))[_0x4316('0x2b')](handleError(_0x52ce2b,null));};exports[_0x4316('0x6f')]=function(_0x25e9cf,_0x1ae71e,_0x537611){var _0x16437c={'body':_0x25e9cf[_0x4316('0x59')],'channel':_0x4316('0x70')};var _0xb95b91=[];var _0x33eb5d=[];var _0x5265ba={};var _0x33b543=![];return db[_0x4316('0x71')][_0x4316('0x60')]()['then'](function(_0x5e345c){if(!_0x5e345c){throw new db[(_0x4316('0x72'))][(_0x4316('0x73'))](_0x4316('0x74'));}_0xb95b91=_[_0x4316('0x75')](_[_0x4316('0x45')](_0x5e345c),['createdAt',_0x4316('0x76')]);_0x33eb5d=_[_0x4316('0x75')](_[_0x4316('0x45')](_0x5e345c),[_0x4316('0x77'),_0x4316('0x76'),_0x4316('0x78'),_0x4316('0x79')]);if(_0x25e9cf[_0x4316('0x59')]['id']){delete _0x25e9cf['body']['id'];}if(_[_0x4316('0x7a')](_0x25e9cf[_0x4316('0x59')][_0x4316('0x7b')])){throw new db[(_0x4316('0x72'))][(_0x4316('0x73'))](_0x4316('0x7c'));}if(_[_0x4316('0x7a')](_0x25e9cf[_0x4316('0x59')][_0x4316('0x59')])||_0x25e9cf[_0x4316('0x59')][_0x4316('0x59')]===''){throw new db['Sequelize'][(_0x4316('0x73'))](_0x4316('0x7d'));}if(_[_0x4316('0x7a')](_0x25e9cf[_0x4316('0x59')][_0x4316('0x7e')])){throw new db['Sequelize'][(_0x4316('0x73'))](_0x4316('0x7f')+_0x33eb5d);}if(!_[_0x4316('0x80')](_0x33eb5d,_0x25e9cf[_0x4316('0x59')]['mapKey'])){throw new db[(_0x4316('0x72'))][(_0x4316('0x73'))](_0x4316('0x81')+_0x33eb5d);}_0x5265ba[_0x25e9cf[_0x4316('0x59')][_0x4316('0x7e')]]=_0x25e9cf[_0x4316('0x59')][_0x4316('0x7b')];})[_0x4316('0x22')](function(){return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x25e9cf[_0x4316('0x56')]['id']},'include':[{'model':db[_0x4316('0x82')],'as':'List','include':[{'model':db['CmContact'],'as':_0x4316('0x83'),'where':_0x5265ba,'limit':0x1,'order':[[_0x4316('0x76'),_0x4316('0x84')]]}]},{'model':db[_0x4316('0x85')],'as':'Applications'}]});})[_0x4316('0x22')](handleEntityNotFound(_0x1ae71e,null))[_0x4316('0x22')](function(_0x2682a7){if(_0x2682a7&&_0x2682a7[_0x4316('0x86')]){_0x16437c[_0x4316('0x87')]=_0x2682a7;_0x16437c[_0x4316('0x88')]=_0x2682a7['Applications'];_0x16437c['list']=_0x2682a7[_0x4316('0x86')];_0x16437c['applications']=_[_0x4316('0x89')](_0x16437c['applications'],['priority'],['asc']);if(_0x16437c['account']['Applications']){delete _0x16437c[_0x4316('0x87')][_0x4316('0x8a')];}if(_0x16437c[_0x4316('0x87')][_0x4316('0x86')]&&_0x16437c[_0x4316('0x87')][_0x4316('0x86')][_0x4316('0x83')][_0x4316('0x4c')]){return _0x16437c[_0x4316('0x87')][_0x4316('0x86')]['Contacts'][0x0];}var _0x47d731=_['defaults'](_0x25e9cf['body'],{'firstName':_0x25e9cf[_0x4316('0x59')][_0x4316('0x7b')],'ListId':_0x2682a7['ListId']});_0x47d731[_0x25e9cf[_0x4316('0x59')][_0x4316('0x7e')]]=_0x25e9cf[_0x4316('0x59')]['from'];return db['CmContact'][_0x4316('0x58')](_0x47d731,{'fields':_0xb95b91,'raw':!![]});}})[_0x4316('0x22')](handleEntityNotFound(_0x1ae71e,null))[_0x4316('0x22')](function(_0x231d1a){_0x16437c['contact']=_0x231d1a;if(_0x231d1a){var _0x5dfb39={'ContactId':_0x231d1a['id'],'OpenchannelAccountId':_0x25e9cf[_0x4316('0x56')]['id'],'from':(_0x231d1a[_0x4316('0x8b')]||'')+'\x20'+(_0x231d1a[_0x4316('0x8c')]||'')};var _0x539b01={'OpenchannelAccountId':_0x25e9cf[_0x4316('0x56')]['id'],'closed':![]};if(_0x25e9cf[_0x4316('0x59')]['threadId']){_0x539b01[_0x4316('0x8d')]=_0x25e9cf[_0x4316('0x59')][_0x4316('0x8d')];return db[_0x4316('0x8e')][_0x4316('0x57')]({'where':_0x539b01})[_0x4316('0x22')](function(_0x3572aa){if(_0x3572aa){return[_0x3572aa,![]];}_0x5dfb39['threadId']=_0x25e9cf[_0x4316('0x59')][_0x4316('0x8d')];_0x5dfb39[_0x4316('0x8f')]=_0x25e9cf[_0x4316('0x59')][_0x4316('0x8f')];return db[_0x4316('0x8e')][_0x4316('0x58')](_0x5dfb39)[_0x4316('0x22')](function(_0x2404bb){return[_0x2404bb,!![]];});});}else{_0x539b01[_0x4316('0x8d')]=null;}_0x539b01[_0x4316('0x90')]=_0x231d1a['id'];return db[_0x4316('0x8e')][_0x4316('0x57')]({'where':_0x539b01})[_0x4316('0x22')](function(_0xb90a6c){if(_0xb90a6c){return[_0xb90a6c,![]];}return db['OpenchannelInteraction']['create'](_0x5dfb39)['then'](function(_0x24e7c6){return[_0x24e7c6,!![]];});});}})[_0x4316('0x91')](function(_0x2c3275,_0x23fe41){if(_0x2c3275){_0x33b543=_0x23fe41;if(!_0x23fe41){var _0xec2c47={'from':(_0x16437c[_0x4316('0x92')][_0x4316('0x8b')]||'')+'\x20'+(_0x16437c[_0x4316('0x92')][_0x4316('0x8c')]||'')};if(_0x25e9cf['body'][_0x4316('0x8d')]&&_0x25e9cf[_0x4316('0x59')][_0x4316('0x93')]&&_0x25e9cf['body']['threadId']!=_0x25e9cf[_0x4316('0x59')][_0x4316('0x93')]){_0xec2c47[_0x4316('0x8d')]=_0x25e9cf[_0x4316('0x59')][_0x4316('0x93')];}return _0x2c3275[_0x4316('0x36')](_0xec2c47);}else{return _0x2c3275;}}})['then'](function(_0x1d6676){_0x16437c['interaction']=_0x1d6676[_0x4316('0x38')]({'plain':!![]});_0x16437c[_0x4316('0x94')][_0x4316('0x95')]=_0x33b543;if(_0x16437c['interaction'][_0x4316('0x95')]){if(_0x16437c[_0x4316('0x87')][_0x4316('0x96')]){_0x16437c['applications'][_0x4316('0x97')]({'id':0x0,'priority':_0x16437c[_0x4316('0x88')]['length']+0x1,'app':_0x4316('0x98'),'appdata':_0x4316('0x99'),'interval':_0x4316('0x9a')});}}return db[_0x4316('0x9b')][_0x4316('0x58')]({'body':_0x25e9cf[_0x4316('0x59')][_0x4316('0x59')],'OpenchannelAccountId':_0x25e9cf[_0x4316('0x56')]['id'],'OpenchannelInteractionId':_0x1d6676['id'],'direction':'in','ContactId':_0x16437c[_0x4316('0x92')]['id'],'AttachmentId':_0x25e9cf['body'][_0x4316('0x9c')]});})['then'](function(_0x4da808){_0x16437c[_0x4316('0x29')]=_0x4da808;if(_0x16437c[_0x4316('0x94')][_0x4316('0x9d')]){return db[_0x4316('0x9e')][_0x4316('0x57')]({'attributes':['id',_0x4316('0x3a')],'where':{'id':_0x16437c['interaction']['UserId']}})[_0x4316('0x22')](function(_0x14eb88){if(_0x14eb88){_0x16437c[_0x4316('0x88')][_0x4316('0x9f')]({'id':0x0,'priority':0x0,'app':_0x4316('0xa0'),'appdata':_0x14eb88[_0x4316('0x3a')]+','+(_0x16437c[_0x4316('0x87')][_0x4316('0xa1')]||0xa),'interval':_0x4316('0x9a')});_0x16437c['forcedOwnership']=![];}return respondWithRpcPromise(_0x4316('0xa2'),_0x4316('0xa3'),_0x16437c);});}return respondWithRpcPromise(_0x4316('0xa2'),_0x4316('0xa3'),_0x16437c);})[_0x4316('0x22')](function(_0x19774d){respondWithRpcPromise(_0x4316('0xa4'),_0x4316('0xa4'),{'event':_0x4316('0x6f'),'message':_0x19774d},client9002);return _0x19774d;})[_0x4316('0x22')](respondWithResult(_0x1ae71e,null))[_0x4316('0x2b')](handleError(_0x1ae71e,null));};exports[_0x4316('0xa5')]=function(_0xc41edb,_0xc64fac){var _0x4bc165=_0xc41edb[_0x4316('0x56')]['id'];var _0x5122b4=_0xc41edb[_0x4316('0x59')];var _0x1b360f=0xc8;var _0x5ba46d=null;return db[_0x4316('0xa6')][_0x4316('0xa7')]({'isolationLevel':db['sequelize'][_0x4316('0xa8')]['ISOLATION_LEVELS'][_0x4316('0xa9')]},function(_0xd76ff9){return db['OpenchannelAccount'][_0x4316('0x64')]({'where':{'id':_0x4bc165},'transaction':_0xd76ff9})[_0x4316('0x22')](function(_0x2689c7){if(_0x2689c7){return db[_0x4316('0x85')][_0x4316('0x37')]({'where':{'OpenchannelAccountId':_0x4bc165},'transaction':_0xd76ff9})[_0x4316('0x22')](function(){var _0x12731a=_['map'](_0x5122b4,function(_0x560425){_0x560425[_0x4316('0x66')]=_0x4bc165;return _0x560425;});return db[_0x4316('0x85')]['bulkCreate'](_0x12731a,{'transaction':_0xd76ff9});});}else{_0x1b360f=0x194;_0x5ba46d=[];}});})[_0x4316('0x22')](function(){if(_0x1b360f!==0x194){return db[_0x4316('0x85')][_0x4316('0xaa')]({'where':{'OpenchannelAccountId':_0x4bc165},'order':_0x4316('0xab')})[_0x4316('0x22')](function(_0x3da672){_0x5ba46d=_0x3da672;});}})[_0x4316('0x2b')](function(_0x5c2510){_0x1b360f=0x1f4;logger[_0x4316('0x28')](_0x5c2510['stack']);if(_0x5c2510[_0x4316('0x3a')]){delete _0x5c2510[_0x4316('0x3a')];}_0x5ba46d=_0x5c2510;})[_0x4316('0xac')](function(){if(_0x5ba46d===null){_0xc64fac[_0x4316('0x2c')](_0x1b360f);}else{if(_0x1b360f===0x1f4){_0xc64fac['status'](_0x1b360f)[_0x4316('0x3b')](_0x5ba46d);}else{_0xc64fac[_0x4316('0x2d')](_0x1b360f)[_0x4316('0x2f')](_0x5ba46d);}}});};exports[_0x4316('0xad')]=function(_0x190350,_0x55e1d9,_0x12c398){var _0x4bee1a={};var _0x1b7c60={};var _0x2a06fa;var _0x5ac7b6;return db[_0x4316('0x40')][_0x4316('0x64')]({'where':{'id':_0x190350['params']['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x55e1d9,null))[_0x4316('0x22')](function(_0x53f23e){if(_0x53f23e){_0x2a06fa=_0x53f23e;_0x1b7c60[_0x4316('0x48')]=_[_0x4316('0x45')](db[_0x4316('0x85')][_0x4316('0x41')]);_0x1b7c60[_0x4316('0x46')]=_[_0x4316('0x45')](_0x190350[_0x4316('0x46')]);_0x1b7c60[_0x4316('0x47')]=_[_0x4316('0x49')](_0x1b7c60[_0x4316('0x48')],_0x1b7c60['query']);_0x4bee1a['attributes']=_[_0x4316('0x49')](_0x1b7c60[_0x4316('0x48')],qs['fields'](_0x190350[_0x4316('0x46')]['fields']));_0x4bee1a[_0x4316('0x4b')]=_0x4bee1a[_0x4316('0x4b')][_0x4316('0x4c')]?_0x4bee1a[_0x4316('0x4b')]:_0x1b7c60['model'];_0x4bee1a[_0x4316('0x6b')]=qs['sort'](_0x190350[_0x4316('0x46')][_0x4316('0x4e')]);_0x4bee1a[_0x4316('0x50')]=qs[_0x4316('0x47')](_[_0x4316('0x4f')](_0x190350['query'],_0x1b7c60[_0x4316('0x47')]));if(_0x190350[_0x4316('0x46')]['filter']){_0x4bee1a[_0x4316('0x50')]=_[_0x4316('0x51')](_0x4bee1a[_0x4316('0x50')],{'$or':_[_0x4316('0x3f')](_0x4bee1a[_0x4316('0x4b')],function(_0x4edc9f){var _0x10ee7b={};_0x10ee7b[_0x4edc9f]={'$like':'%'+_0x190350[_0x4316('0x46')][_0x4316('0x67')]+'%'};return _0x10ee7b;})});}_0x4bee1a=_[_0x4316('0x51')]({},_0x4bee1a,_0x190350[_0x4316('0x52')]);return _0x2a06fa['getApplications'](_0x4bee1a);}})[_0x4316('0x22')](function(_0x1e766e){if(_0x1e766e){_0x5ac7b6=_0x1e766e[_0x4316('0x4c')];if(!_0x190350[_0x4316('0x46')]['hasOwnProperty'](_0x4316('0x4d'))){_0x4bee1a[_0x4316('0x31')]=qs[_0x4316('0x31')](_0x190350[_0x4316('0x46')]['limit']);_0x4bee1a[_0x4316('0x30')]=qs['offset'](_0x190350[_0x4316('0x46')][_0x4316('0x30')]);}return _0x2a06fa['getApplications'](_0x4bee1a);}})[_0x4316('0x22')](function(_0x1e8e9c){if(_0x1e8e9c){return _0x1e8e9c?{'count':_0x5ac7b6,'rows':_0x1e8e9c}:null;}})[_0x4316('0x22')](respondWithResult(_0x55e1d9,null))[_0x4316('0x2b')](handleError(_0x55e1d9,null));};exports['getInteractions']=function(_0x38db82,_0x313702,_0x18770b){var _0x5670bc={'raw':![],'where':{}};var _0x5be82d={};var _0x6e8f76={'count':0x0,'rows':[]};return db[_0x4316('0x40')][_0x4316('0x64')]({'where':{'id':_0x38db82[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x313702,null))[_0x4316('0x22')](function(_0x192a0b){if(_0x192a0b){_0x5be82d[_0x4316('0x48')]=_[_0x4316('0x45')](db[_0x4316('0x8e')][_0x4316('0x41')]);_0x5be82d[_0x4316('0x46')]=_[_0x4316('0x45')](_0x38db82[_0x4316('0x46')]);_0x5be82d[_0x4316('0x47')]=_[_0x4316('0x49')](_0x5be82d[_0x4316('0x48')],_0x5be82d['query']);_0x5670bc[_0x4316('0x4b')]=_[_0x4316('0x49')](_0x5be82d['model'],qs['fields'](_0x38db82['query']['fields']));_0x5670bc[_0x4316('0x4b')]=_0x5670bc[_0x4316('0x4b')][_0x4316('0x4c')]?_0x5670bc['attributes']:_0x5be82d[_0x4316('0x48')];if(!_0x38db82['query'][_0x4316('0x65')]('nolimit')){_0x5670bc[_0x4316('0x31')]=qs[_0x4316('0x31')](_0x38db82['query'][_0x4316('0x31')]);_0x5670bc[_0x4316('0x30')]=qs[_0x4316('0x30')](_0x38db82[_0x4316('0x46')]['offset']);}_0x5670bc[_0x4316('0x6b')]=qs[_0x4316('0x4e')](_0x38db82[_0x4316('0x46')][_0x4316('0x4e')]);_0x5670bc[_0x4316('0x50')]=qs[_0x4316('0x47')](_['pick'](_0x38db82[_0x4316('0x46')],_0x5be82d['filters']));_0x5670bc[_0x4316('0x50')]['OpenchannelAccountId']=_0x192a0b['id'];if(_0x38db82[_0x4316('0x46')][_0x4316('0x67')]){_0x5670bc[_0x4316('0x50')]=_[_0x4316('0x51')](_0x5670bc[_0x4316('0x50')],{'$or':_['map'](_0x5670bc[_0x4316('0x4b')],function(_0x5bf359){var _0x270141={};_0x270141[_0x5bf359]={'$like':'%'+_0x38db82['query']['filter']+'%'};return _0x270141;})});}_0x5670bc=_[_0x4316('0x51')]({},_0x5670bc,_0x38db82['options']);return db[_0x4316('0x8e')]['count']({'where':_0x5670bc['where']})[_0x4316('0x22')](function(_0x422508){_0x6e8f76[_0x4316('0x32')]=_0x422508;if(_0x38db82['query'][_0x4316('0x6c')]){_0x5670bc['include']=[{'model':db[_0x4316('0x71')],'as':_0x4316('0xae'),'required':![]},{'model':db[_0x4316('0x9e')],'as':'Owner','attributes':['name',_0x4316('0xaf'),_0x4316('0xb0')],'required':![]},{'model':db[_0x4316('0xb1')],'as':_0x4316('0xb2'),'attributes':['id','name',_0x4316('0xb3')],'where':_0x38db82[_0x4316('0x46')]['tag']?{'id':_0x38db82[_0x4316('0x46')]['tag']}:undefined,'required':_0x38db82['query'][_0x4316('0xb4')]?!![]:![]}];}return db[_0x4316('0x8e')]['findAll'](_0x5670bc);})[_0x4316('0x22')](function(_0x56c3b9){_0x6e8f76['rows']=_0x56c3b9;return _0x6e8f76;});}})[_0x4316('0x22')](respondWithFilteredResult(_0x313702,_0x5670bc))['catch'](handleError(_0x313702,null));};exports[_0x4316('0xb5')]=function(_0x324a98,_0xdff196,_0x348bc3){return db['OpenchannelAccount'][_0x4316('0x57')]({'where':{'id':_0x324a98[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0xdff196,null))[_0x4316('0x22')](function(_0x399d27){if(_0x399d27){return _0x399d27[_0x4316('0xb5')](_0x324a98[_0x4316('0x59')][_0x4316('0x6e')],_['omit'](_0x324a98['body'],[_0x4316('0x6e'),'id'])||{})[_0x4316('0x91')](function(_0x51d3bb){for(var _0x106999=0x0;_0x106999<_0x324a98['body'][_0x4316('0x6e')][_0x4316('0x4c')];_0x106999+=0x1){socket[_0x4316('0xb6')](_0x4316('0xb7'),{'UserId':Number(_0x324a98[_0x4316('0x59')]['ids'][_0x106999]),'OpenchannelAccountId':Number(_0x324a98['params']['id'])});}return _0x51d3bb;});}})['then'](respondWithResult(_0xdff196,null))[_0x4316('0x2b')](handleError(_0xdff196,null));};exports[_0x4316('0xb8')]=function(_0x3f1bf1,_0x5eccd9,_0x631b78){return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x3f1bf1['params']['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x5eccd9,null))[_0x4316('0x22')](function(_0x4fd13c){if(_0x4fd13c){return _0x4fd13c[_0x4316('0xb8')](_0x3f1bf1[_0x4316('0x46')]['ids'])[_0x4316('0x22')](function(){if(_[_0x4316('0xb9')](_0x3f1bf1[_0x4316('0x46')][_0x4316('0x6e')])){for(var _0x575ec7=0x0;_0x575ec7<_0x3f1bf1[_0x4316('0x46')]['ids'][_0x4316('0x4c')];_0x575ec7+=0x1){socket[_0x4316('0xb6')]('userOpenchannelAccount:remove',{'UserId':Number(_0x3f1bf1[_0x4316('0x46')]['ids'][_0x575ec7]),'OpenchannelAccountId':Number(_0x3f1bf1[_0x4316('0x56')]['id'])});}}else{socket['emit'](_0x4316('0xba'),{'UserId':Number(_0x3f1bf1[_0x4316('0x46')]['ids']),'OpenchannelAccountId':Number(_0x3f1bf1[_0x4316('0x56')]['id'])});}});}})[_0x4316('0x22')](respondWithStatusCode(_0x5eccd9,null))[_0x4316('0x2b')](handleError(_0x5eccd9,null));};exports[_0x4316('0xbb')]=function(_0x29a893,_0x485519,_0x12285d){var _0x17664f={};var _0x4fbb16={};var _0x239a7e;var _0x12677b;return db[_0x4316('0x40')][_0x4316('0x64')]({'where':{'id':_0x29a893['params']['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x485519,null))[_0x4316('0x22')](function(_0x556f4e){if(_0x556f4e){_0x239a7e=_0x556f4e;_0x4fbb16['model']=_[_0x4316('0x45')](db['User']['rawAttributes']);_0x4fbb16[_0x4316('0x46')]=_[_0x4316('0x45')](_0x29a893[_0x4316('0x46')]);_0x4fbb16[_0x4316('0x47')]=_[_0x4316('0x49')](_0x4fbb16[_0x4316('0x48')],_0x4fbb16[_0x4316('0x46')]);_0x17664f[_0x4316('0x4b')]=_[_0x4316('0x49')](_0x4fbb16[_0x4316('0x48')],qs[_0x4316('0x4a')](_0x29a893[_0x4316('0x46')]['fields']));_0x17664f[_0x4316('0x4b')]=_0x17664f[_0x4316('0x4b')]['length']?_0x17664f[_0x4316('0x4b')]:_0x4fbb16[_0x4316('0x48')];_0x17664f[_0x4316('0x6b')]=qs[_0x4316('0x4e')](_0x29a893['query'][_0x4316('0x4e')]);_0x17664f['where']=qs[_0x4316('0x47')](_[_0x4316('0x4f')](_0x29a893[_0x4316('0x46')],_0x4fbb16[_0x4316('0x47')]));if(_0x29a893[_0x4316('0x46')]['filter']){_0x17664f[_0x4316('0x50')]=_[_0x4316('0x51')](_0x17664f[_0x4316('0x50')],{'$or':_[_0x4316('0x3f')](_0x17664f[_0x4316('0x4b')],function(_0x5c1ce9){var _0x1e551f={};_0x1e551f[_0x5c1ce9]={'$like':'%'+_0x29a893['query'][_0x4316('0x67')]+'%'};return _0x1e551f;})});}_0x17664f=_[_0x4316('0x51')]({},_0x17664f,_0x29a893['options']);return _0x239a7e[_0x4316('0xbb')](_0x17664f);}})['then'](function(_0x39016a){if(_0x39016a){_0x12677b=_0x39016a[_0x4316('0x4c')];if(!_0x29a893[_0x4316('0x46')][_0x4316('0x65')](_0x4316('0x4d'))){_0x17664f['limit']=qs[_0x4316('0x31')](_0x29a893[_0x4316('0x46')][_0x4316('0x31')]);_0x17664f[_0x4316('0x30')]=qs[_0x4316('0x30')](_0x29a893[_0x4316('0x46')]['offset']);}return _0x239a7e[_0x4316('0xbb')](_0x17664f);}})['then'](function(_0x8fc6a4){if(_0x8fc6a4){return _0x8fc6a4?{'count':_0x12677b,'rows':_0x8fc6a4}:null;}})[_0x4316('0x22')](respondWithResult(_0x485519,null))[_0x4316('0x2b')](handleError(_0x485519,null));};exports['send']=function(_0x1021c5,_0x10330f,_0x4b4a81){var _0x39b04a,_0x91a601,_0x171f62;if(_[_0x4316('0x7a')](_0x1021c5[_0x4316('0x59')][_0x4316('0x59')])||_0x1021c5[_0x4316('0x59')][_0x4316('0x59')]===''){throw new db['Sequelize'][(_0x4316('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1021c5['body']['to'])){}_0x39b04a=_0x1021c5[_0x4316('0x59')]['to'];return db[_0x4316('0x40')]['findOne']({'where':{'id':_0x1021c5[_0x4316('0x56')]['id']}})[_0x4316('0x22')](handleEntityNotFound(_0x10330f,null))[_0x4316('0x22')](function(_0x81e9ec){if(_0x81e9ec){return db[_0x4316('0x40')][_0x4316('0x57')]({'where':{'id':_0x81e9ec['id']},'include':[{'model':db['CmList'],'as':_0x4316('0x86'),'include':[{'model':db[_0x4316('0x71')],'as':_0x4316('0x83'),'where':{[_0x81e9ec[_0x4316('0x7e')]]:_0x39b04a},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x4316('0x22')](handleEntityNotFound(_0x10330f,null))[_0x4316('0x22')](function(_0x3d24e5){if(_0x3d24e5&&_0x3d24e5[_0x4316('0x86')]){_0x91a601=_0x3d24e5['get']({'plain':!![]});if(_0x91a601[_0x4316('0x86')]&&_0x91a601['List'][_0x4316('0x83')]['length']){return _0x91a601['List'][_0x4316('0x83')][0x0];}return db[_0x4316('0x71')][_0x4316('0x58')](_['defaults'](_0x1021c5[_0x4316('0x59')],{'firstName':_0x39b04a,[_0x3d24e5[_0x4316('0x7e')]]:_0x39b04a,'phone':_0x39b04a,'ListId':_0x91a601['ListId']}));}})[_0x4316('0x22')](handleEntityNotFound(_0x10330f,null))[_0x4316('0x22')](function(_0x3c3bed){if(_0x3c3bed){_0x171f62=_0x3c3bed;return db[_0x4316('0x8e')][_0x4316('0x57')]({'where':{'ContactId':_0x171f62['id'],'closed':![],'OpenchannelAccountId':_0x91a601['id']}})['then'](function(_0x37635d){if(_0x37635d){return[_0x37635d,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1021c5[_0x4316('0x5a')]['id'],'ContactId':_0x171f62['id'],'OpenchannelAccountId':_0x91a601['id'],'lastMsgDirection':_0x4316('0xbc'),'firstMsgDirection':_0x4316('0xbc'),'Messages':[_[_0x4316('0x51')](_0x1021c5[_0x4316('0x59')],{'read':![],'body':_0x1021c5['body'][_0x4316('0x59')],'OpenchannelAccountId':_0x91a601['id'],'UserId':_0x1021c5[_0x4316('0x5a')]['id'],'ContactId':_0x171f62['id']})]},{'include':[{'model':db[_0x4316('0x9b')],'as':_0x4316('0xbd')}]})[_0x4316('0x22')](function(_0x584895){return[_0x584895,!![]];});});}})[_0x4316('0x91')](function(_0x48bef9,_0x5e78aa){if(_0x5e78aa){return _0x48bef9;}return db['OpenchannelMessage']['create'](_[_0x4316('0x51')](_0x1021c5[_0x4316('0x59')],{'read':![],'body':_0x1021c5[_0x4316('0x59')][_0x4316('0x59')],'OpenchannelAccountId':_0x91a601['id'],'OpenchannelInteractionId':_0x48bef9['id'],'UserId':_0x1021c5[_0x4316('0x5a')]['id'],'ContactId':_0x171f62['id']}))[_0x4316('0x22')](function(_0x3b9304){_0x48bef9[_0x4316('0xbe')]['Messages']=[];_0x48bef9[_0x4316('0xbe')][_0x4316('0xbd')]['push'](_0x3b9304[_0x4316('0xbe')]);return _0x48bef9;});});}})[_0x4316('0x22')](respondWithResult(_0x10330f,null))[_0x4316('0x2b')](handleError(_0x10330f,null));}; \ No newline at end of file +var _0x55ca=['findAll','rows','show','Pause','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','autoAssociation','UserProfileResource','params','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','createdAt','updatedAt','difference','CompanyId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','Applications','List','account','applications','orderBy','priority','asc','defaults','from','ListId','mapKey','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','READ_COMMITTED','OpenchannelAccountId','bulkCreate','finally','getApplications','OpenchannelApplication','hasOwnProperty','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','dataValues','Messages','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','stack','name','send','OpenchannelAccount','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','options','includeAll','include'];(function(_0x36802a,_0x31c1af){var _0x27b418=function(_0x3f5ecc){while(--_0x3f5ecc){_0x36802a['push'](_0x36802a['shift']());}};_0x27b418(++_0x31c1af);}(_0x55ca,0x126));var _0xa55c=function(_0x35b07d,_0x3d0ae7){_0x35b07d=_0x35b07d-0x0;var _0x2868bc=_0x55ca[_0x35b07d];return _0x2868bc;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];config['redis']=_['defaults'](config[_0xa55c('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa55c('0x19'))[_0xa55c('0x1a')](socket);var jayson=require(_0xa55c('0x1b'));var client=jayson[_0xa55c('0x1c')][_0xa55c('0x1d')]({'port':0x232c});var client9002=jayson[_0xa55c('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccf65,_0x3dcf4f,_0x25934f,_0x31e10d){return new BPromise(function(_0x1c4cfd,_0x3ae86b){var _0x51590e=_0x31e10d||client;return _0x51590e[_0xa55c('0x1e')](_0x3ccf65,_0x25934f)[_0xa55c('0x1f')](function(_0x4cee3c){logger[_0xa55c('0x20')](_0xa55c('0x21'),_0x3dcf4f,_0xa55c('0x22'));logger[_0xa55c('0x23')](_0xa55c('0x24'),_0x3dcf4f,_0xa55c('0x22'),JSON['stringify'](_0x4cee3c));if(_0x4cee3c['error']){if(_0x4cee3c[_0xa55c('0x25')][_0xa55c('0x26')]===0x1f4){logger[_0xa55c('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x3dcf4f,_0x4cee3c[_0xa55c('0x25')][_0xa55c('0x27')]);return _0x3ae86b(_0x4cee3c['error'][_0xa55c('0x27')]);}logger[_0xa55c('0x25')](_0xa55c('0x21'),_0x3dcf4f,_0x4cee3c[_0xa55c('0x25')][_0xa55c('0x27')]);return _0x1c4cfd(_0x4cee3c['error'][_0xa55c('0x27')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3dcf4f,'request\x20sent');_0x1c4cfd(_0x4cee3c[_0xa55c('0x28')]['message']);}})[_0xa55c('0x29')](function(_0x190757){logger[_0xa55c('0x25')](_0xa55c('0x21'),_0x3dcf4f,_0x190757);_0x3ae86b(_0x190757);});});}function respondWithStatusCode(_0x2313a9,_0x170ba4){_0x170ba4=_0x170ba4||0xcc;return function(_0x1da633){if(_0x1da633){return _0x2313a9[_0xa55c('0x2a')](_0x170ba4);}return _0x2313a9[_0xa55c('0x2b')](_0x170ba4)[_0xa55c('0x2c')]();};}function respondWithResult(_0x1273d7,_0x57f271){_0x57f271=_0x57f271||0xc8;return function(_0x430d55){if(_0x430d55){return _0x1273d7[_0xa55c('0x2b')](_0x57f271)[_0xa55c('0x2d')](_0x430d55);}};}function respondWithFilteredResult(_0x906caa,_0x5d940d){return function(_0x1377b0){if(_0x1377b0){var _0x22f6b6=typeof _0x5d940d[_0xa55c('0x2e')]===_0xa55c('0x2f')&&typeof _0x5d940d[_0xa55c('0x30')]===_0xa55c('0x2f');var _0x52d37f=_0x1377b0[_0xa55c('0x31')];var _0x490b7d=_0x22f6b6?0x0:_0x5d940d[_0xa55c('0x2e')];var _0x1d730b=_0x22f6b6?_0x1377b0[_0xa55c('0x31')]:_0x5d940d[_0xa55c('0x2e')]+_0x5d940d['limit'];var _0x3d28fb;if(_0x1d730b>=_0x52d37f){_0x1d730b=_0x52d37f;_0x3d28fb=0xc8;}else{_0x3d28fb=0xce;}_0x906caa[_0xa55c('0x2b')](_0x3d28fb);return _0x906caa[_0xa55c('0x32')](_0xa55c('0x33'),_0x490b7d+'-'+_0x1d730b+'/'+_0x52d37f)[_0xa55c('0x2d')](_0x1377b0);}return null;};}function patchUpdates(_0x1225c3){return function(_0x29748a){try{jsonpatch[_0xa55c('0x34')](_0x29748a,_0x1225c3,!![]);}catch(_0x2808e9){return BPromise[_0xa55c('0x35')](_0x2808e9);}return _0x29748a[_0xa55c('0x36')]();};}function saveUpdates(_0x4eb7c4,_0x54ca97){return function(_0x4146f3){if(_0x4146f3){return _0x4146f3[_0xa55c('0x37')](_0x4eb7c4)['then'](function(_0x30fadd){return _0x30fadd;});}return null;};}function removeEntity(_0x2f0110,_0x2e9623){return function(_0x1839ac){if(_0x1839ac){return _0x1839ac[_0xa55c('0x38')]()[_0xa55c('0x1f')](function(){var _0x3ce1b3=_0x1839ac[_0xa55c('0x39')]({'plain':!![]});var _0x3959e3='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x3959e3,'resourceId':_0x3ce1b3['id']}})[_0xa55c('0x1f')](function(){return _0x1839ac;});})[_0xa55c('0x1f')](function(){_0x2f0110[_0xa55c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x768408,_0x547930){return function(_0x119220){if(!_0x119220){_0x768408['sendStatus'](0x194);}return _0x119220;};}function handleError(_0x18c6f1,_0x39267c){_0x39267c=_0x39267c||0x1f4;return function(_0x3c0ec1){logger['error'](_0x3c0ec1[_0xa55c('0x3a')]);if(_0x3c0ec1[_0xa55c('0x3b')]){delete _0x3c0ec1['name'];}_0x18c6f1[_0xa55c('0x2b')](_0x39267c)[_0xa55c('0x3c')](_0x3c0ec1);};}exports['index']=function(_0x529ff8,_0x235f6b){var _0x5d3960={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1e75dc={},_0x284bcf={'count':0x0,'rows':[]};var _0x5e50b6=_['map'](db[_0xa55c('0x3d')][_0xa55c('0x3e')],function(_0x429336){return{'name':_0x429336[_0xa55c('0x3f')],'type':_0x429336[_0xa55c('0x40')]['key']};});_0x1e75dc[_0xa55c('0x41')]=_[_0xa55c('0x42')](_0x5e50b6,_0xa55c('0x3b'));_0x1e75dc[_0xa55c('0x43')]=_[_0xa55c('0x44')](_0x529ff8[_0xa55c('0x43')]);_0x1e75dc['filters']=_[_0xa55c('0x45')](_0x1e75dc['model'],_0x1e75dc['query']);_0x5d3960[_0xa55c('0x46')]=_[_0xa55c('0x45')](_0x1e75dc['model'],qs[_0xa55c('0x47')](_0x529ff8['query']['fields']));_0x5d3960[_0xa55c('0x46')]=_0x5d3960[_0xa55c('0x46')][_0xa55c('0x48')]?_0x5d3960['attributes']:_0x1e75dc[_0xa55c('0x41')];if(!_0x529ff8[_0xa55c('0x43')]['hasOwnProperty'](_0xa55c('0x49'))){_0x5d3960['limit']=qs[_0xa55c('0x30')](_0x529ff8[_0xa55c('0x43')]['limit']);_0x5d3960[_0xa55c('0x2e')]=qs[_0xa55c('0x2e')](_0x529ff8['query'][_0xa55c('0x2e')]);}_0x5d3960[_0xa55c('0x4a')]=qs[_0xa55c('0x4b')](_0x529ff8['query'][_0xa55c('0x4b')]);_0x5d3960['where']=qs[_0xa55c('0x4c')](_[_0xa55c('0x4d')](_0x529ff8[_0xa55c('0x43')],_0x1e75dc['filters']),_0x5e50b6);if(_0x529ff8[_0xa55c('0x43')][_0xa55c('0x4e')]){_0x5d3960['where']=_[_0xa55c('0x4f')](_0x5d3960[_0xa55c('0x50')],{'$or':_['map'](_0x5e50b6,function(_0x11ff1d){if(_0x11ff1d[_0xa55c('0x40')]!=='VIRTUAL'){var _0x46f839={};_0x46f839[_0x11ff1d[_0xa55c('0x3b')]]={'$like':'%'+_0x529ff8[_0xa55c('0x43')][_0xa55c('0x4e')]+'%'};return _0x46f839;}})});}_0x5d3960=_['merge']({},_0x5d3960,_0x529ff8[_0xa55c('0x51')]);var _0x58a7ea={'where':_0x5d3960[_0xa55c('0x50')]};return db[_0xa55c('0x3d')][_0xa55c('0x31')](_0x58a7ea)['then'](function(_0x39bd3d){_0x284bcf[_0xa55c('0x31')]=_0x39bd3d;if(_0x529ff8['query'][_0xa55c('0x52')]){_0x5d3960[_0xa55c('0x53')]=[{'all':!![]}];}return db[_0xa55c('0x3d')][_0xa55c('0x54')](_0x5d3960);})[_0xa55c('0x1f')](function(_0x1c84d9){_0x284bcf[_0xa55c('0x55')]=_0x1c84d9;return _0x284bcf;})[_0xa55c('0x1f')](respondWithFilteredResult(_0x235f6b,_0x5d3960))[_0xa55c('0x29')](handleError(_0x235f6b,null));};exports[_0xa55c('0x56')]=function(_0x4fc0a9,_0x13e1d4){var _0x46e27d={'raw':![],'where':{'id':_0x4fc0a9['params']['id']},'include':[{'model':db[_0xa55c('0x57')],'as':_0xa55c('0x58')}]},_0x216de8={};_0x216de8['model']=_[_0xa55c('0x44')](db['OpenchannelAccount'][_0xa55c('0x3e')]);_0x216de8[_0xa55c('0x43')]=_[_0xa55c('0x44')](_0x4fc0a9[_0xa55c('0x43')]);_0x216de8[_0xa55c('0x4c')]=_['intersection'](_0x216de8[_0xa55c('0x41')],_0x216de8[_0xa55c('0x43')]);_0x46e27d['attributes']=_[_0xa55c('0x45')](_0x216de8[_0xa55c('0x41')],qs[_0xa55c('0x47')](_0x4fc0a9[_0xa55c('0x43')]['fields']));_0x46e27d['attributes']=_0x46e27d[_0xa55c('0x46')][_0xa55c('0x48')]?_0x46e27d[_0xa55c('0x46')]:_0x216de8[_0xa55c('0x41')];if(_0x4fc0a9['query'][_0xa55c('0x52')]){_0x46e27d['include']=[{'all':!![]}];}_0x46e27d=_[_0xa55c('0x4f')]({},_0x46e27d,_0x4fc0a9[_0xa55c('0x51')]);return db[_0xa55c('0x3d')][_0xa55c('0x59')](_0x46e27d)[_0xa55c('0x1f')](handleEntityNotFound(_0x13e1d4,null))['then'](respondWithResult(_0x13e1d4,null))[_0xa55c('0x29')](handleError(_0x13e1d4,null));};exports['create']=function(_0x23f67f,_0x157afe){return db[_0xa55c('0x3d')][_0xa55c('0x5a')](_0x23f67f[_0xa55c('0x5b')],{})[_0xa55c('0x1f')](function(_0x5d14e0){var _0x53e2be=_0x23f67f[_0xa55c('0x5c')][_0xa55c('0x39')]({'plain':!![]});if(!_0x53e2be)throw new Error(_0xa55c('0x5d'));if(_0x53e2be[_0xa55c('0x5e')]===_0xa55c('0x5c')){var _0x5ba2b0=_0x5d14e0[_0xa55c('0x39')]({'plain':!![]});var _0x3cd40d=_0xa55c('0x5f');return db[_0xa55c('0x60')][_0xa55c('0x59')]({'where':{'name':_0x3cd40d,'userProfileId':_0x53e2be['userProfileId']},'raw':!![]})[_0xa55c('0x1f')](function(_0x21725b){if(_0x21725b&&_0x21725b[_0xa55c('0x61')]===0x0){return db[_0xa55c('0x62')][_0xa55c('0x5a')]({'name':_0x5ba2b0['name'],'resourceId':_0x5ba2b0['id'],'type':_0x21725b[_0xa55c('0x3b')],'sectionId':_0x21725b['id']},{})['then'](function(){return _0x5d14e0;});}else{return _0x5d14e0;}})[_0xa55c('0x29')](function(_0x5e3a28){logger[_0xa55c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e3a28);throw _0x5e3a28;});}return _0x5d14e0;})[_0xa55c('0x1f')](respondWithResult(_0x157afe,0xc9))[_0xa55c('0x29')](handleError(_0x157afe,null));};exports[_0xa55c('0x37')]=function(_0x2f811e,_0x4cb38c){if(_0x2f811e[_0xa55c('0x5b')]['id']){delete _0x2f811e[_0xa55c('0x5b')]['id'];}return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x2f811e[_0xa55c('0x63')]['id']},'include':[{'model':db['Pause'],'as':_0xa55c('0x58')}]})[_0xa55c('0x1f')](handleEntityNotFound(_0x4cb38c,null))['then'](saveUpdates(_0x2f811e[_0xa55c('0x5b')],null))[_0xa55c('0x1f')](respondWithResult(_0x4cb38c,null))[_0xa55c('0x29')](handleError(_0x4cb38c,null));};exports[_0xa55c('0x38')]=function(_0x1b8b06,_0xa38271){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x1b8b06['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0xa38271,null))[_0xa55c('0x1f')](removeEntity(_0xa38271,null))[_0xa55c('0x29')](handleError(_0xa38271,null));};exports[_0xa55c('0x64')]=function(_0x1a52b9,_0x1bcb40){return db[_0xa55c('0x3d')][_0xa55c('0x64')]()[_0xa55c('0x1f')](respondWithResult(_0x1bcb40,null))['catch'](handleError(_0x1bcb40,null));};exports[_0xa55c('0x65')]=function(_0x4174eb,_0x40c56a,_0x26606c){if(_0x4174eb[_0xa55c('0x5b')]['id']){delete _0x4174eb[_0xa55c('0x5b')]['id'];}return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x4174eb[_0xa55c('0x63')]['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x40c56a,null))[_0xa55c('0x1f')](function(_0x5c598a){if(_0x5c598a){_0x4174eb[_0xa55c('0x5b')]['OpenchannelAccountId']=_0x5c598a['id'];return db[_0xa55c('0x66')][_0xa55c('0x5a')](_0x4174eb[_0xa55c('0x5b')]);}})['then'](respondWithResult(_0x40c56a,null))['catch'](handleError(_0x40c56a,null));};exports[_0xa55c('0x67')]=function(_0x182cd9,_0x23c84c,_0x42529f){var _0x4c7ee1={'raw':![],'where':{}};var _0x149cb9={};var _0xd02251={'count':0x0,'rows':[]};return db[_0xa55c('0x3d')][_0xa55c('0x68')]({'where':{'id':_0x182cd9[_0xa55c('0x63')]['id']}})['then'](handleEntityNotFound(_0x23c84c,null))['then'](function(_0x3f7fca){if(_0x3f7fca){_0x149cb9[_0xa55c('0x41')]=_[_0xa55c('0x44')](db[_0xa55c('0x66')][_0xa55c('0x3e')]);_0x149cb9['query']=_[_0xa55c('0x44')](_0x182cd9[_0xa55c('0x43')]);_0x149cb9['filters']=_[_0xa55c('0x45')](_0x149cb9[_0xa55c('0x41')],_0x149cb9[_0xa55c('0x43')]);_0x4c7ee1['attributes']=_[_0xa55c('0x45')](_0x149cb9[_0xa55c('0x41')],qs[_0xa55c('0x47')](_0x182cd9[_0xa55c('0x43')][_0xa55c('0x47')]));_0x4c7ee1['attributes']=_0x4c7ee1[_0xa55c('0x46')][_0xa55c('0x48')]?_0x4c7ee1['attributes']:_0x149cb9['model'];if(!_0x182cd9[_0xa55c('0x43')]['hasOwnProperty'](_0xa55c('0x49'))){_0x4c7ee1[_0xa55c('0x30')]=qs[_0xa55c('0x30')](_0x182cd9[_0xa55c('0x43')][_0xa55c('0x30')]);_0x4c7ee1[_0xa55c('0x2e')]=qs[_0xa55c('0x2e')](_0x182cd9[_0xa55c('0x43')][_0xa55c('0x2e')]);}_0x4c7ee1['order']=qs[_0xa55c('0x4b')](_0x182cd9[_0xa55c('0x43')][_0xa55c('0x4b')]);_0x4c7ee1[_0xa55c('0x50')]=qs['filters'](_[_0xa55c('0x4d')](_0x182cd9[_0xa55c('0x43')],_0x149cb9[_0xa55c('0x4c')]));_0x4c7ee1[_0xa55c('0x50')]['OpenchannelAccountId']=_0x3f7fca['id'];if(_0x182cd9['query'][_0xa55c('0x4e')]){_0x4c7ee1[_0xa55c('0x50')]=_[_0xa55c('0x4f')](_0x4c7ee1[_0xa55c('0x50')],{'$or':_['map'](_0x4c7ee1['attributes'],function(_0x40663){var _0x3b2a5c={};_0x3b2a5c[_0x40663]={'$like':'%'+_0x182cd9[_0xa55c('0x43')][_0xa55c('0x4e')]+'%'};return _0x3b2a5c;})});}_0x4c7ee1=_[_0xa55c('0x4f')]({},_0x4c7ee1,_0x182cd9[_0xa55c('0x51')]);return db[_0xa55c('0x66')]['count']({'where':_0x4c7ee1[_0xa55c('0x50')]})['then'](function(_0x2859a0){_0xd02251['count']=_0x2859a0;if(_0x182cd9[_0xa55c('0x43')][_0xa55c('0x52')]){_0x4c7ee1[_0xa55c('0x53')]=[{'all':!![]}];}return db[_0xa55c('0x66')][_0xa55c('0x54')](_0x4c7ee1);})[_0xa55c('0x1f')](function(_0x1ea5b6){_0xd02251[_0xa55c('0x55')]=_0x1ea5b6;return _0xd02251;});}})['then'](respondWithFilteredResult(_0x23c84c,_0x4c7ee1))['catch'](handleError(_0x23c84c,null));};exports[_0xa55c('0x69')]=function(_0x2948b1,_0xc2ad5c,_0x256db0){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x2948b1['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0xc2ad5c,null))[_0xa55c('0x1f')](function(_0x301e56){if(_0x301e56){return _0x301e56[_0xa55c('0x69')](_0x2948b1[_0xa55c('0x43')][_0xa55c('0x6a')]);}})[_0xa55c('0x1f')](respondWithStatusCode(_0xc2ad5c,null))[_0xa55c('0x29')](handleError(_0xc2ad5c,null));};exports['addAnswer']=function(_0x25d09d,_0xb29c7c,_0x42d773){if(_0x25d09d[_0xa55c('0x5b')]['id']){delete _0x25d09d[_0xa55c('0x5b')]['id'];}return db['OpenchannelAccount'][_0xa55c('0x59')]({'where':{'id':_0x25d09d[_0xa55c('0x63')]['id']}})['then'](handleEntityNotFound(_0xb29c7c,null))['then'](function(_0x1f7b00){if(_0x1f7b00){_0x25d09d[_0xa55c('0x5b')]['OpenchannelAccountId']=_0x1f7b00['id'];return db['CannedAnswer']['create'](_0x25d09d['body']);}})[_0xa55c('0x1f')](respondWithResult(_0xb29c7c,null))[_0xa55c('0x29')](handleError(_0xb29c7c,null));};exports[_0xa55c('0x6b')]=function(_0x1a2f31,_0x3e7aa2,_0x3c07ed){var _0x568a5b={'raw':![],'where':{}};var _0xf4ea45={};var _0x3b6abe={'count':0x0,'rows':[]};return db[_0xa55c('0x3d')][_0xa55c('0x68')]({'where':{'id':_0x1a2f31['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x3e7aa2,null))[_0xa55c('0x1f')](function(_0x36824c){if(_0x36824c){_0xf4ea45['model']=_[_0xa55c('0x44')](db['CannedAnswer']['rawAttributes']);_0xf4ea45[_0xa55c('0x43')]=_[_0xa55c('0x44')](_0x1a2f31[_0xa55c('0x43')]);_0xf4ea45[_0xa55c('0x4c')]=_[_0xa55c('0x45')](_0xf4ea45[_0xa55c('0x41')],_0xf4ea45[_0xa55c('0x43')]);_0x568a5b['attributes']=_['intersection'](_0xf4ea45[_0xa55c('0x41')],qs[_0xa55c('0x47')](_0x1a2f31[_0xa55c('0x43')][_0xa55c('0x47')]));_0x568a5b[_0xa55c('0x46')]=_0x568a5b[_0xa55c('0x46')][_0xa55c('0x48')]?_0x568a5b[_0xa55c('0x46')]:_0xf4ea45[_0xa55c('0x41')];if(!_0x1a2f31[_0xa55c('0x43')]['hasOwnProperty'](_0xa55c('0x49'))){_0x568a5b[_0xa55c('0x30')]=qs['limit'](_0x1a2f31[_0xa55c('0x43')]['limit']);_0x568a5b[_0xa55c('0x2e')]=qs[_0xa55c('0x2e')](_0x1a2f31[_0xa55c('0x43')][_0xa55c('0x2e')]);}_0x568a5b[_0xa55c('0x4a')]=qs['sort'](_0x1a2f31[_0xa55c('0x43')][_0xa55c('0x4b')]);_0x568a5b[_0xa55c('0x50')]=qs[_0xa55c('0x4c')](_[_0xa55c('0x4d')](_0x1a2f31[_0xa55c('0x43')],_0xf4ea45[_0xa55c('0x4c')]));_0x568a5b['where']['OpenchannelAccountId']=_0x36824c['id'];if(_0x1a2f31['query'][_0xa55c('0x4e')]){_0x568a5b['where']=_[_0xa55c('0x4f')](_0x568a5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x42')](_0x568a5b[_0xa55c('0x46')],function(_0x26ca90){var _0x4f8f56={};_0x4f8f56[_0x26ca90]={'$like':'%'+_0x1a2f31[_0xa55c('0x43')]['filter']+'%'};return _0x4f8f56;})});}_0x568a5b=_[_0xa55c('0x4f')]({},_0x568a5b,_0x1a2f31[_0xa55c('0x51')]);return db[_0xa55c('0x6c')][_0xa55c('0x31')]({'where':_0x568a5b['where']})[_0xa55c('0x1f')](function(_0x46f8ab){_0x3b6abe[_0xa55c('0x31')]=_0x46f8ab;if(_0x1a2f31[_0xa55c('0x43')][_0xa55c('0x52')]){_0x568a5b[_0xa55c('0x53')]=[{'all':!![]}];}return db[_0xa55c('0x6c')][_0xa55c('0x54')](_0x568a5b);})['then'](function(_0x147962){_0x3b6abe[_0xa55c('0x55')]=_0x147962;return _0x3b6abe;});}})[_0xa55c('0x1f')](respondWithFilteredResult(_0x3e7aa2,_0x568a5b))[_0xa55c('0x29')](handleError(_0x3e7aa2,null));};exports[_0xa55c('0x6d')]=function(_0x111113,_0x4c6ac5,_0x46124b){return db['OpenchannelAccount'][_0xa55c('0x59')]({'where':{'id':_0x111113['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x4c6ac5,null))[_0xa55c('0x1f')](function(_0x17312b){if(_0x17312b){return _0x17312b['removeAnswers'](_0x111113[_0xa55c('0x43')][_0xa55c('0x6a')]);}})[_0xa55c('0x1f')](respondWithStatusCode(_0x4c6ac5,null))['catch'](handleError(_0x4c6ac5,null));};exports[_0xa55c('0x6e')]=function(_0x4c0c82,_0x777c32,_0x1cf9d0){var _0x5d39ca={'body':_0x4c0c82[_0xa55c('0x5b')],'channel':'openchannel'};var _0x4286e0=[];var _0x3d9a87=[];var _0x51082f={};var _0x41a2ef=![];return db[_0xa55c('0x6f')]['describe']()[_0xa55c('0x1f')](function(_0x8f3d34){if(!_0x8f3d34){throw new db['Sequelize'][(_0xa55c('0x70'))]('no\x20available\x20attributes');}_0x4286e0=_['difference'](_[_0xa55c('0x44')](_0x8f3d34),[_0xa55c('0x71'),_0xa55c('0x72')]);_0x3d9a87=_[_0xa55c('0x73')](_['keys'](_0x8f3d34),[_0xa55c('0x71'),'updatedAt',_0xa55c('0x74'),'ListId']);if(_0x4c0c82['body']['id']){delete _0x4c0c82['body']['id'];}if(_[_0xa55c('0x75')](_0x4c0c82['body']['from'])){throw new db[(_0xa55c('0x76'))][(_0xa55c('0x70'))](_0xa55c('0x77'));}if(_[_0xa55c('0x75')](_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x5b')])||_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x5b')]===''){throw new db[(_0xa55c('0x76'))][(_0xa55c('0x70'))](_0xa55c('0x78'));}if(_[_0xa55c('0x75')](_0x4c0c82[_0xa55c('0x5b')]['mapKey'])){throw new db[(_0xa55c('0x76'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d9a87);}if(!_['includes'](_0x3d9a87,_0x4c0c82[_0xa55c('0x5b')]['mapKey'])){throw new db[(_0xa55c('0x76'))]['ValidationError'](_0xa55c('0x79')+_0x3d9a87);}_0x51082f[_0x4c0c82['body']['mapKey']]=_0x4c0c82[_0xa55c('0x5b')]['from'];})['then'](function(){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x4c0c82['params']['id']},'include':[{'model':db[_0xa55c('0x7a')],'as':'List','include':[{'model':db[_0xa55c('0x6f')],'as':_0xa55c('0x7b'),'where':_0x51082f,'limit':0x1,'order':[[_0xa55c('0x72'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xa55c('0x7c')}]});})[_0xa55c('0x1f')](handleEntityNotFound(_0x777c32,null))[_0xa55c('0x1f')](function(_0xfda07f){if(_0xfda07f&&_0xfda07f[_0xa55c('0x7d')]){_0x5d39ca[_0xa55c('0x7e')]=_0xfda07f;_0x5d39ca[_0xa55c('0x7f')]=_0xfda07f[_0xa55c('0x7c')];_0x5d39ca['list']=_0xfda07f[_0xa55c('0x7d')];_0x5d39ca[_0xa55c('0x7f')]=_[_0xa55c('0x80')](_0x5d39ca[_0xa55c('0x7f')],[_0xa55c('0x81')],[_0xa55c('0x82')]);if(_0x5d39ca[_0xa55c('0x7e')][_0xa55c('0x7c')]){delete _0x5d39ca[_0xa55c('0x7e')]['Applications'];}if(_0x5d39ca[_0xa55c('0x7e')][_0xa55c('0x7d')]&&_0x5d39ca[_0xa55c('0x7e')]['List']['Contacts']['length']){return _0x5d39ca[_0xa55c('0x7e')]['List'][_0xa55c('0x7b')][0x0];}var _0x41242e=_[_0xa55c('0x83')](_0x4c0c82[_0xa55c('0x5b')],{'firstName':_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x84')],'ListId':_0xfda07f[_0xa55c('0x85')]});_0x41242e[_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x86')]]=_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x84')];return db[_0xa55c('0x6f')][_0xa55c('0x5a')](_0x41242e,{'fields':_0x4286e0,'raw':!![]});}})[_0xa55c('0x1f')](handleEntityNotFound(_0x777c32,null))[_0xa55c('0x1f')](function(_0x1c7aec){_0x5d39ca[_0xa55c('0x87')]=_0x1c7aec;if(_0x1c7aec){var _0x414680={'ContactId':_0x1c7aec['id'],'OpenchannelAccountId':_0x4c0c82[_0xa55c('0x63')]['id'],'from':(_0x1c7aec[_0xa55c('0x88')]||'')+'\x20'+(_0x1c7aec[_0xa55c('0x89')]||'')};var _0x360bfa={'OpenchannelAccountId':_0x4c0c82[_0xa55c('0x63')]['id'],'closed':![]};if(_0x4c0c82[_0xa55c('0x5b')]['threadId']){_0x360bfa[_0xa55c('0x8a')]=_0x4c0c82[_0xa55c('0x5b')]['threadId'];return db[_0xa55c('0x8b')][_0xa55c('0x59')]({'where':_0x360bfa})[_0xa55c('0x1f')](function(_0x1761ac){if(_0x1761ac){return[_0x1761ac,![]];}_0x414680[_0xa55c('0x8a')]=_0x4c0c82['body'][_0xa55c('0x8a')];_0x414680['externalUrl']=_0x4c0c82['body'][_0xa55c('0x8c')];return db[_0xa55c('0x8b')][_0xa55c('0x5a')](_0x414680)[_0xa55c('0x1f')](function(_0x370986){return[_0x370986,!![]];});});}else{_0x360bfa[_0xa55c('0x8a')]=null;}_0x360bfa[_0xa55c('0x8d')]=_0x1c7aec['id'];return db[_0xa55c('0x8b')][_0xa55c('0x59')]({'where':_0x360bfa})[_0xa55c('0x1f')](function(_0x1036b3){if(_0x1036b3){return[_0x1036b3,![]];}return db[_0xa55c('0x8b')][_0xa55c('0x5a')](_0x414680)[_0xa55c('0x1f')](function(_0x414abc){return[_0x414abc,!![]];});});}})[_0xa55c('0x8e')](function(_0x1f00f8,_0x222fd9){if(_0x1f00f8){_0x41a2ef=_0x222fd9;if(!_0x222fd9){var _0x1073c5={'from':(_0x5d39ca['contact']['firstName']||'')+'\x20'+(_0x5d39ca['contact'][_0xa55c('0x89')]||'')};if(_0x4c0c82[_0xa55c('0x5b')]['threadId']&&_0x4c0c82[_0xa55c('0x5b')]['messageId']&&_0x4c0c82[_0xa55c('0x5b')]['threadId']!=_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x8f')]){_0x1073c5[_0xa55c('0x8a')]=_0x4c0c82[_0xa55c('0x5b')][_0xa55c('0x8f')];}return _0x1f00f8[_0xa55c('0x37')](_0x1073c5);}else{return _0x1f00f8;}}})[_0xa55c('0x1f')](function(_0x41aa56){_0x5d39ca[_0xa55c('0x90')]=_0x41aa56[_0xa55c('0x39')]({'plain':!![]});_0x5d39ca[_0xa55c('0x90')]['created']=_0x41a2ef;if(_0x5d39ca['interaction'][_0xa55c('0x91')]){if(_0x5d39ca['account'][_0xa55c('0x92')]){_0x5d39ca['applications'][_0xa55c('0x93')]({'id':0x0,'priority':_0x5d39ca[_0xa55c('0x7f')][_0xa55c('0x48')]+0x1,'app':'close','appdata':_0xa55c('0x94'),'interval':_0xa55c('0x95')});}}return db[_0xa55c('0x96')]['create']({'body':_0x4c0c82[_0xa55c('0x5b')]['body'],'OpenchannelAccountId':_0x4c0c82[_0xa55c('0x63')]['id'],'OpenchannelInteractionId':_0x41aa56['id'],'direction':'in','ContactId':_0x5d39ca['contact']['id'],'AttachmentId':_0x4c0c82['body'][_0xa55c('0x97')]});})[_0xa55c('0x1f')](function(_0x203bf7){_0x5d39ca['message']=_0x203bf7;if(_0x5d39ca[_0xa55c('0x90')][_0xa55c('0x98')]){return db[_0xa55c('0x99')][_0xa55c('0x59')]({'attributes':['id',_0xa55c('0x3b')],'where':{'id':_0x5d39ca[_0xa55c('0x90')][_0xa55c('0x98')]}})[_0xa55c('0x1f')](function(_0x4b1762){if(_0x4b1762){_0x5d39ca[_0xa55c('0x7f')][_0xa55c('0x9a')]({'id':0x0,'priority':0x0,'app':_0xa55c('0x9b'),'appdata':_0x4b1762[_0xa55c('0x3b')]+','+(_0x5d39ca[_0xa55c('0x7e')][_0xa55c('0x9c')]||0xa),'interval':_0xa55c('0x95')});_0x5d39ca[_0xa55c('0x9d')]=![];}return respondWithRpcPromise(_0xa55c('0x9e'),_0xa55c('0x9f'),_0x5d39ca);});}return respondWithRpcPromise(_0xa55c('0x9e'),'startRouting',_0x5d39ca);})[_0xa55c('0x1f')](function(_0x48127c){respondWithRpcPromise('EventManager',_0xa55c('0xa0'),{'event':'notify','message':_0x48127c},client9002);return _0x48127c;})[_0xa55c('0x1f')](respondWithResult(_0x777c32,null))['catch'](handleError(_0x777c32,null));};exports[_0xa55c('0xa1')]=function(_0x231499,_0x1db744){var _0x2d3e42=_0x231499[_0xa55c('0x63')]['id'];var _0x5c7c60=_0x231499[_0xa55c('0x5b')];var _0x51b21e=0xc8;var _0x3f089b=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xa55c('0xa2')][_0xa55c('0xa3')]['ISOLATION_LEVELS'][_0xa55c('0xa4')]},function(_0x25e576){return db[_0xa55c('0x3d')]['findOne']({'where':{'id':_0x2d3e42},'transaction':_0x25e576})['then'](function(_0x57a1fc){if(_0x57a1fc){return db['OpenchannelApplication'][_0xa55c('0x38')]({'where':{'OpenchannelAccountId':_0x2d3e42},'transaction':_0x25e576})[_0xa55c('0x1f')](function(){var _0x4c77c4=_[_0xa55c('0x42')](_0x5c7c60,function(_0x1322a0){_0x1322a0[_0xa55c('0xa5')]=_0x2d3e42;return _0x1322a0;});return db['OpenchannelApplication'][_0xa55c('0xa6')](_0x4c77c4,{'transaction':_0x25e576});});}else{_0x51b21e=0x194;_0x3f089b=[];}});})['then'](function(){if(_0x51b21e!==0x194){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2d3e42},'order':_0xa55c('0x81')})['then'](function(_0x197f31){_0x3f089b=_0x197f31;});}})['catch'](function(_0x6917f2){_0x51b21e=0x1f4;logger[_0xa55c('0x25')](_0x6917f2[_0xa55c('0x3a')]);if(_0x6917f2['name']){delete _0x6917f2[_0xa55c('0x3b')];}_0x3f089b=_0x6917f2;})[_0xa55c('0xa7')](function(){if(_0x3f089b===null){_0x1db744[_0xa55c('0x2a')](_0x51b21e);}else{if(_0x51b21e===0x1f4){_0x1db744[_0xa55c('0x2b')](_0x51b21e)[_0xa55c('0x3c')](_0x3f089b);}else{_0x1db744[_0xa55c('0x2b')](_0x51b21e)[_0xa55c('0x2d')](_0x3f089b);}}});};exports[_0xa55c('0xa8')]=function(_0xfb7289,_0x4a0792,_0x8e0aeb){var _0x2a9a51={};var _0x288498={};var _0x297c38;var _0x185b41;return db[_0xa55c('0x3d')]['findOne']({'where':{'id':_0xfb7289[_0xa55c('0x63')]['id']}})['then'](handleEntityNotFound(_0x4a0792,null))[_0xa55c('0x1f')](function(_0x3c29ae){if(_0x3c29ae){_0x297c38=_0x3c29ae;_0x288498['model']=_[_0xa55c('0x44')](db[_0xa55c('0xa9')]['rawAttributes']);_0x288498['query']=_[_0xa55c('0x44')](_0xfb7289[_0xa55c('0x43')]);_0x288498[_0xa55c('0x4c')]=_[_0xa55c('0x45')](_0x288498[_0xa55c('0x41')],_0x288498[_0xa55c('0x43')]);_0x2a9a51[_0xa55c('0x46')]=_[_0xa55c('0x45')](_0x288498['model'],qs[_0xa55c('0x47')](_0xfb7289[_0xa55c('0x43')][_0xa55c('0x47')]));_0x2a9a51[_0xa55c('0x46')]=_0x2a9a51[_0xa55c('0x46')]['length']?_0x2a9a51[_0xa55c('0x46')]:_0x288498['model'];_0x2a9a51['order']=qs[_0xa55c('0x4b')](_0xfb7289[_0xa55c('0x43')][_0xa55c('0x4b')]);_0x2a9a51[_0xa55c('0x50')]=qs['filters'](_[_0xa55c('0x4d')](_0xfb7289[_0xa55c('0x43')],_0x288498[_0xa55c('0x4c')]));if(_0xfb7289[_0xa55c('0x43')][_0xa55c('0x4e')]){_0x2a9a51[_0xa55c('0x50')]=_[_0xa55c('0x4f')](_0x2a9a51[_0xa55c('0x50')],{'$or':_['map'](_0x2a9a51[_0xa55c('0x46')],function(_0xb72ac3){var _0x2639cc={};_0x2639cc[_0xb72ac3]={'$like':'%'+_0xfb7289[_0xa55c('0x43')]['filter']+'%'};return _0x2639cc;})});}_0x2a9a51=_[_0xa55c('0x4f')]({},_0x2a9a51,_0xfb7289[_0xa55c('0x51')]);return _0x297c38[_0xa55c('0xa8')](_0x2a9a51);}})['then'](function(_0x43eb27){if(_0x43eb27){_0x185b41=_0x43eb27[_0xa55c('0x48')];if(!_0xfb7289[_0xa55c('0x43')][_0xa55c('0xaa')](_0xa55c('0x49'))){_0x2a9a51[_0xa55c('0x30')]=qs[_0xa55c('0x30')](_0xfb7289['query'][_0xa55c('0x30')]);_0x2a9a51[_0xa55c('0x2e')]=qs['offset'](_0xfb7289[_0xa55c('0x43')][_0xa55c('0x2e')]);}return _0x297c38[_0xa55c('0xa8')](_0x2a9a51);}})['then'](function(_0x485382){if(_0x485382){return _0x485382?{'count':_0x185b41,'rows':_0x485382}:null;}})['then'](respondWithResult(_0x4a0792,null))[_0xa55c('0x29')](handleError(_0x4a0792,null));};exports[_0xa55c('0xab')]=function(_0x527b19,_0x507c86,_0x4754e1){var _0x1c53f0={'raw':![],'where':{}};var _0x591ee3={};var _0x5a01b0={'count':0x0,'rows':[]};return db[_0xa55c('0x3d')][_0xa55c('0x68')]({'where':{'id':_0x527b19[_0xa55c('0x63')]['id']}})['then'](handleEntityNotFound(_0x507c86,null))['then'](function(_0x37a7e1){if(_0x37a7e1){_0x591ee3['model']=_[_0xa55c('0x44')](db[_0xa55c('0x8b')]['rawAttributes']);_0x591ee3[_0xa55c('0x43')]=_['keys'](_0x527b19['query']);_0x591ee3['filters']=_['intersection'](_0x591ee3['model'],_0x591ee3[_0xa55c('0x43')]);_0x1c53f0['attributes']=_[_0xa55c('0x45')](_0x591ee3[_0xa55c('0x41')],qs[_0xa55c('0x47')](_0x527b19['query'][_0xa55c('0x47')]));_0x1c53f0[_0xa55c('0x46')]=_0x1c53f0[_0xa55c('0x46')][_0xa55c('0x48')]?_0x1c53f0[_0xa55c('0x46')]:_0x591ee3[_0xa55c('0x41')];if(!_0x527b19[_0xa55c('0x43')][_0xa55c('0xaa')](_0xa55c('0x49'))){_0x1c53f0[_0xa55c('0x30')]=qs['limit'](_0x527b19[_0xa55c('0x43')][_0xa55c('0x30')]);_0x1c53f0['offset']=qs[_0xa55c('0x2e')](_0x527b19[_0xa55c('0x43')][_0xa55c('0x2e')]);}_0x1c53f0[_0xa55c('0x4a')]=qs[_0xa55c('0x4b')](_0x527b19[_0xa55c('0x43')][_0xa55c('0x4b')]);_0x1c53f0[_0xa55c('0x50')]=qs[_0xa55c('0x4c')](_[_0xa55c('0x4d')](_0x527b19[_0xa55c('0x43')],_0x591ee3[_0xa55c('0x4c')]));_0x1c53f0[_0xa55c('0x50')][_0xa55c('0xa5')]=_0x37a7e1['id'];if(_0x527b19[_0xa55c('0x43')]['filter']){_0x1c53f0[_0xa55c('0x50')]=_['merge'](_0x1c53f0[_0xa55c('0x50')],{'$or':_[_0xa55c('0x42')](_0x1c53f0[_0xa55c('0x46')],function(_0x41de39){var _0x4a80fd={};_0x4a80fd[_0x41de39]={'$like':'%'+_0x527b19[_0xa55c('0x43')][_0xa55c('0x4e')]+'%'};return _0x4a80fd;})});}_0x1c53f0=_[_0xa55c('0x4f')]({},_0x1c53f0,_0x527b19['options']);return db[_0xa55c('0x8b')][_0xa55c('0x31')]({'where':_0x1c53f0[_0xa55c('0x50')]})['then'](function(_0x191a39){_0x5a01b0[_0xa55c('0x31')]=_0x191a39;if(_0x527b19[_0xa55c('0x43')]['includeAll']){_0x1c53f0[_0xa55c('0x53')]=[{'model':db['CmContact'],'as':_0xa55c('0xac'),'required':![]},{'model':db[_0xa55c('0x99')],'as':_0xa55c('0xad'),'attributes':[_0xa55c('0x3b'),_0xa55c('0xae'),'internal'],'required':![]},{'model':db[_0xa55c('0xaf')],'as':_0xa55c('0xb0'),'attributes':['id',_0xa55c('0x3b'),'color'],'where':_0x527b19[_0xa55c('0x43')][_0xa55c('0xb1')]?{'id':_0x527b19[_0xa55c('0x43')]['tag']}:undefined,'required':_0x527b19[_0xa55c('0x43')][_0xa55c('0xb1')]?!![]:![]}];}return db[_0xa55c('0x8b')][_0xa55c('0x54')](_0x1c53f0);})[_0xa55c('0x1f')](function(_0x2aad69){_0x5a01b0[_0xa55c('0x55')]=_0x2aad69;return _0x5a01b0;});}})['then'](respondWithFilteredResult(_0x507c86,_0x1c53f0))[_0xa55c('0x29')](handleError(_0x507c86,null));};exports[_0xa55c('0xb2')]=function(_0x3f0e63,_0x100ccb,_0x531e60){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x3f0e63[_0xa55c('0x63')]['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x100ccb,null))[_0xa55c('0x1f')](function(_0xcd4149){if(_0xcd4149){return _0xcd4149[_0xa55c('0xb2')](_0x3f0e63['body'][_0xa55c('0x6a')],_[_0xa55c('0xb3')](_0x3f0e63[_0xa55c('0x5b')],[_0xa55c('0x6a'),'id'])||{})[_0xa55c('0x8e')](function(_0x489873){for(var _0x58d20c=0x0;_0x58d20c<_0x3f0e63['body'][_0xa55c('0x6a')][_0xa55c('0x48')];_0x58d20c+=0x1){socket[_0xa55c('0xb4')](_0xa55c('0xb5'),{'UserId':Number(_0x3f0e63[_0xa55c('0x5b')][_0xa55c('0x6a')][_0x58d20c]),'OpenchannelAccountId':Number(_0x3f0e63[_0xa55c('0x63')]['id'])});}return _0x489873;});}})[_0xa55c('0x1f')](respondWithResult(_0x100ccb,null))['catch'](handleError(_0x100ccb,null));};exports[_0xa55c('0xb6')]=function(_0x3b2174,_0x35375e,_0x19a5f1){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x3b2174['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x35375e,null))['then'](function(_0x47e382){if(_0x47e382){return _0x47e382['removeAgents'](_0x3b2174['query'][_0xa55c('0x6a')])[_0xa55c('0x1f')](function(){if(_[_0xa55c('0xb7')](_0x3b2174[_0xa55c('0x43')][_0xa55c('0x6a')])){for(var _0xe125dd=0x0;_0xe125dd<_0x3b2174[_0xa55c('0x43')][_0xa55c('0x6a')][_0xa55c('0x48')];_0xe125dd+=0x1){socket[_0xa55c('0xb4')](_0xa55c('0xb8'),{'UserId':Number(_0x3b2174['query']['ids'][_0xe125dd]),'OpenchannelAccountId':Number(_0x3b2174[_0xa55c('0x63')]['id'])});}}else{socket['emit'](_0xa55c('0xb8'),{'UserId':Number(_0x3b2174[_0xa55c('0x43')][_0xa55c('0x6a')]),'OpenchannelAccountId':Number(_0x3b2174[_0xa55c('0x63')]['id'])});}});}})[_0xa55c('0x1f')](respondWithStatusCode(_0x35375e,null))[_0xa55c('0x29')](handleError(_0x35375e,null));};exports[_0xa55c('0xb9')]=function(_0x3011ac,_0x2144fe,_0x563a64){var _0x3425fe={};var _0x434754={};var _0x558889;var _0x4b8436;return db[_0xa55c('0x3d')][_0xa55c('0x68')]({'where':{'id':_0x3011ac[_0xa55c('0x63')]['id']}})['then'](handleEntityNotFound(_0x2144fe,null))[_0xa55c('0x1f')](function(_0x3622dd){if(_0x3622dd){_0x558889=_0x3622dd;_0x434754[_0xa55c('0x41')]=_[_0xa55c('0x44')](db['User']['rawAttributes']);_0x434754[_0xa55c('0x43')]=_['keys'](_0x3011ac['query']);_0x434754[_0xa55c('0x4c')]=_[_0xa55c('0x45')](_0x434754[_0xa55c('0x41')],_0x434754[_0xa55c('0x43')]);_0x3425fe['attributes']=_[_0xa55c('0x45')](_0x434754[_0xa55c('0x41')],qs[_0xa55c('0x47')](_0x3011ac[_0xa55c('0x43')][_0xa55c('0x47')]));_0x3425fe['attributes']=_0x3425fe[_0xa55c('0x46')][_0xa55c('0x48')]?_0x3425fe[_0xa55c('0x46')]:_0x434754[_0xa55c('0x41')];_0x3425fe[_0xa55c('0x4a')]=qs[_0xa55c('0x4b')](_0x3011ac[_0xa55c('0x43')]['sort']);_0x3425fe[_0xa55c('0x50')]=qs['filters'](_[_0xa55c('0x4d')](_0x3011ac[_0xa55c('0x43')],_0x434754[_0xa55c('0x4c')]));if(_0x3011ac['query']['filter']){_0x3425fe[_0xa55c('0x50')]=_[_0xa55c('0x4f')](_0x3425fe['where'],{'$or':_['map'](_0x3425fe[_0xa55c('0x46')],function(_0x1732c7){var _0x59f11d={};_0x59f11d[_0x1732c7]={'$like':'%'+_0x3011ac[_0xa55c('0x43')]['filter']+'%'};return _0x59f11d;})});}_0x3425fe=_[_0xa55c('0x4f')]({},_0x3425fe,_0x3011ac[_0xa55c('0x51')]);return _0x558889[_0xa55c('0xb9')](_0x3425fe);}})[_0xa55c('0x1f')](function(_0x53bceb){if(_0x53bceb){_0x4b8436=_0x53bceb[_0xa55c('0x48')];if(!_0x3011ac[_0xa55c('0x43')][_0xa55c('0xaa')]('nolimit')){_0x3425fe['limit']=qs[_0xa55c('0x30')](_0x3011ac['query']['limit']);_0x3425fe[_0xa55c('0x2e')]=qs[_0xa55c('0x2e')](_0x3011ac[_0xa55c('0x43')][_0xa55c('0x2e')]);}return _0x558889[_0xa55c('0xb9')](_0x3425fe);}})[_0xa55c('0x1f')](function(_0x450be7){if(_0x450be7){return _0x450be7?{'count':_0x4b8436,'rows':_0x450be7}:null;}})[_0xa55c('0x1f')](respondWithResult(_0x2144fe,null))[_0xa55c('0x29')](handleError(_0x2144fe,null));};exports[_0xa55c('0x3c')]=function(_0x59786e,_0x59452f,_0x2b6738){var _0x1d4701,_0x2fa997,_0x29fd8e;if(_['isNil'](_0x59786e[_0xa55c('0x5b')][_0xa55c('0x5b')])||_0x59786e[_0xa55c('0x5b')][_0xa55c('0x5b')]===''){throw new db['Sequelize'][(_0xa55c('0x70'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x59786e['body']['to'])){}_0x1d4701=_0x59786e['body']['to'];return db[_0xa55c('0x3d')][_0xa55c('0x68')]({'where':{'id':_0x59786e['params']['id']}})[_0xa55c('0x1f')](handleEntityNotFound(_0x59452f,null))[_0xa55c('0x1f')](function(_0x1942e8){if(_0x1942e8){return db[_0xa55c('0x3d')][_0xa55c('0x59')]({'where':{'id':_0x1942e8['id']},'include':[{'model':db[_0xa55c('0x7a')],'as':'List','include':[{'model':db[_0xa55c('0x6f')],'as':_0xa55c('0x7b'),'where':{[_0x1942e8[_0xa55c('0x86')]]:_0x1d4701},'limit':0x1,'order':[[_0xa55c('0x72'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x59452f,null))['then'](function(_0x212b54){if(_0x212b54&&_0x212b54[_0xa55c('0x7d')]){_0x2fa997=_0x212b54[_0xa55c('0x39')]({'plain':!![]});if(_0x2fa997[_0xa55c('0x7d')]&&_0x2fa997[_0xa55c('0x7d')][_0xa55c('0x7b')][_0xa55c('0x48')]){return _0x2fa997[_0xa55c('0x7d')]['Contacts'][0x0];}return db['CmContact'][_0xa55c('0x5a')](_[_0xa55c('0x83')](_0x59786e['body'],{'firstName':_0x1d4701,[_0x212b54[_0xa55c('0x86')]]:_0x1d4701,'phone':_0x1d4701,'ListId':_0x2fa997[_0xa55c('0x85')]}));}})['then'](handleEntityNotFound(_0x59452f,null))['then'](function(_0x1b82ab){if(_0x1b82ab){_0x29fd8e=_0x1b82ab;return db[_0xa55c('0x8b')][_0xa55c('0x59')]({'where':{'ContactId':_0x29fd8e['id'],'closed':![],'OpenchannelAccountId':_0x2fa997['id']}})[_0xa55c('0x1f')](function(_0x4f9c89){if(_0x4f9c89){return[_0x4f9c89,![]];}return db['OpenchannelInteraction'][_0xa55c('0x5a')]({'UserId':_0x59786e[_0xa55c('0x5c')]['id'],'ContactId':_0x29fd8e['id'],'OpenchannelAccountId':_0x2fa997['id'],'lastMsgDirection':_0xa55c('0xba'),'firstMsgDirection':_0xa55c('0xba'),'Messages':[_[_0xa55c('0x4f')](_0x59786e[_0xa55c('0x5b')],{'read':![],'body':_0x59786e[_0xa55c('0x5b')][_0xa55c('0x5b')],'OpenchannelAccountId':_0x2fa997['id'],'UserId':_0x59786e[_0xa55c('0x5c')]['id'],'ContactId':_0x29fd8e['id']})]},{'include':[{'model':db[_0xa55c('0x96')],'as':'Messages'}]})[_0xa55c('0x1f')](function(_0x55276f){return[_0x55276f,!![]];});});}})[_0xa55c('0x8e')](function(_0x3064dd,_0x385a0a){if(_0x385a0a){return _0x3064dd;}return db[_0xa55c('0x96')][_0xa55c('0x5a')](_[_0xa55c('0x4f')](_0x59786e[_0xa55c('0x5b')],{'read':![],'body':_0x59786e[_0xa55c('0x5b')][_0xa55c('0x5b')],'OpenchannelAccountId':_0x2fa997['id'],'OpenchannelInteractionId':_0x3064dd['id'],'UserId':_0x59786e[_0xa55c('0x5c')]['id'],'ContactId':_0x29fd8e['id']}))[_0xa55c('0x1f')](function(_0x157a13){_0x3064dd[_0xa55c('0xbb')]['Messages']=[];_0x3064dd[_0xa55c('0xbb')][_0xa55c('0xbc')]['push'](_0x157a13[_0xa55c('0xbb')]);return _0x3064dd;});});}})[_0xa55c('0x1f')](respondWithResult(_0x59452f,null))[_0xa55c('0x29')](handleError(_0x59452f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6c3815e..134c01e 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 _0xd64b=['exports','events','OpenchannelAccount','save','update','remove','hasOwnProperty','hook'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd64b,0xc1));var _0xbd64=function(_0x373f3c,_0x44e12b){_0x373f3c=_0x373f3c-0x0;var _0x555326=_0xd64b[_0x373f3c];return _0x555326;};'use strict';var EventEmitter=require(_0xbd64('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xbd64('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd64('0x2'),'afterUpdate':_0xbd64('0x3'),'afterDestroy':_0xbd64('0x4')};function emitEvent(_0x3f1f05){return function(_0x30fe29,_0x5458d8,_0x5446e4){OpenchannelAccountEvents['emit'](_0x3f1f05+':'+_0x30fe29['id'],_0x30fe29);OpenchannelAccountEvents['emit'](_0x3f1f05,_0x30fe29);_0x5446e4(null);};}for(var e in events){if(events[_0xbd64('0x5')](e)){var event=events[e];OpenchannelAccount[_0xbd64('0x6')](e,emitEvent(event));}}module[_0xbd64('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0x108f9a,_0x9c2847){var _0x2f7282=function(_0x46af9c){while(--_0x46af9c){_0x108f9a['push'](_0x108f9a['shift']());}};_0x2f7282(++_0x9c2847);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var OpenchannelAccount=require(_0xc6e6('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);OpenchannelAccountEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 71eedc2..4ca0ab3 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(_0x340836,_0x2b2691){var _0x623346=function(_0x3f3d7f){while(--_0x3f3d7f){_0x340836['push'](_0x340836['shift']());}};_0x623346(++_0x2b2691);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x592630,_0x399a94){var _0x32feb2=function(_0x4bded8){while(--_0x4bded8){_0x592630['push'](_0x592630['shift']());}};_0x32feb2(++_0x399a94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 15babc4..4307d39 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 _0x6b20=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x31551b,_0x528352){var _0x332c28=function(_0x348112){while(--_0x348112){_0x31551b['push'](_0x31551b['shift']());}};_0x332c28(++_0x528352);}(_0x6b20,0xd1));var _0x06b2=function(_0x190cda,_0xcc9eee){_0x190cda=_0x190cda-0x0;var _0x2cf6ad=_0x6b20[_0x190cda];return _0x2cf6ad;};'use strict';var _=require(_0x06b2('0x0'));var util=require(_0x06b2('0x1'));var moment=require('moment');var BPromise=require(_0x06b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x06b2('0x3'));var db=require(_0x06b2('0x4'))['db'];var utils=require(_0x06b2('0x5'));var logger=require('../../config/logger')(_0x06b2('0x6'));var config=require(_0x06b2('0x7'));var jayson=require(_0x06b2('0x8'));var client=jayson[_0x06b2('0x9')][_0x06b2('0xa')]({'port':0x232a});config[_0x06b2('0xb')]=_[_0x06b2('0xc')](config['redis'],{'host':_0x06b2('0xd'),'port':0x18eb});var socket=require(_0x06b2('0xe'))(new Redis(config[_0x06b2('0xb')]));require('./openchannelAccount.socket')[_0x06b2('0xf')](socket);function respondWithRpcPromise(_0x57f854,_0x2cc28f,_0x4da705){return new BPromise(function(_0x552cd8,_0x301519){return client[_0x06b2('0x10')](_0x57f854,_0x4da705)['then'](function(_0x182f8f){logger[_0x06b2('0x11')](_0x06b2('0x12'),_0x2cc28f,_0x06b2('0x13'));logger[_0x06b2('0x14')](_0x06b2('0x15'),_0x2cc28f,_0x06b2('0x13'),JSON[_0x06b2('0x16')](_0x182f8f));if(_0x182f8f[_0x06b2('0x17')]){if(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x18')]===0x1f4){logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f['error'][_0x06b2('0x19')]);return _0x301519(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}logger[_0x06b2('0x17')](_0x06b2('0x12'),_0x2cc28f,_0x182f8f[_0x06b2('0x17')]['message']);return _0x552cd8(_0x182f8f[_0x06b2('0x17')][_0x06b2('0x19')]);}else{logger['info'](_0x06b2('0x12'),_0x2cc28f,'request\x20sent');_0x552cd8(_0x182f8f['result'][_0x06b2('0x19')]);}})[_0x06b2('0x1a')](function(_0x27852e){logger[_0x06b2('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2cc28f,_0x27852e);_0x301519(_0x27852e);});});} \ No newline at end of file +var _0x0db9=['stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0xea767b,_0x23c2e7){var _0x3e0105=function(_0x4b250d){while(--_0x4b250d){_0xea767b['push'](_0xea767b['shift']());}};_0x3e0105(++_0x23c2e7);}(_0x0db9,0xa3));var _0x90db=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0db9[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});config[_0x90db('0x8')]=_[_0x90db('0x9')](config[_0x90db('0x8')],{'host':_0x90db('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90db('0x8')]));require(_0x90db('0xb'))[_0x90db('0xc')](socket);function respondWithRpcPromise(_0x3d5bfd,_0x26eb8f,_0x9a578c){return new BPromise(function(_0xbd058e,_0x1d9f78){return client[_0x90db('0xd')](_0x3d5bfd,_0x9a578c)[_0x90db('0xe')](function(_0x2cb70b){logger['info'](_0x90db('0xf'),_0x26eb8f,_0x90db('0x10'));logger[_0x90db('0x11')](_0x90db('0x12'),_0x26eb8f,_0x90db('0x10'),JSON[_0x90db('0x13')](_0x2cb70b));if(_0x2cb70b[_0x90db('0x14')]){if(_0x2cb70b[_0x90db('0x14')][_0x90db('0x15')]===0x1f4){logger[_0x90db('0x14')](_0x90db('0xf'),_0x26eb8f,_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);return _0x1d9f78(_0x2cb70b[_0x90db('0x14')]['message']);}logger[_0x90db('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x26eb8f,_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);return _0xbd058e(_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);}else{logger[_0x90db('0x17')](_0x90db('0xf'),_0x26eb8f,_0x90db('0x10'));_0xbd058e(_0x2cb70b[_0x90db('0x18')][_0x90db('0x16')]);}})[_0x90db('0x19')](function(_0x5b373b){logger[_0x90db('0x14')](_0x90db('0xf'),_0x26eb8f,_0x5b373b);_0x1d9f78(_0x5b373b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 65c4d82..8a89edb 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 _0x803f=['length','openchannelAccount:','./openchannelAccount.events','remove','update','emit','register'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0x803f,0x64));var _0xf803=function(_0x3ef36d,_0x37781b){_0x3ef36d=_0x3ef36d-0x0;var _0x3890cc=_0x803f[_0x3ef36d];return _0x3890cc;};'use strict';var OpenchannelAccountEvents=require(_0xf803('0x0'));var events=['save',_0xf803('0x1'),_0xf803('0x2')];function createListener(_0x4ce875,_0x1a8691){return function(_0x43fb3b){_0x1a8691[_0xf803('0x3')](_0x4ce875,_0x43fb3b);};}function removeListener(_0x6baafe,_0x5c2cd6){return function(){OpenchannelAccountEvents['removeListener'](_0x6baafe,_0x5c2cd6);};}exports[_0xf803('0x4')]=function(_0x2ba12f){for(var _0x1d3a79=0x0,_0x584b2d=events[_0xf803('0x5')];_0x1d3a79<_0x584b2d;_0x1d3a79++){var _0x47128f=events[_0x1d3a79];var _0x587319=createListener(_0xf803('0x6')+_0x47128f,_0x2ba12f);OpenchannelAccountEvents['on'](_0x47128f,_0x587319);}}; \ No newline at end of file +var _0x8bdf=['./openchannelAccount.events','save','remove','update','emit','removeListener','register','length','openchannelAccount:'];(function(_0x535724,_0x4e589e){var _0x68e768=function(_0x16ee4d){while(--_0x16ee4d){_0x535724['push'](_0x535724['shift']());}};_0x68e768(++_0x4e589e);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8bdf[_0x297fd3];return _0x2af381;};'use strict';var OpenchannelAccountEvents=require(_0xf8bd('0x0'));var events=[_0xf8bd('0x1'),_0xf8bd('0x2'),_0xf8bd('0x3')];function createListener(_0x336d9f,_0x57e7be){return function(_0x35ddcf){_0x57e7be[_0xf8bd('0x4')](_0x336d9f,_0x35ddcf);};}function removeListener(_0x147fea,_0x3b32a1){return function(){OpenchannelAccountEvents[_0xf8bd('0x5')](_0x147fea,_0x3b32a1);};}exports[_0xf8bd('0x6')]=function(_0x59eff9){for(var _0x4ed701=0x0,_0x504c82=events[_0xf8bd('0x7')];_0x4ed701<_0x504c82;_0x4ed701++){var _0x22a277=events[_0x4ed701];var _0x3e1db1=createListener(_0xf8bd('0x8')+_0x22a277,_0x59eff9);OpenchannelAccountEvents['on'](_0x22a277,_0x3e1db1);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index e1c3782..0102aa7 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 _0x36b0=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','put','destroy','exports','util','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36b0,0xa2));var _0x036b=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x36b0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require('multer');var util=require(_0x036b('0x0'));var path=require(_0x036b('0x1'));var timeout=require('connect-timeout');var express=require(_0x036b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x036b('0x3'));var interaction=require(_0x036b('0x4'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0x036b('0x5')]('/',auth[_0x036b('0x6')](),controller[_0x036b('0x7')]);router[_0x036b('0x5')](_0x036b('0x8'),auth['isAuthenticated'](),controller[_0x036b('0x9')]);router[_0x036b('0xa')]('/',auth[_0x036b('0x6')](),controller[_0x036b('0xb')]);router[_0x036b('0xc')](_0x036b('0x8'),auth[_0x036b('0x6')](),controller['update']);router['delete'](_0x036b('0x8'),auth[_0x036b('0x6')](),controller[_0x036b('0xd')]);module[_0x036b('0xe')]=router; \ No newline at end of file +var _0xe0d5=['exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','post','isAuthenticated','create','delete','destroy'];(function(_0x2e10b1,_0x845b82){var _0x41de8b=function(_0x3cad6d){while(--_0x3cad6d){_0x2e10b1['push'](_0x2e10b1['shift']());}};_0x41de8b(++_0x845b82);}(_0xe0d5,0x1c1));var _0x5e0d=function(_0x21adfc,_0x13ca07){_0x21adfc=_0x21adfc-0x0;var _0x1a0778=_0xe0d5[_0x21adfc];return _0x1a0778;};'use strict';var multer=require('multer');var util=require(_0x5e0d('0x0'));var path=require('path');var timeout=require(_0x5e0d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5e0d('0x2'));var auth=require(_0x5e0d('0x3'));var interaction=require(_0x5e0d('0x4'));var config=require(_0x5e0d('0x5'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5e0d('0x6')]);router[_0x5e0d('0x7')](_0x5e0d('0x8'),auth['isAuthenticated'](),controller[_0x5e0d('0x9')]);router[_0x5e0d('0xa')]('/',auth[_0x5e0d('0xb')](),controller[_0x5e0d('0xc')]);router['put'](_0x5e0d('0x8'),auth[_0x5e0d('0xb')](),controller['update']);router[_0x5e0d('0xd')]('/:id',auth[_0x5e0d('0xb')](),controller[_0x5e0d('0xe')]);module[_0x5e0d('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index df8de77..3932b7f 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 _0xde2f=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xde2f,0x18d));var _0xfde2=function(_0x58c2aa,_0x4de1f3){_0x58c2aa=_0x58c2aa-0x0;var _0x12391d=_0xde2f[_0x58c2aa];return _0x12391d;};'use strict';var Sequelize=require(_0xfde2('0x0'));module['exports']={'priority':{'type':Sequelize[_0xfde2('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xfde2('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xfde2('0x3')]()},'description':{'type':Sequelize[_0xfde2('0x2')]},'interval':{'type':Sequelize[_0xfde2('0x2')],'defaultValue':_0xfde2('0x4')}}; \ No newline at end of file +var _0x398e=['TEXT','STRING','exports','INTEGER'];(function(_0x4a2fa8,_0x536247){var _0xf982c6=function(_0x4006d1){while(--_0x4006d1){_0x4a2fa8['push'](_0x4a2fa8['shift']());}};_0xf982c6(++_0x536247);}(_0x398e,0x192));var _0xe398=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x398e[_0x4dab14];return _0xf41aa;};'use strict';var Sequelize=require('sequelize');module[_0xe398('0x0')]={'priority':{'type':Sequelize[_0xe398('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe398('0x2')]()},'description':{'type':Sequelize[_0xe398('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 0ed16e2..6d0b683 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 _0x4cef=['bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','name','index','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','catch','show','params','keys','intersection','fields','length','find','create','body','rimraf','zip-dir'];(function(_0x333fdc,_0x6fb8cf){var _0x12ad3f=function(_0x24d13d){while(--_0x24d13d){_0x333fdc['push'](_0x333fdc['shift']());}};_0x12ad3f(++_0x6fb8cf);}(_0x4cef,0x1ae));var _0xf4ce=function(_0x15cc17,_0x5a498d){_0x15cc17=_0x15cc17-0x0;var _0x9607cc=_0x4cef[_0x15cc17];return _0x9607cc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4ce('0x0'));var zipdir=require(_0xf4ce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf4ce('0x2'));var Mustache=require(_0xf4ce('0x3'));var util=require(_0xf4ce('0x4'));var path=require(_0xf4ce('0x5'));var sox=require('sox');var csv=require(_0xf4ce('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf4ce('0x7'));var _=require(_0xf4ce('0x8'));var squel=require(_0xf4ce('0x9'));var crypto=require('crypto');var jsforce=require(_0xf4ce('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf4ce('0x6'));var querystring=require(_0xf4ce('0xb'));var Papa=require(_0xf4ce('0xc'));var Redis=require(_0xf4ce('0xd'));var authService=require(_0xf4ce('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf4ce('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf4ce('0x10'))(_0xf4ce('0x11'));var utils=require(_0xf4ce('0x12'));var config=require(_0xf4ce('0x13'));var licenseUtil=require(_0xf4ce('0x14'));var db=require(_0xf4ce('0x15'))['db'];function respondWithStatusCode(_0x200fd5,_0x28796c){_0x28796c=_0x28796c||0xcc;return function(_0x453576){if(_0x453576){return _0x200fd5[_0xf4ce('0x16')](_0x28796c);}return _0x200fd5[_0xf4ce('0x17')](_0x28796c)[_0xf4ce('0x18')]();};}function respondWithResult(_0x36b36b,_0x2c127e){_0x2c127e=_0x2c127e||0xc8;return function(_0x2bde26){if(_0x2bde26){return _0x36b36b['status'](_0x2c127e)['json'](_0x2bde26);}};}function respondWithFilteredResult(_0x440852,_0x20d120){return function(_0x3ab495){if(_0x3ab495){var _0x24d708=typeof _0x20d120[_0xf4ce('0x19')]===_0xf4ce('0x1a')&&typeof _0x20d120['limit']===_0xf4ce('0x1a');var _0x480475=_0x3ab495[_0xf4ce('0x1b')];var _0x5376cb=_0x24d708?0x0:_0x20d120['offset'];var _0x56daa3=_0x24d708?_0x3ab495['count']:_0x20d120[_0xf4ce('0x19')]+_0x20d120['limit'];var _0x4d9c52;if(_0x56daa3>=_0x480475){_0x56daa3=_0x480475;_0x4d9c52=0xc8;}else{_0x4d9c52=0xce;}_0x440852[_0xf4ce('0x17')](_0x4d9c52);return _0x440852[_0xf4ce('0x1c')](_0xf4ce('0x1d'),_0x5376cb+'-'+_0x56daa3+'/'+_0x480475)[_0xf4ce('0x1e')](_0x3ab495);}return null;};}function patchUpdates(_0x419623){return function(_0x232ea9){try{jsonpatch[_0xf4ce('0x1f')](_0x232ea9,_0x419623,!![]);}catch(_0x2e647d){return BPromise['reject'](_0x2e647d);}return _0x232ea9[_0xf4ce('0x20')]();};}function saveUpdates(_0x4f1ac8,_0x17f349){return function(_0x5d8444){if(_0x5d8444){return _0x5d8444[_0xf4ce('0x21')](_0x4f1ac8)[_0xf4ce('0x22')](function(_0x5e5b63){return _0x5e5b63;});}return null;};}function removeEntity(_0x26d2aa,_0x8aa2c1){return function(_0x1349b8){if(_0x1349b8){return _0x1349b8[_0xf4ce('0x23')]()['then'](function(){_0x26d2aa[_0xf4ce('0x17')](0xcc)[_0xf4ce('0x18')]();});}};}function handleEntityNotFound(_0x2852a6,_0x5226f1){return function(_0x5aca2f){if(!_0x5aca2f){_0x2852a6['sendStatus'](0x194);}return _0x5aca2f;};}function handleError(_0x109415,_0x22a523){_0x22a523=_0x22a523||0x1f4;return function(_0x331366){logger['error'](_0x331366['stack']);if(_0x331366[_0xf4ce('0x24')]){delete _0x331366[_0xf4ce('0x24')];}_0x109415[_0xf4ce('0x17')](_0x22a523)['send'](_0x331366);};}exports[_0xf4ce('0x25')]=function(_0x3edebf,_0x469d36){var _0x32ea34={},_0x10b9c6={},_0x4f342e={'count':0x0,'rows':[]};var _0x593031=_['map'](db['OpenchannelApplication'][_0xf4ce('0x26')],function(_0x23b991){return{'name':_0x23b991[_0xf4ce('0x27')],'type':_0x23b991[_0xf4ce('0x28')][_0xf4ce('0x29')]};});_0x10b9c6['model']=_[_0xf4ce('0x2a')](_0x593031,_0xf4ce('0x24'));_0x10b9c6['query']=_['keys'](_0x3edebf[_0xf4ce('0x2b')]);_0x10b9c6[_0xf4ce('0x2c')]=_['intersection'](_0x10b9c6[_0xf4ce('0x2d')],_0x10b9c6[_0xf4ce('0x2b')]);_0x32ea34['attributes']=_['intersection'](_0x10b9c6[_0xf4ce('0x2d')],qs['fields'](_0x3edebf['query']['fields']));_0x32ea34['attributes']=_0x32ea34[_0xf4ce('0x2e')]['length']?_0x32ea34[_0xf4ce('0x2e')]:_0x10b9c6['model'];if(!_0x3edebf[_0xf4ce('0x2b')][_0xf4ce('0x2f')](_0xf4ce('0x30'))){_0x32ea34[_0xf4ce('0x31')]=qs[_0xf4ce('0x31')](_0x3edebf['query']['limit']);_0x32ea34[_0xf4ce('0x19')]=qs[_0xf4ce('0x19')](_0x3edebf[_0xf4ce('0x2b')][_0xf4ce('0x19')]);}_0x32ea34[_0xf4ce('0x32')]=qs['sort'](_0x3edebf[_0xf4ce('0x2b')][_0xf4ce('0x33')]);_0x32ea34[_0xf4ce('0x34')]=qs['filters'](_[_0xf4ce('0x35')](_0x3edebf[_0xf4ce('0x2b')],_0x10b9c6[_0xf4ce('0x2c')]),_0x593031);if(_0x3edebf['query'][_0xf4ce('0x36')]){_0x32ea34[_0xf4ce('0x34')]=_[_0xf4ce('0x37')](_0x32ea34['where'],{'$or':_[_0xf4ce('0x2a')](_0x593031,function(_0x529547){if(_0x529547[_0xf4ce('0x28')]!==_0xf4ce('0x38')){var _0x2c25aa={};_0x2c25aa[_0x529547[_0xf4ce('0x24')]]={'$like':'%'+_0x3edebf[_0xf4ce('0x2b')][_0xf4ce('0x36')]+'%'};return _0x2c25aa;}})});}_0x32ea34=_[_0xf4ce('0x37')]({},_0x32ea34,_0x3edebf[_0xf4ce('0x39')]);var _0x51fb03={'where':_0x32ea34[_0xf4ce('0x34')]};return db[_0xf4ce('0x3a')][_0xf4ce('0x1b')](_0x51fb03)['then'](function(_0x3958e5){_0x4f342e[_0xf4ce('0x1b')]=_0x3958e5;if(_0x3edebf[_0xf4ce('0x2b')][_0xf4ce('0x3b')]){_0x32ea34[_0xf4ce('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf4ce('0x3d')](_0x32ea34);})[_0xf4ce('0x22')](function(_0x1c569e){_0x4f342e['rows']=_0x1c569e;return _0x4f342e;})[_0xf4ce('0x22')](respondWithFilteredResult(_0x469d36,_0x32ea34))[_0xf4ce('0x3e')](handleError(_0x469d36,null));};exports[_0xf4ce('0x3f')]=function(_0x1c1e3d,_0x33192f){var _0x24dd98={'raw':!![],'where':{'id':_0x1c1e3d[_0xf4ce('0x40')]['id']}},_0x161839={};_0x161839['model']=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x161839[_0xf4ce('0x2b')]=_[_0xf4ce('0x41')](_0x1c1e3d[_0xf4ce('0x2b')]);_0x161839[_0xf4ce('0x2c')]=_[_0xf4ce('0x42')](_0x161839['model'],_0x161839[_0xf4ce('0x2b')]);_0x24dd98[_0xf4ce('0x2e')]=_[_0xf4ce('0x42')](_0x161839[_0xf4ce('0x2d')],qs[_0xf4ce('0x43')](_0x1c1e3d[_0xf4ce('0x2b')][_0xf4ce('0x43')]));_0x24dd98[_0xf4ce('0x2e')]=_0x24dd98['attributes'][_0xf4ce('0x44')]?_0x24dd98[_0xf4ce('0x2e')]:_0x161839[_0xf4ce('0x2d')];if(_0x1c1e3d[_0xf4ce('0x2b')]['includeAll']){_0x24dd98['include']=[{'all':!![]}];}_0x24dd98=_[_0xf4ce('0x37')]({},_0x24dd98,_0x1c1e3d[_0xf4ce('0x39')]);return db[_0xf4ce('0x3a')][_0xf4ce('0x45')](_0x24dd98)['then'](handleEntityNotFound(_0x33192f,null))[_0xf4ce('0x22')](respondWithResult(_0x33192f,null))[_0xf4ce('0x3e')](handleError(_0x33192f,null));};exports[_0xf4ce('0x46')]=function(_0xbba7a3,_0xbec28c){return db[_0xf4ce('0x3a')][_0xf4ce('0x46')](_0xbba7a3[_0xf4ce('0x47')],{})[_0xf4ce('0x22')](respondWithResult(_0xbec28c,0xc9))['catch'](handleError(_0xbec28c,null));};exports['update']=function(_0x2c909f,_0x3c840e){if(_0x2c909f['body']['id']){delete _0x2c909f[_0xf4ce('0x47')]['id'];}return db[_0xf4ce('0x3a')][_0xf4ce('0x45')]({'where':{'id':_0x2c909f[_0xf4ce('0x40')]['id']}})[_0xf4ce('0x22')](handleEntityNotFound(_0x3c840e,null))[_0xf4ce('0x22')](saveUpdates(_0x2c909f[_0xf4ce('0x47')],null))[_0xf4ce('0x22')](respondWithResult(_0x3c840e,null))[_0xf4ce('0x3e')](handleError(_0x3c840e,null));};exports['destroy']=function(_0xa87d7d,_0xc2661a){return db['OpenchannelApplication'][_0xf4ce('0x45')]({'where':{'id':_0xa87d7d[_0xf4ce('0x40')]['id']}})[_0xf4ce('0x22')](handleEntityNotFound(_0xc2661a,null))[_0xf4ce('0x22')](removeEntity(_0xc2661a,null))[_0xf4ce('0x3e')](handleError(_0xc2661a,null));}; \ No newline at end of file +var _0xf619=['set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','OpenchannelApplication','rawAttributes','fieldName','type','map','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','length','options','create','body','find','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x44439b,_0x304902){var _0x51037a=function(_0x43cad8){while(--_0x43cad8){_0x44439b['push'](_0x44439b['shift']());}};_0x51037a(++_0x304902);}(_0xf619,0x14e));var _0x9f61=function(_0x543e66,_0x562c37){_0x543e66=_0x543e66-0x0;var _0x1e01e9=_0xf619[_0x543e66];return _0x1e01e9;};'use strict';var emlformat=require(_0x9f61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f61('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f61('0x2'));var moment=require(_0x9f61('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9f61('0x4'));var util=require(_0x9f61('0x5'));var path=require(_0x9f61('0x6'));var sox=require(_0x9f61('0x7'));var csv=require(_0x9f61('0x8'));var ejs=require(_0x9f61('0x9'));var fs=require('fs');var fs_extra=require(_0x9f61('0xa'));var _=require(_0x9f61('0xb'));var squel=require(_0x9f61('0xc'));var crypto=require(_0x9f61('0xd'));var jsforce=require(_0x9f61('0xe'));var deskjs=require(_0x9f61('0xf'));var toCsv=require(_0x9f61('0x8'));var querystring=require(_0x9f61('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f61('0x11'));var as=require(_0x9f61('0x12'));var hardwareService=require(_0x9f61('0x13'));var logger=require('../../config/logger')(_0x9f61('0x14'));var utils=require('../../config/utils');var config=require(_0x9f61('0x15'));var licenseUtil=require(_0x9f61('0x16'));var db=require(_0x9f61('0x17'))['db'];function respondWithStatusCode(_0x27dd2c,_0x111184){_0x111184=_0x111184||0xcc;return function(_0x162181){if(_0x162181){return _0x27dd2c[_0x9f61('0x18')](_0x111184);}return _0x27dd2c[_0x9f61('0x19')](_0x111184)['end']();};}function respondWithResult(_0x576f8e,_0x33e6d1){_0x33e6d1=_0x33e6d1||0xc8;return function(_0x38dbec){if(_0x38dbec){return _0x576f8e[_0x9f61('0x19')](_0x33e6d1)[_0x9f61('0x1a')](_0x38dbec);}};}function respondWithFilteredResult(_0x284f78,_0x4a8e17){return function(_0x51dbb9){if(_0x51dbb9){var _0xb96701=typeof _0x4a8e17[_0x9f61('0x1b')]===_0x9f61('0x1c')&&typeof _0x4a8e17[_0x9f61('0x1d')]===_0x9f61('0x1c');var _0x201d9a=_0x51dbb9[_0x9f61('0x1e')];var _0x4fef00=_0xb96701?0x0:_0x4a8e17['offset'];var _0x3ec105=_0xb96701?_0x51dbb9[_0x9f61('0x1e')]:_0x4a8e17['offset']+_0x4a8e17[_0x9f61('0x1d')];var _0x58f256;if(_0x3ec105>=_0x201d9a){_0x3ec105=_0x201d9a;_0x58f256=0xc8;}else{_0x58f256=0xce;}_0x284f78[_0x9f61('0x19')](_0x58f256);return _0x284f78[_0x9f61('0x1f')](_0x9f61('0x20'),_0x4fef00+'-'+_0x3ec105+'/'+_0x201d9a)[_0x9f61('0x1a')](_0x51dbb9);}return null;};}function patchUpdates(_0x13897b){return function(_0x5c138d){try{jsonpatch[_0x9f61('0x21')](_0x5c138d,_0x13897b,!![]);}catch(_0x2ba534){return BPromise[_0x9f61('0x22')](_0x2ba534);}return _0x5c138d[_0x9f61('0x23')]();};}function saveUpdates(_0x34c408,_0x25d1ac){return function(_0x47db5e){if(_0x47db5e){return _0x47db5e[_0x9f61('0x24')](_0x34c408)['then'](function(_0x3725a8){return _0x3725a8;});}return null;};}function removeEntity(_0x2fbf62,_0x319f94){return function(_0x3e9af8){if(_0x3e9af8){return _0x3e9af8[_0x9f61('0x25')]()[_0x9f61('0x26')](function(){_0x2fbf62[_0x9f61('0x19')](0xcc)[_0x9f61('0x27')]();});}};}function handleEntityNotFound(_0x1917d1,_0x4ef9f6){return function(_0x5d0344){if(!_0x5d0344){_0x1917d1['sendStatus'](0x194);}return _0x5d0344;};}function handleError(_0x1e6a1a,_0x11bfee){_0x11bfee=_0x11bfee||0x1f4;return function(_0x51a853){logger[_0x9f61('0x28')](_0x51a853[_0x9f61('0x29')]);if(_0x51a853[_0x9f61('0x2a')]){delete _0x51a853[_0x9f61('0x2a')];}_0x1e6a1a[_0x9f61('0x19')](_0x11bfee)[_0x9f61('0x2b')](_0x51a853);};}exports['index']=function(_0x3cb875,_0x340b8c){var _0x3a2aa4={},_0x16aa67={},_0x9dd44d={'count':0x0,'rows':[]};var _0x3ed766=_['map'](db[_0x9f61('0x2c')][_0x9f61('0x2d')],function(_0x5e4aa6){return{'name':_0x5e4aa6[_0x9f61('0x2e')],'type':_0x5e4aa6[_0x9f61('0x2f')]['key']};});_0x16aa67['model']=_[_0x9f61('0x30')](_0x3ed766,'name');_0x16aa67[_0x9f61('0x31')]=_[_0x9f61('0x32')](_0x3cb875[_0x9f61('0x31')]);_0x16aa67['filters']=_['intersection'](_0x16aa67[_0x9f61('0x33')],_0x16aa67[_0x9f61('0x31')]);_0x3a2aa4[_0x9f61('0x34')]=_[_0x9f61('0x35')](_0x16aa67[_0x9f61('0x33')],qs[_0x9f61('0x36')](_0x3cb875['query'][_0x9f61('0x36')]));_0x3a2aa4['attributes']=_0x3a2aa4[_0x9f61('0x34')]['length']?_0x3a2aa4[_0x9f61('0x34')]:_0x16aa67['model'];if(!_0x3cb875[_0x9f61('0x31')][_0x9f61('0x37')]('nolimit')){_0x3a2aa4[_0x9f61('0x1d')]=qs[_0x9f61('0x1d')](_0x3cb875[_0x9f61('0x31')][_0x9f61('0x1d')]);_0x3a2aa4[_0x9f61('0x1b')]=qs[_0x9f61('0x1b')](_0x3cb875[_0x9f61('0x31')][_0x9f61('0x1b')]);}_0x3a2aa4['order']=qs[_0x9f61('0x38')](_0x3cb875[_0x9f61('0x31')][_0x9f61('0x38')]);_0x3a2aa4[_0x9f61('0x39')]=qs[_0x9f61('0x3a')](_[_0x9f61('0x3b')](_0x3cb875[_0x9f61('0x31')],_0x16aa67[_0x9f61('0x3a')]),_0x3ed766);if(_0x3cb875[_0x9f61('0x31')][_0x9f61('0x3c')]){_0x3a2aa4[_0x9f61('0x39')]=_[_0x9f61('0x3d')](_0x3a2aa4[_0x9f61('0x39')],{'$or':_['map'](_0x3ed766,function(_0x6f2669){if(_0x6f2669[_0x9f61('0x2f')]!==_0x9f61('0x3e')){var _0x1c867f={};_0x1c867f[_0x6f2669[_0x9f61('0x2a')]]={'$like':'%'+_0x3cb875[_0x9f61('0x31')][_0x9f61('0x3c')]+'%'};return _0x1c867f;}})});}_0x3a2aa4=_[_0x9f61('0x3d')]({},_0x3a2aa4,_0x3cb875['options']);var _0x8c3481={'where':_0x3a2aa4[_0x9f61('0x39')]};return db[_0x9f61('0x2c')]['count'](_0x8c3481)[_0x9f61('0x26')](function(_0x4b70a6){_0x9dd44d[_0x9f61('0x1e')]=_0x4b70a6;if(_0x3cb875[_0x9f61('0x31')][_0x9f61('0x3f')]){_0x3a2aa4['include']=[{'all':!![]}];}return db[_0x9f61('0x2c')][_0x9f61('0x40')](_0x3a2aa4);})[_0x9f61('0x26')](function(_0xe4822a){_0x9dd44d[_0x9f61('0x41')]=_0xe4822a;return _0x9dd44d;})[_0x9f61('0x26')](respondWithFilteredResult(_0x340b8c,_0x3a2aa4))[_0x9f61('0x42')](handleError(_0x340b8c,null));};exports['show']=function(_0x518b47,_0x5ddb7d){var _0x35c454={'raw':!![],'where':{'id':_0x518b47[_0x9f61('0x43')]['id']}},_0x27eac0={};_0x27eac0[_0x9f61('0x33')]=_[_0x9f61('0x32')](db[_0x9f61('0x2c')][_0x9f61('0x2d')]);_0x27eac0[_0x9f61('0x31')]=_[_0x9f61('0x32')](_0x518b47[_0x9f61('0x31')]);_0x27eac0[_0x9f61('0x3a')]=_['intersection'](_0x27eac0[_0x9f61('0x33')],_0x27eac0[_0x9f61('0x31')]);_0x35c454[_0x9f61('0x34')]=_[_0x9f61('0x35')](_0x27eac0['model'],qs['fields'](_0x518b47[_0x9f61('0x31')][_0x9f61('0x36')]));_0x35c454[_0x9f61('0x34')]=_0x35c454['attributes'][_0x9f61('0x44')]?_0x35c454['attributes']:_0x27eac0['model'];if(_0x518b47['query'][_0x9f61('0x3f')]){_0x35c454['include']=[{'all':!![]}];}_0x35c454=_[_0x9f61('0x3d')]({},_0x35c454,_0x518b47[_0x9f61('0x45')]);return db['OpenchannelApplication']['find'](_0x35c454)[_0x9f61('0x26')](handleEntityNotFound(_0x5ddb7d,null))[_0x9f61('0x26')](respondWithResult(_0x5ddb7d,null))['catch'](handleError(_0x5ddb7d,null));};exports[_0x9f61('0x46')]=function(_0x308698,_0x496e11){return db[_0x9f61('0x2c')][_0x9f61('0x46')](_0x308698[_0x9f61('0x47')],{})[_0x9f61('0x26')](respondWithResult(_0x496e11,0xc9))[_0x9f61('0x42')](handleError(_0x496e11,null));};exports[_0x9f61('0x24')]=function(_0x527290,_0x80c26a){if(_0x527290['body']['id']){delete _0x527290[_0x9f61('0x47')]['id'];}return db[_0x9f61('0x2c')][_0x9f61('0x48')]({'where':{'id':_0x527290['params']['id']}})['then'](handleEntityNotFound(_0x80c26a,null))[_0x9f61('0x26')](saveUpdates(_0x527290[_0x9f61('0x47')],null))[_0x9f61('0x26')](respondWithResult(_0x80c26a,null))[_0x9f61('0x42')](handleError(_0x80c26a,null));};exports[_0x9f61('0x25')]=function(_0x4866ba,_0x2608b7){return db[_0x9f61('0x2c')][_0x9f61('0x48')]({'where':{'id':_0x4866ba[_0x9f61('0x43')]['id']}})[_0x9f61('0x26')](handleEntityNotFound(_0x2608b7,null))[_0x9f61('0x26')](removeEntity(_0x2608b7,null))[_0x9f61('0x42')](handleError(_0x2608b7,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 863f713..d3d2bb2 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 _0x79b9=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79b9,0x83));var _0x979b=function(_0x2e80f2,_0x4a8364){_0x2e80f2=_0x2e80f2-0x0;var _0x12ef3c=_0x79b9[_0x2e80f2];return _0x12ef3c;};'use strict';var _=require('lodash');var util=require(_0x979b('0x0'));var logger=require(_0x979b('0x1'))(_0x979b('0x2'));var moment=require('moment');var BPromise=require(_0x979b('0x3'));var rp=require(_0x979b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x979b('0x5'));var config=require(_0x979b('0x6'));var attributes=require(_0x979b('0x7'));module[_0x979b('0x8')]=function(_0x397e38,_0x6e8482){return _0x397e38['define'](_0x979b('0x9'),attributes,{'tableName':_0x979b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x979b('0xb'),'collate':_0x979b('0xc')});}; \ No newline at end of file +var _0x7f23=['path','../../config/environment','exports','define','OpenchannelApplication','utf8mb4','lodash','api','moment','bluebird','request-promise'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0x7f23,0x12f));var _0x37f2=function(_0x560dc9,_0x1c92a8){_0x560dc9=_0x560dc9-0x0;var _0x352cef=_0x7f23[_0x560dc9];return _0x352cef;};'use strict';var _=require(_0x37f2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x37f2('0x1'));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('./openchannelApplication.attributes');module[_0x37f2('0x7')]=function(_0x3f96c1,_0x282fd8){return _0x3f96c1[_0x37f2('0x8')](_0x37f2('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x37f2('0xa'),'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 8cb6f94..1d1f28b 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 _0x202d=['info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','raw','options','where','lodash','moment','bluebird','randomstring','../../config/logger','rpc','client','http'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x202d,0x130));var _0xd202=function(_0x4f7212,_0x443130){_0x4f7212=_0x4f7212-0x0;var _0x4eff91=_0x202d[_0x4f7212];return _0x4eff91;};'use strict';var _=require(_0xd202('0x0'));var util=require('util');var moment=require(_0xd202('0x1'));var BPromise=require(_0xd202('0x2'));var rs=require(_0xd202('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd202('0x4'))(_0xd202('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd202('0x6')][_0xd202('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37a6e5,_0x228d5b,_0x43589c){return new BPromise(function(_0x4ff6e0,_0x186d41){return client['request'](_0x37a6e5,_0x43589c)['then'](function(_0x5c64f0){logger[_0xd202('0x8')](_0xd202('0x9'),_0x228d5b,'request\x20sent');logger[_0xd202('0xa')](_0xd202('0xb'),_0x228d5b,'request\x20sent',JSON['stringify'](_0x5c64f0));if(_0x5c64f0[_0xd202('0xc')]){if(_0x5c64f0[_0xd202('0xc')][_0xd202('0xd')]===0x1f4){logger[_0xd202('0xc')](_0xd202('0x9'),_0x228d5b,_0x5c64f0[_0xd202('0xc')][_0xd202('0xe')]);return _0x186d41(_0x5c64f0['error'][_0xd202('0xe')]);}logger[_0xd202('0xc')](_0xd202('0x9'),_0x228d5b,_0x5c64f0[_0xd202('0xc')][_0xd202('0xe')]);return _0x4ff6e0(_0x5c64f0[_0xd202('0xc')][_0xd202('0xe')]);}else{logger[_0xd202('0x8')](_0xd202('0x9'),_0x228d5b,_0xd202('0xf'));_0x4ff6e0(_0x5c64f0[_0xd202('0x10')][_0xd202('0xe')]);}})[_0xd202('0x11')](function(_0x280693){logger['error'](_0xd202('0x9'),_0x228d5b,_0x280693);_0x186d41(_0x280693);});});}exports[_0xd202('0x12')]=function(_0x817902){var _0xaf903c=this;return new Promise(function(_0x528f92,_0x235f80){return db[_0xd202('0x13')]['update'](_0x817902[_0xd202('0x14')],{'raw':_0x817902['options']?_0x817902['options'][_0xd202('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x817902[_0xd202('0x16')]?_0x817902[_0xd202('0x16')][_0xd202('0x17')]||null:null,'attributes':_0x817902[_0xd202('0x16')]?_0x817902[_0xd202('0x16')]['attributes']||null:null,'limit':_0x817902[_0xd202('0x16')]?_0x817902[_0xd202('0x16')]['limit']||null:null})['then'](function(_0x1698b1){logger['info']('UpdateOpenchannelApplication',_0x817902);logger[_0xd202('0xa')](_0xd202('0x12'),_0x817902,JSON['stringify'](_0x1698b1));_0x528f92(_0x1698b1);})[_0xd202('0x11')](function(_0x2260fb){logger[_0xd202('0xc')]('UpdateOpenchannelApplication',_0x2260fb[_0xd202('0xe')],_0x817902);_0x235f80(_0xaf903c[_0xd202('0xc')](0x1f4,_0x2260fb[_0xd202('0xe')]));});});}; \ No newline at end of file +var _0x2e5c=['where','limit','UpdateOpenchannelApplication','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','OpenchannelApplication','update','body','options','raw'];(function(_0x3acd45,_0x45e5d0){var _0x219166=function(_0x35d0c8){while(--_0x35d0c8){_0x3acd45['push'](_0x3acd45['shift']());}};_0x219166(++_0x45e5d0);}(_0x2e5c,0x189));var _0xc2e5=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x2e5c[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0xc2e5('0x0'));var util=require(_0xc2e5('0x1'));var moment=require(_0xc2e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xc2e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2e5('0x4'))['db'];var utils=require(_0xc2e5('0x5'));var logger=require('../../config/logger')(_0xc2e5('0x6'));var config=require(_0xc2e5('0x7'));var jayson=require(_0xc2e5('0x8'));var client=jayson[_0xc2e5('0x9')][_0xc2e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a7548,_0x480e50,_0x32b60e){return new BPromise(function(_0x54945d,_0x2863dd){return client[_0xc2e5('0xb')](_0x5a7548,_0x32b60e)[_0xc2e5('0xc')](function(_0x231a4f){logger[_0xc2e5('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x480e50,'request\x20sent');logger[_0xc2e5('0xe')](_0xc2e5('0xf'),_0x480e50,_0xc2e5('0x10'),JSON[_0xc2e5('0x11')](_0x231a4f));if(_0x231a4f[_0xc2e5('0x12')]){if(_0x231a4f[_0xc2e5('0x12')]['code']===0x1f4){logger[_0xc2e5('0x12')](_0xc2e5('0x13'),_0x480e50,_0x231a4f[_0xc2e5('0x12')]['message']);return _0x2863dd(_0x231a4f[_0xc2e5('0x12')][_0xc2e5('0x14')]);}logger['error'](_0xc2e5('0x13'),_0x480e50,_0x231a4f[_0xc2e5('0x12')][_0xc2e5('0x14')]);return _0x54945d(_0x231a4f['error']['message']);}else{logger[_0xc2e5('0xd')](_0xc2e5('0x13'),_0x480e50,_0xc2e5('0x10'));_0x54945d(_0x231a4f['result'][_0xc2e5('0x14')]);}})[_0xc2e5('0x15')](function(_0x486cff){logger[_0xc2e5('0x12')](_0xc2e5('0x13'),_0x480e50,_0x486cff);_0x2863dd(_0x486cff);});});}exports['UpdateOpenchannelApplication']=function(_0x2b1d2d){var _0x1b4919=this;return new Promise(function(_0x128be5,_0x5c67a2){return db[_0xc2e5('0x16')][_0xc2e5('0x17')](_0x2b1d2d[_0xc2e5('0x18')],{'raw':_0x2b1d2d[_0xc2e5('0x19')]?_0x2b1d2d[_0xc2e5('0x19')][_0xc2e5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b1d2d[_0xc2e5('0x19')]?_0x2b1d2d[_0xc2e5('0x19')][_0xc2e5('0x1b')]||null:null,'attributes':_0x2b1d2d[_0xc2e5('0x19')]?_0x2b1d2d['options']['attributes']||null:null,'limit':_0x2b1d2d[_0xc2e5('0x19')]?_0x2b1d2d[_0xc2e5('0x19')][_0xc2e5('0x1c')]||null:null})[_0xc2e5('0xc')](function(_0x51449b){logger['info'](_0xc2e5('0x1d'),_0x2b1d2d);logger[_0xc2e5('0xe')](_0xc2e5('0x1d'),_0x2b1d2d,JSON[_0xc2e5('0x11')](_0x51449b));_0x128be5(_0x51449b);})[_0xc2e5('0x15')](function(_0x458ee3){logger[_0xc2e5('0x12')](_0xc2e5('0x1d'),_0x458ee3[_0xc2e5('0x14')],_0x2b1d2d);_0x5c67a2(_0x1b4919[_0xc2e5('0x12')](0x1f4,_0x458ee3[_0xc2e5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c9ef732..3ae430e 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 _0x5f03=['openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','tracked','openchannelinteraction:addtags','addTags','openchannel'];(function(_0x453327,_0x3ebe4a){var _0x1d5a70=function(_0x1ff3d3){while(--_0x1ff3d3){_0x453327['push'](_0x453327['shift']());}};_0x1d5a70(++_0x3ebe4a);}(_0x5f03,0x101));var _0x35f0=function(_0x4c5ef9,_0x54017a){_0x4c5ef9=_0x4c5ef9-0x0;var _0x3c9d6c=_0x5f03[_0x4c5ef9];return _0x3c9d6c;};'use strict';var multer=require('multer');var util=require(_0x35f0('0x0'));var path=require('path');var timeout=require(_0x35f0('0x1'));var express=require(_0x35f0('0x2'));var router=express[_0x35f0('0x3')]();var fs_extra=require(_0x35f0('0x4'));var auth=require(_0x35f0('0x5'));var interaction=require(_0x35f0('0x6'));var config=require('../../config/environment');var controller=require(_0x35f0('0x7'));router[_0x35f0('0x8')]('/',auth[_0x35f0('0x9')](),controller[_0x35f0('0xa')]);router['get']('/describe',auth[_0x35f0('0x9')](),controller['describe']);router[_0x35f0('0x8')](_0x35f0('0xb'),auth[_0x35f0('0x9')](),controller[_0x35f0('0xc')]);router['get']('/:id/messages',auth[_0x35f0('0x9')](),controller[_0x35f0('0xd')]);router[_0x35f0('0x8')](_0x35f0('0xe'),auth[_0x35f0('0x9')](),controller['download']);router[_0x35f0('0xf')]('/',auth[_0x35f0('0x9')](),controller[_0x35f0('0x10')]);router[_0x35f0('0xf')](_0x35f0('0x11'),auth[_0x35f0('0x9')](),controller['addMessage']);router[_0x35f0('0xf')](_0x35f0('0x12'),auth[_0x35f0('0x9')](),interaction[_0x35f0('0x13')]('openchannel',_0x35f0('0x14')),controller[_0x35f0('0x15')]);router['put']('/:id',auth[_0x35f0('0x9')](),interaction['tracked'](_0x35f0('0x16'),_0x35f0('0x17')),controller['update']);router['delete'](_0x35f0('0xb'),auth[_0x35f0('0x9')](),interaction[_0x35f0('0x13')](_0x35f0('0x16'),_0x35f0('0x18')),controller[_0x35f0('0x19')]);router[_0x35f0('0x1a')]('/:id/tags',auth[_0x35f0('0x9')](),controller['removeTags']);module[_0x35f0('0x1b')]=router; \ No newline at end of file +var _0xca5d=['tracked','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xca5d,0x88));var _0xdca5=function(_0x29965b,_0x4bebd3){_0x29965b=_0x29965b-0x0;var _0x189bdc=_0xca5d[_0x29965b];return _0x189bdc;};'use strict';var multer=require(_0xdca5('0x0'));var util=require('util');var path=require(_0xdca5('0x1'));var timeout=require(_0xdca5('0x2'));var express=require('express');var router=express[_0xdca5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdca5('0x4'));var config=require('../../config/environment');var controller=require(_0xdca5('0x5'));router[_0xdca5('0x6')]('/',auth[_0xdca5('0x7')](),controller[_0xdca5('0x8')]);router[_0xdca5('0x6')](_0xdca5('0x9'),auth[_0xdca5('0x7')](),controller[_0xdca5('0xa')]);router[_0xdca5('0x6')](_0xdca5('0xb'),auth['isAuthenticated'](),controller[_0xdca5('0xc')]);router['get'](_0xdca5('0xd'),auth[_0xdca5('0x7')](),controller[_0xdca5('0xe')]);router[_0xdca5('0x6')](_0xdca5('0xf'),auth[_0xdca5('0x7')](),controller[_0xdca5('0x10')]);router[_0xdca5('0x11')]('/',auth['isAuthenticated'](),controller[_0xdca5('0x12')]);router[_0xdca5('0x11')](_0xdca5('0xd'),auth[_0xdca5('0x7')](),controller[_0xdca5('0x13')]);router[_0xdca5('0x11')]('/:id/tags',auth[_0xdca5('0x7')](),interaction['tracked'](_0xdca5('0x14'),_0xdca5('0x15')),controller[_0xdca5('0x16')]);router[_0xdca5('0x17')](_0xdca5('0xb'),auth[_0xdca5('0x7')](),interaction[_0xdca5('0x18')]('openchannel',_0xdca5('0x19')),controller['update']);router[_0xdca5('0x1a')](_0xdca5('0xb'),auth['isAuthenticated'](),interaction[_0xdca5('0x18')](_0xdca5('0x14'),_0xdca5('0x1b')),controller[_0xdca5('0x1c')]);router[_0xdca5('0x1a')](_0xdca5('0x1d'),auth[_0xdca5('0x7')](),controller[_0xdca5('0x1e')]);module[_0xdca5('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 62bcb26..507c982 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 _0x4bd1=['exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x5d2a7d,_0x1ca06c){var _0x14e58b=function(_0x23be04){while(--_0x23be04){_0x5d2a7d['push'](_0x5d2a7d['shift']());}};_0x14e58b(++_0x1ca06c);}(_0x4bd1,0x90));var _0x14bd=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x4bd1[_0x7b484];return _0x2ae1cf;};'use strict';var Sequelize=require('sequelize');module[_0x14bd('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x14bd('0x1')]},'disposition':{'type':Sequelize[_0x14bd('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x14bd('0x2')]},'note':{'type':Sequelize[_0x14bd('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x14bd('0x2')]},'externalUrl':{'type':Sequelize[_0x14bd('0x2')]},'lastMsgAt':{'type':Sequelize[_0x14bd('0x1')]},'firstMsgDirection':{'type':Sequelize[_0x14bd('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x14bd('0x3')]('in',_0x14bd('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x14bd('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x14bd('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xb205=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x19718d,_0x37281c){var _0x126b33=function(_0x4eafab){while(--_0x4eafab){_0x19718d['push'](_0x19718d['shift']());}};_0x126b33(++_0x37281c);}(_0xb205,0xf0));var _0x5b20=function(_0x1fd6b0,_0x43c536){_0x1fd6b0=_0x1fd6b0-0x0;var _0x3a2ee8=_0xb205[_0x1fd6b0];return _0x3a2ee8;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'closed':{'type':Sequelize[_0x5b20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b20('0x3')]},'disposition':{'type':Sequelize[_0x5b20('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b20('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x5b20('0x4')]},'externalUrl':{'type':Sequelize[_0x5b20('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x5b20('0x5')]('in',_0x5b20('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x5b20('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5b20('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x5b20('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 8643326..66d0715 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 _0x61e0=['map','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','length','includeAll','options','create','body','find','catch','describe','addMessage','ids','findOne','OpenchannelMessage','hasOwnProperty','nolimit','offset','order','sort','where','pick','OpenchannelInteractionId','filter','merge','include','rows','addTags','omit','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','threadId','Public','Private','Messages','basename','createReadStream','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','update','then','destroy','error','stack','name','send','index'];(function(_0x5b6cf9,_0x41a440){var _0x376e84=function(_0x4f0ca1){while(--_0x4f0ca1){_0x5b6cf9['push'](_0x5b6cf9['shift']());}};_0x376e84(++_0x41a440);}(_0x61e0,0x167));var _0x061e=function(_0x2626bb,_0x4f1e67){_0x2626bb=_0x2626bb-0x0;var _0x1f1bfc=_0x61e0[_0x2626bb];return _0x1f1bfc;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x061e('0x0'));var moment=require(_0x061e('0x1'));var util=require(_0x061e('0x2'));var path=require(_0x061e('0x3'));var ejs=require(_0x061e('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x061e('0x5'));var interaction=require(_0x061e('0x6'));var qs=require(_0x061e('0x7'));var pdf=require(_0x061e('0x8'));var logger=require(_0x061e('0x9'))('api');var config=require('../../config/environment');var db=require(_0x061e('0xa'))['db'];config[_0x061e('0xb')]=_[_0x061e('0xc')](config[_0x061e('0xb')],{'host':_0x061e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x061e('0xe'))[_0x061e('0xf')](socket);function respondWithStatusCode(_0x59b2d0,_0x5da993){_0x5da993=_0x5da993||0xcc;return function(_0x2fd531){if(_0x2fd531){return _0x59b2d0[_0x061e('0x10')](_0x5da993);}return _0x59b2d0[_0x061e('0x11')](_0x5da993)[_0x061e('0x12')]();};}function respondWithResult(_0x41c785,_0x1a70bf){_0x1a70bf=_0x1a70bf||0xc8;return function(_0x126994){if(_0x126994){return _0x41c785[_0x061e('0x11')](_0x1a70bf)[_0x061e('0x13')](_0x126994);}};}function respondWithFilteredResult(_0x311374,_0x2c217f){return function(_0x44efdc){if(_0x44efdc){var _0x3841f3=typeof _0x2c217f['offset']===_0x061e('0x14')&&typeof _0x2c217f[_0x061e('0x15')]===_0x061e('0x14');var _0x1ac870=_0x44efdc[_0x061e('0x16')];var _0x1969fc=_0x3841f3?0x0:_0x2c217f['offset'];var _0x4b7cb3=_0x3841f3?_0x44efdc[_0x061e('0x16')]:_0x2c217f['offset']+_0x2c217f['limit'];var _0x2755ef;if(_0x4b7cb3>=_0x1ac870){_0x4b7cb3=_0x1ac870;_0x2755ef=0xc8;}else{_0x2755ef=0xce;}_0x311374['status'](_0x2755ef);return _0x311374['set']('Content-Range',_0x1969fc+'-'+_0x4b7cb3+'/'+_0x1ac870)['json'](_0x44efdc);}return null;};}function saveUpdates(_0x52eb6b){return function(_0x3464e9){if(_0x3464e9){return _0x3464e9[_0x061e('0x17')](_0x52eb6b)[_0x061e('0x18')](function(_0xe440d8){return _0xe440d8;});}return null;};}function removeEntity(_0xffecb){return function(_0xa1ab55){if(_0xa1ab55){return _0xa1ab55[_0x061e('0x19')]()[_0x061e('0x18')](function(){_0xffecb[_0x061e('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bec05){return function(_0x4d9410){if(!_0x4d9410){_0x2bec05[_0x061e('0x10')](0x194);}return _0x4d9410;};}function handleError(_0x1b67ee,_0x324fdd){_0x324fdd=_0x324fdd||0x1f4;return function(_0x235623){logger[_0x061e('0x1a')](_0x235623[_0x061e('0x1b')]);if(_0x235623[_0x061e('0x1c')]){delete _0x235623[_0x061e('0x1c')];}_0x1b67ee[_0x061e('0x11')](_0x324fdd)[_0x061e('0x1d')](_0x235623);};}exports[_0x061e('0x1e')]=function(_0x567615,_0x51928d){var _0x1b20a8={};var _0x4cb2cf=_[_0x061e('0x1f')](db['OpenchannelInteraction'][_0x061e('0x20')],function(_0x352db1){return{'name':_0x352db1[_0x061e('0x21')],'type':_0x352db1[_0x061e('0x22')][_0x061e('0x23')]};});_0x1b20a8=qs[_0x061e('0x24')](_0x4cb2cf,_0x567615);return interaction[_0x061e('0x25')](_0x061e('0x26'),_0x567615[_0x061e('0x27')],_0x567615[_0x061e('0x28')],_0x1b20a8,_0x4cb2cf)[_0x061e('0x18')](respondWithFilteredResult(_0x51928d,_0x1b20a8))['catch'](handleError(_0x51928d,null));};exports[_0x061e('0x29')]=function(_0x536760,_0xf85e5c){var _0x537d2c={};if(_0x536760[_0x061e('0x27')][_0x061e('0x22')]&&_0x536760[_0x061e('0x27')][_0x061e('0x22')]==='from'){_0x537d2c[_0x061e('0x2a')]=_0x536760['params']['id'];}else{_0x537d2c['id']=_0x536760[_0x061e('0x2b')]['id'];}var _0x52b0fd={'raw':![],'where':_0x537d2c},_0x2e5593={};_0x2e5593[_0x061e('0x2c')]=_[_0x061e('0x2d')](db[_0x061e('0x2e')][_0x061e('0x20')]);_0x2e5593[_0x061e('0x27')]=_[_0x061e('0x2d')](_0x536760[_0x061e('0x27')]);_0x2e5593[_0x061e('0x2f')]=_[_0x061e('0x30')](_0x2e5593[_0x061e('0x2c')],_0x2e5593['query']);_0x52b0fd[_0x061e('0x31')]=_[_0x061e('0x30')](_0x2e5593[_0x061e('0x2c')],qs[_0x061e('0x32')](_0x536760[_0x061e('0x27')][_0x061e('0x32')]));_0x52b0fd[_0x061e('0x31')]=_0x52b0fd[_0x061e('0x31')][_0x061e('0x33')]?_0x52b0fd[_0x061e('0x31')]:_0x2e5593[_0x061e('0x2c')];if(_0x536760[_0x061e('0x27')][_0x061e('0x34')]){_0x52b0fd['include']=[{'all':!![]}];}_0x52b0fd=_['merge']({},_0x52b0fd,_0x536760[_0x061e('0x35')]);return db['OpenchannelInteraction']['find'](_0x52b0fd)[_0x061e('0x18')](handleEntityNotFound(_0xf85e5c,null))[_0x061e('0x18')](respondWithResult(_0xf85e5c,null))['catch'](handleError(_0xf85e5c,null));};exports[_0x061e('0x36')]=function(_0x15885f,_0x3f0c08){return db[_0x061e('0x2e')][_0x061e('0x36')](_0x15885f[_0x061e('0x37')],{})[_0x061e('0x18')](respondWithResult(_0x3f0c08,0xc9))['catch'](handleError(_0x3f0c08,null));};exports[_0x061e('0x17')]=function(_0x29b019,_0x269cf8){if(_0x29b019[_0x061e('0x37')]['id']){delete _0x29b019['body']['id'];}return db['OpenchannelInteraction'][_0x061e('0x38')]({'where':{'id':_0x29b019[_0x061e('0x2b')]['id']}})[_0x061e('0x18')](handleEntityNotFound(_0x269cf8,null))[_0x061e('0x18')](saveUpdates(_0x29b019[_0x061e('0x37')],null))[_0x061e('0x18')](respondWithResult(_0x269cf8,null))[_0x061e('0x39')](handleError(_0x269cf8,null));};exports['destroy']=function(_0x489256,_0x42dadd){return db[_0x061e('0x2e')]['find']({'where':{'id':_0x489256[_0x061e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x42dadd,null))[_0x061e('0x18')](removeEntity(_0x42dadd,null))[_0x061e('0x39')](handleError(_0x42dadd,null));};exports[_0x061e('0x3a')]=function(_0x35d0c3,_0x4c6e9a){return db[_0x061e('0x2e')][_0x061e('0x3a')]()[_0x061e('0x18')](respondWithResult(_0x4c6e9a,null))[_0x061e('0x39')](handleError(_0x4c6e9a,null));};exports[_0x061e('0x3b')]=function(_0x5d5746,_0x478ac9){return db['OpenchannelMessage'][_0x061e('0x38')]({'where':{'id':_0x5d5746['params']['id']}})[_0x061e('0x18')](handleEntityNotFound(_0x478ac9,null))[_0x061e('0x18')](function(_0x21718b){if(_0x21718b){return _0x21718b[_0x061e('0x3b')](_0x5d5746['body']['ids'],_['omit'](_0x5d5746[_0x061e('0x37')],[_0x061e('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x478ac9,null))[_0x061e('0x39')](handleError(_0x478ac9,null));};exports['getMessages']=function(_0x3a51a6,_0x5ecb06){var _0x4a6664={'raw':![],'where':{}};var _0x5dc3eb={};var _0x5c54fe={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x061e('0x3d')]({'where':{'id':_0x3a51a6['params']['id']}})[_0x061e('0x18')](handleEntityNotFound(_0x5ecb06,null))[_0x061e('0x18')](function(_0x471d31){if(_0x471d31){_0x5dc3eb[_0x061e('0x2c')]=_[_0x061e('0x2d')](db[_0x061e('0x3e')][_0x061e('0x20')]);_0x5dc3eb[_0x061e('0x27')]=_['keys'](_0x3a51a6[_0x061e('0x27')]);_0x5dc3eb[_0x061e('0x2f')]=_[_0x061e('0x30')](_0x5dc3eb['model'],_0x5dc3eb[_0x061e('0x27')]);_0x4a6664[_0x061e('0x31')]=_[_0x061e('0x30')](_0x5dc3eb[_0x061e('0x2c')],qs['fields'](_0x3a51a6['query'][_0x061e('0x32')]));_0x4a6664[_0x061e('0x31')]=_0x4a6664[_0x061e('0x31')][_0x061e('0x33')]?_0x4a6664[_0x061e('0x31')]:_0x5dc3eb[_0x061e('0x2c')];if(!_0x3a51a6[_0x061e('0x27')][_0x061e('0x3f')](_0x061e('0x40'))){_0x4a6664[_0x061e('0x15')]=qs['limit'](_0x3a51a6['query'][_0x061e('0x15')]);_0x4a6664[_0x061e('0x41')]=qs[_0x061e('0x41')](_0x3a51a6[_0x061e('0x27')][_0x061e('0x41')]);}_0x4a6664[_0x061e('0x42')]=qs[_0x061e('0x43')](_0x3a51a6[_0x061e('0x27')][_0x061e('0x43')]);_0x4a6664[_0x061e('0x44')]=qs[_0x061e('0x2f')](_[_0x061e('0x45')](_0x3a51a6['query'],_0x5dc3eb[_0x061e('0x2f')]));_0x4a6664['where'][_0x061e('0x46')]=_0x471d31['id'];if(_0x3a51a6[_0x061e('0x27')][_0x061e('0x47')]){_0x4a6664[_0x061e('0x44')]=_[_0x061e('0x48')](_0x4a6664[_0x061e('0x44')],{'$or':_[_0x061e('0x1f')](_0x4a6664[_0x061e('0x31')],function(_0xd266f0){var _0x4b0e8b={};_0x4b0e8b[_0xd266f0]={'$like':'%'+_0x3a51a6[_0x061e('0x27')][_0x061e('0x47')]+'%'};return _0x4b0e8b;})});}if(_0x3a51a6[_0x061e('0x27')]['$gte']){var _0x4d1d70=_0x3a51a6[_0x061e('0x27')]['$gte']['split'](',');var _0x268b5a={};_0x268b5a[_0x4d1d70[0x0]]={'$gte':moment(_0x4d1d70[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4a6664[_0x061e('0x44')]=_[_0x061e('0x48')](_0x4a6664[_0x061e('0x44')],_0x268b5a);}_0x4a6664=_[_0x061e('0x48')]({},_0x4a6664,_0x3a51a6[_0x061e('0x35')]);return db['OpenchannelMessage'][_0x061e('0x16')]({'where':_0x4a6664[_0x061e('0x44')]})[_0x061e('0x18')](function(_0x5a11b5){_0x5c54fe['count']=_0x5a11b5;if(_0x3a51a6[_0x061e('0x27')][_0x061e('0x34')]){_0x4a6664[_0x061e('0x49')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x061e('0x25')](_0x4a6664);})[_0x061e('0x18')](function(_0x58896d){_0x5c54fe[_0x061e('0x4a')]=_0x58896d;return _0x5c54fe;});}})['then'](respondWithFilteredResult(_0x5ecb06,_0x4a6664))[_0x061e('0x39')](handleError(_0x5ecb06,null));};exports[_0x061e('0x4b')]=function(_0x58a440,_0x2edf1c){return db[_0x061e('0x2e')][_0x061e('0x38')]({'where':{'id':_0x58a440[_0x061e('0x2b')]['id']}})[_0x061e('0x18')](handleEntityNotFound(_0x2edf1c,null))['then'](function(_0x2a9214){if(_0x2a9214){return _0x2a9214['setTags'](_0x58a440[_0x061e('0x37')][_0x061e('0x3c')],_[_0x061e('0x4c')](_0x58a440['body'],[_0x061e('0x3c'),'id'])||{})['spread'](function(){return db[_0x061e('0x4d')][_0x061e('0x25')]({'attributes':['id','name','color'],'where':{'id':_0x58a440['body'][_0x061e('0x3c')]}});})[_0x061e('0x18')](function(_0x31773d){socket[_0x061e('0x4e')](_0x061e('0x4f'),{'id':Number(_0x58a440['params']['id']),'tags':_0x31773d||[]});return{'id':Number(_0x58a440[_0x061e('0x2b')]['id']),'tags':_0x31773d||[]};});}})['then'](respondWithResult(_0x2edf1c,null))[_0x061e('0x39')](handleError(_0x2edf1c,null));};exports[_0x061e('0x50')]=function(_0xb2205b,_0x48cf72){return db[_0x061e('0x2e')][_0x061e('0x38')]({'where':{'id':_0xb2205b['params']['id']}})[_0x061e('0x18')](handleEntityNotFound(_0x48cf72,null))['then'](function(_0xbf2ed3){if(_0xbf2ed3){return _0xbf2ed3['removeTags'](_0xb2205b[_0x061e('0x27')]['ids']);}})[_0x061e('0x18')](respondWithStatusCode(_0x48cf72,null))[_0x061e('0x39')](handleError(_0x48cf72,null));};exports[_0x061e('0x51')]=function(_0x2d5dd4,_0x5c9d42){var _0x42c0e6=moment()['unix']()[_0x061e('0x52')]();var _0x46c195=path[_0x061e('0x53')](config[_0x061e('0x54')],_0x061e('0x55'),_0x061e('0x56'),_0x061e('0x57'));var _0x10546a=path[_0x061e('0x53')](config[_0x061e('0x54')],'server','files',_0x061e('0x58'));var _0x2dd078=path[_0x061e('0x53')](_0x46c195,_0x42c0e6);var _0x590f67=util[_0x061e('0x59')](_0x061e('0x5a'),_0x2d5dd4['params']['id'],_0x42c0e6);var _0xb57e8a=path[_0x061e('0x53')](_0x46c195,_0x590f67);var _0x1f0710=[];_0x1f0710[_0x061e('0x5b')]({'model':db[_0x061e('0x5c')],'as':'User','attributes':['id',_0x061e('0x5d')],'raw':!![]});_0x1f0710['push']({'model':db[_0x061e('0x5e')],'as':_0x061e('0x5f'),'attributes':['id',_0x061e('0x60'),_0x061e('0x61')],'raw':!![]});if(_0x2d5dd4['query']['attachments']){_0x1f0710['push']({'model':db['Attachment'],'as':_0x061e('0x62'),'raw':!![]});}var _0xeec332=[{'model':db[_0x061e('0x3e')],'as':'Messages','attributes':['id',_0x061e('0x37'),_0x061e('0x63'),_0x061e('0x64'),_0x061e('0x65'),_0x061e('0x66')],'include':_0x1f0710}];_0xeec332[_0x061e('0x5b')]({'model':db[_0x061e('0x67')],'as':_0x061e('0x68'),'attributes':['id',_0x061e('0x1c')]});_0xeec332[_0x061e('0x5b')]({'model':db[_0x061e('0x5c')],'as':_0x061e('0x69'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x061e('0x38')]({'where':{'id':_0x2d5dd4[_0x061e('0x2b')]['id']},'include':_0xeec332})[_0x061e('0x18')](handleEntityNotFound(_0x5c9d42,null))[_0x061e('0x18')](function(_0x5e5692){if(_0x5e5692){var _0x26201e=_0x5e5692[_0x061e('0x6a')]({'plain':!![]});fs[_0x061e('0x6b')](_0x2dd078);var _0x5d6e62={'channel':_0x061e('0x6c'),'account':_0x26201e['Account'][_0x061e('0x1c')],'agent':_0x26201e[_0x061e('0x69')]?_0x26201e[_0x061e('0x69')][_0x061e('0x5d')]:_0x061e('0x6d'),'createdAt':moment(_0x26201e[_0x061e('0x63')])[_0x061e('0x59')]('YYYY-MM-DD\x20HH:mm:ss')[_0x061e('0x52')](),'closedAt':_0x26201e[_0x061e('0x6e')]?moment(_0x26201e[_0x061e('0x6f')])[_0x061e('0x59')](_0x061e('0x70'))[_0x061e('0x52')]():'','disposition':_0x26201e['disposition'],'visibility':_0x26201e[_0x061e('0x71')]?_0x061e('0x72'):_0x061e('0x73'),'messages':_(_0x26201e[_0x061e('0x74')])[_0x061e('0x47')]({'secret':![]})['map'](function(_0x33b653){if(_0x33b653['Attachment']){var _0x14f89f=path['join'](_0x10546a,_0x33b653[_0x061e('0x62')][_0x061e('0x75')]);if(fs['existsSync'](_0x14f89f)){fs[_0x061e('0x76')](_0x14f89f)['pipe'](fs[_0x061e('0x77')](path['join'](_0x2dd078,_0x33b653['Attachment']['basename'])));}}return{'date':moment(_0x33b653['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x061e('0x52')](),'sender':_0x33b653['direction']===_0x061e('0x78')?_0x33b653['User']?_0x33b653[_0x061e('0x5c')]['fullname']:_0x061e('0x79'):_0x33b653['Contact'][_0x061e('0x60')]+(_0x33b653['Contact'][_0x061e('0x61')]?'\x20'+_0x33b653[_0x061e('0x5f')][_0x061e('0x61')]:''),'body':_0x33b653[_0x061e('0x62')]?_0x33b653['Attachment'][_0x061e('0x75')]:_0x33b653[_0x061e('0x37')],'direction':_0x33b653[_0x061e('0x64')]===_0x061e('0x78')?'A':'C','secret':_0x33b653[_0x061e('0x65')],'read':_0x33b653[_0x061e('0x66')],'attachment':_0x33b653['Attachment']};})[_0x061e('0x7a')]()};return ejs[_0x061e('0x7b')](path[_0x061e('0x53')](config[_0x061e('0x54')],_0x061e('0x55'),_0x061e('0x7c'),_0x061e('0x7d')),{'interaction':_0x5d6e62})[_0x061e('0x18')](function(_0x34f815){var _0x1a515f=path[_0x061e('0x53')](_0x2dd078,'transcript-'+_0x26201e['id']+'-'+_0x42c0e6+_0x061e('0x7e'));var _0x4252b7={'path':_0x1a515f,'channel':_0x061e('0x6c'),'interactionId':_0x26201e['id']};return pdf[_0x061e('0x7f')](_0x34f815,_0x4252b7);})['then'](function(){return new Promise(function(_0x396957,_0x34be43){zipdir(_0x2dd078,{'saveTo':_0xb57e8a},function(_0x3b4cef,_0x131ae5){if(_0x3b4cef)return _0x34be43(_0x3b4cef);return _0x396957(_0x131ae5);});})['then'](function(){return new Promise(function(_0x3b5caf,_0x21af01){rimraf(_0x2dd078,function(_0xf14c59){if(_0xf14c59)_0x21af01(_0xf14c59);return _0x3b5caf();});});})[_0x061e('0x18')](function(){return _0x5c9d42[_0x061e('0x51')](_0xb57e8a,_0x590f67,function(_0x4fe2bc){if(_0x4fe2bc){logger[_0x061e('0x1a')](_0x061e('0x80'),_0x4fe2bc);}else{fs[_0x061e('0x81')](_0xb57e8a);}});});});}else{return _0x5c9d42[_0x061e('0x10')](0xc8);}})['catch'](handleError(_0x5c9d42,null));}; \ No newline at end of file +var _0x6e31=['query','user','catch','show','from','params','model','keys','OpenchannelInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','hasOwnProperty','nolimit','limit','order','where','pick','OpenchannelInteractionId','map','$gte','format','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','files','root','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Attachment','Messages','createdAt','secret','OpenchannelAccount','Owner','get','mkdirSync','Openchannel','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Public','Private','filter','existsSync','createReadStream','pipe','createWriteStream','basename','out','firstName','direction','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','offset','undefined','count','set','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel'];(function(_0x4d0e8b,_0x25837e){var _0x1163d3=function(_0x417a53){while(--_0x417a53){_0x4d0e8b['push'](_0x4d0e8b['shift']());}};_0x1163d3(++_0x25837e);}(_0x6e31,0xe8));var _0x16e3=function(_0x6bdb38,_0x19ea23){_0x6bdb38=_0x6bdb38-0x0;var _0xa38184=_0x6e31[_0x6bdb38];return _0xa38184;};'use strict';var rimraf=require(_0x16e3('0x0'));var zipdir=require(_0x16e3('0x1'));var moment=require(_0x16e3('0x2'));var util=require(_0x16e3('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x16e3('0x4'));var Redis=require(_0x16e3('0x5'));var interaction=require(_0x16e3('0x6'));var qs=require(_0x16e3('0x7'));var pdf=require(_0x16e3('0x8'));var logger=require(_0x16e3('0x9'))(_0x16e3('0xa'));var config=require(_0x16e3('0xb'));var db=require(_0x16e3('0xc'))['db'];config[_0x16e3('0xd')]=_[_0x16e3('0xe')](config[_0x16e3('0xd')],{'host':_0x16e3('0xf'),'port':0x18eb});var socket=require(_0x16e3('0x10'))(new Redis(config['redis']));require(_0x16e3('0x11'))['register'](socket);function respondWithStatusCode(_0x1cb31f,_0x3af48a){_0x3af48a=_0x3af48a||0xcc;return function(_0x3bb95a){if(_0x3bb95a){return _0x1cb31f[_0x16e3('0x12')](_0x3af48a);}return _0x1cb31f[_0x16e3('0x13')](_0x3af48a)['end']();};}function respondWithResult(_0x5c9d6b,_0x4f7c68){_0x4f7c68=_0x4f7c68||0xc8;return function(_0x53c364){if(_0x53c364){return _0x5c9d6b['status'](_0x4f7c68)[_0x16e3('0x14')](_0x53c364);}};}function respondWithFilteredResult(_0x547598,_0x230888){return function(_0x5eb614){if(_0x5eb614){var _0x387ca1=typeof _0x230888[_0x16e3('0x15')]===_0x16e3('0x16')&&typeof _0x230888['limit']===_0x16e3('0x16');var _0x422601=_0x5eb614[_0x16e3('0x17')];var _0x5edd9e=_0x387ca1?0x0:_0x230888[_0x16e3('0x15')];var _0x51020a=_0x387ca1?_0x5eb614['count']:_0x230888[_0x16e3('0x15')]+_0x230888['limit'];var _0x455b6a;if(_0x51020a>=_0x422601){_0x51020a=_0x422601;_0x455b6a=0xc8;}else{_0x455b6a=0xce;}_0x547598[_0x16e3('0x13')](_0x455b6a);return _0x547598[_0x16e3('0x18')]('Content-Range',_0x5edd9e+'-'+_0x51020a+'/'+_0x422601)[_0x16e3('0x14')](_0x5eb614);}return null;};}function saveUpdates(_0x1e1825){return function(_0x231502){if(_0x231502){return _0x231502[_0x16e3('0x19')](_0x1e1825)[_0x16e3('0x1a')](function(_0x3ba9f4){return _0x3ba9f4;});}return null;};}function removeEntity(_0x5edbdc){return function(_0x24936f){if(_0x24936f){return _0x24936f['destroy']()[_0x16e3('0x1a')](function(){_0x5edbdc[_0x16e3('0x13')](0xcc)[_0x16e3('0x1b')]();});}};}function handleEntityNotFound(_0x5db1b1){return function(_0x3fd86f){if(!_0x3fd86f){_0x5db1b1['sendStatus'](0x194);}return _0x3fd86f;};}function handleError(_0x175db9,_0x5da767){_0x5da767=_0x5da767||0x1f4;return function(_0x5e8016){logger[_0x16e3('0x1c')](_0x5e8016[_0x16e3('0x1d')]);if(_0x5e8016[_0x16e3('0x1e')]){delete _0x5e8016['name'];}_0x175db9[_0x16e3('0x13')](_0x5da767)[_0x16e3('0x1f')](_0x5e8016);};}exports[_0x16e3('0x20')]=function(_0x1f33f9,_0x251a2f){var _0x1b6ecf={};var _0x358e7b=_['map'](db['OpenchannelInteraction'][_0x16e3('0x21')],function(_0x4b174d){return{'name':_0x4b174d[_0x16e3('0x22')],'type':_0x4b174d[_0x16e3('0x23')][_0x16e3('0x24')]};});_0x1b6ecf=qs[_0x16e3('0x25')](_0x358e7b,_0x1f33f9);return interaction[_0x16e3('0x26')](_0x16e3('0x27'),_0x1f33f9[_0x16e3('0x28')],_0x1f33f9[_0x16e3('0x29')],_0x1b6ecf,_0x358e7b)[_0x16e3('0x1a')](respondWithFilteredResult(_0x251a2f,_0x1b6ecf))[_0x16e3('0x2a')](handleError(_0x251a2f,null));};exports[_0x16e3('0x2b')]=function(_0x59a8e7,_0x570c44){var _0x9483e={};if(_0x59a8e7['query']['type']&&_0x59a8e7[_0x16e3('0x28')][_0x16e3('0x23')]===_0x16e3('0x2c')){_0x9483e[_0x16e3('0x2c')]=_0x59a8e7[_0x16e3('0x2d')]['id'];}else{_0x9483e['id']=_0x59a8e7[_0x16e3('0x2d')]['id'];}var _0x3374f2={'raw':![],'where':_0x9483e},_0x5b4085={};_0x5b4085[_0x16e3('0x2e')]=_[_0x16e3('0x2f')](db[_0x16e3('0x30')]['rawAttributes']);_0x5b4085[_0x16e3('0x28')]=_[_0x16e3('0x2f')](_0x59a8e7[_0x16e3('0x28')]);_0x5b4085[_0x16e3('0x31')]=_[_0x16e3('0x32')](_0x5b4085[_0x16e3('0x2e')],_0x5b4085[_0x16e3('0x28')]);_0x3374f2[_0x16e3('0x33')]=_['intersection'](_0x5b4085['model'],qs[_0x16e3('0x34')](_0x59a8e7[_0x16e3('0x28')][_0x16e3('0x34')]));_0x3374f2[_0x16e3('0x33')]=_0x3374f2['attributes'][_0x16e3('0x35')]?_0x3374f2[_0x16e3('0x33')]:_0x5b4085[_0x16e3('0x2e')];if(_0x59a8e7['query'][_0x16e3('0x36')]){_0x3374f2[_0x16e3('0x37')]=[{'all':!![]}];}_0x3374f2=_[_0x16e3('0x38')]({},_0x3374f2,_0x59a8e7[_0x16e3('0x39')]);return db[_0x16e3('0x30')][_0x16e3('0x3a')](_0x3374f2)[_0x16e3('0x1a')](handleEntityNotFound(_0x570c44,null))[_0x16e3('0x1a')](respondWithResult(_0x570c44,null))[_0x16e3('0x2a')](handleError(_0x570c44,null));};exports['create']=function(_0x389d55,_0x4678b5){return db[_0x16e3('0x30')][_0x16e3('0x3b')](_0x389d55['body'],{})[_0x16e3('0x1a')](respondWithResult(_0x4678b5,0xc9))[_0x16e3('0x2a')](handleError(_0x4678b5,null));};exports[_0x16e3('0x19')]=function(_0x4acd05,_0x425cce){if(_0x4acd05[_0x16e3('0x3c')]['id']){delete _0x4acd05['body']['id'];}return db[_0x16e3('0x30')][_0x16e3('0x3a')]({'where':{'id':_0x4acd05['params']['id']}})[_0x16e3('0x1a')](handleEntityNotFound(_0x425cce,null))['then'](saveUpdates(_0x4acd05[_0x16e3('0x3c')],null))[_0x16e3('0x1a')](respondWithResult(_0x425cce,null))[_0x16e3('0x2a')](handleError(_0x425cce,null));};exports[_0x16e3('0x3d')]=function(_0x441b7a,_0x4c0634){return db[_0x16e3('0x30')][_0x16e3('0x3a')]({'where':{'id':_0x441b7a['params']['id']}})[_0x16e3('0x1a')](handleEntityNotFound(_0x4c0634,null))[_0x16e3('0x1a')](removeEntity(_0x4c0634,null))[_0x16e3('0x2a')](handleError(_0x4c0634,null));};exports[_0x16e3('0x3e')]=function(_0x9d8539,_0x418761){return db[_0x16e3('0x30')][_0x16e3('0x3e')]()[_0x16e3('0x1a')](respondWithResult(_0x418761,null))[_0x16e3('0x2a')](handleError(_0x418761,null));};exports['addMessage']=function(_0x54d349,_0x26d644){return db['OpenchannelMessage'][_0x16e3('0x3a')]({'where':{'id':_0x54d349[_0x16e3('0x2d')]['id']}})[_0x16e3('0x1a')](handleEntityNotFound(_0x26d644,null))[_0x16e3('0x1a')](function(_0x4a2b5a){if(_0x4a2b5a){return _0x4a2b5a[_0x16e3('0x3f')](_0x54d349[_0x16e3('0x3c')][_0x16e3('0x40')],_[_0x16e3('0x41')](_0x54d349[_0x16e3('0x3c')],[_0x16e3('0x40'),'id'])||{});}})[_0x16e3('0x1a')](respondWithResult(_0x26d644,null))[_0x16e3('0x2a')](handleError(_0x26d644,null));};exports[_0x16e3('0x42')]=function(_0x15b1ed,_0x59aab6){var _0x49fa75={'raw':![],'where':{}};var _0x128bae={};var _0x230744={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x16e3('0x43')]({'where':{'id':_0x15b1ed['params']['id']}})[_0x16e3('0x1a')](handleEntityNotFound(_0x59aab6,null))[_0x16e3('0x1a')](function(_0x8b16ba){if(_0x8b16ba){_0x128bae[_0x16e3('0x2e')]=_[_0x16e3('0x2f')](db[_0x16e3('0x44')]['rawAttributes']);_0x128bae[_0x16e3('0x28')]=_[_0x16e3('0x2f')](_0x15b1ed[_0x16e3('0x28')]);_0x128bae[_0x16e3('0x31')]=_[_0x16e3('0x32')](_0x128bae[_0x16e3('0x2e')],_0x128bae[_0x16e3('0x28')]);_0x49fa75[_0x16e3('0x33')]=_['intersection'](_0x128bae['model'],qs['fields'](_0x15b1ed[_0x16e3('0x28')][_0x16e3('0x34')]));_0x49fa75[_0x16e3('0x33')]=_0x49fa75['attributes'][_0x16e3('0x35')]?_0x49fa75[_0x16e3('0x33')]:_0x128bae[_0x16e3('0x2e')];if(!_0x15b1ed['query'][_0x16e3('0x45')](_0x16e3('0x46'))){_0x49fa75['limit']=qs[_0x16e3('0x47')](_0x15b1ed['query']['limit']);_0x49fa75[_0x16e3('0x15')]=qs['offset'](_0x15b1ed[_0x16e3('0x28')][_0x16e3('0x15')]);}_0x49fa75[_0x16e3('0x48')]=qs['sort'](_0x15b1ed[_0x16e3('0x28')]['sort']);_0x49fa75[_0x16e3('0x49')]=qs[_0x16e3('0x31')](_[_0x16e3('0x4a')](_0x15b1ed[_0x16e3('0x28')],_0x128bae['filters']));_0x49fa75[_0x16e3('0x49')][_0x16e3('0x4b')]=_0x8b16ba['id'];if(_0x15b1ed[_0x16e3('0x28')]['filter']){_0x49fa75[_0x16e3('0x49')]=_[_0x16e3('0x38')](_0x49fa75['where'],{'$or':_[_0x16e3('0x4c')](_0x49fa75[_0x16e3('0x33')],function(_0x380fd6){var _0x67c832={};_0x67c832[_0x380fd6]={'$like':'%'+_0x15b1ed['query']['filter']+'%'};return _0x67c832;})});}if(_0x15b1ed[_0x16e3('0x28')]['$gte']){var _0x40461b=_0x15b1ed['query'][_0x16e3('0x4d')]['split'](',');var _0x2723ea={};_0x2723ea[_0x40461b[0x0]]={'$gte':moment(_0x40461b[0x1])[_0x16e3('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x49fa75[_0x16e3('0x49')]=_[_0x16e3('0x38')](_0x49fa75[_0x16e3('0x49')],_0x2723ea);}_0x49fa75=_[_0x16e3('0x38')]({},_0x49fa75,_0x15b1ed[_0x16e3('0x39')]);return db[_0x16e3('0x44')][_0x16e3('0x17')]({'where':_0x49fa75[_0x16e3('0x49')]})['then'](function(_0x34801b){_0x230744['count']=_0x34801b;if(_0x15b1ed['query']['includeAll']){_0x49fa75['include']=[{'all':!![]}];}return db[_0x16e3('0x44')][_0x16e3('0x26')](_0x49fa75);})[_0x16e3('0x1a')](function(_0x2db577){_0x230744[_0x16e3('0x4f')]=_0x2db577;return _0x230744;});}})[_0x16e3('0x1a')](respondWithFilteredResult(_0x59aab6,_0x49fa75))[_0x16e3('0x2a')](handleError(_0x59aab6,null));};exports[_0x16e3('0x50')]=function(_0x40676e,_0x495cb3){return db['OpenchannelInteraction'][_0x16e3('0x3a')]({'where':{'id':_0x40676e[_0x16e3('0x2d')]['id']}})[_0x16e3('0x1a')](handleEntityNotFound(_0x495cb3,null))[_0x16e3('0x1a')](function(_0x51fb9d){if(_0x51fb9d){return _0x51fb9d[_0x16e3('0x51')](_0x40676e['body'][_0x16e3('0x40')],_[_0x16e3('0x41')](_0x40676e[_0x16e3('0x3c')],['ids','id'])||{})[_0x16e3('0x52')](function(){return db['Tag'][_0x16e3('0x26')]({'attributes':['id',_0x16e3('0x1e'),_0x16e3('0x53')],'where':{'id':_0x40676e[_0x16e3('0x3c')]['ids']}});})['then'](function(_0x159e31){socket[_0x16e3('0x54')](_0x16e3('0x55'),{'id':Number(_0x40676e['params']['id']),'tags':_0x159e31||[]});return{'id':Number(_0x40676e['params']['id']),'tags':_0x159e31||[]};});}})[_0x16e3('0x1a')](respondWithResult(_0x495cb3,null))[_0x16e3('0x2a')](handleError(_0x495cb3,null));};exports[_0x16e3('0x56')]=function(_0x49cf4c,_0x113914){return db['OpenchannelInteraction'][_0x16e3('0x3a')]({'where':{'id':_0x49cf4c[_0x16e3('0x2d')]['id']}})['then'](handleEntityNotFound(_0x113914,null))[_0x16e3('0x1a')](function(_0x2ab63d){if(_0x2ab63d){return _0x2ab63d['removeTags'](_0x49cf4c[_0x16e3('0x28')][_0x16e3('0x40')]);}})[_0x16e3('0x1a')](respondWithStatusCode(_0x113914,null))[_0x16e3('0x2a')](handleError(_0x113914,null));};exports[_0x16e3('0x57')]=function(_0x141854,_0xe11850){var _0x205c09=moment()[_0x16e3('0x58')]()[_0x16e3('0x59')]();var _0x115524=path[_0x16e3('0x5a')](config['root'],_0x16e3('0x5b'),_0x16e3('0x5c'),'tmp');var _0x524b90=path[_0x16e3('0x5a')](config[_0x16e3('0x5d')],_0x16e3('0x5b'),_0x16e3('0x5c'),_0x16e3('0x5e'));var _0x9c2e10=path[_0x16e3('0x5a')](_0x115524,_0x205c09);var _0x219d85=util[_0x16e3('0x4e')](_0x16e3('0x5f'),_0x141854[_0x16e3('0x2d')]['id'],_0x205c09);var _0x55f497=path[_0x16e3('0x5a')](_0x115524,_0x219d85);var _0x15ddd0=[];_0x15ddd0[_0x16e3('0x60')]({'model':db[_0x16e3('0x61')],'as':'User','attributes':['id',_0x16e3('0x62')],'raw':!![]});_0x15ddd0[_0x16e3('0x60')]({'model':db[_0x16e3('0x63')],'as':_0x16e3('0x64'),'attributes':['id','firstName',_0x16e3('0x65')],'raw':!![]});if(_0x141854[_0x16e3('0x28')][_0x16e3('0x5e')]){_0x15ddd0[_0x16e3('0x60')]({'model':db[_0x16e3('0x66')],'as':_0x16e3('0x66'),'raw':!![]});}var _0x4b7852=[{'model':db[_0x16e3('0x44')],'as':_0x16e3('0x67'),'attributes':['id','body',_0x16e3('0x68'),'direction',_0x16e3('0x69'),'read'],'include':_0x15ddd0}];_0x4b7852[_0x16e3('0x60')]({'model':db[_0x16e3('0x6a')],'as':'Account','attributes':['id',_0x16e3('0x1e')]});_0x4b7852[_0x16e3('0x60')]({'model':db[_0x16e3('0x61')],'as':_0x16e3('0x6b'),'attributes':['id',_0x16e3('0x62')]});return db[_0x16e3('0x30')][_0x16e3('0x3a')]({'where':{'id':_0x141854[_0x16e3('0x2d')]['id']},'include':_0x4b7852})[_0x16e3('0x1a')](handleEntityNotFound(_0xe11850,null))[_0x16e3('0x1a')](function(_0x22f4fe){if(_0x22f4fe){var _0x45ea9d=_0x22f4fe[_0x16e3('0x6c')]({'plain':!![]});fs[_0x16e3('0x6d')](_0x9c2e10);var _0x2ac5c6={'channel':_0x16e3('0x6e'),'account':_0x45ea9d[_0x16e3('0x6f')]['name'],'agent':_0x45ea9d[_0x16e3('0x6b')]?_0x45ea9d[_0x16e3('0x6b')][_0x16e3('0x62')]:_0x16e3('0x70'),'createdAt':moment(_0x45ea9d['createdAt'])[_0x16e3('0x4e')](_0x16e3('0x71'))['toString'](),'closedAt':_0x45ea9d['closed']?moment(_0x45ea9d['closedAt'])[_0x16e3('0x4e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x16e3('0x59')]():'','disposition':_0x45ea9d[_0x16e3('0x72')],'visibility':_0x45ea9d[_0x16e3('0x73')]?_0x16e3('0x74'):_0x16e3('0x75'),'messages':_(_0x45ea9d[_0x16e3('0x67')])[_0x16e3('0x76')]({'secret':![]})[_0x16e3('0x4c')](function(_0x153d1e){if(_0x153d1e['Attachment']){var _0x1a2b37=path[_0x16e3('0x5a')](_0x524b90,_0x153d1e[_0x16e3('0x66')]['basename']);if(fs[_0x16e3('0x77')](_0x1a2b37)){fs[_0x16e3('0x78')](_0x1a2b37)[_0x16e3('0x79')](fs[_0x16e3('0x7a')](path[_0x16e3('0x5a')](_0x9c2e10,_0x153d1e[_0x16e3('0x66')][_0x16e3('0x7b')])));}}return{'date':moment(_0x153d1e[_0x16e3('0x68')])['format'](_0x16e3('0x71'))['toString'](),'sender':_0x153d1e['direction']===_0x16e3('0x7c')?_0x153d1e[_0x16e3('0x61')]?_0x153d1e[_0x16e3('0x61')][_0x16e3('0x62')]:'System':_0x153d1e['Contact'][_0x16e3('0x7d')]+(_0x153d1e[_0x16e3('0x64')][_0x16e3('0x65')]?'\x20'+_0x153d1e[_0x16e3('0x64')][_0x16e3('0x65')]:''),'body':_0x153d1e['Attachment']?_0x153d1e[_0x16e3('0x66')][_0x16e3('0x7b')]:_0x153d1e[_0x16e3('0x3c')],'direction':_0x153d1e[_0x16e3('0x7e')]===_0x16e3('0x7c')?'A':'C','secret':_0x153d1e[_0x16e3('0x69')],'read':_0x153d1e[_0x16e3('0x7f')],'attachment':_0x153d1e['Attachment']};})[_0x16e3('0x80')]()};return ejs[_0x16e3('0x81')](path[_0x16e3('0x5a')](config['root'],_0x16e3('0x5b'),_0x16e3('0x82'),_0x16e3('0x83')),{'interaction':_0x2ac5c6})[_0x16e3('0x1a')](function(_0x20b79e){var _0x133fa9=path[_0x16e3('0x5a')](_0x9c2e10,'transcript-'+_0x45ea9d['id']+'-'+_0x205c09+_0x16e3('0x84'));var _0x38944d={'path':_0x133fa9,'channel':_0x16e3('0x6e'),'interactionId':_0x45ea9d['id']};return pdf[_0x16e3('0x85')](_0x20b79e,_0x38944d);})['then'](function(){return new Promise(function(_0x534be2,_0x59870f){zipdir(_0x9c2e10,{'saveTo':_0x55f497},function(_0x184539,_0x26b608){if(_0x184539)return _0x59870f(_0x184539);return _0x534be2(_0x26b608);});})['then'](function(){return new Promise(function(_0x1f592a,_0x5356fb){rimraf(_0x9c2e10,function(_0x4ac2fe){if(_0x4ac2fe)_0x5356fb(_0x4ac2fe);return _0x1f592a();});});})[_0x16e3('0x1a')](function(){return _0xe11850['download'](_0x55f497,_0x219d85,function(_0x34e367){if(_0x34e367){logger[_0x16e3('0x1c')](_0x16e3('0x86'),_0x34e367);}else{fs[_0x16e3('0x87')](_0x55f497);}});});});}else{return _0xe11850[_0x16e3('0x12')](0xc8);}})['catch'](handleError(_0xe11850,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f792315..4f93206 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 _0x14d4=['remove','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x47d6c8,_0x4195c5){var _0x42e495=function(_0x37503e){while(--_0x37503e){_0x47d6c8['push'](_0x47d6c8['shift']());}};_0x42e495(++_0x4195c5);}(_0x14d4,0x9a));var _0x414d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d4[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x414d('0x0'));var OpenchannelInteraction=require(_0x414d('0x1'))['db'][_0x414d('0x2')];var OpenchannelMessage=require(_0x414d('0x1'))['db'][_0x414d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x414d('0x4')](0x0);var events={'afterCreate':_0x414d('0x5'),'afterUpdate':'update','afterDestroy':_0x414d('0x6')};function emitEvent(_0x289865){return function(_0x1871c3,_0x455f9f,_0x744a41){_0x1871c3['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1b0cb6){_0x1871c3['setDataValue'](_0x414d('0x7'),_0x1b0cb6[_0x414d('0x8')](function(_0x5ba60a){return{'id':_0x5ba60a['id']};}));return OpenchannelMessage[_0x414d('0x9')]({'where':{'OpenchannelInteractionId':_0x1871c3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x414d('0xa')](function(_0x237f09){_0x1871c3['setDataValue']('unreadMessages',_0x237f09[_0x414d('0xb')]);OpenchannelInteractionEvents[_0x414d('0xc')](_0x289865+':'+_0x1871c3['id'],_0x1871c3);OpenchannelInteractionEvents[_0x414d('0xc')](_0x289865,_0x1871c3);_0x744a41(null);})[_0x414d('0xd')](_0x744a41(null));};}for(var e in events){if(events[_0x414d('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x414d('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x9182=['hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9182,0xe6));var _0x2918=function(_0x19b267,_0x5ea777){_0x19b267=_0x19b267-0x0;var _0x3103af=_0x9182[_0x19b267];return _0x3103af;};'use strict';var EventEmitter=require(_0x2918('0x0'));var OpenchannelInteraction=require(_0x2918('0x1'))['db'][_0x2918('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x2918('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2918('0x4')](0x0);var events={'afterCreate':_0x2918('0x5'),'afterUpdate':_0x2918('0x6'),'afterDestroy':'remove'};function emitEvent(_0x46059d){return function(_0x65164a,_0x194eb4,_0x331822){_0x65164a[_0x2918('0x7')]({'attributes':['id'],'raw':!![]})[_0x2918('0x8')](function(_0x3ae33c){_0x65164a[_0x2918('0x9')]('Users',_0x3ae33c[_0x2918('0xa')](function(_0x132239){return{'id':_0x132239['id']};}));return OpenchannelMessage[_0x2918('0xb')]({'where':{'OpenchannelInteractionId':_0x65164a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2918('0x8')](function(_0xaac3e9){_0x65164a[_0x2918('0x9')](_0x2918('0xc'),_0xaac3e9[_0x2918('0xd')]);OpenchannelInteractionEvents[_0x2918('0xe')](_0x46059d+':'+_0x65164a['id'],_0x65164a);OpenchannelInteractionEvents['emit'](_0x46059d,_0x65164a);_0x331822(null);})[_0x2918('0xf')](_0x331822(null));};}for(var e in events){if(events[_0x2918('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x2918('0x11')](e,emitEvent(event));}}module[_0x2918('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 29e966e..9f8b54e 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 _0x71ba=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed'];(function(_0x5af9b3,_0x516c90){var _0x129f28=function(_0x1a8fe6){while(--_0x1a8fe6){_0x5af9b3['push'](_0x5af9b3['shift']());}};_0x129f28(++_0x516c90);}(_0x71ba,0x1c2));var _0xa71b=function(_0x18624e,_0x172c43){_0x18624e=_0x18624e-0x0;var _0x41ef95=_0x71ba[_0x18624e];return _0x41ef95;};'use strict';var _=require(_0xa71b('0x0'));var util=require(_0xa71b('0x1'));var logger=require(_0xa71b('0x2'))(_0xa71b('0x3'));var moment=require(_0xa71b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa71b('0x5'));var fs=require('fs');var path=require(_0xa71b('0x6'));var rimraf=require(_0xa71b('0x7'));var config=require(_0xa71b('0x8'));var attributes=require(_0xa71b('0x9'));module['exports']=function(_0x55c001,_0xaf0ceb){return _0x55c001['define']('OpenchannelInteraction',attributes,{'tableName':_0xa71b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa71b('0xb'),'collate':_0xa71b('0xc'),'hooks':{'beforeUpdate':function(_0x5c9cb3,_0x3ed78b,_0x163f4a){if(_0x5c9cb3['changed'](_0xa71b('0xd'))){_0x5c9cb3['closedAt']=moment()[_0xa71b('0xe')](_0xa71b('0xf'));}_0x163f4a(null,_0x5c9cb3);}}});}; \ No newline at end of file +var _0x1856=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','format'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x1856,0x121));var _0x6185=function(_0x4cca8e,_0x4e35c6){_0x4cca8e=_0x4cca8e-0x0;var _0x50ac6d=_0x1856[_0x4cca8e];return _0x50ac6d;};'use strict';var _=require(_0x6185('0x0'));var util=require(_0x6185('0x1'));var logger=require(_0x6185('0x2'))('api');var moment=require(_0x6185('0x3'));var BPromise=require(_0x6185('0x4'));var rp=require(_0x6185('0x5'));var fs=require('fs');var path=require(_0x6185('0x6'));var rimraf=require(_0x6185('0x7'));var config=require(_0x6185('0x8'));var attributes=require(_0x6185('0x9'));module[_0x6185('0xa')]=function(_0xbf3b32,_0x4c7bef){return _0xbf3b32[_0x6185('0xb')](_0x6185('0xc'),attributes,{'tableName':_0x6185('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6185('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5e05f1,_0x23ca88,_0x3aa4d0){if(_0x5e05f1[_0x6185('0xf')]('closed')){_0x5e05f1['closedAt']=moment()[_0x6185('0x10')](_0x6185('0x11'));}_0x3aa4d0(null,_0x5e05f1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index e10c5c7..6833d98 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 _0x339a=['catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result'];(function(_0x5d123d,_0x1969c9){var _0x44015b=function(_0x243fc2){while(--_0x243fc2){_0x5d123d['push'](_0x5d123d['shift']());}};_0x44015b(++_0x1969c9);}(_0x339a,0x1cc));var _0xa339=function(_0x24f0c5,_0x5e09a6){_0x24f0c5=_0x24f0c5-0x0;var _0x2ab3e2=_0x339a[_0x24f0c5];return _0x2ab3e2;};'use strict';var _=require(_0xa339('0x0'));var util=require(_0xa339('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa339('0x2'));var logger=require('../../config/logger')(_0xa339('0x3'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa339('0x4')][_0xa339('0x5')]({'port':0x232a});config[_0xa339('0x6')]=_['defaults'](config[_0xa339('0x6')],{'host':_0xa339('0x7'),'port':0x18eb});var socket=require(_0xa339('0x8'))(new Redis(config[_0xa339('0x6')]));require(_0xa339('0x9'))[_0xa339('0xa')](socket);function respondWithRpcPromise(_0x512b8e,_0x106a84,_0x1a7fbe){return new BPromise(function(_0x5cd390,_0x2d4077){return client['request'](_0x512b8e,_0x1a7fbe)[_0xa339('0xb')](function(_0x5a2c8f){logger[_0xa339('0xc')](_0xa339('0xd'),_0x106a84,'request\x20sent');logger[_0xa339('0xe')](_0xa339('0xf'),_0x106a84,'request\x20sent',JSON['stringify'](_0x5a2c8f));if(_0x5a2c8f[_0xa339('0x10')]){if(_0x5a2c8f[_0xa339('0x10')][_0xa339('0x11')]===0x1f4){logger[_0xa339('0x10')](_0xa339('0xd'),_0x106a84,_0x5a2c8f[_0xa339('0x10')][_0xa339('0x12')]);return _0x2d4077(_0x5a2c8f[_0xa339('0x10')]['message']);}logger[_0xa339('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x106a84,_0x5a2c8f[_0xa339('0x10')]['message']);return _0x5cd390(_0x5a2c8f[_0xa339('0x10')][_0xa339('0x12')]);}else{logger['info'](_0xa339('0xd'),_0x106a84,_0xa339('0x13'));_0x5cd390(_0x5a2c8f[_0xa339('0x14')][_0xa339('0x12')]);}})[_0xa339('0x15')](function(_0x3d4c0e){logger[_0xa339('0x10')](_0xa339('0xd'),_0x106a84,_0x3d4c0e);_0x2d4077(_0x3d4c0e);});});}exports[_0xa339('0x16')]=function(_0x3d94c4){var _0x3dac4=this;return new Promise(function(_0x5b463e,_0x3e7e87){return db['OpenchannelInteraction'][_0xa339('0x17')](_0x3d94c4[_0xa339('0x18')],{'raw':_0x3d94c4[_0xa339('0x19')]?_0x3d94c4['options'][_0xa339('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d94c4[_0xa339('0x19')]?_0x3d94c4[_0xa339('0x19')][_0xa339('0x1b')]||null:null,'attributes':_0x3d94c4[_0xa339('0x19')]?_0x3d94c4[_0xa339('0x19')][_0xa339('0x1c')]||null:null,'limit':_0x3d94c4[_0xa339('0x19')]?_0x3d94c4[_0xa339('0x19')]['limit']||null:null})['then'](function(_0x5a5f11){logger[_0xa339('0xc')](_0xa339('0x16'),_0x3d94c4);logger[_0xa339('0xe')](_0xa339('0x16'),_0x3d94c4,JSON[_0xa339('0x1d')](_0x5a5f11));_0x5b463e(_0x5a5f11);})['catch'](function(_0x463028){logger['error'](_0xa339('0x16'),_0x463028['message'],_0x3d94c4);_0x3e7e87(_0x3dac4[_0xa339('0x10')](0x1f4,_0x463028[_0xa339('0x12')]));});});};exports[_0xa339('0x1e')]=function(_0x27aca0){return new Promise(function(_0x5c2dbf,_0x2aa136){return db['OpenchannelInteraction'][_0xa339('0x1f')]({'where':_0x27aca0[_0xa339('0x19')]?_0x27aca0[_0xa339('0x19')]['where']||null:null})[_0xa339('0xb')](function(_0x45f5a0){if(_0x45f5a0){return _0x45f5a0[_0xa339('0x20')](_0x27aca0[_0xa339('0x18')][_0xa339('0x21')],_[_0xa339('0x22')](_0x27aca0[_0xa339('0x18')],[_0xa339('0x21'),'id'])||{});}})[_0xa339('0x23')](function(_0x32dd1c){logger['info'](_0xa339('0x24'),_0x27aca0);logger['debug'](_0xa339('0x24'),_0x27aca0,JSON[_0xa339('0x1d')](_0x32dd1c));_0x5c2dbf(_0x32dd1c);})[_0xa339('0x15')](function(_0x383f86){logger[_0xa339('0x10')](_0xa339('0x24'),_0x383f86[_0xa339('0x12')],_0x27aca0);_0x2aa136(_this[_0xa339('0x10')](0x1f4,_0x383f86[_0xa339('0x12')]));});});}; \ No newline at end of file +var _0x9b75=['AddTags','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','attributes','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread'];(function(_0x4cde79,_0x5b2a84){var _0x1cbd6a=function(_0x53879a){while(--_0x53879a){_0x4cde79['push'](_0x4cde79['shift']());}};_0x1cbd6a(++_0x5b2a84);}(_0x9b75,0x191));var _0x59b7=function(_0xab6fd4,_0x2040fa){_0xab6fd4=_0xab6fd4-0x0;var _0x4843b9=_0x9b75[_0xab6fd4];return _0x4843b9;};'use strict';var _=require('lodash');var util=require(_0x59b7('0x0'));var moment=require('moment');var BPromise=require(_0x59b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59b7('0x2'));var db=require(_0x59b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x59b7('0x4'));var config=require(_0x59b7('0x5'));var jayson=require(_0x59b7('0x6'));var client=jayson[_0x59b7('0x7')][_0x59b7('0x8')]({'port':0x232a});config[_0x59b7('0x9')]=_[_0x59b7('0xa')](config[_0x59b7('0x9')],{'host':_0x59b7('0xb'),'port':0x18eb});var socket=require(_0x59b7('0xc'))(new Redis(config[_0x59b7('0x9')]));require(_0x59b7('0xd'))['register'](socket);function respondWithRpcPromise(_0xf5daed,_0x34cac1,_0x4d2644){return new BPromise(function(_0x34ac38,_0x4829e4){return client[_0x59b7('0xe')](_0xf5daed,_0x4d2644)[_0x59b7('0xf')](function(_0x2cd82d){logger[_0x59b7('0x10')](_0x59b7('0x11'),_0x34cac1,_0x59b7('0x12'));logger[_0x59b7('0x13')](_0x59b7('0x14'),_0x34cac1,'request\x20sent',JSON[_0x59b7('0x15')](_0x2cd82d));if(_0x2cd82d[_0x59b7('0x16')]){if(_0x2cd82d[_0x59b7('0x16')][_0x59b7('0x17')]===0x1f4){logger[_0x59b7('0x16')](_0x59b7('0x11'),_0x34cac1,_0x2cd82d[_0x59b7('0x16')][_0x59b7('0x18')]);return _0x4829e4(_0x2cd82d[_0x59b7('0x16')][_0x59b7('0x18')]);}logger[_0x59b7('0x16')](_0x59b7('0x11'),_0x34cac1,_0x2cd82d[_0x59b7('0x16')]['message']);return _0x34ac38(_0x2cd82d[_0x59b7('0x16')][_0x59b7('0x18')]);}else{logger[_0x59b7('0x10')](_0x59b7('0x11'),_0x34cac1,'request\x20sent');_0x34ac38(_0x2cd82d[_0x59b7('0x19')][_0x59b7('0x18')]);}})[_0x59b7('0x1a')](function(_0x4e5845){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x34cac1,_0x4e5845);_0x4829e4(_0x4e5845);});});}exports[_0x59b7('0x1b')]=function(_0x32c41c){var _0x439870=this;return new Promise(function(_0x4a6996,_0x414e69){return db[_0x59b7('0x1c')]['update'](_0x32c41c[_0x59b7('0x1d')],{'raw':_0x32c41c[_0x59b7('0x1e')]?_0x32c41c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32c41c[_0x59b7('0x1e')]?_0x32c41c[_0x59b7('0x1e')][_0x59b7('0x1f')]||null:null,'attributes':_0x32c41c[_0x59b7('0x1e')]?_0x32c41c['options'][_0x59b7('0x20')]||null:null,'limit':_0x32c41c['options']?_0x32c41c['options']['limit']||null:null})[_0x59b7('0xf')](function(_0xcd234e){logger['info'](_0x59b7('0x1b'),_0x32c41c);logger[_0x59b7('0x13')](_0x59b7('0x1b'),_0x32c41c,JSON[_0x59b7('0x15')](_0xcd234e));_0x4a6996(_0xcd234e);})['catch'](function(_0x37fc1f){logger[_0x59b7('0x16')]('UpdateOpenchannelInteraction',_0x37fc1f[_0x59b7('0x18')],_0x32c41c);_0x414e69(_0x439870[_0x59b7('0x16')](0x1f4,_0x37fc1f[_0x59b7('0x18')]));});});};exports[_0x59b7('0x21')]=function(_0x205585){return new Promise(function(_0x2cafec,_0x29acfe){return db[_0x59b7('0x1c')][_0x59b7('0x22')]({'where':_0x205585['options']?_0x205585[_0x59b7('0x1e')][_0x59b7('0x1f')]||null:null})[_0x59b7('0xf')](function(_0x2ef020){if(_0x2ef020){return _0x2ef020[_0x59b7('0x23')](_0x205585[_0x59b7('0x1d')][_0x59b7('0x24')],_[_0x59b7('0x25')](_0x205585[_0x59b7('0x1d')],[_0x59b7('0x24'),'id'])||{});}})[_0x59b7('0x26')](function(_0x8623da){logger[_0x59b7('0x10')]('AddTags',_0x205585);logger[_0x59b7('0x13')]('AddTags',_0x205585,JSON[_0x59b7('0x15')](_0x8623da));_0x2cafec(_0x8623da);})[_0x59b7('0x1a')](function(_0x4ffeff){logger[_0x59b7('0x16')](_0x59b7('0x27'),_0x4ffeff[_0x59b7('0x18')],_0x205585);_0x29acfe(_this['error'](0x1f4,_0x4ffeff[_0x59b7('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 15c234a..dfe843a 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 _0x8ea0=['emit','removeListener','register','length','openchannelInteraction:','save','remove','update'];(function(_0x14f46c,_0x21e8f3){var _0x108122=function(_0x259c7f){while(--_0x259c7f){_0x14f46c['push'](_0x14f46c['shift']());}};_0x108122(++_0x21e8f3);}(_0x8ea0,0x15d));var _0x08ea=function(_0x491e6d,_0x4020b7){_0x491e6d=_0x491e6d-0x0;var _0x2552be=_0x8ea0[_0x491e6d];return _0x2552be;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x08ea('0x0'),_0x08ea('0x1'),_0x08ea('0x2')];function createListener(_0x4fa1fc,_0x341073){return function(_0x4dbdc5){_0x341073[_0x08ea('0x3')](_0x4fa1fc,_0x4dbdc5);};}function removeListener(_0x1176bf,_0x4be865){return function(){OpenchannelInteractionEvents[_0x08ea('0x4')](_0x1176bf,_0x4be865);};}exports[_0x08ea('0x5')]=function(_0x47c864){for(var _0x5aba04=0x0,_0x5c36ff=events[_0x08ea('0x6')];_0x5aba04<_0x5c36ff;_0x5aba04++){var _0x4f5d5e=events[_0x5aba04];var _0x45d92c=createListener(_0x08ea('0x7')+_0x4f5d5e,_0x47c864);OpenchannelInteractionEvents['on'](_0x4f5d5e,_0x45d92c);}}; \ No newline at end of file +var _0xfbed=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x5caee9,_0x2d5230){var _0x2463a3=function(_0x4c13cd){while(--_0x4c13cd){_0x5caee9['push'](_0x5caee9['shift']());}};_0x2463a3(++_0x2d5230);}(_0xfbed,0x155));var _0xdfbe=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xfbed[_0x4b055c];return _0x4b62bb;};'use strict';var OpenchannelInteractionEvents=require(_0xdfbe('0x0'));var events=[_0xdfbe('0x1'),_0xdfbe('0x2'),'update'];function createListener(_0x151585,_0x8b29d4){return function(_0x42c466){_0x8b29d4[_0xdfbe('0x3')](_0x151585,_0x42c466);};}function removeListener(_0x3714c3,_0x432384){return function(){OpenchannelInteractionEvents[_0xdfbe('0x4')](_0x3714c3,_0x432384);};}exports[_0xdfbe('0x5')]=function(_0xb01404){for(var _0x274144=0x0,_0x7cf7ad=events[_0xdfbe('0x6')];_0x274144<_0x7cf7ad;_0x274144++){var _0x5f3da0=events[_0x274144];var _0x56cbb9=createListener(_0xdfbe('0x7')+_0x5f3da0,_0xb01404);OpenchannelInteractionEvents['on'](_0x5f3da0,_0x56cbb9);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b272c6c..8a4eaaa 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x5523c0,_0x16318e){_0x5523c0=_0x5523c0-0x0;var _0x4326fe=_0x70e0[_0x5523c0];return _0x4326fe;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _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(_0x355adc,_0xac51ab){var _0x4df04f=function(_0x4a787d){while(--_0x4a787d){_0x355adc['push'](_0x355adc['shift']());}};_0x4df04f(++_0xac51ab);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0xcb91[_0x1ee62e];return _0x27c6c8;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 56e290b..616649c 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 _0x02a7=['medium','BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0x02a7,0x1a6));var _0x702a=function(_0x429364,_0x1056d8){_0x429364=_0x429364-0x0;var _0x408936=_0x02a7[_0x429364];return _0x408936;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'body':{'type':Sequelize[_0x702a('0x1')](_0x702a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x702a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x702a('0x4')]('in',_0x702a('0x5')),'defaultValue':_0x702a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x702a('0x6')]},'providerName':{'type':Sequelize[_0x702a('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x57f8=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x1e78cb,_0x423703){var _0x40eaf4=function(_0x12e83b){while(--_0x12e83b){_0x1e78cb['push'](_0x1e78cb['shift']());}};_0x40eaf4(++_0x423703);}(_0x57f8,0x198));var _0x857f=function(_0x2493a8,_0x5a240d){_0x2493a8=_0x2493a8-0x0;var _0x2b06c9=_0x57f8[_0x2493a8];return _0x2b06c9;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'body':{'type':Sequelize[_0x857f('0x1')](_0x857f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x857f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x857f('0x4')]('in',_0x857f('0x5')),'defaultValue':_0x857f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x857f('0x6')]},'providerName':{'type':Sequelize[_0x857f('0x7')]},'providerResponse':{'type':Sequelize[_0x857f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 9ccc9c2..8326d26 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 _0xf2cc=['motionChannel','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','User','interface','SIP/%s','event','reject','rejectmessage','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','catch','sendStatus','status','offset','undefined','limit','count','save','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','params','include','options','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','update','read1stAt','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','channel'];(function(_0x5469f3,_0x18ca81){var _0xa8573a=function(_0x56f262){while(--_0x56f262){_0x5469f3['push'](_0x5469f3['shift']());}};_0xa8573a(++_0x18ca81);}(_0xf2cc,0x186));var _0xcf2c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf2cc[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xcf2c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf2c('0x1'));var rp=require(_0xcf2c('0x2'));var moment=require('moment');var BPromise=require(_0xcf2c('0x3'));var Mustache=require(_0xcf2c('0x4'));var util=require(_0xcf2c('0x5'));var path=require(_0xcf2c('0x6'));var sox=require('sox');var csv=require(_0xcf2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf2c('0x8'));var _=require(_0xcf2c('0x9'));var squel=require(_0xcf2c('0xa'));var crypto=require(_0xcf2c('0xb'));var jsforce=require(_0xcf2c('0xc'));var deskjs=require(_0xcf2c('0xd'));var toCsv=require(_0xcf2c('0x7'));var querystring=require(_0xcf2c('0xe'));var Papa=require(_0xcf2c('0xf'));var Redis=require(_0xcf2c('0x10'));var authService=require(_0xcf2c('0x11'));var qs=require(_0xcf2c('0x12'));var as=require(_0xcf2c('0x13'));var hardwareService=require(_0xcf2c('0x14'));var logger=require(_0xcf2c('0x15'))(_0xcf2c('0x16'));var utils=require(_0xcf2c('0x17'));var config=require(_0xcf2c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf2c('0x19'))['db'];config['redis']=_['defaults'](config[_0xcf2c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf2c('0x1a')]));require(_0xcf2c('0x1b'))[_0xcf2c('0x1c')](socket);var jayson=require(_0xcf2c('0x1d'));var client=jayson[_0xcf2c('0x1e')][_0xcf2c('0x1f')]({'port':0x232c});var client9002=jayson[_0xcf2c('0x1e')][_0xcf2c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4f003d,_0xc418b5,_0x4a36dd,_0x2ddc09){return new BPromise(function(_0x3b8612,_0x2dd5a2){var _0x24a588=_0x2ddc09||client;return _0x24a588[_0xcf2c('0x20')](_0x4f003d,_0x4a36dd)[_0xcf2c('0x21')](function(_0x4cb52e){logger[_0xcf2c('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xc418b5,'request\x20sent');logger[_0xcf2c('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0xc418b5,_0xcf2c('0x24'),JSON[_0xcf2c('0x25')](_0x4cb52e));if(_0x4cb52e['error']){if(_0x4cb52e[_0xcf2c('0x26')][_0xcf2c('0x27')]===0x1f4){logger[_0xcf2c('0x26')](_0xcf2c('0x28'),_0xc418b5,_0x4cb52e[_0xcf2c('0x26')][_0xcf2c('0x29')]);return _0x2dd5a2(_0x4cb52e[_0xcf2c('0x26')][_0xcf2c('0x29')]);}logger[_0xcf2c('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0xc418b5,_0x4cb52e[_0xcf2c('0x26')][_0xcf2c('0x29')]);return _0x3b8612(_0x4cb52e[_0xcf2c('0x26')][_0xcf2c('0x29')]);}else{logger[_0xcf2c('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xc418b5,'request\x20sent');_0x3b8612(_0x4cb52e['result'][_0xcf2c('0x29')]);}})[_0xcf2c('0x2a')](function(_0x989d7b){logger['error'](_0xcf2c('0x28'),_0xc418b5,_0x989d7b);_0x2dd5a2(_0x989d7b);});});}function respondWithStatusCode(_0x14daca,_0xc7884c){_0xc7884c=_0xc7884c||0xcc;return function(_0x629145){if(_0x629145){return _0x14daca[_0xcf2c('0x2b')](_0xc7884c);}return _0x14daca[_0xcf2c('0x2c')](_0xc7884c)['end']();};}function respondWithResult(_0x3cc242,_0x477a51){_0x477a51=_0x477a51||0xc8;return function(_0x380b44){if(_0x380b44){return _0x3cc242[_0xcf2c('0x2c')](_0x477a51)['json'](_0x380b44);}};}function respondWithFilteredResult(_0x62727e,_0x4b7e26){return function(_0x29c2d2){if(_0x29c2d2){var _0x221429=typeof _0x4b7e26[_0xcf2c('0x2d')]===_0xcf2c('0x2e')&&typeof _0x4b7e26[_0xcf2c('0x2f')]===_0xcf2c('0x2e');var _0x28248a=_0x29c2d2['count'];var _0x3b2013=_0x221429?0x0:_0x4b7e26[_0xcf2c('0x2d')];var _0x2ffe1d=_0x221429?_0x29c2d2[_0xcf2c('0x30')]:_0x4b7e26[_0xcf2c('0x2d')]+_0x4b7e26[_0xcf2c('0x2f')];var _0x3f1253;if(_0x2ffe1d>=_0x28248a){_0x2ffe1d=_0x28248a;_0x3f1253=0xc8;}else{_0x3f1253=0xce;}_0x62727e[_0xcf2c('0x2c')](_0x3f1253);return _0x62727e['set']('Content-Range',_0x3b2013+'-'+_0x2ffe1d+'/'+_0x28248a)['json'](_0x29c2d2);}return null;};}function patchUpdates(_0xdd5a45){return function(_0x5494fe){try{jsonpatch['apply'](_0x5494fe,_0xdd5a45,!![]);}catch(_0x300fd7){return BPromise['reject'](_0x300fd7);}return _0x5494fe[_0xcf2c('0x31')]();};}function saveUpdates(_0x357c45,_0x33655a){return function(_0x517d2c){if(_0x517d2c){return _0x517d2c['update'](_0x357c45)[_0xcf2c('0x21')](function(_0x35c2f9){return _0x35c2f9;});}return null;};}function removeEntity(_0x56bb02,_0x1cf2b5){return function(_0x3ae360){if(_0x3ae360){return _0x3ae360[_0xcf2c('0x32')]()['then'](function(){_0x56bb02[_0xcf2c('0x2c')](0xcc)[_0xcf2c('0x33')]();});}};}function handleEntityNotFound(_0x16fd31,_0x4f5147){return function(_0x41d358){if(!_0x41d358){_0x16fd31['sendStatus'](0x194);}return _0x41d358;};}function handleError(_0x27abfa,_0x17eb71){_0x17eb71=_0x17eb71||0x1f4;return function(_0x5cbc9a){logger[_0xcf2c('0x26')](_0x5cbc9a['stack']);if(_0x5cbc9a[_0xcf2c('0x34')]){delete _0x5cbc9a[_0xcf2c('0x34')];}_0x27abfa[_0xcf2c('0x2c')](_0x17eb71)[_0xcf2c('0x35')](_0x5cbc9a);};}exports[_0xcf2c('0x36')]=function(_0x4ce2fa,_0x54dac7){var _0xf4657c={},_0x38ce77={},_0x42e267={'count':0x0,'rows':[]};var _0x5d88e8=_[_0xcf2c('0x37')](db[_0xcf2c('0x38')][_0xcf2c('0x39')],function(_0xa8b0e6){return{'name':_0xa8b0e6[_0xcf2c('0x3a')],'type':_0xa8b0e6[_0xcf2c('0x3b')]['key']};});_0x38ce77[_0xcf2c('0x3c')]=_['map'](_0x5d88e8,_0xcf2c('0x34'));_0x38ce77[_0xcf2c('0x3d')]=_[_0xcf2c('0x3e')](_0x4ce2fa[_0xcf2c('0x3d')]);_0x38ce77[_0xcf2c('0x3f')]=_[_0xcf2c('0x40')](_0x38ce77[_0xcf2c('0x3c')],_0x38ce77[_0xcf2c('0x3d')]);_0xf4657c[_0xcf2c('0x41')]=_['intersection'](_0x38ce77[_0xcf2c('0x3c')],qs[_0xcf2c('0x42')](_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x42')]));_0xf4657c['attributes']=_0xf4657c['attributes'][_0xcf2c('0x43')]?_0xf4657c[_0xcf2c('0x41')]:_0x38ce77[_0xcf2c('0x3c')];if(!_0x4ce2fa['query'][_0xcf2c('0x44')](_0xcf2c('0x45'))){_0xf4657c[_0xcf2c('0x2f')]=qs[_0xcf2c('0x2f')](_0x4ce2fa['query'][_0xcf2c('0x2f')]);_0xf4657c[_0xcf2c('0x2d')]=qs[_0xcf2c('0x2d')](_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x2d')]);}_0xf4657c[_0xcf2c('0x46')]=qs[_0xcf2c('0x47')](_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x47')]);_0xf4657c[_0xcf2c('0x48')]=qs[_0xcf2c('0x3f')](_[_0xcf2c('0x49')](_0x4ce2fa[_0xcf2c('0x3d')],_0x38ce77[_0xcf2c('0x3f')]),_0x5d88e8);if(_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x4a')]){_0xf4657c[_0xcf2c('0x48')]=_['merge'](_0xf4657c[_0xcf2c('0x48')],{'$or':_[_0xcf2c('0x37')](_0x5d88e8,function(_0x4afa24){if(_0x4afa24[_0xcf2c('0x3b')]!==_0xcf2c('0x4b')){var _0x160458={};_0x160458[_0x4afa24['name']]={'$like':'%'+_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x4a')]+'%'};return _0x160458;}})});}_0xf4657c=_[_0xcf2c('0x4c')]({},_0xf4657c,_0x4ce2fa['options']);var _0x282b2e={'where':_0xf4657c[_0xcf2c('0x48')]};return db[_0xcf2c('0x38')][_0xcf2c('0x30')](_0x282b2e)[_0xcf2c('0x21')](function(_0x5e34ad){_0x42e267[_0xcf2c('0x30')]=_0x5e34ad;if(_0x4ce2fa[_0xcf2c('0x3d')][_0xcf2c('0x4d')]){_0xf4657c['include']=[{'all':!![]}];}return db[_0xcf2c('0x38')]['findAll'](_0xf4657c);})[_0xcf2c('0x21')](function(_0x34b4e3){_0x42e267[_0xcf2c('0x4e')]=_0x34b4e3;return _0x42e267;})[_0xcf2c('0x21')](respondWithFilteredResult(_0x54dac7,_0xf4657c))[_0xcf2c('0x2a')](handleError(_0x54dac7,null));};exports['show']=function(_0x3cd306,_0x41a4d0){var _0x4bbf38={'raw':!![],'where':{'id':_0x3cd306[_0xcf2c('0x4f')]['id']}},_0x36055e={};_0x36055e[_0xcf2c('0x3c')]=_[_0xcf2c('0x3e')](db['OpenchannelMessage'][_0xcf2c('0x39')]);_0x36055e[_0xcf2c('0x3d')]=_['keys'](_0x3cd306[_0xcf2c('0x3d')]);_0x36055e[_0xcf2c('0x3f')]=_[_0xcf2c('0x40')](_0x36055e['model'],_0x36055e[_0xcf2c('0x3d')]);_0x4bbf38[_0xcf2c('0x41')]=_[_0xcf2c('0x40')](_0x36055e[_0xcf2c('0x3c')],qs[_0xcf2c('0x42')](_0x3cd306[_0xcf2c('0x3d')][_0xcf2c('0x42')]));_0x4bbf38[_0xcf2c('0x41')]=_0x4bbf38[_0xcf2c('0x41')][_0xcf2c('0x43')]?_0x4bbf38[_0xcf2c('0x41')]:_0x36055e[_0xcf2c('0x3c')];if(_0x3cd306['query'][_0xcf2c('0x4d')]){_0x4bbf38[_0xcf2c('0x50')]=[{'all':!![]}];}_0x4bbf38=_['merge']({},_0x4bbf38,_0x3cd306[_0xcf2c('0x51')]);return db['OpenchannelMessage'][_0xcf2c('0x52')](_0x4bbf38)[_0xcf2c('0x21')](handleEntityNotFound(_0x41a4d0,null))[_0xcf2c('0x21')](respondWithResult(_0x41a4d0,null))['catch'](handleError(_0x41a4d0,null));};exports[_0xcf2c('0x53')]=function(_0x526bc1,_0xcb133e){return db['OpenchannelMessage']['create'](_0x526bc1[_0xcf2c('0x54')],{})[_0xcf2c('0x21')](respondWithResult(_0xcb133e,0xc9))[_0xcf2c('0x2a')](handleError(_0xcb133e,null));};exports['update']=function(_0x5c7791,_0x13f994){if(_0x5c7791[_0xcf2c('0x54')]['id']){delete _0x5c7791['body']['id'];}return db[_0xcf2c('0x38')][_0xcf2c('0x52')]({'where':{'id':_0x5c7791[_0xcf2c('0x4f')]['id']}})[_0xcf2c('0x21')](handleEntityNotFound(_0x13f994,null))[_0xcf2c('0x21')](saveUpdates(_0x5c7791[_0xcf2c('0x54')],null))[_0xcf2c('0x21')](respondWithResult(_0x13f994,null))[_0xcf2c('0x2a')](handleError(_0x13f994,null));};exports[_0xcf2c('0x32')]=function(_0x52c5e4,_0x2153b1){return db['OpenchannelMessage'][_0xcf2c('0x52')]({'where':{'id':_0x52c5e4[_0xcf2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2153b1,null))['then'](removeEntity(_0x2153b1,null))[_0xcf2c('0x2a')](handleError(_0x2153b1,null));};exports['describe']=function(_0x597c51,_0x1e9926){return db[_0xcf2c('0x38')][_0xcf2c('0x55')]()['then'](respondWithResult(_0x1e9926,null))['catch'](handleError(_0x1e9926,null));};var interaction_log=require(_0xcf2c('0x15'))(_0xcf2c('0x56'));exports[_0xcf2c('0x57')]=function(_0x5ab250,_0x54f25e,_0x5158da){var _0x1c0567={'agent':{},'channel':_0xcf2c('0x58')};if(_0x5ab250[_0xcf2c('0x54')]['id']){delete _0x5ab250[_0xcf2c('0x54')]['id'];}_0x5ab250[_0xcf2c('0x54')]['read']=!![];_0x5ab250[_0xcf2c('0x54')][_0xcf2c('0x59')]=moment()[_0xcf2c('0x5a')](_0xcf2c('0x5b'));_0x5ab250[_0xcf2c('0x54')][_0xcf2c('0x5c')]=_0x5ab250[_0xcf2c('0x54')][_0xcf2c('0x5c')]||_0x5ab250[_0xcf2c('0x5d')]['id'];_0x1c0567[_0xcf2c('0x5e')]['id']=_0x5ab250[_0xcf2c('0x54')]['UserId'];return db[_0xcf2c('0x38')][_0xcf2c('0x52')]({'where':{'id':_0x5ab250[_0xcf2c('0x4f')]['id'],'UserId':null}})[_0xcf2c('0x21')](handleEntityNotFound(_0x54f25e,null))[_0xcf2c('0x21')](saveUpdates(_0x5ab250['body'],null))[_0xcf2c('0x21')](function(_0x17bdb5){if(_0x17bdb5){_0x1c0567[_0xcf2c('0x29')]=_0x17bdb5[_0xcf2c('0x5f')]({'plain':!![]});return db[_0xcf2c('0x60')][_0xcf2c('0x52')]({'where':{'id':_0x17bdb5[_0xcf2c('0x61')]}});}return null;})[_0xcf2c('0x21')](handleEntityNotFound(_0x54f25e,null))[_0xcf2c('0x21')](function(_0x596c86){if(_0x596c86){return _0x596c86[_0xcf2c('0x62')]({'UserId':_0x5ab250[_0xcf2c('0x54')][_0xcf2c('0x5c')],'read1stAt':_['isNil'](_0x596c86[_0xcf2c('0x63')])?moment()[_0xcf2c('0x5a')](_0xcf2c('0x5b')):undefined});}return null;})[_0xcf2c('0x21')](function(_0x45bd5f){if(_0x45bd5f){_0x1c0567[_0xcf2c('0x64')]=_0x45bd5f[_0xcf2c('0x5f')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5ab250['user']['id'],_0x5ab250['user']['name'],_0x5ab250[_0xcf2c('0x5d')]['role'],_0x1c0567['interaction']['id'],_0x5ab250[_0xcf2c('0x54')]?JSON[_0xcf2c('0x25')](_0x5ab250[_0xcf2c('0x54')]):'null');return respondWithRpcPromise(_0xcf2c('0x65'),_0xcf2c('0x66'),_0x1c0567);}return null;})[_0xcf2c('0x21')](function(_0x53ae49){var _0x8875b7=_0xcf2c('0x67')+_0x53ae49[_0xcf2c('0x29')][_0xcf2c('0x68')];return db[_0xcf2c('0x69')][_0xcf2c('0x3d')](_0x8875b7,{'type':db[_0xcf2c('0x6a')][_0xcf2c('0x6b')][_0xcf2c('0x6c')],'raw':!![]})[_0xcf2c('0x21')](function(_0x10ddca){return _0x10ddca;});})['then'](function(_0x5c7d6a){if(_0x5c7d6a){_0x1c0567['message'][_0xcf2c('0x6d')]=_0x5c7d6a[0x0];if(!_0x5ab250[_0xcf2c('0x54')][_0xcf2c('0x5c')])return;return db['User'][_0xcf2c('0x52')]({'where':{'id':_0x5ab250[_0xcf2c('0x54')]['UserId'],'role':'agent'},'attributes':['id','name',_0xcf2c('0x6e'),_0xcf2c('0x6f'),_0xcf2c('0x70')],'raw':!![]});}return null;})[_0xcf2c('0x21')](function(_0x44a4ed){if(!_0x44a4ed)return null;_0x1c0567[_0xcf2c('0x29')]['agent']=_0x44a4ed;return _0x1c0567;})[_0xcf2c('0x21')](function(_0x4bf332){if(_0x4bf332){if(_0x5ab250[_0xcf2c('0x54')]['manual']){_0x1c0567[_0xcf2c('0x29')]['interface']=util[_0xcf2c('0x5a')]('SIP/%s',_0x5ab250[_0xcf2c('0x5d')][_0xcf2c('0x34')]);_0x1c0567[_0xcf2c('0x29')][_0xcf2c('0x71')]=_0x1c0567[_0xcf2c('0x71')];_0x1c0567[_0xcf2c('0x29')][_0xcf2c('0x72')]=_0x1c0567[_0xcf2c('0x71')];_0x1c0567['message']['event']=_0xcf2c('0x57');return respondWithRpcPromise(_0xcf2c('0x73'),_0xcf2c('0x73'),{'event':'acceptmessage','message':_0x1c0567[_0xcf2c('0x29')]},client9002)[_0xcf2c('0x21')](function(){return _0x1c0567;});}return _0x1c0567;}return null;})['then'](respondWithResult(_0x54f25e,null))[_0xcf2c('0x2a')](handleError(_0x54f25e,null));};var interaction_log=require(_0xcf2c('0x15'))(_0xcf2c('0x56'));exports['reject']=function(_0x4bfb3a,_0x3a56c8,_0x55c0ac){var _0x31cfec={'agent':{},'channel':_0xcf2c('0x58')};if(_0x4bfb3a[_0xcf2c('0x54')]['id']){delete _0x4bfb3a[_0xcf2c('0x54')]['id'];}_0x4bfb3a['body'][_0xcf2c('0x5c')]=_0x4bfb3a['body'][_0xcf2c('0x5c')]||_0x4bfb3a['user']['id'];_0x31cfec[_0xcf2c('0x5e')]['id']=_0x4bfb3a[_0xcf2c('0x54')][_0xcf2c('0x5c')];return db[_0xcf2c('0x38')][_0xcf2c('0x52')]({'where':{'id':_0x4bfb3a[_0xcf2c('0x4f')]['id'],'UserId':null}})[_0xcf2c('0x21')](handleEntityNotFound(_0x3a56c8,null))[_0xcf2c('0x21')](function(_0x1c7a47){if(_0x1c7a47){_0x31cfec[_0xcf2c('0x29')]=_0x1c7a47['get']({'plain':!![]});return db[_0xcf2c('0x60')][_0xcf2c('0x52')]({'where':{'id':_0x1c7a47[_0xcf2c('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x3a56c8,null))['then'](function(_0x4697ae){if(_0x4697ae){_0x31cfec['interaction']=_0x4697ae[_0xcf2c('0x5f')]({'plain':!![]});interaction_log[_0xcf2c('0x22')](_0xcf2c('0x74'),_0x4bfb3a['user']['id'],_0x4bfb3a[_0xcf2c('0x5d')]['name'],_0x4bfb3a[_0xcf2c('0x5d')][_0xcf2c('0x75')],_0x31cfec[_0xcf2c('0x64')]['id'],_0x4bfb3a['body']?JSON[_0xcf2c('0x25')](_0x4bfb3a[_0xcf2c('0x54')]):_0xcf2c('0x76'));return respondWithRpcPromise('RejectMessage',_0xcf2c('0x77'),_0x31cfec);}return null;})[_0xcf2c('0x21')](function(_0x4a3f68){var _0x533fce=_0xcf2c('0x67')+_0x4a3f68[_0xcf2c('0x29')][_0xcf2c('0x68')];return db[_0xcf2c('0x69')][_0xcf2c('0x3d')](_0x533fce,{'type':db[_0xcf2c('0x6a')][_0xcf2c('0x6b')]['SELECT'],'raw':!![]})[_0xcf2c('0x21')](function(_0x366e96){return _0x366e96;});})[_0xcf2c('0x21')](function(_0x4b4b12){if(_0x4b4b12){_0x31cfec[_0xcf2c('0x29')][_0xcf2c('0x6d')]=_0x4b4b12[0x0];if(!_0x4bfb3a[_0xcf2c('0x54')][_0xcf2c('0x5c')])return;return db[_0xcf2c('0x78')][_0xcf2c('0x52')]({'where':{'id':_0x4bfb3a[_0xcf2c('0x54')][_0xcf2c('0x5c')],'role':'agent'},'attributes':['id',_0xcf2c('0x34'),_0xcf2c('0x6e'),'email',_0xcf2c('0x70')],'raw':!![]});}return null;})[_0xcf2c('0x21')](function(_0x23d991){if(!_0x23d991)return null;_0x31cfec[_0xcf2c('0x29')][_0xcf2c('0x5e')]=_0x23d991;return _0x31cfec;})[_0xcf2c('0x21')](function(_0x40bd03){if(_0x40bd03){_0x40bd03[_0xcf2c('0x29')][_0xcf2c('0x79')]=util['format'](_0xcf2c('0x7a'),_0x4bfb3a[_0xcf2c('0x5d')][_0xcf2c('0x34')]);_0x40bd03['message'][_0xcf2c('0x71')]=_0x31cfec['channel'];_0x40bd03[_0xcf2c('0x29')][_0xcf2c('0x72')]=_0x31cfec[_0xcf2c('0x71')];_0x40bd03['message'][_0xcf2c('0x7b')]=_0xcf2c('0x7c');respondWithRpcPromise(_0xcf2c('0x73'),_0xcf2c('0x73'),{'event':_0xcf2c('0x7d'),'message':_0x40bd03['message']},client9002);return _0x31cfec;}return null;})['then'](respondWithResult(_0x3a56c8,null))[_0xcf2c('0x2a')](handleError(_0x3a56c8,null));}; \ No newline at end of file +var _0x6e04=['interaction','role','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','fullname','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','OpenchannelMessage','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','get','OpenchannelInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x14792e,_0xa801a5){var _0x2bfbfb=function(_0xe06f79){while(--_0xe06f79){_0x14792e['push'](_0x14792e['shift']());}};_0x2bfbfb(++_0xa801a5);}(_0x6e04,0x99));var _0x46e0=function(_0x3a21c0,_0x348451){_0x3a21c0=_0x3a21c0-0x0;var _0x411e84=_0x6e04[_0x3a21c0];return _0x411e84;};'use strict';var emlformat=require(_0x46e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x46e0('0x1'));var jsonpatch=require(_0x46e0('0x2'));var rp=require(_0x46e0('0x3'));var moment=require(_0x46e0('0x4'));var BPromise=require(_0x46e0('0x5'));var Mustache=require(_0x46e0('0x6'));var util=require(_0x46e0('0x7'));var path=require(_0x46e0('0x8'));var sox=require('sox');var csv=require(_0x46e0('0x9'));var ejs=require(_0x46e0('0xa'));var fs=require('fs');var fs_extra=require(_0x46e0('0xb'));var _=require(_0x46e0('0xc'));var squel=require('squel');var crypto=require(_0x46e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x46e0('0xe'));var toCsv=require(_0x46e0('0x9'));var querystring=require(_0x46e0('0xf'));var Papa=require('papaparse');var Redis=require(_0x46e0('0x10'));var authService=require(_0x46e0('0x11'));var qs=require(_0x46e0('0x12'));var as=require(_0x46e0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46e0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x46e0('0x15'));var licenseUtil=require(_0x46e0('0x16'));var db=require('../../mysqldb')['db'];config[_0x46e0('0x17')]=_[_0x46e0('0x18')](config[_0x46e0('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x46e0('0x19'))(new Redis(config[_0x46e0('0x17')]));require(_0x46e0('0x1a'))[_0x46e0('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x46e0('0x1c')][_0x46e0('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35e440,_0x5e923c,_0x480b73,_0x526a5c){return new BPromise(function(_0x576476,_0x43cdc0){var _0x3027d1=_0x526a5c||client;return _0x3027d1[_0x46e0('0x1e')](_0x35e440,_0x480b73)[_0x46e0('0x1f')](function(_0x46b8ac){logger[_0x46e0('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x5e923c,_0x46e0('0x21'));logger[_0x46e0('0x22')](_0x46e0('0x23'),_0x5e923c,_0x46e0('0x21'),JSON['stringify'](_0x46b8ac));if(_0x46b8ac[_0x46e0('0x24')]){if(_0x46b8ac[_0x46e0('0x24')][_0x46e0('0x25')]===0x1f4){logger[_0x46e0('0x24')](_0x46e0('0x26'),_0x5e923c,_0x46b8ac[_0x46e0('0x24')][_0x46e0('0x27')]);return _0x43cdc0(_0x46b8ac[_0x46e0('0x24')][_0x46e0('0x27')]);}logger[_0x46e0('0x24')](_0x46e0('0x26'),_0x5e923c,_0x46b8ac['error']['message']);return _0x576476(_0x46b8ac[_0x46e0('0x24')]['message']);}else{logger[_0x46e0('0x20')](_0x46e0('0x26'),_0x5e923c,_0x46e0('0x21'));_0x576476(_0x46b8ac[_0x46e0('0x28')]['message']);}})[_0x46e0('0x29')](function(_0x5885f6){logger[_0x46e0('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x5e923c,_0x5885f6);_0x43cdc0(_0x5885f6);});});}function respondWithStatusCode(_0x1f136f,_0x36167e){_0x36167e=_0x36167e||0xcc;return function(_0x1525ce){if(_0x1525ce){return _0x1f136f['sendStatus'](_0x36167e);}return _0x1f136f[_0x46e0('0x2a')](_0x36167e)[_0x46e0('0x2b')]();};}function respondWithResult(_0xc71c84,_0x36b349){_0x36b349=_0x36b349||0xc8;return function(_0x187cc1){if(_0x187cc1){return _0xc71c84['status'](_0x36b349)[_0x46e0('0x2c')](_0x187cc1);}};}function respondWithFilteredResult(_0x32709c,_0x439138){return function(_0x1920bc){if(_0x1920bc){var _0x8b6aa6=typeof _0x439138[_0x46e0('0x2d')]===_0x46e0('0x2e')&&typeof _0x439138[_0x46e0('0x2f')]===_0x46e0('0x2e');var _0x1026aa=_0x1920bc['count'];var _0x28e324=_0x8b6aa6?0x0:_0x439138[_0x46e0('0x2d')];var _0x4e997e=_0x8b6aa6?_0x1920bc[_0x46e0('0x30')]:_0x439138[_0x46e0('0x2d')]+_0x439138['limit'];var _0x279537;if(_0x4e997e>=_0x1026aa){_0x4e997e=_0x1026aa;_0x279537=0xc8;}else{_0x279537=0xce;}_0x32709c[_0x46e0('0x2a')](_0x279537);return _0x32709c[_0x46e0('0x31')](_0x46e0('0x32'),_0x28e324+'-'+_0x4e997e+'/'+_0x1026aa)[_0x46e0('0x2c')](_0x1920bc);}return null;};}function patchUpdates(_0x58b3cd){return function(_0x4cfa8d){try{jsonpatch[_0x46e0('0x33')](_0x4cfa8d,_0x58b3cd,!![]);}catch(_0x3c2ad5){return BPromise[_0x46e0('0x34')](_0x3c2ad5);}return _0x4cfa8d[_0x46e0('0x35')]();};}function saveUpdates(_0x1b1141,_0xc58bb5){return function(_0x75958b){if(_0x75958b){return _0x75958b[_0x46e0('0x36')](_0x1b1141)['then'](function(_0x396b19){return _0x396b19;});}return null;};}function removeEntity(_0x41269d,_0x266d5b){return function(_0x1f2b84){if(_0x1f2b84){return _0x1f2b84[_0x46e0('0x37')]()['then'](function(){_0x41269d[_0x46e0('0x2a')](0xcc)[_0x46e0('0x2b')]();});}};}function handleEntityNotFound(_0xb6ecf2,_0x28b7ed){return function(_0x492623){if(!_0x492623){_0xb6ecf2[_0x46e0('0x38')](0x194);}return _0x492623;};}function handleError(_0x235272,_0x552461){_0x552461=_0x552461||0x1f4;return function(_0x10ef79){logger['error'](_0x10ef79['stack']);if(_0x10ef79[_0x46e0('0x39')]){delete _0x10ef79['name'];}_0x235272[_0x46e0('0x2a')](_0x552461)[_0x46e0('0x3a')](_0x10ef79);};}exports[_0x46e0('0x3b')]=function(_0x539916,_0x5e489d){var _0x26513a={},_0x5efd38={},_0x3654d2={'count':0x0,'rows':[]};var _0x3ec02f=_['map'](db[_0x46e0('0x3c')]['rawAttributes'],function(_0x2a1421){return{'name':_0x2a1421['fieldName'],'type':_0x2a1421[_0x46e0('0x3d')]['key']};});_0x5efd38[_0x46e0('0x3e')]=_[_0x46e0('0x3f')](_0x3ec02f,'name');_0x5efd38[_0x46e0('0x40')]=_['keys'](_0x539916[_0x46e0('0x40')]);_0x5efd38[_0x46e0('0x41')]=_['intersection'](_0x5efd38[_0x46e0('0x3e')],_0x5efd38[_0x46e0('0x40')]);_0x26513a['attributes']=_[_0x46e0('0x42')](_0x5efd38[_0x46e0('0x3e')],qs[_0x46e0('0x43')](_0x539916[_0x46e0('0x40')][_0x46e0('0x43')]));_0x26513a['attributes']=_0x26513a[_0x46e0('0x44')][_0x46e0('0x45')]?_0x26513a[_0x46e0('0x44')]:_0x5efd38['model'];if(!_0x539916['query'][_0x46e0('0x46')](_0x46e0('0x47'))){_0x26513a[_0x46e0('0x2f')]=qs[_0x46e0('0x2f')](_0x539916[_0x46e0('0x40')][_0x46e0('0x2f')]);_0x26513a[_0x46e0('0x2d')]=qs[_0x46e0('0x2d')](_0x539916['query'][_0x46e0('0x2d')]);}_0x26513a[_0x46e0('0x48')]=qs[_0x46e0('0x49')](_0x539916['query'][_0x46e0('0x49')]);_0x26513a[_0x46e0('0x4a')]=qs['filters'](_['pick'](_0x539916[_0x46e0('0x40')],_0x5efd38[_0x46e0('0x41')]),_0x3ec02f);if(_0x539916[_0x46e0('0x40')][_0x46e0('0x4b')]){_0x26513a[_0x46e0('0x4a')]=_['merge'](_0x26513a[_0x46e0('0x4a')],{'$or':_[_0x46e0('0x3f')](_0x3ec02f,function(_0x882567){if(_0x882567['type']!==_0x46e0('0x4c')){var _0x323bf2={};_0x323bf2[_0x882567[_0x46e0('0x39')]]={'$like':'%'+_0x539916[_0x46e0('0x40')][_0x46e0('0x4b')]+'%'};return _0x323bf2;}})});}_0x26513a=_[_0x46e0('0x4d')]({},_0x26513a,_0x539916[_0x46e0('0x4e')]);var _0x512c02={'where':_0x26513a[_0x46e0('0x4a')]};return db[_0x46e0('0x3c')]['count'](_0x512c02)['then'](function(_0x1989c8){_0x3654d2[_0x46e0('0x30')]=_0x1989c8;if(_0x539916[_0x46e0('0x40')][_0x46e0('0x4f')]){_0x26513a[_0x46e0('0x50')]=[{'all':!![]}];}return db[_0x46e0('0x3c')][_0x46e0('0x51')](_0x26513a);})[_0x46e0('0x1f')](function(_0x3d229c){_0x3654d2[_0x46e0('0x52')]=_0x3d229c;return _0x3654d2;})['then'](respondWithFilteredResult(_0x5e489d,_0x26513a))['catch'](handleError(_0x5e489d,null));};exports[_0x46e0('0x53')]=function(_0x38c7a5,_0x1d8de0){var _0x88deaa={'raw':!![],'where':{'id':_0x38c7a5[_0x46e0('0x54')]['id']}},_0x1df5b3={};_0x1df5b3[_0x46e0('0x3e')]=_['keys'](db[_0x46e0('0x3c')][_0x46e0('0x55')]);_0x1df5b3['query']=_['keys'](_0x38c7a5[_0x46e0('0x40')]);_0x1df5b3['filters']=_[_0x46e0('0x42')](_0x1df5b3[_0x46e0('0x3e')],_0x1df5b3[_0x46e0('0x40')]);_0x88deaa['attributes']=_[_0x46e0('0x42')](_0x1df5b3[_0x46e0('0x3e')],qs[_0x46e0('0x43')](_0x38c7a5[_0x46e0('0x40')][_0x46e0('0x43')]));_0x88deaa[_0x46e0('0x44')]=_0x88deaa['attributes'][_0x46e0('0x45')]?_0x88deaa[_0x46e0('0x44')]:_0x1df5b3[_0x46e0('0x3e')];if(_0x38c7a5[_0x46e0('0x40')]['includeAll']){_0x88deaa[_0x46e0('0x50')]=[{'all':!![]}];}_0x88deaa=_[_0x46e0('0x4d')]({},_0x88deaa,_0x38c7a5[_0x46e0('0x4e')]);return db[_0x46e0('0x3c')][_0x46e0('0x56')](_0x88deaa)['then'](handleEntityNotFound(_0x1d8de0,null))[_0x46e0('0x1f')](respondWithResult(_0x1d8de0,null))[_0x46e0('0x29')](handleError(_0x1d8de0,null));};exports['create']=function(_0x119a79,_0x33e88c){return db[_0x46e0('0x3c')][_0x46e0('0x57')](_0x119a79[_0x46e0('0x58')],{})['then'](respondWithResult(_0x33e88c,0xc9))[_0x46e0('0x29')](handleError(_0x33e88c,null));};exports['update']=function(_0x4277a8,_0x1d8c1a){if(_0x4277a8[_0x46e0('0x58')]['id']){delete _0x4277a8[_0x46e0('0x58')]['id'];}return db[_0x46e0('0x3c')][_0x46e0('0x56')]({'where':{'id':_0x4277a8[_0x46e0('0x54')]['id']}})[_0x46e0('0x1f')](handleEntityNotFound(_0x1d8c1a,null))[_0x46e0('0x1f')](saveUpdates(_0x4277a8[_0x46e0('0x58')],null))[_0x46e0('0x1f')](respondWithResult(_0x1d8c1a,null))[_0x46e0('0x29')](handleError(_0x1d8c1a,null));};exports[_0x46e0('0x37')]=function(_0x4384a4,_0x57e5c5){return db['OpenchannelMessage']['find']({'where':{'id':_0x4384a4[_0x46e0('0x54')]['id']}})[_0x46e0('0x1f')](handleEntityNotFound(_0x57e5c5,null))['then'](removeEntity(_0x57e5c5,null))[_0x46e0('0x29')](handleError(_0x57e5c5,null));};exports[_0x46e0('0x59')]=function(_0x1a078e,_0x5569f8){return db[_0x46e0('0x3c')][_0x46e0('0x59')]()['then'](respondWithResult(_0x5569f8,null))[_0x46e0('0x29')](handleError(_0x5569f8,null));};var interaction_log=require(_0x46e0('0x14'))(_0x46e0('0x5a'));exports[_0x46e0('0x5b')]=function(_0x2b1fb4,_0x5d46c0,_0x7d309c){var _0x2da509={'agent':{},'channel':_0x46e0('0x5c')};if(_0x2b1fb4[_0x46e0('0x58')]['id']){delete _0x2b1fb4['body']['id'];}_0x2b1fb4[_0x46e0('0x58')]['read']=!![];_0x2b1fb4[_0x46e0('0x58')][_0x46e0('0x5d')]=moment()[_0x46e0('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b1fb4['body']['UserId']=_0x2b1fb4['body'][_0x46e0('0x5f')]||_0x2b1fb4[_0x46e0('0x60')]['id'];_0x2da509[_0x46e0('0x61')]['id']=_0x2b1fb4[_0x46e0('0x58')][_0x46e0('0x5f')];return db[_0x46e0('0x3c')][_0x46e0('0x56')]({'where':{'id':_0x2b1fb4[_0x46e0('0x54')]['id'],'UserId':null}})[_0x46e0('0x1f')](handleEntityNotFound(_0x5d46c0,null))['then'](saveUpdates(_0x2b1fb4[_0x46e0('0x58')],null))[_0x46e0('0x1f')](function(_0x52dbf0){if(_0x52dbf0){_0x2da509['message']=_0x52dbf0[_0x46e0('0x62')]({'plain':!![]});return db[_0x46e0('0x63')][_0x46e0('0x56')]({'where':{'id':_0x52dbf0['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5d46c0,null))['then'](function(_0x48430d){if(_0x48430d){return _0x48430d['update']({'UserId':_0x2b1fb4[_0x46e0('0x58')][_0x46e0('0x5f')],'read1stAt':_[_0x46e0('0x64')](_0x48430d[_0x46e0('0x65')])?moment()[_0x46e0('0x5e')](_0x46e0('0x66')):undefined});}return null;})[_0x46e0('0x1f')](function(_0x6fc521){if(_0x6fc521){_0x2da509[_0x46e0('0x67')]=_0x6fc521[_0x46e0('0x62')]({'plain':!![]});interaction_log[_0x46e0('0x20')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b1fb4[_0x46e0('0x60')]['id'],_0x2b1fb4[_0x46e0('0x60')][_0x46e0('0x39')],_0x2b1fb4[_0x46e0('0x60')][_0x46e0('0x68')],_0x2da509[_0x46e0('0x67')]['id'],_0x2b1fb4[_0x46e0('0x58')]?JSON[_0x46e0('0x69')](_0x2b1fb4[_0x46e0('0x58')]):_0x46e0('0x6a'));return respondWithRpcPromise(_0x46e0('0x6b'),'acceptMessage',_0x2da509);}return null;})[_0x46e0('0x1f')](function(_0x15f01b){var _0x2be3b3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x15f01b[_0x46e0('0x27')][_0x46e0('0x6c')];return db[_0x46e0('0x6d')][_0x46e0('0x40')](_0x2be3b3,{'type':db[_0x46e0('0x6e')][_0x46e0('0x6f')][_0x46e0('0x70')],'raw':!![]})[_0x46e0('0x1f')](function(_0xa59db0){return _0xa59db0;});})['then'](function(_0x2bbd1a){if(_0x2bbd1a){_0x2da509['message'][_0x46e0('0x71')]=_0x2bbd1a[0x0];if(!_0x2b1fb4[_0x46e0('0x58')][_0x46e0('0x5f')])return;return db['User']['find']({'where':{'id':_0x2b1fb4[_0x46e0('0x58')]['UserId'],'role':_0x46e0('0x61')},'attributes':['id',_0x46e0('0x39'),'fullname',_0x46e0('0x72'),_0x46e0('0x73')],'raw':!![]});}return null;})[_0x46e0('0x1f')](function(_0x514433){if(!_0x514433)return null;_0x2da509[_0x46e0('0x27')][_0x46e0('0x61')]=_0x514433;return _0x2da509;})[_0x46e0('0x1f')](function(_0x5c8059){if(_0x5c8059){if(_0x2b1fb4[_0x46e0('0x58')]['manual']){_0x2da509[_0x46e0('0x27')][_0x46e0('0x74')]=util[_0x46e0('0x5e')](_0x46e0('0x75'),_0x2b1fb4[_0x46e0('0x60')][_0x46e0('0x39')]);_0x2da509[_0x46e0('0x27')][_0x46e0('0x76')]=_0x2da509[_0x46e0('0x76')];_0x2da509[_0x46e0('0x27')][_0x46e0('0x77')]=_0x2da509[_0x46e0('0x76')];_0x2da509['message'][_0x46e0('0x78')]=_0x46e0('0x5b');return respondWithRpcPromise(_0x46e0('0x79'),'EventManager',{'event':_0x46e0('0x7a'),'message':_0x2da509[_0x46e0('0x27')]},client9002)[_0x46e0('0x1f')](function(){return _0x2da509;});}return _0x2da509;}return null;})[_0x46e0('0x1f')](respondWithResult(_0x5d46c0,null))[_0x46e0('0x29')](handleError(_0x5d46c0,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x46e0('0x34')]=function(_0x233a30,_0x2611e3,_0x1495c0){var _0x28500f={'agent':{},'channel':'openchannel'};if(_0x233a30[_0x46e0('0x58')]['id']){delete _0x233a30['body']['id'];}_0x233a30[_0x46e0('0x58')][_0x46e0('0x5f')]=_0x233a30[_0x46e0('0x58')]['UserId']||_0x233a30[_0x46e0('0x60')]['id'];_0x28500f[_0x46e0('0x61')]['id']=_0x233a30[_0x46e0('0x58')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x233a30[_0x46e0('0x54')]['id'],'UserId':null}})[_0x46e0('0x1f')](handleEntityNotFound(_0x2611e3,null))['then'](function(_0x2c9ebb){if(_0x2c9ebb){_0x28500f['message']=_0x2c9ebb[_0x46e0('0x62')]({'plain':!![]});return db[_0x46e0('0x63')][_0x46e0('0x56')]({'where':{'id':_0x2c9ebb[_0x46e0('0x7b')]}});}return null;})[_0x46e0('0x1f')](handleEntityNotFound(_0x2611e3,null))[_0x46e0('0x1f')](function(_0x41a776){if(_0x41a776){_0x28500f[_0x46e0('0x67')]=_0x41a776['get']({'plain':!![]});interaction_log['info'](_0x46e0('0x7c'),_0x233a30['user']['id'],_0x233a30[_0x46e0('0x60')][_0x46e0('0x39')],_0x233a30[_0x46e0('0x60')][_0x46e0('0x68')],_0x28500f[_0x46e0('0x67')]['id'],_0x233a30['body']?JSON['stringify'](_0x233a30[_0x46e0('0x58')]):_0x46e0('0x6a'));return respondWithRpcPromise('RejectMessage',_0x46e0('0x7d'),_0x28500f);}return null;})[_0x46e0('0x1f')](function(_0x55a5bf){var _0x35b1cf='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55a5bf['message'][_0x46e0('0x6c')];return db[_0x46e0('0x6d')][_0x46e0('0x40')](_0x35b1cf,{'type':db['Sequelize'][_0x46e0('0x6f')]['SELECT'],'raw':!![]})[_0x46e0('0x1f')](function(_0x3fb55f){return _0x3fb55f;});})[_0x46e0('0x1f')](function(_0x36ee3f){if(_0x36ee3f){_0x28500f[_0x46e0('0x27')]['contact']=_0x36ee3f[0x0];if(!_0x233a30['body'][_0x46e0('0x5f')])return;return db[_0x46e0('0x7e')]['find']({'where':{'id':_0x233a30[_0x46e0('0x58')][_0x46e0('0x5f')],'role':'agent'},'attributes':['id',_0x46e0('0x39'),_0x46e0('0x7f'),_0x46e0('0x72'),'internal'],'raw':!![]});}return null;})[_0x46e0('0x1f')](function(_0x54e656){if(!_0x54e656)return null;_0x28500f['message'][_0x46e0('0x61')]=_0x54e656;return _0x28500f;})['then'](function(_0xf3deda){if(_0xf3deda){_0xf3deda[_0x46e0('0x27')][_0x46e0('0x74')]=util['format'](_0x46e0('0x75'),_0x233a30[_0x46e0('0x60')][_0x46e0('0x39')]);_0xf3deda[_0x46e0('0x27')][_0x46e0('0x76')]=_0x28500f[_0x46e0('0x76')];_0xf3deda['message'][_0x46e0('0x77')]=_0x28500f[_0x46e0('0x76')];_0xf3deda[_0x46e0('0x27')]['event']=_0x46e0('0x34');respondWithRpcPromise(_0x46e0('0x79'),_0x46e0('0x79'),{'event':'rejectmessage','message':_0xf3deda['message']},client9002);return _0x28500f;}return null;})[_0x46e0('0x1f')](respondWithResult(_0x2611e3,null))['catch'](handleError(_0x2611e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9a9a516..47bfe31 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 _0xae04=['remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xae04,0x1ed));var _0x4ae0=function(_0x1352f0,_0x4cd565){_0x1352f0=_0x1352f0-0x0;var _0x1c2a82=_0xae04[_0x1352f0];return _0x1c2a82;};'use strict';var EventEmitter=require(_0x4ae0('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4ae0('0x1')](0x0);var events={'afterCreate':_0x4ae0('0x2'),'afterUpdate':'update','afterDestroy':_0x4ae0('0x3')};function emitEvent(_0x14fea0){return function(_0x56c506,_0x26b244,_0x37ff0b){OpenchannelMessageEvents[_0x4ae0('0x4')](_0x14fea0+':'+_0x56c506['id'],_0x56c506);OpenchannelMessageEvents[_0x4ae0('0x4')](_0x14fea0,_0x56c506);_0x37ff0b(null);};}for(var e in events){if(events[_0x4ae0('0x5')](e)){var event=events[e];OpenchannelMessage[_0x4ae0('0x6')](e,emitEvent(event));}}module[_0x4ae0('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1885=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x1885,0x15d));var _0x5188=function(_0x3e3edf,_0x146094){_0x3e3edf=_0x3e3edf-0x0;var _0x10dc2a=_0x1885[_0x3e3edf];return _0x10dc2a;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x5188('0x0'))['db'][_0x5188('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5188('0x2')](0x0);var events={'afterCreate':_0x5188('0x3'),'afterUpdate':_0x5188('0x4'),'afterDestroy':_0x5188('0x5')};function emitEvent(_0x67b0ac){return function(_0x5db661,_0x10f72f,_0x46527f){OpenchannelMessageEvents[_0x5188('0x6')](_0x67b0ac+':'+_0x5db661['id'],_0x5db661);OpenchannelMessageEvents['emit'](_0x67b0ac,_0x5db661);_0x46527f(null);};}for(var e in events){if(events[_0x5188('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5188('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index fb8b405..0aada0e 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 _0x4e70=['CmContact','describe','find','OpenchannelAccountId','Interactions','Contact','keys','then','get','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','POST','method','GET','body','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','define','OpenchannelMessage','FULLTEXT','models','direction','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','toLowerCase','catch','error'];(function(_0x17711e,_0x3714e5){var _0x343dce=function(_0x2782e0){while(--_0x2782e0){_0x17711e['push'](_0x17711e['shift']());}};_0x343dce(++_0x3714e5);}(_0x4e70,0x1ef));var _0x04e7=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4e70[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x04e7('0x0'));var util=require(_0x04e7('0x1'));var logger=require(_0x04e7('0x2'))(_0x04e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x04e7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04e7('0x5'));var config=require(_0x04e7('0x6'));var attributes=require('./openchannelMessage.attributes');module['exports']=function(_0x285029,_0x5724f8){return _0x285029[_0x04e7('0x7')](_0x04e7('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x04e7('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4607d4,_0x287f9f,_0x22f864){var _0x4faa84=_0x285029[_0x04e7('0xa')];var _0x47b04e=_0x4607d4['get']({'plain':!![]});if(_0x47b04e[_0x04e7('0xb')]['toLowerCase']()==='in'||_0x47b04e['direction']['toLowerCase']()==='out'&&!_0x47b04e[_0x04e7('0xc')]&&!_['isNil'](_0x47b04e[_0x04e7('0xd')])){_0x4faa84[_0x04e7('0xe')][_0x04e7('0xf')]({'where':{'id':_0x47b04e[_0x04e7('0x10')]}})['then'](function(_0x339fbb){if(_0x339fbb){_0x339fbb[_0x04e7('0x11')]({'lastMsgAt':_0x47b04e[_0x04e7('0x12')],'lastMsgDirection':_0x47b04e[_0x04e7('0xb')][_0x04e7('0x13')]()});}})[_0x04e7('0x14')](function(_0x395706){console[_0x04e7('0x15')](_0x395706);});}if(_0x47b04e[_0x04e7('0xb')]==='out'&&!_0x47b04e[_0x04e7('0xc')]){var _0x33ab8e;_0x4faa84[_0x04e7('0x16')][_0x04e7('0x17')]()['then'](function(_0x1eb921){return _0x4faa84['OpenchannelAccount'][_0x04e7('0x18')]({'where':{'id':_0x47b04e[_0x04e7('0x19')]},'include':[{'model':_0x4faa84[_0x04e7('0xe')],'as':_0x04e7('0x1a'),'where':{'id':_0x47b04e[_0x04e7('0x10')]},'limit':0x1,'include':[{'model':_0x4faa84[_0x04e7('0x16')],'as':_0x04e7('0x1b'),'attributes':_[_0x04e7('0x1c')](_0x1eb921)}]}]});})[_0x04e7('0x1d')](function(_0x935aca){_0x33ab8e=_0x935aca[_0x04e7('0x1e')]({'plain':!![]});if(_0x33ab8e&&_0x33ab8e[_0x04e7('0x1f')]){logger[_0x04e7('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x04e7('0x21'),util[_0x04e7('0x22')](_0x04e7('0x23'),_0x47b04e['id'],_0x33ab8e['replyUri']));if(_0x33ab8e[_0x04e7('0x1a')]&&_0x33ab8e['Interactions'][_0x04e7('0x24')]){_0x47b04e[_0x04e7('0x25')]=_['omit'](_0x33ab8e[_0x04e7('0x1a')][0x0],_0x04e7('0x1b'));_0x47b04e[_0x04e7('0x1b')]=_0x33ab8e[_0x04e7('0x1a')][0x0]['Contact'];}var _0x287f9f={'method':_0x04e7('0x26'),'uri':encodeURI(_0x33ab8e[_0x04e7('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x287f9f[_0x04e7('0x27')]){case _0x04e7('0x28'):_0x287f9f['qs']=_0x47b04e;break;case _0x04e7('0x26'):_0x287f9f[_0x04e7('0x29')]=_0x47b04e;break;}return rp(_0x287f9f)['then'](function(_0x4582fa){logger[_0x04e7('0x20')](_0x04e7('0x2a'),_0x04e7('0x21'),util['format'](_0x04e7('0x2b'),_0x47b04e['id'],_0x33ab8e[_0x04e7('0x1f')]));if(_0x4582fa[_0x04e7('0x29')]['threadId']&&_0x4582fa[_0x04e7('0x29')]['threadId']!=_0x47b04e[_0x04e7('0x25')]['threadId']){return _0x4faa84[_0x04e7('0xe')][_0x04e7('0x11')]({'threadId':_0x4582fa[_0x04e7('0x29')][_0x04e7('0x2c')]},{'where':{'id':_0x47b04e[_0x04e7('0x25')]['id']}});}else{return;}})[_0x04e7('0x1d')](function(){return _0x4607d4[_0x04e7('0x11')]({'read':!![]});})[_0x04e7('0x14')](function(_0x555d31){logger[_0x04e7('0x15')](_0x04e7('0x2a'),_0x04e7('0x21'),util[_0x04e7('0x2d')](_0x555d31,{'showHidden':![],'depth':null}));_0x22f864();});}else{_0x22f864();}})['finally'](function(){_0x22f864();});}else{_0x22f864();}}},'charset':'utf8mb4','collate':_0x04e7('0x2e')});}; \ No newline at end of file +var _0x45ae=['toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','catch','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','fti_openchannel_messages','body','models','get','direction'];(function(_0xfd700f,_0xa53af5){var _0x42344e=function(_0x3c30c6){while(--_0x3c30c6){_0xfd700f['push'](_0xfd700f['shift']());}};_0x42344e(++_0xa53af5);}(_0x45ae,0x1eb));var _0xe45a=function(_0x204047,_0x11bc27){_0x204047=_0x204047-0x0;var _0x3408f5=_0x45ae[_0x204047];return _0x3408f5;};'use strict';var _=require('lodash');var util=require(_0xe45a('0x0'));var logger=require(_0xe45a('0x1'))(_0xe45a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe45a('0x3'));var fs=require('fs');var path=require(_0xe45a('0x4'));var rimraf=require(_0xe45a('0x5'));var config=require(_0xe45a('0x6'));var attributes=require(_0xe45a('0x7'));module[_0xe45a('0x8')]=function(_0x4d70c8,_0x2b5d7e){return _0x4d70c8['define']('OpenchannelMessage',attributes,{'tableName':_0xe45a('0x9'),'paranoid':![],'indexes':[{'name':_0xe45a('0xa'),'fields':[_0xe45a('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b91bd,_0x2df66a,_0x2c408b){var _0x35ef7a=_0x4d70c8[_0xe45a('0xc')];var _0x4d4621=_0x4b91bd[_0xe45a('0xd')]({'plain':!![]});if(_0x4d4621[_0xe45a('0xe')][_0xe45a('0xf')]()==='in'||_0x4d4621[_0xe45a('0xe')][_0xe45a('0xf')]()===_0xe45a('0x10')&&!_0x4d4621[_0xe45a('0x11')]&&!_[_0xe45a('0x12')](_0x4d4621[_0xe45a('0x13')])){_0x35ef7a[_0xe45a('0x14')]['findOne']({'where':{'id':_0x4d4621[_0xe45a('0x15')]}})[_0xe45a('0x16')](function(_0x2bf712){if(_0x2bf712){_0x2bf712[_0xe45a('0x17')]({'lastMsgAt':_0x4d4621['createdAt'],'lastMsgDirection':_0x4d4621[_0xe45a('0xe')][_0xe45a('0xf')]()});}})[_0xe45a('0x18')](function(_0x138eb8){console['error'](_0x138eb8);});}if(_0x4d4621[_0xe45a('0xe')]===_0xe45a('0x10')&&!_0x4d4621[_0xe45a('0x11')]){var _0x51ff62;_0x35ef7a['CmContact'][_0xe45a('0x19')]()[_0xe45a('0x16')](function(_0x2f6fc3){return _0x35ef7a[_0xe45a('0x1a')]['find']({'where':{'id':_0x4d4621[_0xe45a('0x1b')]},'include':[{'model':_0x35ef7a['OpenchannelInteraction'],'as':_0xe45a('0x1c'),'where':{'id':_0x4d4621[_0xe45a('0x15')]},'limit':0x1,'include':[{'model':_0x35ef7a[_0xe45a('0x1d')],'as':_0xe45a('0x1e'),'attributes':_[_0xe45a('0x1f')](_0x2f6fc3)}]}]});})[_0xe45a('0x16')](function(_0xb0360a){_0x51ff62=_0xb0360a['get']({'plain':!![]});if(_0x51ff62&&_0x51ff62[_0xe45a('0x20')]){logger['info'](_0xe45a('0x21'),_0xe45a('0x22'),util[_0xe45a('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x4d4621['id'],_0x51ff62[_0xe45a('0x20')]));if(_0x51ff62[_0xe45a('0x1c')]&&_0x51ff62[_0xe45a('0x1c')][_0xe45a('0x24')]){_0x4d4621[_0xe45a('0x25')]=_['omit'](_0x51ff62['Interactions'][0x0],_0xe45a('0x1e'));_0x4d4621[_0xe45a('0x1e')]=_0x51ff62['Interactions'][0x0][_0xe45a('0x1e')];}var _0x2df66a={'method':_0xe45a('0x26'),'uri':encodeURI(_0x51ff62[_0xe45a('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2df66a[_0xe45a('0x27')]){case _0xe45a('0x28'):_0x2df66a['qs']=_0x4d4621;break;case _0xe45a('0x26'):_0x2df66a[_0xe45a('0xb')]=_0x4d4621;break;}return rp(_0x2df66a)['then'](function(_0x4aef71){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xe45a('0x22'),util[_0xe45a('0x23')](_0xe45a('0x29'),_0x4d4621['id'],_0x51ff62[_0xe45a('0x20')]));if(_0x4aef71['body'][_0xe45a('0x2a')]&&_0x4aef71[_0xe45a('0xb')][_0xe45a('0x2a')]!=_0x4d4621[_0xe45a('0x25')][_0xe45a('0x2a')]){return _0x35ef7a['OpenchannelInteraction'][_0xe45a('0x17')]({'threadId':_0x4aef71[_0xe45a('0xb')][_0xe45a('0x2a')]},{'where':{'id':_0x4d4621['Interaction']['id']}});}else{return;}})['then'](function(){return _0x4b91bd[_0xe45a('0x17')]({'read':!![]});})[_0xe45a('0x18')](function(_0x2724b7){logger[_0xe45a('0x2b')](_0xe45a('0x21'),_0xe45a('0x22'),util[_0xe45a('0x2c')](_0x2724b7,{'showHidden':![],'depth':null}));_0x2c408b();});}else{_0x2c408b();}})['finally'](function(){_0x2c408b();});}else{_0x2c408b();}}},'charset':'utf8mb4','collate':_0xe45a('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index cb6da4c..80b5b92 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0xb48d19,_0x133b22){var _0x313a3b=function(_0x5b719e){while(--_0x5b719e){_0xb48d19['push'](_0xb48d19['shift']());}};_0x313a3b(++_0x133b22);}(_0x7a54,0x106));var _0x47a5=function(_0x15efb0,_0x319413){_0x15efb0=_0x15efb0-0x0;var _0x723ed3=_0x7a54[_0x15efb0];return _0x723ed3;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +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(_0x5aa00e,_0x99cd93){var _0xf69379=function(_0x3a5fbf){while(--_0x3a5fbf){_0x5aa00e['push'](_0x5aa00e['shift']());}};_0xf69379(++_0x99cd93);}(_0xadb5,0xad));var _0x5adb=function(_0x196040,_0x2429a3){_0x196040=_0x196040-0x0;var _0x13a713=_0xadb5[_0x196040];return _0x13a713;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b3fb5f9..9840c12 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 _0xca61=['length','openchannelMessage:','./openchannelMessage.events','save','update','removeListener'];(function(_0x5363e8,_0xff636f){var _0x8a27ca=function(_0x1b16a1){while(--_0x1b16a1){_0x5363e8['push'](_0x5363e8['shift']());}};_0x8a27ca(++_0xff636f);}(_0xca61,0x1be));var _0x1ca6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca61[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x1ca6('0x0'));var events=[_0x1ca6('0x1'),'remove',_0x1ca6('0x2')];function createListener(_0x38d7c5,_0x3431d6){return function(_0x572733){_0x3431d6['emit'](_0x38d7c5,_0x572733);};}function removeListener(_0x493546,_0x2696f9){return function(){OpenchannelMessageEvents[_0x1ca6('0x3')](_0x493546,_0x2696f9);};}exports['register']=function(_0x413df0){for(var _0x24b955=0x0,_0x5875bd=events[_0x1ca6('0x4')];_0x24b955<_0x5875bd;_0x24b955++){var _0x7c7bea=events[_0x24b955];var _0x472c3d=createListener(_0x1ca6('0x5')+_0x7c7bea,_0x413df0);OpenchannelMessageEvents['on'](_0x7c7bea,_0x472c3d);}}; \ No newline at end of file +var _0x0e26=['removeListener','length','openchannelMessage:','save','remove','emit'];(function(_0x55d7c2,_0x4ce6fb){var _0x1755ef=function(_0xddc25c){while(--_0xddc25c){_0x55d7c2['push'](_0x55d7c2['shift']());}};_0x1755ef(++_0x4ce6fb);}(_0x0e26,0x19b));var _0x60e2=function(_0x4496ae,_0x2e1282){_0x4496ae=_0x4496ae-0x0;var _0x3defd9=_0x0e26[_0x4496ae];return _0x3defd9;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x60e2('0x0'),_0x60e2('0x1'),'update'];function createListener(_0x10e9b3,_0x2eb9c3){return function(_0x2cca54){_0x2eb9c3[_0x60e2('0x2')](_0x10e9b3,_0x2cca54);};}function removeListener(_0x431bba,_0x2c63c0){return function(){OpenchannelMessageEvents[_0x60e2('0x3')](_0x431bba,_0x2c63c0);};}exports['register']=function(_0x3fc7fb){for(var _0x35393b=0x0,_0x36e315=events[_0x60e2('0x4')];_0x35393b<_0x36e315;_0x35393b++){var _0x110845=events[_0x35393b];var _0x2e1583=createListener(_0x60e2('0x5')+_0x110845,_0x3fc7fb);OpenchannelMessageEvents['on'](_0x110845,_0x2e1583);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 1add7aa..4bfb095 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 _0xfeff=['put','update','destroy','removeTeams','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfeff,0x1a5));var _0xffef=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xfeff[_0x5cb1af];return _0x8d7940;};'use strict';var multer=require(_0xffef('0x0'));var util=require(_0xffef('0x1'));var path=require(_0xffef('0x2'));var timeout=require(_0xffef('0x3'));var express=require(_0xffef('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xffef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xffef('0x6'));var controller=require(_0xffef('0x7'));router[_0xffef('0x8')]('/',auth[_0xffef('0x9')](),controller['index']);router[_0xffef('0x8')](_0xffef('0xa'),auth[_0xffef('0x9')](),controller[_0xffef('0xb')]);router[_0xffef('0x8')](_0xffef('0xc'),auth[_0xffef('0x9')](),controller[_0xffef('0xd')]);router['get']('/:id/members',auth[_0xffef('0x9')](),controller['getMembers']);router[_0xffef('0x8')](_0xffef('0xe'),auth[_0xffef('0x9')](),controller[_0xffef('0xf')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xffef('0x10')]);router[_0xffef('0x11')]('/',auth[_0xffef('0x9')](),controller['create']);router[_0xffef('0x11')](_0xffef('0xe'),auth[_0xffef('0x9')](),controller[_0xffef('0x12')]);router['post'](_0xffef('0x13'),auth[_0xffef('0x9')](),controller[_0xffef('0x14')]);router[_0xffef('0x15')](_0xffef('0xc'),auth[_0xffef('0x9')](),controller[_0xffef('0x16')]);router['delete'](_0xffef('0xc'),auth['isAuthenticated'](),controller[_0xffef('0x17')]);router['delete'](_0xffef('0xe'),auth[_0xffef('0x9')](),controller[_0xffef('0x18')]);router[_0xffef('0x19')]('/:id/users',auth[_0xffef('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2902=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','delete','removeAgents'];(function(_0x3783ca,_0x4969fd){var _0x5f455e=function(_0x1670c6){while(--_0x1670c6){_0x3783ca['push'](_0x3783ca['shift']());}};_0x5f455e(++_0x4969fd);}(_0x2902,0xa3));var _0x2290=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x2902[_0x33c603];return _0xae96f4;};'use strict';var multer=require(_0x2290('0x0'));var util=require(_0x2290('0x1'));var path=require(_0x2290('0x2'));var timeout=require(_0x2290('0x3'));var express=require(_0x2290('0x4'));var router=express[_0x2290('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2290('0x6'));var interaction=require(_0x2290('0x7'));var config=require(_0x2290('0x8'));var controller=require(_0x2290('0x9'));router[_0x2290('0xa')]('/',auth[_0x2290('0xb')](),controller[_0x2290('0xc')]);router[_0x2290('0xa')](_0x2290('0xd'),auth[_0x2290('0xb')](),controller['describe']);router[_0x2290('0xa')](_0x2290('0xe'),auth[_0x2290('0xb')](),controller['show']);router[_0x2290('0xa')](_0x2290('0xf'),auth[_0x2290('0xb')](),controller[_0x2290('0x10')]);router[_0x2290('0xa')](_0x2290('0x11'),auth[_0x2290('0xb')](),controller[_0x2290('0x12')]);router[_0x2290('0xa')](_0x2290('0x13'),auth[_0x2290('0xb')](),controller['getAgents']);router[_0x2290('0x14')]('/',auth[_0x2290('0xb')](),controller[_0x2290('0x15')]);router[_0x2290('0x14')](_0x2290('0x11'),auth[_0x2290('0xb')](),controller[_0x2290('0x16')]);router[_0x2290('0x14')](_0x2290('0x13'),auth[_0x2290('0xb')](),controller[_0x2290('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x2290('0x18')](_0x2290('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x2290('0x18')]('/:id/teams',auth[_0x2290('0xb')](),controller['removeTeams']);router[_0x2290('0x18')](_0x2290('0x13'),auth[_0x2290('0xb')](),controller[_0x2290('0x19')]);module[_0x2290('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 3a52c44..808d334 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 _0x1797=['name','INTEGER','rrmemory','roundrobin','sequelize','STRING'];(function(_0x2f6634,_0x3f1f3f){var _0x3e2f57=function(_0xbe950b){while(--_0xbe950b){_0x2f6634['push'](_0x2f6634['shift']());}};_0x3e2f57(++_0x3f1f3f);}(_0x1797,0x130));var _0x7179=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x1797[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x7179('0x0'));module['exports']={'name':{'type':Sequelize[_0x7179('0x1')],'unique':_0x7179('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7179('0x1')]},'timeout':{'type':Sequelize[_0x7179('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x7179('0x4'),'beepall',_0x7179('0x5'))}}; \ No newline at end of file +var _0x66e7=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x45aeff,_0x4609d2){var _0x2ffc3c=function(_0x3a41ea){while(--_0x3a41ea){_0x45aeff['push'](_0x45aeff['shift']());}};_0x2ffc3c(++_0x4609d2);}(_0x66e7,0x90));var _0x766e=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x66e7[_0x2b91c5];return _0xbd5531;};'use strict';var Sequelize=require('sequelize');module[_0x766e('0x0')]={'name':{'type':Sequelize[_0x766e('0x1')],'unique':_0x766e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x766e('0x1')]},'timeout':{'type':Sequelize[_0x766e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x766e('0x4')](_0x766e('0x5'),_0x766e('0x6'),_0x766e('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 01068f3..84e3833 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 _0x93ec=['union','value','isEmpty','forEach','emit','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','UserOpenchannelQueue','pick','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','addTeams','ids','Team','online','voicePause','Agents','sequelize','transaction','each','findOrCreate','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x93ec,0x12a));var _0xc93e=function(_0x298e73,_0x4a537c){_0x298e73=_0x298e73-0x0;var _0x5391d8=_0x93ec[_0x298e73];return _0x5391d8;};'use strict';var emlformat=require(_0xc93e('0x0'));var rimraf=require(_0xc93e('0x1'));var zipdir=require(_0xc93e('0x2'));var jsonpatch=require(_0xc93e('0x3'));var rp=require(_0xc93e('0x4'));var moment=require(_0xc93e('0x5'));var BPromise=require(_0xc93e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc93e('0x7'));var sox=require('sox');var csv=require(_0xc93e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93e('0x9'));var _=require(_0xc93e('0xa'));var squel=require(_0xc93e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc93e('0xc'));var deskjs=require(_0xc93e('0xd'));var toCsv=require(_0xc93e('0x8'));var querystring=require(_0xc93e('0xe'));var Papa=require(_0xc93e('0xf'));var Redis=require(_0xc93e('0x10'));var authService=require(_0xc93e('0x11'));var qs=require(_0xc93e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc93e('0x13'));var logger=require(_0xc93e('0x14'))(_0xc93e('0x15'));var utils=require(_0xc93e('0x16'));var config=require(_0xc93e('0x17'));var licenseUtil=require(_0xc93e('0x18'));var db=require(_0xc93e('0x19'))['db'];config[_0xc93e('0x1a')]=_['defaults'](config[_0xc93e('0x1a')],{'host':_0xc93e('0x1b'),'port':0x18eb});var socket=require(_0xc93e('0x1c'))(new Redis(config['redis']));require(_0xc93e('0x1d'))[_0xc93e('0x1e')](socket);function respondWithStatusCode(_0x482f2b,_0xa4c5b8){_0xa4c5b8=_0xa4c5b8||0xcc;return function(_0x216f3f){if(_0x216f3f){return _0x482f2b[_0xc93e('0x1f')](_0xa4c5b8);}return _0x482f2b[_0xc93e('0x20')](_0xa4c5b8)[_0xc93e('0x21')]();};}function respondWithResult(_0xe2a5ee,_0x2ba092){_0x2ba092=_0x2ba092||0xc8;return function(_0x4285b1){if(_0x4285b1){return _0xe2a5ee[_0xc93e('0x20')](_0x2ba092)['json'](_0x4285b1);}};}function respondWithFilteredResult(_0x332e7d,_0x346a09){return function(_0x412fe3){if(_0x412fe3){var _0x23b817=typeof _0x346a09[_0xc93e('0x22')]===_0xc93e('0x23')&&typeof _0x346a09[_0xc93e('0x24')]==='undefined';var _0x44dd51=_0x412fe3[_0xc93e('0x25')];var _0x450848=_0x23b817?0x0:_0x346a09[_0xc93e('0x22')];var _0x3564ea=_0x23b817?_0x412fe3[_0xc93e('0x25')]:_0x346a09[_0xc93e('0x22')]+_0x346a09[_0xc93e('0x24')];var _0x38eb57;if(_0x3564ea>=_0x44dd51){_0x3564ea=_0x44dd51;_0x38eb57=0xc8;}else{_0x38eb57=0xce;}_0x332e7d[_0xc93e('0x20')](_0x38eb57);return _0x332e7d[_0xc93e('0x26')](_0xc93e('0x27'),_0x450848+'-'+_0x3564ea+'/'+_0x44dd51)['json'](_0x412fe3);}return null;};}function patchUpdates(_0x29d039){return function(_0x5bf9f8){try{jsonpatch[_0xc93e('0x28')](_0x5bf9f8,_0x29d039,!![]);}catch(_0x462317){return BPromise[_0xc93e('0x29')](_0x462317);}return _0x5bf9f8[_0xc93e('0x2a')]();};}function saveUpdates(_0x391089,_0x1d615d){return function(_0x39135a){if(_0x39135a){return _0x39135a[_0xc93e('0x2b')](_0x391089)[_0xc93e('0x2c')](function(_0x2e3899){return _0x2e3899;});}return null;};}function removeEntity(_0x31574a,_0x4cdfb4){return function(_0x25494f){if(_0x25494f){return _0x25494f[_0xc93e('0x2d')]()[_0xc93e('0x2c')](function(){var _0x183b85=_0x25494f[_0xc93e('0x2e')]({'plain':!![]});var _0x2c9683=_0xc93e('0x2f');return db[_0xc93e('0x30')][_0xc93e('0x2d')]({'where':{'type':_0x2c9683,'resourceId':_0x183b85['id']}})[_0xc93e('0x2c')](function(){return _0x25494f;});})[_0xc93e('0x2c')](function(){_0x31574a[_0xc93e('0x20')](0xcc)[_0xc93e('0x21')]();});}};}function handleEntityNotFound(_0x36ff18,_0x52324d){return function(_0x1b20ef){if(!_0x1b20ef){_0x36ff18['sendStatus'](0x194);}return _0x1b20ef;};}function handleError(_0xca7d4c,_0x4526d4){_0x4526d4=_0x4526d4||0x1f4;return function(_0x43b523){logger[_0xc93e('0x31')](_0x43b523[_0xc93e('0x32')]);if(_0x43b523[_0xc93e('0x33')]){delete _0x43b523[_0xc93e('0x33')];}_0xca7d4c['status'](_0x4526d4)[_0xc93e('0x34')](_0x43b523);};}exports['index']=function(_0xa23b6b,_0x32baa9){var _0x179607={},_0x11180e={},_0x53825f={'count':0x0,'rows':[]};var _0xc4880f=_[_0xc93e('0x35')](db[_0xc93e('0x36')][_0xc93e('0x37')],function(_0x2dea1a){return{'name':_0x2dea1a[_0xc93e('0x38')],'type':_0x2dea1a[_0xc93e('0x39')][_0xc93e('0x3a')]};});_0x11180e[_0xc93e('0x3b')]=_[_0xc93e('0x35')](_0xc4880f,_0xc93e('0x33'));_0x11180e[_0xc93e('0x3c')]=_[_0xc93e('0x3d')](_0xa23b6b[_0xc93e('0x3c')]);_0x11180e[_0xc93e('0x3e')]=_['intersection'](_0x11180e[_0xc93e('0x3b')],_0x11180e['query']);_0x179607['attributes']=_[_0xc93e('0x3f')](_0x11180e[_0xc93e('0x3b')],qs['fields'](_0xa23b6b['query'][_0xc93e('0x40')]));_0x179607['attributes']=_0x179607[_0xc93e('0x41')][_0xc93e('0x42')]?_0x179607[_0xc93e('0x41')]:_0x11180e[_0xc93e('0x3b')];if(!_0xa23b6b[_0xc93e('0x3c')][_0xc93e('0x43')](_0xc93e('0x44'))){_0x179607[_0xc93e('0x24')]=qs[_0xc93e('0x24')](_0xa23b6b[_0xc93e('0x3c')][_0xc93e('0x24')]);_0x179607[_0xc93e('0x22')]=qs[_0xc93e('0x22')](_0xa23b6b['query'][_0xc93e('0x22')]);}_0x179607[_0xc93e('0x45')]=qs[_0xc93e('0x46')](_0xa23b6b[_0xc93e('0x3c')][_0xc93e('0x46')]);_0x179607[_0xc93e('0x47')]=qs[_0xc93e('0x3e')](_['pick'](_0xa23b6b[_0xc93e('0x3c')],_0x11180e[_0xc93e('0x3e')]),_0xc4880f);if(_0xa23b6b[_0xc93e('0x3c')][_0xc93e('0x48')]){_0x179607[_0xc93e('0x47')]=_[_0xc93e('0x49')](_0x179607[_0xc93e('0x47')],{'$or':_[_0xc93e('0x35')](_0xc4880f,function(_0x127c57){if(_0x127c57[_0xc93e('0x39')]!==_0xc93e('0x4a')){var _0x1fcd98={};_0x1fcd98[_0x127c57['name']]={'$like':'%'+_0xa23b6b['query'][_0xc93e('0x48')]+'%'};return _0x1fcd98;}})});}_0x179607=_[_0xc93e('0x49')]({},_0x179607,_0xa23b6b[_0xc93e('0x4b')]);var _0x1cbfb0={'where':_0x179607[_0xc93e('0x47')]};return db['OpenchannelQueue'][_0xc93e('0x25')](_0x1cbfb0)[_0xc93e('0x2c')](function(_0x322648){_0x53825f[_0xc93e('0x25')]=_0x322648;if(_0xa23b6b[_0xc93e('0x3c')][_0xc93e('0x4c')]){_0x179607[_0xc93e('0x4d')]=[{'all':!![]}];}return db[_0xc93e('0x36')][_0xc93e('0x4e')](_0x179607);})[_0xc93e('0x2c')](function(_0x96325d){_0x53825f[_0xc93e('0x4f')]=_0x96325d;return _0x53825f;})[_0xc93e('0x2c')](respondWithFilteredResult(_0x32baa9,_0x179607))[_0xc93e('0x50')](handleError(_0x32baa9,null));};exports[_0xc93e('0x51')]=function(_0x588478,_0x39313d){var _0x477624={'raw':!![],'where':{'id':_0x588478[_0xc93e('0x52')]['id']}},_0x4e393b={};_0x4e393b[_0xc93e('0x3b')]=_[_0xc93e('0x3d')](db[_0xc93e('0x36')][_0xc93e('0x37')]);_0x4e393b[_0xc93e('0x3c')]=_[_0xc93e('0x3d')](_0x588478[_0xc93e('0x3c')]);_0x4e393b[_0xc93e('0x3e')]=_[_0xc93e('0x3f')](_0x4e393b[_0xc93e('0x3b')],_0x4e393b[_0xc93e('0x3c')]);_0x477624[_0xc93e('0x41')]=_[_0xc93e('0x3f')](_0x4e393b[_0xc93e('0x3b')],qs[_0xc93e('0x40')](_0x588478['query']['fields']));_0x477624[_0xc93e('0x41')]=_0x477624[_0xc93e('0x41')]['length']?_0x477624['attributes']:_0x4e393b[_0xc93e('0x3b')];if(_0x588478[_0xc93e('0x3c')][_0xc93e('0x4c')]){_0x477624['include']=[{'all':!![]}];}_0x477624=_[_0xc93e('0x49')]({},_0x477624,_0x588478[_0xc93e('0x4b')]);return db[_0xc93e('0x36')][_0xc93e('0x53')](_0x477624)[_0xc93e('0x2c')](handleEntityNotFound(_0x39313d,null))['then'](respondWithResult(_0x39313d,null))[_0xc93e('0x50')](handleError(_0x39313d,null));};exports[_0xc93e('0x54')]=function(_0x412ff2,_0x2c715f){return db['OpenchannelQueue'][_0xc93e('0x54')](_0x412ff2['body'],{})[_0xc93e('0x2c')](function(_0x48547d){var _0xc29953=_0x412ff2[_0xc93e('0x55')][_0xc93e('0x2e')]({'plain':!![]});if(!_0xc29953)throw new Error(_0xc93e('0x56'));if(_0xc29953[_0xc93e('0x57')]===_0xc93e('0x55')){var _0x401114=_0x48547d['get']({'plain':!![]});var _0x595892=_0xc93e('0x2f');return db[_0xc93e('0x58')][_0xc93e('0x53')]({'where':{'name':_0x595892,'userProfileId':_0xc29953[_0xc93e('0x59')]},'raw':!![]})[_0xc93e('0x2c')](function(_0x57f5dc){if(_0x57f5dc&&_0x57f5dc[_0xc93e('0x5a')]===0x0){return db[_0xc93e('0x30')][_0xc93e('0x54')]({'name':_0x401114[_0xc93e('0x33')],'resourceId':_0x401114['id'],'type':_0x57f5dc[_0xc93e('0x33')],'sectionId':_0x57f5dc['id']},{})[_0xc93e('0x2c')](function(){return _0x48547d;});}else{return _0x48547d;}})[_0xc93e('0x50')](function(_0x3af66a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3af66a);throw _0x3af66a;});}return _0x48547d;})[_0xc93e('0x2c')](respondWithResult(_0x2c715f,0xc9))['catch'](handleError(_0x2c715f,null));};exports[_0xc93e('0x2b')]=function(_0x3083f1,_0x44e725){if(_0x3083f1[_0xc93e('0x5b')]['id']){delete _0x3083f1[_0xc93e('0x5b')]['id'];}return db[_0xc93e('0x36')][_0xc93e('0x53')]({'where':{'id':_0x3083f1[_0xc93e('0x52')]['id']}})['then'](handleEntityNotFound(_0x44e725,null))[_0xc93e('0x2c')](saveUpdates(_0x3083f1[_0xc93e('0x5b')],null))[_0xc93e('0x2c')](respondWithResult(_0x44e725,null))[_0xc93e('0x50')](handleError(_0x44e725,null));};exports[_0xc93e('0x2d')]=function(_0xa523d5,_0x3031a4){return db[_0xc93e('0x36')][_0xc93e('0x53')]({'where':{'id':_0xa523d5['params']['id']}})['then'](handleEntityNotFound(_0x3031a4,null))['then'](removeEntity(_0x3031a4,null))[_0xc93e('0x50')](handleError(_0x3031a4,null));};exports[_0xc93e('0x5c')]=function(_0x16d24c,_0x1031ba){return db[_0xc93e('0x36')]['describe']()[_0xc93e('0x2c')](respondWithResult(_0x1031ba,null))[_0xc93e('0x50')](handleError(_0x1031ba,null));};exports[_0xc93e('0x5d')]=function(_0x45ed9d,_0x1a31a1,_0x252e60){var _0x339fc2={'raw':!![],'where':{}},_0x57d70d={},_0x2a02cf;return db[_0xc93e('0x36')]['findOne']({'where':{'id':_0x45ed9d[_0xc93e('0x52')]['id']}})[_0xc93e('0x2c')](handleEntityNotFound(_0x1a31a1,null))['then'](function(_0x1310b5){if(_0x1310b5){_0x2a02cf=_0x1310b5[_0xc93e('0x2e')]({'plain':!![]});_0x57d70d[_0xc93e('0x3b')]=_['keys'](db[_0xc93e('0x5e')][_0xc93e('0x37')]);_0x57d70d[_0xc93e('0x3c')]=_[_0xc93e('0x3d')](_0x45ed9d['query']);_0x57d70d[_0xc93e('0x3e')]=_['intersection'](_0x57d70d[_0xc93e('0x3b')],_0x57d70d[_0xc93e('0x3c')]);_0x339fc2[_0xc93e('0x41')]=_['intersection'](_0x57d70d[_0xc93e('0x3b')],qs[_0xc93e('0x40')](_0x45ed9d[_0xc93e('0x3c')][_0xc93e('0x40')]));_0x339fc2[_0xc93e('0x41')]=_0x339fc2[_0xc93e('0x41')]['length']?_0x339fc2[_0xc93e('0x41')]:_0x57d70d[_0xc93e('0x3b')];if(!_0x45ed9d[_0xc93e('0x3c')][_0xc93e('0x43')](_0xc93e('0x44'))){_0x339fc2['limit']=qs[_0xc93e('0x24')](_0x45ed9d[_0xc93e('0x3c')]['limit']);_0x339fc2['offset']=qs[_0xc93e('0x22')](_0x45ed9d[_0xc93e('0x3c')][_0xc93e('0x22')]);}_0x339fc2[_0xc93e('0x45')]=qs[_0xc93e('0x46')](_0x45ed9d[_0xc93e('0x3c')][_0xc93e('0x46')]);_0x339fc2[_0xc93e('0x47')]=qs[_0xc93e('0x3e')](_[_0xc93e('0x5f')](_0x45ed9d[_0xc93e('0x3c')],_0x57d70d[_0xc93e('0x3e')]));_0x339fc2[_0xc93e('0x47')]['OpenchannelQueueId']=_0x1310b5['id'];if(_0x45ed9d[_0xc93e('0x3c')]['filter']){_0x339fc2['where']=_[_0xc93e('0x49')](_0x339fc2['where'],{'$or':_['map'](_0x339fc2[_0xc93e('0x41')],function(_0x5917a0){var _0x3c97bd={};_0x3c97bd[_0x5917a0]={'$like':'%'+_0x45ed9d[_0xc93e('0x3c')][_0xc93e('0x48')]+'%'};return _0x3c97bd;})});}_0x339fc2=_[_0xc93e('0x49')]({},_0x339fc2,_0x45ed9d[_0xc93e('0x4b')]);return db[_0xc93e('0x5e')][_0xc93e('0x4e')](_0x339fc2);}})[_0xc93e('0x2c')](function(_0x5a5233){if(_0x5a5233){return db[_0xc93e('0x60')][_0xc93e('0x61')]({'where':{'id':_[_0xc93e('0x35')](_0x5a5233,'UserId'),'role':_0xc93e('0x62')},'attributes':['id',_0xc93e('0x33'),_0xc93e('0x63'),_0xc93e('0x64'),_0xc93e('0x65')]});}})[_0xc93e('0x2c')](function(_0x55d892){if(_0x55d892){return{'count':_0x55d892[_0xc93e('0x25')],'rows':_[_0xc93e('0x35')](_0x55d892[_0xc93e('0x4f')],function(_0x433a44){return{'membername':_0x433a44['name'],'UserId':_0x433a44['id'],'queue_name':_0x2a02cf['name'],'OpenchannelQueueId':_0x2a02cf['id'],'interface':util[_0xc93e('0x66')](_0xc93e('0x67'),'SIP',_0x433a44[_0xc93e('0x33')]),'penalty':0x0,'paused':_0x433a44[_0xc93e('0x63')],'createdAt':_0x433a44['createdAt'],'updatedAt':_0x433a44[_0xc93e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc93e('0x2c')](respondWithFilteredResult(_0x1a31a1,_0x339fc2))['catch'](handleError(_0x1a31a1,null));};exports[_0xc93e('0x68')]=function(_0x102d37,_0x17fe9f,_0x5d2caf){var _0xc2c8c1={};var _0x1bd9c1={};var _0x5833ab;var _0x4ccb7b;return db['OpenchannelQueue'][_0xc93e('0x69')]({'where':{'id':_0x102d37[_0xc93e('0x52')]['id']}})[_0xc93e('0x2c')](handleEntityNotFound(_0x17fe9f,null))[_0xc93e('0x2c')](function(_0x2c1e25){if(_0x2c1e25){_0x5833ab=_0x2c1e25;_0x1bd9c1[_0xc93e('0x3b')]=_[_0xc93e('0x3d')](db['Team'][_0xc93e('0x37')]);_0x1bd9c1[_0xc93e('0x3c')]=_['keys'](_0x102d37[_0xc93e('0x3c')]);_0x1bd9c1[_0xc93e('0x3e')]=_[_0xc93e('0x3f')](_0x1bd9c1[_0xc93e('0x3b')],_0x1bd9c1[_0xc93e('0x3c')]);_0xc2c8c1[_0xc93e('0x41')]=_['intersection'](_0x1bd9c1[_0xc93e('0x3b')],qs[_0xc93e('0x40')](_0x102d37[_0xc93e('0x3c')]['fields']));_0xc2c8c1[_0xc93e('0x41')]=_0xc2c8c1['attributes']['length']?_0xc2c8c1[_0xc93e('0x41')]:_0x1bd9c1['model'];_0xc2c8c1['order']=qs['sort'](_0x102d37[_0xc93e('0x3c')][_0xc93e('0x46')]);_0xc2c8c1[_0xc93e('0x47')]=qs['filters'](_[_0xc93e('0x5f')](_0x102d37[_0xc93e('0x3c')],_0x1bd9c1[_0xc93e('0x3e')]));if(_0x102d37[_0xc93e('0x3c')][_0xc93e('0x48')]){_0xc2c8c1[_0xc93e('0x47')]=_['merge'](_0xc2c8c1[_0xc93e('0x47')],{'$or':_['map'](_0xc2c8c1[_0xc93e('0x41')],function(_0x42903f){var _0x568cd9={};_0x568cd9[_0x42903f]={'$like':'%'+_0x102d37['query'][_0xc93e('0x48')]+'%'};return _0x568cd9;})});}_0xc2c8c1=_['merge']({},_0xc2c8c1,_0x102d37['options']);return _0x5833ab['getTeams'](_0xc2c8c1);}})[_0xc93e('0x2c')](function(_0x3eb801){if(_0x3eb801){_0x4ccb7b=_0x3eb801[_0xc93e('0x42')];if(!_0x102d37['query']['hasOwnProperty']('nolimit')){_0xc2c8c1[_0xc93e('0x24')]=qs['limit'](_0x102d37['query'][_0xc93e('0x24')]);_0xc2c8c1[_0xc93e('0x22')]=qs[_0xc93e('0x22')](_0x102d37[_0xc93e('0x3c')][_0xc93e('0x22')]);}return _0x5833ab[_0xc93e('0x68')](_0xc2c8c1);}})[_0xc93e('0x2c')](function(_0x35bff7){if(_0x35bff7){return _0x35bff7?{'count':_0x4ccb7b,'rows':_0x35bff7}:null;}})['then'](respondWithResult(_0x17fe9f,null))['catch'](handleError(_0x17fe9f,null));};exports[_0xc93e('0x6a')]=function(_0x7e4e4f,_0x2d336c,_0x1646ae){var _0x40f87b=_0x7e4e4f[_0xc93e('0x5b')][_0xc93e('0x6b')];return db[_0xc93e('0x6c')]['findAll']({'where':{'id':_0x40f87b},'attributes':['id'],'include':[{'model':db[_0xc93e('0x60')],'as':'Agents','attributes':['id',_0xc93e('0x33'),_0xc93e('0x6d'),_0xc93e('0x6e'),'interface'],'raw':!![]}]})[_0xc93e('0x2c')](function(_0x494ab6){if(_0x494ab6){var _0x4ac075=_['flatMap'](_0x494ab6,function(_0x331a1c){var _0x3c7a79=_0x331a1c[_0xc93e('0x2e')]({'plain':!![]});return _0x3c7a79[_0xc93e('0x6f')];});return db[_0xc93e('0x36')][_0xc93e('0x53')]({'where':{'id':_0x7e4e4f['params']['id']}})[_0xc93e('0x2c')](function(_0x1e64ce){return db[_0xc93e('0x70')][_0xc93e('0x71')](function(_0x3c23cc){return _0x1e64ce[_0xc93e('0x6a')](_0x40f87b,{'transaction':_0x3c23cc})[_0xc93e('0x2c')](function(){return BPromise[_0xc93e('0x72')](_0x4ac075,function(_0x5b4523){return db[_0xc93e('0x5e')][_0xc93e('0x73')]({'where':{'UserId':_0x5b4523['id'],'OpenchannelQueueId':_0x7e4e4f[_0xc93e('0x52')]['id']},'transaction':_0x3c23cc});});})['then'](function(){_0x4ac075['forEach'](function(_0x52c176){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x52c176['id'],'OpenchannelQueueId':_0x1e64ce['id']});});});});});}})['then'](respondWithStatusCode(_0x2d336c,null))[_0xc93e('0x50')](handleError(_0x2d336c,null));};exports[_0xc93e('0x74')]=function(_0xd4e3cd,_0x50008b,_0x53bac9){return db['Team'][_0xc93e('0x4e')]({'where':{'id':_0xd4e3cd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc93e('0x60')],'as':_0xc93e('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xc93e('0x2c')](handleEntityNotFound(_0x50008b,null))['then'](function(_0x4121a){var _0x38724b=_['map'](_0x4121a,'id');var _0x4f795f=[];var _0x5883b9=[];var _0x26e3a7=squel[_0xc93e('0x75')]();_0x26e3a7[_0xc93e('0x76')]('tq.TeamId')[_0xc93e('0x77')](_0xc93e('0x78'),'tq')[_0xc93e('0x79')](_0xc93e('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xc93e('0x7b'),_0xd4e3cd['params']['id']);for(var _0x106311=0x0;_0x106311<_0x4121a[_0xc93e('0x42')];_0x106311+=0x1){let _0x17e6ae=_0x4121a[_0x106311];for(var _0x52123f=0x0;_0x52123f<_0x17e6ae['Agents'][_0xc93e('0x42')];_0x52123f+=0x1){let _0x32ccf8=_0x17e6ae['Agents'][_0x52123f];var _0x13d371=_0x26e3a7['clone']();_0x13d371[_0xc93e('0x47')](_0xc93e('0x7c'),_0x32ccf8['id']);_0x5883b9['push'](db[_0xc93e('0x70')]['query'](_0x13d371[_0xc93e('0x7d')](),{'type':db[_0xc93e('0x70')][_0xc93e('0x7e')][_0xc93e('0x7f')]})['then'](function(_0x2f36aa){if(_0x2f36aa[_0xc93e('0x42')]===0x1){return _0x32ccf8['id'];}else{var _0x247262=_[_0xc93e('0x80')](_[_0xc93e('0x35')](_0x2f36aa,'TeamId'),function(_0x1b86a4){return _[_0xc93e('0x81')](_0x38724b,_0x1b86a4);});if(_0x247262){return _0x32ccf8['id'];}}}));}}return BPromise[_0xc93e('0x82')](_0x5883b9)['then'](function(_0x257782){_0x4f795f=_(_0x4f795f)[_0xc93e('0x83')](_0x257782)['compact']()[_0xc93e('0x84')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xd4e3cd['params']['id']}})['then'](function(_0x547a20){return db['sequelize'][_0xc93e('0x71')](function(_0x4cc610){return _0x547a20[_0xc93e('0x74')](_0xd4e3cd[_0xc93e('0x3c')][_0xc93e('0x6b')],{'transaction':_0x4cc610})['then'](function(){if(!_[_0xc93e('0x85')](_0x4f795f)){return _0x547a20['removeAgents'](_0x4f795f,{'transaction':_0x4cc610});}})[_0xc93e('0x2c')](function(){_0x4f795f[_0xc93e('0x86')](function(_0x5f2459){socket[_0xc93e('0x87')](_0xc93e('0x88'),{'UserId':_0x5f2459,'OpenchannelQueueId':_0x547a20['id']});});});});});});})[_0xc93e('0x2c')](respondWithStatusCode(_0x50008b,null))[_0xc93e('0x50')](handleError(_0x50008b,null));};exports[_0xc93e('0x89')]=function(_0x52453c,_0x556eb9,_0x198984){return db[_0xc93e('0x36')][_0xc93e('0x53')]({'where':{'id':_0x52453c['params']['id']}})['then'](handleEntityNotFound(_0x556eb9,null))[_0xc93e('0x2c')](function(_0x32a182){if(_0x32a182){return _0x32a182[_0xc93e('0x89')](_0x52453c['body']['ids'],_['omit'](_0x52453c[_0xc93e('0x5b')],['ids','id'])||{})[_0xc93e('0x8a')](function(_0x1bc58d){for(var _0x1b7f3a=0x0;_0x1b7f3a<_0x52453c[_0xc93e('0x5b')][_0xc93e('0x6b')][_0xc93e('0x42')];_0x1b7f3a+=0x1){socket['emit'](_0xc93e('0x8b'),{'UserId':Number(_0x52453c[_0xc93e('0x5b')][_0xc93e('0x6b')][_0x1b7f3a]),'OpenchannelQueueId':Number(_0x52453c[_0xc93e('0x52')]['id'])});}return _0x1bc58d;});}})[_0xc93e('0x2c')](respondWithResult(_0x556eb9,null))['catch'](handleError(_0x556eb9,null));};exports[_0xc93e('0x8c')]=function(_0x5eb4f6,_0x5931b5,_0x3c8581){return db[_0xc93e('0x36')][_0xc93e('0x53')]({'where':{'id':_0x5eb4f6[_0xc93e('0x52')]['id']}})[_0xc93e('0x2c')](handleEntityNotFound(_0x5931b5,null))[_0xc93e('0x2c')](function(_0x40407f){if(_0x40407f){return _0x40407f['removeAgents'](_0x5eb4f6[_0xc93e('0x3c')][_0xc93e('0x6b')])[_0xc93e('0x2c')](function(){if(_[_0xc93e('0x8d')](_0x5eb4f6['query'][_0xc93e('0x6b')])){for(var _0xf271c3=0x0;_0xf271c3<_0x5eb4f6[_0xc93e('0x3c')][_0xc93e('0x6b')]['length'];_0xf271c3+=0x1){socket[_0xc93e('0x87')](_0xc93e('0x88'),{'UserId':Number(_0x5eb4f6[_0xc93e('0x3c')]['ids'][_0xf271c3]),'OpenchannelQueueId':Number(_0x5eb4f6[_0xc93e('0x52')]['id'])});}}else{socket[_0xc93e('0x87')](_0xc93e('0x88'),{'UserId':Number(_0x5eb4f6['query'][_0xc93e('0x6b')]),'OpenchannelQueueId':Number(_0x5eb4f6['params']['id'])});}});}})[_0xc93e('0x2c')](respondWithStatusCode(_0x5931b5,null))['catch'](handleError(_0x5931b5,null));};exports['getAgents']=function(_0x358248,_0x487192,_0x7abedd){var _0x530052={};var _0x2ea292={};var _0xd39bc2;var _0x57f86d;return db[_0xc93e('0x36')]['findOne']({'where':{'id':_0x358248[_0xc93e('0x52')]['id']}})[_0xc93e('0x2c')](handleEntityNotFound(_0x487192,null))[_0xc93e('0x2c')](function(_0x4ba1ca){if(_0x4ba1ca){_0xd39bc2=_0x4ba1ca;_0x2ea292['model']=_[_0xc93e('0x3d')](db['User'][_0xc93e('0x37')]);_0x2ea292[_0xc93e('0x3c')]=_[_0xc93e('0x3d')](_0x358248['query']);_0x2ea292[_0xc93e('0x3e')]=_['intersection'](_0x2ea292[_0xc93e('0x3b')],_0x2ea292[_0xc93e('0x3c')]);_0x530052[_0xc93e('0x41')]=_[_0xc93e('0x3f')](_0x2ea292['model'],qs[_0xc93e('0x40')](_0x358248[_0xc93e('0x3c')]['fields']));_0x530052['attributes']=_0x530052[_0xc93e('0x41')][_0xc93e('0x42')]?_0x530052[_0xc93e('0x41')]:_0x2ea292[_0xc93e('0x3b')];_0x530052[_0xc93e('0x45')]=qs[_0xc93e('0x46')](_0x358248[_0xc93e('0x3c')][_0xc93e('0x46')]);_0x530052[_0xc93e('0x47')]=qs[_0xc93e('0x3e')](_[_0xc93e('0x5f')](_0x358248[_0xc93e('0x3c')],_0x2ea292['filters']));if(_0x358248[_0xc93e('0x3c')]['filter']){_0x530052[_0xc93e('0x47')]=_[_0xc93e('0x49')](_0x530052[_0xc93e('0x47')],{'$or':_[_0xc93e('0x35')](_0x530052['attributes'],function(_0x13efac){var _0x5a8cdc={};_0x5a8cdc[_0x13efac]={'$like':'%'+_0x358248[_0xc93e('0x3c')][_0xc93e('0x48')]+'%'};return _0x5a8cdc;})});}_0x530052=_[_0xc93e('0x49')]({},_0x530052,_0x358248['options']);return _0xd39bc2['getAgents'](_0x530052);}})[_0xc93e('0x2c')](function(_0x4c33be){if(_0x4c33be){_0x57f86d=_0x4c33be[_0xc93e('0x42')];if(!_0x358248[_0xc93e('0x3c')][_0xc93e('0x43')](_0xc93e('0x44'))){_0x530052[_0xc93e('0x24')]=qs[_0xc93e('0x24')](_0x358248[_0xc93e('0x3c')][_0xc93e('0x24')]);_0x530052[_0xc93e('0x22')]=qs['offset'](_0x358248[_0xc93e('0x3c')][_0xc93e('0x22')]);}return _0xd39bc2[_0xc93e('0x8e')](_0x530052);}})['then'](function(_0x376623){if(_0x376623){return _0x376623?{'count':_0x57f86d,'rows':_0x376623}:null;}})['then'](respondWithResult(_0x487192,null))['catch'](handleError(_0x487192,null));}; \ No newline at end of file +var _0x1f45=['apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','sort','filters','pick','filter','where','VIRTUAL','options','OpenchannelQueue','includeAll','include','rows','catch','show','params','length','merge','find','body','role','user','UserProfileResource','create','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','agent','updatedAt','createdAt','SIP','openchannelPause','hasOwnProperty','getTeams','addTeams','ids','findAll','User','online','voicePause','interface','flatMap','Agents','transaction','userOpenchannelQueue:save','removeTeams','Team','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','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/license/util','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x273ace,_0x3b28bc){var _0x5a5548=function(_0x2d2aaf){while(--_0x2d2aaf){_0x273ace['push'](_0x273ace['shift']());}};_0x5a5548(++_0x3b28bc);}(_0x1f45,0x64));var _0x51f4=function(_0x313513,_0x1c30b4){_0x313513=_0x313513-0x0;var _0x1c96c9=_0x1f45[_0x313513];return _0x1c96c9;};'use strict';var emlformat=require(_0x51f4('0x0'));var rimraf=require(_0x51f4('0x1'));var zipdir=require(_0x51f4('0x2'));var jsonpatch=require(_0x51f4('0x3'));var rp=require('request-promise');var moment=require(_0x51f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x51f4('0x5'));var util=require('util');var path=require(_0x51f4('0x6'));var sox=require(_0x51f4('0x7'));var csv=require('to-csv');var ejs=require(_0x51f4('0x8'));var fs=require('fs');var fs_extra=require(_0x51f4('0x9'));var _=require('lodash');var squel=require(_0x51f4('0xa'));var crypto=require(_0x51f4('0xb'));var jsforce=require(_0x51f4('0xc'));var deskjs=require(_0x51f4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x51f4('0xe'));var Papa=require(_0x51f4('0xf'));var Redis=require(_0x51f4('0x10'));var authService=require(_0x51f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x51f4('0x12'));var hardwareService=require(_0x51f4('0x13'));var logger=require(_0x51f4('0x14'))(_0x51f4('0x15'));var utils=require(_0x51f4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x51f4('0x17'));var db=require(_0x51f4('0x18'))['db'];config[_0x51f4('0x19')]=_['defaults'](config['redis'],{'host':_0x51f4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51f4('0x19')]));require(_0x51f4('0x1b'))[_0x51f4('0x1c')](socket);function respondWithStatusCode(_0x362635,_0x136af1){_0x136af1=_0x136af1||0xcc;return function(_0x2e9665){if(_0x2e9665){return _0x362635[_0x51f4('0x1d')](_0x136af1);}return _0x362635[_0x51f4('0x1e')](_0x136af1)[_0x51f4('0x1f')]();};}function respondWithResult(_0x4bcbd2,_0x27340f){_0x27340f=_0x27340f||0xc8;return function(_0x4f34a8){if(_0x4f34a8){return _0x4bcbd2[_0x51f4('0x1e')](_0x27340f)[_0x51f4('0x20')](_0x4f34a8);}};}function respondWithFilteredResult(_0x30787e,_0x2fcff6){return function(_0x50409c){if(_0x50409c){var _0x432033=typeof _0x2fcff6['offset']===_0x51f4('0x21')&&typeof _0x2fcff6[_0x51f4('0x22')]==='undefined';var _0x4c1420=_0x50409c[_0x51f4('0x23')];var _0x803238=_0x432033?0x0:_0x2fcff6[_0x51f4('0x24')];var _0x48c925=_0x432033?_0x50409c[_0x51f4('0x23')]:_0x2fcff6[_0x51f4('0x24')]+_0x2fcff6[_0x51f4('0x22')];var _0x3a5ecb;if(_0x48c925>=_0x4c1420){_0x48c925=_0x4c1420;_0x3a5ecb=0xc8;}else{_0x3a5ecb=0xce;}_0x30787e[_0x51f4('0x1e')](_0x3a5ecb);return _0x30787e[_0x51f4('0x25')](_0x51f4('0x26'),_0x803238+'-'+_0x48c925+'/'+_0x4c1420)[_0x51f4('0x20')](_0x50409c);}return null;};}function patchUpdates(_0xec7b59){return function(_0x3da675){try{jsonpatch[_0x51f4('0x27')](_0x3da675,_0xec7b59,!![]);}catch(_0x47a4b0){return BPromise[_0x51f4('0x28')](_0x47a4b0);}return _0x3da675[_0x51f4('0x29')]();};}function saveUpdates(_0x524a75,_0x4bab6a){return function(_0x26984d){if(_0x26984d){return _0x26984d[_0x51f4('0x2a')](_0x524a75)[_0x51f4('0x2b')](function(_0x51e60c){return _0x51e60c;});}return null;};}function removeEntity(_0x4a6b88,_0x3888fa){return function(_0x164543){if(_0x164543){return _0x164543[_0x51f4('0x2c')]()[_0x51f4('0x2b')](function(){var _0x39bc65=_0x164543[_0x51f4('0x2d')]({'plain':!![]});var _0x4e6432=_0x51f4('0x2e');return db['UserProfileResource'][_0x51f4('0x2c')]({'where':{'type':_0x4e6432,'resourceId':_0x39bc65['id']}})[_0x51f4('0x2b')](function(){return _0x164543;});})[_0x51f4('0x2b')](function(){_0x4a6b88[_0x51f4('0x1e')](0xcc)[_0x51f4('0x1f')]();});}};}function handleEntityNotFound(_0x3ad4df,_0xcc36e2){return function(_0x57af55){if(!_0x57af55){_0x3ad4df['sendStatus'](0x194);}return _0x57af55;};}function handleError(_0x496a9a,_0x56044b){_0x56044b=_0x56044b||0x1f4;return function(_0x14fb0f){logger[_0x51f4('0x2f')](_0x14fb0f[_0x51f4('0x30')]);if(_0x14fb0f[_0x51f4('0x31')]){delete _0x14fb0f['name'];}_0x496a9a[_0x51f4('0x1e')](_0x56044b)['send'](_0x14fb0f);};}exports[_0x51f4('0x32')]=function(_0x992ded,_0x1be676){var _0x13bbef={},_0x310881={},_0x1e43b5={'count':0x0,'rows':[]};var _0x4aae44=_[_0x51f4('0x33')](db['OpenchannelQueue'][_0x51f4('0x34')],function(_0x2762a3){return{'name':_0x2762a3[_0x51f4('0x35')],'type':_0x2762a3[_0x51f4('0x36')][_0x51f4('0x37')]};});_0x310881[_0x51f4('0x38')]=_[_0x51f4('0x33')](_0x4aae44,_0x51f4('0x31'));_0x310881[_0x51f4('0x39')]=_[_0x51f4('0x3a')](_0x992ded[_0x51f4('0x39')]);_0x310881['filters']=_[_0x51f4('0x3b')](_0x310881['model'],_0x310881[_0x51f4('0x39')]);_0x13bbef['attributes']=_[_0x51f4('0x3b')](_0x310881[_0x51f4('0x38')],qs[_0x51f4('0x3c')](_0x992ded[_0x51f4('0x39')]['fields']));_0x13bbef[_0x51f4('0x3d')]=_0x13bbef[_0x51f4('0x3d')]['length']?_0x13bbef[_0x51f4('0x3d')]:_0x310881[_0x51f4('0x38')];if(!_0x992ded[_0x51f4('0x39')]['hasOwnProperty'](_0x51f4('0x3e'))){_0x13bbef['limit']=qs['limit'](_0x992ded[_0x51f4('0x39')][_0x51f4('0x22')]);_0x13bbef[_0x51f4('0x24')]=qs[_0x51f4('0x24')](_0x992ded[_0x51f4('0x39')][_0x51f4('0x24')]);}_0x13bbef['order']=qs[_0x51f4('0x3f')](_0x992ded[_0x51f4('0x39')]['sort']);_0x13bbef['where']=qs[_0x51f4('0x40')](_[_0x51f4('0x41')](_0x992ded['query'],_0x310881[_0x51f4('0x40')]),_0x4aae44);if(_0x992ded[_0x51f4('0x39')][_0x51f4('0x42')]){_0x13bbef[_0x51f4('0x43')]=_['merge'](_0x13bbef[_0x51f4('0x43')],{'$or':_[_0x51f4('0x33')](_0x4aae44,function(_0x5e71b2){if(_0x5e71b2[_0x51f4('0x36')]!==_0x51f4('0x44')){var _0x42d4de={};_0x42d4de[_0x5e71b2[_0x51f4('0x31')]]={'$like':'%'+_0x992ded[_0x51f4('0x39')][_0x51f4('0x42')]+'%'};return _0x42d4de;}})});}_0x13bbef=_['merge']({},_0x13bbef,_0x992ded[_0x51f4('0x45')]);var _0x4e0796={'where':_0x13bbef['where']};return db[_0x51f4('0x46')][_0x51f4('0x23')](_0x4e0796)[_0x51f4('0x2b')](function(_0x166c4b){_0x1e43b5[_0x51f4('0x23')]=_0x166c4b;if(_0x992ded[_0x51f4('0x39')][_0x51f4('0x47')]){_0x13bbef[_0x51f4('0x48')]=[{'all':!![]}];}return db[_0x51f4('0x46')]['findAll'](_0x13bbef);})[_0x51f4('0x2b')](function(_0x152f24){_0x1e43b5[_0x51f4('0x49')]=_0x152f24;return _0x1e43b5;})[_0x51f4('0x2b')](respondWithFilteredResult(_0x1be676,_0x13bbef))[_0x51f4('0x4a')](handleError(_0x1be676,null));};exports[_0x51f4('0x4b')]=function(_0x5419b9,_0xdf33a4){var _0x3fc078={'raw':!![],'where':{'id':_0x5419b9[_0x51f4('0x4c')]['id']}},_0x1d8a29={};_0x1d8a29[_0x51f4('0x38')]=_[_0x51f4('0x3a')](db[_0x51f4('0x46')]['rawAttributes']);_0x1d8a29[_0x51f4('0x39')]=_[_0x51f4('0x3a')](_0x5419b9[_0x51f4('0x39')]);_0x1d8a29[_0x51f4('0x40')]=_[_0x51f4('0x3b')](_0x1d8a29[_0x51f4('0x38')],_0x1d8a29[_0x51f4('0x39')]);_0x3fc078[_0x51f4('0x3d')]=_[_0x51f4('0x3b')](_0x1d8a29['model'],qs[_0x51f4('0x3c')](_0x5419b9['query'][_0x51f4('0x3c')]));_0x3fc078['attributes']=_0x3fc078[_0x51f4('0x3d')][_0x51f4('0x4d')]?_0x3fc078[_0x51f4('0x3d')]:_0x1d8a29[_0x51f4('0x38')];if(_0x5419b9[_0x51f4('0x39')][_0x51f4('0x47')]){_0x3fc078[_0x51f4('0x48')]=[{'all':!![]}];}_0x3fc078=_[_0x51f4('0x4e')]({},_0x3fc078,_0x5419b9[_0x51f4('0x45')]);return db[_0x51f4('0x46')][_0x51f4('0x4f')](_0x3fc078)['then'](handleEntityNotFound(_0xdf33a4,null))[_0x51f4('0x2b')](respondWithResult(_0xdf33a4,null))[_0x51f4('0x4a')](handleError(_0xdf33a4,null));};exports['create']=function(_0x3b7837,_0x537903){return db['OpenchannelQueue']['create'](_0x3b7837[_0x51f4('0x50')],{})[_0x51f4('0x2b')](function(_0x132b8c){var _0x529dc1=_0x3b7837['user'][_0x51f4('0x2d')]({'plain':!![]});if(!_0x529dc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x529dc1[_0x51f4('0x51')]===_0x51f4('0x52')){var _0xf9650a=_0x132b8c['get']({'plain':!![]});var _0x435391='OpenchannelQueues';return db['UserProfileSection']['find']({'where':{'name':_0x435391,'userProfileId':_0x529dc1['userProfileId']},'raw':!![]})[_0x51f4('0x2b')](function(_0x29b27a){if(_0x29b27a&&_0x29b27a['autoAssociation']===0x0){return db[_0x51f4('0x53')][_0x51f4('0x54')]({'name':_0xf9650a[_0x51f4('0x31')],'resourceId':_0xf9650a['id'],'type':_0x29b27a[_0x51f4('0x31')],'sectionId':_0x29b27a['id']},{})[_0x51f4('0x2b')](function(){return _0x132b8c;});}else{return _0x132b8c;}})[_0x51f4('0x4a')](function(_0x527da5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x527da5);throw _0x527da5;});}return _0x132b8c;})[_0x51f4('0x2b')](respondWithResult(_0x537903,0xc9))[_0x51f4('0x4a')](handleError(_0x537903,null));};exports[_0x51f4('0x2a')]=function(_0x29f242,_0x55c3bd){if(_0x29f242['body']['id']){delete _0x29f242['body']['id'];}return db['OpenchannelQueue'][_0x51f4('0x4f')]({'where':{'id':_0x29f242[_0x51f4('0x4c')]['id']}})[_0x51f4('0x2b')](handleEntityNotFound(_0x55c3bd,null))[_0x51f4('0x2b')](saveUpdates(_0x29f242[_0x51f4('0x50')],null))[_0x51f4('0x2b')](respondWithResult(_0x55c3bd,null))['catch'](handleError(_0x55c3bd,null));};exports['destroy']=function(_0x20b09f,_0x45c07e){return db['OpenchannelQueue'][_0x51f4('0x4f')]({'where':{'id':_0x20b09f['params']['id']}})[_0x51f4('0x2b')](handleEntityNotFound(_0x45c07e,null))['then'](removeEntity(_0x45c07e,null))['catch'](handleError(_0x45c07e,null));};exports[_0x51f4('0x55')]=function(_0x4d02c7,_0xed099b){return db[_0x51f4('0x46')]['describe']()[_0x51f4('0x2b')](respondWithResult(_0xed099b,null))['catch'](handleError(_0xed099b,null));};exports[_0x51f4('0x56')]=function(_0x19cf6c,_0x3ce876,_0x3ca893){var _0x12e97a={'raw':!![],'where':{}},_0x5340c1={},_0x33ede0;return db['OpenchannelQueue'][_0x51f4('0x57')]({'where':{'id':_0x19cf6c[_0x51f4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ce876,null))[_0x51f4('0x2b')](function(_0x52dfa5){if(_0x52dfa5){_0x33ede0=_0x52dfa5[_0x51f4('0x2d')]({'plain':!![]});_0x5340c1['model']=_[_0x51f4('0x3a')](db[_0x51f4('0x58')][_0x51f4('0x34')]);_0x5340c1[_0x51f4('0x39')]=_['keys'](_0x19cf6c['query']);_0x5340c1['filters']=_[_0x51f4('0x3b')](_0x5340c1[_0x51f4('0x38')],_0x5340c1['query']);_0x12e97a[_0x51f4('0x3d')]=_[_0x51f4('0x3b')](_0x5340c1[_0x51f4('0x38')],qs[_0x51f4('0x3c')](_0x19cf6c['query'][_0x51f4('0x3c')]));_0x12e97a[_0x51f4('0x3d')]=_0x12e97a[_0x51f4('0x3d')][_0x51f4('0x4d')]?_0x12e97a[_0x51f4('0x3d')]:_0x5340c1[_0x51f4('0x38')];if(!_0x19cf6c[_0x51f4('0x39')]['hasOwnProperty'](_0x51f4('0x3e'))){_0x12e97a['limit']=qs[_0x51f4('0x22')](_0x19cf6c[_0x51f4('0x39')]['limit']);_0x12e97a[_0x51f4('0x24')]=qs[_0x51f4('0x24')](_0x19cf6c[_0x51f4('0x39')]['offset']);}_0x12e97a[_0x51f4('0x59')]=qs[_0x51f4('0x3f')](_0x19cf6c[_0x51f4('0x39')]['sort']);_0x12e97a['where']=qs[_0x51f4('0x40')](_[_0x51f4('0x41')](_0x19cf6c[_0x51f4('0x39')],_0x5340c1['filters']));_0x12e97a[_0x51f4('0x43')][_0x51f4('0x5a')]=_0x52dfa5['id'];if(_0x19cf6c[_0x51f4('0x39')][_0x51f4('0x42')]){_0x12e97a['where']=_['merge'](_0x12e97a[_0x51f4('0x43')],{'$or':_['map'](_0x12e97a[_0x51f4('0x3d')],function(_0x1f916d){var _0x29a358={};_0x29a358[_0x1f916d]={'$like':'%'+_0x19cf6c[_0x51f4('0x39')]['filter']+'%'};return _0x29a358;})});}_0x12e97a=_[_0x51f4('0x4e')]({},_0x12e97a,_0x19cf6c[_0x51f4('0x45')]);return db[_0x51f4('0x58')]['findAll'](_0x12e97a);}})[_0x51f4('0x2b')](function(_0x315377){if(_0x315377){return db['User'][_0x51f4('0x5b')]({'where':{'id':_['map'](_0x315377,'UserId'),'role':_0x51f4('0x5c')},'attributes':['id',_0x51f4('0x31'),'openchannelPause',_0x51f4('0x5d'),_0x51f4('0x5e')]});}})['then'](function(_0x44cd1a){if(_0x44cd1a){return{'count':_0x44cd1a[_0x51f4('0x23')],'rows':_[_0x51f4('0x33')](_0x44cd1a[_0x51f4('0x49')],function(_0x2e2033){return{'membername':_0x2e2033['name'],'UserId':_0x2e2033['id'],'queue_name':_0x33ede0['name'],'OpenchannelQueueId':_0x33ede0['id'],'interface':util['format']('%s/%s',_0x51f4('0x5f'),_0x2e2033[_0x51f4('0x31')]),'penalty':0x0,'paused':_0x2e2033[_0x51f4('0x60')],'createdAt':_0x2e2033[_0x51f4('0x5e')],'updatedAt':_0x2e2033[_0x51f4('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x51f4('0x2b')](respondWithFilteredResult(_0x3ce876,_0x12e97a))['catch'](handleError(_0x3ce876,null));};exports['getTeams']=function(_0x2f51f0,_0x265c55,_0x312393){var _0x40a9f0={};var _0x421c6d={};var _0x571cff;var _0x4aea66;return db['OpenchannelQueue'][_0x51f4('0x57')]({'where':{'id':_0x2f51f0[_0x51f4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x265c55,null))[_0x51f4('0x2b')](function(_0x406fff){if(_0x406fff){_0x571cff=_0x406fff;_0x421c6d[_0x51f4('0x38')]=_[_0x51f4('0x3a')](db['Team'][_0x51f4('0x34')]);_0x421c6d['query']=_[_0x51f4('0x3a')](_0x2f51f0['query']);_0x421c6d[_0x51f4('0x40')]=_['intersection'](_0x421c6d[_0x51f4('0x38')],_0x421c6d[_0x51f4('0x39')]);_0x40a9f0[_0x51f4('0x3d')]=_[_0x51f4('0x3b')](_0x421c6d[_0x51f4('0x38')],qs[_0x51f4('0x3c')](_0x2f51f0[_0x51f4('0x39')][_0x51f4('0x3c')]));_0x40a9f0['attributes']=_0x40a9f0[_0x51f4('0x3d')][_0x51f4('0x4d')]?_0x40a9f0[_0x51f4('0x3d')]:_0x421c6d[_0x51f4('0x38')];_0x40a9f0[_0x51f4('0x59')]=qs[_0x51f4('0x3f')](_0x2f51f0[_0x51f4('0x39')][_0x51f4('0x3f')]);_0x40a9f0[_0x51f4('0x43')]=qs[_0x51f4('0x40')](_[_0x51f4('0x41')](_0x2f51f0[_0x51f4('0x39')],_0x421c6d[_0x51f4('0x40')]));if(_0x2f51f0['query']['filter']){_0x40a9f0[_0x51f4('0x43')]=_[_0x51f4('0x4e')](_0x40a9f0[_0x51f4('0x43')],{'$or':_[_0x51f4('0x33')](_0x40a9f0[_0x51f4('0x3d')],function(_0x4952da){var _0x549d96={};_0x549d96[_0x4952da]={'$like':'%'+_0x2f51f0['query'][_0x51f4('0x42')]+'%'};return _0x549d96;})});}_0x40a9f0=_['merge']({},_0x40a9f0,_0x2f51f0[_0x51f4('0x45')]);return _0x571cff['getTeams'](_0x40a9f0);}})[_0x51f4('0x2b')](function(_0x517a2d){if(_0x517a2d){_0x4aea66=_0x517a2d[_0x51f4('0x4d')];if(!_0x2f51f0[_0x51f4('0x39')][_0x51f4('0x61')](_0x51f4('0x3e'))){_0x40a9f0['limit']=qs['limit'](_0x2f51f0['query'][_0x51f4('0x22')]);_0x40a9f0[_0x51f4('0x24')]=qs[_0x51f4('0x24')](_0x2f51f0[_0x51f4('0x39')][_0x51f4('0x24')]);}return _0x571cff[_0x51f4('0x62')](_0x40a9f0);}})['then'](function(_0x1db6cb){if(_0x1db6cb){return _0x1db6cb?{'count':_0x4aea66,'rows':_0x1db6cb}:null;}})[_0x51f4('0x2b')](respondWithResult(_0x265c55,null))['catch'](handleError(_0x265c55,null));};exports[_0x51f4('0x63')]=function(_0xbeb1e0,_0x3d1c01,_0x20bb2e){var _0x3da320=_0xbeb1e0[_0x51f4('0x50')][_0x51f4('0x64')];return db['Team'][_0x51f4('0x65')]({'where':{'id':_0x3da320},'attributes':['id'],'include':[{'model':db[_0x51f4('0x66')],'as':'Agents','attributes':['id',_0x51f4('0x31'),_0x51f4('0x67'),_0x51f4('0x68'),_0x51f4('0x69')],'raw':!![]}]})[_0x51f4('0x2b')](function(_0x242630){if(_0x242630){var _0x244073=_[_0x51f4('0x6a')](_0x242630,function(_0x2dd508){var _0x240cbb=_0x2dd508[_0x51f4('0x2d')]({'plain':!![]});return _0x240cbb[_0x51f4('0x6b')];});return db[_0x51f4('0x46')][_0x51f4('0x4f')]({'where':{'id':_0xbeb1e0[_0x51f4('0x4c')]['id']}})['then'](function(_0x1dc9e3){return db['sequelize'][_0x51f4('0x6c')](function(_0x33eb15){return _0x1dc9e3[_0x51f4('0x63')](_0x3da320,{'transaction':_0x33eb15})['then'](function(){return BPromise['each'](_0x244073,function(_0x5cec28){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x5cec28['id'],'OpenchannelQueueId':_0xbeb1e0[_0x51f4('0x4c')]['id']},'transaction':_0x33eb15});});})['then'](function(){_0x244073['forEach'](function(_0x32ef42){socket['emit'](_0x51f4('0x6d'),{'UserId':_0x32ef42['id'],'OpenchannelQueueId':_0x1dc9e3['id']});});});});});}})[_0x51f4('0x2b')](respondWithStatusCode(_0x3d1c01,null))[_0x51f4('0x4a')](handleError(_0x3d1c01,null));};exports[_0x51f4('0x6e')]=function(_0x503192,_0x5c4f00,_0x45c9ef){return db[_0x51f4('0x6f')][_0x51f4('0x65')]({'where':{'id':_0x503192['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x51f4('0x66')],'as':_0x51f4('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x51f4('0x2b')](handleEntityNotFound(_0x5c4f00,null))[_0x51f4('0x2b')](function(_0x1e3105){var _0x15555f=_[_0x51f4('0x33')](_0x1e3105,'id');var _0x134af4=[];var _0x4573ed=[];var _0x3ae689=squel[_0x51f4('0x70')]();_0x3ae689[_0x51f4('0x71')](_0x51f4('0x72'))['from']('team_has_openchannel_queues','tq')[_0x51f4('0x73')](_0x51f4('0x74'),'ut',_0x51f4('0x75'))[_0x51f4('0x43')](_0x51f4('0x76'),_0x503192[_0x51f4('0x4c')]['id']);for(var _0xed4dec=0x0;_0xed4dec<_0x1e3105[_0x51f4('0x4d')];_0xed4dec+=0x1){let _0x1624c0=_0x1e3105[_0xed4dec];for(var _0x4e8a4f=0x0;_0x4e8a4f<_0x1624c0['Agents'][_0x51f4('0x4d')];_0x4e8a4f+=0x1){let _0xe99b03=_0x1624c0[_0x51f4('0x6b')][_0x4e8a4f];var _0x53855e=_0x3ae689[_0x51f4('0x77')]();_0x53855e[_0x51f4('0x43')]('ut.UserId\x20=\x20?',_0xe99b03['id']);_0x4573ed['push'](db[_0x51f4('0x78')]['query'](_0x53855e[_0x51f4('0x79')](),{'type':db['sequelize']['QueryTypes'][_0x51f4('0x7a')]})[_0x51f4('0x2b')](function(_0x2a8967){if(_0x2a8967[_0x51f4('0x4d')]===0x1){return _0xe99b03['id'];}else{var _0x2cefdb=_[_0x51f4('0x7b')](_[_0x51f4('0x33')](_0x2a8967,_0x51f4('0x7c')),function(_0x2ac487){return _[_0x51f4('0x7d')](_0x15555f,_0x2ac487);});if(_0x2cefdb){return _0xe99b03['id'];}}}));}}return BPromise[_0x51f4('0x7e')](_0x4573ed)[_0x51f4('0x2b')](function(_0x4be6e9){_0x134af4=_(_0x134af4)[_0x51f4('0x7f')](_0x4be6e9)[_0x51f4('0x80')]()[_0x51f4('0x81')]();return db[_0x51f4('0x46')]['find']({'where':{'id':_0x503192[_0x51f4('0x4c')]['id']}})[_0x51f4('0x2b')](function(_0x5bd827){return db[_0x51f4('0x78')][_0x51f4('0x6c')](function(_0x4f0298){return _0x5bd827[_0x51f4('0x6e')](_0x503192[_0x51f4('0x39')][_0x51f4('0x64')],{'transaction':_0x4f0298})[_0x51f4('0x2b')](function(){if(!_[_0x51f4('0x82')](_0x134af4)){return _0x5bd827[_0x51f4('0x83')](_0x134af4,{'transaction':_0x4f0298});}})[_0x51f4('0x2b')](function(){_0x134af4[_0x51f4('0x84')](function(_0x14f928){socket['emit'](_0x51f4('0x85'),{'UserId':_0x14f928,'OpenchannelQueueId':_0x5bd827['id']});});});});});});})[_0x51f4('0x2b')](respondWithStatusCode(_0x5c4f00,null))['catch'](handleError(_0x5c4f00,null));};exports['addAgents']=function(_0x47c218,_0xe2656f,_0x26f0c4){return db['OpenchannelQueue'][_0x51f4('0x4f')]({'where':{'id':_0x47c218[_0x51f4('0x4c')]['id']}})[_0x51f4('0x2b')](handleEntityNotFound(_0xe2656f,null))[_0x51f4('0x2b')](function(_0x5afd84){if(_0x5afd84){return _0x5afd84['addAgents'](_0x47c218[_0x51f4('0x50')][_0x51f4('0x64')],_[_0x51f4('0x86')](_0x47c218[_0x51f4('0x50')],[_0x51f4('0x64'),'id'])||{})[_0x51f4('0x87')](function(_0x6539f6){for(var _0x5ac479=0x0;_0x5ac479<_0x47c218[_0x51f4('0x50')][_0x51f4('0x64')][_0x51f4('0x4d')];_0x5ac479+=0x1){socket[_0x51f4('0x88')]('userOpenchannelQueue:save',{'UserId':Number(_0x47c218['body'][_0x51f4('0x64')][_0x5ac479]),'OpenchannelQueueId':Number(_0x47c218[_0x51f4('0x4c')]['id'])});}return _0x6539f6;});}})[_0x51f4('0x2b')](respondWithResult(_0xe2656f,null))[_0x51f4('0x4a')](handleError(_0xe2656f,null));};exports[_0x51f4('0x83')]=function(_0x751baf,_0x2c4526,_0x5163d8){return db[_0x51f4('0x46')][_0x51f4('0x4f')]({'where':{'id':_0x751baf['params']['id']}})['then'](handleEntityNotFound(_0x2c4526,null))['then'](function(_0x137de9){if(_0x137de9){return _0x137de9[_0x51f4('0x83')](_0x751baf[_0x51f4('0x39')][_0x51f4('0x64')])['then'](function(){if(_[_0x51f4('0x89')](_0x751baf[_0x51f4('0x39')][_0x51f4('0x64')])){for(var _0x5de063=0x0;_0x5de063<_0x751baf['query'][_0x51f4('0x64')][_0x51f4('0x4d')];_0x5de063+=0x1){socket['emit'](_0x51f4('0x85'),{'UserId':Number(_0x751baf[_0x51f4('0x39')]['ids'][_0x5de063]),'OpenchannelQueueId':Number(_0x751baf['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x751baf[_0x51f4('0x39')][_0x51f4('0x64')]),'OpenchannelQueueId':Number(_0x751baf[_0x51f4('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c4526,null))[_0x51f4('0x4a')](handleError(_0x2c4526,null));};exports[_0x51f4('0x8a')]=function(_0x268995,_0x295735,_0x54a79b){var _0x1fbca6={};var _0x11cbfb={};var _0x3c9247;var _0x27b25d;return db[_0x51f4('0x46')][_0x51f4('0x57')]({'where':{'id':_0x268995['params']['id']}})[_0x51f4('0x2b')](handleEntityNotFound(_0x295735,null))[_0x51f4('0x2b')](function(_0x11170){if(_0x11170){_0x3c9247=_0x11170;_0x11cbfb[_0x51f4('0x38')]=_[_0x51f4('0x3a')](db['User'][_0x51f4('0x34')]);_0x11cbfb[_0x51f4('0x39')]=_[_0x51f4('0x3a')](_0x268995['query']);_0x11cbfb['filters']=_['intersection'](_0x11cbfb[_0x51f4('0x38')],_0x11cbfb[_0x51f4('0x39')]);_0x1fbca6[_0x51f4('0x3d')]=_[_0x51f4('0x3b')](_0x11cbfb[_0x51f4('0x38')],qs[_0x51f4('0x3c')](_0x268995[_0x51f4('0x39')]['fields']));_0x1fbca6[_0x51f4('0x3d')]=_0x1fbca6[_0x51f4('0x3d')][_0x51f4('0x4d')]?_0x1fbca6[_0x51f4('0x3d')]:_0x11cbfb[_0x51f4('0x38')];_0x1fbca6[_0x51f4('0x59')]=qs[_0x51f4('0x3f')](_0x268995[_0x51f4('0x39')]['sort']);_0x1fbca6['where']=qs[_0x51f4('0x40')](_[_0x51f4('0x41')](_0x268995[_0x51f4('0x39')],_0x11cbfb[_0x51f4('0x40')]));if(_0x268995[_0x51f4('0x39')][_0x51f4('0x42')]){_0x1fbca6['where']=_[_0x51f4('0x4e')](_0x1fbca6[_0x51f4('0x43')],{'$or':_['map'](_0x1fbca6[_0x51f4('0x3d')],function(_0x2f2b00){var _0x14f123={};_0x14f123[_0x2f2b00]={'$like':'%'+_0x268995[_0x51f4('0x39')]['filter']+'%'};return _0x14f123;})});}_0x1fbca6=_[_0x51f4('0x4e')]({},_0x1fbca6,_0x268995[_0x51f4('0x45')]);return _0x3c9247[_0x51f4('0x8a')](_0x1fbca6);}})[_0x51f4('0x2b')](function(_0xe74ef6){if(_0xe74ef6){_0x27b25d=_0xe74ef6[_0x51f4('0x4d')];if(!_0x268995[_0x51f4('0x39')][_0x51f4('0x61')](_0x51f4('0x3e'))){_0x1fbca6[_0x51f4('0x22')]=qs['limit'](_0x268995[_0x51f4('0x39')][_0x51f4('0x22')]);_0x1fbca6['offset']=qs[_0x51f4('0x24')](_0x268995[_0x51f4('0x39')][_0x51f4('0x24')]);}return _0x3c9247[_0x51f4('0x8a')](_0x1fbca6);}})[_0x51f4('0x2b')](function(_0x285770){if(_0x285770){return _0x285770?{'count':_0x27b25d,'rows':_0x285770}:null;}})[_0x51f4('0x2b')](respondWithResult(_0x295735,null))[_0x51f4('0x4a')](handleError(_0x295735,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a723503..8e7fc8f 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 _0x6a50=['hasOwnProperty','hook','events','OpenchannelQueue','save','update','remove','emit'];(function(_0x4ecbbf,_0x1b62ee){var _0x5ddb38=function(_0x13fb28){while(--_0x13fb28){_0x4ecbbf['push'](_0x4ecbbf['shift']());}};_0x5ddb38(++_0x1b62ee);}(_0x6a50,0x1e2));var _0x06a5=function(_0x517c97,_0x3fd275){_0x517c97=_0x517c97-0x0;var _0x244ef3=_0x6a50[_0x517c97];return _0x244ef3;};'use strict';var EventEmitter=require(_0x06a5('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x06a5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06a5('0x2'),'afterUpdate':_0x06a5('0x3'),'afterDestroy':_0x06a5('0x4')};function emitEvent(_0x40a440){return function(_0x3a9c7d,_0x300fde,_0x155d5b){OpenchannelQueueEvents['emit'](_0x40a440+':'+_0x3a9c7d['id'],_0x3a9c7d);OpenchannelQueueEvents[_0x06a5('0x5')](_0x40a440,_0x3a9c7d);_0x155d5b(null);};}for(var e in events){if(events[_0x06a5('0x6')](e)){var event=events[e];OpenchannelQueue[_0x06a5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x50a6=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x4ad00a,_0xd5cc1){var _0x2e8b37=function(_0x5eff13){while(--_0x5eff13){_0x4ad00a['push'](_0x4ad00a['shift']());}};_0x2e8b37(++_0xd5cc1);}(_0x50a6,0x6d));var _0x650a=function(_0x581e1d,_0x1ed7d4){_0x581e1d=_0x581e1d-0x0;var _0x39965b=_0x50a6[_0x581e1d];return _0x39965b;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x650a('0x0'))['db'][_0x650a('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x650a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x650a('0x3')};function emitEvent(_0xe23430){return function(_0x2d9e44,_0x1d91d3,_0x15814d){OpenchannelQueueEvents[_0x650a('0x4')](_0xe23430+':'+_0x2d9e44['id'],_0x2d9e44);OpenchannelQueueEvents['emit'](_0xe23430,_0x2d9e44);_0x15814d(null);};}for(var e in events){if(events[_0x650a('0x5')](e)){var event=events[e];OpenchannelQueue[_0x650a('0x6')](e,emitEvent(event));}}module[_0x650a('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f208dc0..0dc13fd 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 _0xfd11=['api','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xfd11,0x1ba));var _0x1fd1=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0xfd11[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0x1fd1('0x0'));var util=require(_0x1fd1('0x1'));var logger=require('../../config/logger')(_0x1fd1('0x2'));var moment=require('moment');var BPromise=require(_0x1fd1('0x3'));var rp=require(_0x1fd1('0x4'));var fs=require('fs');var path=require(_0x1fd1('0x5'));var rimraf=require('rimraf');var config=require(_0x1fd1('0x6'));var attributes=require(_0x1fd1('0x7'));module[_0x1fd1('0x8')]=function(_0x158a66,_0x4f0d2d){return _0x158a66[_0x1fd1('0x9')](_0x1fd1('0xa'),attributes,{'tableName':_0x1fd1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac38=['../../config/logger','moment','request-promise','../../config/environment','exports','OpenchannelQueue','openchannel_queues','util'];(function(_0x1cbfd3,_0x8b30a4){var _0x400c68=function(_0x391773){while(--_0x391773){_0x1cbfd3['push'](_0x1cbfd3['shift']());}};_0x400c68(++_0x8b30a4);}(_0xac38,0x13f));var _0x8ac3=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0xac38[_0x2cc711];return _0x31a52e;};'use strict';var _=require('lodash');var util=require(_0x8ac3('0x0'));var logger=require(_0x8ac3('0x1'))('api');var moment=require(_0x8ac3('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ac3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ac3('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x8ac3('0x5')]=function(_0x5cf37b,_0x3d3969){return _0x5cf37b['define'](_0x8ac3('0x6'),attributes,{'tableName':_0x8ac3('0x7'),'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 abee6a4..2ebd70b 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 _0x8313=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','model','map','catch','ShowOpenchannelQueue','find','raw','util','moment'];(function(_0x26ffb3,_0x342140){var _0x3b40ba=function(_0xd44bc0){while(--_0xd44bc0){_0x26ffb3['push'](_0x26ffb3['shift']());}};_0x3b40ba(++_0x342140);}(_0x8313,0xcb));var _0x3831=function(_0x57c919,_0x2ad33a){_0x57c919=_0x57c919-0x0;var _0xd55782=_0x8313[_0x57c919];return _0xd55782;};'use strict';var _=require('lodash');var util=require(_0x3831('0x0'));var moment=require(_0x3831('0x1'));var BPromise=require(_0x3831('0x2'));var rs=require(_0x3831('0x3'));var fs=require('fs');var Redis=require(_0x3831('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3831('0x5'));var logger=require(_0x3831('0x6'))(_0x3831('0x7'));var config=require(_0x3831('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3831('0x9')]({'port':0x232a});config[_0x3831('0xa')]=_[_0x3831('0xb')](config[_0x3831('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3831('0xc'))(new Redis(config[_0x3831('0xa')]));require(_0x3831('0xd'))[_0x3831('0xe')](socket);function respondWithRpcPromise(_0x12e974,_0x223a82,_0x15daef){return new BPromise(function(_0x26fb47,_0x5110dc){return client[_0x3831('0xf')](_0x12e974,_0x15daef)[_0x3831('0x10')](function(_0xe788c1){logger[_0x3831('0x11')](_0x3831('0x12'),_0x223a82,_0x3831('0x13'));logger[_0x3831('0x14')](_0x3831('0x15'),_0x223a82,_0x3831('0x13'),JSON[_0x3831('0x16')](_0xe788c1));if(_0xe788c1['error']){if(_0xe788c1[_0x3831('0x17')][_0x3831('0x18')]===0x1f4){logger['error'](_0x3831('0x12'),_0x223a82,_0xe788c1[_0x3831('0x17')][_0x3831('0x19')]);return _0x5110dc(_0xe788c1[_0x3831('0x17')]['message']);}logger[_0x3831('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x223a82,_0xe788c1[_0x3831('0x17')]['message']);return _0x26fb47(_0xe788c1[_0x3831('0x17')][_0x3831('0x19')]);}else{logger['info'](_0x3831('0x12'),_0x223a82,_0x3831('0x13'));_0x26fb47(_0xe788c1[_0x3831('0x1a')][_0x3831('0x19')]);}})['catch'](function(_0x4edc45){logger['error'](_0x3831('0x12'),_0x223a82,_0x4edc45);_0x5110dc(_0x4edc45);});});}exports[_0x3831('0x1b')]=function(_0x574918){var _0xfffa92=this;return new Promise(function(_0x379833,_0x38beb4){return db[_0x3831('0x1c')][_0x3831('0x1d')]({'raw':_0x574918[_0x3831('0x1e')]?_0x574918['options']['raw']===undefined?!![]:![]:!![],'where':_0x574918['options']?_0x574918['options'][_0x3831('0x1f')]||null:null,'attributes':_0x574918[_0x3831('0x1e')]?_0x574918[_0x3831('0x1e')][_0x3831('0x20')]||null:null,'limit':_0x574918['options']?_0x574918[_0x3831('0x1e')][_0x3831('0x21')]||null:null,'include':_0x574918[_0x3831('0x1e')]?_0x574918['options'][_0x3831('0x22')]?_['map'](_0x574918[_0x3831('0x1e')]['include'],function(_0x29bc1a){return{'model':db[_0x29bc1a[_0x3831('0x23')]],'as':_0x29bc1a['as'],'attributes':_0x29bc1a['attributes'],'include':_0x29bc1a['include']?_[_0x3831('0x24')](_0x29bc1a['include'],function(_0x235781){return{'model':db[_0x235781[_0x3831('0x23')]],'as':_0x235781['as'],'attributes':_0x235781[_0x3831('0x20')],'include':_0x235781[_0x3831('0x22')]?_[_0x3831('0x24')](_0x235781[_0x3831('0x22')],function(_0xfbed86){return{'model':db[_0xfbed86[_0x3831('0x23')]],'as':_0xfbed86['as'],'attributes':_0xfbed86[_0x3831('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3831('0x10')](function(_0x314195){logger[_0x3831('0x11')]('GetOpenchannelQueue',_0x574918);logger[_0x3831('0x14')](_0x3831('0x1b'),_0x574918,JSON[_0x3831('0x16')](_0x314195));_0x379833(_0x314195);})[_0x3831('0x25')](function(_0x28a76b){logger[_0x3831('0x17')](_0x3831('0x1b'),_0x28a76b[_0x3831('0x19')],_0x574918);_0x38beb4(_0xfffa92[_0x3831('0x17')](0x1f4,_0x28a76b[_0x3831('0x19')]));});});};exports[_0x3831('0x26')]=function(_0x45fe03){var _0x39d83f=this;return new Promise(function(_0x462bdf,_0x5d8591){return db[_0x3831('0x1c')][_0x3831('0x27')]({'raw':_0x45fe03[_0x3831('0x1e')]?_0x45fe03[_0x3831('0x1e')][_0x3831('0x28')]===undefined?!![]:![]:!![],'where':_0x45fe03[_0x3831('0x1e')]?_0x45fe03[_0x3831('0x1e')]['where']||null:null,'attributes':_0x45fe03[_0x3831('0x1e')]?_0x45fe03[_0x3831('0x1e')]['attributes']||null:null,'include':_0x45fe03[_0x3831('0x1e')]?_0x45fe03[_0x3831('0x1e')]['include']?_[_0x3831('0x24')](_0x45fe03['options'][_0x3831('0x22')],function(_0x109bbe){return{'model':db[_0x109bbe['model']],'as':_0x109bbe['as'],'attributes':_0x109bbe[_0x3831('0x20')],'include':_0x109bbe[_0x3831('0x22')]?_[_0x3831('0x24')](_0x109bbe['include'],function(_0x22e9f3){return{'model':db[_0x22e9f3['model']],'as':_0x22e9f3['as'],'attributes':_0x22e9f3[_0x3831('0x20')],'include':_0x22e9f3[_0x3831('0x22')]?_[_0x3831('0x24')](_0x22e9f3[_0x3831('0x22')],function(_0x45adc3){return{'model':db[_0x45adc3[_0x3831('0x23')]],'as':_0x45adc3['as'],'attributes':_0x45adc3[_0x3831('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3137b9){logger[_0x3831('0x11')](_0x3831('0x26'),_0x45fe03);logger[_0x3831('0x14')](_0x3831('0x26'),_0x45fe03,JSON[_0x3831('0x16')](_0x3137b9));_0x462bdf(_0x3137b9);})[_0x3831('0x25')](function(_0x16c973){logger[_0x3831('0x17')]('ShowOpenchannelQueue',_0x16c973['message'],_0x45fe03);_0x5d8591(_0x39d83f[_0x3831('0x17')](0x1f4,_0x16c973['message']));});});}; \ No newline at end of file +var _0xd0b0=['http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xe096fd,_0x221b15){var _0x116b36=function(_0xa4436a){while(--_0xa4436a){_0xe096fd['push'](_0xe096fd['shift']());}};_0x116b36(++_0x221b15);}(_0xd0b0,0x135));var _0x0d0b=function(_0x39238c,_0x4cc91c){_0x39238c=_0x39238c-0x0;var _0xfa45b3=_0xd0b0[_0x39238c];return _0xfa45b3;};'use strict';var _=require(_0x0d0b('0x0'));var util=require(_0x0d0b('0x1'));var moment=require(_0x0d0b('0x2'));var BPromise=require(_0x0d0b('0x3'));var rs=require(_0x0d0b('0x4'));var fs=require('fs');var Redis=require(_0x0d0b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d0b('0x6'));var logger=require(_0x0d0b('0x7'))(_0x0d0b('0x8'));var config=require(_0x0d0b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0d0b('0xa')][_0x0d0b('0xb')]({'port':0x232a});config[_0x0d0b('0xc')]=_[_0x0d0b('0xd')](config[_0x0d0b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d0b('0xe'))(new Redis(config['redis']));require(_0x0d0b('0xf'))['register'](socket);function respondWithRpcPromise(_0x2723dd,_0x5db5a1,_0x494e79){return new BPromise(function(_0x31488e,_0x41dc79){return client[_0x0d0b('0x10')](_0x2723dd,_0x494e79)['then'](function(_0x2cd832){logger[_0x0d0b('0x11')](_0x0d0b('0x12'),_0x5db5a1,_0x0d0b('0x13'));logger[_0x0d0b('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5db5a1,_0x0d0b('0x13'),JSON[_0x0d0b('0x15')](_0x2cd832));if(_0x2cd832[_0x0d0b('0x16')]){if(_0x2cd832[_0x0d0b('0x16')]['code']===0x1f4){logger[_0x0d0b('0x16')](_0x0d0b('0x12'),_0x5db5a1,_0x2cd832[_0x0d0b('0x16')][_0x0d0b('0x17')]);return _0x41dc79(_0x2cd832[_0x0d0b('0x16')][_0x0d0b('0x17')]);}logger[_0x0d0b('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5db5a1,_0x2cd832[_0x0d0b('0x16')][_0x0d0b('0x17')]);return _0x31488e(_0x2cd832[_0x0d0b('0x16')][_0x0d0b('0x17')]);}else{logger[_0x0d0b('0x11')](_0x0d0b('0x12'),_0x5db5a1,_0x0d0b('0x13'));_0x31488e(_0x2cd832[_0x0d0b('0x18')][_0x0d0b('0x17')]);}})[_0x0d0b('0x19')](function(_0x50711a){logger[_0x0d0b('0x16')](_0x0d0b('0x12'),_0x5db5a1,_0x50711a);_0x41dc79(_0x50711a);});});}exports[_0x0d0b('0x1a')]=function(_0x5d54a5){var _0x49a868=this;return new Promise(function(_0x50eafd,_0x29a600){return db[_0x0d0b('0x1b')][_0x0d0b('0x1c')]({'raw':_0x5d54a5[_0x0d0b('0x1d')]?_0x5d54a5[_0x0d0b('0x1d')][_0x0d0b('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d54a5[_0x0d0b('0x1d')]?_0x5d54a5['options'][_0x0d0b('0x1f')]||null:null,'attributes':_0x5d54a5['options']?_0x5d54a5[_0x0d0b('0x1d')]['attributes']||null:null,'limit':_0x5d54a5[_0x0d0b('0x1d')]?_0x5d54a5[_0x0d0b('0x1d')][_0x0d0b('0x20')]||null:null,'include':_0x5d54a5[_0x0d0b('0x1d')]?_0x5d54a5[_0x0d0b('0x1d')][_0x0d0b('0x21')]?_[_0x0d0b('0x22')](_0x5d54a5[_0x0d0b('0x1d')][_0x0d0b('0x21')],function(_0x54f987){return{'model':db[_0x54f987[_0x0d0b('0x23')]],'as':_0x54f987['as'],'attributes':_0x54f987[_0x0d0b('0x24')],'include':_0x54f987['include']?_[_0x0d0b('0x22')](_0x54f987['include'],function(_0x3936e5){return{'model':db[_0x3936e5[_0x0d0b('0x23')]],'as':_0x3936e5['as'],'attributes':_0x3936e5['attributes'],'include':_0x3936e5['include']?_[_0x0d0b('0x22')](_0x3936e5['include'],function(_0x1bf5ba){return{'model':db[_0x1bf5ba[_0x0d0b('0x23')]],'as':_0x1bf5ba['as'],'attributes':_0x1bf5ba['attributes']};}):[]};}):[]};}):[]:[]})[_0x0d0b('0x25')](function(_0x21d6bb){logger[_0x0d0b('0x11')](_0x0d0b('0x1a'),_0x5d54a5);logger[_0x0d0b('0x14')](_0x0d0b('0x1a'),_0x5d54a5,JSON[_0x0d0b('0x15')](_0x21d6bb));_0x50eafd(_0x21d6bb);})[_0x0d0b('0x19')](function(_0x2f3345){logger[_0x0d0b('0x16')](_0x0d0b('0x1a'),_0x2f3345['message'],_0x5d54a5);_0x29a600(_0x49a868[_0x0d0b('0x16')](0x1f4,_0x2f3345[_0x0d0b('0x17')]));});});};exports[_0x0d0b('0x26')]=function(_0x31a83d){var _0x22e8e1=this;return new Promise(function(_0x34f026,_0x839c30){return db[_0x0d0b('0x1b')][_0x0d0b('0x27')]({'raw':_0x31a83d['options']?_0x31a83d['options']['raw']===undefined?!![]:![]:!![],'where':_0x31a83d[_0x0d0b('0x1d')]?_0x31a83d[_0x0d0b('0x1d')][_0x0d0b('0x1f')]||null:null,'attributes':_0x31a83d[_0x0d0b('0x1d')]?_0x31a83d[_0x0d0b('0x1d')][_0x0d0b('0x24')]||null:null,'include':_0x31a83d[_0x0d0b('0x1d')]?_0x31a83d[_0x0d0b('0x1d')][_0x0d0b('0x21')]?_[_0x0d0b('0x22')](_0x31a83d[_0x0d0b('0x1d')]['include'],function(_0x4aaddc){return{'model':db[_0x4aaddc[_0x0d0b('0x23')]],'as':_0x4aaddc['as'],'attributes':_0x4aaddc['attributes'],'include':_0x4aaddc[_0x0d0b('0x21')]?_[_0x0d0b('0x22')](_0x4aaddc[_0x0d0b('0x21')],function(_0x8fc63d){return{'model':db[_0x8fc63d[_0x0d0b('0x23')]],'as':_0x8fc63d['as'],'attributes':_0x8fc63d[_0x0d0b('0x24')],'include':_0x8fc63d[_0x0d0b('0x21')]?_[_0x0d0b('0x22')](_0x8fc63d[_0x0d0b('0x21')],function(_0x29420e){return{'model':db[_0x29420e[_0x0d0b('0x23')]],'as':_0x29420e['as'],'attributes':_0x29420e[_0x0d0b('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0d0b('0x25')](function(_0x29663f){logger['info'](_0x0d0b('0x26'),_0x31a83d);logger[_0x0d0b('0x14')]('ShowOpenchannelQueue',_0x31a83d,JSON[_0x0d0b('0x15')](_0x29663f));_0x34f026(_0x29663f);})[_0x0d0b('0x19')](function(_0x1d5b14){logger['error'](_0x0d0b('0x26'),_0x1d5b14[_0x0d0b('0x17')],_0x31a83d);_0x839c30(_0x22e8e1['error'](0x1f4,_0x1d5b14[_0x0d0b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5542b9a..f2a0d43 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 _0x401a=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x3c769d,_0x215272){var _0x1c19e2=function(_0x3ddc0d){while(--_0x3ddc0d){_0x3c769d['push'](_0x3c769d['shift']());}};_0x1c19e2(++_0x215272);}(_0x401a,0x17b));var _0xa401=function(_0x49a355,_0x55809f){_0x49a355=_0x49a355-0x0;var _0x2b0b2f=_0x401a[_0x49a355];return _0x2b0b2f;};'use strict';var OpenchannelQueueEvents=require(_0xa401('0x0'));var events=[_0xa401('0x1'),_0xa401('0x2'),_0xa401('0x3')];function createListener(_0xe84a90,_0x6f800f){return function(_0x51fc3e){_0x6f800f[_0xa401('0x4')](_0xe84a90,_0x51fc3e);};}function removeListener(_0x3a795c,_0x542feb){return function(){OpenchannelQueueEvents[_0xa401('0x5')](_0x3a795c,_0x542feb);};}exports['register']=function(_0x445d4e){for(var _0x5bd7ef=0x0,_0x3559dd=events['length'];_0x5bd7ef<_0x3559dd;_0x5bd7ef++){var _0x10c9f5=events[_0x5bd7ef];var _0x11d6e3=createListener(_0xa401('0x6')+_0x10c9f5,_0x445d4e);OpenchannelQueueEvents['on'](_0x10c9f5,_0x11d6e3);}}; \ No newline at end of file +var _0x8057=['remove','update','emit','removeListener','openchannelQueue:'];(function(_0x340f62,_0x42d4a3){var _0x82a7d8=function(_0x3b0487){while(--_0x3b0487){_0x340f62['push'](_0x340f62['shift']());}};_0x82a7d8(++_0x42d4a3);}(_0x8057,0x140));var _0x7805=function(_0x4ed891,_0x5d3a1e){_0x4ed891=_0x4ed891-0x0;var _0xe5fce3=_0x8057[_0x4ed891];return _0xe5fce3;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0x7805('0x0'),_0x7805('0x1')];function createListener(_0x581d25,_0x396fad){return function(_0x42fcf7){_0x396fad[_0x7805('0x2')](_0x581d25,_0x42fcf7);};}function removeListener(_0x5f2844,_0x4e9a91){return function(){OpenchannelQueueEvents[_0x7805('0x3')](_0x5f2844,_0x4e9a91);};}exports['register']=function(_0x2ed71d){for(var _0xf2715b=0x0,_0x43df01=events['length'];_0xf2715b<_0x43df01;_0xf2715b++){var _0x132ac1=events[_0xf2715b];var _0x5318af=createListener(_0x7805('0x4')+_0x132ac1,_0x2ed71d);OpenchannelQueueEvents['on'](_0x132ac1,_0x5318af);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e0b8442..c8ab065 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 _0xf35c=['./openchannelQueueReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3802a1,_0x2ef1f6){var _0x3bff59=function(_0x2a6fc0){while(--_0x2a6fc0){_0x3802a1['push'](_0x3802a1['shift']());}};_0x3bff59(++_0x2ef1f6);}(_0xf35c,0xe8));var _0xcf35=function(_0x375fbc,_0x5cb01d){_0x375fbc=_0x375fbc-0x0;var _0x12dae4=_0xf35c[_0x375fbc];return _0x12dae4;};'use strict';var multer=require('multer');var util=require(_0xcf35('0x0'));var path=require(_0xcf35('0x1'));var timeout=require(_0xcf35('0x2'));var express=require(_0xcf35('0x3'));var router=express['Router']();var fs_extra=require(_0xcf35('0x4'));var auth=require(_0xcf35('0x5'));var interaction=require(_0xcf35('0x6'));var config=require(_0xcf35('0x7'));var controller=require(_0xcf35('0x8'));router[_0xcf35('0x9')]('/',auth[_0xcf35('0xa')](),controller['index']);router['get']('/describe',auth[_0xcf35('0xa')](),controller['describe']);router[_0xcf35('0x9')](_0xcf35('0xb'),auth[_0xcf35('0xa')](),controller[_0xcf35('0xc')]);router[_0xcf35('0xd')]('/',auth[_0xcf35('0xa')](),controller[_0xcf35('0xe')]);router[_0xcf35('0xf')](_0xcf35('0xb'),auth[_0xcf35('0xa')](),controller[_0xcf35('0x10')]);router[_0xcf35('0x11')](_0xcf35('0xb'),auth[_0xcf35('0xa')](),controller[_0xcf35('0x12')]);module[_0xcf35('0x13')]=router; \ No newline at end of file +var _0x7c6d=['post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x7c6d,0xd6));var _0xd7c6=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x7c6d[_0x2cf2e9];return _0xd3670d;};'use strict';var multer=require(_0xd7c6('0x0'));var util=require('util');var path=require(_0xd7c6('0x1'));var timeout=require(_0xd7c6('0x2'));var express=require(_0xd7c6('0x3'));var router=express[_0xd7c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd7c6('0x5'));var config=require('../../config/environment');var controller=require(_0xd7c6('0x6'));router[_0xd7c6('0x7')]('/',auth['isAuthenticated'](),controller[_0xd7c6('0x8')]);router['get'](_0xd7c6('0x9'),auth[_0xd7c6('0xa')](),controller[_0xd7c6('0xb')]);router['get'](_0xd7c6('0xc'),auth['isAuthenticated'](),controller[_0xd7c6('0xd')]);router[_0xd7c6('0xe')]('/',auth[_0xd7c6('0xa')](),controller[_0xd7c6('0xf')]);router[_0xd7c6('0x10')](_0xd7c6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd7c6('0x11')](_0xd7c6('0xc'),auth[_0xd7c6('0xa')](),controller['destroy']);module[_0xd7c6('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 62de24f..13c1578 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 _0xbfbd=['exports','STRING','DATE','moment','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbfbd,0x102));var _0xdbfb=function(_0x565b27,_0xc538f4){_0x565b27=_0x565b27-0x0;var _0x55c33a=_0xbfbd[_0x565b27];return _0x55c33a;};'use strict';var moment=require(_0xdbfb('0x0'));var Sequelize=require(_0xdbfb('0x1'));module[_0xdbfb('0x2')]={'uniqueid':{'type':Sequelize[_0xdbfb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdbfb('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdbfb('0x4')]},'exitAt':{'type':Sequelize[_0xdbfb('0x4')]},'reason':{'type':Sequelize[_0xdbfb('0x3')]}}; \ No newline at end of file +var _0xb2be=['sequelize','exports','STRING','DATE','moment'];(function(_0x5d72c8,_0x85e2e1){var _0x3abc9e=function(_0x1311b){while(--_0x1311b){_0x5d72c8['push'](_0x5d72c8['shift']());}};_0x3abc9e(++_0x85e2e1);}(_0xb2be,0x1da));var _0xeb2b=function(_0x14d250,_0x4b2e12){_0x14d250=_0x14d250-0x0;var _0xb991d8=_0xb2be[_0x14d250];return _0xb991d8;};'use strict';var moment=require(_0xeb2b('0x0'));var Sequelize=require(_0xeb2b('0x1'));module[_0xeb2b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xeb2b('0x3')]},'joinAt':{'type':Sequelize[_0xeb2b('0x4')]},'leaveAt':{'type':Sequelize[_0xeb2b('0x4')]},'acceptAt':{'type':Sequelize[_0xeb2b('0x4')]},'exitAt':{'type':Sequelize[_0xeb2b('0x4')]},'reason':{'type':Sequelize[_0xeb2b('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 95d1120..3ec8e2e 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 _0x43c8=['include','OpenchannelQueueReport','findAll','catch','show','params','includeAll','find','create','body','destroy','describe','zip-dir','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x43c8,0x183));var _0x843c=function(_0x118a15,_0x1c3d29){_0x118a15=_0x118a15-0x0;var _0x37d179=_0x43c8[_0x118a15];return _0x37d179;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x843c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x843c('0x1'));var moment=require(_0x843c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x843c('0x3'));var util=require(_0x843c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x843c('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x843c('0x6'));var _=require(_0x843c('0x7'));var squel=require('squel');var crypto=require(_0x843c('0x8'));var jsforce=require(_0x843c('0x9'));var deskjs=require(_0x843c('0xa'));var toCsv=require(_0x843c('0x5'));var querystring=require(_0x843c('0xb'));var Papa=require(_0x843c('0xc'));var Redis=require(_0x843c('0xd'));var authService=require(_0x843c('0xe'));var qs=require(_0x843c('0xf'));var as=require(_0x843c('0x10'));var hardwareService=require(_0x843c('0x11'));var logger=require(_0x843c('0x12'))('api');var utils=require(_0x843c('0x13'));var config=require(_0x843c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x843c('0x15'))['db'];function respondWithStatusCode(_0x3d11a7,_0x31f68d){_0x31f68d=_0x31f68d||0xcc;return function(_0x13a4c4){if(_0x13a4c4){return _0x3d11a7[_0x843c('0x16')](_0x31f68d);}return _0x3d11a7[_0x843c('0x17')](_0x31f68d)['end']();};}function respondWithResult(_0x22a80f,_0x581c22){_0x581c22=_0x581c22||0xc8;return function(_0x2e22d8){if(_0x2e22d8){return _0x22a80f[_0x843c('0x17')](_0x581c22)[_0x843c('0x18')](_0x2e22d8);}};}function respondWithFilteredResult(_0x233423,_0x3c2937){return function(_0x40633c){if(_0x40633c){var _0x2d47a7=typeof _0x3c2937[_0x843c('0x19')]==='undefined'&&typeof _0x3c2937[_0x843c('0x1a')]==='undefined';var _0x12e45c=_0x40633c[_0x843c('0x1b')];var _0x3794fe=_0x2d47a7?0x0:_0x3c2937[_0x843c('0x19')];var _0x351279=_0x2d47a7?_0x40633c['count']:_0x3c2937[_0x843c('0x19')]+_0x3c2937[_0x843c('0x1a')];var _0x446ca3;if(_0x351279>=_0x12e45c){_0x351279=_0x12e45c;_0x446ca3=0xc8;}else{_0x446ca3=0xce;}_0x233423[_0x843c('0x17')](_0x446ca3);return _0x233423[_0x843c('0x1c')](_0x843c('0x1d'),_0x3794fe+'-'+_0x351279+'/'+_0x12e45c)[_0x843c('0x18')](_0x40633c);}return null;};}function patchUpdates(_0x55c26d){return function(_0x43c0fe){try{jsonpatch[_0x843c('0x1e')](_0x43c0fe,_0x55c26d,!![]);}catch(_0x1e5588){return BPromise[_0x843c('0x1f')](_0x1e5588);}return _0x43c0fe[_0x843c('0x20')]();};}function saveUpdates(_0x79e7f2,_0x50626f){return function(_0x17454f){if(_0x17454f){return _0x17454f[_0x843c('0x21')](_0x79e7f2)[_0x843c('0x22')](function(_0x11ed99){return _0x11ed99;});}return null;};}function removeEntity(_0x2664e3,_0x2098e4){return function(_0x3f5cd9){if(_0x3f5cd9){return _0x3f5cd9['destroy']()[_0x843c('0x22')](function(){_0x2664e3['status'](0xcc)[_0x843c('0x23')]();});}};}function handleEntityNotFound(_0x64c00d,_0x3e13c8){return function(_0x19caa1){if(!_0x19caa1){_0x64c00d[_0x843c('0x16')](0x194);}return _0x19caa1;};}function handleError(_0x534ac1,_0x9c33cc){_0x9c33cc=_0x9c33cc||0x1f4;return function(_0x24eaff){logger[_0x843c('0x24')](_0x24eaff[_0x843c('0x25')]);if(_0x24eaff[_0x843c('0x26')]){delete _0x24eaff[_0x843c('0x26')];}_0x534ac1['status'](_0x9c33cc)[_0x843c('0x27')](_0x24eaff);};}exports[_0x843c('0x28')]=function(_0x46761c,_0x21d539){var _0x240bef={},_0x1e7f16={},_0x497add={'count':0x0,'rows':[]};var _0x541019=_['map'](db['OpenchannelQueueReport'][_0x843c('0x29')],function(_0x39359f){return{'name':_0x39359f[_0x843c('0x2a')],'type':_0x39359f['type'][_0x843c('0x2b')]};});_0x1e7f16[_0x843c('0x2c')]=_[_0x843c('0x2d')](_0x541019,_0x843c('0x26'));_0x1e7f16[_0x843c('0x2e')]=_[_0x843c('0x2f')](_0x46761c['query']);_0x1e7f16[_0x843c('0x30')]=_[_0x843c('0x31')](_0x1e7f16[_0x843c('0x2c')],_0x1e7f16['query']);_0x240bef['attributes']=_[_0x843c('0x31')](_0x1e7f16[_0x843c('0x2c')],qs[_0x843c('0x32')](_0x46761c[_0x843c('0x2e')]['fields']));_0x240bef['attributes']=_0x240bef[_0x843c('0x33')][_0x843c('0x34')]?_0x240bef[_0x843c('0x33')]:_0x1e7f16[_0x843c('0x2c')];if(!_0x46761c['query'][_0x843c('0x35')](_0x843c('0x36'))){_0x240bef[_0x843c('0x1a')]=qs['limit'](_0x46761c['query']['limit']);_0x240bef[_0x843c('0x19')]=qs['offset'](_0x46761c[_0x843c('0x2e')][_0x843c('0x19')]);}_0x240bef[_0x843c('0x37')]=qs[_0x843c('0x38')](_0x46761c[_0x843c('0x2e')][_0x843c('0x38')]);_0x240bef[_0x843c('0x39')]=qs[_0x843c('0x30')](_[_0x843c('0x3a')](_0x46761c[_0x843c('0x2e')],_0x1e7f16[_0x843c('0x30')]),_0x541019);if(_0x46761c[_0x843c('0x2e')][_0x843c('0x3b')]){_0x240bef[_0x843c('0x39')]=_[_0x843c('0x3c')](_0x240bef[_0x843c('0x39')],{'$or':_['map'](_0x541019,function(_0x3f0c4d){if(_0x3f0c4d[_0x843c('0x3d')]!=='VIRTUAL'){var _0x21c4bc={};_0x21c4bc[_0x3f0c4d['name']]={'$like':'%'+_0x46761c[_0x843c('0x2e')]['filter']+'%'};return _0x21c4bc;}})});}_0x240bef=_['merge']({},_0x240bef,_0x46761c[_0x843c('0x3e')]);var _0x4b5511={'where':_0x240bef[_0x843c('0x39')]};return db['OpenchannelQueueReport'][_0x843c('0x1b')](_0x4b5511)[_0x843c('0x22')](function(_0x25512f){_0x497add['count']=_0x25512f;if(_0x46761c[_0x843c('0x2e')]['includeAll']){_0x240bef[_0x843c('0x3f')]=[{'all':!![]}];}return db[_0x843c('0x40')][_0x843c('0x41')](_0x240bef);})['then'](function(_0x1f998c){_0x497add['rows']=_0x1f998c;return _0x497add;})['then'](respondWithFilteredResult(_0x21d539,_0x240bef))[_0x843c('0x42')](handleError(_0x21d539,null));};exports[_0x843c('0x43')]=function(_0x4c11e0,_0x15df18){var _0x1c39b3={'raw':!![],'where':{'id':_0x4c11e0[_0x843c('0x44')]['id']}},_0x360a3b={};_0x360a3b['model']=_[_0x843c('0x2f')](db[_0x843c('0x40')][_0x843c('0x29')]);_0x360a3b[_0x843c('0x2e')]=_['keys'](_0x4c11e0[_0x843c('0x2e')]);_0x360a3b['filters']=_[_0x843c('0x31')](_0x360a3b['model'],_0x360a3b[_0x843c('0x2e')]);_0x1c39b3[_0x843c('0x33')]=_[_0x843c('0x31')](_0x360a3b[_0x843c('0x2c')],qs[_0x843c('0x32')](_0x4c11e0[_0x843c('0x2e')][_0x843c('0x32')]));_0x1c39b3[_0x843c('0x33')]=_0x1c39b3['attributes'][_0x843c('0x34')]?_0x1c39b3[_0x843c('0x33')]:_0x360a3b[_0x843c('0x2c')];if(_0x4c11e0['query'][_0x843c('0x45')]){_0x1c39b3['include']=[{'all':!![]}];}_0x1c39b3=_[_0x843c('0x3c')]({},_0x1c39b3,_0x4c11e0['options']);return db['OpenchannelQueueReport'][_0x843c('0x46')](_0x1c39b3)['then'](handleEntityNotFound(_0x15df18,null))[_0x843c('0x22')](respondWithResult(_0x15df18,null))[_0x843c('0x42')](handleError(_0x15df18,null));};exports[_0x843c('0x47')]=function(_0x407aef,_0x5040ac){return db[_0x843c('0x40')][_0x843c('0x47')](_0x407aef[_0x843c('0x48')],{})[_0x843c('0x22')](respondWithResult(_0x5040ac,0xc9))[_0x843c('0x42')](handleError(_0x5040ac,null));};exports[_0x843c('0x21')]=function(_0x1bcb2c,_0x48e5b9){if(_0x1bcb2c[_0x843c('0x48')]['id']){delete _0x1bcb2c['body']['id'];}return db[_0x843c('0x40')][_0x843c('0x46')]({'where':{'id':_0x1bcb2c['params']['id']}})[_0x843c('0x22')](handleEntityNotFound(_0x48e5b9,null))[_0x843c('0x22')](saveUpdates(_0x1bcb2c['body'],null))['then'](respondWithResult(_0x48e5b9,null))[_0x843c('0x42')](handleError(_0x48e5b9,null));};exports[_0x843c('0x49')]=function(_0x230084,_0x3ef856){return db[_0x843c('0x40')][_0x843c('0x46')]({'where':{'id':_0x230084['params']['id']}})[_0x843c('0x22')](handleEntityNotFound(_0x3ef856,null))['then'](removeEntity(_0x3ef856,null))['catch'](handleError(_0x3ef856,null));};exports[_0x843c('0x4a')]=function(_0x1b1a97,_0x5123a2){return db[_0x843c('0x40')][_0x843c('0x4a')]()[_0x843c('0x22')](respondWithResult(_0x5123a2,null))[_0x843c('0x42')](handleError(_0x5123a2,null));}; \ No newline at end of file +var _0x7c4d=['util','path','sox','ejs','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c4d,0x19e));var _0xd7c4=function(_0x4fcca6,_0x29466d){_0x4fcca6=_0x4fcca6-0x0;var _0x2719a0=_0x7c4d[_0x4fcca6];return _0x2719a0;};'use strict';var emlformat=require(_0xd7c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd7c4('0x1'));var jsonpatch=require(_0xd7c4('0x2'));var rp=require('request-promise');var moment=require(_0xd7c4('0x3'));var BPromise=require(_0xd7c4('0x4'));var Mustache=require(_0xd7c4('0x5'));var util=require(_0xd7c4('0x6'));var path=require(_0xd7c4('0x7'));var sox=require(_0xd7c4('0x8'));var csv=require('to-csv');var ejs=require(_0xd7c4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd7c4('0xa'));var squel=require(_0xd7c4('0xb'));var crypto=require(_0xd7c4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd7c4('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd7c4('0xe'));var authService=require(_0xd7c4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd7c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7c4('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd7c4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7c4('0x13'))['db'];function respondWithStatusCode(_0x1f9e40,_0x1ef23e){_0x1ef23e=_0x1ef23e||0xcc;return function(_0x3495fb){if(_0x3495fb){return _0x1f9e40[_0xd7c4('0x14')](_0x1ef23e);}return _0x1f9e40[_0xd7c4('0x15')](_0x1ef23e)[_0xd7c4('0x16')]();};}function respondWithResult(_0x450950,_0x1eb670){_0x1eb670=_0x1eb670||0xc8;return function(_0x55561e){if(_0x55561e){return _0x450950[_0xd7c4('0x15')](_0x1eb670)[_0xd7c4('0x17')](_0x55561e);}};}function respondWithFilteredResult(_0x4dc5b3,_0x5a9824){return function(_0x57b1b1){if(_0x57b1b1){var _0x31b077=typeof _0x5a9824['offset']===_0xd7c4('0x18')&&typeof _0x5a9824['limit']==='undefined';var _0xe7bc29=_0x57b1b1[_0xd7c4('0x19')];var _0x52d224=_0x31b077?0x0:_0x5a9824[_0xd7c4('0x1a')];var _0x5280c6=_0x31b077?_0x57b1b1[_0xd7c4('0x19')]:_0x5a9824[_0xd7c4('0x1a')]+_0x5a9824[_0xd7c4('0x1b')];var _0x1ba719;if(_0x5280c6>=_0xe7bc29){_0x5280c6=_0xe7bc29;_0x1ba719=0xc8;}else{_0x1ba719=0xce;}_0x4dc5b3['status'](_0x1ba719);return _0x4dc5b3[_0xd7c4('0x1c')]('Content-Range',_0x52d224+'-'+_0x5280c6+'/'+_0xe7bc29)[_0xd7c4('0x17')](_0x57b1b1);}return null;};}function patchUpdates(_0x296ee9){return function(_0x4e4102){try{jsonpatch[_0xd7c4('0x1d')](_0x4e4102,_0x296ee9,!![]);}catch(_0x5ac268){return BPromise[_0xd7c4('0x1e')](_0x5ac268);}return _0x4e4102[_0xd7c4('0x1f')]();};}function saveUpdates(_0x20e8d1,_0x3aa0f8){return function(_0x1d3598){if(_0x1d3598){return _0x1d3598[_0xd7c4('0x20')](_0x20e8d1)[_0xd7c4('0x21')](function(_0x5f53b7){return _0x5f53b7;});}return null;};}function removeEntity(_0x38c3e6,_0x601dfb){return function(_0x40c8f8){if(_0x40c8f8){return _0x40c8f8[_0xd7c4('0x22')]()[_0xd7c4('0x21')](function(){_0x38c3e6['status'](0xcc)[_0xd7c4('0x16')]();});}};}function handleEntityNotFound(_0x3cab71,_0x3ae19a){return function(_0x533d80){if(!_0x533d80){_0x3cab71[_0xd7c4('0x14')](0x194);}return _0x533d80;};}function handleError(_0x25943e,_0x879b06){_0x879b06=_0x879b06||0x1f4;return function(_0x207a3f){logger[_0xd7c4('0x23')](_0x207a3f['stack']);if(_0x207a3f[_0xd7c4('0x24')]){delete _0x207a3f['name'];}_0x25943e[_0xd7c4('0x15')](_0x879b06)['send'](_0x207a3f);};}exports['index']=function(_0x586581,_0x34d1ef){var _0x4cf90e={},_0x1fdc74={},_0x212295={'count':0x0,'rows':[]};var _0x43a9d9=_[_0xd7c4('0x25')](db[_0xd7c4('0x26')][_0xd7c4('0x27')],function(_0x1fe603){return{'name':_0x1fe603[_0xd7c4('0x28')],'type':_0x1fe603[_0xd7c4('0x29')][_0xd7c4('0x2a')]};});_0x1fdc74['model']=_[_0xd7c4('0x25')](_0x43a9d9,_0xd7c4('0x24'));_0x1fdc74[_0xd7c4('0x2b')]=_['keys'](_0x586581['query']);_0x1fdc74[_0xd7c4('0x2c')]=_[_0xd7c4('0x2d')](_0x1fdc74[_0xd7c4('0x2e')],_0x1fdc74[_0xd7c4('0x2b')]);_0x4cf90e[_0xd7c4('0x2f')]=_[_0xd7c4('0x2d')](_0x1fdc74[_0xd7c4('0x2e')],qs[_0xd7c4('0x30')](_0x586581['query']['fields']));_0x4cf90e['attributes']=_0x4cf90e['attributes'][_0xd7c4('0x31')]?_0x4cf90e[_0xd7c4('0x2f')]:_0x1fdc74[_0xd7c4('0x2e')];if(!_0x586581['query']['hasOwnProperty'](_0xd7c4('0x32'))){_0x4cf90e[_0xd7c4('0x1b')]=qs[_0xd7c4('0x1b')](_0x586581[_0xd7c4('0x2b')]['limit']);_0x4cf90e['offset']=qs[_0xd7c4('0x1a')](_0x586581['query'][_0xd7c4('0x1a')]);}_0x4cf90e[_0xd7c4('0x33')]=qs['sort'](_0x586581['query'][_0xd7c4('0x34')]);_0x4cf90e[_0xd7c4('0x35')]=qs['filters'](_[_0xd7c4('0x36')](_0x586581['query'],_0x1fdc74['filters']),_0x43a9d9);if(_0x586581[_0xd7c4('0x2b')][_0xd7c4('0x37')]){_0x4cf90e['where']=_[_0xd7c4('0x38')](_0x4cf90e[_0xd7c4('0x35')],{'$or':_[_0xd7c4('0x25')](_0x43a9d9,function(_0x350207){if(_0x350207[_0xd7c4('0x29')]!=='VIRTUAL'){var _0x8ca82b={};_0x8ca82b[_0x350207['name']]={'$like':'%'+_0x586581[_0xd7c4('0x2b')][_0xd7c4('0x37')]+'%'};return _0x8ca82b;}})});}_0x4cf90e=_[_0xd7c4('0x38')]({},_0x4cf90e,_0x586581[_0xd7c4('0x39')]);var _0x5e8a93={'where':_0x4cf90e[_0xd7c4('0x35')]};return db['OpenchannelQueueReport']['count'](_0x5e8a93)['then'](function(_0x57c728){_0x212295[_0xd7c4('0x19')]=_0x57c728;if(_0x586581[_0xd7c4('0x2b')][_0xd7c4('0x3a')]){_0x4cf90e[_0xd7c4('0x3b')]=[{'all':!![]}];}return db[_0xd7c4('0x26')][_0xd7c4('0x3c')](_0x4cf90e);})[_0xd7c4('0x21')](function(_0x148f3a){_0x212295[_0xd7c4('0x3d')]=_0x148f3a;return _0x212295;})[_0xd7c4('0x21')](respondWithFilteredResult(_0x34d1ef,_0x4cf90e))['catch'](handleError(_0x34d1ef,null));};exports[_0xd7c4('0x3e')]=function(_0x1a081e,_0x1825fa){var _0x1fa606={'raw':!![],'where':{'id':_0x1a081e[_0xd7c4('0x3f')]['id']}},_0x3f96ff={};_0x3f96ff[_0xd7c4('0x2e')]=_['keys'](db[_0xd7c4('0x26')][_0xd7c4('0x27')]);_0x3f96ff['query']=_[_0xd7c4('0x40')](_0x1a081e[_0xd7c4('0x2b')]);_0x3f96ff['filters']=_[_0xd7c4('0x2d')](_0x3f96ff['model'],_0x3f96ff['query']);_0x1fa606['attributes']=_['intersection'](_0x3f96ff['model'],qs[_0xd7c4('0x30')](_0x1a081e[_0xd7c4('0x2b')]['fields']));_0x1fa606[_0xd7c4('0x2f')]=_0x1fa606[_0xd7c4('0x2f')][_0xd7c4('0x31')]?_0x1fa606['attributes']:_0x3f96ff[_0xd7c4('0x2e')];if(_0x1a081e[_0xd7c4('0x2b')][_0xd7c4('0x3a')]){_0x1fa606[_0xd7c4('0x3b')]=[{'all':!![]}];}_0x1fa606=_['merge']({},_0x1fa606,_0x1a081e[_0xd7c4('0x39')]);return db[_0xd7c4('0x26')]['find'](_0x1fa606)[_0xd7c4('0x21')](handleEntityNotFound(_0x1825fa,null))[_0xd7c4('0x21')](respondWithResult(_0x1825fa,null))[_0xd7c4('0x41')](handleError(_0x1825fa,null));};exports[_0xd7c4('0x42')]=function(_0x1fa873,_0x587226){return db['OpenchannelQueueReport'][_0xd7c4('0x42')](_0x1fa873[_0xd7c4('0x43')],{})[_0xd7c4('0x21')](respondWithResult(_0x587226,0xc9))['catch'](handleError(_0x587226,null));};exports[_0xd7c4('0x20')]=function(_0x212e13,_0x1b4dcd){if(_0x212e13[_0xd7c4('0x43')]['id']){delete _0x212e13[_0xd7c4('0x43')]['id'];}return db[_0xd7c4('0x26')][_0xd7c4('0x44')]({'where':{'id':_0x212e13[_0xd7c4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1b4dcd,null))[_0xd7c4('0x21')](saveUpdates(_0x212e13[_0xd7c4('0x43')],null))[_0xd7c4('0x21')](respondWithResult(_0x1b4dcd,null))['catch'](handleError(_0x1b4dcd,null));};exports[_0xd7c4('0x22')]=function(_0x2d0456,_0x2a6773){return db[_0xd7c4('0x26')]['find']({'where':{'id':_0x2d0456['params']['id']}})[_0xd7c4('0x21')](handleEntityNotFound(_0x2a6773,null))[_0xd7c4('0x21')](removeEntity(_0x2a6773,null))[_0xd7c4('0x41')](handleError(_0x2a6773,null));};exports[_0xd7c4('0x45')]=function(_0xbd1232,_0x14905f){return db[_0xd7c4('0x26')][_0xd7c4('0x45')]()[_0xd7c4('0x21')](respondWithResult(_0x14905f,null))[_0xd7c4('0x41')](handleError(_0x14905f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 405ebe6..2517402 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x20d1b2,_0x3738e3){var _0x143731=function(_0x34a905){while(--_0x34a905){_0x20d1b2['push'](_0x20d1b2['shift']());}};_0x143731(++_0x3738e3);}(_0x1261,0x144));var _0x1126=function(_0x28d885,_0x22d916){_0x28d885=_0x28d885-0x0;var _0x54e080=_0x1261[_0x28d885];return _0x54e080;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x814b,0x1a2));var _0xb814=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x814b[_0x13b330];return _0x1f666c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1792ed3..0c0695f 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 _0x9f4d=['result','catch','OpenchannelQueueReport','create','body','options','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x3c86b4,_0x431782){_0x3c86b4=_0x3c86b4-0x0;var _0x268334=_0x9f4d[_0x3c86b4];return _0x268334;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});}exports['CreateOpenchannelQueueReport']=function(_0x25a7fe){var _0x2d7cb2=this;return new Promise(function(_0xc01934,_0x4a5ecf){return db[_0xd9f4('0x18')][_0xd9f4('0x19')](_0x25a7fe[_0xd9f4('0x1a')],{'raw':_0x25a7fe['options']?_0x25a7fe[_0xd9f4('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xd9f4('0xc')](function(_0x93e8df){logger[_0xd9f4('0xd')]('CreateOpenchannelQueueReport',_0x25a7fe);logger[_0xd9f4('0x10')](_0xd9f4('0x1c'),_0x25a7fe,JSON['stringify'](_0x93e8df));_0xc01934(_0x93e8df);})['catch'](function(_0x7196ab){logger['error'](_0xd9f4('0x1c'),_0x7196ab[_0xd9f4('0x15')],_0x25a7fe);_0x4a5ecf(_0x2d7cb2[_0xd9f4('0x13')](0x1f4,_0x7196ab[_0xd9f4('0x15')]));});});};exports[_0xd9f4('0x1d')]=function(_0x33ddd6){var _0x3bd2c8=this;return new Promise(function(_0x41bfba,_0x275989){return db['OpenchannelQueueReport'][_0xd9f4('0x1e')](_0x33ddd6[_0xd9f4('0x1a')],{'raw':_0x33ddd6[_0xd9f4('0x1b')]?_0x33ddd6[_0xd9f4('0x1b')][_0xd9f4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ddd6[_0xd9f4('0x1b')]?_0x33ddd6[_0xd9f4('0x1b')]['where']||null:null,'attributes':_0x33ddd6[_0xd9f4('0x1b')]?_0x33ddd6[_0xd9f4('0x1b')][_0xd9f4('0x20')]||null:null,'limit':_0x33ddd6[_0xd9f4('0x1b')]?_0x33ddd6['options']['limit']||null:null})['then'](function(_0x261903){logger['info'](_0xd9f4('0x1d'),_0x33ddd6);logger[_0xd9f4('0x10')]('UpdateOpenchannelQueueReport',_0x33ddd6,JSON['stringify'](_0x261903));_0x41bfba(_0x261903);})[_0xd9f4('0x17')](function(_0x30e009){logger[_0xd9f4('0x13')](_0xd9f4('0x1d'),_0x30e009[_0xd9f4('0x15')],_0x33ddd6);_0x275989(_0x3bd2c8[_0xd9f4('0x13')](0x1f4,_0x30e009[_0xd9f4('0x15')]));});});}; \ No newline at end of file +var _0x5204=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1ad547,_0x19bd4c){var _0x21aca7=function(_0x1a42e9){while(--_0x1a42e9){_0x1ad547['push'](_0x1ad547['shift']());}};_0x21aca7(++_0x19bd4c);}(_0x5204,0xdf));var _0x4520=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x5204[_0x1de43c];return _0x296d3e;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateOpenchannelQueueReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});};exports[_0x4520('0x1c')]=function(_0x3a4680){var _0x2a8528=this;return new Promise(function(_0x552da1,_0x3774bd){return db[_0x4520('0x18')][_0x4520('0x1d')](_0x3a4680[_0x4520('0x1a')],{'raw':_0x3a4680['options']?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1f')]||null:null,'attributes':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x20')]||null:null,'limit':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')]['limit']||null:null})[_0x4520('0x21')](function(_0x5c1a0b){logger[_0x4520('0xc')](_0x4520('0x1c'),_0x3a4680);logger[_0x4520('0xf')](_0x4520('0x1c'),_0x3a4680,JSON[_0x4520('0x11')](_0x5c1a0b));_0x552da1(_0x5c1a0b);})[_0x4520('0x16')](function(_0x5bb163){logger[_0x4520('0x12')]('UpdateOpenchannelQueueReport',_0x5bb163[_0x4520('0x14')],_0x3a4680);_0x3774bd(_0x2a8528['error'](0x1f4,_0x5bb163[_0x4520('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 97a5faf..dc63b18 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 _0xcaf9=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','./openchannelTransferReport.controller'];(function(_0x28445d,_0x18905e){var _0xec0bc5=function(_0x3ce7fb){while(--_0x3ce7fb){_0x28445d['push'](_0x28445d['shift']());}};_0xec0bc5(++_0x18905e);}(_0xcaf9,0x1c2));var _0x9caf=function(_0x696baa,_0x527619){_0x696baa=_0x696baa-0x0;var _0x53ec79=_0xcaf9[_0x696baa];return _0x53ec79;};'use strict';var multer=require('multer');var util=require(_0x9caf('0x0'));var path=require(_0x9caf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9caf('0x2')]();var fs_extra=require(_0x9caf('0x3'));var auth=require(_0x9caf('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9caf('0x5'));router[_0x9caf('0x6')]('/',auth[_0x9caf('0x7')](),controller[_0x9caf('0x8')]);router['get'](_0x9caf('0x9'),auth['isAuthenticated'](),controller[_0x9caf('0xa')]);router[_0x9caf('0x6')](_0x9caf('0xb'),auth[_0x9caf('0x7')](),controller[_0x9caf('0xc')]);router[_0x9caf('0xd')]('/',auth[_0x9caf('0x7')](),controller[_0x9caf('0xe')]);router[_0x9caf('0xf')]('/:id',auth[_0x9caf('0x7')](),controller[_0x9caf('0x10')]);router[_0x9caf('0x11')](_0x9caf('0xb'),auth[_0x9caf('0x7')](),controller['destroy']);module[_0x9caf('0x12')]=router; \ No newline at end of file +var _0xbc5e=['destroy','exports','multer','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete'];(function(_0xcfac1e,_0x53f88d){var _0x494d4b=function(_0x5bf85c){while(--_0x5bf85c){_0xcfac1e['push'](_0xcfac1e['shift']());}};_0x494d4b(++_0x53f88d);}(_0xbc5e,0x1a4));var _0xebc5=function(_0x1bc773,_0x4a3eb4){_0x1bc773=_0x1bc773-0x0;var _0x327323=_0xbc5e[_0x1bc773];return _0x327323;};'use strict';var multer=require(_0xebc5('0x0'));var util=require('util');var path=require(_0xebc5('0x1'));var timeout=require('connect-timeout');var express=require(_0xebc5('0x2'));var router=express[_0xebc5('0x3')]();var fs_extra=require(_0xebc5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xebc5('0x5'));var controller=require('./openchannelTransferReport.controller');router[_0xebc5('0x6')]('/',auth[_0xebc5('0x7')](),controller[_0xebc5('0x8')]);router[_0xebc5('0x6')](_0xebc5('0x9'),auth['isAuthenticated'](),controller[_0xebc5('0xa')]);router['get'](_0xebc5('0xb'),auth[_0xebc5('0x7')](),controller['show']);router[_0xebc5('0xc')]('/',auth['isAuthenticated'](),controller[_0xebc5('0xd')]);router[_0xebc5('0xe')](_0xebc5('0xb'),auth[_0xebc5('0x7')](),controller[_0xebc5('0xf')]);router[_0xebc5('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xebc5('0x11')]);module[_0xebc5('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 6345cb5..ef5b2b5 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x9b9c46,_0x3997a8){var _0x47ee52=function(_0x1b382f){while(--_0x1b382f){_0x9b9c46['push'](_0x9b9c46['shift']());}};_0x47ee52(++_0x3997a8);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x9bde,0xe1));var _0xe9bd=function(_0x179239,_0x26f4ed){_0x179239=_0x179239-0x0;var _0x2c9c17=_0x9bde[_0x179239];return _0x2c9c17;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 357bb7f..f156097 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 _0x01ef=['bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','findAll','rows','catch','show','params','keys','length','include','options','find','create','body','describe','moment'];(function(_0x266703,_0x120c3b){var _0x37d275=function(_0x5a300b){while(--_0x5a300b){_0x266703['push'](_0x266703['shift']());}};_0x37d275(++_0x120c3b);}(_0x01ef,0x16c));var _0xf01e=function(_0x793c82,_0x4e593d){_0x793c82=_0x793c82-0x0;var _0x2b6374=_0x01ef[_0x793c82];return _0x2b6374;};'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('request-promise');var moment=require(_0xf01e('0x0'));var BPromise=require(_0xf01e('0x1'));var Mustache=require(_0xf01e('0x2'));var util=require(_0xf01e('0x3'));var path=require('path');var sox=require(_0xf01e('0x4'));var csv=require(_0xf01e('0x5'));var ejs=require(_0xf01e('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf01e('0x7'));var squel=require(_0xf01e('0x8'));var crypto=require(_0xf01e('0x9'));var jsforce=require(_0xf01e('0xa'));var deskjs=require(_0xf01e('0xb'));var toCsv=require(_0xf01e('0x5'));var querystring=require(_0xf01e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf01e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf01e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf01e('0xf'));var logger=require('../../config/logger')(_0xf01e('0x10'));var utils=require(_0xf01e('0x11'));var config=require(_0xf01e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf01e('0x13'))['db'];function respondWithStatusCode(_0x59b5cf,_0x5b7694){_0x5b7694=_0x5b7694||0xcc;return function(_0x2e3a81){if(_0x2e3a81){return _0x59b5cf[_0xf01e('0x14')](_0x5b7694);}return _0x59b5cf[_0xf01e('0x15')](_0x5b7694)[_0xf01e('0x16')]();};}function respondWithResult(_0x5d2b6e,_0x3ca093){_0x3ca093=_0x3ca093||0xc8;return function(_0x35fafe){if(_0x35fafe){return _0x5d2b6e[_0xf01e('0x15')](_0x3ca093)[_0xf01e('0x17')](_0x35fafe);}};}function respondWithFilteredResult(_0x1d6128,_0x127ee2){return function(_0x333706){if(_0x333706){var _0x194c7f=typeof _0x127ee2['offset']===_0xf01e('0x18')&&typeof _0x127ee2[_0xf01e('0x19')]==='undefined';var _0x1c5045=_0x333706[_0xf01e('0x1a')];var _0x4b7e88=_0x194c7f?0x0:_0x127ee2[_0xf01e('0x1b')];var _0x48110a=_0x194c7f?_0x333706[_0xf01e('0x1a')]:_0x127ee2['offset']+_0x127ee2[_0xf01e('0x19')];var _0x1f9e66;if(_0x48110a>=_0x1c5045){_0x48110a=_0x1c5045;_0x1f9e66=0xc8;}else{_0x1f9e66=0xce;}_0x1d6128['status'](_0x1f9e66);return _0x1d6128[_0xf01e('0x1c')](_0xf01e('0x1d'),_0x4b7e88+'-'+_0x48110a+'/'+_0x1c5045)['json'](_0x333706);}return null;};}function patchUpdates(_0x9ecac8){return function(_0x13d97c){try{jsonpatch[_0xf01e('0x1e')](_0x13d97c,_0x9ecac8,!![]);}catch(_0x4c194d){return BPromise[_0xf01e('0x1f')](_0x4c194d);}return _0x13d97c['save']();};}function saveUpdates(_0x552278,_0x5afc12){return function(_0x2287a5){if(_0x2287a5){return _0x2287a5[_0xf01e('0x20')](_0x552278)['then'](function(_0x1ba853){return _0x1ba853;});}return null;};}function removeEntity(_0x5e0844,_0x2b0268){return function(_0xbcaf8d){if(_0xbcaf8d){return _0xbcaf8d[_0xf01e('0x21')]()['then'](function(){_0x5e0844[_0xf01e('0x15')](0xcc)[_0xf01e('0x16')]();});}};}function handleEntityNotFound(_0x44c9a6,_0x482443){return function(_0x59ceae){if(!_0x59ceae){_0x44c9a6[_0xf01e('0x14')](0x194);}return _0x59ceae;};}function handleError(_0x5f36b2,_0x2dae47){_0x2dae47=_0x2dae47||0x1f4;return function(_0x2fca0a){logger[_0xf01e('0x22')](_0x2fca0a[_0xf01e('0x23')]);if(_0x2fca0a['name']){delete _0x2fca0a[_0xf01e('0x24')];}_0x5f36b2[_0xf01e('0x15')](_0x2dae47)[_0xf01e('0x25')](_0x2fca0a);};}exports[_0xf01e('0x26')]=function(_0x3b39e4,_0x3723dc){var _0x479978={},_0x36da4c={},_0x14fab0={'count':0x0,'rows':[]};var _0x371572=_[_0xf01e('0x27')](db[_0xf01e('0x28')][_0xf01e('0x29')],function(_0x1b6d22){return{'name':_0x1b6d22[_0xf01e('0x2a')],'type':_0x1b6d22[_0xf01e('0x2b')][_0xf01e('0x2c')]};});_0x36da4c[_0xf01e('0x2d')]=_[_0xf01e('0x27')](_0x371572,_0xf01e('0x24'));_0x36da4c['query']=_['keys'](_0x3b39e4['query']);_0x36da4c[_0xf01e('0x2e')]=_['intersection'](_0x36da4c['model'],_0x36da4c[_0xf01e('0x2f')]);_0x479978[_0xf01e('0x30')]=_[_0xf01e('0x31')](_0x36da4c[_0xf01e('0x2d')],qs[_0xf01e('0x32')](_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x32')]));_0x479978[_0xf01e('0x30')]=_0x479978['attributes']['length']?_0x479978['attributes']:_0x36da4c[_0xf01e('0x2d')];if(!_0x3b39e4[_0xf01e('0x2f')]['hasOwnProperty'](_0xf01e('0x33'))){_0x479978['limit']=qs[_0xf01e('0x19')](_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x19')]);_0x479978['offset']=qs[_0xf01e('0x1b')](_0x3b39e4[_0xf01e('0x2f')]['offset']);}_0x479978['order']=qs[_0xf01e('0x34')](_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x34')]);_0x479978[_0xf01e('0x35')]=qs[_0xf01e('0x2e')](_[_0xf01e('0x36')](_0x3b39e4['query'],_0x36da4c['filters']),_0x371572);if(_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x37')]){_0x479978['where']=_[_0xf01e('0x38')](_0x479978['where'],{'$or':_[_0xf01e('0x27')](_0x371572,function(_0x52cefe){if(_0x52cefe[_0xf01e('0x2b')]!==_0xf01e('0x39')){var _0x593fe5={};_0x593fe5[_0x52cefe['name']]={'$like':'%'+_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x37')]+'%'};return _0x593fe5;}})});}_0x479978=_[_0xf01e('0x38')]({},_0x479978,_0x3b39e4['options']);var _0x279fa={'where':_0x479978[_0xf01e('0x35')]};return db[_0xf01e('0x28')][_0xf01e('0x1a')](_0x279fa)[_0xf01e('0x3a')](function(_0x5a750c){_0x14fab0['count']=_0x5a750c;if(_0x3b39e4[_0xf01e('0x2f')][_0xf01e('0x3b')]){_0x479978['include']=[{'all':!![]}];}return db[_0xf01e('0x28')][_0xf01e('0x3c')](_0x479978);})[_0xf01e('0x3a')](function(_0x2cec7e){_0x14fab0[_0xf01e('0x3d')]=_0x2cec7e;return _0x14fab0;})[_0xf01e('0x3a')](respondWithFilteredResult(_0x3723dc,_0x479978))[_0xf01e('0x3e')](handleError(_0x3723dc,null));};exports[_0xf01e('0x3f')]=function(_0x436c9d,_0x1592ec){var _0x1d5fa6={'raw':!![],'where':{'id':_0x436c9d[_0xf01e('0x40')]['id']}},_0x5bfcef={};_0x5bfcef['model']=_['keys'](db['OpenchannelTransferReport'][_0xf01e('0x29')]);_0x5bfcef[_0xf01e('0x2f')]=_[_0xf01e('0x41')](_0x436c9d['query']);_0x5bfcef[_0xf01e('0x2e')]=_[_0xf01e('0x31')](_0x5bfcef[_0xf01e('0x2d')],_0x5bfcef[_0xf01e('0x2f')]);_0x1d5fa6['attributes']=_['intersection'](_0x5bfcef[_0xf01e('0x2d')],qs[_0xf01e('0x32')](_0x436c9d[_0xf01e('0x2f')][_0xf01e('0x32')]));_0x1d5fa6[_0xf01e('0x30')]=_0x1d5fa6[_0xf01e('0x30')][_0xf01e('0x42')]?_0x1d5fa6['attributes']:_0x5bfcef[_0xf01e('0x2d')];if(_0x436c9d[_0xf01e('0x2f')][_0xf01e('0x3b')]){_0x1d5fa6[_0xf01e('0x43')]=[{'all':!![]}];}_0x1d5fa6=_[_0xf01e('0x38')]({},_0x1d5fa6,_0x436c9d[_0xf01e('0x44')]);return db[_0xf01e('0x28')][_0xf01e('0x45')](_0x1d5fa6)[_0xf01e('0x3a')](handleEntityNotFound(_0x1592ec,null))[_0xf01e('0x3a')](respondWithResult(_0x1592ec,null))[_0xf01e('0x3e')](handleError(_0x1592ec,null));};exports[_0xf01e('0x46')]=function(_0x15366f,_0x314561){return db[_0xf01e('0x28')][_0xf01e('0x46')](_0x15366f[_0xf01e('0x47')],{})[_0xf01e('0x3a')](respondWithResult(_0x314561,0xc9))['catch'](handleError(_0x314561,null));};exports['update']=function(_0x271e66,_0x40555d){if(_0x271e66[_0xf01e('0x47')]['id']){delete _0x271e66[_0xf01e('0x47')]['id'];}return db[_0xf01e('0x28')][_0xf01e('0x45')]({'where':{'id':_0x271e66[_0xf01e('0x40')]['id']}})['then'](handleEntityNotFound(_0x40555d,null))[_0xf01e('0x3a')](saveUpdates(_0x271e66[_0xf01e('0x47')],null))[_0xf01e('0x3a')](respondWithResult(_0x40555d,null))[_0xf01e('0x3e')](handleError(_0x40555d,null));};exports[_0xf01e('0x21')]=function(_0x14bdcd,_0x532783){return db[_0xf01e('0x28')][_0xf01e('0x45')]({'where':{'id':_0x14bdcd['params']['id']}})[_0xf01e('0x3a')](handleEntityNotFound(_0x532783,null))[_0xf01e('0x3a')](removeEntity(_0x532783,null))['catch'](handleError(_0x532783,null));};exports[_0xf01e('0x48')]=function(_0x1284d0,_0x481eb7){return db[_0xf01e('0x28')][_0xf01e('0x48')]()['then'](respondWithResult(_0x481eb7,null))['catch'](handleError(_0x481eb7,null));}; \ No newline at end of file +var _0xc849=['name','send','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','fields','options','create','update','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','then','sendStatus','error'];(function(_0xd291e2,_0x49978a){var _0xb4ca1b=function(_0x385262){while(--_0x385262){_0xd291e2['push'](_0xd291e2['shift']());}};_0xb4ca1b(++_0x49978a);}(_0xc849,0xb7));var _0x9c84=function(_0x18176e,_0x5c8a7b){_0x18176e=_0x18176e-0x0;var _0x561593=_0xc849[_0x18176e];return _0x561593;};'use strict';var emlformat=require(_0x9c84('0x0'));var rimraf=require(_0x9c84('0x1'));var zipdir=require(_0x9c84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c84('0x3'));var moment=require(_0x9c84('0x4'));var BPromise=require(_0x9c84('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9c84('0x6'));var sox=require(_0x9c84('0x7'));var csv=require('to-csv');var ejs=require(_0x9c84('0x8'));var fs=require('fs');var fs_extra=require(_0x9c84('0x9'));var _=require(_0x9c84('0xa'));var squel=require(_0x9c84('0xb'));var crypto=require(_0x9c84('0xc'));var jsforce=require(_0x9c84('0xd'));var deskjs=require(_0x9c84('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9c84('0xf'));var Papa=require('papaparse');var Redis=require(_0x9c84('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9c84('0x11'));var as=require(_0x9c84('0x12'));var hardwareService=require(_0x9c84('0x13'));var logger=require(_0x9c84('0x14'))(_0x9c84('0x15'));var utils=require(_0x9c84('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c84('0x17'));var db=require(_0x9c84('0x18'))['db'];function respondWithStatusCode(_0x29756c,_0xad67ac){_0xad67ac=_0xad67ac||0xcc;return function(_0x54bb39){if(_0x54bb39){return _0x29756c['sendStatus'](_0xad67ac);}return _0x29756c[_0x9c84('0x19')](_0xad67ac)['end']();};}function respondWithResult(_0x5ceee2,_0x14e742){_0x14e742=_0x14e742||0xc8;return function(_0xf65ce7){if(_0xf65ce7){return _0x5ceee2[_0x9c84('0x19')](_0x14e742)[_0x9c84('0x1a')](_0xf65ce7);}};}function respondWithFilteredResult(_0x2014ae,_0x44a1f8){return function(_0x5c1177){if(_0x5c1177){var _0x537860=typeof _0x44a1f8[_0x9c84('0x1b')]===_0x9c84('0x1c')&&typeof _0x44a1f8[_0x9c84('0x1d')]===_0x9c84('0x1c');var _0x37bc1d=_0x5c1177[_0x9c84('0x1e')];var _0x388459=_0x537860?0x0:_0x44a1f8[_0x9c84('0x1b')];var _0x549269=_0x537860?_0x5c1177[_0x9c84('0x1e')]:_0x44a1f8[_0x9c84('0x1b')]+_0x44a1f8[_0x9c84('0x1d')];var _0x2d7598;if(_0x549269>=_0x37bc1d){_0x549269=_0x37bc1d;_0x2d7598=0xc8;}else{_0x2d7598=0xce;}_0x2014ae[_0x9c84('0x19')](_0x2d7598);return _0x2014ae[_0x9c84('0x1f')]('Content-Range',_0x388459+'-'+_0x549269+'/'+_0x37bc1d)[_0x9c84('0x1a')](_0x5c1177);}return null;};}function patchUpdates(_0x3b48ab){return function(_0xbfca31){try{jsonpatch[_0x9c84('0x20')](_0xbfca31,_0x3b48ab,!![]);}catch(_0x4fb3ba){return BPromise['reject'](_0x4fb3ba);}return _0xbfca31['save']();};}function saveUpdates(_0x3b81b7,_0x29746e){return function(_0x575855){if(_0x575855){return _0x575855['update'](_0x3b81b7)[_0x9c84('0x21')](function(_0x59849f){return _0x59849f;});}return null;};}function removeEntity(_0x5a2937,_0x3a4ea3){return function(_0x1236fe){if(_0x1236fe){return _0x1236fe['destroy']()[_0x9c84('0x21')](function(){_0x5a2937[_0x9c84('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa7b1a1,_0x379e79){return function(_0x4845e8){if(!_0x4845e8){_0xa7b1a1[_0x9c84('0x22')](0x194);}return _0x4845e8;};}function handleError(_0x4a4415,_0x3fadc8){_0x3fadc8=_0x3fadc8||0x1f4;return function(_0x9cb7){logger[_0x9c84('0x23')](_0x9cb7['stack']);if(_0x9cb7[_0x9c84('0x24')]){delete _0x9cb7[_0x9c84('0x24')];}_0x4a4415[_0x9c84('0x19')](_0x3fadc8)[_0x9c84('0x25')](_0x9cb7);};}exports[_0x9c84('0x26')]=function(_0x1283f6,_0x5ec377){var _0x3a034d={},_0x4f66e2={},_0x3b1d9b={'count':0x0,'rows':[]};var _0x7d1bfd=_[_0x9c84('0x27')](db[_0x9c84('0x28')]['rawAttributes'],function(_0x5266c9){return{'name':_0x5266c9[_0x9c84('0x29')],'type':_0x5266c9[_0x9c84('0x2a')][_0x9c84('0x2b')]};});_0x4f66e2[_0x9c84('0x2c')]=_[_0x9c84('0x27')](_0x7d1bfd,'name');_0x4f66e2[_0x9c84('0x2d')]=_[_0x9c84('0x2e')](_0x1283f6[_0x9c84('0x2d')]);_0x4f66e2['filters']=_[_0x9c84('0x2f')](_0x4f66e2[_0x9c84('0x2c')],_0x4f66e2[_0x9c84('0x2d')]);_0x3a034d[_0x9c84('0x30')]=_[_0x9c84('0x2f')](_0x4f66e2['model'],qs['fields'](_0x1283f6[_0x9c84('0x2d')]['fields']));_0x3a034d['attributes']=_0x3a034d['attributes'][_0x9c84('0x31')]?_0x3a034d[_0x9c84('0x30')]:_0x4f66e2['model'];if(!_0x1283f6[_0x9c84('0x2d')]['hasOwnProperty'](_0x9c84('0x32'))){_0x3a034d[_0x9c84('0x1d')]=qs['limit'](_0x1283f6[_0x9c84('0x2d')][_0x9c84('0x1d')]);_0x3a034d[_0x9c84('0x1b')]=qs[_0x9c84('0x1b')](_0x1283f6[_0x9c84('0x2d')][_0x9c84('0x1b')]);}_0x3a034d[_0x9c84('0x33')]=qs[_0x9c84('0x34')](_0x1283f6['query'][_0x9c84('0x34')]);_0x3a034d[_0x9c84('0x35')]=qs[_0x9c84('0x36')](_[_0x9c84('0x37')](_0x1283f6[_0x9c84('0x2d')],_0x4f66e2['filters']),_0x7d1bfd);if(_0x1283f6[_0x9c84('0x2d')]['filter']){_0x3a034d[_0x9c84('0x35')]=_['merge'](_0x3a034d[_0x9c84('0x35')],{'$or':_[_0x9c84('0x27')](_0x7d1bfd,function(_0x35a467){if(_0x35a467['type']!=='VIRTUAL'){var _0xcd59aa={};_0xcd59aa[_0x35a467[_0x9c84('0x24')]]={'$like':'%'+_0x1283f6[_0x9c84('0x2d')][_0x9c84('0x38')]+'%'};return _0xcd59aa;}})});}_0x3a034d=_[_0x9c84('0x39')]({},_0x3a034d,_0x1283f6['options']);var _0x29434b={'where':_0x3a034d[_0x9c84('0x35')]};return db[_0x9c84('0x28')]['count'](_0x29434b)[_0x9c84('0x21')](function(_0x2e3316){_0x3b1d9b['count']=_0x2e3316;if(_0x1283f6['query'][_0x9c84('0x3a')]){_0x3a034d[_0x9c84('0x3b')]=[{'all':!![]}];}return db[_0x9c84('0x28')][_0x9c84('0x3c')](_0x3a034d);})[_0x9c84('0x21')](function(_0x59dff0){_0x3b1d9b[_0x9c84('0x3d')]=_0x59dff0;return _0x3b1d9b;})[_0x9c84('0x21')](respondWithFilteredResult(_0x5ec377,_0x3a034d))[_0x9c84('0x3e')](handleError(_0x5ec377,null));};exports[_0x9c84('0x3f')]=function(_0x1e7586,_0x322135){var _0x2375d1={'raw':!![],'where':{'id':_0x1e7586[_0x9c84('0x40')]['id']}},_0x1eb919={};_0x1eb919['model']=_[_0x9c84('0x2e')](db[_0x9c84('0x28')]['rawAttributes']);_0x1eb919[_0x9c84('0x2d')]=_[_0x9c84('0x2e')](_0x1e7586[_0x9c84('0x2d')]);_0x1eb919['filters']=_[_0x9c84('0x2f')](_0x1eb919[_0x9c84('0x2c')],_0x1eb919[_0x9c84('0x2d')]);_0x2375d1[_0x9c84('0x30')]=_[_0x9c84('0x2f')](_0x1eb919[_0x9c84('0x2c')],qs['fields'](_0x1e7586[_0x9c84('0x2d')][_0x9c84('0x41')]));_0x2375d1[_0x9c84('0x30')]=_0x2375d1[_0x9c84('0x30')][_0x9c84('0x31')]?_0x2375d1[_0x9c84('0x30')]:_0x1eb919[_0x9c84('0x2c')];if(_0x1e7586[_0x9c84('0x2d')][_0x9c84('0x3a')]){_0x2375d1[_0x9c84('0x3b')]=[{'all':!![]}];}_0x2375d1=_['merge']({},_0x2375d1,_0x1e7586[_0x9c84('0x42')]);return db[_0x9c84('0x28')]['find'](_0x2375d1)[_0x9c84('0x21')](handleEntityNotFound(_0x322135,null))[_0x9c84('0x21')](respondWithResult(_0x322135,null))[_0x9c84('0x3e')](handleError(_0x322135,null));};exports[_0x9c84('0x43')]=function(_0x1182c7,_0x11fa4a){return db[_0x9c84('0x28')][_0x9c84('0x43')](_0x1182c7['body'],{})['then'](respondWithResult(_0x11fa4a,0xc9))[_0x9c84('0x3e')](handleError(_0x11fa4a,null));};exports[_0x9c84('0x44')]=function(_0x4b3e02,_0x1556f8){if(_0x4b3e02[_0x9c84('0x45')]['id']){delete _0x4b3e02[_0x9c84('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x9c84('0x46')]({'where':{'id':_0x4b3e02[_0x9c84('0x40')]['id']}})[_0x9c84('0x21')](handleEntityNotFound(_0x1556f8,null))[_0x9c84('0x21')](saveUpdates(_0x4b3e02[_0x9c84('0x45')],null))[_0x9c84('0x21')](respondWithResult(_0x1556f8,null))[_0x9c84('0x3e')](handleError(_0x1556f8,null));};exports[_0x9c84('0x47')]=function(_0x3c892d,_0x1e5aab){return db[_0x9c84('0x28')][_0x9c84('0x46')]({'where':{'id':_0x3c892d[_0x9c84('0x40')]['id']}})[_0x9c84('0x21')](handleEntityNotFound(_0x1e5aab,null))[_0x9c84('0x21')](removeEntity(_0x1e5aab,null))[_0x9c84('0x3e')](handleError(_0x1e5aab,null));};exports[_0x9c84('0x48')]=function(_0x540a75,_0x2418be){return db[_0x9c84('0x28')]['describe']()[_0x9c84('0x21')](respondWithResult(_0x2418be,null))[_0x9c84('0x3e')](handleError(_0x2418be,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f9f3dce..a8c00f1 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 _0x15b3=['./openchannelTransferReport.attributes','exports','define','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b3,0x1b1));var _0x315b=function(_0xa0a36d,_0x1f249e){_0xa0a36d=_0xa0a36d-0x0;var _0x93603=_0x15b3[_0xa0a36d];return _0x93603;};'use strict';var _=require(_0x315b('0x0'));var util=require(_0x315b('0x1'));var logger=require('../../config/logger')(_0x315b('0x2'));var moment=require(_0x315b('0x3'));var BPromise=require('bluebird');var rp=require(_0x315b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x315b('0x5'));var config=require(_0x315b('0x6'));var attributes=require(_0x315b('0x7'));module[_0x315b('0x8')]=function(_0x189fe3,_0x2b6e7e){return _0x189fe3[_0x315b('0x9')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd871=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','exports','define','report_openchannel_transfer'];(function(_0x1e6e99,_0xd3bb5f){var _0x6b6ca8=function(_0xa29245){while(--_0xa29245){_0x1e6e99['push'](_0x1e6e99['shift']());}};_0x6b6ca8(++_0xd3bb5f);}(_0xd871,0x109));var _0x1d87=function(_0x34b244,_0x5c9a1d){_0x34b244=_0x34b244-0x0;var _0x304eee=_0xd871[_0x34b244];return _0x304eee;};'use strict';var _=require(_0x1d87('0x0'));var util=require(_0x1d87('0x1'));var logger=require(_0x1d87('0x2'))(_0x1d87('0x3'));var moment=require('moment');var BPromise=require(_0x1d87('0x4'));var rp=require(_0x1d87('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d87('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x1d87('0x7')]=function(_0x2fec67,_0x3a4d70){return _0x2fec67[_0x1d87('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x1d87('0x9'),'paranoid':![],'indexes':[{'name':_0x1d87('0xa'),'fields':[_0x1d87('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 9234f6c..5f917c5 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 _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x2c9402,_0x254900){var _0x5a0bcb=function(_0x2dd72b){while(--_0x2dd72b){_0x2c9402['push'](_0x2c9402['shift']());}};_0x5a0bcb(++_0x254900);}(_0x3e74,0x175));var _0x43e7=function(_0x5f0b7f,_0x49d597){_0x5f0b7f=_0x5f0b7f-0x0;var _0x35e58d=_0x3e74[_0x5f0b7f];return _0x35e58d;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file +var _0xac95=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x12494f,_0x3a0512){var _0x242919=function(_0x5320b7){while(--_0x5320b7){_0x12494f['push'](_0x12494f['shift']());}};_0x242919(++_0x3a0512);}(_0xac95,0xa8));var _0x5ac9=function(_0x5d41e3,_0x42fcc9){_0x5d41e3=_0x5d41e3-0x0;var _0x47c5bf=_0xac95[_0x5d41e3];return _0x47c5bf;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var moment=require(_0x5ac9('0x2'));var BPromise=require(_0x5ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ac9('0x4'))['db'];var utils=require(_0x5ac9('0x5'));var logger=require('../../config/logger')(_0x5ac9('0x6'));var config=require(_0x5ac9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x8')][_0x5ac9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8675ec,_0x4bddcf,_0x4dffb8){return new BPromise(function(_0x32afbc,_0x2ab11c){return client[_0x5ac9('0xa')](_0x8675ec,_0x4dffb8)[_0x5ac9('0xb')](function(_0x397bb8){logger[_0x5ac9('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'));logger[_0x5ac9('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4bddcf,_0x5ac9('0xd'),JSON['stringify'](_0x397bb8));if(_0x397bb8[_0x5ac9('0xf')]){if(_0x397bb8['error'][_0x5ac9('0x10')]===0x1f4){logger[_0x5ac9('0xf')](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x2ab11c(_0x397bb8['error'][_0x5ac9('0x12')]);}logger['error'](_0x5ac9('0x11'),_0x4bddcf,_0x397bb8[_0x5ac9('0xf')]['message']);return _0x32afbc(_0x397bb8[_0x5ac9('0xf')][_0x5ac9('0x12')]);}else{logger[_0x5ac9('0xc')](_0x5ac9('0x11'),_0x4bddcf,_0x5ac9('0xd'));_0x32afbc(_0x397bb8[_0x5ac9('0x13')][_0x5ac9('0x12')]);}})[_0x5ac9('0x14')](function(_0x460fd7){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4bddcf,_0x460fd7);_0x2ab11c(_0x460fd7);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1b32ef4..73e0d1e 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 _0xabae=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xabae,0x1a1));var _0xeaba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xabae[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeaba('0x0'));var timeout=require(_0xeaba('0x1'));var express=require(_0xeaba('0x2'));var router=express[_0xeaba('0x3')]();var fs_extra=require(_0xeaba('0x4'));var auth=require(_0xeaba('0x5'));var interaction=require(_0xeaba('0x6'));var config=require(_0xeaba('0x7'));var controller=require(_0xeaba('0x8'));router[_0xeaba('0x9')]('/',auth[_0xeaba('0xa')](),controller[_0xeaba('0xb')]);router['get'](_0xeaba('0xc'),auth['isAuthenticated'](),controller[_0xeaba('0xd')]);router[_0xeaba('0xe')]('/',auth['isAuthenticated'](),controller[_0xeaba('0xf')]);router[_0xeaba('0x10')](_0xeaba('0xc'),auth[_0xeaba('0xa')](),controller[_0xeaba('0x11')]);router[_0xeaba('0x12')](_0xeaba('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xeaba('0x13')]=router; \ No newline at end of file +var _0x8286=['post','create','put','/:id','destroy','exports','util','express','Router','fs-extra','./pause.controller','get','isAuthenticated','index','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8286,0x105));var _0x6828=function(_0x245a2c,_0x2fd853){_0x245a2c=_0x245a2c-0x0;var _0x2ff642=_0x8286[_0x245a2c];return _0x2ff642;};'use strict';var multer=require('multer');var util=require(_0x6828('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6828('0x1'));var router=express[_0x6828('0x2')]();var fs_extra=require(_0x6828('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6828('0x4'));router[_0x6828('0x5')]('/',auth[_0x6828('0x6')](),controller[_0x6828('0x7')]);router[_0x6828('0x5')]('/:id',auth[_0x6828('0x6')](),controller[_0x6828('0x8')]);router[_0x6828('0x9')]('/',auth['isAuthenticated'](),controller[_0x6828('0xa')]);router[_0x6828('0xb')](_0x6828('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6828('0xc'),auth[_0x6828('0x6')](),controller[_0x6828('0xd')]);module[_0x6828('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7a51a76..4658dc1 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 _0x1d13=['STRING','name','sequelize','exports'];(function(_0x153843,_0x4b6938){var _0x50c855=function(_0x22cf6a){while(--_0x22cf6a){_0x153843['push'](_0x153843['shift']());}};_0x50c855(++_0x4b6938);}(_0x1d13,0x11a));var _0x31d1=function(_0x3faa3e,_0x25ab8c){_0x3faa3e=_0x3faa3e-0x0;var _0xe79791=_0x1d13[_0x3faa3e];return _0xe79791;};'use strict';var Sequelize=require(_0x31d1('0x0'));module[_0x31d1('0x1')]={'name':{'type':Sequelize[_0x31d1('0x2')],'unique':_0x31d1('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x59fa=['name','exports'];(function(_0x552fb8,_0x4ed24b){var _0x2a741a=function(_0x15b7a1){while(--_0x15b7a1){_0x552fb8['push'](_0x552fb8['shift']());}};_0x2a741a(++_0x4ed24b);}(_0x59fa,0x15b));var _0xa59f=function(_0x64777f,_0x5d7ed6){_0x64777f=_0x64777f-0x0;var _0x4a0018=_0x59fa[_0x64777f];return _0x4a0018;};'use strict';var Sequelize=require('sequelize');module[_0xa59f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xa59f('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3b813c2..84dc46d 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 _0xb5b0=['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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','index','map','Pause','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','includeAll','body','user','UserProfileSection','find','userProfileId','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv'];(function(_0x4a97c5,_0x1fd90d){var _0x307063=function(_0x2439fb){while(--_0x2439fb){_0x4a97c5['push'](_0x4a97c5['shift']());}};_0x307063(++_0x1fd90d);}(_0xb5b0,0x136));var _0x0b5b=function(_0x5da4d5,_0x3d26ae){_0x5da4d5=_0x5da4d5-0x0;var _0xab5eec=_0xb5b0[_0x5da4d5];return _0xab5eec;};'use strict';var emlformat=require(_0x0b5b('0x0'));var rimraf=require(_0x0b5b('0x1'));var zipdir=require(_0x0b5b('0x2'));var jsonpatch=require(_0x0b5b('0x3'));var rp=require('request-promise');var moment=require(_0x0b5b('0x4'));var BPromise=require(_0x0b5b('0x5'));var Mustache=require('mustache');var util=require(_0x0b5b('0x6'));var path=require(_0x0b5b('0x7'));var sox=require(_0x0b5b('0x8'));var csv=require(_0x0b5b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b5b('0xa'));var _=require(_0x0b5b('0xb'));var squel=require(_0x0b5b('0xc'));var crypto=require(_0x0b5b('0xd'));var jsforce=require(_0x0b5b('0xe'));var deskjs=require(_0x0b5b('0xf'));var toCsv=require(_0x0b5b('0x9'));var querystring=require(_0x0b5b('0x10'));var Papa=require(_0x0b5b('0x11'));var Redis=require(_0x0b5b('0x12'));var authService=require(_0x0b5b('0x13'));var qs=require(_0x0b5b('0x14'));var as=require(_0x0b5b('0x15'));var hardwareService=require(_0x0b5b('0x16'));var logger=require('../../config/logger')(_0x0b5b('0x17'));var utils=require(_0x0b5b('0x18'));var config=require(_0x0b5b('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a955d,_0x26a609){_0x26a609=_0x26a609||0xcc;return function(_0x3be26d){if(_0x3be26d){return _0x3a955d[_0x0b5b('0x1a')](_0x26a609);}return _0x3a955d[_0x0b5b('0x1b')](_0x26a609)[_0x0b5b('0x1c')]();};}function respondWithResult(_0x30b383,_0x24cc30){_0x24cc30=_0x24cc30||0xc8;return function(_0x50d7be){if(_0x50d7be){return _0x30b383['status'](_0x24cc30)[_0x0b5b('0x1d')](_0x50d7be);}};}function respondWithFilteredResult(_0x70775d,_0x57c8b6){return function(_0x3a4f5b){if(_0x3a4f5b){var _0x2ebe42=typeof _0x57c8b6[_0x0b5b('0x1e')]===_0x0b5b('0x1f')&&typeof _0x57c8b6[_0x0b5b('0x20')]===_0x0b5b('0x1f');var _0x2bf4cf=_0x3a4f5b[_0x0b5b('0x21')];var _0x34c3d8=_0x2ebe42?0x0:_0x57c8b6[_0x0b5b('0x1e')];var _0x3bee48=_0x2ebe42?_0x3a4f5b[_0x0b5b('0x21')]:_0x57c8b6[_0x0b5b('0x1e')]+_0x57c8b6[_0x0b5b('0x20')];var _0x2f728c;if(_0x3bee48>=_0x2bf4cf){_0x3bee48=_0x2bf4cf;_0x2f728c=0xc8;}else{_0x2f728c=0xce;}_0x70775d['status'](_0x2f728c);return _0x70775d['set'](_0x0b5b('0x22'),_0x34c3d8+'-'+_0x3bee48+'/'+_0x2bf4cf)[_0x0b5b('0x1d')](_0x3a4f5b);}return null;};}function patchUpdates(_0x5b9f1a){return function(_0x1c98ab){try{jsonpatch[_0x0b5b('0x23')](_0x1c98ab,_0x5b9f1a,!![]);}catch(_0x3790d4){return BPromise[_0x0b5b('0x24')](_0x3790d4);}return _0x1c98ab['save']();};}function saveUpdates(_0x5a6ece,_0x2fca16){return function(_0xf47257){if(_0xf47257){return _0xf47257[_0x0b5b('0x25')](_0x5a6ece)[_0x0b5b('0x26')](function(_0x41a7bd){return _0x41a7bd;});}return null;};}function removeEntity(_0x2c41e1,_0x4353f7){return function(_0x40a14a){if(_0x40a14a){return _0x40a14a[_0x0b5b('0x27')]()['then'](function(){var _0x2db749=_0x40a14a[_0x0b5b('0x28')]({'plain':!![]});var _0x172027=_0x0b5b('0x29');return db[_0x0b5b('0x2a')]['destroy']({'where':{'type':_0x172027,'resourceId':_0x2db749['id']}})['then'](function(){return _0x40a14a;});})[_0x0b5b('0x26')](function(){_0x2c41e1[_0x0b5b('0x1b')](0xcc)[_0x0b5b('0x1c')]();});}};}function handleEntityNotFound(_0x2da86d,_0x2bd734){return function(_0x350d59){if(!_0x350d59){_0x2da86d[_0x0b5b('0x1a')](0x194);}return _0x350d59;};}function handleError(_0x4614a4,_0x41a74b){_0x41a74b=_0x41a74b||0x1f4;return function(_0x5511d4){logger[_0x0b5b('0x2b')](_0x5511d4[_0x0b5b('0x2c')]);if(_0x5511d4[_0x0b5b('0x2d')]){delete _0x5511d4[_0x0b5b('0x2d')];}_0x4614a4[_0x0b5b('0x1b')](_0x41a74b)['send'](_0x5511d4);};}exports[_0x0b5b('0x2e')]=function(_0x5639eb,_0x4e56c0){var _0x155789={},_0x53c7cb={},_0x3207bd={'count':0x0,'rows':[]};var _0x287924=_[_0x0b5b('0x2f')](db[_0x0b5b('0x30')][_0x0b5b('0x31')],function(_0x2157d5){return{'name':_0x2157d5['fieldName'],'type':_0x2157d5[_0x0b5b('0x32')][_0x0b5b('0x33')]};});_0x53c7cb['model']=_[_0x0b5b('0x2f')](_0x287924,_0x0b5b('0x2d'));_0x53c7cb[_0x0b5b('0x34')]=_['keys'](_0x5639eb[_0x0b5b('0x34')]);_0x53c7cb[_0x0b5b('0x35')]=_[_0x0b5b('0x36')](_0x53c7cb[_0x0b5b('0x37')],_0x53c7cb[_0x0b5b('0x34')]);_0x155789[_0x0b5b('0x38')]=_[_0x0b5b('0x36')](_0x53c7cb['model'],qs[_0x0b5b('0x39')](_0x5639eb[_0x0b5b('0x34')][_0x0b5b('0x39')]));_0x155789[_0x0b5b('0x38')]=_0x155789[_0x0b5b('0x38')][_0x0b5b('0x3a')]?_0x155789['attributes']:_0x53c7cb[_0x0b5b('0x37')];if(!_0x5639eb[_0x0b5b('0x34')]['hasOwnProperty'](_0x0b5b('0x3b'))){_0x155789['limit']=qs[_0x0b5b('0x20')](_0x5639eb[_0x0b5b('0x34')][_0x0b5b('0x20')]);_0x155789[_0x0b5b('0x1e')]=qs[_0x0b5b('0x1e')](_0x5639eb[_0x0b5b('0x34')][_0x0b5b('0x1e')]);}_0x155789['order']=qs[_0x0b5b('0x3c')](_0x5639eb['query'][_0x0b5b('0x3c')]);_0x155789[_0x0b5b('0x3d')]=qs['filters'](_[_0x0b5b('0x3e')](_0x5639eb['query'],_0x53c7cb[_0x0b5b('0x35')]),_0x287924);if(_0x5639eb[_0x0b5b('0x34')]['filter']){_0x155789[_0x0b5b('0x3d')]=_['merge'](_0x155789[_0x0b5b('0x3d')],{'$or':_['map'](_0x287924,function(_0x4cac65){if(_0x4cac65[_0x0b5b('0x32')]!==_0x0b5b('0x3f')){var _0xb1ed26={};_0xb1ed26[_0x4cac65[_0x0b5b('0x2d')]]={'$like':'%'+_0x5639eb['query']['filter']+'%'};return _0xb1ed26;}})});}_0x155789=_[_0x0b5b('0x40')]({},_0x155789,_0x5639eb[_0x0b5b('0x41')]);var _0x164259={'where':_0x155789['where']};return db[_0x0b5b('0x30')][_0x0b5b('0x21')](_0x164259)['then'](function(_0x46bea9){_0x3207bd['count']=_0x46bea9;if(_0x5639eb['query']['includeAll']){_0x155789[_0x0b5b('0x42')]=[{'all':!![]}];}return db[_0x0b5b('0x30')][_0x0b5b('0x43')](_0x155789);})['then'](function(_0x2eeade){_0x3207bd[_0x0b5b('0x44')]=_0x2eeade;return _0x3207bd;})[_0x0b5b('0x26')](respondWithFilteredResult(_0x4e56c0,_0x155789))[_0x0b5b('0x45')](handleError(_0x4e56c0,null));};exports[_0x0b5b('0x46')]=function(_0x41d248,_0x498f84){var _0x569bf6={'raw':!![],'where':{'id':_0x41d248[_0x0b5b('0x47')]['id']}},_0x5e940e={};_0x5e940e[_0x0b5b('0x37')]=_[_0x0b5b('0x48')](db[_0x0b5b('0x30')][_0x0b5b('0x31')]);_0x5e940e[_0x0b5b('0x34')]=_[_0x0b5b('0x48')](_0x41d248[_0x0b5b('0x34')]);_0x5e940e[_0x0b5b('0x35')]=_['intersection'](_0x5e940e[_0x0b5b('0x37')],_0x5e940e['query']);_0x569bf6[_0x0b5b('0x38')]=_[_0x0b5b('0x36')](_0x5e940e['model'],qs['fields'](_0x41d248['query'][_0x0b5b('0x39')]));_0x569bf6[_0x0b5b('0x38')]=_0x569bf6[_0x0b5b('0x38')][_0x0b5b('0x3a')]?_0x569bf6[_0x0b5b('0x38')]:_0x5e940e[_0x0b5b('0x37')];if(_0x41d248[_0x0b5b('0x34')][_0x0b5b('0x49')]){_0x569bf6[_0x0b5b('0x42')]=[{'all':!![]}];}_0x569bf6=_[_0x0b5b('0x40')]({},_0x569bf6,_0x41d248[_0x0b5b('0x41')]);return db[_0x0b5b('0x30')]['find'](_0x569bf6)[_0x0b5b('0x26')](handleEntityNotFound(_0x498f84,null))[_0x0b5b('0x26')](respondWithResult(_0x498f84,null))[_0x0b5b('0x45')](handleError(_0x498f84,null));};exports['create']=function(_0x56fa34,_0x495273){return db[_0x0b5b('0x30')]['create'](_0x56fa34[_0x0b5b('0x4a')],{})['then'](function(_0x1655a2){var _0xda0788=_0x56fa34[_0x0b5b('0x4b')][_0x0b5b('0x28')]({'plain':!![]});if(!_0xda0788)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xda0788['role']===_0x0b5b('0x4b')){var _0x17e219=_0x1655a2[_0x0b5b('0x28')]({'plain':!![]});var _0x426094=_0x0b5b('0x29');return db[_0x0b5b('0x4c')][_0x0b5b('0x4d')]({'where':{'name':_0x426094,'userProfileId':_0xda0788[_0x0b5b('0x4e')]},'raw':!![]})['then'](function(_0x584e55){if(_0x584e55&&_0x584e55['autoAssociation']===0x0){return db[_0x0b5b('0x2a')][_0x0b5b('0x4f')]({'name':_0x17e219['name'],'resourceId':_0x17e219['id'],'type':_0x584e55[_0x0b5b('0x2d')],'sectionId':_0x584e55['id']},{})[_0x0b5b('0x26')](function(){return _0x1655a2;});}else{return _0x1655a2;}})[_0x0b5b('0x45')](function(_0x524e16){logger[_0x0b5b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x524e16);throw _0x524e16;});}return _0x1655a2;})['then'](respondWithResult(_0x495273,0xc9))[_0x0b5b('0x45')](handleError(_0x495273,null));};exports['update']=function(_0x333425,_0x4d8806){if(_0x333425[_0x0b5b('0x4a')]['id']){delete _0x333425[_0x0b5b('0x4a')]['id'];}return db[_0x0b5b('0x30')][_0x0b5b('0x4d')]({'where':{'id':_0x333425['params']['id']}})[_0x0b5b('0x26')](handleEntityNotFound(_0x4d8806,null))[_0x0b5b('0x26')](saveUpdates(_0x333425[_0x0b5b('0x4a')],null))[_0x0b5b('0x26')](respondWithResult(_0x4d8806,null))[_0x0b5b('0x45')](handleError(_0x4d8806,null));};exports['destroy']=function(_0x21f14f,_0x5dc9c5){return db[_0x0b5b('0x30')][_0x0b5b('0x4d')]({'where':{'id':_0x21f14f['params']['id']}})[_0x0b5b('0x26')](handleEntityNotFound(_0x5dc9c5,null))[_0x0b5b('0x26')](removeEntity(_0x5dc9c5,null))[_0x0b5b('0x45')](handleError(_0x5dc9c5,null));}; \ No newline at end of file +var _0xfc1e=['Pause','type','key','model','map','name','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','catch','show','rawAttributes','intersection','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Pauses','UserProfileResource','destroy','end','stack','index'];(function(_0x589cdf,_0x53f463){var _0x5f0774=function(_0x530589){while(--_0x530589){_0x589cdf['push'](_0x589cdf['shift']());}};_0x5f0774(++_0x53f463);}(_0xfc1e,0x182));var _0xefc1=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0xfc1e[_0x2eb3db];return _0x358f33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefc1('0x0'));var zipdir=require(_0xefc1('0x1'));var jsonpatch=require(_0xefc1('0x2'));var rp=require(_0xefc1('0x3'));var moment=require(_0xefc1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xefc1('0x5'));var util=require(_0xefc1('0x6'));var path=require(_0xefc1('0x7'));var sox=require('sox');var csv=require(_0xefc1('0x8'));var ejs=require(_0xefc1('0x9'));var fs=require('fs');var fs_extra=require(_0xefc1('0xa'));var _=require(_0xefc1('0xb'));var squel=require(_0xefc1('0xc'));var crypto=require(_0xefc1('0xd'));var jsforce=require(_0xefc1('0xe'));var deskjs=require(_0xefc1('0xf'));var toCsv=require(_0xefc1('0x8'));var querystring=require(_0xefc1('0x10'));var Papa=require(_0xefc1('0x11'));var Redis=require(_0xefc1('0x12'));var authService=require(_0xefc1('0x13'));var qs=require(_0xefc1('0x14'));var as=require(_0xefc1('0x15'));var hardwareService=require(_0xefc1('0x16'));var logger=require('../../config/logger')(_0xefc1('0x17'));var utils=require(_0xefc1('0x18'));var config=require(_0xefc1('0x19'));var licenseUtil=require(_0xefc1('0x1a'));var db=require(_0xefc1('0x1b'))['db'];function respondWithStatusCode(_0x1db671,_0x216b66){_0x216b66=_0x216b66||0xcc;return function(_0x5a74ab){if(_0x5a74ab){return _0x1db671[_0xefc1('0x1c')](_0x216b66);}return _0x1db671[_0xefc1('0x1d')](_0x216b66)['end']();};}function respondWithResult(_0x2de030,_0x10a625){_0x10a625=_0x10a625||0xc8;return function(_0x3273bb){if(_0x3273bb){return _0x2de030[_0xefc1('0x1d')](_0x10a625)[_0xefc1('0x1e')](_0x3273bb);}};}function respondWithFilteredResult(_0x56d5a7,_0x50648c){return function(_0x687aef){if(_0x687aef){var _0x2f10e1=typeof _0x50648c['offset']===_0xefc1('0x1f')&&typeof _0x50648c[_0xefc1('0x20')]===_0xefc1('0x1f');var _0x560d0b=_0x687aef[_0xefc1('0x21')];var _0x3aaaeb=_0x2f10e1?0x0:_0x50648c[_0xefc1('0x22')];var _0x2def7e=_0x2f10e1?_0x687aef[_0xefc1('0x21')]:_0x50648c[_0xefc1('0x22')]+_0x50648c[_0xefc1('0x20')];var _0x1d660a;if(_0x2def7e>=_0x560d0b){_0x2def7e=_0x560d0b;_0x1d660a=0xc8;}else{_0x1d660a=0xce;}_0x56d5a7[_0xefc1('0x1d')](_0x1d660a);return _0x56d5a7[_0xefc1('0x23')](_0xefc1('0x24'),_0x3aaaeb+'-'+_0x2def7e+'/'+_0x560d0b)['json'](_0x687aef);}return null;};}function patchUpdates(_0x2b0be6){return function(_0x233d95){try{jsonpatch[_0xefc1('0x25')](_0x233d95,_0x2b0be6,!![]);}catch(_0x4b2ff7){return BPromise[_0xefc1('0x26')](_0x4b2ff7);}return _0x233d95[_0xefc1('0x27')]();};}function saveUpdates(_0x26b036,_0x29c80c){return function(_0x50b2cd){if(_0x50b2cd){return _0x50b2cd[_0xefc1('0x28')](_0x26b036)[_0xefc1('0x29')](function(_0x5eac67){return _0x5eac67;});}return null;};}function removeEntity(_0x575c37,_0x281b3e){return function(_0x3f6001){if(_0x3f6001){return _0x3f6001['destroy']()[_0xefc1('0x29')](function(){var _0x89159c=_0x3f6001[_0xefc1('0x2a')]({'plain':!![]});var _0x239314=_0xefc1('0x2b');return db[_0xefc1('0x2c')][_0xefc1('0x2d')]({'where':{'type':_0x239314,'resourceId':_0x89159c['id']}})[_0xefc1('0x29')](function(){return _0x3f6001;});})[_0xefc1('0x29')](function(){_0x575c37[_0xefc1('0x1d')](0xcc)[_0xefc1('0x2e')]();});}};}function handleEntityNotFound(_0x3244d8,_0x104394){return function(_0x2a836d){if(!_0x2a836d){_0x3244d8[_0xefc1('0x1c')](0x194);}return _0x2a836d;};}function handleError(_0x6a4c2d,_0x343954){_0x343954=_0x343954||0x1f4;return function(_0x22b36e){logger['error'](_0x22b36e[_0xefc1('0x2f')]);if(_0x22b36e['name']){delete _0x22b36e['name'];}_0x6a4c2d[_0xefc1('0x1d')](_0x343954)['send'](_0x22b36e);};}exports[_0xefc1('0x30')]=function(_0x49a6fc,_0x417cef){var _0x70ad8c={},_0x10fd61={},_0x1c6261={'count':0x0,'rows':[]};var _0x4e202e=_['map'](db[_0xefc1('0x31')]['rawAttributes'],function(_0x25d1e7){return{'name':_0x25d1e7['fieldName'],'type':_0x25d1e7[_0xefc1('0x32')][_0xefc1('0x33')]};});_0x10fd61[_0xefc1('0x34')]=_[_0xefc1('0x35')](_0x4e202e,_0xefc1('0x36'));_0x10fd61[_0xefc1('0x37')]=_[_0xefc1('0x38')](_0x49a6fc[_0xefc1('0x37')]);_0x10fd61[_0xefc1('0x39')]=_['intersection'](_0x10fd61[_0xefc1('0x34')],_0x10fd61[_0xefc1('0x37')]);_0x70ad8c['attributes']=_['intersection'](_0x10fd61[_0xefc1('0x34')],qs[_0xefc1('0x3a')](_0x49a6fc[_0xefc1('0x37')]['fields']));_0x70ad8c[_0xefc1('0x3b')]=_0x70ad8c['attributes'][_0xefc1('0x3c')]?_0x70ad8c[_0xefc1('0x3b')]:_0x10fd61[_0xefc1('0x34')];if(!_0x49a6fc[_0xefc1('0x37')][_0xefc1('0x3d')](_0xefc1('0x3e'))){_0x70ad8c[_0xefc1('0x20')]=qs['limit'](_0x49a6fc[_0xefc1('0x37')]['limit']);_0x70ad8c[_0xefc1('0x22')]=qs[_0xefc1('0x22')](_0x49a6fc['query'][_0xefc1('0x22')]);}_0x70ad8c[_0xefc1('0x3f')]=qs[_0xefc1('0x40')](_0x49a6fc[_0xefc1('0x37')]['sort']);_0x70ad8c[_0xefc1('0x41')]=qs[_0xefc1('0x39')](_[_0xefc1('0x42')](_0x49a6fc[_0xefc1('0x37')],_0x10fd61['filters']),_0x4e202e);if(_0x49a6fc[_0xefc1('0x37')][_0xefc1('0x43')]){_0x70ad8c['where']=_['merge'](_0x70ad8c[_0xefc1('0x41')],{'$or':_['map'](_0x4e202e,function(_0x25fd26){if(_0x25fd26[_0xefc1('0x32')]!=='VIRTUAL'){var _0x101e33={};_0x101e33[_0x25fd26[_0xefc1('0x36')]]={'$like':'%'+_0x49a6fc[_0xefc1('0x37')]['filter']+'%'};return _0x101e33;}})});}_0x70ad8c=_[_0xefc1('0x44')]({},_0x70ad8c,_0x49a6fc[_0xefc1('0x45')]);var _0xef6a9c={'where':_0x70ad8c[_0xefc1('0x41')]};return db[_0xefc1('0x31')][_0xefc1('0x21')](_0xef6a9c)[_0xefc1('0x29')](function(_0x4e3738){_0x1c6261['count']=_0x4e3738;if(_0x49a6fc[_0xefc1('0x37')]['includeAll']){_0x70ad8c[_0xefc1('0x46')]=[{'all':!![]}];}return db[_0xefc1('0x31')]['findAll'](_0x70ad8c);})[_0xefc1('0x29')](function(_0x3756ca){_0x1c6261[_0xefc1('0x47')]=_0x3756ca;return _0x1c6261;})[_0xefc1('0x29')](respondWithFilteredResult(_0x417cef,_0x70ad8c))[_0xefc1('0x48')](handleError(_0x417cef,null));};exports[_0xefc1('0x49')]=function(_0x596a7d,_0x40c3f5){var _0x2911dc={'raw':!![],'where':{'id':_0x596a7d['params']['id']}},_0x1d2c03={};_0x1d2c03[_0xefc1('0x34')]=_[_0xefc1('0x38')](db[_0xefc1('0x31')][_0xefc1('0x4a')]);_0x1d2c03['query']=_[_0xefc1('0x38')](_0x596a7d['query']);_0x1d2c03['filters']=_[_0xefc1('0x4b')](_0x1d2c03[_0xefc1('0x34')],_0x1d2c03[_0xefc1('0x37')]);_0x2911dc['attributes']=_[_0xefc1('0x4b')](_0x1d2c03['model'],qs[_0xefc1('0x3a')](_0x596a7d[_0xefc1('0x37')][_0xefc1('0x3a')]));_0x2911dc[_0xefc1('0x3b')]=_0x2911dc[_0xefc1('0x3b')]['length']?_0x2911dc[_0xefc1('0x3b')]:_0x1d2c03[_0xefc1('0x34')];if(_0x596a7d['query'][_0xefc1('0x4c')]){_0x2911dc[_0xefc1('0x46')]=[{'all':!![]}];}_0x2911dc=_[_0xefc1('0x44')]({},_0x2911dc,_0x596a7d[_0xefc1('0x45')]);return db[_0xefc1('0x31')][_0xefc1('0x4d')](_0x2911dc)[_0xefc1('0x29')](handleEntityNotFound(_0x40c3f5,null))[_0xefc1('0x29')](respondWithResult(_0x40c3f5,null))['catch'](handleError(_0x40c3f5,null));};exports['create']=function(_0x306e18,_0x4465b1){return db['Pause'][_0xefc1('0x4e')](_0x306e18['body'],{})['then'](function(_0x5540ec){var _0x167288=_0x306e18[_0xefc1('0x4f')][_0xefc1('0x2a')]({'plain':!![]});if(!_0x167288)throw new Error(_0xefc1('0x50'));if(_0x167288['role']==='user'){var _0x400638=_0x5540ec[_0xefc1('0x2a')]({'plain':!![]});var _0xdab41c=_0xefc1('0x2b');return db[_0xefc1('0x51')][_0xefc1('0x4d')]({'where':{'name':_0xdab41c,'userProfileId':_0x167288[_0xefc1('0x52')]},'raw':!![]})['then'](function(_0x39a02e){if(_0x39a02e&&_0x39a02e[_0xefc1('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x400638[_0xefc1('0x36')],'resourceId':_0x400638['id'],'type':_0x39a02e[_0xefc1('0x36')],'sectionId':_0x39a02e['id']},{})[_0xefc1('0x29')](function(){return _0x5540ec;});}else{return _0x5540ec;}})[_0xefc1('0x48')](function(_0xff2b60){logger['error'](_0xefc1('0x54'),_0xff2b60);throw _0xff2b60;});}return _0x5540ec;})[_0xefc1('0x29')](respondWithResult(_0x4465b1,0xc9))[_0xefc1('0x48')](handleError(_0x4465b1,null));};exports['update']=function(_0x392379,_0xcf4a70){if(_0x392379[_0xefc1('0x55')]['id']){delete _0x392379[_0xefc1('0x55')]['id'];}return db[_0xefc1('0x31')][_0xefc1('0x4d')]({'where':{'id':_0x392379[_0xefc1('0x56')]['id']}})[_0xefc1('0x29')](handleEntityNotFound(_0xcf4a70,null))[_0xefc1('0x29')](saveUpdates(_0x392379[_0xefc1('0x55')],null))[_0xefc1('0x29')](respondWithResult(_0xcf4a70,null))[_0xefc1('0x48')](handleError(_0xcf4a70,null));};exports[_0xefc1('0x2d')]=function(_0x242499,_0x50af9b){return db[_0xefc1('0x31')]['find']({'where':{'id':_0x242499['params']['id']}})[_0xefc1('0x29')](handleEntityNotFound(_0x50af9b,null))[_0xefc1('0x29')](removeEntity(_0x50af9b,null))[_0xefc1('0x48')](handleError(_0x50af9b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 92ec43d..fcc176e 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x7217,0x19e));var _0x7721=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7217[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x2b78cb,_0x3f5912){var _0x4b8ba6=function(_0x2c145f){while(--_0x2c145f){_0x2b78cb['push'](_0x2b78cb['shift']());}};_0x4b8ba6(++_0x3f5912);}(_0x5fab,0x177));var _0xb5fa=function(_0x2220d7,_0x804d20){_0x2220d7=_0x2220d7-0x0;var _0xe4a29f=_0x5fab[_0x2220d7];return _0xe4a29f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 3275b3c..0b0e617 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(_0x20c594,_0x1454f7){var _0x4c39fd=function(_0x4e214a){while(--_0x4e214a){_0x20c594['push'](_0x20c594['shift']());}};_0x4c39fd(++_0x1454f7);}(_0x7a54,0x106));var _0x47a5=function(_0x5579b5,_0x5441c1){_0x5579b5=_0x5579b5-0x0;var _0x51b7cb=_0x7a54[_0x5579b5];return _0x51b7cb;};'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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x41d200,_0x230259){var _0x53c364=function(_0x541f7f){while(--_0x541f7f){_0x41d200['push'](_0x41d200['shift']());}};_0x53c364(++_0x230259);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xb10b[_0x3a1ea5];return _0xfac9b2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 2cc53cd..a48ded8 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 _0xb821=['upload','post','update','delete','exports','util','path','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','basename','extname','single'];(function(_0x58c17c,_0x37e964){var _0x4b7828=function(_0x58a7f2){while(--_0x58a7f2){_0x58c17c['push'](_0x58c17c['shift']());}};_0x4b7828(++_0x37e964);}(_0xb821,0xa7));var _0x1b82=function(_0x2a4ee5,_0x43a71e){_0x2a4ee5=_0x2a4ee5-0x0;var _0x334164=_0xb821[_0x2a4ee5];return _0x334164;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),controller[_0x1b82('0x9')]);router[_0x1b82('0x6')](_0x1b82('0xa'),auth[_0x1b82('0xb')](),controller[_0x1b82('0xc')]);router[_0x1b82('0x6')]('/:id/download',auth[_0x1b82('0xb')](),controller[_0x1b82('0xd')]);var upload=multer({'storage':multer[_0x1b82('0xe')]({'destination':function(_0x14c57a,_0xcffb87,_0x17a96b){_0x17a96b(null,path[_0x1b82('0xf')](config[_0x1b82('0x10')],'server/files/plugins'));},'filename':function(_0x46007e,_0x241d11,_0x2391f5){_0x241d11[_0x1b82('0x11')]=_0x241d11['originalname'][_0x1b82('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2391f5(null,util['format']('%s-%s%s',path[_0x1b82('0x13')](_0x241d11['originalname'],path[_0x1b82('0x14')](_0x241d11[_0x1b82('0x11')])),Date['now'](),path[_0x1b82('0x14')](_0x241d11['originalname'])));}})});router['post']('/',upload[_0x1b82('0x15')]('file'),controller[_0x1b82('0x16')]);router[_0x1b82('0x17')](_0x1b82('0x8'),controller['webhookPost']);router['put'](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x18')]);router[_0x1b82('0x19')](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x19')]);module[_0x1b82('0x1a')]=router; \ No newline at end of file +var _0xb903=['replace','basename','originalname','now','extname','post','single','/webhook','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','join','root'];(function(_0x392a82,_0x51f168){var _0x1e6b71=function(_0xdf18b0){while(--_0xdf18b0){_0x392a82['push'](_0x392a82['shift']());}};_0x1e6b71(++_0x51f168);}(_0xb903,0x185));var _0x3b90=function(_0x2431f7,_0x4d4a47){_0x2431f7=_0x2431f7-0x0;var _0x2ca3ce=_0xb903[_0x2431f7];return _0x2ca3ce;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/webhook',controller[_0x3b90('0xc')]);router[_0x3b90('0xa')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336913,_0x5af39c,_0x574955){_0x574955(null,path[_0x3b90('0xf')](config[_0x3b90('0x10')],'server/files/plugins'));},'filename':function(_0x45b75f,_0x174c0d,_0x43c08c){_0x174c0d['originalname']=_0x174c0d['originalname'][_0x3b90('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43c08c(null,util['format']('%s-%s%s',path[_0x3b90('0x12')](_0x174c0d[_0x3b90('0x13')],path['extname'](_0x174c0d['originalname'])),Date[_0x3b90('0x14')](),path[_0x3b90('0x15')](_0x174c0d[_0x3b90('0x13')])));}})});router[_0x3b90('0x16')]('/',upload[_0x3b90('0x17')]('file'),controller['upload']);router[_0x3b90('0x16')](_0x3b90('0x18'),controller['webhookPost']);router[_0x3b90('0x19')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller[_0x3b90('0x1a')]);router['delete'](_0x3b90('0xd'),auth['isAuthenticated'](),controller[_0x3b90('0x1b')]);module[_0x3b90('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index eb07913..63cbb07 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 _0x666b=['html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING'];(function(_0x12384c,_0x1d80ea){var _0x12be81=function(_0x3f9eee){while(--_0x3f9eee){_0x12384c['push'](_0x12384c['shift']());}};_0x12be81(++_0x1d80ea);}(_0x666b,0x1b9));var _0xb666=function(_0x122534,_0x4f9590){_0x122534=_0x122534-0x0;var _0x357aa6=_0x666b[_0x122534];return _0x357aa6;};'use strict';var Sequelize=require(_0xb666('0x0'));module[_0xb666('0x1')]={'name':{'type':Sequelize[_0xb666('0x2')]},'type':{'type':Sequelize['ENUM'](_0xb666('0x3'),_0xb666('0x4'))},'description':{'type':Sequelize[_0xb666('0x5')]},'version':{'type':Sequelize[_0xb666('0x5')]},'path':{'type':Sequelize['STRING'],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xb666('0x6')],'defaultValue':0x0,'comment':_0xb666('0x7')},'sidebar':{'type':Sequelize[_0xb666('0x8')](_0xb666('0x9'),'agentOnly',_0xb666('0xa'),'never'),'defaultValue':_0xb666('0xa'),'comment':_0xb666('0xb')},'icon':{'type':Sequelize[_0xb666('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xb666('0x2')]},'scriptName':{'type':Sequelize[_0xb666('0x2')]},'scriptPath':{'type':Sequelize[_0xb666('0x2')]}}; \ No newline at end of file +var _0x3dd3=['sequelize','exports','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x3dd3,0x75));var _0x33dd=function(_0x2d4eef,_0x2c37d5){_0x2d4eef=_0x2d4eef-0x0;var _0x25839d=_0x3dd3[_0x2d4eef];return _0x25839d;};'use strict';var Sequelize=require(_0x33dd('0x0'));module[_0x33dd('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x33dd('0x2')](_0x33dd('0x3'),'script')},'description':{'type':Sequelize[_0x33dd('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x33dd('0x5')},'active':{'type':Sequelize[_0x33dd('0x6')],'defaultValue':0x0,'comment':_0x33dd('0x7')},'sidebar':{'type':Sequelize[_0x33dd('0x2')](_0x33dd('0x8'),'agentOnly','always',_0x33dd('0x9')),'defaultValue':_0x33dd('0xa'),'comment':_0x33dd('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x33dd('0xc')]},'agentUrl':{'type':Sequelize[_0x33dd('0xc')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x33dd('0xc')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 144de6c..c2c1078 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 _0x66f2=['limit','count','status','set','Content-Range','apply','update','then','destroy','get','end','error','stack','name','index','map','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','Plugin','includeAll','catch','show','params','include','find','path','join','root','server/files/plugins','format','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','offset','undefined'];(function(_0x4058d8,_0x42baee){var _0x4f1013=function(_0x20c2c7){while(--_0x20c2c7){_0x4058d8['push'](_0x4058d8['shift']());}};_0x4f1013(++_0x42baee);}(_0x66f2,0x1dc));var _0x266f=function(_0x53f5ec,_0x34bca9){_0x53f5ec=_0x53f5ec-0x0;var _0x4e2d6a=_0x66f2[_0x53f5ec];return _0x4e2d6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x266f('0x0'));var zipdir=require(_0x266f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x266f('0x2'));var moment=require(_0x266f('0x3'));var BPromise=require(_0x266f('0x4'));var Mustache=require(_0x266f('0x5'));var util=require(_0x266f('0x6'));var path=require('path');var sox=require(_0x266f('0x7'));var csv=require(_0x266f('0x8'));var ejs=require(_0x266f('0x9'));var fs=require('fs');var fs_extra=require(_0x266f('0xa'));var _=require(_0x266f('0xb'));var squel=require('squel');var crypto=require(_0x266f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x266f('0x8'));var querystring=require(_0x266f('0xd'));var Papa=require(_0x266f('0xe'));var extract=require(_0x266f('0xf'));var rimraf=require('rimraf');var archiver=require(_0x266f('0x10'));var Redis=require(_0x266f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x266f('0x12'));var as=require(_0x266f('0x13'));var hardwareService=require(_0x266f('0x14'));var logger=require('../../config/logger')(_0x266f('0x15'));var utils=require(_0x266f('0x16'));var config=require(_0x266f('0x17'));var licenseUtil=require(_0x266f('0x18'));var db=require('../../mysqldb')['db'];config[_0x266f('0x19')]=_[_0x266f('0x1a')](config[_0x266f('0x19')],{'host':_0x266f('0x1b'),'port':0x18eb});var socket=require(_0x266f('0x1c'))(new Redis(config[_0x266f('0x19')]));require('./plugin.socket')[_0x266f('0x1d')](socket);function respondWithStatusCode(_0xa562f2,_0xc078b9){_0xc078b9=_0xc078b9||0xcc;return function(_0x34e69c){if(_0x34e69c){return _0xa562f2[_0x266f('0x1e')](_0xc078b9);}return _0xa562f2['status'](_0xc078b9)['end']();};}function respondWithResult(_0x1cb4b3,_0x39a576){_0x39a576=_0x39a576||0xc8;return function(_0x43c25f){if(_0x43c25f){return _0x1cb4b3['status'](_0x39a576)[_0x266f('0x1f')](_0x43c25f);}};}function respondWithFilteredResult(_0x3c583d,_0x2ecf74){return function(_0x277bde){if(_0x277bde){var _0x311c9c=typeof _0x2ecf74[_0x266f('0x20')]===_0x266f('0x21')&&typeof _0x2ecf74[_0x266f('0x22')]==='undefined';var _0x39e184=_0x277bde['count'];var _0x1a9207=_0x311c9c?0x0:_0x2ecf74[_0x266f('0x20')];var _0x2b09cc=_0x311c9c?_0x277bde[_0x266f('0x23')]:_0x2ecf74[_0x266f('0x20')]+_0x2ecf74[_0x266f('0x22')];var _0x174170;if(_0x2b09cc>=_0x39e184){_0x2b09cc=_0x39e184;_0x174170=0xc8;}else{_0x174170=0xce;}_0x3c583d[_0x266f('0x24')](_0x174170);return _0x3c583d[_0x266f('0x25')](_0x266f('0x26'),_0x1a9207+'-'+_0x2b09cc+'/'+_0x39e184)[_0x266f('0x1f')](_0x277bde);}return null;};}function patchUpdates(_0x19f7f2){return function(_0x2a8d42){try{jsonpatch[_0x266f('0x27')](_0x2a8d42,_0x19f7f2,!![]);}catch(_0x35d986){return BPromise['reject'](_0x35d986);}return _0x2a8d42['save']();};}function saveUpdates(_0x22474a,_0x396ed2){return function(_0x5098d6){if(_0x5098d6){return _0x5098d6[_0x266f('0x28')](_0x22474a)[_0x266f('0x29')](function(_0x35bd67){return _0x35bd67;});}return null;};}function removeEntity(_0x526942,_0x28b2ec){return function(_0x301b20){if(_0x301b20){return _0x301b20[_0x266f('0x2a')]()['then'](function(){var _0x212d2a=_0x301b20[_0x266f('0x2b')]({'plain':!![]});var _0x450c08='Plugins';return db['UserProfileResource'][_0x266f('0x2a')]({'where':{'type':_0x450c08,'resourceId':_0x212d2a['id']}})['then'](function(){return _0x301b20;});})[_0x266f('0x29')](function(){_0x526942[_0x266f('0x24')](0xcc)[_0x266f('0x2c')]();});}};}function handleEntityNotFound(_0x496df7,_0x45c940){return function(_0x1d351b){if(!_0x1d351b){_0x496df7['sendStatus'](0x194);}return _0x1d351b;};}function handleError(_0x3bfc30,_0x1dadc8){_0x1dadc8=_0x1dadc8||0x1f4;return function(_0x22916d){logger[_0x266f('0x2d')](_0x22916d[_0x266f('0x2e')]);if(_0x22916d[_0x266f('0x2f')]){delete _0x22916d[_0x266f('0x2f')];}_0x3bfc30[_0x266f('0x24')](_0x1dadc8)['send'](_0x22916d);};}exports[_0x266f('0x30')]=function(_0x3ac9e0,_0x39b22a){var _0x458869={},_0x3cbb2f={},_0x2f56f4={'count':0x0,'rows':[]};var _0x1b0db2=_[_0x266f('0x31')](db['Plugin'][_0x266f('0x32')],function(_0x3de3d1){return{'name':_0x3de3d1['fieldName'],'type':_0x3de3d1['type'][_0x266f('0x33')]};});_0x3cbb2f[_0x266f('0x34')]=_[_0x266f('0x31')](_0x1b0db2,_0x266f('0x2f'));_0x3cbb2f[_0x266f('0x35')]=_[_0x266f('0x36')](_0x3ac9e0['query']);_0x3cbb2f['filters']=_['intersection'](_0x3cbb2f[_0x266f('0x34')],_0x3cbb2f['query']);_0x458869[_0x266f('0x37')]=_[_0x266f('0x38')](_0x3cbb2f['model'],qs[_0x266f('0x39')](_0x3ac9e0[_0x266f('0x35')][_0x266f('0x39')]));_0x458869[_0x266f('0x37')]=_0x458869['attributes'][_0x266f('0x3a')]?_0x458869[_0x266f('0x37')]:_0x3cbb2f[_0x266f('0x34')];if(!_0x3ac9e0[_0x266f('0x35')]['hasOwnProperty'](_0x266f('0x3b'))){_0x458869[_0x266f('0x22')]=qs['limit'](_0x3ac9e0['query']['limit']);_0x458869[_0x266f('0x20')]=qs[_0x266f('0x20')](_0x3ac9e0[_0x266f('0x35')][_0x266f('0x20')]);}_0x458869[_0x266f('0x3c')]=qs[_0x266f('0x3d')](_0x3ac9e0['query']['sort']);_0x458869[_0x266f('0x3e')]=qs[_0x266f('0x3f')](_['pick'](_0x3ac9e0['query'],_0x3cbb2f[_0x266f('0x3f')]),_0x1b0db2);if(_0x3ac9e0[_0x266f('0x35')]['filter']){_0x458869[_0x266f('0x3e')]=_[_0x266f('0x40')](_0x458869[_0x266f('0x3e')],{'$or':_[_0x266f('0x31')](_0x1b0db2,function(_0x229d6d){if(_0x229d6d[_0x266f('0x41')]!==_0x266f('0x42')){var _0x3c77f4={};_0x3c77f4[_0x229d6d[_0x266f('0x2f')]]={'$like':'%'+_0x3ac9e0[_0x266f('0x35')][_0x266f('0x43')]+'%'};return _0x3c77f4;}})});}_0x458869=_['merge']({},_0x458869,_0x3ac9e0[_0x266f('0x44')]);var _0x107c25={'where':_0x458869[_0x266f('0x3e')]};return db[_0x266f('0x45')][_0x266f('0x23')](_0x107c25)[_0x266f('0x29')](function(_0x31d951){_0x2f56f4[_0x266f('0x23')]=_0x31d951;if(_0x3ac9e0[_0x266f('0x35')][_0x266f('0x46')]){_0x458869['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x458869);})[_0x266f('0x29')](function(_0x2066f0){_0x2f56f4['rows']=_0x2066f0;return _0x2f56f4;})['then'](respondWithFilteredResult(_0x39b22a,_0x458869))[_0x266f('0x47')](handleError(_0x39b22a,null));};exports[_0x266f('0x48')]=function(_0xf2115b,_0x1b8850){var _0x2e0f07={'raw':!![],'where':{'id':_0xf2115b[_0x266f('0x49')]['id']}},_0x12523d={};_0x12523d[_0x266f('0x34')]=_[_0x266f('0x36')](db[_0x266f('0x45')][_0x266f('0x32')]);_0x12523d[_0x266f('0x35')]=_[_0x266f('0x36')](_0xf2115b['query']);_0x12523d[_0x266f('0x3f')]=_['intersection'](_0x12523d[_0x266f('0x34')],_0x12523d['query']);_0x2e0f07[_0x266f('0x37')]=_[_0x266f('0x38')](_0x12523d[_0x266f('0x34')],qs['fields'](_0xf2115b[_0x266f('0x35')][_0x266f('0x39')]));_0x2e0f07[_0x266f('0x37')]=_0x2e0f07[_0x266f('0x37')][_0x266f('0x3a')]?_0x2e0f07['attributes']:_0x12523d[_0x266f('0x34')];if(_0xf2115b[_0x266f('0x35')][_0x266f('0x46')]){_0x2e0f07[_0x266f('0x4a')]=[{'all':!![]}];}_0x2e0f07=_[_0x266f('0x40')]({},_0x2e0f07,_0xf2115b['options']);return db[_0x266f('0x45')][_0x266f('0x4b')](_0x2e0f07)['then'](handleEntityNotFound(_0x1b8850,null))[_0x266f('0x29')](respondWithResult(_0x1b8850,null))[_0x266f('0x47')](handleError(_0x1b8850,null));};exports['download']=function(_0x252fe1,_0x2f03ab,_0x41cd1c){return db['Plugin'][_0x266f('0x4b')]({'where':{'id':_0x252fe1[_0x266f('0x49')]['id']},'attributes':['name',_0x266f('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x2f03ab,null))[_0x266f('0x29')](function(_0x5c0fad){if(_0x5c0fad){var _0x2cf467=path[_0x266f('0x4d')](config[_0x266f('0x4e')],_0x266f('0x4f'),util[_0x266f('0x50')]('%s.zip',path[_0x266f('0x51')](_0x5c0fad[_0x266f('0x4c')])));var _0x4f35e0=fs['createWriteStream'](_0x2cf467);var _0x36743e=archiver(_0x266f('0x52'),{'zlib':{'level':0x9}});_0x36743e['on'](_0x266f('0x53'),function(_0xb38ed7){if(_0xb38ed7[_0x266f('0x54')]===_0x266f('0x55')){logger[_0x266f('0x2d')](_0xb38ed7);}else{throw new db[(_0x266f('0x56'))][(_0x266f('0x57'))](_0x266f('0x58'));}});_0x36743e['on'](_0x266f('0x2d'),function(_0x440984){throw new db['Sequelize'][(_0x266f('0x57'))](_0x266f('0x58'));});_0x36743e['pipe'](_0x4f35e0);_0x36743e['glob'](_0x266f('0x59'),{'cwd':path['join'](config[_0x266f('0x4e')],_0x266f('0x4f'),path['dirname'](_0x5c0fad[_0x266f('0x4c')])),'ignore':[path['join'](path['basename'](_0x5c0fad['path']),_0x266f('0x5a')),path[_0x266f('0x4d')](path['basename'](_0x5c0fad['path']),'attachments/**/*')],'nodir':!![]})[_0x266f('0x5b')]();_0x4f35e0['on'](_0x266f('0x5c'),function(){if(!fs[_0x266f('0x5d')](_0x2cf467)){throw new db[(_0x266f('0x56'))]['Error'](_0x266f('0x5e'));}return _0x2f03ab[_0x266f('0x5f')](_0x2cf467,util[_0x266f('0x50')](_0x266f('0x60'),path['basename'](_0x5c0fad['path'])),function(_0xc99601){if(_0xc99601){throw new db['Sequelize'][(_0x266f('0x57'))](_0x266f('0x61'));}fs['unlinkSync'](_0x2cf467);logger[_0x266f('0x62')](_0x266f('0x63'));logger[_0x266f('0x62')](_0x266f('0x64'));});});}return null;})[_0x266f('0x47')](handleError(_0x2f03ab,null));};exports[_0x266f('0x65')]=function(_0x6e5ade,_0x34c4cc,_0x59f9a4){var _0xa10ff2=path[_0x266f('0x51')](_0x6e5ade[_0x266f('0x66')][_0x266f('0x67')],path[_0x266f('0x68')](_0x6e5ade['file'][_0x266f('0x67')]));var _0x5310d6=path[_0x266f('0x4d')](config[_0x266f('0x4e')],_0x266f('0x4f'),_0x6e5ade[_0x266f('0x66')][_0x266f('0x67')]);var _0x3ec705=path[_0x266f('0x4d')](config[_0x266f('0x4e')],'server/files/plugins',_0xa10ff2);logger[_0x266f('0x62')](_0x266f('0x69'),_0x5310d6);logger[_0x266f('0x62')](_0x266f('0x6a'),_0x3ec705);try{fs[_0x266f('0x6b')](_0x5310d6,parseInt(_0x266f('0x6c'),0x8));extract(_0x5310d6,{'dir':_0x3ec705},function(_0x3c67b6){if(_0x3c67b6){logger['error'](_0x3c67b6);handleError(_0x3c67b6,!![]);};var _0x48d59e=fs[_0x266f('0x6d')](_0x3ec705);if(_0x48d59e[_0x266f('0x3a')]>0x1){removeReferences(_0x5310d6,_0x3ec705);logger[_0x266f('0x2d')](_0x266f('0x6e'));return _0x59f9a4(new Error(_0x266f('0x6e')));}var _0x348b0d=fs[_0x266f('0x6f')](path[_0x266f('0x4d')](_0x3ec705,_0x48d59e[0x0]));if(_0x348b0d[_0x266f('0x70')]()){removeReferences(_0x5310d6,_0x3ec705);logger[_0x266f('0x2d')](_0x266f('0x6e'));return _0x59f9a4(new Error('Invalid\x20plugin\x20structure'));}if(_0x348b0d[_0x266f('0x71')]()){var _0x1db4b0=fs['readdirSync'](path['join'](_0x3ec705,_0x48d59e[0x0]));if(_0x1db4b0[_0x266f('0x3a')]===0x0){removeReferences(_0x5310d6,_0x3ec705);logger['error'](_0x266f('0x6e'));return _0x59f9a4(new Error('Invalid\x20plugin\x20structure'));}var _0x2d38d6=_0x1db4b0[_0x266f('0x72')](function(_0x34d540){return _0x34d540===_0x266f('0x73');});if(!_0x2d38d6){return _0x59f9a4(new Error(_0x266f('0x74')));}var _0x413634=fs['readFileSync'](path[_0x266f('0x4d')](_0x3ec705,_0x48d59e[0x0],_0x266f('0x73')));var _0x5b1af9=JSON[_0x266f('0x75')](_0x413634);if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x2f')]){return _0x59f9a4(new Error(_0x266f('0x76')));}if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x41')]){return _0x59f9a4(new Error(_0x266f('0x77')));}if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x78')]){return _0x59f9a4(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x5b1af9[_0x266f('0x79')]){return _0x59f9a4(new Error(_0x266f('0x7a')));}if(_0x5b1af9[_0x266f('0x41')]===_0x266f('0x7b')){if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')]){return _0x59f9a4(new Error(_0x266f('0x7d')));}if('undefined'==typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')]['admin']&&_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')]['agent']){return _0x59f9a4(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x5b1af9[_0x266f('0x41')]==='script'){if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7e')]){return _0x59f9a4(new Error(_0x266f('0x7f')));}if(_0x266f('0x21')==typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x80')]){return _0x59f9a4(new Error(_0x266f('0x81')));}}else{return _0x59f9a4(new Error(_0x266f('0x82')));}var _0x295afd=_0x5b1af9[_0x266f('0x2f')];var _0x4162e1=_0x5b1af9[_0x266f('0x83')];var _0x422c38=_0x5b1af9['type'];var _0x41c010=_0x5b1af9[_0x266f('0x84')]?_0x5b1af9['sidebar']:_0x266f('0x85');var _0x5f2de5=_0x5b1af9['icon']?_0x5b1af9[_0x266f('0x86')]:'icon-apps';var _0x357912='';var _0x19f08c='';var _0x175ceb='';var _0x5bf8fb='';var _0x331fa5=_0x5b1af9[_0x266f('0x78')];if(_0x422c38===_0x266f('0x7b')){if(_0x266f('0x21')!=typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')][_0x266f('0x87')]){var _0x3b5335=_0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')][_0x266f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x266f('0x88')](_0x3b5335)){_0x357912=path[_0x266f('0x4d')](_0x266f('0x89'),_0xa10ff2,_0x48d59e[0x0],_0x3b5335);}else{_0x357912=_0x3b5335;}}else{logger[_0x266f('0x62')](_0x266f('0x8a'));}if('undefined'!=typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')][_0x266f('0x8b')]){var _0x575ca4=_0x5b1af9['parameters'][_0x266f('0x7c')][_0x266f('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x266f('0x88')](_0x575ca4)){_0x19f08c=path['join'](_0x266f('0x89'),_0xa10ff2,_0x48d59e[0x0],_0x575ca4);}else{_0x19f08c=_0x575ca4;}}else{logger[_0x266f('0x62')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x422c38===_0x266f('0x8c')){_0x175ceb=_0x5b1af9['parameters']['scriptName'];_0x5bf8fb=_0x5b1af9[_0x266f('0x79')]['scriptPath'];if(_0x266f('0x21')!=typeof _0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')]){if(_0x266f('0x21')!=typeof _0x5b1af9['parameters'][_0x266f('0x7c')]['admin']){var _0x3b5335=_0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')][_0x266f('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x266f('0x88')](_0x3b5335)){_0x357912=path[_0x266f('0x4d')](_0x266f('0x89'),_0xa10ff2,_0x48d59e[0x0],_0x3b5335);}else{_0x357912=_0x3b5335;}}if(_0x266f('0x21')!=typeof _0x5b1af9['parameters'][_0x266f('0x7c')][_0x266f('0x8b')]){var _0x575ca4=_0x5b1af9[_0x266f('0x79')][_0x266f('0x7c')][_0x266f('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x266f('0x88')](_0x575ca4)){_0x19f08c=path[_0x266f('0x4d')](_0x266f('0x89'),_0xa10ff2,_0x48d59e[0x0],_0x575ca4);}else{_0x19f08c=_0x575ca4;}}}}var _0x31c082={'name':_0x295afd,'description':_0x4162e1,'path':path[_0x266f('0x4d')](_0xa10ff2,_0x48d59e[0x0]),'type':_0x422c38,'sidebar':_0x41c010,'icon':_0x5f2de5,'adminUrl':_0x357912,'agentUrl':_0x19f08c,'scriptName':_0x175ceb,'scriptPath':_0x5bf8fb,'version':_0x331fa5};removeReferences(_0x5310d6,null);return db['Plugin'][_0x266f('0x8d')](_0x31c082)[_0x266f('0x29')](function(_0x5be264){var _0x411a94={'role':_0x6e5ade[_0x266f('0x8e')][_0x266f('0x8f')],'userProfileId':_0x6e5ade[_0x266f('0x8e')][_0x266f('0x90')]};if(!_0x411a94)throw new Error(_0x266f('0x91'));if(_0x411a94[_0x266f('0x8f')]===_0x266f('0x92')){var _0x56f3d3=_0x5be264[_0x266f('0x2b')]({'plain':!![]});return db[_0x266f('0x93')][_0x266f('0x4b')]({'where':{'name':'Plugins','userProfileId':_0x411a94[_0x266f('0x90')]},'raw':!![]})[_0x266f('0x29')](function(_0x59c9e6){if(_0x59c9e6&&_0x59c9e6[_0x266f('0x94')]===0x0){return db[_0x266f('0x95')]['create']({'name':_0x56f3d3[_0x266f('0x2f')],'resourceId':_0x56f3d3['id'],'type':_0x59c9e6[_0x266f('0x2f')],'sectionId':_0x59c9e6['id']},{})['then'](function(){return _0x5be264;});}else{return _0x5be264;}})['catch'](function(_0x3f1ab9){logger[_0x266f('0x2d')](_0x266f('0x96'),_0x3f1ab9);throw _0x3f1ab9;});}return _0x5be264;})[_0x266f('0x29')](respondWithResult(_0x34c4cc,null))[_0x266f('0x47')](handleError(_0x34c4cc,null));}});}catch(_0x58b3e9){_0x34c4cc['status'](0x1f4)[_0x266f('0x97')](_0x58b3e9);}};function removeReferences(_0x2bc9f5,_0x5e0c5d){try{if(_0x2bc9f5){fs[_0x266f('0x98')](_0x2bc9f5);logger['info'](_0x266f('0x99'));}if(_0x5e0c5d){rimraf(_0x5e0c5d,function(){});logger['info'](_0x266f('0x9a'));}}catch(_0x2461cb){logger[_0x266f('0x2d')](_0x2461cb);}}exports[_0x266f('0x28')]=function(_0x5bf019,_0xf7cb40,_0x4bea5d){return db[_0x266f('0x45')][_0x266f('0x4b')]({'where':{'id':_0x5bf019[_0x266f('0x49')]['id']}})[_0x266f('0x29')](handleEntityNotFound(_0xf7cb40,null))[_0x266f('0x29')](saveUpdates(_0x5bf019[_0x266f('0x8e')],null))[_0x266f('0x29')](respondWithResult(_0xf7cb40,null))[_0x266f('0x47')](handleError(_0xf7cb40,null));};exports[_0x266f('0x9b')]=function(_0x4b3f80,_0x3036f6,_0xab86bc){return db['Plugin'][_0x266f('0x4b')]({'where':{'id':_0x4b3f80[_0x266f('0x49')]['id']}})[_0x266f('0x29')](function(_0x3300be){if(_0x3300be){return _0x3300be[_0x266f('0x2a')]();}})[_0x266f('0x29')](function(_0x5f4e96){rimraf(path['join'](config[_0x266f('0x4e')],_0x266f('0x4f'),path['dirname'](_0x5f4e96[_0x266f('0x4c')])),function(){});return _0x5f4e96;})['then'](handleEntityNotFound(_0x3036f6,null))[_0x266f('0x29')](respondWithStatusCode(_0x3036f6,null))[_0x266f('0x47')](handleError(_0x3036f6,null));};exports[_0x266f('0x9c')]=function(_0x7d4a9d,_0x42ec1b,_0x4336d4){return BPromise[_0x266f('0x9d')]()['then'](function(){if(!_0x7d4a9d[_0x266f('0x35')][_0x266f('0x4c')]){throw new Error(_0x266f('0x9e'));}if(!_0x7d4a9d['query']['port']){throw new Error(_0x266f('0x9f'));}var _0x73438b=_0x7d4a9d[_0x266f('0x35')][_0x266f('0xa0')]?_0x7d4a9d[_0x266f('0x35')]['hostname']+':'+_0x7d4a9d[_0x266f('0x35')][_0x266f('0xa1')]:_0x266f('0xa2')+_0x7d4a9d[_0x266f('0x35')][_0x266f('0xa1')];var _0x3bf6b6=_0x7d4a9d[_0x266f('0x35')][_0x266f('0x1f')]?_0x7d4a9d['query']['json']:!![];var _0x1ab14a=_0x7d4a9d[_0x266f('0x35')][_0x266f('0xa3')]?_0x7d4a9d['query']['encoding']:null;var _0x27214b={'method':_0x7d4a9d['method'],'uri':util[_0x266f('0x50')](_0x266f('0xa4'),_0x73438b,_0x7d4a9d['query'][_0x266f('0x4c')]),'json':_0x3bf6b6,'resolveWithFullResponse':!![],'encoding':_0x1ab14a,'qs':_0x7d4a9d['query']};if(_0x7d4a9d[_0x266f('0xa5')]){_0x27214b[_0x266f('0xa5')]=_0x7d4a9d[_0x266f('0xa5')];if(_0x27214b[_0x266f('0xa5')][_0x266f('0xa6')]){delete _0x27214b[_0x266f('0xa5')][_0x266f('0xa6')];}}if(_0x27214b[_0x266f('0xa5')][_0x266f('0xa7')]){delete _0x27214b[_0x266f('0xa5')]['content-type'];}return rp(_0x27214b);})[_0x266f('0x29')](function(_0x4ecca6){if(_0x4ecca6){_0x42ec1b[_0x266f('0x25')](_0x4ecca6['headers']);logger[_0x266f('0x62')](_0x4ecca6[_0x266f('0x8e')]);if(_['endsWith'](_0x7d4a9d[_0x266f('0x35')][_0x266f('0x4c')],_0x266f('0x5f'))&&_0x4ecca6[_0x266f('0xa8')]==0x1f4){return _0x42ec1b[_0x266f('0x1e')](_0x4ecca6[_0x266f('0xa8')]);}else{return _0x42ec1b[_0x266f('0x24')](_0x4ecca6['statusCode'])[_0x266f('0x97')](_0x4ecca6[_0x266f('0x8e')]);}}else{return _0x42ec1b[_0x266f('0x1e')](0xc8);}})[_0x266f('0x47')](handleError(_0x42ec1b,null));};exports[_0x266f('0xa9')]=function(_0x4f59a1,_0x3a8486,_0x2bf2e9){return BPromise[_0x266f('0x9d')]()[_0x266f('0x29')](function(){if(!_0x4f59a1['query'][_0x266f('0x4c')]){throw new Error(_0x266f('0x9e'));}if(!_0x4f59a1[_0x266f('0x35')][_0x266f('0xa1')]){throw new Error(_0x266f('0x9f'));}var _0x2b31ff=_0x4f59a1['query'][_0x266f('0xa0')]?_0x4f59a1['query']['hostname']+':'+_0x4f59a1[_0x266f('0x35')][_0x266f('0xa1')]:'http://localhost:'+_0x4f59a1[_0x266f('0x35')][_0x266f('0xa1')];var _0x3c2e01=_0x4f59a1[_0x266f('0x35')][_0x266f('0x1f')]?_0x4f59a1[_0x266f('0x35')][_0x266f('0x1f')]:!![];var _0x3a778f=_0x4f59a1['query'][_0x266f('0xa3')]?_0x4f59a1[_0x266f('0x35')][_0x266f('0xa3')]:null;var _0x1cf1c2={'method':_0x4f59a1['method'],'uri':util['format']('%s%s',_0x2b31ff,_0x4f59a1['query']['path']),'json':_0x3c2e01,'resolveWithFullResponse':!![],'encoding':_0x3a778f,'body':_0x4f59a1[_0x266f('0x8e')]};if(_0x4f59a1[_0x266f('0xa5')]){_0x1cf1c2[_0x266f('0xa5')]=_0x4f59a1['headers'];if(_0x1cf1c2[_0x266f('0xa5')][_0x266f('0xa6')]){delete _0x1cf1c2[_0x266f('0xa5')]['content-length'];}}if(_0x1cf1c2[_0x266f('0xa5')][_0x266f('0xa7')]){delete _0x1cf1c2[_0x266f('0xa5')][_0x266f('0xa7')];}return rp(_0x1cf1c2);})[_0x266f('0x29')](function(_0x485d8d){if(_0x485d8d){_0x3a8486['set'](_0x485d8d['headers']);logger[_0x266f('0x62')](_0x485d8d['body']);return _0x3a8486[_0x266f('0x24')](_0x485d8d[_0x266f('0xa8')])[_0x266f('0x97')](_0x485d8d[_0x266f('0x8e')]);}else{return _0x3a8486[_0x266f('0x1e')](0xc8);}})[_0x266f('0x47')](handleError(_0x3a8486,null));}; \ No newline at end of file +var _0xf2a9=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','include','findAll','rows','show','includeAll','options','Plugin','find','catch','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','attachments/**/*','finalize','close','Error','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','set','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./plugin.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','Content-Range','apply','reject','destroy','then','get','Plugins','UserProfileResource','error','name','send','index','map'];(function(_0xe80d4f,_0x4afb7d){var _0x45d4a2=function(_0x238536){while(--_0x238536){_0xe80d4f['push'](_0xe80d4f['shift']());}};_0x45d4a2(++_0x4afb7d);}(_0xf2a9,0x1db));var _0x9f2a=function(_0x5a6161,_0x18251b){_0x5a6161=_0x5a6161-0x0;var _0x30191f=_0xf2a9[_0x5a6161];return _0x30191f;};'use strict';var emlformat=require(_0x9f2a('0x0'));var rimraf=require(_0x9f2a('0x1'));var zipdir=require(_0x9f2a('0x2'));var jsonpatch=require(_0x9f2a('0x3'));var rp=require(_0x9f2a('0x4'));var moment=require(_0x9f2a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f2a('0x6'));var path=require(_0x9f2a('0x7'));var sox=require(_0x9f2a('0x8'));var csv=require('to-csv');var ejs=require(_0x9f2a('0x9'));var fs=require('fs');var fs_extra=require(_0x9f2a('0xa'));var _=require(_0x9f2a('0xb'));var squel=require(_0x9f2a('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f2a('0xd'));var deskjs=require(_0x9f2a('0xe'));var toCsv=require(_0x9f2a('0xf'));var querystring=require(_0x9f2a('0x10'));var Papa=require(_0x9f2a('0x11'));var extract=require(_0x9f2a('0x12'));var rimraf=require(_0x9f2a('0x1'));var archiver=require('archiver');var Redis=require(_0x9f2a('0x13'));var authService=require(_0x9f2a('0x14'));var qs=require(_0x9f2a('0x15'));var as=require(_0x9f2a('0x16'));var hardwareService=require(_0x9f2a('0x17'));var logger=require('../../config/logger')(_0x9f2a('0x18'));var utils=require(_0x9f2a('0x19'));var config=require(_0x9f2a('0x1a'));var licenseUtil=require(_0x9f2a('0x1b'));var db=require(_0x9f2a('0x1c'))['db'];config['redis']=_[_0x9f2a('0x1d')](config['redis'],{'host':_0x9f2a('0x1e'),'port':0x18eb});var socket=require(_0x9f2a('0x1f'))(new Redis(config[_0x9f2a('0x20')]));require(_0x9f2a('0x21'))[_0x9f2a('0x22')](socket);function respondWithStatusCode(_0x5e4d36,_0x23991c){_0x23991c=_0x23991c||0xcc;return function(_0x52e498){if(_0x52e498){return _0x5e4d36[_0x9f2a('0x23')](_0x23991c);}return _0x5e4d36['status'](_0x23991c)[_0x9f2a('0x24')]();};}function respondWithResult(_0x56b8a3,_0x35dcea){_0x35dcea=_0x35dcea||0xc8;return function(_0x16ca9b){if(_0x16ca9b){return _0x56b8a3['status'](_0x35dcea)[_0x9f2a('0x25')](_0x16ca9b);}};}function respondWithFilteredResult(_0xe742ce,_0x9a3f5){return function(_0xb3f334){if(_0xb3f334){var _0x145183=typeof _0x9a3f5[_0x9f2a('0x26')]==='undefined'&&typeof _0x9a3f5[_0x9f2a('0x27')]===_0x9f2a('0x28');var _0x3cfee1=_0xb3f334[_0x9f2a('0x29')];var _0xf10911=_0x145183?0x0:_0x9a3f5['offset'];var _0x5582eb=_0x145183?_0xb3f334[_0x9f2a('0x29')]:_0x9a3f5[_0x9f2a('0x26')]+_0x9a3f5[_0x9f2a('0x27')];var _0x2e3307;if(_0x5582eb>=_0x3cfee1){_0x5582eb=_0x3cfee1;_0x2e3307=0xc8;}else{_0x2e3307=0xce;}_0xe742ce[_0x9f2a('0x2a')](_0x2e3307);return _0xe742ce['set'](_0x9f2a('0x2b'),_0xf10911+'-'+_0x5582eb+'/'+_0x3cfee1)[_0x9f2a('0x25')](_0xb3f334);}return null;};}function patchUpdates(_0x5194dd){return function(_0x2aa25b){try{jsonpatch[_0x9f2a('0x2c')](_0x2aa25b,_0x5194dd,!![]);}catch(_0x3a7df2){return BPromise[_0x9f2a('0x2d')](_0x3a7df2);}return _0x2aa25b['save']();};}function saveUpdates(_0x536786,_0x192980){return function(_0x5ce953){if(_0x5ce953){return _0x5ce953['update'](_0x536786)['then'](function(_0x5deb26){return _0x5deb26;});}return null;};}function removeEntity(_0x5f28c1,_0x1d4669){return function(_0x3181fd){if(_0x3181fd){return _0x3181fd[_0x9f2a('0x2e')]()[_0x9f2a('0x2f')](function(){var _0x52a844=_0x3181fd[_0x9f2a('0x30')]({'plain':!![]});var _0x22963a=_0x9f2a('0x31');return db[_0x9f2a('0x32')][_0x9f2a('0x2e')]({'where':{'type':_0x22963a,'resourceId':_0x52a844['id']}})[_0x9f2a('0x2f')](function(){return _0x3181fd;});})[_0x9f2a('0x2f')](function(){_0x5f28c1['status'](0xcc)[_0x9f2a('0x24')]();});}};}function handleEntityNotFound(_0x5ee280,_0x4eef30){return function(_0x4876e0){if(!_0x4876e0){_0x5ee280[_0x9f2a('0x23')](0x194);}return _0x4876e0;};}function handleError(_0x495acd,_0x477b6d){_0x477b6d=_0x477b6d||0x1f4;return function(_0x32bac0){logger[_0x9f2a('0x33')](_0x32bac0['stack']);if(_0x32bac0['name']){delete _0x32bac0[_0x9f2a('0x34')];}_0x495acd['status'](_0x477b6d)[_0x9f2a('0x35')](_0x32bac0);};}exports[_0x9f2a('0x36')]=function(_0x168738,_0x4ce9e1){var _0x4225e5={},_0x86b765={},_0x52657c={'count':0x0,'rows':[]};var _0x3aec3f=_[_0x9f2a('0x37')](db['Plugin'][_0x9f2a('0x38')],function(_0x5306ce){return{'name':_0x5306ce[_0x9f2a('0x39')],'type':_0x5306ce[_0x9f2a('0x3a')][_0x9f2a('0x3b')]};});_0x86b765['model']=_[_0x9f2a('0x37')](_0x3aec3f,_0x9f2a('0x34'));_0x86b765[_0x9f2a('0x3c')]=_[_0x9f2a('0x3d')](_0x168738['query']);_0x86b765[_0x9f2a('0x3e')]=_[_0x9f2a('0x3f')](_0x86b765[_0x9f2a('0x40')],_0x86b765[_0x9f2a('0x3c')]);_0x4225e5[_0x9f2a('0x41')]=_['intersection'](_0x86b765[_0x9f2a('0x40')],qs[_0x9f2a('0x42')](_0x168738[_0x9f2a('0x3c')]['fields']));_0x4225e5[_0x9f2a('0x41')]=_0x4225e5[_0x9f2a('0x41')][_0x9f2a('0x43')]?_0x4225e5[_0x9f2a('0x41')]:_0x86b765[_0x9f2a('0x40')];if(!_0x168738[_0x9f2a('0x3c')][_0x9f2a('0x44')]('nolimit')){_0x4225e5[_0x9f2a('0x27')]=qs[_0x9f2a('0x27')](_0x168738[_0x9f2a('0x3c')][_0x9f2a('0x27')]);_0x4225e5['offset']=qs['offset'](_0x168738[_0x9f2a('0x3c')][_0x9f2a('0x26')]);}_0x4225e5[_0x9f2a('0x45')]=qs[_0x9f2a('0x46')](_0x168738['query'][_0x9f2a('0x46')]);_0x4225e5[_0x9f2a('0x47')]=qs[_0x9f2a('0x3e')](_[_0x9f2a('0x48')](_0x168738[_0x9f2a('0x3c')],_0x86b765[_0x9f2a('0x3e')]),_0x3aec3f);if(_0x168738[_0x9f2a('0x3c')]['filter']){_0x4225e5[_0x9f2a('0x47')]=_['merge'](_0x4225e5['where'],{'$or':_['map'](_0x3aec3f,function(_0x1d170){if(_0x1d170[_0x9f2a('0x3a')]!==_0x9f2a('0x49')){var _0x41bcb6={};_0x41bcb6[_0x1d170[_0x9f2a('0x34')]]={'$like':'%'+_0x168738[_0x9f2a('0x3c')][_0x9f2a('0x4a')]+'%'};return _0x41bcb6;}})});}_0x4225e5=_[_0x9f2a('0x4b')]({},_0x4225e5,_0x168738['options']);var _0x11fd4d={'where':_0x4225e5[_0x9f2a('0x47')]};return db['Plugin'][_0x9f2a('0x29')](_0x11fd4d)[_0x9f2a('0x2f')](function(_0xa5007a){_0x52657c[_0x9f2a('0x29')]=_0xa5007a;if(_0x168738[_0x9f2a('0x3c')]['includeAll']){_0x4225e5[_0x9f2a('0x4c')]=[{'all':!![]}];}return db['Plugin'][_0x9f2a('0x4d')](_0x4225e5);})[_0x9f2a('0x2f')](function(_0x4b4514){_0x52657c[_0x9f2a('0x4e')]=_0x4b4514;return _0x52657c;})['then'](respondWithFilteredResult(_0x4ce9e1,_0x4225e5))['catch'](handleError(_0x4ce9e1,null));};exports[_0x9f2a('0x4f')]=function(_0x427a68,_0x2833a0){var _0x103ef1={'raw':!![],'where':{'id':_0x427a68['params']['id']}},_0xcb9a59={};_0xcb9a59['model']=_[_0x9f2a('0x3d')](db['Plugin'][_0x9f2a('0x38')]);_0xcb9a59[_0x9f2a('0x3c')]=_[_0x9f2a('0x3d')](_0x427a68[_0x9f2a('0x3c')]);_0xcb9a59['filters']=_['intersection'](_0xcb9a59[_0x9f2a('0x40')],_0xcb9a59[_0x9f2a('0x3c')]);_0x103ef1[_0x9f2a('0x41')]=_['intersection'](_0xcb9a59['model'],qs[_0x9f2a('0x42')](_0x427a68[_0x9f2a('0x3c')]['fields']));_0x103ef1[_0x9f2a('0x41')]=_0x103ef1[_0x9f2a('0x41')]['length']?_0x103ef1['attributes']:_0xcb9a59[_0x9f2a('0x40')];if(_0x427a68[_0x9f2a('0x3c')][_0x9f2a('0x50')]){_0x103ef1[_0x9f2a('0x4c')]=[{'all':!![]}];}_0x103ef1=_[_0x9f2a('0x4b')]({},_0x103ef1,_0x427a68[_0x9f2a('0x51')]);return db[_0x9f2a('0x52')][_0x9f2a('0x53')](_0x103ef1)[_0x9f2a('0x2f')](handleEntityNotFound(_0x2833a0,null))[_0x9f2a('0x2f')](respondWithResult(_0x2833a0,null))[_0x9f2a('0x54')](handleError(_0x2833a0,null));};exports[_0x9f2a('0x55')]=function(_0x2336ba,_0x2aade7,_0x91f026){return db['Plugin'][_0x9f2a('0x53')]({'where':{'id':_0x2336ba[_0x9f2a('0x56')]['id']},'attributes':[_0x9f2a('0x34'),'path'],'raw':!![]})[_0x9f2a('0x2f')](handleEntityNotFound(_0x2aade7,null))[_0x9f2a('0x2f')](function(_0x100b8f){if(_0x100b8f){var _0x5e0a62=path[_0x9f2a('0x57')](config[_0x9f2a('0x58')],_0x9f2a('0x59'),util[_0x9f2a('0x5a')](_0x9f2a('0x5b'),path[_0x9f2a('0x5c')](_0x100b8f[_0x9f2a('0x7')])));var _0x48c7f5=fs[_0x9f2a('0x5d')](_0x5e0a62);var _0x262242=archiver(_0x9f2a('0x5e'),{'zlib':{'level':0x9}});_0x262242['on'](_0x9f2a('0x5f'),function(_0x533871){if(_0x533871[_0x9f2a('0x60')]===_0x9f2a('0x61')){logger[_0x9f2a('0x33')](_0x533871);}else{throw new db[(_0x9f2a('0x62'))]['Error'](_0x9f2a('0x63'));}});_0x262242['on'](_0x9f2a('0x33'),function(_0x34878b){throw new db[(_0x9f2a('0x62'))]['Error'](_0x9f2a('0x63'));});_0x262242['pipe'](_0x48c7f5);_0x262242[_0x9f2a('0x64')](_0x9f2a('0x65'),{'cwd':path['join'](config[_0x9f2a('0x58')],_0x9f2a('0x59'),path['dirname'](_0x100b8f['path'])),'ignore':[path[_0x9f2a('0x57')](path[_0x9f2a('0x5c')](_0x100b8f['path']),'node_modules/**/*'),path[_0x9f2a('0x57')](path[_0x9f2a('0x5c')](_0x100b8f['path']),_0x9f2a('0x66'))],'nodir':!![]})[_0x9f2a('0x67')]();_0x48c7f5['on'](_0x9f2a('0x68'),function(){if(!fs['existsSync'](_0x5e0a62)){throw new db[(_0x9f2a('0x62'))][(_0x9f2a('0x69'))](_0x9f2a('0x6a'));}return _0x2aade7[_0x9f2a('0x55')](_0x5e0a62,util[_0x9f2a('0x5a')](_0x9f2a('0x5b'),path[_0x9f2a('0x5c')](_0x100b8f[_0x9f2a('0x7')])),function(_0x2cc291){if(_0x2cc291){throw new db[(_0x9f2a('0x62'))][(_0x9f2a('0x69'))](_0x9f2a('0x6b'));}fs[_0x9f2a('0x6c')](_0x5e0a62);logger[_0x9f2a('0x6d')](_0x9f2a('0x6e'));logger['info'](_0x9f2a('0x6f'));});});}return null;})['catch'](handleError(_0x2aade7,null));};exports[_0x9f2a('0x70')]=function(_0x49d726,_0x3aadfe,_0x12edbb){var _0xc8a87c=path[_0x9f2a('0x5c')](_0x49d726['file'][_0x9f2a('0x71')],path[_0x9f2a('0x72')](_0x49d726[_0x9f2a('0x73')][_0x9f2a('0x71')]));var _0x3b0c3a=path[_0x9f2a('0x57')](config[_0x9f2a('0x58')],'server/files/plugins',_0x49d726[_0x9f2a('0x73')][_0x9f2a('0x71')]);var _0x3fc13d=path['join'](config[_0x9f2a('0x58')],_0x9f2a('0x59'),_0xc8a87c);logger['info'](_0x9f2a('0x74'),_0x3b0c3a);logger[_0x9f2a('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x3fc13d);try{fs[_0x9f2a('0x75')](_0x3b0c3a,parseInt(_0x9f2a('0x76'),0x8));extract(_0x3b0c3a,{'dir':_0x3fc13d},function(_0xadbc47){if(_0xadbc47){logger['error'](_0xadbc47);handleError(_0xadbc47,!![]);};var _0x5e4ea6=fs[_0x9f2a('0x77')](_0x3fc13d);if(_0x5e4ea6[_0x9f2a('0x43')]>0x1){removeReferences(_0x3b0c3a,_0x3fc13d);logger[_0x9f2a('0x33')](_0x9f2a('0x78'));return _0x12edbb(new Error(_0x9f2a('0x78')));}var _0x372317=fs['lstatSync'](path[_0x9f2a('0x57')](_0x3fc13d,_0x5e4ea6[0x0]));if(_0x372317['isFile']()){removeReferences(_0x3b0c3a,_0x3fc13d);logger[_0x9f2a('0x33')]('Invalid\x20plugin\x20structure');return _0x12edbb(new Error(_0x9f2a('0x78')));}if(_0x372317[_0x9f2a('0x79')]()){var _0x5b3c9d=fs['readdirSync'](path['join'](_0x3fc13d,_0x5e4ea6[0x0]));if(_0x5b3c9d[_0x9f2a('0x43')]===0x0){removeReferences(_0x3b0c3a,_0x3fc13d);logger[_0x9f2a('0x33')](_0x9f2a('0x78'));return _0x12edbb(new Error(_0x9f2a('0x78')));}var _0x265b3a=_0x5b3c9d[_0x9f2a('0x7a')](function(_0x46543a){return _0x46543a===_0x9f2a('0x7b');});if(!_0x265b3a){return _0x12edbb(new Error(_0x9f2a('0x7c')));}var _0x1cd0ae=fs[_0x9f2a('0x7d')](path[_0x9f2a('0x57')](_0x3fc13d,_0x5e4ea6[0x0],_0x9f2a('0x7b')));var _0x33aaeb=JSON['parse'](_0x1cd0ae);if(_0x9f2a('0x28')==typeof _0x33aaeb[_0x9f2a('0x34')]){return _0x12edbb(new Error(_0x9f2a('0x7e')));}if('undefined'==typeof _0x33aaeb[_0x9f2a('0x3a')]){return _0x12edbb(new Error(_0x9f2a('0x7f')));}if('undefined'==typeof _0x33aaeb[_0x9f2a('0x80')]){return _0x12edbb(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x9f2a('0x28')==typeof _0x33aaeb[_0x9f2a('0x81')]){return _0x12edbb(new Error(_0x9f2a('0x82')));}if(_0x33aaeb[_0x9f2a('0x3a')]===_0x9f2a('0x83')){if(_0x9f2a('0x28')==typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')]){return _0x12edbb(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x9f2a('0x28')==typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x85')]&&'undefined'==typeof _0x33aaeb[_0x9f2a('0x81')]['views'][_0x9f2a('0x86')]){return _0x12edbb(new Error(_0x9f2a('0x87')));}}else if(_0x33aaeb[_0x9f2a('0x3a')]===_0x9f2a('0x88')){if('undefined'==typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x89')]){return _0x12edbb(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9f2a('0x28')==typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x8a')]){return _0x12edbb(new Error(_0x9f2a('0x8b')));}}else{return _0x12edbb(new Error(_0x9f2a('0x8c')));}var _0x36e11e=_0x33aaeb['name'];var _0x2c7a12=_0x33aaeb['description'];var _0x39af30=_0x33aaeb['type'];var _0xde323f=_0x33aaeb['sidebar']?_0x33aaeb[_0x9f2a('0x8d')]:_0x9f2a('0x8e');var _0x533be7=_0x33aaeb[_0x9f2a('0x8f')]?_0x33aaeb[_0x9f2a('0x8f')]:'icon-apps';var _0x4e2c22='';var _0x3581da='';var _0x3e940a='';var _0xd5a95a='';var _0xfe1f88=_0x33aaeb[_0x9f2a('0x80')];if(_0x39af30===_0x9f2a('0x83')){if(_0x9f2a('0x28')!=typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')]['admin']){var _0x2041b9=_0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9f2a('0x90')](_0x2041b9)){_0x4e2c22=path[_0x9f2a('0x57')](_0x9f2a('0x91'),_0xc8a87c,_0x5e4ea6[0x0],_0x2041b9);}else{_0x4e2c22=_0x2041b9;}}else{logger[_0x9f2a('0x6d')](_0x9f2a('0x92'));}if(_0x9f2a('0x28')!=typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x86')]){var _0x1395cc=_0x33aaeb[_0x9f2a('0x81')]['views'][_0x9f2a('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9f2a('0x90')](_0x1395cc)){_0x3581da=path[_0x9f2a('0x57')](_0x9f2a('0x91'),_0xc8a87c,_0x5e4ea6[0x0],_0x1395cc);}else{_0x3581da=_0x1395cc;}}else{logger[_0x9f2a('0x6d')](_0x9f2a('0x93'));}}else if(_0x39af30==='script'){_0x3e940a=_0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x89')];_0xd5a95a=_0x33aaeb['parameters'][_0x9f2a('0x8a')];if('undefined'!=typeof _0x33aaeb['parameters'][_0x9f2a('0x84')]){if('undefined'!=typeof _0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x85')]){var _0x2041b9=_0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x9f2a('0x90')](_0x2041b9)){_0x4e2c22=path[_0x9f2a('0x57')](_0x9f2a('0x91'),_0xc8a87c,_0x5e4ea6[0x0],_0x2041b9);}else{_0x4e2c22=_0x2041b9;}}if('undefined'!=typeof _0x33aaeb['parameters'][_0x9f2a('0x84')][_0x9f2a('0x86')]){var _0x1395cc=_0x33aaeb[_0x9f2a('0x81')][_0x9f2a('0x84')][_0x9f2a('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9f2a('0x90')](_0x1395cc)){_0x3581da=path[_0x9f2a('0x57')](_0x9f2a('0x91'),_0xc8a87c,_0x5e4ea6[0x0],_0x1395cc);}else{_0x3581da=_0x1395cc;}}}}var _0x8452dd={'name':_0x36e11e,'description':_0x2c7a12,'path':path['join'](_0xc8a87c,_0x5e4ea6[0x0]),'type':_0x39af30,'sidebar':_0xde323f,'icon':_0x533be7,'adminUrl':_0x4e2c22,'agentUrl':_0x3581da,'scriptName':_0x3e940a,'scriptPath':_0xd5a95a,'version':_0xfe1f88};removeReferences(_0x3b0c3a,null);return db[_0x9f2a('0x52')][_0x9f2a('0x94')](_0x8452dd)[_0x9f2a('0x2f')](function(_0x5ab007){var _0x46c442={'role':_0x49d726[_0x9f2a('0x95')][_0x9f2a('0x96')],'userProfileId':_0x49d726[_0x9f2a('0x95')][_0x9f2a('0x97')]};if(!_0x46c442)throw new Error(_0x9f2a('0x98'));if(_0x46c442[_0x9f2a('0x96')]===_0x9f2a('0x99')){var _0x1cc5f1=_0x5ab007['get']({'plain':!![]});return db[_0x9f2a('0x9a')][_0x9f2a('0x53')]({'where':{'name':_0x9f2a('0x31'),'userProfileId':_0x46c442[_0x9f2a('0x97')]},'raw':!![]})[_0x9f2a('0x2f')](function(_0x401df5){if(_0x401df5&&_0x401df5[_0x9f2a('0x9b')]===0x0){return db[_0x9f2a('0x32')]['create']({'name':_0x1cc5f1['name'],'resourceId':_0x1cc5f1['id'],'type':_0x401df5['name'],'sectionId':_0x401df5['id']},{})['then'](function(){return _0x5ab007;});}else{return _0x5ab007;}})[_0x9f2a('0x54')](function(_0x58b06c){logger[_0x9f2a('0x33')](_0x9f2a('0x9c'),_0x58b06c);throw _0x58b06c;});}return _0x5ab007;})['then'](respondWithResult(_0x3aadfe,null))[_0x9f2a('0x54')](handleError(_0x3aadfe,null));}});}catch(_0x2d5ac4){_0x3aadfe[_0x9f2a('0x2a')](0x1f4)[_0x9f2a('0x35')](_0x2d5ac4);}};function removeReferences(_0x3d1ce8,_0x4765cc){try{if(_0x3d1ce8){fs[_0x9f2a('0x6c')](_0x3d1ce8);logger['info'](_0x9f2a('0x9d'));}if(_0x4765cc){rimraf(_0x4765cc,function(){});logger['info']('Extracted\x20folder\x20removed');}}catch(_0x4b10c1){logger[_0x9f2a('0x33')](_0x4b10c1);}}exports['update']=function(_0x1518c6,_0x144ec5,_0xa1b241){return db['Plugin'][_0x9f2a('0x53')]({'where':{'id':_0x1518c6[_0x9f2a('0x56')]['id']}})[_0x9f2a('0x2f')](handleEntityNotFound(_0x144ec5,null))['then'](saveUpdates(_0x1518c6[_0x9f2a('0x95')],null))[_0x9f2a('0x2f')](respondWithResult(_0x144ec5,null))[_0x9f2a('0x54')](handleError(_0x144ec5,null));};exports[_0x9f2a('0x9e')]=function(_0x127595,_0x16f8c3,_0x1e9b72){return db[_0x9f2a('0x52')][_0x9f2a('0x53')]({'where':{'id':_0x127595[_0x9f2a('0x56')]['id']}})['then'](function(_0x400f7a){if(_0x400f7a){return _0x400f7a['destroy']();}})['then'](function(_0x1734ee){rimraf(path[_0x9f2a('0x57')](config['root'],_0x9f2a('0x59'),path[_0x9f2a('0x9f')](_0x1734ee[_0x9f2a('0x7')])),function(){});return _0x1734ee;})[_0x9f2a('0x2f')](handleEntityNotFound(_0x16f8c3,null))['then'](respondWithStatusCode(_0x16f8c3,null))[_0x9f2a('0x54')](handleError(_0x16f8c3,null));};exports[_0x9f2a('0xa0')]=function(_0x2fca27,_0x25a366,_0x52cfc2){return BPromise[_0x9f2a('0xa1')]()[_0x9f2a('0x2f')](function(){if(!_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0x7')]){throw new Error(_0x9f2a('0xa2'));}if(!_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0xa3')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2db7a5=_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0xa4')]?_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0xa4')]+':'+_0x2fca27[_0x9f2a('0x3c')]['port']:_0x9f2a('0xa5')+_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0xa3')];var _0x152803=_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0x25')]?_0x2fca27[_0x9f2a('0x3c')]['json']:!![];var _0x13d41c=_0x2fca27[_0x9f2a('0x3c')]['encoding']?_0x2fca27[_0x9f2a('0x3c')][_0x9f2a('0xa6')]:null;var _0x3c204d={'method':_0x2fca27[_0x9f2a('0xa7')],'uri':util[_0x9f2a('0x5a')](_0x9f2a('0xa8'),_0x2db7a5,_0x2fca27[_0x9f2a('0x3c')]['path']),'json':_0x152803,'resolveWithFullResponse':!![],'encoding':_0x13d41c,'qs':_0x2fca27['query']};if(_0x2fca27[_0x9f2a('0xa9')]){_0x3c204d[_0x9f2a('0xa9')]=_0x2fca27['headers'];if(_0x3c204d['headers'][_0x9f2a('0xaa')]){delete _0x3c204d[_0x9f2a('0xa9')][_0x9f2a('0xaa')];}}if(_0x3c204d[_0x9f2a('0xa9')][_0x9f2a('0xab')]){delete _0x3c204d[_0x9f2a('0xa9')][_0x9f2a('0xab')];}return rp(_0x3c204d);})[_0x9f2a('0x2f')](function(_0x3ad436){if(_0x3ad436){_0x25a366['set'](_0x3ad436['headers']);logger[_0x9f2a('0x6d')](_0x3ad436['body']);if(_[_0x9f2a('0xac')](_0x2fca27[_0x9f2a('0x3c')]['path'],'download')&&_0x3ad436[_0x9f2a('0xad')]==0x1f4){return _0x25a366[_0x9f2a('0x23')](_0x3ad436[_0x9f2a('0xad')]);}else{return _0x25a366[_0x9f2a('0x2a')](_0x3ad436[_0x9f2a('0xad')])['send'](_0x3ad436[_0x9f2a('0x95')]);}}else{return _0x25a366[_0x9f2a('0x23')](0xc8);}})['catch'](handleError(_0x25a366,null));};exports[_0x9f2a('0xae')]=function(_0x4f0825,_0x3db226,_0x88bd8f){return BPromise['resolve']()[_0x9f2a('0x2f')](function(){if(!_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4f0825[_0x9f2a('0x3c')]['port']){throw new Error(_0x9f2a('0xaf'));}var _0x266bed=_0x4f0825['query'][_0x9f2a('0xa4')]?_0x4f0825['query'][_0x9f2a('0xa4')]+':'+_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0xa3')]:'http://localhost:'+_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0xa3')];var _0x1fc50b=_0x4f0825[_0x9f2a('0x3c')]['json']?_0x4f0825['query'][_0x9f2a('0x25')]:!![];var _0x247483=_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0xa6')]?_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0xa6')]:null;var _0x3cc6ae={'method':_0x4f0825[_0x9f2a('0xa7')],'uri':util[_0x9f2a('0x5a')]('%s%s',_0x266bed,_0x4f0825[_0x9f2a('0x3c')][_0x9f2a('0x7')]),'json':_0x1fc50b,'resolveWithFullResponse':!![],'encoding':_0x247483,'body':_0x4f0825[_0x9f2a('0x95')]};if(_0x4f0825[_0x9f2a('0xa9')]){_0x3cc6ae['headers']=_0x4f0825[_0x9f2a('0xa9')];if(_0x3cc6ae[_0x9f2a('0xa9')][_0x9f2a('0xaa')]){delete _0x3cc6ae[_0x9f2a('0xa9')][_0x9f2a('0xaa')];}}if(_0x3cc6ae['headers']['content-type']){delete _0x3cc6ae[_0x9f2a('0xa9')][_0x9f2a('0xab')];}return rp(_0x3cc6ae);})[_0x9f2a('0x2f')](function(_0x2da981){if(_0x2da981){_0x3db226[_0x9f2a('0xb0')](_0x2da981[_0x9f2a('0xa9')]);logger['info'](_0x2da981[_0x9f2a('0x95')]);return _0x3db226['status'](_0x2da981[_0x9f2a('0xad')])[_0x9f2a('0x35')](_0x2da981[_0x9f2a('0x95')]);}else{return _0x3db226[_0x9f2a('0x23')](0xc8);}})[_0x9f2a('0x54')](handleError(_0x3db226,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index dffc20b..c5a4ea5 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 _0x6333=['update','remove','emit','hook','exports','setMaxListeners'];(function(_0x482f01,_0x2d2ce1){var _0x28e98d=function(_0x46952e){while(--_0x46952e){_0x482f01['push'](_0x482f01['shift']());}};_0x28e98d(++_0x2d2ce1);}(_0x6333,0x83));var _0x3633=function(_0x37685a,_0x1817eb){_0x37685a=_0x37685a-0x0;var _0x2beaf3=_0x6333[_0x37685a];return _0x2beaf3;};'use strict';var EventEmitter=require('events');var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x3633('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3633('0x1'),'afterDestroy':_0x3633('0x2')};function emitEvent(_0x596f7e){return function(_0x3e0961,_0x5cb6c6,_0x2439e1){PluginEvents[_0x3633('0x3')](_0x596f7e+':'+_0x3e0961['id'],_0x3e0961);PluginEvents['emit'](_0x596f7e,_0x3e0961);_0x2439e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x3633('0x4')](e,emitEvent(event));}}module[_0x3633('0x5')]=PluginEvents; \ No newline at end of file +var _0x4148=['Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x4148,0xc6));var _0x8414=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x4148[_0x55ff79];return _0x579067;};'use strict';var EventEmitter=require(_0x8414('0x0'));var Plugin=require(_0x8414('0x1'))['db'][_0x8414('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8414('0x3')](0x0);var events={'afterCreate':_0x8414('0x4'),'afterUpdate':'update','afterDestroy':_0x8414('0x5')};function emitEvent(_0x39b377){return function(_0x41ddde,_0x361d0b,_0x5dfe3c){PluginEvents[_0x8414('0x6')](_0x39b377+':'+_0x41ddde['id'],_0x41ddde);PluginEvents['emit'](_0x39b377,_0x41ddde);_0x5dfe3c(null);};}for(var e in events){if(events[_0x8414('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 1b70bfa..b59073a 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 _0x97da=['./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x447ef1,_0x374cd2){var _0x3d72ec=function(_0x3e10b){while(--_0x3e10b){_0x447ef1['push'](_0x447ef1['shift']());}};_0x3d72ec(++_0x374cd2);}(_0x97da,0x164));var _0xa97d=function(_0x5373ca,_0x5873a0){_0x5373ca=_0x5373ca-0x0;var _0xc90363=_0x97da[_0x5373ca];return _0xc90363;};'use strict';var _=require(_0xa97d('0x0'));var util=require(_0xa97d('0x1'));var logger=require(_0xa97d('0x2'))('api');var moment=require(_0xa97d('0x3'));var BPromise=require(_0xa97d('0x4'));var rp=require(_0xa97d('0x5'));var fs=require('fs');var path=require(_0xa97d('0x6'));var rimraf=require(_0xa97d('0x7'));var config=require('../../config/environment');var attributes=require(_0xa97d('0x8'));module[_0xa97d('0x9')]=function(_0x56b30c,_0x1644a0){return _0x56b30c[_0xa97d('0xa')](_0xa97d('0xb'),attributes,{'tableName':_0xa97d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x213e=['rimraf','./plugin.attributes','exports','define','Plugin','plugins','util','../../config/logger','api','moment','request-promise','path'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x213e,0x102));var _0xe213=function(_0x3834d2,_0x5f23bd){_0x3834d2=_0x3834d2-0x0;var _0x206f96=_0x213e[_0x3834d2];return _0x206f96;};'use strict';var _=require('lodash');var util=require(_0xe213('0x0'));var logger=require(_0xe213('0x1'))(_0xe213('0x2'));var moment=require(_0xe213('0x3'));var BPromise=require('bluebird');var rp=require(_0xe213('0x4'));var fs=require('fs');var path=require(_0xe213('0x5'));var rimraf=require(_0xe213('0x6'));var config=require('../../config/environment');var attributes=require(_0xe213('0x7'));module[_0xe213('0x8')]=function(_0x3ec8b2,_0x3cbd44){return _0x3ec8b2[_0xe213('0x9')](_0xe213('0xa'),attributes,{'tableName':_0xe213('0xb'),'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 7b82349..9b3ff6e 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 _0x5123=['debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','options','raw','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info','request\x20sent'];(function(_0x5729e7,_0x2f7320){var _0x4c25c4=function(_0x3c9414){while(--_0x3c9414){_0x5729e7['push'](_0x5729e7['shift']());}};_0x4c25c4(++_0x2f7320);}(_0x5123,0xb9));var _0x3512=function(_0x2e5343,_0x47a509){_0x2e5343=_0x2e5343-0x0;var _0x2c3ba5=_0x5123[_0x2e5343];return _0x2c3ba5;};'use strict';var _=require(_0x3512('0x0'));var util=require(_0x3512('0x1'));var moment=require(_0x3512('0x2'));var BPromise=require(_0x3512('0x3'));var rs=require(_0x3512('0x4'));var fs=require('fs');var Redis=require(_0x3512('0x5'));var db=require(_0x3512('0x6'))['db'];var utils=require(_0x3512('0x7'));var logger=require(_0x3512('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3512('0x9'));var client=jayson['client'][_0x3512('0xa')]({'port':0x232a});config[_0x3512('0xb')]=_[_0x3512('0xc')](config['redis'],{'host':_0x3512('0xd'),'port':0x18eb});var socket=require(_0x3512('0xe'))(new Redis(config[_0x3512('0xb')]));require(_0x3512('0xf'))[_0x3512('0x10')](socket);function respondWithRpcPromise(_0x969c3b,_0x39de0b,_0x2c8829){return new BPromise(function(_0x2de07e,_0x1a1690){return client['request'](_0x969c3b,_0x2c8829)['then'](function(_0x26c65f){logger[_0x3512('0x11')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x3512('0x12'));logger[_0x3512('0x13')](_0x3512('0x14'),_0x39de0b,_0x3512('0x12'),JSON['stringify'](_0x26c65f));if(_0x26c65f[_0x3512('0x15')]){if(_0x26c65f[_0x3512('0x15')][_0x3512('0x16')]===0x1f4){logger[_0x3512('0x15')]('Plugin,\x20%s,\x20%s',_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x1a1690(_0x26c65f[_0x3512('0x15')]['message']);}logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x26c65f[_0x3512('0x15')][_0x3512('0x17')]);return _0x2de07e(_0x26c65f['error'][_0x3512('0x17')]);}else{logger[_0x3512('0x11')](_0x3512('0x18'),_0x39de0b,_0x3512('0x12'));_0x2de07e(_0x26c65f[_0x3512('0x19')]['message']);}})[_0x3512('0x1a')](function(_0x1d1922){logger[_0x3512('0x15')](_0x3512('0x18'),_0x39de0b,_0x1d1922);_0x1a1690(_0x1d1922);});});}exports[_0x3512('0x1b')]=function(_0x41b002){var _0xb6364c=this;return new Promise(function(_0x2abb09,_0x6b9a5e){return db[_0x3512('0x1c')][_0x3512('0x1d')](_0x41b002['body'],{'raw':_0x41b002[_0x3512('0x1e')]?_0x41b002[_0x3512('0x1e')][_0x3512('0x1f')]===undefined?!![]:![]:!![]})[_0x3512('0x20')](function(_0x293ad6){logger[_0x3512('0x11')](_0x3512('0x1b'),_0x41b002);logger[_0x3512('0x13')](_0x3512('0x1b'),_0x41b002,JSON[_0x3512('0x21')](_0x293ad6));_0x2abb09(_0x293ad6);})['catch'](function(_0x47ea87){logger[_0x3512('0x15')](_0x3512('0x1b'),_0x47ea87[_0x3512('0x17')],_0x41b002);_0x6b9a5e(_0xb6364c[_0x3512('0x15')](0x1f4,_0x47ea87[_0x3512('0x17')]));});});}; \ No newline at end of file +var _0xb6f8=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','CreatePlugin','Plugin','options','raw','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1b7d1d,_0x1762a4){var _0x35c42b=function(_0x4584ef){while(--_0x4584ef){_0x1b7d1d['push'](_0x1b7d1d['shift']());}};_0x35c42b(++_0x1762a4);}(_0xb6f8,0x9d));var _0x8b6f=function(_0x31f308,_0x3db808){_0x31f308=_0x31f308-0x0;var _0x24faed=_0xb6f8[_0x31f308];return _0x24faed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8b6f('0x0'));var BPromise=require(_0x8b6f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b6f('0x2'));var db=require(_0x8b6f('0x3'))['db'];var utils=require(_0x8b6f('0x4'));var logger=require(_0x8b6f('0x5'))(_0x8b6f('0x6'));var config=require(_0x8b6f('0x7'));var jayson=require(_0x8b6f('0x8'));var client=jayson[_0x8b6f('0x9')][_0x8b6f('0xa')]({'port':0x232a});config['redis']=_[_0x8b6f('0xb')](config[_0x8b6f('0xc')],{'host':_0x8b6f('0xd'),'port':0x18eb});var socket=require(_0x8b6f('0xe'))(new Redis(config[_0x8b6f('0xc')]));require(_0x8b6f('0xf'))[_0x8b6f('0x10')](socket);function respondWithRpcPromise(_0x142fe4,_0x21121d,_0x364adf){return new BPromise(function(_0x422ed5,_0x2c50dd){return client[_0x8b6f('0x11')](_0x142fe4,_0x364adf)[_0x8b6f('0x12')](function(_0x5cbbc8){logger['info'](_0x8b6f('0x13'),_0x21121d,'request\x20sent');logger[_0x8b6f('0x14')](_0x8b6f('0x15'),_0x21121d,_0x8b6f('0x16'),JSON[_0x8b6f('0x17')](_0x5cbbc8));if(_0x5cbbc8['error']){if(_0x5cbbc8['error'][_0x8b6f('0x18')]===0x1f4){logger[_0x8b6f('0x19')](_0x8b6f('0x13'),_0x21121d,_0x5cbbc8[_0x8b6f('0x19')][_0x8b6f('0x1a')]);return _0x2c50dd(_0x5cbbc8[_0x8b6f('0x19')][_0x8b6f('0x1a')]);}logger['error'](_0x8b6f('0x13'),_0x21121d,_0x5cbbc8[_0x8b6f('0x19')][_0x8b6f('0x1a')]);return _0x422ed5(_0x5cbbc8['error']['message']);}else{logger[_0x8b6f('0x1b')]('Plugin,\x20%s,\x20%s',_0x21121d,_0x8b6f('0x16'));_0x422ed5(_0x5cbbc8['result']['message']);}})['catch'](function(_0x4de61b){logger[_0x8b6f('0x19')]('Plugin,\x20%s,\x20%s',_0x21121d,_0x4de61b);_0x2c50dd(_0x4de61b);});});}exports[_0x8b6f('0x1c')]=function(_0xb16abd){var _0xbbb9d7=this;return new Promise(function(_0x2cf0e1,_0x296063){return db[_0x8b6f('0x1d')]['create'](_0xb16abd['body'],{'raw':_0xb16abd[_0x8b6f('0x1e')]?_0xb16abd[_0x8b6f('0x1e')][_0x8b6f('0x1f')]===undefined?!![]:![]:!![]})[_0x8b6f('0x12')](function(_0x31604b){logger[_0x8b6f('0x1b')](_0x8b6f('0x1c'),_0xb16abd);logger['debug'](_0x8b6f('0x1c'),_0xb16abd,JSON[_0x8b6f('0x17')](_0x31604b));_0x2cf0e1(_0x31604b);})[_0x8b6f('0x20')](function(_0x612ec9){logger[_0x8b6f('0x19')](_0x8b6f('0x1c'),_0x612ec9['message'],_0xb16abd);_0x296063(_0xbbb9d7['error'](0x1f4,_0x612ec9['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3386b36..1123515 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 _0x64fb=['emit','register','length','plugin:','./plugin.events','save','update'];(function(_0x29c3b2,_0x3c12ac){var _0x4b3aa7=function(_0x622a9d){while(--_0x622a9d){_0x29c3b2['push'](_0x29c3b2['shift']());}};_0x4b3aa7(++_0x3c12ac);}(_0x64fb,0x19a));var _0xb64f=function(_0xcdf206,_0x186cbd){_0xcdf206=_0xcdf206-0x0;var _0x4f947e=_0x64fb[_0xcdf206];return _0x4f947e;};'use strict';var PluginEvents=require(_0xb64f('0x0'));var events=[_0xb64f('0x1'),'remove',_0xb64f('0x2')];function createListener(_0x3b9152,_0x1219e4){return function(_0x2e84a2){_0x1219e4[_0xb64f('0x3')](_0x3b9152,_0x2e84a2);};}function removeListener(_0xc3d391,_0x51d112){return function(){PluginEvents['removeListener'](_0xc3d391,_0x51d112);};}exports[_0xb64f('0x4')]=function(_0x249abd){for(var _0x29c598=0x0,_0x3edf38=events[_0xb64f('0x5')];_0x29c598<_0x3edf38;_0x29c598++){var _0x41f48b=events[_0x29c598];var _0x31e697=createListener(_0xb64f('0x6')+_0x41f48b,_0x249abd);PluginEvents['on'](_0x41f48b,_0x31e697);}}; \ No newline at end of file +var _0xa708=['./plugin.events','update','emit','register','plugin:'];(function(_0x5cf6ad,_0x5960b7){var _0x57ef9d=function(_0x3099f9){while(--_0x3099f9){_0x5cf6ad['push'](_0x5cf6ad['shift']());}};_0x57ef9d(++_0x5960b7);}(_0xa708,0x190));var _0x8a70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa708[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x8a70('0x0'));var events=['save','remove',_0x8a70('0x1')];function createListener(_0x17a927,_0x53d6b3){return function(_0x58db1b){_0x53d6b3[_0x8a70('0x2')](_0x17a927,_0x58db1b);};}function removeListener(_0x1a9ae5,_0x5814fe){return function(){PluginEvents['removeListener'](_0x1a9ae5,_0x5814fe);};}exports[_0x8a70('0x3')]=function(_0x551068){for(var _0x1726d5=0x0,_0x23498f=events['length'];_0x1726d5<_0x23498f;_0x1726d5++){var _0xb4c671=events[_0x1726d5];var _0x71b62b=createListener(_0x8a70('0x4')+_0xb4c671,_0x551068);PluginEvents['on'](_0xb4c671,_0x71b62b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c7940dc..df14e8c 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(_0x445ab6,_0x3db6fe){var _0x31b9eb=function(_0x2dfeca){while(--_0x2dfeca){_0x445ab6['push'](_0x445ab6['shift']());}};_0x31b9eb(++_0x3db6fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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(_0xd52e29,_0x1653c8){var _0x5077f9=function(_0x4906ae){while(--_0x4906ae){_0xd52e29['push'](_0xd52e29['shift']());}};_0x5077f9(++_0x1653c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 012ce4d..17d02a7 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 _0xe13a=['exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','reject','express','length','catch','show','describe','params','then','body','script','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe13a,0x178));var _0xae13=function(_0x5dbd43,_0x52fc9f){_0x5dbd43=_0x5dbd43-0x0;var _0x2c1232=_0xe13a[_0x5dbd43];return _0x2c1232;};'use strict';var _=require('lodash');var pm2=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var path=require(_0xae13('0x3'));var exec=require('child_process')[_0xae13('0x4')];var BPromise=require(_0xae13('0x5'));function handleEntityNotFound(_0x3ebbfe,_0x10abd7){return function(_0x28a89a){if(!_0x28a89a){_0x3ebbfe[_0xae13('0x6')](0x194);;}return _0x28a89a;};}function respondWithResult(_0x412a07,_0x3379ed){_0x3379ed=_0x3379ed||0xc8;return function(_0x341ba4){if(_0x341ba4){return _0x412a07['status'](_0x3379ed)[_0xae13('0x7')](_0x341ba4);}return null;};}function handleError(_0x2b2e1f,_0x27fefd){_0x27fefd=_0x27fefd||0x1f4;return function(_0x2a793f){logger[_0xae13('0x8')](_0x2a793f[_0xae13('0x9')]);if(_0x2a793f[_0xae13('0xa')]){delete _0x2a793f[_0xae13('0xa')];}_0x2b2e1f[_0xae13('0xb')](_0x27fefd)['send'](_0x2a793f);};}function execChildProcess(){return new BPromise(function(_0x404b0e,_0x83de98){exec(_0xae13('0xc'),function(_0x3a6d41,_0x14df2d,_0x3006f0){logger[_0xae13('0xd')](_0x14df2d);logger['info'](_0x3006f0);if(_0x3a6d41){logger[_0xae13('0x8')](_0x3a6d41);return _0x83de98(_0x3a6d41);}return _0x404b0e(_0x14df2d);});});}exports[_0xae13('0xe')]=function(_0x5c61bb,_0x589803){return pm2['list']()['then'](function(_0x52484b){if(_0x52484b){var _0x26ff3e=_[_0xae13('0xf')](_0x52484b,function(_0x44e141){return _0x44e141[_0xae13('0xa')]===_0xae13('0x10')||_0x44e141[_0xae13('0xa')]==='motion2';});return{'rows':_0x26ff3e,'count':_0x26ff3e[_0xae13('0x11')]};}return null;})['then'](respondWithResult(_0x589803,null))[_0xae13('0x12')](handleError(_0x589803,null));};exports[_0xae13('0x13')]=function(_0x207363,_0x118e52){return pm2[_0xae13('0x14')](_0x207363[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x118e52,null))[_0xae13('0x16')](handleEntityNotFound(_0x118e52,null))[_0xae13('0x12')](handleError(_0x118e52,null));};exports['create']=function(_0x4462a5,_0x50eb6c){if(_0x4462a5[_0xae13('0x17')][_0xae13('0xa')]&&_0x4462a5['body'][_0xae13('0x18')]){var _0x39d41c=path[_0xae13('0x19')](__dirname,_0xae13('0x1a'),_0x4462a5[_0xae13('0x17')][_0xae13('0x18')]);var _0x54b3b4=process['cwd']();process[_0xae13('0x1b')](path[_0xae13('0x1c')](_0x39d41c));return execChildProcess()['then'](function(_0x168b92){process['chdir'](_0x54b3b4);return pm2[_0xae13('0x1d')]({'name':_0x4462a5[_0xae13('0x17')][_0xae13('0xa')],'script':_0x39d41c});})['then'](function(_0x57124a){pm2['dump']();return _0x57124a[0x0];})[_0xae13('0x16')](respondWithResult(_0x50eb6c,0xc9))[_0xae13('0x12')](handleError(_0x50eb6c,null));}else{return _0x50eb6c[_0xae13('0xb')](0x1f4)['send']({'message':_0xae13('0x1e')});}};exports['update']=function(_0x3d0d60,_0x5de054){if(_0x3d0d60[_0xae13('0x17')]['id']){delete _0x3d0d60[_0xae13('0x17')]['id'];}var _0x526e4e={'online':_0xae13('0x1f'),'stopped':_0xae13('0x20')};if(_0x526e4e[_0xae13('0x21')](_0x3d0d60[_0xae13('0x17')]['status'])){return pm2[_0x526e4e[_0x3d0d60[_0xae13('0x17')][_0xae13('0xb')]]](_0x3d0d60[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x5de054,0xc8))[_0xae13('0x12')](handleError(_0x5de054,null));}else{return _0x5de054[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':'Unknown\x20status'});}};exports[_0xae13('0x23')]=function(_0x591f94,_0xf6289c){if(_0x591f94[_0xae13('0x17')]['id']){delete _0x591f94[_0xae13('0x17')]['id'];}if(_0x591f94[_0xae13('0x15')]['id']){return pm2[_0xae13('0x24')](_0x591f94[_0xae13('0x15')]['id'])[_0xae13('0x16')](function(_0x48f0f6){pm2['dump']();return _0x48f0f6[0x0];})[_0xae13('0x16')](respondWithResult(_0xf6289c,null))[_0xae13('0x12')](handleError(_0xf6289c,null));}else{return _0xf6289c[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':_0xae13('0x25')});}}; \ No newline at end of file +var _0x91a7=['params','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','child_process','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','length','show','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','catch','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status'];(function(_0x39714b,_0x5e0b0e){var _0x45ed60=function(_0x3ce5c8){while(--_0x3ce5c8){_0x39714b['push'](_0x39714b['shift']());}};_0x45ed60(++_0x5e0b0e);}(_0x91a7,0xe7));var _0x791a=function(_0x3456a7,_0x2c4e6c){_0x3456a7=_0x3456a7-0x0;var _0x32f35a=_0x91a7[_0x3456a7];return _0x32f35a;};'use strict';var _=require('lodash');var pm2=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var path=require('path');var exec=require(_0x791a('0x3'))['exec'];var BPromise=require(_0x791a('0x4'));function handleEntityNotFound(_0x535640,_0x50ab29){return function(_0x32fe2b){if(!_0x32fe2b){_0x535640[_0x791a('0x5')](0x194);;}return _0x32fe2b;};}function respondWithResult(_0x49a9b7,_0x361f53){_0x361f53=_0x361f53||0xc8;return function(_0x5db6db){if(_0x5db6db){return _0x49a9b7[_0x791a('0x6')](_0x361f53)[_0x791a('0x7')](_0x5db6db);}return null;};}function handleError(_0x5aa10a,_0x1a32b4){_0x1a32b4=_0x1a32b4||0x1f4;return function(_0x12884d){logger[_0x791a('0x8')](_0x12884d[_0x791a('0x9')]);if(_0x12884d[_0x791a('0xa')]){delete _0x12884d['name'];}_0x5aa10a[_0x791a('0x6')](_0x1a32b4)[_0x791a('0xb')](_0x12884d);};}function execChildProcess(){return new BPromise(function(_0x57e99c,_0x2bd26a){exec(_0x791a('0xc'),function(_0x167bc4,_0x17cf33,_0x2805c9){logger[_0x791a('0xd')](_0x17cf33);logger['info'](_0x2805c9);if(_0x167bc4){logger['error'](_0x167bc4);return _0x2bd26a(_0x167bc4);}return _0x57e99c(_0x17cf33);});});}exports[_0x791a('0xe')]=function(_0x2f2d8d,_0x4c56f0){return pm2[_0x791a('0xf')]()[_0x791a('0x10')](function(_0x5d5b11){if(_0x5d5b11){var _0x2887f0=_[_0x791a('0x11')](_0x5d5b11,function(_0x2ef5c5){return _0x2ef5c5[_0x791a('0xa')]==='express'||_0x2ef5c5[_0x791a('0xa')]==='motion2';});return{'rows':_0x2887f0,'count':_0x2887f0[_0x791a('0x12')]};}return null;})[_0x791a('0x10')](respondWithResult(_0x4c56f0,null))['catch'](handleError(_0x4c56f0,null));};exports[_0x791a('0x13')]=function(_0x5bea2e,_0x35fe48){return pm2['describe'](_0x5bea2e['params']['id'])['then'](respondWithResult(_0x35fe48,null))[_0x791a('0x10')](handleEntityNotFound(_0x35fe48,null))['catch'](handleError(_0x35fe48,null));};exports['create']=function(_0x39c60b,_0x5a702e){if(_0x39c60b[_0x791a('0x14')][_0x791a('0xa')]&&_0x39c60b['body'][_0x791a('0x15')]){var _0xcb5e66=path[_0x791a('0x16')](__dirname,_0x791a('0x17'),_0x39c60b['body'][_0x791a('0x15')]);var _0x2054c6=process[_0x791a('0x18')]();process[_0x791a('0x19')](path[_0x791a('0x1a')](_0xcb5e66));return execChildProcess()[_0x791a('0x10')](function(_0x2241a0){process[_0x791a('0x19')](_0x2054c6);return pm2[_0x791a('0x1b')]({'name':_0x39c60b[_0x791a('0x14')][_0x791a('0xa')],'script':_0xcb5e66});})['then'](function(_0x1102c9){pm2[_0x791a('0x1c')]();return _0x1102c9[0x0];})[_0x791a('0x10')](respondWithResult(_0x5a702e,0xc9))[_0x791a('0x1d')](handleError(_0x5a702e,null));}else{return _0x5a702e['status'](0x1f4)[_0x791a('0xb')]({'message':_0x791a('0x1e')});}};exports['update']=function(_0xdfa84f,_0x1785f5){if(_0xdfa84f[_0x791a('0x14')]['id']){delete _0xdfa84f['body']['id'];}var _0x29194d={'online':_0x791a('0x1f'),'stopped':_0x791a('0x20')};if(_0x29194d[_0x791a('0x21')](_0xdfa84f[_0x791a('0x14')][_0x791a('0x6')])){return pm2[_0x29194d[_0xdfa84f[_0x791a('0x14')][_0x791a('0x6')]]](_0xdfa84f['params']['id'])[_0x791a('0x10')](respondWithResult(_0x1785f5,0xc8))[_0x791a('0x1d')](handleError(_0x1785f5,null));}else{return _0x1785f5[_0x791a('0x6')](0x1f4)['send']({'message':_0x791a('0x22')});}};exports['destroy']=function(_0xc59f5e,_0x2e4ec8){if(_0xc59f5e[_0x791a('0x14')]['id']){delete _0xc59f5e[_0x791a('0x14')]['id'];}if(_0xc59f5e[_0x791a('0x23')]['id']){return pm2[_0x791a('0x24')](_0xc59f5e[_0x791a('0x23')]['id'])['then'](function(_0x3662c6){pm2[_0x791a('0x1c')]();return _0x3662c6[0x0];})[_0x791a('0x10')](respondWithResult(_0x2e4ec8,null))[_0x791a('0x1d')](handleError(_0x2e4ec8,null));}else{return _0x2e4ec8[_0x791a('0x6')](0x1f4)['send']({'message':_0x791a('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index c21e7b6..260910c 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 _0x466f=['/queues','getQueues','exports','express','./realtime.controller','get','/agents','isAuthenticated','getAgents'];(function(_0x39f765,_0x5e8068){var _0x176f5a=function(_0x1e08db){while(--_0x1e08db){_0x39f765['push'](_0x39f765['shift']());}};_0x176f5a(++_0x5e8068);}(_0x466f,0xc0));var _0xf466=function(_0x3a507b,_0x1147dd){_0x3a507b=_0x3a507b-0x0;var _0x3142f5=_0x466f[_0x3a507b];return _0x3142f5;};'use strict';var express=require(_0xf466('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf466('0x1'));router[_0xf466('0x2')](_0xf466('0x3'),auth[_0xf466('0x4')](),controller[_0xf466('0x5')]);router[_0xf466('0x2')](_0xf466('0x6'),auth[_0xf466('0x4')](),controller[_0xf466('0x7')]);module[_0xf466('0x8')]=router; \ No newline at end of file +var _0x9c10=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getQueues','express','Router'];(function(_0x628091,_0x592bc8){var _0xcbe30a=function(_0xec612f){while(--_0xec612f){_0x628091['push'](_0x628091['shift']());}};_0xcbe30a(++_0x592bc8);}(_0x9c10,0x9e));var _0x09c1=function(_0x54ac7a,_0x313ae3){_0x54ac7a=_0x54ac7a-0x0;var _0x5a438e=_0x9c10[_0x54ac7a];return _0x5a438e;};'use strict';var express=require(_0x09c1('0x0'));var router=express[_0x09c1('0x1')]();var auth=require(_0x09c1('0x2'));var controller=require(_0x09c1('0x3'));router[_0x09c1('0x4')](_0x09c1('0x5'),auth[_0x09c1('0x6')](),controller['getAgents']);router[_0x09c1('0x4')]('/queues',auth[_0x09c1('0x6')](),controller[_0x09c1('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 498570d..3deecac 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 _0x84c8=['waiting','paused','outbound','push','originated','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','talking','busy','find','merge','pick','filter','queue','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','loggedInDb','User','startCase','Queue','Pause','findAll','QueueId','getChannels','includes','toLowerCase','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','rawAttributes','fieldName','type','role','getOptions','sequelize','FIELD(id,','order','forEach','where','user','userProfileId','Agents','extraQueryConditions','assign','getResources','filterAgentAttributes','getAgentStatus','pause','Status','sortAgentsByStatus','catch','key','QueueCampaigns','UserProfile','findAndCountAll','all','util','lodash','jayson/promise','../../components/realtime/agents','../../config/logger','api','../../mysqldb','http','offset','undefined','limit','count','status','json','error','stack','name','send','voice','request','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','result','loggedIn','available'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x84c8,0x1d7));var _0x884c=function(_0x3572f4,_0x31b86c){_0x3572f4=_0x3572f4-0x0;var _0x45bfea=_0x84c8[_0x3572f4];return _0x45bfea;};'use strict';var util=require(_0x884c('0x0'));var _=require(_0x884c('0x1'));var jayson=require(_0x884c('0x2'));var rta=require(_0x884c('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var logger=require(_0x884c('0x4'))(_0x884c('0x5'));var db=require(_0x884c('0x6'))['db'];var amiClient=jayson['client'][_0x884c('0x7')]({'port':0x232a});var routingClient=jayson['client'][_0x884c('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x5a4c26,_0xdaf4aa){return function(_0xed334){if(_0xed334){var _0x557dd5=typeof _0xdaf4aa[_0x884c('0x8')]===_0x884c('0x9')&&typeof _0xdaf4aa[_0x884c('0xa')]===_0x884c('0x9');var _0x107a15=_0xed334[_0x884c('0xb')];var _0x180e99=_0x557dd5?0x0:_0xdaf4aa['offset'];var _0x289e03=_0x557dd5?_0xed334[_0x884c('0xb')]:_0xdaf4aa[_0x884c('0x8')]+_0xdaf4aa[_0x884c('0xa')];var _0x2cd453;if(_0x289e03>=_0x107a15){_0x289e03=_0x107a15;_0x2cd453=0xc8;}else{_0x2cd453=0xce;}_0x5a4c26[_0x884c('0xc')](_0x2cd453);return _0x5a4c26['set']('Content-Range',_0x180e99+'-'+_0x289e03+'/'+_0x107a15)[_0x884c('0xd')](_0xed334);}return null;};}function handleError(_0x244fbc,_0x2272a5){_0x2272a5=_0x2272a5||0x1f4;return function(_0x29c3f1){logger[_0x884c('0xe')](_0x29c3f1[_0x884c('0xf')]);if(_0x29c3f1[_0x884c('0x10')]){delete _0x29c3f1[_0x884c('0x10')];}_0x244fbc[_0x884c('0xc')](_0x2272a5)[_0x884c('0x11')](_0x29c3f1);};}function getRealtimeQueues(_0x3aca7f,_0x3c5f01){return new Promise(function(_0x254e4d,_0x18917c){var _0x5f4db8=_0x3c5f01===_0x884c('0x12')?amiClient:routingClient;return _0x5f4db8[_0x884c('0x13')](_['startCase'](_0x3c5f01)+_0x884c('0x14'),_0x3aca7f)[_0x884c('0x15')](function(_0x3c8686){if(_0x3c8686[_0x884c('0xe')])throw new Error(util[_0x884c('0x16')](_0x884c('0x17'),_0x3c5f01));return _0x254e4d(_0x3c8686['result']);})['catch'](function(_0x562a9f){_0x18917c(_0x562a9f);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x13f8c4,_0x3dc0be){return amiClient[_0x884c('0x13')](_0x884c('0x18'),{})['then'](function(_0x356601){if(_0x356601[_0x884c('0xe')])throw new Error(_0x884c('0x19'));return _0x13f8c4(_0x356601[_0x884c('0x1a')]);})['catch'](function(_0x163d3c){_0x3dc0be(_0x163d3c);});});}function initializeQueues(_0x48ed54,_0x140b4a,_0x100fdf,_0x4ca764){var _0xadd515=[_0x884c('0x1b'),_0x884c('0x1c'),_0x884c('0x1d'),'talking',_0x884c('0x1e')];if(_0x100fdf===_0x884c('0x12')&&_0x4ca764===_0x884c('0x1f')){_0xadd515[_0x884c('0x20')]('pTalking',_0x884c('0x21'),_0x884c('0x22'),_0x884c('0x23'),_0x884c('0x24'),'Trunk','startPredictive',_0x884c('0x25'),_0x884c('0x26'),_0x884c('0x27'),'erlangAbandonmentRate',_0x884c('0x28'),_0x884c('0x29'),_0x884c('0x2a'),_0x884c('0x2b'),_0x884c('0x2c'),_0x884c('0x2d'),_0x884c('0x2e'),_0x884c('0x2f'),_0x884c('0x30'),_0x884c('0x31'),_0x884c('0x32'));}return _0x48ed54[_0x884c('0x33')](function(_0x3d18d8){var _0x33ee3e=_0x3d18d8[_0x884c('0x34')]({'plain':!![]});_0x33ee3e[_0x884c('0x35')]=[];_0x33ee3e[_0x884c('0x1e')]=0x0;_0x33ee3e['loggedInDb']=0x0;_0x33ee3e[_0x884c('0x1b')]=0x0;_0x33ee3e[_0x884c('0x1c')]=0x0;_0x33ee3e[_0x884c('0x1d')]=0x0;if(_0x100fdf===_0x884c('0x12')){_0x33ee3e[_0x884c('0x36')]=0x0;_0x33ee3e[_0x884c('0x37')]=0x0;if(_0x4ca764===_0x884c('0x1f')){_0x33ee3e['pTalking']=0x0;_0x33ee3e[_0x884c('0x21')]=0x0;}}var _0x3143ff=_[_0x884c('0x38')](_0x140b4a,['id',_0x33ee3e['id']]);if(_0x3143ff)_[_0x884c('0x39')](_0x33ee3e,_[_0x884c('0x3a')](_0x3143ff,_0xadd515));return _0x33ee3e;});}function updateAgentVoiceStatus(_0xbbb16,_0x94a235,_0x50bd6a){var _0x555db7=_[_0x884c('0x3b')](_0x50bd6a,[_0x884c('0x3c'),_0x94a235['name']]);if(_0x555db7[_0x884c('0x3d')]===0x0)return _0xbbb16[_0x884c('0x37')]=!![];if(_[_0x884c('0x3e')](_0x555db7,[_0x884c('0x3f'),_0xbbb16[_0x884c('0x40')][_0x884c('0x41')]()]))return _0xbbb16[_0x884c('0x36')]=!![];if(!_0xbbb16[_0x884c('0x36')])return _0xbbb16[_0x884c('0x37')]=!![];}function getVoiceQueueAgents(_0x2fa470,_0x26a823,_0x2c3faa,_0x1fff70){var _0x5202cd=_[_0x884c('0x38')](_0x26a823,['id',_0x2fa470['id']]);if(!_0x5202cd)return _0x2fa470;return _0x5202cd[_0x884c('0x42')]({'raw':!![]})['then'](function(_0x2324c0){for(var _0x1f04ec=0x0;_0x1f04ec<_0x2324c0[_0x884c('0x3d')];_0x1f04ec++){var _0x45ce75=_[_0x884c('0x38')](_0x2c3faa,['id',_0x2324c0[_0x1f04ec][_0x884c('0x43')]]);if(!_0x45ce75){_0x45ce75={'id':_0x2324c0[_0x1f04ec][_0x884c('0x43')],'name':_0x2324c0[_0x1f04ec][_0x884c('0x43')],'accountcode':'','online':![]};}var _0x522d5f={'id':_0x45ce75['id'],'name':_0x45ce75[_0x884c('0x10')],'internal':_0x45ce75[_0x884c('0x44')],'online':Boolean(_0x45ce75[_0x884c('0x45')]),'paused':Boolean(_0x2324c0[_0x1f04ec][_0x884c('0x1e')])};if(_0x45ce75[_0x884c('0x46')]===_0x884c('0x36'))updateAgentVoiceStatus(_0x522d5f,_0x2fa470,_0x1fff70);if(_0x522d5f['online'])_0x2fa470[_0x884c('0x47')]++;if(_0x522d5f[_0x884c('0x37')])_0x2fa470[_0x884c('0x37')]++;if(_0x522d5f[_0x884c('0x1e')]&&!_0x522d5f[_0x884c('0x37')]&&!_0x522d5f[_0x884c('0x36')])_0x2fa470[_0x884c('0x1e')]++;_0x2fa470['agents'][_0x884c('0x20')](_0x522d5f);}return _0x2fa470;});}function getQueueAgents(_0x3fe777,_0x406176,_0xd2cd13){var _0x4d78a2=_0x884c('0x48')+_[_0x884c('0x49')](_0xd2cd13)+_0x884c('0x4a');var _0x1d91f6=_0xd2cd13+_0x884c('0x4b');return db[_0x4d78a2][_0x884c('0x4c')]({'where':{[_['startCase'](_0xd2cd13)+_0x884c('0x4d')]:_0x3fe777['id']},'raw':!![]})['then'](function(_0x1ef443){for(var _0x6aeea9=0x0;_0x6aeea9<_0x1ef443[_0x884c('0x3d')];_0x6aeea9++){var _0x216c2e=_[_0x884c('0x38')](_0x406176,['id',_0x1ef443[_0x6aeea9]['UserId']]);if(!_0x216c2e){_0x216c2e={'id':_0x1ef443[_0x6aeea9][_0x884c('0x43')],'name':_0x1ef443[_0x6aeea9][_0x884c('0x43')],'online':![],['pauseField']:![]};}var _0x3e73df={'id':_0x216c2e['id'],'name':_0x216c2e['name'],'online':Boolean(_0x216c2e['online']),'paused':Boolean(_0x216c2e[_0x1d91f6])};if(_0x3e73df[_0x884c('0x45')])_0x3fe777[_0x884c('0x47')]++;_0x3fe777['agents'][_0x884c('0x20')](_0x3e73df);}return _0x3fe777;});}function validateChannel(_0x2ada9c){var _0xd43491=utils[_0x884c('0x4e')]();if(!_[_0x884c('0x4f')](_0xd43491,_0x2ada9c[_0x884c('0x50')]()))throw new Error('Invalid\x20channel');return _0x2ada9c[_0x884c('0x50')]();}exports[_0x884c('0x51')]=function(_0x2db418,_0x4fe887){var _0x540590={'count':0x0,'rows':[]};var _0x4bbb96={};var _0x55977e;var _0x487f55;var _0x4b0321;var _0x58bb9c;var _0x308cf5=utils['getChannels']();var _0x37b7d9=_0x2db418[_0x884c('0x52')][_0x884c('0x53')];var _0x1cf916=_0x2db418[_0x884c('0x52')][_0x884c('0x54')];var _0x32f918=_0x2db418[_0x884c('0x52')][_0x884c('0x55')];var _0x4fc340=_0x1cf916==='pause'||_0x1cf916===_0x884c('0x56')?!![]:![];var _0x1d14f0=[];var _0x10039d;Promise[_0x884c('0x57')]()[_0x884c('0x15')](function(){if(_0x2db418[_0x884c('0x52')][_0x884c('0x58')]){_0x55977e=validateChannel(_0x2db418[_0x884c('0x52')][_0x884c('0x58')]);}if(!_0x2db418[_0x884c('0x52')][_0x884c('0x59')]||!_0x2db418[_0x884c('0x52')]['sort'][_0x884c('0x4f')](_0x884c('0x5a'))){_0x2db418['query'][_0x884c('0x59')]=rta[_0x884c('0x5b')](_0x2db418['query'][_0x884c('0x59')]);return;}var _0x55fb9b=rta[_0x884c('0x5c')](_0x2db418[_0x884c('0x52')][_0x884c('0x59')]);_0x2db418['query'][_0x884c('0x59')]=_0x55fb9b[_0x884c('0x5d')][_0x884c('0x5e')](',');_0x487f55=_0x55fb9b['order'];})[_0x884c('0x15')](function(){if(!_0x37b7d9){return[];}return rta['getAgentIdsByQueues'](_0x37b7d9,_0x55977e);})['then'](function(_0x11a3a4){_0x1d14f0=_0x11a3a4;return rta[_0x884c('0x5f')]();})[_0x884c('0x15')](function(_0x5686fe){_0x58bb9c=_0x5686fe[_0x884c('0x60')];if((!_0x1cf916||_0x4fc340)&&!_0x487f55){return _0x1d14f0;}if(_0x487f55&&!_0x1cf916){return rta[_0x884c('0x61')](_0x58bb9c,_0x1d14f0,_0x487f55);}else{return rta['getAgentIdsByStatus'](_0x58bb9c,_0x1d14f0,_0x1cf916);}})[_0x884c('0x15')](function(_0x37158c){_0x1d14f0=_0x37158c;var _0x165063=![];if(_0x1d14f0[_0x884c('0x3d')]===0x0){if(_0x37b7d9||_0x1cf916){_0x165063=!![];}if(_0x4fc340){_0x165063=![];}}if(_0x165063){return _0x540590;}var _0x5fe4ce=_['map'](db['User'][_0x884c('0x62')],function(_0x25de51){return{'name':_0x25de51[_0x884c('0x63')],'type':_0x25de51[_0x884c('0x64')]['key']};});_0x2db418[_0x884c('0x52')][_0x884c('0x65')]='agent';_0x2db418[_0x884c('0x52')][_0x884c('0x45')]=!![];_0x4bbb96=qs[_0x884c('0x66')](_0x5fe4ce,_0x2db418);_0x4bbb96['raw']=!![];var _0x3d667d=[];if(_0x1d14f0[_0x884c('0x3d')]>0x0){_0x3d667d[_0x884c('0x20')]({'id':{'$in':_0x1d14f0}});if(_0x487f55&&!_0x1cf916){_0x10039d=[db[_0x884c('0x67')]['literal'](_0x884c('0x68')+_0x1d14f0+')')];_0x4bbb96[_0x884c('0x69')]=_0x10039d;}}if(_0x4fc340){_0x308cf5[_0x884c('0x6a')](function(_0x452608){var _0x5076fc=!![];if(_0x1cf916===_0x884c('0x56')&&_0x55977e!==_0x452608){_0x5076fc=![];}_0x3d667d['push']({[_0x452608+_0x884c('0x4b')]:_0x5076fc});});if(_0x32f918){_0x3d667d[_0x884c('0x20')]({'pauseType':_0x32f918});}}else if(_0x1cf916){_0x308cf5[_0x884c('0x6a')](function(_0x20a34f){_0x3d667d[_0x884c('0x20')]({[_0x20a34f+'Pause']:![]});});}_0x4bbb96[_0x884c('0x6b')]=_[_0x884c('0x39')](_0x4bbb96[_0x884c('0x6b')],{'$and':_0x3d667d});if(_0x2db418[_0x884c('0x6c')][_0x884c('0x65')]===_0x884c('0x6c')){var _0x7550ee={'params':{'id':_0x2db418[_0x884c('0x6c')][_0x884c('0x6d')]},'query':{'section':_0x884c('0x6e'),'role':'agent','online':!![],'raw':!![],'ids':_0x1d14f0,'customSorting':_0x10039d}};if(_0x4fc340){_0x7550ee[_0x884c('0x52')][_0x884c('0x6f')]=_0x3d667d;}_0x7550ee[_0x884c('0x52')]=Object[_0x884c('0x70')](_0x7550ee['query'],_0x2db418[_0x884c('0x52')]);delete _0x7550ee['query']['id'];return db['UserProfile'][_0x884c('0x71')](_0x7550ee);}return db[_0x884c('0x48')]['findAndCountAll'](_0x4bbb96);})[_0x884c('0x15')](function(_0x10c847){_0x540590[_0x884c('0xb')]=_0x10c847[_0x884c('0xb')];_0x4b0321=_0x10c847[_0x884c('0x60')];return _0x4b0321['map'](function(_0x1103b0){var _0x5a082f=_[_0x884c('0x38')](_0x58bb9c,['id',_0x1103b0['id']]);if(_0x5a082f){var _0x10ed16=rta[_0x884c('0x72')](_0x5a082f);_[_0x884c('0x39')](_0x1103b0,_0x10ed16);}_0x1103b0[_0x884c('0x5a')]=rta[_0x884c('0x73')](_0x1103b0);if(_0x1103b0['globalStatus']['includes'](_0x884c('0x74'))){_0x308cf5[_0x884c('0x6a')](function(_0x2c9c21){if(_0x1103b0[_0x2c9c21+'Pause']){_0x1103b0[_0x2c9c21+_0x884c('0x75')]=_0x884c('0x74');}});}return _0x1103b0;});})[_0x884c('0x15')](function(_0x53b128){if(!_0x487f55||_0x10039d){return _0x53b128;}return rta[_0x884c('0x76')](_0x53b128,_0x487f55);})[_0x884c('0x15')](function(_0x340e48){_0x540590['rows']=_0x340e48;return _0x540590;})['then'](respondWithFilteredResult(_0x4fe887,_0x4bbb96))[_0x884c('0x77')](handleError(_0x4fe887,null));};exports['getQueues']=function(_0x4d7fa4,_0x59b9e7){var _0x2b0e98={'count':0x0,'rows':[]},_0x69b33b={},_0x28f9cd,_0x4c0932,_0x7c38a5,_0x2ead17,_0x451716;Promise[_0x884c('0x57')]()[_0x884c('0x15')](function(){if(_0x4d7fa4[_0x884c('0x52')][_0x884c('0x58')])_0x28f9cd=validateChannel(_0x4d7fa4['query'][_0x884c('0x58')]);var _0xc02533=_[_0x884c('0x49')](_0x28f9cd)+_0x884c('0x4a');var _0x300649=_[_0x884c('0x33')](db[_0xc02533][_0x884c('0x62')],function(_0x410eeb){return{'name':_0x410eeb[_0x884c('0x63')],'type':_0x410eeb[_0x884c('0x64')][_0x884c('0x78')]};});_0x69b33b=qs[_0x884c('0x66')](_0x300649,_0x4d7fa4);if(_0x4d7fa4[_0x884c('0x6c')][_0x884c('0x65')]===_0x884c('0x6c')){var _0x4eff22={'params':{'id':_0x4d7fa4['user'][_0x884c('0x6d')]},'query':{'section':_0x28f9cd===_0x884c('0x12')&&_0x4d7fa4[_0x884c('0x52')][_0x884c('0x64')]==='outbound'?_0x884c('0x79'):_[_0x884c('0x49')](_0x28f9cd)+'Queues','type':_0x4d7fa4[_0x884c('0x52')][_0x884c('0x64')],'nolimit':!![],'sort':_0x884c('0x10'),'filter':_0x4d7fa4['query'][_0x884c('0x3b')]}};return db[_0x884c('0x7a')][_0x884c('0x71')](_0x4eff22);}return db[_0xc02533][_0x884c('0x7b')](_0x69b33b);})['then'](function(_0x965526){_0x2b0e98[_0x884c('0xb')]=_0x965526[_0x884c('0xb')];_0x4c0932=_0x965526['rows'];return getRealtimeQueues(_0x4d7fa4,_0x28f9cd);})['then'](function(_0x549a9a){_0x2ead17=_0x549a9a['rows'];return rta['getRealtimeAgents']();})['then'](function(_0x4601bf){_0x7c38a5=_0x4601bf[_0x884c('0x60')];if(_0x28f9cd!=_0x884c('0x12'))return;return getRealtimeVoiceQueueChannels();})[_0x884c('0x15')](function(_0x30a03a){_0x451716=_0x30a03a?_0x30a03a['rows']:[];return initializeQueues(_0x4c0932,_0x2ead17,_0x28f9cd,_0x4d7fa4[_0x884c('0x52')]['type']);})[_0x884c('0x15')](function(_0x48349b){var _0x466110=_0x48349b['map'](function(_0x332ac2){if(_0x28f9cd===_0x884c('0x12'))return getVoiceQueueAgents(_0x332ac2,_0x4c0932,_0x7c38a5,_0x451716);else return getQueueAgents(_0x332ac2,_0x7c38a5,_0x28f9cd);});return Promise[_0x884c('0x7c')](_0x466110);})[_0x884c('0x15')](function(_0x4de30f){_0x2b0e98['rows']=_0x4de30f;return _0x2b0e98;})['then'](respondWithFilteredResult(_0x59b9e7,_0x69b33b))['catch'](handleError(_0x59b9e7,null));}; \ No newline at end of file +var _0xbf12=['loggedIn','available','waiting','paused','voice','outbound','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','find','merge','pick','queue','length','busy','some','internal','toString','talking','getMembers','UserId','accountcode','online','voiceStatus','push','User','Queue','Pause','findAll','QueueId','getChannels','includes','toLowerCase','Invalid\x20channel','getAgents','query','globalQueueFilter','pause','resolve','channel','sort','validateSortParameter','fields','join','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','order','*pause','forEach','where','user','Agents','extraQueryConditions','UserProfile','findAndCountAll','filterAgentAttributes','getAgentStatus','globalStatus','Status','getQueues','rawAttributes','type','key','QueueCampaigns','getRealtimeAgents','util','lodash','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../config/logger','api','http','offset','undefined','limit','count','status','set','Content-Range','json','error','stack','name','send','request','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels'];(function(_0x2c825a,_0x5761d8){var _0x25f2c2=function(_0x433b8c){while(--_0x433b8c){_0x2c825a['push'](_0x2c825a['shift']());}};_0x25f2c2(++_0x5761d8);}(_0xbf12,0x1d2));var _0x2bf1=function(_0x462f5c,_0xd41889){_0x462f5c=_0x462f5c-0x0;var _0x52df33=_0xbf12[_0x462f5c];return _0x52df33;};'use strict';var util=require(_0x2bf1('0x0'));var _=require(_0x2bf1('0x1'));var jayson=require(_0x2bf1('0x2'));var rta=require(_0x2bf1('0x3'));var qs=require(_0x2bf1('0x4'));var utils=require(_0x2bf1('0x5'));var logger=require(_0x2bf1('0x6'))(_0x2bf1('0x7'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson['client'][_0x2bf1('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x31e568,_0x552681){return function(_0x1c4aff){if(_0x1c4aff){var _0x21a4b3=typeof _0x552681[_0x2bf1('0x9')]===_0x2bf1('0xa')&&typeof _0x552681[_0x2bf1('0xb')]===_0x2bf1('0xa');var _0x4061fa=_0x1c4aff[_0x2bf1('0xc')];var _0x17cb58=_0x21a4b3?0x0:_0x552681[_0x2bf1('0x9')];var _0x53e387=_0x21a4b3?_0x1c4aff['count']:_0x552681['offset']+_0x552681['limit'];var _0x47cec2;if(_0x53e387>=_0x4061fa){_0x53e387=_0x4061fa;_0x47cec2=0xc8;}else{_0x47cec2=0xce;}_0x31e568[_0x2bf1('0xd')](_0x47cec2);return _0x31e568[_0x2bf1('0xe')](_0x2bf1('0xf'),_0x17cb58+'-'+_0x53e387+'/'+_0x4061fa)[_0x2bf1('0x10')](_0x1c4aff);}return null;};}function handleError(_0x516732,_0x516122){_0x516122=_0x516122||0x1f4;return function(_0x429e42){logger[_0x2bf1('0x11')](_0x429e42[_0x2bf1('0x12')]);if(_0x429e42[_0x2bf1('0x13')]){delete _0x429e42[_0x2bf1('0x13')];}_0x516732[_0x2bf1('0xd')](_0x516122)[_0x2bf1('0x14')](_0x429e42);};}function getRealtimeQueues(_0x1072d1,_0x1d2787){return new Promise(function(_0x145ca1,_0x44b54c){var _0x50ebc6=_0x1d2787==='voice'?amiClient:routingClient;return _0x50ebc6[_0x2bf1('0x15')](_[_0x2bf1('0x16')](_0x1d2787)+_0x2bf1('0x17'),_0x1072d1)[_0x2bf1('0x18')](function(_0x58cde7){if(_0x58cde7[_0x2bf1('0x11')])throw new Error(util['format'](_0x2bf1('0x19'),_0x1d2787));return _0x145ca1(_0x58cde7[_0x2bf1('0x1a')]);})[_0x2bf1('0x1b')](function(_0x4cfd26){_0x44b54c(_0x4cfd26);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x410b1e,_0x5e7102){return amiClient[_0x2bf1('0x15')](_0x2bf1('0x1c'),{})[_0x2bf1('0x18')](function(_0x59bc2){if(_0x59bc2['error'])throw new Error(_0x2bf1('0x1d'));return _0x410b1e(_0x59bc2['result']);})[_0x2bf1('0x1b')](function(_0x46899f){_0x5e7102(_0x46899f);});});}function initializeQueues(_0x3cd0e2,_0x373be3,_0x55e081,_0x1ae073){var _0x523ea0=[_0x2bf1('0x1e'),_0x2bf1('0x1f'),_0x2bf1('0x20'),'talking',_0x2bf1('0x21')];if(_0x55e081===_0x2bf1('0x22')&&_0x1ae073===_0x2bf1('0x23')){_0x523ea0['push'](_0x2bf1('0x24'),_0x2bf1('0x25'),_0x2bf1('0x26'),_0x2bf1('0x27'),_0x2bf1('0x28'),_0x2bf1('0x29'),_0x2bf1('0x2a'),_0x2bf1('0x2b'),_0x2bf1('0x2c'),_0x2bf1('0x2d'),_0x2bf1('0x2e'),_0x2bf1('0x2f'),_0x2bf1('0x30'),'dialPredictiveIntervalMaxThreshold',_0x2bf1('0x31'),_0x2bf1('0x32'),_0x2bf1('0x33'),_0x2bf1('0x34'),_0x2bf1('0x35'),'predictiveIntervalDroppedCallsCallersExit',_0x2bf1('0x36'),_0x2bf1('0x37'));}return _0x3cd0e2[_0x2bf1('0x38')](function(_0x5da1ff){var _0x11c8e7=_0x5da1ff[_0x2bf1('0x39')]({'plain':!![]});_0x11c8e7[_0x2bf1('0x3a')]=[];_0x11c8e7[_0x2bf1('0x21')]=0x0;_0x11c8e7[_0x2bf1('0x3b')]=0x0;_0x11c8e7[_0x2bf1('0x1e')]=0x0;_0x11c8e7[_0x2bf1('0x1f')]=0x0;_0x11c8e7['waiting']=0x0;if(_0x55e081==='voice'){_0x11c8e7['talking']=0x0;_0x11c8e7['busy']=0x0;if(_0x1ae073===_0x2bf1('0x23')){_0x11c8e7['pTalking']=0x0;_0x11c8e7['originated']=0x0;}}var _0x58ba58=_[_0x2bf1('0x3c')](_0x373be3,['id',_0x11c8e7['id']]);if(_0x58ba58)_[_0x2bf1('0x3d')](_0x11c8e7,_[_0x2bf1('0x3e')](_0x58ba58,_0x523ea0));return _0x11c8e7;});}function updateAgentVoiceStatus(_0x539966,_0xf7dc8b,_0x522245){var _0x43f125=_['filter'](_0x522245,[_0x2bf1('0x3f'),_0xf7dc8b[_0x2bf1('0x13')]]);if(_0x43f125[_0x2bf1('0x40')]===0x0)return _0x539966[_0x2bf1('0x41')]=!![];if(_[_0x2bf1('0x42')](_0x43f125,['connectedlinenum',_0x539966[_0x2bf1('0x43')][_0x2bf1('0x44')]()]))return _0x539966[_0x2bf1('0x45')]=!![];if(!_0x539966[_0x2bf1('0x45')])return _0x539966[_0x2bf1('0x41')]=!![];}function getVoiceQueueAgents(_0x2c2199,_0x57d362,_0x39038f,_0x3676b6){var _0x15b89e=_[_0x2bf1('0x3c')](_0x57d362,['id',_0x2c2199['id']]);if(!_0x15b89e)return _0x2c2199;return _0x15b89e[_0x2bf1('0x46')]({'raw':!![]})['then'](function(_0x5f090b){for(var _0x4767f2=0x0;_0x4767f2<_0x5f090b[_0x2bf1('0x40')];_0x4767f2++){var _0x438bc3=_['find'](_0x39038f,['id',_0x5f090b[_0x4767f2]['UserId']]);if(!_0x438bc3){_0x438bc3={'id':_0x5f090b[_0x4767f2][_0x2bf1('0x47')],'name':_0x5f090b[_0x4767f2][_0x2bf1('0x47')],'accountcode':'','online':![]};}var _0x890742={'id':_0x438bc3['id'],'name':_0x438bc3[_0x2bf1('0x13')],'internal':_0x438bc3[_0x2bf1('0x48')],'online':Boolean(_0x438bc3[_0x2bf1('0x49')]),'paused':Boolean(_0x5f090b[_0x4767f2]['paused'])};if(_0x438bc3[_0x2bf1('0x4a')]===_0x2bf1('0x45'))updateAgentVoiceStatus(_0x890742,_0x2c2199,_0x3676b6);if(_0x890742[_0x2bf1('0x49')])_0x2c2199[_0x2bf1('0x3b')]++;if(_0x890742[_0x2bf1('0x41')])_0x2c2199['busy']++;if(_0x890742['paused']&&!_0x890742[_0x2bf1('0x41')]&&!_0x890742[_0x2bf1('0x45')])_0x2c2199[_0x2bf1('0x21')]++;_0x2c2199[_0x2bf1('0x3a')][_0x2bf1('0x4b')](_0x890742);}return _0x2c2199;});}function getQueueAgents(_0xc4c169,_0x2a12ce,_0xe14c7f){var _0x21e292=_0x2bf1('0x4c')+_['startCase'](_0xe14c7f)+_0x2bf1('0x4d');var _0x5a55bf=_0xe14c7f+_0x2bf1('0x4e');return db[_0x21e292][_0x2bf1('0x4f')]({'where':{[_[_0x2bf1('0x16')](_0xe14c7f)+_0x2bf1('0x50')]:_0xc4c169['id']},'raw':!![]})['then'](function(_0x1e6553){for(var _0x330929=0x0;_0x330929<_0x1e6553[_0x2bf1('0x40')];_0x330929++){var _0x53ada3=_[_0x2bf1('0x3c')](_0x2a12ce,['id',_0x1e6553[_0x330929][_0x2bf1('0x47')]]);if(!_0x53ada3){_0x53ada3={'id':_0x1e6553[_0x330929][_0x2bf1('0x47')],'name':_0x1e6553[_0x330929][_0x2bf1('0x47')],'online':![],['pauseField']:![]};}var _0x3fc321={'id':_0x53ada3['id'],'name':_0x53ada3[_0x2bf1('0x13')],'online':Boolean(_0x53ada3[_0x2bf1('0x49')]),'paused':Boolean(_0x53ada3[_0x5a55bf])};if(_0x3fc321[_0x2bf1('0x49')])_0xc4c169[_0x2bf1('0x3b')]++;_0xc4c169['agents'][_0x2bf1('0x4b')](_0x3fc321);}return _0xc4c169;});}function validateChannel(_0x55b4e8){var _0x37d2a0=utils[_0x2bf1('0x51')]();if(!_[_0x2bf1('0x52')](_0x37d2a0,_0x55b4e8[_0x2bf1('0x53')]()))throw new Error(_0x2bf1('0x54'));return _0x55b4e8[_0x2bf1('0x53')]();}exports[_0x2bf1('0x55')]=function(_0x3e8ada,_0x1bb3b6){var _0x483358={'count':0x0,'rows':[]};var _0x3647f0={};var _0xca6758;var _0x3e896c;var _0x2a8a83;var _0x597169;var _0x585240=utils['getChannels']();var _0x396331=_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x57')];var _0x26917e=_0x3e8ada['query']['globalStatusFilter'];var _0x4c63b1=_0x3e8ada[_0x2bf1('0x56')]['pauseTypeFilter'];var _0x56de45=_0x26917e===_0x2bf1('0x58')||_0x26917e==='*pause'?!![]:![];var _0xc55695=[];var _0x2ccb8c;Promise[_0x2bf1('0x59')]()['then'](function(){if(_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x5a')]){_0xca6758=validateChannel(_0x3e8ada['query'][_0x2bf1('0x5a')]);}if(!_0x3e8ada['query'][_0x2bf1('0x5b')]||!_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x5b')][_0x2bf1('0x52')]('globalStatus')){_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x5b')]=rta[_0x2bf1('0x5c')](_0x3e8ada[_0x2bf1('0x56')]['sort']);return;}var _0x39023b=rta['getUpdatedSortOptions'](_0x3e8ada['query'][_0x2bf1('0x5b')]);_0x3e8ada[_0x2bf1('0x56')]['sort']=_0x39023b[_0x2bf1('0x5d')][_0x2bf1('0x5e')](',');_0x3e896c=_0x39023b['order'];})['then'](function(){if(!_0x396331){return[];}return rta[_0x2bf1('0x5f')](_0x396331,_0xca6758);})['then'](function(_0x4b984c){_0xc55695=_0x4b984c;return rta['getRealtimeAgents']();})['then'](function(_0x2f8437){_0x597169=_0x2f8437[_0x2bf1('0x60')];if((!_0x26917e||_0x56de45)&&!_0x3e896c){return _0xc55695;}if(_0x3e896c&&!_0x26917e){return rta[_0x2bf1('0x61')](_0x597169,_0xc55695,_0x3e896c);}else{return rta['getAgentIdsByStatus'](_0x597169,_0xc55695,_0x26917e);}})[_0x2bf1('0x18')](function(_0x199adb){_0xc55695=_0x199adb;var _0x3d4746=![];if(_0xc55695['length']===0x0){if(_0x396331||_0x26917e){_0x3d4746=!![];}if(_0x56de45){_0x3d4746=![];}}if(_0x3d4746){return _0x483358;}var _0x5e3762=_['map'](db['User']['rawAttributes'],function(_0x20085f){return{'name':_0x20085f['fieldName'],'type':_0x20085f['type']['key']};});_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x62')]=_0x2bf1('0x63');_0x3e8ada[_0x2bf1('0x56')][_0x2bf1('0x49')]=!![];_0x3647f0=qs[_0x2bf1('0x64')](_0x5e3762,_0x3e8ada);_0x3647f0[_0x2bf1('0x65')]=!![];var _0x133d25=[];if(_0xc55695[_0x2bf1('0x40')]>0x0){_0x133d25[_0x2bf1('0x4b')]({'id':{'$in':_0xc55695}});if(_0x3e896c&&!_0x26917e){_0x2ccb8c=[db[_0x2bf1('0x66')][_0x2bf1('0x67')](_0x2bf1('0x68')+_0xc55695+')')];_0x3647f0[_0x2bf1('0x69')]=_0x2ccb8c;}}if(_0x56de45){_0x585240['forEach'](function(_0x1bf51d){var _0x3604b7=!![];if(_0x26917e===_0x2bf1('0x6a')&&_0xca6758!==_0x1bf51d){_0x3604b7=![];}_0x133d25['push']({[_0x1bf51d+_0x2bf1('0x4e')]:_0x3604b7});});if(_0x4c63b1){_0x133d25[_0x2bf1('0x4b')]({'pauseType':_0x4c63b1});}}else if(_0x26917e){_0x585240[_0x2bf1('0x6b')](function(_0x5b5d82){_0x133d25[_0x2bf1('0x4b')]({[_0x5b5d82+_0x2bf1('0x4e')]:![]});});}_0x3647f0[_0x2bf1('0x6c')]=_[_0x2bf1('0x3d')](_0x3647f0['where'],{'$and':_0x133d25});if(_0x3e8ada[_0x2bf1('0x6d')][_0x2bf1('0x62')]===_0x2bf1('0x6d')){var _0x18cf77={'params':{'id':_0x3e8ada[_0x2bf1('0x6d')]['userProfileId']},'query':{'section':_0x2bf1('0x6e'),'role':'agent','online':!![],'raw':!![],'ids':_0xc55695,'customSorting':_0x2ccb8c}};if(_0x56de45){_0x18cf77[_0x2bf1('0x56')][_0x2bf1('0x6f')]=_0x133d25;}_0x18cf77[_0x2bf1('0x56')]=Object['assign'](_0x18cf77[_0x2bf1('0x56')],_0x3e8ada['query']);delete _0x18cf77[_0x2bf1('0x56')]['id'];return db[_0x2bf1('0x70')]['getResources'](_0x18cf77);}return db[_0x2bf1('0x4c')][_0x2bf1('0x71')](_0x3647f0);})[_0x2bf1('0x18')](function(_0x32669a){_0x483358['count']=_0x32669a['count'];_0x2a8a83=_0x32669a[_0x2bf1('0x60')];return _0x2a8a83[_0x2bf1('0x38')](function(_0x829461){var _0x3aa4b1=_[_0x2bf1('0x3c')](_0x597169,['id',_0x829461['id']]);if(_0x3aa4b1){var _0x9c9187=rta[_0x2bf1('0x72')](_0x3aa4b1);_[_0x2bf1('0x3d')](_0x829461,_0x9c9187);}_0x829461['globalStatus']=rta[_0x2bf1('0x73')](_0x829461);if(_0x829461[_0x2bf1('0x74')][_0x2bf1('0x52')]('pause')){_0x585240[_0x2bf1('0x6b')](function(_0x3bbada){if(_0x829461[_0x3bbada+'Pause']){_0x829461[_0x3bbada+_0x2bf1('0x75')]=_0x2bf1('0x58');}});}return _0x829461;});})[_0x2bf1('0x18')](function(_0x75fd11){if(!_0x3e896c||_0x2ccb8c){return _0x75fd11;}return rta['sortAgentsByStatus'](_0x75fd11,_0x3e896c);})[_0x2bf1('0x18')](function(_0x2e59fd){_0x483358[_0x2bf1('0x60')]=_0x2e59fd;return _0x483358;})[_0x2bf1('0x18')](respondWithFilteredResult(_0x1bb3b6,_0x3647f0))[_0x2bf1('0x1b')](handleError(_0x1bb3b6,null));};exports[_0x2bf1('0x76')]=function(_0x525c18,_0x593bed){var _0x293f45={'count':0x0,'rows':[]},_0x2b2f2a={},_0x445a74,_0x44e167,_0x1b1950,_0x2adcc4,_0x58c325;Promise[_0x2bf1('0x59')]()[_0x2bf1('0x18')](function(){if(_0x525c18['query'][_0x2bf1('0x5a')])_0x445a74=validateChannel(_0x525c18[_0x2bf1('0x56')][_0x2bf1('0x5a')]);var _0x1e5a51=_[_0x2bf1('0x16')](_0x445a74)+_0x2bf1('0x4d');var _0x1ef14b=_['map'](db[_0x1e5a51][_0x2bf1('0x77')],function(_0x135f18){return{'name':_0x135f18['fieldName'],'type':_0x135f18[_0x2bf1('0x78')][_0x2bf1('0x79')]};});_0x2b2f2a=qs[_0x2bf1('0x64')](_0x1ef14b,_0x525c18);if(_0x525c18[_0x2bf1('0x6d')][_0x2bf1('0x62')]===_0x2bf1('0x6d')){var _0x3a4ed7={'params':{'id':_0x525c18['user']['userProfileId']},'query':{'section':_0x445a74===_0x2bf1('0x22')&&_0x525c18['query'][_0x2bf1('0x78')]===_0x2bf1('0x23')?_0x2bf1('0x7a'):_[_0x2bf1('0x16')](_0x445a74)+_0x2bf1('0x17'),'type':_0x525c18[_0x2bf1('0x56')][_0x2bf1('0x78')],'nolimit':!![],'sort':_0x2bf1('0x13'),'filter':_0x525c18[_0x2bf1('0x56')]['filter']}};return db[_0x2bf1('0x70')]['getResources'](_0x3a4ed7);}return db[_0x1e5a51][_0x2bf1('0x71')](_0x2b2f2a);})[_0x2bf1('0x18')](function(_0xad66d){_0x293f45[_0x2bf1('0xc')]=_0xad66d[_0x2bf1('0xc')];_0x44e167=_0xad66d[_0x2bf1('0x60')];return getRealtimeQueues(_0x525c18,_0x445a74);})[_0x2bf1('0x18')](function(_0x467fdd){_0x2adcc4=_0x467fdd[_0x2bf1('0x60')];return rta[_0x2bf1('0x7b')]();})[_0x2bf1('0x18')](function(_0x35ddb4){_0x1b1950=_0x35ddb4['rows'];if(_0x445a74!='voice')return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x389090){_0x58c325=_0x389090?_0x389090[_0x2bf1('0x60')]:[];return initializeQueues(_0x44e167,_0x2adcc4,_0x445a74,_0x525c18[_0x2bf1('0x56')]['type']);})['then'](function(_0x2d21e0){var _0x872ca4=_0x2d21e0[_0x2bf1('0x38')](function(_0x5e099f){if(_0x445a74==='voice')return getVoiceQueueAgents(_0x5e099f,_0x44e167,_0x1b1950,_0x58c325);else return getQueueAgents(_0x5e099f,_0x1b1950,_0x445a74);});return Promise['all'](_0x872ca4);})[_0x2bf1('0x18')](function(_0x1f7490){_0x293f45[_0x2bf1('0x60')]=_0x1f7490;return _0x293f45;})[_0x2bf1('0x18')](respondWithFilteredResult(_0x593bed,_0x2b2f2a))[_0x2bf1('0x1b')](handleError(_0x593bed,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d5c7da7..ec36938 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37192f,_0x596c39){var _0x508e86=function(_0x2719c0){while(--_0x2719c0){_0x37192f['push'](_0x37192f['shift']());}};_0x508e86(++_0x596c39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x34f63b,_0x46798b){var _0x45f97b=function(_0x3d3b0e){while(--_0x3d3b0e){_0x34f63b['push'](_0x34f63b['shift']());}};_0x45f97b(++_0x46798b);}(_0x70e0,0x17b));var _0x070e=function(_0x574983,_0x9e1159){_0x574983=_0x574983-0x0;var _0x22dd49=_0x70e0[_0x574983];return _0x22dd49;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 0658134..47d32ac 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 _0x0734=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0xe003bd,_0x3fbb70){var _0xd0eda3=function(_0x54e04f){while(--_0x54e04f){_0xe003bd['push'](_0xe003bd['shift']());}};_0xd0eda3(++_0x3fbb70);}(_0x0734,0xba));var _0x4073=function(_0x10cb63,_0x16bc16){_0x10cb63=_0x10cb63-0x0;var _0x4c1115=_0x0734[_0x10cb63];return _0x4c1115;};'use strict';var Sequelize=require(_0x4073('0x0'));module[_0x4073('0x1')]={'state':{'type':Sequelize[_0x4073('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4073('0x3')]},'scheduledat':{'type':Sequelize[_0x4073('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4073('0x4')]},'responsetime':{'type':Sequelize[_0x4073('0x4')]},'ringtime':{'type':Sequelize[_0x4073('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4073('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb242=['INTEGER','STRING','DATE','exports'];(function(_0x2b876f,_0x2c0f13){var _0x50392a=function(_0x5cbda2){while(--_0x5cbda2){_0x2b876f['push'](_0x2b876f['shift']());}};_0x50392a(++_0x2c0f13);}(_0xb242,0x1f3));var _0x2b24=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xb242[_0x4695ba];return _0x524b7d;};'use strict';var Sequelize=require('sequelize');module[_0x2b24('0x0')]={'state':{'type':Sequelize[_0x2b24('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2b24('0x2')]},'scheduledat':{'type':Sequelize[_0x2b24('0x3')]},'uniqueid':{'type':Sequelize[_0x2b24('0x2')]},'starttime':{'type':Sequelize[_0x2b24('0x3')]},'responsetime':{'type':Sequelize[_0x2b24('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x2b24('0x2')]},'membername':{'type':Sequelize[_0x2b24('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d4daf95..aeef7e3 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 _0x2010=['rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x43a057,_0x411e19){var _0x1b6de8=function(_0x41385c){while(--_0x41385c){_0x43a057['push'](_0x43a057['shift']());}};_0x1b6de8(++_0x411e19);}(_0x2010,0x69));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0201('0x0'));var util=require(_0x0201('0x1'));var logger=require(_0x0201('0x2'))(_0x0201('0x3'));var moment=require(_0x0201('0x4'));var BPromise=require(_0x0201('0x5'));var rp=require(_0x0201('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0201('0x7'));var config=require(_0x0201('0x8'));var attributes=require(_0x0201('0x9'));module[_0x0201('0xa')]=function(_0x1bf1ff,_0x3f0eb7){return _0x1bf1ff[_0x0201('0xb')](_0x0201('0xc'),attributes,{'tableName':_0x0201('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb938=['../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb938,0x1f2));var _0x8b93=function(_0xcfd89a,_0xcea52b){_0xcfd89a=_0xcfd89a-0x0;var _0x4335cc=_0xb938[_0xcfd89a];return _0x4335cc;};'use strict';var _=require(_0x8b93('0x0'));var util=require('util');var logger=require(_0x8b93('0x1'))(_0x8b93('0x2'));var moment=require('moment');var BPromise=require(_0x8b93('0x3'));var rp=require(_0x8b93('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b93('0x5'));var config=require(_0x8b93('0x6'));var attributes=require(_0x8b93('0x7'));module[_0x8b93('0x8')]=function(_0x21d3dc,_0x4d6096){return _0x21d3dc[_0x8b93('0x9')](_0x8b93('0xa'),attributes,{'tableName':_0x8b93('0xb'),'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 ef0c64e..3f17089 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 _0x0594=['request\x20sent','stringify','error','code','message','catch','CreateReportAgentPreview','options','raw','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0594,0xeb));var _0x4059=function(_0xa80ebc,_0x3c297e){_0xa80ebc=_0xa80ebc-0x0;var _0x33c85e=_0x0594[_0xa80ebc];return _0x33c85e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4059('0x0'));var BPromise=require(_0x4059('0x1'));var rs=require(_0x4059('0x2'));var fs=require('fs');var Redis=require(_0x4059('0x3'));var db=require(_0x4059('0x4'))['db'];var utils=require(_0x4059('0x5'));var logger=require(_0x4059('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4059('0x7'));var client=jayson[_0x4059('0x8')][_0x4059('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18032b,_0x54a6f3,_0x56870a){return new BPromise(function(_0x3cf29c,_0x3fc365){return client[_0x4059('0xa')](_0x18032b,_0x56870a)[_0x4059('0xb')](function(_0x3e2451){logger[_0x4059('0xc')](_0x4059('0xd'),_0x54a6f3,'request\x20sent');logger['debug'](_0x4059('0xe'),_0x54a6f3,_0x4059('0xf'),JSON[_0x4059('0x10')](_0x3e2451));if(_0x3e2451[_0x4059('0x11')]){if(_0x3e2451[_0x4059('0x11')][_0x4059('0x12')]===0x1f4){logger['error'](_0x4059('0xd'),_0x54a6f3,_0x3e2451[_0x4059('0x11')][_0x4059('0x13')]);return _0x3fc365(_0x3e2451[_0x4059('0x11')][_0x4059('0x13')]);}logger['error'](_0x4059('0xd'),_0x54a6f3,_0x3e2451[_0x4059('0x11')][_0x4059('0x13')]);return _0x3cf29c(_0x3e2451[_0x4059('0x11')][_0x4059('0x13')]);}else{logger['info'](_0x4059('0xd'),_0x54a6f3,_0x4059('0xf'));_0x3cf29c(_0x3e2451['result'][_0x4059('0x13')]);}})[_0x4059('0x14')](function(_0x21b5cf){logger[_0x4059('0x11')](_0x4059('0xd'),_0x54a6f3,_0x21b5cf);_0x3fc365(_0x21b5cf);});});}exports[_0x4059('0x15')]=function(_0x318125){var _0x4b2141=this;return new Promise(function(_0x3e3136,_0x314009){return db['ReportAgentPreview']['create'](_0x318125['body'],{'raw':_0x318125[_0x4059('0x16')]?_0x318125['options'][_0x4059('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5e51e0){logger[_0x4059('0xc')](_0x4059('0x15'),_0x318125);logger[_0x4059('0x18')](_0x4059('0x15'),_0x318125,JSON[_0x4059('0x10')](_0x5e51e0));_0x3e3136(_0x5e51e0);})[_0x4059('0x14')](function(_0x52e24e){logger[_0x4059('0x11')](_0x4059('0x15'),_0x52e24e[_0x4059('0x13')],_0x318125);_0x314009(_0x4b2141[_0x4059('0x11')](0x1f4,_0x52e24e[_0x4059('0x13')]));});});}; \ No newline at end of file +var _0xb3c3=['../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb3c3,0x88));var _0x3b3c=function(_0x39ff0a,_0x3904cc){_0x39ff0a=_0x39ff0a-0x0;var _0x384f45=_0xb3c3[_0x39ff0a];return _0x384f45;};'use strict';var _=require(_0x3b3c('0x0'));var util=require(_0x3b3c('0x1'));var moment=require(_0x3b3c('0x2'));var BPromise=require(_0x3b3c('0x3'));var rs=require(_0x3b3c('0x4'));var fs=require('fs');var Redis=require(_0x3b3c('0x5'));var db=require(_0x3b3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b3c('0x7'))(_0x3b3c('0x8'));var config=require(_0x3b3c('0x9'));var jayson=require(_0x3b3c('0xa'));var client=jayson[_0x3b3c('0xb')][_0x3b3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e9b89,_0x5e36c2,_0x440286){return new BPromise(function(_0x38ba66,_0x3ae324){return client['request'](_0x3e9b89,_0x440286)[_0x3b3c('0xd')](function(_0x547465){logger[_0x3b3c('0xe')](_0x3b3c('0xf'),_0x5e36c2,_0x3b3c('0x10'));logger[_0x3b3c('0x11')](_0x3b3c('0x12'),_0x5e36c2,_0x3b3c('0x10'),JSON[_0x3b3c('0x13')](_0x547465));if(_0x547465[_0x3b3c('0x14')]){if(_0x547465[_0x3b3c('0x14')][_0x3b3c('0x15')]===0x1f4){logger[_0x3b3c('0x14')](_0x3b3c('0xf'),_0x5e36c2,_0x547465[_0x3b3c('0x14')]['message']);return _0x3ae324(_0x547465[_0x3b3c('0x14')][_0x3b3c('0x16')]);}logger[_0x3b3c('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x5e36c2,_0x547465[_0x3b3c('0x14')]['message']);return _0x38ba66(_0x547465['error'][_0x3b3c('0x16')]);}else{logger[_0x3b3c('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x5e36c2,_0x3b3c('0x10'));_0x38ba66(_0x547465[_0x3b3c('0x17')]['message']);}})[_0x3b3c('0x18')](function(_0x4a38eb){logger[_0x3b3c('0x14')](_0x3b3c('0xf'),_0x5e36c2,_0x4a38eb);_0x3ae324(_0x4a38eb);});});}exports[_0x3b3c('0x19')]=function(_0x5b9dac){var _0x33461a=this;return new Promise(function(_0x459a2,_0x5e3918){return db['ReportAgentPreview']['create'](_0x5b9dac[_0x3b3c('0x1a')],{'raw':_0x5b9dac['options']?_0x5b9dac[_0x3b3c('0x1b')][_0x3b3c('0x1c')]===undefined?!![]:![]:!![]})[_0x3b3c('0xd')](function(_0x22e99d){logger[_0x3b3c('0xe')](_0x3b3c('0x19'),_0x5b9dac);logger[_0x3b3c('0x11')](_0x3b3c('0x19'),_0x5b9dac,JSON[_0x3b3c('0x13')](_0x22e99d));_0x459a2(_0x22e99d);})[_0x3b3c('0x18')](function(_0x5e6e7d){logger[_0x3b3c('0x14')](_0x3b3c('0x19'),_0x5e6e7d[_0x3b3c('0x16')],_0x5b9dac);_0x5e3918(_0x33461a[_0x3b3c('0x14')](0x1f4,_0x5e6e7d[_0x3b3c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4ba71ff..35d794c 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 _0xcc47=['express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path'];(function(_0x46e540,_0x43c70c){var _0x12d66b=function(_0x9d309e){while(--_0x9d309e){_0x46e540['push'](_0x46e540['shift']());}};_0x12d66b(++_0x43c70c);}(_0xcc47,0xfc));var _0x7cc4=function(_0x438326,_0x42ee25){_0x438326=_0x438326-0x0;var _0x32c95c=_0xcc47[_0x438326];return _0x32c95c;};'use strict';var multer=require(_0x7cc4('0x0'));var util=require(_0x7cc4('0x1'));var path=require(_0x7cc4('0x2'));var express=require(_0x7cc4('0x3'));var router=express[_0x7cc4('0x4')]();var auth=require(_0x7cc4('0x5'));var controller=require(_0x7cc4('0x6'));router[_0x7cc4('0x7')]('/voice/channels',auth[_0x7cc4('0x8')](),controller['voiceChannels']);router[_0x7cc4('0x7')](_0x7cc4('0x9'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0xa')]);router[_0x7cc4('0x7')](_0x7cc4('0xb'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0xc')]);router[_0x7cc4('0x7')](_0x7cc4('0xd'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0xe')]);router[_0x7cc4('0x7')](_0x7cc4('0xf'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x10')]);router[_0x7cc4('0x7')](_0x7cc4('0x11'),auth['isAuthenticated'](),controller[_0x7cc4('0x12')]);router[_0x7cc4('0x7')](_0x7cc4('0x13'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x7cc4('0x7')](_0x7cc4('0x14'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x15')]);router[_0x7cc4('0x7')](_0x7cc4('0x16'),auth[_0x7cc4('0x8')](),controller['smsQueues']);router[_0x7cc4('0x7')](_0x7cc4('0x17'),auth[_0x7cc4('0x8')](),controller['whatsappQueues']);router['get'](_0x7cc4('0x18'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x19')]);router[_0x7cc4('0x7')](_0x7cc4('0x1a'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x1b')]);router['get']('/voice/queues/channels',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x1c')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x1e')]);router['get'](_0x7cc4('0x1f'),auth['isAuthenticated'](),controller[_0x7cc4('0x20')]);router[_0x7cc4('0x7')](_0x7cc4('0x21'),auth[_0x7cc4('0x8')](),controller['showVoiceQueues']);router[_0x7cc4('0x22')](_0x7cc4('0x21'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x23')]);router['get'](_0x7cc4('0x24'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x25')]);router[_0x7cc4('0x7')](_0x7cc4('0x26'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x27')]);router['get'](_0x7cc4('0x28'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x29')]);router[_0x7cc4('0x22')]('/agents/:id/capacity',auth[_0x7cc4('0x8')](),controller['agentCapacity']);router['get'](_0x7cc4('0x2a'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x2b')]);router[_0x7cc4('0x7')](_0x7cc4('0x2c'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x2d')]);router['get'](_0x7cc4('0x2e'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x2f')]);router[_0x7cc4('0x7')](_0x7cc4('0x30'),auth['isAuthenticated'](),controller[_0x7cc4('0x31')]);router[_0x7cc4('0x7')](_0x7cc4('0x32'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x33')]);router['get'](_0x7cc4('0x34'),auth['isAuthenticated'](),controller[_0x7cc4('0x35')]);router[_0x7cc4('0x7')](_0x7cc4('0x36'),auth[_0x7cc4('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0x7cc4('0x7')](_0x7cc4('0x37'),auth[_0x7cc4('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x7cc4('0x7')]('/sms/queues/waitinginteractions',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x38')]);router['get'](_0x7cc4('0x39'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x3a')]);router['get'](_0x7cc4('0x3b'),auth[_0x7cc4('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0x7cc4('0x3c')]('/mail/queues/:id/notify',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x3d')](_0x7cc4('0x3e')));router[_0x7cc4('0x7')](_0x7cc4('0x3f'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x40')]);router[_0x7cc4('0x3c')](_0x7cc4('0x41'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x3d')](_0x7cc4('0x42')));router[_0x7cc4('0x7')](_0x7cc4('0x43'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x44')]);router[_0x7cc4('0x3c')](_0x7cc4('0x45'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x3d')]('fax'));router[_0x7cc4('0x7')](_0x7cc4('0x46'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x47')]);router['post'](_0x7cc4('0x48'),auth[_0x7cc4('0x8')](),controller['queueNotify'](_0x7cc4('0x49')));router[_0x7cc4('0x7')]('/openchannel/queues/:id',auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x4a')]);router[_0x7cc4('0x3c')](_0x7cc4('0x4b'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x3d')](_0x7cc4('0x4c')));router[_0x7cc4('0x3c')](_0x7cc4('0x4d'),auth['isAuthenticated'](),controller[_0x7cc4('0x3d')](_0x7cc4('0x4e')));router[_0x7cc4('0x7')](_0x7cc4('0x4f'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x50')]);router[_0x7cc4('0x7')](_0x7cc4('0x51'),auth[_0x7cc4('0x8')](),controller[_0x7cc4('0x52')]);router[_0x7cc4('0x3c')](_0x7cc4('0x53'),auth[_0x7cc4('0x8')](),controller['agentNotify']);module[_0x7cc4('0x54')]=router; \ No newline at end of file +var _0x31dc=['/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify'];(function(_0x4ae8f3,_0x3a27cf){var _0x1bcedd=function(_0x5d782f){while(--_0x5d782f){_0x4ae8f3['push'](_0x4ae8f3['shift']());}};_0x1bcedd(++_0x3a27cf);}(_0x31dc,0x1ab));var _0xc31d=function(_0x3bcef8,_0x3dfb4a){_0x3bcef8=_0x3bcef8-0x0;var _0x114a95=_0x31dc[_0x3bcef8];return _0x114a95;};'use strict';var multer=require('multer');var util=require(_0xc31d('0x0'));var path=require(_0xc31d('0x1'));var express=require(_0xc31d('0x2'));var router=express[_0xc31d('0x3')]();var auth=require(_0xc31d('0x4'));var controller=require(_0xc31d('0x5'));router[_0xc31d('0x6')](_0xc31d('0x7'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x9')]);router[_0xc31d('0x6')](_0xc31d('0xa'),auth[_0xc31d('0x8')](),controller[_0xc31d('0xb')]);router[_0xc31d('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xc31d('0x8')](),controller[_0xc31d('0xc')]);router[_0xc31d('0x6')](_0xc31d('0xd'),auth[_0xc31d('0x8')](),controller[_0xc31d('0xe')]);router[_0xc31d('0x6')](_0xc31d('0xf'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x10')]);router[_0xc31d('0x6')](_0xc31d('0x11'),auth['isAuthenticated'](),controller[_0xc31d('0x12')]);router[_0xc31d('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0xc31d('0x13')]);router[_0xc31d('0x6')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0xc31d('0x14')]);router['get'](_0xc31d('0x15'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x16')]);router['get']('/whatsapp/queues',auth[_0xc31d('0x8')](),controller[_0xc31d('0x17')]);router['get']('/fax/queues',auth[_0xc31d('0x8')](),controller['faxQueues']);router[_0xc31d('0x6')](_0xc31d('0x18'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x19')]);router[_0xc31d('0x6')](_0xc31d('0x1a'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x1b')]);router[_0xc31d('0x6')](_0xc31d('0x1c'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x1d')]);router[_0xc31d('0x6')](_0xc31d('0x1e'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x1f')]);router['get'](_0xc31d('0x20'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x21')]);router['get']('/voice/queues/:id',auth[_0xc31d('0x8')](),controller[_0xc31d('0x22')]);router[_0xc31d('0x23')](_0xc31d('0x24'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0xc31d('0x6')](_0xc31d('0x25'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x26')]);router[_0xc31d('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller['outboundChannels']);router[_0xc31d('0x6')]('/agents',auth[_0xc31d('0x8')](),controller[_0xc31d('0x27')]);router['put']('/agents/:id/capacity',auth[_0xc31d('0x8')](),controller[_0xc31d('0x28')]);router['get']('/telephones',auth[_0xc31d('0x8')](),controller[_0xc31d('0x29')]);router[_0xc31d('0x6')](_0xc31d('0x2a'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x2b')]);router[_0xc31d('0x6')](_0xc31d('0x2c'),auth['isAuthenticated'](),controller[_0xc31d('0x2d')]);router[_0xc31d('0x6')](_0xc31d('0x2e'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x2f')]);router[_0xc31d('0x6')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xc31d('0x30')]);router[_0xc31d('0x6')](_0xc31d('0x31'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x32')]);router[_0xc31d('0x6')](_0xc31d('0x33'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0xc31d('0x6')](_0xc31d('0x34'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x35')]);router[_0xc31d('0x6')](_0xc31d('0x36'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x37')]);router[_0xc31d('0x6')](_0xc31d('0x38'),auth[_0xc31d('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0xc31d('0x6')](_0xc31d('0x39'),auth['isAuthenticated'](),controller[_0xc31d('0x3a')]);router[_0xc31d('0x3b')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0xc31d('0x3c')](_0xc31d('0x3d')));router['get'](_0xc31d('0x3e'),auth['isAuthenticated'](),controller[_0xc31d('0x3f')]);router[_0xc31d('0x3b')](_0xc31d('0x40'),auth['isAuthenticated'](),controller[_0xc31d('0x3c')]('chat'));router[_0xc31d('0x6')](_0xc31d('0x41'),auth['isAuthenticated'](),controller[_0xc31d('0x42')]);router[_0xc31d('0x3b')](_0xc31d('0x43'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x3c')]('fax'));router[_0xc31d('0x6')](_0xc31d('0x44'),auth[_0xc31d('0x8')](),controller['showFaxQueues']);router[_0xc31d('0x3b')](_0xc31d('0x45'),auth['isAuthenticated'](),controller['queueNotify'](_0xc31d('0x46')));router['get'](_0xc31d('0x47'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x48')]);router['post'](_0xc31d('0x49'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x3c')](_0xc31d('0x4a')));router[_0xc31d('0x3b')]('/whatsapp/queues/:id/notify',auth[_0xc31d('0x8')](),controller[_0xc31d('0x3c')](_0xc31d('0x4b')));router[_0xc31d('0x6')](_0xc31d('0x4c'),auth['isAuthenticated'](),controller[_0xc31d('0x4d')]);router[_0xc31d('0x6')](_0xc31d('0x4e'),auth[_0xc31d('0x8')](),controller[_0xc31d('0x4f')]);router['post']('/agents/:id/notify',auth[_0xc31d('0x8')](),controller[_0xc31d('0x50')]);module[_0xc31d('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f9a3b63..637f224 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 _0x5d17=['whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','capitalize','chat','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','create','Start','Account','queueTransferTimeout','*,*,*,*','agentNotify','channel','User','Agent\x20not\x20found','agentTransferTimeout','bluebird','moment','../../mysqldb','../../config/logger','api','client','http','code','error','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','voiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','internal','AgentCapacity','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions'];(function(_0x591a0a,_0x45796b){var _0x22453a=function(_0xe5e77d){while(--_0xe5e77d){_0x591a0a['push'](_0x591a0a['shift']());}};_0x22453a(++_0x45796b);}(_0x5d17,0x114));var _0x75d1=function(_0x2336ea,_0x46e872){_0x2336ea=_0x2336ea-0x0;var _0x216bf9=_0x5d17[_0x2336ea];return _0x216bf9;};'use strict';var BPromise=require(_0x75d1('0x0'));var moment=require(_0x75d1('0x1'));var _=require('lodash');var util=require('util');var db=require(_0x75d1('0x2'))['db'];var logger=require(_0x75d1('0x3'))(_0x75d1('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x75d1('0x5')][_0x75d1('0x6')]({'port':0x232a});var mailClient=jayson[_0x75d1('0x5')][_0x75d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x75d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){var _0xf9f8e=_0x1ee61b?_0x1ee61b:amiClient;return _0xf9f8e['request'](_0x116a51,_0x5c957a)['then'](function(_0x40df40){if(_0x40df40['error']){if(_0x40df40['error'][_0x75d1('0x7')]===0x1f4){return _0x105607(_0x40df40[_0x75d1('0x8')]['message']);}return _0x3a9d5e(_0x40df40[_0x75d1('0x8')][_0x75d1('0x9')]);}else{_0x3a9d5e(_0x40df40[_0x75d1('0xa')]);}})[_0x75d1('0xb')](function(_0x6c1265){_0x105607(_0x6c1265);});});}function respondWithResult(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xc8;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0xc')](_0x49667a)[_0x75d1('0xd')](_0x19e825);}return _0xd089cf[_0x75d1('0xe')](0x194);};}function handleError(_0x49d723,_0x553697){_0x553697=_0x553697||0x1f4;return function(_0x55b8a0){logger[_0x75d1('0x8')](_0x55b8a0[_0x75d1('0xf')]);if(_0x55b8a0[_0x75d1('0x10')]){delete _0x55b8a0['name'];}_0x49d723[_0x75d1('0xc')](_0x553697)[_0x75d1('0x11')](_0x55b8a0);};}function findById(_0x1d30f3){return function(_0x269e82){if(!_[_0x75d1('0x12')](_0x1d30f3)&&!_[_0x75d1('0x12')](_0x269e82)&&!_[_0x75d1('0x12')](_0x269e82[_0x75d1('0x13')])){return _[_0x75d1('0x14')](_0x269e82[_0x75d1('0x13')],function(_0x2c2a6d){return _0x2c2a6d['id']==_0x1d30f3;});}return null;};}exports['voiceChannels']=function(_0x493fff,_0xc6b282){return respondWithRpcPromise(_0x75d1('0x15'),_0x493fff['query'])[_0x75d1('0x16')](respondWithResult(_0xc6b282,null))[_0x75d1('0xb')](handleError(_0xc6b282,null));};exports[_0x75d1('0x17')]=function(_0xf6cc70,_0xa42dbe){return respondWithRpcPromise(_0x75d1('0x18'),_['merge'](_0xf6cc70[_0x75d1('0x19')],_0xf6cc70[_0x75d1('0x1a')]))['then'](respondWithResult(_0xa42dbe,null))[_0x75d1('0xb')](handleError(_0xa42dbe,null));};exports[_0x75d1('0x1b')]=function(_0x526f6c,_0x2c0c21){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x75d1('0x1c')](_0x526f6c[_0x75d1('0x19')],_0x526f6c[_0x75d1('0x1a')]))['then'](respondWithResult(_0x2c0c21,null))['catch'](handleError(_0x2c0c21,null));};exports[_0x75d1('0x1d')]=function(_0x45b18f,_0x315ce5){return respondWithRpcPromise(_0x75d1('0x1e'),_0x45b18f['query'])[_0x75d1('0x16')](respondWithResult(_0x315ce5,null))[_0x75d1('0xb')](handleError(_0x315ce5,null));};exports[_0x75d1('0x1f')]=function(_0x51138e,_0x54095d){return respondWithRpcPromise('VoiceQueues',_0x51138e[_0x75d1('0x19')])[_0x75d1('0x16')](findById(_0x51138e[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x54095d,null))[_0x75d1('0xb')](handleError(_0x54095d,null));};exports['updateVoiceQueue']=function(_0x4d292e,_0x410e16){return respondWithRpcPromise(_0x75d1('0x20'),_['merge'](_0x4d292e[_0x75d1('0x21')],_0x4d292e['params']))[_0x75d1('0x16')](respondWithResult(_0x410e16,null))[_0x75d1('0xb')](handleError(_0x410e16,null));};exports[_0x75d1('0x22')]=function(_0x3fb7b9,_0x36ae86){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x75d1('0x1c')](_0x3fb7b9[_0x75d1('0x19')],_0x3fb7b9[_0x75d1('0x1a')]))[_0x75d1('0x16')](respondWithResult(_0x36ae86,null))['catch'](handleError(_0x36ae86,null));};exports[_0x75d1('0x23')]=function(_0x551824,_0x1b2bbb){return respondWithRpcPromise(_0x75d1('0x24'),_0x551824['query'])[_0x75d1('0x16')](respondWithResult(_0x1b2bbb,null))[_0x75d1('0xb')](handleError(_0x1b2bbb,null));};exports[_0x75d1('0x25')]=function(_0x100a4b,_0x22b190){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x75d1('0x1c')](_0x100a4b[_0x75d1('0x19')],_0x100a4b[_0x75d1('0x1a')]))[_0x75d1('0x16')](respondWithResult(_0x22b190,null))['catch'](handleError(_0x22b190,null));};exports['voiceQueuesChannelHangup']=function(_0x551723,_0x3d9275){return respondWithRpcPromise(_0x75d1('0x26'),_[_0x75d1('0x1c')](_0x551723[_0x75d1('0x19')],_0x551723[_0x75d1('0x1a')]))[_0x75d1('0x16')](respondWithResult(_0x3d9275,null))[_0x75d1('0xb')](handleError(_0x3d9275,null));};exports[_0x75d1('0x27')]=function(_0x433092,_0x534511){return respondWithRpcPromise(_0x75d1('0x28'),_[_0x75d1('0x1c')](_0x433092[_0x75d1('0x19')],_0x433092[_0x75d1('0x1a')]))[_0x75d1('0x16')](respondWithResult(_0x534511,null))['catch'](handleError(_0x534511,null));};exports['outbound']=function(_0x487431,_0x1058b7){return respondWithRpcPromise(_0x75d1('0x29'),_0x487431[_0x75d1('0x19')])[_0x75d1('0x16')](respondWithResult(_0x1058b7,null))[_0x75d1('0xb')](handleError(_0x1058b7,null));};exports[_0x75d1('0x2a')]=function(_0x48f9f3,_0x5553b9){return respondWithRpcPromise('OutboundChannels',_0x48f9f3[_0x75d1('0x19')])['then'](respondWithResult(_0x5553b9,null))['catch'](handleError(_0x5553b9,null));};exports[_0x75d1('0x2b')]=function(_0x21bfd8,_0x45eea3){var _0x46854c;return respondWithRpcPromise('Agents',_0x21bfd8[_0x75d1('0x19')])[_0x75d1('0x16')](function(_0x38bf47){_0x46854c=_0x38bf47;return respondWithRpcPromise(_0x75d1('0x2c'),_0x21bfd8[_0x75d1('0x19')],routingClient);})[_0x75d1('0x16')](function(_0x33df05){return _[_0x75d1('0x1c')]({},_0x33df05,_0x46854c);})[_0x75d1('0x16')](respondWithResult(_0x45eea3,null))[_0x75d1('0xb')](handleError(_0x45eea3,null));};exports[_0x75d1('0x2d')]=function(_0x93922f,_0xe14be9){if(_0x93922f[_0x75d1('0x21')]&&_0x93922f[_0x75d1('0x21')][_0x75d1('0x2e')]&&_0x93922f[_0x75d1('0x2f')]&&_0x93922f[_0x75d1('0x2f')][_0x75d1('0x10')]){for(var _0x2384aa in _0x93922f[_0x75d1('0x21')][_0x75d1('0x2e')]){if(_0x93922f['body']['interaction'][_0x75d1('0x30')](_0x2384aa)){db[_0x75d1('0x31')][_0x75d1('0x32')]({'where':{'channel':_0x2384aa,'membername':_0x93922f[_0x75d1('0x2f')]['name'],'type':_0x75d1('0x33'),'exitAt':null,'uniqueid':_0x93922f[_0x75d1('0x21')][_0x75d1('0x2e')][_0x2384aa]&&_0x93922f[_0x75d1('0x21')]['interaction'][_0x2384aa][_0x75d1('0x34')]?{'$notIn':_0x93922f[_0x75d1('0x21')][_0x75d1('0x2e')][_0x2384aa]}:{'$ne':null}}})[_0x75d1('0x16')](function(_0x5b486d){var _0x34d132=moment()['format'](_0x75d1('0x35'));for(var _0x1d063d=0x0,_0x9bc1ed=_0x5b486d[_0x75d1('0x34')];_0x1d063d<_0x9bc1ed;_0x1d063d+=0x1){_0x5b486d[_0x1d063d][_0x75d1('0x36')]({'exitAt':_0x34d132});}});for(var _0x2137e1=0x0;_0x2137e1<_0x93922f['body'][_0x75d1('0x2e')][_0x2384aa]['length'];_0x2137e1+=0x1){db['MemberReport'][_0x75d1('0x37')]({'where':{'channel':_0x2384aa,'membername':_0x93922f[_0x75d1('0x2f')][_0x75d1('0x10')],'type':_0x75d1('0x33'),'uniqueid':_0x93922f[_0x75d1('0x21')][_0x75d1('0x2e')][_0x2384aa][_0x2137e1],'exitAt':null},'defaults':{'channel':_0x2384aa,'membername':_0x93922f[_0x75d1('0x2f')]['name'],'interface':_['isNil'](_0x93922f[_0x75d1('0x2f')][_0x75d1('0x38')])?util['format'](_0x75d1('0x39'),_0x93922f[_0x75d1('0x2f')][_0x75d1('0x10')]):_0x93922f['user'][_0x75d1('0x38')],'type':_0x75d1('0x33'),'enterAt':moment()[_0x75d1('0x3a')](_0x75d1('0x35')),'role':_0x75d1('0x3b'),'internal':_0x93922f[_0x75d1('0x2f')][_0x75d1('0x3c')],'uniqueid':_0x93922f['body'][_0x75d1('0x2e')][_0x2384aa][_0x2137e1]}});}}}}return respondWithRpcPromise(_0x75d1('0x3d'),{'id':_0x93922f[_0x75d1('0x1a')]['id'],'capacity':_0x93922f[_0x75d1('0x21')][_0x75d1('0x3e')]},routingClient)[_0x75d1('0x16')](respondWithResult(_0xe14be9,null))[_0x75d1('0xb')](handleError(_0xe14be9,null));};exports['telephones']=function(_0x7da202,_0x3af9c5){return respondWithRpcPromise(_0x75d1('0x3f'),_0x7da202['query'])[_0x75d1('0x16')](respondWithResult(_0x3af9c5,null))[_0x75d1('0xb')](handleError(_0x3af9c5,null));};exports[_0x75d1('0x40')]=function(_0x382760,_0x281123){return respondWithRpcPromise(_0x75d1('0x41'),_0x382760['query'])[_0x75d1('0x16')](respondWithResult(_0x281123,null))[_0x75d1('0xb')](handleError(_0x281123,null));};exports[_0x75d1('0x42')]=function(_0x46e665,_0x2e746a){return respondWithRpcPromise(_0x75d1('0x43'),_0x46e665[_0x75d1('0x19')])[_0x75d1('0x16')](respondWithResult(_0x2e746a,null))[_0x75d1('0xb')](handleError(_0x2e746a,null));};exports[_0x75d1('0x44')]=function(_0x1038d2,_0x13050e){return respondWithRpcPromise('ChatQueues',_0x1038d2['query'],routingClient)[_0x75d1('0x16')](respondWithResult(_0x13050e,null))['catch'](handleError(_0x13050e,null));};exports[_0x75d1('0x45')]=function(_0x1e149b,_0x5dcb55){return respondWithRpcPromise(_0x75d1('0x46'),_0x1e149b[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](findById(_0x1e149b[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x5dcb55,null))[_0x75d1('0xb')](handleError(_0x5dcb55,null));};exports[_0x75d1('0x47')]=function(_0x5048ef,_0x3c5da6){return respondWithRpcPromise(_0x75d1('0x48'),_0x5048ef[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x3c5da6,null))[_0x75d1('0xb')](handleError(_0x3c5da6,null));};exports[_0x75d1('0x49')]=function(_0x41f98f,_0x3b30fb){return respondWithRpcPromise(_0x75d1('0x48'),_0x41f98f[_0x75d1('0x19')],routingClient)['then'](findById(_0x41f98f['params']['id']))[_0x75d1('0x16')](respondWithResult(_0x3b30fb,null))[_0x75d1('0xb')](handleError(_0x3b30fb,null));};exports[_0x75d1('0x4a')]=function(_0x49d9ca,_0x1d7de1){return respondWithRpcPromise('MailAccounts',_0x49d9ca[_0x75d1('0x19')],mailClient)[_0x75d1('0x16')](respondWithResult(_0x1d7de1,null))[_0x75d1('0xb')](handleError(_0x1d7de1,null));};exports[_0x75d1('0x4b')]=function(_0x5d2219,_0x22ce12){return respondWithRpcPromise('OpenchannelQueues',_0x5d2219['query'],routingClient)[_0x75d1('0x16')](respondWithResult(_0x22ce12,null))[_0x75d1('0xb')](handleError(_0x22ce12,null));};exports[_0x75d1('0x4c')]=function(_0x3c8119,_0x4fd170){return respondWithRpcPromise('OpenchannelQueues',_0x3c8119[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](findById(_0x3c8119[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x4fd170,null))[_0x75d1('0xb')](handleError(_0x4fd170,null));};exports['smsQueues']=function(_0x223db6,_0x44173c){return respondWithRpcPromise(_0x75d1('0x4d'),_0x223db6[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x44173c,null))[_0x75d1('0xb')](handleError(_0x44173c,null));};exports[_0x75d1('0x4e')]=function(_0x1092fb,_0x40f50b){return respondWithRpcPromise(_0x75d1('0x4d'),_0x1092fb[_0x75d1('0x19')],routingClient)['then'](findById(_0x1092fb[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x40f50b,null))[_0x75d1('0xb')](handleError(_0x40f50b,null));};exports[_0x75d1('0x4f')]=function(_0x3754b1,_0x174fde){return respondWithRpcPromise(_0x75d1('0x50'),_0x3754b1['query'],routingClient)['then'](respondWithResult(_0x174fde,null))[_0x75d1('0xb')](handleError(_0x174fde,null));};exports[_0x75d1('0x51')]=function(_0x6f8ca2,_0x13ddbb){return respondWithRpcPromise(_0x75d1('0x50'),_0x6f8ca2['query'],routingClient)['then'](findById(_0x6f8ca2[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x13ddbb,null))['catch'](handleError(_0x13ddbb,null));};exports[_0x75d1('0x52')]=function(_0x29b1f4,_0x25dfa1){return respondWithRpcPromise(_0x75d1('0x53'),_0x29b1f4[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x25dfa1,null))['catch'](handleError(_0x25dfa1,null));};exports['showFaxQueues']=function(_0x2c0452,_0x3fad5c){return respondWithRpcPromise('FaxQueues',_0x2c0452[_0x75d1('0x19')],routingClient)['then'](findById(_0x2c0452[_0x75d1('0x1a')]['id']))[_0x75d1('0x16')](respondWithResult(_0x3fad5c,null))[_0x75d1('0xb')](handleError(_0x3fad5c,null));};exports['faxAccounts']=function(_0x254cfe,_0x1f9ac2){return respondWithRpcPromise(_0x75d1('0x54'),_0x254cfe[_0x75d1('0x19')])[_0x75d1('0x16')](respondWithResult(_0x1f9ac2,null))['catch'](handleError(_0x1f9ac2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3785fd,_0x58d20b){return respondWithRpcPromise(_0x75d1('0x55'),_0x3785fd[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x58d20b,null))['catch'](handleError(_0x58d20b,null));};exports['mailQueuesWaitingInteractions']=function(_0x2e6849,_0x486977){return respondWithRpcPromise(_0x75d1('0x56'),_0x2e6849[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x486977,null))['catch'](handleError(_0x486977,null));};exports[_0x75d1('0x57')]=function(_0x353bec,_0x644ced){return respondWithRpcPromise(_0x75d1('0x58'),_0x353bec[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](respondWithResult(_0x644ced,null))[_0x75d1('0xb')](handleError(_0x644ced,null));};exports[_0x75d1('0x59')]=function(_0x3af4a7,_0x1ca2ee){return respondWithRpcPromise(_0x75d1('0x58'),_0x3af4a7[_0x75d1('0x19')],routingClient)[_0x75d1('0x16')](function(_0x44ef76){if(_0x3af4a7['query']['type']!==undefined){var _0x410fa1=_(_0x44ef76[_0x75d1('0x13')])['filter']([_0x3af4a7[_0x75d1('0x19')]['type'],_0x3af4a7['params']['id']])['map'](_0x75d1('0x5a'))[_0x75d1('0x5b')]()[_0x75d1('0x5c')]();return _0x44ef76[_0x75d1('0x13')][_0x75d1('0x5d')](function(_0x5d5a72){return _0x410fa1[_0x75d1('0x5e')](_0x5d5a72[_0x75d1('0x5a')])>-0x1;});}else{return _0x44ef76[_0x75d1('0x13')][_0x75d1('0x5d')](function(_0x29960e){return _0x29960e['queue_id']===parseInt(_0x3af4a7[_0x75d1('0x1a')]['id']);});}})['then'](respondWithResult(_0x1ca2ee,null))[_0x75d1('0xb')](handleError(_0x1ca2ee,null));};exports[_0x75d1('0x5f')]=function(_0x3d5355,_0x526d98){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x3d5355['query'],routingClient)[_0x75d1('0x16')](respondWithResult(_0x526d98,null))[_0x75d1('0xb')](handleError(_0x526d98,null));};exports[_0x75d1('0x60')]=function(_0x22caf3,_0x17ec6d){return respondWithRpcPromise(_0x75d1('0x61'),_0x22caf3['query'],routingClient)[_0x75d1('0x16')](respondWithResult(_0x17ec6d,null))[_0x75d1('0xb')](handleError(_0x17ec6d,null));};exports['faxQueuesWaitingInteractions']=function(_0x4eda90,_0x5c16be){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4eda90['query'],routingClient)[_0x75d1('0x16')](respondWithResult(_0x5c16be,null))['catch'](handleError(_0x5c16be,null));};exports['queueNotify']=function(_0x3f582c){return function(_0x4e546f,_0x451828){var _0x13179c,_0x739cc2;var _0xc939c9=_[_0x75d1('0x62')](_0x3f582c);var _0x1aa806=_0x3f582c===_0x75d1('0x63')?_0x75d1('0x64'):'Account';return db[_0xc939c9+_0x75d1('0x65')]['findOne']({'raw':!![],'where':{'id':_0x4e546f[_0x75d1('0x1a')]['id']}})[_0x75d1('0x16')](function(_0x358c70){if(_['isNil'](_0x358c70)){throw new Error(_0xc939c9+_0x75d1('0x66'));}_0x13179c=_0x358c70;return db[_0xc939c9+_0x75d1('0x67')][_0x75d1('0x68')]({'where':{'id':_0x4e546f[_0x75d1('0x21')][_0x75d1('0x69')]},'include':[{'model':db[_0xc939c9+_0x75d1('0x6a')],'as':_0x75d1('0x6a')},{'model':db[_0xc939c9+_0x1aa806],'as':'Account'}]});})[_0x75d1('0x16')](function(_0x21932b){if(_[_0x75d1('0x12')](_0x21932b)){throw new Error(_0xc939c9+_0x75d1('0x6b'));}_0x739cc2=_0x21932b;return _0x21932b[_0x75d1('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4814d8={'uniqueid':_0x3f582c+'.'+_0x739cc2['id']+'.'+_0x739cc2[_0x75d1('0x6a')]['id'],'FromUserId':_0x4e546f['user']['id'],'type':_0x75d1('0x6d')};_0x4814d8[_0xc939c9+_0x75d1('0x6e')]=_0x739cc2['id'];_0x4814d8[_0xc939c9+_0x75d1('0x6f')]=_0x739cc2[_0x75d1('0x6a')]['id'];_0x4814d8['From'+_0xc939c9+_0x1aa806+'Id']=_0x739cc2['Account']['id'];_0x4814d8['To'+_0xc939c9+_0x75d1('0x70')]=_0x13179c['id'];return db[_0xc939c9+_0x75d1('0x71')][_0x75d1('0x72')](_0x4814d8);})[_0x75d1('0x16')](function(){return respondWithRpcPromise(_0x75d1('0x73'),{'channel':_0x3f582c,'interaction':_0x739cc2['Interaction'],'message':_0x739cc2,'account':_0x739cc2[_0x75d1('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':_0x75d1('0x6d'),'appdata':_0x13179c['name']+','+(_0x739cc2[_0x75d1('0x74')][_0x75d1('0x75')]||0x12c),'interval':_0x75d1('0x76')}]},routingClient);})[_0x75d1('0x16')](respondWithResult(_0x451828,null))[_0x75d1('0xb')](handleError(_0x451828,null));};};exports[_0x75d1('0x77')]=function(_0x54405a,_0x145b7f){var _0x1b026e,_0x39084f;if(_[_0x75d1('0x12')](_0x54405a[_0x75d1('0x21')][_0x75d1('0x78')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x30214e=_0x54405a['body'][_0x75d1('0x78')];var _0x400d3a=_[_0x75d1('0x62')](_0x30214e);var _0x15ac7b=_0x30214e===_0x75d1('0x63')?_0x75d1('0x64'):'Account';return db[_0x75d1('0x79')][_0x75d1('0x68')]({'raw':!![],'where':{'id':_0x54405a[_0x75d1('0x1a')]['id'],'role':'agent'}})[_0x75d1('0x16')](function(_0x4433ff){if(_['isNil'](_0x4433ff)){throw new Error(_0x75d1('0x7a'));}_0x1b026e=_0x4433ff;return db[_0x400d3a+_0x75d1('0x67')][_0x75d1('0x68')]({'where':{'id':_0x54405a[_0x75d1('0x21')][_0x75d1('0x69')]},'include':[{'model':db[_0x400d3a+_0x75d1('0x6a')],'as':_0x75d1('0x6a')},{'model':db[_0x400d3a+_0x15ac7b],'as':_0x75d1('0x74')}]});})[_0x75d1('0x16')](function(_0x57653d){if(_[_0x75d1('0x12')](_0x57653d)){throw new Error(_0x400d3a+_0x75d1('0x6b'));}_0x39084f=_0x57653d;return _0x57653d['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x75d1('0x16')](function(){var _0x2e9cf1={'uniqueid':_0x30214e+'.'+_0x39084f['id']+'.'+_0x39084f['Interaction']['id'],'FromUserId':_0x54405a['user']['id'],'type':_0x75d1('0x6d'),'ToUserId':_0x1b026e['id']};_0x2e9cf1[_0x400d3a+_0x75d1('0x6e')]=_0x39084f['id'];_0x2e9cf1[_0x400d3a+_0x75d1('0x6f')]=_0x39084f[_0x75d1('0x6a')]['id'];_0x2e9cf1['From'+_0x400d3a+_0x15ac7b+'Id']=_0x39084f[_0x75d1('0x74')]['id'];return db[_0x400d3a+'TransferReport'][_0x75d1('0x72')](_0x2e9cf1);})[_0x75d1('0x16')](function(){return respondWithRpcPromise(_0x75d1('0x73'),{'channel':_0x30214e,'interaction':_0x39084f[_0x75d1('0x6a')],'message':_0x39084f,'account':_0x39084f[_0x75d1('0x74')],'applications':[{'id':0x0,'priority':0x1,'app':_0x75d1('0x3b'),'appdata':_0x1b026e[_0x75d1('0x10')]+','+(_0x39084f[_0x75d1('0x74')][_0x75d1('0x7b')]||0x12c),'interval':_0x75d1('0x76')}]},routingClient);})[_0x75d1('0x16')](respondWithResult(_0x145b7f,null))[_0x75d1('0xb')](handleError(_0x145b7f,null));}; \ No newline at end of file +var _0x038b=['\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','update','Start','agentTransferTimeout','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne'];(function(_0xb72220,_0x2f7d42){var _0x20af34=function(_0x229d37){while(--_0x229d37){_0xb72220['push'](_0xb72220['shift']());}};_0x20af34(++_0x2f7d42);}(_0x038b,0x114));var _0xb038=function(_0x2042e6,_0x4208de){_0x2042e6=_0x2042e6-0x0;var _0x3c8770=_0x038b[_0x2042e6];return _0x3c8770;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb038('0x0'));var _=require(_0xb038('0x1'));var util=require(_0xb038('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb038('0x3'))('api');var jayson=require(_0xb038('0x4'));var amiClient=jayson[_0xb038('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb038('0x5')][_0xb038('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){var _0x462e8f=_0x1534a9?_0x1534a9:amiClient;return _0x462e8f[_0xb038('0x7')](_0x2e3e64,_0x1b077a)['then'](function(_0x53bcc0){if(_0x53bcc0[_0xb038('0x8')]){if(_0x53bcc0[_0xb038('0x8')]['code']===0x1f4){return _0x48a4d7(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}return _0x4b4085(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}else{_0x4b4085(_0x53bcc0[_0xb038('0xa')]);}})[_0xb038('0xb')](function(_0x1e6474){_0x48a4d7(_0x1e6474);});});}function respondWithResult(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xc8;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0xc')](_0x16e4a3)[_0xb038('0xd')](_0x57acd8);}return _0x439751[_0xb038('0xe')](0x194);};}function handleError(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0x1f4;return function(_0x13acc7){logger[_0xb038('0x8')](_0x13acc7['stack']);if(_0x13acc7[_0xb038('0xf')]){delete _0x13acc7[_0xb038('0xf')];}_0x3cc717[_0xb038('0xc')](_0x3a71a6)[_0xb038('0x10')](_0x13acc7);};}function findById(_0xdef213){return function(_0x2b4173){if(!_['isNil'](_0xdef213)&&!_[_0xb038('0x11')](_0x2b4173)&&!_[_0xb038('0x11')](_0x2b4173[_0xb038('0x12')])){return _[_0xb038('0x13')](_0x2b4173['rows'],function(_0x49b237){return _0x49b237['id']==_0xdef213;});}return null;};}exports[_0xb038('0x14')]=function(_0x3f48e6,_0x3e06ef){return respondWithRpcPromise(_0xb038('0x15'),_0x3f48e6['query'])[_0xb038('0x16')](respondWithResult(_0x3e06ef,null))[_0xb038('0xb')](handleError(_0x3e06ef,null));};exports[_0xb038('0x17')]=function(_0x33a377,_0xc6cd61){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb038('0x18')](_0x33a377[_0xb038('0x19')],_0x33a377[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0xc6cd61,null))['catch'](handleError(_0xc6cd61,null));};exports[_0xb038('0x1b')]=function(_0x1b7505,_0x4bbf38){return respondWithRpcPromise(_0xb038('0x1c'),_[_0xb038('0x18')](_0x1b7505['query'],_0x1b7505[_0xb038('0x1a')]))['then'](respondWithResult(_0x4bbf38,null))[_0xb038('0xb')](handleError(_0x4bbf38,null));};exports[_0xb038('0x1d')]=function(_0x27ff21,_0x1df7c4){return respondWithRpcPromise(_0xb038('0x1e'),_0x27ff21[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1df7c4,null))['catch'](handleError(_0x1df7c4,null));};exports[_0xb038('0x1f')]=function(_0x33cf3c,_0x226631){return respondWithRpcPromise('VoiceQueues',_0x33cf3c[_0xb038('0x19')])[_0xb038('0x16')](findById(_0x33cf3c[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x226631,null))[_0xb038('0xb')](handleError(_0x226631,null));};exports[_0xb038('0x20')]=function(_0x28a6a9,_0x12b3b6){return respondWithRpcPromise(_0xb038('0x21'),_['merge'](_0x28a6a9[_0xb038('0x22')],_0x28a6a9[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x12b3b6,null))[_0xb038('0xb')](handleError(_0x12b3b6,null));};exports[_0xb038('0x23')]=function(_0xbc8958,_0x29a0d7){return respondWithRpcPromise(_0xb038('0x24'),_[_0xb038('0x18')](_0xbc8958[_0xb038('0x19')],_0xbc8958[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x29a0d7,null))[_0xb038('0xb')](handleError(_0x29a0d7,null));};exports['voiceQueuesChannels']=function(_0x1d807a,_0x598554){return respondWithRpcPromise(_0xb038('0x25'),_0x1d807a[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x598554,null))[_0xb038('0xb')](handleError(_0x598554,null));};exports[_0xb038('0x26')]=function(_0x424b81,_0x3a393d){return respondWithRpcPromise(_0xb038('0x27'),_[_0xb038('0x18')](_0x424b81[_0xb038('0x19')],_0x424b81['params']))[_0xb038('0x16')](respondWithResult(_0x3a393d,null))[_0xb038('0xb')](handleError(_0x3a393d,null));};exports[_0xb038('0x28')]=function(_0x560342,_0x51e649){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb038('0x18')](_0x560342[_0xb038('0x19')],_0x560342[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x51e649,null))[_0xb038('0xb')](handleError(_0x51e649,null));};exports[_0xb038('0x29')]=function(_0x48f777,_0x16abea){return respondWithRpcPromise(_0xb038('0x2a'),_[_0xb038('0x18')](_0x48f777[_0xb038('0x19')],_0x48f777['params']))[_0xb038('0x16')](respondWithResult(_0x16abea,null))[_0xb038('0xb')](handleError(_0x16abea,null));};exports['outbound']=function(_0x5cb40c,_0x26c769){return respondWithRpcPromise(_0xb038('0x2b'),_0x5cb40c[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x26c769,null))[_0xb038('0xb')](handleError(_0x26c769,null));};exports['outboundChannels']=function(_0x404f82,_0x125d2a){return respondWithRpcPromise(_0xb038('0x2c'),_0x404f82[_0xb038('0x19')])['then'](respondWithResult(_0x125d2a,null))[_0xb038('0xb')](handleError(_0x125d2a,null));};exports[_0xb038('0x2d')]=function(_0x7d2f79,_0x573426){var _0x412d71;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')])[_0xb038('0x16')](function(_0x3ac1db){_0x412d71=_0x3ac1db;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')],routingClient);})[_0xb038('0x16')](function(_0x4e0533){return _['merge']({},_0x4e0533,_0x412d71);})[_0xb038('0x16')](respondWithResult(_0x573426,null))[_0xb038('0xb')](handleError(_0x573426,null));};exports[_0xb038('0x2e')]=function(_0x3c291e,_0x5ad462){if(_0x3c291e[_0xb038('0x22')]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]&&_0x3c291e[_0xb038('0x30')]&&_0x3c291e['user'][_0xb038('0xf')]){for(var _0x269c7d in _0x3c291e['body'][_0xb038('0x2f')]){if(_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]['hasOwnProperty'](_0x269c7d)){db[_0xb038('0x31')][_0xb038('0x32')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e['user']['name'],'type':_0xb038('0x33'),'exitAt':null,'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0xb038('0x34')]?{'$notIn':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]}:{'$ne':null}}})['then'](function(_0x5f0d9d){var _0x5e8383=moment()[_0xb038('0x35')](_0xb038('0x36'));for(var _0x52f0b8=0x0,_0x46a724=_0x5f0d9d[_0xb038('0x34')];_0x52f0b8<_0x46a724;_0x52f0b8+=0x1){_0x5f0d9d[_0x52f0b8][_0xb038('0x37')]({'exitAt':_0x5e8383});}});for(var _0x5f24cd=0x0;_0x5f24cd<_0x3c291e[_0xb038('0x22')]['interaction'][_0x269c7d]['length'];_0x5f24cd+=0x1){db[_0xb038('0x31')][_0xb038('0x38')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'type':_0xb038('0x33'),'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd],'exitAt':null},'defaults':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'interface':_[_0xb038('0x11')](_0x3c291e['user'][_0xb038('0x39')])?util[_0xb038('0x35')]('SIP/%s',_0x3c291e[_0xb038('0x30')][_0xb038('0xf')]):_0x3c291e['user'][_0xb038('0x39')],'type':_0xb038('0x33'),'enterAt':moment()[_0xb038('0x35')](_0xb038('0x36')),'role':_0xb038('0x3a'),'internal':_0x3c291e[_0xb038('0x30')][_0xb038('0x3b')],'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3c291e[_0xb038('0x1a')]['id'],'capacity':_0x3c291e[_0xb038('0x22')][_0xb038('0x3c')]},routingClient)[_0xb038('0x16')](respondWithResult(_0x5ad462,null))[_0xb038('0xb')](handleError(_0x5ad462,null));};exports[_0xb038('0x3d')]=function(_0x591077,_0x1f4997){return respondWithRpcPromise(_0xb038('0x3e'),_0x591077[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1f4997,null))[_0xb038('0xb')](handleError(_0x1f4997,null));};exports[_0xb038('0x3f')]=function(_0xd7a862,_0x5b82f4){return respondWithRpcPromise(_0xb038('0x40'),_0xd7a862['query'])[_0xb038('0x16')](respondWithResult(_0x5b82f4,null))[_0xb038('0xb')](handleError(_0x5b82f4,null));};exports[_0xb038('0x41')]=function(_0x998fe3,_0x1518c4){return respondWithRpcPromise('Campaigns',_0x998fe3['query'])['then'](respondWithResult(_0x1518c4,null))[_0xb038('0xb')](handleError(_0x1518c4,null));};exports[_0xb038('0x42')]=function(_0x276fac,_0x218368){return respondWithRpcPromise(_0xb038('0x43'),_0x276fac[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x218368,null))[_0xb038('0xb')](handleError(_0x218368,null));};exports[_0xb038('0x44')]=function(_0x5b2cbb,_0x5b27d3){return respondWithRpcPromise(_0xb038('0x43'),_0x5b2cbb['query'],routingClient)[_0xb038('0x16')](findById(_0x5b2cbb['params']['id']))[_0xb038('0x16')](respondWithResult(_0x5b27d3,null))[_0xb038('0xb')](handleError(_0x5b27d3,null));};exports[_0xb038('0x45')]=function(_0x4300e9,_0x4ee38b){return respondWithRpcPromise(_0xb038('0x46'),_0x4300e9[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4ee38b,null))[_0xb038('0xb')](handleError(_0x4ee38b,null));};exports[_0xb038('0x47')]=function(_0x1246c8,_0x14a553){return respondWithRpcPromise(_0xb038('0x46'),_0x1246c8[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x1246c8[_0xb038('0x1a')]['id']))[_0xb038('0x16')](respondWithResult(_0x14a553,null))['catch'](handleError(_0x14a553,null));};exports[_0xb038('0x48')]=function(_0x2fc38d,_0x438e7e){return respondWithRpcPromise(_0xb038('0x49'),_0x2fc38d[_0xb038('0x19')],mailClient)['then'](respondWithResult(_0x438e7e,null))[_0xb038('0xb')](handleError(_0x438e7e,null));};exports['openchannelQueues']=function(_0xfb3ce6,_0x170a7e){return respondWithRpcPromise('OpenchannelQueues',_0xfb3ce6[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x170a7e,null))[_0xb038('0xb')](handleError(_0x170a7e,null));};exports[_0xb038('0x4a')]=function(_0x120cc7,_0x2f01c0){return respondWithRpcPromise(_0xb038('0x4b'),_0x120cc7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x120cc7[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2f01c0,null))[_0xb038('0xb')](handleError(_0x2f01c0,null));};exports['smsQueues']=function(_0x189894,_0x37e445){return respondWithRpcPromise(_0xb038('0x4c'),_0x189894[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x37e445,null))[_0xb038('0xb')](handleError(_0x37e445,null));};exports[_0xb038('0x4d')]=function(_0x4c23b2,_0x572ad4){return respondWithRpcPromise(_0xb038('0x4c'),_0x4c23b2[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4c23b2['params']['id']))['then'](respondWithResult(_0x572ad4,null))[_0xb038('0xb')](handleError(_0x572ad4,null));};exports['whatsappQueues']=function(_0x35da9e,_0x50e078){return respondWithRpcPromise(_0xb038('0x4e'),_0x35da9e['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x50e078,null))[_0xb038('0xb')](handleError(_0x50e078,null));};exports[_0xb038('0x4f')]=function(_0x112d77,_0x2c57b9){return respondWithRpcPromise(_0xb038('0x4e'),_0x112d77['query'],routingClient)['then'](findById(_0x112d77[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2c57b9,null))[_0xb038('0xb')](handleError(_0x2c57b9,null));};exports[_0xb038('0x50')]=function(_0x2f4650,_0x538690){return respondWithRpcPromise(_0xb038('0x51'),_0x2f4650['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x538690,null))[_0xb038('0xb')](handleError(_0x538690,null));};exports[_0xb038('0x52')]=function(_0x4a417a,_0x40abb7){return respondWithRpcPromise(_0xb038('0x51'),_0x4a417a[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4a417a[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x40abb7,null))['catch'](handleError(_0x40abb7,null));};exports['faxAccounts']=function(_0x609caf,_0x4efa0f){return respondWithRpcPromise(_0xb038('0x53'),_0x609caf['query'])[_0xb038('0x16')](respondWithResult(_0x4efa0f,null))[_0xb038('0xb')](handleError(_0x4efa0f,null));};exports[_0xb038('0x54')]=function(_0x1294d7,_0x7c8d01){return respondWithRpcPromise(_0xb038('0x55'),_0x1294d7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x7c8d01,null))[_0xb038('0xb')](handleError(_0x7c8d01,null));};exports[_0xb038('0x56')]=function(_0x1db407,_0x1a5cf6){return respondWithRpcPromise(_0xb038('0x57'),_0x1db407[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1a5cf6,null))[_0xb038('0xb')](handleError(_0x1a5cf6,null));};exports[_0xb038('0x58')]=function(_0x123e31,_0x1f9a30){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x123e31[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1f9a30,null))[_0xb038('0xb')](handleError(_0x1f9a30,null));};exports[_0xb038('0x59')]=function(_0xdaacfe,_0x5ead21){return respondWithRpcPromise(_0xb038('0x5a'),_0xdaacfe[_0xb038('0x19')],routingClient)[_0xb038('0x16')](function(_0x80d720){if(_0xdaacfe[_0xb038('0x19')][_0xb038('0x5b')]!==undefined){var _0x2acbf6=_(_0x80d720[_0xb038('0x12')])[_0xb038('0x5c')]([_0xdaacfe['query']['type'],_0xdaacfe[_0xb038('0x1a')]['id']])['map'](_0xb038('0x5d'))['uniq']()['value']();return _0x80d720['rows'][_0xb038('0x5c')](function(_0x463ae6){return _0x2acbf6['indexOf'](_0x463ae6[_0xb038('0x5d')])>-0x1;});}else{return _0x80d720[_0xb038('0x12')][_0xb038('0x5c')](function(_0x31ccf7){return _0x31ccf7[_0xb038('0x5d')]===parseInt(_0xdaacfe[_0xb038('0x1a')]['id']);});}})[_0xb038('0x16')](respondWithResult(_0x5ead21,null))[_0xb038('0xb')](handleError(_0x5ead21,null));};exports[_0xb038('0x5e')]=function(_0xde487d,_0x4b15b7){return respondWithRpcPromise(_0xb038('0x5f'),_0xde487d[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4b15b7,null))[_0xb038('0xb')](handleError(_0x4b15b7,null));};exports[_0xb038('0x60')]=function(_0x222e90,_0x425854){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x222e90[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x425854,null))[_0xb038('0xb')](handleError(_0x425854,null));};exports['faxQueuesWaitingInteractions']=function(_0x551fcc,_0x2adf3b){return respondWithRpcPromise(_0xb038('0x61'),_0x551fcc[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x2adf3b,null))[_0xb038('0xb')](handleError(_0x2adf3b,null));};exports[_0xb038('0x62')]=function(_0x5b003a){return function(_0x2e6db4,_0x1d5640){var _0x240d06,_0x2a41c8;var _0x24f810=_[_0xb038('0x63')](_0x5b003a);var _0x1ea747=_0x5b003a===_0xb038('0x64')?_0xb038('0x65'):_0xb038('0x66');return db[_0x24f810+_0xb038('0x67')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x2e6db4[_0xb038('0x1a')]['id']}})[_0xb038('0x16')](function(_0x5d1410){if(_[_0xb038('0x11')](_0x5d1410)){throw new Error(_0x24f810+_0xb038('0x69'));}_0x240d06=_0x5d1410;return db[_0x24f810+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x2e6db4[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x24f810+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x24f810+_0x1ea747],'as':'Account'}]});})[_0xb038('0x16')](function(_0x3e01ce){if(_['isNil'](_0x3e01ce)){throw new Error(_0x24f810+_0xb038('0x6d'));}_0x2a41c8=_0x3e01ce;return _0x3e01ce['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x38a4d3={'uniqueid':_0x5b003a+'.'+_0x2a41c8['id']+'.'+_0x2a41c8['Interaction']['id'],'FromUserId':_0x2e6db4[_0xb038('0x30')]['id'],'type':'queue'};_0x38a4d3[_0x24f810+_0xb038('0x6e')]=_0x2a41c8['id'];_0x38a4d3[_0x24f810+_0xb038('0x6f')]=_0x2a41c8[_0xb038('0x6c')]['id'];_0x38a4d3[_0xb038('0x70')+_0x24f810+_0x1ea747+'Id']=_0x2a41c8[_0xb038('0x66')]['id'];_0x38a4d3['To'+_0x24f810+_0xb038('0x71')]=_0x240d06['id'];return db[_0x24f810+_0xb038('0x72')][_0xb038('0x73')](_0x38a4d3);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5b003a,'interaction':_0x2a41c8[_0xb038('0x6c')],'message':_0x2a41c8,'account':_0x2a41c8[_0xb038('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x74'),'appdata':_0x240d06[_0xb038('0xf')]+','+(_0x2a41c8['Account'][_0xb038('0x75')]||0x12c),'interval':_0xb038('0x76')}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x1d5640,null))[_0xb038('0xb')](handleError(_0x1d5640,null));};};exports[_0xb038('0x77')]=function(_0x139ffa,_0x208cdd){var _0x2ee9bd,_0x32ee35;if(_[_0xb038('0x11')](_0x139ffa['body']['channel'])){throw new Error(_0xb038('0x78'));}var _0xb7f025=_0x139ffa[_0xb038('0x22')][_0xb038('0x79')];var _0x3ee569=_[_0xb038('0x63')](_0xb7f025);var _0x3e129d=_0xb7f025==='chat'?_0xb038('0x65'):_0xb038('0x66');return db[_0xb038('0x7a')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x139ffa[_0xb038('0x1a')]['id'],'role':_0xb038('0x3a')}})['then'](function(_0x451fe5){if(_[_0xb038('0x11')](_0x451fe5)){throw new Error(_0xb038('0x7b'));}_0x2ee9bd=_0x451fe5;return db[_0x3ee569+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x139ffa[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x3ee569+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x3ee569+_0x3e129d],'as':_0xb038('0x66')}]});})[_0xb038('0x16')](function(_0x22e0bd){if(_[_0xb038('0x11')](_0x22e0bd)){throw new Error(_0x3ee569+_0xb038('0x6d'));}_0x32ee35=_0x22e0bd;return _0x22e0bd[_0xb038('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb038('0x16')](function(){var _0x5448e3={'uniqueid':_0xb7f025+'.'+_0x32ee35['id']+'.'+_0x32ee35['Interaction']['id'],'FromUserId':_0x139ffa[_0xb038('0x30')]['id'],'type':_0xb038('0x74'),'ToUserId':_0x2ee9bd['id']};_0x5448e3[_0x3ee569+_0xb038('0x6e')]=_0x32ee35['id'];_0x5448e3[_0x3ee569+'InteractionId']=_0x32ee35[_0xb038('0x6c')]['id'];_0x5448e3[_0xb038('0x70')+_0x3ee569+_0x3e129d+'Id']=_0x32ee35[_0xb038('0x66')]['id'];return db[_0x3ee569+_0xb038('0x72')]['create'](_0x5448e3);})['then'](function(){return respondWithRpcPromise(_0xb038('0x7d'),{'channel':_0xb7f025,'interaction':_0x32ee35[_0xb038('0x6c')],'message':_0x32ee35,'account':_0x32ee35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x3a'),'appdata':_0x2ee9bd[_0xb038('0xf')]+','+(_0x32ee35[_0xb038('0x66')][_0xb038('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x208cdd,null))[_0xb038('0xb')](handleError(_0x208cdd,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a8cfa1a..f2f96a2 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 _0x25cb=['index','isAuthenticated','show','/:id/run','run','post','put','/:id','update','delete','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25cb,0x106));var _0xb25c=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0x25cb[_0x33cf66];return _0x3a400b;};'use strict';var multer=require(_0xb25c('0x0'));var util=require(_0xb25c('0x1'));var path=require(_0xb25c('0x2'));var timeout=require(_0xb25c('0x3'));var express=require('express');var router=express[_0xb25c('0x4')]();var fs_extra=require(_0xb25c('0x5'));var auth=require(_0xb25c('0x6'));var interaction=require(_0xb25c('0x7'));var config=require(_0xb25c('0x8'));var controller=require(_0xb25c('0x9'));router[_0xb25c('0xa')]('/',auth['isAuthenticated'](),controller[_0xb25c('0xb')]);router[_0xb25c('0xa')]('/:id',auth[_0xb25c('0xc')](),controller[_0xb25c('0xd')]);router[_0xb25c('0xa')](_0xb25c('0xe'),auth[_0xb25c('0xc')](),controller[_0xb25c('0xf')]);router[_0xb25c('0x10')]('/',auth[_0xb25c('0xc')](),controller['create']);router[_0xb25c('0x11')](_0xb25c('0x12'),auth[_0xb25c('0xc')](),controller[_0xb25c('0x13')]);router[_0xb25c('0x14')](_0xb25c('0x12'),auth[_0xb25c('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x67d3=['path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/run','run','post','create','/:id','destroy','exports','multer','util'];(function(_0x3fe2af,_0x144df2){var _0x213c7a=function(_0x9e3b07){while(--_0x9e3b07){_0x3fe2af['push'](_0x3fe2af['shift']());}};_0x213c7a(++_0x144df2);}(_0x67d3,0x12e));var _0x367d=function(_0x1f2509,_0x49520e){_0x1f2509=_0x1f2509-0x0;var _0x2ba954=_0x67d3[_0x1f2509];return _0x2ba954;};'use strict';var multer=require(_0x367d('0x0'));var util=require(_0x367d('0x1'));var path=require(_0x367d('0x2'));var timeout=require('connect-timeout');var express=require(_0x367d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x367d('0x4'));var interaction=require(_0x367d('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0x367d('0x6')]('/',auth[_0x367d('0x7')](),controller[_0x367d('0x8')]);router[_0x367d('0x6')]('/:id',auth[_0x367d('0x7')](),controller['show']);router[_0x367d('0x6')](_0x367d('0x9'),auth[_0x367d('0x7')](),controller[_0x367d('0xa')]);router[_0x367d('0xb')]('/',auth['isAuthenticated'](),controller[_0x367d('0xc')]);router['put']('/:id',auth[_0x367d('0x7')](),controller['update']);router['delete'](_0x367d('0xd'),auth['isAuthenticated'](),controller[_0x367d('0xe')]);module[_0x367d('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a9da691..71ea8e1 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 _0x690d=['minutes','ENUM','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','years','quarters','weeks','days'];(function(_0x504c88,_0x1c3016){var _0xb5611e=function(_0x2beaf8){while(--_0x2beaf8){_0x504c88['push'](_0x504c88['shift']());}};_0xb5611e(++_0x1c3016);}(_0x690d,0x1dd));var _0xd690=function(_0x467c08,_0x5369a5){_0x467c08=_0x467c08-0x0;var _0x4c9443=_0x690d[_0x467c08];return _0x4c9443;};'use strict';var Sequelize=require(_0xd690('0x0'));module[_0xd690('0x1')]={'name':{'type':Sequelize[_0xd690('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd690('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd690('0x2')],'allowNull':![],'defaultValue':_0xd690('0x3')},'startAt':{'type':Sequelize[_0xd690('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd690('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd690('0x5'),_0xd690('0x6'),'months',_0xd690('0x7'),_0xd690('0x8'),'hours',_0xd690('0x9')),'allowNull':![],'defaultValue':_0xd690('0x8')},'output':{'type':Sequelize[_0xd690('0xa')](_0xd690('0xb'),_0xd690('0xc'),_0xd690('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xd690('0xe'),_0xd690('0xf')),'allowNull':![],'defaultValue':_0xd690('0xe')},'sendMail':{'type':Sequelize[_0xd690('0x10')],'defaultValue':![]},'email':{'type':Sequelize[_0xd690('0x2')]},'cc':{'type':Sequelize[_0xd690('0x11')]},'bcc':{'type':Sequelize[_0xd690('0x11')]},'sendIfEmpty':{'type':Sequelize[_0xd690('0x10')],'defaultValue':!![]}}; \ No newline at end of file +var _0x254c=['0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','months','weeks','days','hours','pdf','csv','default','custom','BOOLEAN','TEXT','sequelize','STRING'];(function(_0xd86a22,_0x58034d){var _0x2cc68b=function(_0x16171e){while(--_0x16171e){_0xd86a22['push'](_0xd86a22['shift']());}};_0x2cc68b(++_0x58034d);}(_0x254c,0xdb));var _0xc254=function(_0x56cdf8,_0x58e7b9){_0x56cdf8=_0x56cdf8-0x0;var _0x35da11=_0x254c[_0x56cdf8];return _0x35da11;};'use strict';var Sequelize=require(_0xc254('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xc254('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc254('0x1')],'allowNull':![],'defaultValue':_0xc254('0x2')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc254('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc254('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xc254('0x5')](_0xc254('0x6'),'quarters',_0xc254('0x7'),_0xc254('0x8'),_0xc254('0x9'),_0xc254('0xa'),'minutes'),'allowNull':![],'defaultValue':_0xc254('0x9')},'output':{'type':Sequelize[_0xc254('0x5')]('csv',_0xc254('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xc254('0xc')},'type':{'type':Sequelize[_0xc254('0x5')]('custom',_0xc254('0xd')),'allowNull':![],'defaultValue':_0xc254('0xe')},'sendMail':{'type':Sequelize[_0xc254('0xf')],'defaultValue':![]},'email':{'type':Sequelize[_0xc254('0x1')]},'cc':{'type':Sequelize[_0xc254('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0xc254('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 2d3e785..1a668d2 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 _0x3a7f=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','run','../../config/schedule','eml-format','rimraf','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','update','then','destroy','get','error','stack','name','send','map','Schedule','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge'];(function(_0x50798b,_0x22ccf8){var _0x4b1d26=function(_0x26107f){while(--_0x26107f){_0x50798b['push'](_0x50798b['shift']());}};_0x4b1d26(++_0x22ccf8);}(_0x3a7f,0x64));var _0xf3a7=function(_0x93a9a1,_0x3f597e){_0x93a9a1=_0x93a9a1-0x0;var _0x5bed10=_0x3a7f[_0x93a9a1];return _0x5bed10;};'use strict';var emlformat=require(_0xf3a7('0x0'));var rimraf=require(_0xf3a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf3a7('0x2'));var Mustache=require(_0xf3a7('0x3'));var util=require(_0xf3a7('0x4'));var path=require(_0xf3a7('0x5'));var sox=require('sox');var csv=require(_0xf3a7('0x6'));var ejs=require(_0xf3a7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf3a7('0x8'));var crypto=require('crypto');var jsforce=require(_0xf3a7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf3a7('0x6'));var querystring=require(_0xf3a7('0xa'));var Papa=require(_0xf3a7('0xb'));var Redis=require(_0xf3a7('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xf3a7('0xd'));var as=require(_0xf3a7('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf3a7('0xf'))(_0xf3a7('0x10'));var utils=require(_0xf3a7('0x11'));var config=require(_0xf3a7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xf3a7('0x13'))['db'];function respondWithStatusCode(_0x328054,_0x336219){_0x336219=_0x336219||0xcc;return function(_0x3fc4ba){if(_0x3fc4ba){return _0x328054[_0xf3a7('0x14')](_0x336219);}return _0x328054[_0xf3a7('0x15')](_0x336219)['end']();};}function respondWithResult(_0xd2bee4,_0x2dcbf8){_0x2dcbf8=_0x2dcbf8||0xc8;return function(_0x307634){if(_0x307634){return _0xd2bee4['status'](_0x2dcbf8)[_0xf3a7('0x16')](_0x307634);}};}function respondWithFilteredResult(_0x525c84,_0x4e778e){return function(_0x29f9a3){if(_0x29f9a3){var _0xac79f=typeof _0x4e778e[_0xf3a7('0x17')]===_0xf3a7('0x18')&&typeof _0x4e778e['limit']==='undefined';var _0x2f9071=_0x29f9a3[_0xf3a7('0x19')];var _0x486b21=_0xac79f?0x0:_0x4e778e[_0xf3a7('0x17')];var _0x228259=_0xac79f?_0x29f9a3[_0xf3a7('0x19')]:_0x4e778e[_0xf3a7('0x17')]+_0x4e778e['limit'];var _0x251b7a;if(_0x228259>=_0x2f9071){_0x228259=_0x2f9071;_0x251b7a=0xc8;}else{_0x251b7a=0xce;}_0x525c84[_0xf3a7('0x15')](_0x251b7a);return _0x525c84['set'](_0xf3a7('0x1a'),_0x486b21+'-'+_0x228259+'/'+_0x2f9071)['json'](_0x29f9a3);}return null;};}function patchUpdates(_0x4fbd09){return function(_0x11db06){try{jsonpatch[_0xf3a7('0x1b')](_0x11db06,_0x4fbd09,!![]);}catch(_0xc71ef1){return BPromise[_0xf3a7('0x1c')](_0xc71ef1);}return _0x11db06['save']();};}function saveUpdates(_0x2de266,_0x21c2a6){return function(_0x1ae854){if(_0x1ae854){return _0x1ae854[_0xf3a7('0x1d')](_0x2de266)[_0xf3a7('0x1e')](function(_0x1e7078){return _0x1e7078;});}return null;};}function removeEntity(_0x18cd05,_0x2a4b62){return function(_0x53c578){if(_0x53c578){return _0x53c578[_0xf3a7('0x1f')]()[_0xf3a7('0x1e')](function(){var _0x7bbe57=_0x53c578[_0xf3a7('0x20')]({'plain':!![]});var _0x1d12d0='Scheduler';return db['UserProfileResource'][_0xf3a7('0x1f')]({'where':{'type':_0x1d12d0,'resourceId':_0x7bbe57['id']}})[_0xf3a7('0x1e')](function(){return _0x53c578;});})['then'](function(){_0x18cd05[_0xf3a7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x433380,_0x4b229c){return function(_0x3a1af9){if(!_0x3a1af9){_0x433380['sendStatus'](0x194);}return _0x3a1af9;};}function handleError(_0xb41a24,_0x2ab7c3){_0x2ab7c3=_0x2ab7c3||0x1f4;return function(_0x49398a){logger[_0xf3a7('0x21')](_0x49398a[_0xf3a7('0x22')]);if(_0x49398a['name']){delete _0x49398a[_0xf3a7('0x23')];}_0xb41a24[_0xf3a7('0x15')](_0x2ab7c3)[_0xf3a7('0x24')](_0x49398a);};}exports['index']=function(_0x46665d,_0x23f09e){var _0xd3af4d={},_0x558e90={},_0x21a035={'count':0x0,'rows':[]};var _0x51379a=_[_0xf3a7('0x25')](db[_0xf3a7('0x26')][_0xf3a7('0x27')],function(_0x28bb37){return{'name':_0x28bb37['fieldName'],'type':_0x28bb37[_0xf3a7('0x28')][_0xf3a7('0x29')]};});_0x558e90['model']=_[_0xf3a7('0x25')](_0x51379a,'name');_0x558e90[_0xf3a7('0x2a')]=_[_0xf3a7('0x2b')](_0x46665d[_0xf3a7('0x2a')]);_0x558e90[_0xf3a7('0x2c')]=_['intersection'](_0x558e90[_0xf3a7('0x2d')],_0x558e90['query']);_0xd3af4d[_0xf3a7('0x2e')]=_[_0xf3a7('0x2f')](_0x558e90[_0xf3a7('0x2d')],qs['fields'](_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x30')]));_0xd3af4d['attributes']=_0xd3af4d[_0xf3a7('0x2e')][_0xf3a7('0x31')]?_0xd3af4d[_0xf3a7('0x2e')]:_0x558e90[_0xf3a7('0x2d')];if(!_0x46665d['query'][_0xf3a7('0x32')](_0xf3a7('0x33'))){_0xd3af4d['limit']=qs[_0xf3a7('0x34')](_0x46665d['query']['limit']);_0xd3af4d[_0xf3a7('0x17')]=qs[_0xf3a7('0x17')](_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x17')]);}_0xd3af4d['order']=qs['sort'](_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x35')]);_0xd3af4d[_0xf3a7('0x36')]=qs[_0xf3a7('0x2c')](_[_0xf3a7('0x37')](_0x46665d[_0xf3a7('0x2a')],_0x558e90[_0xf3a7('0x2c')]),_0x51379a);if(_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x38')]){_0xd3af4d['where']=_[_0xf3a7('0x39')](_0xd3af4d[_0xf3a7('0x36')],{'$or':_['map'](_0x51379a,function(_0x36d086){if(_0x36d086[_0xf3a7('0x28')]!==_0xf3a7('0x3a')){var _0xa13c5c={};_0xa13c5c[_0x36d086[_0xf3a7('0x23')]]={'$like':'%'+_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x38')]+'%'};return _0xa13c5c;}})});}_0xd3af4d=_[_0xf3a7('0x39')]({},_0xd3af4d,_0x46665d[_0xf3a7('0x3b')]);var _0x63534d={'where':_0xd3af4d[_0xf3a7('0x36')]};return db[_0xf3a7('0x26')][_0xf3a7('0x19')](_0x63534d)[_0xf3a7('0x1e')](function(_0x2c7357){_0x21a035[_0xf3a7('0x19')]=_0x2c7357;if(_0x46665d[_0xf3a7('0x2a')][_0xf3a7('0x3c')]){_0xd3af4d[_0xf3a7('0x3d')]=[{'all':!![]}];}return db[_0xf3a7('0x26')][_0xf3a7('0x3e')](_0xd3af4d);})[_0xf3a7('0x1e')](function(_0x40d634){_0x21a035[_0xf3a7('0x3f')]=_0x40d634;return _0x21a035;})[_0xf3a7('0x1e')](respondWithFilteredResult(_0x23f09e,_0xd3af4d))[_0xf3a7('0x40')](handleError(_0x23f09e,null));};exports[_0xf3a7('0x41')]=function(_0x4c0a11,_0x4f5f0f){var _0x2cb34a={'raw':![],'where':{'id':_0x4c0a11[_0xf3a7('0x42')]['id']}},_0x49f0b0={};_0x49f0b0[_0xf3a7('0x2d')]=_[_0xf3a7('0x2b')](db[_0xf3a7('0x26')]['rawAttributes']);_0x49f0b0[_0xf3a7('0x2a')]=_[_0xf3a7('0x2b')](_0x4c0a11[_0xf3a7('0x2a')]);_0x49f0b0[_0xf3a7('0x2c')]=_[_0xf3a7('0x2f')](_0x49f0b0[_0xf3a7('0x2d')],_0x49f0b0[_0xf3a7('0x2a')]);_0x2cb34a['attributes']=_[_0xf3a7('0x2f')](_0x49f0b0[_0xf3a7('0x2d')],qs['fields'](_0x4c0a11[_0xf3a7('0x2a')][_0xf3a7('0x30')]));_0x2cb34a['attributes']=_0x2cb34a[_0xf3a7('0x2e')][_0xf3a7('0x31')]?_0x2cb34a[_0xf3a7('0x2e')]:_0x49f0b0['model'];if(_0x4c0a11[_0xf3a7('0x2a')][_0xf3a7('0x3c')]){_0x2cb34a[_0xf3a7('0x3d')]=[{'all':!![]}];}_0x2cb34a=_[_0xf3a7('0x39')]({},_0x2cb34a,_0x4c0a11['options']);return db[_0xf3a7('0x26')]['find'](_0x2cb34a)[_0xf3a7('0x1e')](handleEntityNotFound(_0x4f5f0f,null))['then'](respondWithResult(_0x4f5f0f,null))[_0xf3a7('0x40')](handleError(_0x4f5f0f,null));};exports['create']=function(_0x7f0201,_0x5a76d5){return db[_0xf3a7('0x26')][_0xf3a7('0x43')](_0x7f0201[_0xf3a7('0x44')],{})[_0xf3a7('0x1e')](function(_0x47bb4e){var _0x47718e=_0x7f0201[_0xf3a7('0x45')][_0xf3a7('0x20')]({'plain':!![]});if(!_0x47718e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47718e[_0xf3a7('0x46')]===_0xf3a7('0x45')){var _0x33d849=_0x47bb4e[_0xf3a7('0x20')]({'plain':!![]});var _0x834802=_0xf3a7('0x47');return db[_0xf3a7('0x48')][_0xf3a7('0x49')]({'where':{'name':_0x834802,'userProfileId':_0x47718e[_0xf3a7('0x4a')]},'raw':!![]})['then'](function(_0x4a11f0){if(_0x4a11f0&&_0x4a11f0[_0xf3a7('0x4b')]===0x0){return db[_0xf3a7('0x4c')][_0xf3a7('0x43')]({'name':_0x33d849[_0xf3a7('0x23')],'resourceId':_0x33d849['id'],'type':_0x4a11f0['name'],'sectionId':_0x4a11f0['id']},{})['then'](function(){return _0x47bb4e;});}else{return _0x47bb4e;}})[_0xf3a7('0x40')](function(_0x34cb0b){logger[_0xf3a7('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x34cb0b);throw _0x34cb0b;});}return _0x47bb4e;})['then'](respondWithResult(_0x5a76d5,0xc9))[_0xf3a7('0x40')](handleError(_0x5a76d5,null));};exports[_0xf3a7('0x1d')]=function(_0x39f2e4,_0x138501){if(_0x39f2e4[_0xf3a7('0x44')]['id']){delete _0x39f2e4[_0xf3a7('0x44')]['id'];}return db[_0xf3a7('0x26')][_0xf3a7('0x49')]({'where':{'id':_0x39f2e4['params']['id']}})['then'](handleEntityNotFound(_0x138501,null))[_0xf3a7('0x1e')](saveUpdates(_0x39f2e4[_0xf3a7('0x44')],null))[_0xf3a7('0x1e')](respondWithResult(_0x138501,null))[_0xf3a7('0x40')](handleError(_0x138501,null));};exports[_0xf3a7('0x1f')]=function(_0x11759a,_0x53e2cc){return db[_0xf3a7('0x26')][_0xf3a7('0x49')]({'where':{'id':_0x11759a[_0xf3a7('0x42')]['id']}})[_0xf3a7('0x1e')](handleEntityNotFound(_0x53e2cc,null))[_0xf3a7('0x1e')](removeEntity(_0x53e2cc,null))[_0xf3a7('0x40')](handleError(_0x53e2cc,null));};exports[_0xf3a7('0x4d')]=function(_0x55bcfb,_0x277719,_0x25007d){var _0x3cca64=require(_0xf3a7('0x4e'));return db[_0xf3a7('0x26')][_0xf3a7('0x49')]({'where':{'id':_0x55bcfb['params']['id']},'raw':!![]})[_0xf3a7('0x1e')](handleEntityNotFound(_0x277719,null))[_0xf3a7('0x1e')](function(){_0x3cca64[_0xf3a7('0x4d')](_0x55bcfb[_0xf3a7('0x42')]['id']);})['then'](respondWithStatusCode(_0x277719,null))['catch'](handleError(_0x277719,null));}; \ No newline at end of file +var _0x493a=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Schedule','rawAttributes','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','find','autoAssociation','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x5f1863,_0x12fa59){var _0x365402=function(_0x45abf7){while(--_0x45abf7){_0x5f1863['push'](_0x5f1863['shift']());}};_0x365402(++_0x12fa59);}(_0x493a,0x9b));var _0xa493=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x493a[_0xa5d9f9];return _0x40e9f6;};'use strict';var emlformat=require(_0xa493('0x0'));var rimraf=require(_0xa493('0x1'));var zipdir=require(_0xa493('0x2'));var jsonpatch=require(_0xa493('0x3'));var rp=require(_0xa493('0x4'));var moment=require(_0xa493('0x5'));var BPromise=require(_0xa493('0x6'));var Mustache=require('mustache');var util=require(_0xa493('0x7'));var path=require(_0xa493('0x8'));var sox=require('sox');var csv=require(_0xa493('0x9'));var ejs=require(_0xa493('0xa'));var fs=require('fs');var fs_extra=require(_0xa493('0xb'));var _=require(_0xa493('0xc'));var squel=require('squel');var crypto=require(_0xa493('0xd'));var jsforce=require(_0xa493('0xe'));var deskjs=require(_0xa493('0xf'));var toCsv=require(_0xa493('0x9'));var querystring=require(_0xa493('0x10'));var Papa=require(_0xa493('0x11'));var Redis=require(_0xa493('0x12'));var authService=require(_0xa493('0x13'));var qs=require(_0xa493('0x14'));var as=require(_0xa493('0x15'));var hardwareService=require(_0xa493('0x16'));var logger=require(_0xa493('0x17'))(_0xa493('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa493('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf76776,_0x2540ba){_0x2540ba=_0x2540ba||0xcc;return function(_0x9a5c67){if(_0x9a5c67){return _0xf76776['sendStatus'](_0x2540ba);}return _0xf76776['status'](_0x2540ba)[_0xa493('0x1a')]();};}function respondWithResult(_0x23933d,_0x22c40d){_0x22c40d=_0x22c40d||0xc8;return function(_0x1b87cd){if(_0x1b87cd){return _0x23933d[_0xa493('0x1b')](_0x22c40d)[_0xa493('0x1c')](_0x1b87cd);}};}function respondWithFilteredResult(_0x377918,_0x5ecb96){return function(_0x130728){if(_0x130728){var _0x3e0374=typeof _0x5ecb96['offset']===_0xa493('0x1d')&&typeof _0x5ecb96[_0xa493('0x1e')]===_0xa493('0x1d');var _0xff54c6=_0x130728[_0xa493('0x1f')];var _0x1de471=_0x3e0374?0x0:_0x5ecb96[_0xa493('0x20')];var _0x5233af=_0x3e0374?_0x130728['count']:_0x5ecb96[_0xa493('0x20')]+_0x5ecb96['limit'];var _0x5c462b;if(_0x5233af>=_0xff54c6){_0x5233af=_0xff54c6;_0x5c462b=0xc8;}else{_0x5c462b=0xce;}_0x377918[_0xa493('0x1b')](_0x5c462b);return _0x377918[_0xa493('0x21')](_0xa493('0x22'),_0x1de471+'-'+_0x5233af+'/'+_0xff54c6)[_0xa493('0x1c')](_0x130728);}return null;};}function patchUpdates(_0x5b53f0){return function(_0x16d234){try{jsonpatch[_0xa493('0x23')](_0x16d234,_0x5b53f0,!![]);}catch(_0x256d59){return BPromise['reject'](_0x256d59);}return _0x16d234[_0xa493('0x24')]();};}function saveUpdates(_0x1e3a59,_0x3bba97){return function(_0x2b941b){if(_0x2b941b){return _0x2b941b[_0xa493('0x25')](_0x1e3a59)[_0xa493('0x26')](function(_0x41b5f6){return _0x41b5f6;});}return null;};}function removeEntity(_0x19339a,_0x14ca8d){return function(_0x597ed0){if(_0x597ed0){return _0x597ed0[_0xa493('0x27')]()[_0xa493('0x26')](function(){var _0x374343=_0x597ed0[_0xa493('0x28')]({'plain':!![]});var _0x31233b='Scheduler';return db[_0xa493('0x29')]['destroy']({'where':{'type':_0x31233b,'resourceId':_0x374343['id']}})[_0xa493('0x26')](function(){return _0x597ed0;});})['then'](function(){_0x19339a[_0xa493('0x1b')](0xcc)[_0xa493('0x1a')]();});}};}function handleEntityNotFound(_0x4c2d26,_0xd4a230){return function(_0x168a2a){if(!_0x168a2a){_0x4c2d26['sendStatus'](0x194);}return _0x168a2a;};}function handleError(_0x20416e,_0x592322){_0x592322=_0x592322||0x1f4;return function(_0x400ab1){logger[_0xa493('0x2a')](_0x400ab1[_0xa493('0x2b')]);if(_0x400ab1[_0xa493('0x2c')]){delete _0x400ab1[_0xa493('0x2c')];}_0x20416e[_0xa493('0x1b')](_0x592322)[_0xa493('0x2d')](_0x400ab1);};}exports[_0xa493('0x2e')]=function(_0x52bf11,_0x525545){var _0x86aa5a={},_0x5c7985={},_0x486ef6={'count':0x0,'rows':[]};var _0x119fa1=_[_0xa493('0x2f')](db[_0xa493('0x30')][_0xa493('0x31')],function(_0x5c6fd3){return{'name':_0x5c6fd3['fieldName'],'type':_0x5c6fd3['type'][_0xa493('0x32')]};});_0x5c7985['model']=_[_0xa493('0x2f')](_0x119fa1,_0xa493('0x2c'));_0x5c7985[_0xa493('0x33')]=_['keys'](_0x52bf11['query']);_0x5c7985[_0xa493('0x34')]=_[_0xa493('0x35')](_0x5c7985[_0xa493('0x36')],_0x5c7985[_0xa493('0x33')]);_0x86aa5a[_0xa493('0x37')]=_[_0xa493('0x35')](_0x5c7985['model'],qs[_0xa493('0x38')](_0x52bf11[_0xa493('0x33')][_0xa493('0x38')]));_0x86aa5a[_0xa493('0x37')]=_0x86aa5a[_0xa493('0x37')]['length']?_0x86aa5a[_0xa493('0x37')]:_0x5c7985[_0xa493('0x36')];if(!_0x52bf11[_0xa493('0x33')][_0xa493('0x39')](_0xa493('0x3a'))){_0x86aa5a[_0xa493('0x1e')]=qs[_0xa493('0x1e')](_0x52bf11['query']['limit']);_0x86aa5a[_0xa493('0x20')]=qs[_0xa493('0x20')](_0x52bf11['query'][_0xa493('0x20')]);}_0x86aa5a[_0xa493('0x3b')]=qs['sort'](_0x52bf11[_0xa493('0x33')]['sort']);_0x86aa5a[_0xa493('0x3c')]=qs[_0xa493('0x34')](_[_0xa493('0x3d')](_0x52bf11['query'],_0x5c7985[_0xa493('0x34')]),_0x119fa1);if(_0x52bf11[_0xa493('0x33')][_0xa493('0x3e')]){_0x86aa5a['where']=_[_0xa493('0x3f')](_0x86aa5a[_0xa493('0x3c')],{'$or':_[_0xa493('0x2f')](_0x119fa1,function(_0x55d2a2){if(_0x55d2a2['type']!=='VIRTUAL'){var _0x1f647b={};_0x1f647b[_0x55d2a2[_0xa493('0x2c')]]={'$like':'%'+_0x52bf11[_0xa493('0x33')][_0xa493('0x3e')]+'%'};return _0x1f647b;}})});}_0x86aa5a=_['merge']({},_0x86aa5a,_0x52bf11[_0xa493('0x40')]);var _0x32913c={'where':_0x86aa5a[_0xa493('0x3c')]};return db[_0xa493('0x30')]['count'](_0x32913c)['then'](function(_0x289f47){_0x486ef6['count']=_0x289f47;if(_0x52bf11[_0xa493('0x33')][_0xa493('0x41')]){_0x86aa5a['include']=[{'all':!![]}];}return db[_0xa493('0x30')][_0xa493('0x42')](_0x86aa5a);})[_0xa493('0x26')](function(_0x231d35){_0x486ef6[_0xa493('0x43')]=_0x231d35;return _0x486ef6;})[_0xa493('0x26')](respondWithFilteredResult(_0x525545,_0x86aa5a))[_0xa493('0x44')](handleError(_0x525545,null));};exports[_0xa493('0x45')]=function(_0xa30061,_0x117b38){var _0x28a6f1={'raw':![],'where':{'id':_0xa30061[_0xa493('0x46')]['id']}},_0x4d672c={};_0x4d672c[_0xa493('0x36')]=_[_0xa493('0x47')](db[_0xa493('0x30')]['rawAttributes']);_0x4d672c[_0xa493('0x33')]=_[_0xa493('0x47')](_0xa30061['query']);_0x4d672c[_0xa493('0x34')]=_[_0xa493('0x35')](_0x4d672c['model'],_0x4d672c[_0xa493('0x33')]);_0x28a6f1['attributes']=_[_0xa493('0x35')](_0x4d672c['model'],qs[_0xa493('0x38')](_0xa30061[_0xa493('0x33')][_0xa493('0x38')]));_0x28a6f1[_0xa493('0x37')]=_0x28a6f1[_0xa493('0x37')]['length']?_0x28a6f1[_0xa493('0x37')]:_0x4d672c['model'];if(_0xa30061[_0xa493('0x33')]['includeAll']){_0x28a6f1['include']=[{'all':!![]}];}_0x28a6f1=_[_0xa493('0x3f')]({},_0x28a6f1,_0xa30061[_0xa493('0x40')]);return db[_0xa493('0x30')]['find'](_0x28a6f1)[_0xa493('0x26')](handleEntityNotFound(_0x117b38,null))['then'](respondWithResult(_0x117b38,null))[_0xa493('0x44')](handleError(_0x117b38,null));};exports[_0xa493('0x48')]=function(_0x53b73f,_0x3cd3b7){return db['Schedule'][_0xa493('0x48')](_0x53b73f[_0xa493('0x49')],{})[_0xa493('0x26')](function(_0x30c723){var _0x577a2a=_0x53b73f[_0xa493('0x4a')]['get']({'plain':!![]});if(!_0x577a2a)throw new Error(_0xa493('0x4b'));if(_0x577a2a[_0xa493('0x4c')]==='user'){var _0x2a9c31=_0x30c723[_0xa493('0x28')]({'plain':!![]});var _0xbe14fb=_0xa493('0x4d');return db[_0xa493('0x4e')][_0xa493('0x4f')]({'where':{'name':_0xbe14fb,'userProfileId':_0x577a2a['userProfileId']},'raw':!![]})['then'](function(_0xc3903){if(_0xc3903&&_0xc3903[_0xa493('0x50')]===0x0){return db[_0xa493('0x29')][_0xa493('0x48')]({'name':_0x2a9c31[_0xa493('0x2c')],'resourceId':_0x2a9c31['id'],'type':_0xc3903[_0xa493('0x2c')],'sectionId':_0xc3903['id']},{})['then'](function(){return _0x30c723;});}else{return _0x30c723;}})[_0xa493('0x44')](function(_0x3509e0){logger[_0xa493('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3509e0);throw _0x3509e0;});}return _0x30c723;})[_0xa493('0x26')](respondWithResult(_0x3cd3b7,0xc9))[_0xa493('0x44')](handleError(_0x3cd3b7,null));};exports[_0xa493('0x25')]=function(_0x1caebf,_0x29dc78){if(_0x1caebf[_0xa493('0x49')]['id']){delete _0x1caebf['body']['id'];}return db[_0xa493('0x30')][_0xa493('0x4f')]({'where':{'id':_0x1caebf[_0xa493('0x46')]['id']}})[_0xa493('0x26')](handleEntityNotFound(_0x29dc78,null))[_0xa493('0x26')](saveUpdates(_0x1caebf[_0xa493('0x49')],null))['then'](respondWithResult(_0x29dc78,null))[_0xa493('0x44')](handleError(_0x29dc78,null));};exports[_0xa493('0x27')]=function(_0x5864cc,_0x1c1faf){return db[_0xa493('0x30')]['find']({'where':{'id':_0x5864cc[_0xa493('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c1faf,null))[_0xa493('0x26')](removeEntity(_0x1c1faf,null))['catch'](handleError(_0x1c1faf,null));};exports[_0xa493('0x51')]=function(_0x26c862,_0x469edd,_0x1b2e53){var _0x291b2f=require(_0xa493('0x52'));return db[_0xa493('0x30')][_0xa493('0x4f')]({'where':{'id':_0x26c862['params']['id']},'raw':!![]})[_0xa493('0x26')](handleEntityNotFound(_0x469edd,null))[_0xa493('0x26')](function(){_0x291b2f[_0xa493('0x51')](_0x26c862[_0xa493('0x46')]['id']);})[_0xa493('0x26')](respondWithStatusCode(_0x469edd,null))[_0xa493('0x44')](handleError(_0x469edd,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index d32ec36..0ba7d7e 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 _0x6184=['util','../../config/logger','bluebird','path','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x37b55a,_0x5cbe44){var _0x16c813=function(_0x420fe8){while(--_0x420fe8){_0x37b55a['push'](_0x37b55a['shift']());}};_0x16c813(++_0x5cbe44);}(_0x6184,0x1ef));var _0x4618=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x6184[_0x2ce6d5];return _0x32d272;};'use strict';var _=require('lodash');var util=require(_0x4618('0x0'));var logger=require(_0x4618('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4618('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4618('0x3'));var rimraf=require('rimraf');var config=require(_0x4618('0x4'));var attributes=require(_0x4618('0x5'));module['exports']=function(_0x320fb8,_0x132bab){return _0x320fb8[_0x4618('0x6')](_0x4618('0x7'),attributes,{'tableName':_0x4618('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb957=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','Schedule','tools_schedules','lodash'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xb957,0xc5));var _0x7b95=function(_0x45df6c,_0x1df8db){_0x45df6c=_0x45df6c-0x0;var _0x3f60b3=_0xb957[_0x45df6c];return _0x3f60b3;};'use strict';var _=require(_0x7b95('0x0'));var util=require('util');var logger=require(_0x7b95('0x1'))(_0x7b95('0x2'));var moment=require(_0x7b95('0x3'));var BPromise=require(_0x7b95('0x4'));var rp=require(_0x7b95('0x5'));var fs=require('fs');var path=require(_0x7b95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x7b95('0x7')]=function(_0x982f67,_0x58fd80){return _0x982f67[_0x7b95('0x8')](_0x7b95('0x9'),attributes,{'tableName':_0x7b95('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 4e618df..06b2d54 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 _0x9db5=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x9db5,0x113));var _0x59db=function(_0x49d355,_0x255c6e){_0x49d355=_0x49d355-0x0;var _0x5dadc9=_0x9db5[_0x49d355];return _0x5dadc9;};'use strict';var _=require(_0x59db('0x0'));var util=require(_0x59db('0x1'));var moment=require(_0x59db('0x2'));var BPromise=require(_0x59db('0x3'));var rs=require(_0x59db('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59db('0x5'))['db'];var utils=require(_0x59db('0x6'));var logger=require(_0x59db('0x7'))(_0x59db('0x8'));var config=require(_0x59db('0x9'));var jayson=require(_0x59db('0xa'));var client=jayson['client'][_0x59db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x907fd9,_0x37df85,_0xaf5921){return new BPromise(function(_0x16a0b7,_0x2a0858){return client[_0x59db('0xc')](_0x907fd9,_0xaf5921)['then'](function(_0x4dea8f){logger['info'](_0x59db('0xd'),_0x37df85,_0x59db('0xe'));logger['debug'](_0x59db('0xf'),_0x37df85,_0x59db('0xe'),JSON[_0x59db('0x10')](_0x4dea8f));if(_0x4dea8f[_0x59db('0x11')]){if(_0x4dea8f[_0x59db('0x11')][_0x59db('0x12')]===0x1f4){logger[_0x59db('0x11')](_0x59db('0xd'),_0x37df85,_0x4dea8f['error'][_0x59db('0x13')]);return _0x2a0858(_0x4dea8f['error'][_0x59db('0x13')]);}logger[_0x59db('0x11')](_0x59db('0xd'),_0x37df85,_0x4dea8f[_0x59db('0x11')][_0x59db('0x13')]);return _0x16a0b7(_0x4dea8f['error']['message']);}else{logger[_0x59db('0x14')]('Schedule,\x20%s,\x20%s',_0x37df85,_0x59db('0xe'));_0x16a0b7(_0x4dea8f[_0x59db('0x15')]['message']);}})[_0x59db('0x16')](function(_0x2ec700){logger['error'](_0x59db('0xd'),_0x37df85,_0x2ec700);_0x2a0858(_0x2ec700);});});} \ No newline at end of file +var _0xa9d8=['jayson/promise','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x51eb91,_0x4799d5){var _0x1c4fc4=function(_0x1fd807){while(--_0x1fd807){_0x51eb91['push'](_0x51eb91['shift']());}};_0x1c4fc4(++_0x4799d5);}(_0xa9d8,0x174));var _0x8a9d=function(_0x4487b2,_0x432f6b){_0x4487b2=_0x4487b2-0x0;var _0x5b33a1=_0xa9d8[_0x4487b2];return _0x5b33a1;};'use strict';var _=require(_0x8a9d('0x0'));var util=require(_0x8a9d('0x1'));var moment=require('moment');var BPromise=require(_0x8a9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a9d('0x3'));var db=require(_0x8a9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a9d('0x5'))(_0x8a9d('0x6'));var config=require(_0x8a9d('0x7'));var jayson=require(_0x8a9d('0x8'));var client=jayson[_0x8a9d('0x9')][_0x8a9d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29cd5d,_0xcc84cd,_0x3573ac){return new BPromise(function(_0x1e5ced,_0xbb0a6f){return client['request'](_0x29cd5d,_0x3573ac)[_0x8a9d('0xb')](function(_0x320582){logger[_0x8a9d('0xc')](_0x8a9d('0xd'),_0xcc84cd,_0x8a9d('0xe'));logger['debug'](_0x8a9d('0xf'),_0xcc84cd,_0x8a9d('0xe'),JSON['stringify'](_0x320582));if(_0x320582['error']){if(_0x320582[_0x8a9d('0x10')][_0x8a9d('0x11')]===0x1f4){logger[_0x8a9d('0x10')](_0x8a9d('0xd'),_0xcc84cd,_0x320582['error']['message']);return _0xbb0a6f(_0x320582['error'][_0x8a9d('0x12')]);}logger[_0x8a9d('0x10')](_0x8a9d('0xd'),_0xcc84cd,_0x320582[_0x8a9d('0x10')]['message']);return _0x1e5ced(_0x320582['error'][_0x8a9d('0x12')]);}else{logger[_0x8a9d('0xc')](_0x8a9d('0xd'),_0xcc84cd,_0x8a9d('0xe'));_0x1e5ced(_0x320582['result'][_0x8a9d('0x12')]);}})['catch'](function(_0x4bb264){logger[_0x8a9d('0x10')]('Schedule,\x20%s,\x20%s',_0xcc84cd,_0x4bb264);_0xbb0a6f(_0x4bb264);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f6f3d54..1833906 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 _0x8cdc=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','get','/describe','describe','/:id/download','download','post','create'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x8cdc,0x1d2));var _0xc8cd=function(_0x321231,_0x2fdc78){_0x321231=_0x321231-0x0;var _0x313c26=_0x8cdc[_0x321231];return _0x313c26;};'use strict';var multer=require(_0xc8cd('0x0'));var util=require(_0xc8cd('0x1'));var path=require(_0xc8cd('0x2'));var timeout=require(_0xc8cd('0x3'));var express=require(_0xc8cd('0x4'));var router=express[_0xc8cd('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc8cd('0x6'));var config=require(_0xc8cd('0x7'));var controller=require(_0xc8cd('0x8'));router['get']('/',auth[_0xc8cd('0x9')](),controller['index']);router[_0xc8cd('0xa')](_0xc8cd('0xb'),auth[_0xc8cd('0x9')](),controller[_0xc8cd('0xc')]);router['get']('/:id',auth[_0xc8cd('0x9')](),controller['show']);router[_0xc8cd('0xa')](_0xc8cd('0xd'),auth[_0xc8cd('0x9')](),controller[_0xc8cd('0xe')]);router[_0xc8cd('0xf')]('/',auth[_0xc8cd('0x9')](),controller[_0xc8cd('0x10')]);router[_0xc8cd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc8cd('0x12')]);router[_0xc8cd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc8cd('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc918=['describe','/:id','show','/:id/download','download','put','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x3d398b,_0x542808){var _0xaf8fd4=function(_0x112ac6){while(--_0x112ac6){_0x3d398b['push'](_0x3d398b['shift']());}};_0xaf8fd4(++_0x542808);}(_0xc918,0x14b));var _0x8c91=function(_0x38e0e6,_0x4fb62b){_0x38e0e6=_0x38e0e6-0x0;var _0x52d426=_0xc918[_0x38e0e6];return _0x52d426;};'use strict';var multer=require(_0x8c91('0x0'));var util=require(_0x8c91('0x1'));var path=require(_0x8c91('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c91('0x3'));var router=express[_0x8c91('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c91('0x5'));var interaction=require(_0x8c91('0x6'));var config=require(_0x8c91('0x7'));var controller=require('./screenRecording.controller');router[_0x8c91('0x8')]('/',auth[_0x8c91('0x9')](),controller['index']);router['get'](_0x8c91('0xa'),auth['isAuthenticated'](),controller[_0x8c91('0xb')]);router[_0x8c91('0x8')](_0x8c91('0xc'),auth[_0x8c91('0x9')](),controller[_0x8c91('0xd')]);router['get'](_0x8c91('0xe'),auth[_0x8c91('0x9')](),controller[_0x8c91('0xf')]);router['post']('/',auth[_0x8c91('0x9')](),controller['create']);router[_0x8c91('0x10')](_0x8c91('0xc'),auth[_0x8c91('0x9')](),controller['update']);router['delete'](_0x8c91('0xc'),auth[_0x8c91('0x9')](),controller[_0x8c91('0x11')]);module[_0x8c91('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 2214e86..da577a2 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 _0x9b0d=['extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','startedAt','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','moment','path','../../config/environment','exports','getDataValue','value'];(function(_0x9fa457,_0x70196){var _0xacc08d=function(_0x252c4f){while(--_0x252c4f){_0x9fa457['push'](_0x9fa457['shift']());}};_0xacc08d(++_0x70196);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x474aa9,_0x4cac07){_0x474aa9=_0x474aa9-0x0;var _0x4cb82b=_0x9b0d[_0x474aa9];return _0x4cb82b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var config=require(_0xd9b0('0x2'));module[_0xd9b0('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd9b0('0x4')](_0xd9b0('0x5'))?path[_0xd9b0('0x6')](this[_0xd9b0('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xd9b0('0x7')]},'channel':{'type':Sequelize[_0xd9b0('0x7')]},'value':{'type':Sequelize[_0xd9b0('0x7')],'set':function(_0x31c012){var _0x58bd64=_0x31c012[_0xd9b0('0x8')](/\\/g,'/');this[_0xd9b0('0x9')]('value',_0x58bd64);}},'rating':{'type':Sequelize[_0xd9b0('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xd9b0('0xa')],'set':function(_0x48181a){this[_0xd9b0('0x9')]('startedAt',moment()[_0xd9b0('0xb')](_0x48181a,'ms'));this['setDataValue'](_0xd9b0('0xc'),moment());this[_0xd9b0('0x9')](_0xd9b0('0xd'),_0x48181a);}},'startedAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0xf')))['format'](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0xc')))[_0xd9b0('0x12')](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'createdAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this['getDataValue'](_0xd9b0('0x13')))['format'](_0xd9b0('0x10'))[_0xd9b0('0x11')]();}},'updatedAt':{'type':Sequelize[_0xd9b0('0xe')],'get':function(){return moment(this[_0xd9b0('0x4')](_0xd9b0('0x14')))[_0xd9b0('0x12')](_0xd9b0('0x10'))['toString']();}}}; \ No newline at end of file +var _0xf08c=['replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x1d20e5,_0x3d4f74){var _0x14c8d3=function(_0x368a35){while(--_0x368a35){_0x1d20e5['push'](_0x1d20e5['shift']());}};_0x14c8d3(++_0x3d4f74);}(_0xf08c,0xb5));var _0xcf08=function(_0x4a0131,_0x53c22a){_0x4a0131=_0x4a0131-0x0;var _0x1104ab=_0xf08c[_0x4a0131];return _0x1104ab;};'use strict';var Sequelize=require(_0xcf08('0x0'));var moment=require(_0xcf08('0x1'));var path=require(_0xcf08('0x2'));var config=require('../../config/environment');module[_0xcf08('0x3')]={'format':{'type':Sequelize[_0xcf08('0x4')],'get':function(){return this[_0xcf08('0x5')](_0xcf08('0x6'))?path['extname'](this['getDataValue'](_0xcf08('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xcf08('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xcf08('0x7')],'set':function(_0x37efab){var _0x13b89c=_0x37efab[_0xcf08('0x8')](/\\/g,'/');this['setDataValue']('value',_0x13b89c);}},'rating':{'type':Sequelize[_0xcf08('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1ab45d){this[_0xcf08('0xa')](_0xcf08('0xb'),moment()[_0xcf08('0xc')](_0x1ab45d,'ms'));this['setDataValue'](_0xcf08('0xd'),moment());this[_0xcf08('0xa')](_0xcf08('0xe'),_0x1ab45d);}},'startedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this[_0xcf08('0x5')](_0xcf08('0xb')))[_0xcf08('0x10')](_0xcf08('0x11'))[_0xcf08('0x12')]();}},'closedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this[_0xcf08('0x5')]('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0xcf08('0x12')]();}},'createdAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this['getDataValue'](_0xcf08('0x13')))[_0xcf08('0x10')](_0xcf08('0x11'))[_0xcf08('0x12')]();}},'updatedAt':{'type':Sequelize[_0xcf08('0xf')],'get':function(){return moment(this['getDataValue'](_0xcf08('0x14')))['format']('MM-DD-YYYY\x20HH:mm')[_0xcf08('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 852be01..cc4161e 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 _0xdbf5=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','keys','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5100ed,_0x538636){_0x5100ed=_0x5100ed-0x0;var _0xc6dc78=_0xdbf5[_0x5100ed];return _0xc6dc78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5dbf('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5dbf('0x1'));var moment=require(_0x5dbf('0x2'));var BPromise=require(_0x5dbf('0x3'));var Mustache=require(_0x5dbf('0x4'));var util=require(_0x5dbf('0x5'));var path=require(_0x5dbf('0x6'));var sox=require(_0x5dbf('0x7'));var csv=require(_0x5dbf('0x8'));var ejs=require(_0x5dbf('0x9'));var fs=require('fs');var fs_extra=require(_0x5dbf('0xa'));var _=require(_0x5dbf('0xb'));var squel=require(_0x5dbf('0xc'));var crypto=require(_0x5dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5dbf('0xf'));var Papa=require(_0x5dbf('0x10'));var Redis=require(_0x5dbf('0x11'));var authService=require(_0x5dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5dbf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5dbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5dbf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x182cec,_0x2bb7ed){_0x2bb7ed=_0x2bb7ed||0xcc;return function(_0x1453a9){if(_0x1453a9){return _0x182cec[_0x5dbf('0x16')](_0x2bb7ed);}return _0x182cec[_0x5dbf('0x17')](_0x2bb7ed)['end']();};}function respondWithResult(_0x4803ca,_0x2b4e1c){_0x2b4e1c=_0x2b4e1c||0xc8;return function(_0x3480c8){if(_0x3480c8){return _0x4803ca['status'](_0x2b4e1c)[_0x5dbf('0x18')](_0x3480c8);}};}function respondWithFilteredResult(_0x248e3c,_0x23f763){return function(_0x2dfa44){if(_0x2dfa44){var _0x181816=typeof _0x23f763[_0x5dbf('0x19')]===_0x5dbf('0x1a')&&typeof _0x23f763['limit']==='undefined';var _0x16dc82=_0x2dfa44[_0x5dbf('0x1b')];var _0x39c7aa=_0x181816?0x0:_0x23f763[_0x5dbf('0x19')];var _0x20c2b0=_0x181816?_0x2dfa44['count']:_0x23f763[_0x5dbf('0x19')]+_0x23f763['limit'];var _0x565efa;if(_0x20c2b0>=_0x16dc82){_0x20c2b0=_0x16dc82;_0x565efa=0xc8;}else{_0x565efa=0xce;}_0x248e3c['status'](_0x565efa);return _0x248e3c[_0x5dbf('0x1c')](_0x5dbf('0x1d'),_0x39c7aa+'-'+_0x20c2b0+'/'+_0x16dc82)[_0x5dbf('0x18')](_0x2dfa44);}return null;};}function patchUpdates(_0x2ab57c){return function(_0x1e3cce){try{jsonpatch['apply'](_0x1e3cce,_0x2ab57c,!![]);}catch(_0x2764ea){return BPromise['reject'](_0x2764ea);}return _0x1e3cce[_0x5dbf('0x1e')]();};}function saveUpdates(_0x11cc67,_0x14d133){return function(_0x43a612){if(_0x43a612){return _0x43a612[_0x5dbf('0x1f')](_0x11cc67)[_0x5dbf('0x20')](function(_0x58085e){return _0x58085e;});}return null;};}function removeEntity(_0x4027c3,_0x3e3a2d){return function(_0x2d3e1b){if(_0x2d3e1b){return _0x2d3e1b[_0x5dbf('0x21')]()[_0x5dbf('0x20')](function(){_0x4027c3[_0x5dbf('0x17')](0xcc)[_0x5dbf('0x22')]();});}};}function handleEntityNotFound(_0x20ab1b,_0x42f13b){return function(_0x15a790){if(!_0x15a790){_0x20ab1b[_0x5dbf('0x16')](0x194);}return _0x15a790;};}function handleError(_0x232c77,_0x3f9e60){_0x3f9e60=_0x3f9e60||0x1f4;return function(_0x407741){logger[_0x5dbf('0x23')](_0x407741[_0x5dbf('0x24')]);if(_0x407741[_0x5dbf('0x25')]){delete _0x407741[_0x5dbf('0x25')];}_0x232c77[_0x5dbf('0x17')](_0x3f9e60)[_0x5dbf('0x26')](_0x407741);};}exports[_0x5dbf('0x27')]=function(_0x471027,_0x21cd00){var _0x5768b7={},_0x2f71eb={},_0x24dc99={'count':0x0,'rows':[]};var _0xc4748=_[_0x5dbf('0x28')](db[_0x5dbf('0x29')][_0x5dbf('0x2a')],function(_0x2a65c5){return{'name':_0x2a65c5[_0x5dbf('0x2b')],'type':_0x2a65c5[_0x5dbf('0x2c')][_0x5dbf('0x2d')]};});_0x2f71eb[_0x5dbf('0x2e')]=_['differenceBy'](_['map'](_0xc4748,_0x5dbf('0x25')),[_0x5dbf('0x2f')]);_0x2f71eb[_0x5dbf('0x30')]=_[_0x5dbf('0x31')](_0x471027[_0x5dbf('0x30')]);_0x2f71eb['filters']=_['intersection'](_0x2f71eb[_0x5dbf('0x2e')],_0x2f71eb[_0x5dbf('0x30')]);_0x5768b7['attributes']=_[_0x5dbf('0x32')](_0x2f71eb[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x5768b7['attributes']=_0x5768b7[_0x5dbf('0x34')][_0x5dbf('0x35')]?_0x5768b7[_0x5dbf('0x34')]:_0x2f71eb[_0x5dbf('0x2e')];if(!_0x471027[_0x5dbf('0x30')]['hasOwnProperty'](_0x5dbf('0x36'))){_0x5768b7[_0x5dbf('0x37')]=qs[_0x5dbf('0x37')](_0x471027[_0x5dbf('0x30')]['limit']);_0x5768b7[_0x5dbf('0x19')]=qs[_0x5dbf('0x19')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x19')]);}_0x5768b7[_0x5dbf('0x38')]=qs[_0x5dbf('0x39')](_0x471027[_0x5dbf('0x30')][_0x5dbf('0x39')]);_0x5768b7[_0x5dbf('0x3a')]=qs[_0x5dbf('0x3b')](_[_0x5dbf('0x3c')](_0x471027['query'],_0x2f71eb[_0x5dbf('0x3b')]),_0xc4748);if(_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]){_0x5768b7['where']=_[_0x5dbf('0x3e')](_0x5768b7[_0x5dbf('0x3a')],{'$or':_[_0x5dbf('0x28')](_0xc4748,function(_0x5b3738){if(_0x5b3738[_0x5dbf('0x2c')]!==_0x5dbf('0x3f')){var _0x9bd4c0={};_0x9bd4c0[_0x5b3738['name']]={'$like':'%'+_0x471027[_0x5dbf('0x30')][_0x5dbf('0x3d')]+'%'};return _0x9bd4c0;}})});}_0x5768b7=_[_0x5dbf('0x3e')]({},_0x5768b7,_0x471027[_0x5dbf('0x40')]);var _0x10537d={'where':_0x5768b7[_0x5dbf('0x3a')]};return db[_0x5dbf('0x29')][_0x5dbf('0x1b')](_0x10537d)['then'](function(_0x5be96b){_0x24dc99['count']=_0x5be96b;if(_0x471027['query'][_0x5dbf('0x41')]){_0x5768b7[_0x5dbf('0x42')]=[{'all':!![]}];}return db['ScreenRecording'][_0x5dbf('0x43')](_0x5768b7);})[_0x5dbf('0x20')](function(_0x5a60e8){_0x24dc99[_0x5dbf('0x44')]=_0x5a60e8;return _0x24dc99;})[_0x5dbf('0x20')](respondWithFilteredResult(_0x21cd00,_0x5768b7))[_0x5dbf('0x45')](handleError(_0x21cd00,null));};exports[_0x5dbf('0x46')]=function(_0x21ae10,_0x7c390d){var _0x2745df={'raw':![],'where':{'id':_0x21ae10[_0x5dbf('0x47')]['id']}},_0x1c020a={};_0x1c020a[_0x5dbf('0x2e')]=_['keys'](db[_0x5dbf('0x29')][_0x5dbf('0x2a')]);_0x1c020a[_0x5dbf('0x30')]=_['keys'](_0x21ae10[_0x5dbf('0x30')]);_0x1c020a[_0x5dbf('0x3b')]=_[_0x5dbf('0x32')](_0x1c020a[_0x5dbf('0x2e')],_0x1c020a['query']);_0x2745df[_0x5dbf('0x34')]=_['intersection'](_0x1c020a[_0x5dbf('0x2e')],qs[_0x5dbf('0x33')](_0x21ae10[_0x5dbf('0x30')][_0x5dbf('0x33')]));_0x2745df['attributes']=_0x2745df['attributes'][_0x5dbf('0x35')]?_0x2745df[_0x5dbf('0x34')]:_0x1c020a[_0x5dbf('0x2e')];if(_0x21ae10['query'][_0x5dbf('0x41')]){_0x2745df['include']=[{'all':!![]}];}_0x2745df=_['merge']({},_0x2745df,_0x21ae10['options']);return db['ScreenRecording'][_0x5dbf('0x48')](_0x2745df)[_0x5dbf('0x20')](handleEntityNotFound(_0x7c390d,null))['then'](respondWithResult(_0x7c390d,null))[_0x5dbf('0x45')](handleError(_0x7c390d,null));};exports[_0x5dbf('0x49')]=function(_0x4b6f30,_0x366102){return db[_0x5dbf('0x29')]['create'](_0x4b6f30[_0x5dbf('0x4a')],{})['then'](respondWithResult(_0x366102,0xc9))['catch'](handleError(_0x366102,null));};exports[_0x5dbf('0x1f')]=function(_0x2a3d30,_0x17a1c0){if(_0x2a3d30['body']['id']){delete _0x2a3d30['body']['id'];}delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4b')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4c')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4d')];delete _0x2a3d30[_0x5dbf('0x4a')][_0x5dbf('0x4e')];return db['ScreenRecording'][_0x5dbf('0x48')]({'where':{'id':_0x2a3d30[_0x5dbf('0x47')]['id']}})[_0x5dbf('0x20')](handleEntityNotFound(_0x17a1c0,null))[_0x5dbf('0x20')](saveUpdates(_0x2a3d30[_0x5dbf('0x4a')],null))[_0x5dbf('0x20')](respondWithResult(_0x17a1c0,null))[_0x5dbf('0x45')](handleError(_0x17a1c0,null));};exports['describe']=function(_0x1b0b13,_0x54f401){return db[_0x5dbf('0x29')][_0x5dbf('0x4f')]()[_0x5dbf('0x20')](respondWithResult(_0x54f401,null))[_0x5dbf('0x45')](handleError(_0x54f401,null));};exports[_0x5dbf('0x50')]=function(_0x1f165d,_0x353d0f,_0x48403a){var _0x5c3c0d=require('../../components/encryptor');var _0x1e1876=![];var _0xfdacc7={};if(_0x1f165d[_0x5dbf('0x30')]['type']&&_0x1f165d['query'][_0x5dbf('0x2c')]===_0x5dbf('0x51')){_0xfdacc7[_0x5dbf('0x51')]=_0x1f165d['params']['id'];}else{_0xfdacc7['id']=_0x1f165d[_0x5dbf('0x47')]['id'];}return db['ScreenRecording'][_0x5dbf('0x48')]({'where':_0xfdacc7,'attributes':['id',_0x5dbf('0x4e')],'raw':!![]})[_0x5dbf('0x20')](handleEntityNotFound(_0x353d0f,null))['then'](function(_0x55fd51){if(_0x55fd51){var _0x1b316d=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x55fd51['value']);var _0xfcc43c=util[_0x5dbf('0x2f')]('%s.cypher',_0x1b316d);if(fs['existsSync'](_0xfcc43c)){_0x1e1876=!![];return _0x5c3c0d[_0x5dbf('0x55')](_0xfcc43c,_0x1b316d,config[_0x5dbf('0x56')][_0x5dbf('0x57')])[_0x5dbf('0x20')](function(){return _0x55fd51;});}return _0x55fd51;}})[_0x5dbf('0x20')](function(_0x4711d5){if(_0x4711d5){var _0x50a029=path[_0x5dbf('0x52')](config['root'],'server/files/screen_recordings',_0x4711d5['value']);if(!fs[_0x5dbf('0x58')](_0x50a029)){throw new db['Sequelize'][(_0x5dbf('0x59'))](_0x5dbf('0x5a'));}if(_0x4711d5[_0x5dbf('0x5b')]){return _0x353d0f[_0x5dbf('0x50')](_0x50a029,_0x4711d5[_0x5dbf('0x5b')]+path[_0x5dbf('0x5c')](_0x50a029),function(){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}else{return _0x353d0f[_0x5dbf('0x50')](_0x50a029,function(_0x2c84d6){if(_0x1e1876){fs[_0x5dbf('0x5d')](_0x50a029);}});}}})[_0x5dbf('0x45')](function(_0x2ca889){if(_0x2ca889[_0x5dbf('0x5e')]===_0x5dbf('0x5a')){_0x353d0f[_0x5dbf('0x17')](0x194)['send'](_0x5dbf('0x5f'));}else{return handleError(_0x353d0f,null);}});};exports['destroy']=function(_0xb0a9bf,_0xfc5817){return db[_0x5dbf('0x29')][_0x5dbf('0x48')]({'where':{'id':_0xb0a9bf['params']['id']}})[_0x5dbf('0x20')](function(_0x1ade34){if(_[_0x5dbf('0x60')](_0x1ade34)){throw new ReferenceError(_0x5dbf('0x61'));}return _0x1ade34;})[_0x5dbf('0x20')](function(_0x40982f){var _0x52efd7=path[_0x5dbf('0x52')](config[_0x5dbf('0x53')],_0x5dbf('0x54'),_0x40982f[_0x5dbf('0x4e')]);logger[_0x5dbf('0x62')](_0x5dbf('0x63'),_0x52efd7);if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs['unlinkSync'](_0x52efd7);}_0x52efd7=_0x52efd7+'.cypher';if(!_[_0x5dbf('0x60')](_0x40982f[_0x5dbf('0x4e')])&&fs[_0x5dbf('0x58')](_0x52efd7)){logger[_0x5dbf('0x62')](_0x5dbf('0x64')+_0x52efd7+_0x5dbf('0x65'));fs[_0x5dbf('0x66')](_0x52efd7);}return _0x40982f;})[_0x5dbf('0x20')](function(_0x3a4001){if(!_0x3a4001)throw new InternalError();return _0x3a4001['destroy']();})['then'](function(){_0xfc5817['status'](0xcc)['end']();})[_0x5dbf('0x45')](handleError(_0xfc5817,null));}; \ No newline at end of file +var _0xb458=['differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','ScreenRecording','includeAll','rows','catch','show','params','include','create','body','createdAt','closedAt','find','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x4310f8,_0x28fe3a){var _0x49cbed=function(_0x34b2e3){while(--_0x34b2e3){_0x4310f8['push'](_0x4310f8['shift']());}};_0x49cbed(++_0x28fe3a);}(_0xb458,0x103));var _0x8b45=function(_0x376830,_0x1adaca){_0x376830=_0x376830-0x0;var _0x51ead4=_0xb458[_0x376830];return _0x51ead4;};'use strict';var emlformat=require(_0x8b45('0x0'));var rimraf=require(_0x8b45('0x1'));var zipdir=require(_0x8b45('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8b45('0x3'));var BPromise=require(_0x8b45('0x4'));var Mustache=require(_0x8b45('0x5'));var util=require(_0x8b45('0x6'));var path=require('path');var sox=require(_0x8b45('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b45('0x8'));var _=require(_0x8b45('0x9'));var squel=require(_0x8b45('0xa'));var crypto=require(_0x8b45('0xb'));var jsforce=require(_0x8b45('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8b45('0xd'));var querystring=require(_0x8b45('0xe'));var Papa=require(_0x8b45('0xf'));var Redis=require(_0x8b45('0x10'));var authService=require(_0x8b45('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8b45('0x12'));var hardwareService=require(_0x8b45('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b45('0x14'));var db=require(_0x8b45('0x15'))['db'];function respondWithStatusCode(_0x37c220,_0x52c4db){_0x52c4db=_0x52c4db||0xcc;return function(_0x30d38c){if(_0x30d38c){return _0x37c220[_0x8b45('0x16')](_0x52c4db);}return _0x37c220[_0x8b45('0x17')](_0x52c4db)[_0x8b45('0x18')]();};}function respondWithResult(_0x32babc,_0x2ad2ae){_0x2ad2ae=_0x2ad2ae||0xc8;return function(_0x5f0b20){if(_0x5f0b20){return _0x32babc['status'](_0x2ad2ae)[_0x8b45('0x19')](_0x5f0b20);}};}function respondWithFilteredResult(_0x23f1dd,_0x445170){return function(_0x39c1d1){if(_0x39c1d1){var _0x4781d7=typeof _0x445170[_0x8b45('0x1a')]===_0x8b45('0x1b')&&typeof _0x445170[_0x8b45('0x1c')]===_0x8b45('0x1b');var _0x391d1e=_0x39c1d1[_0x8b45('0x1d')];var _0x21d5b2=_0x4781d7?0x0:_0x445170[_0x8b45('0x1a')];var _0x43ffb7=_0x4781d7?_0x39c1d1[_0x8b45('0x1d')]:_0x445170[_0x8b45('0x1a')]+_0x445170[_0x8b45('0x1c')];var _0x309e23;if(_0x43ffb7>=_0x391d1e){_0x43ffb7=_0x391d1e;_0x309e23=0xc8;}else{_0x309e23=0xce;}_0x23f1dd['status'](_0x309e23);return _0x23f1dd[_0x8b45('0x1e')](_0x8b45('0x1f'),_0x21d5b2+'-'+_0x43ffb7+'/'+_0x391d1e)[_0x8b45('0x19')](_0x39c1d1);}return null;};}function patchUpdates(_0x46e21a){return function(_0x3e1438){try{jsonpatch[_0x8b45('0x20')](_0x3e1438,_0x46e21a,!![]);}catch(_0x2f4f1c){return BPromise[_0x8b45('0x21')](_0x2f4f1c);}return _0x3e1438['save']();};}function saveUpdates(_0x52f93f,_0x41154a){return function(_0x580e17){if(_0x580e17){return _0x580e17[_0x8b45('0x22')](_0x52f93f)[_0x8b45('0x23')](function(_0x30f405){return _0x30f405;});}return null;};}function removeEntity(_0x45e2db,_0x165570){return function(_0x2b8526){if(_0x2b8526){return _0x2b8526[_0x8b45('0x24')]()['then'](function(){_0x45e2db['status'](0xcc)[_0x8b45('0x18')]();});}};}function handleEntityNotFound(_0x2c2c06,_0x500044){return function(_0x5723a2){if(!_0x5723a2){_0x2c2c06[_0x8b45('0x16')](0x194);}return _0x5723a2;};}function handleError(_0x32f6f0,_0x2ca2d9){_0x2ca2d9=_0x2ca2d9||0x1f4;return function(_0x2f37bc){logger['error'](_0x2f37bc[_0x8b45('0x25')]);if(_0x2f37bc[_0x8b45('0x26')]){delete _0x2f37bc[_0x8b45('0x26')];}_0x32f6f0[_0x8b45('0x17')](_0x2ca2d9)[_0x8b45('0x27')](_0x2f37bc);};}exports[_0x8b45('0x28')]=function(_0x461017,_0x234f62){var _0x1733a7={},_0xf21bd1={},_0x339c73={'count':0x0,'rows':[]};var _0x1ba2d4=_[_0x8b45('0x29')](db['ScreenRecording'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x2f')](_[_0x8b45('0x29')](_0x1ba2d4,'name'),[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x461017[_0x8b45('0x31')]);_0xf21bd1[_0x8b45('0x33')]=_['intersection'](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7['attributes']=_[_0x8b45('0x34')](_0xf21bd1[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x461017[_0x8b45('0x31')][_0x8b45('0x35')]));_0x1733a7[_0x8b45('0x36')]=_0x1733a7['attributes'][_0x8b45('0x37')]?_0x1733a7[_0x8b45('0x36')]:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x31')]['hasOwnProperty'](_0x8b45('0x38'))){_0x1733a7[_0x8b45('0x1c')]=qs[_0x8b45('0x1c')](_0x461017['query'][_0x8b45('0x1c')]);_0x1733a7[_0x8b45('0x1a')]=qs[_0x8b45('0x1a')](_0x461017['query'][_0x8b45('0x1a')]);}_0x1733a7[_0x8b45('0x39')]=qs[_0x8b45('0x3a')](_0x461017[_0x8b45('0x31')]['sort']);_0x1733a7[_0x8b45('0x3b')]=qs[_0x8b45('0x33')](_[_0x8b45('0x3c')](_0x461017[_0x8b45('0x31')],_0xf21bd1[_0x8b45('0x33')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x31')]['filter']){_0x1733a7['where']=_[_0x8b45('0x3d')](_0x1733a7[_0x8b45('0x3b')],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x12d4b2){if(_0x12d4b2[_0x8b45('0x2c')]!=='VIRTUAL'){var _0x120068={};_0x120068[_0x12d4b2['name']]={'$like':'%'+_0x461017[_0x8b45('0x31')][_0x8b45('0x3e')]+'%'};return _0x120068;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3f')]);var _0x254f17={'where':_0x1733a7[_0x8b45('0x3b')]};return db[_0x8b45('0x40')][_0x8b45('0x1d')](_0x254f17)[_0x8b45('0x23')](function(_0x2ca00e){_0x339c73[_0x8b45('0x1d')]=_0x2ca00e;if(_0x461017['query'][_0x8b45('0x41')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x40')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x224c45){_0x339c73[_0x8b45('0x42')]=_0x224c45;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x43')](handleError(_0x234f62,null));};exports[_0x8b45('0x44')]=function(_0x58e663,_0x6fbca4){var _0x5916c7={'raw':![],'where':{'id':_0x58e663[_0x8b45('0x45')]['id']}},_0x4c56c8={};_0x4c56c8[_0x8b45('0x2e')]=_[_0x8b45('0x32')](db['ScreenRecording'][_0x8b45('0x2a')]);_0x4c56c8['query']=_[_0x8b45('0x32')](_0x58e663[_0x8b45('0x31')]);_0x4c56c8[_0x8b45('0x33')]=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],_0x4c56c8[_0x8b45('0x31')]);_0x5916c7['attributes']=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x58e663[_0x8b45('0x31')][_0x8b45('0x35')]));_0x5916c7[_0x8b45('0x36')]=_0x5916c7[_0x8b45('0x36')][_0x8b45('0x37')]?_0x5916c7[_0x8b45('0x36')]:_0x4c56c8[_0x8b45('0x2e')];if(_0x58e663[_0x8b45('0x31')][_0x8b45('0x41')]){_0x5916c7[_0x8b45('0x46')]=[{'all':!![]}];}_0x5916c7=_[_0x8b45('0x3d')]({},_0x5916c7,_0x58e663[_0x8b45('0x3f')]);return db[_0x8b45('0x40')]['find'](_0x5916c7)['then'](handleEntityNotFound(_0x6fbca4,null))['then'](respondWithResult(_0x6fbca4,null))[_0x8b45('0x43')](handleError(_0x6fbca4,null));};exports[_0x8b45('0x47')]=function(_0x3a1621,_0x473530){return db[_0x8b45('0x40')][_0x8b45('0x47')](_0x3a1621[_0x8b45('0x48')],{})[_0x8b45('0x23')](respondWithResult(_0x473530,0xc9))['catch'](handleError(_0x473530,null));};exports[_0x8b45('0x22')]=function(_0x5d5be2,_0x23b5c6){if(_0x5d5be2[_0x8b45('0x48')]['id']){delete _0x5d5be2[_0x8b45('0x48')]['id'];}delete _0x5d5be2[_0x8b45('0x48')]['duration'];delete _0x5d5be2[_0x8b45('0x48')][_0x8b45('0x49')];delete _0x5d5be2['body'][_0x8b45('0x4a')];delete _0x5d5be2[_0x8b45('0x48')]['value'];return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':{'id':_0x5d5be2[_0x8b45('0x45')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x23b5c6,null))[_0x8b45('0x23')](saveUpdates(_0x5d5be2[_0x8b45('0x48')],null))['then'](respondWithResult(_0x23b5c6,null))['catch'](handleError(_0x23b5c6,null));};exports[_0x8b45('0x4c')]=function(_0x2a2e59,_0x2d5b31){return db['ScreenRecording'][_0x8b45('0x4c')]()[_0x8b45('0x23')](respondWithResult(_0x2d5b31,null))[_0x8b45('0x43')](handleError(_0x2d5b31,null));};exports[_0x8b45('0x4d')]=function(_0x2d6b66,_0x597402,_0x34c05d){var _0xa92a05=require('../../components/encryptor');var _0x422da0=![];var _0x4c3f38={};if(_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]&&_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]==='uniqueid'){_0x4c3f38[_0x8b45('0x4e')]=_0x2d6b66[_0x8b45('0x45')]['id'];}else{_0x4c3f38['id']=_0x2d6b66[_0x8b45('0x45')]['id'];}return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':_0x4c3f38,'attributes':['id',_0x8b45('0x4f')],'raw':!![]})[_0x8b45('0x23')](handleEntityNotFound(_0x597402,null))[_0x8b45('0x23')](function(_0x446fe5){if(_0x446fe5){var _0x5ba878=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x446fe5[_0x8b45('0x4f')]);var _0x1851c2=util['format'](_0x8b45('0x53'),_0x5ba878);if(fs[_0x8b45('0x54')](_0x1851c2)){_0x422da0=!![];return _0xa92a05[_0x8b45('0x55')](_0x1851c2,_0x5ba878,config['secrets'][_0x8b45('0x56')])[_0x8b45('0x23')](function(){return _0x446fe5;});}return _0x446fe5;}})[_0x8b45('0x23')](function(_0x9eacc1){if(_0x9eacc1){var _0x5795ca=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x9eacc1[_0x8b45('0x4f')]);if(!fs['existsSync'](_0x5795ca)){throw new db[(_0x8b45('0x57'))][(_0x8b45('0x58'))](_0x8b45('0x59'));}if(_0x9eacc1[_0x8b45('0x5a')]){return _0x597402[_0x8b45('0x4d')](_0x5795ca,_0x9eacc1['filename']+path[_0x8b45('0x5b')](_0x5795ca),function(){if(_0x422da0){fs['unlink'](_0x5795ca);}});}else{return _0x597402[_0x8b45('0x4d')](_0x5795ca,function(_0x2f7ab0){if(_0x422da0){fs[_0x8b45('0x5c')](_0x5795ca);}});}}})[_0x8b45('0x43')](function(_0x6a77bd){if(_0x6a77bd[_0x8b45('0x5d')]==='ScreenRecording\x20not\x20found'){_0x597402['status'](0x194)[_0x8b45('0x27')](_0x8b45('0x5e'));}else{return handleError(_0x597402,null);}});};exports['destroy']=function(_0x461c83,_0x239330){return db[_0x8b45('0x40')]['find']({'where':{'id':_0x461c83['params']['id']}})[_0x8b45('0x23')](function(_0x8e5a41){if(_['isNil'](_0x8e5a41)){throw new ReferenceError(_0x8b45('0x5f'));}return _0x8e5a41;})['then'](function(_0xf1ab37){var _0x560c51=path['join'](config[_0x8b45('0x51')],_0x8b45('0x52'),_0xf1ab37['value']);logger[_0x8b45('0x60')](_0x8b45('0x61'),_0x560c51);if(!_[_0x8b45('0x62')](_0xf1ab37[_0x8b45('0x4f')])&&fs[_0x8b45('0x54')](_0x560c51)){logger['info'](_0x8b45('0x63')+_0x560c51+_0x8b45('0x64'));fs[_0x8b45('0x65')](_0x560c51);}_0x560c51=_0x560c51+'.cypher';if(!_['isNil'](_0xf1ab37[_0x8b45('0x4f')])&&fs['existsSync'](_0x560c51)){logger[_0x8b45('0x60')]('File:\x20\x22'+_0x560c51+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x560c51);}return _0xf1ab37;})[_0x8b45('0x23')](function(_0x4df581){if(!_0x4df581)throw new InternalError();return _0x4df581[_0x8b45('0x24')]();})[_0x8b45('0x23')](function(){_0x239330['status'](0xcc)[_0x8b45('0x18')]();})[_0x8b45('0x43')](handleError(_0x239330,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 382fa48..6b14971 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 _0x2901=['request-promise','rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','util','../../config/logger','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2901,0x1b7));var _0x1290=function(_0x5ea92d,_0x36311e){_0x5ea92d=_0x5ea92d-0x0;var _0xd1df2=_0x2901[_0x5ea92d];return _0xd1df2;};'use strict';var _=require('lodash');var util=require(_0x1290('0x0'));var logger=require(_0x1290('0x1'))(_0x1290('0x2'));var moment=require(_0x1290('0x3'));var BPromise=require(_0x1290('0x4'));var rp=require(_0x1290('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1290('0x6'));var config=require(_0x1290('0x7'));var attributes=require('./screenRecording.attributes');module[_0x1290('0x8')]=function(_0x579279,_0x33a757){return _0x579279[_0x1290('0x9')](_0x1290('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x1290('0xb'),'fields':[_0x1290('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f61=['interactionid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x333ded,_0x15a86c){var _0x99f844=function(_0x5ae8f8){while(--_0x5ae8f8){_0x333ded['push'](_0x333ded['shift']());}};_0x99f844(++_0x15a86c);}(_0x5f61,0xd9));var _0x15f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f61[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x15f6('0x0'));var logger=require(_0x15f6('0x1'))('api');var moment=require(_0x15f6('0x2'));var BPromise=require(_0x15f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15f6('0x4'));var rimraf=require(_0x15f6('0x5'));var config=require(_0x15f6('0x6'));var attributes=require(_0x15f6('0x7'));module[_0x15f6('0x8')]=function(_0x3bb9d2,_0x5a863a){return _0x3bb9d2[_0x15f6('0x9')](_0x15f6('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x15f6('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 5930cea..59ced33 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 _0x59c8=['util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info','ScreenRecording,\x20%s,\x20%s','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x94d7da,_0x37da1c){var _0x44eaa9=function(_0x6aef10){while(--_0x6aef10){_0x94d7da['push'](_0x94d7da['shift']());}};_0x44eaa9(++_0x37da1c);}(_0x59c8,0xdb));var _0x859c=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x59c8[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x859c('0x0'));var util=require(_0x859c('0x1'));var moment=require(_0x859c('0x2'));var BPromise=require(_0x859c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x859c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x859c('0x5'))('rpc');var config=require(_0x859c('0x6'));var jayson=require(_0x859c('0x7'));var client=jayson[_0x859c('0x8')][_0x859c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39cf73,_0x2a3335,_0x46417f){return new BPromise(function(_0xca4b63,_0x500e36){return client['request'](_0x39cf73,_0x46417f)['then'](function(_0x5c59f6){logger[_0x859c('0xa')](_0x859c('0xb'),_0x2a3335,'request\x20sent');logger['debug'](_0x859c('0xc'),_0x2a3335,_0x859c('0xd'),JSON[_0x859c('0xe')](_0x5c59f6));if(_0x5c59f6[_0x859c('0xf')]){if(_0x5c59f6[_0x859c('0xf')][_0x859c('0x10')]===0x1f4){logger[_0x859c('0xf')](_0x859c('0xb'),_0x2a3335,_0x5c59f6[_0x859c('0xf')][_0x859c('0x11')]);return _0x500e36(_0x5c59f6[_0x859c('0xf')]['message']);}logger[_0x859c('0xf')](_0x859c('0xb'),_0x2a3335,_0x5c59f6[_0x859c('0xf')]['message']);return _0xca4b63(_0x5c59f6[_0x859c('0xf')][_0x859c('0x11')]);}else{logger['info'](_0x859c('0xb'),_0x2a3335,'request\x20sent');_0xca4b63(_0x5c59f6[_0x859c('0x12')]['message']);}})[_0x859c('0x13')](function(_0x1a2320){logger[_0x859c('0xf')](_0x859c('0xb'),_0x2a3335,_0x1a2320);_0x500e36(_0x1a2320);});});} \ No newline at end of file +var _0x64ee=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x557510,_0x4b4cb6){var _0x538506=function(_0x15c311){while(--_0x15c311){_0x557510['push'](_0x557510['shift']());}};_0x538506(++_0x4b4cb6);}(_0x64ee,0x157));var _0xe64e=function(_0x153891,_0x4eb35f){_0x153891=_0x153891-0x0;var _0x5869fe=_0x64ee[_0x153891];return _0x5869fe;};'use strict';var _=require(_0xe64e('0x0'));var util=require('util');var moment=require(_0xe64e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe64e('0x2'));var db=require(_0xe64e('0x3'))['db'];var utils=require(_0xe64e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe64e('0x5'));var jayson=require(_0xe64e('0x6'));var client=jayson[_0xe64e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18ce25,_0x4815d7,_0x2d7faa){return new BPromise(function(_0x47c59e,_0x122e4c){return client['request'](_0x18ce25,_0x2d7faa)['then'](function(_0x4e45b8){logger[_0xe64e('0x8')](_0xe64e('0x9'),_0x4815d7,_0xe64e('0xa'));logger[_0xe64e('0xb')](_0xe64e('0xc'),_0x4815d7,'request\x20sent',JSON[_0xe64e('0xd')](_0x4e45b8));if(_0x4e45b8[_0xe64e('0xe')]){if(_0x4e45b8[_0xe64e('0xe')]['code']===0x1f4){logger[_0xe64e('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x4815d7,_0x4e45b8[_0xe64e('0xe')][_0xe64e('0xf')]);return _0x122e4c(_0x4e45b8[_0xe64e('0xe')][_0xe64e('0xf')]);}logger['error'](_0xe64e('0x9'),_0x4815d7,_0x4e45b8[_0xe64e('0xe')][_0xe64e('0xf')]);return _0x47c59e(_0x4e45b8[_0xe64e('0xe')][_0xe64e('0xf')]);}else{logger[_0xe64e('0x8')](_0xe64e('0x9'),_0x4815d7,_0xe64e('0xa'));_0x47c59e(_0x4e45b8[_0xe64e('0x10')][_0xe64e('0xf')]);}})[_0xe64e('0x11')](function(_0x2af287){logger[_0xe64e('0xe')](_0xe64e('0x9'),_0x4815d7,_0x2af287);_0x122e4c(_0x2af287);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6961d69..206d714 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 _0x3644=['join','root','server/files/images/logos/','%s%s','logo','extname','post','file','addLogo','format','logologin','originalname','single','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','show','/:id/logo','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage'];(function(_0xa3b118,_0xaf2c8e){var _0x590bb0=function(_0x55a846){while(--_0x55a846){_0xa3b118['push'](_0xa3b118['shift']());}};_0x590bb0(++_0xaf2c8e);}(_0x3644,0x1d9));var _0x4364=function(_0x27c8f5,_0x184274){_0x27c8f5=_0x27c8f5-0x0;var _0x1903e7=_0x3644[_0x27c8f5];return _0x1903e7;};'use strict';var multer=require(_0x4364('0x0'));var util=require('util');var path=require(_0x4364('0x1'));var timeout=require('connect-timeout');var express=require(_0x4364('0x2'));var router=express[_0x4364('0x3')]();var fs_extra=require(_0x4364('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4364('0x5'));var config=require(_0x4364('0x6'));var controller=require('./setting.controller');router[_0x4364('0x7')]('/',auth[_0x4364('0x8')](),controller[_0x4364('0x9')]);router[_0x4364('0x7')]('/now',controller[_0x4364('0xa')]);router['get']('/:id',controller[_0x4364('0xb')]);router[_0x4364('0x7')](_0x4364('0xc'),controller['getLogo']);router[_0x4364('0x7')]('/:id/logo_login',controller[_0x4364('0xd')]);router['get'](_0x4364('0xe'),controller[_0x4364('0xf')]);router[_0x4364('0x7')](_0x4364('0x10'),controller['getPreferred']);router[_0x4364('0x7')]('/:id/favicon',controller[_0x4364('0x11')]);var upload=multer({'storage':multer[_0x4364('0x12')]({'destination':function(_0x1991f6,_0x1e91cc,_0x675c0){_0x675c0(null,path[_0x4364('0x13')](config[_0x4364('0x14')],_0x4364('0x15')));},'filename':function(_0x40550e,_0x45b064,_0x183485){_0x183485(null,util['format'](_0x4364('0x16'),_0x4364('0x17'),path[_0x4364('0x18')](_0x45b064['originalname'])));}})});router[_0x4364('0x19')]('/:id/logo',upload['single'](_0x4364('0x1a')),controller[_0x4364('0x1b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x519e1e,_0x13870f,_0x4c6ba4){_0x4c6ba4(null,path['join'](config[_0x4364('0x14')],_0x4364('0x15')));},'filename':function(_0x5ace51,_0x5aa617,_0x3c7786){_0x3c7786(null,util[_0x4364('0x1c')](_0x4364('0x16'),_0x4364('0x1d'),path[_0x4364('0x18')](_0x5aa617[_0x4364('0x1e')])));}})});router[_0x4364('0x19')]('/:id/logo_login',upload[_0x4364('0x1f')](_0x4364('0x1a')),controller[_0x4364('0x20')]);var upload=multer({'storage':multer[_0x4364('0x12')]({'destination':function(_0x42261c,_0x33e75a,_0x1c5fae){_0x1c5fae(null,path['join'](config['root'],_0x4364('0x15')));},'filename':function(_0x7323db,_0xd22016,_0x4d29b8){_0x4d29b8(null,util[_0x4364('0x1c')]('%s%s',_0x4364('0x21'),path['extname'](_0xd22016[_0x4364('0x1e')])));}})});router['post'](_0x4364('0x10'),upload[_0x4364('0x1f')]('file'),controller[_0x4364('0x22')]);var upload=multer({'storage':multer[_0x4364('0x12')]({'destination':function(_0x273a51,_0x33138e,_0x81a9cc){_0x81a9cc(null,path[_0x4364('0x13')](config[_0x4364('0x14')],_0x4364('0x15')));},'filename':function(_0x29ee47,_0x5a7a9d,_0x18cc2e){_0x18cc2e(null,util[_0x4364('0x1c')](_0x4364('0x16'),_0x4364('0x23'),path[_0x4364('0x18')](_0x5a7a9d[_0x4364('0x1e')])));}})});router[_0x4364('0x19')](_0x4364('0x24'),upload[_0x4364('0x1f')](_0x4364('0x1a')),controller[_0x4364('0x25')]);router[_0x4364('0x26')]('/:id',auth['isAuthenticated'](),controller[_0x4364('0x27')]);module[_0x4364('0x28')]=router; \ No newline at end of file +var _0x2a23=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','originalname','post','file','addLogo','extname','single','addLogoLogin','preferred','addPreferred','put','exports'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x2a23,0x72));var _0x32a2=function(_0x51f92c,_0x18337a){_0x51f92c=_0x51f92c-0x0;var _0x4c5a2e=_0x2a23[_0x51f92c];return _0x4c5a2e;};'use strict';var multer=require('multer');var util=require(_0x32a2('0x0'));var path=require(_0x32a2('0x1'));var timeout=require(_0x32a2('0x2'));var express=require(_0x32a2('0x3'));var router=express[_0x32a2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x32a2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32a2('0x6'));var controller=require(_0x32a2('0x7'));router[_0x32a2('0x8')]('/',auth[_0x32a2('0x9')](),controller[_0x32a2('0xa')]);router[_0x32a2('0x8')](_0x32a2('0xb'),controller['getDate']);router[_0x32a2('0x8')](_0x32a2('0xc'),controller[_0x32a2('0xd')]);router[_0x32a2('0x8')](_0x32a2('0xe'),controller[_0x32a2('0xf')]);router[_0x32a2('0x8')](_0x32a2('0x10'),controller[_0x32a2('0x11')]);router[_0x32a2('0x8')](_0x32a2('0x12'),controller['gdpr']);router[_0x32a2('0x8')](_0x32a2('0x13'),controller['getPreferred']);router[_0x32a2('0x8')](_0x32a2('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0x32a2('0x15')]({'destination':function(_0x55166e,_0x184751,_0x284458){_0x284458(null,path[_0x32a2('0x16')](config[_0x32a2('0x17')],_0x32a2('0x18')));},'filename':function(_0xa1324,_0x5f1ea9,_0x1ff8ad){_0x1ff8ad(null,util[_0x32a2('0x19')](_0x32a2('0x1a'),'logo',path['extname'](_0x5f1ea9[_0x32a2('0x1b')])));}})});router[_0x32a2('0x1c')](_0x32a2('0xe'),upload['single'](_0x32a2('0x1d')),controller[_0x32a2('0x1e')]);var upload=multer({'storage':multer[_0x32a2('0x15')]({'destination':function(_0x4e116b,_0x576b1c,_0x1db555){_0x1db555(null,path[_0x32a2('0x16')](config[_0x32a2('0x17')],_0x32a2('0x18')));},'filename':function(_0x263ccc,_0x53aec4,_0x48fff5){_0x48fff5(null,util[_0x32a2('0x19')](_0x32a2('0x1a'),'logologin',path[_0x32a2('0x1f')](_0x53aec4[_0x32a2('0x1b')])));}})});router[_0x32a2('0x1c')](_0x32a2('0x10'),upload[_0x32a2('0x20')](_0x32a2('0x1d')),controller[_0x32a2('0x21')]);var upload=multer({'storage':multer[_0x32a2('0x15')]({'destination':function(_0x230f2b,_0x189fdb,_0x5004ee){_0x5004ee(null,path[_0x32a2('0x16')](config[_0x32a2('0x17')],_0x32a2('0x18')));},'filename':function(_0x3b0d8c,_0x26b466,_0x31933f){_0x31933f(null,util[_0x32a2('0x19')](_0x32a2('0x1a'),_0x32a2('0x22'),path[_0x32a2('0x1f')](_0x26b466[_0x32a2('0x1b')])));}})});router[_0x32a2('0x1c')]('/:id/preferred',upload[_0x32a2('0x20')](_0x32a2('0x1d')),controller[_0x32a2('0x23')]);var upload=multer({'storage':multer[_0x32a2('0x15')]({'destination':function(_0x273938,_0x5fac32,_0xa0315e){_0xa0315e(null,path[_0x32a2('0x16')](config[_0x32a2('0x17')],_0x32a2('0x18')));},'filename':function(_0x2faa5b,_0x313e16,_0x220f8e){_0x220f8e(null,util[_0x32a2('0x19')](_0x32a2('0x1a'),'favicon',path[_0x32a2('0x1f')](_0x313e16[_0x32a2('0x1b')])));}})});router[_0x32a2('0x1c')](_0x32a2('0x14'),upload[_0x32a2('0x20')](_0x32a2('0x1d')),controller['addFavicon']);router[_0x32a2('0x24')](_0x32a2('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x32a2('0x25')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 14d1114..e5d033a 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x42d54,_0x51623b){var _0x509235=function(_0x283f3e){while(--_0x283f3e){_0x42d54['push'](_0x42d54['shift']());}};_0x509235(++_0x51623b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x4d2218,_0x126628){var _0xee353f=function(_0x4a0e82){while(--_0x4a0e82){_0x4d2218['push'](_0x4d2218['shift']());}};_0xee353f(++_0x126628);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index e636136..8eb32cd 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 _0x217a=['filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','logo','default_logo.svg','default','upperFirst','custom','ValidationError','download','getLogoLogin','default_loginLogo.svg','Sequelize','\x20not\x20found','gdpr','securePassword','addPreferred','preferred','default_preferred.png','addFavicon','getFavicon','getDate','utcOffset','now','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','name','send','index','Setting','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x42b902,_0x3c49fd){var _0x2d9d68=function(_0x2175bf){while(--_0x2175bf){_0x42b902['push'](_0x42b902['shift']());}};_0x2d9d68(++_0x3c49fd);}(_0x217a,0x1ac));var _0xa217=function(_0x3fe8c2,_0x26abad){_0x3fe8c2=_0x3fe8c2-0x0;var _0x3256ce=_0x217a[_0x3fe8c2];return _0x3256ce;};'use strict';var emlformat=require(_0xa217('0x0'));var rimraf=require(_0xa217('0x1'));var zipdir=require(_0xa217('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa217('0x3'));var moment=require(_0xa217('0x4'));var BPromise=require(_0xa217('0x5'));var Mustache=require(_0xa217('0x6'));var util=require(_0xa217('0x7'));var path=require(_0xa217('0x8'));var sox=require(_0xa217('0x9'));var csv=require('to-csv');var ejs=require(_0xa217('0xa'));var fs=require('fs');var fs_extra=require(_0xa217('0xb'));var _=require('lodash');var squel=require(_0xa217('0xc'));var crypto=require(_0xa217('0xd'));var jsforce=require(_0xa217('0xe'));var deskjs=require(_0xa217('0xf'));var toCsv=require(_0xa217('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa217('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa217('0x12'));var as=require(_0xa217('0x13'));var hardwareService=require(_0xa217('0x14'));var logger=require(_0xa217('0x15'))(_0xa217('0x16'));var utils=require('../../config/utils');var config=require(_0xa217('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa217('0x18'))['db'];var jayson=require(_0xa217('0x19'));var client=jayson[_0xa217('0x1a')][_0xa217('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2d6a11,_0x3effac,_0x7fa7fc,_0x3a7da9){return new BPromise(function(_0x51036a,_0x2ea4e3){var _0x43e5da=_0x3a7da9||client;return _0x43e5da['request'](_0x2d6a11,_0x7fa7fc)[_0xa217('0x1c')](function(_0x1aa6a7){logger[_0xa217('0x1d')](_0xa217('0x1e'),_0x3effac,_0xa217('0x1f'));logger[_0xa217('0x20')](_0xa217('0x21'),_0x3effac,_0xa217('0x1f'),JSON['stringify'](_0x1aa6a7));if(_0x1aa6a7[_0xa217('0x22')]){if(_0x1aa6a7['error'][_0xa217('0x23')]===0x1f4){logger['error'](_0xa217('0x1e'),_0x3effac,_0x1aa6a7['error'][_0xa217('0x24')]);return _0x2ea4e3(_0x1aa6a7[_0xa217('0x22')][_0xa217('0x24')]);}logger[_0xa217('0x22')](_0xa217('0x1e'),_0x3effac,_0x1aa6a7[_0xa217('0x22')]['message']);return _0x51036a(_0x1aa6a7[_0xa217('0x22')][_0xa217('0x24')]);}else{logger[_0xa217('0x1d')](_0xa217('0x1e'),_0x3effac,_0xa217('0x1f'));_0x51036a(_0x1aa6a7['result'][_0xa217('0x24')]);}})[_0xa217('0x25')](function(_0x14c481){logger[_0xa217('0x22')](_0xa217('0x1e'),_0x3effac,_0x14c481);_0x2ea4e3(_0x14c481);});});}function respondWithStatusCode(_0xa6db7a,_0x383e5b){_0x383e5b=_0x383e5b||0xcc;return function(_0x296d2f){if(_0x296d2f){return _0xa6db7a['sendStatus'](_0x383e5b);}return _0xa6db7a[_0xa217('0x26')](_0x383e5b)[_0xa217('0x27')]();};}function respondWithResult(_0x2da43a,_0x5eff56){_0x5eff56=_0x5eff56||0xc8;return function(_0x23a41b){if(_0x23a41b){return _0x2da43a['status'](_0x5eff56)[_0xa217('0x28')](_0x23a41b);}};}function respondWithFilteredResult(_0x80716c,_0x301d21){return function(_0x24d730){if(_0x24d730){var _0x4e4e25=typeof _0x301d21[_0xa217('0x29')]===_0xa217('0x2a')&&typeof _0x301d21[_0xa217('0x2b')]===_0xa217('0x2a');var _0x54f5a0=_0x24d730[_0xa217('0x2c')];var _0x13aaa9=_0x4e4e25?0x0:_0x301d21['offset'];var _0x263cd4=_0x4e4e25?_0x24d730[_0xa217('0x2c')]:_0x301d21[_0xa217('0x29')]+_0x301d21[_0xa217('0x2b')];var _0x1207db;if(_0x263cd4>=_0x54f5a0){_0x263cd4=_0x54f5a0;_0x1207db=0xc8;}else{_0x1207db=0xce;}_0x80716c['status'](_0x1207db);return _0x80716c[_0xa217('0x2d')](_0xa217('0x2e'),_0x13aaa9+'-'+_0x263cd4+'/'+_0x54f5a0)[_0xa217('0x28')](_0x24d730);}return null;};}function patchUpdates(_0x5148cd){return function(_0x99953b){try{jsonpatch[_0xa217('0x2f')](_0x99953b,_0x5148cd,!![]);}catch(_0x41f4dd){return BPromise['reject'](_0x41f4dd);}return _0x99953b[_0xa217('0x30')]();};}function saveUpdates(_0x283d7d,_0xaca519){return function(_0x7b123f){if(_0x7b123f){return _0x7b123f[_0xa217('0x31')](_0x283d7d)[_0xa217('0x1c')](function(_0x2e8958){return _0x2e8958;});}return null;};}function removeEntity(_0x35541e,_0x2cca9a){return function(_0x315e6b){if(_0x315e6b){return _0x315e6b[_0xa217('0x32')]()[_0xa217('0x1c')](function(){_0x35541e[_0xa217('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x420e65,_0x1fd483){return function(_0xd58e43){if(!_0xd58e43){_0x420e65['sendStatus'](0x194);}return _0xd58e43;};}function handleError(_0x436400,_0x39c8ef){_0x39c8ef=_0x39c8ef||0x1f4;return function(_0x14d98a){logger[_0xa217('0x22')](_0x14d98a['stack']);if(_0x14d98a[_0xa217('0x33')]){delete _0x14d98a[_0xa217('0x33')];}_0x436400[_0xa217('0x26')](_0x39c8ef)[_0xa217('0x34')](_0x14d98a);};}exports[_0xa217('0x35')]=function(_0x5938a8,_0x4abcf6){var _0x465998={},_0x530b9e={},_0x51cba4={'count':0x0,'rows':[]};var _0x4f1420=_['map'](db[_0xa217('0x36')][_0xa217('0x37')],function(_0x5272d1){return{'name':_0x5272d1['fieldName'],'type':_0x5272d1[_0xa217('0x38')][_0xa217('0x39')]};});_0x530b9e[_0xa217('0x3a')]=_[_0xa217('0x3b')](_0x4f1420,_0xa217('0x33'));_0x530b9e[_0xa217('0x3c')]=_[_0xa217('0x3d')](_0x5938a8[_0xa217('0x3c')]);_0x530b9e['filters']=_[_0xa217('0x3e')](_0x530b9e[_0xa217('0x3a')],_0x530b9e['query']);_0x465998['attributes']=_[_0xa217('0x3e')](_0x530b9e[_0xa217('0x3a')],qs[_0xa217('0x3f')](_0x5938a8[_0xa217('0x3c')][_0xa217('0x3f')]));_0x465998['attributes']=_0x465998[_0xa217('0x40')][_0xa217('0x41')]?_0x465998['attributes']:_0x530b9e[_0xa217('0x3a')];if(!_0x5938a8['query'][_0xa217('0x42')](_0xa217('0x43'))){_0x465998['limit']=qs[_0xa217('0x2b')](_0x5938a8[_0xa217('0x3c')][_0xa217('0x2b')]);_0x465998[_0xa217('0x29')]=qs[_0xa217('0x29')](_0x5938a8[_0xa217('0x3c')]['offset']);}_0x465998[_0xa217('0x44')]=qs[_0xa217('0x45')](_0x5938a8['query'][_0xa217('0x45')]);_0x465998['where']=qs[_0xa217('0x46')](_[_0xa217('0x47')](_0x5938a8[_0xa217('0x3c')],_0x530b9e[_0xa217('0x46')]),_0x4f1420);if(_0x5938a8['query'][_0xa217('0x48')]){_0x465998[_0xa217('0x49')]=_[_0xa217('0x4a')](_0x465998['where'],{'$or':_[_0xa217('0x3b')](_0x4f1420,function(_0x4f28a8){if(_0x4f28a8['type']!==_0xa217('0x4b')){var _0x214a61={};_0x214a61[_0x4f28a8[_0xa217('0x33')]]={'$like':'%'+_0x5938a8[_0xa217('0x3c')][_0xa217('0x48')]+'%'};return _0x214a61;}})});}_0x465998=_[_0xa217('0x4a')]({},_0x465998,_0x5938a8[_0xa217('0x4c')]);var _0x2c5149={'where':_0x465998[_0xa217('0x49')]};return db[_0xa217('0x36')][_0xa217('0x2c')](_0x2c5149)['then'](function(_0x22bc29){_0x51cba4[_0xa217('0x2c')]=_0x22bc29;if(_0x5938a8[_0xa217('0x3c')][_0xa217('0x4d')]){_0x465998[_0xa217('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xa217('0x4f')](_0x465998);})[_0xa217('0x1c')](function(_0x5c795d){_0x51cba4[_0xa217('0x50')]=_0x5c795d;return _0x51cba4;})['then'](respondWithFilteredResult(_0x4abcf6,_0x465998))[_0xa217('0x25')](handleError(_0x4abcf6,null));};exports[_0xa217('0x51')]=function(_0x5bed96,_0x94a723){var _0x408f5c={'raw':![],'where':{'id':_0x5bed96[_0xa217('0x52')]['id']}},_0x1d7bc4={};_0x1d7bc4[_0xa217('0x3a')]=_[_0xa217('0x3d')](db['Setting']['rawAttributes']);_0x1d7bc4[_0xa217('0x3c')]=_['keys'](_0x5bed96['query']);_0x1d7bc4[_0xa217('0x46')]=_[_0xa217('0x3e')](_0x1d7bc4['model'],_0x1d7bc4[_0xa217('0x3c')]);_0x408f5c[_0xa217('0x40')]=_[_0xa217('0x3e')](_0x1d7bc4[_0xa217('0x3a')],qs[_0xa217('0x3f')](_0x5bed96[_0xa217('0x3c')][_0xa217('0x3f')]));_0x408f5c[_0xa217('0x40')]=_0x408f5c[_0xa217('0x40')][_0xa217('0x41')]?_0x408f5c[_0xa217('0x40')]:_0x1d7bc4[_0xa217('0x3a')];if(_0x5bed96[_0xa217('0x3c')][_0xa217('0x4d')]){_0x408f5c[_0xa217('0x4e')]=[{'all':!![]}];}_0x408f5c=_[_0xa217('0x4a')]({},_0x408f5c,_0x5bed96[_0xa217('0x4c')]);return db['Setting'][_0xa217('0x53')](_0x408f5c)[_0xa217('0x1c')](handleEntityNotFound(_0x94a723,null))[_0xa217('0x1c')](respondWithResult(_0x94a723,null))[_0xa217('0x25')](handleError(_0x94a723,null));};exports[_0xa217('0x31')]=function(_0x47d8cf,_0x46ffe9){if(_0x47d8cf[_0xa217('0x54')]['id']){delete _0x47d8cf['body']['id'];}return db['Setting'][_0xa217('0x53')]({'where':{'id':_0x47d8cf[_0xa217('0x52')]['id']}})[_0xa217('0x1c')](handleEntityNotFound(_0x46ffe9,null))[_0xa217('0x1c')](saveUpdates(_0x47d8cf[_0xa217('0x54')],null))[_0xa217('0x1c')](respondWithResult(_0x46ffe9,null))[_0xa217('0x25')](handleError(_0x46ffe9,null));};exports[_0xa217('0x55')]=function(_0x1b2f88,_0x20f375,_0x21b0fe){if(_0x1b2f88[_0xa217('0x56')]&&_0x1b2f88[_0xa217('0x56')][_0xa217('0x57')]){_0x1b2f88['body']['logo']=_0x1b2f88[_0xa217('0x56')][_0xa217('0x57')];}return db[_0xa217('0x36')][_0xa217('0x53')]({'where':{'id':_0x1b2f88[_0xa217('0x52')]['id']}})[_0xa217('0x1c')](handleEntityNotFound(_0x20f375,null))[_0xa217('0x1c')](saveUpdates(_0x1b2f88['body'],null))['then'](respondWithResult(_0x20f375,null))['catch'](handleError(_0x20f375,null));};exports[_0xa217('0x58')]=function(_0x2d57fb,_0x15080b,_0xd778){if(_0x2d57fb['file']&&_0x2d57fb['file'][_0xa217('0x57')]){_0x2d57fb[_0xa217('0x54')][_0xa217('0x59')]=_0x2d57fb['file'][_0xa217('0x57')];}return db['Setting'][_0xa217('0x53')]({'where':{'id':_0x2d57fb[_0xa217('0x52')]['id']}})[_0xa217('0x1c')](handleEntityNotFound(_0x15080b,null))['then'](saveUpdates(_0x2d57fb[_0xa217('0x54')],null))[_0xa217('0x1c')](respondWithResult(_0x15080b,null))[_0xa217('0x25')](handleError(_0x15080b,null));};var utilLicense=require(_0xa217('0x5a'));exports[_0xa217('0x5b')]=function(_0x531929,_0x21c785,_0x568f57){var _0x2d3c53=_0xa217('0x5c');var _0x16fae1={'custom':![]};return utilLicense[_0xa217('0x5d')]()[_0xa217('0x1c')](function(_0x3a9445){if(_0x3a9445){_0x16fae1=_0x3a9445;}return db['Setting']['find']({'where':{'id':_0x531929[_0xa217('0x52')]['id']},'attributes':['logo','loginLogo','preferred',_0xa217('0x5e'),_0xa217('0x5f'),_0xa217('0x60'),_0xa217('0x61'),_0xa217('0x62')],'raw':!![]});})[_0xa217('0x1c')](handleEntityNotFound(_0x21c785,null))[_0xa217('0x1c')](function(_0x5cf4e0){if(_0x5cf4e0){var _0x20a73f=_0x5cf4e0['logo']&&fs[_0xa217('0x63')](path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2d3c53,_[_0xa217('0x66')](_0x5cf4e0[_0xa217('0x67')])))?path['join'](config[_0xa217('0x65')],_0x2d3c53,_[_0xa217('0x66')](_0x5cf4e0[_0xa217('0x67')])):path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2d3c53,_[_0xa217('0x66')](_0xa217('0x68')));var _0x4d3a33=_0xa217('0x69')+_[_0xa217('0x6a')](_0xa217('0x67'));if(_0x5cf4e0[_0x4d3a33]||!_0x16fae1[_0xa217('0x6b')]){_0x20a73f=path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2d3c53,_[_0xa217('0x66')](_0xa217('0x68')));}if(!fs[_0xa217('0x63')](_0x20a73f)){throw new db['Sequelize'][(_0xa217('0x6c'))](_[_0xa217('0x6a')](_0xa217('0x67'))+'\x20not\x20found');}return _0x21c785[_0xa217('0x6d')](_0x20a73f);}})[_0xa217('0x25')](handleError(_0x21c785,null));};var utilLicense=require(_0xa217('0x5a'));exports[_0xa217('0x6e')]=function(_0x32f925,_0xeeee3e,_0x2a8f1d){var _0x2129f7=_0xa217('0x5c');var _0x25ce69={'custom':![]};return utilLicense['getLicense']()[_0xa217('0x1c')](function(_0x7976e5){if(_0x7976e5){_0x25ce69=_0x7976e5;}return db[_0xa217('0x36')][_0xa217('0x53')]({'where':{'id':_0x32f925[_0xa217('0x52')]['id']},'attributes':[_0xa217('0x67'),'loginLogo','preferred',_0xa217('0x5e'),_0xa217('0x5f'),_0xa217('0x60'),_0xa217('0x61'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0xeeee3e,null))['then'](function(_0x3050e3){if(_0x3050e3){var _0x34979a=_0x3050e3[_0xa217('0x59')]&&fs[_0xa217('0x63')](path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2129f7,_[_0xa217('0x66')](_0x3050e3[_0xa217('0x59')])))?path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2129f7,_[_0xa217('0x66')](_0x3050e3['loginLogo'])):path['join'](config[_0xa217('0x65')],_0x2129f7,_['toLower'](_0xa217('0x6f')));var _0x240e69=_0xa217('0x69')+_[_0xa217('0x6a')](_0xa217('0x59'));if(_0x3050e3[_0x240e69]||!_0x25ce69[_0xa217('0x6b')]){_0x34979a=path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2129f7,_[_0xa217('0x66')](_0xa217('0x6f')));}if(!fs[_0xa217('0x63')](_0x34979a)){throw new db[(_0xa217('0x70'))]['ValidationError'](_[_0xa217('0x6a')]('loginLogo')+_0xa217('0x71'));}return _0xeeee3e[_0xa217('0x6d')](_0x34979a);}})[_0xa217('0x25')](handleError(_0xeeee3e,null));};exports[_0xa217('0x72')]=function(_0x36e45e,_0x688a7d){return db[_0xa217('0x36')][_0xa217('0x53')]({'where':{'id':_0x36e45e['params']['id']},'attributes':[_0xa217('0x73')]})[_0xa217('0x1c')](respondWithResult(_0x688a7d,null))['catch'](handleError(_0x688a7d,null));};exports[_0xa217('0x74')]=function(_0x371569,_0x971732,_0x46cdd5){if(_0x371569[_0xa217('0x56')]&&_0x371569[_0xa217('0x56')]['filename']){_0x371569['body'][_0xa217('0x75')]=_0x371569[_0xa217('0x56')][_0xa217('0x57')];}return db[_0xa217('0x36')][_0xa217('0x53')]({'where':{'id':_0x371569[_0xa217('0x52')]['id']}})[_0xa217('0x1c')](handleEntityNotFound(_0x971732,null))[_0xa217('0x1c')](saveUpdates(_0x371569[_0xa217('0x54')],null))['then'](respondWithResult(_0x971732,null))[_0xa217('0x25')](handleError(_0x971732,null));};var utilLicense=require(_0xa217('0x5a'));exports['getPreferred']=function(_0x1d7d81,_0x39c89a,_0x51c45c){var _0x7914a8=_0xa217('0x5c');var _0x2a46da={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4e742d){if(_0x4e742d){_0x2a46da=_0x4e742d;}return db[_0xa217('0x36')][_0xa217('0x53')]({'where':{'id':_0x1d7d81['params']['id']},'attributes':[_0xa217('0x67'),'loginLogo',_0xa217('0x75'),_0xa217('0x5e'),_0xa217('0x5f'),_0xa217('0x60'),_0xa217('0x61'),_0xa217('0x62')],'raw':!![]});})[_0xa217('0x1c')](handleEntityNotFound(_0x39c89a,null))[_0xa217('0x1c')](function(_0x40bc60){if(_0x40bc60){var _0x3eb942=_0x40bc60[_0xa217('0x75')]&&fs[_0xa217('0x63')](path[_0xa217('0x64')](config['root'],_0x7914a8,_[_0xa217('0x66')](_0x40bc60[_0xa217('0x75')])))?path[_0xa217('0x64')](config[_0xa217('0x65')],_0x7914a8,_[_0xa217('0x66')](_0x40bc60[_0xa217('0x75')])):path[_0xa217('0x64')](config[_0xa217('0x65')],_0x7914a8,_[_0xa217('0x66')](_0xa217('0x76')));var _0x2a6aca=_0xa217('0x69')+_[_0xa217('0x6a')]('preferred');if(_0x40bc60[_0x2a6aca]||!_0x2a46da[_0xa217('0x6b')]||!_0x2a46da[_0xa217('0x75')]){_0x3eb942=path['join'](config[_0xa217('0x65')],_0x7914a8,_[_0xa217('0x66')](_0xa217('0x76')));}if(!fs[_0xa217('0x63')](_0x3eb942)){throw new db['Sequelize'][(_0xa217('0x6c'))](_[_0xa217('0x6a')](_0xa217('0x75'))+'\x20not\x20found');}return _0x39c89a[_0xa217('0x6d')](_0x3eb942);}})[_0xa217('0x25')](handleError(_0x39c89a,null));};exports[_0xa217('0x77')]=function(_0x51deed,_0x35d3fc,_0xbd5b00){if(_0x51deed[_0xa217('0x56')]&&_0x51deed[_0xa217('0x56')][_0xa217('0x57')]){_0x51deed['body'][_0xa217('0x5e')]=_0x51deed[_0xa217('0x56')][_0xa217('0x57')];}return db['Setting'][_0xa217('0x53')]({'where':{'id':_0x51deed[_0xa217('0x52')]['id']}})[_0xa217('0x1c')](handleEntityNotFound(_0x35d3fc,null))[_0xa217('0x1c')](saveUpdates(_0x51deed[_0xa217('0x54')],null))[_0xa217('0x1c')](respondWithResult(_0x35d3fc,null))[_0xa217('0x25')](handleError(_0x35d3fc,null));};var utilLicense=require(_0xa217('0x5a'));exports[_0xa217('0x78')]=function(_0x5e9441,_0x39f908,_0x3538ca){var _0x2a6f71='server/files/images/logos';var _0x2f93b7={'custom':![]};return utilLicense[_0xa217('0x5d')]()[_0xa217('0x1c')](function(_0x5df228){if(_0x5df228){_0x2f93b7=_0x5df228;}return db['Setting'][_0xa217('0x53')]({'where':{'id':_0x5e9441[_0xa217('0x52')]['id']},'attributes':[_0xa217('0x67'),_0xa217('0x59'),_0xa217('0x75'),_0xa217('0x5e'),_0xa217('0x5f'),'defaultLoginLogo',_0xa217('0x61'),_0xa217('0x62')],'raw':!![]});})[_0xa217('0x1c')](handleEntityNotFound(_0x39f908,null))[_0xa217('0x1c')](function(_0x57d5a1){if(_0x57d5a1){var _0x25e11d=_0x57d5a1[_0xa217('0x5e')]&&fs['existsSync'](path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2a6f71,_[_0xa217('0x66')](_0x57d5a1[_0xa217('0x5e')])))?path[_0xa217('0x64')](config[_0xa217('0x65')],_0x2a6f71,_[_0xa217('0x66')](_0x57d5a1[_0xa217('0x5e')])):path[_0xa217('0x64')](config['root'],_0x2a6f71,_[_0xa217('0x66')]('default_favicon.ico'));var _0x2372e8=_0xa217('0x69')+_['upperFirst'](_0xa217('0x5e'));if(_0x57d5a1[_0x2372e8]||!_0x2f93b7[_0xa217('0x6b')]){_0x25e11d=path['join'](config['root'],_0x2a6f71,_[_0xa217('0x66')]('default_favicon.ico'));}if(!fs[_0xa217('0x63')](_0x25e11d)){throw new db['Sequelize'][(_0xa217('0x6c'))](_[_0xa217('0x6a')]('favicon')+_0xa217('0x71'));}return _0x39f908[_0xa217('0x6d')](_0x25e11d);}})['catch'](handleError(_0x39f908,null));};exports[_0xa217('0x79')]=function(_0x31f777,_0x1f87ec){var _0x590322={'offset':moment()[_0xa217('0x7a')]()};_0x590322[_0xa217('0x7b')]=moment()[_0xa217('0x7a')](_0x590322[_0xa217('0x29')])[_0xa217('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1f87ec['status'](0xc8)['send'](_0x590322);}; \ No newline at end of file +var _0xc694=['find','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','\x20not\x20found','getLogoLogin','getLicense','preferred','default_loginLogo.svg','Sequelize','ValidationError','download','securePassword','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','sendStatus','stack','index','map','rawAttributes','fieldName','key','model','name','query','keys','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','show','params','intersection','options','Setting','body'];(function(_0x12186a,_0x110c8c){var _0x12da52=function(_0x3285b1){while(--_0x3285b1){_0x12186a['push'](_0x12186a['shift']());}};_0x12da52(++_0x110c8c);}(_0xc694,0x11e));var _0x4c69=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xc694[_0x547456];return _0xc1fd7b;};'use strict';var emlformat=require(_0x4c69('0x0'));var rimraf=require(_0x4c69('0x1'));var zipdir=require(_0x4c69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4c69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4c69('0x4'));var util=require(_0x4c69('0x5'));var path=require('path');var sox=require(_0x4c69('0x6'));var csv=require(_0x4c69('0x7'));var ejs=require(_0x4c69('0x8'));var fs=require('fs');var fs_extra=require(_0x4c69('0x9'));var _=require(_0x4c69('0xa'));var squel=require(_0x4c69('0xb'));var crypto=require(_0x4c69('0xc'));var jsforce=require(_0x4c69('0xd'));var deskjs=require(_0x4c69('0xe'));var toCsv=require(_0x4c69('0x7'));var querystring=require(_0x4c69('0xf'));var Papa=require(_0x4c69('0x10'));var Redis=require(_0x4c69('0x11'));var authService=require(_0x4c69('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4c69('0x13'));var hardwareService=require(_0x4c69('0x14'));var logger=require(_0x4c69('0x15'))(_0x4c69('0x16'));var utils=require('../../config/utils');var config=require(_0x4c69('0x17'));var licenseUtil=require(_0x4c69('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4c69('0x19'));var client=jayson[_0x4c69('0x1a')][_0x4c69('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4fa492,_0x16e430,_0x26931b,_0x108815){return new BPromise(function(_0x47eb1f,_0xee9d26){var _0x95584b=_0x108815||client;return _0x95584b['request'](_0x4fa492,_0x26931b)['then'](function(_0x2b7bfa){logger[_0x4c69('0x1c')](_0x4c69('0x1d'),_0x16e430,_0x4c69('0x1e'));logger[_0x4c69('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x16e430,_0x4c69('0x1e'),JSON[_0x4c69('0x20')](_0x2b7bfa));if(_0x2b7bfa[_0x4c69('0x21')]){if(_0x2b7bfa[_0x4c69('0x21')][_0x4c69('0x22')]===0x1f4){logger['error'](_0x4c69('0x1d'),_0x16e430,_0x2b7bfa['error']['message']);return _0xee9d26(_0x2b7bfa[_0x4c69('0x21')][_0x4c69('0x23')]);}logger[_0x4c69('0x21')](_0x4c69('0x1d'),_0x16e430,_0x2b7bfa[_0x4c69('0x21')][_0x4c69('0x23')]);return _0x47eb1f(_0x2b7bfa['error'][_0x4c69('0x23')]);}else{logger[_0x4c69('0x1c')](_0x4c69('0x1d'),_0x16e430,_0x4c69('0x1e'));_0x47eb1f(_0x2b7bfa[_0x4c69('0x24')][_0x4c69('0x23')]);}})[_0x4c69('0x25')](function(_0x39545e){logger[_0x4c69('0x21')](_0x4c69('0x1d'),_0x16e430,_0x39545e);_0xee9d26(_0x39545e);});});}function respondWithStatusCode(_0x2ae750,_0x947361){_0x947361=_0x947361||0xcc;return function(_0x537312){if(_0x537312){return _0x2ae750['sendStatus'](_0x947361);}return _0x2ae750[_0x4c69('0x26')](_0x947361)[_0x4c69('0x27')]();};}function respondWithResult(_0x13becb,_0x3491bf){_0x3491bf=_0x3491bf||0xc8;return function(_0x59f32e){if(_0x59f32e){return _0x13becb['status'](_0x3491bf)[_0x4c69('0x28')](_0x59f32e);}};}function respondWithFilteredResult(_0x1c4577,_0x5002e9){return function(_0x222896){if(_0x222896){var _0x24f7fd=typeof _0x5002e9['offset']==='undefined'&&typeof _0x5002e9[_0x4c69('0x29')]===_0x4c69('0x2a');var _0x2a3d3d=_0x222896[_0x4c69('0x2b')];var _0x2fe4ac=_0x24f7fd?0x0:_0x5002e9[_0x4c69('0x2c')];var _0x5f288c=_0x24f7fd?_0x222896[_0x4c69('0x2b')]:_0x5002e9['offset']+_0x5002e9[_0x4c69('0x29')];var _0xb9eb42;if(_0x5f288c>=_0x2a3d3d){_0x5f288c=_0x2a3d3d;_0xb9eb42=0xc8;}else{_0xb9eb42=0xce;}_0x1c4577[_0x4c69('0x26')](_0xb9eb42);return _0x1c4577[_0x4c69('0x2d')](_0x4c69('0x2e'),_0x2fe4ac+'-'+_0x5f288c+'/'+_0x2a3d3d)[_0x4c69('0x28')](_0x222896);}return null;};}function patchUpdates(_0x1ced84){return function(_0xdd5e43){try{jsonpatch['apply'](_0xdd5e43,_0x1ced84,!![]);}catch(_0x2f5d9d){return BPromise[_0x4c69('0x2f')](_0x2f5d9d);}return _0xdd5e43[_0x4c69('0x30')]();};}function saveUpdates(_0x1621c6,_0x1d341f){return function(_0x522d24){if(_0x522d24){return _0x522d24[_0x4c69('0x31')](_0x1621c6)[_0x4c69('0x32')](function(_0x12e4e6){return _0x12e4e6;});}return null;};}function removeEntity(_0x26d1b9,_0x214c05){return function(_0x33d18c){if(_0x33d18c){return _0x33d18c['destroy']()[_0x4c69('0x32')](function(){_0x26d1b9[_0x4c69('0x26')](0xcc)[_0x4c69('0x27')]();});}};}function handleEntityNotFound(_0x6d465c,_0x231f19){return function(_0x3af8c8){if(!_0x3af8c8){_0x6d465c[_0x4c69('0x33')](0x194);}return _0x3af8c8;};}function handleError(_0x379cef,_0xc46674){_0xc46674=_0xc46674||0x1f4;return function(_0x1bd843){logger[_0x4c69('0x21')](_0x1bd843[_0x4c69('0x34')]);if(_0x1bd843['name']){delete _0x1bd843['name'];}_0x379cef['status'](_0xc46674)['send'](_0x1bd843);};}exports[_0x4c69('0x35')]=function(_0x5abcdb,_0x28998c){var _0x1e3c8d={},_0x2396a7={},_0x3ababf={'count':0x0,'rows':[]};var _0x1d2440=_[_0x4c69('0x36')](db['Setting'][_0x4c69('0x37')],function(_0x10993e){return{'name':_0x10993e[_0x4c69('0x38')],'type':_0x10993e['type'][_0x4c69('0x39')]};});_0x2396a7[_0x4c69('0x3a')]=_[_0x4c69('0x36')](_0x1d2440,_0x4c69('0x3b'));_0x2396a7[_0x4c69('0x3c')]=_[_0x4c69('0x3d')](_0x5abcdb[_0x4c69('0x3c')]);_0x2396a7['filters']=_['intersection'](_0x2396a7['model'],_0x2396a7['query']);_0x1e3c8d[_0x4c69('0x3e')]=_['intersection'](_0x2396a7[_0x4c69('0x3a')],qs[_0x4c69('0x3f')](_0x5abcdb['query']['fields']));_0x1e3c8d[_0x4c69('0x3e')]=_0x1e3c8d['attributes'][_0x4c69('0x40')]?_0x1e3c8d[_0x4c69('0x3e')]:_0x2396a7[_0x4c69('0x3a')];if(!_0x5abcdb[_0x4c69('0x3c')]['hasOwnProperty'](_0x4c69('0x41'))){_0x1e3c8d[_0x4c69('0x29')]=qs[_0x4c69('0x29')](_0x5abcdb['query'][_0x4c69('0x29')]);_0x1e3c8d[_0x4c69('0x2c')]=qs[_0x4c69('0x2c')](_0x5abcdb[_0x4c69('0x3c')][_0x4c69('0x2c')]);}_0x1e3c8d[_0x4c69('0x42')]=qs[_0x4c69('0x43')](_0x5abcdb[_0x4c69('0x3c')][_0x4c69('0x43')]);_0x1e3c8d[_0x4c69('0x44')]=qs[_0x4c69('0x45')](_[_0x4c69('0x46')](_0x5abcdb[_0x4c69('0x3c')],_0x2396a7[_0x4c69('0x45')]),_0x1d2440);if(_0x5abcdb[_0x4c69('0x3c')][_0x4c69('0x47')]){_0x1e3c8d[_0x4c69('0x44')]=_['merge'](_0x1e3c8d[_0x4c69('0x44')],{'$or':_['map'](_0x1d2440,function(_0x9bddb5){if(_0x9bddb5['type']!=='VIRTUAL'){var _0x1ee961={};_0x1ee961[_0x9bddb5[_0x4c69('0x3b')]]={'$like':'%'+_0x5abcdb[_0x4c69('0x3c')][_0x4c69('0x47')]+'%'};return _0x1ee961;}})});}_0x1e3c8d=_[_0x4c69('0x48')]({},_0x1e3c8d,_0x5abcdb['options']);var _0x425e75={'where':_0x1e3c8d['where']};return db['Setting'][_0x4c69('0x2b')](_0x425e75)[_0x4c69('0x32')](function(_0x33307a){_0x3ababf[_0x4c69('0x2b')]=_0x33307a;if(_0x5abcdb[_0x4c69('0x3c')][_0x4c69('0x49')]){_0x1e3c8d[_0x4c69('0x4a')]=[{'all':!![]}];}return db['Setting'][_0x4c69('0x4b')](_0x1e3c8d);})[_0x4c69('0x32')](function(_0x1eae37){_0x3ababf[_0x4c69('0x4c')]=_0x1eae37;return _0x3ababf;})[_0x4c69('0x32')](respondWithFilteredResult(_0x28998c,_0x1e3c8d))[_0x4c69('0x25')](handleError(_0x28998c,null));};exports[_0x4c69('0x4d')]=function(_0xc233,_0x1dab62){var _0x450582={'raw':![],'where':{'id':_0xc233[_0x4c69('0x4e')]['id']}},_0x44d519={};_0x44d519[_0x4c69('0x3a')]=_[_0x4c69('0x3d')](db['Setting'][_0x4c69('0x37')]);_0x44d519[_0x4c69('0x3c')]=_[_0x4c69('0x3d')](_0xc233['query']);_0x44d519['filters']=_['intersection'](_0x44d519['model'],_0x44d519['query']);_0x450582[_0x4c69('0x3e')]=_[_0x4c69('0x4f')](_0x44d519[_0x4c69('0x3a')],qs[_0x4c69('0x3f')](_0xc233[_0x4c69('0x3c')][_0x4c69('0x3f')]));_0x450582['attributes']=_0x450582[_0x4c69('0x3e')][_0x4c69('0x40')]?_0x450582[_0x4c69('0x3e')]:_0x44d519['model'];if(_0xc233['query'][_0x4c69('0x49')]){_0x450582[_0x4c69('0x4a')]=[{'all':!![]}];}_0x450582=_[_0x4c69('0x48')]({},_0x450582,_0xc233[_0x4c69('0x50')]);return db[_0x4c69('0x51')]['find'](_0x450582)[_0x4c69('0x32')](handleEntityNotFound(_0x1dab62,null))[_0x4c69('0x32')](respondWithResult(_0x1dab62,null))[_0x4c69('0x25')](handleError(_0x1dab62,null));};exports[_0x4c69('0x31')]=function(_0x47f487,_0x353cb2){if(_0x47f487[_0x4c69('0x52')]['id']){delete _0x47f487[_0x4c69('0x52')]['id'];}return db[_0x4c69('0x51')][_0x4c69('0x53')]({'where':{'id':_0x47f487['params']['id']}})[_0x4c69('0x32')](handleEntityNotFound(_0x353cb2,null))[_0x4c69('0x32')](saveUpdates(_0x47f487['body'],null))[_0x4c69('0x32')](respondWithResult(_0x353cb2,null))[_0x4c69('0x25')](handleError(_0x353cb2,null));};exports[_0x4c69('0x54')]=function(_0x5f032c,_0x1cc353,_0x1356e8){if(_0x5f032c['file']&&_0x5f032c[_0x4c69('0x55')][_0x4c69('0x56')]){_0x5f032c[_0x4c69('0x52')][_0x4c69('0x57')]=_0x5f032c[_0x4c69('0x55')]['filename'];}return db[_0x4c69('0x51')]['find']({'where':{'id':_0x5f032c[_0x4c69('0x4e')]['id']}})[_0x4c69('0x32')](handleEntityNotFound(_0x1cc353,null))['then'](saveUpdates(_0x5f032c[_0x4c69('0x52')],null))['then'](respondWithResult(_0x1cc353,null))[_0x4c69('0x25')](handleError(_0x1cc353,null));};exports[_0x4c69('0x58')]=function(_0x31da6b,_0x4bddad,_0x4313d1){if(_0x31da6b['file']&&_0x31da6b[_0x4c69('0x55')][_0x4c69('0x56')]){_0x31da6b[_0x4c69('0x52')][_0x4c69('0x59')]=_0x31da6b[_0x4c69('0x55')][_0x4c69('0x56')];}return db[_0x4c69('0x51')][_0x4c69('0x53')]({'where':{'id':_0x31da6b[_0x4c69('0x4e')]['id']}})[_0x4c69('0x32')](handleEntityNotFound(_0x4bddad,null))['then'](saveUpdates(_0x31da6b[_0x4c69('0x52')],null))[_0x4c69('0x32')](respondWithResult(_0x4bddad,null))[_0x4c69('0x25')](handleError(_0x4bddad,null));};var utilLicense=require(_0x4c69('0x18'));exports[_0x4c69('0x5a')]=function(_0x3052ef,_0x54324e,_0x4e7457){var _0x1346b0=_0x4c69('0x5b');var _0x1a31be={'custom':![]};return utilLicense['getLicense']()[_0x4c69('0x32')](function(_0x67220c){if(_0x67220c){_0x1a31be=_0x67220c;}return db['Setting']['find']({'where':{'id':_0x3052ef['params']['id']},'attributes':[_0x4c69('0x57'),'loginLogo','preferred',_0x4c69('0x5c'),_0x4c69('0x5d'),_0x4c69('0x5e'),_0x4c69('0x5f'),_0x4c69('0x60')],'raw':!![]});})[_0x4c69('0x32')](handleEntityNotFound(_0x54324e,null))[_0x4c69('0x32')](function(_0x32c9a5){if(_0x32c9a5){var _0x115f65=_0x32c9a5['logo']&&fs[_0x4c69('0x61')](path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x1346b0,_[_0x4c69('0x64')](_0x32c9a5['logo'])))?path[_0x4c69('0x62')](config['root'],_0x1346b0,_[_0x4c69('0x64')](_0x32c9a5['logo'])):path['join'](config[_0x4c69('0x63')],_0x1346b0,_[_0x4c69('0x64')](_0x4c69('0x65')));var _0x39b9af=_0x4c69('0x66')+_[_0x4c69('0x67')](_0x4c69('0x57'));if(_0x32c9a5[_0x39b9af]||!_0x1a31be[_0x4c69('0x68')]){_0x115f65=path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x1346b0,_[_0x4c69('0x64')](_0x4c69('0x65')));}if(!fs['existsSync'](_0x115f65)){throw new db['Sequelize']['ValidationError'](_[_0x4c69('0x67')](_0x4c69('0x57'))+_0x4c69('0x69'));}return _0x54324e['download'](_0x115f65);}})[_0x4c69('0x25')](handleError(_0x54324e,null));};var utilLicense=require(_0x4c69('0x18'));exports[_0x4c69('0x6a')]=function(_0x431af7,_0x2e864d,_0x3e8793){var _0x49ff19=_0x4c69('0x5b');var _0x505003={'custom':![]};return utilLicense[_0x4c69('0x6b')]()['then'](function(_0x5b0759){if(_0x5b0759){_0x505003=_0x5b0759;}return db['Setting'][_0x4c69('0x53')]({'where':{'id':_0x431af7[_0x4c69('0x4e')]['id']},'attributes':[_0x4c69('0x57'),_0x4c69('0x59'),_0x4c69('0x6c'),_0x4c69('0x5c'),_0x4c69('0x5d'),_0x4c69('0x5e'),_0x4c69('0x5f'),_0x4c69('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x2e864d,null))['then'](function(_0x5a5a86){if(_0x5a5a86){var _0x8e1c99=_0x5a5a86[_0x4c69('0x59')]&&fs[_0x4c69('0x61')](path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x49ff19,_[_0x4c69('0x64')](_0x5a5a86[_0x4c69('0x59')])))?path['join'](config['root'],_0x49ff19,_[_0x4c69('0x64')](_0x5a5a86[_0x4c69('0x59')])):path['join'](config[_0x4c69('0x63')],_0x49ff19,_[_0x4c69('0x64')](_0x4c69('0x6d')));var _0x2449ce='default'+_[_0x4c69('0x67')](_0x4c69('0x59'));if(_0x5a5a86[_0x2449ce]||!_0x505003['custom']){_0x8e1c99=path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x49ff19,_[_0x4c69('0x64')](_0x4c69('0x6d')));}if(!fs[_0x4c69('0x61')](_0x8e1c99)){throw new db[(_0x4c69('0x6e'))][(_0x4c69('0x6f'))](_[_0x4c69('0x67')](_0x4c69('0x59'))+_0x4c69('0x69'));}return _0x2e864d[_0x4c69('0x70')](_0x8e1c99);}})[_0x4c69('0x25')](handleError(_0x2e864d,null));};exports['gdpr']=function(_0x1c7e73,_0x92bc58){return db[_0x4c69('0x51')]['find']({'where':{'id':_0x1c7e73[_0x4c69('0x4e')]['id']},'attributes':[_0x4c69('0x71')]})[_0x4c69('0x32')](respondWithResult(_0x92bc58,null))[_0x4c69('0x25')](handleError(_0x92bc58,null));};exports['addPreferred']=function(_0x4bcb9e,_0x4a6724,_0x2fa2a2){if(_0x4bcb9e[_0x4c69('0x55')]&&_0x4bcb9e[_0x4c69('0x55')][_0x4c69('0x56')]){_0x4bcb9e[_0x4c69('0x52')][_0x4c69('0x6c')]=_0x4bcb9e[_0x4c69('0x55')][_0x4c69('0x56')];}return db[_0x4c69('0x51')]['find']({'where':{'id':_0x4bcb9e[_0x4c69('0x4e')]['id']}})[_0x4c69('0x32')](handleEntityNotFound(_0x4a6724,null))['then'](saveUpdates(_0x4bcb9e[_0x4c69('0x52')],null))[_0x4c69('0x32')](respondWithResult(_0x4a6724,null))['catch'](handleError(_0x4a6724,null));};var utilLicense=require(_0x4c69('0x18'));exports['getPreferred']=function(_0x245c87,_0x590574,_0x149b97){var _0x490d7f='server/files/images/logos';var _0xbd75e5={'custom':![]};return utilLicense[_0x4c69('0x6b')]()[_0x4c69('0x32')](function(_0x409584){if(_0x409584){_0xbd75e5=_0x409584;}return db[_0x4c69('0x51')]['find']({'where':{'id':_0x245c87[_0x4c69('0x4e')]['id']},'attributes':[_0x4c69('0x57'),_0x4c69('0x59'),_0x4c69('0x6c'),'favicon',_0x4c69('0x5d'),_0x4c69('0x5e'),'defaultPreferred',_0x4c69('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x590574,null))[_0x4c69('0x32')](function(_0x3ddca8){if(_0x3ddca8){var _0x489d90=_0x3ddca8[_0x4c69('0x6c')]&&fs[_0x4c69('0x61')](path[_0x4c69('0x62')](config['root'],_0x490d7f,_[_0x4c69('0x64')](_0x3ddca8[_0x4c69('0x6c')])))?path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x490d7f,_[_0x4c69('0x64')](_0x3ddca8['preferred'])):path['join'](config['root'],_0x490d7f,_[_0x4c69('0x64')](_0x4c69('0x72')));var _0x2063bf=_0x4c69('0x66')+_[_0x4c69('0x67')](_0x4c69('0x6c'));if(_0x3ddca8[_0x2063bf]||!_0xbd75e5[_0x4c69('0x68')]||!_0xbd75e5['preferred']){_0x489d90=path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x490d7f,_[_0x4c69('0x64')](_0x4c69('0x72')));}if(!fs[_0x4c69('0x61')](_0x489d90)){throw new db['Sequelize'][(_0x4c69('0x6f'))](_[_0x4c69('0x67')](_0x4c69('0x6c'))+_0x4c69('0x69'));}return _0x590574[_0x4c69('0x70')](_0x489d90);}})[_0x4c69('0x25')](handleError(_0x590574,null));};exports[_0x4c69('0x73')]=function(_0x43fbd5,_0x356854,_0x17364){if(_0x43fbd5[_0x4c69('0x55')]&&_0x43fbd5['file'][_0x4c69('0x56')]){_0x43fbd5[_0x4c69('0x52')][_0x4c69('0x5c')]=_0x43fbd5[_0x4c69('0x55')][_0x4c69('0x56')];}return db[_0x4c69('0x51')][_0x4c69('0x53')]({'where':{'id':_0x43fbd5['params']['id']}})['then'](handleEntityNotFound(_0x356854,null))[_0x4c69('0x32')](saveUpdates(_0x43fbd5[_0x4c69('0x52')],null))[_0x4c69('0x32')](respondWithResult(_0x356854,null))[_0x4c69('0x25')](handleError(_0x356854,null));};var utilLicense=require(_0x4c69('0x18'));exports['getFavicon']=function(_0x2c3188,_0x249065,_0x23de49){var _0x43539c=_0x4c69('0x5b');var _0x4f62c8={'custom':![]};return utilLicense[_0x4c69('0x6b')]()[_0x4c69('0x32')](function(_0x5ca322){if(_0x5ca322){_0x4f62c8=_0x5ca322;}return db[_0x4c69('0x51')]['find']({'where':{'id':_0x2c3188[_0x4c69('0x4e')]['id']},'attributes':[_0x4c69('0x57'),_0x4c69('0x59'),_0x4c69('0x6c'),_0x4c69('0x5c'),_0x4c69('0x5d'),_0x4c69('0x5e'),_0x4c69('0x5f'),_0x4c69('0x60')],'raw':!![]});})[_0x4c69('0x32')](handleEntityNotFound(_0x249065,null))[_0x4c69('0x32')](function(_0x4d06e5){if(_0x4d06e5){var _0x2e5512=_0x4d06e5[_0x4c69('0x5c')]&&fs[_0x4c69('0x61')](path[_0x4c69('0x62')](config[_0x4c69('0x63')],_0x43539c,_[_0x4c69('0x64')](_0x4d06e5['favicon'])))?path['join'](config[_0x4c69('0x63')],_0x43539c,_[_0x4c69('0x64')](_0x4d06e5[_0x4c69('0x5c')])):path[_0x4c69('0x62')](config['root'],_0x43539c,_[_0x4c69('0x64')](_0x4c69('0x74')));var _0x36f719=_0x4c69('0x66')+_[_0x4c69('0x67')](_0x4c69('0x5c'));if(_0x4d06e5[_0x36f719]||!_0x4f62c8['custom']){_0x2e5512=path['join'](config[_0x4c69('0x63')],_0x43539c,_['toLower']('default_favicon.ico'));}if(!fs[_0x4c69('0x61')](_0x2e5512)){throw new db[(_0x4c69('0x6e'))][(_0x4c69('0x6f'))](_['upperFirst'](_0x4c69('0x5c'))+'\x20not\x20found');}return _0x249065['download'](_0x2e5512);}})['catch'](handleError(_0x249065,null));};exports[_0x4c69('0x75')]=function(_0xf0b63a,_0x1b1daa){var _0x1815e0={'offset':moment()[_0x4c69('0x76')]()};_0x1815e0[_0x4c69('0x77')]=moment()[_0x4c69('0x76')](_0x1815e0['offset'])[_0x4c69('0x78')](_0x4c69('0x79'));return _0x1b1daa[_0x4c69('0x26')](0xc8)[_0x4c69('0x7a')](_0x1815e0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8e96c74..d765675 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(_0x181728,_0x471cc4){var _0x3525db=function(_0x59c05c){while(--_0x59c05c){_0x181728['push'](_0x181728['shift']());}};_0x3525db(++_0x471cc4);}(_0x3e74,0x175));var _0x43e7=function(_0x2c5b1,_0x38266c){_0x2c5b1=_0x2c5b1-0x0;var _0xb37513=_0x3e74[_0x2c5b1];return _0xb37513;};'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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x245505,_0x2cfe7b){var _0x424bcb=function(_0x10c8df){while(--_0x10c8df){_0x245505['push'](_0x245505['shift']());}};_0x424bcb(++_0x2cfe7b);}(_0x3e74,0x175));var _0x43e7=function(_0x1d3f69,_0x5caa96){_0x1d3f69=_0x1d3f69-0x0;var _0x9d899f=_0x3e74[_0x1d3f69];return _0x9d899f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ccf3866..f0352d6 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 _0xd3c8=['error','code','message','info','result','Setting','find','options','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0xd3c8,0xc8));var _0x8d3c=function(_0x55571d,_0x34e64f){_0x55571d=_0x55571d-0x0;var _0x51b619=_0xd3c8[_0x55571d];return _0x51b619;};'use strict';var _=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var moment=require(_0x8d3c('0x2'));var BPromise=require(_0x8d3c('0x3'));var rs=require(_0x8d3c('0x4'));var fs=require('fs');var Redis=require(_0x8d3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d3c('0x6'));var logger=require('../../config/logger')(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var jayson=require(_0x8d3c('0x9'));var client=jayson[_0x8d3c('0xa')][_0x8d3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f5c46,_0x252647,_0x57b7e9){return new BPromise(function(_0x565591,_0x428a74){return client['request'](_0x5f5c46,_0x57b7e9)[_0x8d3c('0xc')](function(_0x4f8b08){logger['info'](_0x8d3c('0xd'),_0x252647,_0x8d3c('0xe'));logger[_0x8d3c('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x252647,_0x8d3c('0xe'),JSON[_0x8d3c('0x10')](_0x4f8b08));if(_0x4f8b08[_0x8d3c('0x11')]){if(_0x4f8b08['error'][_0x8d3c('0x12')]===0x1f4){logger[_0x8d3c('0x11')](_0x8d3c('0xd'),_0x252647,_0x4f8b08[_0x8d3c('0x11')][_0x8d3c('0x13')]);return _0x428a74(_0x4f8b08[_0x8d3c('0x11')][_0x8d3c('0x13')]);}logger[_0x8d3c('0x11')](_0x8d3c('0xd'),_0x252647,_0x4f8b08[_0x8d3c('0x11')][_0x8d3c('0x13')]);return _0x565591(_0x4f8b08[_0x8d3c('0x11')]['message']);}else{logger[_0x8d3c('0x14')]('Setting,\x20%s,\x20%s',_0x252647,_0x8d3c('0xe'));_0x565591(_0x4f8b08[_0x8d3c('0x15')][_0x8d3c('0x13')]);}})['catch'](function(_0x4b75d2){logger[_0x8d3c('0x11')](_0x8d3c('0xd'),_0x252647,_0x4b75d2);_0x428a74(_0x4b75d2);});});}exports['ShowSetting']=function(_0x4b1856){var _0x427174=this;return new Promise(function(_0x119964,_0x3f4338){return db[_0x8d3c('0x16')][_0x8d3c('0x17')]({'raw':_0x4b1856[_0x8d3c('0x18')]?_0x4b1856[_0x8d3c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4b1856[_0x8d3c('0x18')]?_0x4b1856[_0x8d3c('0x18')][_0x8d3c('0x19')]||null:null,'attributes':_0x4b1856[_0x8d3c('0x18')]?_0x4b1856['options'][_0x8d3c('0x1a')]||null:null,'include':_0x4b1856[_0x8d3c('0x18')]?_0x4b1856[_0x8d3c('0x18')][_0x8d3c('0x1b')]?_[_0x8d3c('0x1c')](_0x4b1856['options']['include'],function(_0x2afeef){return{'model':db[_0x2afeef[_0x8d3c('0x1d')]],'as':_0x2afeef['as'],'attributes':_0x2afeef[_0x8d3c('0x1a')],'include':_0x2afeef[_0x8d3c('0x1b')]?_[_0x8d3c('0x1c')](_0x2afeef[_0x8d3c('0x1b')],function(_0x2c706c){return{'model':db[_0x2c706c[_0x8d3c('0x1d')]],'as':_0x2c706c['as'],'attributes':_0x2c706c[_0x8d3c('0x1a')],'include':_0x2c706c[_0x8d3c('0x1b')]?_['map'](_0x2c706c[_0x8d3c('0x1b')],function(_0x353127){return{'model':db[_0x353127[_0x8d3c('0x1d')]],'as':_0x353127['as'],'attributes':_0x353127['attributes']};}):[]};}):[]};}):[]:[]})[_0x8d3c('0xc')](function(_0x300f7f){logger[_0x8d3c('0x14')](_0x8d3c('0x1e'),_0x4b1856);logger[_0x8d3c('0xf')]('ShowSetting',_0x4b1856,JSON['stringify'](_0x300f7f));_0x119964(_0x300f7f);})['catch'](function(_0x298097){logger[_0x8d3c('0x11')](_0x8d3c('0x1e'),_0x298097[_0x8d3c('0x13')],_0x4b1856);_0x3f4338(_0x427174[_0x8d3c('0x11')](0x1f4,_0x298097[_0x8d3c('0x13')]));});});}; \ No newline at end of file +var _0x825d=['Setting,\x20%s,\x20%s,\x20%s','error','message','catch','ShowSetting','Setting','find','options','where','include','map','attributes','model','debug','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','then','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x3162b1,_0x4ae511){var _0x144344=function(_0x2df0cd){while(--_0x2df0cd){_0x3162b1['push'](_0x3162b1['shift']());}};_0x144344(++_0x4ae511);}(_0x825d,0x143));var _0xd825=function(_0x11e64a,_0x1333ad){_0x11e64a=_0x11e64a-0x0;var _0x48a502=_0x825d[_0x11e64a];return _0x48a502;};'use strict';var _=require(_0xd825('0x0'));var util=require(_0xd825('0x1'));var moment=require(_0xd825('0x2'));var BPromise=require(_0xd825('0x3'));var rs=require(_0xd825('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd825('0x5'));var logger=require(_0xd825('0x6'))('rpc');var config=require(_0xd825('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd825('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d72d9,_0x13e69b,_0x4a42f4){return new BPromise(function(_0x5d769b,_0x3343b4){return client['request'](_0x4d72d9,_0x4a42f4)[_0xd825('0x9')](function(_0x496447){logger[_0xd825('0xa')](_0xd825('0xb'),_0x13e69b,_0xd825('0xc'));logger['debug'](_0xd825('0xd'),_0x13e69b,'request\x20sent',JSON['stringify'](_0x496447));if(_0x496447[_0xd825('0xe')]){if(_0x496447['error']['code']===0x1f4){logger[_0xd825('0xe')]('Setting,\x20%s,\x20%s',_0x13e69b,_0x496447[_0xd825('0xe')][_0xd825('0xf')]);return _0x3343b4(_0x496447[_0xd825('0xe')][_0xd825('0xf')]);}logger[_0xd825('0xe')]('Setting,\x20%s,\x20%s',_0x13e69b,_0x496447[_0xd825('0xe')][_0xd825('0xf')]);return _0x5d769b(_0x496447[_0xd825('0xe')][_0xd825('0xf')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x13e69b,_0xd825('0xc'));_0x5d769b(_0x496447['result']['message']);}})[_0xd825('0x10')](function(_0x3d8dca){logger[_0xd825('0xe')]('Setting,\x20%s,\x20%s',_0x13e69b,_0x3d8dca);_0x3343b4(_0x3d8dca);});});}exports[_0xd825('0x11')]=function(_0x37cebf){var _0x4c6ced=this;return new Promise(function(_0xc6f116,_0x454546){return db[_0xd825('0x12')][_0xd825('0x13')]({'raw':_0x37cebf[_0xd825('0x14')]?_0x37cebf[_0xd825('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x37cebf[_0xd825('0x14')]?_0x37cebf['options'][_0xd825('0x15')]||null:null,'attributes':_0x37cebf[_0xd825('0x14')]?_0x37cebf['options']['attributes']||null:null,'include':_0x37cebf[_0xd825('0x14')]?_0x37cebf[_0xd825('0x14')][_0xd825('0x16')]?_[_0xd825('0x17')](_0x37cebf['options']['include'],function(_0x46a818){return{'model':db[_0x46a818['model']],'as':_0x46a818['as'],'attributes':_0x46a818[_0xd825('0x18')],'include':_0x46a818[_0xd825('0x16')]?_[_0xd825('0x17')](_0x46a818[_0xd825('0x16')],function(_0x260a5){return{'model':db[_0x260a5[_0xd825('0x19')]],'as':_0x260a5['as'],'attributes':_0x260a5[_0xd825('0x18')],'include':_0x260a5[_0xd825('0x16')]?_[_0xd825('0x17')](_0x260a5[_0xd825('0x16')],function(_0x5301d9){return{'model':db[_0x5301d9[_0xd825('0x19')]],'as':_0x5301d9['as'],'attributes':_0x5301d9[_0xd825('0x18')]};}):[]};}):[]};}):[]:[]})[_0xd825('0x9')](function(_0x4b3944){logger[_0xd825('0xa')](_0xd825('0x11'),_0x37cebf);logger[_0xd825('0x1a')]('ShowSetting',_0x37cebf,JSON[_0xd825('0x1b')](_0x4b3944));_0xc6f116(_0x4b3944);})[_0xd825('0x10')](function(_0x149cee){logger[_0xd825('0xe')](_0xd825('0x11'),_0x149cee[_0xd825('0xf')],_0x37cebf);_0x454546(_0x4c6ced[_0xd825('0xe')](0x1f4,_0x149cee[_0xd825('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b2ab8c7..69d7796 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x9b671e,_0xca4c8b){var _0x43e533=function(_0x278447){while(--_0x278447){_0x9b671e['push'](_0x9b671e['shift']());}};_0x43e533(++_0xca4c8b);}(_0xabce,0x103));var _0xeabc=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xabce[_0x92c450];return _0x2a9599;};'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('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x2c4540,_0x2859d2){var _0x527b47=function(_0x2a73e5){while(--_0x2a73e5){_0x2c4540['push'](_0x2c4540['shift']());}};_0x527b47(++_0x2859d2);}(_0x6aa7,0x178));var _0x76aa=function(_0x27dcca,_0x16d4dd){_0x27dcca=_0x27dcca-0x0;var _0x1b10f7=_0x6aa7[_0x27dcca];return _0x1b10f7;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('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 b6a677f..148f33e 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 _0x7cb0=['mandatoryDispositionPauseId','sequelize','randomstring','name','STRING','generate','ENUM','skebby','connectel','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xa1db78,_0x4515df){var _0x441bd6=function(_0x9ce953){while(--_0x9ce953){_0xa1db78['push'](_0xa1db78['shift']());}};_0x441bd6(++_0x4515df);}(_0x7cb0,0x79));var _0x07cb=function(_0x290201,_0x279632){_0x290201=_0x290201-0x0;var _0x3d5c08=_0x7cb0[_0x290201];return _0x3d5c08;};'use strict';var Sequelize=require(_0x07cb('0x0'));var rs=require(_0x07cb('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x07cb('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x07cb('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x07cb('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x07cb('0x3')],'defaultValue':function(){return rs[_0x07cb('0x4')]();}},'phone':{'type':Sequelize[_0x07cb('0x3')]},'type':{'type':Sequelize[_0x07cb('0x5')]('twilio',_0x07cb('0x6'),_0x07cb('0x7'),'clicksend','plivo',_0x07cb('0x8'),_0x07cb('0x9'),_0x07cb('0xa'),'infobip',_0x07cb('0xb'))},'accountSid':{'type':Sequelize[_0x07cb('0x3')]},'authId':{'type':Sequelize[_0x07cb('0x3')]},'authToken':{'type':Sequelize[_0x07cb('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x07cb('0x3')]},'password':{'type':Sequelize[_0x07cb('0x3')]},'apiKey':{'type':Sequelize[_0x07cb('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x07cb('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x07cb('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x07cb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x07cb('0xd')],'defaultValue':function(){return _0x07cb('0xe');}},'notificationSound':{'type':Sequelize[_0x07cb('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x07cb('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x07cb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x07cb('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x07cb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x07cb('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x07cb('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x07cb('0xf')],'comment':_0x07cb('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x07cb('0xc')],'defaultValue':![],'comment':_0x07cb('0x11'),'set':function(_0x117f5c){if(!_0x117f5c)this[_0x07cb('0x12')](_0x07cb('0x13'),null);this[_0x07cb('0x12')]('mandatoryDisposition',_0x117f5c);}}}; \ No newline at end of file +var _0x130c=['bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x130c,0x1ae));var _0xc130=function(_0x550e8f,_0x4bba5c){_0x550e8f=_0x550e8f-0x0;var _0x3e67a7=_0x130c[_0x550e8f];return _0x3e67a7;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xc130('0x0'));module[_0xc130('0x1')]={'name':{'type':Sequelize[_0xc130('0x2')],'unique':_0xc130('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc130('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc130('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc130('0x4')]();}},'phone':{'type':Sequelize[_0xc130('0x2')]},'type':{'type':Sequelize[_0xc130('0x5')](_0xc130('0x6'),_0xc130('0x7'),_0xc130('0x8'),'clicksend',_0xc130('0x9'),'clickatell',_0xc130('0xa'),_0xc130('0xb'),_0xc130('0xc'),_0xc130('0xd'))},'accountSid':{'type':Sequelize[_0xc130('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xc130('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xc130('0x2')]},'password':{'type':Sequelize[_0xc130('0x2')]},'apiKey':{'type':Sequelize[_0xc130('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xc130('0x2')]},'deliveryReport':{'type':Sequelize[_0xc130('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0xc130('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc130('0xf')],'defaultValue':function(){return _0xc130('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc130('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc130('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc130('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc130('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc130('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc130('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc130('0x11')],'comment':_0xc130('0x12')},'mandatoryDisposition':{'type':Sequelize[_0xc130('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x130f87){if(!_0x130f87)this[_0xc130('0x13')](_0xc130('0x14'),null);this['setDataValue'](_0xc130('0x15'),_0x130f87);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 999efa2..c2603e4 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 _0x91ac=['zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','params','keys','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','order','pick','removeDispositions','ids','CannedAnswer','rows','removeAnswers','notify','Applications','account','applications','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','sender','text','connectel','message_id','MessageUUID','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','autoclose','push','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','CmList','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','infobip','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','User','eml-format'];(function(_0x601c7d,_0x2208d7){var _0x885c7e=function(_0x1a8dd1){while(--_0x1a8dd1){_0x601c7d['push'](_0x601c7d['shift']());}};_0x885c7e(++_0x2208d7);}(_0x91ac,0xe7));var _0xc91a=function(_0x98c64,_0x5d246d){_0x98c64=_0x98c64-0x0;var _0x1201e8=_0x91ac[_0x98c64];return _0x1201e8;};'use strict';var emlformat=require(_0xc91a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc91a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc91a('0x2'));var moment=require(_0xc91a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc91a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc91a('0x5'));var csv=require(_0xc91a('0x6'));var ejs=require(_0xc91a('0x7'));var fs=require('fs');var fs_extra=require(_0xc91a('0x8'));var _=require(_0xc91a('0x9'));var squel=require(_0xc91a('0xa'));var crypto=require(_0xc91a('0xb'));var jsforce=require(_0xc91a('0xc'));var deskjs=require(_0xc91a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc91a('0xe'));var Papa=require(_0xc91a('0xf'));var Redis=require(_0xc91a('0x10'));var authService=require(_0xc91a('0x11'));var qs=require(_0xc91a('0x12'));var as=require(_0xc91a('0x13'));var hardwareService=require(_0xc91a('0x14'));var logger=require(_0xc91a('0x15'))(_0xc91a('0x16'));var utils=require(_0xc91a('0x17'));var config=require(_0xc91a('0x18'));var licenseUtil=require(_0xc91a('0x19'));var db=require(_0xc91a('0x1a'))['db'];config['redis']=_[_0xc91a('0x1b')](config[_0xc91a('0x1c')],{'host':_0xc91a('0x1d'),'port':0x18eb});var socket=require(_0xc91a('0x1e'))(new Redis(config[_0xc91a('0x1c')]));require(_0xc91a('0x1f'))[_0xc91a('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xc91a('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x52389d,_0x1f0a06,_0x3c4534,_0x26d8e1){return new BPromise(function(_0x103dd4,_0x260da4){var _0x2a33c0=_0x26d8e1||client;return _0x2a33c0[_0xc91a('0x22')](_0x52389d,_0x3c4534)[_0xc91a('0x23')](function(_0x5de2fe){logger[_0xc91a('0x24')](_0xc91a('0x25'),_0x1f0a06,_0xc91a('0x26'));logger[_0xc91a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1f0a06,_0xc91a('0x26'),JSON[_0xc91a('0x28')](_0x5de2fe));if(_0x5de2fe[_0xc91a('0x29')]){if(_0x5de2fe[_0xc91a('0x29')][_0xc91a('0x2a')]===0x1f4){logger[_0xc91a('0x29')](_0xc91a('0x25'),_0x1f0a06,_0x5de2fe[_0xc91a('0x29')][_0xc91a('0x2b')]);return _0x260da4(_0x5de2fe[_0xc91a('0x29')][_0xc91a('0x2b')]);}logger[_0xc91a('0x29')](_0xc91a('0x25'),_0x1f0a06,_0x5de2fe['error'][_0xc91a('0x2b')]);return _0x103dd4(_0x5de2fe[_0xc91a('0x29')][_0xc91a('0x2b')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1f0a06,_0xc91a('0x26'));_0x103dd4(_0x5de2fe['result'][_0xc91a('0x2b')]);}})['catch'](function(_0xce6e28){logger[_0xc91a('0x29')](_0xc91a('0x25'),_0x1f0a06,_0xce6e28);_0x260da4(_0xce6e28);});});}function respondWithStatusCode(_0x586567,_0x2f0568){_0x2f0568=_0x2f0568||0xcc;return function(_0x4e7d13){if(_0x4e7d13){return _0x586567[_0xc91a('0x2c')](_0x2f0568);}return _0x586567['status'](_0x2f0568)[_0xc91a('0x2d')]();};}function respondWithResult(_0x4e42e1,_0x44cbfd){_0x44cbfd=_0x44cbfd||0xc8;return function(_0x50f980){if(_0x50f980){return _0x4e42e1['status'](_0x44cbfd)[_0xc91a('0x2e')](_0x50f980);}};}function respondWithFilteredResult(_0x63eb19,_0x5b2f64){return function(_0x5c8d93){if(_0x5c8d93){var _0x1770b2=typeof _0x5b2f64[_0xc91a('0x2f')]===_0xc91a('0x30')&&typeof _0x5b2f64[_0xc91a('0x31')]===_0xc91a('0x30');var _0x306ce9=_0x5c8d93['count'];var _0x37b3d0=_0x1770b2?0x0:_0x5b2f64[_0xc91a('0x2f')];var _0x291292=_0x1770b2?_0x5c8d93[_0xc91a('0x32')]:_0x5b2f64[_0xc91a('0x2f')]+_0x5b2f64['limit'];var _0x325088;if(_0x291292>=_0x306ce9){_0x291292=_0x306ce9;_0x325088=0xc8;}else{_0x325088=0xce;}_0x63eb19[_0xc91a('0x33')](_0x325088);return _0x63eb19[_0xc91a('0x34')](_0xc91a('0x35'),_0x37b3d0+'-'+_0x291292+'/'+_0x306ce9)['json'](_0x5c8d93);}return null;};}function patchUpdates(_0x4f7e28){return function(_0x2947cf){try{jsonpatch[_0xc91a('0x36')](_0x2947cf,_0x4f7e28,!![]);}catch(_0x596c77){return BPromise['reject'](_0x596c77);}return _0x2947cf['save']();};}function saveUpdates(_0xa26956,_0x4f15c0){return function(_0x169364){if(_0x169364){return _0x169364[_0xc91a('0x37')](_0xa26956)[_0xc91a('0x23')](function(_0x1acd1c){return _0x1acd1c;});}return null;};}function removeEntity(_0x42000d,_0x22859f){return function(_0x3a31e8){if(_0x3a31e8){return _0x3a31e8[_0xc91a('0x38')]()[_0xc91a('0x23')](function(){var _0x523a3d=_0x3a31e8[_0xc91a('0x39')]({'plain':!![]});var _0x15c064=_0xc91a('0x3a');return db['UserProfileResource'][_0xc91a('0x38')]({'where':{'type':_0x15c064,'resourceId':_0x523a3d['id']}})['then'](function(){return _0x3a31e8;});})[_0xc91a('0x23')](function(){_0x42000d['status'](0xcc)[_0xc91a('0x2d')]();});}};}function handleEntityNotFound(_0x17df87,_0x2e7838){return function(_0x1f0208){if(!_0x1f0208){_0x17df87[_0xc91a('0x2c')](0x194);}return _0x1f0208;};}function handleError(_0x4b6714,_0x4b28d9){_0x4b28d9=_0x4b28d9||0x1f4;return function(_0x924bdb){logger['error'](_0x924bdb[_0xc91a('0x3b')]);if(_0x924bdb['name']){delete _0x924bdb[_0xc91a('0x3c')];}_0x4b6714[_0xc91a('0x33')](_0x4b28d9)[_0xc91a('0x3d')](_0x924bdb);};}exports[_0xc91a('0x3e')]=function(_0x40a52d,_0x2baa9f){var _0x354704={'include':[{'model':db[_0xc91a('0x3f')],'as':_0xc91a('0x40')}]},_0x492da9={},_0x1fb3e8={'count':0x0,'rows':[]};var _0x2778ea=_[_0xc91a('0x41')](db[_0xc91a('0x42')][_0xc91a('0x43')],function(_0x2ff2b7){return{'name':_0x2ff2b7[_0xc91a('0x44')],'type':_0x2ff2b7['type'][_0xc91a('0x45')]};});_0x492da9[_0xc91a('0x46')]=_[_0xc91a('0x41')](_0x2778ea,'name');_0x492da9[_0xc91a('0x47')]=_['keys'](_0x40a52d[_0xc91a('0x47')]);_0x492da9[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0x492da9[_0xc91a('0x46')],_0x492da9[_0xc91a('0x47')]);_0x354704[_0xc91a('0x4a')]=_[_0xc91a('0x49')](_0x492da9[_0xc91a('0x46')],qs[_0xc91a('0x4b')](_0x40a52d['query'][_0xc91a('0x4b')]));_0x354704[_0xc91a('0x4a')]=_0x354704['attributes'][_0xc91a('0x4c')]?_0x354704[_0xc91a('0x4a')]:_0x492da9[_0xc91a('0x46')];if(!_0x40a52d[_0xc91a('0x47')][_0xc91a('0x4d')](_0xc91a('0x4e'))){_0x354704[_0xc91a('0x31')]=qs[_0xc91a('0x31')](_0x40a52d[_0xc91a('0x47')][_0xc91a('0x31')]);_0x354704[_0xc91a('0x2f')]=qs['offset'](_0x40a52d[_0xc91a('0x47')][_0xc91a('0x2f')]);}_0x354704['order']=qs[_0xc91a('0x4f')](_0x40a52d[_0xc91a('0x47')][_0xc91a('0x4f')]);_0x354704[_0xc91a('0x50')]=qs['filters'](_['pick'](_0x40a52d['query'],_0x492da9[_0xc91a('0x48')]),_0x2778ea);if(_0x40a52d['query'][_0xc91a('0x51')]){_0x354704[_0xc91a('0x50')]=_[_0xc91a('0x52')](_0x354704[_0xc91a('0x50')],{'$or':_[_0xc91a('0x41')](_0x2778ea,function(_0x3cb8f8){if(_0x3cb8f8[_0xc91a('0x53')]!==_0xc91a('0x54')){var _0xe19a57={};_0xe19a57[_0x3cb8f8[_0xc91a('0x3c')]]={'$like':'%'+_0x40a52d[_0xc91a('0x47')][_0xc91a('0x51')]+'%'};return _0xe19a57;}})});}_0x354704=_[_0xc91a('0x52')]({},_0x354704,_0x40a52d[_0xc91a('0x55')]);var _0x198ba1={'where':_0x354704['where']};return db['SmsAccount'][_0xc91a('0x32')](_0x198ba1)[_0xc91a('0x23')](function(_0x7c4cb5){_0x1fb3e8[_0xc91a('0x32')]=_0x7c4cb5;if(_0x40a52d[_0xc91a('0x47')]['includeAll']){_0x354704[_0xc91a('0x56')]=[{'all':!![]}];}return db[_0xc91a('0x42')][_0xc91a('0x57')](_0x354704);})[_0xc91a('0x23')](function(_0x417e66){_0x1fb3e8['rows']=_0x417e66;return _0x1fb3e8;})[_0xc91a('0x23')](respondWithFilteredResult(_0x2baa9f,_0x354704))['catch'](handleError(_0x2baa9f,null));};exports['show']=function(_0x5dfe2d,_0x531a06){var _0x352e0b={'raw':![],'where':{'id':_0x5dfe2d[_0xc91a('0x58')]['id']},'include':[{'model':db[_0xc91a('0x3f')],'as':_0xc91a('0x40')}]},_0x34a66f={};_0x34a66f[_0xc91a('0x46')]=_['keys'](db[_0xc91a('0x42')][_0xc91a('0x43')]);_0x34a66f[_0xc91a('0x47')]=_[_0xc91a('0x59')](_0x5dfe2d[_0xc91a('0x47')]);_0x34a66f[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0x34a66f[_0xc91a('0x46')],_0x34a66f['query']);_0x352e0b[_0xc91a('0x4a')]=_[_0xc91a('0x49')](_0x34a66f[_0xc91a('0x46')],qs[_0xc91a('0x4b')](_0x5dfe2d[_0xc91a('0x47')][_0xc91a('0x4b')]));_0x352e0b[_0xc91a('0x4a')]=_0x352e0b[_0xc91a('0x4a')][_0xc91a('0x4c')]?_0x352e0b[_0xc91a('0x4a')]:_0x34a66f[_0xc91a('0x46')];if(_0x5dfe2d['query'][_0xc91a('0x5a')]){_0x352e0b['include']=[{'all':!![]}];}_0x352e0b=_[_0xc91a('0x52')]({},_0x352e0b,_0x5dfe2d[_0xc91a('0x55')]);return db[_0xc91a('0x42')]['find'](_0x352e0b)[_0xc91a('0x23')](handleEntityNotFound(_0x531a06,null))[_0xc91a('0x23')](respondWithResult(_0x531a06,null))['catch'](handleError(_0x531a06,null));};exports['create']=function(_0x3a4272,_0x5b8535){return db['SmsAccount'][_0xc91a('0x5b')](_0x3a4272['body'],{})[_0xc91a('0x23')](function(_0x23efcc){var _0x1e03d4=_0x3a4272[_0xc91a('0x5c')]['get']({'plain':!![]});if(!_0x1e03d4)throw new Error(_0xc91a('0x5d'));if(_0x1e03d4[_0xc91a('0x5e')]===_0xc91a('0x5c')){var _0x2629bb=_0x23efcc[_0xc91a('0x39')]({'plain':!![]});var _0x41fd92=_0xc91a('0x3a');return db[_0xc91a('0x5f')][_0xc91a('0x60')]({'where':{'name':_0x41fd92,'userProfileId':_0x1e03d4[_0xc91a('0x61')]},'raw':!![]})[_0xc91a('0x23')](function(_0x1861c5){if(_0x1861c5&&_0x1861c5[_0xc91a('0x62')]===0x0){return db['UserProfileResource']['create']({'name':_0x2629bb[_0xc91a('0x3c')],'resourceId':_0x2629bb['id'],'type':_0x1861c5[_0xc91a('0x3c')],'sectionId':_0x1861c5['id']},{})[_0xc91a('0x23')](function(){return _0x23efcc;});}else{return _0x23efcc;}})[_0xc91a('0x63')](function(_0x29a0f3){logger[_0xc91a('0x29')](_0xc91a('0x64'),_0x29a0f3);throw _0x29a0f3;});}return _0x23efcc;})[_0xc91a('0x23')](respondWithResult(_0x5b8535,0xc9))[_0xc91a('0x63')](handleError(_0x5b8535,null));};exports[_0xc91a('0x37')]=function(_0x52eb27,_0xb148b2){if(_0x52eb27[_0xc91a('0x65')]['id']){delete _0x52eb27[_0xc91a('0x65')]['id'];}return db[_0xc91a('0x42')]['find']({'where':{'id':_0x52eb27[_0xc91a('0x58')]['id']},'include':[{'model':db[_0xc91a('0x3f')],'as':_0xc91a('0x40')}]})[_0xc91a('0x23')](handleEntityNotFound(_0xb148b2,null))[_0xc91a('0x23')](saveUpdates(_0x52eb27[_0xc91a('0x65')],null))[_0xc91a('0x23')](respondWithResult(_0xb148b2,null))[_0xc91a('0x63')](handleError(_0xb148b2,null));};exports['destroy']=function(_0x2aaf59,_0x3ef736){return db['SmsAccount'][_0xc91a('0x60')]({'where':{'id':_0x2aaf59[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x3ef736,null))[_0xc91a('0x23')](removeEntity(_0x3ef736,null))[_0xc91a('0x63')](handleError(_0x3ef736,null));};exports[_0xc91a('0x66')]=function(_0x263506,_0x25a71b){return db[_0xc91a('0x42')][_0xc91a('0x66')]()[_0xc91a('0x23')](respondWithResult(_0x25a71b,null))[_0xc91a('0x63')](handleError(_0x25a71b,null));};exports[_0xc91a('0x67')]=function(_0x190cb8,_0xe09644,_0x56faa7){if(_0x190cb8[_0xc91a('0x65')]['id']){delete _0x190cb8[_0xc91a('0x65')]['id'];}return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0x190cb8[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0xe09644,null))[_0xc91a('0x23')](function(_0x2544c5){if(_0x2544c5){_0x190cb8[_0xc91a('0x65')][_0xc91a('0x68')]=_0x2544c5['id'];return db[_0xc91a('0x69')][_0xc91a('0x5b')](_0x190cb8[_0xc91a('0x65')]);}})[_0xc91a('0x23')](respondWithResult(_0xe09644,null))[_0xc91a('0x63')](handleError(_0xe09644,null));};exports[_0xc91a('0x6a')]=function(_0x335333,_0x3938af,_0x5e0122){var _0xa37432={'raw':![],'where':{}};var _0x3bb5cc={};var _0x4c7172={'count':0x0,'rows':[]};return db[_0xc91a('0x42')][_0xc91a('0x6b')]({'where':{'id':_0x335333[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x3938af,null))[_0xc91a('0x23')](function(_0x7393a7){if(_0x7393a7){_0x3bb5cc['model']=_['keys'](db[_0xc91a('0x69')][_0xc91a('0x43')]);_0x3bb5cc[_0xc91a('0x47')]=_['keys'](_0x335333[_0xc91a('0x47')]);_0x3bb5cc[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0x3bb5cc[_0xc91a('0x46')],_0x3bb5cc['query']);_0xa37432[_0xc91a('0x4a')]=_[_0xc91a('0x49')](_0x3bb5cc[_0xc91a('0x46')],qs[_0xc91a('0x4b')](_0x335333[_0xc91a('0x47')][_0xc91a('0x4b')]));_0xa37432[_0xc91a('0x4a')]=_0xa37432['attributes']['length']?_0xa37432['attributes']:_0x3bb5cc[_0xc91a('0x46')];if(!_0x335333['query'][_0xc91a('0x4d')](_0xc91a('0x4e'))){_0xa37432[_0xc91a('0x31')]=qs['limit'](_0x335333[_0xc91a('0x47')][_0xc91a('0x31')]);_0xa37432[_0xc91a('0x2f')]=qs[_0xc91a('0x2f')](_0x335333['query'][_0xc91a('0x2f')]);}_0xa37432[_0xc91a('0x6c')]=qs[_0xc91a('0x4f')](_0x335333[_0xc91a('0x47')][_0xc91a('0x4f')]);_0xa37432[_0xc91a('0x50')]=qs['filters'](_[_0xc91a('0x6d')](_0x335333[_0xc91a('0x47')],_0x3bb5cc[_0xc91a('0x48')]));_0xa37432[_0xc91a('0x50')][_0xc91a('0x68')]=_0x7393a7['id'];if(_0x335333[_0xc91a('0x47')][_0xc91a('0x51')]){_0xa37432['where']=_[_0xc91a('0x52')](_0xa37432['where'],{'$or':_[_0xc91a('0x41')](_0xa37432[_0xc91a('0x4a')],function(_0x17bde7){var _0x14bd03={};_0x14bd03[_0x17bde7]={'$like':'%'+_0x335333[_0xc91a('0x47')][_0xc91a('0x51')]+'%'};return _0x14bd03;})});}_0xa37432=_[_0xc91a('0x52')]({},_0xa37432,_0x335333[_0xc91a('0x55')]);return db[_0xc91a('0x69')][_0xc91a('0x32')]({'where':_0xa37432[_0xc91a('0x50')]})['then'](function(_0x45dfe7){_0x4c7172[_0xc91a('0x32')]=_0x45dfe7;if(_0x335333[_0xc91a('0x47')][_0xc91a('0x5a')]){_0xa37432[_0xc91a('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xc91a('0x57')](_0xa37432);})[_0xc91a('0x23')](function(_0x3020e3){_0x4c7172['rows']=_0x3020e3;return _0x4c7172;});}})[_0xc91a('0x23')](respondWithFilteredResult(_0x3938af,_0xa37432))['catch'](handleError(_0x3938af,null));};exports[_0xc91a('0x6e')]=function(_0x2f1fd1,_0x5a1c02,_0x3536a4){return db['SmsAccount'][_0xc91a('0x60')]({'where':{'id':_0x2f1fd1['params']['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x5a1c02,null))['then'](function(_0x209480){if(_0x209480){return _0x209480['removeDispositions'](_0x2f1fd1[_0xc91a('0x47')][_0xc91a('0x6f')]);}})[_0xc91a('0x23')](respondWithStatusCode(_0x5a1c02,null))[_0xc91a('0x63')](handleError(_0x5a1c02,null));};exports['addAnswer']=function(_0x5c98c6,_0x46bbe9,_0x38b76a){if(_0x5c98c6[_0xc91a('0x65')]['id']){delete _0x5c98c6[_0xc91a('0x65')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5c98c6[_0xc91a('0x58')]['id']}})['then'](handleEntityNotFound(_0x46bbe9,null))['then'](function(_0x4a6874){if(_0x4a6874){_0x5c98c6[_0xc91a('0x65')][_0xc91a('0x68')]=_0x4a6874['id'];return db[_0xc91a('0x70')]['create'](_0x5c98c6['body']);}})[_0xc91a('0x23')](respondWithResult(_0x46bbe9,null))[_0xc91a('0x63')](handleError(_0x46bbe9,null));};exports['getAnswers']=function(_0x5a06ac,_0xa29f4f,_0x2416cd){var _0x392fc4={'raw':![],'where':{}};var _0x3b04fd={};var _0x53181c={'count':0x0,'rows':[]};return db[_0xc91a('0x42')][_0xc91a('0x6b')]({'where':{'id':_0x5a06ac['params']['id']}})['then'](handleEntityNotFound(_0xa29f4f,null))['then'](function(_0x543532){if(_0x543532){_0x3b04fd[_0xc91a('0x46')]=_[_0xc91a('0x59')](db[_0xc91a('0x70')]['rawAttributes']);_0x3b04fd[_0xc91a('0x47')]=_[_0xc91a('0x59')](_0x5a06ac[_0xc91a('0x47')]);_0x3b04fd[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0x3b04fd['model'],_0x3b04fd[_0xc91a('0x47')]);_0x392fc4['attributes']=_[_0xc91a('0x49')](_0x3b04fd[_0xc91a('0x46')],qs[_0xc91a('0x4b')](_0x5a06ac[_0xc91a('0x47')]['fields']));_0x392fc4[_0xc91a('0x4a')]=_0x392fc4[_0xc91a('0x4a')][_0xc91a('0x4c')]?_0x392fc4[_0xc91a('0x4a')]:_0x3b04fd[_0xc91a('0x46')];if(!_0x5a06ac['query'][_0xc91a('0x4d')](_0xc91a('0x4e'))){_0x392fc4[_0xc91a('0x31')]=qs[_0xc91a('0x31')](_0x5a06ac[_0xc91a('0x47')][_0xc91a('0x31')]);_0x392fc4[_0xc91a('0x2f')]=qs[_0xc91a('0x2f')](_0x5a06ac[_0xc91a('0x47')][_0xc91a('0x2f')]);}_0x392fc4['order']=qs[_0xc91a('0x4f')](_0x5a06ac[_0xc91a('0x47')][_0xc91a('0x4f')]);_0x392fc4[_0xc91a('0x50')]=qs['filters'](_[_0xc91a('0x6d')](_0x5a06ac[_0xc91a('0x47')],_0x3b04fd[_0xc91a('0x48')]));_0x392fc4[_0xc91a('0x50')]['SmsAccountId']=_0x543532['id'];if(_0x5a06ac[_0xc91a('0x47')][_0xc91a('0x51')]){_0x392fc4['where']=_[_0xc91a('0x52')](_0x392fc4['where'],{'$or':_[_0xc91a('0x41')](_0x392fc4[_0xc91a('0x4a')],function(_0x90e89f){var _0x99c59f={};_0x99c59f[_0x90e89f]={'$like':'%'+_0x5a06ac[_0xc91a('0x47')]['filter']+'%'};return _0x99c59f;})});}_0x392fc4=_[_0xc91a('0x52')]({},_0x392fc4,_0x5a06ac[_0xc91a('0x55')]);return db[_0xc91a('0x70')][_0xc91a('0x32')]({'where':_0x392fc4[_0xc91a('0x50')]})['then'](function(_0x5d3a9e){_0x53181c[_0xc91a('0x32')]=_0x5d3a9e;if(_0x5a06ac['query'][_0xc91a('0x5a')]){_0x392fc4[_0xc91a('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc91a('0x57')](_0x392fc4);})[_0xc91a('0x23')](function(_0x45a66a){_0x53181c[_0xc91a('0x71')]=_0x45a66a;return _0x53181c;});}})[_0xc91a('0x23')](respondWithFilteredResult(_0xa29f4f,_0x392fc4))[_0xc91a('0x63')](handleError(_0xa29f4f,null));};exports['removeAnswers']=function(_0x192c5a,_0x1ed7ab,_0x3ae57e){return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0x192c5a[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x1ed7ab,null))[_0xc91a('0x23')](function(_0x4e998b){if(_0x4e998b){return _0x4e998b[_0xc91a('0x72')](_0x192c5a[_0xc91a('0x47')][_0xc91a('0x6f')]);}})[_0xc91a('0x23')](respondWithStatusCode(_0x1ed7ab,null))[_0xc91a('0x63')](handleError(_0x1ed7ab,null));};exports[_0xc91a('0x73')]=function(_0x2a7359,_0x13e769,_0x16a1c6){var _0x3796cf={'channel':'sms'};var _0x499c30=[];var _0x50a291=[];var _0x2b98ce={};return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0x2a7359[_0xc91a('0x58')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xc91a('0x74')}]})[_0xc91a('0x23')](handleEntityNotFound(_0x13e769,null))[_0xc91a('0x23')](function(_0x2acd39){_0x3796cf[_0xc91a('0x75')]=_0x2acd39;_0x3796cf[_0xc91a('0x76')]=_[_0xc91a('0x77')](_0x2acd39[_0xc91a('0x74')],['priority'],[_0xc91a('0x78')]);if(_0x3796cf[_0xc91a('0x75')][_0xc91a('0x74')]){delete _0x3796cf[_0xc91a('0x75')][_0xc91a('0x74')];}return db[_0xc91a('0x79')][_0xc91a('0x66')]();})['then'](function(_0x33dfe2){if(!_0x33dfe2){throw new db[(_0xc91a('0x7a'))]['ValidationError'](_0xc91a('0x7b'));}_0x499c30=_[_0xc91a('0x7c')](_[_0xc91a('0x59')](_0x33dfe2),['createdAt',_0xc91a('0x7d')]);_0x50a291=_['difference'](_['keys'](_0x33dfe2),['createdAt','updatedAt',_0xc91a('0x7e'),_0xc91a('0x7f')]);_0x3796cf[_0xc91a('0x65')]={'mapKey':_0xc91a('0x80')};if(_0x3796cf[_0xc91a('0x75')][_0xc91a('0x53')]){switch(_0x3796cf[_0xc91a('0x75')][_0xc91a('0x53')]){case _0xc91a('0x81'):_0x3796cf['body'][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')]['From'];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x83')];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x84')]=_0x2a7359['body'][_0xc91a('0x85')];break;case'skebby':_0x3796cf['body'][_0xc91a('0x82')]='+'+_0x2a7359[_0xc91a('0x65')][_0xc91a('0x86')];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x87')];break;case _0xc91a('0x88'):_0x3796cf[_0xc91a('0x65')]['from']=_0x2a7359[_0xc91a('0x65')]['from'];_0x3796cf['body'][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x2b')];break;case'clicksend':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x82')];_0x3796cf['body']['body']=_0x2a7359['body']['body'];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x84')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x89')];break;case'plivo':_0x3796cf[_0xc91a('0x65')]['from']=_0x2a7359[_0xc91a('0x65')]['From'];_0x3796cf[_0xc91a('0x65')]['body']=_0x2a7359[_0xc91a('0x65')]['Text'];_0x3796cf['body'][_0xc91a('0x84')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x8a')];break;case'infobip':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')]='+'+_0x2a7359[_0xc91a('0x65')]['results'][0x0][_0xc91a('0x82')];_0x3796cf['body'][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x8b')][0x0][_0xc91a('0x87')];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x84')]=_0x2a7359[_0xc91a('0x65')]['results'][0x0][_0xc91a('0x84')];break;case _0xc91a('0x8c'):_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')]['originatingAddress'];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x8d')][_0xc91a('0x2b')];break;case _0xc91a('0x8e'):_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x8f')];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')]['text'];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x84')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x90')];break;case _0xc91a('0x91'):_0x3796cf[_0xc91a('0x65')][_0xc91a('0x84')]=_0x2a7359['body'][0x0][_0xc91a('0x2b')]['id'];_0x3796cf['body'][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')][0x0][_0xc91a('0x2b')][_0xc91a('0x82')];_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][0x0][_0xc91a('0x2b')][_0xc91a('0x87')];break;case _0xc91a('0x92'):_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')]=_0x2a7359[_0xc91a('0x65')]['from'];_0x3796cf['body'][_0xc91a('0x65')]=_0x2a7359[_0xc91a('0x65')][_0xc91a('0x2b')];_0x3796cf['body'][_0xc91a('0x84')]=_0x2a7359['body']['refid'];break;}}if(_0x3796cf['body']['id']){delete _0x3796cf[_0xc91a('0x65')]['id'];}if(_['isNil'](_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')])){throw new db[(_0xc91a('0x7a'))][(_0xc91a('0x93'))](_0xc91a('0x94'));}if(_[_0xc91a('0x95')](_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')])||_0x3796cf['body'][_0xc91a('0x65')]===''){throw new db[(_0xc91a('0x7a'))][(_0xc91a('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc91a('0x95')](_0x3796cf[_0xc91a('0x65')][_0xc91a('0x96')])){throw new db[(_0xc91a('0x7a'))][(_0xc91a('0x93'))](_0xc91a('0x97')+_0x50a291);}if(!_[_0xc91a('0x98')](_0x50a291,_0x3796cf['body'][_0xc91a('0x96')])){throw new db[(_0xc91a('0x7a'))][(_0xc91a('0x93'))](_0xc91a('0x99')+_0x50a291);}_0x2b98ce[_0x3796cf[_0xc91a('0x65')][_0xc91a('0x96')]]=_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')];return db['CmList'][_0xc91a('0x60')]({'where':{'id':_0x3796cf['account']['ListId']},'include':[{'model':db[_0xc91a('0x79')],'as':_0xc91a('0x9a'),'where':_0x2b98ce,'limit':0x1,'order':[[_0xc91a('0x7d'),_0xc91a('0x9b')]]}]});})[_0xc91a('0x23')](handleEntityNotFound(_0x13e769,null))[_0xc91a('0x23')](function(_0x321f7c){if(_0x321f7c){_0x3796cf[_0xc91a('0x9c')]=_['omit'](_0x321f7c,['Contacts']);if(_0x321f7c[_0xc91a('0x9a')][_0xc91a('0x4c')]){return _0x321f7c[_0xc91a('0x9a')][0x0];}var _0x2b901f=_[_0xc91a('0x1b')](_0x3796cf[_0xc91a('0x65')],{'firstName':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')],'ListId':_0x321f7c['id']});_0x2b901f[_0x3796cf['body'][_0xc91a('0x96')]]=_0x3796cf['body']['from'];return db[_0xc91a('0x79')][_0xc91a('0x5b')](_0x2b901f,{'fields':_0x499c30,'raw':!![]});}})[_0xc91a('0x23')](handleEntityNotFound(_0x13e769,null))['then'](function(_0x27e1e5){if(_0x27e1e5){_0x3796cf[_0xc91a('0x9d')]=_0x27e1e5;var _0xe69bfa={'ContactId':_0x27e1e5['id'],'phone':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')],'SmsAccountId':_0x2a7359['params']['id']};var _0x60b5a5={'ContactId':_0x27e1e5['id'],'SmsAccountId':_0x2a7359['params']['id'],'closed':![]};return db[_0xc91a('0x9e')][_0xc91a('0x60')]({'where':_0x60b5a5})['then'](function(_0x4cd7c0){if(_0x4cd7c0){return[_0x4cd7c0,![]];}return db['SmsInteraction'][_0xc91a('0x5b')](_0xe69bfa)[_0xc91a('0x23')](function(_0x3c11ff){return[_0x3c11ff,!![]];});});}})[_0xc91a('0x9f')](function(_0x1ab478,_0x3f8180){_0x3796cf[_0xc91a('0xa0')]=_0x1ab478[_0xc91a('0x39')]({'plain':!![]});_0x3796cf[_0xc91a('0xa0')]['created']=![];if(_0x3f8180){if(_0x3796cf[_0xc91a('0x75')][_0xc91a('0xa1')]){_0x3796cf[_0xc91a('0x76')][_0xc91a('0xa2')]({'id':0x0,'priority':_0x3796cf[_0xc91a('0x76')][_0xc91a('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xc91a('0xa3')});}_0x3796cf[_0xc91a('0xa0')][_0xc91a('0xa4')]=!![];}return db[_0xc91a('0xa5')][_0xc91a('0x5b')]({'phone':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x82')],'messageId':_0x3796cf['body'][_0xc91a('0x84')],'body':_0x3796cf[_0xc91a('0x65')][_0xc91a('0x65')],'SmsAccountId':_0x2a7359[_0xc91a('0x58')]['id'],'SmsInteractionId':_0x1ab478['id'],'direction':'in','ContactId':_0x1ab478[_0xc91a('0xa6')],'AttachmentId':_0x3796cf[_0xc91a('0x65')][_0xc91a('0xa7')]});})[_0xc91a('0x23')](function(_0x294708){_0x3796cf[_0xc91a('0x2b')]=_0x294708;if(_0x3796cf['interaction'][_0xc91a('0xa8')]){return db['User'][_0xc91a('0x60')]({'attributes':['id',_0xc91a('0x3c')],'where':{'id':_0x3796cf['interaction']['UserId']}})[_0xc91a('0x23')](function(_0x40eab5){if(_0x40eab5){_0x3796cf[_0xc91a('0x76')][_0xc91a('0xa9')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40eab5[_0xc91a('0x3c')]+','+(_0x3796cf['account']['waitForTheAssignedAgent']||0xa),'interval':_0xc91a('0xa3')});}return respondWithRpcPromise('Start',_0xc91a('0xaa'),_0x3796cf);});}return respondWithRpcPromise(_0xc91a('0xab'),_0xc91a('0xaa'),_0x3796cf);})['then'](function(_0x4ae863){if(_0x4ae863){var _0x3345fd=0xc8;var _0x210a04=_0xc91a('0xac');logger[_0xc91a('0x24')](_0xc91a('0xad'),_0x210a04,_0x3345fd,_0xc91a('0xae'));logger[_0xc91a('0x27')](_0xc91a('0xaf'),_0x210a04,_0x3345fd,_0xc91a('0xae'),JSON[_0xc91a('0x28')](_0x4ae863));if(_0x3796cf[_0xc91a('0x75')][_0xc91a('0x53')]===_0xc91a('0x81')){return _0x13e769[_0xc91a('0x33')](_0x3345fd)['set'](_0xc91a('0xb0'),_0xc91a('0xb1'))['send'](_0xc91a('0xb2'));}else{return _0x13e769[_0xc91a('0x33')](_0x3345fd)['json'](_0x4ae863);}}})['catch'](handleError(_0x13e769,null));};exports[_0xc91a('0xb3')]=function(_0x5e47d6,_0x9bfacb){var _0x553a9b=_0x5e47d6[_0xc91a('0x58')]['id'];var _0x4d64b9=_0x5e47d6[_0xc91a('0x65')];var _0x5c91ea=0xc8;var _0x135d7b=null;return db[_0xc91a('0xb4')][_0xc91a('0xb5')]({'isolationLevel':db['sequelize']['Transaction'][_0xc91a('0xb6')]['READ_COMMITTED']},function(_0x2b6bce){return db[_0xc91a('0x42')][_0xc91a('0x6b')]({'where':{'id':_0x553a9b},'transaction':_0x2b6bce})[_0xc91a('0x23')](function(_0x49887b){if(_0x49887b){return db[_0xc91a('0xb7')][_0xc91a('0x38')]({'where':{'SmsAccountId':_0x553a9b},'transaction':_0x2b6bce})['then'](function(){var _0x16215c=_['map'](_0x4d64b9,function(_0x33e934){_0x33e934[_0xc91a('0x68')]=_0x553a9b;return _0x33e934;});return db[_0xc91a('0xb7')][_0xc91a('0xb8')](_0x16215c,{'transaction':_0x2b6bce});});}else{_0x5c91ea=0x194;_0x135d7b=[];}});})['then'](function(){if(_0x5c91ea!==0x194){return db[_0xc91a('0xb7')][_0xc91a('0xb9')]({'where':{'SmsAccountId':_0x553a9b},'order':_0xc91a('0xba')})[_0xc91a('0x23')](function(_0x5c2cc4){_0x135d7b=_0x5c2cc4;});}})[_0xc91a('0x63')](function(_0x10e017){_0x5c91ea=0x1f4;logger[_0xc91a('0x29')](_0x10e017[_0xc91a('0x3b')]);if(_0x10e017['name']){delete _0x10e017[_0xc91a('0x3c')];}_0x135d7b=_0x10e017;})[_0xc91a('0xbb')](function(){if(_0x135d7b===null){_0x9bfacb[_0xc91a('0x2c')](_0x5c91ea);}else{if(_0x5c91ea===0x1f4){_0x9bfacb['status'](_0x5c91ea)[_0xc91a('0x3d')](_0x135d7b);}else{_0x9bfacb['status'](_0x5c91ea)[_0xc91a('0x2e')](_0x135d7b);}}});};exports[_0xc91a('0xbc')]=function(_0x5c078d,_0x1fa516,_0x5f3960){var _0xf816d={};var _0x3bd7a5={};var _0x53440a;var _0x5238a4;return db[_0xc91a('0x42')][_0xc91a('0x6b')]({'where':{'id':_0x5c078d[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x1fa516,null))[_0xc91a('0x23')](function(_0x99a177){if(_0x99a177){_0x53440a=_0x99a177;_0x3bd7a5[_0xc91a('0x46')]=_[_0xc91a('0x59')](db['SmsApplication'][_0xc91a('0x43')]);_0x3bd7a5['query']=_[_0xc91a('0x59')](_0x5c078d[_0xc91a('0x47')]);_0x3bd7a5['filters']=_['intersection'](_0x3bd7a5[_0xc91a('0x46')],_0x3bd7a5[_0xc91a('0x47')]);_0xf816d[_0xc91a('0x4a')]=_['intersection'](_0x3bd7a5[_0xc91a('0x46')],qs[_0xc91a('0x4b')](_0x5c078d[_0xc91a('0x47')][_0xc91a('0x4b')]));_0xf816d[_0xc91a('0x4a')]=_0xf816d[_0xc91a('0x4a')][_0xc91a('0x4c')]?_0xf816d[_0xc91a('0x4a')]:_0x3bd7a5[_0xc91a('0x46')];_0xf816d[_0xc91a('0x6c')]=qs[_0xc91a('0x4f')](_0x5c078d[_0xc91a('0x47')][_0xc91a('0x4f')]);_0xf816d[_0xc91a('0x50')]=qs[_0xc91a('0x48')](_[_0xc91a('0x6d')](_0x5c078d[_0xc91a('0x47')],_0x3bd7a5[_0xc91a('0x48')]));if(_0x5c078d[_0xc91a('0x47')][_0xc91a('0x51')]){_0xf816d[_0xc91a('0x50')]=_[_0xc91a('0x52')](_0xf816d[_0xc91a('0x50')],{'$or':_[_0xc91a('0x41')](_0xf816d[_0xc91a('0x4a')],function(_0x24e85d){var _0x4891ed={};_0x4891ed[_0x24e85d]={'$like':'%'+_0x5c078d[_0xc91a('0x47')][_0xc91a('0x51')]+'%'};return _0x4891ed;})});}_0xf816d=_[_0xc91a('0x52')]({},_0xf816d,_0x5c078d[_0xc91a('0x55')]);return _0x53440a[_0xc91a('0xbc')](_0xf816d);}})[_0xc91a('0x23')](function(_0x35f9a8){if(_0x35f9a8){_0x5238a4=_0x35f9a8['length'];if(!_0x5c078d['query'][_0xc91a('0x4d')](_0xc91a('0x4e'))){_0xf816d['limit']=qs[_0xc91a('0x31')](_0x5c078d[_0xc91a('0x47')][_0xc91a('0x31')]);_0xf816d[_0xc91a('0x2f')]=qs['offset'](_0x5c078d[_0xc91a('0x47')][_0xc91a('0x2f')]);}return _0x53440a[_0xc91a('0xbc')](_0xf816d);}})[_0xc91a('0x23')](function(_0x2fbef1){if(_0x2fbef1){return _0x2fbef1?{'count':_0x5238a4,'rows':_0x2fbef1}:null;}})[_0xc91a('0x23')](respondWithResult(_0x1fa516,null))[_0xc91a('0x63')](handleError(_0x1fa516,null));};exports[_0xc91a('0xbd')]=function(_0x3dbb51,_0xe74d80,_0x3afb35){var _0xf3dd={'raw':![],'where':{}};var _0x783018={};var _0x1aa529={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x3dbb51['params']['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0xe74d80,null))[_0xc91a('0x23')](function(_0x380055){if(_0x380055){_0x783018[_0xc91a('0x46')]=_[_0xc91a('0x59')](db[_0xc91a('0x9e')][_0xc91a('0x43')]);_0x783018[_0xc91a('0x47')]=_[_0xc91a('0x59')](_0x3dbb51[_0xc91a('0x47')]);_0x783018[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0x783018[_0xc91a('0x46')],_0x783018[_0xc91a('0x47')]);_0xf3dd[_0xc91a('0x4a')]=_[_0xc91a('0x49')](_0x783018[_0xc91a('0x46')],qs['fields'](_0x3dbb51['query']['fields']));_0xf3dd[_0xc91a('0x4a')]=_0xf3dd[_0xc91a('0x4a')][_0xc91a('0x4c')]?_0xf3dd[_0xc91a('0x4a')]:_0x783018[_0xc91a('0x46')];if(!_0x3dbb51[_0xc91a('0x47')]['hasOwnProperty'](_0xc91a('0x4e'))){_0xf3dd[_0xc91a('0x31')]=qs[_0xc91a('0x31')](_0x3dbb51[_0xc91a('0x47')][_0xc91a('0x31')]);_0xf3dd[_0xc91a('0x2f')]=qs['offset'](_0x3dbb51['query'][_0xc91a('0x2f')]);}_0xf3dd[_0xc91a('0x6c')]=qs[_0xc91a('0x4f')](_0x3dbb51[_0xc91a('0x47')][_0xc91a('0x4f')]);_0xf3dd[_0xc91a('0x50')]=qs[_0xc91a('0x48')](_[_0xc91a('0x6d')](_0x3dbb51[_0xc91a('0x47')],_0x783018[_0xc91a('0x48')]));_0xf3dd[_0xc91a('0x50')]['SmsAccountId']=_0x380055['id'];if(_0x3dbb51[_0xc91a('0x47')][_0xc91a('0x51')]){_0xf3dd[_0xc91a('0x50')]=_[_0xc91a('0x52')](_0xf3dd['where'],{'$or':_['map'](_0xf3dd['attributes'],function(_0x5b0561){var _0x438ccf={};_0x438ccf[_0x5b0561]={'$like':'%'+_0x3dbb51[_0xc91a('0x47')][_0xc91a('0x51')]+'%'};return _0x438ccf;})});}_0xf3dd=_[_0xc91a('0x52')]({},_0xf3dd,_0x3dbb51[_0xc91a('0x55')]);return db[_0xc91a('0x9e')][_0xc91a('0x32')]({'where':_0xf3dd[_0xc91a('0x50')]})[_0xc91a('0x23')](function(_0x32e131){_0x1aa529['count']=_0x32e131;if(_0x3dbb51['query']['includeAll']){_0xf3dd[_0xc91a('0x56')]=[{'model':db[_0xc91a('0x79')],'as':_0xc91a('0xbe'),'required':![]},{'model':db['User'],'as':_0xc91a('0xbf'),'attributes':[_0xc91a('0x3c'),_0xc91a('0xc0'),_0xc91a('0xc1')],'required':![]},{'model':db['Tag'],'as':_0xc91a('0xc2'),'attributes':['id',_0xc91a('0x3c'),_0xc91a('0xc3')],'where':_0x3dbb51[_0xc91a('0x47')]['tag']?{'id':_0x3dbb51[_0xc91a('0x47')][_0xc91a('0xc4')]}:undefined,'required':_0x3dbb51[_0xc91a('0x47')][_0xc91a('0xc4')]?!![]:![]}];}return db[_0xc91a('0x9e')][_0xc91a('0x57')](_0xf3dd);})[_0xc91a('0x23')](function(_0x8d2f96){_0x1aa529[_0xc91a('0x71')]=_0x8d2f96;return _0x1aa529;});}})[_0xc91a('0x23')](respondWithFilteredResult(_0xe74d80,_0xf3dd))['catch'](handleError(_0xe74d80,null));};exports[_0xc91a('0x3d')]=function(_0x228cda,_0x182a78,_0x599faf){var _0x434af9,_0x181ddf,_0x36b5b7;if(_[_0xc91a('0x95')](_0x228cda[_0xc91a('0x65')][_0xc91a('0x65')])||_0x228cda[_0xc91a('0x65')][_0xc91a('0x65')]===''){throw new db[(_0xc91a('0x7a'))][(_0xc91a('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc91a('0x95')](_0x228cda[_0xc91a('0x65')]['to'])){throw new db[(_0xc91a('0x7a'))]['ValidationError']('to\x20is\x20mandatory');}_0x434af9=_0x228cda['body']['to'];return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0x228cda[_0xc91a('0x58')]['id']},'include':[{'model':db[_0xc91a('0xc5')],'as':'List','include':[{'model':db[_0xc91a('0x79')],'as':_0xc91a('0x9a'),'where':{'mobile':_0x434af9},'limit':0x1,'order':[[_0xc91a('0x7d'),_0xc91a('0x9b')]]}]}]})[_0xc91a('0x23')](handleEntityNotFound(_0x182a78,null))[_0xc91a('0x23')](function(_0x54280b){if(_0x54280b&&_0x54280b[_0xc91a('0xc6')]){_0x181ddf=_0x54280b[_0xc91a('0x39')]({'plain':!![]});if(_0x181ddf['List']&&_0x181ddf[_0xc91a('0xc6')][_0xc91a('0x9a')][_0xc91a('0x4c')]){return _0x181ddf[_0xc91a('0xc6')][_0xc91a('0x9a')][0x0];}return db['CmContact'][_0xc91a('0x5b')](_[_0xc91a('0x1b')](_0x228cda['body'],{'firstName':_0x434af9,'mobile':_0x434af9,'phone':_0x434af9,'ListId':_0x181ddf['ListId']}));}})['then'](handleEntityNotFound(_0x182a78,null))[_0xc91a('0x23')](function(_0xee1688){if(_0xee1688){_0x36b5b7=_0xee1688;return db[_0xc91a('0x9e')]['find']({'where':{'ContactId':_0x36b5b7['id'],'closed':![],'SmsAccountId':_0x181ddf['id']}})[_0xc91a('0x23')](function(_0x21fa4c){if(_0x21fa4c){return[_0x21fa4c,![]];}return db[_0xc91a('0x9e')][_0xc91a('0x5b')]({'UserId':_0x228cda['user']['id'],'ContactId':_0x36b5b7['id'],'SmsAccountId':_0x181ddf['id'],'phone':_0x434af9,'firstMsgDirection':_0xc91a('0xc7'),'Messages':[_['merge'](_0x228cda[_0xc91a('0x65')],{'read':![],'body':_0x228cda[_0xc91a('0x65')][_0xc91a('0x65')],'phone':_0x434af9,'SmsAccountId':_0x181ddf['id'],'UserId':_0x228cda[_0xc91a('0x5c')]['id'],'ContactId':_0x36b5b7['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xc91a('0xc8')}]})[_0xc91a('0x23')](function(_0x4fa897){return[_0x4fa897,!![]];});});}})[_0xc91a('0x9f')](function(_0x4b68af,_0xfb015d){if(_0xfb015d){return _0x4b68af;}return db[_0xc91a('0xa5')][_0xc91a('0x5b')](_[_0xc91a('0x52')](_0x228cda[_0xc91a('0x65')],{'read':![],'body':_0x228cda['body'][_0xc91a('0x65')],'phone':_0x434af9,'SmsAccountId':_0x181ddf['id'],'SmsInteractionId':_0x4b68af['id'],'UserId':_0x228cda[_0xc91a('0x5c')]['id'],'ContactId':_0x36b5b7['id']}))[_0xc91a('0x23')](function(_0x14b418){_0x4b68af[_0xc91a('0xc9')][_0xc91a('0xc8')]=[];_0x4b68af['dataValues'][_0xc91a('0xc8')][_0xc91a('0xa2')](_0x14b418[_0xc91a('0xc9')]);return _0x4b68af;});})[_0xc91a('0x23')](respondWithResult(_0x182a78,null))[_0xc91a('0x63')](handleError(_0x182a78,null));};exports['status']=function(_0xe1ba86,_0xb1b20e,_0x22824d){if(_0xe1ba86[_0xc91a('0x65')]['id']){delete _0xe1ba86[_0xc91a('0x65')]['id'];}var _0x48e7cf,_0x5d2549,_0x219a02;return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0xe1ba86['params']['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0xb1b20e,null))[_0xc91a('0x23')](function(_0x4466df){if(_0x4466df){_0x219a02=_0x4466df;logger[_0xc91a('0x27')](_0xc91a('0xad'),'status','received\x20delivery\x20report\x20from',_0x4466df[_0xc91a('0x53')],util[_0xc91a('0xca')](_0xe1ba86[_0xc91a('0x65')],{'showHidden':![],'depth':null}));switch(_0x4466df[_0xc91a('0x53')]){case _0xc91a('0xcb'):if(_0xe1ba86[_0xc91a('0x65')]['skebby_dispatch_id']&&_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x33')]){_0x5d2549=_0xe1ba86[_0xc91a('0x65')]['status'];return db[_0xc91a('0xa5')][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86['body'][_0xc91a('0xcc')]}});}break;case _0xc91a('0x88'):if(_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xcd')]&&_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xce')]){_0x5d2549=_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xce')];return db['SmsMessage'][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86['body']['requestid']}});}break;case _0xc91a('0xcf'):if(_0xe1ba86['body'][_0xc91a('0x89')]&&_0xe1ba86[_0xc91a('0x65')]['status_code']){_0x5d2549=_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xd0')];return db[_0xc91a('0xa5')][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86['body'][_0xc91a('0x89')]}});}break;case'infobip':var _0x2cde6b=_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x8b')][0x0];if(_0x2cde6b[_0xc91a('0x84')]&&_0x2cde6b['status'][_0xc91a('0xd1')]===_0xc91a('0xd2')){_0x5d2549=_0x2cde6b[_0xc91a('0x33')][_0xc91a('0xd1')];return db['SmsMessage']['find']({'where':{'messageId':_0x2cde6b[_0xc91a('0x84')]}});}break;case _0xc91a('0x8e'):if(_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x84')]&&_0xe1ba86['body'][_0xc91a('0x33')]){_0x5d2549=_0xe1ba86['body']['status'];return db['SmsMessage'][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x84')]}});}break;case _0xc91a('0x91'):if(_0xe1ba86[_0xc91a('0x65')][0x0][_0xc91a('0x2b')]['id']){_0x5d2549=_0xe1ba86['body'][0x0][_0xc91a('0x53')];return db[_0xc91a('0xa5')][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86[_0xc91a('0x65')][0x0][_0xc91a('0x2b')]['id']}});}break;case'intelepeer':if(_0xe1ba86[_0xc91a('0x65')]['redif']&&_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x33')]){_0x5d2549=_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x33')];return db['SmsMessage'][_0xc91a('0x60')]({'where':{'messageId':_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xd3')]}});}break;}}})['then'](handleEntityNotFound(_0xb1b20e,null))['then'](function(_0x399143){if(_0x399143){_0x48e7cf=_0x399143;switch(_0x219a02[_0xc91a('0x53')]){case _0xc91a('0xcb'):if(_0x5d2549===_0xc91a('0xd2')){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc91a('0x33'),'skebby',util['inspect'](_0xe1ba86['body'],{'showHidden':![],'depth':null}));}break;case _0xc91a('0x88'):if(_0x5d2549==='1'){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')](_0xc91a('0xad'),_0xc91a('0x33'),_0xc91a('0xcb'),util[_0xc91a('0xca')](_0xe1ba86[_0xc91a('0x65')],{'showHidden':![],'depth':null}));}break;case _0xc91a('0xcf'):if(!_0xe1ba86[_0xc91a('0x65')][_0xc91a('0xd4')]&&_0x5d2549>=0xc8&&_0x5d2549<=0xce){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')](_0xc91a('0xad'),_0xc91a('0x33'),'clicksend',util[_0xc91a('0xca')](_0xe1ba86['body'],{'showHidden':![],'depth':null}));}break;case _0xc91a('0xd5'):var _0x4dd453=_0xe1ba86[_0xc91a('0x65')][_0xc91a('0x8b')][0x0];if(_0x4dd453[_0xc91a('0x33')][_0xc91a('0xd1')]===_0xc91a('0xd2')){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xc91a('0x33'),_0xc91a('0xd5'),util['inspect'](_0xe1ba86['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5d2549==_0xc91a('0xd6')||_0x5d2549==_0xc91a('0xd7')){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger['error'](_0xc91a('0xad'),_0xc91a('0x33'),'clickatell',util[_0xc91a('0xca')](_0xe1ba86[_0xc91a('0x65')],{'showHidden':![],'depth':null}));}break;case _0xc91a('0x91'):if(_0x5d2549==_0xc91a('0xd8')){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')](_0xc91a('0xad'),_0xc91a('0x33'),_0xc91a('0x91'),util[_0xc91a('0xca')](_0xe1ba86[_0xc91a('0x65')],{'showHidden':![],'depth':null}));}break;case _0xc91a('0x92'):if(_0x5d2549===_0xc91a('0xd9')||_0x5d2549===_0xc91a('0xda')){return _0x48e7cf[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')](_0xc91a('0xad'),_0xc91a('0x33'),_0xc91a('0x92'),util[_0xc91a('0xca')](_0xe1ba86[_0xc91a('0x65')],{'showHidden':![],'depth':null}));}break;}return _0x48e7cf;}})[_0xc91a('0x23')](respondWithResult(_0xb1b20e,null))[_0xc91a('0x63')](handleError(_0xb1b20e,null));};exports[_0xc91a('0xdb')]=function(_0x1ead16,_0x583b32,_0x504fa8){var _0x396e56,_0x21dcf9,_0x1deb3e;return db['SmsAccount']['find']({'where':{'id':_0x1ead16[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x583b32,null))['then'](function(_0x33ca0d){if(_0x33ca0d){_0x1deb3e=_0x33ca0d;logger['debug'](_0xc91a('0xad'),_0xc91a('0x33'),_0xc91a('0xdc'),_0x33ca0d[_0xc91a('0x53')],util['inspect'](_0x1ead16[_0xc91a('0x47')],{'showHidden':![],'depth':null}));switch(_0x33ca0d[_0xc91a('0x53')]){case _0xc91a('0x8c'):if(_0x1ead16[_0xc91a('0x47')][_0xc91a('0xdd')]&&_0x1ead16[_0xc91a('0x47')][_0xc91a('0xde')]){_0x21dcf9=_0x1ead16['query'][_0xc91a('0xde')];return db['SmsMessage'][_0xc91a('0x60')]({'where':{'messageId':_0x1ead16['query'][_0xc91a('0xdd')]}});}break;}}})[_0xc91a('0x23')](handleEntityNotFound(_0x583b32,null))[_0xc91a('0x23')](function(_0x5ef078){if(_0x5ef078){_0x396e56=_0x5ef078;switch(_0x1deb3e[_0xc91a('0x53')]){case'csc':if(_0x21dcf9==='2'||_0x21dcf9==='6'){return _0x396e56[_0xc91a('0x37')]({'read':!![]});}else{logger[_0xc91a('0x29')](_0xc91a('0xad'),'status',_0xc91a('0x8c'),util[_0xc91a('0xca')](_0x1ead16[_0xc91a('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x396e56;}})[_0xc91a('0x23')](respondWithResult(_0x583b32,null))[_0xc91a('0x63')](handleError(_0x583b32,null));};exports[_0xc91a('0xdf')]=function(_0x3c8882,_0x4d22fc,_0x15e0f9){return db['SmsAccount'][_0xc91a('0x60')]({'where':{'id':_0x3c8882[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x4d22fc,null))[_0xc91a('0x23')](function(_0x2e71e6){if(_0x2e71e6){return _0x2e71e6['addAgents'](_0x3c8882['body'][_0xc91a('0x6f')],_[_0xc91a('0xe0')](_0x3c8882['body'],[_0xc91a('0x6f'),'id'])||{})[_0xc91a('0x9f')](function(_0x2d4f1f){for(var _0x41b93b=0x0;_0x41b93b<_0x3c8882[_0xc91a('0x65')][_0xc91a('0x6f')][_0xc91a('0x4c')];_0x41b93b+=0x1){socket['emit'](_0xc91a('0xe1'),{'UserId':Number(_0x3c8882[_0xc91a('0x65')]['ids'][_0x41b93b]),'SmsAccountId':Number(_0x3c8882[_0xc91a('0x58')]['id'])});}return _0x2d4f1f;});}})[_0xc91a('0x23')](respondWithResult(_0x4d22fc,null))[_0xc91a('0x63')](handleError(_0x4d22fc,null));};exports[_0xc91a('0xe2')]=function(_0x43928d,_0x52fea0,_0x1fc722){return db[_0xc91a('0x42')][_0xc91a('0x60')]({'where':{'id':_0x43928d['params']['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x52fea0,null))[_0xc91a('0x23')](function(_0x5a0655){if(_0x5a0655){return _0x5a0655[_0xc91a('0xe2')](_0x43928d['query'][_0xc91a('0x6f')])['then'](function(){if(_[_0xc91a('0xe3')](_0x43928d['query']['ids'])){for(var _0x45e1=0x0;_0x45e1<_0x43928d[_0xc91a('0x47')][_0xc91a('0x6f')][_0xc91a('0x4c')];_0x45e1+=0x1){socket[_0xc91a('0xe4')](_0xc91a('0xe5'),{'UserId':Number(_0x43928d['query'][_0xc91a('0x6f')][_0x45e1]),'SmsAccountId':Number(_0x43928d[_0xc91a('0x58')]['id'])});}}else{socket[_0xc91a('0xe4')](_0xc91a('0xe5'),{'UserId':Number(_0x43928d[_0xc91a('0x47')]['ids']),'SmsAccountId':Number(_0x43928d[_0xc91a('0x58')]['id'])});}});}})[_0xc91a('0x23')](respondWithStatusCode(_0x52fea0,null))[_0xc91a('0x63')](handleError(_0x52fea0,null));};exports[_0xc91a('0xe6')]=function(_0x3aae31,_0x5a7e05,_0x51b1e9){var _0x30326b={};var _0xea992d={};var _0x4623d8;var _0x2a8873;return db[_0xc91a('0x42')][_0xc91a('0x6b')]({'where':{'id':_0x3aae31[_0xc91a('0x58')]['id']}})[_0xc91a('0x23')](handleEntityNotFound(_0x5a7e05,null))[_0xc91a('0x23')](function(_0x5d4a96){if(_0x5d4a96){_0x4623d8=_0x5d4a96;_0xea992d[_0xc91a('0x46')]=_[_0xc91a('0x59')](db[_0xc91a('0xe7')]['rawAttributes']);_0xea992d[_0xc91a('0x47')]=_[_0xc91a('0x59')](_0x3aae31['query']);_0xea992d[_0xc91a('0x48')]=_[_0xc91a('0x49')](_0xea992d['model'],_0xea992d[_0xc91a('0x47')]);_0x30326b[_0xc91a('0x4a')]=_['intersection'](_0xea992d['model'],qs[_0xc91a('0x4b')](_0x3aae31[_0xc91a('0x47')][_0xc91a('0x4b')]));_0x30326b[_0xc91a('0x4a')]=_0x30326b[_0xc91a('0x4a')]['length']?_0x30326b[_0xc91a('0x4a')]:_0xea992d[_0xc91a('0x46')];_0x30326b[_0xc91a('0x6c')]=qs['sort'](_0x3aae31[_0xc91a('0x47')][_0xc91a('0x4f')]);_0x30326b[_0xc91a('0x50')]=qs[_0xc91a('0x48')](_[_0xc91a('0x6d')](_0x3aae31['query'],_0xea992d[_0xc91a('0x48')]));if(_0x3aae31[_0xc91a('0x47')][_0xc91a('0x51')]){_0x30326b[_0xc91a('0x50')]=_[_0xc91a('0x52')](_0x30326b[_0xc91a('0x50')],{'$or':_[_0xc91a('0x41')](_0x30326b[_0xc91a('0x4a')],function(_0x20907d){var _0x34ba1e={};_0x34ba1e[_0x20907d]={'$like':'%'+_0x3aae31[_0xc91a('0x47')][_0xc91a('0x51')]+'%'};return _0x34ba1e;})});}_0x30326b=_[_0xc91a('0x52')]({},_0x30326b,_0x3aae31[_0xc91a('0x55')]);return _0x4623d8[_0xc91a('0xe6')](_0x30326b);}})['then'](function(_0x273a13){if(_0x273a13){_0x2a8873=_0x273a13[_0xc91a('0x4c')];if(!_0x3aae31['query'][_0xc91a('0x4d')]('nolimit')){_0x30326b['limit']=qs[_0xc91a('0x31')](_0x3aae31[_0xc91a('0x47')][_0xc91a('0x31')]);_0x30326b[_0xc91a('0x2f')]=qs['offset'](_0x3aae31[_0xc91a('0x47')][_0xc91a('0x2f')]);}return _0x4623d8[_0xc91a('0xe6')](_0x30326b);}})[_0xc91a('0x23')](function(_0x78baf4){if(_0x78baf4){return _0x78baf4?{'count':_0x2a8873,'rows':_0x78baf4}:null;}})[_0xc91a('0x23')](respondWithResult(_0x5a7e05,null))[_0xc91a('0x63')](handleError(_0x5a7e05,null));}; \ No newline at end of file +var _0xfd4e=['sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','name','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','query','filters','model','attributes','fields','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','Pause','keys','intersection','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','params','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','findAll','removeAnswers','sms','SmsApplication','Applications','account','orderBy','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','MessageSid','skebby','text','connectel','clicksend','messageId','plivo','Text','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','CmContact','DESC','list','omit','Contacts','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','tag','to\x20is\x20mandatory','CmList','List','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','message_id','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','csc','state','message-id','addAgents','userSmsAccount:save','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x33a62a,_0x4ea9c8){var _0x3afa43=function(_0x5c2bab){while(--_0x5c2bab){_0x33a62a['push'](_0x33a62a['shift']());}};_0x3afa43(++_0x4ea9c8);}(_0xfd4e,0x1bc));var _0xefd4=function(_0x5d9fd0,_0x2cb36f){_0x5d9fd0=_0x5d9fd0-0x0;var _0x9a10be=_0xfd4e[_0x5d9fd0];return _0x9a10be;};'use strict';var emlformat=require(_0xefd4('0x0'));var rimraf=require(_0xefd4('0x1'));var zipdir=require(_0xefd4('0x2'));var jsonpatch=require(_0xefd4('0x3'));var rp=require(_0xefd4('0x4'));var moment=require(_0xefd4('0x5'));var BPromise=require(_0xefd4('0x6'));var Mustache=require('mustache');var util=require(_0xefd4('0x7'));var path=require('path');var sox=require(_0xefd4('0x8'));var csv=require('to-csv');var ejs=require(_0xefd4('0x9'));var fs=require('fs');var fs_extra=require(_0xefd4('0xa'));var _=require('lodash');var squel=require(_0xefd4('0xb'));var crypto=require('crypto');var jsforce=require(_0xefd4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xefd4('0xd'));var querystring=require(_0xefd4('0xe'));var Papa=require(_0xefd4('0xf'));var Redis=require(_0xefd4('0x10'));var authService=require(_0xefd4('0x11'));var qs=require(_0xefd4('0x12'));var as=require(_0xefd4('0x13'));var hardwareService=require(_0xefd4('0x14'));var logger=require(_0xefd4('0x15'))(_0xefd4('0x16'));var utils=require(_0xefd4('0x17'));var config=require(_0xefd4('0x18'));var licenseUtil=require(_0xefd4('0x19'));var db=require(_0xefd4('0x1a'))['db'];config['redis']=_[_0xefd4('0x1b')](config['redis'],{'host':_0xefd4('0x1c'),'port':0x18eb});var socket=require(_0xefd4('0x1d'))(new Redis(config[_0xefd4('0x1e')]));require('./smsAccount.socket')[_0xefd4('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xefd4('0x20')][_0xefd4('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x59e657,_0x33dfc7,_0x580a79,_0x3ed587){return new BPromise(function(_0x11490b,_0x176ea3){var _0x4cf783=_0x3ed587||client;return _0x4cf783[_0xefd4('0x22')](_0x59e657,_0x580a79)[_0xefd4('0x23')](function(_0x4e483f){logger[_0xefd4('0x24')](_0xefd4('0x25'),_0x33dfc7,_0xefd4('0x26'));logger[_0xefd4('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x33dfc7,_0xefd4('0x26'),JSON['stringify'](_0x4e483f));if(_0x4e483f[_0xefd4('0x28')]){if(_0x4e483f[_0xefd4('0x28')][_0xefd4('0x29')]===0x1f4){logger[_0xefd4('0x28')](_0xefd4('0x25'),_0x33dfc7,_0x4e483f[_0xefd4('0x28')][_0xefd4('0x2a')]);return _0x176ea3(_0x4e483f[_0xefd4('0x28')][_0xefd4('0x2a')]);}logger['error'](_0xefd4('0x25'),_0x33dfc7,_0x4e483f[_0xefd4('0x28')][_0xefd4('0x2a')]);return _0x11490b(_0x4e483f[_0xefd4('0x28')]['message']);}else{logger[_0xefd4('0x24')](_0xefd4('0x25'),_0x33dfc7,_0xefd4('0x26'));_0x11490b(_0x4e483f[_0xefd4('0x2b')]['message']);}})[_0xefd4('0x2c')](function(_0x3b9030){logger[_0xefd4('0x28')](_0xefd4('0x25'),_0x33dfc7,_0x3b9030);_0x176ea3(_0x3b9030);});});}function respondWithStatusCode(_0x56ab82,_0x17dd2c){_0x17dd2c=_0x17dd2c||0xcc;return function(_0x506625){if(_0x506625){return _0x56ab82[_0xefd4('0x2d')](_0x17dd2c);}return _0x56ab82[_0xefd4('0x2e')](_0x17dd2c)[_0xefd4('0x2f')]();};}function respondWithResult(_0x361dd1,_0x49509d){_0x49509d=_0x49509d||0xc8;return function(_0x23e4c1){if(_0x23e4c1){return _0x361dd1['status'](_0x49509d)[_0xefd4('0x30')](_0x23e4c1);}};}function respondWithFilteredResult(_0x106a6a,_0x3e5560){return function(_0x15046d){if(_0x15046d){var _0x3702bd=typeof _0x3e5560[_0xefd4('0x31')]===_0xefd4('0x32')&&typeof _0x3e5560[_0xefd4('0x33')]===_0xefd4('0x32');var _0xc0c57f=_0x15046d[_0xefd4('0x34')];var _0x78af39=_0x3702bd?0x0:_0x3e5560[_0xefd4('0x31')];var _0x52ca07=_0x3702bd?_0x15046d[_0xefd4('0x34')]:_0x3e5560[_0xefd4('0x31')]+_0x3e5560[_0xefd4('0x33')];var _0x51242a;if(_0x52ca07>=_0xc0c57f){_0x52ca07=_0xc0c57f;_0x51242a=0xc8;}else{_0x51242a=0xce;}_0x106a6a[_0xefd4('0x2e')](_0x51242a);return _0x106a6a[_0xefd4('0x35')](_0xefd4('0x36'),_0x78af39+'-'+_0x52ca07+'/'+_0xc0c57f)[_0xefd4('0x30')](_0x15046d);}return null;};}function patchUpdates(_0x48c25b){return function(_0x3f8787){try{jsonpatch[_0xefd4('0x37')](_0x3f8787,_0x48c25b,!![]);}catch(_0x3c20a7){return BPromise[_0xefd4('0x38')](_0x3c20a7);}return _0x3f8787['save']();};}function saveUpdates(_0x77995e,_0x4d3e50){return function(_0x4c2140){if(_0x4c2140){return _0x4c2140[_0xefd4('0x39')](_0x77995e)[_0xefd4('0x23')](function(_0x516469){return _0x516469;});}return null;};}function removeEntity(_0x5930b8,_0x1a257b){return function(_0x5b3fed){if(_0x5b3fed){return _0x5b3fed[_0xefd4('0x3a')]()[_0xefd4('0x23')](function(){var _0x3c8cfd=_0x5b3fed[_0xefd4('0x3b')]({'plain':!![]});var _0x4a91ec=_0xefd4('0x3c');return db[_0xefd4('0x3d')][_0xefd4('0x3a')]({'where':{'type':_0x4a91ec,'resourceId':_0x3c8cfd['id']}})['then'](function(){return _0x5b3fed;});})[_0xefd4('0x23')](function(){_0x5930b8['status'](0xcc)[_0xefd4('0x2f')]();});}};}function handleEntityNotFound(_0x2facaf,_0x793534){return function(_0x4ef094){if(!_0x4ef094){_0x2facaf[_0xefd4('0x2d')](0x194);}return _0x4ef094;};}function handleError(_0x509dcc,_0x518e4f){_0x518e4f=_0x518e4f||0x1f4;return function(_0x596cb3){logger[_0xefd4('0x28')](_0x596cb3['stack']);if(_0x596cb3[_0xefd4('0x3e')]){delete _0x596cb3[_0xefd4('0x3e')];}_0x509dcc['status'](_0x518e4f)[_0xefd4('0x3f')](_0x596cb3);};}exports['index']=function(_0x4bb169,_0x2e0224){var _0x15ecfb={'include':[{'model':db['Pause'],'as':_0xefd4('0x40')}]},_0x203d63={},_0x294977={'count':0x0,'rows':[]};var _0x3baa7e=_[_0xefd4('0x41')](db[_0xefd4('0x42')][_0xefd4('0x43')],function(_0x16ea34){return{'name':_0x16ea34[_0xefd4('0x44')],'type':_0x16ea34['type'][_0xefd4('0x45')]};});_0x203d63['model']=_[_0xefd4('0x41')](_0x3baa7e,_0xefd4('0x3e'));_0x203d63[_0xefd4('0x46')]=_['keys'](_0x4bb169['query']);_0x203d63[_0xefd4('0x47')]=_['intersection'](_0x203d63[_0xefd4('0x48')],_0x203d63[_0xefd4('0x46')]);_0x15ecfb[_0xefd4('0x49')]=_['intersection'](_0x203d63['model'],qs[_0xefd4('0x4a')](_0x4bb169[_0xefd4('0x46')][_0xefd4('0x4a')]));_0x15ecfb[_0xefd4('0x49')]=_0x15ecfb['attributes']['length']?_0x15ecfb[_0xefd4('0x49')]:_0x203d63[_0xefd4('0x48')];if(!_0x4bb169[_0xefd4('0x46')][_0xefd4('0x4b')]('nolimit')){_0x15ecfb[_0xefd4('0x33')]=qs[_0xefd4('0x33')](_0x4bb169[_0xefd4('0x46')][_0xefd4('0x33')]);_0x15ecfb[_0xefd4('0x31')]=qs[_0xefd4('0x31')](_0x4bb169[_0xefd4('0x46')][_0xefd4('0x31')]);}_0x15ecfb[_0xefd4('0x4c')]=qs[_0xefd4('0x4d')](_0x4bb169[_0xefd4('0x46')]['sort']);_0x15ecfb[_0xefd4('0x4e')]=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x4bb169[_0xefd4('0x46')],_0x203d63[_0xefd4('0x47')]),_0x3baa7e);if(_0x4bb169[_0xefd4('0x46')]['filter']){_0x15ecfb['where']=_['merge'](_0x15ecfb[_0xefd4('0x4e')],{'$or':_['map'](_0x3baa7e,function(_0x5cb59d){if(_0x5cb59d[_0xefd4('0x50')]!==_0xefd4('0x51')){var _0x4329eb={};_0x4329eb[_0x5cb59d[_0xefd4('0x3e')]]={'$like':'%'+_0x4bb169[_0xefd4('0x46')]['filter']+'%'};return _0x4329eb;}})});}_0x15ecfb=_[_0xefd4('0x52')]({},_0x15ecfb,_0x4bb169[_0xefd4('0x53')]);var _0x4beed4={'where':_0x15ecfb['where']};return db[_0xefd4('0x42')][_0xefd4('0x34')](_0x4beed4)['then'](function(_0x11cff8){_0x294977['count']=_0x11cff8;if(_0x4bb169[_0xefd4('0x46')][_0xefd4('0x54')]){_0x15ecfb[_0xefd4('0x55')]=[{'all':!![]}];}return db[_0xefd4('0x42')]['findAll'](_0x15ecfb);})['then'](function(_0x487b53){_0x294977[_0xefd4('0x56')]=_0x487b53;return _0x294977;})[_0xefd4('0x23')](respondWithFilteredResult(_0x2e0224,_0x15ecfb))[_0xefd4('0x2c')](handleError(_0x2e0224,null));};exports[_0xefd4('0x57')]=function(_0x23e380,_0x3918a6){var _0x593b62={'raw':![],'where':{'id':_0x23e380['params']['id']},'include':[{'model':db[_0xefd4('0x58')],'as':_0xefd4('0x40')}]},_0x372142={};_0x372142['model']=_[_0xefd4('0x59')](db['SmsAccount'][_0xefd4('0x43')]);_0x372142[_0xefd4('0x46')]=_[_0xefd4('0x59')](_0x23e380['query']);_0x372142[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0x372142['model'],_0x372142[_0xefd4('0x46')]);_0x593b62[_0xefd4('0x49')]=_[_0xefd4('0x5a')](_0x372142[_0xefd4('0x48')],qs['fields'](_0x23e380['query'][_0xefd4('0x4a')]));_0x593b62[_0xefd4('0x49')]=_0x593b62[_0xefd4('0x49')][_0xefd4('0x5b')]?_0x593b62[_0xefd4('0x49')]:_0x372142[_0xefd4('0x48')];if(_0x23e380[_0xefd4('0x46')][_0xefd4('0x54')]){_0x593b62[_0xefd4('0x55')]=[{'all':!![]}];}_0x593b62=_['merge']({},_0x593b62,_0x23e380[_0xefd4('0x53')]);return db[_0xefd4('0x42')][_0xefd4('0x5c')](_0x593b62)['then'](handleEntityNotFound(_0x3918a6,null))[_0xefd4('0x23')](respondWithResult(_0x3918a6,null))[_0xefd4('0x2c')](handleError(_0x3918a6,null));};exports['create']=function(_0x2a45a6,_0x3d33f1){return db[_0xefd4('0x42')][_0xefd4('0x5d')](_0x2a45a6[_0xefd4('0x5e')],{})[_0xefd4('0x23')](function(_0x6c8a4c){var _0x7ad4ac=_0x2a45a6[_0xefd4('0x5f')][_0xefd4('0x3b')]({'plain':!![]});if(!_0x7ad4ac)throw new Error(_0xefd4('0x60'));if(_0x7ad4ac[_0xefd4('0x61')]===_0xefd4('0x5f')){var _0x45c49c=_0x6c8a4c[_0xefd4('0x3b')]({'plain':!![]});var _0x8f4c6d='SmsAccounts';return db[_0xefd4('0x62')][_0xefd4('0x5c')]({'where':{'name':_0x8f4c6d,'userProfileId':_0x7ad4ac['userProfileId']},'raw':!![]})[_0xefd4('0x23')](function(_0xe1a4f4){if(_0xe1a4f4&&_0xe1a4f4['autoAssociation']===0x0){return db['UserProfileResource'][_0xefd4('0x5d')]({'name':_0x45c49c[_0xefd4('0x3e')],'resourceId':_0x45c49c['id'],'type':_0xe1a4f4[_0xefd4('0x3e')],'sectionId':_0xe1a4f4['id']},{})[_0xefd4('0x23')](function(){return _0x6c8a4c;});}else{return _0x6c8a4c;}})[_0xefd4('0x2c')](function(_0x2cebca){logger[_0xefd4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cebca);throw _0x2cebca;});}return _0x6c8a4c;})[_0xefd4('0x23')](respondWithResult(_0x3d33f1,0xc9))[_0xefd4('0x2c')](handleError(_0x3d33f1,null));};exports['update']=function(_0x320835,_0x3a059b){if(_0x320835[_0xefd4('0x5e')]['id']){delete _0x320835[_0xefd4('0x5e')]['id'];}return db['SmsAccount'][_0xefd4('0x5c')]({'where':{'id':_0x320835[_0xefd4('0x63')]['id']},'include':[{'model':db[_0xefd4('0x58')],'as':_0xefd4('0x40')}]})[_0xefd4('0x23')](handleEntityNotFound(_0x3a059b,null))[_0xefd4('0x23')](saveUpdates(_0x320835[_0xefd4('0x5e')],null))[_0xefd4('0x23')](respondWithResult(_0x3a059b,null))[_0xefd4('0x2c')](handleError(_0x3a059b,null));};exports[_0xefd4('0x3a')]=function(_0x164d1b,_0x20ab3b){return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x164d1b['params']['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x20ab3b,null))[_0xefd4('0x23')](removeEntity(_0x20ab3b,null))[_0xefd4('0x2c')](handleError(_0x20ab3b,null));};exports[_0xefd4('0x64')]=function(_0x548e6f,_0x59762a){return db[_0xefd4('0x42')]['describe']()[_0xefd4('0x23')](respondWithResult(_0x59762a,null))[_0xefd4('0x2c')](handleError(_0x59762a,null));};exports[_0xefd4('0x65')]=function(_0x464b9f,_0x2adf94,_0x5563cb){if(_0x464b9f[_0xefd4('0x5e')]['id']){delete _0x464b9f[_0xefd4('0x5e')]['id'];}return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x464b9f[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x2adf94,null))[_0xefd4('0x23')](function(_0x175e23){if(_0x175e23){_0x464b9f['body'][_0xefd4('0x66')]=_0x175e23['id'];return db[_0xefd4('0x67')]['create'](_0x464b9f[_0xefd4('0x5e')]);}})[_0xefd4('0x23')](respondWithResult(_0x2adf94,null))[_0xefd4('0x2c')](handleError(_0x2adf94,null));};exports[_0xefd4('0x68')]=function(_0x30bc70,_0x3c27dc,_0x5914bd){var _0x49ed2b={'raw':![],'where':{}};var _0x54bef0={};var _0x99e754={'count':0x0,'rows':[]};return db['SmsAccount'][_0xefd4('0x69')]({'where':{'id':_0x30bc70[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x3c27dc,null))[_0xefd4('0x23')](function(_0xe6f836){if(_0xe6f836){_0x54bef0['model']=_[_0xefd4('0x59')](db[_0xefd4('0x67')][_0xefd4('0x43')]);_0x54bef0[_0xefd4('0x46')]=_['keys'](_0x30bc70[_0xefd4('0x46')]);_0x54bef0[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0x54bef0[_0xefd4('0x48')],_0x54bef0['query']);_0x49ed2b[_0xefd4('0x49')]=_[_0xefd4('0x5a')](_0x54bef0[_0xefd4('0x48')],qs[_0xefd4('0x4a')](_0x30bc70['query'][_0xefd4('0x4a')]));_0x49ed2b['attributes']=_0x49ed2b[_0xefd4('0x49')][_0xefd4('0x5b')]?_0x49ed2b[_0xefd4('0x49')]:_0x54bef0[_0xefd4('0x48')];if(!_0x30bc70[_0xefd4('0x46')][_0xefd4('0x4b')]('nolimit')){_0x49ed2b[_0xefd4('0x33')]=qs[_0xefd4('0x33')](_0x30bc70['query'][_0xefd4('0x33')]);_0x49ed2b[_0xefd4('0x31')]=qs[_0xefd4('0x31')](_0x30bc70[_0xefd4('0x46')]['offset']);}_0x49ed2b['order']=qs[_0xefd4('0x4d')](_0x30bc70['query'][_0xefd4('0x4d')]);_0x49ed2b['where']=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x30bc70[_0xefd4('0x46')],_0x54bef0[_0xefd4('0x47')]));_0x49ed2b[_0xefd4('0x4e')][_0xefd4('0x66')]=_0xe6f836['id'];if(_0x30bc70['query'][_0xefd4('0x6a')]){_0x49ed2b[_0xefd4('0x4e')]=_[_0xefd4('0x52')](_0x49ed2b['where'],{'$or':_[_0xefd4('0x41')](_0x49ed2b[_0xefd4('0x49')],function(_0x1c1818){var _0x16937f={};_0x16937f[_0x1c1818]={'$like':'%'+_0x30bc70[_0xefd4('0x46')][_0xefd4('0x6a')]+'%'};return _0x16937f;})});}_0x49ed2b=_['merge']({},_0x49ed2b,_0x30bc70[_0xefd4('0x53')]);return db[_0xefd4('0x67')]['count']({'where':_0x49ed2b[_0xefd4('0x4e')]})[_0xefd4('0x23')](function(_0x530552){_0x99e754[_0xefd4('0x34')]=_0x530552;if(_0x30bc70[_0xefd4('0x46')]['includeAll']){_0x49ed2b['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x49ed2b);})[_0xefd4('0x23')](function(_0x57978b){_0x99e754[_0xefd4('0x56')]=_0x57978b;return _0x99e754;});}})[_0xefd4('0x23')](respondWithFilteredResult(_0x3c27dc,_0x49ed2b))[_0xefd4('0x2c')](handleError(_0x3c27dc,null));};exports[_0xefd4('0x6b')]=function(_0x5989b6,_0x450cb2,_0x508de6){return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x5989b6[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x450cb2,null))[_0xefd4('0x23')](function(_0x57d300){if(_0x57d300){return _0x57d300[_0xefd4('0x6b')](_0x5989b6[_0xefd4('0x46')][_0xefd4('0x6c')]);}})[_0xefd4('0x23')](respondWithStatusCode(_0x450cb2,null))['catch'](handleError(_0x450cb2,null));};exports[_0xefd4('0x6d')]=function(_0x5defdf,_0x596b6a,_0x2da081){if(_0x5defdf['body']['id']){delete _0x5defdf['body']['id'];}return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x5defdf[_0xefd4('0x63')]['id']}})['then'](handleEntityNotFound(_0x596b6a,null))[_0xefd4('0x23')](function(_0x344595){if(_0x344595){_0x5defdf['body'][_0xefd4('0x66')]=_0x344595['id'];return db[_0xefd4('0x6e')][_0xefd4('0x5d')](_0x5defdf['body']);}})[_0xefd4('0x23')](respondWithResult(_0x596b6a,null))['catch'](handleError(_0x596b6a,null));};exports[_0xefd4('0x6f')]=function(_0x5228aa,_0x2d211f,_0x27a534){var _0x1fbda3={'raw':![],'where':{}};var _0x73c287={};var _0x5460a4={'count':0x0,'rows':[]};return db[_0xefd4('0x42')][_0xefd4('0x69')]({'where':{'id':_0x5228aa[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x2d211f,null))[_0xefd4('0x23')](function(_0x1d95b2){if(_0x1d95b2){_0x73c287['model']=_[_0xefd4('0x59')](db[_0xefd4('0x6e')][_0xefd4('0x43')]);_0x73c287[_0xefd4('0x46')]=_['keys'](_0x5228aa[_0xefd4('0x46')]);_0x73c287[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0x73c287[_0xefd4('0x48')],_0x73c287[_0xefd4('0x46')]);_0x1fbda3['attributes']=_[_0xefd4('0x5a')](_0x73c287['model'],qs[_0xefd4('0x4a')](_0x5228aa[_0xefd4('0x46')]['fields']));_0x1fbda3[_0xefd4('0x49')]=_0x1fbda3['attributes'][_0xefd4('0x5b')]?_0x1fbda3[_0xefd4('0x49')]:_0x73c287[_0xefd4('0x48')];if(!_0x5228aa[_0xefd4('0x46')][_0xefd4('0x4b')](_0xefd4('0x70'))){_0x1fbda3[_0xefd4('0x33')]=qs[_0xefd4('0x33')](_0x5228aa['query']['limit']);_0x1fbda3[_0xefd4('0x31')]=qs[_0xefd4('0x31')](_0x5228aa[_0xefd4('0x46')]['offset']);}_0x1fbda3[_0xefd4('0x4c')]=qs['sort'](_0x5228aa[_0xefd4('0x46')][_0xefd4('0x4d')]);_0x1fbda3['where']=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x5228aa['query'],_0x73c287[_0xefd4('0x47')]));_0x1fbda3[_0xefd4('0x4e')]['SmsAccountId']=_0x1d95b2['id'];if(_0x5228aa[_0xefd4('0x46')][_0xefd4('0x6a')]){_0x1fbda3[_0xefd4('0x4e')]=_[_0xefd4('0x52')](_0x1fbda3['where'],{'$or':_[_0xefd4('0x41')](_0x1fbda3[_0xefd4('0x49')],function(_0x4680b2){var _0x1dcd89={};_0x1dcd89[_0x4680b2]={'$like':'%'+_0x5228aa[_0xefd4('0x46')][_0xefd4('0x6a')]+'%'};return _0x1dcd89;})});}_0x1fbda3=_[_0xefd4('0x52')]({},_0x1fbda3,_0x5228aa['options']);return db[_0xefd4('0x6e')]['count']({'where':_0x1fbda3[_0xefd4('0x4e')]})[_0xefd4('0x23')](function(_0x1e3e35){_0x5460a4[_0xefd4('0x34')]=_0x1e3e35;if(_0x5228aa[_0xefd4('0x46')]['includeAll']){_0x1fbda3[_0xefd4('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xefd4('0x71')](_0x1fbda3);})[_0xefd4('0x23')](function(_0x4911fa){_0x5460a4[_0xefd4('0x56')]=_0x4911fa;return _0x5460a4;});}})[_0xefd4('0x23')](respondWithFilteredResult(_0x2d211f,_0x1fbda3))['catch'](handleError(_0x2d211f,null));};exports['removeAnswers']=function(_0x306c5c,_0x5bcf70,_0x420315){return db[_0xefd4('0x42')]['find']({'where':{'id':_0x306c5c[_0xefd4('0x63')]['id']}})['then'](handleEntityNotFound(_0x5bcf70,null))['then'](function(_0x51fc3e){if(_0x51fc3e){return _0x51fc3e[_0xefd4('0x72')](_0x306c5c[_0xefd4('0x46')][_0xefd4('0x6c')]);}})[_0xefd4('0x23')](respondWithStatusCode(_0x5bcf70,null))['catch'](handleError(_0x5bcf70,null));};exports['notify']=function(_0x1d3ac7,_0x1b59d2,_0x52523d){var _0x11a595={'channel':_0xefd4('0x73')};var _0x521727=[];var _0x4a18be=[];var _0x2049b8={};return db['SmsAccount'][_0xefd4('0x5c')]({'where':{'id':_0x1d3ac7[_0xefd4('0x63')]['id']},'include':[{'model':db[_0xefd4('0x74')],'as':_0xefd4('0x75')}]})[_0xefd4('0x23')](handleEntityNotFound(_0x1b59d2,null))[_0xefd4('0x23')](function(_0x1dfafd){_0x11a595[_0xefd4('0x76')]=_0x1dfafd;_0x11a595['applications']=_[_0xefd4('0x77')](_0x1dfafd[_0xefd4('0x75')],['priority'],[_0xefd4('0x78')]);if(_0x11a595[_0xefd4('0x76')][_0xefd4('0x75')]){delete _0x11a595[_0xefd4('0x76')][_0xefd4('0x75')];}return db['CmContact'][_0xefd4('0x64')]();})['then'](function(_0x320e2d){if(!_0x320e2d){throw new db[(_0xefd4('0x79'))]['ValidationError'](_0xefd4('0x7a'));}_0x521727=_[_0xefd4('0x7b')](_[_0xefd4('0x59')](_0x320e2d),[_0xefd4('0x7c'),'updatedAt']);_0x4a18be=_[_0xefd4('0x7b')](_['keys'](_0x320e2d),[_0xefd4('0x7c'),_0xefd4('0x7d'),_0xefd4('0x7e'),'ListId']);_0x11a595[_0xefd4('0x5e')]={'mapKey':_0xefd4('0x7f')};if(_0x11a595[_0xefd4('0x76')][_0xefd4('0x50')]){switch(_0x11a595[_0xefd4('0x76')][_0xefd4('0x50')]){case'twilio':_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x81')];_0x11a595['body']['body']=_0x1d3ac7['body']['Body'];_0x11a595['body']['messageId']=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x82')];break;case _0xefd4('0x83'):_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')]='+'+_0x1d3ac7[_0xefd4('0x5e')]['sender'];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x84')];break;case _0xefd4('0x85'):_0x11a595[_0xefd4('0x5e')]['from']=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x80')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7['body'][_0xefd4('0x2a')];break;case _0xefd4('0x86'):_0x11a595['body'][_0xefd4('0x80')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x80')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')]['body'];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x87')]=_0x1d3ac7[_0xefd4('0x5e')]['message_id'];break;case _0xefd4('0x88'):_0x11a595[_0xefd4('0x5e')]['from']=_0x1d3ac7['body'][_0xefd4('0x81')];_0x11a595['body'][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x89')];_0x11a595['body']['messageId']=_0x1d3ac7[_0xefd4('0x5e')]['MessageUUID'];break;case _0xefd4('0x8a'):_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')]='+'+_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x8b')][0x0][_0xefd4('0x80')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7['body'][_0xefd4('0x8b')][0x0][_0xefd4('0x84')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x87')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x8b')][0x0][_0xefd4('0x87')];break;case'csc':_0x11a595['body'][_0xefd4('0x80')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x8c')];_0x11a595['body'][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x8d')]['message'];break;case _0xefd4('0x8e'):_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x8f')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x84')];_0x11a595['body']['messageId']=_0x1d3ac7[_0xefd4('0x5e')][_0xefd4('0x90')];break;case _0xefd4('0x91'):_0x11a595['body'][_0xefd4('0x87')]=_0x1d3ac7[_0xefd4('0x5e')][0x0]['message']['id'];_0x11a595[_0xefd4('0x5e')]['from']=_0x1d3ac7['body'][0x0]['message']['from'];_0x11a595['body'][_0xefd4('0x5e')]=_0x1d3ac7[_0xefd4('0x5e')][0x0][_0xefd4('0x2a')][_0xefd4('0x84')];break;case _0xefd4('0x92'):_0x11a595[_0xefd4('0x5e')]['from']=_0x1d3ac7['body'][_0xefd4('0x80')];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')]=_0x1d3ac7['body']['message'];_0x11a595[_0xefd4('0x5e')][_0xefd4('0x87')]=_0x1d3ac7['body']['refid'];break;}}if(_0x11a595[_0xefd4('0x5e')]['id']){delete _0x11a595[_0xefd4('0x5e')]['id'];}if(_['isNil'](_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')])){throw new db[(_0xefd4('0x79'))][(_0xefd4('0x93'))]('from\x20is\x20mandatory');}if(_[_0xefd4('0x94')](_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')])||_0x11a595['body'][_0xefd4('0x5e')]===''){throw new db['Sequelize']['ValidationError'](_0xefd4('0x95'));}if(_['isNil'](_0x11a595[_0xefd4('0x5e')]['mapKey'])){throw new db[(_0xefd4('0x79'))][(_0xefd4('0x93'))](_0xefd4('0x96')+_0x4a18be);}if(!_['includes'](_0x4a18be,_0x11a595[_0xefd4('0x5e')][_0xefd4('0x97')])){throw new db[(_0xefd4('0x79'))]['ValidationError'](_0xefd4('0x98')+_0x4a18be);}_0x2049b8[_0x11a595[_0xefd4('0x5e')]['mapKey']]=_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')];return db['CmList'][_0xefd4('0x5c')]({'where':{'id':_0x11a595['account'][_0xefd4('0x99')]},'include':[{'model':db[_0xefd4('0x9a')],'as':'Contacts','where':_0x2049b8,'limit':0x1,'order':[[_0xefd4('0x7d'),_0xefd4('0x9b')]]}]});})[_0xefd4('0x23')](handleEntityNotFound(_0x1b59d2,null))[_0xefd4('0x23')](function(_0x5d970b){if(_0x5d970b){_0x11a595[_0xefd4('0x9c')]=_[_0xefd4('0x9d')](_0x5d970b,[_0xefd4('0x9e')]);if(_0x5d970b[_0xefd4('0x9e')][_0xefd4('0x5b')]){return _0x5d970b[_0xefd4('0x9e')][0x0];}var _0xb91572=_['defaults'](_0x11a595[_0xefd4('0x5e')],{'firstName':_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')],'ListId':_0x5d970b['id']});_0xb91572[_0x11a595[_0xefd4('0x5e')][_0xefd4('0x97')]]=_0x11a595['body'][_0xefd4('0x80')];return db[_0xefd4('0x9a')][_0xefd4('0x5d')](_0xb91572,{'fields':_0x521727,'raw':!![]});}})['then'](handleEntityNotFound(_0x1b59d2,null))[_0xefd4('0x23')](function(_0x18af7b){if(_0x18af7b){_0x11a595['contact']=_0x18af7b;var _0xccffa9={'ContactId':_0x18af7b['id'],'phone':_0x11a595['body'][_0xefd4('0x80')],'SmsAccountId':_0x1d3ac7[_0xefd4('0x63')]['id']};var _0x42c5df={'ContactId':_0x18af7b['id'],'SmsAccountId':_0x1d3ac7[_0xefd4('0x63')]['id'],'closed':![]};return db[_0xefd4('0x9f')][_0xefd4('0x5c')]({'where':_0x42c5df})[_0xefd4('0x23')](function(_0x41eb3d){if(_0x41eb3d){return[_0x41eb3d,![]];}return db['SmsInteraction'][_0xefd4('0x5d')](_0xccffa9)[_0xefd4('0x23')](function(_0x48a895){return[_0x48a895,!![]];});});}})[_0xefd4('0xa0')](function(_0x24efe0,_0x18db51){_0x11a595[_0xefd4('0xa1')]=_0x24efe0[_0xefd4('0x3b')]({'plain':!![]});_0x11a595[_0xefd4('0xa1')][_0xefd4('0xa2')]=![];if(_0x18db51){if(_0x11a595[_0xefd4('0x76')][_0xefd4('0xa3')]){_0x11a595[_0xefd4('0xa4')][_0xefd4('0xa5')]({'id':0x0,'priority':_0x11a595[_0xefd4('0xa4')][_0xefd4('0x5b')]+0x1,'app':_0xefd4('0xa6'),'appdata':'unmanaged','interval':_0xefd4('0xa7')});}_0x11a595[_0xefd4('0xa1')]['created']=!![];}return db[_0xefd4('0xa8')][_0xefd4('0x5d')]({'phone':_0x11a595[_0xefd4('0x5e')][_0xefd4('0x80')],'messageId':_0x11a595[_0xefd4('0x5e')][_0xefd4('0x87')],'body':_0x11a595[_0xefd4('0x5e')][_0xefd4('0x5e')],'SmsAccountId':_0x1d3ac7['params']['id'],'SmsInteractionId':_0x24efe0['id'],'direction':'in','ContactId':_0x24efe0[_0xefd4('0xa9')],'AttachmentId':_0x11a595[_0xefd4('0x5e')][_0xefd4('0xaa')]});})[_0xefd4('0x23')](function(_0xc0ca2f){_0x11a595[_0xefd4('0x2a')]=_0xc0ca2f;if(_0x11a595['interaction'][_0xefd4('0xab')]){return db[_0xefd4('0xac')][_0xefd4('0x5c')]({'attributes':['id','name'],'where':{'id':_0x11a595[_0xefd4('0xa1')][_0xefd4('0xab')]}})[_0xefd4('0x23')](function(_0x42d183){if(_0x42d183){_0x11a595['applications'][_0xefd4('0xad')]({'id':0x0,'priority':0x0,'app':_0xefd4('0xae'),'appdata':_0x42d183[_0xefd4('0x3e')]+','+(_0x11a595[_0xefd4('0x76')][_0xefd4('0xaf')]||0xa),'interval':_0xefd4('0xa7')});}return respondWithRpcPromise('Start',_0xefd4('0xb0'),_0x11a595);});}return respondWithRpcPromise(_0xefd4('0xb1'),_0xefd4('0xb0'),_0x11a595);})[_0xefd4('0x23')](function(_0x162ef8){if(_0x162ef8){var _0x42ea06=0xc8;var _0x471dcf=_0xefd4('0xb2');logger[_0xefd4('0x24')](_0xefd4('0xb3'),_0x471dcf,_0x42ea06,_0xefd4('0xb4'));logger[_0xefd4('0x27')](_0xefd4('0xb5'),_0x471dcf,_0x42ea06,_0xefd4('0xb4'),JSON[_0xefd4('0xb6')](_0x162ef8));if(_0x11a595[_0xefd4('0x76')]['type']==='twilio'){return _0x1b59d2[_0xefd4('0x2e')](_0x42ea06)[_0xefd4('0x35')]('Content-Type',_0xefd4('0xb7'))['send'](_0xefd4('0xb8'));}else{return _0x1b59d2[_0xefd4('0x2e')](_0x42ea06)[_0xefd4('0x30')](_0x162ef8);}}})[_0xefd4('0x2c')](handleError(_0x1b59d2,null));};exports[_0xefd4('0xb9')]=function(_0xf0e762,_0x1df705){var _0x54c1eb=_0xf0e762[_0xefd4('0x63')]['id'];var _0x53dca6=_0xf0e762[_0xefd4('0x5e')];var _0x16a7f5=0xc8;var _0xc545c8=null;return db[_0xefd4('0xba')]['transaction']({'isolationLevel':db[_0xefd4('0xba')]['Transaction'][_0xefd4('0xbb')]['READ_COMMITTED']},function(_0x244427){return db[_0xefd4('0x42')][_0xefd4('0x69')]({'where':{'id':_0x54c1eb},'transaction':_0x244427})[_0xefd4('0x23')](function(_0x8d3a29){if(_0x8d3a29){return db[_0xefd4('0x74')][_0xefd4('0x3a')]({'where':{'SmsAccountId':_0x54c1eb},'transaction':_0x244427})[_0xefd4('0x23')](function(){var _0xa8f460=_[_0xefd4('0x41')](_0x53dca6,function(_0x1c9002){_0x1c9002[_0xefd4('0x66')]=_0x54c1eb;return _0x1c9002;});return db[_0xefd4('0x74')]['bulkCreate'](_0xa8f460,{'transaction':_0x244427});});}else{_0x16a7f5=0x194;_0xc545c8=[];}});})[_0xefd4('0x23')](function(){if(_0x16a7f5!==0x194){return db[_0xefd4('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0x54c1eb},'order':'priority'})[_0xefd4('0x23')](function(_0xc28cca){_0xc545c8=_0xc28cca;});}})[_0xefd4('0x2c')](function(_0x4663bb){_0x16a7f5=0x1f4;logger[_0xefd4('0x28')](_0x4663bb['stack']);if(_0x4663bb[_0xefd4('0x3e')]){delete _0x4663bb[_0xefd4('0x3e')];}_0xc545c8=_0x4663bb;})[_0xefd4('0xbc')](function(){if(_0xc545c8===null){_0x1df705['sendStatus'](_0x16a7f5);}else{if(_0x16a7f5===0x1f4){_0x1df705[_0xefd4('0x2e')](_0x16a7f5)[_0xefd4('0x3f')](_0xc545c8);}else{_0x1df705[_0xefd4('0x2e')](_0x16a7f5)[_0xefd4('0x30')](_0xc545c8);}}});};exports['getApplications']=function(_0x2c7e9f,_0x10fea2,_0x5b9366){var _0x15722e={};var _0xfa66a9={};var _0x4af640;var _0x4d9448;return db[_0xefd4('0x42')][_0xefd4('0x69')]({'where':{'id':_0x2c7e9f[_0xefd4('0x63')]['id']}})['then'](handleEntityNotFound(_0x10fea2,null))['then'](function(_0x15038b){if(_0x15038b){_0x4af640=_0x15038b;_0xfa66a9['model']=_[_0xefd4('0x59')](db[_0xefd4('0x74')][_0xefd4('0x43')]);_0xfa66a9[_0xefd4('0x46')]=_['keys'](_0x2c7e9f[_0xefd4('0x46')]);_0xfa66a9[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0xfa66a9[_0xefd4('0x48')],_0xfa66a9['query']);_0x15722e[_0xefd4('0x49')]=_[_0xefd4('0x5a')](_0xfa66a9['model'],qs['fields'](_0x2c7e9f[_0xefd4('0x46')][_0xefd4('0x4a')]));_0x15722e['attributes']=_0x15722e['attributes'][_0xefd4('0x5b')]?_0x15722e[_0xefd4('0x49')]:_0xfa66a9[_0xefd4('0x48')];_0x15722e[_0xefd4('0x4c')]=qs[_0xefd4('0x4d')](_0x2c7e9f[_0xefd4('0x46')][_0xefd4('0x4d')]);_0x15722e['where']=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x2c7e9f[_0xefd4('0x46')],_0xfa66a9[_0xefd4('0x47')]));if(_0x2c7e9f[_0xefd4('0x46')]['filter']){_0x15722e[_0xefd4('0x4e')]=_[_0xefd4('0x52')](_0x15722e['where'],{'$or':_['map'](_0x15722e['attributes'],function(_0xa5c3a9){var _0x486bb4={};_0x486bb4[_0xa5c3a9]={'$like':'%'+_0x2c7e9f['query']['filter']+'%'};return _0x486bb4;})});}_0x15722e=_[_0xefd4('0x52')]({},_0x15722e,_0x2c7e9f['options']);return _0x4af640['getApplications'](_0x15722e);}})['then'](function(_0x184f49){if(_0x184f49){_0x4d9448=_0x184f49[_0xefd4('0x5b')];if(!_0x2c7e9f[_0xefd4('0x46')]['hasOwnProperty']('nolimit')){_0x15722e[_0xefd4('0x33')]=qs[_0xefd4('0x33')](_0x2c7e9f[_0xefd4('0x46')][_0xefd4('0x33')]);_0x15722e['offset']=qs['offset'](_0x2c7e9f['query'][_0xefd4('0x31')]);}return _0x4af640[_0xefd4('0xbd')](_0x15722e);}})[_0xefd4('0x23')](function(_0x3a6ef8){if(_0x3a6ef8){return _0x3a6ef8?{'count':_0x4d9448,'rows':_0x3a6ef8}:null;}})[_0xefd4('0x23')](respondWithResult(_0x10fea2,null))[_0xefd4('0x2c')](handleError(_0x10fea2,null));};exports[_0xefd4('0xbe')]=function(_0x1f0302,_0x1620de,_0x10889a){var _0x4d4994={'raw':![],'where':{}};var _0x39a447={};var _0x3c8fe5={'count':0x0,'rows':[]};return db[_0xefd4('0x42')]['findOne']({'where':{'id':_0x1f0302['params']['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x1620de,null))[_0xefd4('0x23')](function(_0x255fec){if(_0x255fec){_0x39a447[_0xefd4('0x48')]=_[_0xefd4('0x59')](db[_0xefd4('0x9f')][_0xefd4('0x43')]);_0x39a447['query']=_[_0xefd4('0x59')](_0x1f0302[_0xefd4('0x46')]);_0x39a447[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0x39a447[_0xefd4('0x48')],_0x39a447[_0xefd4('0x46')]);_0x4d4994[_0xefd4('0x49')]=_[_0xefd4('0x5a')](_0x39a447[_0xefd4('0x48')],qs[_0xefd4('0x4a')](_0x1f0302[_0xefd4('0x46')][_0xefd4('0x4a')]));_0x4d4994[_0xefd4('0x49')]=_0x4d4994[_0xefd4('0x49')][_0xefd4('0x5b')]?_0x4d4994['attributes']:_0x39a447['model'];if(!_0x1f0302[_0xefd4('0x46')][_0xefd4('0x4b')]('nolimit')){_0x4d4994[_0xefd4('0x33')]=qs[_0xefd4('0x33')](_0x1f0302[_0xefd4('0x46')]['limit']);_0x4d4994['offset']=qs[_0xefd4('0x31')](_0x1f0302[_0xefd4('0x46')][_0xefd4('0x31')]);}_0x4d4994['order']=qs['sort'](_0x1f0302[_0xefd4('0x46')]['sort']);_0x4d4994[_0xefd4('0x4e')]=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x1f0302[_0xefd4('0x46')],_0x39a447['filters']));_0x4d4994[_0xefd4('0x4e')][_0xefd4('0x66')]=_0x255fec['id'];if(_0x1f0302['query']['filter']){_0x4d4994[_0xefd4('0x4e')]=_[_0xefd4('0x52')](_0x4d4994['where'],{'$or':_[_0xefd4('0x41')](_0x4d4994[_0xefd4('0x49')],function(_0x2b836c){var _0x58cd51={};_0x58cd51[_0x2b836c]={'$like':'%'+_0x1f0302[_0xefd4('0x46')][_0xefd4('0x6a')]+'%'};return _0x58cd51;})});}_0x4d4994=_[_0xefd4('0x52')]({},_0x4d4994,_0x1f0302[_0xefd4('0x53')]);return db[_0xefd4('0x9f')]['count']({'where':_0x4d4994[_0xefd4('0x4e')]})['then'](function(_0x5419a0){_0x3c8fe5[_0xefd4('0x34')]=_0x5419a0;if(_0x1f0302[_0xefd4('0x46')][_0xefd4('0x54')]){_0x4d4994['include']=[{'model':db['CmContact'],'as':_0xefd4('0xbf'),'required':![]},{'model':db[_0xefd4('0xac')],'as':_0xefd4('0xc0'),'attributes':['name',_0xefd4('0xc1'),_0xefd4('0xc2')],'required':![]},{'model':db[_0xefd4('0xc3')],'as':'Tags','attributes':['id','name','color'],'where':_0x1f0302[_0xefd4('0x46')][_0xefd4('0xc4')]?{'id':_0x1f0302['query']['tag']}:undefined,'required':_0x1f0302[_0xefd4('0x46')][_0xefd4('0xc4')]?!![]:![]}];}return db[_0xefd4('0x9f')]['findAll'](_0x4d4994);})[_0xefd4('0x23')](function(_0x37bc1d){_0x3c8fe5['rows']=_0x37bc1d;return _0x3c8fe5;});}})[_0xefd4('0x23')](respondWithFilteredResult(_0x1620de,_0x4d4994))[_0xefd4('0x2c')](handleError(_0x1620de,null));};exports[_0xefd4('0x3f')]=function(_0xeffbc6,_0x1ab99d,_0x393a2c){var _0x12cc61,_0x57754d,_0x372d09;if(_['isNil'](_0xeffbc6[_0xefd4('0x5e')][_0xefd4('0x5e')])||_0xeffbc6[_0xefd4('0x5e')][_0xefd4('0x5e')]===''){throw new db[(_0xefd4('0x79'))][(_0xefd4('0x93'))](_0xefd4('0x95'));}if(_[_0xefd4('0x94')](_0xeffbc6[_0xefd4('0x5e')]['to'])){throw new db[(_0xefd4('0x79'))][(_0xefd4('0x93'))](_0xefd4('0xc5'));}_0x12cc61=_0xeffbc6['body']['to'];return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0xeffbc6[_0xefd4('0x63')]['id']},'include':[{'model':db[_0xefd4('0xc6')],'as':_0xefd4('0xc7'),'include':[{'model':db[_0xefd4('0x9a')],'as':'Contacts','where':{'mobile':_0x12cc61},'limit':0x1,'order':[['updatedAt',_0xefd4('0x9b')]]}]}]})[_0xefd4('0x23')](handleEntityNotFound(_0x1ab99d,null))['then'](function(_0x121f97){if(_0x121f97&&_0x121f97[_0xefd4('0xc7')]){_0x57754d=_0x121f97[_0xefd4('0x3b')]({'plain':!![]});if(_0x57754d['List']&&_0x57754d[_0xefd4('0xc7')][_0xefd4('0x9e')][_0xefd4('0x5b')]){return _0x57754d[_0xefd4('0xc7')][_0xefd4('0x9e')][0x0];}return db[_0xefd4('0x9a')][_0xefd4('0x5d')](_[_0xefd4('0x1b')](_0xeffbc6[_0xefd4('0x5e')],{'firstName':_0x12cc61,'mobile':_0x12cc61,'phone':_0x12cc61,'ListId':_0x57754d[_0xefd4('0x99')]}));}})['then'](handleEntityNotFound(_0x1ab99d,null))[_0xefd4('0x23')](function(_0x371ea7){if(_0x371ea7){_0x372d09=_0x371ea7;return db[_0xefd4('0x9f')][_0xefd4('0x5c')]({'where':{'ContactId':_0x372d09['id'],'closed':![],'SmsAccountId':_0x57754d['id']}})[_0xefd4('0x23')](function(_0x29f3eb){if(_0x29f3eb){return[_0x29f3eb,![]];}return db[_0xefd4('0x9f')]['create']({'UserId':_0xeffbc6[_0xefd4('0x5f')]['id'],'ContactId':_0x372d09['id'],'SmsAccountId':_0x57754d['id'],'phone':_0x12cc61,'firstMsgDirection':'out','Messages':[_[_0xefd4('0x52')](_0xeffbc6[_0xefd4('0x5e')],{'read':![],'body':_0xeffbc6[_0xefd4('0x5e')]['body'],'phone':_0x12cc61,'SmsAccountId':_0x57754d['id'],'UserId':_0xeffbc6['user']['id'],'ContactId':_0x372d09['id']})]},{'include':[{'model':db[_0xefd4('0xa8')],'as':'Messages'}]})[_0xefd4('0x23')](function(_0x387722){return[_0x387722,!![]];});});}})[_0xefd4('0xa0')](function(_0x35bdbb,_0x198d13){if(_0x198d13){return _0x35bdbb;}return db[_0xefd4('0xa8')][_0xefd4('0x5d')](_[_0xefd4('0x52')](_0xeffbc6[_0xefd4('0x5e')],{'read':![],'body':_0xeffbc6[_0xefd4('0x5e')][_0xefd4('0x5e')],'phone':_0x12cc61,'SmsAccountId':_0x57754d['id'],'SmsInteractionId':_0x35bdbb['id'],'UserId':_0xeffbc6[_0xefd4('0x5f')]['id'],'ContactId':_0x372d09['id']}))[_0xefd4('0x23')](function(_0x356e34){_0x35bdbb['dataValues']['Messages']=[];_0x35bdbb[_0xefd4('0xc8')][_0xefd4('0xc9')][_0xefd4('0xa5')](_0x356e34[_0xefd4('0xc8')]);return _0x35bdbb;});})[_0xefd4('0x23')](respondWithResult(_0x1ab99d,null))[_0xefd4('0x2c')](handleError(_0x1ab99d,null));};exports[_0xefd4('0x2e')]=function(_0x19b276,_0x3094b3,_0x3f36ae){if(_0x19b276[_0xefd4('0x5e')]['id']){delete _0x19b276[_0xefd4('0x5e')]['id'];}var _0x2d5767,_0x383260,_0xe515d5;return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x19b276['params']['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x3094b3,null))[_0xefd4('0x23')](function(_0x2e464d){if(_0x2e464d){_0xe515d5=_0x2e464d;logger['debug'](_0xefd4('0xb3'),_0xefd4('0x2e'),_0xefd4('0xca'),_0x2e464d[_0xefd4('0x50')],util['inspect'](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));switch(_0x2e464d[_0xefd4('0x50')]){case _0xefd4('0x83'):if(_0x19b276['body'][_0xefd4('0xcb')]&&_0x19b276[_0xefd4('0x5e')][_0xefd4('0x2e')]){_0x383260=_0x19b276[_0xefd4('0x5e')][_0xefd4('0x2e')];return db['SmsMessage'][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276[_0xefd4('0x5e')][_0xefd4('0xcb')]}});}break;case'connectel':if(_0x19b276[_0xefd4('0x5e')][_0xefd4('0xcc')]&&_0x19b276['body'][_0xefd4('0xcd')]){_0x383260=_0x19b276[_0xefd4('0x5e')][_0xefd4('0xcd')];return db[_0xefd4('0xa8')][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276[_0xefd4('0x5e')]['requestid']}});}break;case _0xefd4('0x86'):if(_0x19b276[_0xefd4('0x5e')]['message_id']&&_0x19b276[_0xefd4('0x5e')][_0xefd4('0xce')]){_0x383260=_0x19b276['body'][_0xefd4('0xce')];return db[_0xefd4('0xa8')][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276[_0xefd4('0x5e')][_0xefd4('0xcf')]}});}break;case'infobip':var _0xfa4b8f=_0x19b276[_0xefd4('0x5e')][_0xefd4('0x8b')][0x0];if(_0xfa4b8f[_0xefd4('0x87')]&&_0xfa4b8f['status'][_0xefd4('0xd0')]===_0xefd4('0xd1')){_0x383260=_0xfa4b8f[_0xefd4('0x2e')][_0xefd4('0xd0')];return db['SmsMessage'][_0xefd4('0x5c')]({'where':{'messageId':_0xfa4b8f[_0xefd4('0x87')]}});}break;case _0xefd4('0x8e'):if(_0x19b276[_0xefd4('0x5e')]['messageId']&&_0x19b276[_0xefd4('0x5e')][_0xefd4('0x2e')]){_0x383260=_0x19b276[_0xefd4('0x5e')][_0xefd4('0x2e')];return db[_0xefd4('0xa8')][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276[_0xefd4('0x5e')]['messageId']}});}break;case _0xefd4('0x91'):if(_0x19b276['body'][0x0][_0xefd4('0x2a')]['id']){_0x383260=_0x19b276[_0xefd4('0x5e')][0x0]['type'];return db['SmsMessage'][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276['body'][0x0][_0xefd4('0x2a')]['id']}});}break;case'intelepeer':if(_0x19b276[_0xefd4('0x5e')]['redif']&&_0x19b276['body'][_0xefd4('0x2e')]){_0x383260=_0x19b276['body']['status'];return db[_0xefd4('0xa8')][_0xefd4('0x5c')]({'where':{'messageId':_0x19b276[_0xefd4('0x5e')][_0xefd4('0xd2')]}});}break;}}})[_0xefd4('0x23')](handleEntityNotFound(_0x3094b3,null))[_0xefd4('0x23')](function(_0x10a0ae){if(_0x10a0ae){_0x2d5767=_0x10a0ae;switch(_0xe515d5[_0xefd4('0x50')]){case _0xefd4('0x83'):if(_0x383260==='DELIVERED'){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger['error'](_0xefd4('0xb3'),_0xefd4('0x2e'),'skebby',util[_0xefd4('0xd3')](_0x19b276['body'],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x85'):if(_0x383260==='1'){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),_0xefd4('0x2e'),_0xefd4('0x83'),util[_0xefd4('0xd3')](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x86'):if(!_0x19b276[_0xefd4('0x5e')][_0xefd4('0xd4')]&&_0x383260>=0xc8&&_0x383260<=0xce){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),_0xefd4('0x2e'),_0xefd4('0x86'),util[_0xefd4('0xd3')](_0x19b276['body'],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x8a'):var _0x7ec7ce=_0x19b276[_0xefd4('0x5e')][_0xefd4('0x8b')][0x0];if(_0x7ec7ce[_0xefd4('0x2e')][_0xefd4('0xd0')]===_0xefd4('0xd1')){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),_0xefd4('0x2e'),'infobip',util[_0xefd4('0xd3')](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x8e'):if(_0x383260==_0xefd4('0xd5')||_0x383260==_0xefd4('0xd6')){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),'status',_0xefd4('0x8e'),util['inspect'](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x91'):if(_0x383260=='message-delivered'){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),'status',_0xefd4('0x91'),util['inspect'](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xefd4('0x92'):if(_0x383260===_0xefd4('0xd7')||_0x383260==='ACCEPTD'){return _0x2d5767[_0xefd4('0x39')]({'read':!![]});}else{logger[_0xefd4('0x28')](_0xefd4('0xb3'),_0xefd4('0x2e'),'intelepeer',util[_0xefd4('0xd3')](_0x19b276[_0xefd4('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x2d5767;}})['then'](respondWithResult(_0x3094b3,null))[_0xefd4('0x2c')](handleError(_0x3094b3,null));};exports[_0xefd4('0xd8')]=function(_0x121726,_0x314c8a,_0x268992){var _0x2ba2fa,_0x26fff5,_0x581792;return db[_0xefd4('0x42')]['find']({'where':{'id':_0x121726['params']['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x314c8a,null))['then'](function(_0x3f9df5){if(_0x3f9df5){_0x581792=_0x3f9df5;logger[_0xefd4('0x27')](_0xefd4('0xb3'),_0xefd4('0x2e'),_0xefd4('0xca'),_0x3f9df5[_0xefd4('0x50')],util['inspect'](_0x121726[_0xefd4('0x46')],{'showHidden':![],'depth':null}));switch(_0x3f9df5[_0xefd4('0x50')]){case _0xefd4('0xd9'):if(_0x121726[_0xefd4('0x46')]['message-id']&&_0x121726[_0xefd4('0x46')][_0xefd4('0xda')]){_0x26fff5=_0x121726['query'][_0xefd4('0xda')];return db[_0xefd4('0xa8')]['find']({'where':{'messageId':_0x121726['query'][_0xefd4('0xdb')]}});}break;}}})['then'](handleEntityNotFound(_0x314c8a,null))[_0xefd4('0x23')](function(_0x13a6db){if(_0x13a6db){_0x2ba2fa=_0x13a6db;switch(_0x581792[_0xefd4('0x50')]){case _0xefd4('0xd9'):if(_0x26fff5==='2'||_0x26fff5==='6'){return _0x2ba2fa[_0xefd4('0x39')]({'read':!![]});}else{logger['error'](_0xefd4('0xb3'),'status',_0xefd4('0xd9'),util[_0xefd4('0xd3')](_0x121726['query'],{'showHidden':![],'depth':null}));};break;}return _0x2ba2fa;}})[_0xefd4('0x23')](respondWithResult(_0x314c8a,null))[_0xefd4('0x2c')](handleError(_0x314c8a,null));};exports[_0xefd4('0xdc')]=function(_0x3a8b65,_0x3a8e77,_0x247b65){return db['SmsAccount'][_0xefd4('0x5c')]({'where':{'id':_0x3a8b65[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x3a8e77,null))[_0xefd4('0x23')](function(_0x3a7ef8){if(_0x3a7ef8){return _0x3a7ef8[_0xefd4('0xdc')](_0x3a8b65[_0xefd4('0x5e')][_0xefd4('0x6c')],_['omit'](_0x3a8b65[_0xefd4('0x5e')],[_0xefd4('0x6c'),'id'])||{})[_0xefd4('0xa0')](function(_0x5e5da0){for(var _0x58fc0c=0x0;_0x58fc0c<_0x3a8b65['body']['ids'][_0xefd4('0x5b')];_0x58fc0c+=0x1){socket['emit'](_0xefd4('0xdd'),{'UserId':Number(_0x3a8b65['body']['ids'][_0x58fc0c]),'SmsAccountId':Number(_0x3a8b65['params']['id'])});}return _0x5e5da0;});}})['then'](respondWithResult(_0x3a8e77,null))[_0xefd4('0x2c')](handleError(_0x3a8e77,null));};exports[_0xefd4('0xde')]=function(_0x13e642,_0x1b33c9,_0x1bcc93){return db[_0xefd4('0x42')][_0xefd4('0x5c')]({'where':{'id':_0x13e642[_0xefd4('0x63')]['id']}})[_0xefd4('0x23')](handleEntityNotFound(_0x1b33c9,null))[_0xefd4('0x23')](function(_0x2dadda){if(_0x2dadda){return _0x2dadda[_0xefd4('0xde')](_0x13e642[_0xefd4('0x46')][_0xefd4('0x6c')])[_0xefd4('0x23')](function(){if(_['isArray'](_0x13e642[_0xefd4('0x46')][_0xefd4('0x6c')])){for(var _0x57f970=0x0;_0x57f970<_0x13e642[_0xefd4('0x46')]['ids'][_0xefd4('0x5b')];_0x57f970+=0x1){socket[_0xefd4('0xdf')](_0xefd4('0xe0'),{'UserId':Number(_0x13e642[_0xefd4('0x46')][_0xefd4('0x6c')][_0x57f970]),'SmsAccountId':Number(_0x13e642[_0xefd4('0x63')]['id'])});}}else{socket[_0xefd4('0xdf')](_0xefd4('0xe0'),{'UserId':Number(_0x13e642[_0xefd4('0x46')][_0xefd4('0x6c')]),'SmsAccountId':Number(_0x13e642[_0xefd4('0x63')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b33c9,null))[_0xefd4('0x2c')](handleError(_0x1b33c9,null));};exports[_0xefd4('0xe1')]=function(_0x2666fc,_0x576b35,_0x2b679f){var _0x2caf97={};var _0x39a47a={};var _0x177825;var _0x5e1171;return db[_0xefd4('0x42')][_0xefd4('0x69')]({'where':{'id':_0x2666fc[_0xefd4('0x63')]['id']}})['then'](handleEntityNotFound(_0x576b35,null))[_0xefd4('0x23')](function(_0x33aba9){if(_0x33aba9){_0x177825=_0x33aba9;_0x39a47a['model']=_[_0xefd4('0x59')](db[_0xefd4('0xac')]['rawAttributes']);_0x39a47a[_0xefd4('0x46')]=_[_0xefd4('0x59')](_0x2666fc['query']);_0x39a47a[_0xefd4('0x47')]=_[_0xefd4('0x5a')](_0x39a47a[_0xefd4('0x48')],_0x39a47a[_0xefd4('0x46')]);_0x2caf97[_0xefd4('0x49')]=_[_0xefd4('0x5a')](_0x39a47a[_0xefd4('0x48')],qs[_0xefd4('0x4a')](_0x2666fc[_0xefd4('0x46')]['fields']));_0x2caf97[_0xefd4('0x49')]=_0x2caf97[_0xefd4('0x49')]['length']?_0x2caf97['attributes']:_0x39a47a[_0xefd4('0x48')];_0x2caf97[_0xefd4('0x4c')]=qs[_0xefd4('0x4d')](_0x2666fc[_0xefd4('0x46')][_0xefd4('0x4d')]);_0x2caf97['where']=qs[_0xefd4('0x47')](_[_0xefd4('0x4f')](_0x2666fc[_0xefd4('0x46')],_0x39a47a[_0xefd4('0x47')]));if(_0x2666fc[_0xefd4('0x46')][_0xefd4('0x6a')]){_0x2caf97[_0xefd4('0x4e')]=_[_0xefd4('0x52')](_0x2caf97[_0xefd4('0x4e')],{'$or':_[_0xefd4('0x41')](_0x2caf97[_0xefd4('0x49')],function(_0x3f83c1){var _0x1e3286={};_0x1e3286[_0x3f83c1]={'$like':'%'+_0x2666fc[_0xefd4('0x46')][_0xefd4('0x6a')]+'%'};return _0x1e3286;})});}_0x2caf97=_[_0xefd4('0x52')]({},_0x2caf97,_0x2666fc[_0xefd4('0x53')]);return _0x177825[_0xefd4('0xe1')](_0x2caf97);}})[_0xefd4('0x23')](function(_0x3cc8db){if(_0x3cc8db){_0x5e1171=_0x3cc8db[_0xefd4('0x5b')];if(!_0x2666fc[_0xefd4('0x46')][_0xefd4('0x4b')]('nolimit')){_0x2caf97[_0xefd4('0x33')]=qs['limit'](_0x2666fc['query'][_0xefd4('0x33')]);_0x2caf97[_0xefd4('0x31')]=qs[_0xefd4('0x31')](_0x2666fc[_0xefd4('0x46')][_0xefd4('0x31')]);}return _0x177825[_0xefd4('0xe1')](_0x2caf97);}})[_0xefd4('0x23')](function(_0x4b8fb0){if(_0x4b8fb0){return _0x4b8fb0?{'count':_0x5e1171,'rows':_0x4b8fb0}:null;}})['then'](respondWithResult(_0x576b35,null))[_0xefd4('0x2c')](handleError(_0x576b35,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index c22eb50..402a9cd 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 _0x1948=['save','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1948,0x14d));var _0x8194=function(_0x3cb9d6,_0x2f0d55){_0x3cb9d6=_0x3cb9d6-0x0;var _0x1d32f9=_0x1948[_0x3cb9d6];return _0x1d32f9;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x8194('0x0'))['db'][_0x8194('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8194('0x2')](0x0);var events={'afterCreate':_0x8194('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10118e){return function(_0x1494a1,_0xb0ff0a,_0x2cff71){SmsAccountEvents[_0x8194('0x4')](_0x10118e+':'+_0x1494a1['id'],_0x1494a1);SmsAccountEvents[_0x8194('0x4')](_0x10118e,_0x1494a1);_0x2cff71(null);};}for(var e in events){if(events[_0x8194('0x5')](e)){var event=events[e];SmsAccount[_0x8194('0x6')](e,emitEvent(event));}}module[_0x8194('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x75fc=['exports','events','SmsAccount','update','remove','emit','hasOwnProperty','hook'];(function(_0x393055,_0x309968){var _0x5411f9=function(_0x6c4426){while(--_0x6c4426){_0x393055['push'](_0x393055['shift']());}};_0x5411f9(++_0x309968);}(_0x75fc,0x199));var _0xc75f=function(_0x260bed,_0x553a99){_0x260bed=_0x260bed-0x0;var _0x32d6fb=_0x75fc[_0x260bed];return _0x32d6fb;};'use strict';var EventEmitter=require(_0xc75f('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xc75f('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc75f('0x2'),'afterDestroy':_0xc75f('0x3')};function emitEvent(_0x5399eb){return function(_0x3cd51d,_0xd310b9,_0x108111){SmsAccountEvents[_0xc75f('0x4')](_0x5399eb+':'+_0x3cd51d['id'],_0x3cd51d);SmsAccountEvents['emit'](_0x5399eb,_0x3cd51d);_0x108111(null);};}for(var e in events){if(events[_0xc75f('0x5')](e)){var event=events[e];SmsAccount[_0xc75f('0x6')](e,emitEvent(event));}}module[_0xc75f('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 86d732f..281cce5 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 _0x9ac0=['SmsAccount','sms_accounts','util','../../config/logger','rimraf','./smsAccount.attributes','exports'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x9ac0,0x1e5));var _0x09ac=function(_0x399f37,_0x455057){_0x399f37=_0x399f37-0x0;var _0x4da913=_0x9ac0[_0x399f37];return _0x4da913;};'use strict';var _=require('lodash');var util=require(_0x09ac('0x0'));var logger=require(_0x09ac('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09ac('0x2'));var config=require('../../config/environment');var attributes=require(_0x09ac('0x3'));module[_0x09ac('0x4')]=function(_0x651bb1,_0x4c1687){return _0x651bb1['define'](_0x09ac('0x5'),attributes,{'tableName':_0x09ac('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70b2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','util'];(function(_0x55a493,_0xfed0ba){var _0x41d1b9=function(_0x3ad47b){while(--_0x3ad47b){_0x55a493['push'](_0x55a493['shift']());}};_0x41d1b9(++_0xfed0ba);}(_0x70b2,0x1b9));var _0x270b=function(_0x5b69fa,_0x2e4f35){_0x5b69fa=_0x5b69fa-0x0;var _0x34144a=_0x70b2[_0x5b69fa];return _0x34144a;};'use strict';var _=require('lodash');var util=require(_0x270b('0x0'));var logger=require(_0x270b('0x1'))(_0x270b('0x2'));var moment=require('moment');var BPromise=require(_0x270b('0x3'));var rp=require(_0x270b('0x4'));var fs=require('fs');var path=require(_0x270b('0x5'));var rimraf=require(_0x270b('0x6'));var config=require(_0x270b('0x7'));var attributes=require(_0x270b('0x8'));module[_0x270b('0x9')]=function(_0xfa233,_0x5cd96c){return _0xfa233[_0x270b('0xa')](_0x270b('0xb'),attributes,{'tableName':_0x270b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index ff37439..d7d6d12 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 _0x4ae1=['ShowSmsAccount','SmsAccount','options','raw','attributes','map','model','include','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','register','then','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3201cd,_0x2e44ed){var _0x5ce5b4=function(_0x5655ce){while(--_0x5655ce){_0x3201cd['push'](_0x3201cd['shift']());}};_0x5ce5b4(++_0x2e44ed);}(_0x4ae1,0xb3));var _0x14ae=function(_0x5311a1,_0x304912){_0x5311a1=_0x5311a1-0x0;var _0x2acb9f=_0x4ae1[_0x5311a1];return _0x2acb9f;};'use strict';var _=require(_0x14ae('0x0'));var util=require(_0x14ae('0x1'));var moment=require(_0x14ae('0x2'));var BPromise=require('bluebird');var rs=require(_0x14ae('0x3'));var fs=require('fs');var Redis=require(_0x14ae('0x4'));var db=require(_0x14ae('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ae('0x6'))(_0x14ae('0x7'));var config=require(_0x14ae('0x8'));var jayson=require(_0x14ae('0x9'));var client=jayson['client'][_0x14ae('0xa')]({'port':0x232a});config[_0x14ae('0xb')]=_[_0x14ae('0xc')](config[_0x14ae('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14ae('0xb')]));require('./smsAccount.socket')[_0x14ae('0xd')](socket);function respondWithRpcPromise(_0x3dcc17,_0x32909b,_0x3e0afa){return new BPromise(function(_0x4380fc,_0x2a9478){return client['request'](_0x3dcc17,_0x3e0afa)[_0x14ae('0xe')](function(_0x25bc85){logger['info'](_0x14ae('0xf'),_0x32909b,'request\x20sent');logger['debug'](_0x14ae('0x10'),_0x32909b,_0x14ae('0x11'),JSON[_0x14ae('0x12')](_0x25bc85));if(_0x25bc85[_0x14ae('0x13')]){if(_0x25bc85[_0x14ae('0x13')][_0x14ae('0x14')]===0x1f4){logger[_0x14ae('0x13')](_0x14ae('0xf'),_0x32909b,_0x25bc85['error']['message']);return _0x2a9478(_0x25bc85['error'][_0x14ae('0x15')]);}logger[_0x14ae('0x13')](_0x14ae('0xf'),_0x32909b,_0x25bc85['error']['message']);return _0x4380fc(_0x25bc85[_0x14ae('0x13')][_0x14ae('0x15')]);}else{logger[_0x14ae('0x16')](_0x14ae('0xf'),_0x32909b,_0x14ae('0x11'));_0x4380fc(_0x25bc85[_0x14ae('0x17')]['message']);}})[_0x14ae('0x18')](function(_0x437367){logger[_0x14ae('0x13')](_0x14ae('0xf'),_0x32909b,_0x437367);_0x2a9478(_0x437367);});});}exports[_0x14ae('0x19')]=function(_0x5197dd){var _0xa3c962=this;return new Promise(function(_0x3351d2,_0x391ee6){return db[_0x14ae('0x1a')]['find']({'raw':_0x5197dd['options']?_0x5197dd[_0x14ae('0x1b')][_0x14ae('0x1c')]===undefined?!![]:![]:!![],'where':_0x5197dd[_0x14ae('0x1b')]?_0x5197dd['options']['where']||null:null,'attributes':_0x5197dd[_0x14ae('0x1b')]?_0x5197dd[_0x14ae('0x1b')][_0x14ae('0x1d')]||null:null,'include':_0x5197dd[_0x14ae('0x1b')]?_0x5197dd[_0x14ae('0x1b')]['include']?_[_0x14ae('0x1e')](_0x5197dd[_0x14ae('0x1b')]['include'],function(_0x12a569){return{'model':db[_0x12a569[_0x14ae('0x1f')]],'as':_0x12a569['as'],'attributes':_0x12a569['attributes'],'include':_0x12a569[_0x14ae('0x20')]?_['map'](_0x12a569[_0x14ae('0x20')],function(_0x535ba7){return{'model':db[_0x535ba7[_0x14ae('0x1f')]],'as':_0x535ba7['as'],'attributes':_0x535ba7[_0x14ae('0x1d')],'include':_0x535ba7[_0x14ae('0x20')]?_['map'](_0x535ba7[_0x14ae('0x20')],function(_0x345968){return{'model':db[_0x345968[_0x14ae('0x1f')]],'as':_0x345968['as'],'attributes':_0x345968[_0x14ae('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x14ae('0xe')](function(_0x30db4e){logger[_0x14ae('0x16')](_0x14ae('0x19'),_0x5197dd);logger[_0x14ae('0x21')]('ShowSmsAccount',_0x5197dd,JSON[_0x14ae('0x12')](_0x30db4e));_0x3351d2(_0x30db4e);})[_0x14ae('0x18')](function(_0x5d88dd){logger[_0x14ae('0x13')](_0x14ae('0x19'),_0x5d88dd[_0x14ae('0x15')],_0x5197dd);_0x391ee6(_0xa3c962[_0x14ae('0x13')](0x1f4,_0x5d88dd[_0x14ae('0x15')]));});});}; \ No newline at end of file +var _0xfa18=['model','ShowSmsAccount','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./smsAccount.socket','register','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','find','options','where','attributes','include','map'];(function(_0x109876,_0x4dabbd){var _0x2e6067=function(_0x396866){while(--_0x396866){_0x109876['push'](_0x109876['shift']());}};_0x2e6067(++_0x4dabbd);}(_0xfa18,0x8b));var _0x8fa1=function(_0x384352,_0x8f42a3){_0x384352=_0x384352-0x0;var _0x4604fb=_0xfa18[_0x384352];return _0x4604fb;};'use strict';var _=require('lodash');var util=require(_0x8fa1('0x0'));var moment=require('moment');var BPromise=require(_0x8fa1('0x1'));var rs=require(_0x8fa1('0x2'));var fs=require('fs');var Redis=require(_0x8fa1('0x3'));var db=require(_0x8fa1('0x4'))['db'];var utils=require(_0x8fa1('0x5'));var logger=require(_0x8fa1('0x6'))(_0x8fa1('0x7'));var config=require(_0x8fa1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8fa1('0x9')][_0x8fa1('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8fa1('0xb')],{'host':_0x8fa1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8fa1('0xd'))[_0x8fa1('0xe')](socket);function respondWithRpcPromise(_0x14c075,_0x315959,_0x48f71b){return new BPromise(function(_0x2d7935,_0x2b7a33){return client['request'](_0x14c075,_0x48f71b)[_0x8fa1('0xf')](function(_0xb0755){logger[_0x8fa1('0x10')]('SmsAccount,\x20%s,\x20%s',_0x315959,_0x8fa1('0x11'));logger[_0x8fa1('0x12')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x315959,_0x8fa1('0x11'),JSON['stringify'](_0xb0755));if(_0xb0755['error']){if(_0xb0755[_0x8fa1('0x13')][_0x8fa1('0x14')]===0x1f4){logger['error'](_0x8fa1('0x15'),_0x315959,_0xb0755[_0x8fa1('0x13')][_0x8fa1('0x16')]);return _0x2b7a33(_0xb0755['error'][_0x8fa1('0x16')]);}logger[_0x8fa1('0x13')](_0x8fa1('0x15'),_0x315959,_0xb0755['error']['message']);return _0x2d7935(_0xb0755[_0x8fa1('0x13')][_0x8fa1('0x16')]);}else{logger[_0x8fa1('0x10')]('SmsAccount,\x20%s,\x20%s',_0x315959,_0x8fa1('0x11'));_0x2d7935(_0xb0755[_0x8fa1('0x17')][_0x8fa1('0x16')]);}})[_0x8fa1('0x18')](function(_0x3f0207){logger[_0x8fa1('0x13')]('SmsAccount,\x20%s,\x20%s',_0x315959,_0x3f0207);_0x2b7a33(_0x3f0207);});});}exports['ShowSmsAccount']=function(_0xbbf368){var _0x4a6601=this;return new Promise(function(_0x530eb8,_0x431eeb){return db['SmsAccount'][_0x8fa1('0x19')]({'raw':_0xbbf368[_0x8fa1('0x1a')]?_0xbbf368[_0x8fa1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xbbf368[_0x8fa1('0x1a')]?_0xbbf368[_0x8fa1('0x1a')][_0x8fa1('0x1b')]||null:null,'attributes':_0xbbf368[_0x8fa1('0x1a')]?_0xbbf368[_0x8fa1('0x1a')][_0x8fa1('0x1c')]||null:null,'include':_0xbbf368[_0x8fa1('0x1a')]?_0xbbf368[_0x8fa1('0x1a')][_0x8fa1('0x1d')]?_[_0x8fa1('0x1e')](_0xbbf368[_0x8fa1('0x1a')]['include'],function(_0x1883ac){return{'model':db[_0x1883ac[_0x8fa1('0x1f')]],'as':_0x1883ac['as'],'attributes':_0x1883ac[_0x8fa1('0x1c')],'include':_0x1883ac[_0x8fa1('0x1d')]?_[_0x8fa1('0x1e')](_0x1883ac[_0x8fa1('0x1d')],function(_0x281391){return{'model':db[_0x281391['model']],'as':_0x281391['as'],'attributes':_0x281391[_0x8fa1('0x1c')],'include':_0x281391[_0x8fa1('0x1d')]?_[_0x8fa1('0x1e')](_0x281391[_0x8fa1('0x1d')],function(_0x21070f){return{'model':db[_0x21070f[_0x8fa1('0x1f')]],'as':_0x21070f['as'],'attributes':_0x21070f[_0x8fa1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8fa1('0xf')](function(_0xe7ec1b){logger[_0x8fa1('0x10')](_0x8fa1('0x20'),_0xbbf368);logger['debug']('ShowSmsAccount',_0xbbf368,JSON[_0x8fa1('0x21')](_0xe7ec1b));_0x530eb8(_0xe7ec1b);})[_0x8fa1('0x18')](function(_0x5dc96f){logger[_0x8fa1('0x13')](_0x8fa1('0x20'),_0x5dc96f[_0x8fa1('0x16')],_0xbbf368);_0x431eeb(_0x4a6601[_0x8fa1('0x13')](0x1f4,_0x5dc96f[_0x8fa1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 49ed2ff..bb25eb5 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(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 35e9bf7..390d015 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x3652a6,_0x564c8b){var _0x477dd1=function(_0x27a746){while(--_0x27a746){_0x3652a6['push'](_0x3652a6['shift']());}};_0x477dd1(++_0x564c8b);}(_0x55ca,0x126));var _0xa55c=function(_0x9a825b,_0x35c63e){_0x9a825b=_0x9a825b-0x0;var _0x4e5706=_0x55ca[_0x9a825b];return _0x4e5706;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x468342,_0x15e0ed){var _0x204a5c=function(_0x20917d){while(--_0x20917d){_0x468342['push'](_0x468342['shift']());}};_0x204a5c(++_0x15e0ed);}(_0x34e8,0x12c));var _0x834e=function(_0x432c92,_0x114b1e){_0x432c92=_0x432c92-0x0;var _0x2cdf70=_0x34e8[_0x432c92];return _0x2cdf70;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 83f249b..b30598f 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 _0x4c0b=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4c0b,0x120));var _0xb4c0=function(_0x27bd36,_0x54058a){_0x27bd36=_0x27bd36-0x0;var _0x1ac09e=_0x4c0b[_0x27bd36];return _0x1ac09e;};'use strict';var Sequelize=require(_0xb4c0('0x0'));module[_0xb4c0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4c0('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb4c0('0x3')]()},'description':{'type':Sequelize[_0xb4c0('0x2')]},'interval':{'type':Sequelize[_0xb4c0('0x2')],'defaultValue':_0xb4c0('0x4')}}; \ No newline at end of file +var _0xa19e=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x1b9f5a,_0x4543b0){var _0x4a5969=function(_0x571bb3){while(--_0x571bb3){_0x1b9f5a['push'](_0x1b9f5a['shift']());}};_0x4a5969(++_0x4543b0);}(_0xa19e,0x12e));var _0xea19=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0xa19e[_0x126f47];return _0x49508a;};'use strict';var Sequelize=require(_0xea19('0x0'));module[_0xea19('0x1')]={'priority':{'type':Sequelize[_0xea19('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xea19('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xea19('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xea19('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 100bac3..229c75e 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 _0xe8af=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0xe8af,0x178));var _0xfe8a=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xe8af[_0x1e2080];return _0x260111;};'use strict';var emlformat=require(_0xfe8a('0x0'));var rimraf=require(_0xfe8a('0x1'));var zipdir=require(_0xfe8a('0x2'));var jsonpatch=require(_0xfe8a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfe8a('0x4'));var Mustache=require(_0xfe8a('0x5'));var util=require(_0xfe8a('0x6'));var path=require(_0xfe8a('0x7'));var sox=require(_0xfe8a('0x8'));var csv=require(_0xfe8a('0x9'));var ejs=require(_0xfe8a('0xa'));var fs=require('fs');var fs_extra=require(_0xfe8a('0xb'));var _=require(_0xfe8a('0xc'));var squel=require(_0xfe8a('0xd'));var crypto=require(_0xfe8a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfe8a('0xf'));var toCsv=require(_0xfe8a('0x9'));var querystring=require(_0xfe8a('0x10'));var Papa=require(_0xfe8a('0x11'));var Redis=require(_0xfe8a('0x12'));var authService=require(_0xfe8a('0x13'));var qs=require(_0xfe8a('0x14'));var as=require(_0xfe8a('0x15'));var hardwareService=require(_0xfe8a('0x16'));var logger=require(_0xfe8a('0x17'))('api');var utils=require(_0xfe8a('0x18'));var config=require(_0xfe8a('0x19'));var licenseUtil=require(_0xfe8a('0x1a'));var db=require(_0xfe8a('0x1b'))['db'];function respondWithStatusCode(_0x21e367,_0x566636){_0x566636=_0x566636||0xcc;return function(_0x3237c1){if(_0x3237c1){return _0x21e367[_0xfe8a('0x1c')](_0x566636);}return _0x21e367[_0xfe8a('0x1d')](_0x566636)[_0xfe8a('0x1e')]();};}function respondWithResult(_0x1e5f8f,_0x131798){_0x131798=_0x131798||0xc8;return function(_0x238cf2){if(_0x238cf2){return _0x1e5f8f['status'](_0x131798)[_0xfe8a('0x1f')](_0x238cf2);}};}function respondWithFilteredResult(_0x293172,_0x76f8aa){return function(_0x179b7f){if(_0x179b7f){var _0x3ee311=typeof _0x76f8aa['offset']==='undefined'&&typeof _0x76f8aa[_0xfe8a('0x20')]==='undefined';var _0x384baa=_0x179b7f[_0xfe8a('0x21')];var _0xb924e4=_0x3ee311?0x0:_0x76f8aa[_0xfe8a('0x22')];var _0x45ff58=_0x3ee311?_0x179b7f[_0xfe8a('0x21')]:_0x76f8aa[_0xfe8a('0x22')]+_0x76f8aa['limit'];var _0x32782c;if(_0x45ff58>=_0x384baa){_0x45ff58=_0x384baa;_0x32782c=0xc8;}else{_0x32782c=0xce;}_0x293172[_0xfe8a('0x1d')](_0x32782c);return _0x293172[_0xfe8a('0x23')](_0xfe8a('0x24'),_0xb924e4+'-'+_0x45ff58+'/'+_0x384baa)['json'](_0x179b7f);}return null;};}function patchUpdates(_0x3459dc){return function(_0x13d830){try{jsonpatch[_0xfe8a('0x25')](_0x13d830,_0x3459dc,!![]);}catch(_0x1786c3){return BPromise[_0xfe8a('0x26')](_0x1786c3);}return _0x13d830[_0xfe8a('0x27')]();};}function saveUpdates(_0x1806e8,_0xc832b3){return function(_0x103833){if(_0x103833){return _0x103833[_0xfe8a('0x28')](_0x1806e8)[_0xfe8a('0x29')](function(_0x17e164){return _0x17e164;});}return null;};}function removeEntity(_0x117010,_0x31702a){return function(_0x524be3){if(_0x524be3){return _0x524be3['destroy']()[_0xfe8a('0x29')](function(){_0x117010['status'](0xcc)[_0xfe8a('0x1e')]();});}};}function handleEntityNotFound(_0x14a8ee,_0x2ffeaa){return function(_0x443aed){if(!_0x443aed){_0x14a8ee[_0xfe8a('0x1c')](0x194);}return _0x443aed;};}function handleError(_0x18842f,_0x22d90d){_0x22d90d=_0x22d90d||0x1f4;return function(_0x47a214){logger[_0xfe8a('0x2a')](_0x47a214[_0xfe8a('0x2b')]);if(_0x47a214[_0xfe8a('0x2c')]){delete _0x47a214['name'];}_0x18842f[_0xfe8a('0x1d')](_0x22d90d)['send'](_0x47a214);};}exports[_0xfe8a('0x2d')]=function(_0x391102,_0x2f671b){var _0x4e7e42={},_0x3e15da={},_0x5221cb={'count':0x0,'rows':[]};var _0x418985=_[_0xfe8a('0x2e')](db[_0xfe8a('0x2f')][_0xfe8a('0x30')],function(_0xae2ba8){return{'name':_0xae2ba8[_0xfe8a('0x31')],'type':_0xae2ba8[_0xfe8a('0x32')][_0xfe8a('0x33')]};});_0x3e15da['model']=_[_0xfe8a('0x2e')](_0x418985,_0xfe8a('0x2c'));_0x3e15da[_0xfe8a('0x34')]=_[_0xfe8a('0x35')](_0x391102['query']);_0x3e15da[_0xfe8a('0x36')]=_[_0xfe8a('0x37')](_0x3e15da[_0xfe8a('0x38')],_0x3e15da[_0xfe8a('0x34')]);_0x4e7e42[_0xfe8a('0x39')]=_[_0xfe8a('0x37')](_0x3e15da[_0xfe8a('0x38')],qs[_0xfe8a('0x3a')](_0x391102[_0xfe8a('0x34')][_0xfe8a('0x3a')]));_0x4e7e42[_0xfe8a('0x39')]=_0x4e7e42['attributes'][_0xfe8a('0x3b')]?_0x4e7e42[_0xfe8a('0x39')]:_0x3e15da[_0xfe8a('0x38')];if(!_0x391102[_0xfe8a('0x34')]['hasOwnProperty']('nolimit')){_0x4e7e42[_0xfe8a('0x20')]=qs[_0xfe8a('0x20')](_0x391102[_0xfe8a('0x34')][_0xfe8a('0x20')]);_0x4e7e42[_0xfe8a('0x22')]=qs[_0xfe8a('0x22')](_0x391102[_0xfe8a('0x34')][_0xfe8a('0x22')]);}_0x4e7e42['order']=qs[_0xfe8a('0x3c')](_0x391102['query']['sort']);_0x4e7e42['where']=qs[_0xfe8a('0x36')](_['pick'](_0x391102[_0xfe8a('0x34')],_0x3e15da[_0xfe8a('0x36')]),_0x418985);if(_0x391102[_0xfe8a('0x34')]['filter']){_0x4e7e42[_0xfe8a('0x3d')]=_[_0xfe8a('0x3e')](_0x4e7e42[_0xfe8a('0x3d')],{'$or':_[_0xfe8a('0x2e')](_0x418985,function(_0x136760){if(_0x136760[_0xfe8a('0x32')]!==_0xfe8a('0x3f')){var _0x1c969b={};_0x1c969b[_0x136760[_0xfe8a('0x2c')]]={'$like':'%'+_0x391102['query']['filter']+'%'};return _0x1c969b;}})});}_0x4e7e42=_[_0xfe8a('0x3e')]({},_0x4e7e42,_0x391102[_0xfe8a('0x40')]);var _0x124377={'where':_0x4e7e42[_0xfe8a('0x3d')]};return db[_0xfe8a('0x2f')][_0xfe8a('0x21')](_0x124377)['then'](function(_0x23b09d){_0x5221cb[_0xfe8a('0x21')]=_0x23b09d;if(_0x391102[_0xfe8a('0x34')][_0xfe8a('0x41')]){_0x4e7e42['include']=[{'all':!![]}];}return db[_0xfe8a('0x2f')][_0xfe8a('0x42')](_0x4e7e42);})[_0xfe8a('0x29')](function(_0x345d2f){_0x5221cb[_0xfe8a('0x43')]=_0x345d2f;return _0x5221cb;})[_0xfe8a('0x29')](respondWithFilteredResult(_0x2f671b,_0x4e7e42))['catch'](handleError(_0x2f671b,null));};exports[_0xfe8a('0x44')]=function(_0x58005c,_0x3e4384){var _0x244863={'raw':!![],'where':{'id':_0x58005c[_0xfe8a('0x45')]['id']}},_0x16fd9f={};_0x16fd9f['model']=_['keys'](db[_0xfe8a('0x2f')][_0xfe8a('0x30')]);_0x16fd9f[_0xfe8a('0x34')]=_[_0xfe8a('0x35')](_0x58005c[_0xfe8a('0x34')]);_0x16fd9f[_0xfe8a('0x36')]=_['intersection'](_0x16fd9f[_0xfe8a('0x38')],_0x16fd9f[_0xfe8a('0x34')]);_0x244863[_0xfe8a('0x39')]=_['intersection'](_0x16fd9f[_0xfe8a('0x38')],qs[_0xfe8a('0x3a')](_0x58005c[_0xfe8a('0x34')][_0xfe8a('0x3a')]));_0x244863[_0xfe8a('0x39')]=_0x244863[_0xfe8a('0x39')][_0xfe8a('0x3b')]?_0x244863[_0xfe8a('0x39')]:_0x16fd9f[_0xfe8a('0x38')];if(_0x58005c[_0xfe8a('0x34')][_0xfe8a('0x41')]){_0x244863[_0xfe8a('0x46')]=[{'all':!![]}];}_0x244863=_[_0xfe8a('0x3e')]({},_0x244863,_0x58005c[_0xfe8a('0x40')]);return db[_0xfe8a('0x2f')][_0xfe8a('0x47')](_0x244863)[_0xfe8a('0x29')](handleEntityNotFound(_0x3e4384,null))[_0xfe8a('0x29')](respondWithResult(_0x3e4384,null))[_0xfe8a('0x48')](handleError(_0x3e4384,null));};exports['create']=function(_0x2794c4,_0x59c0ab){return db[_0xfe8a('0x2f')][_0xfe8a('0x49')](_0x2794c4[_0xfe8a('0x4a')],{})[_0xfe8a('0x29')](respondWithResult(_0x59c0ab,0xc9))[_0xfe8a('0x48')](handleError(_0x59c0ab,null));};exports[_0xfe8a('0x28')]=function(_0x33197e,_0x3ccf8e){if(_0x33197e[_0xfe8a('0x4a')]['id']){delete _0x33197e[_0xfe8a('0x4a')]['id'];}return db[_0xfe8a('0x2f')]['find']({'where':{'id':_0x33197e[_0xfe8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3ccf8e,null))[_0xfe8a('0x29')](saveUpdates(_0x33197e[_0xfe8a('0x4a')],null))[_0xfe8a('0x29')](respondWithResult(_0x3ccf8e,null))[_0xfe8a('0x48')](handleError(_0x3ccf8e,null));};exports[_0xfe8a('0x4b')]=function(_0x5f01a4,_0x20ef85){return db['SmsApplication'][_0xfe8a('0x47')]({'where':{'id':_0x5f01a4[_0xfe8a('0x45')]['id']}})[_0xfe8a('0x29')](handleEntityNotFound(_0x20ef85,null))[_0xfe8a('0x29')](removeEntity(_0x20ef85,null))[_0xfe8a('0x48')](handleError(_0x20ef85,null));}; \ No newline at end of file +var _0xdb2c=['desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','map','SmsApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4fdd64,_0x4ec5d4){var _0x1e9ae1=function(_0x60bf04){while(--_0x60bf04){_0x4fdd64['push'](_0x4fdd64['shift']());}};_0x1e9ae1(++_0x4ec5d4);}(_0xdb2c,0x1a9));var _0xcdb2=function(_0x34e731,_0x2ecf48){_0x34e731=_0x34e731-0x0;var _0x115ff0=_0xdb2c[_0x34e731];return _0x115ff0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdb2('0x0'));var zipdir=require(_0xcdb2('0x1'));var jsonpatch=require(_0xcdb2('0x2'));var rp=require(_0xcdb2('0x3'));var moment=require('moment');var BPromise=require(_0xcdb2('0x4'));var Mustache=require(_0xcdb2('0x5'));var util=require(_0xcdb2('0x6'));var path=require(_0xcdb2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcdb2('0x8'));var fs=require('fs');var fs_extra=require(_0xcdb2('0x9'));var _=require(_0xcdb2('0xa'));var squel=require(_0xcdb2('0xb'));var crypto=require(_0xcdb2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcdb2('0xd'));var toCsv=require(_0xcdb2('0xe'));var querystring=require('querystring');var Papa=require(_0xcdb2('0xf'));var Redis=require('ioredis');var authService=require(_0xcdb2('0x10'));var qs=require(_0xcdb2('0x11'));var as=require(_0xcdb2('0x12'));var hardwareService=require(_0xcdb2('0x13'));var logger=require('../../config/logger')(_0xcdb2('0x14'));var utils=require(_0xcdb2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcdb2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ec031,_0xf192be){_0xf192be=_0xf192be||0xcc;return function(_0x91a5f5){if(_0x91a5f5){return _0x3ec031['sendStatus'](_0xf192be);}return _0x3ec031[_0xcdb2('0x17')](_0xf192be)[_0xcdb2('0x18')]();};}function respondWithResult(_0x1d6a34,_0x78ffb3){_0x78ffb3=_0x78ffb3||0xc8;return function(_0x3c5660){if(_0x3c5660){return _0x1d6a34[_0xcdb2('0x17')](_0x78ffb3)[_0xcdb2('0x19')](_0x3c5660);}};}function respondWithFilteredResult(_0x16b883,_0x9a479b){return function(_0x122903){if(_0x122903){var _0x773a0b=typeof _0x9a479b[_0xcdb2('0x1a')]===_0xcdb2('0x1b')&&typeof _0x9a479b[_0xcdb2('0x1c')]===_0xcdb2('0x1b');var _0x8c3db7=_0x122903[_0xcdb2('0x1d')];var _0x4173f3=_0x773a0b?0x0:_0x9a479b['offset'];var _0xc00fd2=_0x773a0b?_0x122903[_0xcdb2('0x1d')]:_0x9a479b[_0xcdb2('0x1a')]+_0x9a479b[_0xcdb2('0x1c')];var _0x2825f8;if(_0xc00fd2>=_0x8c3db7){_0xc00fd2=_0x8c3db7;_0x2825f8=0xc8;}else{_0x2825f8=0xce;}_0x16b883[_0xcdb2('0x17')](_0x2825f8);return _0x16b883[_0xcdb2('0x1e')](_0xcdb2('0x1f'),_0x4173f3+'-'+_0xc00fd2+'/'+_0x8c3db7)['json'](_0x122903);}return null;};}function patchUpdates(_0x57176d){return function(_0x557ef3){try{jsonpatch['apply'](_0x557ef3,_0x57176d,!![]);}catch(_0x23ab3c){return BPromise[_0xcdb2('0x20')](_0x23ab3c);}return _0x557ef3[_0xcdb2('0x21')]();};}function saveUpdates(_0x2af901,_0x53f78a){return function(_0x58521c){if(_0x58521c){return _0x58521c[_0xcdb2('0x22')](_0x2af901)['then'](function(_0x112d26){return _0x112d26;});}return null;};}function removeEntity(_0x47f279,_0x4f2244){return function(_0x5455f0){if(_0x5455f0){return _0x5455f0[_0xcdb2('0x23')]()[_0xcdb2('0x24')](function(){_0x47f279[_0xcdb2('0x17')](0xcc)[_0xcdb2('0x18')]();});}};}function handleEntityNotFound(_0x3d9001,_0x55f1d4){return function(_0x33c759){if(!_0x33c759){_0x3d9001[_0xcdb2('0x25')](0x194);}return _0x33c759;};}function handleError(_0x4c69e9,_0x48506a){_0x48506a=_0x48506a||0x1f4;return function(_0x30f31b){logger[_0xcdb2('0x26')](_0x30f31b[_0xcdb2('0x27')]);if(_0x30f31b[_0xcdb2('0x28')]){delete _0x30f31b[_0xcdb2('0x28')];}_0x4c69e9['status'](_0x48506a)['send'](_0x30f31b);};}exports['index']=function(_0x4f68fa,_0x228cfe){var _0x537d5f={},_0x18deb4={},_0x558bef={'count':0x0,'rows':[]};var _0x2c0b2e=_[_0xcdb2('0x29')](db[_0xcdb2('0x2a')][_0xcdb2('0x2b')],function(_0x55b49c){return{'name':_0x55b49c[_0xcdb2('0x2c')],'type':_0x55b49c[_0xcdb2('0x2d')][_0xcdb2('0x2e')]};});_0x18deb4['model']=_[_0xcdb2('0x29')](_0x2c0b2e,'name');_0x18deb4[_0xcdb2('0x2f')]=_[_0xcdb2('0x30')](_0x4f68fa[_0xcdb2('0x2f')]);_0x18deb4[_0xcdb2('0x31')]=_[_0xcdb2('0x32')](_0x18deb4[_0xcdb2('0x33')],_0x18deb4[_0xcdb2('0x2f')]);_0x537d5f[_0xcdb2('0x34')]=_[_0xcdb2('0x32')](_0x18deb4[_0xcdb2('0x33')],qs[_0xcdb2('0x35')](_0x4f68fa[_0xcdb2('0x2f')]['fields']));_0x537d5f[_0xcdb2('0x34')]=_0x537d5f[_0xcdb2('0x34')][_0xcdb2('0x36')]?_0x537d5f[_0xcdb2('0x34')]:_0x18deb4[_0xcdb2('0x33')];if(!_0x4f68fa['query'][_0xcdb2('0x37')](_0xcdb2('0x38'))){_0x537d5f[_0xcdb2('0x1c')]=qs['limit'](_0x4f68fa['query'][_0xcdb2('0x1c')]);_0x537d5f['offset']=qs['offset'](_0x4f68fa[_0xcdb2('0x2f')][_0xcdb2('0x1a')]);}_0x537d5f['order']=qs[_0xcdb2('0x39')](_0x4f68fa[_0xcdb2('0x2f')]['sort']);_0x537d5f[_0xcdb2('0x3a')]=qs[_0xcdb2('0x31')](_[_0xcdb2('0x3b')](_0x4f68fa[_0xcdb2('0x2f')],_0x18deb4[_0xcdb2('0x31')]),_0x2c0b2e);if(_0x4f68fa['query']['filter']){_0x537d5f[_0xcdb2('0x3a')]=_['merge'](_0x537d5f[_0xcdb2('0x3a')],{'$or':_[_0xcdb2('0x29')](_0x2c0b2e,function(_0x1c37f4){if(_0x1c37f4['type']!==_0xcdb2('0x3c')){var _0x5a1174={};_0x5a1174[_0x1c37f4[_0xcdb2('0x28')]]={'$like':'%'+_0x4f68fa['query'][_0xcdb2('0x3d')]+'%'};return _0x5a1174;}})});}_0x537d5f=_[_0xcdb2('0x3e')]({},_0x537d5f,_0x4f68fa[_0xcdb2('0x3f')]);var _0x5667e4={'where':_0x537d5f[_0xcdb2('0x3a')]};return db['SmsApplication'][_0xcdb2('0x1d')](_0x5667e4)[_0xcdb2('0x24')](function(_0x3fa2e1){_0x558bef[_0xcdb2('0x1d')]=_0x3fa2e1;if(_0x4f68fa['query'][_0xcdb2('0x40')]){_0x537d5f[_0xcdb2('0x41')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x537d5f);})[_0xcdb2('0x24')](function(_0x1aa871){_0x558bef[_0xcdb2('0x42')]=_0x1aa871;return _0x558bef;})[_0xcdb2('0x24')](respondWithFilteredResult(_0x228cfe,_0x537d5f))[_0xcdb2('0x43')](handleError(_0x228cfe,null));};exports[_0xcdb2('0x44')]=function(_0x5cef9d,_0x19f18d){var _0x13eda9={'raw':!![],'where':{'id':_0x5cef9d[_0xcdb2('0x45')]['id']}},_0x34ce15={};_0x34ce15['model']=_[_0xcdb2('0x30')](db[_0xcdb2('0x2a')][_0xcdb2('0x2b')]);_0x34ce15[_0xcdb2('0x2f')]=_[_0xcdb2('0x30')](_0x5cef9d['query']);_0x34ce15[_0xcdb2('0x31')]=_[_0xcdb2('0x32')](_0x34ce15['model'],_0x34ce15[_0xcdb2('0x2f')]);_0x13eda9['attributes']=_['intersection'](_0x34ce15[_0xcdb2('0x33')],qs[_0xcdb2('0x35')](_0x5cef9d[_0xcdb2('0x2f')]['fields']));_0x13eda9[_0xcdb2('0x34')]=_0x13eda9[_0xcdb2('0x34')][_0xcdb2('0x36')]?_0x13eda9[_0xcdb2('0x34')]:_0x34ce15['model'];if(_0x5cef9d[_0xcdb2('0x2f')][_0xcdb2('0x40')]){_0x13eda9[_0xcdb2('0x41')]=[{'all':!![]}];}_0x13eda9=_[_0xcdb2('0x3e')]({},_0x13eda9,_0x5cef9d['options']);return db['SmsApplication'][_0xcdb2('0x46')](_0x13eda9)[_0xcdb2('0x24')](handleEntityNotFound(_0x19f18d,null))[_0xcdb2('0x24')](respondWithResult(_0x19f18d,null))[_0xcdb2('0x43')](handleError(_0x19f18d,null));};exports['create']=function(_0x54e674,_0x19b605){return db[_0xcdb2('0x2a')][_0xcdb2('0x47')](_0x54e674[_0xcdb2('0x48')],{})[_0xcdb2('0x24')](respondWithResult(_0x19b605,0xc9))[_0xcdb2('0x43')](handleError(_0x19b605,null));};exports[_0xcdb2('0x22')]=function(_0x1e11ac,_0x4d348b){if(_0x1e11ac[_0xcdb2('0x48')]['id']){delete _0x1e11ac[_0xcdb2('0x48')]['id'];}return db[_0xcdb2('0x2a')][_0xcdb2('0x46')]({'where':{'id':_0x1e11ac['params']['id']}})['then'](handleEntityNotFound(_0x4d348b,null))[_0xcdb2('0x24')](saveUpdates(_0x1e11ac[_0xcdb2('0x48')],null))['then'](respondWithResult(_0x4d348b,null))[_0xcdb2('0x43')](handleError(_0x4d348b,null));};exports[_0xcdb2('0x23')]=function(_0x5bb1cb,_0x2d72f8){return db['SmsApplication'][_0xcdb2('0x46')]({'where':{'id':_0x5bb1cb[_0xcdb2('0x45')]['id']}})[_0xcdb2('0x24')](handleEntityNotFound(_0x2d72f8,null))[_0xcdb2('0x24')](removeEntity(_0x2d72f8,null))[_0xcdb2('0x43')](handleError(_0x2d72f8,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index edbfc0f..9a8968d 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 _0xa0e8=['./smsApplication.attributes','exports','SmsApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1e2d1c,_0x1ad3e9){var _0x53ad56=function(_0x5a89cd){while(--_0x5a89cd){_0x1e2d1c['push'](_0x1e2d1c['shift']());}};_0x53ad56(++_0x1ad3e9);}(_0xa0e8,0x1e4));var _0x8a0e=function(_0x189740,_0x78b728){_0x189740=_0x189740-0x0;var _0x2bad0c=_0xa0e8[_0x189740];return _0x2bad0c;};'use strict';var _=require(_0x8a0e('0x0'));var util=require(_0x8a0e('0x1'));var logger=require(_0x8a0e('0x2'))(_0x8a0e('0x3'));var moment=require(_0x8a0e('0x4'));var BPromise=require(_0x8a0e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a0e('0x6'));var rimraf=require(_0x8a0e('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a0e('0x8'));module[_0x8a0e('0x9')]=function(_0x416d1c,_0x1e76fc){return _0x416d1c['define'](_0x8a0e('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a0e('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2cff=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','SmsApplication','sms_applications'];(function(_0x450262,_0x51ce04){var _0x14339c=function(_0x5b3367){while(--_0x5b3367){_0x450262['push'](_0x450262['shift']());}};_0x14339c(++_0x51ce04);}(_0x2cff,0xa7));var _0xf2cf=function(_0x74923d,_0x4eff77){_0x74923d=_0x74923d-0x0;var _0x2c9e16=_0x2cff[_0x74923d];return _0x2c9e16;};'use strict';var _=require(_0xf2cf('0x0'));var util=require(_0xf2cf('0x1'));var logger=require(_0xf2cf('0x2'))(_0xf2cf('0x3'));var moment=require(_0xf2cf('0x4'));var BPromise=require(_0xf2cf('0x5'));var rp=require(_0xf2cf('0x6'));var fs=require('fs');var path=require(_0xf2cf('0x7'));var rimraf=require(_0xf2cf('0x8'));var config=require('../../config/environment');var attributes=require('./smsApplication.attributes');module[_0xf2cf('0x9')]=function(_0x13a0c2,_0x2f09f1){return _0x13a0c2[_0xf2cf('0xa')](_0xf2cf('0xb'),attributes,{'tableName':_0xf2cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2cf('0xd'),'collate':_0xf2cf('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5160eb6..4f0d1c8 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 _0x8ed7=['jayson/promise','client','http','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x8ed7,0x8b));var _0x78ed=function(_0x1341a8,_0x31b787){_0x1341a8=_0x1341a8-0x0;var _0x551b2d=_0x8ed7[_0x1341a8];return _0x551b2d;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var moment=require(_0x78ed('0x1'));var BPromise=require(_0x78ed('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ed('0x3'))['db'];var utils=require(_0x78ed('0x4'));var logger=require(_0x78ed('0x5'))(_0x78ed('0x6'));var config=require(_0x78ed('0x7'));var jayson=require(_0x78ed('0x8'));var client=jayson[_0x78ed('0x9')][_0x78ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fc5e7,_0x54c783,_0x232d7b){return new BPromise(function(_0x5197a3,_0x1c0ec8){return client['request'](_0x1fc5e7,_0x232d7b)[_0x78ed('0xb')](function(_0x550763){logger['info'](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));logger['debug'](_0x78ed('0xe'),_0x54c783,_0x78ed('0xd'),JSON['stringify'](_0x550763));if(_0x550763[_0x78ed('0xf')]){if(_0x550763['error'][_0x78ed('0x10')]===0x1f4){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x550763[_0x78ed('0xf')][_0x78ed('0x11')]);return _0x1c0ec8(_0x550763[_0x78ed('0xf')]['message']);}logger[_0x78ed('0xf')]('SmsApplication,\x20%s,\x20%s',_0x54c783,_0x550763['error']['message']);return _0x5197a3(_0x550763['error']['message']);}else{logger[_0x78ed('0x12')](_0x78ed('0xc'),_0x54c783,_0x78ed('0xd'));_0x5197a3(_0x550763[_0x78ed('0x13')][_0x78ed('0x11')]);}})[_0x78ed('0x14')](function(_0x336ae1){logger[_0x78ed('0xf')](_0x78ed('0xc'),_0x54c783,_0x336ae1);_0x1c0ec8(_0x336ae1);});});} \ No newline at end of file +var _0x4e7b=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','SmsApplication,\x20%s,\x20%s'];(function(_0x3e2d65,_0x405694){var _0x47d254=function(_0x104c21){while(--_0x104c21){_0x3e2d65['push'](_0x3e2d65['shift']());}};_0x47d254(++_0x405694);}(_0x4e7b,0xf3));var _0xb4e7=function(_0x251036,_0xd8d59a){_0x251036=_0x251036-0x0;var _0x4a7ce0=_0x4e7b[_0x251036];return _0x4a7ce0;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var moment=require('moment');var BPromise=require(_0xb4e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4e7('0x3'));var db=require(_0xb4e7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4e7('0x5'))(_0xb4e7('0x6'));var config=require('../../config/environment');var jayson=require(_0xb4e7('0x7'));var client=jayson[_0xb4e7('0x8')][_0xb4e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dcf05,_0x315c27,_0x490b1b){return new BPromise(function(_0x366595,_0x3e621e){return client['request'](_0x1dcf05,_0x490b1b)[_0xb4e7('0xa')](function(_0x472973){logger[_0xb4e7('0xb')]('SmsApplication,\x20%s,\x20%s',_0x315c27,_0xb4e7('0xc'));logger[_0xb4e7('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x315c27,'request\x20sent',JSON['stringify'](_0x472973));if(_0x472973['error']){if(_0x472973[_0xb4e7('0xe')][_0xb4e7('0xf')]===0x1f4){logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x3e621e(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}logger[_0xb4e7('0xe')](_0xb4e7('0x10'),_0x315c27,_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);return _0x366595(_0x472973[_0xb4e7('0xe')][_0xb4e7('0x11')]);}else{logger['info'](_0xb4e7('0x10'),_0x315c27,_0xb4e7('0xc'));_0x366595(_0x472973[_0xb4e7('0x12')][_0xb4e7('0x11')]);}})[_0xb4e7('0x13')](function(_0x3078a0){logger['error']('SmsApplication,\x20%s,\x20%s',_0x315c27,_0x3078a0);_0x3e621e(_0x3078a0);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c338d2d..eba399e 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 _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x370761,_0x7f9b3){var _0x35a0b3=function(_0x16b9f3){while(--_0x16b9f3){_0x370761['push'](_0x370761['shift']());}};_0x35a0b3(++_0x7f9b3);}(_0x3266,0x6a));var _0x6326=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3266[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file +var _0x9ffd=['sms','smsinteraction:addtags','put','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x1f2734,_0x529bad){var _0x17b385=function(_0x5eabc1){while(--_0x5eabc1){_0x1f2734['push'](_0x1f2734['shift']());}};_0x17b385(++_0x529bad);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x272c60,_0x51587d){_0x272c60=_0x272c60-0x0;var _0x49dd88=_0x9ffd[_0x272c60];return _0x49dd88;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0x12')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router['post']('/:id/messages',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x14')]);router[_0xd9ff('0x12')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),interaction['tracked'](_0xd9ff('0x16'),_0xd9ff('0x17')),controller['addTags']);router[_0xd9ff('0x18')]('/:id',auth['isAuthenticated'](),interaction['tracked']('sms',_0xd9ff('0x19')),controller['update']);router[_0xd9ff('0x1a')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),interaction[_0xd9ff('0x1b')](_0xd9ff('0x16'),_0xd9ff('0x1c')),controller[_0xd9ff('0x1d')]);router[_0xd9ff('0x1a')](_0xd9ff('0x15'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x1e')]);module[_0xd9ff('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 193011b..3058117 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 _0x8f6b=['exports','DATE','STRING','out','ENUM','BOOLEAN','sequelize','moment'];(function(_0x1089fb,_0x2a412d){var _0x5deb2a=function(_0x4c3b10){while(--_0x4c3b10){_0x1089fb['push'](_0x1089fb['shift']());}};_0x5deb2a(++_0x2a412d);}(_0x8f6b,0x146));var _0xb8f6=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x8f6b[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0xb8f6('0x0'));var moment=require(_0xb8f6('0x1'));module[_0xb8f6('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb8f6('0x3')]},'disposition':{'type':Sequelize[_0xb8f6('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb8f6('0x4')]},'note':{'type':Sequelize[_0xb8f6('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb8f6('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb8f6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb8f6('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb8f6('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4b19=['DATE','STRING','ENUM','sequelize','exports','BOOLEAN'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4b19,0x195));var _0x94b1=function(_0x3d2bab,_0x114f32){_0x3d2bab=_0x3d2bab-0x0;var _0x5d0a66=_0x4b19[_0x3d2bab];return _0x5d0a66;};'use strict';var Sequelize=require(_0x94b1('0x0'));var moment=require('moment');module[_0x94b1('0x1')]={'closed':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x94b1('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x94b1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x94b1('0x4')]},'note':{'type':Sequelize[_0x94b1('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x94b1('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x94b1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x94b1('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x94b1('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6668dc3..3b40583 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 _0xa9c6=['filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','secret','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','format','disposition','direction','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','undefined','limit','count','set','update','then','destroy','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','query','user','catch','show','params','model','keys','filters','attributes','intersection','fields','includeAll','include','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','getMessages','findOne','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','SmsInteractionId'];(function(_0x570957,_0x2b6ede){var _0x20a456=function(_0x1dae0c){while(--_0x1dae0c){_0x570957['push'](_0x570957['shift']());}};_0x20a456(++_0x2b6ede);}(_0xa9c6,0xb4));var _0x6a9c=function(_0xd2b53a,_0x339403){_0xd2b53a=_0xd2b53a-0x0;var _0x3c5094=_0xa9c6[_0xd2b53a];return _0x3c5094;};'use strict';var rimraf=require(_0x6a9c('0x0'));var zipdir=require(_0x6a9c('0x1'));var moment=require('moment');var BPromise=require(_0x6a9c('0x2'));var util=require(_0x6a9c('0x3'));var path=require(_0x6a9c('0x4'));var ejs=require(_0x6a9c('0x5'));var fs=require('fs');var _=require(_0x6a9c('0x6'));var Redis=require(_0x6a9c('0x7'));var interaction=require(_0x6a9c('0x8'));var qs=require(_0x6a9c('0x9'));var pdf=require(_0x6a9c('0xa'));var logger=require(_0x6a9c('0xb'))(_0x6a9c('0xc'));var config=require('../../config/environment');var db=require(_0x6a9c('0xd'))['db'];config[_0x6a9c('0xe')]=_[_0x6a9c('0xf')](config[_0x6a9c('0xe')],{'host':_0x6a9c('0x10'),'port':0x18eb});var socket=require(_0x6a9c('0x11'))(new Redis(config[_0x6a9c('0xe')]));require(_0x6a9c('0x12'))[_0x6a9c('0x13')](socket);function respondWithStatusCode(_0x452687,_0x83de86){_0x83de86=_0x83de86||0xcc;return function(_0x20c8a0){if(_0x20c8a0){return _0x452687[_0x6a9c('0x14')](_0x83de86);}return _0x452687['status'](_0x83de86)[_0x6a9c('0x15')]();};}function respondWithResult(_0x5dbd5,_0x5596aa){_0x5596aa=_0x5596aa||0xc8;return function(_0x29ec63){if(_0x29ec63){return _0x5dbd5[_0x6a9c('0x16')](_0x5596aa)['json'](_0x29ec63);}};}function respondWithFilteredResult(_0x5dcba1,_0x58c67e){return function(_0x39f4f0){if(_0x39f4f0){var _0x2f25a2=typeof _0x58c67e['offset']===_0x6a9c('0x17')&&typeof _0x58c67e[_0x6a9c('0x18')]===_0x6a9c('0x17');var _0x178e12=_0x39f4f0['count'];var _0x57edcd=_0x2f25a2?0x0:_0x58c67e['offset'];var _0xc12094=_0x2f25a2?_0x39f4f0[_0x6a9c('0x19')]:_0x58c67e['offset']+_0x58c67e[_0x6a9c('0x18')];var _0x43cf95;if(_0xc12094>=_0x178e12){_0xc12094=_0x178e12;_0x43cf95=0xc8;}else{_0x43cf95=0xce;}_0x5dcba1['status'](_0x43cf95);return _0x5dcba1[_0x6a9c('0x1a')]('Content-Range',_0x57edcd+'-'+_0xc12094+'/'+_0x178e12)['json'](_0x39f4f0);}return null;};}function saveUpdates(_0x11ff2){return function(_0xb050e3){if(_0xb050e3){return _0xb050e3[_0x6a9c('0x1b')](_0x11ff2)[_0x6a9c('0x1c')](function(_0x5774de){return _0x5774de;});}return null;};}function removeEntity(_0x355ea7){return function(_0x4ea01e){if(_0x4ea01e){return _0x4ea01e[_0x6a9c('0x1d')]()[_0x6a9c('0x1c')](function(){_0x355ea7[_0x6a9c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x286462){return function(_0x2084bd){if(!_0x2084bd){_0x286462[_0x6a9c('0x14')](0x194);}return _0x2084bd;};}function handleError(_0x5183ed,_0x7f3f52){_0x7f3f52=_0x7f3f52||0x1f4;return function(_0x36230f){logger[_0x6a9c('0x1e')](_0x36230f[_0x6a9c('0x1f')]);if(_0x36230f[_0x6a9c('0x20')]){delete _0x36230f[_0x6a9c('0x20')];}_0x5183ed[_0x6a9c('0x16')](_0x7f3f52)[_0x6a9c('0x21')](_0x36230f);};}exports[_0x6a9c('0x22')]=function(_0x2b1137,_0x484326){var _0x212897={};var _0x19ae72=_[_0x6a9c('0x23')](db[_0x6a9c('0x24')][_0x6a9c('0x25')],function(_0x4eb9ac){return{'name':_0x4eb9ac[_0x6a9c('0x26')],'type':_0x4eb9ac[_0x6a9c('0x27')][_0x6a9c('0x28')]};});_0x212897=qs['getOptions'](_0x19ae72,_0x2b1137);return interaction['findAll']('sms',_0x2b1137[_0x6a9c('0x29')],_0x2b1137[_0x6a9c('0x2a')],_0x212897,_0x19ae72)[_0x6a9c('0x1c')](respondWithFilteredResult(_0x484326,_0x212897))[_0x6a9c('0x2b')](handleError(_0x484326,null));};exports[_0x6a9c('0x2c')]=function(_0x5548e4,_0x3982f1){var _0x248e01={'raw':![],'where':{'id':_0x5548e4[_0x6a9c('0x2d')]['id']}},_0x2516cd={};_0x2516cd[_0x6a9c('0x2e')]=_[_0x6a9c('0x2f')](db[_0x6a9c('0x24')][_0x6a9c('0x25')]);_0x2516cd[_0x6a9c('0x29')]=_[_0x6a9c('0x2f')](_0x5548e4[_0x6a9c('0x29')]);_0x2516cd[_0x6a9c('0x30')]=_['intersection'](_0x2516cd[_0x6a9c('0x2e')],_0x2516cd['query']);_0x248e01[_0x6a9c('0x31')]=_[_0x6a9c('0x32')](_0x2516cd[_0x6a9c('0x2e')],qs[_0x6a9c('0x33')](_0x5548e4[_0x6a9c('0x29')][_0x6a9c('0x33')]));_0x248e01[_0x6a9c('0x31')]=_0x248e01['attributes']['length']?_0x248e01[_0x6a9c('0x31')]:_0x2516cd[_0x6a9c('0x2e')];if(_0x5548e4[_0x6a9c('0x29')][_0x6a9c('0x34')]){_0x248e01[_0x6a9c('0x35')]=[{'all':!![]}];}_0x248e01=_[_0x6a9c('0x36')]({},_0x248e01,_0x5548e4[_0x6a9c('0x37')]);return db['SmsInteraction']['find'](_0x248e01)[_0x6a9c('0x1c')](handleEntityNotFound(_0x3982f1,null))[_0x6a9c('0x1c')](respondWithResult(_0x3982f1,null))[_0x6a9c('0x2b')](handleError(_0x3982f1,null));};exports[_0x6a9c('0x38')]=function(_0x513ce1,_0x505cfe){return db[_0x6a9c('0x24')][_0x6a9c('0x38')](_0x513ce1[_0x6a9c('0x39')],{})[_0x6a9c('0x1c')](respondWithResult(_0x505cfe,0xc9))[_0x6a9c('0x2b')](handleError(_0x505cfe,null));};exports[_0x6a9c('0x1b')]=function(_0x456221,_0x5704b1){if(_0x456221[_0x6a9c('0x39')]['id']){delete _0x456221[_0x6a9c('0x39')]['id'];}return db[_0x6a9c('0x24')][_0x6a9c('0x3a')]({'where':{'id':_0x456221[_0x6a9c('0x2d')]['id']}})[_0x6a9c('0x1c')](handleEntityNotFound(_0x5704b1,null))[_0x6a9c('0x1c')](saveUpdates(_0x456221[_0x6a9c('0x39')],null))[_0x6a9c('0x1c')](respondWithResult(_0x5704b1,null))[_0x6a9c('0x2b')](handleError(_0x5704b1,null));};exports[_0x6a9c('0x1d')]=function(_0x309ae5,_0x2d1fcb){return db['SmsInteraction'][_0x6a9c('0x3a')]({'where':{'id':_0x309ae5[_0x6a9c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2d1fcb,null))[_0x6a9c('0x1c')](removeEntity(_0x2d1fcb,null))[_0x6a9c('0x2b')](handleError(_0x2d1fcb,null));};exports[_0x6a9c('0x3b')]=function(_0x3d2c90,_0x13c0ef){return db[_0x6a9c('0x24')]['describe']()['then'](respondWithResult(_0x13c0ef,null))['catch'](handleError(_0x13c0ef,null));};exports[_0x6a9c('0x3c')]=function(_0xdd72c3,_0x47d008){return db[_0x6a9c('0x3d')][_0x6a9c('0x3a')]({'where':{'id':_0xdd72c3[_0x6a9c('0x2d')]['id']}})[_0x6a9c('0x1c')](handleEntityNotFound(_0x47d008,null))[_0x6a9c('0x1c')](function(_0x4f364f){if(_0x4f364f){return _0x4f364f[_0x6a9c('0x3c')](_0xdd72c3['body'][_0x6a9c('0x3e')],_['omit'](_0xdd72c3['body'],[_0x6a9c('0x3e'),'id'])||{});}})[_0x6a9c('0x1c')](respondWithResult(_0x47d008,null))[_0x6a9c('0x2b')](handleError(_0x47d008,null));};exports[_0x6a9c('0x3f')]=function(_0x5b529b,_0x2a39b9){var _0x1f29b4={'raw':![],'where':{}};var _0x5b6c13={};var _0x4ef42d={'count':0x0,'rows':[]};return db[_0x6a9c('0x24')][_0x6a9c('0x40')]({'where':{'id':_0x5b529b[_0x6a9c('0x2d')]['id']}})[_0x6a9c('0x1c')](handleEntityNotFound(_0x2a39b9,null))[_0x6a9c('0x1c')](function(_0x4ff330){if(_0x4ff330){_0x5b6c13[_0x6a9c('0x2e')]=_['keys'](db[_0x6a9c('0x3d')][_0x6a9c('0x25')]);_0x5b6c13[_0x6a9c('0x29')]=_[_0x6a9c('0x2f')](_0x5b529b[_0x6a9c('0x29')]);_0x5b6c13[_0x6a9c('0x30')]=_[_0x6a9c('0x32')](_0x5b6c13[_0x6a9c('0x2e')],_0x5b6c13['query']);_0x1f29b4[_0x6a9c('0x31')]=_[_0x6a9c('0x32')](_0x5b6c13[_0x6a9c('0x2e')],qs[_0x6a9c('0x33')](_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x33')]));_0x1f29b4[_0x6a9c('0x31')]=_0x1f29b4[_0x6a9c('0x31')][_0x6a9c('0x41')]?_0x1f29b4[_0x6a9c('0x31')]:_0x5b6c13['model'];if(!_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x42')](_0x6a9c('0x43'))){_0x1f29b4[_0x6a9c('0x18')]=qs[_0x6a9c('0x18')](_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x18')]);_0x1f29b4[_0x6a9c('0x44')]=qs[_0x6a9c('0x44')](_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x44')]);}_0x1f29b4[_0x6a9c('0x45')]=qs[_0x6a9c('0x46')](_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x46')]);_0x1f29b4[_0x6a9c('0x47')]=qs['filters'](_[_0x6a9c('0x48')](_0x5b529b['query'],_0x5b6c13['filters']));_0x1f29b4[_0x6a9c('0x47')][_0x6a9c('0x49')]=_0x4ff330['id'];if(_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x4a')]){_0x1f29b4['where']=_[_0x6a9c('0x36')](_0x1f29b4[_0x6a9c('0x47')],{'$or':_[_0x6a9c('0x23')](_0x1f29b4['attributes'],function(_0x5d5bad){var _0xc3a086={};_0xc3a086[_0x5d5bad]={'$like':'%'+_0x5b529b['query'][_0x6a9c('0x4a')]+'%'};return _0xc3a086;})});}if(_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x4b')]){var _0x3d132c=_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x4b')][_0x6a9c('0x4c')](',');var _0x107de1={};_0x107de1[_0x3d132c[0x0]]={'$gte':moment(_0x3d132c[0x1])['format'](_0x6a9c('0x4d'))};_0x1f29b4[_0x6a9c('0x47')]=_[_0x6a9c('0x36')](_0x1f29b4[_0x6a9c('0x47')],_0x107de1);}_0x1f29b4=_[_0x6a9c('0x36')]({},_0x1f29b4,_0x5b529b['options']);return db[_0x6a9c('0x3d')]['count']({'where':_0x1f29b4['where']})[_0x6a9c('0x1c')](function(_0x4a7b20){_0x4ef42d[_0x6a9c('0x19')]=_0x4a7b20;if(_0x5b529b[_0x6a9c('0x29')][_0x6a9c('0x34')]){_0x1f29b4[_0x6a9c('0x35')]=[{'all':!![]}];}return db[_0x6a9c('0x3d')]['findAll'](_0x1f29b4);})[_0x6a9c('0x1c')](function(_0x2d78b3){_0x4ef42d[_0x6a9c('0x4e')]=_0x2d78b3;return _0x4ef42d;});}})[_0x6a9c('0x1c')](respondWithFilteredResult(_0x2a39b9,_0x1f29b4))[_0x6a9c('0x2b')](handleError(_0x2a39b9,null));};exports[_0x6a9c('0x4f')]=function(_0x5fad31,_0x4f71e1){return db[_0x6a9c('0x24')][_0x6a9c('0x3a')]({'where':{'id':_0x5fad31['params']['id']}})[_0x6a9c('0x1c')](handleEntityNotFound(_0x4f71e1,null))[_0x6a9c('0x1c')](function(_0x13edb6){if(_0x13edb6){return _0x13edb6[_0x6a9c('0x50')](_0x5fad31['body'][_0x6a9c('0x3e')],_[_0x6a9c('0x51')](_0x5fad31['body'],[_0x6a9c('0x3e'),'id'])||{})[_0x6a9c('0x52')](function(){return db[_0x6a9c('0x53')][_0x6a9c('0x54')]({'attributes':['id',_0x6a9c('0x20'),_0x6a9c('0x55')],'where':{'id':_0x5fad31[_0x6a9c('0x39')][_0x6a9c('0x3e')]}});})[_0x6a9c('0x1c')](function(_0x278b31){socket[_0x6a9c('0x56')](_0x6a9c('0x57'),{'id':Number(_0x5fad31[_0x6a9c('0x2d')]['id']),'tags':_0x278b31||[]});return{'id':Number(_0x5fad31[_0x6a9c('0x2d')]['id']),'tags':_0x278b31||[]};});}})[_0x6a9c('0x1c')](respondWithResult(_0x4f71e1,null))[_0x6a9c('0x2b')](handleError(_0x4f71e1,null));};exports[_0x6a9c('0x58')]=function(_0x478a5c,_0x11dd68){return db[_0x6a9c('0x24')][_0x6a9c('0x3a')]({'where':{'id':_0x478a5c[_0x6a9c('0x2d')]['id']}})[_0x6a9c('0x1c')](handleEntityNotFound(_0x11dd68,null))['then'](function(_0x166b91){if(_0x166b91){return _0x166b91[_0x6a9c('0x58')](_0x478a5c[_0x6a9c('0x29')][_0x6a9c('0x3e')]);}})[_0x6a9c('0x1c')](respondWithStatusCode(_0x11dd68,null))[_0x6a9c('0x2b')](handleError(_0x11dd68,null));};exports[_0x6a9c('0x59')]=function(_0x453669,_0x1fc194){var _0x2f24af=moment()[_0x6a9c('0x5a')]()[_0x6a9c('0x5b')]();var _0x37afca=path[_0x6a9c('0x5c')](config[_0x6a9c('0x5d')],_0x6a9c('0x5e'),_0x6a9c('0x5f'),'tmp');var _0x109d16=path[_0x6a9c('0x5c')](_0x37afca,_0x2f24af);var _0x2aacb7=util['format'](_0x6a9c('0x60'),_0x453669[_0x6a9c('0x2d')]['id'],_0x2f24af);var _0x467cd2=path[_0x6a9c('0x5c')](_0x37afca,_0x2aacb7);var _0x3cc9d7=[];_0x3cc9d7[_0x6a9c('0x61')]({'model':db[_0x6a9c('0x62')],'as':_0x6a9c('0x62'),'attributes':['id',_0x6a9c('0x63')],'raw':!![]});_0x3cc9d7[_0x6a9c('0x61')]({'model':db['CmContact'],'as':_0x6a9c('0x64'),'attributes':['id',_0x6a9c('0x65'),_0x6a9c('0x66')],'raw':!![]});var _0x31a575=[{'model':db[_0x6a9c('0x3d')],'as':_0x6a9c('0x67'),'attributes':['id',_0x6a9c('0x39'),_0x6a9c('0x68'),'direction',_0x6a9c('0x69'),'read'],'include':_0x3cc9d7}];_0x31a575[_0x6a9c('0x61')]({'model':db['SmsAccount'],'as':_0x6a9c('0x6a'),'attributes':['id',_0x6a9c('0x20')]});_0x31a575['push']({'model':db[_0x6a9c('0x62')],'as':_0x6a9c('0x6b'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x6a9c('0x3a')]({'where':{'id':_0x453669['params']['id']},'include':_0x31a575})[_0x6a9c('0x1c')](handleEntityNotFound(_0x1fc194,null))['then'](function(_0x201ea7){if(_0x201ea7){var _0x3dae62=_0x201ea7[_0x6a9c('0x6c')]({'plain':!![]});fs[_0x6a9c('0x6d')](_0x109d16);var _0x3d1f65={'channel':_0x6a9c('0x6e'),'account':_0x3dae62[_0x6a9c('0x6a')][_0x6a9c('0x20')],'agent':_0x3dae62[_0x6a9c('0x6b')]?_0x3dae62['Owner'][_0x6a9c('0x63')]:_0x6a9c('0x6f'),'createdAt':moment(_0x3dae62[_0x6a9c('0x68')])['format'](_0x6a9c('0x4d'))[_0x6a9c('0x5b')](),'closedAt':_0x3dae62['closed']?moment(_0x3dae62[_0x6a9c('0x70')])[_0x6a9c('0x71')](_0x6a9c('0x4d'))[_0x6a9c('0x5b')]():'','disposition':_0x3dae62[_0x6a9c('0x72')],'messages':_(_0x3dae62[_0x6a9c('0x67')])[_0x6a9c('0x4a')]({'secret':![]})[_0x6a9c('0x23')](function(_0x41c72b){return{'date':moment(_0x41c72b[_0x6a9c('0x68')])[_0x6a9c('0x71')](_0x6a9c('0x4d'))[_0x6a9c('0x5b')](),'sender':_0x41c72b[_0x6a9c('0x73')]==='out'?_0x41c72b[_0x6a9c('0x62')]?_0x41c72b['User']['fullname']:_0x6a9c('0x74'):_0x41c72b['Contact'][_0x6a9c('0x65')]+(_0x41c72b[_0x6a9c('0x64')]['lastName']?'\x20'+_0x41c72b[_0x6a9c('0x64')][_0x6a9c('0x66')]:''),'body':_0x41c72b[_0x6a9c('0x39')],'direction':_0x41c72b[_0x6a9c('0x73')]==='out'?'A':'C','secret':_0x41c72b[_0x6a9c('0x69')],'read':_0x41c72b[_0x6a9c('0x75')]};})[_0x6a9c('0x76')]()};return ejs[_0x6a9c('0x77')](path[_0x6a9c('0x5c')](config[_0x6a9c('0x5d')],'server',_0x6a9c('0x78'),_0x6a9c('0x79')),{'interaction':_0x3d1f65})['then'](function(_0x1c0c8e){var _0x1b9910=path[_0x6a9c('0x5c')](_0x109d16,_0x6a9c('0x7a')+_0x3dae62['id']+'-'+_0x2f24af+_0x6a9c('0x7b'));var _0x3f6864={'path':_0x1b9910,'channel':_0x6a9c('0x6e'),'interactionId':_0x3dae62['id']};return pdf[_0x6a9c('0x7c')](_0x1c0c8e,_0x3f6864);})[_0x6a9c('0x1c')](function(){return new BPromise(function(_0xdde913,_0x201655){zipdir(_0x109d16,{'saveTo':_0x467cd2},function(_0x5d49d6,_0x2bf69d){if(_0x5d49d6)return _0x201655(_0x5d49d6);return _0xdde913(_0x2bf69d);});})[_0x6a9c('0x1c')](function(){return new BPromise(function(_0x3bb8ae,_0x138175){rimraf(_0x109d16,function(_0x3c2521){if(_0x3c2521)_0x138175(_0x3c2521);return _0x3bb8ae();});});})['then'](function(){return _0x1fc194[_0x6a9c('0x59')](_0x467cd2,_0x2aacb7,function(_0x3f91b1){if(_0x3f91b1){console[_0x6a9c('0x7d')](_0x6a9c('0x7e'),_0x3f91b1);}else{fs['unlinkSync'](_0x467cd2);}});});});}else{return _0x1fc194[_0x6a9c('0x14')](0xc8);}})[_0x6a9c('0x2b')](handleError(_0x1fc194,null));}; \ No newline at end of file +var _0xe047=['split','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','format','transcript-%d-%s.zip','push','User','Contact','createdAt','direction','secret','read','Account','Owner','get','Sms','fullname','N.A.','toString','closed','disposition','Messages','out','System','firstName','lastName','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','type','key','getOptions','sms','query','user','then','catch','show','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','update','describe','addMessage','SmsMessage','ids','omit','findOne','nolimit','order','sort','where','pick','filter','map','$gte'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0xe047,0x119));var _0x7e04=function(_0x2cd793,_0x2f6819){_0x2cd793=_0x2cd793-0x0;var _0x5554ab=_0xe047[_0x2cd793];return _0x5554ab;};'use strict';var rimraf=require(_0x7e04('0x0'));var zipdir=require(_0x7e04('0x1'));var moment=require('moment');var BPromise=require(_0x7e04('0x2'));var util=require(_0x7e04('0x3'));var path=require(_0x7e04('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e04('0x5'));var Redis=require(_0x7e04('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x7e04('0x7'));var pdf=require(_0x7e04('0x8'));var logger=require(_0x7e04('0x9'))(_0x7e04('0xa'));var config=require(_0x7e04('0xb'));var db=require(_0x7e04('0xc'))['db'];config[_0x7e04('0xd')]=_[_0x7e04('0xe')](config[_0x7e04('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7e04('0xf'))(new Redis(config[_0x7e04('0xd')]));require(_0x7e04('0x10'))[_0x7e04('0x11')](socket);function respondWithStatusCode(_0xd7edf8,_0xc8bfda){_0xc8bfda=_0xc8bfda||0xcc;return function(_0xe13f91){if(_0xe13f91){return _0xd7edf8[_0x7e04('0x12')](_0xc8bfda);}return _0xd7edf8['status'](_0xc8bfda)['end']();};}function respondWithResult(_0x19d9f1,_0xf60f66){_0xf60f66=_0xf60f66||0xc8;return function(_0x21f5bd){if(_0x21f5bd){return _0x19d9f1[_0x7e04('0x13')](_0xf60f66)[_0x7e04('0x14')](_0x21f5bd);}};}function respondWithFilteredResult(_0x1d870f,_0x45afea){return function(_0x14f80b){if(_0x14f80b){var _0x6ff8d7=typeof _0x45afea[_0x7e04('0x15')]===_0x7e04('0x16')&&typeof _0x45afea['limit']==='undefined';var _0x119cd3=_0x14f80b[_0x7e04('0x17')];var _0x409270=_0x6ff8d7?0x0:_0x45afea[_0x7e04('0x15')];var _0x59fd20=_0x6ff8d7?_0x14f80b['count']:_0x45afea['offset']+_0x45afea[_0x7e04('0x18')];var _0x58dd14;if(_0x59fd20>=_0x119cd3){_0x59fd20=_0x119cd3;_0x58dd14=0xc8;}else{_0x58dd14=0xce;}_0x1d870f['status'](_0x58dd14);return _0x1d870f[_0x7e04('0x19')](_0x7e04('0x1a'),_0x409270+'-'+_0x59fd20+'/'+_0x119cd3)[_0x7e04('0x14')](_0x14f80b);}return null;};}function saveUpdates(_0x9a8c82){return function(_0x3bc3cc){if(_0x3bc3cc){return _0x3bc3cc['update'](_0x9a8c82)['then'](function(_0x272297){return _0x272297;});}return null;};}function removeEntity(_0x347af8){return function(_0x1fc842){if(_0x1fc842){return _0x1fc842[_0x7e04('0x1b')]()['then'](function(){_0x347af8[_0x7e04('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5118df){return function(_0x285065){if(!_0x285065){_0x5118df[_0x7e04('0x12')](0x194);}return _0x285065;};}function handleError(_0x1ac628,_0x23e36d){_0x23e36d=_0x23e36d||0x1f4;return function(_0x6b676b){logger[_0x7e04('0x1c')](_0x6b676b[_0x7e04('0x1d')]);if(_0x6b676b[_0x7e04('0x1e')]){delete _0x6b676b[_0x7e04('0x1e')];}_0x1ac628[_0x7e04('0x13')](_0x23e36d)[_0x7e04('0x1f')](_0x6b676b);};}exports[_0x7e04('0x20')]=function(_0x57a3d8,_0x3a9d2f){var _0x32ddf3={};var _0x1a24bb=_['map'](db[_0x7e04('0x21')][_0x7e04('0x22')],function(_0x15d82f){return{'name':_0x15d82f['fieldName'],'type':_0x15d82f[_0x7e04('0x23')][_0x7e04('0x24')]};});_0x32ddf3=qs[_0x7e04('0x25')](_0x1a24bb,_0x57a3d8);return interaction['findAll'](_0x7e04('0x26'),_0x57a3d8[_0x7e04('0x27')],_0x57a3d8[_0x7e04('0x28')],_0x32ddf3,_0x1a24bb)[_0x7e04('0x29')](respondWithFilteredResult(_0x3a9d2f,_0x32ddf3))[_0x7e04('0x2a')](handleError(_0x3a9d2f,null));};exports[_0x7e04('0x2b')]=function(_0x57a28b,_0xdff2c9){var _0xcba1a6={'raw':![],'where':{'id':_0x57a28b[_0x7e04('0x2c')]['id']}},_0x576bd2={};_0x576bd2[_0x7e04('0x2d')]=_[_0x7e04('0x2e')](db[_0x7e04('0x21')][_0x7e04('0x22')]);_0x576bd2[_0x7e04('0x27')]=_[_0x7e04('0x2e')](_0x57a28b[_0x7e04('0x27')]);_0x576bd2[_0x7e04('0x2f')]=_[_0x7e04('0x30')](_0x576bd2[_0x7e04('0x2d')],_0x576bd2['query']);_0xcba1a6[_0x7e04('0x31')]=_[_0x7e04('0x30')](_0x576bd2[_0x7e04('0x2d')],qs[_0x7e04('0x32')](_0x57a28b[_0x7e04('0x27')][_0x7e04('0x32')]));_0xcba1a6['attributes']=_0xcba1a6[_0x7e04('0x31')][_0x7e04('0x33')]?_0xcba1a6[_0x7e04('0x31')]:_0x576bd2[_0x7e04('0x2d')];if(_0x57a28b[_0x7e04('0x27')]['includeAll']){_0xcba1a6[_0x7e04('0x34')]=[{'all':!![]}];}_0xcba1a6=_[_0x7e04('0x35')]({},_0xcba1a6,_0x57a28b[_0x7e04('0x36')]);return db[_0x7e04('0x21')][_0x7e04('0x37')](_0xcba1a6)['then'](handleEntityNotFound(_0xdff2c9,null))[_0x7e04('0x29')](respondWithResult(_0xdff2c9,null))[_0x7e04('0x2a')](handleError(_0xdff2c9,null));};exports[_0x7e04('0x38')]=function(_0x1b49fd,_0x240639){return db[_0x7e04('0x21')]['create'](_0x1b49fd[_0x7e04('0x39')],{})[_0x7e04('0x29')](respondWithResult(_0x240639,0xc9))[_0x7e04('0x2a')](handleError(_0x240639,null));};exports[_0x7e04('0x3a')]=function(_0x210ff6,_0x3b7e46){if(_0x210ff6['body']['id']){delete _0x210ff6[_0x7e04('0x39')]['id'];}return db['SmsInteraction'][_0x7e04('0x37')]({'where':{'id':_0x210ff6[_0x7e04('0x2c')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x3b7e46,null))[_0x7e04('0x29')](saveUpdates(_0x210ff6[_0x7e04('0x39')],null))[_0x7e04('0x29')](respondWithResult(_0x3b7e46,null))[_0x7e04('0x2a')](handleError(_0x3b7e46,null));};exports[_0x7e04('0x1b')]=function(_0x31c0cb,_0x514470){return db['SmsInteraction'][_0x7e04('0x37')]({'where':{'id':_0x31c0cb[_0x7e04('0x2c')]['id']}})['then'](handleEntityNotFound(_0x514470,null))[_0x7e04('0x29')](removeEntity(_0x514470,null))[_0x7e04('0x2a')](handleError(_0x514470,null));};exports[_0x7e04('0x3b')]=function(_0x4032a2,_0x2f38f9){return db[_0x7e04('0x21')][_0x7e04('0x3b')]()[_0x7e04('0x29')](respondWithResult(_0x2f38f9,null))[_0x7e04('0x2a')](handleError(_0x2f38f9,null));};exports[_0x7e04('0x3c')]=function(_0x47c35b,_0x1051c4){return db[_0x7e04('0x3d')]['find']({'where':{'id':_0x47c35b['params']['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x1051c4,null))[_0x7e04('0x29')](function(_0x2b9f6f){if(_0x2b9f6f){return _0x2b9f6f['addMessage'](_0x47c35b[_0x7e04('0x39')][_0x7e04('0x3e')],_[_0x7e04('0x3f')](_0x47c35b[_0x7e04('0x39')],[_0x7e04('0x3e'),'id'])||{});}})[_0x7e04('0x29')](respondWithResult(_0x1051c4,null))[_0x7e04('0x2a')](handleError(_0x1051c4,null));};exports['getMessages']=function(_0x259f75,_0x1b4b51){var _0x23da01={'raw':![],'where':{}};var _0x2c3daa={};var _0x7d8295={'count':0x0,'rows':[]};return db[_0x7e04('0x21')][_0x7e04('0x40')]({'where':{'id':_0x259f75['params']['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x1b4b51,null))[_0x7e04('0x29')](function(_0x2b1069){if(_0x2b1069){_0x2c3daa[_0x7e04('0x2d')]=_[_0x7e04('0x2e')](db[_0x7e04('0x3d')][_0x7e04('0x22')]);_0x2c3daa[_0x7e04('0x27')]=_[_0x7e04('0x2e')](_0x259f75[_0x7e04('0x27')]);_0x2c3daa[_0x7e04('0x2f')]=_[_0x7e04('0x30')](_0x2c3daa['model'],_0x2c3daa[_0x7e04('0x27')]);_0x23da01[_0x7e04('0x31')]=_[_0x7e04('0x30')](_0x2c3daa[_0x7e04('0x2d')],qs[_0x7e04('0x32')](_0x259f75['query'][_0x7e04('0x32')]));_0x23da01['attributes']=_0x23da01[_0x7e04('0x31')]['length']?_0x23da01[_0x7e04('0x31')]:_0x2c3daa['model'];if(!_0x259f75[_0x7e04('0x27')]['hasOwnProperty'](_0x7e04('0x41'))){_0x23da01[_0x7e04('0x18')]=qs['limit'](_0x259f75['query'][_0x7e04('0x18')]);_0x23da01[_0x7e04('0x15')]=qs[_0x7e04('0x15')](_0x259f75[_0x7e04('0x27')][_0x7e04('0x15')]);}_0x23da01[_0x7e04('0x42')]=qs[_0x7e04('0x43')](_0x259f75['query'][_0x7e04('0x43')]);_0x23da01[_0x7e04('0x44')]=qs['filters'](_[_0x7e04('0x45')](_0x259f75[_0x7e04('0x27')],_0x2c3daa['filters']));_0x23da01['where']['SmsInteractionId']=_0x2b1069['id'];if(_0x259f75['query'][_0x7e04('0x46')]){_0x23da01[_0x7e04('0x44')]=_[_0x7e04('0x35')](_0x23da01['where'],{'$or':_[_0x7e04('0x47')](_0x23da01[_0x7e04('0x31')],function(_0x2f6003){var _0xbbd6a0={};_0xbbd6a0[_0x2f6003]={'$like':'%'+_0x259f75['query'][_0x7e04('0x46')]+'%'};return _0xbbd6a0;})});}if(_0x259f75[_0x7e04('0x27')][_0x7e04('0x48')]){var _0x4f52d4=_0x259f75[_0x7e04('0x27')][_0x7e04('0x48')][_0x7e04('0x49')](',');var _0x4b5f85={};_0x4b5f85[_0x4f52d4[0x0]]={'$gte':moment(_0x4f52d4[0x1])['format'](_0x7e04('0x4a'))};_0x23da01[_0x7e04('0x44')]=_[_0x7e04('0x35')](_0x23da01[_0x7e04('0x44')],_0x4b5f85);}_0x23da01=_['merge']({},_0x23da01,_0x259f75['options']);return db[_0x7e04('0x3d')][_0x7e04('0x17')]({'where':_0x23da01[_0x7e04('0x44')]})['then'](function(_0x59e70c){_0x7d8295[_0x7e04('0x17')]=_0x59e70c;if(_0x259f75[_0x7e04('0x27')]['includeAll']){_0x23da01['include']=[{'all':!![]}];}return db[_0x7e04('0x3d')][_0x7e04('0x4b')](_0x23da01);})[_0x7e04('0x29')](function(_0x41a2a1){_0x7d8295['rows']=_0x41a2a1;return _0x7d8295;});}})['then'](respondWithFilteredResult(_0x1b4b51,_0x23da01))[_0x7e04('0x2a')](handleError(_0x1b4b51,null));};exports[_0x7e04('0x4c')]=function(_0x11b512,_0xf9056d){return db[_0x7e04('0x21')][_0x7e04('0x37')]({'where':{'id':_0x11b512[_0x7e04('0x2c')]['id']}})['then'](handleEntityNotFound(_0xf9056d,null))[_0x7e04('0x29')](function(_0xce54d0){if(_0xce54d0){return _0xce54d0[_0x7e04('0x4d')](_0x11b512[_0x7e04('0x39')][_0x7e04('0x3e')],_[_0x7e04('0x3f')](_0x11b512[_0x7e04('0x39')],[_0x7e04('0x3e'),'id'])||{})[_0x7e04('0x4e')](function(){return db[_0x7e04('0x4f')][_0x7e04('0x4b')]({'attributes':['id',_0x7e04('0x1e'),'color'],'where':{'id':_0x11b512[_0x7e04('0x39')][_0x7e04('0x3e')]}});})[_0x7e04('0x29')](function(_0x3b9ef9){socket['emit'](_0x7e04('0x50'),{'id':Number(_0x11b512['params']['id']),'tags':_0x3b9ef9||[]});return{'id':Number(_0x11b512[_0x7e04('0x2c')]['id']),'tags':_0x3b9ef9||[]};});}})['then'](respondWithResult(_0xf9056d,null))[_0x7e04('0x2a')](handleError(_0xf9056d,null));};exports[_0x7e04('0x51')]=function(_0x3dba29,_0x4217df){return db['SmsInteraction'][_0x7e04('0x37')]({'where':{'id':_0x3dba29[_0x7e04('0x2c')]['id']}})[_0x7e04('0x29')](handleEntityNotFound(_0x4217df,null))[_0x7e04('0x29')](function(_0x5ceef1){if(_0x5ceef1){return _0x5ceef1[_0x7e04('0x51')](_0x3dba29[_0x7e04('0x27')][_0x7e04('0x3e')]);}})[_0x7e04('0x29')](respondWithStatusCode(_0x4217df,null))[_0x7e04('0x2a')](handleError(_0x4217df,null));};exports[_0x7e04('0x52')]=function(_0x102a4d,_0x18cfc3){var _0x57bac9=moment()[_0x7e04('0x53')]()['toString']();var _0x276757=path['join'](config[_0x7e04('0x54')],_0x7e04('0x55'),_0x7e04('0x56'),_0x7e04('0x57'));var _0xcec462=path[_0x7e04('0x58')](_0x276757,_0x57bac9);var _0x542bbd=util[_0x7e04('0x59')](_0x7e04('0x5a'),_0x102a4d[_0x7e04('0x2c')]['id'],_0x57bac9);var _0x428eb0=path['join'](_0x276757,_0x542bbd);var _0x444656=[];_0x444656[_0x7e04('0x5b')]({'model':db[_0x7e04('0x5c')],'as':_0x7e04('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x444656[_0x7e04('0x5b')]({'model':db['CmContact'],'as':_0x7e04('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0xcd40ac=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x7e04('0x39'),_0x7e04('0x5e'),_0x7e04('0x5f'),_0x7e04('0x60'),_0x7e04('0x61')],'include':_0x444656}];_0xcd40ac[_0x7e04('0x5b')]({'model':db['SmsAccount'],'as':_0x7e04('0x62'),'attributes':['id',_0x7e04('0x1e')]});_0xcd40ac['push']({'model':db[_0x7e04('0x5c')],'as':_0x7e04('0x63'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x7e04('0x37')]({'where':{'id':_0x102a4d['params']['id']},'include':_0xcd40ac})[_0x7e04('0x29')](handleEntityNotFound(_0x18cfc3,null))[_0x7e04('0x29')](function(_0x3711b4){if(_0x3711b4){var _0x3b13c7=_0x3711b4[_0x7e04('0x64')]({'plain':!![]});fs['mkdirSync'](_0xcec462);var _0x24b34d={'channel':_0x7e04('0x65'),'account':_0x3b13c7[_0x7e04('0x62')][_0x7e04('0x1e')],'agent':_0x3b13c7[_0x7e04('0x63')]?_0x3b13c7['Owner'][_0x7e04('0x66')]:_0x7e04('0x67'),'createdAt':moment(_0x3b13c7[_0x7e04('0x5e')])[_0x7e04('0x59')](_0x7e04('0x4a'))[_0x7e04('0x68')](),'closedAt':_0x3b13c7[_0x7e04('0x69')]?moment(_0x3b13c7['closedAt'])[_0x7e04('0x59')](_0x7e04('0x4a'))[_0x7e04('0x68')]():'','disposition':_0x3b13c7[_0x7e04('0x6a')],'messages':_(_0x3b13c7[_0x7e04('0x6b')])['filter']({'secret':![]})['map'](function(_0x140571){return{'date':moment(_0x140571[_0x7e04('0x5e')])[_0x7e04('0x59')](_0x7e04('0x4a'))[_0x7e04('0x68')](),'sender':_0x140571['direction']===_0x7e04('0x6c')?_0x140571[_0x7e04('0x5c')]?_0x140571[_0x7e04('0x5c')][_0x7e04('0x66')]:_0x7e04('0x6d'):_0x140571[_0x7e04('0x5d')][_0x7e04('0x6e')]+(_0x140571[_0x7e04('0x5d')][_0x7e04('0x6f')]?'\x20'+_0x140571[_0x7e04('0x5d')][_0x7e04('0x6f')]:''),'body':_0x140571[_0x7e04('0x39')],'direction':_0x140571[_0x7e04('0x5f')]===_0x7e04('0x6c')?'A':'C','secret':_0x140571[_0x7e04('0x60')],'read':_0x140571[_0x7e04('0x61')]};})['value']()};return ejs['renderFile'](path[_0x7e04('0x58')](config['root'],_0x7e04('0x55'),_0x7e04('0x70'),_0x7e04('0x71')),{'interaction':_0x24b34d})[_0x7e04('0x29')](function(_0x2d5dc1){var _0x200a79=path[_0x7e04('0x58')](_0xcec462,'transcript-'+_0x3b13c7['id']+'-'+_0x57bac9+'.pdf');var _0x353cd5={'path':_0x200a79,'channel':_0x7e04('0x65'),'interactionId':_0x3b13c7['id']};return pdf[_0x7e04('0x72')](_0x2d5dc1,_0x353cd5);})[_0x7e04('0x29')](function(){return new BPromise(function(_0x1d90b5,_0x274bb1){zipdir(_0xcec462,{'saveTo':_0x428eb0},function(_0x46e3e5,_0x3b03e1){if(_0x46e3e5)return _0x274bb1(_0x46e3e5);return _0x1d90b5(_0x3b03e1);});})['then'](function(){return new BPromise(function(_0x2777d3,_0xabe249){rimraf(_0xcec462,function(_0xd32539){if(_0xd32539)_0xabe249(_0xd32539);return _0x2777d3();});});})[_0x7e04('0x29')](function(){return _0x18cfc3[_0x7e04('0x52')](_0x428eb0,_0x542bbd,function(_0x3ed577){if(_0x3ed577){console[_0x7e04('0x73')](_0x7e04('0x74'),_0x3ed577);}else{fs[_0x7e04('0x75')](_0x428eb0);}});});});}else{return _0x18cfc3['sendStatus'](0xc8);}})['catch'](handleError(_0x18cfc3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 72f1889..2e7bbd5 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 _0x1399=['setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','Users','findAll'];(function(_0x31a961,_0x53b235){var _0x526341=function(_0x4cc54a){while(--_0x4cc54a){_0x31a961['push'](_0x31a961['shift']());}};_0x526341(++_0x53b235);}(_0x1399,0x16c));var _0x9139=function(_0x4a3559,_0x42c32e){_0x4a3559=_0x4a3559-0x0;var _0xd8982e=_0x1399[_0x4a3559];return _0xd8982e;};'use strict';var EventEmitter=require(_0x9139('0x0'));var SmsInteraction=require(_0x9139('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x9139('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x9139('0x2')](0x0);var events={'afterCreate':_0x9139('0x3'),'afterUpdate':_0x9139('0x4'),'afterDestroy':_0x9139('0x5')};function emitEvent(_0x251798){return function(_0x2acb38,_0x5ac80b,_0x54af2d){_0x2acb38[_0x9139('0x6')]({'attributes':['id'],'raw':!![]})[_0x9139('0x7')](function(_0x4d5d1e){_0x2acb38['setDataValue'](_0x9139('0x8'),_0x4d5d1e['map'](function(_0x504ced){return{'id':_0x504ced['id']};}));return SmsMessage[_0x9139('0x9')]({'where':{'SmsInteractionId':_0x2acb38['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9139('0x7')](function(_0x4830cd){_0x2acb38[_0x9139('0xa')](_0x9139('0xb'),_0x4830cd['length']);SmsInteractionEvents['emit'](_0x251798+':'+_0x2acb38['id'],_0x2acb38);SmsInteractionEvents[_0x9139('0xc')](_0x251798,_0x2acb38);_0x54af2d(null);})[_0x9139('0xd')](_0x54af2d(null));};}for(var e in events){if(events[_0x9139('0xe')](e)){var event=events[e];SmsInteraction[_0x9139('0xf')](e,emitEvent(event));}}module[_0x9139('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0x583c=['../../mysqldb','SmsInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','events'];(function(_0x36242b,_0x543bcc){var _0x4cdae5=function(_0x3b63f7){while(--_0x3b63f7){_0x36242b['push'](_0x36242b['shift']());}};_0x4cdae5(++_0x543bcc);}(_0x583c,0x12b));var _0xc583=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x583c[_0x1abeb2];return _0x48da20;};'use strict';var EventEmitter=require(_0xc583('0x0'));var SmsInteraction=require(_0xc583('0x1'))['db'][_0xc583('0x2')];var SmsMessage=require(_0xc583('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc583('0x3')](0x0);var events={'afterCreate':_0xc583('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13b8a7){return function(_0xf03852,_0x5b7292,_0xd3a750){_0xf03852[_0xc583('0x5')]({'attributes':['id'],'raw':!![]})[_0xc583('0x6')](function(_0x1dd37c){_0xf03852['setDataValue'](_0xc583('0x7'),_0x1dd37c[_0xc583('0x8')](function(_0x5b456e){return{'id':_0x5b456e['id']};}));return SmsMessage[_0xc583('0x9')]({'where':{'SmsInteractionId':_0xf03852['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc583('0x6')](function(_0x25f8d3){_0xf03852[_0xc583('0xa')](_0xc583('0xb'),_0x25f8d3['length']);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7+':'+_0xf03852['id'],_0xf03852);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7,_0xf03852);_0xd3a750(null);})['catch'](_0xd3a750(null));};}for(var e in events){if(events[_0xc583('0xd')](e)){var event=events[e];SmsInteraction[_0xc583('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 5cace03..51a15d5 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 _0xed06=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','SmsInteraction','sms_interactions','closed'];(function(_0x494241,_0x1efd95){var _0x3c5524=function(_0x3a0030){while(--_0x3a0030){_0x494241['push'](_0x494241['shift']());}};_0x3c5524(++_0x1efd95);}(_0xed06,0x82));var _0x6ed0=function(_0x471596,_0x157724){_0x471596=_0x471596-0x0;var _0x311dc2=_0xed06[_0x471596];return _0x311dc2;};'use strict';var _=require('lodash');var util=require(_0x6ed0('0x0'));var logger=require(_0x6ed0('0x1'))(_0x6ed0('0x2'));var moment=require(_0x6ed0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ed0('0x4'));var rimraf=require(_0x6ed0('0x5'));var config=require(_0x6ed0('0x6'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x287f5,_0x4fed11){return _0x287f5['define'](_0x6ed0('0x7'),attributes,{'tableName':_0x6ed0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5d7546,_0x541b2c,_0x5a106c){if(_0x5d7546['changed'](_0x6ed0('0x9'))){_0x5d7546['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5a106c(null,_0x5d7546);}}});}; \ No newline at end of file +var _0xbfa7=['moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xbfa7,0x14e));var _0x7bfa=function(_0x51319e,_0x6bf44b){_0x51319e=_0x51319e-0x0;var _0x1b44b2=_0xbfa7[_0x51319e];return _0x1b44b2;};'use strict';var _=require('lodash');var util=require(_0x7bfa('0x0'));var logger=require('../../config/logger')(_0x7bfa('0x1'));var moment=require(_0x7bfa('0x2'));var BPromise=require(_0x7bfa('0x3'));var rp=require(_0x7bfa('0x4'));var fs=require('fs');var path=require(_0x7bfa('0x5'));var rimraf=require(_0x7bfa('0x6'));var config=require('../../config/environment');var attributes=require(_0x7bfa('0x7'));module[_0x7bfa('0x8')]=function(_0x325d29,_0x38db4c){return _0x325d29['define'](_0x7bfa('0x9'),attributes,{'tableName':_0x7bfa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x278a3b,_0x4577ff,_0x4ced7b){if(_0x278a3b[_0x7bfa('0xb')](_0x7bfa('0xc'))){_0x278a3b[_0x7bfa('0xd')]=moment()[_0x7bfa('0xe')](_0x7bfa('0xf'));}_0x4ced7b(null,_0x278a3b);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0dd001a..999d97f 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 _0x29c2=['AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','SmsInteraction','body','raw','options','where','attributes','limit','then','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','find','addTags','ids','spread'];(function(_0x3fc9ca,_0xcbb78e){var _0x35a678=function(_0x22731d){while(--_0x22731d){_0x3fc9ca['push'](_0x3fc9ca['shift']());}};_0x35a678(++_0xcbb78e);}(_0x29c2,0x169));var _0x229c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x29c2[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x229c('0x0'));var util=require(_0x229c('0x1'));var moment=require(_0x229c('0x2'));var BPromise=require(_0x229c('0x3'));var rs=require(_0x229c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x229c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x229c('0x6'));var config=require(_0x229c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x229c('0x8')]['http']({'port':0x232a});config[_0x229c('0x9')]=_[_0x229c('0xa')](config[_0x229c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x229c('0xb'))(new Redis(config[_0x229c('0x9')]));require(_0x229c('0xc'))[_0x229c('0xd')](socket);function respondWithRpcPromise(_0x3f348e,_0x1218df,_0x414c35){return new BPromise(function(_0x20cb60,_0xeab770){return client[_0x229c('0xe')](_0x3f348e,_0x414c35)['then'](function(_0x3e45ad){logger[_0x229c('0xf')](_0x229c('0x10'),_0x1218df,'request\x20sent');logger[_0x229c('0x11')](_0x229c('0x12'),_0x1218df,_0x229c('0x13'),JSON['stringify'](_0x3e45ad));if(_0x3e45ad[_0x229c('0x14')]){if(_0x3e45ad[_0x229c('0x14')][_0x229c('0x15')]===0x1f4){logger['error'](_0x229c('0x10'),_0x1218df,_0x3e45ad[_0x229c('0x14')]['message']);return _0xeab770(_0x3e45ad[_0x229c('0x14')][_0x229c('0x16')]);}logger[_0x229c('0x14')](_0x229c('0x10'),_0x1218df,_0x3e45ad[_0x229c('0x14')][_0x229c('0x16')]);return _0x20cb60(_0x3e45ad[_0x229c('0x14')][_0x229c('0x16')]);}else{logger['info'](_0x229c('0x10'),_0x1218df,_0x229c('0x13'));_0x20cb60(_0x3e45ad['result'][_0x229c('0x16')]);}})[_0x229c('0x17')](function(_0x3b3d3b){logger[_0x229c('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x1218df,_0x3b3d3b);_0xeab770(_0x3b3d3b);});});}exports['UpdateSmsInteraction']=function(_0x378a81){var _0x439435=this;return new Promise(function(_0x1626c7,_0x5b9577){return db[_0x229c('0x18')]['update'](_0x378a81[_0x229c('0x19')],{'raw':_0x378a81['options']?_0x378a81['options'][_0x229c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378a81[_0x229c('0x1b')]?_0x378a81['options'][_0x229c('0x1c')]||null:null,'attributes':_0x378a81[_0x229c('0x1b')]?_0x378a81['options'][_0x229c('0x1d')]||null:null,'limit':_0x378a81[_0x229c('0x1b')]?_0x378a81[_0x229c('0x1b')][_0x229c('0x1e')]||null:null})[_0x229c('0x1f')](function(_0x53735c){logger[_0x229c('0xf')](_0x229c('0x20'),_0x378a81);logger[_0x229c('0x11')](_0x229c('0x20'),_0x378a81,JSON[_0x229c('0x21')](_0x53735c));_0x1626c7(_0x53735c);})[_0x229c('0x17')](function(_0x2c4e2a){logger[_0x229c('0x14')](_0x229c('0x20'),_0x2c4e2a[_0x229c('0x16')],_0x378a81);_0x5b9577(_0x439435[_0x229c('0x14')](0x1f4,_0x2c4e2a['message']));});});};exports[_0x229c('0x22')]=function(_0x2e7f31){return new Promise(function(_0x4cb1d4,_0x26ec04){return db['SmsInteraction'][_0x229c('0x23')]({'where':_0x2e7f31[_0x229c('0x1b')]?_0x2e7f31['options']['where']||null:null})[_0x229c('0x1f')](function(_0x979027){if(_0x979027){return _0x979027[_0x229c('0x24')](_0x2e7f31[_0x229c('0x19')]['ids'],_['omit'](_0x2e7f31[_0x229c('0x19')],[_0x229c('0x25'),'id'])||{});}})[_0x229c('0x26')](function(_0x33ce16){logger[_0x229c('0xf')]('AddTags',_0x2e7f31);logger[_0x229c('0x11')](_0x229c('0x27'),_0x2e7f31,JSON[_0x229c('0x21')](_0x33ce16));_0x4cb1d4(_0x33ce16);})[_0x229c('0x17')](function(_0x5dc4af){logger[_0x229c('0x14')](_0x229c('0x27'),_0x5dc4af[_0x229c('0x16')],_0x2e7f31);_0x26ec04(_this[_0x229c('0x14')](0x1f4,_0x5dc4af['message']));});});}; \ No newline at end of file +var _0xd3f9=['body','options','raw','where','attributes','limit','then','find','addTags','omit','spread','AddTags','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','defaults','localhost','redis','./smsInteraction.socket','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsInteraction,\x20%s,\x20%s','result','UpdateSmsInteraction','SmsInteraction','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3f9,0x1af));var _0x9d3f=function(_0x570b5d,_0x267462){_0x570b5d=_0x570b5d-0x0;var _0x2d06be=_0xd3f9[_0x570b5d];return _0x2d06be;};'use strict';var _=require(_0x9d3f('0x0'));var util=require(_0x9d3f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d3f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d3f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9d3f('0x4'))('rpc');var config=require(_0x9d3f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9d3f('0x6')]['http']({'port':0x232a});config['redis']=_[_0x9d3f('0x7')](config['redis'],{'host':_0x9d3f('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d3f('0x9')]));require(_0x9d3f('0xa'))[_0x9d3f('0xb')](socket);function respondWithRpcPromise(_0x2e571e,_0x55063b,_0x3b2763){return new BPromise(function(_0x4dcd2f,_0x1c5838){return client[_0x9d3f('0xc')](_0x2e571e,_0x3b2763)['then'](function(_0x4cf90a){logger[_0x9d3f('0xd')]('SmsInteraction,\x20%s,\x20%s',_0x55063b,_0x9d3f('0xe'));logger[_0x9d3f('0xf')](_0x9d3f('0x10'),_0x55063b,_0x9d3f('0xe'),JSON[_0x9d3f('0x11')](_0x4cf90a));if(_0x4cf90a[_0x9d3f('0x12')]){if(_0x4cf90a[_0x9d3f('0x12')]['code']===0x1f4){logger[_0x9d3f('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x55063b,_0x4cf90a[_0x9d3f('0x12')][_0x9d3f('0x13')]);return _0x1c5838(_0x4cf90a[_0x9d3f('0x12')][_0x9d3f('0x13')]);}logger[_0x9d3f('0x12')](_0x9d3f('0x14'),_0x55063b,_0x4cf90a[_0x9d3f('0x12')][_0x9d3f('0x13')]);return _0x4dcd2f(_0x4cf90a['error'][_0x9d3f('0x13')]);}else{logger['info'](_0x9d3f('0x14'),_0x55063b,_0x9d3f('0xe'));_0x4dcd2f(_0x4cf90a[_0x9d3f('0x15')]['message']);}})['catch'](function(_0x2ccf28){logger[_0x9d3f('0x12')](_0x9d3f('0x14'),_0x55063b,_0x2ccf28);_0x1c5838(_0x2ccf28);});});}exports[_0x9d3f('0x16')]=function(_0x356a12){var _0x4d7d80=this;return new Promise(function(_0x492764,_0x324010){return db[_0x9d3f('0x17')][_0x9d3f('0x18')](_0x356a12[_0x9d3f('0x19')],{'raw':_0x356a12[_0x9d3f('0x1a')]?_0x356a12[_0x9d3f('0x1a')][_0x9d3f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356a12[_0x9d3f('0x1a')]?_0x356a12[_0x9d3f('0x1a')][_0x9d3f('0x1c')]||null:null,'attributes':_0x356a12[_0x9d3f('0x1a')]?_0x356a12['options'][_0x9d3f('0x1d')]||null:null,'limit':_0x356a12[_0x9d3f('0x1a')]?_0x356a12[_0x9d3f('0x1a')][_0x9d3f('0x1e')]||null:null})[_0x9d3f('0x1f')](function(_0x559319){logger[_0x9d3f('0xd')](_0x9d3f('0x16'),_0x356a12);logger['debug'](_0x9d3f('0x16'),_0x356a12,JSON['stringify'](_0x559319));_0x492764(_0x559319);})['catch'](function(_0x4e031d){logger[_0x9d3f('0x12')](_0x9d3f('0x16'),_0x4e031d[_0x9d3f('0x13')],_0x356a12);_0x324010(_0x4d7d80[_0x9d3f('0x12')](0x1f4,_0x4e031d['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x47a626){return new Promise(function(_0x2ed145,_0x412866){return db[_0x9d3f('0x17')][_0x9d3f('0x20')]({'where':_0x47a626[_0x9d3f('0x1a')]?_0x47a626[_0x9d3f('0x1a')]['where']||null:null})['then'](function(_0x37b760){if(_0x37b760){return _0x37b760[_0x9d3f('0x21')](_0x47a626[_0x9d3f('0x19')]['ids'],_[_0x9d3f('0x22')](_0x47a626[_0x9d3f('0x19')],['ids','id'])||{});}})[_0x9d3f('0x23')](function(_0x4afe71){logger[_0x9d3f('0xd')](_0x9d3f('0x24'),_0x47a626);logger['debug'](_0x9d3f('0x24'),_0x47a626,JSON['stringify'](_0x4afe71));_0x2ed145(_0x4afe71);})[_0x9d3f('0x25')](function(_0x216398){logger['error']('AddTags',_0x216398[_0x9d3f('0x13')],_0x47a626);_0x412866(_this['error'](0x1f4,_0x216398[_0x9d3f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index be9b818..26f22d8 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 _0x0eb3=['./smsInteraction.events','update','emit','length'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x0eb3,0x7c));var _0x30eb=function(_0x255839,_0x44761d){_0x255839=_0x255839-0x0;var _0x241e74=_0x0eb3[_0x255839];return _0x241e74;};'use strict';var SmsInteractionEvents=require(_0x30eb('0x0'));var events=['save','remove',_0x30eb('0x1')];function createListener(_0x39ebd6,_0x3bd76d){return function(_0x497e61){_0x3bd76d[_0x30eb('0x2')](_0x39ebd6,_0x497e61);};}function removeListener(_0x2281f0,_0x57b5e8){return function(){SmsInteractionEvents['removeListener'](_0x2281f0,_0x57b5e8);};}exports['register']=function(_0xf863eb){for(var _0x4eddff=0x0,_0xc432fc=events[_0x30eb('0x3')];_0x4eddff<_0xc432fc;_0x4eddff++){var _0x2cf591=events[_0x4eddff];var _0x704547=createListener('smsInteraction:'+_0x2cf591,_0xf863eb);SmsInteractionEvents['on'](_0x2cf591,_0x704547);}}; \ No newline at end of file +var _0x9bfd=['./smsInteraction.events','save','update','emit','removeListener','smsInteraction:'];(function(_0x464e6b,_0x49e3bc){var _0x13ed4b=function(_0x583421){while(--_0x583421){_0x464e6b['push'](_0x464e6b['shift']());}};_0x13ed4b(++_0x49e3bc);}(_0x9bfd,0x10e));var _0xd9bf=function(_0x3827dd,_0x3dc148){_0x3827dd=_0x3827dd-0x0;var _0x3f9460=_0x9bfd[_0x3827dd];return _0x3f9460;};'use strict';var SmsInteractionEvents=require(_0xd9bf('0x0'));var events=[_0xd9bf('0x1'),'remove',_0xd9bf('0x2')];function createListener(_0x39e7fc,_0x42a9ee){return function(_0x15701c){_0x42a9ee[_0xd9bf('0x3')](_0x39e7fc,_0x15701c);};}function removeListener(_0x1cd8c6,_0x21107c){return function(){SmsInteractionEvents[_0xd9bf('0x4')](_0x1cd8c6,_0x21107c);};}exports['register']=function(_0x2abf8e){for(var _0x2ae791=0x0,_0x4e8878=events['length'];_0x2ae791<_0x4e8878;_0x2ae791++){var _0x2681ab=events[_0x2ae791];var _0x535372=createListener(_0xd9bf('0x5')+_0x2681ab,_0x2abf8e);SmsInteractionEvents['on'](_0x2681ab,_0x535372);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1fb5d68..e2912d9 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 _0xd0f5=['/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','get','show','post','tracked','sms','create','status','put'];(function(_0x2375a9,_0x4b7669){var _0x2a9d9c=function(_0x453b01){while(--_0x453b01){_0x2375a9['push'](_0x2375a9['shift']());}};_0x2a9d9c(++_0x4b7669);}(_0xd0f5,0xda));var _0x5d0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd0f5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5d0f('0x0'));var util=require(_0x5d0f('0x1'));var path=require('path');var timeout=require(_0x5d0f('0x2'));var express=require(_0x5d0f('0x3'));var router=express[_0x5d0f('0x4')]();var fs_extra=require(_0x5d0f('0x5'));var auth=require(_0x5d0f('0x6'));var interaction=require(_0x5d0f('0x7'));var config=require(_0x5d0f('0x8'));var controller=require(_0x5d0f('0x9'));router['get']('/',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xb')]);router['get'](_0x5d0f('0xc'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xd')]);router[_0x5d0f('0xe')]('/:id',auth[_0x5d0f('0xa')](),controller[_0x5d0f('0xf')]);router[_0x5d0f('0x10')]('/',auth['isAuthenticated'](),interaction[_0x5d0f('0x11')](_0x5d0f('0x12'),'smsmessage:create'),controller[_0x5d0f('0x13')]);router[_0x5d0f('0x10')]('/:id/status',controller[_0x5d0f('0x14')]);router[_0x5d0f('0x15')](_0x5d0f('0x16'),auth[_0x5d0f('0xa')](),controller['update']);router['put'](_0x5d0f('0x17'),auth['isAuthenticated'](),controller[_0x5d0f('0x18')]);router[_0x5d0f('0x15')](_0x5d0f('0x19'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x1a')]);router[_0x5d0f('0x1b')](_0x5d0f('0x16'),auth[_0x5d0f('0xa')](),controller[_0x5d0f('0x1c')]);module[_0x5d0f('0x1d')]=router; \ No newline at end of file +var _0x7275=['path','express','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','show','tracked','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util'];(function(_0x3592ab,_0x4f669a){var _0x13298a=function(_0x25f018){while(--_0x25f018){_0x3592ab['push'](_0x3592ab['shift']());}};_0x13298a(++_0x4f669a);}(_0x7275,0x143));var _0x5727=function(_0x2d897b,_0x358269){_0x2d897b=_0x2d897b-0x0;var _0x2e81c6=_0x7275[_0x2d897b];return _0x2e81c6;};'use strict';var multer=require(_0x5727('0x0'));var util=require(_0x5727('0x1'));var path=require(_0x5727('0x2'));var timeout=require('connect-timeout');var express=require(_0x5727('0x3'));var router=express['Router']();var fs_extra=require(_0x5727('0x4'));var auth=require(_0x5727('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5727('0x6'));var controller=require(_0x5727('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5727('0x8')]('/describe',auth[_0x5727('0x9')](),controller['describe']);router[_0x5727('0x8')]('/:id',auth[_0x5727('0x9')](),controller[_0x5727('0xa')]);router['post']('/',auth[_0x5727('0x9')](),interaction[_0x5727('0xb')]('sms',_0x5727('0xc')),controller[_0x5727('0xd')]);router['post'](_0x5727('0xe'),controller[_0x5727('0xf')]);router[_0x5727('0x10')](_0x5727('0x11'),auth[_0x5727('0x9')](),controller[_0x5727('0x12')]);router['put'](_0x5727('0x13'),auth[_0x5727('0x9')](),controller[_0x5727('0x14')]);router[_0x5727('0x10')](_0x5727('0x15'),auth[_0x5727('0x9')](),controller[_0x5727('0x16')]);router['delete'](_0x5727('0x11'),auth[_0x5727('0x9')](),controller[_0x5727('0x17')]);module[_0x5727('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 63ea728..6f35909 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 _0x5a5a=['ENUM','out','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a5a,0x1d1));var _0xa5a5=function(_0x512e72,_0x49ffe1){_0x512e72=_0x512e72-0x0;var _0x143086=_0x5a5a[_0x512e72];return _0x143086;};'use strict';var Sequelize=require('sequelize');module[_0xa5a5('0x0')]={'body':{'type':Sequelize[_0xa5a5('0x1')](_0xa5a5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa5a5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xa5a5('0x4')]('in','out'),'defaultValue':_0xa5a5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa5a5('0x6')](0xbe)},'phone':{'type':Sequelize[_0xa5a5('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa5a5('0x6')]},'providerResponse':{'type':Sequelize[_0xa5a5('0x1')]}}; \ No newline at end of file +var _0xed20=['STRING','sequelize','medium','BOOLEAN','ENUM'];(function(_0x85d5a8,_0x1977be){var _0x20479b=function(_0x125248){while(--_0x125248){_0x85d5a8['push'](_0x85d5a8['shift']());}};_0x20479b(++_0x1977be);}(_0xed20,0x1b9));var _0x0ed2=function(_0x824460,_0x51539d){_0x824460=_0x824460-0x0;var _0x81354=_0xed20[_0x824460];return _0x81354;};'use strict';var Sequelize=require(_0x0ed2('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x0ed2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x0ed2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ed2('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x0ed2('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0ed2('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0ed2('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 896c824..3cf14a7 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 _0x9ab9=['request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','save','name','index','map','SmsMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','update','body','destroy','describe','../../config/logger','sms-interactions','accept','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','Sequelize','QueryTypes','contact','fullname','format','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client'];(function(_0x2094ca,_0x1eddd7){var _0x1ea7e3=function(_0x3ecbb3){while(--_0x3ecbb3){_0x2094ca['push'](_0x2094ca['shift']());}};_0x1ea7e3(++_0x1eddd7);}(_0x9ab9,0x19d));var _0x99ab=function(_0x3f1c4e,_0x404056){_0x3f1c4e=_0x3f1c4e-0x0;var _0x12561e=_0x9ab9[_0x3f1c4e];return _0x12561e;};'use strict';var emlformat=require(_0x99ab('0x0'));var rimraf=require(_0x99ab('0x1'));var zipdir=require(_0x99ab('0x2'));var jsonpatch=require(_0x99ab('0x3'));var rp=require(_0x99ab('0x4'));var moment=require('moment');var BPromise=require(_0x99ab('0x5'));var Mustache=require(_0x99ab('0x6'));var util=require('util');var path=require(_0x99ab('0x7'));var sox=require('sox');var csv=require(_0x99ab('0x8'));var ejs=require(_0x99ab('0x9'));var fs=require('fs');var fs_extra=require(_0x99ab('0xa'));var _=require(_0x99ab('0xb'));var squel=require(_0x99ab('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99ab('0xd'));var toCsv=require(_0x99ab('0x8'));var querystring=require('querystring');var Papa=require(_0x99ab('0xe'));var Redis=require(_0x99ab('0xf'));var authService=require(_0x99ab('0x10'));var qs=require(_0x99ab('0x11'));var as=require(_0x99ab('0x12'));var hardwareService=require(_0x99ab('0x13'));var logger=require('../../config/logger')(_0x99ab('0x14'));var utils=require(_0x99ab('0x15'));var config=require(_0x99ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x99ab('0x17')]=_[_0x99ab('0x18')](config[_0x99ab('0x17')],{'host':_0x99ab('0x19'),'port':0x18eb});var socket=require(_0x99ab('0x1a'))(new Redis(config[_0x99ab('0x17')]));require('./smsMessage.socket')[_0x99ab('0x1b')](socket);var jayson=require(_0x99ab('0x1c'));var client=jayson['client'][_0x99ab('0x1d')]({'port':0x232c});var client9002=jayson[_0x99ab('0x1e')][_0x99ab('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4b11f1,_0x4299ae,_0x13b9aa,_0x1c52a6){return new BPromise(function(_0x31b340,_0x19681d){var _0x2a5e0e=_0x1c52a6||client;return _0x2a5e0e[_0x99ab('0x1f')](_0x4b11f1,_0x13b9aa)[_0x99ab('0x20')](function(_0x478b37){logger[_0x99ab('0x21')](_0x99ab('0x22'),_0x4299ae,_0x99ab('0x23'));logger[_0x99ab('0x24')](_0x99ab('0x25'),_0x4299ae,_0x99ab('0x23'),JSON[_0x99ab('0x26')](_0x478b37));if(_0x478b37[_0x99ab('0x27')]){if(_0x478b37[_0x99ab('0x27')]['code']===0x1f4){logger['error'](_0x99ab('0x22'),_0x4299ae,_0x478b37[_0x99ab('0x27')][_0x99ab('0x28')]);return _0x19681d(_0x478b37['error'][_0x99ab('0x28')]);}logger[_0x99ab('0x27')](_0x99ab('0x22'),_0x4299ae,_0x478b37[_0x99ab('0x27')][_0x99ab('0x28')]);return _0x31b340(_0x478b37[_0x99ab('0x27')][_0x99ab('0x28')]);}else{logger['info'](_0x99ab('0x22'),_0x4299ae,'request\x20sent');_0x31b340(_0x478b37[_0x99ab('0x29')]['message']);}})['catch'](function(_0x2d3281){logger[_0x99ab('0x27')](_0x99ab('0x22'),_0x4299ae,_0x2d3281);_0x19681d(_0x2d3281);});});}function respondWithStatusCode(_0x570bed,_0x1a44eb){_0x1a44eb=_0x1a44eb||0xcc;return function(_0x40b5b2){if(_0x40b5b2){return _0x570bed[_0x99ab('0x2a')](_0x1a44eb);}return _0x570bed[_0x99ab('0x2b')](_0x1a44eb)[_0x99ab('0x2c')]();};}function respondWithResult(_0x45d50e,_0x970ce7){_0x970ce7=_0x970ce7||0xc8;return function(_0x2efec3){if(_0x2efec3){return _0x45d50e[_0x99ab('0x2b')](_0x970ce7)['json'](_0x2efec3);}};}function respondWithFilteredResult(_0x37182e,_0x3178c2){return function(_0x50ffdc){if(_0x50ffdc){var _0x35d09e=typeof _0x3178c2[_0x99ab('0x2d')]===_0x99ab('0x2e')&&typeof _0x3178c2['limit']==='undefined';var _0x415276=_0x50ffdc[_0x99ab('0x2f')];var _0x1aeca3=_0x35d09e?0x0:_0x3178c2[_0x99ab('0x2d')];var _0x16b405=_0x35d09e?_0x50ffdc[_0x99ab('0x2f')]:_0x3178c2[_0x99ab('0x2d')]+_0x3178c2[_0x99ab('0x30')];var _0x5ba1ea;if(_0x16b405>=_0x415276){_0x16b405=_0x415276;_0x5ba1ea=0xc8;}else{_0x5ba1ea=0xce;}_0x37182e[_0x99ab('0x2b')](_0x5ba1ea);return _0x37182e[_0x99ab('0x31')]('Content-Range',_0x1aeca3+'-'+_0x16b405+'/'+_0x415276)[_0x99ab('0x32')](_0x50ffdc);}return null;};}function patchUpdates(_0xc1cb26){return function(_0x55dcb6){try{jsonpatch['apply'](_0x55dcb6,_0xc1cb26,!![]);}catch(_0x18b705){return BPromise[_0x99ab('0x33')](_0x18b705);}return _0x55dcb6[_0x99ab('0x34')]();};}function saveUpdates(_0x56a440,_0x4eee06){return function(_0x5ec3fa){if(_0x5ec3fa){return _0x5ec3fa['update'](_0x56a440)['then'](function(_0x482255){return _0x482255;});}return null;};}function removeEntity(_0x1e134f,_0x306721){return function(_0x1e741d){if(_0x1e741d){return _0x1e741d['destroy']()[_0x99ab('0x20')](function(){_0x1e134f[_0x99ab('0x2b')](0xcc)[_0x99ab('0x2c')]();});}};}function handleEntityNotFound(_0x4914f8,_0x18ab38){return function(_0x40a02f){if(!_0x40a02f){_0x4914f8[_0x99ab('0x2a')](0x194);}return _0x40a02f;};}function handleError(_0x28629b,_0x120680){_0x120680=_0x120680||0x1f4;return function(_0x10ede5){logger[_0x99ab('0x27')](_0x10ede5['stack']);if(_0x10ede5['name']){delete _0x10ede5[_0x99ab('0x35')];}_0x28629b[_0x99ab('0x2b')](_0x120680)['send'](_0x10ede5);};}exports[_0x99ab('0x36')]=function(_0x41a54d,_0x153ffc){var _0x581896={},_0x285a0d={},_0x182044={'count':0x0,'rows':[]};var _0x2361c0=_[_0x99ab('0x37')](db[_0x99ab('0x38')]['rawAttributes'],function(_0xcfba5a){return{'name':_0xcfba5a[_0x99ab('0x39')],'type':_0xcfba5a['type'][_0x99ab('0x3a')]};});_0x285a0d['model']=_[_0x99ab('0x37')](_0x2361c0,_0x99ab('0x35'));_0x285a0d[_0x99ab('0x3b')]=_[_0x99ab('0x3c')](_0x41a54d[_0x99ab('0x3b')]);_0x285a0d[_0x99ab('0x3d')]=_[_0x99ab('0x3e')](_0x285a0d[_0x99ab('0x3f')],_0x285a0d[_0x99ab('0x3b')]);_0x581896[_0x99ab('0x40')]=_['intersection'](_0x285a0d[_0x99ab('0x3f')],qs[_0x99ab('0x41')](_0x41a54d['query'][_0x99ab('0x41')]));_0x581896['attributes']=_0x581896[_0x99ab('0x40')]['length']?_0x581896[_0x99ab('0x40')]:_0x285a0d[_0x99ab('0x3f')];if(!_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x42')]('nolimit')){_0x581896[_0x99ab('0x30')]=qs[_0x99ab('0x30')](_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x30')]);_0x581896[_0x99ab('0x2d')]=qs[_0x99ab('0x2d')](_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x2d')]);}_0x581896[_0x99ab('0x43')]=qs[_0x99ab('0x44')](_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x44')]);_0x581896[_0x99ab('0x45')]=qs[_0x99ab('0x3d')](_[_0x99ab('0x46')](_0x41a54d['query'],_0x285a0d[_0x99ab('0x3d')]),_0x2361c0);if(_0x41a54d[_0x99ab('0x3b')]['filter']){_0x581896[_0x99ab('0x45')]=_[_0x99ab('0x47')](_0x581896[_0x99ab('0x45')],{'$or':_[_0x99ab('0x37')](_0x2361c0,function(_0x63b31b){if(_0x63b31b[_0x99ab('0x48')]!==_0x99ab('0x49')){var _0x2a6e69={};_0x2a6e69[_0x63b31b[_0x99ab('0x35')]]={'$like':'%'+_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x4a')]+'%'};return _0x2a6e69;}})});}_0x581896=_['merge']({},_0x581896,_0x41a54d[_0x99ab('0x4b')]);var _0x313cd0={'where':_0x581896[_0x99ab('0x45')]};return db[_0x99ab('0x38')]['count'](_0x313cd0)['then'](function(_0x162867){_0x182044['count']=_0x162867;if(_0x41a54d[_0x99ab('0x3b')][_0x99ab('0x4c')]){_0x581896[_0x99ab('0x4d')]=[{'all':!![]}];}return db[_0x99ab('0x38')][_0x99ab('0x4e')](_0x581896);})[_0x99ab('0x20')](function(_0x38d8f4){_0x182044['rows']=_0x38d8f4;return _0x182044;})[_0x99ab('0x20')](respondWithFilteredResult(_0x153ffc,_0x581896))[_0x99ab('0x4f')](handleError(_0x153ffc,null));};exports[_0x99ab('0x50')]=function(_0x436f84,_0x144b30){var _0x35eedf={'raw':!![],'where':{'id':_0x436f84[_0x99ab('0x51')]['id']}},_0x7a6c95={};_0x7a6c95[_0x99ab('0x3f')]=_[_0x99ab('0x3c')](db['SmsMessage'][_0x99ab('0x52')]);_0x7a6c95[_0x99ab('0x3b')]=_['keys'](_0x436f84[_0x99ab('0x3b')]);_0x7a6c95[_0x99ab('0x3d')]=_[_0x99ab('0x3e')](_0x7a6c95[_0x99ab('0x3f')],_0x7a6c95[_0x99ab('0x3b')]);_0x35eedf[_0x99ab('0x40')]=_[_0x99ab('0x3e')](_0x7a6c95['model'],qs[_0x99ab('0x41')](_0x436f84[_0x99ab('0x3b')][_0x99ab('0x41')]));_0x35eedf[_0x99ab('0x40')]=_0x35eedf[_0x99ab('0x40')]['length']?_0x35eedf['attributes']:_0x7a6c95[_0x99ab('0x3f')];if(_0x436f84[_0x99ab('0x3b')][_0x99ab('0x4c')]){_0x35eedf[_0x99ab('0x4d')]=[{'all':!![]}];}_0x35eedf=_['merge']({},_0x35eedf,_0x436f84[_0x99ab('0x4b')]);return db['SmsMessage'][_0x99ab('0x53')](_0x35eedf)[_0x99ab('0x20')](handleEntityNotFound(_0x144b30,null))['then'](respondWithResult(_0x144b30,null))[_0x99ab('0x4f')](handleError(_0x144b30,null));};exports[_0x99ab('0x54')]=function(_0xc6482b,_0x4adeac){return db[_0x99ab('0x38')][_0x99ab('0x54')](_0xc6482b['body'],{})[_0x99ab('0x20')](respondWithResult(_0x4adeac,0xc9))[_0x99ab('0x4f')](handleError(_0x4adeac,null));};exports[_0x99ab('0x55')]=function(_0x2662be,_0x40ff5c){if(_0x2662be[_0x99ab('0x56')]['id']){delete _0x2662be[_0x99ab('0x56')]['id'];}return db[_0x99ab('0x38')][_0x99ab('0x53')]({'where':{'id':_0x2662be[_0x99ab('0x51')]['id']}})[_0x99ab('0x20')](handleEntityNotFound(_0x40ff5c,null))[_0x99ab('0x20')](saveUpdates(_0x2662be['body'],null))['then'](respondWithResult(_0x40ff5c,null))[_0x99ab('0x4f')](handleError(_0x40ff5c,null));};exports[_0x99ab('0x57')]=function(_0xeecf24,_0x5ceaa8){return db[_0x99ab('0x38')][_0x99ab('0x53')]({'where':{'id':_0xeecf24[_0x99ab('0x51')]['id']}})[_0x99ab('0x20')](handleEntityNotFound(_0x5ceaa8,null))[_0x99ab('0x20')](removeEntity(_0x5ceaa8,null))[_0x99ab('0x4f')](handleError(_0x5ceaa8,null));};exports[_0x99ab('0x58')]=function(_0x31d980,_0x6499a5){return db[_0x99ab('0x38')][_0x99ab('0x58')]()[_0x99ab('0x20')](respondWithResult(_0x6499a5,null))['catch'](handleError(_0x6499a5,null));};var interaction_log=require(_0x99ab('0x59'))(_0x99ab('0x5a'));exports[_0x99ab('0x5b')]=function(_0x448201,_0x514b5c,_0x13d17a){var _0x397417={'agent':{},'channel':_0x99ab('0x5c')};if(_0x448201['body']['id']){delete _0x448201[_0x99ab('0x56')]['id'];}_0x448201[_0x99ab('0x56')]['read']=!![];_0x448201[_0x99ab('0x56')][_0x99ab('0x5d')]=moment()['format'](_0x99ab('0x5e'));_0x448201[_0x99ab('0x56')][_0x99ab('0x5f')]=_0x448201[_0x99ab('0x56')][_0x99ab('0x5f')]||_0x448201['user']['id'];_0x397417['agent']['id']=_0x448201[_0x99ab('0x56')][_0x99ab('0x5f')];return db['SmsMessage'][_0x99ab('0x53')]({'where':{'id':_0x448201['params']['id'],'UserId':null}})[_0x99ab('0x20')](handleEntityNotFound(_0x514b5c,null))[_0x99ab('0x20')](saveUpdates(_0x448201[_0x99ab('0x56')],null))[_0x99ab('0x20')](function(_0x4f58f){if(_0x4f58f){_0x397417[_0x99ab('0x28')]=_0x4f58f['get']({'plain':!![]});return db[_0x99ab('0x60')][_0x99ab('0x53')]({'where':{'id':_0x4f58f[_0x99ab('0x61')]}});}return null;})[_0x99ab('0x20')](handleEntityNotFound(_0x514b5c,null))['then'](function(_0x3da9ff){if(_0x3da9ff){return _0x3da9ff['update']({'UserId':_0x448201[_0x99ab('0x56')][_0x99ab('0x5f')],'read1stAt':_[_0x99ab('0x62')](_0x3da9ff[_0x99ab('0x63')])?moment()['format'](_0x99ab('0x5e')):undefined});}return null;})[_0x99ab('0x20')](function(_0x47cfc4){if(_0x47cfc4){_0x397417[_0x99ab('0x64')]=_0x47cfc4[_0x99ab('0x65')]({'plain':!![]});interaction_log[_0x99ab('0x21')](_0x99ab('0x66'),_0x448201[_0x99ab('0x67')]['id'],_0x448201[_0x99ab('0x67')][_0x99ab('0x35')],_0x448201[_0x99ab('0x67')][_0x99ab('0x68')],_0x397417[_0x99ab('0x64')]['id'],_0x448201[_0x99ab('0x56')]?JSON[_0x99ab('0x26')](_0x448201[_0x99ab('0x56')]):_0x99ab('0x69'));return respondWithRpcPromise(_0x99ab('0x6a'),'acceptMessage',_0x397417);}return null;})[_0x99ab('0x20')](function(_0x906a51){var _0x1a320d=_0x99ab('0x6b')+_0x906a51['message'][_0x99ab('0x6c')];return db['sequelize'][_0x99ab('0x3b')](_0x1a320d,{'type':db['Sequelize']['QueryTypes'][_0x99ab('0x6d')],'raw':!![]})[_0x99ab('0x20')](function(_0x3f9eb1){return _0x3f9eb1;});})[_0x99ab('0x20')](function(_0x476be6){if(_0x476be6){_0x397417[_0x99ab('0x28')]['contact']=_0x476be6[0x0];if(!_0x448201['body'][_0x99ab('0x5f')])return;return db[_0x99ab('0x6e')][_0x99ab('0x53')]({'where':{'id':_0x448201[_0x99ab('0x56')][_0x99ab('0x5f')],'role':_0x99ab('0x6f')},'attributes':['id','name','fullname',_0x99ab('0x70'),_0x99ab('0x71')],'raw':!![]});}return null;})['then'](function(_0x3bdcde){if(!_0x3bdcde)return null;_0x397417[_0x99ab('0x28')][_0x99ab('0x6f')]=_0x3bdcde;return _0x397417;})[_0x99ab('0x20')](function(_0x1693a6){if(_0x1693a6){if(_0x448201[_0x99ab('0x56')][_0x99ab('0x72')]){_0x397417[_0x99ab('0x28')][_0x99ab('0x73')]=util['format'](_0x99ab('0x74'),_0x448201['user'][_0x99ab('0x35')]);_0x397417[_0x99ab('0x28')][_0x99ab('0x75')]=_0x397417['channel'];_0x397417[_0x99ab('0x28')][_0x99ab('0x76')]=_0x397417[_0x99ab('0x75')];_0x397417[_0x99ab('0x28')][_0x99ab('0x77')]=_0x99ab('0x5b');return respondWithRpcPromise('EventManager',_0x99ab('0x78'),{'event':_0x99ab('0x79'),'message':_0x397417[_0x99ab('0x28')]},client9002)[_0x99ab('0x20')](function(){return _0x397417;});}return _0x397417;}return null;})[_0x99ab('0x20')](respondWithResult(_0x514b5c,null))[_0x99ab('0x4f')](handleError(_0x514b5c,null));};var interaction_log=require(_0x99ab('0x59'))(_0x99ab('0x5a'));exports['reject']=function(_0xc88d76,_0x18addb,_0x5efa2d){var _0x3fe705={'agent':{},'channel':_0x99ab('0x5c')};if(_0xc88d76[_0x99ab('0x56')]['id']){delete _0xc88d76[_0x99ab('0x56')]['id'];}_0xc88d76[_0x99ab('0x56')]['UserId']=_0xc88d76[_0x99ab('0x56')][_0x99ab('0x5f')]||_0xc88d76[_0x99ab('0x67')]['id'];_0x3fe705[_0x99ab('0x6f')]['id']=_0xc88d76[_0x99ab('0x56')]['UserId'];return db[_0x99ab('0x38')][_0x99ab('0x53')]({'where':{'id':_0xc88d76[_0x99ab('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x18addb,null))[_0x99ab('0x20')](function(_0x48af1b){if(_0x48af1b){_0x3fe705['message']=_0x48af1b[_0x99ab('0x65')]({'plain':!![]});return db[_0x99ab('0x60')]['find']({'where':{'id':_0x48af1b[_0x99ab('0x61')]}});}return null;})[_0x99ab('0x20')](handleEntityNotFound(_0x18addb,null))[_0x99ab('0x20')](function(_0x2d54b4){if(_0x2d54b4){_0x3fe705[_0x99ab('0x64')]=_0x2d54b4['get']({'plain':!![]});interaction_log[_0x99ab('0x21')](_0x99ab('0x7a'),_0xc88d76[_0x99ab('0x67')]['id'],_0xc88d76[_0x99ab('0x67')][_0x99ab('0x35')],_0xc88d76[_0x99ab('0x67')][_0x99ab('0x68')],_0x3fe705[_0x99ab('0x64')]['id'],_0xc88d76[_0x99ab('0x56')]?JSON['stringify'](_0xc88d76['body']):_0x99ab('0x69'));return respondWithRpcPromise('RejectMessage',_0x99ab('0x7b'),_0x3fe705);}return null;})[_0x99ab('0x20')](function(_0x1e2c1e){var _0x19c5d1=_0x99ab('0x6b')+_0x1e2c1e['message'][_0x99ab('0x6c')];return db[_0x99ab('0x7c')][_0x99ab('0x3b')](_0x19c5d1,{'type':db[_0x99ab('0x7d')][_0x99ab('0x7e')]['SELECT'],'raw':!![]})['then'](function(_0x4c7afe){return _0x4c7afe;});})['then'](function(_0x3876e8){if(_0x3876e8){_0x3fe705[_0x99ab('0x28')][_0x99ab('0x7f')]=_0x3876e8[0x0];if(!_0xc88d76[_0x99ab('0x56')][_0x99ab('0x5f')])return;return db[_0x99ab('0x6e')][_0x99ab('0x53')]({'where':{'id':_0xc88d76['body'][_0x99ab('0x5f')],'role':_0x99ab('0x6f')},'attributes':['id',_0x99ab('0x35'),_0x99ab('0x80'),_0x99ab('0x70'),'internal'],'raw':!![]});}return null;})[_0x99ab('0x20')](function(_0x55f95b){if(!_0x55f95b)return null;_0x3fe705['message'][_0x99ab('0x6f')]=_0x55f95b;return _0x3fe705;})['then'](function(_0x6a1043){if(_0x6a1043){_0x6a1043['message']['interface']=util[_0x99ab('0x81')](_0x99ab('0x74'),_0xc88d76['user'][_0x99ab('0x35')]);_0x6a1043[_0x99ab('0x28')][_0x99ab('0x75')]=_0x3fe705[_0x99ab('0x75')];_0x6a1043['message'][_0x99ab('0x76')]=_0x3fe705[_0x99ab('0x75')];_0x6a1043['message'][_0x99ab('0x77')]=_0x99ab('0x33');respondWithRpcPromise(_0x99ab('0x78'),_0x99ab('0x78'),{'event':_0x99ab('0x82'),'message':_0x6a1043['message']},client9002);return _0x3fe705;}return null;})[_0x99ab('0x20')](respondWithResult(_0x18addb,null))[_0x99ab('0x4f')](handleError(_0x18addb,null));};exports['status']=function(_0x250c08,_0x483861,_0x36a0e8){if(_0x250c08['body']['id']){delete _0x250c08['body']['id'];}var _0x3aa740;return db['SmsMessage'][_0x99ab('0x53')]({'where':{'id':_0x250c08[_0x99ab('0x51')]['id']}})['then'](handleEntityNotFound(_0x483861,null))['then'](function(_0x15c015){if(_0x15c015){_0x3aa740=_0x15c015;return db[_0x99ab('0x83')][_0x99ab('0x53')]({'where':{'id':_0x15c015[_0x99ab('0x84')]}});}})[_0x99ab('0x20')](handleEntityNotFound(_0x483861,null))[_0x99ab('0x20')](function(_0xc553af){if(_0xc553af){logger['debug'](_0x99ab('0x25'),'status',_0x99ab('0x85'),_0xc553af['type'],util[_0x99ab('0x86')](_0x250c08[_0x99ab('0x56')],{'showHidden':![],'depth':null}));switch(_0xc553af[_0x99ab('0x48')]){case _0x99ab('0x87'):if(_0x250c08[_0x99ab('0x56')][_0x99ab('0x88')]&&_0x250c08[_0x99ab('0x56')][_0x99ab('0x88')]===_0x3aa740[_0x99ab('0x89')]){return _0x3aa740[_0x99ab('0x55')]({'read':!![]});}else{logger[_0x99ab('0x27')](_0x99ab('0x8a'),'status',_0x99ab('0x87'),util[_0x99ab('0x86')](_0x250c08['body'],{'showHidden':![],'depth':null}));}break;case _0x99ab('0x8b'):if(_0x250c08[_0x99ab('0x56')][_0x99ab('0x8c')]&&_0x250c08[_0x99ab('0x56')][_0x99ab('0x8c')]===_0x3aa740[_0x99ab('0x89')]&&_[_0x99ab('0x8d')](['sent','delivered'],_0x250c08[_0x99ab('0x56')][_0x99ab('0x8e')])>=0x0){return _0x3aa740[_0x99ab('0x55')]({'read':!![]});}else{logger['error'](_0x99ab('0x8a'),_0x99ab('0x2b'),_0x99ab('0x8f'),util[_0x99ab('0x86')](_0x250c08[_0x99ab('0x56')],{'showHidden':![],'depth':null}));}break;case _0x99ab('0x90'):var _0x11a60e=_0x250c08[_0x99ab('0x56')][_0x99ab('0x91')][0x0];if(_0x11a60e['status'][_0x99ab('0x92')]===_0x99ab('0x93')){return _0x3aa740[_0x99ab('0x55')]({'read':!![]});}else{logger[_0x99ab('0x27')](_0x99ab('0x8a'),_0x99ab('0x2b'),_0x99ab('0x90'),util['inspect'](_0x250c08['body'],{'showHidden':![],'depth':null}));}break;}return _0x3aa740;}})['then'](respondWithResult(_0x483861,null))[_0x99ab('0x4f')](handleError(_0x483861,null));}; \ No newline at end of file +var _0x7097=['results','groupName','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../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','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','send','index','map','SmsMessage','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','filter','includeAll','include','findAll','rows','params','keys','length','options','find','create','body','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','interface','SIP/%s','motionChannel','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','User','email','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip'];(function(_0x3ee9cc,_0x2dfe30){var _0x2040fb=function(_0xf57ed2){while(--_0xf57ed2){_0x3ee9cc['push'](_0x3ee9cc['shift']());}};_0x2040fb(++_0x2dfe30);}(_0x7097,0x1be));var _0x7709=function(_0x62916e,_0x5a2b6c){_0x62916e=_0x62916e-0x0;var _0xe1277c=_0x7097[_0x62916e];return _0xe1277c;};'use strict';var emlformat=require(_0x7709('0x0'));var rimraf=require(_0x7709('0x1'));var zipdir=require(_0x7709('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7709('0x3'));var BPromise=require(_0x7709('0x4'));var Mustache=require(_0x7709('0x5'));var util=require(_0x7709('0x6'));var path=require(_0x7709('0x7'));var sox=require('sox');var csv=require(_0x7709('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7709('0x9'));var _=require('lodash');var squel=require(_0x7709('0xa'));var crypto=require(_0x7709('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7709('0xc'));var Redis=require(_0x7709('0xd'));var authService=require(_0x7709('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7709('0xf'));var hardwareService=require(_0x7709('0x10'));var logger=require(_0x7709('0x11'))(_0x7709('0x12'));var utils=require(_0x7709('0x13'));var config=require(_0x7709('0x14'));var licenseUtil=require(_0x7709('0x15'));var db=require(_0x7709('0x16'))['db'];config[_0x7709('0x17')]=_[_0x7709('0x18')](config[_0x7709('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x7709('0x19'))(new Redis(config['redis']));require(_0x7709('0x1a'))[_0x7709('0x1b')](socket);var jayson=require(_0x7709('0x1c'));var client=jayson[_0x7709('0x1d')][_0x7709('0x1e')]({'port':0x232c});var client9002=jayson[_0x7709('0x1d')][_0x7709('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x29b2cf,_0x407632,_0x365f38,_0x361d3e){return new BPromise(function(_0x18883d,_0x55aac8){var _0x2b2090=_0x361d3e||client;return _0x2b2090[_0x7709('0x1f')](_0x29b2cf,_0x365f38)[_0x7709('0x20')](function(_0x4ea50f){logger[_0x7709('0x21')]('SmsMessage,\x20%s,\x20%s',_0x407632,'request\x20sent');logger[_0x7709('0x22')](_0x7709('0x23'),_0x407632,'request\x20sent',JSON[_0x7709('0x24')](_0x4ea50f));if(_0x4ea50f['error']){if(_0x4ea50f[_0x7709('0x25')]['code']===0x1f4){logger['error'](_0x7709('0x26'),_0x407632,_0x4ea50f[_0x7709('0x25')]['message']);return _0x55aac8(_0x4ea50f['error'][_0x7709('0x27')]);}logger['error'](_0x7709('0x26'),_0x407632,_0x4ea50f[_0x7709('0x25')][_0x7709('0x27')]);return _0x18883d(_0x4ea50f[_0x7709('0x25')][_0x7709('0x27')]);}else{logger[_0x7709('0x21')](_0x7709('0x26'),_0x407632,_0x7709('0x28'));_0x18883d(_0x4ea50f[_0x7709('0x29')][_0x7709('0x27')]);}})[_0x7709('0x2a')](function(_0x35ca8e){logger['error'](_0x7709('0x26'),_0x407632,_0x35ca8e);_0x55aac8(_0x35ca8e);});});}function respondWithStatusCode(_0x1b065b,_0x273e05){_0x273e05=_0x273e05||0xcc;return function(_0x490618){if(_0x490618){return _0x1b065b[_0x7709('0x2b')](_0x273e05);}return _0x1b065b[_0x7709('0x2c')](_0x273e05)[_0x7709('0x2d')]();};}function respondWithResult(_0x5ced5f,_0x35c0e2){_0x35c0e2=_0x35c0e2||0xc8;return function(_0x36baff){if(_0x36baff){return _0x5ced5f[_0x7709('0x2c')](_0x35c0e2)[_0x7709('0x2e')](_0x36baff);}};}function respondWithFilteredResult(_0x2fa3da,_0x379f58){return function(_0x5d473b){if(_0x5d473b){var _0x12b925=typeof _0x379f58[_0x7709('0x2f')]===_0x7709('0x30')&&typeof _0x379f58['limit']==='undefined';var _0x1d420c=_0x5d473b[_0x7709('0x31')];var _0x928391=_0x12b925?0x0:_0x379f58['offset'];var _0x4d856f=_0x12b925?_0x5d473b[_0x7709('0x31')]:_0x379f58['offset']+_0x379f58[_0x7709('0x32')];var _0x5d729b;if(_0x4d856f>=_0x1d420c){_0x4d856f=_0x1d420c;_0x5d729b=0xc8;}else{_0x5d729b=0xce;}_0x2fa3da[_0x7709('0x2c')](_0x5d729b);return _0x2fa3da[_0x7709('0x33')]('Content-Range',_0x928391+'-'+_0x4d856f+'/'+_0x1d420c)[_0x7709('0x2e')](_0x5d473b);}return null;};}function patchUpdates(_0x1a44b3){return function(_0x2da058){try{jsonpatch[_0x7709('0x34')](_0x2da058,_0x1a44b3,!![]);}catch(_0x5ab951){return BPromise[_0x7709('0x35')](_0x5ab951);}return _0x2da058['save']();};}function saveUpdates(_0x30c093,_0x24e382){return function(_0x5d6e4e){if(_0x5d6e4e){return _0x5d6e4e[_0x7709('0x36')](_0x30c093)[_0x7709('0x20')](function(_0x484ca6){return _0x484ca6;});}return null;};}function removeEntity(_0x2726a2,_0x397802){return function(_0x57c9e4){if(_0x57c9e4){return _0x57c9e4[_0x7709('0x37')]()[_0x7709('0x20')](function(){_0x2726a2[_0x7709('0x2c')](0xcc)[_0x7709('0x2d')]();});}};}function handleEntityNotFound(_0x54b54c,_0xc4685c){return function(_0x9802f3){if(!_0x9802f3){_0x54b54c['sendStatus'](0x194);}return _0x9802f3;};}function handleError(_0x154227,_0x22b68e){_0x22b68e=_0x22b68e||0x1f4;return function(_0x3f7d2a){logger[_0x7709('0x25')](_0x3f7d2a['stack']);if(_0x3f7d2a['name']){delete _0x3f7d2a['name'];}_0x154227[_0x7709('0x2c')](_0x22b68e)[_0x7709('0x38')](_0x3f7d2a);};}exports[_0x7709('0x39')]=function(_0xe7dd84,_0x5119c5){var _0x13bd52={},_0x3148d4={},_0x361cfa={'count':0x0,'rows':[]};var _0x5bf06a=_[_0x7709('0x3a')](db[_0x7709('0x3b')][_0x7709('0x3c')],function(_0x13a862){return{'name':_0x13a862['fieldName'],'type':_0x13a862[_0x7709('0x3d')][_0x7709('0x3e')]};});_0x3148d4[_0x7709('0x3f')]=_['map'](_0x5bf06a,_0x7709('0x40'));_0x3148d4[_0x7709('0x41')]=_['keys'](_0xe7dd84[_0x7709('0x41')]);_0x3148d4[_0x7709('0x42')]=_[_0x7709('0x43')](_0x3148d4[_0x7709('0x3f')],_0x3148d4['query']);_0x13bd52[_0x7709('0x44')]=_['intersection'](_0x3148d4['model'],qs[_0x7709('0x45')](_0xe7dd84[_0x7709('0x41')][_0x7709('0x45')]));_0x13bd52['attributes']=_0x13bd52[_0x7709('0x44')]['length']?_0x13bd52['attributes']:_0x3148d4['model'];if(!_0xe7dd84['query'][_0x7709('0x46')]('nolimit')){_0x13bd52[_0x7709('0x32')]=qs[_0x7709('0x32')](_0xe7dd84[_0x7709('0x41')][_0x7709('0x32')]);_0x13bd52[_0x7709('0x2f')]=qs[_0x7709('0x2f')](_0xe7dd84[_0x7709('0x41')][_0x7709('0x2f')]);}_0x13bd52[_0x7709('0x47')]=qs[_0x7709('0x48')](_0xe7dd84[_0x7709('0x41')][_0x7709('0x48')]);_0x13bd52[_0x7709('0x49')]=qs[_0x7709('0x42')](_['pick'](_0xe7dd84['query'],_0x3148d4['filters']),_0x5bf06a);if(_0xe7dd84[_0x7709('0x41')]['filter']){_0x13bd52['where']=_[_0x7709('0x4a')](_0x13bd52['where'],{'$or':_['map'](_0x5bf06a,function(_0x118079){if(_0x118079[_0x7709('0x3d')]!=='VIRTUAL'){var _0x302c78={};_0x302c78[_0x118079[_0x7709('0x40')]]={'$like':'%'+_0xe7dd84['query'][_0x7709('0x4b')]+'%'};return _0x302c78;}})});}_0x13bd52=_[_0x7709('0x4a')]({},_0x13bd52,_0xe7dd84['options']);var _0x505dd3={'where':_0x13bd52[_0x7709('0x49')]};return db[_0x7709('0x3b')]['count'](_0x505dd3)[_0x7709('0x20')](function(_0x2b8ce3){_0x361cfa[_0x7709('0x31')]=_0x2b8ce3;if(_0xe7dd84['query'][_0x7709('0x4c')]){_0x13bd52[_0x7709('0x4d')]=[{'all':!![]}];}return db['SmsMessage'][_0x7709('0x4e')](_0x13bd52);})[_0x7709('0x20')](function(_0x14ccb5){_0x361cfa[_0x7709('0x4f')]=_0x14ccb5;return _0x361cfa;})[_0x7709('0x20')](respondWithFilteredResult(_0x5119c5,_0x13bd52))[_0x7709('0x2a')](handleError(_0x5119c5,null));};exports['show']=function(_0xfa7c,_0x453bd8){var _0x525628={'raw':!![],'where':{'id':_0xfa7c[_0x7709('0x50')]['id']}},_0x4be2cd={};_0x4be2cd[_0x7709('0x3f')]=_[_0x7709('0x51')](db[_0x7709('0x3b')][_0x7709('0x3c')]);_0x4be2cd[_0x7709('0x41')]=_[_0x7709('0x51')](_0xfa7c['query']);_0x4be2cd[_0x7709('0x42')]=_['intersection'](_0x4be2cd['model'],_0x4be2cd[_0x7709('0x41')]);_0x525628[_0x7709('0x44')]=_[_0x7709('0x43')](_0x4be2cd[_0x7709('0x3f')],qs[_0x7709('0x45')](_0xfa7c[_0x7709('0x41')][_0x7709('0x45')]));_0x525628[_0x7709('0x44')]=_0x525628[_0x7709('0x44')][_0x7709('0x52')]?_0x525628[_0x7709('0x44')]:_0x4be2cd['model'];if(_0xfa7c[_0x7709('0x41')]['includeAll']){_0x525628[_0x7709('0x4d')]=[{'all':!![]}];}_0x525628=_['merge']({},_0x525628,_0xfa7c[_0x7709('0x53')]);return db[_0x7709('0x3b')][_0x7709('0x54')](_0x525628)['then'](handleEntityNotFound(_0x453bd8,null))[_0x7709('0x20')](respondWithResult(_0x453bd8,null))[_0x7709('0x2a')](handleError(_0x453bd8,null));};exports[_0x7709('0x55')]=function(_0x271ac2,_0x384384){return db[_0x7709('0x3b')][_0x7709('0x55')](_0x271ac2[_0x7709('0x56')],{})[_0x7709('0x20')](respondWithResult(_0x384384,0xc9))[_0x7709('0x2a')](handleError(_0x384384,null));};exports[_0x7709('0x36')]=function(_0x33e156,_0x164def){if(_0x33e156[_0x7709('0x56')]['id']){delete _0x33e156[_0x7709('0x56')]['id'];}return db['SmsMessage'][_0x7709('0x54')]({'where':{'id':_0x33e156[_0x7709('0x50')]['id']}})[_0x7709('0x20')](handleEntityNotFound(_0x164def,null))[_0x7709('0x20')](saveUpdates(_0x33e156[_0x7709('0x56')],null))['then'](respondWithResult(_0x164def,null))[_0x7709('0x2a')](handleError(_0x164def,null));};exports[_0x7709('0x37')]=function(_0x186daf,_0x5449ab){return db[_0x7709('0x3b')][_0x7709('0x54')]({'where':{'id':_0x186daf[_0x7709('0x50')]['id']}})['then'](handleEntityNotFound(_0x5449ab,null))[_0x7709('0x20')](removeEntity(_0x5449ab,null))[_0x7709('0x2a')](handleError(_0x5449ab,null));};exports[_0x7709('0x57')]=function(_0x567ef1,_0x578faf){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x578faf,null))['catch'](handleError(_0x578faf,null));};var interaction_log=require(_0x7709('0x11'))(_0x7709('0x58'));exports[_0x7709('0x59')]=function(_0x124e83,_0x109614,_0x50aad7){var _0x5978bc={'agent':{},'channel':_0x7709('0x5a')};if(_0x124e83[_0x7709('0x56')]['id']){delete _0x124e83['body']['id'];}_0x124e83['body'][_0x7709('0x5b')]=!![];_0x124e83['body'][_0x7709('0x5c')]=moment()['format'](_0x7709('0x5d'));_0x124e83['body']['UserId']=_0x124e83['body'][_0x7709('0x5e')]||_0x124e83['user']['id'];_0x5978bc[_0x7709('0x5f')]['id']=_0x124e83[_0x7709('0x56')][_0x7709('0x5e')];return db[_0x7709('0x3b')][_0x7709('0x54')]({'where':{'id':_0x124e83[_0x7709('0x50')]['id'],'UserId':null}})[_0x7709('0x20')](handleEntityNotFound(_0x109614,null))[_0x7709('0x20')](saveUpdates(_0x124e83[_0x7709('0x56')],null))[_0x7709('0x20')](function(_0x4d356a){if(_0x4d356a){_0x5978bc[_0x7709('0x27')]=_0x4d356a[_0x7709('0x60')]({'plain':!![]});return db[_0x7709('0x61')][_0x7709('0x54')]({'where':{'id':_0x4d356a[_0x7709('0x62')]}});}return null;})[_0x7709('0x20')](handleEntityNotFound(_0x109614,null))[_0x7709('0x20')](function(_0x2fa55a){if(_0x2fa55a){return _0x2fa55a[_0x7709('0x36')]({'UserId':_0x124e83['body']['UserId'],'read1stAt':_[_0x7709('0x63')](_0x2fa55a[_0x7709('0x64')])?moment()[_0x7709('0x65')](_0x7709('0x5d')):undefined});}return null;})[_0x7709('0x20')](function(_0x5f158d){if(_0x5f158d){_0x5978bc[_0x7709('0x66')]=_0x5f158d['get']({'plain':!![]});interaction_log[_0x7709('0x21')](_0x7709('0x67'),_0x124e83[_0x7709('0x68')]['id'],_0x124e83['user'][_0x7709('0x40')],_0x124e83[_0x7709('0x68')][_0x7709('0x69')],_0x5978bc[_0x7709('0x66')]['id'],_0x124e83[_0x7709('0x56')]?JSON[_0x7709('0x24')](_0x124e83[_0x7709('0x56')]):'null');return respondWithRpcPromise(_0x7709('0x6a'),_0x7709('0x6b'),_0x5978bc);}return null;})[_0x7709('0x20')](function(_0x45cc8d){var _0x2dad03=_0x7709('0x6c')+_0x45cc8d['message'][_0x7709('0x6d')];return db[_0x7709('0x6e')]['query'](_0x2dad03,{'type':db['Sequelize'][_0x7709('0x6f')][_0x7709('0x70')],'raw':!![]})[_0x7709('0x20')](function(_0x123e26){return _0x123e26;});})[_0x7709('0x20')](function(_0x9c6621){if(_0x9c6621){_0x5978bc[_0x7709('0x27')][_0x7709('0x71')]=_0x9c6621[0x0];if(!_0x124e83['body']['UserId'])return;return db['User'][_0x7709('0x54')]({'where':{'id':_0x124e83[_0x7709('0x56')][_0x7709('0x5e')],'role':_0x7709('0x5f')},'attributes':['id','name',_0x7709('0x72'),'email',_0x7709('0x73')],'raw':!![]});}return null;})['then'](function(_0x4248d5){if(!_0x4248d5)return null;_0x5978bc[_0x7709('0x27')]['agent']=_0x4248d5;return _0x5978bc;})[_0x7709('0x20')](function(_0x11d11c){if(_0x11d11c){if(_0x124e83[_0x7709('0x56')][_0x7709('0x74')]){_0x5978bc[_0x7709('0x27')][_0x7709('0x75')]=util[_0x7709('0x65')](_0x7709('0x76'),_0x124e83['user'][_0x7709('0x40')]);_0x5978bc[_0x7709('0x27')]['channel']=_0x5978bc['channel'];_0x5978bc['message'][_0x7709('0x77')]=_0x5978bc[_0x7709('0x78')];_0x5978bc[_0x7709('0x27')][_0x7709('0x79')]=_0x7709('0x59');return respondWithRpcPromise(_0x7709('0x7a'),_0x7709('0x7a'),{'event':_0x7709('0x7b'),'message':_0x5978bc['message']},client9002)[_0x7709('0x20')](function(){return _0x5978bc;});}return _0x5978bc;}return null;})[_0x7709('0x20')](respondWithResult(_0x109614,null))['catch'](handleError(_0x109614,null));};var interaction_log=require(_0x7709('0x11'))(_0x7709('0x58'));exports['reject']=function(_0x5ca44d,_0xfadd95,_0x11b632){var _0x4a9450={'agent':{},'channel':_0x7709('0x5a')};if(_0x5ca44d[_0x7709('0x56')]['id']){delete _0x5ca44d[_0x7709('0x56')]['id'];}_0x5ca44d['body'][_0x7709('0x5e')]=_0x5ca44d[_0x7709('0x56')][_0x7709('0x5e')]||_0x5ca44d[_0x7709('0x68')]['id'];_0x4a9450[_0x7709('0x5f')]['id']=_0x5ca44d[_0x7709('0x56')]['UserId'];return db[_0x7709('0x3b')]['find']({'where':{'id':_0x5ca44d[_0x7709('0x50')]['id'],'UserId':null}})[_0x7709('0x20')](handleEntityNotFound(_0xfadd95,null))[_0x7709('0x20')](function(_0x58adbb){if(_0x58adbb){_0x4a9450[_0x7709('0x27')]=_0x58adbb['get']({'plain':!![]});return db['SmsInteraction'][_0x7709('0x54')]({'where':{'id':_0x58adbb[_0x7709('0x62')]}});}return null;})[_0x7709('0x20')](handleEntityNotFound(_0xfadd95,null))[_0x7709('0x20')](function(_0x5d1777){if(_0x5d1777){_0x4a9450['interaction']=_0x5d1777[_0x7709('0x60')]({'plain':!![]});interaction_log[_0x7709('0x21')](_0x7709('0x7c'),_0x5ca44d[_0x7709('0x68')]['id'],_0x5ca44d[_0x7709('0x68')][_0x7709('0x40')],_0x5ca44d[_0x7709('0x68')][_0x7709('0x69')],_0x4a9450['interaction']['id'],_0x5ca44d[_0x7709('0x56')]?JSON[_0x7709('0x24')](_0x5ca44d[_0x7709('0x56')]):_0x7709('0x7d'));return respondWithRpcPromise(_0x7709('0x7e'),_0x7709('0x7f'),_0x4a9450);}return null;})[_0x7709('0x20')](function(_0x53b739){var _0x4355a4=_0x7709('0x6c')+_0x53b739[_0x7709('0x27')][_0x7709('0x6d')];return db[_0x7709('0x6e')][_0x7709('0x41')](_0x4355a4,{'type':db['Sequelize'][_0x7709('0x6f')]['SELECT'],'raw':!![]})[_0x7709('0x20')](function(_0x3dab79){return _0x3dab79;});})[_0x7709('0x20')](function(_0x2f159c){if(_0x2f159c){_0x4a9450['message']['contact']=_0x2f159c[0x0];if(!_0x5ca44d[_0x7709('0x56')][_0x7709('0x5e')])return;return db[_0x7709('0x80')][_0x7709('0x54')]({'where':{'id':_0x5ca44d[_0x7709('0x56')][_0x7709('0x5e')],'role':'agent'},'attributes':['id',_0x7709('0x40'),'fullname',_0x7709('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1ba508){if(!_0x1ba508)return null;_0x4a9450[_0x7709('0x27')][_0x7709('0x5f')]=_0x1ba508;return _0x4a9450;})[_0x7709('0x20')](function(_0x36c25f){if(_0x36c25f){_0x36c25f[_0x7709('0x27')][_0x7709('0x75')]=util[_0x7709('0x65')](_0x7709('0x76'),_0x5ca44d[_0x7709('0x68')][_0x7709('0x40')]);_0x36c25f[_0x7709('0x27')]['channel']=_0x4a9450['channel'];_0x36c25f[_0x7709('0x27')][_0x7709('0x77')]=_0x4a9450[_0x7709('0x78')];_0x36c25f[_0x7709('0x27')][_0x7709('0x79')]=_0x7709('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0x7709('0x82'),'message':_0x36c25f[_0x7709('0x27')]},client9002);return _0x4a9450;}return null;})[_0x7709('0x20')](respondWithResult(_0xfadd95,null))['catch'](handleError(_0xfadd95,null));};exports[_0x7709('0x2c')]=function(_0x1afb75,_0x132d7c,_0x395a4d){if(_0x1afb75['body']['id']){delete _0x1afb75[_0x7709('0x56')]['id'];}var _0x25adf0;return db[_0x7709('0x3b')][_0x7709('0x54')]({'where':{'id':_0x1afb75[_0x7709('0x50')]['id']}})[_0x7709('0x20')](handleEntityNotFound(_0x132d7c,null))[_0x7709('0x20')](function(_0x5928b9){if(_0x5928b9){_0x25adf0=_0x5928b9;return db[_0x7709('0x83')][_0x7709('0x54')]({'where':{'id':_0x5928b9['SmsAccountId']}});}})[_0x7709('0x20')](handleEntityNotFound(_0x132d7c,null))[_0x7709('0x20')](function(_0x1ac7eb){if(_0x1ac7eb){logger['debug'](_0x7709('0x23'),'status',_0x7709('0x84'),_0x1ac7eb[_0x7709('0x3d')],util['inspect'](_0x1afb75[_0x7709('0x56')],{'showHidden':![],'depth':null}));switch(_0x1ac7eb[_0x7709('0x3d')]){case _0x7709('0x85'):if(_0x1afb75['body'][_0x7709('0x86')]&&_0x1afb75[_0x7709('0x56')][_0x7709('0x86')]===_0x25adf0['messageId']){return _0x25adf0[_0x7709('0x36')]({'read':!![]});}else{logger[_0x7709('0x25')](_0x7709('0x87'),_0x7709('0x2c'),_0x7709('0x85'),util[_0x7709('0x88')](_0x1afb75['body'],{'showHidden':![],'depth':null}));}break;case _0x7709('0x89'):if(_0x1afb75['body'][_0x7709('0x8a')]&&_0x1afb75[_0x7709('0x56')][_0x7709('0x8a')]===_0x25adf0[_0x7709('0x8b')]&&_[_0x7709('0x8c')]([_0x7709('0x8d'),_0x7709('0x8e')],_0x1afb75[_0x7709('0x56')][_0x7709('0x8f')])>=0x0){return _0x25adf0[_0x7709('0x36')]({'read':!![]});}else{logger[_0x7709('0x25')](_0x7709('0x87'),_0x7709('0x2c'),_0x7709('0x90'),util[_0x7709('0x88')](_0x1afb75['body'],{'showHidden':![],'depth':null}));}break;case _0x7709('0x91'):var _0x784d7a=_0x1afb75[_0x7709('0x56')][_0x7709('0x92')][0x0];if(_0x784d7a[_0x7709('0x2c')][_0x7709('0x93')]==='DELIVERED'){return _0x25adf0[_0x7709('0x36')]({'read':!![]});}else{logger[_0x7709('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7709('0x2c'),_0x7709('0x91'),util['inspect'](_0x1afb75[_0x7709('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x25adf0;}})[_0x7709('0x20')](respondWithResult(_0x132d7c,null))[_0x7709('0x2a')](handleError(_0x132d7c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 02a3ee9..b31e45e 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 _0x1a9c=['events','SmsMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2a0343,_0x172988){var _0x41d2bd=function(_0x4d5bae){while(--_0x4d5bae){_0x2a0343['push'](_0x2a0343['shift']());}};_0x41d2bd(++_0x172988);}(_0x1a9c,0x1d4));var _0xc1a9=function(_0x55b006,_0x1c8b8e){_0x55b006=_0x55b006-0x0;var _0x216c91=_0x1a9c[_0x55b006];return _0x216c91;};'use strict';var EventEmitter=require(_0xc1a9('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xc1a9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc1a9('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc1a9('0x3'),'afterDestroy':_0xc1a9('0x4')};function emitEvent(_0x18ed03){return function(_0x52430d,_0x4cb9b4,_0x1cbf67){SmsMessageEvents[_0xc1a9('0x5')](_0x18ed03+':'+_0x52430d['id'],_0x52430d);SmsMessageEvents[_0xc1a9('0x5')](_0x18ed03,_0x52430d);_0x1cbf67(null);};}for(var e in events){if(events[_0xc1a9('0x6')](e)){var event=events[e];SmsMessage[_0xc1a9('0x7')](e,emitEvent(event));}}module[_0xc1a9('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xaaad=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x2f7dd5,_0x2ff089){var _0x5acbd6=function(_0x3303e6){while(--_0x3303e6){_0x2f7dd5['push'](_0x2f7dd5['shift']());}};_0x5acbd6(++_0x2ff089);}(_0xaaad,0x115));var _0xdaaa=function(_0x3f3835,_0x4ad60c){_0x3f3835=_0x3f3835-0x0;var _0x131b9c=_0xaaad[_0x3f3835];return _0x131b9c;};'use strict';var EventEmitter=require(_0xdaaa('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xdaaa('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xdaaa('0x2')](0x0);var events={'afterCreate':_0xdaaa('0x3'),'afterUpdate':'update','afterDestroy':_0xdaaa('0x4')};function emitEvent(_0x3ca04b){return function(_0x294542,_0x59af8a,_0x21a20f){SmsMessageEvents[_0xdaaa('0x5')](_0x3ca04b+':'+_0x294542['id'],_0x294542);SmsMessageEvents['emit'](_0x3ca04b,_0x294542);_0x21a20f(null);};}for(var e in events){if(events[_0xdaaa('0x6')](e)){var event=events[e];SmsMessage[_0xdaaa('0x7')](e,emitEvent(event));}}module[_0xdaaa('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d818fee..a26fea7 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 _0x07db=['Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','applicationId','bandwidth','intelepeer','application/json','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','status','refid','finally','utf8mb4','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','smsMethod','login?username=','username','&password=','GET','sms','POST','total_sent','internal_order_id','https://smsapi.connectel.se/api/v2/send/','deliveryReport','read','connectel','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','senderString','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','sender','text','keys','sort','createHash','md5','digest','signature=','id_sms'];(function(_0x3d3249,_0x4ccae1){var _0x1818df=function(_0x1a998b){while(--_0x1a998b){_0x3d3249['push'](_0x3d3249['shift']());}};_0x1818df(++_0x4ccae1);}(_0x07db,0x104));var _0xb07d=function(_0x41c842,_0x3865f6){_0x41c842=_0x41c842-0x0;var _0x15ee6b=_0x07db[_0x41c842];return _0x15ee6b;};'use strict';var _=require(_0xb07d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb07d('0x1'));var moment=require('moment');var BPromise=require(_0xb07d('0x2'));var rp=require(_0xb07d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb07d('0x4'));var config=require(_0xb07d('0x5'));var attributes=require(_0xb07d('0x6'));module[_0xb07d('0x7')]=function(_0x2f5b50,_0x459162){return _0x2f5b50['define'](_0xb07d('0x8'),attributes,{'tableName':_0xb07d('0x9'),'paranoid':![],'indexes':[{'name':_0xb07d('0xa'),'fields':[_0xb07d('0xa')]},{'name':_0xb07d('0xb'),'fields':[_0xb07d('0xc')],'type':_0xb07d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf58f4f,_0x4623ca,_0x447529){var _0x15c349=_0x2f5b50[_0xb07d('0xe')];var _0xc97ebf=_0xf58f4f[_0xb07d('0xf')]({'plain':!![]});if(_0xc97ebf['direction']['toLowerCase']()==='in'||_0xc97ebf[_0xb07d('0x10')][_0xb07d('0x11')]()===_0xb07d('0x12')&&!_0xc97ebf[_0xb07d('0x13')]&&!_[_0xb07d('0x14')](_0xc97ebf[_0xb07d('0x15')])&&!_[_0xb07d('0x14')](_0xc97ebf['SmsInteractionId'])){_0x15c349[_0xb07d('0x16')][_0xb07d('0x17')]({'where':{'id':_0xc97ebf[_0xb07d('0x18')]}})[_0xb07d('0x19')](function(_0x2506c8){if(_0x2506c8){_0x2506c8[_0xb07d('0x1a')]({'lastMsgAt':_0xc97ebf[_0xb07d('0x1b')],'lastMsgDirection':_0xc97ebf[_0xb07d('0x10')]['toLowerCase']()});}})[_0xb07d('0x1c')](function(_0x290df2){console['error'](_0x290df2);});}if(_0xc97ebf[_0xb07d('0x10')]===_0xb07d('0x12')&&!_0xc97ebf[_0xb07d('0x13')]){var _0x5eee8c;_0x15c349['SmsAccount'][_0xb07d('0x1d')]({'where':{'id':_0xc97ebf[_0xb07d('0x1e')]},'raw':!![]})[_0xb07d('0x19')](function(_0x5e9118){_0x5eee8c=_0x5e9118;if(_0x5eee8c&&_0x5eee8c[_0xb07d('0x1f')]){switch(_0x5eee8c['type']){case _0xb07d('0x20'):var _0xe411af=require(_0xb07d('0x20'));if(_0x5eee8c[_0xb07d('0x21')]&&_0x5eee8c[_0xb07d('0x22')]&&_0x5eee8c['phone']){var _0x1cca4f=new _0xe411af(_0x5eee8c[_0xb07d('0x21')],_0x5eee8c[_0xb07d('0x22')]);_0x1cca4f[_0xb07d('0x23')][_0xb07d('0x24')]({'body':_0xc97ebf['body'],'to':_0xc97ebf[_0xb07d('0x25')],'from':_0x5eee8c[_0xb07d('0x25')],'statusCallback':_0x5eee8c[_0xb07d('0x26')]+_0xb07d('0x27')+_0xc97ebf['id']+_0xb07d('0x28')+_0x5eee8c[_0xb07d('0x29')]})[_0xb07d('0x19')](function(_0x3927fe){if(_0x3927fe[_0xb07d('0x2a')]){return _0xf58f4f['update']({'messageId':_0x3927fe[_0xb07d('0x2a')]});}})['catch'](function(_0x4e931a){logger[_0xb07d('0x2b')](_0xb07d('0x2c'),'afterCreate','twilio',util[_0xb07d('0x2d')](_0x4e931a,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x20'),_0xb07d('0x2f'));}break;case _0xb07d('0x30'):var _0x1732bb=_0xb07d('0x31');if(_0x5eee8c['username']&&_0x5eee8c['password']){var _0x2142eb={'recipient':[_0xc97ebf[_0xb07d('0x25')]],'message':_0xc97ebf['body'],'message_type':_0x5eee8c[_0xb07d('0x32')]};if(_0x5eee8c[_0xb07d('0x32')]&&_0x5eee8c[_0xb07d('0x32')]!=='SI'){_0x2142eb['sender']=_0x5eee8c[_0xb07d('0x25')];}var _0x210d31={'url':_0x1732bb+_0xb07d('0x33')+_0x5eee8c[_0xb07d('0x34')]+_0xb07d('0x35')+_0x5eee8c['password'],'method':_0xb07d('0x36')};rp(_0x210d31)[_0xb07d('0x19')](function(_0x2d81a0){var _0x4f9bc1=_0x2d81a0['split'](';');var _0x36dfb1={'user_key':_0x4f9bc1[0x0],'session_key':_0x4f9bc1[0x1]};_0x210d31={'url':_0x1732bb+_0xb07d('0x37'),'method':_0xb07d('0x38'),'headers':{'user_key':_0x36dfb1['user_key'],'Session_key':_0x36dfb1['session_key']},'json':!![],'body':_0x2142eb};return rp(_0x210d31);})[_0xb07d('0x19')](function(_0x64bd6b){if(_0x64bd6b[_0xb07d('0x39')]>=0x1){var _0x4d6cf9={'messageId':_0x64bd6b[_0xb07d('0x3a')]};if(_0x5eee8c['smsMethod']!=='GP'||!_0x5eee8c['deliveryReport']){_0x4d6cf9['read']=!![];}return _0xf58f4f['update'](_0x4d6cf9);}else{return logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),'skebby',util[_0xb07d('0x2d')](_0x64bd6b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x300bc5){return logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb07d('0x30'),util[_0xb07d('0x2d')](_0x300bc5,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),'afterCreate',_0xb07d('0x30'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x5eee8c[_0xb07d('0x22')]){var _0x2efffd={'recipient':_0xc97ebf[_0xb07d('0x25')],'message':_0xc97ebf['body'],'sender':_0x5eee8c['senderString']||_0x5eee8c['phone'],'authorization':_0x5eee8c[_0xb07d('0x22')]};var _0x4623ca={'method':_0xb07d('0x38'),'uri':_0xb07d('0x3b'),'body':_0x2efffd,'json':!![]};rp(_0x4623ca)[_0xb07d('0x19')](function(_0x219192){var _0x8cc88b={'messageId':_0x219192['requestid']};if(!_0x5eee8c[_0xb07d('0x3c')]){_0x8cc88b[_0xb07d('0x3d')]=!![];}return _0xf58f4f[_0xb07d('0x1a')](_0x8cc88b);})['catch'](function(_0xe21d4d){logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x3e'),util[_0xb07d('0x2d')](_0xe21d4d,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0xb07d('0x3f'));}break;case _0xb07d('0x40'):if(_0x5eee8c[_0xb07d('0x34')]&&_0x5eee8c[_0xb07d('0x41')]){var _0x2efffd={'messages':[{'source':_0xb07d('0x42'),'to':_0xc97ebf[_0xb07d('0x25')],'body':_0xc97ebf['body'],'from':_0x5eee8c[_0xb07d('0x43')]||_0x5eee8c[_0xb07d('0x25')]}]};var _0x43cf2d=util[_0xb07d('0x44')](_0xb07d('0x45'),_0x5eee8c[_0xb07d('0x34')],_0x5eee8c[_0xb07d('0x41')]);var _0x4623ca={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x2efffd,'headers':{'Authorization':util[_0xb07d('0x44')](_0xb07d('0x46'),new Buffer(_0x43cf2d)[_0xb07d('0x47')](_0xb07d('0x48')))},'json':!![]};rp(_0x4623ca)[_0xb07d('0x19')](function(_0x504b7f){if(_0x504b7f[_0xb07d('0x49')]>=0xc8&&_0x504b7f[_0xb07d('0x49')]<=0xce){if(_0x504b7f[_0xb07d('0x4a')]&&_0x504b7f[_0xb07d('0x4a')][_0xb07d('0x4b')]>0x0){var _0x1bf067=_[_0xb07d('0x4c')](_0x504b7f[_0xb07d('0x4a')][_0xb07d('0x23')]);var _0x3dd3a7={'messageId':_0x1bf067[_0xb07d('0x4d')]};if(!_0x5eee8c[_0xb07d('0x3c')]){_0x3dd3a7['read']=!![];}return _0xf58f4f[_0xb07d('0x1a')](_0x3dd3a7);}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x4e'),util['inspect'](_0x504b7f,{'showHidden':![],'depth':null}));}}else{logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),'clickSend',util[_0xb07d('0x2d')](_0x504b7f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2655a8){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb07d('0x4e'),util[_0xb07d('0x2d')](_0x2655a8,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xb07d('0x4f'):if(_0x5eee8c['authId']&&_0x5eee8c[_0xb07d('0x22')]){var _0x2efffd={'dst':_0xc97ebf['phone'],'text':_0xc97ebf[_0xb07d('0xc')],'src':_0x5eee8c[_0xb07d('0x43')]||_0x5eee8c[_0xb07d('0x25')],'url':_0x5eee8c[_0xb07d('0x26')]+_0xb07d('0x27')+_0xc97ebf['id']+'/status?token='+_0x5eee8c['token']};var _0x43cf2d=util[_0xb07d('0x44')](_0xb07d('0x45'),_0x5eee8c[_0xb07d('0x50')],_0x5eee8c['authToken']);var _0x4623ca={'method':'POST','uri':util[_0xb07d('0x44')](_0xb07d('0x51'),_0x5eee8c['authId']),'body':_0x2efffd,'headers':{'Authorization':util[_0xb07d('0x44')](_0xb07d('0x46'),new Buffer(_0x43cf2d)['toString'](_0xb07d('0x48')))},'json':!![]};rp(_0x4623ca)[_0xb07d('0x19')](function(_0x598de5){var _0x145b77={'messageId':_0x598de5[_0xb07d('0x52')][0x0]};return _0xf58f4f['update'](_0x145b77);})[_0xb07d('0x1c')](function(_0x5c2788){logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x4f'),util[_0xb07d('0x2d')](_0x5c2788,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x4f'),_0xb07d('0x53'));}break;case _0xb07d('0x54'):if(_0x5eee8c[_0xb07d('0x34')]&&_0x5eee8c[_0xb07d('0x41')]){if(_0x5eee8c[_0xb07d('0x55')]){var _0x28832b={'method':'POST','uri':_0x5eee8c[_0xb07d('0x55')]+_0xb07d('0x56'),'body':{'username':_0x5eee8c[_0xb07d('0x34')],'password':_0x5eee8c['password']},'json':!![]};return rp(_0x28832b)[_0xb07d('0x19')](function(_0x4ca70a){var _0x576890={'method':_0xb07d('0x38'),'uri':_0x5eee8c[_0xb07d('0x55')]+_0xb07d('0x57'),'body':{'messages':[{'from':_0x5eee8c['phone'],'destinations':[{'to':_0xc97ebf[_0xb07d('0x25')]}],'text':_0xc97ebf[_0xb07d('0xc')],'notifyUrl':_0x5eee8c[_0xb07d('0x26')]+'/api/sms/messages/'+_0xc97ebf['id']+_0xb07d('0x28')+_0x5eee8c[_0xb07d('0x29')],'notifyContentType':'application/json','callbackData':_0x5eee8c[_0xb07d('0x25')]+';'+_0xc97ebf[_0xb07d('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x4ca70a[_0xb07d('0x29')]},'json':!![]};return rp(_0x576890)['then'](function(_0x3afba2){if(_0x3afba2['messages']){var _0x313017={'messageId':_0x3afba2[_0xb07d('0x23')][0x0][_0xb07d('0xa')]};if(!_0x5eee8c[_0xb07d('0x3c')]){_0x313017[_0xb07d('0x3d')]=!![];}return _0xf58f4f[_0xb07d('0x1a')](_0x313017);}else{return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),'afterCreate',_0xb07d('0x54'),util[_0xb07d('0x2d')](_0x3afba2,{'showHidden':![],'depth':null}));}});})[_0xb07d('0x1c')](function(_0x1b13dd){return logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),_0xb07d('0x54'),util['inspect'](_0x1b13dd,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),'infobip',_0xb07d('0x58'));}}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x54'),_0xb07d('0x59'));}break;case _0xb07d('0x5a'):var _0x31a178=require(_0xb07d('0x5b'));if(_0x5eee8c[_0xb07d('0x5c')]){var _0x506636={};_0x506636[_0xb07d('0x5d')]=_0x5eee8c[_0xb07d('0x34')];_0x506636[_0xb07d('0x25')]=_0xc97ebf[_0xb07d('0x25')];_0x506636[_0xb07d('0x5e')]=_0x5eee8c[_0xb07d('0x25')];_0x506636[_0xb07d('0x5f')]=_0xc97ebf[_0xb07d('0xc')];_0x506636['timestamp']=+new Date();var _0x4c3593='';var _0x3b7411='';var _0x5f2019=Object[_0xb07d('0x60')](_0x506636);_0x5f2019[_0xb07d('0x61')]();for(var _0x4dd67a=0x0;_0x4dd67a<_0x5f2019['length'];_0x4dd67a++){if(_0x4c3593!=''){_0x4c3593+='&';}_0x4c3593+=_0x5f2019[_0x4dd67a]+'='+encodeURIComponent(_0x506636[_0x5f2019[_0x4dd67a]]);_0x3b7411+=_0x506636[_0x5f2019[_0x4dd67a]];}_0x3b7411+=_0x5eee8c[_0xb07d('0x5c')];_0x3b7411=_0x31a178[_0xb07d('0x62')](_0xb07d('0x63'))['update'](_0x3b7411)[_0xb07d('0x64')]('hex');if(_0x4c3593!==''){_0x4c3593+='&';}_0x4c3593+=_0xb07d('0x65')+_0x3b7411;var _0x210d31={'method':_0xb07d('0x36'),'uri':_0x5eee8c[_0xb07d('0x55')]+'/external/get/send.php?'+_0x4c3593,'json':!![]};return rp(_0x210d31)[_0xb07d('0x19')](function(_0x4b5880){var _0x318f87=Object[_0xb07d('0x60')](_0x4b5880);if(_0x4b5880[_0x318f87[0x0]][_0xb07d('0x2b')]&&parseInt(_0x4b5880[_0x318f87[0x0]]['error'])===0x0){var _0x2ceadf={'messageId':_0x4b5880[_0x318f87[0x0]][_0xb07d('0x66')]};if(!_0x5eee8c['deliveryReport']){_0x2ceadf[_0xb07d('0x3d')]=!![];}return _0xf58f4f[_0xb07d('0x1a')](_0x2ceadf);}else{return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x5a'),util[_0xb07d('0x2d')](_0x4b5880[_0xb07d('0x2b')],{'showHidden':![],'depth':null}));}})[_0xb07d('0x1c')](function(_0x26d2c0){return logger['error'](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x5a'),util['inspect'](_0x26d2c0,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x5a'),_0xb07d('0x67'));}break;case _0xb07d('0x68'):if(_0x5eee8c[_0xb07d('0x5c')]){var _0x270b6b={'method':_0xb07d('0x38'),'uri':_0xb07d('0x69'),'headers':{'Authorization':_0x5eee8c[_0xb07d('0x5c')]},'body':{'content':_0xc97ebf[_0xb07d('0xc')],'to':[_0xc97ebf[_0xb07d('0x25')]],'from':_0x5eee8c[_0xb07d('0x25')],'binary':![],'clientMessageId':_0xb07d('0x6a'),'charset':_0xb07d('0x6b')},'json':!![]};rp(_0x270b6b)[_0xb07d('0x19')](function(_0x34f32d){if(!_0x34f32d[_0xb07d('0x2b')]){var _0x39c8ac={'messageId':_0x34f32d[_0xb07d('0x23')][0x0][_0xb07d('0x6c')]};if(!_0x5eee8c['deliveryReport']){_0x39c8ac[_0xb07d('0x3d')]=!![];}return _0xf58f4f[_0xb07d('0x1a')](_0x39c8ac);}else{return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),'clickatell',util[_0xb07d('0x2d')](_0x34f32d[_0xb07d('0x2b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x8dfc3f){return logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),_0xb07d('0x68'),util[_0xb07d('0x2d')](_0x8dfc3f,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),_0xb07d('0x68'),_0xb07d('0x67'));}break;case'bandwidth':if(_0x5eee8c[_0xb07d('0x34')]&&_0x5eee8c['password']){var _0x43cf2d=util[_0xb07d('0x44')](_0xb07d('0x45'),_0x5eee8c[_0xb07d('0x34')],_0x5eee8c[_0xb07d('0x41')]);var _0x4623ca={'method':_0xb07d('0x38'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5eee8c[_0xb07d('0x6d')]+'/messages','body':{'to':[_0xc97ebf[_0xb07d('0x25')]],'text':_0xc97ebf[_0xb07d('0xc')],'from':_0x5eee8c[_0xb07d('0x25')],'applicationId':_0x5eee8c[_0xb07d('0x6e')]},'headers':{'Authorization':util[_0xb07d('0x44')](_0xb07d('0x46'),new Buffer(_0x43cf2d)['toString'](_0xb07d('0x48')))},'json':!![]};rp(_0x4623ca)[_0xb07d('0x19')](function(_0x25e896){if(_0x25e896['id']){var _0x4d88c3={'messageId':_0x25e896['id']};return _0xf58f4f[_0xb07d('0x1a')](_0x4d88c3);}else{logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb07d('0x2e'),_0xb07d('0x6f'),util[_0xb07d('0x2d')](_0x25e896,{'showHidden':![],'depth':null}));}})[_0xb07d('0x1c')](function(_0x3d48da){logger[_0xb07d('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb07d('0x6f'),util[_0xb07d('0x2d')](_0x3d48da,{'showHidden':![],'depth':null}));});}else{logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xb07d('0x70'):if(_0x5eee8c['apiKey']){var _0x14cd0c={};var _0x210d31={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x5eee8c[_0xb07d('0x5c')],'Content-Type':_0xb07d('0x71')},'body':{'from':_0x5eee8c[_0xb07d('0x25')],'to':_0xc97ebf['phone'],'text':_0xc97ebf[_0xb07d('0xc')]},'json':!![]};return rp(_0x210d31)[_0xb07d('0x19')](function(_0x4ad571){if(_0x4ad571['code']==0xca){_0x14cd0c['message']=_0x4ad571;var _0x193664={'method':_0xb07d('0x38'),'uri':_0xb07d('0x72'),'headers':{'Authorization':_0xb07d('0x73')+_0x5eee8c[_0xb07d('0x5c')],'Content-Type':'application/json'},'body':{'refid':_0x14cd0c[_0xb07d('0x74')]['refid']},'json':!![]};return rp(_0x193664)[_0xb07d('0x19')](function(_0x22ef72){_0x14cd0c[_0xb07d('0x75')]=_0x22ef72;var _0x2471f8={'messageId':_0x14cd0c['message'][_0xb07d('0x76')],'read':!![]};return _0xf58f4f['update'](_0x2471f8);});}else{return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x70'),util['inspect'](_0x4ad571,{'showHidden':![],'depth':null}));}})['catch'](function(_0xb18d11){return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),_0xb07d('0x70'),util[_0xb07d('0x2d')](_0xb18d11,{'showHidden':![],'depth':null}));});}else{return logger[_0xb07d('0x2b')](_0xb07d('0x2c'),_0xb07d('0x2e'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xb07d('0x77')](function(){_0x447529();});}else{_0x447529();}}},'charset':_0xb07d('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x14a6=['sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','login?username=','GET','split','sms','POST','session_key','total_sent','internal_order_id','inspect','connectel','requestid','deliveryReport','Missing\x20parameters:\x20authToken','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','read','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','token','Missing\x20parameters:\x20base_url','csc','crypto','sender','text','timestamp','keys','sort','length','apiKey','md5','digest','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','refid','Token\x20not\x20received','finally','utf8mb4','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','findOne','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token='];(function(_0x1ac0b6,_0x37b48b){var _0x155f39=function(_0x55f7e8){while(--_0x55f7e8){_0x1ac0b6['push'](_0x1ac0b6['shift']());}};_0x155f39(++_0x37b48b);}(_0x14a6,0xc7));var _0x614a=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0x14a6[_0x3d90b4];return _0x4c65d3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x614a('0x0'))('api');var moment=require(_0x614a('0x1'));var BPromise=require(_0x614a('0x2'));var rp=require(_0x614a('0x3'));var fs=require('fs');var path=require(_0x614a('0x4'));var rimraf=require('rimraf');var config=require(_0x614a('0x5'));var attributes=require('./smsMessage.attributes');module[_0x614a('0x6')]=function(_0x47db87,_0x1c4e67){return _0x47db87[_0x614a('0x7')](_0x614a('0x8'),attributes,{'tableName':_0x614a('0x9'),'paranoid':![],'indexes':[{'name':_0x614a('0xa'),'fields':[_0x614a('0xa')]},{'name':_0x614a('0xb'),'fields':[_0x614a('0xc')],'type':_0x614a('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x116dca,_0x12747a,_0x3ca4ec){var _0x4b5aff=_0x47db87[_0x614a('0xe')];var _0xf77d15=_0x116dca[_0x614a('0xf')]({'plain':!![]});if(_0xf77d15['direction']['toLowerCase']()==='in'||_0xf77d15[_0x614a('0x10')][_0x614a('0x11')]()===_0x614a('0x12')&&!_0xf77d15[_0x614a('0x13')]&&!_[_0x614a('0x14')](_0xf77d15['UserId'])&&!_[_0x614a('0x14')](_0xf77d15[_0x614a('0x15')])){_0x4b5aff['SmsInteraction'][_0x614a('0x16')]({'where':{'id':_0xf77d15[_0x614a('0x15')]}})[_0x614a('0x17')](function(_0x11ed49){if(_0x11ed49){_0x11ed49[_0x614a('0x18')]({'lastMsgAt':_0xf77d15[_0x614a('0x19')],'lastMsgDirection':_0xf77d15[_0x614a('0x10')][_0x614a('0x11')]()});}})[_0x614a('0x1a')](function(_0x36b0db){console[_0x614a('0x1b')](_0x36b0db);});}if(_0xf77d15['direction']===_0x614a('0x12')&&!_0xf77d15[_0x614a('0x13')]){var _0x2f8bc1;_0x4b5aff[_0x614a('0x1c')][_0x614a('0x1d')]({'where':{'id':_0xf77d15[_0x614a('0x1e')]},'raw':!![]})[_0x614a('0x17')](function(_0x28e3c8){_0x2f8bc1=_0x28e3c8;if(_0x2f8bc1&&_0x2f8bc1['type']){switch(_0x2f8bc1[_0x614a('0x1f')]){case'twilio':var _0x45b3e0=require(_0x614a('0x20'));if(_0x2f8bc1[_0x614a('0x21')]&&_0x2f8bc1[_0x614a('0x22')]&&_0x2f8bc1['phone']){var _0x457124=new _0x45b3e0(_0x2f8bc1['accountSid'],_0x2f8bc1[_0x614a('0x22')]);_0x457124[_0x614a('0x23')][_0x614a('0x24')]({'body':_0xf77d15[_0x614a('0xc')],'to':_0xf77d15[_0x614a('0x25')],'from':_0x2f8bc1[_0x614a('0x25')],'statusCallback':_0x2f8bc1[_0x614a('0x26')]+_0x614a('0x27')+_0xf77d15['id']+_0x614a('0x28')+_0x2f8bc1['token']})[_0x614a('0x17')](function(_0xaf956c){if(_0xaf956c[_0x614a('0x29')]){return _0x116dca['update']({'messageId':_0xaf956c[_0x614a('0x29')]});}})[_0x614a('0x1a')](function(_0x21e8de){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x614a('0x20'),util['inspect'](_0x21e8de,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x20'),_0x614a('0x2c'));}break;case _0x614a('0x2d'):var _0x4c73d3='https://api.skebby.it/API/v1.0/REST/';if(_0x2f8bc1[_0x614a('0x2e')]&&_0x2f8bc1[_0x614a('0x2f')]){var _0x4ebf01={'recipient':[_0xf77d15[_0x614a('0x25')]],'message':_0xf77d15[_0x614a('0xc')],'message_type':_0x2f8bc1[_0x614a('0x30')]};if(_0x2f8bc1[_0x614a('0x30')]&&_0x2f8bc1[_0x614a('0x30')]!=='SI'){_0x4ebf01['sender']=_0x2f8bc1['phone'];}var _0x3580b9={'url':_0x4c73d3+_0x614a('0x31')+_0x2f8bc1[_0x614a('0x2e')]+'&password='+_0x2f8bc1['password'],'method':_0x614a('0x32')};rp(_0x3580b9)[_0x614a('0x17')](function(_0x19b78c){var _0x137b71=_0x19b78c[_0x614a('0x33')](';');var _0xd7072a={'user_key':_0x137b71[0x0],'session_key':_0x137b71[0x1]};_0x3580b9={'url':_0x4c73d3+_0x614a('0x34'),'method':_0x614a('0x35'),'headers':{'user_key':_0xd7072a['user_key'],'Session_key':_0xd7072a[_0x614a('0x36')]},'json':!![],'body':_0x4ebf01};return rp(_0x3580b9);})[_0x614a('0x17')](function(_0x5746fa){if(_0x5746fa[_0x614a('0x37')]>=0x1){var _0x503ee2={'messageId':_0x5746fa[_0x614a('0x38')]};if(_0x2f8bc1['smsMethod']!=='GP'||!_0x2f8bc1['deliveryReport']){_0x503ee2['read']=!![];}return _0x116dca['update'](_0x503ee2);}else{return logger[_0x614a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x614a('0x2b'),_0x614a('0x2d'),util[_0x614a('0x39')](_0x5746fa,{'showHidden':![],'depth':null}));}})[_0x614a('0x1a')](function(_0x2a37c8){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x614a('0x2d'),util['inspect'](_0x2a37c8,{'showHidden':![],'depth':null}));});}else{logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0x614a('0x3a'):if(_0x2f8bc1[_0x614a('0x22')]){var _0x55e2f3={'recipient':_0xf77d15['phone'],'message':_0xf77d15['body'],'sender':_0x2f8bc1['senderString']||_0x2f8bc1[_0x614a('0x25')],'authorization':_0x2f8bc1[_0x614a('0x22')]};var _0x12747a={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x55e2f3,'json':!![]};rp(_0x12747a)[_0x614a('0x17')](function(_0x265e38){var _0x5cb7a8={'messageId':_0x265e38[_0x614a('0x3b')]};if(!_0x2f8bc1[_0x614a('0x3c')]){_0x5cb7a8['read']=!![];}return _0x116dca[_0x614a('0x18')](_0x5cb7a8);})[_0x614a('0x1a')](function(_0x2e610f){logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x3a'),util[_0x614a('0x39')](_0x2e610f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x3a'),_0x614a('0x3d'));}break;case'clicksend':if(_0x2f8bc1[_0x614a('0x2e')]&&_0x2f8bc1[_0x614a('0x2f')]){var _0x55e2f3={'messages':[{'source':'xCALLY\x20Motion','to':_0xf77d15[_0x614a('0x25')],'body':_0xf77d15[_0x614a('0xc')],'from':_0x2f8bc1[_0x614a('0x3e')]||_0x2f8bc1[_0x614a('0x25')]}]};var _0x4010f9=util[_0x614a('0x3f')](_0x614a('0x40'),_0x2f8bc1[_0x614a('0x2e')],_0x2f8bc1[_0x614a('0x2f')]);var _0x12747a={'method':'POST','uri':_0x614a('0x41'),'body':_0x55e2f3,'headers':{'Authorization':util[_0x614a('0x3f')]('Basic\x20%s',new Buffer(_0x4010f9)[_0x614a('0x42')]('base64'))},'json':!![]};rp(_0x12747a)[_0x614a('0x17')](function(_0x440c55){if(_0x440c55[_0x614a('0x43')]>=0xc8&&_0x440c55[_0x614a('0x43')]<=0xce){if(_0x440c55[_0x614a('0x44')]&&_0x440c55['data'][_0x614a('0x45')]>0x0){var _0x57e0d8=_[_0x614a('0x46')](_0x440c55['data'][_0x614a('0x23')]);var _0x1514c8={'messageId':_0x57e0d8[_0x614a('0x47')]};if(!_0x2f8bc1[_0x614a('0x3c')]){_0x1514c8[_0x614a('0x48')]=!![];}return _0x116dca[_0x614a('0x18')](_0x1514c8);}else{logger[_0x614a('0x1b')](_0x614a('0x2a'),'afterCreate',_0x614a('0x49'),util[_0x614a('0x39')](_0x440c55,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x49'),util[_0x614a('0x39')](_0x440c55,{'showHidden':![],'depth':null}));}})[_0x614a('0x1a')](function(_0x7670e6){logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),'clickSend',util[_0x614a('0x39')](_0x7670e6,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x614a('0x2a'),'afterCreate',_0x614a('0x49'),_0x614a('0x4a'));}break;case _0x614a('0x4b'):if(_0x2f8bc1[_0x614a('0x4c')]&&_0x2f8bc1[_0x614a('0x22')]){var _0x55e2f3={'dst':_0xf77d15[_0x614a('0x25')],'text':_0xf77d15[_0x614a('0xc')],'src':_0x2f8bc1[_0x614a('0x3e')]||_0x2f8bc1[_0x614a('0x25')],'url':_0x2f8bc1[_0x614a('0x26')]+_0x614a('0x27')+_0xf77d15['id']+'/status?token='+_0x2f8bc1['token']};var _0x4010f9=util[_0x614a('0x3f')](_0x614a('0x40'),_0x2f8bc1[_0x614a('0x4c')],_0x2f8bc1[_0x614a('0x22')]);var _0x12747a={'method':_0x614a('0x35'),'uri':util[_0x614a('0x3f')](_0x614a('0x4d'),_0x2f8bc1[_0x614a('0x4c')]),'body':_0x55e2f3,'headers':{'Authorization':util[_0x614a('0x3f')](_0x614a('0x4e'),new Buffer(_0x4010f9)[_0x614a('0x42')](_0x614a('0x4f')))},'json':!![]};rp(_0x12747a)['then'](function(_0x14664e){var _0x1d66e5={'messageId':_0x14664e[_0x614a('0x50')][0x0]};return _0x116dca[_0x614a('0x18')](_0x1d66e5);})[_0x614a('0x1a')](function(_0x201f11){logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x4b'),util[_0x614a('0x39')](_0x201f11,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x4b'),_0x614a('0x51'));}break;case _0x614a('0x52'):if(_0x2f8bc1['username']&&_0x2f8bc1[_0x614a('0x2f')]){if(_0x2f8bc1[_0x614a('0x53')]){var _0x25e7a3={'method':_0x614a('0x35'),'uri':_0x2f8bc1[_0x614a('0x53')]+'/auth/1/session','body':{'username':_0x2f8bc1[_0x614a('0x2e')],'password':_0x2f8bc1['password']},'json':!![]};return rp(_0x25e7a3)[_0x614a('0x17')](function(_0x41769d){var _0x59ae06={'method':_0x614a('0x35'),'uri':_0x2f8bc1[_0x614a('0x53')]+_0x614a('0x54'),'body':{'messages':[{'from':_0x2f8bc1[_0x614a('0x25')],'destinations':[{'to':_0xf77d15[_0x614a('0x25')]}],'text':_0xf77d15[_0x614a('0xc')],'notifyUrl':_0x2f8bc1['remote']+_0x614a('0x27')+_0xf77d15['id']+_0x614a('0x28')+_0x2f8bc1['token'],'notifyContentType':_0x614a('0x55'),'callbackData':_0x2f8bc1[_0x614a('0x25')]+';'+_0xf77d15[_0x614a('0xc')]}]},'headers':{'Authorization':_0x614a('0x56')+_0x41769d[_0x614a('0x57')]},'json':!![]};return rp(_0x59ae06)[_0x614a('0x17')](function(_0x5d1fc2){if(_0x5d1fc2[_0x614a('0x23')]){var _0x15e644={'messageId':_0x5d1fc2[_0x614a('0x23')][0x0][_0x614a('0xa')]};if(!_0x2f8bc1[_0x614a('0x3c')]){_0x15e644[_0x614a('0x48')]=!![];}return _0x116dca[_0x614a('0x18')](_0x15e644);}else{return logger[_0x614a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x614a('0x2b'),'infobip',util[_0x614a('0x39')](_0x5d1fc2,{'showHidden':![],'depth':null}));}});})[_0x614a('0x1a')](function(_0x13d159){return logger[_0x614a('0x1b')](_0x614a('0x2a'),'afterCreate',_0x614a('0x52'),util[_0x614a('0x39')](_0x13d159,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x52'),_0x614a('0x58'));}}else{logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x614a('0x59'):var _0x2f2629=require(_0x614a('0x5a'));if(_0x2f8bc1['apiKey']){var _0x1a03fa={};_0x1a03fa['login']=_0x2f8bc1[_0x614a('0x2e')];_0x1a03fa[_0x614a('0x25')]=_0xf77d15['phone'];_0x1a03fa[_0x614a('0x5b')]=_0x2f8bc1['phone'];_0x1a03fa[_0x614a('0x5c')]=_0xf77d15['body'];_0x1a03fa[_0x614a('0x5d')]=+new Date();var _0x32d825='';var _0x110201='';var _0x623173=Object[_0x614a('0x5e')](_0x1a03fa);_0x623173[_0x614a('0x5f')]();for(var _0x20ca3c=0x0;_0x20ca3c<_0x623173[_0x614a('0x60')];_0x20ca3c++){if(_0x32d825!=''){_0x32d825+='&';}_0x32d825+=_0x623173[_0x20ca3c]+'='+encodeURIComponent(_0x1a03fa[_0x623173[_0x20ca3c]]);_0x110201+=_0x1a03fa[_0x623173[_0x20ca3c]];}_0x110201+=_0x2f8bc1[_0x614a('0x61')];_0x110201=_0x2f2629['createHash'](_0x614a('0x62'))[_0x614a('0x18')](_0x110201)[_0x614a('0x63')]('hex');if(_0x32d825!==''){_0x32d825+='&';}_0x32d825+=_0x614a('0x64')+_0x110201;var _0x3580b9={'method':'GET','uri':_0x2f8bc1['baseUrl']+_0x614a('0x65')+_0x32d825,'json':!![]};return rp(_0x3580b9)['then'](function(_0x85150e){var _0x25e90b=Object[_0x614a('0x5e')](_0x85150e);if(_0x85150e[_0x25e90b[0x0]]['error']&&parseInt(_0x85150e[_0x25e90b[0x0]][_0x614a('0x1b')])===0x0){var _0xb0da2={'messageId':_0x85150e[_0x25e90b[0x0]]['id_sms']};if(!_0x2f8bc1[_0x614a('0x3c')]){_0xb0da2[_0x614a('0x48')]=!![];}return _0x116dca[_0x614a('0x18')](_0xb0da2);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x614a('0x2b'),_0x614a('0x59'),util[_0x614a('0x39')](_0x85150e['error'],{'showHidden':![],'depth':null}));}})[_0x614a('0x1a')](function(_0x43edec){return logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x59'),util[_0x614a('0x39')](_0x43edec,{'showHidden':![],'depth':null}));});}else{logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x59'),_0x614a('0x66'));}break;case _0x614a('0x67'):if(_0x2f8bc1[_0x614a('0x61')]){var _0x34c817={'method':_0x614a('0x35'),'uri':_0x614a('0x68'),'headers':{'Authorization':_0x2f8bc1[_0x614a('0x61')]},'body':{'content':_0xf77d15[_0x614a('0xc')],'to':[_0xf77d15[_0x614a('0x25')]],'from':_0x2f8bc1['phone'],'binary':![],'clientMessageId':_0x614a('0x69'),'charset':_0x614a('0x6a')},'json':!![]};rp(_0x34c817)[_0x614a('0x17')](function(_0x1bdfe2){if(!_0x1bdfe2[_0x614a('0x1b')]){var _0x5a66e6={'messageId':_0x1bdfe2[_0x614a('0x23')][0x0][_0x614a('0x6b')]};if(!_0x2f8bc1['deliveryReport']){_0x5a66e6[_0x614a('0x48')]=!![];}return _0x116dca[_0x614a('0x18')](_0x5a66e6);}else{return logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),'clickatell',util[_0x614a('0x39')](_0x1bdfe2[_0x614a('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x17131b){return logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x67'),util[_0x614a('0x39')](_0x17131b,{'showHidden':![],'depth':null}));});}else{logger[_0x614a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x614a('0x67'),_0x614a('0x66'));}break;case'bandwidth':if(_0x2f8bc1[_0x614a('0x2e')]&&_0x2f8bc1[_0x614a('0x2f')]){var _0x4010f9=util[_0x614a('0x3f')](_0x614a('0x40'),_0x2f8bc1['username'],_0x2f8bc1[_0x614a('0x2f')]);var _0x12747a={'method':_0x614a('0x35'),'uri':_0x614a('0x6c')+_0x2f8bc1[_0x614a('0x6d')]+_0x614a('0x6e'),'body':{'to':[_0xf77d15[_0x614a('0x25')]],'text':_0xf77d15[_0x614a('0xc')],'from':_0x2f8bc1['phone'],'applicationId':_0x2f8bc1['applicationId']},'headers':{'Authorization':util[_0x614a('0x3f')](_0x614a('0x4e'),new Buffer(_0x4010f9)['toString']('base64'))},'json':!![]};rp(_0x12747a)[_0x614a('0x17')](function(_0x1df28c){if(_0x1df28c['id']){var _0x2f3420={'messageId':_0x1df28c['id']};return _0x116dca[_0x614a('0x18')](_0x2f3420);}else{logger[_0x614a('0x1b')](_0x614a('0x2a'),'afterCreate',_0x614a('0x6f'),util[_0x614a('0x39')](_0x1df28c,{'showHidden':![],'depth':null}));}})[_0x614a('0x1a')](function(_0xd05782){logger['error'](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x6f'),util[_0x614a('0x39')](_0xd05782,{'showHidden':![],'depth':null}));});}else{logger[_0x614a('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x614a('0x2b'),_0x614a('0x6f'),_0x614a('0x4a'));}break;case _0x614a('0x70'):if(_0x2f8bc1['apiKey']){var _0x3edb49={};var _0x3580b9={'method':_0x614a('0x35'),'uri':_0x614a('0x71'),'headers':{'Authorization':_0x614a('0x72')+_0x2f8bc1[_0x614a('0x61')],'Content-Type':_0x614a('0x55')},'body':{'from':_0x2f8bc1[_0x614a('0x25')],'to':_0xf77d15[_0x614a('0x25')],'text':_0xf77d15[_0x614a('0xc')]},'json':!![]};return rp(_0x3580b9)[_0x614a('0x17')](function(_0x100d38){if(_0x100d38['code']==0xca){_0x3edb49['message']=_0x100d38;var _0x1997f8={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x614a('0x72')+_0x2f8bc1[_0x614a('0x61')],'Content-Type':_0x614a('0x55')},'body':{'refid':_0x3edb49[_0x614a('0x73')][_0x614a('0x74')]},'json':!![]};return rp(_0x1997f8)[_0x614a('0x17')](function(_0x51c10b){_0x3edb49['status']=_0x51c10b;var _0x2c9dd1={'messageId':_0x3edb49['message'][_0x614a('0x74')],'read':!![]};return _0x116dca['update'](_0x2c9dd1);});}else{return logger[_0x614a('0x1b')](_0x614a('0x2a'),'afterCreate',_0x614a('0x70'),util[_0x614a('0x39')](_0x100d38,{'showHidden':![],'depth':null}));}})[_0x614a('0x1a')](function(_0x4c9d66){return logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x70'),util[_0x614a('0x39')](_0x4c9d66,{'showHidden':![],'depth':null}));});}else{return logger[_0x614a('0x1b')](_0x614a('0x2a'),_0x614a('0x2b'),_0x614a('0x70'),_0x614a('0x75'));}break;}}})[_0x614a('0x76')](function(){_0x3ca4ec();});}else{_0x3ca4ec();}}},'charset':_0x614a('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 398436a..3784bf7 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 _0xd597=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','catch','CreateSmsMessage','SmsMessage','body','options','raw','debug'];(function(_0x114665,_0x1ba9c6){var _0x46a514=function(_0x36d2b0){while(--_0x36d2b0){_0x114665['push'](_0x114665['shift']());}};_0x46a514(++_0x1ba9c6);}(_0xd597,0x197));var _0x7d59=function(_0x521f48,_0x5e66e8){_0x521f48=_0x521f48-0x0;var _0x5ef07f=_0xd597[_0x521f48];return _0x5ef07f;};'use strict';var _=require(_0x7d59('0x0'));var util=require(_0x7d59('0x1'));var moment=require(_0x7d59('0x2'));var BPromise=require(_0x7d59('0x3'));var rs=require(_0x7d59('0x4'));var fs=require('fs');var Redis=require(_0x7d59('0x5'));var db=require(_0x7d59('0x6'))['db'];var utils=require(_0x7d59('0x7'));var logger=require(_0x7d59('0x8'))(_0x7d59('0x9'));var config=require(_0x7d59('0xa'));var jayson=require(_0x7d59('0xb'));var client=jayson[_0x7d59('0xc')][_0x7d59('0xd')]({'port':0x232a});config[_0x7d59('0xe')]=_[_0x7d59('0xf')](config[_0x7d59('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x7d59('0x10'))(new Redis(config[_0x7d59('0xe')]));require(_0x7d59('0x11'))[_0x7d59('0x12')](socket);function respondWithRpcPromise(_0x467534,_0x3fcafe,_0x45c82e){return new BPromise(function(_0x468e59,_0x22a618){return client[_0x7d59('0x13')](_0x467534,_0x45c82e)[_0x7d59('0x14')](function(_0x285623){logger[_0x7d59('0x15')]('SmsMessage,\x20%s,\x20%s',_0x3fcafe,_0x7d59('0x16'));logger['debug'](_0x7d59('0x17'),_0x3fcafe,_0x7d59('0x16'),JSON[_0x7d59('0x18')](_0x285623));if(_0x285623[_0x7d59('0x19')]){if(_0x285623[_0x7d59('0x19')][_0x7d59('0x1a')]===0x1f4){logger[_0x7d59('0x19')]('SmsMessage,\x20%s,\x20%s',_0x3fcafe,_0x285623[_0x7d59('0x19')][_0x7d59('0x1b')]);return _0x22a618(_0x285623['error'][_0x7d59('0x1b')]);}logger[_0x7d59('0x19')](_0x7d59('0x1c'),_0x3fcafe,_0x285623['error']['message']);return _0x468e59(_0x285623[_0x7d59('0x19')][_0x7d59('0x1b')]);}else{logger[_0x7d59('0x15')]('SmsMessage,\x20%s,\x20%s',_0x3fcafe,_0x7d59('0x16'));_0x468e59(_0x285623[_0x7d59('0x1d')]['message']);}})[_0x7d59('0x1e')](function(_0x2b820d){logger[_0x7d59('0x19')](_0x7d59('0x1c'),_0x3fcafe,_0x2b820d);_0x22a618(_0x2b820d);});});}exports[_0x7d59('0x1f')]=function(_0x3d5a71){var _0x2d1b77=this;return new Promise(function(_0x4c46df,_0x345b9c){return db[_0x7d59('0x20')]['create'](_0x3d5a71[_0x7d59('0x21')],{'raw':_0x3d5a71[_0x7d59('0x22')]?_0x3d5a71['options'][_0x7d59('0x23')]===undefined?!![]:![]:!![]})[_0x7d59('0x14')](function(_0x41edf6){logger[_0x7d59('0x15')](_0x7d59('0x1f'),_0x3d5a71);logger[_0x7d59('0x24')]('CreateSmsMessage',_0x3d5a71,JSON[_0x7d59('0x18')](_0x41edf6));_0x4c46df(_0x41edf6);})['catch'](function(_0x5ad5f4){logger[_0x7d59('0x19')](_0x7d59('0x1f'),_0x5ad5f4[_0x7d59('0x1b')],_0x3d5a71);_0x345b9c(_0x2d1b77[_0x7d59('0x19')](0x1f4,_0x5ad5f4[_0x7d59('0x1b')]));});});}; \ No newline at end of file +var _0x86bb=['code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xc4d6bd,_0x569f98){var _0x37d365=function(_0x2af42c){while(--_0x2af42c){_0xc4d6bd['push'](_0xc4d6bd['shift']());}};_0x37d365(++_0x569f98);}(_0x86bb,0xb9));var _0xb86b=function(_0x4f1ee6,_0x3a0ac1){_0x4f1ee6=_0x4f1ee6-0x0;var _0x331ef3=_0x86bb[_0x4f1ee6];return _0x331ef3;};'use strict';var _=require(_0xb86b('0x0'));var util=require(_0xb86b('0x1'));var moment=require(_0xb86b('0x2'));var BPromise=require(_0xb86b('0x3'));var rs=require(_0xb86b('0x4'));var fs=require('fs');var Redis=require(_0xb86b('0x5'));var db=require(_0xb86b('0x6'))['db'];var utils=require(_0xb86b('0x7'));var logger=require(_0xb86b('0x8'))('rpc');var config=require(_0xb86b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb86b('0xa')][_0xb86b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb86b('0xc')],{'host':_0xb86b('0xd'),'port':0x18eb});var socket=require(_0xb86b('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xb86b('0xf')](socket);function respondWithRpcPromise(_0x52c9a4,_0x370218,_0x5c5f56){return new BPromise(function(_0x472f84,_0x2aafb1){return client[_0xb86b('0x10')](_0x52c9a4,_0x5c5f56)[_0xb86b('0x11')](function(_0x450119){logger[_0xb86b('0x12')](_0xb86b('0x13'),_0x370218,_0xb86b('0x14'));logger[_0xb86b('0x15')](_0xb86b('0x16'),_0x370218,'request\x20sent',JSON[_0xb86b('0x17')](_0x450119));if(_0x450119['error']){if(_0x450119[_0xb86b('0x18')][_0xb86b('0x19')]===0x1f4){logger[_0xb86b('0x18')](_0xb86b('0x13'),_0x370218,_0x450119[_0xb86b('0x18')][_0xb86b('0x1a')]);return _0x2aafb1(_0x450119['error'][_0xb86b('0x1a')]);}logger['error'](_0xb86b('0x13'),_0x370218,_0x450119[_0xb86b('0x18')][_0xb86b('0x1a')]);return _0x472f84(_0x450119[_0xb86b('0x18')][_0xb86b('0x1a')]);}else{logger[_0xb86b('0x12')](_0xb86b('0x13'),_0x370218,_0xb86b('0x14'));_0x472f84(_0x450119[_0xb86b('0x1b')]['message']);}})[_0xb86b('0x1c')](function(_0x5e35e5){logger[_0xb86b('0x18')](_0xb86b('0x13'),_0x370218,_0x5e35e5);_0x2aafb1(_0x5e35e5);});});}exports[_0xb86b('0x1d')]=function(_0x2c9073){var _0x145ed2=this;return new Promise(function(_0x73010d,_0x3f0f1a){return db[_0xb86b('0x1e')][_0xb86b('0x1f')](_0x2c9073[_0xb86b('0x20')],{'raw':_0x2c9073['options']?_0x2c9073[_0xb86b('0x21')][_0xb86b('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x2e2343){logger[_0xb86b('0x12')](_0xb86b('0x1d'),_0x2c9073);logger[_0xb86b('0x15')](_0xb86b('0x1d'),_0x2c9073,JSON[_0xb86b('0x17')](_0x2e2343));_0x73010d(_0x2e2343);})[_0xb86b('0x1c')](function(_0x5546a0){logger[_0xb86b('0x18')](_0xb86b('0x1d'),_0x5546a0[_0xb86b('0x1a')],_0x2c9073);_0x3f0f1a(_0x145ed2[_0xb86b('0x18')](0x1f4,_0x5546a0[_0xb86b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index b3e8620..36fa32e 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 _0x2568=['smsMessage:','save','remove','update','emit','removeListener','length'];(function(_0x1fe188,_0x11e1df){var _0x1b3e93=function(_0x5203a4){while(--_0x5203a4){_0x1fe188['push'](_0x1fe188['shift']());}};_0x1b3e93(++_0x11e1df);}(_0x2568,0x1a5));var _0x8256=function(_0x192cf9,_0x92f709){_0x192cf9=_0x192cf9-0x0;var _0x3480dd=_0x2568[_0x192cf9];return _0x3480dd;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x8256('0x0'),_0x8256('0x1'),_0x8256('0x2')];function createListener(_0x5e5f58,_0x4ca0b2){return function(_0x4a55e0){_0x4ca0b2[_0x8256('0x3')](_0x5e5f58,_0x4a55e0);};}function removeListener(_0x3c59f6,_0x3f1aa7){return function(){SmsMessageEvents[_0x8256('0x4')](_0x3c59f6,_0x3f1aa7);};}exports['register']=function(_0x51b0af){for(var _0xf2fb60=0x0,_0x1a771a=events[_0x8256('0x5')];_0xf2fb60<_0x1a771a;_0xf2fb60++){var _0x9d9412=events[_0xf2fb60];var _0x28a773=createListener(_0x8256('0x6')+_0x9d9412,_0x51b0af);SmsMessageEvents['on'](_0x9d9412,_0x28a773);}}; \ No newline at end of file +var _0xf94a=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x36b18a,_0x247ff5){var _0x13706b=function(_0x4d2a63){while(--_0x4d2a63){_0x36b18a['push'](_0x36b18a['shift']());}};_0x13706b(++_0x247ff5);}(_0xf94a,0x17c));var _0xaf94=function(_0x393839,_0x27a377){_0x393839=_0x393839-0x0;var _0x111e02=_0xf94a[_0x393839];return _0x111e02;};'use strict';var SmsMessageEvents=require(_0xaf94('0x0'));var events=[_0xaf94('0x1'),_0xaf94('0x2'),'update'];function createListener(_0x5b226f,_0x1c6add){return function(_0x37ae33){_0x1c6add[_0xaf94('0x3')](_0x5b226f,_0x37ae33);};}function removeListener(_0x450700,_0x437745){return function(){SmsMessageEvents[_0xaf94('0x4')](_0x450700,_0x437745);};}exports[_0xaf94('0x5')]=function(_0x50c518){for(var _0x1cccda=0x0,_0x35b4c1=events[_0xaf94('0x6')];_0x1cccda<_0x35b4c1;_0x1cccda++){var _0x27b418=events[_0x1cccda];var _0x5e8624=createListener(_0xaf94('0x7')+_0x27b418,_0x50c518);SmsMessageEvents['on'](_0x27b418,_0x5e8624);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 91a01c9..10c2c37 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 _0x42a2=['put','/:id','update','destroy','delete','removeTeams','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x42a2,0x1b9));var _0x242a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x42a2[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0x242a('0x0'));var util=require(_0x242a('0x1'));var path=require('path');var timeout=require(_0x242a('0x2'));var express=require(_0x242a('0x3'));var router=express[_0x242a('0x4')]();var fs_extra=require(_0x242a('0x5'));var auth=require(_0x242a('0x6'));var interaction=require(_0x242a('0x7'));var config=require(_0x242a('0x8'));var controller=require(_0x242a('0x9'));router[_0x242a('0xa')]('/',auth[_0x242a('0xb')](),controller[_0x242a('0xc')]);router['get'](_0x242a('0xd'),auth[_0x242a('0xb')](),controller[_0x242a('0xe')]);router[_0x242a('0xa')]('/:id',auth[_0x242a('0xb')](),controller[_0x242a('0xf')]);router['get'](_0x242a('0x10'),auth[_0x242a('0xb')](),controller['getMembers']);router[_0x242a('0xa')]('/:id/teams',auth[_0x242a('0xb')](),controller[_0x242a('0x11')]);router['get'](_0x242a('0x12'),auth[_0x242a('0xb')](),controller[_0x242a('0x13')]);router[_0x242a('0x14')]('/',auth[_0x242a('0xb')](),controller[_0x242a('0x15')]);router[_0x242a('0x14')](_0x242a('0x16'),auth[_0x242a('0xb')](),controller[_0x242a('0x17')]);router[_0x242a('0x14')](_0x242a('0x12'),auth[_0x242a('0xb')](),controller['addAgents']);router[_0x242a('0x18')](_0x242a('0x19'),auth[_0x242a('0xb')](),controller[_0x242a('0x1a')]);router['delete'](_0x242a('0x19'),auth['isAuthenticated'](),controller[_0x242a('0x1b')]);router[_0x242a('0x1c')](_0x242a('0x16'),auth[_0x242a('0xb')](),controller[_0x242a('0x1d')]);router[_0x242a('0x1c')](_0x242a('0x12'),auth[_0x242a('0xb')](),controller[_0x242a('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xe2e5=['../../config/environment','./smsQueue.controller','get','index','/describe','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x458fb3,_0x5dd915){var _0x233fac=function(_0x507747){while(--_0x507747){_0x458fb3['push'](_0x458fb3['shift']());}};_0x233fac(++_0x5dd915);}(_0xe2e5,0x1a3));var _0x5e2e=function(_0x4b9f25,_0x541580){_0x4b9f25=_0x4b9f25-0x0;var _0x12710e=_0xe2e5[_0x4b9f25];return _0x12710e;};'use strict';var multer=require(_0x5e2e('0x0'));var util=require('util');var path=require(_0x5e2e('0x1'));var timeout=require(_0x5e2e('0x2'));var express=require(_0x5e2e('0x3'));var router=express[_0x5e2e('0x4')]();var fs_extra=require(_0x5e2e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e2e('0x6'));var controller=require(_0x5e2e('0x7'));router[_0x5e2e('0x8')]('/',auth['isAuthenticated'](),controller[_0x5e2e('0x9')]);router[_0x5e2e('0x8')](_0x5e2e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5e2e('0x8')](_0x5e2e('0xb'),auth[_0x5e2e('0xc')](),controller['show']);router[_0x5e2e('0x8')](_0x5e2e('0xd'),auth[_0x5e2e('0xc')](),controller[_0x5e2e('0xe')]);router[_0x5e2e('0x8')](_0x5e2e('0xf'),auth[_0x5e2e('0xc')](),controller[_0x5e2e('0x10')]);router[_0x5e2e('0x8')](_0x5e2e('0x11'),auth[_0x5e2e('0xc')](),controller['getAgents']);router[_0x5e2e('0x12')]('/',auth['isAuthenticated'](),controller[_0x5e2e('0x13')]);router[_0x5e2e('0x12')](_0x5e2e('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5e2e('0x12')](_0x5e2e('0x11'),auth[_0x5e2e('0xc')](),controller[_0x5e2e('0x14')]);router[_0x5e2e('0x15')](_0x5e2e('0xb'),auth[_0x5e2e('0xc')](),controller[_0x5e2e('0x16')]);router[_0x5e2e('0x17')](_0x5e2e('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x5e2e('0x17')](_0x5e2e('0xf'),auth[_0x5e2e('0xc')](),controller['removeTeams']);router[_0x5e2e('0x17')](_0x5e2e('0x11'),auth[_0x5e2e('0xc')](),controller['removeAgents']);module[_0x5e2e('0x18')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 71bbb4a..2e3c519 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 _0x9385=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9385,0x1b1));var _0x5938=function(_0x51990b,_0x3ea2c9){_0x51990b=_0x51990b-0x0;var _0xbdb9e7=_0x9385[_0x51990b];return _0xbdb9e7;};'use strict';var Sequelize=require(_0x5938('0x0'));module[_0x5938('0x1')]={'name':{'type':Sequelize[_0x5938('0x2')],'unique':_0x5938('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5938('0x2')]},'timeout':{'type':Sequelize[_0x5938('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5938('0x5')]('rrmemory',_0x5938('0x6'),_0x5938('0x7'))}}; \ No newline at end of file +var _0x55dc=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x1d58ed,_0x520f5a){var _0xa4d106=function(_0x3385db){while(--_0x3385db){_0x1d58ed['push'](_0x1d58ed['shift']());}};_0xa4d106(++_0x520f5a);}(_0x55dc,0xaa));var _0xc55d=function(_0x337e83,_0x14b3a5){_0x337e83=_0x337e83-0x0;var _0x2b48fa=_0x55dc[_0x337e83];return _0x2b48fa;};'use strict';var Sequelize=require(_0xc55d('0x0'));module[_0xc55d('0x1')]={'name':{'type':Sequelize[_0xc55d('0x2')],'unique':_0xc55d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc55d('0x2')]},'timeout':{'type':Sequelize[_0xc55d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc55d('0x5')](_0xc55d('0x6'),'beepall',_0xc55d('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 3437f9d..c6d3619 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 _0xa2d0=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy','then','get','SmsQueues','UserProfileResource','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','role','userProfileId','autoAssociation','error','describe','findOne','hasOwnProperty','SmsQueueId','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','flatMap','sequelize','addTeams','findOrCreate','forEach','removeTeams','field','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','emit','addAgents','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b291c,_0x3a8748){var _0x5a1254=function(_0x40a7fc){while(--_0x40a7fc){_0x1b291c['push'](_0x1b291c['shift']());}};_0x5a1254(++_0x3a8748);}(_0xa2d0,0x77));var _0x0a2d=function(_0x37b7b7,_0x19318a){_0x37b7b7=_0x37b7b7-0x0;var _0x7ac4f8=_0xa2d0[_0x37b7b7];return _0x7ac4f8;};'use strict';var emlformat=require(_0x0a2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a2d('0x1'));var jsonpatch=require(_0x0a2d('0x2'));var rp=require(_0x0a2d('0x3'));var moment=require(_0x0a2d('0x4'));var BPromise=require(_0x0a2d('0x5'));var Mustache=require(_0x0a2d('0x6'));var util=require(_0x0a2d('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0a2d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0a2d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0a2d('0xa'));var toCsv=require(_0x0a2d('0xb'));var querystring=require('querystring');var Papa=require(_0x0a2d('0xc'));var Redis=require('ioredis');var authService=require(_0x0a2d('0xd'));var qs=require(_0x0a2d('0xe'));var as=require(_0x0a2d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a2d('0x10'))(_0x0a2d('0x11'));var utils=require(_0x0a2d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0a2d('0x13'))['db'];config[_0x0a2d('0x14')]=_[_0x0a2d('0x15')](config[_0x0a2d('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a2d('0x16'))(new Redis(config['redis']));require(_0x0a2d('0x17'))['register'](socket);function respondWithStatusCode(_0x40b9bd,_0x452069){_0x452069=_0x452069||0xcc;return function(_0x2cbc9a){if(_0x2cbc9a){return _0x40b9bd[_0x0a2d('0x18')](_0x452069);}return _0x40b9bd[_0x0a2d('0x19')](_0x452069)[_0x0a2d('0x1a')]();};}function respondWithResult(_0xe4dcc,_0xfceb47){_0xfceb47=_0xfceb47||0xc8;return function(_0x4685dc){if(_0x4685dc){return _0xe4dcc[_0x0a2d('0x19')](_0xfceb47)[_0x0a2d('0x1b')](_0x4685dc);}};}function respondWithFilteredResult(_0x1de418,_0x343baa){return function(_0x225f64){if(_0x225f64){var _0x4ff897=typeof _0x343baa[_0x0a2d('0x1c')]==='undefined'&&typeof _0x343baa[_0x0a2d('0x1d')]===_0x0a2d('0x1e');var _0x4afe9e=_0x225f64[_0x0a2d('0x1f')];var _0x482b0e=_0x4ff897?0x0:_0x343baa[_0x0a2d('0x1c')];var _0x3a287c=_0x4ff897?_0x225f64['count']:_0x343baa['offset']+_0x343baa[_0x0a2d('0x1d')];var _0x959060;if(_0x3a287c>=_0x4afe9e){_0x3a287c=_0x4afe9e;_0x959060=0xc8;}else{_0x959060=0xce;}_0x1de418[_0x0a2d('0x19')](_0x959060);return _0x1de418[_0x0a2d('0x20')]('Content-Range',_0x482b0e+'-'+_0x3a287c+'/'+_0x4afe9e)[_0x0a2d('0x1b')](_0x225f64);}return null;};}function patchUpdates(_0x1b803e){return function(_0x3f0bff){try{jsonpatch[_0x0a2d('0x21')](_0x3f0bff,_0x1b803e,!![]);}catch(_0x3b9a3a){return BPromise['reject'](_0x3b9a3a);}return _0x3f0bff[_0x0a2d('0x22')]();};}function saveUpdates(_0x1b0b01,_0x48f90c){return function(_0x10eae3){if(_0x10eae3){return _0x10eae3[_0x0a2d('0x23')](_0x1b0b01)['then'](function(_0x3a68ce){return _0x3a68ce;});}return null;};}function removeEntity(_0x593841,_0x49ec0b){return function(_0x5c6684){if(_0x5c6684){return _0x5c6684[_0x0a2d('0x24')]()[_0x0a2d('0x25')](function(){var _0x570a3e=_0x5c6684[_0x0a2d('0x26')]({'plain':!![]});var _0x2ebd20=_0x0a2d('0x27');return db[_0x0a2d('0x28')]['destroy']({'where':{'type':_0x2ebd20,'resourceId':_0x570a3e['id']}})['then'](function(){return _0x5c6684;});})[_0x0a2d('0x25')](function(){_0x593841[_0x0a2d('0x19')](0xcc)[_0x0a2d('0x1a')]();});}};}function handleEntityNotFound(_0x470679,_0x4615e2){return function(_0x1095d2){if(!_0x1095d2){_0x470679[_0x0a2d('0x18')](0x194);}return _0x1095d2;};}function handleError(_0x2cbbf8,_0x430462){_0x430462=_0x430462||0x1f4;return function(_0x3cd4a5){logger['error'](_0x3cd4a5['stack']);if(_0x3cd4a5[_0x0a2d('0x29')]){delete _0x3cd4a5[_0x0a2d('0x29')];}_0x2cbbf8[_0x0a2d('0x19')](_0x430462)[_0x0a2d('0x2a')](_0x3cd4a5);};}exports[_0x0a2d('0x2b')]=function(_0x2ad855,_0x10ff01){var _0x26163f={},_0x5bc5ae={},_0x150406={'count':0x0,'rows':[]};var _0x174792=_[_0x0a2d('0x2c')](db[_0x0a2d('0x2d')][_0x0a2d('0x2e')],function(_0x15eabc){return{'name':_0x15eabc['fieldName'],'type':_0x15eabc[_0x0a2d('0x2f')][_0x0a2d('0x30')]};});_0x5bc5ae[_0x0a2d('0x31')]=_[_0x0a2d('0x2c')](_0x174792,'name');_0x5bc5ae['query']=_['keys'](_0x2ad855[_0x0a2d('0x32')]);_0x5bc5ae[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x5bc5ae['model'],_0x5bc5ae[_0x0a2d('0x32')]);_0x26163f[_0x0a2d('0x35')]=_[_0x0a2d('0x34')](_0x5bc5ae['model'],qs['fields'](_0x2ad855[_0x0a2d('0x32')][_0x0a2d('0x36')]));_0x26163f[_0x0a2d('0x35')]=_0x26163f[_0x0a2d('0x35')][_0x0a2d('0x37')]?_0x26163f['attributes']:_0x5bc5ae[_0x0a2d('0x31')];if(!_0x2ad855['query']['hasOwnProperty'](_0x0a2d('0x38'))){_0x26163f[_0x0a2d('0x1d')]=qs[_0x0a2d('0x1d')](_0x2ad855['query'][_0x0a2d('0x1d')]);_0x26163f[_0x0a2d('0x1c')]=qs[_0x0a2d('0x1c')](_0x2ad855[_0x0a2d('0x32')][_0x0a2d('0x1c')]);}_0x26163f[_0x0a2d('0x39')]=qs['sort'](_0x2ad855[_0x0a2d('0x32')][_0x0a2d('0x3a')]);_0x26163f[_0x0a2d('0x3b')]=qs[_0x0a2d('0x33')](_[_0x0a2d('0x3c')](_0x2ad855[_0x0a2d('0x32')],_0x5bc5ae['filters']),_0x174792);if(_0x2ad855['query']['filter']){_0x26163f['where']=_[_0x0a2d('0x3d')](_0x26163f['where'],{'$or':_[_0x0a2d('0x2c')](_0x174792,function(_0xe24c4a){if(_0xe24c4a[_0x0a2d('0x2f')]!==_0x0a2d('0x3e')){var _0x5db552={};_0x5db552[_0xe24c4a[_0x0a2d('0x29')]]={'$like':'%'+_0x2ad855[_0x0a2d('0x32')][_0x0a2d('0x3f')]+'%'};return _0x5db552;}})});}_0x26163f=_[_0x0a2d('0x3d')]({},_0x26163f,_0x2ad855[_0x0a2d('0x40')]);var _0x514e55={'where':_0x26163f[_0x0a2d('0x3b')]};return db[_0x0a2d('0x2d')][_0x0a2d('0x1f')](_0x514e55)[_0x0a2d('0x25')](function(_0x958e67){_0x150406['count']=_0x958e67;if(_0x2ad855['query'][_0x0a2d('0x41')]){_0x26163f['include']=[{'all':!![]}];}return db['SmsQueue'][_0x0a2d('0x42')](_0x26163f);})[_0x0a2d('0x25')](function(_0x3729dc){_0x150406[_0x0a2d('0x43')]=_0x3729dc;return _0x150406;})[_0x0a2d('0x25')](respondWithFilteredResult(_0x10ff01,_0x26163f))[_0x0a2d('0x44')](handleError(_0x10ff01,null));};exports[_0x0a2d('0x45')]=function(_0x55dbf8,_0x541906){var _0x396ad0={'raw':!![],'where':{'id':_0x55dbf8[_0x0a2d('0x46')]['id']}},_0x423e16={};_0x423e16[_0x0a2d('0x31')]=_[_0x0a2d('0x47')](db[_0x0a2d('0x2d')][_0x0a2d('0x2e')]);_0x423e16['query']=_[_0x0a2d('0x47')](_0x55dbf8['query']);_0x423e16[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x423e16[_0x0a2d('0x31')],_0x423e16[_0x0a2d('0x32')]);_0x396ad0['attributes']=_['intersection'](_0x423e16['model'],qs[_0x0a2d('0x36')](_0x55dbf8[_0x0a2d('0x32')][_0x0a2d('0x36')]));_0x396ad0[_0x0a2d('0x35')]=_0x396ad0['attributes']['length']?_0x396ad0[_0x0a2d('0x35')]:_0x423e16['model'];if(_0x55dbf8[_0x0a2d('0x32')][_0x0a2d('0x41')]){_0x396ad0[_0x0a2d('0x48')]=[{'all':!![]}];}_0x396ad0=_['merge']({},_0x396ad0,_0x55dbf8[_0x0a2d('0x40')]);return db['SmsQueue'][_0x0a2d('0x49')](_0x396ad0)['then'](handleEntityNotFound(_0x541906,null))[_0x0a2d('0x25')](respondWithResult(_0x541906,null))[_0x0a2d('0x44')](handleError(_0x541906,null));};exports[_0x0a2d('0x4a')]=function(_0x58a283,_0x46cc5f){return db['SmsQueue']['create'](_0x58a283[_0x0a2d('0x4b')],{})[_0x0a2d('0x25')](function(_0x2bd68a){var _0x46236b=_0x58a283[_0x0a2d('0x4c')][_0x0a2d('0x26')]({'plain':!![]});if(!_0x46236b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46236b[_0x0a2d('0x4d')]==='user'){var _0x47f97a=_0x2bd68a['get']({'plain':!![]});var _0x4c27ae=_0x0a2d('0x27');return db['UserProfileSection'][_0x0a2d('0x49')]({'where':{'name':_0x4c27ae,'userProfileId':_0x46236b[_0x0a2d('0x4e')]},'raw':!![]})['then'](function(_0x376ad8){if(_0x376ad8&&_0x376ad8[_0x0a2d('0x4f')]===0x0){return db[_0x0a2d('0x28')][_0x0a2d('0x4a')]({'name':_0x47f97a['name'],'resourceId':_0x47f97a['id'],'type':_0x376ad8[_0x0a2d('0x29')],'sectionId':_0x376ad8['id']},{})['then'](function(){return _0x2bd68a;});}else{return _0x2bd68a;}})['catch'](function(_0x5ec24b){logger[_0x0a2d('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec24b);throw _0x5ec24b;});}return _0x2bd68a;})['then'](respondWithResult(_0x46cc5f,0xc9))[_0x0a2d('0x44')](handleError(_0x46cc5f,null));};exports[_0x0a2d('0x23')]=function(_0xb0d356,_0x3ede54){if(_0xb0d356[_0x0a2d('0x4b')]['id']){delete _0xb0d356[_0x0a2d('0x4b')]['id'];}return db[_0x0a2d('0x2d')][_0x0a2d('0x49')]({'where':{'id':_0xb0d356[_0x0a2d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ede54,null))[_0x0a2d('0x25')](saveUpdates(_0xb0d356[_0x0a2d('0x4b')],null))[_0x0a2d('0x25')](respondWithResult(_0x3ede54,null))[_0x0a2d('0x44')](handleError(_0x3ede54,null));};exports['destroy']=function(_0x2a253e,_0x3126d7){return db[_0x0a2d('0x2d')][_0x0a2d('0x49')]({'where':{'id':_0x2a253e[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](handleEntityNotFound(_0x3126d7,null))[_0x0a2d('0x25')](removeEntity(_0x3126d7,null))['catch'](handleError(_0x3126d7,null));};exports['describe']=function(_0x559e84,_0x18256c){return db[_0x0a2d('0x2d')][_0x0a2d('0x51')]()[_0x0a2d('0x25')](respondWithResult(_0x18256c,null))[_0x0a2d('0x44')](handleError(_0x18256c,null));};exports['getMembers']=function(_0x33321f,_0xf342d7,_0x30f77d){var _0x270163={'raw':!![],'where':{}},_0x60b071={},_0x2ee774;return db[_0x0a2d('0x2d')][_0x0a2d('0x52')]({'where':{'id':_0x33321f[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](handleEntityNotFound(_0xf342d7,null))[_0x0a2d('0x25')](function(_0x2dd7b1){if(_0x2dd7b1){_0x2ee774=_0x2dd7b1[_0x0a2d('0x26')]({'plain':!![]});_0x60b071[_0x0a2d('0x31')]=_['keys'](db['UserSmsQueue'][_0x0a2d('0x2e')]);_0x60b071[_0x0a2d('0x32')]=_[_0x0a2d('0x47')](_0x33321f[_0x0a2d('0x32')]);_0x60b071['filters']=_['intersection'](_0x60b071['model'],_0x60b071[_0x0a2d('0x32')]);_0x270163[_0x0a2d('0x35')]=_[_0x0a2d('0x34')](_0x60b071[_0x0a2d('0x31')],qs[_0x0a2d('0x36')](_0x33321f[_0x0a2d('0x32')]['fields']));_0x270163[_0x0a2d('0x35')]=_0x270163[_0x0a2d('0x35')]['length']?_0x270163[_0x0a2d('0x35')]:_0x60b071[_0x0a2d('0x31')];if(!_0x33321f[_0x0a2d('0x32')][_0x0a2d('0x53')](_0x0a2d('0x38'))){_0x270163[_0x0a2d('0x1d')]=qs[_0x0a2d('0x1d')](_0x33321f[_0x0a2d('0x32')]['limit']);_0x270163['offset']=qs[_0x0a2d('0x1c')](_0x33321f['query']['offset']);}_0x270163['order']=qs['sort'](_0x33321f[_0x0a2d('0x32')][_0x0a2d('0x3a')]);_0x270163[_0x0a2d('0x3b')]=qs[_0x0a2d('0x33')](_[_0x0a2d('0x3c')](_0x33321f[_0x0a2d('0x32')],_0x60b071[_0x0a2d('0x33')]));_0x270163['where'][_0x0a2d('0x54')]=_0x2dd7b1['id'];if(_0x33321f[_0x0a2d('0x32')][_0x0a2d('0x3f')]){_0x270163[_0x0a2d('0x3b')]=_[_0x0a2d('0x3d')](_0x270163[_0x0a2d('0x3b')],{'$or':_[_0x0a2d('0x2c')](_0x270163[_0x0a2d('0x35')],function(_0x27af72){var _0x4db05e={};_0x4db05e[_0x27af72]={'$like':'%'+_0x33321f[_0x0a2d('0x32')][_0x0a2d('0x3f')]+'%'};return _0x4db05e;})});}_0x270163=_[_0x0a2d('0x3d')]({},_0x270163,_0x33321f[_0x0a2d('0x40')]);return db[_0x0a2d('0x55')]['findAll'](_0x270163);}})[_0x0a2d('0x25')](function(_0x32f656){if(_0x32f656){return db[_0x0a2d('0x56')][_0x0a2d('0x57')]({'where':{'id':_[_0x0a2d('0x2c')](_0x32f656,_0x0a2d('0x58')),'role':_0x0a2d('0x59')},'attributes':['id',_0x0a2d('0x29'),_0x0a2d('0x5a'),_0x0a2d('0x5b'),'createdAt']});}})[_0x0a2d('0x25')](function(_0x3e0676){if(_0x3e0676){return{'count':_0x3e0676['count'],'rows':_[_0x0a2d('0x2c')](_0x3e0676[_0x0a2d('0x43')],function(_0x5c4907){return{'membername':_0x5c4907[_0x0a2d('0x29')],'UserId':_0x5c4907['id'],'queue_name':_0x2ee774[_0x0a2d('0x29')],'SmsQueueId':_0x2ee774['id'],'interface':util[_0x0a2d('0x5c')](_0x0a2d('0x5d'),_0x0a2d('0x5e'),_0x5c4907[_0x0a2d('0x29')]),'penalty':0x0,'paused':_0x5c4907[_0x0a2d('0x5a')],'createdAt':_0x5c4907['createdAt'],'updatedAt':_0x5c4907[_0x0a2d('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0a2d('0x25')](respondWithFilteredResult(_0xf342d7,_0x270163))[_0x0a2d('0x44')](handleError(_0xf342d7,null));};exports[_0x0a2d('0x5f')]=function(_0x314d58,_0x78a1d4,_0xfb9a4a){var _0x2fdcb4={};var _0x5377da={};var _0x30e897;var _0x122293;return db[_0x0a2d('0x2d')][_0x0a2d('0x52')]({'where':{'id':_0x314d58[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](handleEntityNotFound(_0x78a1d4,null))[_0x0a2d('0x25')](function(_0x255eb3){if(_0x255eb3){_0x30e897=_0x255eb3;_0x5377da[_0x0a2d('0x31')]=_[_0x0a2d('0x47')](db[_0x0a2d('0x60')][_0x0a2d('0x2e')]);_0x5377da[_0x0a2d('0x32')]=_[_0x0a2d('0x47')](_0x314d58[_0x0a2d('0x32')]);_0x5377da[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x5377da[_0x0a2d('0x31')],_0x5377da[_0x0a2d('0x32')]);_0x2fdcb4[_0x0a2d('0x35')]=_[_0x0a2d('0x34')](_0x5377da[_0x0a2d('0x31')],qs[_0x0a2d('0x36')](_0x314d58[_0x0a2d('0x32')][_0x0a2d('0x36')]));_0x2fdcb4[_0x0a2d('0x35')]=_0x2fdcb4[_0x0a2d('0x35')][_0x0a2d('0x37')]?_0x2fdcb4[_0x0a2d('0x35')]:_0x5377da[_0x0a2d('0x31')];_0x2fdcb4[_0x0a2d('0x39')]=qs[_0x0a2d('0x3a')](_0x314d58[_0x0a2d('0x32')][_0x0a2d('0x3a')]);_0x2fdcb4['where']=qs[_0x0a2d('0x33')](_[_0x0a2d('0x3c')](_0x314d58[_0x0a2d('0x32')],_0x5377da[_0x0a2d('0x33')]));if(_0x314d58[_0x0a2d('0x32')][_0x0a2d('0x3f')]){_0x2fdcb4[_0x0a2d('0x3b')]=_[_0x0a2d('0x3d')](_0x2fdcb4[_0x0a2d('0x3b')],{'$or':_[_0x0a2d('0x2c')](_0x2fdcb4['attributes'],function(_0x5b4d09){var _0x56176d={};_0x56176d[_0x5b4d09]={'$like':'%'+_0x314d58['query']['filter']+'%'};return _0x56176d;})});}_0x2fdcb4=_['merge']({},_0x2fdcb4,_0x314d58[_0x0a2d('0x40')]);return _0x30e897[_0x0a2d('0x5f')](_0x2fdcb4);}})[_0x0a2d('0x25')](function(_0x43b89a){if(_0x43b89a){_0x122293=_0x43b89a['length'];if(!_0x314d58['query'][_0x0a2d('0x53')](_0x0a2d('0x38'))){_0x2fdcb4['limit']=qs[_0x0a2d('0x1d')](_0x314d58['query']['limit']);_0x2fdcb4['offset']=qs['offset'](_0x314d58[_0x0a2d('0x32')][_0x0a2d('0x1c')]);}return _0x30e897['getTeams'](_0x2fdcb4);}})[_0x0a2d('0x25')](function(_0x32a4ef){if(_0x32a4ef){return _0x32a4ef?{'count':_0x122293,'rows':_0x32a4ef}:null;}})[_0x0a2d('0x25')](respondWithResult(_0x78a1d4,null))[_0x0a2d('0x44')](handleError(_0x78a1d4,null));};exports['addTeams']=function(_0x490ba6,_0x264631,_0x20c5f9){var _0x533016=_0x490ba6[_0x0a2d('0x4b')][_0x0a2d('0x61')];return db[_0x0a2d('0x60')][_0x0a2d('0x42')]({'where':{'id':_0x533016},'attributes':['id'],'include':[{'model':db[_0x0a2d('0x56')],'as':_0x0a2d('0x62'),'attributes':['id',_0x0a2d('0x29'),_0x0a2d('0x63'),_0x0a2d('0x64'),'interface'],'raw':!![]}]})['then'](function(_0x4d5a07){if(_0x4d5a07){var _0x7fb844=_[_0x0a2d('0x65')](_0x4d5a07,function(_0x2823d8){var _0x5b70be=_0x2823d8[_0x0a2d('0x26')]({'plain':!![]});return _0x5b70be[_0x0a2d('0x62')];});return db['SmsQueue'][_0x0a2d('0x49')]({'where':{'id':_0x490ba6[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](function(_0x3b9059){return db[_0x0a2d('0x66')]['transaction'](function(_0x100e54){return _0x3b9059[_0x0a2d('0x67')](_0x533016,{'transaction':_0x100e54})[_0x0a2d('0x25')](function(){return BPromise['each'](_0x7fb844,function(_0x5ddd9e){return db['UserSmsQueue'][_0x0a2d('0x68')]({'where':{'UserId':_0x5ddd9e['id'],'SmsQueueId':_0x490ba6[_0x0a2d('0x46')]['id']},'transaction':_0x100e54});});})[_0x0a2d('0x25')](function(){_0x7fb844[_0x0a2d('0x69')](function(_0x11cdde){socket['emit']('userSmsQueue:save',{'UserId':_0x11cdde['id'],'SmsQueueId':_0x3b9059['id']});});});});});}})[_0x0a2d('0x25')](respondWithStatusCode(_0x264631,null))['catch'](handleError(_0x264631,null));};exports[_0x0a2d('0x6a')]=function(_0x496678,_0x504f3a,_0x5bc853){return db[_0x0a2d('0x60')]['findAll']({'where':{'id':_0x496678['query'][_0x0a2d('0x61')]},'attributes':['id'],'include':[{'model':db[_0x0a2d('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0a2d('0x25')](handleEntityNotFound(_0x504f3a,null))[_0x0a2d('0x25')](function(_0x38b22c){var _0x1cd68c=_[_0x0a2d('0x2c')](_0x38b22c,'id');var _0x424cca=[];var _0x1f6bf4=[];var _0x304e22=squel['select']();_0x304e22[_0x0a2d('0x6b')]('tq.TeamId')['from'](_0x0a2d('0x6c'),'tq')[_0x0a2d('0x6d')](_0x0a2d('0x6e'),'ut',_0x0a2d('0x6f'))[_0x0a2d('0x3b')](_0x0a2d('0x70'),_0x496678[_0x0a2d('0x46')]['id']);for(var _0x262dec=0x0;_0x262dec<_0x38b22c[_0x0a2d('0x37')];_0x262dec+=0x1){let _0x2011db=_0x38b22c[_0x262dec];for(var _0x242a28=0x0;_0x242a28<_0x2011db[_0x0a2d('0x62')][_0x0a2d('0x37')];_0x242a28+=0x1){let _0x5e2a0f=_0x2011db['Agents'][_0x242a28];var _0x3c302f=_0x304e22[_0x0a2d('0x71')]();_0x3c302f[_0x0a2d('0x3b')](_0x0a2d('0x72'),_0x5e2a0f['id']);_0x1f6bf4['push'](db[_0x0a2d('0x66')][_0x0a2d('0x32')](_0x3c302f[_0x0a2d('0x73')](),{'type':db[_0x0a2d('0x66')][_0x0a2d('0x74')][_0x0a2d('0x75')]})['then'](function(_0xd540b8){if(_0xd540b8[_0x0a2d('0x37')]===0x1){return _0x5e2a0f['id'];}else{var _0x94ced2=_[_0x0a2d('0x76')](_[_0x0a2d('0x2c')](_0xd540b8,_0x0a2d('0x77')),function(_0x5c6877){return _[_0x0a2d('0x78')](_0x1cd68c,_0x5c6877);});if(_0x94ced2){return _0x5e2a0f['id'];}}}));}}return BPromise[_0x0a2d('0x79')](_0x1f6bf4)['then'](function(_0x1a7729){_0x424cca=_(_0x424cca)['union'](_0x1a7729)[_0x0a2d('0x7a')]()[_0x0a2d('0x7b')]();return db[_0x0a2d('0x2d')][_0x0a2d('0x49')]({'where':{'id':_0x496678[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](function(_0x5d5bb8){return db[_0x0a2d('0x66')][_0x0a2d('0x7c')](function(_0x1419e7){return _0x5d5bb8['removeTeams'](_0x496678[_0x0a2d('0x32')][_0x0a2d('0x61')],{'transaction':_0x1419e7})['then'](function(){if(!_[_0x0a2d('0x7d')](_0x424cca)){return _0x5d5bb8[_0x0a2d('0x7e')](_0x424cca,{'transaction':_0x1419e7});}})[_0x0a2d('0x25')](function(){_0x424cca[_0x0a2d('0x69')](function(_0x146064){socket[_0x0a2d('0x7f')]('userSmsQueue:remove',{'UserId':_0x146064,'SmsQueueId':_0x5d5bb8['id']});});});});});});})[_0x0a2d('0x25')](respondWithStatusCode(_0x504f3a,null))[_0x0a2d('0x44')](handleError(_0x504f3a,null));};exports[_0x0a2d('0x80')]=function(_0x1e9187,_0x97e1b8,_0x536e35){return db[_0x0a2d('0x2d')][_0x0a2d('0x49')]({'where':{'id':_0x1e9187[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](handleEntityNotFound(_0x97e1b8,null))[_0x0a2d('0x25')](function(_0x29d66e){if(_0x29d66e){return _0x29d66e[_0x0a2d('0x80')](_0x1e9187[_0x0a2d('0x4b')][_0x0a2d('0x61')],_['omit'](_0x1e9187[_0x0a2d('0x4b')],[_0x0a2d('0x61'),'id'])||{})[_0x0a2d('0x81')](function(_0x34c9d0){for(var _0x49b495=0x0;_0x49b495<_0x1e9187[_0x0a2d('0x4b')][_0x0a2d('0x61')][_0x0a2d('0x37')];_0x49b495+=0x1){socket[_0x0a2d('0x7f')](_0x0a2d('0x82'),{'UserId':Number(_0x1e9187[_0x0a2d('0x4b')][_0x0a2d('0x61')][_0x49b495]),'SmsQueueId':Number(_0x1e9187['params']['id'])});}return _0x34c9d0;});}})['then'](respondWithResult(_0x97e1b8,null))[_0x0a2d('0x44')](handleError(_0x97e1b8,null));};exports[_0x0a2d('0x7e')]=function(_0x38e4da,_0x5917f3,_0xb742f8){return db[_0x0a2d('0x2d')]['find']({'where':{'id':_0x38e4da[_0x0a2d('0x46')]['id']}})[_0x0a2d('0x25')](handleEntityNotFound(_0x5917f3,null))['then'](function(_0x5f9c4a){if(_0x5f9c4a){return _0x5f9c4a[_0x0a2d('0x7e')](_0x38e4da[_0x0a2d('0x32')][_0x0a2d('0x61')])[_0x0a2d('0x25')](function(){if(_[_0x0a2d('0x83')](_0x38e4da[_0x0a2d('0x32')][_0x0a2d('0x61')])){for(var _0x2931c3=0x0;_0x2931c3<_0x38e4da[_0x0a2d('0x32')]['ids'][_0x0a2d('0x37')];_0x2931c3+=0x1){socket[_0x0a2d('0x7f')]('userSmsQueue:remove',{'UserId':Number(_0x38e4da[_0x0a2d('0x32')][_0x0a2d('0x61')][_0x2931c3]),'SmsQueueId':Number(_0x38e4da[_0x0a2d('0x46')]['id'])});}}else{socket[_0x0a2d('0x7f')](_0x0a2d('0x84'),{'UserId':Number(_0x38e4da['query'][_0x0a2d('0x61')]),'SmsQueueId':Number(_0x38e4da[_0x0a2d('0x46')]['id'])});}});}})[_0x0a2d('0x25')](respondWithStatusCode(_0x5917f3,null))['catch'](handleError(_0x5917f3,null));};exports[_0x0a2d('0x85')]=function(_0x164100,_0x4ad34a,_0x56358c){var _0x5ce824={};var _0x30f00a={};var _0x2e9de0;var _0x35393a;return db[_0x0a2d('0x2d')][_0x0a2d('0x52')]({'where':{'id':_0x164100['params']['id']}})['then'](handleEntityNotFound(_0x4ad34a,null))[_0x0a2d('0x25')](function(_0x42f981){if(_0x42f981){_0x2e9de0=_0x42f981;_0x30f00a[_0x0a2d('0x31')]=_['keys'](db[_0x0a2d('0x56')][_0x0a2d('0x2e')]);_0x30f00a['query']=_['keys'](_0x164100['query']);_0x30f00a[_0x0a2d('0x33')]=_[_0x0a2d('0x34')](_0x30f00a[_0x0a2d('0x31')],_0x30f00a[_0x0a2d('0x32')]);_0x5ce824[_0x0a2d('0x35')]=_[_0x0a2d('0x34')](_0x30f00a[_0x0a2d('0x31')],qs[_0x0a2d('0x36')](_0x164100[_0x0a2d('0x32')][_0x0a2d('0x36')]));_0x5ce824[_0x0a2d('0x35')]=_0x5ce824[_0x0a2d('0x35')][_0x0a2d('0x37')]?_0x5ce824[_0x0a2d('0x35')]:_0x30f00a[_0x0a2d('0x31')];_0x5ce824[_0x0a2d('0x39')]=qs['sort'](_0x164100['query']['sort']);_0x5ce824[_0x0a2d('0x3b')]=qs['filters'](_[_0x0a2d('0x3c')](_0x164100[_0x0a2d('0x32')],_0x30f00a[_0x0a2d('0x33')]));if(_0x164100[_0x0a2d('0x32')][_0x0a2d('0x3f')]){_0x5ce824['where']=_[_0x0a2d('0x3d')](_0x5ce824[_0x0a2d('0x3b')],{'$or':_['map'](_0x5ce824[_0x0a2d('0x35')],function(_0x29219a){var _0x5b0e42={};_0x5b0e42[_0x29219a]={'$like':'%'+_0x164100[_0x0a2d('0x32')][_0x0a2d('0x3f')]+'%'};return _0x5b0e42;})});}_0x5ce824=_[_0x0a2d('0x3d')]({},_0x5ce824,_0x164100[_0x0a2d('0x40')]);return _0x2e9de0[_0x0a2d('0x85')](_0x5ce824);}})[_0x0a2d('0x25')](function(_0x9e07eb){if(_0x9e07eb){_0x35393a=_0x9e07eb['length'];if(!_0x164100[_0x0a2d('0x32')][_0x0a2d('0x53')](_0x0a2d('0x38'))){_0x5ce824[_0x0a2d('0x1d')]=qs['limit'](_0x164100[_0x0a2d('0x32')][_0x0a2d('0x1d')]);_0x5ce824[_0x0a2d('0x1c')]=qs[_0x0a2d('0x1c')](_0x164100[_0x0a2d('0x32')][_0x0a2d('0x1c')]);}return _0x2e9de0[_0x0a2d('0x85')](_0x5ce824);}})['then'](function(_0x295d73){if(_0x295d73){return _0x295d73?{'count':_0x35393a,'rows':_0x295d73}:null;}})[_0x0a2d('0x25')](respondWithResult(_0x4ad34a,null))['catch'](handleError(_0x4ad34a,null));}; \ No newline at end of file +var _0x4012=['userSmsQueue:remove','addAgents','omit','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueue','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','order','SmsQueueId','UserSmsQueue','User','findAndCountAll','smsPause','createdAt','format','%s/%s','updatedAt','getTeams','Team','length','addTeams','Agents','online','voicePause','flatMap','transaction','each','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0x4012,0x1bf));var _0x2401=function(_0x230747,_0x1d413c){_0x230747=_0x230747-0x0;var _0xfe856f=_0x4012[_0x230747];return _0xfe856f;};'use strict';var emlformat=require(_0x2401('0x0'));var rimraf=require(_0x2401('0x1'));var zipdir=require(_0x2401('0x2'));var jsonpatch=require(_0x2401('0x3'));var rp=require(_0x2401('0x4'));var moment=require('moment');var BPromise=require(_0x2401('0x5'));var Mustache=require(_0x2401('0x6'));var util=require(_0x2401('0x7'));var path=require(_0x2401('0x8'));var sox=require(_0x2401('0x9'));var csv=require(_0x2401('0xa'));var ejs=require(_0x2401('0xb'));var fs=require('fs');var fs_extra=require(_0x2401('0xc'));var _=require(_0x2401('0xd'));var squel=require(_0x2401('0xe'));var crypto=require(_0x2401('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2401('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2401('0x11'));var Papa=require(_0x2401('0x12'));var Redis=require(_0x2401('0x13'));var authService=require(_0x2401('0x14'));var qs=require(_0x2401('0x15'));var as=require(_0x2401('0x16'));var hardwareService=require(_0x2401('0x17'));var logger=require(_0x2401('0x18'))(_0x2401('0x19'));var utils=require(_0x2401('0x1a'));var config=require(_0x2401('0x1b'));var licenseUtil=require(_0x2401('0x1c'));var db=require(_0x2401('0x1d'))['db'];config[_0x2401('0x1e')]=_['defaults'](config[_0x2401('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x2401('0x1f'))(new Redis(config[_0x2401('0x1e')]));require(_0x2401('0x20'))[_0x2401('0x21')](socket);function respondWithStatusCode(_0x3f54e4,_0x5f3c68){_0x5f3c68=_0x5f3c68||0xcc;return function(_0x523978){if(_0x523978){return _0x3f54e4[_0x2401('0x22')](_0x5f3c68);}return _0x3f54e4['status'](_0x5f3c68)['end']();};}function respondWithResult(_0x2abb8c,_0x17d709){_0x17d709=_0x17d709||0xc8;return function(_0x29568a){if(_0x29568a){return _0x2abb8c[_0x2401('0x23')](_0x17d709)[_0x2401('0x24')](_0x29568a);}};}function respondWithFilteredResult(_0x2c66c,_0x1ba9bf){return function(_0x4ca827){if(_0x4ca827){var _0xfa9520=typeof _0x1ba9bf[_0x2401('0x25')]==='undefined'&&typeof _0x1ba9bf['limit']==='undefined';var _0x4d1fd1=_0x4ca827['count'];var _0x1716ef=_0xfa9520?0x0:_0x1ba9bf['offset'];var _0x3412e5=_0xfa9520?_0x4ca827['count']:_0x1ba9bf[_0x2401('0x25')]+_0x1ba9bf[_0x2401('0x26')];var _0xbbfcbd;if(_0x3412e5>=_0x4d1fd1){_0x3412e5=_0x4d1fd1;_0xbbfcbd=0xc8;}else{_0xbbfcbd=0xce;}_0x2c66c['status'](_0xbbfcbd);return _0x2c66c[_0x2401('0x27')](_0x2401('0x28'),_0x1716ef+'-'+_0x3412e5+'/'+_0x4d1fd1)[_0x2401('0x24')](_0x4ca827);}return null;};}function patchUpdates(_0x46a4ce){return function(_0x21e90c){try{jsonpatch[_0x2401('0x29')](_0x21e90c,_0x46a4ce,!![]);}catch(_0x2ff84c){return BPromise['reject'](_0x2ff84c);}return _0x21e90c[_0x2401('0x2a')]();};}function saveUpdates(_0x38d527,_0x5482fe){return function(_0x396b0b){if(_0x396b0b){return _0x396b0b[_0x2401('0x2b')](_0x38d527)[_0x2401('0x2c')](function(_0x1111c3){return _0x1111c3;});}return null;};}function removeEntity(_0x402749,_0x3426e7){return function(_0x1655c1){if(_0x1655c1){return _0x1655c1['destroy']()['then'](function(){var _0x24a660=_0x1655c1[_0x2401('0x2d')]({'plain':!![]});var _0x17bde0='SmsQueues';return db[_0x2401('0x2e')][_0x2401('0x2f')]({'where':{'type':_0x17bde0,'resourceId':_0x24a660['id']}})[_0x2401('0x2c')](function(){return _0x1655c1;});})['then'](function(){_0x402749[_0x2401('0x23')](0xcc)[_0x2401('0x30')]();});}};}function handleEntityNotFound(_0x292a78,_0x3fad1b){return function(_0x19302a){if(!_0x19302a){_0x292a78[_0x2401('0x22')](0x194);}return _0x19302a;};}function handleError(_0x5b7764,_0xc6403c){_0xc6403c=_0xc6403c||0x1f4;return function(_0x38a820){logger[_0x2401('0x31')](_0x38a820[_0x2401('0x32')]);if(_0x38a820[_0x2401('0x33')]){delete _0x38a820[_0x2401('0x33')];}_0x5b7764[_0x2401('0x23')](_0xc6403c)['send'](_0x38a820);};}exports[_0x2401('0x34')]=function(_0x44bc40,_0x2b7f7a){var _0x108e4a={},_0x13ae3f={},_0x28bd41={'count':0x0,'rows':[]};var _0x1e7ce2=_[_0x2401('0x35')](db['SmsQueue'][_0x2401('0x36')],function(_0x3d28e6){return{'name':_0x3d28e6[_0x2401('0x37')],'type':_0x3d28e6[_0x2401('0x38')][_0x2401('0x39')]};});_0x13ae3f[_0x2401('0x3a')]=_[_0x2401('0x35')](_0x1e7ce2,'name');_0x13ae3f['query']=_[_0x2401('0x3b')](_0x44bc40[_0x2401('0x3c')]);_0x13ae3f[_0x2401('0x3d')]=_['intersection'](_0x13ae3f[_0x2401('0x3a')],_0x13ae3f[_0x2401('0x3c')]);_0x108e4a[_0x2401('0x3e')]=_[_0x2401('0x3f')](_0x13ae3f[_0x2401('0x3a')],qs[_0x2401('0x40')](_0x44bc40[_0x2401('0x3c')]['fields']));_0x108e4a['attributes']=_0x108e4a['attributes']['length']?_0x108e4a[_0x2401('0x3e')]:_0x13ae3f[_0x2401('0x3a')];if(!_0x44bc40[_0x2401('0x3c')][_0x2401('0x41')](_0x2401('0x42'))){_0x108e4a[_0x2401('0x26')]=qs[_0x2401('0x26')](_0x44bc40[_0x2401('0x3c')]['limit']);_0x108e4a[_0x2401('0x25')]=qs['offset'](_0x44bc40[_0x2401('0x3c')]['offset']);}_0x108e4a['order']=qs[_0x2401('0x43')](_0x44bc40[_0x2401('0x3c')][_0x2401('0x43')]);_0x108e4a[_0x2401('0x44')]=qs[_0x2401('0x3d')](_[_0x2401('0x45')](_0x44bc40[_0x2401('0x3c')],_0x13ae3f[_0x2401('0x3d')]),_0x1e7ce2);if(_0x44bc40[_0x2401('0x3c')][_0x2401('0x46')]){_0x108e4a['where']=_[_0x2401('0x47')](_0x108e4a[_0x2401('0x44')],{'$or':_['map'](_0x1e7ce2,function(_0x1a9d53){if(_0x1a9d53[_0x2401('0x38')]!==_0x2401('0x48')){var _0x22409b={};_0x22409b[_0x1a9d53[_0x2401('0x33')]]={'$like':'%'+_0x44bc40[_0x2401('0x3c')][_0x2401('0x46')]+'%'};return _0x22409b;}})});}_0x108e4a=_['merge']({},_0x108e4a,_0x44bc40[_0x2401('0x49')]);var _0x4c2c9b={'where':_0x108e4a[_0x2401('0x44')]};return db[_0x2401('0x4a')][_0x2401('0x4b')](_0x4c2c9b)[_0x2401('0x2c')](function(_0x4a7b5b){_0x28bd41[_0x2401('0x4b')]=_0x4a7b5b;if(_0x44bc40['query'][_0x2401('0x4c')]){_0x108e4a[_0x2401('0x4d')]=[{'all':!![]}];}return db[_0x2401('0x4a')][_0x2401('0x4e')](_0x108e4a);})['then'](function(_0x1fbe14){_0x28bd41[_0x2401('0x4f')]=_0x1fbe14;return _0x28bd41;})['then'](respondWithFilteredResult(_0x2b7f7a,_0x108e4a))[_0x2401('0x50')](handleError(_0x2b7f7a,null));};exports[_0x2401('0x51')]=function(_0x25e795,_0x5bb1e6){var _0x5a4479={'raw':!![],'where':{'id':_0x25e795[_0x2401('0x52')]['id']}},_0x3878be={};_0x3878be[_0x2401('0x3a')]=_[_0x2401('0x3b')](db['SmsQueue']['rawAttributes']);_0x3878be['query']=_[_0x2401('0x3b')](_0x25e795[_0x2401('0x3c')]);_0x3878be[_0x2401('0x3d')]=_[_0x2401('0x3f')](_0x3878be['model'],_0x3878be[_0x2401('0x3c')]);_0x5a4479['attributes']=_[_0x2401('0x3f')](_0x3878be[_0x2401('0x3a')],qs[_0x2401('0x40')](_0x25e795[_0x2401('0x3c')][_0x2401('0x40')]));_0x5a4479[_0x2401('0x3e')]=_0x5a4479['attributes']['length']?_0x5a4479[_0x2401('0x3e')]:_0x3878be[_0x2401('0x3a')];if(_0x25e795[_0x2401('0x3c')][_0x2401('0x4c')]){_0x5a4479[_0x2401('0x4d')]=[{'all':!![]}];}_0x5a4479=_[_0x2401('0x47')]({},_0x5a4479,_0x25e795['options']);return db[_0x2401('0x4a')]['find'](_0x5a4479)[_0x2401('0x2c')](handleEntityNotFound(_0x5bb1e6,null))[_0x2401('0x2c')](respondWithResult(_0x5bb1e6,null))[_0x2401('0x50')](handleError(_0x5bb1e6,null));};exports[_0x2401('0x53')]=function(_0x7228c7,_0x469a21){return db[_0x2401('0x4a')]['create'](_0x7228c7[_0x2401('0x54')],{})[_0x2401('0x2c')](function(_0x5147ec){var _0x36ce0e=_0x7228c7[_0x2401('0x55')]['get']({'plain':!![]});if(!_0x36ce0e)throw new Error(_0x2401('0x56'));if(_0x36ce0e[_0x2401('0x57')]==='user'){var _0x42d19f=_0x5147ec[_0x2401('0x2d')]({'plain':!![]});var _0xf3950f=_0x2401('0x58');return db['UserProfileSection'][_0x2401('0x59')]({'where':{'name':_0xf3950f,'userProfileId':_0x36ce0e[_0x2401('0x5a')]},'raw':!![]})[_0x2401('0x2c')](function(_0x2cd67d){if(_0x2cd67d&&_0x2cd67d[_0x2401('0x5b')]===0x0){return db['UserProfileResource'][_0x2401('0x53')]({'name':_0x42d19f[_0x2401('0x33')],'resourceId':_0x42d19f['id'],'type':_0x2cd67d[_0x2401('0x33')],'sectionId':_0x2cd67d['id']},{})['then'](function(){return _0x5147ec;});}else{return _0x5147ec;}})['catch'](function(_0x571168){logger['error'](_0x2401('0x5c'),_0x571168);throw _0x571168;});}return _0x5147ec;})[_0x2401('0x2c')](respondWithResult(_0x469a21,0xc9))[_0x2401('0x50')](handleError(_0x469a21,null));};exports[_0x2401('0x2b')]=function(_0xb89830,_0x23d5b0){if(_0xb89830[_0x2401('0x54')]['id']){delete _0xb89830[_0x2401('0x54')]['id'];}return db[_0x2401('0x4a')]['find']({'where':{'id':_0xb89830[_0x2401('0x52')]['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x23d5b0,null))['then'](saveUpdates(_0xb89830[_0x2401('0x54')],null))['then'](respondWithResult(_0x23d5b0,null))[_0x2401('0x50')](handleError(_0x23d5b0,null));};exports[_0x2401('0x2f')]=function(_0xde2daa,_0x4c44be){return db[_0x2401('0x4a')]['find']({'where':{'id':_0xde2daa[_0x2401('0x52')]['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x4c44be,null))[_0x2401('0x2c')](removeEntity(_0x4c44be,null))[_0x2401('0x50')](handleError(_0x4c44be,null));};exports[_0x2401('0x5d')]=function(_0x363776,_0x687791){return db[_0x2401('0x4a')]['describe']()[_0x2401('0x2c')](respondWithResult(_0x687791,null))['catch'](handleError(_0x687791,null));};exports['getMembers']=function(_0x194d1c,_0x402134,_0xcb09d3){var _0x3878af={'raw':!![],'where':{}},_0x39f6f5={},_0x1929d9;return db[_0x2401('0x4a')][_0x2401('0x5e')]({'where':{'id':_0x194d1c[_0x2401('0x52')]['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x402134,null))[_0x2401('0x2c')](function(_0x10ca12){if(_0x10ca12){_0x1929d9=_0x10ca12[_0x2401('0x2d')]({'plain':!![]});_0x39f6f5['model']=_[_0x2401('0x3b')](db['UserSmsQueue'][_0x2401('0x36')]);_0x39f6f5['query']=_[_0x2401('0x3b')](_0x194d1c[_0x2401('0x3c')]);_0x39f6f5[_0x2401('0x3d')]=_[_0x2401('0x3f')](_0x39f6f5[_0x2401('0x3a')],_0x39f6f5[_0x2401('0x3c')]);_0x3878af['attributes']=_[_0x2401('0x3f')](_0x39f6f5[_0x2401('0x3a')],qs[_0x2401('0x40')](_0x194d1c[_0x2401('0x3c')]['fields']));_0x3878af['attributes']=_0x3878af[_0x2401('0x3e')]['length']?_0x3878af[_0x2401('0x3e')]:_0x39f6f5['model'];if(!_0x194d1c[_0x2401('0x3c')][_0x2401('0x41')](_0x2401('0x42'))){_0x3878af[_0x2401('0x26')]=qs['limit'](_0x194d1c[_0x2401('0x3c')][_0x2401('0x26')]);_0x3878af['offset']=qs[_0x2401('0x25')](_0x194d1c['query'][_0x2401('0x25')]);}_0x3878af[_0x2401('0x5f')]=qs[_0x2401('0x43')](_0x194d1c[_0x2401('0x3c')][_0x2401('0x43')]);_0x3878af['where']=qs[_0x2401('0x3d')](_[_0x2401('0x45')](_0x194d1c['query'],_0x39f6f5[_0x2401('0x3d')]));_0x3878af[_0x2401('0x44')][_0x2401('0x60')]=_0x10ca12['id'];if(_0x194d1c[_0x2401('0x3c')][_0x2401('0x46')]){_0x3878af[_0x2401('0x44')]=_[_0x2401('0x47')](_0x3878af[_0x2401('0x44')],{'$or':_[_0x2401('0x35')](_0x3878af[_0x2401('0x3e')],function(_0x4ddf9b){var _0x402af1={};_0x402af1[_0x4ddf9b]={'$like':'%'+_0x194d1c[_0x2401('0x3c')]['filter']+'%'};return _0x402af1;})});}_0x3878af=_[_0x2401('0x47')]({},_0x3878af,_0x194d1c['options']);return db[_0x2401('0x61')][_0x2401('0x4e')](_0x3878af);}})[_0x2401('0x2c')](function(_0x2a80cc){if(_0x2a80cc){return db[_0x2401('0x62')][_0x2401('0x63')]({'where':{'id':_[_0x2401('0x35')](_0x2a80cc,'UserId'),'role':'agent'},'attributes':['id',_0x2401('0x33'),_0x2401('0x64'),'updatedAt',_0x2401('0x65')]});}})['then'](function(_0x3eaf2c){if(_0x3eaf2c){return{'count':_0x3eaf2c[_0x2401('0x4b')],'rows':_[_0x2401('0x35')](_0x3eaf2c[_0x2401('0x4f')],function(_0x578d5c){return{'membername':_0x578d5c[_0x2401('0x33')],'UserId':_0x578d5c['id'],'queue_name':_0x1929d9['name'],'SmsQueueId':_0x1929d9['id'],'interface':util[_0x2401('0x66')](_0x2401('0x67'),'SIP',_0x578d5c['name']),'penalty':0x0,'paused':_0x578d5c[_0x2401('0x64')],'createdAt':_0x578d5c[_0x2401('0x65')],'updatedAt':_0x578d5c[_0x2401('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2401('0x2c')](respondWithFilteredResult(_0x402134,_0x3878af))['catch'](handleError(_0x402134,null));};exports[_0x2401('0x69')]=function(_0x48a084,_0x2e91f6,_0xd6e4c3){var _0x131490={};var _0x50b252={};var _0x4f1a48;var _0xdf427e;return db[_0x2401('0x4a')][_0x2401('0x5e')]({'where':{'id':_0x48a084['params']['id']}})['then'](handleEntityNotFound(_0x2e91f6,null))[_0x2401('0x2c')](function(_0x17280d){if(_0x17280d){_0x4f1a48=_0x17280d;_0x50b252['model']=_[_0x2401('0x3b')](db[_0x2401('0x6a')][_0x2401('0x36')]);_0x50b252[_0x2401('0x3c')]=_[_0x2401('0x3b')](_0x48a084[_0x2401('0x3c')]);_0x50b252[_0x2401('0x3d')]=_[_0x2401('0x3f')](_0x50b252[_0x2401('0x3a')],_0x50b252[_0x2401('0x3c')]);_0x131490[_0x2401('0x3e')]=_[_0x2401('0x3f')](_0x50b252['model'],qs[_0x2401('0x40')](_0x48a084['query'][_0x2401('0x40')]));_0x131490['attributes']=_0x131490[_0x2401('0x3e')][_0x2401('0x6b')]?_0x131490[_0x2401('0x3e')]:_0x50b252['model'];_0x131490[_0x2401('0x5f')]=qs[_0x2401('0x43')](_0x48a084[_0x2401('0x3c')][_0x2401('0x43')]);_0x131490[_0x2401('0x44')]=qs['filters'](_[_0x2401('0x45')](_0x48a084[_0x2401('0x3c')],_0x50b252[_0x2401('0x3d')]));if(_0x48a084['query'][_0x2401('0x46')]){_0x131490[_0x2401('0x44')]=_[_0x2401('0x47')](_0x131490[_0x2401('0x44')],{'$or':_[_0x2401('0x35')](_0x131490['attributes'],function(_0x5aab59){var _0x541883={};_0x541883[_0x5aab59]={'$like':'%'+_0x48a084[_0x2401('0x3c')][_0x2401('0x46')]+'%'};return _0x541883;})});}_0x131490=_[_0x2401('0x47')]({},_0x131490,_0x48a084[_0x2401('0x49')]);return _0x4f1a48[_0x2401('0x69')](_0x131490);}})[_0x2401('0x2c')](function(_0x3b37da){if(_0x3b37da){_0xdf427e=_0x3b37da['length'];if(!_0x48a084['query'][_0x2401('0x41')]('nolimit')){_0x131490[_0x2401('0x26')]=qs[_0x2401('0x26')](_0x48a084[_0x2401('0x3c')]['limit']);_0x131490['offset']=qs[_0x2401('0x25')](_0x48a084['query'][_0x2401('0x25')]);}return _0x4f1a48[_0x2401('0x69')](_0x131490);}})[_0x2401('0x2c')](function(_0x311951){if(_0x311951){return _0x311951?{'count':_0xdf427e,'rows':_0x311951}:null;}})[_0x2401('0x2c')](respondWithResult(_0x2e91f6,null))['catch'](handleError(_0x2e91f6,null));};exports[_0x2401('0x6c')]=function(_0x5239d7,_0x1540a8,_0x278359){var _0x4f6349=_0x5239d7['body']['ids'];return db[_0x2401('0x6a')][_0x2401('0x4e')]({'where':{'id':_0x4f6349},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2401('0x6d'),'attributes':['id',_0x2401('0x33'),_0x2401('0x6e'),_0x2401('0x6f'),'interface'],'raw':!![]}]})[_0x2401('0x2c')](function(_0x12ae80){if(_0x12ae80){var _0x39d402=_[_0x2401('0x70')](_0x12ae80,function(_0x3cc659){var _0x22a041=_0x3cc659['get']({'plain':!![]});return _0x22a041[_0x2401('0x6d')];});return db[_0x2401('0x4a')]['find']({'where':{'id':_0x5239d7['params']['id']}})['then'](function(_0x4c1f98){return db['sequelize'][_0x2401('0x71')](function(_0x552ed1){return _0x4c1f98[_0x2401('0x6c')](_0x4f6349,{'transaction':_0x552ed1})[_0x2401('0x2c')](function(){return BPromise[_0x2401('0x72')](_0x39d402,function(_0x210eaf){return db[_0x2401('0x61')]['findOrCreate']({'where':{'UserId':_0x210eaf['id'],'SmsQueueId':_0x5239d7['params']['id']},'transaction':_0x552ed1});});})[_0x2401('0x2c')](function(){_0x39d402[_0x2401('0x73')](function(_0x5b2dc4){socket['emit'](_0x2401('0x74'),{'UserId':_0x5b2dc4['id'],'SmsQueueId':_0x4c1f98['id']});});});});});}})['then'](respondWithStatusCode(_0x1540a8,null))[_0x2401('0x50')](handleError(_0x1540a8,null));};exports[_0x2401('0x75')]=function(_0x566007,_0x41efab,_0x234806){return db[_0x2401('0x6a')][_0x2401('0x4e')]({'where':{'id':_0x566007[_0x2401('0x3c')][_0x2401('0x76')]},'attributes':['id'],'include':[{'model':db[_0x2401('0x62')],'as':_0x2401('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2401('0x2c')](handleEntityNotFound(_0x41efab,null))['then'](function(_0x2d476c){var _0x12ed6b=_[_0x2401('0x35')](_0x2d476c,'id');var _0x8d725b=[];var _0x55c65e=[];var _0x34582c=squel[_0x2401('0x77')]();_0x34582c[_0x2401('0x78')](_0x2401('0x79'))[_0x2401('0x7a')](_0x2401('0x7b'),'tq')[_0x2401('0x7c')](_0x2401('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2401('0x7e'),_0x566007[_0x2401('0x52')]['id']);for(var _0x268297=0x0;_0x268297<_0x2d476c[_0x2401('0x6b')];_0x268297+=0x1){let _0x65e4c3=_0x2d476c[_0x268297];for(var _0x2612a5=0x0;_0x2612a5<_0x65e4c3[_0x2401('0x6d')]['length'];_0x2612a5+=0x1){let _0x150553=_0x65e4c3[_0x2401('0x6d')][_0x2612a5];var _0x2edb79=_0x34582c['clone']();_0x2edb79['where'](_0x2401('0x7f'),_0x150553['id']);_0x55c65e[_0x2401('0x80')](db[_0x2401('0x81')][_0x2401('0x3c')](_0x2edb79[_0x2401('0x82')](),{'type':db['sequelize'][_0x2401('0x83')][_0x2401('0x84')]})[_0x2401('0x2c')](function(_0x2891ae){if(_0x2891ae['length']===0x1){return _0x150553['id'];}else{var _0x29e596=_['every'](_[_0x2401('0x35')](_0x2891ae,_0x2401('0x85')),function(_0x1a680a){return _[_0x2401('0x86')](_0x12ed6b,_0x1a680a);});if(_0x29e596){return _0x150553['id'];}}}));}}return BPromise[_0x2401('0x87')](_0x55c65e)[_0x2401('0x2c')](function(_0x296116){_0x8d725b=_(_0x8d725b)[_0x2401('0x88')](_0x296116)[_0x2401('0x89')]()[_0x2401('0x8a')]();return db[_0x2401('0x4a')][_0x2401('0x59')]({'where':{'id':_0x566007[_0x2401('0x52')]['id']}})[_0x2401('0x2c')](function(_0x49ac03){return db[_0x2401('0x81')][_0x2401('0x71')](function(_0x4a6b55){return _0x49ac03[_0x2401('0x75')](_0x566007['query'][_0x2401('0x76')],{'transaction':_0x4a6b55})[_0x2401('0x2c')](function(){if(!_[_0x2401('0x8b')](_0x8d725b)){return _0x49ac03[_0x2401('0x8c')](_0x8d725b,{'transaction':_0x4a6b55});}})[_0x2401('0x2c')](function(){_0x8d725b['forEach'](function(_0xe9c49b){socket['emit'](_0x2401('0x8d'),{'UserId':_0xe9c49b,'SmsQueueId':_0x49ac03['id']});});});});});});})[_0x2401('0x2c')](respondWithStatusCode(_0x41efab,null))[_0x2401('0x50')](handleError(_0x41efab,null));};exports['addAgents']=function(_0x2feb31,_0x5c770a,_0x869c25){return db[_0x2401('0x4a')][_0x2401('0x59')]({'where':{'id':_0x2feb31['params']['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x5c770a,null))[_0x2401('0x2c')](function(_0x1b1d81){if(_0x1b1d81){return _0x1b1d81[_0x2401('0x8e')](_0x2feb31[_0x2401('0x54')][_0x2401('0x76')],_[_0x2401('0x8f')](_0x2feb31[_0x2401('0x54')],[_0x2401('0x76'),'id'])||{})['spread'](function(_0x2aad28){for(var _0x4f1b68=0x0;_0x4f1b68<_0x2feb31['body'][_0x2401('0x76')][_0x2401('0x6b')];_0x4f1b68+=0x1){socket[_0x2401('0x90')](_0x2401('0x74'),{'UserId':Number(_0x2feb31[_0x2401('0x54')][_0x2401('0x76')][_0x4f1b68]),'SmsQueueId':Number(_0x2feb31[_0x2401('0x52')]['id'])});}return _0x2aad28;});}})[_0x2401('0x2c')](respondWithResult(_0x5c770a,null))[_0x2401('0x50')](handleError(_0x5c770a,null));};exports[_0x2401('0x8c')]=function(_0x595e5d,_0x37ed20,_0x588d6d){return db['SmsQueue'][_0x2401('0x59')]({'where':{'id':_0x595e5d[_0x2401('0x52')]['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x37ed20,null))[_0x2401('0x2c')](function(_0x38fb48){if(_0x38fb48){return _0x38fb48[_0x2401('0x8c')](_0x595e5d[_0x2401('0x3c')][_0x2401('0x76')])[_0x2401('0x2c')](function(){if(_[_0x2401('0x91')](_0x595e5d['query'][_0x2401('0x76')])){for(var _0x2c206f=0x0;_0x2c206f<_0x595e5d[_0x2401('0x3c')][_0x2401('0x76')]['length'];_0x2c206f+=0x1){socket[_0x2401('0x90')](_0x2401('0x8d'),{'UserId':Number(_0x595e5d[_0x2401('0x3c')][_0x2401('0x76')][_0x2c206f]),'SmsQueueId':Number(_0x595e5d[_0x2401('0x52')]['id'])});}}else{socket['emit'](_0x2401('0x8d'),{'UserId':Number(_0x595e5d[_0x2401('0x3c')]['ids']),'SmsQueueId':Number(_0x595e5d[_0x2401('0x52')]['id'])});}});}})[_0x2401('0x2c')](respondWithStatusCode(_0x37ed20,null))[_0x2401('0x50')](handleError(_0x37ed20,null));};exports[_0x2401('0x92')]=function(_0x5b8c66,_0x426cb7,_0x16f2eb){var _0x12551a={};var _0x47b002={};var _0xbc469a;var _0x1c0ed0;return db[_0x2401('0x4a')][_0x2401('0x5e')]({'where':{'id':_0x5b8c66['params']['id']}})[_0x2401('0x2c')](handleEntityNotFound(_0x426cb7,null))['then'](function(_0x323772){if(_0x323772){_0xbc469a=_0x323772;_0x47b002[_0x2401('0x3a')]=_['keys'](db['User'][_0x2401('0x36')]);_0x47b002[_0x2401('0x3c')]=_[_0x2401('0x3b')](_0x5b8c66[_0x2401('0x3c')]);_0x47b002[_0x2401('0x3d')]=_[_0x2401('0x3f')](_0x47b002[_0x2401('0x3a')],_0x47b002['query']);_0x12551a[_0x2401('0x3e')]=_['intersection'](_0x47b002[_0x2401('0x3a')],qs[_0x2401('0x40')](_0x5b8c66[_0x2401('0x3c')][_0x2401('0x40')]));_0x12551a['attributes']=_0x12551a[_0x2401('0x3e')]['length']?_0x12551a[_0x2401('0x3e')]:_0x47b002[_0x2401('0x3a')];_0x12551a[_0x2401('0x5f')]=qs[_0x2401('0x43')](_0x5b8c66[_0x2401('0x3c')]['sort']);_0x12551a[_0x2401('0x44')]=qs[_0x2401('0x3d')](_[_0x2401('0x45')](_0x5b8c66['query'],_0x47b002['filters']));if(_0x5b8c66['query'][_0x2401('0x46')]){_0x12551a[_0x2401('0x44')]=_[_0x2401('0x47')](_0x12551a[_0x2401('0x44')],{'$or':_[_0x2401('0x35')](_0x12551a[_0x2401('0x3e')],function(_0x5f3123){var _0x108221={};_0x108221[_0x5f3123]={'$like':'%'+_0x5b8c66[_0x2401('0x3c')][_0x2401('0x46')]+'%'};return _0x108221;})});}_0x12551a=_[_0x2401('0x47')]({},_0x12551a,_0x5b8c66['options']);return _0xbc469a[_0x2401('0x92')](_0x12551a);}})[_0x2401('0x2c')](function(_0x198122){if(_0x198122){_0x1c0ed0=_0x198122['length'];if(!_0x5b8c66[_0x2401('0x3c')]['hasOwnProperty'](_0x2401('0x42'))){_0x12551a[_0x2401('0x26')]=qs[_0x2401('0x26')](_0x5b8c66[_0x2401('0x3c')][_0x2401('0x26')]);_0x12551a[_0x2401('0x25')]=qs[_0x2401('0x25')](_0x5b8c66['query'][_0x2401('0x25')]);}return _0xbc469a['getAgents'](_0x12551a);}})[_0x2401('0x2c')](function(_0x405d20){if(_0x405d20){return _0x405d20?{'count':_0x1c0ed0,'rows':_0x405d20}:null;}})['then'](respondWithResult(_0x426cb7,null))[_0x2401('0x50')](handleError(_0x426cb7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d6eaa94..ad66a2a 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 _0xe55b=['hook','exports','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x224029,_0x463fda){var _0x509ead=function(_0x3d15b2){while(--_0x3d15b2){_0x224029['push'](_0x224029['shift']());}};_0x509ead(++_0x463fda);}(_0xe55b,0x142));var _0xbe55=function(_0x532685,_0x1a38c2){_0x532685=_0x532685-0x0;var _0x21426a=_0xe55b[_0x532685];return _0x21426a;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xbe55('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe55('0x1'),'afterUpdate':_0xbe55('0x2'),'afterDestroy':_0xbe55('0x3')};function emitEvent(_0x10a5b0){return function(_0xe01b79,_0x2a3404,_0x542d24){SmsQueueEvents['emit'](_0x10a5b0+':'+_0xe01b79['id'],_0xe01b79);SmsQueueEvents[_0xbe55('0x4')](_0x10a5b0,_0xe01b79);_0x542d24(null);};}for(var e in events){if(events[_0xbe55('0x5')](e)){var event=events[e];SmsQueue[_0xbe55('0x6')](e,emitEvent(event));}}module[_0xbe55('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x7c0a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4e3394,_0xf90364){var _0x3a5d65=function(_0x390985){while(--_0x390985){_0x4e3394['push'](_0x4e3394['shift']());}};_0x3a5d65(++_0xf90364);}(_0x7c0a,0x9c));var _0xa7c0=function(_0x4da626,_0x583923){_0x4da626=_0x4da626-0x0;var _0x28ba58=_0x7c0a[_0x4da626];return _0x28ba58;};'use strict';var EventEmitter=require(_0xa7c0('0x0'));var SmsQueue=require(_0xa7c0('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa7c0('0x2')](0x0);var events={'afterCreate':_0xa7c0('0x3'),'afterUpdate':_0xa7c0('0x4'),'afterDestroy':_0xa7c0('0x5')};function emitEvent(_0x4ae19f){return function(_0x93e272,_0x42e6a6,_0x2c6389){SmsQueueEvents['emit'](_0x4ae19f+':'+_0x93e272['id'],_0x93e272);SmsQueueEvents[_0xa7c0('0x6')](_0x4ae19f,_0x93e272);_0x2c6389(null);};}for(var e in events){if(events[_0xa7c0('0x7')](e)){var event=events[e];SmsQueue[_0xa7c0('0x8')](e,emitEvent(event));}}module[_0xa7c0('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 1463b96..4061a7b 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 _0xe4ce=['moment','request-promise','path','rimraf','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','api'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0xe4ce,0x147));var _0xee4c=function(_0x1b02d3,_0x2a28ca){_0x1b02d3=_0x1b02d3-0x0;var _0x26c4ed=_0xe4ce[_0x1b02d3];return _0x26c4ed;};'use strict';var _=require(_0xee4c('0x0'));var util=require(_0xee4c('0x1'));var logger=require('../../config/logger')(_0xee4c('0x2'));var moment=require(_0xee4c('0x3'));var BPromise=require('bluebird');var rp=require(_0xee4c('0x4'));var fs=require('fs');var path=require(_0xee4c('0x5'));var rimraf=require(_0xee4c('0x6'));var config=require('../../config/environment');var attributes=require(_0xee4c('0x7'));module['exports']=function(_0x29f777,_0xaf5570){return _0x29f777[_0xee4c('0x8')](_0xee4c('0x9'),attributes,{'tableName':_0xee4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd7c=['./smsQueue.attributes','exports','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd96162,_0x12f9ec){var _0x56076b=function(_0x53148f){while(--_0x53148f){_0xd96162['push'](_0xd96162['shift']());}};_0x56076b(++_0x12f9ec);}(_0xcd7c,0x162));var _0xccd7=function(_0x36a8fc,_0x35a32e){_0x36a8fc=_0x36a8fc-0x0;var _0x22c1a1=_0xcd7c[_0x36a8fc];return _0x22c1a1;};'use strict';var _=require(_0xccd7('0x0'));var util=require(_0xccd7('0x1'));var logger=require(_0xccd7('0x2'))(_0xccd7('0x3'));var moment=require(_0xccd7('0x4'));var BPromise=require(_0xccd7('0x5'));var rp=require(_0xccd7('0x6'));var fs=require('fs');var path=require(_0xccd7('0x7'));var rimraf=require(_0xccd7('0x8'));var config=require(_0xccd7('0x9'));var attributes=require(_0xccd7('0xa'));module[_0xccd7('0xb')]=function(_0x330998,_0x510a7e){return _0x330998[_0xccd7('0xc')]('SmsQueue',attributes,{'tableName':_0xccd7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 82f8116..51efb87 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 _0xfa8a=['catch','GetSmsQueue','options','limit','include','model','map','info','SmsQueue','find','raw','where','attributes','ShowSmsQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','then','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result'];(function(_0x1ed555,_0x163bb2){var _0x2ade3d=function(_0x26cea2){while(--_0x26cea2){_0x1ed555['push'](_0x1ed555['shift']());}};_0x2ade3d(++_0x163bb2);}(_0xfa8a,0x16d));var _0xafa8=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0xfa8a[_0x41aaa5];return _0x35c60f;};'use strict';var _=require('lodash');var util=require(_0xafa8('0x0'));var moment=require(_0xafa8('0x1'));var BPromise=require('bluebird');var rs=require(_0xafa8('0x2'));var fs=require('fs');var Redis=require(_0xafa8('0x3'));var db=require(_0xafa8('0x4'))['db'];var utils=require(_0xafa8('0x5'));var logger=require('../../config/logger')(_0xafa8('0x6'));var config=require(_0xafa8('0x7'));var jayson=require(_0xafa8('0x8'));var client=jayson['client'][_0xafa8('0x9')]({'port':0x232a});config[_0xafa8('0xa')]=_[_0xafa8('0xb')](config['redis'],{'host':_0xafa8('0xc'),'port':0x18eb});var socket=require(_0xafa8('0xd'))(new Redis(config['redis']));require(_0xafa8('0xe'))['register'](socket);function respondWithRpcPromise(_0x1ed01f,_0x44c575,_0x34c2b6){return new BPromise(function(_0x16a8b1,_0x49180c){return client['request'](_0x1ed01f,_0x34c2b6)[_0xafa8('0xf')](function(_0x135a9a){logger['info']('SmsQueue,\x20%s,\x20%s',_0x44c575,'request\x20sent');logger[_0xafa8('0x10')](_0xafa8('0x11'),_0x44c575,_0xafa8('0x12'),JSON[_0xafa8('0x13')](_0x135a9a));if(_0x135a9a[_0xafa8('0x14')]){if(_0x135a9a[_0xafa8('0x14')][_0xafa8('0x15')]===0x1f4){logger['error'](_0xafa8('0x16'),_0x44c575,_0x135a9a['error'][_0xafa8('0x17')]);return _0x49180c(_0x135a9a[_0xafa8('0x14')][_0xafa8('0x17')]);}logger[_0xafa8('0x14')](_0xafa8('0x16'),_0x44c575,_0x135a9a[_0xafa8('0x14')][_0xafa8('0x17')]);return _0x16a8b1(_0x135a9a['error'][_0xafa8('0x17')]);}else{logger['info'](_0xafa8('0x16'),_0x44c575,_0xafa8('0x12'));_0x16a8b1(_0x135a9a[_0xafa8('0x18')][_0xafa8('0x17')]);}})[_0xafa8('0x19')](function(_0x4080bc){logger[_0xafa8('0x14')](_0xafa8('0x16'),_0x44c575,_0x4080bc);_0x49180c(_0x4080bc);});});}exports[_0xafa8('0x1a')]=function(_0x28ee78){var _0xf559f=this;return new Promise(function(_0x171099,_0x1ef5cf){return db['SmsQueue']['findAll']({'raw':_0x28ee78[_0xafa8('0x1b')]?_0x28ee78[_0xafa8('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x28ee78[_0xafa8('0x1b')]?_0x28ee78[_0xafa8('0x1b')]['where']||null:null,'attributes':_0x28ee78[_0xafa8('0x1b')]?_0x28ee78['options']['attributes']||null:null,'limit':_0x28ee78[_0xafa8('0x1b')]?_0x28ee78[_0xafa8('0x1b')][_0xafa8('0x1c')]||null:null,'include':_0x28ee78['options']?_0x28ee78[_0xafa8('0x1b')][_0xafa8('0x1d')]?_['map'](_0x28ee78[_0xafa8('0x1b')][_0xafa8('0x1d')],function(_0x1040e2){return{'model':db[_0x1040e2[_0xafa8('0x1e')]],'as':_0x1040e2['as'],'attributes':_0x1040e2['attributes'],'include':_0x1040e2[_0xafa8('0x1d')]?_[_0xafa8('0x1f')](_0x1040e2[_0xafa8('0x1d')],function(_0x462fa2){return{'model':db[_0x462fa2[_0xafa8('0x1e')]],'as':_0x462fa2['as'],'attributes':_0x462fa2['attributes'],'include':_0x462fa2[_0xafa8('0x1d')]?_['map'](_0x462fa2['include'],function(_0x4ddaf7){return{'model':db[_0x4ddaf7['model']],'as':_0x4ddaf7['as'],'attributes':_0x4ddaf7['attributes']};}):[]};}):[]};}):[]:[]})[_0xafa8('0xf')](function(_0x32f940){logger[_0xafa8('0x20')](_0xafa8('0x1a'),_0x28ee78);logger[_0xafa8('0x10')](_0xafa8('0x1a'),_0x28ee78,JSON['stringify'](_0x32f940));_0x171099(_0x32f940);})['catch'](function(_0x549d8f){logger[_0xafa8('0x14')]('GetSmsQueue',_0x549d8f[_0xafa8('0x17')],_0x28ee78);_0x1ef5cf(_0xf559f[_0xafa8('0x14')](0x1f4,_0x549d8f[_0xafa8('0x17')]));});});};exports['ShowSmsQueue']=function(_0x4165ac){var _0x165f45=this;return new Promise(function(_0x4914a1,_0x4b9848){return db[_0xafa8('0x21')][_0xafa8('0x22')]({'raw':_0x4165ac['options']?_0x4165ac[_0xafa8('0x1b')][_0xafa8('0x23')]===undefined?!![]:![]:!![],'where':_0x4165ac[_0xafa8('0x1b')]?_0x4165ac['options'][_0xafa8('0x24')]||null:null,'attributes':_0x4165ac[_0xafa8('0x1b')]?_0x4165ac['options'][_0xafa8('0x25')]||null:null,'include':_0x4165ac[_0xafa8('0x1b')]?_0x4165ac['options'][_0xafa8('0x1d')]?_[_0xafa8('0x1f')](_0x4165ac['options']['include'],function(_0x395295){return{'model':db[_0x395295['model']],'as':_0x395295['as'],'attributes':_0x395295['attributes'],'include':_0x395295[_0xafa8('0x1d')]?_['map'](_0x395295[_0xafa8('0x1d')],function(_0x149b56){return{'model':db[_0x149b56[_0xafa8('0x1e')]],'as':_0x149b56['as'],'attributes':_0x149b56[_0xafa8('0x25')],'include':_0x149b56[_0xafa8('0x1d')]?_[_0xafa8('0x1f')](_0x149b56['include'],function(_0x2e2ae4){return{'model':db[_0x2e2ae4[_0xafa8('0x1e')]],'as':_0x2e2ae4['as'],'attributes':_0x2e2ae4[_0xafa8('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2781f9){logger[_0xafa8('0x20')](_0xafa8('0x26'),_0x4165ac);logger['debug'](_0xafa8('0x26'),_0x4165ac,JSON[_0xafa8('0x13')](_0x2781f9));_0x4914a1(_0x2781f9);})[_0xafa8('0x19')](function(_0x1ae545){logger[_0xafa8('0x14')](_0xafa8('0x26'),_0x1ae545[_0xafa8('0x17')],_0x4165ac);_0x4b9848(_0x165f45[_0xafa8('0x14')](0x1f4,_0x1ae545[_0xafa8('0x17')]));});});}; \ No newline at end of file +var _0x8d3e=['findAll','options','raw','where','attributes','map','model','include','then','debug','find','ShowSmsQueue','lodash','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','request','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSmsQueue','SmsQueue'];(function(_0x4c25cb,_0xce5c6c){var _0x5a61f2=function(_0x5ad642){while(--_0x5ad642){_0x4c25cb['push'](_0x4c25cb['shift']());}};_0x5a61f2(++_0xce5c6c);}(_0x8d3e,0x1bc));var _0xe8d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d3e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe8d3('0x0'));var util=require('util');var moment=require(_0xe8d3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8d3('0x2'))['db'];var utils=require(_0xe8d3('0x3'));var logger=require('../../config/logger')(_0xe8d3('0x4'));var config=require(_0xe8d3('0x5'));var jayson=require(_0xe8d3('0x6'));var client=jayson['client'][_0xe8d3('0x7')]({'port':0x232a});config[_0xe8d3('0x8')]=_[_0xe8d3('0x9')](config[_0xe8d3('0x8')],{'host':_0xe8d3('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8d3('0x8')]));require(_0xe8d3('0xb'))['register'](socket);function respondWithRpcPromise(_0x3a3b24,_0x21880d,_0x139ab9){return new BPromise(function(_0x5ca1a0,_0x2a6e2c){return client[_0xe8d3('0xc')](_0x3a3b24,_0x139ab9)['then'](function(_0x27b4a2){logger['info'](_0xe8d3('0xd'),_0x21880d,_0xe8d3('0xe'));logger['debug'](_0xe8d3('0xf'),_0x21880d,_0xe8d3('0xe'),JSON[_0xe8d3('0x10')](_0x27b4a2));if(_0x27b4a2['error']){if(_0x27b4a2[_0xe8d3('0x11')]['code']===0x1f4){logger[_0xe8d3('0x11')](_0xe8d3('0xd'),_0x21880d,_0x27b4a2[_0xe8d3('0x11')][_0xe8d3('0x12')]);return _0x2a6e2c(_0x27b4a2[_0xe8d3('0x11')][_0xe8d3('0x12')]);}logger[_0xe8d3('0x11')]('SmsQueue,\x20%s,\x20%s',_0x21880d,_0x27b4a2[_0xe8d3('0x11')][_0xe8d3('0x12')]);return _0x5ca1a0(_0x27b4a2[_0xe8d3('0x11')]['message']);}else{logger[_0xe8d3('0x13')]('SmsQueue,\x20%s,\x20%s',_0x21880d,'request\x20sent');_0x5ca1a0(_0x27b4a2[_0xe8d3('0x14')][_0xe8d3('0x12')]);}})[_0xe8d3('0x15')](function(_0x2811d7){logger[_0xe8d3('0x11')](_0xe8d3('0xd'),_0x21880d,_0x2811d7);_0x2a6e2c(_0x2811d7);});});}exports[_0xe8d3('0x16')]=function(_0x2a9f39){var _0x2f4458=this;return new Promise(function(_0x4d1f79,_0x321d3c){return db[_0xe8d3('0x17')][_0xe8d3('0x18')]({'raw':_0x2a9f39[_0xe8d3('0x19')]?_0x2a9f39[_0xe8d3('0x19')][_0xe8d3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2a9f39[_0xe8d3('0x19')]?_0x2a9f39[_0xe8d3('0x19')][_0xe8d3('0x1b')]||null:null,'attributes':_0x2a9f39[_0xe8d3('0x19')]?_0x2a9f39[_0xe8d3('0x19')][_0xe8d3('0x1c')]||null:null,'limit':_0x2a9f39['options']?_0x2a9f39[_0xe8d3('0x19')]['limit']||null:null,'include':_0x2a9f39[_0xe8d3('0x19')]?_0x2a9f39[_0xe8d3('0x19')]['include']?_[_0xe8d3('0x1d')](_0x2a9f39[_0xe8d3('0x19')]['include'],function(_0x1c9a77){return{'model':db[_0x1c9a77[_0xe8d3('0x1e')]],'as':_0x1c9a77['as'],'attributes':_0x1c9a77['attributes'],'include':_0x1c9a77[_0xe8d3('0x1f')]?_[_0xe8d3('0x1d')](_0x1c9a77[_0xe8d3('0x1f')],function(_0x4ee081){return{'model':db[_0x4ee081[_0xe8d3('0x1e')]],'as':_0x4ee081['as'],'attributes':_0x4ee081['attributes'],'include':_0x4ee081[_0xe8d3('0x1f')]?_[_0xe8d3('0x1d')](_0x4ee081[_0xe8d3('0x1f')],function(_0x461eeb){return{'model':db[_0x461eeb[_0xe8d3('0x1e')]],'as':_0x461eeb['as'],'attributes':_0x461eeb[_0xe8d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8d3('0x20')](function(_0x2e6c2e){logger[_0xe8d3('0x13')](_0xe8d3('0x16'),_0x2a9f39);logger[_0xe8d3('0x21')](_0xe8d3('0x16'),_0x2a9f39,JSON[_0xe8d3('0x10')](_0x2e6c2e));_0x4d1f79(_0x2e6c2e);})[_0xe8d3('0x15')](function(_0x8402d2){logger[_0xe8d3('0x11')](_0xe8d3('0x16'),_0x8402d2[_0xe8d3('0x12')],_0x2a9f39);_0x321d3c(_0x2f4458[_0xe8d3('0x11')](0x1f4,_0x8402d2[_0xe8d3('0x12')]));});});};exports['ShowSmsQueue']=function(_0x37f475){var _0x23ddfb=this;return new Promise(function(_0x1c090e,_0x1636fe){return db[_0xe8d3('0x17')][_0xe8d3('0x22')]({'raw':_0x37f475[_0xe8d3('0x19')]?_0x37f475[_0xe8d3('0x19')][_0xe8d3('0x1a')]===undefined?!![]:![]:!![],'where':_0x37f475[_0xe8d3('0x19')]?_0x37f475[_0xe8d3('0x19')]['where']||null:null,'attributes':_0x37f475[_0xe8d3('0x19')]?_0x37f475['options'][_0xe8d3('0x1c')]||null:null,'include':_0x37f475[_0xe8d3('0x19')]?_0x37f475[_0xe8d3('0x19')][_0xe8d3('0x1f')]?_[_0xe8d3('0x1d')](_0x37f475[_0xe8d3('0x19')][_0xe8d3('0x1f')],function(_0x2315c2){return{'model':db[_0x2315c2[_0xe8d3('0x1e')]],'as':_0x2315c2['as'],'attributes':_0x2315c2['attributes'],'include':_0x2315c2['include']?_[_0xe8d3('0x1d')](_0x2315c2['include'],function(_0x40648d){return{'model':db[_0x40648d['model']],'as':_0x40648d['as'],'attributes':_0x40648d[_0xe8d3('0x1c')],'include':_0x40648d[_0xe8d3('0x1f')]?_[_0xe8d3('0x1d')](_0x40648d[_0xe8d3('0x1f')],function(_0x2f4b72){return{'model':db[_0x2f4b72[_0xe8d3('0x1e')]],'as':_0x2f4b72['as'],'attributes':_0x2f4b72[_0xe8d3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe8d3('0x20')](function(_0x84d0f9){logger['info']('ShowSmsQueue',_0x37f475);logger[_0xe8d3('0x21')](_0xe8d3('0x23'),_0x37f475,JSON[_0xe8d3('0x10')](_0x84d0f9));_0x1c090e(_0x84d0f9);})[_0xe8d3('0x15')](function(_0x7aa55f){logger[_0xe8d3('0x11')]('ShowSmsQueue',_0x7aa55f[_0xe8d3('0x12')],_0x37f475);_0x1636fe(_0x23ddfb[_0xe8d3('0x11')](0x1f4,_0x7aa55f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 100d28d..7060b15 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 _0x4071=['smsQueue:','./smsQueue.events','remove','emit','removeListener','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4071,0x199));var _0x1407=function(_0x5cdd35,_0x5285de){_0x5cdd35=_0x5cdd35-0x0;var _0x431f1f=_0x4071[_0x5cdd35];return _0x431f1f;};'use strict';var SmsQueueEvents=require(_0x1407('0x0'));var events=['save',_0x1407('0x1'),'update'];function createListener(_0xdde964,_0x1661f9){return function(_0x16eb1f){_0x1661f9[_0x1407('0x2')](_0xdde964,_0x16eb1f);};}function removeListener(_0x2abaed,_0x1691a0){return function(){SmsQueueEvents[_0x1407('0x3')](_0x2abaed,_0x1691a0);};}exports['register']=function(_0x2e1d8c){for(var _0xfa156e=0x0,_0x45446b=events[_0x1407('0x4')];_0xfa156e<_0x45446b;_0xfa156e++){var _0x32a2fb=events[_0xfa156e];var _0x46e08b=createListener(_0x1407('0x5')+_0x32a2fb,_0x2e1d8c);SmsQueueEvents['on'](_0x32a2fb,_0x46e08b);}}; \ No newline at end of file +var _0x95a7=['length','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x95a7,0x161));var _0x795a=function(_0x845041,_0x1c2043){_0x845041=_0x845041-0x0;var _0x2f8542=_0x95a7[_0x845041];return _0x2f8542;};'use strict';var SmsQueueEvents=require(_0x795a('0x0'));var events=[_0x795a('0x1'),_0x795a('0x2'),_0x795a('0x3')];function createListener(_0x2e84e0,_0x7e4938){return function(_0x29b1ee){_0x7e4938[_0x795a('0x4')](_0x2e84e0,_0x29b1ee);};}function removeListener(_0x361462,_0x3039b8){return function(){SmsQueueEvents[_0x795a('0x5')](_0x361462,_0x3039b8);};}exports[_0x795a('0x6')]=function(_0x37b803){for(var _0x54b9eb=0x0,_0x1f2cff=events[_0x795a('0x7')];_0x54b9eb<_0x1f2cff;_0x54b9eb++){var _0x100a52=events[_0x54b9eb];var _0x5c9926=createListener('smsQueue:'+_0x100a52,_0x37b803);SmsQueueEvents['on'](_0x100a52,_0x5c9926);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e26b9ce..e76c485 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 _0x3912=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x23a83a,_0x3921bd){var _0x105b0d=function(_0x1d25a7){while(--_0x1d25a7){_0x23a83a['push'](_0x23a83a['shift']());}};_0x105b0d(++_0x3921bd);}(_0x3912,0xa9));var _0x2391=function(_0x4d66dc,_0x3373e0){_0x4d66dc=_0x4d66dc-0x0;var _0x24cb1a=_0x3912[_0x4d66dc];return _0x24cb1a;};'use strict';var multer=require(_0x2391('0x0'));var util=require(_0x2391('0x1'));var path=require('path');var timeout=require(_0x2391('0x2'));var express=require(_0x2391('0x3'));var router=express[_0x2391('0x4')]();var fs_extra=require(_0x2391('0x5'));var auth=require(_0x2391('0x6'));var interaction=require(_0x2391('0x7'));var config=require(_0x2391('0x8'));var controller=require(_0x2391('0x9'));router[_0x2391('0xa')]('/',auth[_0x2391('0xb')](),controller[_0x2391('0xc')]);router[_0x2391('0xa')](_0x2391('0xd'),auth[_0x2391('0xb')](),controller[_0x2391('0xe')]);router[_0x2391('0xa')](_0x2391('0xf'),auth[_0x2391('0xb')](),controller[_0x2391('0x10')]);router[_0x2391('0x11')]('/',auth[_0x2391('0xb')](),controller['create']);router[_0x2391('0x12')](_0x2391('0xf'),auth[_0x2391('0xb')](),controller[_0x2391('0x13')]);router[_0x2391('0x14')](_0x2391('0xf'),auth[_0x2391('0xb')](),controller[_0x2391('0x15')]);module[_0x2391('0x16')]=router; \ No newline at end of file +var _0xf77f=['describe','show','post','create','put','/:id','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x4c2ba3,_0x1696d8){var _0xca6c93=function(_0x49d209){while(--_0x49d209){_0x4c2ba3['push'](_0x4c2ba3['shift']());}};_0xca6c93(++_0x1696d8);}(_0xf77f,0x134));var _0xff77=function(_0x1aba25,_0x1faed1){_0x1aba25=_0x1aba25-0x0;var _0x47d997=_0xf77f[_0x1aba25];return _0x47d997;};'use strict';var multer=require(_0xff77('0x0'));var util=require('util');var path=require(_0xff77('0x1'));var timeout=require(_0xff77('0x2'));var express=require(_0xff77('0x3'));var router=express[_0xff77('0x4')]();var fs_extra=require(_0xff77('0x5'));var auth=require(_0xff77('0x6'));var interaction=require(_0xff77('0x7'));var config=require(_0xff77('0x8'));var controller=require('./smsQueueReport.controller');router[_0xff77('0x9')]('/',auth[_0xff77('0xa')](),controller['index']);router['get'](_0xff77('0xb'),auth[_0xff77('0xa')](),controller[_0xff77('0xc')]);router[_0xff77('0x9')]('/:id',auth[_0xff77('0xa')](),controller[_0xff77('0xd')]);router[_0xff77('0xe')]('/',auth[_0xff77('0xa')](),controller[_0xff77('0xf')]);router[_0xff77('0x10')](_0xff77('0x11'),auth['isAuthenticated'](),controller[_0xff77('0x12')]);router[_0xff77('0x13')](_0xff77('0x11'),auth[_0xff77('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 5387ae7..0378cf7 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 _0x13ac=['exports','STRING','DATE','moment','sequelize'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x13ac,0x139));var _0xc13a=function(_0x2a08df,_0x2fc61c){_0x2a08df=_0x2a08df-0x0;var _0x1f8399=_0x13ac[_0x2a08df];return _0x1f8399;};'use strict';var moment=require(_0xc13a('0x0'));var Sequelize=require(_0xc13a('0x1'));module[_0xc13a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc13a('0x3')]},'joinAt':{'type':Sequelize[_0xc13a('0x4')]},'leaveAt':{'type':Sequelize[_0xc13a('0x4')]},'acceptAt':{'type':Sequelize[_0xc13a('0x4')]},'exitAt':{'type':Sequelize[_0xc13a('0x4')]},'reason':{'type':Sequelize[_0xc13a('0x3')]}}; \ No newline at end of file +var _0xd23d=['DATE','sequelize','exports','STRING'];(function(_0x19159a,_0x1cb5c3){var _0xa677f4=function(_0x24bb85){while(--_0x24bb85){_0x19159a['push'](_0x19159a['shift']());}};_0xa677f4(++_0x1cb5c3);}(_0xd23d,0xed));var _0xdd23=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xd23d[_0x22eb96];return _0x5e1adf;};'use strict';var moment=require('moment');var Sequelize=require(_0xdd23('0x0'));module[_0xdd23('0x1')]={'uniqueid':{'type':Sequelize[_0xdd23('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdd23('0x3')]},'leaveAt':{'type':Sequelize[_0xdd23('0x3')]},'acceptAt':{'type':Sequelize[_0xdd23('0x3')]},'exitAt':{'type':Sequelize[_0xdd23('0x3')]},'reason':{'type':Sequelize[_0xdd23('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 7b4480c..a71a9af 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 _0x4abd=['SmsQueueReport','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','stack','name','map'];(function(_0x587980,_0x103f80){var _0x2a4054=function(_0x6d7f74){while(--_0x6d7f74){_0x587980['push'](_0x587980['shift']());}};_0x2a4054(++_0x103f80);}(_0x4abd,0x18e));var _0xd4ab=function(_0x5bcdb9,_0x2bef44){_0x5bcdb9=_0x5bcdb9-0x0;var _0x4f0dda=_0x4abd[_0x5bcdb9];return _0x4f0dda;};'use strict';var emlformat=require(_0xd4ab('0x0'));var rimraf=require(_0xd4ab('0x1'));var zipdir=require(_0xd4ab('0x2'));var jsonpatch=require(_0xd4ab('0x3'));var rp=require(_0xd4ab('0x4'));var moment=require(_0xd4ab('0x5'));var BPromise=require(_0xd4ab('0x6'));var Mustache=require(_0xd4ab('0x7'));var util=require('util');var path=require(_0xd4ab('0x8'));var sox=require('sox');var csv=require(_0xd4ab('0x9'));var ejs=require(_0xd4ab('0xa'));var fs=require('fs');var fs_extra=require(_0xd4ab('0xb'));var _=require(_0xd4ab('0xc'));var squel=require('squel');var crypto=require(_0xd4ab('0xd'));var jsforce=require(_0xd4ab('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd4ab('0xf'));var Papa=require(_0xd4ab('0x10'));var Redis=require(_0xd4ab('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd4ab('0x12'));var hardwareService=require(_0xd4ab('0x13'));var logger=require(_0xd4ab('0x14'))('api');var utils=require(_0xd4ab('0x15'));var config=require(_0xd4ab('0x16'));var licenseUtil=require(_0xd4ab('0x17'));var db=require(_0xd4ab('0x18'))['db'];function respondWithStatusCode(_0x15cf48,_0x124c99){_0x124c99=_0x124c99||0xcc;return function(_0xd52db6){if(_0xd52db6){return _0x15cf48[_0xd4ab('0x19')](_0x124c99);}return _0x15cf48[_0xd4ab('0x1a')](_0x124c99)[_0xd4ab('0x1b')]();};}function respondWithResult(_0x1118aa,_0x2cac2a){_0x2cac2a=_0x2cac2a||0xc8;return function(_0x234331){if(_0x234331){return _0x1118aa['status'](_0x2cac2a)[_0xd4ab('0x1c')](_0x234331);}};}function respondWithFilteredResult(_0x5649c9,_0x581923){return function(_0x5b5231){if(_0x5b5231){var _0x27bd17=typeof _0x581923[_0xd4ab('0x1d')]===_0xd4ab('0x1e')&&typeof _0x581923['limit']===_0xd4ab('0x1e');var _0x1cdd7f=_0x5b5231[_0xd4ab('0x1f')];var _0x434c7e=_0x27bd17?0x0:_0x581923[_0xd4ab('0x1d')];var _0x278f87=_0x27bd17?_0x5b5231[_0xd4ab('0x1f')]:_0x581923['offset']+_0x581923[_0xd4ab('0x20')];var _0x1db731;if(_0x278f87>=_0x1cdd7f){_0x278f87=_0x1cdd7f;_0x1db731=0xc8;}else{_0x1db731=0xce;}_0x5649c9[_0xd4ab('0x1a')](_0x1db731);return _0x5649c9[_0xd4ab('0x21')](_0xd4ab('0x22'),_0x434c7e+'-'+_0x278f87+'/'+_0x1cdd7f)[_0xd4ab('0x1c')](_0x5b5231);}return null;};}function patchUpdates(_0x574e55){return function(_0x238082){try{jsonpatch[_0xd4ab('0x23')](_0x238082,_0x574e55,!![]);}catch(_0x364c0f){return BPromise['reject'](_0x364c0f);}return _0x238082['save']();};}function saveUpdates(_0x37ffe6,_0x23772a){return function(_0x3c4c1b){if(_0x3c4c1b){return _0x3c4c1b['update'](_0x37ffe6)[_0xd4ab('0x24')](function(_0x1e9408){return _0x1e9408;});}return null;};}function removeEntity(_0x5b9253,_0x4b0177){return function(_0x130ea6){if(_0x130ea6){return _0x130ea6['destroy']()[_0xd4ab('0x24')](function(){_0x5b9253['status'](0xcc)[_0xd4ab('0x1b')]();});}};}function handleEntityNotFound(_0x54cfca,_0x3abbc5){return function(_0x2a46c2){if(!_0x2a46c2){_0x54cfca[_0xd4ab('0x19')](0x194);}return _0x2a46c2;};}function handleError(_0x333391,_0x3de976){_0x3de976=_0x3de976||0x1f4;return function(_0x53711a){logger['error'](_0x53711a[_0xd4ab('0x25')]);if(_0x53711a[_0xd4ab('0x26')]){delete _0x53711a[_0xd4ab('0x26')];}_0x333391[_0xd4ab('0x1a')](_0x3de976)['send'](_0x53711a);};}exports['index']=function(_0x2541a7,_0x5b9fc2){var _0x18aeeb={},_0x19b79f={},_0x3d722f={'count':0x0,'rows':[]};var _0x88cfdf=_[_0xd4ab('0x27')](db[_0xd4ab('0x28')][_0xd4ab('0x29')],function(_0x57b236){return{'name':_0x57b236[_0xd4ab('0x2a')],'type':_0x57b236['type']['key']};});_0x19b79f['model']=_[_0xd4ab('0x27')](_0x88cfdf,_0xd4ab('0x26'));_0x19b79f[_0xd4ab('0x2b')]=_[_0xd4ab('0x2c')](_0x2541a7['query']);_0x19b79f[_0xd4ab('0x2d')]=_[_0xd4ab('0x2e')](_0x19b79f[_0xd4ab('0x2f')],_0x19b79f[_0xd4ab('0x2b')]);_0x18aeeb['attributes']=_[_0xd4ab('0x2e')](_0x19b79f[_0xd4ab('0x2f')],qs[_0xd4ab('0x30')](_0x2541a7['query'][_0xd4ab('0x30')]));_0x18aeeb['attributes']=_0x18aeeb['attributes']['length']?_0x18aeeb[_0xd4ab('0x31')]:_0x19b79f[_0xd4ab('0x2f')];if(!_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x32')]('nolimit')){_0x18aeeb[_0xd4ab('0x20')]=qs[_0xd4ab('0x20')](_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x20')]);_0x18aeeb[_0xd4ab('0x1d')]=qs[_0xd4ab('0x1d')](_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x1d')]);}_0x18aeeb[_0xd4ab('0x33')]=qs[_0xd4ab('0x34')](_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x34')]);_0x18aeeb['where']=qs[_0xd4ab('0x2d')](_['pick'](_0x2541a7['query'],_0x19b79f[_0xd4ab('0x2d')]),_0x88cfdf);if(_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x35')]){_0x18aeeb[_0xd4ab('0x36')]=_[_0xd4ab('0x37')](_0x18aeeb['where'],{'$or':_[_0xd4ab('0x27')](_0x88cfdf,function(_0xd9d816){if(_0xd9d816[_0xd4ab('0x38')]!==_0xd4ab('0x39')){var _0x5b08d1={};_0x5b08d1[_0xd9d816[_0xd4ab('0x26')]]={'$like':'%'+_0x2541a7['query'][_0xd4ab('0x35')]+'%'};return _0x5b08d1;}})});}_0x18aeeb=_[_0xd4ab('0x37')]({},_0x18aeeb,_0x2541a7['options']);var _0x5860f6={'where':_0x18aeeb[_0xd4ab('0x36')]};return db['SmsQueueReport'][_0xd4ab('0x1f')](_0x5860f6)[_0xd4ab('0x24')](function(_0x409058){_0x3d722f[_0xd4ab('0x1f')]=_0x409058;if(_0x2541a7[_0xd4ab('0x2b')][_0xd4ab('0x3a')]){_0x18aeeb[_0xd4ab('0x3b')]=[{'all':!![]}];}return db[_0xd4ab('0x28')][_0xd4ab('0x3c')](_0x18aeeb);})['then'](function(_0x15468a){_0x3d722f[_0xd4ab('0x3d')]=_0x15468a;return _0x3d722f;})[_0xd4ab('0x24')](respondWithFilteredResult(_0x5b9fc2,_0x18aeeb))[_0xd4ab('0x3e')](handleError(_0x5b9fc2,null));};exports[_0xd4ab('0x3f')]=function(_0x3471c7,_0x3b0721){var _0x5282a5={'raw':!![],'where':{'id':_0x3471c7[_0xd4ab('0x40')]['id']}},_0x2c4355={};_0x2c4355[_0xd4ab('0x2f')]=_['keys'](db[_0xd4ab('0x28')][_0xd4ab('0x29')]);_0x2c4355[_0xd4ab('0x2b')]=_[_0xd4ab('0x2c')](_0x3471c7[_0xd4ab('0x2b')]);_0x2c4355['filters']=_['intersection'](_0x2c4355[_0xd4ab('0x2f')],_0x2c4355['query']);_0x5282a5['attributes']=_[_0xd4ab('0x2e')](_0x2c4355[_0xd4ab('0x2f')],qs[_0xd4ab('0x30')](_0x3471c7[_0xd4ab('0x2b')][_0xd4ab('0x30')]));_0x5282a5[_0xd4ab('0x31')]=_0x5282a5[_0xd4ab('0x31')][_0xd4ab('0x41')]?_0x5282a5['attributes']:_0x2c4355[_0xd4ab('0x2f')];if(_0x3471c7[_0xd4ab('0x2b')][_0xd4ab('0x3a')]){_0x5282a5['include']=[{'all':!![]}];}_0x5282a5=_[_0xd4ab('0x37')]({},_0x5282a5,_0x3471c7[_0xd4ab('0x42')]);return db[_0xd4ab('0x28')][_0xd4ab('0x43')](_0x5282a5)['then'](handleEntityNotFound(_0x3b0721,null))[_0xd4ab('0x24')](respondWithResult(_0x3b0721,null))['catch'](handleError(_0x3b0721,null));};exports['create']=function(_0x2014fe,_0x24a682){return db['SmsQueueReport'][_0xd4ab('0x44')](_0x2014fe[_0xd4ab('0x45')],{})[_0xd4ab('0x24')](respondWithResult(_0x24a682,0xc9))[_0xd4ab('0x3e')](handleError(_0x24a682,null));};exports[_0xd4ab('0x46')]=function(_0x555813,_0x580f2){if(_0x555813[_0xd4ab('0x45')]['id']){delete _0x555813['body']['id'];}return db['SmsQueueReport'][_0xd4ab('0x43')]({'where':{'id':_0x555813[_0xd4ab('0x40')]['id']}})[_0xd4ab('0x24')](handleEntityNotFound(_0x580f2,null))[_0xd4ab('0x24')](saveUpdates(_0x555813[_0xd4ab('0x45')],null))[_0xd4ab('0x24')](respondWithResult(_0x580f2,null))[_0xd4ab('0x3e')](handleError(_0x580f2,null));};exports[_0xd4ab('0x47')]=function(_0x1a4123,_0x1434ec){return db[_0xd4ab('0x28')][_0xd4ab('0x43')]({'where':{'id':_0x1a4123['params']['id']}})[_0xd4ab('0x24')](handleEntityNotFound(_0x1434ec,null))[_0xd4ab('0x24')](removeEntity(_0x1434ec,null))['catch'](handleError(_0x1434ec,null));};exports['describe']=function(_0x10a8c1,_0x583aec){return db['SmsQueueReport'][_0xd4ab('0x48')]()[_0xd4ab('0x24')](respondWithResult(_0x583aec,null))[_0xd4ab('0x3e')](handleError(_0x583aec,null));}; \ No newline at end of file +var _0xfd45=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','json','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','options','SmsQueueReport','includeAll','findAll','rows','catch','params','keys','length','merge','create','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd45,0x156));var _0x5fd4=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xfd45[_0x5834bc];return _0x3e183a;};'use strict';var emlformat=require(_0x5fd4('0x0'));var rimraf=require(_0x5fd4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5fd4('0x2'));var rp=require(_0x5fd4('0x3'));var moment=require(_0x5fd4('0x4'));var BPromise=require(_0x5fd4('0x5'));var Mustache=require(_0x5fd4('0x6'));var util=require(_0x5fd4('0x7'));var path=require(_0x5fd4('0x8'));var sox=require(_0x5fd4('0x9'));var csv=require(_0x5fd4('0xa'));var ejs=require(_0x5fd4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5fd4('0xc'));var squel=require('squel');var crypto=require(_0x5fd4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5fd4('0xe'));var toCsv=require(_0x5fd4('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5fd4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5fd4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5fd4('0x11'));var logger=require('../../config/logger')(_0x5fd4('0x12'));var utils=require(_0x5fd4('0x13'));var config=require(_0x5fd4('0x14'));var licenseUtil=require(_0x5fd4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2739a6,_0x52fa31){_0x52fa31=_0x52fa31||0xcc;return function(_0x54ebaf){if(_0x54ebaf){return _0x2739a6[_0x5fd4('0x16')](_0x52fa31);}return _0x2739a6[_0x5fd4('0x17')](_0x52fa31)[_0x5fd4('0x18')]();};}function respondWithResult(_0x2f8488,_0x588b77){_0x588b77=_0x588b77||0xc8;return function(_0x230e5e){if(_0x230e5e){return _0x2f8488['status'](_0x588b77)['json'](_0x230e5e);}};}function respondWithFilteredResult(_0x1a4269,_0x1b6470){return function(_0xd93780){if(_0xd93780){var _0x500110=typeof _0x1b6470[_0x5fd4('0x19')]===_0x5fd4('0x1a')&&typeof _0x1b6470['limit']===_0x5fd4('0x1a');var _0x37362e=_0xd93780[_0x5fd4('0x1b')];var _0x4f1e72=_0x500110?0x0:_0x1b6470[_0x5fd4('0x19')];var _0x4b3eca=_0x500110?_0xd93780['count']:_0x1b6470[_0x5fd4('0x19')]+_0x1b6470['limit'];var _0x31b1c8;if(_0x4b3eca>=_0x37362e){_0x4b3eca=_0x37362e;_0x31b1c8=0xc8;}else{_0x31b1c8=0xce;}_0x1a4269['status'](_0x31b1c8);return _0x1a4269[_0x5fd4('0x1c')]('Content-Range',_0x4f1e72+'-'+_0x4b3eca+'/'+_0x37362e)[_0x5fd4('0x1d')](_0xd93780);}return null;};}function patchUpdates(_0x44c597){return function(_0x29c9ae){try{jsonpatch[_0x5fd4('0x1e')](_0x29c9ae,_0x44c597,!![]);}catch(_0x3e7fd2){return BPromise['reject'](_0x3e7fd2);}return _0x29c9ae[_0x5fd4('0x1f')]();};}function saveUpdates(_0x4c6e1f,_0x149eab){return function(_0x40ce24){if(_0x40ce24){return _0x40ce24[_0x5fd4('0x20')](_0x4c6e1f)[_0x5fd4('0x21')](function(_0x2e71ad){return _0x2e71ad;});}return null;};}function removeEntity(_0x48e017,_0x473d07){return function(_0x48a75b){if(_0x48a75b){return _0x48a75b['destroy']()['then'](function(){_0x48e017[_0x5fd4('0x17')](0xcc)[_0x5fd4('0x18')]();});}};}function handleEntityNotFound(_0xde6714,_0x1e1af5){return function(_0x48a387){if(!_0x48a387){_0xde6714[_0x5fd4('0x16')](0x194);}return _0x48a387;};}function handleError(_0x526df0,_0x5cab07){_0x5cab07=_0x5cab07||0x1f4;return function(_0xeae3d9){logger[_0x5fd4('0x22')](_0xeae3d9[_0x5fd4('0x23')]);if(_0xeae3d9[_0x5fd4('0x24')]){delete _0xeae3d9[_0x5fd4('0x24')];}_0x526df0[_0x5fd4('0x17')](_0x5cab07)['send'](_0xeae3d9);};}exports[_0x5fd4('0x25')]=function(_0x1049b8,_0x5c961f){var _0x35ace0={},_0x138a97={},_0x4fdd3e={'count':0x0,'rows':[]};var _0x3d7699=_[_0x5fd4('0x26')](db['SmsQueueReport'][_0x5fd4('0x27')],function(_0x50215c){return{'name':_0x50215c[_0x5fd4('0x28')],'type':_0x50215c[_0x5fd4('0x29')]['key']};});_0x138a97[_0x5fd4('0x2a')]=_[_0x5fd4('0x26')](_0x3d7699,_0x5fd4('0x24'));_0x138a97['query']=_['keys'](_0x1049b8[_0x5fd4('0x2b')]);_0x138a97['filters']=_['intersection'](_0x138a97[_0x5fd4('0x2a')],_0x138a97[_0x5fd4('0x2b')]);_0x35ace0[_0x5fd4('0x2c')]=_[_0x5fd4('0x2d')](_0x138a97['model'],qs['fields'](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x2e')]));_0x35ace0['attributes']=_0x35ace0[_0x5fd4('0x2c')]['length']?_0x35ace0[_0x5fd4('0x2c')]:_0x138a97[_0x5fd4('0x2a')];if(!_0x1049b8['query'][_0x5fd4('0x2f')](_0x5fd4('0x30'))){_0x35ace0[_0x5fd4('0x31')]=qs[_0x5fd4('0x31')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x31')]);_0x35ace0['offset']=qs[_0x5fd4('0x19')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x19')]);}_0x35ace0[_0x5fd4('0x32')]=qs[_0x5fd4('0x33')](_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x33')]);_0x35ace0['where']=qs[_0x5fd4('0x34')](_[_0x5fd4('0x35')](_0x1049b8[_0x5fd4('0x2b')],_0x138a97[_0x5fd4('0x34')]),_0x3d7699);if(_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x36')]){_0x35ace0[_0x5fd4('0x37')]=_['merge'](_0x35ace0[_0x5fd4('0x37')],{'$or':_[_0x5fd4('0x26')](_0x3d7699,function(_0x2cf57f){if(_0x2cf57f['type']!==_0x5fd4('0x38')){var _0x3a8042={};_0x3a8042[_0x2cf57f[_0x5fd4('0x24')]]={'$like':'%'+_0x1049b8[_0x5fd4('0x2b')]['filter']+'%'};return _0x3a8042;}})});}_0x35ace0=_['merge']({},_0x35ace0,_0x1049b8[_0x5fd4('0x39')]);var _0x414176={'where':_0x35ace0['where']};return db[_0x5fd4('0x3a')][_0x5fd4('0x1b')](_0x414176)[_0x5fd4('0x21')](function(_0x5ac00a){_0x4fdd3e['count']=_0x5ac00a;if(_0x1049b8[_0x5fd4('0x2b')][_0x5fd4('0x3b')]){_0x35ace0['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x5fd4('0x3c')](_0x35ace0);})[_0x5fd4('0x21')](function(_0x1992d9){_0x4fdd3e[_0x5fd4('0x3d')]=_0x1992d9;return _0x4fdd3e;})[_0x5fd4('0x21')](respondWithFilteredResult(_0x5c961f,_0x35ace0))[_0x5fd4('0x3e')](handleError(_0x5c961f,null));};exports['show']=function(_0x32276d,_0x50a1f2){var _0x53ec27={'raw':!![],'where':{'id':_0x32276d[_0x5fd4('0x3f')]['id']}},_0x4b6c13={};_0x4b6c13[_0x5fd4('0x2a')]=_[_0x5fd4('0x40')](db[_0x5fd4('0x3a')][_0x5fd4('0x27')]);_0x4b6c13['query']=_['keys'](_0x32276d[_0x5fd4('0x2b')]);_0x4b6c13['filters']=_[_0x5fd4('0x2d')](_0x4b6c13['model'],_0x4b6c13['query']);_0x53ec27[_0x5fd4('0x2c')]=_[_0x5fd4('0x2d')](_0x4b6c13['model'],qs[_0x5fd4('0x2e')](_0x32276d[_0x5fd4('0x2b')][_0x5fd4('0x2e')]));_0x53ec27[_0x5fd4('0x2c')]=_0x53ec27[_0x5fd4('0x2c')][_0x5fd4('0x41')]?_0x53ec27[_0x5fd4('0x2c')]:_0x4b6c13[_0x5fd4('0x2a')];if(_0x32276d[_0x5fd4('0x2b')][_0x5fd4('0x3b')]){_0x53ec27['include']=[{'all':!![]}];}_0x53ec27=_[_0x5fd4('0x42')]({},_0x53ec27,_0x32276d['options']);return db['SmsQueueReport']['find'](_0x53ec27)[_0x5fd4('0x21')](handleEntityNotFound(_0x50a1f2,null))[_0x5fd4('0x21')](respondWithResult(_0x50a1f2,null))[_0x5fd4('0x3e')](handleError(_0x50a1f2,null));};exports[_0x5fd4('0x43')]=function(_0x2dbb29,_0x39aeb5){return db[_0x5fd4('0x3a')]['create'](_0x2dbb29[_0x5fd4('0x44')],{})[_0x5fd4('0x21')](respondWithResult(_0x39aeb5,0xc9))[_0x5fd4('0x3e')](handleError(_0x39aeb5,null));};exports['update']=function(_0x57b243,_0x445e7a){if(_0x57b243[_0x5fd4('0x44')]['id']){delete _0x57b243[_0x5fd4('0x44')]['id'];}return db['SmsQueueReport'][_0x5fd4('0x45')]({'where':{'id':_0x57b243[_0x5fd4('0x3f')]['id']}})[_0x5fd4('0x21')](handleEntityNotFound(_0x445e7a,null))['then'](saveUpdates(_0x57b243['body'],null))[_0x5fd4('0x21')](respondWithResult(_0x445e7a,null))['catch'](handleError(_0x445e7a,null));};exports[_0x5fd4('0x46')]=function(_0x2dd149,_0x4937a){return db['SmsQueueReport'][_0x5fd4('0x45')]({'where':{'id':_0x2dd149[_0x5fd4('0x3f')]['id']}})[_0x5fd4('0x21')](handleEntityNotFound(_0x4937a,null))['then'](removeEntity(_0x4937a,null))['catch'](handleError(_0x4937a,null));};exports[_0x5fd4('0x47')]=function(_0xc90bf7,_0x4eaec0){return db[_0x5fd4('0x3a')][_0x5fd4('0x47')]()[_0x5fd4('0x21')](respondWithResult(_0x4eaec0,null))[_0x5fd4('0x3e')](handleError(_0x4eaec0,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index c3f1a50..4ae902a 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7e6b25,_0x56f038){var _0x44e586=function(_0x4eead6){while(--_0x4eead6){_0x7e6b25['push'](_0x7e6b25['shift']());}};_0x44e586(++_0x56f038);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x35c64a,_0x359100){var _0x40cadd=function(_0x1d1fa9){while(--_0x1d1fa9){_0x35c64a['push'](_0x35c64a['shift']());}};_0x40cadd(++_0x359100);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index d4814e0..9a7df6e 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 _0x4b72=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','options','UpdateSmsQueueReport','update','body','raw','where','limit','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2b5993,_0x5da0cf){var _0x281d82=function(_0x93b166){while(--_0x93b166){_0x2b5993['push'](_0x2b5993['shift']());}};_0x281d82(++_0x5da0cf);}(_0x4b72,0x1b4));var _0x24b7=function(_0x4f2f77,_0x572f05){_0x4f2f77=_0x4f2f77-0x0;var _0x59ae0f=_0x4b72[_0x4f2f77];return _0x59ae0f;};'use strict';var _=require(_0x24b7('0x0'));var util=require(_0x24b7('0x1'));var moment=require(_0x24b7('0x2'));var BPromise=require(_0x24b7('0x3'));var rs=require(_0x24b7('0x4'));var fs=require('fs');var Redis=require(_0x24b7('0x5'));var db=require(_0x24b7('0x6'))['db'];var utils=require(_0x24b7('0x7'));var logger=require('../../config/logger')(_0x24b7('0x8'));var config=require('../../config/environment');var jayson=require(_0x24b7('0x9'));var client=jayson[_0x24b7('0xa')][_0x24b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x429572,_0x5d0f00,_0x1b68bf){return new BPromise(function(_0x47e4ab,_0x220b98){return client[_0x24b7('0xc')](_0x429572,_0x1b68bf)[_0x24b7('0xd')](function(_0x570680){logger[_0x24b7('0xe')](_0x24b7('0xf'),_0x5d0f00,_0x24b7('0x10'));logger['debug'](_0x24b7('0x11'),_0x5d0f00,_0x24b7('0x10'),JSON[_0x24b7('0x12')](_0x570680));if(_0x570680[_0x24b7('0x13')]){if(_0x570680[_0x24b7('0x13')][_0x24b7('0x14')]===0x1f4){logger[_0x24b7('0x13')](_0x24b7('0xf'),_0x5d0f00,_0x570680[_0x24b7('0x13')][_0x24b7('0x15')]);return _0x220b98(_0x570680['error'][_0x24b7('0x15')]);}logger[_0x24b7('0x13')](_0x24b7('0xf'),_0x5d0f00,_0x570680[_0x24b7('0x13')][_0x24b7('0x15')]);return _0x47e4ab(_0x570680[_0x24b7('0x13')][_0x24b7('0x15')]);}else{logger[_0x24b7('0xe')](_0x24b7('0xf'),_0x5d0f00,_0x24b7('0x10'));_0x47e4ab(_0x570680['result']['message']);}})['catch'](function(_0x49776e){logger['error'](_0x24b7('0xf'),_0x5d0f00,_0x49776e);_0x220b98(_0x49776e);});});}exports[_0x24b7('0x16')]=function(_0x16dec3){var _0x2e7fd9=this;return new Promise(function(_0x1d87f9,_0x3b62bd){return db[_0x24b7('0x17')][_0x24b7('0x18')](_0x16dec3['body'],{'raw':_0x16dec3[_0x24b7('0x19')]?_0x16dec3[_0x24b7('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xc1c43e){logger[_0x24b7('0xe')](_0x24b7('0x16'),_0x16dec3);logger['debug'](_0x24b7('0x16'),_0x16dec3,JSON['stringify'](_0xc1c43e));_0x1d87f9(_0xc1c43e);})['catch'](function(_0xbe8b09){logger['error'](_0x24b7('0x16'),_0xbe8b09['message'],_0x16dec3);_0x3b62bd(_0x2e7fd9[_0x24b7('0x13')](0x1f4,_0xbe8b09[_0x24b7('0x15')]));});});};exports[_0x24b7('0x1a')]=function(_0x58026a){var _0x517f5a=this;return new Promise(function(_0x4e8ff7,_0x5ecee9){return db[_0x24b7('0x17')][_0x24b7('0x1b')](_0x58026a[_0x24b7('0x1c')],{'raw':_0x58026a[_0x24b7('0x19')]?_0x58026a[_0x24b7('0x19')][_0x24b7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58026a[_0x24b7('0x19')]?_0x58026a[_0x24b7('0x19')][_0x24b7('0x1e')]||null:null,'attributes':_0x58026a['options']?_0x58026a['options']['attributes']||null:null,'limit':_0x58026a[_0x24b7('0x19')]?_0x58026a[_0x24b7('0x19')][_0x24b7('0x1f')]||null:null})['then'](function(_0x56156b){logger['info'](_0x24b7('0x1a'),_0x58026a);logger[_0x24b7('0x20')]('UpdateSmsQueueReport',_0x58026a,JSON['stringify'](_0x56156b));_0x4e8ff7(_0x56156b);})[_0x24b7('0x21')](function(_0x1109b6){logger['error']('UpdateSmsQueueReport',_0x1109b6['message'],_0x58026a);_0x5ecee9(_0x517f5a[_0x24b7('0x13')](0x1f4,_0x1109b6['message']));});});}; \ No newline at end of file +var _0xec3e=['raw','SmsQueueReport','where','UpdateSmsQueueReport','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','body','options'];(function(_0x4134f7,_0x6801d1){var _0x4b7dfc=function(_0x33617a){while(--_0x33617a){_0x4134f7['push'](_0x4134f7['shift']());}};_0x4b7dfc(++_0x6801d1);}(_0xec3e,0x1d4));var _0xeec3=function(_0x328ccb,_0x171c91){_0x328ccb=_0x328ccb-0x0;var _0x5da119=_0xec3e[_0x328ccb];return _0x5da119;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xeec3('0x0'));var BPromise=require(_0xeec3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeec3('0x2'));var db=require(_0xeec3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xeec3('0x4'))(_0xeec3('0x5'));var config=require(_0xeec3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeec3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x241da4,_0x46637b,_0x59fd69){return new BPromise(function(_0x12a9cb,_0x247262){return client[_0xeec3('0x8')](_0x241da4,_0x59fd69)[_0xeec3('0x9')](function(_0xb17cdb){logger[_0xeec3('0xa')](_0xeec3('0xb'),_0x46637b,'request\x20sent');logger[_0xeec3('0xc')](_0xeec3('0xd'),_0x46637b,_0xeec3('0xe'),JSON[_0xeec3('0xf')](_0xb17cdb));if(_0xb17cdb[_0xeec3('0x10')]){if(_0xb17cdb[_0xeec3('0x10')][_0xeec3('0x11')]===0x1f4){logger[_0xeec3('0x10')](_0xeec3('0xb'),_0x46637b,_0xb17cdb[_0xeec3('0x10')][_0xeec3('0x12')]);return _0x247262(_0xb17cdb[_0xeec3('0x10')]['message']);}logger[_0xeec3('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x46637b,_0xb17cdb[_0xeec3('0x10')]['message']);return _0x12a9cb(_0xb17cdb[_0xeec3('0x10')][_0xeec3('0x12')]);}else{logger[_0xeec3('0xa')](_0xeec3('0xb'),_0x46637b,'request\x20sent');_0x12a9cb(_0xb17cdb[_0xeec3('0x13')]['message']);}})[_0xeec3('0x14')](function(_0x302e71){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x46637b,_0x302e71);_0x247262(_0x302e71);});});}exports[_0xeec3('0x15')]=function(_0x58c374){var _0xa72a95=this;return new Promise(function(_0x419538,_0x19afb0){return db['SmsQueueReport'][_0xeec3('0x16')](_0x58c374[_0xeec3('0x17')],{'raw':_0x58c374[_0xeec3('0x18')]?_0x58c374[_0xeec3('0x18')][_0xeec3('0x19')]===undefined?!![]:![]:!![]})[_0xeec3('0x9')](function(_0x25c589){logger['info'](_0xeec3('0x15'),_0x58c374);logger[_0xeec3('0xc')]('CreateSmsQueueReport',_0x58c374,JSON[_0xeec3('0xf')](_0x25c589));_0x419538(_0x25c589);})['catch'](function(_0x48afc1){logger[_0xeec3('0x10')](_0xeec3('0x15'),_0x48afc1[_0xeec3('0x12')],_0x58c374);_0x19afb0(_0xa72a95[_0xeec3('0x10')](0x1f4,_0x48afc1[_0xeec3('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x30d233){var _0x43cd84=this;return new Promise(function(_0x326709,_0x5010fb){return db[_0xeec3('0x1a')]['update'](_0x30d233['body'],{'raw':_0x30d233[_0xeec3('0x18')]?_0x30d233[_0xeec3('0x18')][_0xeec3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d233[_0xeec3('0x18')]?_0x30d233['options'][_0xeec3('0x1b')]||null:null,'attributes':_0x30d233[_0xeec3('0x18')]?_0x30d233['options']['attributes']||null:null,'limit':_0x30d233['options']?_0x30d233[_0xeec3('0x18')]['limit']||null:null})['then'](function(_0x298a44){logger['info'](_0xeec3('0x1c'),_0x30d233);logger[_0xeec3('0xc')](_0xeec3('0x1c'),_0x30d233,JSON[_0xeec3('0xf')](_0x298a44));_0x326709(_0x298a44);})[_0xeec3('0x14')](function(_0x114a26){logger[_0xeec3('0x10')](_0xeec3('0x1c'),_0x114a26['message'],_0x30d233);_0x5010fb(_0x43cd84['error'](0x1f4,_0x114a26[_0xeec3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 64cf4de..b0d042d 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 _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','describe'];(function(_0x54e4dd,_0x515497){var _0x408196=function(_0x3daa50){while(--_0x3daa50){_0x54e4dd['push'](_0x54e4dd['shift']());}};_0x408196(++_0x515497);}(_0x950a,0x111));var _0xa950=function(_0x25a682,_0x219dea){_0x25a682=_0x25a682-0x0;var _0x666218=_0x950a[_0x25a682];return _0x666218;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x12')]);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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0xeec6[_0x3a3b9e];return _0x148103;};'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 3feb4b9..dca6787 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xc0bf56,_0x476134){var _0x43ff64=function(_0x173815){while(--_0x173815){_0xc0bf56['push'](_0xc0bf56['shift']());}};_0x43ff64(++_0x476134);}(_0x34e8,0x12c));var _0x834e=function(_0x960dc0,_0x1df298){_0x960dc0=_0x960dc0-0x0;var _0x1fc006=_0x34e8[_0x960dc0];return _0x1fc006;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x212a63,_0x2d0ce4){var _0x2cecf2=function(_0x29133a){while(--_0x29133a){_0x212a63['push'](_0x212a63['shift']());}};_0x2cecf2(++_0x2d0ce4);}(_0xedd9,0xfc));var _0x9edd=function(_0x47d5e3,_0x19fe4c){_0x47d5e3=_0x47d5e3-0x0;var _0x4023b9=_0xedd9[_0x47d5e3];return _0x4023b9;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 307ab3a..c85106c 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 _0xcede=['fs-extra','lodash','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xcede,0x117));var _0xeced=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcede[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0xeced('0x0'));var rimraf=require(_0xeced('0x1'));var zipdir=require(_0xeced('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeced('0x3'));var moment=require(_0xeced('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeced('0x5'));var util=require(_0xeced('0x6'));var path=require(_0xeced('0x7'));var sox=require('sox');var csv=require(_0xeced('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeced('0x9'));var _=require(_0xeced('0xa'));var squel=require('squel');var crypto=require(_0xeced('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xeced('0x8'));var querystring=require(_0xeced('0xc'));var Papa=require('papaparse');var Redis=require(_0xeced('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xeced('0xe'));var as=require(_0xeced('0xf'));var hardwareService=require(_0xeced('0x10'));var logger=require(_0xeced('0x11'))(_0xeced('0x12'));var utils=require(_0xeced('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb018da,_0x499933){_0x499933=_0x499933||0xcc;return function(_0x3b21ff){if(_0x3b21ff){return _0xb018da[_0xeced('0x14')](_0x499933);}return _0xb018da[_0xeced('0x15')](_0x499933)[_0xeced('0x16')]();};}function respondWithResult(_0x7b42a7,_0x2adddc){_0x2adddc=_0x2adddc||0xc8;return function(_0x14b6f7){if(_0x14b6f7){return _0x7b42a7[_0xeced('0x15')](_0x2adddc)[_0xeced('0x17')](_0x14b6f7);}};}function respondWithFilteredResult(_0x2281b3,_0x52e108){return function(_0x28a408){if(_0x28a408){var _0x21aab6=typeof _0x52e108[_0xeced('0x18')]===_0xeced('0x19')&&typeof _0x52e108['limit']==='undefined';var _0x1d6c7e=_0x28a408[_0xeced('0x1a')];var _0x5ef1d6=_0x21aab6?0x0:_0x52e108[_0xeced('0x18')];var _0x5f3d57=_0x21aab6?_0x28a408[_0xeced('0x1a')]:_0x52e108['offset']+_0x52e108[_0xeced('0x1b')];var _0x3933af;if(_0x5f3d57>=_0x1d6c7e){_0x5f3d57=_0x1d6c7e;_0x3933af=0xc8;}else{_0x3933af=0xce;}_0x2281b3[_0xeced('0x15')](_0x3933af);return _0x2281b3['set'](_0xeced('0x1c'),_0x5ef1d6+'-'+_0x5f3d57+'/'+_0x1d6c7e)[_0xeced('0x17')](_0x28a408);}return null;};}function patchUpdates(_0x3090a9){return function(_0x2dca74){try{jsonpatch[_0xeced('0x1d')](_0x2dca74,_0x3090a9,!![]);}catch(_0x5674ef){return BPromise[_0xeced('0x1e')](_0x5674ef);}return _0x2dca74[_0xeced('0x1f')]();};}function saveUpdates(_0xce604,_0x249ddb){return function(_0x5f5efc){if(_0x5f5efc){return _0x5f5efc[_0xeced('0x20')](_0xce604)[_0xeced('0x21')](function(_0x482938){return _0x482938;});}return null;};}function removeEntity(_0x1ca52c,_0x37950b){return function(_0x48e337){if(_0x48e337){return _0x48e337[_0xeced('0x22')]()[_0xeced('0x21')](function(){_0x1ca52c[_0xeced('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70614e,_0x5850f4){return function(_0x24d42b){if(!_0x24d42b){_0x70614e['sendStatus'](0x194);}return _0x24d42b;};}function handleError(_0x12ba9b,_0x35d695){_0x35d695=_0x35d695||0x1f4;return function(_0x76526a){logger[_0xeced('0x23')](_0x76526a[_0xeced('0x24')]);if(_0x76526a['name']){delete _0x76526a[_0xeced('0x25')];}_0x12ba9b['status'](_0x35d695)[_0xeced('0x26')](_0x76526a);};}exports[_0xeced('0x27')]=function(_0x5b7af8,_0x24e81c){var _0x3380d5={},_0x147e93={},_0x5ac9c5={'count':0x0,'rows':[]};var _0x530b19=_[_0xeced('0x28')](db[_0xeced('0x29')][_0xeced('0x2a')],function(_0x572b5f){return{'name':_0x572b5f[_0xeced('0x2b')],'type':_0x572b5f[_0xeced('0x2c')][_0xeced('0x2d')]};});_0x147e93['model']=_[_0xeced('0x28')](_0x530b19,'name');_0x147e93[_0xeced('0x2e')]=_['keys'](_0x5b7af8[_0xeced('0x2e')]);_0x147e93['filters']=_['intersection'](_0x147e93[_0xeced('0x2f')],_0x147e93[_0xeced('0x2e')]);_0x3380d5[_0xeced('0x30')]=_[_0xeced('0x31')](_0x147e93[_0xeced('0x2f')],qs[_0xeced('0x32')](_0x5b7af8[_0xeced('0x2e')][_0xeced('0x32')]));_0x3380d5['attributes']=_0x3380d5[_0xeced('0x30')][_0xeced('0x33')]?_0x3380d5[_0xeced('0x30')]:_0x147e93[_0xeced('0x2f')];if(!_0x5b7af8[_0xeced('0x2e')][_0xeced('0x34')]('nolimit')){_0x3380d5[_0xeced('0x1b')]=qs['limit'](_0x5b7af8[_0xeced('0x2e')]['limit']);_0x3380d5[_0xeced('0x18')]=qs[_0xeced('0x18')](_0x5b7af8[_0xeced('0x2e')][_0xeced('0x18')]);}_0x3380d5[_0xeced('0x35')]=qs[_0xeced('0x36')](_0x5b7af8['query'][_0xeced('0x36')]);_0x3380d5['where']=qs[_0xeced('0x37')](_['pick'](_0x5b7af8[_0xeced('0x2e')],_0x147e93[_0xeced('0x37')]),_0x530b19);if(_0x5b7af8[_0xeced('0x2e')][_0xeced('0x38')]){_0x3380d5[_0xeced('0x39')]=_[_0xeced('0x3a')](_0x3380d5[_0xeced('0x39')],{'$or':_[_0xeced('0x28')](_0x530b19,function(_0x1d8235){if(_0x1d8235[_0xeced('0x2c')]!==_0xeced('0x3b')){var _0x13dc7b={};_0x13dc7b[_0x1d8235[_0xeced('0x25')]]={'$like':'%'+_0x5b7af8[_0xeced('0x2e')]['filter']+'%'};return _0x13dc7b;}})});}_0x3380d5=_[_0xeced('0x3a')]({},_0x3380d5,_0x5b7af8[_0xeced('0x3c')]);var _0x28cee9={'where':_0x3380d5[_0xeced('0x39')]};return db[_0xeced('0x29')]['count'](_0x28cee9)[_0xeced('0x21')](function(_0x5c17b1){_0x5ac9c5[_0xeced('0x1a')]=_0x5c17b1;if(_0x5b7af8['query']['includeAll']){_0x3380d5[_0xeced('0x3d')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xeced('0x3e')](_0x3380d5);})['then'](function(_0x2e717d){_0x5ac9c5[_0xeced('0x3f')]=_0x2e717d;return _0x5ac9c5;})[_0xeced('0x21')](respondWithFilteredResult(_0x24e81c,_0x3380d5))['catch'](handleError(_0x24e81c,null));};exports[_0xeced('0x40')]=function(_0x36a4a0,_0x5b2d76){var _0x3b9543={'raw':!![],'where':{'id':_0x36a4a0[_0xeced('0x41')]['id']}},_0x1906d3={};_0x1906d3[_0xeced('0x2f')]=_[_0xeced('0x42')](db[_0xeced('0x29')][_0xeced('0x2a')]);_0x1906d3[_0xeced('0x2e')]=_['keys'](_0x36a4a0[_0xeced('0x2e')]);_0x1906d3[_0xeced('0x37')]=_[_0xeced('0x31')](_0x1906d3[_0xeced('0x2f')],_0x1906d3[_0xeced('0x2e')]);_0x3b9543[_0xeced('0x30')]=_[_0xeced('0x31')](_0x1906d3[_0xeced('0x2f')],qs['fields'](_0x36a4a0['query'][_0xeced('0x32')]));_0x3b9543[_0xeced('0x30')]=_0x3b9543[_0xeced('0x30')][_0xeced('0x33')]?_0x3b9543['attributes']:_0x1906d3[_0xeced('0x2f')];if(_0x36a4a0['query']['includeAll']){_0x3b9543[_0xeced('0x3d')]=[{'all':!![]}];}_0x3b9543=_[_0xeced('0x3a')]({},_0x3b9543,_0x36a4a0[_0xeced('0x3c')]);return db[_0xeced('0x29')][_0xeced('0x43')](_0x3b9543)[_0xeced('0x21')](handleEntityNotFound(_0x5b2d76,null))[_0xeced('0x21')](respondWithResult(_0x5b2d76,null))[_0xeced('0x44')](handleError(_0x5b2d76,null));};exports['create']=function(_0x43d2e2,_0x23cab3){return db[_0xeced('0x29')][_0xeced('0x45')](_0x43d2e2[_0xeced('0x46')],{})[_0xeced('0x21')](respondWithResult(_0x23cab3,0xc9))[_0xeced('0x44')](handleError(_0x23cab3,null));};exports[_0xeced('0x20')]=function(_0x49a0c3,_0x2f5ab9){if(_0x49a0c3['body']['id']){delete _0x49a0c3[_0xeced('0x46')]['id'];}return db[_0xeced('0x29')][_0xeced('0x43')]({'where':{'id':_0x49a0c3[_0xeced('0x41')]['id']}})[_0xeced('0x21')](handleEntityNotFound(_0x2f5ab9,null))['then'](saveUpdates(_0x49a0c3[_0xeced('0x46')],null))[_0xeced('0x21')](respondWithResult(_0x2f5ab9,null))[_0xeced('0x44')](handleError(_0x2f5ab9,null));};exports[_0xeced('0x22')]=function(_0x214d91,_0x1e6a94){return db[_0xeced('0x29')][_0xeced('0x43')]({'where':{'id':_0x214d91[_0xeced('0x41')]['id']}})[_0xeced('0x21')](handleEntityNotFound(_0x1e6a94,null))[_0xeced('0x21')](removeEntity(_0x1e6a94,null))[_0xeced('0x44')](handleError(_0x1e6a94,null));};exports[_0xeced('0x47')]=function(_0xd61533,_0x5799b0){return db[_0xeced('0x29')]['describe']()[_0xeced('0x21')](respondWithResult(_0x5799b0,null))[_0xeced('0x44')](handleError(_0x5799b0,null));}; \ No newline at end of file +var _0xbd83=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty'];(function(_0x247ff8,_0x3bfc15){var _0x4f68cd=function(_0x7f3e9a){while(--_0x7f3e9a){_0x247ff8['push'](_0x247ff8['shift']());}};_0x4f68cd(++_0x3bfc15);}(_0xbd83,0x14d));var _0x3bd8=function(_0x233716,_0x346676){_0x233716=_0x233716-0x0;var _0x302298=_0xbd83[_0x233716];return _0x302298;};'use strict';var emlformat=require(_0x3bd8('0x0'));var rimraf=require(_0x3bd8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3bd8('0x2'));var rp=require('request-promise');var moment=require(_0x3bd8('0x3'));var BPromise=require(_0x3bd8('0x4'));var Mustache=require('mustache');var util=require(_0x3bd8('0x5'));var path=require(_0x3bd8('0x6'));var sox=require(_0x3bd8('0x7'));var csv=require(_0x3bd8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3bd8('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3bd8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3bd8('0xb'));var toCsv=require(_0x3bd8('0x8'));var querystring=require('querystring');var Papa=require(_0x3bd8('0xc'));var Redis=require('ioredis');var authService=require(_0x3bd8('0xd'));var qs=require(_0x3bd8('0xe'));var as=require(_0x3bd8('0xf'));var hardwareService=require(_0x3bd8('0x10'));var logger=require(_0x3bd8('0x11'))(_0x3bd8('0x12'));var utils=require(_0x3bd8('0x13'));var config=require(_0x3bd8('0x14'));var licenseUtil=require(_0x3bd8('0x15'));var db=require(_0x3bd8('0x16'))['db'];function respondWithStatusCode(_0x40fe17,_0x591833){_0x591833=_0x591833||0xcc;return function(_0x1e52e5){if(_0x1e52e5){return _0x40fe17['sendStatus'](_0x591833);}return _0x40fe17[_0x3bd8('0x17')](_0x591833)[_0x3bd8('0x18')]();};}function respondWithResult(_0x437890,_0x2f4f28){_0x2f4f28=_0x2f4f28||0xc8;return function(_0x88dc5a){if(_0x88dc5a){return _0x437890[_0x3bd8('0x17')](_0x2f4f28)[_0x3bd8('0x19')](_0x88dc5a);}};}function respondWithFilteredResult(_0x266b67,_0xbf990b){return function(_0x19d49b){if(_0x19d49b){var _0x307b05=typeof _0xbf990b['offset']===_0x3bd8('0x1a')&&typeof _0xbf990b[_0x3bd8('0x1b')]===_0x3bd8('0x1a');var _0x45972e=_0x19d49b['count'];var _0x4b5897=_0x307b05?0x0:_0xbf990b[_0x3bd8('0x1c')];var _0x149b52=_0x307b05?_0x19d49b[_0x3bd8('0x1d')]:_0xbf990b[_0x3bd8('0x1c')]+_0xbf990b['limit'];var _0x440254;if(_0x149b52>=_0x45972e){_0x149b52=_0x45972e;_0x440254=0xc8;}else{_0x440254=0xce;}_0x266b67[_0x3bd8('0x17')](_0x440254);return _0x266b67[_0x3bd8('0x1e')](_0x3bd8('0x1f'),_0x4b5897+'-'+_0x149b52+'/'+_0x45972e)[_0x3bd8('0x19')](_0x19d49b);}return null;};}function patchUpdates(_0x5192af){return function(_0x2a150e){try{jsonpatch[_0x3bd8('0x20')](_0x2a150e,_0x5192af,!![]);}catch(_0x212f1c){return BPromise[_0x3bd8('0x21')](_0x212f1c);}return _0x2a150e[_0x3bd8('0x22')]();};}function saveUpdates(_0x2b8c36,_0x5b723a){return function(_0x2a44d7){if(_0x2a44d7){return _0x2a44d7['update'](_0x2b8c36)[_0x3bd8('0x23')](function(_0x501e1e){return _0x501e1e;});}return null;};}function removeEntity(_0x80a3bc,_0x45bc66){return function(_0x1de79e){if(_0x1de79e){return _0x1de79e[_0x3bd8('0x24')]()[_0x3bd8('0x23')](function(){_0x80a3bc[_0x3bd8('0x17')](0xcc)[_0x3bd8('0x18')]();});}};}function handleEntityNotFound(_0x26fbba,_0x10a76f){return function(_0x5130b7){if(!_0x5130b7){_0x26fbba[_0x3bd8('0x25')](0x194);}return _0x5130b7;};}function handleError(_0x44075a,_0x58c787){_0x58c787=_0x58c787||0x1f4;return function(_0x4744eb){logger[_0x3bd8('0x26')](_0x4744eb[_0x3bd8('0x27')]);if(_0x4744eb[_0x3bd8('0x28')]){delete _0x4744eb[_0x3bd8('0x28')];}_0x44075a[_0x3bd8('0x17')](_0x58c787)[_0x3bd8('0x29')](_0x4744eb);};}exports[_0x3bd8('0x2a')]=function(_0x4c43bc,_0x4267d4){var _0x316275={},_0x467332={},_0x35ed3b={'count':0x0,'rows':[]};var _0x187257=_[_0x3bd8('0x2b')](db[_0x3bd8('0x2c')][_0x3bd8('0x2d')],function(_0xf03a7d){return{'name':_0xf03a7d[_0x3bd8('0x2e')],'type':_0xf03a7d[_0x3bd8('0x2f')][_0x3bd8('0x30')]};});_0x467332[_0x3bd8('0x31')]=_[_0x3bd8('0x2b')](_0x187257,_0x3bd8('0x28'));_0x467332[_0x3bd8('0x32')]=_[_0x3bd8('0x33')](_0x4c43bc[_0x3bd8('0x32')]);_0x467332[_0x3bd8('0x34')]=_[_0x3bd8('0x35')](_0x467332[_0x3bd8('0x31')],_0x467332['query']);_0x316275['attributes']=_[_0x3bd8('0x35')](_0x467332['model'],qs['fields'](_0x4c43bc[_0x3bd8('0x32')]['fields']));_0x316275[_0x3bd8('0x36')]=_0x316275['attributes'][_0x3bd8('0x37')]?_0x316275[_0x3bd8('0x36')]:_0x467332[_0x3bd8('0x31')];if(!_0x4c43bc['query'][_0x3bd8('0x38')](_0x3bd8('0x39'))){_0x316275['limit']=qs[_0x3bd8('0x1b')](_0x4c43bc[_0x3bd8('0x32')][_0x3bd8('0x1b')]);_0x316275['offset']=qs['offset'](_0x4c43bc[_0x3bd8('0x32')]['offset']);}_0x316275[_0x3bd8('0x3a')]=qs[_0x3bd8('0x3b')](_0x4c43bc['query'][_0x3bd8('0x3b')]);_0x316275['where']=qs[_0x3bd8('0x34')](_['pick'](_0x4c43bc[_0x3bd8('0x32')],_0x467332[_0x3bd8('0x34')]),_0x187257);if(_0x4c43bc[_0x3bd8('0x32')][_0x3bd8('0x3c')]){_0x316275[_0x3bd8('0x3d')]=_[_0x3bd8('0x3e')](_0x316275['where'],{'$or':_[_0x3bd8('0x2b')](_0x187257,function(_0x4b2998){if(_0x4b2998['type']!==_0x3bd8('0x3f')){var _0x172177={};_0x172177[_0x4b2998[_0x3bd8('0x28')]]={'$like':'%'+_0x4c43bc['query'][_0x3bd8('0x3c')]+'%'};return _0x172177;}})});}_0x316275=_[_0x3bd8('0x3e')]({},_0x316275,_0x4c43bc[_0x3bd8('0x40')]);var _0xa8aa70={'where':_0x316275[_0x3bd8('0x3d')]};return db[_0x3bd8('0x2c')][_0x3bd8('0x1d')](_0xa8aa70)[_0x3bd8('0x23')](function(_0x2d73b5){_0x35ed3b['count']=_0x2d73b5;if(_0x4c43bc[_0x3bd8('0x32')][_0x3bd8('0x41')]){_0x316275['include']=[{'all':!![]}];}return db[_0x3bd8('0x2c')][_0x3bd8('0x42')](_0x316275);})[_0x3bd8('0x23')](function(_0x2dd429){_0x35ed3b[_0x3bd8('0x43')]=_0x2dd429;return _0x35ed3b;})[_0x3bd8('0x23')](respondWithFilteredResult(_0x4267d4,_0x316275))[_0x3bd8('0x44')](handleError(_0x4267d4,null));};exports[_0x3bd8('0x45')]=function(_0x378c44,_0x5dd2fb){var _0x28ac5e={'raw':!![],'where':{'id':_0x378c44[_0x3bd8('0x46')]['id']}},_0x1a1532={};_0x1a1532['model']=_[_0x3bd8('0x33')](db['SmsTransferReport'][_0x3bd8('0x2d')]);_0x1a1532[_0x3bd8('0x32')]=_[_0x3bd8('0x33')](_0x378c44['query']);_0x1a1532[_0x3bd8('0x34')]=_[_0x3bd8('0x35')](_0x1a1532[_0x3bd8('0x31')],_0x1a1532['query']);_0x28ac5e['attributes']=_[_0x3bd8('0x35')](_0x1a1532['model'],qs[_0x3bd8('0x47')](_0x378c44['query'][_0x3bd8('0x47')]));_0x28ac5e[_0x3bd8('0x36')]=_0x28ac5e[_0x3bd8('0x36')][_0x3bd8('0x37')]?_0x28ac5e['attributes']:_0x1a1532[_0x3bd8('0x31')];if(_0x378c44['query']['includeAll']){_0x28ac5e[_0x3bd8('0x48')]=[{'all':!![]}];}_0x28ac5e=_[_0x3bd8('0x3e')]({},_0x28ac5e,_0x378c44[_0x3bd8('0x40')]);return db['SmsTransferReport'][_0x3bd8('0x49')](_0x28ac5e)[_0x3bd8('0x23')](handleEntityNotFound(_0x5dd2fb,null))[_0x3bd8('0x23')](respondWithResult(_0x5dd2fb,null))[_0x3bd8('0x44')](handleError(_0x5dd2fb,null));};exports[_0x3bd8('0x4a')]=function(_0x16a59b,_0x454fda){return db[_0x3bd8('0x2c')]['create'](_0x16a59b[_0x3bd8('0x4b')],{})[_0x3bd8('0x23')](respondWithResult(_0x454fda,0xc9))[_0x3bd8('0x44')](handleError(_0x454fda,null));};exports[_0x3bd8('0x4c')]=function(_0x3ce069,_0x5ce15d){if(_0x3ce069[_0x3bd8('0x4b')]['id']){delete _0x3ce069[_0x3bd8('0x4b')]['id'];}return db[_0x3bd8('0x2c')][_0x3bd8('0x49')]({'where':{'id':_0x3ce069[_0x3bd8('0x46')]['id']}})[_0x3bd8('0x23')](handleEntityNotFound(_0x5ce15d,null))['then'](saveUpdates(_0x3ce069[_0x3bd8('0x4b')],null))['then'](respondWithResult(_0x5ce15d,null))['catch'](handleError(_0x5ce15d,null));};exports[_0x3bd8('0x24')]=function(_0x33b128,_0x53b709){return db[_0x3bd8('0x2c')][_0x3bd8('0x49')]({'where':{'id':_0x33b128[_0x3bd8('0x46')]['id']}})[_0x3bd8('0x23')](handleEntityNotFound(_0x53b709,null))[_0x3bd8('0x23')](removeEntity(_0x53b709,null))[_0x3bd8('0x44')](handleError(_0x53b709,null));};exports[_0x3bd8('0x4d')]=function(_0x1ec16c,_0x493594){return db['SmsTransferReport'][_0x3bd8('0x4d')]()[_0x3bd8('0x23')](respondWithResult(_0x493594,null))[_0x3bd8('0x44')](handleError(_0x493594,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 20fa802..a842711 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 _0x5908=['report_sms_transfer','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport'];(function(_0xb1f35d,_0x7da770){var _0x406a57=function(_0x5eed2d){while(--_0x5eed2d){_0xb1f35d['push'](_0xb1f35d['shift']());}};_0x406a57(++_0x7da770);}(_0x5908,0x84));var _0x8590=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x5908[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x8590('0x0'));var util=require(_0x8590('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8590('0x2'));var BPromise=require(_0x8590('0x3'));var rp=require(_0x8590('0x4'));var fs=require('fs');var path=require(_0x8590('0x5'));var rimraf=require(_0x8590('0x6'));var config=require(_0x8590('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x8590('0x8')]=function(_0x78e1dd,_0x16fa46){return _0x78e1dd[_0x8590('0x9')](_0x8590('0xa'),attributes,{'tableName':_0x8590('0xb'),'paranoid':![],'indexes':[{'name':_0x8590('0xc'),'fields':[_0x8590('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60a1=['./smsTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1068ff,_0x3dd4f0){var _0x2040ac=function(_0x4bb635){while(--_0x4bb635){_0x1068ff['push'](_0x1068ff['shift']());}};_0x2040ac(++_0x3dd4f0);}(_0x60a1,0x9f));var _0x160a=function(_0x45b282,_0x3e50d1){_0x45b282=_0x45b282-0x0;var _0x35859b=_0x60a1[_0x45b282];return _0x35859b;};'use strict';var _=require(_0x160a('0x0'));var util=require(_0x160a('0x1'));var logger=require(_0x160a('0x2'))(_0x160a('0x3'));var moment=require(_0x160a('0x4'));var BPromise=require(_0x160a('0x5'));var rp=require(_0x160a('0x6'));var fs=require('fs');var path=require(_0x160a('0x7'));var rimraf=require(_0x160a('0x8'));var config=require('../../config/environment');var attributes=require(_0x160a('0x9'));module[_0x160a('0xa')]=function(_0x14f8da,_0x475942){return _0x14f8da['define']('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x160a('0xb'),'fields':[_0x160a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0d9d8e9..ea33585 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 _0xa276=['request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xa276,0x9a));var _0x6a27=function(_0x16fca0,_0x4fa275){_0x16fca0=_0x16fca0-0x0;var _0x1b2a5a=_0xa276[_0x16fca0];return _0x1b2a5a;};'use strict';var _=require('lodash');var util=require(_0x6a27('0x0'));var moment=require(_0x6a27('0x1'));var BPromise=require('bluebird');var rs=require(_0x6a27('0x2'));var fs=require('fs');var Redis=require(_0x6a27('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a27('0x4'));var logger=require(_0x6a27('0x5'))(_0x6a27('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a27('0x7'));var client=jayson[_0x6a27('0x8')][_0x6a27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57b4bd,_0x38d674,_0x55cd2c){return new BPromise(function(_0x50d293,_0x5ebb25){return client['request'](_0x57b4bd,_0x55cd2c)[_0x6a27('0xa')](function(_0x326066){logger[_0x6a27('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x38d674,'request\x20sent');logger[_0x6a27('0xc')](_0x6a27('0xd'),_0x38d674,_0x6a27('0xe'),JSON[_0x6a27('0xf')](_0x326066));if(_0x326066[_0x6a27('0x10')]){if(_0x326066[_0x6a27('0x10')][_0x6a27('0x11')]===0x1f4){logger[_0x6a27('0x10')](_0x6a27('0x12'),_0x38d674,_0x326066['error'][_0x6a27('0x13')]);return _0x5ebb25(_0x326066['error']['message']);}logger[_0x6a27('0x10')](_0x6a27('0x12'),_0x38d674,_0x326066[_0x6a27('0x10')]['message']);return _0x50d293(_0x326066[_0x6a27('0x10')][_0x6a27('0x13')]);}else{logger[_0x6a27('0xb')](_0x6a27('0x12'),_0x38d674,_0x6a27('0xe'));_0x50d293(_0x326066['result']['message']);}})[_0x6a27('0x14')](function(_0x5bb1f3){logger[_0x6a27('0x10')](_0x6a27('0x12'),_0x38d674,_0x5bb1f3);_0x5ebb25(_0x5bb1f3);});});} \ No newline at end of file +var _0x254a=['http','request','info','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x254a,0x138));var _0xa254=function(_0x1b5f7a,_0x281348){_0x1b5f7a=_0x1b5f7a-0x0;var _0x205dd7=_0x254a[_0x1b5f7a];return _0x205dd7;};'use strict';var _=require(_0xa254('0x0'));var util=require(_0xa254('0x1'));var moment=require(_0xa254('0x2'));var BPromise=require('bluebird');var rs=require(_0xa254('0x3'));var fs=require('fs');var Redis=require(_0xa254('0x4'));var db=require(_0xa254('0x5'))['db'];var utils=require(_0xa254('0x6'));var logger=require('../../config/logger')(_0xa254('0x7'));var config=require('../../config/environment');var jayson=require(_0xa254('0x8'));var client=jayson[_0xa254('0x9')][_0xa254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597d72,_0x5951b2,_0xaeed42){return new BPromise(function(_0x352a44,_0x50c5a3){return client[_0xa254('0xb')](_0x597d72,_0xaeed42)['then'](function(_0x19d140){logger[_0xa254('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x5951b2,'request\x20sent');logger[_0xa254('0xd')](_0xa254('0xe'),_0x5951b2,_0xa254('0xf'),JSON[_0xa254('0x10')](_0x19d140));if(_0x19d140[_0xa254('0x11')]){if(_0x19d140['error'][_0xa254('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x50c5a3(_0x19d140['error'][_0xa254('0x13')]);}logger[_0xa254('0x11')](_0xa254('0x14'),_0x5951b2,_0x19d140[_0xa254('0x11')][_0xa254('0x13')]);return _0x352a44(_0x19d140['error'][_0xa254('0x13')]);}else{logger[_0xa254('0xc')](_0xa254('0x14'),_0x5951b2,_0xa254('0xf'));_0x352a44(_0x19d140[_0xa254('0x15')][_0xa254('0x13')]);}})[_0xa254('0x16')](function(_0x1f21ae){logger[_0xa254('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x5951b2,_0x1f21ae);_0x50c5a3(_0x1f21ae);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 32be27a..36238bf 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 _0x1f36=['format','extname','now','single','file','create','put','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x1f36,0xab));var _0x61f3=function(_0x162167,_0x52203f){_0x162167=_0x162167-0x0;var _0x13fda6=_0x1f36[_0x162167];return _0x13fda6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x61f3('0x0'));var timeout=require(_0x61f3('0x1'));var express=require('express');var router=express[_0x61f3('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x61f3('0x3'));var config=require(_0x61f3('0x4'));var controller=require(_0x61f3('0x5'));router[_0x61f3('0x6')]('/',auth[_0x61f3('0x7')](),controller[_0x61f3('0x8')]);router[_0x61f3('0x6')](_0x61f3('0x9'),auth['isAuthenticated'](),controller[_0x61f3('0xa')]);router[_0x61f3('0x6')](_0x61f3('0xb'),auth[_0x61f3('0x7')](),controller[_0x61f3('0xc')]);var upload=multer({'storage':multer[_0x61f3('0xd')]({'destination':function(_0x25bbd3,_0x34b2f2,_0x1baf51){_0x1baf51(null,path[_0x61f3('0xe')](config['root'],_0x61f3('0xf')));},'filename':function(_0x1d7a93,_0x20078b,_0x1b133d){_0x20078b[_0x61f3('0x10')]=_0x20078b['originalname'][_0x61f3('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b133d(null,util[_0x61f3('0x12')]('%s-%s%s',path['basename'](_0x20078b[_0x61f3('0x10')],path[_0x61f3('0x13')](_0x20078b[_0x61f3('0x10')])),Date[_0x61f3('0x14')](),path[_0x61f3('0x13')](_0x20078b[_0x61f3('0x10')])));}})});router['post']('/',upload[_0x61f3('0x15')](_0x61f3('0x16')),controller[_0x61f3('0x17')]);router[_0x61f3('0x18')](_0x61f3('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x61f3('0x19')](_0x61f3('0x9'),auth[_0x61f3('0x7')](),controller[_0x61f3('0x19')]);module[_0x61f3('0x1a')]=router; \ No newline at end of file +var _0x35c8=['fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x35c8,0x17a));var _0x835c=function(_0x26e5d4,_0xbb879e){_0x26e5d4=_0x26e5d4-0x0;var _0x4cdfb7=_0x35c8[_0x26e5d4];return _0x4cdfb7;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express[_0x835c('0x5')]();var fs_extra=require(_0x835c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x835c('0x7'));var config=require(_0x835c('0x8'));var controller=require(_0x835c('0x9'));router[_0x835c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x835c('0xa')](_0x835c('0xb'),auth[_0x835c('0xc')](),controller[_0x835c('0xd')]);router[_0x835c('0xa')](_0x835c('0xe'),auth[_0x835c('0xc')](),controller[_0x835c('0xf')]);var upload=multer({'storage':multer[_0x835c('0x10')]({'destination':function(_0x1dfe08,_0x5d8fb3,_0x1b6c0d){_0x1b6c0d(null,path[_0x835c('0x11')](config[_0x835c('0x12')],_0x835c('0x13')));},'filename':function(_0x4fe27e,_0xb4dbb0,_0x4be5b0){_0xb4dbb0[_0x835c('0x14')]=_0xb4dbb0[_0x835c('0x14')][_0x835c('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4be5b0(null,util[_0x835c('0x16')]('%s-%s%s',path[_0x835c('0x17')](_0xb4dbb0[_0x835c('0x14')],path[_0x835c('0x18')](_0xb4dbb0[_0x835c('0x14')])),Date[_0x835c('0x19')](),path[_0x835c('0x18')](_0xb4dbb0[_0x835c('0x14')])));}})});router[_0x835c('0x1a')]('/',upload[_0x835c('0x1b')](_0x835c('0x1c')),controller['create']);router[_0x835c('0x1d')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x835c('0x1e')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x835c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b09716b..acddc51 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 _0x3a37=['BIGINT','INTEGER','sequelize','exports','STRING','FLOAT'];(function(_0x1d3cb6,_0x26a1f4){var _0x18270c=function(_0xfcf989){while(--_0xfcf989){_0x1d3cb6['push'](_0x1d3cb6['shift']());}};_0x18270c(++_0x26a1f4);}(_0x3a37,0x110));var _0x73a3=function(_0x358fd3,_0x4a9c44){_0x358fd3=_0x358fd3-0x0;var _0x1ad0f3=_0x3a37[_0x358fd3];return _0x1ad0f3;};'use strict';var Sequelize=require(_0x73a3('0x0'));module[_0x73a3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x73a3('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x73a3('0x2')]},'original_format':{'type':Sequelize[_0x73a3('0x2')]},'original_duration':{'type':Sequelize[_0x73a3('0x3')]},'original_sampleCount':{'type':Sequelize[_0x73a3('0x4')]},'original_channelCount':{'type':Sequelize[_0x73a3('0x5')]},'original_bitRate':{'type':Sequelize[_0x73a3('0x4')]},'original_sampleRate':{'type':Sequelize[_0x73a3('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x73a3('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x73a3('0x5')]},'converted_bitRate':{'type':Sequelize[_0x73a3('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x73a3('0x5')]}}; \ No newline at end of file +var _0xde76=['INTEGER','exports','name','STRING','FLOAT','BIGINT'];(function(_0x1ed10b,_0x59032f){var _0x14dc1a=function(_0x171b9f){while(--_0x171b9f){_0x1ed10b['push'](_0x1ed10b['shift']());}};_0x14dc1a(++_0x59032f);}(_0xde76,0xd3));var _0x6de7=function(_0x2e78e4,_0x1e089a){_0x2e78e4=_0x2e78e4-0x0;var _0x457ce1=_0xde76[_0x2e78e4];return _0x457ce1;};'use strict';var Sequelize=require('sequelize');module[_0x6de7('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6de7('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x6de7('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x6de7('0x2')]},'original_format':{'type':Sequelize[_0x6de7('0x2')]},'original_duration':{'type':Sequelize[_0x6de7('0x3')]},'original_sampleCount':{'type':Sequelize[_0x6de7('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x6de7('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x6de7('0x4')]},'converted_channelCount':{'type':Sequelize[_0x6de7('0x5')]},'converted_bitRate':{'type':Sequelize[_0x6de7('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x6de7('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index ed75d37..9e5133e 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 _0x97b1=['save','update','then','destroy','Sounds','UserProfileResource','error','name','send','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','include','findAll','rows','catch','show','includeAll','options','find','params','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','download','root','%s.%s','format','create','basename','originalname','file','filename','substring','wav','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate','0777','body','role','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','apply','reject'];(function(_0x4ae0f8,_0x481211){var _0xcd39f7=function(_0x2a4134){while(--_0x2a4134){_0x4ae0f8['push'](_0x4ae0f8['shift']());}};_0xcd39f7(++_0x481211);}(_0x97b1,0x149));var _0x197b=function(_0x4d40dd,_0x39592b){_0x4d40dd=_0x4d40dd-0x0;var _0x1c51f2=_0x97b1[_0x4d40dd];return _0x1c51f2;};'use strict';var emlformat=require(_0x197b('0x0'));var rimraf=require(_0x197b('0x1'));var zipdir=require(_0x197b('0x2'));var jsonpatch=require(_0x197b('0x3'));var rp=require('request-promise');var moment=require(_0x197b('0x4'));var BPromise=require(_0x197b('0x5'));var Mustache=require('mustache');var util=require(_0x197b('0x6'));var path=require(_0x197b('0x7'));var sox=require(_0x197b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197b('0x9'));var _=require(_0x197b('0xa'));var squel=require(_0x197b('0xb'));var crypto=require(_0x197b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197b('0xd'));var querystring=require(_0x197b('0xe'));var Papa=require(_0x197b('0xf'));var Redis=require(_0x197b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x197b('0x11'));var as=require(_0x197b('0x12'));var hardwareService=require(_0x197b('0x13'));var logger=require(_0x197b('0x14'))(_0x197b('0x15'));var utils=require('../../config/utils');var config=require(_0x197b('0x16'));var licenseUtil=require(_0x197b('0x17'));var db=require(_0x197b('0x18'))['db'];function respondWithStatusCode(_0x4270f2,_0x5d4ae7){_0x5d4ae7=_0x5d4ae7||0xcc;return function(_0x4350a2){if(_0x4350a2){return _0x4270f2[_0x197b('0x19')](_0x5d4ae7);}return _0x4270f2['status'](_0x5d4ae7)[_0x197b('0x1a')]();};}function respondWithResult(_0x108216,_0x1a4c00){_0x1a4c00=_0x1a4c00||0xc8;return function(_0x259f4f){if(_0x259f4f){return _0x108216[_0x197b('0x1b')](_0x1a4c00)['json'](_0x259f4f);}};}function respondWithFilteredResult(_0x15a563,_0x249e86){return function(_0x41d538){if(_0x41d538){var _0x1b36b1=typeof _0x249e86[_0x197b('0x1c')]===_0x197b('0x1d')&&typeof _0x249e86[_0x197b('0x1e')]===_0x197b('0x1d');var _0x3afccb=_0x41d538[_0x197b('0x1f')];var _0x136ba6=_0x1b36b1?0x0:_0x249e86[_0x197b('0x1c')];var _0x3e34b8=_0x1b36b1?_0x41d538[_0x197b('0x1f')]:_0x249e86[_0x197b('0x1c')]+_0x249e86[_0x197b('0x1e')];var _0x1d72de;if(_0x3e34b8>=_0x3afccb){_0x3e34b8=_0x3afccb;_0x1d72de=0xc8;}else{_0x1d72de=0xce;}_0x15a563[_0x197b('0x1b')](_0x1d72de);return _0x15a563['set']('Content-Range',_0x136ba6+'-'+_0x3e34b8+'/'+_0x3afccb)['json'](_0x41d538);}return null;};}function patchUpdates(_0x3dd4c6){return function(_0x2bfaa7){try{jsonpatch[_0x197b('0x20')](_0x2bfaa7,_0x3dd4c6,!![]);}catch(_0x44fd37){return BPromise[_0x197b('0x21')](_0x44fd37);}return _0x2bfaa7[_0x197b('0x22')]();};}function saveUpdates(_0x19c98e,_0x34295e){return function(_0x530d28){if(_0x530d28){return _0x530d28[_0x197b('0x23')](_0x19c98e)[_0x197b('0x24')](function(_0x2e2045){return _0x2e2045;});}return null;};}function removeEntity(_0x2fb21b,_0x13dfd8){return function(_0x31433e){if(_0x31433e){return _0x31433e[_0x197b('0x25')]()[_0x197b('0x24')](function(){var _0x9bd9a1=_0x31433e['get']({'plain':!![]});var _0x4087b2=_0x197b('0x26');return db[_0x197b('0x27')][_0x197b('0x25')]({'where':{'type':_0x4087b2,'resourceId':_0x9bd9a1['id']}})[_0x197b('0x24')](function(){return _0x31433e;});})[_0x197b('0x24')](function(){_0x2fb21b[_0x197b('0x1b')](0xcc)[_0x197b('0x1a')]();});}};}function handleEntityNotFound(_0x18ec68,_0x250e1b){return function(_0x50a537){if(!_0x50a537){_0x18ec68['sendStatus'](0x194);}return _0x50a537;};}function handleError(_0x1840f0,_0x566dcc){_0x566dcc=_0x566dcc||0x1f4;return function(_0x585032){logger[_0x197b('0x28')](_0x585032['stack']);if(_0x585032[_0x197b('0x29')]){delete _0x585032[_0x197b('0x29')];}_0x1840f0[_0x197b('0x1b')](_0x566dcc)[_0x197b('0x2a')](_0x585032);};}exports['index']=function(_0x27b2e4,_0x3d8c75){var _0xfe9b53={},_0x599f6b={},_0x507939={'count':0x0,'rows':[]};var _0x14c960=_[_0x197b('0x2b')](db[_0x197b('0x2c')][_0x197b('0x2d')],function(_0x3d5a59){return{'name':_0x3d5a59[_0x197b('0x2e')],'type':_0x3d5a59[_0x197b('0x2f')]['key']};});_0x599f6b[_0x197b('0x30')]=_[_0x197b('0x2b')](_0x14c960,_0x197b('0x29'));_0x599f6b['query']=_[_0x197b('0x31')](_0x27b2e4[_0x197b('0x32')]);_0x599f6b[_0x197b('0x33')]=_[_0x197b('0x34')](_0x599f6b[_0x197b('0x30')],_0x599f6b[_0x197b('0x32')]);_0xfe9b53[_0x197b('0x35')]=_[_0x197b('0x34')](_0x599f6b['model'],qs[_0x197b('0x36')](_0x27b2e4['query']['fields']));_0xfe9b53[_0x197b('0x35')]=_0xfe9b53[_0x197b('0x35')][_0x197b('0x37')]?_0xfe9b53[_0x197b('0x35')]:_0x599f6b[_0x197b('0x30')];if(!_0x27b2e4[_0x197b('0x32')]['hasOwnProperty'](_0x197b('0x38'))){_0xfe9b53[_0x197b('0x1e')]=qs[_0x197b('0x1e')](_0x27b2e4['query'][_0x197b('0x1e')]);_0xfe9b53[_0x197b('0x1c')]=qs[_0x197b('0x1c')](_0x27b2e4[_0x197b('0x32')][_0x197b('0x1c')]);}_0xfe9b53[_0x197b('0x39')]=qs['sort'](_0x27b2e4[_0x197b('0x32')][_0x197b('0x3a')]);_0xfe9b53['where']=qs[_0x197b('0x33')](_[_0x197b('0x3b')](_0x27b2e4[_0x197b('0x32')],_0x599f6b[_0x197b('0x33')]),_0x14c960);if(_0x27b2e4[_0x197b('0x32')]['filter']){_0xfe9b53[_0x197b('0x3c')]=_[_0x197b('0x3d')](_0xfe9b53[_0x197b('0x3c')],{'$or':_[_0x197b('0x2b')](_0x14c960,function(_0x592299){if(_0x592299[_0x197b('0x2f')]!=='VIRTUAL'){var _0x5a2121={};_0x5a2121[_0x592299['name']]={'$like':'%'+_0x27b2e4[_0x197b('0x32')][_0x197b('0x3e')]+'%'};return _0x5a2121;}})});}_0xfe9b53=_['merge']({},_0xfe9b53,_0x27b2e4['options']);var _0x41d550={'where':_0xfe9b53[_0x197b('0x3c')]};return db[_0x197b('0x2c')][_0x197b('0x1f')](_0x41d550)[_0x197b('0x24')](function(_0x1610d4){_0x507939['count']=_0x1610d4;if(_0x27b2e4['query']['includeAll']){_0xfe9b53[_0x197b('0x3f')]=[{'all':!![]}];}return db[_0x197b('0x2c')][_0x197b('0x40')](_0xfe9b53);})[_0x197b('0x24')](function(_0x2eb0ab){_0x507939[_0x197b('0x41')]=_0x2eb0ab;return _0x507939;})['then'](respondWithFilteredResult(_0x3d8c75,_0xfe9b53))[_0x197b('0x42')](handleError(_0x3d8c75,null));};exports[_0x197b('0x43')]=function(_0x38620a,_0x3e02a2){var _0x1155ee={'raw':!![],'where':{'id':_0x38620a['params']['id']}},_0x4fe9ab={};_0x4fe9ab['model']=_[_0x197b('0x31')](db[_0x197b('0x2c')][_0x197b('0x2d')]);_0x4fe9ab[_0x197b('0x32')]=_[_0x197b('0x31')](_0x38620a[_0x197b('0x32')]);_0x4fe9ab[_0x197b('0x33')]=_[_0x197b('0x34')](_0x4fe9ab[_0x197b('0x30')],_0x4fe9ab['query']);_0x1155ee[_0x197b('0x35')]=_[_0x197b('0x34')](_0x4fe9ab['model'],qs[_0x197b('0x36')](_0x38620a[_0x197b('0x32')]['fields']));_0x1155ee[_0x197b('0x35')]=_0x1155ee['attributes'][_0x197b('0x37')]?_0x1155ee[_0x197b('0x35')]:_0x4fe9ab['model'];if(_0x38620a['query'][_0x197b('0x44')]){_0x1155ee[_0x197b('0x3f')]=[{'all':!![]}];}_0x1155ee=_['merge']({},_0x1155ee,_0x38620a[_0x197b('0x45')]);return db[_0x197b('0x2c')][_0x197b('0x46')](_0x1155ee)[_0x197b('0x24')](handleEntityNotFound(_0x3e02a2,null))[_0x197b('0x24')](respondWithResult(_0x3e02a2,null))[_0x197b('0x42')](handleError(_0x3e02a2,null));};exports['download']=function(_0x34e4fd,_0x2099aa,_0x6d4bc1){return db[_0x197b('0x2c')][_0x197b('0x46')]({'where':{'id':_0x34e4fd[_0x197b('0x47')]['id']},'attributes':[_0x197b('0x29'),_0x197b('0x48'),_0x197b('0x49')],'raw':!![]})[_0x197b('0x24')](handleEntityNotFound(_0x2099aa,null))['then'](function(_0x340843){if(_0x340843){if(!fs[_0x197b('0x4a')](path[_0x197b('0x4b')](config['root'],_0x197b('0x4c'),_0x340843[_0x197b('0x48')]+'.'+_0x340843[_0x197b('0x49')]))){throw new db[(_0x197b('0x4d'))]['ValidationError']('Sound\x20not\x20found');}return _0x2099aa[_0x197b('0x4e')](path[_0x197b('0x4b')](config[_0x197b('0x4f')],_0x197b('0x4c'),util['format'](_0x197b('0x50'),_0x340843[_0x197b('0x48')],_0x340843[_0x197b('0x49')])),util[_0x197b('0x51')](_0x197b('0x50'),_0x340843[_0x197b('0x29')],_0x340843[_0x197b('0x49')]));}return null;})[_0x197b('0x42')](handleError(_0x2099aa,null));};exports[_0x197b('0x52')]=function(_0x33deb4,_0x288381,_0x9322ce){var _0x593aa3={'name':path[_0x197b('0x53')](_0x33deb4['file'][_0x197b('0x54')],path['extname'](_0x33deb4[_0x197b('0x55')][_0x197b('0x54')])),'save_name':path[_0x197b('0x53')](_0x33deb4['file'][_0x197b('0x56')],path['extname'](_0x33deb4[_0x197b('0x55')][_0x197b('0x56')])),'original_format':path['extname'](_0x33deb4['file'][_0x197b('0x54')])[_0x197b('0x57')](0x1),'converted_format':_0x197b('0x58')};var _0x2ff998=path[_0x197b('0x4b')](config[_0x197b('0x4f')],'server/files/sounds/original',_0x33deb4[_0x197b('0x55')][_0x197b('0x56')]);var _0x8b2ecd=path[_0x197b('0x4b')](config[_0x197b('0x4f')],_0x197b('0x4c'),util[_0x197b('0x51')](_0x197b('0x50'),path[_0x197b('0x53')](_0x33deb4[_0x197b('0x55')][_0x197b('0x56')],path['extname'](_0x33deb4[_0x197b('0x55')][_0x197b('0x56')])),_0x593aa3[_0x197b('0x49')]));logger['info'](_0x197b('0x59'),_0x2ff998);logger[_0x197b('0x5a')](_0x197b('0x5b'),_0x8b2ecd);try{fs[_0x197b('0x5c')](_0x2ff998,parseInt('0777',0x8));var _0x210e24=sox[_0x197b('0x5d')](_0x2ff998,_0x8b2ecd,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x210e24['on'](_0x197b('0x28'),function(_0x5900d7){fs[_0x197b('0x5e')](_0x2ff998);_0x288381[_0x197b('0x1b')](0x1f4)[_0x197b('0x2a')](_0x5900d7);});_0x210e24['on'](_0x197b('0x5f'),function(_0x49143d){_0x593aa3[_0x197b('0x60')]=isNaN(_0x49143d[_0x197b('0x61')])?null:_0x49143d[_0x197b('0x61')]*0x3e8;_0x593aa3[_0x197b('0x62')]=isNaN(_0x49143d[_0x197b('0x63')])?null:_0x49143d['sampleCount'];_0x593aa3[_0x197b('0x64')]=isNaN(_0x49143d[_0x197b('0x65')])?null:_0x49143d['channelCount'];_0x593aa3['original_bitRate']=isNaN(_0x49143d['bitRate'])?null:_0x49143d[_0x197b('0x66')];_0x593aa3[_0x197b('0x67')]=isNaN(_0x49143d[_0x197b('0x68')])?null:_0x49143d['sampleRate'];});_0x210e24['on'](_0x197b('0x69'),function(_0x40ff89){_0x593aa3['converted_duration']=isNaN(_0x40ff89[_0x197b('0x61')])?null:_0x40ff89[_0x197b('0x61')]*0x3e8;_0x593aa3[_0x197b('0x6a')]=isNaN(_0x40ff89[_0x197b('0x63')])?null:_0x40ff89[_0x197b('0x63')];_0x593aa3[_0x197b('0x6b')]=isNaN(_0x40ff89['channelCount'])?null:_0x40ff89[_0x197b('0x65')];_0x593aa3[_0x197b('0x6c')]=isNaN(_0x40ff89['bitRate'])?null:_0x40ff89[_0x197b('0x66')];_0x593aa3['converted_sampleRate']=isNaN(_0x40ff89[_0x197b('0x68')])?null:_0x40ff89[_0x197b('0x68')];});_0x210e24['on']('end',function(){fs[_0x197b('0x5c')](_0x8b2ecd,parseInt(_0x197b('0x6d'),0x8));return db[_0x197b('0x2c')][_0x197b('0x52')](_0x593aa3)['then'](function(_0x14b33f){var _0x5dff7b={'role':_0x33deb4[_0x197b('0x6e')][_0x197b('0x6f')],'userProfileId':_0x33deb4['body']['userProfileId']};if(!_0x5dff7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5dff7b[_0x197b('0x6f')]===_0x197b('0x70')){var _0x1b0ecb=_0x14b33f[_0x197b('0x71')]({'plain':!![]});return db[_0x197b('0x72')][_0x197b('0x46')]({'where':{'name':'Sounds','userProfileId':_0x5dff7b[_0x197b('0x73')]},'raw':!![]})[_0x197b('0x24')](function(_0x41d28b){if(_0x41d28b&&_0x41d28b['autoAssociation']===0x0){return db[_0x197b('0x27')][_0x197b('0x52')]({'name':_0x1b0ecb[_0x197b('0x29')],'resourceId':_0x1b0ecb['id'],'type':_0x41d28b[_0x197b('0x29')],'sectionId':_0x41d28b['id']},{})[_0x197b('0x24')](function(){return _0x14b33f;});}else{return _0x14b33f;}})['catch'](function(_0x17728e){logger[_0x197b('0x28')](_0x197b('0x74'),_0x17728e);throw _0x17728e;});}return _0x14b33f;})[_0x197b('0x24')](respondWithResult(_0x288381,null))[_0x197b('0x42')](handleError(_0x288381,null));});_0x210e24[_0x197b('0x75')]();}catch(_0xa6c9a0){_0x288381[_0x197b('0x1b')](0x1f4)['send'](_0xa6c9a0);}};exports[_0x197b('0x23')]=function(_0x3b2c59,_0x2e6658,_0x2bc2db){return db[_0x197b('0x2c')][_0x197b('0x46')]({'where':{'id':_0x3b2c59[_0x197b('0x47')]['id']}})[_0x197b('0x24')](handleEntityNotFound(_0x2e6658,null))['then'](saveUpdates(_['pick'](_0x3b2c59[_0x197b('0x6e')],['name',_0x197b('0x76')]),null))[_0x197b('0x24')](respondWithResult(_0x2e6658,null))[_0x197b('0x42')](handleError(_0x2e6658,null));};exports[_0x197b('0x77')]=function(_0xa4c5fe,_0x100ab3,_0x273cb8){return db[_0x197b('0x2c')]['find']({'where':{'id':_0xa4c5fe[_0x197b('0x47')]['id']}})[_0x197b('0x24')](function(_0x485fd7){if(_0x485fd7){return _0x485fd7[_0x197b('0x25')]();}})[_0x197b('0x24')](function(_0x8af159){var _0x2feeea=path[_0x197b('0x4b')](config[_0x197b('0x4f')],'server/files/sounds/original',util[_0x197b('0x51')](_0x197b('0x50'),_0x8af159[_0x197b('0x48')],_0x8af159[_0x197b('0x78')]));var _0x2989f5=path[_0x197b('0x4b')](config['root'],_0x197b('0x4c'),util[_0x197b('0x51')]('%s.%s',_0x8af159['save_name'],_0x8af159[_0x197b('0x49')]));fs['unlinkSync'](_0x2feeea);fs['unlinkSync'](_0x2989f5);return _0x8af159;})[_0x197b('0x24')](function(_0x3b7b55){if(_0x3b7b55){return _0x100ab3[_0x197b('0x1b')](0xcc)[_0x197b('0x1a')]();}})[_0x197b('0x24')](handleEntityNotFound(_0x100ab3,null))[_0x197b('0x42')](handleError(_0x100ab3,null));}; \ No newline at end of file +var _0x748f=['Content-Range','json','reject','save','then','destroy','get','Sounds','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','options','Sound','includeAll','catch','show','keys','length','include','find','download','params','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','create','basename','originalname','file','filename','extname','substring','wav','join','server/files/sounds/original','format','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','user','UserProfileSection','autoAssociation','start','update','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set'];(function(_0x10ad20,_0x348a7f){var _0x1712c0=function(_0x38ddbb){while(--_0x38ddbb){_0x10ad20['push'](_0x10ad20['shift']());}};_0x1712c0(++_0x348a7f);}(_0x748f,0xd6));var _0xf748=function(_0x59d1ef,_0x137c8b){_0x59d1ef=_0x59d1ef-0x0;var _0x3b54ad=_0x748f[_0x59d1ef];return _0x3b54ad;};'use strict';var emlformat=require(_0xf748('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf748('0x1'));var jsonpatch=require(_0xf748('0x2'));var rp=require(_0xf748('0x3'));var moment=require(_0xf748('0x4'));var BPromise=require(_0xf748('0x5'));var Mustache=require(_0xf748('0x6'));var util=require('util');var path=require(_0xf748('0x7'));var sox=require(_0xf748('0x8'));var csv=require(_0xf748('0x9'));var ejs=require(_0xf748('0xa'));var fs=require('fs');var fs_extra=require(_0xf748('0xb'));var _=require(_0xf748('0xc'));var squel=require(_0xf748('0xd'));var crypto=require(_0xf748('0xe'));var jsforce=require(_0xf748('0xf'));var deskjs=require(_0xf748('0x10'));var toCsv=require(_0xf748('0x9'));var querystring=require(_0xf748('0x11'));var Papa=require(_0xf748('0x12'));var Redis=require(_0xf748('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf748('0x14'));var as=require(_0xf748('0x15'));var hardwareService=require(_0xf748('0x16'));var logger=require(_0xf748('0x17'))('api');var utils=require(_0xf748('0x18'));var config=require(_0xf748('0x19'));var licenseUtil=require(_0xf748('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7eadfb,_0x12cb1d){_0x12cb1d=_0x12cb1d||0xcc;return function(_0x14eb95){if(_0x14eb95){return _0x7eadfb['sendStatus'](_0x12cb1d);}return _0x7eadfb[_0xf748('0x1b')](_0x12cb1d)[_0xf748('0x1c')]();};}function respondWithResult(_0x4ff377,_0x359ae5){_0x359ae5=_0x359ae5||0xc8;return function(_0x14c178){if(_0x14c178){return _0x4ff377['status'](_0x359ae5)['json'](_0x14c178);}};}function respondWithFilteredResult(_0x2dceff,_0x3ce5eb){return function(_0x117ea2){if(_0x117ea2){var _0x52c610=typeof _0x3ce5eb[_0xf748('0x1d')]===_0xf748('0x1e')&&typeof _0x3ce5eb['limit']===_0xf748('0x1e');var _0xe67cdc=_0x117ea2['count'];var _0x229aff=_0x52c610?0x0:_0x3ce5eb['offset'];var _0x3e5433=_0x52c610?_0x117ea2[_0xf748('0x1f')]:_0x3ce5eb[_0xf748('0x1d')]+_0x3ce5eb[_0xf748('0x20')];var _0x39de0a;if(_0x3e5433>=_0xe67cdc){_0x3e5433=_0xe67cdc;_0x39de0a=0xc8;}else{_0x39de0a=0xce;}_0x2dceff['status'](_0x39de0a);return _0x2dceff[_0xf748('0x21')](_0xf748('0x22'),_0x229aff+'-'+_0x3e5433+'/'+_0xe67cdc)[_0xf748('0x23')](_0x117ea2);}return null;};}function patchUpdates(_0x77b63d){return function(_0x33e6a7){try{jsonpatch['apply'](_0x33e6a7,_0x77b63d,!![]);}catch(_0x1f3088){return BPromise[_0xf748('0x24')](_0x1f3088);}return _0x33e6a7[_0xf748('0x25')]();};}function saveUpdates(_0x55a7c6,_0x246c05){return function(_0x300f50){if(_0x300f50){return _0x300f50['update'](_0x55a7c6)[_0xf748('0x26')](function(_0xcf7697){return _0xcf7697;});}return null;};}function removeEntity(_0xbbcd09,_0x41eb69){return function(_0x17c990){if(_0x17c990){return _0x17c990[_0xf748('0x27')]()[_0xf748('0x26')](function(){var _0x4f3624=_0x17c990[_0xf748('0x28')]({'plain':!![]});var _0xea22b1=_0xf748('0x29');return db[_0xf748('0x2a')][_0xf748('0x27')]({'where':{'type':_0xea22b1,'resourceId':_0x4f3624['id']}})[_0xf748('0x26')](function(){return _0x17c990;});})[_0xf748('0x26')](function(){_0xbbcd09['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2be039,_0x272484){return function(_0x20b6ac){if(!_0x20b6ac){_0x2be039[_0xf748('0x2b')](0x194);}return _0x20b6ac;};}function handleError(_0x1229f6,_0x1e92c2){_0x1e92c2=_0x1e92c2||0x1f4;return function(_0x8776c3){logger['error'](_0x8776c3[_0xf748('0x2c')]);if(_0x8776c3[_0xf748('0x2d')]){delete _0x8776c3[_0xf748('0x2d')];}_0x1229f6['status'](_0x1e92c2)[_0xf748('0x2e')](_0x8776c3);};}exports[_0xf748('0x2f')]=function(_0x2ded39,_0x4d4147){var _0x2c9f34={},_0x1266f8={},_0x351b6c={'count':0x0,'rows':[]};var _0x51b9e0=_[_0xf748('0x30')](db['Sound'][_0xf748('0x31')],function(_0x4f3d04){return{'name':_0x4f3d04[_0xf748('0x32')],'type':_0x4f3d04[_0xf748('0x33')][_0xf748('0x34')]};});_0x1266f8[_0xf748('0x35')]=_[_0xf748('0x30')](_0x51b9e0,_0xf748('0x2d'));_0x1266f8[_0xf748('0x36')]=_['keys'](_0x2ded39['query']);_0x1266f8[_0xf748('0x37')]=_[_0xf748('0x38')](_0x1266f8[_0xf748('0x35')],_0x1266f8[_0xf748('0x36')]);_0x2c9f34[_0xf748('0x39')]=_[_0xf748('0x38')](_0x1266f8['model'],qs['fields'](_0x2ded39['query'][_0xf748('0x3a')]));_0x2c9f34[_0xf748('0x39')]=_0x2c9f34[_0xf748('0x39')]['length']?_0x2c9f34[_0xf748('0x39')]:_0x1266f8['model'];if(!_0x2ded39[_0xf748('0x36')]['hasOwnProperty'](_0xf748('0x3b'))){_0x2c9f34[_0xf748('0x20')]=qs['limit'](_0x2ded39['query'][_0xf748('0x20')]);_0x2c9f34[_0xf748('0x1d')]=qs[_0xf748('0x1d')](_0x2ded39[_0xf748('0x36')][_0xf748('0x1d')]);}_0x2c9f34['order']=qs[_0xf748('0x3c')](_0x2ded39[_0xf748('0x36')][_0xf748('0x3c')]);_0x2c9f34[_0xf748('0x3d')]=qs[_0xf748('0x37')](_[_0xf748('0x3e')](_0x2ded39[_0xf748('0x36')],_0x1266f8[_0xf748('0x37')]),_0x51b9e0);if(_0x2ded39[_0xf748('0x36')][_0xf748('0x3f')]){_0x2c9f34['where']=_[_0xf748('0x40')](_0x2c9f34[_0xf748('0x3d')],{'$or':_[_0xf748('0x30')](_0x51b9e0,function(_0x5665ae){if(_0x5665ae[_0xf748('0x33')]!=='VIRTUAL'){var _0x2eff70={};_0x2eff70[_0x5665ae[_0xf748('0x2d')]]={'$like':'%'+_0x2ded39['query'][_0xf748('0x3f')]+'%'};return _0x2eff70;}})});}_0x2c9f34=_[_0xf748('0x40')]({},_0x2c9f34,_0x2ded39[_0xf748('0x41')]);var _0x1a5c17={'where':_0x2c9f34['where']};return db[_0xf748('0x42')][_0xf748('0x1f')](_0x1a5c17)['then'](function(_0x17c354){_0x351b6c[_0xf748('0x1f')]=_0x17c354;if(_0x2ded39[_0xf748('0x36')][_0xf748('0x43')]){_0x2c9f34['include']=[{'all':!![]}];}return db[_0xf748('0x42')]['findAll'](_0x2c9f34);})[_0xf748('0x26')](function(_0x5960c9){_0x351b6c['rows']=_0x5960c9;return _0x351b6c;})[_0xf748('0x26')](respondWithFilteredResult(_0x4d4147,_0x2c9f34))[_0xf748('0x44')](handleError(_0x4d4147,null));};exports[_0xf748('0x45')]=function(_0x1d93b3,_0x5081e1){var _0x5d2893={'raw':!![],'where':{'id':_0x1d93b3['params']['id']}},_0x232188={};_0x232188[_0xf748('0x35')]=_[_0xf748('0x46')](db[_0xf748('0x42')][_0xf748('0x31')]);_0x232188[_0xf748('0x36')]=_[_0xf748('0x46')](_0x1d93b3[_0xf748('0x36')]);_0x232188[_0xf748('0x37')]=_[_0xf748('0x38')](_0x232188[_0xf748('0x35')],_0x232188['query']);_0x5d2893['attributes']=_[_0xf748('0x38')](_0x232188[_0xf748('0x35')],qs[_0xf748('0x3a')](_0x1d93b3[_0xf748('0x36')][_0xf748('0x3a')]));_0x5d2893[_0xf748('0x39')]=_0x5d2893[_0xf748('0x39')][_0xf748('0x47')]?_0x5d2893[_0xf748('0x39')]:_0x232188[_0xf748('0x35')];if(_0x1d93b3['query'][_0xf748('0x43')]){_0x5d2893[_0xf748('0x48')]=[{'all':!![]}];}_0x5d2893=_[_0xf748('0x40')]({},_0x5d2893,_0x1d93b3['options']);return db[_0xf748('0x42')][_0xf748('0x49')](_0x5d2893)['then'](handleEntityNotFound(_0x5081e1,null))['then'](respondWithResult(_0x5081e1,null))[_0xf748('0x44')](handleError(_0x5081e1,null));};exports[_0xf748('0x4a')]=function(_0x2201d5,_0xfe89a2,_0x363df1){return db[_0xf748('0x42')][_0xf748('0x49')]({'where':{'id':_0x2201d5[_0xf748('0x4b')]['id']},'attributes':[_0xf748('0x2d'),_0xf748('0x4c'),_0xf748('0x4d')],'raw':!![]})[_0xf748('0x26')](handleEntityNotFound(_0xfe89a2,null))[_0xf748('0x26')](function(_0x44c8ce){if(_0x44c8ce){if(!fs[_0xf748('0x4e')](path['join'](config[_0xf748('0x4f')],_0xf748('0x50'),_0x44c8ce[_0xf748('0x4c')]+'.'+_0x44c8ce['converted_format']))){throw new db[(_0xf748('0x51'))][(_0xf748('0x52'))](_0xf748('0x53'));}return _0xfe89a2['download'](path['join'](config['root'],_0xf748('0x50'),util['format']('%s.%s',_0x44c8ce[_0xf748('0x4c')],_0x44c8ce[_0xf748('0x4d')])),util['format']('%s.%s',_0x44c8ce['name'],_0x44c8ce[_0xf748('0x4d')]));}return null;})[_0xf748('0x44')](handleError(_0xfe89a2,null));};exports[_0xf748('0x54')]=function(_0x2cf02d,_0x543a85,_0x309e19){var _0x4b2922={'name':path[_0xf748('0x55')](_0x2cf02d['file'][_0xf748('0x56')],path['extname'](_0x2cf02d[_0xf748('0x57')][_0xf748('0x56')])),'save_name':path[_0xf748('0x55')](_0x2cf02d[_0xf748('0x57')][_0xf748('0x58')],path['extname'](_0x2cf02d[_0xf748('0x57')][_0xf748('0x58')])),'original_format':path[_0xf748('0x59')](_0x2cf02d[_0xf748('0x57')][_0xf748('0x56')])[_0xf748('0x5a')](0x1),'converted_format':_0xf748('0x5b')};var _0x1f8ef5=path[_0xf748('0x5c')](config[_0xf748('0x4f')],_0xf748('0x5d'),_0x2cf02d[_0xf748('0x57')][_0xf748('0x58')]);var _0x518493=path[_0xf748('0x5c')](config[_0xf748('0x4f')],_0xf748('0x50'),util[_0xf748('0x5e')](_0xf748('0x5f'),path[_0xf748('0x55')](_0x2cf02d[_0xf748('0x57')][_0xf748('0x58')],path[_0xf748('0x59')](_0x2cf02d['file'][_0xf748('0x58')])),_0x4b2922[_0xf748('0x4d')]));logger[_0xf748('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x1f8ef5);logger['info'](_0xf748('0x61'),_0x518493);try{fs[_0xf748('0x62')](_0x1f8ef5,parseInt(_0xf748('0x63'),0x8));var _0xc93555=sox[_0xf748('0x64')](_0x1f8ef5,_0x518493,{'sampleRate':0x1f40,'format':_0xf748('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xc93555['on'](_0xf748('0x65'),function(_0x16fe29){fs[_0xf748('0x66')](_0x1f8ef5);_0x543a85[_0xf748('0x1b')](0x1f4)[_0xf748('0x2e')](_0x16fe29);});_0xc93555['on']('src',function(_0x3461aa){_0x4b2922['original_duration']=isNaN(_0x3461aa[_0xf748('0x67')])?null:_0x3461aa[_0xf748('0x67')]*0x3e8;_0x4b2922[_0xf748('0x68')]=isNaN(_0x3461aa[_0xf748('0x69')])?null:_0x3461aa[_0xf748('0x69')];_0x4b2922['original_channelCount']=isNaN(_0x3461aa[_0xf748('0x6a')])?null:_0x3461aa['channelCount'];_0x4b2922['original_bitRate']=isNaN(_0x3461aa[_0xf748('0x6b')])?null:_0x3461aa[_0xf748('0x6b')];_0x4b2922[_0xf748('0x6c')]=isNaN(_0x3461aa[_0xf748('0x6d')])?null:_0x3461aa['sampleRate'];});_0xc93555['on']('dest',function(_0x2dd7e6){_0x4b2922[_0xf748('0x6e')]=isNaN(_0x2dd7e6[_0xf748('0x67')])?null:_0x2dd7e6[_0xf748('0x67')]*0x3e8;_0x4b2922[_0xf748('0x6f')]=isNaN(_0x2dd7e6[_0xf748('0x69')])?null:_0x2dd7e6[_0xf748('0x69')];_0x4b2922[_0xf748('0x70')]=isNaN(_0x2dd7e6[_0xf748('0x6a')])?null:_0x2dd7e6[_0xf748('0x6a')];_0x4b2922[_0xf748('0x71')]=isNaN(_0x2dd7e6[_0xf748('0x6b')])?null:_0x2dd7e6[_0xf748('0x6b')];_0x4b2922['converted_sampleRate']=isNaN(_0x2dd7e6[_0xf748('0x6d')])?null:_0x2dd7e6['sampleRate'];});_0xc93555['on'](_0xf748('0x1c'),function(){fs[_0xf748('0x62')](_0x518493,parseInt(_0xf748('0x63'),0x8));return db[_0xf748('0x42')][_0xf748('0x54')](_0x4b2922)[_0xf748('0x26')](function(_0x56545b){var _0x5b96a1={'role':_0x2cf02d[_0xf748('0x72')][_0xf748('0x73')],'userProfileId':_0x2cf02d[_0xf748('0x72')][_0xf748('0x74')]};if(!_0x5b96a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b96a1[_0xf748('0x73')]===_0xf748('0x75')){var _0x51c7bd=_0x56545b['get']({'plain':!![]});return db[_0xf748('0x76')]['find']({'where':{'name':_0xf748('0x29'),'userProfileId':_0x5b96a1[_0xf748('0x74')]},'raw':!![]})[_0xf748('0x26')](function(_0x2a55a5){if(_0x2a55a5&&_0x2a55a5[_0xf748('0x77')]===0x0){return db[_0xf748('0x2a')]['create']({'name':_0x51c7bd['name'],'resourceId':_0x51c7bd['id'],'type':_0x2a55a5[_0xf748('0x2d')],'sectionId':_0x2a55a5['id']},{})['then'](function(){return _0x56545b;});}else{return _0x56545b;}})['catch'](function(_0x42ee98){logger[_0xf748('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42ee98);throw _0x42ee98;});}return _0x56545b;})[_0xf748('0x26')](respondWithResult(_0x543a85,null))[_0xf748('0x44')](handleError(_0x543a85,null));});_0xc93555[_0xf748('0x78')]();}catch(_0x54b35b){_0x543a85[_0xf748('0x1b')](0x1f4)[_0xf748('0x2e')](_0x54b35b);}};exports[_0xf748('0x79')]=function(_0x47f883,_0x290c47,_0x42fa50){return db[_0xf748('0x42')][_0xf748('0x49')]({'where':{'id':_0x47f883[_0xf748('0x4b')]['id']}})['then'](handleEntityNotFound(_0x290c47,null))['then'](saveUpdates(_[_0xf748('0x3e')](_0x47f883[_0xf748('0x72')],[_0xf748('0x2d'),'description']),null))['then'](respondWithResult(_0x290c47,null))['catch'](handleError(_0x290c47,null));};exports[_0xf748('0x7a')]=function(_0x461328,_0x44a0d0,_0x500edf){return db[_0xf748('0x42')]['find']({'where':{'id':_0x461328[_0xf748('0x4b')]['id']}})['then'](function(_0x1fcb4a){if(_0x1fcb4a){return _0x1fcb4a[_0xf748('0x27')]();}})['then'](function(_0x1d8015){var _0x351a68=path[_0xf748('0x5c')](config[_0xf748('0x4f')],_0xf748('0x5d'),util['format'](_0xf748('0x5f'),_0x1d8015[_0xf748('0x4c')],_0x1d8015[_0xf748('0x7b')]));var _0x32a8cc=path[_0xf748('0x5c')](config[_0xf748('0x4f')],_0xf748('0x50'),util[_0xf748('0x5e')](_0xf748('0x5f'),_0x1d8015[_0xf748('0x4c')],_0x1d8015[_0xf748('0x4d')]));fs[_0xf748('0x66')](_0x351a68);fs[_0xf748('0x66')](_0x32a8cc);return _0x1d8015;})[_0xf748('0x26')](function(_0x3dee23){if(_0x3dee23){return _0x44a0d0[_0xf748('0x1b')](0xcc)[_0xf748('0x1c')]();}})[_0xf748('0x26')](handleEntityNotFound(_0x44a0d0,null))[_0xf748('0x44')](handleError(_0x44a0d0,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7957d93..c710672 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 _0x8ad2=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x97208b,_0x5cac26){var _0x282831=function(_0x1c7a26){while(--_0x1c7a26){_0x97208b['push'](_0x97208b['shift']());}};_0x282831(++_0x5cac26);}(_0x8ad2,0x88));var _0x28ad=function(_0x27481a,_0x26230f){_0x27481a=_0x27481a-0x0;var _0x421655=_0x8ad2[_0x27481a];return _0x421655;};'use strict';var _=require(_0x28ad('0x0'));var util=require(_0x28ad('0x1'));var logger=require(_0x28ad('0x2'))(_0x28ad('0x3'));var moment=require(_0x28ad('0x4'));var BPromise=require(_0x28ad('0x5'));var rp=require(_0x28ad('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28ad('0x7'));var config=require('../../config/environment');var attributes=require(_0x28ad('0x8'));module[_0x28ad('0x9')]=function(_0x4bc676,_0x22d08a){return _0x4bc676['define'](_0x28ad('0xa'),attributes,{'tableName':_0x28ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa012=['rimraf','../../config/environment','./sound.attributes','define','Sound','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xa012,0x185));var _0x2a01=function(_0x5f0d94,_0x5618be){_0x5f0d94=_0x5f0d94-0x0;var _0x4fe50d=_0xa012[_0x5f0d94];return _0x4fe50d;};'use strict';var _=require(_0x2a01('0x0'));var util=require(_0x2a01('0x1'));var logger=require(_0x2a01('0x2'))('api');var moment=require(_0x2a01('0x3'));var BPromise=require(_0x2a01('0x4'));var rp=require(_0x2a01('0x5'));var fs=require('fs');var path=require(_0x2a01('0x6'));var rimraf=require(_0x2a01('0x7'));var config=require(_0x2a01('0x8'));var attributes=require(_0x2a01('0x9'));module['exports']=function(_0x53e6a9,_0x543433){return _0x53e6a9[_0x2a01('0xa')](_0x2a01('0xb'),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 610a5c0..81ad62f 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 _0x4fd8=['stringify','error','code','message','result','catch','Sound','find','raw','options','where','attributes','include','map','model','info','ShowSound','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Sound,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1b5b87,_0x596b97){var _0x445229=function(_0x31d2b1){while(--_0x31d2b1){_0x1b5b87['push'](_0x1b5b87['shift']());}};_0x445229(++_0x596b97);}(_0x4fd8,0x197));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x84fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84fd('0x1'));var db=require(_0x84fd('0x2'))['db'];var utils=require(_0x84fd('0x3'));var logger=require(_0x84fd('0x4'))(_0x84fd('0x5'));var config=require(_0x84fd('0x6'));var jayson=require(_0x84fd('0x7'));var client=jayson[_0x84fd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15a43d,_0x470230,_0x2c1808){return new BPromise(function(_0x40aae3,_0x41eb62){return client['request'](_0x15a43d,_0x2c1808)[_0x84fd('0x9')](function(_0x29fd69){logger['info'](_0x84fd('0xa'),_0x470230,'request\x20sent');logger[_0x84fd('0xb')]('Sound,\x20%s,\x20%s,\x20%s',_0x470230,_0x84fd('0xc'),JSON[_0x84fd('0xd')](_0x29fd69));if(_0x29fd69[_0x84fd('0xe')]){if(_0x29fd69[_0x84fd('0xe')][_0x84fd('0xf')]===0x1f4){logger[_0x84fd('0xe')](_0x84fd('0xa'),_0x470230,_0x29fd69[_0x84fd('0xe')][_0x84fd('0x10')]);return _0x41eb62(_0x29fd69[_0x84fd('0xe')][_0x84fd('0x10')]);}logger['error']('Sound,\x20%s,\x20%s',_0x470230,_0x29fd69[_0x84fd('0xe')][_0x84fd('0x10')]);return _0x40aae3(_0x29fd69[_0x84fd('0xe')][_0x84fd('0x10')]);}else{logger['info'](_0x84fd('0xa'),_0x470230,_0x84fd('0xc'));_0x40aae3(_0x29fd69[_0x84fd('0x11')][_0x84fd('0x10')]);}})[_0x84fd('0x12')](function(_0x34c588){logger[_0x84fd('0xe')](_0x84fd('0xa'),_0x470230,_0x34c588);_0x41eb62(_0x34c588);});});}exports['ShowSound']=function(_0x1faccf){var _0x22516c=this;return new Promise(function(_0x225703,_0xe28b6f){return db[_0x84fd('0x13')][_0x84fd('0x14')]({'raw':_0x1faccf['options']?_0x1faccf['options'][_0x84fd('0x15')]===undefined?!![]:![]:!![],'where':_0x1faccf[_0x84fd('0x16')]?_0x1faccf[_0x84fd('0x16')][_0x84fd('0x17')]||null:null,'attributes':_0x1faccf[_0x84fd('0x16')]?_0x1faccf[_0x84fd('0x16')][_0x84fd('0x18')]||null:null,'include':_0x1faccf['options']?_0x1faccf[_0x84fd('0x16')][_0x84fd('0x19')]?_[_0x84fd('0x1a')](_0x1faccf[_0x84fd('0x16')]['include'],function(_0x118979){return{'model':db[_0x118979['model']],'as':_0x118979['as'],'attributes':_0x118979[_0x84fd('0x18')],'include':_0x118979[_0x84fd('0x19')]?_[_0x84fd('0x1a')](_0x118979[_0x84fd('0x19')],function(_0x49827a){return{'model':db[_0x49827a['model']],'as':_0x49827a['as'],'attributes':_0x49827a[_0x84fd('0x18')],'include':_0x49827a[_0x84fd('0x19')]?_[_0x84fd('0x1a')](_0x49827a[_0x84fd('0x19')],function(_0x1acca9){return{'model':db[_0x1acca9[_0x84fd('0x1b')]],'as':_0x1acca9['as'],'attributes':_0x1acca9[_0x84fd('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x885408){logger[_0x84fd('0x1c')](_0x84fd('0x1d'),_0x1faccf);logger[_0x84fd('0xb')](_0x84fd('0x1d'),_0x1faccf,JSON[_0x84fd('0xd')](_0x885408));_0x225703(_0x885408);})[_0x84fd('0x12')](function(_0x4e1689){logger[_0x84fd('0xe')](_0x84fd('0x1d'),_0x4e1689[_0x84fd('0x10')],_0x1faccf);_0xe28b6f(_0x22516c[_0x84fd('0xe')](0x1f4,_0x4e1689[_0x84fd('0x10')]));});});}; \ No newline at end of file +var _0xb81d=['ShowSound','Sound','find','options','raw','where','attributes','model','map','include','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','catch'];(function(_0x2188b9,_0x44fa4a){var _0x4d50fa=function(_0x2be866){while(--_0x2be866){_0x2188b9['push'](_0x2188b9['shift']());}};_0x4d50fa(++_0x44fa4a);}(_0xb81d,0x6d));var _0xdb81=function(_0x71dc3,_0x220d82){_0x71dc3=_0x71dc3-0x0;var _0x7f763f=_0xb81d[_0x71dc3];return _0x7f763f;};'use strict';var _=require(_0xdb81('0x0'));var util=require('util');var moment=require(_0xdb81('0x1'));var BPromise=require(_0xdb81('0x2'));var rs=require(_0xdb81('0x3'));var fs=require('fs');var Redis=require(_0xdb81('0x4'));var db=require(_0xdb81('0x5'))['db'];var utils=require(_0xdb81('0x6'));var logger=require(_0xdb81('0x7'))(_0xdb81('0x8'));var config=require(_0xdb81('0x9'));var jayson=require(_0xdb81('0xa'));var client=jayson['client'][_0xdb81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d4153,_0x3777e1,_0x13359e){return new BPromise(function(_0x296c55,_0x34e463){return client[_0xdb81('0xc')](_0x2d4153,_0x13359e)[_0xdb81('0xd')](function(_0x52e301){logger['info']('Sound,\x20%s,\x20%s',_0x3777e1,_0xdb81('0xe'));logger[_0xdb81('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x3777e1,_0xdb81('0xe'),JSON[_0xdb81('0x10')](_0x52e301));if(_0x52e301['error']){if(_0x52e301[_0xdb81('0x11')][_0xdb81('0x12')]===0x1f4){logger[_0xdb81('0x11')](_0xdb81('0x13'),_0x3777e1,_0x52e301[_0xdb81('0x11')]['message']);return _0x34e463(_0x52e301['error']['message']);}logger[_0xdb81('0x11')](_0xdb81('0x13'),_0x3777e1,_0x52e301['error'][_0xdb81('0x14')]);return _0x296c55(_0x52e301[_0xdb81('0x11')][_0xdb81('0x14')]);}else{logger[_0xdb81('0x15')](_0xdb81('0x13'),_0x3777e1,_0xdb81('0xe'));_0x296c55(_0x52e301['result'][_0xdb81('0x14')]);}})[_0xdb81('0x16')](function(_0x2f3a76){logger['error'](_0xdb81('0x13'),_0x3777e1,_0x2f3a76);_0x34e463(_0x2f3a76);});});}exports[_0xdb81('0x17')]=function(_0x8cad13){var _0x58b6e0=this;return new Promise(function(_0x9e20c7,_0xdd0372){return db[_0xdb81('0x18')][_0xdb81('0x19')]({'raw':_0x8cad13[_0xdb81('0x1a')]?_0x8cad13[_0xdb81('0x1a')][_0xdb81('0x1b')]===undefined?!![]:![]:!![],'where':_0x8cad13['options']?_0x8cad13[_0xdb81('0x1a')][_0xdb81('0x1c')]||null:null,'attributes':_0x8cad13['options']?_0x8cad13['options'][_0xdb81('0x1d')]||null:null,'include':_0x8cad13['options']?_0x8cad13[_0xdb81('0x1a')]['include']?_['map'](_0x8cad13[_0xdb81('0x1a')]['include'],function(_0xd32ae4){return{'model':db[_0xd32ae4[_0xdb81('0x1e')]],'as':_0xd32ae4['as'],'attributes':_0xd32ae4[_0xdb81('0x1d')],'include':_0xd32ae4['include']?_[_0xdb81('0x1f')](_0xd32ae4[_0xdb81('0x20')],function(_0x3180b){return{'model':db[_0x3180b['model']],'as':_0x3180b['as'],'attributes':_0x3180b['attributes'],'include':_0x3180b[_0xdb81('0x20')]?_[_0xdb81('0x1f')](_0x3180b[_0xdb81('0x20')],function(_0x18c5b5){return{'model':db[_0x18c5b5['model']],'as':_0x18c5b5['as'],'attributes':_0x18c5b5[_0xdb81('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xdb81('0xd')](function(_0x140bb1){logger[_0xdb81('0x15')](_0xdb81('0x17'),_0x8cad13);logger[_0xdb81('0xf')](_0xdb81('0x17'),_0x8cad13,JSON[_0xdb81('0x10')](_0x140bb1));_0x9e20c7(_0x140bb1);})[_0xdb81('0x16')](function(_0x4caa27){logger[_0xdb81('0x11')](_0xdb81('0x17'),_0x4caa27[_0xdb81('0x14')],_0x8cad13);_0xdd0372(_0x58b6e0[_0xdb81('0x11')](0x1f4,_0x4caa27['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 9822f95..4d8a465 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x407d50,_0x1c258b){var _0x13e7cb=function(_0x3e7b1e){while(--_0x3e7b1e){_0x407d50['push'](_0x407d50['shift']());}};_0x13e7cb(++_0x1c258b);}(_0x2032,0xd9));var _0x2203=function(_0x509851,_0x3cb22b){_0x509851=_0x509851-0x0;var _0x1910a5=_0x2032[_0x509851];return _0x1910a5;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x50516c,_0x500c0f){var _0x5c3523=function(_0x2c6dbe){while(--_0x2c6dbe){_0x50516c['push'](_0x50516c['shift']());}};_0x5c3523(++_0x500c0f);}(_0x14a0,0x8e));var _0x014a=function(_0x248f86,_0x47b892){_0x248f86=_0x248f86-0x0;var _0x53f443=_0x14a0[_0x248f86];return _0x53f443;};'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/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e518218..0093ed2 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 _0xc1cc=['ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0xc1cc,0x81));var _0xcc1c=function(_0x5d5e39,_0x500a9e){_0x5d5e39=_0x5d5e39-0x0;var _0x45efe1=_0xc1cc[_0x5d5e39];return _0x45efe1;};'use strict';var Sequelize=require(_0xcc1c('0x0'));module[_0xcc1c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xcc1c('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xcc1c('0x3')]('in',_0xcc1c('0x4')),'defaultValue':_0xcc1c('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xcc1c('0x5')]},'providerResponse':{'type':Sequelize[_0xcc1c('0x2')]}}; \ No newline at end of file +var _0x1aa0=['medium','out','sequelize','STRING','TEXT'];(function(_0x383fac,_0xeda6b6){var _0x38d3b6=function(_0x481966){while(--_0x481966){_0x383fac['push'](_0x383fac['shift']());}};_0x38d3b6(++_0xeda6b6);}(_0x1aa0,0xe3));var _0x01aa=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x1aa0[_0x2085f3];return _0x384e3c;};'use strict';var Sequelize=require(_0x01aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x01aa('0x1')]},'body':{'type':Sequelize[_0x01aa('0x2')](_0x01aa('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x01aa('0x4')),'defaultValue':_0x01aa('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x01aa('0x1')]},'providerResponse':{'type':Sequelize[_0x01aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 3ad40b2..9fdac42 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 _0x8c6c=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','eml-format','rimraf','fast-json-patch','moment','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','then','destroy','stack','name','send','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x21fdcb,_0xbd6fc4){var _0x176ca3=function(_0x456e1a){while(--_0x456e1a){_0x21fdcb['push'](_0x21fdcb['shift']());}};_0x176ca3(++_0xbd6fc4);}(_0x8c6c,0x133));var _0xc8c6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8c6c[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xc8c6('0x0'));var rimraf=require(_0xc8c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8c6('0x2'));var rp=require('request-promise');var moment=require(_0xc8c6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc8c6('0x4'));var path=require(_0xc8c6('0x5'));var sox=require(_0xc8c6('0x6'));var csv=require('to-csv');var ejs=require(_0xc8c6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8c6('0x8'));var crypto=require('crypto');var jsforce=require(_0xc8c6('0x9'));var deskjs=require(_0xc8c6('0xa'));var toCsv=require(_0xc8c6('0xb'));var querystring=require(_0xc8c6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc8c6('0xd'));var authService=require(_0xc8c6('0xe'));var qs=require(_0xc8c6('0xf'));var as=require(_0xc8c6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc8c6('0x11'))(_0xc8c6('0x12'));var utils=require(_0xc8c6('0x13'));var config=require(_0xc8c6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc8c6('0x15'))['db'];function respondWithStatusCode(_0xd9c8f0,_0x523fc8){_0x523fc8=_0x523fc8||0xcc;return function(_0x2a0732){if(_0x2a0732){return _0xd9c8f0[_0xc8c6('0x16')](_0x523fc8);}return _0xd9c8f0[_0xc8c6('0x17')](_0x523fc8)[_0xc8c6('0x18')]();};}function respondWithResult(_0x95c5ec,_0x3b20d4){_0x3b20d4=_0x3b20d4||0xc8;return function(_0xff14af){if(_0xff14af){return _0x95c5ec[_0xc8c6('0x17')](_0x3b20d4)[_0xc8c6('0x19')](_0xff14af);}};}function respondWithFilteredResult(_0x175f57,_0x12a8a1){return function(_0x280323){if(_0x280323){var _0xab935f=typeof _0x12a8a1[_0xc8c6('0x1a')]===_0xc8c6('0x1b')&&typeof _0x12a8a1['limit']===_0xc8c6('0x1b');var _0x412ed3=_0x280323['count'];var _0x35ad89=_0xab935f?0x0:_0x12a8a1[_0xc8c6('0x1a')];var _0xbc2480=_0xab935f?_0x280323[_0xc8c6('0x1c')]:_0x12a8a1[_0xc8c6('0x1a')]+_0x12a8a1[_0xc8c6('0x1d')];var _0x3c50cf;if(_0xbc2480>=_0x412ed3){_0xbc2480=_0x412ed3;_0x3c50cf=0xc8;}else{_0x3c50cf=0xce;}_0x175f57[_0xc8c6('0x17')](_0x3c50cf);return _0x175f57[_0xc8c6('0x1e')](_0xc8c6('0x1f'),_0x35ad89+'-'+_0xbc2480+'/'+_0x412ed3)[_0xc8c6('0x19')](_0x280323);}return null;};}function patchUpdates(_0x2f8ada){return function(_0x3f259a){try{jsonpatch['apply'](_0x3f259a,_0x2f8ada,!![]);}catch(_0x4bd296){return BPromise[_0xc8c6('0x20')](_0x4bd296);}return _0x3f259a['save']();};}function saveUpdates(_0x4e0669,_0x4f7c03){return function(_0x35d827){if(_0x35d827){return _0x35d827['update'](_0x4e0669)[_0xc8c6('0x21')](function(_0x52442d){return _0x52442d;});}return null;};}function removeEntity(_0x308f35,_0x13e3b7){return function(_0x4b6948){if(_0x4b6948){return _0x4b6948[_0xc8c6('0x22')]()[_0xc8c6('0x21')](function(){_0x308f35['status'](0xcc)[_0xc8c6('0x18')]();});}};}function handleEntityNotFound(_0x18bbe6,_0x405cea){return function(_0x56033b){if(!_0x56033b){_0x18bbe6[_0xc8c6('0x16')](0x194);}return _0x56033b;};}function handleError(_0x22f6e6,_0x28d8ca){_0x28d8ca=_0x28d8ca||0x1f4;return function(_0x148568){logger['error'](_0x148568[_0xc8c6('0x23')]);if(_0x148568[_0xc8c6('0x24')]){delete _0x148568[_0xc8c6('0x24')];}_0x22f6e6[_0xc8c6('0x17')](_0x28d8ca)[_0xc8c6('0x25')](_0x148568);};}exports['index']=function(_0xc6dde3,_0xeaa4ee){var _0x5830d2={},_0x126a9d={},_0x5a215a={'count':0x0,'rows':[]};var _0xe5b410=_['map'](db[_0xc8c6('0x26')][_0xc8c6('0x27')],function(_0x2a9012){return{'name':_0x2a9012[_0xc8c6('0x28')],'type':_0x2a9012[_0xc8c6('0x29')][_0xc8c6('0x2a')]};});_0x126a9d[_0xc8c6('0x2b')]=_['map'](_0xe5b410,_0xc8c6('0x24'));_0x126a9d['query']=_[_0xc8c6('0x2c')](_0xc6dde3[_0xc8c6('0x2d')]);_0x126a9d[_0xc8c6('0x2e')]=_[_0xc8c6('0x2f')](_0x126a9d['model'],_0x126a9d[_0xc8c6('0x2d')]);_0x5830d2[_0xc8c6('0x30')]=_['intersection'](_0x126a9d['model'],qs[_0xc8c6('0x31')](_0xc6dde3['query'][_0xc8c6('0x31')]));_0x5830d2[_0xc8c6('0x30')]=_0x5830d2[_0xc8c6('0x30')][_0xc8c6('0x32')]?_0x5830d2[_0xc8c6('0x30')]:_0x126a9d[_0xc8c6('0x2b')];if(!_0xc6dde3[_0xc8c6('0x2d')][_0xc8c6('0x33')](_0xc8c6('0x34'))){_0x5830d2['limit']=qs[_0xc8c6('0x1d')](_0xc6dde3['query'][_0xc8c6('0x1d')]);_0x5830d2[_0xc8c6('0x1a')]=qs[_0xc8c6('0x1a')](_0xc6dde3[_0xc8c6('0x2d')][_0xc8c6('0x1a')]);}_0x5830d2[_0xc8c6('0x35')]=qs[_0xc8c6('0x36')](_0xc6dde3[_0xc8c6('0x2d')][_0xc8c6('0x36')]);_0x5830d2[_0xc8c6('0x37')]=qs[_0xc8c6('0x2e')](_[_0xc8c6('0x38')](_0xc6dde3[_0xc8c6('0x2d')],_0x126a9d[_0xc8c6('0x2e')]),_0xe5b410);if(_0xc6dde3[_0xc8c6('0x2d')][_0xc8c6('0x39')]){_0x5830d2[_0xc8c6('0x37')]=_[_0xc8c6('0x3a')](_0x5830d2[_0xc8c6('0x37')],{'$or':_['map'](_0xe5b410,function(_0xb3f7b3){if(_0xb3f7b3[_0xc8c6('0x29')]!=='VIRTUAL'){var _0x2e1d10={};_0x2e1d10[_0xb3f7b3[_0xc8c6('0x24')]]={'$like':'%'+_0xc6dde3[_0xc8c6('0x2d')]['filter']+'%'};return _0x2e1d10;}})});}_0x5830d2=_[_0xc8c6('0x3a')]({},_0x5830d2,_0xc6dde3[_0xc8c6('0x3b')]);var _0x2029f8={'where':_0x5830d2['where']};return db[_0xc8c6('0x26')][_0xc8c6('0x1c')](_0x2029f8)['then'](function(_0x576146){_0x5a215a['count']=_0x576146;if(_0xc6dde3[_0xc8c6('0x2d')][_0xc8c6('0x3c')]){_0x5830d2[_0xc8c6('0x3d')]=[{'all':!![]}];}return db[_0xc8c6('0x26')][_0xc8c6('0x3e')](_0x5830d2);})[_0xc8c6('0x21')](function(_0x1b56bd){_0x5a215a[_0xc8c6('0x3f')]=_0x1b56bd;return _0x5a215a;})['then'](respondWithFilteredResult(_0xeaa4ee,_0x5830d2))[_0xc8c6('0x40')](handleError(_0xeaa4ee,null));};exports[_0xc8c6('0x41')]=function(_0x45efc8,_0x45ce13){var _0x181e32={'raw':!![],'where':{'id':_0x45efc8[_0xc8c6('0x42')]['id']}},_0x2da23c={};_0x2da23c['model']=_[_0xc8c6('0x2c')](db[_0xc8c6('0x26')]['rawAttributes']);_0x2da23c[_0xc8c6('0x2d')]=_[_0xc8c6('0x2c')](_0x45efc8[_0xc8c6('0x2d')]);_0x2da23c[_0xc8c6('0x2e')]=_['intersection'](_0x2da23c[_0xc8c6('0x2b')],_0x2da23c[_0xc8c6('0x2d')]);_0x181e32[_0xc8c6('0x30')]=_[_0xc8c6('0x2f')](_0x2da23c[_0xc8c6('0x2b')],qs[_0xc8c6('0x31')](_0x45efc8[_0xc8c6('0x2d')]['fields']));_0x181e32['attributes']=_0x181e32[_0xc8c6('0x30')]['length']?_0x181e32[_0xc8c6('0x30')]:_0x2da23c[_0xc8c6('0x2b')];if(_0x45efc8[_0xc8c6('0x2d')][_0xc8c6('0x3c')]){_0x181e32[_0xc8c6('0x3d')]=[{'all':!![]}];}_0x181e32=_['merge']({},_0x181e32,_0x45efc8[_0xc8c6('0x3b')]);return db['SquareMessage']['find'](_0x181e32)[_0xc8c6('0x21')](handleEntityNotFound(_0x45ce13,null))[_0xc8c6('0x21')](respondWithResult(_0x45ce13,null))[_0xc8c6('0x40')](handleError(_0x45ce13,null));};exports[_0xc8c6('0x43')]=function(_0x538d93,_0x2447a0){return db['SquareMessage'][_0xc8c6('0x43')](_0x538d93[_0xc8c6('0x44')],{})['then'](respondWithResult(_0x2447a0,0xc9))[_0xc8c6('0x40')](handleError(_0x2447a0,null));};exports[_0xc8c6('0x45')]=function(_0x2c1653,_0x14828f){if(_0x2c1653[_0xc8c6('0x44')]['id']){delete _0x2c1653['body']['id'];}return db[_0xc8c6('0x26')]['find']({'where':{'id':_0x2c1653[_0xc8c6('0x42')]['id']}})[_0xc8c6('0x21')](handleEntityNotFound(_0x14828f,null))['then'](saveUpdates(_0x2c1653['body'],null))[_0xc8c6('0x21')](respondWithResult(_0x14828f,null))['catch'](handleError(_0x14828f,null));};exports['destroy']=function(_0x3aeeeb,_0x184ac2){return db['SquareMessage'][_0xc8c6('0x46')]({'where':{'id':_0x3aeeeb['params']['id']}})['then'](handleEntityNotFound(_0x184ac2,null))[_0xc8c6('0x21')](removeEntity(_0x184ac2,null))[_0xc8c6('0x40')](handleError(_0x184ac2,null));}; \ No newline at end of file +var _0xc1d3=['rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareMessage','includeAll','include','findAll'];(function(_0x3e5f15,_0x203d61){var _0x33af59=function(_0x2218d1){while(--_0x2218d1){_0x3e5f15['push'](_0x3e5f15['shift']());}};_0x33af59(++_0x203d61);}(_0xc1d3,0x147));var _0x3c1d=function(_0x271720,_0x4f678b){_0x271720=_0x271720-0x0;var _0x553803=_0xc1d3[_0x271720];return _0x553803;};'use strict';var emlformat=require(_0x3c1d('0x0'));var rimraf=require(_0x3c1d('0x1'));var zipdir=require(_0x3c1d('0x2'));var jsonpatch=require(_0x3c1d('0x3'));var rp=require(_0x3c1d('0x4'));var moment=require(_0x3c1d('0x5'));var BPromise=require(_0x3c1d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3c1d('0x7'));var sox=require(_0x3c1d('0x8'));var csv=require(_0x3c1d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c1d('0xa'));var _=require(_0x3c1d('0xb'));var squel=require(_0x3c1d('0xc'));var crypto=require(_0x3c1d('0xd'));var jsforce=require(_0x3c1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3c1d('0x9'));var querystring=require(_0x3c1d('0xf'));var Papa=require(_0x3c1d('0x10'));var Redis=require(_0x3c1d('0x11'));var authService=require(_0x3c1d('0x12'));var qs=require(_0x3c1d('0x13'));var as=require(_0x3c1d('0x14'));var hardwareService=require(_0x3c1d('0x15'));var logger=require('../../config/logger')(_0x3c1d('0x16'));var utils=require(_0x3c1d('0x17'));var config=require(_0x3c1d('0x18'));var licenseUtil=require(_0x3c1d('0x19'));var db=require(_0x3c1d('0x1a'))['db'];function respondWithStatusCode(_0x5a2402,_0xf3cd6d){_0xf3cd6d=_0xf3cd6d||0xcc;return function(_0x209b55){if(_0x209b55){return _0x5a2402['sendStatus'](_0xf3cd6d);}return _0x5a2402[_0x3c1d('0x1b')](_0xf3cd6d)['end']();};}function respondWithResult(_0x4ed530,_0x4b941d){_0x4b941d=_0x4b941d||0xc8;return function(_0x2875a9){if(_0x2875a9){return _0x4ed530[_0x3c1d('0x1b')](_0x4b941d)[_0x3c1d('0x1c')](_0x2875a9);}};}function respondWithFilteredResult(_0x434dbc,_0x2ed7af){return function(_0x2c0b83){if(_0x2c0b83){var _0x4e6157=typeof _0x2ed7af['offset']===_0x3c1d('0x1d')&&typeof _0x2ed7af['limit']===_0x3c1d('0x1d');var _0x295467=_0x2c0b83['count'];var _0x4a7e42=_0x4e6157?0x0:_0x2ed7af['offset'];var _0x33637d=_0x4e6157?_0x2c0b83[_0x3c1d('0x1e')]:_0x2ed7af[_0x3c1d('0x1f')]+_0x2ed7af[_0x3c1d('0x20')];var _0x9dce85;if(_0x33637d>=_0x295467){_0x33637d=_0x295467;_0x9dce85=0xc8;}else{_0x9dce85=0xce;}_0x434dbc['status'](_0x9dce85);return _0x434dbc['set'](_0x3c1d('0x21'),_0x4a7e42+'-'+_0x33637d+'/'+_0x295467)[_0x3c1d('0x1c')](_0x2c0b83);}return null;};}function patchUpdates(_0x3c7455){return function(_0x233dff){try{jsonpatch[_0x3c1d('0x22')](_0x233dff,_0x3c7455,!![]);}catch(_0x5b2720){return BPromise[_0x3c1d('0x23')](_0x5b2720);}return _0x233dff[_0x3c1d('0x24')]();};}function saveUpdates(_0xa5fd81,_0x5211d7){return function(_0x129497){if(_0x129497){return _0x129497[_0x3c1d('0x25')](_0xa5fd81)[_0x3c1d('0x26')](function(_0x210e9c){return _0x210e9c;});}return null;};}function removeEntity(_0x2e1af4,_0x1a853d){return function(_0x41a683){if(_0x41a683){return _0x41a683[_0x3c1d('0x27')]()[_0x3c1d('0x26')](function(){_0x2e1af4['status'](0xcc)[_0x3c1d('0x28')]();});}};}function handleEntityNotFound(_0x2a8854,_0x2078d5){return function(_0x4f7cd8){if(!_0x4f7cd8){_0x2a8854[_0x3c1d('0x29')](0x194);}return _0x4f7cd8;};}function handleError(_0x3bde45,_0x4e1f79){_0x4e1f79=_0x4e1f79||0x1f4;return function(_0x392bb1){logger[_0x3c1d('0x2a')](_0x392bb1[_0x3c1d('0x2b')]);if(_0x392bb1['name']){delete _0x392bb1[_0x3c1d('0x2c')];}_0x3bde45['status'](_0x4e1f79)[_0x3c1d('0x2d')](_0x392bb1);};}exports[_0x3c1d('0x2e')]=function(_0x59db0a,_0x4ff12a){var _0x356f61={},_0x2f7af9={},_0x93a3b1={'count':0x0,'rows':[]};var _0x52ab2b=_[_0x3c1d('0x2f')](db['SquareMessage'][_0x3c1d('0x30')],function(_0x438b09){return{'name':_0x438b09[_0x3c1d('0x31')],'type':_0x438b09['type'][_0x3c1d('0x32')]};});_0x2f7af9[_0x3c1d('0x33')]=_[_0x3c1d('0x2f')](_0x52ab2b,_0x3c1d('0x2c'));_0x2f7af9[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x59db0a[_0x3c1d('0x34')]);_0x2f7af9[_0x3c1d('0x36')]=_[_0x3c1d('0x37')](_0x2f7af9['model'],_0x2f7af9['query']);_0x356f61[_0x3c1d('0x38')]=_['intersection'](_0x2f7af9[_0x3c1d('0x33')],qs[_0x3c1d('0x39')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x356f61[_0x3c1d('0x38')]=_0x356f61['attributes'][_0x3c1d('0x3a')]?_0x356f61[_0x3c1d('0x38')]:_0x2f7af9['model'];if(!_0x59db0a['query'][_0x3c1d('0x3b')](_0x3c1d('0x3c'))){_0x356f61[_0x3c1d('0x20')]=qs[_0x3c1d('0x20')](_0x59db0a[_0x3c1d('0x34')]['limit']);_0x356f61[_0x3c1d('0x1f')]=qs[_0x3c1d('0x1f')](_0x59db0a['query']['offset']);}_0x356f61['order']=qs[_0x3c1d('0x3d')](_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x3d')]);_0x356f61[_0x3c1d('0x3e')]=qs['filters'](_[_0x3c1d('0x3f')](_0x59db0a['query'],_0x2f7af9[_0x3c1d('0x36')]),_0x52ab2b);if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x40')]){_0x356f61[_0x3c1d('0x3e')]=_[_0x3c1d('0x41')](_0x356f61['where'],{'$or':_[_0x3c1d('0x2f')](_0x52ab2b,function(_0x28c575){if(_0x28c575[_0x3c1d('0x42')]!==_0x3c1d('0x43')){var _0x59c8fb={};_0x59c8fb[_0x28c575[_0x3c1d('0x2c')]]={'$like':'%'+_0x59db0a['query']['filter']+'%'};return _0x59c8fb;}})});}_0x356f61=_[_0x3c1d('0x41')]({},_0x356f61,_0x59db0a[_0x3c1d('0x44')]);var _0x58c490={'where':_0x356f61['where']};return db[_0x3c1d('0x45')][_0x3c1d('0x1e')](_0x58c490)['then'](function(_0x4f07d6){_0x93a3b1[_0x3c1d('0x1e')]=_0x4f07d6;if(_0x59db0a[_0x3c1d('0x34')][_0x3c1d('0x46')]){_0x356f61[_0x3c1d('0x47')]=[{'all':!![]}];}return db[_0x3c1d('0x45')][_0x3c1d('0x48')](_0x356f61);})[_0x3c1d('0x26')](function(_0x11bca2){_0x93a3b1[_0x3c1d('0x49')]=_0x11bca2;return _0x93a3b1;})[_0x3c1d('0x26')](respondWithFilteredResult(_0x4ff12a,_0x356f61))[_0x3c1d('0x4a')](handleError(_0x4ff12a,null));};exports[_0x3c1d('0x4b')]=function(_0x4b0f40,_0x21dbef){var _0x5ca02c={'raw':!![],'where':{'id':_0x4b0f40['params']['id']}},_0x415a61={};_0x415a61[_0x3c1d('0x33')]=_['keys'](db[_0x3c1d('0x45')][_0x3c1d('0x30')]);_0x415a61[_0x3c1d('0x34')]=_[_0x3c1d('0x35')](_0x4b0f40['query']);_0x415a61[_0x3c1d('0x36')]=_['intersection'](_0x415a61[_0x3c1d('0x33')],_0x415a61[_0x3c1d('0x34')]);_0x5ca02c[_0x3c1d('0x38')]=_[_0x3c1d('0x37')](_0x415a61['model'],qs[_0x3c1d('0x39')](_0x4b0f40[_0x3c1d('0x34')][_0x3c1d('0x39')]));_0x5ca02c[_0x3c1d('0x38')]=_0x5ca02c[_0x3c1d('0x38')]['length']?_0x5ca02c[_0x3c1d('0x38')]:_0x415a61[_0x3c1d('0x33')];if(_0x4b0f40[_0x3c1d('0x34')]['includeAll']){_0x5ca02c['include']=[{'all':!![]}];}_0x5ca02c=_[_0x3c1d('0x41')]({},_0x5ca02c,_0x4b0f40[_0x3c1d('0x44')]);return db[_0x3c1d('0x45')][_0x3c1d('0x4c')](_0x5ca02c)[_0x3c1d('0x26')](handleEntityNotFound(_0x21dbef,null))[_0x3c1d('0x26')](respondWithResult(_0x21dbef,null))['catch'](handleError(_0x21dbef,null));};exports[_0x3c1d('0x4d')]=function(_0x4c533e,_0x34ad3a){return db[_0x3c1d('0x45')][_0x3c1d('0x4d')](_0x4c533e[_0x3c1d('0x4e')],{})[_0x3c1d('0x26')](respondWithResult(_0x34ad3a,0xc9))[_0x3c1d('0x4a')](handleError(_0x34ad3a,null));};exports[_0x3c1d('0x25')]=function(_0x4f0b44,_0x576552){if(_0x4f0b44['body']['id']){delete _0x4f0b44[_0x3c1d('0x4e')]['id'];}return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4f0b44[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x576552,null))[_0x3c1d('0x26')](saveUpdates(_0x4f0b44['body'],null))[_0x3c1d('0x26')](respondWithResult(_0x576552,null))[_0x3c1d('0x4a')](handleError(_0x576552,null));};exports['destroy']=function(_0x4bc4ac,_0x4302f3){return db[_0x3c1d('0x45')][_0x3c1d('0x4c')]({'where':{'id':_0x4bc4ac[_0x3c1d('0x4f')]['id']}})[_0x3c1d('0x26')](handleEntityNotFound(_0x4302f3,null))[_0x3c1d('0x26')](removeEntity(_0x4302f3,null))[_0x3c1d('0x4a')](handleError(_0x4302f3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e5e6664..edcf21c 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 _0x8e7c=['../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x6dc241,_0x3d6db7){var _0xac50e7=function(_0x42c8a1){while(--_0x42c8a1){_0x6dc241['push'](_0x6dc241['shift']());}};_0xac50e7(++_0x3d6db7);}(_0x8e7c,0x150));var _0xc8e7=function(_0x25cf1c,_0x3c4fcd){_0x25cf1c=_0x25cf1c-0x0;var _0xabeafe=_0x8e7c[_0x25cf1c];return _0xabeafe;};'use strict';var _=require(_0xc8e7('0x0'));var util=require('util');var logger=require(_0xc8e7('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc8e7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8e7('0x3'));var rimraf=require(_0xc8e7('0x4'));var config=require(_0xc8e7('0x5'));var attributes=require(_0xc8e7('0x6'));module[_0xc8e7('0x7')]=function(_0x2a7a96,_0x327eba){return _0x2a7a96[_0xc8e7('0x8')](_0xc8e7('0x9'),attributes,{'tableName':_0xc8e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b5f=['square_messages','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareMessage.attributes','SquareMessage'];(function(_0x33f4bc,_0x375ed2){var _0x565bdd=function(_0x55b083){while(--_0x55b083){_0x33f4bc['push'](_0x33f4bc['shift']());}};_0x565bdd(++_0x375ed2);}(_0x5b5f,0xd9));var _0xf5b5=function(_0xbdf091,_0x35a06c){_0xbdf091=_0xbdf091-0x0;var _0x129fd5=_0x5b5f[_0xbdf091];return _0x129fd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5b5('0x0'))(_0xf5b5('0x1'));var moment=require(_0xf5b5('0x2'));var BPromise=require('bluebird');var rp=require(_0xf5b5('0x3'));var fs=require('fs');var path=require(_0xf5b5('0x4'));var rimraf=require('rimraf');var config=require(_0xf5b5('0x5'));var attributes=require(_0xf5b5('0x6'));module['exports']=function(_0x46c9e4,_0x56bd04){return _0x46c9e4['define'](_0xf5b5('0x7'),attributes,{'tableName':_0xf5b5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index e644924..8bc753d 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 _0x3f03=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','SquareMessage','create','body','options','raw','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0x3f03,0x1a9));var _0x33f0=function(_0x39a566,_0x119e74){_0x39a566=_0x39a566-0x0;var _0x5bee7e=_0x3f03[_0x39a566];return _0x5bee7e;};'use strict';var _=require(_0x33f0('0x0'));var util=require(_0x33f0('0x1'));var moment=require(_0x33f0('0x2'));var BPromise=require(_0x33f0('0x3'));var rs=require(_0x33f0('0x4'));var fs=require('fs');var Redis=require(_0x33f0('0x5'));var db=require(_0x33f0('0x6'))['db'];var utils=require(_0x33f0('0x7'));var logger=require(_0x33f0('0x8'))(_0x33f0('0x9'));var config=require(_0x33f0('0xa'));var jayson=require(_0x33f0('0xb'));var client=jayson['client'][_0x33f0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1371cd,_0x3e4f4f,_0x285579){return new BPromise(function(_0x5ad7af,_0x29efa6){return client['request'](_0x1371cd,_0x285579)['then'](function(_0x585b67){logger[_0x33f0('0xd')](_0x33f0('0xe'),_0x3e4f4f,'request\x20sent');logger[_0x33f0('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3e4f4f,_0x33f0('0x10'),JSON[_0x33f0('0x11')](_0x585b67));if(_0x585b67[_0x33f0('0x12')]){if(_0x585b67[_0x33f0('0x12')]['code']===0x1f4){logger[_0x33f0('0x12')](_0x33f0('0xe'),_0x3e4f4f,_0x585b67['error'][_0x33f0('0x13')]);return _0x29efa6(_0x585b67[_0x33f0('0x12')][_0x33f0('0x13')]);}logger[_0x33f0('0x12')](_0x33f0('0xe'),_0x3e4f4f,_0x585b67[_0x33f0('0x12')]['message']);return _0x5ad7af(_0x585b67[_0x33f0('0x12')][_0x33f0('0x13')]);}else{logger[_0x33f0('0xd')](_0x33f0('0xe'),_0x3e4f4f,'request\x20sent');_0x5ad7af(_0x585b67['result'][_0x33f0('0x13')]);}})[_0x33f0('0x14')](function(_0x8f6ada){logger[_0x33f0('0x12')](_0x33f0('0xe'),_0x3e4f4f,_0x8f6ada);_0x29efa6(_0x8f6ada);});});}exports['CreateSquareMessage']=function(_0x1f5db5){var _0x310658=this;return new Promise(function(_0x5a50a1,_0x10592d){return db[_0x33f0('0x15')][_0x33f0('0x16')](_0x1f5db5[_0x33f0('0x17')],{'raw':_0x1f5db5[_0x33f0('0x18')]?_0x1f5db5[_0x33f0('0x18')][_0x33f0('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x2ad4e5){logger[_0x33f0('0xd')](_0x33f0('0x1a'),_0x1f5db5);logger[_0x33f0('0xf')](_0x33f0('0x1a'),_0x1f5db5,JSON['stringify'](_0x2ad4e5));_0x5a50a1(_0x2ad4e5);})['catch'](function(_0x1ac32e){logger['error'](_0x33f0('0x1a'),_0x1ac32e[_0x33f0('0x13')],_0x1f5db5);_0x10592d(_0x310658['error'](0x1f4,_0x1ac32e['message']));});});}; \ No newline at end of file +var _0x779e=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x321291,_0xa447e7){var _0x17c066=function(_0x50ac5a){while(--_0x50ac5a){_0x321291['push'](_0x321291['shift']());}};_0x17c066(++_0xa447e7);}(_0x779e,0x6e));var _0xe779=function(_0x1a3243,_0x201872){_0x1a3243=_0x1a3243-0x0;var _0x33f2ca=_0x779e[_0x1a3243];return _0x33f2ca;};'use strict';var _=require(_0xe779('0x0'));var util=require(_0xe779('0x1'));var moment=require(_0xe779('0x2'));var BPromise=require(_0xe779('0x3'));var rs=require(_0xe779('0x4'));var fs=require('fs');var Redis=require(_0xe779('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe779('0x6'));var config=require(_0xe779('0x7'));var jayson=require(_0xe779('0x8'));var client=jayson[_0xe779('0x9')][_0xe779('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfaeb4,_0x2fb463,_0x510bea){return new BPromise(function(_0x5f06c8,_0x53eb9e){return client['request'](_0xfaeb4,_0x510bea)[_0xe779('0xb')](function(_0x4b1102){logger[_0xe779('0xc')]('SquareMessage,\x20%s,\x20%s',_0x2fb463,_0xe779('0xd'));logger[_0xe779('0xe')](_0xe779('0xf'),_0x2fb463,_0xe779('0xd'),JSON['stringify'](_0x4b1102));if(_0x4b1102[_0xe779('0x10')]){if(_0x4b1102['error'][_0xe779('0x11')]===0x1f4){logger[_0xe779('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2fb463,_0x4b1102[_0xe779('0x10')]['message']);return _0x53eb9e(_0x4b1102[_0xe779('0x10')][_0xe779('0x12')]);}logger[_0xe779('0x10')]('SquareMessage,\x20%s,\x20%s',_0x2fb463,_0x4b1102[_0xe779('0x10')]['message']);return _0x5f06c8(_0x4b1102[_0xe779('0x10')]['message']);}else{logger[_0xe779('0xc')](_0xe779('0x13'),_0x2fb463,'request\x20sent');_0x5f06c8(_0x4b1102[_0xe779('0x14')][_0xe779('0x12')]);}})[_0xe779('0x15')](function(_0xf63ad3){logger[_0xe779('0x10')](_0xe779('0x13'),_0x2fb463,_0xf63ad3);_0x53eb9e(_0xf63ad3);});});}exports[_0xe779('0x16')]=function(_0x5ee1ca){var _0x1cd60a=this;return new Promise(function(_0x378faa,_0x25300f){return db[_0xe779('0x17')][_0xe779('0x18')](_0x5ee1ca[_0xe779('0x19')],{'raw':_0x5ee1ca['options']?_0x5ee1ca[_0xe779('0x1a')][_0xe779('0x1b')]===undefined?!![]:![]:!![]})[_0xe779('0xb')](function(_0x37a110){logger['info'](_0xe779('0x16'),_0x5ee1ca);logger[_0xe779('0xe')](_0xe779('0x16'),_0x5ee1ca,JSON[_0xe779('0x1c')](_0x37a110));_0x378faa(_0x37a110);})['catch'](function(_0x5e2649){logger['error'](_0xe779('0x16'),_0x5e2649['message'],_0x5ee1ca);_0x25300f(_0x1cd60a[_0xe779('0x10')](0x1f4,_0x5e2649[_0xe779('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 91cc37c..3c5d0ef 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 _0x91c4=['/:id','show','/:id/test','15s','post','create','put','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x4a106b,_0x530204){var _0x10ac51=function(_0x28d01e){while(--_0x28d01e){_0x4a106b['push'](_0x4a106b['shift']());}};_0x10ac51(++_0x530204);}(_0x91c4,0xd5));var _0x491c=function(_0x56e6c8,_0x4998ec){_0x56e6c8=_0x56e6c8-0x0;var _0x2454a5=_0x91c4[_0x56e6c8];return _0x2454a5;};'use strict';var multer=require(_0x491c('0x0'));var util=require(_0x491c('0x1'));var path=require(_0x491c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x491c('0x3')]();var fs_extra=require(_0x491c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x491c('0x5'));var controller=require('./squareOdbc.controller');router[_0x491c('0x6')]('/',auth[_0x491c('0x7')](),controller['index']);router[_0x491c('0x6')](_0x491c('0x8'),auth['isAuthenticated'](),controller[_0x491c('0x9')]);router[_0x491c('0x6')](_0x491c('0xa'),auth['isAuthenticated'](),timeout(_0x491c('0xb')),controller['test']);router[_0x491c('0xc')]('/',auth[_0x491c('0x7')](),controller[_0x491c('0xd')]);router[_0x491c('0xe')](_0x491c('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x491c('0xf')](_0x491c('0x8'),auth['isAuthenticated'](),controller[_0x491c('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe207=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','test','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x112929,_0x7da466){var _0x333c16=function(_0x762dc0){while(--_0x762dc0){_0x112929['push'](_0x112929['shift']());}};_0x333c16(++_0x7da466);}(_0xe207,0x175));var _0x7e20=function(_0x399efe,_0x45e643){_0x399efe=_0x399efe-0x0;var _0x493c73=_0xe207[_0x399efe];return _0x493c73;};'use strict';var multer=require(_0x7e20('0x0'));var util=require(_0x7e20('0x1'));var path=require('path');var timeout=require(_0x7e20('0x2'));var express=require(_0x7e20('0x3'));var router=express[_0x7e20('0x4')]();var fs_extra=require(_0x7e20('0x5'));var auth=require(_0x7e20('0x6'));var interaction=require(_0x7e20('0x7'));var config=require('../../config/environment');var controller=require(_0x7e20('0x8'));router[_0x7e20('0x9')]('/',auth[_0x7e20('0xa')](),controller[_0x7e20('0xb')]);router['get'](_0x7e20('0xc'),auth[_0x7e20('0xa')](),controller[_0x7e20('0xd')]);router[_0x7e20('0x9')]('/:id/test',auth[_0x7e20('0xa')](),timeout('15s'),controller[_0x7e20('0xe')]);router[_0x7e20('0xf')]('/',auth[_0x7e20('0xa')](),controller[_0x7e20('0x10')]);router[_0x7e20('0x11')](_0x7e20('0xc'),auth[_0x7e20('0xa')](),controller[_0x7e20('0x12')]);router[_0x7e20('0x13')](_0x7e20('0xc'),auth[_0x7e20('0xa')](),controller['destroy']);module[_0x7e20('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f4392c9..08ce41e 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 _0x05ae=['name','sequelize','exports','STRING'];(function(_0x5472ec,_0x48d49e){var _0x82a54a=function(_0x3d3bbf){while(--_0x3d3bbf){_0x5472ec['push'](_0x5472ec['shift']());}};_0x82a54a(++_0x48d49e);}(_0x05ae,0xd9));var _0xe05a=function(_0x1727d0,_0x3a4d8e){_0x1727d0=_0x1727d0-0x0;var _0x971c9e=_0x05ae[_0x1727d0];return _0x971c9e;};'use strict';var Sequelize=require(_0xe05a('0x0'));module[_0xe05a('0x1')]={'name':{'type':Sequelize[_0xe05a('0x2')],'unique':_0xe05a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6088=['exports','name','STRING','sequelize'];(function(_0x5eba02,_0x5e3745){var _0x1d9617=function(_0x277d65){while(--_0x277d65){_0x5eba02['push'](_0x5eba02['shift']());}};_0x1d9617(++_0x5e3745);}(_0x6088,0x16b));var _0x8608=function(_0x41ff31,_0x4e234b){_0x41ff31=_0x41ff31-0x0;var _0x3409dc=_0x6088[_0x41ff31];return _0x3409dc;};'use strict';var Sequelize=require(_0x8608('0x0'));module[_0x8608('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8608('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x8608('0x3')]},'description':{'type':Sequelize[_0x8608('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 269e213..ca26af6 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 _0x96b8=['then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','include','rows','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x96b8,0x18f));var _0x896b=function(_0x1fd3e2,_0x1a6772){_0x1fd3e2=_0x1fd3e2-0x0;var _0x5a9210=_0x96b8[_0x1fd3e2];return _0x5a9210;};'use strict';var emlformat=require(_0x896b('0x0'));var rimraf=require(_0x896b('0x1'));var zipdir=require(_0x896b('0x2'));var jsonpatch=require(_0x896b('0x3'));var rp=require('request-promise');var moment=require(_0x896b('0x4'));var BPromise=require(_0x896b('0x5'));var Mustache=require(_0x896b('0x6'));var util=require('util');var path=require(_0x896b('0x7'));var sox=require(_0x896b('0x8'));var csv=require(_0x896b('0x9'));var ejs=require(_0x896b('0xa'));var fs=require('fs');var fs_extra=require(_0x896b('0xb'));var _=require(_0x896b('0xc'));var squel=require(_0x896b('0xd'));var crypto=require(_0x896b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x896b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x896b('0x10'));var Redis=require('ioredis');var authService=require(_0x896b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x896b('0x12'));var logger=require('../../config/logger')(_0x896b('0x13'));var utils=require(_0x896b('0x14'));var config=require(_0x896b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x896b('0x16'))['db'];function respondWithStatusCode(_0x26a8eb,_0x5cf243){_0x5cf243=_0x5cf243||0xcc;return function(_0x587d11){if(_0x587d11){return _0x26a8eb[_0x896b('0x17')](_0x5cf243);}return _0x26a8eb[_0x896b('0x18')](_0x5cf243)[_0x896b('0x19')]();};}function respondWithResult(_0xd1e456,_0x548641){_0x548641=_0x548641||0xc8;return function(_0x5f335e){if(_0x5f335e){return _0xd1e456[_0x896b('0x18')](_0x548641)[_0x896b('0x1a')](_0x5f335e);}};}function respondWithFilteredResult(_0x143f7c,_0x2c8bce){return function(_0x4f1153){if(_0x4f1153){var _0x354c29=typeof _0x2c8bce['offset']===_0x896b('0x1b')&&typeof _0x2c8bce[_0x896b('0x1c')]===_0x896b('0x1b');var _0x2d87d2=_0x4f1153[_0x896b('0x1d')];var _0x181a0b=_0x354c29?0x0:_0x2c8bce[_0x896b('0x1e')];var _0x233f3b=_0x354c29?_0x4f1153['count']:_0x2c8bce['offset']+_0x2c8bce[_0x896b('0x1c')];var _0x57acb8;if(_0x233f3b>=_0x2d87d2){_0x233f3b=_0x2d87d2;_0x57acb8=0xc8;}else{_0x57acb8=0xce;}_0x143f7c[_0x896b('0x18')](_0x57acb8);return _0x143f7c[_0x896b('0x1f')](_0x896b('0x20'),_0x181a0b+'-'+_0x233f3b+'/'+_0x2d87d2)['json'](_0x4f1153);}return null;};}function patchUpdates(_0x3fbd2a){return function(_0x1188bc){try{jsonpatch[_0x896b('0x21')](_0x1188bc,_0x3fbd2a,!![]);}catch(_0xc40fea){return BPromise[_0x896b('0x22')](_0xc40fea);}return _0x1188bc['save']();};}function saveUpdates(_0xf6e65e,_0x11dfec){return function(_0x27acb6){if(_0x27acb6){return _0x27acb6[_0x896b('0x23')](_0xf6e65e)[_0x896b('0x24')](function(_0x22914d){return _0x22914d;});}return null;};}function removeEntity(_0x55cbc2,_0x8c6842){return function(_0x340327){if(_0x340327){return _0x340327[_0x896b('0x25')]()['then'](function(){var _0x4cdd69=_0x340327[_0x896b('0x26')]({'plain':!![]});var _0x474fd0=_0x896b('0x27');return db[_0x896b('0x28')][_0x896b('0x25')]({'where':{'type':_0x474fd0,'resourceId':_0x4cdd69['id']}})[_0x896b('0x24')](function(){return _0x340327;});})['then'](function(){_0x55cbc2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20e343,_0x1682fe){return function(_0xa31757){if(!_0xa31757){_0x20e343[_0x896b('0x17')](0x194);}return _0xa31757;};}function handleError(_0x39ae6b,_0x403afa){_0x403afa=_0x403afa||0x1f4;return function(_0x590507){logger[_0x896b('0x29')](_0x590507[_0x896b('0x2a')]);if(_0x590507[_0x896b('0x2b')]){delete _0x590507[_0x896b('0x2b')];}_0x39ae6b[_0x896b('0x18')](_0x403afa)[_0x896b('0x2c')](_0x590507);};}exports['index']=function(_0x2543bf,_0xad639f){var _0x421c7c={},_0x18807a={},_0x125547={'count':0x0,'rows':[]};var _0x21d2bb=_[_0x896b('0x2d')](db['SquareOdbc'][_0x896b('0x2e')],function(_0x3519ba){return{'name':_0x3519ba[_0x896b('0x2f')],'type':_0x3519ba[_0x896b('0x30')]['key']};});_0x18807a[_0x896b('0x31')]=_[_0x896b('0x2d')](_0x21d2bb,_0x896b('0x2b'));_0x18807a[_0x896b('0x32')]=_[_0x896b('0x33')](_0x2543bf[_0x896b('0x32')]);_0x18807a['filters']=_[_0x896b('0x34')](_0x18807a[_0x896b('0x31')],_0x18807a[_0x896b('0x32')]);_0x421c7c['attributes']=_[_0x896b('0x34')](_0x18807a['model'],qs[_0x896b('0x35')](_0x2543bf[_0x896b('0x32')][_0x896b('0x35')]));_0x421c7c[_0x896b('0x36')]=_0x421c7c[_0x896b('0x36')][_0x896b('0x37')]?_0x421c7c[_0x896b('0x36')]:_0x18807a[_0x896b('0x31')];if(!_0x2543bf[_0x896b('0x32')][_0x896b('0x38')](_0x896b('0x39'))){_0x421c7c[_0x896b('0x1c')]=qs['limit'](_0x2543bf[_0x896b('0x32')]['limit']);_0x421c7c[_0x896b('0x1e')]=qs['offset'](_0x2543bf[_0x896b('0x32')][_0x896b('0x1e')]);}_0x421c7c[_0x896b('0x3a')]=qs[_0x896b('0x3b')](_0x2543bf[_0x896b('0x32')][_0x896b('0x3b')]);_0x421c7c[_0x896b('0x3c')]=qs[_0x896b('0x3d')](_[_0x896b('0x3e')](_0x2543bf['query'],_0x18807a[_0x896b('0x3d')]),_0x21d2bb);if(_0x2543bf[_0x896b('0x32')][_0x896b('0x3f')]){_0x421c7c[_0x896b('0x3c')]=_[_0x896b('0x40')](_0x421c7c[_0x896b('0x3c')],{'$or':_[_0x896b('0x2d')](_0x21d2bb,function(_0x447a4b){if(_0x447a4b[_0x896b('0x30')]!==_0x896b('0x41')){var _0x771e2a={};_0x771e2a[_0x447a4b['name']]={'$like':'%'+_0x2543bf[_0x896b('0x32')][_0x896b('0x3f')]+'%'};return _0x771e2a;}})});}_0x421c7c=_[_0x896b('0x40')]({},_0x421c7c,_0x2543bf[_0x896b('0x42')]);var _0x19060b={'where':_0x421c7c[_0x896b('0x3c')]};return db[_0x896b('0x43')][_0x896b('0x1d')](_0x19060b)[_0x896b('0x24')](function(_0x5553e6){_0x125547[_0x896b('0x1d')]=_0x5553e6;if(_0x2543bf[_0x896b('0x32')][_0x896b('0x44')]){_0x421c7c[_0x896b('0x45')]=[{'all':!![]}];}return db[_0x896b('0x43')]['findAll'](_0x421c7c);})[_0x896b('0x24')](function(_0x2f383e){_0x125547[_0x896b('0x46')]=_0x2f383e;return _0x125547;})[_0x896b('0x24')](respondWithFilteredResult(_0xad639f,_0x421c7c))['catch'](handleError(_0xad639f,null));};exports[_0x896b('0x47')]=function(_0x1eaeb3,_0x295dcf){var _0x50ec22={'raw':!![],'where':{'id':_0x1eaeb3['params']['id']}},_0x141590={};_0x141590['model']=_['keys'](db[_0x896b('0x43')][_0x896b('0x2e')]);_0x141590['query']=_[_0x896b('0x33')](_0x1eaeb3['query']);_0x141590[_0x896b('0x3d')]=_[_0x896b('0x34')](_0x141590['model'],_0x141590[_0x896b('0x32')]);_0x50ec22[_0x896b('0x36')]=_[_0x896b('0x34')](_0x141590[_0x896b('0x31')],qs[_0x896b('0x35')](_0x1eaeb3[_0x896b('0x32')][_0x896b('0x35')]));_0x50ec22[_0x896b('0x36')]=_0x50ec22[_0x896b('0x36')]['length']?_0x50ec22['attributes']:_0x141590[_0x896b('0x31')];if(_0x1eaeb3[_0x896b('0x32')][_0x896b('0x44')]){_0x50ec22['include']=[{'all':!![]}];}_0x50ec22=_[_0x896b('0x40')]({},_0x50ec22,_0x1eaeb3[_0x896b('0x42')]);return db[_0x896b('0x43')][_0x896b('0x48')](_0x50ec22)[_0x896b('0x24')](handleEntityNotFound(_0x295dcf,null))[_0x896b('0x24')](respondWithResult(_0x295dcf,null))[_0x896b('0x49')](handleError(_0x295dcf,null));};exports['create']=function(_0x5174df,_0x142628){return db[_0x896b('0x43')][_0x896b('0x4a')](_0x5174df[_0x896b('0x4b')],{})[_0x896b('0x24')](function(_0x34ac5e){var _0x1071a1=_0x5174df[_0x896b('0x4c')]['get']({'plain':!![]});if(!_0x1071a1)throw new Error(_0x896b('0x4d'));if(_0x1071a1[_0x896b('0x4e')]===_0x896b('0x4c')){var _0x20f41d=_0x34ac5e[_0x896b('0x26')]({'plain':!![]});var _0x2b46ce=_0x896b('0x27');return db[_0x896b('0x4f')][_0x896b('0x48')]({'where':{'name':_0x2b46ce,'userProfileId':_0x1071a1[_0x896b('0x50')]},'raw':!![]})[_0x896b('0x24')](function(_0x4dacaa){if(_0x4dacaa&&_0x4dacaa['autoAssociation']===0x0){return db['UserProfileResource'][_0x896b('0x4a')]({'name':_0x20f41d['name'],'resourceId':_0x20f41d['id'],'type':_0x4dacaa[_0x896b('0x2b')],'sectionId':_0x4dacaa['id']},{})[_0x896b('0x24')](function(){return _0x34ac5e;});}else{return _0x34ac5e;}})[_0x896b('0x49')](function(_0x120599){logger[_0x896b('0x29')](_0x896b('0x51'),_0x120599);throw _0x120599;});}return _0x34ac5e;})[_0x896b('0x24')](respondWithResult(_0x142628,0xc9))[_0x896b('0x49')](handleError(_0x142628,null));};exports[_0x896b('0x23')]=function(_0x354341,_0x4466bc){if(_0x354341[_0x896b('0x4b')]['id']){delete _0x354341[_0x896b('0x4b')]['id'];}return db[_0x896b('0x43')][_0x896b('0x48')]({'where':{'id':_0x354341[_0x896b('0x52')]['id']}})['then'](handleEntityNotFound(_0x4466bc,null))['then'](saveUpdates(_0x354341[_0x896b('0x4b')],null))[_0x896b('0x24')](respondWithResult(_0x4466bc,null))['catch'](handleError(_0x4466bc,null));};exports[_0x896b('0x25')]=function(_0x317a6c,_0x5e9d78){return db[_0x896b('0x43')][_0x896b('0x48')]({'where':{'id':_0x317a6c[_0x896b('0x52')]['id']}})[_0x896b('0x24')](handleEntityNotFound(_0x5e9d78,null))['then'](removeEntity(_0x5e9d78,null))[_0x896b('0x49')](handleError(_0x5e9d78,null));};exports['test']=function(_0x24c7cb,_0x270178,_0x2290ae){var _0x396a45;return db[_0x896b('0x43')][_0x896b('0x48')]({'where':{'id':_0x24c7cb[_0x896b('0x52')]['id']},'attributes':['id',_0x896b('0x53')]})[_0x896b('0x24')](handleEntityNotFound(_0x270178,null))[_0x896b('0x24')](function(_0x3a0843){if(_0x3a0843){var _0x376daa=require(_0x896b('0x54'))();_0x376daa[_0x896b('0x55')](_0x3a0843[_0x896b('0x53')]);_0x376daa[_0x896b('0x56')]();return _0x3a0843;}})[_0x896b('0x24')](respondWithResult(_0x270178,null))[_0x896b('0x49')](handleError(_0x270178,null));}; \ No newline at end of file +var _0x3793=['update','then','destroy','get','ODBC','error','name','send','index','map','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','SquareOdbc','includeAll','include','findAll','params','keys','find','catch','create','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x5308ef,_0x1a9bda){var _0x53eef9=function(_0x5eca02){while(--_0x5eca02){_0x5308ef['push'](_0x5308ef['shift']());}};_0x53eef9(++_0x1a9bda);}(_0x3793,0xd9));var _0x3379=function(_0x5d5fe4,_0x3e6dcf){_0x5d5fe4=_0x5d5fe4-0x0;var _0x512d41=_0x3793[_0x5d5fe4];return _0x512d41;};'use strict';var emlformat=require(_0x3379('0x0'));var rimraf=require(_0x3379('0x1'));var zipdir=require(_0x3379('0x2'));var jsonpatch=require(_0x3379('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3379('0x4'));var Mustache=require(_0x3379('0x5'));var util=require('util');var path=require(_0x3379('0x6'));var sox=require(_0x3379('0x7'));var csv=require(_0x3379('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3379('0x9'));var _=require(_0x3379('0xa'));var squel=require('squel');var crypto=require(_0x3379('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3379('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3379('0xd'));var Redis=require(_0x3379('0xe'));var authService=require(_0x3379('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3379('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3379('0x11'))(_0x3379('0x12'));var utils=require('../../config/utils');var config=require(_0x3379('0x13'));var licenseUtil=require(_0x3379('0x14'));var db=require(_0x3379('0x15'))['db'];function respondWithStatusCode(_0x13fe6e,_0x3acf22){_0x3acf22=_0x3acf22||0xcc;return function(_0x209c23){if(_0x209c23){return _0x13fe6e[_0x3379('0x16')](_0x3acf22);}return _0x13fe6e[_0x3379('0x17')](_0x3acf22)[_0x3379('0x18')]();};}function respondWithResult(_0x435188,_0x45ebfc){_0x45ebfc=_0x45ebfc||0xc8;return function(_0x4786a2){if(_0x4786a2){return _0x435188[_0x3379('0x17')](_0x45ebfc)[_0x3379('0x19')](_0x4786a2);}};}function respondWithFilteredResult(_0x17e2ab,_0x30af3d){return function(_0x38a8d5){if(_0x38a8d5){var _0x154512=typeof _0x30af3d[_0x3379('0x1a')]===_0x3379('0x1b')&&typeof _0x30af3d[_0x3379('0x1c')]===_0x3379('0x1b');var _0xf79d8c=_0x38a8d5['count'];var _0x42fbfb=_0x154512?0x0:_0x30af3d['offset'];var _0x417c78=_0x154512?_0x38a8d5[_0x3379('0x1d')]:_0x30af3d[_0x3379('0x1a')]+_0x30af3d[_0x3379('0x1c')];var _0x1c9451;if(_0x417c78>=_0xf79d8c){_0x417c78=_0xf79d8c;_0x1c9451=0xc8;}else{_0x1c9451=0xce;}_0x17e2ab[_0x3379('0x17')](_0x1c9451);return _0x17e2ab[_0x3379('0x1e')](_0x3379('0x1f'),_0x42fbfb+'-'+_0x417c78+'/'+_0xf79d8c)[_0x3379('0x19')](_0x38a8d5);}return null;};}function patchUpdates(_0x56d08b){return function(_0x18f3e0){try{jsonpatch[_0x3379('0x20')](_0x18f3e0,_0x56d08b,!![]);}catch(_0x19da16){return BPromise[_0x3379('0x21')](_0x19da16);}return _0x18f3e0[_0x3379('0x22')]();};}function saveUpdates(_0x390b2b,_0x575bea){return function(_0x467f45){if(_0x467f45){return _0x467f45[_0x3379('0x23')](_0x390b2b)[_0x3379('0x24')](function(_0x24b3f3){return _0x24b3f3;});}return null;};}function removeEntity(_0x1e21bd,_0x574ea8){return function(_0x3d9a6e){if(_0x3d9a6e){return _0x3d9a6e[_0x3379('0x25')]()[_0x3379('0x24')](function(){var _0xe5cb24=_0x3d9a6e[_0x3379('0x26')]({'plain':!![]});var _0x780fa3=_0x3379('0x27');return db['UserProfileResource'][_0x3379('0x25')]({'where':{'type':_0x780fa3,'resourceId':_0xe5cb24['id']}})[_0x3379('0x24')](function(){return _0x3d9a6e;});})[_0x3379('0x24')](function(){_0x1e21bd[_0x3379('0x17')](0xcc)[_0x3379('0x18')]();});}};}function handleEntityNotFound(_0x194d7b,_0x97074){return function(_0x4d7195){if(!_0x4d7195){_0x194d7b[_0x3379('0x16')](0x194);}return _0x4d7195;};}function handleError(_0xf11718,_0x3d1920){_0x3d1920=_0x3d1920||0x1f4;return function(_0x59e079){logger[_0x3379('0x28')](_0x59e079['stack']);if(_0x59e079['name']){delete _0x59e079[_0x3379('0x29')];}_0xf11718[_0x3379('0x17')](_0x3d1920)[_0x3379('0x2a')](_0x59e079);};}exports[_0x3379('0x2b')]=function(_0x45366e,_0x3efafb){var _0x239e41={},_0x308c60={},_0x3411f4={'count':0x0,'rows':[]};var _0x566595=_[_0x3379('0x2c')](db['SquareOdbc'][_0x3379('0x2d')],function(_0x4f27ef){return{'name':_0x4f27ef[_0x3379('0x2e')],'type':_0x4f27ef[_0x3379('0x2f')]['key']};});_0x308c60['model']=_['map'](_0x566595,_0x3379('0x29'));_0x308c60['query']=_['keys'](_0x45366e[_0x3379('0x30')]);_0x308c60['filters']=_[_0x3379('0x31')](_0x308c60[_0x3379('0x32')],_0x308c60['query']);_0x239e41[_0x3379('0x33')]=_[_0x3379('0x31')](_0x308c60['model'],qs['fields'](_0x45366e['query'][_0x3379('0x34')]));_0x239e41[_0x3379('0x33')]=_0x239e41[_0x3379('0x33')][_0x3379('0x35')]?_0x239e41[_0x3379('0x33')]:_0x308c60[_0x3379('0x32')];if(!_0x45366e['query']['hasOwnProperty'](_0x3379('0x36'))){_0x239e41['limit']=qs[_0x3379('0x1c')](_0x45366e[_0x3379('0x30')][_0x3379('0x1c')]);_0x239e41[_0x3379('0x1a')]=qs['offset'](_0x45366e['query'][_0x3379('0x1a')]);}_0x239e41[_0x3379('0x37')]=qs[_0x3379('0x38')](_0x45366e['query'][_0x3379('0x38')]);_0x239e41['where']=qs[_0x3379('0x39')](_[_0x3379('0x3a')](_0x45366e[_0x3379('0x30')],_0x308c60[_0x3379('0x39')]),_0x566595);if(_0x45366e[_0x3379('0x30')][_0x3379('0x3b')]){_0x239e41[_0x3379('0x3c')]=_['merge'](_0x239e41[_0x3379('0x3c')],{'$or':_[_0x3379('0x2c')](_0x566595,function(_0x38b8bc){if(_0x38b8bc['type']!==_0x3379('0x3d')){var _0x46a61e={};_0x46a61e[_0x38b8bc['name']]={'$like':'%'+_0x45366e[_0x3379('0x30')][_0x3379('0x3b')]+'%'};return _0x46a61e;}})});}_0x239e41=_[_0x3379('0x3e')]({},_0x239e41,_0x45366e[_0x3379('0x3f')]);var _0x28c8ce={'where':_0x239e41[_0x3379('0x3c')]};return db[_0x3379('0x40')][_0x3379('0x1d')](_0x28c8ce)[_0x3379('0x24')](function(_0x4315f5){_0x3411f4['count']=_0x4315f5;if(_0x45366e['query'][_0x3379('0x41')]){_0x239e41[_0x3379('0x42')]=[{'all':!![]}];}return db[_0x3379('0x40')][_0x3379('0x43')](_0x239e41);})[_0x3379('0x24')](function(_0x5bce9a){_0x3411f4['rows']=_0x5bce9a;return _0x3411f4;})['then'](respondWithFilteredResult(_0x3efafb,_0x239e41))['catch'](handleError(_0x3efafb,null));};exports['show']=function(_0x23103d,_0x408c79){var _0x462b7f={'raw':!![],'where':{'id':_0x23103d[_0x3379('0x44')]['id']}},_0x37f585={};_0x37f585['model']=_[_0x3379('0x45')](db[_0x3379('0x40')][_0x3379('0x2d')]);_0x37f585['query']=_[_0x3379('0x45')](_0x23103d['query']);_0x37f585[_0x3379('0x39')]=_[_0x3379('0x31')](_0x37f585[_0x3379('0x32')],_0x37f585['query']);_0x462b7f[_0x3379('0x33')]=_['intersection'](_0x37f585[_0x3379('0x32')],qs[_0x3379('0x34')](_0x23103d[_0x3379('0x30')][_0x3379('0x34')]));_0x462b7f[_0x3379('0x33')]=_0x462b7f['attributes'][_0x3379('0x35')]?_0x462b7f['attributes']:_0x37f585[_0x3379('0x32')];if(_0x23103d['query'][_0x3379('0x41')]){_0x462b7f[_0x3379('0x42')]=[{'all':!![]}];}_0x462b7f=_[_0x3379('0x3e')]({},_0x462b7f,_0x23103d[_0x3379('0x3f')]);return db[_0x3379('0x40')][_0x3379('0x46')](_0x462b7f)[_0x3379('0x24')](handleEntityNotFound(_0x408c79,null))['then'](respondWithResult(_0x408c79,null))[_0x3379('0x47')](handleError(_0x408c79,null));};exports[_0x3379('0x48')]=function(_0x206186,_0x2dd9cb){return db[_0x3379('0x40')][_0x3379('0x48')](_0x206186['body'],{})[_0x3379('0x24')](function(_0x47e244){var _0x4dc094=_0x206186['user'][_0x3379('0x26')]({'plain':!![]});if(!_0x4dc094)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dc094['role']===_0x3379('0x49')){var _0x12c6eb=_0x47e244[_0x3379('0x26')]({'plain':!![]});var _0x5dde15='ODBC';return db[_0x3379('0x4a')][_0x3379('0x46')]({'where':{'name':_0x5dde15,'userProfileId':_0x4dc094[_0x3379('0x4b')]},'raw':!![]})['then'](function(_0x28d771){if(_0x28d771&&_0x28d771[_0x3379('0x4c')]===0x0){return db[_0x3379('0x4d')][_0x3379('0x48')]({'name':_0x12c6eb[_0x3379('0x29')],'resourceId':_0x12c6eb['id'],'type':_0x28d771[_0x3379('0x29')],'sectionId':_0x28d771['id']},{})['then'](function(){return _0x47e244;});}else{return _0x47e244;}})[_0x3379('0x47')](function(_0x290ebd){logger[_0x3379('0x28')](_0x3379('0x4e'),_0x290ebd);throw _0x290ebd;});}return _0x47e244;})[_0x3379('0x24')](respondWithResult(_0x2dd9cb,0xc9))[_0x3379('0x47')](handleError(_0x2dd9cb,null));};exports['update']=function(_0x3941d7,_0x1eb8e9){if(_0x3941d7[_0x3379('0x4f')]['id']){delete _0x3941d7['body']['id'];}return db[_0x3379('0x40')][_0x3379('0x46')]({'where':{'id':_0x3941d7[_0x3379('0x44')]['id']}})[_0x3379('0x24')](handleEntityNotFound(_0x1eb8e9,null))['then'](saveUpdates(_0x3941d7[_0x3379('0x4f')],null))['then'](respondWithResult(_0x1eb8e9,null))[_0x3379('0x47')](handleError(_0x1eb8e9,null));};exports['destroy']=function(_0x3f309f,_0x3697a0){return db['SquareOdbc'][_0x3379('0x46')]({'where':{'id':_0x3f309f[_0x3379('0x44')]['id']}})['then'](handleEntityNotFound(_0x3697a0,null))[_0x3379('0x24')](removeEntity(_0x3697a0,null))[_0x3379('0x47')](handleError(_0x3697a0,null));};exports[_0x3379('0x50')]=function(_0x268e88,_0x3e7585,_0x38541f){var _0x5e6796;return db[_0x3379('0x40')]['find']({'where':{'id':_0x268e88[_0x3379('0x44')]['id']},'attributes':['id','dsn']})[_0x3379('0x24')](handleEntityNotFound(_0x3e7585,null))[_0x3379('0x24')](function(_0x4a8a31){if(_0x4a8a31){var _0x76e594=require(_0x3379('0x51'))();_0x76e594[_0x3379('0x52')](_0x4a8a31[_0x3379('0x53')]);_0x76e594['closeSync']();return _0x4a8a31;}})['then'](respondWithResult(_0x3e7585,null))[_0x3379('0x47')](handleError(_0x3e7585,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7441d25..c7dc042 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 _0x9a62=['square_odbc','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x521388,_0x496912){var _0x21f702=function(_0x355165){while(--_0x355165){_0x521388['push'](_0x521388['shift']());}};_0x21f702(++_0x496912);}(_0x9a62,0xd1));var _0x29a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a62[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x29a6('0x0'));var util=require(_0x29a6('0x1'));var logger=require('../../config/logger')(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require(_0x29a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29a6('0x5'));var rimraf=require(_0x29a6('0x6'));var config=require(_0x29a6('0x7'));var attributes=require(_0x29a6('0x8'));module[_0x29a6('0x9')]=function(_0x4d323d,_0x53dafd){return _0x4d323d[_0x29a6('0xa')](_0x29a6('0xb'),attributes,{'tableName':_0x29a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x612a=['SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise','path','./squareOdbc.attributes','exports','define'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0x612a,0xf2));var _0xa612=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x612a[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0xa612('0x0'));var util=require(_0xa612('0x1'));var logger=require('../../config/logger')(_0xa612('0x2'));var moment=require(_0xa612('0x3'));var BPromise=require(_0xa612('0x4'));var rp=require(_0xa612('0x5'));var fs=require('fs');var path=require(_0xa612('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa612('0x7'));module[_0xa612('0x8')]=function(_0x2254d4,_0x11d007){return _0x2254d4[_0xa612('0x9')](_0xa612('0xa'),attributes,{'tableName':_0xa612('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index e1e833b..5797880 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 _0x837f=['SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','SquareOdbc','options','raw','where','attributes','include','map','model','ShowSquareOdbc','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5f5cb3,_0x56e8ca){var _0x58a81c=function(_0x1e4976){while(--_0x1e4976){_0x5f5cb3['push'](_0x5f5cb3['shift']());}};_0x58a81c(++_0x56e8ca);}(_0x837f,0x8e));var _0xf837=function(_0x2f5d4d,_0x40fbd4){_0x2f5d4d=_0x2f5d4d-0x0;var _0x562958=_0x837f[_0x2f5d4d];return _0x562958;};'use strict';var _=require(_0xf837('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf837('0x1'));var rs=require(_0xf837('0x2'));var fs=require('fs');var Redis=require(_0xf837('0x3'));var db=require(_0xf837('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf837('0x5'))(_0xf837('0x6'));var config=require(_0xf837('0x7'));var jayson=require(_0xf837('0x8'));var client=jayson[_0xf837('0x9')][_0xf837('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be9f5,_0x13fde0,_0x48608d){return new BPromise(function(_0x11b239,_0x413849){return client[_0xf837('0xb')](_0x1be9f5,_0x48608d)[_0xf837('0xc')](function(_0x5a5dae){logger['info'](_0xf837('0xd'),_0x13fde0,_0xf837('0xe'));logger[_0xf837('0xf')](_0xf837('0x10'),_0x13fde0,_0xf837('0xe'),JSON[_0xf837('0x11')](_0x5a5dae));if(_0x5a5dae[_0xf837('0x12')]){if(_0x5a5dae[_0xf837('0x12')]['code']===0x1f4){logger[_0xf837('0x12')](_0xf837('0xd'),_0x13fde0,_0x5a5dae[_0xf837('0x12')][_0xf837('0x13')]);return _0x413849(_0x5a5dae[_0xf837('0x12')][_0xf837('0x13')]);}logger[_0xf837('0x12')](_0xf837('0xd'),_0x13fde0,_0x5a5dae[_0xf837('0x12')][_0xf837('0x13')]);return _0x11b239(_0x5a5dae[_0xf837('0x12')]['message']);}else{logger[_0xf837('0x14')](_0xf837('0xd'),_0x13fde0,_0xf837('0xe'));_0x11b239(_0x5a5dae['result'][_0xf837('0x13')]);}})[_0xf837('0x15')](function(_0x1b5d08){logger[_0xf837('0x12')](_0xf837('0xd'),_0x13fde0,_0x1b5d08);_0x413849(_0x1b5d08);});});}exports['ShowSquareOdbc']=function(_0x1da662){var _0x5e9d56=this;return new Promise(function(_0x33972d,_0x537bbe){return db[_0xf837('0x16')]['find']({'raw':_0x1da662[_0xf837('0x17')]?_0x1da662[_0xf837('0x17')][_0xf837('0x18')]===undefined?!![]:![]:!![],'where':_0x1da662['options']?_0x1da662[_0xf837('0x17')][_0xf837('0x19')]||null:null,'attributes':_0x1da662[_0xf837('0x17')]?_0x1da662[_0xf837('0x17')][_0xf837('0x1a')]||null:null,'include':_0x1da662[_0xf837('0x17')]?_0x1da662[_0xf837('0x17')][_0xf837('0x1b')]?_[_0xf837('0x1c')](_0x1da662[_0xf837('0x17')][_0xf837('0x1b')],function(_0x156559){return{'model':db[_0x156559['model']],'as':_0x156559['as'],'attributes':_0x156559[_0xf837('0x1a')],'include':_0x156559[_0xf837('0x1b')]?_['map'](_0x156559['include'],function(_0x1d56d4){return{'model':db[_0x1d56d4[_0xf837('0x1d')]],'as':_0x1d56d4['as'],'attributes':_0x1d56d4[_0xf837('0x1a')],'include':_0x1d56d4['include']?_[_0xf837('0x1c')](_0x1d56d4[_0xf837('0x1b')],function(_0x593463){return{'model':db[_0x593463[_0xf837('0x1d')]],'as':_0x593463['as'],'attributes':_0x593463['attributes']};}):[]};}):[]};}):[]:[]})[_0xf837('0xc')](function(_0x1ad493){logger[_0xf837('0x14')]('ShowSquareOdbc',_0x1da662);logger[_0xf837('0xf')](_0xf837('0x1e'),_0x1da662,JSON[_0xf837('0x11')](_0x1ad493));_0x33972d(_0x1ad493);})['catch'](function(_0x4cd6df){logger['error'](_0xf837('0x1e'),_0x4cd6df['message'],_0x1da662);_0x537bbe(_0x5e9d56[_0xf837('0x12')](0x1f4,_0x4cd6df[_0xf837('0x13')]));});});}; \ No newline at end of file +var _0x61c7=['where','include','model','map','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ShowSquareOdbc','find','options','raw'];(function(_0x20a532,_0x521afd){var _0x49b8a9=function(_0x3c2bdd){while(--_0x3c2bdd){_0x20a532['push'](_0x20a532['shift']());}};_0x49b8a9(++_0x521afd);}(_0x61c7,0x137));var _0x761c=function(_0x22f35f,_0x108401){_0x22f35f=_0x22f35f-0x0;var _0x3938c0=_0x61c7[_0x22f35f];return _0x3938c0;};'use strict';var _=require('lodash');var util=require(_0x761c('0x0'));var moment=require(_0x761c('0x1'));var BPromise=require(_0x761c('0x2'));var rs=require(_0x761c('0x3'));var fs=require('fs');var Redis=require(_0x761c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x761c('0x5'));var logger=require(_0x761c('0x6'))(_0x761c('0x7'));var config=require(_0x761c('0x8'));var jayson=require(_0x761c('0x9'));var client=jayson[_0x761c('0xa')][_0x761c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b5d7b,_0x5ba4e1,_0x811f2e){return new BPromise(function(_0x15f276,_0x5f4a6e){return client[_0x761c('0xc')](_0x1b5d7b,_0x811f2e)[_0x761c('0xd')](function(_0x277659){logger[_0x761c('0xe')](_0x761c('0xf'),_0x5ba4e1,'request\x20sent');logger[_0x761c('0x10')](_0x761c('0x11'),_0x5ba4e1,'request\x20sent',JSON[_0x761c('0x12')](_0x277659));if(_0x277659[_0x761c('0x13')]){if(_0x277659[_0x761c('0x13')][_0x761c('0x14')]===0x1f4){logger[_0x761c('0x13')](_0x761c('0xf'),_0x5ba4e1,_0x277659[_0x761c('0x13')][_0x761c('0x15')]);return _0x5f4a6e(_0x277659[_0x761c('0x13')][_0x761c('0x15')]);}logger[_0x761c('0x13')](_0x761c('0xf'),_0x5ba4e1,_0x277659['error'][_0x761c('0x15')]);return _0x15f276(_0x277659[_0x761c('0x13')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x5ba4e1,_0x761c('0x16'));_0x15f276(_0x277659[_0x761c('0x17')]['message']);}})[_0x761c('0x18')](function(_0x31361b){logger[_0x761c('0x13')](_0x761c('0xf'),_0x5ba4e1,_0x31361b);_0x5f4a6e(_0x31361b);});});}exports[_0x761c('0x19')]=function(_0x2b2a6c){var _0x2d8381=this;return new Promise(function(_0xf67ab6,_0x3d7d53){return db['SquareOdbc'][_0x761c('0x1a')]({'raw':_0x2b2a6c[_0x761c('0x1b')]?_0x2b2a6c['options'][_0x761c('0x1c')]===undefined?!![]:![]:!![],'where':_0x2b2a6c[_0x761c('0x1b')]?_0x2b2a6c[_0x761c('0x1b')][_0x761c('0x1d')]||null:null,'attributes':_0x2b2a6c[_0x761c('0x1b')]?_0x2b2a6c[_0x761c('0x1b')]['attributes']||null:null,'include':_0x2b2a6c['options']?_0x2b2a6c[_0x761c('0x1b')]['include']?_['map'](_0x2b2a6c[_0x761c('0x1b')][_0x761c('0x1e')],function(_0x4f6373){return{'model':db[_0x4f6373[_0x761c('0x1f')]],'as':_0x4f6373['as'],'attributes':_0x4f6373['attributes'],'include':_0x4f6373[_0x761c('0x1e')]?_[_0x761c('0x20')](_0x4f6373['include'],function(_0x1422b8){return{'model':db[_0x1422b8[_0x761c('0x1f')]],'as':_0x1422b8['as'],'attributes':_0x1422b8[_0x761c('0x21')],'include':_0x1422b8['include']?_[_0x761c('0x20')](_0x1422b8[_0x761c('0x1e')],function(_0xe01980){return{'model':db[_0xe01980[_0x761c('0x1f')]],'as':_0xe01980['as'],'attributes':_0xe01980[_0x761c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x761c('0xd')](function(_0xb2b4f7){logger[_0x761c('0xe')](_0x761c('0x19'),_0x2b2a6c);logger['debug']('ShowSquareOdbc',_0x2b2a6c,JSON[_0x761c('0x12')](_0xb2b4f7));_0xf67ab6(_0xb2b4f7);})[_0x761c('0x18')](function(_0x13e9df){logger[_0x761c('0x13')](_0x761c('0x19'),_0x13e9df[_0x761c('0x15')],_0x2b2a6c);_0x3d7d53(_0x2d8381[_0x761c('0x13')](0x1f4,_0x13e9df['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 593752f..e8655d7 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 _0x280b=['fs-extra','./squareProject.controller','get','index','show','/:id/users','getUsers','post','isAuthenticated','put','update','delete','/:id','removeUsers','exports','util','path','Router'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x280b,0x1bf));var _0xb280=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x280b[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0xb280('0x0'));var path=require(_0xb280('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb280('0x2')]();var fs_extra=require(_0xb280('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb280('0x4'));router[_0xb280('0x5')]('/',auth['isAuthenticated'](),controller[_0xb280('0x6')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb280('0x7')]);router['get'](_0xb280('0x8'),auth['isAuthenticated'](),controller[_0xb280('0x9')]);router[_0xb280('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb280('0xa')]('/:id/users',auth[_0xb280('0xb')](),controller['addUsers']);router[_0xb280('0xc')]('/:id',auth[_0xb280('0xb')](),controller[_0xb280('0xd')]);router[_0xb280('0xe')](_0xb280('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0xb280('0xe')](_0xb280('0x8'),auth['isAuthenticated'](),controller[_0xb280('0x10')]);module[_0xb280('0x11')]=router; \ No newline at end of file +var _0x3dd7=['get','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','put','update','delete','destroy','removeUsers','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller'];(function(_0x5036ed,_0x5f5239){var _0x36d20e=function(_0x257c92){while(--_0x257c92){_0x5036ed['push'](_0x5036ed['shift']());}};_0x36d20e(++_0x5f5239);}(_0x3dd7,0xe9));var _0x73dd=function(_0x3c83f8,_0x28ee63){_0x3c83f8=_0x3c83f8-0x0;var _0x292f92=_0x3dd7[_0x3c83f8];return _0x292f92;};'use strict';var multer=require(_0x73dd('0x0'));var util=require(_0x73dd('0x1'));var path=require(_0x73dd('0x2'));var timeout=require(_0x73dd('0x3'));var express=require('express');var router=express[_0x73dd('0x4')]();var fs_extra=require(_0x73dd('0x5'));var auth=require(_0x73dd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x73dd('0x7'));var controller=require(_0x73dd('0x8'));router[_0x73dd('0x9')]('/',auth['isAuthenticated'](),controller[_0x73dd('0xa')]);router[_0x73dd('0x9')](_0x73dd('0xb'),auth[_0x73dd('0xc')](),controller[_0x73dd('0xd')]);router[_0x73dd('0x9')](_0x73dd('0xe'),auth[_0x73dd('0xc')](),controller[_0x73dd('0xf')]);router[_0x73dd('0x10')]('/',auth[_0x73dd('0xc')](),controller['create']);router[_0x73dd('0x10')]('/:id/users',auth[_0x73dd('0xc')](),controller['addUsers']);router[_0x73dd('0x11')](_0x73dd('0xb'),auth[_0x73dd('0xc')](),controller[_0x73dd('0x12')]);router[_0x73dd('0x13')](_0x73dd('0xb'),auth[_0x73dd('0xc')](),controller[_0x73dd('0x14')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x73dd('0x15')]);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 59e34c6..a42da67 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 _0x8c7f=['preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','name','long','getDataValue'];(function(_0x5aa8cd,_0x4b4906){var _0x3fad8a=function(_0x4ecbf3){while(--_0x4ecbf3){_0x5aa8cd['push'](_0x5aa8cd['shift']());}};_0x3fad8a(++_0x4b4906);}(_0x8c7f,0xa2));var _0xf8c7=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x8c7f[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0xf8c7('0x0'));module[_0xf8c7('0x1')]={'name':{'type':Sequelize[_0xf8c7('0x2')],'unique':_0xf8c7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf8c7('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xf8c7('0x4')),'get':function(){if(this[_0xf8c7('0x5')]('preproduction')){return this[_0xf8c7('0x5')](_0xf8c7('0x6'))[_0xf8c7('0x7')](_0xf8c7('0x8'));}}},'production':{'type':Sequelize[_0xf8c7('0x9')]('long'),'get':function(){if(this[_0xf8c7('0x5')](_0xf8c7('0xa'))){return this['getDataValue'](_0xf8c7('0xa'))[_0xf8c7('0x7')](_0xf8c7('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xf8c7('0xb')]}}; \ No newline at end of file +var _0x4c99=['utf8','DATE','sequelize','STRING','BLOB','long','preproduction','getDataValue','toString','production'];(function(_0x1aa368,_0x56c31d){var _0x3d9e29=function(_0x32c580){while(--_0x32c580){_0x1aa368['push'](_0x1aa368['shift']());}};_0x3d9e29(++_0x56c31d);}(_0x4c99,0x1ec));var _0x94c9=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x4c99[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0x94c9('0x0'));module['exports']={'name':{'type':Sequelize[_0x94c9('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x94c9('0x2')](_0x94c9('0x3')),'get':function(){if(this['getDataValue'](_0x94c9('0x4'))){return this[_0x94c9('0x5')]('preproduction')[_0x94c9('0x6')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x94c9('0x5')](_0x94c9('0x7'))){return this[_0x94c9('0x5')](_0x94c9('0x7'))[_0x94c9('0x6')](_0x94c9('0x8'));}}},'savedAt':{'type':Sequelize[_0x94c9('0x9')]},'publishedAt':{'type':Sequelize[_0x94c9('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8728978..32514ee 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 _0x4c60=['include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','user','role','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','localhost','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SquareProjects','agi','stringify','name','send','index','map','SquareProject','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options'];(function(_0x53dcc7,_0x56e2e1){var _0x57a3c2=function(_0x3c7f51){while(--_0x3c7f51){_0x53dcc7['push'](_0x53dcc7['shift']());}};_0x57a3c2(++_0x56e2e1);}(_0x4c60,0xc1));var _0x04c6=function(_0x236ecf,_0x3a0acb){_0x236ecf=_0x236ecf-0x0;var _0x5efe92=_0x4c60[_0x236ecf];return _0x5efe92;};'use strict';var _=require(_0x04c6('0x0'));var Redis=require(_0x04c6('0x1'));var qs=require(_0x04c6('0x2'));var logger=require(_0x04c6('0x3'))('api');var config=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x04c6('0x5'),'port':0x18eb});var socket=require(_0x04c6('0x6'))(new Redis(config[_0x04c6('0x7')]));require(_0x04c6('0x8'))[_0x04c6('0x9')](socket);function respondWithStatusCode(_0x39be2d,_0x8f9b13){_0x8f9b13=_0x8f9b13||0xcc;return function(_0x530a48){if(_0x530a48){return _0x39be2d[_0x04c6('0xa')](_0x8f9b13);}return _0x39be2d[_0x04c6('0xb')](_0x8f9b13)[_0x04c6('0xc')]();};}function respondWithResult(_0x30b901,_0x52a9af){_0x52a9af=_0x52a9af||0xc8;return function(_0x59a98c){if(_0x59a98c){return _0x30b901['status'](_0x52a9af)[_0x04c6('0xd')](_0x59a98c);}};}function respondWithFilteredResult(_0x5584cd,_0x15d31a){return function(_0x2772fa){if(_0x2772fa){var _0x5236c8=typeof _0x15d31a[_0x04c6('0xe')]===_0x04c6('0xf')&&typeof _0x15d31a[_0x04c6('0x10')]===_0x04c6('0xf');var _0x52cdcf=_0x2772fa[_0x04c6('0x11')];var _0x453342=_0x5236c8?0x0:_0x15d31a[_0x04c6('0xe')];var _0x56422a=_0x5236c8?_0x2772fa[_0x04c6('0x11')]:_0x15d31a[_0x04c6('0xe')]+_0x15d31a[_0x04c6('0x10')];var _0x3e80a6;if(_0x56422a>=_0x52cdcf){_0x56422a=_0x52cdcf;_0x3e80a6=0xc8;}else{_0x3e80a6=0xce;}_0x5584cd[_0x04c6('0xb')](_0x3e80a6);return _0x5584cd[_0x04c6('0x12')](_0x04c6('0x13'),_0x453342+'-'+_0x56422a+'/'+_0x52cdcf)[_0x04c6('0xd')](_0x2772fa);}return null;};}function saveUpdates(_0x5a5a66){return function(_0x31edf9){if(_0x31edf9){return _0x31edf9[_0x04c6('0x14')](_0x5a5a66)[_0x04c6('0x15')](function(_0x2bc754){return _0x2bc754;});}return null;};}function removeEntity(_0x43596a){return function(_0xfb4db5){if(_0xfb4db5){return _0xfb4db5[_0x04c6('0x16')]()[_0x04c6('0x15')](function(){var _0x47f400=_0xfb4db5[_0x04c6('0x17')]({'plain':!![]});var _0x13e472=_0x04c6('0x18');return db['UserProfileResource']['destroy']({'where':{'type':_0x13e472,'resourceId':_0x47f400['id']}})['then'](function(){return _0xfb4db5;});})[_0x04c6('0x15')](function(){var _0xb997e0=new Redis(config['redis']);_0xb997e0['publish'](_0x04c6('0x19'),JSON[_0x04c6('0x1a')]({'id':_0xfb4db5['id'],'deleted':!![]}));})[_0x04c6('0x15')](function(){_0x43596a['status'](0xcc)[_0x04c6('0xc')]();});}};}function handleEntityNotFound(_0x13f2dc){return function(_0x9d41f8){if(!_0x9d41f8){_0x13f2dc['sendStatus'](0x194);}return _0x9d41f8;};}function handleError(_0x2d3277,_0x41e29f){_0x41e29f=_0x41e29f||0x1f4;return function(_0x562491){logger['error'](_0x562491['stack']);if(_0x562491[_0x04c6('0x1b')]){delete _0x562491[_0x04c6('0x1b')];}_0x2d3277[_0x04c6('0xb')](_0x41e29f)[_0x04c6('0x1c')](_0x562491);};}exports[_0x04c6('0x1d')]=function(_0x52e5f5,_0x562952){var _0x383435={},_0x2ab1d2={},_0x9acfa={'count':0x0,'rows':[]};var _0x3233d7=_[_0x04c6('0x1e')](db[_0x04c6('0x1f')]['rawAttributes'],function(_0x1d0d3f){return{'name':_0x1d0d3f[_0x04c6('0x20')],'type':_0x1d0d3f['type'][_0x04c6('0x21')]};});_0x2ab1d2[_0x04c6('0x22')]=_['map'](_0x3233d7,'name');_0x2ab1d2[_0x04c6('0x23')]=_[_0x04c6('0x24')](_0x52e5f5[_0x04c6('0x23')]);_0x2ab1d2[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x2ab1d2[_0x04c6('0x22')],_0x2ab1d2['query']);_0x383435['attributes']=_['intersection'](_0x2ab1d2[_0x04c6('0x22')],qs['fields'](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x27')]));_0x383435['attributes']=_0x383435[_0x04c6('0x28')][_0x04c6('0x29')]?_0x383435[_0x04c6('0x28')]:_0x2ab1d2[_0x04c6('0x22')];if(!_0x52e5f5['query'][_0x04c6('0x2a')](_0x04c6('0x2b'))){_0x383435[_0x04c6('0x10')]=qs[_0x04c6('0x10')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x10')]);_0x383435[_0x04c6('0xe')]=qs[_0x04c6('0xe')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0xe')]);}_0x383435[_0x04c6('0x2c')]=qs[_0x04c6('0x2d')](_0x52e5f5[_0x04c6('0x23')][_0x04c6('0x2d')]);_0x383435[_0x04c6('0x2e')]=qs['filters'](_[_0x04c6('0x2f')](_0x52e5f5[_0x04c6('0x23')],_0x2ab1d2[_0x04c6('0x25')]),_0x3233d7);if(_0x52e5f5[_0x04c6('0x23')]['filter']){_0x383435[_0x04c6('0x2e')]=_[_0x04c6('0x30')](_0x383435['where'],{'$or':_['map'](_0x3233d7,function(_0x4aac49){if(_0x4aac49[_0x04c6('0x31')]!==_0x04c6('0x32')){var _0x4f9a6c={};_0x4f9a6c[_0x4aac49[_0x04c6('0x1b')]]={'$like':'%'+_0x52e5f5['query'][_0x04c6('0x33')]+'%'};return _0x4f9a6c;}})});}_0x383435=_[_0x04c6('0x30')]({},_0x383435,_0x52e5f5[_0x04c6('0x34')]);var _0x2b28cd={'where':_0x383435['where']};return db['SquareProject'][_0x04c6('0x11')](_0x2b28cd)[_0x04c6('0x15')](function(_0x50041f){_0x9acfa[_0x04c6('0x11')]=_0x50041f;if(_0x52e5f5['query']['includeAll']){_0x383435[_0x04c6('0x35')]=[{'all':!![]}];}return db['SquareProject'][_0x04c6('0x36')](_0x383435);})[_0x04c6('0x15')](function(_0x59ca18){_0x9acfa[_0x04c6('0x37')]=_0x59ca18;return _0x9acfa;})['then'](respondWithFilteredResult(_0x562952,_0x383435))[_0x04c6('0x38')](handleError(_0x562952,null));};exports[_0x04c6('0x39')]=function(_0x2d83eb,_0x120238){var _0x679718={'raw':![],'where':{'id':_0x2d83eb[_0x04c6('0x3a')]['id']}},_0x57ed53={};_0x57ed53['model']=_[_0x04c6('0x24')](db['SquareProject'][_0x04c6('0x3b')]);_0x57ed53[_0x04c6('0x23')]=_[_0x04c6('0x24')](_0x2d83eb[_0x04c6('0x23')]);_0x57ed53[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x57ed53[_0x04c6('0x22')],_0x57ed53['query']);_0x679718[_0x04c6('0x28')]=_['intersection'](_0x57ed53[_0x04c6('0x22')],qs['fields'](_0x2d83eb['query'][_0x04c6('0x27')]));_0x679718['attributes']=_0x679718[_0x04c6('0x28')][_0x04c6('0x29')]?_0x679718[_0x04c6('0x28')]:_0x57ed53['model'];if(_0x2d83eb[_0x04c6('0x23')][_0x04c6('0x3c')]){_0x679718[_0x04c6('0x35')]=[{'all':!![]}];}_0x679718=_[_0x04c6('0x30')]({},_0x679718,_0x2d83eb[_0x04c6('0x34')]);return db[_0x04c6('0x1f')][_0x04c6('0x3d')](_0x679718)['then'](handleEntityNotFound(_0x120238,null))['then'](respondWithResult(_0x120238,null))[_0x04c6('0x38')](handleError(_0x120238,null));};exports[_0x04c6('0x3e')]=function(_0x417cb7,_0x5d6726){return db[_0x04c6('0x1f')][_0x04c6('0x3e')](_0x417cb7[_0x04c6('0x3f')],{})['then'](function(_0x4c9942){var _0x56c7e6=_0x417cb7[_0x04c6('0x40')][_0x04c6('0x17')]({'plain':!![]});if(!_0x56c7e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56c7e6[_0x04c6('0x41')]===_0x04c6('0x40')){var _0x2bd045=_0x4c9942['get']({'plain':!![]});var _0x392983=_0x04c6('0x18');return db['UserProfileSection'][_0x04c6('0x3d')]({'where':{'name':_0x392983,'userProfileId':_0x56c7e6[_0x04c6('0x42')]},'raw':!![]})[_0x04c6('0x15')](function(_0xee2822){if(_0xee2822&&_0xee2822['autoAssociation']===0x0){return db[_0x04c6('0x43')][_0x04c6('0x3e')]({'name':_0x2bd045[_0x04c6('0x1b')],'resourceId':_0x2bd045['id'],'type':_0xee2822[_0x04c6('0x1b')],'sectionId':_0xee2822['id']},{})['then'](function(){return _0x4c9942;});}else{return _0x4c9942;}})[_0x04c6('0x38')](function(_0x17824f){logger[_0x04c6('0x44')](_0x04c6('0x45'),_0x17824f);throw _0x17824f;});}return _0x4c9942;})['then'](respondWithResult(_0x5d6726,0xc9))[_0x04c6('0x38')](handleError(_0x5d6726,null));};exports[_0x04c6('0x14')]=function(_0x15ec61,_0x489361){if(_0x15ec61[_0x04c6('0x3f')]['id']){delete _0x15ec61[_0x04c6('0x3f')]['id'];}return db[_0x04c6('0x1f')][_0x04c6('0x3d')]({'where':{'id':_0x15ec61[_0x04c6('0x3a')]['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x489361,null))[_0x04c6('0x15')](saveUpdates(_0x15ec61[_0x04c6('0x3f')],null))[_0x04c6('0x15')](function(_0x12f2c6){if(!_0x12f2c6)return;var _0x27e805=_0x12f2c6[_0x04c6('0x17')]({'plain':!![]});return _0x27e805;})[_0x04c6('0x15')](function(_0x54e577){var _0x3a80f6=new Redis(config[_0x04c6('0x7')]);_0x3a80f6[_0x04c6('0x46')](_0x04c6('0x19'),JSON[_0x04c6('0x1a')](_['pick'](_0x54e577,['id',_0x04c6('0x1b'),_0x04c6('0x47')])));return _0x54e577;})[_0x04c6('0x15')](respondWithResult(_0x489361,null))[_0x04c6('0x38')](handleError(_0x489361,null));};exports[_0x04c6('0x16')]=function(_0x45fbd5,_0x111364){return db[_0x04c6('0x1f')][_0x04c6('0x3d')]({'where':{'id':_0x45fbd5[_0x04c6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x111364,null))['then'](removeEntity(_0x111364,null))['catch'](handleError(_0x111364,null));};exports['addUsers']=function(_0x3be262,_0x4dce86){return db[_0x04c6('0x1f')]['find']({'where':{'id':_0x3be262[_0x04c6('0x3a')]['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x4dce86,null))['then'](function(_0x4dd6bb){if(_0x4dd6bb){return _0x4dd6bb[_0x04c6('0x48')](_0x3be262[_0x04c6('0x3f')][_0x04c6('0x49')],_[_0x04c6('0x4a')](_0x3be262['body'],[_0x04c6('0x49'),'id'])||{});}})[_0x04c6('0x15')](respondWithResult(_0x4dce86,null))[_0x04c6('0x38')](handleError(_0x4dce86,null));};exports[_0x04c6('0x4b')]=function(_0x24c5be,_0x29c72f){return db[_0x04c6('0x1f')]['find']({'where':{'id':_0x24c5be[_0x04c6('0x3a')]['id']}})['then'](handleEntityNotFound(_0x29c72f,null))[_0x04c6('0x15')](function(_0x3bbd8b){if(_0x3bbd8b){return _0x3bbd8b['removeUsers'](_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')])[_0x04c6('0x15')](function(){if(_[_0x04c6('0x4c')](_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')])){for(var _0xf073a8=0x0;_0xf073a8<_0x24c5be[_0x04c6('0x23')]['ids'][_0x04c6('0x29')];_0xf073a8+=0x1){socket['emit'](_0x04c6('0x4d'),{'UserId':Number(_0x24c5be[_0x04c6('0x23')]['ids'][_0xf073a8]),'SquareProjectId':Number(_0x24c5be['params']['id'])});}}else{socket[_0x04c6('0x4e')]('userSquareProject:remove',{'UserId':Number(_0x24c5be[_0x04c6('0x23')][_0x04c6('0x49')]),'SquareProjectId':Number(_0x24c5be['params']['id'])});}});}})[_0x04c6('0x15')](respondWithStatusCode(_0x29c72f,null))[_0x04c6('0x38')](handleError(_0x29c72f,null));};exports[_0x04c6('0x4f')]=function(_0x1cc1a1,_0x2be139){var _0xd12535={};var _0x3e5a53={};var _0x35ca98;var _0x243bc4;return db[_0x04c6('0x1f')][_0x04c6('0x50')]({'where':{'id':_0x1cc1a1['params']['id']}})[_0x04c6('0x15')](handleEntityNotFound(_0x2be139,null))[_0x04c6('0x15')](function(_0x289612){if(_0x289612){_0x35ca98=_0x289612;_0x3e5a53[_0x04c6('0x22')]=_['keys'](db[_0x04c6('0x51')][_0x04c6('0x3b')]);_0x3e5a53[_0x04c6('0x23')]=_['keys'](_0x1cc1a1['query']);_0x3e5a53[_0x04c6('0x25')]=_[_0x04c6('0x26')](_0x3e5a53[_0x04c6('0x22')],_0x3e5a53[_0x04c6('0x23')]);_0xd12535[_0x04c6('0x28')]=_[_0x04c6('0x26')](_0x3e5a53['model'],qs[_0x04c6('0x27')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x27')]));_0xd12535['attributes']=_0xd12535['attributes'][_0x04c6('0x29')]?_0xd12535[_0x04c6('0x28')]:_0x3e5a53[_0x04c6('0x22')];_0xd12535[_0x04c6('0x2c')]=qs['sort'](_0x1cc1a1[_0x04c6('0x23')]['sort']);_0xd12535['where']=qs[_0x04c6('0x25')](_[_0x04c6('0x2f')](_0x1cc1a1[_0x04c6('0x23')],_0x3e5a53[_0x04c6('0x25')]));if(_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x33')]){_0xd12535[_0x04c6('0x2e')]=_['merge'](_0xd12535[_0x04c6('0x2e')],{'$or':_[_0x04c6('0x1e')](_0xd12535[_0x04c6('0x28')],function(_0x329c82){var _0x1c2e79={};_0x1c2e79[_0x329c82]={'$like':'%'+_0x1cc1a1['query']['filter']+'%'};return _0x1c2e79;})});}_0xd12535=_[_0x04c6('0x30')]({},_0xd12535,_0x1cc1a1[_0x04c6('0x34')]);return _0x35ca98[_0x04c6('0x4f')](_0xd12535);}})['then'](function(_0x38bd2e){if(_0x38bd2e){_0x243bc4=_0x38bd2e[_0x04c6('0x29')];if(!_0x1cc1a1['query'][_0x04c6('0x2a')](_0x04c6('0x2b'))){_0xd12535[_0x04c6('0x10')]=qs[_0x04c6('0x10')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0x10')]);_0xd12535[_0x04c6('0xe')]=qs[_0x04c6('0xe')](_0x1cc1a1[_0x04c6('0x23')][_0x04c6('0xe')]);}return _0x35ca98[_0x04c6('0x4f')](_0xd12535);}})[_0x04c6('0x15')](function(_0x38900b){if(_0x38900b){return _0x38900b?{'count':_0x243bc4,'rows':_0x38900b}:null;}})['then'](respondWithResult(_0x2be139,null))[_0x04c6('0x38')](handleError(_0x2be139,null));}; \ No newline at end of file +var _0x896e=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish','sendStatus','error','stack','name','send','map','SquareProject','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','params','keys','options','create','body','user','role','UserProfileSection','find','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','agi','stringify','production','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','lodash','ioredis','../../components/parsers/qs'];(function(_0x1fd948,_0x39efcf){var _0x49a6db=function(_0x4f16d3){while(--_0x4f16d3){_0x1fd948['push'](_0x1fd948['shift']());}};_0x49a6db(++_0x39efcf);}(_0x896e,0x1e9));var _0xe896=function(_0x32706c,_0x1b8fae){_0x32706c=_0x32706c-0x0;var _0x5f200c=_0x896e[_0x32706c];return _0x5f200c;};'use strict';var _=require(_0xe896('0x0'));var Redis=require(_0xe896('0x1'));var qs=require(_0xe896('0x2'));var logger=require(_0xe896('0x3'))(_0xe896('0x4'));var config=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];config[_0xe896('0x7')]=_[_0xe896('0x8')](config[_0xe896('0x7')],{'host':_0xe896('0x9'),'port':0x18eb});var socket=require(_0xe896('0xa'))(new Redis(config['redis']));require(_0xe896('0xb'))[_0xe896('0xc')](socket);function respondWithStatusCode(_0x3b902c,_0x264eeb){_0x264eeb=_0x264eeb||0xcc;return function(_0x43c619){if(_0x43c619){return _0x3b902c['sendStatus'](_0x264eeb);}return _0x3b902c[_0xe896('0xd')](_0x264eeb)[_0xe896('0xe')]();};}function respondWithResult(_0x37a90d,_0x4afd3f){_0x4afd3f=_0x4afd3f||0xc8;return function(_0x305616){if(_0x305616){return _0x37a90d['status'](_0x4afd3f)[_0xe896('0xf')](_0x305616);}};}function respondWithFilteredResult(_0x5be679,_0x409eaf){return function(_0x146b12){if(_0x146b12){var _0xa00ae9=typeof _0x409eaf['offset']===_0xe896('0x10')&&typeof _0x409eaf[_0xe896('0x11')]===_0xe896('0x10');var _0x580aac=_0x146b12[_0xe896('0x12')];var _0x2f1c3e=_0xa00ae9?0x0:_0x409eaf[_0xe896('0x13')];var _0x5383b7=_0xa00ae9?_0x146b12[_0xe896('0x12')]:_0x409eaf[_0xe896('0x13')]+_0x409eaf[_0xe896('0x11')];var _0x564758;if(_0x5383b7>=_0x580aac){_0x5383b7=_0x580aac;_0x564758=0xc8;}else{_0x564758=0xce;}_0x5be679['status'](_0x564758);return _0x5be679[_0xe896('0x14')](_0xe896('0x15'),_0x2f1c3e+'-'+_0x5383b7+'/'+_0x580aac)['json'](_0x146b12);}return null;};}function saveUpdates(_0x5e78d6){return function(_0x11f41c){if(_0x11f41c){return _0x11f41c[_0xe896('0x16')](_0x5e78d6)['then'](function(_0x50d224){return _0x50d224;});}return null;};}function removeEntity(_0x4e062a){return function(_0x41cbd7){if(_0x41cbd7){return _0x41cbd7[_0xe896('0x17')]()[_0xe896('0x18')](function(){var _0x5dc89d=_0x41cbd7[_0xe896('0x19')]({'plain':!![]});var _0x9714f1=_0xe896('0x1a');return db[_0xe896('0x1b')][_0xe896('0x17')]({'where':{'type':_0x9714f1,'resourceId':_0x5dc89d['id']}})[_0xe896('0x18')](function(){return _0x41cbd7;});})[_0xe896('0x18')](function(){var _0x32d3d3=new Redis(config['redis']);_0x32d3d3[_0xe896('0x1c')]('agi',JSON['stringify']({'id':_0x41cbd7['id'],'deleted':!![]}));})[_0xe896('0x18')](function(){_0x4e062a[_0xe896('0xd')](0xcc)[_0xe896('0xe')]();});}};}function handleEntityNotFound(_0xeeec7c){return function(_0x498469){if(!_0x498469){_0xeeec7c[_0xe896('0x1d')](0x194);}return _0x498469;};}function handleError(_0x4ad156,_0x5001f7){_0x5001f7=_0x5001f7||0x1f4;return function(_0x45dd49){logger[_0xe896('0x1e')](_0x45dd49[_0xe896('0x1f')]);if(_0x45dd49[_0xe896('0x20')]){delete _0x45dd49[_0xe896('0x20')];}_0x4ad156[_0xe896('0xd')](_0x5001f7)[_0xe896('0x21')](_0x45dd49);};}exports['index']=function(_0x390128,_0x163a75){var _0xc3cd05={},_0x569d5f={},_0x26635e={'count':0x0,'rows':[]};var _0xd50fe2=_[_0xe896('0x22')](db[_0xe896('0x23')][_0xe896('0x24')],function(_0x3f8ceb){return{'name':_0x3f8ceb['fieldName'],'type':_0x3f8ceb[_0xe896('0x25')][_0xe896('0x26')]};});_0x569d5f[_0xe896('0x27')]=_[_0xe896('0x22')](_0xd50fe2,_0xe896('0x20'));_0x569d5f['query']=_['keys'](_0x390128['query']);_0x569d5f['filters']=_['intersection'](_0x569d5f[_0xe896('0x27')],_0x569d5f[_0xe896('0x28')]);_0xc3cd05[_0xe896('0x29')]=_[_0xe896('0x2a')](_0x569d5f[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x390128[_0xe896('0x28')][_0xe896('0x2b')]));_0xc3cd05['attributes']=_0xc3cd05['attributes'][_0xe896('0x2c')]?_0xc3cd05[_0xe896('0x29')]:_0x569d5f[_0xe896('0x27')];if(!_0x390128[_0xe896('0x28')]['hasOwnProperty'](_0xe896('0x2d'))){_0xc3cd05['limit']=qs['limit'](_0x390128[_0xe896('0x28')][_0xe896('0x11')]);_0xc3cd05[_0xe896('0x13')]=qs['offset'](_0x390128['query']['offset']);}_0xc3cd05[_0xe896('0x2e')]=qs[_0xe896('0x2f')](_0x390128[_0xe896('0x28')][_0xe896('0x2f')]);_0xc3cd05[_0xe896('0x30')]=qs['filters'](_[_0xe896('0x31')](_0x390128[_0xe896('0x28')],_0x569d5f[_0xe896('0x32')]),_0xd50fe2);if(_0x390128[_0xe896('0x28')][_0xe896('0x33')]){_0xc3cd05[_0xe896('0x30')]=_[_0xe896('0x34')](_0xc3cd05[_0xe896('0x30')],{'$or':_['map'](_0xd50fe2,function(_0x42f3fb){if(_0x42f3fb[_0xe896('0x25')]!=='VIRTUAL'){var _0xc5eedb={};_0xc5eedb[_0x42f3fb['name']]={'$like':'%'+_0x390128[_0xe896('0x28')]['filter']+'%'};return _0xc5eedb;}})});}_0xc3cd05=_[_0xe896('0x34')]({},_0xc3cd05,_0x390128['options']);var _0x2ab7a6={'where':_0xc3cd05[_0xe896('0x30')]};return db[_0xe896('0x23')][_0xe896('0x12')](_0x2ab7a6)[_0xe896('0x18')](function(_0x533173){_0x26635e['count']=_0x533173;if(_0x390128[_0xe896('0x28')][_0xe896('0x35')]){_0xc3cd05[_0xe896('0x36')]=[{'all':!![]}];}return db[_0xe896('0x23')][_0xe896('0x37')](_0xc3cd05);})['then'](function(_0x5b8131){_0x26635e[_0xe896('0x38')]=_0x5b8131;return _0x26635e;})[_0xe896('0x18')](respondWithFilteredResult(_0x163a75,_0xc3cd05))['catch'](handleError(_0x163a75,null));};exports['show']=function(_0x19d2fd,_0x3b1de8){var _0x911adb={'raw':![],'where':{'id':_0x19d2fd[_0xe896('0x39')]['id']}},_0x2ab0ac={};_0x2ab0ac[_0xe896('0x27')]=_[_0xe896('0x3a')](db[_0xe896('0x23')][_0xe896('0x24')]);_0x2ab0ac[_0xe896('0x28')]=_[_0xe896('0x3a')](_0x19d2fd[_0xe896('0x28')]);_0x2ab0ac['filters']=_[_0xe896('0x2a')](_0x2ab0ac[_0xe896('0x27')],_0x2ab0ac['query']);_0x911adb['attributes']=_['intersection'](_0x2ab0ac[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x19d2fd[_0xe896('0x28')]['fields']));_0x911adb[_0xe896('0x29')]=_0x911adb[_0xe896('0x29')]['length']?_0x911adb['attributes']:_0x2ab0ac['model'];if(_0x19d2fd[_0xe896('0x28')][_0xe896('0x35')]){_0x911adb[_0xe896('0x36')]=[{'all':!![]}];}_0x911adb=_[_0xe896('0x34')]({},_0x911adb,_0x19d2fd[_0xe896('0x3b')]);return db[_0xe896('0x23')]['find'](_0x911adb)[_0xe896('0x18')](handleEntityNotFound(_0x3b1de8,null))[_0xe896('0x18')](respondWithResult(_0x3b1de8,null))['catch'](handleError(_0x3b1de8,null));};exports[_0xe896('0x3c')]=function(_0x429f1a,_0x179fc2){return db[_0xe896('0x23')]['create'](_0x429f1a[_0xe896('0x3d')],{})[_0xe896('0x18')](function(_0x31ac25){var _0x11615a=_0x429f1a[_0xe896('0x3e')][_0xe896('0x19')]({'plain':!![]});if(!_0x11615a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11615a[_0xe896('0x3f')]==='user'){var _0x234a22=_0x31ac25[_0xe896('0x19')]({'plain':!![]});var _0x2dd1fa=_0xe896('0x1a');return db[_0xe896('0x40')][_0xe896('0x41')]({'where':{'name':_0x2dd1fa,'userProfileId':_0x11615a['userProfileId']},'raw':!![]})[_0xe896('0x18')](function(_0x206ad3){if(_0x206ad3&&_0x206ad3['autoAssociation']===0x0){return db[_0xe896('0x1b')][_0xe896('0x3c')]({'name':_0x234a22['name'],'resourceId':_0x234a22['id'],'type':_0x206ad3[_0xe896('0x20')],'sectionId':_0x206ad3['id']},{})['then'](function(){return _0x31ac25;});}else{return _0x31ac25;}})[_0xe896('0x42')](function(_0xb90690){logger[_0xe896('0x1e')](_0xe896('0x43'),_0xb90690);throw _0xb90690;});}return _0x31ac25;})[_0xe896('0x18')](respondWithResult(_0x179fc2,0xc9))['catch'](handleError(_0x179fc2,null));};exports[_0xe896('0x16')]=function(_0x819c8a,_0x379bf2){if(_0x819c8a['body']['id']){delete _0x819c8a[_0xe896('0x3d')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x819c8a[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x379bf2,null))['then'](saveUpdates(_0x819c8a[_0xe896('0x3d')],null))[_0xe896('0x18')](function(_0x5bfd1e){if(!_0x5bfd1e)return;var _0x58497a=_0x5bfd1e[_0xe896('0x19')]({'plain':!![]});return _0x58497a;})[_0xe896('0x18')](function(_0x5b8719){var _0x1d18f6=new Redis(config[_0xe896('0x7')]);_0x1d18f6[_0xe896('0x1c')](_0xe896('0x44'),JSON[_0xe896('0x45')](_[_0xe896('0x31')](_0x5b8719,['id',_0xe896('0x20'),_0xe896('0x46')])));return _0x5b8719;})[_0xe896('0x18')](respondWithResult(_0x379bf2,null))[_0xe896('0x42')](handleError(_0x379bf2,null));};exports[_0xe896('0x17')]=function(_0x54a93d,_0x1d7e31){return db[_0xe896('0x23')][_0xe896('0x41')]({'where':{'id':_0x54a93d[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x1d7e31,null))[_0xe896('0x18')](removeEntity(_0x1d7e31,null))[_0xe896('0x42')](handleError(_0x1d7e31,null));};exports[_0xe896('0x47')]=function(_0x21c9ea,_0x4460bc){return db[_0xe896('0x23')][_0xe896('0x41')]({'where':{'id':_0x21c9ea['params']['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x4460bc,null))[_0xe896('0x18')](function(_0x156867){if(_0x156867){return _0x156867['addUsers'](_0x21c9ea['body']['ids'],_[_0xe896('0x48')](_0x21c9ea[_0xe896('0x3d')],[_0xe896('0x49'),'id'])||{});}})[_0xe896('0x18')](respondWithResult(_0x4460bc,null))['catch'](handleError(_0x4460bc,null));};exports[_0xe896('0x4a')]=function(_0x28396c,_0x57ed84){return db[_0xe896('0x23')]['find']({'where':{'id':_0x28396c[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0x57ed84,null))['then'](function(_0x112e47){if(_0x112e47){return _0x112e47[_0xe896('0x4a')](_0x28396c['query']['ids'])[_0xe896('0x18')](function(){if(_[_0xe896('0x4b')](_0x28396c[_0xe896('0x28')][_0xe896('0x49')])){for(var _0x2a1858=0x0;_0x2a1858<_0x28396c['query'][_0xe896('0x49')][_0xe896('0x2c')];_0x2a1858+=0x1){socket[_0xe896('0x4c')](_0xe896('0x4d'),{'UserId':Number(_0x28396c['query']['ids'][_0x2a1858]),'SquareProjectId':Number(_0x28396c[_0xe896('0x39')]['id'])});}}else{socket[_0xe896('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x28396c[_0xe896('0x28')]['ids']),'SquareProjectId':Number(_0x28396c[_0xe896('0x39')]['id'])});}});}})[_0xe896('0x18')](respondWithStatusCode(_0x57ed84,null))[_0xe896('0x42')](handleError(_0x57ed84,null));};exports[_0xe896('0x4e')]=function(_0x11b001,_0xa0a63e){var _0x221108={};var _0x117e92={};var _0x1d780a;var _0x14b2b9;return db[_0xe896('0x23')][_0xe896('0x4f')]({'where':{'id':_0x11b001[_0xe896('0x39')]['id']}})[_0xe896('0x18')](handleEntityNotFound(_0xa0a63e,null))[_0xe896('0x18')](function(_0x33bd1b){if(_0x33bd1b){_0x1d780a=_0x33bd1b;_0x117e92[_0xe896('0x27')]=_[_0xe896('0x3a')](db[_0xe896('0x50')][_0xe896('0x24')]);_0x117e92[_0xe896('0x28')]=_[_0xe896('0x3a')](_0x11b001['query']);_0x117e92['filters']=_[_0xe896('0x2a')](_0x117e92[_0xe896('0x27')],_0x117e92['query']);_0x221108[_0xe896('0x29')]=_[_0xe896('0x2a')](_0x117e92[_0xe896('0x27')],qs[_0xe896('0x2b')](_0x11b001[_0xe896('0x28')][_0xe896('0x2b')]));_0x221108[_0xe896('0x29')]=_0x221108[_0xe896('0x29')][_0xe896('0x2c')]?_0x221108[_0xe896('0x29')]:_0x117e92[_0xe896('0x27')];_0x221108['order']=qs[_0xe896('0x2f')](_0x11b001[_0xe896('0x28')]['sort']);_0x221108[_0xe896('0x30')]=qs['filters'](_['pick'](_0x11b001[_0xe896('0x28')],_0x117e92[_0xe896('0x32')]));if(_0x11b001['query']['filter']){_0x221108[_0xe896('0x30')]=_['merge'](_0x221108['where'],{'$or':_[_0xe896('0x22')](_0x221108[_0xe896('0x29')],function(_0xf7e014){var _0x539f6d={};_0x539f6d[_0xf7e014]={'$like':'%'+_0x11b001[_0xe896('0x28')][_0xe896('0x33')]+'%'};return _0x539f6d;})});}_0x221108=_[_0xe896('0x34')]({},_0x221108,_0x11b001['options']);return _0x1d780a[_0xe896('0x4e')](_0x221108);}})[_0xe896('0x18')](function(_0x362bd1){if(_0x362bd1){_0x14b2b9=_0x362bd1[_0xe896('0x2c')];if(!_0x11b001['query'][_0xe896('0x51')](_0xe896('0x2d'))){_0x221108[_0xe896('0x11')]=qs[_0xe896('0x11')](_0x11b001['query'][_0xe896('0x11')]);_0x221108[_0xe896('0x13')]=qs['offset'](_0x11b001[_0xe896('0x28')][_0xe896('0x13')]);}return _0x1d780a[_0xe896('0x4e')](_0x221108);}})[_0xe896('0x18')](function(_0x59afad){if(_0x59afad){return _0x59afad?{'count':_0x14b2b9,'rows':_0x59afad}:null;}})[_0xe896('0x18')](respondWithResult(_0xa0a63e,null))[_0xe896('0x42')](handleError(_0xa0a63e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e3f21ce..8a71bf2 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 _0x6f59=['SquareProject','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x440aed,_0x2b66fe){var _0x58c80f=function(_0x134a15){while(--_0x134a15){_0x440aed['push'](_0x440aed['shift']());}};_0x58c80f(++_0x2b66fe);}(_0x6f59,0xd6));var _0x96f5=function(_0x390cae,_0x514f8e){_0x390cae=_0x390cae-0x0;var _0x28d4a1=_0x6f59[_0x390cae];return _0x28d4a1;};'use strict';var EventEmitter=require(_0x96f5('0x0'));var SquareProject=require(_0x96f5('0x1'))['db'][_0x96f5('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x96f5('0x3'),'afterUpdate':'update','afterDestroy':_0x96f5('0x4')};function emitEvent(_0x4c1dcb){return function(_0x38782,_0x20f6ab,_0x43166b){SquareProjectEvents[_0x96f5('0x5')](_0x4c1dcb+':'+_0x38782['id'],_0x38782);SquareProjectEvents[_0x96f5('0x5')](_0x4c1dcb,_0x38782);_0x43166b(null);};}for(var e in events){if(events[_0x96f5('0x6')](e)){var event=events[e];SquareProject[_0x96f5('0x7')](e,emitEvent(event));}}module[_0x96f5('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xc19e=['save','update','remove','emit','hasOwnProperty','hook','SquareProject','setMaxListeners'];(function(_0x221e0d,_0x384d06){var _0x41bcb7=function(_0x1a2d6b){while(--_0x1a2d6b){_0x221e0d['push'](_0x221e0d['shift']());}};_0x41bcb7(++_0x384d06);}(_0xc19e,0x116));var _0xec19=function(_0x948c4c,_0x51804e){_0x948c4c=_0x948c4c-0x0;var _0x24805a=_0xc19e[_0x948c4c];return _0x24805a;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xec19('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xec19('0x1')](0x0);var events={'afterCreate':_0xec19('0x2'),'afterUpdate':_0xec19('0x3'),'afterDestroy':_0xec19('0x4')};function emitEvent(_0x4aea89){return function(_0x734615,_0x476b43,_0x2f505c){SquareProjectEvents['emit'](_0x4aea89+':'+_0x734615['id'],_0x734615);SquareProjectEvents[_0xec19('0x5')](_0x4aea89,_0x734615);_0x2f505c(null);};}for(var e in events){if(events[_0xec19('0x6')](e)){var event=events[e];SquareProject[_0xec19('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index de1ec0b..8374ae8 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 _0x503a=['bluebird','request-promise','path','rimraf','../../config/environment','define','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','format','lodash','util','api'];(function(_0x1463b1,_0x1132b7){var _0x4cc0e7=function(_0x353e7a){while(--_0x353e7a){_0x1463b1['push'](_0x1463b1['shift']());}};_0x4cc0e7(++_0x1132b7);}(_0x503a,0x19d));var _0xa503=function(_0x2dea58,_0x59d6f0){_0x2dea58=_0x2dea58-0x0;var _0x2b23c2=_0x503a[_0x2dea58];return _0x2b23c2;};'use strict';var _=require(_0xa503('0x0'));var util=require(_0xa503('0x1'));var logger=require('../../config/logger')(_0xa503('0x2'));var moment=require('moment');var BPromise=require(_0xa503('0x3'));var rp=require(_0xa503('0x4'));var fs=require('fs');var path=require(_0xa503('0x5'));var rimraf=require(_0xa503('0x6'));var config=require(_0xa503('0x7'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x47f11d,_0x1eb8d1){return _0x47f11d[_0xa503('0x8')]('SquareProject',attributes,{'tableName':_0xa503('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18a066,_0x35cca2,_0x3c696b){if(_0x18a066[_0xa503('0xa')](_0xa503('0xb'))){_0x18a066[_0xa503('0xc')]=moment()['format'](_0xa503('0xd'));}if(_0x18a066[_0xa503('0xa')](_0xa503('0xe'))){_0x18a066['publishedAt']=moment()[_0xa503('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c696b(null,_0x18a066);}}});}; \ No newline at end of file +var _0xaded=['production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','square_projects','savedAt','format','changed'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xaded,0x1ce));var _0xdade=function(_0x15bfc0,_0x4703bf){_0x15bfc0=_0x15bfc0-0x0;var _0x1246b5=_0xaded[_0x15bfc0];return _0x1246b5;};'use strict';var _=require(_0xdade('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdade('0x1'));var moment=require(_0xdade('0x2'));var BPromise=require(_0xdade('0x3'));var rp=require(_0xdade('0x4'));var fs=require('fs');var path=require(_0xdade('0x5'));var rimraf=require(_0xdade('0x6'));var config=require(_0xdade('0x7'));var attributes=require('./squareProject.attributes');module[_0xdade('0x8')]=function(_0x113ad4,_0x2e60c1){return _0x113ad4[_0xdade('0x9')]('SquareProject',attributes,{'tableName':_0xdade('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508a44,_0x50f42a,_0x5d760e){if(_0x508a44['changed']('preproduction')){_0x508a44[_0xdade('0xb')]=moment()[_0xdade('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x508a44[_0xdade('0xd')](_0xdade('0xe'))){_0x508a44[_0xdade('0xf')]=moment()['format'](_0xdade('0x10'));}_0x5d760e(null,_0x508a44);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index e607639..e2b46af 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 _0x0e09=['raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','SquareProject','find','info','ShowSquareProject','ioredis','../../mysqldb','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options'];(function(_0x451fd9,_0x21d73b){var _0x24c6ad=function(_0xf22b72){while(--_0xf22b72){_0x451fd9['push'](_0x451fd9['shift']());}};_0x24c6ad(++_0x21d73b);}(_0x0e09,0x1c1));var _0x90e0=function(_0x3e3069,_0x36f1f0){_0x3e3069=_0x3e3069-0x0;var _0x4ab06e=_0x0e09[_0x3e3069];return _0x4ab06e;};'use strict';var _=require('lodash');var Redis=require(_0x90e0('0x0'));var db=require(_0x90e0('0x1'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x90e0('0x2'));config[_0x90e0('0x3')]=_['defaults'](config[_0x90e0('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x90e0('0x4'))(new Redis(config[_0x90e0('0x3')]));require(_0x90e0('0x5'))[_0x90e0('0x6')](socket);exports[_0x90e0('0x7')]=function(_0x318724){var _0x3f6645=this;return new Promise(function(_0x8d73a3,_0x5befce){return db['SquareProject'][_0x90e0('0x8')]({'raw':_0x318724[_0x90e0('0x9')]?_0x318724[_0x90e0('0x9')][_0x90e0('0xa')]===undefined?!![]:![]:!![],'where':_0x318724[_0x90e0('0x9')]?_0x318724[_0x90e0('0x9')][_0x90e0('0xb')]||null:null,'attributes':_0x318724[_0x90e0('0x9')]?_0x318724['options'][_0x90e0('0xc')]||null:null,'limit':_0x318724[_0x90e0('0x9')]?_0x318724['options'][_0x90e0('0xd')]||null:null,'include':_0x318724[_0x90e0('0x9')]?_0x318724[_0x90e0('0x9')][_0x90e0('0xe')]?_[_0x90e0('0xf')](_0x318724['options']['include'],function(_0x22d7f8){return{'model':db[_0x22d7f8['model']],'as':_0x22d7f8['as'],'attributes':_0x22d7f8[_0x90e0('0xc')],'include':_0x22d7f8['include']?_[_0x90e0('0xf')](_0x22d7f8[_0x90e0('0xe')],function(_0xa54cd1){return{'model':db[_0xa54cd1[_0x90e0('0x10')]],'as':_0xa54cd1['as'],'attributes':_0xa54cd1[_0x90e0('0xc')],'include':_0xa54cd1[_0x90e0('0xe')]?_[_0x90e0('0xf')](_0xa54cd1[_0x90e0('0xe')],function(_0x1c8e62){return{'model':db[_0x1c8e62[_0x90e0('0x10')]],'as':_0x1c8e62['as'],'attributes':_0x1c8e62[_0x90e0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x90e0('0x11')](function(_0x359a89){logger['info'](_0x90e0('0x7'),_0x318724);logger[_0x90e0('0x12')]('GetSquareProjects',_0x318724,JSON[_0x90e0('0x13')](_0x359a89));_0x8d73a3(_0x359a89);})[_0x90e0('0x14')](function(_0x5e1de0){logger[_0x90e0('0x15')](_0x90e0('0x7'),_0x5e1de0[_0x90e0('0x16')],_0x318724);_0x5befce(_0x3f6645['error'](0x1f4,_0x5e1de0[_0x90e0('0x16')]));});});};exports['ShowSquareProject']=function(_0xd04ec1){var _0x59e622=this;return new Promise(function(_0x386871,_0x5bf6a9){return db[_0x90e0('0x17')][_0x90e0('0x18')]({'raw':_0xd04ec1['options']?_0xd04ec1[_0x90e0('0x9')][_0x90e0('0xa')]===undefined?!![]:![]:!![],'where':_0xd04ec1['options']?_0xd04ec1['options'][_0x90e0('0xb')]||null:null,'attributes':_0xd04ec1[_0x90e0('0x9')]?_0xd04ec1[_0x90e0('0x9')][_0x90e0('0xc')]||null:null,'include':_0xd04ec1[_0x90e0('0x9')]?_0xd04ec1[_0x90e0('0x9')][_0x90e0('0xe')]?_[_0x90e0('0xf')](_0xd04ec1[_0x90e0('0x9')][_0x90e0('0xe')],function(_0x387d6e){return{'model':db[_0x387d6e[_0x90e0('0x10')]],'as':_0x387d6e['as'],'attributes':_0x387d6e[_0x90e0('0xc')],'include':_0x387d6e[_0x90e0('0xe')]?_['map'](_0x387d6e['include'],function(_0x67bcc3){return{'model':db[_0x67bcc3['model']],'as':_0x67bcc3['as'],'attributes':_0x67bcc3['attributes'],'include':_0x67bcc3[_0x90e0('0xe')]?_[_0x90e0('0xf')](_0x67bcc3[_0x90e0('0xe')],function(_0x5991c){return{'model':db[_0x5991c[_0x90e0('0x10')]],'as':_0x5991c['as'],'attributes':_0x5991c[_0x90e0('0xc')]};}):[]};}):[]};}):[]:[]})[_0x90e0('0x11')](function(_0x6063c5){logger[_0x90e0('0x19')](_0x90e0('0x1a'),_0xd04ec1);logger[_0x90e0('0x12')](_0x90e0('0x1a'),_0xd04ec1,JSON[_0x90e0('0x13')](_0x6063c5));_0x386871(_0x6063c5);})[_0x90e0('0x14')](function(_0x17ffa7){logger[_0x90e0('0x15')](_0x90e0('0x1a'),_0x17ffa7['message'],_0xd04ec1);_0x5bf6a9(_0x59e622[_0x90e0('0x15')](0x1f4,_0x17ffa7[_0x90e0('0x16')]));});});}; \ No newline at end of file +var _0x0958=['options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','error','message','SquareProject','find','ShowSquareProject','ioredis','rpc','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll'];(function(_0x2f8f9c,_0x2d6090){var _0x39d3e8=function(_0x23f3ff){while(--_0x23f3ff){_0x2f8f9c['push'](_0x2f8f9c['shift']());}};_0x39d3e8(++_0x2d6090);}(_0x0958,0xb3));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var Redis=require(_0x8095('0x0'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x8095('0x1'));var config=require(_0x8095('0x2'));config[_0x8095('0x3')]=_[_0x8095('0x4')](config[_0x8095('0x3')],{'host':'localhost','port':0x18eb});var socket=require(_0x8095('0x5'))(new Redis(config[_0x8095('0x3')]));require(_0x8095('0x6'))[_0x8095('0x7')](socket);exports[_0x8095('0x8')]=function(_0x7dd167){var _0x3219fd=this;return new Promise(function(_0x1436f8,_0x30b25b){return db['SquareProject'][_0x8095('0x9')]({'raw':_0x7dd167[_0x8095('0xa')]?_0x7dd167[_0x8095('0xa')][_0x8095('0xb')]===undefined?!![]:![]:!![],'where':_0x7dd167['options']?_0x7dd167['options'][_0x8095('0xc')]||null:null,'attributes':_0x7dd167[_0x8095('0xa')]?_0x7dd167[_0x8095('0xa')][_0x8095('0xd')]||null:null,'limit':_0x7dd167[_0x8095('0xa')]?_0x7dd167[_0x8095('0xa')][_0x8095('0xe')]||null:null,'include':_0x7dd167['options']?_0x7dd167[_0x8095('0xa')][_0x8095('0xf')]?_[_0x8095('0x10')](_0x7dd167[_0x8095('0xa')]['include'],function(_0x5d5836){return{'model':db[_0x5d5836[_0x8095('0x11')]],'as':_0x5d5836['as'],'attributes':_0x5d5836[_0x8095('0xd')],'include':_0x5d5836[_0x8095('0xf')]?_['map'](_0x5d5836['include'],function(_0x4d8d3c){return{'model':db[_0x4d8d3c[_0x8095('0x11')]],'as':_0x4d8d3c['as'],'attributes':_0x4d8d3c[_0x8095('0xd')],'include':_0x4d8d3c[_0x8095('0xf')]?_['map'](_0x4d8d3c[_0x8095('0xf')],function(_0x528974){return{'model':db[_0x528974[_0x8095('0x11')]],'as':_0x528974['as'],'attributes':_0x528974['attributes']};}):[]};}):[]};}):[]:[]})[_0x8095('0x12')](function(_0x3b0072){logger[_0x8095('0x13')](_0x8095('0x8'),_0x7dd167);logger[_0x8095('0x14')](_0x8095('0x8'),_0x7dd167,JSON[_0x8095('0x15')](_0x3b0072));_0x1436f8(_0x3b0072);})['catch'](function(_0x5ff247){logger[_0x8095('0x16')](_0x8095('0x8'),_0x5ff247[_0x8095('0x17')],_0x7dd167);_0x30b25b(_0x3219fd[_0x8095('0x16')](0x1f4,_0x5ff247[_0x8095('0x17')]));});});};exports['ShowSquareProject']=function(_0x511661){var _0xff3263=this;return new Promise(function(_0x588d23,_0x16a5df){return db[_0x8095('0x18')][_0x8095('0x19')]({'raw':_0x511661[_0x8095('0xa')]?_0x511661[_0x8095('0xa')][_0x8095('0xb')]===undefined?!![]:![]:!![],'where':_0x511661[_0x8095('0xa')]?_0x511661[_0x8095('0xa')][_0x8095('0xc')]||null:null,'attributes':_0x511661[_0x8095('0xa')]?_0x511661[_0x8095('0xa')][_0x8095('0xd')]||null:null,'include':_0x511661[_0x8095('0xa')]?_0x511661[_0x8095('0xa')][_0x8095('0xf')]?_[_0x8095('0x10')](_0x511661[_0x8095('0xa')][_0x8095('0xf')],function(_0x1d915e){return{'model':db[_0x1d915e[_0x8095('0x11')]],'as':_0x1d915e['as'],'attributes':_0x1d915e[_0x8095('0xd')],'include':_0x1d915e[_0x8095('0xf')]?_[_0x8095('0x10')](_0x1d915e[_0x8095('0xf')],function(_0x4ef362){return{'model':db[_0x4ef362[_0x8095('0x11')]],'as':_0x4ef362['as'],'attributes':_0x4ef362[_0x8095('0xd')],'include':_0x4ef362['include']?_[_0x8095('0x10')](_0x4ef362[_0x8095('0xf')],function(_0x1b3235){return{'model':db[_0x1b3235[_0x8095('0x11')]],'as':_0x1b3235['as'],'attributes':_0x1b3235[_0x8095('0xd')]};}):[]};}):[]};}):[]:[]})[_0x8095('0x12')](function(_0x230969){logger[_0x8095('0x13')](_0x8095('0x1a'),_0x511661);logger[_0x8095('0x14')](_0x8095('0x1a'),_0x511661,JSON[_0x8095('0x15')](_0x230969));_0x588d23(_0x230969);})['catch'](function(_0x25623c){logger[_0x8095('0x16')]('ShowSquareProject',_0x25623c[_0x8095('0x17')],_0x511661);_0x16a5df(_0xff3263[_0x8095('0x16')](0x1f4,_0x25623c[_0x8095('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index d2cead6..50e52e6 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 _0x242c=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register','length'];(function(_0x18a40f,_0x49dd9e){var _0x5d250d=function(_0x22465f){while(--_0x22465f){_0x18a40f['push'](_0x18a40f['shift']());}};_0x5d250d(++_0x49dd9e);}(_0x242c,0x91));var _0xc242=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0x242c[_0x10791d];return _0x1b4f9c;};'use strict';var SquareProjectEvents=require(_0xc242('0x0'));var events=[_0xc242('0x1'),_0xc242('0x2'),_0xc242('0x3')];function createListener(_0x364b4d,_0xdc4eb6){return function(_0x3b0ed2){_0xdc4eb6[_0xc242('0x4')](_0x364b4d,_0x3b0ed2);};}function removeListener(_0x401109,_0x533132){return function(){SquareProjectEvents[_0xc242('0x5')](_0x401109,_0x533132);};}exports[_0xc242('0x6')]=function(_0x9931f2){for(var _0x4b0bad=0x0,_0x226aa5=events[_0xc242('0x7')];_0x4b0bad<_0x226aa5;_0x4b0bad++){var _0x37bc95=events[_0x4b0bad];var _0x2cf7c9=createListener(_0xc242('0x8')+_0x37bc95,_0x9931f2);SquareProjectEvents['on'](_0x37bc95,_0x2cf7c9);}}; \ No newline at end of file +var _0x5c0e=['emit','removeListener','register','length','squareProject:','./squareProject.events','update'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x5c0e,0x1c5));var _0xe5c0=function(_0x2656a4,_0x28dd1b){_0x2656a4=_0x2656a4-0x0;var _0x48ce85=_0x5c0e[_0x2656a4];return _0x48ce85;};'use strict';var SquareProjectEvents=require(_0xe5c0('0x0'));var events=['save','remove',_0xe5c0('0x1')];function createListener(_0x500de2,_0x45eca9){return function(_0x4eee6f){_0x45eca9[_0xe5c0('0x2')](_0x500de2,_0x4eee6f);};}function removeListener(_0x5432be,_0x2e9581){return function(){SquareProjectEvents[_0xe5c0('0x3')](_0x5432be,_0x2e9581);};}exports[_0xe5c0('0x4')]=function(_0x39fff9){for(var _0x59ef08=0x0,_0x20fe84=events[_0xe5c0('0x5')];_0x59ef08<_0x20fe84;_0x59ef08++){var _0x4d3c67=events[_0x59ef08];var _0x1bcba8=createListener(_0xe5c0('0x6')+_0x4d3c67,_0x39fff9);SquareProjectEvents['on'](_0x4d3c67,_0x1bcba8);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9c81b32..01445b2 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x108b78,_0x28a619){var _0x3f81ed=function(_0x117143){while(--_0x117143){_0x108b78['push'](_0x108b78['shift']());}};_0x3f81ed(++_0x28a619);}(_0x326f,0xd1));var _0xf326=function(_0x52b9c5,_0x5b5429){_0x52b9c5=_0x52b9c5-0x0;var _0xa123c0=_0x326f[_0x52b9c5];return _0xa123c0;};'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/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x25fa21,_0x100f42){var _0x3ce8c9=function(_0x5bc466){while(--_0x5bc466){_0x25fa21['push'](_0x25fa21['shift']());}};_0x3ce8c9(++_0x100f42);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x5fc3[_0xd578cb];return _0x775533;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1b0ea26..92e3486 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4c7=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x391194,_0x54f7b3){var _0x55f988=function(_0x51891a){while(--_0x51891a){_0x391194['push'](_0x391194['shift']());}};_0x55f988(++_0x54f7b3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x5d035a,_0x18c849){_0x5d035a=_0x5d035a-0x0;var _0x14aceb=_0xb4c7[_0x5d035a];return _0x14aceb;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'callerid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize[_0x7b4c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize[_0x7b4c('0x2')]},'dnid':{'type':Sequelize[_0x7b4c('0x2')]},'projectName':{'type':Sequelize[_0x7b4c('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x7b4c('0x2')]},'savePath':{'type':Sequelize[_0x7b4c('0x2')]},'format':{'type':Sequelize[_0x7b4c('0x3')],'get':function(){var _0x4bf85d='';var _0x2d7b7e=this[_0x7b4c('0x4')]('savePath');if(_0x2d7b7e){_0x4bf85d=_0x2d7b7e[_0x7b4c('0x5')](_0x2d7b7e[_0x7b4c('0x6')]('.'));}return _0x4bf85d;}}}; \ No newline at end of file +var _0x326f=['getDataValue','sequelize','STRING','VIRTUAL'];(function(_0x5f2f64,_0x35a099){var _0x2b4199=function(_0x154aff){while(--_0x154aff){_0x5f2f64['push'](_0x5f2f64['shift']());}};_0x2b4199(++_0x35a099);}(_0x326f,0xd1));var _0xf326=function(_0x280126,_0xf23689){_0x280126=_0x280126-0x0;var _0x2b2e70=_0x326f[_0x280126];return _0x2b2e70;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf326('0x1')]},'calleridname':{'type':Sequelize[_0xf326('0x1')]},'context':{'type':Sequelize[_0xf326('0x1')]},'extension':{'type':Sequelize[_0xf326('0x1')]},'priority':{'type':Sequelize[_0xf326('0x1')]},'accountcode':{'type':Sequelize[_0xf326('0x1')]},'dnid':{'type':Sequelize[_0xf326('0x1')]},'projectName':{'type':Sequelize[_0xf326('0x1')]},'saveName':{'type':Sequelize[_0xf326('0x1')]},'filename':{'type':Sequelize[_0xf326('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xf326('0x2')],'get':function(){var _0x3851eb='';var _0x165f95=this[_0xf326('0x3')]('savePath');if(_0x165f95){_0x3851eb=_0x165f95['substring'](_0x165f95['lastIndexOf']('.'));}return _0x3851eb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4e16444..6c947fa 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 _0xcac1=['savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','send','SquareRecording','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','body','download','../../components/encryptor','uniqueid'];(function(_0xf1db8,_0x1125c1){var _0x4bb322=function(_0x59556d){while(--_0x59556d){_0xf1db8['push'](_0xf1db8['shift']());}};_0x4bb322(++_0x1125c1);}(_0xcac1,0x79));var _0x1cac=function(_0x13e47d,_0x1e38bd){_0x13e47d=_0x13e47d-0x0;var _0x1042e4=_0xcac1[_0x13e47d];return _0x1042e4;};'use strict';var emlformat=require(_0x1cac('0x0'));var rimraf=require(_0x1cac('0x1'));var zipdir=require(_0x1cac('0x2'));var jsonpatch=require(_0x1cac('0x3'));var rp=require(_0x1cac('0x4'));var moment=require('moment');var BPromise=require(_0x1cac('0x5'));var Mustache=require('mustache');var util=require(_0x1cac('0x6'));var path=require(_0x1cac('0x7'));var sox=require(_0x1cac('0x8'));var csv=require(_0x1cac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cac('0xa'));var _=require('lodash');var squel=require(_0x1cac('0xb'));var crypto=require(_0x1cac('0xc'));var jsforce=require(_0x1cac('0xd'));var deskjs=require(_0x1cac('0xe'));var toCsv=require(_0x1cac('0x9'));var querystring=require(_0x1cac('0xf'));var Papa=require(_0x1cac('0x10'));var Redis=require(_0x1cac('0x11'));var authService=require(_0x1cac('0x12'));var qs=require(_0x1cac('0x13'));var as=require(_0x1cac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1cac('0x15'))(_0x1cac('0x16'));var utils=require(_0x1cac('0x17'));var config=require(_0x1cac('0x18'));var licenseUtil=require(_0x1cac('0x19'));var db=require(_0x1cac('0x1a'))['db'];function respondWithStatusCode(_0x2b4f14,_0x4f063a){_0x4f063a=_0x4f063a||0xcc;return function(_0x7b8276){if(_0x7b8276){return _0x2b4f14['sendStatus'](_0x4f063a);}return _0x2b4f14['status'](_0x4f063a)[_0x1cac('0x1b')]();};}function respondWithResult(_0x14805b,_0x42de4a){_0x42de4a=_0x42de4a||0xc8;return function(_0x8ffa68){if(_0x8ffa68){return _0x14805b['status'](_0x42de4a)[_0x1cac('0x1c')](_0x8ffa68);}};}function respondWithFilteredResult(_0x3e4d98,_0x240aa9){return function(_0x2e8a5b){if(_0x2e8a5b){var _0x84b49e=typeof _0x240aa9[_0x1cac('0x1d')]===_0x1cac('0x1e')&&typeof _0x240aa9[_0x1cac('0x1f')]===_0x1cac('0x1e');var _0x55c7fb=_0x2e8a5b[_0x1cac('0x20')];var _0x5f0c26=_0x84b49e?0x0:_0x240aa9[_0x1cac('0x1d')];var _0x7265cd=_0x84b49e?_0x2e8a5b[_0x1cac('0x20')]:_0x240aa9['offset']+_0x240aa9[_0x1cac('0x1f')];var _0x3b54c2;if(_0x7265cd>=_0x55c7fb){_0x7265cd=_0x55c7fb;_0x3b54c2=0xc8;}else{_0x3b54c2=0xce;}_0x3e4d98['status'](_0x3b54c2);return _0x3e4d98[_0x1cac('0x21')](_0x1cac('0x22'),_0x5f0c26+'-'+_0x7265cd+'/'+_0x55c7fb)[_0x1cac('0x1c')](_0x2e8a5b);}return null;};}function patchUpdates(_0x2e9125){return function(_0x208f29){try{jsonpatch[_0x1cac('0x23')](_0x208f29,_0x2e9125,!![]);}catch(_0x1ecea3){return BPromise[_0x1cac('0x24')](_0x1ecea3);}return _0x208f29[_0x1cac('0x25')]();};}function saveUpdates(_0x349c41,_0x1c31e7){return function(_0x18fc71){if(_0x18fc71){return _0x18fc71[_0x1cac('0x26')](_0x349c41)[_0x1cac('0x27')](function(_0x46304b){return _0x46304b;});}return null;};}function removeEntity(_0x361f7f,_0x1d1c62){return function(_0x577f8d){if(_0x577f8d){return _0x577f8d[_0x1cac('0x28')]()['then'](function(){_0x361f7f[_0x1cac('0x29')](0xcc)[_0x1cac('0x1b')]();});}};}function handleEntityNotFound(_0x4725cf,_0x5c97d8){return function(_0x53ede8){if(!_0x53ede8){_0x4725cf[_0x1cac('0x2a')](0x194);}return _0x53ede8;};}function handleError(_0x3469c9,_0x55e022){_0x55e022=_0x55e022||0x1f4;return function(_0x5408df){logger[_0x1cac('0x2b')](_0x5408df[_0x1cac('0x2c')]);if(_0x5408df[_0x1cac('0x2d')]){delete _0x5408df[_0x1cac('0x2d')];}_0x3469c9[_0x1cac('0x29')](_0x55e022)[_0x1cac('0x2e')](_0x5408df);};}exports['index']=function(_0x1f35fd,_0x51c97d){var _0x581a94={},_0x1b1617={},_0x27b7ba={'count':0x0,'rows':[]};var _0xea3bce=_['map'](db[_0x1cac('0x2f')][_0x1cac('0x30')],function(_0x301543){return{'name':_0x301543['fieldName'],'type':_0x301543[_0x1cac('0x31')][_0x1cac('0x32')]};});_0x1b1617['model']=_[_0x1cac('0x33')](_0xea3bce,'name');_0x1b1617[_0x1cac('0x34')]=_[_0x1cac('0x35')](_0x1f35fd[_0x1cac('0x34')]);_0x1b1617[_0x1cac('0x36')]=_[_0x1cac('0x37')](_0x1b1617[_0x1cac('0x38')],_0x1b1617[_0x1cac('0x34')]);_0x581a94[_0x1cac('0x39')]=_[_0x1cac('0x37')](_0x1b1617[_0x1cac('0x38')],qs[_0x1cac('0x3a')](_0x1f35fd['query'][_0x1cac('0x3a')]));_0x581a94[_0x1cac('0x39')]=_0x581a94['attributes'][_0x1cac('0x3b')]?_0x581a94[_0x1cac('0x39')]:_0x1b1617[_0x1cac('0x38')];if(!_0x1f35fd[_0x1cac('0x34')][_0x1cac('0x3c')]('nolimit')){_0x581a94[_0x1cac('0x1f')]=qs[_0x1cac('0x1f')](_0x1f35fd[_0x1cac('0x34')]['limit']);_0x581a94[_0x1cac('0x1d')]=qs[_0x1cac('0x1d')](_0x1f35fd[_0x1cac('0x34')][_0x1cac('0x1d')]);}_0x581a94['order']=qs[_0x1cac('0x3d')](_0x1f35fd['query'][_0x1cac('0x3d')]);_0x581a94[_0x1cac('0x3e')]=qs[_0x1cac('0x36')](_[_0x1cac('0x3f')](_0x1f35fd[_0x1cac('0x34')],_0x1b1617[_0x1cac('0x36')]),_0xea3bce);if(_0x1f35fd[_0x1cac('0x34')][_0x1cac('0x40')]){_0x581a94[_0x1cac('0x3e')]=_[_0x1cac('0x41')](_0x581a94[_0x1cac('0x3e')],{'$or':_[_0x1cac('0x33')](_0xea3bce,function(_0x1ebdbf){if(_0x1ebdbf['type']!==_0x1cac('0x42')){var _0x471e2a={};_0x471e2a[_0x1ebdbf[_0x1cac('0x2d')]]={'$like':'%'+_0x1f35fd['query']['filter']+'%'};return _0x471e2a;}})});}_0x581a94=_[_0x1cac('0x41')]({},_0x581a94,_0x1f35fd[_0x1cac('0x43')]);var _0x20381b={'where':_0x581a94[_0x1cac('0x3e')]};return db['SquareRecording'][_0x1cac('0x20')](_0x20381b)[_0x1cac('0x27')](function(_0x2af4e8){_0x27b7ba[_0x1cac('0x20')]=_0x2af4e8;if(_0x1f35fd[_0x1cac('0x34')][_0x1cac('0x44')]){_0x581a94['include']=[{'all':!![]}];}return db[_0x1cac('0x2f')]['findAll'](_0x581a94);})[_0x1cac('0x27')](function(_0x12d899){_0x27b7ba[_0x1cac('0x45')]=_0x12d899;return _0x27b7ba;})['then'](respondWithFilteredResult(_0x51c97d,_0x581a94))[_0x1cac('0x46')](handleError(_0x51c97d,null));};exports[_0x1cac('0x47')]=function(_0x3a286e,_0x18f1b5){var _0x392c72={'raw':!![],'where':{'id':_0x3a286e[_0x1cac('0x48')]['id']}},_0x52fca1={};_0x52fca1['model']=_[_0x1cac('0x35')](db[_0x1cac('0x2f')]['rawAttributes']);_0x52fca1['query']=_[_0x1cac('0x35')](_0x3a286e[_0x1cac('0x34')]);_0x52fca1[_0x1cac('0x36')]=_[_0x1cac('0x37')](_0x52fca1[_0x1cac('0x38')],_0x52fca1[_0x1cac('0x34')]);_0x392c72['attributes']=_[_0x1cac('0x37')](_0x52fca1[_0x1cac('0x38')],qs[_0x1cac('0x3a')](_0x3a286e[_0x1cac('0x34')][_0x1cac('0x3a')]));_0x392c72[_0x1cac('0x39')]=_0x392c72[_0x1cac('0x39')][_0x1cac('0x3b')]?_0x392c72[_0x1cac('0x39')]:_0x52fca1[_0x1cac('0x38')];if(_0x3a286e[_0x1cac('0x34')][_0x1cac('0x44')]){_0x392c72[_0x1cac('0x49')]=[{'all':!![]}];}_0x392c72=_['merge']({},_0x392c72,_0x3a286e[_0x1cac('0x43')]);return db[_0x1cac('0x2f')][_0x1cac('0x4a')](_0x392c72)['then'](handleEntityNotFound(_0x18f1b5,null))[_0x1cac('0x27')](respondWithResult(_0x18f1b5,null))[_0x1cac('0x46')](handleError(_0x18f1b5,null));};exports['create']=function(_0x5de68c,_0x38ae40){return db[_0x1cac('0x2f')]['create'](_0x5de68c['body'],{})[_0x1cac('0x27')](respondWithResult(_0x38ae40,0xc9))[_0x1cac('0x46')](handleError(_0x38ae40,null));};exports[_0x1cac('0x26')]=function(_0x35c407,_0x4b4efe){if(_0x35c407['body']['id']){delete _0x35c407['body']['id'];}return db[_0x1cac('0x2f')][_0x1cac('0x4a')]({'where':{'id':_0x35c407[_0x1cac('0x48')]['id']}})[_0x1cac('0x27')](handleEntityNotFound(_0x4b4efe,null))['then'](saveUpdates(_0x35c407[_0x1cac('0x4b')],null))[_0x1cac('0x27')](respondWithResult(_0x4b4efe,null))[_0x1cac('0x46')](handleError(_0x4b4efe,null));};exports[_0x1cac('0x4c')]=function(_0x2a3bcd,_0x16c10a,_0x250b50){var _0x17837b=require(_0x1cac('0x4d'));var _0x39b1f6=![];var _0x2ca759={};if(_0x2a3bcd['query'][_0x1cac('0x31')]&&_0x2a3bcd['query'][_0x1cac('0x31')]===_0x1cac('0x4e')){_0x2ca759[_0x1cac('0x4e')]=_0x2a3bcd[_0x1cac('0x48')]['id'];}else{_0x2ca759['id']=_0x2a3bcd[_0x1cac('0x48')]['id'];}return db[_0x1cac('0x2f')][_0x1cac('0x4a')]({'where':_0x2ca759,'attributes':['id',_0x1cac('0x4f'),_0x1cac('0x50')],'raw':!![]})[_0x1cac('0x27')](handleEntityNotFound(_0x16c10a,null))['then'](function(_0x4360cf){if(_0x4360cf){var _0x48db01=_0x4360cf[_0x1cac('0x4f')];var _0x49a437=util[_0x1cac('0x51')](_0x1cac('0x52'),_0x48db01);if(fs[_0x1cac('0x53')](_0x49a437)){_0x39b1f6=!![];return _0x17837b[_0x1cac('0x54')](_0x49a437,_0x48db01,config[_0x1cac('0x55')][_0x1cac('0x56')])[_0x1cac('0x27')](function(){return _0x4360cf;});}return _0x4360cf;}})['then'](function(_0x2c091a){if(_0x2c091a){var _0x3338b9=_0x2c091a['savePath'];if(!fs['existsSync'](_0x3338b9)){throw new db[(_0x1cac('0x57'))][(_0x1cac('0x58'))](_0x1cac('0x59'));}if(_0x2c091a[_0x1cac('0x50')]){return _0x16c10a[_0x1cac('0x4c')](_0x3338b9,_0x2c091a['filename']+path[_0x1cac('0x5a')](_0x3338b9),function(){if(_0x39b1f6){fs[_0x1cac('0x5b')](_0x3338b9);}});}else{return _0x16c10a[_0x1cac('0x4c')](_0x3338b9,function(_0x22ec11){if(_0x39b1f6){fs[_0x1cac('0x5b')](_0x3338b9);}});}}})['catch'](function(_0x1d3ed6){if(_0x1d3ed6[_0x1cac('0x5c')]===_0x1cac('0x59')){_0x16c10a[_0x1cac('0x29')](0x194)[_0x1cac('0x2e')](_0x1cac('0x5d'));}else{return handleError(_0x16c10a,null);}});};exports['destroy']=function(_0x5476ad,_0x4592c0){return db[_0x1cac('0x2f')][_0x1cac('0x4a')]({'where':{'id':_0x5476ad[_0x1cac('0x48')]['id']}})[_0x1cac('0x27')](function(_0x4ea061){if(_['isNil'](_0x4ea061)){throw new ReferenceError(_0x1cac('0x5e'));}return _0x4ea061;})[_0x1cac('0x27')](function(_0x20c980){var _0x18d94b=_0x20c980[_0x1cac('0x4f')];logger[_0x1cac('0x5f')]('cancellazione\x20fisica\x20documento\x20%s',_0x18d94b);if(!_[_0x1cac('0x60')](_0x20c980[_0x1cac('0x4f')])&&fs[_0x1cac('0x53')](_0x18d94b)){logger[_0x1cac('0x5f')]('File:\x20\x22'+_0x18d94b+_0x1cac('0x61'));fs[_0x1cac('0x62')](_0x18d94b);}_0x18d94b=_0x18d94b+'.cypher';if(!_[_0x1cac('0x60')](_0x20c980[_0x1cac('0x4f')])&&fs[_0x1cac('0x53')](_0x18d94b)){logger['info'](_0x1cac('0x63')+_0x18d94b+_0x1cac('0x61'));fs[_0x1cac('0x62')](_0x18d94b);}return _0x20c980;})[_0x1cac('0x27')](function(_0x35ade1){if(!_0x35ade1)throw new InternalError();return _0x35ade1['destroy']();})[_0x1cac('0x27')](function(){_0x4592c0[_0x1cac('0x29')](0xcc)[_0x1cac('0x1b')]();})[_0x1cac('0x46')](handleError(_0x4592c0,null));}; \ No newline at end of file +var _0xf2ad=['index','map','rawAttributes','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','download','uniqueid','savePath','format','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','bluebird','mustache','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','stack'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xf2ad,0x8f));var _0xdf2a=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xf2ad[_0x555ebb];return _0x3c0a4a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf2a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdf2a('0x1'));var Mustache=require(_0xdf2a('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdf2a('0x3'));var crypto=require(_0xdf2a('0x4'));var jsforce=require(_0xdf2a('0x5'));var deskjs=require(_0xdf2a('0x6'));var toCsv=require(_0xdf2a('0x7'));var querystring=require(_0xdf2a('0x8'));var Papa=require('papaparse');var Redis=require(_0xdf2a('0x9'));var authService=require('../../components/auth/service');var qs=require(_0xdf2a('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf2a('0xb'));var logger=require(_0xdf2a('0xc'))(_0xdf2a('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdf2a('0xe'))['db'];function respondWithStatusCode(_0x78e57b,_0x506d87){_0x506d87=_0x506d87||0xcc;return function(_0x5457f1){if(_0x5457f1){return _0x78e57b[_0xdf2a('0xf')](_0x506d87);}return _0x78e57b['status'](_0x506d87)[_0xdf2a('0x10')]();};}function respondWithResult(_0x40baef,_0x4bc32f){_0x4bc32f=_0x4bc32f||0xc8;return function(_0x26372f){if(_0x26372f){return _0x40baef[_0xdf2a('0x11')](_0x4bc32f)[_0xdf2a('0x12')](_0x26372f);}};}function respondWithFilteredResult(_0x3cf3e5,_0x5271e3){return function(_0xe7b97d){if(_0xe7b97d){var _0x45aa0d=typeof _0x5271e3[_0xdf2a('0x13')]===_0xdf2a('0x14')&&typeof _0x5271e3[_0xdf2a('0x15')]==='undefined';var _0x292837=_0xe7b97d[_0xdf2a('0x16')];var _0x3dbf41=_0x45aa0d?0x0:_0x5271e3[_0xdf2a('0x13')];var _0x1903a9=_0x45aa0d?_0xe7b97d[_0xdf2a('0x16')]:_0x5271e3[_0xdf2a('0x13')]+_0x5271e3[_0xdf2a('0x15')];var _0x486cd5;if(_0x1903a9>=_0x292837){_0x1903a9=_0x292837;_0x486cd5=0xc8;}else{_0x486cd5=0xce;}_0x3cf3e5[_0xdf2a('0x11')](_0x486cd5);return _0x3cf3e5['set'](_0xdf2a('0x17'),_0x3dbf41+'-'+_0x1903a9+'/'+_0x292837)[_0xdf2a('0x12')](_0xe7b97d);}return null;};}function patchUpdates(_0x39d554){return function(_0x286839){try{jsonpatch[_0xdf2a('0x18')](_0x286839,_0x39d554,!![]);}catch(_0x4d4c3b){return BPromise['reject'](_0x4d4c3b);}return _0x286839[_0xdf2a('0x19')]();};}function saveUpdates(_0x5f28c9,_0x452b14){return function(_0x11380b){if(_0x11380b){return _0x11380b['update'](_0x5f28c9)[_0xdf2a('0x1a')](function(_0x5a3b42){return _0x5a3b42;});}return null;};}function removeEntity(_0x5474c8,_0x21fb33){return function(_0x51ae10){if(_0x51ae10){return _0x51ae10[_0xdf2a('0x1b')]()[_0xdf2a('0x1a')](function(){_0x5474c8[_0xdf2a('0x11')](0xcc)[_0xdf2a('0x10')]();});}};}function handleEntityNotFound(_0xc66711,_0x276c63){return function(_0x2df178){if(!_0x2df178){_0xc66711['sendStatus'](0x194);}return _0x2df178;};}function handleError(_0x400992,_0x55b3f1){_0x55b3f1=_0x55b3f1||0x1f4;return function(_0x23b683){logger['error'](_0x23b683[_0xdf2a('0x1c')]);if(_0x23b683['name']){delete _0x23b683['name'];}_0x400992[_0xdf2a('0x11')](_0x55b3f1)['send'](_0x23b683);};}exports[_0xdf2a('0x1d')]=function(_0x5029f2,_0x9beea7){var _0x4403a4={},_0x152b3c={},_0x37dc88={'count':0x0,'rows':[]};var _0x20dd08=_[_0xdf2a('0x1e')](db['SquareRecording'][_0xdf2a('0x1f')],function(_0x335901){return{'name':_0x335901['fieldName'],'type':_0x335901[_0xdf2a('0x20')][_0xdf2a('0x21')]};});_0x152b3c[_0xdf2a('0x22')]=_[_0xdf2a('0x1e')](_0x20dd08,_0xdf2a('0x23'));_0x152b3c['query']=_[_0xdf2a('0x24')](_0x5029f2['query']);_0x152b3c[_0xdf2a('0x25')]=_[_0xdf2a('0x26')](_0x152b3c['model'],_0x152b3c[_0xdf2a('0x27')]);_0x4403a4[_0xdf2a('0x28')]=_[_0xdf2a('0x26')](_0x152b3c[_0xdf2a('0x22')],qs[_0xdf2a('0x29')](_0x5029f2['query']['fields']));_0x4403a4['attributes']=_0x4403a4[_0xdf2a('0x28')][_0xdf2a('0x2a')]?_0x4403a4[_0xdf2a('0x28')]:_0x152b3c[_0xdf2a('0x22')];if(!_0x5029f2[_0xdf2a('0x27')][_0xdf2a('0x2b')](_0xdf2a('0x2c'))){_0x4403a4[_0xdf2a('0x15')]=qs[_0xdf2a('0x15')](_0x5029f2[_0xdf2a('0x27')][_0xdf2a('0x15')]);_0x4403a4['offset']=qs[_0xdf2a('0x13')](_0x5029f2['query'][_0xdf2a('0x13')]);}_0x4403a4[_0xdf2a('0x2d')]=qs[_0xdf2a('0x2e')](_0x5029f2[_0xdf2a('0x27')]['sort']);_0x4403a4[_0xdf2a('0x2f')]=qs['filters'](_[_0xdf2a('0x30')](_0x5029f2[_0xdf2a('0x27')],_0x152b3c[_0xdf2a('0x25')]),_0x20dd08);if(_0x5029f2[_0xdf2a('0x27')][_0xdf2a('0x31')]){_0x4403a4[_0xdf2a('0x2f')]=_[_0xdf2a('0x32')](_0x4403a4[_0xdf2a('0x2f')],{'$or':_['map'](_0x20dd08,function(_0x31fcf8){if(_0x31fcf8[_0xdf2a('0x20')]!==_0xdf2a('0x33')){var _0x43f1bc={};_0x43f1bc[_0x31fcf8['name']]={'$like':'%'+_0x5029f2['query'][_0xdf2a('0x31')]+'%'};return _0x43f1bc;}})});}_0x4403a4=_[_0xdf2a('0x32')]({},_0x4403a4,_0x5029f2[_0xdf2a('0x34')]);var _0x4f8f17={'where':_0x4403a4[_0xdf2a('0x2f')]};return db[_0xdf2a('0x35')][_0xdf2a('0x16')](_0x4f8f17)[_0xdf2a('0x1a')](function(_0x117386){_0x37dc88[_0xdf2a('0x16')]=_0x117386;if(_0x5029f2['query'][_0xdf2a('0x36')]){_0x4403a4[_0xdf2a('0x37')]=[{'all':!![]}];}return db[_0xdf2a('0x35')][_0xdf2a('0x38')](_0x4403a4);})[_0xdf2a('0x1a')](function(_0x439e80){_0x37dc88[_0xdf2a('0x39')]=_0x439e80;return _0x37dc88;})[_0xdf2a('0x1a')](respondWithFilteredResult(_0x9beea7,_0x4403a4))[_0xdf2a('0x3a')](handleError(_0x9beea7,null));};exports[_0xdf2a('0x3b')]=function(_0x42dea3,_0xd902e6){var _0x9d50a={'raw':!![],'where':{'id':_0x42dea3['params']['id']}},_0x466a68={};_0x466a68['model']=_[_0xdf2a('0x24')](db[_0xdf2a('0x35')]['rawAttributes']);_0x466a68[_0xdf2a('0x27')]=_[_0xdf2a('0x24')](_0x42dea3['query']);_0x466a68['filters']=_['intersection'](_0x466a68[_0xdf2a('0x22')],_0x466a68[_0xdf2a('0x27')]);_0x9d50a[_0xdf2a('0x28')]=_[_0xdf2a('0x26')](_0x466a68[_0xdf2a('0x22')],qs['fields'](_0x42dea3[_0xdf2a('0x27')][_0xdf2a('0x29')]));_0x9d50a[_0xdf2a('0x28')]=_0x9d50a[_0xdf2a('0x28')]['length']?_0x9d50a[_0xdf2a('0x28')]:_0x466a68[_0xdf2a('0x22')];if(_0x42dea3[_0xdf2a('0x27')][_0xdf2a('0x36')]){_0x9d50a[_0xdf2a('0x37')]=[{'all':!![]}];}_0x9d50a=_[_0xdf2a('0x32')]({},_0x9d50a,_0x42dea3[_0xdf2a('0x34')]);return db[_0xdf2a('0x35')][_0xdf2a('0x3c')](_0x9d50a)[_0xdf2a('0x1a')](handleEntityNotFound(_0xd902e6,null))[_0xdf2a('0x1a')](respondWithResult(_0xd902e6,null))[_0xdf2a('0x3a')](handleError(_0xd902e6,null));};exports[_0xdf2a('0x3d')]=function(_0x46849f,_0x2a493d){return db[_0xdf2a('0x35')][_0xdf2a('0x3d')](_0x46849f[_0xdf2a('0x3e')],{})[_0xdf2a('0x1a')](respondWithResult(_0x2a493d,0xc9))['catch'](handleError(_0x2a493d,null));};exports[_0xdf2a('0x3f')]=function(_0x40d611,_0x5f13d7){if(_0x40d611['body']['id']){delete _0x40d611[_0xdf2a('0x3e')]['id'];}return db[_0xdf2a('0x35')][_0xdf2a('0x3c')]({'where':{'id':_0x40d611[_0xdf2a('0x40')]['id']}})[_0xdf2a('0x1a')](handleEntityNotFound(_0x5f13d7,null))[_0xdf2a('0x1a')](saveUpdates(_0x40d611[_0xdf2a('0x3e')],null))['then'](respondWithResult(_0x5f13d7,null))[_0xdf2a('0x3a')](handleError(_0x5f13d7,null));};exports[_0xdf2a('0x41')]=function(_0x5fca96,_0x47b33d,_0x2987c2){var _0x4bde26=require('../../components/encryptor');var _0x44c624=![];var _0x45adef={};if(_0x5fca96['query'][_0xdf2a('0x20')]&&_0x5fca96[_0xdf2a('0x27')]['type']==='uniqueid'){_0x45adef[_0xdf2a('0x42')]=_0x5fca96['params']['id'];}else{_0x45adef['id']=_0x5fca96[_0xdf2a('0x40')]['id'];}return db[_0xdf2a('0x35')]['find']({'where':_0x45adef,'attributes':['id',_0xdf2a('0x43'),'filename'],'raw':!![]})[_0xdf2a('0x1a')](handleEntityNotFound(_0x47b33d,null))[_0xdf2a('0x1a')](function(_0x284dbe){if(_0x284dbe){var _0x3188b9=_0x284dbe[_0xdf2a('0x43')];var _0x4f23e5=util[_0xdf2a('0x44')]('%s.cypher',_0x3188b9);if(fs[_0xdf2a('0x45')](_0x4f23e5)){_0x44c624=!![];return _0x4bde26[_0xdf2a('0x46')](_0x4f23e5,_0x3188b9,config[_0xdf2a('0x47')]['recording'])[_0xdf2a('0x1a')](function(){return _0x284dbe;});}return _0x284dbe;}})[_0xdf2a('0x1a')](function(_0x1aa386){if(_0x1aa386){var _0x439785=_0x1aa386['savePath'];if(!fs[_0xdf2a('0x45')](_0x439785)){throw new db[(_0xdf2a('0x48'))][(_0xdf2a('0x49'))](_0xdf2a('0x4a'));}if(_0x1aa386[_0xdf2a('0x4b')]){return _0x47b33d['download'](_0x439785,_0x1aa386[_0xdf2a('0x4b')]+path[_0xdf2a('0x4c')](_0x439785),function(){if(_0x44c624){fs['unlink'](_0x439785);}});}else{return _0x47b33d['download'](_0x439785,function(_0xb5b5fa){if(_0x44c624){fs[_0xdf2a('0x4d')](_0x439785);}});}}})[_0xdf2a('0x3a')](function(_0x3303d0){if(_0x3303d0[_0xdf2a('0x4e')]===_0xdf2a('0x4a')){_0x47b33d['status'](0x194)['send'](_0xdf2a('0x4f'));}else{return handleError(_0x47b33d,null);}});};exports[_0xdf2a('0x1b')]=function(_0x45ee52,_0x12fcd3){return db[_0xdf2a('0x35')]['find']({'where':{'id':_0x45ee52['params']['id']}})[_0xdf2a('0x1a')](function(_0x5857c7){if(_[_0xdf2a('0x50')](_0x5857c7)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5857c7;})[_0xdf2a('0x1a')](function(_0x550856){var _0x5abd4e=_0x550856[_0xdf2a('0x43')];logger[_0xdf2a('0x51')](_0xdf2a('0x52'),_0x5abd4e);if(!_[_0xdf2a('0x50')](_0x550856['savePath'])&&fs['existsSync'](_0x5abd4e)){logger[_0xdf2a('0x51')](_0xdf2a('0x53')+_0x5abd4e+_0xdf2a('0x54'));fs['unlinkSync'](_0x5abd4e);}_0x5abd4e=_0x5abd4e+'.cypher';if(!_[_0xdf2a('0x50')](_0x550856[_0xdf2a('0x43')])&&fs['existsSync'](_0x5abd4e)){logger[_0xdf2a('0x51')]('File:\x20\x22'+_0x5abd4e+_0xdf2a('0x54'));fs[_0xdf2a('0x55')](_0x5abd4e);}return _0x550856;})[_0xdf2a('0x1a')](function(_0x13f1b6){if(!_0x13f1b6)throw new InternalError();return _0x13f1b6[_0xdf2a('0x1b')]();})[_0xdf2a('0x1a')](function(){_0x12fcd3[_0xdf2a('0x11')](0xcc)['end']();})[_0xdf2a('0x3a')](handleError(_0x12fcd3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 08f28ee..e0ef8fa 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 _0x9bd9=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x465147,_0x240ccd){_0x465147=_0x465147-0x0;var _0x5449b5=_0x9bd9[_0x465147];return _0x5449b5;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var logger=require(_0x99bd('0x2'))(_0x99bd('0x3'));var moment=require(_0x99bd('0x4'));var BPromise=require(_0x99bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99bd('0x6'));var rimraf=require('rimraf');var config=require(_0x99bd('0x7'));var attributes=require(_0x99bd('0x8'));module['exports']=function(_0xa1cd99,_0x45b939){return _0xa1cd99[_0x99bd('0x9')](_0x99bd('0xa'),attributes,{'tableName':_0x99bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','square_recordings','bluebird'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0x5d58,0x187));var _0x85d5=function(_0x41fc73,_0x7cb3c5){_0x41fc73=_0x41fc73-0x0;var _0x10d8eb=_0x5d58[_0x41fc73];return _0x10d8eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./squareRecording.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('SquareRecording',attributes,{'tableName':_0x85d5('0x6'),'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 9bf767d..502b369 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 _0x34a3=['../../config/environment','client','http','request','info','debug','error','SquareRecording,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x10faf1,_0x2457d0){var _0x26f730=function(_0x4ac80d){while(--_0x4ac80d){_0x10faf1['push'](_0x10faf1['shift']());}};_0x26f730(++_0x2457d0);}(_0x34a3,0x9f));var _0x334a=function(_0x556b28,_0x46061b){_0x556b28=_0x556b28-0x0;var _0x23bfc1=_0x34a3[_0x556b28];return _0x23bfc1;};'use strict';var _=require(_0x334a('0x0'));var util=require(_0x334a('0x1'));var moment=require(_0x334a('0x2'));var BPromise=require(_0x334a('0x3'));var rs=require(_0x334a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x334a('0x5'))['db'];var utils=require(_0x334a('0x6'));var logger=require(_0x334a('0x7'))(_0x334a('0x8'));var config=require(_0x334a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x334a('0xa')][_0x334a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2113f,_0x5d2529,_0x28c308){return new BPromise(function(_0x16ba4f,_0x2a9df5){return client[_0x334a('0xc')](_0xd2113f,_0x28c308)['then'](function(_0x46019d){logger[_0x334a('0xd')]('SquareRecording,\x20%s,\x20%s',_0x5d2529,'request\x20sent');logger[_0x334a('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5d2529,'request\x20sent',JSON['stringify'](_0x46019d));if(_0x46019d[_0x334a('0xf')]){if(_0x46019d[_0x334a('0xf')]['code']===0x1f4){logger['error'](_0x334a('0x10'),_0x5d2529,_0x46019d[_0x334a('0xf')][_0x334a('0x11')]);return _0x2a9df5(_0x46019d[_0x334a('0xf')]['message']);}logger[_0x334a('0xf')](_0x334a('0x10'),_0x5d2529,_0x46019d[_0x334a('0xf')][_0x334a('0x11')]);return _0x16ba4f(_0x46019d[_0x334a('0xf')][_0x334a('0x11')]);}else{logger[_0x334a('0xd')](_0x334a('0x10'),_0x5d2529,_0x334a('0x12'));_0x16ba4f(_0x46019d[_0x334a('0x13')]['message']);}})[_0x334a('0x14')](function(_0xa75daf){logger[_0x334a('0xf')](_0x334a('0x10'),_0x5d2529,_0xa75daf);_0x2a9df5(_0xa75daf);});});}exports[_0x334a('0x15')]=function(_0x462621){var _0x5dceec=this;return new Promise(function(_0x58f6ec,_0x5943ee){return db[_0x334a('0x16')][_0x334a('0x17')](_0x462621[_0x334a('0x18')],{'raw':_0x462621[_0x334a('0x19')]?_0x462621[_0x334a('0x19')][_0x334a('0x1a')]===undefined?!![]:![]:!![]})[_0x334a('0x1b')](function(_0x4f7152){logger[_0x334a('0xd')](_0x334a('0x15'),_0x462621);logger[_0x334a('0xe')](_0x334a('0x15'),_0x462621,JSON['stringify'](_0x4f7152));_0x58f6ec(_0x4f7152);})[_0x334a('0x14')](function(_0x261811){logger[_0x334a('0xf')](_0x334a('0x15'),_0x261811['message'],_0x462621);_0x5943ee(_0x5dceec[_0x334a('0xf')](0x1f4,_0x261811[_0x334a('0x11')]));});});}; \ No newline at end of file +var _0xf494=['http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4ca31c,_0x3810a6){var _0x503b0f=function(_0x30431d){while(--_0x30431d){_0x4ca31c['push'](_0x4ca31c['shift']());}};_0x503b0f(++_0x3810a6);}(_0xf494,0x13e));var _0x4f49=function(_0x2ec2d4,_0x2c73f9){_0x2ec2d4=_0x2ec2d4-0x0;var _0x5c35c4=_0xf494[_0x2ec2d4];return _0x5c35c4;};'use strict';var _=require(_0x4f49('0x0'));var util=require('util');var moment=require(_0x4f49('0x1'));var BPromise=require(_0x4f49('0x2'));var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5091df,_0x4bb472,_0x2d20c7){return new BPromise(function(_0x422f54,_0x10c8b4){return client[_0x4f49('0xd')](_0x5091df,_0x2d20c7)[_0x4f49('0xe')](function(_0x29d472){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x4bb472,'request\x20sent');logger[_0x4f49('0x11')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x4bb472,'request\x20sent',JSON[_0x4f49('0x12')](_0x29d472));if(_0x29d472['error']){if(_0x29d472[_0x4f49('0x13')]['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x4bb472,_0x29d472[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x10c8b4(_0x29d472['error'][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x4bb472,_0x29d472['error']['message']);return _0x422f54(_0x29d472[_0x4f49('0x13')][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x4bb472,_0x4f49('0x15'));_0x422f54(_0x29d472[_0x4f49('0x16')][_0x4f49('0x14')]);}})[_0x4f49('0x17')](function(_0x98c37d){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x4bb472,_0x98c37d);_0x10c8b4(_0x98c37d);});});}exports[_0x4f49('0x18')]=function(_0x1789d4){var _0x31f16c=this;return new Promise(function(_0x3a44b7,_0x1729de){return db[_0x4f49('0x19')][_0x4f49('0x1a')](_0x1789d4[_0x4f49('0x1b')],{'raw':_0x1789d4[_0x4f49('0x1c')]?_0x1789d4[_0x4f49('0x1c')][_0x4f49('0x1d')]===undefined?!![]:![]:!![]})[_0x4f49('0xe')](function(_0x30ee72){logger['info']('CreateSquareRecording',_0x1789d4);logger[_0x4f49('0x11')]('CreateSquareRecording',_0x1789d4,JSON['stringify'](_0x30ee72));_0x3a44b7(_0x30ee72);})[_0x4f49('0x17')](function(_0x2fed56){logger['error'](_0x4f49('0x18'),_0x2fed56['message'],_0x1789d4);_0x1729de(_0x31f16c[_0x4f49('0x13')](0x1f4,_0x2fed56['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index edf19e2..2daa5fd 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 _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x133f5a,_0x3919aa){var _0x56d4be=function(_0x21ce27){while(--_0x21ce27){_0x133f5a['push'](_0x133f5a['shift']());}};_0x56d4be(++_0x3919aa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index ba013e2..0ea7440 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 _0x5d20=['DATE','BOOLEAN','STRING'];(function(_0x325c70,_0x2f976c){var _0x1dcd49=function(_0x2fded4){while(--_0x2fded4){_0x325c70['push'](_0x325c70['shift']());}};_0x1dcd49(++_0x2f976c);}(_0x5d20,0xcb));var _0x05d2=function(_0xe3c217,_0x175a62){_0xe3c217=_0xe3c217-0x0;var _0x18f29b=_0x5d20[_0xe3c217];return _0x18f29b;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x05d2('0x0')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x05d2('0x0')]},'language':{'type':Sequelize[_0x05d2('0x0')]},'type':{'type':Sequelize[_0x05d2('0x0')]},'uniqueid':{'type':Sequelize[_0x05d2('0x0')]},'version':{'type':Sequelize[_0x05d2('0x0')]},'callerid':{'type':Sequelize[_0x05d2('0x0')]},'calleridname':{'type':Sequelize[_0x05d2('0x0')]},'callingpres':{'type':Sequelize[_0x05d2('0x0')]},'callingani2':{'type':Sequelize[_0x05d2('0x0')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x05d2('0x0')]},'dnid':{'type':Sequelize[_0x05d2('0x0')]},'rdnis':{'type':Sequelize[_0x05d2('0x0')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x05d2('0x0')]},'priority':{'type':Sequelize[_0x05d2('0x0')]},'enhanced':{'type':Sequelize[_0x05d2('0x0')]},'accountcode':{'type':Sequelize[_0x05d2('0x0')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x05d2('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x05d2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3e94=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0xb509e5,_0x5a7f48){var _0x16a111=function(_0x8d8366){while(--_0x8d8366){_0xb509e5['push'](_0xb509e5['shift']());}};_0x16a111(++_0x5a7f48);}(_0x3e94,0x99));var _0x43e9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3e94[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x43e9('0x0'));module[_0x43e9('0x1')]={'network':{'type':Sequelize[_0x43e9('0x2')]},'network_script':{'type':Sequelize[_0x43e9('0x2')]},'request':{'type':Sequelize[_0x43e9('0x2')]},'channel':{'type':Sequelize[_0x43e9('0x2')]},'language':{'type':Sequelize[_0x43e9('0x2')]},'type':{'type':Sequelize[_0x43e9('0x2')]},'uniqueid':{'type':Sequelize[_0x43e9('0x2')]},'version':{'type':Sequelize[_0x43e9('0x2')]},'callerid':{'type':Sequelize[_0x43e9('0x2')]},'calleridname':{'type':Sequelize[_0x43e9('0x2')]},'callingpres':{'type':Sequelize[_0x43e9('0x2')]},'callingani2':{'type':Sequelize[_0x43e9('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x43e9('0x2')]},'rdnis':{'type':Sequelize[_0x43e9('0x2')]},'context':{'type':Sequelize[_0x43e9('0x2')]},'extension':{'type':Sequelize[_0x43e9('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x43e9('0x2')]},'accountcode':{'type':Sequelize[_0x43e9('0x2')]},'threadid':{'type':Sequelize[_0x43e9('0x2')]},'project_name':{'type':Sequelize[_0x43e9('0x2')]},'joinAt':{'type':Sequelize[_0x43e9('0x3')]},'leaveAt':{'type':Sequelize[_0x43e9('0x3')]},'bot':{'type':Sequelize[_0x43e9('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 7282ced..b603c4f 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 _0x55c7=['query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','filter','options','includeAll','findAll','show','keys','include','create','body','catch','find','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','key','model'];(function(_0x3a5e80,_0x4995c4){var _0x149837=function(_0x18451c){while(--_0x18451c){_0x3a5e80['push'](_0x3a5e80['shift']());}};_0x149837(++_0x4995c4);}(_0x55c7,0x68));var _0x755c=function(_0x31f85a,_0x213e1c){_0x31f85a=_0x31f85a-0x0;var _0x380f5d=_0x55c7[_0x31f85a];return _0x380f5d;};'use strict';var emlformat=require(_0x755c('0x0'));var rimraf=require(_0x755c('0x1'));var zipdir=require(_0x755c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x755c('0x3'));var moment=require(_0x755c('0x4'));var BPromise=require(_0x755c('0x5'));var Mustache=require(_0x755c('0x6'));var util=require(_0x755c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x755c('0x8'));var ejs=require(_0x755c('0x9'));var fs=require('fs');var fs_extra=require(_0x755c('0xa'));var _=require(_0x755c('0xb'));var squel=require(_0x755c('0xc'));var crypto=require(_0x755c('0xd'));var jsforce=require(_0x755c('0xe'));var deskjs=require(_0x755c('0xf'));var toCsv=require(_0x755c('0x8'));var querystring=require(_0x755c('0x10'));var Papa=require(_0x755c('0x11'));var Redis=require(_0x755c('0x12'));var authService=require(_0x755c('0x13'));var qs=require(_0x755c('0x14'));var as=require(_0x755c('0x15'));var hardwareService=require(_0x755c('0x16'));var logger=require(_0x755c('0x17'))(_0x755c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x755c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2eb5a1,_0x250e08){_0x250e08=_0x250e08||0xcc;return function(_0x5788d0){if(_0x5788d0){return _0x2eb5a1[_0x755c('0x1a')](_0x250e08);}return _0x2eb5a1[_0x755c('0x1b')](_0x250e08)[_0x755c('0x1c')]();};}function respondWithResult(_0xc3d003,_0xe7ce01){_0xe7ce01=_0xe7ce01||0xc8;return function(_0x7e027){if(_0x7e027){return _0xc3d003['status'](_0xe7ce01)[_0x755c('0x1d')](_0x7e027);}};}function respondWithFilteredResult(_0x594dcc,_0x3cba8a){return function(_0x2264cc){if(_0x2264cc){var _0x3b542a=typeof _0x3cba8a[_0x755c('0x1e')]==='undefined'&&typeof _0x3cba8a[_0x755c('0x1f')]===_0x755c('0x20');var _0x303934=_0x2264cc[_0x755c('0x21')];var _0x3db144=_0x3b542a?0x0:_0x3cba8a['offset'];var _0x265c38=_0x3b542a?_0x2264cc[_0x755c('0x21')]:_0x3cba8a['offset']+_0x3cba8a[_0x755c('0x1f')];var _0x5acc00;if(_0x265c38>=_0x303934){_0x265c38=_0x303934;_0x5acc00=0xc8;}else{_0x5acc00=0xce;}_0x594dcc[_0x755c('0x1b')](_0x5acc00);return _0x594dcc['set'](_0x755c('0x22'),_0x3db144+'-'+_0x265c38+'/'+_0x303934)[_0x755c('0x1d')](_0x2264cc);}return null;};}function patchUpdates(_0x2bcc10){return function(_0x216215){try{jsonpatch[_0x755c('0x23')](_0x216215,_0x2bcc10,!![]);}catch(_0x571f96){return BPromise['reject'](_0x571f96);}return _0x216215[_0x755c('0x24')]();};}function saveUpdates(_0x2a5501,_0x33b7b7){return function(_0x56cf10){if(_0x56cf10){return _0x56cf10[_0x755c('0x25')](_0x2a5501)[_0x755c('0x26')](function(_0x320cb2){return _0x320cb2;});}return null;};}function removeEntity(_0x47ebd1,_0x4f4c96){return function(_0x2586c5){if(_0x2586c5){return _0x2586c5['destroy']()['then'](function(){_0x47ebd1['status'](0xcc)[_0x755c('0x1c')]();});}};}function handleEntityNotFound(_0x5c8036,_0x524730){return function(_0x3ff0d1){if(!_0x3ff0d1){_0x5c8036[_0x755c('0x1a')](0x194);}return _0x3ff0d1;};}function handleError(_0x31b757,_0x1cecb2){_0x1cecb2=_0x1cecb2||0x1f4;return function(_0x51a2f4){logger[_0x755c('0x27')](_0x51a2f4[_0x755c('0x28')]);if(_0x51a2f4[_0x755c('0x29')]){delete _0x51a2f4[_0x755c('0x29')];}_0x31b757[_0x755c('0x1b')](_0x1cecb2)[_0x755c('0x2a')](_0x51a2f4);};}exports[_0x755c('0x2b')]=function(_0x4e6597,_0x2dafbd){var _0xf6bad2={},_0x25dd91={},_0x474d94={'count':0x0,'rows':[]};var _0x28674d=_['map'](db[_0x755c('0x2c')][_0x755c('0x2d')],function(_0x330b77){return{'name':_0x330b77['fieldName'],'type':_0x330b77['type'][_0x755c('0x2e')]};});_0x25dd91[_0x755c('0x2f')]=_['map'](_0x28674d,'name');_0x25dd91[_0x755c('0x30')]=_['keys'](_0x4e6597[_0x755c('0x30')]);_0x25dd91[_0x755c('0x31')]=_['intersection'](_0x25dd91[_0x755c('0x2f')],_0x25dd91[_0x755c('0x30')]);_0xf6bad2[_0x755c('0x32')]=_[_0x755c('0x33')](_0x25dd91[_0x755c('0x2f')],qs[_0x755c('0x34')](_0x4e6597['query'][_0x755c('0x34')]));_0xf6bad2[_0x755c('0x32')]=_0xf6bad2[_0x755c('0x32')][_0x755c('0x35')]?_0xf6bad2[_0x755c('0x32')]:_0x25dd91[_0x755c('0x2f')];if(!_0x4e6597[_0x755c('0x30')][_0x755c('0x36')](_0x755c('0x37'))){_0xf6bad2[_0x755c('0x1f')]=qs['limit'](_0x4e6597[_0x755c('0x30')][_0x755c('0x1f')]);_0xf6bad2[_0x755c('0x1e')]=qs[_0x755c('0x1e')](_0x4e6597[_0x755c('0x30')][_0x755c('0x1e')]);}_0xf6bad2[_0x755c('0x38')]=qs['sort'](_0x4e6597['query'][_0x755c('0x39')]);_0xf6bad2[_0x755c('0x3a')]=qs[_0x755c('0x31')](_['pick'](_0x4e6597[_0x755c('0x30')],_0x25dd91[_0x755c('0x31')]),_0x28674d);if(_0x4e6597[_0x755c('0x30')]['filter']){_0xf6bad2[_0x755c('0x3a')]=_[_0x755c('0x3b')](_0xf6bad2[_0x755c('0x3a')],{'$or':_[_0x755c('0x3c')](_0x28674d,function(_0x4f42bc){if(_0x4f42bc[_0x755c('0x3d')]!=='VIRTUAL'){var _0xca32b0={};_0xca32b0[_0x4f42bc[_0x755c('0x29')]]={'$like':'%'+_0x4e6597[_0x755c('0x30')][_0x755c('0x3e')]+'%'};return _0xca32b0;}})});}_0xf6bad2=_[_0x755c('0x3b')]({},_0xf6bad2,_0x4e6597[_0x755c('0x3f')]);var _0x122f96={'where':_0xf6bad2[_0x755c('0x3a')]};return db['SquareReport'][_0x755c('0x21')](_0x122f96)[_0x755c('0x26')](function(_0x56d521){_0x474d94[_0x755c('0x21')]=_0x56d521;if(_0x4e6597['query'][_0x755c('0x40')]){_0xf6bad2['include']=[{'all':!![]}];}return db[_0x755c('0x2c')][_0x755c('0x41')](_0xf6bad2);})[_0x755c('0x26')](function(_0xae0b83){_0x474d94['rows']=_0xae0b83;return _0x474d94;})[_0x755c('0x26')](respondWithFilteredResult(_0x2dafbd,_0xf6bad2))['catch'](handleError(_0x2dafbd,null));};exports[_0x755c('0x42')]=function(_0x3d35d1,_0x1a83e3){var _0x511735={'raw':!![],'where':{'id':_0x3d35d1['params']['id']}},_0x1be4ae={};_0x1be4ae[_0x755c('0x2f')]=_[_0x755c('0x43')](db[_0x755c('0x2c')][_0x755c('0x2d')]);_0x1be4ae[_0x755c('0x30')]=_[_0x755c('0x43')](_0x3d35d1[_0x755c('0x30')]);_0x1be4ae['filters']=_[_0x755c('0x33')](_0x1be4ae[_0x755c('0x2f')],_0x1be4ae[_0x755c('0x30')]);_0x511735[_0x755c('0x32')]=_[_0x755c('0x33')](_0x1be4ae[_0x755c('0x2f')],qs[_0x755c('0x34')](_0x3d35d1[_0x755c('0x30')]['fields']));_0x511735[_0x755c('0x32')]=_0x511735[_0x755c('0x32')][_0x755c('0x35')]?_0x511735[_0x755c('0x32')]:_0x1be4ae[_0x755c('0x2f')];if(_0x3d35d1[_0x755c('0x30')][_0x755c('0x40')]){_0x511735[_0x755c('0x44')]=[{'all':!![]}];}_0x511735=_[_0x755c('0x3b')]({},_0x511735,_0x3d35d1['options']);return db[_0x755c('0x2c')]['find'](_0x511735)[_0x755c('0x26')](handleEntityNotFound(_0x1a83e3,null))[_0x755c('0x26')](respondWithResult(_0x1a83e3,null))['catch'](handleError(_0x1a83e3,null));};exports[_0x755c('0x45')]=function(_0x4f737c,_0x525d70){return db[_0x755c('0x2c')][_0x755c('0x45')](_0x4f737c[_0x755c('0x46')],{})[_0x755c('0x26')](respondWithResult(_0x525d70,0xc9))[_0x755c('0x47')](handleError(_0x525d70,null));};exports[_0x755c('0x25')]=function(_0x1e58d2,_0x394350){if(_0x1e58d2[_0x755c('0x46')]['id']){delete _0x1e58d2[_0x755c('0x46')]['id'];}return db[_0x755c('0x2c')][_0x755c('0x48')]({'where':{'id':_0x1e58d2[_0x755c('0x49')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0x394350,null))['then'](saveUpdates(_0x1e58d2['body'],null))[_0x755c('0x26')](respondWithResult(_0x394350,null))[_0x755c('0x47')](handleError(_0x394350,null));};exports[_0x755c('0x4a')]=function(_0x37dd9f,_0x2ee665){return db[_0x755c('0x2c')]['find']({'where':{'id':_0x37dd9f[_0x755c('0x49')]['id']}})[_0x755c('0x26')](handleEntityNotFound(_0x2ee665,null))[_0x755c('0x26')](removeEntity(_0x2ee665,null))[_0x755c('0x47')](handleError(_0x2ee665,null));};exports['describe']=function(_0x1810e8,_0x1e4fff){return db['SquareReport'][_0x755c('0x4b')]()[_0x755c('0x26')](respondWithResult(_0x1e4fff,null))[_0x755c('0x47')](handleError(_0x1e4fff,null));}; \ No newline at end of file +var _0xe7b8=['squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','end','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x3f0646,_0x367112){var _0x1b5ffe=function(_0x22ed7d){while(--_0x22ed7d){_0x3f0646['push'](_0x3f0646['shift']());}};_0x1b5ffe(++_0x367112);}(_0xe7b8,0xda));var _0x8e7b=function(_0x5aa605,_0x871096){_0x5aa605=_0x5aa605-0x0;var _0x3fa635=_0xe7b8[_0x5aa605];return _0x3fa635;};'use strict';var emlformat=require(_0x8e7b('0x0'));var rimraf=require(_0x8e7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e7b('0x2'));var rp=require(_0x8e7b('0x3'));var moment=require(_0x8e7b('0x4'));var BPromise=require(_0x8e7b('0x5'));var Mustache=require(_0x8e7b('0x6'));var util=require(_0x8e7b('0x7'));var path=require(_0x8e7b('0x8'));var sox=require(_0x8e7b('0x9'));var csv=require(_0x8e7b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e7b('0xb'));var _=require(_0x8e7b('0xc'));var squel=require(_0x8e7b('0xd'));var crypto=require(_0x8e7b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e7b('0xf'));var toCsv=require(_0x8e7b('0xa'));var querystring=require(_0x8e7b('0x10'));var Papa=require(_0x8e7b('0x11'));var Redis=require(_0x8e7b('0x12'));var authService=require(_0x8e7b('0x13'));var qs=require(_0x8e7b('0x14'));var as=require(_0x8e7b('0x15'));var hardwareService=require(_0x8e7b('0x16'));var logger=require('../../config/logger')(_0x8e7b('0x17'));var utils=require(_0x8e7b('0x18'));var config=require(_0x8e7b('0x19'));var licenseUtil=require(_0x8e7b('0x1a'));var db=require(_0x8e7b('0x1b'))['db'];function respondWithStatusCode(_0x689437,_0x84774a){_0x84774a=_0x84774a||0xcc;return function(_0x5b7df4){if(_0x5b7df4){return _0x689437[_0x8e7b('0x1c')](_0x84774a);}return _0x689437[_0x8e7b('0x1d')](_0x84774a)['end']();};}function respondWithResult(_0x2dfc84,_0x28e221){_0x28e221=_0x28e221||0xc8;return function(_0x38a09f){if(_0x38a09f){return _0x2dfc84['status'](_0x28e221)['json'](_0x38a09f);}};}function respondWithFilteredResult(_0x117650,_0x5b9ec4){return function(_0xc3fe39){if(_0xc3fe39){var _0x130f96=typeof _0x5b9ec4[_0x8e7b('0x1e')]===_0x8e7b('0x1f')&&typeof _0x5b9ec4[_0x8e7b('0x20')]===_0x8e7b('0x1f');var _0x58306a=_0xc3fe39[_0x8e7b('0x21')];var _0x14b627=_0x130f96?0x0:_0x5b9ec4[_0x8e7b('0x1e')];var _0x5270a7=_0x130f96?_0xc3fe39['count']:_0x5b9ec4[_0x8e7b('0x1e')]+_0x5b9ec4[_0x8e7b('0x20')];var _0x1aa627;if(_0x5270a7>=_0x58306a){_0x5270a7=_0x58306a;_0x1aa627=0xc8;}else{_0x1aa627=0xce;}_0x117650[_0x8e7b('0x1d')](_0x1aa627);return _0x117650[_0x8e7b('0x22')]('Content-Range',_0x14b627+'-'+_0x5270a7+'/'+_0x58306a)[_0x8e7b('0x23')](_0xc3fe39);}return null;};}function patchUpdates(_0x1d3ba2){return function(_0xa2ddab){try{jsonpatch[_0x8e7b('0x24')](_0xa2ddab,_0x1d3ba2,!![]);}catch(_0x2ab119){return BPromise[_0x8e7b('0x25')](_0x2ab119);}return _0xa2ddab['save']();};}function saveUpdates(_0x34f194,_0x53fada){return function(_0x868cdf){if(_0x868cdf){return _0x868cdf[_0x8e7b('0x26')](_0x34f194)[_0x8e7b('0x27')](function(_0x45227e){return _0x45227e;});}return null;};}function removeEntity(_0x412fb3,_0x3ab593){return function(_0x107205){if(_0x107205){return _0x107205['destroy']()['then'](function(){_0x412fb3[_0x8e7b('0x1d')](0xcc)[_0x8e7b('0x28')]();});}};}function handleEntityNotFound(_0x115963,_0x4d3380){return function(_0x578b06){if(!_0x578b06){_0x115963['sendStatus'](0x194);}return _0x578b06;};}function handleError(_0x3fdc18,_0x4003cf){_0x4003cf=_0x4003cf||0x1f4;return function(_0x452868){logger['error'](_0x452868['stack']);if(_0x452868['name']){delete _0x452868[_0x8e7b('0x29')];}_0x3fdc18[_0x8e7b('0x1d')](_0x4003cf)['send'](_0x452868);};}exports['index']=function(_0x30bfd2,_0xd32921){var _0xbca6e1={},_0x338d79={},_0x3830c4={'count':0x0,'rows':[]};var _0x1f5afa=_[_0x8e7b('0x2a')](db['SquareReport'][_0x8e7b('0x2b')],function(_0x4132b5){return{'name':_0x4132b5[_0x8e7b('0x2c')],'type':_0x4132b5[_0x8e7b('0x2d')][_0x8e7b('0x2e')]};});_0x338d79['model']=_[_0x8e7b('0x2a')](_0x1f5afa,_0x8e7b('0x29'));_0x338d79[_0x8e7b('0x2f')]=_[_0x8e7b('0x30')](_0x30bfd2['query']);_0x338d79[_0x8e7b('0x31')]=_[_0x8e7b('0x32')](_0x338d79[_0x8e7b('0x33')],_0x338d79[_0x8e7b('0x2f')]);_0xbca6e1['attributes']=_['intersection'](_0x338d79[_0x8e7b('0x33')],qs['fields'](_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x34')]));_0xbca6e1[_0x8e7b('0x35')]=_0xbca6e1[_0x8e7b('0x35')][_0x8e7b('0x36')]?_0xbca6e1[_0x8e7b('0x35')]:_0x338d79[_0x8e7b('0x33')];if(!_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x37')](_0x8e7b('0x38'))){_0xbca6e1[_0x8e7b('0x20')]=qs[_0x8e7b('0x20')](_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x20')]);_0xbca6e1[_0x8e7b('0x1e')]=qs[_0x8e7b('0x1e')](_0x30bfd2[_0x8e7b('0x2f')]['offset']);}_0xbca6e1[_0x8e7b('0x39')]=qs[_0x8e7b('0x3a')](_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x3a')]);_0xbca6e1[_0x8e7b('0x3b')]=qs[_0x8e7b('0x31')](_[_0x8e7b('0x3c')](_0x30bfd2[_0x8e7b('0x2f')],_0x338d79[_0x8e7b('0x31')]),_0x1f5afa);if(_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x3d')]){_0xbca6e1['where']=_[_0x8e7b('0x3e')](_0xbca6e1['where'],{'$or':_[_0x8e7b('0x2a')](_0x1f5afa,function(_0x56f971){if(_0x56f971[_0x8e7b('0x2d')]!==_0x8e7b('0x3f')){var _0x2206cb={};_0x2206cb[_0x56f971[_0x8e7b('0x29')]]={'$like':'%'+_0x30bfd2[_0x8e7b('0x2f')]['filter']+'%'};return _0x2206cb;}})});}_0xbca6e1=_[_0x8e7b('0x3e')]({},_0xbca6e1,_0x30bfd2[_0x8e7b('0x40')]);var _0x1fe3c6={'where':_0xbca6e1[_0x8e7b('0x3b')]};return db[_0x8e7b('0x41')][_0x8e7b('0x21')](_0x1fe3c6)['then'](function(_0x598cbe){_0x3830c4[_0x8e7b('0x21')]=_0x598cbe;if(_0x30bfd2[_0x8e7b('0x2f')][_0x8e7b('0x42')]){_0xbca6e1[_0x8e7b('0x43')]=[{'all':!![]}];}return db[_0x8e7b('0x41')][_0x8e7b('0x44')](_0xbca6e1);})['then'](function(_0x5e15e5){_0x3830c4[_0x8e7b('0x45')]=_0x5e15e5;return _0x3830c4;})[_0x8e7b('0x27')](respondWithFilteredResult(_0xd32921,_0xbca6e1))[_0x8e7b('0x46')](handleError(_0xd32921,null));};exports['show']=function(_0x3c704b,_0x4a394a){var _0x46a016={'raw':!![],'where':{'id':_0x3c704b[_0x8e7b('0x47')]['id']}},_0x574dc7={};_0x574dc7[_0x8e7b('0x33')]=_[_0x8e7b('0x30')](db[_0x8e7b('0x41')][_0x8e7b('0x2b')]);_0x574dc7[_0x8e7b('0x2f')]=_[_0x8e7b('0x30')](_0x3c704b[_0x8e7b('0x2f')]);_0x574dc7['filters']=_[_0x8e7b('0x32')](_0x574dc7[_0x8e7b('0x33')],_0x574dc7[_0x8e7b('0x2f')]);_0x46a016[_0x8e7b('0x35')]=_[_0x8e7b('0x32')](_0x574dc7['model'],qs[_0x8e7b('0x34')](_0x3c704b[_0x8e7b('0x2f')][_0x8e7b('0x34')]));_0x46a016[_0x8e7b('0x35')]=_0x46a016['attributes'][_0x8e7b('0x36')]?_0x46a016[_0x8e7b('0x35')]:_0x574dc7['model'];if(_0x3c704b[_0x8e7b('0x2f')][_0x8e7b('0x42')]){_0x46a016[_0x8e7b('0x43')]=[{'all':!![]}];}_0x46a016=_[_0x8e7b('0x3e')]({},_0x46a016,_0x3c704b[_0x8e7b('0x40')]);return db[_0x8e7b('0x41')][_0x8e7b('0x48')](_0x46a016)[_0x8e7b('0x27')](handleEntityNotFound(_0x4a394a,null))['then'](respondWithResult(_0x4a394a,null))[_0x8e7b('0x46')](handleError(_0x4a394a,null));};exports[_0x8e7b('0x49')]=function(_0xfafa4e,_0x58d5e4){return db['SquareReport']['create'](_0xfafa4e[_0x8e7b('0x4a')],{})[_0x8e7b('0x27')](respondWithResult(_0x58d5e4,0xc9))[_0x8e7b('0x46')](handleError(_0x58d5e4,null));};exports[_0x8e7b('0x26')]=function(_0x9c614f,_0x1e0926){if(_0x9c614f['body']['id']){delete _0x9c614f[_0x8e7b('0x4a')]['id'];}return db[_0x8e7b('0x41')][_0x8e7b('0x48')]({'where':{'id':_0x9c614f[_0x8e7b('0x47')]['id']}})[_0x8e7b('0x27')](handleEntityNotFound(_0x1e0926,null))[_0x8e7b('0x27')](saveUpdates(_0x9c614f[_0x8e7b('0x4a')],null))['then'](respondWithResult(_0x1e0926,null))[_0x8e7b('0x46')](handleError(_0x1e0926,null));};exports[_0x8e7b('0x4b')]=function(_0x44b6c6,_0x55bc51){return db[_0x8e7b('0x41')]['find']({'where':{'id':_0x44b6c6['params']['id']}})[_0x8e7b('0x27')](handleEntityNotFound(_0x55bc51,null))[_0x8e7b('0x27')](removeEntity(_0x55bc51,null))['catch'](handleError(_0x55bc51,null));};exports[_0x8e7b('0x4c')]=function(_0x40786f,_0x35c1fb){return db[_0x8e7b('0x41')][_0x8e7b('0x4c')]()['then'](respondWithResult(_0x35c1fb,null))['catch'](handleError(_0x35c1fb,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6f51909..5da684f 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 _0xb49a=['project_name','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid'];(function(_0x2c27c6,_0xb57741){var _0x43e0a3=function(_0x1b861f){while(--_0x1b861f){_0x2c27c6['push'](_0x2c27c6['shift']());}};_0x43e0a3(++_0xb57741);}(_0xb49a,0x81));var _0xab49=function(_0x44cc74,_0x426cda){_0x44cc74=_0x44cc74-0x0;var _0x8761b4=_0xb49a[_0x44cc74];return _0x8761b4;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var logger=require(_0xab49('0x2'))(_0xab49('0x3'));var moment=require(_0xab49('0x4'));var BPromise=require(_0xab49('0x5'));var rp=require(_0xab49('0x6'));var fs=require('fs');var path=require(_0xab49('0x7'));var rimraf=require('rimraf');var config=require(_0xab49('0x8'));var attributes=require(_0xab49('0x9'));module[_0xab49('0xa')]=function(_0x3c3f3a,_0x25e419){return _0x3c3f3a[_0xab49('0xb')](_0xab49('0xc'),attributes,{'tableName':_0xab49('0xd'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xab49('0xe'),_0xab49('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1c2=['lodash','../../config/logger','api','moment','rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name'];(function(_0x46e7da,_0xe066cc){var _0xb30d53=function(_0x437e8c){while(--_0x437e8c){_0x46e7da['push'](_0x46e7da['shift']());}};_0xb30d53(++_0xe066cc);}(_0xd1c2,0xa8));var _0x2d1c=function(_0x519714,_0x4fc507){_0x519714=_0x519714-0x0;var _0x4bc00d=_0xd1c2[_0x519714];return _0x4bc00d;};'use strict';var _=require(_0x2d1c('0x0'));var util=require('util');var logger=require(_0x2d1c('0x1'))(_0x2d1c('0x2'));var moment=require(_0x2d1c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2d1c('0x4'));var config=require(_0x2d1c('0x5'));var attributes=require(_0x2d1c('0x6'));module['exports']=function(_0x581cd9,_0x45bf06){return _0x581cd9['define'](_0x2d1c('0x7'),attributes,{'tableName':_0x2d1c('0x8'),'paranoid':![],'indexes':[{'name':_0x2d1c('0x9'),'fields':[_0x2d1c('0xa'),_0x2d1c('0xb')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 0df6bfd..81f185e 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 _0xfd9e=['SquareReport','create','body','options','raw','UpdateSquareReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfd9e,0x14d));var _0xefd9=function(_0x8d20dd,_0x24caec){_0x8d20dd=_0x8d20dd-0x0;var _0x1c0b7c=_0xfd9e[_0x8d20dd];return _0x1c0b7c;};'use strict';var _=require(_0xefd9('0x0'));var util=require(_0xefd9('0x1'));var moment=require(_0xefd9('0x2'));var BPromise=require(_0xefd9('0x3'));var rs=require(_0xefd9('0x4'));var fs=require('fs');var Redis=require(_0xefd9('0x5'));var db=require(_0xefd9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xefd9('0x7'))(_0xefd9('0x8'));var config=require(_0xefd9('0x9'));var jayson=require(_0xefd9('0xa'));var client=jayson[_0xefd9('0xb')][_0xefd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x538481,_0x1464a9,_0x9bd3d0){return new BPromise(function(_0x3e2577,_0xd22e83){return client[_0xefd9('0xd')](_0x538481,_0x9bd3d0)[_0xefd9('0xe')](function(_0x56fec7){logger[_0xefd9('0xf')]('SquareReport,\x20%s,\x20%s',_0x1464a9,'request\x20sent');logger[_0xefd9('0x10')](_0xefd9('0x11'),_0x1464a9,_0xefd9('0x12'),JSON[_0xefd9('0x13')](_0x56fec7));if(_0x56fec7[_0xefd9('0x14')]){if(_0x56fec7[_0xefd9('0x14')][_0xefd9('0x15')]===0x1f4){logger[_0xefd9('0x14')](_0xefd9('0x16'),_0x1464a9,_0x56fec7[_0xefd9('0x14')]['message']);return _0xd22e83(_0x56fec7['error']['message']);}logger[_0xefd9('0x14')](_0xefd9('0x16'),_0x1464a9,_0x56fec7[_0xefd9('0x14')][_0xefd9('0x17')]);return _0x3e2577(_0x56fec7['error']['message']);}else{logger[_0xefd9('0xf')]('SquareReport,\x20%s,\x20%s',_0x1464a9,_0xefd9('0x12'));_0x3e2577(_0x56fec7[_0xefd9('0x18')][_0xefd9('0x17')]);}})[_0xefd9('0x19')](function(_0x54610f){logger[_0xefd9('0x14')](_0xefd9('0x16'),_0x1464a9,_0x54610f);_0xd22e83(_0x54610f);});});}exports[_0xefd9('0x1a')]=function(_0xd1eefb){var _0x3965c1=this;return new Promise(function(_0x454e8c,_0x3e9f26){return db[_0xefd9('0x1b')][_0xefd9('0x1c')](_0xd1eefb[_0xefd9('0x1d')],{'raw':_0xd1eefb[_0xefd9('0x1e')]?_0xd1eefb[_0xefd9('0x1e')][_0xefd9('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x387f60){logger[_0xefd9('0xf')](_0xefd9('0x1a'),_0xd1eefb);logger['debug']('CreateSquareReport',_0xd1eefb,JSON[_0xefd9('0x13')](_0x387f60));_0x454e8c(_0x387f60);})[_0xefd9('0x19')](function(_0x90dddd){logger[_0xefd9('0x14')](_0xefd9('0x1a'),_0x90dddd[_0xefd9('0x17')],_0xd1eefb);_0x3e9f26(_0x3965c1[_0xefd9('0x14')](0x1f4,_0x90dddd[_0xefd9('0x17')]));});});};exports[_0xefd9('0x20')]=function(_0x4699b0){var _0x6616d0=this;return new Promise(function(_0x450131,_0x5501bd){return db['SquareReport'][_0xefd9('0x21')](_0x4699b0[_0xefd9('0x1d')],{'raw':_0x4699b0[_0xefd9('0x1e')]?_0x4699b0[_0xefd9('0x1e')][_0xefd9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4699b0[_0xefd9('0x1e')]?_0x4699b0[_0xefd9('0x1e')]['where']||null:null,'attributes':_0x4699b0[_0xefd9('0x1e')]?_0x4699b0['options'][_0xefd9('0x22')]||null:null,'limit':_0x4699b0[_0xefd9('0x1e')]?_0x4699b0['options'][_0xefd9('0x23')]||null:null})[_0xefd9('0xe')](function(_0x49424b){logger[_0xefd9('0xf')](_0xefd9('0x20'),_0x4699b0);logger[_0xefd9('0x10')](_0xefd9('0x20'),_0x4699b0,JSON[_0xefd9('0x13')](_0x49424b));_0x450131(_0x49424b);})[_0xefd9('0x19')](function(_0x405f88){logger[_0xefd9('0x14')](_0xefd9('0x20'),_0x405f88[_0xefd9('0x17')],_0x4699b0);_0x5501bd(_0x6616d0[_0xefd9('0x14')](0x1f4,_0x405f88[_0xefd9('0x17')]));});});}; \ No newline at end of file +var _0x85ee=['../../config/logger','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','create','body','options','raw','stringify','where','attributes','limit','UpdateSquareReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2c8ec4,_0x514c1b){var _0xb59229=function(_0x114046){while(--_0x114046){_0x2c8ec4['push'](_0x2c8ec4['shift']());}};_0xb59229(++_0x514c1b);}(_0x85ee,0x19a));var _0xe85e=function(_0x18be8d,_0xb462e){_0x18be8d=_0x18be8d-0x0;var _0x109582=_0x85ee[_0x18be8d];return _0x109582;};'use strict';var _=require(_0xe85e('0x0'));var util=require('util');var moment=require(_0xe85e('0x1'));var BPromise=require('bluebird');var rs=require(_0xe85e('0x2'));var fs=require('fs');var Redis=require(_0xe85e('0x3'));var db=require(_0xe85e('0x4'))['db'];var utils=require(_0xe85e('0x5'));var logger=require(_0xe85e('0x6'))(_0xe85e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe85e('0x8')][_0xe85e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb00338,_0x59af07,_0x36944b){return new BPromise(function(_0x167286,_0x521f79){return client[_0xe85e('0xa')](_0xb00338,_0x36944b)[_0xe85e('0xb')](function(_0xc1abc){logger[_0xe85e('0xc')](_0xe85e('0xd'),_0x59af07,_0xe85e('0xe'));logger[_0xe85e('0xf')](_0xe85e('0x10'),_0x59af07,_0xe85e('0xe'),JSON['stringify'](_0xc1abc));if(_0xc1abc[_0xe85e('0x11')]){if(_0xc1abc[_0xe85e('0x11')][_0xe85e('0x12')]===0x1f4){logger['error'](_0xe85e('0xd'),_0x59af07,_0xc1abc[_0xe85e('0x11')][_0xe85e('0x13')]);return _0x521f79(_0xc1abc[_0xe85e('0x11')]['message']);}logger['error'](_0xe85e('0xd'),_0x59af07,_0xc1abc['error']['message']);return _0x167286(_0xc1abc[_0xe85e('0x11')][_0xe85e('0x13')]);}else{logger[_0xe85e('0xc')]('SquareReport,\x20%s,\x20%s',_0x59af07,'request\x20sent');_0x167286(_0xc1abc[_0xe85e('0x14')]['message']);}})[_0xe85e('0x15')](function(_0x21e47){logger[_0xe85e('0x11')](_0xe85e('0xd'),_0x59af07,_0x21e47);_0x521f79(_0x21e47);});});}exports[_0xe85e('0x16')]=function(_0x272593){var _0x33468b=this;return new Promise(function(_0x3315c2,_0x5106ae){return db['SquareReport'][_0xe85e('0x17')](_0x272593[_0xe85e('0x18')],{'raw':_0x272593[_0xe85e('0x19')]?_0x272593[_0xe85e('0x19')][_0xe85e('0x1a')]===undefined?!![]:![]:!![]})[_0xe85e('0xb')](function(_0x195bdb){logger[_0xe85e('0xc')](_0xe85e('0x16'),_0x272593);logger[_0xe85e('0xf')](_0xe85e('0x16'),_0x272593,JSON[_0xe85e('0x1b')](_0x195bdb));_0x3315c2(_0x195bdb);})[_0xe85e('0x15')](function(_0x552570){logger['error'](_0xe85e('0x16'),_0x552570[_0xe85e('0x13')],_0x272593);_0x5106ae(_0x33468b[_0xe85e('0x11')](0x1f4,_0x552570[_0xe85e('0x13')]));});});};exports['UpdateSquareReport']=function(_0x4226ce){var _0x4dcfae=this;return new Promise(function(_0x5578ca,_0x1816f6){return db['SquareReport']['update'](_0x4226ce[_0xe85e('0x18')],{'raw':_0x4226ce[_0xe85e('0x19')]?_0x4226ce[_0xe85e('0x19')][_0xe85e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4226ce[_0xe85e('0x19')]?_0x4226ce['options'][_0xe85e('0x1c')]||null:null,'attributes':_0x4226ce[_0xe85e('0x19')]?_0x4226ce['options'][_0xe85e('0x1d')]||null:null,'limit':_0x4226ce[_0xe85e('0x19')]?_0x4226ce[_0xe85e('0x19')][_0xe85e('0x1e')]||null:null})[_0xe85e('0xb')](function(_0x485c93){logger[_0xe85e('0xc')](_0xe85e('0x1f'),_0x4226ce);logger[_0xe85e('0xf')](_0xe85e('0x1f'),_0x4226ce,JSON[_0xe85e('0x1b')](_0x485c93));_0x5578ca(_0x485c93);})['catch'](function(_0x4ebb7f){logger[_0xe85e('0x11')](_0xe85e('0x1f'),_0x4ebb7f['message'],_0x4226ce);_0x1816f6(_0x4dcfae[_0xe85e('0x11')](0x1f4,_0x4ebb7f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 40045ae..91e48e7 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 _0xf0cc=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','describe','show','post','update','delete','/:id','exports'];(function(_0x360e8c,_0x29cac0){var _0x37c789=function(_0x317493){while(--_0x317493){_0x360e8c['push'](_0x360e8c['shift']());}};_0x37c789(++_0x29cac0);}(_0xf0cc,0x19e));var _0xcf0c=function(_0x1c3c24,_0x3e014b){_0x1c3c24=_0x1c3c24-0x0;var _0x24f75d=_0xf0cc[_0x1c3c24];return _0x24f75d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcf0c('0x0'));var express=require(_0xcf0c('0x1'));var router=express[_0xcf0c('0x2')]();var fs_extra=require(_0xcf0c('0x3'));var auth=require(_0xcf0c('0x4'));var interaction=require(_0xcf0c('0x5'));var config=require(_0xcf0c('0x6'));var controller=require(_0xcf0c('0x7'));router[_0xcf0c('0x8')]('/',auth[_0xcf0c('0x9')](),controller['index']);router[_0xcf0c('0x8')](_0xcf0c('0xa'),auth[_0xcf0c('0x9')](),controller[_0xcf0c('0xb')]);router[_0xcf0c('0x8')]('/:id',auth[_0xcf0c('0x9')](),controller[_0xcf0c('0xc')]);router[_0xcf0c('0xd')]('/',auth[_0xcf0c('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcf0c('0xe')]);router[_0xcf0c('0xf')](_0xcf0c('0x10'),auth[_0xcf0c('0x9')](),controller['destroy']);module[_0xcf0c('0x11')]=router; \ No newline at end of file +var _0x9e9c=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe','/:id','show','create','put','update','delete'];(function(_0x37257e,_0x4415ca){var _0x2eca67=function(_0x280736){while(--_0x280736){_0x37257e['push'](_0x37257e['shift']());}};_0x2eca67(++_0x4415ca);}(_0x9e9c,0x66));var _0xc9e9=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x9e9c[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0xc9e9('0x0'));var util=require('util');var path=require(_0xc9e9('0x1'));var timeout=require(_0xc9e9('0x2'));var express=require('express');var router=express[_0xc9e9('0x3')]();var fs_extra=require(_0xc9e9('0x4'));var auth=require(_0xc9e9('0x5'));var interaction=require(_0xc9e9('0x6'));var config=require(_0xc9e9('0x7'));var controller=require(_0xc9e9('0x8'));router['get']('/',auth[_0xc9e9('0x9')](),controller['index']);router[_0xc9e9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xc9e9('0xb')]);router['get'](_0xc9e9('0xc'),auth[_0xc9e9('0x9')](),controller[_0xc9e9('0xd')]);router['post']('/',auth[_0xc9e9('0x9')](),controller[_0xc9e9('0xe')]);router[_0xc9e9('0xf')](_0xc9e9('0xc'),auth['isAuthenticated'](),controller[_0xc9e9('0x10')]);router[_0xc9e9('0x11')](_0xc9e9('0xc'),auth[_0xc9e9('0x9')](),controller[_0xc9e9('0x12')]);module[_0xc9e9('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 4ab9af9..26bdc15 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 _0xa3e5=['TEXT','sequelize','STRING'];(function(_0x15e62a,_0xb3a95f){var _0x5d408c=function(_0x49614a){while(--_0x49614a){_0x15e62a['push'](_0x15e62a['shift']());}};_0x5d408c(++_0xb3a95f);}(_0xa3e5,0x17e));var _0x5a3e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa3e5[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x5a3e('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5a3e('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5a3e('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5a3e('0x1')]}}; \ No newline at end of file +var _0x446b=['sequelize','exports','STRING'];(function(_0xfb44c0,_0x122534){var _0x4a7536=function(_0x3f108f){while(--_0x3f108f){_0xfb44c0['push'](_0xfb44c0['shift']());}};_0x4a7536(++_0x122534);}(_0x446b,0x12c));var _0xb446=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x446b[_0x18afca];return _0x11603f;};'use strict';var Sequelize=require(_0xb446('0x0'));module[_0xb446('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xb446('0x2')]},'application':{'type':Sequelize[_0xb446('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xb446('0x2')]},'callerid':{'type':Sequelize[_0xb446('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d2931eb..067e3fd 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 _0xd4b8=['fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','includeAll','findAll','rows','catch','show','keys','include','find','create','body','update','destroy','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','intersection','attributes'];(function(_0x206ee0,_0x505fe4){var _0x5cdd10=function(_0x35df2d){while(--_0x35df2d){_0x206ee0['push'](_0x206ee0['shift']());}};_0x5cdd10(++_0x505fe4);}(_0xd4b8,0x67));var _0x8d4b=function(_0x4b4a1f,_0x3f64b9){_0x4b4a1f=_0x4b4a1f-0x0;var _0x58a307=_0xd4b8[_0x4b4a1f];return _0x58a307;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8d4b('0x0'));var jsonpatch=require(_0x8d4b('0x1'));var rp=require(_0x8d4b('0x2'));var moment=require(_0x8d4b('0x3'));var BPromise=require(_0x8d4b('0x4'));var Mustache=require(_0x8d4b('0x5'));var util=require(_0x8d4b('0x6'));var path=require(_0x8d4b('0x7'));var sox=require(_0x8d4b('0x8'));var csv=require('to-csv');var ejs=require(_0x8d4b('0x9'));var fs=require('fs');var fs_extra=require(_0x8d4b('0xa'));var _=require(_0x8d4b('0xb'));var squel=require(_0x8d4b('0xc'));var crypto=require('crypto');var jsforce=require(_0x8d4b('0xd'));var deskjs=require(_0x8d4b('0xe'));var toCsv=require(_0x8d4b('0xf'));var querystring=require(_0x8d4b('0x10'));var Papa=require(_0x8d4b('0x11'));var Redis=require(_0x8d4b('0x12'));var authService=require(_0x8d4b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8d4b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d4b('0x15'))(_0x8d4b('0x16'));var utils=require('../../config/utils');var config=require(_0x8d4b('0x17'));var licenseUtil=require(_0x8d4b('0x18'));var db=require(_0x8d4b('0x19'))['db'];function respondWithStatusCode(_0x60ec34,_0x2cb917){_0x2cb917=_0x2cb917||0xcc;return function(_0x143d33){if(_0x143d33){return _0x60ec34[_0x8d4b('0x1a')](_0x2cb917);}return _0x60ec34[_0x8d4b('0x1b')](_0x2cb917)[_0x8d4b('0x1c')]();};}function respondWithResult(_0x966a44,_0x569361){_0x569361=_0x569361||0xc8;return function(_0x3c1541){if(_0x3c1541){return _0x966a44[_0x8d4b('0x1b')](_0x569361)[_0x8d4b('0x1d')](_0x3c1541);}};}function respondWithFilteredResult(_0x545d0a,_0x537a71){return function(_0x393c5f){if(_0x393c5f){var _0x41fb71=typeof _0x537a71[_0x8d4b('0x1e')]===_0x8d4b('0x1f')&&typeof _0x537a71[_0x8d4b('0x20')]===_0x8d4b('0x1f');var _0x268bea=_0x393c5f[_0x8d4b('0x21')];var _0x548246=_0x41fb71?0x0:_0x537a71[_0x8d4b('0x1e')];var _0x40bac9=_0x41fb71?_0x393c5f[_0x8d4b('0x21')]:_0x537a71[_0x8d4b('0x1e')]+_0x537a71[_0x8d4b('0x20')];var _0x58d39f;if(_0x40bac9>=_0x268bea){_0x40bac9=_0x268bea;_0x58d39f=0xc8;}else{_0x58d39f=0xce;}_0x545d0a['status'](_0x58d39f);return _0x545d0a['set'](_0x8d4b('0x22'),_0x548246+'-'+_0x40bac9+'/'+_0x268bea)[_0x8d4b('0x1d')](_0x393c5f);}return null;};}function patchUpdates(_0x3edef7){return function(_0x5e8211){try{jsonpatch[_0x8d4b('0x23')](_0x5e8211,_0x3edef7,!![]);}catch(_0x5462fa){return BPromise[_0x8d4b('0x24')](_0x5462fa);}return _0x5e8211[_0x8d4b('0x25')]();};}function saveUpdates(_0x1cba1c,_0x5e6ca9){return function(_0x300cb9){if(_0x300cb9){return _0x300cb9['update'](_0x1cba1c)[_0x8d4b('0x26')](function(_0x11c77d){return _0x11c77d;});}return null;};}function removeEntity(_0xc71cff,_0x31eb10){return function(_0x570c35){if(_0x570c35){return _0x570c35['destroy']()[_0x8d4b('0x26')](function(){_0xc71cff['status'](0xcc)[_0x8d4b('0x1c')]();});}};}function handleEntityNotFound(_0x3b1510,_0x54a962){return function(_0x1e0df4){if(!_0x1e0df4){_0x3b1510['sendStatus'](0x194);}return _0x1e0df4;};}function handleError(_0x567527,_0x139e7b){_0x139e7b=_0x139e7b||0x1f4;return function(_0x515b04){logger[_0x8d4b('0x27')](_0x515b04[_0x8d4b('0x28')]);if(_0x515b04[_0x8d4b('0x29')]){delete _0x515b04[_0x8d4b('0x29')];}_0x567527[_0x8d4b('0x1b')](_0x139e7b)[_0x8d4b('0x2a')](_0x515b04);};}exports['index']=function(_0xdabf6b,_0x2709bb){var _0x55e838={},_0x4320bd={},_0x1b7ce8={'count':0x0,'rows':[]};var _0x2abb00=_[_0x8d4b('0x2b')](db['SquareDetailsReport'][_0x8d4b('0x2c')],function(_0x4f379b){return{'name':_0x4f379b[_0x8d4b('0x2d')],'type':_0x4f379b[_0x8d4b('0x2e')]['key']};});_0x4320bd[_0x8d4b('0x2f')]=_[_0x8d4b('0x2b')](_0x2abb00,_0x8d4b('0x29'));_0x4320bd[_0x8d4b('0x30')]=_['keys'](_0xdabf6b[_0x8d4b('0x30')]);_0x4320bd['filters']=_[_0x8d4b('0x31')](_0x4320bd['model'],_0x4320bd['query']);_0x55e838[_0x8d4b('0x32')]=_['intersection'](_0x4320bd[_0x8d4b('0x2f')],qs[_0x8d4b('0x33')](_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x33')]));_0x55e838[_0x8d4b('0x32')]=_0x55e838[_0x8d4b('0x32')][_0x8d4b('0x34')]?_0x55e838[_0x8d4b('0x32')]:_0x4320bd[_0x8d4b('0x2f')];if(!_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x35')]('nolimit')){_0x55e838[_0x8d4b('0x20')]=qs[_0x8d4b('0x20')](_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x20')]);_0x55e838[_0x8d4b('0x1e')]=qs[_0x8d4b('0x1e')](_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x1e')]);}_0x55e838['order']=qs[_0x8d4b('0x36')](_0xdabf6b[_0x8d4b('0x30')]['sort']);_0x55e838[_0x8d4b('0x37')]=qs[_0x8d4b('0x38')](_[_0x8d4b('0x39')](_0xdabf6b['query'],_0x4320bd[_0x8d4b('0x38')]),_0x2abb00);if(_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x3a')]){_0x55e838[_0x8d4b('0x37')]=_[_0x8d4b('0x3b')](_0x55e838['where'],{'$or':_[_0x8d4b('0x2b')](_0x2abb00,function(_0x2c4c28){if(_0x2c4c28[_0x8d4b('0x2e')]!==_0x8d4b('0x3c')){var _0x5cf10c={};_0x5cf10c[_0x2c4c28[_0x8d4b('0x29')]]={'$like':'%'+_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x3a')]+'%'};return _0x5cf10c;}})});}_0x55e838=_[_0x8d4b('0x3b')]({},_0x55e838,_0xdabf6b[_0x8d4b('0x3d')]);var _0x3938e3={'where':_0x55e838[_0x8d4b('0x37')]};return db[_0x8d4b('0x3e')][_0x8d4b('0x21')](_0x3938e3)[_0x8d4b('0x26')](function(_0x21b97c){_0x1b7ce8['count']=_0x21b97c;if(_0xdabf6b[_0x8d4b('0x30')][_0x8d4b('0x3f')]){_0x55e838['include']=[{'all':!![]}];}return db[_0x8d4b('0x3e')][_0x8d4b('0x40')](_0x55e838);})[_0x8d4b('0x26')](function(_0x230394){_0x1b7ce8[_0x8d4b('0x41')]=_0x230394;return _0x1b7ce8;})[_0x8d4b('0x26')](respondWithFilteredResult(_0x2709bb,_0x55e838))[_0x8d4b('0x42')](handleError(_0x2709bb,null));};exports[_0x8d4b('0x43')]=function(_0x507dbc,_0x29f307){var _0x382b05={'raw':!![],'where':{'id':_0x507dbc['params']['id']}},_0x30cb54={};_0x30cb54['model']=_[_0x8d4b('0x44')](db[_0x8d4b('0x3e')]['rawAttributes']);_0x30cb54[_0x8d4b('0x30')]=_[_0x8d4b('0x44')](_0x507dbc[_0x8d4b('0x30')]);_0x30cb54[_0x8d4b('0x38')]=_[_0x8d4b('0x31')](_0x30cb54[_0x8d4b('0x2f')],_0x30cb54[_0x8d4b('0x30')]);_0x382b05[_0x8d4b('0x32')]=_[_0x8d4b('0x31')](_0x30cb54[_0x8d4b('0x2f')],qs[_0x8d4b('0x33')](_0x507dbc[_0x8d4b('0x30')][_0x8d4b('0x33')]));_0x382b05[_0x8d4b('0x32')]=_0x382b05[_0x8d4b('0x32')][_0x8d4b('0x34')]?_0x382b05[_0x8d4b('0x32')]:_0x30cb54['model'];if(_0x507dbc[_0x8d4b('0x30')][_0x8d4b('0x3f')]){_0x382b05[_0x8d4b('0x45')]=[{'all':!![]}];}_0x382b05=_['merge']({},_0x382b05,_0x507dbc[_0x8d4b('0x3d')]);return db['SquareDetailsReport'][_0x8d4b('0x46')](_0x382b05)['then'](handleEntityNotFound(_0x29f307,null))[_0x8d4b('0x26')](respondWithResult(_0x29f307,null))['catch'](handleError(_0x29f307,null));};exports[_0x8d4b('0x47')]=function(_0x38b972,_0x56db3c){return db[_0x8d4b('0x3e')][_0x8d4b('0x47')](_0x38b972[_0x8d4b('0x48')],{})['then'](respondWithResult(_0x56db3c,0xc9))[_0x8d4b('0x42')](handleError(_0x56db3c,null));};exports[_0x8d4b('0x49')]=function(_0x500886,_0x46b5f1){if(_0x500886['body']['id']){delete _0x500886['body']['id'];}return db[_0x8d4b('0x3e')][_0x8d4b('0x46')]({'where':{'id':_0x500886['params']['id']}})[_0x8d4b('0x26')](handleEntityNotFound(_0x46b5f1,null))[_0x8d4b('0x26')](saveUpdates(_0x500886[_0x8d4b('0x48')],null))[_0x8d4b('0x26')](respondWithResult(_0x46b5f1,null))[_0x8d4b('0x42')](handleError(_0x46b5f1,null));};exports[_0x8d4b('0x4a')]=function(_0x38b776,_0x59a358){return db[_0x8d4b('0x3e')][_0x8d4b('0x46')]({'where':{'id':_0x38b776[_0x8d4b('0x4b')]['id']}})[_0x8d4b('0x26')](handleEntityNotFound(_0x59a358,null))[_0x8d4b('0x26')](removeEntity(_0x59a358,null))[_0x8d4b('0x42')](handleError(_0x59a358,null));};exports[_0x8d4b('0x4c')]=function(_0x27b183,_0x4485e0){return db[_0x8d4b('0x3e')][_0x8d4b('0x4c')]()[_0x8d4b('0x26')](respondWithResult(_0x4485e0,null))[_0x8d4b('0x42')](handleError(_0x4485e0,null));}; \ No newline at end of file +var _0xb79b=['includeAll','include','find','body','catch','describe','eml-format','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','show','params','filters','length'];(function(_0x2f97aa,_0x4790a9){var _0x9471d5=function(_0x8fab25){while(--_0x8fab25){_0x2f97aa['push'](_0x2f97aa['shift']());}};_0x9471d5(++_0x4790a9);}(_0xb79b,0x126));var _0xbb79=function(_0x197df0,_0x4a9a64){_0x197df0=_0x197df0-0x0;var _0x10a925=_0xb79b[_0x197df0];return _0x10a925;};'use strict';var emlformat=require(_0xbb79('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbb79('0x1'));var BPromise=require(_0xbb79('0x2'));var Mustache=require('mustache');var util=require(_0xbb79('0x3'));var path=require('path');var sox=require(_0xbb79('0x4'));var csv=require(_0xbb79('0x5'));var ejs=require(_0xbb79('0x6'));var fs=require('fs');var fs_extra=require(_0xbb79('0x7'));var _=require('lodash');var squel=require(_0xbb79('0x8'));var crypto=require('crypto');var jsforce=require(_0xbb79('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xbb79('0x5'));var querystring=require(_0xbb79('0xa'));var Papa=require(_0xbb79('0xb'));var Redis=require('ioredis');var authService=require(_0xbb79('0xc'));var qs=require(_0xbb79('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb79('0xe'));var logger=require(_0xbb79('0xf'))(_0xbb79('0x10'));var utils=require(_0xbb79('0x11'));var config=require(_0xbb79('0x12'));var licenseUtil=require(_0xbb79('0x13'));var db=require(_0xbb79('0x14'))['db'];function respondWithStatusCode(_0x30a761,_0x452b6e){_0x452b6e=_0x452b6e||0xcc;return function(_0x57ff25){if(_0x57ff25){return _0x30a761[_0xbb79('0x15')](_0x452b6e);}return _0x30a761[_0xbb79('0x16')](_0x452b6e)[_0xbb79('0x17')]();};}function respondWithResult(_0x577ca0,_0x32e63b){_0x32e63b=_0x32e63b||0xc8;return function(_0x13e3be){if(_0x13e3be){return _0x577ca0['status'](_0x32e63b)[_0xbb79('0x18')](_0x13e3be);}};}function respondWithFilteredResult(_0x687658,_0x548b0a){return function(_0x2571d1){if(_0x2571d1){var _0x54f162=typeof _0x548b0a[_0xbb79('0x19')]===_0xbb79('0x1a')&&typeof _0x548b0a[_0xbb79('0x1b')]===_0xbb79('0x1a');var _0x4fc3d3=_0x2571d1['count'];var _0x1a83ea=_0x54f162?0x0:_0x548b0a[_0xbb79('0x19')];var _0x19f42f=_0x54f162?_0x2571d1[_0xbb79('0x1c')]:_0x548b0a[_0xbb79('0x19')]+_0x548b0a['limit'];var _0x9cb1a1;if(_0x19f42f>=_0x4fc3d3){_0x19f42f=_0x4fc3d3;_0x9cb1a1=0xc8;}else{_0x9cb1a1=0xce;}_0x687658[_0xbb79('0x16')](_0x9cb1a1);return _0x687658[_0xbb79('0x1d')](_0xbb79('0x1e'),_0x1a83ea+'-'+_0x19f42f+'/'+_0x4fc3d3)[_0xbb79('0x18')](_0x2571d1);}return null;};}function patchUpdates(_0x21cff8){return function(_0x290d1e){try{jsonpatch[_0xbb79('0x1f')](_0x290d1e,_0x21cff8,!![]);}catch(_0x1c58a){return BPromise['reject'](_0x1c58a);}return _0x290d1e[_0xbb79('0x20')]();};}function saveUpdates(_0x54ff63,_0xc39839){return function(_0x4539cd){if(_0x4539cd){return _0x4539cd[_0xbb79('0x21')](_0x54ff63)['then'](function(_0xde8b7c){return _0xde8b7c;});}return null;};}function removeEntity(_0x27b956,_0x1c50e4){return function(_0x3e4e5a){if(_0x3e4e5a){return _0x3e4e5a[_0xbb79('0x22')]()[_0xbb79('0x23')](function(){_0x27b956[_0xbb79('0x16')](0xcc)[_0xbb79('0x17')]();});}};}function handleEntityNotFound(_0x2853e5,_0x3e11d8){return function(_0x51c73a){if(!_0x51c73a){_0x2853e5[_0xbb79('0x15')](0x194);}return _0x51c73a;};}function handleError(_0xa9945d,_0x81343c){_0x81343c=_0x81343c||0x1f4;return function(_0x142899){logger[_0xbb79('0x24')](_0x142899[_0xbb79('0x25')]);if(_0x142899[_0xbb79('0x26')]){delete _0x142899[_0xbb79('0x26')];}_0xa9945d[_0xbb79('0x16')](_0x81343c)['send'](_0x142899);};}exports[_0xbb79('0x27')]=function(_0x47dfc5,_0x166a59){var _0xe49213={},_0x53a719={},_0x76c29c={'count':0x0,'rows':[]};var _0x59364c=_[_0xbb79('0x28')](db[_0xbb79('0x29')][_0xbb79('0x2a')],function(_0x473e55){return{'name':_0x473e55[_0xbb79('0x2b')],'type':_0x473e55[_0xbb79('0x2c')][_0xbb79('0x2d')]};});_0x53a719[_0xbb79('0x2e')]=_[_0xbb79('0x28')](_0x59364c,'name');_0x53a719['query']=_[_0xbb79('0x2f')](_0x47dfc5[_0xbb79('0x30')]);_0x53a719['filters']=_['intersection'](_0x53a719[_0xbb79('0x2e')],_0x53a719[_0xbb79('0x30')]);_0xe49213[_0xbb79('0x31')]=_[_0xbb79('0x32')](_0x53a719['model'],qs['fields'](_0x47dfc5['query'][_0xbb79('0x33')]));_0xe49213[_0xbb79('0x31')]=_0xe49213[_0xbb79('0x31')]['length']?_0xe49213[_0xbb79('0x31')]:_0x53a719['model'];if(!_0x47dfc5['query'][_0xbb79('0x34')](_0xbb79('0x35'))){_0xe49213[_0xbb79('0x1b')]=qs['limit'](_0x47dfc5[_0xbb79('0x30')][_0xbb79('0x1b')]);_0xe49213['offset']=qs[_0xbb79('0x19')](_0x47dfc5[_0xbb79('0x30')][_0xbb79('0x19')]);}_0xe49213[_0xbb79('0x36')]=qs['sort'](_0x47dfc5[_0xbb79('0x30')][_0xbb79('0x37')]);_0xe49213[_0xbb79('0x38')]=qs['filters'](_[_0xbb79('0x39')](_0x47dfc5[_0xbb79('0x30')],_0x53a719['filters']),_0x59364c);if(_0x47dfc5[_0xbb79('0x30')][_0xbb79('0x3a')]){_0xe49213[_0xbb79('0x38')]=_[_0xbb79('0x3b')](_0xe49213[_0xbb79('0x38')],{'$or':_[_0xbb79('0x28')](_0x59364c,function(_0xab0dcb){if(_0xab0dcb[_0xbb79('0x2c')]!=='VIRTUAL'){var _0x4b4267={};_0x4b4267[_0xab0dcb[_0xbb79('0x26')]]={'$like':'%'+_0x47dfc5['query'][_0xbb79('0x3a')]+'%'};return _0x4b4267;}})});}_0xe49213=_[_0xbb79('0x3b')]({},_0xe49213,_0x47dfc5[_0xbb79('0x3c')]);var _0x578ff0={'where':_0xe49213['where']};return db[_0xbb79('0x29')]['count'](_0x578ff0)[_0xbb79('0x23')](function(_0x5095a8){_0x76c29c[_0xbb79('0x1c')]=_0x5095a8;if(_0x47dfc5[_0xbb79('0x30')]['includeAll']){_0xe49213['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0xbb79('0x3d')](_0xe49213);})[_0xbb79('0x23')](function(_0x3fd98e){_0x76c29c['rows']=_0x3fd98e;return _0x76c29c;})[_0xbb79('0x23')](respondWithFilteredResult(_0x166a59,_0xe49213))['catch'](handleError(_0x166a59,null));};exports[_0xbb79('0x3e')]=function(_0x4f87d9,_0x18f6e1){var _0x756c60={'raw':!![],'where':{'id':_0x4f87d9[_0xbb79('0x3f')]['id']}},_0x1b21f9={};_0x1b21f9[_0xbb79('0x2e')]=_['keys'](db[_0xbb79('0x29')][_0xbb79('0x2a')]);_0x1b21f9[_0xbb79('0x30')]=_[_0xbb79('0x2f')](_0x4f87d9[_0xbb79('0x30')]);_0x1b21f9[_0xbb79('0x40')]=_[_0xbb79('0x32')](_0x1b21f9[_0xbb79('0x2e')],_0x1b21f9['query']);_0x756c60[_0xbb79('0x31')]=_[_0xbb79('0x32')](_0x1b21f9[_0xbb79('0x2e')],qs['fields'](_0x4f87d9['query'][_0xbb79('0x33')]));_0x756c60[_0xbb79('0x31')]=_0x756c60['attributes'][_0xbb79('0x41')]?_0x756c60[_0xbb79('0x31')]:_0x1b21f9['model'];if(_0x4f87d9[_0xbb79('0x30')][_0xbb79('0x42')]){_0x756c60[_0xbb79('0x43')]=[{'all':!![]}];}_0x756c60=_[_0xbb79('0x3b')]({},_0x756c60,_0x4f87d9['options']);return db[_0xbb79('0x29')][_0xbb79('0x44')](_0x756c60)[_0xbb79('0x23')](handleEntityNotFound(_0x18f6e1,null))[_0xbb79('0x23')](respondWithResult(_0x18f6e1,null))['catch'](handleError(_0x18f6e1,null));};exports['create']=function(_0x38989e,_0x10c276){return db[_0xbb79('0x29')]['create'](_0x38989e[_0xbb79('0x45')],{})['then'](respondWithResult(_0x10c276,0xc9))[_0xbb79('0x46')](handleError(_0x10c276,null));};exports['update']=function(_0xa57394,_0x2023e3){if(_0xa57394[_0xbb79('0x45')]['id']){delete _0xa57394[_0xbb79('0x45')]['id'];}return db[_0xbb79('0x29')][_0xbb79('0x44')]({'where':{'id':_0xa57394['params']['id']}})[_0xbb79('0x23')](handleEntityNotFound(_0x2023e3,null))[_0xbb79('0x23')](saveUpdates(_0xa57394[_0xbb79('0x45')],null))[_0xbb79('0x23')](respondWithResult(_0x2023e3,null))['catch'](handleError(_0x2023e3,null));};exports[_0xbb79('0x22')]=function(_0x1e8b74,_0x44b1bd){return db[_0xbb79('0x29')][_0xbb79('0x44')]({'where':{'id':_0x1e8b74['params']['id']}})[_0xbb79('0x23')](handleEntityNotFound(_0x44b1bd,null))['then'](removeEntity(_0x44b1bd,null))[_0xbb79('0x46')](handleError(_0x44b1bd,null));};exports['describe']=function(_0x555cea,_0x52cfcf){return db[_0xbb79('0x29')][_0xbb79('0x47')]()[_0xbb79('0x23')](respondWithResult(_0x52cfcf,null))['catch'](handleError(_0x52cfcf,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 17bab9a..8cee975 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 _0x7ca5=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','lodash'];(function(_0x870b62,_0x2143f9){var _0x2dcb39=function(_0x2fb63d){while(--_0x2fb63d){_0x870b62['push'](_0x870b62['shift']());}};_0x2dcb39(++_0x2143f9);}(_0x7ca5,0x112));var _0x57ca=function(_0xe7c76,_0x18c15a){_0xe7c76=_0xe7c76-0x0;var _0x4c28be=_0x7ca5[_0xe7c76];return _0x4c28be;};'use strict';var _=require(_0x57ca('0x0'));var util=require(_0x57ca('0x1'));var logger=require(_0x57ca('0x2'))('api');var moment=require(_0x57ca('0x3'));var BPromise=require(_0x57ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57ca('0x5'));var rimraf=require(_0x57ca('0x6'));var config=require(_0x57ca('0x7'));var attributes=require(_0x57ca('0x8'));module[_0x57ca('0x9')]=function(_0x247719,_0x5b57a2){return _0x247719[_0x57ca('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc3=['SquareDetailsReport','report_square_details','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xfbc3,0xf2));var _0x3fbc=function(_0xb267f6,_0x5f4501){_0xb267f6=_0xb267f6-0x0;var _0x18d026=_0xfbc3[_0xb267f6];return _0x18d026;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3fbc('0x0'));var moment=require(_0x3fbc('0x1'));var BPromise=require('bluebird');var rp=require(_0x3fbc('0x2'));var fs=require('fs');var path=require(_0x3fbc('0x3'));var rimraf=require(_0x3fbc('0x4'));var config=require(_0x3fbc('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0x3fbc('0x6')]=function(_0x584a3c,_0x1dd067){return _0x584a3c[_0x3fbc('0x7')](_0x3fbc('0x8'),attributes,{'tableName':_0x3fbc('0x9'),'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 f645eec..f88f900 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','util','moment'];(function(_0x28d388,_0x15a4f8){var _0x452ddc=function(_0x545d53){while(--_0x545d53){_0x28d388['push'](_0x28d388['shift']());}};_0x452ddc(++_0x15a4f8);}(_0xda2d,0x102));var _0xdda2=function(_0x303aeb,_0x377170){_0x303aeb=_0x303aeb-0x0;var _0x3310b5=_0xda2d[_0x303aeb];return _0x3310b5;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')](_0x1a3b35[_0xdda2('0x17')],{'raw':_0x1a3b35[_0xdda2('0x18')]?_0x1a3b35[_0xdda2('0x18')][_0xdda2('0x19')]===undefined?!![]:![]:!![]})[_0xdda2('0xa')](function(_0x4eed30){logger[_0xdda2('0x12')]('CreateSquareDetailsReport',_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON[_0xdda2('0xf')](_0x4eed30));_0x2b6ee8(_0x4eed30);})['catch'](function(_0x347ee6){logger['error'](_0xdda2('0x14'),_0x347ee6[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5['error'](0x1f4,_0x347ee6[_0xdda2('0x11')]));});});}; \ No newline at end of file +var _0x1775=['code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x11f3c9,_0x21fe37){var _0x3ff1e2=function(_0x5a3501){while(--_0x5a3501){_0x11f3c9['push'](_0x11f3c9['shift']());}};_0x3ff1e2(++_0x21fe37);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ac1c6,_0x300b43,_0x245c12){return new BPromise(function(_0x363611,_0x3ce288){return client[_0x5177('0xd')](_0x2ac1c6,_0x245c12)[_0x5177('0xe')](function(_0x2c23d8){logger[_0x5177('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x300b43,'request\x20sent');logger[_0x5177('0x10')](_0x5177('0x11'),_0x300b43,_0x5177('0x12'),JSON[_0x5177('0x13')](_0x2c23d8));if(_0x2c23d8[_0x5177('0x14')]){if(_0x2c23d8['error'][_0x5177('0x15')]===0x1f4){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x3ce288(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);return _0x363611(_0x2c23d8[_0x5177('0x14')][_0x5177('0x17')]);}else{logger[_0x5177('0xf')](_0x5177('0x16'),_0x300b43,_0x5177('0x12'));_0x363611(_0x2c23d8[_0x5177('0x18')][_0x5177('0x17')]);}})[_0x5177('0x19')](function(_0x50ce2c){logger[_0x5177('0x14')](_0x5177('0x16'),_0x300b43,_0x50ce2c);_0x3ce288(_0x50ce2c);});});}exports[_0x5177('0x1a')]=function(_0x1b4102){var _0x5f5bd4=this;return new Promise(function(_0x3e6944,_0x2ebf91){return db[_0x5177('0x1b')]['create'](_0x1b4102[_0x5177('0x1c')],{'raw':_0x1b4102['options']?_0x1b4102[_0x5177('0x1d')][_0x5177('0x1e')]===undefined?!![]:![]:!![]})[_0x5177('0xe')](function(_0x27b732){logger[_0x5177('0xf')](_0x5177('0x1a'),_0x1b4102);logger[_0x5177('0x10')](_0x5177('0x1a'),_0x1b4102,JSON[_0x5177('0x13')](_0x27b732));_0x3e6944(_0x27b732);})[_0x5177('0x19')](function(_0x23dad2){logger[_0x5177('0x14')]('CreateSquareDetailsReport',_0x23dad2[_0x5177('0x17')],_0x1b4102);_0x2ebf91(_0x5f5bd4['error'](0x1f4,_0x23dad2[_0x5177('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b3f589e..b138e3d 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 _0xf5a3=['get','isAuthenticated','killProcess','exports','Router','./system.controller'];(function(_0x31103f,_0xf26653){var _0x234c2f=function(_0x1270ef){while(--_0x1270ef){_0x31103f['push'](_0x31103f['shift']());}};_0x234c2f(++_0xf26653);}(_0xf5a3,0x1a2));var _0x3f5a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf5a3[_0x4e676e];return _0x336a3c;};'use strict';var express=require('express');var router=express[_0x3f5a('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x3f5a('0x1'));router[_0x3f5a('0x2')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/process/:pid/kill',auth[_0x3f5a('0x3')](),controller[_0x3f5a('0x4')]);module[_0x3f5a('0x5')]=router; \ No newline at end of file +var _0x2f9d=['isAuthenticated','killProcess','exports','express','../../components/auth/service','./system.controller','get','/process/:pid/kill'];(function(_0x58dd18,_0x4e6fa0){var _0x1bc723=function(_0x14fedf){while(--_0x14fedf){_0x58dd18['push'](_0x58dd18['shift']());}};_0x1bc723(++_0x4e6fa0);}(_0x2f9d,0x9b));var _0xd2f9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2f9d[_0x502c7d];return _0x30b7ed;};'use strict';var express=require(_0xd2f9('0x0'));var router=express['Router']();var auth=require(_0xd2f9('0x1'));var controller=require(_0xd2f9('0x2'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd2f9('0x3')](_0xd2f9('0x4'),auth[_0xd2f9('0x5')](),controller[_0xd2f9('0x6')]);module[_0xd2f9('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 2630a8c..8d8f9ec 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 _0x3e36=['killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','pid','kill','catch','systeminformation','exec','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json'];(function(_0x43446b,_0x54a77e){var _0x2a6178=function(_0x2889b7){while(--_0x2889b7){_0x43446b['push'](_0x43446b['shift']());}};_0x2a6178(++_0x54a77e);}(_0x3e36,0x142));var _0x63e3=function(_0x25bc65,_0x585165){_0x25bc65=_0x25bc65-0x0;var _0x415357=_0x3e36[_0x25bc65];return _0x415357;};'use strict';var info=require(_0x63e3('0x0'));var exec=require('child_process')[_0x63e3('0x1')];var logger=require('../../config/logger')(_0x63e3('0x2'));var util=require(_0x63e3('0x3'));var BPromise=require(_0x63e3('0x4'));var _=require(_0x63e3('0x5'));function handleError(_0x14218c,_0x5e763b,_0x52d294){_0x5e763b=_0x5e763b||0x1f4;return function(_0x2e9e69){logger[_0x63e3('0x6')](_0x63e3('0x7'),_0x52d294,_0x5e763b,util[_0x63e3('0x8')](_0x2e9e69,{'showHidden':![],'depth':null}));delete _0x2e9e69[_0x63e3('0x9')];_0x14218c[_0x63e3('0xa')](_0x5e763b)[_0x63e3('0xb')](_0x2e9e69);};}exports[_0x63e3('0xc')]=function(_0x3cc0f0,_0x589434){return info[_0x63e3('0xd')]()[_0x63e3('0xe')](function(_0x143a04){return _0x589434['status'](0xc8)['json'](_0x143a04);})['catch'](function(_0x4bab00){return _0x589434['status'](0x1f4)[_0x63e3('0xf')](_0x4bab00);});};exports[_0x63e3('0x10')]=function(_0x8a51c,_0x225a27){var _0x36a891=[_0x63e3('0x11')];return new BPromise(function(_0x4d7fdf,_0x57c60d){return exec(util[_0x63e3('0x12')](_0x63e3('0x13'),_0x8a51c[_0x63e3('0x14')]['pid']),function(_0x2dd322,_0x1bc31a,_0xfed921){if(_0x2dd322){return _0x57c60d(_0x2dd322);}return _0x4d7fdf(_0x1bc31a);});})[_0x63e3('0xe')](function(_0x101cc8){var _0x5ac11e=![];var _0x2154ab=_0x101cc8['split'](/\n/);for(var _0x348278=0x0,_0x51b2f1=_0x36a891[_0x63e3('0x15')];_0x348278<_0x51b2f1,_0x5ac11e===![];_0x348278+=0x1){if(_0x101cc8[_0x63e3('0x16')](_0x36a891[_0x348278])>=0x0){_0x5ac11e=!![];}}if(!_0x5ac11e){throw new Error(util[_0x63e3('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x8a51c[_0x63e3('0x14')][_0x63e3('0x17')]));}process[_0x63e3('0x18')](_0x8a51c['params'][_0x63e3('0x17')],'SIGINT');return _0x225a27[_0x63e3('0xa')](0xc8)['json']({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x8a51c[_0x63e3('0x14')][_0x63e3('0x17')])});})[_0x63e3('0x19')](handleError(_0x225a27,null,_0x63e3('0x10')));}; \ No newline at end of file +var _0x9dd8=['then','json','catch','components/import/cm','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','inspect','name','status','send','index','getAllData'];(function(_0x4084e9,_0x4557fb){var _0x45b452=function(_0xf6adce){while(--_0xf6adce){_0x4084e9['push'](_0x4084e9['shift']());}};_0x45b452(++_0x4557fb);}(_0x9dd8,0x17a));var _0x89dd=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x9dd8[_0xda464c];return _0x19e222;};'use strict';var info=require(_0x89dd('0x0'));var exec=require(_0x89dd('0x1'))[_0x89dd('0x2')];var logger=require(_0x89dd('0x3'))('api');var util=require(_0x89dd('0x4'));var BPromise=require(_0x89dd('0x5'));var _=require('lodash');function handleError(_0x4edc99,_0x34366c,_0x5a20b3){_0x34366c=_0x34366c||0x1f4;return function(_0x372272){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5a20b3,_0x34366c,util[_0x89dd('0x6')](_0x372272,{'showHidden':![],'depth':null}));delete _0x372272[_0x89dd('0x7')];_0x4edc99[_0x89dd('0x8')](_0x34366c)[_0x89dd('0x9')](_0x372272);};}exports[_0x89dd('0xa')]=function(_0x2bc2ac,_0x4bf36c){return info[_0x89dd('0xb')]()[_0x89dd('0xc')](function(_0x130660){return _0x4bf36c[_0x89dd('0x8')](0xc8)[_0x89dd('0xd')](_0x130660);})[_0x89dd('0xe')](function(_0x40d1b4){return _0x4bf36c[_0x89dd('0x8')](0x1f4)[_0x89dd('0xd')](_0x40d1b4);});};exports['killProcess']=function(_0x1b447b,_0x3b6cfc){var _0x797d60=[_0x89dd('0xf')];return new BPromise(function(_0x2d27fd,_0x54bbf7){return exec(util[_0x89dd('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x1b447b[_0x89dd('0x11')][_0x89dd('0x12')]),function(_0x5bfd15,_0x283dfe,_0x1ece8e){if(_0x5bfd15){return _0x54bbf7(_0x5bfd15);}return _0x2d27fd(_0x283dfe);});})[_0x89dd('0xc')](function(_0x1dc05c){var _0x38b00a=![];var _0x2836a1=_0x1dc05c[_0x89dd('0x13')](/\n/);for(var _0x5b9eb2=0x0,_0xf72a1d=_0x797d60[_0x89dd('0x14')];_0x5b9eb2<_0xf72a1d,_0x38b00a===![];_0x5b9eb2+=0x1){if(_0x1dc05c[_0x89dd('0x15')](_0x797d60[_0x5b9eb2])>=0x0){_0x38b00a=!![];}}if(!_0x38b00a){throw new Error(util[_0x89dd('0x10')](_0x89dd('0x16'),_0x1b447b[_0x89dd('0x11')]['pid']));}process[_0x89dd('0x17')](_0x1b447b[_0x89dd('0x11')][_0x89dd('0x12')],_0x89dd('0x18'));return _0x3b6cfc['status'](0xc8)[_0x89dd('0xd')]({'message':util[_0x89dd('0x10')](_0x89dd('0x19'),_0x1b447b[_0x89dd('0x11')][_0x89dd('0x12')])});})['catch'](handleError(_0x3b6cfc,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0088e5c..8251039 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 _0x1a40=['put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x310d58,_0x4280d8){var _0x2b6845=function(_0xaf52cf){while(--_0xaf52cf){_0x310d58['push'](_0x310d58['shift']());}};_0x2b6845(++_0x4280d8);}(_0x1a40,0xb7));var _0x01a4=function(_0x6b3064,_0x35051a){_0x6b3064=_0x6b3064-0x0;var _0x3ed563=_0x1a40[_0x6b3064];return _0x3ed563;};'use strict';var multer=require(_0x01a4('0x0'));var util=require(_0x01a4('0x1'));var path=require(_0x01a4('0x2'));var timeout=require(_0x01a4('0x3'));var express=require(_0x01a4('0x4'));var router=express[_0x01a4('0x5')]();var fs_extra=require(_0x01a4('0x6'));var auth=require(_0x01a4('0x7'));var interaction=require(_0x01a4('0x8'));var config=require(_0x01a4('0x9'));var controller=require(_0x01a4('0xa'));router[_0x01a4('0xb')]('/',auth[_0x01a4('0xc')](),controller[_0x01a4('0xd')]);router[_0x01a4('0xb')](_0x01a4('0xe'),auth[_0x01a4('0xc')](),controller['show']);router[_0x01a4('0xf')]('/',auth[_0x01a4('0xc')](),controller[_0x01a4('0x10')]);router[_0x01a4('0x11')](_0x01a4('0xe'),auth[_0x01a4('0xc')](),controller['update']);router[_0x01a4('0x12')]('/:id',auth[_0x01a4('0xc')](),controller[_0x01a4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1e4c=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0xb4f654,_0x33ce4b){var _0x521323=function(_0x531016){while(--_0x531016){_0xb4f654['push'](_0xb4f654['shift']());}};_0x521323(++_0x33ce4b);}(_0x1e4c,0x1bc));var _0xc1e4=function(_0xb94716,_0x36189b){_0xb94716=_0xb94716-0x0;var _0x444fdb=_0x1e4c[_0xb94716];return _0x444fdb;};'use strict';var multer=require(_0xc1e4('0x0'));var util=require(_0xc1e4('0x1'));var path=require(_0xc1e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc1e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc1e4('0x4'));var interaction=require(_0xc1e4('0x5'));var config=require(_0xc1e4('0x6'));var controller=require('./tag.controller');router[_0xc1e4('0x7')]('/',auth[_0xc1e4('0x8')](),controller[_0xc1e4('0x9')]);router[_0xc1e4('0x7')](_0xc1e4('0xa'),auth['isAuthenticated'](),controller[_0xc1e4('0xb')]);router[_0xc1e4('0xc')]('/',auth[_0xc1e4('0x8')](),controller['create']);router[_0xc1e4('0xd')]('/:id',auth[_0xc1e4('0x8')](),controller[_0xc1e4('0xe')]);router['delete'](_0xc1e4('0xa'),auth[_0xc1e4('0x8')](),controller[_0xc1e4('0xf')]);module[_0xc1e4('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 75a3ed4..8dfa8ee 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 _0x6b24=['exports','STRING','name'];(function(_0x554f6d,_0x4ee746){var _0x753f81=function(_0x204ac3){while(--_0x204ac3){_0x554f6d['push'](_0x554f6d['shift']());}};_0x753f81(++_0x4ee746);}(_0x6b24,0x1ce));var _0x46b2=function(_0x5cc30e,_0x2646b6){_0x5cc30e=_0x5cc30e-0x0;var _0x208c6d=_0x6b24[_0x5cc30e];return _0x208c6d;};'use strict';var Sequelize=require('sequelize');module[_0x46b2('0x0')]={'name':{'type':Sequelize[_0x46b2('0x1')],'unique':_0x46b2('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x46b2('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb35=['STRING','name','#0091EA','exports'];(function(_0x277176,_0x4b72ee){var _0x75ae92=function(_0x41d7c4){while(--_0x41d7c4){_0x277176['push'](_0x277176['shift']());}};_0x75ae92(++_0x4b72ee);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x498819,_0x5f17e0){_0x498819=_0x498819-0x0;var _0x20a9a6=_0xbb35[_0x498819];return _0x20a9a6;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'name':{'type':Sequelize[_0x5bb3('0x1')],'unique':_0x5bb3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x5bb3('0x1')],'defaultValue':_0x5bb3('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5b961a8..8e29150 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 _0x9c5e=['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','get','UserProfileResource','end','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x3bbef8,_0xf0a2e){var _0x38cd98=function(_0x2782fc){while(--_0x2782fc){_0x3bbef8['push'](_0x3bbef8['shift']());}};_0x38cd98(++_0xf0a2e);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x490872,_0x381055){_0x490872=_0x490872-0x0;var _0x1e76bc=_0x9c5e[_0x490872];return _0x1e76bc;};'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(){var _0x1cd9c4=_0x245161[_0xe9c5('0x28')]({'plain':!![]});var _0x5a3caa='Tags';return db[_0xe9c5('0x29')][_0xe9c5('0x27')]({'where':{'type':_0x5a3caa,'resourceId':_0x1cd9c4['id']}})[_0xe9c5('0x26')](function(){return _0x245161;});})[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x2a')]();});}};}function handleEntityNotFound(_0x493108,_0x2c3fcb){return function(_0x480187){if(!_0x480187){_0x493108[_0xe9c5('0x19')](0x194);}return _0x480187;};}function handleError(_0x50256b,_0x4fa0c2){_0x4fa0c2=_0x4fa0c2||0x1f4;return function(_0x2112a6){logger['error'](_0x2112a6[_0xe9c5('0x2b')]);if(_0x2112a6[_0xe9c5('0x2c')]){delete _0x2112a6[_0xe9c5('0x2c')];}_0x50256b[_0xe9c5('0x1a')](_0x4fa0c2)[_0xe9c5('0x2d')](_0x2112a6);};}exports['index']=function(_0xe3464c,_0x4fcabd){var _0x46d3e6={},_0x5088a6={},_0x348fee={'count':0x0,'rows':[]};var _0x32e267=_[_0xe9c5('0x2e')](db[_0xe9c5('0x2f')][_0xe9c5('0x30')],function(_0x4e6043){return{'name':_0x4e6043[_0xe9c5('0x31')],'type':_0x4e6043[_0xe9c5('0x32')][_0xe9c5('0x33')]};});_0x5088a6[_0xe9c5('0x34')]=_[_0xe9c5('0x2e')](_0x32e267,'name');_0x5088a6['query']=_[_0xe9c5('0x35')](_0xe3464c[_0xe9c5('0x36')]);_0x5088a6[_0xe9c5('0x37')]=_[_0xe9c5('0x38')](_0x5088a6[_0xe9c5('0x34')],_0x5088a6[_0xe9c5('0x36')]);_0x46d3e6[_0xe9c5('0x39')]=_[_0xe9c5('0x38')](_0x5088a6['model'],qs[_0xe9c5('0x3a')](_0xe3464c[_0xe9c5('0x36')]['fields']));_0x46d3e6[_0xe9c5('0x39')]=_0x46d3e6['attributes'][_0xe9c5('0x3b')]?_0x46d3e6[_0xe9c5('0x39')]:_0x5088a6[_0xe9c5('0x34')];if(!_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x3c')](_0xe9c5('0x3d'))){_0x46d3e6[_0xe9c5('0x1d')]=qs[_0xe9c5('0x1d')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x1d')]);_0x46d3e6[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x1f')]);}_0x46d3e6[_0xe9c5('0x3e')]=qs[_0xe9c5('0x3f')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x3f')]);_0x46d3e6[_0xe9c5('0x40')]=qs['filters'](_[_0xe9c5('0x41')](_0xe3464c[_0xe9c5('0x36')],_0x5088a6[_0xe9c5('0x37')]),_0x32e267);if(_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x42')]){_0x46d3e6[_0xe9c5('0x40')]=_['merge'](_0x46d3e6[_0xe9c5('0x40')],{'$or':_[_0xe9c5('0x2e')](_0x32e267,function(_0x3a8be8){if(_0x3a8be8['type']!==_0xe9c5('0x43')){var _0x1bf7c5={};_0x1bf7c5[_0x3a8be8[_0xe9c5('0x2c')]]={'$like':'%'+_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x42')]+'%'};return _0x1bf7c5;}})});}_0x46d3e6=_[_0xe9c5('0x44')]({},_0x46d3e6,_0xe3464c[_0xe9c5('0x45')]);var _0x1fdf92={'where':_0x46d3e6[_0xe9c5('0x40')]};return db[_0xe9c5('0x2f')][_0xe9c5('0x1e')](_0x1fdf92)['then'](function(_0x51dd18){_0x348fee[_0xe9c5('0x1e')]=_0x51dd18;if(_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x46')]){_0x46d3e6[_0xe9c5('0x47')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x46d3e6);})[_0xe9c5('0x26')](function(_0x144e85){_0x348fee['rows']=_0x144e85;return _0x348fee;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x4fcabd,_0x46d3e6))['catch'](handleError(_0x4fcabd,null));};exports['show']=function(_0x5c395d,_0x3c7e42){var _0x232ab0={'raw':!![],'where':{'id':_0x5c395d[_0xe9c5('0x48')]['id']}},_0x1d081a={};_0x1d081a['model']=_[_0xe9c5('0x35')](db[_0xe9c5('0x2f')][_0xe9c5('0x30')]);_0x1d081a[_0xe9c5('0x36')]=_[_0xe9c5('0x35')](_0x5c395d[_0xe9c5('0x36')]);_0x1d081a[_0xe9c5('0x37')]=_[_0xe9c5('0x38')](_0x1d081a['model'],_0x1d081a[_0xe9c5('0x36')]);_0x232ab0[_0xe9c5('0x39')]=_[_0xe9c5('0x38')](_0x1d081a[_0xe9c5('0x34')],qs[_0xe9c5('0x3a')](_0x5c395d[_0xe9c5('0x36')]['fields']));_0x232ab0['attributes']=_0x232ab0['attributes']['length']?_0x232ab0[_0xe9c5('0x39')]:_0x1d081a[_0xe9c5('0x34')];if(_0x5c395d[_0xe9c5('0x36')]['includeAll']){_0x232ab0[_0xe9c5('0x47')]=[{'all':!![]}];}_0x232ab0=_[_0xe9c5('0x44')]({},_0x232ab0,_0x5c395d[_0xe9c5('0x45')]);return db[_0xe9c5('0x2f')][_0xe9c5('0x49')](_0x232ab0)[_0xe9c5('0x26')](handleEntityNotFound(_0x3c7e42,null))['then'](respondWithResult(_0x3c7e42,null))[_0xe9c5('0x4a')](handleError(_0x3c7e42,null));};exports[_0xe9c5('0x4b')]=function(_0x1da6a3,_0x249940){return db['Tag'][_0xe9c5('0x4b')](_0x1da6a3[_0xe9c5('0x4c')],{})[_0xe9c5('0x26')](function(_0x2d68be){var _0x38396f=_0x1da6a3[_0xe9c5('0x4d')]['get']({'plain':!![]});if(!_0x38396f)throw new Error(_0xe9c5('0x4e'));if(_0x38396f[_0xe9c5('0x4f')]===_0xe9c5('0x4d')){var _0x9d0154=_0x2d68be['get']({'plain':!![]});var _0x375f60=_0xe9c5('0x50');return db[_0xe9c5('0x51')][_0xe9c5('0x49')]({'where':{'name':_0x375f60,'userProfileId':_0x38396f[_0xe9c5('0x52')]},'raw':!![]})[_0xe9c5('0x26')](function(_0x581f8f){if(_0x581f8f&&_0x581f8f['autoAssociation']===0x0){return db[_0xe9c5('0x29')][_0xe9c5('0x4b')]({'name':_0x9d0154[_0xe9c5('0x2c')],'resourceId':_0x9d0154['id'],'type':_0x581f8f[_0xe9c5('0x2c')],'sectionId':_0x581f8f['id']},{})[_0xe9c5('0x26')](function(){return _0x2d68be;});}else{return _0x2d68be;}})[_0xe9c5('0x4a')](function(_0x2a9260){logger[_0xe9c5('0x53')](_0xe9c5('0x54'),_0x2a9260);throw _0x2a9260;});}return _0x2d68be;})[_0xe9c5('0x26')](respondWithResult(_0x249940,0xc9))[_0xe9c5('0x4a')](handleError(_0x249940,null));};exports[_0xe9c5('0x25')]=function(_0x2086fd,_0x3cd72b){if(_0x2086fd[_0xe9c5('0x4c')]['id']){delete _0x2086fd[_0xe9c5('0x4c')]['id'];}return db['Tag']['find']({'where':{'id':_0x2086fd['params']['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x3cd72b,null))[_0xe9c5('0x26')](saveUpdates(_0x2086fd[_0xe9c5('0x4c')],null))['then'](respondWithResult(_0x3cd72b,null))[_0xe9c5('0x4a')](handleError(_0x3cd72b,null));};exports['destroy']=function(_0x227370,_0xbac8ef){return db[_0xe9c5('0x2f')][_0xe9c5('0x49')]({'where':{'id':_0x227370[_0xe9c5('0x48')]['id']}})['then'](handleEntityNotFound(_0xbac8ef,null))[_0xe9c5('0x26')](removeEntity(_0xbac8ef,null))[_0xe9c5('0x4a')](handleError(_0xbac8ef,null));}; \ No newline at end of file +var _0x750a=['filter','options','Tag','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','body','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','status','end','offset','undefined','count','set','json','destroy','then','get','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x3e93c7,_0x9d5904){var _0xdba5b6=function(_0x3aadaa){while(--_0x3aadaa){_0x3e93c7['push'](_0x3e93c7['shift']());}};_0xdba5b6(++_0x9d5904);}(_0x750a,0x140));var _0xa750=function(_0x27d18e,_0x5b5383){_0x27d18e=_0x27d18e-0x0;var _0x333597=_0x750a[_0x27d18e];return _0x333597;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa750('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa750('0x1'));var moment=require(_0xa750('0x2'));var BPromise=require(_0xa750('0x3'));var Mustache=require(_0xa750('0x4'));var util=require(_0xa750('0x5'));var path=require(_0xa750('0x6'));var sox=require(_0xa750('0x7'));var csv=require(_0xa750('0x8'));var ejs=require(_0xa750('0x9'));var fs=require('fs');var fs_extra=require(_0xa750('0xa'));var _=require(_0xa750('0xb'));var squel=require(_0xa750('0xc'));var crypto=require(_0xa750('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa750('0x8'));var querystring=require('querystring');var Papa=require(_0xa750('0xe'));var Redis=require(_0xa750('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa750('0x10'));var as=require(_0xa750('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa750('0x12'));var utils=require('../../config/utils');var config=require(_0xa750('0x13'));var licenseUtil=require(_0xa750('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24ec62,_0x1c5657){_0x1c5657=_0x1c5657||0xcc;return function(_0x344c67){if(_0x344c67){return _0x24ec62['sendStatus'](_0x1c5657);}return _0x24ec62[_0xa750('0x15')](_0x1c5657)[_0xa750('0x16')]();};}function respondWithResult(_0x2d3421,_0x24e48a){_0x24e48a=_0x24e48a||0xc8;return function(_0xa66181){if(_0xa66181){return _0x2d3421[_0xa750('0x15')](_0x24e48a)['json'](_0xa66181);}};}function respondWithFilteredResult(_0x3ae2a1,_0x8488ea){return function(_0x290d46){if(_0x290d46){var _0x49fe3b=typeof _0x8488ea[_0xa750('0x17')]===_0xa750('0x18')&&typeof _0x8488ea['limit']==='undefined';var _0x321eb2=_0x290d46['count'];var _0x433dbd=_0x49fe3b?0x0:_0x8488ea[_0xa750('0x17')];var _0x4f1faa=_0x49fe3b?_0x290d46[_0xa750('0x19')]:_0x8488ea['offset']+_0x8488ea['limit'];var _0x25e335;if(_0x4f1faa>=_0x321eb2){_0x4f1faa=_0x321eb2;_0x25e335=0xc8;}else{_0x25e335=0xce;}_0x3ae2a1['status'](_0x25e335);return _0x3ae2a1[_0xa750('0x1a')]('Content-Range',_0x433dbd+'-'+_0x4f1faa+'/'+_0x321eb2)[_0xa750('0x1b')](_0x290d46);}return null;};}function patchUpdates(_0x4a007d){return function(_0x3dc7f1){try{jsonpatch['apply'](_0x3dc7f1,_0x4a007d,!![]);}catch(_0x1efb68){return BPromise['reject'](_0x1efb68);}return _0x3dc7f1['save']();};}function saveUpdates(_0xaa9d3e,_0x52da84){return function(_0x216fbf){if(_0x216fbf){return _0x216fbf['update'](_0xaa9d3e)['then'](function(_0x5b433d){return _0x5b433d;});}return null;};}function removeEntity(_0x5d758e,_0x15d72f){return function(_0x2ec6c4){if(_0x2ec6c4){return _0x2ec6c4[_0xa750('0x1c')]()[_0xa750('0x1d')](function(){var _0x1b80a5=_0x2ec6c4[_0xa750('0x1e')]({'plain':!![]});var _0x3001bc=_0xa750('0x1f');return db[_0xa750('0x20')][_0xa750('0x1c')]({'where':{'type':_0x3001bc,'resourceId':_0x1b80a5['id']}})[_0xa750('0x1d')](function(){return _0x2ec6c4;});})[_0xa750('0x1d')](function(){_0x5d758e[_0xa750('0x15')](0xcc)[_0xa750('0x16')]();});}};}function handleEntityNotFound(_0x310e2d,_0x4ffff4){return function(_0x3d3923){if(!_0x3d3923){_0x310e2d[_0xa750('0x21')](0x194);}return _0x3d3923;};}function handleError(_0x21cd2c,_0x4cceee){_0x4cceee=_0x4cceee||0x1f4;return function(_0x35ab53){logger[_0xa750('0x22')](_0x35ab53[_0xa750('0x23')]);if(_0x35ab53[_0xa750('0x24')]){delete _0x35ab53['name'];}_0x21cd2c[_0xa750('0x15')](_0x4cceee)[_0xa750('0x25')](_0x35ab53);};}exports[_0xa750('0x26')]=function(_0x2aef3a,_0x2c5253){var _0x59ab33={},_0x46cc11={},_0x4c2c9e={'count':0x0,'rows':[]};var _0x2d0e93=_[_0xa750('0x27')](db['Tag'][_0xa750('0x28')],function(_0x6bc25d){return{'name':_0x6bc25d[_0xa750('0x29')],'type':_0x6bc25d[_0xa750('0x2a')][_0xa750('0x2b')]};});_0x46cc11[_0xa750('0x2c')]=_[_0xa750('0x27')](_0x2d0e93,_0xa750('0x24'));_0x46cc11['query']=_[_0xa750('0x2d')](_0x2aef3a['query']);_0x46cc11[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],_0x46cc11[_0xa750('0x30')]);_0x59ab33['attributes']=_[_0xa750('0x2f')](_0x46cc11[_0xa750('0x2c')],qs['fields'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x31')]));_0x59ab33[_0xa750('0x32')]=_0x59ab33[_0xa750('0x32')]['length']?_0x59ab33[_0xa750('0x32')]:_0x46cc11['model'];if(!_0x2aef3a['query'][_0xa750('0x33')](_0xa750('0x34'))){_0x59ab33[_0xa750('0x35')]=qs['limit'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x35')]);_0x59ab33[_0xa750('0x17')]=qs['offset'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x17')]);}_0x59ab33[_0xa750('0x36')]=qs['sort'](_0x2aef3a[_0xa750('0x30')][_0xa750('0x37')]);_0x59ab33[_0xa750('0x38')]=qs['filters'](_[_0xa750('0x39')](_0x2aef3a[_0xa750('0x30')],_0x46cc11[_0xa750('0x2e')]),_0x2d0e93);if(_0x2aef3a[_0xa750('0x30')]['filter']){_0x59ab33['where']=_[_0xa750('0x3a')](_0x59ab33[_0xa750('0x38')],{'$or':_['map'](_0x2d0e93,function(_0x43dc3a){if(_0x43dc3a[_0xa750('0x2a')]!==_0xa750('0x3b')){var _0x1166ff={};_0x1166ff[_0x43dc3a[_0xa750('0x24')]]={'$like':'%'+_0x2aef3a['query'][_0xa750('0x3c')]+'%'};return _0x1166ff;}})});}_0x59ab33=_[_0xa750('0x3a')]({},_0x59ab33,_0x2aef3a[_0xa750('0x3d')]);var _0x134874={'where':_0x59ab33[_0xa750('0x38')]};return db[_0xa750('0x3e')][_0xa750('0x19')](_0x134874)['then'](function(_0x3daa38){_0x4c2c9e['count']=_0x3daa38;if(_0x2aef3a[_0xa750('0x30')]['includeAll']){_0x59ab33[_0xa750('0x3f')]=[{'all':!![]}];}return db[_0xa750('0x3e')][_0xa750('0x40')](_0x59ab33);})[_0xa750('0x1d')](function(_0x430d60){_0x4c2c9e[_0xa750('0x41')]=_0x430d60;return _0x4c2c9e;})[_0xa750('0x1d')](respondWithFilteredResult(_0x2c5253,_0x59ab33))[_0xa750('0x42')](handleError(_0x2c5253,null));};exports[_0xa750('0x43')]=function(_0x108a1a,_0x36a8d6){var _0x1458f1={'raw':!![],'where':{'id':_0x108a1a[_0xa750('0x44')]['id']}},_0x3ec860={};_0x3ec860[_0xa750('0x2c')]=_[_0xa750('0x2d')](db[_0xa750('0x3e')][_0xa750('0x28')]);_0x3ec860[_0xa750('0x30')]=_[_0xa750('0x2d')](_0x108a1a['query']);_0x3ec860[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],_0x3ec860[_0xa750('0x30')]);_0x1458f1[_0xa750('0x32')]=_[_0xa750('0x2f')](_0x3ec860[_0xa750('0x2c')],qs[_0xa750('0x31')](_0x108a1a[_0xa750('0x30')]['fields']));_0x1458f1[_0xa750('0x32')]=_0x1458f1[_0xa750('0x32')]['length']?_0x1458f1[_0xa750('0x32')]:_0x3ec860[_0xa750('0x2c')];if(_0x108a1a[_0xa750('0x30')][_0xa750('0x45')]){_0x1458f1[_0xa750('0x3f')]=[{'all':!![]}];}_0x1458f1=_[_0xa750('0x3a')]({},_0x1458f1,_0x108a1a[_0xa750('0x3d')]);return db[_0xa750('0x3e')][_0xa750('0x46')](_0x1458f1)[_0xa750('0x1d')](handleEntityNotFound(_0x36a8d6,null))['then'](respondWithResult(_0x36a8d6,null))[_0xa750('0x42')](handleError(_0x36a8d6,null));};exports[_0xa750('0x47')]=function(_0x58afd2,_0x93e49f){return db[_0xa750('0x3e')][_0xa750('0x47')](_0x58afd2['body'],{})[_0xa750('0x1d')](function(_0x3fc623){var _0x1e5a9a=_0x58afd2[_0xa750('0x48')]['get']({'plain':!![]});if(!_0x1e5a9a)throw new Error(_0xa750('0x49'));if(_0x1e5a9a[_0xa750('0x4a')]===_0xa750('0x48')){var _0xed4f88=_0x3fc623['get']({'plain':!![]});var _0x203f2a=_0xa750('0x1f');return db['UserProfileSection'][_0xa750('0x46')]({'where':{'name':_0x203f2a,'userProfileId':_0x1e5a9a['userProfileId']},'raw':!![]})[_0xa750('0x1d')](function(_0x69995b){if(_0x69995b&&_0x69995b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xed4f88[_0xa750('0x24')],'resourceId':_0xed4f88['id'],'type':_0x69995b[_0xa750('0x24')],'sectionId':_0x69995b['id']},{})['then'](function(){return _0x3fc623;});}else{return _0x3fc623;}})[_0xa750('0x42')](function(_0x1a79a9){logger[_0xa750('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a79a9);throw _0x1a79a9;});}return _0x3fc623;})['then'](respondWithResult(_0x93e49f,0xc9))['catch'](handleError(_0x93e49f,null));};exports['update']=function(_0x3c34d4,_0x4a1b5d){if(_0x3c34d4[_0xa750('0x4b')]['id']){delete _0x3c34d4[_0xa750('0x4b')]['id'];}return db['Tag'][_0xa750('0x46')]({'where':{'id':_0x3c34d4['params']['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x4a1b5d,null))['then'](saveUpdates(_0x3c34d4['body'],null))['then'](respondWithResult(_0x4a1b5d,null))['catch'](handleError(_0x4a1b5d,null));};exports[_0xa750('0x1c')]=function(_0x40dac2,_0x5f1313){return db['Tag']['find']({'where':{'id':_0x40dac2[_0xa750('0x44')]['id']}})[_0xa750('0x1d')](handleEntityNotFound(_0x5f1313,null))[_0xa750('0x1d')](removeEntity(_0x5f1313,null))[_0xa750('0x42')](handleError(_0x5f1313,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e7c9a7e..e255aec 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 _0x8bd4=['../../config/environment','exports','define','Tag','tools_tags','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36eab5,_0x2073d3){var _0x150dda=function(_0x509dfc){while(--_0x509dfc){_0x36eab5['push'](_0x36eab5['shift']());}};_0x150dda(++_0x2073d3);}(_0x8bd4,0xb9));var _0x48bd=function(_0xacf204,_0x28327f){_0xacf204=_0xacf204-0x0;var _0x4dec30=_0x8bd4[_0xacf204];return _0x4dec30;};'use strict';var _=require('lodash');var util=require(_0x48bd('0x0'));var logger=require('../../config/logger')(_0x48bd('0x1'));var moment=require(_0x48bd('0x2'));var BPromise=require(_0x48bd('0x3'));var rp=require(_0x48bd('0x4'));var fs=require('fs');var path=require(_0x48bd('0x5'));var rimraf=require(_0x48bd('0x6'));var config=require(_0x48bd('0x7'));var attributes=require('./tag.attributes');module[_0x48bd('0x8')]=function(_0xd6fe07,_0x58b0f8){return _0xd6fe07[_0x48bd('0x9')](_0x48bd('0xa'),attributes,{'tableName':_0x48bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x283c=['./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25b997,_0x9d645b){var _0x203842=function(_0x1f5d06){while(--_0x1f5d06){_0x25b997['push'](_0x25b997['shift']());}};_0x203842(++_0x9d645b);}(_0x283c,0x170));var _0xc283=function(_0xc8422d,_0x49ab0d){_0xc8422d=_0xc8422d-0x0;var _0x49c438=_0x283c[_0xc8422d];return _0x49c438;};'use strict';var _=require(_0xc283('0x0'));var util=require(_0xc283('0x1'));var logger=require(_0xc283('0x2'))(_0xc283('0x3'));var moment=require('moment');var BPromise=require(_0xc283('0x4'));var rp=require(_0xc283('0x5'));var fs=require('fs');var path=require(_0xc283('0x6'));var rimraf=require(_0xc283('0x7'));var config=require(_0xc283('0x8'));var attributes=require(_0xc283('0x9'));module[_0xc283('0xa')]=function(_0x2c18a4,_0x35a392){return _0x2c18a4[_0xc283('0xb')]('Tag',attributes,{'tableName':_0xc283('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 2b5ec1f..5144e85 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2e0aee,_0x41efa6){var _0x549622=function(_0x5cd3d9){while(--_0x5cd3d9){_0x2e0aee['push'](_0x2e0aee['shift']());}};_0x549622(++_0x41efa6);}(_0xfd28,0x148));var _0x8fd2=function(_0x171fdc,_0x16ae91){_0x171fdc=_0x171fdc-0x0;var _0x3782ea=_0xfd28[_0x171fdc];return _0x3782ea;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0x826a=['debug','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x826a,0x1aa));var _0xa826=function(_0x5e09ce,_0x4f9662){_0x5e09ce=_0x5e09ce-0x0;var _0x17c118=_0x826a[_0x5e09ce];return _0x17c118;};'use strict';var _=require('lodash');var util=require(_0xa826('0x0'));var moment=require('moment');var BPromise=require(_0xa826('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa826('0x2'));var db=require(_0xa826('0x3'))['db'];var utils=require(_0xa826('0x4'));var logger=require(_0xa826('0x5'))('rpc');var config=require(_0xa826('0x6'));var jayson=require(_0xa826('0x7'));var client=jayson[_0xa826('0x8')][_0xa826('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45154f,_0x4124f5,_0x4339f9){return new BPromise(function(_0x14c2ba,_0xc348d2){return client[_0xa826('0xa')](_0x45154f,_0x4339f9)[_0xa826('0xb')](function(_0x1005e6){logger[_0xa826('0xc')](_0xa826('0xd'),_0x4124f5,_0xa826('0xe'));logger[_0xa826('0xf')]('Tag,\x20%s,\x20%s,\x20%s',_0x4124f5,_0xa826('0xe'),JSON['stringify'](_0x1005e6));if(_0x1005e6[_0xa826('0x10')]){if(_0x1005e6[_0xa826('0x10')][_0xa826('0x11')]===0x1f4){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')][_0xa826('0x12')]);return _0xc348d2(_0x1005e6['error'][_0xa826('0x12')]);}logger['error'](_0xa826('0xd'),_0x4124f5,_0x1005e6[_0xa826('0x10')]['message']);return _0x14c2ba(_0x1005e6['error']['message']);}else{logger[_0xa826('0xc')]('Tag,\x20%s,\x20%s',_0x4124f5,'request\x20sent');_0x14c2ba(_0x1005e6[_0xa826('0x13')][_0xa826('0x12')]);}})[_0xa826('0x14')](function(_0x5832b9){logger[_0xa826('0x10')](_0xa826('0xd'),_0x4124f5,_0x5832b9);_0xc348d2(_0x5832b9);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f6edde9..1971218 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 2cf1d35..01a904b 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 _0xbaf0=['name','exports','STRING'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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 +var _0xbaf0=['name','exports','STRING'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'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/team/team.controller.js b/server/api/team/team.controller.js index 4b629e9..39132f0 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 _0x69e1=['filter','merge','VIRTUAL','includeAll','include','Team','then','rows','catch','params','keys','options','find','create','user','get','Teams','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','transaction','Sequelize','SELECT','UserId','QueryTypes','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','SmsQueueId','UserSmsQueue','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','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','end','send','getQueues','findOne','isValidChannel','channel','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','penalty','QueueId','TeamVoiceQueue','User','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','upsert','spread','removeAgents','isArray','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','defaults','redis','socket.io-emitter','./team.socket','register','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','sendStatus','error','stack','name','index','map','rawAttributes','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x5be652,_0x129d44){var _0x3c89da=function(_0x2f01ac){while(--_0x2f01ac){_0x5be652['push'](_0x5be652['shift']());}};_0x3c89da(++_0x129d44);}(_0x69e1,0x199));var _0x169e=function(_0x45a40f,_0x41d6bb){_0x45a40f=_0x45a40f-0x0;var _0x2a377c=_0x69e1[_0x45a40f];return _0x2a377c;};'use strict';var emlformat=require(_0x169e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x169e('0x1'));var jsonpatch=require(_0x169e('0x2'));var rp=require(_0x169e('0x3'));var moment=require(_0x169e('0x4'));var BPromise=require(_0x169e('0x5'));var Mustache=require(_0x169e('0x6'));var util=require(_0x169e('0x7'));var path=require(_0x169e('0x8'));var sox=require(_0x169e('0x9'));var csv=require(_0x169e('0xa'));var ejs=require(_0x169e('0xb'));var fs=require('fs');var fs_extra=require(_0x169e('0xc'));var _=require('lodash');var squel=require(_0x169e('0xd'));var crypto=require(_0x169e('0xe'));var jsforce=require(_0x169e('0xf'));var deskjs=require(_0x169e('0x10'));var toCsv=require(_0x169e('0xa'));var querystring=require(_0x169e('0x11'));var Papa=require('papaparse');var Redis=require(_0x169e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x169e('0x13'));var as=require(_0x169e('0x14'));var hardwareService=require(_0x169e('0x15'));var logger=require(_0x169e('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x169e('0x17'))['db'];config['redis']=_[_0x169e('0x18')](config[_0x169e('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x169e('0x1a'))(new Redis(config[_0x169e('0x19')]));require(_0x169e('0x1b'))[_0x169e('0x1c')](socket);function respondWithStatusCode(_0x458dea,_0x360b37){_0x360b37=_0x360b37||0xcc;return function(_0x518a92){if(_0x518a92){return _0x458dea['sendStatus'](_0x360b37);}return _0x458dea[_0x169e('0x1d')](_0x360b37)['end']();};}function respondWithResult(_0x3b43f1,_0x1339d6){_0x1339d6=_0x1339d6||0xc8;return function(_0x49e6bc){if(_0x49e6bc){return _0x3b43f1[_0x169e('0x1d')](_0x1339d6)['json'](_0x49e6bc);}};}function respondWithFilteredResult(_0x544da9,_0x496842){return function(_0xdc9226){if(_0xdc9226){var _0x4cafd9=typeof _0x496842[_0x169e('0x1e')]==='undefined'&&typeof _0x496842[_0x169e('0x1f')]===_0x169e('0x20');var _0x3a562c=_0xdc9226[_0x169e('0x21')];var _0x515d30=_0x4cafd9?0x0:_0x496842[_0x169e('0x1e')];var _0x1e3a6c=_0x4cafd9?_0xdc9226[_0x169e('0x21')]:_0x496842[_0x169e('0x1e')]+_0x496842[_0x169e('0x1f')];var _0xd98fe;if(_0x1e3a6c>=_0x3a562c){_0x1e3a6c=_0x3a562c;_0xd98fe=0xc8;}else{_0xd98fe=0xce;}_0x544da9[_0x169e('0x1d')](_0xd98fe);return _0x544da9[_0x169e('0x22')](_0x169e('0x23'),_0x515d30+'-'+_0x1e3a6c+'/'+_0x3a562c)[_0x169e('0x24')](_0xdc9226);}return null;};}function patchUpdates(_0x4ce07e){return function(_0x5d417f){try{jsonpatch['apply'](_0x5d417f,_0x4ce07e,!![]);}catch(_0x360b0d){return BPromise[_0x169e('0x25')](_0x360b0d);}return _0x5d417f[_0x169e('0x26')]();};}function saveUpdates(_0x2eaf7c,_0x2bb3b6){return function(_0x1df85d){if(_0x1df85d){return _0x1df85d[_0x169e('0x27')](_0x2eaf7c)['then'](function(_0x27a32b){return _0x27a32b;});}return null;};}function handleEntityNotFound(_0x135aef,_0x507be3){return function(_0x46e95e){if(!_0x46e95e){_0x135aef[_0x169e('0x28')](0x194);}return _0x46e95e;};}function handleError(_0x3317f8,_0x583ad4){_0x583ad4=_0x583ad4||0x1f4;return function(_0x39ae44){logger[_0x169e('0x29')](_0x39ae44[_0x169e('0x2a')]);if(_0x39ae44[_0x169e('0x2b')]){delete _0x39ae44[_0x169e('0x2b')];}_0x3317f8['status'](_0x583ad4)['send'](_0x39ae44);};}exports[_0x169e('0x2c')]=function(_0x441a36,_0x24c0d7){var _0x269388={},_0x472fb2={},_0x1f5444={'count':0x0,'rows':[]};var _0x29fab5=_[_0x169e('0x2d')](db['Team'][_0x169e('0x2e')],function(_0x78791a){return{'name':_0x78791a['fieldName'],'type':_0x78791a[_0x169e('0x2f')][_0x169e('0x30')]};});_0x472fb2['model']=_[_0x169e('0x2d')](_0x29fab5,'name');_0x472fb2[_0x169e('0x31')]=_['keys'](_0x441a36['query']);_0x472fb2[_0x169e('0x32')]=_['intersection'](_0x472fb2['model'],_0x472fb2[_0x169e('0x31')]);_0x269388[_0x169e('0x33')]=_[_0x169e('0x34')](_0x472fb2[_0x169e('0x35')],qs[_0x169e('0x36')](_0x441a36['query'][_0x169e('0x36')]));_0x269388[_0x169e('0x33')]=_0x269388[_0x169e('0x33')][_0x169e('0x37')]?_0x269388[_0x169e('0x33')]:_0x472fb2['model'];if(!_0x441a36['query'][_0x169e('0x38')](_0x169e('0x39'))){_0x269388[_0x169e('0x1f')]=qs[_0x169e('0x1f')](_0x441a36[_0x169e('0x31')]['limit']);_0x269388[_0x169e('0x1e')]=qs['offset'](_0x441a36['query'][_0x169e('0x1e')]);}_0x269388[_0x169e('0x3a')]=qs['sort'](_0x441a36[_0x169e('0x31')][_0x169e('0x3b')]);_0x269388[_0x169e('0x3c')]=qs['filters'](_[_0x169e('0x3d')](_0x441a36[_0x169e('0x31')],_0x472fb2[_0x169e('0x32')]),_0x29fab5);if(_0x441a36[_0x169e('0x31')][_0x169e('0x3e')]){_0x269388[_0x169e('0x3c')]=_[_0x169e('0x3f')](_0x269388[_0x169e('0x3c')],{'$or':_[_0x169e('0x2d')](_0x29fab5,function(_0x58b6cc){if(_0x58b6cc[_0x169e('0x2f')]!==_0x169e('0x40')){var _0x341a48={};_0x341a48[_0x58b6cc[_0x169e('0x2b')]]={'$like':'%'+_0x441a36[_0x169e('0x31')][_0x169e('0x3e')]+'%'};return _0x341a48;}})});}_0x269388=_[_0x169e('0x3f')]({},_0x269388,_0x441a36['options']);var _0x9783b3={'where':_0x269388[_0x169e('0x3c')]};return db['Team'][_0x169e('0x21')](_0x9783b3)['then'](function(_0x4a2975){_0x1f5444[_0x169e('0x21')]=_0x4a2975;if(_0x441a36[_0x169e('0x31')][_0x169e('0x41')]){_0x269388[_0x169e('0x42')]=[{'all':!![]}];}return db[_0x169e('0x43')]['findAll'](_0x269388);})[_0x169e('0x44')](function(_0x1cde79){_0x1f5444[_0x169e('0x45')]=_0x1cde79;return _0x1f5444;})[_0x169e('0x44')](respondWithFilteredResult(_0x24c0d7,_0x269388))[_0x169e('0x46')](handleError(_0x24c0d7,null));};exports['show']=function(_0x1dec1c,_0x19c544){var _0xb798ed={'raw':![],'where':{'id':_0x1dec1c[_0x169e('0x47')]['id']}},_0x5982c7={};_0x5982c7[_0x169e('0x35')]=_[_0x169e('0x48')](db[_0x169e('0x43')][_0x169e('0x2e')]);_0x5982c7[_0x169e('0x31')]=_[_0x169e('0x48')](_0x1dec1c[_0x169e('0x31')]);_0x5982c7[_0x169e('0x32')]=_[_0x169e('0x34')](_0x5982c7['model'],_0x5982c7[_0x169e('0x31')]);_0xb798ed[_0x169e('0x33')]=_[_0x169e('0x34')](_0x5982c7[_0x169e('0x35')],qs[_0x169e('0x36')](_0x1dec1c['query']['fields']));_0xb798ed[_0x169e('0x33')]=_0xb798ed[_0x169e('0x33')][_0x169e('0x37')]?_0xb798ed['attributes']:_0x5982c7[_0x169e('0x35')];if(_0x1dec1c[_0x169e('0x31')][_0x169e('0x41')]){_0xb798ed['include']=[{'all':!![]}];}_0xb798ed=_[_0x169e('0x3f')]({},_0xb798ed,_0x1dec1c[_0x169e('0x49')]);return db[_0x169e('0x43')][_0x169e('0x4a')](_0xb798ed)[_0x169e('0x44')](handleEntityNotFound(_0x19c544,null))[_0x169e('0x44')](respondWithResult(_0x19c544,null))[_0x169e('0x46')](handleError(_0x19c544,null));};exports[_0x169e('0x4b')]=function(_0x30d129,_0xe1a72d){return db[_0x169e('0x43')][_0x169e('0x4b')](_0x30d129['body'],{})['then'](function(_0x5a0425){var _0x1a9ce9=_0x30d129[_0x169e('0x4c')][_0x169e('0x4d')]({'plain':!![]});if(!_0x1a9ce9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9ce9['role']===_0x169e('0x4c')){var _0x33d0cf=_0x5a0425['get']({'plain':!![]});var _0x163e94=_0x169e('0x4e');return db['UserProfileSection'][_0x169e('0x4a')]({'where':{'name':_0x163e94,'userProfileId':_0x1a9ce9[_0x169e('0x4f')]},'raw':!![]})[_0x169e('0x44')](function(_0x199dae){if(_0x199dae&&_0x199dae[_0x169e('0x50')]===0x0){return db[_0x169e('0x51')][_0x169e('0x4b')]({'name':_0x33d0cf['name'],'resourceId':_0x33d0cf['id'],'type':_0x199dae[_0x169e('0x2b')],'sectionId':_0x199dae['id']},{})[_0x169e('0x44')](function(){return _0x5a0425;});}else{return _0x5a0425;}})['catch'](function(_0x36029a){logger[_0x169e('0x29')](_0x169e('0x52'),_0x36029a);throw _0x36029a;});}return _0x5a0425;})[_0x169e('0x44')](respondWithResult(_0xe1a72d,0xc9))[_0x169e('0x46')](handleError(_0xe1a72d,null));};exports[_0x169e('0x27')]=function(_0x2e3d84,_0x42d383){if(_0x2e3d84[_0x169e('0x53')]['id']){delete _0x2e3d84[_0x169e('0x53')]['id'];}return db['Team'][_0x169e('0x4a')]({'where':{'id':_0x2e3d84[_0x169e('0x47')]['id']}})[_0x169e('0x44')](handleEntityNotFound(_0x42d383,null))[_0x169e('0x44')](saveUpdates(_0x2e3d84[_0x169e('0x53')],null))[_0x169e('0x44')](respondWithResult(_0x42d383,null))[_0x169e('0x46')](handleError(_0x42d383,null));};exports[_0x169e('0x54')]=function(_0x285052,_0x464afc){var _0x440c62=_0x285052[_0x169e('0x47')]['id'];var _0x4fc3b7=[];return db[_0x169e('0x55')][_0x169e('0x56')](function(_0x339688){var _0x525e89='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x440c62;return db['sequelize'][_0x169e('0x31')](_0x525e89,{'type':db[_0x169e('0x57')]['QueryTypes'][_0x169e('0x58')],'raw':!![],'transaction':_0x339688})[_0x169e('0x44')](function(_0x3e6e9b){_0x4fc3b7=_[_0x169e('0x2d')](_0x3e6e9b,function(_0x22f80a){return Number(_0x22f80a[_0x169e('0x59')]);});})['then'](function(){var _0x3112d2='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x440c62;return db[_0x169e('0x55')][_0x169e('0x31')](_0x3112d2,{'type':db[_0x169e('0x57')][_0x169e('0x5a')]['SELECT'],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x25c6c4){var _0xafc669=_[_0x169e('0x2d')](_0x25c6c4,function(_0x163194){return Number(_0x163194[_0x169e('0x5b')]);});return db[_0x169e('0x5c')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'VoiceQueueId':{'$in':_0xafc669}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x135e7b=_0x169e('0x5d')+_0x440c62;return db[_0x169e('0x55')]['query'](_0x135e7b,{'type':db[_0x169e('0x57')][_0x169e('0x5a')][_0x169e('0x58')],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x192cd8){var _0xcc1586=_[_0x169e('0x2d')](_0x192cd8,function(_0x428cc3){return Number(_0x428cc3[_0x169e('0x5e')]);});return db[_0x169e('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x4fc3b7},'MailQueueId':{'$in':_0xcc1586}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x48750f=_0x169e('0x60')+_0x440c62;return db[_0x169e('0x55')][_0x169e('0x31')](_0x48750f,{'type':db[_0x169e('0x57')][_0x169e('0x5a')]['SELECT'],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x2e5f7c){var _0x597b71=_[_0x169e('0x2d')](_0x2e5f7c,function(_0x2e8248){return Number(_0x2e8248[_0x169e('0x61')]);});return db[_0x169e('0x62')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'SmsQueueId':{'$in':_0x597b71}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x3111b2='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x440c62;return db[_0x169e('0x55')]['query'](_0x3111b2,{'type':db['Sequelize'][_0x169e('0x5a')][_0x169e('0x58')],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x85dc56){var _0x1187de=_[_0x169e('0x2d')](_0x85dc56,function(_0x4b7e05){return Number(_0x4b7e05['ChatQueueId']);});return db[_0x169e('0x63')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'ChatQueueId':{'$in':_0x1187de}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x3fb31b=_0x169e('0x64')+_0x440c62;return db['sequelize'][_0x169e('0x31')](_0x3fb31b,{'type':db[_0x169e('0x57')][_0x169e('0x5a')][_0x169e('0x58')],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x549860){var _0x2cb334=_[_0x169e('0x2d')](_0x549860,function(_0x3986e5){return Number(_0x3986e5[_0x169e('0x65')]);});return db[_0x169e('0x66')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'FaxQueueId':{'$in':_0x2cb334}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x14a4fc=_0x169e('0x67')+_0x440c62;return db[_0x169e('0x55')][_0x169e('0x31')](_0x14a4fc,{'type':db[_0x169e('0x57')]['QueryTypes'][_0x169e('0x58')],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x388001){var _0x42c0fb=_['map'](_0x388001,function(_0x2c0c2b){return Number(_0x2c0c2b[_0x169e('0x68')]);});return db[_0x169e('0x69')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'OpenchannelQueueId':{'$in':_0x42c0fb}},'transaction':_0x339688});})[_0x169e('0x44')](function(){var _0x190b1f=_0x169e('0x6a')+_0x440c62;return db[_0x169e('0x55')][_0x169e('0x31')](_0x190b1f,{'type':db[_0x169e('0x57')][_0x169e('0x5a')][_0x169e('0x58')],'raw':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x2b2b61){var _0xaeb671=_[_0x169e('0x2d')](_0x2b2b61,function(_0x18cdaf){return Number(_0x18cdaf[_0x169e('0x6b')]);});return db[_0x169e('0x6c')][_0x169e('0x54')]({'where':{'UserId':{'$in':_0x4fc3b7},'WhatsappQueueId':{'$in':_0xaeb671}},'transaction':_0x339688});})[_0x169e('0x44')](function(){return db[_0x169e('0x6d')][_0x169e('0x4a')]({'where':{'TeamId':_0x440c62}});})[_0x169e('0x44')](function(_0x4324fe){if(_0x4324fe===null){return;}return db[_0x169e('0x6e')]['destroy']({'where':{'UserId':{'$in':_0x4fc3b7},'VoicePrefixId':_0x4324fe[_0x169e('0x6f')]},'transaction':_0x339688});})[_0x169e('0x44')](function(){return db[_0x169e('0x43')][_0x169e('0x54')]({'where':{'id':_0x440c62},'cascade':!![],'transaction':_0x339688});})[_0x169e('0x44')](function(_0x4c1607){if(_0x4c1607===0x0){_0x464afc[_0x169e('0x28')](0x194);}else{return db[_0x169e('0x51')][_0x169e('0x54')]({'where':{'type':_0x169e('0x4e'),'resourceId':_0x440c62},'cascade':!![],'transaction':_0x339688})[_0x169e('0x44')](function(){_0x464afc[_0x169e('0x1d')](0xcc)[_0x169e('0x70')]();});}})[_0x169e('0x46')](function(_0x56ccb1){_0x464afc['status'](0x1f4)[_0x169e('0x71')](_0x56ccb1);});});};exports[_0x169e('0x72')]=function(_0x53ef90,_0x22566a,_0x36a387){return db['Team'][_0x169e('0x73')]({'where':{'id':_0x53ef90[_0x169e('0x47')]['id']}})[_0x169e('0x44')](handleEntityNotFound(_0x22566a,null))[_0x169e('0x44')](function(_0x3290d5){if(!_0x53ef90[_0x169e('0x31')]['channel']||!utils[_0x169e('0x74')](_0x53ef90[_0x169e('0x31')][_0x169e('0x75')])){throw new db['Sequelize'][(_0x169e('0x76'))]('Unknown\x20channel');}var _0x432b94={};var _0x5711fd={};_0x5711fd[_0x169e('0x35')]=_[_0x169e('0x48')](db[_[_0x169e('0x77')](_0x53ef90[_0x169e('0x31')][_0x169e('0x75')][_0x169e('0x78')]())+_0x169e('0x79')][_0x169e('0x2e')]);_0x5711fd[_0x169e('0x31')]=_[_0x169e('0x48')](_0x53ef90[_0x169e('0x31')]);_0x5711fd['filters']=_['intersection'](_0x5711fd[_0x169e('0x35')],_0x5711fd[_0x169e('0x31')]);_0x432b94[_0x169e('0x33')]=_['intersection'](_0x5711fd[_0x169e('0x35')],qs[_0x169e('0x36')](_0x53ef90['query'][_0x169e('0x36')]));_0x432b94['attributes']=_0x432b94['attributes'][_0x169e('0x37')]?_0x432b94[_0x169e('0x33')]:_0x5711fd[_0x169e('0x35')];_0x432b94[_0x169e('0x1f')]=qs[_0x169e('0x1f')](_0x53ef90[_0x169e('0x31')][_0x169e('0x1f')]);_0x432b94[_0x169e('0x1e')]=qs[_0x169e('0x1e')](_0x53ef90[_0x169e('0x31')][_0x169e('0x1e')]);_0x432b94[_0x169e('0x3a')]=qs[_0x169e('0x3b')](_0x53ef90[_0x169e('0x31')][_0x169e('0x3b')]);_0x432b94[_0x169e('0x3c')]=qs['filters'](_['pick'](_0x53ef90['query'],_0x5711fd[_0x169e('0x32')]));_0x432b94=_[_0x169e('0x3f')]({},_0x432b94,_0x53ef90[_0x169e('0x49')]);return _0x3290d5[_0x169e('0x4d')+_[_0x169e('0x77')](_0x53ef90['query']['channel']['toLowerCase']())+_0x169e('0x7a')](_0x432b94);})[_0x169e('0x44')](respondWithResult(_0x22566a,null))[_0x169e('0x46')](handleError(_0x22566a,null));};exports[_0x169e('0x7b')]=function(_0xc95162,_0x40fb7e,_0x5fd5){return db[_0x169e('0x43')][_0x169e('0x73')]({'where':{'id':_0xc95162[_0x169e('0x47')]['id']}})[_0x169e('0x44')](function(_0x267c8e){if(_0x267c8e){if(!_0xc95162[_0x169e('0x53')][_0x169e('0x75')]||!utils[_0x169e('0x74')](_0xc95162[_0x169e('0x53')][_0x169e('0x75')])){throw new db['Sequelize'][(_0x169e('0x76'))](_0x169e('0x7c'));}return _0x267c8e[_0x169e('0x7d')+_['capitalize'](_0xc95162[_0x169e('0x53')][_0x169e('0x75')][_0x169e('0x78')]())+_0x169e('0x7a')](_0xc95162['body'][_0x169e('0x7e')]);}return null;})[_0x169e('0x44')](handleEntityNotFound(_0x40fb7e,null))['then'](respondWithStatusCode(_0x40fb7e,null))[_0x169e('0x46')](handleError(_0x40fb7e,null));};exports[_0x169e('0x7f')]=function(_0x2e0f43,_0x22755d,_0x3fd8c2){return db[_0x169e('0x43')][_0x169e('0x73')]({'where':{'id':_0x2e0f43[_0x169e('0x47')]['id']}})[_0x169e('0x44')](function(_0x3afa3f){if(_0x3afa3f){if(!_0x2e0f43['query'][_0x169e('0x75')]||!utils[_0x169e('0x74')](_0x2e0f43[_0x169e('0x31')][_0x169e('0x75')])){throw new db[(_0x169e('0x57'))][(_0x169e('0x76'))](_0x169e('0x7c'));}return _0x3afa3f[_0x169e('0x80')+_[_0x169e('0x77')](_0x2e0f43['query'][_0x169e('0x75')][_0x169e('0x78')]())+'Queues'](_0x2e0f43[_0x169e('0x31')][_0x169e('0x7e')]);}return null;})[_0x169e('0x44')](handleEntityNotFound(_0x22755d,null))['then'](respondWithStatusCode(_0x22755d,null))['catch'](handleError(_0x22755d,null));};exports[_0x169e('0x81')]=function(_0x1b2eda,_0xf303be){var _0xf46512=_['isArray'](_0x1b2eda['body'][_0x169e('0x7e')])?_0x1b2eda['body'][_0x169e('0x7e')]:[_0x1b2eda[_0x169e('0x53')][_0x169e('0x7e')]];var _0x4e3cce=_0x1b2eda['params']['id'];return db[_0x169e('0x43')][_0x169e('0x4a')]({'where':{'id':_0x4e3cce}})[_0x169e('0x44')](handleEntityNotFound(_0xf303be,null))[_0x169e('0x44')](function(_0x26c821){if(_0x26c821){var _0x532955=['Voice',_0x169e('0x82'),_0x169e('0x83'),_0x169e('0x84'),_0x169e('0x85'),_0x169e('0x86'),_0x169e('0x87')];return db['sequelize']['transaction'](function(_0x3c74f1){var _0x127a8d=_[_0x169e('0x2d')](_0x532955,function(_0x85713c){var _0x5a793f={'attributes':['id',_0x169e('0x2b')]};if(_0x85713c===_0x169e('0x88')){_0x5a793f['through']={'attributes':[_0x169e('0x89')]};}return _0x26c821['get'+_0x85713c+_0x169e('0x7a')](_0x5a793f)[_0x169e('0x44')](function(_0x1e0e03){var _0x384e52=_[_0x169e('0x2d')](_0x1e0e03,function(_0x455c90){var _0x533c31=_['map'](_0xf46512,function(_0x125916){var _0x5c9335={'where':{'UserId':_0x125916,[_0x85713c+_0x169e('0x8a')]:_0x455c90['id']},'transaction':_0x3c74f1};if(_0x85713c===_0x169e('0x88')){_0x5c9335[_0x169e('0x18')]={'penalty':_0x455c90[_0x169e('0x8b')][_0x169e('0x89')]};}return db[_0x169e('0x8c')+_0x85713c+_0x169e('0x79')]['findOrCreate'](_0x5c9335)[_0x169e('0x44')](function(){socket['emit'](_0x169e('0x4c')+_0x85713c+_0x169e('0x8d'),{'UserId':_0x125916,[_0x85713c+_0x169e('0x8a')]:_0x455c90['id']});if(_0x85713c!==_0x169e('0x88')){return;}return db[_0x169e('0x8c')]['findAll']({'where':{'id':_0xf46512,'online':0x1},'attributes':['id',_0x169e('0x2b'),_0x169e('0x8e'),_0x169e('0x8f'),_0x169e('0x90')],'raw':!![]})[_0x169e('0x44')](function(_0x113693){var _0x12fdfe=_[_0x169e('0x2d')](_0x113693,function(_0x4048b2){return db[_0x169e('0x91')]['upsert']({'membername':_0x4048b2[_0x169e('0x2b')],'UserId':_0x4048b2['id'],'queue_name':_0x455c90[_0x169e('0x2b')],'VoiceQueueId':_0x455c90['id'],'interface':_[_0x169e('0x92')](_0x4048b2[_0x169e('0x90')])?util[_0x169e('0x93')](_0x169e('0x94'),_0x4048b2[_0x169e('0x2b')]):_0x4048b2[_0x169e('0x90')],'paused':_0x4048b2[_0x169e('0x8f')]||![],'penalty':_0x455c90[_0x169e('0x8b')][_0x169e('0x89')]},{'transaction':_0x3c74f1});});return Promise['all'](_0x12fdfe);});});});return Promise[_0x169e('0x95')](_0x533c31);});return Promise[_0x169e('0x95')](_0x384e52);})[_0x169e('0x44')](function(){return db[_0x169e('0x6d')][_0x169e('0x73')]({'where':{'teamId':_0x4e3cce}})[_0x169e('0x44')](function(_0xe16229){if(_0xe16229){var _0x76ca34=_[_0x169e('0x2d')](_0xf46512,function(_0x31cdbf){db[_0x169e('0x6e')][_0x169e('0x96')]({'UserId':_0x31cdbf,'VoicePrefixId':_0xe16229['VoicePrefixId']});});return Promise[_0x169e('0x95')](_0x76ca34);}});});});return Promise['all'](_0x127a8d)[_0x169e('0x44')](function(){return _0x26c821[_0x169e('0x81')](_0xf46512,{'transaction':_0x3c74f1})[_0x169e('0x97')](function(_0x17046d){return _0x17046d;});});});}})[_0x169e('0x44')](respondWithResult(_0xf303be,null))[_0x169e('0x46')](handleError(_0xf303be,null));};exports[_0x169e('0x98')]=function(_0x3bf5b4,_0x44d8a0){var _0x2bd885=_[_0x169e('0x99')](_0x3bf5b4[_0x169e('0x31')][_0x169e('0x7e')])?_0x3bf5b4[_0x169e('0x31')][_0x169e('0x7e')]:[_0x3bf5b4['query']['ids']];var _0x3bfa3b=_0x3bf5b4[_0x169e('0x47')]['id'];return db[_0x169e('0x43')][_0x169e('0x4a')]({'where':{'id':_0x3bfa3b}})[_0x169e('0x44')](handleEntityNotFound(_0x44d8a0,null))[_0x169e('0x44')](function(_0xf39302){if(_0xf39302){var _0x3638be=[_0x169e('0x88'),'Chat',_0x169e('0x83'),'Sms',_0x169e('0x85'),_0x169e('0x86'),'Whatsapp'];return db['sequelize'][_0x169e('0x56')](function(_0xb87015){var _0x1a4aa5=_[_0x169e('0x2d')](_0x3638be,function(_0x473d63){var _0x3c3cf5={'attributes':['id',_0x169e('0x2b')]};return _0xf39302[_0x169e('0x4d')+_0x473d63+_0x169e('0x7a')](_0x3c3cf5)[_0x169e('0x44')](function(_0x1c02bf){var _0x12225f=_[_0x169e('0x2d')](_0x1c02bf,function(_0x1bde6a){return _0x1bde6a['removeAgents'](_0x2bd885,{'transaction':_0xb87015})[_0x169e('0x44')](function(){var _0x4ae529=_[_0x169e('0x2d')](_0x2bd885,function(_0x84ce6b){socket[_0x169e('0x9a')]('user'+_0x473d63+_0x169e('0x9b'),{'UserId':Number(_0x84ce6b),[_0x473d63+'QueueId']:_0x1bde6a['id']});if(_0x473d63!=='Voice'){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x1bde6a['id'],'UserId':_0x84ce6b},'transaction':_0xb87015});});return Promise[_0x169e('0x95')](_0x4ae529);});});return Promise[_0x169e('0x95')](_0x12225f);});});return Promise[_0x169e('0x95')](_0x1a4aa5)[_0x169e('0x44')](function(){return _0xf39302[_0x169e('0x98')](_0x2bd885,{'transaction':_0xb87015});})['then'](function(){return db[_0x169e('0x6d')][_0x169e('0x73')]({'where':{'teamId':_0x3bfa3b}})[_0x169e('0x44')](function(_0x83cf52){if(_0x83cf52){var _0x5a3b22=_[_0x169e('0x2d')](_0x2bd885,function(_0x2f7ffb){db[_0x169e('0x6e')]['destroy']({'where':{'UserId':_0x2f7ffb,'VoicePrefixId':_0x83cf52[_0x169e('0x6f')]}});});return Promise['all'](_0x5a3b22);}});});});}})['then'](respondWithStatusCode(_0x44d8a0,null))['catch'](handleError(_0x44d8a0,null));};exports[_0x169e('0x9c')]=function(_0x19b3ba,_0x184246,_0x31d93f){var _0x3db26b={};var _0x409835={};var _0x116c33;var _0x18c214;return db['Team']['findOne']({'where':{'id':_0x19b3ba[_0x169e('0x47')]['id']}})[_0x169e('0x44')](handleEntityNotFound(_0x184246,null))['then'](function(_0x5b5bc4){if(_0x5b5bc4){_0x116c33=_0x5b5bc4;_0x409835['model']=_[_0x169e('0x48')](db[_0x169e('0x8c')]['rawAttributes']);_0x409835[_0x169e('0x31')]=_[_0x169e('0x48')](_0x19b3ba[_0x169e('0x31')]);_0x409835[_0x169e('0x32')]=_[_0x169e('0x34')](_0x409835[_0x169e('0x35')],_0x409835[_0x169e('0x31')]);_0x3db26b['attributes']=_[_0x169e('0x34')](_0x409835[_0x169e('0x35')],qs[_0x169e('0x36')](_0x19b3ba['query']['fields']));_0x3db26b[_0x169e('0x33')]=_0x3db26b[_0x169e('0x33')][_0x169e('0x37')]?_0x3db26b[_0x169e('0x33')]:_0x409835[_0x169e('0x35')];_0x3db26b[_0x169e('0x3a')]=qs[_0x169e('0x3b')](_0x19b3ba[_0x169e('0x31')]['sort']);_0x3db26b['where']=qs[_0x169e('0x32')](_[_0x169e('0x3d')](_0x19b3ba[_0x169e('0x31')],_0x409835[_0x169e('0x32')]));if(_0x19b3ba[_0x169e('0x31')]['filter']){_0x3db26b[_0x169e('0x3c')]=_['merge'](_0x3db26b[_0x169e('0x3c')],{'$or':_[_0x169e('0x2d')](_0x3db26b[_0x169e('0x33')],function(_0x1b25e4){var _0x1ec6d4={};_0x1ec6d4[_0x1b25e4]={'$like':'%'+_0x19b3ba[_0x169e('0x31')]['filter']+'%'};return _0x1ec6d4;})});}_0x3db26b=_[_0x169e('0x3f')]({},_0x3db26b,_0x19b3ba[_0x169e('0x49')]);return _0x116c33['getAgents'](_0x3db26b);}})['then'](function(_0x41ddc8){if(_0x41ddc8){_0x18c214=_0x41ddc8[_0x169e('0x37')];if(!_0x19b3ba[_0x169e('0x31')][_0x169e('0x38')]('nolimit')){_0x3db26b[_0x169e('0x1f')]=qs['limit'](_0x19b3ba[_0x169e('0x31')]['limit']);_0x3db26b[_0x169e('0x1e')]=qs[_0x169e('0x1e')](_0x19b3ba['query']['offset']);}return _0x116c33[_0x169e('0x9c')](_0x3db26b);}})['then'](function(_0x1ab50d){if(_0x1ab50d){return _0x1ab50d?{'count':_0x18c214,'rows':_0x1ab50d}:null;}})[_0x169e('0x44')](respondWithResult(_0x184246,null))[_0x169e('0x46')](handleError(_0x184246,null));}; \ No newline at end of file +var _0x6e61=['Sms','Fax','Openchannel','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','TeamVoicePrefix','UserVoicePrefix','addAgents','removeAgents','Chat','Whatsapp','getAgents','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','offset','undefined','count','limit','set','save','update','then','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','transaction','sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','VoicePrefixId','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','addQueues','findOne','add','Queues','ids','removeQueues','remove','isArray','Voice','Mail'];(function(_0x4576aa,_0x46c8a8){var _0x1ec6ba=function(_0x356675){while(--_0x356675){_0x4576aa['push'](_0x4576aa['shift']());}};_0x1ec6ba(++_0x46c8a8);}(_0x6e61,0x1eb));var _0x16e6=function(_0x3355c0,_0x4b530b){_0x3355c0=_0x3355c0-0x0;var _0x5a3288=_0x6e61[_0x3355c0];return _0x5a3288;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16e6('0x0'));var zipdir=require(_0x16e6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16e6('0x2'));var Mustache=require(_0x16e6('0x3'));var util=require(_0x16e6('0x4'));var path=require('path');var sox=require(_0x16e6('0x5'));var csv=require(_0x16e6('0x6'));var ejs=require(_0x16e6('0x7'));var fs=require('fs');var fs_extra=require(_0x16e6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x16e6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x16e6('0xa'));var toCsv=require(_0x16e6('0x6'));var querystring=require(_0x16e6('0xb'));var Papa=require(_0x16e6('0xc'));var Redis=require(_0x16e6('0xd'));var authService=require(_0x16e6('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x16e6('0xf'));var hardwareService=require(_0x16e6('0x10'));var logger=require(_0x16e6('0x11'))(_0x16e6('0x12'));var utils=require('../../config/utils');var config=require(_0x16e6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x16e6('0x14'))['db'];config[_0x16e6('0x15')]=_[_0x16e6('0x16')](config['redis'],{'host':_0x16e6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x16e6('0x15')]));require(_0x16e6('0x18'))[_0x16e6('0x19')](socket);function respondWithStatusCode(_0x5aa136,_0x1e6728){_0x1e6728=_0x1e6728||0xcc;return function(_0x1367e8){if(_0x1367e8){return _0x5aa136['sendStatus'](_0x1e6728);}return _0x5aa136[_0x16e6('0x1a')](_0x1e6728)[_0x16e6('0x1b')]();};}function respondWithResult(_0x5177a2,_0x4391c1){_0x4391c1=_0x4391c1||0xc8;return function(_0x326fd9){if(_0x326fd9){return _0x5177a2[_0x16e6('0x1a')](_0x4391c1)['json'](_0x326fd9);}};}function respondWithFilteredResult(_0x4692c0,_0x159677){return function(_0x2acd1f){if(_0x2acd1f){var _0x5c9b26=typeof _0x159677[_0x16e6('0x1c')]===_0x16e6('0x1d')&&typeof _0x159677['limit']==='undefined';var _0x2a7484=_0x2acd1f[_0x16e6('0x1e')];var _0x30648f=_0x5c9b26?0x0:_0x159677[_0x16e6('0x1c')];var _0x23bf00=_0x5c9b26?_0x2acd1f[_0x16e6('0x1e')]:_0x159677['offset']+_0x159677[_0x16e6('0x1f')];var _0x419cfa;if(_0x23bf00>=_0x2a7484){_0x23bf00=_0x2a7484;_0x419cfa=0xc8;}else{_0x419cfa=0xce;}_0x4692c0['status'](_0x419cfa);return _0x4692c0[_0x16e6('0x20')]('Content-Range',_0x30648f+'-'+_0x23bf00+'/'+_0x2a7484)['json'](_0x2acd1f);}return null;};}function patchUpdates(_0x5298d9){return function(_0x10d91f){try{jsonpatch['apply'](_0x10d91f,_0x5298d9,!![]);}catch(_0x4972f5){return BPromise['reject'](_0x4972f5);}return _0x10d91f[_0x16e6('0x21')]();};}function saveUpdates(_0x1927a5,_0x422e33){return function(_0x19c007){if(_0x19c007){return _0x19c007[_0x16e6('0x22')](_0x1927a5)[_0x16e6('0x23')](function(_0x1ad159){return _0x1ad159;});}return null;};}function handleEntityNotFound(_0x51ab30,_0x1201a5){return function(_0x46bb59){if(!_0x46bb59){_0x51ab30[_0x16e6('0x24')](0x194);}return _0x46bb59;};}function handleError(_0x34d340,_0x3a3194){_0x3a3194=_0x3a3194||0x1f4;return function(_0x153f6a){logger[_0x16e6('0x25')](_0x153f6a['stack']);if(_0x153f6a[_0x16e6('0x26')]){delete _0x153f6a[_0x16e6('0x26')];}_0x34d340[_0x16e6('0x1a')](_0x3a3194)[_0x16e6('0x27')](_0x153f6a);};}exports[_0x16e6('0x28')]=function(_0x49df6a,_0x158f92){var _0x2308e8={},_0x22aa52={},_0x2b9272={'count':0x0,'rows':[]};var _0x18d578=_[_0x16e6('0x29')](db[_0x16e6('0x2a')][_0x16e6('0x2b')],function(_0x4aea6d){return{'name':_0x4aea6d[_0x16e6('0x2c')],'type':_0x4aea6d[_0x16e6('0x2d')][_0x16e6('0x2e')]};});_0x22aa52[_0x16e6('0x2f')]=_['map'](_0x18d578,_0x16e6('0x26'));_0x22aa52[_0x16e6('0x30')]=_[_0x16e6('0x31')](_0x49df6a['query']);_0x22aa52[_0x16e6('0x32')]=_[_0x16e6('0x33')](_0x22aa52[_0x16e6('0x2f')],_0x22aa52[_0x16e6('0x30')]);_0x2308e8[_0x16e6('0x34')]=_[_0x16e6('0x33')](_0x22aa52['model'],qs[_0x16e6('0x35')](_0x49df6a[_0x16e6('0x30')][_0x16e6('0x35')]));_0x2308e8[_0x16e6('0x34')]=_0x2308e8[_0x16e6('0x34')]['length']?_0x2308e8['attributes']:_0x22aa52['model'];if(!_0x49df6a[_0x16e6('0x30')][_0x16e6('0x36')](_0x16e6('0x37'))){_0x2308e8[_0x16e6('0x1f')]=qs[_0x16e6('0x1f')](_0x49df6a[_0x16e6('0x30')]['limit']);_0x2308e8[_0x16e6('0x1c')]=qs[_0x16e6('0x1c')](_0x49df6a[_0x16e6('0x30')]['offset']);}_0x2308e8['order']=qs[_0x16e6('0x38')](_0x49df6a[_0x16e6('0x30')]['sort']);_0x2308e8[_0x16e6('0x39')]=qs[_0x16e6('0x32')](_[_0x16e6('0x3a')](_0x49df6a[_0x16e6('0x30')],_0x22aa52['filters']),_0x18d578);if(_0x49df6a[_0x16e6('0x30')][_0x16e6('0x3b')]){_0x2308e8[_0x16e6('0x39')]=_[_0x16e6('0x3c')](_0x2308e8[_0x16e6('0x39')],{'$or':_[_0x16e6('0x29')](_0x18d578,function(_0x504236){if(_0x504236[_0x16e6('0x2d')]!==_0x16e6('0x3d')){var _0x3dae48={};_0x3dae48[_0x504236[_0x16e6('0x26')]]={'$like':'%'+_0x49df6a[_0x16e6('0x30')][_0x16e6('0x3b')]+'%'};return _0x3dae48;}})});}_0x2308e8=_['merge']({},_0x2308e8,_0x49df6a[_0x16e6('0x3e')]);var _0x2783ed={'where':_0x2308e8[_0x16e6('0x39')]};return db[_0x16e6('0x2a')][_0x16e6('0x1e')](_0x2783ed)['then'](function(_0x53741a){_0x2b9272[_0x16e6('0x1e')]=_0x53741a;if(_0x49df6a[_0x16e6('0x30')][_0x16e6('0x3f')]){_0x2308e8['include']=[{'all':!![]}];}return db[_0x16e6('0x2a')][_0x16e6('0x40')](_0x2308e8);})[_0x16e6('0x23')](function(_0x3e435b){_0x2b9272[_0x16e6('0x41')]=_0x3e435b;return _0x2b9272;})[_0x16e6('0x23')](respondWithFilteredResult(_0x158f92,_0x2308e8))[_0x16e6('0x42')](handleError(_0x158f92,null));};exports[_0x16e6('0x43')]=function(_0x4d1e3f,_0x19a404){var _0x18132a={'raw':![],'where':{'id':_0x4d1e3f['params']['id']}},_0x441a08={};_0x441a08[_0x16e6('0x2f')]=_['keys'](db[_0x16e6('0x2a')]['rawAttributes']);_0x441a08['query']=_[_0x16e6('0x31')](_0x4d1e3f['query']);_0x441a08[_0x16e6('0x32')]=_[_0x16e6('0x33')](_0x441a08[_0x16e6('0x2f')],_0x441a08[_0x16e6('0x30')]);_0x18132a['attributes']=_[_0x16e6('0x33')](_0x441a08[_0x16e6('0x2f')],qs[_0x16e6('0x35')](_0x4d1e3f[_0x16e6('0x30')][_0x16e6('0x35')]));_0x18132a[_0x16e6('0x34')]=_0x18132a[_0x16e6('0x34')][_0x16e6('0x44')]?_0x18132a[_0x16e6('0x34')]:_0x441a08['model'];if(_0x4d1e3f[_0x16e6('0x30')]['includeAll']){_0x18132a[_0x16e6('0x45')]=[{'all':!![]}];}_0x18132a=_[_0x16e6('0x3c')]({},_0x18132a,_0x4d1e3f['options']);return db[_0x16e6('0x2a')]['find'](_0x18132a)[_0x16e6('0x23')](handleEntityNotFound(_0x19a404,null))[_0x16e6('0x23')](respondWithResult(_0x19a404,null))[_0x16e6('0x42')](handleError(_0x19a404,null));};exports[_0x16e6('0x46')]=function(_0x41ef39,_0x2cde02){return db['Team'][_0x16e6('0x46')](_0x41ef39[_0x16e6('0x47')],{})[_0x16e6('0x23')](function(_0x4858dd){var _0x482166=_0x41ef39['user'][_0x16e6('0x48')]({'plain':!![]});if(!_0x482166)throw new Error(_0x16e6('0x49'));if(_0x482166[_0x16e6('0x4a')]===_0x16e6('0x4b')){var _0x5babad=_0x4858dd['get']({'plain':!![]});var _0x2760e0=_0x16e6('0x4c');return db[_0x16e6('0x4d')][_0x16e6('0x4e')]({'where':{'name':_0x2760e0,'userProfileId':_0x482166[_0x16e6('0x4f')]},'raw':!![]})[_0x16e6('0x23')](function(_0x52c4f4){if(_0x52c4f4&&_0x52c4f4[_0x16e6('0x50')]===0x0){return db[_0x16e6('0x51')][_0x16e6('0x46')]({'name':_0x5babad[_0x16e6('0x26')],'resourceId':_0x5babad['id'],'type':_0x52c4f4[_0x16e6('0x26')],'sectionId':_0x52c4f4['id']},{})['then'](function(){return _0x4858dd;});}else{return _0x4858dd;}})['catch'](function(_0x22a42b){logger[_0x16e6('0x25')](_0x16e6('0x52'),_0x22a42b);throw _0x22a42b;});}return _0x4858dd;})[_0x16e6('0x23')](respondWithResult(_0x2cde02,0xc9))[_0x16e6('0x42')](handleError(_0x2cde02,null));};exports[_0x16e6('0x22')]=function(_0xb76060,_0x1156b0){if(_0xb76060[_0x16e6('0x47')]['id']){delete _0xb76060[_0x16e6('0x47')]['id'];}return db[_0x16e6('0x2a')][_0x16e6('0x4e')]({'where':{'id':_0xb76060[_0x16e6('0x53')]['id']}})[_0x16e6('0x23')](handleEntityNotFound(_0x1156b0,null))[_0x16e6('0x23')](saveUpdates(_0xb76060[_0x16e6('0x47')],null))[_0x16e6('0x23')](respondWithResult(_0x1156b0,null))[_0x16e6('0x42')](handleError(_0x1156b0,null));};exports['destroy']=function(_0x7a6a62,_0x140345){var _0x45bc01=_0x7a6a62[_0x16e6('0x53')]['id'];var _0x150229=[];return db['sequelize'][_0x16e6('0x54')](function(_0x48733f){var _0x3d2849='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x3d2849,{'type':db['Sequelize'][_0x16e6('0x56')][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f})[_0x16e6('0x23')](function(_0x3c38d3){_0x150229=_[_0x16e6('0x29')](_0x3c38d3,function(_0x50a033){return Number(_0x50a033[_0x16e6('0x58')]);});})[_0x16e6('0x23')](function(){var _0x2358d2=_0x16e6('0x59')+_0x45bc01;return db[_0x16e6('0x55')]['query'](_0x2358d2,{'type':db[_0x16e6('0x5a')]['QueryTypes'][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x302175){var _0x213797=_[_0x16e6('0x29')](_0x302175,function(_0x24c7cd){return Number(_0x24c7cd['VoiceQueueId']);});return db[_0x16e6('0x5b')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'VoiceQueueId':{'$in':_0x213797}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0x31d956=_0x16e6('0x5d')+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x31d956,{'type':db[_0x16e6('0x5a')]['QueryTypes'][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x5a4195){var _0x295cab=_['map'](_0x5a4195,function(_0xa20511){return Number(_0xa20511[_0x16e6('0x5e')]);});return db[_0x16e6('0x5f')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'MailQueueId':{'$in':_0x295cab}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0x480c03=_0x16e6('0x60')+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x480c03,{'type':db[_0x16e6('0x5a')][_0x16e6('0x56')][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x10eefd){var _0x507377=_[_0x16e6('0x29')](_0x10eefd,function(_0x392798){return Number(_0x392798[_0x16e6('0x61')]);});return db[_0x16e6('0x62')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'SmsQueueId':{'$in':_0x507377}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0xe724f8=_0x16e6('0x63')+_0x45bc01;return db['sequelize'][_0x16e6('0x30')](_0xe724f8,{'type':db[_0x16e6('0x5a')]['QueryTypes'][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f});})['then'](function(_0x522504){var _0x3e9998=_[_0x16e6('0x29')](_0x522504,function(_0x35c3d7){return Number(_0x35c3d7['ChatQueueId']);});return db[_0x16e6('0x64')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'ChatQueueId':{'$in':_0x3e9998}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0x4329b1=_0x16e6('0x65')+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x4329b1,{'type':db[_0x16e6('0x5a')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x3e9b05){var _0x1631a2=_[_0x16e6('0x29')](_0x3e9b05,function(_0x518102){return Number(_0x518102['FaxQueueId']);});return db[_0x16e6('0x66')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'FaxQueueId':{'$in':_0x1631a2}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0x446962=_0x16e6('0x67')+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x446962,{'type':db['Sequelize'][_0x16e6('0x56')]['SELECT'],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x1fd3d1){var _0x24e9f6=_[_0x16e6('0x29')](_0x1fd3d1,function(_0xb132ce){return Number(_0xb132ce[_0x16e6('0x68')]);});return db[_0x16e6('0x69')]['destroy']({'where':{'UserId':{'$in':_0x150229},'OpenchannelQueueId':{'$in':_0x24e9f6}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){var _0x57332c=_0x16e6('0x6a')+_0x45bc01;return db[_0x16e6('0x55')][_0x16e6('0x30')](_0x57332c,{'type':db['Sequelize'][_0x16e6('0x56')][_0x16e6('0x57')],'raw':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x5c4b6b){var _0x223fb9=_[_0x16e6('0x29')](_0x5c4b6b,function(_0x5a561d){return Number(_0x5a561d[_0x16e6('0x6b')]);});return db[_0x16e6('0x6c')][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'WhatsappQueueId':{'$in':_0x223fb9}},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x45bc01}});})[_0x16e6('0x23')](function(_0x52e02e){if(_0x52e02e===null){return;}return db['UserVoicePrefix'][_0x16e6('0x5c')]({'where':{'UserId':{'$in':_0x150229},'VoicePrefixId':_0x52e02e[_0x16e6('0x6d')]},'transaction':_0x48733f});})[_0x16e6('0x23')](function(){return db[_0x16e6('0x2a')][_0x16e6('0x5c')]({'where':{'id':_0x45bc01},'cascade':!![],'transaction':_0x48733f});})[_0x16e6('0x23')](function(_0x2b86a8){if(_0x2b86a8===0x0){_0x140345['sendStatus'](0x194);}else{return db[_0x16e6('0x51')]['destroy']({'where':{'type':_0x16e6('0x4c'),'resourceId':_0x45bc01},'cascade':!![],'transaction':_0x48733f})[_0x16e6('0x23')](function(){_0x140345[_0x16e6('0x1a')](0xcc)['end']();});}})[_0x16e6('0x42')](function(_0x102020){_0x140345[_0x16e6('0x1a')](0x1f4)[_0x16e6('0x27')](_0x102020);});});};exports[_0x16e6('0x6e')]=function(_0x117b90,_0x3c0991,_0x39b091){return db[_0x16e6('0x2a')]['findOne']({'where':{'id':_0x117b90[_0x16e6('0x53')]['id']}})[_0x16e6('0x23')](handleEntityNotFound(_0x3c0991,null))['then'](function(_0x143f7e){if(!_0x117b90[_0x16e6('0x30')][_0x16e6('0x6f')]||!utils[_0x16e6('0x70')](_0x117b90['query']['channel'])){throw new db[(_0x16e6('0x5a'))][(_0x16e6('0x71'))](_0x16e6('0x72'));}var _0x5f430b={};var _0x1bfcb8={};_0x1bfcb8[_0x16e6('0x2f')]=_[_0x16e6('0x31')](db[_[_0x16e6('0x73')](_0x117b90[_0x16e6('0x30')][_0x16e6('0x6f')][_0x16e6('0x74')]())+_0x16e6('0x75')][_0x16e6('0x2b')]);_0x1bfcb8[_0x16e6('0x30')]=_[_0x16e6('0x31')](_0x117b90[_0x16e6('0x30')]);_0x1bfcb8['filters']=_['intersection'](_0x1bfcb8['model'],_0x1bfcb8[_0x16e6('0x30')]);_0x5f430b[_0x16e6('0x34')]=_['intersection'](_0x1bfcb8['model'],qs[_0x16e6('0x35')](_0x117b90[_0x16e6('0x30')][_0x16e6('0x35')]));_0x5f430b['attributes']=_0x5f430b[_0x16e6('0x34')]['length']?_0x5f430b[_0x16e6('0x34')]:_0x1bfcb8[_0x16e6('0x2f')];_0x5f430b[_0x16e6('0x1f')]=qs['limit'](_0x117b90[_0x16e6('0x30')][_0x16e6('0x1f')]);_0x5f430b[_0x16e6('0x1c')]=qs[_0x16e6('0x1c')](_0x117b90[_0x16e6('0x30')][_0x16e6('0x1c')]);_0x5f430b[_0x16e6('0x76')]=qs['sort'](_0x117b90[_0x16e6('0x30')][_0x16e6('0x38')]);_0x5f430b[_0x16e6('0x39')]=qs['filters'](_[_0x16e6('0x3a')](_0x117b90[_0x16e6('0x30')],_0x1bfcb8[_0x16e6('0x32')]));_0x5f430b=_[_0x16e6('0x3c')]({},_0x5f430b,_0x117b90[_0x16e6('0x3e')]);return _0x143f7e['get'+_[_0x16e6('0x73')](_0x117b90[_0x16e6('0x30')][_0x16e6('0x6f')]['toLowerCase']())+'Queues'](_0x5f430b);})[_0x16e6('0x23')](respondWithResult(_0x3c0991,null))['catch'](handleError(_0x3c0991,null));};exports[_0x16e6('0x77')]=function(_0x440dc7,_0x349131,_0x1b3113){return db[_0x16e6('0x2a')][_0x16e6('0x78')]({'where':{'id':_0x440dc7['params']['id']}})[_0x16e6('0x23')](function(_0x2d0c3b){if(_0x2d0c3b){if(!_0x440dc7[_0x16e6('0x47')][_0x16e6('0x6f')]||!utils[_0x16e6('0x70')](_0x440dc7[_0x16e6('0x47')]['channel'])){throw new db[(_0x16e6('0x5a'))]['ValidationError'](_0x16e6('0x72'));}return _0x2d0c3b[_0x16e6('0x79')+_['capitalize'](_0x440dc7[_0x16e6('0x47')][_0x16e6('0x6f')][_0x16e6('0x74')]())+_0x16e6('0x7a')](_0x440dc7[_0x16e6('0x47')][_0x16e6('0x7b')]);}return null;})[_0x16e6('0x23')](handleEntityNotFound(_0x349131,null))[_0x16e6('0x23')](respondWithStatusCode(_0x349131,null))[_0x16e6('0x42')](handleError(_0x349131,null));};exports[_0x16e6('0x7c')]=function(_0x5df0b7,_0x91af8,_0x27e353){return db['Team']['findOne']({'where':{'id':_0x5df0b7['params']['id']}})[_0x16e6('0x23')](function(_0x521a05){if(_0x521a05){if(!_0x5df0b7[_0x16e6('0x30')][_0x16e6('0x6f')]||!utils[_0x16e6('0x70')](_0x5df0b7['query']['channel'])){throw new db[(_0x16e6('0x5a'))]['ValidationError']('Unknown\x20channel');}return _0x521a05[_0x16e6('0x7d')+_[_0x16e6('0x73')](_0x5df0b7['query']['channel'][_0x16e6('0x74')]())+'Queues'](_0x5df0b7[_0x16e6('0x30')]['ids']);}return null;})[_0x16e6('0x23')](handleEntityNotFound(_0x91af8,null))['then'](respondWithStatusCode(_0x91af8,null))[_0x16e6('0x42')](handleError(_0x91af8,null));};exports['addAgents']=function(_0x196b3d,_0x4ccf80){var _0x3d4238=_[_0x16e6('0x7e')](_0x196b3d[_0x16e6('0x47')]['ids'])?_0x196b3d[_0x16e6('0x47')][_0x16e6('0x7b')]:[_0x196b3d[_0x16e6('0x47')][_0x16e6('0x7b')]];var _0x486b45=_0x196b3d[_0x16e6('0x53')]['id'];return db[_0x16e6('0x2a')][_0x16e6('0x4e')]({'where':{'id':_0x486b45}})[_0x16e6('0x23')](handleEntityNotFound(_0x4ccf80,null))[_0x16e6('0x23')](function(_0x81394a){if(_0x81394a){var _0x4f265f=[_0x16e6('0x7f'),'Chat',_0x16e6('0x80'),_0x16e6('0x81'),_0x16e6('0x82'),_0x16e6('0x83'),'Whatsapp'];return db['sequelize'][_0x16e6('0x54')](function(_0x3535d5){var _0x113cfa=_[_0x16e6('0x29')](_0x4f265f,function(_0x518546){var _0x4ea439={'attributes':['id',_0x16e6('0x26')]};if(_0x518546===_0x16e6('0x7f')){_0x4ea439[_0x16e6('0x84')]={'attributes':[_0x16e6('0x85')]};}return _0x81394a['get'+_0x518546+_0x16e6('0x7a')](_0x4ea439)[_0x16e6('0x23')](function(_0x53b286){var _0x13e9d6=_['map'](_0x53b286,function(_0x9c55b0){var _0x4efa3e=_['map'](_0x3d4238,function(_0x1d8c58){var _0x13f3c5={'where':{'UserId':_0x1d8c58,[_0x518546+'QueueId']:_0x9c55b0['id']},'transaction':_0x3535d5};if(_0x518546===_0x16e6('0x7f')){_0x13f3c5[_0x16e6('0x16')]={'penalty':_0x9c55b0[_0x16e6('0x86')][_0x16e6('0x85')]};}return db[_0x16e6('0x87')+_0x518546+'Queue'][_0x16e6('0x88')](_0x13f3c5)['then'](function(){socket[_0x16e6('0x89')]('user'+_0x518546+_0x16e6('0x8a'),{'UserId':_0x1d8c58,[_0x518546+_0x16e6('0x8b')]:_0x9c55b0['id']});if(_0x518546!==_0x16e6('0x7f')){return;}return db[_0x16e6('0x87')][_0x16e6('0x40')]({'where':{'id':_0x3d4238,'online':0x1},'attributes':['id',_0x16e6('0x26'),'online','voicePause',_0x16e6('0x8c')],'raw':!![]})[_0x16e6('0x23')](function(_0x500858){var _0x3a53d5=_[_0x16e6('0x29')](_0x500858,function(_0x21b9fe){return db[_0x16e6('0x8d')][_0x16e6('0x8e')]({'membername':_0x21b9fe[_0x16e6('0x26')],'UserId':_0x21b9fe['id'],'queue_name':_0x9c55b0[_0x16e6('0x26')],'VoiceQueueId':_0x9c55b0['id'],'interface':_[_0x16e6('0x8f')](_0x21b9fe[_0x16e6('0x8c')])?util[_0x16e6('0x90')](_0x16e6('0x91'),_0x21b9fe[_0x16e6('0x26')]):_0x21b9fe[_0x16e6('0x8c')],'paused':_0x21b9fe[_0x16e6('0x92')]||![],'penalty':_0x9c55b0[_0x16e6('0x86')][_0x16e6('0x85')]},{'transaction':_0x3535d5});});return Promise[_0x16e6('0x93')](_0x3a53d5);});});});return Promise['all'](_0x4efa3e);});return Promise['all'](_0x13e9d6);})[_0x16e6('0x23')](function(){return db[_0x16e6('0x94')][_0x16e6('0x78')]({'where':{'teamId':_0x486b45}})[_0x16e6('0x23')](function(_0x57244e){if(_0x57244e){var _0x48cb4e=_['map'](_0x3d4238,function(_0x492c56){db[_0x16e6('0x95')][_0x16e6('0x8e')]({'UserId':_0x492c56,'VoicePrefixId':_0x57244e[_0x16e6('0x6d')]});});return Promise['all'](_0x48cb4e);}});});});return Promise['all'](_0x113cfa)['then'](function(){return _0x81394a[_0x16e6('0x96')](_0x3d4238,{'transaction':_0x3535d5})['spread'](function(_0x1f8be4){return _0x1f8be4;});});});}})[_0x16e6('0x23')](respondWithResult(_0x4ccf80,null))[_0x16e6('0x42')](handleError(_0x4ccf80,null));};exports[_0x16e6('0x97')]=function(_0x3990c1,_0x308b40){var _0x53e8bf=_[_0x16e6('0x7e')](_0x3990c1[_0x16e6('0x30')][_0x16e6('0x7b')])?_0x3990c1[_0x16e6('0x30')][_0x16e6('0x7b')]:[_0x3990c1[_0x16e6('0x30')][_0x16e6('0x7b')]];var _0x576fe5=_0x3990c1[_0x16e6('0x53')]['id'];return db[_0x16e6('0x2a')][_0x16e6('0x4e')]({'where':{'id':_0x576fe5}})['then'](handleEntityNotFound(_0x308b40,null))[_0x16e6('0x23')](function(_0x766661){if(_0x766661){var _0x1d6c7c=['Voice',_0x16e6('0x98'),_0x16e6('0x80'),_0x16e6('0x81'),_0x16e6('0x82'),_0x16e6('0x83'),_0x16e6('0x99')];return db[_0x16e6('0x55')][_0x16e6('0x54')](function(_0x2d1034){var _0x1332a7=_[_0x16e6('0x29')](_0x1d6c7c,function(_0x570241){var _0x16dea2={'attributes':['id','name']};return _0x766661['get'+_0x570241+_0x16e6('0x7a')](_0x16dea2)[_0x16e6('0x23')](function(_0x50c386){var _0x14e867=_[_0x16e6('0x29')](_0x50c386,function(_0x213e7c){return _0x213e7c['removeAgents'](_0x53e8bf,{'transaction':_0x2d1034})[_0x16e6('0x23')](function(){var _0x21add3=_[_0x16e6('0x29')](_0x53e8bf,function(_0x4a51c5){socket[_0x16e6('0x89')](_0x16e6('0x4b')+_0x570241+'Queue:remove',{'UserId':Number(_0x4a51c5),[_0x570241+'QueueId']:_0x213e7c['id']});if(_0x570241!==_0x16e6('0x7f')){return;}return db[_0x16e6('0x8d')]['destroy']({'where':{'VoiceQueueId':_0x213e7c['id'],'UserId':_0x4a51c5},'transaction':_0x2d1034});});return Promise[_0x16e6('0x93')](_0x21add3);});});return Promise[_0x16e6('0x93')](_0x14e867);});});return Promise[_0x16e6('0x93')](_0x1332a7)[_0x16e6('0x23')](function(){return _0x766661[_0x16e6('0x97')](_0x53e8bf,{'transaction':_0x2d1034});})['then'](function(){return db[_0x16e6('0x94')][_0x16e6('0x78')]({'where':{'teamId':_0x576fe5}})['then'](function(_0x35ee51){if(_0x35ee51){var _0x3df95f=_['map'](_0x53e8bf,function(_0x4ffed5){db[_0x16e6('0x95')][_0x16e6('0x5c')]({'where':{'UserId':_0x4ffed5,'VoicePrefixId':_0x35ee51[_0x16e6('0x6d')]}});});return Promise[_0x16e6('0x93')](_0x3df95f);}});});});}})[_0x16e6('0x23')](respondWithStatusCode(_0x308b40,null))['catch'](handleError(_0x308b40,null));};exports['getAgents']=function(_0x2fbb45,_0x3ba523,_0x2337a9){var _0x2e55d7={};var _0x2a9b3a={};var _0x2cd457;var _0x289262;return db[_0x16e6('0x2a')][_0x16e6('0x78')]({'where':{'id':_0x2fbb45[_0x16e6('0x53')]['id']}})[_0x16e6('0x23')](handleEntityNotFound(_0x3ba523,null))['then'](function(_0x4cde8f){if(_0x4cde8f){_0x2cd457=_0x4cde8f;_0x2a9b3a['model']=_[_0x16e6('0x31')](db[_0x16e6('0x87')][_0x16e6('0x2b')]);_0x2a9b3a[_0x16e6('0x30')]=_[_0x16e6('0x31')](_0x2fbb45['query']);_0x2a9b3a[_0x16e6('0x32')]=_[_0x16e6('0x33')](_0x2a9b3a[_0x16e6('0x2f')],_0x2a9b3a[_0x16e6('0x30')]);_0x2e55d7[_0x16e6('0x34')]=_[_0x16e6('0x33')](_0x2a9b3a[_0x16e6('0x2f')],qs[_0x16e6('0x35')](_0x2fbb45['query'][_0x16e6('0x35')]));_0x2e55d7[_0x16e6('0x34')]=_0x2e55d7[_0x16e6('0x34')]['length']?_0x2e55d7[_0x16e6('0x34')]:_0x2a9b3a[_0x16e6('0x2f')];_0x2e55d7[_0x16e6('0x76')]=qs['sort'](_0x2fbb45['query']['sort']);_0x2e55d7[_0x16e6('0x39')]=qs[_0x16e6('0x32')](_['pick'](_0x2fbb45['query'],_0x2a9b3a[_0x16e6('0x32')]));if(_0x2fbb45[_0x16e6('0x30')][_0x16e6('0x3b')]){_0x2e55d7['where']=_[_0x16e6('0x3c')](_0x2e55d7[_0x16e6('0x39')],{'$or':_[_0x16e6('0x29')](_0x2e55d7[_0x16e6('0x34')],function(_0x542371){var _0x1aa711={};_0x1aa711[_0x542371]={'$like':'%'+_0x2fbb45[_0x16e6('0x30')][_0x16e6('0x3b')]+'%'};return _0x1aa711;})});}_0x2e55d7=_[_0x16e6('0x3c')]({},_0x2e55d7,_0x2fbb45[_0x16e6('0x3e')]);return _0x2cd457[_0x16e6('0x9a')](_0x2e55d7);}})[_0x16e6('0x23')](function(_0x4ed865){if(_0x4ed865){_0x289262=_0x4ed865[_0x16e6('0x44')];if(!_0x2fbb45[_0x16e6('0x30')][_0x16e6('0x36')](_0x16e6('0x37'))){_0x2e55d7['limit']=qs[_0x16e6('0x1f')](_0x2fbb45[_0x16e6('0x30')][_0x16e6('0x1f')]);_0x2e55d7['offset']=qs[_0x16e6('0x1c')](_0x2fbb45[_0x16e6('0x30')][_0x16e6('0x1c')]);}return _0x2cd457[_0x16e6('0x9a')](_0x2e55d7);}})[_0x16e6('0x23')](function(_0x2906b5){if(_0x2906b5){return _0x2906b5?{'count':_0x289262,'rows':_0x2906b5}:null;}})[_0x16e6('0x23')](respondWithResult(_0x3ba523,null))[_0x16e6('0x42')](handleError(_0x3ba523,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 411f1bf..b107212 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 _0x75d9=['Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5791b0,_0x377b88){var _0x33b904=function(_0x882d3){while(--_0x882d3){_0x5791b0['push'](_0x5791b0['shift']());}};_0x33b904(++_0x377b88);}(_0x75d9,0xda));var _0x975d=function(_0x5e7514,_0x30c2e1){_0x5e7514=_0x5e7514-0x0;var _0x12f472=_0x75d9[_0x5e7514];return _0x12f472;};'use strict';var EventEmitter=require(_0x975d('0x0'));var Team=require(_0x975d('0x1'))['db'][_0x975d('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x975d('0x3')](0x0);var events={'afterCreate':_0x975d('0x4'),'afterUpdate':_0x975d('0x5'),'afterDestroy':_0x975d('0x6')};function emitEvent(_0x57c095){return function(_0xca79b4,_0x451dae,_0x2a64ea){TeamEvents[_0x975d('0x7')](_0x57c095+':'+_0xca79b4['id'],_0xca79b4);TeamEvents['emit'](_0x57c095,_0xca79b4);_0x2a64ea(null);};}for(var e in events){if(events[_0x975d('0x8')](e)){var event=events[e];Team[_0x975d('0x9')](e,emitEvent(event));}}module[_0x975d('0xa')]=TeamEvents; \ No newline at end of file +var _0xc064=['../../mysqldb','Team','emit','hasOwnProperty','exports','events'];(function(_0x563201,_0x9b82b6){var _0xa91133=function(_0x149db4){while(--_0x149db4){_0x563201['push'](_0x563201['shift']());}};_0xa91133(++_0x9b82b6);}(_0xc064,0x1af));var _0x4c06=function(_0x5aefb8,_0x8db666){_0x5aefb8=_0x5aefb8-0x0;var _0x257c0a=_0xc064[_0x5aefb8];return _0x257c0a;};'use strict';var EventEmitter=require(_0x4c06('0x0'));var Team=require(_0x4c06('0x1'))['db'][_0x4c06('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x21b91){return function(_0x1095bf,_0x22c71a,_0x4c66ea){TeamEvents[_0x4c06('0x3')](_0x21b91+':'+_0x1095bf['id'],_0x1095bf);TeamEvents[_0x4c06('0x3')](_0x21b91,_0x1095bf);_0x4c66ea(null);};}for(var e in events){if(events[_0x4c06('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x4c06('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c6f625a..1827632 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 _0x2d85=['Chat','Fax','Openchannel','resolve','all','lodash','./team.attributes','get','Queues','setDataValue','channel','catch','exports','define','Team','teams'];(function(_0x320c77,_0x317b9c){var _0xe647ff=function(_0xc99eb1){while(--_0xc99eb1){_0x320c77['push'](_0x320c77['shift']());}};_0xe647ff(++_0x317b9c);}(_0x2d85,0x1d5));var _0x52d8=function(_0x33cb1a,_0x5822b1){_0x33cb1a=_0x33cb1a-0x0;var _0x221897=_0x2d85[_0x33cb1a];return _0x221897;};'use strict';var _=require(_0x52d8('0x0'));var attributes=require(_0x52d8('0x1'));function getQueuesByChannel(_0x54fbbf,_0x5a3df0){var _0x3bc785=_0x52d8('0x2')+_0x5a3df0+_0x52d8('0x3');return _0x54fbbf[_0x3bc785]()['then'](function(_0x357181){return _['map'](_0x357181,function(_0x553f39){_0x553f39[_0x52d8('0x4')](_0x52d8('0x5'),_0x5a3df0);return _0x553f39;});})[_0x52d8('0x6')](function(_0x2cb5bc){throw _0x2cb5bc;});}module[_0x52d8('0x7')]=function(_0x494882){return _0x494882[_0x52d8('0x8')](_0x52d8('0x9'),attributes,{'tableName':_0x52d8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x62c481=this;var _0x80767=[_0x52d8('0xb'),_0x52d8('0xc'),'Mail',_0x52d8('0xd'),'Sms','Voice','Whatsapp'];return Promise[_0x52d8('0xe')]()['then'](function(){var _0x173684=_['map'](_0x80767,function(_0x321a61){return getQueuesByChannel(_0x62c481,_0x321a61);});return Promise[_0x52d8('0xf')](_0x173684);})['catch'](function(_0x410d36){throw _0x410d36;});}}});}; \ No newline at end of file +var _0x7cb7=['Team','teams','Chat','Mail','Voice','Whatsapp','resolve','all','lodash','then','map','setDataValue','channel','catch','exports','define'];(function(_0x2ebfcc,_0x58f78f){var _0x5970fa=function(_0x1a5af0){while(--_0x1a5af0){_0x2ebfcc['push'](_0x2ebfcc['shift']());}};_0x5970fa(++_0x58f78f);}(_0x7cb7,0xc8));var _0x77cb=function(_0x1ab516,_0x331ba9){_0x1ab516=_0x1ab516-0x0;var _0x2a293e=_0x7cb7[_0x1ab516];return _0x2a293e;};'use strict';var _=require(_0x77cb('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x4a698b,_0x1b1318){var _0x4298ba='get'+_0x1b1318+'Queues';return _0x4a698b[_0x4298ba]()[_0x77cb('0x1')](function(_0x5b92ec){return _[_0x77cb('0x2')](_0x5b92ec,function(_0x55f3e8){_0x55f3e8[_0x77cb('0x3')](_0x77cb('0x4'),_0x1b1318);return _0x55f3e8;});})[_0x77cb('0x5')](function(_0x2a7078){throw _0x2a7078;});}module[_0x77cb('0x6')]=function(_0x4d0d56){return _0x4d0d56[_0x77cb('0x7')](_0x77cb('0x8'),attributes,{'tableName':_0x77cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2464f3=this;var _0x134d89=[_0x77cb('0xa'),'Fax',_0x77cb('0xb'),'Openchannel','Sms',_0x77cb('0xc'),_0x77cb('0xd')];return Promise[_0x77cb('0xe')]()[_0x77cb('0x1')](function(){var _0xbf01e9=_[_0x77cb('0x2')](_0x134d89,function(_0x38490c){return getQueuesByChannel(_0x2464f3,_0x38490c);});return Promise[_0x77cb('0xf')](_0xbf01e9);})[_0x77cb('0x5')](function(_0x20d488){throw _0x20d488;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f736fe0..17c9f46 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 _0x7f9c=['then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x3f82ac,_0x19a440){var _0x24bbba=function(_0x833896){while(--_0x833896){_0x3f82ac['push'](_0x3f82ac['shift']());}};_0x24bbba(++_0x19a440);}(_0x7f9c,0x1d9));var _0xc7f9=function(_0x25dfba,_0x596998){_0x25dfba=_0x25dfba-0x0;var _0x222ac9=_0x7f9c[_0x25dfba];return _0x222ac9;};'use strict';var _=require(_0xc7f9('0x0'));var util=require(_0xc7f9('0x1'));var moment=require(_0xc7f9('0x2'));var BPromise=require(_0xc7f9('0x3'));var rs=require(_0xc7f9('0x4'));var fs=require('fs');var Redis=require(_0xc7f9('0x5'));var db=require(_0xc7f9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7f9('0x7'))(_0xc7f9('0x8'));var config=require(_0xc7f9('0x9'));var jayson=require(_0xc7f9('0xa'));var client=jayson[_0xc7f9('0xb')][_0xc7f9('0xc')]({'port':0x232a});config[_0xc7f9('0xd')]=_[_0xc7f9('0xe')](config['redis'],{'host':_0xc7f9('0xf'),'port':0x18eb});var socket=require(_0xc7f9('0x10'))(new Redis(config[_0xc7f9('0xd')]));require(_0xc7f9('0x11'))[_0xc7f9('0x12')](socket);function respondWithRpcPromise(_0x47219a,_0x34271c,_0x472095){return new BPromise(function(_0x4f2f50,_0x3e4e50){return client[_0xc7f9('0x13')](_0x47219a,_0x472095)[_0xc7f9('0x14')](function(_0x2859ec){logger[_0xc7f9('0x15')](_0xc7f9('0x16'),_0x34271c,_0xc7f9('0x17'));logger['debug'](_0xc7f9('0x18'),_0x34271c,'request\x20sent',JSON[_0xc7f9('0x19')](_0x2859ec));if(_0x2859ec[_0xc7f9('0x1a')]){if(_0x2859ec[_0xc7f9('0x1a')][_0xc7f9('0x1b')]===0x1f4){logger[_0xc7f9('0x1a')]('Team,\x20%s,\x20%s',_0x34271c,_0x2859ec[_0xc7f9('0x1a')][_0xc7f9('0x1c')]);return _0x3e4e50(_0x2859ec[_0xc7f9('0x1a')][_0xc7f9('0x1c')]);}logger['error'](_0xc7f9('0x16'),_0x34271c,_0x2859ec[_0xc7f9('0x1a')][_0xc7f9('0x1c')]);return _0x4f2f50(_0x2859ec[_0xc7f9('0x1a')][_0xc7f9('0x1c')]);}else{logger[_0xc7f9('0x15')](_0xc7f9('0x16'),_0x34271c,_0xc7f9('0x17'));_0x4f2f50(_0x2859ec['result'][_0xc7f9('0x1c')]);}})['catch'](function(_0x319ef0){logger[_0xc7f9('0x1a')]('Team,\x20%s,\x20%s',_0x34271c,_0x319ef0);_0x3e4e50(_0x319ef0);});});} \ No newline at end of file +var _0xc7d7=['stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x2dfaec,_0x387ea1){var _0x50ffff=function(_0x376536){while(--_0x376536){_0x2dfaec['push'](_0x2dfaec['shift']());}};_0x50ffff(++_0x387ea1);}(_0xc7d7,0x11a));var _0x7c7d=function(_0x836e67,_0x23b165){_0x836e67=_0x836e67-0x0;var _0x178ba4=_0xc7d7[_0x836e67];return _0x178ba4;};'use strict';var _=require(_0x7c7d('0x0'));var util=require('util');var moment=require(_0x7c7d('0x1'));var BPromise=require(_0x7c7d('0x2'));var rs=require(_0x7c7d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7c7d('0x5'));var config=require(_0x7c7d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c7d('0x7')][_0x7c7d('0x8')]({'port':0x232a});config['redis']=_[_0x7c7d('0x9')](config[_0x7c7d('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c7d('0xa')]));require(_0x7c7d('0xb'))[_0x7c7d('0xc')](socket);function respondWithRpcPromise(_0xcdf007,_0x157fcc,_0x3dd405){return new BPromise(function(_0x5b386d,_0x5ddf6c){return client[_0x7c7d('0xd')](_0xcdf007,_0x3dd405)['then'](function(_0xec41a1){logger[_0x7c7d('0xe')](_0x7c7d('0xf'),_0x157fcc,'request\x20sent');logger[_0x7c7d('0x10')](_0x7c7d('0x11'),_0x157fcc,'request\x20sent',JSON[_0x7c7d('0x12')](_0xec41a1));if(_0xec41a1[_0x7c7d('0x13')]){if(_0xec41a1[_0x7c7d('0x13')][_0x7c7d('0x14')]===0x1f4){logger[_0x7c7d('0x13')](_0x7c7d('0xf'),_0x157fcc,_0xec41a1[_0x7c7d('0x13')][_0x7c7d('0x15')]);return _0x5ddf6c(_0xec41a1[_0x7c7d('0x13')][_0x7c7d('0x15')]);}logger[_0x7c7d('0x13')](_0x7c7d('0xf'),_0x157fcc,_0xec41a1[_0x7c7d('0x13')][_0x7c7d('0x15')]);return _0x5b386d(_0xec41a1[_0x7c7d('0x13')][_0x7c7d('0x15')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x157fcc,_0x7c7d('0x16'));_0x5b386d(_0xec41a1[_0x7c7d('0x17')][_0x7c7d('0x15')]);}})[_0x7c7d('0x18')](function(_0x46f640){logger[_0x7c7d('0x13')](_0x7c7d('0xf'),_0x157fcc,_0x46f640);_0x5ddf6c(_0x46f640);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c252687..87bc684 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 _0xa786=['./team.events','save','remove','update','removeListener','register','length'];(function(_0x190c3f,_0x52e7d6){var _0x55fadb=function(_0x1ff5f3){while(--_0x1ff5f3){_0x190c3f['push'](_0x190c3f['shift']());}};_0x55fadb(++_0x52e7d6);}(_0xa786,0x1f1));var _0x6a78=function(_0x1f6f79,_0xbe5522){_0x1f6f79=_0x1f6f79-0x0;var _0x2d8e7d=_0xa786[_0x1f6f79];return _0x2d8e7d;};'use strict';var TeamEvents=require(_0x6a78('0x0'));var events=[_0x6a78('0x1'),_0x6a78('0x2'),_0x6a78('0x3')];function createListener(_0x6002b8,_0x29c1b5){return function(_0x185973){_0x29c1b5['emit'](_0x6002b8,_0x185973);};}function removeListener(_0x2f9133,_0x28cc9f){return function(){TeamEvents[_0x6a78('0x4')](_0x2f9133,_0x28cc9f);};}exports[_0x6a78('0x5')]=function(_0x5624df){for(var _0x152b20=0x0,_0x34deae=events[_0x6a78('0x6')];_0x152b20<_0x34deae;_0x152b20++){var _0x55482c=events[_0x152b20];var _0x58d2bc=createListener('team:'+_0x55482c,_0x5624df);TeamEvents['on'](_0x55482c,_0x58d2bc);}}; \ No newline at end of file +var _0xfca2=['emit','register','length','team:','./team.events','remove','update'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0xfca2,0x6d));var _0x2fca=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0xfca2[_0x5d1044];return _0x3cd90e;};'use strict';var TeamEvents=require(_0x2fca('0x0'));var events=['save',_0x2fca('0x1'),_0x2fca('0x2')];function createListener(_0x7acaf8,_0x96bab8){return function(_0x28a583){_0x96bab8[_0x2fca('0x3')](_0x7acaf8,_0x28a583);};}function removeListener(_0x23361b,_0xb17e73){return function(){TeamEvents['removeListener'](_0x23361b,_0xb17e73);};}exports[_0x2fca('0x4')]=function(_0xc65361){for(var _0xfa36ca=0x0,_0x459131=events[_0x2fca('0x5')];_0xfa36ca<_0x459131;_0xfa36ca++){var _0x54bb89=events[_0xfa36ca];var _0x34151b=createListener(_0x2fca('0x6')+_0x54bb89,_0xc65361);TeamEvents['on'](_0x54bb89,_0x34151b);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 56bff15..610a810 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 _0x1a9c=['INTEGER'];(function(_0x4ea012,_0x443b5c){var _0x1bd446=function(_0x378d27){while(--_0x378d27){_0x4ea012['push'](_0x4ea012['shift']());}};_0x1bd446(++_0x443b5c);}(_0x1a9c,0xff));var _0xc1a9=function(_0x266c93,_0x53bced){_0x266c93=_0x266c93-0x0;var _0x892106=_0x1a9c[_0x266c93];return _0x892106;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xc1a9('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xc1a9('0x0')]}}; \ No newline at end of file +var _0x3ef0=['sequelize','INTEGER'];(function(_0x55d27a,_0x2be62c){var _0x22d271=function(_0x387536){while(--_0x387536){_0x55d27a['push'](_0x55d27a['shift']());}};_0x22d271(++_0x2be62c);}(_0x3ef0,0x19a));var _0x03ef=function(_0x279629,_0x82681e){_0x279629=_0x279629-0x0;var _0x31c8a4=_0x3ef0[_0x279629];return _0x31c8a4;};'use strict';var Sequelize=require(_0x03ef('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x03ef('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 54a003c..b563e8a 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ba6=['bluebird','request-promise','path','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','../../config/logger','moment'];(function(_0x58bf8f,_0x5f19d7){var _0x3f82e8=function(_0x32a25c){while(--_0x32a25c){_0x58bf8f['push'](_0x58bf8f['shift']());}};_0x3f82e8(++_0x5f19d7);}(_0x8ba6,0x11b));var _0x68ba=function(_0x5ca7d4,_0x509066){_0x5ca7d4=_0x5ca7d4-0x0;var _0x469015=_0x8ba6[_0x5ca7d4];return _0x469015;};'use strict';var _=require(_0x68ba('0x0'));var util=require('util');var logger=require(_0x68ba('0x1'))('api');var moment=require(_0x68ba('0x2'));var BPromise=require(_0x68ba('0x3'));var rp=require(_0x68ba('0x4'));var fs=require('fs');var path=require(_0x68ba('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x68ba('0x6'));module[_0x68ba('0x7')]=function(_0x14f5f6,_0x183957){return _0x14f5f6[_0x68ba('0x8')](_0x68ba('0x9'),attributes,{'tableName':_0x68ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','TeamVoicePrefix'];(function(_0x1c97d8,_0x593cb2){var _0x35853a=function(_0x161c20){while(--_0x161c20){_0x1c97d8['push'](_0x1c97d8['shift']());}};_0x35853a(++_0x593cb2);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3349ac,_0x889beb){_0x3349ac=_0x3349ac-0x0;var _0x18d071=_0x8f4c[_0x3349ac];return _0x18d071;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),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 7311a5f..5678680 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x31f1d7,_0x44aeae){var _0x26f3e1=function(_0x50ed6a){while(--_0x50ed6a){_0x31f1d7['push'](_0x31f1d7['shift']());}};_0x26f3e1(++_0x44aeae);}(_0xedd9,0xfc));var _0x9edd=function(_0x256c98,_0x3447bc){_0x256c98=_0x256c98-0x0;var _0x475e4c=_0xedd9[_0x256c98];return _0x475e4c;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44f4c5,_0x60cd8b){var _0x35cf6a=function(_0x43a904){while(--_0x43a904){_0x44f4c5['push'](_0x44f4c5['shift']());}};_0x35cf6a(++_0x60cd8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 0ceeba2..b56c6e2 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 _0xab6f=['exports','INTEGER','sequelize'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xab6f,0x1af));var _0xfab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab6f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfab6('0x0'));module[_0xfab6('0x1')]={'penalty':{'type':Sequelize[_0xfab6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d84=['INTEGER','sequelize','exports'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x8d84,0x64));var _0x48d8=function(_0x1880af,_0x2948d4){_0x1880af=_0x1880af-0x0;var _0x218579=_0x8d84[_0x1880af];return _0x218579;};'use strict';var Sequelize=require(_0x48d8('0x0'));module[_0x48d8('0x1')]={'penalty':{'type':Sequelize[_0x48d8('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 79939d7..788a3b9 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 _0xd493=['bluebird','rimraf','../../config/environment','define','TeamVoiceQueue','lodash','../../config/logger','api'];(function(_0x51ccc4,_0x41c347){var _0x2b23c1=function(_0x2ae2ad){while(--_0x2ae2ad){_0x51ccc4['push'](_0x51ccc4['shift']());}};_0x2b23c1(++_0x41c347);}(_0xd493,0x1bd));var _0x3d49=function(_0x13095a,_0x599e5e){_0x13095a=_0x13095a-0x0;var _0x211fa2=_0xd493[_0x13095a];return _0x211fa2;};'use strict';var _=require(_0x3d49('0x0'));var util=require('util');var logger=require(_0x3d49('0x1'))(_0x3d49('0x2'));var moment=require('moment');var BPromise=require(_0x3d49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d49('0x4'));var config=require(_0x3d49('0x5'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0x1550e0,_0x1316f4){return _0x1550e0[_0x3d49('0x6')](_0x3d49('0x7'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fb=['define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x1a9204,_0x3328bc){var _0x501fa2=function(_0x43a43b){while(--_0x43a43b){_0x1a9204['push'](_0x1a9204['shift']());}};_0x501fa2(++_0x3328bc);}(_0xf6fb,0x111));var _0xbf6f=function(_0x4b8377,_0x50d1c3){_0x4b8377=_0x4b8377-0x0;var _0x58506f=_0xf6fb[_0x4b8377];return _0x58506f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf6f('0x0'))(_0xbf6f('0x1'));var moment=require('moment');var BPromise=require(_0xbf6f('0x2'));var rp=require(_0xbf6f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf6f('0x4'));var config=require('../../config/environment');var attributes=require(_0xbf6f('0x5'));module[_0xbf6f('0x6')]=function(_0x2d8ffb,_0x370983){return _0x2d8ffb[_0xbf6f('0x7')](_0xbf6f('0x8'),attributes,{'tableName':_0xbf6f('0x9'),'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 06b6ae9..2a075c9 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 _0x8388=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','info','result','catch','lodash','util'];(function(_0x28a5eb,_0x513eac){var _0xb4d010=function(_0x201a4d){while(--_0x201a4d){_0x28a5eb['push'](_0x28a5eb['shift']());}};_0xb4d010(++_0x513eac);}(_0x8388,0x18d));var _0x8838=function(_0x271537,_0x8b7b3b){_0x271537=_0x271537-0x0;var _0x19dc22=_0x8388[_0x271537];return _0x19dc22;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var moment=require(_0x8838('0x2'));var BPromise=require(_0x8838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8838('0x4'));var db=require(_0x8838('0x5'))['db'];var utils=require(_0x8838('0x6'));var logger=require(_0x8838('0x7'))(_0x8838('0x8'));var config=require('../../config/environment');var jayson=require(_0x8838('0x9'));var client=jayson[_0x8838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xca2d0f,_0x2d9615,_0x27707c){return new BPromise(function(_0x56596f,_0x4645f4){return client['request'](_0xca2d0f,_0x27707c)['then'](function(_0x8555b2){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x2d9615,_0x8838('0xb'));logger[_0x8838('0xc')](_0x8838('0xd'),_0x2d9615,_0x8838('0xb'),JSON['stringify'](_0x8555b2));if(_0x8555b2[_0x8838('0xe')]){if(_0x8555b2[_0x8838('0xe')][_0x8838('0xf')]===0x1f4){logger[_0x8838('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d9615,_0x8555b2[_0x8838('0xe')]['message']);return _0x4645f4(_0x8555b2['error'][_0x8838('0x10')]);}logger[_0x8838('0xe')](_0x8838('0x11'),_0x2d9615,_0x8555b2[_0x8838('0xe')][_0x8838('0x10')]);return _0x56596f(_0x8555b2[_0x8838('0xe')][_0x8838('0x10')]);}else{logger[_0x8838('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d9615,_0x8838('0xb'));_0x56596f(_0x8555b2[_0x8838('0x13')]['message']);}})[_0x8838('0x14')](function(_0xab3fb8){logger[_0x8838('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2d9615,_0xab3fb8);_0x4645f4(_0xab3fb8);});});} \ No newline at end of file +var _0x02e5=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe6ad32,_0x346005){var _0x483d39=function(_0x4099dd){while(--_0x4099dd){_0xe6ad32['push'](_0xe6ad32['shift']());}};_0x483d39(++_0x346005);}(_0x02e5,0x132));var _0x502e=function(_0xc39752,_0x34338a){_0xc39752=_0xc39752-0x0;var _0x5c4099=_0x02e5[_0xc39752];return _0x5c4099;};'use strict';var _=require(_0x502e('0x0'));var util=require(_0x502e('0x1'));var moment=require(_0x502e('0x2'));var BPromise=require('bluebird');var rs=require(_0x502e('0x3'));var fs=require('fs');var Redis=require(_0x502e('0x4'));var db=require(_0x502e('0x5'))['db'];var utils=require(_0x502e('0x6'));var logger=require(_0x502e('0x7'))(_0x502e('0x8'));var config=require(_0x502e('0x9'));var jayson=require(_0x502e('0xa'));var client=jayson[_0x502e('0xb')][_0x502e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38efb2,_0x1f97dd,_0x257de3){return new BPromise(function(_0x4432d1,_0x2a461e){return client[_0x502e('0xd')](_0x38efb2,_0x257de3)[_0x502e('0xe')](function(_0x2fc2ec){logger[_0x502e('0xf')](_0x502e('0x10'),_0x1f97dd,_0x502e('0x11'));logger[_0x502e('0x12')](_0x502e('0x13'),_0x1f97dd,'request\x20sent',JSON[_0x502e('0x14')](_0x2fc2ec));if(_0x2fc2ec['error']){if(_0x2fc2ec['error'][_0x502e('0x15')]===0x1f4){logger[_0x502e('0x16')](_0x502e('0x10'),_0x1f97dd,_0x2fc2ec[_0x502e('0x16')][_0x502e('0x17')]);return _0x2a461e(_0x2fc2ec[_0x502e('0x16')]['message']);}logger[_0x502e('0x16')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1f97dd,_0x2fc2ec[_0x502e('0x16')][_0x502e('0x17')]);return _0x4432d1(_0x2fc2ec[_0x502e('0x16')][_0x502e('0x17')]);}else{logger[_0x502e('0xf')](_0x502e('0x10'),_0x1f97dd,_0x502e('0x11'));_0x4432d1(_0x2fc2ec['result'][_0x502e('0x17')]);}})[_0x502e('0x18')](function(_0x59df43){logger[_0x502e('0x16')](_0x502e('0x10'),_0x1f97dd,_0x59df43);_0x2a461e(_0x59df43);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 3aa1680..53fdad8 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 _0x5d59=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','post','create','update','delete','destroy','exports','util'];(function(_0x34e1c7,_0x38196c){var _0x444b5e=function(_0x23f04e){while(--_0x23f04e){_0x34e1c7['push'](_0x34e1c7['shift']());}};_0x444b5e(++_0x38196c);}(_0x5d59,0x15f));var _0x95d5=function(_0x5d6105,_0x1f5ca9){_0x5d6105=_0x5d6105-0x0;var _0x15f36e=_0x5d59[_0x5d6105];return _0x15f36e;};'use strict';var multer=require('multer');var util=require(_0x95d5('0x0'));var path=require(_0x95d5('0x1'));var timeout=require(_0x95d5('0x2'));var express=require(_0x95d5('0x3'));var router=express[_0x95d5('0x4')]();var fs_extra=require(_0x95d5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95d5('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x95d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x95d5('0x7')](_0x95d5('0x8'),auth[_0x95d5('0x9')](),controller['show']);router[_0x95d5('0xa')]('/',auth['isAuthenticated'](),controller[_0x95d5('0xb')]);router['put'](_0x95d5('0x8'),auth[_0x95d5('0x9')](),controller[_0x95d5('0xc')]);router[_0x95d5('0xd')](_0x95d5('0x8'),auth[_0x95d5('0x9')](),controller[_0x95d5('0xe')]);module[_0x95d5('0xf')]=router; \ No newline at end of file +var _0x0650=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','delete','multer','path','connect-timeout'];(function(_0x5938d8,_0x52d748){var _0xa99dc9=function(_0x2fa8f3){while(--_0x2fa8f3){_0x5938d8['push'](_0x5938d8['shift']());}};_0xa99dc9(++_0x52d748);}(_0x0650,0xed));var _0x0065=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x0650[_0x234ce7];return _0x57c561;};'use strict';var multer=require(_0x0065('0x0'));var util=require('util');var path=require(_0x0065('0x1'));var timeout=require(_0x0065('0x2'));var express=require('express');var router=express[_0x0065('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0065('0x4'));var interaction=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var controller=require('./template.controller');router[_0x0065('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0065('0x8'),auth[_0x0065('0x9')](),controller[_0x0065('0xa')]);router[_0x0065('0xb')]('/',auth[_0x0065('0x9')](),controller[_0x0065('0xc')]);router[_0x0065('0xd')](_0x0065('0x8'),auth[_0x0065('0x9')](),controller['update']);router[_0x0065('0xe')](_0x0065('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0b43fa1..b58c3a0 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 _0xc765=['STRING','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc765,0x11e));var _0x5c76=function(_0x4d8c6e,_0x2dfeee){_0x4d8c6e=_0x4d8c6e-0x0;var _0x436e25=_0xc765[_0x4d8c6e];return _0x436e25;};'use strict';var Sequelize=require(_0x5c76('0x0'));module[_0x5c76('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5c76('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe4fc=['STRING','TEXT','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xe4fc,0x134));var _0xce4f=function(_0x13c774,_0x4d3531){_0x13c774=_0x13c774-0x0;var _0x5ae4e7=_0xe4fc[_0x13c774];return _0x5ae4e7;};'use strict';var Sequelize=require('sequelize');module[_0xce4f('0x0')]={'name':{'type':Sequelize[_0xce4f('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xce4f('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0967fe3..514eaae 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 _0x0d5f=['set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','error','name','send','map','rawAttributes','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Template','include','findAll','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count'];(function(_0x3fe9bb,_0x32a5fd){var _0x32186c=function(_0xa6e3c){while(--_0xa6e3c){_0x3fe9bb['push'](_0x3fe9bb['shift']());}};_0x32186c(++_0x32a5fd);}(_0x0d5f,0x115));var _0xf0d5=function(_0x44a7e7,_0x3b6c3c){_0x44a7e7=_0x44a7e7-0x0;var _0x2e1355=_0x0d5f[_0x44a7e7];return _0x2e1355;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0d5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf0d5('0x1'));var util=require(_0xf0d5('0x2'));var path=require('path');var sox=require(_0xf0d5('0x3'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0d5('0x4'));var _=require('lodash');var squel=require(_0xf0d5('0x5'));var crypto=require(_0xf0d5('0x6'));var jsforce=require(_0xf0d5('0x7'));var deskjs=require(_0xf0d5('0x8'));var toCsv=require(_0xf0d5('0x9'));var querystring=require(_0xf0d5('0xa'));var Papa=require(_0xf0d5('0xb'));var Redis=require(_0xf0d5('0xc'));var authService=require(_0xf0d5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf0d5('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0d5('0xf'));var utils=require(_0xf0d5('0x10'));var config=require(_0xf0d5('0x11'));var licenseUtil=require(_0xf0d5('0x12'));var db=require(_0xf0d5('0x13'))['db'];function respondWithStatusCode(_0x2ad3f1,_0x5ac1c3){_0x5ac1c3=_0x5ac1c3||0xcc;return function(_0x39394a){if(_0x39394a){return _0x2ad3f1[_0xf0d5('0x14')](_0x5ac1c3);}return _0x2ad3f1[_0xf0d5('0x15')](_0x5ac1c3)[_0xf0d5('0x16')]();};}function respondWithResult(_0x13d4cd,_0x39d220){_0x39d220=_0x39d220||0xc8;return function(_0x54c7a7){if(_0x54c7a7){return _0x13d4cd['status'](_0x39d220)[_0xf0d5('0x17')](_0x54c7a7);}};}function respondWithFilteredResult(_0x4f50df,_0x30180c){return function(_0x3504cb){if(_0x3504cb){var _0x13945a=typeof _0x30180c[_0xf0d5('0x18')]==='undefined'&&typeof _0x30180c[_0xf0d5('0x19')]==='undefined';var _0x28463b=_0x3504cb[_0xf0d5('0x1a')];var _0xca78cf=_0x13945a?0x0:_0x30180c[_0xf0d5('0x18')];var _0xb80187=_0x13945a?_0x3504cb[_0xf0d5('0x1a')]:_0x30180c['offset']+_0x30180c[_0xf0d5('0x19')];var _0x2546fe;if(_0xb80187>=_0x28463b){_0xb80187=_0x28463b;_0x2546fe=0xc8;}else{_0x2546fe=0xce;}_0x4f50df[_0xf0d5('0x15')](_0x2546fe);return _0x4f50df[_0xf0d5('0x1b')](_0xf0d5('0x1c'),_0xca78cf+'-'+_0xb80187+'/'+_0x28463b)[_0xf0d5('0x17')](_0x3504cb);}return null;};}function patchUpdates(_0x2ca333){return function(_0x4bbacc){try{jsonpatch[_0xf0d5('0x1d')](_0x4bbacc,_0x2ca333,!![]);}catch(_0x2b81d5){return BPromise[_0xf0d5('0x1e')](_0x2b81d5);}return _0x4bbacc['save']();};}function saveUpdates(_0x15d31d,_0x138c71){return function(_0x52c742){if(_0x52c742){return _0x52c742[_0xf0d5('0x1f')](_0x15d31d)['then'](function(_0x5eba5e){return _0x5eba5e;});}return null;};}function removeEntity(_0x5e1b82,_0x35c9a5){return function(_0x3d4d56){if(_0x3d4d56){return _0x3d4d56[_0xf0d5('0x20')]()[_0xf0d5('0x21')](function(){var _0x1d9ce6=_0x3d4d56[_0xf0d5('0x22')]({'plain':!![]});var _0x4432ab='Templates';return db[_0xf0d5('0x23')][_0xf0d5('0x20')]({'where':{'type':_0x4432ab,'resourceId':_0x1d9ce6['id']}})[_0xf0d5('0x21')](function(){return _0x3d4d56;});})[_0xf0d5('0x21')](function(){_0x5e1b82[_0xf0d5('0x15')](0xcc)[_0xf0d5('0x16')]();});}};}function handleEntityNotFound(_0x191042,_0x42f3df){return function(_0x98f38e){if(!_0x98f38e){_0x191042[_0xf0d5('0x14')](0x194);}return _0x98f38e;};}function handleError(_0x5cbf9f,_0x196d43){_0x196d43=_0x196d43||0x1f4;return function(_0x36670a){logger[_0xf0d5('0x24')](_0x36670a['stack']);if(_0x36670a[_0xf0d5('0x25')]){delete _0x36670a[_0xf0d5('0x25')];}_0x5cbf9f[_0xf0d5('0x15')](_0x196d43)[_0xf0d5('0x26')](_0x36670a);};}exports['index']=function(_0x50f4f6,_0xda73b2){var _0xd27cd7={},_0x574cf9={},_0x217cf1={'count':0x0,'rows':[]};var _0x2473ff=_[_0xf0d5('0x27')](db['Template'][_0xf0d5('0x28')],function(_0x2cb875){return{'name':_0x2cb875['fieldName'],'type':_0x2cb875['type']['key']};});_0x574cf9[_0xf0d5('0x29')]=_[_0xf0d5('0x27')](_0x2473ff,_0xf0d5('0x25'));_0x574cf9[_0xf0d5('0x2a')]=_['keys'](_0x50f4f6['query']);_0x574cf9[_0xf0d5('0x2b')]=_['intersection'](_0x574cf9['model'],_0x574cf9[_0xf0d5('0x2a')]);_0xd27cd7[_0xf0d5('0x2c')]=_[_0xf0d5('0x2d')](_0x574cf9[_0xf0d5('0x29')],qs['fields'](_0x50f4f6['query']['fields']));_0xd27cd7['attributes']=_0xd27cd7[_0xf0d5('0x2c')][_0xf0d5('0x2e')]?_0xd27cd7[_0xf0d5('0x2c')]:_0x574cf9[_0xf0d5('0x29')];if(!_0x50f4f6[_0xf0d5('0x2a')][_0xf0d5('0x2f')](_0xf0d5('0x30'))){_0xd27cd7[_0xf0d5('0x19')]=qs[_0xf0d5('0x19')](_0x50f4f6['query'][_0xf0d5('0x19')]);_0xd27cd7[_0xf0d5('0x18')]=qs[_0xf0d5('0x18')](_0x50f4f6[_0xf0d5('0x2a')]['offset']);}_0xd27cd7[_0xf0d5('0x31')]=qs[_0xf0d5('0x32')](_0x50f4f6[_0xf0d5('0x2a')][_0xf0d5('0x32')]);_0xd27cd7[_0xf0d5('0x33')]=qs[_0xf0d5('0x2b')](_[_0xf0d5('0x34')](_0x50f4f6[_0xf0d5('0x2a')],_0x574cf9['filters']),_0x2473ff);if(_0x50f4f6[_0xf0d5('0x2a')][_0xf0d5('0x35')]){_0xd27cd7[_0xf0d5('0x33')]=_[_0xf0d5('0x36')](_0xd27cd7['where'],{'$or':_[_0xf0d5('0x27')](_0x2473ff,function(_0x4a6671){if(_0x4a6671[_0xf0d5('0x37')]!==_0xf0d5('0x38')){var _0x2d50ad={};_0x2d50ad[_0x4a6671[_0xf0d5('0x25')]]={'$like':'%'+_0x50f4f6[_0xf0d5('0x2a')][_0xf0d5('0x35')]+'%'};return _0x2d50ad;}})});}_0xd27cd7=_['merge']({},_0xd27cd7,_0x50f4f6[_0xf0d5('0x39')]);var _0x537dc0={'where':_0xd27cd7[_0xf0d5('0x33')]};return db[_0xf0d5('0x3a')][_0xf0d5('0x1a')](_0x537dc0)['then'](function(_0x26ba12){_0x217cf1['count']=_0x26ba12;if(_0x50f4f6['query']['includeAll']){_0xd27cd7[_0xf0d5('0x3b')]=[{'all':!![]}];}return db[_0xf0d5('0x3a')][_0xf0d5('0x3c')](_0xd27cd7);})['then'](function(_0x45d339){_0x217cf1['rows']=_0x45d339;return _0x217cf1;})[_0xf0d5('0x21')](respondWithFilteredResult(_0xda73b2,_0xd27cd7))[_0xf0d5('0x3d')](handleError(_0xda73b2,null));};exports[_0xf0d5('0x3e')]=function(_0xff1818,_0x501df6){var _0x52521e={'raw':!![],'where':{'id':_0xff1818[_0xf0d5('0x3f')]['id']}},_0x19881d={};_0x19881d[_0xf0d5('0x29')]=_[_0xf0d5('0x40')](db[_0xf0d5('0x3a')][_0xf0d5('0x28')]);_0x19881d[_0xf0d5('0x2a')]=_[_0xf0d5('0x40')](_0xff1818[_0xf0d5('0x2a')]);_0x19881d[_0xf0d5('0x2b')]=_[_0xf0d5('0x2d')](_0x19881d['model'],_0x19881d['query']);_0x52521e[_0xf0d5('0x2c')]=_['intersection'](_0x19881d[_0xf0d5('0x29')],qs[_0xf0d5('0x41')](_0xff1818[_0xf0d5('0x2a')][_0xf0d5('0x41')]));_0x52521e[_0xf0d5('0x2c')]=_0x52521e[_0xf0d5('0x2c')][_0xf0d5('0x2e')]?_0x52521e['attributes']:_0x19881d['model'];if(_0xff1818[_0xf0d5('0x2a')]['includeAll']){_0x52521e[_0xf0d5('0x3b')]=[{'all':!![]}];}_0x52521e=_[_0xf0d5('0x36')]({},_0x52521e,_0xff1818[_0xf0d5('0x39')]);return db['Template'][_0xf0d5('0x42')](_0x52521e)['then'](handleEntityNotFound(_0x501df6,null))['then'](respondWithResult(_0x501df6,null))[_0xf0d5('0x3d')](handleError(_0x501df6,null));};exports['create']=function(_0x4dbb7a,_0x3e19ef){return db['Template'][_0xf0d5('0x43')](_0x4dbb7a[_0xf0d5('0x44')],{})['then'](function(_0x1a8586){var _0x203c4a=_0x4dbb7a[_0xf0d5('0x45')]['get']({'plain':!![]});if(!_0x203c4a)throw new Error(_0xf0d5('0x46'));if(_0x203c4a['role']===_0xf0d5('0x45')){var _0x50e00f=_0x1a8586['get']({'plain':!![]});var _0x4eb840=_0xf0d5('0x47');return db[_0xf0d5('0x48')][_0xf0d5('0x42')]({'where':{'name':_0x4eb840,'userProfileId':_0x203c4a[_0xf0d5('0x49')]},'raw':!![]})['then'](function(_0x260099){if(_0x260099&&_0x260099[_0xf0d5('0x4a')]===0x0){return db[_0xf0d5('0x23')][_0xf0d5('0x43')]({'name':_0x50e00f[_0xf0d5('0x25')],'resourceId':_0x50e00f['id'],'type':_0x260099[_0xf0d5('0x25')],'sectionId':_0x260099['id']},{})['then'](function(){return _0x1a8586;});}else{return _0x1a8586;}})[_0xf0d5('0x3d')](function(_0x4161d5){logger[_0xf0d5('0x24')](_0xf0d5('0x4b'),_0x4161d5);throw _0x4161d5;});}return _0x1a8586;})['then'](respondWithResult(_0x3e19ef,0xc9))['catch'](handleError(_0x3e19ef,null));};exports[_0xf0d5('0x1f')]=function(_0x36fc12,_0x593a2b){if(_0x36fc12['body']['id']){delete _0x36fc12[_0xf0d5('0x44')]['id'];}return db[_0xf0d5('0x3a')][_0xf0d5('0x42')]({'where':{'id':_0x36fc12['params']['id']}})[_0xf0d5('0x21')](handleEntityNotFound(_0x593a2b,null))[_0xf0d5('0x21')](saveUpdates(_0x36fc12[_0xf0d5('0x44')],null))[_0xf0d5('0x21')](respondWithResult(_0x593a2b,null))[_0xf0d5('0x3d')](handleError(_0x593a2b,null));};exports[_0xf0d5('0x20')]=function(_0x1d22a7,_0x51b0c0){return db['Template']['find']({'where':{'id':_0x1d22a7[_0xf0d5('0x3f')]['id']}})['then'](handleEntityNotFound(_0x51b0c0,null))[_0xf0d5('0x21')](removeEntity(_0x51b0c0,null))['catch'](handleError(_0x51b0c0,null));}; \ No newline at end of file +var _0x9bc8=['filter','merge','Template','findAll','rows','catch','show','params','keys','length','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x45d886,_0x694715){var _0x3c1904=function(_0x120ec1){while(--_0x120ec1){_0x45d886['push'](_0x45d886['shift']());}};_0x3c1904(++_0x694715);}(_0x9bc8,0x68));var _0x89bc=function(_0x3dc2a4,_0x224ebd){_0x3dc2a4=_0x3dc2a4-0x0;var _0x347524=_0x9bc8[_0x3dc2a4];return _0x347524;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89bc('0x0'));var zipdir=require(_0x89bc('0x1'));var jsonpatch=require(_0x89bc('0x2'));var rp=require('request-promise');var moment=require(_0x89bc('0x3'));var BPromise=require(_0x89bc('0x4'));var Mustache=require(_0x89bc('0x5'));var util=require('util');var path=require(_0x89bc('0x6'));var sox=require(_0x89bc('0x7'));var csv=require(_0x89bc('0x8'));var ejs=require(_0x89bc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89bc('0xa'));var squel=require(_0x89bc('0xb'));var crypto=require(_0x89bc('0xc'));var jsforce=require(_0x89bc('0xd'));var deskjs=require(_0x89bc('0xe'));var toCsv=require(_0x89bc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89bc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89bc('0x10'));var logger=require(_0x89bc('0x11'))(_0x89bc('0x12'));var utils=require(_0x89bc('0x13'));var config=require(_0x89bc('0x14'));var licenseUtil=require(_0x89bc('0x15'));var db=require(_0x89bc('0x16'))['db'];function respondWithStatusCode(_0x4cfe77,_0x57d666){_0x57d666=_0x57d666||0xcc;return function(_0x39dde3){if(_0x39dde3){return _0x4cfe77['sendStatus'](_0x57d666);}return _0x4cfe77[_0x89bc('0x17')](_0x57d666)[_0x89bc('0x18')]();};}function respondWithResult(_0x1f09bb,_0x45f7bc){_0x45f7bc=_0x45f7bc||0xc8;return function(_0x1a7e16){if(_0x1a7e16){return _0x1f09bb[_0x89bc('0x17')](_0x45f7bc)[_0x89bc('0x19')](_0x1a7e16);}};}function respondWithFilteredResult(_0x5a6eb4,_0x170dee){return function(_0x5d5e01){if(_0x5d5e01){var _0x52cc32=typeof _0x170dee[_0x89bc('0x1a')]==='undefined'&&typeof _0x170dee[_0x89bc('0x1b')]===_0x89bc('0x1c');var _0x4e412e=_0x5d5e01[_0x89bc('0x1d')];var _0x3f4afb=_0x52cc32?0x0:_0x170dee[_0x89bc('0x1a')];var _0x1f0f74=_0x52cc32?_0x5d5e01[_0x89bc('0x1d')]:_0x170dee['offset']+_0x170dee[_0x89bc('0x1b')];var _0x12ec0c;if(_0x1f0f74>=_0x4e412e){_0x1f0f74=_0x4e412e;_0x12ec0c=0xc8;}else{_0x12ec0c=0xce;}_0x5a6eb4['status'](_0x12ec0c);return _0x5a6eb4[_0x89bc('0x1e')](_0x89bc('0x1f'),_0x3f4afb+'-'+_0x1f0f74+'/'+_0x4e412e)[_0x89bc('0x19')](_0x5d5e01);}return null;};}function patchUpdates(_0x81f4b){return function(_0x4f01c4){try{jsonpatch[_0x89bc('0x20')](_0x4f01c4,_0x81f4b,!![]);}catch(_0xc41af0){return BPromise[_0x89bc('0x21')](_0xc41af0);}return _0x4f01c4[_0x89bc('0x22')]();};}function saveUpdates(_0x26c901,_0x3c1b46){return function(_0xb6f9da){if(_0xb6f9da){return _0xb6f9da[_0x89bc('0x23')](_0x26c901)[_0x89bc('0x24')](function(_0x17a703){return _0x17a703;});}return null;};}function removeEntity(_0x39e19d,_0x2b4bd4){return function(_0x3c5730){if(_0x3c5730){return _0x3c5730[_0x89bc('0x25')]()[_0x89bc('0x24')](function(){var _0x5f09e1=_0x3c5730[_0x89bc('0x26')]({'plain':!![]});var _0x428148=_0x89bc('0x27');return db[_0x89bc('0x28')]['destroy']({'where':{'type':_0x428148,'resourceId':_0x5f09e1['id']}})[_0x89bc('0x24')](function(){return _0x3c5730;});})[_0x89bc('0x24')](function(){_0x39e19d[_0x89bc('0x17')](0xcc)[_0x89bc('0x18')]();});}};}function handleEntityNotFound(_0x465e66,_0x286ea3){return function(_0x477366){if(!_0x477366){_0x465e66[_0x89bc('0x29')](0x194);}return _0x477366;};}function handleError(_0x1d9999,_0x2225cc){_0x2225cc=_0x2225cc||0x1f4;return function(_0x1b9a39){logger[_0x89bc('0x2a')](_0x1b9a39[_0x89bc('0x2b')]);if(_0x1b9a39[_0x89bc('0x2c')]){delete _0x1b9a39[_0x89bc('0x2c')];}_0x1d9999[_0x89bc('0x17')](_0x2225cc)[_0x89bc('0x2d')](_0x1b9a39);};}exports[_0x89bc('0x2e')]=function(_0x4354c2,_0x5cac09){var _0x13ce0f={},_0x1a1319={},_0x1a3dd3={'count':0x0,'rows':[]};var _0x2fad0c=_['map'](db['Template'][_0x89bc('0x2f')],function(_0x27eada){return{'name':_0x27eada[_0x89bc('0x30')],'type':_0x27eada[_0x89bc('0x31')]['key']};});_0x1a1319[_0x89bc('0x32')]=_[_0x89bc('0x33')](_0x2fad0c,_0x89bc('0x2c'));_0x1a1319['query']=_['keys'](_0x4354c2[_0x89bc('0x34')]);_0x1a1319[_0x89bc('0x35')]=_[_0x89bc('0x36')](_0x1a1319[_0x89bc('0x32')],_0x1a1319[_0x89bc('0x34')]);_0x13ce0f[_0x89bc('0x37')]=_[_0x89bc('0x36')](_0x1a1319[_0x89bc('0x32')],qs['fields'](_0x4354c2[_0x89bc('0x34')][_0x89bc('0x38')]));_0x13ce0f[_0x89bc('0x37')]=_0x13ce0f[_0x89bc('0x37')]['length']?_0x13ce0f['attributes']:_0x1a1319[_0x89bc('0x32')];if(!_0x4354c2['query'][_0x89bc('0x39')](_0x89bc('0x3a'))){_0x13ce0f[_0x89bc('0x1b')]=qs[_0x89bc('0x1b')](_0x4354c2[_0x89bc('0x34')]['limit']);_0x13ce0f[_0x89bc('0x1a')]=qs[_0x89bc('0x1a')](_0x4354c2[_0x89bc('0x34')][_0x89bc('0x1a')]);}_0x13ce0f[_0x89bc('0x3b')]=qs[_0x89bc('0x3c')](_0x4354c2[_0x89bc('0x34')][_0x89bc('0x3c')]);_0x13ce0f[_0x89bc('0x3d')]=qs[_0x89bc('0x35')](_['pick'](_0x4354c2['query'],_0x1a1319[_0x89bc('0x35')]),_0x2fad0c);if(_0x4354c2[_0x89bc('0x34')][_0x89bc('0x3e')]){_0x13ce0f[_0x89bc('0x3d')]=_[_0x89bc('0x3f')](_0x13ce0f['where'],{'$or':_[_0x89bc('0x33')](_0x2fad0c,function(_0x459824){if(_0x459824[_0x89bc('0x31')]!=='VIRTUAL'){var _0x1f2dec={};_0x1f2dec[_0x459824['name']]={'$like':'%'+_0x4354c2[_0x89bc('0x34')][_0x89bc('0x3e')]+'%'};return _0x1f2dec;}})});}_0x13ce0f=_['merge']({},_0x13ce0f,_0x4354c2['options']);var _0x1c0308={'where':_0x13ce0f[_0x89bc('0x3d')]};return db['Template']['count'](_0x1c0308)['then'](function(_0x3f80a3){_0x1a3dd3[_0x89bc('0x1d')]=_0x3f80a3;if(_0x4354c2[_0x89bc('0x34')]['includeAll']){_0x13ce0f['include']=[{'all':!![]}];}return db[_0x89bc('0x40')][_0x89bc('0x41')](_0x13ce0f);})[_0x89bc('0x24')](function(_0x39096b){_0x1a3dd3[_0x89bc('0x42')]=_0x39096b;return _0x1a3dd3;})[_0x89bc('0x24')](respondWithFilteredResult(_0x5cac09,_0x13ce0f))[_0x89bc('0x43')](handleError(_0x5cac09,null));};exports[_0x89bc('0x44')]=function(_0x355a52,_0x55974d){var _0x38ff28={'raw':!![],'where':{'id':_0x355a52[_0x89bc('0x45')]['id']}},_0x133048={};_0x133048[_0x89bc('0x32')]=_[_0x89bc('0x46')](db[_0x89bc('0x40')][_0x89bc('0x2f')]);_0x133048[_0x89bc('0x34')]=_[_0x89bc('0x46')](_0x355a52[_0x89bc('0x34')]);_0x133048[_0x89bc('0x35')]=_[_0x89bc('0x36')](_0x133048[_0x89bc('0x32')],_0x133048['query']);_0x38ff28['attributes']=_[_0x89bc('0x36')](_0x133048['model'],qs[_0x89bc('0x38')](_0x355a52['query'][_0x89bc('0x38')]));_0x38ff28[_0x89bc('0x37')]=_0x38ff28[_0x89bc('0x37')][_0x89bc('0x47')]?_0x38ff28[_0x89bc('0x37')]:_0x133048[_0x89bc('0x32')];if(_0x355a52[_0x89bc('0x34')][_0x89bc('0x48')]){_0x38ff28[_0x89bc('0x49')]=[{'all':!![]}];}_0x38ff28=_[_0x89bc('0x3f')]({},_0x38ff28,_0x355a52['options']);return db[_0x89bc('0x40')]['find'](_0x38ff28)[_0x89bc('0x24')](handleEntityNotFound(_0x55974d,null))[_0x89bc('0x24')](respondWithResult(_0x55974d,null))[_0x89bc('0x43')](handleError(_0x55974d,null));};exports['create']=function(_0x3adc5a,_0x26abc5){return db[_0x89bc('0x40')][_0x89bc('0x4a')](_0x3adc5a[_0x89bc('0x4b')],{})[_0x89bc('0x24')](function(_0x453878){var _0xab8693=_0x3adc5a[_0x89bc('0x4c')][_0x89bc('0x26')]({'plain':!![]});if(!_0xab8693)throw new Error(_0x89bc('0x4d'));if(_0xab8693[_0x89bc('0x4e')]==='user'){var _0x1b9185=_0x453878['get']({'plain':!![]});var _0x5adbf0=_0x89bc('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5adbf0,'userProfileId':_0xab8693[_0x89bc('0x4f')]},'raw':!![]})['then'](function(_0x449903){if(_0x449903&&_0x449903[_0x89bc('0x50')]===0x0){return db['UserProfileResource'][_0x89bc('0x4a')]({'name':_0x1b9185[_0x89bc('0x2c')],'resourceId':_0x1b9185['id'],'type':_0x449903[_0x89bc('0x2c')],'sectionId':_0x449903['id']},{})[_0x89bc('0x24')](function(){return _0x453878;});}else{return _0x453878;}})[_0x89bc('0x43')](function(_0x1b4e7b){logger[_0x89bc('0x2a')](_0x89bc('0x51'),_0x1b4e7b);throw _0x1b4e7b;});}return _0x453878;})[_0x89bc('0x24')](respondWithResult(_0x26abc5,0xc9))[_0x89bc('0x43')](handleError(_0x26abc5,null));};exports[_0x89bc('0x23')]=function(_0x184a12,_0x470a05){if(_0x184a12[_0x89bc('0x4b')]['id']){delete _0x184a12[_0x89bc('0x4b')]['id'];}return db['Template'][_0x89bc('0x52')]({'where':{'id':_0x184a12[_0x89bc('0x45')]['id']}})['then'](handleEntityNotFound(_0x470a05,null))['then'](saveUpdates(_0x184a12[_0x89bc('0x4b')],null))[_0x89bc('0x24')](respondWithResult(_0x470a05,null))['catch'](handleError(_0x470a05,null));};exports[_0x89bc('0x25')]=function(_0xe64372,_0x2405da){return db[_0x89bc('0x40')]['find']({'where':{'id':_0xe64372[_0x89bc('0x45')]['id']}})[_0x89bc('0x24')](handleEntityNotFound(_0x2405da,null))[_0x89bc('0x24')](removeEntity(_0x2405da,null))['catch'](handleError(_0x2405da,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5a47551..364771f 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 _0x8c10=['api','moment','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','util','../../config/logger'];(function(_0x12d86b,_0x44aa90){var _0x36f3db=function(_0x55dacc){while(--_0x55dacc){_0x12d86b['push'](_0x12d86b['shift']());}};_0x36f3db(++_0x44aa90);}(_0x8c10,0x1ab));var _0x08c1=function(_0x5a659f,_0x30eca5){_0x5a659f=_0x5a659f-0x0;var _0x39faef=_0x8c10[_0x5a659f];return _0x39faef;};'use strict';var _=require('lodash');var util=require(_0x08c1('0x0'));var logger=require(_0x08c1('0x1'))(_0x08c1('0x2'));var moment=require(_0x08c1('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x08c1('0x4'));var rimraf=require(_0x08c1('0x5'));var config=require(_0x08c1('0x6'));var attributes=require(_0x08c1('0x7'));module[_0x08c1('0x8')]=function(_0x5de54e,_0x25b316){return _0x5de54e[_0x08c1('0x9')](_0x08c1('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39e2=['path','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','api','moment','request-promise'];(function(_0x2487b3,_0x9c573c){var _0x43df45=function(_0x4ae9e9){while(--_0x4ae9e9){_0x2487b3['push'](_0x2487b3['shift']());}};_0x43df45(++_0x9c573c);}(_0x39e2,0x128));var _0x239e=function(_0x56447f,_0x47d4f8){_0x56447f=_0x56447f-0x0;var _0x15557b=_0x39e2[_0x56447f];return _0x15557b;};'use strict';var _=require(_0x239e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x239e('0x1'));var moment=require(_0x239e('0x2'));var BPromise=require('bluebird');var rp=require(_0x239e('0x3'));var fs=require('fs');var path=require(_0x239e('0x4'));var rimraf=require('rimraf');var config=require(_0x239e('0x5'));var attributes=require(_0x239e('0x6'));module['exports']=function(_0x573f5c,_0x5cd74d){return _0x573f5c[_0x239e('0x7')](_0x239e('0x8'),attributes,{'tableName':_0x239e('0x9'),'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 39abaae..b3c85fe 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 _0xf2ba=['message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x167914,_0x87b5a){var _0x5e5d79=function(_0x221d4e){while(--_0x221d4e){_0x167914['push'](_0x167914['shift']());}};_0x5e5d79(++_0x87b5a);}(_0xf2ba,0xab));var _0xaf2b=function(_0xe95af,_0x4b849b){_0xe95af=_0xe95af-0x0;var _0x16effb=_0xf2ba[_0xe95af];return _0x16effb;};'use strict';var _=require(_0xaf2b('0x0'));var util=require(_0xaf2b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaf2b('0x2'));var fs=require('fs');var Redis=require(_0xaf2b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf2b('0x4'))(_0xaf2b('0x5'));var config=require(_0xaf2b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf2b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32081f,_0x29cf83,_0x59c0e9){return new BPromise(function(_0x429e47,_0xcd57b0){return client['request'](_0x32081f,_0x59c0e9)['then'](function(_0x3c3822){logger[_0xaf2b('0x8')](_0xaf2b('0x9'),_0x29cf83,_0xaf2b('0xa'));logger['debug'](_0xaf2b('0xb'),_0x29cf83,_0xaf2b('0xa'),JSON[_0xaf2b('0xc')](_0x3c3822));if(_0x3c3822['error']){if(_0x3c3822[_0xaf2b('0xd')][_0xaf2b('0xe')]===0x1f4){logger[_0xaf2b('0xd')](_0xaf2b('0x9'),_0x29cf83,_0x3c3822['error']['message']);return _0xcd57b0(_0x3c3822['error']['message']);}logger[_0xaf2b('0xd')](_0xaf2b('0x9'),_0x29cf83,_0x3c3822['error'][_0xaf2b('0xf')]);return _0x429e47(_0x3c3822['error']['message']);}else{logger[_0xaf2b('0x8')](_0xaf2b('0x9'),_0x29cf83,_0xaf2b('0xa'));_0x429e47(_0x3c3822[_0xaf2b('0x10')]['message']);}})[_0xaf2b('0x11')](function(_0x24ec4d){logger[_0xaf2b('0xd')](_0xaf2b('0x9'),_0x29cf83,_0x24ec4d);_0xcd57b0(_0x24ec4d);});});}exports[_0xaf2b('0x12')]=function(_0x1eaa58){var _0x14426c=this;return new Promise(function(_0x466534,_0x4641d7){return db[_0xaf2b('0x13')][_0xaf2b('0x14')]({'raw':_0x1eaa58['options']?_0x1eaa58[_0xaf2b('0x15')][_0xaf2b('0x16')]===undefined?!![]:![]:!![],'where':_0x1eaa58[_0xaf2b('0x15')]?_0x1eaa58[_0xaf2b('0x15')][_0xaf2b('0x17')]||null:null,'attributes':_0x1eaa58[_0xaf2b('0x15')]?_0x1eaa58['options'][_0xaf2b('0x18')]||null:null,'limit':_0x1eaa58['options']?_0x1eaa58[_0xaf2b('0x15')][_0xaf2b('0x19')]||null:null,'include':_0x1eaa58[_0xaf2b('0x15')]?_0x1eaa58[_0xaf2b('0x15')][_0xaf2b('0x1a')]?_['map'](_0x1eaa58[_0xaf2b('0x15')]['include'],function(_0x677dac){return{'model':db[_0x677dac[_0xaf2b('0x1b')]],'as':_0x677dac['as'],'attributes':_0x677dac['attributes'],'include':_0x677dac[_0xaf2b('0x1a')]?_['map'](_0x677dac['include'],function(_0x53a59d){return{'model':db[_0x53a59d[_0xaf2b('0x1b')]],'as':_0x53a59d['as'],'attributes':_0x53a59d[_0xaf2b('0x18')],'include':_0x53a59d[_0xaf2b('0x1a')]?_[_0xaf2b('0x1c')](_0x53a59d['include'],function(_0x200575){return{'model':db[_0x200575[_0xaf2b('0x1b')]],'as':_0x200575['as'],'attributes':_0x200575['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf2b('0x1d')](function(_0x5323e5){logger['info'](_0xaf2b('0x12'),_0x1eaa58);logger[_0xaf2b('0x1e')](_0xaf2b('0x12'),_0x1eaa58,JSON[_0xaf2b('0xc')](_0x5323e5));_0x466534(_0x5323e5);})['catch'](function(_0xb7b9d9){logger['error'](_0xaf2b('0x12'),_0xb7b9d9['message'],_0x1eaa58);_0x4641d7(_0x14426c['error'](0x1f4,_0xb7b9d9[_0xaf2b('0xf')]));});});}; \ No newline at end of file +var _0x4f0f=['jayson/promise','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x4f0f,0xdf));var _0xf4f0=function(_0x11c15b,_0x28de76){_0x11c15b=_0x11c15b-0x0;var _0x132c01=_0x4f0f[_0x11c15b];return _0x132c01;};'use strict';var _=require(_0xf4f0('0x0'));var util=require(_0xf4f0('0x1'));var moment=require(_0xf4f0('0x2'));var BPromise=require(_0xf4f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4f0('0x4'));var db=require(_0xf4f0('0x5'))['db'];var utils=require(_0xf4f0('0x6'));var logger=require('../../config/logger')(_0xf4f0('0x7'));var config=require('../../config/environment');var jayson=require(_0xf4f0('0x8'));var client=jayson['client'][_0xf4f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x793a01,_0x595027,_0x127bad){return new BPromise(function(_0x3157db,_0x1f3419){return client[_0xf4f0('0xa')](_0x793a01,_0x127bad)[_0xf4f0('0xb')](function(_0x212e81){logger[_0xf4f0('0xc')](_0xf4f0('0xd'),_0x595027,'request\x20sent');logger[_0xf4f0('0xe')](_0xf4f0('0xf'),_0x595027,_0xf4f0('0x10'),JSON[_0xf4f0('0x11')](_0x212e81));if(_0x212e81[_0xf4f0('0x12')]){if(_0x212e81[_0xf4f0('0x12')]['code']===0x1f4){logger[_0xf4f0('0x12')](_0xf4f0('0xd'),_0x595027,_0x212e81[_0xf4f0('0x12')][_0xf4f0('0x13')]);return _0x1f3419(_0x212e81[_0xf4f0('0x12')]['message']);}logger['error'](_0xf4f0('0xd'),_0x595027,_0x212e81[_0xf4f0('0x12')][_0xf4f0('0x13')]);return _0x3157db(_0x212e81[_0xf4f0('0x12')]['message']);}else{logger[_0xf4f0('0xc')]('Template,\x20%s,\x20%s',_0x595027,'request\x20sent');_0x3157db(_0x212e81[_0xf4f0('0x14')]['message']);}})[_0xf4f0('0x15')](function(_0x4182c6){logger[_0xf4f0('0x12')](_0xf4f0('0xd'),_0x595027,_0x4182c6);_0x1f3419(_0x4182c6);});});}exports[_0xf4f0('0x16')]=function(_0x3fcd8f){var _0x10388b=this;return new Promise(function(_0xfc1755,_0x1184ce){return db[_0xf4f0('0x17')][_0xf4f0('0x18')]({'raw':_0x3fcd8f[_0xf4f0('0x19')]?_0x3fcd8f[_0xf4f0('0x19')][_0xf4f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x3fcd8f[_0xf4f0('0x19')]?_0x3fcd8f['options'][_0xf4f0('0x1b')]||null:null,'attributes':_0x3fcd8f[_0xf4f0('0x19')]?_0x3fcd8f[_0xf4f0('0x19')][_0xf4f0('0x1c')]||null:null,'limit':_0x3fcd8f[_0xf4f0('0x19')]?_0x3fcd8f[_0xf4f0('0x19')][_0xf4f0('0x1d')]||null:null,'include':_0x3fcd8f[_0xf4f0('0x19')]?_0x3fcd8f[_0xf4f0('0x19')][_0xf4f0('0x1e')]?_[_0xf4f0('0x1f')](_0x3fcd8f[_0xf4f0('0x19')][_0xf4f0('0x1e')],function(_0x50358c){return{'model':db[_0x50358c[_0xf4f0('0x20')]],'as':_0x50358c['as'],'attributes':_0x50358c['attributes'],'include':_0x50358c[_0xf4f0('0x1e')]?_['map'](_0x50358c[_0xf4f0('0x1e')],function(_0x1cfe65){return{'model':db[_0x1cfe65[_0xf4f0('0x20')]],'as':_0x1cfe65['as'],'attributes':_0x1cfe65[_0xf4f0('0x1c')],'include':_0x1cfe65[_0xf4f0('0x1e')]?_[_0xf4f0('0x1f')](_0x1cfe65[_0xf4f0('0x1e')],function(_0x34a3f8){return{'model':db[_0x34a3f8[_0xf4f0('0x20')]],'as':_0x34a3f8['as'],'attributes':_0x34a3f8[_0xf4f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4f0('0xb')](function(_0x446473){logger[_0xf4f0('0xc')](_0xf4f0('0x16'),_0x3fcd8f);logger[_0xf4f0('0xe')](_0xf4f0('0x16'),_0x3fcd8f,JSON[_0xf4f0('0x11')](_0x446473));_0xfc1755(_0x446473);})['catch'](function(_0x2059a4){logger[_0xf4f0('0x12')](_0xf4f0('0x16'),_0x2059a4['message'],_0x3fcd8f);_0x1184ce(_0x10388b['error'](0x1f4,_0x2059a4[_0xf4f0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2375b29..9cb2467 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 _0xb233=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','/:id/any_conditions','addAnyCondition','put','update','delete','destroy','exports'];(function(_0x5623c8,_0x14b259){var _0x4e73ea=function(_0x48f566){while(--_0x48f566){_0x5623c8['push'](_0x5623c8['shift']());}};_0x4e73ea(++_0x14b259);}(_0xb233,0x15e));var _0x3b23=function(_0x214631,_0x4237fb){_0x214631=_0x214631-0x0;var _0x23a417=_0xb233[_0x214631];return _0x23a417;};'use strict';var multer=require('multer');var util=require(_0x3b23('0x0'));var path=require(_0x3b23('0x1'));var timeout=require(_0x3b23('0x2'));var express=require('express');var router=express[_0x3b23('0x3')]();var fs_extra=require(_0x3b23('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3b23('0x5'));var config=require(_0x3b23('0x6'));var controller=require('./trigger.controller');router[_0x3b23('0x7')]('/',auth[_0x3b23('0x8')](),controller[_0x3b23('0x9')]);router[_0x3b23('0x7')](_0x3b23('0xa'),auth[_0x3b23('0x8')](),controller[_0x3b23('0xb')]);router[_0x3b23('0x7')]('/:id/all_conditions',auth[_0x3b23('0x8')](),controller['getAllConditions']);router[_0x3b23('0x7')]('/:id/any_conditions',auth[_0x3b23('0x8')](),controller[_0x3b23('0xc')]);router['get']('/:id/actions',auth[_0x3b23('0x8')](),controller[_0x3b23('0xd')]);router[_0x3b23('0xe')]('/',auth['isAuthenticated'](),controller[_0x3b23('0xf')]);router[_0x3b23('0xe')](_0x3b23('0x10'),auth['isAuthenticated'](),controller[_0x3b23('0x11')]);router[_0x3b23('0xe')](_0x3b23('0x12'),auth['isAuthenticated'](),controller[_0x3b23('0x13')]);router['post']('/:id/actions',auth[_0x3b23('0x8')](),controller['addAction']);router[_0x3b23('0x14')](_0x3b23('0xa'),auth[_0x3b23('0x8')](),controller[_0x3b23('0x15')]);router[_0x3b23('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3b23('0x17')]);module[_0x3b23('0x18')]=router; \ No newline at end of file +var _0xe34e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','/:id','show','/:id/all_conditions','getAnyConditions','getActions','post','create','/:id/any_conditions','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4c807c,_0x3e41c5){var _0xad2435=function(_0x1e7b31){while(--_0x1e7b31){_0x4c807c['push'](_0x4c807c['shift']());}};_0xad2435(++_0x3e41c5);}(_0xe34e,0x132));var _0xee34=function(_0x1fb26f,_0x18b096){_0x1fb26f=_0x1fb26f-0x0;var _0x285528=_0xe34e[_0x1fb26f];return _0x285528;};'use strict';var multer=require(_0xee34('0x0'));var util=require(_0xee34('0x1'));var path=require('path');var timeout=require(_0xee34('0x2'));var express=require(_0xee34('0x3'));var router=express[_0xee34('0x4')]();var fs_extra=require(_0xee34('0x5'));var auth=require(_0xee34('0x6'));var interaction=require(_0xee34('0x7'));var config=require(_0xee34('0x8'));var controller=require(_0xee34('0x9'));router['get']('/',auth[_0xee34('0xa')](),controller['index']);router[_0xee34('0xb')](_0xee34('0xc'),auth[_0xee34('0xa')](),controller[_0xee34('0xd')]);router[_0xee34('0xb')](_0xee34('0xe'),auth[_0xee34('0xa')](),controller['getAllConditions']);router[_0xee34('0xb')]('/:id/any_conditions',auth[_0xee34('0xa')](),controller[_0xee34('0xf')]);router['get']('/:id/actions',auth[_0xee34('0xa')](),controller[_0xee34('0x10')]);router[_0xee34('0x11')]('/',auth['isAuthenticated'](),controller[_0xee34('0x12')]);router[_0xee34('0x11')](_0xee34('0xe'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xee34('0x11')](_0xee34('0x13'),auth[_0xee34('0xa')](),controller['addAnyCondition']);router[_0xee34('0x11')]('/:id/actions',auth[_0xee34('0xa')](),controller[_0xee34('0x14')]);router[_0xee34('0x15')]('/:id',auth[_0xee34('0xa')](),controller[_0xee34('0x16')]);router[_0xee34('0x17')](_0xee34('0xc'),auth['isAuthenticated'](),controller[_0xee34('0x18')]);module[_0xee34('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 7524bd4..8cd17f2 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 _0xe93c=['exports','STRING','BOOLEAN'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0xe93c,0x183));var _0xce93=function(_0x37b9ab,_0x51d125){_0x37b9ab=_0x37b9ab-0x0;var _0x86301c=_0xe93c[_0x37b9ab];return _0x86301c;};'use strict';var Sequelize=require('sequelize');module[_0xce93('0x0')]={'name':{'type':Sequelize[_0xce93('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce93('0x1')]},'status':{'type':Sequelize[_0xce93('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb2ba=['BOOLEAN','sequelize','exports','STRING'];(function(_0x39d980,_0x15c127){var _0x33fcbc=function(_0x32548a){while(--_0x32548a){_0x39d980['push'](_0x39d980['shift']());}};_0x33fcbc(++_0x15c127);}(_0xb2ba,0x1b5));var _0xab2b=function(_0x57b973,_0x3e3578){_0x57b973=_0x57b973-0x0;var _0xcba513=_0xb2ba[_0x57b973];return _0xcba513;};'use strict';var Sequelize=require(_0xab2b('0x0'));module[_0xab2b('0x1')]={'name':{'type':Sequelize[_0xab2b('0x2')]},'channel':{'type':Sequelize[_0xab2b('0x2')]},'description':{'type':Sequelize[_0xab2b('0x2')]},'status':{'type':Sequelize[_0xab2b('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 1bb1498..df0fd97 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 _0x83f6=['bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','get','Triggers','UserProfileResource','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','pick','filter','merge','where','VIRTUAL','Trigger','includeAll','include','findAll','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','find','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','hasOwnProperty','getAnyConditions','findOne','options','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x52feb3,_0x5bfd59){var _0x2922a7=function(_0x44d2b8){while(--_0x44d2b8){_0x52feb3['push'](_0x52feb3['shift']());}};_0x2922a7(++_0x5bfd59);}(_0x83f6,0x10f));var _0x683f=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x83f6[_0x6d6a66];return _0x11eb6e;};'use strict';var emlformat=require(_0x683f('0x0'));var rimraf=require(_0x683f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x683f('0x2'));var rp=require(_0x683f('0x3'));var moment=require(_0x683f('0x4'));var BPromise=require(_0x683f('0x5'));var Mustache=require(_0x683f('0x6'));var util=require(_0x683f('0x7'));var path=require(_0x683f('0x8'));var sox=require(_0x683f('0x9'));var csv=require(_0x683f('0xa'));var ejs=require(_0x683f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x683f('0xc'));var crypto=require(_0x683f('0xd'));var jsforce=require(_0x683f('0xe'));var deskjs=require(_0x683f('0xf'));var toCsv=require(_0x683f('0xa'));var querystring=require(_0x683f('0x10'));var Papa=require(_0x683f('0x11'));var Redis=require(_0x683f('0x12'));var authService=require(_0x683f('0x13'));var qs=require(_0x683f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x683f('0x15'))(_0x683f('0x16'));var utils=require(_0x683f('0x17'));var config=require(_0x683f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x683f('0x19'))['db'];function respondWithStatusCode(_0x40f081,_0x244652){_0x244652=_0x244652||0xcc;return function(_0x5e2f2d){if(_0x5e2f2d){return _0x40f081[_0x683f('0x1a')](_0x244652);}return _0x40f081[_0x683f('0x1b')](_0x244652)[_0x683f('0x1c')]();};}function respondWithResult(_0x2c54f4,_0x3fe29d){_0x3fe29d=_0x3fe29d||0xc8;return function(_0xe4b2db){if(_0xe4b2db){return _0x2c54f4[_0x683f('0x1b')](_0x3fe29d)[_0x683f('0x1d')](_0xe4b2db);}};}function respondWithFilteredResult(_0x472f9c,_0x18c7d1){return function(_0x36d0ac){if(_0x36d0ac){var _0x597615=typeof _0x18c7d1[_0x683f('0x1e')]===_0x683f('0x1f')&&typeof _0x18c7d1[_0x683f('0x20')]==='undefined';var _0x1751ce=_0x36d0ac[_0x683f('0x21')];var _0x5e6610=_0x597615?0x0:_0x18c7d1[_0x683f('0x1e')];var _0xa01968=_0x597615?_0x36d0ac['count']:_0x18c7d1[_0x683f('0x1e')]+_0x18c7d1[_0x683f('0x20')];var _0x1e6269;if(_0xa01968>=_0x1751ce){_0xa01968=_0x1751ce;_0x1e6269=0xc8;}else{_0x1e6269=0xce;}_0x472f9c['status'](_0x1e6269);return _0x472f9c[_0x683f('0x22')]('Content-Range',_0x5e6610+'-'+_0xa01968+'/'+_0x1751ce)[_0x683f('0x1d')](_0x36d0ac);}return null;};}function patchUpdates(_0x5d5795){return function(_0x26ecf3){try{jsonpatch['apply'](_0x26ecf3,_0x5d5795,!![]);}catch(_0x45ae36){return BPromise[_0x683f('0x23')](_0x45ae36);}return _0x26ecf3['save']();};}function saveUpdates(_0x3d6e9,_0x34a377){return function(_0x8a615a){if(_0x8a615a){return _0x8a615a[_0x683f('0x24')](_0x3d6e9)[_0x683f('0x25')](function(_0x536b53){return _0x536b53;});}return null;};}function removeEntity(_0x484e0d,_0xb5e0b4){return function(_0x204f41){if(_0x204f41){return _0x204f41[_0x683f('0x26')]()[_0x683f('0x25')](function(){var _0x722ee8=_0x204f41[_0x683f('0x27')]({'plain':!![]});var _0x304a8c=_0x683f('0x28');return db[_0x683f('0x29')][_0x683f('0x26')]({'where':{'type':_0x304a8c,'resourceId':_0x722ee8['id']}})['then'](function(){return _0x204f41;});})[_0x683f('0x25')](function(){_0x484e0d[_0x683f('0x1b')](0xcc)[_0x683f('0x1c')]();});}};}function handleEntityNotFound(_0x4e0e2,_0x33f015){return function(_0x45cc2c){if(!_0x45cc2c){_0x4e0e2[_0x683f('0x1a')](0x194);}return _0x45cc2c;};}function handleError(_0x2c0942,_0x2e23f3){_0x2e23f3=_0x2e23f3||0x1f4;return function(_0x1fb560){logger['error'](_0x1fb560['stack']);if(_0x1fb560[_0x683f('0x2a')]){delete _0x1fb560[_0x683f('0x2a')];}_0x2c0942[_0x683f('0x1b')](_0x2e23f3)[_0x683f('0x2b')](_0x1fb560);};}exports['index']=function(_0x55c3a5,_0x2154bc){var _0x4764ea={},_0x830dbc={},_0x5b7d71={'count':0x0,'rows':[]};var _0x2a2987=_[_0x683f('0x2c')](db['Trigger'][_0x683f('0x2d')],function(_0x3cfebd){return{'name':_0x3cfebd[_0x683f('0x2e')],'type':_0x3cfebd[_0x683f('0x2f')]['key']};});_0x830dbc['model']=_[_0x683f('0x2c')](_0x2a2987,'name');_0x830dbc[_0x683f('0x30')]=_[_0x683f('0x31')](_0x55c3a5[_0x683f('0x30')]);_0x830dbc[_0x683f('0x32')]=_[_0x683f('0x33')](_0x830dbc[_0x683f('0x34')],_0x830dbc[_0x683f('0x30')]);_0x4764ea['attributes']=_[_0x683f('0x33')](_0x830dbc[_0x683f('0x34')],qs[_0x683f('0x35')](_0x55c3a5[_0x683f('0x30')]['fields']));_0x4764ea['attributes']=_0x4764ea[_0x683f('0x36')][_0x683f('0x37')]?_0x4764ea[_0x683f('0x36')]:_0x830dbc['model'];if(!_0x55c3a5[_0x683f('0x30')]['hasOwnProperty'](_0x683f('0x38'))){_0x4764ea['limit']=qs[_0x683f('0x20')](_0x55c3a5[_0x683f('0x30')]['limit']);_0x4764ea[_0x683f('0x1e')]=qs[_0x683f('0x1e')](_0x55c3a5['query'][_0x683f('0x1e')]);}_0x4764ea['order']=qs[_0x683f('0x39')](_0x55c3a5['query'][_0x683f('0x39')]);_0x4764ea['where']=qs['filters'](_[_0x683f('0x3a')](_0x55c3a5[_0x683f('0x30')],_0x830dbc[_0x683f('0x32')]),_0x2a2987);if(_0x55c3a5[_0x683f('0x30')][_0x683f('0x3b')]){_0x4764ea['where']=_[_0x683f('0x3c')](_0x4764ea[_0x683f('0x3d')],{'$or':_[_0x683f('0x2c')](_0x2a2987,function(_0x3b0051){if(_0x3b0051[_0x683f('0x2f')]!==_0x683f('0x3e')){var _0x2fb006={};_0x2fb006[_0x3b0051['name']]={'$like':'%'+_0x55c3a5[_0x683f('0x30')][_0x683f('0x3b')]+'%'};return _0x2fb006;}})});}_0x4764ea=_[_0x683f('0x3c')]({},_0x4764ea,_0x55c3a5['options']);var _0xaf39d1={'where':_0x4764ea[_0x683f('0x3d')]};return db[_0x683f('0x3f')]['count'](_0xaf39d1)[_0x683f('0x25')](function(_0x3f9852){_0x5b7d71['count']=_0x3f9852;if(_0x55c3a5['query'][_0x683f('0x40')]){_0x4764ea[_0x683f('0x41')]=[{'all':!![]}];}return db[_0x683f('0x3f')][_0x683f('0x42')](_0x4764ea);})[_0x683f('0x25')](function(_0x3029e0){_0x5b7d71['rows']=_0x3029e0;return _0x5b7d71;})[_0x683f('0x25')](respondWithFilteredResult(_0x2154bc,_0x4764ea))[_0x683f('0x43')](handleError(_0x2154bc,null));};exports[_0x683f('0x44')]=function(_0x162aa7,_0x25a4ac){var _0x3ae261={'raw':![],'where':{'id':_0x162aa7[_0x683f('0x45')]['id']}},_0x26a1ab={};_0x26a1ab['model']=_[_0x683f('0x31')](db[_0x683f('0x3f')]['rawAttributes']);_0x26a1ab[_0x683f('0x30')]=_[_0x683f('0x31')](_0x162aa7[_0x683f('0x30')]);_0x26a1ab[_0x683f('0x32')]=_[_0x683f('0x33')](_0x26a1ab[_0x683f('0x34')],_0x26a1ab['query']);_0x3ae261[_0x683f('0x36')]=_[_0x683f('0x33')](_0x26a1ab['model'],qs[_0x683f('0x35')](_0x162aa7[_0x683f('0x30')][_0x683f('0x35')]));_0x3ae261[_0x683f('0x36')]=_0x3ae261['attributes'][_0x683f('0x37')]?_0x3ae261[_0x683f('0x36')]:_0x26a1ab[_0x683f('0x34')];if(_0x162aa7[_0x683f('0x30')]['includeAll']){_0x3ae261[_0x683f('0x41')]=[{'all':!![]}];}_0x3ae261=_[_0x683f('0x3c')]({},_0x3ae261,_0x162aa7['options']);return db[_0x683f('0x3f')]['find'](_0x3ae261)[_0x683f('0x25')](handleEntityNotFound(_0x25a4ac,null))[_0x683f('0x25')](respondWithResult(_0x25a4ac,null))[_0x683f('0x43')](handleError(_0x25a4ac,null));};exports[_0x683f('0x46')]=function(_0x1008de,_0x2be205){return db['Trigger'][_0x683f('0x46')](_0x1008de[_0x683f('0x47')],{})[_0x683f('0x25')](function(_0x1648da){var _0x31b3ed=_0x1008de[_0x683f('0x48')][_0x683f('0x27')]({'plain':!![]});if(!_0x31b3ed)throw new Error(_0x683f('0x49'));if(_0x31b3ed['role']==='user'){var _0x81f063=_0x1648da[_0x683f('0x27')]({'plain':!![]});var _0x181cb8=_0x683f('0x28');return db[_0x683f('0x4a')]['find']({'where':{'name':_0x181cb8,'userProfileId':_0x31b3ed[_0x683f('0x4b')]},'raw':!![]})[_0x683f('0x25')](function(_0x48157e){if(_0x48157e&&_0x48157e[_0x683f('0x4c')]===0x0){return db[_0x683f('0x29')][_0x683f('0x46')]({'name':_0x81f063[_0x683f('0x2a')],'resourceId':_0x81f063['id'],'type':_0x48157e['name'],'sectionId':_0x48157e['id']},{})[_0x683f('0x25')](function(){return _0x1648da;});}else{return _0x1648da;}})[_0x683f('0x43')](function(_0x3eae56){logger[_0x683f('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3eae56);throw _0x3eae56;});}return _0x1648da;})[_0x683f('0x25')](respondWithResult(_0x2be205,0xc9))[_0x683f('0x43')](handleError(_0x2be205,null));};exports[_0x683f('0x24')]=function(_0x2877e5,_0x18af09){if(_0x2877e5[_0x683f('0x47')]['id']){delete _0x2877e5[_0x683f('0x47')]['id'];}return db[_0x683f('0x3f')][_0x683f('0x4e')]({'where':{'id':_0x2877e5[_0x683f('0x45')]['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x18af09,null))['then'](saveUpdates(_0x2877e5[_0x683f('0x47')],null))[_0x683f('0x25')](respondWithResult(_0x18af09,null))[_0x683f('0x43')](handleError(_0x18af09,null));};exports['destroy']=function(_0x559359,_0x3475ac){return db[_0x683f('0x3f')][_0x683f('0x4e')]({'where':{'id':_0x559359['params']['id']}})['then'](handleEntityNotFound(_0x3475ac,null))[_0x683f('0x25')](removeEntity(_0x3475ac,null))[_0x683f('0x43')](handleError(_0x3475ac,null));};exports['addAllCondition']=function(_0xff3223,_0x3f4743,_0x2118c1){if(_0xff3223[_0x683f('0x47')]['id']){delete _0xff3223['body']['id'];}return db[_0x683f('0x3f')][_0x683f('0x4e')]({'where':{'id':_0xff3223['params']['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x3f4743,null))['then'](function(_0x3b3490){if(_0x3b3490){_0xff3223['body'][_0x683f('0x4f')]=_0x3b3490['id'];return db[_0x683f('0x50')][_0x683f('0x46')](_0xff3223[_0x683f('0x47')]);}})['then'](respondWithResult(_0x3f4743,null))[_0x683f('0x43')](handleError(_0x3f4743,null));};exports[_0x683f('0x51')]=function(_0xf335cb,_0x4ce733,_0x1fab50){if(_0xf335cb[_0x683f('0x47')]['id']){delete _0xf335cb[_0x683f('0x47')]['id'];}return db[_0x683f('0x3f')]['find']({'where':{'id':_0xf335cb[_0x683f('0x45')]['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x4ce733,null))[_0x683f('0x25')](function(_0x11a2b0){if(_0x11a2b0){_0xf335cb[_0x683f('0x47')][_0x683f('0x52')]=_0x11a2b0['id'];return db['Condition'][_0x683f('0x46')](_0xf335cb[_0x683f('0x47')]);}})[_0x683f('0x25')](respondWithResult(_0x4ce733,null))[_0x683f('0x43')](handleError(_0x4ce733,null));};exports[_0x683f('0x53')]=function(_0x5f3edb,_0x46877b,_0x15f421){var _0x4893e6={};var _0x24dd13={};var _0x318204;var _0x2c44c9;return db[_0x683f('0x3f')]['findOne']({'where':{'id':_0x5f3edb['params']['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x46877b,null))['then'](function(_0xb32e15){if(_0xb32e15){_0x318204=_0xb32e15;_0x24dd13[_0x683f('0x34')]=_[_0x683f('0x31')](db['Condition']['rawAttributes']);_0x24dd13['query']=_[_0x683f('0x31')](_0x5f3edb[_0x683f('0x30')]);_0x24dd13['filters']=_[_0x683f('0x33')](_0x24dd13[_0x683f('0x34')],_0x24dd13[_0x683f('0x30')]);_0x4893e6[_0x683f('0x36')]=_[_0x683f('0x33')](_0x24dd13[_0x683f('0x34')],qs['fields'](_0x5f3edb[_0x683f('0x30')][_0x683f('0x35')]));_0x4893e6[_0x683f('0x36')]=_0x4893e6[_0x683f('0x36')][_0x683f('0x37')]?_0x4893e6[_0x683f('0x36')]:_0x24dd13[_0x683f('0x34')];_0x4893e6[_0x683f('0x54')]=qs[_0x683f('0x39')](_0x5f3edb[_0x683f('0x30')][_0x683f('0x39')]);_0x4893e6[_0x683f('0x3d')]=qs[_0x683f('0x32')](_['pick'](_0x5f3edb[_0x683f('0x30')],_0x24dd13[_0x683f('0x32')]));if(_0x5f3edb[_0x683f('0x30')][_0x683f('0x3b')]){_0x4893e6[_0x683f('0x3d')]=_[_0x683f('0x3c')](_0x4893e6[_0x683f('0x3d')],{'$or':_[_0x683f('0x2c')](_0x4893e6[_0x683f('0x36')],function(_0xf9e381){var _0x389190={};_0x389190[_0xf9e381]={'$like':'%'+_0x5f3edb[_0x683f('0x30')][_0x683f('0x3b')]+'%'};return _0x389190;})});}_0x4893e6=_[_0x683f('0x3c')]({},_0x4893e6,_0x5f3edb['options']);return _0x318204['getAllConditions'](_0x4893e6);}})['then'](function(_0x59c8b2){if(_0x59c8b2){_0x2c44c9=_0x59c8b2['length'];if(!_0x5f3edb[_0x683f('0x30')][_0x683f('0x55')](_0x683f('0x38'))){_0x4893e6[_0x683f('0x20')]=qs['limit'](_0x5f3edb[_0x683f('0x30')][_0x683f('0x20')]);_0x4893e6['offset']=qs['offset'](_0x5f3edb[_0x683f('0x30')][_0x683f('0x1e')]);}return _0x318204[_0x683f('0x53')](_0x4893e6);}})['then'](function(_0x156792){if(_0x156792){return _0x156792?{'count':_0x2c44c9,'rows':_0x156792}:null;}})[_0x683f('0x25')](respondWithResult(_0x46877b,null))[_0x683f('0x43')](handleError(_0x46877b,null));};exports[_0x683f('0x56')]=function(_0x1c46e8,_0x52c4b5,_0x4329ee){var _0x3fc446={};var _0x26273e={};var _0x2c0027;var _0x2952fe;return db[_0x683f('0x3f')][_0x683f('0x57')]({'where':{'id':_0x1c46e8['params']['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x52c4b5,null))[_0x683f('0x25')](function(_0x3705b2){if(_0x3705b2){_0x2c0027=_0x3705b2;_0x26273e[_0x683f('0x34')]=_[_0x683f('0x31')](db[_0x683f('0x50')][_0x683f('0x2d')]);_0x26273e[_0x683f('0x30')]=_['keys'](_0x1c46e8[_0x683f('0x30')]);_0x26273e[_0x683f('0x32')]=_[_0x683f('0x33')](_0x26273e[_0x683f('0x34')],_0x26273e[_0x683f('0x30')]);_0x3fc446[_0x683f('0x36')]=_['intersection'](_0x26273e[_0x683f('0x34')],qs[_0x683f('0x35')](_0x1c46e8['query'][_0x683f('0x35')]));_0x3fc446[_0x683f('0x36')]=_0x3fc446[_0x683f('0x36')][_0x683f('0x37')]?_0x3fc446['attributes']:_0x26273e['model'];_0x3fc446[_0x683f('0x54')]=qs[_0x683f('0x39')](_0x1c46e8[_0x683f('0x30')][_0x683f('0x39')]);_0x3fc446[_0x683f('0x3d')]=qs['filters'](_[_0x683f('0x3a')](_0x1c46e8[_0x683f('0x30')],_0x26273e[_0x683f('0x32')]));if(_0x1c46e8[_0x683f('0x30')][_0x683f('0x3b')]){_0x3fc446['where']=_['merge'](_0x3fc446['where'],{'$or':_['map'](_0x3fc446[_0x683f('0x36')],function(_0x39925e){var _0xb24219={};_0xb24219[_0x39925e]={'$like':'%'+_0x1c46e8[_0x683f('0x30')][_0x683f('0x3b')]+'%'};return _0xb24219;})});}_0x3fc446=_[_0x683f('0x3c')]({},_0x3fc446,_0x1c46e8[_0x683f('0x58')]);return _0x2c0027[_0x683f('0x56')](_0x3fc446);}})['then'](function(_0x4373c1){if(_0x4373c1){_0x2952fe=_0x4373c1[_0x683f('0x37')];if(!_0x1c46e8['query'][_0x683f('0x55')](_0x683f('0x38'))){_0x3fc446['limit']=qs[_0x683f('0x20')](_0x1c46e8[_0x683f('0x30')]['limit']);_0x3fc446[_0x683f('0x1e')]=qs[_0x683f('0x1e')](_0x1c46e8['query'][_0x683f('0x1e')]);}return _0x2c0027[_0x683f('0x56')](_0x3fc446);}})[_0x683f('0x25')](function(_0x3c8817){if(_0x3c8817){return _0x3c8817?{'count':_0x2952fe,'rows':_0x3c8817}:null;}})[_0x683f('0x25')](respondWithResult(_0x52c4b5,null))[_0x683f('0x43')](handleError(_0x52c4b5,null));};exports[_0x683f('0x59')]=function(_0x534b69,_0x31a211,_0x43a4e3){if(_0x534b69[_0x683f('0x47')]['id']){delete _0x534b69['body']['id'];}return db[_0x683f('0x3f')]['find']({'where':{'id':_0x534b69[_0x683f('0x45')]['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x31a211,null))[_0x683f('0x25')](function(_0x516924){if(_0x516924){_0x534b69[_0x683f('0x47')]['TriggerId']=_0x516924['id'];return db[_0x683f('0x5a')]['create'](_0x534b69['body']);}})['then'](respondWithResult(_0x31a211,null))[_0x683f('0x43')](handleError(_0x31a211,null));};exports[_0x683f('0x5b')]=function(_0x2de83f,_0x5d3048,_0x12f6cb){var _0xfaa7aa={};var _0x13b645={};var _0x259638;var _0x6272b1;return db[_0x683f('0x3f')][_0x683f('0x57')]({'where':{'id':_0x2de83f[_0x683f('0x45')]['id']}})[_0x683f('0x25')](handleEntityNotFound(_0x5d3048,null))[_0x683f('0x25')](function(_0x2e3cae){if(_0x2e3cae){_0x259638=_0x2e3cae;_0x13b645[_0x683f('0x34')]=_['keys'](db['Action'][_0x683f('0x2d')]);_0x13b645[_0x683f('0x30')]=_[_0x683f('0x31')](_0x2de83f[_0x683f('0x30')]);_0x13b645[_0x683f('0x32')]=_[_0x683f('0x33')](_0x13b645[_0x683f('0x34')],_0x13b645[_0x683f('0x30')]);_0xfaa7aa['attributes']=_[_0x683f('0x33')](_0x13b645[_0x683f('0x34')],qs['fields'](_0x2de83f[_0x683f('0x30')][_0x683f('0x35')]));_0xfaa7aa[_0x683f('0x36')]=_0xfaa7aa[_0x683f('0x36')][_0x683f('0x37')]?_0xfaa7aa[_0x683f('0x36')]:_0x13b645['model'];_0xfaa7aa[_0x683f('0x54')]=qs[_0x683f('0x39')](_0x2de83f[_0x683f('0x30')]['sort']);_0xfaa7aa[_0x683f('0x3d')]=qs[_0x683f('0x32')](_[_0x683f('0x3a')](_0x2de83f[_0x683f('0x30')],_0x13b645['filters']));if(_0x2de83f[_0x683f('0x30')][_0x683f('0x3b')]){_0xfaa7aa['where']=_[_0x683f('0x3c')](_0xfaa7aa[_0x683f('0x3d')],{'$or':_[_0x683f('0x2c')](_0xfaa7aa[_0x683f('0x36')],function(_0xf40fbd){var _0x597b18={};_0x597b18[_0xf40fbd]={'$like':'%'+_0x2de83f['query'][_0x683f('0x3b')]+'%'};return _0x597b18;})});}_0xfaa7aa=_[_0x683f('0x3c')]({},_0xfaa7aa,_0x2de83f[_0x683f('0x58')]);return _0x259638[_0x683f('0x5b')](_0xfaa7aa);}})[_0x683f('0x25')](function(_0x4573e0){if(_0x4573e0){_0x6272b1=_0x4573e0[_0x683f('0x37')];if(!_0x2de83f[_0x683f('0x30')][_0x683f('0x55')]('nolimit')){_0xfaa7aa[_0x683f('0x20')]=qs[_0x683f('0x20')](_0x2de83f[_0x683f('0x30')][_0x683f('0x20')]);_0xfaa7aa[_0x683f('0x1e')]=qs[_0x683f('0x1e')](_0x2de83f['query'][_0x683f('0x1e')]);}return _0x259638[_0x683f('0x5b')](_0xfaa7aa);}})[_0x683f('0x25')](function(_0x43eac0){if(_0x43eac0){return _0x43eac0?{'count':_0x6272b1,'rows':_0x43eac0}:null;}})[_0x683f('0x25')](respondWithResult(_0x5d3048,null))[_0x683f('0x43')](handleError(_0x5d3048,null));}; \ No newline at end of file +var _0x0238=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','pick','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','Triggers','UserProfileResource','error','stack','send','map','Trigger','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x0238,0x18b));var _0x8023=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0238[_0x4fbfd9];return _0x31dc94;};'use strict';var emlformat=require(_0x8023('0x0'));var rimraf=require(_0x8023('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8023('0x2'));var Mustache=require('mustache');var util=require(_0x8023('0x3'));var path=require(_0x8023('0x4'));var sox=require(_0x8023('0x5'));var csv=require(_0x8023('0x6'));var ejs=require(_0x8023('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8023('0x8'));var jsforce=require(_0x8023('0x9'));var deskjs=require(_0x8023('0xa'));var toCsv=require(_0x8023('0x6'));var querystring=require(_0x8023('0xb'));var Papa=require(_0x8023('0xc'));var Redis=require(_0x8023('0xd'));var authService=require(_0x8023('0xe'));var qs=require(_0x8023('0xf'));var as=require(_0x8023('0x10'));var hardwareService=require(_0x8023('0x11'));var logger=require(_0x8023('0x12'))(_0x8023('0x13'));var utils=require(_0x8023('0x14'));var config=require(_0x8023('0x15'));var licenseUtil=require(_0x8023('0x16'));var db=require(_0x8023('0x17'))['db'];function respondWithStatusCode(_0x3100e4,_0x2d65a7){_0x2d65a7=_0x2d65a7||0xcc;return function(_0x452c2f){if(_0x452c2f){return _0x3100e4[_0x8023('0x18')](_0x2d65a7);}return _0x3100e4['status'](_0x2d65a7)[_0x8023('0x19')]();};}function respondWithResult(_0x27cadc,_0x231c32){_0x231c32=_0x231c32||0xc8;return function(_0xd0123c){if(_0xd0123c){return _0x27cadc[_0x8023('0x1a')](_0x231c32)['json'](_0xd0123c);}};}function respondWithFilteredResult(_0x2872fc,_0x4443b9){return function(_0x383b83){if(_0x383b83){var _0x31c08a=typeof _0x4443b9[_0x8023('0x1b')]===_0x8023('0x1c')&&typeof _0x4443b9[_0x8023('0x1d')]===_0x8023('0x1c');var _0xffec09=_0x383b83[_0x8023('0x1e')];var _0x15dc37=_0x31c08a?0x0:_0x4443b9[_0x8023('0x1b')];var _0x5871b4=_0x31c08a?_0x383b83[_0x8023('0x1e')]:_0x4443b9[_0x8023('0x1b')]+_0x4443b9[_0x8023('0x1d')];var _0x1b12ec;if(_0x5871b4>=_0xffec09){_0x5871b4=_0xffec09;_0x1b12ec=0xc8;}else{_0x1b12ec=0xce;}_0x2872fc['status'](_0x1b12ec);return _0x2872fc[_0x8023('0x1f')](_0x8023('0x20'),_0x15dc37+'-'+_0x5871b4+'/'+_0xffec09)['json'](_0x383b83);}return null;};}function patchUpdates(_0x371a8b){return function(_0x2e3a80){try{jsonpatch['apply'](_0x2e3a80,_0x371a8b,!![]);}catch(_0x1037ed){return BPromise[_0x8023('0x21')](_0x1037ed);}return _0x2e3a80['save']();};}function saveUpdates(_0x497c3b,_0x47b1d1){return function(_0x3e75b0){if(_0x3e75b0){return _0x3e75b0[_0x8023('0x22')](_0x497c3b)['then'](function(_0x1bd70c){return _0x1bd70c;});}return null;};}function removeEntity(_0x300041,_0x10eb58){return function(_0x47f702){if(_0x47f702){return _0x47f702[_0x8023('0x23')]()[_0x8023('0x24')](function(){var _0x3d587c=_0x47f702[_0x8023('0x25')]({'plain':!![]});var _0x46274e=_0x8023('0x26');return db[_0x8023('0x27')][_0x8023('0x23')]({'where':{'type':_0x46274e,'resourceId':_0x3d587c['id']}})['then'](function(){return _0x47f702;});})['then'](function(){_0x300041[_0x8023('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1105a9,_0x23e2b3){return function(_0x3de0c3){if(!_0x3de0c3){_0x1105a9['sendStatus'](0x194);}return _0x3de0c3;};}function handleError(_0x3d5784,_0x5d0f3b){_0x5d0f3b=_0x5d0f3b||0x1f4;return function(_0x2c774e){logger[_0x8023('0x28')](_0x2c774e[_0x8023('0x29')]);if(_0x2c774e['name']){delete _0x2c774e['name'];}_0x3d5784[_0x8023('0x1a')](_0x5d0f3b)[_0x8023('0x2a')](_0x2c774e);};}exports['index']=function(_0x3ce26b,_0x42c054){var _0x4e266f={},_0x829284={},_0x28e595={'count':0x0,'rows':[]};var _0x165909=_[_0x8023('0x2b')](db[_0x8023('0x2c')][_0x8023('0x2d')],function(_0xe9ded0){return{'name':_0xe9ded0[_0x8023('0x2e')],'type':_0xe9ded0[_0x8023('0x2f')][_0x8023('0x30')]};});_0x829284[_0x8023('0x31')]=_[_0x8023('0x2b')](_0x165909,_0x8023('0x32'));_0x829284[_0x8023('0x33')]=_[_0x8023('0x34')](_0x3ce26b[_0x8023('0x33')]);_0x829284['filters']=_[_0x8023('0x35')](_0x829284['model'],_0x829284[_0x8023('0x33')]);_0x4e266f[_0x8023('0x36')]=_['intersection'](_0x829284[_0x8023('0x31')],qs[_0x8023('0x37')](_0x3ce26b[_0x8023('0x33')][_0x8023('0x37')]));_0x4e266f['attributes']=_0x4e266f['attributes'][_0x8023('0x38')]?_0x4e266f[_0x8023('0x36')]:_0x829284[_0x8023('0x31')];if(!_0x3ce26b[_0x8023('0x33')][_0x8023('0x39')](_0x8023('0x3a'))){_0x4e266f[_0x8023('0x1d')]=qs[_0x8023('0x1d')](_0x3ce26b[_0x8023('0x33')][_0x8023('0x1d')]);_0x4e266f[_0x8023('0x1b')]=qs[_0x8023('0x1b')](_0x3ce26b['query'][_0x8023('0x1b')]);}_0x4e266f[_0x8023('0x3b')]=qs['sort'](_0x3ce26b[_0x8023('0x33')][_0x8023('0x3c')]);_0x4e266f[_0x8023('0x3d')]=qs[_0x8023('0x3e')](_['pick'](_0x3ce26b[_0x8023('0x33')],_0x829284[_0x8023('0x3e')]),_0x165909);if(_0x3ce26b[_0x8023('0x33')][_0x8023('0x3f')]){_0x4e266f[_0x8023('0x3d')]=_[_0x8023('0x40')](_0x4e266f[_0x8023('0x3d')],{'$or':_[_0x8023('0x2b')](_0x165909,function(_0xbdbd4e){if(_0xbdbd4e[_0x8023('0x2f')]!==_0x8023('0x41')){var _0xc922e8={};_0xc922e8[_0xbdbd4e[_0x8023('0x32')]]={'$like':'%'+_0x3ce26b[_0x8023('0x33')][_0x8023('0x3f')]+'%'};return _0xc922e8;}})});}_0x4e266f=_[_0x8023('0x40')]({},_0x4e266f,_0x3ce26b[_0x8023('0x42')]);var _0x92adc7={'where':_0x4e266f[_0x8023('0x3d')]};return db[_0x8023('0x2c')]['count'](_0x92adc7)['then'](function(_0x2c9f4f){_0x28e595[_0x8023('0x1e')]=_0x2c9f4f;if(_0x3ce26b['query'][_0x8023('0x43')]){_0x4e266f[_0x8023('0x44')]=[{'all':!![]}];}return db[_0x8023('0x2c')][_0x8023('0x45')](_0x4e266f);})[_0x8023('0x24')](function(_0x27a094){_0x28e595[_0x8023('0x46')]=_0x27a094;return _0x28e595;})[_0x8023('0x24')](respondWithFilteredResult(_0x42c054,_0x4e266f))[_0x8023('0x47')](handleError(_0x42c054,null));};exports[_0x8023('0x48')]=function(_0x7326b0,_0x42427b){var _0x5ea476={'raw':![],'where':{'id':_0x7326b0[_0x8023('0x49')]['id']}},_0x15669f={};_0x15669f[_0x8023('0x31')]=_[_0x8023('0x34')](db[_0x8023('0x2c')][_0x8023('0x2d')]);_0x15669f[_0x8023('0x33')]=_['keys'](_0x7326b0['query']);_0x15669f[_0x8023('0x3e')]=_['intersection'](_0x15669f[_0x8023('0x31')],_0x15669f[_0x8023('0x33')]);_0x5ea476[_0x8023('0x36')]=_[_0x8023('0x35')](_0x15669f[_0x8023('0x31')],qs[_0x8023('0x37')](_0x7326b0[_0x8023('0x33')][_0x8023('0x37')]));_0x5ea476[_0x8023('0x36')]=_0x5ea476[_0x8023('0x36')][_0x8023('0x38')]?_0x5ea476[_0x8023('0x36')]:_0x15669f['model'];if(_0x7326b0[_0x8023('0x33')]['includeAll']){_0x5ea476[_0x8023('0x44')]=[{'all':!![]}];}_0x5ea476=_[_0x8023('0x40')]({},_0x5ea476,_0x7326b0['options']);return db[_0x8023('0x2c')]['find'](_0x5ea476)[_0x8023('0x24')](handleEntityNotFound(_0x42427b,null))[_0x8023('0x24')](respondWithResult(_0x42427b,null))[_0x8023('0x47')](handleError(_0x42427b,null));};exports[_0x8023('0x4a')]=function(_0x3d7710,_0xf18707){return db[_0x8023('0x2c')][_0x8023('0x4a')](_0x3d7710[_0x8023('0x4b')],{})[_0x8023('0x24')](function(_0x56a567){var _0x5bbdac=_0x3d7710[_0x8023('0x4c')][_0x8023('0x25')]({'plain':!![]});if(!_0x5bbdac)throw new Error(_0x8023('0x4d'));if(_0x5bbdac['role']===_0x8023('0x4c')){var _0x579705=_0x56a567[_0x8023('0x25')]({'plain':!![]});var _0x1c287e=_0x8023('0x26');return db['UserProfileSection'][_0x8023('0x4e')]({'where':{'name':_0x1c287e,'userProfileId':_0x5bbdac[_0x8023('0x4f')]},'raw':!![]})[_0x8023('0x24')](function(_0xb318cd){if(_0xb318cd&&_0xb318cd[_0x8023('0x50')]===0x0){return db[_0x8023('0x27')][_0x8023('0x4a')]({'name':_0x579705[_0x8023('0x32')],'resourceId':_0x579705['id'],'type':_0xb318cd['name'],'sectionId':_0xb318cd['id']},{})[_0x8023('0x24')](function(){return _0x56a567;});}else{return _0x56a567;}})[_0x8023('0x47')](function(_0x58b8a9){logger[_0x8023('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58b8a9);throw _0x58b8a9;});}return _0x56a567;})[_0x8023('0x24')](respondWithResult(_0xf18707,0xc9))['catch'](handleError(_0xf18707,null));};exports[_0x8023('0x22')]=function(_0x4051e8,_0xd66792){if(_0x4051e8['body']['id']){delete _0x4051e8[_0x8023('0x4b')]['id'];}return db['Trigger'][_0x8023('0x4e')]({'where':{'id':_0x4051e8[_0x8023('0x49')]['id']}})[_0x8023('0x24')](handleEntityNotFound(_0xd66792,null))[_0x8023('0x24')](saveUpdates(_0x4051e8[_0x8023('0x4b')],null))[_0x8023('0x24')](respondWithResult(_0xd66792,null))['catch'](handleError(_0xd66792,null));};exports[_0x8023('0x23')]=function(_0x45707b,_0x2cfca3){return db[_0x8023('0x2c')][_0x8023('0x4e')]({'where':{'id':_0x45707b[_0x8023('0x49')]['id']}})[_0x8023('0x24')](handleEntityNotFound(_0x2cfca3,null))[_0x8023('0x24')](removeEntity(_0x2cfca3,null))['catch'](handleError(_0x2cfca3,null));};exports[_0x8023('0x51')]=function(_0x8f16d6,_0x5dff9a,_0x408cc7){if(_0x8f16d6[_0x8023('0x4b')]['id']){delete _0x8f16d6[_0x8023('0x4b')]['id'];}return db[_0x8023('0x2c')][_0x8023('0x4e')]({'where':{'id':_0x8f16d6['params']['id']}})[_0x8023('0x24')](handleEntityNotFound(_0x5dff9a,null))['then'](function(_0x17175e){if(_0x17175e){_0x8f16d6[_0x8023('0x4b')][_0x8023('0x52')]=_0x17175e['id'];return db[_0x8023('0x53')][_0x8023('0x4a')](_0x8f16d6[_0x8023('0x4b')]);}})[_0x8023('0x24')](respondWithResult(_0x5dff9a,null))[_0x8023('0x47')](handleError(_0x5dff9a,null));};exports[_0x8023('0x54')]=function(_0x51e2ad,_0xf3998c,_0x401dd1){if(_0x51e2ad[_0x8023('0x4b')]['id']){delete _0x51e2ad[_0x8023('0x4b')]['id'];}return db[_0x8023('0x2c')][_0x8023('0x4e')]({'where':{'id':_0x51e2ad[_0x8023('0x49')]['id']}})['then'](handleEntityNotFound(_0xf3998c,null))[_0x8023('0x24')](function(_0x307022){if(_0x307022){_0x51e2ad['body'][_0x8023('0x55')]=_0x307022['id'];return db[_0x8023('0x53')][_0x8023('0x4a')](_0x51e2ad[_0x8023('0x4b')]);}})[_0x8023('0x24')](respondWithResult(_0xf3998c,null))[_0x8023('0x47')](handleError(_0xf3998c,null));};exports['getAllConditions']=function(_0x59621c,_0x3c2e1f,_0x40a62a){var _0x444536={};var _0x29e6d6={};var _0x198ff4;var _0x54b61d;return db[_0x8023('0x2c')][_0x8023('0x56')]({'where':{'id':_0x59621c[_0x8023('0x49')]['id']}})[_0x8023('0x24')](handleEntityNotFound(_0x3c2e1f,null))[_0x8023('0x24')](function(_0x519865){if(_0x519865){_0x198ff4=_0x519865;_0x29e6d6['model']=_[_0x8023('0x34')](db[_0x8023('0x53')][_0x8023('0x2d')]);_0x29e6d6[_0x8023('0x33')]=_[_0x8023('0x34')](_0x59621c[_0x8023('0x33')]);_0x29e6d6['filters']=_['intersection'](_0x29e6d6['model'],_0x29e6d6[_0x8023('0x33')]);_0x444536['attributes']=_[_0x8023('0x35')](_0x29e6d6[_0x8023('0x31')],qs[_0x8023('0x37')](_0x59621c[_0x8023('0x33')][_0x8023('0x37')]));_0x444536['attributes']=_0x444536[_0x8023('0x36')]['length']?_0x444536['attributes']:_0x29e6d6[_0x8023('0x31')];_0x444536[_0x8023('0x3b')]=qs[_0x8023('0x3c')](_0x59621c[_0x8023('0x33')][_0x8023('0x3c')]);_0x444536['where']=qs[_0x8023('0x3e')](_[_0x8023('0x57')](_0x59621c[_0x8023('0x33')],_0x29e6d6[_0x8023('0x3e')]));if(_0x59621c['query']['filter']){_0x444536[_0x8023('0x3d')]=_[_0x8023('0x40')](_0x444536[_0x8023('0x3d')],{'$or':_[_0x8023('0x2b')](_0x444536['attributes'],function(_0x5961a2){var _0x11d564={};_0x11d564[_0x5961a2]={'$like':'%'+_0x59621c[_0x8023('0x33')][_0x8023('0x3f')]+'%'};return _0x11d564;})});}_0x444536=_['merge']({},_0x444536,_0x59621c['options']);return _0x198ff4[_0x8023('0x58')](_0x444536);}})[_0x8023('0x24')](function(_0x2ab2be){if(_0x2ab2be){_0x54b61d=_0x2ab2be[_0x8023('0x38')];if(!_0x59621c['query']['hasOwnProperty']('nolimit')){_0x444536[_0x8023('0x1d')]=qs[_0x8023('0x1d')](_0x59621c[_0x8023('0x33')][_0x8023('0x1d')]);_0x444536[_0x8023('0x1b')]=qs['offset'](_0x59621c[_0x8023('0x33')]['offset']);}return _0x198ff4[_0x8023('0x58')](_0x444536);}})[_0x8023('0x24')](function(_0x577d1e){if(_0x577d1e){return _0x577d1e?{'count':_0x54b61d,'rows':_0x577d1e}:null;}})[_0x8023('0x24')](respondWithResult(_0x3c2e1f,null))[_0x8023('0x47')](handleError(_0x3c2e1f,null));};exports[_0x8023('0x59')]=function(_0x90f051,_0x4d0ba0,_0x8d9bd1){var _0x65fc77={};var _0x245dee={};var _0x5d12e2;var _0xb5768f;return db[_0x8023('0x2c')][_0x8023('0x56')]({'where':{'id':_0x90f051[_0x8023('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d0ba0,null))[_0x8023('0x24')](function(_0x40f5b9){if(_0x40f5b9){_0x5d12e2=_0x40f5b9;_0x245dee[_0x8023('0x31')]=_[_0x8023('0x34')](db[_0x8023('0x53')]['rawAttributes']);_0x245dee[_0x8023('0x33')]=_[_0x8023('0x34')](_0x90f051[_0x8023('0x33')]);_0x245dee['filters']=_[_0x8023('0x35')](_0x245dee[_0x8023('0x31')],_0x245dee[_0x8023('0x33')]);_0x65fc77[_0x8023('0x36')]=_[_0x8023('0x35')](_0x245dee[_0x8023('0x31')],qs[_0x8023('0x37')](_0x90f051[_0x8023('0x33')][_0x8023('0x37')]));_0x65fc77[_0x8023('0x36')]=_0x65fc77[_0x8023('0x36')][_0x8023('0x38')]?_0x65fc77[_0x8023('0x36')]:_0x245dee[_0x8023('0x31')];_0x65fc77[_0x8023('0x3b')]=qs[_0x8023('0x3c')](_0x90f051[_0x8023('0x33')][_0x8023('0x3c')]);_0x65fc77[_0x8023('0x3d')]=qs[_0x8023('0x3e')](_[_0x8023('0x57')](_0x90f051['query'],_0x245dee[_0x8023('0x3e')]));if(_0x90f051[_0x8023('0x33')]['filter']){_0x65fc77[_0x8023('0x3d')]=_[_0x8023('0x40')](_0x65fc77[_0x8023('0x3d')],{'$or':_[_0x8023('0x2b')](_0x65fc77[_0x8023('0x36')],function(_0xc8bffa){var _0x29f502={};_0x29f502[_0xc8bffa]={'$like':'%'+_0x90f051[_0x8023('0x33')]['filter']+'%'};return _0x29f502;})});}_0x65fc77=_['merge']({},_0x65fc77,_0x90f051[_0x8023('0x42')]);return _0x5d12e2[_0x8023('0x59')](_0x65fc77);}})[_0x8023('0x24')](function(_0x5942ea){if(_0x5942ea){_0xb5768f=_0x5942ea[_0x8023('0x38')];if(!_0x90f051[_0x8023('0x33')][_0x8023('0x39')]('nolimit')){_0x65fc77[_0x8023('0x1d')]=qs[_0x8023('0x1d')](_0x90f051[_0x8023('0x33')]['limit']);_0x65fc77['offset']=qs[_0x8023('0x1b')](_0x90f051[_0x8023('0x33')][_0x8023('0x1b')]);}return _0x5d12e2[_0x8023('0x59')](_0x65fc77);}})[_0x8023('0x24')](function(_0x7d2939){if(_0x7d2939){return _0x7d2939?{'count':_0xb5768f,'rows':_0x7d2939}:null;}})['then'](respondWithResult(_0x4d0ba0,null))['catch'](handleError(_0x4d0ba0,null));};exports[_0x8023('0x5a')]=function(_0x174b28,_0x34bc99,_0x4b78e3){if(_0x174b28[_0x8023('0x4b')]['id']){delete _0x174b28['body']['id'];}return db[_0x8023('0x2c')][_0x8023('0x4e')]({'where':{'id':_0x174b28['params']['id']}})[_0x8023('0x24')](handleEntityNotFound(_0x34bc99,null))['then'](function(_0x2af2d7){if(_0x2af2d7){_0x174b28['body'][_0x8023('0x5b')]=_0x2af2d7['id'];return db['Action'][_0x8023('0x4a')](_0x174b28['body']);}})['then'](respondWithResult(_0x34bc99,null))[_0x8023('0x47')](handleError(_0x34bc99,null));};exports[_0x8023('0x5c')]=function(_0x5c22f7,_0x47372a,_0x14a969){var _0x16506c={};var _0x51236d={};var _0x33e8a6;var _0x5d210a;return db[_0x8023('0x2c')]['findOne']({'where':{'id':_0x5c22f7[_0x8023('0x49')]['id']}})['then'](handleEntityNotFound(_0x47372a,null))[_0x8023('0x24')](function(_0x34b4ac){if(_0x34b4ac){_0x33e8a6=_0x34b4ac;_0x51236d[_0x8023('0x31')]=_[_0x8023('0x34')](db[_0x8023('0x5d')][_0x8023('0x2d')]);_0x51236d[_0x8023('0x33')]=_[_0x8023('0x34')](_0x5c22f7['query']);_0x51236d[_0x8023('0x3e')]=_[_0x8023('0x35')](_0x51236d[_0x8023('0x31')],_0x51236d[_0x8023('0x33')]);_0x16506c['attributes']=_['intersection'](_0x51236d['model'],qs[_0x8023('0x37')](_0x5c22f7[_0x8023('0x33')][_0x8023('0x37')]));_0x16506c['attributes']=_0x16506c[_0x8023('0x36')][_0x8023('0x38')]?_0x16506c[_0x8023('0x36')]:_0x51236d[_0x8023('0x31')];_0x16506c[_0x8023('0x3b')]=qs[_0x8023('0x3c')](_0x5c22f7['query'][_0x8023('0x3c')]);_0x16506c[_0x8023('0x3d')]=qs[_0x8023('0x3e')](_['pick'](_0x5c22f7[_0x8023('0x33')],_0x51236d[_0x8023('0x3e')]));if(_0x5c22f7[_0x8023('0x33')][_0x8023('0x3f')]){_0x16506c[_0x8023('0x3d')]=_[_0x8023('0x40')](_0x16506c[_0x8023('0x3d')],{'$or':_[_0x8023('0x2b')](_0x16506c[_0x8023('0x36')],function(_0x3b1f63){var _0x5560d6={};_0x5560d6[_0x3b1f63]={'$like':'%'+_0x5c22f7['query'][_0x8023('0x3f')]+'%'};return _0x5560d6;})});}_0x16506c=_[_0x8023('0x40')]({},_0x16506c,_0x5c22f7[_0x8023('0x42')]);return _0x33e8a6[_0x8023('0x5c')](_0x16506c);}})[_0x8023('0x24')](function(_0x1f9e0a){if(_0x1f9e0a){_0x5d210a=_0x1f9e0a[_0x8023('0x38')];if(!_0x5c22f7['query'][_0x8023('0x39')](_0x8023('0x3a'))){_0x16506c['limit']=qs[_0x8023('0x1d')](_0x5c22f7['query'][_0x8023('0x1d')]);_0x16506c[_0x8023('0x1b')]=qs[_0x8023('0x1b')](_0x5c22f7[_0x8023('0x33')][_0x8023('0x1b')]);}return _0x33e8a6[_0x8023('0x5c')](_0x16506c);}})['then'](function(_0x16a35b){if(_0x16a35b){return _0x16a35b?{'count':_0x5d210a,'rows':_0x16a35b}:null;}})[_0x8023('0x24')](respondWithResult(_0x47372a,null))[_0x8023('0x47')](handleError(_0x47372a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 792b934..2bb6425 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 _0x777f=['define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./trigger.attributes'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x777f,0x9f));var _0xf777=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0x777f[_0x5caf7e];return _0x5c3435;};'use strict';var _=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var logger=require(_0xf777('0x2'))(_0xf777('0x3'));var moment=require(_0xf777('0x4'));var BPromise=require(_0xf777('0x5'));var rp=require(_0xf777('0x6'));var fs=require('fs');var path=require(_0xf777('0x7'));var rimraf=require('rimraf');var config=require(_0xf777('0x8'));var attributes=require(_0xf777('0x9'));module['exports']=function(_0x5b7903,_0x5df5dc){return _0x5b7903[_0xf777('0xa')](_0xf777('0xb'),attributes,{'tableName':_0xf777('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa25a=['rimraf','exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x17ee35,_0x5f2792){var _0x334457=function(_0x2876bb){while(--_0x2876bb){_0x17ee35['push'](_0x17ee35['shift']());}};_0x334457(++_0x5f2792);}(_0xa25a,0x160));var _0xaa25=function(_0x25fe0b,_0x199b5a){_0x25fe0b=_0x25fe0b-0x0;var _0x1368bc=_0xa25a[_0x25fe0b];return _0x1368bc;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require(_0xaa25('0x4'));var BPromise=require(_0xaa25('0x5'));var rp=require(_0xaa25('0x6'));var fs=require('fs');var path=require(_0xaa25('0x7'));var rimraf=require(_0xaa25('0x8'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0xaa25('0x9')]=function(_0x866fa1,_0x51ce9a){return _0x866fa1[_0xaa25('0xa')](_0xaa25('0xb'),attributes,{'tableName':'tools_triggers','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 cbe0bf6..eee997f 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 _0x6764=['options','raw','attributes','limit','map','model','include','debug','ShowTrigger','find','where','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrigger','Trigger','findAll'];(function(_0x11b9d3,_0x2d82ce){var _0x4303c3=function(_0x120907){while(--_0x120907){_0x11b9d3['push'](_0x11b9d3['shift']());}};_0x4303c3(++_0x2d82ce);}(_0x6764,0x74));var _0x4676=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6764[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4676('0x0'));var BPromise=require(_0x4676('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4676('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4676('0x3'));var logger=require(_0x4676('0x4'))(_0x4676('0x5'));var config=require(_0x4676('0x6'));var jayson=require(_0x4676('0x7'));var client=jayson[_0x4676('0x8')][_0x4676('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14ffc0,_0x74ce0,_0x1956e6){return new BPromise(function(_0x120a8a,_0x2d6e73){return client[_0x4676('0xa')](_0x14ffc0,_0x1956e6)[_0x4676('0xb')](function(_0x3f2914){logger[_0x4676('0xc')](_0x4676('0xd'),_0x74ce0,'request\x20sent');logger['debug'](_0x4676('0xe'),_0x74ce0,_0x4676('0xf'),JSON[_0x4676('0x10')](_0x3f2914));if(_0x3f2914[_0x4676('0x11')]){if(_0x3f2914['error'][_0x4676('0x12')]===0x1f4){logger['error'](_0x4676('0xd'),_0x74ce0,_0x3f2914[_0x4676('0x11')]['message']);return _0x2d6e73(_0x3f2914[_0x4676('0x11')][_0x4676('0x13')]);}logger[_0x4676('0x11')](_0x4676('0xd'),_0x74ce0,_0x3f2914[_0x4676('0x11')][_0x4676('0x13')]);return _0x120a8a(_0x3f2914['error'][_0x4676('0x13')]);}else{logger[_0x4676('0xc')](_0x4676('0xd'),_0x74ce0,_0x4676('0xf'));_0x120a8a(_0x3f2914['result']['message']);}})[_0x4676('0x14')](function(_0x52e8a1){logger['error'](_0x4676('0xd'),_0x74ce0,_0x52e8a1);_0x2d6e73(_0x52e8a1);});});}exports[_0x4676('0x15')]=function(_0x2c2dc0){var _0x3e5926=this;return new Promise(function(_0x45eeab,_0x7f6ab3){return db[_0x4676('0x16')][_0x4676('0x17')]({'raw':_0x2c2dc0[_0x4676('0x18')]?_0x2c2dc0[_0x4676('0x18')][_0x4676('0x19')]===undefined?!![]:![]:!![],'where':_0x2c2dc0[_0x4676('0x18')]?_0x2c2dc0[_0x4676('0x18')]['where']||null:null,'attributes':_0x2c2dc0[_0x4676('0x18')]?_0x2c2dc0['options'][_0x4676('0x1a')]||null:null,'limit':_0x2c2dc0[_0x4676('0x18')]?_0x2c2dc0[_0x4676('0x18')][_0x4676('0x1b')]||null:null,'include':_0x2c2dc0[_0x4676('0x18')]?_0x2c2dc0['options']['include']?_[_0x4676('0x1c')](_0x2c2dc0['options']['include'],function(_0x243521){return{'model':db[_0x243521[_0x4676('0x1d')]],'as':_0x243521['as'],'attributes':_0x243521[_0x4676('0x1a')],'include':_0x243521[_0x4676('0x1e')]?_[_0x4676('0x1c')](_0x243521[_0x4676('0x1e')],function(_0x5ed4e1){return{'model':db[_0x5ed4e1['model']],'as':_0x5ed4e1['as'],'attributes':_0x5ed4e1[_0x4676('0x1a')],'include':_0x5ed4e1[_0x4676('0x1e')]?_['map'](_0x5ed4e1[_0x4676('0x1e')],function(_0x21d5e8){return{'model':db[_0x21d5e8[_0x4676('0x1d')]],'as':_0x21d5e8['as'],'attributes':_0x21d5e8[_0x4676('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4676('0xb')](function(_0x27e790){logger[_0x4676('0xc')](_0x4676('0x15'),_0x2c2dc0);logger[_0x4676('0x1f')](_0x4676('0x15'),_0x2c2dc0,JSON[_0x4676('0x10')](_0x27e790));_0x45eeab(_0x27e790);})[_0x4676('0x14')](function(_0x5a5e59){logger[_0x4676('0x11')]('GetTrigger',_0x5a5e59[_0x4676('0x13')],_0x2c2dc0);_0x7f6ab3(_0x3e5926[_0x4676('0x11')](0x1f4,_0x5a5e59[_0x4676('0x13')]));});});};exports[_0x4676('0x20')]=function(_0x28d423){var _0x1a5f1a=this;return new Promise(function(_0x553ff0,_0x1715e6){return db[_0x4676('0x16')][_0x4676('0x21')]({'raw':_0x28d423[_0x4676('0x18')]?_0x28d423[_0x4676('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x28d423[_0x4676('0x18')]?_0x28d423[_0x4676('0x18')][_0x4676('0x22')]||null:null,'attributes':_0x28d423['options']?_0x28d423[_0x4676('0x18')][_0x4676('0x1a')]||null:null,'include':_0x28d423[_0x4676('0x18')]?_0x28d423['options'][_0x4676('0x1e')]?_[_0x4676('0x1c')](_0x28d423[_0x4676('0x18')][_0x4676('0x1e')],function(_0x3ba8a2){return{'model':db[_0x3ba8a2[_0x4676('0x1d')]],'as':_0x3ba8a2['as'],'attributes':_0x3ba8a2['attributes'],'include':_0x3ba8a2[_0x4676('0x1e')]?_[_0x4676('0x1c')](_0x3ba8a2['include'],function(_0x4f5c34){return{'model':db[_0x4f5c34[_0x4676('0x1d')]],'as':_0x4f5c34['as'],'attributes':_0x4f5c34[_0x4676('0x1a')],'include':_0x4f5c34[_0x4676('0x1e')]?_[_0x4676('0x1c')](_0x4f5c34['include'],function(_0x10065f){return{'model':db[_0x10065f[_0x4676('0x1d')]],'as':_0x10065f['as'],'attributes':_0x10065f[_0x4676('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x295791){logger[_0x4676('0xc')](_0x4676('0x20'),_0x28d423);logger[_0x4676('0x1f')](_0x4676('0x20'),_0x28d423,JSON[_0x4676('0x10')](_0x295791));_0x553ff0(_0x295791);})[_0x4676('0x14')](function(_0x54fc8a){logger[_0x4676('0x11')](_0x4676('0x20'),_0x54fc8a['message'],_0x28d423);_0x1715e6(_0x1a5f1a[_0x4676('0x11')](0x1f4,_0x54fc8a['message']));});});}; \ No newline at end of file +var _0x8fe0=['limit','include','map','model','attributes','find','raw','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','where'];(function(_0x4f996a,_0x5d07ae){var _0x9dd3fa=function(_0x596cb4){while(--_0x596cb4){_0x4f996a['push'](_0x4f996a['shift']());}};_0x9dd3fa(++_0x5d07ae);}(_0x8fe0,0xec));var _0x08fe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fe0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x08fe('0x0'));var util=require('util');var moment=require(_0x08fe('0x1'));var BPromise=require(_0x08fe('0x2'));var rs=require(_0x08fe('0x3'));var fs=require('fs');var Redis=require(_0x08fe('0x4'));var db=require(_0x08fe('0x5'))['db'];var utils=require(_0x08fe('0x6'));var logger=require(_0x08fe('0x7'))(_0x08fe('0x8'));var config=require('../../config/environment');var jayson=require(_0x08fe('0x9'));var client=jayson[_0x08fe('0xa')][_0x08fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2928e5,_0xdab886,_0x1e442d){return new BPromise(function(_0x2ad20e,_0x18b2d3){return client[_0x08fe('0xc')](_0x2928e5,_0x1e442d)[_0x08fe('0xd')](function(_0x9555d7){logger[_0x08fe('0xe')](_0x08fe('0xf'),_0xdab886,_0x08fe('0x10'));logger[_0x08fe('0x11')](_0x08fe('0x12'),_0xdab886,_0x08fe('0x10'),JSON[_0x08fe('0x13')](_0x9555d7));if(_0x9555d7[_0x08fe('0x14')]){if(_0x9555d7[_0x08fe('0x14')][_0x08fe('0x15')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0xdab886,_0x9555d7['error'][_0x08fe('0x16')]);return _0x18b2d3(_0x9555d7[_0x08fe('0x14')][_0x08fe('0x16')]);}logger[_0x08fe('0x14')](_0x08fe('0xf'),_0xdab886,_0x9555d7['error'][_0x08fe('0x16')]);return _0x2ad20e(_0x9555d7[_0x08fe('0x14')][_0x08fe('0x16')]);}else{logger[_0x08fe('0xe')](_0x08fe('0xf'),_0xdab886,_0x08fe('0x10'));_0x2ad20e(_0x9555d7[_0x08fe('0x17')]['message']);}})[_0x08fe('0x18')](function(_0xaa9b13){logger[_0x08fe('0x14')](_0x08fe('0xf'),_0xdab886,_0xaa9b13);_0x18b2d3(_0xaa9b13);});});}exports[_0x08fe('0x19')]=function(_0x3ab316){var _0x3ad30f=this;return new Promise(function(_0x38cc3b,_0x41cf32){return db[_0x08fe('0x1a')][_0x08fe('0x1b')]({'raw':_0x3ab316[_0x08fe('0x1c')]?_0x3ab316[_0x08fe('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3ab316[_0x08fe('0x1c')]?_0x3ab316[_0x08fe('0x1c')][_0x08fe('0x1d')]||null:null,'attributes':_0x3ab316[_0x08fe('0x1c')]?_0x3ab316['options']['attributes']||null:null,'limit':_0x3ab316['options']?_0x3ab316[_0x08fe('0x1c')][_0x08fe('0x1e')]||null:null,'include':_0x3ab316[_0x08fe('0x1c')]?_0x3ab316['options'][_0x08fe('0x1f')]?_[_0x08fe('0x20')](_0x3ab316[_0x08fe('0x1c')]['include'],function(_0x421ae8){return{'model':db[_0x421ae8[_0x08fe('0x21')]],'as':_0x421ae8['as'],'attributes':_0x421ae8['attributes'],'include':_0x421ae8['include']?_['map'](_0x421ae8['include'],function(_0x79c708){return{'model':db[_0x79c708[_0x08fe('0x21')]],'as':_0x79c708['as'],'attributes':_0x79c708[_0x08fe('0x22')],'include':_0x79c708[_0x08fe('0x1f')]?_[_0x08fe('0x20')](_0x79c708['include'],function(_0x1f561c){return{'model':db[_0x1f561c[_0x08fe('0x21')]],'as':_0x1f561c['as'],'attributes':_0x1f561c[_0x08fe('0x22')]};}):[]};}):[]};}):[]:[]})[_0x08fe('0xd')](function(_0x594f91){logger['info'](_0x08fe('0x19'),_0x3ab316);logger[_0x08fe('0x11')]('GetTrigger',_0x3ab316,JSON[_0x08fe('0x13')](_0x594f91));_0x38cc3b(_0x594f91);})['catch'](function(_0x1ae9df){logger[_0x08fe('0x14')](_0x08fe('0x19'),_0x1ae9df['message'],_0x3ab316);_0x41cf32(_0x3ad30f[_0x08fe('0x14')](0x1f4,_0x1ae9df[_0x08fe('0x16')]));});});};exports['ShowTrigger']=function(_0x24eae9){var _0x272ef0=this;return new Promise(function(_0x20feba,_0x2834e5){return db['Trigger'][_0x08fe('0x23')]({'raw':_0x24eae9['options']?_0x24eae9[_0x08fe('0x1c')][_0x08fe('0x24')]===undefined?!![]:![]:!![],'where':_0x24eae9['options']?_0x24eae9[_0x08fe('0x1c')][_0x08fe('0x1d')]||null:null,'attributes':_0x24eae9[_0x08fe('0x1c')]?_0x24eae9['options'][_0x08fe('0x22')]||null:null,'include':_0x24eae9[_0x08fe('0x1c')]?_0x24eae9[_0x08fe('0x1c')]['include']?_[_0x08fe('0x20')](_0x24eae9['options']['include'],function(_0x5b9574){return{'model':db[_0x5b9574[_0x08fe('0x21')]],'as':_0x5b9574['as'],'attributes':_0x5b9574['attributes'],'include':_0x5b9574[_0x08fe('0x1f')]?_[_0x08fe('0x20')](_0x5b9574['include'],function(_0x40315a){return{'model':db[_0x40315a[_0x08fe('0x21')]],'as':_0x40315a['as'],'attributes':_0x40315a['attributes'],'include':_0x40315a['include']?_[_0x08fe('0x20')](_0x40315a[_0x08fe('0x1f')],function(_0x149f26){return{'model':db[_0x149f26[_0x08fe('0x21')]],'as':_0x149f26['as'],'attributes':_0x149f26[_0x08fe('0x22')]};}):[]};}):[]};}):[]:[]})[_0x08fe('0xd')](function(_0xc8f7d0){logger['info'](_0x08fe('0x25'),_0x24eae9);logger['debug']('ShowTrigger',_0x24eae9,JSON[_0x08fe('0x13')](_0xc8f7d0));_0x20feba(_0xc8f7d0);})['catch'](function(_0x30dcaa){logger[_0x08fe('0x14')]('ShowTrigger',_0x30dcaa['message'],_0x24eae9);_0x2834e5(_0x272ef0[_0x08fe('0x14')](0x1f4,_0x30dcaa[_0x08fe('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 73f7589..dcb3e06 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 _0x117a=['get','isAuthenticated','show','post','clone','create','put','/:id','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','index'];(function(_0x32b308,_0x2c7f89){var _0x5736d5=function(_0x30c8ba){while(--_0x30c8ba){_0x32b308['push'](_0x32b308['shift']());}};_0x5736d5(++_0x2c7f89);}(_0x117a,0x11a));var _0xa117=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x117a[_0x576e2b];return _0x46461a;};'use strict';var multer=require(_0xa117('0x0'));var util=require(_0xa117('0x1'));var path=require(_0xa117('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa117('0x3'));var auth=require(_0xa117('0x4'));var interaction=require(_0xa117('0x5'));var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa117('0x6')]);router[_0xa117('0x7')]('/:id',auth[_0xa117('0x8')](),controller[_0xa117('0x9')]);router[_0xa117('0xa')]('/:id/clone',auth['isAuthenticated'](),controller[_0xa117('0xb')]);router[_0xa117('0xa')]('/',auth[_0xa117('0x8')](),controller[_0xa117('0xc')]);router[_0xa117('0xd')](_0xa117('0xe'),auth[_0xa117('0x8')](),controller['update']);router[_0xa117('0xf')](_0xa117('0xe'),auth[_0xa117('0x8')](),controller['destroy']);module[_0xa117('0x10')]=router; \ No newline at end of file +var _0x2c2e=['put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create'];(function(_0x285ca5,_0x1f3401){var _0x2113ee=function(_0x20f3b6){while(--_0x20f3b6){_0x285ca5['push'](_0x285ca5['shift']());}};_0x2113ee(++_0x1f3401);}(_0x2c2e,0xad));var _0xe2c2=function(_0x221f58,_0x5e2237){_0x221f58=_0x221f58-0x0;var _0x13d0d5=_0x2c2e[_0x221f58];return _0x13d0d5;};'use strict';var multer=require('multer');var util=require(_0xe2c2('0x0'));var path=require(_0xe2c2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe2c2('0x2')]();var fs_extra=require(_0xe2c2('0x3'));var auth=require(_0xe2c2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe2c2('0x5'));var controller=require(_0xe2c2('0x6'));router[_0xe2c2('0x7')]('/',auth[_0xe2c2('0x8')](),controller[_0xe2c2('0x9')]);router[_0xe2c2('0x7')](_0xe2c2('0xa'),auth[_0xe2c2('0x8')](),controller[_0xe2c2('0xb')]);router[_0xe2c2('0xc')](_0xe2c2('0xd'),auth[_0xe2c2('0x8')](),controller[_0xe2c2('0xe')]);router[_0xe2c2('0xc')]('/',auth['isAuthenticated'](),controller[_0xe2c2('0xf')]);router[_0xe2c2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe2c2('0x11')]);router[_0xe2c2('0x12')](_0xe2c2('0xa'),auth[_0xe2c2('0x8')](),controller[_0xe2c2('0x13')]);module[_0xe2c2('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 7ac9491..e0b8812 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 _0x01b6=['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]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','update,nonat','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','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]','all','allow','ulaw;alaw;gsm'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x01b6,0x15d));var _0x601b=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x01b6[_0x29db36];return _0x234e87;};'use strict';var Sequelize=require(_0x601b('0x0'));module['exports']={'name':{'type':Sequelize[_0x601b('0x1')],'allowNull':![],'unique':_0x601b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x4'),_0x601b('0x5'),_0x601b('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x601b('0x7')},'callingpres':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x8'),_0x601b('0x9'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x601b('0xa'),_0x601b('0xb'),_0x601b('0xc'),_0x601b('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x601b('0x1')]},'secret':{'type':Sequelize[_0x601b('0x1')]},'md5secret':{'type':Sequelize[_0x601b('0x1')]},'remotesecret':{'type':Sequelize[_0x601b('0x1')]},'transport':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0xe'),'set':function(_0x448b11){this[_0x601b('0xf')](_0x601b('0x10'),_0x448b11?_0x448b11[_0x601b('0x11')](','):null);},'get':function(){return this[_0x601b('0x12')]('transport')?this[_0x601b('0x12')](_0x601b('0x10'))[_0x601b('0x13')](','):null;},'comment':_0x601b('0x14')},'dtmfmode':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x15'),_0x601b('0x16'),_0x601b('0x17'),_0x601b('0x18'),_0x601b('0x19')),'defaultValue':_0x601b('0x15')},'directmedia':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no',_0x601b('0x1b'),_0x601b('0x1c'),_0x601b('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x601b('0x1')]},'nat':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0x1e'),'set':function(_0x4248cf){this['setDataValue']('nat',_0x4248cf?_0x4248cf[_0x601b('0x11')](','):null);},'get':function(){return this[_0x601b('0x12')](_0x601b('0x1f'))?this[_0x601b('0x12')](_0x601b('0x1f'))['split'](','):null;},'comment':_0x601b('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x601b('0x1')]},'language':{'type':Sequelize[_0x601b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x601b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0x21')},'allow':{'type':Sequelize[_0x601b('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x37b216){this['setDataValue'](_0x601b('0x22'),_0x37b216?_0x37b216[_0x601b('0x11')](';'):_0x601b('0x23'));},'get':function(){return this['getDataValue'](_0x601b('0x22'))?this['getDataValue'](_0x601b('0x22'))[_0x601b('0x13')](';'):null;},'comment':_0x601b('0x24')},'autoframing':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'insecure':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0x25'),'set':function(_0x3df364){this['setDataValue'](_0x601b('0x26'),_0x3df364?_0x3df364[_0x601b('0x11')](','):null);},'get':function(){return this[_0x601b('0x12')](_0x601b('0x26'))?this[_0x601b('0x12')](_0x601b('0x26'))[_0x601b('0x13')](','):null;},'comment':_0x601b('0x27')},'trustrpid':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no','never')},'promiscredir':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x601b('0x28')](0xb)},'setvar':{'type':Sequelize[_0x601b('0x1')]},'callerid':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0x29')},'amaflags':{'type':Sequelize[_0x601b('0x1')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x601b('0x1a')},'busylevel':{'type':Sequelize[_0x601b('0x28')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x601b('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no',_0x601b('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x601b('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x601b('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x601b('0x2b'),_0x601b('0x2c'),_0x601b('0x2d'))},'session_expires':{'type':Sequelize[_0x601b('0x28')](0xb)},'session_minse':{'type':Sequelize[_0x601b('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x2e'),'uas'),'defaultValue':_0x601b('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0x601b('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x601b('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x601b('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x601b('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no',_0x601b('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x601b('0x1')]},'callbackextension':{'type':Sequelize[_0x601b('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x601b('0x1')]},'contactdeny':{'type':Sequelize[_0x601b('0x1')]},'contactacl':{'type':Sequelize[_0x601b('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x601b('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no',_0x601b('0x31'),_0x601b('0x32'))},'dtlsrekey':{'type':Sequelize[_0x601b('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x601b('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x601b('0x1')]},'dtlscipher':{'type':Sequelize[_0x601b('0x1')]},'dtlscafile':{'type':Sequelize[_0x601b('0x1')]},'dtlscapath':{'type':Sequelize[_0x601b('0x1')]},'dtlssetup':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x33'),_0x601b('0x34'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x601b('0x1')]},'usereqphone':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x601b('0x1')]},'recordofffeature':{'type':Sequelize[_0x601b('0x1')]},'call_limit':{'type':Sequelize[_0x601b('0x28')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x601b('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x601b('0x3')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x601b('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x601b('0x1')],'defaultValue':_0x601b('0x35')},'canreinvite':{'type':Sequelize[_0x601b('0x3')](_0x601b('0x1a'),'no',_0x601b('0x1b'),'update',_0x601b('0x36')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x601b('0x1')]},'otherFields':{'type':Sequelize[_0x601b('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4bde=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue'];(function(_0x3e3221,_0x392851){var _0x190da4=function(_0x13d601){while(--_0x13d601){_0x3e3221['push'](_0x3e3221['shift']());}};_0x190da4(++_0x392851);}(_0x4bde,0x153));var _0xe4bd=function(_0x485f70,_0x3b56c6){_0x485f70=_0x485f70-0x0;var _0x5e04c2=_0x4bde[_0x485f70];return _0x5e04c2;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'name':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':![],'unique':_0xe4bd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe4bd('0x4')]('friend',_0xe4bd('0x5'),_0xe4bd('0x6')),'allowNull':![],'defaultValue':_0xe4bd('0x7')},'context':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':![],'defaultValue':_0xe4bd('0x8')},'callingpres':{'type':Sequelize[_0xe4bd('0x4')]('ALLOWED_NOT_SCREENED',_0xe4bd('0x9'),_0xe4bd('0xa'),_0xe4bd('0xb'),'PROHIB_NOT_SCREENED',_0xe4bd('0xc'),'PROHIB_FAILED_SCREEN',_0xe4bd('0xd'))},'deny':{'type':Sequelize[_0xe4bd('0x2')]},'permit':{'type':Sequelize[_0xe4bd('0x2')]},'secret':{'type':Sequelize[_0xe4bd('0x2')]},'md5secret':{'type':Sequelize[_0xe4bd('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x3a7e70){this[_0xe4bd('0xe')](_0xe4bd('0xf'),_0x3a7e70?_0x3a7e70[_0xe4bd('0x10')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xe4bd('0x11')](_0xe4bd('0xf'))['split'](','):null;},'comment':_0xe4bd('0x12')},'dtmfmode':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x13'),_0xe4bd('0x14'),_0xe4bd('0x15'),_0xe4bd('0x16'),_0xe4bd('0x17')),'defaultValue':_0xe4bd('0x13')},'directmedia':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no',_0xe4bd('0x19'),_0xe4bd('0x1a'),_0xe4bd('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':'force_rport,comedia','set':function(_0x3af8df){this['setDataValue'](_0xe4bd('0x1c'),_0x3af8df?_0x3af8df[_0xe4bd('0x10')](','):null);},'get':function(){return this[_0xe4bd('0x11')](_0xe4bd('0x1c'))?this[_0xe4bd('0x11')](_0xe4bd('0x1c'))[_0xe4bd('0x1d')](','):null;},'comment':_0xe4bd('0x1e')},'callgroup':{'type':Sequelize[_0xe4bd('0x2')]},'namedcallgroup':{'type':Sequelize[_0xe4bd('0x2')]},'pickupgroup':{'type':Sequelize[_0xe4bd('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xe4bd('0x2')]},'language':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':_0xe4bd('0x1f')},'allow':{'type':Sequelize[_0xe4bd('0x2')],'allowNull':![],'defaultValue':_0xe4bd('0x20'),'set':function(_0x2ca146){this['setDataValue'](_0xe4bd('0x21'),_0x2ca146?_0x2ca146[_0xe4bd('0x10')](';'):_0xe4bd('0x20'));},'get':function(){return this[_0xe4bd('0x11')](_0xe4bd('0x21'))?this[_0xe4bd('0x11')](_0xe4bd('0x21'))[_0xe4bd('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0xe4bd('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':_0xe4bd('0x22'),'set':function(_0x30c0b1){this[_0xe4bd('0xe')](_0xe4bd('0x23'),_0x30c0b1?_0x30c0b1[_0xe4bd('0x10')](','):null);},'get':function(){return this[_0xe4bd('0x11')]('insecure')?this[_0xe4bd('0x11')]('insecure')[_0xe4bd('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no',_0xe4bd('0x24'))},'promiscredir':{'type':Sequelize[_0xe4bd('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no')},'accountcode':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':_0xe4bd('0x26')},'amaflags':{'type':Sequelize[_0xe4bd('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no'),'defaultValue':_0xe4bd('0x18')},'busylevel':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xe4bd('0x2')]},'template':{'type':Sequelize[_0xe4bd('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no',_0xe4bd('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x28'),_0xe4bd('0x29'),_0xe4bd('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x2b'),_0xe4bd('0x2c')),'defaultValue':_0xe4bd('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0xe4bd('0x2')]},'regexten':{'type':Sequelize[_0xe4bd('0x2')]},'fromdomain':{'type':Sequelize[_0xe4bd('0x2')]},'fromuser':{'type':Sequelize[_0xe4bd('0x2')]},'port':{'type':Sequelize[_0xe4bd('0x25')](0x5)},'qualify':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no'),'defaultValue':_0xe4bd('0x18')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xe4bd('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe4bd('0x2')]},'callbackextension':{'type':Sequelize[_0xe4bd('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xe4bd('0x2')]},'contactdeny':{'type':Sequelize[_0xe4bd('0x2')]},'contactacl':{'type':Sequelize[_0xe4bd('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xe4bd('0x2')]},'use_q850_reason':{'type':Sequelize[_0xe4bd('0x2')]},'maxforwards':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'encryption':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'icesupport':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xe4bd('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0xe4bd('0x4')]('yes','no',_0xe4bd('0x2d'),_0xe4bd('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xe4bd('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xe4bd('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xe4bd('0x2')]},'dtlscapath':{'type':Sequelize[_0xe4bd('0x2')]},'dtlssetup':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x2f'),'passive',_0xe4bd('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe4bd('0x2')]},'recordofffeature':{'type':Sequelize[_0xe4bd('0x2')]},'call_limit':{'type':Sequelize[_0xe4bd('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no')},'vmexten':{'type':Sequelize[_0xe4bd('0x2')]},'mohinterpret':{'type':Sequelize[_0xe4bd('0x2')]},'mohsuggest':{'type':Sequelize[_0xe4bd('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe4bd('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xe4bd('0x4')](_0xe4bd('0x18'),'no',_0xe4bd('0x19'),'update',_0xe4bd('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe4bd('0x2')]},'otherFields':{'type':Sequelize[_0xe4bd('0x2')]},'active':{'type':Sequelize[_0xe4bd('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index f63df77..dd60464 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 _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x548220,_0x2fda2c){var _0xd76e76=function(_0x29b8ac){while(--_0x29b8ac){_0x548220['push'](_0x548220['shift']());}};_0xd76e76(++_0x2fda2c);}(_0x3e74,0x175));var _0x43e7=function(_0x589fac,_0x26b9c8){_0x589fac=_0x589fac-0x0;var _0x55cfd7=_0x3e74[_0x589fac];return _0x55cfd7;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0xa9d6ab,_0x522307){var _0x556205=function(_0x4e6a73){while(--_0x4e6a73){_0xa9d6ab['push'](_0xa9d6ab['shift']());}};_0x556205(++_0x522307);}(_0xe14d,0x1ee));var _0xde14=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xe14d[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index d239b16..87f9e7c 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 _0x1f17=['Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x552ec2,_0x3a393f){var _0x5cd583=function(_0x4d852b){while(--_0x4d852b){_0x552ec2['push'](_0x552ec2['shift']());}};_0x5cd583(++_0x3a393f);}(_0x1f17,0x1be));var _0x71f1=function(_0x28c89b,_0x2510b3){_0x28c89b=_0x28c89b-0x0;var _0x176500=_0x1f17[_0x28c89b];return _0x176500;};'use strict';var _=require(_0x71f1('0x0'));var util=require(_0x71f1('0x1'));var logger=require(_0x71f1('0x2'))(_0x71f1('0x3'));var moment=require(_0x71f1('0x4'));var BPromise=require(_0x71f1('0x5'));var rp=require(_0x71f1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x71f1('0x7'));var config=require(_0x71f1('0x8'));var attributes=require('./trunk.attributes');module[_0x71f1('0x9')]=function(_0x43c352,_0x44e778){return _0x43c352['define'](_0x71f1('0xa'),attributes,{'tableName':_0x71f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x744b=['Trunk','lodash','util','../../config/logger','api','moment','path','rimraf','./trunk.attributes','exports','define'];(function(_0x5bebee,_0x3f73ae){var _0x304b5a=function(_0x7589c7){while(--_0x7589c7){_0x5bebee['push'](_0x5bebee['shift']());}};_0x304b5a(++_0x3f73ae);}(_0x744b,0x16c));var _0xb744=function(_0xf4f985,_0x21a7f4){_0xf4f985=_0xf4f985-0x0;var _0x56d65a=_0x744b[_0xf4f985];return _0x56d65a;};'use strict';var _=require(_0xb744('0x0'));var util=require(_0xb744('0x1'));var logger=require(_0xb744('0x2'))(_0xb744('0x3'));var moment=require(_0xb744('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb744('0x5'));var rimraf=require(_0xb744('0x6'));var config=require('../../config/environment');var attributes=require(_0xb744('0x7'));module[_0xb744('0x8')]=function(_0x2924b4,_0x1d03b5){return _0x2924b4[_0xb744('0x9')](_0xb744('0xa'),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 b16ceed..cec8281 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 _0xc71d=['model','map','stringify','ShowTrunk','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','include'];(function(_0x150fc7,_0x130f7b){var _0x344446=function(_0x15d401){while(--_0x15d401){_0x150fc7['push'](_0x150fc7['shift']());}};_0x344446(++_0x130f7b);}(_0xc71d,0xb0));var _0xdc71=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xc71d[_0x318840];return _0x223da4;};'use strict';var _=require(_0xdc71('0x0'));var util=require(_0xdc71('0x1'));var moment=require(_0xdc71('0x2'));var BPromise=require(_0xdc71('0x3'));var rs=require(_0xdc71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc71('0x5'))['db'];var utils=require(_0xdc71('0x6'));var logger=require(_0xdc71('0x7'))(_0xdc71('0x8'));var config=require('../../config/environment');var jayson=require(_0xdc71('0x9'));var client=jayson[_0xdc71('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4597f1,_0x2d7aba,_0x5aa26a){return new BPromise(function(_0x326dc4,_0x6f77c2){return client[_0xdc71('0xb')](_0x4597f1,_0x5aa26a)[_0xdc71('0xc')](function(_0x267b4b){logger[_0xdc71('0xd')](_0xdc71('0xe'),_0x2d7aba,'request\x20sent');logger[_0xdc71('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2d7aba,_0xdc71('0x10'),JSON['stringify'](_0x267b4b));if(_0x267b4b['error']){if(_0x267b4b[_0xdc71('0x11')][_0xdc71('0x12')]===0x1f4){logger['error'](_0xdc71('0xe'),_0x2d7aba,_0x267b4b['error'][_0xdc71('0x13')]);return _0x6f77c2(_0x267b4b[_0xdc71('0x11')]['message']);}logger[_0xdc71('0x11')]('Trunk,\x20%s,\x20%s',_0x2d7aba,_0x267b4b[_0xdc71('0x11')]['message']);return _0x326dc4(_0x267b4b['error'][_0xdc71('0x13')]);}else{logger[_0xdc71('0xd')](_0xdc71('0xe'),_0x2d7aba,'request\x20sent');_0x326dc4(_0x267b4b['result'][_0xdc71('0x13')]);}})[_0xdc71('0x14')](function(_0x4c7ea3){logger[_0xdc71('0x11')](_0xdc71('0xe'),_0x2d7aba,_0x4c7ea3);_0x6f77c2(_0x4c7ea3);});});}exports[_0xdc71('0x15')]=function(_0x416651){var _0x300c9c=this;return new Promise(function(_0x205877,_0x369fb2){return db[_0xdc71('0x16')][_0xdc71('0x17')]({'raw':_0x416651[_0xdc71('0x18')]?_0x416651['options'][_0xdc71('0x19')]===undefined?!![]:![]:!![],'where':_0x416651['options']?_0x416651[_0xdc71('0x18')]['where']||null:null,'attributes':_0x416651[_0xdc71('0x18')]?_0x416651[_0xdc71('0x18')][_0xdc71('0x1a')]||null:null,'limit':_0x416651[_0xdc71('0x18')]?_0x416651['options']['limit']||null:null,'include':_0x416651[_0xdc71('0x18')]?_0x416651[_0xdc71('0x18')][_0xdc71('0x1b')]?_['map'](_0x416651[_0xdc71('0x18')][_0xdc71('0x1b')],function(_0x1bfe02){return{'model':db[_0x1bfe02[_0xdc71('0x1c')]],'as':_0x1bfe02['as'],'attributes':_0x1bfe02[_0xdc71('0x1a')],'include':_0x1bfe02[_0xdc71('0x1b')]?_[_0xdc71('0x1d')](_0x1bfe02['include'],function(_0x5ded20){return{'model':db[_0x5ded20['model']],'as':_0x5ded20['as'],'attributes':_0x5ded20[_0xdc71('0x1a')],'include':_0x5ded20[_0xdc71('0x1b')]?_[_0xdc71('0x1d')](_0x5ded20[_0xdc71('0x1b')],function(_0x4e5222){return{'model':db[_0x4e5222[_0xdc71('0x1c')]],'as':_0x4e5222['as'],'attributes':_0x4e5222[_0xdc71('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdc71('0xc')](function(_0x2a39f4){logger[_0xdc71('0xd')]('GetTrunk',_0x416651);logger[_0xdc71('0xf')](_0xdc71('0x15'),_0x416651,JSON[_0xdc71('0x1e')](_0x2a39f4));_0x205877(_0x2a39f4);})[_0xdc71('0x14')](function(_0x293a69){logger[_0xdc71('0x11')]('GetTrunk',_0x293a69['message'],_0x416651);_0x369fb2(_0x300c9c['error'](0x1f4,_0x293a69[_0xdc71('0x13')]));});});};exports[_0xdc71('0x1f')]=function(_0x1cd7a6){var _0x2c59ff=this;return new Promise(function(_0x5745ed,_0xb73b46){return db[_0xdc71('0x16')][_0xdc71('0x20')]({'raw':_0x1cd7a6[_0xdc71('0x18')]?_0x1cd7a6['options'][_0xdc71('0x19')]===undefined?!![]:![]:!![],'where':_0x1cd7a6[_0xdc71('0x18')]?_0x1cd7a6[_0xdc71('0x18')][_0xdc71('0x21')]||null:null,'attributes':_0x1cd7a6['options']?_0x1cd7a6[_0xdc71('0x18')][_0xdc71('0x1a')]||null:null,'include':_0x1cd7a6[_0xdc71('0x18')]?_0x1cd7a6['options'][_0xdc71('0x1b')]?_[_0xdc71('0x1d')](_0x1cd7a6[_0xdc71('0x18')][_0xdc71('0x1b')],function(_0xf9c039){return{'model':db[_0xf9c039[_0xdc71('0x1c')]],'as':_0xf9c039['as'],'attributes':_0xf9c039[_0xdc71('0x1a')],'include':_0xf9c039[_0xdc71('0x1b')]?_['map'](_0xf9c039[_0xdc71('0x1b')],function(_0x2c218d){return{'model':db[_0x2c218d['model']],'as':_0x2c218d['as'],'attributes':_0x2c218d[_0xdc71('0x1a')],'include':_0x2c218d['include']?_[_0xdc71('0x1d')](_0x2c218d[_0xdc71('0x1b')],function(_0x208b11){return{'model':db[_0x208b11[_0xdc71('0x1c')]],'as':_0x208b11['as'],'attributes':_0x208b11['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc71('0xc')](function(_0x3df4fe){logger[_0xdc71('0xd')]('ShowTrunk',_0x1cd7a6);logger[_0xdc71('0xf')](_0xdc71('0x1f'),_0x1cd7a6,JSON[_0xdc71('0x1e')](_0x3df4fe));_0x5745ed(_0x3df4fe);})['catch'](function(_0x35d1ae){logger[_0xdc71('0x11')](_0xdc71('0x1f'),_0x35d1ae[_0xdc71('0x13')],_0x1cd7a6);_0xb73b46(_0x2c59ff[_0xdc71('0x11')](0x1f4,_0x35d1ae[_0xdc71('0x13')]));});});}; \ No newline at end of file +var _0xc0bd=['Trunk','options','where','limit','map','model','attributes','include','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetTrunk'];(function(_0xb2717e,_0x5f3ba5){var _0xbe3f06=function(_0x1c84b1){while(--_0x1c84b1){_0xb2717e['push'](_0xb2717e['shift']());}};_0xbe3f06(++_0x5f3ba5);}(_0xc0bd,0x18c));var _0xdc0b=function(_0x1a04d2,_0x333082){_0x1a04d2=_0x1a04d2-0x0;var _0x434ec6=_0xc0bd[_0x1a04d2];return _0x434ec6;};'use strict';var _=require(_0xdc0b('0x0'));var util=require(_0xdc0b('0x1'));var moment=require(_0xdc0b('0x2'));var BPromise=require(_0xdc0b('0x3'));var rs=require(_0xdc0b('0x4'));var fs=require('fs');var Redis=require(_0xdc0b('0x5'));var db=require(_0xdc0b('0x6'))['db'];var utils=require(_0xdc0b('0x7'));var logger=require(_0xdc0b('0x8'))(_0xdc0b('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc0b('0xa'));var client=jayson['client'][_0xdc0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc61d,_0x13ff2f,_0x17ba91){return new BPromise(function(_0x1f23b5,_0x5015bc){return client[_0xdc0b('0xc')](_0x2cc61d,_0x17ba91)[_0xdc0b('0xd')](function(_0xf712a5){logger[_0xdc0b('0xe')](_0xdc0b('0xf'),_0x13ff2f,_0xdc0b('0x10'));logger[_0xdc0b('0x11')](_0xdc0b('0x12'),_0x13ff2f,_0xdc0b('0x10'),JSON['stringify'](_0xf712a5));if(_0xf712a5[_0xdc0b('0x13')]){if(_0xf712a5[_0xdc0b('0x13')]['code']===0x1f4){logger['error'](_0xdc0b('0xf'),_0x13ff2f,_0xf712a5[_0xdc0b('0x13')][_0xdc0b('0x14')]);return _0x5015bc(_0xf712a5['error'][_0xdc0b('0x14')]);}logger[_0xdc0b('0x13')](_0xdc0b('0xf'),_0x13ff2f,_0xf712a5[_0xdc0b('0x13')][_0xdc0b('0x14')]);return _0x1f23b5(_0xf712a5['error'][_0xdc0b('0x14')]);}else{logger[_0xdc0b('0xe')](_0xdc0b('0xf'),_0x13ff2f,_0xdc0b('0x10'));_0x1f23b5(_0xf712a5[_0xdc0b('0x15')]['message']);}})[_0xdc0b('0x16')](function(_0x1a8799){logger[_0xdc0b('0x13')](_0xdc0b('0xf'),_0x13ff2f,_0x1a8799);_0x5015bc(_0x1a8799);});});}exports[_0xdc0b('0x17')]=function(_0x462930){var _0x1696b1=this;return new Promise(function(_0x3fce5d,_0x1eedf9){return db[_0xdc0b('0x18')]['findAll']({'raw':_0x462930[_0xdc0b('0x19')]?_0x462930[_0xdc0b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x462930[_0xdc0b('0x19')]?_0x462930[_0xdc0b('0x19')][_0xdc0b('0x1a')]||null:null,'attributes':_0x462930[_0xdc0b('0x19')]?_0x462930[_0xdc0b('0x19')]['attributes']||null:null,'limit':_0x462930[_0xdc0b('0x19')]?_0x462930[_0xdc0b('0x19')][_0xdc0b('0x1b')]||null:null,'include':_0x462930[_0xdc0b('0x19')]?_0x462930[_0xdc0b('0x19')]['include']?_[_0xdc0b('0x1c')](_0x462930[_0xdc0b('0x19')]['include'],function(_0x42861c){return{'model':db[_0x42861c[_0xdc0b('0x1d')]],'as':_0x42861c['as'],'attributes':_0x42861c[_0xdc0b('0x1e')],'include':_0x42861c['include']?_['map'](_0x42861c[_0xdc0b('0x1f')],function(_0x2385ee){return{'model':db[_0x2385ee[_0xdc0b('0x1d')]],'as':_0x2385ee['as'],'attributes':_0x2385ee['attributes'],'include':_0x2385ee[_0xdc0b('0x1f')]?_['map'](_0x2385ee[_0xdc0b('0x1f')],function(_0x53fb5c){return{'model':db[_0x53fb5c[_0xdc0b('0x1d')]],'as':_0x53fb5c['as'],'attributes':_0x53fb5c[_0xdc0b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc0b('0xd')](function(_0x12a9ab){logger[_0xdc0b('0xe')](_0xdc0b('0x17'),_0x462930);logger[_0xdc0b('0x11')](_0xdc0b('0x17'),_0x462930,JSON[_0xdc0b('0x20')](_0x12a9ab));_0x3fce5d(_0x12a9ab);})[_0xdc0b('0x16')](function(_0x516b6a){logger[_0xdc0b('0x13')](_0xdc0b('0x17'),_0x516b6a[_0xdc0b('0x14')],_0x462930);_0x1eedf9(_0x1696b1[_0xdc0b('0x13')](0x1f4,_0x516b6a[_0xdc0b('0x14')]));});});};exports[_0xdc0b('0x21')]=function(_0x20ef3e){var _0x12e14c=this;return new Promise(function(_0x15613e,_0x22e97b){return db[_0xdc0b('0x18')][_0xdc0b('0x22')]({'raw':_0x20ef3e[_0xdc0b('0x19')]?_0x20ef3e[_0xdc0b('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x20ef3e[_0xdc0b('0x19')]?_0x20ef3e[_0xdc0b('0x19')]['where']||null:null,'attributes':_0x20ef3e[_0xdc0b('0x19')]?_0x20ef3e[_0xdc0b('0x19')]['attributes']||null:null,'include':_0x20ef3e[_0xdc0b('0x19')]?_0x20ef3e[_0xdc0b('0x19')][_0xdc0b('0x1f')]?_[_0xdc0b('0x1c')](_0x20ef3e[_0xdc0b('0x19')][_0xdc0b('0x1f')],function(_0x48c47c){return{'model':db[_0x48c47c[_0xdc0b('0x1d')]],'as':_0x48c47c['as'],'attributes':_0x48c47c[_0xdc0b('0x1e')],'include':_0x48c47c[_0xdc0b('0x1f')]?_[_0xdc0b('0x1c')](_0x48c47c[_0xdc0b('0x1f')],function(_0x101488){return{'model':db[_0x101488['model']],'as':_0x101488['as'],'attributes':_0x101488[_0xdc0b('0x1e')],'include':_0x101488[_0xdc0b('0x1f')]?_[_0xdc0b('0x1c')](_0x101488['include'],function(_0x21d80d){return{'model':db[_0x21d80d['model']],'as':_0x21d80d['as'],'attributes':_0x21d80d[_0xdc0b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5cacd5){logger['info'](_0xdc0b('0x21'),_0x20ef3e);logger[_0xdc0b('0x11')]('ShowTrunk',_0x20ef3e,JSON[_0xdc0b('0x20')](_0x5cacd5));_0x15613e(_0x5cacd5);})[_0xdc0b('0x16')](function(_0x3bf244){logger[_0xdc0b('0x13')](_0xdc0b('0x21'),_0x3bf244[_0xdc0b('0x14')],_0x20ef3e);_0x22e97b(_0x12e14c[_0xdc0b('0x13')](0x1f4,_0x3bf244['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d063dc1..da2eb13 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 _0x6b93=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','exports','Router'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6b93,0x68));var _0x36b9=function(_0x2bf410,_0x585a77){_0x2bf410=_0x2bf410-0x0;var _0x527046=_0x6b93[_0x2bf410];return _0x527046;};'use strict';var express=require('express');var router=express[_0x36b9('0x0')]();var auth=require(_0x36b9('0x1'));var controller=require(_0x36b9('0x2'));router[_0x36b9('0x3')](_0x36b9('0x4'),auth[_0x36b9('0x5')](),controller['update']);module[_0x36b9('0x6')]=router; \ No newline at end of file +var _0x278e=['isAuthenticated','update','exports','express','Router','./user-setting.controller','/:id'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x278e,0x1ae));var _0xe278=function(_0x346f68,_0xb45d9d){_0x346f68=_0x346f68-0x0;var _0x2d1803=_0x278e[_0x346f68];return _0x2d1803;};'use strict';var express=require(_0xe278('0x0'));var router=express[_0xe278('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe278('0x2'));router['put'](_0xe278('0x3'),auth[_0xe278('0x4')](),controller[_0xe278('0x5')]);module[_0xe278('0x6')]=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 51e7357..b4e4aa6 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 _0x5c7a=['TEXT','DATE','INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','BOOLEAN'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x5c7a,0x130));var _0xa5c7=function(_0x1d9163,_0x79567d){_0x1d9163=_0x1d9163-0x0;var _0xb42197=_0x5c7a[_0x1d9163];return _0xb42197;};'use strict';var Sequelize=require(_0xa5c7('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xa5c7('0x1'),_0xa5c7('0x2'),_0xa5c7('0x3'),_0xa5c7('0x4')];module[_0xa5c7('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xa5c7('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xa5c7('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xa5c7('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xa5c7('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xa5c7('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xa5c7('0xa')],'unique':_0xa5c7('0xb')}}; \ No newline at end of file +var _0x7b21=['DATE','INTEGER','error','warning','ENUM','TEXT'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x7b21,0xda));var _0x17b2=function(_0xb3ccad,_0x41f121){_0xb3ccad=_0xb3ccad-0x0;var _0x5bcba9=_0x7b21[_0xb3ccad];return _0x5bcba9;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x17b2('0x0'),_0x17b2('0x1'),'info','debug'];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x17b2('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x17b2('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x17b2('0x3')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x17b2('0x4')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x17b2('0x5')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 407c50e..5d4faeb 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 _0xc770=['params','Invalid\x20user\x20setting\x20id','find','body','lodash','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','json','then','sendStatus','stack','name','status','user','role','admin'];(function(_0xb933b5,_0x1dc69f){var _0x4e1165=function(_0xbefeb2){while(--_0xbefeb2){_0xb933b5['push'](_0xb933b5['shift']());}};_0x4e1165(++_0x1dc69f);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var Redis=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var config=require(_0x0c77('0x2'));var db=require(_0x0c77('0x3'))['db'];var socket=require(_0x0c77('0x4'))(new Redis(config[_0x0c77('0x5')]));require(_0x0c77('0x6'))[_0x0c77('0x7')](socket);config[_0x0c77('0x5')]=_[_0x0c77('0x8')](config['redis'],{'host':_0x0c77('0x9'),'port':0x18eb});function respondWithResult(_0x1972ef,_0x4b2424){_0x4b2424=_0x4b2424||0xc8;return function(_0x221281){if(_0x221281){return _0x1972ef['status'](_0x4b2424)[_0x0c77('0xa')](_0x221281);}};}function saveUpdates(_0x339a3d){return function(_0x3a09de){if(_0x3a09de){return _0x3a09de['update'](_0x339a3d)[_0x0c77('0xb')](function(_0x194f36){return _0x194f36;});}return null;};}function handleEntityNotFound(_0x4b47f0){return function(_0x58c6d5){if(!_0x58c6d5){_0x4b47f0[_0x0c77('0xc')](0x194);}return _0x58c6d5;};}function handleError(_0x4fe5cf,_0x145e17){_0x145e17=_0x145e17||0x1f4;return function(_0x831896){logger['error'](_0x831896[_0x0c77('0xd')]);if(_0x831896[_0x0c77('0xe')]){delete _0x831896[_0x0c77('0xe')];}_0x4fe5cf[_0x0c77('0xf')](_0x145e17)['send'](_0x831896);};}exports['update']=function(_0x525e76,_0x466ac8){if(_0x525e76[_0x0c77('0x10')][_0x0c77('0x11')]!==_0x0c77('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x525e76[_0x0c77('0x13')]['id'])))throw new Error(_0x0c77('0x14'));return db['UserSetting'][_0x0c77('0x15')]({'where':{'id':_0x525e76[_0x0c77('0x13')]['id']}})['then'](handleEntityNotFound(_0x466ac8,null))['then'](saveUpdates(_0x525e76[_0x0c77('0x16')],null))[_0x0c77('0xb')](respondWithResult(_0x466ac8,null))['catch'](handleError(_0x466ac8,null));}; \ No newline at end of file +var _0xb38e=['ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','register','defaults','redis','localhost','status','json','update','then','sendStatus','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','lodash'];(function(_0x51f7f0,_0x241265){var _0x7e82a5=function(_0x379e8a){while(--_0x379e8a){_0x51f7f0['push'](_0x51f7f0['shift']());}};_0x7e82a5(++_0x241265);}(_0xb38e,0xa7));var _0xeb38=function(_0x3a3e2a,_0x427f7f){_0x3a3e2a=_0x3a3e2a-0x0;var _0x254588=_0xb38e[_0x3a3e2a];return _0x254588;};'use strict';var _=require(_0xeb38('0x0'));var Redis=require(_0xeb38('0x1'));var logger=require(_0xeb38('0x2'))(_0xeb38('0x3'));var config=require(_0xeb38('0x4'));var db=require(_0xeb38('0x5'))['db'];var socket=require(_0xeb38('0x6'))(new Redis(config['redis']));require(_0xeb38('0x7'))[_0xeb38('0x8')](socket);config['redis']=_[_0xeb38('0x9')](config[_0xeb38('0xa')],{'host':_0xeb38('0xb'),'port':0x18eb});function respondWithResult(_0x31db8c,_0x4cfa4d){_0x4cfa4d=_0x4cfa4d||0xc8;return function(_0x3003aa){if(_0x3003aa){return _0x31db8c[_0xeb38('0xc')](_0x4cfa4d)[_0xeb38('0xd')](_0x3003aa);}};}function saveUpdates(_0x35dec7){return function(_0x4c3a7d){if(_0x4c3a7d){return _0x4c3a7d[_0xeb38('0xe')](_0x35dec7)[_0xeb38('0xf')](function(_0x8a6144){return _0x8a6144;});}return null;};}function handleEntityNotFound(_0xa54e19){return function(_0xfbd120){if(!_0xfbd120){_0xa54e19[_0xeb38('0x10')](0x194);}return _0xfbd120;};}function handleError(_0x16edc9,_0x5838cd){_0x5838cd=_0x5838cd||0x1f4;return function(_0x170e47){logger['error'](_0x170e47[_0xeb38('0x11')]);if(_0x170e47[_0xeb38('0x12')]){delete _0x170e47['name'];}_0x16edc9[_0xeb38('0xc')](_0x5838cd)[_0xeb38('0x13')](_0x170e47);};}exports[_0xeb38('0xe')]=function(_0x398ca9,_0x6bc43d){if(_0x398ca9[_0xeb38('0x14')]['role']!==_0xeb38('0x15'))throw new Error(_0xeb38('0x16'));if(isNaN(Number(_0x398ca9[_0xeb38('0x17')]['id'])))throw new Error(_0xeb38('0x18'));return db[_0xeb38('0x19')][_0xeb38('0x1a')]({'where':{'id':_0x398ca9[_0xeb38('0x17')]['id']}})['then'](handleEntityNotFound(_0x6bc43d,null))[_0xeb38('0xf')](saveUpdates(_0x398ca9[_0xeb38('0x1b')],null))[_0xeb38('0xf')](respondWithResult(_0x6bc43d,null))['catch'](handleError(_0x6bc43d,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 275a3b9..17be8c2 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 _0x2290=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2290,0x1c1));var _0x0229=function(_0x3ce61e,_0x3e10c0){_0x3ce61e=_0x3ce61e-0x0;var _0x10aaf8=_0x2290[_0x3ce61e];return _0x10aaf8;};'use strict';var EventEmitter=require(_0x0229('0x0'));var UserSetting=require(_0x0229('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0229('0x2')](0x0);var events={'afterCreate':_0x0229('0x3'),'afterUpdate':_0x0229('0x4'),'afterDestroy':_0x0229('0x5')};function emitEvent(_0x58c87c){return function(_0x4dd853,_0x4f38b6,_0x5ebcf7){UserSettingEvents['emit'](_0x58c87c+':'+_0x4dd853['id'],_0x4dd853);UserSettingEvents[_0x0229('0x6')](_0x58c87c,_0x4dd853);_0x5ebcf7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x0229('0x7')](e,emitEvent(event));}}module[_0x0229('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x5f6f=['events','UserSetting','remove','hasOwnProperty','hook','exports'];(function(_0xea3b5a,_0x16998f){var _0x257186=function(_0x19063){while(--_0x19063){_0xea3b5a['push'](_0xea3b5a['shift']());}};_0x257186(++_0x16998f);}(_0x5f6f,0xf0));var _0xf5f6=function(_0x50d6d6,_0x189c68){_0x50d6d6=_0x50d6d6-0x0;var _0x5d9bb4=_0x5f6f[_0x50d6d6];return _0x5d9bb4;};'use strict';var EventEmitter=require(_0xf5f6('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xf5f6('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf5f6('0x2')};function emitEvent(_0x2f665a){return function(_0x3571a7,_0x1ad4ca,_0x5c7043){UserSettingEvents['emit'](_0x2f665a+':'+_0x3571a7['id'],_0x3571a7);UserSettingEvents['emit'](_0x2f665a,_0x3571a7);_0x5c7043(null);};}for(var e in events){if(events[_0xf5f6('0x3')](e)){var event=events[e];UserSetting[_0xf5f6('0x4')](e,emitEvent(event));}}module[_0xf5f6('0x5')]=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 cd4b339..979bc26 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 _0x0664=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','exports','define','UserSetting'];(function(_0x46ce98,_0x52d764){var _0x172f46=function(_0x10ccee){while(--_0x10ccee){_0x46ce98['push'](_0x46ce98['shift']());}};_0x172f46(++_0x52d764);}(_0x0664,0x93));var _0x4066=function(_0x422f59,_0xb88afb){_0x422f59=_0x422f59-0x0;var _0x5a2942=_0x0664[_0x422f59];return _0x5a2942;};'use strict';var attributes=require('./user-setting.attributes');module[_0x4066('0x0')]=function(_0x4a0fa5){return _0x4a0fa5[_0x4066('0x1')](_0x4066('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42bb0c){if(!_0x42bb0c[_0x4066('0x3')])_0x42bb0c[_0x4066('0x4')]=null;else if(_0x42bb0c[_0x4066('0x4')]===null)_0x42bb0c[_0x4066('0x4')]=new Date();}}});}; \ No newline at end of file +var _0x55f1=['define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x318e0f,_0x3e953b){var _0x259c69=function(_0x2350de){while(--_0x2350de){_0x318e0f['push'](_0x318e0f['shift']());}};_0x259c69(++_0x3e953b);}(_0x55f1,0x9b));var _0x155f=function(_0xefe535,_0x39551a){_0xefe535=_0xefe535-0x0;var _0x54c45a=_0x55f1[_0xefe535];return _0x54c45a;};'use strict';var attributes=require(_0x155f('0x0'));module['exports']=function(_0x9fa58a){return _0x9fa58a[_0x155f('0x1')](_0x155f('0x2'),attributes,{'tableName':_0x155f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53478b){if(!_0x53478b[_0x155f('0x4')])_0x53478b[_0x155f('0x5')]=null;else if(_0x53478b['clientSideLoggingEnabledSince']===null)_0x53478b['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 7f11f46..6e460f6 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 _0x756d=['user-setting:update','user-setting:update:user-','UserId','register','length','./user-setting.events','save','update','emit'];(function(_0x1f9dd0,_0x4fd67e){var _0x17ed50=function(_0x525566){while(--_0x525566){_0x1f9dd0['push'](_0x1f9dd0['shift']());}};_0x17ed50(++_0x4fd67e);}(_0x756d,0x113));var _0xd756=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x756d[_0x4565bf];return _0x5610ba;};'use strict';var UserSettingEvents=require(_0xd756('0x0'));var events=[_0xd756('0x1'),'remove',_0xd756('0x2')];function createListener(_0x56423e,_0x16a2f9){return function(_0xd443a8){_0x16a2f9[_0xd756('0x3')](_0x56423e,_0xd443a8);if(_0x56423e===_0xd756('0x4')){_0x16a2f9[_0xd756('0x3')](_0xd756('0x5')+_0xd443a8[_0xd756('0x6')],_0xd443a8);}};}exports[_0xd756('0x7')]=function(_0x32741e){for(var _0x39e18d=0x0,_0x190a44=events[_0xd756('0x8')];_0x39e18d<_0x190a44;_0x39e18d++){var _0x42a33=events[_0x39e18d];var _0x2504a3=createListener('user-setting:'+_0x42a33,_0x32741e);UserSettingEvents['on'](_0x42a33,_0x2504a3);}}; \ No newline at end of file +var _0x63ad=['user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update'];(function(_0x1611b8,_0x52e90e){var _0x5e72a0=function(_0x44b86d){while(--_0x44b86d){_0x1611b8['push'](_0x1611b8['shift']());}};_0x5e72a0(++_0x52e90e);}(_0x63ad,0x102));var _0xd63a=function(_0x5227c6,_0x52a88a){_0x5227c6=_0x5227c6-0x0;var _0x5f1242=_0x63ad[_0x5227c6];return _0x5f1242;};'use strict';var UserSettingEvents=require(_0xd63a('0x0'));var events=[_0xd63a('0x1'),_0xd63a('0x2'),_0xd63a('0x3')];function createListener(_0x368470,_0x5b64ea){return function(_0x4e2828){_0x5b64ea[_0xd63a('0x4')](_0x368470,_0x4e2828);if(_0x368470===_0xd63a('0x5')){_0x5b64ea[_0xd63a('0x4')](_0xd63a('0x6')+_0x4e2828[_0xd63a('0x7')],_0x4e2828);}};}exports[_0xd63a('0x8')]=function(_0x111784){for(var _0x4da004=0x0,_0x32b118=events[_0xd63a('0x9')];_0x4da004<_0x32b118;_0x4da004++){var _0x49a149=events[_0x4da004];var _0x14f52b=createListener(_0xd63a('0xa')+_0x49a149,_0x111784);UserSettingEvents['on'](_0x49a149,_0x14f52b);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 8c0c154..b5bf893 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 _0x21c8=['addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','originalname','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions'];(function(_0x11ad99,_0x4eabe0){var _0x29d8d1=function(_0x352aeb){while(--_0x352aeb){_0x11ad99['push'](_0x11ad99['shift']());}};_0x29d8d1(++_0x4eabe0);}(_0x21c8,0x101));var _0x821c=function(_0x3603ba,_0x137527){_0x3603ba=_0x3603ba-0x0;var _0x15f202=_0x21c8[_0x3603ba];return _0x15f202;};'use strict';var multer=require(_0x821c('0x0'));var util=require(_0x821c('0x1'));var path=require(_0x821c('0x2'));var timeout=require('connect-timeout');var express=require(_0x821c('0x3'));var router=express[_0x821c('0x4')]();var fs_extra=require(_0x821c('0x5'));var auth=require(_0x821c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0x821c('0x7')](),controller[_0x821c('0x8')]);router[_0x821c('0x9')](_0x821c('0xa'),auth['isAuthenticated'](),controller[_0x821c('0xb')]);router[_0x821c('0x9')](_0x821c('0xc'),auth[_0x821c('0x7')](),controller[_0x821c('0xd')]);router[_0x821c('0x9')](_0x821c('0xe'),auth[_0x821c('0x7')](),controller[_0x821c('0xf')]);router[_0x821c('0x9')](_0x821c('0x10'),auth[_0x821c('0x7')](),controller['show']);router['get'](_0x821c('0x11'),controller[_0x821c('0x12')]);router[_0x821c('0x9')]('/:id/open_tabs',auth[_0x821c('0x7')](),controller[_0x821c('0x13')]);router[_0x821c('0x9')](_0x821c('0x14'),auth[_0x821c('0x7')](),controller['getContacts']);router[_0x821c('0x9')](_0x821c('0x15'),auth['isAuthenticated'](),controller[_0x821c('0x16')]);router['get'](_0x821c('0x17'),auth[_0x821c('0x7')](),controller['getVoiceQueuesRt']);router[_0x821c('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0x821c('0x18')]);router[_0x821c('0x9')](_0x821c('0x19'),auth[_0x821c('0x7')](),controller[_0x821c('0x1a')]);router[_0x821c('0x9')](_0x821c('0x1b'),auth[_0x821c('0x7')](),controller[_0x821c('0x1c')]);router[_0x821c('0x9')](_0x821c('0x1d'),auth[_0x821c('0x7')](),controller[_0x821c('0x1e')]);router[_0x821c('0x9')]('/:id/openchannel/interactions',auth[_0x821c('0x7')](),controller['getOpenchannelInteractions']);router[_0x821c('0x9')](_0x821c('0x1f'),auth[_0x821c('0x7')](),controller['getMailInteractions']);router[_0x821c('0x9')](_0x821c('0x20'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x821c('0x9')](_0x821c('0x21'),auth['isAuthenticated'](),controller[_0x821c('0x22')]);router[_0x821c('0x9')](_0x821c('0x23'),auth[_0x821c('0x7')](),controller[_0x821c('0x24')]);router[_0x821c('0x9')](_0x821c('0x25'),auth['isAuthenticated'](),controller[_0x821c('0x26')]);router['get'](_0x821c('0x27'),auth[_0x821c('0x7')](),controller[_0x821c('0x28')]);router[_0x821c('0x9')](_0x821c('0x29'),auth[_0x821c('0x7')](),controller[_0x821c('0x2a')]);router[_0x821c('0x9')](_0x821c('0x2b'),auth['isAuthenticated'](),controller[_0x821c('0x2c')]);router['get'](_0x821c('0x2d'),auth['isAuthenticated'](),controller[_0x821c('0x2e')]);router['get'](_0x821c('0x2f'),auth[_0x821c('0x7')](),controller[_0x821c('0x30')]);router['get'](_0x821c('0x31'),auth[_0x821c('0x7')](),controller[_0x821c('0x32')]);router[_0x821c('0x9')]('/:id/sms_accounts',auth[_0x821c('0x7')](),controller['getSmsAccounts']);router[_0x821c('0x9')](_0x821c('0x33'),auth[_0x821c('0x7')](),controller[_0x821c('0x34')]);router[_0x821c('0x9')]('/:id/whatsapp_accounts',auth[_0x821c('0x7')](),controller[_0x821c('0x35')]);router['get'](_0x821c('0x36'),auth[_0x821c('0x7')](),controller['getSquareProjects']);router[_0x821c('0x9')](_0x821c('0x37'),auth[_0x821c('0x7')](),controller['getScheduledCalls']);router[_0x821c('0x9')](_0x821c('0x38'),auth[_0x821c('0x7')](),controller[_0x821c('0x39')]);router['post']('/:id/contacts',auth[_0x821c('0x7')](),controller[_0x821c('0x3a')]);router[_0x821c('0x3b')]('/',auth[_0x821c('0x7')](),controller[_0x821c('0x3c')]);router['post'](_0x821c('0x3d'),auth[_0x821c('0x7')](),controller[_0x821c('0x3e')]);router[_0x821c('0x3b')](_0x821c('0x15'),auth[_0x821c('0x7')](),controller[_0x821c('0x3f')]);var upload=multer({'storage':multer[_0x821c('0x40')]({'destination':function(_0x3ed8e2,_0x4868ba,_0x226c87){_0x226c87(null,path[_0x821c('0x41')](config[_0x821c('0x42')],_0x821c('0x43')));},'filename':function(_0x61a850,_0x22bf24,_0x3b4748){_0x3b4748(null,util[_0x821c('0x44')]('%s-%s',Date['now'](),_0x22bf24[_0x821c('0x45')]));}})});router[_0x821c('0x3b')](_0x821c('0x11'),upload['single']('file'),controller[_0x821c('0x46')]);router[_0x821c('0x3b')](_0x821c('0x47'),auth[_0x821c('0x7')](),controller[_0x821c('0x48')]);router[_0x821c('0x3b')](_0x821c('0x49'),auth[_0x821c('0x7')](),controller[_0x821c('0x4a')]);router[_0x821c('0x3b')](_0x821c('0x4b'),auth['isAuthenticated'](),controller[_0x821c('0x4c')]);router[_0x821c('0x3b')]('/:id/unpause',auth[_0x821c('0x7')](),controller[_0x821c('0x4d')]);router[_0x821c('0x3b')](_0x821c('0x25'),auth['isAuthenticated'](),controller['addTeams']);router[_0x821c('0x3b')](_0x821c('0x4e'),auth['isAuthenticated'](),controller[_0x821c('0x4f')]);router['post'](_0x821c('0x50'),auth[_0x821c('0x7')](),controller[_0x821c('0x51')]);router[_0x821c('0x3b')](_0x821c('0x52'),auth[_0x821c('0x7')](),controller[_0x821c('0x53')]);router[_0x821c('0x3b')]('/:id/sms_interactions',auth[_0x821c('0x7')](),controller[_0x821c('0x54')]);router['post'](_0x821c('0x55'),auth[_0x821c('0x7')](),controller[_0x821c('0x56')]);router[_0x821c('0x3b')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x821c('0x57')]);router[_0x821c('0x3b')](_0x821c('0x2d'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x821c('0x3b')](_0x821c('0x2f'),auth[_0x821c('0x7')](),controller['addMailAccounts']);router['post'](_0x821c('0x31'),auth[_0x821c('0x7')](),controller[_0x821c('0x58')]);router['post'](_0x821c('0x59'),auth[_0x821c('0x7')](),controller[_0x821c('0x5a')]);router[_0x821c('0x3b')](_0x821c('0x33'),auth[_0x821c('0x7')](),controller[_0x821c('0x5b')]);router[_0x821c('0x3b')](_0x821c('0x5c'),auth[_0x821c('0x7')](),controller[_0x821c('0x5d')]);router[_0x821c('0x3b')](_0x821c('0x36'),auth[_0x821c('0x7')](),controller[_0x821c('0x5e')]);router[_0x821c('0x3b')](_0x821c('0x38'),auth[_0x821c('0x7')](),controller[_0x821c('0x5f')]);router[_0x821c('0x60')](_0x821c('0x10'),auth[_0x821c('0x7')](),controller[_0x821c('0x61')]);router['put'](_0x821c('0x62'),auth[_0x821c('0x7')](),controller[_0x821c('0x63')]);router[_0x821c('0x64')](_0x821c('0x15'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x821c('0x64')](_0x821c('0x25'),auth[_0x821c('0x7')](),controller[_0x821c('0x65')]);router['delete'](_0x821c('0x10'),auth[_0x821c('0x7')](),controller['destroy']);router[_0x821c('0x64')](_0x821c('0x4e'),auth[_0x821c('0x7')](),controller[_0x821c('0x66')]);router[_0x821c('0x64')](_0x821c('0x50'),auth[_0x821c('0x7')](),controller[_0x821c('0x67')]);router['delete'](_0x821c('0x52'),auth[_0x821c('0x7')](),controller['removeFaxInteractions']);router[_0x821c('0x64')]('/:id/sms_interactions',auth[_0x821c('0x7')](),controller[_0x821c('0x68')]);router[_0x821c('0x64')](_0x821c('0x55'),auth[_0x821c('0x7')](),controller[_0x821c('0x69')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x821c('0x6a')]);router[_0x821c('0x64')](_0x821c('0x2d'),auth[_0x821c('0x7')](),controller[_0x821c('0x6b')]);router[_0x821c('0x64')]('/:id/mail_accounts',auth[_0x821c('0x7')](),controller[_0x821c('0x6c')]);router[_0x821c('0x64')](_0x821c('0x31'),auth[_0x821c('0x7')](),controller[_0x821c('0x6d')]);router[_0x821c('0x64')](_0x821c('0x59'),auth[_0x821c('0x7')](),controller[_0x821c('0x6e')]);router[_0x821c('0x64')](_0x821c('0x33'),auth[_0x821c('0x7')](),controller[_0x821c('0x6f')]);router[_0x821c('0x64')](_0x821c('0x5c'),auth[_0x821c('0x7')](),controller[_0x821c('0x70')]);router['delete']('/:id/square_projects',auth[_0x821c('0x7')](),controller[_0x821c('0x71')]);router[_0x821c('0x64')](_0x821c('0x38'),auth[_0x821c('0x7')](),controller[_0x821c('0x72')]);module['exports']=router; \ No newline at end of file +var _0x0500=['getFaxInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','login','/:id/logout','/:id/pause','pause','/:id/unpause','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','/:id/fax_accounts','addOpenchannelAccounts','/:id/chat_websites','addWhatsappAccounts','addSquareProjects','/:id/api_key','update','changePassword','removeQueues','delete','removeTeams','destroy','/:id/chat_interactions','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getGroups','/:id/recordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions'];(function(_0x5bef9e,_0x22b1a2){var _0x527faf=function(_0x779997){while(--_0x779997){_0x5bef9e['push'](_0x5bef9e['shift']());}};_0x527faf(++_0x22b1a2);}(_0x0500,0x110));var _0x0050=function(_0x4c6ff1,_0x39ada3){_0x4c6ff1=_0x4c6ff1-0x0;var _0x4f1df0=_0x0500[_0x4c6ff1];return _0x4f1df0;};'use strict';var multer=require(_0x0050('0x0'));var util=require(_0x0050('0x1'));var path=require(_0x0050('0x2'));var timeout=require(_0x0050('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0050('0x4'));var auth=require(_0x0050('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0050('0x6'));var controller=require(_0x0050('0x7'));router[_0x0050('0x8')]('/',auth[_0x0050('0x9')](),controller['index']);router[_0x0050('0x8')](_0x0050('0xa'),auth[_0x0050('0x9')](),controller[_0x0050('0xb')]);router['get'](_0x0050('0xc'),auth[_0x0050('0x9')](),controller[_0x0050('0xd')]);router['get'](_0x0050('0xe'),auth[_0x0050('0x9')](),controller[_0x0050('0xf')]);router['get'](_0x0050('0x10'),auth[_0x0050('0x9')](),controller['show']);router[_0x0050('0x8')](_0x0050('0x11'),controller['getAvatar']);router[_0x0050('0x8')]('/:id/open_tabs',auth[_0x0050('0x9')](),controller[_0x0050('0x12')]);router['get'](_0x0050('0x13'),auth[_0x0050('0x9')](),controller[_0x0050('0x14')]);router[_0x0050('0x8')](_0x0050('0x15'),auth['isAuthenticated'](),controller[_0x0050('0x16')]);router[_0x0050('0x8')](_0x0050('0x17'),auth[_0x0050('0x9')](),controller['getVoiceQueuesRt']);router[_0x0050('0x8')]('/:id/groups',auth[_0x0050('0x9')](),controller[_0x0050('0x18')]);router[_0x0050('0x8')](_0x0050('0x19'),auth[_0x0050('0x9')](),controller['getRecordings']);router['get']('/:id/screen_recordings',auth[_0x0050('0x9')](),controller['getScreenRecordings']);router[_0x0050('0x8')](_0x0050('0x1a'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x0050('0x8')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x0050('0x1b')]);router[_0x0050('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x0050('0x8')](_0x0050('0x1c'),auth[_0x0050('0x9')](),controller[_0x0050('0x1d')]);router[_0x0050('0x8')](_0x0050('0x1e'),auth[_0x0050('0x9')](),controller[_0x0050('0x1f')]);router[_0x0050('0x8')]('/:id/whatsapp/interactions',auth[_0x0050('0x9')](),controller['getWhatsappInteractions']);router[_0x0050('0x8')](_0x0050('0x20'),auth[_0x0050('0x9')](),controller['getTeams']);router[_0x0050('0x8')](_0x0050('0x21'),auth[_0x0050('0x9')](),controller['getLists']);router[_0x0050('0x8')](_0x0050('0x22'),auth[_0x0050('0x9')](),controller[_0x0050('0x23')]);router[_0x0050('0x8')](_0x0050('0x24'),auth[_0x0050('0x9')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x0050('0x25')]);router['get'](_0x0050('0x26'),auth[_0x0050('0x9')](),controller[_0x0050('0x27')]);router[_0x0050('0x8')](_0x0050('0x28'),auth['isAuthenticated'](),controller[_0x0050('0x29')]);router['get'](_0x0050('0x2a'),auth[_0x0050('0x9')](),controller[_0x0050('0x2b')]);router[_0x0050('0x8')]('/:id/chat_websites',auth[_0x0050('0x9')](),controller[_0x0050('0x2c')]);router['get'](_0x0050('0x2d'),auth[_0x0050('0x9')](),controller['getWhatsappAccounts']);router[_0x0050('0x8')](_0x0050('0x2e'),auth[_0x0050('0x9')](),controller[_0x0050('0x2f')]);router[_0x0050('0x8')](_0x0050('0x30'),auth[_0x0050('0x9')](),controller['getScheduledCalls']);router[_0x0050('0x8')]('/:id/api_key',auth[_0x0050('0x9')](),controller[_0x0050('0x31')]);router[_0x0050('0x32')]('/:id/contacts',auth[_0x0050('0x9')](),controller[_0x0050('0x33')]);router[_0x0050('0x32')]('/',auth['isAuthenticated'](),controller[_0x0050('0x34')]);router[_0x0050('0x32')]('/create_many',auth['isAuthenticated'](),controller[_0x0050('0x35')]);router['post'](_0x0050('0x15'),auth[_0x0050('0x9')](),controller[_0x0050('0x36')]);var upload=multer({'storage':multer[_0x0050('0x37')]({'destination':function(_0x44e6b7,_0x36c0bb,_0x3b7cae){_0x3b7cae(null,path[_0x0050('0x38')](config[_0x0050('0x39')],_0x0050('0x3a')));},'filename':function(_0x3be973,_0x2624de,_0x168636){_0x168636(null,util[_0x0050('0x3b')](_0x0050('0x3c'),Date[_0x0050('0x3d')](),_0x2624de[_0x0050('0x3e')]));}})});router[_0x0050('0x32')](_0x0050('0x11'),upload[_0x0050('0x3f')](_0x0050('0x40')),controller[_0x0050('0x41')]);router[_0x0050('0x32')]('/:id/login',auth[_0x0050('0x9')](),controller[_0x0050('0x42')]);router[_0x0050('0x32')](_0x0050('0x43'),auth[_0x0050('0x9')](),controller['logout']);router[_0x0050('0x32')](_0x0050('0x44'),auth[_0x0050('0x9')](),controller[_0x0050('0x45')]);router[_0x0050('0x32')](_0x0050('0x46'),auth['isAuthenticated'](),controller['unpause']);router[_0x0050('0x32')](_0x0050('0x20'),auth[_0x0050('0x9')](),controller['addTeams']);router[_0x0050('0x32')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x0050('0x47')]);router[_0x0050('0x32')](_0x0050('0x48'),auth[_0x0050('0x9')](),controller[_0x0050('0x49')]);router[_0x0050('0x32')](_0x0050('0x4a'),auth[_0x0050('0x9')](),controller['addFaxInteractions']);router[_0x0050('0x32')]('/:id/sms_interactions',auth[_0x0050('0x9')](),controller['addSmsInteractions']);router[_0x0050('0x32')](_0x0050('0x4b'),auth[_0x0050('0x9')](),controller['addOpenchannelInteractions']);router[_0x0050('0x32')](_0x0050('0x4c'),auth[_0x0050('0x9')](),controller['addWhatsappInteractions']);router[_0x0050('0x32')](_0x0050('0x4d'),auth[_0x0050('0x9')](),controller['addFaxAccounts']);router[_0x0050('0x32')](_0x0050('0x26'),auth[_0x0050('0x9')](),controller['addMailAccounts']);router[_0x0050('0x32')]('/:id/openchannel_accounts',auth[_0x0050('0x9')](),controller[_0x0050('0x4e')]);router['post'](_0x0050('0x2a'),auth[_0x0050('0x9')](),controller['addSmsAccounts']);router[_0x0050('0x32')](_0x0050('0x4f'),auth[_0x0050('0x9')](),controller['addChatWebsites']);router[_0x0050('0x32')](_0x0050('0x2d'),auth[_0x0050('0x9')](),controller[_0x0050('0x50')]);router['post'](_0x0050('0x2e'),auth[_0x0050('0x9')](),controller[_0x0050('0x51')]);router[_0x0050('0x32')](_0x0050('0x52'),auth[_0x0050('0x9')](),controller['createApiKey']);router['put'](_0x0050('0x10'),auth['isAuthenticated'](),controller[_0x0050('0x53')]);router['put']('/:id/password',auth[_0x0050('0x9')](),controller[_0x0050('0x54')]);router['delete'](_0x0050('0x15'),auth[_0x0050('0x9')](),controller[_0x0050('0x55')]);router[_0x0050('0x56')](_0x0050('0x20'),auth[_0x0050('0x9')](),controller[_0x0050('0x57')]);router[_0x0050('0x56')](_0x0050('0x10'),auth[_0x0050('0x9')](),controller[_0x0050('0x58')]);router[_0x0050('0x56')](_0x0050('0x59'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0x0050('0x56')](_0x0050('0x48'),auth['isAuthenticated'](),controller[_0x0050('0x5a')]);router['delete'](_0x0050('0x4a'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0x0050('0x56')](_0x0050('0x5b'),auth['isAuthenticated'](),controller[_0x0050('0x5c')]);router[_0x0050('0x56')](_0x0050('0x4b'),auth['isAuthenticated'](),controller[_0x0050('0x5d')]);router[_0x0050('0x56')]('/:id/whatsapp_interactions',auth[_0x0050('0x9')](),controller[_0x0050('0x5e')]);router[_0x0050('0x56')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x0050('0x56')](_0x0050('0x26'),auth[_0x0050('0x9')](),controller['removeMailAccounts']);router[_0x0050('0x56')](_0x0050('0x28'),auth[_0x0050('0x9')](),controller[_0x0050('0x5f')]);router[_0x0050('0x56')](_0x0050('0x2a'),auth[_0x0050('0x9')](),controller[_0x0050('0x60')]);router[_0x0050('0x56')](_0x0050('0x4f'),auth['isAuthenticated'](),controller[_0x0050('0x61')]);router[_0x0050('0x56')](_0x0050('0x2d'),auth[_0x0050('0x9')](),controller[_0x0050('0x62')]);router[_0x0050('0x56')](_0x0050('0x2e'),auth[_0x0050('0x9')](),controller[_0x0050('0x63')]);router[_0x0050('0x56')](_0x0050('0x52'),auth[_0x0050('0x9')](),controller[_0x0050('0x64')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 90980e5..768b170 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x24bcb3,_0x255c07){var _0x405a3f=function(_0x95b156){while(--_0x95b156){_0x24bcb3['push'](_0x24bcb3['shift']());}};_0x405a3f(++_0x255c07);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xcb91[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index ecd22f9..5b6ca60 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 _0x8c99=['getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','sort','pick','hasOwnProperty','CmList','Tag','color','tag','nolimit','getQueues','order','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','pause','QueuePause','updateAttributes','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','chatPause','faxPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','Body\x20parameter\x20\x27ids\x27\x20is\x20required','addTeams','getAssociatedQueues','flattenDeep','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','Queue:save','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getDataValue','VoicePrefixId','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','$gt','$gte','$lt','$lte','$not','$notBetween','$notIn','$iLike','$notILike','$like','$overlap','$contained','$any','firstName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','isEmpty','queues','flatten','lower','col','toString','asc','substring','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','ringing','voiceStatus','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','client','http','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','emit','userNotification:recalc:','destroy','get','role','user','Agents','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','end','stack','index','rawAttributes','fieldName','type','key','includes','salt','getOptions','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','User','rows','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','password','keys','filters','intersection','model','fields','merge','options','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','fullname','email','permissions','101','102','103','113','104','105','106','107','108','109','100','114','create','agent','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','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','findAll','autoAssociation','compact','oldPassword','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queues','spread','QueueId','voice','VoiceQueue','format','SIP/%s','UserVoiceQueueRt','removeQueues','remove','Queue:remove','addAvatar','userpic','filename','getAvatar','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/'];(function(_0x15fea4,_0x33be33){var _0x3586e6=function(_0x455813){while(--_0x455813){_0x15fea4['push'](_0x15fea4['shift']());}};_0x3586e6(++_0x33be33);}(_0x8c99,0xd3));var _0x98c9=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x8c99[_0x35ef6b];return _0x3ad145;};'use strict';var moment=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var path=require(_0x98c9('0x2'));var fs=require('fs');var _=require(_0x98c9('0x3'));var squel=require('squel');var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require(_0x98c9('0x4'));var qs=require(_0x98c9('0x5'));var logger=require('../../config/logger')(_0x98c9('0x6'));var utils=require(_0x98c9('0x7'));var config=require(_0x98c9('0x8'));var licenseUtil=require(_0x98c9('0x9'));var APIBadRequestError=require(_0x98c9('0xa'))[_0x98c9('0xb')];var APINotFoundError=require(_0x98c9('0xa'))[_0x98c9('0xc')];var APIHandleError=require(_0x98c9('0xa'))['handleError'];var db=require(_0x98c9('0xd'))['db'];var socket=require(_0x98c9('0xe'))(new Redis(config[_0x98c9('0xf')]));require(_0x98c9('0x10'))[_0x98c9('0x11')](socket);config['redis']=_['defaults'](config[_0x98c9('0xf')],{'host':_0x98c9('0x12'),'port':0x18eb});var amiClient=jayson[_0x98c9('0x13')][_0x98c9('0x14')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3f2c0e,_0x57871f,_0x105df1,_0x1504ca){return new Promise(function(_0x5cf13a,_0x185e08){var _0x18bb2b=_0x1504ca||amiClient;return _0x18bb2b['request'](_0x3f2c0e,_0x105df1)[_0x98c9('0x15')](function(_0x3b6ad9){logger[_0x98c9('0x16')](_0x98c9('0x17'),_0x57871f,_0x98c9('0x18'));logger[_0x98c9('0x19')](_0x98c9('0x1a'),_0x57871f,_0x98c9('0x18'),JSON[_0x98c9('0x1b')](_0x3b6ad9));if(_0x3b6ad9['error']){if(_0x3b6ad9['error']['code']===0x1f4){logger[_0x98c9('0x1c')]('User,\x20%s,\x20%s',_0x57871f,_0x3b6ad9[_0x98c9('0x1c')][_0x98c9('0x1d')]);return _0x185e08(_0x3b6ad9[_0x98c9('0x1c')][_0x98c9('0x1d')]);}logger['error'](_0x98c9('0x17'),_0x57871f,_0x3b6ad9[_0x98c9('0x1c')][_0x98c9('0x1d')]);return _0x5cf13a(_0x3b6ad9[_0x98c9('0x1c')][_0x98c9('0x1d')]);}else{logger['info'](_0x98c9('0x17'),_0x57871f,_0x98c9('0x18'));_0x5cf13a(_0x3b6ad9[_0x98c9('0x1e')][_0x98c9('0x1d')]);}})[_0x98c9('0x1f')](function(_0x5af554){logger['error'](_0x98c9('0x17'),_0x57871f,_0x5af554);_0x185e08(_0x5af554);});});}function respondWithStatusCode(_0x36c761,_0x304792){_0x304792=_0x304792||0xcc;return function(_0x45d143){if(_0x45d143){return _0x36c761[_0x98c9('0x20')](_0x304792);}return _0x36c761[_0x98c9('0x21')](_0x304792)['end']();};}function respondWithResult(_0x11c038,_0x4bbd14){_0x4bbd14=_0x4bbd14||0xc8;return function(_0x352842){if(_0x352842){return _0x11c038[_0x98c9('0x21')](_0x4bbd14)[_0x98c9('0x22')](_0x352842);}};}function respondWithFilteredResult(_0x19ac5f,_0x18c9d4){return function(_0x349f6a){if(_0x349f6a){var _0x562689=typeof _0x18c9d4[_0x98c9('0x23')]===_0x98c9('0x24')&&typeof _0x18c9d4['limit']===_0x98c9('0x24');var _0x18cd6a=_0x349f6a[_0x98c9('0x25')];var _0x54f1d5=_0x562689?0x0:_0x18c9d4[_0x98c9('0x23')];var _0x846773=_0x562689?_0x349f6a['count']:_0x18c9d4[_0x98c9('0x23')]+_0x18c9d4[_0x98c9('0x26')];var _0x3d6d60;if(_0x846773>=_0x18cd6a){_0x846773=_0x18cd6a;_0x3d6d60=0xc8;}else{_0x3d6d60=0xce;}_0x19ac5f[_0x98c9('0x21')](_0x3d6d60);return _0x19ac5f[_0x98c9('0x27')](_0x98c9('0x28'),_0x54f1d5+'-'+_0x846773+'/'+_0x18cd6a)[_0x98c9('0x22')](_0x349f6a);}return null;};}function saveUpdates(_0x29fad7){return function(_0x5944f9){if(_0x5944f9){return _0x5944f9[_0x98c9('0x29')](_0x29fad7)['then'](function(_0x41413a){socket[_0x98c9('0x2a')](_0x98c9('0x2b')+_0x41413a['id'],{});return _0x41413a;});}return null;};}function removeEntity(_0x2dd089){return function(_0x1a85b8){if(_0x1a85b8){return _0x1a85b8[_0x98c9('0x2c')]()['then'](function(){var _0x5a5e63=_0x1a85b8[_0x98c9('0x2d')]({'plain':!![]});if(_0x5a5e63[_0x98c9('0x2e')]==='admin')return;var _0x2a39f2=[{'name':'Users','value':_0x98c9('0x2f'),'ignore':!![]},{'name':_0x98c9('0x30'),'value':'agent','ignore':![]},{'name':_0x98c9('0x31'),'value':_0x98c9('0x32'),'ignore':![]}];var _0x4eec09=_(_0x2a39f2)[_0x98c9('0x33')](_0x98c9('0x34'))[_0x98c9('0x35')](_0x98c9('0x36'))['value']();if(_['includes'](_0x4eec09,_0x5a5e63['role'])){return;}var _0xde19e2=_[_0x98c9('0x37')](_0x2a39f2,[_0x98c9('0x36'),_0x5a5e63['role']])[_0x98c9('0x38')];return db[_0x98c9('0x39')]['destroy']({'where':{'type':_0xde19e2,'resourceId':_0x5a5e63['id']}})[_0x98c9('0x15')](function(){return _0x1a85b8;});})[_0x98c9('0x15')](function(){_0x2dd089[_0x98c9('0x21')](0xcc)[_0x98c9('0x3a')]();});}};}function handleEntityNotFound(_0x5b32a5){return function(_0x59de98){if(!_0x59de98){_0x5b32a5['sendStatus'](0x194);}return _0x59de98;};}function handleError(_0x105d13,_0x1bcd86){_0x1bcd86=_0x1bcd86||0x1f4;return function(_0xffebd1){logger['error'](_0xffebd1[_0x98c9('0x3b')]);if(_0xffebd1[_0x98c9('0x38')]){delete _0xffebd1[_0x98c9('0x38')];}_0x105d13[_0x98c9('0x21')](_0x1bcd86)['send'](_0xffebd1);};}exports[_0x98c9('0x3c')]=function(_0xf09186,_0x1146af){var _0x47a36b={},_0x3f7707={'count':0x0,'rows':[]};var _0xba3749=_(db['User'][_0x98c9('0x3d')])[_0x98c9('0x35')](function(_0x3f0906){return{'name':_0x3f0906[_0x98c9('0x3e')],'type':_0x3f0906[_0x98c9('0x3f')][_0x98c9('0x40')]};})[_0x98c9('0x33')](function(_0x32e50f){return!_[_0x98c9('0x41')](['password',_0x98c9('0x42')],_0x32e50f[_0x98c9('0x38')]);})[_0x98c9('0x36')]();_0x47a36b=qs[_0x98c9('0x43')](_0xba3749,_0xf09186);var _0x5ce9f9={'where':_0x47a36b[_0x98c9('0x44')]};return db['User'][_0x98c9('0x25')](_0x5ce9f9)['then'](function(_0xd8ad83){_0x3f7707[_0x98c9('0x25')]=_0xd8ad83;if(_0xf09186['query'][_0x98c9('0x45')]){_0x47a36b[_0x98c9('0x46')]=[{'all':!![]}];}if(_0xf09186[_0x98c9('0x47')][_0x98c9('0x48')]===_0x98c9('0x49')){_0x47a36b[_0x98c9('0x46')]=[{'model':db[_0x98c9('0x4a')],'as':_0x98c9('0x48')}];}if(!_[_0x98c9('0x41')](_0x47a36b[_0x98c9('0x4b')],'id')){_0x47a36b['attributes'][_0x98c9('0x4c')]('id');}return db[_0x98c9('0x4d')]['findAll'](_0x47a36b);})[_0x98c9('0x15')](function(_0xb1e3cf){_0x3f7707['rows']=_0xb1e3cf;if(_0xf09186[_0x98c9('0x47')]['openTabs']===_0x98c9('0x49')){var _0x33d919=[];for(var _0x3eac80=0x0;_0x3eac80<_0x3f7707[_0x98c9('0x4e')][_0x98c9('0x4f')];_0x3eac80++){_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x50'),_0x3f7707[_0x98c9('0x4e')][_0x3eac80][_0x98c9('0x51')]));_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x52'),_0x3f7707[_0x98c9('0x4e')][_0x3eac80]['dataValues']));_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x53'),_0x3f7707['rows'][_0x3eac80][_0x98c9('0x51')]));_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x54'),_0x3f7707[_0x98c9('0x4e')][_0x3eac80][_0x98c9('0x51')]));_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x55'),_0x3f7707[_0x98c9('0x4e')][_0x3eac80][_0x98c9('0x51')]));_0x33d919[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x56'),_0x3f7707['rows'][_0x3eac80]['dataValues']));}return Promise[_0x98c9('0x57')](_0x33d919)[_0x98c9('0x15')](function(){return _0x3f7707;});}else{return _0x3f7707;}})['then'](respondWithFilteredResult(_0x1146af,_0x47a36b))[_0x98c9('0x1f')](handleError(_0x1146af,null));};exports[_0x98c9('0x58')]=function(_0x2d254f,_0x4ed4f5){var _0x159d63={'raw':![],'where':{'id':_0x2d254f[_0x98c9('0x59')]['id']}},_0x5b6620={};_0x5b6620['model']=_['differenceBy'](_['keys'](db[_0x98c9('0x4d')][_0x98c9('0x3d')]),[_0x98c9('0x5a'),_0x98c9('0x42')]);_0x5b6620['query']=_[_0x98c9('0x5b')](_0x2d254f['query']);_0x5b6620[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x5b6620[_0x98c9('0x5e')],_0x5b6620[_0x98c9('0x47')]);_0x159d63[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x5b6620[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x2d254f[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x159d63[_0x98c9('0x4b')]=_0x159d63['attributes'][_0x98c9('0x4f')]?_0x159d63['attributes']:_0x5b6620[_0x98c9('0x5e')];if(_0x2d254f[_0x98c9('0x47')][_0x98c9('0x45')]){_0x159d63[_0x98c9('0x46')]=[{'all':!![]}];}if(_0x2d254f['query']['userSetting']===_0x98c9('0x49')){_0x159d63[_0x98c9('0x46')]=[{'model':db[_0x98c9('0x4a')],'as':'userSetting'}];}_0x159d63=_[_0x98c9('0x60')]({},_0x159d63,_0x2d254f[_0x98c9('0x61')]);if(!_['includes'](_0x159d63[_0x98c9('0x4b')],'id')){_0x159d63['attributes'][_0x98c9('0x4c')]('id');}return db[_0x98c9('0x4d')][_0x98c9('0x37')](_0x159d63)[_0x98c9('0x15')](handleEntityNotFound(_0x4ed4f5,null))['then'](function(_0x3207f4){var _0xfc2798=[];values=_0x3207f4;if(_0x2d254f['query']['openTabs']===_0x98c9('0x49')){_0xfc2798[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x50'),_0x3207f4[_0x98c9('0x51')]));_0xfc2798[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x52'),_0x3207f4[_0x98c9('0x51')]));_0xfc2798[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x55'),_0x3207f4[_0x98c9('0x51')]));_0xfc2798['push'](get_open_tabs(_0x98c9('0x56'),_0x3207f4['dataValues']));_0xfc2798[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x53'),_0x3207f4[_0x98c9('0x51')]));_0xfc2798[_0x98c9('0x4c')](get_open_tabs('mail',_0x3207f4[_0x98c9('0x51')]));return Promise[_0x98c9('0x57')](_0xfc2798);}else{return values;}})[_0x98c9('0x15')](function(){return values;})[_0x98c9('0x15')](respondWithResult(_0x4ed4f5,null))[_0x98c9('0x1f')](handleError(_0x4ed4f5,null));};exports[_0x98c9('0x29')]=function(_0x52af98,_0x9b0104){if(_0x52af98[_0x98c9('0x62')]['id']){delete _0x52af98[_0x98c9('0x62')]['id'];}delete _0x52af98[_0x98c9('0x62')]['role'];return db['User'][_0x98c9('0x37')]({'where':{'id':_0x52af98['params']['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x9b0104,null))[_0x98c9('0x15')](saveUpdates(_0x52af98[_0x98c9('0x62')],null))['then'](respondWithResult(_0x9b0104,null))['catch'](handleError(_0x9b0104,null));};exports[_0x98c9('0x63')]=function(_0x400913,_0x1a49a8){return db[_0x98c9('0x4d')][_0x98c9('0x63')]()[_0x98c9('0x15')](respondWithResult(_0x1a49a8,null))[_0x98c9('0x1f')](handleError(_0x1a49a8,null));};exports[_0x98c9('0x64')]=function(_0x4c0a16,_0x34f570){return db['User'][_0x98c9('0x37')]({'where':{'id':_0x4c0a16[_0x98c9('0x59')]['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x34f570,null))['then'](function(_0x48f323){if(_0x48f323){return _0x48f323['addContacts'](_0x4c0a16['body'][_0x98c9('0x65')],_[_0x98c9('0x66')](_0x4c0a16[_0x98c9('0x62')],[_0x98c9('0x65'),'id'])||{});}})[_0x98c9('0x15')](respondWithResult(_0x34f570,null))[_0x98c9('0x1f')](handleError(_0x34f570,null));};function validateUser(_0x13b8c8){return new Promise(function(_0x5022e8,_0x17fd1e){if(_0x13b8c8[_0x98c9('0x67')])return _0x5022e8(_0x13b8c8);return db[_0x98c9('0x68')][_0x98c9('0x69')](0x1)[_0x98c9('0x15')](function(_0x5d1018){if(_0x5d1018[_0x98c9('0x6a')])authService[_0x98c9('0x6b')](_0x13b8c8['password']);db[_0x98c9('0x4d')]['max'](_0x98c9('0x67'))['then'](function(_0x2b8522){if(_[_0x98c9('0x6c')](_0x2b8522)){_0x13b8c8[_0x98c9('0x67')]=_0x5d1018[_0x98c9('0x6d')]||0x1;return;}if(_[_0x98c9('0x6c')](_0x5d1018[_0x98c9('0x6d')])||_0x5d1018[_0x98c9('0x6d')]===_0x2b8522){_0x13b8c8[_0x98c9('0x67')]=_0x2b8522+0x1;return;}if(_0x5d1018[_0x98c9('0x6d')]>_0x2b8522){_0x13b8c8[_0x98c9('0x67')]=_0x5d1018[_0x98c9('0x6d')];return;}return db[_0x98c9('0x6e')]['query'](_0x98c9('0x6f'),{'type':db[_0x98c9('0x6e')][_0x98c9('0x70')][_0x98c9('0x71')]})['then'](function(_0x39a3be){if(_0x39a3be&&_0x39a3be[_0x98c9('0x4f')]){for(var _0x2af4ce=0x0,_0x4a91f6=_0x39a3be['length'];_0x2af4ce<_0x4a91f6&&_[_0x98c9('0x6c')](_0x13b8c8[_0x98c9('0x67')]);_0x2af4ce++){if(_0x5d1018[_0x98c9('0x6d')]<=_0x39a3be[_0x2af4ce][_0x98c9('0x72')]){_0x13b8c8[_0x98c9('0x67')]=_0x39a3be[_0x2af4ce][_0x98c9('0x72')];}else if(_0x5d1018['min_internal']>_0x39a3be[_0x2af4ce][_0x98c9('0x72')]&&_0x5d1018[_0x98c9('0x6d')]<=_0x39a3be[_0x2af4ce]['to']){_0x13b8c8[_0x98c9('0x67')]=_0x5d1018[_0x98c9('0x6d')];}}}if(_[_0x98c9('0x6c')](_0x13b8c8[_0x98c9('0x67')])){_0x13b8c8[_0x98c9('0x67')]=_0x2b8522+0x1;}return _0x5022e8(_0x13b8c8);});});})[_0x98c9('0x1f')](function(_0x1a1f5b){_0x17fd1e(_0x1a1f5b);});});}function updateUser(_0x51deb9){return new Promise(function(_0x2db05a,_0x41328a){try{if(_0x51deb9[_0x98c9('0x73')]){_0x51deb9[_0x98c9('0x74')]=_0x51deb9['internal'];_0x51deb9['VoiceMail']={'mailbox':_0x51deb9[_0x98c9('0x67')],'password':_0x51deb9[_0x98c9('0x5a')],'fullname':_0x51deb9[_0x98c9('0x75')],'email':_0x51deb9[_0x98c9('0x76')]};}if(_0x51deb9['role']==='agent'){if(!_0x51deb9[_0x98c9('0x77')])_0x51deb9['permissions']=[_0x98c9('0x78'),_0x98c9('0x79'),_0x98c9('0x7a'),_0x98c9('0x7b'),'110',_0x98c9('0x7c'),_0x98c9('0x7d'),_0x98c9('0x7e'),_0x98c9('0x7f'),_0x98c9('0x80'),_0x98c9('0x81'),_0x98c9('0x82'),'111',_0x98c9('0x83'),'115'];}_0x2db05a(_0x51deb9);}catch(_0x40fb98){_0x41328a(_0x40fb98);}});}exports[_0x98c9('0x84')]=function(_0x3e8a8c,_0x3980a3){if(_0x3e8a8c[_0x98c9('0x2f')][_0x98c9('0x2e')]===_0x98c9('0x85'))throw new Error('Unauthorized');if(_0x3e8a8c['body'][_0x98c9('0x2e')]===_0x98c9('0x2f')&&_0x3e8a8c[_0x98c9('0x2f')][_0x98c9('0x2e')]!==_0x98c9('0x86')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x3e8a8c[_0x98c9('0x62')][_0x98c9('0x2e')]===_0x98c9('0x86')&&_0x3e8a8c['user'][_0x98c9('0x2e')]!==_0x98c9('0x86')){throw new Error(_0x98c9('0x87'));}return licenseUtil[_0x98c9('0x88')]([_0x3e8a8c['body']])[_0x98c9('0x15')](function(){return validateUser(_0x3e8a8c['body']);})[_0x98c9('0x15')](function(_0x32e7b4){return updateUser(_0x32e7b4)[_0x98c9('0x15')](function(_0x4b094f){if(_0x4b094f[_0x98c9('0x2e')]==='admin'){_0x4b094f['settingsEnabled']=_0x3e8a8c['user'][_0x98c9('0x89')];delete _0x4b094f[_0x98c9('0x8a')];}return _0x4b094f;});})[_0x98c9('0x15')](function(_0x169c05){return db[_0x98c9('0x4d')][_0x98c9('0x84')](_0x169c05,{'include':[{'model':db[_0x98c9('0x8b')],'as':'VoiceMail'}]});})[_0x98c9('0x15')](function(_0x377671){if(_0x3e8a8c['body'][_0x98c9('0x2e')]==='user')return _0x377671;if(_0x3e8a8c[_0x98c9('0x2f')][_0x98c9('0x2e')]!==_0x98c9('0x2f'))return _0x377671;return db[_0x98c9('0x8c')][_0x98c9('0x37')]({'where':{'name':_0x377671[_0x98c9('0x2e')]===_0x98c9('0x85')?'Agents':_0x98c9('0x31'),'userProfileId':_0x3e8a8c[_0x98c9('0x2f')][_0x98c9('0x8a')]},'raw':!![]})['then'](function(_0x5f0d06){if(!_0x5f0d06||_0x5f0d06['autoAssociation']!=0x0)return _0x377671;return db[_0x98c9('0x39')][_0x98c9('0x84')]({'name':_0x377671[_0x98c9('0x38')],'resourceId':_0x377671['id'],'type':_0x5f0d06[_0x98c9('0x38')],'sectionId':_0x5f0d06['id']},{})[_0x98c9('0x15')](function(){return _0x377671;});})[_0x98c9('0x1f')](function(_0x2c450f){logger[_0x98c9('0x1c')](_0x98c9('0x8d'),_0x2c450f);throw _0x2c450f;});})[_0x98c9('0x15')](respondWithResult(_0x3980a3,0xc9))[_0x98c9('0x1f')](handleError(_0x3980a3,null));};exports[_0x98c9('0x8e')]=function(_0x19e2c6,_0x5897c9){var _0x25623d=_0x19e2c6[_0x98c9('0x62')];var _0x47b4f1=[];if(_0x19e2c6[_0x98c9('0x2f')][_0x98c9('0x2e')]===_0x98c9('0x85'))throw new Error(_0x98c9('0x8f'));if(_[_0x98c9('0x90')](_0x25623d,[_0x98c9('0x2e'),'user'])&&_0x19e2c6[_0x98c9('0x2f')][_0x98c9('0x2e')]!==_0x98c9('0x86')){throw new Error(_0x98c9('0x91'));}if(_['some'](_0x25623d,['role',_0x98c9('0x86')])&&_0x19e2c6['user'][_0x98c9('0x2e')]!==_0x98c9('0x86')){throw new Error(_0x98c9('0x92'));}return licenseUtil['checkUserLimits'](_0x25623d)['then'](function(){return validateUser(_0x25623d[0x0]);})[_0x98c9('0x15')](function(){for(var _0x2c1559=0x1;_0x2c1559<_0x25623d['length'];_0x2c1559++){var _0x3612dc=_0x25623d[_0x2c1559-0x1][_0x98c9('0x67')];if(!_0x25623d[_0x2c1559][_0x98c9('0x67')])_0x25623d[_0x2c1559][_0x98c9('0x67')]=_0x3612dc+0x1;_0x47b4f1[_0x98c9('0x4c')](validateUser(_0x25623d[_0x2c1559]));}return Promise[_0x98c9('0x57')](_0x47b4f1);})[_0x98c9('0x15')](function(){_0x47b4f1=[];for(var _0x1c8dfb=0x0;_0x1c8dfb<_0x25623d[_0x98c9('0x4f')];_0x1c8dfb++){_0x47b4f1['push'](updateUser(_0x25623d[_0x1c8dfb]));}return Promise[_0x98c9('0x57')](_0x47b4f1);})[_0x98c9('0x15')](function(){_0x47b4f1=_0x25623d[_0x98c9('0x35')](function(_0x3ef0c7){return db[_0x98c9('0x4d')]['create'](_0x3ef0c7,{'include':[{'model':db[_0x98c9('0x8b')],'as':_0x98c9('0x8b')}]})[_0x98c9('0x15')](function(_0x2ff013){_0x3ef0c7['id']=_0x2ff013['id'];return _0x3ef0c7;});});return Promise[_0x98c9('0x57')](_0x47b4f1);})[_0x98c9('0x15')](function(_0x58c546){if(_0x19e2c6['body']['role']===_0x98c9('0x2f'))return _0x58c546;if(_0x19e2c6[_0x98c9('0x2f')]['role']!==_0x98c9('0x2f'))return _0x58c546;var _0x359670=_['some'](_0x58c546,function(_0x2f96c6){return _0x2f96c6['role']==='agent'||_0x2f96c6['role']===_0x98c9('0x32');});if(!_0x359670)return _0x58c546;return db[_0x98c9('0x8c')][_0x98c9('0x93')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x19e2c6[_0x98c9('0x2f')][_0x98c9('0x8a')]},'raw':!![]})[_0x98c9('0x15')](function(_0x3de273){if(_['isEmpty'](_0x3de273)||!_[_0x98c9('0x90')](_0x3de273,['autoAssociation',0x0]))return _0x58c546;_0x47b4f1=[];var _0x2eea2a=_(_0x3de273)['map'](function(_0x490464){if(_0x490464[_0x98c9('0x94')]===0x1)return;return _0x490464[_0x98c9('0x38')]===_0x98c9('0x30')?_0x98c9('0x85'):_0x98c9('0x32');})[_0x98c9('0x95')]()[_0x98c9('0x36')]();for(var _0x4fd4a8=0x0;_0x4fd4a8<_0x58c546['length'];_0x4fd4a8++){if(!_[_0x98c9('0x41')](_0x2eea2a,_0x58c546[_0x4fd4a8][_0x98c9('0x2e')]))return;var _0x1d4b5f=_0x58c546[_0x4fd4a8][_0x98c9('0x2e')]==='agent'?'Agents':_0x98c9('0x31');_0x47b4f1[_0x98c9('0x4c')](db[_0x98c9('0x39')][_0x98c9('0x84')]({'name':_0x58c546[_0x4fd4a8][_0x98c9('0x38')],'resourceId':_0x58c546[_0x4fd4a8]['id'],'type':_0x1d4b5f,'sectionId':_[_0x98c9('0x37')](_0x3de273,[_0x98c9('0x38'),_0x1d4b5f])['id']},{}));}return Promise[_0x98c9('0x57')](_0x47b4f1);});})[_0x98c9('0x15')](respondWithResult(_0x5897c9,0xc9))['catch'](handleError(_0x5897c9,null));};exports['changePassword']=function(_0x488d7f,_0x135427){if(_0x488d7f[_0x98c9('0x62')]['id']){delete _0x488d7f[_0x98c9('0x62')]['id'];}return db['User'][_0x98c9('0x37')]({'where':{'id':_0x488d7f[_0x98c9('0x59')]['id']}})[_0x98c9('0x15')](function(_0x3214e8){if(!_0x3214e8)return null;if(_0x3214e8['id']===_0x488d7f[_0x98c9('0x2f')]['id']){if(!_0x488d7f[_0x98c9('0x62')][_0x98c9('0x96')]||!_0x488d7f[_0x98c9('0x62')][_0x98c9('0x97')]){throw new db['Sequelize'][(_0x98c9('0x98'))](_0x98c9('0x99'));}if(!_0x3214e8[_0x98c9('0x9a')](_0x488d7f[_0x98c9('0x62')][_0x98c9('0x96')])){throw new db[(_0x98c9('0x9b'))][(_0x98c9('0x98'))](_0x98c9('0x9c'));}if(_0x488d7f[_0x98c9('0x62')][_0x98c9('0x96')]===_0x488d7f[_0x98c9('0x62')][_0x98c9('0x97')]){throw new db[(_0x98c9('0x9b'))][(_0x98c9('0x98'))](_0x98c9('0x9d'));}}else if(_0x488d7f[_0x98c9('0x2f')][_0x98c9('0x2e')]===_0x98c9('0x86')){if(!_0x488d7f['body'][_0x98c9('0x97')]){throw new db[(_0x98c9('0x9b'))]['ValidationError'](_0x98c9('0x9e'));}}else if(_0x488d7f[_0x98c9('0x2f')][_0x98c9('0x2e')]===_0x98c9('0x2f')){if(!_0x488d7f['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0x98c9('0x9e'));}if(_0x3214e8['role']!=='agent'){throw new db[(_0x98c9('0x9b'))][(_0x98c9('0x98'))]('Unauthorized');}}else{throw new db[(_0x98c9('0x9b'))][(_0x98c9('0x98'))](_0x98c9('0x8f'));}return _0x3214e8;})['then'](handleEntityNotFound(_0x135427,null))[_0x98c9('0x15')](function(_0x8e4a92){return db[_0x98c9('0x68')][_0x98c9('0x9f')]({'attributes':['id','securePassword',_0x98c9('0xa0'),_0x98c9('0xa1')]})[_0x98c9('0x15')](function(_0x1c0db9){if(_0x1c0db9[_0x98c9('0x6a')])authService[_0x98c9('0x6b')](_0x488d7f['body'][_0x98c9('0x97')]);if(!_0x1c0db9[_0x98c9('0xa0')]||!_0x8e4a92[_0x98c9('0xa2')])return _0x8e4a92;authService[_0x98c9('0xa3')](_0x488d7f[_0x98c9('0x62')][_0x98c9('0x97')],_0x8e4a92['previousPasswords'],_0x1c0db9[_0x98c9('0xa1')]);return _0x8e4a92;})[_0x98c9('0x15')](saveUpdates({'password':_0x488d7f[_0x98c9('0x62')][_0x98c9('0x97')],'passwordResetAt':_0x488d7f[_0x98c9('0x2f')]['id']==_0x488d7f[_0x98c9('0x59')]['id']?moment():null,'previousPasswords':authService[_0x98c9('0xa4')](_0x488d7f[_0x98c9('0x62')][_0x98c9('0x97')],_0x8e4a92[_0x98c9('0xa2')])},null));})[_0x98c9('0x15')](respondWithResult(_0x135427,null))[_0x98c9('0x1f')](handleError(_0x135427,null));};exports[_0x98c9('0xa5')]=function(_0x3e17ec,_0x193ff9){var _0x1738b7=_0x3e17ec[_0x98c9('0x62')][_0x98c9('0xa6')];return db[_0x98c9('0x4d')][_0x98c9('0x37')]({'where':{'id':_0x3e17ec[_0x98c9('0x59')]['id']},'attributes':['id',_0x98c9('0x38'),_0x98c9('0x2e'),_0x98c9('0xa7'),_0x98c9('0xa8'),'voicePause',_0x98c9('0xa9')]})[_0x98c9('0x15')](handleEntityNotFound(_0x193ff9,null))['then'](function(_0x384912){if(_0x384912){if(!utils[_0x98c9('0xaa')](_0x1738b7)){throw new db['Sequelize'][(_0x98c9('0x98'))](_0x98c9('0xab'));}return _0x384912['add'+_[_0x98c9('0xac')](_0x1738b7[_0x98c9('0xad')]())+_0x98c9('0xae')](_0x3e17ec[_0x98c9('0x62')]['ids'],{'penalty':_0x3e17ec[_0x98c9('0x62')]['penalty']||0x0})[_0x98c9('0xaf')](function(_0x3b1b59){for(var _0x4d662d=0x0;_0x4d662d<_0x3e17ec['body'][_0x98c9('0x65')]['length'];_0x4d662d+=0x1){var _0x238b03={'UserId':Number(_0x3e17ec['params']['id'])};_0x238b03[_[_0x98c9('0xac')](_0x1738b7[_0x98c9('0xad')]())+_0x98c9('0xb0')]=Number(_0x3e17ec[_0x98c9('0x62')][_0x98c9('0x65')][_0x4d662d]);socket[_0x98c9('0x2a')](_0x98c9('0x2f')+_[_0x98c9('0xac')](_0x1738b7['toLowerCase']())+'Queue:save',_0x238b03);}return _0x3b1b59;})[_0x98c9('0x15')](function(){if(_0x1738b7===_0x98c9('0xb1')){return db[_0x98c9('0xb2')]['findAll']({'where':{'id':_0x3e17ec[_0x98c9('0x62')][_0x98c9('0x65')]||[]},'raw':!![],'attributes':['id',_0x98c9('0x38')]});}})[_0x98c9('0x15')](function(_0x2b4194){var _0x27f07f=_0x384912[_0x98c9('0x2d')]({'plain':!![]});var _0x26e8b7=[];if(_0x1738b7===_0x98c9('0xb1')&&_0x27f07f[_0x98c9('0x2e')]===_0x98c9('0x85')&&_0x27f07f[_0x98c9('0xa7')]){for(let _0xe9fe78=0x0;_0xe9fe78<_0x2b4194[_0x98c9('0x4f')];_0xe9fe78+=0x1){_0x26e8b7[_0x98c9('0x4c')]({'membername':_0x27f07f[_0x98c9('0x38')],'UserId':_0x27f07f['id'],'queue_name':_0x2b4194[_0xe9fe78][_0x98c9('0x38')],'VoiceQueueId':_0x2b4194[_0xe9fe78]['id'],'interface':_['isNil'](_0x27f07f[_0x98c9('0xa9')])?util[_0x98c9('0xb3')](_0x98c9('0xb4'),_0x27f07f[_0x98c9('0x38')]):_0x27f07f[_0x98c9('0xa9')],'paused':_0x27f07f['voicePause']||![],'penalty':_0x3e17ec[_0x98c9('0x62')]['penalty']||0x0});}return Promise[_0x98c9('0x57')](_0x26e8b7[_0x98c9('0x35')](function(_0x3a4a55){return db[_0x98c9('0xb5')]['upsert'](_0x3a4a55);}));}return _0x384912;});}})[_0x98c9('0x15')](respondWithStatusCode(_0x193ff9,null))[_0x98c9('0x1f')](handleError(_0x193ff9,null));};exports[_0x98c9('0xb6')]=function(_0x412147,_0xb6d9a8){var _0x22c1a0,_0x3ecb73;return db['User']['find']({'where':{'id':_0x412147[_0x98c9('0x59')]['id']},'attributes':['id',_0x98c9('0x38'),_0x98c9('0x2e')]})['then'](handleEntityNotFound(_0xb6d9a8,null))[_0x98c9('0x15')](function(_0x11b2b3){if(_0x11b2b3){_0x22c1a0=_0x11b2b3;if(!_0x412147[_0x98c9('0x47')][_0x98c9('0xa6')]||!utils[_0x98c9('0xaa')](_0x412147[_0x98c9('0x47')]['channel'])){throw new db['Sequelize'][(_0x98c9('0x98'))](_0x98c9('0xab'));}return _0x11b2b3[_0x98c9('0xb7')+_[_0x98c9('0xac')](_0x412147[_0x98c9('0x47')][_0x98c9('0xa6')][_0x98c9('0xad')]())+_0x98c9('0xae')](_0x412147[_0x98c9('0x47')][_0x98c9('0x65')]);}})[_0x98c9('0x15')](function(_0x4d6991){if(_['isArray'](_0x412147['query'][_0x98c9('0x65')])){for(var _0x5ba500=0x0;_0x5ba500<_0x412147[_0x98c9('0x47')][_0x98c9('0x65')][_0x98c9('0x4f')];_0x5ba500+=0x1){_0x3ecb73={'UserId':Number(_0x412147[_0x98c9('0x59')]['id'])};_0x3ecb73[_['capitalize'](_0x412147[_0x98c9('0x47')]['channel'][_0x98c9('0xad')]())+_0x98c9('0xb0')]=Number(_0x412147[_0x98c9('0x47')]['ids'][_0x5ba500]);socket['emit']('user'+_['capitalize'](_0x412147[_0x98c9('0x47')][_0x98c9('0xa6')]['toLowerCase']())+_0x98c9('0xb8'),_0x3ecb73);}}else{_0x3ecb73={'UserId':Number(_0x412147[_0x98c9('0x59')]['id'])};_0x3ecb73[_[_0x98c9('0xac')](_0x412147[_0x98c9('0x47')]['channel'][_0x98c9('0xad')]())+_0x98c9('0xb0')]=Number(_0x412147[_0x98c9('0x47')][_0x98c9('0x65')]);socket[_0x98c9('0x2a')](_0x98c9('0x2f')+_['capitalize'](_0x412147[_0x98c9('0x47')]['channel'][_0x98c9('0xad')]())+_0x98c9('0xb8'),_0x3ecb73);}return _0x4d6991;})['then'](function(){if(_0x412147[_0x98c9('0x47')][_0x98c9('0xa6')]===_0x98c9('0xb1')){return db[_0x98c9('0xb5')][_0x98c9('0x2c')]({'where':{'UserId':_0x412147[_0x98c9('0x59')]['id'],'VoiceQueueId':_0x412147[_0x98c9('0x47')][_0x98c9('0x65')]},'individualHooks':!![]})['then'](function(){return _0x22c1a0;});}return _0x22c1a0;})[_0x98c9('0x15')](respondWithStatusCode(_0xb6d9a8,null))['catch'](handleError(_0xb6d9a8,null));};exports[_0x98c9('0xb9')]=function(_0x43dba8,_0x4383a5){_0x43dba8[_0x98c9('0x62')][_0x98c9('0xba')]=_0x43dba8['file'][_0x98c9('0xbb')];return db['User']['find']({'where':{'id':_0x43dba8['params']['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x4383a5,null))[_0x98c9('0x15')](saveUpdates(_0x43dba8['body'],null))[_0x98c9('0x15')](respondWithResult(_0x4383a5,null))[_0x98c9('0x1f')](handleError(_0x4383a5,null));};exports[_0x98c9('0xbc')]=function(_0x1799fc,_0x33fe2e){var _0x701243=path['join'](config['root'],_0x98c9('0xbd'));return db[_0x98c9('0x4d')][_0x98c9('0x37')]({'where':{'id':_0x1799fc['params']['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x33fe2e,null))[_0x98c9('0x15')](function(_0xa0b416){if(_0xa0b416){if(_['isNil'](_0xa0b416[_0x98c9('0xba')])){return _0x33fe2e[_0x98c9('0xbe')](_0x701243);}else{if(!fs[_0x98c9('0xbf')](path[_0x98c9('0xc0')](config[_0x98c9('0xc1')],_0x98c9('0xc2'),_0xa0b416[_0x98c9('0xba')]))){return _0x33fe2e[_0x98c9('0xbe')](_0x701243);}return _0x33fe2e[_0x98c9('0xbe')](path['join'](config[_0x98c9('0xc1')],_0x98c9('0xc2'),_0xa0b416['userpic']));}}})['catch'](handleError(_0x33fe2e,null));};exports[_0x98c9('0xc3')]=function(_0x19a6b3,_0x37ea2d){return db[_0x98c9('0x4d')][_0x98c9('0x37')]({'where':{'id':_0x19a6b3[_0x98c9('0x59')]['id']},'attributes':['id']})[_0x98c9('0x15')](handleEntityNotFound(_0x37ea2d,null))[_0x98c9('0x15')](function(_0x195854){var _0x2244f0=[];values=_0x195854[_0x98c9('0x51')];_0x2244f0['push'](get_open_tabs(_0x98c9('0x50'),_0x195854[_0x98c9('0x51')]));_0x2244f0[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x52'),_0x195854['dataValues']));_0x2244f0[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x55'),_0x195854['dataValues']));_0x2244f0[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x56'),_0x195854[_0x98c9('0x51')]));_0x2244f0[_0x98c9('0x4c')](get_open_tabs('fax',_0x195854['dataValues']));_0x2244f0[_0x98c9('0x4c')](get_open_tabs(_0x98c9('0x54'),_0x195854[_0x98c9('0x51')]));return Promise[_0x98c9('0x57')](_0x2244f0);})[_0x98c9('0x15')](function(_0xbb7299){if(_0xbb7299){var _0x28f4aa=_[_0x98c9('0x35')](values[_0x98c9('0xc4')],function(_0x4d9d88){return{'channel':_0x98c9('0xc5'),'id':_0x4d9d88['id'],'createdAt':_0x4d9d88[_0x98c9('0xc6')]};});var _0x5f8dec=_['map'](values[_0x98c9('0xc7')],function(_0x557d9b){return{'channel':_0x98c9('0xc8'),'id':_0x557d9b['id'],'createdAt':_0x557d9b[_0x98c9('0xc6')]};});var _0x181f0c=_[_0x98c9('0x35')](values[_0x98c9('0xc9')],function(_0x2f87ea){return{'channel':_0x98c9('0xca'),'id':_0x2f87ea['id'],'createdAt':_0x2f87ea[_0x98c9('0xc6')]};});var _0x4ab2b5=_[_0x98c9('0x35')](values[_0x98c9('0xcb')],function(_0x13b85d){return{'channel':_0x98c9('0xcc'),'id':_0x13b85d['id'],'createdAt':_0x13b85d[_0x98c9('0xc6')]};});var _0x4f46b7=_[_0x98c9('0x35')](values[_0x98c9('0xcd')],function(_0x2ad18e){return{'channel':_0x98c9('0xce'),'id':_0x2ad18e['id'],'createdAt':_0x2ad18e['createdAt']};});var _0x405bf=_[_0x98c9('0x35')](values[_0x98c9('0xcf')],function(_0x32115f){return{'channel':_0x98c9('0xd0'),'id':_0x32115f['id'],'createdAt':_0x32115f[_0x98c9('0xc6')]};});var _0x31ff66=_[_0x98c9('0xd1')](_0x28f4aa,_0x5f8dec,_0x181f0c,_0x4ab2b5,_0x4f46b7,_0x405bf);var _0x5aff31={'count':_0x31ff66[_0x98c9('0x4f')],'rows':_0x31ff66};return _0x5aff31;}else return null;})[_0x98c9('0x15')](respondWithResult(_0x37ea2d,null))[_0x98c9('0x1f')](handleError(_0x37ea2d,null));};exports[_0x98c9('0xd2')]=function(_0x598e98,_0x7104ee){var _0x55a6d5={};var _0x5720b9={};var _0x20a072;var _0x298df5;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x598e98[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x7104ee,null))[_0x98c9('0x15')](function(_0x5ca2ce){if(_0x5ca2ce){_0x20a072=_0x5ca2ce;_0x5720b9[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xd3')][_0x98c9('0x3d')]);_0x5720b9['query']=_['keys'](_0x598e98[_0x98c9('0x47')]);_0x5720b9[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x5720b9[_0x98c9('0x5e')],_0x5720b9[_0x98c9('0x47')]);_0x55a6d5['attributes']=_[_0x98c9('0x5d')](_0x5720b9[_0x98c9('0x5e')],qs['fields'](_0x598e98[_0x98c9('0x47')]['fields']));_0x55a6d5[_0x98c9('0x4b')]=_0x55a6d5[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x55a6d5['attributes']:_0x5720b9['model'];_0x55a6d5['order']=qs['sort'](_0x598e98[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x55a6d5[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x598e98['query'],_0x5720b9[_0x98c9('0x5c')]));if(_0x598e98[_0x98c9('0x47')]['filter']){_0x55a6d5['where']=_[_0x98c9('0x60')](_0x55a6d5['where'],{'$or':_[_0x98c9('0x35')](_0x55a6d5['attributes'],function(_0x37142a){var _0x1546d0={};_0x1546d0[_0x37142a]={'$like':'%'+_0x598e98[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x1546d0;})});}_0x55a6d5=_[_0x98c9('0x60')]({},_0x55a6d5,_0x598e98[_0x98c9('0x61')]);return _0x20a072[_0x98c9('0xd2')](_0x55a6d5);}})['then'](function(_0x3acfb2){if(_0x3acfb2){_0x298df5=_0x3acfb2['length'];if(_0x598e98['query'][_0x98c9('0xd6')](_0x98c9('0x45'))){_0x55a6d5[_0x98c9('0x46')]=[{'model':db[_0x98c9('0xd7')],'as':'List','required':![]},{'model':db[_0x98c9('0xd8')],'as':'Tags','attributes':['id',_0x98c9('0x38'),_0x98c9('0xd9')],'where':_0x598e98[_0x98c9('0x47')][_0x98c9('0xda')]?{'id':_0x598e98[_0x98c9('0x47')][_0x98c9('0xda')]}:undefined,'required':_0x598e98[_0x98c9('0x47')][_0x98c9('0xda')]?!![]:![]}];}if(!_0x598e98[_0x98c9('0x47')]['hasOwnProperty'](_0x98c9('0xdb'))){_0x55a6d5['limit']=qs[_0x98c9('0x26')](_0x598e98[_0x98c9('0x47')][_0x98c9('0x26')]);_0x55a6d5['offset']=qs[_0x98c9('0x23')](_0x598e98[_0x98c9('0x47')]['offset']);}return _0x20a072[_0x98c9('0xd2')](_0x55a6d5);}})[_0x98c9('0x15')](function(_0x2b1718){if(_0x2b1718){return _0x2b1718?{'count':_0x298df5,'rows':_0x2b1718}:null;}})[_0x98c9('0x15')](respondWithResult(_0x7104ee,null))[_0x98c9('0x1f')](handleError(_0x7104ee,null));};exports[_0x98c9('0xdc')]=function(_0x55eab6,_0x4c92e5){var _0x54823c;var _0x27f655={};var _0x2a4d2a;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x55eab6[_0x98c9('0x59')]['id']},'attributes':['id',_0x98c9('0x38'),_0x98c9('0x2e')]})['then'](handleEntityNotFound(_0x4c92e5,null))[_0x98c9('0x15')](function(_0x33f252){if(!utils[_0x98c9('0xaa')](_0x55eab6[_0x98c9('0x47')][_0x98c9('0xa6')])){throw new db[(_0x98c9('0x9b'))]['ValidationError']('Unknown\x20channel');}_0x54823c=_0x33f252;var _0x1d28f3={};_0x1d28f3[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_['capitalize'](_0x55eab6[_0x98c9('0x47')][_0x98c9('0xa6')])+'Queue']['rawAttributes']);_0x1d28f3[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x55eab6[_0x98c9('0x47')]);_0x1d28f3[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x1d28f3[_0x98c9('0x5e')],_0x1d28f3[_0x98c9('0x47')]);_0x27f655['attributes']=_[_0x98c9('0x5d')](_0x1d28f3[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x55eab6[_0x98c9('0x47')]['fields']));_0x27f655[_0x98c9('0x4b')]=_0x27f655['attributes']['length']?_0x27f655[_0x98c9('0x4b')]:_0x1d28f3[_0x98c9('0x5e')];_0x27f655[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x55eab6[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x27f655[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_['pick'](_0x55eab6['query'],_0x1d28f3[_0x98c9('0x5c')]));if(_0x55eab6[_0x98c9('0x47')][_0x98c9('0x33')]){_0x27f655['where']=_[_0x98c9('0x60')](_0x27f655['where'],{'$or':_[_0x98c9('0x35')](_0x27f655[_0x98c9('0x4b')],function(_0x32c6ee){var _0x1f3c33={};_0x1f3c33[_0x32c6ee]={'$like':'%'+_0x55eab6[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x1f3c33;})});}_0x27f655=_[_0x98c9('0x60')]({},_0x27f655,_0x55eab6[_0x98c9('0x61')]);switch(_0x54823c['role']){case _0x98c9('0x86'):return db[_[_0x98c9('0xac')](_0x55eab6[_0x98c9('0x47')]['channel'])+_0x98c9('0xde')]['findAll'](_0x27f655);case'user':case'agent':return _0x54823c[_0x98c9('0x2d')+_[_0x98c9('0xac')](_0x55eab6[_0x98c9('0x47')]['channel'])+_0x98c9('0xae')](_0x27f655);default:throw new db[(_0x98c9('0x9b'))][(_0x98c9('0x98'))](_0x98c9('0xdf'));}})[_0x98c9('0x15')](function(_0x9c06cb){_0x2a4d2a=_0x9c06cb[_0x98c9('0x4f')];if(!_0x55eab6[_0x98c9('0x47')][_0x98c9('0xd6')]('nolimit')){_0x27f655[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x55eab6['query'][_0x98c9('0x26')]);_0x27f655['offset']=qs['offset'](_0x55eab6[_0x98c9('0x47')][_0x98c9('0x23')]);}switch(_0x54823c['role']){case _0x98c9('0x86'):return db[_[_0x98c9('0xac')](_0x55eab6['query'][_0x98c9('0xa6')])+'Queue'][_0x98c9('0x93')](_0x27f655);case _0x98c9('0x2f'):case _0x98c9('0x85'):return _0x54823c[_0x98c9('0x2d')+_[_0x98c9('0xac')](_0x55eab6['query'][_0x98c9('0xa6')])+'Queues'](_0x27f655);}})[_0x98c9('0x15')](function(_0x2d1cd4){return{'count':_0x2a4d2a,'rows':_0x2d1cd4};})[_0x98c9('0x15')](respondWithResult(_0x4c92e5,null))[_0x98c9('0x1f')](handleError(_0x4c92e5,null));};exports[_0x98c9('0xe0')]=function(_0x4d318c,_0x3b2484){var _0x428cd7={};var _0x148b4a={};var _0x4b9b5c;var _0x5721e8;return db[_0x98c9('0x4d')]['findOne']({'where':{'id':_0x4d318c[_0x98c9('0x59')]['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x3b2484,null))[_0x98c9('0x15')](function(_0x1f205f){if(_0x1f205f){_0x4b9b5c=_0x1f205f;_0x148b4a[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xb5')][_0x98c9('0x3d')]);_0x148b4a[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x4d318c['query']);_0x148b4a[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x148b4a[_0x98c9('0x5e')],_0x148b4a[_0x98c9('0x47')]);_0x428cd7['attributes']=_[_0x98c9('0x5d')](_0x148b4a[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x4d318c[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x428cd7[_0x98c9('0x4b')]=_0x428cd7[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x428cd7[_0x98c9('0x4b')]:_0x148b4a[_0x98c9('0x5e')];_0x428cd7[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x4d318c[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x428cd7[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x4d318c[_0x98c9('0x47')],_0x148b4a[_0x98c9('0x5c')]));if(_0x4d318c['query'][_0x98c9('0x33')]){_0x428cd7[_0x98c9('0x44')]=_['merge'](_0x428cd7[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x428cd7[_0x98c9('0x4b')],function(_0x1c807e){var _0xbcc1f7={};_0xbcc1f7[_0x1c807e]={'$like':'%'+_0x4d318c[_0x98c9('0x47')]['filter']+'%'};return _0xbcc1f7;})});}_0x428cd7=_[_0x98c9('0x60')]({},_0x428cd7,_0x4d318c[_0x98c9('0x61')]);return _0x4b9b5c['getVoiceQueuesRt'](_0x428cd7);}})[_0x98c9('0x15')](function(_0x4e9dca){if(_0x4e9dca){_0x5721e8=_0x4e9dca[_0x98c9('0x4f')];if(!_0x4d318c[_0x98c9('0x47')]['hasOwnProperty']('nolimit')){_0x428cd7[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x4d318c['query'][_0x98c9('0x26')]);_0x428cd7[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x4d318c[_0x98c9('0x47')][_0x98c9('0x23')]);}return _0x4b9b5c[_0x98c9('0xe0')](_0x428cd7);}})[_0x98c9('0x15')](function(_0x57a005){if(_0x57a005){return _0x57a005?{'count':_0x5721e8,'rows':_0x57a005}:null;}})[_0x98c9('0x15')](respondWithResult(_0x3b2484,null))[_0x98c9('0x1f')](handleError(_0x3b2484,null));};exports[_0x98c9('0xe1')]=function(_0x2b0a84,_0x59492c){var _0x55b2a5={};var _0x4cdfd1={};var _0x727a5d;var _0x20c1ed;return db['User'][_0x98c9('0x9f')]({'where':{'id':_0x2b0a84['params']['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x59492c,null))[_0x98c9('0x15')](function(_0xd876f2){if(_0xd876f2){_0x727a5d=_0xd876f2;_0x4cdfd1['model']=_['keys'](db[_0x98c9('0xe2')][_0x98c9('0x3d')]);_0x4cdfd1[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x2b0a84['query']);_0x4cdfd1[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x4cdfd1['model'],_0x4cdfd1[_0x98c9('0x47')]);_0x55b2a5[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x4cdfd1['model'],qs[_0x98c9('0x5f')](_0x2b0a84['query'][_0x98c9('0x5f')]));_0x55b2a5['attributes']=_0x55b2a5['attributes']['length']?_0x55b2a5[_0x98c9('0x4b')]:_0x4cdfd1[_0x98c9('0x5e')];_0x55b2a5[_0x98c9('0xdd')]=qs['sort'](_0x2b0a84[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x55b2a5[_0x98c9('0x44')]=qs['filters'](_[_0x98c9('0xd5')](_0x2b0a84[_0x98c9('0x47')],_0x4cdfd1[_0x98c9('0x5c')]));if(_0x2b0a84[_0x98c9('0x47')][_0x98c9('0x33')]){_0x55b2a5[_0x98c9('0x44')]=_['merge'](_0x55b2a5['where'],{'$or':_['map'](_0x55b2a5['attributes'],function(_0x34e014){var _0x4b2c57={};_0x4b2c57[_0x34e014]={'$like':'%'+_0x2b0a84['query'][_0x98c9('0x33')]+'%'};return _0x4b2c57;})});}_0x55b2a5=_['merge']({},_0x55b2a5,_0x2b0a84[_0x98c9('0x61')]);return _0x727a5d[_0x98c9('0xe1')](_0x55b2a5);}})['then'](function(_0x3c8cf7){if(_0x3c8cf7){_0x20c1ed=_0x3c8cf7['length'];if(!_0x2b0a84[_0x98c9('0x47')]['hasOwnProperty'](_0x98c9('0xdb'))){_0x55b2a5['limit']=qs['limit'](_0x2b0a84[_0x98c9('0x47')][_0x98c9('0x26')]);_0x55b2a5[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x2b0a84['query'][_0x98c9('0x23')]);}return _0x727a5d[_0x98c9('0xe1')](_0x55b2a5);}})[_0x98c9('0x15')](function(_0x5185dc){if(_0x5185dc){return _0x5185dc?{'count':_0x20c1ed,'rows':_0x5185dc}:null;}})[_0x98c9('0x15')](respondWithResult(_0x59492c,null))['catch'](handleError(_0x59492c,null));};exports[_0x98c9('0xe3')]=function(_0x56ad94,_0xa4b844){var _0x4fd816={'raw':!![],'where':{}};var _0x298ff9={};var _0x4e07b0={'count':0x0,'rows':[]};return db[_0x98c9('0x4d')]['findOne']({'where':{'id':_0x56ad94[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0xa4b844,null))['then'](function(_0x3a45d2){if(_0x3a45d2){_0x298ff9[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xe4')][_0x98c9('0x3d')]);_0x298ff9['query']=_['keys'](_0x56ad94[_0x98c9('0x47')]);_0x298ff9[_0x98c9('0x5c')]=_['intersection'](_0x298ff9[_0x98c9('0x5e')],_0x298ff9[_0x98c9('0x47')]);_0x4fd816[_0x98c9('0x4b')]=_['intersection'](_0x298ff9[_0x98c9('0x5e')],qs['fields'](_0x56ad94[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x4fd816[_0x98c9('0x4b')]=_0x4fd816[_0x98c9('0x4b')]['length']?_0x4fd816[_0x98c9('0x4b')]:_0x298ff9['model'];if(!_0x56ad94[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x4fd816[_0x98c9('0x26')]=qs['limit'](_0x56ad94[_0x98c9('0x47')][_0x98c9('0x26')]);_0x4fd816[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x56ad94[_0x98c9('0x47')][_0x98c9('0x23')]);}_0x4fd816['order']=qs[_0x98c9('0xd4')](_0x56ad94[_0x98c9('0x47')]['sort']);_0x4fd816[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x56ad94['query'],_0x298ff9[_0x98c9('0x5c')]));_0x4fd816[_0x98c9('0x44')][_0x98c9('0xe5')]=_0x3a45d2['id'];if(_0x56ad94[_0x98c9('0x47')][_0x98c9('0x33')]){_0x4fd816['where']=_[_0x98c9('0x60')](_0x4fd816[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x4fd816[_0x98c9('0x4b')],function(_0x3ef367){var _0x51f7df={};_0x51f7df[_0x3ef367]={'$like':'%'+_0x56ad94[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x51f7df;})});}_0x4fd816=_['merge']({},_0x4fd816,_0x56ad94[_0x98c9('0x61')]);return db[_0x98c9('0xe4')][_0x98c9('0x25')]({'where':_0x4fd816[_0x98c9('0x44')]})['then'](function(_0x3018c2){_0x4e07b0[_0x98c9('0x25')]=_0x3018c2;if(_0x56ad94[_0x98c9('0x47')][_0x98c9('0x45')]){_0x4fd816['include']=[{'all':!![]}];}return db['VoiceRecording'][_0x98c9('0x93')](_0x4fd816);})[_0x98c9('0x15')](function(_0x167487){_0x4e07b0[_0x98c9('0x4e')]=_0x167487;return _0x4e07b0;});}})['then'](respondWithFilteredResult(_0xa4b844,_0x4fd816))[_0x98c9('0x1f')](handleError(_0xa4b844,null));};exports[_0x98c9('0xe6')]=function(_0x4ba696,_0x3a4d54){var _0x4a78ac={'raw':!![],'where':{}};var _0x5a00a8={};var _0x1ac25c={'count':0x0,'rows':[]};return db[_0x98c9('0x4d')]['findOne']({'where':{'id':_0x4ba696['params']['id']}})['then'](handleEntityNotFound(_0x3a4d54,null))[_0x98c9('0x15')](function(_0x42c66d){if(_0x42c66d){_0x5a00a8['model']=_[_0x98c9('0x5b')](db[_0x98c9('0xe7')][_0x98c9('0x3d')]);_0x5a00a8['query']=_[_0x98c9('0x5b')](_0x4ba696['query']);_0x5a00a8[_0x98c9('0x5c')]=_['intersection'](_0x5a00a8[_0x98c9('0x5e')],_0x5a00a8[_0x98c9('0x47')]);_0x4a78ac[_0x98c9('0x4b')]=_['intersection'](_0x5a00a8[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x4ba696[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x4a78ac['attributes']=_0x4a78ac[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x4a78ac[_0x98c9('0x4b')]:_0x5a00a8[_0x98c9('0x5e')];if(!_0x4ba696[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x4a78ac[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x4ba696[_0x98c9('0x47')][_0x98c9('0x26')]);_0x4a78ac['offset']=qs[_0x98c9('0x23')](_0x4ba696['query'][_0x98c9('0x23')]);}_0x4a78ac[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x4ba696[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x4a78ac[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x4ba696[_0x98c9('0x47')],_0x5a00a8['filters']));_0x4a78ac[_0x98c9('0x44')][_0x98c9('0xe5')]=_0x42c66d['id'];if(_0x4ba696['query'][_0x98c9('0x33')]){_0x4a78ac[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x4a78ac[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x4a78ac[_0x98c9('0x4b')],function(_0x541354){var _0x322e3d={};_0x322e3d[_0x541354]={'$like':'%'+_0x4ba696[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x322e3d;})});}_0x4a78ac=_[_0x98c9('0x60')]({},_0x4a78ac,_0x4ba696[_0x98c9('0x61')]);return db[_0x98c9('0xe7')][_0x98c9('0x25')]({'where':_0x4a78ac[_0x98c9('0x44')]})[_0x98c9('0x15')](function(_0x5557c6){_0x1ac25c['count']=_0x5557c6;if(_0x4ba696[_0x98c9('0x47')]['includeAll']){_0x4a78ac['include']=[{'all':!![]}];}return db[_0x98c9('0xe7')][_0x98c9('0x93')](_0x4a78ac);})[_0x98c9('0x15')](function(_0x441d50){_0x1ac25c['rows']=_0x441d50;return _0x1ac25c;});}})['then'](respondWithFilteredResult(_0x3a4d54,_0x4a78ac))[_0x98c9('0x1f')](handleError(_0x3a4d54,null));};exports['getChatInteractions']=function(_0x7a4f97,_0x2c8481){var _0x369d1d={};var _0x4ba80a={};var _0x5ea7f6;var _0x33357d;return db['User']['findOne']({'where':{'id':_0x7a4f97[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x2c8481,null))[_0x98c9('0x15')](function(_0x2b40c0){if(_0x2b40c0){_0x5ea7f6=_0x2b40c0;_0x4ba80a[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xe8')][_0x98c9('0x3d')]);_0x4ba80a[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x7a4f97[_0x98c9('0x47')]);_0x4ba80a[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x4ba80a[_0x98c9('0x5e')],_0x4ba80a[_0x98c9('0x47')]);_0x369d1d[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x4ba80a[_0x98c9('0x5e')],qs['fields'](_0x7a4f97['query'][_0x98c9('0x5f')]));_0x369d1d[_0x98c9('0x4b')]=_0x369d1d[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x369d1d[_0x98c9('0x4b')]:_0x4ba80a[_0x98c9('0x5e')];_0x369d1d['order']=qs[_0x98c9('0xd4')](_0x7a4f97[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x369d1d[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_['pick'](_0x7a4f97['query'],_0x4ba80a[_0x98c9('0x5c')]));if(_0x7a4f97[_0x98c9('0x47')]['filter']){_0x369d1d[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x369d1d[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x369d1d[_0x98c9('0x4b')],function(_0x235985){var _0x2d90a9={};_0x2d90a9[_0x235985]={'$like':'%'+_0x7a4f97[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x2d90a9;})});}_0x369d1d=_['merge']({},_0x369d1d,_0x7a4f97['options']);return _0x5ea7f6[_0x98c9('0xe9')](_0x369d1d);}})[_0x98c9('0x15')](function(_0xda1a0c){if(_0xda1a0c){_0x33357d=_0xda1a0c[_0x98c9('0x4f')];if(!_0x7a4f97['query'][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x369d1d[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x7a4f97['query'][_0x98c9('0x26')]);_0x369d1d[_0x98c9('0x23')]=qs['offset'](_0x7a4f97[_0x98c9('0x47')][_0x98c9('0x23')]);}return _0x5ea7f6['getChatInteractions'](_0x369d1d);}})[_0x98c9('0x15')](function(_0x475f22){if(_0x475f22){return _0x475f22?{'count':_0x33357d,'rows':_0x475f22}:null;}})[_0x98c9('0x15')](respondWithResult(_0x2c8481,null))[_0x98c9('0x1f')](handleError(_0x2c8481,null));};exports[_0x98c9('0xea')]=function(_0x4f9b5f,_0x398dc6){var _0x4e63d6={};var _0x53fac6={};var _0x360bc2;var _0x5b5871;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x4f9b5f[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x398dc6,null))[_0x98c9('0x15')](function(_0x55c51a){if(_0x55c51a){_0x360bc2=_0x55c51a;_0x53fac6[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db['OpenchannelInteraction'][_0x98c9('0x3d')]);_0x53fac6[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x4f9b5f[_0x98c9('0x47')]);_0x53fac6[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x53fac6[_0x98c9('0x5e')],_0x53fac6['query']);_0x4e63d6[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x53fac6[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x4f9b5f['query']['fields']));_0x4e63d6[_0x98c9('0x4b')]=_0x4e63d6[_0x98c9('0x4b')]['length']?_0x4e63d6[_0x98c9('0x4b')]:_0x53fac6['model'];_0x4e63d6[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x4f9b5f[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x4e63d6['where']=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x4f9b5f[_0x98c9('0x47')],_0x53fac6[_0x98c9('0x5c')]));if(_0x4f9b5f[_0x98c9('0x47')][_0x98c9('0x33')]){_0x4e63d6['where']=_['merge'](_0x4e63d6[_0x98c9('0x44')],{'$or':_['map'](_0x4e63d6['attributes'],function(_0x41040b){var _0x398904={};_0x398904[_0x41040b]={'$like':'%'+_0x4f9b5f['query'][_0x98c9('0x33')]+'%'};return _0x398904;})});}_0x4e63d6=_[_0x98c9('0x60')]({},_0x4e63d6,_0x4f9b5f['options']);return _0x360bc2['getOpenchannelInteractions'](_0x4e63d6);}})['then'](function(_0x1da0f2){if(_0x1da0f2){_0x5b5871=_0x1da0f2[_0x98c9('0x4f')];if(!_0x4f9b5f[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x4e63d6[_0x98c9('0x26')]=qs['limit'](_0x4f9b5f['query'][_0x98c9('0x26')]);_0x4e63d6[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x4f9b5f[_0x98c9('0x47')]['offset']);}return _0x360bc2[_0x98c9('0xea')](_0x4e63d6);}})[_0x98c9('0x15')](function(_0x1de0dd){if(_0x1de0dd){return _0x1de0dd?{'count':_0x5b5871,'rows':_0x1de0dd}:null;}})[_0x98c9('0x15')](respondWithResult(_0x398dc6,null))['catch'](handleError(_0x398dc6,null));};exports[_0x98c9('0xeb')]=function(_0x1657b2,_0x3fba18){var _0x11ff37={'raw':!![],'where':{}};var _0x3b02a7={};var _0x531ce0={'count':0x0,'rows':[]};return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x1657b2[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x3fba18,null))['then'](function(_0x3cf283){if(_0x3cf283){_0x3b02a7[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xec')][_0x98c9('0x3d')]);_0x3b02a7[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x1657b2[_0x98c9('0x47')]);_0x3b02a7[_0x98c9('0x5c')]=_['intersection'](_0x3b02a7[_0x98c9('0x5e')],_0x3b02a7[_0x98c9('0x47')]);_0x11ff37[_0x98c9('0x4b')]=_['intersection'](_0x3b02a7[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x1657b2['query'][_0x98c9('0x5f')]));_0x11ff37[_0x98c9('0x4b')]=_0x11ff37[_0x98c9('0x4b')]['length']?_0x11ff37[_0x98c9('0x4b')]:_0x3b02a7[_0x98c9('0x5e')];if(!_0x1657b2[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x11ff37[_0x98c9('0x26')]=qs['limit'](_0x1657b2[_0x98c9('0x47')][_0x98c9('0x26')]);_0x11ff37[_0x98c9('0x23')]=qs['offset'](_0x1657b2[_0x98c9('0x47')][_0x98c9('0x23')]);}_0x11ff37[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x1657b2['query']['sort']);_0x11ff37[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_['pick'](_0x1657b2['query'],_0x3b02a7[_0x98c9('0x5c')]));_0x11ff37['where'][_0x98c9('0xe5')]=_0x3cf283['id'];if(_0x1657b2[_0x98c9('0x47')][_0x98c9('0x33')]){_0x11ff37[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x11ff37[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x11ff37[_0x98c9('0x4b')],function(_0x5be396){var _0xe1478={};_0xe1478[_0x5be396]={'$like':'%'+_0x1657b2[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0xe1478;})});}_0x11ff37=_[_0x98c9('0x60')]({},_0x11ff37,_0x1657b2['options']);return db[_0x98c9('0xec')][_0x98c9('0x25')]({'where':_0x11ff37[_0x98c9('0x44')]})[_0x98c9('0x15')](function(_0x28ad34){_0x531ce0[_0x98c9('0x25')]=_0x28ad34;if(_0x1657b2[_0x98c9('0x47')][_0x98c9('0x45')]){_0x11ff37['include']=[{'all':!![]}];}return db['MailInteraction'][_0x98c9('0x93')](_0x11ff37);})[_0x98c9('0x15')](function(_0x456e5b){_0x531ce0[_0x98c9('0x4e')]=_0x456e5b;return _0x531ce0;});}})[_0x98c9('0x15')](respondWithFilteredResult(_0x3fba18,_0x11ff37))['catch'](handleError(_0x3fba18,null));};exports[_0x98c9('0xed')]=function(_0x11ce97,_0x472453){var _0x14bb39={};var _0x213dd2={};var _0x3190c4;var _0xd36969;return db['User'][_0x98c9('0x9f')]({'where':{'id':_0x11ce97['params']['id']}})['then'](handleEntityNotFound(_0x472453,null))['then'](function(_0x21f540){if(_0x21f540){_0x3190c4=_0x21f540;_0x213dd2[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xee')][_0x98c9('0x3d')]);_0x213dd2[_0x98c9('0x47')]=_['keys'](_0x11ce97[_0x98c9('0x47')]);_0x213dd2['filters']=_[_0x98c9('0x5d')](_0x213dd2['model'],_0x213dd2[_0x98c9('0x47')]);_0x14bb39[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x213dd2[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x11ce97['query'][_0x98c9('0x5f')]));_0x14bb39[_0x98c9('0x4b')]=_0x14bb39[_0x98c9('0x4b')]['length']?_0x14bb39[_0x98c9('0x4b')]:_0x213dd2[_0x98c9('0x5e')];_0x14bb39['order']=qs[_0x98c9('0xd4')](_0x11ce97[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x14bb39[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x11ce97[_0x98c9('0x47')],_0x213dd2[_0x98c9('0x5c')]));if(_0x11ce97[_0x98c9('0x47')][_0x98c9('0x33')]){_0x14bb39[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x14bb39[_0x98c9('0x44')],{'$or':_['map'](_0x14bb39[_0x98c9('0x4b')],function(_0x4a4630){var _0x396bb1={};_0x396bb1[_0x4a4630]={'$like':'%'+_0x11ce97[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x396bb1;})});}_0x14bb39=_[_0x98c9('0x60')]({},_0x14bb39,_0x11ce97[_0x98c9('0x61')]);return _0x3190c4[_0x98c9('0xed')](_0x14bb39);}})[_0x98c9('0x15')](function(_0x589459){if(_0x589459){_0xd36969=_0x589459[_0x98c9('0x4f')];if(!_0x11ce97[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x14bb39[_0x98c9('0x26')]=qs['limit'](_0x11ce97['query'][_0x98c9('0x26')]);_0x14bb39[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x11ce97[_0x98c9('0x47')][_0x98c9('0x23')]);}return _0x3190c4[_0x98c9('0xed')](_0x14bb39);}})[_0x98c9('0x15')](function(_0x1cfae5){if(_0x1cfae5){return _0x1cfae5?{'count':_0xd36969,'rows':_0x1cfae5}:null;}})[_0x98c9('0x15')](respondWithResult(_0x472453,null))[_0x98c9('0x1f')](handleError(_0x472453,null));};exports[_0x98c9('0xef')]=function(_0x362e09,_0x4669a1){var _0x1c1eaa={};var _0x27b6e3={};var _0x2d1408;var _0x18af02;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x362e09['params']['id']}})['then'](handleEntityNotFound(_0x4669a1,null))[_0x98c9('0x15')](function(_0x3c99aa){if(_0x3c99aa){_0x2d1408=_0x3c99aa;_0x27b6e3[_0x98c9('0x5e')]=_['keys'](db[_0x98c9('0xf0')][_0x98c9('0x3d')]);_0x27b6e3[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x362e09[_0x98c9('0x47')]);_0x27b6e3[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x27b6e3[_0x98c9('0x5e')],_0x27b6e3[_0x98c9('0x47')]);_0x1c1eaa[_0x98c9('0x4b')]=_['intersection'](_0x27b6e3[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x362e09[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x1c1eaa[_0x98c9('0x4b')]=_0x1c1eaa[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x1c1eaa[_0x98c9('0x4b')]:_0x27b6e3[_0x98c9('0x5e')];_0x1c1eaa[_0x98c9('0xdd')]=qs['sort'](_0x362e09[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x1c1eaa[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x362e09[_0x98c9('0x47')],_0x27b6e3[_0x98c9('0x5c')]));if(_0x362e09[_0x98c9('0x47')][_0x98c9('0x33')]){_0x1c1eaa[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x1c1eaa['where'],{'$or':_[_0x98c9('0x35')](_0x1c1eaa[_0x98c9('0x4b')],function(_0x1b2b96){var _0x55efc8={};_0x55efc8[_0x1b2b96]={'$like':'%'+_0x362e09[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x55efc8;})});}_0x1c1eaa=_[_0x98c9('0x60')]({},_0x1c1eaa,_0x362e09[_0x98c9('0x61')]);return _0x2d1408[_0x98c9('0xef')](_0x1c1eaa);}})[_0x98c9('0x15')](function(_0x561475){if(_0x561475){_0x18af02=_0x561475['length'];if(!_0x362e09[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x1c1eaa[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x362e09[_0x98c9('0x47')][_0x98c9('0x26')]);_0x1c1eaa[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x362e09['query'][_0x98c9('0x23')]);}return _0x2d1408[_0x98c9('0xef')](_0x1c1eaa);}})[_0x98c9('0x15')](function(_0x295536){if(_0x295536){return _0x295536?{'count':_0x18af02,'rows':_0x295536}:null;}})[_0x98c9('0x15')](respondWithResult(_0x4669a1,null))[_0x98c9('0x1f')](handleError(_0x4669a1,null));};exports['getWhatsappInteractions']=function(_0x1bc3cd,_0x3780e8){var _0x919d65={};var _0x59f25c={};var _0x2e0778;var _0xf52c2d;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x1bc3cd[_0x98c9('0x59')]['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x3780e8,null))['then'](function(_0x105c44){if(_0x105c44){_0x2e0778=_0x105c44;_0x59f25c[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xf1')][_0x98c9('0x3d')]);_0x59f25c[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x1bc3cd[_0x98c9('0x47')]);_0x59f25c[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x59f25c['model'],_0x59f25c['query']);_0x919d65[_0x98c9('0x4b')]=_[_0x98c9('0x5d')](_0x59f25c['model'],qs[_0x98c9('0x5f')](_0x1bc3cd[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x919d65['attributes']=_0x919d65[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x919d65[_0x98c9('0x4b')]:_0x59f25c[_0x98c9('0x5e')];_0x919d65[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x1bc3cd['query'][_0x98c9('0xd4')]);_0x919d65[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x1bc3cd['query'],_0x59f25c['filters']));if(_0x1bc3cd[_0x98c9('0x47')][_0x98c9('0x33')]){_0x919d65[_0x98c9('0x44')]=_['merge'](_0x919d65[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x919d65[_0x98c9('0x4b')],function(_0xdd0b0d){var _0x3e3687={};_0x3e3687[_0xdd0b0d]={'$like':'%'+_0x1bc3cd['query']['filter']+'%'};return _0x3e3687;})});}_0x919d65=_[_0x98c9('0x60')]({},_0x919d65,_0x1bc3cd[_0x98c9('0x61')]);return _0x2e0778[_0x98c9('0xf2')](_0x919d65);}})[_0x98c9('0x15')](function(_0x46510f){if(_0x46510f){_0xf52c2d=_0x46510f[_0x98c9('0x4f')];if(!_0x1bc3cd['query'][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x919d65[_0x98c9('0x26')]=qs['limit'](_0x1bc3cd[_0x98c9('0x47')][_0x98c9('0x26')]);_0x919d65[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x1bc3cd[_0x98c9('0x47')]['offset']);}return _0x2e0778['getWhatsappInteractions'](_0x919d65);}})['then'](function(_0x27959a){if(_0x27959a){return _0x27959a?{'count':_0xf52c2d,'rows':_0x27959a}:null;}})[_0x98c9('0x15')](respondWithResult(_0x3780e8,null))['catch'](handleError(_0x3780e8,null));};exports[_0x98c9('0xf3')]=function(_0x3eccf0,_0x43f9ad,_0x148762){var _0x2faba5;var _0x16aa46;var _0x2ba5b7;var _0x5a38a0=!_['isNil'](_0x3eccf0[_0x98c9('0x59')]['id'])?_0x3eccf0[_0x98c9('0x59')]['id']:!_['isNil'](_0x3eccf0[_0x98c9('0x2f')]['id'])?_0x3eccf0[_0x98c9('0x2f')]['id']:null;return db['User'][_0x98c9('0x37')]({'where':{'id':_0x5a38a0,'role':{'$or':[_0x98c9('0x86'),_0x98c9('0x2f'),_0x98c9('0x85')]}},'attributes':['id',_0x98c9('0x38'),_0x98c9('0xf4'),_0x98c9('0xf5'),_0x98c9('0x2e'),_0x98c9('0x67'),_0x98c9('0xa8')]})[_0x98c9('0x15')](function(_0x19fb92){if(_0x19fb92){if(_0x19fb92['role']===_0x98c9('0x85')){_0x2faba5=_0x19fb92;if(_0x3eccf0[_0x98c9('0x62')][_0x98c9('0xa9')]){_0x2ba5b7=util['format'](_0x98c9('0xf6'),_0x2faba5[_0x3eccf0['body'][_0x98c9('0xa9')]]);}else if(_0x3eccf0[_0x98c9('0x62')][_0x98c9('0xf7')]){_0x2ba5b7=util[_0x98c9('0xb3')](_0x98c9('0xb4'),_0x3eccf0[_0x98c9('0x62')][_0x98c9('0xf7')]);}else{_0x2ba5b7=util['format'](_0x98c9('0xb4'),_0x2faba5[_0x98c9('0x38')]);}socket['to'](util[_0x98c9('0xb3')]('user:%s',_0x2faba5[_0x98c9('0x38')]))[_0x98c9('0x2a')](_0x98c9('0xf8'),{'user':{'id':_0x2faba5['id'],'name':_0x2faba5[_0x98c9('0x38')]},'ip':_0x3eccf0[_0x98c9('0xf9')][_0x98c9('0xfa')]||_0x3eccf0[_0x98c9('0xfb')][_0x98c9('0xfc')]||_0x3eccf0[_0x98c9('0xfd')][_0x98c9('0xfc')]||_0x3eccf0[_0x98c9('0xfb')][_0x98c9('0xfd')][_0x98c9('0xfc')]});return db[_0x98c9('0xb5')][_0x98c9('0x2c')]({'where':{'membername':_0x2faba5['name']},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x98c9('0x98'))](_0x98c9('0xfe'));}})['then'](function(){if(_0x2faba5){return _0x2faba5[_0x98c9('0xff')]({'raw':!![]});}})[_0x98c9('0x15')](function(_0x71b77){if(_0x2faba5){if(_0x71b77){_0x16aa46=_0x71b77;if(_0x16aa46[_0x98c9('0x4f')]){var _0x1fb1f8=_0x16aa46[_0x98c9('0x35')](function(_0xea7c3e){var _0x2b3bd2={'membername':_0x2faba5[_0x98c9('0x38')],'UserId':_0x2faba5['id'],'queue_name':_0xea7c3e[_0x98c9('0x38')],'VoiceQueueId':_0xea7c3e['id'],'interface':_0x2ba5b7,'paused':_0x2faba5[_0x98c9('0xa8')]||![],'penalty':_0xea7c3e[_0x98c9('0x100')]||0x0};return db['UserVoiceQueueRt'][_0x98c9('0x101')](_0x2b3bd2);});return Promise[_0x98c9('0x57')](_0x1fb1f8);}}}})[_0x98c9('0x15')](function(){if(_0x2faba5){return db[_0x98c9('0x102')][_0x98c9('0x93')]({'where':{'membername':_0x2faba5[_0x98c9('0x38')],'exitAt':null}});}})['then'](function(_0x5cdb62){if(_0x2faba5){var _0x2f7399=[];_0x5cdb62['forEach'](function(_0x1b6f5a){_0x2f7399[_0x98c9('0x4c')](_0x1b6f5a[_0x98c9('0x29')]({'exitAt':moment()[_0x98c9('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x98c9('0x57')](_0x2f7399);}})['then'](function(){if(_0x2faba5){var _0x1d06e4=[];var _0x32a0df=[];var _0x4f6018=utils['getChannels']();var _0x1d5996={'membername':_0x2faba5[_0x98c9('0x38')],'interface':_0x2ba5b7,'enterAt':moment()[_0x98c9('0xb3')](_0x98c9('0x103')),'role':_0x2faba5[_0x98c9('0x2e')],'internal':_0x2faba5['internal']};_0x4f6018[_0x98c9('0x104')](function(_0x44b567){_0x1d06e4[_0x98c9('0x4c')](_[_0x98c9('0x60')]({'channel':_0x44b567,'type':_0x98c9('0x105'),'data1':_0x3eccf0['body'][_0x98c9('0x106')],'data2':_0x2ba5b7},_0x1d5996));if(_0x2faba5['loginInPause']){_0x32a0df['push'](_[_0x98c9('0x60')]({'channel':_0x44b567,'type':_0x98c9('0x107'),'data1':_0x98c9('0x108')},_0x1d5996));}});return db[_0x98c9('0x102')]['bulkCreate'](_0x1d06e4[_0x98c9('0xd1')](_0x32a0df),{'individualHooks':!![]});}})[_0x98c9('0x15')](function(){if(_0x2faba5){return _0x2faba5[_0x98c9('0x29')]({'online':!![],'lastLoginAt':moment()[_0x98c9('0xb3')](_0x98c9('0x103')),'voicePause':_0x2faba5[_0x98c9('0xa8')]||![],'mailPause':_0x2faba5[_0x98c9('0xa8')]||![],'chatPause':_0x2faba5[_0x98c9('0xa8')]||![],'faxPause':_0x2faba5[_0x98c9('0xa8')]||![],'smsPause':_0x2faba5[_0x98c9('0xa8')]||![],'openchannelPause':_0x2faba5[_0x98c9('0xa8')]||![],'whatsappPause':_0x2faba5[_0x98c9('0xa8')]||![],'pauseType':_0x2faba5[_0x98c9('0xa8')]?_0x98c9('0x108'):null,'interface':_0x2ba5b7,'lastPauseAt':moment()[_0x98c9('0xb3')](_0x98c9('0x103'))});}})[_0x98c9('0x15')](function(_0x3b12a0){if(_0x3eccf0[_0x98c9('0x109')]){return _0x148762();}else{return Promise[_0x98c9('0x10a')](_0x3b12a0)['then'](respondWithResult(_0x43f9ad,null));}})[_0x98c9('0x1f')](handleError(_0x43f9ad,null));};exports['logout']=function(_0x288535,_0xafdd2f){var _0x33b15e;return db[_0x98c9('0x4d')]['find']({'where':{'id':_0x288535[_0x98c9('0x59')]['id'],'role':_0x98c9('0x85')},'attributes':['id',_0x98c9('0x38'),_0x98c9('0x2e')]})[_0x98c9('0x15')](handleEntityNotFound(_0xafdd2f,null))[_0x98c9('0x15')](function(_0xc8115e){if(_0xc8115e){_0x33b15e=_0xc8115e;return db['UserVoiceQueueRt'][_0x98c9('0x2c')]({'where':{'membername':_0x33b15e[_0x98c9('0x38')]},'individualHooks':!![]});}})[_0x98c9('0x15')](function(){return db['MemberReport'][_0x98c9('0x93')]({'where':{'membername':_0x33b15e[_0x98c9('0x38')],'exitAt':null}});})[_0x98c9('0x15')](function(_0x18aaf7){var _0x42b34e=[];_0x18aaf7[_0x98c9('0x104')](function(_0x153124){_0x42b34e[_0x98c9('0x4c')](_0x153124[_0x98c9('0x29')]({'exitAt':moment()[_0x98c9('0xb3')](_0x98c9('0x103'))}));});return Promise['all'](_0x42b34e);})[_0x98c9('0x15')](function(){return _0x33b15e[_0x98c9('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x98c9('0x15')](respondWithResult(_0xafdd2f,null))[_0x98c9('0x1f')](handleError(_0xafdd2f,null));};exports[_0x98c9('0x10b')]=function(_0x38ad5a,_0x21432f){var _0x4030ba;return db[_0x98c9('0xb5')][_0x98c9('0x29')]({'paused':0x1},{'where':{'UserId':_0x38ad5a[_0x98c9('0x59')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x98c9('0x4d')][_0x98c9('0x37')]({'where':{'id':_0x38ad5a['params']['id'],'role':_0x98c9('0x85')},'attributes':['id',_0x98c9('0x38'),'role',_0x98c9('0x67'),'interface','online']});})['then'](handleEntityNotFound(_0x21432f,null))[_0x98c9('0x15')](function(_0x2d53a2){if(_0x2d53a2){_0x4030ba=_0x2d53a2;return respondWithRpcPromise(_0x98c9('0x10c'),'pause',{'id':_0x4030ba['id'],'name':_0x4030ba[_0x98c9('0x38')],'pause':!![]});}})['then'](function(){if(_0x4030ba){return db[_0x98c9('0x102')][_0x98c9('0x93')]({'where':{'membername':_0x4030ba[_0x98c9('0x38')],'type':_0x98c9('0x107'),'exitAt':null}});}})[_0x98c9('0x15')](function(_0xc7bfc3){if(_0xc7bfc3[_0x98c9('0x4f')]){var _0x55a80b=moment()[_0x98c9('0xb3')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x477854=0x0,_0x1c3a71=_0xc7bfc3[_0x98c9('0x4f')];_0x477854<_0x1c3a71;_0x477854++){_0xc7bfc3[_0x477854][_0x98c9('0x10d')]({'exitAt':_0x55a80b});}}})[_0x98c9('0x15')](function(){var _0x27a91f=[];var _0x5e48ea=utils[_0x98c9('0x10e')]();_0x5e48ea['forEach'](function(_0x52db78){_0x27a91f[_0x98c9('0x4c')]({'channel':_0x52db78,'membername':_0x4030ba[_0x98c9('0x38')],'interface':_['isNil'](_0x4030ba[_0x98c9('0xa9')])?util['format'](_0x98c9('0xb4'),_0x4030ba[_0x98c9('0x38')]):_0x4030ba[_0x98c9('0xa9')],'type':'PAUSE','enterAt':moment()[_0x98c9('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x38ad5a[_0x98c9('0x62')][_0x98c9('0x3f')]||_0x98c9('0x10f'),'role':_0x4030ba[_0x98c9('0x2e')],'internal':_0x4030ba['internal']});});return db[_0x98c9('0x102')][_0x98c9('0x8e')](_0x27a91f,{'individualHooks':!![]});})[_0x98c9('0x15')](function(){return _0x4030ba[_0x98c9('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x38ad5a[_0x98c9('0x62')]['type']||_0x98c9('0x10f'),'lastPauseAt':moment()[_0x98c9('0xb3')](_0x98c9('0x103'))});})[_0x98c9('0x15')](respondWithResult(_0x21432f,null))['catch'](handleError(_0x21432f,null));};exports[_0x98c9('0x110')]=function(_0x2c5030,_0xa09879){if(_0x2c5030[_0x98c9('0x62')]['channel']&&!utils['isValidChannel'](_0x2c5030[_0x98c9('0x62')][_0x98c9('0xa6')])){throw new APIBadRequestError(util[_0x98c9('0xb3')](_0x98c9('0x111'),_0x2c5030['body']['channel']));}return db[_0x98c9('0x4d')][_0x98c9('0x37')]({'where':{'id':_0x2c5030[_0x98c9('0x59')]['id']},'attributes':['id',_0x98c9('0x38'),_0x98c9('0x2e'),'internal','interface','online',_0x98c9('0x112'),'mailPause',_0x98c9('0x113'),_0x98c9('0x114'),'openchannelPause',_0x98c9('0x115'),_0x98c9('0x116'),_0x98c9('0x117'),'lastPauseAt']})['then'](function(_0x58ff36){if(!_0x58ff36){throw new APINotFoundError(util['format'](_0x98c9('0x118'),_0x2c5030[_0x98c9('0x59')]['id']));}return _0x58ff36['unpause'](_0x2c5030[_0x98c9('0x62')][_0x98c9('0xa6')]);})[_0x98c9('0x15')](respondWithResult(_0xa09879,null))['catch'](APIHandleError(_0xa09879));};exports[_0x98c9('0x119')]=function(_0x57fa26,_0x1b961a){var _0x5ea2bd={};var _0x52637e={};var _0x1631d5;var _0x1d9173;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x57fa26[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x1b961a,null))[_0x98c9('0x15')](function(_0x1b0fcb){if(_0x1b0fcb){_0x1631d5=_0x1b0fcb;_0x52637e[_0x98c9('0x5e')]=_['keys'](db[_0x98c9('0x11a')][_0x98c9('0x3d')]);_0x52637e[_0x98c9('0x47')]=_[_0x98c9('0x5b')](_0x57fa26['query']);_0x52637e[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x52637e[_0x98c9('0x5e')],_0x52637e[_0x98c9('0x47')]);_0x5ea2bd[_0x98c9('0x4b')]=_['intersection'](_0x52637e['model'],qs[_0x98c9('0x5f')](_0x57fa26[_0x98c9('0x47')]['fields']));_0x5ea2bd['attributes']=_0x5ea2bd[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x5ea2bd[_0x98c9('0x4b')]:_0x52637e[_0x98c9('0x5e')];_0x5ea2bd[_0x98c9('0xdd')]=qs['sort'](_0x57fa26[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x5ea2bd[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x57fa26[_0x98c9('0x47')],_0x52637e[_0x98c9('0x5c')]));if(_0x57fa26[_0x98c9('0x47')]['filter']){_0x5ea2bd[_0x98c9('0x44')]=_[_0x98c9('0x60')](_0x5ea2bd[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x5ea2bd[_0x98c9('0x4b')],function(_0x421b42){var _0x25ed1d={};_0x25ed1d[_0x421b42]={'$like':'%'+_0x57fa26[_0x98c9('0x47')]['filter']+'%'};return _0x25ed1d;})});}_0x5ea2bd=_['merge']({},_0x5ea2bd,_0x57fa26[_0x98c9('0x61')]);return _0x1631d5[_0x98c9('0x119')](_0x5ea2bd);}})[_0x98c9('0x15')](function(_0x1514c8){if(_0x1514c8){_0x1d9173=_0x1514c8['length'];if(!_0x57fa26['query'][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x5ea2bd[_0x98c9('0x26')]=qs[_0x98c9('0x26')](_0x57fa26[_0x98c9('0x47')]['limit']);_0x5ea2bd[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x57fa26[_0x98c9('0x47')][_0x98c9('0x23')]);}return _0x1631d5[_0x98c9('0x119')](_0x5ea2bd);}})[_0x98c9('0x15')](function(_0x5bf81e){if(_0x5bf81e){return _0x5bf81e?{'count':_0x1d9173,'rows':_0x5bf81e}:null;}})[_0x98c9('0x15')](respondWithResult(_0x1b961a,null))['catch'](handleError(_0x1b961a,null));};exports['addTeams']=function(_0x270cea,_0x1b10e2){var _0x1df19d=_0x270cea[_0x98c9('0x59')]['id'];var _0x476594=_0x270cea[_0x98c9('0x62')]?_0x270cea['body'][_0x98c9('0x65')]:null;var _0x7d0878=[];return Promise[_0x98c9('0x10a')]()[_0x98c9('0x15')](function(){if(!_0x476594)throw new APIBadRequestError(_0x98c9('0x11b'));})[_0x98c9('0x15')](function(){return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x1df19d}});})['then'](function(_0x199d83){if(!_0x199d83)throw new APINotFoundError(util[_0x98c9('0xb3')](_0x98c9('0x118'),_0x270cea[_0x98c9('0x59')]['id']));return db[_0x98c9('0x6e')]['transaction'](function(_0x15541a){return _0x199d83[_0x98c9('0x11c')](_0x476594,{'transaction':_0x15541a})[_0x98c9('0x15')](function(){return db['Team'][_0x98c9('0x93')]({'where':{'id':{'$in':_0x476594}}});})[_0x98c9('0x15')](function(_0x1a7b2a){var _0x451117=_['map'](_0x1a7b2a,function(_0x1861c7){return _0x1861c7[_0x98c9('0x11d')]();});return Promise[_0x98c9('0x57')](_0x451117);})['then'](function(_0x55d1fe){_0x7d0878=_[_0x98c9('0x11e')](_0x55d1fe);var _0x5ca8d7=_['map'](_0x7d0878,function(_0xd756a6){return _0xd756a6[_0x98c9('0x11f')](_0x199d83['id'],{'transaction':_0x15541a});});return Promise[_0x98c9('0x57')](_0x5ca8d7);})[_0x98c9('0x15')](function(){if(!_0x199d83['online'])return;var _0x296c53=_['filter'](_0x7d0878,function(_0x594ce3){return _0x594ce3['getDataValue'](_0x98c9('0xa6'))===_0x98c9('0x120');});var _0x59cb87=_[_0x98c9('0x35')](_0x296c53,function(_0x20b075){return db[_0x98c9('0xb5')][_0x98c9('0x101')]({'membername':_0x199d83['name'],'UserId':_0x199d83['id'],'queue_name':_0x20b075[_0x98c9('0x38')],'VoiceQueueId':_0x20b075['id'],'interface':_['isNil'](_0x199d83['interface'])?util[_0x98c9('0xb3')](_0x98c9('0xb4'),_0x199d83[_0x98c9('0x38')]):_0x199d83[_0x98c9('0xa9')],'paused':_0x199d83['voicePause']||![],'penalty':_0x199d83['penalty']},{'transaction':_0x15541a});});return Promise[_0x98c9('0x57')](_0x59cb87);})[_0x98c9('0x15')](function(){return db[_0x98c9('0x121')][_0x98c9('0x93')]({'where':{'teamId':{'$in':_0x476594}}});})[_0x98c9('0x15')](function(_0x2f0471){var _0x4dea30=_[_0x98c9('0x35')](_0x2f0471,function(_0xc2a3e8){return db[_0x98c9('0x122')]['create']({'UserId':_0x199d83['id'],'VoicePrefixId':_0xc2a3e8['VoicePrefixId']},{'transaction':_0x15541a});});return Promise[_0x98c9('0x57')](_0x4dea30);});});})[_0x98c9('0x15')](function(){for(var _0x2e6437=0x0;_0x2e6437<_0x7d0878['length'];_0x2e6437++){var _0x5922b1=_0x7d0878[_0x2e6437]['getDataValue'](_0x98c9('0xa6'));var _0xfa70d7=_0x5922b1+_0x98c9('0xb0');socket[_0x98c9('0x2a')]('user'+_0x5922b1+_0x98c9('0x123'),{'UserId':_0x1df19d,['queueField']:_0x7d0878[_0x2e6437]['id']});}})['then'](respondWithStatusCode(_0x1b10e2,null))[_0x98c9('0x1f')](APIHandleError(_0x1b10e2));};exports[_0x98c9('0x124')]=function(_0x16ce8a,_0x6e4c3d){var _0x4a9c19=_0x16ce8a[_0x98c9('0x59')]['id'];var _0x4e18ae=null;if(_0x16ce8a['query'][_0x98c9('0x65')]){_0x4e18ae=_[_0x98c9('0x125')](_0x16ce8a['query']['ids'])?_0x16ce8a[_0x98c9('0x47')]['ids']:[_0x16ce8a[_0x98c9('0x47')][_0x98c9('0x65')]];}var _0x665ff9=[];return Promise[_0x98c9('0x10a')]()[_0x98c9('0x15')](function(){if(!_0x4e18ae)throw new APIBadRequestError(_0x98c9('0x126'));})['then'](function(){return db[_0x98c9('0x4d')]['findOne']({'where':{'id':_0x4a9c19}});})[_0x98c9('0x15')](function(_0x5b1a92){if(!_0x5b1a92)throw new APINotFoundError(util[_0x98c9('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x16ce8a[_0x98c9('0x59')]['id']));return db[_0x98c9('0x6e')]['transaction'](function(_0x36541e){return _0x5b1a92[_0x98c9('0x124')](_0x4e18ae,{'transaction':_0x36541e})['then'](function(){return db[_0x98c9('0x11a')]['findAll']({'where':{'id':{'$in':_0x4e18ae}}});})[_0x98c9('0x15')](function(_0x2a920b){var _0x41f1c8=_[_0x98c9('0x35')](_0x2a920b,function(_0xcb3648){return _0xcb3648[_0x98c9('0x11d')]();});return Promise[_0x98c9('0x57')](_0x41f1c8);})[_0x98c9('0x15')](function(_0xf87ef5){_0x665ff9=_[_0x98c9('0x11e')](_0xf87ef5);var _0x50fddf=_[_0x98c9('0x35')](_0x665ff9,function(_0x50d51b){return _0x50d51b['removeAgent'](_0x5b1a92['id'],{'transaction':_0x36541e});});return Promise[_0x98c9('0x57')](_0x50fddf);})[_0x98c9('0x15')](function(){if(!_0x5b1a92[_0x98c9('0xa7')])return;var _0xcb9468=_[_0x98c9('0x33')](_0x665ff9,function(_0x4f10c5){return _0x4f10c5[_0x98c9('0x127')](_0x98c9('0xa6'))===_0x98c9('0x120');});var _0x2f6415=_[_0x98c9('0x35')](_0xcb9468,function(_0x1ae141){return db['UserVoiceQueueRt'][_0x98c9('0x2c')]({'where':{'VoiceQueueId':_0x1ae141['id'],'UserId':_0x5b1a92['id']},'transaction':_0x36541e});});return Promise['all'](_0x2f6415);})[_0x98c9('0x15')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x4e18ae}}});})[_0x98c9('0x15')](function(_0x584680){var _0xbe3b80=_[_0x98c9('0x35')](_0x584680,function(_0x18dc03){return db['UserVoicePrefix'][_0x98c9('0x2c')]({'where':{'UserId':_0x5b1a92['id'],'VoicePrefixId':_0x18dc03[_0x98c9('0x128')]}},{'transaction':_0x36541e});});return Promise[_0x98c9('0x57')](_0xbe3b80);});});})[_0x98c9('0x15')](function(){for(var _0x56dea0=0x0;_0x56dea0<_0x665ff9[_0x98c9('0x4f')];_0x56dea0++){var _0x1c199c=_0x665ff9[_0x56dea0][_0x98c9('0x127')](_0x98c9('0xa6'));var _0x10e3f2=_0x1c199c+_0x98c9('0xb0');socket[_0x98c9('0x2a')](_0x98c9('0x2f')+_0x1c199c+_0x98c9('0xb8'),{'UserId':_0x4a9c19,['queueField']:_0x665ff9[_0x56dea0]['id']});}})['then'](respondWithStatusCode(_0x6e4c3d,null))[_0x98c9('0x1f')](APIHandleError(_0x6e4c3d));};exports[_0x98c9('0x129')]=function(_0x5888f8,_0x1eac76){var _0x319e7d={};var _0x28a156={};var _0x4b2387;var _0x3cd478;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x5888f8[_0x98c9('0x59')]['id']}})['then'](handleEntityNotFound(_0x1eac76,null))['then'](function(_0x4ab4f5){if(_0x4ab4f5){_0x4b2387=_0x4ab4f5;_0x28a156[_0x98c9('0x5e')]=_[_0x98c9('0x5b')](db[_0x98c9('0xd7')][_0x98c9('0x3d')]);_0x28a156[_0x98c9('0x47')]=_['keys'](_0x5888f8[_0x98c9('0x47')]);_0x28a156[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x28a156['model'],_0x28a156['query']);_0x319e7d['attributes']=_[_0x98c9('0x5d')](_0x28a156[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x5888f8[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x319e7d[_0x98c9('0x4b')]=_0x319e7d[_0x98c9('0x4b')]['length']?_0x319e7d[_0x98c9('0x4b')]:_0x28a156['model'];_0x319e7d[_0x98c9('0xdd')]=qs['sort'](_0x5888f8[_0x98c9('0x47')][_0x98c9('0xd4')]);_0x319e7d[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x5888f8['query'],_0x28a156[_0x98c9('0x5c')]));if(_0x5888f8[_0x98c9('0x47')][_0x98c9('0x33')]){_0x319e7d['where']=_[_0x98c9('0x60')](_0x319e7d['where'],{'$or':_['map'](_0x319e7d['attributes'],function(_0x49c7d3){var _0x2addaf={};_0x2addaf[_0x49c7d3]={'$like':'%'+_0x5888f8['query'][_0x98c9('0x33')]+'%'};return _0x2addaf;})});}_0x319e7d=_[_0x98c9('0x60')]({},_0x319e7d,_0x5888f8[_0x98c9('0x61')]);return _0x4b2387['getLists'](_0x319e7d);}})[_0x98c9('0x15')](function(_0x2afb68){if(_0x2afb68){_0x3cd478=_0x2afb68[_0x98c9('0x4f')];if(!_0x5888f8[_0x98c9('0x47')][_0x98c9('0xd6')](_0x98c9('0xdb'))){_0x319e7d['limit']=qs[_0x98c9('0x26')](_0x5888f8['query']['limit']);_0x319e7d[_0x98c9('0x23')]=qs[_0x98c9('0x23')](_0x5888f8[_0x98c9('0x47')]['offset']);}return _0x4b2387[_0x98c9('0x129')](_0x319e7d);}})['then'](function(_0x436d9f){if(_0x436d9f){return _0x436d9f?{'count':_0x3cd478,'rows':_0x436d9f}:null;}})[_0x98c9('0x15')](respondWithResult(_0x1eac76,null))[_0x98c9('0x1f')](handleError(_0x1eac76,null));};exports[_0x98c9('0x12a')]=function(_0x5ddfba,_0x135186){var _0x2e4390={};var _0x87093c={};var _0x2e90c3;return db[_0x98c9('0x4d')][_0x98c9('0x9f')]({'where':{'id':_0x5ddfba[_0x98c9('0x59')]['id']}})[_0x98c9('0x15')](handleEntityNotFound(_0x135186,null))[_0x98c9('0x15')](function(_0x43e564){if(_0x43e564){_0x2e90c3=_0x43e564;_0x87093c['model']=_[_0x98c9('0x5b')](db[_0x98c9('0x4d')][_0x98c9('0x3d')]);_0x87093c['query']=_['keys'](_0x5ddfba[_0x98c9('0x47')]);_0x87093c[_0x98c9('0x5c')]=_[_0x98c9('0x5d')](_0x87093c['model'],_0x87093c[_0x98c9('0x47')]);_0x2e4390[_0x98c9('0x4b')]=_['intersection'](_0x87093c[_0x98c9('0x5e')],qs[_0x98c9('0x5f')](_0x5ddfba[_0x98c9('0x47')][_0x98c9('0x5f')]));_0x2e4390[_0x98c9('0x4b')]=_0x2e4390[_0x98c9('0x4b')][_0x98c9('0x4f')]?_0x2e4390[_0x98c9('0x4b')]:_0x87093c[_0x98c9('0x5e')];_0x2e4390[_0x98c9('0xdd')]=qs[_0x98c9('0xd4')](_0x5ddfba['query'][_0x98c9('0xd4')]);_0x2e4390[_0x98c9('0x44')]=qs[_0x98c9('0x5c')](_[_0x98c9('0xd5')](_0x5ddfba[_0x98c9('0x47')],_0x87093c[_0x98c9('0x5c')]));if(_0x5ddfba[_0x98c9('0x47')][_0x98c9('0x33')]){_0x2e4390['where']=_[_0x98c9('0x60')](_0x2e4390[_0x98c9('0x44')],{'$or':_[_0x98c9('0x35')](_0x2e4390['attributes'],function(_0x245926){var _0x4d9840={};_0x4d9840[_0x245926]={'$like':'%'+_0x5ddfba[_0x98c9('0x47')][_0x98c9('0x33')]+'%'};return _0x4d9840;})});}_0x2e4390[_0x98c9('0x5e')]=db[_0x98c9('0x4d')];_0x2e4390['as']=_0x98c9('0x30');_0x2e4390=_[_0x98c9('0x60')]({},_0x2e4390,_0x5ddfba['options']);return _0x2e90c3[_0x98c9('0xff')]({'include':[_0x2e4390]});}})[_0x98c9('0x15')](function(_0x260bf2){if(_0x260bf2){var _0x5b5640={},_0x5cebe7=[];for(var _0x51e6a9=0x0;_0x51e6a9<_0x260bf2['length'];_0x51e6a9+=0x1){for(var _0x1f5a9a=0x0,_0x22bdcd;_0x1f5a9a<_0x260bf2[_0x51e6a9][_0x98c9('0x30')][_0x98c9('0x4f')];_0x1f5a9a+=0x1){_0x22bdcd=_0x260bf2[_0x51e6a9][_0x98c9('0x30')][_0x1f5a9a][_0x98c9('0x2d')]({'plain':!![]});_0x5b5640[_0x22bdcd['id']]=_0x22bdcd;}}_0x5b5640=_[_0x98c9('0x12b')](_0x5b5640);for(var _0x3ad643=qs['offset'](_0x5ddfba[_0x98c9('0x47')][_0x98c9('0x23')]);_0x3ad643<_0x5b5640[_0x98c9('0x4f')]&&_0x5cebe7[_0x98c9('0x4f')]=_0x56b4be){_0x4364fc=_0x56b4be;_0x27ef57=0xc8;}else{_0x27ef57=0xce;}_0x1ef8df[_0x27ea('0x23')](_0x27ef57);return _0x1ef8df['set'](_0x27ea('0x28'),_0x3cf1e7+'-'+_0x4364fc+'/'+_0x56b4be)[_0x27ea('0x29')](_0x2e2c1f);}return null;};}function saveUpdates(_0x211090){return function(_0x3013ba){if(_0x3013ba){return _0x3013ba[_0x27ea('0x2a')](_0x211090)[_0x27ea('0x16')](function(_0x5ee221){socket[_0x27ea('0x2b')]('userNotification:recalc:'+_0x5ee221['id'],{});return _0x5ee221;});}return null;};}function removeEntity(_0x4f7ed3){return function(_0x31746c){if(_0x31746c){return _0x31746c[_0x27ea('0x2c')]()[_0x27ea('0x16')](function(){var _0x1d0662=_0x31746c[_0x27ea('0x2d')]({'plain':!![]});if(_0x1d0662['role']==='admin')return;var _0x15e1ce=[{'name':_0x27ea('0x2e'),'value':_0x27ea('0x2f'),'ignore':!![]},{'name':_0x27ea('0x30'),'value':_0x27ea('0x31'),'ignore':![]},{'name':_0x27ea('0x32'),'value':'telephone','ignore':![]}];var _0x528ab0=_(_0x15e1ce)[_0x27ea('0x33')](_0x27ea('0x34'))[_0x27ea('0x35')](_0x27ea('0x36'))[_0x27ea('0x36')]();if(_[_0x27ea('0x37')](_0x528ab0,_0x1d0662[_0x27ea('0x38')])){return;}var _0x4f0638=_[_0x27ea('0x39')](_0x15e1ce,[_0x27ea('0x36'),_0x1d0662[_0x27ea('0x38')]])[_0x27ea('0x3a')];return db[_0x27ea('0x3b')][_0x27ea('0x2c')]({'where':{'type':_0x4f0638,'resourceId':_0x1d0662['id']}})['then'](function(){return _0x31746c;});})['then'](function(){_0x4f7ed3['status'](0xcc)[_0x27ea('0x24')]();});}};}function handleEntityNotFound(_0x2ab5a0){return function(_0x5c947a){if(!_0x5c947a){_0x2ab5a0[_0x27ea('0x22')](0x194);}return _0x5c947a;};}function handleError(_0x1357a7,_0x40ff5f){_0x40ff5f=_0x40ff5f||0x1f4;return function(_0x2d09de){logger['error'](_0x2d09de[_0x27ea('0x3c')]);if(_0x2d09de[_0x27ea('0x3a')]){delete _0x2d09de['name'];}_0x1357a7[_0x27ea('0x23')](_0x40ff5f)['send'](_0x2d09de);};}exports[_0x27ea('0x3d')]=function(_0x95eaf1,_0x275d87){var _0x5e85e0={},_0x4c1e2f={'count':0x0,'rows':[]};var _0x2f60cd=_(db['User']['rawAttributes'])[_0x27ea('0x35')](function(_0x2d0a19){return{'name':_0x2d0a19[_0x27ea('0x3e')],'type':_0x2d0a19[_0x27ea('0x3f')][_0x27ea('0x40')]};})[_0x27ea('0x33')](function(_0x4b93fd){return!_[_0x27ea('0x37')]([_0x27ea('0x41'),_0x27ea('0x42')],_0x4b93fd[_0x27ea('0x3a')]);})[_0x27ea('0x36')]();_0x5e85e0=qs['getOptions'](_0x2f60cd,_0x95eaf1);var _0x11f021={'where':_0x5e85e0[_0x27ea('0x43')]};return db[_0x27ea('0x44')][_0x27ea('0x45')](_0x11f021)[_0x27ea('0x16')](function(_0x12abd8){_0x4c1e2f['count']=_0x12abd8;if(_0x95eaf1[_0x27ea('0x46')][_0x27ea('0x47')]){_0x5e85e0['include']=[{'all':!![]}];}if(_0x95eaf1[_0x27ea('0x46')]['userSetting']===_0x27ea('0x48')){_0x5e85e0[_0x27ea('0x49')]=[{'model':db[_0x27ea('0x4a')],'as':'userSetting'}];}if(!_['includes'](_0x5e85e0[_0x27ea('0x4b')],'id')){_0x5e85e0[_0x27ea('0x4b')][_0x27ea('0x4c')]('id');}return db['User'][_0x27ea('0x4d')](_0x5e85e0);})[_0x27ea('0x16')](function(_0x9421e6){_0x4c1e2f[_0x27ea('0x4e')]=_0x9421e6;if(_0x95eaf1['query'][_0x27ea('0x4f')]==='true'){var _0x1aef62=[];for(var _0x36aef3=0x0;_0x36aef3<_0x4c1e2f[_0x27ea('0x4e')][_0x27ea('0x50')];_0x36aef3++){_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x51'),_0x4c1e2f[_0x27ea('0x4e')][_0x36aef3]['dataValues']));_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x52'),_0x4c1e2f['rows'][_0x36aef3]['dataValues']));_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x53'),_0x4c1e2f[_0x27ea('0x4e')][_0x36aef3][_0x27ea('0x54')]));_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x55'),_0x4c1e2f[_0x27ea('0x4e')][_0x36aef3]['dataValues']));_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x56'),_0x4c1e2f[_0x27ea('0x4e')][_0x36aef3]['dataValues']));_0x1aef62[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x57'),_0x4c1e2f[_0x27ea('0x4e')][_0x36aef3][_0x27ea('0x54')]));}return Promise[_0x27ea('0x58')](_0x1aef62)[_0x27ea('0x16')](function(){return _0x4c1e2f;});}else{return _0x4c1e2f;}})['then'](respondWithFilteredResult(_0x275d87,_0x5e85e0))['catch'](handleError(_0x275d87,null));};exports[_0x27ea('0x59')]=function(_0x1b7d3f,_0xe82dce){var _0x6d750b={'raw':![],'where':{'id':_0x1b7d3f['params']['id']}},_0x56526f={};_0x56526f[_0x27ea('0x5a')]=_[_0x27ea('0x5b')](_[_0x27ea('0x5c')](db[_0x27ea('0x44')]['rawAttributes']),[_0x27ea('0x41'),'salt']);_0x56526f['query']=_[_0x27ea('0x5c')](_0x1b7d3f[_0x27ea('0x46')]);_0x56526f[_0x27ea('0x5d')]=_['intersection'](_0x56526f[_0x27ea('0x5a')],_0x56526f[_0x27ea('0x46')]);_0x6d750b[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x56526f[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x1b7d3f[_0x27ea('0x46')][_0x27ea('0x5f')]));_0x6d750b[_0x27ea('0x4b')]=_0x6d750b[_0x27ea('0x4b')]['length']?_0x6d750b['attributes']:_0x56526f[_0x27ea('0x5a')];if(_0x1b7d3f['query'][_0x27ea('0x47')]){_0x6d750b[_0x27ea('0x49')]=[{'all':!![]}];}if(_0x1b7d3f[_0x27ea('0x46')][_0x27ea('0x60')]===_0x27ea('0x48')){_0x6d750b[_0x27ea('0x49')]=[{'model':db[_0x27ea('0x4a')],'as':_0x27ea('0x60')}];}_0x6d750b=_[_0x27ea('0x61')]({},_0x6d750b,_0x1b7d3f[_0x27ea('0x62')]);if(!_[_0x27ea('0x37')](_0x6d750b[_0x27ea('0x4b')],'id')){_0x6d750b['attributes']['push']('id');}return db['User'][_0x27ea('0x39')](_0x6d750b)[_0x27ea('0x16')](handleEntityNotFound(_0xe82dce,null))[_0x27ea('0x16')](function(_0x17aa9f){var _0x317d0a=[];values=_0x17aa9f;if(_0x1b7d3f['query'][_0x27ea('0x4f')]===_0x27ea('0x48')){_0x317d0a['push'](get_open_tabs(_0x27ea('0x51'),_0x17aa9f['dataValues']));_0x317d0a[_0x27ea('0x4c')](get_open_tabs('sms',_0x17aa9f[_0x27ea('0x54')]));_0x317d0a[_0x27ea('0x4c')](get_open_tabs('openchannel',_0x17aa9f[_0x27ea('0x54')]));_0x317d0a[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x57'),_0x17aa9f['dataValues']));_0x317d0a[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x53'),_0x17aa9f[_0x27ea('0x54')]));_0x317d0a[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x55'),_0x17aa9f[_0x27ea('0x54')]));return Promise[_0x27ea('0x58')](_0x317d0a);}else{return values;}})[_0x27ea('0x16')](function(){return values;})[_0x27ea('0x16')](respondWithResult(_0xe82dce,null))[_0x27ea('0x21')](handleError(_0xe82dce,null));};exports[_0x27ea('0x2a')]=function(_0x4e9dfb,_0x4c7514){if(_0x4e9dfb['body']['id']){delete _0x4e9dfb['body']['id'];}delete _0x4e9dfb[_0x27ea('0x63')]['role'];return db['User'][_0x27ea('0x39')]({'where':{'id':_0x4e9dfb['params']['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x4c7514,null))[_0x27ea('0x16')](saveUpdates(_0x4e9dfb[_0x27ea('0x63')],null))['then'](respondWithResult(_0x4c7514,null))[_0x27ea('0x21')](handleError(_0x4c7514,null));};exports['describe']=function(_0x3ba1bc,_0x5808cf){return db[_0x27ea('0x44')]['describe']()[_0x27ea('0x16')](respondWithResult(_0x5808cf,null))['catch'](handleError(_0x5808cf,null));};exports[_0x27ea('0x64')]=function(_0x3ba139,_0x5716d7){return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x3ba139[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x5716d7,null))['then'](function(_0x47ef52){if(_0x47ef52){return _0x47ef52['addContacts'](_0x3ba139[_0x27ea('0x63')][_0x27ea('0x66')],_['omit'](_0x3ba139[_0x27ea('0x63')],[_0x27ea('0x66'),'id'])||{});}})[_0x27ea('0x16')](respondWithResult(_0x5716d7,null))[_0x27ea('0x21')](handleError(_0x5716d7,null));};function validateUser(_0x3b4e0c){return new Promise(function(_0x4230e4,_0x57f886){if(_0x3b4e0c[_0x27ea('0x67')])return _0x4230e4(_0x3b4e0c);return db[_0x27ea('0x68')]['findById'](0x1)[_0x27ea('0x16')](function(_0xbf8a86){if(_0xbf8a86[_0x27ea('0x69')])authService[_0x27ea('0x6a')](_0x3b4e0c[_0x27ea('0x41')]);db['User'][_0x27ea('0x6b')](_0x27ea('0x67'))['then'](function(_0x49613e){if(_['isNil'](_0x49613e)){_0x3b4e0c[_0x27ea('0x67')]=_0xbf8a86[_0x27ea('0x6c')]||0x1;return;}if(_[_0x27ea('0x6d')](_0xbf8a86[_0x27ea('0x6c')])||_0xbf8a86[_0x27ea('0x6c')]===_0x49613e){_0x3b4e0c[_0x27ea('0x67')]=_0x49613e+0x1;return;}if(_0xbf8a86[_0x27ea('0x6c')]>_0x49613e){_0x3b4e0c[_0x27ea('0x67')]=_0xbf8a86[_0x27ea('0x6c')];return;}return db[_0x27ea('0x6e')][_0x27ea('0x46')](_0x27ea('0x6f'),{'type':db[_0x27ea('0x6e')][_0x27ea('0x70')][_0x27ea('0x71')]})[_0x27ea('0x16')](function(_0x3087ee){if(_0x3087ee&&_0x3087ee[_0x27ea('0x50')]){for(var _0x11eb67=0x0,_0x6d44b9=_0x3087ee[_0x27ea('0x50')];_0x11eb67<_0x6d44b9&&_[_0x27ea('0x6d')](_0x3b4e0c['internal']);_0x11eb67++){if(_0xbf8a86[_0x27ea('0x6c')]<=_0x3087ee[_0x11eb67]['from']){_0x3b4e0c['internal']=_0x3087ee[_0x11eb67][_0x27ea('0x72')];}else if(_0xbf8a86[_0x27ea('0x6c')]>_0x3087ee[_0x11eb67]['from']&&_0xbf8a86[_0x27ea('0x6c')]<=_0x3087ee[_0x11eb67]['to']){_0x3b4e0c[_0x27ea('0x67')]=_0xbf8a86['min_internal'];}}}if(_[_0x27ea('0x6d')](_0x3b4e0c[_0x27ea('0x67')])){_0x3b4e0c['internal']=_0x49613e+0x1;}return _0x4230e4(_0x3b4e0c);});});})['catch'](function(_0x3df1cd){_0x57f886(_0x3df1cd);});});}function updateUser(_0x404bb9){return new Promise(function(_0x3085ad,_0x105dfc){try{if(_0x404bb9[_0x27ea('0x73')]){_0x404bb9[_0x27ea('0x74')]=_0x404bb9[_0x27ea('0x67')];_0x404bb9[_0x27ea('0x75')]={'mailbox':_0x404bb9['internal'],'password':_0x404bb9[_0x27ea('0x41')],'fullname':_0x404bb9['fullname'],'email':_0x404bb9[_0x27ea('0x76')]};}if(_0x404bb9[_0x27ea('0x38')]==='agent'){if(!_0x404bb9[_0x27ea('0x77')])_0x404bb9['permissions']=[_0x27ea('0x78'),_0x27ea('0x79'),'103',_0x27ea('0x7a'),'110',_0x27ea('0x7b'),_0x27ea('0x7c'),_0x27ea('0x7d'),_0x27ea('0x7e'),_0x27ea('0x7f'),_0x27ea('0x80'),'100',_0x27ea('0x81'),_0x27ea('0x82'),_0x27ea('0x83')];}_0x3085ad(_0x404bb9);}catch(_0x55b04c){_0x105dfc(_0x55b04c);}});}exports['create']=function(_0x37b903,_0x382a06){if(_0x37b903[_0x27ea('0x2f')]['role']===_0x27ea('0x31'))throw new Error(_0x27ea('0x84'));if(_0x37b903[_0x27ea('0x63')]['role']==='user'&&_0x37b903[_0x27ea('0x2f')][_0x27ea('0x38')]!=='admin'){throw new Error(_0x27ea('0x85'));}if(_0x37b903['body']['role']==='admin'&&_0x37b903[_0x27ea('0x2f')][_0x27ea('0x38')]!==_0x27ea('0x86')){throw new Error(_0x27ea('0x87'));}return licenseUtil[_0x27ea('0x88')]([_0x37b903['body']])[_0x27ea('0x16')](function(){return validateUser(_0x37b903['body']);})[_0x27ea('0x16')](function(_0x591ef2){return updateUser(_0x591ef2)[_0x27ea('0x16')](function(_0x4c27c1){if(_0x4c27c1[_0x27ea('0x38')]===_0x27ea('0x86')){_0x4c27c1[_0x27ea('0x89')]=_0x37b903[_0x27ea('0x2f')][_0x27ea('0x89')];delete _0x4c27c1[_0x27ea('0x8a')];}return _0x4c27c1;});})['then'](function(_0x4a3a95){return db[_0x27ea('0x44')][_0x27ea('0x8b')](_0x4a3a95,{'include':[{'model':db[_0x27ea('0x75')],'as':_0x27ea('0x75')}]});})[_0x27ea('0x16')](function(_0x236000){if(_0x37b903['body']['role']===_0x27ea('0x2f'))return _0x236000;if(_0x37b903['user'][_0x27ea('0x38')]!==_0x27ea('0x2f'))return _0x236000;return db['UserProfileSection'][_0x27ea('0x39')]({'where':{'name':_0x236000[_0x27ea('0x38')]==='agent'?_0x27ea('0x30'):_0x27ea('0x32'),'userProfileId':_0x37b903[_0x27ea('0x2f')][_0x27ea('0x8a')]},'raw':!![]})[_0x27ea('0x16')](function(_0x1ac4a4){if(!_0x1ac4a4||_0x1ac4a4[_0x27ea('0x8c')]!=0x0)return _0x236000;return db['UserProfileResource'][_0x27ea('0x8b')]({'name':_0x236000['name'],'resourceId':_0x236000['id'],'type':_0x1ac4a4[_0x27ea('0x3a')],'sectionId':_0x1ac4a4['id']},{})[_0x27ea('0x16')](function(){return _0x236000;});})[_0x27ea('0x21')](function(_0x3fc5ed){logger[_0x27ea('0x1c')](_0x27ea('0x8d'),_0x3fc5ed);throw _0x3fc5ed;});})[_0x27ea('0x16')](respondWithResult(_0x382a06,0xc9))[_0x27ea('0x21')](handleError(_0x382a06,null));};exports[_0x27ea('0x8e')]=function(_0x16b1ae,_0x462a30){var _0x4d52ad=_0x16b1ae['body'];var _0x54e152=[];if(_0x16b1ae[_0x27ea('0x2f')][_0x27ea('0x38')]===_0x27ea('0x31'))throw new Error('Unauthorized');if(_[_0x27ea('0x8f')](_0x4d52ad,[_0x27ea('0x38'),'user'])&&_0x16b1ae[_0x27ea('0x2f')][_0x27ea('0x38')]!==_0x27ea('0x86')){throw new Error(_0x27ea('0x85'));}if(_[_0x27ea('0x8f')](_0x4d52ad,['role',_0x27ea('0x86')])&&_0x16b1ae[_0x27ea('0x2f')][_0x27ea('0x38')]!=='admin'){throw new Error(_0x27ea('0x90'));}return licenseUtil[_0x27ea('0x88')](_0x4d52ad)[_0x27ea('0x16')](function(){return validateUser(_0x4d52ad[0x0]);})[_0x27ea('0x16')](function(){for(var _0x4152e1=0x1;_0x4152e1<_0x4d52ad[_0x27ea('0x50')];_0x4152e1++){var _0xaac1bd=_0x4d52ad[_0x4152e1-0x1][_0x27ea('0x67')];if(!_0x4d52ad[_0x4152e1][_0x27ea('0x67')])_0x4d52ad[_0x4152e1][_0x27ea('0x67')]=_0xaac1bd+0x1;_0x54e152[_0x27ea('0x4c')](validateUser(_0x4d52ad[_0x4152e1]));}return Promise[_0x27ea('0x58')](_0x54e152);})[_0x27ea('0x16')](function(){_0x54e152=[];for(var _0x3dd842=0x0;_0x3dd842<_0x4d52ad['length'];_0x3dd842++){_0x54e152['push'](updateUser(_0x4d52ad[_0x3dd842]));}return Promise['all'](_0x54e152);})[_0x27ea('0x16')](function(){_0x54e152=_0x4d52ad[_0x27ea('0x35')](function(_0x47475a){return db[_0x27ea('0x44')][_0x27ea('0x8b')](_0x47475a,{'include':[{'model':db['VoiceMail'],'as':_0x27ea('0x75')}]})[_0x27ea('0x16')](function(_0x3e4538){_0x47475a['id']=_0x3e4538['id'];return _0x47475a;});});return Promise[_0x27ea('0x58')](_0x54e152);})[_0x27ea('0x16')](function(_0x38114d){if(_0x16b1ae['body']['role']===_0x27ea('0x2f'))return _0x38114d;if(_0x16b1ae[_0x27ea('0x2f')]['role']!==_0x27ea('0x2f'))return _0x38114d;var _0x5a667b=_[_0x27ea('0x8f')](_0x38114d,function(_0x2ff962){return _0x2ff962[_0x27ea('0x38')]==='agent'||_0x2ff962[_0x27ea('0x38')]===_0x27ea('0x91');});if(!_0x5a667b)return _0x38114d;return db[_0x27ea('0x92')]['findAll']({'where':{'name':{'$or':[_0x27ea('0x30'),_0x27ea('0x32')]},'userProfileId':_0x16b1ae['user'][_0x27ea('0x8a')]},'raw':!![]})['then'](function(_0x4b5427){if(_[_0x27ea('0x93')](_0x4b5427)||!_[_0x27ea('0x8f')](_0x4b5427,['autoAssociation',0x0]))return _0x38114d;_0x54e152=[];var _0x54ceca=_(_0x4b5427)[_0x27ea('0x35')](function(_0x4d6205){if(_0x4d6205[_0x27ea('0x8c')]===0x1)return;return _0x4d6205['name']===_0x27ea('0x30')?_0x27ea('0x31'):'telephone';})[_0x27ea('0x94')]()[_0x27ea('0x36')]();for(var _0x6e40bd=0x0;_0x6e40bd<_0x38114d[_0x27ea('0x50')];_0x6e40bd++){if(!_[_0x27ea('0x37')](_0x54ceca,_0x38114d[_0x6e40bd][_0x27ea('0x38')]))return;var _0x52b3e7=_0x38114d[_0x6e40bd][_0x27ea('0x38')]===_0x27ea('0x31')?_0x27ea('0x30'):'Telephones';_0x54e152['push'](db['UserProfileResource'][_0x27ea('0x8b')]({'name':_0x38114d[_0x6e40bd][_0x27ea('0x3a')],'resourceId':_0x38114d[_0x6e40bd]['id'],'type':_0x52b3e7,'sectionId':_[_0x27ea('0x39')](_0x4b5427,['name',_0x52b3e7])['id']},{}));}return Promise[_0x27ea('0x58')](_0x54e152);});})[_0x27ea('0x16')](respondWithResult(_0x462a30,0xc9))[_0x27ea('0x21')](handleError(_0x462a30,null));};exports['changePassword']=function(_0x168c49,_0x1efa7f){if(_0x168c49[_0x27ea('0x63')]['id']){delete _0x168c49[_0x27ea('0x63')]['id'];}return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x168c49[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](function(_0x4b2504){if(!_0x4b2504)return null;if(_0x4b2504['id']===_0x168c49[_0x27ea('0x2f')]['id']){if(!_0x168c49[_0x27ea('0x63')]['oldPassword']||!_0x168c49[_0x27ea('0x63')][_0x27ea('0x95')]){throw new db[(_0x27ea('0x96'))]['ValidationError'](_0x27ea('0x97'));}if(!_0x4b2504['authenticate'](_0x168c49[_0x27ea('0x63')][_0x27ea('0x98')])){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))]('Wrong\x20credentials');}if(_0x168c49[_0x27ea('0x63')]['oldPassword']===_0x168c49[_0x27ea('0x63')][_0x27ea('0x95')]){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0x9a'));}}else if(_0x168c49[_0x27ea('0x2f')][_0x27ea('0x38')]===_0x27ea('0x86')){if(!_0x168c49['body']['newPassword']){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0x9b'));}}else if(_0x168c49['user']['role']===_0x27ea('0x2f')){if(!_0x168c49[_0x27ea('0x63')][_0x27ea('0x95')]){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0x9b'));}if(_0x4b2504[_0x27ea('0x38')]!==_0x27ea('0x31')){throw new db['Sequelize'][(_0x27ea('0x99'))](_0x27ea('0x84'));}}else{throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0x84'));}return _0x4b2504;})[_0x27ea('0x16')](handleEntityNotFound(_0x1efa7f,null))['then'](function(_0x3655dd){return db['Setting']['findOne']({'attributes':['id',_0x27ea('0x69'),_0x27ea('0x9c'),_0x27ea('0x9d')]})[_0x27ea('0x16')](function(_0x2abb14){if(_0x2abb14[_0x27ea('0x69')])authService[_0x27ea('0x6a')](_0x168c49[_0x27ea('0x63')][_0x27ea('0x95')]);if(!_0x2abb14[_0x27ea('0x9c')]||!_0x3655dd[_0x27ea('0x9e')])return _0x3655dd;authService[_0x27ea('0x9f')](_0x168c49['body'][_0x27ea('0x95')],_0x3655dd[_0x27ea('0x9e')],_0x2abb14[_0x27ea('0x9d')]);return _0x3655dd;})[_0x27ea('0x16')](saveUpdates({'password':_0x168c49[_0x27ea('0x63')]['newPassword'],'passwordResetAt':_0x168c49[_0x27ea('0x2f')]['id']==_0x168c49[_0x27ea('0x65')]['id']?moment():null,'previousPasswords':authService[_0x27ea('0xa0')](_0x168c49['body'][_0x27ea('0x95')],_0x3655dd[_0x27ea('0x9e')])},null));})[_0x27ea('0x16')](respondWithResult(_0x1efa7f,null))['catch'](handleError(_0x1efa7f,null));};exports[_0x27ea('0xa1')]=function(_0x16db0f,_0x7bfe48){var _0x222e26=_0x16db0f[_0x27ea('0x63')][_0x27ea('0xa2')];return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x16db0f[_0x27ea('0x65')]['id']},'attributes':['id',_0x27ea('0x3a'),'role',_0x27ea('0xa3'),_0x27ea('0xa4'),_0x27ea('0xa5'),_0x27ea('0xa6')]})[_0x27ea('0x16')](handleEntityNotFound(_0x7bfe48,null))[_0x27ea('0x16')](function(_0x278e40){if(_0x278e40){if(!utils[_0x27ea('0xa7')](_0x222e26)){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0xa8'));}return _0x278e40[_0x27ea('0xa9')+_[_0x27ea('0xaa')](_0x222e26['toLowerCase']())+_0x27ea('0xab')](_0x16db0f[_0x27ea('0x63')][_0x27ea('0x66')],{'penalty':_0x16db0f[_0x27ea('0x63')][_0x27ea('0xac')]||0x0})['spread'](function(_0x1204da){for(var _0x30f4e0=0x0;_0x30f4e0<_0x16db0f['body']['ids'][_0x27ea('0x50')];_0x30f4e0+=0x1){var _0x3df7f7={'UserId':Number(_0x16db0f[_0x27ea('0x65')]['id'])};_0x3df7f7[_[_0x27ea('0xaa')](_0x222e26[_0x27ea('0xad')]())+'QueueId']=Number(_0x16db0f[_0x27ea('0x63')][_0x27ea('0x66')][_0x30f4e0]);socket[_0x27ea('0x2b')](_0x27ea('0x2f')+_['capitalize'](_0x222e26[_0x27ea('0xad')]())+'Queue:save',_0x3df7f7);}return _0x1204da;})[_0x27ea('0x16')](function(){if(_0x222e26===_0x27ea('0xae')){return db[_0x27ea('0xaf')][_0x27ea('0x4d')]({'where':{'id':_0x16db0f[_0x27ea('0x63')][_0x27ea('0x66')]||[]},'raw':!![],'attributes':['id',_0x27ea('0x3a')]});}})[_0x27ea('0x16')](function(_0x5e9006){var _0x132758=_0x278e40['get']({'plain':!![]});var _0x43cb5c=[];if(_0x222e26==='voice'&&_0x132758['role']==='agent'&&_0x132758['online']){for(let _0x46477e=0x0;_0x46477e<_0x5e9006[_0x27ea('0x50')];_0x46477e+=0x1){_0x43cb5c[_0x27ea('0x4c')]({'membername':_0x132758[_0x27ea('0x3a')],'UserId':_0x132758['id'],'queue_name':_0x5e9006[_0x46477e][_0x27ea('0x3a')],'VoiceQueueId':_0x5e9006[_0x46477e]['id'],'interface':_[_0x27ea('0x6d')](_0x132758['interface'])?util['format']('SIP/%s',_0x132758['name']):_0x132758[_0x27ea('0xa6')],'paused':_0x132758['voicePause']||![],'penalty':_0x16db0f[_0x27ea('0x63')][_0x27ea('0xac')]||0x0});}return Promise[_0x27ea('0x58')](_0x43cb5c[_0x27ea('0x35')](function(_0x5dd363){return db['UserVoiceQueueRt'][_0x27ea('0xb0')](_0x5dd363);}));}return _0x278e40;});}})[_0x27ea('0x16')](respondWithStatusCode(_0x7bfe48,null))[_0x27ea('0x21')](handleError(_0x7bfe48,null));};exports[_0x27ea('0xb1')]=function(_0x71d212,_0x5a31ec){var _0x5a2210,_0x4c6ec3;return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x71d212[_0x27ea('0x65')]['id']},'attributes':['id',_0x27ea('0x3a'),_0x27ea('0x38')]})['then'](handleEntityNotFound(_0x5a31ec,null))[_0x27ea('0x16')](function(_0xc83ff7){if(_0xc83ff7){_0x5a2210=_0xc83ff7;if(!_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')]||!utils[_0x27ea('0xa7')](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')])){throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0xa8'));}return _0xc83ff7[_0x27ea('0xb2')+_[_0x27ea('0xaa')](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')][_0x27ea('0xad')]())+_0x27ea('0xab')](_0x71d212[_0x27ea('0x46')]['ids']);}})[_0x27ea('0x16')](function(_0x287571){if(_[_0x27ea('0xb3')](_0x71d212[_0x27ea('0x46')][_0x27ea('0x66')])){for(var _0x41c3fe=0x0;_0x41c3fe<_0x71d212['query'][_0x27ea('0x66')][_0x27ea('0x50')];_0x41c3fe+=0x1){_0x4c6ec3={'UserId':Number(_0x71d212[_0x27ea('0x65')]['id'])};_0x4c6ec3[_['capitalize'](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')][_0x27ea('0xad')]())+_0x27ea('0xb4')]=Number(_0x71d212[_0x27ea('0x46')][_0x27ea('0x66')][_0x41c3fe]);socket[_0x27ea('0x2b')](_0x27ea('0x2f')+_['capitalize'](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')][_0x27ea('0xad')]())+'Queue:remove',_0x4c6ec3);}}else{_0x4c6ec3={'UserId':Number(_0x71d212['params']['id'])};_0x4c6ec3[_[_0x27ea('0xaa')](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')]['toLowerCase']())+_0x27ea('0xb4')]=Number(_0x71d212[_0x27ea('0x46')][_0x27ea('0x66')]);socket['emit'](_0x27ea('0x2f')+_[_0x27ea('0xaa')](_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')][_0x27ea('0xad')]())+_0x27ea('0xb5'),_0x4c6ec3);}return _0x287571;})['then'](function(){if(_0x71d212[_0x27ea('0x46')][_0x27ea('0xa2')]==='voice'){return db[_0x27ea('0xb6')][_0x27ea('0x2c')]({'where':{'UserId':_0x71d212[_0x27ea('0x65')]['id'],'VoiceQueueId':_0x71d212[_0x27ea('0x46')][_0x27ea('0x66')]},'individualHooks':!![]})['then'](function(){return _0x5a2210;});}return _0x5a2210;})['then'](respondWithStatusCode(_0x5a31ec,null))['catch'](handleError(_0x5a31ec,null));};exports['addAvatar']=function(_0x341acb,_0x27a9d2){_0x341acb[_0x27ea('0x63')][_0x27ea('0xb7')]=_0x341acb[_0x27ea('0xb8')][_0x27ea('0xb9')];return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x341acb[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x27a9d2,null))[_0x27ea('0x16')](saveUpdates(_0x341acb[_0x27ea('0x63')],null))[_0x27ea('0x16')](respondWithResult(_0x27a9d2,null))[_0x27ea('0x21')](handleError(_0x27a9d2,null));};exports[_0x27ea('0xba')]=function(_0x2dc3aa,_0x238e3d){var _0x28e911=path[_0x27ea('0xbb')](config[_0x27ea('0xbc')],_0x27ea('0xbd'));return db['User'][_0x27ea('0x39')]({'where':{'id':_0x2dc3aa[_0x27ea('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x27ea('0x16')](handleEntityNotFound(_0x238e3d,null))[_0x27ea('0x16')](function(_0x4ba393){if(_0x4ba393){if(_['isNil'](_0x4ba393['userpic'])){return _0x238e3d[_0x27ea('0xbe')](_0x28e911);}else{if(!fs[_0x27ea('0xbf')](path[_0x27ea('0xbb')](config[_0x27ea('0xbc')],_0x27ea('0xc0'),_0x4ba393[_0x27ea('0xb7')]))){return _0x238e3d[_0x27ea('0xbe')](_0x28e911);}return _0x238e3d['download'](path[_0x27ea('0xbb')](config['root'],_0x27ea('0xc0'),_0x4ba393[_0x27ea('0xb7')]));}}})[_0x27ea('0x21')](handleError(_0x238e3d,null));};exports[_0x27ea('0xc1')]=function(_0x6da27e,_0x269def){return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x6da27e[_0x27ea('0x65')]['id']},'attributes':['id']})[_0x27ea('0x16')](handleEntityNotFound(_0x269def,null))[_0x27ea('0x16')](function(_0x8fcb09){var _0x544130=[];values=_0x8fcb09[_0x27ea('0x54')];_0x544130[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x51'),_0x8fcb09[_0x27ea('0x54')]));_0x544130[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x52'),_0x8fcb09[_0x27ea('0x54')]));_0x544130[_0x27ea('0x4c')](get_open_tabs('openchannel',_0x8fcb09['dataValues']));_0x544130[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x57'),_0x8fcb09[_0x27ea('0x54')]));_0x544130[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x53'),_0x8fcb09[_0x27ea('0x54')]));_0x544130[_0x27ea('0x4c')](get_open_tabs(_0x27ea('0x55'),_0x8fcb09['dataValues']));return Promise[_0x27ea('0x58')](_0x544130);})[_0x27ea('0x16')](function(_0xe67d30){if(_0xe67d30){var _0x4a977b=_[_0x27ea('0x35')](values[_0x27ea('0xc2')],function(_0x283626){return{'channel':_0x27ea('0xc3'),'id':_0x283626['id'],'createdAt':_0x283626[_0x27ea('0xc4')]};});var _0x242210=_['map'](values[_0x27ea('0xc5')],function(_0x3abf2a){return{'channel':_0x27ea('0xc6'),'id':_0x3abf2a['id'],'createdAt':_0x3abf2a[_0x27ea('0xc4')]};});var _0x170e42=_[_0x27ea('0x35')](values['OpenchannelOpenTabs'],function(_0x284faf){return{'channel':_0x27ea('0xc7'),'id':_0x284faf['id'],'createdAt':_0x284faf[_0x27ea('0xc4')]};});var _0x4e0659=_[_0x27ea('0x35')](values[_0x27ea('0xc8')],function(_0x205845){return{'channel':'MAIL','id':_0x205845['id'],'createdAt':_0x205845[_0x27ea('0xc4')]};});var _0x2e0571=_[_0x27ea('0x35')](values[_0x27ea('0xc9')],function(_0xe3110d){return{'channel':'SMS','id':_0xe3110d['id'],'createdAt':_0xe3110d[_0x27ea('0xc4')]};});var _0x486866=_[_0x27ea('0x35')](values[_0x27ea('0xca')],function(_0x56ca37){return{'channel':_0x27ea('0xcb'),'id':_0x56ca37['id'],'createdAt':_0x56ca37['createdAt']};});var _0x15f4c9=_['concat'](_0x4a977b,_0x242210,_0x170e42,_0x4e0659,_0x2e0571,_0x486866);var _0x2a7251={'count':_0x15f4c9[_0x27ea('0x50')],'rows':_0x15f4c9};return _0x2a7251;}else return null;})[_0x27ea('0x16')](respondWithResult(_0x269def,null))['catch'](handleError(_0x269def,null));};exports[_0x27ea('0xcc')]=function(_0x5dbf0f,_0x5c8766){var _0x784072={};var _0x1d7813={};var _0x18d1e7;var _0xb4ee43;return db[_0x27ea('0x44')]['findOne']({'where':{'id':_0x5dbf0f[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x5c8766,null))[_0x27ea('0x16')](function(_0x4cec64){if(_0x4cec64){_0x18d1e7=_0x4cec64;_0x1d7813[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xcd')]['rawAttributes']);_0x1d7813[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x5dbf0f[_0x27ea('0x46')]);_0x1d7813[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x1d7813[_0x27ea('0x5a')],_0x1d7813[_0x27ea('0x46')]);_0x784072[_0x27ea('0x4b')]=_['intersection'](_0x1d7813[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x5dbf0f['query'][_0x27ea('0x5f')]));_0x784072[_0x27ea('0x4b')]=_0x784072[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x784072[_0x27ea('0x4b')]:_0x1d7813[_0x27ea('0x5a')];_0x784072[_0x27ea('0xce')]=qs['sort'](_0x5dbf0f[_0x27ea('0x46')]['sort']);_0x784072[_0x27ea('0x43')]=qs['filters'](_[_0x27ea('0xcf')](_0x5dbf0f[_0x27ea('0x46')],_0x1d7813[_0x27ea('0x5d')]));if(_0x5dbf0f[_0x27ea('0x46')][_0x27ea('0x33')]){_0x784072['where']=_[_0x27ea('0x61')](_0x784072['where'],{'$or':_['map'](_0x784072[_0x27ea('0x4b')],function(_0x5a34ee){var _0x535b7d={};_0x535b7d[_0x5a34ee]={'$like':'%'+_0x5dbf0f['query']['filter']+'%'};return _0x535b7d;})});}_0x784072=_['merge']({},_0x784072,_0x5dbf0f[_0x27ea('0x62')]);return _0x18d1e7[_0x27ea('0xcc')](_0x784072);}})[_0x27ea('0x16')](function(_0x2cc8b1){if(_0x2cc8b1){_0xb4ee43=_0x2cc8b1[_0x27ea('0x50')];if(_0x5dbf0f['query'][_0x27ea('0xd0')](_0x27ea('0x47'))){_0x784072[_0x27ea('0x49')]=[{'model':db[_0x27ea('0xd1')],'as':'List','required':![]},{'model':db[_0x27ea('0xd2')],'as':'Tags','attributes':['id','name',_0x27ea('0xd3')],'where':_0x5dbf0f['query'][_0x27ea('0xd4')]?{'id':_0x5dbf0f[_0x27ea('0x46')][_0x27ea('0xd4')]}:undefined,'required':_0x5dbf0f[_0x27ea('0x46')][_0x27ea('0xd4')]?!![]:![]}];}if(!_0x5dbf0f[_0x27ea('0x46')]['hasOwnProperty'](_0x27ea('0xd5'))){_0x784072[_0x27ea('0x27')]=qs['limit'](_0x5dbf0f[_0x27ea('0x46')][_0x27ea('0x27')]);_0x784072[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x5dbf0f[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x18d1e7['getContacts'](_0x784072);}})[_0x27ea('0x16')](function(_0x406925){if(_0x406925){return _0x406925?{'count':_0xb4ee43,'rows':_0x406925}:null;}})[_0x27ea('0x16')](respondWithResult(_0x5c8766,null))[_0x27ea('0x21')](handleError(_0x5c8766,null));};exports[_0x27ea('0xd6')]=function(_0x2cd5d5,_0x3ac84e){var _0x166a36;var _0x1bd6d2={};var _0x464b6b;return db['User'][_0x27ea('0xd7')]({'where':{'id':_0x2cd5d5['params']['id']},'attributes':['id',_0x27ea('0x3a'),_0x27ea('0x38')]})['then'](handleEntityNotFound(_0x3ac84e,null))[_0x27ea('0x16')](function(_0x232166){if(!utils[_0x27ea('0xa7')](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0xa2')])){throw new db['Sequelize']['ValidationError'](_0x27ea('0xa8'));}_0x166a36=_0x232166;var _0x2a428c={};_0x2a428c['model']=_['keys'](db[_[_0x27ea('0xaa')](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0xa2')])+'Queue'][_0x27ea('0xd8')]);_0x2a428c[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x2cd5d5['query']);_0x2a428c[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x2a428c[_0x27ea('0x5a')],_0x2a428c['query']);_0x1bd6d2[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x2a428c[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x2cd5d5[_0x27ea('0x46')]['fields']));_0x1bd6d2['attributes']=_0x1bd6d2[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x1bd6d2[_0x27ea('0x4b')]:_0x2a428c['model'];_0x1bd6d2[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x2cd5d5['query'][_0x27ea('0xd9')]);_0x1bd6d2['where']=qs['filters'](_[_0x27ea('0xcf')](_0x2cd5d5[_0x27ea('0x46')],_0x2a428c[_0x27ea('0x5d')]));if(_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0x33')]){_0x1bd6d2['where']=_[_0x27ea('0x61')](_0x1bd6d2[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x1bd6d2[_0x27ea('0x4b')],function(_0x18bfe7){var _0x5a7e2c={};_0x5a7e2c[_0x18bfe7]={'$like':'%'+_0x2cd5d5['query'][_0x27ea('0x33')]+'%'};return _0x5a7e2c;})});}_0x1bd6d2=_[_0x27ea('0x61')]({},_0x1bd6d2,_0x2cd5d5[_0x27ea('0x62')]);switch(_0x166a36['role']){case _0x27ea('0x86'):return db[_[_0x27ea('0xaa')](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0xa2')])+_0x27ea('0xda')][_0x27ea('0x4d')](_0x1bd6d2);case _0x27ea('0x2f'):case'agent':return _0x166a36['get'+_[_0x27ea('0xaa')](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0xa2')])+_0x27ea('0xab')](_0x1bd6d2);default:throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))]('Unknown\x20role');}})[_0x27ea('0x16')](function(_0x36279f){_0x464b6b=_0x36279f[_0x27ea('0x50')];if(!_0x2cd5d5['query'][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x1bd6d2[_0x27ea('0x27')]=qs['limit'](_0x2cd5d5['query']['limit']);_0x1bd6d2[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0x25')]);}switch(_0x166a36[_0x27ea('0x38')]){case'admin':return db[_['capitalize'](_0x2cd5d5['query'][_0x27ea('0xa2')])+_0x27ea('0xda')][_0x27ea('0x4d')](_0x1bd6d2);case'user':case'agent':return _0x166a36[_0x27ea('0x2d')+_['capitalize'](_0x2cd5d5[_0x27ea('0x46')][_0x27ea('0xa2')])+_0x27ea('0xab')](_0x1bd6d2);}})[_0x27ea('0x16')](function(_0x2bc259){return{'count':_0x464b6b,'rows':_0x2bc259};})[_0x27ea('0x16')](respondWithResult(_0x3ac84e,null))[_0x27ea('0x21')](handleError(_0x3ac84e,null));};exports[_0x27ea('0xdb')]=function(_0x3a825d,_0x377377){var _0x1f0ac8={};var _0x95f244={};var _0x4e5932;var _0x4d79cf;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x3a825d[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x377377,null))[_0x27ea('0x16')](function(_0x13e504){if(_0x13e504){_0x4e5932=_0x13e504;_0x95f244[_0x27ea('0x5a')]=_['keys'](db[_0x27ea('0xb6')][_0x27ea('0xd8')]);_0x95f244['query']=_['keys'](_0x3a825d['query']);_0x95f244[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x95f244[_0x27ea('0x5a')],_0x95f244['query']);_0x1f0ac8[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x95f244[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x3a825d['query']['fields']));_0x1f0ac8[_0x27ea('0x4b')]=_0x1f0ac8['attributes']['length']?_0x1f0ac8['attributes']:_0x95f244['model'];_0x1f0ac8[_0x27ea('0xce')]=qs['sort'](_0x3a825d[_0x27ea('0x46')][_0x27ea('0xd9')]);_0x1f0ac8[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x3a825d[_0x27ea('0x46')],_0x95f244[_0x27ea('0x5d')]));if(_0x3a825d[_0x27ea('0x46')][_0x27ea('0x33')]){_0x1f0ac8[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x1f0ac8[_0x27ea('0x43')],{'$or':_['map'](_0x1f0ac8[_0x27ea('0x4b')],function(_0x394f5a){var _0x47f88d={};_0x47f88d[_0x394f5a]={'$like':'%'+_0x3a825d[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x47f88d;})});}_0x1f0ac8=_[_0x27ea('0x61')]({},_0x1f0ac8,_0x3a825d[_0x27ea('0x62')]);return _0x4e5932['getVoiceQueuesRt'](_0x1f0ac8);}})[_0x27ea('0x16')](function(_0x2bf676){if(_0x2bf676){_0x4d79cf=_0x2bf676[_0x27ea('0x50')];if(!_0x3a825d[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x1f0ac8[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x3a825d[_0x27ea('0x46')][_0x27ea('0x27')]);_0x1f0ac8[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x3a825d[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x4e5932[_0x27ea('0xdb')](_0x1f0ac8);}})[_0x27ea('0x16')](function(_0x3002b3){if(_0x3002b3){return _0x3002b3?{'count':_0x4d79cf,'rows':_0x3002b3}:null;}})['then'](respondWithResult(_0x377377,null))[_0x27ea('0x21')](handleError(_0x377377,null));};exports[_0x27ea('0xdc')]=function(_0x4e0c6a,_0x958955){var _0x374431={};var _0x3a099c={};var _0x2fa338;var _0x1b6480;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x4e0c6a[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x958955,null))['then'](function(_0x2f4dea){if(_0x2f4dea){_0x2fa338=_0x2f4dea;_0x3a099c[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db['ChatGroup']['rawAttributes']);_0x3a099c[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x4e0c6a[_0x27ea('0x46')]);_0x3a099c[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x3a099c[_0x27ea('0x5a')],_0x3a099c[_0x27ea('0x46')]);_0x374431[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x3a099c['model'],qs[_0x27ea('0x5f')](_0x4e0c6a[_0x27ea('0x46')]['fields']));_0x374431[_0x27ea('0x4b')]=_0x374431[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x374431[_0x27ea('0x4b')]:_0x3a099c['model'];_0x374431[_0x27ea('0xce')]=qs['sort'](_0x4e0c6a['query'][_0x27ea('0xd9')]);_0x374431['where']=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x4e0c6a[_0x27ea('0x46')],_0x3a099c['filters']));if(_0x4e0c6a['query']['filter']){_0x374431['where']=_['merge'](_0x374431[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x374431['attributes'],function(_0x518122){var _0x5a7c93={};_0x5a7c93[_0x518122]={'$like':'%'+_0x4e0c6a['query']['filter']+'%'};return _0x5a7c93;})});}_0x374431=_[_0x27ea('0x61')]({},_0x374431,_0x4e0c6a[_0x27ea('0x62')]);return _0x2fa338[_0x27ea('0xdc')](_0x374431);}})[_0x27ea('0x16')](function(_0x54ee69){if(_0x54ee69){_0x1b6480=_0x54ee69[_0x27ea('0x50')];if(!_0x4e0c6a[_0x27ea('0x46')][_0x27ea('0xd0')]('nolimit')){_0x374431[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x4e0c6a['query'][_0x27ea('0x27')]);_0x374431['offset']=qs[_0x27ea('0x25')](_0x4e0c6a[_0x27ea('0x46')]['offset']);}return _0x2fa338[_0x27ea('0xdc')](_0x374431);}})[_0x27ea('0x16')](function(_0x5c6deb){if(_0x5c6deb){return _0x5c6deb?{'count':_0x1b6480,'rows':_0x5c6deb}:null;}})[_0x27ea('0x16')](respondWithResult(_0x958955,null))[_0x27ea('0x21')](handleError(_0x958955,null));};exports['getRecordings']=function(_0x399ade,_0x316fe3){var _0x1ca989={'raw':!![],'where':{}};var _0x579c2d={};var _0x242fa2={'count':0x0,'rows':[]};return db[_0x27ea('0x44')]['findOne']({'where':{'id':_0x399ade[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x316fe3,null))[_0x27ea('0x16')](function(_0x2686e6){if(_0x2686e6){_0x579c2d['model']=_['keys'](db[_0x27ea('0xdd')][_0x27ea('0xd8')]);_0x579c2d['query']=_[_0x27ea('0x5c')](_0x399ade[_0x27ea('0x46')]);_0x579c2d[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x579c2d[_0x27ea('0x5a')],_0x579c2d[_0x27ea('0x46')]);_0x1ca989[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x579c2d[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x399ade['query'][_0x27ea('0x5f')]));_0x1ca989[_0x27ea('0x4b')]=_0x1ca989[_0x27ea('0x4b')]['length']?_0x1ca989['attributes']:_0x579c2d[_0x27ea('0x5a')];if(!_0x399ade[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x1ca989['limit']=qs[_0x27ea('0x27')](_0x399ade[_0x27ea('0x46')][_0x27ea('0x27')]);_0x1ca989[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x399ade[_0x27ea('0x46')]['offset']);}_0x1ca989[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x399ade['query'][_0x27ea('0xd9')]);_0x1ca989[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_['pick'](_0x399ade['query'],_0x579c2d['filters']));_0x1ca989[_0x27ea('0x43')][_0x27ea('0xde')]=_0x2686e6['id'];if(_0x399ade[_0x27ea('0x46')]['filter']){_0x1ca989[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x1ca989[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x1ca989[_0x27ea('0x4b')],function(_0x225a9e){var _0x1eb5a6={};_0x1eb5a6[_0x225a9e]={'$like':'%'+_0x399ade[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x1eb5a6;})});}_0x1ca989=_[_0x27ea('0x61')]({},_0x1ca989,_0x399ade[_0x27ea('0x62')]);return db[_0x27ea('0xdd')][_0x27ea('0x45')]({'where':_0x1ca989['where']})['then'](function(_0x42e2ae){_0x242fa2['count']=_0x42e2ae;if(_0x399ade[_0x27ea('0x46')]['includeAll']){_0x1ca989[_0x27ea('0x49')]=[{'all':!![]}];}return db[_0x27ea('0xdd')][_0x27ea('0x4d')](_0x1ca989);})[_0x27ea('0x16')](function(_0x36e448){_0x242fa2[_0x27ea('0x4e')]=_0x36e448;return _0x242fa2;});}})[_0x27ea('0x16')](respondWithFilteredResult(_0x316fe3,_0x1ca989))[_0x27ea('0x21')](handleError(_0x316fe3,null));};exports[_0x27ea('0xdf')]=function(_0x36fd0f,_0x53463b){var _0x46de25={'raw':!![],'where':{}};var _0x535e0c={};var _0x219513={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x36fd0f[_0x27ea('0x65')]['id']}})['then'](handleEntityNotFound(_0x53463b,null))[_0x27ea('0x16')](function(_0xf6e042){if(_0xf6e042){_0x535e0c[_0x27ea('0x5a')]=_['keys'](db[_0x27ea('0xe0')][_0x27ea('0xd8')]);_0x535e0c[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x36fd0f[_0x27ea('0x46')]);_0x535e0c[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x535e0c[_0x27ea('0x5a')],_0x535e0c[_0x27ea('0x46')]);_0x46de25[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x535e0c[_0x27ea('0x5a')],qs['fields'](_0x36fd0f[_0x27ea('0x46')][_0x27ea('0x5f')]));_0x46de25[_0x27ea('0x4b')]=_0x46de25[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x46de25[_0x27ea('0x4b')]:_0x535e0c[_0x27ea('0x5a')];if(!_0x36fd0f[_0x27ea('0x46')][_0x27ea('0xd0')]('nolimit')){_0x46de25[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x36fd0f['query'][_0x27ea('0x27')]);_0x46de25[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x36fd0f[_0x27ea('0x46')][_0x27ea('0x25')]);}_0x46de25['order']=qs[_0x27ea('0xd9')](_0x36fd0f[_0x27ea('0x46')][_0x27ea('0xd9')]);_0x46de25[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x36fd0f[_0x27ea('0x46')],_0x535e0c[_0x27ea('0x5d')]));_0x46de25[_0x27ea('0x43')][_0x27ea('0xde')]=_0xf6e042['id'];if(_0x36fd0f['query']['filter']){_0x46de25[_0x27ea('0x43')]=_['merge'](_0x46de25[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x46de25['attributes'],function(_0x2d81c9){var _0x167b3d={};_0x167b3d[_0x2d81c9]={'$like':'%'+_0x36fd0f[_0x27ea('0x46')]['filter']+'%'};return _0x167b3d;})});}_0x46de25=_[_0x27ea('0x61')]({},_0x46de25,_0x36fd0f[_0x27ea('0x62')]);return db['ScreenRecording'][_0x27ea('0x45')]({'where':_0x46de25[_0x27ea('0x43')]})[_0x27ea('0x16')](function(_0x18d3fe){_0x219513[_0x27ea('0x45')]=_0x18d3fe;if(_0x36fd0f[_0x27ea('0x46')]['includeAll']){_0x46de25['include']=[{'all':!![]}];}return db[_0x27ea('0xe0')][_0x27ea('0x4d')](_0x46de25);})[_0x27ea('0x16')](function(_0x2f9301){_0x219513['rows']=_0x2f9301;return _0x219513;});}})[_0x27ea('0x16')](respondWithFilteredResult(_0x53463b,_0x46de25))[_0x27ea('0x21')](handleError(_0x53463b,null));};exports[_0x27ea('0xe1')]=function(_0x5c6c2c,_0x10ee6a){var _0x4613dd={};var _0x14c1e2={};var _0x3cec91;var _0x25ca5f;return db[_0x27ea('0x44')]['findOne']({'where':{'id':_0x5c6c2c[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x10ee6a,null))[_0x27ea('0x16')](function(_0x42e4e6){if(_0x42e4e6){_0x3cec91=_0x42e4e6;_0x14c1e2[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xe2')][_0x27ea('0xd8')]);_0x14c1e2[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x5c6c2c[_0x27ea('0x46')]);_0x14c1e2[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x14c1e2[_0x27ea('0x5a')],_0x14c1e2[_0x27ea('0x46')]);_0x4613dd[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x14c1e2[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x5c6c2c[_0x27ea('0x46')][_0x27ea('0x5f')]));_0x4613dd[_0x27ea('0x4b')]=_0x4613dd[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x4613dd[_0x27ea('0x4b')]:_0x14c1e2['model'];_0x4613dd[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x5c6c2c['query']['sort']);_0x4613dd[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x5c6c2c[_0x27ea('0x46')],_0x14c1e2['filters']));if(_0x5c6c2c[_0x27ea('0x46')][_0x27ea('0x33')]){_0x4613dd[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x4613dd[_0x27ea('0x43')],{'$or':_['map'](_0x4613dd[_0x27ea('0x4b')],function(_0x5e7bf0){var _0x35ebcc={};_0x35ebcc[_0x5e7bf0]={'$like':'%'+_0x5c6c2c[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x35ebcc;})});}_0x4613dd=_[_0x27ea('0x61')]({},_0x4613dd,_0x5c6c2c['options']);return _0x3cec91[_0x27ea('0xe1')](_0x4613dd);}})[_0x27ea('0x16')](function(_0x5ec2f7){if(_0x5ec2f7){_0x25ca5f=_0x5ec2f7[_0x27ea('0x50')];if(!_0x5c6c2c['query'][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x4613dd[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x5c6c2c[_0x27ea('0x46')]['limit']);_0x4613dd[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x5c6c2c[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x3cec91[_0x27ea('0xe1')](_0x4613dd);}})['then'](function(_0x404ddb){if(_0x404ddb){return _0x404ddb?{'count':_0x25ca5f,'rows':_0x404ddb}:null;}})[_0x27ea('0x16')](respondWithResult(_0x10ee6a,null))['catch'](handleError(_0x10ee6a,null));};exports[_0x27ea('0xe3')]=function(_0x2d8e5d,_0x58cd09){var _0x19a94d={};var _0x52d008={};var _0x56300e;var _0x30f6ba;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x2d8e5d['params']['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x58cd09,null))[_0x27ea('0x16')](function(_0x2fbbcd){if(_0x2fbbcd){_0x56300e=_0x2fbbcd;_0x52d008[_0x27ea('0x5a')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x52d008[_0x27ea('0x46')]=_['keys'](_0x2d8e5d[_0x27ea('0x46')]);_0x52d008[_0x27ea('0x5d')]=_['intersection'](_0x52d008[_0x27ea('0x5a')],_0x52d008[_0x27ea('0x46')]);_0x19a94d[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x52d008[_0x27ea('0x5a')],qs['fields'](_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0x5f')]));_0x19a94d['attributes']=_0x19a94d['attributes'][_0x27ea('0x50')]?_0x19a94d[_0x27ea('0x4b')]:_0x52d008['model'];_0x19a94d[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x2d8e5d[_0x27ea('0x46')]['sort']);_0x19a94d[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_['pick'](_0x2d8e5d['query'],_0x52d008['filters']));if(_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0x33')]){_0x19a94d['where']=_[_0x27ea('0x61')](_0x19a94d[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x19a94d['attributes'],function(_0x621d36){var _0x2a4b99={};_0x2a4b99[_0x621d36]={'$like':'%'+_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x2a4b99;})});}_0x19a94d=_[_0x27ea('0x61')]({},_0x19a94d,_0x2d8e5d[_0x27ea('0x62')]);return _0x56300e[_0x27ea('0xe3')](_0x19a94d);}})[_0x27ea('0x16')](function(_0x3ba794){if(_0x3ba794){_0x30f6ba=_0x3ba794[_0x27ea('0x50')];if(!_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x19a94d['limit']=qs[_0x27ea('0x27')](_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0x27')]);_0x19a94d[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x2d8e5d[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x56300e[_0x27ea('0xe3')](_0x19a94d);}})['then'](function(_0x2deb4b){if(_0x2deb4b){return _0x2deb4b?{'count':_0x30f6ba,'rows':_0x2deb4b}:null;}})[_0x27ea('0x16')](respondWithResult(_0x58cd09,null))['catch'](handleError(_0x58cd09,null));};exports['getMailInteractions']=function(_0x27fe57,_0x1787c0){var _0x26b354={'raw':!![],'where':{}};var _0x16cb6c={};var _0x4cfd8b={'count':0x0,'rows':[]};return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x27fe57[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x1787c0,null))[_0x27ea('0x16')](function(_0x3ac067){if(_0x3ac067){_0x16cb6c[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xe4')][_0x27ea('0xd8')]);_0x16cb6c[_0x27ea('0x46')]=_['keys'](_0x27fe57[_0x27ea('0x46')]);_0x16cb6c[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x16cb6c[_0x27ea('0x5a')],_0x16cb6c[_0x27ea('0x46')]);_0x26b354[_0x27ea('0x4b')]=_['intersection'](_0x16cb6c['model'],qs[_0x27ea('0x5f')](_0x27fe57['query'][_0x27ea('0x5f')]));_0x26b354[_0x27ea('0x4b')]=_0x26b354[_0x27ea('0x4b')][_0x27ea('0x50')]?_0x26b354['attributes']:_0x16cb6c[_0x27ea('0x5a')];if(!_0x27fe57[_0x27ea('0x46')][_0x27ea('0xd0')]('nolimit')){_0x26b354['limit']=qs[_0x27ea('0x27')](_0x27fe57[_0x27ea('0x46')]['limit']);_0x26b354[_0x27ea('0x25')]=qs['offset'](_0x27fe57[_0x27ea('0x46')][_0x27ea('0x25')]);}_0x26b354[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x27fe57[_0x27ea('0x46')][_0x27ea('0xd9')]);_0x26b354[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x27fe57[_0x27ea('0x46')],_0x16cb6c[_0x27ea('0x5d')]));_0x26b354[_0x27ea('0x43')][_0x27ea('0xde')]=_0x3ac067['id'];if(_0x27fe57[_0x27ea('0x46')][_0x27ea('0x33')]){_0x26b354[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x26b354['where'],{'$or':_[_0x27ea('0x35')](_0x26b354[_0x27ea('0x4b')],function(_0x49f1db){var _0x414372={};_0x414372[_0x49f1db]={'$like':'%'+_0x27fe57[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x414372;})});}_0x26b354=_[_0x27ea('0x61')]({},_0x26b354,_0x27fe57[_0x27ea('0x62')]);return db[_0x27ea('0xe4')][_0x27ea('0x45')]({'where':_0x26b354[_0x27ea('0x43')]})[_0x27ea('0x16')](function(_0x12ea95){_0x4cfd8b['count']=_0x12ea95;if(_0x27fe57[_0x27ea('0x46')][_0x27ea('0x47')]){_0x26b354[_0x27ea('0x49')]=[{'all':!![]}];}return db['MailInteraction'][_0x27ea('0x4d')](_0x26b354);})['then'](function(_0x337bc1){_0x4cfd8b[_0x27ea('0x4e')]=_0x337bc1;return _0x4cfd8b;});}})[_0x27ea('0x16')](respondWithFilteredResult(_0x1787c0,_0x26b354))[_0x27ea('0x21')](handleError(_0x1787c0,null));};exports[_0x27ea('0xe5')]=function(_0x5b8aa4,_0x1bb07f){var _0x38ad98={};var _0x3259b8={};var _0x500b5a;var _0x4b36b3;return db[_0x27ea('0x44')]['findOne']({'where':{'id':_0x5b8aa4['params']['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x1bb07f,null))[_0x27ea('0x16')](function(_0x5c5cee){if(_0x5c5cee){_0x500b5a=_0x5c5cee;_0x3259b8[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xe6')][_0x27ea('0xd8')]);_0x3259b8[_0x27ea('0x46')]=_['keys'](_0x5b8aa4['query']);_0x3259b8[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x3259b8[_0x27ea('0x5a')],_0x3259b8[_0x27ea('0x46')]);_0x38ad98[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x3259b8[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x5b8aa4[_0x27ea('0x46')]['fields']));_0x38ad98[_0x27ea('0x4b')]=_0x38ad98[_0x27ea('0x4b')]['length']?_0x38ad98[_0x27ea('0x4b')]:_0x3259b8[_0x27ea('0x5a')];_0x38ad98['order']=qs['sort'](_0x5b8aa4[_0x27ea('0x46')][_0x27ea('0xd9')]);_0x38ad98['where']=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x5b8aa4[_0x27ea('0x46')],_0x3259b8[_0x27ea('0x5d')]));if(_0x5b8aa4[_0x27ea('0x46')][_0x27ea('0x33')]){_0x38ad98[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x38ad98['where'],{'$or':_[_0x27ea('0x35')](_0x38ad98[_0x27ea('0x4b')],function(_0x4af6d0){var _0x1b2228={};_0x1b2228[_0x4af6d0]={'$like':'%'+_0x5b8aa4['query']['filter']+'%'};return _0x1b2228;})});}_0x38ad98=_[_0x27ea('0x61')]({},_0x38ad98,_0x5b8aa4[_0x27ea('0x62')]);return _0x500b5a[_0x27ea('0xe5')](_0x38ad98);}})['then'](function(_0xbd73cc){if(_0xbd73cc){_0x4b36b3=_0xbd73cc[_0x27ea('0x50')];if(!_0x5b8aa4[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x38ad98[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x5b8aa4[_0x27ea('0x46')][_0x27ea('0x27')]);_0x38ad98[_0x27ea('0x25')]=qs['offset'](_0x5b8aa4[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x500b5a[_0x27ea('0xe5')](_0x38ad98);}})[_0x27ea('0x16')](function(_0x2eca26){if(_0x2eca26){return _0x2eca26?{'count':_0x4b36b3,'rows':_0x2eca26}:null;}})[_0x27ea('0x16')](respondWithResult(_0x1bb07f,null))[_0x27ea('0x21')](handleError(_0x1bb07f,null));};exports['getFaxInteractions']=function(_0x3cd7ed,_0x45840f){var _0xda8334={};var _0x51eb7c={};var _0x105766;var _0x34faa2;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x3cd7ed[_0x27ea('0x65')]['id']}})['then'](handleEntityNotFound(_0x45840f,null))[_0x27ea('0x16')](function(_0x3fe98c){if(_0x3fe98c){_0x105766=_0x3fe98c;_0x51eb7c[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xe7')][_0x27ea('0xd8')]);_0x51eb7c['query']=_['keys'](_0x3cd7ed[_0x27ea('0x46')]);_0x51eb7c[_0x27ea('0x5d')]=_['intersection'](_0x51eb7c[_0x27ea('0x5a')],_0x51eb7c[_0x27ea('0x46')]);_0xda8334[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x51eb7c[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x3cd7ed[_0x27ea('0x46')]['fields']));_0xda8334[_0x27ea('0x4b')]=_0xda8334[_0x27ea('0x4b')]['length']?_0xda8334[_0x27ea('0x4b')]:_0x51eb7c[_0x27ea('0x5a')];_0xda8334['order']=qs[_0x27ea('0xd9')](_0x3cd7ed[_0x27ea('0x46')][_0x27ea('0xd9')]);_0xda8334[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_['pick'](_0x3cd7ed[_0x27ea('0x46')],_0x51eb7c[_0x27ea('0x5d')]));if(_0x3cd7ed[_0x27ea('0x46')][_0x27ea('0x33')]){_0xda8334[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0xda8334['where'],{'$or':_[_0x27ea('0x35')](_0xda8334[_0x27ea('0x4b')],function(_0x39ffdb){var _0x856bd5={};_0x856bd5[_0x39ffdb]={'$like':'%'+_0x3cd7ed[_0x27ea('0x46')]['filter']+'%'};return _0x856bd5;})});}_0xda8334=_[_0x27ea('0x61')]({},_0xda8334,_0x3cd7ed[_0x27ea('0x62')]);return _0x105766[_0x27ea('0xe8')](_0xda8334);}})['then'](function(_0x4142c3){if(_0x4142c3){_0x34faa2=_0x4142c3[_0x27ea('0x50')];if(!_0x3cd7ed[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0xda8334[_0x27ea('0x27')]=qs['limit'](_0x3cd7ed['query'][_0x27ea('0x27')]);_0xda8334[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x3cd7ed[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x105766[_0x27ea('0xe8')](_0xda8334);}})[_0x27ea('0x16')](function(_0x33f34c){if(_0x33f34c){return _0x33f34c?{'count':_0x34faa2,'rows':_0x33f34c}:null;}})[_0x27ea('0x16')](respondWithResult(_0x45840f,null))['catch'](handleError(_0x45840f,null));};exports[_0x27ea('0xe9')]=function(_0x49b093,_0x460625){var _0x318caf={};var _0x19035f={};var _0x58506d;var _0x3509cd;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x49b093[_0x27ea('0x65')]['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x460625,null))[_0x27ea('0x16')](function(_0x21b2a2){if(_0x21b2a2){_0x58506d=_0x21b2a2;_0x19035f[_0x27ea('0x5a')]=_['keys'](db[_0x27ea('0xea')]['rawAttributes']);_0x19035f[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x49b093['query']);_0x19035f[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x19035f['model'],_0x19035f[_0x27ea('0x46')]);_0x318caf[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x19035f[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x49b093[_0x27ea('0x46')][_0x27ea('0x5f')]));_0x318caf[_0x27ea('0x4b')]=_0x318caf['attributes'][_0x27ea('0x50')]?_0x318caf[_0x27ea('0x4b')]:_0x19035f[_0x27ea('0x5a')];_0x318caf['order']=qs[_0x27ea('0xd9')](_0x49b093[_0x27ea('0x46')]['sort']);_0x318caf[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x49b093['query'],_0x19035f[_0x27ea('0x5d')]));if(_0x49b093[_0x27ea('0x46')][_0x27ea('0x33')]){_0x318caf[_0x27ea('0x43')]=_['merge'](_0x318caf[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x318caf[_0x27ea('0x4b')],function(_0x5231a9){var _0x4e23fe={};_0x4e23fe[_0x5231a9]={'$like':'%'+_0x49b093[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x4e23fe;})});}_0x318caf=_[_0x27ea('0x61')]({},_0x318caf,_0x49b093['options']);return _0x58506d['getWhatsappInteractions'](_0x318caf);}})[_0x27ea('0x16')](function(_0x37e22f){if(_0x37e22f){_0x3509cd=_0x37e22f[_0x27ea('0x50')];if(!_0x49b093[_0x27ea('0x46')][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0x318caf[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x49b093[_0x27ea('0x46')][_0x27ea('0x27')]);_0x318caf[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x49b093[_0x27ea('0x46')][_0x27ea('0x25')]);}return _0x58506d['getWhatsappInteractions'](_0x318caf);}})[_0x27ea('0x16')](function(_0x468885){if(_0x468885){return _0x468885?{'count':_0x3509cd,'rows':_0x468885}:null;}})[_0x27ea('0x16')](respondWithResult(_0x460625,null))[_0x27ea('0x21')](handleError(_0x460625,null));};exports['login']=function(_0x33e441,_0x12a5ee,_0x30c8ca){var _0x588e9c;var _0xb902c;var _0x30345f;var _0x185de3=!_[_0x27ea('0x6d')](_0x33e441[_0x27ea('0x65')]['id'])?_0x33e441[_0x27ea('0x65')]['id']:!_[_0x27ea('0x6d')](_0x33e441[_0x27ea('0x2f')]['id'])?_0x33e441['user']['id']:null;return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x185de3,'role':{'$or':[_0x27ea('0x86'),'user','agent']}},'attributes':['id',_0x27ea('0x3a'),_0x27ea('0xeb'),_0x27ea('0xec'),_0x27ea('0x38'),_0x27ea('0x67'),_0x27ea('0xa4')]})[_0x27ea('0x16')](function(_0x4dfeb6){if(_0x4dfeb6){if(_0x4dfeb6[_0x27ea('0x38')]===_0x27ea('0x31')){_0x588e9c=_0x4dfeb6;if(_0x33e441[_0x27ea('0x63')][_0x27ea('0xa6')]){_0x30345f=util[_0x27ea('0xed')](_0x27ea('0xee'),_0x588e9c[_0x33e441[_0x27ea('0x63')][_0x27ea('0xa6')]]);}else if(_0x33e441['body'][_0x27ea('0xef')]){_0x30345f=util[_0x27ea('0xed')](_0x27ea('0xf0'),_0x33e441['body'][_0x27ea('0xef')]);}else{_0x30345f=util['format'](_0x27ea('0xf0'),_0x588e9c[_0x27ea('0x3a')]);}socket['to'](util['format'](_0x27ea('0xf1'),_0x588e9c[_0x27ea('0x3a')]))['emit'](_0x27ea('0xf2'),{'user':{'id':_0x588e9c['id'],'name':_0x588e9c[_0x27ea('0x3a')]},'ip':_0x33e441[_0x27ea('0xf3')][_0x27ea('0xf4')]||_0x33e441[_0x27ea('0xf5')][_0x27ea('0xf6')]||_0x33e441[_0x27ea('0xf7')][_0x27ea('0xf6')]||_0x33e441[_0x27ea('0xf5')][_0x27ea('0xf7')][_0x27ea('0xf6')]});return db[_0x27ea('0xb6')][_0x27ea('0x2c')]({'where':{'membername':_0x588e9c['name']},'individualHooks':!![]});}}else{throw new db[(_0x27ea('0x96'))][(_0x27ea('0x99'))](_0x27ea('0xf8'));}})['then'](function(){if(_0x588e9c){return _0x588e9c[_0x27ea('0xf9')]({'raw':!![]});}})[_0x27ea('0x16')](function(_0x3e4b86){if(_0x588e9c){if(_0x3e4b86){_0xb902c=_0x3e4b86;if(_0xb902c[_0x27ea('0x50')]){var _0x33373c=_0xb902c[_0x27ea('0x35')](function(_0x4f7660){var _0x254484={'membername':_0x588e9c[_0x27ea('0x3a')],'UserId':_0x588e9c['id'],'queue_name':_0x4f7660[_0x27ea('0x3a')],'VoiceQueueId':_0x4f7660['id'],'interface':_0x30345f,'paused':_0x588e9c[_0x27ea('0xa4')]||![],'penalty':_0x4f7660[_0x27ea('0xfa')]||0x0};return db[_0x27ea('0xb6')]['upsert'](_0x254484);});return Promise['all'](_0x33373c);}}}})[_0x27ea('0x16')](function(){if(_0x588e9c){return db[_0x27ea('0xfb')][_0x27ea('0x4d')]({'where':{'membername':_0x588e9c['name'],'exitAt':null}});}})['then'](function(_0x572305){if(_0x588e9c){var _0x15dc04=[];_0x572305[_0x27ea('0xfc')](function(_0x5f93cd){_0x15dc04[_0x27ea('0x4c')](_0x5f93cd[_0x27ea('0x2a')]({'exitAt':moment()[_0x27ea('0xed')](_0x27ea('0xfd'))}));});return Promise[_0x27ea('0x58')](_0x15dc04);}})[_0x27ea('0x16')](function(){if(_0x588e9c){var _0x5c4263=[];var _0x4a5a8d=[];var _0x29a70b=utils[_0x27ea('0xfe')]();var _0x1e027f={'membername':_0x588e9c[_0x27ea('0x3a')],'interface':_0x30345f,'enterAt':moment()['format'](_0x27ea('0xfd')),'role':_0x588e9c[_0x27ea('0x38')],'internal':_0x588e9c['internal']};_0x29a70b[_0x27ea('0xfc')](function(_0x2799df){_0x5c4263[_0x27ea('0x4c')](_[_0x27ea('0x61')]({'channel':_0x2799df,'type':_0x27ea('0xff'),'data1':_0x33e441['body']['device'],'data2':_0x30345f},_0x1e027f));if(_0x588e9c[_0x27ea('0xa4')]){_0x4a5a8d[_0x27ea('0x4c')](_['merge']({'channel':_0x2799df,'type':'PAUSE','data1':_0x27ea('0x100')},_0x1e027f));}});return db[_0x27ea('0xfb')][_0x27ea('0x8e')](_0x5c4263[_0x27ea('0x101')](_0x4a5a8d),{'individualHooks':!![]});}})[_0x27ea('0x16')](function(){if(_0x588e9c){return _0x588e9c[_0x27ea('0x2a')]({'online':!![],'lastLoginAt':moment()['format'](_0x27ea('0xfd')),'voicePause':_0x588e9c[_0x27ea('0xa4')]||![],'mailPause':_0x588e9c[_0x27ea('0xa4')]||![],'chatPause':_0x588e9c[_0x27ea('0xa4')]||![],'faxPause':_0x588e9c[_0x27ea('0xa4')]||![],'smsPause':_0x588e9c[_0x27ea('0xa4')]||![],'openchannelPause':_0x588e9c[_0x27ea('0xa4')]||![],'whatsappPause':_0x588e9c[_0x27ea('0xa4')]||![],'pauseType':_0x588e9c[_0x27ea('0xa4')]?_0x27ea('0x100'):null,'interface':_0x30345f,'lastPauseAt':moment()[_0x27ea('0xed')](_0x27ea('0xfd'))});}})[_0x27ea('0x16')](function(_0x3f054b){if(_0x33e441['isMiddleware']){return _0x30c8ca();}else{return Promise[_0x27ea('0x102')](_0x3f054b)[_0x27ea('0x16')](respondWithResult(_0x12a5ee,null));}})[_0x27ea('0x21')](handleError(_0x12a5ee,null));};exports[_0x27ea('0x103')]=function(_0x7029fb,_0x16b741){var _0x4412d9;return db['User'][_0x27ea('0x39')]({'where':{'id':_0x7029fb[_0x27ea('0x65')]['id'],'role':_0x27ea('0x31')},'attributes':['id',_0x27ea('0x3a'),_0x27ea('0x38')]})[_0x27ea('0x16')](handleEntityNotFound(_0x16b741,null))[_0x27ea('0x16')](function(_0x3c1e7d){if(_0x3c1e7d){_0x4412d9=_0x3c1e7d;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x4412d9[_0x27ea('0x3a')]},'individualHooks':!![]});}})[_0x27ea('0x16')](function(){return db[_0x27ea('0xfb')][_0x27ea('0x4d')]({'where':{'membername':_0x4412d9[_0x27ea('0x3a')],'exitAt':null}});})[_0x27ea('0x16')](function(_0x68a2a4){var _0x19b1be=[];_0x68a2a4[_0x27ea('0xfc')](function(_0x4d1d54){_0x19b1be[_0x27ea('0x4c')](_0x4d1d54[_0x27ea('0x2a')]({'exitAt':moment()['format'](_0x27ea('0xfd'))}));});return Promise[_0x27ea('0x58')](_0x19b1be);})[_0x27ea('0x16')](function(){return _0x4412d9[_0x27ea('0x2a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x16b741,null))[_0x27ea('0x21')](handleError(_0x16b741,null));};exports['pause']=function(_0x2a5e38,_0x24bca0){var _0x70c83f;return db[_0x27ea('0xb6')]['update']({'paused':0x1},{'where':{'UserId':_0x2a5e38[_0x27ea('0x65')]['id']},'individualHooks':!![]})[_0x27ea('0x16')](function(){return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x2a5e38[_0x27ea('0x65')]['id'],'role':'agent'},'attributes':['id','name',_0x27ea('0x38'),_0x27ea('0x67'),'interface',_0x27ea('0xa3')]});})[_0x27ea('0x16')](handleEntityNotFound(_0x24bca0,null))[_0x27ea('0x16')](function(_0x5f1887){if(_0x5f1887){_0x70c83f=_0x5f1887;return respondWithRpcPromise(_0x27ea('0x104'),_0x27ea('0x105'),{'id':_0x70c83f['id'],'name':_0x70c83f['name'],'pause':!![]});}})[_0x27ea('0x16')](function(){if(_0x70c83f){return db[_0x27ea('0xfb')]['findAll']({'where':{'membername':_0x70c83f['name'],'type':_0x27ea('0x106'),'exitAt':null}});}})[_0x27ea('0x16')](function(_0x35e733){if(_0x35e733[_0x27ea('0x50')]){var _0x10b291=moment()[_0x27ea('0xed')](_0x27ea('0xfd'));for(var _0x4b8f3e=0x0,_0x411194=_0x35e733[_0x27ea('0x50')];_0x4b8f3e<_0x411194;_0x4b8f3e++){_0x35e733[_0x4b8f3e]['updateAttributes']({'exitAt':_0x10b291});}}})[_0x27ea('0x16')](function(){var _0x30e5dc=[];var _0xc6986a=utils[_0x27ea('0xfe')]();_0xc6986a[_0x27ea('0xfc')](function(_0x50fcab){_0x30e5dc[_0x27ea('0x4c')]({'channel':_0x50fcab,'membername':_0x70c83f[_0x27ea('0x3a')],'interface':_['isNil'](_0x70c83f['interface'])?util[_0x27ea('0xed')](_0x27ea('0xf0'),_0x70c83f[_0x27ea('0x3a')]):_0x70c83f[_0x27ea('0xa6')],'type':_0x27ea('0x106'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2a5e38[_0x27ea('0x63')][_0x27ea('0x3f')]||_0x27ea('0x107'),'role':_0x70c83f['role'],'internal':_0x70c83f[_0x27ea('0x67')]});});return db[_0x27ea('0xfb')][_0x27ea('0x8e')](_0x30e5dc,{'individualHooks':!![]});})[_0x27ea('0x16')](function(){return _0x70c83f[_0x27ea('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2a5e38[_0x27ea('0x63')][_0x27ea('0x3f')]||_0x27ea('0x107'),'lastPauseAt':moment()[_0x27ea('0xed')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x24bca0,null))['catch'](handleError(_0x24bca0,null));};exports[_0x27ea('0x108')]=function(_0x2e1a6b,_0x585e2b){if(_0x2e1a6b[_0x27ea('0x63')][_0x27ea('0xa2')]&&!utils[_0x27ea('0xa7')](_0x2e1a6b['body'][_0x27ea('0xa2')])){throw new APIBadRequestError(util[_0x27ea('0xed')](_0x27ea('0x109'),_0x2e1a6b[_0x27ea('0x63')][_0x27ea('0xa2')]));}return db[_0x27ea('0x44')][_0x27ea('0x39')]({'where':{'id':_0x2e1a6b['params']['id']},'attributes':['id',_0x27ea('0x3a'),_0x27ea('0x38'),_0x27ea('0x67'),_0x27ea('0xa6'),_0x27ea('0xa3'),'voicePause',_0x27ea('0x10a'),'chatPause',_0x27ea('0x10b'),_0x27ea('0x10c'),_0x27ea('0x10d'),_0x27ea('0x10e'),_0x27ea('0x10f'),_0x27ea('0x110')]})[_0x27ea('0x16')](function(_0x6a8dfc){if(!_0x6a8dfc){throw new APINotFoundError(util[_0x27ea('0xed')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2e1a6b['params']['id']));}return _0x6a8dfc['unpause'](_0x2e1a6b['body'][_0x27ea('0xa2')]);})[_0x27ea('0x16')](respondWithResult(_0x585e2b,null))[_0x27ea('0x21')](APIHandleError(_0x585e2b));};exports['getTeams']=function(_0x4f47d2,_0x324869){var _0xcc007d={};var _0x5fe2dd={};var _0x4d3f8b;var _0x2eef82;return db[_0x27ea('0x44')]['findOne']({'where':{'id':_0x4f47d2['params']['id']}})[_0x27ea('0x16')](handleEntityNotFound(_0x324869,null))[_0x27ea('0x16')](function(_0x1e5a71){if(_0x1e5a71){_0x4d3f8b=_0x1e5a71;_0x5fe2dd['model']=_['keys'](db['Team']['rawAttributes']);_0x5fe2dd['query']=_[_0x27ea('0x5c')](_0x4f47d2[_0x27ea('0x46')]);_0x5fe2dd[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x5fe2dd[_0x27ea('0x5a')],_0x5fe2dd[_0x27ea('0x46')]);_0xcc007d['attributes']=_[_0x27ea('0x5e')](_0x5fe2dd[_0x27ea('0x5a')],qs['fields'](_0x4f47d2[_0x27ea('0x46')]['fields']));_0xcc007d['attributes']=_0xcc007d['attributes'][_0x27ea('0x50')]?_0xcc007d[_0x27ea('0x4b')]:_0x5fe2dd[_0x27ea('0x5a')];_0xcc007d[_0x27ea('0xce')]=qs['sort'](_0x4f47d2['query'][_0x27ea('0xd9')]);_0xcc007d[_0x27ea('0x43')]=qs['filters'](_['pick'](_0x4f47d2[_0x27ea('0x46')],_0x5fe2dd[_0x27ea('0x5d')]));if(_0x4f47d2[_0x27ea('0x46')][_0x27ea('0x33')]){_0xcc007d['where']=_[_0x27ea('0x61')](_0xcc007d[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0xcc007d[_0x27ea('0x4b')],function(_0x5619a3){var _0x1ae8b8={};_0x1ae8b8[_0x5619a3]={'$like':'%'+_0x4f47d2[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x1ae8b8;})});}_0xcc007d=_[_0x27ea('0x61')]({},_0xcc007d,_0x4f47d2[_0x27ea('0x62')]);return _0x4d3f8b[_0x27ea('0x111')](_0xcc007d);}})[_0x27ea('0x16')](function(_0x57250b){if(_0x57250b){_0x2eef82=_0x57250b[_0x27ea('0x50')];if(!_0x4f47d2['query'][_0x27ea('0xd0')](_0x27ea('0xd5'))){_0xcc007d[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x4f47d2['query'][_0x27ea('0x27')]);_0xcc007d[_0x27ea('0x25')]=qs['offset'](_0x4f47d2[_0x27ea('0x46')]['offset']);}return _0x4d3f8b[_0x27ea('0x111')](_0xcc007d);}})[_0x27ea('0x16')](function(_0x15d45e){if(_0x15d45e){return _0x15d45e?{'count':_0x2eef82,'rows':_0x15d45e}:null;}})[_0x27ea('0x16')](respondWithResult(_0x324869,null))[_0x27ea('0x21')](handleError(_0x324869,null));};exports[_0x27ea('0x112')]=function(_0x12304e,_0x4e8626){var _0x539df8=_0x12304e[_0x27ea('0x65')]['id'];var _0x1e7656=_0x12304e[_0x27ea('0x63')]?_0x12304e[_0x27ea('0x63')]['ids']:null;var _0x4b3ddc=[];return Promise[_0x27ea('0x102')]()[_0x27ea('0x16')](function(){if(!_0x1e7656)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x27ea('0x16')](function(){return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x539df8}});})[_0x27ea('0x16')](function(_0x2d440d){if(!_0x2d440d)throw new APINotFoundError(util[_0x27ea('0xed')](_0x27ea('0x113'),_0x12304e[_0x27ea('0x65')]['id']));return db[_0x27ea('0x6e')][_0x27ea('0x114')](function(_0x31f6f0){return _0x2d440d[_0x27ea('0x112')](_0x1e7656,{'transaction':_0x31f6f0})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x1e7656}}});})[_0x27ea('0x16')](function(_0x33b5e8){var _0x5768f5=_[_0x27ea('0x35')](_0x33b5e8,function(_0x4e0b6c){return _0x4e0b6c[_0x27ea('0x115')]();});return Promise[_0x27ea('0x58')](_0x5768f5);})[_0x27ea('0x16')](function(_0x5a93e6){_0x4b3ddc=_[_0x27ea('0x116')](_0x5a93e6);var _0x163485=_[_0x27ea('0x35')](_0x4b3ddc,function(_0x16d2de){return _0x16d2de[_0x27ea('0x117')](_0x2d440d['id'],{'transaction':_0x31f6f0});});return Promise['all'](_0x163485);})['then'](function(){if(!_0x2d440d[_0x27ea('0xa3')])return;var _0x48f5a5=_['filter'](_0x4b3ddc,function(_0x103279){return _0x103279[_0x27ea('0x118')]('channel')===_0x27ea('0x119');});var _0x29ec8e=_['map'](_0x48f5a5,function(_0x2bb744){return db[_0x27ea('0xb6')][_0x27ea('0xb0')]({'membername':_0x2d440d[_0x27ea('0x3a')],'UserId':_0x2d440d['id'],'queue_name':_0x2bb744[_0x27ea('0x3a')],'VoiceQueueId':_0x2bb744['id'],'interface':_['isNil'](_0x2d440d[_0x27ea('0xa6')])?util[_0x27ea('0xed')](_0x27ea('0xf0'),_0x2d440d[_0x27ea('0x3a')]):_0x2d440d['interface'],'paused':_0x2d440d['voicePause']||![],'penalty':_0x2d440d[_0x27ea('0xac')]},{'transaction':_0x31f6f0});});return Promise['all'](_0x29ec8e);})[_0x27ea('0x16')](function(){return db[_0x27ea('0x11a')]['findAll']({'where':{'teamId':{'$in':_0x1e7656}}});})['then'](function(_0x4b72a0){var _0x1f0b1f=_['map'](_0x4b72a0,function(_0x4bfc64){return db[_0x27ea('0x11b')][_0x27ea('0x8b')]({'UserId':_0x2d440d['id'],'VoicePrefixId':_0x4bfc64[_0x27ea('0x11c')]},{'transaction':_0x31f6f0});});return Promise['all'](_0x1f0b1f);});});})[_0x27ea('0x16')](function(){for(var _0x407648=0x0;_0x407648<_0x4b3ddc['length'];_0x407648++){var _0x36b6ee=_0x4b3ddc[_0x407648][_0x27ea('0x118')](_0x27ea('0xa2'));var _0x3aa161=_0x36b6ee+_0x27ea('0xb4');socket[_0x27ea('0x2b')](_0x27ea('0x2f')+_0x36b6ee+'Queue:save',{'UserId':_0x539df8,['queueField']:_0x4b3ddc[_0x407648]['id']});}})[_0x27ea('0x16')](respondWithStatusCode(_0x4e8626,null))[_0x27ea('0x21')](APIHandleError(_0x4e8626));};exports['removeTeams']=function(_0x2ab206,_0x1d7e28){var _0x4784c5=_0x2ab206['params']['id'];var _0x6313a0=null;if(_0x2ab206[_0x27ea('0x46')][_0x27ea('0x66')]){_0x6313a0=_[_0x27ea('0xb3')](_0x2ab206[_0x27ea('0x46')]['ids'])?_0x2ab206[_0x27ea('0x46')]['ids']:[_0x2ab206[_0x27ea('0x46')][_0x27ea('0x66')]];}var _0x423f3a=[];return Promise['resolve']()[_0x27ea('0x16')](function(){if(!_0x6313a0)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x27ea('0x16')](function(){return db['User'][_0x27ea('0xd7')]({'where':{'id':_0x4784c5}});})[_0x27ea('0x16')](function(_0x100ac3){if(!_0x100ac3)throw new APINotFoundError(util[_0x27ea('0xed')](_0x27ea('0x113'),_0x2ab206[_0x27ea('0x65')]['id']));return db['sequelize'][_0x27ea('0x114')](function(_0x4b385f){return _0x100ac3[_0x27ea('0x11d')](_0x6313a0,{'transaction':_0x4b385f})[_0x27ea('0x16')](function(){return db[_0x27ea('0x11e')]['findAll']({'where':{'id':{'$in':_0x6313a0}}});})[_0x27ea('0x16')](function(_0x2174e5){var _0x2bd0e9=_['map'](_0x2174e5,function(_0x482c8a){return _0x482c8a[_0x27ea('0x115')]();});return Promise[_0x27ea('0x58')](_0x2bd0e9);})[_0x27ea('0x16')](function(_0x12b7f6){_0x423f3a=_['flattenDeep'](_0x12b7f6);var _0x47fbee=_[_0x27ea('0x35')](_0x423f3a,function(_0x10c102){return _0x10c102[_0x27ea('0x11f')](_0x100ac3['id'],{'transaction':_0x4b385f});});return Promise[_0x27ea('0x58')](_0x47fbee);})[_0x27ea('0x16')](function(){if(!_0x100ac3[_0x27ea('0xa3')])return;var _0xfeb3ea=_[_0x27ea('0x33')](_0x423f3a,function(_0x2c1107){return _0x2c1107[_0x27ea('0x118')]('channel')===_0x27ea('0x119');});var _0x53fee8=_[_0x27ea('0x35')](_0xfeb3ea,function(_0x147a0b){return db[_0x27ea('0xb6')]['destroy']({'where':{'VoiceQueueId':_0x147a0b['id'],'UserId':_0x100ac3['id']},'transaction':_0x4b385f});});return Promise[_0x27ea('0x58')](_0x53fee8);})[_0x27ea('0x16')](function(){return db[_0x27ea('0x11a')][_0x27ea('0x4d')]({'where':{'teamId':{'$in':_0x6313a0}}});})[_0x27ea('0x16')](function(_0x2886f3){var _0x2073c0=_[_0x27ea('0x35')](_0x2886f3,function(_0x1b4b98){return db[_0x27ea('0x11b')]['destroy']({'where':{'UserId':_0x100ac3['id'],'VoicePrefixId':_0x1b4b98[_0x27ea('0x11c')]}},{'transaction':_0x4b385f});});return Promise[_0x27ea('0x58')](_0x2073c0);});});})['then'](function(){for(var _0x4e7807=0x0;_0x4e7807<_0x423f3a[_0x27ea('0x50')];_0x4e7807++){var _0x31e8fc=_0x423f3a[_0x4e7807][_0x27ea('0x118')](_0x27ea('0xa2'));var _0x5fb44b=_0x31e8fc+_0x27ea('0xb4');socket[_0x27ea('0x2b')](_0x27ea('0x2f')+_0x31e8fc+_0x27ea('0xb5'),{'UserId':_0x4784c5,['queueField']:_0x423f3a[_0x4e7807]['id']});}})[_0x27ea('0x16')](respondWithStatusCode(_0x1d7e28,null))[_0x27ea('0x21')](APIHandleError(_0x1d7e28));};exports[_0x27ea('0x120')]=function(_0x30024f,_0x51f847){var _0xcfda99={};var _0x1f749a={};var _0x822255;var _0x2d4222;return db['User']['findOne']({'where':{'id':_0x30024f[_0x27ea('0x65')]['id']}})['then'](handleEntityNotFound(_0x51f847,null))['then'](function(_0x4bc340){if(_0x4bc340){_0x822255=_0x4bc340;_0x1f749a[_0x27ea('0x5a')]=_[_0x27ea('0x5c')](db[_0x27ea('0xd1')][_0x27ea('0xd8')]);_0x1f749a[_0x27ea('0x46')]=_['keys'](_0x30024f['query']);_0x1f749a[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x1f749a[_0x27ea('0x5a')],_0x1f749a['query']);_0xcfda99[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x1f749a[_0x27ea('0x5a')],qs['fields'](_0x30024f[_0x27ea('0x46')][_0x27ea('0x5f')]));_0xcfda99[_0x27ea('0x4b')]=_0xcfda99[_0x27ea('0x4b')][_0x27ea('0x50')]?_0xcfda99[_0x27ea('0x4b')]:_0x1f749a[_0x27ea('0x5a')];_0xcfda99[_0x27ea('0xce')]=qs[_0x27ea('0xd9')](_0x30024f[_0x27ea('0x46')]['sort']);_0xcfda99['where']=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x30024f[_0x27ea('0x46')],_0x1f749a['filters']));if(_0x30024f['query'][_0x27ea('0x33')]){_0xcfda99[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0xcfda99[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0xcfda99['attributes'],function(_0xaecbc6){var _0x4300b2={};_0x4300b2[_0xaecbc6]={'$like':'%'+_0x30024f[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x4300b2;})});}_0xcfda99=_[_0x27ea('0x61')]({},_0xcfda99,_0x30024f[_0x27ea('0x62')]);return _0x822255[_0x27ea('0x120')](_0xcfda99);}})[_0x27ea('0x16')](function(_0x2dc808){if(_0x2dc808){_0x2d4222=_0x2dc808[_0x27ea('0x50')];if(!_0x30024f[_0x27ea('0x46')][_0x27ea('0xd0')]('nolimit')){_0xcfda99[_0x27ea('0x27')]=qs[_0x27ea('0x27')](_0x30024f[_0x27ea('0x46')]['limit']);_0xcfda99[_0x27ea('0x25')]=qs[_0x27ea('0x25')](_0x30024f['query'][_0x27ea('0x25')]);}return _0x822255[_0x27ea('0x120')](_0xcfda99);}})[_0x27ea('0x16')](function(_0x45cfb2){if(_0x45cfb2){return _0x45cfb2?{'count':_0x2d4222,'rows':_0x45cfb2}:null;}})[_0x27ea('0x16')](respondWithResult(_0x51f847,null))[_0x27ea('0x21')](handleError(_0x51f847,null));};exports[_0x27ea('0x121')]=function(_0x3ba5d3,_0x2a48bb){var _0x3daf77={};var _0x3e8e6f={};var _0x27eb07;return db[_0x27ea('0x44')][_0x27ea('0xd7')]({'where':{'id':_0x3ba5d3[_0x27ea('0x65')]['id']}})['then'](handleEntityNotFound(_0x2a48bb,null))[_0x27ea('0x16')](function(_0x464d91){if(_0x464d91){_0x27eb07=_0x464d91;_0x3e8e6f[_0x27ea('0x5a')]=_['keys'](db['User'][_0x27ea('0xd8')]);_0x3e8e6f[_0x27ea('0x46')]=_[_0x27ea('0x5c')](_0x3ba5d3[_0x27ea('0x46')]);_0x3e8e6f[_0x27ea('0x5d')]=_[_0x27ea('0x5e')](_0x3e8e6f[_0x27ea('0x5a')],_0x3e8e6f[_0x27ea('0x46')]);_0x3daf77[_0x27ea('0x4b')]=_[_0x27ea('0x5e')](_0x3e8e6f[_0x27ea('0x5a')],qs[_0x27ea('0x5f')](_0x3ba5d3['query'][_0x27ea('0x5f')]));_0x3daf77[_0x27ea('0x4b')]=_0x3daf77[_0x27ea('0x4b')]['length']?_0x3daf77['attributes']:_0x3e8e6f['model'];_0x3daf77['order']=qs[_0x27ea('0xd9')](_0x3ba5d3['query'][_0x27ea('0xd9')]);_0x3daf77[_0x27ea('0x43')]=qs[_0x27ea('0x5d')](_[_0x27ea('0xcf')](_0x3ba5d3['query'],_0x3e8e6f[_0x27ea('0x5d')]));if(_0x3ba5d3[_0x27ea('0x46')][_0x27ea('0x33')]){_0x3daf77[_0x27ea('0x43')]=_[_0x27ea('0x61')](_0x3daf77[_0x27ea('0x43')],{'$or':_[_0x27ea('0x35')](_0x3daf77[_0x27ea('0x4b')],function(_0x388eb9){var _0x52c8b4={};_0x52c8b4[_0x388eb9]={'$like':'%'+_0x3ba5d3[_0x27ea('0x46')][_0x27ea('0x33')]+'%'};return _0x52c8b4;})});}_0x3daf77[_0x27ea('0x5a')]=db[_0x27ea('0x44')];_0x3daf77['as']=_0x27ea('0x30');_0x3daf77=_[_0x27ea('0x61')]({},_0x3daf77,_0x3ba5d3[_0x27ea('0x62')]);return _0x27eb07[_0x27ea('0xf9')]({'include':[_0x3daf77]});}})[_0x27ea('0x16')](function(_0x2cd53){if(_0x2cd53){var _0x52f719={},_0x35d181=[];for(var _0x56c0ec=0x0;_0x56c0ec<_0x2cd53[_0x27ea('0x50')];_0x56c0ec+=0x1){for(var _0x3f7b2e=0x0,_0x23b9de;_0x3f7b2e<_0x2cd53[_0x56c0ec]['Agents']['length'];_0x3f7b2e+=0x1){_0x23b9de=_0x2cd53[_0x56c0ec][_0x27ea('0x30')][_0x3f7b2e][_0x27ea('0x2d')]({'plain':!![]});_0x52f719[_0x23b9de['id']]=_0x23b9de;}}_0x52f719=_[_0x27ea('0x122')](_0x52f719);for(var _0x561bdc=qs[_0x27ea('0x25')](_0x3ba5d3[_0x27ea('0x46')][_0x27ea('0x25')]);_0x561bdc<_0x52f719['length']&&_0x35d181[_0x27ea('0x50')]=_0x518b9f[_0x6991('0x4a')]){throw new Error(_0x6991('0x4b'));}})['then'](function(){if(_0x42a7c7){return db[_0x6991('0x21')][_0x6991('0x3e')]({'where':{'membername':_0x42a7c7[_0x6991('0x1d')]},'individualHooks':!![]});}})[_0x6991('0x14')](function(){if(_0x42a7c7){return _0x42a7c7[_0x6991('0x4c')]({'raw':!![]});}})[_0x6991('0x14')](function(_0x594528){if(_0x42a7c7){if(_0x594528){var _0x466456=[];_0x40a7f3=_0x594528;if(_0x40a7f3['length']){for(var _0x1e2795=0x0;_0x1e2795<_0x40a7f3[_0x6991('0x24')];_0x1e2795++){_0x466456[_0x6991('0x3f')](db[_0x6991('0x21')]['upsert']({'membername':_0x42a7c7[_0x6991('0x1d')],'UserId':_0x42a7c7['id'],'queue_name':_0x40a7f3[_0x1e2795][_0x6991('0x1d')],'VoiceQueueId':_0x40a7f3[_0x1e2795]['id'],'interface':_0x3cc003,'paused':_0x42a7c7[_0x6991('0x44')]||![],'penalty':_0x40a7f3[_0x1e2795][_0x6991('0x4d')]||0x0}));}return BPromise[_0x6991('0x40')](_0x466456);}}}})[_0x6991('0x14')](function(){if(_0x42a7c7){return db['MemberReport']['findAll']({'where':{'membername':_0x42a7c7['name'],'exitAt':null}});}})[_0x6991('0x14')](function(_0x43a1b1){if(_0x42a7c7){if(_0x43a1b1&&_0x43a1b1[_0x6991('0x24')]){var _0x3e4f4a=[];_0x43a1b1[_0x6991('0x28')](function(_0x249400){_0x3e4f4a[_0x6991('0x3f')](_0x249400[_0x6991('0x22')]({'exitAt':moment()[_0x6991('0x2a')](_0x6991('0x25'))}));});return BPromise[_0x6991('0x40')](_0x3e4f4a);}}})['then'](function(){if(_0x42a7c7){var _0x503381=[];var _0x4e1d41=[];var _0x3845aa=utils[_0x6991('0x27')]();var _0x59cca8={'membername':_0x42a7c7[_0x6991('0x1d')],'interface':_0x3cc003,'enterAt':moment()['format'](_0x6991('0x25')),'role':_0x42a7c7['role'],'internal':_0x42a7c7[_0x6991('0x1f')]};_0x3845aa['forEach'](function(_0x40e019){_0x503381[_0x6991('0x3f')](_[_0x6991('0x4e')]({'channel':_0x40e019,'type':_0x6991('0x4f'),'data1':_0x6991('0x50'),'data2':_0x3cc003},_0x59cca8));if(_0x42a7c7[_0x6991('0x44')]){_0x4e1d41['push'](_['merge']({'channel':_0x40e019,'type':_0x6991('0x23'),'data1':'LOGININPAUSE'},_0x59cca8));}});return db['MemberReport'][_0x6991('0x30')](_0x503381[_0x6991('0x51')](_0x4e1d41),{'individualHooks':!![]});}})[_0x6991('0x14')](function(){if(_0x42a7c7){return _0x42a7c7[_0x6991('0x22')]({'online':!![],'lastLoginAt':moment()[_0x6991('0x2a')](_0x6991('0x25')),'voicePause':_0x42a7c7[_0x6991('0x44')]||![],'mailPause':_0x42a7c7[_0x6991('0x44')]||![],'chatPause':_0x42a7c7['loginInPause']||![],'faxPause':_0x42a7c7[_0x6991('0x44')]||![],'smsPause':_0x42a7c7[_0x6991('0x44')]||![],'openchannelPause':_0x42a7c7[_0x6991('0x44')]||![],'pauseType':_0x42a7c7[_0x6991('0x44')]?_0x6991('0x52'):null,'lastPauseAt':moment()[_0x6991('0x2a')](_0x6991('0x25')),'interface':_0x3cc003});}})['then'](function(_0x4fcb1e){_0x362824(_0x4fcb1e);})['catch'](function(_0x20ebe4){_0x475c63(_0x3d8116[_0x6991('0x1a')](0x1f4,_0x20ebe4['message']));});});}; \ No newline at end of file +var _0xda91=['format','SIP/%s','DEFAULT\x20PAUSE','role','internal','body','uniqueid','bulkCreate','update','type','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','chatPause','faxPause','openchannelPause','smsPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','destroy','all','findOne','mobile','loginInPause','count','getLicense','agents','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','limit','include','map','attributes','model','info','debug','stringify','catch','message','error','raw','then','ShowUser','PauseUser','find','interface','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','name','isNil'];(function(_0xab232d,_0x1540a9){var _0x301433=function(_0x553376){while(--_0x553376){_0xab232d['push'](_0xab232d['shift']());}};_0x301433(++_0x1540a9);}(_0xda91,0x7c));var _0x1da9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xda91[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1da9('0x0'));var util=require(_0x1da9('0x1'));var moment=require(_0x1da9('0x2'));var BPromise=require(_0x1da9('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1da9('0x4'));var logger=require(_0x1da9('0x5'))(_0x1da9('0x6'));var config=require(_0x1da9('0x7'));config[_0x1da9('0x8')]=_['defaults'](config[_0x1da9('0x8')],{'host':_0x1da9('0x9'),'port':0x18eb});var socket=require(_0x1da9('0xa'))(new Redis(config[_0x1da9('0x8')]));require(_0x1da9('0xb'))[_0x1da9('0xc')](socket);exports[_0x1da9('0xd')]=function(_0x4e3f8a){var _0x31eeb0=this;return new Promise(function(_0x1c55ce,_0x3d4d86){return db[_0x1da9('0xe')][_0x1da9('0xf')]({'raw':_0x4e3f8a[_0x1da9('0x10')]?_0x4e3f8a[_0x1da9('0x10')]['raw']===undefined?!![]:![]:!![],'where':_0x4e3f8a['options']?_0x4e3f8a[_0x1da9('0x10')][_0x1da9('0x11')]||null:null,'attributes':_0x4e3f8a[_0x1da9('0x10')]?_0x4e3f8a[_0x1da9('0x10')]['attributes']||null:null,'limit':_0x4e3f8a[_0x1da9('0x10')]?_0x4e3f8a[_0x1da9('0x10')][_0x1da9('0x12')]||null:null,'include':_0x4e3f8a[_0x1da9('0x10')]?_0x4e3f8a[_0x1da9('0x10')][_0x1da9('0x13')]?_[_0x1da9('0x14')](_0x4e3f8a['options'][_0x1da9('0x13')],function(_0x125242){return{'model':db[_0x125242['model']],'as':_0x125242['as'],'attributes':_0x125242[_0x1da9('0x15')],'include':_0x125242[_0x1da9('0x13')]?_[_0x1da9('0x14')](_0x125242[_0x1da9('0x13')],function(_0x50b60a){return{'model':db[_0x50b60a[_0x1da9('0x16')]],'as':_0x50b60a['as'],'attributes':_0x50b60a[_0x1da9('0x15')],'include':_0x50b60a[_0x1da9('0x13')]?_[_0x1da9('0x14')](_0x50b60a['include'],function(_0x27178b){return{'model':db[_0x27178b[_0x1da9('0x16')]],'as':_0x27178b['as'],'attributes':_0x27178b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31216a){logger[_0x1da9('0x17')]('GetUser',_0x4e3f8a);logger[_0x1da9('0x18')](_0x1da9('0xd'),_0x4e3f8a,JSON[_0x1da9('0x19')](_0x31216a));_0x1c55ce(_0x31216a);})[_0x1da9('0x1a')](function(_0x5d21f0){logger['error'](_0x1da9('0xd'),_0x5d21f0[_0x1da9('0x1b')],_0x4e3f8a);_0x3d4d86(_0x31eeb0[_0x1da9('0x1c')](0x1f4,_0x5d21f0[_0x1da9('0x1b')]));});});};exports['ShowUser']=function(_0x318b4b){var _0x54ed4c=this;return new Promise(function(_0x11ba70,_0xdf4a34){return db[_0x1da9('0xe')]['find']({'raw':_0x318b4b[_0x1da9('0x10')]?_0x318b4b['options'][_0x1da9('0x1d')]===undefined?!![]:![]:!![],'where':_0x318b4b[_0x1da9('0x10')]?_0x318b4b[_0x1da9('0x10')][_0x1da9('0x11')]||null:null,'attributes':_0x318b4b[_0x1da9('0x10')]?_0x318b4b['options'][_0x1da9('0x15')]||null:null,'include':_0x318b4b[_0x1da9('0x10')]?_0x318b4b[_0x1da9('0x10')][_0x1da9('0x13')]?_[_0x1da9('0x14')](_0x318b4b[_0x1da9('0x10')][_0x1da9('0x13')],function(_0x30c778){return{'model':db[_0x30c778[_0x1da9('0x16')]],'as':_0x30c778['as'],'attributes':_0x30c778[_0x1da9('0x15')],'include':_0x30c778[_0x1da9('0x13')]?_[_0x1da9('0x14')](_0x30c778['include'],function(_0x1bc1cd){return{'model':db[_0x1bc1cd[_0x1da9('0x16')]],'as':_0x1bc1cd['as'],'attributes':_0x1bc1cd[_0x1da9('0x15')],'include':_0x1bc1cd['include']?_[_0x1da9('0x14')](_0x1bc1cd[_0x1da9('0x13')],function(_0x355f33){return{'model':db[_0x355f33[_0x1da9('0x16')]],'as':_0x355f33['as'],'attributes':_0x355f33[_0x1da9('0x15')]};}):[]};}):[]};}):[]:[]})[_0x1da9('0x1e')](function(_0x184aaf){logger[_0x1da9('0x17')](_0x1da9('0x1f'),_0x318b4b);logger[_0x1da9('0x18')](_0x1da9('0x1f'),_0x318b4b,JSON[_0x1da9('0x19')](_0x184aaf));_0x11ba70(_0x184aaf);})[_0x1da9('0x1a')](function(_0x3790d2){logger[_0x1da9('0x1c')](_0x1da9('0x1f'),_0x3790d2[_0x1da9('0x1b')],_0x318b4b);_0xdf4a34(_0x54ed4c[_0x1da9('0x1c')](0x1f4,_0x3790d2[_0x1da9('0x1b')]));});});};exports[_0x1da9('0x20')]=function(_0x2c824c){var _0x262c27=this;return new Promise(function(_0xb70296,_0x46644d){var _0x94c839;return db[_0x1da9('0xe')][_0x1da9('0x21')]({'where':_0x2c824c['options'][_0x1da9('0x11')]||{},'attributes':['id','name','role','internal',_0x1da9('0x22')]})['then'](function(_0x990a56){if(_0x990a56){_0x94c839=_0x990a56;return db[_0x1da9('0x23')]['update']({'paused':0x1},{'where':{'UserId':_0x94c839['id']},'individualHooks':!![]});}})[_0x1da9('0x1e')](function(){if(_0x94c839){return db[_0x1da9('0x24')][_0x1da9('0xf')]({'where':{'membername':_0x94c839['name'],'type':_0x1da9('0x25'),'exitAt':null}});}})['then'](function(_0x314bbb){if(_0x94c839){if(_0x314bbb&&_0x314bbb[_0x1da9('0x26')]){var _0x454e6b=moment()['format'](_0x1da9('0x27'));for(var _0x5c2d99=0x0,_0x4fdc2e=_0x314bbb[_0x1da9('0x26')];_0x5c2d99<_0x4fdc2e;_0x5c2d99++){_0x314bbb[_0x5c2d99][_0x1da9('0x28')]({'exitAt':_0x454e6b});}}}})[_0x1da9('0x1e')](function(){if(_0x94c839){var _0x209eda=[];var _0xcdc242=utils[_0x1da9('0x29')]();_0xcdc242[_0x1da9('0x2a')](function(_0x2f00bd){_0x209eda[_0x1da9('0x2b')]({'channel':_0x2f00bd,'membername':_0x94c839[_0x1da9('0x2c')],'interface':_[_0x1da9('0x2d')](_0x94c839[_0x1da9('0x22')])?util[_0x1da9('0x2e')](_0x1da9('0x2f'),_0x94c839[_0x1da9('0x2c')]):_0x94c839[_0x1da9('0x22')],'type':_0x1da9('0x25'),'enterAt':moment()[_0x1da9('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2c824c['body']['type']||_0x1da9('0x30'),'role':_0x94c839[_0x1da9('0x31')],'internal':_0x94c839[_0x1da9('0x32')],'uniqueid':_0x2c824c[_0x1da9('0x33')][_0x1da9('0x34')]||null});});return db[_0x1da9('0x24')][_0x1da9('0x35')](_0x209eda,{'individualHooks':!![]});}})[_0x1da9('0x1e')](function(){if(_0x94c839){return _0x94c839[_0x1da9('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2c824c[_0x1da9('0x33')][_0x1da9('0x37')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1da9('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x1da9('0x1e')](function(_0x3ee08e){_0xb70296(_0x3ee08e);})[_0x1da9('0x1a')](function(_0x439ed8){_0x46644d(_0x262c27[_0x1da9('0x1c')](0x1f4,_0x439ed8[_0x1da9('0x1b')]));});});};exports[_0x1da9('0x38')]=function(_0xb8caca){var _0x3a6d59=this;return new Promise(function(_0x59de71,_0x4fade4){if(_0xb8caca[_0x1da9('0x33')][_0x1da9('0x39')]&&!utils[_0x1da9('0x3a')](_0xb8caca[_0x1da9('0x33')][_0x1da9('0x39')])){throw new Error(util['format'](_0x1da9('0x3b'),_0xb8caca[_0x1da9('0x33')]['channel']));}return db[_0x1da9('0xe')]['findOne']({'where':_0xb8caca[_0x1da9('0x10')]['where']||{},'attributes':['id',_0x1da9('0x2c'),'role',_0x1da9('0x32'),'interface','online',_0x1da9('0x3c'),'mailPause',_0x1da9('0x3d'),_0x1da9('0x3e'),_0x1da9('0x3f'),_0x1da9('0x40'),'whatsappPause','pauseType',_0x1da9('0x41')]})[_0x1da9('0x1e')](function(_0x29d49a){if(!_0x29d49a){throw new Error(util[_0x1da9('0x2e')](_0x1da9('0x42'),_0xb8caca[_0x1da9('0x43')]['id']));}return _0x29d49a[_0x1da9('0x44')](_0xb8caca[_0x1da9('0x33')]['channel'],'system');})[_0x1da9('0x1e')](function(_0x96227c){_0x59de71(_0x96227c);})['catch'](function(_0x8ac06){_0x4fade4(_0x3a6d59[_0x1da9('0x1c')](0x1f4,_0x8ac06['message']));});});};exports['LogoutUser']=function(_0x2189d4){var _0x473406=this;return new Promise(function(_0x187c87,_0x215900){var _0x4fe344;return db[_0x1da9('0xe')]['findOne']({'where':_0x2189d4['options'][_0x1da9('0x11')]||{},'attributes':['id','name']})[_0x1da9('0x1e')](function(_0x45eb71){if(_0x45eb71){_0x4fe344=_0x45eb71;return db[_0x1da9('0x23')][_0x1da9('0x45')]({'where':{'membername':_0x4fe344['name']},'individualHooks':!![]});}})[_0x1da9('0x1e')](function(){if(_0x4fe344){return db[_0x1da9('0x24')][_0x1da9('0xf')]({'where':{'membername':_0x4fe344[_0x1da9('0x2c')],'exitAt':null}});}})[_0x1da9('0x1e')](function(_0x3d21a5){if(_0x4fe344){if(_0x3d21a5&&_0x3d21a5['length']){var _0x26ffe1=[];_0x3d21a5[_0x1da9('0x2a')](function(_0x594234){_0x26ffe1[_0x1da9('0x2b')](_0x594234['update']({'exitAt':moment()[_0x1da9('0x2e')](_0x1da9('0x27'))}));});return BPromise[_0x1da9('0x46')](_0x26ffe1);}}})[_0x1da9('0x1e')](function(){if(_0x4fe344){return _0x4fe344[_0x1da9('0x36')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1da9('0x1e')](function(_0xf76955){_0x187c87(_0xf76955);})['catch'](function(_0x353175){_0x215900(_0x473406[_0x1da9('0x1c')](0x1f4,_0x353175[_0x1da9('0x1b')]));});});};exports['LoginUser']=function(_0x11c47c){var _0xfbd9aa=this;return new Promise(function(_0x496273,_0x27619f){var _0x5f3f2a;var _0x438a66;var _0x4bc8c9;var _0x2edcb3;return db[_0x1da9('0xe')][_0x1da9('0x47')]({'where':_0x11c47c[_0x1da9('0x10')]['where']||{},'attributes':['id',_0x1da9('0x2c'),_0x1da9('0x31'),_0x1da9('0x48'),'phone','internal',_0x1da9('0x49'),_0x1da9('0x22')]})[_0x1da9('0x1e')](function(_0x2aba91){if(_0x2aba91){_0x5f3f2a=_0x2aba91;_0x2edcb3=_0x11c47c[_0x1da9('0x33')][_0x1da9('0x22')]?_0x11c47c['body']['interface']:util[_0x1da9('0x2e')](_0x1da9('0x2f'),_0x5f3f2a[_0x1da9('0x2c')]);return db[_0x1da9('0xe')][_0x1da9('0x4a')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5f3f2a['id']}}});}})[_0x1da9('0x1e')](function(_0x19bb3b){if(_0x19bb3b){_0x4bc8c9=_0x19bb3b;return require('../../config/license/util')[_0x1da9('0x4b')]();}})[_0x1da9('0x1e')](function(_0xa109ed){if(_0xa109ed&&_0xa109ed[_0x1da9('0x4c')]&&_0x4bc8c9>=_0xa109ed[_0x1da9('0x4c')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x1da9('0x1e')](function(){if(_0x5f3f2a){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x5f3f2a[_0x1da9('0x2c')]},'individualHooks':!![]});}})[_0x1da9('0x1e')](function(){if(_0x5f3f2a){return _0x5f3f2a[_0x1da9('0x4d')]({'raw':!![]});}})['then'](function(_0x5b38ad){if(_0x5f3f2a){if(_0x5b38ad){var _0x1f1dbe=[];_0x438a66=_0x5b38ad;if(_0x438a66[_0x1da9('0x26')]){for(var _0x2175d3=0x0;_0x2175d3<_0x438a66[_0x1da9('0x26')];_0x2175d3++){_0x1f1dbe['push'](db[_0x1da9('0x23')][_0x1da9('0x4e')]({'membername':_0x5f3f2a['name'],'UserId':_0x5f3f2a['id'],'queue_name':_0x438a66[_0x2175d3]['name'],'VoiceQueueId':_0x438a66[_0x2175d3]['id'],'interface':_0x2edcb3,'paused':_0x5f3f2a[_0x1da9('0x49')]||![],'penalty':_0x438a66[_0x2175d3][_0x1da9('0x4f')]||0x0}));}return BPromise[_0x1da9('0x46')](_0x1f1dbe);}}}})[_0x1da9('0x1e')](function(){if(_0x5f3f2a){return db['MemberReport']['findAll']({'where':{'membername':_0x5f3f2a[_0x1da9('0x2c')],'exitAt':null}});}})[_0x1da9('0x1e')](function(_0x597be9){if(_0x5f3f2a){if(_0x597be9&&_0x597be9['length']){var _0x12b553=[];_0x597be9['forEach'](function(_0x5757a3){_0x12b553[_0x1da9('0x2b')](_0x5757a3[_0x1da9('0x36')]({'exitAt':moment()[_0x1da9('0x2e')](_0x1da9('0x27'))}));});return BPromise[_0x1da9('0x46')](_0x12b553);}}})[_0x1da9('0x1e')](function(){if(_0x5f3f2a){var _0x2f7b53=[];var _0x5620f8=[];var _0x56253f=utils[_0x1da9('0x29')]();var _0x5be646={'membername':_0x5f3f2a[_0x1da9('0x2c')],'interface':_0x2edcb3,'enterAt':moment()[_0x1da9('0x2e')](_0x1da9('0x27')),'role':_0x5f3f2a['role'],'internal':_0x5f3f2a['internal']};_0x56253f[_0x1da9('0x2a')](function(_0x70db79){_0x2f7b53['push'](_[_0x1da9('0x50')]({'channel':_0x70db79,'type':_0x1da9('0x51'),'data1':_0x1da9('0x52'),'data2':_0x2edcb3},_0x5be646));if(_0x5f3f2a[_0x1da9('0x49')]){_0x5620f8[_0x1da9('0x2b')](_[_0x1da9('0x50')]({'channel':_0x70db79,'type':_0x1da9('0x25'),'data1':_0x1da9('0x53')},_0x5be646));}});return db['MemberReport'][_0x1da9('0x35')](_0x2f7b53[_0x1da9('0x54')](_0x5620f8),{'individualHooks':!![]});}})['then'](function(){if(_0x5f3f2a){return _0x5f3f2a[_0x1da9('0x36')]({'online':!![],'lastLoginAt':moment()[_0x1da9('0x2e')](_0x1da9('0x27')),'voicePause':_0x5f3f2a['loginInPause']||![],'mailPause':_0x5f3f2a[_0x1da9('0x49')]||![],'chatPause':_0x5f3f2a['loginInPause']||![],'faxPause':_0x5f3f2a['loginInPause']||![],'smsPause':_0x5f3f2a[_0x1da9('0x49')]||![],'openchannelPause':_0x5f3f2a[_0x1da9('0x49')]||![],'pauseType':_0x5f3f2a[_0x1da9('0x49')]?_0x1da9('0x53'):null,'lastPauseAt':moment()[_0x1da9('0x2e')](_0x1da9('0x27')),'interface':_0x2edcb3});}})[_0x1da9('0x1e')](function(_0x4bdb79){_0x496273(_0x4bdb79);})[_0x1da9('0x1a')](function(_0x3c2f0d){_0x27619f(_0xfbd9aa[_0x1da9('0x1c')](0x1f4,_0x3c2f0d['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index edac000..714feab 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 _0xc3fc=['user:','save','remove','update','removeListener','register','length'];(function(_0x1c713f,_0x20cb30){var _0x420ce6=function(_0x1d79f2){while(--_0x1d79f2){_0x1c713f['push'](_0x1c713f['shift']());}};_0x420ce6(++_0x20cb30);}(_0xc3fc,0x166));var _0xcc3f=function(_0x449b4e,_0x1ab937){_0x449b4e=_0x449b4e-0x0;var _0x32e387=_0xc3fc[_0x449b4e];return _0x32e387;};'use strict';var UserEvents=require('./user.events');var events=[_0xcc3f('0x0'),_0xcc3f('0x1'),_0xcc3f('0x2')];function createListener(_0x26a1be,_0x3ab311){return function(_0x574f7e){_0x3ab311['emit'](_0x26a1be,_0x574f7e);};}function removeListener(_0x1a7589,_0x3d8426){return function(){UserEvents[_0xcc3f('0x3')](_0x1a7589,_0x3d8426);};}exports[_0xcc3f('0x4')]=function(_0x4786f9){for(var _0x215806=0x0,_0x54c300=events[_0xcc3f('0x5')];_0x215806<_0x54c300;_0x215806++){var _0x361d68=events[_0x215806];var _0x1e06a3=createListener(_0xcc3f('0x6')+_0x361d68,_0x4786f9);UserEvents['on'](_0x361d68,_0x1e06a3);}}; \ No newline at end of file +var _0xd6b0=['./user.events','emit','removeListener','length','user:'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd6b0,0xd2));var _0x0d6b=function(_0xeba69a,_0x30b201){_0xeba69a=_0xeba69a-0x0;var _0x261689=_0xd6b0[_0xeba69a];return _0x261689;};'use strict';var UserEvents=require(_0x0d6b('0x0'));var events=['save','remove','update'];function createListener(_0x482dd7,_0x441d66){return function(_0x5b433e){_0x441d66[_0x0d6b('0x1')](_0x482dd7,_0x5b433e);};}function removeListener(_0x2643f4,_0x3e934f){return function(){UserEvents[_0x0d6b('0x2')](_0x2643f4,_0x3e934f);};}exports['register']=function(_0x4cfe4e){for(var _0x54d671=0x0,_0x37ef93=events[_0x0d6b('0x3')];_0x54d671<_0x37ef93;_0x54d671++){var _0x280e69=events[_0x54d671];var _0x2edebe=createListener(_0x0d6b('0x4')+_0x280e69,_0x4cfe4e);UserEvents['on'](_0x280e69,_0x2edebe);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index a8f337c..78b41c7 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x8fa9cf,_0x57c8fe){var _0x3b0a73=function(_0x39fc53){while(--_0x39fc53){_0x8fa9cf['push'](_0x8fa9cf['shift']());}};_0x3b0a73(++_0x57c8fe);}(_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(_0x579bdc,_0x262928){var _0x474b69=function(_0x5301ff){while(--_0x5301ff){_0x579bdc['push'](_0x579bdc['shift']());}};_0x474b69(++_0x262928);}(_0xe706,0xa3));var _0x6e70=function(_0x828160,_0x26d5be){_0x828160=_0x828160-0x0;var _0x296b5f=_0xe706[_0x828160];return _0x296b5f;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a04e3e6..3d610f6 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 _0xc955=['exports','INTEGER','sequelize'];(function(_0x5e7ee9,_0x4dbc4b){var _0xadb900=function(_0x5eecb3){while(--_0x5eecb3){_0x5e7ee9['push'](_0x5e7ee9['shift']());}};_0xadb900(++_0x4dbc4b);}(_0xc955,0x80));var _0x5c95=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0xc955[_0x754ab4];return _0x34079a;};'use strict';var Sequelize=require(_0x5c95('0x0'));module[_0x5c95('0x1')]={'penalty':{'type':Sequelize[_0x5c95('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe8ac=['sequelize','exports','INTEGER'];(function(_0x2b8e76,_0x3e34d7){var _0x21271b=function(_0x287c22){while(--_0x287c22){_0x2b8e76['push'](_0x2b8e76['shift']());}};_0x21271b(++_0x3e34d7);}(_0xe8ac,0xea));var _0xce8a=function(_0x586f64,_0x3462f4){_0x586f64=_0x586f64-0x0;var _0x1ec56d=_0xe8ac[_0x586f64];return _0x1ec56d;};'use strict';var Sequelize=require(_0xce8a('0x0'));module[_0xce8a('0x1')]={'penalty':{'type':Sequelize[_0xce8a('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 9085ce5..20ee8fc 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 _0xec88=['bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment'];(function(_0x2fc0a5,_0x74010c){var _0x1c9b8d=function(_0x58846c){while(--_0x58846c){_0x2fc0a5['push'](_0x2fc0a5['shift']());}};_0x1c9b8d(++_0x74010c);}(_0xec88,0x134));var _0x8ec8=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0xec88[_0x270dba];return _0x36b83b;};'use strict';var _=require('lodash');var util=require(_0x8ec8('0x0'));var logger=require(_0x8ec8('0x1'))(_0x8ec8('0x2'));var moment=require(_0x8ec8('0x3'));var BPromise=require(_0x8ec8('0x4'));var rp=require(_0x8ec8('0x5'));var fs=require('fs');var path=require(_0x8ec8('0x6'));var rimraf=require(_0x8ec8('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ec8('0x8'));module[_0x8ec8('0x9')]=function(_0x3468c0,_0x1490e5){return _0x3468c0['define'](_0x8ec8('0xa'),attributes,{'tableName':_0x8ec8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c73=['lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x32ee50,_0x564493){var _0x12a1b3=function(_0x3d6bc8){while(--_0x3d6bc8){_0x32ee50['push'](_0x32ee50['shift']());}};_0x12a1b3(++_0x564493);}(_0x4c73,0x174));var _0x34c7=function(_0xdb3843,_0x5c06bd){_0xdb3843=_0xdb3843-0x0;var _0x44a51e=_0x4c73[_0xdb3843];return _0x44a51e;};'use strict';var _=require(_0x34c7('0x0'));var util=require('util');var logger=require(_0x34c7('0x1'))('api');var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rp=require(_0x34c7('0x4'));var fs=require('fs');var path=require(_0x34c7('0x5'));var rimraf=require('rimraf');var config=require(_0x34c7('0x6'));var attributes=require(_0x34c7('0x7'));module[_0x34c7('0x8')]=function(_0x1919eb,_0x2bef19){return _0x1919eb[_0x34c7('0x9')](_0x34c7('0xa'),attributes,{'tableName':_0x34c7('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 93231c7..580e653 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 _0xa303=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x411fad,_0x1ed81a){var _0x1a0ee1=function(_0x42f8ae){while(--_0x42f8ae){_0x411fad['push'](_0x411fad['shift']());}};_0x1a0ee1(++_0x1ed81a);}(_0xa303,0x98));var _0x3a30=function(_0x2f7554,_0x23ef76){_0x2f7554=_0x2f7554-0x0;var _0x2b0efe=_0xa303[_0x2f7554];return _0x2b0efe;};'use strict';var _=require(_0x3a30('0x0'));var util=require(_0x3a30('0x1'));var moment=require(_0x3a30('0x2'));var BPromise=require(_0x3a30('0x3'));var rs=require(_0x3a30('0x4'));var fs=require('fs');var Redis=require(_0x3a30('0x5'));var db=require(_0x3a30('0x6'))['db'];var utils=require(_0x3a30('0x7'));var logger=require(_0x3a30('0x8'))(_0x3a30('0x9'));var config=require('../../config/environment');var jayson=require(_0x3a30('0xa'));var client=jayson[_0x3a30('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x818a77,_0x421cc6,_0x379955){return new BPromise(function(_0x2a076e,_0x2c143b){return client[_0x3a30('0xc')](_0x818a77,_0x379955)[_0x3a30('0xd')](function(_0x1b4f7b){logger[_0x3a30('0xe')](_0x3a30('0xf'),_0x421cc6,'request\x20sent');logger[_0x3a30('0x10')](_0x3a30('0x11'),_0x421cc6,'request\x20sent',JSON[_0x3a30('0x12')](_0x1b4f7b));if(_0x1b4f7b['error']){if(_0x1b4f7b[_0x3a30('0x13')][_0x3a30('0x14')]===0x1f4){logger['error'](_0x3a30('0xf'),_0x421cc6,_0x1b4f7b['error'][_0x3a30('0x15')]);return _0x2c143b(_0x1b4f7b[_0x3a30('0x13')][_0x3a30('0x15')]);}logger[_0x3a30('0x13')](_0x3a30('0xf'),_0x421cc6,_0x1b4f7b[_0x3a30('0x13')][_0x3a30('0x15')]);return _0x2a076e(_0x1b4f7b[_0x3a30('0x13')]['message']);}else{logger[_0x3a30('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x421cc6,_0x3a30('0x16'));_0x2a076e(_0x1b4f7b[_0x3a30('0x17')][_0x3a30('0x15')]);}})[_0x3a30('0x18')](function(_0x1be696){logger[_0x3a30('0x13')](_0x3a30('0xf'),_0x421cc6,_0x1be696);_0x2c143b(_0x1be696);});});} \ No newline at end of file +var _0x2723=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2723,0x108));var _0x3272=function(_0x34c0a7,_0xd888bf){_0x34c0a7=_0x34c0a7-0x0;var _0x4654fe=_0x2723[_0x34c0a7];return _0x4654fe;};'use strict';var _=require(_0x3272('0x0'));var util=require('util');var moment=require(_0x3272('0x1'));var BPromise=require(_0x3272('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3272('0x3'));var db=require(_0x3272('0x4'))['db'];var utils=require(_0x3272('0x5'));var logger=require('../../config/logger')(_0x3272('0x6'));var config=require(_0x3272('0x7'));var jayson=require(_0x3272('0x8'));var client=jayson[_0x3272('0x9')][_0x3272('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51eb6e,_0x34df08,_0x568be7){return new BPromise(function(_0x401f46,_0x4e28a1){return client[_0x3272('0xb')](_0x51eb6e,_0x568be7)[_0x3272('0xc')](function(_0x3021d9){logger[_0x3272('0xd')](_0x3272('0xe'),_0x34df08,_0x3272('0xf'));logger[_0x3272('0x10')](_0x3272('0x11'),_0x34df08,_0x3272('0xf'),JSON[_0x3272('0x12')](_0x3021d9));if(_0x3021d9[_0x3272('0x13')]){if(_0x3021d9[_0x3272('0x13')][_0x3272('0x14')]===0x1f4){logger[_0x3272('0x13')](_0x3272('0xe'),_0x34df08,_0x3021d9[_0x3272('0x13')][_0x3272('0x15')]);return _0x4e28a1(_0x3021d9['error'][_0x3272('0x15')]);}logger[_0x3272('0x13')](_0x3272('0xe'),_0x34df08,_0x3021d9['error']['message']);return _0x401f46(_0x3021d9['error'][_0x3272('0x15')]);}else{logger[_0x3272('0xd')](_0x3272('0xe'),_0x34df08,_0x3272('0xf'));_0x401f46(_0x3021d9['result'][_0x3272('0x15')]);}})['catch'](function(_0x45b815){logger['error'](_0x3272('0xe'),_0x34df08,_0x45b815);_0x4e28a1(_0x45b815);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 39d0708..8c9f2b0 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x631c23,_0x3e18bc){var _0x37f536=function(_0x2a0d53){while(--_0x2a0d53){_0x631c23['push'](_0x631c23['shift']());}};_0x37f536(++_0x3e18bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xd93cbe,_0x11202e){var _0xe0bb40=function(_0x50f4cc){while(--_0x50f4cc){_0xd93cbe['push'](_0xd93cbe['shift']());}};_0xe0bb40(++_0x11202e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 1574c1c..4873ece 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 _0x2c3e=['exports','INTEGER','STRING','sequelize'];(function(_0x3d4bf5,_0x2fd974){var _0x2dc517=function(_0x150b34){while(--_0x150b34){_0x3d4bf5['push'](_0x3d4bf5['shift']());}};_0x2dc517(++_0x2fd974);}(_0x2c3e,0x1a3));var _0xe2c3=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x2c3e[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0xe2c3('0x0'));module[_0xe2c3('0x1')]={'penalty':{'type':Sequelize[_0xe2c3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xe2c3('0x3')]}}; \ No newline at end of file +var _0x1120=['exports','INTEGER','STRING','sequelize'];(function(_0x1fc25b,_0x593674){var _0x46d52b=function(_0x5a6e8b){while(--_0x5a6e8b){_0x1fc25b['push'](_0x1fc25b['shift']());}};_0x46d52b(++_0x593674);}(_0x1120,0x18b));var _0x0112=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x1120[_0x44268d];return _0x4be92d;};'use strict';var Sequelize=require(_0x0112('0x0'));module[_0x0112('0x1')]={'penalty':{'type':Sequelize[_0x0112('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0112('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0112('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 529eef7..ac48e8f 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 _0x299e=['UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define'];(function(_0x3348d1,_0x4e2fbe){var _0x8445aa=function(_0x39a17){while(--_0x39a17){_0x3348d1['push'](_0x3348d1['shift']());}};_0x8445aa(++_0x4e2fbe);}(_0x299e,0x110));var _0xe299=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x299e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xe299('0x0'));var logger=require(_0xe299('0x1'))(_0xe299('0x2'));var moment=require('moment');var BPromise=require(_0xe299('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe299('0x4'));var config=require(_0xe299('0x5'));var attributes=require('./userFaxQueue.attributes');module[_0xe299('0x6')]=function(_0x57cc8a,_0x26dccc){return _0x57cc8a[_0xe299('0x7')](_0xe299('0x8'),attributes,{'tableName':_0xe299('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x167e=['define','user_has_fax_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x43606b,_0x2f2292){var _0xbfd21a=function(_0x2f28fa){while(--_0x2f28fa){_0x43606b['push'](_0x43606b['shift']());}};_0xbfd21a(++_0x2f2292);}(_0x167e,0x1d6));var _0xe167=function(_0x3f6456,_0x3e254d){_0x3f6456=_0x3f6456-0x0;var _0x34d923=_0x167e[_0x3f6456];return _0x34d923;};'use strict';var _=require('lodash');var util=require(_0xe167('0x0'));var logger=require('../../config/logger')(_0xe167('0x1'));var moment=require('moment');var BPromise=require(_0xe167('0x2'));var rp=require(_0xe167('0x3'));var fs=require('fs');var path=require(_0xe167('0x4'));var rimraf=require(_0xe167('0x5'));var config=require(_0xe167('0x6'));var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0xec7fc6,_0x34176b){return _0xec7fc6[_0xe167('0x7')]('UserFaxQueue',attributes,{'tableName':_0xe167('0x8'),'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 0fce10f..48fe3c0 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 _0x3786=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e8420,_0x2e28f0){var _0x94e47f=function(_0x535b87){while(--_0x535b87){_0x2e8420['push'](_0x2e8420['shift']());}};_0x94e47f(++_0x2e28f0);}(_0x3786,0x96));var _0x6378=function(_0x2877ea,_0x29f988){_0x2877ea=_0x2877ea-0x0;var _0x4527d5=_0x3786[_0x2877ea];return _0x4527d5;};'use strict';var _=require('lodash');var util=require(_0x6378('0x0'));var moment=require(_0x6378('0x1'));var BPromise=require(_0x6378('0x2'));var rs=require(_0x6378('0x3'));var fs=require('fs');var Redis=require(_0x6378('0x4'));var db=require(_0x6378('0x5'))['db'];var utils=require(_0x6378('0x6'));var logger=require('../../config/logger')(_0x6378('0x7'));var config=require(_0x6378('0x8'));var jayson=require(_0x6378('0x9'));var client=jayson[_0x6378('0xa')][_0x6378('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e1336,_0x2f7f73,_0x3b82d7){return new BPromise(function(_0x70f379,_0x4fdb0a){return client[_0x6378('0xc')](_0x5e1336,_0x3b82d7)[_0x6378('0xd')](function(_0x2f16c5){logger[_0x6378('0xe')](_0x6378('0xf'),_0x2f7f73,'request\x20sent');logger['debug'](_0x6378('0x10'),_0x2f7f73,_0x6378('0x11'),JSON[_0x6378('0x12')](_0x2f16c5));if(_0x2f16c5[_0x6378('0x13')]){if(_0x2f16c5[_0x6378('0x13')][_0x6378('0x14')]===0x1f4){logger[_0x6378('0x13')](_0x6378('0xf'),_0x2f7f73,_0x2f16c5[_0x6378('0x13')][_0x6378('0x15')]);return _0x4fdb0a(_0x2f16c5['error']['message']);}logger[_0x6378('0x13')](_0x6378('0xf'),_0x2f7f73,_0x2f16c5['error'][_0x6378('0x15')]);return _0x70f379(_0x2f16c5[_0x6378('0x13')][_0x6378('0x15')]);}else{logger[_0x6378('0xe')](_0x6378('0xf'),_0x2f7f73,'request\x20sent');_0x70f379(_0x2f16c5[_0x6378('0x16')][_0x6378('0x15')]);}})['catch'](function(_0x3c3ae2){logger[_0x6378('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x2f7f73,_0x3c3ae2);_0x4fdb0a(_0x3c3ae2);});});} \ No newline at end of file +var _0x32cb=['request\x20sent','debug','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x266da1,_0x357901){var _0x40c6fe=function(_0x4af66a){while(--_0x4af66a){_0x266da1['push'](_0x266da1['shift']());}};_0x40c6fe(++_0x357901);}(_0x32cb,0x1d3));var _0xb32c=function(_0x3b0c00,_0x31b49e){_0x3b0c00=_0x3b0c00-0x0;var _0x34d184=_0x32cb[_0x3b0c00];return _0x34d184;};'use strict';var _=require(_0xb32c('0x0'));var util=require(_0xb32c('0x1'));var moment=require('moment');var BPromise=require(_0xb32c('0x2'));var rs=require(_0xb32c('0x3'));var fs=require('fs');var Redis=require(_0xb32c('0x4'));var db=require(_0xb32c('0x5'))['db'];var utils=require(_0xb32c('0x6'));var logger=require(_0xb32c('0x7'))(_0xb32c('0x8'));var config=require(_0xb32c('0x9'));var jayson=require(_0xb32c('0xa'));var client=jayson[_0xb32c('0xb')][_0xb32c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x586d0a,_0x480859,_0x201d20){return new BPromise(function(_0x48a213,_0x30dbe9){return client[_0xb32c('0xd')](_0x586d0a,_0x201d20)[_0xb32c('0xe')](function(_0x4ed9bb){logger[_0xb32c('0xf')](_0xb32c('0x10'),_0x480859,_0xb32c('0x11'));logger[_0xb32c('0x12')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x480859,_0xb32c('0x11'),JSON['stringify'](_0x4ed9bb));if(_0x4ed9bb[_0xb32c('0x13')]){if(_0x4ed9bb['error']['code']===0x1f4){logger['error'](_0xb32c('0x10'),_0x480859,_0x4ed9bb['error']['message']);return _0x30dbe9(_0x4ed9bb[_0xb32c('0x13')][_0xb32c('0x14')]);}logger[_0xb32c('0x13')](_0xb32c('0x10'),_0x480859,_0x4ed9bb['error'][_0xb32c('0x14')]);return _0x48a213(_0x4ed9bb[_0xb32c('0x13')]['message']);}else{logger[_0xb32c('0xf')](_0xb32c('0x10'),_0x480859,_0xb32c('0x11'));_0x48a213(_0x4ed9bb[_0xb32c('0x15')]['message']);}})['catch'](function(_0x467b2c){logger[_0xb32c('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x480859,_0x467b2c);_0x30dbe9(_0x467b2c);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 4a47fa6..5ee7656 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x50aa5d,_0x358aa2){var _0x3bf558=function(_0x5e0d1b){while(--_0x5e0d1b){_0x50aa5d['push'](_0x50aa5d['shift']());}};_0x3bf558(++_0x358aa2);}(_0x70e0,0x17b));var _0x070e=function(_0x3cdd5a,_0x1fa16a){_0x3cdd5a=_0x3cdd5a-0x0;var _0x1690a3=_0x70e0[_0x3cdd5a];return _0x1690a3;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3a3041,_0x2e6118){var _0x136988=function(_0x2b501c){while(--_0x2b501c){_0x3a3041['push'](_0x3a3041['shift']());}};_0x136988(++_0x2e6118);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 483155a..d1294cd 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 _0x6ea7=['INTEGER','exports'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x6ea7,0x163));var _0x76ea=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x6ea7[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require('sequelize');module[_0x76ea('0x0')]={'penalty':{'type':Sequelize[_0x76ea('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb33c=['sequelize','exports','INTEGER'];(function(_0x1692ce,_0x596641){var _0x5c2a63=function(_0x25161f){while(--_0x25161f){_0x1692ce['push'](_0x1692ce['shift']());}};_0x5c2a63(++_0x596641);}(_0xb33c,0x12c));var _0xcb33=function(_0x3a25d7,_0xac4e81){_0x3a25d7=_0x3a25d7-0x0;var _0x4d0c41=_0xb33c[_0x3a25d7];return _0x4d0c41;};'use strict';var Sequelize=require(_0xcb33('0x0'));module[_0xcb33('0x1')]={'penalty':{'type':Sequelize[_0xcb33('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 9d4b596..a73d2cb 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 _0xa390=['UserMailQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x438912,_0x3f7f74){var _0x18112f=function(_0x1b8ac9){while(--_0x1b8ac9){_0x438912['push'](_0x438912['shift']());}};_0x18112f(++_0x3f7f74);}(_0xa390,0x114));var _0x0a39=function(_0x1c6a91,_0x428472){_0x1c6a91=_0x1c6a91-0x0;var _0x50f9ca=_0xa390[_0x1c6a91];return _0x50f9ca;};'use strict';var _=require('lodash');var util=require(_0x0a39('0x0'));var logger=require(_0x0a39('0x1'))(_0x0a39('0x2'));var moment=require(_0x0a39('0x3'));var BPromise=require(_0x0a39('0x4'));var rp=require(_0x0a39('0x5'));var fs=require('fs');var path=require(_0x0a39('0x6'));var rimraf=require(_0x0a39('0x7'));var config=require(_0x0a39('0x8'));var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x1e6af8,_0x4b9bb1){return _0x1e6af8[_0x0a39('0x9')](_0x0a39('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc920=['define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x52f3a3,_0x736637){var _0x37865b=function(_0x3a3344){while(--_0x3a3344){_0x52f3a3['push'](_0x52f3a3['shift']());}};_0x37865b(++_0x736637);}(_0xc920,0xe0));var _0x0c92=function(_0x4fa08c,_0x30cac4){_0x4fa08c=_0x4fa08c-0x0;var _0x7a920a=_0xc920[_0x4fa08c];return _0x7a920a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0c92('0x0'))(_0x0c92('0x1'));var moment=require(_0x0c92('0x2'));var BPromise=require(_0x0c92('0x3'));var rp=require(_0x0c92('0x4'));var fs=require('fs');var path=require(_0x0c92('0x5'));var rimraf=require(_0x0c92('0x6'));var config=require(_0x0c92('0x7'));var attributes=require(_0x0c92('0x8'));module[_0x0c92('0x9')]=function(_0x2896ff,_0x3f55dd){return _0x2896ff[_0x0c92('0xa')](_0x0c92('0xb'),attributes,{'tableName':_0x0c92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 8f4ec15..e1594ea 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x3418ee,_0x487382){var _0x18d728=function(_0x2a53a4){while(--_0x2a53a4){_0x3418ee['push'](_0x3418ee['shift']());}};_0x18d728(++_0x487382);}(_0xe14b,0x93));var _0xbe14=function(_0xa18fdf,_0x4b3185){_0xa18fdf=_0xa18fdf-0x0;var _0x29bf3a=_0xe14b[_0xa18fdf];return _0x29bf3a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x1cb9,0x14e));var _0x91cb=function(_0x527088,_0x2479be){_0x527088=_0x527088-0x0;var _0x29e7b9=_0x1cb9[_0x527088];return _0x29e7b9;};'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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 614895a..bf574bf 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 _0x77bf=['Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x3c6b3e,_0x58a0b5){var _0x91fa59=function(_0x5d2c63){while(--_0x5d2c63){_0x3c6b3e['push'](_0x3c6b3e['shift']());}};_0x91fa59(++_0x58a0b5);}(_0x77bf,0xbf));var _0xf77b=function(_0x544656,_0x317c20){_0x544656=_0x544656-0x0;var _0x16fd42=_0x77bf[_0x544656];return _0x16fd42;};'use strict';var multer=require(_0xf77b('0x0'));var util=require(_0xf77b('0x1'));var path=require(_0xf77b('0x2'));var timeout=require(_0xf77b('0x3'));var express=require(_0xf77b('0x4'));var router=express[_0xf77b('0x5')]();var fs_extra=require(_0xf77b('0x6'));var auth=require(_0xf77b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf77b('0x8'));var controller=require(_0xf77b('0x9'));router[_0xf77b('0xa')]('/',auth[_0xf77b('0xb')](),controller[_0xf77b('0xc')]);module[_0xf77b('0xd')]=router; \ No newline at end of file +var _0x72fa=['../../components/interaction/service','./userNotification.controller','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x4811fc,_0x462867){var _0x17ae26=function(_0x15055f){while(--_0x15055f){_0x4811fc['push'](_0x4811fc['shift']());}};_0x17ae26(++_0x462867);}(_0x72fa,0x122));var _0xa72f=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x72fa[_0x2d2e85];return _0x3e9f5e;};'use strict';var multer=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var path=require(_0xa72f('0x2'));var timeout=require(_0xa72f('0x3'));var express=require(_0xa72f('0x4'));var router=express[_0xa72f('0x5')]();var fs_extra=require(_0xa72f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa72f('0x7'));var config=require('../../config/environment');var controller=require(_0xa72f('0x8'));router['post']('/',auth['isAuthenticated'](),controller[_0xa72f('0x9')]);module[_0xa72f('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 1020721..1a48a2e 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 _0xe86a=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x322749,_0xdb4126){var _0x5c590b=function(_0x45ec7b){while(--_0x45ec7b){_0x322749['push'](_0x322749['shift']());}};_0x5c590b(++_0xdb4126);}(_0xe86a,0x1a5));var _0xae86=function(_0x2545a9,_0x3a19c9){_0x2545a9=_0x2545a9-0x0;var _0x342fdf=_0xe86a[_0x2545a9];return _0x342fdf;};'use strict';var Sequelize=require(_0xae86('0x0'));module[_0xae86('0x1')]={'body':{'type':Sequelize[_0xae86('0x2')]},'senderName':{'type':Sequelize[_0xae86('0x3')]},'recipientsId':{'type':Sequelize[_0xae86('0x2')]},'recipientsDescription':{'type':Sequelize[_0xae86('0x3')]},'beep':{'type':Sequelize[_0xae86('0x4')]}}; \ No newline at end of file +var _0xc2cd=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x1e6f66,_0x21424d){var _0x21893c=function(_0x5de055){while(--_0x5de055){_0x1e6f66['push'](_0x1e6f66['shift']());}};_0x21893c(++_0x21424d);}(_0xc2cd,0x1a8));var _0xdc2c=function(_0x4d124d,_0x24db6c){_0x4d124d=_0x4d124d-0x0;var _0x9a237c=_0xc2cd[_0x4d124d];return _0x9a237c;};'use strict';var Sequelize=require(_0xdc2c('0x0'));module[_0xdc2c('0x1')]={'body':{'type':Sequelize[_0xdc2c('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xdc2c('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdc2c('0x3')]},'beep':{'type':Sequelize[_0xdc2c('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b3b75d5..1c8d010 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 _0x5044=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','startCase','User','includes','queue','union','flatten','getAgents','map','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0xd8ba95,_0xb5859a){var _0x29d42e=function(_0x53abb3){while(--_0x53abb3){_0xd8ba95['push'](_0xd8ba95['shift']());}};_0x29d42e(++_0xb5859a);}(_0x5044,0xbc));var _0x4504=function(_0x100ec7,_0x2c79d1){_0x100ec7=_0x100ec7-0x0;var _0x4c47f8=_0x5044[_0x100ec7];return _0x4c47f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4504('0x0'));var zipdir=require(_0x4504('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4504('0x2'));var Mustache=require(_0x4504('0x3'));var util=require(_0x4504('0x4'));var path=require('path');var sox=require(_0x4504('0x5'));var csv=require(_0x4504('0x6'));var ejs=require(_0x4504('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4504('0x8'));var squel=require(_0x4504('0x9'));var crypto=require(_0x4504('0xa'));var jsforce=require(_0x4504('0xb'));var deskjs=require(_0x4504('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4504('0xd'));var Papa=require(_0x4504('0xe'));var Redis=require(_0x4504('0xf'));var authService=require(_0x4504('0x10'));var qs=require(_0x4504('0x11'));var as=require(_0x4504('0x12'));var hardwareService=require(_0x4504('0x13'));var logger=require(_0x4504('0x14'))('api');var utils=require(_0x4504('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4504('0x16'));var db=require('../../mysqldb')['db'];config[_0x4504('0x17')]=_[_0x4504('0x18')](config['redis'],{'host':_0x4504('0x19'),'port':0x18eb});var socket=require(_0x4504('0x1a'))(new Redis(config[_0x4504('0x17')]));require(_0x4504('0x1b'))['register'](socket);function respondWithStatusCode(_0x17e342,_0x898e8){_0x898e8=_0x898e8||0xcc;return function(_0xa07325){if(_0xa07325){return _0x17e342['sendStatus'](_0x898e8);}return _0x17e342[_0x4504('0x1c')](_0x898e8)['end']();};}function respondWithResult(_0x2ee9f7,_0x47a42a){_0x47a42a=_0x47a42a||0xc8;return function(_0x3fc676){if(_0x3fc676){return _0x2ee9f7[_0x4504('0x1c')](_0x47a42a)[_0x4504('0x1d')](_0x3fc676);}};}function respondWithFilteredResult(_0x44773e,_0x538a06){return function(_0x4830c2){if(_0x4830c2){var _0x875afe=typeof _0x538a06[_0x4504('0x1e')]===_0x4504('0x1f')&&typeof _0x538a06[_0x4504('0x20')]===_0x4504('0x1f');var _0x3d9e6a=_0x4830c2[_0x4504('0x21')];var _0x1e96db=_0x875afe?0x0:_0x538a06['offset'];var _0x129ebc=_0x875afe?_0x4830c2['count']:_0x538a06[_0x4504('0x1e')]+_0x538a06[_0x4504('0x20')];var _0x2244a3;if(_0x129ebc>=_0x3d9e6a){_0x129ebc=_0x3d9e6a;_0x2244a3=0xc8;}else{_0x2244a3=0xce;}_0x44773e[_0x4504('0x1c')](_0x2244a3);return _0x44773e[_0x4504('0x22')](_0x4504('0x23'),_0x1e96db+'-'+_0x129ebc+'/'+_0x3d9e6a)['json'](_0x4830c2);}return null;};}function patchUpdates(_0x49649e){return function(_0x1fa238){try{jsonpatch[_0x4504('0x24')](_0x1fa238,_0x49649e,!![]);}catch(_0x31bf30){return BPromise[_0x4504('0x25')](_0x31bf30);}return _0x1fa238[_0x4504('0x26')]();};}function saveUpdates(_0x56b1b4,_0x4871b7){return function(_0x336e54){if(_0x336e54){return _0x336e54[_0x4504('0x27')](_0x56b1b4)[_0x4504('0x28')](function(_0x134931){return _0x134931;});}return null;};}function removeEntity(_0x17009f,_0x139110){return function(_0x48666d){if(_0x48666d){return _0x48666d[_0x4504('0x29')]()[_0x4504('0x28')](function(){_0x17009f['status'](0xcc)[_0x4504('0x2a')]();});}};}function handleEntityNotFound(_0x511e6d,_0x51cd77){return function(_0x51cf6f){if(!_0x51cf6f){_0x511e6d[_0x4504('0x2b')](0x194);}return _0x51cf6f;};}function handleError(_0x3c21f0,_0x325947){_0x325947=_0x325947||0x1f4;return function(_0x1bdaad){logger[_0x4504('0x2c')](_0x1bdaad[_0x4504('0x2d')]);if(_0x1bdaad[_0x4504('0x2e')]){delete _0x1bdaad[_0x4504('0x2e')];}_0x3c21f0[_0x4504('0x1c')](_0x325947)[_0x4504('0x2f')](_0x1bdaad);};}exports[_0x4504('0x30')]=function(_0x5d21e0,_0x395689,_0x4f1564){if(!_0x5d21e0[_0x4504('0x31')][_0x4504('0x32')](_0x4504('0x33'))&&!_0x5d21e0[_0x4504('0x31')][_0x4504('0x32')](_0x4504('0x34'))){throw new db[(_0x4504('0x35'))][(_0x4504('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5d21e0[_0x4504('0x31')][_0x4504('0x32')](_0x4504('0x34'))&&!_0x5d21e0[_0x4504('0x31')][_0x4504('0x32')](_0x4504('0x37'))){throw new db[(_0x4504('0x35'))][(_0x4504('0x36'))](_0x4504('0x38'));}if(!_0x5d21e0[_0x4504('0x31')]['hasOwnProperty']('recipients')){throw new db[(_0x4504('0x35'))]['ValidationError'](_0x4504('0x39'));}else{try{var _0x9c8d12=JSON[_0x4504('0x3a')](_0x5d21e0[_0x4504('0x31')]['recipients']);}catch(_0x2b534d){logger[_0x4504('0x2c')](_0x2b534d);throw new db[(_0x4504('0x35'))][(_0x4504('0x36'))](_0x4504('0x3b'));}var _0x5d437d=[_0x4504('0x3c'),_0x4504('0x3d'),_0x4504('0x3e'),_0x4504('0x3f'),'smsqueue','voicequeue','whatsappqueue',_0x4504('0x40'),'user'];if(_[_0x4504('0x41')](_0x9c8d12,function(_0x59240f){return!_['includes'](_0x5d437d,_0x59240f[_0x4504('0x42')][_0x4504('0x43')]());})){throw new db[(_0x4504('0x35'))][(_0x4504('0x36'))](_0x4504('0x44'));}}}var _0x53d4c9={};_0x53d4c9['senderName']=_0x5d21e0['body'][_0x4504('0x32')](_0x4504('0x45'))?_0x5d21e0[_0x4504('0x31')][_0x4504('0x45')]:_0x5d21e0[_0x4504('0x46')][_0x4504('0x47')];_0x53d4c9['recipientsDescription']=_[_0x4504('0x48')](_0x5d21e0[_0x4504('0x31')][_0x4504('0x49')])?null:_0x5d21e0[_0x4504('0x31')][_0x4504('0x49')];_0x53d4c9[_0x4504('0x4a')]=_0x5d21e0[_0x4504('0x31')][_0x4504('0x4a')]||![];_0x53d4c9[_0x4504('0x4b')]=_0x5d21e0[_0x4504('0x46')]['id'];return getContent(_0x5d21e0[_0x4504('0x31')])[_0x4504('0x28')](function(_0x18f415){_0x53d4c9['body']=_0x18f415;return getRecipients(_0x9c8d12);})[_0x4504('0x28')](function(_0x338646){_0x53d4c9[_0x4504('0x4c')]=_[_0x4504('0x4d')](_0x338646)[_0x4504('0x4e')](',');return db[_0x4504('0x4f')][_0x4504('0x50')](function(_0xe105c3){return db[_0x4504('0x51')][_0x4504('0x52')](_0x53d4c9,{'raw':!![],'transaction':_0xe105c3})[_0x4504('0x28')](function(_0x4902c0){var _0x2296bc={'sender':_0x53d4c9[_0x4504('0x45')],'description':_0x53d4c9[_0x4504('0x49')],'content':_0x53d4c9[_0x4504('0x31')],'beep':_0x53d4c9[_0x4504('0x4a')]};_0x338646[_0x4504('0x53')](function(_0x44ae0b){_0x2296bc[_0x4504('0x54')]=_0x44ae0b;socket[_0x4504('0x55')](_0x4504('0x56'),_0x2296bc);});return _0x4902c0;});});})[_0x4504('0x28')](respondWithResult(_0x395689,0xc9))[_0x4504('0x57')](handleError(_0x395689,null));};function getContent(_0x33116c){return new BPromise(function(_0x1be02b,_0x2f4f87){if(_0x33116c[_0x4504('0x33')]){_0x1be02b(_0x33116c[_0x4504('0x33')]);return;}return db[_0x4504('0x58')][_0x4504('0x59')]({'attributes':[_0x4504('0x5a')],'where':{'id':_0x33116c[_0x4504('0x34')]},'raw':!![]})[_0x4504('0x28')](function(_0x1083f0){if(!_0x1083f0)throw new db[(_0x4504('0x35'))][(_0x4504('0x36'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x293974=Mustache['render'](_0x1083f0[_0x4504('0x5a')],_0x33116c[_0x4504('0x37')]);_0x1be02b(_0x293974);})[_0x4504('0x57')](function(_0x51dc20){_0x2f4f87(_0x51dc20);});});}function getRecipients(_0x4582e4){return new BPromise(function(_0xc49365,_0x936535){var _0x5aeff4=[];var _0x57f673=[];_0x4582e4['forEach'](function(_0x4ded2a){var _0x5150a9=_[_0x4504('0x5b')](_0x4ded2a[_0x4504('0x42')]['toLowerCase']());if(_0x5150a9===_0x4504('0x5c')){_0x5aeff4=_['union'](_0x5aeff4,_0x4ded2a['ids']);}else{if(_[_0x4504('0x5d')](_0x5150a9,'queue'))_0x5150a9=_0x5150a9['replace'](_0x4504('0x5e'),'Queue');_0x4ded2a['ids'][_0x4504('0x53')](function(_0x1c4d26){_0x57f673['push'](getAgents(_0x5150a9,_0x1c4d26));});}});return BPromise['all'](_0x57f673)['then'](function(_0x1c3303){_0x5aeff4=_[_0x4504('0x5f')](_0x5aeff4,_[_0x4504('0x60')](_0x1c3303));_0xc49365(_0x5aeff4);})['catch'](function(_0x2b1ade){_0x936535(_0x2b1ade);});});}function getAgents(_0x15fbc6,_0x7ea23c){return new BPromise(function(_0x524500,_0x68c527){return db[_0x15fbc6][_0x4504('0x59')]({'where':{'id':_0x7ea23c}})[_0x4504('0x28')](function(_0x4ae584){return _0x4ae584[_0x4504('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x60d5e5){var _0x31350f=_[_0x4504('0x62')](_0x60d5e5,'id');_0x524500(_0x31350f);});})[_0x4504('0x57')](function(_0x49b3d9){_0x68c527(_0x49b3d9);});});} \ No newline at end of file +var _0x5f88=['ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','senderName','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','replace','queue','Queue','ids','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x5f88,0x134));var _0x85f8=function(_0x216dcb,_0x19bb51){_0x216dcb=_0x216dcb-0x0;var _0x594a83=_0x5f88[_0x216dcb];return _0x594a83;};'use strict';var emlformat=require(_0x85f8('0x0'));var rimraf=require(_0x85f8('0x1'));var zipdir=require(_0x85f8('0x2'));var jsonpatch=require(_0x85f8('0x3'));var rp=require('request-promise');var moment=require(_0x85f8('0x4'));var BPromise=require(_0x85f8('0x5'));var Mustache=require(_0x85f8('0x6'));var util=require(_0x85f8('0x7'));var path=require(_0x85f8('0x8'));var sox=require(_0x85f8('0x9'));var csv=require('to-csv');var ejs=require(_0x85f8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85f8('0xb'));var squel=require('squel');var crypto=require(_0x85f8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x85f8('0xd'));var toCsv=require(_0x85f8('0xe'));var querystring=require(_0x85f8('0xf'));var Papa=require(_0x85f8('0x10'));var Redis=require(_0x85f8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x85f8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85f8('0x13'));var logger=require(_0x85f8('0x14'))(_0x85f8('0x15'));var utils=require(_0x85f8('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x85f8('0x17'))['db'];config[_0x85f8('0x18')]=_[_0x85f8('0x19')](config[_0x85f8('0x18')],{'host':_0x85f8('0x1a'),'port':0x18eb});var socket=require(_0x85f8('0x1b'))(new Redis(config[_0x85f8('0x18')]));require('./userNotification.socket')[_0x85f8('0x1c')](socket);function respondWithStatusCode(_0x11b71a,_0x3ec1c1){_0x3ec1c1=_0x3ec1c1||0xcc;return function(_0x368eb1){if(_0x368eb1){return _0x11b71a[_0x85f8('0x1d')](_0x3ec1c1);}return _0x11b71a['status'](_0x3ec1c1)['end']();};}function respondWithResult(_0x36298f,_0x78ad10){_0x78ad10=_0x78ad10||0xc8;return function(_0x10efa8){if(_0x10efa8){return _0x36298f[_0x85f8('0x1e')](_0x78ad10)[_0x85f8('0x1f')](_0x10efa8);}};}function respondWithFilteredResult(_0x2e9bc2,_0x2c3b64){return function(_0x479643){if(_0x479643){var _0x455a7f=typeof _0x2c3b64['offset']===_0x85f8('0x20')&&typeof _0x2c3b64[_0x85f8('0x21')]===_0x85f8('0x20');var _0x20f5ba=_0x479643[_0x85f8('0x22')];var _0x17e431=_0x455a7f?0x0:_0x2c3b64['offset'];var _0x3b68cb=_0x455a7f?_0x479643[_0x85f8('0x22')]:_0x2c3b64['offset']+_0x2c3b64[_0x85f8('0x21')];var _0xeb7a09;if(_0x3b68cb>=_0x20f5ba){_0x3b68cb=_0x20f5ba;_0xeb7a09=0xc8;}else{_0xeb7a09=0xce;}_0x2e9bc2[_0x85f8('0x1e')](_0xeb7a09);return _0x2e9bc2[_0x85f8('0x23')](_0x85f8('0x24'),_0x17e431+'-'+_0x3b68cb+'/'+_0x20f5ba)['json'](_0x479643);}return null;};}function patchUpdates(_0x144e29){return function(_0x39b4c2){try{jsonpatch[_0x85f8('0x25')](_0x39b4c2,_0x144e29,!![]);}catch(_0x3a6de1){return BPromise[_0x85f8('0x26')](_0x3a6de1);}return _0x39b4c2[_0x85f8('0x27')]();};}function saveUpdates(_0x477d45,_0x1d4b56){return function(_0x39c62f){if(_0x39c62f){return _0x39c62f[_0x85f8('0x28')](_0x477d45)[_0x85f8('0x29')](function(_0x2a21e5){return _0x2a21e5;});}return null;};}function removeEntity(_0x2c7aaa,_0x3f687d){return function(_0x13347e){if(_0x13347e){return _0x13347e[_0x85f8('0x2a')]()[_0x85f8('0x29')](function(){_0x2c7aaa[_0x85f8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5616b7,_0x833b46){return function(_0x46abdf){if(!_0x46abdf){_0x5616b7[_0x85f8('0x1d')](0x194);}return _0x46abdf;};}function handleError(_0x31c8f4,_0x5918b0){_0x5918b0=_0x5918b0||0x1f4;return function(_0x45d123){logger[_0x85f8('0x2b')](_0x45d123[_0x85f8('0x2c')]);if(_0x45d123[_0x85f8('0x2d')]){delete _0x45d123[_0x85f8('0x2d')];}_0x31c8f4[_0x85f8('0x1e')](_0x5918b0)[_0x85f8('0x2e')](_0x45d123);};}exports[_0x85f8('0x2f')]=function(_0x4c96d1,_0x226af6,_0xb1b3b8){if(!_0x4c96d1[_0x85f8('0x30')]['hasOwnProperty']('text')&&!_0x4c96d1['body'][_0x85f8('0x31')](_0x85f8('0x32'))){throw new db[(_0x85f8('0x33'))][(_0x85f8('0x34'))](_0x85f8('0x35'));}else{if(_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x31')](_0x85f8('0x32'))&&!_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x31')](_0x85f8('0x36'))){throw new db['Sequelize'][(_0x85f8('0x34'))](_0x85f8('0x37'));}if(!_0x4c96d1['body'][_0x85f8('0x31')](_0x85f8('0x38'))){throw new db[(_0x85f8('0x33'))][(_0x85f8('0x34'))](_0x85f8('0x39'));}else{try{var _0x4ab778=JSON[_0x85f8('0x3a')](_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x38')]);}catch(_0x299f57){logger['error'](_0x299f57);throw new db[(_0x85f8('0x33'))][(_0x85f8('0x34'))](_0x85f8('0x3b'));}var _0x223f80=[_0x85f8('0x3c'),_0x85f8('0x3d'),_0x85f8('0x3e'),'openchannelqueue',_0x85f8('0x3f'),'voicequeue','whatsappqueue',_0x85f8('0x40'),_0x85f8('0x41')];if(_[_0x85f8('0x42')](_0x4ab778,function(_0x373412){return!_[_0x85f8('0x43')](_0x223f80,_0x373412[_0x85f8('0x44')][_0x85f8('0x45')]());})){throw new db[(_0x85f8('0x33'))][(_0x85f8('0x34'))](_0x85f8('0x46'));}}}var _0x7996b5={};_0x7996b5['senderName']=_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x31')]('senderName')?_0x4c96d1[_0x85f8('0x30')]['senderName']:_0x4c96d1[_0x85f8('0x41')]['fullname'];_0x7996b5[_0x85f8('0x47')]=_[_0x85f8('0x48')](_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x47')])?null:_0x4c96d1['body'][_0x85f8('0x47')];_0x7996b5[_0x85f8('0x49')]=_0x4c96d1[_0x85f8('0x30')][_0x85f8('0x49')]||![];_0x7996b5[_0x85f8('0x4a')]=_0x4c96d1['user']['id'];return getContent(_0x4c96d1['body'])['then'](function(_0x28ea91){_0x7996b5[_0x85f8('0x30')]=_0x28ea91;return getRecipients(_0x4ab778);})[_0x85f8('0x29')](function(_0x165280){_0x7996b5[_0x85f8('0x4b')]=_[_0x85f8('0x4c')](_0x165280)[_0x85f8('0x4d')](',');return db[_0x85f8('0x4e')][_0x85f8('0x4f')](function(_0x34b674){return db[_0x85f8('0x50')][_0x85f8('0x51')](_0x7996b5,{'raw':!![],'transaction':_0x34b674})[_0x85f8('0x29')](function(_0x5a5099){var _0x4c54a2={'sender':_0x7996b5[_0x85f8('0x52')],'description':_0x7996b5['recipientsDescription'],'content':_0x7996b5[_0x85f8('0x30')],'beep':_0x7996b5['beep']};_0x165280[_0x85f8('0x53')](function(_0x22632c){_0x4c54a2[_0x85f8('0x54')]=_0x22632c;socket[_0x85f8('0x55')](_0x85f8('0x56'),_0x4c54a2);});return _0x5a5099;});});})[_0x85f8('0x29')](respondWithResult(_0x226af6,0xc9))[_0x85f8('0x57')](handleError(_0x226af6,null));};function getContent(_0x402528){return new BPromise(function(_0x55e1c3,_0x1c8429){if(_0x402528[_0x85f8('0x58')]){_0x55e1c3(_0x402528[_0x85f8('0x58')]);return;}return db[_0x85f8('0x59')][_0x85f8('0x5a')]({'attributes':['html'],'where':{'id':_0x402528['TemplateId']},'raw':!![]})['then'](function(_0x21c961){if(!_0x21c961)throw new db[(_0x85f8('0x33'))][(_0x85f8('0x34'))](_0x85f8('0x5b'));var _0x3287af=Mustache[_0x85f8('0x5c')](_0x21c961[_0x85f8('0x5d')],_0x402528[_0x85f8('0x36')]);_0x55e1c3(_0x3287af);})[_0x85f8('0x57')](function(_0x29eb8a){_0x1c8429(_0x29eb8a);});});}function getRecipients(_0x475632){return new BPromise(function(_0xc5a303,_0x5acecf){var _0x5c244c=[];var _0x2bb22a=[];_0x475632[_0x85f8('0x53')](function(_0x39f92b){var _0xc11dc0=_[_0x85f8('0x5e')](_0x39f92b[_0x85f8('0x44')][_0x85f8('0x45')]());if(_0xc11dc0===_0x85f8('0x5f')){_0x5c244c=_[_0x85f8('0x60')](_0x5c244c,_0x39f92b['ids']);}else{if(_[_0x85f8('0x43')](_0xc11dc0,'queue'))_0xc11dc0=_0xc11dc0[_0x85f8('0x61')](_0x85f8('0x62'),_0x85f8('0x63'));_0x39f92b[_0x85f8('0x64')][_0x85f8('0x53')](function(_0x2afbec){_0x2bb22a[_0x85f8('0x65')](getAgents(_0xc11dc0,_0x2afbec));});}});return BPromise[_0x85f8('0x66')](_0x2bb22a)[_0x85f8('0x29')](function(_0xd551ce){_0x5c244c=_[_0x85f8('0x60')](_0x5c244c,_[_0x85f8('0x67')](_0xd551ce));_0xc5a303(_0x5c244c);})[_0x85f8('0x57')](function(_0x58b4a4){_0x5acecf(_0x58b4a4);});});}function getAgents(_0x3c070a,_0x516d44){return new BPromise(function(_0x22d181,_0x376d47){return db[_0x3c070a][_0x85f8('0x5a')]({'where':{'id':_0x516d44}})[_0x85f8('0x29')](function(_0x125dc9){return _0x125dc9[_0x85f8('0x68')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2e53c0){var _0x3065ce=_[_0x85f8('0x69')](_0x2e53c0,'id');_0x22d181(_0x3065ce);});})[_0x85f8('0x57')](function(_0x167537){_0x376d47(_0x167537);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 77e6f78..95e3aa8 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 _0xbd3e=['exports','events','UserNotification','update','remove','emit','hasOwnProperty'];(function(_0x2c17b3,_0x428bb3){var _0xe61b63=function(_0x83c5d8){while(--_0x83c5d8){_0x2c17b3['push'](_0x2c17b3['shift']());}};_0xe61b63(++_0x428bb3);}(_0xbd3e,0x6a));var _0xebd3=function(_0x4e9f00,_0x181c88){_0x4e9f00=_0x4e9f00-0x0;var _0x89ac1=_0xbd3e[_0x4e9f00];return _0x89ac1;};'use strict';var EventEmitter=require(_0xebd3('0x0'));var UserNotification=require('../../mysqldb')['db'][_0xebd3('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xebd3('0x2'),'afterDestroy':_0xebd3('0x3')};function emitEvent(_0x425def){return function(_0x472aea,_0x512236,_0x188b52){UserNotificationEvents[_0xebd3('0x4')](_0x425def+':'+_0x472aea['id'],_0x472aea);UserNotificationEvents['emit'](_0x425def,_0x472aea);_0x188b52(null);};}for(var e in events){if(events[_0xebd3('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xebd3('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x4d7a=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x435f2d,_0x1843f9){var _0x5992a7=function(_0x42d25e){while(--_0x42d25e){_0x435f2d['push'](_0x435f2d['shift']());}};_0x5992a7(++_0x1843f9);}(_0x4d7a,0x91));var _0xa4d7=function(_0x5d87e8,_0x1e853f){_0x5d87e8=_0x5d87e8-0x0;var _0x443394=_0x4d7a[_0x5d87e8];return _0x443394;};'use strict';var EventEmitter=require(_0xa4d7('0x0'));var UserNotification=require(_0xa4d7('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa4d7('0x2')](0x0);var events={'afterCreate':_0xa4d7('0x3'),'afterUpdate':_0xa4d7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x406e48){return function(_0x5d84c2,_0x180d49,_0x330361){UserNotificationEvents['emit'](_0x406e48+':'+_0x5d84c2['id'],_0x5d84c2);UserNotificationEvents[_0xa4d7('0x5')](_0x406e48,_0x5d84c2);_0x330361(null);};}for(var e in events){if(events[_0xa4d7('0x6')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xa4d7('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 40c247a..87f0df0 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 _0xead8=['userNotifications','utf8mb4','lodash','util','api','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0xead8,0x70));var _0x8ead=function(_0xbaf699,_0x4aa945){_0xbaf699=_0xbaf699-0x0;var _0x55a131=_0xead8[_0xbaf699];return _0x55a131;};'use strict';var _=require(_0x8ead('0x0'));var util=require(_0x8ead('0x1'));var logger=require('../../config/logger')(_0x8ead('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ead('0x3'));var rimraf=require('rimraf');var config=require(_0x8ead('0x4'));var attributes=require(_0x8ead('0x5'));module[_0x8ead('0x6')]=function(_0xe5c4b1,_0x1549d8){return _0xe5c4b1[_0x8ead('0x7')](_0x8ead('0x8'),attributes,{'tableName':_0x8ead('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ead('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf69c=['./userNotification.attributes','exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x330470,_0x6bc6a2){var _0xce74b9=function(_0x95ea9a){while(--_0x95ea9a){_0x330470['push'](_0x330470['shift']());}};_0xce74b9(++_0x6bc6a2);}(_0xf69c,0x1e2));var _0xcf69=function(_0x491ff4,_0x1c83fd){_0x491ff4=_0x491ff4-0x0;var _0x223621=_0xf69c[_0x491ff4];return _0x223621;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));module[_0xcf69('0x9')]=function(_0x2e8d3,_0x2ec528){return _0x2e8d3[_0xcf69('0xa')](_0xcf69('0xb'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcf69('0xc'),'collate':_0xcf69('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 1cec2c8..6d0432a 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 _0xa041=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','ioredis'];(function(_0x230814,_0x327dd5){var _0x3b8bee=function(_0x4667bc){while(--_0x4667bc){_0x230814['push'](_0x230814['shift']());}};_0x3b8bee(++_0x327dd5);}(_0xa041,0x1c8));var _0x1a04=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa041[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x1a04('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1a04('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a04('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a04('0x3'));var logger=require(_0x1a04('0x4'))(_0x1a04('0x5'));var config=require(_0x1a04('0x6'));var jayson=require(_0x1a04('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a04('0x8')]=_[_0x1a04('0x9')](config[_0x1a04('0x8')],{'host':_0x1a04('0xa'),'port':0x18eb});var socket=require(_0x1a04('0xb'))(new Redis(config['redis']));require(_0x1a04('0xc'))[_0x1a04('0xd')](socket);function respondWithRpcPromise(_0x58095c,_0x1c0d1b,_0x3ed6cc){return new BPromise(function(_0x42f9b9,_0x4f30f8){return client[_0x1a04('0xe')](_0x58095c,_0x3ed6cc)[_0x1a04('0xf')](function(_0x35693a){logger['info']('UserNotification,\x20%s,\x20%s',_0x1c0d1b,'request\x20sent');logger[_0x1a04('0x10')](_0x1a04('0x11'),_0x1c0d1b,_0x1a04('0x12'),JSON[_0x1a04('0x13')](_0x35693a));if(_0x35693a[_0x1a04('0x14')]){if(_0x35693a[_0x1a04('0x14')][_0x1a04('0x15')]===0x1f4){logger['error'](_0x1a04('0x16'),_0x1c0d1b,_0x35693a[_0x1a04('0x14')][_0x1a04('0x17')]);return _0x4f30f8(_0x35693a[_0x1a04('0x14')][_0x1a04('0x17')]);}logger[_0x1a04('0x14')]('UserNotification,\x20%s,\x20%s',_0x1c0d1b,_0x35693a[_0x1a04('0x14')][_0x1a04('0x17')]);return _0x42f9b9(_0x35693a[_0x1a04('0x14')][_0x1a04('0x17')]);}else{logger[_0x1a04('0x18')](_0x1a04('0x16'),_0x1c0d1b,_0x1a04('0x12'));_0x42f9b9(_0x35693a[_0x1a04('0x19')][_0x1a04('0x17')]);}})[_0x1a04('0x1a')](function(_0x2c0297){logger[_0x1a04('0x14')]('UserNotification,\x20%s,\x20%s',_0x1c0d1b,_0x2c0297);_0x4f30f8(_0x2c0297);});});} \ No newline at end of file +var _0x0196=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','defaults','redis','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','code','error','message','result','util','moment','bluebird'];(function(_0x1f87a3,_0x3799c5){var _0x17ebae=function(_0x55b076){while(--_0x55b076){_0x1f87a3['push'](_0x1f87a3['shift']());}};_0x17ebae(++_0x3799c5);}(_0x0196,0x184));var _0x6019=function(_0x416541,_0xc1193a){_0x416541=_0x416541-0x0;var _0x1206c9=_0x0196[_0x416541];return _0x1206c9;};'use strict';var _=require('lodash');var util=require(_0x6019('0x0'));var moment=require(_0x6019('0x1'));var BPromise=require(_0x6019('0x2'));var rs=require(_0x6019('0x3'));var fs=require('fs');var Redis=require(_0x6019('0x4'));var db=require(_0x6019('0x5'))['db'];var utils=require(_0x6019('0x6'));var logger=require(_0x6019('0x7'))(_0x6019('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6019('0x9')]({'port':0x232a});config['redis']=_[_0x6019('0xa')](config[_0x6019('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6019('0xc'))(new Redis(config[_0x6019('0xb')]));require('./userNotification.socket')[_0x6019('0xd')](socket);function respondWithRpcPromise(_0x32900c,_0x1e01b6,_0x571e7e){return new BPromise(function(_0x3761b9,_0x1ed186){return client[_0x6019('0xe')](_0x32900c,_0x571e7e)[_0x6019('0xf')](function(_0x32ff61){logger[_0x6019('0x10')](_0x6019('0x11'),_0x1e01b6,_0x6019('0x12'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x1e01b6,'request\x20sent',JSON['stringify'](_0x32ff61));if(_0x32ff61['error']){if(_0x32ff61['error'][_0x6019('0x13')]===0x1f4){logger[_0x6019('0x14')](_0x6019('0x11'),_0x1e01b6,_0x32ff61['error'][_0x6019('0x15')]);return _0x1ed186(_0x32ff61[_0x6019('0x14')]['message']);}logger[_0x6019('0x14')](_0x6019('0x11'),_0x1e01b6,_0x32ff61[_0x6019('0x14')]['message']);return _0x3761b9(_0x32ff61[_0x6019('0x14')]['message']);}else{logger[_0x6019('0x10')](_0x6019('0x11'),_0x1e01b6,_0x6019('0x12'));_0x3761b9(_0x32ff61[_0x6019('0x16')][_0x6019('0x15')]);}})['catch'](function(_0x5c6eb8){logger[_0x6019('0x14')]('UserNotification,\x20%s,\x20%s',_0x1e01b6,_0x5c6eb8);_0x1ed186(_0x5c6eb8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 869e4d3..5e60963 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 _0xb655=['./userNotification.events','save','update','emit','removeListener','length'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xb655,0xc0));var _0x5b65=function(_0x5940d1,_0x3f5687){_0x5940d1=_0x5940d1-0x0;var _0x3e7bca=_0xb655[_0x5940d1];return _0x3e7bca;};'use strict';var UserNotificationEvents=require(_0x5b65('0x0'));var events=[_0x5b65('0x1'),'remove',_0x5b65('0x2')];function createListener(_0x17e53f,_0x5112e4){return function(_0x26bfee){_0x5112e4[_0x5b65('0x3')](_0x17e53f,_0x26bfee);};}function removeListener(_0x4dbe18,_0x120b0b){return function(){UserNotificationEvents[_0x5b65('0x4')](_0x4dbe18,_0x120b0b);};}exports['register']=function(_0xd18447){for(var _0x547eff=0x0,_0x552b05=events[_0x5b65('0x5')];_0x547eff<_0x552b05;_0x547eff++){var _0x26b3ac=events[_0x547eff];var _0x1644be=createListener('userNotification:'+_0x26b3ac,_0xd18447);UserNotificationEvents['on'](_0x26b3ac,_0x1644be);}}; \ No newline at end of file +var _0x8807=['removeListener','register','userNotification:','./userNotification.events','remove','update'];(function(_0x1317f1,_0x4f3ee8){var _0x25b45f=function(_0x2c3178){while(--_0x2c3178){_0x1317f1['push'](_0x1317f1['shift']());}};_0x25b45f(++_0x4f3ee8);}(_0x8807,0x195));var _0x7880=function(_0x3bbd6b,_0x498df1){_0x3bbd6b=_0x3bbd6b-0x0;var _0x1d27fc=_0x8807[_0x3bbd6b];return _0x1d27fc;};'use strict';var UserNotificationEvents=require(_0x7880('0x0'));var events=['save',_0x7880('0x1'),_0x7880('0x2')];function createListener(_0x5c04cb,_0x4dceeb){return function(_0x20c684){_0x4dceeb['emit'](_0x5c04cb,_0x20c684);};}function removeListener(_0x59a0d7,_0x136c1c){return function(){UserNotificationEvents[_0x7880('0x3')](_0x59a0d7,_0x136c1c);};}exports[_0x7880('0x4')]=function(_0x2fa2a2){for(var _0x333433=0x0,_0x3b7682=events['length'];_0x333433<_0x3b7682;_0x333433++){var _0xb25893=events[_0x333433];var _0x49411b=createListener(_0x7880('0x5')+_0xb25893,_0x2fa2a2);UserNotificationEvents['on'](_0xb25893,_0x49411b);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index eb296b1..baa6707 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x8d8917,_0x504e20){var _0x55bd93=function(_0x24db56){while(--_0x24db56){_0x8d8917['push'](_0x8d8917['shift']());}};_0x55bd93(++_0x504e20);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x47e5f3,_0x164472){var _0x5d07e3=function(_0x373821){while(--_0x373821){_0x47e5f3['push'](_0x47e5f3['shift']());}};_0x5d07e3(++_0x164472);}(_0xedd9,0xfc));var _0x9edd=function(_0x162c30,_0x39448c){_0x162c30=_0x162c30-0x0;var _0x274e63=_0xedd9[_0x162c30];return _0x274e63;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index ea68511..84e3c88 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 _0x1074=['exports','INTEGER','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1074,0x137));var _0x4107=function(_0x5bced2,_0x317e86){_0x5bced2=_0x5bced2-0x0;var _0x2f5c70=_0x1074[_0x5bced2];return _0x2f5c70;};'use strict';var Sequelize=require(_0x4107('0x0'));module[_0x4107('0x1')]={'penalty':{'type':Sequelize[_0x4107('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc884=['sequelize','INTEGER'];(function(_0x53e973,_0x20c33b){var _0x18458f=function(_0x4c6b05){while(--_0x4c6b05){_0x53e973['push'](_0x53e973['shift']());}};_0x18458f(++_0x20c33b);}(_0xc884,0x130));var _0x4c88=function(_0x3ef854,_0x1ac8d5){_0x3ef854=_0x3ef854-0x0;var _0x36d0ed=_0xc884[_0x3ef854];return _0x36d0ed;};'use strict';var Sequelize=require(_0x4c88('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4c88('0x1')],'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 552be65..627d8c4 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 _0x1ea0=['api','moment','bluebird','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x1ea0,0x13d));var _0x01ea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1ea0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var logger=require(_0x01ea('0x2'))(_0x01ea('0x3'));var moment=require(_0x01ea('0x4'));var BPromise=require(_0x01ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x01ea('0x6'));var attributes=require(_0x01ea('0x7'));module['exports']=function(_0x846aa,_0x51d37e){return _0x846aa[_0x01ea('0x8')]('UserOpenchannelQueue',attributes,{'tableName':_0x01ea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcb0=['moment','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api'];(function(_0x54861c,_0x8756fc){var _0x4786d6=function(_0x2c151b){while(--_0x2c151b){_0x54861c['push'](_0x54861c['shift']());}};_0x4786d6(++_0x8756fc);}(_0xdcb0,0x19d));var _0x0dcb=function(_0x241cf4,_0x3c2f10){_0x241cf4=_0x241cf4-0x0;var _0x1a8b6d=_0xdcb0[_0x241cf4];return _0x1a8b6d;};'use strict';var _=require('lodash');var util=require(_0x0dcb('0x0'));var logger=require(_0x0dcb('0x1'))(_0x0dcb('0x2'));var moment=require(_0x0dcb('0x3'));var BPromise=require('bluebird');var rp=require(_0x0dcb('0x4'));var fs=require('fs');var path=require(_0x0dcb('0x5'));var rimraf=require(_0x0dcb('0x6'));var config=require(_0x0dcb('0x7'));var attributes=require(_0x0dcb('0x8'));module[_0x0dcb('0x9')]=function(_0x576c73,_0x29d957){return _0x576c73[_0x0dcb('0xa')](_0x0dcb('0xb'),attributes,{'tableName':_0x0dcb('0xc'),'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 b8b8ec2..1a0e826 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 _0x3363=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3363,0x1ae));var _0x3336=function(_0x1351de,_0x438b5b){_0x1351de=_0x1351de-0x0;var _0x103459=_0x3363[_0x1351de];return _0x103459;};'use strict';var _=require(_0x3336('0x0'));var util=require(_0x3336('0x1'));var moment=require(_0x3336('0x2'));var BPromise=require(_0x3336('0x3'));var rs=require(_0x3336('0x4'));var fs=require('fs');var Redis=require(_0x3336('0x5'));var db=require(_0x3336('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3336('0x7'))(_0x3336('0x8'));var config=require(_0x3336('0x9'));var jayson=require(_0x3336('0xa'));var client=jayson[_0x3336('0xb')][_0x3336('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x565722,_0x44ef62,_0x4ff339){return new BPromise(function(_0x4d6c96,_0x50ef97){return client[_0x3336('0xd')](_0x565722,_0x4ff339)[_0x3336('0xe')](function(_0x4bf3fd){logger[_0x3336('0xf')](_0x3336('0x10'),_0x44ef62,'request\x20sent');logger[_0x3336('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x44ef62,_0x3336('0x12'),JSON['stringify'](_0x4bf3fd));if(_0x4bf3fd[_0x3336('0x13')]){if(_0x4bf3fd[_0x3336('0x13')][_0x3336('0x14')]===0x1f4){logger['error'](_0x3336('0x10'),_0x44ef62,_0x4bf3fd[_0x3336('0x13')][_0x3336('0x15')]);return _0x50ef97(_0x4bf3fd['error'][_0x3336('0x15')]);}logger[_0x3336('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x44ef62,_0x4bf3fd[_0x3336('0x13')]['message']);return _0x4d6c96(_0x4bf3fd[_0x3336('0x13')][_0x3336('0x15')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x44ef62,_0x3336('0x12'));_0x4d6c96(_0x4bf3fd[_0x3336('0x16')]['message']);}})[_0x3336('0x17')](function(_0x20aeca){logger[_0x3336('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x44ef62,_0x20aeca);_0x50ef97(_0x20aeca);});});} \ No newline at end of file +var _0x8b3a=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0x8b3a,0x1b2));var _0xa8b3=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x8b3a[_0xef4ef0];return _0x39b60b;};'use strict';var _=require(_0xa8b3('0x0'));var util=require(_0xa8b3('0x1'));var moment=require(_0xa8b3('0x2'));var BPromise=require(_0xa8b3('0x3'));var rs=require(_0xa8b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8b3('0x5'))['db'];var utils=require(_0xa8b3('0x6'));var logger=require(_0xa8b3('0x7'))(_0xa8b3('0x8'));var config=require(_0xa8b3('0x9'));var jayson=require(_0xa8b3('0xa'));var client=jayson['client'][_0xa8b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x20eebe,_0x442d70,_0x40b790){return new BPromise(function(_0x274fe5,_0x241146){return client[_0xa8b3('0xc')](_0x20eebe,_0x40b790)[_0xa8b3('0xd')](function(_0x2192de){logger[_0xa8b3('0xe')](_0xa8b3('0xf'),_0x442d70,'request\x20sent');logger[_0xa8b3('0x10')](_0xa8b3('0x11'),_0x442d70,_0xa8b3('0x12'),JSON[_0xa8b3('0x13')](_0x2192de));if(_0x2192de[_0xa8b3('0x14')]){if(_0x2192de[_0xa8b3('0x14')]['code']===0x1f4){logger[_0xa8b3('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x442d70,_0x2192de[_0xa8b3('0x14')]['message']);return _0x241146(_0x2192de[_0xa8b3('0x14')][_0xa8b3('0x15')]);}logger[_0xa8b3('0x14')](_0xa8b3('0xf'),_0x442d70,_0x2192de[_0xa8b3('0x14')][_0xa8b3('0x15')]);return _0x274fe5(_0x2192de['error'][_0xa8b3('0x15')]);}else{logger['info'](_0xa8b3('0xf'),_0x442d70,_0xa8b3('0x12'));_0x274fe5(_0x2192de['result']['message']);}})[_0xa8b3('0x16')](function(_0x37f909){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x442d70,_0x37f909);_0x241146(_0x37f909);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6ca8d8a..9ca090a 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 _0x1611=['describe','/:id','getSections','getResources','post','create','/:id/sections','addResources','update','delete','destroy','removeSections','/:id/resources','removeResources','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','/describe','isAuthenticated'];(function(_0x1395e1,_0x1caaa0){var _0x6e7d8a=function(_0xa5f4a8){while(--_0xa5f4a8){_0x1395e1['push'](_0x1395e1['shift']());}};_0x6e7d8a(++_0x1caaa0);}(_0x1611,0xd6));var _0x1161=function(_0xe79504,_0x41f5ae){_0xe79504=_0xe79504-0x0;var _0x524e65=_0x1611[_0xe79504];return _0x524e65;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1161('0x0'));var express=require(_0x1161('0x1'));var router=express[_0x1161('0x2')]();var fs_extra=require(_0x1161('0x3'));var auth=require(_0x1161('0x4'));var interaction=require(_0x1161('0x5'));var config=require(_0x1161('0x6'));var controller=require(_0x1161('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1161('0x8')](_0x1161('0x9'),auth[_0x1161('0xa')](),controller[_0x1161('0xb')]);router['get'](_0x1161('0xc'),auth[_0x1161('0xa')](),controller['show']);router['get']('/:id/sections',auth[_0x1161('0xa')](),controller[_0x1161('0xd')]);router['get']('/:id/resources',auth['isAuthenticated'](),controller[_0x1161('0xe')]);router[_0x1161('0xf')]('/',auth[_0x1161('0xa')](),controller[_0x1161('0x10')]);router[_0x1161('0xf')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x1161('0xf')](_0x1161('0x11'),auth['isAuthenticated'](),controller['addSections']);router[_0x1161('0xf')]('/:id/resources',auth[_0x1161('0xa')](),controller[_0x1161('0x12')]);router['put']('/:id',auth[_0x1161('0xa')](),controller[_0x1161('0x13')]);router[_0x1161('0x14')](_0x1161('0xc'),auth[_0x1161('0xa')](),controller[_0x1161('0x15')]);router[_0x1161('0x14')](_0x1161('0x11'),auth[_0x1161('0xa')](),controller[_0x1161('0x16')]);router[_0x1161('0x14')](_0x1161('0x17'),auth[_0x1161('0xa')](),controller[_0x1161('0x18')]);module['exports']=router; \ No newline at end of file +var _0x29f7=['../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/resources','create','post','/:id/clone','/:id/sections','addSections','addResources','put','update','delete','removeSections','removeResources','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30e02c,_0x10fc99){var _0x4bdfcd=function(_0x58ae43){while(--_0x58ae43){_0x30e02c['push'](_0x30e02c['shift']());}};_0x4bdfcd(++_0x10fc99);}(_0x29f7,0xca));var _0x729f=function(_0x1dd897,_0x52f40c){_0x1dd897=_0x1dd897-0x0;var _0x4cd22d=_0x29f7[_0x1dd897];return _0x4cd22d;};'use strict';var multer=require(_0x729f('0x0'));var util=require(_0x729f('0x1'));var path=require(_0x729f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x729f('0x3'));var auth=require(_0x729f('0x4'));var interaction=require(_0x729f('0x5'));var config=require(_0x729f('0x6'));var controller=require(_0x729f('0x7'));router[_0x729f('0x8')]('/',auth[_0x729f('0x9')](),controller[_0x729f('0xa')]);router[_0x729f('0x8')](_0x729f('0xb'),auth[_0x729f('0x9')](),controller[_0x729f('0xc')]);router[_0x729f('0x8')](_0x729f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x729f('0x8')]('/:id/sections',auth['isAuthenticated'](),controller['getSections']);router[_0x729f('0x8')](_0x729f('0xe'),auth[_0x729f('0x9')](),controller['getResources']);router['post']('/',auth[_0x729f('0x9')](),controller[_0x729f('0xf')]);router[_0x729f('0x10')](_0x729f('0x11'),auth[_0x729f('0x9')](),controller['clone']);router[_0x729f('0x10')](_0x729f('0x12'),auth[_0x729f('0x9')](),controller[_0x729f('0x13')]);router[_0x729f('0x10')](_0x729f('0xe'),auth[_0x729f('0x9')](),controller[_0x729f('0x14')]);router[_0x729f('0x15')](_0x729f('0xd'),auth[_0x729f('0x9')](),controller[_0x729f('0x16')]);router[_0x729f('0x17')](_0x729f('0xd'),auth[_0x729f('0x9')](),controller['destroy']);router[_0x729f('0x17')](_0x729f('0x12'),auth['isAuthenticated'](),controller[_0x729f('0x18')]);router[_0x729f('0x17')](_0x729f('0xe'),auth['isAuthenticated'](),controller[_0x729f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index e8fe035..aa43b46 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 _0xd908=['getDataValue','STRING','BOOLEAN','sequelize','name','crudPermissions'];(function(_0x46c133,_0x303b60){var _0x275e95=function(_0x23d2e8){while(--_0x23d2e8){_0x46c133['push'](_0x46c133['shift']());}};_0x275e95(++_0x303b60);}(_0xd908,0x1b3));var _0x8d90=function(_0x58c301,_0x33abf4){_0x58c301=_0x58c301-0x0;var _0x33899c=_0xd908[_0x58c301];return _0x33899c;};'use strict';var Sequelize=require(_0x8d90('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8d90('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xe27b97){this['setDataValue'](_0x8d90('0x2'),_0xe27b97?_0xe27b97['join'](''):[]);},'get':function(){return this['getDataValue'](_0x8d90('0x2'))?this[_0x8d90('0x3')](_0x8d90('0x2'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8d90('0x4')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8d90('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8d90('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8d90('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x6ecb=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','crudPermissions','join'];(function(_0x1b0b9c,_0x202b29){var _0x11adcf=function(_0x391b41){while(--_0x391b41){_0x1b0b9c['push'](_0x1b0b9c['shift']());}};_0x11adcf(++_0x202b29);}(_0x6ecb,0x12c));var _0xb6ec=function(_0x5f4a33,_0x5a9b58){_0x5f4a33=_0x5f4a33-0x0;var _0x3f19b6=_0x6ecb[_0x5f4a33];return _0x3f19b6;};'use strict';var Sequelize=require(_0xb6ec('0x0'));module[_0xb6ec('0x1')]={'name':{'type':Sequelize[_0xb6ec('0x2')],'allowNull':![],'unique':_0xb6ec('0x3')},'crudPermissions':{'type':Sequelize[_0xb6ec('0x2')],'set':function(_0x53520e){this['setDataValue'](_0xb6ec('0x4'),_0x53520e?_0x53520e[_0xb6ec('0x5')](''):[]);},'get':function(){return this[_0xb6ec('0x6')](_0xb6ec('0x4'))?this[_0xb6ec('0x6')](_0xb6ec('0x4'))[_0xb6ec('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xb6ec('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xb6ec('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xb6ec('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xb6ec('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xb6ec('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xb6ec('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index cba4f81..7f17480 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 _0x5232=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userProfile.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','send','UserProfile','rawAttributes','fieldName','type','key','map','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','UserProfileSection','each','UserProfileResource','userProfileId','Resources','describe','addSections','sequelize','transaction','sectionId','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','autoAssociation','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x5ac1d0,_0x2591c1){var _0x307207=function(_0x2db6ea){while(--_0x2db6ea){_0x5ac1d0['push'](_0x5ac1d0['shift']());}};_0x307207(++_0x2591c1);}(_0x5232,0x1c9));var _0x2523=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x5232[_0x5cb97e];return _0x1714b4;};'use strict';var emlformat=require(_0x2523('0x0'));var rimraf=require(_0x2523('0x1'));var zipdir=require(_0x2523('0x2'));var jsonpatch=require(_0x2523('0x3'));var rp=require(_0x2523('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2523('0x5'));var util=require(_0x2523('0x6'));var path=require('path');var sox=require(_0x2523('0x7'));var csv=require(_0x2523('0x8'));var ejs=require(_0x2523('0x9'));var fs=require('fs');var fs_extra=require(_0x2523('0xa'));var _=require(_0x2523('0xb'));var squel=require(_0x2523('0xc'));var crypto=require(_0x2523('0xd'));var jsforce=require(_0x2523('0xe'));var deskjs=require(_0x2523('0xf'));var toCsv=require(_0x2523('0x8'));var querystring=require(_0x2523('0x10'));var Papa=require(_0x2523('0x11'));var Redis=require('ioredis');var authService=require(_0x2523('0x12'));var qs=require(_0x2523('0x13'));var as=require(_0x2523('0x14'));var hardwareService=require(_0x2523('0x15'));var logger=require(_0x2523('0x16'))(_0x2523('0x17'));var utils=require('../../config/utils');var config=require(_0x2523('0x18'));var licenseUtil=require(_0x2523('0x19'));var db=require(_0x2523('0x1a'))['db'];config[_0x2523('0x1b')]=_['defaults'](config[_0x2523('0x1b')],{'host':_0x2523('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2523('0x1b')]));require(_0x2523('0x1d'))[_0x2523('0x1e')](socket);function respondWithStatusCode(_0xc09a01,_0x4bc216){_0x4bc216=_0x4bc216||0xcc;return function(_0x211505){if(_0x211505){return _0xc09a01['sendStatus'](_0x4bc216);}return _0xc09a01[_0x2523('0x1f')](_0x4bc216)[_0x2523('0x20')]();};}function respondWithResult(_0x173218,_0x73e57a){_0x73e57a=_0x73e57a||0xc8;return function(_0x4830e4){if(_0x4830e4){return _0x173218[_0x2523('0x1f')](_0x73e57a)[_0x2523('0x21')](_0x4830e4);}};}function respondWithFilteredResult(_0x108159,_0x367bae){return function(_0x1ce828){if(_0x1ce828){var _0x2f3a96=typeof _0x367bae['offset']===_0x2523('0x22')&&typeof _0x367bae[_0x2523('0x23')]==='undefined';var _0x2819aa=_0x1ce828[_0x2523('0x24')];var _0x3f29f6=_0x2f3a96?0x0:_0x367bae[_0x2523('0x25')];var _0x5744d9=_0x2f3a96?_0x1ce828['count']:_0x367bae['offset']+_0x367bae['limit'];var _0x1d52dc;if(_0x5744d9>=_0x2819aa){_0x5744d9=_0x2819aa;_0x1d52dc=0xc8;}else{_0x1d52dc=0xce;}_0x108159[_0x2523('0x1f')](_0x1d52dc);return _0x108159[_0x2523('0x26')](_0x2523('0x27'),_0x3f29f6+'-'+_0x5744d9+'/'+_0x2819aa)[_0x2523('0x21')](_0x1ce828);}return null;};}function patchUpdates(_0x578a83){return function(_0x577359){try{jsonpatch['apply'](_0x577359,_0x578a83,!![]);}catch(_0x50e34e){return BPromise[_0x2523('0x28')](_0x50e34e);}return _0x577359[_0x2523('0x29')]();};}function saveUpdates(_0x4fc304,_0x5b5043){return function(_0x1df86b){if(_0x1df86b){return _0x1df86b[_0x2523('0x2a')](_0x4fc304)[_0x2523('0x2b')](function(_0x393956){return _0x393956;});}return null;};}function removeEntity(_0xd47858,_0x5495f4){return function(_0x3f3ab1){if(_0x3f3ab1){return _0x3f3ab1[_0x2523('0x2c')]()[_0x2523('0x2b')](function(){_0xd47858[_0x2523('0x1f')](0xcc)[_0x2523('0x20')]();});}};}function handleEntityNotFound(_0x23941b,_0x17b55c){return function(_0x3af962){if(!_0x3af962){_0x23941b[_0x2523('0x2d')](0x194);}return _0x3af962;};}function handleError(_0x4f88ca,_0x1c90f4){_0x1c90f4=_0x1c90f4||0x1f4;return function(_0x1565a8){logger['error'](_0x1565a8[_0x2523('0x2e')]);if(_0x1565a8['name']){delete _0x1565a8['name'];}_0x4f88ca['status'](_0x1c90f4)[_0x2523('0x2f')](_0x1565a8);};}exports['index']=function(_0x3d8862,_0x577c90){var _0x42ea60={},_0xb9cba8={},_0x5ba27c={'count':0x0,'rows':[]};var _0xe78975=_['map'](db[_0x2523('0x30')][_0x2523('0x31')],function(_0x965bb8){return{'name':_0x965bb8[_0x2523('0x32')],'type':_0x965bb8[_0x2523('0x33')][_0x2523('0x34')]};});_0xb9cba8['model']=_[_0x2523('0x35')](_0xe78975,_0x2523('0x36'));_0xb9cba8[_0x2523('0x37')]=_['keys'](_0x3d8862[_0x2523('0x37')]);_0xb9cba8['filters']=_[_0x2523('0x38')](_0xb9cba8[_0x2523('0x39')],_0xb9cba8[_0x2523('0x37')]);_0x42ea60[_0x2523('0x3a')]=_[_0x2523('0x38')](_0xb9cba8[_0x2523('0x39')],qs[_0x2523('0x3b')](_0x3d8862['query'][_0x2523('0x3b')]));_0x42ea60[_0x2523('0x3a')]=_0x42ea60[_0x2523('0x3a')][_0x2523('0x3c')]?_0x42ea60[_0x2523('0x3a')]:_0xb9cba8['model'];if(!_0x3d8862[_0x2523('0x37')][_0x2523('0x3d')](_0x2523('0x3e'))){_0x42ea60[_0x2523('0x23')]=qs['limit'](_0x3d8862[_0x2523('0x37')]['limit']);_0x42ea60[_0x2523('0x25')]=qs['offset'](_0x3d8862[_0x2523('0x37')][_0x2523('0x25')]);}_0x42ea60[_0x2523('0x3f')]=qs[_0x2523('0x40')](_0x3d8862[_0x2523('0x37')][_0x2523('0x40')]);_0x42ea60[_0x2523('0x41')]=qs[_0x2523('0x42')](_['pick'](_0x3d8862[_0x2523('0x37')],_0xb9cba8[_0x2523('0x42')]),_0xe78975);if(_0x3d8862[_0x2523('0x37')][_0x2523('0x43')]){_0x42ea60[_0x2523('0x41')]=_['merge'](_0x42ea60[_0x2523('0x41')],{'$or':_[_0x2523('0x35')](_0xe78975,function(_0x5164c3){if(_0x5164c3['type']!==_0x2523('0x44')){var _0x4aa9ad={};_0x4aa9ad[_0x5164c3[_0x2523('0x36')]]={'$like':'%'+_0x3d8862[_0x2523('0x37')][_0x2523('0x43')]+'%'};return _0x4aa9ad;}})});}_0x42ea60=_[_0x2523('0x45')]({},_0x42ea60,_0x3d8862['options']);var _0x51331d={'where':_0x42ea60[_0x2523('0x41')]};return db[_0x2523('0x30')][_0x2523('0x24')](_0x51331d)[_0x2523('0x2b')](function(_0x14104c){_0x5ba27c['count']=_0x14104c;if(_0x3d8862['query']['includeAll']){_0x42ea60[_0x2523('0x46')]=[{'all':!![]}];}return db[_0x2523('0x30')][_0x2523('0x47')](_0x42ea60);})['then'](function(_0x24e0e1){_0x5ba27c[_0x2523('0x48')]=_0x24e0e1;return _0x5ba27c;})['then'](respondWithFilteredResult(_0x577c90,_0x42ea60))[_0x2523('0x49')](handleError(_0x577c90,null));};exports[_0x2523('0x4a')]=function(_0x4180b1,_0x35cff0){var _0xb8d95e={'raw':![],'where':{'id':_0x4180b1[_0x2523('0x4b')]['id']}},_0x5a02bf={};_0x5a02bf[_0x2523('0x39')]=_[_0x2523('0x4c')](db[_0x2523('0x30')]['rawAttributes']);_0x5a02bf[_0x2523('0x37')]=_[_0x2523('0x4c')](_0x4180b1[_0x2523('0x37')]);_0x5a02bf[_0x2523('0x42')]=_['intersection'](_0x5a02bf['model'],_0x5a02bf[_0x2523('0x37')]);_0xb8d95e['attributes']=_[_0x2523('0x38')](_0x5a02bf[_0x2523('0x39')],qs[_0x2523('0x3b')](_0x4180b1[_0x2523('0x37')][_0x2523('0x3b')]));_0xb8d95e['attributes']=_0xb8d95e[_0x2523('0x3a')][_0x2523('0x3c')]?_0xb8d95e['attributes']:_0x5a02bf[_0x2523('0x39')];if(_0x4180b1[_0x2523('0x37')][_0x2523('0x4d')]){_0xb8d95e['include']=[{'all':!![]}];}_0xb8d95e=_[_0x2523('0x45')]({},_0xb8d95e,_0x4180b1[_0x2523('0x4e')]);return db[_0x2523('0x30')][_0x2523('0x4f')](_0xb8d95e)[_0x2523('0x2b')](handleEntityNotFound(_0x35cff0,null))['then'](respondWithResult(_0x35cff0,null))[_0x2523('0x49')](handleError(_0x35cff0,null));};exports[_0x2523('0x50')]=function(_0x4d0727,_0x569caa){return db['UserProfile']['create'](_0x4d0727[_0x2523('0x51')],{})[_0x2523('0x2b')](respondWithResult(_0x569caa,0xc9))[_0x2523('0x49')](handleError(_0x569caa,null));};exports[_0x2523('0x52')]=function(_0x3e9533,_0x3bb391){var _0x296c44={'where':{'id':_0x3e9533['params']['id']}},_0x5c891a={};_0x5c891a['model']=_[_0x2523('0x4c')](db[_0x2523('0x30')]['rawAttributes']);_0x296c44[_0x2523('0x3a')]=_[_0x2523('0x38')](_0x5c891a[_0x2523('0x39')],qs['fields'](_0x3e9533[_0x2523('0x37')][_0x2523('0x3b')]));_0x296c44[_0x2523('0x3a')]=_0x296c44['attributes']['length']?_0x296c44[_0x2523('0x3a')]:_0x5c891a[_0x2523('0x39')];if(_0x3e9533['query'][_0x2523('0x4d')]){_0x296c44[_0x2523('0x46')]=[{'all':!![]}];}_0x296c44=_[_0x2523('0x45')]({},_0x296c44,_0x3e9533[_0x2523('0x4e')]);return db[_0x2523('0x30')][_0x2523('0x4f')](_0x296c44)[_0x2523('0x2b')](handleEntityNotFound(_0x3bb391,null))[_0x2523('0x2b')](function(_0x27d74d){if(_0x27d74d){var _0x12c163=_0x27d74d[_0x2523('0x53')]({'plain':!![]});_0x12c163=qs[_0x2523('0x54')](_0x12c163,['id',_0x2523('0x55'),_0x2523('0x56'),_0x2523('0x57')]);_0x3e9533['body']=_[_0x2523('0x54')](_0x3e9533['body'],['id',_0x2523('0x55'),_0x2523('0x56')]);return db['sequelize']['transaction'](function(_0x37616d){return db[_0x2523('0x30')]['create'](_[_0x2523('0x45')](_0x12c163,_0x3e9533[_0x2523('0x51')]),{'include':_0x3e9533['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x37616d})[_0x2523('0x2b')](function(_0x570338){var _0x3da34a=_0x570338[_0x2523('0x53')]({'plain':!![]});return db[_0x2523('0x58')][_0x2523('0x47')]({'where':{'userProfileId':_0x3e9533[_0x2523('0x4b')]['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x5a5119){if(_0x5a5119){return BPromise[_0x2523('0x59')](_0x5a5119,function(_0x4136f0){return new BPromise(function(_0x4f1dad,_0x463709){if(_0x4136f0['autoAssociation']===null||_0x4136f0['autoAssociation']===0x1)_0x4f1dad(null);return db[_0x2523('0x5a')]['findAll']({'where':{'sectionId':_0x4136f0['id']},'raw':!![]})['then'](function(_0x30a910){var _0x43de6f=_[_0x2523('0x35')](_0x30a910,function(_0xc32bf3){return qs[_0x2523('0x54')](_0xc32bf3,['id',_0x2523('0x55'),_0x2523('0x56'),'sectionId']);});_0x4f1dad(_0x43de6f);})['catch'](function(_0x26c881){_0x463709(_0x26c881);});})[_0x2523('0x2b')](function(_0x3bcdf6){var _0x595cd5=qs[_0x2523('0x54')](_0x4136f0,['id',_0x2523('0x55'),'updatedAt']);_0x595cd5[_0x2523('0x5b')]=_0x3da34a['id'];if(_0x3bcdf6)_0x595cd5[_0x2523('0x5c')]=_0x3bcdf6;return _0x595cd5;})[_0x2523('0x2b')](function(_0x29dfd2){return db['UserProfileSection'][_0x2523('0x50')](_0x29dfd2,{'include':[{'model':db[_0x2523('0x5a')],'as':_0x2523('0x5c')}],'raw':!![],'transaction':_0x37616d});});})[_0x2523('0x2b')](function(){return _0x3da34a;});}});});});}})[_0x2523('0x2b')](respondWithResult(_0x3bb391,0xc9))[_0x2523('0x49')](handleError(_0x3bb391,null));};exports[_0x2523('0x2a')]=function(_0x2af3d2,_0x47078a){if(_0x2af3d2[_0x2523('0x51')]['id']){delete _0x2af3d2[_0x2523('0x51')]['id'];}return db[_0x2523('0x30')][_0x2523('0x4f')]({'where':{'id':_0x2af3d2[_0x2523('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47078a,null))[_0x2523('0x2b')](saveUpdates(_0x2af3d2[_0x2523('0x51')],null))[_0x2523('0x2b')](respondWithResult(_0x47078a,null))[_0x2523('0x49')](handleError(_0x47078a,null));};exports[_0x2523('0x2c')]=function(_0x3c6306,_0x5f19f6){return db[_0x2523('0x30')]['find']({'where':{'id':_0x3c6306[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x5f19f6,null))[_0x2523('0x2b')](removeEntity(_0x5f19f6,null))['catch'](handleError(_0x5f19f6,null));};exports[_0x2523('0x5d')]=function(_0x42a76a,_0x1daf51){return db[_0x2523('0x30')][_0x2523('0x5d')]()[_0x2523('0x2b')](respondWithResult(_0x1daf51,null))[_0x2523('0x49')](handleError(_0x1daf51,null));};exports[_0x2523('0x5e')]=function(_0x44706e,_0x451e00){var _0x3a54ac=_0x44706e['body'];return db[_0x2523('0x30')]['find']({'where':{'id':_0x44706e[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x451e00,null))[_0x2523('0x2b')](function(_0xcc1b79){if(_0xcc1b79){return db[_0x2523('0x5f')][_0x2523('0x60')](function(_0x53e6d8){return db[_0x2523('0x58')][_0x2523('0x2c')]({'where':{'userProfileId':_0x44706e[_0x2523('0x4b')]['id'],'sectionId':_[_0x2523('0x35')](_0x3a54ac,function(_0x5d8178){return _0x5d8178[_0x2523('0x61')];})},'transaction':_0x53e6d8})[_0x2523('0x2b')](function(){var _0x5090f2=_[_0x2523('0x35')](_0x3a54ac,function(_0x4f56cf){_0x4f56cf['userProfileId']=_0x44706e['params']['id'];return _0x4f56cf;});var _0x5bba49=[];return BPromise[_0x2523('0x59')](_0x5090f2,function(_0x573bb5){return db[_0x2523('0x58')][_0x2523('0x50')](_0x573bb5,{'include':[{'model':db[_0x2523('0x5a')],'as':_0x2523('0x5c')}],'raw':!![],'transaction':_0x53e6d8})[_0x2523('0x2b')](function(_0x1c1e75){_0x5bba49['push'](_0x1c1e75['get']({'plain':!![]}));});})[_0x2523('0x2b')](function(){return _0x5bba49;});});});}})[_0x2523('0x2b')](function(_0x174559){return _0x174559;})['then'](respondWithResult(_0x451e00,null))['catch'](handleError(_0x451e00,null));};exports[_0x2523('0x62')]=function(_0x6be76b,_0x33cf70){var _0x2617f1;return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0x6be76b[_0x2523('0x4b')]['id']},'attributes':['id',_0x2523('0x36')]})['then'](handleEntityNotFound(_0x33cf70,null))[_0x2523('0x2b')](function(_0x1ac011){if(_0x1ac011){_0x2617f1=_0x1ac011;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x6be76b[_0x2523('0x4b')]['id'],'sectionId':_0x6be76b[_0x2523('0x37')][_0x2523('0x63')]}});}})[_0x2523('0x2b')](function(){return _0x2617f1;})['then'](respondWithStatusCode(_0x33cf70,null))[_0x2523('0x49')](handleError(_0x33cf70,null));};exports[_0x2523('0x64')]=function(_0x3c11a1,_0x1fecc0){var _0x29750c=[];var _0x505cb6=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3c11a1[_0x2523('0x4b')]['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x334b5c){_0x29750c=_['filter'](_0x334b5c,function(_0x3da450){return _0x3da450[_0x2523('0x65')]===0x1||_[_0x2523('0x66')]([0x3eb,0x709],_0x3da450[_0x2523('0x61')]);});if(!_[_0x2523('0x67')](_0x29750c)){return _['map'](_0x29750c,function(_0x47e5ce){return _0x47e5ce[_0x2523('0x61')];});}else{return;}})['then'](function(_0x4e358d){if(_0x4e358d)_0x505cb6=_0x4e358d;if(_[_0x2523('0x66')](_0x505cb6,0x64)){var _0x2e1dff=_[_0x2523('0x4f')](_0x29750c,{'sectionId':0x64});return hasDefaultDashboard(_0x2e1dff)['then'](function(_0x458993){return _[_0x2523('0x35')](_0x29750c,function(_0x2ede82){if(_0x2ede82[_0x2523('0x61')]===0x64){_0x2ede82[_0x2523('0x68')]=_0x458993;}return _0x2ede82;});});}else{return;}})[_0x2523('0x2b')](function(_0x50d724){if(_0x50d724)_0x29750c=_0x50d724;if(_[_0x2523('0x66')](_0x505cb6,0x3eb)){var _0x4d8233=_[_0x2523('0x4f')](_0x29750c,{'sectionId':0x3eb});return getCustomDashboards(_0x4d8233)[_0x2523('0x2b')](function(_0x4489a8){return _[_0x2523('0x35')](_0x29750c,function(_0x49a9a0){if(_0x4d8233[_0x2523('0x65')]){if(_0x49a9a0['sectionId']===0x3eb){_0x49a9a0[_0x2523('0x68')]=_0x4489a8;}}else{if(_0x49a9a0[_0x2523('0x61')]===0x64){_0x49a9a0[_0x2523('0x68')]=_0x4489a8;}}return _0x49a9a0;});});}else{return;}})[_0x2523('0x2b')](function(_0x3ce53f){if(_0x3ce53f)_0x29750c=_0x3ce53f;if(_[_0x2523('0x66')](_0x505cb6,0x709)){var _0x18bdb2=_['find'](_0x29750c,{'sectionId':0x709});return getPlugins(_0x18bdb2)[_0x2523('0x2b')](function(_0x3c12fa){if(_0x18bdb2['enabled']){return _[_0x2523('0x35')](_0x29750c,function(_0x29ff8e){if(_0x29ff8e['sectionId']===0x709){_0x29ff8e[_0x2523('0x68')]=_0x3c12fa;}return _0x29ff8e;});}else{var _0x2b218b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3c12fa};var _0x2b5c64=_[_0x2523('0x35')](_0x29750c);_0x2b5c64[_0x2523('0x69')](_0x2b218b);return _0x2b5c64;}});}else{return;}})[_0x2523('0x2b')](function(_0x3f3af9){if(_0x3f3af9)_0x29750c=_0x3f3af9;return _[_0x2523('0x43')](_0x29750c,[_0x2523('0x65'),0x1]);})[_0x2523('0x2b')](respondWithResult(_0x1fecc0,null))[_0x2523('0x49')](handleError(_0x1fecc0,null));};function hasDefaultDashboard(_0x5f412a){var _0x28f53e=[0x65];return new BPromise(function(_0x4168ae,_0x57e29c){try{if(_0x5f412a['autoAssociation']){_0x4168ae(_0x28f53e);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x5f412a['id']},'raw':!![]})[_0x2523('0x2b')](function(_0xd275c8){_0xd275c8?_0x4168ae(_0x28f53e):_0x4168ae();});}}catch(_0x13af4b){_0x57e29c(_0x13af4b);}});}function getCustomDashboards(_0x369752){var _0x12f8b3=[];return new BPromise(function(_0x5b889b,_0x197f9e){try{if(_0x369752[_0x2523('0x6a')]){return db[_0x2523('0x6b')][_0x2523('0x47')]({'raw':!![]})[_0x2523('0x2b')](function(_0x3675d8){_0x3675d8[_0x2523('0x6c')](function(_0x10ede3){_0x12f8b3[_0x2523('0x69')](_0x10ede3['id']+0x1869f);});_0x5b889b(_0x12f8b3);});}else{return db[_0x2523('0x5a')][_0x2523('0x47')]({'where':{'sectionId':_0x369752['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x34be38){_0x34be38[_0x2523('0x6c')](function(_0x787029){_0x12f8b3[_0x2523('0x69')](_0x787029[_0x2523('0x6d')]+0x1869f);});_0x5b889b(_0x12f8b3);});}}catch(_0x2fc802){_0x197f9e(_0x2fc802);}});}function getPlugins(_0x162a4b){var _0x3af278=[];return new BPromise(function(_0x4c804f,_0x99f6e7){try{if(_0x162a4b[_0x2523('0x6a')]){return db[_0x2523('0x6e')][_0x2523('0x47')]({'raw':!![]})['then'](function(_0x2295dd){_0x2295dd['forEach'](function(_0x5a76cc){_0x3af278['push'](_0x5a76cc['id']+0x15b38);});_0x4c804f(_0x3af278);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x162a4b['id']},'raw':!![]})[_0x2523('0x2b')](function(_0x5f49a5){_0x5f49a5['forEach'](function(_0x405d63){_0x3af278[_0x2523('0x69')](_0x405d63['resourceId']+0x15b38);});_0x4c804f(_0x3af278);});}}catch(_0x4c3a84){_0x99f6e7(_0x4c3a84);}});}exports[_0x2523('0x6f')]=function(_0xc74259,_0x33b23a){return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0xc74259[_0x2523('0x4b')]['id']}})['then'](handleEntityNotFound(_0x33b23a,null))[_0x2523('0x2b')](function(_0x5b96a0){if(_0x5b96a0){return db['sequelize'][_0x2523('0x60')](function(_0x148633){return db[_0x2523('0x58')]['findAll']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x2523('0x2b')](function(_0x5d50c9){if(_0x5d50c9){return db[_0x2523('0x58')]['destroy']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id'],'id':_[_0x2523('0x35')](_0x5d50c9,function(_0x1de812){return _0x1de812['id'];})},'transaction':_0x148633});}})[_0x2523('0x2b')](function(_0x519a9d){var _0x24e346=_['map'](_0xc74259[_0x2523('0x51')],function(_0x46efbe){_0x46efbe[_0x2523('0x5b')]=_0xc74259[_0x2523('0x4b')]['id'];return _0x46efbe;});return db[_0x2523('0x58')]['bulkCreate'](_0x24e346,{'raw':!![],'transaction':_0x148633});})[_0x2523('0x2b')](function(_0x25cb9b){var _0x64c848=_['filter'](_[_0x2523('0x35')](_0x25cb9b,function(_0x2dff11){return _0x2dff11[_0x2523('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x64c848){return db[_0x2523('0x58')]['findAll']({'where':{'userProfileId':_0xc74259[_0x2523('0x4b')]['id'],'sectionId':_['map'](_0x64c848,function(_0x2c3abd){return _0x2c3abd[_0x2523('0x61')];})},'attributes':['id',_0x2523('0x61')],'raw':!![]})[_0x2523('0x2b')](function(_0x578f11){var _0x2b4868=_[_0x2523('0x35')](_0xc74259['body'],function(_0x577df9){_0x577df9[_0x2523('0x5b')]=_0xc74259[_0x2523('0x4b')]['id'];return _0x577df9;});return db[_0x2523('0x5a')][_0x2523('0x70')](_0x2b4868,{'raw':!![],'transaction':_0x148633});});}})['catch'](handleError(_0x33b23a,null));});}})['then'](function(_0x589fae){var _0x534e2d=_[_0x2523('0x35')](_0x589fae,function(_0x357938){return _0x357938['get']({'plain':!![]});});})[_0x2523('0x2b')](respondWithResult(_0x33b23a,null))[_0x2523('0x49')](handleError(_0x33b23a,null));};exports[_0x2523('0x71')]=function(_0x57e874,_0x458254,_0xa1d53){return db[_0x2523('0x30')][_0x2523('0x4f')]({'where':{'id':_0x57e874[_0x2523('0x4b')]['id']}})[_0x2523('0x2b')](handleEntityNotFound(_0x458254,null))[_0x2523('0x2b')](function(_0x2d3222){if(_0x2d3222){return _0x2d3222[_0x2523('0x71')](_0x57e874[_0x2523('0x37')]['ids']);}})[_0x2523('0x2b')](respondWithStatusCode(_0x458254,null))[_0x2523('0x49')](handleError(_0x458254,null));};exports['getResources']=function(_0x4382d2,_0x8b9b6a){var _0x4454e6={};if(!_0x4382d2[_0x2523('0x37')]['section'])throw new Error(_0x2523('0x72'));if(!_0x4382d2['query'][_0x2523('0x3d')](_0x2523('0x3e'))){_0x4454e6[_0x2523('0x23')]=qs[_0x2523('0x23')](_0x4382d2[_0x2523('0x37')]['limit']);_0x4454e6[_0x2523('0x25')]=qs[_0x2523('0x25')](_0x4382d2[_0x2523('0x37')]['offset']);}return db['UserProfile'][_0x2523('0x4f')]({'where':{'id':_0x4382d2[_0x2523('0x4b')]['id']}})['then'](function(_0x2a52dc){if(!_0x2a52dc)throw new Error(_0x2523('0x73')+_0x4382d2[_0x2523('0x4b')]['id']);return db[_0x2523('0x30')][_0x2523('0x74')](_0x4382d2);})['then'](respondWithFilteredResult(_0x8b9b6a,_0x4454e6))[_0x2523('0x49')](handleError(_0x8b9b6a,null));}; \ No newline at end of file +var _0xe2cf=['to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','show','params','keys','catch','create','body','clone','find','get','omit','createdAt','updatedAt','crudPermissions','UserProfileSection','each','autoAssociation','sectionId','Resources','UserProfileResource','describe','addSections','transaction','userProfileId','push','getSections','enabled','isEmpty','includes','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox'];(function(_0x3f9d05,_0x4706b4){var _0x1c3f12=function(_0x273e34){while(--_0x273e34){_0x3f9d05['push'](_0x3f9d05['shift']());}};_0x1c3f12(++_0x4706b4);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3ecf3f,_0x1709c9){_0x3ecf3f=_0x3ecf3f-0x0;var _0x1c6c85=_0xe2cf[_0x3ecf3f];return _0x1c6c85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfe2c('0x15'))(new Redis(config['redis']));require('./userProfile.socket')[_0xfe2c('0x16')](socket);function respondWithStatusCode(_0x4d0a10,_0x2aa7df){_0x2aa7df=_0x2aa7df||0xcc;return function(_0x12e4c4){if(_0x12e4c4){return _0x4d0a10['sendStatus'](_0x2aa7df);}return _0x4d0a10['status'](_0x2aa7df)[_0xfe2c('0x17')]();};}function respondWithResult(_0x3b3ebd,_0x1dbed4){_0x1dbed4=_0x1dbed4||0xc8;return function(_0x56cebc){if(_0x56cebc){return _0x3b3ebd['status'](_0x1dbed4)[_0xfe2c('0x18')](_0x56cebc);}};}function respondWithFilteredResult(_0x96a3a3,_0x135436){return function(_0x23242b){if(_0x23242b){var _0x36aeec=typeof _0x135436[_0xfe2c('0x19')]==='undefined'&&typeof _0x135436[_0xfe2c('0x1a')]===_0xfe2c('0x1b');var _0x1d7852=_0x23242b[_0xfe2c('0x1c')];var _0x55f751=_0x36aeec?0x0:_0x135436[_0xfe2c('0x19')];var _0x59bdeb=_0x36aeec?_0x23242b['count']:_0x135436[_0xfe2c('0x19')]+_0x135436[_0xfe2c('0x1a')];var _0x4bf7c0;if(_0x59bdeb>=_0x1d7852){_0x59bdeb=_0x1d7852;_0x4bf7c0=0xc8;}else{_0x4bf7c0=0xce;}_0x96a3a3[_0xfe2c('0x1d')](_0x4bf7c0);return _0x96a3a3[_0xfe2c('0x1e')]('Content-Range',_0x55f751+'-'+_0x59bdeb+'/'+_0x1d7852)[_0xfe2c('0x18')](_0x23242b);}return null;};}function patchUpdates(_0x5dd54b){return function(_0x4481ff){try{jsonpatch[_0xfe2c('0x1f')](_0x4481ff,_0x5dd54b,!![]);}catch(_0x8b5c0d){return BPromise[_0xfe2c('0x20')](_0x8b5c0d);}return _0x4481ff[_0xfe2c('0x21')]();};}function saveUpdates(_0x2ee3b3,_0x57cd6d){return function(_0x41a545){if(_0x41a545){return _0x41a545[_0xfe2c('0x22')](_0x2ee3b3)[_0xfe2c('0x23')](function(_0x26448c){return _0x26448c;});}return null;};}function removeEntity(_0x3486b5,_0x10afde){return function(_0x53bab0){if(_0x53bab0){return _0x53bab0[_0xfe2c('0x24')]()['then'](function(){_0x3486b5[_0xfe2c('0x1d')](0xcc)[_0xfe2c('0x17')]();});}};}function handleEntityNotFound(_0x1c35d3,_0x54e356){return function(_0x377cc5){if(!_0x377cc5){_0x1c35d3[_0xfe2c('0x25')](0x194);}return _0x377cc5;};}function handleError(_0x59094a,_0x3d7e1f){_0x3d7e1f=_0x3d7e1f||0x1f4;return function(_0x1b6eb7){logger[_0xfe2c('0x26')](_0x1b6eb7[_0xfe2c('0x27')]);if(_0x1b6eb7[_0xfe2c('0x28')]){delete _0x1b6eb7[_0xfe2c('0x28')];}_0x59094a['status'](_0x3d7e1f)['send'](_0x1b6eb7);};}exports[_0xfe2c('0x29')]=function(_0x13e9a9,_0x1a5e15){var _0xe940fe={},_0xf4495b={},_0x4bd059={'count':0x0,'rows':[]};var _0x1f8ea7=_[_0xfe2c('0x2a')](db[_0xfe2c('0x2b')][_0xfe2c('0x2c')],function(_0x2843a5){return{'name':_0x2843a5[_0xfe2c('0x2d')],'type':_0x2843a5[_0xfe2c('0x2e')][_0xfe2c('0x2f')]};});_0xf4495b[_0xfe2c('0x30')]=_[_0xfe2c('0x2a')](_0x1f8ea7,_0xfe2c('0x28'));_0xf4495b[_0xfe2c('0x31')]=_['keys'](_0x13e9a9[_0xfe2c('0x31')]);_0xf4495b[_0xfe2c('0x32')]=_[_0xfe2c('0x33')](_0xf4495b['model'],_0xf4495b[_0xfe2c('0x31')]);_0xe940fe[_0xfe2c('0x34')]=_['intersection'](_0xf4495b[_0xfe2c('0x30')],qs[_0xfe2c('0x35')](_0x13e9a9[_0xfe2c('0x31')]['fields']));_0xe940fe[_0xfe2c('0x34')]=_0xe940fe[_0xfe2c('0x34')][_0xfe2c('0x36')]?_0xe940fe[_0xfe2c('0x34')]:_0xf4495b[_0xfe2c('0x30')];if(!_0x13e9a9[_0xfe2c('0x31')][_0xfe2c('0x37')]('nolimit')){_0xe940fe['limit']=qs[_0xfe2c('0x1a')](_0x13e9a9[_0xfe2c('0x31')][_0xfe2c('0x1a')]);_0xe940fe[_0xfe2c('0x19')]=qs['offset'](_0x13e9a9[_0xfe2c('0x31')]['offset']);}_0xe940fe[_0xfe2c('0x38')]=qs[_0xfe2c('0x39')](_0x13e9a9['query'][_0xfe2c('0x39')]);_0xe940fe['where']=qs['filters'](_[_0xfe2c('0x3a')](_0x13e9a9[_0xfe2c('0x31')],_0xf4495b[_0xfe2c('0x32')]),_0x1f8ea7);if(_0x13e9a9[_0xfe2c('0x31')][_0xfe2c('0x3b')]){_0xe940fe[_0xfe2c('0x3c')]=_[_0xfe2c('0x3d')](_0xe940fe[_0xfe2c('0x3c')],{'$or':_[_0xfe2c('0x2a')](_0x1f8ea7,function(_0x46cc5f){if(_0x46cc5f[_0xfe2c('0x2e')]!=='VIRTUAL'){var _0x39e1a0={};_0x39e1a0[_0x46cc5f[_0xfe2c('0x28')]]={'$like':'%'+_0x13e9a9[_0xfe2c('0x31')]['filter']+'%'};return _0x39e1a0;}})});}_0xe940fe=_['merge']({},_0xe940fe,_0x13e9a9['options']);var _0xc97c16={'where':_0xe940fe[_0xfe2c('0x3c')]};return db[_0xfe2c('0x2b')][_0xfe2c('0x1c')](_0xc97c16)['then'](function(_0x1ed30b){_0x4bd059[_0xfe2c('0x1c')]=_0x1ed30b;if(_0x13e9a9[_0xfe2c('0x31')][_0xfe2c('0x3e')]){_0xe940fe[_0xfe2c('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0xfe2c('0x40')](_0xe940fe);})[_0xfe2c('0x23')](function(_0x6055dd){_0x4bd059[_0xfe2c('0x41')]=_0x6055dd;return _0x4bd059;})['then'](respondWithFilteredResult(_0x1a5e15,_0xe940fe))['catch'](handleError(_0x1a5e15,null));};exports[_0xfe2c('0x42')]=function(_0x1f64cc,_0x4c9aaa){var _0x3c2004={'raw':![],'where':{'id':_0x1f64cc[_0xfe2c('0x43')]['id']}},_0x27862d={};_0x27862d[_0xfe2c('0x30')]=_['keys'](db[_0xfe2c('0x2b')][_0xfe2c('0x2c')]);_0x27862d[_0xfe2c('0x31')]=_[_0xfe2c('0x44')](_0x1f64cc[_0xfe2c('0x31')]);_0x27862d[_0xfe2c('0x32')]=_[_0xfe2c('0x33')](_0x27862d[_0xfe2c('0x30')],_0x27862d['query']);_0x3c2004[_0xfe2c('0x34')]=_['intersection'](_0x27862d[_0xfe2c('0x30')],qs[_0xfe2c('0x35')](_0x1f64cc[_0xfe2c('0x31')][_0xfe2c('0x35')]));_0x3c2004['attributes']=_0x3c2004['attributes']['length']?_0x3c2004['attributes']:_0x27862d['model'];if(_0x1f64cc[_0xfe2c('0x31')]['includeAll']){_0x3c2004['include']=[{'all':!![]}];}_0x3c2004=_[_0xfe2c('0x3d')]({},_0x3c2004,_0x1f64cc['options']);return db[_0xfe2c('0x2b')]['find'](_0x3c2004)[_0xfe2c('0x23')](handleEntityNotFound(_0x4c9aaa,null))[_0xfe2c('0x23')](respondWithResult(_0x4c9aaa,null))[_0xfe2c('0x45')](handleError(_0x4c9aaa,null));};exports[_0xfe2c('0x46')]=function(_0x3cfda2,_0x57ad76){return db[_0xfe2c('0x2b')][_0xfe2c('0x46')](_0x3cfda2[_0xfe2c('0x47')],{})['then'](respondWithResult(_0x57ad76,0xc9))[_0xfe2c('0x45')](handleError(_0x57ad76,null));};exports[_0xfe2c('0x48')]=function(_0x579b6b,_0x56f716){var _0x5255db={'where':{'id':_0x579b6b[_0xfe2c('0x43')]['id']}},_0x3c3e58={};_0x3c3e58[_0xfe2c('0x30')]=_[_0xfe2c('0x44')](db[_0xfe2c('0x2b')]['rawAttributes']);_0x5255db[_0xfe2c('0x34')]=_[_0xfe2c('0x33')](_0x3c3e58[_0xfe2c('0x30')],qs['fields'](_0x579b6b['query'][_0xfe2c('0x35')]));_0x5255db[_0xfe2c('0x34')]=_0x5255db[_0xfe2c('0x34')][_0xfe2c('0x36')]?_0x5255db[_0xfe2c('0x34')]:_0x3c3e58[_0xfe2c('0x30')];if(_0x579b6b[_0xfe2c('0x31')][_0xfe2c('0x3e')]){_0x5255db[_0xfe2c('0x3f')]=[{'all':!![]}];}_0x5255db=_[_0xfe2c('0x3d')]({},_0x5255db,_0x579b6b['options']);return db[_0xfe2c('0x2b')][_0xfe2c('0x49')](_0x5255db)[_0xfe2c('0x23')](handleEntityNotFound(_0x56f716,null))[_0xfe2c('0x23')](function(_0x1ee7f1){if(_0x1ee7f1){var _0x32e987=_0x1ee7f1[_0xfe2c('0x4a')]({'plain':!![]});_0x32e987=qs[_0xfe2c('0x4b')](_0x32e987,['id',_0xfe2c('0x4c'),_0xfe2c('0x4d'),_0xfe2c('0x4e')]);_0x579b6b['body']=_[_0xfe2c('0x4b')](_0x579b6b['body'],['id',_0xfe2c('0x4c'),'updatedAt']);return db['sequelize']['transaction'](function(_0x13499b){return db['UserProfile'][_0xfe2c('0x46')](_['merge'](_0x32e987,_0x579b6b[_0xfe2c('0x47')]),{'include':_0x579b6b[_0xfe2c('0x31')][_0xfe2c('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x13499b})[_0xfe2c('0x23')](function(_0x1e03d0){var _0xf68850=_0x1e03d0[_0xfe2c('0x4a')]({'plain':!![]});return db[_0xfe2c('0x4f')][_0xfe2c('0x40')]({'where':{'userProfileId':_0x579b6b['params']['id']},'raw':!![]})[_0xfe2c('0x23')](function(_0x1b4ab9){if(_0x1b4ab9){return BPromise[_0xfe2c('0x50')](_0x1b4ab9,function(_0x385c21){return new BPromise(function(_0x366687,_0x5e6d96){if(_0x385c21[_0xfe2c('0x51')]===null||_0x385c21[_0xfe2c('0x51')]===0x1)_0x366687(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x385c21['id']},'raw':!![]})[_0xfe2c('0x23')](function(_0x20514f){var _0xa22dca=_[_0xfe2c('0x2a')](_0x20514f,function(_0x16be1b){return qs[_0xfe2c('0x4b')](_0x16be1b,['id',_0xfe2c('0x4c'),'updatedAt',_0xfe2c('0x52')]);});_0x366687(_0xa22dca);})[_0xfe2c('0x45')](function(_0x4679){_0x5e6d96(_0x4679);});})[_0xfe2c('0x23')](function(_0x1e010e){var _0x320842=qs[_0xfe2c('0x4b')](_0x385c21,['id','createdAt',_0xfe2c('0x4d')]);_0x320842['userProfileId']=_0xf68850['id'];if(_0x1e010e)_0x320842[_0xfe2c('0x53')]=_0x1e010e;return _0x320842;})[_0xfe2c('0x23')](function(_0x4cede1){return db[_0xfe2c('0x4f')]['create'](_0x4cede1,{'include':[{'model':db[_0xfe2c('0x54')],'as':_0xfe2c('0x53')}],'raw':!![],'transaction':_0x13499b});});})['then'](function(){return _0xf68850;});}});});});}})[_0xfe2c('0x23')](respondWithResult(_0x56f716,0xc9))['catch'](handleError(_0x56f716,null));};exports[_0xfe2c('0x22')]=function(_0x5231ae,_0x23827b){if(_0x5231ae[_0xfe2c('0x47')]['id']){delete _0x5231ae['body']['id'];}return db[_0xfe2c('0x2b')][_0xfe2c('0x49')]({'where':{'id':_0x5231ae[_0xfe2c('0x43')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x23827b,null))[_0xfe2c('0x23')](saveUpdates(_0x5231ae['body'],null))[_0xfe2c('0x23')](respondWithResult(_0x23827b,null))[_0xfe2c('0x45')](handleError(_0x23827b,null));};exports[_0xfe2c('0x24')]=function(_0x264af9,_0x516237){return db[_0xfe2c('0x2b')]['find']({'where':{'id':_0x264af9[_0xfe2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x516237,null))[_0xfe2c('0x23')](removeEntity(_0x516237,null))[_0xfe2c('0x45')](handleError(_0x516237,null));};exports[_0xfe2c('0x55')]=function(_0x281213,_0x2733a7){return db[_0xfe2c('0x2b')][_0xfe2c('0x55')]()[_0xfe2c('0x23')](respondWithResult(_0x2733a7,null))[_0xfe2c('0x45')](handleError(_0x2733a7,null));};exports[_0xfe2c('0x56')]=function(_0x3da347,_0x2fcb15){var _0x2b855e=_0x3da347[_0xfe2c('0x47')];return db[_0xfe2c('0x2b')][_0xfe2c('0x49')]({'where':{'id':_0x3da347['params']['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x2fcb15,null))['then'](function(_0xdafb46){if(_0xdafb46){return db['sequelize'][_0xfe2c('0x57')](function(_0x500e9a){return db['UserProfileSection'][_0xfe2c('0x24')]({'where':{'userProfileId':_0x3da347[_0xfe2c('0x43')]['id'],'sectionId':_[_0xfe2c('0x2a')](_0x2b855e,function(_0x40124f){return _0x40124f[_0xfe2c('0x52')];})},'transaction':_0x500e9a})['then'](function(){var _0x313d80=_[_0xfe2c('0x2a')](_0x2b855e,function(_0x4e973f){_0x4e973f[_0xfe2c('0x58')]=_0x3da347[_0xfe2c('0x43')]['id'];return _0x4e973f;});var _0x517401=[];return BPromise['each'](_0x313d80,function(_0x58165d){return db[_0xfe2c('0x4f')][_0xfe2c('0x46')](_0x58165d,{'include':[{'model':db[_0xfe2c('0x54')],'as':'Resources'}],'raw':!![],'transaction':_0x500e9a})['then'](function(_0x3ec7be){_0x517401[_0xfe2c('0x59')](_0x3ec7be['get']({'plain':!![]}));});})[_0xfe2c('0x23')](function(){return _0x517401;});});});}})[_0xfe2c('0x23')](function(_0x5ac774){return _0x5ac774;})[_0xfe2c('0x23')](respondWithResult(_0x2fcb15,null))['catch'](handleError(_0x2fcb15,null));};exports['removeSections']=function(_0x43504d,_0x414b87){var _0x4a233d;return db[_0xfe2c('0x2b')][_0xfe2c('0x49')]({'where':{'id':_0x43504d['params']['id']},'attributes':['id',_0xfe2c('0x28')]})['then'](handleEntityNotFound(_0x414b87,null))['then'](function(_0x1f5190){if(_0x1f5190){_0x4a233d=_0x1f5190;return db[_0xfe2c('0x4f')]['destroy']({'where':{'userProfileId':_0x43504d[_0xfe2c('0x43')]['id'],'sectionId':_0x43504d[_0xfe2c('0x31')]['ids']}});}})[_0xfe2c('0x23')](function(){return _0x4a233d;})['then'](respondWithStatusCode(_0x414b87,null))[_0xfe2c('0x45')](handleError(_0x414b87,null));};exports[_0xfe2c('0x5a')]=function(_0x20f799,_0x45a272){var _0x57bfe3=[];var _0x10e0a0=[];return db[_0xfe2c('0x4f')]['findAll']({'where':{'userProfileId':_0x20f799[_0xfe2c('0x43')]['id']},'raw':!![]})['then'](function(_0x373006){_0x57bfe3=_['filter'](_0x373006,function(_0x16529c){return _0x16529c[_0xfe2c('0x5b')]===0x1||_['includes']([0x3eb,0x709],_0x16529c[_0xfe2c('0x52')]);});if(!_[_0xfe2c('0x5c')](_0x57bfe3)){return _[_0xfe2c('0x2a')](_0x57bfe3,function(_0x21ea78){return _0x21ea78[_0xfe2c('0x52')];});}else{return;}})[_0xfe2c('0x23')](function(_0x52627b){if(_0x52627b)_0x10e0a0=_0x52627b;if(_[_0xfe2c('0x5d')](_0x10e0a0,0x64)){var _0x524fac=_['find'](_0x57bfe3,{'sectionId':0x64});return hasDefaultDashboard(_0x524fac)[_0xfe2c('0x23')](function(_0xa260cf){return _[_0xfe2c('0x2a')](_0x57bfe3,function(_0xb2ad67){if(_0xb2ad67[_0xfe2c('0x52')]===0x64){_0xb2ad67[_0xfe2c('0x5e')]=_0xa260cf;}return _0xb2ad67;});});}else{return;}})['then'](function(_0x890225){if(_0x890225)_0x57bfe3=_0x890225;if(_[_0xfe2c('0x5d')](_0x10e0a0,0x3eb)){var _0x1a4f1c=_[_0xfe2c('0x49')](_0x57bfe3,{'sectionId':0x3eb});return getCustomDashboards(_0x1a4f1c)['then'](function(_0x376de3){return _[_0xfe2c('0x2a')](_0x57bfe3,function(_0x392232){if(_0x1a4f1c[_0xfe2c('0x5b')]){if(_0x392232['sectionId']===0x3eb){_0x392232[_0xfe2c('0x5e')]=_0x376de3;}}else{if(_0x392232['sectionId']===0x64){_0x392232['subsections']=_0x376de3;}}return _0x392232;});});}else{return;}})['then'](function(_0x447feb){if(_0x447feb)_0x57bfe3=_0x447feb;if(_[_0xfe2c('0x5d')](_0x10e0a0,0x709)){var _0x3d4c3e=_[_0xfe2c('0x49')](_0x57bfe3,{'sectionId':0x709});return getPlugins(_0x3d4c3e)[_0xfe2c('0x23')](function(_0x37d2b0){if(_0x3d4c3e[_0xfe2c('0x5b')]){return _[_0xfe2c('0x2a')](_0x57bfe3,function(_0x3a4409){if(_0x3a4409['sectionId']===0x709){_0x3a4409['subsections']=_0x37d2b0;}return _0x3a4409;});}else{var _0x1552fb={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37d2b0};var _0x156d2d=_[_0xfe2c('0x2a')](_0x57bfe3);_0x156d2d[_0xfe2c('0x59')](_0x1552fb);return _0x156d2d;}});}else{return;}})[_0xfe2c('0x23')](function(_0x206d24){if(_0x206d24)_0x57bfe3=_0x206d24;return _['filter'](_0x57bfe3,[_0xfe2c('0x5b'),0x1]);})[_0xfe2c('0x23')](respondWithResult(_0x45a272,null))[_0xfe2c('0x45')](handleError(_0x45a272,null));};function hasDefaultDashboard(_0x40465e){var _0x2549fc=[0x65];return new BPromise(function(_0x20ea78,_0x21cdf3){try{if(_0x40465e[_0xfe2c('0x51')]){_0x20ea78(_0x2549fc);}else{return db[_0xfe2c('0x54')]['findOne']({'where':{'sectionId':_0x40465e['id']},'raw':!![]})[_0xfe2c('0x23')](function(_0x245bc1){_0x245bc1?_0x20ea78(_0x2549fc):_0x20ea78();});}}catch(_0x49863d){_0x21cdf3(_0x49863d);}});}function getCustomDashboards(_0xaedb60){var _0x5ededc=[];return new BPromise(function(_0x78a54c,_0x575784){try{if(_0xaedb60[_0xfe2c('0x51')]){return db[_0xfe2c('0x5f')][_0xfe2c('0x40')]({'raw':!![]})[_0xfe2c('0x23')](function(_0x57453e){_0x57453e['forEach'](function(_0x306cc4){_0x5ededc[_0xfe2c('0x59')](_0x306cc4['id']+0x1869f);});_0x78a54c(_0x5ededc);});}else{return db[_0xfe2c('0x54')]['findAll']({'where':{'sectionId':_0xaedb60['id']},'raw':!![]})[_0xfe2c('0x23')](function(_0x29e622){_0x29e622[_0xfe2c('0x60')](function(_0x5dd213){_0x5ededc[_0xfe2c('0x59')](_0x5dd213[_0xfe2c('0x61')]+0x1869f);});_0x78a54c(_0x5ededc);});}}catch(_0x1193c2){_0x575784(_0x1193c2);}});}function getPlugins(_0xc86d1b){var _0x12ee7d=[];return new BPromise(function(_0x2fa25c,_0x11493d){try{if(_0xc86d1b[_0xfe2c('0x51')]){return db[_0xfe2c('0x62')]['findAll']({'raw':!![]})[_0xfe2c('0x23')](function(_0x539cfa){_0x539cfa[_0xfe2c('0x60')](function(_0x3222da){_0x12ee7d[_0xfe2c('0x59')](_0x3222da['id']+0x15b38);});_0x2fa25c(_0x12ee7d);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0xc86d1b['id']},'raw':!![]})['then'](function(_0x313d48){_0x313d48[_0xfe2c('0x60')](function(_0x111bee){_0x12ee7d[_0xfe2c('0x59')](_0x111bee[_0xfe2c('0x61')]+0x15b38);});_0x2fa25c(_0x12ee7d);});}}catch(_0x27d025){_0x11493d(_0x27d025);}});}exports[_0xfe2c('0x63')]=function(_0x14ebf0,_0x20c22a){return db[_0xfe2c('0x2b')][_0xfe2c('0x49')]({'where':{'id':_0x14ebf0[_0xfe2c('0x43')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x20c22a,null))['then'](function(_0x2c8880){if(_0x2c8880){return db['sequelize'][_0xfe2c('0x57')](function(_0x3f4bfd){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x14ebf0['params']['id']},'attributes':['id'],'raw':!![]})[_0xfe2c('0x23')](function(_0x38cfeb){if(_0x38cfeb){return db[_0xfe2c('0x4f')][_0xfe2c('0x24')]({'where':{'userProfileId':_0x14ebf0[_0xfe2c('0x43')]['id'],'id':_[_0xfe2c('0x2a')](_0x38cfeb,function(_0x4d9d8a){return _0x4d9d8a['id'];})},'transaction':_0x3f4bfd});}})['then'](function(_0x18639f){var _0x3c4ee8=_[_0xfe2c('0x2a')](_0x14ebf0['body'],function(_0x4104b3){_0x4104b3['userProfileId']=_0x14ebf0[_0xfe2c('0x43')]['id'];return _0x4104b3;});return db[_0xfe2c('0x4f')][_0xfe2c('0x64')](_0x3c4ee8,{'raw':!![],'transaction':_0x3f4bfd});})[_0xfe2c('0x23')](function(_0x5e3cc7){var _0x433fd2=_[_0xfe2c('0x3b')](_[_0xfe2c('0x2a')](_0x5e3cc7,function(_0x29b4f4){return _0x29b4f4[_0xfe2c('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x433fd2){return db['UserProfileSection'][_0xfe2c('0x40')]({'where':{'userProfileId':_0x14ebf0[_0xfe2c('0x43')]['id'],'sectionId':_['map'](_0x433fd2,function(_0xcf75b9){return _0xcf75b9[_0xfe2c('0x52')];})},'attributes':['id',_0xfe2c('0x52')],'raw':!![]})[_0xfe2c('0x23')](function(_0x3b3b5b){var _0x50f27e=_[_0xfe2c('0x2a')](_0x14ebf0[_0xfe2c('0x47')],function(_0x41ecea){_0x41ecea[_0xfe2c('0x58')]=_0x14ebf0[_0xfe2c('0x43')]['id'];return _0x41ecea;});return db[_0xfe2c('0x54')][_0xfe2c('0x64')](_0x50f27e,{'raw':!![],'transaction':_0x3f4bfd});});}})[_0xfe2c('0x45')](handleError(_0x20c22a,null));});}})['then'](function(_0x50976f){var _0xa20354=_[_0xfe2c('0x2a')](_0x50976f,function(_0x288669){return _0x288669[_0xfe2c('0x4a')]({'plain':!![]});});})[_0xfe2c('0x23')](respondWithResult(_0x20c22a,null))[_0xfe2c('0x45')](handleError(_0x20c22a,null));};exports['removeResources']=function(_0x51f905,_0x56479d,_0x2e2987){return db[_0xfe2c('0x2b')][_0xfe2c('0x49')]({'where':{'id':_0x51f905[_0xfe2c('0x43')]['id']}})[_0xfe2c('0x23')](handleEntityNotFound(_0x56479d,null))[_0xfe2c('0x23')](function(_0x3cd58f){if(_0x3cd58f){return _0x3cd58f[_0xfe2c('0x65')](_0x51f905[_0xfe2c('0x31')][_0xfe2c('0x66')]);}})['then'](respondWithStatusCode(_0x56479d,null))[_0xfe2c('0x45')](handleError(_0x56479d,null));};exports[_0xfe2c('0x67')]=function(_0x14631f,_0x5686e3){var _0x26946e={};if(!_0x14631f[_0xfe2c('0x31')][_0xfe2c('0x68')])throw new Error(_0xfe2c('0x69'));if(!_0x14631f[_0xfe2c('0x31')][_0xfe2c('0x37')]('nolimit')){_0x26946e['limit']=qs['limit'](_0x14631f[_0xfe2c('0x31')][_0xfe2c('0x1a')]);_0x26946e[_0xfe2c('0x19')]=qs[_0xfe2c('0x19')](_0x14631f[_0xfe2c('0x31')][_0xfe2c('0x19')]);}return db['UserProfile'][_0xfe2c('0x49')]({'where':{'id':_0x14631f['params']['id']}})[_0xfe2c('0x23')](function(_0x552cd3){if(!_0x552cd3)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x14631f[_0xfe2c('0x43')]['id']);return db[_0xfe2c('0x2b')][_0xfe2c('0x67')](_0x14631f);})['then'](respondWithFilteredResult(_0x5686e3,_0x26946e))[_0xfe2c('0x45')](handleError(_0x5686e3,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index b67c082..62a41b6 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 _0x3a6d=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a6d,0x143));var _0xd3a6=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3a6d[_0x465a0c];return _0x1e202e;};'use strict';var EventEmitter=require(_0xd3a6('0x0'));var UserProfile=require(_0xd3a6('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xd3a6('0x2')](0x0);var events={'afterCreate':_0xd3a6('0x3'),'afterUpdate':_0xd3a6('0x4'),'afterDestroy':_0xd3a6('0x5')};function emitEvent(_0x3d37ff){return function(_0x585473,_0x1cb966,_0x27d641){UserProfileEvents[_0xd3a6('0x6')](_0x3d37ff+':'+_0x585473['id'],_0x585473);UserProfileEvents[_0xd3a6('0x6')](_0x3d37ff,_0x585473);_0x27d641(null);};}for(var e in events){if(events[_0xd3a6('0x7')](e)){var event=events[e];UserProfile[_0xd3a6('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x5226=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x21005c,_0x38870c){var _0x483795=function(_0x116d4b){while(--_0x116d4b){_0x21005c['push'](_0x21005c['shift']());}};_0x483795(++_0x38870c);}(_0x5226,0x137));var _0x6522=function(_0x8f327b,_0x448380){_0x8f327b=_0x8f327b-0x0;var _0xf1eed9=_0x5226[_0x8f327b];return _0xf1eed9;};'use strict';var EventEmitter=require(_0x6522('0x0'));var UserProfile=require(_0x6522('0x1'))['db'][_0x6522('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6522('0x3')](0x0);var events={'afterCreate':_0x6522('0x4'),'afterUpdate':'update','afterDestroy':_0x6522('0x5')};function emitEvent(_0x43f913){return function(_0x12dffe,_0x48d4db,_0x228009){UserProfileEvents['emit'](_0x43f913+':'+_0x12dffe['id'],_0x12dffe);UserProfileEvents[_0x6522('0x6')](_0x43f913,_0x12dffe);_0x228009(null);};}for(var e in events){if(events[_0x6522('0x7')](e)){var event=events[e];UserProfile[_0x6522('0x8')](e,emitEvent(event));}}module[_0x6522('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d465b05..50614a6 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 _0xd39c=['inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','Telephones','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','toUpperCase','slice','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','sequelize','query','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','model','all','rawAttributes','keys','intersection','attributes','fields','nolimit','limit','offset','order','sort','filters','merge','key','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','default','DefaultReports','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tags','color','tag','openTabs','true','chat','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','filter','field','findAll','then','associatedResources','map','catch','value','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareRecording','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','role','agent','User','telephone','VoiceQueues','queue'];(function(_0x3a1a85,_0x1aecbc){var _0xb1e7ab=function(_0x4c9f82){while(--_0x4c9f82){_0x3a1a85['push'](_0x3a1a85['shift']());}};_0xb1e7ab(++_0x1aecbc);}(_0xd39c,0x14d));var _0xcd39=function(_0x2da988,_0x558a7a){_0x2da988=_0x2da988-0x0;var _0x296564=_0xd39c[_0x2da988];return _0x296564;};'use strict';var _=require(_0xcd39('0x0'));var attributes=require(_0xcd39('0x1'));var qs=require(_0xcd39('0x2'));var squel=require(_0xcd39('0x3'));module[_0xcd39('0x4')]=function(_0x51a777){var _0x16d677=_0x51a777['models'];function _0x2ee220(_0xefc3a,_0x4fb6b1){return new Promise(function(_0x3c9322,_0x258741){if(!_0x4fb6b1)return _0x3c9322(null);var _0x288d8f=_0x4fb6b1['filter']?{[_0x4fb6b1[_0xcd39('0x5')][_0xcd39('0x6')]]:_0x4fb6b1[_0xcd39('0x5')]['value']}:undefined;return _0x16d677[_0xefc3a][_0xcd39('0x7')]({'where':_0x288d8f,'raw':!![]})[_0xcd39('0x8')](function(_0x539df0){_0x4fb6b1[_0xcd39('0x9')]=_[_0xcd39('0xa')](_0x539df0,'id');_0x3c9322(_0x4fb6b1);})[_0xcd39('0xb')](function(_0x14f472){_0x258741(_0x14f472);});});}function _0x12b849(_0x331a93,_0x1d2a7e){return new Promise(function(_0x222569,_0x5c4db6){var _0x519622=_0x331a93['filter']?{[_0x331a93[_0xcd39('0x5')]['field']]:_0x331a93[_0xcd39('0x5')][_0xcd39('0xc')]}:undefined;return _0x16d677[_0x331a93['model']][_0xcd39('0x7')]({'where':_0x519622,'raw':!![]})[_0xcd39('0x8')](function(_0x266d48){_0x1d2a7e[_0xcd39('0x9')]=_[_0xcd39('0xa')](_0x266d48,function(_0x2a2376){return _0x2a2376['name'];});_0x222569(_0x1d2a7e);})['catch'](function(_0x3f1e5f){_0x5c4db6(_0x3f1e5f);});});}function _0x4a6389(_0x5791d4,_0x412602,_0x57f794){if(!_0x412602)return Promise[_0xcd39('0xd')](null);return new Promise(function(_0xc80db6,_0x567937){return _0x16d677[_0xcd39('0xe')]['findAll']({'where':{'sectionId':_0x412602['id']},'raw':!![]})['then'](function(_0x25ba9b){if(_0x5791d4[_0xcd39('0x6')]&&_0x5791d4['field']!=='id'){_0x412602[_0xcd39('0x9')]=_['map'](_0x25ba9b,function(_0x55960f){return _0x55960f[_0x5791d4[_0xcd39('0x6')]];});}else{if(_0x57f794===_0xcd39('0xf')){_0x412602['associatedResources']=_[_0xcd39('0xa')](_0x25ba9b,function(_0x31d9cd){return{'id':_0x31d9cd[_0xcd39('0x10')],'type':_0x31d9cd[_0xcd39('0x11')]};});}else{_0x412602[_0xcd39('0x9')]=_[_0xcd39('0xa')](_0x25ba9b,function(_0x3fbbd8){return _0x3fbbd8[_0xcd39('0x10')];});}}_0xc80db6(_0x412602);})['catch'](function(_0x4fbd78){_0x567937(_0x4fbd78);});});}function _0x543358(_0x3569e5,_0x417442){var _0x391b43={'parentSections':[]};switch(_0x3569e5['toLowerCase']()){case _0xcd39('0x12'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x14');break;case _0xcd39('0x15'):_0x391b43[_0xcd39('0x13')]='SquareOdbc';break;case'squarerecordings':_0x391b43[_0xcd39('0x13')]=_0xcd39('0x16');_0x391b43['parentSections']=[{'name':_0xcd39('0x17'),'field':_0xcd39('0x18'),'foreignKey':_0xcd39('0x19')}];break;case _0xcd39('0x1a'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x1b');break;case _0xcd39('0x1c'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x1d');_0x391b43[_0xcd39('0x1e')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xcd39('0x1f'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x20');break;case _0xcd39('0x21'):_0x391b43['childModel']=_0xcd39('0x22');break;case _0xcd39('0x23'):_0x391b43[_0xcd39('0x13')]='CmCustomField';break;case _0xcd39('0x24'):_0x391b43[_0xcd39('0x13')]='ChatQueue';break;case _0xcd39('0x25'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x26');break;case _0xcd39('0x27'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x28');break;case _0xcd39('0x29'):_0x391b43[_0xcd39('0x13')]='FaxAccount';break;case _0xcd39('0x2a'):case _0xcd39('0x2b'):case _0xcd39('0x2c'):_0x391b43['childModel']=_0xcd39('0x2d');break;case _0xcd39('0x2e'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x2f');break;case _0xcd39('0x30'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x31');break;case _0xcd39('0x32'):_0x391b43['childModel']='VoiceRecording';_0x391b43[_0xcd39('0x1e')]=[{'name':_0xcd39('0x33'),'field':_0xcd39('0x18'),'foreignKey':_0xcd39('0x34'),'model':'User','filter':{'field':_0xcd39('0x35'),'value':[_0xcd39('0x36')]}},{'name':'Telephones','field':_0xcd39('0x18'),'foreignKey':_0xcd39('0x34'),'model':_0xcd39('0x37'),'filter':{'field':'role','value':[_0xcd39('0x38')]}},{'name':_0xcd39('0x39'),'field':_0xcd39('0x18'),'foreignKey':_0xcd39('0x3a'),'model':'VoiceQueue','filter':{'field':_0xcd39('0x11'),'value':[_0xcd39('0x3b')]}},{'name':_0xcd39('0x3c'),'field':_0xcd39('0x18'),'foreignKey':_0xcd39('0x3a'),'model':_0xcd39('0x3d'),'filter':{'field':'type','value':[_0xcd39('0x3e')]}}];break;case _0xcd39('0x3f'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x40');break;case _0xcd39('0x41'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x42');break;case'voiceprefixes':_0x391b43['childModel']=_0xcd39('0x43');break;case'ivrcampaigns':_0x391b43[_0xcd39('0x13')]='Campaign';break;case _0xcd39('0x44'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x45');break;case'mailaccounts':_0x391b43[_0xcd39('0x13')]=_0xcd39('0x46');break;case _0xcd39('0x47'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x48');break;case'openchannelqueues':_0x391b43[_0xcd39('0x13')]=_0xcd39('0x49');break;case _0xcd39('0x4a'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x4b');break;case _0xcd39('0x4c'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x4d');break;case _0xcd39('0x4e'):_0x391b43['childModel']=_0xcd39('0x4f');break;case _0xcd39('0x50'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x51');break;case'whatsappaccounts':_0x391b43[_0xcd39('0x13')]=_0xcd39('0x52');break;case _0xcd39('0x53'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x54');break;case _0xcd39('0x55'):case _0xcd39('0x56'):_0x391b43['childModel']=_0xcd39('0x3d');if(_0x417442){_0x391b43['parentSections']=[{'name':_0xcd39('0x39')},{'name':'QueueCampaigns'}];}break;case _0xcd39('0x57'):case _0xcd39('0x58'):case _0xcd39('0x59'):_0x391b43['childModel']='User';if(_0x417442){_0x391b43['parentSections']=[{'name':_0xcd39('0x5a'),'filter':{'field':_0xcd39('0x35'),'value':[_0xcd39('0x5b'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xcd39('0x5c')}];}break;case _0xcd39('0x5d'):_0x391b43[_0xcd39('0x13')]='ZendeskAccount';break;case'salesforceaccounts':_0x391b43[_0xcd39('0x13')]=_0xcd39('0x5e');break;case _0xcd39('0x5f'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x60');break;case _0xcd39('0x61'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x62');break;case _0xcd39('0x63'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x64');break;case _0xcd39('0x65'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x66');break;case _0xcd39('0x67'):_0x391b43[_0xcd39('0x13')]='User';break;case _0xcd39('0x68'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x69');break;case _0xcd39('0x6a'):_0x391b43['childModel']='Disposition';break;case _0xcd39('0x6b'):_0x391b43['childModel']=_0xcd39('0x6c');break;case _0xcd39('0x6d'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x6e');break;case _0xcd39('0x6f'):_0x391b43[_0xcd39('0x13')]='Pause';break;case _0xcd39('0x70'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x71');break;case _0xcd39('0x72'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x73');break;case _0xcd39('0x74'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x75');break;case _0xcd39('0x76'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x77');break;case _0xcd39('0x78'):_0x391b43['childModel']=_0xcd39('0x79');break;case _0xcd39('0x7a'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0x7b');break;case'variables':_0x391b43['childModel']=_0xcd39('0x7c');break;case _0xcd39('0x7d'):_0x391b43[_0xcd39('0x13')]='Plugin';break;case _0xcd39('0x7e'):_0x391b43[_0xcd39('0x13')]=_0xcd39('0xf');_0x391b43[_0xcd39('0x1e')]=[{'name':_0xcd39('0x7f'),'field':'id','foreignKey':_0xcd39('0x80')}];break;case _0xcd39('0x81'):_0x391b43[_0xcd39('0x13')]='AnalyticMetric';break;}return _0x391b43;}function _0x444882(_0x2b0efe,_0x16b15f){var _0x586616=_0x2b0efe['charAt'](0x0)[_0xcd39('0x82')]()+_0x2b0efe[_0xcd39('0x83')](0x1);var _0xc83548={'type':_0x16d677['Sequelize']['QueryTypes'][_0xcd39('0x84')],'raw':!![]};return new Promise(function(_0x1b8f86,_0x520783){var _0x15ebf4=squel['select']()['field'](_0xcd39('0x85')+_0x586616+_0xcd39('0x86'),'id')[_0xcd39('0x6')](_0xcd39('0x87'))[_0xcd39('0x88')]('user_has_'+_0x2b0efe+_0xcd39('0x89'),'ui')[_0xcd39('0x8a')]('ui.UserId\x20=\x20?',_0x16b15f['id']);return _0x16d677[_0xcd39('0x8b')][_0xcd39('0x8c')](_0x15ebf4['toString'](),_0xc83548)['then'](function(_0x5148b8){_0x16b15f[_0x586616+'OpenTabs']=_0x5148b8;_0x1b8f86(_0x5148b8);})[_0xcd39('0xb')](function(_0xf8298e){_0x520783(_0xf8298e);});});}return _0x51a777[_0xcd39('0x8d')](_0xcd39('0x8e'),attributes,{'tableName':_0xcd39('0x8f'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3b631c){var _0x1aa9be={'raw':_0x3b631c[_0xcd39('0x8c')][_0xcd39('0x90')],'where':{}};var _0x52d345={};var _0x292d11={'count':0x0,'rows':[]};var _0x2337b0=_0x3b631c[_0xcd39('0x8c')][_0xcd39('0x91')];var _0x5b19e3=_0x3b631c[_0xcd39('0x8c')][_0xcd39('0x92')]||![];var _0x1e85ef=_0x543358(_0x2337b0,_0x5b19e3);if(!_0x1e85ef[_0xcd39('0x13')])throw new Error(_0xcd39('0x93')+_0x2337b0+'\x27');var _0x6bcb4f=[{'name':_0x2337b0}];if(!_[_0xcd39('0x94')](_0x1e85ef[_0xcd39('0x1e')]))_0x6bcb4f=_0x1e85ef[_0xcd39('0x1e')];var _0x251e1d=[];for(var _0x18d1ec=0x0;_0x18d1ec<_0x6bcb4f[_0xcd39('0x95')];_0x18d1ec++){_0x251e1d[_0xcd39('0x96')](_0x16d677[_0xcd39('0x97')][_0xcd39('0x98')]({'where':{'userProfileId':_0x3b631c[_0xcd39('0x99')]['id'],'name':_0x6bcb4f[_0x18d1ec][_0xcd39('0x18')]},'raw':!![]}));}return Promise['all'](_0x251e1d)[_0xcd39('0x8')](function(_0x1518b9){var _0x459a75=_[_0xcd39('0x5')](_0x1518b9,function(_0xbce209){return _0xbce209?_0xbce209:undefined;});var _0x51cb23=_[_0xcd39('0x5')](_0x6bcb4f,['ignore',!![]]);var _0xda2836=_[_0xcd39('0x94')](_0x459a75)&&_[_0xcd39('0x94')](_0x51cb23)?null:_['union'](_0x51cb23,_0x459a75);if(!_0xda2836)return null;var _0x2e6dfb=[];for(var _0x2a8420=0x0;_0x2a8420<_0xda2836[_0xcd39('0x95')];_0x2a8420++){var _0xe09e06=_[_0xcd39('0x98')](_0x6bcb4f,function(_0x39b85d){return _0xda2836[_0x2a8420]?_0x39b85d[_0xcd39('0x18')]===_0xda2836[_0x2a8420][_0xcd39('0x18')]:null;});if(_0xe09e06){if(_0xda2836[_0x2a8420][_0xcd39('0x9a')]){_0x2e6dfb[_0xcd39('0x96')](_0x2ee220(_0x1e85ef['childModel'],_0xda2836[_0x2a8420]));}else{if(!_0xda2836[_0x2a8420]['autoAssociation']){_0x2e6dfb[_0xcd39('0x96')](_0x4a6389(_0xe09e06,_0xda2836[_0x2a8420],_0x1e85ef[_0xcd39('0x13')]));}else{if(_0xe09e06[_0xcd39('0x9b')]){_0x2e6dfb[_0xcd39('0x96')](_0x12b849(_0xe09e06,_0xda2836[_0x2a8420]));}}}}}return Promise[_0xcd39('0x9c')](_0x2e6dfb);})[_0xcd39('0x8')](function(_0x520b9a){var _0x41e40d=_0x520b9a;var _0x27eef3=null;if(_0x41e40d){_0x27eef3=_0x41e40d[_0xcd39('0x95')]===0x1?_0x41e40d[0x0]:null;}if(!_0x27eef3&&!_0x41e40d)return _0x292d11;var _0x47cc76=_0x16d677[_0x1e85ef['childModel']][_0xcd39('0x9d')];_0x52d345[_0xcd39('0x9b')]=_['keys'](_0x47cc76);_0x52d345[_0xcd39('0x8c')]=_[_0xcd39('0x9e')](_0x3b631c[_0xcd39('0x8c')]);_0x52d345['filters']=_[_0xcd39('0x9f')](_0x52d345[_0xcd39('0x9b')],_0x52d345[_0xcd39('0x8c')]);_0x1aa9be[_0xcd39('0xa0')]=_[_0xcd39('0x9f')](_0x52d345[_0xcd39('0x9b')],qs[_0xcd39('0xa1')](_0x3b631c[_0xcd39('0x8c')]['fields']));_0x1aa9be[_0xcd39('0xa0')]=_0x1aa9be[_0xcd39('0xa0')][_0xcd39('0x95')]?_0x1aa9be[_0xcd39('0xa0')]:_0x52d345[_0xcd39('0x9b')];if(!_0x3b631c[_0xcd39('0x8c')]['hasOwnProperty'](_0xcd39('0xa2'))){_0x1aa9be[_0xcd39('0xa3')]=qs[_0xcd39('0xa3')](_0x3b631c['query'][_0xcd39('0xa3')]);_0x1aa9be[_0xcd39('0xa4')]=qs['offset'](_0x3b631c['query'][_0xcd39('0xa4')]);}_0x1aa9be[_0xcd39('0xa5')]=qs[_0xcd39('0xa6')](_0x3b631c[_0xcd39('0x8c')][_0xcd39('0xa6')]);_0x1aa9be[_0xcd39('0x8a')]=qs[_0xcd39('0xa7')](_['pick'](_0x3b631c[_0xcd39('0x8c')],_0x52d345[_0xcd39('0xa7')]));if(_0x3b631c[_0xcd39('0x8c')][_0xcd39('0x5')]){_0x1aa9be[_0xcd39('0x8a')]=_[_0xcd39('0xa8')](_0x1aa9be['where'],{'$or':_[_0xcd39('0xa')](_0x47cc76,function(_0x69629e){if(_0x69629e[_0xcd39('0x11')][_0xcd39('0xa9')]!==_0xcd39('0xaa')){var _0x3f7974={};_0x3f7974[_0x69629e[_0xcd39('0x6')]]={'$like':'%'+_0x3b631c[_0xcd39('0x8c')]['filter']+'%'};return _0x3f7974;}})});}var _0x11b93e=[];var _0x58214e=null;var _0x246165={};if(_0x27eef3){_0x58214e=_[_0xcd39('0x98')](_0x6bcb4f,[_0xcd39('0x18'),_0x27eef3[_0xcd39('0x18')]]);if(_0x58214e[_0xcd39('0x6')]){_0x246165={};if(_0x1e85ef[_0xcd39('0x13')]===_0xcd39('0xf')){_0x246165[_0x58214e['foreignKey']]=_[_0xcd39('0xa')](_0x27eef3[_0xcd39('0x9')],'id');}else{_0x246165[_0x58214e[_0xcd39('0xab')]]=_0x27eef3[_0xcd39('0x9')];}_0x11b93e[_0xcd39('0x96')](_0x246165);}else{_0x1aa9be[_0xcd39('0x8a')]['id']=_0x27eef3[_0xcd39('0x9')];}}else{for(var _0x5c54c2=0x0;_0x5c54c2<_0x41e40d[_0xcd39('0x95')];_0x5c54c2++){_0x58214e=_['find'](_0x6bcb4f,['name',_0x41e40d[_0x5c54c2][_0xcd39('0x18')]]);if(_0x58214e[_0xcd39('0x6')]){_0x246165={};_0x246165[_0x58214e[_0xcd39('0xab')]]=_0x41e40d[_0x5c54c2][_0xcd39('0x9')];_0x11b93e[_0xcd39('0x96')](_0x246165);}else{if(!_0x1aa9be[_0xcd39('0x8a')]['id'])_0x1aa9be[_0xcd39('0x8a')]['id']=[];_0x41e40d[_0x5c54c2][_0xcd39('0x9')][_0xcd39('0xac')](function(_0x1c37c2){_0x1aa9be[_0xcd39('0x8a')]['id'][_0xcd39('0x96')](_0x1c37c2);});}}}if(!_[_0xcd39('0x94')](_0x11b93e)){_0x1aa9be['where']=_['merge'](_0x1aa9be[_0xcd39('0x8a')],{'$and':{'$or':_0x11b93e}});}_0x1aa9be=_[_0xcd39('0xa8')]({},_0x1aa9be,_0x3b631c[_0xcd39('0xad')]);if(_0x27eef3&&!_0x27eef3[_0xcd39('0xae')]&&_0x1e85ef[_0xcd39('0x13')]===_0xcd39('0xf')){if(_0x3b631c[_0xcd39('0x8c')][_0xcd39('0xaf')]){_0x1aa9be[_0xcd39('0xb0')]=[{'all':!![]}];}return _0x16d677[_0x1e85ef[_0xcd39('0x13')]][_0xcd39('0x7')](_0x1aa9be)[_0xcd39('0x8')](function(_0x232ee9){var _0x49452b=[];_0x232ee9[_0xcd39('0xac')](function(_0x56ee2d){var _0x5c0676;switch(_0x56ee2d['reportType']){case _0xcd39('0xb1'):_0x5c0676=_['find'](_0x27eef3[_0xcd39('0x9')],function(_0x4401ba){return _0x4401ba['id']===_0x56ee2d['reportId']&&_0x4401ba['type']===_0xcd39('0xb2');});break;case'custom':_0x5c0676=_[_0xcd39('0x98')](_0x27eef3[_0xcd39('0x9')],function(_0x442481){return _0x442481['id']===_0x56ee2d['reportId']&&_0x442481[_0xcd39('0x11')]===_0xcd39('0xb3');});break;}if(_0x5c0676)_0x49452b[_0xcd39('0x96')](_0x56ee2d);});_0x292d11['count']=_0x49452b[_0xcd39('0x95')];_0x292d11[_0xcd39('0xb4')]=_0x49452b;return _0x292d11;});}else{if(!_[_0xcd39('0x94')](_0x3b631c[_0xcd39('0x8c')]['ids'])){_0x1aa9be[_0xcd39('0x8a')]['id']=_0x1aa9be[_0xcd39('0x8a')]['id']?_[_0xcd39('0x9f')](_0x1aa9be['where']['id'],_0x3b631c['query'][_0xcd39('0xb5')]):_0x3b631c['query']['ids'];if(_0x3b631c['query'][_0xcd39('0xb6')]){_0x1aa9be[_0xcd39('0xa5')]=_0x3b631c[_0xcd39('0x8c')]['customSorting'];}}if(_0x3b631c[_0xcd39('0x8c')][_0xcd39('0xb7')]){_0x1aa9be[_0xcd39('0x8a')]=_[_0xcd39('0xa8')](_0x1aa9be[_0xcd39('0x8a')],{'$and':_0x3b631c[_0xcd39('0x8c')][_0xcd39('0xb7')]});}return _0x16d677[_0x1e85ef[_0xcd39('0x13')]]['count']({'where':_0x1aa9be[_0xcd39('0x8a')]})['then'](function(_0x5986d8){_0x292d11[_0xcd39('0xb8')]=_0x5986d8;if(_0x3b631c['query'][_0xcd39('0xaf')]){if(_0x1e85ef['childModel']===_0xcd39('0x1d')){_0x1aa9be['include']=[{'model':_0x16d677[_0xcd39('0x75')],'as':_0xcd39('0xb9'),'attributes':['id',_0xcd39('0x18'),_0xcd39('0xba')],'required':_0x3b631c[_0xcd39('0x8c')][_0xcd39('0xbb')]?!![]:![]},{'model':_0x16d677[_0xcd39('0x75')],'as':'ThroughTags','attributes':['id',_0xcd39('0x18'),_0xcd39('0xba')],'through':_0x3b631c[_0xcd39('0x8c')]['tag']?{'attributes':[],'where':{'TagId':_0x3b631c[_0xcd39('0x8c')]['tag']||undefined}}:{},'required':_0x3b631c['query'][_0xcd39('0xbb')]?!![]:![]}];}else{_0x1aa9be['include']=[{'all':!![]}];}}return _0x16d677[_0x1e85ef[_0xcd39('0x13')]][_0xcd39('0x7')](_0x1aa9be);})[_0xcd39('0x8')](function(_0xb491ca){_0x292d11[_0xcd39('0xb4')]=_0xb491ca;if(_0x2337b0===_0xcd39('0x33')&&_0x3b631c['query'][_0xcd39('0xbc')]===_0xcd39('0xbd')){var _0x13ac45=[];for(var _0x102a6d=0x0;_0x102a6d<_0x292d11[_0xcd39('0xb4')][_0xcd39('0x95')];_0x102a6d++){_0x13ac45['push'](_0x444882(_0xcd39('0xbe'),_0x292d11['rows'][_0x102a6d][_0xcd39('0xbf')]));_0x13ac45[_0xcd39('0x96')](_0x444882(_0xcd39('0xc0'),_0x292d11[_0xcd39('0xb4')][_0x102a6d]['dataValues']));_0x13ac45['push'](_0x444882(_0xcd39('0xc1'),_0x292d11['rows'][_0x102a6d][_0xcd39('0xbf')]));_0x13ac45[_0xcd39('0x96')](_0x444882('mail',_0x292d11['rows'][_0x102a6d][_0xcd39('0xbf')]));_0x13ac45['push'](_0x444882(_0xcd39('0xc2'),_0x292d11['rows'][_0x102a6d][_0xcd39('0xbf')]));_0x13ac45['push'](_0x444882(_0xcd39('0xc3'),_0x292d11[_0xcd39('0xb4')][_0x102a6d][_0xcd39('0xbf')]));}return Promise[_0xcd39('0x9c')](_0x13ac45)[_0xcd39('0x8')](function(){return _0x292d11;});}return _0x292d11;});}});}}});}; \ No newline at end of file +var _0x77e1=['then','field','resourceId','type','squareprojects','childModel','odbc','squarerecordings','SquareRecording','parentSections','name','projectName','projects','JscriptyProject','CmContact','ListId','lists','CmList','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','role','Telephones','membername','User','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','intervals','pauses','Pause','scheduler','Schedule','Sound','templates','Template','triggers','Trigger','trunks','Trunk','variables','plugins','Plugin','AnalyticExtractedReport','Reports','reportId','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','params','ignore','union','find','push','autoAssociation','rawAttributes','model','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','ids','customSorting','extraQueryConditions','count','color','tag','Tag','ThroughTags','openTabs','rows','chat','sms','fax','dataValues','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','value','findAll','associatedResources','map','catch','resolve'];(function(_0x538595,_0x400814){var _0x35a0ec=function(_0x55b59f){while(--_0x55b59f){_0x538595['push'](_0x538595['shift']());}};_0x35a0ec(++_0x400814);}(_0x77e1,0xb4));var _0x177e=function(_0x10730d,_0x426e76){_0x10730d=_0x10730d-0x0;var _0x5b59a6=_0x77e1[_0x10730d];return _0x5b59a6;};'use strict';var _=require(_0x177e('0x0'));var attributes=require(_0x177e('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x177e('0x2'));module[_0x177e('0x3')]=function(_0x13bc55){var _0x3ad1c2=_0x13bc55[_0x177e('0x4')];function _0x12c5fb(_0x4bff37,_0x3f6df3){return new Promise(function(_0x929b3b,_0x20f53d){if(!_0x3f6df3)return _0x929b3b(null);var _0x46be4f=_0x3f6df3[_0x177e('0x5')]?{[_0x3f6df3[_0x177e('0x5')]['field']]:_0x3f6df3[_0x177e('0x5')][_0x177e('0x6')]}:undefined;return _0x3ad1c2[_0x4bff37][_0x177e('0x7')]({'where':_0x46be4f,'raw':!![]})['then'](function(_0x358bb0){_0x3f6df3[_0x177e('0x8')]=_[_0x177e('0x9')](_0x358bb0,'id');_0x929b3b(_0x3f6df3);})[_0x177e('0xa')](function(_0x5628f4){_0x20f53d(_0x5628f4);});});}function _0x2a6713(_0x31aab5,_0x21034b){return new Promise(function(_0x4a4ea9,_0xca00de){var _0x54a952=_0x31aab5[_0x177e('0x5')]?{[_0x31aab5[_0x177e('0x5')]['field']]:_0x31aab5[_0x177e('0x5')][_0x177e('0x6')]}:undefined;return _0x3ad1c2[_0x31aab5['model']]['findAll']({'where':_0x54a952,'raw':!![]})['then'](function(_0x4d0eb9){_0x21034b[_0x177e('0x8')]=_[_0x177e('0x9')](_0x4d0eb9,function(_0x13cf49){return _0x13cf49['name'];});_0x4a4ea9(_0x21034b);})[_0x177e('0xa')](function(_0x986d37){_0xca00de(_0x986d37);});});}function _0x2b9c5e(_0x1179b6,_0x57c265,_0x36dffd){if(!_0x57c265)return Promise[_0x177e('0xb')](null);return new Promise(function(_0x2018ed,_0x1f669c){return _0x3ad1c2['UserProfileResource']['findAll']({'where':{'sectionId':_0x57c265['id']},'raw':!![]})[_0x177e('0xc')](function(_0x502c08){if(_0x1179b6['field']&&_0x1179b6['field']!=='id'){_0x57c265[_0x177e('0x8')]=_[_0x177e('0x9')](_0x502c08,function(_0x509fe8){return _0x509fe8[_0x1179b6[_0x177e('0xd')]];});}else{if(_0x36dffd==='AnalyticExtractedReport'){_0x57c265[_0x177e('0x8')]=_[_0x177e('0x9')](_0x502c08,function(_0x4c831c){return{'id':_0x4c831c[_0x177e('0xe')],'type':_0x4c831c[_0x177e('0xf')]};});}else{_0x57c265[_0x177e('0x8')]=_[_0x177e('0x9')](_0x502c08,function(_0x1ce132){return _0x1ce132[_0x177e('0xe')];});}}_0x2018ed(_0x57c265);})[_0x177e('0xa')](function(_0x46d2e6){_0x1f669c(_0x46d2e6);});});}function _0x52f783(_0x32704c,_0x43df82){var _0x519dad={'parentSections':[]};switch(_0x32704c['toLowerCase']()){case _0x177e('0x10'):_0x519dad[_0x177e('0x11')]='SquareProject';break;case _0x177e('0x12'):_0x519dad['childModel']='SquareOdbc';break;case _0x177e('0x13'):_0x519dad['childModel']=_0x177e('0x14');_0x519dad[_0x177e('0x15')]=[{'name':'SquareProjects','field':_0x177e('0x16'),'foreignKey':_0x177e('0x17')}];break;case _0x177e('0x18'):_0x519dad[_0x177e('0x11')]=_0x177e('0x19');break;case'contacts':_0x519dad[_0x177e('0x11')]=_0x177e('0x1a');_0x519dad[_0x177e('0x15')]=[{'name':'Lists','field':'id','foreignKey':_0x177e('0x1b')}];break;case _0x177e('0x1c'):_0x519dad[_0x177e('0x11')]=_0x177e('0x1d');break;case'companies':_0x519dad[_0x177e('0x11')]=_0x177e('0x1e');break;case _0x177e('0x1f'):_0x519dad[_0x177e('0x11')]=_0x177e('0x20');break;case _0x177e('0x21'):_0x519dad[_0x177e('0x11')]=_0x177e('0x22');break;case _0x177e('0x23'):_0x519dad[_0x177e('0x11')]=_0x177e('0x24');break;case _0x177e('0x25'):_0x519dad[_0x177e('0x11')]=_0x177e('0x26');break;case _0x177e('0x27'):_0x519dad[_0x177e('0x11')]=_0x177e('0x28');break;case _0x177e('0x29'):case _0x177e('0x2a'):case'outboundroutes':_0x519dad[_0x177e('0x11')]=_0x177e('0x2b');break;case _0x177e('0x2c'):_0x519dad['childModel']=_0x177e('0x2d');break;case _0x177e('0x2e'):_0x519dad[_0x177e('0x11')]=_0x177e('0x2f');break;case _0x177e('0x30'):_0x519dad[_0x177e('0x11')]=_0x177e('0x31');_0x519dad[_0x177e('0x15')]=[{'name':'Agents','field':'name','foreignKey':'membername','model':'User','filter':{'field':_0x177e('0x32'),'value':['agent']}},{'name':_0x177e('0x33'),'field':_0x177e('0x16'),'foreignKey':_0x177e('0x34'),'model':_0x177e('0x35'),'filter':{'field':_0x177e('0x32'),'value':[_0x177e('0x36')]}},{'name':_0x177e('0x37'),'field':_0x177e('0x16'),'foreignKey':_0x177e('0x38'),'model':'VoiceQueue','filter':{'field':_0x177e('0xf'),'value':[_0x177e('0x39')]}},{'name':_0x177e('0x3a'),'field':_0x177e('0x16'),'foreignKey':'queue','model':_0x177e('0x3b'),'filter':{'field':_0x177e('0xf'),'value':[_0x177e('0x3c')]}}];break;case _0x177e('0x3d'):_0x519dad['childModel']=_0x177e('0x3e');break;case'chanspies':_0x519dad[_0x177e('0x11')]=_0x177e('0x3f');break;case _0x177e('0x40'):_0x519dad[_0x177e('0x11')]='VoicePrefix';break;case _0x177e('0x41'):_0x519dad['childModel']=_0x177e('0x42');break;case'mailqueues':_0x519dad[_0x177e('0x11')]='MailQueue';break;case'mailaccounts':_0x519dad[_0x177e('0x11')]=_0x177e('0x43');break;case _0x177e('0x44'):_0x519dad['childModel']=_0x177e('0x45');break;case _0x177e('0x46'):_0x519dad[_0x177e('0x11')]=_0x177e('0x47');break;case _0x177e('0x48'):_0x519dad[_0x177e('0x11')]=_0x177e('0x49');break;case _0x177e('0x4a'):_0x519dad[_0x177e('0x11')]=_0x177e('0x4b');break;case _0x177e('0x4c'):_0x519dad[_0x177e('0x11')]='SmsAccount';break;case'whatsappqueues':_0x519dad[_0x177e('0x11')]=_0x177e('0x4d');break;case _0x177e('0x4e'):_0x519dad[_0x177e('0x11')]=_0x177e('0x4f');break;case'teams':_0x519dad[_0x177e('0x11')]=_0x177e('0x50');break;case _0x177e('0x51'):case'queuecampaigns':_0x519dad[_0x177e('0x11')]=_0x177e('0x3b');if(_0x43df82){_0x519dad[_0x177e('0x15')]=[{'name':_0x177e('0x37')},{'name':_0x177e('0x3a')}];}break;case _0x177e('0x52'):case _0x177e('0x53'):case _0x177e('0x54'):_0x519dad[_0x177e('0x11')]=_0x177e('0x35');if(_0x43df82){_0x519dad['parentSections']=[{'name':_0x177e('0x55'),'filter':{'field':_0x177e('0x32'),'value':[_0x177e('0x56'),_0x177e('0x57')]},'ignore':!![]},{'name':_0x177e('0x58')},{'name':_0x177e('0x33')}];}break;case _0x177e('0x59'):_0x519dad[_0x177e('0x11')]=_0x177e('0x5a');break;case _0x177e('0x5b'):_0x519dad[_0x177e('0x11')]=_0x177e('0x5c');break;case _0x177e('0x5d'):_0x519dad[_0x177e('0x11')]=_0x177e('0x5e');break;case _0x177e('0x5f'):_0x519dad[_0x177e('0x11')]=_0x177e('0x60');break;case'deskaccounts':_0x519dad[_0x177e('0x11')]=_0x177e('0x61');break;case'zohoaccounts':_0x519dad[_0x177e('0x11')]=_0x177e('0x62');break;case _0x177e('0x63'):_0x519dad[_0x177e('0x11')]=_0x177e('0x35');break;case _0x177e('0x64'):_0x519dad[_0x177e('0x11')]=_0x177e('0x65');break;case _0x177e('0x66'):_0x519dad[_0x177e('0x11')]='Disposition';break;case _0x177e('0x67'):_0x519dad['childModel']='Dashboard';break;case _0x177e('0x68'):_0x519dad[_0x177e('0x11')]='Interval';break;case _0x177e('0x69'):_0x519dad[_0x177e('0x11')]=_0x177e('0x6a');break;case _0x177e('0x6b'):_0x519dad['childModel']=_0x177e('0x6c');break;case'sounds':_0x519dad[_0x177e('0x11')]=_0x177e('0x6d');break;case'tags':_0x519dad[_0x177e('0x11')]='Tag';break;case _0x177e('0x6e'):_0x519dad['childModel']=_0x177e('0x6f');break;case _0x177e('0x70'):_0x519dad[_0x177e('0x11')]=_0x177e('0x71');break;case _0x177e('0x72'):_0x519dad[_0x177e('0x11')]=_0x177e('0x73');break;case _0x177e('0x74'):_0x519dad['childModel']='Variable';break;case _0x177e('0x75'):_0x519dad['childModel']=_0x177e('0x76');break;case'extractedreports':_0x519dad['childModel']=_0x177e('0x77');_0x519dad[_0x177e('0x15')]=[{'name':_0x177e('0x78'),'field':'id','foreignKey':_0x177e('0x79')}];break;case'metrics':_0x519dad[_0x177e('0x11')]='AnalyticMetric';break;}return _0x519dad;}function _0x577b51(_0x4ef116,_0x2507d){var _0x21cfd1=_0x4ef116[_0x177e('0x7a')](0x0)[_0x177e('0x7b')]()+_0x4ef116[_0x177e('0x7c')](0x1);var _0x1f98a2={'type':_0x3ad1c2[_0x177e('0x7d')]['QueryTypes'][_0x177e('0x7e')],'raw':!![]};return new Promise(function(_0x590db5,_0xfcc671){var _0x42fc20=squel[_0x177e('0x7f')]()[_0x177e('0xd')](_0x177e('0x80')+_0x21cfd1+_0x177e('0x81'),'id')['field'](_0x177e('0x82'))['from'](_0x177e('0x83')+_0x4ef116+'_interactions','ui')[_0x177e('0x84')](_0x177e('0x85'),_0x2507d['id']);return _0x3ad1c2[_0x177e('0x86')][_0x177e('0x87')](_0x42fc20[_0x177e('0x88')](),_0x1f98a2)[_0x177e('0xc')](function(_0x3528e2){_0x2507d[_0x21cfd1+_0x177e('0x89')]=_0x3528e2;_0x590db5(_0x3528e2);})['catch'](function(_0x2875bd){_0xfcc671(_0x2875bd);});});}return _0x13bc55[_0x177e('0x8a')](_0x177e('0x8b'),attributes,{'tableName':_0x177e('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1bdafe){var _0x2f5dbd={'raw':_0x1bdafe[_0x177e('0x87')][_0x177e('0x8d')],'where':{}};var _0x40aeac={};var _0x4aeeb5={'count':0x0,'rows':[]};var _0xe0df3=_0x1bdafe[_0x177e('0x87')][_0x177e('0x8e')];var _0x2cb52c=_0x1bdafe[_0x177e('0x87')]['mergeResources']||![];var _0x32e2f1=_0x52f783(_0xe0df3,_0x2cb52c);if(!_0x32e2f1['childModel'])throw new Error(_0x177e('0x8f')+_0xe0df3+'\x27');var _0x1f76e7=[{'name':_0xe0df3}];if(!_[_0x177e('0x90')](_0x32e2f1[_0x177e('0x15')]))_0x1f76e7=_0x32e2f1[_0x177e('0x15')];var _0x50e619=[];for(var _0x56554d=0x0;_0x56554d<_0x1f76e7[_0x177e('0x91')];_0x56554d++){_0x50e619['push'](_0x3ad1c2['UserProfileSection']['find']({'where':{'userProfileId':_0x1bdafe[_0x177e('0x92')]['id'],'name':_0x1f76e7[_0x56554d]['name']},'raw':!![]}));}return Promise['all'](_0x50e619)[_0x177e('0xc')](function(_0x48eaa1){var _0x8f2d11=_[_0x177e('0x5')](_0x48eaa1,function(_0x12ebc6){return _0x12ebc6?_0x12ebc6:undefined;});var _0x16a5be=_[_0x177e('0x5')](_0x1f76e7,[_0x177e('0x93'),!![]]);var _0x185921=_[_0x177e('0x90')](_0x8f2d11)&&_['isEmpty'](_0x16a5be)?null:_[_0x177e('0x94')](_0x16a5be,_0x8f2d11);if(!_0x185921)return null;var _0x37c25b=[];for(var _0x45c8c9=0x0;_0x45c8c9<_0x185921['length'];_0x45c8c9++){var _0x2777c3=_[_0x177e('0x95')](_0x1f76e7,function(_0x3dc4af){return _0x185921[_0x45c8c9]?_0x3dc4af[_0x177e('0x16')]===_0x185921[_0x45c8c9][_0x177e('0x16')]:null;});if(_0x2777c3){if(_0x185921[_0x45c8c9][_0x177e('0x93')]){_0x37c25b[_0x177e('0x96')](_0x12c5fb(_0x32e2f1[_0x177e('0x11')],_0x185921[_0x45c8c9]));}else{if(!_0x185921[_0x45c8c9][_0x177e('0x97')]){_0x37c25b[_0x177e('0x96')](_0x2b9c5e(_0x2777c3,_0x185921[_0x45c8c9],_0x32e2f1[_0x177e('0x11')]));}else{if(_0x2777c3['model']){_0x37c25b['push'](_0x2a6713(_0x2777c3,_0x185921[_0x45c8c9]));}}}}}return Promise['all'](_0x37c25b);})[_0x177e('0xc')](function(_0x2c0fac){var _0x314eda=_0x2c0fac;var _0x3cc7cf=null;if(_0x314eda){_0x3cc7cf=_0x314eda[_0x177e('0x91')]===0x1?_0x314eda[0x0]:null;}if(!_0x3cc7cf&&!_0x314eda)return _0x4aeeb5;var _0x2e3528=_0x3ad1c2[_0x32e2f1[_0x177e('0x11')]][_0x177e('0x98')];_0x40aeac[_0x177e('0x99')]=_['keys'](_0x2e3528);_0x40aeac[_0x177e('0x87')]=_[_0x177e('0x9a')](_0x1bdafe[_0x177e('0x87')]);_0x40aeac[_0x177e('0x9b')]=_[_0x177e('0x9c')](_0x40aeac[_0x177e('0x99')],_0x40aeac[_0x177e('0x87')]);_0x2f5dbd['attributes']=_[_0x177e('0x9c')](_0x40aeac[_0x177e('0x99')],qs['fields'](_0x1bdafe[_0x177e('0x87')][_0x177e('0x9d')]));_0x2f5dbd['attributes']=_0x2f5dbd[_0x177e('0x9e')][_0x177e('0x91')]?_0x2f5dbd['attributes']:_0x40aeac[_0x177e('0x99')];if(!_0x1bdafe[_0x177e('0x87')][_0x177e('0x9f')](_0x177e('0xa0'))){_0x2f5dbd[_0x177e('0xa1')]=qs[_0x177e('0xa1')](_0x1bdafe[_0x177e('0x87')][_0x177e('0xa1')]);_0x2f5dbd['offset']=qs[_0x177e('0xa2')](_0x1bdafe[_0x177e('0x87')]['offset']);}_0x2f5dbd[_0x177e('0xa3')]=qs[_0x177e('0xa4')](_0x1bdafe[_0x177e('0x87')][_0x177e('0xa4')]);_0x2f5dbd['where']=qs['filters'](_['pick'](_0x1bdafe[_0x177e('0x87')],_0x40aeac[_0x177e('0x9b')]));if(_0x1bdafe[_0x177e('0x87')][_0x177e('0x5')]){_0x2f5dbd[_0x177e('0x84')]=_[_0x177e('0xa5')](_0x2f5dbd[_0x177e('0x84')],{'$or':_['map'](_0x2e3528,function(_0x443bba){if(_0x443bba[_0x177e('0xf')][_0x177e('0xa6')]!==_0x177e('0xa7')){var _0x23aa72={};_0x23aa72[_0x443bba['field']]={'$like':'%'+_0x1bdafe[_0x177e('0x87')][_0x177e('0x5')]+'%'};return _0x23aa72;}})});}var _0xe23c42=[];var _0x278024=null;var _0xbe0fbc={};if(_0x3cc7cf){_0x278024=_[_0x177e('0x95')](_0x1f76e7,[_0x177e('0x16'),_0x3cc7cf[_0x177e('0x16')]]);if(_0x278024[_0x177e('0xd')]){_0xbe0fbc={};if(_0x32e2f1[_0x177e('0x11')]===_0x177e('0x77')){_0xbe0fbc[_0x278024[_0x177e('0xa8')]]=_[_0x177e('0x9')](_0x3cc7cf[_0x177e('0x8')],'id');}else{_0xbe0fbc[_0x278024[_0x177e('0xa8')]]=_0x3cc7cf['associatedResources'];}_0xe23c42['push'](_0xbe0fbc);}else{_0x2f5dbd[_0x177e('0x84')]['id']=_0x3cc7cf[_0x177e('0x8')];}}else{for(var _0x323e31=0x0;_0x323e31<_0x314eda['length'];_0x323e31++){_0x278024=_[_0x177e('0x95')](_0x1f76e7,[_0x177e('0x16'),_0x314eda[_0x323e31][_0x177e('0x16')]]);if(_0x278024[_0x177e('0xd')]){_0xbe0fbc={};_0xbe0fbc[_0x278024['foreignKey']]=_0x314eda[_0x323e31]['associatedResources'];_0xe23c42['push'](_0xbe0fbc);}else{if(!_0x2f5dbd[_0x177e('0x84')]['id'])_0x2f5dbd['where']['id']=[];_0x314eda[_0x323e31][_0x177e('0x8')][_0x177e('0xa9')](function(_0x1dabbe){_0x2f5dbd[_0x177e('0x84')]['id'][_0x177e('0x96')](_0x1dabbe);});}}}if(!_[_0x177e('0x90')](_0xe23c42)){_0x2f5dbd[_0x177e('0x84')]=_[_0x177e('0xa5')](_0x2f5dbd[_0x177e('0x84')],{'$and':{'$or':_0xe23c42}});}_0x2f5dbd=_['merge']({},_0x2f5dbd,_0x1bdafe['options']);if(_0x3cc7cf&&!_0x3cc7cf[_0x177e('0x97')]&&_0x32e2f1[_0x177e('0x11')]===_0x177e('0x77')){if(_0x1bdafe[_0x177e('0x87')][_0x177e('0xaa')]){_0x2f5dbd[_0x177e('0xab')]=[{'all':!![]}];}return _0x3ad1c2[_0x32e2f1[_0x177e('0x11')]]['findAll'](_0x2f5dbd)[_0x177e('0xc')](function(_0x2811de){var _0x1bb3a9=[];_0x2811de[_0x177e('0xa9')](function(_0x2bc1bc){var _0x12cab4;switch(_0x2bc1bc[_0x177e('0xac')]){case _0x177e('0xad'):_0x12cab4=_[_0x177e('0x95')](_0x3cc7cf[_0x177e('0x8')],function(_0x4da013){return _0x4da013['id']===_0x2bc1bc[_0x177e('0x79')]&&_0x4da013[_0x177e('0xf')]===_0x177e('0xae');});break;case _0x177e('0xaf'):_0x12cab4=_[_0x177e('0x95')](_0x3cc7cf[_0x177e('0x8')],function(_0x5adf1e){return _0x5adf1e['id']===_0x2bc1bc[_0x177e('0x79')]&&_0x5adf1e[_0x177e('0xf')]===_0x177e('0xb0');});break;}if(_0x12cab4)_0x1bb3a9['push'](_0x2bc1bc);});_0x4aeeb5['count']=_0x1bb3a9[_0x177e('0x91')];_0x4aeeb5['rows']=_0x1bb3a9;return _0x4aeeb5;});}else{if(!_[_0x177e('0x90')](_0x1bdafe['query'][_0x177e('0xb1')])){_0x2f5dbd['where']['id']=_0x2f5dbd[_0x177e('0x84')]['id']?_[_0x177e('0x9c')](_0x2f5dbd[_0x177e('0x84')]['id'],_0x1bdafe[_0x177e('0x87')][_0x177e('0xb1')]):_0x1bdafe['query'][_0x177e('0xb1')];if(_0x1bdafe[_0x177e('0x87')]['customSorting']){_0x2f5dbd[_0x177e('0xa3')]=_0x1bdafe['query'][_0x177e('0xb2')];}}if(_0x1bdafe['query'][_0x177e('0xb3')]){_0x2f5dbd[_0x177e('0x84')]=_['merge'](_0x2f5dbd['where'],{'$and':_0x1bdafe[_0x177e('0x87')]['extraQueryConditions']});}return _0x3ad1c2[_0x32e2f1['childModel']][_0x177e('0xb4')]({'where':_0x2f5dbd[_0x177e('0x84')]})[_0x177e('0xc')](function(_0x1fb02a){_0x4aeeb5['count']=_0x1fb02a;if(_0x1bdafe[_0x177e('0x87')]['includeAll']){if(_0x32e2f1[_0x177e('0x11')]==='CmContact'){_0x2f5dbd[_0x177e('0xab')]=[{'model':_0x3ad1c2['Tag'],'as':'Tags','attributes':['id','name',_0x177e('0xb5')],'required':_0x1bdafe[_0x177e('0x87')][_0x177e('0xb6')]?!![]:![]},{'model':_0x3ad1c2[_0x177e('0xb7')],'as':_0x177e('0xb8'),'attributes':['id','name',_0x177e('0xb5')],'through':_0x1bdafe[_0x177e('0x87')][_0x177e('0xb6')]?{'attributes':[],'where':{'TagId':_0x1bdafe[_0x177e('0x87')][_0x177e('0xb6')]||undefined}}:{},'required':_0x1bdafe[_0x177e('0x87')][_0x177e('0xb6')]?!![]:![]}];}else{_0x2f5dbd['include']=[{'all':!![]}];}}return _0x3ad1c2[_0x32e2f1['childModel']][_0x177e('0x7')](_0x2f5dbd);})[_0x177e('0xc')](function(_0x2b5a2e){_0x4aeeb5['rows']=_0x2b5a2e;if(_0xe0df3===_0x177e('0x58')&&_0x1bdafe['query'][_0x177e('0xb9')]==='true'){var _0x454152=[];for(var _0x47f02b=0x0;_0x47f02b<_0x4aeeb5[_0x177e('0xba')]['length'];_0x47f02b++){_0x454152[_0x177e('0x96')](_0x577b51(_0x177e('0xbb'),_0x4aeeb5[_0x177e('0xba')][_0x47f02b]['dataValues']));_0x454152[_0x177e('0x96')](_0x577b51(_0x177e('0xbc'),_0x4aeeb5['rows'][_0x47f02b]['dataValues']));_0x454152[_0x177e('0x96')](_0x577b51(_0x177e('0xbd'),_0x4aeeb5[_0x177e('0xba')][_0x47f02b][_0x177e('0xbe')]));_0x454152[_0x177e('0x96')](_0x577b51('mail',_0x4aeeb5[_0x177e('0xba')][_0x47f02b][_0x177e('0xbe')]));_0x454152[_0x177e('0x96')](_0x577b51('openchannel',_0x4aeeb5[_0x177e('0xba')][_0x47f02b][_0x177e('0xbe')]));_0x454152[_0x177e('0x96')](_0x577b51(_0x177e('0xbf'),_0x4aeeb5[_0x177e('0xba')][_0x47f02b][_0x177e('0xbe')]));}return Promise['all'](_0x454152)[_0x177e('0xc')](function(){return _0x4aeeb5;});}return _0x4aeeb5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ce9d49d..4361376 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 _0x905a=['catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0x905a,0xeb));var _0xa905=function(_0x169923,_0x4603df){_0x169923=_0x169923-0x0;var _0x38db05=_0x905a[_0x169923];return _0x38db05;};'use strict';var _=require(_0xa905('0x0'));var util=require('util');var moment=require(_0xa905('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa905('0x2'));var db=require(_0xa905('0x3'))['db'];var utils=require(_0xa905('0x4'));var logger=require(_0xa905('0x5'))(_0xa905('0x6'));var config=require(_0xa905('0x7'));var jayson=require(_0xa905('0x8'));var client=jayson[_0xa905('0x9')][_0xa905('0xa')]({'port':0x232a});config[_0xa905('0xb')]=_[_0xa905('0xc')](config[_0xa905('0xb')],{'host':_0xa905('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa905('0xb')]));require('./userProfile.socket')[_0xa905('0xe')](socket);function respondWithRpcPromise(_0x50004a,_0x4b5009,_0x34922c){return new BPromise(function(_0x118ff4,_0x58e8b4){return client[_0xa905('0xf')](_0x50004a,_0x34922c)['then'](function(_0x4e4ffa){logger[_0xa905('0x10')](_0xa905('0x11'),_0x4b5009,'request\x20sent');logger['debug'](_0xa905('0x12'),_0x4b5009,_0xa905('0x13'),JSON[_0xa905('0x14')](_0x4e4ffa));if(_0x4e4ffa[_0xa905('0x15')]){if(_0x4e4ffa[_0xa905('0x15')][_0xa905('0x16')]===0x1f4){logger['error'](_0xa905('0x11'),_0x4b5009,_0x4e4ffa['error'][_0xa905('0x17')]);return _0x58e8b4(_0x4e4ffa[_0xa905('0x15')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x4b5009,_0x4e4ffa[_0xa905('0x15')][_0xa905('0x17')]);return _0x118ff4(_0x4e4ffa[_0xa905('0x15')][_0xa905('0x17')]);}else{logger[_0xa905('0x10')](_0xa905('0x11'),_0x4b5009,_0xa905('0x13'));_0x118ff4(_0x4e4ffa[_0xa905('0x18')][_0xa905('0x17')]);}})[_0xa905('0x19')](function(_0x3afe0c){logger[_0xa905('0x15')]('UserProfile,\x20%s,\x20%s',_0x4b5009,_0x3afe0c);_0x58e8b4(_0x3afe0c);});});} \ No newline at end of file +var _0x74af=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash'];(function(_0x4b213f,_0x4ed769){var _0x2fe02e=function(_0x23097e){while(--_0x23097e){_0x4b213f['push'](_0x4b213f['shift']());}};_0x2fe02e(++_0x4ed769);}(_0x74af,0x178));var _0xf74a=function(_0x544ba2,_0x4de1f2){_0x544ba2=_0x544ba2-0x0;var _0x261b89=_0x74af[_0x544ba2];return _0x261b89;};'use strict';var _=require(_0xf74a('0x0'));var util=require(_0xf74a('0x1'));var moment=require(_0xf74a('0x2'));var BPromise=require(_0xf74a('0x3'));var rs=require(_0xf74a('0x4'));var fs=require('fs');var Redis=require(_0xf74a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf74a('0x6'));var logger=require(_0xf74a('0x7'))(_0xf74a('0x8'));var config=require(_0xf74a('0x9'));var jayson=require(_0xf74a('0xa'));var client=jayson[_0xf74a('0xb')][_0xf74a('0xc')]({'port':0x232a});config['redis']=_[_0xf74a('0xd')](config[_0xf74a('0xe')],{'host':_0xf74a('0xf'),'port':0x18eb});var socket=require(_0xf74a('0x10'))(new Redis(config[_0xf74a('0xe')]));require(_0xf74a('0x11'))[_0xf74a('0x12')](socket);function respondWithRpcPromise(_0x78bbd9,_0x206db9,_0x15c591){return new BPromise(function(_0xd6896f,_0xd79080){return client[_0xf74a('0x13')](_0x78bbd9,_0x15c591)[_0xf74a('0x14')](function(_0x15f94b){logger['info'](_0xf74a('0x15'),_0x206db9,'request\x20sent');logger[_0xf74a('0x16')](_0xf74a('0x17'),_0x206db9,_0xf74a('0x18'),JSON[_0xf74a('0x19')](_0x15f94b));if(_0x15f94b[_0xf74a('0x1a')]){if(_0x15f94b[_0xf74a('0x1a')]['code']===0x1f4){logger[_0xf74a('0x1a')]('UserProfile,\x20%s,\x20%s',_0x206db9,_0x15f94b[_0xf74a('0x1a')][_0xf74a('0x1b')]);return _0xd79080(_0x15f94b['error'][_0xf74a('0x1b')]);}logger[_0xf74a('0x1a')](_0xf74a('0x15'),_0x206db9,_0x15f94b[_0xf74a('0x1a')]['message']);return _0xd6896f(_0x15f94b[_0xf74a('0x1a')]['message']);}else{logger['info'](_0xf74a('0x15'),_0x206db9,_0xf74a('0x18'));_0xd6896f(_0x15f94b[_0xf74a('0x1c')]['message']);}})['catch'](function(_0x56f11a){logger[_0xf74a('0x1a')](_0xf74a('0x15'),_0x206db9,_0x56f11a);_0xd79080(_0x56f11a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index ed66dcf..d269485 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 _0x7408=['update','emit','removeListener','register','./userProfile.events','save','remove'];(function(_0x319570,_0x3177b4){var _0x30eced=function(_0xb95dae){while(--_0xb95dae){_0x319570['push'](_0x319570['shift']());}};_0x30eced(++_0x3177b4);}(_0x7408,0xdd));var _0x8740=function(_0xbb14db,_0x3ee8c6){_0xbb14db=_0xbb14db-0x0;var _0x36bed7=_0x7408[_0xbb14db];return _0x36bed7;};'use strict';var UserProfileEvents=require(_0x8740('0x0'));var events=[_0x8740('0x1'),_0x8740('0x2'),_0x8740('0x3')];function createListener(_0x3cd636,_0x48b0a5){return function(_0x4d19cb){_0x48b0a5[_0x8740('0x4')](_0x3cd636,_0x4d19cb);};}function removeListener(_0x47e7be,_0xf01f1b){return function(){UserProfileEvents[_0x8740('0x5')](_0x47e7be,_0xf01f1b);};}exports[_0x8740('0x6')]=function(_0x4eae5a){for(var _0x37c45e=0x0,_0x3df390=events['length'];_0x37c45e<_0x3df390;_0x37c45e++){var _0x3a6c78=events[_0x37c45e];var _0x307bb6=createListener('userProfile:'+_0x3a6c78,_0x4eae5a);UserProfileEvents['on'](_0x3a6c78,_0x307bb6);}}; \ No newline at end of file +var _0xc9de=['userProfile:','./userProfile.events','remove','removeListener','register','length'];(function(_0x45b3bf,_0x32e68f){var _0x11ef6b=function(_0x208561){while(--_0x208561){_0x45b3bf['push'](_0x45b3bf['shift']());}};_0x11ef6b(++_0x32e68f);}(_0xc9de,0xa9));var _0xec9d=function(_0xc1105b,_0x2e1218){_0xc1105b=_0xc1105b-0x0;var _0x5234bf=_0xc9de[_0xc1105b];return _0x5234bf;};'use strict';var UserProfileEvents=require(_0xec9d('0x0'));var events=['save',_0xec9d('0x1'),'update'];function createListener(_0x2ddf3f,_0x54517a){return function(_0x1aeba1){_0x54517a['emit'](_0x2ddf3f,_0x1aeba1);};}function removeListener(_0x17d0de,_0x2dd930){return function(){UserProfileEvents[_0xec9d('0x2')](_0x17d0de,_0x2dd930);};}exports[_0xec9d('0x3')]=function(_0x416b0d){for(var _0x10f101=0x0,_0x1972c2=events[_0xec9d('0x4')];_0x10f101<_0x1972c2;_0x10f101++){var _0x398d40=events[_0x10f101];var _0x59be0e=createListener(_0xec9d('0x5')+_0x398d40,_0x416b0d);UserProfileEvents['on'](_0x398d40,_0x59be0e);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 06aad90..9d7795a 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 _0xda01=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','create','update','delete','exports','multer'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0xda01,0x155));var _0x1da0=function(_0x2d8463,_0x59cee9){_0x2d8463=_0x2d8463-0x0;var _0x209046=_0xda01[_0x2d8463];return _0x209046;};'use strict';var multer=require(_0x1da0('0x0'));var util=require(_0x1da0('0x1'));var path=require(_0x1da0('0x2'));var timeout=require(_0x1da0('0x3'));var express=require('express');var router=express[_0x1da0('0x4')]();var fs_extra=require(_0x1da0('0x5'));var auth=require(_0x1da0('0x6'));var interaction=require(_0x1da0('0x7'));var config=require(_0x1da0('0x8'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0x1da0('0x9')](),controller[_0x1da0('0xa')]);router[_0x1da0('0xb')]('/describe',auth[_0x1da0('0x9')](),controller[_0x1da0('0xc')]);router[_0x1da0('0xb')](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller[_0x1da0('0xe')]);router['post']('/',auth[_0x1da0('0x9')](),controller[_0x1da0('0xf')]);router['put'](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller[_0x1da0('0x10')]);router[_0x1da0('0x11')](_0x1da0('0xd'),auth[_0x1da0('0x9')](),controller['destroy']);module[_0x1da0('0x12')]=router; \ No newline at end of file +var _0x8bc0=['isAuthenticated','describe','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe'];(function(_0x5dd723,_0x2dda0){var _0x273e6c=function(_0x16077a){while(--_0x16077a){_0x5dd723['push'](_0x5dd723['shift']());}};_0x273e6c(++_0x2dda0);}(_0x8bc0,0xa8));var _0x08bc=function(_0x2611e5,_0x41a4ee){_0x2611e5=_0x2611e5-0x0;var _0x374757=_0x8bc0[_0x2611e5];return _0x374757;};'use strict';var multer=require(_0x08bc('0x0'));var util=require(_0x08bc('0x1'));var path=require(_0x08bc('0x2'));var timeout=require(_0x08bc('0x3'));var express=require('express');var router=express[_0x08bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x08bc('0x5'));var interaction=require(_0x08bc('0x6'));var config=require(_0x08bc('0x7'));var controller=require(_0x08bc('0x8'));router[_0x08bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x08bc('0xa')]);router[_0x08bc('0x9')](_0x08bc('0xb'),auth[_0x08bc('0xc')](),controller[_0x08bc('0xd')]);router[_0x08bc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x08bc('0xe')]('/',auth['isAuthenticated'](),controller[_0x08bc('0xf')]);router[_0x08bc('0x10')](_0x08bc('0x11'),auth[_0x08bc('0xc')](),controller[_0x08bc('0x12')]);router['delete'](_0x08bc('0x11'),auth['isAuthenticated'](),controller[_0x08bc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 83a068e..0612778 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 _0xbcd7=['sequelize','STRING','INTEGER'];(function(_0x29a601,_0x3cc65f){var _0xab60fd=function(_0x548977){while(--_0x548977){_0x29a601['push'](_0x29a601['shift']());}};_0xab60fd(++_0x3cc65f);}(_0xbcd7,0x1b0));var _0x7bcd=function(_0x31d76d,_0x793459){_0x31d76d=_0x31d76d-0x0;var _0x3c0ddc=_0xbcd7[_0x31d76d];return _0x3c0ddc;};'use strict';var Sequelize=require(_0x7bcd('0x0'));module['exports']={'name':{'type':Sequelize[_0x7bcd('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7bcd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7bcd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0feb=['sequelize','STRING','INTEGER'];(function(_0x4e3264,_0x46d4c1){var _0x1084c1=function(_0x3a110f){while(--_0x3a110f){_0x4e3264['push'](_0x4e3264['shift']());}};_0x1084c1(++_0x46d4c1);}(_0x0feb,0x171));var _0xb0fe=function(_0x338036,_0x11a222){_0x338036=_0x338036-0x0;var _0x44ed8c=_0x0feb[_0x338036];return _0x44ed8c;};'use strict';var Sequelize=require(_0xb0fe('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0fe('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb0fe('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb0fe('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index a9ef749..59c17d2 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x781d=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','UserProfileResource','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x781d,0x14a));var _0xd781=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x781d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));};exports[_0xd781('0x46')]=function(_0x17a46e,_0x4f9e37){return db[_0xd781('0x2c')]['describe']()['then'](respondWithResult(_0x4f9e37,null))['catch'](handleError(_0x4f9e37,null));}; \ No newline at end of file +var _0xd117=['filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','UserProfileResource','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x9ed7fd,_0x463820){var _0x389c02=function(_0x24c29f){while(--_0x24c29f){_0x9ed7fd['push'](_0x9ed7fd['shift']());}};_0x389c02(++_0x463820);}(_0xd117,0x182));var _0x7d11=function(_0x52a6e3,_0x4a73b4){_0x52a6e3=_0x52a6e3-0x0;var _0x8910d0=_0xd117[_0x52a6e3];return _0x8910d0;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['create'](_0x161213['body'],{})['then'](respondWithResult(_0x193631,0xc9))[_0x7d11('0x40')](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x20297a,_0x18ae0e){if(_0x20297a[_0x7d11('0x48')]['id']){delete _0x20297a[_0x7d11('0x48')]['id'];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'id':_0x20297a[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x18ae0e,null))[_0x7d11('0x22')](saveUpdates(_0x20297a[_0x7d11('0x48')],null))['then'](respondWithResult(_0x18ae0e,null))[_0x7d11('0x40')](handleError(_0x18ae0e,null));};exports[_0x7d11('0x23')]=function(_0x29207f,_0x553a03){return db['UserProfileResource'][_0x7d11('0x45')]({'where':{'id':_0x29207f[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x553a03,null))['then'](removeEntity(_0x553a03,null))['catch'](handleError(_0x553a03,null));};exports[_0x7d11('0x49')]=function(_0x36af2b,_0x5e6234){return db[_0x7d11('0x28')][_0x7d11('0x49')]()[_0x7d11('0x22')](respondWithResult(_0x5e6234,null))[_0x7d11('0x40')](handleError(_0x5e6234,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0778d44..6e5713a 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 _0x898e=['rimraf','../../config/environment','define','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x898e,0x1b9));var _0xe898=function(_0x4cd20a,_0x4ef84d){_0x4cd20a=_0x4cd20a-0x0;var _0x4747a2=_0x898e[_0x4cd20a];return _0x4747a2;};'use strict';var _=require(_0xe898('0x0'));var util=require(_0xe898('0x1'));var logger=require(_0xe898('0x2'))(_0xe898('0x3'));var moment=require('moment');var BPromise=require(_0xe898('0x4'));var rp=require(_0xe898('0x5'));var fs=require('fs');var path=require(_0xe898('0x6'));var rimraf=require(_0xe898('0x7'));var config=require(_0xe898('0x8'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x50ffe5,_0x51798f){return _0x50ffe5[_0xe898('0x9')](_0xe898('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe898('0xb'),'fields':[_0xe898('0xc'),_0xe898('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b73=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','compositeIndex','resourceId','sectionId'];(function(_0x265d13,_0x5e3252){var _0x20260c=function(_0x479c53){while(--_0x479c53){_0x265d13['push'](_0x265d13['shift']());}};_0x20260c(++_0x5e3252);}(_0x9b73,0xea));var _0x39b7=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x9b73[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x39b7('0x0'))(_0x39b7('0x1'));var moment=require(_0x39b7('0x2'));var BPromise=require(_0x39b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x39b7('0x4'));var rimraf=require(_0x39b7('0x5'));var config=require(_0x39b7('0x6'));var attributes=require(_0x39b7('0x7'));module['exports']=function(_0x4057aa,_0x2092fe){return _0x4057aa[_0x39b7('0x8')](_0x39b7('0x9'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x39b7('0xa'),'fields':[_0x39b7('0xb'),_0x39b7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8e62527..65b771d 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 _0xd201=['stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0xdec71a,_0x23bab3){var _0x55c2c9=function(_0x3dff68){while(--_0x3dff68){_0xdec71a['push'](_0xdec71a['shift']());}};_0x55c2c9(++_0x23bab3);}(_0xd201,0x113));var _0x1d20=function(_0x1d5ccb,_0x136776){_0x1d5ccb=_0x1d5ccb-0x0;var _0x49fc07=_0xd201[_0x1d5ccb];return _0x49fc07;};'use strict';var _=require(_0x1d20('0x0'));var util=require(_0x1d20('0x1'));var moment=require(_0x1d20('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d20('0x3'));var db=require(_0x1d20('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d20('0x5'))(_0x1d20('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d20('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3d59,_0x38cad1,_0x1f5e1d){return new BPromise(function(_0x1d89b0,_0x3b4a7a){return client[_0x1d20('0x8')](_0x5b3d59,_0x1f5e1d)[_0x1d20('0x9')](function(_0x561f4e){logger[_0x1d20('0xa')](_0x1d20('0xb'),_0x38cad1,_0x1d20('0xc'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x38cad1,_0x1d20('0xc'),JSON[_0x1d20('0xd')](_0x561f4e));if(_0x561f4e[_0x1d20('0xe')]){if(_0x561f4e[_0x1d20('0xe')][_0x1d20('0xf')]===0x1f4){logger[_0x1d20('0xe')](_0x1d20('0xb'),_0x38cad1,_0x561f4e[_0x1d20('0xe')][_0x1d20('0x10')]);return _0x3b4a7a(_0x561f4e[_0x1d20('0xe')][_0x1d20('0x10')]);}logger['error'](_0x1d20('0xb'),_0x38cad1,_0x561f4e['error'][_0x1d20('0x10')]);return _0x1d89b0(_0x561f4e[_0x1d20('0xe')][_0x1d20('0x10')]);}else{logger[_0x1d20('0xa')](_0x1d20('0xb'),_0x38cad1,_0x1d20('0xc'));_0x1d89b0(_0x561f4e['result'][_0x1d20('0x10')]);}})[_0x1d20('0x11')](function(_0x1ace72){logger[_0x1d20('0xe')](_0x1d20('0xb'),_0x38cad1,_0x1ace72);_0x3b4a7a(_0x1ace72);});});} \ No newline at end of file +var _0x03a0=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4f3db7,_0x4afa7d){var _0x5cea20=function(_0x213df1){while(--_0x213df1){_0x4f3db7['push'](_0x4f3db7['shift']());}};_0x5cea20(++_0x4afa7d);}(_0x03a0,0x186));var _0x003a=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x03a0[_0x40dd56];return _0x4f850f;};'use strict';var _=require(_0x003a('0x0'));var util=require('util');var moment=require(_0x003a('0x1'));var BPromise=require('bluebird');var rs=require(_0x003a('0x2'));var fs=require('fs');var Redis=require(_0x003a('0x3'));var db=require(_0x003a('0x4'))['db'];var utils=require(_0x003a('0x5'));var logger=require(_0x003a('0x6'))(_0x003a('0x7'));var config=require(_0x003a('0x8'));var jayson=require(_0x003a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1517ab,_0x3bc503,_0x1080bd){return new BPromise(function(_0x5b9f33,_0x20674b){return client[_0x003a('0xa')](_0x1517ab,_0x1080bd)['then'](function(_0x231972){logger[_0x003a('0xb')](_0x003a('0xc'),_0x3bc503,_0x003a('0xd'));logger[_0x003a('0xe')](_0x003a('0xf'),_0x3bc503,_0x003a('0xd'),JSON[_0x003a('0x10')](_0x231972));if(_0x231972[_0x003a('0x11')]){if(_0x231972['error'][_0x003a('0x12')]===0x1f4){logger[_0x003a('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x3bc503,_0x231972[_0x003a('0x11')][_0x003a('0x13')]);return _0x20674b(_0x231972[_0x003a('0x11')][_0x003a('0x13')]);}logger[_0x003a('0x11')](_0x003a('0xc'),_0x3bc503,_0x231972[_0x003a('0x11')][_0x003a('0x13')]);return _0x5b9f33(_0x231972[_0x003a('0x11')][_0x003a('0x13')]);}else{logger[_0x003a('0xb')](_0x003a('0xc'),_0x3bc503,_0x003a('0xd'));_0x5b9f33(_0x231972[_0x003a('0x14')][_0x003a('0x13')]);}})[_0x003a('0x15')](function(_0x5ea29f){logger[_0x003a('0x11')](_0x003a('0xc'),_0x3bc503,_0x5ea29f);_0x20674b(_0x5ea29f);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index a6ebb80..eb5c92d 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 _0x0053=['./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x235fb4,_0x434ded){var _0x6441e8=function(_0x1865f7){while(--_0x1865f7){_0x235fb4['push'](_0x235fb4['shift']());}};_0x6441e8(++_0x434ded);}(_0x0053,0x1c6));var _0x3005=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0053[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3005('0x0'));var util=require(_0x3005('0x1'));var path=require(_0x3005('0x2'));var timeout=require(_0x3005('0x3'));var express=require('express');var router=express[_0x3005('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3005('0x5'));var interaction=require(_0x3005('0x6'));var config=require(_0x3005('0x7'));var controller=require(_0x3005('0x8'));router[_0x3005('0x9')]('/',auth[_0x3005('0xa')](),controller[_0x3005('0xb')]);router[_0x3005('0x9')](_0x3005('0xc'),auth[_0x3005('0xa')](),controller[_0x3005('0xd')]);router['get'](_0x3005('0xe'),auth[_0x3005('0xa')](),controller[_0x3005('0xf')]);router[_0x3005('0x10')]('/',auth[_0x3005('0xa')](),controller[_0x3005('0x11')]);router[_0x3005('0x12')](_0x3005('0xe'),auth['isAuthenticated'](),controller[_0x3005('0x13')]);router[_0x3005('0x14')](_0x3005('0xe'),auth[_0x3005('0xa')](),controller[_0x3005('0x15')]);module['exports']=router; \ No newline at end of file +var _0xeb73=['./userProfileSection.controller','get','index','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57198c,_0x4ff4b3){var _0x41bff7=function(_0x34f019){while(--_0x34f019){_0x57198c['push'](_0x57198c['shift']());}};_0x41bff7(++_0x4ff4b3);}(_0xeb73,0x84));var _0x3eb7=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0xeb73[_0xd93b26];return _0x25f668;};'use strict';var multer=require(_0x3eb7('0x0'));var util=require(_0x3eb7('0x1'));var path=require(_0x3eb7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3eb7('0x3'));var router=express[_0x3eb7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3eb7('0x5'));var interaction=require(_0x3eb7('0x6'));var config=require(_0x3eb7('0x7'));var controller=require(_0x3eb7('0x8'));router[_0x3eb7('0x9')]('/',auth['isAuthenticated'](),controller[_0x3eb7('0xa')]);router[_0x3eb7('0x9')]('/describe',auth[_0x3eb7('0xb')](),controller[_0x3eb7('0xc')]);router[_0x3eb7('0x9')](_0x3eb7('0xd'),auth[_0x3eb7('0xb')](),controller['show']);router[_0x3eb7('0xe')]('/',auth[_0x3eb7('0xb')](),controller[_0x3eb7('0xf')]);router['put'](_0x3eb7('0xd'),auth[_0x3eb7('0xb')](),controller[_0x3eb7('0x10')]);router[_0x3eb7('0x11')](_0x3eb7('0xd'),auth[_0x3eb7('0xb')](),controller[_0x3eb7('0x12')]);module[_0x3eb7('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6da0162..bf53904 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 _0xd824=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x8da259,_0x33192f){var _0x181b7f=function(_0x30fe25){while(--_0x30fe25){_0x8da259['push'](_0x8da259['shift']());}};_0x181b7f(++_0x33192f);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x4d82('0x0'));module[_0x4d82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4d82('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4d82('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4d82('0x4')],'set':function(_0x287fbf){this[_0x4d82('0x5')]('crudPermissions',_0x287fbf?_0x287fbf['join'](''):[]);},'get':function(){return this[_0x4d82('0x6')]('crudPermissions')?this['getDataValue'](_0x4d82('0x7'))[_0x4d82('0x8')](''):[];}}}; \ No newline at end of file +var _0x8f4c=['setDataValue','join','crudPermissions','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x20f953,_0x3b1fc5){var _0x17337f=function(_0xae86fc){while(--_0xae86fc){_0x20f953['push'](_0x20f953['shift']());}};_0x17337f(++_0x3b1fc5);}(_0x8f4c,0x113));var _0xc8f4=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0x8f4c[_0xafceaf];return _0x3684e4;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xc8f4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xc8f4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xc8f4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xc8f4('0x2')],'set':function(_0x47350d){this[_0xc8f4('0x5')]('crudPermissions',_0x47350d?_0x47350d[_0xc8f4('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xc8f4('0x7'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b0a1ccb..af5ea00 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 _0x9406=['create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0x9406,0x12b));var _0x6940=function(_0x57334a,_0x568061){_0x57334a=_0x57334a-0x0;var _0x6f6e40=_0x9406[_0x57334a];return _0x6f6e40;};'use strict';var emlformat=require(_0x6940('0x0'));var rimraf=require(_0x6940('0x1'));var zipdir=require(_0x6940('0x2'));var jsonpatch=require(_0x6940('0x3'));var rp=require(_0x6940('0x4'));var moment=require(_0x6940('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6940('0x6'));var util=require(_0x6940('0x7'));var path=require(_0x6940('0x8'));var sox=require(_0x6940('0x9'));var csv=require(_0x6940('0xa'));var ejs=require(_0x6940('0xb'));var fs=require('fs');var fs_extra=require(_0x6940('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6940('0xd'));var jsforce=require(_0x6940('0xe'));var deskjs=require(_0x6940('0xf'));var toCsv=require(_0x6940('0xa'));var querystring=require(_0x6940('0x10'));var Papa=require(_0x6940('0x11'));var Redis=require('ioredis');var authService=require(_0x6940('0x12'));var qs=require(_0x6940('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6940('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6940('0x15'));var db=require(_0x6940('0x16'))['db'];function respondWithStatusCode(_0x2a4325,_0x153e18){_0x153e18=_0x153e18||0xcc;return function(_0x308aa2){if(_0x308aa2){return _0x2a4325[_0x6940('0x17')](_0x153e18);}return _0x2a4325[_0x6940('0x18')](_0x153e18)[_0x6940('0x19')]();};}function respondWithResult(_0x3b4c7b,_0x3a2c81){_0x3a2c81=_0x3a2c81||0xc8;return function(_0x40cf3d){if(_0x40cf3d){return _0x3b4c7b['status'](_0x3a2c81)[_0x6940('0x1a')](_0x40cf3d);}};}function respondWithFilteredResult(_0x28e2f6,_0x477b89){return function(_0x3c5dc3){if(_0x3c5dc3){var _0x1f5892=typeof _0x477b89[_0x6940('0x1b')]===_0x6940('0x1c')&&typeof _0x477b89[_0x6940('0x1d')]===_0x6940('0x1c');var _0x17aa8f=_0x3c5dc3[_0x6940('0x1e')];var _0x778786=_0x1f5892?0x0:_0x477b89[_0x6940('0x1b')];var _0x1a0c0d=_0x1f5892?_0x3c5dc3['count']:_0x477b89[_0x6940('0x1b')]+_0x477b89[_0x6940('0x1d')];var _0x191364;if(_0x1a0c0d>=_0x17aa8f){_0x1a0c0d=_0x17aa8f;_0x191364=0xc8;}else{_0x191364=0xce;}_0x28e2f6['status'](_0x191364);return _0x28e2f6[_0x6940('0x1f')](_0x6940('0x20'),_0x778786+'-'+_0x1a0c0d+'/'+_0x17aa8f)['json'](_0x3c5dc3);}return null;};}function patchUpdates(_0x182b64){return function(_0xd875c7){try{jsonpatch[_0x6940('0x21')](_0xd875c7,_0x182b64,!![]);}catch(_0x5cf522){return BPromise[_0x6940('0x22')](_0x5cf522);}return _0xd875c7['save']();};}function saveUpdates(_0x1dc504,_0x41a606){return function(_0x59f593){if(_0x59f593){return _0x59f593[_0x6940('0x23')](_0x1dc504)[_0x6940('0x24')](function(_0x22ff17){return _0x22ff17;});}return null;};}function removeEntity(_0x5c3b7c,_0x56b657){return function(_0xc84819){if(_0xc84819){return _0xc84819[_0x6940('0x25')]()['then'](function(){_0x5c3b7c['status'](0xcc)[_0x6940('0x19')]();});}};}function handleEntityNotFound(_0x17ad4f,_0x48505a){return function(_0x2d7fa4){if(!_0x2d7fa4){_0x17ad4f[_0x6940('0x17')](0x194);}return _0x2d7fa4;};}function handleError(_0x27ca78,_0x5b9871){_0x5b9871=_0x5b9871||0x1f4;return function(_0x4f18a9){logger['error'](_0x4f18a9[_0x6940('0x26')]);if(_0x4f18a9[_0x6940('0x27')]){delete _0x4f18a9[_0x6940('0x27')];}_0x27ca78[_0x6940('0x18')](_0x5b9871)[_0x6940('0x28')](_0x4f18a9);};}exports['index']=function(_0x1062a1,_0x57c36e){var _0x20b135={},_0x35d8e1={},_0x285b7b={'count':0x0,'rows':[]};var _0x343bf7=_[_0x6940('0x29')](db[_0x6940('0x2a')][_0x6940('0x2b')],function(_0x15c39e){return{'name':_0x15c39e[_0x6940('0x2c')],'type':_0x15c39e[_0x6940('0x2d')]['key']};});_0x35d8e1[_0x6940('0x2e')]=_[_0x6940('0x29')](_0x343bf7,_0x6940('0x27'));_0x35d8e1['query']=_[_0x6940('0x2f')](_0x1062a1[_0x6940('0x30')]);_0x35d8e1[_0x6940('0x31')]=_['intersection'](_0x35d8e1[_0x6940('0x2e')],_0x35d8e1[_0x6940('0x30')]);_0x20b135[_0x6940('0x32')]=_[_0x6940('0x33')](_0x35d8e1[_0x6940('0x2e')],qs[_0x6940('0x34')](_0x1062a1[_0x6940('0x30')][_0x6940('0x34')]));_0x20b135[_0x6940('0x32')]=_0x20b135[_0x6940('0x32')][_0x6940('0x35')]?_0x20b135[_0x6940('0x32')]:_0x35d8e1[_0x6940('0x2e')];if(!_0x1062a1['query'][_0x6940('0x36')](_0x6940('0x37'))){_0x20b135[_0x6940('0x1d')]=qs[_0x6940('0x1d')](_0x1062a1[_0x6940('0x30')][_0x6940('0x1d')]);_0x20b135['offset']=qs[_0x6940('0x1b')](_0x1062a1[_0x6940('0x30')][_0x6940('0x1b')]);}_0x20b135[_0x6940('0x38')]=qs[_0x6940('0x39')](_0x1062a1[_0x6940('0x30')]['sort']);_0x20b135[_0x6940('0x3a')]=qs['filters'](_[_0x6940('0x3b')](_0x1062a1['query'],_0x35d8e1[_0x6940('0x31')]),_0x343bf7);if(_0x1062a1[_0x6940('0x30')][_0x6940('0x3c')]){_0x20b135['where']=_[_0x6940('0x3d')](_0x20b135[_0x6940('0x3a')],{'$or':_['map'](_0x343bf7,function(_0x2a48e6){if(_0x2a48e6[_0x6940('0x2d')]!==_0x6940('0x3e')){var _0x34ed11={};_0x34ed11[_0x2a48e6[_0x6940('0x27')]]={'$like':'%'+_0x1062a1[_0x6940('0x30')][_0x6940('0x3c')]+'%'};return _0x34ed11;}})});}_0x20b135=_[_0x6940('0x3d')]({},_0x20b135,_0x1062a1[_0x6940('0x3f')]);var _0x74a09={'where':_0x20b135[_0x6940('0x3a')]};return db[_0x6940('0x2a')][_0x6940('0x1e')](_0x74a09)[_0x6940('0x24')](function(_0x4a0830){_0x285b7b['count']=_0x4a0830;if(_0x1062a1[_0x6940('0x30')]['includeAll']){_0x20b135[_0x6940('0x40')]=[{'all':!![]}];}return db[_0x6940('0x2a')][_0x6940('0x41')](_0x20b135);})['then'](function(_0x5aa410){_0x285b7b[_0x6940('0x42')]=_0x5aa410;return _0x285b7b;})['then'](respondWithFilteredResult(_0x57c36e,_0x20b135))[_0x6940('0x43')](handleError(_0x57c36e,null));};exports[_0x6940('0x44')]=function(_0x2109bb,_0x48dfd6){var _0x31b1fd={'raw':![],'where':{'id':_0x2109bb[_0x6940('0x45')]['id']}},_0x270938={};_0x270938['model']=_['keys'](db['UserProfileSection'][_0x6940('0x2b')]);_0x270938[_0x6940('0x30')]=_[_0x6940('0x2f')](_0x2109bb['query']);_0x270938[_0x6940('0x31')]=_[_0x6940('0x33')](_0x270938['model'],_0x270938[_0x6940('0x30')]);_0x31b1fd['attributes']=_[_0x6940('0x33')](_0x270938[_0x6940('0x2e')],qs[_0x6940('0x34')](_0x2109bb['query']['fields']));_0x31b1fd[_0x6940('0x32')]=_0x31b1fd['attributes'][_0x6940('0x35')]?_0x31b1fd[_0x6940('0x32')]:_0x270938[_0x6940('0x2e')];if(_0x2109bb[_0x6940('0x30')]['includeAll']){_0x31b1fd[_0x6940('0x40')]=[{'all':!![]}];}_0x31b1fd=_[_0x6940('0x3d')]({},_0x31b1fd,_0x2109bb[_0x6940('0x3f')]);return db['UserProfileSection'][_0x6940('0x46')](_0x31b1fd)[_0x6940('0x24')](handleEntityNotFound(_0x48dfd6,null))['then'](respondWithResult(_0x48dfd6,null))[_0x6940('0x43')](handleError(_0x48dfd6,null));};exports[_0x6940('0x47')]=function(_0x138264,_0x141d0c){return db[_0x6940('0x2a')][_0x6940('0x47')](_0x138264[_0x6940('0x48')],{})[_0x6940('0x24')](respondWithResult(_0x141d0c,0xc9))['catch'](handleError(_0x141d0c,null));};exports[_0x6940('0x23')]=function(_0x1a1aee,_0x2480f6){if(_0x1a1aee['body']['id']){delete _0x1a1aee[_0x6940('0x48')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1a1aee[_0x6940('0x45')]['id']}})[_0x6940('0x24')](handleEntityNotFound(_0x2480f6,null))[_0x6940('0x24')](saveUpdates(_0x1a1aee['body'],null))['then'](respondWithResult(_0x2480f6,null))[_0x6940('0x43')](handleError(_0x2480f6,null));};exports[_0x6940('0x25')]=function(_0xc84b87,_0x226499){return db['UserProfileSection']['find']({'where':{'id':_0xc84b87[_0x6940('0x45')]['id']}})[_0x6940('0x24')](handleEntityNotFound(_0x226499,null))[_0x6940('0x24')](removeEntity(_0x226499,null))[_0x6940('0x43')](handleError(_0x226499,null));};exports[_0x6940('0x49')]=function(_0x565ae4,_0x5e6ae4){return db[_0x6940('0x2a')][_0x6940('0x49')]()[_0x6940('0x24')](respondWithResult(_0x5e6ae4,null))[_0x6940('0x43')](handleError(_0x5e6ae4,null));}; \ No newline at end of file +var _0xfa0f=['error','stack','name','send','index','map','UserProfileSection','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','length','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x4fc13a,_0x169f5d){var _0x56ede5=function(_0x9d0b24){while(--_0x9d0b24){_0x4fc13a['push'](_0x4fc13a['shift']());}};_0x56ede5(++_0x169f5d);}(_0xfa0f,0x6f));var _0xffa0=function(_0x5285d0,_0x3d424c){_0x5285d0=_0x5285d0-0x0;var _0x4dd0a2=_0xfa0f[_0x5285d0];return _0x4dd0a2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xffa0('0x0'));var jsonpatch=require(_0xffa0('0x1'));var rp=require(_0xffa0('0x2'));var moment=require(_0xffa0('0x3'));var BPromise=require(_0xffa0('0x4'));var Mustache=require(_0xffa0('0x5'));var util=require(_0xffa0('0x6'));var path=require(_0xffa0('0x7'));var sox=require(_0xffa0('0x8'));var csv=require(_0xffa0('0x9'));var ejs=require(_0xffa0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xffa0('0xb'));var crypto=require('crypto');var jsforce=require(_0xffa0('0xc'));var deskjs=require(_0xffa0('0xd'));var toCsv=require(_0xffa0('0x9'));var querystring=require(_0xffa0('0xe'));var Papa=require('papaparse');var Redis=require(_0xffa0('0xf'));var authService=require(_0xffa0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffa0('0x11'));var hardwareService=require(_0xffa0('0x12'));var logger=require(_0xffa0('0x13'))(_0xffa0('0x14'));var utils=require(_0xffa0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xffa0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d757e,_0x1d81d1){_0x1d81d1=_0x1d81d1||0xcc;return function(_0x5326b6){if(_0x5326b6){return _0x1d757e[_0xffa0('0x17')](_0x1d81d1);}return _0x1d757e[_0xffa0('0x18')](_0x1d81d1)[_0xffa0('0x19')]();};}function respondWithResult(_0xf9c5f1,_0x136f19){_0x136f19=_0x136f19||0xc8;return function(_0x2eab39){if(_0x2eab39){return _0xf9c5f1[_0xffa0('0x18')](_0x136f19)['json'](_0x2eab39);}};}function respondWithFilteredResult(_0x1a48b0,_0x233e94){return function(_0xfdd493){if(_0xfdd493){var _0x65bc36=typeof _0x233e94[_0xffa0('0x1a')]===_0xffa0('0x1b')&&typeof _0x233e94['limit']===_0xffa0('0x1b');var _0x41da98=_0xfdd493[_0xffa0('0x1c')];var _0x4ac72e=_0x65bc36?0x0:_0x233e94[_0xffa0('0x1a')];var _0x5b4dea=_0x65bc36?_0xfdd493[_0xffa0('0x1c')]:_0x233e94['offset']+_0x233e94[_0xffa0('0x1d')];var _0x3d1d62;if(_0x5b4dea>=_0x41da98){_0x5b4dea=_0x41da98;_0x3d1d62=0xc8;}else{_0x3d1d62=0xce;}_0x1a48b0[_0xffa0('0x18')](_0x3d1d62);return _0x1a48b0[_0xffa0('0x1e')](_0xffa0('0x1f'),_0x4ac72e+'-'+_0x5b4dea+'/'+_0x41da98)['json'](_0xfdd493);}return null;};}function patchUpdates(_0x51bec6){return function(_0x400cde){try{jsonpatch[_0xffa0('0x20')](_0x400cde,_0x51bec6,!![]);}catch(_0x2466c3){return BPromise[_0xffa0('0x21')](_0x2466c3);}return _0x400cde[_0xffa0('0x22')]();};}function saveUpdates(_0x293113,_0x478948){return function(_0x35f679){if(_0x35f679){return _0x35f679[_0xffa0('0x23')](_0x293113)[_0xffa0('0x24')](function(_0x2e01db){return _0x2e01db;});}return null;};}function removeEntity(_0x539a4f,_0x1a56aa){return function(_0x408755){if(_0x408755){return _0x408755['destroy']()[_0xffa0('0x24')](function(){_0x539a4f[_0xffa0('0x18')](0xcc)[_0xffa0('0x19')]();});}};}function handleEntityNotFound(_0x69a19e,_0x4d8021){return function(_0x29c466){if(!_0x29c466){_0x69a19e['sendStatus'](0x194);}return _0x29c466;};}function handleError(_0x2ad034,_0x50c286){_0x50c286=_0x50c286||0x1f4;return function(_0x6fcac){logger[_0xffa0('0x25')](_0x6fcac[_0xffa0('0x26')]);if(_0x6fcac[_0xffa0('0x27')]){delete _0x6fcac[_0xffa0('0x27')];}_0x2ad034[_0xffa0('0x18')](_0x50c286)[_0xffa0('0x28')](_0x6fcac);};}exports[_0xffa0('0x29')]=function(_0x5be1e3,_0x24e7fc){var _0x34704b={},_0x580016={},_0x42726b={'count':0x0,'rows':[]};var _0x33da50=_[_0xffa0('0x2a')](db[_0xffa0('0x2b')][_0xffa0('0x2c')],function(_0x45cdfc){return{'name':_0x45cdfc['fieldName'],'type':_0x45cdfc['type'][_0xffa0('0x2d')]};});_0x580016[_0xffa0('0x2e')]=_[_0xffa0('0x2a')](_0x33da50,_0xffa0('0x27'));_0x580016[_0xffa0('0x2f')]=_['keys'](_0x5be1e3[_0xffa0('0x2f')]);_0x580016[_0xffa0('0x30')]=_[_0xffa0('0x31')](_0x580016[_0xffa0('0x2e')],_0x580016[_0xffa0('0x2f')]);_0x34704b[_0xffa0('0x32')]=_[_0xffa0('0x31')](_0x580016[_0xffa0('0x2e')],qs[_0xffa0('0x33')](_0x5be1e3['query'][_0xffa0('0x33')]));_0x34704b[_0xffa0('0x32')]=_0x34704b[_0xffa0('0x32')]['length']?_0x34704b['attributes']:_0x580016[_0xffa0('0x2e')];if(!_0x5be1e3['query'][_0xffa0('0x34')](_0xffa0('0x35'))){_0x34704b[_0xffa0('0x1d')]=qs[_0xffa0('0x1d')](_0x5be1e3[_0xffa0('0x2f')][_0xffa0('0x1d')]);_0x34704b[_0xffa0('0x1a')]=qs[_0xffa0('0x1a')](_0x5be1e3[_0xffa0('0x2f')][_0xffa0('0x1a')]);}_0x34704b[_0xffa0('0x36')]=qs['sort'](_0x5be1e3[_0xffa0('0x2f')]['sort']);_0x34704b[_0xffa0('0x37')]=qs['filters'](_[_0xffa0('0x38')](_0x5be1e3[_0xffa0('0x2f')],_0x580016[_0xffa0('0x30')]),_0x33da50);if(_0x5be1e3[_0xffa0('0x2f')][_0xffa0('0x39')]){_0x34704b['where']=_[_0xffa0('0x3a')](_0x34704b[_0xffa0('0x37')],{'$or':_['map'](_0x33da50,function(_0x1c52bf){if(_0x1c52bf[_0xffa0('0x3b')]!==_0xffa0('0x3c')){var _0x24be46={};_0x24be46[_0x1c52bf['name']]={'$like':'%'+_0x5be1e3[_0xffa0('0x2f')][_0xffa0('0x39')]+'%'};return _0x24be46;}})});}_0x34704b=_[_0xffa0('0x3a')]({},_0x34704b,_0x5be1e3[_0xffa0('0x3d')]);var _0xe524fc={'where':_0x34704b[_0xffa0('0x37')]};return db['UserProfileSection'][_0xffa0('0x1c')](_0xe524fc)[_0xffa0('0x24')](function(_0x27c544){_0x42726b[_0xffa0('0x1c')]=_0x27c544;if(_0x5be1e3[_0xffa0('0x2f')][_0xffa0('0x3e')]){_0x34704b[_0xffa0('0x3f')]=[{'all':!![]}];}return db['UserProfileSection'][_0xffa0('0x40')](_0x34704b);})['then'](function(_0x46e38e){_0x42726b['rows']=_0x46e38e;return _0x42726b;})[_0xffa0('0x24')](respondWithFilteredResult(_0x24e7fc,_0x34704b))[_0xffa0('0x41')](handleError(_0x24e7fc,null));};exports['show']=function(_0x9d6deb,_0x505aa2){var _0x310c56={'raw':![],'where':{'id':_0x9d6deb[_0xffa0('0x42')]['id']}},_0x4048bc={};_0x4048bc[_0xffa0('0x2e')]=_[_0xffa0('0x43')](db[_0xffa0('0x2b')]['rawAttributes']);_0x4048bc['query']=_[_0xffa0('0x43')](_0x9d6deb[_0xffa0('0x2f')]);_0x4048bc['filters']=_['intersection'](_0x4048bc[_0xffa0('0x2e')],_0x4048bc[_0xffa0('0x2f')]);_0x310c56[_0xffa0('0x32')]=_[_0xffa0('0x31')](_0x4048bc[_0xffa0('0x2e')],qs[_0xffa0('0x33')](_0x9d6deb[_0xffa0('0x2f')][_0xffa0('0x33')]));_0x310c56[_0xffa0('0x32')]=_0x310c56[_0xffa0('0x32')][_0xffa0('0x44')]?_0x310c56['attributes']:_0x4048bc['model'];if(_0x9d6deb[_0xffa0('0x2f')][_0xffa0('0x3e')]){_0x310c56[_0xffa0('0x3f')]=[{'all':!![]}];}_0x310c56=_[_0xffa0('0x3a')]({},_0x310c56,_0x9d6deb[_0xffa0('0x3d')]);return db[_0xffa0('0x2b')][_0xffa0('0x45')](_0x310c56)[_0xffa0('0x24')](handleEntityNotFound(_0x505aa2,null))[_0xffa0('0x24')](respondWithResult(_0x505aa2,null))[_0xffa0('0x41')](handleError(_0x505aa2,null));};exports[_0xffa0('0x46')]=function(_0x4f12a5,_0xaa08f5){return db[_0xffa0('0x2b')][_0xffa0('0x46')](_0x4f12a5[_0xffa0('0x47')],{})[_0xffa0('0x24')](respondWithResult(_0xaa08f5,0xc9))[_0xffa0('0x41')](handleError(_0xaa08f5,null));};exports[_0xffa0('0x23')]=function(_0x5427d5,_0x4febb6){if(_0x5427d5[_0xffa0('0x47')]['id']){delete _0x5427d5[_0xffa0('0x47')]['id'];}return db[_0xffa0('0x2b')][_0xffa0('0x45')]({'where':{'id':_0x5427d5['params']['id']}})[_0xffa0('0x24')](handleEntityNotFound(_0x4febb6,null))[_0xffa0('0x24')](saveUpdates(_0x5427d5['body'],null))['then'](respondWithResult(_0x4febb6,null))[_0xffa0('0x41')](handleError(_0x4febb6,null));};exports[_0xffa0('0x48')]=function(_0x4be792,_0x576b29){return db['UserProfileSection'][_0xffa0('0x45')]({'where':{'id':_0x4be792[_0xffa0('0x42')]['id']}})[_0xffa0('0x24')](handleEntityNotFound(_0x576b29,null))[_0xffa0('0x24')](removeEntity(_0x576b29,null))['catch'](handleError(_0x576b29,null));};exports[_0xffa0('0x49')]=function(_0x2a60c9,_0x8af8c8){return db[_0xffa0('0x2b')][_0xffa0('0x49')]()[_0xffa0('0x24')](respondWithResult(_0x8af8c8,null))[_0xffa0('0x41')](handleError(_0x8af8c8,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 852b578..f10e111 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 _0x0a05=['sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userProfileSection.attributes','user_profile_has_sections','compositeIndex'];(function(_0x3be415,_0x5d6559){var _0xcf051c=function(_0x163a86){while(--_0x163a86){_0x3be415['push'](_0x3be415['shift']());}};_0xcf051c(++_0x5d6559);}(_0x0a05,0x9e));var _0x50a0=function(_0x3abe6a,_0xdd7b1a){_0x3abe6a=_0x3abe6a-0x0;var _0x2fc39e=_0x0a05[_0x3abe6a];return _0x2fc39e;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var logger=require(_0x50a0('0x2'))(_0x50a0('0x3'));var moment=require(_0x50a0('0x4'));var BPromise=require(_0x50a0('0x5'));var rp=require(_0x50a0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x50a0('0x7'));var config=require('../../config/environment');var attributes=require(_0x50a0('0x8'));module['exports']=function(_0x3546f9,_0x41a18d){return _0x3546f9['define']('UserProfileSection',attributes,{'tableName':_0x50a0('0x9'),'paranoid':![],'indexes':[{'name':_0x50a0('0xa'),'fields':[_0x50a0('0xb'),_0x50a0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03bb=['exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x318cb1,_0x1f8c80){var _0x219643=function(_0x2bd51e){while(--_0x2bd51e){_0x318cb1['push'](_0x318cb1['shift']());}};_0x219643(++_0x1f8c80);}(_0x03bb,0x17a));var _0xb03b=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0x03bb[_0xe3e0af];return _0x4828e9;};'use strict';var _=require('lodash');var util=require(_0xb03b('0x0'));var logger=require(_0xb03b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb03b('0x2'));var rp=require(_0xb03b('0x3'));var fs=require('fs');var path=require(_0xb03b('0x4'));var rimraf=require(_0xb03b('0x5'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xb03b('0x6')]=function(_0x27aad4,_0x4353bf){return _0x27aad4[_0xb03b('0x7')](_0xb03b('0x8'),attributes,{'tableName':_0xb03b('0x9'),'paranoid':![],'indexes':[{'name':_0xb03b('0xa'),'fields':['sectionId',_0xb03b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index e54b08c..f358636 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 _0x2b99=['moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x96fc16,_0xc2d511){var _0x53ff44=function(_0x1f636b){while(--_0x1f636b){_0x96fc16['push'](_0x96fc16['shift']());}};_0x53ff44(++_0xc2d511);}(_0x2b99,0x1b3));var _0x92b9=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x2b99[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var moment=require(_0x92b9('0x2'));var BPromise=require('bluebird');var rs=require(_0x92b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b9('0x4'))['db'];var utils=require(_0x92b9('0x5'));var logger=require('../../config/logger')(_0x92b9('0x6'));var config=require(_0x92b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x92b9('0x8')][_0x92b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x61f37e,_0x1b1000,_0x4267b2){return new BPromise(function(_0x927fc0,_0x53e1a5){return client[_0x92b9('0xa')](_0x61f37e,_0x4267b2)[_0x92b9('0xb')](function(_0x31f8bb){logger[_0x92b9('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x1b1000,_0x92b9('0xd'));logger[_0x92b9('0xe')](_0x92b9('0xf'),_0x1b1000,_0x92b9('0xd'),JSON[_0x92b9('0x10')](_0x31f8bb));if(_0x31f8bb[_0x92b9('0x11')]){if(_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x12')]===0x1f4){logger[_0x92b9('0x11')](_0x92b9('0x13'),_0x1b1000,_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);return _0x53e1a5(_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);}logger[_0x92b9('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x1b1000,_0x31f8bb[_0x92b9('0x11')][_0x92b9('0x14')]);return _0x927fc0(_0x31f8bb['error']['message']);}else{logger[_0x92b9('0xc')](_0x92b9('0x13'),_0x1b1000,_0x92b9('0xd'));_0x927fc0(_0x31f8bb[_0x92b9('0x15')][_0x92b9('0x14')]);}})[_0x92b9('0x16')](function(_0x491168){logger['error'](_0x92b9('0x13'),_0x1b1000,_0x491168);_0x53e1a5(_0x491168);});});} \ No newline at end of file +var _0xe6a5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch'];(function(_0x310926,_0x226e01){var _0x205927=function(_0x330d81){while(--_0x330d81){_0x310926['push'](_0x310926['shift']());}};_0x205927(++_0x226e01);}(_0xe6a5,0x13b));var _0x5e6a=function(_0x239231,_0x2e03ee){_0x239231=_0x239231-0x0;var _0x54e479=_0xe6a5[_0x239231];return _0x54e479;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5e6a('0x0'));var rs=require(_0x5e6a('0x1'));var fs=require('fs');var Redis=require(_0x5e6a('0x2'));var db=require(_0x5e6a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e6a('0x4'))('rpc');var config=require(_0x5e6a('0x5'));var jayson=require(_0x5e6a('0x6'));var client=jayson[_0x5e6a('0x7')][_0x5e6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1aa798,_0x11ab77,_0x2f34a0){return new BPromise(function(_0x26ea18,_0x26e98e){return client[_0x5e6a('0x9')](_0x1aa798,_0x2f34a0)[_0x5e6a('0xa')](function(_0x593b06){logger[_0x5e6a('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x11ab77,_0x5e6a('0xc'));logger[_0x5e6a('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x11ab77,_0x5e6a('0xc'),JSON[_0x5e6a('0xe')](_0x593b06));if(_0x593b06[_0x5e6a('0xf')]){if(_0x593b06[_0x5e6a('0xf')][_0x5e6a('0x10')]===0x1f4){logger[_0x5e6a('0xf')](_0x5e6a('0x11'),_0x11ab77,_0x593b06[_0x5e6a('0xf')]['message']);return _0x26e98e(_0x593b06[_0x5e6a('0xf')][_0x5e6a('0x12')]);}logger[_0x5e6a('0xf')](_0x5e6a('0x11'),_0x11ab77,_0x593b06['error'][_0x5e6a('0x12')]);return _0x26ea18(_0x593b06[_0x5e6a('0xf')]['message']);}else{logger['info'](_0x5e6a('0x11'),_0x11ab77,_0x5e6a('0xc'));_0x26ea18(_0x593b06[_0x5e6a('0x13')][_0x5e6a('0x12')]);}})[_0x5e6a('0x14')](function(_0x53d663){logger[_0x5e6a('0xf')](_0x5e6a('0x11'),_0x11ab77,_0x53d663);_0x26e98e(_0x53d663);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2cd4f17..192c883 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(_0x15acfe,_0x1fd6fb){var _0x2b1f9b=function(_0x47e717){while(--_0x47e717){_0x15acfe['push'](_0x15acfe['shift']());}};_0x2b1f9b(++_0x1fd6fb);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4d2752,_0x16f0c5){var _0x3d2e74=function(_0x50d2d6){while(--_0x50d2d6){_0x4d2752['push'](_0x4d2752['shift']());}};_0x3d2e74(++_0x16f0c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 64a3987..313c19a 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 _0x1828=['INTEGER'];(function(_0x3badc5,_0xc49ce3){var _0x5d05ac=function(_0xaa1849){while(--_0xaa1849){_0x3badc5['push'](_0x3badc5['shift']());}};_0x5d05ac(++_0xc49ce3);}(_0x1828,0xb0));var _0x8182=function(_0x27a3de,_0x46798e){_0x27a3de=_0x27a3de-0x0;var _0x44a885=_0x1828[_0x27a3de];return _0x44a885;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x8182('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd63=['exports','INTEGER','sequelize'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0xcd63,0xfe));var _0x3cd6=function(_0x2169c5,_0x330ade){_0x2169c5=_0x2169c5-0x0;var _0x401328=_0xcd63[_0x2169c5];return _0x401328;};'use strict';var Sequelize=require(_0x3cd6('0x0'));module[_0x3cd6('0x1')]={'penalty':{'type':Sequelize[_0x3cd6('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 ecde86b..5667730 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 _0xf69c=['../../config/environment','exports','define','UserSmsQueue','lodash','../../config/logger','api','bluebird','path'];(function(_0x5c5f2f,_0x4325f3){var _0x4ecef=function(_0x94d18c){while(--_0x94d18c){_0x5c5f2f['push'](_0x5c5f2f['shift']());}};_0x4ecef(++_0x4325f3);}(_0xf69c,0x151));var _0xcf69=function(_0x1c05c0,_0x38e872){_0x1c05c0=_0x1c05c0-0x0;var _0x4b8d87=_0xf69c[_0x1c05c0];return _0x4b8d87;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var logger=require(_0xcf69('0x1'))(_0xcf69('0x2'));var moment=require('moment');var BPromise=require(_0xcf69('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf69('0x4'));var rimraf=require('rimraf');var config=require(_0xcf69('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0xcf69('0x6')]=function(_0x168197,_0x225c65){return _0x168197[_0xcf69('0x7')](_0xcf69('0x8'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b65=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0xa4d003,_0x3d9dbd){var _0x319ad9=function(_0x2b42f0){while(--_0x2b42f0){_0xa4d003['push'](_0xa4d003['shift']());}};_0x319ad9(++_0x3d9dbd);}(_0x1b65,0x1b4));var _0x51b6=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0x1b65[_0x2c2a8e];return _0x3b9e38;};'use strict';var _=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var logger=require(_0x51b6('0x2'))(_0x51b6('0x3'));var moment=require('moment');var BPromise=require(_0x51b6('0x4'));var rp=require(_0x51b6('0x5'));var fs=require('fs');var path=require(_0x51b6('0x6'));var rimraf=require(_0x51b6('0x7'));var config=require(_0x51b6('0x8'));var attributes=require(_0x51b6('0x9'));module[_0x51b6('0xa')]=function(_0x578b6a,_0x466a60){return _0x578b6a[_0x51b6('0xb')](_0x51b6('0xc'),attributes,{'tableName':_0x51b6('0xd'),'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 ca71584..7c0a640 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 _0xd57e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x351ce6,_0x235b4f){var _0x477abb=function(_0x5508f7){while(--_0x5508f7){_0x351ce6['push'](_0x351ce6['shift']());}};_0x477abb(++_0x235b4f);}(_0xd57e,0xec));var _0xed57=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0xd57e[_0x3238ea];return _0x4aaac2;};'use strict';var _=require(_0xed57('0x0'));var util=require(_0xed57('0x1'));var moment=require(_0xed57('0x2'));var BPromise=require(_0xed57('0x3'));var rs=require(_0xed57('0x4'));var fs=require('fs');var Redis=require(_0xed57('0x5'));var db=require(_0xed57('0x6'))['db'];var utils=require(_0xed57('0x7'));var logger=require(_0xed57('0x8'))(_0xed57('0x9'));var config=require(_0xed57('0xa'));var jayson=require(_0xed57('0xb'));var client=jayson[_0xed57('0xc')][_0xed57('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4888cc,_0x318e06,_0x3b7f08){return new BPromise(function(_0x24b7d8,_0x2e2c17){return client[_0xed57('0xe')](_0x4888cc,_0x3b7f08)[_0xed57('0xf')](function(_0x3dc728){logger[_0xed57('0x10')](_0xed57('0x11'),_0x318e06,_0xed57('0x12'));logger[_0xed57('0x13')](_0xed57('0x14'),_0x318e06,_0xed57('0x12'),JSON[_0xed57('0x15')](_0x3dc728));if(_0x3dc728[_0xed57('0x16')]){if(_0x3dc728[_0xed57('0x16')][_0xed57('0x17')]===0x1f4){logger[_0xed57('0x16')]('UserSmsQueue,\x20%s,\x20%s',_0x318e06,_0x3dc728[_0xed57('0x16')]['message']);return _0x2e2c17(_0x3dc728[_0xed57('0x16')][_0xed57('0x18')]);}logger[_0xed57('0x16')](_0xed57('0x11'),_0x318e06,_0x3dc728[_0xed57('0x16')][_0xed57('0x18')]);return _0x24b7d8(_0x3dc728[_0xed57('0x16')][_0xed57('0x18')]);}else{logger[_0xed57('0x10')](_0xed57('0x11'),_0x318e06,_0xed57('0x12'));_0x24b7d8(_0x3dc728[_0xed57('0x19')]['message']);}})[_0xed57('0x1a')](function(_0x3953d1){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x318e06,_0x3953d1);_0x2e2c17(_0x3953d1);});});} \ No newline at end of file +var _0x27e0=['request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x27e0,0xf2));var _0x027e=function(_0x116f7d,_0xe30646){_0x116f7d=_0x116f7d-0x0;var _0x1a63bd=_0x27e0[_0x116f7d];return _0x1a63bd;};'use strict';var _=require(_0x027e('0x0'));var util=require(_0x027e('0x1'));var moment=require(_0x027e('0x2'));var BPromise=require(_0x027e('0x3'));var rs=require(_0x027e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x027e('0x5'))['db'];var utils=require(_0x027e('0x6'));var logger=require(_0x027e('0x7'))('rpc');var config=require(_0x027e('0x8'));var jayson=require(_0x027e('0x9'));var client=jayson[_0x027e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473d5a,_0x322240,_0x10cdb6){return new BPromise(function(_0x473d91,_0x307d61){return client[_0x027e('0xb')](_0x473d5a,_0x10cdb6)[_0x027e('0xc')](function(_0x1e47c8){logger['info'](_0x027e('0xd'),_0x322240,_0x027e('0xe'));logger['debug'](_0x027e('0xf'),_0x322240,_0x027e('0xe'),JSON[_0x027e('0x10')](_0x1e47c8));if(_0x1e47c8[_0x027e('0x11')]){if(_0x1e47c8['error'][_0x027e('0x12')]===0x1f4){logger[_0x027e('0x11')](_0x027e('0xd'),_0x322240,_0x1e47c8[_0x027e('0x11')][_0x027e('0x13')]);return _0x307d61(_0x1e47c8['error'][_0x027e('0x13')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x322240,_0x1e47c8[_0x027e('0x11')][_0x027e('0x13')]);return _0x473d91(_0x1e47c8[_0x027e('0x11')][_0x027e('0x13')]);}else{logger[_0x027e('0x14')](_0x027e('0xd'),_0x322240,_0x027e('0xe'));_0x473d91(_0x1e47c8[_0x027e('0x15')][_0x027e('0x13')]);}})[_0x027e('0x16')](function(_0x235023){logger[_0x027e('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x322240,_0x235023);_0x307d61(_0x235023);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index a7693d4..c36c721 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 _0x9230=['INTEGER'];(function(_0x56c313,_0x4acb15){var _0x12987d=function(_0x597e84){while(--_0x597e84){_0x56c313['push'](_0x56c313['shift']());}};_0x12987d(++_0x4acb15);}(_0x9230,0xdf));var _0x0923=function(_0x40c64b,_0x53b4d0){_0x40c64b=_0x40c64b-0x0;var _0x32b982=_0x9230[_0x40c64b];return _0x32b982;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0x0923('0x0')]},'VoicePrefixId':{'type':Sequelize[_0x0923('0x0')]}}; \ No newline at end of file +var _0x7e1d=['INTEGER'];(function(_0x38fa84,_0x44395f){var _0x547889=function(_0x4f8779){while(--_0x4f8779){_0x38fa84['push'](_0x38fa84['shift']());}};_0x547889(++_0x44395f);}(_0x7e1d,0x116));var _0xd7e1=function(_0x2f1c1f,_0x178ef8){_0x2f1c1f=_0x2f1c1f-0x0;var _0x197323=_0x7e1d[_0x2f1c1f];return _0x197323;};'use strict';var Sequelize=require('sequelize');module['exports']={'UserId':{'type':Sequelize[_0xd7e1('0x0')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6aa0171..a1e0512 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(_0x18701f,_0x39d491){var _0x4045e7=function(_0x2c5161){while(--_0x2c5161){_0x18701f['push'](_0x18701f['shift']());}};_0x4045e7(++_0x39d491);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x449972,_0x20482b){var _0x1a77d1=function(_0x5af064){while(--_0x5af064){_0x449972['push'](_0x449972['shift']());}};_0x1a77d1(++_0x20482b);}(_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':'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 b0143e4..f761944 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1ac98f,_0x1a96b0){var _0x9d0e7=function(_0x50a405){while(--_0x50a405){_0x1ac98f['push'](_0x1ac98f['shift']());}};_0x9d0e7(++_0x1a96b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x93feb2,_0x569f20){var _0x5117d5=function(_0xb443c9){while(--_0xb443c9){_0x93feb2['push'](_0x93feb2['shift']());}};_0x5117d5(++_0x569f20);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0xcb91[_0x52b7b9];return _0x5b5d30;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index f200942..40e86c1 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 _0x04e7=['INTEGER','sequelize','exports'];(function(_0x5257b7,_0x4f42d6){var _0x5a8139=function(_0x4adfe2){while(--_0x4adfe2){_0x5257b7['push'](_0x5257b7['shift']());}};_0x5a8139(++_0x4f42d6);}(_0x04e7,0x121));var _0x704e=function(_0x1ca9e9,_0x1c4391){_0x1ca9e9=_0x1ca9e9-0x0;var _0x309f3c=_0x04e7[_0x1ca9e9];return _0x309f3c;};'use strict';var Sequelize=require(_0x704e('0x0'));module[_0x704e('0x1')]={'penalty':{'type':Sequelize[_0x704e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7f0=['sequelize','INTEGER'];(function(_0x2f8cb4,_0x2958d5){var _0x16dd55=function(_0x12405b){while(--_0x12405b){_0x2f8cb4['push'](_0x2f8cb4['shift']());}};_0x16dd55(++_0x2958d5);}(_0xf7f0,0xa4));var _0x0f7f=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0xf7f0[_0x6cf3b6];return _0xdbe948;};'use strict';var Sequelize=require(_0x0f7f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0f7f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index ae69354..6578113 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 _0x3003=['path','../../config/environment','./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d8f27,_0x240391){var _0x348718=function(_0x911e02){while(--_0x911e02){_0x5d8f27['push'](_0x5d8f27['shift']());}};_0x348718(++_0x240391);}(_0x3003,0x1c1));var _0x3300=function(_0x4d6d36,_0x268b66){_0x4d6d36=_0x4d6d36-0x0;var _0xc2dc1b=_0x3003[_0x4d6d36];return _0xc2dc1b;};'use strict';var _=require(_0x3300('0x0'));var util=require(_0x3300('0x1'));var logger=require(_0x3300('0x2'))(_0x3300('0x3'));var moment=require(_0x3300('0x4'));var BPromise=require(_0x3300('0x5'));var rp=require(_0x3300('0x6'));var fs=require('fs');var path=require(_0x3300('0x7'));var rimraf=require('rimraf');var config=require(_0x3300('0x8'));var attributes=require(_0x3300('0x9'));module[_0x3300('0xa')]=function(_0x4e82a3,_0x100eac){return _0x4e82a3['define']('UserVoiceQueue',attributes,{'tableName':_0x3300('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1073=['exports','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d37db,_0x1e7783){var _0x14e51b=function(_0x4298bd){while(--_0x4298bd){_0x5d37db['push'](_0x5d37db['shift']());}};_0x14e51b(++_0x1e7783);}(_0x1073,0x10b));var _0x3107=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x1073[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x3107('0x0'));var util=require(_0x3107('0x1'));var logger=require('../../config/logger')(_0x3107('0x2'));var moment=require(_0x3107('0x3'));var BPromise=require(_0x3107('0x4'));var rp=require(_0x3107('0x5'));var fs=require('fs');var path=require(_0x3107('0x6'));var rimraf=require(_0x3107('0x7'));var config=require(_0x3107('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x3107('0x9')]=function(_0x2ed01a,_0x33a8da){return _0x2ed01a['define'](_0x3107('0xa'),attributes,{'tableName':_0x3107('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 0135bfe..0edeb7b 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 _0x45e6=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2ef27c,_0x13f80a){var _0x5e84f5=function(_0x592b3e){while(--_0x592b3e){_0x2ef27c['push'](_0x2ef27c['shift']());}};_0x5e84f5(++_0x13f80a);}(_0x45e6,0x1e5));var _0x645e=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x45e6[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x645e('0x0'));var util=require(_0x645e('0x1'));var moment=require(_0x645e('0x2'));var BPromise=require(_0x645e('0x3'));var rs=require(_0x645e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x645e('0x5'))['db'];var utils=require(_0x645e('0x6'));var logger=require('../../config/logger')(_0x645e('0x7'));var config=require('../../config/environment');var jayson=require(_0x645e('0x8'));var client=jayson[_0x645e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41170a,_0x5f6074,_0x33a939){return new BPromise(function(_0x42bb18,_0x337f3f){return client[_0x645e('0xa')](_0x41170a,_0x33a939)[_0x645e('0xb')](function(_0x5f0567){logger[_0x645e('0xc')](_0x645e('0xd'),_0x5f6074,'request\x20sent');logger[_0x645e('0xe')](_0x645e('0xf'),_0x5f6074,_0x645e('0x10'),JSON['stringify'](_0x5f0567));if(_0x5f0567['error']){if(_0x5f0567[_0x645e('0x11')][_0x645e('0x12')]===0x1f4){logger['error'](_0x645e('0xd'),_0x5f6074,_0x5f0567[_0x645e('0x11')][_0x645e('0x13')]);return _0x337f3f(_0x5f0567[_0x645e('0x11')][_0x645e('0x13')]);}logger['error'](_0x645e('0xd'),_0x5f6074,_0x5f0567[_0x645e('0x11')][_0x645e('0x13')]);return _0x42bb18(_0x5f0567[_0x645e('0x11')][_0x645e('0x13')]);}else{logger['info'](_0x645e('0xd'),_0x5f6074,_0x645e('0x10'));_0x42bb18(_0x5f0567[_0x645e('0x14')][_0x645e('0x13')]);}})['catch'](function(_0x67a6e){logger[_0x645e('0x11')](_0x645e('0xd'),_0x5f6074,_0x67a6e);_0x337f3f(_0x67a6e);});});} \ No newline at end of file +var _0xddcd=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1365a8,_0x34edea){var _0x9e46e8=function(_0x5886fb){while(--_0x5886fb){_0x1365a8['push'](_0x1365a8['shift']());}};_0x9e46e8(++_0x34edea);}(_0xddcd,0x16c));var _0xdddc=function(_0x336966,_0x3dd901){_0x336966=_0x336966-0x0;var _0x3d0cc5=_0xddcd[_0x336966];return _0x3d0cc5;};'use strict';var _=require(_0xdddc('0x0'));var util=require('util');var moment=require(_0xdddc('0x1'));var BPromise=require(_0xdddc('0x2'));var rs=require(_0xdddc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdddc('0x4'))(_0xdddc('0x5'));var config=require(_0xdddc('0x6'));var jayson=require(_0xdddc('0x7'));var client=jayson[_0xdddc('0x8')][_0xdddc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c6f60,_0x270886,_0x224cc7){return new BPromise(function(_0x539480,_0x170cb4){return client[_0xdddc('0xa')](_0x4c6f60,_0x224cc7)[_0xdddc('0xb')](function(_0x241daf){logger[_0xdddc('0xc')](_0xdddc('0xd'),_0x270886,_0xdddc('0xe'));logger[_0xdddc('0xf')](_0xdddc('0x10'),_0x270886,_0xdddc('0xe'),JSON[_0xdddc('0x11')](_0x241daf));if(_0x241daf[_0xdddc('0x12')]){if(_0x241daf['error'][_0xdddc('0x13')]===0x1f4){logger[_0xdddc('0x12')](_0xdddc('0xd'),_0x270886,_0x241daf[_0xdddc('0x12')][_0xdddc('0x14')]);return _0x170cb4(_0x241daf[_0xdddc('0x12')][_0xdddc('0x14')]);}logger[_0xdddc('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x270886,_0x241daf['error']['message']);return _0x539480(_0x241daf[_0xdddc('0x12')][_0xdddc('0x14')]);}else{logger[_0xdddc('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x270886,_0xdddc('0xe'));_0x539480(_0x241daf['result'][_0xdddc('0x14')]);}})[_0xdddc('0x15')](function(_0x5067ac){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x270886,_0x5067ac);_0x170cb4(_0x5067ac);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6541da5..fc71de9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3466bf,_0x2886dd){var _0x42e29a=function(_0x2fbcee){while(--_0x2fbcee){_0x3466bf['push'](_0x3466bf['shift']());}};_0x42e29a(++_0x2886dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e35de,_0x1939d8){var _0x5e5600=function(_0x38badb){while(--_0x38badb){_0x1e35de['push'](_0x1e35de['shift']());}};_0x5e5600(++_0x1939d8);}(_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 b8f4886..9c0217e 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 _0x63a5=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x3a86a7,_0x12ade0){var _0x19b1b6=function(_0x2af9d0){while(--_0x2af9d0){_0x3a86a7['push'](_0x3a86a7['shift']());}};_0x19b1b6(++_0x12ade0);}(_0x63a5,0x138));var _0x563a=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x63a5[_0x39e283];return _0x7de89f;};'use strict';var Sequelize=require(_0x563a('0x0'));module[_0x563a('0x1')]={'uniqueid':{'type':Sequelize[_0x563a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x563a('0x3')},'membername':{'type':Sequelize[_0x563a('0x4')],'allowNull':![],'comment':_0x563a('0x3')},'UserId':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x563a('0x4')],'allowNull':![],'unique':_0x563a('0x5'),'comment':_0x563a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x563a('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x563a('0x4')],'allowNull':![],'unique':_0x563a('0x5'),'comment':_0x563a('0x3')},'penalty':{'type':Sequelize[_0x563a('0x2')](0xb),'defaultValue':0x0,'comment':_0x563a('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x563a('0x3')}}; \ No newline at end of file +var _0x4ec5=['exports','Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize'];(function(_0x35e97,_0x20fac6){var _0xc0a3d4=function(_0x133886){while(--_0x133886){_0x35e97['push'](_0x35e97['shift']());}};_0xc0a3d4(++_0x20fac6);}(_0x4ec5,0x1eb));var _0x54ec=function(_0x188170,_0x42bae7){_0x188170=_0x188170-0x0;var _0x2d1136=_0x4ec5[_0x188170];return _0x2d1136;};'use strict';var Sequelize=require(_0x54ec('0x0'));module[_0x54ec('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x54ec('0x2')},'membername':{'type':Sequelize[_0x54ec('0x3')],'allowNull':![],'comment':_0x54ec('0x2')},'UserId':{'type':Sequelize[_0x54ec('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54ec('0x5'),'comment':_0x54ec('0x2')},'VoiceQueueId':{'type':Sequelize[_0x54ec('0x4')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x54ec('0x5'),'comment':_0x54ec('0x2')},'penalty':{'type':Sequelize[_0x54ec('0x4')](0xb),'defaultValue':0x0,'comment':_0x54ec('0x2')},'paused':{'type':Sequelize[_0x54ec('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 db1ceba..3d192fd 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 _0x5be3=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0x5be3,0xc0));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x35be('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x35be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x35be('0x2')};function emitEvent(_0x126599){return function(_0x38ae81,_0x4e5140,_0x4c9e87){UserVoiceQueueRtEvents['emit'](_0x126599+':'+_0x38ae81['id'],_0x38ae81);UserVoiceQueueRtEvents[_0x35be('0x3')](_0x126599,_0x38ae81);_0x4c9e87(null);};}for(var e in events){if(events[_0x35be('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x35be('0x5')](e,emitEvent(event));}}module[_0x35be('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbdbf=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','hasOwnProperty'];(function(_0x2aadce,_0xd4b8f4){var _0x2615e6=function(_0x63b4cf){while(--_0x63b4cf){_0x2aadce['push'](_0x2aadce['shift']());}};_0x2615e6(++_0xd4b8f4);}(_0xbdbf,0x102));var _0xfbdb=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xbdbf[_0x86b219];return _0x1f320c;};'use strict';var EventEmitter=require(_0xfbdb('0x0'));var UserVoiceQueueRt=require(_0xfbdb('0x1'))['db'][_0xfbdb('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xfbdb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfbdb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bcb6b){return function(_0x3ccf2c,_0x56eea5,_0x43fab2){UserVoiceQueueRtEvents['emit'](_0x4bcb6b+':'+_0x3ccf2c['id'],_0x3ccf2c);UserVoiceQueueRtEvents['emit'](_0x4bcb6b,_0x3ccf2c);_0x43fab2(null);};}for(var e in events){if(events[_0xfbdb('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xfbdb('0x6')](e,emitEvent(event));}}module[_0xfbdb('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 34f9b7e..c6662fb 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 _0xe6d0=['../../config/logger','moment','path','rimraf','../../config/environment','exports','define','user_has_voice_queues_rt','lodash','util'];(function(_0x5bc051,_0x459c1f){var _0x52a01d=function(_0x30d8b8){while(--_0x30d8b8){_0x5bc051['push'](_0x5bc051['shift']());}};_0x52a01d(++_0x459c1f);}(_0xe6d0,0x94));var _0x0e6d=function(_0x32f7f5,_0x363170){_0x32f7f5=_0x32f7f5-0x0;var _0x1c7f8=_0xe6d0[_0x32f7f5];return _0x1c7f8;};'use strict';var _=require(_0x0e6d('0x0'));var util=require(_0x0e6d('0x1'));var logger=require(_0x0e6d('0x2'))('api');var moment=require(_0x0e6d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e6d('0x4'));var rimraf=require(_0x0e6d('0x5'));var config=require(_0x0e6d('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x0e6d('0x7')]=function(_0x41a1b6,_0x587b4e){return _0x41a1b6[_0x0e6d('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x0e6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a2e=['UserVoiceQueueRt','../../config/logger','request-promise','path','../../config/environment','define'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x6a2e,0xf1));var _0xe6a2=function(_0x5d5552,_0x10a3ce){_0x5d5552=_0x5d5552-0x0;var _0x527431=_0x6a2e[_0x5d5552];return _0x527431;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe6a2('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe6a2('0x1'));var fs=require('fs');var path=require(_0xe6a2('0x2'));var rimraf=require('rimraf');var config=require(_0xe6a2('0x3'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x52e373,_0x263f9f){return _0x52e373[_0xe6a2('0x4')](_0xe6a2('0x5'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 82d12b1..24bd5e8 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 _0x365b=['findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','GetVoiceQueueRtPauses','UserVoiceQueueRt'];(function(_0x442759,_0x36d772){var _0x1489f3=function(_0xa00954){while(--_0xa00954){_0x442759['push'](_0x442759['shift']());}};_0x1489f3(++_0x36d772);}(_0x365b,0xac));var _0xb365=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x365b[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0xb365('0x0'));var util=require(_0xb365('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb365('0x2'));var db=require(_0xb365('0x3'))['db'];var utils=require(_0xb365('0x4'));var logger=require(_0xb365('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb365('0x6'));var client=jayson[_0xb365('0x7')][_0xb365('0x8')]({'port':0x232a});config[_0xb365('0x9')]=_[_0xb365('0xa')](config[_0xb365('0x9')],{'host':_0xb365('0xb'),'port':0x18eb});var socket=require(_0xb365('0xc'))(new Redis(config[_0xb365('0x9')]));require('./userVoiceQueueRt.socket')[_0xb365('0xd')](socket);function respondWithRpcPromise(_0x206002,_0x49c414,_0x45cf0e){return new BPromise(function(_0x17146b,_0x3e69a0){return client[_0xb365('0xe')](_0x206002,_0x45cf0e)[_0xb365('0xf')](function(_0x1773a1){logger[_0xb365('0x10')](_0xb365('0x11'),_0x49c414,_0xb365('0x12'));logger[_0xb365('0x13')](_0xb365('0x14'),_0x49c414,'request\x20sent',JSON[_0xb365('0x15')](_0x1773a1));if(_0x1773a1[_0xb365('0x16')]){if(_0x1773a1['error']['code']===0x1f4){logger['error'](_0xb365('0x11'),_0x49c414,_0x1773a1[_0xb365('0x16')]['message']);return _0x3e69a0(_0x1773a1[_0xb365('0x16')]['message']);}logger['error'](_0xb365('0x11'),_0x49c414,_0x1773a1['error'][_0xb365('0x17')]);return _0x17146b(_0x1773a1[_0xb365('0x16')][_0xb365('0x17')]);}else{logger['info'](_0xb365('0x11'),_0x49c414,_0xb365('0x12'));_0x17146b(_0x1773a1['result'][_0xb365('0x17')]);}})['catch'](function(_0x4c8255){logger['error'](_0xb365('0x11'),_0x49c414,_0x4c8255);_0x3e69a0(_0x4c8255);});});}exports[_0xb365('0x18')]=function(_0x331d61){var _0x4a62f1=this;return new Promise(function(_0x3612ce,_0x38efc6){return db[_0xb365('0x19')][_0xb365('0x1a')]({'raw':_0x331d61[_0xb365('0x1b')]?_0x331d61[_0xb365('0x1b')][_0xb365('0x1c')]===undefined?!![]:![]:!![],'where':_0x331d61[_0xb365('0x1b')]?_0x331d61[_0xb365('0x1b')][_0xb365('0x1d')]||null:null,'attributes':[[db[_0xb365('0x1e')]['fn']('COUNT',db[_0xb365('0x1e')]['fn']('IF',db['sequelize'][_0xb365('0x1f')](_0xb365('0x20')))),'outboundQueuePauses']]})[_0xb365('0xf')](function(_0x15a665){logger[_0xb365('0x10')](_0xb365('0x18'),_0x331d61);logger[_0xb365('0x13')](_0xb365('0x18'),_0x331d61,JSON['stringify'](_0x15a665));_0x3612ce(_0x15a665);})['catch'](function(_0x4b9190){logger[_0xb365('0x16')](_0xb365('0x18'),_0x4b9190[_0xb365('0x17')],_0x331d61);_0x38efc6(_0x4a62f1['error'](0x1f4,_0x4b9190[_0xb365('0x17')]));});});}; \ No newline at end of file +var _0xc294=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','register','request','then','debug','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','request\x20sent','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null'];(function(_0x320c39,_0x1ffc73){var _0x39d47b=function(_0x4791b3){while(--_0x4791b3){_0x320c39['push'](_0x320c39['shift']());}};_0x39d47b(++_0x1ffc73);}(_0xc294,0x88));var _0x4c29=function(_0x9c5512,_0x5651f1){_0x9c5512=_0x9c5512-0x0;var _0x5c4f5d=_0xc294[_0x9c5512];return _0x5c4f5d;};'use strict';var _=require(_0x4c29('0x0'));var util=require(_0x4c29('0x1'));var moment=require(_0x4c29('0x2'));var BPromise=require(_0x4c29('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c29('0x4'))['db'];var utils=require(_0x4c29('0x5'));var logger=require('../../config/logger')(_0x4c29('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c29('0x7'));var client=jayson[_0x4c29('0x8')]['http']({'port':0x232a});config[_0x4c29('0x9')]=_[_0x4c29('0xa')](config[_0x4c29('0x9')],{'host':_0x4c29('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0x4c29('0xc')](socket);function respondWithRpcPromise(_0x14e395,_0x32feec,_0x1811ff){return new BPromise(function(_0x55154f,_0x24ba62){return client[_0x4c29('0xd')](_0x14e395,_0x1811ff)[_0x4c29('0xe')](function(_0x2e555c){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x32feec,'request\x20sent');logger[_0x4c29('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x32feec,'request\x20sent',JSON[_0x4c29('0x10')](_0x2e555c));if(_0x2e555c[_0x4c29('0x11')]){if(_0x2e555c[_0x4c29('0x11')][_0x4c29('0x12')]===0x1f4){logger[_0x4c29('0x11')](_0x4c29('0x13'),_0x32feec,_0x2e555c['error'][_0x4c29('0x14')]);return _0x24ba62(_0x2e555c[_0x4c29('0x11')]['message']);}logger[_0x4c29('0x11')](_0x4c29('0x13'),_0x32feec,_0x2e555c[_0x4c29('0x11')][_0x4c29('0x14')]);return _0x55154f(_0x2e555c[_0x4c29('0x11')][_0x4c29('0x14')]);}else{logger[_0x4c29('0x15')](_0x4c29('0x13'),_0x32feec,_0x4c29('0x16'));_0x55154f(_0x2e555c[_0x4c29('0x17')][_0x4c29('0x14')]);}})[_0x4c29('0x18')](function(_0x4b5684){logger['error'](_0x4c29('0x13'),_0x32feec,_0x4b5684);_0x24ba62(_0x4b5684);});});}exports[_0x4c29('0x19')]=function(_0x308ced){var _0x510046=this;return new Promise(function(_0x130486,_0x3f8b2c){return db[_0x4c29('0x1a')][_0x4c29('0x1b')]({'raw':_0x308ced[_0x4c29('0x1c')]?_0x308ced['options'][_0x4c29('0x1d')]===undefined?!![]:![]:!![],'where':_0x308ced[_0x4c29('0x1c')]?_0x308ced['options']['where']||null:null,'attributes':[[db[_0x4c29('0x1e')]['fn'](_0x4c29('0x1f'),db[_0x4c29('0x1e')]['fn']('IF',db[_0x4c29('0x1e')][_0x4c29('0x20')](_0x4c29('0x21')))),'outboundQueuePauses']]})['then'](function(_0x25cc02){logger['info']('GetVoiceQueueRtPauses',_0x308ced);logger[_0x4c29('0xf')](_0x4c29('0x19'),_0x308ced,JSON[_0x4c29('0x10')](_0x25cc02));_0x130486(_0x25cc02);})[_0x4c29('0x18')](function(_0x546da4){logger[_0x4c29('0x11')]('GetVoiceQueueRtPauses',_0x546da4[_0x4c29('0x14')],_0x308ced);_0x3f8b2c(_0x510046[_0x4c29('0x11')](0x1f4,_0x546da4[_0x4c29('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 23f561f..04768f8 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 _0xbac8=['./userVoiceQueueRt.events','save','length','userVoiceQueueRt:'];(function(_0x476c6c,_0x434db8){var _0xbb94db=function(_0x4be12){while(--_0x4be12){_0x476c6c['push'](_0x476c6c['shift']());}};_0xbb94db(++_0x434db8);}(_0xbac8,0x140));var _0x8bac=function(_0x64672f,_0x34766c){_0x64672f=_0x64672f-0x0;var _0x36b412=_0xbac8[_0x64672f];return _0x36b412;};'use strict';var UserVoiceQueueRtEvents=require(_0x8bac('0x0'));var events=[_0x8bac('0x1'),'remove','update'];function createListener(_0x9c72e9,_0x1bc048){return function(_0x333437){_0x1bc048['emit'](_0x9c72e9,_0x333437);};}function removeListener(_0x3f0076,_0x10229f){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3f0076,_0x10229f);};}exports['register']=function(_0x28b1d1){for(var _0x36f5b4=0x0,_0x3e95bb=events[_0x8bac('0x2')];_0x36f5b4<_0x3e95bb;_0x36f5b4++){var _0x2e6c33=events[_0x36f5b4];var _0x3a315c=createListener(_0x8bac('0x3')+_0x2e6c33,_0x28b1d1);UserVoiceQueueRtEvents['on'](_0x2e6c33,_0x3a315c);}}; \ No newline at end of file +var _0x1b20=['removeListener','register','length','userVoiceQueueRt:','save','remove','emit'];(function(_0x48c9b3,_0x1fb678){var _0x4c782f=function(_0x4b3842){while(--_0x4b3842){_0x48c9b3['push'](_0x48c9b3['shift']());}};_0x4c782f(++_0x1fb678);}(_0x1b20,0x66));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x01b2('0x0'),_0x01b2('0x1'),'update'];function createListener(_0x54eccf,_0x27a406){return function(_0x18e3ff){_0x27a406[_0x01b2('0x2')](_0x54eccf,_0x18e3ff);};}function removeListener(_0x1150fc,_0x1cf757){return function(){UserVoiceQueueRtEvents[_0x01b2('0x3')](_0x1150fc,_0x1cf757);};}exports[_0x01b2('0x4')]=function(_0x28de4a){for(var _0x46e745=0x0,_0xa64ad1=events[_0x01b2('0x5')];_0x46e745<_0xa64ad1;_0x46e745++){var _0x323470=events[_0x46e745];var _0x508add=createListener(_0x01b2('0x6')+_0x323470,_0x28de4a);UserVoiceQueueRtEvents['on'](_0x323470,_0x508add);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index f3861c7..ed93b26 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4a96ea,_0x4609ec){var _0x3952f6=function(_0x3c8656){while(--_0x3c8656){_0x4a96ea['push'](_0x4a96ea['shift']());}};_0x3952f6(++_0x4609ec);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xcb91[_0x4bdf64];return _0x9a1a19;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x568228,_0x2c03e6){var _0x519d89=function(_0x102972){while(--_0x102972){_0x568228['push'](_0x568228['shift']());}};_0x519d89(++_0x2c03e6);}(_0xe706,0xa3));var _0x6e70=function(_0x503d48,_0x42e5a9){_0x503d48=_0x503d48-0x0;var _0x59743e=_0xe706[_0x503d48];return _0x59743e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index afa58af..af0eff6 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 _0xfc9a=['INTEGER','sequelize'];(function(_0x1e4635,_0x589a9b){var _0x4a6dae=function(_0x3288dd){while(--_0x3288dd){_0x1e4635['push'](_0x1e4635['shift']());}};_0x4a6dae(++_0x589a9b);}(_0xfc9a,0x147));var _0xafc9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfc9a[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xafc9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xafc9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x18fe=['exports','INTEGER','sequelize'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0x18fe,0x13a));var _0xe18f=function(_0x416817,_0x20607f){_0x416817=_0x416817-0x0;var _0x1beae4=_0x18fe[_0x416817];return _0x1beae4;};'use strict';var Sequelize=require(_0xe18f('0x0'));module[_0xe18f('0x1')]={'penalty':{'type':Sequelize[_0xe18f('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 69dadb0..05c0338 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 _0xab47=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x487a0b,_0x33c302){var _0x4cb1ba=function(_0x2a3615){while(--_0x2a3615){_0x487a0b['push'](_0x487a0b['shift']());}};_0x4cb1ba(++_0x33c302);}(_0xab47,0x1dd));var _0x7ab4=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0xab47[_0x3a3c17];return _0xd07f21;};'use strict';var _=require(_0x7ab4('0x0'));var util=require(_0x7ab4('0x1'));var logger=require(_0x7ab4('0x2'))(_0x7ab4('0x3'));var moment=require('moment');var BPromise=require(_0x7ab4('0x4'));var rp=require(_0x7ab4('0x5'));var fs=require('fs');var path=require(_0x7ab4('0x6'));var rimraf=require(_0x7ab4('0x7'));var config=require(_0x7ab4('0x8'));var attributes=require('./userWhatsappQueue.attributes');module[_0x7ab4('0x9')]=function(_0x57ba95,_0x38add1){return _0x57ba95[_0x7ab4('0xa')](_0x7ab4('0xb'),attributes,{'tableName':_0x7ab4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xded6=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues'];(function(_0x488d0f,_0x41bc6e){var _0x19ca8b=function(_0x560e7f){while(--_0x560e7f){_0x488d0f['push'](_0x488d0f['shift']());}};_0x19ca8b(++_0x41bc6e);}(_0xded6,0x78));var _0x6ded=function(_0x55d7c2,_0x4ce6fb){_0x55d7c2=_0x55d7c2-0x0;var _0x1755ef=_0xded6[_0x55d7c2];return _0x1755ef;};'use strict';var _=require(_0x6ded('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6ded('0x1'));var BPromise=require(_0x6ded('0x2'));var rp=require(_0x6ded('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ded('0x4'));var config=require(_0x6ded('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0x6ded('0x6')]=function(_0x25e739,_0x5e60d7){return _0x25e739[_0x6ded('0x7')](_0x6ded('0x8'),attributes,{'tableName':_0x6ded('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index afd5b09..c37ef38 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 _0x241b=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3368d4,_0x58dc82){var _0x505df3=function(_0x4697b6){while(--_0x4697b6){_0x3368d4['push'](_0x3368d4['shift']());}};_0x505df3(++_0x58dc82);}(_0x241b,0x14b));var _0xb241=function(_0x27acb9,_0xcb1caa){_0x27acb9=_0x27acb9-0x0;var _0x58e43b=_0x241b[_0x27acb9];return _0x58e43b;};'use strict';var _=require(_0xb241('0x0'));var util=require('util');var moment=require(_0xb241('0x1'));var BPromise=require(_0xb241('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb241('0x3'));var db=require(_0xb241('0x4'))['db'];var utils=require(_0xb241('0x5'));var logger=require(_0xb241('0x6'))(_0xb241('0x7'));var config=require(_0xb241('0x8'));var jayson=require(_0xb241('0x9'));var client=jayson['client'][_0xb241('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x267c98,_0x2b0c90,_0x2fdb19){return new BPromise(function(_0x396764,_0x10c137){return client[_0xb241('0xb')](_0x267c98,_0x2fdb19)[_0xb241('0xc')](function(_0x18238c){logger[_0xb241('0xd')](_0xb241('0xe'),_0x2b0c90,_0xb241('0xf'));logger[_0xb241('0x10')](_0xb241('0x11'),_0x2b0c90,'request\x20sent',JSON['stringify'](_0x18238c));if(_0x18238c[_0xb241('0x12')]){if(_0x18238c[_0xb241('0x12')]['code']===0x1f4){logger[_0xb241('0x12')](_0xb241('0xe'),_0x2b0c90,_0x18238c[_0xb241('0x12')][_0xb241('0x13')]);return _0x10c137(_0x18238c['error'][_0xb241('0x13')]);}logger[_0xb241('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2b0c90,_0x18238c['error'][_0xb241('0x13')]);return _0x396764(_0x18238c[_0xb241('0x12')][_0xb241('0x13')]);}else{logger[_0xb241('0xd')](_0xb241('0xe'),_0x2b0c90,'request\x20sent');_0x396764(_0x18238c[_0xb241('0x14')]['message']);}})[_0xb241('0x15')](function(_0x5a539c){logger[_0xb241('0x12')](_0xb241('0xe'),_0x2b0c90,_0x5a539c);_0x10c137(_0x5a539c);});});} \ No newline at end of file +var _0xb4a9=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','bluebird','ioredis','../../mysqldb'];(function(_0x1f6bd8,_0x487c65){var _0x240c82=function(_0x2a9edc){while(--_0x2a9edc){_0x1f6bd8['push'](_0x1f6bd8['shift']());}};_0x240c82(++_0x487c65);}(_0xb4a9,0x164));var _0x9b4a=function(_0x4ea9f5,_0x44a57b){_0x4ea9f5=_0x4ea9f5-0x0;var _0x9b6ed2=_0xb4a9[_0x4ea9f5];return _0x9b6ed2;};'use strict';var _=require(_0x9b4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9b4a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b4a('0x2'));var db=require(_0x9b4a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b4a('0x4'))(_0x9b4a('0x5'));var config=require(_0x9b4a('0x6'));var jayson=require(_0x9b4a('0x7'));var client=jayson[_0x9b4a('0x8')][_0x9b4a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e6fe2,_0x179952,_0x434c98){return new BPromise(function(_0x51a932,_0x38d991){return client['request'](_0x5e6fe2,_0x434c98)[_0x9b4a('0xa')](function(_0x54c7d6){logger[_0x9b4a('0xb')](_0x9b4a('0xc'),_0x179952,'request\x20sent');logger[_0x9b4a('0xd')](_0x9b4a('0xe'),_0x179952,'request\x20sent',JSON['stringify'](_0x54c7d6));if(_0x54c7d6[_0x9b4a('0xf')]){if(_0x54c7d6['error']['code']===0x1f4){logger[_0x9b4a('0xf')](_0x9b4a('0xc'),_0x179952,_0x54c7d6[_0x9b4a('0xf')][_0x9b4a('0x10')]);return _0x38d991(_0x54c7d6[_0x9b4a('0xf')][_0x9b4a('0x10')]);}logger[_0x9b4a('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x179952,_0x54c7d6['error'][_0x9b4a('0x10')]);return _0x51a932(_0x54c7d6[_0x9b4a('0xf')][_0x9b4a('0x10')]);}else{logger['info'](_0x9b4a('0xc'),_0x179952,_0x9b4a('0x11'));_0x51a932(_0x54c7d6[_0x9b4a('0x12')][_0x9b4a('0x10')]);}})[_0x9b4a('0x13')](function(_0x3f61e1){logger['error'](_0x9b4a('0xc'),_0x179952,_0x3f61e1);_0x38d991(_0x3f61e1);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4b65ca8..27892fa 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 _0xfd7b=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x174a59,_0x349d5f){var _0xfa83fc=function(_0x39d112){while(--_0x39d112){_0x174a59['push'](_0x174a59['shift']());}};_0xfa83fc(++_0x349d5f);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xfd7b[_0x1b3564];return _0x504069;};'use strict';var multer=require('multer');var util=require(_0xbfd7('0x0'));var path=require(_0xbfd7('0x1'));var timeout=require(_0xbfd7('0x2'));var express=require(_0xbfd7('0x3'));var router=express[_0xbfd7('0x4')]();var fs_extra=require(_0xbfd7('0x5'));var auth=require(_0xbfd7('0x6'));var interaction=require(_0xbfd7('0x7'));var config=require(_0xbfd7('0x8'));var controller=require(_0xbfd7('0x9'));router[_0xbfd7('0xa')]('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xc')]);router['get'](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0xe')]);router['post']('/',auth[_0xbfd7('0xb')](),controller[_0xbfd7('0xf')]);router[_0xbfd7('0x10')](_0xbfd7('0xd'),auth['isAuthenticated'](),controller[_0xbfd7('0x11')]);router[_0xbfd7('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xbfd7('0x13')]);module[_0xbfd7('0x14')]=router; \ No newline at end of file +var _0xc818=['update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc818,0x1e3));var _0x8c81=function(_0x5a89b9,_0x29d3fe){_0x5a89b9=_0x5a89b9-0x0;var _0x5a4bb9=_0xc818[_0x5a89b9];return _0x5a4bb9;};'use strict';var multer=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var timeout=require(_0x8c81('0x3'));var express=require('express');var router=express[_0x8c81('0x4')]();var fs_extra=require(_0x8c81('0x5'));var auth=require(_0x8c81('0x6'));var interaction=require(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var controller=require(_0x8c81('0x9'));router[_0x8c81('0xa')]('/',auth['isAuthenticated'](),controller[_0x8c81('0xb')]);router[_0x8c81('0xa')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['show']);router[_0x8c81('0xe')]('/',auth[_0x8c81('0xd')](),controller[_0x8c81('0xf')]);router[_0x8c81('0x10')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x11')]);router['delete'](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x12')]);module[_0x8c81('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 29ec09c..f624d33 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 _0x9ea2=['name','sequelize'];(function(_0x16622d,_0x52bfcc){var _0x57c890=function(_0x64b2c5){while(--_0x64b2c5){_0x16622d['push'](_0x16622d['shift']());}};_0x57c890(++_0x52bfcc);}(_0x9ea2,0x147));var _0x29ea=function(_0x36a715,_0x2b5397){_0x36a715=_0x36a715-0x0;var _0x148fb0=_0x9ea2[_0x36a715];return _0x148fb0;};'use strict';var Sequelize=require(_0x29ea('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x29ea('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3584=['STRING','name'];(function(_0x35640e,_0x174d83){var _0x5632cf=function(_0x57b0aa){while(--_0x57b0aa){_0x35640e['push'](_0x35640e['shift']());}};_0x5632cf(++_0x174d83);}(_0x3584,0xba));var _0x4358=function(_0x39d66a,_0x2fb73c){_0x39d66a=_0x39d66a-0x0;var _0xdc677b=_0x3584[_0x39d66a];return _0xdc677b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4358('0x0')],'unique':_0x4358('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4358('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 18c599e..a614b53 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 _0xd92e=['stack','name','send','Variable','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','catch','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','update','params','zip-dir','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save','destroy','then','get','Variables','UserProfileResource','error'];(function(_0x493643,_0x2e1a51){var _0x2ba2fe=function(_0x1ff1ef){while(--_0x1ff1ef){_0x493643['push'](_0x493643['shift']());}};_0x2ba2fe(++_0x2e1a51);}(_0xd92e,0xd9));var _0xed92=function(_0x58c8b6,_0x15c81e){_0x58c8b6=_0x58c8b6-0x0;var _0x26b93e=_0xd92e[_0x58c8b6];return _0x26b93e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed92('0x0'));var jsonpatch=require(_0xed92('0x1'));var rp=require(_0xed92('0x2'));var moment=require(_0xed92('0x3'));var BPromise=require(_0xed92('0x4'));var Mustache=require(_0xed92('0x5'));var util=require(_0xed92('0x6'));var path=require(_0xed92('0x7'));var sox=require(_0xed92('0x8'));var csv=require('to-csv');var ejs=require(_0xed92('0x9'));var fs=require('fs');var fs_extra=require(_0xed92('0xa'));var _=require(_0xed92('0xb'));var squel=require(_0xed92('0xc'));var crypto=require(_0xed92('0xd'));var jsforce=require(_0xed92('0xe'));var deskjs=require(_0xed92('0xf'));var toCsv=require(_0xed92('0x10'));var querystring=require(_0xed92('0x11'));var Papa=require(_0xed92('0x12'));var Redis=require('ioredis');var authService=require(_0xed92('0x13'));var qs=require(_0xed92('0x14'));var as=require(_0xed92('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed92('0x16'))(_0xed92('0x17'));var utils=require(_0xed92('0x18'));var config=require(_0xed92('0x19'));var licenseUtil=require(_0xed92('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7eccee,_0x4bb3c3){_0x4bb3c3=_0x4bb3c3||0xcc;return function(_0x290d90){if(_0x290d90){return _0x7eccee[_0xed92('0x1b')](_0x4bb3c3);}return _0x7eccee[_0xed92('0x1c')](_0x4bb3c3)[_0xed92('0x1d')]();};}function respondWithResult(_0x54a811,_0x2a56e2){_0x2a56e2=_0x2a56e2||0xc8;return function(_0x5384e8){if(_0x5384e8){return _0x54a811[_0xed92('0x1c')](_0x2a56e2)['json'](_0x5384e8);}};}function respondWithFilteredResult(_0xad53b2,_0x24337d){return function(_0x1a881c){if(_0x1a881c){var _0x5d3418=typeof _0x24337d['offset']===_0xed92('0x1e')&&typeof _0x24337d[_0xed92('0x1f')]===_0xed92('0x1e');var _0x41e720=_0x1a881c[_0xed92('0x20')];var _0x12188a=_0x5d3418?0x0:_0x24337d[_0xed92('0x21')];var _0x101fb8=_0x5d3418?_0x1a881c[_0xed92('0x20')]:_0x24337d[_0xed92('0x21')]+_0x24337d['limit'];var _0x55ee3a;if(_0x101fb8>=_0x41e720){_0x101fb8=_0x41e720;_0x55ee3a=0xc8;}else{_0x55ee3a=0xce;}_0xad53b2[_0xed92('0x1c')](_0x55ee3a);return _0xad53b2[_0xed92('0x22')]('Content-Range',_0x12188a+'-'+_0x101fb8+'/'+_0x41e720)[_0xed92('0x23')](_0x1a881c);}return null;};}function patchUpdates(_0x310f6e){return function(_0x5c945c){try{jsonpatch['apply'](_0x5c945c,_0x310f6e,!![]);}catch(_0x54576e){return BPromise[_0xed92('0x24')](_0x54576e);}return _0x5c945c[_0xed92('0x25')]();};}function saveUpdates(_0x3118b4,_0x2fbbcf){return function(_0x1a5a22){if(_0x1a5a22){return _0x1a5a22['update'](_0x3118b4)['then'](function(_0x19d30f){return _0x19d30f;});}return null;};}function removeEntity(_0x48ffc5,_0x332ce2){return function(_0x145739){if(_0x145739){return _0x145739[_0xed92('0x26')]()[_0xed92('0x27')](function(){var _0x3b7361=_0x145739[_0xed92('0x28')]({'plain':!![]});var _0x2882e5=_0xed92('0x29');return db[_0xed92('0x2a')][_0xed92('0x26')]({'where':{'type':_0x2882e5,'resourceId':_0x3b7361['id']}})[_0xed92('0x27')](function(){return _0x145739;});})[_0xed92('0x27')](function(){_0x48ffc5['status'](0xcc)[_0xed92('0x1d')]();});}};}function handleEntityNotFound(_0x375279,_0x2c9a65){return function(_0x3eb484){if(!_0x3eb484){_0x375279[_0xed92('0x1b')](0x194);}return _0x3eb484;};}function handleError(_0x328d91,_0x3fdf89){_0x3fdf89=_0x3fdf89||0x1f4;return function(_0x4af06f){logger[_0xed92('0x2b')](_0x4af06f[_0xed92('0x2c')]);if(_0x4af06f[_0xed92('0x2d')]){delete _0x4af06f[_0xed92('0x2d')];}_0x328d91[_0xed92('0x1c')](_0x3fdf89)[_0xed92('0x2e')](_0x4af06f);};}exports['index']=function(_0x2151e1,_0xe7cb5){var _0x18a909={},_0x426f90={},_0x4b75ea={'count':0x0,'rows':[]};var _0x22f2b2=_['map'](db[_0xed92('0x2f')][_0xed92('0x30')],function(_0x3bfd43){return{'name':_0x3bfd43['fieldName'],'type':_0x3bfd43[_0xed92('0x31')][_0xed92('0x32')]};});_0x426f90[_0xed92('0x33')]=_[_0xed92('0x34')](_0x22f2b2,_0xed92('0x2d'));_0x426f90['query']=_[_0xed92('0x35')](_0x2151e1[_0xed92('0x36')]);_0x426f90[_0xed92('0x37')]=_[_0xed92('0x38')](_0x426f90[_0xed92('0x33')],_0x426f90[_0xed92('0x36')]);_0x18a909[_0xed92('0x39')]=_[_0xed92('0x38')](_0x426f90['model'],qs[_0xed92('0x3a')](_0x2151e1[_0xed92('0x36')]['fields']));_0x18a909[_0xed92('0x39')]=_0x18a909[_0xed92('0x39')][_0xed92('0x3b')]?_0x18a909[_0xed92('0x39')]:_0x426f90[_0xed92('0x33')];if(!_0x2151e1[_0xed92('0x36')]['hasOwnProperty'](_0xed92('0x3c'))){_0x18a909['limit']=qs['limit'](_0x2151e1[_0xed92('0x36')]['limit']);_0x18a909[_0xed92('0x21')]=qs[_0xed92('0x21')](_0x2151e1['query']['offset']);}_0x18a909[_0xed92('0x3d')]=qs[_0xed92('0x3e')](_0x2151e1[_0xed92('0x36')][_0xed92('0x3e')]);_0x18a909[_0xed92('0x3f')]=qs['filters'](_[_0xed92('0x40')](_0x2151e1['query'],_0x426f90['filters']),_0x22f2b2);if(_0x2151e1[_0xed92('0x36')][_0xed92('0x41')]){_0x18a909[_0xed92('0x3f')]=_['merge'](_0x18a909[_0xed92('0x3f')],{'$or':_[_0xed92('0x34')](_0x22f2b2,function(_0x5d332b){if(_0x5d332b[_0xed92('0x31')]!==_0xed92('0x42')){var _0x5b5d24={};_0x5b5d24[_0x5d332b['name']]={'$like':'%'+_0x2151e1['query']['filter']+'%'};return _0x5b5d24;}})});}_0x18a909=_[_0xed92('0x43')]({},_0x18a909,_0x2151e1[_0xed92('0x44')]);var _0x1a5725={'where':_0x18a909[_0xed92('0x3f')]};return db[_0xed92('0x2f')][_0xed92('0x20')](_0x1a5725)['then'](function(_0x2493bc){_0x4b75ea[_0xed92('0x20')]=_0x2493bc;if(_0x2151e1[_0xed92('0x36')][_0xed92('0x45')]){_0x18a909[_0xed92('0x46')]=[{'all':!![]}];}return db[_0xed92('0x2f')][_0xed92('0x47')](_0x18a909);})[_0xed92('0x27')](function(_0x2690a){_0x4b75ea[_0xed92('0x48')]=_0x2690a;return _0x4b75ea;})[_0xed92('0x27')](respondWithFilteredResult(_0xe7cb5,_0x18a909))['catch'](handleError(_0xe7cb5,null));};exports[_0xed92('0x49')]=function(_0x4a1d3a,_0x19869e){var _0x12266e={'raw':!![],'where':{'id':_0x4a1d3a['params']['id']}},_0x4cca07={};_0x4cca07[_0xed92('0x33')]=_['keys'](db[_0xed92('0x2f')][_0xed92('0x30')]);_0x4cca07['query']=_[_0xed92('0x35')](_0x4a1d3a[_0xed92('0x36')]);_0x4cca07[_0xed92('0x37')]=_[_0xed92('0x38')](_0x4cca07['model'],_0x4cca07['query']);_0x12266e[_0xed92('0x39')]=_[_0xed92('0x38')](_0x4cca07[_0xed92('0x33')],qs[_0xed92('0x3a')](_0x4a1d3a[_0xed92('0x36')][_0xed92('0x3a')]));_0x12266e[_0xed92('0x39')]=_0x12266e[_0xed92('0x39')][_0xed92('0x3b')]?_0x12266e[_0xed92('0x39')]:_0x4cca07[_0xed92('0x33')];if(_0x4a1d3a[_0xed92('0x36')]['includeAll']){_0x12266e['include']=[{'all':!![]}];}_0x12266e=_['merge']({},_0x12266e,_0x4a1d3a[_0xed92('0x44')]);return db[_0xed92('0x2f')]['find'](_0x12266e)[_0xed92('0x27')](handleEntityNotFound(_0x19869e,null))[_0xed92('0x27')](respondWithResult(_0x19869e,null))[_0xed92('0x4a')](handleError(_0x19869e,null));};exports[_0xed92('0x4b')]=function(_0x1e4aa5,_0x416870){return db[_0xed92('0x2f')]['create'](_0x1e4aa5[_0xed92('0x4c')],{})[_0xed92('0x27')](function(_0x213803){var _0x3b5af0=_0x1e4aa5[_0xed92('0x4d')][_0xed92('0x28')]({'plain':!![]});if(!_0x3b5af0)throw new Error(_0xed92('0x4e'));if(_0x3b5af0[_0xed92('0x4f')]===_0xed92('0x4d')){var _0x58141b=_0x213803[_0xed92('0x28')]({'plain':!![]});var _0x577965=_0xed92('0x29');return db[_0xed92('0x50')][_0xed92('0x51')]({'where':{'name':_0x577965,'userProfileId':_0x3b5af0[_0xed92('0x52')]},'raw':!![]})['then'](function(_0x3c442d){if(_0x3c442d&&_0x3c442d[_0xed92('0x53')]===0x0){return db[_0xed92('0x2a')][_0xed92('0x4b')]({'name':_0x58141b[_0xed92('0x2d')],'resourceId':_0x58141b['id'],'type':_0x3c442d['name'],'sectionId':_0x3c442d['id']},{})['then'](function(){return _0x213803;});}else{return _0x213803;}})[_0xed92('0x4a')](function(_0x18aedb){logger[_0xed92('0x2b')](_0xed92('0x54'),_0x18aedb);throw _0x18aedb;});}return _0x213803;})[_0xed92('0x27')](respondWithResult(_0x416870,0xc9))[_0xed92('0x4a')](handleError(_0x416870,null));};exports[_0xed92('0x55')]=function(_0x9cdc6e,_0x1cf10a){if(_0x9cdc6e['body']['id']){delete _0x9cdc6e[_0xed92('0x4c')]['id'];}return db[_0xed92('0x2f')]['find']({'where':{'id':_0x9cdc6e[_0xed92('0x56')]['id']}})[_0xed92('0x27')](handleEntityNotFound(_0x1cf10a,null))[_0xed92('0x27')](saveUpdates(_0x9cdc6e['body'],null))[_0xed92('0x27')](respondWithResult(_0x1cf10a,null))[_0xed92('0x4a')](handleError(_0x1cf10a,null));};exports['destroy']=function(_0x5ea926,_0x448378){return db['Variable'][_0xed92('0x51')]({'where':{'id':_0x5ea926['params']['id']}})['then'](handleEntityNotFound(_0x448378,null))[_0xed92('0x27')](removeEntity(_0x448378,null))[_0xed92('0x4a')](handleError(_0x448378,null));}; \ No newline at end of file +var _0x0c70=['apply','save','then','destroy','end','error','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Variables','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0c70,0x132));var _0x00c7=function(_0x528166,_0x31dd49){_0x528166=_0x528166-0x0;var _0x502b7f=_0x0c70[_0x528166];return _0x502b7f;};'use strict';var emlformat=require(_0x00c7('0x0'));var rimraf=require(_0x00c7('0x1'));var zipdir=require(_0x00c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x00c7('0x3'));var moment=require(_0x00c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x00c7('0x5'));var path=require('path');var sox=require(_0x00c7('0x6'));var csv=require(_0x00c7('0x7'));var ejs=require(_0x00c7('0x8'));var fs=require('fs');var fs_extra=require(_0x00c7('0x9'));var _=require(_0x00c7('0xa'));var squel=require(_0x00c7('0xb'));var crypto=require(_0x00c7('0xc'));var jsforce=require(_0x00c7('0xd'));var deskjs=require(_0x00c7('0xe'));var toCsv=require(_0x00c7('0x7'));var querystring=require(_0x00c7('0xf'));var Papa=require('papaparse');var Redis=require(_0x00c7('0x10'));var authService=require(_0x00c7('0x11'));var qs=require(_0x00c7('0x12'));var as=require(_0x00c7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x00c7('0x14'))('api');var utils=require(_0x00c7('0x15'));var config=require(_0x00c7('0x16'));var licenseUtil=require(_0x00c7('0x17'));var db=require(_0x00c7('0x18'))['db'];function respondWithStatusCode(_0x34e213,_0x333a19){_0x333a19=_0x333a19||0xcc;return function(_0x5278b4){if(_0x5278b4){return _0x34e213[_0x00c7('0x19')](_0x333a19);}return _0x34e213[_0x00c7('0x1a')](_0x333a19)['end']();};}function respondWithResult(_0x2b041c,_0x35e960){_0x35e960=_0x35e960||0xc8;return function(_0x5ada4c){if(_0x5ada4c){return _0x2b041c[_0x00c7('0x1a')](_0x35e960)[_0x00c7('0x1b')](_0x5ada4c);}};}function respondWithFilteredResult(_0x20551d,_0x828cca){return function(_0x4e8d6e){if(_0x4e8d6e){var _0x5aa561=typeof _0x828cca[_0x00c7('0x1c')]===_0x00c7('0x1d')&&typeof _0x828cca['limit']===_0x00c7('0x1d');var _0x51a4a7=_0x4e8d6e[_0x00c7('0x1e')];var _0x4aa076=_0x5aa561?0x0:_0x828cca[_0x00c7('0x1c')];var _0x1d3ed0=_0x5aa561?_0x4e8d6e[_0x00c7('0x1e')]:_0x828cca[_0x00c7('0x1c')]+_0x828cca[_0x00c7('0x1f')];var _0x124f2b;if(_0x1d3ed0>=_0x51a4a7){_0x1d3ed0=_0x51a4a7;_0x124f2b=0xc8;}else{_0x124f2b=0xce;}_0x20551d[_0x00c7('0x1a')](_0x124f2b);return _0x20551d[_0x00c7('0x20')](_0x00c7('0x21'),_0x4aa076+'-'+_0x1d3ed0+'/'+_0x51a4a7)['json'](_0x4e8d6e);}return null;};}function patchUpdates(_0x15b7b9){return function(_0x2feaa3){try{jsonpatch[_0x00c7('0x22')](_0x2feaa3,_0x15b7b9,!![]);}catch(_0x588623){return BPromise['reject'](_0x588623);}return _0x2feaa3[_0x00c7('0x23')]();};}function saveUpdates(_0x3a2766,_0x5f320c){return function(_0x1181e8){if(_0x1181e8){return _0x1181e8['update'](_0x3a2766)[_0x00c7('0x24')](function(_0x313e77){return _0x313e77;});}return null;};}function removeEntity(_0x3364c0,_0x6359c1){return function(_0x5b44ec){if(_0x5b44ec){return _0x5b44ec['destroy']()[_0x00c7('0x24')](function(){var _0x9abf86=_0x5b44ec['get']({'plain':!![]});var _0x5e0ec9='Variables';return db['UserProfileResource'][_0x00c7('0x25')]({'where':{'type':_0x5e0ec9,'resourceId':_0x9abf86['id']}})[_0x00c7('0x24')](function(){return _0x5b44ec;});})['then'](function(){_0x3364c0['status'](0xcc)[_0x00c7('0x26')]();});}};}function handleEntityNotFound(_0x59bf71,_0x5821e6){return function(_0x106e6d){if(!_0x106e6d){_0x59bf71[_0x00c7('0x19')](0x194);}return _0x106e6d;};}function handleError(_0x2c05eb,_0x4df5d1){_0x4df5d1=_0x4df5d1||0x1f4;return function(_0x1b59ba){logger[_0x00c7('0x27')](_0x1b59ba[_0x00c7('0x28')]);if(_0x1b59ba[_0x00c7('0x29')]){delete _0x1b59ba[_0x00c7('0x29')];}_0x2c05eb[_0x00c7('0x1a')](_0x4df5d1)[_0x00c7('0x2a')](_0x1b59ba);};}exports[_0x00c7('0x2b')]=function(_0x26c99b,_0x5e9229){var _0x21a8e1={},_0x138638={},_0x5ba045={'count':0x0,'rows':[]};var _0x3d1136=_[_0x00c7('0x2c')](db[_0x00c7('0x2d')]['rawAttributes'],function(_0x2925d4){return{'name':_0x2925d4[_0x00c7('0x2e')],'type':_0x2925d4[_0x00c7('0x2f')][_0x00c7('0x30')]};});_0x138638[_0x00c7('0x31')]=_['map'](_0x3d1136,_0x00c7('0x29'));_0x138638[_0x00c7('0x32')]=_[_0x00c7('0x33')](_0x26c99b[_0x00c7('0x32')]);_0x138638[_0x00c7('0x34')]=_[_0x00c7('0x35')](_0x138638[_0x00c7('0x31')],_0x138638[_0x00c7('0x32')]);_0x21a8e1[_0x00c7('0x36')]=_[_0x00c7('0x35')](_0x138638[_0x00c7('0x31')],qs['fields'](_0x26c99b[_0x00c7('0x32')][_0x00c7('0x37')]));_0x21a8e1[_0x00c7('0x36')]=_0x21a8e1['attributes'][_0x00c7('0x38')]?_0x21a8e1[_0x00c7('0x36')]:_0x138638[_0x00c7('0x31')];if(!_0x26c99b[_0x00c7('0x32')][_0x00c7('0x39')]('nolimit')){_0x21a8e1['limit']=qs[_0x00c7('0x1f')](_0x26c99b[_0x00c7('0x32')][_0x00c7('0x1f')]);_0x21a8e1[_0x00c7('0x1c')]=qs[_0x00c7('0x1c')](_0x26c99b['query']['offset']);}_0x21a8e1[_0x00c7('0x3a')]=qs['sort'](_0x26c99b[_0x00c7('0x32')]['sort']);_0x21a8e1[_0x00c7('0x3b')]=qs[_0x00c7('0x34')](_['pick'](_0x26c99b['query'],_0x138638[_0x00c7('0x34')]),_0x3d1136);if(_0x26c99b['query'][_0x00c7('0x3c')]){_0x21a8e1['where']=_[_0x00c7('0x3d')](_0x21a8e1[_0x00c7('0x3b')],{'$or':_[_0x00c7('0x2c')](_0x3d1136,function(_0x3b7d0b){if(_0x3b7d0b[_0x00c7('0x2f')]!==_0x00c7('0x3e')){var _0x37f313={};_0x37f313[_0x3b7d0b[_0x00c7('0x29')]]={'$like':'%'+_0x26c99b[_0x00c7('0x32')]['filter']+'%'};return _0x37f313;}})});}_0x21a8e1=_[_0x00c7('0x3d')]({},_0x21a8e1,_0x26c99b[_0x00c7('0x3f')]);var _0x35ae36={'where':_0x21a8e1[_0x00c7('0x3b')]};return db[_0x00c7('0x2d')][_0x00c7('0x1e')](_0x35ae36)[_0x00c7('0x24')](function(_0x1bb1f8){_0x5ba045[_0x00c7('0x1e')]=_0x1bb1f8;if(_0x26c99b['query'][_0x00c7('0x40')]){_0x21a8e1[_0x00c7('0x41')]=[{'all':!![]}];}return db[_0x00c7('0x2d')][_0x00c7('0x42')](_0x21a8e1);})[_0x00c7('0x24')](function(_0x27b377){_0x5ba045[_0x00c7('0x43')]=_0x27b377;return _0x5ba045;})[_0x00c7('0x24')](respondWithFilteredResult(_0x5e9229,_0x21a8e1))['catch'](handleError(_0x5e9229,null));};exports[_0x00c7('0x44')]=function(_0x4f2882,_0x34605a){var _0x42486a={'raw':!![],'where':{'id':_0x4f2882['params']['id']}},_0xb49e71={};_0xb49e71[_0x00c7('0x31')]=_['keys'](db[_0x00c7('0x2d')][_0x00c7('0x45')]);_0xb49e71[_0x00c7('0x32')]=_[_0x00c7('0x33')](_0x4f2882['query']);_0xb49e71[_0x00c7('0x34')]=_[_0x00c7('0x35')](_0xb49e71[_0x00c7('0x31')],_0xb49e71[_0x00c7('0x32')]);_0x42486a[_0x00c7('0x36')]=_[_0x00c7('0x35')](_0xb49e71[_0x00c7('0x31')],qs[_0x00c7('0x37')](_0x4f2882[_0x00c7('0x32')]['fields']));_0x42486a['attributes']=_0x42486a[_0x00c7('0x36')]['length']?_0x42486a[_0x00c7('0x36')]:_0xb49e71[_0x00c7('0x31')];if(_0x4f2882[_0x00c7('0x32')][_0x00c7('0x40')]){_0x42486a[_0x00c7('0x41')]=[{'all':!![]}];}_0x42486a=_[_0x00c7('0x3d')]({},_0x42486a,_0x4f2882[_0x00c7('0x3f')]);return db['Variable'][_0x00c7('0x46')](_0x42486a)[_0x00c7('0x24')](handleEntityNotFound(_0x34605a,null))[_0x00c7('0x24')](respondWithResult(_0x34605a,null))[_0x00c7('0x47')](handleError(_0x34605a,null));};exports[_0x00c7('0x48')]=function(_0xed720f,_0x24bb4a){return db[_0x00c7('0x2d')][_0x00c7('0x48')](_0xed720f['body'],{})[_0x00c7('0x24')](function(_0x3833dc){var _0x4522fe=_0xed720f[_0x00c7('0x49')]['get']({'plain':!![]});if(!_0x4522fe)throw new Error(_0x00c7('0x4a'));if(_0x4522fe[_0x00c7('0x4b')]==='user'){var _0x4838b2=_0x3833dc[_0x00c7('0x4c')]({'plain':!![]});var _0x24d244=_0x00c7('0x4d');return db[_0x00c7('0x4e')][_0x00c7('0x46')]({'where':{'name':_0x24d244,'userProfileId':_0x4522fe[_0x00c7('0x4f')]},'raw':!![]})[_0x00c7('0x24')](function(_0x41e4ac){if(_0x41e4ac&&_0x41e4ac['autoAssociation']===0x0){return db[_0x00c7('0x50')][_0x00c7('0x48')]({'name':_0x4838b2['name'],'resourceId':_0x4838b2['id'],'type':_0x41e4ac['name'],'sectionId':_0x41e4ac['id']},{})[_0x00c7('0x24')](function(){return _0x3833dc;});}else{return _0x3833dc;}})[_0x00c7('0x47')](function(_0x4843da){logger[_0x00c7('0x27')](_0x00c7('0x51'),_0x4843da);throw _0x4843da;});}return _0x3833dc;})[_0x00c7('0x24')](respondWithResult(_0x24bb4a,0xc9))['catch'](handleError(_0x24bb4a,null));};exports[_0x00c7('0x52')]=function(_0x193dac,_0x5da85c){if(_0x193dac['body']['id']){delete _0x193dac['body']['id'];}return db['Variable'][_0x00c7('0x46')]({'where':{'id':_0x193dac['params']['id']}})['then'](handleEntityNotFound(_0x5da85c,null))[_0x00c7('0x24')](saveUpdates(_0x193dac[_0x00c7('0x53')],null))[_0x00c7('0x24')](respondWithResult(_0x5da85c,null))['catch'](handleError(_0x5da85c,null));};exports[_0x00c7('0x25')]=function(_0x220ae0,_0x2c129d){return db['Variable'][_0x00c7('0x46')]({'where':{'id':_0x220ae0[_0x00c7('0x54')]['id']}})[_0x00c7('0x24')](handleEntityNotFound(_0x2c129d,null))[_0x00c7('0x24')](removeEntity(_0x2c129d,null))[_0x00c7('0x47')](handleError(_0x2c129d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index dd77bea..4d7b386 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 _0x1a66=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','Variable','util'];(function(_0x3e6099,_0x2e989f){var _0x1f8750=function(_0x479ef0){while(--_0x479ef0){_0x3e6099['push'](_0x3e6099['shift']());}};_0x1f8750(++_0x2e989f);}(_0x1a66,0x103));var _0x61a6=function(_0x3e95c1,_0x7838ea){_0x3e95c1=_0x3e95c1-0x0;var _0x5bcb50=_0x1a66[_0x3e95c1];return _0x5bcb50;};'use strict';var _=require('lodash');var util=require(_0x61a6('0x0'));var logger=require(_0x61a6('0x1'))(_0x61a6('0x2'));var moment=require(_0x61a6('0x3'));var BPromise=require(_0x61a6('0x4'));var rp=require(_0x61a6('0x5'));var fs=require('fs');var path=require(_0x61a6('0x6'));var rimraf=require('rimraf');var config=require(_0x61a6('0x7'));var attributes=require('./variable.attributes');module[_0x61a6('0x8')]=function(_0x3453a9,_0x20cc8c){return _0x3453a9['define'](_0x61a6('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc265=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x103f3b,_0x3c865c){var _0x50218c=function(_0x1138d0){while(--_0x1138d0){_0x103f3b['push'](_0x103f3b['shift']());}};_0x50218c(++_0x3c865c);}(_0xc265,0x1d4));var _0x5c26=function(_0x3180a4,_0x5a4219){_0x3180a4=_0x3180a4-0x0;var _0x4feac4=_0xc265[_0x3180a4];return _0x4feac4;};'use strict';var _=require(_0x5c26('0x0'));var util=require(_0x5c26('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5c26('0x2'));var BPromise=require(_0x5c26('0x3'));var rp=require(_0x5c26('0x4'));var fs=require('fs');var path=require(_0x5c26('0x5'));var rimraf=require(_0x5c26('0x6'));var config=require(_0x5c26('0x7'));var attributes=require(_0x5c26('0x8'));module[_0x5c26('0x9')]=function(_0x395ffc,_0x1eec6c){return _0x395ffc[_0x5c26('0xa')](_0x5c26('0xb'),attributes,{'tableName':_0x5c26('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 744d827..5d083eb 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 _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x5a9776,_0x4b5ab3){var _0x454edb=function(_0x4116ae){while(--_0x4116ae){_0x5a9776['push'](_0x5a9776['shift']());}};_0x454edb(++_0x4b5ab3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x482e7b,_0x419a12){_0x482e7b=_0x482e7b-0x0;var _0x324fb0=_0x1cb9[_0x482e7b];return _0x324fb0;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +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(_0x449235,_0x567736){var _0x2446ad=function(_0x36d60c){while(--_0x36d60c){_0x449235['push'](_0x449235['shift']());}};_0x2446ad(++_0x567736);}(_0x55ca,0x126));var _0xa55c=function(_0x152c9d,_0x371656){_0x152c9d=_0x152c9d-0x0;var _0x462f34=_0x55ca[_0x152c9d];return _0x462f34;};'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 2eab058..5b59830 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 _0x7efd=['migrations','express','../../components/auth/service','get','index','isAuthenticated','canUpdate','fetch','/pull','pull','/restart','restart'];(function(_0x1a9a9e,_0x33fbf0){var _0x314054=function(_0x2ea64e){while(--_0x2ea64e){_0x1a9a9e['push'](_0x1a9a9e['shift']());}};_0x314054(++_0x33fbf0);}(_0x7efd,0x139));var _0xd7ef=function(_0x560411,_0x22de2b){_0x560411=_0x560411-0x0;var _0x3da57e=_0x7efd[_0x560411];return _0x3da57e;};'use strict';var express=require(_0xd7ef('0x0'));var router=express['Router']();var auth=require(_0xd7ef('0x1'));var controller=require('./version.controller');router[_0xd7ef('0x2')]('/',controller[_0xd7ef('0x3')]);router['get']('/fetch',auth[_0xd7ef('0x4')](),auth[_0xd7ef('0x5')](),controller[_0xd7ef('0x6')]);router[_0xd7ef('0x2')]('/reset',auth[_0xd7ef('0x4')](),auth[_0xd7ef('0x5')](),controller['reset']);router[_0xd7ef('0x2')](_0xd7ef('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xd7ef('0x8')]);router[_0xd7ef('0x2')](_0xd7ef('0x9'),auth['isAuthenticated'](),controller[_0xd7ef('0xa')]);router[_0xd7ef('0x2')]('/migrations',controller[_0xd7ef('0xb')]);module['exports']=router; \ No newline at end of file +var _0x3c3c=['reset','isAuthenticated','pull','/restart','restart','/migrations','migrations','exports','express','./version.controller','get','index','/fetch','canUpdate','fetch','/reset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3c3c,0x178));var _0xc3c3=function(_0x2a498b,_0x4a7306){_0x2a498b=_0x2a498b-0x0;var _0x25b090=_0x3c3c[_0x2a498b];return _0x25b090;};'use strict';var express=require(_0xc3c3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc3c3('0x1'));router[_0xc3c3('0x2')]('/',controller[_0xc3c3('0x3')]);router[_0xc3c3('0x2')](_0xc3c3('0x4'),auth['isAuthenticated'](),auth[_0xc3c3('0x5')](),controller[_0xc3c3('0x6')]);router[_0xc3c3('0x2')](_0xc3c3('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc3c3('0x8')]);router[_0xc3c3('0x2')]('/pull',auth[_0xc3c3('0x9')](),auth[_0xc3c3('0x5')](),controller[_0xc3c3('0xa')]);router[_0xc3c3('0x2')](_0xc3c3('0xb'),auth[_0xc3c3('0x9')](),controller[_0xc3c3('0xc')]);router[_0xc3c3('0x2')](_0xc3c3('0xd'),controller[_0xc3c3('0xe')]);module[_0xc3c3('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 922acd3..d2cbf85 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 _0x80f2=['length','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','../../config/logger','simple-git','root','index','exports','query','latest','status','json','fetch','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','info','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server'];(function(_0x443621,_0x1bed91){var _0x1ec439=function(_0x2f878a){while(--_0x2f878a){_0x443621['push'](_0x443621['shift']());}};_0x1ec439(++_0x1bed91);}(_0x80f2,0x18d));var _0x280f=function(_0x4bc839,_0x5bffb8){_0x4bc839=_0x4bc839-0x0;var _0x2b5f1a=_0x80f2[_0x4bc839];return _0x2b5f1a;};'use strict';var Umzug=require('umzug');var path=require(_0x280f('0x0'));var fs=require('fs');var _=require(_0x280f('0x1'));var pkginfo=require(_0x280f('0x2'))(module,_0x280f('0x3'));var compareVersions=require(_0x280f('0x4'));var exec=require(_0x280f('0x5'))['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0x280f('0x6'))('update');var git=require(_0x280f('0x7'))(config[_0x280f('0x8')]);exports[_0x280f('0x9')]=function(_0x1fe981,_0x5c1647){var _0x524c2c={'current':module[_0x280f('0xa')][_0x280f('0x3')],'phonebar':0x2};if(_0x1fe981['query']&&_0x1fe981[_0x280f('0xb')][_0x280f('0xc')]){return git['fetch']()['tags'](function(_0x53077f,_0x8ac058){_0x524c2c[_0x280f('0xc')]=(_0x53077f?module['exports']['version']:_0x8ac058[_0x280f('0xc')])||'2.0.0';return _0x5c1647[_0x280f('0xd')](0xc8)[_0x280f('0xe')](_0x524c2c);});}else{return _0x5c1647[_0x280f('0xd')](0xc8)[_0x280f('0xe')](_0x524c2c);}};exports[_0x280f('0xf')]=function(_0x421991,_0x5a2278){return git['fetch']([_0x280f('0x10'),_0x280f('0x11')],function(_0xea352){if(_0xea352){logger[_0x280f('0x12')](_0xea352);return _0x5a2278['status'](0x1f4)[_0x280f('0xe')](_0xea352);}logger['info'](_0x280f('0x13'));return _0x5a2278[_0x280f('0xd')](0xc8)[_0x280f('0xe')]({'output':_0x280f('0x14')});});};exports[_0x280f('0x15')]=function(_0x219b8a,_0x4f85b2){return git['reset']([_0x280f('0x16'),_0x280f('0x17')],function(_0x419064){if(_0x419064){logger['error'](_0x419064);return _0x4f85b2[_0x280f('0xd')](0x1f4)[_0x280f('0xe')](_0x419064);}logger['info'](_0x280f('0x18'));return _0x4f85b2[_0x280f('0xd')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x1035e8,_0x5ac3d2){exec(_0x280f('0x19'),function(_0x3f8c64,_0x43165a,_0x14f5f1){logger['info'](_0x43165a);logger[_0x280f('0x1a')](_0x14f5f1);if(_0x3f8c64){logger[_0x280f('0x12')](_0x3f8c64);return _0x5ac3d2[_0x280f('0xd')](0x1f4)[_0x280f('0xe')](_0x3f8c64);}return _0x5ac3d2[_0x280f('0xd')](0xc8)[_0x280f('0xe')]({'output':_0x43165a});});};exports[_0x280f('0x1b')]=function(_0x1eb767,_0x47ab7e){return pm2['restart']('motion2')[_0x280f('0x1c')](function(_0x47935d){logger[_0x280f('0x1a')](_0x280f('0x1d'),_0x47935d);return _0x47ab7e['status'](0xc8)[_0x280f('0xe')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x280f('0x1e')](function(_0x3da417){logger['error'](_0x3da417);return _0x47ab7e[_0x280f('0xd')](0x1f4)[_0x280f('0xe')](_0x3da417);});};exports[_0x280f('0x1f')]=function(_0x620859,_0x45eb71){var _0x4efa26=fs[_0x280f('0x20')](path[_0x280f('0x21')](config['root'],_0x280f('0x22'),_0x280f('0x1f')));var _0x5555f9=[];for(var _0x3480ed=0x0;_0x3480ed<_0x4efa26[_0x280f('0x23')];_0x3480ed++){var _0x3971b9=_0x4efa26[_0x3480ed]['replace'](_0x280f('0x24'),'');if(compareVersions(module[_0x280f('0xa')][_0x280f('0x3')],_0x3971b9)===-0x1){_0x5555f9[_0x280f('0x25')](_0x3971b9);}}if(_0x5555f9[_0x280f('0x23')]){var _0x57fda3=_0x5555f9[_0x280f('0x26')](compareVersions);var _0x48cc1c=new Umzug({'storage':_0x280f('0x27'),'storageOptions':{'model':db[_0x280f('0x28')],'modelName':'Migration','columnName':_0x280f('0x3')},'migrations':{'params':[db[_0x280f('0x27')]['getQueryInterface'](),db[_0x280f('0x27')][_0x280f('0x29')],function(){throw new Error(_0x280f('0x2a'));}],'path':path[_0x280f('0x21')](config[_0x280f('0x8')],'server','migrations'),'pattern':/\.js$/}});_0x48cc1c['up']({'migrations':_[_0x280f('0x2b')](_0x57fda3,function(_0x4bc5bc){return _0x4bc5bc+_0x280f('0x24');})})[_0x280f('0x1c')](function(){return _0x45eb71[_0x280f('0xd')](0xc8)[_0x280f('0xe')]({'output':_0x280f('0x2c')+module[_0x280f('0xa')][_0x280f('0x3')]+'\x20to\x20'+_[_0x280f('0x2d')](_0x57fda3),'migrations':_[_0x280f('0x21')](_0x57fda3)});})[_0x280f('0x1e')](function(_0x3ffe8c){if(_0x3ffe8c instanceof db[_0x280f('0x27')][_0x280f('0x2e')]){return _0x45eb71[_0x280f('0xd')](0xc8)[_0x280f('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x45eb71[_0x280f('0xd')](0x1f4)[_0x280f('0xe')](_0x3ffe8c);}});}else{return _0x45eb71[_0x280f('0xd')](0xc8)[_0x280f('0xe')]({'output':_0x280f('0x2f')});}}; \ No newline at end of file +var _0x3cc1=['path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','server','length','push','sort','Migration','sequelize','getQueryInterface','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','join','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x3cc1,0x164));var _0x13cc=function(_0x243e17,_0x59cca0){_0x243e17=_0x243e17-0x0;var _0x517bf1=_0x3cc1[_0x243e17];return _0x517bf1;};'use strict';var Umzug=require(_0x13cc('0x0'));var path=require(_0x13cc('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x13cc('0x2'))(module,_0x13cc('0x3'));var compareVersions=require(_0x13cc('0x4'));var exec=require(_0x13cc('0x5'))['exec'];var db=require(_0x13cc('0x6'))['db'];var config=require(_0x13cc('0x7'));var pm2=require(_0x13cc('0x8'));var logger=require('../../config/logger')(_0x13cc('0x9'));var git=require(_0x13cc('0xa'))(config[_0x13cc('0xb')]);exports[_0x13cc('0xc')]=function(_0xd551dd,_0x18094f){var _0x2b75a7={'current':module[_0x13cc('0xd')]['version'],'phonebar':0x2};if(_0xd551dd[_0x13cc('0xe')]&&_0xd551dd[_0x13cc('0xe')][_0x13cc('0xf')]){return git[_0x13cc('0x10')]()['tags'](function(_0x23c1d9,_0xd2d63d){_0x2b75a7[_0x13cc('0xf')]=(_0x23c1d9?module[_0x13cc('0xd')][_0x13cc('0x3')]:_0xd2d63d[_0x13cc('0xf')])||_0x13cc('0x11');return _0x18094f['status'](0xc8)['json'](_0x2b75a7);});}else{return _0x18094f[_0x13cc('0x12')](0xc8)[_0x13cc('0x13')](_0x2b75a7);}};exports[_0x13cc('0x10')]=function(_0x36aa63,_0x128c29){return git[_0x13cc('0x10')](['origin',_0x13cc('0x14')],function(_0xf47c2c){if(_0xf47c2c){logger[_0x13cc('0x15')](_0xf47c2c);return _0x128c29[_0x13cc('0x12')](0x1f4)[_0x13cc('0x13')](_0xf47c2c);}logger[_0x13cc('0x16')]('git\x20fetch');return _0x128c29[_0x13cc('0x12')](0xc8)[_0x13cc('0x13')]({'output':_0x13cc('0x17')});});};exports[_0x13cc('0x18')]=function(_0x57741d,_0x16afd4){return git[_0x13cc('0x18')]([_0x13cc('0x19'),_0x13cc('0x1a')],function(_0x59daee){if(_0x59daee){logger['error'](_0x59daee);return _0x16afd4[_0x13cc('0x12')](0x1f4)[_0x13cc('0x13')](_0x59daee);}logger[_0x13cc('0x16')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x16afd4['status'](0xc8)['json']({'output':_0x13cc('0x1b')});});};exports[_0x13cc('0x1c')]=function(_0x39b9c9,_0x1dde1a){exec(_0x13cc('0x1d'),function(_0x4f2957,_0x1ad6f4,_0x52a6fe){logger[_0x13cc('0x16')](_0x1ad6f4);logger['info'](_0x52a6fe);if(_0x4f2957){logger['error'](_0x4f2957);return _0x1dde1a[_0x13cc('0x12')](0x1f4)[_0x13cc('0x13')](_0x4f2957);}return _0x1dde1a[_0x13cc('0x12')](0xc8)['json']({'output':_0x1ad6f4});});};exports[_0x13cc('0x1e')]=function(_0x402239,_0x52d39a){return pm2[_0x13cc('0x1e')]('motion2')[_0x13cc('0x1f')](function(_0xf361b6){logger[_0x13cc('0x16')](_0x13cc('0x20'),_0xf361b6);return _0x52d39a[_0x13cc('0x12')](0xc8)[_0x13cc('0x13')]({'output':_0x13cc('0x21')});})['catch'](function(_0x3d537a){logger['error'](_0x3d537a);return _0x52d39a[_0x13cc('0x12')](0x1f4)['json'](_0x3d537a);});};exports[_0x13cc('0x22')]=function(_0x22993b,_0x4881cd){var _0x19a371=fs[_0x13cc('0x23')](path['join'](config[_0x13cc('0xb')],_0x13cc('0x24'),_0x13cc('0x22')));var _0x1ccb1e=[];for(var _0x2d8656=0x0;_0x2d8656<_0x19a371[_0x13cc('0x25')];_0x2d8656++){var _0x341de3=_0x19a371[_0x2d8656]['replace']('.js','');if(compareVersions(module[_0x13cc('0xd')][_0x13cc('0x3')],_0x341de3)===-0x1){_0x1ccb1e[_0x13cc('0x26')](_0x341de3);}}if(_0x1ccb1e[_0x13cc('0x25')]){var _0x3020d3=_0x1ccb1e[_0x13cc('0x27')](compareVersions);var _0x54484c=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x13cc('0x28'),'columnName':_0x13cc('0x3')},'migrations':{'params':[db[_0x13cc('0x29')][_0x13cc('0x2a')](),db[_0x13cc('0x29')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config['root'],_0x13cc('0x24'),_0x13cc('0x22')),'pattern':/\.js$/}});_0x54484c['up']({'migrations':_[_0x13cc('0x2b')](_0x3020d3,function(_0x409ba8){return _0x409ba8+_0x13cc('0x2c');})})[_0x13cc('0x1f')](function(){return _0x4881cd[_0x13cc('0x12')](0xc8)['json']({'output':_0x13cc('0x2d')+module[_0x13cc('0xd')][_0x13cc('0x3')]+'\x20to\x20'+_[_0x13cc('0x2e')](_0x3020d3),'migrations':_[_0x13cc('0x2f')](_0x3020d3)});})[_0x13cc('0x30')](function(_0x153f8c){if(_0x153f8c instanceof db[_0x13cc('0x29')][_0x13cc('0x31')]){return _0x4881cd[_0x13cc('0x12')](0xc8)[_0x13cc('0x13')]({'output':_0x13cc('0x32')});}else{return _0x4881cd[_0x13cc('0x12')](0x1f4)[_0x13cc('0x13')](_0x153f8c);}});}else{return _0x4881cd[_0x13cc('0x12')](0xc8)[_0x13cc('0x13')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 18d57d7..cfca5b3 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 _0x1be1=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id','post','put','update','destroy','path','connect-timeout','Router'];(function(_0x49e25e,_0x387905){var _0x10b3cd=function(_0x36dd99){while(--_0x36dd99){_0x49e25e['push'](_0x49e25e['shift']());}};_0x10b3cd(++_0x387905);}(_0x1be1,0x192));var _0x11be=function(_0x5ee155,_0x2e5b07){_0x5ee155=_0x5ee155-0x0;var _0x4aa64e=_0x1be1[_0x5ee155];return _0x4aa64e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0xb')]('/',auth[_0x11be('0x8')](),controller['create']);router[_0x11be('0xc')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xd')]);router['delete'](_0x11be('0xa'),auth[_0x11be('0x8')](),controller[_0x11be('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc198=['Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path'];(function(_0x2e2b8d,_0x4fa0d1){var _0x446d85=function(_0x2a1e67){while(--_0x2a1e67){_0x2e2b8d['push'](_0x2e2b8d['shift']());}};_0x446d85(++_0x4fa0d1);}(_0xc198,0x1e3));var _0x8c19=function(_0x2abcbe,_0x1ce8c3){_0x2abcbe=_0x2abcbe-0x0;var _0x1e097f=_0xc198[_0x2abcbe];return _0x1e097f;};'use strict';var multer=require(_0x8c19('0x0'));var util=require(_0x8c19('0x1'));var path=require(_0x8c19('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c19('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8c19('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x8c19('0x5')]('/',auth[_0x8c19('0x6')](),controller[_0x8c19('0x7')]);router['get'](_0x8c19('0x8'),auth[_0x8c19('0x6')](),controller[_0x8c19('0x9')]);router[_0x8c19('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8c19('0xa')]);router[_0x8c19('0xb')]('/',auth[_0x8c19('0x6')](),controller[_0x8c19('0xc')]);router[_0x8c19('0xd')](_0x8c19('0xe'),auth[_0x8c19('0x6')](),controller[_0x8c19('0xf')]);router[_0x8c19('0x10')](_0x8c19('0xe'),auth[_0x8c19('0x6')](),controller[_0x8c19('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ccdb083..197b66d 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 _0x6017=['exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x33d533,_0x218ed8){var _0x2153ef=function(_0x46d51c){while(--_0x46d51c){_0x33d533['push'](_0x33d533['shift']());}};_0x2153ef(++_0x218ed8);}(_0x6017,0xae));var _0x7601=function(_0x503d79,_0x2be005){_0x503d79=_0x503d79-0x0;var _0x116b60=_0x6017[_0x503d79];return _0x116b60;};'use strict';var Sequelize=require(_0x7601('0x0'));module[_0x7601('0x1')]={'type':{'type':Sequelize[_0x7601('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7601('0x2')]},'calleridname':{'type':Sequelize[_0x7601('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7601('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7601('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7601('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7601('0x3')]},'holdtime':{'type':Sequelize[_0x7601('0x4')]},'agentcomplete':{'type':Sequelize[_0x7601('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7601('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7601('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7601('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7601('0x4')]},'reason':{'type':Sequelize[_0x7601('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7601('0x2')]},'channelstate':{'type':Sequelize[_0x7601('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7601('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7601('0x2')]},'language':{'type':Sequelize[_0x7601('0x2')]},'accountcode':{'type':Sequelize[_0x7601('0x2')]},'context':{'type':Sequelize[_0x7601('0x2')]},'exten':{'type':Sequelize[_0x7601('0x2')]},'priority':{'type':Sequelize[_0x7601('0x2')]},'destchannel':{'type':Sequelize[_0x7601('0x2')]},'destchannelstate':{'type':Sequelize[_0x7601('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7601('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7601('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7601('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x7601('0x2')]},'destaccountcode':{'type':Sequelize[_0x7601('0x2')]},'destcontext':{'type':Sequelize[_0x7601('0x2')]},'destexten':{'type':Sequelize[_0x7601('0x2')]},'destpriority':{'type':Sequelize[_0x7601('0x2')]},'destuniqueid':{'type':Sequelize[_0x7601('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7601('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7601('0x2')]},'transfer':{'type':Sequelize[_0x7601('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7601('0x6')},'transferexten':{'type':Sequelize[_0x7601('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x7601('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x777d=['DATE','INTEGER','BOOLEAN','exports','STRING'];(function(_0x2b786d,_0x3c542e){var _0x6accfc=function(_0x326dd9){while(--_0x326dd9){_0x2b786d['push'](_0x2b786d['shift']());}};_0x6accfc(++_0x3c542e);}(_0x777d,0xe9));var _0xd777=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x777d[_0xfcbcb8];return _0x1b1f97;};'use strict';var Sequelize=require('sequelize');module[_0xd777('0x0')]={'type':{'type':Sequelize[_0xd777('0x1')]},'uniqueid':{'type':Sequelize[_0xd777('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd777('0x1')]},'queue':{'type':Sequelize[_0xd777('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd777('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd777('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd777('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd777('0x3')]},'agentacw':{'type':Sequelize[_0xd777('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd777('0x3')]},'reason':{'type':Sequelize[_0xd777('0x1')]},'lastevent':{'type':Sequelize[_0xd777('0x1')]},'channel':{'type':Sequelize[_0xd777('0x1')]},'channelstate':{'type':Sequelize[_0xd777('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd777('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd777('0x1')]},'connectedlinename':{'type':Sequelize[_0xd777('0x1')]},'language':{'type':Sequelize[_0xd777('0x1')]},'accountcode':{'type':Sequelize[_0xd777('0x1')]},'context':{'type':Sequelize[_0xd777('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd777('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd777('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd777('0x1')]},'destcalleridname':{'type':Sequelize[_0xd777('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd777('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd777('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xd777('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd777('0x1')]},'destpriority':{'type':Sequelize[_0xd777('0x1')]},'destuniqueid':{'type':Sequelize[_0xd777('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd777('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd777('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd777('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xd777('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xd777('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 232e103..0c4f668 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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 b1c5ba7..db85211 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 _0x8375=['rimraf','../../config/environment','exports','define','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfee4ec,_0xc28062){var _0x33d632=function(_0x48d732){while(--_0x48d732){_0xfee4ec['push'](_0xfee4ec['shift']());}};_0x33d632(++_0xc28062);}(_0x8375,0x132));var _0x5837=function(_0x195eb9,_0x159c7a){_0x195eb9=_0x195eb9-0x0;var _0x3be064=_0x8375[_0x195eb9];return _0x3be064;};'use strict';var _=require('lodash');var util=require(_0x5837('0x0'));var logger=require(_0x5837('0x1'))(_0x5837('0x2'));var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5837('0x6'));var config=require(_0x5837('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x5837('0x8')]=function(_0x438491,_0x21c9bd){return _0x438491[_0x5837('0x9')]('VoiceAgentReport',attributes,{'tableName':_0x5837('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5837('0xb'),_0x5837('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06f4=['api','moment','path','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x206cbd,_0x2068c1){var _0x27a307=function(_0x13df8f){while(--_0x13df8f){_0x206cbd['push'](_0x206cbd['shift']());}};_0x27a307(++_0x2068c1);}(_0x06f4,0x136));var _0x406f=function(_0x239276,_0x40ba23){_0x239276=_0x239276-0x0;var _0x58dd3e=_0x06f4[_0x239276];return _0x58dd3e;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x406f('0x9'),'paranoid':![],'indexes':[{'fields':[_0x406f('0xa'),_0x406f('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 60168d6..5d3e2f6 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 _0x6d79=['attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where'];(function(_0x4515e0,_0x17e56d){var _0x34ca38=function(_0x4a61ec){while(--_0x4a61ec){_0x4515e0['push'](_0x4515e0['shift']());}};_0x34ca38(++_0x17e56d);}(_0x6d79,0x7a));var _0x96d7=function(_0x298cf4,_0xf99e68){_0x298cf4=_0x298cf4-0x0;var _0x19ea6a=_0x6d79[_0x298cf4];return _0x19ea6a;};'use strict';var _=require(_0x96d7('0x0'));var util=require(_0x96d7('0x1'));var moment=require(_0x96d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x96d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x96d7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x96d7('0x5'));var jayson=require(_0x96d7('0x6'));var client=jayson[_0x96d7('0x7')][_0x96d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ae095,_0x3cec81,_0x54bf0a){return new BPromise(function(_0x4f8b78,_0x1f65a8){return client['request'](_0x2ae095,_0x54bf0a)[_0x96d7('0x9')](function(_0x5ce57c){logger[_0x96d7('0xa')](_0x96d7('0xb'),_0x3cec81,_0x96d7('0xc'));logger[_0x96d7('0xd')](_0x96d7('0xe'),_0x3cec81,_0x96d7('0xc'),JSON[_0x96d7('0xf')](_0x5ce57c));if(_0x5ce57c[_0x96d7('0x10')]){if(_0x5ce57c[_0x96d7('0x10')]['code']===0x1f4){logger['error'](_0x96d7('0xb'),_0x3cec81,_0x5ce57c['error']['message']);return _0x1f65a8(_0x5ce57c[_0x96d7('0x10')][_0x96d7('0x11')]);}logger[_0x96d7('0x10')](_0x96d7('0xb'),_0x3cec81,_0x5ce57c['error']['message']);return _0x4f8b78(_0x5ce57c['error'][_0x96d7('0x11')]);}else{logger[_0x96d7('0xa')](_0x96d7('0xb'),_0x3cec81,'request\x20sent');_0x4f8b78(_0x5ce57c['result'][_0x96d7('0x11')]);}})[_0x96d7('0x12')](function(_0x1a36cc){logger[_0x96d7('0x10')](_0x96d7('0xb'),_0x3cec81,_0x1a36cc);_0x1f65a8(_0x1a36cc);});});}exports[_0x96d7('0x13')]=function(_0x1d3251){var _0x53b8a7=this;return new Promise(function(_0x2085cf,_0x1068ec){return db['VoiceAgentReport'][_0x96d7('0x14')](_0x1d3251[_0x96d7('0x15')],{'raw':_0x1d3251[_0x96d7('0x16')]?_0x1d3251[_0x96d7('0x16')][_0x96d7('0x17')]===undefined?!![]:![]:!![]})[_0x96d7('0x9')](function(_0x564c33){logger[_0x96d7('0xa')](_0x96d7('0x13'),_0x1d3251);logger[_0x96d7('0xd')](_0x96d7('0x13'),_0x1d3251,JSON[_0x96d7('0xf')](_0x564c33));_0x2085cf(_0x564c33);})['catch'](function(_0x50bf63){logger['error'](_0x96d7('0x13'),_0x50bf63[_0x96d7('0x11')],_0x1d3251);_0x1068ec(_0x53b8a7[_0x96d7('0x10')](0x1f4,_0x50bf63[_0x96d7('0x11')]));});});};exports[_0x96d7('0x18')]=function(_0x2c97dc){var _0x38f0f7=this;return new Promise(function(_0x1ddb42,_0xab4949){return db[_0x96d7('0x19')][_0x96d7('0x1a')](_0x2c97dc[_0x96d7('0x15')],{'raw':_0x2c97dc[_0x96d7('0x16')]?_0x2c97dc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c97dc[_0x96d7('0x16')]?_0x2c97dc[_0x96d7('0x16')][_0x96d7('0x1b')]||null:null,'attributes':_0x2c97dc['options']?_0x2c97dc[_0x96d7('0x16')][_0x96d7('0x1c')]||null:null,'limit':_0x2c97dc[_0x96d7('0x16')]?_0x2c97dc[_0x96d7('0x16')][_0x96d7('0x1d')]||null:null})['then'](function(_0x1bc20d){logger[_0x96d7('0xa')](_0x96d7('0x18'),_0x2c97dc);logger[_0x96d7('0xd')](_0x96d7('0x18'),_0x2c97dc,JSON[_0x96d7('0xf')](_0x1bc20d));_0x1ddb42(_0x1bc20d);})[_0x96d7('0x12')](function(_0x569cef){logger[_0x96d7('0x10')](_0x96d7('0x18'),_0x569cef[_0x96d7('0x11')],_0x2c97dc);_0xab4949(_0x38f0f7[_0x96d7('0x10')](0x1f4,_0x569cef['message']));});});}; \ No newline at end of file +var _0x036a=['util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','raw','catch','update','options','where','attributes','limit','UpdateVoiceAgentReport'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x036a,0xf0));var _0xa036=function(_0x38f789,_0x33c8f5){_0x38f789=_0x38f789-0x0;var _0x285033=_0x036a[_0x38f789];return _0x285033;};'use strict';var _=require('lodash');var util=require(_0xa036('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa036('0x1'));var fs=require('fs');var Redis=require(_0xa036('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa036('0x3'));var logger=require(_0xa036('0x4'))(_0xa036('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa036('0x6')][_0xa036('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d8424,_0x9ff675,_0x319467){return new BPromise(function(_0x5a4b4c,_0x2e735b){return client[_0xa036('0x8')](_0x4d8424,_0x319467)[_0xa036('0x9')](function(_0x405aa0){logger[_0xa036('0xa')](_0xa036('0xb'),_0x9ff675,'request\x20sent');logger[_0xa036('0xc')](_0xa036('0xd'),_0x9ff675,'request\x20sent',JSON[_0xa036('0xe')](_0x405aa0));if(_0x405aa0[_0xa036('0xf')]){if(_0x405aa0[_0xa036('0xf')][_0xa036('0x10')]===0x1f4){logger['error'](_0xa036('0xb'),_0x9ff675,_0x405aa0['error'][_0xa036('0x11')]);return _0x2e735b(_0x405aa0[_0xa036('0xf')]['message']);}logger['error'](_0xa036('0xb'),_0x9ff675,_0x405aa0[_0xa036('0xf')][_0xa036('0x11')]);return _0x5a4b4c(_0x405aa0['error']['message']);}else{logger[_0xa036('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x9ff675,'request\x20sent');_0x5a4b4c(_0x405aa0[_0xa036('0x12')][_0xa036('0x11')]);}})['catch'](function(_0x1e7818){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x9ff675,_0x1e7818);_0x2e735b(_0x1e7818);});});}exports[_0xa036('0x13')]=function(_0xc8114e){var _0x4b8254=this;return new Promise(function(_0x124722,_0x51dcb6){return db[_0xa036('0x14')]['create'](_0xc8114e[_0xa036('0x15')],{'raw':_0xc8114e['options']?_0xc8114e['options'][_0xa036('0x16')]===undefined?!![]:![]:!![]})[_0xa036('0x9')](function(_0x29bf84){logger[_0xa036('0xa')](_0xa036('0x13'),_0xc8114e);logger[_0xa036('0xc')]('CreateVoiceAgentReport',_0xc8114e,JSON[_0xa036('0xe')](_0x29bf84));_0x124722(_0x29bf84);})[_0xa036('0x17')](function(_0x814697){logger['error'](_0xa036('0x13'),_0x814697[_0xa036('0x11')],_0xc8114e);_0x51dcb6(_0x4b8254['error'](0x1f4,_0x814697['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x350535){var _0x4d6ff8=this;return new Promise(function(_0x40438d,_0x491322){return db[_0xa036('0x14')][_0xa036('0x18')](_0x350535[_0xa036('0x15')],{'raw':_0x350535[_0xa036('0x19')]?_0x350535['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x350535[_0xa036('0x19')]?_0x350535[_0xa036('0x19')][_0xa036('0x1a')]||null:null,'attributes':_0x350535[_0xa036('0x19')]?_0x350535[_0xa036('0x19')][_0xa036('0x1b')]||null:null,'limit':_0x350535[_0xa036('0x19')]?_0x350535[_0xa036('0x19')][_0xa036('0x1c')]||null:null})[_0xa036('0x9')](function(_0x38a5a2){logger[_0xa036('0xa')](_0xa036('0x1d'),_0x350535);logger[_0xa036('0xc')]('UpdateVoiceAgentReport',_0x350535,JSON[_0xa036('0xe')](_0x38a5a2));_0x40438d(_0x38a5a2);})['catch'](function(_0x3d9441){logger[_0xa036('0xf')](_0xa036('0x1d'),_0x3d9441[_0xa036('0x11')],_0x350535);_0x491322(_0x4d6ff8[_0xa036('0xf')](0x1f4,_0x3d9441[_0xa036('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index ed7a0af..3ddf6de 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 _0x33c5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33c5,0xe6));var _0x533c=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x33c5[_0xb24fad];return _0x173226;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);router[_0x533c('0xf')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/:id',auth[_0x533c('0x9')](),controller[_0x533c('0x12')]);router[_0x533c('0x13')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9b67=['../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x188089,_0x43b0cf){var _0x157570=function(_0x4c1f5f){while(--_0x4c1f5f){_0x188089['push'](_0x188089['shift']());}};_0x157570(++_0x43b0cf);}(_0x9b67,0xf6));var _0x79b6=function(_0x221673,_0x1f46e5){_0x221673=_0x221673-0x0;var _0x1c0023=_0x9b67[_0x221673];return _0x1c0023;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['describe']);router[_0x79b6('0x8')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')]('/',auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller['update']);router['delete'](_0x79b6('0xc'),auth[_0x79b6('0x9')](),controller[_0x79b6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 8ce31a2..c1af8a4 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 _0xea7c=['outbound-fax','dialer','TEXT','DATE','INTEGER','STRING','inbound','outbound','inbound-fax'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xea7c,0xe6));var _0xcea7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xea7c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcea7('0x0')]},'type':{'type':Sequelize['ENUM'](_0xcea7('0x1'),'internal',_0xcea7('0x2'),_0xcea7('0x3'),_0xcea7('0x4'),_0xcea7('0x5'))},'tag':{'type':Sequelize[_0xcea7('0x0')]},'accountcode':{'type':Sequelize[_0xcea7('0x0')]},'source':{'type':Sequelize[_0xcea7('0x0')]},'destination':{'type':Sequelize[_0xcea7('0x0')]},'destinationcontext':{'type':Sequelize[_0xcea7('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xcea7('0x0')]},'destinationchannel':{'type':Sequelize[_0xcea7('0x0')]},'lastapplication':{'type':Sequelize[_0xcea7('0x0')]},'lastdata':{'type':Sequelize[_0xcea7('0x6')]},'starttime':{'type':Sequelize[_0xcea7('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xcea7('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xcea7('0x8')]},'billableseconds':{'type':Sequelize[_0xcea7('0x8')]},'mohtime':{'type':Sequelize[_0xcea7('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcea7('0x0')]},'amaflags':{'type':Sequelize[_0xcea7('0x0')]},'userfield':{'type':Sequelize[_0xcea7('0x0')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xcea7('0x0')]},'userThirdDisposition':{'type':Sequelize[_0xcea7('0x0')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xcea7('0x8')]},'sipcallid':{'type':Sequelize[_0xcea7('0x0')]}}; \ No newline at end of file +var _0x94df=['internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x94df,0xa3));var _0xf94d=function(_0x418df4,_0x32ff0e){_0x418df4=_0x418df4-0x0;var _0x5b85d8=_0x94df[_0x418df4];return _0x5b85d8;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'uniqueid':{'type':Sequelize[_0xf94d('0x2')]},'type':{'type':Sequelize[_0xf94d('0x3')](_0xf94d('0x4'),_0xf94d('0x5'),'outbound',_0xf94d('0x6'),_0xf94d('0x7'),_0xf94d('0x8'))},'tag':{'type':Sequelize[_0xf94d('0x2')]},'accountcode':{'type':Sequelize[_0xf94d('0x2')]},'source':{'type':Sequelize[_0xf94d('0x2')]},'destination':{'type':Sequelize[_0xf94d('0x2')]},'destinationcontext':{'type':Sequelize[_0xf94d('0x2')]},'callerid':{'type':Sequelize[_0xf94d('0x2')]},'channel':{'type':Sequelize[_0xf94d('0x2')]},'destinationchannel':{'type':Sequelize[_0xf94d('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf94d('0x9')]},'starttime':{'type':Sequelize[_0xf94d('0xa')]},'systemanswertime':{'type':Sequelize[_0xf94d('0xa')]},'answertime':{'type':Sequelize[_0xf94d('0xa')]},'endtime':{'type':Sequelize[_0xf94d('0xa')]},'duration':{'type':Sequelize[_0xf94d('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xf94d('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf94d('0x2')]},'amaflags':{'type':Sequelize[_0xf94d('0x2')]},'userfield':{'type':Sequelize[_0xf94d('0x2')]},'userDisposition':{'type':Sequelize[_0xf94d('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf94d('0x2')]},'prefix':{'type':Sequelize[_0xf94d('0x2')]},'routeid':{'type':Sequelize[_0xf94d('0xb')]},'sipcallid':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e1ae0f4..ccd6ac4 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x2ef3,0xba));var _0x32ef=function(_0x1fa354,_0x3da85a){_0x1fa354=_0x1fa354-0x0;var _0x3f3916=_0x2ef3[_0x1fa354];return _0x3f3916;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x22814f,_0x3b4afc){var _0x523be1=function(_0x582395){while(--_0x582395){_0x22814f['push'](_0x22814f['shift']());}};_0x523be1(++_0x3b4afc);}(_0x0b0e,0x187));var _0xe0b0=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x0b0e[_0x368587];return _0x42d33c;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index d9a3a6b..63e3744 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 _0x2ce7=['request-promise','path','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x1ef973,_0x490bb2){var _0x2c7d46=function(_0x878c8b){while(--_0x878c8b){_0x1ef973['push'](_0x1ef973['shift']());}};_0x2c7d46(++_0x490bb2);}(_0x2ce7,0xc7));var _0x72ce=function(_0x85755d,_0xde9ee9){_0x85755d=_0x85755d-0x0;var _0x138e97=_0x2ce7[_0x85755d];return _0x138e97;};'use strict';var _=require(_0x72ce('0x0'));var util=require(_0x72ce('0x1'));var logger=require('../../config/logger')(_0x72ce('0x2'));var moment=require(_0x72ce('0x3'));var BPromise=require(_0x72ce('0x4'));var rp=require(_0x72ce('0x5'));var fs=require('fs');var path=require(_0x72ce('0x6'));var rimraf=require('rimraf');var config=require(_0x72ce('0x7'));var attributes=require(_0x72ce('0x8'));module['exports']=function(_0x16f7a7,_0x554613){return _0x16f7a7[_0x72ce('0x9')](_0x72ce('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x72ce('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc73=['util','../../config/logger','bluebird','path','./voiceCallReport.attributes','exports','define','report_call','uniqueid'];(function(_0x498b9e,_0x46ae26){var _0x29dd57=function(_0x56f191){while(--_0x56f191){_0x498b9e['push'](_0x498b9e['shift']());}};_0x29dd57(++_0x46ae26);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcc73[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var logger=require(_0x3cc7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3cc7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cc7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3cc7('0x4'));module[_0x3cc7('0x5')]=function(_0x1ccad1,_0x10d0f9){return _0x1ccad1[_0x3cc7('0x6')]('VoiceCallReport',attributes,{'tableName':_0x3cc7('0x7'),'paranoid':![],'indexes':[{'fields':[_0x3cc7('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5bd64dd..067367d 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 _0xd590=['VoiceCallReport,\x20%s,\x20%s','message','catch','findAll','options','where','attributes','limit','include','map','model','GetVoiceCallReport','VoiceCallReport','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd590,0xa2));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d59('0x0'));var util=require('util');var moment=require(_0x0d59('0x1'));var BPromise=require(_0x0d59('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d59('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d59('0x4'));var logger=require(_0x0d59('0x5'))(_0x0d59('0x6'));var config=require('../../config/environment');var jayson=require(_0x0d59('0x7'));var client=jayson[_0x0d59('0x8')][_0x0d59('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4414aa,_0x53b183,_0x13838d){return new BPromise(function(_0x2938a6,_0x1f1664){return client[_0x0d59('0xa')](_0x4414aa,_0x13838d)[_0x0d59('0xb')](function(_0x232626){logger[_0x0d59('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x53b183,_0x0d59('0xd'));logger[_0x0d59('0xe')](_0x0d59('0xf'),_0x53b183,_0x0d59('0xd'),JSON[_0x0d59('0x10')](_0x232626));if(_0x232626[_0x0d59('0x11')]){if(_0x232626['error']['code']===0x1f4){logger[_0x0d59('0x11')](_0x0d59('0x12'),_0x53b183,_0x232626[_0x0d59('0x11')][_0x0d59('0x13')]);return _0x1f1664(_0x232626['error']['message']);}logger[_0x0d59('0x11')](_0x0d59('0x12'),_0x53b183,_0x232626['error'][_0x0d59('0x13')]);return _0x2938a6(_0x232626[_0x0d59('0x11')][_0x0d59('0x13')]);}else{logger['info'](_0x0d59('0x12'),_0x53b183,_0x0d59('0xd'));_0x2938a6(_0x232626['result'][_0x0d59('0x13')]);}})[_0x0d59('0x14')](function(_0x3557d2){logger[_0x0d59('0x11')](_0x0d59('0x12'),_0x53b183,_0x3557d2);_0x1f1664(_0x3557d2);});});}exports['GetVoiceCallReport']=function(_0x2f6f6b){var _0x56ba8c=this;return new Promise(function(_0xe3ae45,_0x4f17b0){return db['VoiceCallReport'][_0x0d59('0x15')]({'raw':_0x2f6f6b[_0x0d59('0x16')]?_0x2f6f6b[_0x0d59('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2f6f6b['options']?_0x2f6f6b[_0x0d59('0x16')][_0x0d59('0x17')]||null:null,'attributes':_0x2f6f6b[_0x0d59('0x16')]?_0x2f6f6b[_0x0d59('0x16')][_0x0d59('0x18')]||null:null,'limit':_0x2f6f6b[_0x0d59('0x16')]?_0x2f6f6b[_0x0d59('0x16')][_0x0d59('0x19')]||null:null,'include':_0x2f6f6b[_0x0d59('0x16')]?_0x2f6f6b['options'][_0x0d59('0x1a')]?_[_0x0d59('0x1b')](_0x2f6f6b[_0x0d59('0x16')]['include'],function(_0x178b9f){return{'model':db[_0x178b9f[_0x0d59('0x1c')]],'as':_0x178b9f['as'],'attributes':_0x178b9f[_0x0d59('0x18')],'include':_0x178b9f[_0x0d59('0x1a')]?_[_0x0d59('0x1b')](_0x178b9f[_0x0d59('0x1a')],function(_0x18bb3f){return{'model':db[_0x18bb3f[_0x0d59('0x1c')]],'as':_0x18bb3f['as'],'attributes':_0x18bb3f[_0x0d59('0x18')],'include':_0x18bb3f[_0x0d59('0x1a')]?_[_0x0d59('0x1b')](_0x18bb3f[_0x0d59('0x1a')],function(_0x186325){return{'model':db[_0x186325['model']],'as':_0x186325['as'],'attributes':_0x186325[_0x0d59('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x25dd80){logger[_0x0d59('0xc')](_0x0d59('0x1d'),_0x2f6f6b);logger[_0x0d59('0xe')](_0x0d59('0x1d'),_0x2f6f6b,JSON[_0x0d59('0x10')](_0x25dd80));_0xe3ae45(_0x25dd80);})[_0x0d59('0x14')](function(_0x3cc049){logger[_0x0d59('0x11')](_0x0d59('0x1d'),_0x3cc049[_0x0d59('0x13')],_0x2f6f6b);_0x4f17b0(_0x56ba8c[_0x0d59('0x11')](0x1f4,_0x3cc049[_0x0d59('0x13')]));});});};exports['CreateVoiceCallReport']=function(_0x161c1c){var _0x7bbe37=this;return new Promise(function(_0x4db4cf,_0x32c060){return db[_0x0d59('0x1e')]['create'](_0x161c1c[_0x0d59('0x1f')],{'raw':_0x161c1c[_0x0d59('0x16')]?_0x161c1c[_0x0d59('0x16')][_0x0d59('0x20')]===undefined?!![]:![]:!![]})[_0x0d59('0xb')](function(_0x4f3332){logger[_0x0d59('0xc')]('CreateVoiceCallReport',_0x161c1c);logger[_0x0d59('0xe')]('CreateVoiceCallReport',_0x161c1c,JSON[_0x0d59('0x10')](_0x4f3332));_0x4db4cf(_0x4f3332);})[_0x0d59('0x14')](function(_0x588673){logger[_0x0d59('0x11')](_0x0d59('0x21'),_0x588673[_0x0d59('0x13')],_0x161c1c);_0x32c060(_0x7bbe37['error'](0x1f4,_0x588673[_0x0d59('0x13')]));});});};exports[_0x0d59('0x22')]=function(_0x4027e5){var _0x2008d7=this;return new Promise(function(_0x269d1c,_0x217965){return db[_0x0d59('0x1e')][_0x0d59('0x23')](_0x4027e5['body'],{'raw':_0x4027e5[_0x0d59('0x16')]?_0x4027e5[_0x0d59('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4027e5[_0x0d59('0x16')]?_0x4027e5[_0x0d59('0x16')][_0x0d59('0x17')]||null:null,'attributes':_0x4027e5['options']?_0x4027e5[_0x0d59('0x16')]['attributes']||null:null,'limit':_0x4027e5[_0x0d59('0x16')]?_0x4027e5['options']['limit']||null:null})['then'](function(_0x224324){logger[_0x0d59('0xc')](_0x0d59('0x22'),_0x4027e5);logger[_0x0d59('0xe')](_0x0d59('0x22'),_0x4027e5,JSON['stringify'](_0x224324));_0x269d1c(_0x224324);})[_0x0d59('0x14')](function(_0x460de5){logger['error']('UpdateVoiceCallReport',_0x460de5[_0x0d59('0x13')],_0x4027e5);_0x217965(_0x2008d7[_0x0d59('0x11')](0x1f4,_0x460de5[_0x0d59('0x13')]));});});}; \ No newline at end of file +var _0x7ac0=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','limit','catch'];(function(_0x4635c9,_0x54cd69){var _0x2901e0=function(_0x5d500a){while(--_0x5d500a){_0x4635c9['push'](_0x4635c9['shift']());}};_0x2901e0(++_0x54cd69);}(_0x7ac0,0x98));var _0x07ac=function(_0xf48dea,_0x44a2c7){_0xf48dea=_0xf48dea-0x0;var _0x1ca3e3=_0x7ac0[_0xf48dea];return _0x1ca3e3;};'use strict';var _=require(_0x07ac('0x0'));var util=require(_0x07ac('0x1'));var moment=require(_0x07ac('0x2'));var BPromise=require(_0x07ac('0x3'));var rs=require(_0x07ac('0x4'));var fs=require('fs');var Redis=require(_0x07ac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07ac('0x6'));var logger=require(_0x07ac('0x7'))('rpc');var config=require(_0x07ac('0x8'));var jayson=require(_0x07ac('0x9'));var client=jayson[_0x07ac('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20ddf5,_0x4ef76a,_0x1ba662){return new BPromise(function(_0x376ddd,_0x569925){return client['request'](_0x20ddf5,_0x1ba662)[_0x07ac('0xb')](function(_0x593531){logger['info'](_0x07ac('0xc'),_0x4ef76a,_0x07ac('0xd'));logger[_0x07ac('0xe')](_0x07ac('0xf'),_0x4ef76a,_0x07ac('0xd'),JSON[_0x07ac('0x10')](_0x593531));if(_0x593531[_0x07ac('0x11')]){if(_0x593531[_0x07ac('0x11')][_0x07ac('0x12')]===0x1f4){logger['error'](_0x07ac('0xc'),_0x4ef76a,_0x593531[_0x07ac('0x11')]['message']);return _0x569925(_0x593531['error'][_0x07ac('0x13')]);}logger[_0x07ac('0x11')](_0x07ac('0xc'),_0x4ef76a,_0x593531[_0x07ac('0x11')][_0x07ac('0x13')]);return _0x376ddd(_0x593531[_0x07ac('0x11')]['message']);}else{logger[_0x07ac('0x14')](_0x07ac('0xc'),_0x4ef76a,'request\x20sent');_0x376ddd(_0x593531[_0x07ac('0x15')][_0x07ac('0x13')]);}})['catch'](function(_0x56251c){logger['error'](_0x07ac('0xc'),_0x4ef76a,_0x56251c);_0x569925(_0x56251c);});});}exports[_0x07ac('0x16')]=function(_0x5f598d){var _0x4a6dfd=this;return new Promise(function(_0x5f4acd,_0x25378a){return db['VoiceCallReport'][_0x07ac('0x17')]({'raw':_0x5f598d['options']?_0x5f598d[_0x07ac('0x18')][_0x07ac('0x19')]===undefined?!![]:![]:!![],'where':_0x5f598d[_0x07ac('0x18')]?_0x5f598d[_0x07ac('0x18')][_0x07ac('0x1a')]||null:null,'attributes':_0x5f598d[_0x07ac('0x18')]?_0x5f598d[_0x07ac('0x18')][_0x07ac('0x1b')]||null:null,'limit':_0x5f598d[_0x07ac('0x18')]?_0x5f598d['options']['limit']||null:null,'include':_0x5f598d[_0x07ac('0x18')]?_0x5f598d['options'][_0x07ac('0x1c')]?_[_0x07ac('0x1d')](_0x5f598d[_0x07ac('0x18')][_0x07ac('0x1c')],function(_0xe2469a){return{'model':db[_0xe2469a['model']],'as':_0xe2469a['as'],'attributes':_0xe2469a['attributes'],'include':_0xe2469a[_0x07ac('0x1c')]?_[_0x07ac('0x1d')](_0xe2469a['include'],function(_0x71a091){return{'model':db[_0x71a091[_0x07ac('0x1e')]],'as':_0x71a091['as'],'attributes':_0x71a091['attributes'],'include':_0x71a091['include']?_[_0x07ac('0x1d')](_0x71a091[_0x07ac('0x1c')],function(_0x3ab8b7){return{'model':db[_0x3ab8b7[_0x07ac('0x1e')]],'as':_0x3ab8b7['as'],'attributes':_0x3ab8b7[_0x07ac('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15d9e2){logger['info'](_0x07ac('0x16'),_0x5f598d);logger[_0x07ac('0xe')](_0x07ac('0x16'),_0x5f598d,JSON[_0x07ac('0x10')](_0x15d9e2));_0x5f4acd(_0x15d9e2);})['catch'](function(_0x98f02c){logger[_0x07ac('0x11')]('GetVoiceCallReport',_0x98f02c[_0x07ac('0x13')],_0x5f598d);_0x25378a(_0x4a6dfd['error'](0x1f4,_0x98f02c[_0x07ac('0x13')]));});});};exports[_0x07ac('0x1f')]=function(_0x596867){var _0x28c2dd=this;return new Promise(function(_0x3d8300,_0x30abc4){return db[_0x07ac('0x20')][_0x07ac('0x21')](_0x596867[_0x07ac('0x22')],{'raw':_0x596867[_0x07ac('0x18')]?_0x596867[_0x07ac('0x18')][_0x07ac('0x19')]===undefined?!![]:![]:!![]})[_0x07ac('0xb')](function(_0xf1716c){logger[_0x07ac('0x14')](_0x07ac('0x1f'),_0x596867);logger['debug'](_0x07ac('0x1f'),_0x596867,JSON['stringify'](_0xf1716c));_0x3d8300(_0xf1716c);})['catch'](function(_0x15a536){logger[_0x07ac('0x11')](_0x07ac('0x1f'),_0x15a536[_0x07ac('0x13')],_0x596867);_0x30abc4(_0x28c2dd[_0x07ac('0x11')](0x1f4,_0x15a536[_0x07ac('0x13')]));});});};exports[_0x07ac('0x23')]=function(_0x3b7e40){var _0x1438a7=this;return new Promise(function(_0x2d89cb,_0x4d3cc6){return db[_0x07ac('0x20')]['update'](_0x3b7e40[_0x07ac('0x22')],{'raw':_0x3b7e40[_0x07ac('0x18')]?_0x3b7e40[_0x07ac('0x18')][_0x07ac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7e40[_0x07ac('0x18')]?_0x3b7e40['options'][_0x07ac('0x1a')]||null:null,'attributes':_0x3b7e40[_0x07ac('0x18')]?_0x3b7e40[_0x07ac('0x18')][_0x07ac('0x1b')]||null:null,'limit':_0x3b7e40[_0x07ac('0x18')]?_0x3b7e40[_0x07ac('0x18')][_0x07ac('0x24')]||null:null})[_0x07ac('0xb')](function(_0x18faa7){logger[_0x07ac('0x14')](_0x07ac('0x23'),_0x3b7e40);logger['debug']('UpdateVoiceCallReport',_0x3b7e40,JSON[_0x07ac('0x10')](_0x18faa7));_0x2d89cb(_0x18faa7);})[_0x07ac('0x25')](function(_0x38fb59){logger[_0x07ac('0x11')](_0x07ac('0x23'),_0x38fb59[_0x07ac('0x13')],_0x3b7e40);_0x4d3cc6(_0x1438a7[_0x07ac('0x11')](0x1f4,_0x38fb59[_0x07ac('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 67bddd3..6a6aa00 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 _0xc838=['index','/:id','isAuthenticated','post','create','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x436cb5,_0x2cb52a){var _0x57bb18=function(_0x3ce20e){while(--_0x3ce20e){_0x436cb5['push'](_0x436cb5['shift']());}};_0x57bb18(++_0x2cb52a);}(_0xc838,0x98));var _0x8c83=function(_0x1cf00c,_0x31d85f){_0x1cf00c=_0x1cf00c-0x0;var _0x322b2=_0xc838[_0x1cf00c];return _0x322b2;};'use strict';var multer=require(_0x8c83('0x0'));var util=require(_0x8c83('0x1'));var path=require('path');var timeout=require(_0x8c83('0x2'));var express=require(_0x8c83('0x3'));var router=express['Router']();var fs_extra=require(_0x8c83('0x4'));var auth=require(_0x8c83('0x5'));var interaction=require(_0x8c83('0x6'));var config=require(_0x8c83('0x7'));var controller=require(_0x8c83('0x8'));router[_0x8c83('0x9')]('/',auth['isAuthenticated'](),controller[_0x8c83('0xa')]);router[_0x8c83('0x9')](_0x8c83('0xb'),auth[_0x8c83('0xc')](),controller['show']);router[_0x8c83('0xd')]('/',auth[_0x8c83('0xc')](),controller[_0x8c83('0xe')]);router['put']('/:id',auth[_0x8c83('0xc')](),controller[_0x8c83('0xf')]);router[_0x8c83('0x10')](_0x8c83('0xb'),auth[_0x8c83('0xc')](),controller['destroy']);module[_0x8c83('0x11')]=router; \ No newline at end of file +var _0xa236=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','/:id','isAuthenticated','show','post','create','update'];(function(_0x9c9d03,_0xe3d333){var _0x38ffe8=function(_0x57af2f){while(--_0x57af2f){_0x9c9d03['push'](_0x9c9d03['shift']());}};_0x38ffe8(++_0xe3d333);}(_0xa236,0xec));var _0x6a23=function(_0x5a4302,_0x2f8cc8){_0x5a4302=_0x5a4302-0x0;var _0x312b6e=_0xa236[_0x5a4302];return _0x312b6e;};'use strict';var multer=require('multer');var util=require(_0x6a23('0x0'));var path=require(_0x6a23('0x1'));var timeout=require(_0x6a23('0x2'));var express=require(_0x6a23('0x3'));var router=express[_0x6a23('0x4')]();var fs_extra=require(_0x6a23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6a23('0x6'));var config=require(_0x6a23('0x7'));var controller=require(_0x6a23('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6a23('0x9')]);router['get'](_0x6a23('0xa'),auth[_0x6a23('0xb')](),controller[_0x6a23('0xc')]);router[_0x6a23('0xd')]('/',auth[_0x6a23('0xb')](),controller[_0x6a23('0xe')]);router['put'](_0x6a23('0xa'),auth[_0x6a23('0xb')](),controller[_0x6a23('0xf')]);router['delete'](_0x6a23('0xa'),auth[_0x6a23('0xb')](),controller[_0x6a23('0x10')]);module[_0x6a23('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e8185b5..d7077e5 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 _0x6093=['exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x50702b,_0x36128f){var _0x18bac2=function(_0x340275){while(--_0x340275){_0x50702b['push'](_0x50702b['shift']());}};_0x18bac2(++_0x36128f);}(_0x6093,0xb0));var _0x3609=function(_0x4bd13b,_0x157a13){_0x4bd13b=_0x4bd13b-0x0;var _0x5d1e33=_0x6093[_0x4bd13b];return _0x5d1e33;};'use strict';var Sequelize=require('sequelize');module[_0x3609('0x0')]={'name':{'type':Sequelize[_0x3609('0x1')]},'prefix':{'type':Sequelize[_0x3609('0x1')],'unique':_0x3609('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x3609('0x1')],'set':function(_0x5a4243){this['setDataValue'](_0x3609('0x3'),_0x5a4243?_0x5a4243[_0x3609('0x4')](''):[]);},'get':function(){return this[_0x3609('0x5')](_0x3609('0x3'))?this[_0x3609('0x5')](_0x3609('0x3'))[_0x3609('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x3609('0x1')]},'record':{'type':Sequelize[_0x3609('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3609('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f01=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue','split'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f01,0xc9));var _0x12f0=function(_0xcf4c8,_0x52a7d2){_0xcf4c8=_0xcf4c8-0x0;var _0x2a285f=_0x2f01[_0xcf4c8];return _0x2a285f;};'use strict';var Sequelize=require(_0x12f0('0x0'));module[_0x12f0('0x1')]={'name':{'type':Sequelize[_0x12f0('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x12f0('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x12f0('0x2')],'set':function(_0x3b2ca5){this[_0x12f0('0x4')](_0x12f0('0x5'),_0x3b2ca5?_0x3b2ca5[_0x12f0('0x6')](''):[]);},'get':function(){return this[_0x12f0('0x7')]('options')?this[_0x12f0('0x7')](_0x12f0('0x5'))[_0x12f0('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x12f0('0x2')]},'record':{'type':Sequelize[_0x12f0('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x12f0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index ba7198a..22c2c6c 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 _0x928c=['end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceChanSpy','findAll','rows','show','params','find','create','body','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status'];(function(_0x271630,_0x45cb62){var _0x44d416=function(_0x43f7f7){while(--_0x43f7f7){_0x271630['push'](_0x271630['shift']());}};_0x44d416(++_0x45cb62);}(_0x928c,0x17f));var _0xc928=function(_0x1f9e61,_0x3b7450){_0x1f9e61=_0x1f9e61-0x0;var _0x575955=_0x928c[_0x1f9e61];return _0x575955;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc928('0x0'));var jsonpatch=require(_0xc928('0x1'));var rp=require('request-promise');var moment=require(_0xc928('0x2'));var BPromise=require(_0xc928('0x3'));var Mustache=require(_0xc928('0x4'));var util=require(_0xc928('0x5'));var path=require(_0xc928('0x6'));var sox=require('sox');var csv=require(_0xc928('0x7'));var ejs=require(_0xc928('0x8'));var fs=require('fs');var fs_extra=require(_0xc928('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc928('0xa'));var deskjs=require(_0xc928('0xb'));var toCsv=require(_0xc928('0x7'));var querystring=require(_0xc928('0xc'));var Papa=require(_0xc928('0xd'));var Redis=require(_0xc928('0xe'));var authService=require(_0xc928('0xf'));var qs=require(_0xc928('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc928('0x11'));var logger=require(_0xc928('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xc928('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc928('0x14'))['db'];function respondWithStatusCode(_0x4fe512,_0x425750){_0x425750=_0x425750||0xcc;return function(_0x2e3a6f){if(_0x2e3a6f){return _0x4fe512['sendStatus'](_0x425750);}return _0x4fe512[_0xc928('0x15')](_0x425750)[_0xc928('0x16')]();};}function respondWithResult(_0x5591a1,_0x3b5e4d){_0x3b5e4d=_0x3b5e4d||0xc8;return function(_0x3ae32f){if(_0x3ae32f){return _0x5591a1[_0xc928('0x15')](_0x3b5e4d)[_0xc928('0x17')](_0x3ae32f);}};}function respondWithFilteredResult(_0x42cdfb,_0x23a005){return function(_0x546cfe){if(_0x546cfe){var _0x16dd14=typeof _0x23a005[_0xc928('0x18')]===_0xc928('0x19')&&typeof _0x23a005[_0xc928('0x1a')]===_0xc928('0x19');var _0x9220a2=_0x546cfe[_0xc928('0x1b')];var _0x3206ae=_0x16dd14?0x0:_0x23a005[_0xc928('0x18')];var _0x456dc3=_0x16dd14?_0x546cfe[_0xc928('0x1b')]:_0x23a005[_0xc928('0x18')]+_0x23a005['limit'];var _0xcf3bc7;if(_0x456dc3>=_0x9220a2){_0x456dc3=_0x9220a2;_0xcf3bc7=0xc8;}else{_0xcf3bc7=0xce;}_0x42cdfb[_0xc928('0x15')](_0xcf3bc7);return _0x42cdfb[_0xc928('0x1c')](_0xc928('0x1d'),_0x3206ae+'-'+_0x456dc3+'/'+_0x9220a2)['json'](_0x546cfe);}return null;};}function patchUpdates(_0x13e041){return function(_0x2a7214){try{jsonpatch[_0xc928('0x1e')](_0x2a7214,_0x13e041,!![]);}catch(_0x51c5da){return BPromise['reject'](_0x51c5da);}return _0x2a7214[_0xc928('0x1f')]();};}function saveUpdates(_0x426175,_0x375ec6){return function(_0x16ed73){if(_0x16ed73){return _0x16ed73['update'](_0x426175)['then'](function(_0x145fa4){return _0x145fa4;});}return null;};}function removeEntity(_0xbd5d43,_0x3ce74d){return function(_0x1a5dc2){if(_0x1a5dc2){return _0x1a5dc2[_0xc928('0x20')]()['then'](function(){var _0x3925d3=_0x1a5dc2[_0xc928('0x21')]({'plain':!![]});var _0x2ac3c7='ChanSpies';return db['UserProfileResource'][_0xc928('0x20')]({'where':{'type':_0x2ac3c7,'resourceId':_0x3925d3['id']}})[_0xc928('0x22')](function(){return _0x1a5dc2;});})['then'](function(){_0xbd5d43[_0xc928('0x15')](0xcc)[_0xc928('0x16')]();});}};}function handleEntityNotFound(_0xcb813,_0x3f3690){return function(_0x58b20b){if(!_0x58b20b){_0xcb813[_0xc928('0x23')](0x194);}return _0x58b20b;};}function handleError(_0x1aa39c,_0x38df7a){_0x38df7a=_0x38df7a||0x1f4;return function(_0x203b02){logger[_0xc928('0x24')](_0x203b02[_0xc928('0x25')]);if(_0x203b02[_0xc928('0x26')]){delete _0x203b02[_0xc928('0x26')];}_0x1aa39c[_0xc928('0x15')](_0x38df7a)[_0xc928('0x27')](_0x203b02);};}exports[_0xc928('0x28')]=function(_0x2aeada,_0x295335){var _0x322643={},_0x2d0700={},_0x447a30={'count':0x0,'rows':[]};var _0xe8b6d=_[_0xc928('0x29')](db['VoiceChanSpy'][_0xc928('0x2a')],function(_0xe75e83){return{'name':_0xe75e83[_0xc928('0x2b')],'type':_0xe75e83['type']['key']};});_0x2d0700[_0xc928('0x2c')]=_[_0xc928('0x29')](_0xe8b6d,_0xc928('0x26'));_0x2d0700[_0xc928('0x2d')]=_[_0xc928('0x2e')](_0x2aeada[_0xc928('0x2d')]);_0x2d0700[_0xc928('0x2f')]=_[_0xc928('0x30')](_0x2d0700[_0xc928('0x2c')],_0x2d0700[_0xc928('0x2d')]);_0x322643[_0xc928('0x31')]=_[_0xc928('0x30')](_0x2d0700[_0xc928('0x2c')],qs['fields'](_0x2aeada[_0xc928('0x2d')][_0xc928('0x32')]));_0x322643['attributes']=_0x322643[_0xc928('0x31')][_0xc928('0x33')]?_0x322643[_0xc928('0x31')]:_0x2d0700[_0xc928('0x2c')];if(!_0x2aeada[_0xc928('0x2d')][_0xc928('0x34')](_0xc928('0x35'))){_0x322643[_0xc928('0x1a')]=qs['limit'](_0x2aeada['query'][_0xc928('0x1a')]);_0x322643['offset']=qs[_0xc928('0x18')](_0x2aeada[_0xc928('0x2d')][_0xc928('0x18')]);}_0x322643[_0xc928('0x36')]=qs[_0xc928('0x37')](_0x2aeada[_0xc928('0x2d')]['sort']);_0x322643[_0xc928('0x38')]=qs[_0xc928('0x2f')](_[_0xc928('0x39')](_0x2aeada['query'],_0x2d0700[_0xc928('0x2f')]),_0xe8b6d);if(_0x2aeada[_0xc928('0x2d')][_0xc928('0x3a')]){_0x322643[_0xc928('0x38')]=_[_0xc928('0x3b')](_0x322643[_0xc928('0x38')],{'$or':_['map'](_0xe8b6d,function(_0x2f36c9){if(_0x2f36c9['type']!==_0xc928('0x3c')){var _0x859f13={};_0x859f13[_0x2f36c9[_0xc928('0x26')]]={'$like':'%'+_0x2aeada[_0xc928('0x2d')][_0xc928('0x3a')]+'%'};return _0x859f13;}})});}_0x322643=_['merge']({},_0x322643,_0x2aeada[_0xc928('0x3d')]);var _0x1f83e1={'where':_0x322643['where']};return db['VoiceChanSpy']['count'](_0x1f83e1)['then'](function(_0x45f5ff){_0x447a30[_0xc928('0x1b')]=_0x45f5ff;if(_0x2aeada[_0xc928('0x2d')][_0xc928('0x3e')]){_0x322643[_0xc928('0x3f')]=[{'all':!![]}];}return db[_0xc928('0x40')][_0xc928('0x41')](_0x322643);})['then'](function(_0x1be61a){_0x447a30[_0xc928('0x42')]=_0x1be61a;return _0x447a30;})['then'](respondWithFilteredResult(_0x295335,_0x322643))['catch'](handleError(_0x295335,null));};exports[_0xc928('0x43')]=function(_0x15506a,_0x1ce13d){var _0x1cd95a={'raw':![],'where':{'id':_0x15506a[_0xc928('0x44')]['id']}},_0x34b7b8={};_0x34b7b8['model']=_[_0xc928('0x2e')](db['VoiceChanSpy'][_0xc928('0x2a')]);_0x34b7b8[_0xc928('0x2d')]=_[_0xc928('0x2e')](_0x15506a[_0xc928('0x2d')]);_0x34b7b8[_0xc928('0x2f')]=_['intersection'](_0x34b7b8['model'],_0x34b7b8[_0xc928('0x2d')]);_0x1cd95a[_0xc928('0x31')]=_['intersection'](_0x34b7b8[_0xc928('0x2c')],qs[_0xc928('0x32')](_0x15506a[_0xc928('0x2d')]['fields']));_0x1cd95a[_0xc928('0x31')]=_0x1cd95a[_0xc928('0x31')][_0xc928('0x33')]?_0x1cd95a[_0xc928('0x31')]:_0x34b7b8['model'];if(_0x15506a[_0xc928('0x2d')][_0xc928('0x3e')]){_0x1cd95a['include']=[{'all':!![]}];}_0x1cd95a=_[_0xc928('0x3b')]({},_0x1cd95a,_0x15506a[_0xc928('0x3d')]);return db[_0xc928('0x40')][_0xc928('0x45')](_0x1cd95a)[_0xc928('0x22')](handleEntityNotFound(_0x1ce13d,null))[_0xc928('0x22')](respondWithResult(_0x1ce13d,null))['catch'](handleError(_0x1ce13d,null));};exports[_0xc928('0x46')]=function(_0x3623b6,_0x528786){return db['VoiceChanSpy'][_0xc928('0x46')](_0x3623b6[_0xc928('0x47')],{})[_0xc928('0x22')](function(_0x154a59){var _0x45e3ac=_0x3623b6[_0xc928('0x48')][_0xc928('0x21')]({'plain':!![]});if(!_0x45e3ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45e3ac['role']===_0xc928('0x48')){var _0x2fdabf=_0x154a59[_0xc928('0x21')]({'plain':!![]});var _0x495f60=_0xc928('0x49');return db[_0xc928('0x4a')]['find']({'where':{'name':_0x495f60,'userProfileId':_0x45e3ac[_0xc928('0x4b')]},'raw':!![]})[_0xc928('0x22')](function(_0xc44393){if(_0xc44393&&_0xc44393[_0xc928('0x4c')]===0x0){return db[_0xc928('0x4d')][_0xc928('0x46')]({'name':_0x2fdabf[_0xc928('0x26')],'resourceId':_0x2fdabf['id'],'type':_0xc44393[_0xc928('0x26')],'sectionId':_0xc44393['id']},{})[_0xc928('0x22')](function(){return _0x154a59;});}else{return _0x154a59;}})[_0xc928('0x4e')](function(_0xd22c11){logger[_0xc928('0x24')](_0xc928('0x4f'),_0xd22c11);throw _0xd22c11;});}return _0x154a59;})[_0xc928('0x22')](respondWithResult(_0x528786,0xc9))[_0xc928('0x4e')](handleError(_0x528786,null));};exports[_0xc928('0x50')]=function(_0x2fd37e,_0x2443a4){if(_0x2fd37e[_0xc928('0x47')]['id']){delete _0x2fd37e['body']['id'];}return db[_0xc928('0x40')][_0xc928('0x45')]({'where':{'id':_0x2fd37e[_0xc928('0x44')]['id']}})[_0xc928('0x22')](handleEntityNotFound(_0x2443a4,null))[_0xc928('0x22')](saveUpdates(_0x2fd37e[_0xc928('0x47')],null))[_0xc928('0x22')](respondWithResult(_0x2443a4,null))[_0xc928('0x4e')](handleError(_0x2443a4,null));};exports[_0xc928('0x20')]=function(_0x278293,_0x2a22e5){return db[_0xc928('0x40')][_0xc928('0x45')]({'where':{'id':_0x278293[_0xc928('0x44')]['id']}})[_0xc928('0x22')](handleEntityNotFound(_0x2a22e5,null))[_0xc928('0x22')](removeEntity(_0x2a22e5,null))[_0xc928('0x4e')](handleError(_0x2a22e5,null));}; \ No newline at end of file +var _0x7834=['create','body','user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','error','name','send','index','VoiceChanSpy','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','rawAttributes','catch'];(function(_0x4e9a22,_0x65e645){var _0x364420=function(_0x4ecb09){while(--_0x4ecb09){_0x4e9a22['push'](_0x4e9a22['shift']());}};_0x364420(++_0x65e645);}(_0x7834,0x13f));var _0x4783=function(_0x4e04a8,_0x2f2d6a){_0x4e04a8=_0x4e04a8-0x0;var _0x6c3e6f=_0x7834[_0x4e04a8];return _0x6c3e6f;};'use strict';var emlformat=require(_0x4783('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4783('0x1'));var rp=require('request-promise');var moment=require(_0x4783('0x2'));var BPromise=require(_0x4783('0x3'));var Mustache=require(_0x4783('0x4'));var util=require(_0x4783('0x5'));var path=require(_0x4783('0x6'));var sox=require(_0x4783('0x7'));var csv=require(_0x4783('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4783('0x9'));var _=require(_0x4783('0xa'));var squel=require('squel');var crypto=require(_0x4783('0xb'));var jsforce=require(_0x4783('0xc'));var deskjs=require(_0x4783('0xd'));var toCsv=require(_0x4783('0x8'));var querystring=require(_0x4783('0xe'));var Papa=require(_0x4783('0xf'));var Redis=require('ioredis');var authService=require(_0x4783('0x10'));var qs=require(_0x4783('0x11'));var as=require(_0x4783('0x12'));var hardwareService=require(_0x4783('0x13'));var logger=require(_0x4783('0x14'))(_0x4783('0x15'));var utils=require(_0x4783('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4783('0x17'))['db'];function respondWithStatusCode(_0x85087d,_0x4ce944){_0x4ce944=_0x4ce944||0xcc;return function(_0x2afbdc){if(_0x2afbdc){return _0x85087d['sendStatus'](_0x4ce944);}return _0x85087d[_0x4783('0x18')](_0x4ce944)[_0x4783('0x19')]();};}function respondWithResult(_0x41d853,_0xecb9f9){_0xecb9f9=_0xecb9f9||0xc8;return function(_0x230ae6){if(_0x230ae6){return _0x41d853['status'](_0xecb9f9)[_0x4783('0x1a')](_0x230ae6);}};}function respondWithFilteredResult(_0x225443,_0x11e996){return function(_0x20788f){if(_0x20788f){var _0x3cb485=typeof _0x11e996[_0x4783('0x1b')]===_0x4783('0x1c')&&typeof _0x11e996[_0x4783('0x1d')]===_0x4783('0x1c');var _0x28c979=_0x20788f[_0x4783('0x1e')];var _0x323a90=_0x3cb485?0x0:_0x11e996['offset'];var _0x465ed7=_0x3cb485?_0x20788f[_0x4783('0x1e')]:_0x11e996['offset']+_0x11e996[_0x4783('0x1d')];var _0x4a9dc8;if(_0x465ed7>=_0x28c979){_0x465ed7=_0x28c979;_0x4a9dc8=0xc8;}else{_0x4a9dc8=0xce;}_0x225443[_0x4783('0x18')](_0x4a9dc8);return _0x225443[_0x4783('0x1f')](_0x4783('0x20'),_0x323a90+'-'+_0x465ed7+'/'+_0x28c979)[_0x4783('0x1a')](_0x20788f);}return null;};}function patchUpdates(_0x1b5e90){return function(_0x2772b3){try{jsonpatch[_0x4783('0x21')](_0x2772b3,_0x1b5e90,!![]);}catch(_0x4e15d7){return BPromise[_0x4783('0x22')](_0x4e15d7);}return _0x2772b3['save']();};}function saveUpdates(_0x429801,_0x2d592f){return function(_0x46ada4){if(_0x46ada4){return _0x46ada4[_0x4783('0x23')](_0x429801)[_0x4783('0x24')](function(_0x54529d){return _0x54529d;});}return null;};}function removeEntity(_0x2633e6,_0x16ee3a){return function(_0xba686e){if(_0xba686e){return _0xba686e[_0x4783('0x25')]()[_0x4783('0x24')](function(){var _0x1c7ebf=_0xba686e[_0x4783('0x26')]({'plain':!![]});var _0x48da76=_0x4783('0x27');return db[_0x4783('0x28')]['destroy']({'where':{'type':_0x48da76,'resourceId':_0x1c7ebf['id']}})['then'](function(){return _0xba686e;});})[_0x4783('0x24')](function(){_0x2633e6[_0x4783('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106b09,_0x532961){return function(_0x5c5a6a){if(!_0x5c5a6a){_0x106b09['sendStatus'](0x194);}return _0x5c5a6a;};}function handleError(_0x575f15,_0x4bb091){_0x4bb091=_0x4bb091||0x1f4;return function(_0x59e49b){logger[_0x4783('0x29')](_0x59e49b['stack']);if(_0x59e49b[_0x4783('0x2a')]){delete _0x59e49b[_0x4783('0x2a')];}_0x575f15[_0x4783('0x18')](_0x4bb091)[_0x4783('0x2b')](_0x59e49b);};}exports[_0x4783('0x2c')]=function(_0x52b18f,_0x1e23f4){var _0x2e8ede={},_0x54d5da={},_0x1020ac={'count':0x0,'rows':[]};var _0x54ed15=_['map'](db[_0x4783('0x2d')]['rawAttributes'],function(_0x299660){return{'name':_0x299660['fieldName'],'type':_0x299660[_0x4783('0x2e')][_0x4783('0x2f')]};});_0x54d5da['model']=_[_0x4783('0x30')](_0x54ed15,_0x4783('0x2a'));_0x54d5da[_0x4783('0x31')]=_[_0x4783('0x32')](_0x52b18f['query']);_0x54d5da[_0x4783('0x33')]=_[_0x4783('0x34')](_0x54d5da[_0x4783('0x35')],_0x54d5da[_0x4783('0x31')]);_0x2e8ede['attributes']=_[_0x4783('0x34')](_0x54d5da[_0x4783('0x35')],qs['fields'](_0x52b18f[_0x4783('0x31')][_0x4783('0x36')]));_0x2e8ede[_0x4783('0x37')]=_0x2e8ede[_0x4783('0x37')][_0x4783('0x38')]?_0x2e8ede['attributes']:_0x54d5da[_0x4783('0x35')];if(!_0x52b18f['query']['hasOwnProperty'](_0x4783('0x39'))){_0x2e8ede[_0x4783('0x1d')]=qs[_0x4783('0x1d')](_0x52b18f['query'][_0x4783('0x1d')]);_0x2e8ede['offset']=qs[_0x4783('0x1b')](_0x52b18f['query'][_0x4783('0x1b')]);}_0x2e8ede[_0x4783('0x3a')]=qs[_0x4783('0x3b')](_0x52b18f['query'][_0x4783('0x3b')]);_0x2e8ede['where']=qs[_0x4783('0x33')](_[_0x4783('0x3c')](_0x52b18f[_0x4783('0x31')],_0x54d5da[_0x4783('0x33')]),_0x54ed15);if(_0x52b18f['query'][_0x4783('0x3d')]){_0x2e8ede[_0x4783('0x3e')]=_[_0x4783('0x3f')](_0x2e8ede['where'],{'$or':_[_0x4783('0x30')](_0x54ed15,function(_0x379fad){if(_0x379fad[_0x4783('0x2e')]!=='VIRTUAL'){var _0x49adfd={};_0x49adfd[_0x379fad[_0x4783('0x2a')]]={'$like':'%'+_0x52b18f[_0x4783('0x31')][_0x4783('0x3d')]+'%'};return _0x49adfd;}})});}_0x2e8ede=_[_0x4783('0x3f')]({},_0x2e8ede,_0x52b18f[_0x4783('0x40')]);var _0x158fc8={'where':_0x2e8ede[_0x4783('0x3e')]};return db[_0x4783('0x2d')][_0x4783('0x1e')](_0x158fc8)['then'](function(_0x49e41a){_0x1020ac[_0x4783('0x1e')]=_0x49e41a;if(_0x52b18f['query'][_0x4783('0x41')]){_0x2e8ede[_0x4783('0x42')]=[{'all':!![]}];}return db[_0x4783('0x2d')][_0x4783('0x43')](_0x2e8ede);})['then'](function(_0x409ac6){_0x1020ac[_0x4783('0x44')]=_0x409ac6;return _0x1020ac;})[_0x4783('0x24')](respondWithFilteredResult(_0x1e23f4,_0x2e8ede))['catch'](handleError(_0x1e23f4,null));};exports['show']=function(_0x1b6b69,_0x2bcb38){var _0x560490={'raw':![],'where':{'id':_0x1b6b69['params']['id']}},_0x378c0e={};_0x378c0e[_0x4783('0x35')]=_[_0x4783('0x32')](db[_0x4783('0x2d')][_0x4783('0x45')]);_0x378c0e[_0x4783('0x31')]=_[_0x4783('0x32')](_0x1b6b69[_0x4783('0x31')]);_0x378c0e[_0x4783('0x33')]=_['intersection'](_0x378c0e['model'],_0x378c0e[_0x4783('0x31')]);_0x560490['attributes']=_[_0x4783('0x34')](_0x378c0e[_0x4783('0x35')],qs[_0x4783('0x36')](_0x1b6b69[_0x4783('0x31')][_0x4783('0x36')]));_0x560490[_0x4783('0x37')]=_0x560490[_0x4783('0x37')][_0x4783('0x38')]?_0x560490[_0x4783('0x37')]:_0x378c0e[_0x4783('0x35')];if(_0x1b6b69[_0x4783('0x31')][_0x4783('0x41')]){_0x560490['include']=[{'all':!![]}];}_0x560490=_['merge']({},_0x560490,_0x1b6b69[_0x4783('0x40')]);return db[_0x4783('0x2d')]['find'](_0x560490)['then'](handleEntityNotFound(_0x2bcb38,null))[_0x4783('0x24')](respondWithResult(_0x2bcb38,null))[_0x4783('0x46')](handleError(_0x2bcb38,null));};exports[_0x4783('0x47')]=function(_0x5b248f,_0x3dbd65){return db['VoiceChanSpy'][_0x4783('0x47')](_0x5b248f[_0x4783('0x48')],{})['then'](function(_0x5bd97f){var _0x58c570=_0x5b248f[_0x4783('0x49')][_0x4783('0x26')]({'plain':!![]});if(!_0x58c570)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58c570[_0x4783('0x4a')]===_0x4783('0x49')){var _0x51a14f=_0x5bd97f[_0x4783('0x26')]({'plain':!![]});var _0x4c2b3a=_0x4783('0x27');return db['UserProfileSection'][_0x4783('0x4b')]({'where':{'name':_0x4c2b3a,'userProfileId':_0x58c570['userProfileId']},'raw':!![]})[_0x4783('0x24')](function(_0x4974f6){if(_0x4974f6&&_0x4974f6['autoAssociation']===0x0){return db['UserProfileResource'][_0x4783('0x47')]({'name':_0x51a14f['name'],'resourceId':_0x51a14f['id'],'type':_0x4974f6[_0x4783('0x2a')],'sectionId':_0x4974f6['id']},{})[_0x4783('0x24')](function(){return _0x5bd97f;});}else{return _0x5bd97f;}})[_0x4783('0x46')](function(_0xac3410){logger[_0x4783('0x29')](_0x4783('0x4c'),_0xac3410);throw _0xac3410;});}return _0x5bd97f;})['then'](respondWithResult(_0x3dbd65,0xc9))['catch'](handleError(_0x3dbd65,null));};exports[_0x4783('0x23')]=function(_0x366a80,_0x911ce4){if(_0x366a80[_0x4783('0x48')]['id']){delete _0x366a80['body']['id'];}return db[_0x4783('0x2d')][_0x4783('0x4b')]({'where':{'id':_0x366a80[_0x4783('0x4d')]['id']}})[_0x4783('0x24')](handleEntityNotFound(_0x911ce4,null))[_0x4783('0x24')](saveUpdates(_0x366a80[_0x4783('0x48')],null))[_0x4783('0x24')](respondWithResult(_0x911ce4,null))['catch'](handleError(_0x911ce4,null));};exports['destroy']=function(_0x2099f9,_0x74b4ce){return db[_0x4783('0x2d')][_0x4783('0x4b')]({'where':{'id':_0x2099f9[_0x4783('0x4d')]['id']}})[_0x4783('0x24')](handleEntityNotFound(_0x74b4ce,null))[_0x4783('0x24')](removeEntity(_0x74b4ce,null))[_0x4783('0x46')](handleError(_0x74b4ce,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index fac8a9b..111827b 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 _0x0ff7=['models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','%s%s','prefix','system','push','merge','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports'];(function(_0x1b11af,_0x13d80d){var _0x293088=function(_0x25d09f){while(--_0x25d09f){_0x1b11af['push'](_0x1b11af['shift']());}};_0x293088(++_0x13d80d);}(_0x0ff7,0x126));var _0x70ff=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0ff7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x70ff('0x0'));var util=require(_0x70ff('0x1'));var BPromise=require(_0x70ff('0x2'));var attributes=require(_0x70ff('0x3'));var getUserApplications=function(_0xe35573,_0x37d4c3,_0x4b95ba){var _0x965220=0x1;var _0x4c6882=[];var _0x162db0={'context':_0x37d4c3[_0x70ff('0x4')]||_0x70ff('0x5'),'exten':util['format'](_0x70ff('0x6'),_0xe35573[_0x70ff('0x7')],_0x4b95ba),'type':_0x70ff('0x8'),'isApp':![],'ChanSpyId':_0xe35573['id'],'UserId':_0x37d4c3['id']};_0x4c6882[_0x70ff('0x9')](_[_0x70ff('0xa')]({'app':'Set','appdata':util[_0x70ff('0xb')](_0x70ff('0xc'),_0x70ff('0xd')),'priority':_0x965220++},_0x162db0));if(_0xe35573[_0x70ff('0xe')]){_0x4c6882[_0x70ff('0x9')](_[_0x70ff('0xa')]({'app':_0x70ff('0xf'),'appdata':util[_0x70ff('0xb')](_0x70ff('0x10'),_0xe35573[_0x70ff('0x11')]),'priority':_0x965220++},_0x162db0));}if(_0xe35573[_0x70ff('0x12')]){_0x4c6882[_0x70ff('0x9')](_[_0x70ff('0xa')]({'app':'Authenticate','appdata':_0xe35573[_0x70ff('0x13')],'priority':_0x965220++},_0x162db0));}_0x4c6882[_0x70ff('0x9')](_[_0x70ff('0xa')]({'app':_0x70ff('0x14'),'appdata':util[_0x70ff('0xb')](_0x70ff('0x15'),_0x37d4c3[_0x70ff('0x16')],_0xe35573['options']?_0xe35573[_0x70ff('0x17')][_0x70ff('0x18')](''):''),'priority':_0x965220++},_0x162db0));if(_0xe35573['record']){_0x4c6882[_0x70ff('0x9')](_['merge']({'app':_0x70ff('0x19'),'priority':_0x965220++},_0x162db0));}return _0x4c6882;};var getChanSpyApplications=function(_0x1fac3e,_0xf13377){var _0x2eb12a=[];for(var _0x588b84=0x0,_0x34387e=0x1;_0x588b84<_0xf13377[_0x70ff('0x1a')];_0x588b84++,_0x34387e=0x1){_0x2eb12a=_0x2eb12a[_0x70ff('0x1b')](getUserApplications(_0x1fac3e,_0xf13377[_0x588b84],_0xf13377[_0x588b84]['internal']));if(_0xf13377[_0x588b84][_0x70ff('0x1c')]!=_0xf13377[_0x588b84][_0x70ff('0x16')]){_0x2eb12a=_0x2eb12a[_0x70ff('0x1b')](getUserApplications(_0x1fac3e,_0xf13377[_0x588b84],_0xf13377[_0x588b84][_0x70ff('0x16')]));}}return _0x2eb12a;};var getChanSpyPromise=function(_0x159949,_0x257d79){return new BPromise(function(_0x189b44,_0x4edd49){return _0x159949['User'][_0x70ff('0x1d')]({'attributes':['id',_0x70ff('0x16'),'internal'],'where':{'role':_0x70ff('0x1e'),'chanspy':!![]},'raw':!![]})[_0x70ff('0x1f')](function(_0x4c3d33){if(_0x4c3d33){return _0x189b44(getChanSpyApplications(_0x257d79,_0x4c3d33));}return _0x189b44([]);})[_0x70ff('0x20')](function(_0x59d4fb){_0x4edd49(_0x59d4fb);});});};module[_0x70ff('0x21')]=function(_0x3fa3b2,_0x233e1c){var _0x515910=_0x3fa3b2[_0x70ff('0x22')];return _0x3fa3b2[_0x70ff('0x23')](_0x70ff('0x24'),attributes,{'tableName':_0x70ff('0x25'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xf85bbb,_0x2aced9,_0x241266){return getChanSpyPromise(_0x515910,_0xf85bbb)[_0x70ff('0x1f')](function(_0x55fe07){if(_0x55fe07&&_0x55fe07[_0x70ff('0x1a')]){return _0x515910[_0x70ff('0x26')][_0x70ff('0x27')](_0x55fe07);}})[_0x70ff('0x1f')](function(){_0x241266();})[_0x70ff('0x20')](function(_0x525907){_0x241266(_0x525907);});},'afterUpdate':function(_0xf1902a,_0x11d85f,_0x40f9b8){return _0x515910['VoiceExtension'][_0x70ff('0x28')]({'where':{'ChanSpyId':_0xf1902a['id']}})[_0x70ff('0x1f')](function(){return getChanSpyPromise(_0x515910,_0xf1902a);})[_0x70ff('0x1f')](function(_0x3e7a62){if(_0x3e7a62&&_0x3e7a62[_0x70ff('0x1a')]){return _0x515910['VoiceExtension'][_0x70ff('0x27')](_0x3e7a62);}})[_0x70ff('0x1f')](function(){_0x40f9b8();})[_0x70ff('0x20')](function(_0x2e4a70){_0x40f9b8(_0x2e4a70);});},'afterDestroy':function(_0x5083ef,_0xddb246,_0x16eb71){return _0x515910[_0x70ff('0x26')][_0x70ff('0x28')]({'where':{'ChanSpyId':_0x5083ef['id']}})[_0x70ff('0x1f')](function(){_0x16eb71();})['catch'](function(_0x4787dc){_0x16eb71(_0x4787dc);});}}});}; \ No newline at end of file +var _0x1e6f=['format','prefix','merge','Set','CDR(type)=%s','chanspy','record','push','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','context','from-sip'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0x1e6f,0xe0));var _0xf1e6=function(_0x470790,_0x27a250){_0x470790=_0x470790-0x0;var _0x2a6cab=_0x1e6f[_0x470790];return _0x2a6cab;};'use strict';var _=require(_0xf1e6('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xf1e6('0x1'));var getUserApplications=function(_0x2dff4f,_0x5c3c14,_0x48f7d3){var _0x1e38df=0x1;var _0x446123=[];var _0x2f9c3b={'context':_0x5c3c14[_0xf1e6('0x2')]||_0xf1e6('0x3'),'exten':util[_0xf1e6('0x4')]('%s%s',_0x2dff4f[_0xf1e6('0x5')],_0x48f7d3),'type':'system','isApp':![],'ChanSpyId':_0x2dff4f['id'],'UserId':_0x5c3c14['id']};_0x446123['push'](_[_0xf1e6('0x6')]({'app':_0xf1e6('0x7'),'appdata':util[_0xf1e6('0x4')](_0xf1e6('0x8'),_0xf1e6('0x9')),'priority':_0x1e38df++},_0x2f9c3b));if(_0x2dff4f[_0xf1e6('0xa')]){_0x446123[_0xf1e6('0xb')](_[_0xf1e6('0x6')]({'app':'MixMonitor','appdata':util['format'](_0xf1e6('0xc'),_0x2dff4f[_0xf1e6('0xd')]),'priority':_0x1e38df++},_0x2f9c3b));}if(_0x2dff4f[_0xf1e6('0xe')]){_0x446123[_0xf1e6('0xb')](_['merge']({'app':_0xf1e6('0xf'),'appdata':_0x2dff4f[_0xf1e6('0x10')],'priority':_0x1e38df++},_0x2f9c3b));}_0x446123[_0xf1e6('0xb')](_[_0xf1e6('0x6')]({'app':_0xf1e6('0x11'),'appdata':util[_0xf1e6('0x4')](_0xf1e6('0x12'),_0x5c3c14[_0xf1e6('0x13')],_0x2dff4f['options']?_0x2dff4f[_0xf1e6('0x14')][_0xf1e6('0x15')](''):''),'priority':_0x1e38df++},_0x2f9c3b));if(_0x2dff4f[_0xf1e6('0xa')]){_0x446123['push'](_['merge']({'app':'StopMixMonitor','priority':_0x1e38df++},_0x2f9c3b));}return _0x446123;};var getChanSpyApplications=function(_0x5c4153,_0x1e8ee4){var _0x105215=[];for(var _0x1bca28=0x0,_0x563b75=0x1;_0x1bca28<_0x1e8ee4[_0xf1e6('0x16')];_0x1bca28++,_0x563b75=0x1){_0x105215=_0x105215[_0xf1e6('0x17')](getUserApplications(_0x5c4153,_0x1e8ee4[_0x1bca28],_0x1e8ee4[_0x1bca28]['internal']));if(_0x1e8ee4[_0x1bca28][_0xf1e6('0x18')]!=_0x1e8ee4[_0x1bca28][_0xf1e6('0x13')]){_0x105215=_0x105215[_0xf1e6('0x17')](getUserApplications(_0x5c4153,_0x1e8ee4[_0x1bca28],_0x1e8ee4[_0x1bca28]['name']));}}return _0x105215;};var getChanSpyPromise=function(_0x3fc6c9,_0x2353f3){return new BPromise(function(_0x56e3af,_0x4fc2f5){return _0x3fc6c9[_0xf1e6('0x19')][_0xf1e6('0x1a')]({'attributes':['id',_0xf1e6('0x13'),_0xf1e6('0x18')],'where':{'role':_0xf1e6('0x1b'),'chanspy':!![]},'raw':!![]})[_0xf1e6('0x1c')](function(_0x208b91){if(_0x208b91){return _0x56e3af(getChanSpyApplications(_0x2353f3,_0x208b91));}return _0x56e3af([]);})[_0xf1e6('0x1d')](function(_0x4379de){_0x4fc2f5(_0x4379de);});});};module[_0xf1e6('0x1e')]=function(_0x4eaf25,_0x21fe5a){var _0x54f20c=_0x4eaf25[_0xf1e6('0x1f')];return _0x4eaf25[_0xf1e6('0x20')](_0xf1e6('0x21'),attributes,{'tableName':_0xf1e6('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7725c2,_0x3d8fba,_0x140422){return getChanSpyPromise(_0x54f20c,_0x7725c2)[_0xf1e6('0x1c')](function(_0x30ca47){if(_0x30ca47&&_0x30ca47[_0xf1e6('0x16')]){return _0x54f20c[_0xf1e6('0x23')][_0xf1e6('0x24')](_0x30ca47);}})['then'](function(){_0x140422();})[_0xf1e6('0x1d')](function(_0x50b09f){_0x140422(_0x50b09f);});},'afterUpdate':function(_0xdc42f7,_0x4b4b15,_0x2de13b){return _0x54f20c[_0xf1e6('0x23')][_0xf1e6('0x25')]({'where':{'ChanSpyId':_0xdc42f7['id']}})[_0xf1e6('0x1c')](function(){return getChanSpyPromise(_0x54f20c,_0xdc42f7);})[_0xf1e6('0x1c')](function(_0x4f7971){if(_0x4f7971&&_0x4f7971[_0xf1e6('0x16')]){return _0x54f20c[_0xf1e6('0x23')][_0xf1e6('0x24')](_0x4f7971);}})[_0xf1e6('0x1c')](function(){_0x2de13b();})['catch'](function(_0x43fe52){_0x2de13b(_0x43fe52);});},'afterDestroy':function(_0x12340d,_0x2696da,_0x500dc4){return _0x54f20c[_0xf1e6('0x23')][_0xf1e6('0x25')]({'where':{'ChanSpyId':_0x12340d['id']}})[_0xf1e6('0x1c')](function(){_0x500dc4();})[_0xf1e6('0x1d')](function(_0x171f71){_0x500dc4(_0x171f71);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 95016ea..405e7b8 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 _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x5712,0x140));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file +var _0x6f0d=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent'];(function(_0x51ed11,_0x1721d4){var _0xe436ed=function(_0x2eb689){while(--_0x2eb689){_0x51ed11['push'](_0x51ed11['shift']());}};_0xe436ed(++_0x1721d4);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2396c0,_0x5d771f){_0x2396c0=_0x2396c0-0x0;var _0x3a9104=_0x6f0d[_0x2396c0];return _0x3a9104;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 90140dc..db9078e 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 _0x59ba=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports'];(function(_0x3b7277,_0x1cd98b){var _0x2c73ad=function(_0x455580){while(--_0x455580){_0x3b7277['push'](_0x3b7277['shift']());}};_0x2c73ad(++_0x1cd98b);}(_0x59ba,0x7e));var _0xa59b=function(_0x2e1090,_0x27b823){_0x2e1090=_0x2e1090-0x0;var _0x59f8e1=_0x59ba[_0x2e1090];return _0x59f8e1;};'use strict';var multer=require('multer');var util=require(_0xa59b('0x0'));var path=require(_0xa59b('0x1'));var timeout=require(_0xa59b('0x2'));var express=require(_0xa59b('0x3'));var router=express[_0xa59b('0x4')]();var fs_extra=require(_0xa59b('0x5'));var auth=require(_0xa59b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa59b('0x7'));var controller=require(_0xa59b('0x8'));router[_0xa59b('0x9')]('/',auth[_0xa59b('0xa')](),controller[_0xa59b('0xb')]);router[_0xa59b('0x9')](_0xa59b('0xc'),auth['isAuthenticated'](),controller[_0xa59b('0xd')]);router[_0xa59b('0xe')]('/',auth[_0xa59b('0xa')](),controller['create']);router[_0xa59b('0xf')](_0xa59b('0xc'),auth[_0xa59b('0xa')](),controller[_0xa59b('0x10')]);router['delete'](_0xa59b('0xc'),auth[_0xa59b('0xa')](),controller['destroy']);module[_0xa59b('0x11')]=router; \ No newline at end of file +var _0x90cd=['fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','post','update','delete','exports','util','path','express','Router'];(function(_0x4f3e6a,_0x2aa2da){var _0x41827d=function(_0x364653){while(--_0x364653){_0x4f3e6a['push'](_0x4f3e6a['shift']());}};_0x41827d(++_0x2aa2da);}(_0x90cd,0xf8));var _0xd90c=function(_0x25792f,_0x392e1b){_0x25792f=_0x25792f-0x0;var _0xccd992=_0x90cd[_0x25792f];return _0xccd992;};'use strict';var multer=require('multer');var util=require(_0xd90c('0x0'));var path=require(_0xd90c('0x1'));var timeout=require('connect-timeout');var express=require(_0xd90c('0x2'));var router=express[_0xd90c('0x3')]();var fs_extra=require(_0xd90c('0x4'));var auth=require(_0xd90c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd90c('0x6'));var controller=require(_0xd90c('0x7'));router[_0xd90c('0x8')]('/',auth[_0xd90c('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd90c('0xa')]('/',auth[_0xd90c('0x9')](),controller['create']);router['put']('/:id',auth[_0xd90c('0x9')](),controller[_0xd90c('0xb')]);router[_0xd90c('0xc')]('/:id',auth[_0xd90c('0x9')](),controller['destroy']);module[_0xd90c('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f534db4..ae9b6eb 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 _0x5d9b=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x30c8d3,_0x14fcc9){var _0x471882=function(_0x465610){while(--_0x465610){_0x30c8d3['push'](_0x30c8d3['shift']());}};_0x471882(++_0x14fcc9);}(_0x5d9b,0x8f));var _0xb5d9=function(_0x5a7728,_0x2bbc2d){_0x5a7728=_0x5a7728-0x0;var _0x239a01=_0x5d9b[_0x5a7728];return _0x239a01;};'use strict';var Sequelize=require(_0xb5d9('0x0'));module[_0xb5d9('0x1')]={'name':{'type':Sequelize[_0xb5d9('0x2')],'unique':_0xb5d9('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb5d9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x36f2=['STRING','name','BOOLEAN','sequelize'];(function(_0xbe48c2,_0x3db103){var _0x39a679=function(_0x195d37){while(--_0x195d37){_0xbe48c2['push'](_0xbe48c2['shift']());}};_0x39a679(++_0x3db103);}(_0x36f2,0x123));var _0x236f=function(_0x315d20,_0x36f53f){_0x315d20=_0x315d20-0x0;var _0x43dc75=_0x36f2[_0x315d20];return _0x43dc75;};'use strict';var Sequelize=require(_0x236f('0x0'));module['exports']={'name':{'type':Sequelize[_0x236f('0x1')],'unique':_0x236f('0x2')},'description':{'type':Sequelize[_0x236f('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x236f('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 5c0f14f..a8420c8 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 _0xe0bc=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','pick','merge','map','VIRTUAL','filter','where','includeAll','findAll','rows','show','params','keys','include','options','catch','create','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','update','readFileSync','root','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','bluebird','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end'];(function(_0x2e133e,_0x30ba09){var _0xe23821=function(_0x49a739){while(--_0x49a739){_0x2e133e['push'](_0x2e133e['shift']());}};_0xe23821(++_0x30ba09);}(_0xe0bc,0x17c));var _0xce0b=function(_0x2fa3a3,_0x46b2b0){_0x2fa3a3=_0x2fa3a3-0x0;var _0xe5a9a6=_0xe0bc[_0x2fa3a3];return _0xe5a9a6;};'use strict';var emlformat=require(_0xce0b('0x0'));var rimraf=require(_0xce0b('0x1'));var zipdir=require(_0xce0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce0b('0x3'));var moment=require('moment');var BPromise=require(_0xce0b('0x4'));var Mustache=require(_0xce0b('0x5'));var util=require(_0xce0b('0x6'));var path=require(_0xce0b('0x7'));var sox=require(_0xce0b('0x8'));var csv=require(_0xce0b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce0b('0xa'));var _=require(_0xce0b('0xb'));var squel=require(_0xce0b('0xc'));var crypto=require(_0xce0b('0xd'));var jsforce=require(_0xce0b('0xe'));var deskjs=require(_0xce0b('0xf'));var toCsv=require(_0xce0b('0x9'));var querystring=require('querystring');var Papa=require(_0xce0b('0x10'));var Redis=require(_0xce0b('0x11'));var authService=require(_0xce0b('0x12'));var qs=require(_0xce0b('0x13'));var as=require(_0xce0b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce0b('0x15'))(_0xce0b('0x16'));var utils=require(_0xce0b('0x17'));var config=require(_0xce0b('0x18'));var licenseUtil=require(_0xce0b('0x19'));var db=require(_0xce0b('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xce0b('0x1b')][_0xce0b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1c81c6,_0x2ae344,_0x3b4d20,_0x693e01){return new BPromise(function(_0x379faa,_0x40ebfa){var _0x1ec826=_0x693e01||client;return _0x1ec826[_0xce0b('0x1d')](_0x1c81c6,_0x3b4d20)[_0xce0b('0x1e')](function(_0x1128b9){logger['info'](_0xce0b('0x1f'),_0x2ae344,_0xce0b('0x20'));logger[_0xce0b('0x21')](_0xce0b('0x22'),_0x2ae344,_0xce0b('0x20'),JSON[_0xce0b('0x23')](_0x1128b9));if(_0x1128b9[_0xce0b('0x24')]){if(_0x1128b9[_0xce0b('0x24')][_0xce0b('0x25')]===0x1f4){logger[_0xce0b('0x24')](_0xce0b('0x1f'),_0x2ae344,_0x1128b9[_0xce0b('0x24')][_0xce0b('0x26')]);return _0x40ebfa(_0x1128b9['error'][_0xce0b('0x26')]);}logger[_0xce0b('0x24')](_0xce0b('0x1f'),_0x2ae344,_0x1128b9[_0xce0b('0x24')][_0xce0b('0x26')]);return _0x379faa(_0x1128b9['error'][_0xce0b('0x26')]);}else{logger[_0xce0b('0x27')](_0xce0b('0x1f'),_0x2ae344,_0xce0b('0x20'));_0x379faa(_0x1128b9[_0xce0b('0x28')][_0xce0b('0x26')]);}})['catch'](function(_0xd602c8){logger['error'](_0xce0b('0x1f'),_0x2ae344,_0xd602c8);_0x40ebfa(_0xd602c8);});});}function respondWithStatusCode(_0x2b84d6,_0x275c8c){_0x275c8c=_0x275c8c||0xcc;return function(_0xe59465){if(_0xe59465){return _0x2b84d6[_0xce0b('0x29')](_0x275c8c);}return _0x2b84d6[_0xce0b('0x2a')](_0x275c8c)[_0xce0b('0x2b')]();};}function respondWithResult(_0x3f57bd,_0x561fb7){_0x561fb7=_0x561fb7||0xc8;return function(_0x4dfa3a){if(_0x4dfa3a){return _0x3f57bd[_0xce0b('0x2a')](_0x561fb7)[_0xce0b('0x2c')](_0x4dfa3a);}};}function respondWithFilteredResult(_0x474f6c,_0x44fe4a){return function(_0x32dcc4){if(_0x32dcc4){var _0x1d557f=typeof _0x44fe4a[_0xce0b('0x2d')]===_0xce0b('0x2e')&&typeof _0x44fe4a[_0xce0b('0x2f')]==='undefined';var _0x4e4dbf=_0x32dcc4[_0xce0b('0x30')];var _0x18c245=_0x1d557f?0x0:_0x44fe4a[_0xce0b('0x2d')];var _0x500abb=_0x1d557f?_0x32dcc4[_0xce0b('0x30')]:_0x44fe4a[_0xce0b('0x2d')]+_0x44fe4a[_0xce0b('0x2f')];var _0x2a7767;if(_0x500abb>=_0x4e4dbf){_0x500abb=_0x4e4dbf;_0x2a7767=0xc8;}else{_0x2a7767=0xce;}_0x474f6c[_0xce0b('0x2a')](_0x2a7767);return _0x474f6c[_0xce0b('0x31')](_0xce0b('0x32'),_0x18c245+'-'+_0x500abb+'/'+_0x4e4dbf)[_0xce0b('0x2c')](_0x32dcc4);}return null;};}function patchUpdates(_0x5b3236){return function(_0x46fb27){try{jsonpatch[_0xce0b('0x33')](_0x46fb27,_0x5b3236,!![]);}catch(_0x3d99fc){return BPromise[_0xce0b('0x34')](_0x3d99fc);}return _0x46fb27[_0xce0b('0x35')]();};}function saveUpdates(_0x346c2b,_0x3a9536){return function(_0x2aa8cf){if(_0x2aa8cf){return _0x2aa8cf['update'](_0x346c2b)['then'](function(_0x596466){return _0x596466;});}return null;};}function removeEntity(_0x10796d,_0x1177d8){return function(_0x340072){if(_0x340072){return _0x340072[_0xce0b('0x36')]()[_0xce0b('0x1e')](function(){var _0x38d03f=_0x340072[_0xce0b('0x37')]({'plain':!![]});var _0x33d886=_0xce0b('0x38');return db[_0xce0b('0x39')][_0xce0b('0x36')]({'where':{'type':_0x33d886,'resourceId':_0x38d03f['id']}})[_0xce0b('0x1e')](function(){return _0x340072;});})[_0xce0b('0x1e')](function(){_0x10796d[_0xce0b('0x2a')](0xcc)[_0xce0b('0x2b')]();});}};}function handleEntityNotFound(_0x2018c1,_0x26db53){return function(_0x362f99){if(!_0x362f99){_0x2018c1[_0xce0b('0x29')](0x194);}return _0x362f99;};}function handleError(_0x1dd760,_0x2289ed){_0x2289ed=_0x2289ed||0x1f4;return function(_0x2f30f2){logger[_0xce0b('0x24')](_0x2f30f2[_0xce0b('0x3a')]);if(_0x2f30f2[_0xce0b('0x3b')]){delete _0x2f30f2[_0xce0b('0x3b')];}_0x1dd760[_0xce0b('0x2a')](_0x2289ed)['send'](_0x2f30f2);};}exports[_0xce0b('0x3c')]=function(_0x3672e6,_0x4db858){var _0x364e0f={},_0x4c72cd={},_0x923a45={'count':0x0,'rows':[]};var _0x1821bb=_['map'](db[_0xce0b('0x3d')][_0xce0b('0x3e')],function(_0x1264a2){return{'name':_0x1264a2[_0xce0b('0x3f')],'type':_0x1264a2[_0xce0b('0x40')][_0xce0b('0x41')]};});_0x4c72cd[_0xce0b('0x42')]=_['map'](_0x1821bb,_0xce0b('0x3b'));_0x4c72cd[_0xce0b('0x43')]=_['keys'](_0x3672e6['query']);_0x4c72cd[_0xce0b('0x44')]=_['intersection'](_0x4c72cd[_0xce0b('0x42')],_0x4c72cd[_0xce0b('0x43')]);_0x364e0f[_0xce0b('0x45')]=_[_0xce0b('0x46')](_0x4c72cd[_0xce0b('0x42')],qs['fields'](_0x3672e6[_0xce0b('0x43')][_0xce0b('0x47')]));_0x364e0f[_0xce0b('0x45')]=_0x364e0f[_0xce0b('0x45')][_0xce0b('0x48')]?_0x364e0f[_0xce0b('0x45')]:_0x4c72cd[_0xce0b('0x42')];if(!_0x3672e6[_0xce0b('0x43')]['hasOwnProperty'](_0xce0b('0x49'))){_0x364e0f[_0xce0b('0x2f')]=qs[_0xce0b('0x2f')](_0x3672e6['query']['limit']);_0x364e0f['offset']=qs[_0xce0b('0x2d')](_0x3672e6['query'][_0xce0b('0x2d')]);}_0x364e0f['order']=qs['sort'](_0x3672e6[_0xce0b('0x43')]['sort']);_0x364e0f['where']=qs[_0xce0b('0x44')](_[_0xce0b('0x4a')](_0x3672e6['query'],_0x4c72cd['filters']),_0x1821bb);if(_0x3672e6[_0xce0b('0x43')]['filter']){_0x364e0f['where']=_[_0xce0b('0x4b')](_0x364e0f['where'],{'$or':_[_0xce0b('0x4c')](_0x1821bb,function(_0x4c0e8b){if(_0x4c0e8b[_0xce0b('0x40')]!==_0xce0b('0x4d')){var _0x140382={};_0x140382[_0x4c0e8b['name']]={'$like':'%'+_0x3672e6[_0xce0b('0x43')][_0xce0b('0x4e')]+'%'};return _0x140382;}})});}_0x364e0f=_[_0xce0b('0x4b')]({},_0x364e0f,_0x3672e6['options']);var _0x12904a={'where':_0x364e0f[_0xce0b('0x4f')]};return db[_0xce0b('0x3d')][_0xce0b('0x30')](_0x12904a)[_0xce0b('0x1e')](function(_0x223ecf){_0x923a45['count']=_0x223ecf;if(_0x3672e6[_0xce0b('0x43')][_0xce0b('0x50')]){_0x364e0f['include']=[{'all':!![]}];}return db[_0xce0b('0x3d')][_0xce0b('0x51')](_0x364e0f);})[_0xce0b('0x1e')](function(_0x212258){_0x923a45[_0xce0b('0x52')]=_0x212258;return _0x923a45;})[_0xce0b('0x1e')](respondWithFilteredResult(_0x4db858,_0x364e0f))['catch'](handleError(_0x4db858,null));};exports[_0xce0b('0x53')]=function(_0x92979d,_0x308fcb){var _0xabe7f={'raw':![],'where':{'id':_0x92979d[_0xce0b('0x54')]['id']}},_0x2209bd={};_0x2209bd[_0xce0b('0x42')]=_[_0xce0b('0x55')](db[_0xce0b('0x3d')][_0xce0b('0x3e')]);_0x2209bd[_0xce0b('0x43')]=_[_0xce0b('0x55')](_0x92979d[_0xce0b('0x43')]);_0x2209bd[_0xce0b('0x44')]=_['intersection'](_0x2209bd[_0xce0b('0x42')],_0x2209bd['query']);_0xabe7f[_0xce0b('0x45')]=_[_0xce0b('0x46')](_0x2209bd[_0xce0b('0x42')],qs[_0xce0b('0x47')](_0x92979d[_0xce0b('0x43')]['fields']));_0xabe7f[_0xce0b('0x45')]=_0xabe7f[_0xce0b('0x45')][_0xce0b('0x48')]?_0xabe7f[_0xce0b('0x45')]:_0x2209bd[_0xce0b('0x42')];if(_0x92979d['query'][_0xce0b('0x50')]){_0xabe7f[_0xce0b('0x56')]=[{'all':!![]}];}_0xabe7f=_[_0xce0b('0x4b')]({},_0xabe7f,_0x92979d[_0xce0b('0x57')]);return db['VoiceContext']['find'](_0xabe7f)['then'](handleEntityNotFound(_0x308fcb,null))[_0xce0b('0x1e')](respondWithResult(_0x308fcb,null))[_0xce0b('0x58')](handleError(_0x308fcb,null));};exports[_0xce0b('0x59')]=function(_0xa42920,_0x5238de,_0x27344f){var _0x512865;return db[_0xce0b('0x3d')][_0xce0b('0x59')](_0xa42920['body'],{'raw':!![]})['then'](function(_0x2de37e){_0x512865=_0x2de37e;return db['VoiceContext'][_0xce0b('0x51')]({'raw':!![]});})[_0xce0b('0x1e')](function(_0xcddb1c){var _0x52dcc0=fs['readFileSync'](path[_0xce0b('0x5a')](config['root'],_0xce0b('0x5b')),_0xce0b('0x5c'));var _0x4e2450=ejs[_0xce0b('0x5d')](_0x52dcc0,{'contexts':_0xcddb1c||[]});fs[_0xce0b('0x5e')](_0xce0b('0x5f'),_0x4e2450);})[_0xce0b('0x1e')](function(){return respondWithRpcPromise('Reload',_0xce0b('0x59'),{'module':'chan_sip.so'});})[_0xce0b('0x1e')](function(){var _0x4d7d1c=_0xa42920[_0xce0b('0x60')]['get']({'plain':!![]});if(!_0x4d7d1c)throw new Error(_0xce0b('0x61'));if(_0x4d7d1c[_0xce0b('0x62')]===_0xce0b('0x60')){var _0x5a93c7=_0x512865['get']({'plain':!![]});return db[_0xce0b('0x63')][_0xce0b('0x64')]({'where':{'name':_0xce0b('0x38'),'userProfileId':_0x4d7d1c['userProfileId']},'raw':!![]})[_0xce0b('0x1e')](function(_0x7c9796){if(_0x7c9796&&_0x7c9796['autoAssociation']===0x0){return db['UserProfileResource'][_0xce0b('0x59')]({'name':_0x5a93c7['name'],'resourceId':_0x5a93c7['id'],'type':_0x7c9796[_0xce0b('0x3b')],'sectionId':_0x7c9796['id']},{})[_0xce0b('0x1e')](function(){return _0x512865;});}else{return _0x512865;}})[_0xce0b('0x58')](function(_0x23df9b){logger[_0xce0b('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23df9b);throw _0x23df9b;});}return _0x512865;})[_0xce0b('0x1e')](respondWithResult(_0x5238de,0xc9))[_0xce0b('0x58')](handleError(_0x5238de,null));};exports[_0xce0b('0x65')]=function(_0x225ef7,_0x32a3d0,_0x5a12ec){var _0x408a69;return db[_0xce0b('0x3d')][_0xce0b('0x64')]({'where':{'id':_0x225ef7['params']['id']}})[_0xce0b('0x1e')](handleEntityNotFound(_0x32a3d0,null))['then'](saveUpdates(_0x225ef7['body'],null))[_0xce0b('0x1e')](function(_0x2ec0c6){if(_0x2ec0c6){_0x408a69=_0x2ec0c6;return db[_0xce0b('0x3d')]['findAll']({'raw':!![]});}})[_0xce0b('0x1e')](function(_0x1256b3){var _0x25d16e=fs[_0xce0b('0x66')](path['join'](config[_0xce0b('0x67')],_0xce0b('0x5b')),_0xce0b('0x5c'));var _0x182ae6=ejs[_0xce0b('0x5d')](_0x25d16e,{'contexts':_0x1256b3||[]});fs['writeFileSync'](_0xce0b('0x5f'),_0x182ae6);})[_0xce0b('0x1e')](function(){return respondWithRpcPromise(_0xce0b('0x68'),'update',{'module':_0xce0b('0x69')});})[_0xce0b('0x1e')](function(){return _0x408a69;})[_0xce0b('0x1e')](respondWithResult(_0x32a3d0,null))[_0xce0b('0x58')](handleError(_0x32a3d0,null));};exports[_0xce0b('0x36')]=function(_0x48dbf7,_0x21a4ad,_0x3d471d){var _0x1c7393;return db[_0xce0b('0x3d')]['find']({'where':{'id':_0x48dbf7[_0xce0b('0x54')]['id']}})[_0xce0b('0x1e')](handleEntityNotFound(_0x21a4ad,null))[_0xce0b('0x1e')](removeEntity(_0x21a4ad,null))[_0xce0b('0x1e')](function(){return db[_0xce0b('0x3d')]['findAll']({'raw':!![]});})[_0xce0b('0x1e')](function(_0x17c0c3){var _0x31b50a=fs[_0xce0b('0x66')](path['join'](config[_0xce0b('0x67')],_0xce0b('0x5b')),_0xce0b('0x5c'));var _0x544415=ejs[_0xce0b('0x5d')](_0x31b50a,{'contexts':_0x17c0c3});fs[_0xce0b('0x5e')](_0xce0b('0x5f'),_0x544415);return respondWithRpcPromise('Reload',_0xce0b('0x36'),{'module':_0xce0b('0x69')});})[_0xce0b('0x58')](handleError(_0x21a4ad,null));}; \ No newline at end of file +var _0x5faa=['length','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','keys','create','body','readFileSync','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','params','join','root','writeFileSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','get','destroy','stack','name','send','index','map','VoiceContext','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x458140,_0x20964a){var _0x5e4ba1=function(_0x240ca4){while(--_0x240ca4){_0x458140['push'](_0x458140['shift']());}};_0x5e4ba1(++_0x20964a);}(_0x5faa,0x1c4));var _0xa5fa=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x5faa[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5fa('0x0'));var zipdir=require(_0xa5fa('0x1'));var jsonpatch=require(_0xa5fa('0x2'));var rp=require(_0xa5fa('0x3'));var moment=require(_0xa5fa('0x4'));var BPromise=require(_0xa5fa('0x5'));var Mustache=require(_0xa5fa('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa5fa('0x7'));var csv=require(_0xa5fa('0x8'));var ejs=require(_0xa5fa('0x9'));var fs=require('fs');var fs_extra=require(_0xa5fa('0xa'));var _=require(_0xa5fa('0xb'));var squel=require(_0xa5fa('0xc'));var crypto=require(_0xa5fa('0xd'));var jsforce=require(_0xa5fa('0xe'));var deskjs=require(_0xa5fa('0xf'));var toCsv=require(_0xa5fa('0x8'));var querystring=require('querystring');var Papa=require(_0xa5fa('0x10'));var Redis=require(_0xa5fa('0x11'));var authService=require(_0xa5fa('0x12'));var qs=require(_0xa5fa('0x13'));var as=require(_0xa5fa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa5fa('0x15'));var utils=require('../../config/utils');var config=require(_0xa5fa('0x16'));var licenseUtil=require(_0xa5fa('0x17'));var db=require(_0xa5fa('0x18'))['db'];var jayson=require(_0xa5fa('0x19'));var client=jayson[_0xa5fa('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321f9e,_0x4eed81,_0x151ffa,_0x895827){return new BPromise(function(_0xec430a,_0x5222f3){var _0x38bdcf=_0x895827||client;return _0x38bdcf[_0xa5fa('0x1b')](_0x321f9e,_0x151ffa)[_0xa5fa('0x1c')](function(_0x90cfef){logger['info'](_0xa5fa('0x1d'),_0x4eed81,'request\x20sent');logger[_0xa5fa('0x1e')](_0xa5fa('0x1f'),_0x4eed81,_0xa5fa('0x20'),JSON['stringify'](_0x90cfef));if(_0x90cfef[_0xa5fa('0x21')]){if(_0x90cfef[_0xa5fa('0x21')][_0xa5fa('0x22')]===0x1f4){logger[_0xa5fa('0x21')](_0xa5fa('0x1d'),_0x4eed81,_0x90cfef[_0xa5fa('0x21')][_0xa5fa('0x23')]);return _0x5222f3(_0x90cfef[_0xa5fa('0x21')]['message']);}logger[_0xa5fa('0x21')](_0xa5fa('0x1d'),_0x4eed81,_0x90cfef['error']['message']);return _0xec430a(_0x90cfef[_0xa5fa('0x21')][_0xa5fa('0x23')]);}else{logger[_0xa5fa('0x24')]('VoiceContext,\x20%s,\x20%s',_0x4eed81,'request\x20sent');_0xec430a(_0x90cfef[_0xa5fa('0x25')][_0xa5fa('0x23')]);}})[_0xa5fa('0x26')](function(_0x39252){logger[_0xa5fa('0x21')](_0xa5fa('0x1d'),_0x4eed81,_0x39252);_0x5222f3(_0x39252);});});}function respondWithStatusCode(_0x29a9e7,_0x4f00f5){_0x4f00f5=_0x4f00f5||0xcc;return function(_0x3d16e7){if(_0x3d16e7){return _0x29a9e7[_0xa5fa('0x27')](_0x4f00f5);}return _0x29a9e7[_0xa5fa('0x28')](_0x4f00f5)[_0xa5fa('0x29')]();};}function respondWithResult(_0x45cdc5,_0x221e71){_0x221e71=_0x221e71||0xc8;return function(_0x39a030){if(_0x39a030){return _0x45cdc5[_0xa5fa('0x28')](_0x221e71)[_0xa5fa('0x2a')](_0x39a030);}};}function respondWithFilteredResult(_0x514b77,_0x1f895d){return function(_0x49e63f){if(_0x49e63f){var _0x266507=typeof _0x1f895d[_0xa5fa('0x2b')]===_0xa5fa('0x2c')&&typeof _0x1f895d['limit']===_0xa5fa('0x2c');var _0x2b1ff2=_0x49e63f[_0xa5fa('0x2d')];var _0x2fb944=_0x266507?0x0:_0x1f895d[_0xa5fa('0x2b')];var _0x5d3ba9=_0x266507?_0x49e63f[_0xa5fa('0x2d')]:_0x1f895d['offset']+_0x1f895d['limit'];var _0x2c67bf;if(_0x5d3ba9>=_0x2b1ff2){_0x5d3ba9=_0x2b1ff2;_0x2c67bf=0xc8;}else{_0x2c67bf=0xce;}_0x514b77[_0xa5fa('0x28')](_0x2c67bf);return _0x514b77[_0xa5fa('0x2e')](_0xa5fa('0x2f'),_0x2fb944+'-'+_0x5d3ba9+'/'+_0x2b1ff2)[_0xa5fa('0x2a')](_0x49e63f);}return null;};}function patchUpdates(_0x536c8d){return function(_0x472b68){try{jsonpatch[_0xa5fa('0x30')](_0x472b68,_0x536c8d,!![]);}catch(_0x4dcb0c){return BPromise[_0xa5fa('0x31')](_0x4dcb0c);}return _0x472b68['save']();};}function saveUpdates(_0xc89dc5,_0x1b0465){return function(_0x189f04){if(_0x189f04){return _0x189f04[_0xa5fa('0x32')](_0xc89dc5)[_0xa5fa('0x1c')](function(_0xf39354){return _0xf39354;});}return null;};}function removeEntity(_0x179443,_0x44beec){return function(_0x22701d){if(_0x22701d){return _0x22701d['destroy']()[_0xa5fa('0x1c')](function(){var _0x299609=_0x22701d[_0xa5fa('0x33')]({'plain':!![]});var _0x333bfd='Contexts';return db['UserProfileResource'][_0xa5fa('0x34')]({'where':{'type':_0x333bfd,'resourceId':_0x299609['id']}})[_0xa5fa('0x1c')](function(){return _0x22701d;});})[_0xa5fa('0x1c')](function(){_0x179443['status'](0xcc)[_0xa5fa('0x29')]();});}};}function handleEntityNotFound(_0x541fb7,_0x424b1c){return function(_0x418eb1){if(!_0x418eb1){_0x541fb7['sendStatus'](0x194);}return _0x418eb1;};}function handleError(_0x50cacd,_0x282ba4){_0x282ba4=_0x282ba4||0x1f4;return function(_0x1072f5){logger['error'](_0x1072f5[_0xa5fa('0x35')]);if(_0x1072f5[_0xa5fa('0x36')]){delete _0x1072f5[_0xa5fa('0x36')];}_0x50cacd[_0xa5fa('0x28')](_0x282ba4)[_0xa5fa('0x37')](_0x1072f5);};}exports[_0xa5fa('0x38')]=function(_0x3fa4d9,_0x40f92d){var _0x13d12f={},_0x3a6171={},_0x26cfb0={'count':0x0,'rows':[]};var _0x4a200c=_[_0xa5fa('0x39')](db[_0xa5fa('0x3a')]['rawAttributes'],function(_0x42e8c9){return{'name':_0x42e8c9[_0xa5fa('0x3b')],'type':_0x42e8c9[_0xa5fa('0x3c')][_0xa5fa('0x3d')]};});_0x3a6171[_0xa5fa('0x3e')]=_[_0xa5fa('0x39')](_0x4a200c,_0xa5fa('0x36'));_0x3a6171[_0xa5fa('0x3f')]=_['keys'](_0x3fa4d9[_0xa5fa('0x3f')]);_0x3a6171[_0xa5fa('0x40')]=_[_0xa5fa('0x41')](_0x3a6171[_0xa5fa('0x3e')],_0x3a6171[_0xa5fa('0x3f')]);_0x13d12f[_0xa5fa('0x42')]=_[_0xa5fa('0x41')](_0x3a6171[_0xa5fa('0x3e')],qs[_0xa5fa('0x43')](_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x43')]));_0x13d12f[_0xa5fa('0x42')]=_0x13d12f[_0xa5fa('0x42')][_0xa5fa('0x44')]?_0x13d12f['attributes']:_0x3a6171[_0xa5fa('0x3e')];if(!_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x45')]('nolimit')){_0x13d12f[_0xa5fa('0x46')]=qs[_0xa5fa('0x46')](_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x46')]);_0x13d12f['offset']=qs[_0xa5fa('0x2b')](_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x2b')]);}_0x13d12f['order']=qs[_0xa5fa('0x47')](_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x47')]);_0x13d12f[_0xa5fa('0x48')]=qs[_0xa5fa('0x40')](_[_0xa5fa('0x49')](_0x3fa4d9[_0xa5fa('0x3f')],_0x3a6171['filters']),_0x4a200c);if(_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x4a')]){_0x13d12f[_0xa5fa('0x48')]=_['merge'](_0x13d12f[_0xa5fa('0x48')],{'$or':_[_0xa5fa('0x39')](_0x4a200c,function(_0x16a08b){if(_0x16a08b[_0xa5fa('0x3c')]!==_0xa5fa('0x4b')){var _0xe84f1a={};_0xe84f1a[_0x16a08b[_0xa5fa('0x36')]]={'$like':'%'+_0x3fa4d9[_0xa5fa('0x3f')]['filter']+'%'};return _0xe84f1a;}})});}_0x13d12f=_[_0xa5fa('0x4c')]({},_0x13d12f,_0x3fa4d9['options']);var _0x242aab={'where':_0x13d12f[_0xa5fa('0x48')]};return db[_0xa5fa('0x3a')][_0xa5fa('0x2d')](_0x242aab)[_0xa5fa('0x1c')](function(_0x14cffe){_0x26cfb0[_0xa5fa('0x2d')]=_0x14cffe;if(_0x3fa4d9[_0xa5fa('0x3f')][_0xa5fa('0x4d')]){_0x13d12f[_0xa5fa('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0xa5fa('0x4f')](_0x13d12f);})[_0xa5fa('0x1c')](function(_0x35c277){_0x26cfb0[_0xa5fa('0x50')]=_0x35c277;return _0x26cfb0;})[_0xa5fa('0x1c')](respondWithFilteredResult(_0x40f92d,_0x13d12f))[_0xa5fa('0x26')](handleError(_0x40f92d,null));};exports[_0xa5fa('0x51')]=function(_0x46368a,_0x389310){var _0x36826c={'raw':![],'where':{'id':_0x46368a['params']['id']}},_0x13462a={};_0x13462a['model']=_[_0xa5fa('0x52')](db[_0xa5fa('0x3a')]['rawAttributes']);_0x13462a[_0xa5fa('0x3f')]=_['keys'](_0x46368a[_0xa5fa('0x3f')]);_0x13462a[_0xa5fa('0x40')]=_['intersection'](_0x13462a[_0xa5fa('0x3e')],_0x13462a[_0xa5fa('0x3f')]);_0x36826c[_0xa5fa('0x42')]=_['intersection'](_0x13462a[_0xa5fa('0x3e')],qs[_0xa5fa('0x43')](_0x46368a['query'][_0xa5fa('0x43')]));_0x36826c[_0xa5fa('0x42')]=_0x36826c[_0xa5fa('0x42')][_0xa5fa('0x44')]?_0x36826c['attributes']:_0x13462a[_0xa5fa('0x3e')];if(_0x46368a[_0xa5fa('0x3f')][_0xa5fa('0x4d')]){_0x36826c[_0xa5fa('0x4e')]=[{'all':!![]}];}_0x36826c=_[_0xa5fa('0x4c')]({},_0x36826c,_0x46368a['options']);return db[_0xa5fa('0x3a')]['find'](_0x36826c)['then'](handleEntityNotFound(_0x389310,null))[_0xa5fa('0x1c')](respondWithResult(_0x389310,null))[_0xa5fa('0x26')](handleError(_0x389310,null));};exports[_0xa5fa('0x53')]=function(_0x4b8d70,_0x1461a8,_0x2dc187){var _0x5244d9;return db[_0xa5fa('0x3a')][_0xa5fa('0x53')](_0x4b8d70[_0xa5fa('0x54')],{'raw':!![]})['then'](function(_0x44f285){_0x5244d9=_0x44f285;return db[_0xa5fa('0x3a')][_0xa5fa('0x4f')]({'raw':!![]});})[_0xa5fa('0x1c')](function(_0x4ab664){var _0x112307=fs[_0xa5fa('0x55')](path['join'](config['root'],_0xa5fa('0x56')),_0xa5fa('0x57'));var _0x3ef3cc=ejs[_0xa5fa('0x58')](_0x112307,{'contexts':_0x4ab664||[]});fs['writeFileSync'](_0xa5fa('0x59'),_0x3ef3cc);})['then'](function(){return respondWithRpcPromise(_0xa5fa('0x5a'),_0xa5fa('0x53'),{'module':_0xa5fa('0x5b')});})['then'](function(){var _0x498f56=_0x4b8d70['user']['get']({'plain':!![]});if(!_0x498f56)throw new Error(_0xa5fa('0x5c'));if(_0x498f56['role']===_0xa5fa('0x5d')){var _0x310174=_0x5244d9[_0xa5fa('0x33')]({'plain':!![]});return db[_0xa5fa('0x5e')][_0xa5fa('0x5f')]({'where':{'name':_0xa5fa('0x60'),'userProfileId':_0x498f56[_0xa5fa('0x61')]},'raw':!![]})[_0xa5fa('0x1c')](function(_0x2a9215){if(_0x2a9215&&_0x2a9215[_0xa5fa('0x62')]===0x0){return db[_0xa5fa('0x63')][_0xa5fa('0x53')]({'name':_0x310174[_0xa5fa('0x36')],'resourceId':_0x310174['id'],'type':_0x2a9215[_0xa5fa('0x36')],'sectionId':_0x2a9215['id']},{})[_0xa5fa('0x1c')](function(){return _0x5244d9;});}else{return _0x5244d9;}})[_0xa5fa('0x26')](function(_0x5a8d1f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8d1f);throw _0x5a8d1f;});}return _0x5244d9;})[_0xa5fa('0x1c')](respondWithResult(_0x1461a8,0xc9))[_0xa5fa('0x26')](handleError(_0x1461a8,null));};exports[_0xa5fa('0x32')]=function(_0x2d3907,_0x1058cf,_0x34a187){var _0x27749e;return db[_0xa5fa('0x3a')][_0xa5fa('0x5f')]({'where':{'id':_0x2d3907[_0xa5fa('0x64')]['id']}})[_0xa5fa('0x1c')](handleEntityNotFound(_0x1058cf,null))[_0xa5fa('0x1c')](saveUpdates(_0x2d3907[_0xa5fa('0x54')],null))[_0xa5fa('0x1c')](function(_0x5075b5){if(_0x5075b5){_0x27749e=_0x5075b5;return db[_0xa5fa('0x3a')][_0xa5fa('0x4f')]({'raw':!![]});}})['then'](function(_0x439f64){var _0x2ea25c=fs[_0xa5fa('0x55')](path[_0xa5fa('0x65')](config[_0xa5fa('0x66')],_0xa5fa('0x56')),_0xa5fa('0x57'));var _0x27ed40=ejs['render'](_0x2ea25c,{'contexts':_0x439f64||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x27ed40);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa5fa('0x5b')});})[_0xa5fa('0x1c')](function(){return _0x27749e;})['then'](respondWithResult(_0x1058cf,null))['catch'](handleError(_0x1058cf,null));};exports[_0xa5fa('0x34')]=function(_0x4aa4f3,_0x51b637,_0x58fa0b){var _0x2b78e9;return db['VoiceContext'][_0xa5fa('0x5f')]({'where':{'id':_0x4aa4f3[_0xa5fa('0x64')]['id']}})['then'](handleEntityNotFound(_0x51b637,null))[_0xa5fa('0x1c')](removeEntity(_0x51b637,null))['then'](function(){return db[_0xa5fa('0x3a')][_0xa5fa('0x4f')]({'raw':!![]});})['then'](function(_0x3df8b1){var _0x208a54=fs['readFileSync'](path[_0xa5fa('0x65')](config[_0xa5fa('0x66')],_0xa5fa('0x56')),'utf8');var _0x23a074=ejs[_0xa5fa('0x58')](_0x208a54,{'contexts':_0x3df8b1});fs[_0xa5fa('0x67')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x23a074);return respondWithRpcPromise(_0xa5fa('0x5a'),_0xa5fa('0x34'),{'module':_0xa5fa('0x5b')});})[_0xa5fa('0x26')](handleError(_0x51b637,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 525f370..4f9880d 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 _0xd811=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','rimraf'];(function(_0x5bf8c0,_0x53c5ea){var _0x2c1458=function(_0x2b2390){while(--_0x2b2390){_0x5bf8c0['push'](_0x5bf8c0['shift']());}};_0x2c1458(++_0x53c5ea);}(_0xd811,0x165));var _0x1d81=function(_0x3e27ba,_0x46b120){_0x3e27ba=_0x3e27ba-0x0;var _0x10b3f2=_0xd811[_0x3e27ba];return _0x10b3f2;};'use strict';var _=require(_0x1d81('0x0'));var util=require(_0x1d81('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d81('0x2'));var BPromise=require(_0x1d81('0x3'));var rp=require(_0x1d81('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d81('0x5'));var config=require('../../config/environment');var attributes=require(_0x1d81('0x6'));module[_0x1d81('0x7')]=function(_0x41d857,_0x3c0e8d){return _0x41d857[_0x1d81('0x8')](_0x1d81('0x9'),attributes,{'tableName':_0x1d81('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6603=['voice_contexts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceContext'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x6603,0xe5));var _0x3660=function(_0x51ba4f,_0x45b667){_0x51ba4f=_0x51ba4f-0x0;var _0x444412=_0x6603[_0x51ba4f];return _0x444412;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3660('0x0'))(_0x3660('0x1'));var moment=require(_0x3660('0x2'));var BPromise=require(_0x3660('0x3'));var rp=require(_0x3660('0x4'));var fs=require('fs');var path=require(_0x3660('0x5'));var rimraf=require(_0x3660('0x6'));var config=require(_0x3660('0x7'));var attributes=require('./voiceContext.attributes');module[_0x3660('0x8')]=function(_0x4b4776,_0x7043d2){return _0x4b4776[_0x3660('0x9')](_0x3660('0xa'),attributes,{'tableName':_0x3660('0xb'),'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 c4940c5..d2fe1ad 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 _0xa788=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x2d034d,_0x532a40){var _0x286474=function(_0x17d07c){while(--_0x17d07c){_0x2d034d['push'](_0x2d034d['shift']());}};_0x286474(++_0x532a40);}(_0xa788,0x70));var _0x8a78=function(_0x3fece3,_0x302559){_0x3fece3=_0x3fece3-0x0;var _0x367afe=_0xa788[_0x3fece3];return _0x367afe;};'use strict';var _=require(_0x8a78('0x0'));var util=require(_0x8a78('0x1'));var moment=require(_0x8a78('0x2'));var BPromise=require(_0x8a78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a78('0x4'));var db=require(_0x8a78('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a78('0x6'))(_0x8a78('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8a78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x344c6d,_0x539774,_0x4def98){return new BPromise(function(_0x22ebca,_0x542ac5){return client['request'](_0x344c6d,_0x4def98)[_0x8a78('0x9')](function(_0x811201){logger['info'](_0x8a78('0xa'),_0x539774,_0x8a78('0xb'));logger[_0x8a78('0xc')](_0x8a78('0xd'),_0x539774,_0x8a78('0xb'),JSON[_0x8a78('0xe')](_0x811201));if(_0x811201[_0x8a78('0xf')]){if(_0x811201[_0x8a78('0xf')][_0x8a78('0x10')]===0x1f4){logger['error'](_0x8a78('0xa'),_0x539774,_0x811201[_0x8a78('0xf')][_0x8a78('0x11')]);return _0x542ac5(_0x811201['error'][_0x8a78('0x11')]);}logger[_0x8a78('0xf')](_0x8a78('0xa'),_0x539774,_0x811201['error'][_0x8a78('0x11')]);return _0x22ebca(_0x811201['error'][_0x8a78('0x11')]);}else{logger['info'](_0x8a78('0xa'),_0x539774,'request\x20sent');_0x22ebca(_0x811201['result']['message']);}})[_0x8a78('0x12')](function(_0x27822b){logger[_0x8a78('0xf')](_0x8a78('0xa'),_0x539774,_0x27822b);_0x542ac5(_0x27822b);});});} \ No newline at end of file +var _0xb688=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x11b36a,_0x569c8b){var _0x352720=function(_0x2926b6){while(--_0x2926b6){_0x11b36a['push'](_0x11b36a['shift']());}};_0x352720(++_0x569c8b);}(_0xb688,0xcf));var _0x8b68=function(_0x3936c8,_0x54a612){_0x3936c8=_0x3936c8-0x0;var _0x17315e=_0xb688[_0x3936c8];return _0x17315e;};'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')]('VoiceContext,\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);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8674c64..8eb7513 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 _0xd7ff=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xd7ff,0x6b));var _0xfd7f=function(_0x3082b6,_0x3ebb7f){_0x3082b6=_0x3082b6-0x0;var _0x165493=_0xd7ff[_0x3082b6];return _0x165493;};'use strict';var multer=require(_0xfd7f('0x0'));var util=require(_0xfd7f('0x1'));var path=require(_0xfd7f('0x2'));var timeout=require(_0xfd7f('0x3'));var express=require(_0xfd7f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfd7f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd7f('0x6'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xfd7f('0x7')](),controller[_0xfd7f('0x8')]);router[_0xfd7f('0x9')](_0xfd7f('0xa'),auth[_0xfd7f('0x7')](),controller[_0xfd7f('0xb')]);router['get'](_0xfd7f('0xc'),auth[_0xfd7f('0x7')](),controller['show']);router[_0xfd7f('0xd')]('/',auth[_0xfd7f('0x7')](),controller['create']);router[_0xfd7f('0xe')](_0xfd7f('0xc'),auth['isAuthenticated'](),controller[_0xfd7f('0xf')]);router[_0xfd7f('0x10')](_0xfd7f('0xc'),auth[_0xfd7f('0x7')](),controller[_0xfd7f('0x11')]);module[_0xfd7f('0x12')]=router; \ No newline at end of file +var _0x4458=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4458,0x1e4));var _0x8445=function(_0x1e7bde,_0x477928){_0x1e7bde=_0x1e7bde-0x0;var _0x4eb2f2=_0x4458[_0x1e7bde];return _0x4eb2f2;};'use strict';var multer=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var path=require(_0x8445('0x2'));var timeout=require(_0x8445('0x3'));var express=require(_0x8445('0x4'));var router=express[_0x8445('0x5')]();var fs_extra=require(_0x8445('0x6'));var auth=require(_0x8445('0x7'));var interaction=require(_0x8445('0x8'));var config=require(_0x8445('0x9'));var controller=require(_0x8445('0xa'));router['get']('/',auth[_0x8445('0xb')](),controller[_0x8445('0xc')]);router[_0x8445('0xd')]('/describe',auth['isAuthenticated'](),controller[_0x8445('0xe')]);router[_0x8445('0xd')](_0x8445('0xf'),auth['isAuthenticated'](),controller[_0x8445('0x10')]);router[_0x8445('0x11')]('/',auth['isAuthenticated'](),controller[_0x8445('0x12')]);router[_0x8445('0x13')](_0x8445('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x8445('0x14')](_0x8445('0xf'),auth[_0x8445('0xb')](),controller[_0x8445('0x15')]);module[_0x8445('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index b196f50..f527066 100644 --- a/server/api/voiceDialReport/voiceDialReport.attributes.js +++ b/server/api/voiceDialReport/voiceDialReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa41a=['exports','STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x4e2a5c,_0x37c616){var _0x59f528=function(_0x3af4a8){while(--_0x3af4a8){_0x4e2a5c['push'](_0x4e2a5c['shift']());}};_0x59f528(++_0x37c616);}(_0xa41a,0x6b));var _0xaa41=function(_0x30f29f,_0x7047f3){_0x30f29f=_0x30f29f-0x0;var _0x38f6e9=_0xa41a[_0x30f29f];return _0x38f6e9;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaa41('0x2')]},'channelstate':{'type':Sequelize[_0xaa41('0x3')]},'channelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'calleridnum':{'type':Sequelize[_0xaa41('0x2')]},'calleridname':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'connectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'language':{'type':Sequelize[_0xaa41('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xaa41('0x2')]},'exten':{'type':Sequelize[_0xaa41('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaa41('0x2')]},'destchannel':{'type':Sequelize[_0xaa41('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaa41('0x2')]},'destcalleridname':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa41('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa41('0x2')]},'destlanguage':{'type':Sequelize[_0xaa41('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa41('0x2')]},'destcontext':{'type':Sequelize[_0xaa41('0x2')]},'destexten':{'type':Sequelize[_0xaa41('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xaa41('0x2')]},'destlinkedid':{'type':Sequelize[_0xaa41('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xaa41('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xaa41('0x4')]},'lastevent':{'type':Sequelize[_0xaa41('0x2')],'comment':_0xaa41('0x5')},'routeId':{'type':Sequelize[_0xaa41('0x3')]},'duration':{'type':Sequelize[_0xaa41('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file +var _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x42a75,_0x5229df){var _0x5cd3f4=function(_0x4f8180){while(--_0x4f8180){_0x42a75['push'](_0x42a75['shift']());}};_0x5cd3f4(++_0x5229df);}(_0x55ca,0x126));var _0xa55c=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x55ca[_0x111494];return _0x1d0d8b;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index b7be68e..a5074be 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 _0x624f=['keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','save','then','end','stack','name','send','index','map','VoiceDialReport','fieldName','type','query'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x624f,0xf4));var _0xf624=function(_0x399084,_0x4680aa){_0x399084=_0x399084-0x0;var _0x353684=_0x624f[_0x399084];return _0x353684;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf624('0x0'));var zipdir=require(_0xf624('0x1'));var jsonpatch=require(_0xf624('0x2'));var rp=require('request-promise');var moment=require(_0xf624('0x3'));var BPromise=require(_0xf624('0x4'));var Mustache=require(_0xf624('0x5'));var util=require('util');var path=require(_0xf624('0x6'));var sox=require('sox');var csv=require(_0xf624('0x7'));var ejs=require(_0xf624('0x8'));var fs=require('fs');var fs_extra=require(_0xf624('0x9'));var _=require(_0xf624('0xa'));var squel=require(_0xf624('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf624('0xc'));var Papa=require(_0xf624('0xd'));var Redis=require(_0xf624('0xe'));var authService=require(_0xf624('0xf'));var qs=require(_0xf624('0x10'));var as=require(_0xf624('0x11'));var hardwareService=require(_0xf624('0x12'));var logger=require(_0xf624('0x13'))(_0xf624('0x14'));var utils=require(_0xf624('0x15'));var config=require(_0xf624('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf624('0x17'))['db'];function respondWithStatusCode(_0x345e69,_0x50c28d){_0x50c28d=_0x50c28d||0xcc;return function(_0x24be29){if(_0x24be29){return _0x345e69[_0xf624('0x18')](_0x50c28d);}return _0x345e69[_0xf624('0x19')](_0x50c28d)['end']();};}function respondWithResult(_0xac643,_0x4ac44f){_0x4ac44f=_0x4ac44f||0xc8;return function(_0x3df300){if(_0x3df300){return _0xac643[_0xf624('0x19')](_0x4ac44f)[_0xf624('0x1a')](_0x3df300);}};}function respondWithFilteredResult(_0x2b266e,_0x4e7417){return function(_0x2d8a63){if(_0x2d8a63){var _0x48182a=typeof _0x4e7417[_0xf624('0x1b')]===_0xf624('0x1c')&&typeof _0x4e7417['limit']===_0xf624('0x1c');var _0x3942f8=_0x2d8a63[_0xf624('0x1d')];var _0x36b5fa=_0x48182a?0x0:_0x4e7417['offset'];var _0x5296b=_0x48182a?_0x2d8a63[_0xf624('0x1d')]:_0x4e7417[_0xf624('0x1b')]+_0x4e7417[_0xf624('0x1e')];var _0x5373ce;if(_0x5296b>=_0x3942f8){_0x5296b=_0x3942f8;_0x5373ce=0xc8;}else{_0x5373ce=0xce;}_0x2b266e['status'](_0x5373ce);return _0x2b266e['set']('Content-Range',_0x36b5fa+'-'+_0x5296b+'/'+_0x3942f8)[_0xf624('0x1a')](_0x2d8a63);}return null;};}function patchUpdates(_0x2bcb4c){return function(_0x6f7464){try{jsonpatch['apply'](_0x6f7464,_0x2bcb4c,!![]);}catch(_0x39c2d2){return BPromise[_0xf624('0x1f')](_0x39c2d2);}return _0x6f7464[_0xf624('0x20')]();};}function saveUpdates(_0x1fed83,_0x54a80b){return function(_0x144d21){if(_0x144d21){return _0x144d21['update'](_0x1fed83)[_0xf624('0x21')](function(_0x145f00){return _0x145f00;});}return null;};}function removeEntity(_0x22cac5,_0x100623){return function(_0x50b7a4){if(_0x50b7a4){return _0x50b7a4['destroy']()[_0xf624('0x21')](function(){_0x22cac5[_0xf624('0x19')](0xcc)[_0xf624('0x22')]();});}};}function handleEntityNotFound(_0xbd3f54,_0xfca920){return function(_0x182996){if(!_0x182996){_0xbd3f54[_0xf624('0x18')](0x194);}return _0x182996;};}function handleError(_0x202617,_0x26dde5){_0x26dde5=_0x26dde5||0x1f4;return function(_0x3e09ff){logger['error'](_0x3e09ff[_0xf624('0x23')]);if(_0x3e09ff[_0xf624('0x24')]){delete _0x3e09ff[_0xf624('0x24')];}_0x202617['status'](_0x26dde5)[_0xf624('0x25')](_0x3e09ff);};}exports[_0xf624('0x26')]=function(_0x199c73,_0x28816c){var _0x32190e={},_0x135f02={},_0x55c3f2={'count':0x0,'rows':[]};var _0x575fa3=_[_0xf624('0x27')](db[_0xf624('0x28')]['rawAttributes'],function(_0x176775){return{'name':_0x176775[_0xf624('0x29')],'type':_0x176775[_0xf624('0x2a')]['key']};});_0x135f02['model']=_['map'](_0x575fa3,_0xf624('0x24'));_0x135f02[_0xf624('0x2b')]=_[_0xf624('0x2c')](_0x199c73[_0xf624('0x2b')]);_0x135f02[_0xf624('0x2d')]=_[_0xf624('0x2e')](_0x135f02[_0xf624('0x2f')],_0x135f02[_0xf624('0x2b')]);_0x32190e[_0xf624('0x30')]=_[_0xf624('0x2e')](_0x135f02[_0xf624('0x2f')],qs[_0xf624('0x31')](_0x199c73[_0xf624('0x2b')][_0xf624('0x31')]));_0x32190e[_0xf624('0x30')]=_0x32190e[_0xf624('0x30')][_0xf624('0x32')]?_0x32190e['attributes']:_0x135f02[_0xf624('0x2f')];if(!_0x199c73[_0xf624('0x2b')][_0xf624('0x33')](_0xf624('0x34'))){_0x32190e[_0xf624('0x1e')]=qs[_0xf624('0x1e')](_0x199c73['query']['limit']);_0x32190e[_0xf624('0x1b')]=qs[_0xf624('0x1b')](_0x199c73[_0xf624('0x2b')][_0xf624('0x1b')]);}_0x32190e['order']=qs[_0xf624('0x35')](_0x199c73[_0xf624('0x2b')]['sort']);_0x32190e[_0xf624('0x36')]=qs[_0xf624('0x2d')](_['pick'](_0x199c73['query'],_0x135f02[_0xf624('0x2d')]),_0x575fa3);if(_0x199c73[_0xf624('0x2b')][_0xf624('0x37')]){_0x32190e['where']=_['merge'](_0x32190e[_0xf624('0x36')],{'$or':_[_0xf624('0x27')](_0x575fa3,function(_0x21f118){if(_0x21f118[_0xf624('0x2a')]!==_0xf624('0x38')){var _0x28c946={};_0x28c946[_0x21f118[_0xf624('0x24')]]={'$like':'%'+_0x199c73[_0xf624('0x2b')][_0xf624('0x37')]+'%'};return _0x28c946;}})});}_0x32190e=_[_0xf624('0x39')]({},_0x32190e,_0x199c73['options']);var _0x307cc4={'where':_0x32190e[_0xf624('0x36')]};return db[_0xf624('0x28')][_0xf624('0x1d')](_0x307cc4)[_0xf624('0x21')](function(_0x5ba4d4){_0x55c3f2['count']=_0x5ba4d4;if(_0x199c73[_0xf624('0x2b')][_0xf624('0x3a')]){_0x32190e['include']=[{'all':!![]}];}return db[_0xf624('0x28')][_0xf624('0x3b')](_0x32190e);})['then'](function(_0x22ddca){_0x55c3f2[_0xf624('0x3c')]=_0x22ddca;return _0x55c3f2;})[_0xf624('0x21')](respondWithFilteredResult(_0x28816c,_0x32190e))[_0xf624('0x3d')](handleError(_0x28816c,null));};exports[_0xf624('0x3e')]=function(_0x2ae1df,_0x9e9cda){var _0x477bf2={'raw':!![],'where':{'id':_0x2ae1df[_0xf624('0x3f')]['id']}},_0x43af09={};_0x43af09[_0xf624('0x2f')]=_[_0xf624('0x2c')](db[_0xf624('0x28')][_0xf624('0x40')]);_0x43af09[_0xf624('0x2b')]=_['keys'](_0x2ae1df['query']);_0x43af09['filters']=_['intersection'](_0x43af09['model'],_0x43af09[_0xf624('0x2b')]);_0x477bf2[_0xf624('0x30')]=_[_0xf624('0x2e')](_0x43af09[_0xf624('0x2f')],qs[_0xf624('0x31')](_0x2ae1df[_0xf624('0x2b')][_0xf624('0x31')]));_0x477bf2['attributes']=_0x477bf2['attributes']['length']?_0x477bf2[_0xf624('0x30')]:_0x43af09[_0xf624('0x2f')];if(_0x2ae1df[_0xf624('0x2b')][_0xf624('0x3a')]){_0x477bf2[_0xf624('0x41')]=[{'all':!![]}];}_0x477bf2=_[_0xf624('0x39')]({},_0x477bf2,_0x2ae1df[_0xf624('0x42')]);return db['VoiceDialReport'][_0xf624('0x43')](_0x477bf2)[_0xf624('0x21')](handleEntityNotFound(_0x9e9cda,null))['then'](respondWithResult(_0x9e9cda,null))[_0xf624('0x3d')](handleError(_0x9e9cda,null));};exports[_0xf624('0x44')]=function(_0x1a47b,_0x362267){return db[_0xf624('0x28')][_0xf624('0x44')](_0x1a47b['body'],{})[_0xf624('0x21')](respondWithResult(_0x362267,0xc9))[_0xf624('0x3d')](handleError(_0x362267,null));};exports['update']=function(_0x2fdba7,_0x5d72d7){if(_0x2fdba7[_0xf624('0x45')]['id']){delete _0x2fdba7[_0xf624('0x45')]['id'];}return db[_0xf624('0x28')][_0xf624('0x43')]({'where':{'id':_0x2fdba7[_0xf624('0x3f')]['id']}})[_0xf624('0x21')](handleEntityNotFound(_0x5d72d7,null))[_0xf624('0x21')](saveUpdates(_0x2fdba7[_0xf624('0x45')],null))[_0xf624('0x21')](respondWithResult(_0x5d72d7,null))[_0xf624('0x3d')](handleError(_0x5d72d7,null));};exports[_0xf624('0x46')]=function(_0x48f101,_0x3ba606){return db['VoiceDialReport']['find']({'where':{'id':_0x48f101['params']['id']}})['then'](handleEntityNotFound(_0x3ba606,null))['then'](removeEntity(_0x3ba606,null))['catch'](handleError(_0x3ba606,null));};exports['describe']=function(_0x370bba,_0x1f8795){return db[_0xf624('0x28')][_0xf624('0x47')]()[_0xf624('0x21')](respondWithResult(_0x1f8795,null))[_0xf624('0x3d')](handleError(_0x1f8795,null));}; \ No newline at end of file +var _0x47b9=['hasOwnProperty','nolimit','order','sort','where','filter','merge','options','VoiceDialReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x47b9,0xf7));var _0x947b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x47b9[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x947b('0x0'));var zipdir=require(_0x947b('0x1'));var jsonpatch=require(_0x947b('0x2'));var rp=require(_0x947b('0x3'));var moment=require(_0x947b('0x4'));var BPromise=require(_0x947b('0x5'));var Mustache=require(_0x947b('0x6'));var util=require(_0x947b('0x7'));var path=require(_0x947b('0x8'));var sox=require(_0x947b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x947b('0xa'));var _=require(_0x947b('0xb'));var squel=require(_0x947b('0xc'));var crypto=require(_0x947b('0xd'));var jsforce=require(_0x947b('0xe'));var deskjs=require(_0x947b('0xf'));var toCsv=require(_0x947b('0x10'));var querystring=require(_0x947b('0x11'));var Papa=require(_0x947b('0x12'));var Redis=require('ioredis');var authService=require(_0x947b('0x13'));var qs=require(_0x947b('0x14'));var as=require(_0x947b('0x15'));var hardwareService=require(_0x947b('0x16'));var logger=require(_0x947b('0x17'))(_0x947b('0x18'));var utils=require(_0x947b('0x19'));var config=require(_0x947b('0x1a'));var licenseUtil=require(_0x947b('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x581eb0,_0x321389){_0x321389=_0x321389||0xcc;return function(_0x2edc7e){if(_0x2edc7e){return _0x581eb0[_0x947b('0x1c')](_0x321389);}return _0x581eb0[_0x947b('0x1d')](_0x321389)[_0x947b('0x1e')]();};}function respondWithResult(_0x595ddb,_0x2e31f6){_0x2e31f6=_0x2e31f6||0xc8;return function(_0x24a7fe){if(_0x24a7fe){return _0x595ddb[_0x947b('0x1d')](_0x2e31f6)['json'](_0x24a7fe);}};}function respondWithFilteredResult(_0x5313a0,_0x296a57){return function(_0x4e51c8){if(_0x4e51c8){var _0xb3c771=typeof _0x296a57['offset']===_0x947b('0x1f')&&typeof _0x296a57['limit']===_0x947b('0x1f');var _0xa95bd9=_0x4e51c8['count'];var _0x4abfb4=_0xb3c771?0x0:_0x296a57[_0x947b('0x20')];var _0x1a6cf8=_0xb3c771?_0x4e51c8[_0x947b('0x21')]:_0x296a57['offset']+_0x296a57[_0x947b('0x22')];var _0x416d34;if(_0x1a6cf8>=_0xa95bd9){_0x1a6cf8=_0xa95bd9;_0x416d34=0xc8;}else{_0x416d34=0xce;}_0x5313a0['status'](_0x416d34);return _0x5313a0[_0x947b('0x23')](_0x947b('0x24'),_0x4abfb4+'-'+_0x1a6cf8+'/'+_0xa95bd9)['json'](_0x4e51c8);}return null;};}function patchUpdates(_0xa27b96){return function(_0x53f314){try{jsonpatch[_0x947b('0x25')](_0x53f314,_0xa27b96,!![]);}catch(_0x13d683){return BPromise[_0x947b('0x26')](_0x13d683);}return _0x53f314['save']();};}function saveUpdates(_0x5a5f5b,_0x14eb40){return function(_0x3b7f35){if(_0x3b7f35){return _0x3b7f35[_0x947b('0x27')](_0x5a5f5b)[_0x947b('0x28')](function(_0x4e3596){return _0x4e3596;});}return null;};}function removeEntity(_0x2b12bf,_0x293491){return function(_0x4976cc){if(_0x4976cc){return _0x4976cc[_0x947b('0x29')]()['then'](function(){_0x2b12bf[_0x947b('0x1d')](0xcc)[_0x947b('0x1e')]();});}};}function handleEntityNotFound(_0x5e7d85,_0x4c2a4b){return function(_0x2e5f4b){if(!_0x2e5f4b){_0x5e7d85[_0x947b('0x1c')](0x194);}return _0x2e5f4b;};}function handleError(_0x19ba26,_0x1dccd5){_0x1dccd5=_0x1dccd5||0x1f4;return function(_0x5eb52f){logger[_0x947b('0x2a')](_0x5eb52f['stack']);if(_0x5eb52f['name']){delete _0x5eb52f['name'];}_0x19ba26[_0x947b('0x1d')](_0x1dccd5)[_0x947b('0x2b')](_0x5eb52f);};}exports['index']=function(_0x7dc6e6,_0x11b525){var _0x229fe6={},_0x181e95={},_0x2315e9={'count':0x0,'rows':[]};var _0x33cbde=_[_0x947b('0x2c')](db['VoiceDialReport'][_0x947b('0x2d')],function(_0x15544b){return{'name':_0x15544b[_0x947b('0x2e')],'type':_0x15544b['type'][_0x947b('0x2f')]};});_0x181e95[_0x947b('0x30')]=_[_0x947b('0x2c')](_0x33cbde,_0x947b('0x31'));_0x181e95[_0x947b('0x32')]=_[_0x947b('0x33')](_0x7dc6e6[_0x947b('0x32')]);_0x181e95[_0x947b('0x34')]=_['intersection'](_0x181e95[_0x947b('0x30')],_0x181e95[_0x947b('0x32')]);_0x229fe6[_0x947b('0x35')]=_[_0x947b('0x36')](_0x181e95[_0x947b('0x30')],qs[_0x947b('0x37')](_0x7dc6e6[_0x947b('0x32')][_0x947b('0x37')]));_0x229fe6[_0x947b('0x35')]=_0x229fe6[_0x947b('0x35')][_0x947b('0x38')]?_0x229fe6[_0x947b('0x35')]:_0x181e95[_0x947b('0x30')];if(!_0x7dc6e6[_0x947b('0x32')][_0x947b('0x39')](_0x947b('0x3a'))){_0x229fe6[_0x947b('0x22')]=qs[_0x947b('0x22')](_0x7dc6e6[_0x947b('0x32')][_0x947b('0x22')]);_0x229fe6[_0x947b('0x20')]=qs['offset'](_0x7dc6e6['query']['offset']);}_0x229fe6[_0x947b('0x3b')]=qs[_0x947b('0x3c')](_0x7dc6e6[_0x947b('0x32')][_0x947b('0x3c')]);_0x229fe6[_0x947b('0x3d')]=qs[_0x947b('0x34')](_['pick'](_0x7dc6e6[_0x947b('0x32')],_0x181e95['filters']),_0x33cbde);if(_0x7dc6e6[_0x947b('0x32')][_0x947b('0x3e')]){_0x229fe6[_0x947b('0x3d')]=_[_0x947b('0x3f')](_0x229fe6[_0x947b('0x3d')],{'$or':_[_0x947b('0x2c')](_0x33cbde,function(_0x5de0d4){if(_0x5de0d4['type']!=='VIRTUAL'){var _0xf41d61={};_0xf41d61[_0x5de0d4[_0x947b('0x31')]]={'$like':'%'+_0x7dc6e6['query'][_0x947b('0x3e')]+'%'};return _0xf41d61;}})});}_0x229fe6=_['merge']({},_0x229fe6,_0x7dc6e6[_0x947b('0x40')]);var _0x1495fd={'where':_0x229fe6[_0x947b('0x3d')]};return db[_0x947b('0x41')]['count'](_0x1495fd)[_0x947b('0x28')](function(_0x5ea0c0){_0x2315e9[_0x947b('0x21')]=_0x5ea0c0;if(_0x7dc6e6['query'][_0x947b('0x42')]){_0x229fe6[_0x947b('0x43')]=[{'all':!![]}];}return db[_0x947b('0x41')][_0x947b('0x44')](_0x229fe6);})[_0x947b('0x28')](function(_0x5ecb5){_0x2315e9['rows']=_0x5ecb5;return _0x2315e9;})[_0x947b('0x28')](respondWithFilteredResult(_0x11b525,_0x229fe6))[_0x947b('0x45')](handleError(_0x11b525,null));};exports[_0x947b('0x46')]=function(_0x4a6249,_0x531325){var _0xc73045={'raw':!![],'where':{'id':_0x4a6249[_0x947b('0x47')]['id']}},_0x1e81a6={};_0x1e81a6['model']=_[_0x947b('0x33')](db[_0x947b('0x41')][_0x947b('0x2d')]);_0x1e81a6[_0x947b('0x32')]=_[_0x947b('0x33')](_0x4a6249[_0x947b('0x32')]);_0x1e81a6[_0x947b('0x34')]=_[_0x947b('0x36')](_0x1e81a6[_0x947b('0x30')],_0x1e81a6[_0x947b('0x32')]);_0xc73045['attributes']=_['intersection'](_0x1e81a6['model'],qs[_0x947b('0x37')](_0x4a6249[_0x947b('0x32')][_0x947b('0x37')]));_0xc73045[_0x947b('0x35')]=_0xc73045['attributes'][_0x947b('0x38')]?_0xc73045[_0x947b('0x35')]:_0x1e81a6['model'];if(_0x4a6249['query'][_0x947b('0x42')]){_0xc73045[_0x947b('0x43')]=[{'all':!![]}];}_0xc73045=_[_0x947b('0x3f')]({},_0xc73045,_0x4a6249[_0x947b('0x40')]);return db[_0x947b('0x41')][_0x947b('0x48')](_0xc73045)[_0x947b('0x28')](handleEntityNotFound(_0x531325,null))[_0x947b('0x28')](respondWithResult(_0x531325,null))[_0x947b('0x45')](handleError(_0x531325,null));};exports[_0x947b('0x49')]=function(_0x1992cb,_0x31f374){return db[_0x947b('0x41')][_0x947b('0x49')](_0x1992cb['body'],{})['then'](respondWithResult(_0x31f374,0xc9))[_0x947b('0x45')](handleError(_0x31f374,null));};exports['update']=function(_0x2372b9,_0x2ab6ef){if(_0x2372b9[_0x947b('0x4a')]['id']){delete _0x2372b9[_0x947b('0x4a')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x2372b9[_0x947b('0x47')]['id']}})[_0x947b('0x28')](handleEntityNotFound(_0x2ab6ef,null))[_0x947b('0x28')](saveUpdates(_0x2372b9['body'],null))[_0x947b('0x28')](respondWithResult(_0x2ab6ef,null))[_0x947b('0x45')](handleError(_0x2ab6ef,null));};exports['destroy']=function(_0x575508,_0x38187a){return db['VoiceDialReport'][_0x947b('0x48')]({'where':{'id':_0x575508[_0x947b('0x47')]['id']}})[_0x947b('0x28')](handleEntityNotFound(_0x38187a,null))['then'](removeEntity(_0x38187a,null))[_0x947b('0x45')](handleError(_0x38187a,null));};exports[_0x947b('0x4b')]=function(_0x55cd73,_0x2e3ad9){return db['VoiceDialReport'][_0x947b('0x4b')]()[_0x947b('0x28')](respondWithResult(_0x2e3ad9,null))[_0x947b('0x45')](handleError(_0x2e3ad9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c177fdc..7efd282 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 _0xf089=['bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x3b7b42,_0x31badd){var _0x1ebaad=function(_0x3655d9){while(--_0x3655d9){_0x3b7b42['push'](_0x3b7b42['shift']());}};_0x1ebaad(++_0x31badd);}(_0xf089,0x1a9));var _0x9f08=function(_0x30080f,_0x55f038){_0x30080f=_0x30080f-0x0;var _0x2288c3=_0xf089[_0x30080f];return _0x2288c3;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var logger=require(_0x9f08('0x1'))(_0x9f08('0x2'));var moment=require(_0x9f08('0x3'));var BPromise=require(_0x9f08('0x4'));var rp=require(_0x9f08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9f08('0x6'));var config=require(_0x9f08('0x7'));var attributes=require(_0x9f08('0x8'));module[_0x9f08('0x9')]=function(_0x35e2cd,_0x5ee14d){return _0x35e2cd[_0x9f08('0xa')](_0x9f08('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x9f08('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4294=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment'];(function(_0x16b561,_0x5a914f){var _0x22599f=function(_0x27ce85){while(--_0x27ce85){_0x16b561['push'](_0x16b561['shift']());}};_0x22599f(++_0x5a914f);}(_0x4294,0x6c));var _0x4429=function(_0xed366f,_0x21b501){_0xed366f=_0xed366f-0x0;var _0x229ba3=_0x4294[_0xed366f];return _0x229ba3;};'use strict';var _=require(_0x4429('0x0'));var util=require(_0x4429('0x1'));var logger=require('../../config/logger')(_0x4429('0x2'));var moment=require(_0x4429('0x3'));var BPromise=require('bluebird');var rp=require(_0x4429('0x4'));var fs=require('fs');var path=require(_0x4429('0x5'));var rimraf=require(_0x4429('0x6'));var config=require(_0x4429('0x7'));var attributes=require(_0x4429('0x8'));module[_0x4429('0x9')]=function(_0x21f894,_0x360591){return _0x21f894[_0x4429('0xa')](_0x4429('0xb'),attributes,{'tableName':_0x4429('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4429('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a5e4069..7be68f5 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 _0xb792=['../../config/logger','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','message','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','stringify','catch','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','bluebird','randomstring'];(function(_0x294aef,_0x378f98){var _0x4d235d=function(_0x105d6c){while(--_0x105d6c){_0x294aef['push'](_0x294aef['shift']());}};_0x4d235d(++_0x378f98);}(_0xb792,0xaa));var _0x2b79=function(_0x3c35f8,_0x212d32){_0x3c35f8=_0x3c35f8-0x0;var _0x582027=_0xb792[_0x3c35f8];return _0x582027;};'use strict';var _=require(_0x2b79('0x0'));var util=require(_0x2b79('0x1'));var moment=require('moment');var BPromise=require(_0x2b79('0x2'));var rs=require(_0x2b79('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b79('0x4'))('rpc');var config=require(_0x2b79('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2b79('0x6')][_0x2b79('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x444d7a,_0x413cb8,_0x21f1a7){return new BPromise(function(_0x1c59f0,_0x1e8227){return client[_0x2b79('0x8')](_0x444d7a,_0x21f1a7)[_0x2b79('0x9')](function(_0x57c387){logger[_0x2b79('0xa')](_0x2b79('0xb'),_0x413cb8,_0x2b79('0xc'));logger[_0x2b79('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x413cb8,'request\x20sent',JSON['stringify'](_0x57c387));if(_0x57c387[_0x2b79('0xe')]){if(_0x57c387[_0x2b79('0xe')]['code']===0x1f4){logger['error'](_0x2b79('0xb'),_0x413cb8,_0x57c387[_0x2b79('0xe')][_0x2b79('0xf')]);return _0x1e8227(_0x57c387[_0x2b79('0xe')]['message']);}logger[_0x2b79('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x413cb8,_0x57c387[_0x2b79('0xe')][_0x2b79('0xf')]);return _0x1c59f0(_0x57c387[_0x2b79('0xe')]['message']);}else{logger[_0x2b79('0xa')](_0x2b79('0xb'),_0x413cb8,_0x2b79('0xc'));_0x1c59f0(_0x57c387['result'][_0x2b79('0xf')]);}})['catch'](function(_0x2634bb){logger[_0x2b79('0xe')](_0x2b79('0xb'),_0x413cb8,_0x2634bb);_0x1e8227(_0x2634bb);});});}exports[_0x2b79('0x10')]=function(_0x5b5f56){var _0x2b5a2e=this;return new Promise(function(_0x560305,_0x153111){return db[_0x2b79('0x11')][_0x2b79('0x12')](_0x5b5f56[_0x2b79('0x13')],{'raw':_0x5b5f56['options']?_0x5b5f56[_0x2b79('0x14')][_0x2b79('0x15')]===undefined?!![]:![]:!![]})[_0x2b79('0x9')](function(_0x154743){logger[_0x2b79('0xa')](_0x2b79('0x10'),_0x5b5f56);logger[_0x2b79('0xd')](_0x2b79('0x10'),_0x5b5f56,JSON[_0x2b79('0x16')](_0x154743));_0x560305(_0x154743);})[_0x2b79('0x17')](function(_0x4d6691){logger[_0x2b79('0xe')](_0x2b79('0x10'),_0x4d6691[_0x2b79('0xf')],_0x5b5f56);_0x153111(_0x2b5a2e['error'](0x1f4,_0x4d6691['message']));});});};exports[_0x2b79('0x18')]=function(_0x414e7d){var _0x34a4a5=this;return new Promise(function(_0x1fa48e,_0x5bd0c3){return db['VoiceDialReport'][_0x2b79('0x19')](_0x414e7d[_0x2b79('0x13')],{'raw':_0x414e7d[_0x2b79('0x14')]?_0x414e7d['options'][_0x2b79('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414e7d[_0x2b79('0x14')]?_0x414e7d['options'][_0x2b79('0x1a')]||null:null,'attributes':_0x414e7d[_0x2b79('0x14')]?_0x414e7d[_0x2b79('0x14')][_0x2b79('0x1b')]||null:null,'limit':_0x414e7d[_0x2b79('0x14')]?_0x414e7d[_0x2b79('0x14')][_0x2b79('0x1c')]||null:null})['then'](function(_0x21c741){logger[_0x2b79('0xa')]('UpdateVoiceDialReport',_0x414e7d);logger[_0x2b79('0xd')](_0x2b79('0x18'),_0x414e7d,JSON[_0x2b79('0x16')](_0x21c741));_0x1fa48e(_0x21c741);})['catch'](function(_0x1fe153){logger['error'](_0x2b79('0x18'),_0x1fe153['message'],_0x414e7d);_0x5bd0c3(_0x34a4a5[_0x2b79('0xe')](0x1f4,_0x1fe153[_0x2b79('0xf')]));});});}; \ No newline at end of file +var _0x9cb7=['attributes','UpdateVoiceDialReport','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceDialReport','create','body','options','raw','where'];(function(_0x5a086d,_0x764449){var _0x3354e8=function(_0x17824d){while(--_0x17824d){_0x5a086d['push'](_0x5a086d['shift']());}};_0x3354e8(++_0x764449);}(_0x9cb7,0x11a));var _0x79cb=function(_0x210cf6,_0x2b79af){_0x210cf6=_0x210cf6-0x0;var _0x45ded3=_0x9cb7[_0x210cf6];return _0x45ded3;};'use strict';var _=require(_0x79cb('0x0'));var util=require('util');var moment=require(_0x79cb('0x1'));var BPromise=require(_0x79cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x79cb('0x3'));var db=require(_0x79cb('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79cb('0x5'));var config=require(_0x79cb('0x6'));var jayson=require(_0x79cb('0x7'));var client=jayson[_0x79cb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x204130,_0x4eeb5c,_0x10be75){return new BPromise(function(_0x48b655,_0x5e8253){return client['request'](_0x204130,_0x10be75)[_0x79cb('0x9')](function(_0x25511c){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x4eeb5c,_0x79cb('0xa'));logger[_0x79cb('0xb')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4eeb5c,_0x79cb('0xa'),JSON[_0x79cb('0xc')](_0x25511c));if(_0x25511c[_0x79cb('0xd')]){if(_0x25511c[_0x79cb('0xd')][_0x79cb('0xe')]===0x1f4){logger[_0x79cb('0xd')](_0x79cb('0xf'),_0x4eeb5c,_0x25511c[_0x79cb('0xd')][_0x79cb('0x10')]);return _0x5e8253(_0x25511c[_0x79cb('0xd')]['message']);}logger[_0x79cb('0xd')](_0x79cb('0xf'),_0x4eeb5c,_0x25511c[_0x79cb('0xd')][_0x79cb('0x10')]);return _0x48b655(_0x25511c[_0x79cb('0xd')][_0x79cb('0x10')]);}else{logger[_0x79cb('0x11')](_0x79cb('0xf'),_0x4eeb5c,_0x79cb('0xa'));_0x48b655(_0x25511c[_0x79cb('0x12')][_0x79cb('0x10')]);}})[_0x79cb('0x13')](function(_0x345433){logger['error'](_0x79cb('0xf'),_0x4eeb5c,_0x345433);_0x5e8253(_0x345433);});});}exports[_0x79cb('0x14')]=function(_0x48b239){var _0x1b948c=this;return new Promise(function(_0x5f4c47,_0x3c363b){return db['VoiceDialReport'][_0x79cb('0x15')](_0x48b239[_0x79cb('0x16')],{'raw':_0x48b239[_0x79cb('0x17')]?_0x48b239[_0x79cb('0x17')][_0x79cb('0x18')]===undefined?!![]:![]:!![]})[_0x79cb('0x9')](function(_0x2362f1){logger[_0x79cb('0x11')]('CreateVoiceDialReport',_0x48b239);logger[_0x79cb('0xb')](_0x79cb('0x14'),_0x48b239,JSON[_0x79cb('0xc')](_0x2362f1));_0x5f4c47(_0x2362f1);})[_0x79cb('0x13')](function(_0x14aee7){logger[_0x79cb('0xd')](_0x79cb('0x14'),_0x14aee7[_0x79cb('0x10')],_0x48b239);_0x3c363b(_0x1b948c[_0x79cb('0xd')](0x1f4,_0x14aee7['message']));});});};exports['UpdateVoiceDialReport']=function(_0x3d7dc6){var _0x26cbd4=this;return new Promise(function(_0x38b961,_0xb694c3){return db['VoiceDialReport']['update'](_0x3d7dc6['body'],{'raw':_0x3d7dc6[_0x79cb('0x17')]?_0x3d7dc6[_0x79cb('0x17')][_0x79cb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7dc6[_0x79cb('0x17')]?_0x3d7dc6[_0x79cb('0x17')][_0x79cb('0x19')]||null:null,'attributes':_0x3d7dc6[_0x79cb('0x17')]?_0x3d7dc6[_0x79cb('0x17')][_0x79cb('0x1a')]||null:null,'limit':_0x3d7dc6['options']?_0x3d7dc6[_0x79cb('0x17')]['limit']||null:null})[_0x79cb('0x9')](function(_0x44b18b){logger[_0x79cb('0x11')]('UpdateVoiceDialReport',_0x3d7dc6);logger['debug'](_0x79cb('0x1b'),_0x3d7dc6,JSON[_0x79cb('0xc')](_0x44b18b));_0x38b961(_0x44b18b);})[_0x79cb('0x13')](function(_0x28410a){logger['error']('UpdateVoiceDialReport',_0x28410a[_0x79cb('0x10')],_0x3d7dc6);_0xb694c3(_0x26cbd4[_0x79cb('0xd')](0x1f4,_0x28410a[_0x79cb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 435d6ee..abeb9c8 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 _0xbd9a=['addApplications','put','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','/:id','post','isAuthenticated','create','/:id/applications'];(function(_0x1aeb39,_0x2e8404){var _0x439790=function(_0x199911){while(--_0x199911){_0x1aeb39['push'](_0x1aeb39['shift']());}};_0x439790(++_0x2e8404);}(_0xbd9a,0x109));var _0xabd9=function(_0x125cf1,_0x4a9400){_0x125cf1=_0x125cf1-0x0;var _0x5b3cd8=_0xbd9a[_0x125cf1];return _0x5b3cd8;};'use strict';var multer=require(_0xabd9('0x0'));var util=require('util');var path=require(_0xabd9('0x1'));var timeout=require(_0xabd9('0x2'));var express=require('express');var router=express[_0xabd9('0x3')]();var fs_extra=require(_0xabd9('0x4'));var auth=require(_0xabd9('0x5'));var interaction=require(_0xabd9('0x6'));var config=require(_0xabd9('0x7'));var controller=require(_0xabd9('0x8'));router[_0xabd9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xabd9('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xabd9('0xb')]('/',auth[_0xabd9('0xc')](),controller[_0xabd9('0xd')]);router[_0xabd9('0xb')](_0xabd9('0xe'),auth['isAuthenticated'](),controller[_0xabd9('0xf')]);router[_0xabd9('0x10')](_0xabd9('0xa'),auth['isAuthenticated'](),controller[_0xabd9('0x11')]);router[_0xabd9('0x12')](_0xabd9('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xabd9('0x13')]=router; \ No newline at end of file +var _0x6c57=['show','post','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id'];(function(_0xb7ed68,_0x2195dd){var _0x1e9f79=function(_0x4ff8c0){while(--_0x4ff8c0){_0xb7ed68['push'](_0xb7ed68['shift']());}};_0x1e9f79(++_0x2195dd);}(_0x6c57,0xe5));var _0x76c5=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x6c57[_0x5466ab];return _0x40751a;};'use strict';var multer=require(_0x76c5('0x0'));var util=require(_0x76c5('0x1'));var path=require(_0x76c5('0x2'));var timeout=require('connect-timeout');var express=require(_0x76c5('0x3'));var router=express['Router']();var fs_extra=require(_0x76c5('0x4'));var auth=require(_0x76c5('0x5'));var interaction=require(_0x76c5('0x6'));var config=require(_0x76c5('0x7'));var controller=require(_0x76c5('0x8'));router[_0x76c5('0x9')]('/',auth[_0x76c5('0xa')](),controller[_0x76c5('0xb')]);router[_0x76c5('0x9')](_0x76c5('0xc'),auth[_0x76c5('0xa')](),controller[_0x76c5('0xd')]);router['post']('/',auth[_0x76c5('0xa')](),controller['create']);router[_0x76c5('0xe')](_0x76c5('0xf'),auth[_0x76c5('0xa')](),controller[_0x76c5('0x10')]);router[_0x76c5('0x11')](_0x76c5('0xc'),auth[_0x76c5('0xa')](),controller[_0x76c5('0x12')]);router[_0x76c5('0x13')](_0x76c5('0xc'),auth['isAuthenticated'](),controller[_0x76c5('0x14')]);module[_0x76c5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2c3d876..cf1738a 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 _0xca57=['any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','exten','exports','STRING','compositeIndex','NoOp','outbound','internal','inbound-fax','outbound-fax'];(function(_0x3cca5d,_0x26ee7c){var _0x9b268c=function(_0x5318dd){while(--_0x5318dd){_0x3cca5d['push'](_0x3cca5d['shift']());}};_0x9b268c(++_0x26ee7c);}(_0xca57,0x142));var _0x7ca5=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xca57[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require('sequelize');module[_0x7ca5('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7ca5('0x1')],'allowNull':![],'unique':_0x7ca5('0x2')},'priority':{'type':Sequelize[_0x7ca5('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7ca5('0x1')],'allowNull':![],'defaultValue':_0x7ca5('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x7ca5('0x4'),_0x7ca5('0x5'),_0x7ca5('0x6'),_0x7ca5('0x7'),'system',_0x7ca5('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7ca5('0x1')]},'interval':{'type':Sequelize[_0x7ca5('0x1')],'allowNull':![],'defaultValue':_0x7ca5('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x7ca5('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7ca5('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7ca5('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7ca5('0xb')]},'recordingFormat':{'type':Sequelize[_0x7ca5('0x1')],'defaultValue':_0x7ca5('0xc')},'answer':{'type':Sequelize[_0x7ca5('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7ca5('0xd')],'get':function(_0x4a41fa){return this['getDataValue'](_0x7ca5('0xe'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x3a5e=['system','any','*,*,*,*','BOOLEAN','INTEGER','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','outbound-fax'];(function(_0x154f21,_0x3c7f37){var _0x5ae16f=function(_0x214498){while(--_0x214498){_0x154f21['push'](_0x154f21['shift']());}};_0x5ae16f(++_0x3c7f37);}(_0x3a5e,0x17e));var _0xe3a5=function(_0x4fe95a,_0x2d8ade){_0x4fe95a=_0x4fe95a-0x0;var _0x52e515=_0x3a5e[_0x4fe95a];return _0x52e515;};'use strict';var Sequelize=require(_0xe3a5('0x0'));module['exports']={'context':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':![],'unique':_0xe3a5('0x2')},'priority':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':![],'defaultValue':_0xe3a5('0x3')},'appdata':{'type':Sequelize[_0xe3a5('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe3a5('0x4')]('inbound',_0xe3a5('0x5'),_0xe3a5('0x6'),_0xe3a5('0x7'),_0xe3a5('0x8'),_0xe3a5('0x9'),_0xe3a5('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xe3a5('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe3a5('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe3a5('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xe3a5('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe3a5('0xd')]},'recordingFormat':{'type':Sequelize[_0xe3a5('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xe3a5('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe3a5('0xe')],'get':function(_0x2722a1){return this[_0xe3a5('0xf')](_0xe3a5('0x10'));}},'alias':{'type':Sequelize[_0xe3a5('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index d50e21a..bd26a65 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 _0x8c59=['ignore','map','value','find','type','UserProfileResource','error','stack','name','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','outbound','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter'];(function(_0x371b93,_0xef6ac8){var _0x259b8d=function(_0x3d0c86){while(--_0x3d0c86){_0x371b93['push'](_0x371b93['shift']());}};_0x259b8d(++_0xef6ac8);}(_0x8c59,0xfc));var _0x98c5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8c59[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x98c5('0x0'))('api');var config=require(_0x98c5('0x1'));var db=require(_0x98c5('0x2'))['db'];config['redis']=_[_0x98c5('0x3')](config[_0x98c5('0x4')],{'host':_0x98c5('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98c5('0x4')]));require(_0x98c5('0x6'))[_0x98c5('0x7')](socket);function respondWithStatusCode(_0xa3b68,_0xcfa264){_0xcfa264=_0xcfa264||0xcc;return function(_0x47b656){if(_0x47b656){return _0xa3b68[_0x98c5('0x8')](_0xcfa264);}return _0xa3b68[_0x98c5('0x9')](_0xcfa264)[_0x98c5('0xa')]();};}function respondWithResult(_0x280366,_0x2b8373){_0x2b8373=_0x2b8373||0xc8;return function(_0x27be46){if(_0x27be46){return _0x280366[_0x98c5('0x9')](_0x2b8373)[_0x98c5('0xb')](_0x27be46);}};}function respondWithFilteredResult(_0x298b6f,_0x3947e9){return function(_0x4c4380){if(_0x4c4380){var _0x3040b7=typeof _0x3947e9[_0x98c5('0xc')]===_0x98c5('0xd')&&typeof _0x3947e9[_0x98c5('0xe')]==='undefined';var _0x516559=_0x4c4380[_0x98c5('0xf')];var _0x3a5bea=_0x3040b7?0x0:_0x3947e9['offset'];var _0x1c0b9b=_0x3040b7?_0x4c4380[_0x98c5('0xf')]:_0x3947e9[_0x98c5('0xc')]+_0x3947e9[_0x98c5('0xe')];var _0x14fb17;if(_0x1c0b9b>=_0x516559){_0x1c0b9b=_0x516559;_0x14fb17=0xc8;}else{_0x14fb17=0xce;}_0x298b6f[_0x98c5('0x9')](_0x14fb17);return _0x298b6f[_0x98c5('0x10')](_0x98c5('0x11'),_0x3a5bea+'-'+_0x1c0b9b+'/'+_0x516559)[_0x98c5('0xb')](_0x4c4380);}return null;};}function removeEntity(_0xedb00){return function(_0x3687a7){if(_0x3687a7){return _0x3687a7[_0x98c5('0x12')]()[_0x98c5('0x13')](function(){var _0x499722=_0x3687a7[_0x98c5('0x14')]({'plain':!![]});var _0x38b822=[{'name':_0x98c5('0x15'),'value':_0x98c5('0x16'),'ignore':![]},{'name':_0x98c5('0x17'),'value':'outbound','ignore':![]},{'name':_0x98c5('0x18'),'value':_0x98c5('0x19'),'ignore':![]}];var _0x5f026d=_(_0x38b822)[_0x98c5('0x1a')](_0x98c5('0x1b'))[_0x98c5('0x1c')]('value')[_0x98c5('0x1d')]();if(_['includes'](_0x5f026d,_0x499722['type'])){return;}var _0x1f68c7=_[_0x98c5('0x1e')](_0x38b822,['value',_0x499722[_0x98c5('0x1f')]])['name'];return db[_0x98c5('0x20')][_0x98c5('0x12')]({'where':{'type':_0x1f68c7,'resourceId':_0x499722['id']}})[_0x98c5('0x13')](function(){return _0x3687a7;});})[_0x98c5('0x13')](function(){_0xedb00[_0x98c5('0x9')](0xcc)[_0x98c5('0xa')]();});}};}function handleEntityNotFound(_0x3d66f7){return function(_0x265721){if(!_0x265721){_0x3d66f7['sendStatus'](0x194);}return _0x265721;};}function handleError(_0x530ccf,_0x3466cf){_0x3466cf=_0x3466cf||0x1f4;return function(_0x40c13f){logger[_0x98c5('0x21')](_0x40c13f[_0x98c5('0x22')]);if(_0x40c13f[_0x98c5('0x23')]){delete _0x40c13f['name'];}_0x530ccf[_0x98c5('0x9')](_0x3466cf)[_0x98c5('0x24')](_0x40c13f);};}exports['index']=function(_0xb47941,_0x31cd1f){var _0x1d528f={},_0x1eab37={},_0x3da6f2={'count':0x0,'rows':[]};var _0x5ecf6b=_[_0x98c5('0x1c')](db[_0x98c5('0x25')][_0x98c5('0x26')],function(_0x9a5951){return{'name':_0x9a5951[_0x98c5('0x27')],'type':_0x9a5951['type'][_0x98c5('0x28')]};});_0x1eab37[_0x98c5('0x29')]=_[_0x98c5('0x1c')](_0x5ecf6b,_0x98c5('0x23'));_0x1eab37[_0x98c5('0x2a')]=_[_0x98c5('0x2b')](_0xb47941[_0x98c5('0x2a')]);_0x1eab37[_0x98c5('0x2c')]=_['intersection'](_0x1eab37[_0x98c5('0x29')],_0x1eab37[_0x98c5('0x2a')]);_0x1d528f[_0x98c5('0x2d')]=_[_0x98c5('0x2e')](_0x1eab37[_0x98c5('0x29')],qs[_0x98c5('0x2f')](_0xb47941['query'][_0x98c5('0x2f')]));_0x1d528f[_0x98c5('0x2d')]=_0x1d528f[_0x98c5('0x2d')][_0x98c5('0x30')]?_0x1d528f[_0x98c5('0x2d')]:_0x1eab37[_0x98c5('0x29')];if(!_0xb47941[_0x98c5('0x2a')][_0x98c5('0x31')](_0x98c5('0x32'))){_0x1d528f['limit']=qs[_0x98c5('0xe')](_0xb47941[_0x98c5('0x2a')][_0x98c5('0xe')]);_0x1d528f['offset']=qs['offset'](_0xb47941[_0x98c5('0x2a')][_0x98c5('0xc')]);}_0x1d528f[_0x98c5('0x33')]=qs[_0x98c5('0x34')](_0xb47941[_0x98c5('0x2a')]['sort']);_0x1d528f[_0x98c5('0x35')]=qs[_0x98c5('0x2c')](_[_0x98c5('0x36')](_0xb47941[_0x98c5('0x2a')],_0x1eab37['filters']),_0x5ecf6b);if(_0xb47941['query'][_0x98c5('0x1a')]){_0x1d528f[_0x98c5('0x35')]=_['merge'](_0x1d528f[_0x98c5('0x35')],{'$or':_[_0x98c5('0x1c')](_0x5ecf6b,function(_0x5c7452){if(_0x5c7452[_0x98c5('0x1f')]!==_0x98c5('0x37')){var _0x142100={};_0x142100[_0x5c7452[_0x98c5('0x23')]]={'$like':'%'+_0xb47941[_0x98c5('0x2a')][_0x98c5('0x1a')]+'%'};return _0x142100;}})});}_0x1d528f=_[_0x98c5('0x38')]({},_0x1d528f,_0xb47941[_0x98c5('0x39')]);var _0x4dec3b={'where':_0x1d528f[_0x98c5('0x35')]};return db[_0x98c5('0x25')]['count'](_0x4dec3b)[_0x98c5('0x13')](function(_0x22b0ff){_0x3da6f2[_0x98c5('0xf')]=_0x22b0ff;if(_0xb47941[_0x98c5('0x2a')]['includeAll']){_0x1d528f[_0x98c5('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x98c5('0x3b')](_0x1d528f);})['then'](function(_0x45a29a){_0x3da6f2[_0x98c5('0x3c')]=_0x45a29a;return _0x3da6f2;})[_0x98c5('0x13')](respondWithFilteredResult(_0x31cd1f,_0x1d528f))[_0x98c5('0x3d')](handleError(_0x31cd1f,null));};exports[_0x98c5('0x3e')]=function(_0x58d68b,_0x123b8e){var _0x21a80d={'raw':![],'where':{'id':_0x58d68b[_0x98c5('0x3f')]['id']}},_0xea2598={};_0xea2598[_0x98c5('0x29')]=_[_0x98c5('0x2b')](db['VoiceExtension'][_0x98c5('0x26')]);_0xea2598[_0x98c5('0x2a')]=_[_0x98c5('0x2b')](_0x58d68b[_0x98c5('0x2a')]);_0xea2598[_0x98c5('0x2c')]=_[_0x98c5('0x2e')](_0xea2598[_0x98c5('0x29')],_0xea2598[_0x98c5('0x2a')]);_0x21a80d['attributes']=_[_0x98c5('0x2e')](_0xea2598['model'],qs['fields'](_0x58d68b[_0x98c5('0x2a')][_0x98c5('0x2f')]));_0x21a80d[_0x98c5('0x2d')]=_0x21a80d['attributes'][_0x98c5('0x30')]?_0x21a80d[_0x98c5('0x2d')]:_0xea2598['model'];if(_0x58d68b[_0x98c5('0x2a')][_0x98c5('0x40')]){_0x21a80d[_0x98c5('0x3a')]=[{'all':!![]}];}_0x21a80d=_['merge']({},_0x21a80d,_0x58d68b[_0x98c5('0x39')]);return db[_0x98c5('0x25')][_0x98c5('0x1e')](_0x21a80d)['then'](handleEntityNotFound(_0x123b8e,null))[_0x98c5('0x13')](respondWithResult(_0x123b8e,null))[_0x98c5('0x3d')](handleError(_0x123b8e,null));};exports[_0x98c5('0x12')]=function(_0xae4fac,_0x2f5b32){return db[_0x98c5('0x25')][_0x98c5('0x1e')]({'where':{'id':_0xae4fac[_0x98c5('0x3f')]['id']}})[_0x98c5('0x13')](handleEntityNotFound(_0x2f5b32,null))[_0x98c5('0x13')](removeEntity(_0x2f5b32,null))[_0x98c5('0x3d')](handleError(_0x2f5b32,null));};exports['create']=function(_0x13bd16,_0xf826f4){if(_0x13bd16[_0x98c5('0x41')][_0x98c5('0x1f')]==='outbound'&&!_['startsWith'](_0x13bd16[_0x98c5('0x41')]['exten'],'_')){_0x13bd16[_0x98c5('0x41')][_0x98c5('0x42')]='_'[_0x98c5('0x43')](_0x13bd16[_0x98c5('0x41')][_0x98c5('0x42')]);}return db[_0x98c5('0x25')][_0x98c5('0x44')](_0x13bd16[_0x98c5('0x41')],{'raw':![]})['then'](function(_0x9f4223){var _0x897fd3=_0x13bd16[_0x98c5('0x45')][_0x98c5('0x14')]({'plain':!![]});if(!_0x897fd3)throw new Error(_0x98c5('0x46'));if(_0x897fd3[_0x98c5('0x47')]===_0x98c5('0x45')){var _0x58c1ed=_0x9f4223[_0x98c5('0x14')]({'plain':!![]});var _0x54f124=[{'name':_0x98c5('0x15'),'value':_0x98c5('0x16')},{'name':_0x98c5('0x17'),'value':_0x98c5('0x48')},{'name':_0x98c5('0x18'),'value':_0x98c5('0x19')}];var _0x335af2=_[_0x98c5('0x1e')](_0x54f124,[_0x98c5('0x1d'),_0x58c1ed[_0x98c5('0x1f')]])[_0x98c5('0x23')];return db['UserProfileSection'][_0x98c5('0x1e')]({'where':{'name':_0x335af2,'userProfileId':_0x897fd3['userProfileId']},'raw':!![]})['then'](function(_0x45a0e6){if(_0x45a0e6&&_0x45a0e6[_0x98c5('0x49')]===0x0){return db[_0x98c5('0x20')][_0x98c5('0x44')]({'name':_0x58c1ed['name'],'resourceId':_0x58c1ed['id'],'type':_0x45a0e6['name'],'sectionId':_0x45a0e6['id']},{})[_0x98c5('0x13')](function(){return _0x9f4223;});}else{return _0x9f4223;}})[_0x98c5('0x3d')](function(_0x17ff3c){logger[_0x98c5('0x21')](_0x98c5('0x4a'),_0x17ff3c);throw _0x17ff3c;});}return _0x9f4223;})[_0x98c5('0x13')](respondWithResult(_0xf826f4,0xc9))['catch'](handleError(_0xf826f4,null));};exports[_0x98c5('0x4b')]=function(_0x54d729,_0x1c6601){if(_0x54d729[_0x98c5('0x41')]['id']){delete _0x54d729[_0x98c5('0x41')]['id'];}return db[_0x98c5('0x25')]['find']({'where':{'id':_0x54d729[_0x98c5('0x3f')]['id']}})[_0x98c5('0x13')](handleEntityNotFound(_0x1c6601,null))[_0x98c5('0x13')](function(_0xe619d5){if(_0xe619d5){return db[_0x98c5('0x25')][_0x98c5('0x4b')](_[_0x98c5('0x36')](_0x54d729[_0x98c5('0x41')],[_0x98c5('0x42'),'context',_0x98c5('0x4c'),_0x98c5('0x4d'),_0x98c5('0x4e'),_0x98c5('0x4f'),_0x98c5('0x50')]),{'where':{'context':_0xe619d5[_0x98c5('0x51')],'exten':_0xe619d5[_0x98c5('0x42')]},'individualHooks':!![]})[_0x98c5('0x13')](function(_0x5f04a7){return _0x5f04a7;});}return null;})['then'](respondWithStatusCode(_0x1c6601,null))[_0x98c5('0x3d')](handleError(_0x1c6601,null));};exports[_0x98c5('0x52')]=function(_0x57e4a8,_0x1cd653){var _0x15761b=_0x57e4a8['params']['id'];var _0xa4193b=_0x57e4a8[_0x98c5('0x41')];var _0x4ca120=0xc8;var _0x1ae524=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x98c5('0x53')]['Transaction'][_0x98c5('0x54')][_0x98c5('0x55')]},function(_0x12e5d4){return db['VoiceExtension'][_0x98c5('0x56')]({'where':{'id':_0x15761b},'transaction':_0x12e5d4})['then'](function(_0x301fa4){if(_0x301fa4){return db[_0x98c5('0x25')][_0x98c5('0x12')]({'where':{'VoiceExtensionId':_0x15761b},'transaction':_0x12e5d4})[_0x98c5('0x13')](function(){var _0x39f18f=_[_0x98c5('0x1c')](_0xa4193b,function(_0x4c38fb){_0x4c38fb[_0x98c5('0x57')]=_0x15761b;_0x4c38fb[_0x98c5('0x58')]=!![];return _0x4c38fb;});return _0x301fa4['createRouting'](_0x39f18f);})[_0x98c5('0x13')](function(_0xa68062){return db[_0x98c5('0x25')][_0x98c5('0x59')](_0xa68062,{'transaction':_0x12e5d4});});}else{_0x4ca120=0x194;_0x1ae524=[];}});})[_0x98c5('0x13')](function(){if(_0x4ca120!==0x194){return db[_0x98c5('0x25')][_0x98c5('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x15761b},'order':_0x98c5('0x5b')})[_0x98c5('0x13')](function(_0x3479c2){_0x1ae524=_0x3479c2;});}})[_0x98c5('0x3d')](function(_0x363929){_0x4ca120=0x1f4;logger[_0x98c5('0x21')](_0x363929['stack']);if(_0x363929[_0x98c5('0x23')]){delete _0x363929[_0x98c5('0x23')];}_0x1ae524=_0x363929;})[_0x98c5('0x5c')](function(){if(_0x1ae524===null){_0x1cd653['sendStatus'](_0x4ca120);}else{if(_0x4ca120===0x1f4){_0x1cd653[_0x98c5('0x9')](_0x4ca120)[_0x98c5('0x24')](_0x1ae524);}else{_0x1cd653[_0x98c5('0x9')](_0x4ca120)[_0x98c5('0xb')](_0x1ae524);}}});}; \ No newline at end of file +var _0x010c=['findAll','rows','catch','show','params','includeAll','find','create','body','startsWith','exten','concat','user','role','internal','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','mandatoryDisposition','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','undefined','limit','offset','count','set','json','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','ignore','value','type','UserProfileResource','destroy','error','stack','name','send','map','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x2e9b5b,_0x3e1332){var _0x734c46=function(_0x260a7b){while(--_0x260a7b){_0x2e9b5b['push'](_0x2e9b5b['shift']());}};_0x734c46(++_0x3e1332);}(_0x010c,0x12f));var _0xc010=function(_0x3962df,_0x533854){_0x3962df=_0x3962df-0x0;var _0x5ae774=_0x010c[_0x3962df];return _0x5ae774;};'use strict';var _=require('lodash');var Redis=require(_0xc010('0x0'));var qs=require(_0xc010('0x1'));var logger=require(_0xc010('0x2'))(_0xc010('0x3'));var config=require(_0xc010('0x4'));var db=require('../../mysqldb')['db'];config[_0xc010('0x5')]=_[_0xc010('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc010('0x7'))(new Redis(config[_0xc010('0x5')]));require(_0xc010('0x8'))['register'](socket);function respondWithStatusCode(_0x402a4d,_0x5311fa){_0x5311fa=_0x5311fa||0xcc;return function(_0x495549){if(_0x495549){return _0x402a4d[_0xc010('0x9')](_0x5311fa);}return _0x402a4d[_0xc010('0xa')](_0x5311fa)[_0xc010('0xb')]();};}function respondWithResult(_0x5c2ee1,_0x693b8e){_0x693b8e=_0x693b8e||0xc8;return function(_0x441cb0){if(_0x441cb0){return _0x5c2ee1[_0xc010('0xa')](_0x693b8e)['json'](_0x441cb0);}};}function respondWithFilteredResult(_0x208573,_0x3476c8){return function(_0x29c364){if(_0x29c364){var _0x684da6=typeof _0x3476c8['offset']===_0xc010('0xc')&&typeof _0x3476c8[_0xc010('0xd')]==='undefined';var _0xb379b5=_0x29c364['count'];var _0x17b527=_0x684da6?0x0:_0x3476c8[_0xc010('0xe')];var _0x572fc7=_0x684da6?_0x29c364[_0xc010('0xf')]:_0x3476c8[_0xc010('0xe')]+_0x3476c8[_0xc010('0xd')];var _0x1ec033;if(_0x572fc7>=_0xb379b5){_0x572fc7=_0xb379b5;_0x1ec033=0xc8;}else{_0x1ec033=0xce;}_0x208573[_0xc010('0xa')](_0x1ec033);return _0x208573[_0xc010('0x10')]('Content-Range',_0x17b527+'-'+_0x572fc7+'/'+_0xb379b5)[_0xc010('0x11')](_0x29c364);}return null;};}function removeEntity(_0x4cefe9){return function(_0x49b789){if(_0x49b789){return _0x49b789['destroy']()[_0xc010('0x12')](function(){var _0x5bf026=_0x49b789[_0xc010('0x13')]({'plain':!![]});var _0x33083b=[{'name':_0xc010('0x14'),'value':_0xc010('0x15'),'ignore':![]},{'name':_0xc010('0x16'),'value':_0xc010('0x17'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x1aa041=_(_0x33083b)['filter'](_0xc010('0x18'))['map'](_0xc010('0x19'))[_0xc010('0x19')]();if(_['includes'](_0x1aa041,_0x5bf026['type'])){return;}var _0xaec53b=_['find'](_0x33083b,[_0xc010('0x19'),_0x5bf026[_0xc010('0x1a')]])['name'];return db[_0xc010('0x1b')][_0xc010('0x1c')]({'where':{'type':_0xaec53b,'resourceId':_0x5bf026['id']}})['then'](function(){return _0x49b789;});})[_0xc010('0x12')](function(){_0x4cefe9[_0xc010('0xa')](0xcc)[_0xc010('0xb')]();});}};}function handleEntityNotFound(_0x495c13){return function(_0x1c5078){if(!_0x1c5078){_0x495c13[_0xc010('0x9')](0x194);}return _0x1c5078;};}function handleError(_0x400e23,_0x157efc){_0x157efc=_0x157efc||0x1f4;return function(_0x50553f){logger[_0xc010('0x1d')](_0x50553f[_0xc010('0x1e')]);if(_0x50553f[_0xc010('0x1f')]){delete _0x50553f[_0xc010('0x1f')];}_0x400e23[_0xc010('0xa')](_0x157efc)[_0xc010('0x20')](_0x50553f);};}exports['index']=function(_0x1b4569,_0x29e6a5){var _0x25b905={},_0x411b31={},_0xa72549={'count':0x0,'rows':[]};var _0x484829=_[_0xc010('0x21')](db[_0xc010('0x22')][_0xc010('0x23')],function(_0x56661e){return{'name':_0x56661e[_0xc010('0x24')],'type':_0x56661e[_0xc010('0x1a')][_0xc010('0x25')]};});_0x411b31[_0xc010('0x26')]=_['map'](_0x484829,'name');_0x411b31['query']=_[_0xc010('0x27')](_0x1b4569[_0xc010('0x28')]);_0x411b31[_0xc010('0x29')]=_[_0xc010('0x2a')](_0x411b31[_0xc010('0x26')],_0x411b31[_0xc010('0x28')]);_0x25b905[_0xc010('0x2b')]=_[_0xc010('0x2a')](_0x411b31[_0xc010('0x26')],qs[_0xc010('0x2c')](_0x1b4569[_0xc010('0x28')][_0xc010('0x2c')]));_0x25b905[_0xc010('0x2b')]=_0x25b905[_0xc010('0x2b')][_0xc010('0x2d')]?_0x25b905[_0xc010('0x2b')]:_0x411b31[_0xc010('0x26')];if(!_0x1b4569[_0xc010('0x28')][_0xc010('0x2e')](_0xc010('0x2f'))){_0x25b905['limit']=qs[_0xc010('0xd')](_0x1b4569[_0xc010('0x28')][_0xc010('0xd')]);_0x25b905[_0xc010('0xe')]=qs[_0xc010('0xe')](_0x1b4569[_0xc010('0x28')][_0xc010('0xe')]);}_0x25b905[_0xc010('0x30')]=qs['sort'](_0x1b4569[_0xc010('0x28')][_0xc010('0x31')]);_0x25b905[_0xc010('0x32')]=qs['filters'](_[_0xc010('0x33')](_0x1b4569[_0xc010('0x28')],_0x411b31[_0xc010('0x29')]),_0x484829);if(_0x1b4569['query'][_0xc010('0x34')]){_0x25b905[_0xc010('0x32')]=_[_0xc010('0x35')](_0x25b905['where'],{'$or':_[_0xc010('0x21')](_0x484829,function(_0x47db3c){if(_0x47db3c['type']!==_0xc010('0x36')){var _0x5034d6={};_0x5034d6[_0x47db3c[_0xc010('0x1f')]]={'$like':'%'+_0x1b4569['query']['filter']+'%'};return _0x5034d6;}})});}_0x25b905=_[_0xc010('0x35')]({},_0x25b905,_0x1b4569[_0xc010('0x37')]);var _0x33bb01={'where':_0x25b905[_0xc010('0x32')]};return db[_0xc010('0x22')][_0xc010('0xf')](_0x33bb01)[_0xc010('0x12')](function(_0x4253f2){_0xa72549[_0xc010('0xf')]=_0x4253f2;if(_0x1b4569[_0xc010('0x28')]['includeAll']){_0x25b905[_0xc010('0x38')]=[{'all':!![]}];}return db[_0xc010('0x22')][_0xc010('0x39')](_0x25b905);})[_0xc010('0x12')](function(_0x7d5b4d){_0xa72549[_0xc010('0x3a')]=_0x7d5b4d;return _0xa72549;})['then'](respondWithFilteredResult(_0x29e6a5,_0x25b905))[_0xc010('0x3b')](handleError(_0x29e6a5,null));};exports[_0xc010('0x3c')]=function(_0x1f4925,_0x25c623){var _0x5a34c5={'raw':![],'where':{'id':_0x1f4925[_0xc010('0x3d')]['id']}},_0x3195ba={};_0x3195ba[_0xc010('0x26')]=_[_0xc010('0x27')](db[_0xc010('0x22')][_0xc010('0x23')]);_0x3195ba[_0xc010('0x28')]=_[_0xc010('0x27')](_0x1f4925[_0xc010('0x28')]);_0x3195ba[_0xc010('0x29')]=_['intersection'](_0x3195ba[_0xc010('0x26')],_0x3195ba[_0xc010('0x28')]);_0x5a34c5[_0xc010('0x2b')]=_[_0xc010('0x2a')](_0x3195ba['model'],qs[_0xc010('0x2c')](_0x1f4925[_0xc010('0x28')][_0xc010('0x2c')]));_0x5a34c5[_0xc010('0x2b')]=_0x5a34c5[_0xc010('0x2b')][_0xc010('0x2d')]?_0x5a34c5['attributes']:_0x3195ba[_0xc010('0x26')];if(_0x1f4925[_0xc010('0x28')][_0xc010('0x3e')]){_0x5a34c5[_0xc010('0x38')]=[{'all':!![]}];}_0x5a34c5=_[_0xc010('0x35')]({},_0x5a34c5,_0x1f4925[_0xc010('0x37')]);return db[_0xc010('0x22')][_0xc010('0x3f')](_0x5a34c5)[_0xc010('0x12')](handleEntityNotFound(_0x25c623,null))[_0xc010('0x12')](respondWithResult(_0x25c623,null))[_0xc010('0x3b')](handleError(_0x25c623,null));};exports[_0xc010('0x1c')]=function(_0x5ebbf3,_0x1364c1){return db[_0xc010('0x22')][_0xc010('0x3f')]({'where':{'id':_0x5ebbf3['params']['id']}})[_0xc010('0x12')](handleEntityNotFound(_0x1364c1,null))[_0xc010('0x12')](removeEntity(_0x1364c1,null))[_0xc010('0x3b')](handleError(_0x1364c1,null));};exports[_0xc010('0x40')]=function(_0x4f03f4,_0xc1b9a0){if(_0x4f03f4[_0xc010('0x41')][_0xc010('0x1a')]==='outbound'&&!_[_0xc010('0x42')](_0x4f03f4[_0xc010('0x41')][_0xc010('0x43')],'_')){_0x4f03f4[_0xc010('0x41')][_0xc010('0x43')]='_'[_0xc010('0x44')](_0x4f03f4[_0xc010('0x41')][_0xc010('0x43')]);}return db[_0xc010('0x22')]['create'](_0x4f03f4[_0xc010('0x41')],{'raw':![]})[_0xc010('0x12')](function(_0x47e0ea){var _0x5b7137=_0x4f03f4[_0xc010('0x45')]['get']({'plain':!![]});if(!_0x5b7137)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b7137[_0xc010('0x46')]===_0xc010('0x45')){var _0x91ccd3=_0x47e0ea['get']({'plain':!![]});var _0x24f568=[{'name':_0xc010('0x14'),'value':_0xc010('0x15')},{'name':_0xc010('0x16'),'value':'outbound'},{'name':'InternalRoutes','value':_0xc010('0x47')}];var _0x51bf1b=_[_0xc010('0x3f')](_0x24f568,[_0xc010('0x19'),_0x91ccd3['type']])[_0xc010('0x1f')];return db['UserProfileSection']['find']({'where':{'name':_0x51bf1b,'userProfileId':_0x5b7137['userProfileId']},'raw':!![]})[_0xc010('0x12')](function(_0x332334){if(_0x332334&&_0x332334[_0xc010('0x48')]===0x0){return db[_0xc010('0x1b')][_0xc010('0x40')]({'name':_0x91ccd3['name'],'resourceId':_0x91ccd3['id'],'type':_0x332334[_0xc010('0x1f')],'sectionId':_0x332334['id']},{})[_0xc010('0x12')](function(){return _0x47e0ea;});}else{return _0x47e0ea;}})[_0xc010('0x3b')](function(_0x2fc5a8){logger[_0xc010('0x1d')](_0xc010('0x49'),_0x2fc5a8);throw _0x2fc5a8;});}return _0x47e0ea;})[_0xc010('0x12')](respondWithResult(_0xc1b9a0,0xc9))[_0xc010('0x3b')](handleError(_0xc1b9a0,null));};exports[_0xc010('0x4a')]=function(_0x261d66,_0x37cbe9){if(_0x261d66['body']['id']){delete _0x261d66[_0xc010('0x41')]['id'];}return db[_0xc010('0x22')][_0xc010('0x3f')]({'where':{'id':_0x261d66['params']['id']}})[_0xc010('0x12')](handleEntityNotFound(_0x37cbe9,null))['then'](function(_0x162e67){if(_0x162e67){return db['VoiceExtension']['update'](_[_0xc010('0x33')](_0x261d66[_0xc010('0x41')],[_0xc010('0x43'),_0xc010('0x4b'),_0xc010('0x4c'),'recordingFormat','cutdigits',_0xc010('0x4d'),'alias']),{'where':{'context':_0x162e67[_0xc010('0x4b')],'exten':_0x162e67['exten']},'individualHooks':!![]})[_0xc010('0x12')](function(_0x581cca){return _0x581cca;});}return null;})['then'](respondWithStatusCode(_0x37cbe9,null))[_0xc010('0x3b')](handleError(_0x37cbe9,null));};exports[_0xc010('0x4e')]=function(_0x175fdc,_0x53ee59){var _0x255da0=_0x175fdc[_0xc010('0x3d')]['id'];var _0x24a12a=_0x175fdc[_0xc010('0x41')];var _0x5268ee=0xc8;var _0x4a705c=null;return db[_0xc010('0x4f')]['transaction']({'isolationLevel':db[_0xc010('0x4f')][_0xc010('0x50')][_0xc010('0x51')]['READ_COMMITTED']},function(_0x1d6690){return db[_0xc010('0x22')][_0xc010('0x52')]({'where':{'id':_0x255da0},'transaction':_0x1d6690})['then'](function(_0x540094){if(_0x540094){return db[_0xc010('0x22')][_0xc010('0x1c')]({'where':{'VoiceExtensionId':_0x255da0},'transaction':_0x1d6690})['then'](function(){var _0x38e60d=_[_0xc010('0x21')](_0x24a12a,function(_0x4ba109){_0x4ba109[_0xc010('0x53')]=_0x255da0;_0x4ba109[_0xc010('0x54')]=!![];return _0x4ba109;});return _0x540094[_0xc010('0x55')](_0x38e60d);})['then'](function(_0x940c6e){return db[_0xc010('0x22')][_0xc010('0x56')](_0x940c6e,{'transaction':_0x1d6690});});}else{_0x5268ee=0x194;_0x4a705c=[];}});})[_0xc010('0x12')](function(){if(_0x5268ee!==0x194){return db[_0xc010('0x22')][_0xc010('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x255da0},'order':_0xc010('0x58')})[_0xc010('0x12')](function(_0x5bbf0b){_0x4a705c=_0x5bbf0b;});}})[_0xc010('0x3b')](function(_0xbb1925){_0x5268ee=0x1f4;logger[_0xc010('0x1d')](_0xbb1925[_0xc010('0x1e')]);if(_0xbb1925[_0xc010('0x1f')]){delete _0xbb1925['name'];}_0x4a705c=_0xbb1925;})[_0xc010('0x59')](function(){if(_0x4a705c===null){_0x53ee59['sendStatus'](_0x5268ee);}else{if(_0x5268ee===0x1f4){_0x53ee59[_0xc010('0xa')](_0x5268ee)[_0xc010('0x20')](_0x4a705c);}else{_0x53ee59[_0xc010('0xa')](_0x5268ee)[_0xc010('0x11')](_0x4a705c);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index ae9b3cc..1558d86 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 _0xc841=['exports','events','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x3ef367,_0x45a46f){var _0xeb4de=function(_0x5ceac0){while(--_0x5ceac0){_0x3ef367['push'](_0x3ef367['shift']());}};_0xeb4de(++_0x45a46f);}(_0xc841,0xe8));var _0x1c84=function(_0x57ba40,_0x263703){_0x57ba40=_0x57ba40-0x0;var _0x4c7112=_0xc841[_0x57ba40];return _0x4c7112;};'use strict';var EventEmitter=require(_0x1c84('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x1c84('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1c84('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c84('0x3'),'afterDestroy':_0x1c84('0x4')};function emitEvent(_0x29b10c){return function(_0x57eeb3,_0x4ce813,_0x8ac65b){VoiceExtensionEvents[_0x1c84('0x5')](_0x29b10c+':'+_0x57eeb3['id'],_0x57eeb3);VoiceExtensionEvents[_0x1c84('0x5')](_0x29b10c,_0x57eeb3);_0x8ac65b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x1c84('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x14ab=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','save','update','remove'];(function(_0x3a62b0,_0x4ee605){var _0x374522=function(_0x1c18a5){while(--_0x1c18a5){_0x3a62b0['push'](_0x3a62b0['shift']());}};_0x374522(++_0x4ee605);}(_0x14ab,0x144));var _0xb14a=function(_0x155276,_0x430d9f){_0x155276=_0x155276-0x0;var _0x431285=_0x14ab[_0x155276];return _0x431285;};'use strict';var EventEmitter=require(_0xb14a('0x0'));var VoiceExtension=require(_0xb14a('0x1'))['db'][_0xb14a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb14a('0x3'),'afterUpdate':_0xb14a('0x4'),'afterDestroy':_0xb14a('0x5')};function emitEvent(_0xd31283){return function(_0x1315eb,_0x20dfbd,_0x322d0e){VoiceExtensionEvents[_0xb14a('0x6')](_0xd31283+':'+_0x1315eb['id'],_0x1315eb);VoiceExtensionEvents[_0xb14a('0x6')](_0xd31283,_0x1315eb);_0x322d0e(null);};}for(var e in events){if(events[_0xb14a('0x7')](e)){var event=events[e];VoiceExtension[_0xb14a('0x8')](e,emitEvent(event));}}module[_0xb14a('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a72a29c..162adf2 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 _0xee87=['push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','length','name','param','split','phone','prefix','SIP','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','IntervalId','then','interval','*,*,*,*','intervals','map','filter','tag','toLowerCase','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','get','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound'];(function(_0x2bfd4f,_0x1bbf2c){var _0x341849=function(_0x4c246e){while(--_0x4c246e){_0x2bfd4f['push'](_0x2bfd4f['shift']());}};_0x341849(++_0x1bbf2c);}(_0xee87,0x193));var _0x7ee8=function(_0x633ab1,_0x22afa1){_0x633ab1=_0x633ab1-0x0;var _0x4043c1=_0xee87[_0x633ab1];return _0x4043c1;};'use strict';var _=require('lodash');var attributes=require(_0x7ee8('0x0'));module['exports']=function(_0x4de157){var _0x4d7a1d=_0x4de157[_0x7ee8('0x1')];function _0xe4d376(_0x1d9ddf){var _0x5b5055=0x2;var _0x375133=[{'type':_0x1d9ddf[_0x7ee8('0x2')],'app':'Set','appdata':_0x7ee8('0x3')+_0x1d9ddf[_0x7ee8('0x2')],'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf[_0x7ee8('0x5')],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']},{'type':_0x1d9ddf[_0x7ee8('0x2')],'app':_0x1d9ddf[_0x7ee8('0x6')]?_0x7ee8('0x7'):_0x7ee8('0x8'),'appdata':_0x1d9ddf[_0x7ee8('0x6')]?_0x7ee8('0x9')+_0x1d9ddf[_0x7ee8('0x6')]:_0x7ee8('0xa'),'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf['exten'],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']}];if(_0x1d9ddf[_0x7ee8('0x2')]===_0x7ee8('0xb')){_0x375133[_0x7ee8('0xc')]({'type':_0x7ee8('0xb'),'app':'Set','appdata':_0x7ee8('0xd')+_0x1d9ddf['id'],'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf[_0x7ee8('0x5')],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']});}_0x375133[_0x7ee8('0xc')]({'type':_0x1d9ddf[_0x7ee8('0x2')],'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0xe'),'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf[_0x7ee8('0x5')],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']},{'type':_0x1d9ddf[_0x7ee8('0x2')],'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0xf'),'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf[_0x7ee8('0x5')],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']},{'type':_0x1d9ddf[_0x7ee8('0x2')],'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x10'),'context':_0x1d9ddf[_0x7ee8('0x4')],'exten':_0x1d9ddf[_0x7ee8('0x5')],'priority':_0x5b5055++,'VoiceExtensionId':_0x1d9ddf['id']});return _0x375133;}function _0x3b2c7e(_0x4935f2){var _0x3b167c=0x2;var _0x6e4192=[{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x12'),'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':'outbound','app':_0x4935f2[_0x7ee8('0x6')]?'Set':_0x7ee8('0x8'),'appdata':_0x4935f2['alias']?_0x7ee8('0x9')+_0x4935f2[_0x7ee8('0x6')]:_0x7ee8('0xa'),'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x13')+(_0x4935f2[_0x7ee8('0x14')]?_0x7ee8('0x15')+_0x4935f2[_0x7ee8('0x14')]+'}':'${EXTEN}'),'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0xd')+_0x4935f2['id'],'context':_0x4935f2['context'],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x16'),'appdata':_0x7ee8('0x17')+(_0x3b167c+0x2)+_0x7ee8('0x18')+(_0x3b167c+0x1)+')','context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2['exten'],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':'Set','appdata':_0x4935f2[_0x7ee8('0x14')]?_0x7ee8('0x19')+_0x4935f2[_0x7ee8('0x14')]+'}':_0x7ee8('0x1a'),'context':_0x4935f2['context'],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0xe'),'context':_0x4935f2['context'],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':'Set','appdata':_0x7ee8('0xf'),'context':_0x4935f2['context'],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x10'),'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2['exten'],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':'outbound','app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x1b')+_0x4935f2['id'],'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2['exten'],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']}];if(_0x4935f2[_0x7ee8('0x1c')](_0x7ee8('0x1d'))&&_0x4935f2[_0x7ee8('0x1d')]!=='none'){_0x6e4192['push']({'type':'outbound','app':_0x7ee8('0x7'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4935f2['context'],'exten':_0x4935f2[_0x7ee8('0x5')],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']},{'type':_0x7ee8('0x11'),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x1e')+_0x4935f2[_0x7ee8('0x1d')]||_0x7ee8('0x1f'),'context':_0x4935f2[_0x7ee8('0x4')],'exten':_0x4935f2['exten'],'priority':_0x3b167c++,'VoiceExtensionId':_0x4935f2['id']});}return _0x6e4192;}function _0x19a8c5(_0x36e6d0,_0x394b12){var _0x5c5cdd=[{'name':_0x7ee8('0x20'),'param':0x0},{'name':_0x7ee8('0x21'),'param':0x1},{'name':_0x7ee8('0x22'),'param':0x2},{'name':_0x7ee8('0x23'),'param':0x3}];var _0x4500dd={};var _0x20ca78=_0x394b12['split'](',');var _0x49cad8=[];for(var _0x4a52cc=0x0;_0x4a52cc<_0x5c5cdd[_0x7ee8('0x24')];_0x4a52cc++){switch(_0x5c5cdd[_0x4a52cc][_0x7ee8('0x25')]){case _0x7ee8('0x20'):_0x4500dd[_0x7ee8('0x20')]=_0x20ca78[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]][_0x7ee8('0x27')]('/')[0x1];_0x4500dd[_0x7ee8('0x28')]=_0x20ca78[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]][_0x7ee8('0x27')]('/')[0x2];_0x4500dd['prefix']=_0x4500dd[_0x7ee8('0x28')]?_0x4500dd[_0x7ee8('0x28')][_0x7ee8('0x27')]('$')[0x0]:undefined;_0x4500dd[_0x7ee8('0x28')]=_0x36e6d0[_0x7ee8('0x14')]?(_0x4500dd[_0x7ee8('0x29')]||'')+_0x7ee8('0x15')+_0x36e6d0[_0x7ee8('0x14')]+'}':(_0x4500dd[_0x7ee8('0x29')]||'')+'${EXTEN}';_0x49cad8[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]]=[_0x7ee8('0x2a'),_0x4500dd[_0x7ee8('0x20')],_0x4500dd[_0x7ee8('0x28')]][_0x7ee8('0x2b')]('/');break;case _0x7ee8('0x22'):_0x4500dd['options']=_0x20ca78[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]];if(_0x36e6d0['recordingFormat']!==_0x7ee8('0x2c')){if(_0x4500dd[_0x7ee8('0x22')][_0x7ee8('0x2d')]('U(xcally-mixmonitor-context)')<0x0){_0x4500dd['options']+=_0x7ee8('0x2e');}}else{_0x4500dd[_0x7ee8('0x22')]=_0x4500dd[_0x7ee8('0x22')][_0x7ee8('0x2f')](_0x7ee8('0x2e'),'');}_0x49cad8[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]]=_0x4500dd[_0x7ee8('0x22')];break;default:_0x49cad8[_0x5c5cdd[_0x4a52cc][_0x7ee8('0x26')]]=_0x20ca78[_0x5c5cdd[_0x4a52cc]['param']];}}return _0x49cad8[_0x7ee8('0x2b')](',');}function _0x52439a(_0x549b3b,_0x483f13,_0x5890f4){return new Promise(function(_0x269c24,_0x19bdf8){var _0x403b4d=[];if(_[_0x7ee8('0x30')](_0x483f13))return _0x269c24(_0x403b4d);_0x4d7a1d[_0x7ee8('0x31')][_0x7ee8('0x32')]({'attributes':['id','interval',_0x7ee8('0x33')],'raw':!![]})[_0x7ee8('0x34')](function(_0x721d3b){for(var _0x1b2013=0x0,_0x1e5e79=0x0;_0x1b2013<_0x483f13['length'];_0x1b2013++,_0x1e5e79=0x0){var _0x37bd42=_0x483f13[_0x1b2013];var _0x2bce7a=[];var _0x1aec30=[];delete _0x37bd42['id'];if(_0x37bd42[_0x7ee8('0x35')]!==_0x7ee8('0x36')){_0x37bd42[_0x7ee8('0x37')]=[_0x37bd42[_0x7ee8('0x35')]];}else{_0x37bd42['intervals']=_0x37bd42[_0x7ee8('0x33')]?_[_0x7ee8('0x38')](_[_0x7ee8('0x39')](_0x721d3b,{'IntervalId':_0x37bd42[_0x7ee8('0x33')]}),_0x7ee8('0x35')):[];}_0x37bd42[_0x7ee8('0x4')]=_0x549b3b[_0x7ee8('0x4')];_0x37bd42[_0x7ee8('0x5')]=_0x549b3b['exten'];if(_0x37bd42[_0x7ee8('0x2')])_0x37bd42[_0x7ee8('0x2')]=_0x37bd42[_0x7ee8('0x2')]['toLowerCase']();if(_0x549b3b[_0x7ee8('0x2')]==='outbound'){if(_0x37bd42['hasOwnProperty'](_0x7ee8('0x3a'))&&_0x37bd42[_0x7ee8('0x3a')]&&_0x37bd42[_0x7ee8('0x3a')]!=='--'){_0x2bce7a[_0x7ee8('0xc')]({'type':_0x37bd42[_0x7ee8('0x2')][_0x7ee8('0x3b')](),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x3c')+_0x37bd42[_0x7ee8('0x3a')],'context':_0x549b3b[_0x7ee8('0x4')],'exten':_0x549b3b[_0x7ee8('0x5')],'priority':_0x37bd42[_0x7ee8('0x37')]['length']+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});}_0x2bce7a['push']({'type':_0x37bd42[_0x7ee8('0x2')][_0x7ee8('0x3b')](),'app':'ExecIf','appdata':_0x7ee8('0x3d')+(_0x37bd42[_0x7ee8('0x3e')]?'Set(CALLERID(all)='+_0x37bd42[_0x7ee8('0x3e')]+')':_0x7ee8('0x3f')),'context':_0x549b3b[_0x7ee8('0x4')],'exten':_0x549b3b['exten'],'priority':_0x37bd42['intervals'][_0x7ee8('0x24')]+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});}else{if(_0x37bd42['hasOwnProperty'](_0x7ee8('0x40'))){if([_0x7ee8('0x41'),_0x7ee8('0x42')]['includes'](_0x37bd42[_0x7ee8('0x43')][_0x7ee8('0x3b')]())&&_0x37bd42[_0x7ee8('0x44')]!==_0x7ee8('0x45')){if(_0x37bd42[_0x7ee8('0x40')]){_0x2bce7a['push']({'type':_0x37bd42['type'][_0x7ee8('0x3b')](),'app':_0x7ee8('0x16'),'appdata':_0x7ee8('0x46'),'context':_0x549b3b['context'],'exten':_0x549b3b[_0x7ee8('0x5')],'priority':_0x37bd42[_0x7ee8('0x37')][_0x7ee8('0x24')]+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});_0x2bce7a[_0x7ee8('0xc')]({'type':_0x37bd42[_0x7ee8('0x2')]['toLowerCase'](),'app':_0x7ee8('0x7'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x549b3b['context'],'exten':_0x549b3b[_0x7ee8('0x5')],'priority':_0x37bd42[_0x7ee8('0x37')][_0x7ee8('0x24')]+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});}else{_0x2bce7a[_0x7ee8('0xc')]({'type':_0x37bd42[_0x7ee8('0x2')][_0x7ee8('0x3b')](),'app':_0x7ee8('0x16'),'appdata':_0x7ee8('0x47'),'context':_0x549b3b[_0x7ee8('0x4')],'exten':_0x549b3b[_0x7ee8('0x5')],'priority':_0x37bd42[_0x7ee8('0x37')]['length']+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});_0x2bce7a[_0x7ee8('0xc')]({'type':_0x37bd42[_0x7ee8('0x2')][_0x7ee8('0x3b')](),'app':_0x7ee8('0x7'),'appdata':_0x7ee8('0x48'),'context':_0x549b3b[_0x7ee8('0x4')],'exten':_0x549b3b[_0x7ee8('0x5')],'priority':_0x37bd42[_0x7ee8('0x37')][_0x7ee8('0x24')]+_0x5890f4+_0x1e5e79++,'VoiceExtensionId':_0x549b3b['id']});}}}}for(var _0xaffd8e=0x0;_0xaffd8e<_0x37bd42[_0x7ee8('0x37')][_0x7ee8('0x24')];_0xaffd8e++){var _0x27592b=_0x5890f4+_0x37bd42['intervals'][_0x7ee8('0x24')];var _0x49354d=_0xaffd8e===_0x37bd42[_0x7ee8('0x37')][_0x7ee8('0x24')]-0x1?_0x5890f4+_0x2bce7a[_0x7ee8('0x24')]+_0x1aec30['length']+0x2:_0x5890f4+_0xaffd8e+0x1;_0x2bce7a[_0x7ee8('0x49')](_0xaffd8e,0x0,{'type':_0x549b3b[_0x7ee8('0x2')],'app':_0x7ee8('0x4a'),'appdata':_0x37bd42['intervals'][_0xaffd8e]+'?'+_0x549b3b[_0x7ee8('0x4')]+_0x7ee8('0x4b')+_0x27592b+':'+_0x549b3b[_0x7ee8('0x4')]+',${EXTEN},'+_0x49354d,'exten':_0x549b3b['exten'],'context':_0x549b3b['context'],'priority':_0x5890f4+_0xaffd8e,'VoiceExtensionId':_0x549b3b['id']});}if(_0x37bd42[_0x7ee8('0x44')]===_0x7ee8('0x4c'))_0x37bd42[_0x7ee8('0x4d')]=_0x19a8c5(_0x549b3b,_0x37bd42[_0x7ee8('0x4d')]);_0x37bd42[_0x7ee8('0x4e')]=_0x2bce7a[_0x7ee8('0x24')]?_[_0x7ee8('0x4f')](_0x2bce7a)[_0x7ee8('0x4e')]+0x1:_0x5890f4;_0x403b4d=_['concat'](_0x403b4d,_0x2bce7a,[_0x37bd42],_0x1aec30);_0x5890f4=_[_0x7ee8('0x4f')](_0x403b4d)[_0x7ee8('0x4e')]+0x1;}return _0x269c24(_0x403b4d);})[_0x7ee8('0x50')](function(_0x4febf7){_0x19bdf8(_0x4febf7);});});}return _0x4de157[_0x7ee8('0x51')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3dc3cb){var _0x28f5a4=this[_0x7ee8('0x52')]({'plain':!![]});var _0x461917=_0x28f5a4[_0x7ee8('0x2')]==='outbound'?_0x3b2c7e(_0x28f5a4):_0xe4d376(_0x28f5a4);return _0x52439a(_0x28f5a4,_0x3dc3cb,_['last'](_0x461917)[_0x7ee8('0x4e')]+0x1)['then'](function(_0x216650){var _0x174c99=_['concat'](_0x461917,_0x216650);_0x174c99[_0x7ee8('0xc')]({'type':_0x28f5a4['type'],'app':'Hangup','exten':_0x28f5a4['exten'],'context':_0x28f5a4[_0x7ee8('0x4')],'priority':_['last'](_0x174c99)[_0x7ee8('0x4e')]+0x1,'VoiceExtensionId':_0x28f5a4['id']});return _0x174c99;});}}});}; \ No newline at end of file +var _0x4c7b=['push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','length','param','split','phone','prefix','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','playback','appType','custom','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','VoiceExtension','voice_extensions','Hangup','lodash','exports','models','type','Set','CDR(type)=','context','exten','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound'];(function(_0x13519e,_0x5d4e71){var _0x20a50c=function(_0x40abb6){while(--_0x40abb6){_0x13519e['push'](_0x13519e['shift']());}};_0x20a50c(++_0x5d4e71);}(_0x4c7b,0x128));var _0xb4c7=function(_0x27d0e4,_0x45ef82){_0x27d0e4=_0x27d0e4-0x0;var _0x4039e3=_0x4c7b[_0x27d0e4];return _0x4039e3;};'use strict';var _=require(_0xb4c7('0x0'));var attributes=require('./voiceExtension.attributes');module[_0xb4c7('0x1')]=function(_0x546014){var _0x10a056=_0x546014[_0xb4c7('0x2')];function _0x536f4d(_0x197e5e){var _0x47912f=0x2;var _0x319e4d=[{'type':_0x197e5e[_0xb4c7('0x3')],'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x5')+_0x197e5e[_0xb4c7('0x3')],'context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e[_0xb4c7('0x7')],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']},{'type':_0x197e5e['type'],'app':_0x197e5e['alias']?'Set':'NoOp','appdata':_0x197e5e['alias']?_0xb4c7('0x8')+_0x197e5e[_0xb4c7('0x9')]:_0xb4c7('0xa'),'context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e[_0xb4c7('0x7')],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']}];if(_0x197e5e[_0xb4c7('0x3')]===_0xb4c7('0xb')){_0x319e4d[_0xb4c7('0xc')]({'type':_0xb4c7('0xb'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0xd')+_0x197e5e['id'],'context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e['exten'],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']});}_0x319e4d['push']({'type':_0x197e5e[_0xb4c7('0x3')],'app':_0xb4c7('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e[_0xb4c7('0x7')],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']},{'type':_0x197e5e[_0xb4c7('0x3')],'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0xe'),'context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e[_0xb4c7('0x7')],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']},{'type':_0x197e5e[_0xb4c7('0x3')],'app':_0xb4c7('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0x197e5e[_0xb4c7('0x6')],'exten':_0x197e5e[_0xb4c7('0x7')],'priority':_0x47912f++,'VoiceExtensionId':_0x197e5e['id']});return _0x319e4d;}function _0x3fbb35(_0x409de7){var _0x5884bb=0x2;var _0x4dcd6b=[{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x10'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0x409de7['alias']?'Set':'NoOp','appdata':_0x409de7[_0xb4c7('0x9')]?_0xb4c7('0x8')+_0x409de7[_0xb4c7('0x9')]:'No\x20alias\x20set','context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x11')+(_0x409de7['cutdigits']?_0xb4c7('0x12')+_0x409de7['cutdigits']+'}':'${EXTEN}'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0xd')+_0x409de7['id'],'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':'ExecIf','appdata':_0xb4c7('0x13')+(_0x5884bb+0x2)+_0xb4c7('0x14')+(_0x5884bb+0x1)+')','context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':'Set','appdata':_0x409de7[_0xb4c7('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x409de7[_0xb4c7('0x15')]+'}':_0xb4c7('0x16'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7['exten'],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':'outbound','app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x17'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0xe'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x18'),'context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7['exten'],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':_0xb4c7('0xf'),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x19')+_0x409de7['id'],'context':_0x409de7['context'],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']}];if(_0x409de7['hasOwnProperty'](_0xb4c7('0x1a'))&&_0x409de7[_0xb4c7('0x1a')]!==_0xb4c7('0x1b')){_0x4dcd6b[_0xb4c7('0xc')]({'type':_0xb4c7('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']},{'type':'outbound','app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x1c')+_0x409de7['recordingFormat']||'wav','context':_0x409de7[_0xb4c7('0x6')],'exten':_0x409de7[_0xb4c7('0x7')],'priority':_0x5884bb++,'VoiceExtensionId':_0x409de7['id']});}return _0x4dcd6b;}function _0x4a7376(_0x19dae3,_0x46958e){var _0x5b4f55=[{'name':_0xb4c7('0x1d'),'param':0x0},{'name':_0xb4c7('0x1e'),'param':0x1},{'name':_0xb4c7('0x1f'),'param':0x2},{'name':_0xb4c7('0x20'),'param':0x3}];var _0x2056db={};var _0x35cfab=_0x46958e['split'](',');var _0x18a2b6=[];for(var _0x47b642=0x0;_0x47b642<_0x5b4f55[_0xb4c7('0x21')];_0x47b642++){switch(_0x5b4f55[_0x47b642]['name']){case _0xb4c7('0x1d'):_0x2056db[_0xb4c7('0x1d')]=_0x35cfab[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]][_0xb4c7('0x23')]('/')[0x1];_0x2056db[_0xb4c7('0x24')]=_0x35cfab[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]][_0xb4c7('0x23')]('/')[0x2];_0x2056db[_0xb4c7('0x25')]=_0x2056db[_0xb4c7('0x24')]?_0x2056db[_0xb4c7('0x24')][_0xb4c7('0x23')]('$')[0x0]:undefined;_0x2056db[_0xb4c7('0x24')]=_0x19dae3['cutdigits']?(_0x2056db[_0xb4c7('0x25')]||'')+_0xb4c7('0x12')+_0x19dae3[_0xb4c7('0x15')]+'}':(_0x2056db['prefix']||'')+'${EXTEN}';_0x18a2b6[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]]=[_0xb4c7('0x26'),_0x2056db[_0xb4c7('0x1d')],_0x2056db['phone']]['join']('/');break;case _0xb4c7('0x1f'):_0x2056db['options']=_0x35cfab[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]];if(_0x19dae3[_0xb4c7('0x1a')]!==_0xb4c7('0x1b')){if(_0x2056db[_0xb4c7('0x1f')][_0xb4c7('0x27')](_0xb4c7('0x28'))<0x0){_0x2056db[_0xb4c7('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x2056db[_0xb4c7('0x1f')]=_0x2056db['options'][_0xb4c7('0x29')](_0xb4c7('0x28'),'');}_0x18a2b6[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]]=_0x2056db['options'];break;default:_0x18a2b6[_0x5b4f55[_0x47b642]['param']]=_0x35cfab[_0x5b4f55[_0x47b642][_0xb4c7('0x22')]];}}return _0x18a2b6[_0xb4c7('0x2a')](',');}function _0x22ead3(_0x4d2a45,_0x19de9b,_0x2be547){return new Promise(function(_0x3d2c49,_0x37b413){var _0x2c8ce6=[];if(_[_0xb4c7('0x2b')](_0x19de9b))return _0x3d2c49(_0x2c8ce6);_0x10a056['Interval']['findAll']({'attributes':['id',_0xb4c7('0x2c'),_0xb4c7('0x2d')],'raw':!![]})[_0xb4c7('0x2e')](function(_0x23520d){for(var _0x86d0c8=0x0,_0x1bbb21=0x0;_0x86d0c8<_0x19de9b[_0xb4c7('0x21')];_0x86d0c8++,_0x1bbb21=0x0){var _0x2ead40=_0x19de9b[_0x86d0c8];var _0x49cd40=[];var _0xb1ee1c=[];delete _0x2ead40['id'];if(_0x2ead40[_0xb4c7('0x2c')]!==_0xb4c7('0x2f')){_0x2ead40['intervals']=[_0x2ead40[_0xb4c7('0x2c')]];}else{_0x2ead40[_0xb4c7('0x30')]=_0x2ead40[_0xb4c7('0x2d')]?_[_0xb4c7('0x31')](_[_0xb4c7('0x32')](_0x23520d,{'IntervalId':_0x2ead40[_0xb4c7('0x2d')]}),_0xb4c7('0x2c')):[];}_0x2ead40[_0xb4c7('0x6')]=_0x4d2a45[_0xb4c7('0x6')];_0x2ead40['exten']=_0x4d2a45['exten'];if(_0x2ead40[_0xb4c7('0x3')])_0x2ead40[_0xb4c7('0x3')]=_0x2ead40[_0xb4c7('0x3')][_0xb4c7('0x33')]();if(_0x4d2a45[_0xb4c7('0x3')]===_0xb4c7('0xf')){if(_0x2ead40[_0xb4c7('0x34')](_0xb4c7('0x35'))&&_0x2ead40['tag']&&_0x2ead40[_0xb4c7('0x35')]!=='--'){_0x49cd40[_0xb4c7('0xc')]({'type':_0x2ead40[_0xb4c7('0x3')]['toLowerCase'](),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x36')+_0x2ead40[_0xb4c7('0x35')],'context':_0x4d2a45[_0xb4c7('0x6')],'exten':_0x4d2a45['exten'],'priority':_0x2ead40[_0xb4c7('0x30')][_0xb4c7('0x21')]+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});}_0x49cd40[_0xb4c7('0xc')]({'type':_0x2ead40[_0xb4c7('0x3')][_0xb4c7('0x33')](),'app':'ExecIf','appdata':_0xb4c7('0x37')+(_0x2ead40['callerID']?'Set(CALLERID(all)='+_0x2ead40[_0xb4c7('0x38')]+')':_0xb4c7('0x39')),'context':_0x4d2a45['context'],'exten':_0x4d2a45[_0xb4c7('0x7')],'priority':_0x2ead40[_0xb4c7('0x30')][_0xb4c7('0x21')]+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});}else{if(_0x2ead40['hasOwnProperty'](_0xb4c7('0x3a'))){if(['queue',_0xb4c7('0x3b')]['includes'](_0x2ead40['app'][_0xb4c7('0x33')]())&&_0x2ead40[_0xb4c7('0x3c')]!==_0xb4c7('0x3d')){if(_0x2ead40[_0xb4c7('0x3a')]){_0x49cd40['push']({'type':_0x2ead40['type'][_0xb4c7('0x33')](),'app':_0xb4c7('0x3e'),'appdata':_0xb4c7('0x3f'),'context':_0x4d2a45[_0xb4c7('0x6')],'exten':_0x4d2a45['exten'],'priority':_0x2ead40[_0xb4c7('0x30')][_0xb4c7('0x21')]+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});_0x49cd40[_0xb4c7('0xc')]({'type':_0x2ead40['type'][_0xb4c7('0x33')](),'app':_0xb4c7('0x4'),'appdata':_0xb4c7('0x40'),'context':_0x4d2a45[_0xb4c7('0x6')],'exten':_0x4d2a45[_0xb4c7('0x7')],'priority':_0x2ead40[_0xb4c7('0x30')][_0xb4c7('0x21')]+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});}else{_0x49cd40['push']({'type':_0x2ead40[_0xb4c7('0x3')][_0xb4c7('0x33')](),'app':_0xb4c7('0x3e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x4d2a45[_0xb4c7('0x6')],'exten':_0x4d2a45[_0xb4c7('0x7')],'priority':_0x2ead40['intervals']['length']+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});_0x49cd40[_0xb4c7('0xc')]({'type':_0x2ead40[_0xb4c7('0x3')][_0xb4c7('0x33')](),'app':'Set','appdata':_0xb4c7('0x41'),'context':_0x4d2a45['context'],'exten':_0x4d2a45[_0xb4c7('0x7')],'priority':_0x2ead40['intervals'][_0xb4c7('0x21')]+_0x2be547+_0x1bbb21++,'VoiceExtensionId':_0x4d2a45['id']});}}}}for(var _0x1279da=0x0;_0x1279da<_0x2ead40[_0xb4c7('0x30')][_0xb4c7('0x21')];_0x1279da++){var _0x1f27f6=_0x2be547+_0x2ead40['intervals'][_0xb4c7('0x21')];var _0x367f0a=_0x1279da===_0x2ead40[_0xb4c7('0x30')]['length']-0x1?_0x2be547+_0x49cd40[_0xb4c7('0x21')]+_0xb1ee1c['length']+0x2:_0x2be547+_0x1279da+0x1;_0x49cd40[_0xb4c7('0x42')](_0x1279da,0x0,{'type':_0x4d2a45['type'],'app':_0xb4c7('0x43'),'appdata':_0x2ead40[_0xb4c7('0x30')][_0x1279da]+'?'+_0x4d2a45[_0xb4c7('0x6')]+_0xb4c7('0x44')+_0x1f27f6+':'+_0x4d2a45[_0xb4c7('0x6')]+_0xb4c7('0x44')+_0x367f0a,'exten':_0x4d2a45[_0xb4c7('0x7')],'context':_0x4d2a45[_0xb4c7('0x6')],'priority':_0x2be547+_0x1279da,'VoiceExtensionId':_0x4d2a45['id']});}if(_0x2ead40[_0xb4c7('0x3c')]===_0xb4c7('0x45'))_0x2ead40[_0xb4c7('0x46')]=_0x4a7376(_0x4d2a45,_0x2ead40[_0xb4c7('0x46')]);_0x2ead40[_0xb4c7('0x47')]=_0x49cd40['length']?_[_0xb4c7('0x48')](_0x49cd40)[_0xb4c7('0x47')]+0x1:_0x2be547;_0x2c8ce6=_[_0xb4c7('0x49')](_0x2c8ce6,_0x49cd40,[_0x2ead40],_0xb1ee1c);_0x2be547=_[_0xb4c7('0x48')](_0x2c8ce6)[_0xb4c7('0x47')]+0x1;}return _0x3d2c49(_0x2c8ce6);})['catch'](function(_0x5f052b){_0x37b413(_0x5f052b);});});}return _0x546014['define'](_0xb4c7('0x4a'),attributes,{'tableName':_0xb4c7('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4bcfc3){var _0x59ed44=this['get']({'plain':!![]});var _0x17c503=_0x59ed44[_0xb4c7('0x3')]===_0xb4c7('0xf')?_0x3fbb35(_0x59ed44):_0x536f4d(_0x59ed44);return _0x22ead3(_0x59ed44,_0x4bcfc3,_[_0xb4c7('0x48')](_0x17c503)[_0xb4c7('0x47')]+0x1)[_0xb4c7('0x2e')](function(_0x342bfe){var _0x1a5f2f=_['concat'](_0x17c503,_0x342bfe);_0x1a5f2f['push']({'type':_0x59ed44[_0xb4c7('0x3')],'app':_0xb4c7('0x4c'),'exten':_0x59ed44['exten'],'context':_0x59ed44[_0xb4c7('0x6')],'priority':_['last'](_0x1a5f2f)['priority']+0x1,'VoiceExtensionId':_0x59ed44['id']});return _0x1a5f2f;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5a98147..9f87f1f 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 _0xfb15=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','raw','limit','map','model','attributes','include','GetVoiceExtension','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb15,0x12f));var _0x5fb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfb15[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x5fb1('0x0'));var util=require(_0x5fb1('0x1'));var moment=require(_0x5fb1('0x2'));var BPromise=require(_0x5fb1('0x3'));var rs=require(_0x5fb1('0x4'));var fs=require('fs');var Redis=require(_0x5fb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fb1('0x6'));var logger=require(_0x5fb1('0x7'))(_0x5fb1('0x8'));var config=require(_0x5fb1('0x9'));var jayson=require(_0x5fb1('0xa'));var client=jayson[_0x5fb1('0xb')]['http']({'port':0x232a});config[_0x5fb1('0xc')]=_['defaults'](config['redis'],{'host':_0x5fb1('0xd'),'port':0x18eb});var socket=require(_0x5fb1('0xe'))(new Redis(config[_0x5fb1('0xc')]));require(_0x5fb1('0xf'))[_0x5fb1('0x10')](socket);function respondWithRpcPromise(_0x226da1,_0xacf09e,_0x39c159){return new BPromise(function(_0x249e1a,_0x327e45){return client[_0x5fb1('0x11')](_0x226da1,_0x39c159)[_0x5fb1('0x12')](function(_0x150368){logger['info'](_0x5fb1('0x13'),_0xacf09e,_0x5fb1('0x14'));logger['debug'](_0x5fb1('0x15'),_0xacf09e,_0x5fb1('0x14'),JSON['stringify'](_0x150368));if(_0x150368[_0x5fb1('0x16')]){if(_0x150368[_0x5fb1('0x16')][_0x5fb1('0x17')]===0x1f4){logger[_0x5fb1('0x16')](_0x5fb1('0x13'),_0xacf09e,_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);return _0x327e45(_0x150368[_0x5fb1('0x16')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0xacf09e,_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);return _0x249e1a(_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);}else{logger[_0x5fb1('0x19')](_0x5fb1('0x13'),_0xacf09e,'request\x20sent');_0x249e1a(_0x150368[_0x5fb1('0x1a')][_0x5fb1('0x18')]);}})[_0x5fb1('0x1b')](function(_0x3548ff){logger[_0x5fb1('0x16')](_0x5fb1('0x13'),_0xacf09e,_0x3548ff);_0x327e45(_0x3548ff);});});}exports['GetVoiceExtension']=function(_0x51189d){var _0x4f4c4c=this;return new Promise(function(_0x2174e5,_0x1fa373){return db['VoiceExtension'][_0x5fb1('0x1c')]({'raw':_0x51189d[_0x5fb1('0x1d')]?_0x51189d[_0x5fb1('0x1d')][_0x5fb1('0x1e')]===undefined?!![]:![]:!![],'where':_0x51189d[_0x5fb1('0x1d')]?_0x51189d[_0x5fb1('0x1d')]['where']||null:null,'attributes':_0x51189d[_0x5fb1('0x1d')]?_0x51189d['options']['attributes']||null:null,'limit':_0x51189d[_0x5fb1('0x1d')]?_0x51189d[_0x5fb1('0x1d')][_0x5fb1('0x1f')]||null:null,'include':_0x51189d[_0x5fb1('0x1d')]?_0x51189d[_0x5fb1('0x1d')]['include']?_[_0x5fb1('0x20')](_0x51189d[_0x5fb1('0x1d')]['include'],function(_0x3681a1){return{'model':db[_0x3681a1[_0x5fb1('0x21')]],'as':_0x3681a1['as'],'attributes':_0x3681a1[_0x5fb1('0x22')],'include':_0x3681a1[_0x5fb1('0x23')]?_['map'](_0x3681a1[_0x5fb1('0x23')],function(_0x52aeb8){return{'model':db[_0x52aeb8[_0x5fb1('0x21')]],'as':_0x52aeb8['as'],'attributes':_0x52aeb8[_0x5fb1('0x22')],'include':_0x52aeb8['include']?_[_0x5fb1('0x20')](_0x52aeb8[_0x5fb1('0x23')],function(_0x31de2f){return{'model':db[_0x31de2f['model']],'as':_0x31de2f['as'],'attributes':_0x31de2f[_0x5fb1('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x598398){logger[_0x5fb1('0x19')](_0x5fb1('0x24'),_0x51189d);logger[_0x5fb1('0x25')]('GetVoiceExtension',_0x51189d,JSON[_0x5fb1('0x26')](_0x598398));_0x2174e5(_0x598398);})['catch'](function(_0x5ee949){logger[_0x5fb1('0x16')]('GetVoiceExtension',_0x5ee949[_0x5fb1('0x18')],_0x51189d);_0x1fa373(_0x4f4c4c[_0x5fb1('0x16')](0x1f4,_0x5ee949[_0x5fb1('0x18')]));});});}; \ No newline at end of file +var _0xf360=['then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','catch','VoiceExtension','options','raw','attributes','include','model','map','GetVoiceExtension','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','request'];(function(_0x340543,_0xbf721d){var _0x14feef=function(_0x53d038){while(--_0x53d038){_0x340543['push'](_0x340543['shift']());}};_0x14feef(++_0xbf721d);}(_0xf360,0x9e));var _0x0f36=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xf360[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var moment=require(_0x0f36('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f36('0x4'))['db'];var utils=require(_0x0f36('0x5'));var logger=require(_0x0f36('0x6'))('rpc');var config=require(_0x0f36('0x7'));var jayson=require(_0x0f36('0x8'));var client=jayson[_0x0f36('0x9')][_0x0f36('0xa')]({'port':0x232a});config[_0x0f36('0xb')]=_[_0x0f36('0xc')](config[_0x0f36('0xb')],{'host':_0x0f36('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f36('0xb')]));require(_0x0f36('0xe'))[_0x0f36('0xf')](socket);function respondWithRpcPromise(_0x4036b5,_0x146814,_0x4015fc){return new BPromise(function(_0x4963fb,_0x35d5ee){return client[_0x0f36('0x10')](_0x4036b5,_0x4015fc)[_0x0f36('0x11')](function(_0x5044af){logger[_0x0f36('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x146814,'request\x20sent');logger[_0x0f36('0x13')](_0x0f36('0x14'),_0x146814,'request\x20sent',JSON[_0x0f36('0x15')](_0x5044af));if(_0x5044af[_0x0f36('0x16')]){if(_0x5044af[_0x0f36('0x16')][_0x0f36('0x17')]===0x1f4){logger['error'](_0x0f36('0x18'),_0x146814,_0x5044af['error'][_0x0f36('0x19')]);return _0x35d5ee(_0x5044af[_0x0f36('0x16')][_0x0f36('0x19')]);}logger[_0x0f36('0x16')](_0x0f36('0x18'),_0x146814,_0x5044af[_0x0f36('0x16')][_0x0f36('0x19')]);return _0x4963fb(_0x5044af['error']['message']);}else{logger[_0x0f36('0x12')](_0x0f36('0x18'),_0x146814,'request\x20sent');_0x4963fb(_0x5044af['result'][_0x0f36('0x19')]);}})[_0x0f36('0x1a')](function(_0x523c43){logger[_0x0f36('0x16')](_0x0f36('0x18'),_0x146814,_0x523c43);_0x35d5ee(_0x523c43);});});}exports['GetVoiceExtension']=function(_0x3349c8){var _0x59b76f=this;return new Promise(function(_0x4ebd0b,_0x2f7972){return db[_0x0f36('0x1b')]['findAll']({'raw':_0x3349c8['options']?_0x3349c8[_0x0f36('0x1c')][_0x0f36('0x1d')]===undefined?!![]:![]:!![],'where':_0x3349c8['options']?_0x3349c8[_0x0f36('0x1c')]['where']||null:null,'attributes':_0x3349c8[_0x0f36('0x1c')]?_0x3349c8['options'][_0x0f36('0x1e')]||null:null,'limit':_0x3349c8[_0x0f36('0x1c')]?_0x3349c8[_0x0f36('0x1c')]['limit']||null:null,'include':_0x3349c8[_0x0f36('0x1c')]?_0x3349c8[_0x0f36('0x1c')][_0x0f36('0x1f')]?_['map'](_0x3349c8[_0x0f36('0x1c')][_0x0f36('0x1f')],function(_0x264639){return{'model':db[_0x264639[_0x0f36('0x20')]],'as':_0x264639['as'],'attributes':_0x264639['attributes'],'include':_0x264639[_0x0f36('0x1f')]?_['map'](_0x264639[_0x0f36('0x1f')],function(_0x481492){return{'model':db[_0x481492[_0x0f36('0x20')]],'as':_0x481492['as'],'attributes':_0x481492[_0x0f36('0x1e')],'include':_0x481492[_0x0f36('0x1f')]?_[_0x0f36('0x21')](_0x481492['include'],function(_0x398dcd){return{'model':db[_0x398dcd['model']],'as':_0x398dcd['as'],'attributes':_0x398dcd[_0x0f36('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0f36('0x11')](function(_0xc7772d){logger[_0x0f36('0x12')](_0x0f36('0x22'),_0x3349c8);logger['debug'](_0x0f36('0x22'),_0x3349c8,JSON[_0x0f36('0x15')](_0xc7772d));_0x4ebd0b(_0xc7772d);})[_0x0f36('0x1a')](function(_0x161e11){logger[_0x0f36('0x16')]('GetVoiceExtension',_0x161e11['message'],_0x3349c8);_0x2f7972(_0x59b76f[_0x0f36('0x16')](0x1f4,_0x161e11[_0x0f36('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f0966c3..b72b2b0 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x8d766f,_0x4b18b8){_0x8d766f=_0x8d766f-0x0;var _0x3df385=_0x1cb9[_0x8d766f];return _0x3df385;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x814b,0x1a2));var _0xb814=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x814b[_0x74892f];return _0x10ee61;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index fe8302d..7fd1082 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 _0xd046=['get','show','getMessages','isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./voiceMail.controller','index'];(function(_0xa845e1,_0x12a45d){var _0xf317c2=function(_0x5ecac3){while(--_0x5ecac3){_0xa845e1['push'](_0xa845e1['shift']());}};_0xf317c2(++_0x12a45d);}(_0xd046,0x129));var _0x6d04=function(_0x1d9fb6,_0x1b23d5){_0x1d9fb6=_0x1d9fb6-0x0;var _0x97f97=_0xd046[_0x1d9fb6];return _0x97f97;};'use strict';var multer=require('multer');var util=require(_0x6d04('0x0'));var path=require(_0x6d04('0x1'));var timeout=require(_0x6d04('0x2'));var express=require('express');var router=express[_0x6d04('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d04('0x4'));var config=require('../../config/environment');var controller=require(_0x6d04('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x6d04('0x6')]);router[_0x6d04('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x6d04('0x8')]);router[_0x6d04('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6d04('0x9')]);router['post']('/',auth[_0x6d04('0xa')](),controller['create']);router['put']('/:id',auth[_0x6d04('0xa')](),controller[_0x6d04('0xb')]);router[_0x6d04('0xc')](_0x6d04('0xd'),auth['isAuthenticated'](),controller[_0x6d04('0xe')]);module[_0x6d04('0xf')]=router; \ No newline at end of file +var _0x187d=['/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','/:id','show'];(function(_0x18172e,_0x512f30){var _0x48e63f=function(_0x4edd4d){while(--_0x4edd4d){_0x18172e['push'](_0x18172e['shift']());}};_0x48e63f(++_0x512f30);}(_0x187d,0x93));var _0xd187=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x187d[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xc'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xc'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index ed00202..a85726e 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 _0x8be5=['email','string','trim','central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','exports','from-voicemail','contest_mailbox','STRING','setDataValue'];(function(_0x13a94f,_0x1dbdeb){var _0x46c6d3=function(_0x54eea7){while(--_0x54eea7){_0x13a94f['push'](_0x13a94f['shift']());}};_0x46c6d3(++_0x1dbdeb);}(_0x8be5,0x11c));var _0x58be=function(_0x4922d9,_0x263c9b){_0x4922d9=_0x4922d9-0x0;var _0x2e43c2=_0x8be5[_0x4922d9];return _0x2e43c2;};'use strict';var Sequelize=require('sequelize');module[_0x58be('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x58be('0x1'),'unique':_0x58be('0x2')},'mailbox':{'type':Sequelize[_0x58be('0x3')],'defaultValue':'','allowNull':![],'unique':_0x58be('0x2')},'password':{'type':Sequelize[_0x58be('0x3')]},'fullname':{'type':Sequelize[_0x58be('0x3')]},'email':{'type':Sequelize[_0x58be('0x3')],'validate':{'isEmail':!![]},'set':function(_0x44d113){this[_0x58be('0x4')](_0x58be('0x5'),typeof _0x44d113===_0x58be('0x6')&&_0x44d113[_0x58be('0x7')]()?_0x44d113['trim']():null);}},'pager':{'type':Sequelize[_0x58be('0x3')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x58be('0x8')},'attach':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':_0x58be('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x58be('0x3')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x58be('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':_0x58be('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x58be('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x58be('0x9')](_0x58be('0xa'),'no'),'defaultValue':_0x58be('0xa'),'allowNull':![]},'stamp':{'type':_0x58be('0xb')},'emailsubject':{'type':Sequelize[_0x58be('0x3')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x58be('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x58be('0xd')](_0x58be('0xe'))+_0x58be('0xf')+this[_0x58be('0xd')](_0x58be('0x10'));}}}; \ No newline at end of file +var _0x8390=['contest_mailbox','setDataValue','email','string','trim','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','STRING','from-voicemail'];(function(_0x26c68f,_0x2a9107){var _0x516c08=function(_0x437ea0){while(--_0x437ea0){_0x26c68f['push'](_0x26c68f['shift']());}};_0x516c08(++_0x2a9107);}(_0x8390,0x67));var _0x0839=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x8390[_0x441563];return _0x2369ec;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x0839('0x0')]},'context':{'type':Sequelize[_0x0839('0x0')],'defaultValue':_0x0839('0x1'),'unique':_0x0839('0x2')},'mailbox':{'type':Sequelize[_0x0839('0x0')],'defaultValue':'','allowNull':![],'unique':_0x0839('0x2')},'password':{'type':Sequelize[_0x0839('0x0')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x0839('0x0')],'validate':{'isEmail':!![]},'set':function(_0x352eb5){this[_0x0839('0x3')](_0x0839('0x4'),typeof _0x352eb5===_0x0839('0x5')&&_0x352eb5[_0x0839('0x6')]()?_0x352eb5['trim']():null);}},'pager':{'type':Sequelize[_0x0839('0x0')]},'tz':{'type':Sequelize[_0x0839('0x0')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x0839('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':_0x0839('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0839('0x0')]},'review':{'type':Sequelize[_0x0839('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0839('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x0839('0x7')](_0x0839('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0839('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x0839('0x8'),'no'),'defaultValue':_0x0839('0x8'),'allowNull':![]},'stamp':{'type':_0x0839('0x9')},'emailsubject':{'type':Sequelize[_0x0839('0x0')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0839('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0839('0xb')],'get':function(){return this[_0x0839('0xc')](_0x0839('0xd'))+'\x20-\x20'+this[_0x0839('0xc')](_0x0839('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c62955f..4d635cb 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 _0x1d2d=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','catch','update','find','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x40d8d7,_0x30dd5e){var _0x3454cc=function(_0x512c1b){while(--_0x512c1b){_0x40d8d7['push'](_0x40d8d7['shift']());}};_0x3454cc(++_0x30dd5e);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x32a9a1,_0x48b54a){_0x32a9a1=_0x32a9a1-0x0;var _0x1cdd6a=_0x1d2d[_0x32a9a1];return _0x1cdd6a;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){var _0x5df4af=_0x3f229c[_0xd1d2('0x28')]({'plain':!![]});var _0x42da6d=_0xd1d2('0x29');return db[_0xd1d2('0x2a')][_0xd1d2('0x27')]({'where':{'type':_0x42da6d,'resourceId':_0x5df4af['id']}})[_0xd1d2('0x26')](function(){return _0x3f229c;});})[_0xd1d2('0x26')](function(){_0x19d535[_0xd1d2('0x1c')](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x384460,_0x3645e9){return function(_0x4e1bc2){if(!_0x4e1bc2){_0x384460['sendStatus'](0x194);}return _0x4e1bc2;};}function handleError(_0x133c6c,_0x442375){_0x442375=_0x442375||0x1f4;return function(_0x1e6072){logger[_0xd1d2('0x2b')](_0x1e6072[_0xd1d2('0x2c')]);if(_0x1e6072['name']){delete _0x1e6072[_0xd1d2('0x2d')];}_0x133c6c[_0xd1d2('0x1c')](_0x442375)[_0xd1d2('0x2e')](_0x1e6072);};}exports['index']=function(_0x19db00,_0x1db17f){var _0xbd855a={},_0x56557d={},_0x419db7={'count':0x0,'rows':[]};var _0x18528f=_[_0xd1d2('0x2f')](db[_0xd1d2('0x30')][_0xd1d2('0x31')],function(_0x14d661){return{'name':_0x14d661[_0xd1d2('0x32')],'type':_0x14d661[_0xd1d2('0x33')][_0xd1d2('0x34')]};});_0x56557d[_0xd1d2('0x35')]=_[_0xd1d2('0x2f')](_0x18528f,_0xd1d2('0x2d'));_0x56557d[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x19db00[_0xd1d2('0x36')]);_0x56557d[_0xd1d2('0x38')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],_0x56557d['query']);_0xbd855a[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x56557d[_0xd1d2('0x35')],qs['fields'](_0x19db00[_0xd1d2('0x36')]['fields']));_0xbd855a['attributes']=_0xbd855a[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0xbd855a[_0xd1d2('0x3a')]:_0x56557d[_0xd1d2('0x35')];if(!_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x3c')]('nolimit')){_0xbd855a[_0xd1d2('0x21')]=qs[_0xd1d2('0x21')](_0x19db00['query'][_0xd1d2('0x21')]);_0xbd855a[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x19db00[_0xd1d2('0x36')]['offset']);}_0xbd855a['order']=qs[_0xd1d2('0x3d')](_0x19db00['query']['sort']);_0xbd855a['where']=qs[_0xd1d2('0x38')](_['pick'](_0x19db00[_0xd1d2('0x36')],_0x56557d['filters']),_0x18528f);if(_0x19db00['query']['filter']){_0xbd855a[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0xbd855a[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x18528f,function(_0x33ba30){if(_0x33ba30[_0xd1d2('0x33')]!==_0xd1d2('0x40')){var _0x38bf16={};_0x38bf16[_0x33ba30[_0xd1d2('0x2d')]]={'$like':'%'+_0x19db00[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x38bf16;}})});}_0xbd855a=_[_0xd1d2('0x3f')]({},_0xbd855a,_0x19db00[_0xd1d2('0x42')]);var _0x18ff05={'where':_0xbd855a['where']};return db['VoiceMail'][_0xd1d2('0x22')](_0x18ff05)[_0xd1d2('0x26')](function(_0x24fc93){_0x419db7['count']=_0x24fc93;if(_0x19db00['query'][_0xd1d2('0x43')]){_0xbd855a[_0xd1d2('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0xd1d2('0x45')](_0xbd855a);})['then'](function(_0x5a3790){_0x419db7[_0xd1d2('0x46')]=_0x5a3790;return _0x419db7;})['then'](respondWithFilteredResult(_0x1db17f,_0xbd855a))['catch'](handleError(_0x1db17f,null));};exports[_0xd1d2('0x47')]=function(_0x320fa4,_0x2a8961){var _0x49dad2={'raw':!![],'where':{'id':_0x320fa4[_0xd1d2('0x48')]['id']}},_0x2ba87b={};_0x2ba87b[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db['VoiceMail'][_0xd1d2('0x31')]);_0x2ba87b[_0xd1d2('0x36')]=_['keys'](_0x320fa4[_0xd1d2('0x36')]);_0x2ba87b['filters']=_[_0xd1d2('0x39')](_0x2ba87b[_0xd1d2('0x35')],_0x2ba87b[_0xd1d2('0x36')]);_0x49dad2[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0x2ba87b['model'],qs['fields'](_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x49dad2['attributes']=_0x49dad2[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x49dad2[_0xd1d2('0x3a')]:_0x2ba87b[_0xd1d2('0x35')];if(_0x320fa4[_0xd1d2('0x36')][_0xd1d2('0x43')]){_0x49dad2[_0xd1d2('0x44')]=[{'all':!![]}];}_0x49dad2=_['merge']({},_0x49dad2,_0x320fa4[_0xd1d2('0x42')]);return db[_0xd1d2('0x30')]['find'](_0x49dad2)[_0xd1d2('0x26')](handleEntityNotFound(_0x2a8961,null))[_0xd1d2('0x26')](respondWithResult(_0x2a8961,null))['catch'](handleError(_0x2a8961,null));};exports['create']=function(_0x3d4fe3,_0x182ea8){return db['VoiceMail'][_0xd1d2('0x4a')](_0x3d4fe3[_0xd1d2('0x4b')],{})[_0xd1d2('0x26')](function(_0x23ab46){var _0x404ad2=_0x3d4fe3['user']['get']({'plain':!![]});if(!_0x404ad2)throw new Error(_0xd1d2('0x4c'));if(_0x404ad2['role']===_0xd1d2('0x4d')){var _0xcd4b70=_0x23ab46['get']({'plain':!![]});var _0x389fcb=_0xd1d2('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x389fcb,'userProfileId':_0x404ad2[_0xd1d2('0x4e')]},'raw':!![]})[_0xd1d2('0x26')](function(_0x187de4){if(_0x187de4&&_0x187de4[_0xd1d2('0x4f')]===0x0){return db[_0xd1d2('0x2a')][_0xd1d2('0x4a')]({'name':_0xcd4b70[_0xd1d2('0x2d')],'resourceId':_0xcd4b70['id'],'type':_0x187de4[_0xd1d2('0x2d')],'sectionId':_0x187de4['id']},{})[_0xd1d2('0x26')](function(){return _0x23ab46;});}else{return _0x23ab46;}})['catch'](function(_0x1958f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1958f3);throw _0x1958f3;});}return _0x23ab46;})[_0xd1d2('0x26')](respondWithResult(_0x182ea8,0xc9))[_0xd1d2('0x50')](handleError(_0x182ea8,null));};exports[_0xd1d2('0x51')]=function(_0x47417f,_0x215dea){if(_0x47417f[_0xd1d2('0x4b')]['id']){delete _0x47417f[_0xd1d2('0x4b')]['id'];}return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0x47417f[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x215dea,null))[_0xd1d2('0x26')](saveUpdates(_0x47417f[_0xd1d2('0x4b')],null))['then'](respondWithResult(_0x215dea,null))['catch'](handleError(_0x215dea,null));};exports[_0xd1d2('0x27')]=function(_0xd5323d,_0x1562ad){return db[_0xd1d2('0x30')][_0xd1d2('0x52')]({'where':{'id':_0xd5323d[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x1562ad,null))[_0xd1d2('0x26')](removeEntity(_0x1562ad,null))[_0xd1d2('0x50')](handleError(_0x1562ad,null));};exports[_0xd1d2('0x53')]=function(_0x1788cd,_0x54406e,_0x479471){return db[_0xd1d2('0x30')][_0xd1d2('0x54')]({'where':{'id':_0x1788cd[_0xd1d2('0x48')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x54406e,null))['then'](function(_0x17e149){var _0x27c629;var _0x42961d={},_0xaf2acf={};_0xaf2acf[_0xd1d2('0x35')]=_[_0xd1d2('0x37')](db[_0xd1d2('0x55')]['rawAttributes']);_0xaf2acf[_0xd1d2('0x36')]=_[_0xd1d2('0x37')](_0x1788cd[_0xd1d2('0x36')]);_0xaf2acf['filters']=_['intersection'](_0xaf2acf[_0xd1d2('0x35')],_0xaf2acf[_0xd1d2('0x36')]);_0x42961d[_0xd1d2('0x3a')]=_[_0xd1d2('0x39')](_0xaf2acf['model'],qs[_0xd1d2('0x49')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x49')]));_0x42961d['attributes']=_0x42961d[_0xd1d2('0x3a')][_0xd1d2('0x3b')]?_0x42961d['attributes']:_0xaf2acf[_0xd1d2('0x35')];if(!_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x3c')](_0xd1d2('0x56'))){_0x42961d['limit']=qs[_0xd1d2('0x21')](_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x21')]);_0x42961d[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1788cd['query']['offset']);}_0x42961d['order']=qs['sort'](_0x1788cd['query'][_0xd1d2('0x3d')]);_0x42961d[_0xd1d2('0x3e')]=qs[_0xd1d2('0x38')](_['pick'](_0x1788cd[_0xd1d2('0x36')],_0xaf2acf[_0xd1d2('0x38')]));if(_0x1788cd[_0xd1d2('0x36')]['filter']){_0x42961d[_0xd1d2('0x3e')]=_[_0xd1d2('0x3f')](_0x42961d[_0xd1d2('0x3e')],{'$or':_[_0xd1d2('0x2f')](_0x42961d[_0xd1d2('0x3a')],function(_0x1101a3){var _0x4a83f8={};_0x4a83f8[_0x1101a3]={'$like':'%'+_0x1788cd[_0xd1d2('0x36')][_0xd1d2('0x41')]+'%'};return _0x4a83f8;})});}_0x42961d['where']=_['merge'](_0x42961d[_0xd1d2('0x3e')],{'mailboxuser':_0x17e149[_0xd1d2('0x57')]});_0x42961d=_[_0xd1d2('0x3f')]({},_0x42961d,_0x1788cd[_0xd1d2('0x42')]);return db['VoiceMailMessage'][_0xd1d2('0x58')](_0x42961d)[_0xd1d2('0x26')](respondWithFilteredResult(_0x54406e,_0x42961d));})[_0xd1d2('0x50')](handleError(_0x54406e,null));}; \ No newline at end of file +var _0x6324=['then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','keys','query','filters','intersection','model','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','findOne','rawAttributes','hasOwnProperty','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x55af86,_0x5c8ff6){var _0x58df3b=function(_0x2ddd94){while(--_0x2ddd94){_0x55af86['push'](_0x55af86['shift']());}};_0x58df3b(++_0x5c8ff6);}(_0x6324,0x142));var _0x4632=function(_0x7cacf9,_0x6dac99){_0x7cacf9=_0x7cacf9-0x0;var _0xde6456=_0x6324[_0x7cacf9];return _0xde6456;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){var _0x3b0823=_0x1e1b86[_0x4632('0x28')]({'plain':!![]});var _0xb074d=_0x4632('0x29');return db[_0x4632('0x2a')][_0x4632('0x27')]({'where':{'type':_0xb074d,'resourceId':_0x3b0823['id']}})[_0x4632('0x26')](function(){return _0x1e1b86;});})[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0x438354,_0x4d9098){return function(_0x57798a){if(!_0x57798a){_0x438354[_0x4632('0x18')](0x194);}return _0x57798a;};}function handleError(_0x244743,_0x2f6656){_0x2f6656=_0x2f6656||0x1f4;return function(_0x35a533){logger[_0x4632('0x2b')](_0x35a533[_0x4632('0x2c')]);if(_0x35a533[_0x4632('0x2d')]){delete _0x35a533['name'];}_0x244743[_0x4632('0x19')](_0x2f6656)[_0x4632('0x2e')](_0x35a533);};}exports['index']=function(_0x216119,_0x5316f7){var _0x6599ad={},_0x4cb661={},_0x4fda35={'count':0x0,'rows':[]};var _0x1973eb=_[_0x4632('0x2f')](db[_0x4632('0x30')]['rawAttributes'],function(_0x5ed4d6){return{'name':_0x5ed4d6[_0x4632('0x31')],'type':_0x5ed4d6[_0x4632('0x32')]['key']};});_0x4cb661['model']=_[_0x4632('0x2f')](_0x1973eb,_0x4632('0x2d'));_0x4cb661['query']=_[_0x4632('0x33')](_0x216119[_0x4632('0x34')]);_0x4cb661[_0x4632('0x35')]=_[_0x4632('0x36')](_0x4cb661[_0x4632('0x37')],_0x4cb661['query']);_0x6599ad[_0x4632('0x38')]=_[_0x4632('0x36')](_0x4cb661['model'],qs['fields'](_0x216119[_0x4632('0x34')]['fields']));_0x6599ad['attributes']=_0x6599ad[_0x4632('0x38')]['length']?_0x6599ad[_0x4632('0x38')]:_0x4cb661[_0x4632('0x37')];if(!_0x216119[_0x4632('0x34')]['hasOwnProperty'](_0x4632('0x39'))){_0x6599ad[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x216119[_0x4632('0x34')][_0x4632('0x1e')]);_0x6599ad['offset']=qs['offset'](_0x216119[_0x4632('0x34')][_0x4632('0x1c')]);}_0x6599ad[_0x4632('0x3a')]=qs['sort'](_0x216119['query']['sort']);_0x6599ad[_0x4632('0x3b')]=qs[_0x4632('0x35')](_['pick'](_0x216119[_0x4632('0x34')],_0x4cb661[_0x4632('0x35')]),_0x1973eb);if(_0x216119[_0x4632('0x34')][_0x4632('0x3c')]){_0x6599ad[_0x4632('0x3b')]=_[_0x4632('0x3d')](_0x6599ad[_0x4632('0x3b')],{'$or':_[_0x4632('0x2f')](_0x1973eb,function(_0x21c6a5){if(_0x21c6a5[_0x4632('0x32')]!==_0x4632('0x3e')){var _0x3b6258={};_0x3b6258[_0x21c6a5['name']]={'$like':'%'+_0x216119[_0x4632('0x34')][_0x4632('0x3c')]+'%'};return _0x3b6258;}})});}_0x6599ad=_['merge']({},_0x6599ad,_0x216119[_0x4632('0x3f')]);var _0x1c39bc={'where':_0x6599ad['where']};return db[_0x4632('0x30')]['count'](_0x1c39bc)[_0x4632('0x26')](function(_0x28df3b){_0x4fda35[_0x4632('0x1f')]=_0x28df3b;if(_0x216119[_0x4632('0x34')]['includeAll']){_0x6599ad[_0x4632('0x40')]=[{'all':!![]}];}return db[_0x4632('0x30')][_0x4632('0x41')](_0x6599ad);})[_0x4632('0x26')](function(_0x5cc716){_0x4fda35['rows']=_0x5cc716;return _0x4fda35;})[_0x4632('0x26')](respondWithFilteredResult(_0x5316f7,_0x6599ad))[_0x4632('0x42')](handleError(_0x5316f7,null));};exports[_0x4632('0x43')]=function(_0x512db1,_0x330f21){var _0x1467c8={'raw':!![],'where':{'id':_0x512db1[_0x4632('0x44')]['id']}},_0x66598d={};_0x66598d[_0x4632('0x37')]=_[_0x4632('0x33')](db[_0x4632('0x30')]['rawAttributes']);_0x66598d[_0x4632('0x34')]=_[_0x4632('0x33')](_0x512db1[_0x4632('0x34')]);_0x66598d[_0x4632('0x35')]=_[_0x4632('0x36')](_0x66598d['model'],_0x66598d['query']);_0x1467c8[_0x4632('0x38')]=_[_0x4632('0x36')](_0x66598d[_0x4632('0x37')],qs[_0x4632('0x45')](_0x512db1['query'][_0x4632('0x45')]));_0x1467c8[_0x4632('0x38')]=_0x1467c8[_0x4632('0x38')][_0x4632('0x46')]?_0x1467c8[_0x4632('0x38')]:_0x66598d['model'];if(_0x512db1[_0x4632('0x34')][_0x4632('0x47')]){_0x1467c8[_0x4632('0x40')]=[{'all':!![]}];}_0x1467c8=_[_0x4632('0x3d')]({},_0x1467c8,_0x512db1[_0x4632('0x3f')]);return db[_0x4632('0x30')][_0x4632('0x48')](_0x1467c8)[_0x4632('0x26')](handleEntityNotFound(_0x330f21,null))[_0x4632('0x26')](respondWithResult(_0x330f21,null))[_0x4632('0x42')](handleError(_0x330f21,null));};exports[_0x4632('0x49')]=function(_0x517584,_0xc3ffd0){return db[_0x4632('0x30')][_0x4632('0x49')](_0x517584['body'],{})[_0x4632('0x26')](function(_0x5f4fb5){var _0x1309aa=_0x517584[_0x4632('0x4a')][_0x4632('0x28')]({'plain':!![]});if(!_0x1309aa)throw new Error(_0x4632('0x4b'));if(_0x1309aa[_0x4632('0x4c')]===_0x4632('0x4a')){var _0x1f43b6=_0x5f4fb5[_0x4632('0x28')]({'plain':!![]});var _0x4e89e3=_0x4632('0x29');return db[_0x4632('0x4d')]['find']({'where':{'name':_0x4e89e3,'userProfileId':_0x1309aa[_0x4632('0x4e')]},'raw':!![]})[_0x4632('0x26')](function(_0x18cc47){if(_0x18cc47&&_0x18cc47[_0x4632('0x4f')]===0x0){return db[_0x4632('0x2a')][_0x4632('0x49')]({'name':_0x1f43b6[_0x4632('0x2d')],'resourceId':_0x1f43b6['id'],'type':_0x18cc47[_0x4632('0x2d')],'sectionId':_0x18cc47['id']},{})[_0x4632('0x26')](function(){return _0x5f4fb5;});}else{return _0x5f4fb5;}})[_0x4632('0x42')](function(_0x3e66d8){logger[_0x4632('0x2b')](_0x4632('0x50'),_0x3e66d8);throw _0x3e66d8;});}return _0x5f4fb5;})[_0x4632('0x26')](respondWithResult(_0xc3ffd0,0xc9))[_0x4632('0x42')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x25')]=function(_0x32cd35,_0x6c2864){if(_0x32cd35[_0x4632('0x51')]['id']){delete _0x32cd35[_0x4632('0x51')]['id'];}return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x32cd35[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x6c2864,null))[_0x4632('0x26')](saveUpdates(_0x32cd35[_0x4632('0x51')],null))[_0x4632('0x26')](respondWithResult(_0x6c2864,null))['catch'](handleError(_0x6c2864,null));};exports[_0x4632('0x27')]=function(_0x433fea,_0x41409d){return db['VoiceMail'][_0x4632('0x48')]({'where':{'id':_0x433fea[_0x4632('0x44')]['id']}})['then'](handleEntityNotFound(_0x41409d,null))[_0x4632('0x26')](removeEntity(_0x41409d,null))[_0x4632('0x42')](handleError(_0x41409d,null));};exports[_0x4632('0x52')]=function(_0x4b91cf,_0x3aeefd,_0x334a8e){return db[_0x4632('0x30')][_0x4632('0x53')]({'where':{'id':_0x4b91cf[_0x4632('0x44')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0x3aeefd,null))[_0x4632('0x26')](function(_0x4658de){var _0x2965df;var _0x3abcbf={},_0x58d39a={};_0x58d39a[_0x4632('0x37')]=_[_0x4632('0x33')](db['VoiceMailMessage'][_0x4632('0x54')]);_0x58d39a['query']=_['keys'](_0x4b91cf[_0x4632('0x34')]);_0x58d39a[_0x4632('0x35')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],_0x58d39a[_0x4632('0x34')]);_0x3abcbf[_0x4632('0x38')]=_[_0x4632('0x36')](_0x58d39a[_0x4632('0x37')],qs[_0x4632('0x45')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x45')]));_0x3abcbf[_0x4632('0x38')]=_0x3abcbf[_0x4632('0x38')][_0x4632('0x46')]?_0x3abcbf['attributes']:_0x58d39a['model'];if(!_0x4b91cf[_0x4632('0x34')][_0x4632('0x55')](_0x4632('0x39'))){_0x3abcbf[_0x4632('0x1e')]=qs[_0x4632('0x1e')](_0x4b91cf[_0x4632('0x34')]['limit']);_0x3abcbf[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x4b91cf[_0x4632('0x34')][_0x4632('0x1c')]);}_0x3abcbf['order']=qs['sort'](_0x4b91cf[_0x4632('0x34')]['sort']);_0x3abcbf[_0x4632('0x3b')]=qs[_0x4632('0x35')](_[_0x4632('0x56')](_0x4b91cf[_0x4632('0x34')],_0x58d39a[_0x4632('0x35')]));if(_0x4b91cf['query'][_0x4632('0x3c')]){_0x3abcbf[_0x4632('0x3b')]=_['merge'](_0x3abcbf['where'],{'$or':_[_0x4632('0x2f')](_0x3abcbf[_0x4632('0x38')],function(_0x47391f){var _0x3090d6={};_0x3090d6[_0x47391f]={'$like':'%'+_0x4b91cf['query']['filter']+'%'};return _0x3090d6;})});}_0x3abcbf['where']=_[_0x4632('0x3d')](_0x3abcbf['where'],{'mailboxuser':_0x4658de[_0x4632('0x57')]});_0x3abcbf=_[_0x4632('0x3d')]({},_0x3abcbf,_0x4b91cf[_0x4632('0x3f')]);return db[_0x4632('0x58')][_0x4632('0x59')](_0x3abcbf)[_0x4632('0x26')](respondWithFilteredResult(_0x3aeefd,_0x3abcbf));})[_0x4632('0x42')](handleError(_0x3aeefd,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 6282849..14a823a 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 _0x844b=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','api','bluebird'];(function(_0x43f8cc,_0x592b95){var _0x1c8808=function(_0x352bf9){while(--_0x352bf9){_0x43f8cc['push'](_0x43f8cc['shift']());}};_0x1c8808(++_0x592b95);}(_0x844b,0xa2));var _0xb844=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x844b[_0x1dd532];return _0x3732aa;};'use strict';var _=require('lodash');var util=require(_0xb844('0x0'));var logger=require('../../config/logger')(_0xb844('0x1'));var moment=require('moment');var BPromise=require(_0xb844('0x2'));var rp=require(_0xb844('0x3'));var fs=require('fs');var path=require(_0xb844('0x4'));var rimraf=require(_0xb844('0x5'));var config=require(_0xb844('0x6'));var attributes=require(_0xb844('0x7'));module[_0xb844('0x8')]=function(_0x39bcef,_0x1a595d){return _0x39bcef[_0xb844('0x9')](_0xb844('0xa'),attributes,{'tableName':_0xb844('0xb'),'paranoid':![],'indexes':[{'name':_0xb844('0xc'),'fields':[_0xb844('0xd'),_0xb844('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa93=['../../config/environment','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x26e289,_0x59f5eb){var _0x3a1163=function(_0x1794b7){while(--_0x1794b7){_0x26e289['push'](_0x26e289['shift']());}};_0x3a1163(++_0x59f5eb);}(_0xfa93,0x7f));var _0x3fa9=function(_0x277101,_0x298036){_0x277101=_0x277101-0x0;var _0x36da74=_0xfa93[_0x277101];return _0x36da74;};'use strict';var _=require(_0x3fa9('0x0'));var util=require(_0x3fa9('0x1'));var logger=require(_0x3fa9('0x2'))('api');var moment=require(_0x3fa9('0x3'));var BPromise=require(_0x3fa9('0x4'));var rp=require(_0x3fa9('0x5'));var fs=require('fs');var path=require(_0x3fa9('0x6'));var rimraf=require(_0x3fa9('0x7'));var config=require(_0x3fa9('0x8'));var attributes=require('./voiceMail.attributes');module[_0x3fa9('0x9')]=function(_0x30798f,_0x4d3c25){return _0x30798f[_0x3fa9('0xa')](_0x3fa9('0xb'),attributes,{'tableName':_0x3fa9('0xc'),'paranoid':![],'indexes':[{'name':_0x3fa9('0xd'),'fields':['mailbox',_0x3fa9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1b8aaa9..3e48399 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 _0x001f=['code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x001f,0x9f));var _0xf001=function(_0xd22528,_0x37bd1e){_0xd22528=_0xd22528-0x0;var _0x3640ae=_0x001f[_0xd22528];return _0x3640ae;};'use strict';var _=require(_0xf001('0x0'));var util=require(_0xf001('0x1'));var moment=require(_0xf001('0x2'));var BPromise=require(_0xf001('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf001('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf001('0x5'));var logger=require(_0xf001('0x6'))('rpc');var config=require(_0xf001('0x7'));var jayson=require(_0xf001('0x8'));var client=jayson['client'][_0xf001('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a19c2,_0x520014,_0x19be0d){return new BPromise(function(_0x46e2ab,_0x39f7e1){return client[_0xf001('0xa')](_0x3a19c2,_0x19be0d)[_0xf001('0xb')](function(_0x5cc07b){logger[_0xf001('0xc')](_0xf001('0xd'),_0x520014,'request\x20sent');logger[_0xf001('0xe')](_0xf001('0xf'),_0x520014,_0xf001('0x10'),JSON['stringify'](_0x5cc07b));if(_0x5cc07b['error']){if(_0x5cc07b['error'][_0xf001('0x11')]===0x1f4){logger['error'](_0xf001('0xd'),_0x520014,_0x5cc07b['error']['message']);return _0x39f7e1(_0x5cc07b[_0xf001('0x12')][_0xf001('0x13')]);}logger[_0xf001('0x12')](_0xf001('0xd'),_0x520014,_0x5cc07b[_0xf001('0x12')][_0xf001('0x13')]);return _0x46e2ab(_0x5cc07b[_0xf001('0x12')][_0xf001('0x13')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x520014,_0xf001('0x10'));_0x46e2ab(_0x5cc07b[_0xf001('0x14')][_0xf001('0x13')]);}})[_0xf001('0x15')](function(_0x54dc16){logger[_0xf001('0x12')]('VoiceMail,\x20%s,\x20%s',_0x520014,_0x54dc16);_0x39f7e1(_0x54dc16);});});} \ No newline at end of file +var _0x3ee1=['rpc','../../config/environment','jayson/promise','client','request','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x47572b,_0x442f2e){var _0x4c8e8d=function(_0x573a02){while(--_0x573a02){_0x47572b['push'](_0x47572b['shift']());}};_0x4c8e8d(++_0x442f2e);}(_0x3ee1,0x101));var _0x13ee=function(_0x3d332b,_0x2b398d){_0x3d332b=_0x3d332b-0x0;var _0x17628b=_0x3ee1[_0x3d332b];return _0x17628b;};'use strict';var _=require('lodash');var util=require(_0x13ee('0x0'));var moment=require(_0x13ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x13ee('0x2'));var fs=require('fs');var Redis=require(_0x13ee('0x3'));var db=require(_0x13ee('0x4'))['db'];var utils=require(_0x13ee('0x5'));var logger=require(_0x13ee('0x6'))(_0x13ee('0x7'));var config=require(_0x13ee('0x8'));var jayson=require(_0x13ee('0x9'));var client=jayson[_0x13ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45dd11,_0x26a5f9,_0x7da227){return new BPromise(function(_0x545fc6,_0x142682){return client[_0x13ee('0xb')](_0x45dd11,_0x7da227)['then'](function(_0x42d1da){logger[_0x13ee('0xc')](_0x13ee('0xd'),_0x26a5f9,'request\x20sent');logger[_0x13ee('0xe')](_0x13ee('0xf'),_0x26a5f9,_0x13ee('0x10'),JSON[_0x13ee('0x11')](_0x42d1da));if(_0x42d1da['error']){if(_0x42d1da['error'][_0x13ee('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x26a5f9,_0x42d1da[_0x13ee('0x13')]['message']);return _0x142682(_0x42d1da[_0x13ee('0x13')][_0x13ee('0x14')]);}logger[_0x13ee('0x13')]('VoiceMail,\x20%s,\x20%s',_0x26a5f9,_0x42d1da[_0x13ee('0x13')][_0x13ee('0x14')]);return _0x545fc6(_0x42d1da[_0x13ee('0x13')][_0x13ee('0x14')]);}else{logger[_0x13ee('0xc')]('VoiceMail,\x20%s,\x20%s',_0x26a5f9,'request\x20sent');_0x545fc6(_0x42d1da['result'][_0x13ee('0x14')]);}})[_0x13ee('0x15')](function(_0x347164){logger[_0x13ee('0x13')](_0x13ee('0xd'),_0x26a5f9,_0x347164);_0x142682(_0x347164);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5158e61..9946cbc 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 _0x0266=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','post','update','delete','destroy','exports','multer'];(function(_0x2334b4,_0x3a5429){var _0x1f6b14=function(_0xf1355){while(--_0xf1355){_0x2334b4['push'](_0x2334b4['shift']());}};_0x1f6b14(++_0x3a5429);}(_0x0266,0x175));var _0x6026=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0266[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0x6026('0x0'));var util=require(_0x6026('0x1'));var path=require(_0x6026('0x2'));var timeout=require(_0x6026('0x3'));var express=require(_0x6026('0x4'));var router=express[_0x6026('0x5')]();var fs_extra=require(_0x6026('0x6'));var auth=require(_0x6026('0x7'));var interaction=require(_0x6026('0x8'));var config=require(_0x6026('0x9'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x6026('0xa')](),controller[_0x6026('0xb')]);router[_0x6026('0xc')](_0x6026('0xd'),auth['isAuthenticated'](),controller[_0x6026('0xe')]);router[_0x6026('0xc')](_0x6026('0xf'),auth[_0x6026('0xa')](),controller[_0x6026('0x10')]);router[_0x6026('0x11')]('/',auth[_0x6026('0xa')](),controller['create']);router['put'](_0x6026('0xd'),auth[_0x6026('0xa')](),controller[_0x6026('0x12')]);router[_0x6026('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6026('0x14')]);module[_0x6026('0x15')]=router; \ No newline at end of file +var _0x2ca5=['delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update'];(function(_0x291a83,_0x1af3c3){var _0x200cf9=function(_0x31b55a){while(--_0x31b55a){_0x291a83['push'](_0x291a83['shift']());}};_0x200cf9(++_0x1af3c3);}(_0x2ca5,0x71));var _0x52ca=function(_0x723288,_0x361804){_0x723288=_0x723288-0x0;var _0x45fecf=_0x2ca5[_0x723288];return _0x45fecf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x52ca('0x0'));var timeout=require('connect-timeout');var express=require(_0x52ca('0x1'));var router=express[_0x52ca('0x2')]();var fs_extra=require(_0x52ca('0x3'));var auth=require(_0x52ca('0x4'));var interaction=require(_0x52ca('0x5'));var config=require(_0x52ca('0x6'));var controller=require(_0x52ca('0x7'));router[_0x52ca('0x8')]('/',auth['isAuthenticated'](),controller[_0x52ca('0x9')]);router[_0x52ca('0x8')](_0x52ca('0xa'),auth[_0x52ca('0xb')](),controller[_0x52ca('0xc')]);router[_0x52ca('0x8')](_0x52ca('0xd'),auth[_0x52ca('0xb')](),controller[_0x52ca('0xe')]);router[_0x52ca('0xf')]('/',auth[_0x52ca('0xb')](),controller[_0x52ca('0x10')]);router[_0x52ca('0x11')](_0x52ca('0xa'),auth['isAuthenticated'](),controller[_0x52ca('0x12')]);router[_0x52ca('0x13')](_0x52ca('0xa'),auth[_0x52ca('0xb')](),controller[_0x52ca('0x14')]);module[_0x52ca('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index e7b1d15..2b2fc1d 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 _0x07e0=['exports','VIRTUAL','getDataValue','INTEGER','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x44ad0a,_0x226949){var _0x5e6212=function(_0xad6173){while(--_0xad6173){_0x44ad0a['push'](_0x44ad0a['shift']());}};_0x5e6212(++_0x226949);}(_0x07e0,0x120));var _0x007e=function(_0x1d3ece,_0x3fb359){_0x1d3ece=_0x1d3ece-0x0;var _0x1ba5d2=_0x07e0[_0x1d3ece];return _0x1ba5d2;};'use strict';var Sequelize=require('sequelize');module[_0x007e('0x0')]={'name':{'type':Sequelize[_0x007e('0x1')],'get':function(_0x3f7c8d){return this[_0x007e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x007e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x007e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize['literal'](_0x007e('0x5'))}}; \ No newline at end of file +var _0x50c8=['STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x10a4d0,_0x7c7d6a){var _0x59426e=function(_0x2c47c8){while(--_0x2c47c8){_0x10a4d0['push'](_0x10a4d0['shift']());}};_0x59426e(++_0x7c7d6a);}(_0x50c8,0x195));var _0x850c=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x50c8[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x850c('0x0'));module[_0x850c('0x1')]={'name':{'type':Sequelize[_0x850c('0x2')],'get':function(_0x5406b1){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x850c('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x850c('0x3')],'defaultValue':''},'stamp':{'type':_0x850c('0x5'),'defaultValue':Sequelize[_0x850c('0x6')](_0x850c('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index affb78e..198db4d 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 _0x760f=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','status','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','update','recording','msg_id','VoiceMailMessage\x20not\x20found','audio/wav','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4e21fe,_0x332948){var _0x16e992=function(_0x29f3b0){while(--_0x29f3b0){_0x4e21fe['push'](_0x4e21fe['shift']());}};_0x16e992(++_0x332948);}(_0x760f,0x92));var _0xf760=function(_0x40b680,_0x2db44d){_0x40b680=_0x40b680-0x0;var _0x282fd8=_0x760f[_0x40b680];return _0x282fd8;};'use strict';var emlformat=require(_0xf760('0x0'));var rimraf=require(_0xf760('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf760('0x2'));var rp=require(_0xf760('0x3'));var moment=require(_0xf760('0x4'));var BPromise=require(_0xf760('0x5'));var Mustache=require('mustache');var util=require(_0xf760('0x6'));var path=require('path');var sox=require(_0xf760('0x7'));var csv=require(_0xf760('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf760('0x9'));var _=require(_0xf760('0xa'));var squel=require(_0xf760('0xb'));var crypto=require(_0xf760('0xc'));var jsforce=require(_0xf760('0xd'));var deskjs=require(_0xf760('0xe'));var toCsv=require(_0xf760('0x8'));var querystring=require(_0xf760('0xf'));var Papa=require(_0xf760('0x10'));var Redis=require(_0xf760('0x11'));var authService=require(_0xf760('0x12'));var qs=require(_0xf760('0x13'));var as=require(_0xf760('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf760('0x15'));var utils=require(_0xf760('0x16'));var config=require(_0xf760('0x17'));var licenseUtil=require(_0xf760('0x18'));var db=require(_0xf760('0x19'))['db'];function respondWithStatusCode(_0x517ce6,_0x3f4b21){_0x3f4b21=_0x3f4b21||0xcc;return function(_0xb7cc72){if(_0xb7cc72){return _0x517ce6['sendStatus'](_0x3f4b21);}return _0x517ce6['status'](_0x3f4b21)[_0xf760('0x1a')]();};}function respondWithResult(_0x4cab0e,_0x155408){_0x155408=_0x155408||0xc8;return function(_0x12c154){if(_0x12c154){return _0x4cab0e['status'](_0x155408)['json'](_0x12c154);}};}function respondWithFilteredResult(_0x92feed,_0x5938b0){return function(_0x236a32){if(_0x236a32){var _0x1ac3bc=typeof _0x5938b0[_0xf760('0x1b')]===_0xf760('0x1c')&&typeof _0x5938b0[_0xf760('0x1d')]===_0xf760('0x1c');var _0x2eb8f8=_0x236a32[_0xf760('0x1e')];var _0x56e207=_0x1ac3bc?0x0:_0x5938b0[_0xf760('0x1b')];var _0x4733bd=_0x1ac3bc?_0x236a32[_0xf760('0x1e')]:_0x5938b0[_0xf760('0x1b')]+_0x5938b0[_0xf760('0x1d')];var _0x309cde;if(_0x4733bd>=_0x2eb8f8){_0x4733bd=_0x2eb8f8;_0x309cde=0xc8;}else{_0x309cde=0xce;}_0x92feed['status'](_0x309cde);return _0x92feed[_0xf760('0x1f')](_0xf760('0x20'),_0x56e207+'-'+_0x4733bd+'/'+_0x2eb8f8)[_0xf760('0x21')](_0x236a32);}return null;};}function patchUpdates(_0x481897){return function(_0x1cc813){try{jsonpatch[_0xf760('0x22')](_0x1cc813,_0x481897,!![]);}catch(_0xddaf96){return BPromise[_0xf760('0x23')](_0xddaf96);}return _0x1cc813[_0xf760('0x24')]();};}function saveUpdates(_0x23db78,_0x1c61cf){return function(_0x3be4e4){if(_0x3be4e4){return _0x3be4e4['update'](_0x23db78)[_0xf760('0x25')](function(_0x40261f){return _0x40261f;});}return null;};}function removeEntity(_0x590ac3,_0x14686d){return function(_0x369824){if(_0x369824){return _0x369824[_0xf760('0x26')]()[_0xf760('0x25')](function(){_0x590ac3['status'](0xcc)[_0xf760('0x1a')]();});}};}function handleEntityNotFound(_0x4df6ff,_0x50d52f){return function(_0xa797e2){if(!_0xa797e2){_0x4df6ff['sendStatus'](0x194);}return _0xa797e2;};}function handleError(_0x1aceec,_0x17f213){_0x17f213=_0x17f213||0x1f4;return function(_0x9f181d){logger[_0xf760('0x27')](_0x9f181d[_0xf760('0x28')]);if(_0x9f181d[_0xf760('0x29')]){delete _0x9f181d[_0xf760('0x29')];}_0x1aceec[_0xf760('0x2a')](_0x17f213)[_0xf760('0x2b')](_0x9f181d);};}exports[_0xf760('0x2c')]=function(_0x1ddd98,_0x342261){var _0x1c63bf={},_0x268a07={},_0x3c0764={'count':0x0,'rows':[]};var _0x31aa6b=_[_0xf760('0x2d')](db[_0xf760('0x2e')][_0xf760('0x2f')],function(_0x555520){return{'name':_0x555520[_0xf760('0x30')],'type':_0x555520[_0xf760('0x31')][_0xf760('0x32')]};});_0x268a07[_0xf760('0x33')]=_[_0xf760('0x34')](_[_0xf760('0x2d')](_0x31aa6b,_0xf760('0x29')),[_0xf760('0x29')]);_0x268a07[_0xf760('0x35')]=_['keys'](_0x1ddd98[_0xf760('0x35')]);_0x268a07[_0xf760('0x36')]=_[_0xf760('0x37')](_0x268a07[_0xf760('0x33')],_0x268a07[_0xf760('0x35')]);_0x1c63bf[_0xf760('0x38')]=_[_0xf760('0x37')](_0x268a07[_0xf760('0x33')],qs['fields'](_0x1ddd98[_0xf760('0x35')][_0xf760('0x39')]));_0x1c63bf['attributes']=_0x1c63bf['attributes']['length']?_0x1c63bf[_0xf760('0x38')]:_0x268a07['model'];if(!_0x1ddd98[_0xf760('0x35')][_0xf760('0x3a')]('nolimit')){_0x1c63bf['limit']=qs['limit'](_0x1ddd98[_0xf760('0x35')]['limit']);_0x1c63bf[_0xf760('0x1b')]=qs[_0xf760('0x1b')](_0x1ddd98[_0xf760('0x35')][_0xf760('0x1b')]);}_0x1c63bf[_0xf760('0x3b')]=qs[_0xf760('0x3c')](_0x1ddd98[_0xf760('0x35')][_0xf760('0x3c')]);_0x1c63bf['where']=qs[_0xf760('0x36')](_['pick'](_0x1ddd98[_0xf760('0x35')],_0x268a07[_0xf760('0x36')]),_0x31aa6b);if(_0x1ddd98['query'][_0xf760('0x3d')]){_0x1c63bf[_0xf760('0x3e')]=_['merge'](_0x1c63bf[_0xf760('0x3e')],{'$or':_[_0xf760('0x2d')](_0x31aa6b,function(_0x330859){if(_0x330859[_0xf760('0x31')]!==_0xf760('0x3f')){var _0x1e5274={};_0x1e5274[_0x330859[_0xf760('0x29')]]={'$like':'%'+_0x1ddd98[_0xf760('0x35')][_0xf760('0x3d')]+'%'};return _0x1e5274;}})});}_0x1c63bf=_[_0xf760('0x40')]({},_0x1c63bf,_0x1ddd98[_0xf760('0x41')]);var _0x3729d9={'where':_0x1c63bf['where']};return db[_0xf760('0x2e')][_0xf760('0x1e')](_0x3729d9)[_0xf760('0x25')](function(_0x32529a){_0x3c0764['count']=_0x32529a;if(_0x1ddd98[_0xf760('0x35')][_0xf760('0x42')]){_0x1c63bf['include']=[{'all':!![]}];}return db[_0xf760('0x2e')]['findAll'](_0x1c63bf);})[_0xf760('0x25')](function(_0x5ed801){_0x3c0764[_0xf760('0x43')]=_0x5ed801;return _0x3c0764;})['then'](respondWithFilteredResult(_0x342261,_0x1c63bf))[_0xf760('0x44')](handleError(_0x342261,null));};exports[_0xf760('0x45')]=function(_0x3b7740,_0x361e8f){var _0x4e6a0b={'raw':!![],'where':{'id':_0x3b7740[_0xf760('0x46')]['id']}},_0x437fbf={};_0x437fbf[_0xf760('0x33')]=_['keys'](db[_0xf760('0x2e')]['rawAttributes']);_0x437fbf['query']=_[_0xf760('0x47')](_0x3b7740[_0xf760('0x35')]);_0x437fbf[_0xf760('0x36')]=_['intersection'](_0x437fbf[_0xf760('0x33')],_0x437fbf[_0xf760('0x35')]);_0x4e6a0b[_0xf760('0x38')]=_[_0xf760('0x37')](_0x437fbf[_0xf760('0x33')],qs['fields'](_0x3b7740[_0xf760('0x35')][_0xf760('0x39')]));_0x4e6a0b[_0xf760('0x38')]=_0x4e6a0b[_0xf760('0x38')]['length']?_0x4e6a0b[_0xf760('0x38')]:_0x437fbf[_0xf760('0x33')];if(_0x3b7740[_0xf760('0x35')]['includeAll']){_0x4e6a0b[_0xf760('0x48')]=[{'all':!![]}];}_0x4e6a0b=_[_0xf760('0x40')]({},_0x4e6a0b,_0x3b7740['options']);return db[_0xf760('0x2e')][_0xf760('0x49')](_0x4e6a0b)['then'](handleEntityNotFound(_0x361e8f,null))[_0xf760('0x25')](respondWithResult(_0x361e8f,null))[_0xf760('0x44')](handleError(_0x361e8f,null));};exports[_0xf760('0x4a')]=function(_0x341c40,_0x25c6b1){return db[_0xf760('0x2e')][_0xf760('0x4a')](_0x341c40[_0xf760('0x4b')],{})[_0xf760('0x25')](respondWithResult(_0x25c6b1,0xc9))[_0xf760('0x44')](handleError(_0x25c6b1,null));};exports[_0xf760('0x4c')]=function(_0x5bd7df,_0x429a82){if(_0x5bd7df[_0xf760('0x4b')]['id']){delete _0x5bd7df['body']['id'];}return db['VoiceMailMessage'][_0xf760('0x49')]({'where':{'id':_0x5bd7df[_0xf760('0x46')]['id']}})[_0xf760('0x25')](handleEntityNotFound(_0x429a82,null))[_0xf760('0x25')](saveUpdates(_0x5bd7df[_0xf760('0x4b')],null))[_0xf760('0x25')](respondWithResult(_0x429a82,null))[_0xf760('0x44')](handleError(_0x429a82,null));};exports[_0xf760('0x26')]=function(_0x3b71dc,_0x37514e){return db[_0xf760('0x2e')][_0xf760('0x49')]({'where':{'id':_0x3b71dc[_0xf760('0x46')]['id']}})['then'](handleEntityNotFound(_0x37514e,null))[_0xf760('0x25')](removeEntity(_0x37514e,null))['catch'](handleError(_0x37514e,null));};exports['download']=function(_0x27687a,_0x233437,_0x5c5aef){return db[_0xf760('0x2e')][_0xf760('0x49')]({'where':{'id':_0x27687a[_0xf760('0x46')]['id']},'attributes':['id',_0xf760('0x4d'),_0xf760('0x4e')]})[_0xf760('0x25')](handleEntityNotFound(_0x233437,null))['then'](function(_0x458d76){if(_0x458d76){if(!_0x458d76['recording']){throw new db['Sequelize']['ValidationError'](_0xf760('0x4f'));}var _0x1dd911={'Content-Type':_0xf760('0x50'),'Content-Disposition':'attachment'};if(_0x458d76[_0xf760('0x4e')]){_0x1dd911['Content-Disposition']=_0xf760('0x51')+_0x458d76[_0xf760('0x4e')]+_0xf760('0x52');}_0x233437[_0xf760('0x1f')](_0x1dd911);return _0x233437[_0xf760('0x2b')](new Buffer(_0x458d76['recording']));}})[_0xf760('0x44')](handleError(_0x233437,null));}; \ No newline at end of file +var _0x4e2e=['nolimit','order','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','rows','params','keys','catch','create','body','update','find','download','recording','msg_id','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','model','differenceBy','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x404515,_0x58eb7d){var _0x5d05dc=function(_0x180dc6){while(--_0x180dc6){_0x404515['push'](_0x404515['shift']());}};_0x5d05dc(++_0x58eb7d);}(_0x4e2e,0x72));var _0xe4e2=function(_0xd1b2d9,_0x394303){_0xd1b2d9=_0xd1b2d9-0x0;var _0x56fff8=_0x4e2e[_0xd1b2d9];return _0x56fff8;};'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('bluebird');var Mustache=require('mustache');var util=require(_0xe4e2('0x5'));var path=require(_0xe4e2('0x6'));var sox=require(_0xe4e2('0x7'));var csv=require(_0xe4e2('0x8'));var ejs=require(_0xe4e2('0x9'));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('0x8'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe4e2('0x12'));var as=require(_0xe4e2('0x13'));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(_0xe4e2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa52be9,_0xf4111e){_0xf4111e=_0xf4111e||0xcc;return function(_0x4bf167){if(_0x4bf167){return _0xa52be9['sendStatus'](_0xf4111e);}return _0xa52be9['status'](_0xf4111e)[_0xe4e2('0x1a')]();};}function respondWithResult(_0x6712b3,_0x5ae6f3){_0x5ae6f3=_0x5ae6f3||0xc8;return function(_0x552a61){if(_0x552a61){return _0x6712b3[_0xe4e2('0x1b')](_0x5ae6f3)[_0xe4e2('0x1c')](_0x552a61);}};}function respondWithFilteredResult(_0x1cbf67,_0x4b1f21){return function(_0x2e2186){if(_0x2e2186){var _0x411e74=typeof _0x4b1f21[_0xe4e2('0x1d')]===_0xe4e2('0x1e')&&typeof _0x4b1f21[_0xe4e2('0x1f')]===_0xe4e2('0x1e');var _0x4ff49c=_0x2e2186[_0xe4e2('0x20')];var _0x27a239=_0x411e74?0x0:_0x4b1f21[_0xe4e2('0x1d')];var _0x6c3694=_0x411e74?_0x2e2186[_0xe4e2('0x20')]:_0x4b1f21[_0xe4e2('0x1d')]+_0x4b1f21['limit'];var _0x2c38c0;if(_0x6c3694>=_0x4ff49c){_0x6c3694=_0x4ff49c;_0x2c38c0=0xc8;}else{_0x2c38c0=0xce;}_0x1cbf67[_0xe4e2('0x1b')](_0x2c38c0);return _0x1cbf67['set'](_0xe4e2('0x21'),_0x27a239+'-'+_0x6c3694+'/'+_0x4ff49c)['json'](_0x2e2186);}return null;};}function patchUpdates(_0x24b2d6){return function(_0x3145bf){try{jsonpatch[_0xe4e2('0x22')](_0x3145bf,_0x24b2d6,!![]);}catch(_0x4bd8e3){return BPromise[_0xe4e2('0x23')](_0x4bd8e3);}return _0x3145bf[_0xe4e2('0x24')]();};}function saveUpdates(_0x467076,_0x4f5c46){return function(_0x3b84b0){if(_0x3b84b0){return _0x3b84b0['update'](_0x467076)[_0xe4e2('0x25')](function(_0x468297){return _0x468297;});}return null;};}function removeEntity(_0x52b075,_0x2bcaaf){return function(_0x28bfe2){if(_0x28bfe2){return _0x28bfe2[_0xe4e2('0x26')]()['then'](function(){_0x52b075[_0xe4e2('0x1b')](0xcc)[_0xe4e2('0x1a')]();});}};}function handleEntityNotFound(_0x17560f,_0x2c3cc9){return function(_0x5efd4f){if(!_0x5efd4f){_0x17560f[_0xe4e2('0x27')](0x194);}return _0x5efd4f;};}function handleError(_0x17e161,_0x4a2432){_0x4a2432=_0x4a2432||0x1f4;return function(_0x45c151){logger[_0xe4e2('0x28')](_0x45c151[_0xe4e2('0x29')]);if(_0x45c151[_0xe4e2('0x2a')]){delete _0x45c151[_0xe4e2('0x2a')];}_0x17e161[_0xe4e2('0x1b')](_0x4a2432)['send'](_0x45c151);};}exports['index']=function(_0x4a1dc0,_0x53de81){var _0x11f89e={},_0x414320={},_0xbf291f={'count':0x0,'rows':[]};var _0x13ebc9=_[_0xe4e2('0x2b')](db['VoiceMailMessage'][_0xe4e2('0x2c')],function(_0x6e7ccc){return{'name':_0x6e7ccc[_0xe4e2('0x2d')],'type':_0x6e7ccc[_0xe4e2('0x2e')]['key']};});_0x414320[_0xe4e2('0x2f')]=_[_0xe4e2('0x30')](_[_0xe4e2('0x2b')](_0x13ebc9,_0xe4e2('0x2a')),[_0xe4e2('0x2a')]);_0x414320[_0xe4e2('0x31')]=_['keys'](_0x4a1dc0[_0xe4e2('0x31')]);_0x414320[_0xe4e2('0x32')]=_['intersection'](_0x414320[_0xe4e2('0x2f')],_0x414320[_0xe4e2('0x31')]);_0x11f89e[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x414320[_0xe4e2('0x2f')],qs[_0xe4e2('0x35')](_0x4a1dc0[_0xe4e2('0x31')]['fields']));_0x11f89e[_0xe4e2('0x33')]=_0x11f89e[_0xe4e2('0x33')][_0xe4e2('0x36')]?_0x11f89e[_0xe4e2('0x33')]:_0x414320['model'];if(!_0x4a1dc0['query'][_0xe4e2('0x37')](_0xe4e2('0x38'))){_0x11f89e[_0xe4e2('0x1f')]=qs[_0xe4e2('0x1f')](_0x4a1dc0['query'][_0xe4e2('0x1f')]);_0x11f89e[_0xe4e2('0x1d')]=qs['offset'](_0x4a1dc0[_0xe4e2('0x31')]['offset']);}_0x11f89e[_0xe4e2('0x39')]=qs['sort'](_0x4a1dc0[_0xe4e2('0x31')]['sort']);_0x11f89e[_0xe4e2('0x3a')]=qs[_0xe4e2('0x32')](_[_0xe4e2('0x3b')](_0x4a1dc0['query'],_0x414320[_0xe4e2('0x32')]),_0x13ebc9);if(_0x4a1dc0[_0xe4e2('0x31')][_0xe4e2('0x3c')]){_0x11f89e[_0xe4e2('0x3a')]=_[_0xe4e2('0x3d')](_0x11f89e[_0xe4e2('0x3a')],{'$or':_[_0xe4e2('0x2b')](_0x13ebc9,function(_0x9638ff){if(_0x9638ff[_0xe4e2('0x2e')]!==_0xe4e2('0x3e')){var _0x281048={};_0x281048[_0x9638ff['name']]={'$like':'%'+_0x4a1dc0['query'][_0xe4e2('0x3c')]+'%'};return _0x281048;}})});}_0x11f89e=_[_0xe4e2('0x3d')]({},_0x11f89e,_0x4a1dc0[_0xe4e2('0x3f')]);var _0x1cc7a4={'where':_0x11f89e[_0xe4e2('0x3a')]};return db[_0xe4e2('0x40')][_0xe4e2('0x20')](_0x1cc7a4)[_0xe4e2('0x25')](function(_0x53c9ea){_0xbf291f[_0xe4e2('0x20')]=_0x53c9ea;if(_0x4a1dc0[_0xe4e2('0x31')][_0xe4e2('0x41')]){_0x11f89e[_0xe4e2('0x42')]=[{'all':!![]}];}return db[_0xe4e2('0x40')]['findAll'](_0x11f89e);})[_0xe4e2('0x25')](function(_0x17eee0){_0xbf291f[_0xe4e2('0x43')]=_0x17eee0;return _0xbf291f;})['then'](respondWithFilteredResult(_0x53de81,_0x11f89e))['catch'](handleError(_0x53de81,null));};exports['show']=function(_0x2158ed,_0x479c2e){var _0x862622={'raw':!![],'where':{'id':_0x2158ed[_0xe4e2('0x44')]['id']}},_0x378f8a={};_0x378f8a[_0xe4e2('0x2f')]=_[_0xe4e2('0x45')](db[_0xe4e2('0x40')]['rawAttributes']);_0x378f8a[_0xe4e2('0x31')]=_[_0xe4e2('0x45')](_0x2158ed[_0xe4e2('0x31')]);_0x378f8a[_0xe4e2('0x32')]=_['intersection'](_0x378f8a[_0xe4e2('0x2f')],_0x378f8a['query']);_0x862622[_0xe4e2('0x33')]=_[_0xe4e2('0x34')](_0x378f8a[_0xe4e2('0x2f')],qs[_0xe4e2('0x35')](_0x2158ed[_0xe4e2('0x31')][_0xe4e2('0x35')]));_0x862622[_0xe4e2('0x33')]=_0x862622[_0xe4e2('0x33')][_0xe4e2('0x36')]?_0x862622['attributes']:_0x378f8a['model'];if(_0x2158ed['query'][_0xe4e2('0x41')]){_0x862622[_0xe4e2('0x42')]=[{'all':!![]}];}_0x862622=_[_0xe4e2('0x3d')]({},_0x862622,_0x2158ed['options']);return db[_0xe4e2('0x40')]['find'](_0x862622)[_0xe4e2('0x25')](handleEntityNotFound(_0x479c2e,null))[_0xe4e2('0x25')](respondWithResult(_0x479c2e,null))[_0xe4e2('0x46')](handleError(_0x479c2e,null));};exports[_0xe4e2('0x47')]=function(_0x4629ff,_0x89a602){return db[_0xe4e2('0x40')][_0xe4e2('0x47')](_0x4629ff[_0xe4e2('0x48')],{})[_0xe4e2('0x25')](respondWithResult(_0x89a602,0xc9))['catch'](handleError(_0x89a602,null));};exports[_0xe4e2('0x49')]=function(_0xf3ce90,_0x5798be){if(_0xf3ce90[_0xe4e2('0x48')]['id']){delete _0xf3ce90[_0xe4e2('0x48')]['id'];}return db[_0xe4e2('0x40')][_0xe4e2('0x4a')]({'where':{'id':_0xf3ce90[_0xe4e2('0x44')]['id']}})[_0xe4e2('0x25')](handleEntityNotFound(_0x5798be,null))[_0xe4e2('0x25')](saveUpdates(_0xf3ce90['body'],null))[_0xe4e2('0x25')](respondWithResult(_0x5798be,null))[_0xe4e2('0x46')](handleError(_0x5798be,null));};exports[_0xe4e2('0x26')]=function(_0x22b2b0,_0x2943d5){return db[_0xe4e2('0x40')][_0xe4e2('0x4a')]({'where':{'id':_0x22b2b0['params']['id']}})[_0xe4e2('0x25')](handleEntityNotFound(_0x2943d5,null))['then'](removeEntity(_0x2943d5,null))['catch'](handleError(_0x2943d5,null));};exports[_0xe4e2('0x4b')]=function(_0x204703,_0x568148,_0x78b04b){return db[_0xe4e2('0x40')]['find']({'where':{'id':_0x204703['params']['id']},'attributes':['id',_0xe4e2('0x4c'),_0xe4e2('0x4d')]})[_0xe4e2('0x25')](handleEntityNotFound(_0x568148,null))[_0xe4e2('0x25')](function(_0x3cd597){if(_0x3cd597){if(!_0x3cd597[_0xe4e2('0x4c')]){throw new db['Sequelize'][(_0xe4e2('0x4e'))]('VoiceMailMessage\x20not\x20found');}var _0xb71689={'Content-Type':_0xe4e2('0x4f'),'Content-Disposition':_0xe4e2('0x50')};if(_0x3cd597[_0xe4e2('0x4d')]){_0xb71689[_0xe4e2('0x51')]=_0xe4e2('0x52')+_0x3cd597[_0xe4e2('0x4d')]+'.wav\x22';}_0x568148[_0xe4e2('0x53')](_0xb71689);return _0x568148[_0xe4e2('0x54')](new Buffer(_0x3cd597[_0xe4e2('0x4c')]));}})[_0xe4e2('0x46')](handleError(_0x568148,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index f8b23ab..ecd1324 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 _0x2182=['path','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x328006,_0x43e683){var _0x3f9028=function(_0x3c0af8){while(--_0x3c0af8){_0x328006['push'](_0x328006['shift']());}};_0x3f9028(++_0x43e683);}(_0x2182,0x117));var _0x2218=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2182[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var logger=require(_0x2218('0x2'))(_0x2218('0x3'));var moment=require(_0x2218('0x4'));var BPromise=require(_0x2218('0x5'));var rp=require(_0x2218('0x6'));var fs=require('fs');var path=require(_0x2218('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x44057a,_0x254762){return _0x44057a[_0x2218('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x2218('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x2218('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0625=['request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','bluebird'];(function(_0x72c194,_0x1a953a){var _0x1f4f68=function(_0x43bcdd){while(--_0x43bcdd){_0x72c194['push'](_0x72c194['shift']());}};_0x1f4f68(++_0x1a953a);}(_0x0625,0x6c));var _0x5062=function(_0x1fb53e,_0x393670){_0x1fb53e=_0x1fb53e-0x0;var _0x3623a2=_0x0625[_0x1fb53e];return _0x3623a2;};'use strict';var _=require(_0x5062('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5062('0x1'));var rp=require(_0x5062('0x2'));var fs=require('fs');var path=require(_0x5062('0x3'));var rimraf=require(_0x5062('0x4'));var config=require(_0x5062('0x5'));var attributes=require(_0x5062('0x6'));module[_0x5062('0x7')]=function(_0x2db7bd,_0x5e189c){return _0x2db7bd['define'](_0x5062('0x8'),attributes,{'tableName':_0x5062('0x9'),'paranoid':![],'indexes':[{'name':_0x5062('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index da8c528..490c028 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 _0x3c6d=['info','VoiceMailMessage,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message'];(function(_0x547b42,_0xb844dd){var _0x4d69d=function(_0x3b4bab){while(--_0x3b4bab){_0x547b42['push'](_0x547b42['shift']());}};_0x4d69d(++_0xb844dd);}(_0x3c6d,0xb3));var _0xd3c6=function(_0x16aea8,_0x47051b){_0x16aea8=_0x16aea8-0x0;var _0x1f32f9=_0x3c6d[_0x16aea8];return _0x1f32f9;};'use strict';var _=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rs=require(_0xd3c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd3c6('0x5'))['db'];var utils=require(_0xd3c6('0x6'));var logger=require(_0xd3c6('0x7'))('rpc');var config=require(_0xd3c6('0x8'));var jayson=require(_0xd3c6('0x9'));var client=jayson[_0xd3c6('0xa')][_0xd3c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17973b,_0x711ae2,_0x2f475a){return new BPromise(function(_0x13cca6,_0xc2333d){return client[_0xd3c6('0xc')](_0x17973b,_0x2f475a)[_0xd3c6('0xd')](function(_0x3a4cd1){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x711ae2,_0xd3c6('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x711ae2,'request\x20sent',JSON[_0xd3c6('0xf')](_0x3a4cd1));if(_0x3a4cd1['error']){if(_0x3a4cd1[_0xd3c6('0x10')][_0xd3c6('0x11')]===0x1f4){logger[_0xd3c6('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x711ae2,_0x3a4cd1[_0xd3c6('0x10')][_0xd3c6('0x12')]);return _0xc2333d(_0x3a4cd1[_0xd3c6('0x10')][_0xd3c6('0x12')]);}logger[_0xd3c6('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x711ae2,_0x3a4cd1['error'][_0xd3c6('0x12')]);return _0x13cca6(_0x3a4cd1['error'][_0xd3c6('0x12')]);}else{logger[_0xd3c6('0x13')](_0xd3c6('0x14'),_0x711ae2,_0xd3c6('0xe'));_0x13cca6(_0x3a4cd1['result'][_0xd3c6('0x12')]);}})[_0xd3c6('0x15')](function(_0x386315){logger[_0xd3c6('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x711ae2,_0x386315);_0xc2333d(_0x386315);});});} \ No newline at end of file +var _0x780d=['stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x50fc93,_0x3b3b27){var _0x40f130=function(_0x9270e3){while(--_0x9270e3){_0x50fc93['push'](_0x50fc93['shift']());}};_0x40f130(++_0x3b3b27);}(_0x780d,0x1bd));var _0xd780=function(_0x1819fc,_0x593338){_0x1819fc=_0x1819fc-0x0;var _0x4921c9=_0x780d[_0x1819fc];return _0x4921c9;};'use strict';var _=require(_0xd780('0x0'));var util=require('util');var moment=require(_0xd780('0x1'));var BPromise=require(_0xd780('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd780('0x3'));var db=require(_0xd780('0x4'))['db'];var utils=require(_0xd780('0x5'));var logger=require('../../config/logger')(_0xd780('0x6'));var config=require(_0xd780('0x7'));var jayson=require(_0xd780('0x8'));var client=jayson[_0xd780('0x9')][_0xd780('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21dc68,_0x1b1ce2,_0x2494f5){return new BPromise(function(_0x380d33,_0x2d6551){return client[_0xd780('0xb')](_0x21dc68,_0x2494f5)['then'](function(_0xa234e8){logger[_0xd780('0xc')](_0xd780('0xd'),_0x1b1ce2,_0xd780('0xe'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1b1ce2,'request\x20sent',JSON[_0xd780('0xf')](_0xa234e8));if(_0xa234e8[_0xd780('0x10')]){if(_0xa234e8[_0xd780('0x10')]['code']===0x1f4){logger[_0xd780('0x10')](_0xd780('0xd'),_0x1b1ce2,_0xa234e8[_0xd780('0x10')]['message']);return _0x2d6551(_0xa234e8[_0xd780('0x10')]['message']);}logger[_0xd780('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x1b1ce2,_0xa234e8['error']['message']);return _0x380d33(_0xa234e8['error'][_0xd780('0x11')]);}else{logger[_0xd780('0xc')](_0xd780('0xd'),_0x1b1ce2,_0xd780('0xe'));_0x380d33(_0xa234e8[_0xd780('0x12')][_0xd780('0x11')]);}})[_0xd780('0x13')](function(_0x325e29){logger[_0xd780('0x10')](_0xd780('0xd'),_0x1b1ce2,_0x325e29);_0x2d6551(_0x325e29);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 137ea91..da0babc 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 _0x944d=['addSound','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post'];(function(_0x187357,_0x143396){var _0x1b150b=function(_0x4042ef){while(--_0x4042ef){_0x187357['push'](_0x187357['shift']());}};_0x1b150b(++_0x143396);}(_0x944d,0x98));var _0xd944=function(_0x5be31d,_0x524b6d){_0x5be31d=_0x5be31d-0x0;var _0x48d7ae=_0x944d[_0x5be31d];return _0x48d7ae;};'use strict';var multer=require(_0xd944('0x0'));var util=require(_0xd944('0x1'));var path=require('path');var timeout=require(_0xd944('0x2'));var express=require(_0xd944('0x3'));var router=express[_0xd944('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd944('0x5'));var config=require(_0xd944('0x6'));var controller=require(_0xd944('0x7'));router[_0xd944('0x8')]('/',auth[_0xd944('0x9')](),controller[_0xd944('0xa')]);router['get'](_0xd944('0xb'),auth[_0xd944('0x9')](),controller[_0xd944('0xc')]);router[_0xd944('0x8')](_0xd944('0xd'),auth[_0xd944('0x9')](),controller[_0xd944('0xe')]);router['post']('/',auth[_0xd944('0x9')](),controller['create']);router[_0xd944('0xf')](_0xd944('0xd'),auth[_0xd944('0x9')](),controller[_0xd944('0x10')]);router[_0xd944('0x11')](_0xd944('0xb'),auth[_0xd944('0x9')](),controller[_0xd944('0x12')]);router[_0xd944('0x13')](_0xd944('0xb'),auth[_0xd944('0x9')](),controller[_0xd944('0x14')]);router[_0xd944('0x13')]('/:id/sounds/:id2',auth[_0xd944('0x9')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0xa7eb=['get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','delete','destroy','/:id/sounds/:id2','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x2c4704,_0x325165){var _0x44ff1a=function(_0x3e2848){while(--_0x3e2848){_0x2c4704['push'](_0x2c4704['shift']());}};_0x44ff1a(++_0x325165);}(_0xa7eb,0x158));var _0xba7e=function(_0xb748ff,_0x1298d9){_0xb748ff=_0xb748ff-0x0;var _0x5dd153=_0xa7eb[_0xb748ff];return _0x5dd153;};'use strict';var multer=require(_0xba7e('0x0'));var util=require(_0xba7e('0x1'));var path=require('path');var timeout=require(_0xba7e('0x2'));var express=require(_0xba7e('0x3'));var router=express[_0xba7e('0x4')]();var fs_extra=require(_0xba7e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba7e('0x6'));var controller=require(_0xba7e('0x7'));router[_0xba7e('0x8')]('/',auth[_0xba7e('0x9')](),controller[_0xba7e('0xa')]);router['get']('/:id',auth[_0xba7e('0x9')](),controller['show']);router[_0xba7e('0x8')](_0xba7e('0xb'),auth[_0xba7e('0x9')](),controller[_0xba7e('0xc')]);router[_0xba7e('0xd')]('/',auth[_0xba7e('0x9')](),controller[_0xba7e('0xe')]);router[_0xba7e('0xd')](_0xba7e('0xb'),auth[_0xba7e('0x9')](),controller[_0xba7e('0xf')]);router[_0xba7e('0x10')](_0xba7e('0x11'),auth[_0xba7e('0x9')](),controller['update']);router[_0xba7e('0x12')](_0xba7e('0x11'),auth[_0xba7e('0x9')](),controller[_0xba7e('0x13')]);router['delete'](_0xba7e('0x14'),auth[_0xba7e('0x9')](),controller['removeSound']);module[_0xba7e('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index b5c5491..f5dc6c7 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 _0x1b6d=['files','alpha','BOOLEAN','sequelize','exports','STRING','custom','quietmp3','mp3'];(function(_0x407789,_0x3926c7){var _0x4a23c6=function(_0x427f68){while(--_0x427f68){_0x407789['push'](_0x407789['shift']());}};_0x4a23c6(++_0x3926c7);}(_0x1b6d,0x93));var _0xd1b6=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b6d[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xd1b6('0x0'));module[_0xd1b6('0x1')]={'name':{'type':Sequelize[_0xd1b6('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xd1b6('0x3'),'files','mp3nb','quietmp3nb',_0xd1b6('0x4'),_0xd1b6('0x5')),'allowNull':!![],'defaultValue':_0xd1b6('0x6')},'directory':{'type':Sequelize[_0xd1b6('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xd1b6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd1b6('0x2')],'allowNull':!![],'defaultValue':_0xd1b6('0x7')},'format':{'type':Sequelize[_0xd1b6('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xd1b6('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xcfb1=['exports','STRING','name','custom','quietmp3nb','alpha','BOOLEAN','sequelize'];(function(_0x162a95,_0x9dfb1f){var _0x54cd40=function(_0x249ed1){while(--_0x249ed1){_0x162a95['push'](_0x162a95['shift']());}};_0x54cd40(++_0x9dfb1f);}(_0xcfb1,0xdf));var _0x1cfb=function(_0x144555,_0x5991f4){_0x144555=_0x144555-0x0;var _0x3a3096=_0xcfb1[_0x144555];return _0x3a3096;};'use strict';var Sequelize=require(_0x1cfb('0x0'));module[_0x1cfb('0x1')]={'name':{'type':Sequelize[_0x1cfb('0x2')],'allowNull':![],'unique':_0x1cfb('0x3')},'mode':{'type':Sequelize['ENUM'](_0x1cfb('0x4'),'files','mp3nb',_0x1cfb('0x5'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x1cfb('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x1cfb('0x2')],'allowNull':!![],'defaultValue':_0x1cfb('0x6')},'format':{'type':Sequelize[_0x1cfb('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x1cfb('0x7')],'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 2a73323..fbdec7d 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 _0x6a6c=['findOne','converted_format','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','extname','format','symlinkSync','Sequelize','removeSound','id2','getSounds','pick','filter','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','MusicOnHolds','end','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','merge','VIRTUAL','count','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','find','body','create','sequelize','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','transaction','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','Sound'];(function(_0x1e53ca,_0x2692ed){var _0x55e658=function(_0x2194c5){while(--_0x2194c5){_0x1e53ca['push'](_0x1e53ca['shift']());}};_0x55e658(++_0x2692ed);}(_0x6a6c,0x178));var _0xc6a6=function(_0x2304ca,_0xac6ef3){_0x2304ca=_0x2304ca-0x0;var _0xd6417f=_0x6a6c[_0x2304ca];return _0xd6417f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6a6('0x0'));var zipdir=require(_0xc6a6('0x1'));var jsonpatch=require(_0xc6a6('0x2'));var rp=require(_0xc6a6('0x3'));var moment=require(_0xc6a6('0x4'));var BPromise=require(_0xc6a6('0x5'));var Mustache=require(_0xc6a6('0x6'));var util=require(_0xc6a6('0x7'));var path=require(_0xc6a6('0x8'));var sox=require(_0xc6a6('0x9'));var csv=require(_0xc6a6('0xa'));var ejs=require(_0xc6a6('0xb'));var fs=require('fs');var fs_extra=require(_0xc6a6('0xc'));var _=require(_0xc6a6('0xd'));var squel=require('squel');var crypto=require(_0xc6a6('0xe'));var jsforce=require(_0xc6a6('0xf'));var deskjs=require(_0xc6a6('0x10'));var toCsv=require(_0xc6a6('0xa'));var querystring=require(_0xc6a6('0x11'));var Papa=require(_0xc6a6('0x12'));var Redis=require(_0xc6a6('0x13'));var authService=require(_0xc6a6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc6a6('0x15'));var hardwareService=require(_0xc6a6('0x16'));var logger=require('../../config/logger')(_0xc6a6('0x17'));var utils=require(_0xc6a6('0x18'));var config=require(_0xc6a6('0x19'));var licenseUtil=require(_0xc6a6('0x1a'));var db=require(_0xc6a6('0x1b'))['db'];function respondWithStatusCode(_0x31f2a4,_0x4f9ddc){_0x4f9ddc=_0x4f9ddc||0xcc;return function(_0x1c3e1f){if(_0x1c3e1f){return _0x31f2a4[_0xc6a6('0x1c')](_0x4f9ddc);}return _0x31f2a4[_0xc6a6('0x1d')](_0x4f9ddc)['end']();};}function respondWithResult(_0x38f00a,_0x57f45a){_0x57f45a=_0x57f45a||0xc8;return function(_0x177f9f){if(_0x177f9f){return _0x38f00a[_0xc6a6('0x1d')](_0x57f45a)[_0xc6a6('0x1e')](_0x177f9f);}};}function respondWithFilteredResult(_0xa744ab,_0x26aaf0){return function(_0x13489f){if(_0x13489f){var _0x4832d5=typeof _0x26aaf0[_0xc6a6('0x1f')]===_0xc6a6('0x20')&&typeof _0x26aaf0[_0xc6a6('0x21')]===_0xc6a6('0x20');var _0x203c84=_0x13489f['count'];var _0x29e0c7=_0x4832d5?0x0:_0x26aaf0[_0xc6a6('0x1f')];var _0x3c7f80=_0x4832d5?_0x13489f['count']:_0x26aaf0[_0xc6a6('0x1f')]+_0x26aaf0[_0xc6a6('0x21')];var _0x336b4c;if(_0x3c7f80>=_0x203c84){_0x3c7f80=_0x203c84;_0x336b4c=0xc8;}else{_0x336b4c=0xce;}_0xa744ab[_0xc6a6('0x1d')](_0x336b4c);return _0xa744ab[_0xc6a6('0x22')](_0xc6a6('0x23'),_0x29e0c7+'-'+_0x3c7f80+'/'+_0x203c84)['json'](_0x13489f);}return null;};}function patchUpdates(_0x4a0640){return function(_0x551dde){try{jsonpatch[_0xc6a6('0x24')](_0x551dde,_0x4a0640,!![]);}catch(_0x4c7813){return BPromise[_0xc6a6('0x25')](_0x4c7813);}return _0x551dde[_0xc6a6('0x26')]();};}function saveUpdates(_0x582bf4,_0x5b0f36){return function(_0x4910e4){if(_0x4910e4){return _0x4910e4[_0xc6a6('0x27')](_0x582bf4)[_0xc6a6('0x28')](function(_0xf25b0f){return _0xf25b0f;});}return null;};}function removeEntity(_0x1a7805,_0x3e61c3){return function(_0x1efa33){if(_0x1efa33){return _0x1efa33[_0xc6a6('0x29')]()[_0xc6a6('0x28')](function(){var _0x2baa68=_0x1efa33['get']({'plain':!![]});var _0x5a5e5b=_0xc6a6('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5a5e5b,'resourceId':_0x2baa68['id']}})[_0xc6a6('0x28')](function(){return _0x1efa33;});})['then'](function(){_0x1a7805[_0xc6a6('0x1d')](0xcc)[_0xc6a6('0x2b')]();});}};}function handleEntityNotFound(_0x5b79de,_0xce78a6){return function(_0x5ef5f7){if(!_0x5ef5f7){_0x5b79de[_0xc6a6('0x1c')](0x194);}return _0x5ef5f7;};}function handleError(_0x537c1b,_0x4f7b0b){_0x4f7b0b=_0x4f7b0b||0x1f4;return function(_0x11cea8){logger[_0xc6a6('0x2c')](_0x11cea8[_0xc6a6('0x2d')]);if(_0x11cea8['name']){delete _0x11cea8[_0xc6a6('0x2e')];}_0x537c1b[_0xc6a6('0x1d')](_0x4f7b0b)[_0xc6a6('0x2f')](_0x11cea8);};}exports[_0xc6a6('0x30')]=function(_0x5bf46d,_0x2b53db){var _0x2092ac={},_0x569821={},_0x4e4548={'count':0x0,'rows':[]};var _0x27c69e=_[_0xc6a6('0x31')](db[_0xc6a6('0x32')]['rawAttributes'],function(_0x354a43){return{'name':_0x354a43[_0xc6a6('0x33')],'type':_0x354a43[_0xc6a6('0x34')][_0xc6a6('0x35')]};});_0x569821['model']=_['map'](_0x27c69e,_0xc6a6('0x2e'));_0x569821[_0xc6a6('0x36')]=_['keys'](_0x5bf46d[_0xc6a6('0x36')]);_0x569821[_0xc6a6('0x37')]=_['intersection'](_0x569821['model'],_0x569821[_0xc6a6('0x36')]);_0x2092ac[_0xc6a6('0x38')]=_[_0xc6a6('0x39')](_0x569821[_0xc6a6('0x3a')],qs['fields'](_0x5bf46d[_0xc6a6('0x36')][_0xc6a6('0x3b')]));_0x2092ac[_0xc6a6('0x38')]=_0x2092ac[_0xc6a6('0x38')][_0xc6a6('0x3c')]?_0x2092ac['attributes']:_0x569821[_0xc6a6('0x3a')];if(!_0x5bf46d['query']['hasOwnProperty'](_0xc6a6('0x3d'))){_0x2092ac[_0xc6a6('0x21')]=qs[_0xc6a6('0x21')](_0x5bf46d['query'][_0xc6a6('0x21')]);_0x2092ac[_0xc6a6('0x1f')]=qs['offset'](_0x5bf46d[_0xc6a6('0x36')][_0xc6a6('0x1f')]);}_0x2092ac[_0xc6a6('0x3e')]=qs[_0xc6a6('0x3f')](_0x5bf46d[_0xc6a6('0x36')]['sort']);delete _0x5bf46d['query'][_0xc6a6('0x3f')];_0x2092ac[_0xc6a6('0x40')]=qs[_0xc6a6('0x37')](_['pick'](_0x5bf46d[_0xc6a6('0x36')],_0x569821[_0xc6a6('0x37')]),_0x27c69e);if(_0x5bf46d['query']['filter']){_0x2092ac['where']=_[_0xc6a6('0x41')](_0x2092ac[_0xc6a6('0x40')],{'$or':_[_0xc6a6('0x31')](_0x27c69e,function(_0x3d3561){if(_0x3d3561[_0xc6a6('0x34')]!==_0xc6a6('0x42')){var _0x5d0788={};_0x5d0788[_0x3d3561[_0xc6a6('0x2e')]]={'$like':'%'+_0x5bf46d['query']['filter']+'%'};return _0x5d0788;}})});}_0x2092ac=_[_0xc6a6('0x41')]({},_0x2092ac,_0x5bf46d['options']);var _0x5b058d={'where':_0x2092ac[_0xc6a6('0x40')]};return db[_0xc6a6('0x32')][_0xc6a6('0x43')](_0x5b058d)[_0xc6a6('0x28')](function(_0xd9e1ed){_0x4e4548[_0xc6a6('0x43')]=_0xd9e1ed;if(_0x5bf46d['query']['includeAll']){_0x2092ac[_0xc6a6('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xc6a6('0x45')](_0x2092ac);})[_0xc6a6('0x28')](function(_0x44d26e){_0x4e4548['rows']=_0x44d26e;return _0x4e4548;})[_0xc6a6('0x28')](respondWithFilteredResult(_0x2b53db,_0x2092ac))[_0xc6a6('0x46')](handleError(_0x2b53db,null));};exports[_0xc6a6('0x47')]=function(_0x9e5bb9,_0x1d35e4){var _0x44613b={'raw':![],'where':{'id':_0x9e5bb9[_0xc6a6('0x48')]['id']}},_0x44f489={};_0x44f489['model']=_[_0xc6a6('0x49')](db[_0xc6a6('0x32')][_0xc6a6('0x4a')]);_0x44f489[_0xc6a6('0x36')]=_[_0xc6a6('0x49')](_0x9e5bb9[_0xc6a6('0x36')]);_0x44f489[_0xc6a6('0x37')]=_[_0xc6a6('0x39')](_0x44f489[_0xc6a6('0x3a')],_0x44f489[_0xc6a6('0x36')]);_0x44613b['attributes']=_[_0xc6a6('0x39')](_0x44f489[_0xc6a6('0x3a')],qs['fields'](_0x9e5bb9[_0xc6a6('0x36')][_0xc6a6('0x3b')]));_0x44613b['attributes']=_0x44613b[_0xc6a6('0x38')][_0xc6a6('0x3c')]?_0x44613b[_0xc6a6('0x38')]:_0x44f489[_0xc6a6('0x3a')];if(_0x9e5bb9['query'][_0xc6a6('0x4b')]){_0x44613b['include']=[{'all':!![]}];}_0x44613b=_[_0xc6a6('0x41')]({},_0x44613b,_0x9e5bb9[_0xc6a6('0x4c')]);return db[_0xc6a6('0x32')][_0xc6a6('0x4d')](_0x44613b)[_0xc6a6('0x28')](handleEntityNotFound(_0x1d35e4,null))[_0xc6a6('0x28')](respondWithResult(_0x1d35e4,null))[_0xc6a6('0x46')](handleError(_0x1d35e4,null));};exports[_0xc6a6('0x27')]=function(_0x30b211,_0x3eec25){if(_0x30b211[_0xc6a6('0x4e')]['id']){delete _0x30b211[_0xc6a6('0x4e')]['id'];}return db[_0xc6a6('0x32')][_0xc6a6('0x4d')]({'where':{'id':_0x30b211['params']['id']}})['then'](handleEntityNotFound(_0x3eec25,null))[_0xc6a6('0x28')](saveUpdates(_0x30b211[_0xc6a6('0x4e')],null))[_0xc6a6('0x28')](respondWithResult(_0x3eec25,null))['catch'](handleError(_0x3eec25,null));};exports[_0xc6a6('0x4f')]=function(_0x221b08,_0x25a21c,_0x36dbe7){return db[_0xc6a6('0x50')]['transaction'](function(_0x18c3e0){if(_0x221b08[_0xc6a6('0x4e')]['mode']===_0xc6a6('0x51')){_0x221b08[_0xc6a6('0x4e')][_0xc6a6('0x52')]=path[_0xc6a6('0x53')](config[_0xc6a6('0x54')],_0xc6a6('0x55'),_0x221b08[_0xc6a6('0x4e')]['name']);}return db[_0xc6a6('0x32')][_0xc6a6('0x4f')](_0x221b08[_0xc6a6('0x4e')],{'transaction':_0x18c3e0})[_0xc6a6('0x28')](function(_0x3231b0){if(_0x221b08[_0xc6a6('0x4e')][_0xc6a6('0x56')]===_0xc6a6('0x51')){fs[_0xc6a6('0x57')](_0x3231b0[_0xc6a6('0x52')],parseInt(_0xc6a6('0x58'),0x8));}var _0x31f81e=_0x221b08[_0xc6a6('0x59')][_0xc6a6('0x5a')]({'plain':!![]});if(!_0x31f81e)throw new Error(_0xc6a6('0x5b'));if(_0x31f81e[_0xc6a6('0x5c')]===_0xc6a6('0x59')){var _0x20d08f=_0x3231b0['get']({'plain':!![]});return db[_0xc6a6('0x5d')][_0xc6a6('0x4d')]({'where':{'name':_0xc6a6('0x2a'),'userProfileId':_0x31f81e['userProfileId']},'raw':!![]})['then'](function(_0x1f3b2d){if(_0x1f3b2d&&_0x1f3b2d[_0xc6a6('0x5e')]===0x0){return db[_0xc6a6('0x5f')][_0xc6a6('0x4f')]({'name':_0x20d08f[_0xc6a6('0x2e')],'resourceId':_0x20d08f['id'],'type':_0x1f3b2d[_0xc6a6('0x2e')],'sectionId':_0x1f3b2d['id']},{})['then'](function(){return _0x3231b0;});}else{return _0x3231b0;}})[_0xc6a6('0x46')](function(_0x584ca9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x584ca9);});}return _0x3231b0;});})[_0xc6a6('0x28')](respondWithResult(_0x25a21c,0xc9))['catch'](handleError(_0x25a21c,null));};exports[_0xc6a6('0x29')]=function(_0x1a00c0,_0x559885,_0x4e7890){var _0x46caa5;return db[_0xc6a6('0x32')][_0xc6a6('0x4d')]({'where':{'id':_0x1a00c0[_0xc6a6('0x48')]['id']}})[_0xc6a6('0x28')](function(_0x4b302b){if(_0x4b302b){return db[_0xc6a6('0x50')][_0xc6a6('0x60')](function(_0x1f29f4){return _0x4b302b[_0xc6a6('0x29')]({'transaction':_0x1f29f4,'raw':!![]})[_0xc6a6('0x28')](function(_0x1c5226){if(_0x1c5226['directory']){fs['readdirSync'](_0x1c5226['directory'])[_0xc6a6('0x61')](function(_0x13f80b){fs[_0xc6a6('0x62')](path[_0xc6a6('0x53')](_0x1c5226[_0xc6a6('0x52')],_0x13f80b));});fs[_0xc6a6('0x63')](_0x1c5226[_0xc6a6('0x52')]);}return _0x1c5226;});})[_0xc6a6('0x46')](function(_0x37cb06){throw new db['Sequelize'][(_0xc6a6('0x64'))](_0x37cb06[_0xc6a6('0x65')]);});}})[_0xc6a6('0x28')](handleEntityNotFound(_0x559885,null))['then'](removeEntity(_0x559885,null))['catch'](handleError(_0x559885,null));};exports['addSound']=function(_0x5ce5be,_0x4fd994,_0x1e74da){return db[_0xc6a6('0x50')][_0xc6a6('0x60')](function(_0x1c27f3){var _0xb1638c;return db[_0xc6a6('0x32')][_0xc6a6('0x4d')]({'where':{'id':_0x5ce5be[_0xc6a6('0x48')]['id']}})['then'](function(_0x330b29){if(_0x330b29){_0xb1638c=_0x330b29;return _0x330b29[_0xc6a6('0x66')](_0x5ce5be[_0xc6a6('0x4e')]['id'],{'transaction':_0x1c27f3});}})[_0xc6a6('0x28')](function(_0x388729){if(_0x388729){return db[_0xc6a6('0x67')][_0xc6a6('0x68')]({'where':{'id':_0x5ce5be[_0xc6a6('0x4e')]['id']},'attributes':['id',_0xc6a6('0x2e'),'save_name',_0xc6a6('0x69'),_0xc6a6('0x6a')],'raw':!![]});}})[_0xc6a6('0x28')](function(_0x160c3a){if(_0x160c3a){var _0x5b64a=path[_0xc6a6('0x53')](config[_0xc6a6('0x54')],_0xc6a6('0x6b'),util['format'](_0xc6a6('0x6c'),path[_0xc6a6('0x6d')](_0x160c3a[_0xc6a6('0x6e')],path[_0xc6a6('0x6f')](_0x160c3a[_0xc6a6('0x6e')])),_0x160c3a[_0xc6a6('0x69')]));var _0x11a390=path[_0xc6a6('0x53')](config[_0xc6a6('0x54')],_0xc6a6('0x55'),_0xb1638c[_0xc6a6('0x2e')],util[_0xc6a6('0x70')](_0xc6a6('0x6c'),_0x160c3a[_0xc6a6('0x2e')],_0x160c3a[_0xc6a6('0x69')]));fs[_0xc6a6('0x71')](_0x5b64a,_0x11a390);return _0x160c3a;}})[_0xc6a6('0x46')](function(_0x4aa163){throw new db[(_0xc6a6('0x72'))][(_0xc6a6('0x64'))](_0x4aa163[_0xc6a6('0x65')]);});})[_0xc6a6('0x28')](handleEntityNotFound(_0x4fd994,null))[_0xc6a6('0x28')](respondWithResult(_0x4fd994,0xc9))[_0xc6a6('0x46')](handleError(_0x4fd994,null));};exports[_0xc6a6('0x73')]=function(_0x186670,_0x2325ea,_0x22808d){return db['sequelize'][_0xc6a6('0x60')](function(_0x58c9a7){var _0x491008;return db[_0xc6a6('0x32')][_0xc6a6('0x68')]({'where':{'id':_0x186670[_0xc6a6('0x48')]['id']}})[_0xc6a6('0x28')](handleEntityNotFound(_0x2325ea,null))[_0xc6a6('0x28')](function(_0x4bddba){if(_0x4bddba){_0x491008=_0x4bddba;return _0x4bddba[_0xc6a6('0x73')](_0x186670[_0xc6a6('0x48')]['id2']);}})['then'](function(_0x28d7b8){if(_0x28d7b8){return db[_0xc6a6('0x67')]['findOne']({'where':{'id':_0x186670['params'][_0xc6a6('0x74')]},'attributes':['id','name',_0xc6a6('0x6e'),'converted_format',_0xc6a6('0x6a')],'raw':!![]});}})[_0xc6a6('0x28')](function(_0x4abd53){if(_0x4abd53){fs[_0xc6a6('0x62')](path[_0xc6a6('0x53')](_0x491008[_0xc6a6('0x52')],util['format'](_0xc6a6('0x6c'),_0x4abd53[_0xc6a6('0x2e')],_0x4abd53[_0xc6a6('0x69')])));return _0x4abd53;}})[_0xc6a6('0x46')](function(_0xa4300a){throw new db[(_0xc6a6('0x72'))]['ValidationError'](_0xa4300a['message']);});})[_0xc6a6('0x28')](handleEntityNotFound(_0x2325ea,null))['then'](respondWithStatusCode(_0x2325ea,0xcc))[_0xc6a6('0x46')](handleError(_0x2325ea,null));};exports[_0xc6a6('0x75')]=function(_0x47e761,_0x577360,_0x8ea9){var _0x583c22={};var _0x3362a2={};var _0x5cb06b;var _0x2adee4;return db[_0xc6a6('0x32')][_0xc6a6('0x68')]({'where':{'id':_0x47e761['params']['id']}})[_0xc6a6('0x28')](handleEntityNotFound(_0x577360,null))['then'](function(_0x335702){if(_0x335702){_0x5cb06b=_0x335702;_0x3362a2[_0xc6a6('0x3a')]=_[_0xc6a6('0x49')](db[_0xc6a6('0x67')][_0xc6a6('0x4a')]);_0x3362a2['query']=_['keys'](_0x47e761[_0xc6a6('0x36')]);_0x3362a2['filters']=_[_0xc6a6('0x39')](_0x3362a2[_0xc6a6('0x3a')],_0x3362a2[_0xc6a6('0x36')]);_0x583c22[_0xc6a6('0x38')]=_['intersection'](_0x3362a2[_0xc6a6('0x3a')],qs['fields'](_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x3b')]));_0x583c22['attributes']=_0x583c22[_0xc6a6('0x38')][_0xc6a6('0x3c')]?_0x583c22['attributes']:_0x3362a2[_0xc6a6('0x3a')];_0x583c22[_0xc6a6('0x3e')]=qs[_0xc6a6('0x3f')](_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x3f')]);_0x583c22[_0xc6a6('0x40')]=qs[_0xc6a6('0x37')](_[_0xc6a6('0x76')](_0x47e761[_0xc6a6('0x36')],_0x3362a2[_0xc6a6('0x37')]));if(_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x77')]){_0x583c22['where']=_['merge'](_0x583c22['where'],{'$or':_['map'](_0x583c22[_0xc6a6('0x38')],function(_0x2e971e){var _0x282b8f={};_0x282b8f[_0x2e971e]={'$like':'%'+_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x77')]+'%'};return _0x282b8f;})});}_0x583c22=_['merge']({},_0x583c22,_0x47e761[_0xc6a6('0x4c')]);return _0x5cb06b[_0xc6a6('0x75')](_0x583c22);}})[_0xc6a6('0x28')](function(_0x36e56e){if(_0x36e56e){_0x2adee4=_0x36e56e['length'];if(!_0x47e761[_0xc6a6('0x36')]['hasOwnProperty'](_0xc6a6('0x3d'))){_0x583c22[_0xc6a6('0x21')]=qs['limit'](_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x21')]);_0x583c22[_0xc6a6('0x1f')]=qs[_0xc6a6('0x1f')](_0x47e761[_0xc6a6('0x36')][_0xc6a6('0x1f')]);}return _0x5cb06b[_0xc6a6('0x75')](_0x583c22);}})[_0xc6a6('0x28')](function(_0x42d721){if(_0x42d721){return _0x42d721?{'count':_0x2adee4,'rows':_0x42d721}:null;}})[_0xc6a6('0x28')](respondWithResult(_0x577360,null))[_0xc6a6('0x46')](handleError(_0x577360,null));}; \ No newline at end of file +var _0x9a23=['rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','root','server/files/sounds/converted','basename','extname','format','converted_format','symlinkSync','id2','createdAt','%s.%s','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','options','find','catch','body','create','sequelize','transaction','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync'];(function(_0x5059f8,_0x3ed44e){var _0x5695a5=function(_0x448ff6){while(--_0x448ff6){_0x5059f8['push'](_0x5059f8['shift']());}};_0x5695a5(++_0x3ed44e);}(_0x9a23,0xfe));var _0x39a2=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9a23[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39a2('0x0'));var zipdir=require(_0x39a2('0x1'));var jsonpatch=require(_0x39a2('0x2'));var rp=require(_0x39a2('0x3'));var moment=require(_0x39a2('0x4'));var BPromise=require(_0x39a2('0x5'));var Mustache=require(_0x39a2('0x6'));var util=require(_0x39a2('0x7'));var path=require(_0x39a2('0x8'));var sox=require(_0x39a2('0x9'));var csv=require('to-csv');var ejs=require(_0x39a2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39a2('0xb'));var squel=require('squel');var crypto=require(_0x39a2('0xc'));var jsforce=require(_0x39a2('0xd'));var deskjs=require(_0x39a2('0xe'));var toCsv=require(_0x39a2('0xf'));var querystring=require('querystring');var Papa=require(_0x39a2('0x10'));var Redis=require(_0x39a2('0x11'));var authService=require(_0x39a2('0x12'));var qs=require(_0x39a2('0x13'));var as=require(_0x39a2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39a2('0x15'))(_0x39a2('0x16'));var utils=require(_0x39a2('0x17'));var config=require(_0x39a2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x39a2('0x19'))['db'];function respondWithStatusCode(_0x3baafe,_0x294300){_0x294300=_0x294300||0xcc;return function(_0x5c88be){if(_0x5c88be){return _0x3baafe[_0x39a2('0x1a')](_0x294300);}return _0x3baafe['status'](_0x294300)['end']();};}function respondWithResult(_0x29b33f,_0x305545){_0x305545=_0x305545||0xc8;return function(_0x143c4f){if(_0x143c4f){return _0x29b33f['status'](_0x305545)[_0x39a2('0x1b')](_0x143c4f);}};}function respondWithFilteredResult(_0x253365,_0x159ede){return function(_0x31a9ed){if(_0x31a9ed){var _0x4a8145=typeof _0x159ede[_0x39a2('0x1c')]===_0x39a2('0x1d')&&typeof _0x159ede['limit']===_0x39a2('0x1d');var _0x1b80e0=_0x31a9ed['count'];var _0x4a0850=_0x4a8145?0x0:_0x159ede[_0x39a2('0x1c')];var _0x22aacf=_0x4a8145?_0x31a9ed[_0x39a2('0x1e')]:_0x159ede[_0x39a2('0x1c')]+_0x159ede[_0x39a2('0x1f')];var _0x305f8c;if(_0x22aacf>=_0x1b80e0){_0x22aacf=_0x1b80e0;_0x305f8c=0xc8;}else{_0x305f8c=0xce;}_0x253365[_0x39a2('0x20')](_0x305f8c);return _0x253365[_0x39a2('0x21')](_0x39a2('0x22'),_0x4a0850+'-'+_0x22aacf+'/'+_0x1b80e0)[_0x39a2('0x1b')](_0x31a9ed);}return null;};}function patchUpdates(_0x221cde){return function(_0x46ecdf){try{jsonpatch[_0x39a2('0x23')](_0x46ecdf,_0x221cde,!![]);}catch(_0x54e614){return BPromise[_0x39a2('0x24')](_0x54e614);}return _0x46ecdf['save']();};}function saveUpdates(_0x4c9f42,_0x5a6d15){return function(_0x390cd9){if(_0x390cd9){return _0x390cd9[_0x39a2('0x25')](_0x4c9f42)[_0x39a2('0x26')](function(_0xea393){return _0xea393;});}return null;};}function removeEntity(_0x3f34ea,_0x29296b){return function(_0x3dd436){if(_0x3dd436){return _0x3dd436[_0x39a2('0x27')]()[_0x39a2('0x26')](function(){var _0x4e92c7=_0x3dd436[_0x39a2('0x28')]({'plain':!![]});var _0x11b3cb=_0x39a2('0x29');return db[_0x39a2('0x2a')]['destroy']({'where':{'type':_0x11b3cb,'resourceId':_0x4e92c7['id']}})[_0x39a2('0x26')](function(){return _0x3dd436;});})['then'](function(){_0x3f34ea[_0x39a2('0x20')](0xcc)[_0x39a2('0x2b')]();});}};}function handleEntityNotFound(_0xaa42b4,_0x192e59){return function(_0xf84d21){if(!_0xf84d21){_0xaa42b4[_0x39a2('0x1a')](0x194);}return _0xf84d21;};}function handleError(_0x19a9e3,_0x4d7e28){_0x4d7e28=_0x4d7e28||0x1f4;return function(_0x4ee687){logger[_0x39a2('0x2c')](_0x4ee687['stack']);if(_0x4ee687[_0x39a2('0x2d')]){delete _0x4ee687[_0x39a2('0x2d')];}_0x19a9e3[_0x39a2('0x20')](_0x4d7e28)['send'](_0x4ee687);};}exports[_0x39a2('0x2e')]=function(_0x9aeab2,_0xf7512e){var _0x2c99ed={},_0x1cc377={},_0x3f584b={'count':0x0,'rows':[]};var _0x219137=_['map'](db[_0x39a2('0x2f')][_0x39a2('0x30')],function(_0x58a68c){return{'name':_0x58a68c[_0x39a2('0x31')],'type':_0x58a68c[_0x39a2('0x32')][_0x39a2('0x33')]};});_0x1cc377[_0x39a2('0x34')]=_[_0x39a2('0x35')](_0x219137,'name');_0x1cc377['query']=_['keys'](_0x9aeab2[_0x39a2('0x36')]);_0x1cc377[_0x39a2('0x37')]=_['intersection'](_0x1cc377[_0x39a2('0x34')],_0x1cc377[_0x39a2('0x36')]);_0x2c99ed[_0x39a2('0x38')]=_[_0x39a2('0x39')](_0x1cc377[_0x39a2('0x34')],qs[_0x39a2('0x3a')](_0x9aeab2[_0x39a2('0x36')]['fields']));_0x2c99ed['attributes']=_0x2c99ed[_0x39a2('0x38')][_0x39a2('0x3b')]?_0x2c99ed[_0x39a2('0x38')]:_0x1cc377[_0x39a2('0x34')];if(!_0x9aeab2[_0x39a2('0x36')][_0x39a2('0x3c')](_0x39a2('0x3d'))){_0x2c99ed[_0x39a2('0x1f')]=qs[_0x39a2('0x1f')](_0x9aeab2['query'][_0x39a2('0x1f')]);_0x2c99ed['offset']=qs[_0x39a2('0x1c')](_0x9aeab2[_0x39a2('0x36')]['offset']);}_0x2c99ed['order']=qs[_0x39a2('0x3e')](_0x9aeab2[_0x39a2('0x36')][_0x39a2('0x3e')]);delete _0x9aeab2[_0x39a2('0x36')]['sort'];_0x2c99ed['where']=qs['filters'](_[_0x39a2('0x3f')](_0x9aeab2['query'],_0x1cc377[_0x39a2('0x37')]),_0x219137);if(_0x9aeab2[_0x39a2('0x36')][_0x39a2('0x40')]){_0x2c99ed[_0x39a2('0x41')]=_[_0x39a2('0x42')](_0x2c99ed['where'],{'$or':_[_0x39a2('0x35')](_0x219137,function(_0x2edcbb){if(_0x2edcbb['type']!==_0x39a2('0x43')){var _0x7ff00f={};_0x7ff00f[_0x2edcbb['name']]={'$like':'%'+_0x9aeab2[_0x39a2('0x36')][_0x39a2('0x40')]+'%'};return _0x7ff00f;}})});}_0x2c99ed=_['merge']({},_0x2c99ed,_0x9aeab2['options']);var _0x4653ef={'where':_0x2c99ed[_0x39a2('0x41')]};return db['VoiceMusicOnHold'][_0x39a2('0x1e')](_0x4653ef)[_0x39a2('0x26')](function(_0x765495){_0x3f584b['count']=_0x765495;if(_0x9aeab2[_0x39a2('0x36')]['includeAll']){_0x2c99ed[_0x39a2('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x39a2('0x45')](_0x2c99ed);})[_0x39a2('0x26')](function(_0x1ac944){_0x3f584b[_0x39a2('0x46')]=_0x1ac944;return _0x3f584b;})[_0x39a2('0x26')](respondWithFilteredResult(_0xf7512e,_0x2c99ed))['catch'](handleError(_0xf7512e,null));};exports[_0x39a2('0x47')]=function(_0x506f2c,_0x5dd688){var _0x555a31={'raw':![],'where':{'id':_0x506f2c[_0x39a2('0x48')]['id']}},_0x4d88c2={};_0x4d88c2[_0x39a2('0x34')]=_[_0x39a2('0x49')](db[_0x39a2('0x2f')][_0x39a2('0x30')]);_0x4d88c2[_0x39a2('0x36')]=_[_0x39a2('0x49')](_0x506f2c[_0x39a2('0x36')]);_0x4d88c2['filters']=_[_0x39a2('0x39')](_0x4d88c2[_0x39a2('0x34')],_0x4d88c2[_0x39a2('0x36')]);_0x555a31[_0x39a2('0x38')]=_[_0x39a2('0x39')](_0x4d88c2[_0x39a2('0x34')],qs[_0x39a2('0x3a')](_0x506f2c[_0x39a2('0x36')][_0x39a2('0x3a')]));_0x555a31[_0x39a2('0x38')]=_0x555a31[_0x39a2('0x38')][_0x39a2('0x3b')]?_0x555a31[_0x39a2('0x38')]:_0x4d88c2[_0x39a2('0x34')];if(_0x506f2c['query'][_0x39a2('0x4a')]){_0x555a31[_0x39a2('0x44')]=[{'all':!![]}];}_0x555a31=_[_0x39a2('0x42')]({},_0x555a31,_0x506f2c[_0x39a2('0x4b')]);return db['VoiceMusicOnHold'][_0x39a2('0x4c')](_0x555a31)[_0x39a2('0x26')](handleEntityNotFound(_0x5dd688,null))[_0x39a2('0x26')](respondWithResult(_0x5dd688,null))[_0x39a2('0x4d')](handleError(_0x5dd688,null));};exports[_0x39a2('0x25')]=function(_0x3a3a45,_0x24669d){if(_0x3a3a45[_0x39a2('0x4e')]['id']){delete _0x3a3a45[_0x39a2('0x4e')]['id'];}return db[_0x39a2('0x2f')][_0x39a2('0x4c')]({'where':{'id':_0x3a3a45['params']['id']}})[_0x39a2('0x26')](handleEntityNotFound(_0x24669d,null))[_0x39a2('0x26')](saveUpdates(_0x3a3a45[_0x39a2('0x4e')],null))[_0x39a2('0x26')](respondWithResult(_0x24669d,null))['catch'](handleError(_0x24669d,null));};exports[_0x39a2('0x4f')]=function(_0x3f5711,_0x24d0f1,_0x582d00){return db[_0x39a2('0x50')][_0x39a2('0x51')](function(_0x26a5f8){if(_0x3f5711[_0x39a2('0x4e')][_0x39a2('0x52')]===_0x39a2('0x53')){_0x3f5711[_0x39a2('0x4e')][_0x39a2('0x54')]=path[_0x39a2('0x55')](config['root'],_0x39a2('0x56'),_0x3f5711[_0x39a2('0x4e')][_0x39a2('0x2d')]);}return db['VoiceMusicOnHold'][_0x39a2('0x4f')](_0x3f5711[_0x39a2('0x4e')],{'transaction':_0x26a5f8})[_0x39a2('0x26')](function(_0xc76474){if(_0x3f5711[_0x39a2('0x4e')][_0x39a2('0x52')]===_0x39a2('0x53')){fs[_0x39a2('0x57')](_0xc76474[_0x39a2('0x54')],parseInt(_0x39a2('0x58'),0x8));}var _0x733ea7=_0x3f5711[_0x39a2('0x59')][_0x39a2('0x28')]({'plain':!![]});if(!_0x733ea7)throw new Error(_0x39a2('0x5a'));if(_0x733ea7[_0x39a2('0x5b')]==='user'){var _0x45d430=_0xc76474['get']({'plain':!![]});return db[_0x39a2('0x5c')][_0x39a2('0x4c')]({'where':{'name':'MusicOnHolds','userProfileId':_0x733ea7['userProfileId']},'raw':!![]})['then'](function(_0x562d5a){if(_0x562d5a&&_0x562d5a[_0x39a2('0x5d')]===0x0){return db[_0x39a2('0x2a')][_0x39a2('0x4f')]({'name':_0x45d430['name'],'resourceId':_0x45d430['id'],'type':_0x562d5a[_0x39a2('0x2d')],'sectionId':_0x562d5a['id']},{})['then'](function(){return _0xc76474;});}else{return _0xc76474;}})[_0x39a2('0x4d')](function(_0x2436ed){logger[_0x39a2('0x2c')](_0x39a2('0x5e'),_0x2436ed);});}return _0xc76474;});})['then'](respondWithResult(_0x24d0f1,0xc9))[_0x39a2('0x4d')](handleError(_0x24d0f1,null));};exports[_0x39a2('0x27')]=function(_0x2a0a7d,_0x4fee31,_0x2e99d4){var _0x4b81e8;return db[_0x39a2('0x2f')][_0x39a2('0x4c')]({'where':{'id':_0x2a0a7d[_0x39a2('0x48')]['id']}})[_0x39a2('0x26')](function(_0x29a0e8){if(_0x29a0e8){return db[_0x39a2('0x50')][_0x39a2('0x51')](function(_0x82ba7c){return _0x29a0e8['destroy']({'transaction':_0x82ba7c,'raw':!![]})[_0x39a2('0x26')](function(_0x308e50){if(_0x308e50[_0x39a2('0x54')]){fs[_0x39a2('0x5f')](_0x308e50[_0x39a2('0x54')])['forEach'](function(_0x138d4d){fs[_0x39a2('0x60')](path[_0x39a2('0x55')](_0x308e50[_0x39a2('0x54')],_0x138d4d));});fs[_0x39a2('0x61')](_0x308e50[_0x39a2('0x54')]);}return _0x308e50;});})[_0x39a2('0x4d')](function(_0x39cbf8){throw new db[(_0x39a2('0x62'))][(_0x39a2('0x63'))](_0x39cbf8[_0x39a2('0x64')]);});}})[_0x39a2('0x26')](handleEntityNotFound(_0x4fee31,null))['then'](removeEntity(_0x4fee31,null))[_0x39a2('0x4d')](handleError(_0x4fee31,null));};exports['addSound']=function(_0x5564ba,_0x3ac6a1,_0x2b281e){return db['sequelize'][_0x39a2('0x51')](function(_0x141e0d){var _0xe57ac5;return db[_0x39a2('0x2f')][_0x39a2('0x4c')]({'where':{'id':_0x5564ba['params']['id']}})[_0x39a2('0x26')](function(_0x461b16){if(_0x461b16){_0xe57ac5=_0x461b16;return _0x461b16[_0x39a2('0x65')](_0x5564ba['body']['id'],{'transaction':_0x141e0d});}})[_0x39a2('0x26')](function(_0x12ff73){if(_0x12ff73){return db[_0x39a2('0x66')][_0x39a2('0x67')]({'where':{'id':_0x5564ba[_0x39a2('0x4e')]['id']},'attributes':['id',_0x39a2('0x2d'),_0x39a2('0x68'),'converted_format','createdAt'],'raw':!![]});}})[_0x39a2('0x26')](function(_0xd246f6){if(_0xd246f6){var _0x491dc4=path[_0x39a2('0x55')](config[_0x39a2('0x69')],_0x39a2('0x6a'),util['format']('%s.%s',path[_0x39a2('0x6b')](_0xd246f6[_0x39a2('0x68')],path[_0x39a2('0x6c')](_0xd246f6[_0x39a2('0x68')])),_0xd246f6['converted_format']));var _0x156975=path['join'](config[_0x39a2('0x69')],_0x39a2('0x56'),_0xe57ac5['name'],util[_0x39a2('0x6d')]('%s.%s',_0xd246f6[_0x39a2('0x2d')],_0xd246f6[_0x39a2('0x6e')]));fs[_0x39a2('0x6f')](_0x491dc4,_0x156975);return _0xd246f6;}})[_0x39a2('0x4d')](function(_0x110df2){throw new db[(_0x39a2('0x62'))]['ValidationError'](_0x110df2[_0x39a2('0x64')]);});})[_0x39a2('0x26')](handleEntityNotFound(_0x3ac6a1,null))[_0x39a2('0x26')](respondWithResult(_0x3ac6a1,0xc9))[_0x39a2('0x4d')](handleError(_0x3ac6a1,null));};exports['removeSound']=function(_0xcda190,_0x576c3a,_0x1adf1d){return db[_0x39a2('0x50')]['transaction'](function(_0xe50d3b){var _0x522308;return db['VoiceMusicOnHold'][_0x39a2('0x67')]({'where':{'id':_0xcda190[_0x39a2('0x48')]['id']}})[_0x39a2('0x26')](handleEntityNotFound(_0x576c3a,null))[_0x39a2('0x26')](function(_0xe91975){if(_0xe91975){_0x522308=_0xe91975;return _0xe91975['removeSound'](_0xcda190['params'][_0x39a2('0x70')]);}})[_0x39a2('0x26')](function(_0x2be543){if(_0x2be543){return db[_0x39a2('0x66')][_0x39a2('0x67')]({'where':{'id':_0xcda190['params']['id2']},'attributes':['id','name','save_name',_0x39a2('0x6e'),_0x39a2('0x71')],'raw':!![]});}})['then'](function(_0x5db9da){if(_0x5db9da){fs[_0x39a2('0x60')](path[_0x39a2('0x55')](_0x522308['directory'],util['format'](_0x39a2('0x72'),_0x5db9da[_0x39a2('0x2d')],_0x5db9da['converted_format'])));return _0x5db9da;}})['catch'](function(_0x598e7f){throw new db[(_0x39a2('0x62'))][(_0x39a2('0x63'))](_0x598e7f[_0x39a2('0x64')]);});})[_0x39a2('0x26')](handleEntityNotFound(_0x576c3a,null))[_0x39a2('0x26')](respondWithStatusCode(_0x576c3a,0xcc))[_0x39a2('0x4d')](handleError(_0x576c3a,null));};exports[_0x39a2('0x73')]=function(_0x4d29d5,_0xa821d1,_0x31c32f){var _0x474b1d={};var _0xc3d159={};var _0x1bde8d;var _0x569638;return db[_0x39a2('0x2f')]['findOne']({'where':{'id':_0x4d29d5[_0x39a2('0x48')]['id']}})[_0x39a2('0x26')](handleEntityNotFound(_0xa821d1,null))[_0x39a2('0x26')](function(_0x35aa47){if(_0x35aa47){_0x1bde8d=_0x35aa47;_0xc3d159['model']=_['keys'](db[_0x39a2('0x66')][_0x39a2('0x30')]);_0xc3d159[_0x39a2('0x36')]=_[_0x39a2('0x49')](_0x4d29d5['query']);_0xc3d159[_0x39a2('0x37')]=_['intersection'](_0xc3d159[_0x39a2('0x34')],_0xc3d159[_0x39a2('0x36')]);_0x474b1d['attributes']=_[_0x39a2('0x39')](_0xc3d159['model'],qs['fields'](_0x4d29d5[_0x39a2('0x36')][_0x39a2('0x3a')]));_0x474b1d[_0x39a2('0x38')]=_0x474b1d[_0x39a2('0x38')]['length']?_0x474b1d[_0x39a2('0x38')]:_0xc3d159[_0x39a2('0x34')];_0x474b1d[_0x39a2('0x74')]=qs[_0x39a2('0x3e')](_0x4d29d5['query'][_0x39a2('0x3e')]);_0x474b1d[_0x39a2('0x41')]=qs[_0x39a2('0x37')](_['pick'](_0x4d29d5[_0x39a2('0x36')],_0xc3d159[_0x39a2('0x37')]));if(_0x4d29d5[_0x39a2('0x36')]['filter']){_0x474b1d[_0x39a2('0x41')]=_[_0x39a2('0x42')](_0x474b1d['where'],{'$or':_[_0x39a2('0x35')](_0x474b1d['attributes'],function(_0x48fba7){var _0x4d6c63={};_0x4d6c63[_0x48fba7]={'$like':'%'+_0x4d29d5[_0x39a2('0x36')][_0x39a2('0x40')]+'%'};return _0x4d6c63;})});}_0x474b1d=_['merge']({},_0x474b1d,_0x4d29d5[_0x39a2('0x4b')]);return _0x1bde8d['getSounds'](_0x474b1d);}})[_0x39a2('0x26')](function(_0x5b5a0d){if(_0x5b5a0d){_0x569638=_0x5b5a0d[_0x39a2('0x3b')];if(!_0x4d29d5['query'][_0x39a2('0x3c')](_0x39a2('0x3d'))){_0x474b1d[_0x39a2('0x1f')]=qs[_0x39a2('0x1f')](_0x4d29d5['query'][_0x39a2('0x1f')]);_0x474b1d[_0x39a2('0x1c')]=qs[_0x39a2('0x1c')](_0x4d29d5[_0x39a2('0x36')][_0x39a2('0x1c')]);}return _0x1bde8d[_0x39a2('0x73')](_0x474b1d);}})[_0x39a2('0x26')](function(_0xfe9f4c){if(_0xfe9f4c){return _0xfe9f4c?{'count':_0x569638,'rows':_0xfe9f4c}:null;}})[_0x39a2('0x26')](respondWithResult(_0xa821d1,null))[_0x39a2('0x4d')](handleError(_0xa821d1,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 5574b1b..2d9a69a 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 _0xb7d6=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x305d8c,_0x153576){var _0x1e6143=function(_0x30913b){while(--_0x30913b){_0x305d8c['push'](_0x305d8c['shift']());}};_0x1e6143(++_0x153576);}(_0xb7d6,0x69));var _0x6b7d=function(_0x1eb186,_0x3e8197){_0x1eb186=_0x1eb186-0x0;var _0x49079e=_0xb7d6[_0x1eb186];return _0x49079e;};'use strict';var _=require(_0x6b7d('0x0'));var util=require(_0x6b7d('0x1'));var logger=require(_0x6b7d('0x2'))(_0x6b7d('0x3'));var moment=require(_0x6b7d('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b7d('0x5'));var fs=require('fs');var path=require(_0x6b7d('0x6'));var rimraf=require(_0x6b7d('0x7'));var config=require(_0x6b7d('0x8'));var attributes=require(_0x6b7d('0x9'));module[_0x6b7d('0xa')]=function(_0x243b83,_0x3b9223){return _0x243b83[_0x6b7d('0xb')](_0x6b7d('0xc'),attributes,{'tableName':_0x6b7d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x041d=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x041d,0xce));var _0xd041=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x041d[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xd041('0x0'));var util=require('util');var logger=require(_0xd041('0x1'))('api');var moment=require(_0xd041('0x2'));var BPromise=require('bluebird');var rp=require(_0xd041('0x3'));var fs=require('fs');var path=require(_0xd041('0x4'));var rimraf=require(_0xd041('0x5'));var config=require(_0xd041('0x6'));var attributes=require(_0xd041('0x7'));module['exports']=function(_0x3cefa7,_0x1acf89){return _0x3cefa7[_0xd041('0x8')](_0xd041('0x9'),attributes,{'tableName':_0xd041('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index fc51874..948862d 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1733ef,_0x2df58c){var _0x136b10=function(_0x18af3c){while(--_0x18af3c){_0x1733ef['push'](_0x1733ef['shift']());}};_0x136b10(++_0x2df58c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3ef942,_0xdd102b){var _0x45dd14=function(_0xfd1e91){while(--_0xfd1e91){_0x3ef942['push'](_0x3ef942['shift']());}};_0x45dd14(++_0xdd102b);}(_0xe706,0xa3));var _0x6e70=function(_0x2808d0,_0x221a9f){_0x2808d0=_0x2808d0-0x0;var _0x3aef7c=_0xe706[_0x2808d0];return _0x3aef7c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 121317a..cf34cea 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 _0x46f4=['addTeams','put','update','delete','destroy','removeAgents','removeTeams','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents'];(function(_0x4b1c4d,_0xaa863e){var _0x23a8f9=function(_0x126508){while(--_0x126508){_0x4b1c4d['push'](_0x4b1c4d['shift']());}};_0x23a8f9(++_0xaa863e);}(_0x46f4,0x115));var _0x446f=function(_0x34061b,_0x404908){_0x34061b=_0x34061b-0x0;var _0x3540ff=_0x46f4[_0x34061b];return _0x3540ff;};'use strict';var multer=require(_0x446f('0x0'));var util=require(_0x446f('0x1'));var path=require(_0x446f('0x2'));var timeout=require(_0x446f('0x3'));var express=require(_0x446f('0x4'));var router=express[_0x446f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x446f('0x6'));var interaction=require(_0x446f('0x7'));var config=require('../../config/environment');var controller=require(_0x446f('0x8'));router['get']('/',auth[_0x446f('0x9')](),controller[_0x446f('0xa')]);router[_0x446f('0xb')](_0x446f('0xc'),auth[_0x446f('0x9')](),controller[_0x446f('0xd')]);router[_0x446f('0xb')](_0x446f('0xe'),auth[_0x446f('0x9')](),controller[_0x446f('0xf')]);router[_0x446f('0xb')](_0x446f('0x10'),auth[_0x446f('0x9')](),controller[_0x446f('0x11')]);router[_0x446f('0xb')](_0x446f('0x12'),auth[_0x446f('0x9')](),controller[_0x446f('0x13')]);router[_0x446f('0x14')]('/',auth['isAuthenticated'](),controller[_0x446f('0x15')]);router[_0x446f('0x14')](_0x446f('0x10'),auth[_0x446f('0x9')](),controller[_0x446f('0x16')]);router[_0x446f('0x14')](_0x446f('0x12'),auth[_0x446f('0x9')](),controller[_0x446f('0x17')]);router[_0x446f('0x18')]('/:id',auth[_0x446f('0x9')](),controller[_0x446f('0x19')]);router[_0x446f('0x1a')](_0x446f('0xe'),auth[_0x446f('0x9')](),controller[_0x446f('0x1b')]);router[_0x446f('0x1a')](_0x446f('0x10'),auth[_0x446f('0x9')](),controller[_0x446f('0x1c')]);router[_0x446f('0x1a')](_0x446f('0x12'),auth[_0x446f('0x9')](),controller[_0x446f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe5d5=['index','/describe','describe','/:id','show','/:id/users','getAgents','getTeams','post','/:id/teams','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x1035ab,_0x2f9249){var _0x451ef1=function(_0x179cbb){while(--_0x179cbb){_0x1035ab['push'](_0x1035ab['shift']());}};_0x451ef1(++_0x2f9249);}(_0xe5d5,0x156));var _0x5e5d=function(_0x108812,_0xb6d16c){_0x108812=_0x108812-0x0;var _0x2d8133=_0xe5d5[_0x108812];return _0x2d8133;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var fs_extra=require(_0x5e5d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5e5d('0x3'));var config=require(_0x5e5d('0x4'));var controller=require(_0x5e5d('0x5'));router[_0x5e5d('0x6')]('/',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x8')]);router[_0x5e5d('0x6')](_0x5e5d('0x9'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xa')]);router[_0x5e5d('0x6')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xc')]);router['get'](_0x5e5d('0xd'),auth['isAuthenticated'](),controller[_0x5e5d('0xe')]);router[_0x5e5d('0x6')]('/:id/teams',auth[_0x5e5d('0x7')](),controller[_0x5e5d('0xf')]);router[_0x5e5d('0x10')]('/',auth[_0x5e5d('0x7')](),controller['create']);router['post'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller['addAgents']);router[_0x5e5d('0x10')](_0x5e5d('0x11'),auth['isAuthenticated'](),controller[_0x5e5d('0x12')]);router[_0x5e5d('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x5e5d('0x14')](_0x5e5d('0xb'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x15')]);router['delete'](_0x5e5d('0xd'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x16')]);router[_0x5e5d('0x14')](_0x5e5d('0x11'),auth[_0x5e5d('0x7')](),controller[_0x5e5d('0x17')]);module[_0x5e5d('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 8c7428a..a8a00de 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 _0xd782=['STRING','name','VIRTUAL','system-','getDataValue','sequelize'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xd782,0xf5));var _0x2d78=function(_0x1f21ee,_0x27fd27){_0x1f21ee=_0x1f21ee-0x0;var _0x4cdc25=_0xd782[_0x1f21ee];return _0x4cdc25;};'use strict';var Sequelize=require(_0x2d78('0x0'));module['exports']={'name':{'type':Sequelize[_0x2d78('0x1')],'allowNull':![],'unique':_0x2d78('0x2')},'prefix':{'type':Sequelize[_0x2d78('0x3')],'get':function(_0x213340){return _0x2d78('0x4')+this[_0x2d78('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0x2d78('0x1')]},'callerIdAll':{'type':Sequelize[_0x2d78('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x383c=['name','VIRTUAL','system-','getDataValue','INTEGER','sequelize','exports','STRING'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x383c,0x1a5));var _0xc383=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x383c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xc383('0x0'));module[_0xc383('0x1')]={'name':{'type':Sequelize[_0xc383('0x2')],'allowNull':![],'unique':_0xc383('0x3')},'prefix':{'type':Sequelize[_0xc383('0x4')],'get':function(_0x51622b){return _0xc383('0x5')+this[_0xc383('0x6')](_0xc383('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc383('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index fd96981..746fb59 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 _0x8952=['rawAttributes','fieldName','type','map','keys','filters','intersection','query','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','params','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','context','from-sip','exten','system','Voice\x20Prefix\x20Extension','prefix','Voice\x20Prefix','VoicePrefixId','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','findAll','Agents','online','interface','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','forEach','select','field','from','team_has_voice_prefixes','join','user_has_teams','VoicePrefixId\x20=\x20?','every','includes','all','union','compact','value','removeTeams','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','VoicePrefixes','error','stack','name','send','index','VoicePrefix'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0x8952,0x17e));var _0x2895=function(_0x53a061,_0x57cadb){_0x53a061=_0x53a061-0x0;var _0x28e26b=_0x8952[_0x53a061];return _0x28e26b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];config[_0x2895('0x15')]=_['defaults'](config[_0x2895('0x15')],{'host':_0x2895('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2895('0x17'))[_0x2895('0x18')](socket);function respondWithStatusCode(_0x5777a0,_0x2198c3){_0x2198c3=_0x2198c3||0xcc;return function(_0xd8192e){if(_0xd8192e){return _0x5777a0[_0x2895('0x19')](_0x2198c3);}return _0x5777a0[_0x2895('0x1a')](_0x2198c3)[_0x2895('0x1b')]();};}function respondWithResult(_0x2627e6,_0x6a5c7e){_0x6a5c7e=_0x6a5c7e||0xc8;return function(_0x31bb7f){if(_0x31bb7f){return _0x2627e6[_0x2895('0x1a')](_0x6a5c7e)[_0x2895('0x1c')](_0x31bb7f);}};}function respondWithFilteredResult(_0x10a1bf,_0x183b05){return function(_0xbf8b63){if(_0xbf8b63){var _0x2cb505=typeof _0x183b05[_0x2895('0x1d')]===_0x2895('0x1e')&&typeof _0x183b05[_0x2895('0x1f')]===_0x2895('0x1e');var _0x5a8eab=_0xbf8b63['count'];var _0x493851=_0x2cb505?0x0:_0x183b05[_0x2895('0x1d')];var _0x12c2fb=_0x2cb505?_0xbf8b63[_0x2895('0x20')]:_0x183b05['offset']+_0x183b05[_0x2895('0x1f')];var _0x190b79;if(_0x12c2fb>=_0x5a8eab){_0x12c2fb=_0x5a8eab;_0x190b79=0xc8;}else{_0x190b79=0xce;}_0x10a1bf[_0x2895('0x1a')](_0x190b79);return _0x10a1bf[_0x2895('0x21')](_0x2895('0x22'),_0x493851+'-'+_0x12c2fb+'/'+_0x5a8eab)['json'](_0xbf8b63);}return null;};}function patchUpdates(_0x30c6c3){return function(_0x5e93a4){try{jsonpatch['apply'](_0x5e93a4,_0x30c6c3,!![]);}catch(_0x142e58){return BPromise[_0x2895('0x23')](_0x142e58);}return _0x5e93a4[_0x2895('0x24')]();};}function saveUpdates(_0x511286,_0x4e884f){return function(_0x3a72fa){if(_0x3a72fa){return _0x3a72fa[_0x2895('0x25')](_0x511286)[_0x2895('0x26')](function(_0x4a21cf){return _0x4a21cf;});}return null;};}function removeEntity(_0x3d3320,_0x3690ce){return function(_0x480604){if(_0x480604){return _0x480604[_0x2895('0x27')]()[_0x2895('0x26')](function(){var _0x2cd4df=_0x480604['get']({'plain':!![]});var _0x320661=_0x2895('0x28');return db['UserProfileResource'][_0x2895('0x27')]({'where':{'type':_0x320661,'resourceId':_0x2cd4df['id']}})['then'](function(){return _0x480604;});})['then'](function(){_0x3d3320[_0x2895('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa4f85,_0x381538){return function(_0x4fdd94){if(!_0x4fdd94){_0xfa4f85['sendStatus'](0x194);}return _0x4fdd94;};}function handleError(_0x32db49,_0x30dc2f){_0x30dc2f=_0x30dc2f||0x1f4;return function(_0x190e07){logger[_0x2895('0x29')](_0x190e07[_0x2895('0x2a')]);if(_0x190e07[_0x2895('0x2b')]){delete _0x190e07[_0x2895('0x2b')];}_0x32db49['status'](_0x30dc2f)[_0x2895('0x2c')](_0x190e07);};}exports[_0x2895('0x2d')]=function(_0x3625ba,_0x5546eb){var _0x1e9c13={},_0x458a55={},_0x31ab90={'count':0x0,'rows':[]};var _0x35a2e8=_['map'](db[_0x2895('0x2e')][_0x2895('0x2f')],function(_0x4765c9){return{'name':_0x4765c9[_0x2895('0x30')],'type':_0x4765c9[_0x2895('0x31')]['key']};});_0x458a55['model']=_[_0x2895('0x32')](_0x35a2e8,_0x2895('0x2b'));_0x458a55['query']=_[_0x2895('0x33')](_0x3625ba['query']);_0x458a55[_0x2895('0x34')]=_[_0x2895('0x35')](_0x458a55['model'],_0x458a55[_0x2895('0x36')]);_0x1e9c13['attributes']=_[_0x2895('0x35')](_0x458a55['model'],qs['fields'](_0x3625ba[_0x2895('0x36')][_0x2895('0x37')]));_0x1e9c13[_0x2895('0x38')]=_0x1e9c13['attributes'][_0x2895('0x39')]?_0x1e9c13[_0x2895('0x38')]:_0x458a55[_0x2895('0x3a')];if(!_0x3625ba[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x1e9c13[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1f')]);_0x1e9c13['offset']=qs[_0x2895('0x1d')](_0x3625ba[_0x2895('0x36')][_0x2895('0x1d')]);}_0x1e9c13[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x3625ba[_0x2895('0x36')][_0x2895('0x3e')]);_0x1e9c13['where']=qs['filters'](_[_0x2895('0x3f')](_0x3625ba[_0x2895('0x36')],_0x458a55[_0x2895('0x34')]),_0x35a2e8);if(_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]){_0x1e9c13[_0x2895('0x41')]=_['merge'](_0x1e9c13['where'],{'$or':_[_0x2895('0x32')](_0x35a2e8,function(_0x20208f){if(_0x20208f['type']!=='VIRTUAL'){var _0x2a0eaf={};_0x2a0eaf[_0x20208f[_0x2895('0x2b')]]={'$like':'%'+_0x3625ba[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x2a0eaf;}})});}_0x1e9c13=_[_0x2895('0x42')]({},_0x1e9c13,_0x3625ba[_0x2895('0x43')]);var _0x5d4e23={'where':_0x1e9c13[_0x2895('0x41')]};return db[_0x2895('0x2e')][_0x2895('0x20')](_0x5d4e23)[_0x2895('0x26')](function(_0x4af6d6){_0x31ab90[_0x2895('0x20')]=_0x4af6d6;if(_0x3625ba[_0x2895('0x36')][_0x2895('0x44')]){_0x1e9c13[_0x2895('0x45')]=[{'all':!![]}];}return db['VoicePrefix']['findAll'](_0x1e9c13);})[_0x2895('0x26')](function(_0x19ce85){_0x31ab90[_0x2895('0x46')]=_0x19ce85;return _0x31ab90;})[_0x2895('0x26')](respondWithFilteredResult(_0x5546eb,_0x1e9c13))[_0x2895('0x47')](handleError(_0x5546eb,null));};exports['show']=function(_0x5bd425,_0x4b336c){var _0x28dd37={'raw':![],'where':{'id':_0x5bd425[_0x2895('0x48')]['id']}},_0x2130b2={};_0x2130b2[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x2e')]['rawAttributes']);_0x2130b2[_0x2895('0x36')]=_[_0x2895('0x33')](_0x5bd425[_0x2895('0x36')]);_0x2130b2[_0x2895('0x34')]=_[_0x2895('0x35')](_0x2130b2[_0x2895('0x3a')],_0x2130b2[_0x2895('0x36')]);_0x28dd37[_0x2895('0x38')]=_['intersection'](_0x2130b2[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x5bd425[_0x2895('0x36')]['fields']));_0x28dd37[_0x2895('0x38')]=_0x28dd37[_0x2895('0x38')]['length']?_0x28dd37[_0x2895('0x38')]:_0x2130b2[_0x2895('0x3a')];if(_0x5bd425[_0x2895('0x36')][_0x2895('0x44')]){_0x28dd37[_0x2895('0x45')]=[{'all':!![]}];}_0x28dd37=_[_0x2895('0x42')]({},_0x28dd37,_0x5bd425[_0x2895('0x43')]);return db['VoicePrefix'][_0x2895('0x49')](_0x28dd37)[_0x2895('0x26')](handleEntityNotFound(_0x4b336c,null))['then'](respondWithResult(_0x4b336c,null))['catch'](handleError(_0x4b336c,null));};exports['destroy']=function(_0x212a1f,_0xe552b6){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x212a1f[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0xe552b6,null))[_0x2895('0x26')](removeEntity(_0xe552b6,null))[_0x2895('0x47')](handleError(_0xe552b6,null));};exports[_0x2895('0x4a')]=function(_0x3d043c,_0x45302c){return db[_0x2895('0x2e')][_0x2895('0x4a')]()[_0x2895('0x26')](respondWithResult(_0x45302c,null))[_0x2895('0x47')](handleError(_0x45302c,null));};exports[_0x2895('0x4b')]=function(_0x2116a6,_0x3e0fde){var _0xbcf98;return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x90ed5d){return db[_0x2895('0x2e')][_0x2895('0x4b')](_0x2116a6[_0x2895('0x4e')],{'transaction':_0x90ed5d})[_0x2895('0x26')](function(_0x16ff3d){_0xbcf98=_0x16ff3d[_0x2895('0x4f')]({'plain':!![]});return db[_0x2895('0x50')][_0x2895('0x49')]({'where':{'id':_0xbcf98[_0x2895('0x51')]},'raw':!![]})['then'](function(_0xbc538a){return createVoicePrefixExtensions(_0xbcf98,_0xbc538a,_0x90ed5d);});});})[_0x2895('0x26')](function(){var _0x2bc573=_0x2116a6[_0x2895('0x52')][_0x2895('0x4f')]({'plain':!![]});if(!_0x2bc573)throw new Error(_0x2895('0x53'));if(_0x2bc573['role']===_0x2895('0x52')){var _0x5579b3=_0xbcf98;return db[_0x2895('0x54')][_0x2895('0x49')]({'where':{'name':_0x2895('0x28'),'userProfileId':_0x2bc573[_0x2895('0x55')]},'raw':!![]})[_0x2895('0x26')](function(_0x56a2c0){if(_0x56a2c0&&_0x56a2c0['autoAssociation']===0x0){return db[_0x2895('0x56')][_0x2895('0x4b')]({'name':_0x5579b3[_0x2895('0x2b')],'resourceId':_0x5579b3['id'],'type':_0x56a2c0['name'],'sectionId':_0x56a2c0['id']},{})[_0x2895('0x26')](function(){return _0xbcf98;});}else{return _0xbcf98;}})['catch'](function(_0x3c1f50){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c1f50);throw _0x3c1f50;});}return _0xbcf98;})['then'](respondWithResult(_0x3e0fde,null))['catch'](handleError(_0x3e0fde,null));};function Extension(_0x36177d,_0x2ff725,_0x402e00,_0x4336c){this[_0x2895('0x57')]=_0x2895('0x58');this[_0x2895('0x59')]=_0x36177d;this['app']=_0x402e00;this[_0x2895('0x31')]=_0x2895('0x5a');this['description']=_0x2895('0x5b');this['priority']=_0x2ff725;this['appdata']=_0x4336c;}function createVoicePrefixExtensions(_0x2a9194,_0x14d7f9,_0x50299a){return new BPromise(function(_0xf5be,_0x3c5e32){var _0x35d979=new Extension(formatPrefixName(_0x2a9194[_0x2895('0x5c')]),0x1,'NoOp',_0x2895('0x5d'));_0x35d979['VoicePrefixId']=_0x2a9194['id'];return db[_0x2895('0x50')]['create'](_0x35d979,{'transaction':_0x50299a})['then'](function(_0x1af031){var _0x58f96a=_0x1af031[_0x2895('0x4f')]({'plain':!![]});var _0x39a28b=_[_0x2895('0x32')](addVoicePrefixExtensions(_0x2a9194,_0x14d7f9),function(_0x559ef3){_0x559ef3[_0x2895('0x51')]=_0x58f96a['id'];_0x559ef3[_0x2895('0x5e')]=_0x2a9194['id'];return _0x559ef3;});return db['VoiceExtension']['bulkCreate'](_0x39a28b,{'transaction':_0x50299a})[_0x2895('0x26')](function(_0x347445){if(!_0x347445){return _0x3c5e32('Extensions\x20creation\x20failed');}else{return _0xf5be(_0x347445);}})[_0x2895('0x47')](function(_0x53f9d8){return _0x3c5e32(_0x53f9d8);});});;});};function addVoicePrefixExtensions(_0x567520,_0x98b64d){var _0x3241cb=[];var _0x16b39c=formatPrefixName(_0x567520['prefix']);_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x2,_0x2895('0x60'),_0x2895('0x61')+_0x567520[_0x2895('0x2b')]));if(_0x567520[_0x2895('0x62')]){_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x60'),'PREFIX-CALLERIDALL='+_0x567520[_0x2895('0x62')]));}else{_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x3,_0x2895('0x63'),_0x2895('0x64')));}_0x3241cb[_0x2895('0x5f')](new Extension(_0x16b39c,0x4,_0x2895('0x65'),_0x98b64d[_0x2895('0x57')]+','+_0x2895('0x66')+(0x8+_0x567520['name'][_0x2895('0x39')])+'}'+','+0x1));return _0x3241cb;}function formatPrefixName(_0x354718){var _0x16f369='_';for(var _0x2288ff=0x0;_0x2288ff<_0x354718[_0x2895('0x39')];_0x2288ff++){if(_0x354718[_0x2895('0x67')](_0x2288ff)=='-'){_0x16f369+=_0x354718[_0x2895('0x67')](_0x2288ff);}else{_0x16f369+='['+_0x354718[_0x2895('0x67')](_0x2288ff)+']';}}_0x16f369+='.';return _0x16f369;}exports[_0x2895('0x25')]=function(_0x2862aa,_0x53a270,_0x477385){var _0x1a2045=_0x2862aa[_0x2895('0x4e')];_0x1a2045[_0x2895('0x5c')]=_0x2895('0x68')+_0x1a2045[_0x2895('0x2b')]+'-';return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x203609){return db[_0x2895('0x2e')]['update'](_0x1a2045,{'where':{'id':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')][_0x2895('0x27')]({'where':{'VoicePrefixId':_0x1a2045['id']},'transaction':_0x203609})[_0x2895('0x26')](function(){return db[_0x2895('0x50')]['find']({'where':{'id':_0x1a2045[_0x2895('0x51')]},'raw':!![]})[_0x2895('0x26')](function(_0x4c569e){return createVoicePrefixExtensions(_0x1a2045,_0x4c569e,_0x203609);});});});})['then'](function(){return db['VoicePrefix'][_0x2895('0x69')](_0x1a2045['id']);})[_0x2895('0x26')](respondWithResult(_0x53a270,null))[_0x2895('0x47')](handleError(_0x53a270,null));};exports[_0x2895('0x6a')]=function(_0x31e21a,_0x48c014,_0x5e6a1f){return db[_0x2895('0x2e')]['find']({'where':{'id':_0x31e21a[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x48c014,null))[_0x2895('0x26')](function(_0x3de634){if(_0x3de634){return _0x3de634['addAgents'](_0x31e21a[_0x2895('0x4e')][_0x2895('0x6b')],_[_0x2895('0x6c')](_0x31e21a[_0x2895('0x4e')],['ids','id'])||{})['spread'](function(_0x10ca0f){for(var _0x5dde20=0x0;_0x5dde20<_0x31e21a['body'][_0x2895('0x6b')][_0x2895('0x39')];_0x5dde20+=0x1){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':Number(_0x31e21a['body'][_0x2895('0x6b')][_0x5dde20]),'VoicePrefixId':Number(_0x31e21a[_0x2895('0x48')]['id'])});}return _0x10ca0f;});}})[_0x2895('0x26')](respondWithResult(_0x48c014,null))[_0x2895('0x47')](handleError(_0x48c014,null));};exports[_0x2895('0x6f')]=function(_0x45e80c,_0x21d3dd,_0x3346c2){return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x45e80c[_0x2895('0x48')]['id']}})[_0x2895('0x26')](handleEntityNotFound(_0x21d3dd,null))['then'](function(_0x1a9c84){if(_0x1a9c84){return _0x1a9c84[_0x2895('0x6f')](_0x45e80c[_0x2895('0x36')]['ids'])[_0x2895('0x26')](function(){if(_[_0x2895('0x70')](_0x45e80c['query'][_0x2895('0x6b')])){for(var _0x1693b6=0x0;_0x1693b6<_0x45e80c[_0x2895('0x36')]['ids'][_0x2895('0x39')];_0x1693b6+=0x1){socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c[_0x2895('0x36')]['ids'][_0x1693b6]),'VoicePrefixId':Number(_0x45e80c[_0x2895('0x48')]['id'])});}}else{socket[_0x2895('0x6d')](_0x2895('0x71'),{'UserId':Number(_0x45e80c['query'][_0x2895('0x6b')]),'VoicePrefixId':Number(_0x45e80c['params']['id'])});}});}})[_0x2895('0x26')](respondWithStatusCode(_0x21d3dd,null))[_0x2895('0x47')](handleError(_0x21d3dd,null));};exports[_0x2895('0x72')]=function(_0x253e07,_0x570dd9,_0x6eef86){var _0x46bbca={};var _0x413aa4={};var _0x5e892a;var _0x34898e;return db['VoicePrefix'][_0x2895('0x73')]({'where':{'id':_0x253e07[_0x2895('0x48')]['id']}})['then'](handleEntityNotFound(_0x570dd9,null))['then'](function(_0x3bd07c){if(_0x3bd07c){_0x5e892a=_0x3bd07c;_0x413aa4[_0x2895('0x3a')]=_['keys'](db[_0x2895('0x74')][_0x2895('0x2f')]);_0x413aa4['query']=_[_0x2895('0x33')](_0x253e07[_0x2895('0x36')]);_0x413aa4[_0x2895('0x34')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],_0x413aa4['query']);_0x46bbca[_0x2895('0x38')]=_[_0x2895('0x35')](_0x413aa4[_0x2895('0x3a')],qs[_0x2895('0x37')](_0x253e07[_0x2895('0x36')]['fields']));_0x46bbca[_0x2895('0x38')]=_0x46bbca[_0x2895('0x38')][_0x2895('0x39')]?_0x46bbca[_0x2895('0x38')]:_0x413aa4['model'];_0x46bbca[_0x2895('0x3d')]=qs[_0x2895('0x3e')](_0x253e07[_0x2895('0x36')][_0x2895('0x3e')]);_0x46bbca['where']=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x253e07[_0x2895('0x36')],_0x413aa4[_0x2895('0x34')]));if(_0x253e07[_0x2895('0x36')][_0x2895('0x40')]){_0x46bbca['where']=_[_0x2895('0x42')](_0x46bbca[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x46bbca['attributes'],function(_0x553af0){var _0x1ff21e={};_0x1ff21e[_0x553af0]={'$like':'%'+_0x253e07[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x1ff21e;})});}_0x46bbca=_[_0x2895('0x42')]({},_0x46bbca,_0x253e07[_0x2895('0x43')]);return _0x5e892a['getAgents'](_0x46bbca);}})[_0x2895('0x26')](function(_0x837eef){if(_0x837eef){_0x34898e=_0x837eef[_0x2895('0x39')];if(!_0x253e07['query']['hasOwnProperty'](_0x2895('0x3c'))){_0x46bbca[_0x2895('0x1f')]=qs[_0x2895('0x1f')](_0x253e07['query'][_0x2895('0x1f')]);_0x46bbca[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x253e07[_0x2895('0x36')]['offset']);}return _0x5e892a[_0x2895('0x72')](_0x46bbca);}})[_0x2895('0x26')](function(_0x71d436){if(_0x71d436){return _0x71d436?{'count':_0x34898e,'rows':_0x71d436}:null;}})[_0x2895('0x26')](respondWithResult(_0x570dd9,null))[_0x2895('0x47')](handleError(_0x570dd9,null));};exports[_0x2895('0x75')]=function(_0x3ae81f,_0x25f5c9,_0x2d6167){var _0x265c7a={};var _0x32baef={};var _0x3d2996;var _0x3d47d0;return db[_0x2895('0x2e')]['findOne']({'where':{'id':_0x3ae81f['params']['id']}})['then'](handleEntityNotFound(_0x25f5c9,null))['then'](function(_0x440fbf){if(_0x440fbf){_0x3d2996=_0x440fbf;_0x32baef[_0x2895('0x3a')]=_[_0x2895('0x33')](db[_0x2895('0x76')][_0x2895('0x2f')]);_0x32baef[_0x2895('0x36')]=_[_0x2895('0x33')](_0x3ae81f[_0x2895('0x36')]);_0x32baef[_0x2895('0x34')]=_[_0x2895('0x35')](_0x32baef[_0x2895('0x3a')],_0x32baef[_0x2895('0x36')]);_0x265c7a[_0x2895('0x38')]=_[_0x2895('0x35')](_0x32baef['model'],qs[_0x2895('0x37')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x37')]));_0x265c7a['attributes']=_0x265c7a['attributes'][_0x2895('0x39')]?_0x265c7a[_0x2895('0x38')]:_0x32baef['model'];_0x265c7a[_0x2895('0x3d')]=qs['sort'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x3e')]);_0x265c7a[_0x2895('0x41')]=qs[_0x2895('0x34')](_[_0x2895('0x3f')](_0x3ae81f[_0x2895('0x36')],_0x32baef[_0x2895('0x34')]));if(_0x3ae81f['query'][_0x2895('0x40')]){_0x265c7a[_0x2895('0x41')]=_['merge'](_0x265c7a[_0x2895('0x41')],{'$or':_[_0x2895('0x32')](_0x265c7a['attributes'],function(_0x1cf787){var _0x3c8ea2={};_0x3c8ea2[_0x1cf787]={'$like':'%'+_0x3ae81f[_0x2895('0x36')][_0x2895('0x40')]+'%'};return _0x3c8ea2;})});}_0x265c7a=_[_0x2895('0x42')]({},_0x265c7a,_0x3ae81f[_0x2895('0x43')]);return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})[_0x2895('0x26')](function(_0xdbd16a){if(_0xdbd16a){_0x3d47d0=_0xdbd16a[_0x2895('0x39')];if(!_0x3ae81f[_0x2895('0x36')][_0x2895('0x3b')](_0x2895('0x3c'))){_0x265c7a[_0x2895('0x1f')]=qs['limit'](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1f')]);_0x265c7a[_0x2895('0x1d')]=qs[_0x2895('0x1d')](_0x3ae81f[_0x2895('0x36')][_0x2895('0x1d')]);}return _0x3d2996[_0x2895('0x75')](_0x265c7a);}})['then'](function(_0x17055a){if(_0x17055a){return _0x17055a?{'count':_0x3d47d0,'rows':_0x17055a}:null;}})['then'](respondWithResult(_0x25f5c9,null))[_0x2895('0x47')](handleError(_0x25f5c9,null));};exports['addTeams']=function(_0x204af3,_0x3e2994,_0x1e85d9){var _0x53ccff=_0x204af3[_0x2895('0x4e')]['ids'];var _0x3f024f;return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x53ccff},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id',_0x2895('0x2b'),_0x2895('0x79'),'voicePause',_0x2895('0x7a')],'raw':!![]}]})[_0x2895('0x26')](function(_0x1b8f32){if(_0x1b8f32){_0x3f024f=_0x1b8f32;var _0x4b7c11=_['flatMap'](_0x1b8f32,function(_0x335da0){var _0x13e113=_0x335da0[_0x2895('0x4f')]({'plain':!![]});return _0x13e113['Agents'];});return db[_0x2895('0x2e')][_0x2895('0x49')]({'where':{'id':_0x204af3[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x1dcc85){return db[_0x2895('0x4c')][_0x2895('0x4d')](function(_0x2d6109){return _0x1dcc85[_0x2895('0x7b')](_0x53ccff,{'transaction':_0x2d6109})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x3f024f,function(_0x16ec29){return db[_0x2895('0x7d')][_0x2895('0x7e')]({'TeamId':_0x16ec29['id'],'VoicePrefixId':_0x204af3[_0x2895('0x48')]['id']},{'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){return BPromise[_0x2895('0x7c')](_0x4b7c11,function(_0x2c6df4){return db[_0x2895('0x7f')]['findOrCreate']({'where':{'UserId':_0x2c6df4['id'],'VoicePrefixId':_0x204af3['params']['id']},'transaction':_0x2d6109});});})[_0x2895('0x26')](function(){_0x4b7c11[_0x2895('0x80')](function(_0x366ca5){socket[_0x2895('0x6d')](_0x2895('0x6e'),{'UserId':_0x366ca5['id'],'VoicePrefixId':_0x1dcc85['id']});});});});});}})[_0x2895('0x26')](respondWithStatusCode(_0x3e2994,null))['catch'](handleError(_0x3e2994,null));};exports['removeTeams']=function(_0x51b96a,_0x40d48c,_0x4f0b85){return db[_0x2895('0x76')][_0x2895('0x77')]({'where':{'id':_0x51b96a[_0x2895('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2895('0x74')],'as':_0x2895('0x78'),'attributes':['id'],'raw':!![]}]})[_0x2895('0x26')](handleEntityNotFound(_0x40d48c,null))['then'](function(_0x340cb7){var _0x2458f1=_[_0x2895('0x32')](_0x340cb7,'id');var _0x2e3651=[];var _0x2187ce=[];var _0x175202=squel[_0x2895('0x81')]();_0x175202[_0x2895('0x82')]('tq.TeamId')[_0x2895('0x83')](_0x2895('0x84'),'tq')[_0x2895('0x85')](_0x2895('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2895('0x87'),_0x51b96a[_0x2895('0x48')]['id']);for(var _0x53eef2=0x0;_0x53eef2<_0x340cb7[_0x2895('0x39')];_0x53eef2+=0x1){let _0x1e2311=_0x340cb7[_0x53eef2];for(var _0x368a30=0x0;_0x368a30<_0x1e2311['Agents'][_0x2895('0x39')];_0x368a30+=0x1){let _0x2dd3d9=_0x1e2311[_0x2895('0x78')][_0x368a30];var _0x233136=_0x175202['clone']();_0x233136[_0x2895('0x41')]('ut.UserId\x20=\x20?',_0x2dd3d9['id']);_0x2187ce['push'](db['sequelize'][_0x2895('0x36')](_0x233136['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x2bbb3e){if(_0x2bbb3e[_0x2895('0x39')]===0x1){return _0x2dd3d9['id'];}else{var _0x25969b=_[_0x2895('0x88')](_['map'](_0x2bbb3e,'TeamId'),function(_0x5cc9fc){return _[_0x2895('0x89')](_0x2458f1,_0x5cc9fc);});if(_0x25969b){return _0x2dd3d9['id'];}}}));}}return BPromise[_0x2895('0x8a')](_0x2187ce)[_0x2895('0x26')](function(_0x2ccc9f){_0x2e3651=_(_0x2e3651)[_0x2895('0x8b')](_0x2ccc9f)[_0x2895('0x8c')]()[_0x2895('0x8d')]();return db[_0x2895('0x2e')]['find']({'where':{'id':_0x51b96a[_0x2895('0x48')]['id']}})[_0x2895('0x26')](function(_0x16f74a){return db['sequelize'][_0x2895('0x4d')](function(_0x5d05d3){return _0x16f74a[_0x2895('0x8e')](_0x51b96a[_0x2895('0x36')][_0x2895('0x6b')],{'transaction':_0x5d05d3})[_0x2895('0x26')](function(){if(!_['isEmpty'](_0x2e3651)){return _0x16f74a[_0x2895('0x6f')](_0x2e3651,{'transaction':_0x5d05d3});}})[_0x2895('0x26')](function(){_0x2e3651[_0x2895('0x80')](function(_0x3fb18a){socket[_0x2895('0x6d')]('userVoicePrefix:remove',{'UserId':_0x3fb18a,'VoicePrefixId':_0x16f74a['id']});});});});});});})[_0x2895('0x26')](respondWithStatusCode(_0x40d48c,null))[_0x2895('0x47')](handleError(_0x40d48c,null));}; \ No newline at end of file +var _0x34b7=['fieldName','type','key','model','keys','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','catch','fields','includeAll','find','params','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','order','getTeams','Team','addTeams','findAll','Agents','online','voicePause','interface','flatMap','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','TeamId','all','compact','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','index','map','VoicePrefix','rawAttributes'];(function(_0x5ed173,_0x278773){var _0x5ac8db=function(_0x4ef201){while(--_0x4ef201){_0x5ed173['push'](_0x5ed173['shift']());}};_0x5ac8db(++_0x278773);}(_0x34b7,0x196));var _0x734b=function(_0x1b24eb,_0x39029e){_0x1b24eb=_0x1b24eb-0x0;var _0x157b17=_0x34b7[_0x1b24eb];return _0x157b17;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];config[_0x734b('0x18')]=_[_0x734b('0x19')](config[_0x734b('0x18')],{'host':_0x734b('0x1a'),'port':0x18eb});var socket=require(_0x734b('0x1b'))(new Redis(config['redis']));require(_0x734b('0x1c'))[_0x734b('0x1d')](socket);function respondWithStatusCode(_0x47791c,_0xd1ab2a){_0xd1ab2a=_0xd1ab2a||0xcc;return function(_0x19f427){if(_0x19f427){return _0x47791c[_0x734b('0x1e')](_0xd1ab2a);}return _0x47791c[_0x734b('0x1f')](_0xd1ab2a)[_0x734b('0x20')]();};}function respondWithResult(_0xa6d111,_0x4b8c63){_0x4b8c63=_0x4b8c63||0xc8;return function(_0x42407a){if(_0x42407a){return _0xa6d111['status'](_0x4b8c63)[_0x734b('0x21')](_0x42407a);}};}function respondWithFilteredResult(_0x2ee290,_0xfb661a){return function(_0x5edbe9){if(_0x5edbe9){var _0x4d3b9c=typeof _0xfb661a['offset']===_0x734b('0x22')&&typeof _0xfb661a[_0x734b('0x23')]===_0x734b('0x22');var _0x41ba87=_0x5edbe9[_0x734b('0x24')];var _0xfe567d=_0x4d3b9c?0x0:_0xfb661a[_0x734b('0x25')];var _0x6572ee=_0x4d3b9c?_0x5edbe9[_0x734b('0x24')]:_0xfb661a[_0x734b('0x25')]+_0xfb661a[_0x734b('0x23')];var _0x3d0ffd;if(_0x6572ee>=_0x41ba87){_0x6572ee=_0x41ba87;_0x3d0ffd=0xc8;}else{_0x3d0ffd=0xce;}_0x2ee290[_0x734b('0x1f')](_0x3d0ffd);return _0x2ee290[_0x734b('0x26')]('Content-Range',_0xfe567d+'-'+_0x6572ee+'/'+_0x41ba87)[_0x734b('0x21')](_0x5edbe9);}return null;};}function patchUpdates(_0x7856d7){return function(_0x4f98a7){try{jsonpatch[_0x734b('0x27')](_0x4f98a7,_0x7856d7,!![]);}catch(_0x1f81de){return BPromise[_0x734b('0x28')](_0x1f81de);}return _0x4f98a7[_0x734b('0x29')]();};}function saveUpdates(_0x46d432,_0x26d118){return function(_0x26eccf){if(_0x26eccf){return _0x26eccf[_0x734b('0x2a')](_0x46d432)[_0x734b('0x2b')](function(_0x3abbe6){return _0x3abbe6;});}return null;};}function removeEntity(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(_0x3bb651){return _0x3bb651['destroy']()['then'](function(){var _0x13cc5a=_0x3bb651[_0x734b('0x2c')]({'plain':!![]});var _0x47a0a9=_0x734b('0x2d');return db[_0x734b('0x2e')][_0x734b('0x2f')]({'where':{'type':_0x47a0a9,'resourceId':_0x13cc5a['id']}})[_0x734b('0x2b')](function(){return _0x3bb651;});})[_0x734b('0x2b')](function(){_0x44ffa9[_0x734b('0x1f')](0xcc)[_0x734b('0x20')]();});}};}function handleEntityNotFound(_0x5c6c5d,_0x1f3652){return function(_0x436efe){if(!_0x436efe){_0x5c6c5d[_0x734b('0x1e')](0x194);}return _0x436efe;};}function handleError(_0x241c89,_0x729431){_0x729431=_0x729431||0x1f4;return function(_0x427c36){logger[_0x734b('0x30')](_0x427c36[_0x734b('0x31')]);if(_0x427c36[_0x734b('0x32')]){delete _0x427c36[_0x734b('0x32')];}_0x241c89['status'](_0x729431)[_0x734b('0x33')](_0x427c36);};}exports[_0x734b('0x34')]=function(_0x57f792,_0xbbe037){var _0x3cfce2={},_0xf4ef21={},_0x2fe7d5={'count':0x0,'rows':[]};var _0x21cb04=_[_0x734b('0x35')](db[_0x734b('0x36')][_0x734b('0x37')],function(_0x1e53fb){return{'name':_0x1e53fb[_0x734b('0x38')],'type':_0x1e53fb[_0x734b('0x39')][_0x734b('0x3a')]};});_0xf4ef21[_0x734b('0x3b')]=_[_0x734b('0x35')](_0x21cb04,_0x734b('0x32'));_0xf4ef21['query']=_[_0x734b('0x3c')](_0x57f792['query']);_0xf4ef21[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0xf4ef21[_0x734b('0x3b')],_0xf4ef21[_0x734b('0x3f')]);_0x3cfce2[_0x734b('0x40')]=_[_0x734b('0x3e')](_0xf4ef21['model'],qs['fields'](_0x57f792[_0x734b('0x3f')]['fields']));_0x3cfce2[_0x734b('0x40')]=_0x3cfce2['attributes'][_0x734b('0x41')]?_0x3cfce2['attributes']:_0xf4ef21[_0x734b('0x3b')];if(!_0x57f792['query'][_0x734b('0x42')](_0x734b('0x43'))){_0x3cfce2[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x57f792[_0x734b('0x3f')][_0x734b('0x23')]);_0x3cfce2[_0x734b('0x25')]=qs['offset'](_0x57f792[_0x734b('0x3f')][_0x734b('0x25')]);}_0x3cfce2['order']=qs[_0x734b('0x44')](_0x57f792[_0x734b('0x3f')][_0x734b('0x44')]);_0x3cfce2[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x57f792[_0x734b('0x3f')],_0xf4ef21['filters']),_0x21cb04);if(_0x57f792[_0x734b('0x3f')][_0x734b('0x47')]){_0x3cfce2['where']=_[_0x734b('0x48')](_0x3cfce2[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x21cb04,function(_0x300aaa){if(_0x300aaa['type']!=='VIRTUAL'){var _0x2f6cee={};_0x2f6cee[_0x300aaa['name']]={'$like':'%'+_0x57f792['query'][_0x734b('0x47')]+'%'};return _0x2f6cee;}})});}_0x3cfce2=_['merge']({},_0x3cfce2,_0x57f792[_0x734b('0x49')]);var _0x4d77f0={'where':_0x3cfce2[_0x734b('0x45')]};return db[_0x734b('0x36')][_0x734b('0x24')](_0x4d77f0)['then'](function(_0x5cf3a0){_0x2fe7d5[_0x734b('0x24')]=_0x5cf3a0;if(_0x57f792['query']['includeAll']){_0x3cfce2[_0x734b('0x4a')]=[{'all':!![]}];}return db[_0x734b('0x36')]['findAll'](_0x3cfce2);})[_0x734b('0x2b')](function(_0x513f07){_0x2fe7d5[_0x734b('0x4b')]=_0x513f07;return _0x2fe7d5;})[_0x734b('0x2b')](respondWithFilteredResult(_0xbbe037,_0x3cfce2))[_0x734b('0x4c')](handleError(_0xbbe037,null));};exports['show']=function(_0xe8b116,_0x2455b9){var _0x3bca7e={'raw':![],'where':{'id':_0xe8b116['params']['id']}},_0x439139={};_0x439139['model']=_['keys'](db[_0x734b('0x36')]['rawAttributes']);_0x439139['query']=_[_0x734b('0x3c')](_0xe8b116['query']);_0x439139[_0x734b('0x3d')]=_[_0x734b('0x3e')](_0x439139[_0x734b('0x3b')],_0x439139[_0x734b('0x3f')]);_0x3bca7e['attributes']=_[_0x734b('0x3e')](_0x439139['model'],qs[_0x734b('0x4d')](_0xe8b116[_0x734b('0x3f')][_0x734b('0x4d')]));_0x3bca7e['attributes']=_0x3bca7e[_0x734b('0x40')]['length']?_0x3bca7e[_0x734b('0x40')]:_0x439139[_0x734b('0x3b')];if(_0xe8b116['query'][_0x734b('0x4e')]){_0x3bca7e[_0x734b('0x4a')]=[{'all':!![]}];}_0x3bca7e=_[_0x734b('0x48')]({},_0x3bca7e,_0xe8b116[_0x734b('0x49')]);return db[_0x734b('0x36')]['find'](_0x3bca7e)[_0x734b('0x2b')](handleEntityNotFound(_0x2455b9,null))['then'](respondWithResult(_0x2455b9,null))[_0x734b('0x4c')](handleError(_0x2455b9,null));};exports['destroy']=function(_0xd3c688,_0xa2fd9d){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0xd3c688[_0x734b('0x50')]['id']}})['then'](handleEntityNotFound(_0xa2fd9d,null))['then'](removeEntity(_0xa2fd9d,null))['catch'](handleError(_0xa2fd9d,null));};exports[_0x734b('0x51')]=function(_0x1901a8,_0x541991){return db[_0x734b('0x36')][_0x734b('0x51')]()['then'](respondWithResult(_0x541991,null))[_0x734b('0x4c')](handleError(_0x541991,null));};exports[_0x734b('0x52')]=function(_0x44e6d2,_0x4d6501){var _0x2e95aa;return db[_0x734b('0x53')][_0x734b('0x54')](function(_0xe605be){return db['VoicePrefix'][_0x734b('0x52')](_0x44e6d2[_0x734b('0x55')],{'transaction':_0xe605be})[_0x734b('0x2b')](function(_0x432a96){_0x2e95aa=_0x432a96['get']({'plain':!![]});return db[_0x734b('0x56')]['find']({'where':{'id':_0x2e95aa[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x1f3594){return createVoicePrefixExtensions(_0x2e95aa,_0x1f3594,_0xe605be);});});})[_0x734b('0x2b')](function(){var _0x58d665=_0x44e6d2[_0x734b('0x58')][_0x734b('0x2c')]({'plain':!![]});if(!_0x58d665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58d665['role']===_0x734b('0x58')){var _0x577735=_0x2e95aa;return db[_0x734b('0x59')][_0x734b('0x4f')]({'where':{'name':_0x734b('0x2d'),'userProfileId':_0x58d665['userProfileId']},'raw':!![]})[_0x734b('0x2b')](function(_0x588cd8){if(_0x588cd8&&_0x588cd8[_0x734b('0x5a')]===0x0){return db[_0x734b('0x2e')][_0x734b('0x52')]({'name':_0x577735[_0x734b('0x32')],'resourceId':_0x577735['id'],'type':_0x588cd8['name'],'sectionId':_0x588cd8['id']},{})[_0x734b('0x2b')](function(){return _0x2e95aa;});}else{return _0x2e95aa;}})['catch'](function(_0x6b198c){logger[_0x734b('0x30')](_0x734b('0x5b'),_0x6b198c);throw _0x6b198c;});}return _0x2e95aa;})['then'](respondWithResult(_0x4d6501,null))[_0x734b('0x4c')](handleError(_0x4d6501,null));};function Extension(_0x55c699,_0x2c81a1,_0x17a217,_0x3ec705){this[_0x734b('0x5c')]='from-sip';this[_0x734b('0x5d')]=_0x55c699;this['app']=_0x17a217;this[_0x734b('0x39')]=_0x734b('0x5e');this[_0x734b('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x734b('0x60')]=_0x2c81a1;this[_0x734b('0x61')]=_0x3ec705;}function createVoicePrefixExtensions(_0x366379,_0x3b16bb,_0x228f85){return new BPromise(function(_0x262244,_0x164c81){var _0x506407=new Extension(formatPrefixName(_0x366379[_0x734b('0x62')]),0x1,_0x734b('0x63'),_0x734b('0x64'));_0x506407['VoicePrefixId']=_0x366379['id'];return db['VoiceExtension'][_0x734b('0x52')](_0x506407,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x391c04){var _0x1eec8e=_0x391c04['get']({'plain':!![]});var _0x565a2e=_['map'](addVoicePrefixExtensions(_0x366379,_0x3b16bb),function(_0x1bd023){_0x1bd023[_0x734b('0x57')]=_0x1eec8e['id'];_0x1bd023[_0x734b('0x65')]=_0x366379['id'];return _0x1bd023;});return db[_0x734b('0x56')][_0x734b('0x66')](_0x565a2e,{'transaction':_0x228f85})[_0x734b('0x2b')](function(_0x113931){if(!_0x113931){return _0x164c81(_0x734b('0x67'));}else{return _0x262244(_0x113931);}})[_0x734b('0x4c')](function(_0x459788){return _0x164c81(_0x459788);});});;});};function addVoicePrefixExtensions(_0xc5a114,_0x69b605){var _0x43951a=[];var _0x467b1=formatPrefixName(_0xc5a114[_0x734b('0x62')]);_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x2,_0x734b('0x69'),_0x734b('0x6a')+_0xc5a114[_0x734b('0x32')]));if(_0xc5a114[_0x734b('0x6b')]){_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,'Set',_0x734b('0x6c')+_0xc5a114[_0x734b('0x6b')]));}else{_0x43951a[_0x734b('0x68')](new Extension(_0x467b1,0x3,_0x734b('0x63'),_0x734b('0x6d')));}_0x43951a['push'](new Extension(_0x467b1,0x4,_0x734b('0x6e'),_0x69b605[_0x734b('0x5c')]+','+_0x734b('0x6f')+(0x8+_0xc5a114[_0x734b('0x32')][_0x734b('0x41')])+'}'+','+0x1));return _0x43951a;}function formatPrefixName(_0x5d785d){var _0x594df0='_';for(var _0x479ee2=0x0;_0x479ee2<_0x5d785d['length'];_0x479ee2++){if(_0x5d785d['charAt'](_0x479ee2)=='-'){_0x594df0+=_0x5d785d['charAt'](_0x479ee2);}else{_0x594df0+='['+_0x5d785d[_0x734b('0x70')](_0x479ee2)+']';}}_0x594df0+='.';return _0x594df0;}exports[_0x734b('0x2a')]=function(_0x16c9d2,_0xb23b61,_0x496070){var _0x4f79a9=_0x16c9d2[_0x734b('0x55')];_0x4f79a9[_0x734b('0x62')]=_0x734b('0x71')+_0x4f79a9[_0x734b('0x32')]+'-';return db['sequelize'][_0x734b('0x54')](function(_0x24ab5c){return db[_0x734b('0x36')][_0x734b('0x2a')](_0x4f79a9,{'where':{'id':_0x4f79a9['id']},'transaction':_0x24ab5c})['then'](function(){return db[_0x734b('0x56')]['destroy']({'where':{'VoicePrefixId':_0x4f79a9['id']},'transaction':_0x24ab5c})[_0x734b('0x2b')](function(){return db[_0x734b('0x56')][_0x734b('0x4f')]({'where':{'id':_0x4f79a9[_0x734b('0x57')]},'raw':!![]})[_0x734b('0x2b')](function(_0x4e43c3){return createVoicePrefixExtensions(_0x4f79a9,_0x4e43c3,_0x24ab5c);});});});})[_0x734b('0x2b')](function(){return db[_0x734b('0x36')][_0x734b('0x72')](_0x4f79a9['id']);})[_0x734b('0x2b')](respondWithResult(_0xb23b61,null))[_0x734b('0x4c')](handleError(_0xb23b61,null));};exports['addAgents']=function(_0x475ecd,_0x2dcb30,_0x1316ae){return db[_0x734b('0x36')]['find']({'where':{'id':_0x475ecd[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2dcb30,null))[_0x734b('0x2b')](function(_0x407006){if(_0x407006){return _0x407006[_0x734b('0x73')](_0x475ecd['body'][_0x734b('0x74')],_['omit'](_0x475ecd[_0x734b('0x55')],[_0x734b('0x74'),'id'])||{})[_0x734b('0x75')](function(_0x27fd22){for(var _0x4624c7=0x0;_0x4624c7<_0x475ecd[_0x734b('0x55')]['ids']['length'];_0x4624c7+=0x1){socket['emit'](_0x734b('0x76'),{'UserId':Number(_0x475ecd['body'][_0x734b('0x74')][_0x4624c7]),'VoicePrefixId':Number(_0x475ecd[_0x734b('0x50')]['id'])});}return _0x27fd22;});}})['then'](respondWithResult(_0x2dcb30,null))[_0x734b('0x4c')](handleError(_0x2dcb30,null));};exports[_0x734b('0x77')]=function(_0x17749f,_0x2a3c8d,_0x1d0bfb){return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x17749f[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x2a3c8d,null))[_0x734b('0x2b')](function(_0x5de89a){if(_0x5de89a){return _0x5de89a[_0x734b('0x77')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])['then'](function(){if(_[_0x734b('0x78')](_0x17749f[_0x734b('0x3f')][_0x734b('0x74')])){for(var _0x13f1fd=0x0;_0x13f1fd<_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x734b('0x41')];_0x13f1fd+=0x1){socket[_0x734b('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')][_0x13f1fd]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}}else{socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':Number(_0x17749f[_0x734b('0x3f')][_0x734b('0x74')]),'VoicePrefixId':Number(_0x17749f[_0x734b('0x50')]['id'])});}});}})[_0x734b('0x2b')](respondWithStatusCode(_0x2a3c8d,null))['catch'](handleError(_0x2a3c8d,null));};exports[_0x734b('0x7b')]=function(_0x13f4e8,_0x41eca7,_0x500ebf){var _0x31e1ec={};var _0x2fde66={};var _0x24fb9d;var _0x3f3511;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0x13f4e8['params']['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x41eca7,null))['then'](function(_0x504a7f){if(_0x504a7f){_0x24fb9d=_0x504a7f;_0x2fde66['model']=_['keys'](db[_0x734b('0x7d')][_0x734b('0x37')]);_0x2fde66[_0x734b('0x3f')]=_[_0x734b('0x3c')](_0x13f4e8['query']);_0x2fde66['filters']=_[_0x734b('0x3e')](_0x2fde66['model'],_0x2fde66[_0x734b('0x3f')]);_0x31e1ec[_0x734b('0x40')]=_['intersection'](_0x2fde66[_0x734b('0x3b')],qs['fields'](_0x13f4e8['query']['fields']));_0x31e1ec[_0x734b('0x40')]=_0x31e1ec[_0x734b('0x40')][_0x734b('0x41')]?_0x31e1ec[_0x734b('0x40')]:_0x2fde66['model'];_0x31e1ec[_0x734b('0x7e')]=qs[_0x734b('0x44')](_0x13f4e8['query'][_0x734b('0x44')]);_0x31e1ec[_0x734b('0x45')]=qs['filters'](_[_0x734b('0x46')](_0x13f4e8['query'],_0x2fde66[_0x734b('0x3d')]));if(_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]){_0x31e1ec[_0x734b('0x45')]=_[_0x734b('0x48')](_0x31e1ec[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x31e1ec['attributes'],function(_0x5be5f2){var _0x57f20a={};_0x57f20a[_0x5be5f2]={'$like':'%'+_0x13f4e8[_0x734b('0x3f')][_0x734b('0x47')]+'%'};return _0x57f20a;})});}_0x31e1ec=_['merge']({},_0x31e1ec,_0x13f4e8[_0x734b('0x49')]);return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x48b0e1){if(_0x48b0e1){_0x3f3511=_0x48b0e1[_0x734b('0x41')];if(!_0x13f4e8[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x31e1ec[_0x734b('0x23')]=qs[_0x734b('0x23')](_0x13f4e8[_0x734b('0x3f')]['limit']);_0x31e1ec['offset']=qs['offset'](_0x13f4e8[_0x734b('0x3f')]['offset']);}return _0x24fb9d[_0x734b('0x7b')](_0x31e1ec);}})[_0x734b('0x2b')](function(_0x2a5aa9){if(_0x2a5aa9){return _0x2a5aa9?{'count':_0x3f3511,'rows':_0x2a5aa9}:null;}})['then'](respondWithResult(_0x41eca7,null))['catch'](handleError(_0x41eca7,null));};exports[_0x734b('0x7f')]=function(_0xa9bb2a,_0x4f3a90,_0x72d3ad){var _0x548206={};var _0x4a809a={};var _0x52890d;var _0xbb8121;return db[_0x734b('0x36')][_0x734b('0x7c')]({'where':{'id':_0xa9bb2a[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](handleEntityNotFound(_0x4f3a90,null))[_0x734b('0x2b')](function(_0x18cb9){if(_0x18cb9){_0x52890d=_0x18cb9;_0x4a809a['model']=_[_0x734b('0x3c')](db[_0x734b('0x80')][_0x734b('0x37')]);_0x4a809a[_0x734b('0x3f')]=_['keys'](_0xa9bb2a['query']);_0x4a809a['filters']=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],_0x4a809a[_0x734b('0x3f')]);_0x548206[_0x734b('0x40')]=_[_0x734b('0x3e')](_0x4a809a[_0x734b('0x3b')],qs[_0x734b('0x4d')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x4d')]));_0x548206[_0x734b('0x40')]=_0x548206[_0x734b('0x40')][_0x734b('0x41')]?_0x548206[_0x734b('0x40')]:_0x4a809a['model'];_0x548206['order']=qs[_0x734b('0x44')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x44')]);_0x548206['where']=qs[_0x734b('0x3d')](_[_0x734b('0x46')](_0xa9bb2a[_0x734b('0x3f')],_0x4a809a[_0x734b('0x3d')]));if(_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x47')]){_0x548206[_0x734b('0x45')]=_[_0x734b('0x48')](_0x548206[_0x734b('0x45')],{'$or':_[_0x734b('0x35')](_0x548206[_0x734b('0x40')],function(_0x30dff6){var _0x5ac65f={};_0x5ac65f[_0x30dff6]={'$like':'%'+_0xa9bb2a[_0x734b('0x3f')]['filter']+'%'};return _0x5ac65f;})});}_0x548206=_[_0x734b('0x48')]({},_0x548206,_0xa9bb2a[_0x734b('0x49')]);return _0x52890d[_0x734b('0x7f')](_0x548206);}})[_0x734b('0x2b')](function(_0x1bedc4){if(_0x1bedc4){_0xbb8121=_0x1bedc4['length'];if(!_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x42')]('nolimit')){_0x548206[_0x734b('0x23')]=qs[_0x734b('0x23')](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x23')]);_0x548206['offset']=qs['offset'](_0xa9bb2a[_0x734b('0x3f')][_0x734b('0x25')]);}return _0x52890d['getTeams'](_0x548206);}})[_0x734b('0x2b')](function(_0x19a54a){if(_0x19a54a){return _0x19a54a?{'count':_0xbb8121,'rows':_0x19a54a}:null;}})[_0x734b('0x2b')](respondWithResult(_0x4f3a90,null))[_0x734b('0x4c')](handleError(_0x4f3a90,null));};exports[_0x734b('0x81')]=function(_0x4e46a2,_0x5d0a69,_0x303257){var _0x1bac04=_0x4e46a2[_0x734b('0x55')]['ids'];var _0x200182;return db[_0x734b('0x80')][_0x734b('0x82')]({'where':{'id':_0x1bac04},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':_0x734b('0x83'),'attributes':['id',_0x734b('0x32'),_0x734b('0x84'),_0x734b('0x85'),_0x734b('0x86')],'raw':!![]}]})[_0x734b('0x2b')](function(_0x48fbb3){if(_0x48fbb3){_0x200182=_0x48fbb3;var _0x564dda=_[_0x734b('0x87')](_0x48fbb3,function(_0x26af1f){var _0x1ba633=_0x26af1f[_0x734b('0x2c')]({'plain':!![]});return _0x1ba633[_0x734b('0x83')];});return db[_0x734b('0x36')][_0x734b('0x4f')]({'where':{'id':_0x4e46a2[_0x734b('0x50')]['id']}})[_0x734b('0x2b')](function(_0xc74aeb){return db[_0x734b('0x53')]['transaction'](function(_0x288109){return _0xc74aeb[_0x734b('0x81')](_0x1bac04,{'transaction':_0x288109})['then'](function(){return BPromise['each'](_0x200182,function(_0x255fca){return db[_0x734b('0x88')][_0x734b('0x89')]({'TeamId':_0x255fca['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},{'transaction':_0x288109});});})['then'](function(){return BPromise[_0x734b('0x8a')](_0x564dda,function(_0x1c9a1e){return db['UserVoicePrefix'][_0x734b('0x8b')]({'where':{'UserId':_0x1c9a1e['id'],'VoicePrefixId':_0x4e46a2[_0x734b('0x50')]['id']},'transaction':_0x288109});});})[_0x734b('0x2b')](function(){_0x564dda[_0x734b('0x8c')](function(_0x189e6d){socket[_0x734b('0x79')](_0x734b('0x76'),{'UserId':_0x189e6d['id'],'VoicePrefixId':_0xc74aeb['id']});});});});});}})[_0x734b('0x2b')](respondWithStatusCode(_0x5d0a69,null))['catch'](handleError(_0x5d0a69,null));};exports[_0x734b('0x8d')]=function(_0x31468d,_0x45a160,_0x16451a){return db[_0x734b('0x80')]['findAll']({'where':{'id':_0x31468d['query'][_0x734b('0x74')]},'attributes':['id'],'include':[{'model':db[_0x734b('0x7d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x734b('0x2b')](handleEntityNotFound(_0x45a160,null))['then'](function(_0x19cf27){var _0x1237cf=_[_0x734b('0x35')](_0x19cf27,'id');var _0x42038a=[];var _0x3e61f1=[];var _0x22e919=squel[_0x734b('0x8e')]();_0x22e919['field']('tq.TeamId')[_0x734b('0x8f')](_0x734b('0x90'),'tq')[_0x734b('0x91')]('user_has_teams','ut',_0x734b('0x92'))[_0x734b('0x45')](_0x734b('0x93'),_0x31468d['params']['id']);for(var _0x1fcc17=0x0;_0x1fcc17<_0x19cf27[_0x734b('0x41')];_0x1fcc17+=0x1){let _0x39a46e=_0x19cf27[_0x1fcc17];for(var _0x2a8f17=0x0;_0x2a8f17<_0x39a46e['Agents']['length'];_0x2a8f17+=0x1){let _0x9cfb2f=_0x39a46e[_0x734b('0x83')][_0x2a8f17];var _0x326783=_0x22e919['clone']();_0x326783[_0x734b('0x45')]('ut.UserId\x20=\x20?',_0x9cfb2f['id']);_0x3e61f1[_0x734b('0x68')](db[_0x734b('0x53')][_0x734b('0x3f')](_0x326783[_0x734b('0x94')](),{'type':db[_0x734b('0x53')]['QueryTypes'][_0x734b('0x95')]})[_0x734b('0x2b')](function(_0x5ddf23){if(_0x5ddf23['length']===0x1){return _0x9cfb2f['id'];}else{var _0x967ccc=_[_0x734b('0x96')](_['map'](_0x5ddf23,_0x734b('0x97')),function(_0x23be49){return _['includes'](_0x1237cf,_0x23be49);});if(_0x967ccc){return _0x9cfb2f['id'];}}}));}}return BPromise[_0x734b('0x98')](_0x3e61f1)['then'](function(_0x4d75bc){_0x42038a=_(_0x42038a)['union'](_0x4d75bc)[_0x734b('0x99')]()['value']();return db[_0x734b('0x36')]['find']({'where':{'id':_0x31468d[_0x734b('0x50')]['id']}})['then'](function(_0xf43253){return db[_0x734b('0x53')][_0x734b('0x54')](function(_0x483d0a){return _0xf43253[_0x734b('0x8d')](_0x31468d[_0x734b('0x3f')]['ids'],{'transaction':_0x483d0a})[_0x734b('0x2b')](function(){if(!_['isEmpty'](_0x42038a)){return _0xf43253[_0x734b('0x77')](_0x42038a,{'transaction':_0x483d0a});}})[_0x734b('0x2b')](function(){_0x42038a['forEach'](function(_0x1f00b3){socket[_0x734b('0x79')](_0x734b('0x7a'),{'UserId':_0x1f00b3,'VoicePrefixId':_0xf43253['id']});});});});});});})[_0x734b('0x2b')](respondWithStatusCode(_0x45a160,null))['catch'](handleError(_0x45a160,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 850f825..75d19d1 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 _0x30cc=['save','remove','emit','hasOwnProperty','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x1d9dfa,_0x30598d){var _0x252661=function(_0x4bcc24){while(--_0x4bcc24){_0x1d9dfa['push'](_0x1d9dfa['shift']());}};_0x252661(++_0x30598d);}(_0x30cc,0x8c));var _0xc30c=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x30cc[_0x4ec520];return _0xed49d7;};'use strict';var EventEmitter=require(_0xc30c('0x0'));var VoicePrefix=require(_0xc30c('0x1'))['db'][_0xc30c('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc30c('0x3')](0x0);var events={'afterCreate':_0xc30c('0x4'),'afterUpdate':'update','afterDestroy':_0xc30c('0x5')};function emitEvent(_0x354bc9){return function(_0x33401d,_0x186552,_0x5bd514){VoicePrefixEvents[_0xc30c('0x6')](_0x354bc9+':'+_0x33401d['id'],_0x33401d);VoicePrefixEvents[_0xc30c('0x6')](_0x354bc9,_0x33401d);_0x5bd514(null);};}for(var e in events){if(events[_0xc30c('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x1e4e=['events','../../mysqldb','update','remove','emit','hasOwnProperty'];(function(_0x2a9542,_0x21589a){var _0x1515ad=function(_0x1d8e4f){while(--_0x1d8e4f){_0x2a9542['push'](_0x2a9542['shift']());}};_0x1515ad(++_0x21589a);}(_0x1e4e,0x1ce));var _0xe1e4=function(_0x60fea4,_0x1b6e82){_0x60fea4=_0x60fea4-0x0;var _0x1c76dc=_0x1e4e[_0x60fea4];return _0x1c76dc;};'use strict';var EventEmitter=require(_0xe1e4('0x0'));var VoicePrefix=require(_0xe1e4('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe1e4('0x2'),'afterDestroy':_0xe1e4('0x3')};function emitEvent(_0x5ede28){return function(_0x1a474e,_0x231a6f,_0x5a4810){VoicePrefixEvents['emit'](_0x5ede28+':'+_0x1a474e['id'],_0x1a474e);VoicePrefixEvents[_0xe1e4('0x4')](_0x5ede28,_0x1a474e);_0x5a4810(null);};}for(var e in events){if(events[_0xe1e4('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 6e99844..d22708b 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 _0xde33=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x30d375,_0x11c56e){var _0x7cdafb=function(_0x1421ba){while(--_0x1421ba){_0x30d375['push'](_0x30d375['shift']());}};_0x7cdafb(++_0x11c56e);}(_0xde33,0x87));var _0x3de3=function(_0x46a95b,_0x390ab9){_0x46a95b=_0x46a95b-0x0;var _0x5b56fd=_0xde33[_0x46a95b];return _0x5b56fd;};'use strict';var _=require('lodash');var util=require(_0x3de3('0x0'));var logger=require(_0x3de3('0x1'))(_0x3de3('0x2'));var moment=require(_0x3de3('0x3'));var BPromise=require(_0x3de3('0x4'));var rp=require(_0x3de3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3de3('0x6'));var config=require(_0x3de3('0x7'));var attributes=require(_0x3de3('0x8'));module[_0x3de3('0x9')]=function(_0x51dce6,_0x28dbdc){return _0x51dce6[_0x3de3('0xa')](_0x3de3('0xb'),attributes,{'tableName':_0x3de3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d23=['exports','define','VoicePrefix','voice_prefixes','lodash','api','moment','request-promise','path','rimraf','./voicePrefix.attributes'];(function(_0x4032f9,_0x2f0dd8){var _0x7b68fe=function(_0x1d1a98){while(--_0x1d1a98){_0x4032f9['push'](_0x4032f9['shift']());}};_0x7b68fe(++_0x2f0dd8);}(_0x2d23,0x143));var _0x32d2=function(_0x11fdf8,_0x78c1cb){_0x11fdf8=_0x11fdf8-0x0;var _0x452e17=_0x2d23[_0x11fdf8];return _0x452e17;};'use strict';var _=require(_0x32d2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x32d2('0x1'));var moment=require(_0x32d2('0x2'));var BPromise=require('bluebird');var rp=require(_0x32d2('0x3'));var fs=require('fs');var path=require(_0x32d2('0x4'));var rimraf=require(_0x32d2('0x5'));var config=require('../../config/environment');var attributes=require(_0x32d2('0x6'));module[_0x32d2('0x7')]=function(_0x39549a,_0x4b07e3){return _0x39549a[_0x32d2('0x8')](_0x32d2('0x9'),attributes,{'tableName':_0x32d2('0xa'),'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 1c540c6..1005c5f 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 _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x1a65a3,_0x3a8b06){var _0xbfcd53=function(_0x432df0){while(--_0x432df0){_0x1a65a3['push'](_0x1a65a3['shift']());}};_0xbfcd53(++_0x3a8b06);}(_0x4e83,0x1ae));var _0x34e8=function(_0x3f2621,_0x569366){_0x3f2621=_0x3f2621-0x0;var _0x43018c=_0x4e83[_0x3f2621];return _0x43018c;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('VoicePrefix,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});} \ No newline at end of file +var _0x3c8e=['register','request','then','info','request\x20sent','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x602b1,_0x17c697){var _0x27519f=function(_0x181625){while(--_0x181625){_0x602b1['push'](_0x602b1['shift']());}};_0x27519f(++_0x17c697);}(_0x3c8e,0x89));var _0xe3c8=function(_0x4ff322,_0x125431){_0x4ff322=_0x4ff322-0x0;var _0x441b32=_0x3c8e[_0x4ff322];return _0x441b32;};'use strict';var _=require(_0xe3c8('0x0'));var util=require(_0xe3c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3c8('0x2'));var fs=require('fs');var Redis=require(_0xe3c8('0x3'));var db=require(_0xe3c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3c8('0x5'))(_0xe3c8('0x6'));var config=require(_0xe3c8('0x7'));var jayson=require(_0xe3c8('0x8'));var client=jayson['client'][_0xe3c8('0x9')]({'port':0x232a});config[_0xe3c8('0xa')]=_[_0xe3c8('0xb')](config[_0xe3c8('0xa')],{'host':_0xe3c8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe3c8('0xa')]));require('./voicePrefix.socket')[_0xe3c8('0xd')](socket);function respondWithRpcPromise(_0x24b28f,_0x1ec873,_0x21bda1){return new BPromise(function(_0x50e959,_0x2eb76d){return client[_0xe3c8('0xe')](_0x24b28f,_0x21bda1)[_0xe3c8('0xf')](function(_0x4c24b6){logger[_0xe3c8('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x1ec873,_0xe3c8('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1ec873,_0xe3c8('0x11'),JSON[_0xe3c8('0x12')](_0x4c24b6));if(_0x4c24b6[_0xe3c8('0x13')]){if(_0x4c24b6['error'][_0xe3c8('0x14')]===0x1f4){logger[_0xe3c8('0x13')](_0xe3c8('0x15'),_0x1ec873,_0x4c24b6[_0xe3c8('0x13')][_0xe3c8('0x16')]);return _0x2eb76d(_0x4c24b6[_0xe3c8('0x13')]['message']);}logger[_0xe3c8('0x13')](_0xe3c8('0x15'),_0x1ec873,_0x4c24b6['error'][_0xe3c8('0x16')]);return _0x50e959(_0x4c24b6[_0xe3c8('0x13')][_0xe3c8('0x16')]);}else{logger['info'](_0xe3c8('0x15'),_0x1ec873,_0xe3c8('0x11'));_0x50e959(_0x4c24b6[_0xe3c8('0x17')][_0xe3c8('0x16')]);}})[_0xe3c8('0x18')](function(_0x1136d1){logger[_0xe3c8('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x1ec873,_0x1136d1);_0x2eb76d(_0x1136d1);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 82f01bf..7964828 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 _0xc737=['remove','update','emit','removeListener','./voicePrefix.events','save'];(function(_0x10dc3c,_0x5cd9aa){var _0x1246d3=function(_0xbb8cb5){while(--_0xbb8cb5){_0x10dc3c['push'](_0x10dc3c['shift']());}};_0x1246d3(++_0x5cd9aa);}(_0xc737,0x154));var _0x7c73=function(_0x5cbfc4,_0x592d2d){_0x5cbfc4=_0x5cbfc4-0x0;var _0x2e59b4=_0xc737[_0x5cbfc4];return _0x2e59b4;};'use strict';var VoicePrefixEvents=require(_0x7c73('0x0'));var events=[_0x7c73('0x1'),_0x7c73('0x2'),_0x7c73('0x3')];function createListener(_0x50f167,_0x3cb8f6){return function(_0x284ee4){_0x3cb8f6[_0x7c73('0x4')](_0x50f167,_0x284ee4);};}function removeListener(_0x597691,_0x36583e){return function(){VoicePrefixEvents[_0x7c73('0x5')](_0x597691,_0x36583e);};}exports['register']=function(_0x5ad227){for(var _0x37635c=0x0,_0x3f6f81=events['length'];_0x37635c<_0x3f6f81;_0x37635c++){var _0x9264a9=events[_0x37635c];var _0x3281fe=createListener('voicePrefix:'+_0x9264a9,_0x5ad227);VoicePrefixEvents['on'](_0x9264a9,_0x3281fe);}}; \ No newline at end of file +var _0x136c=['emit','removeListener','register','length','./voicePrefix.events','save','update'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0x136c,0x1d2));var _0xc136=function(_0x505a1d,_0x1136e8){_0x505a1d=_0x505a1d-0x0;var _0x114138=_0x136c[_0x505a1d];return _0x114138;};'use strict';var VoicePrefixEvents=require(_0xc136('0x0'));var events=[_0xc136('0x1'),'remove',_0xc136('0x2')];function createListener(_0x3b4cbd,_0x34c789){return function(_0x15181c){_0x34c789[_0xc136('0x3')](_0x3b4cbd,_0x15181c);};}function removeListener(_0x9e2e9d,_0x19565a){return function(){VoicePrefixEvents[_0xc136('0x4')](_0x9e2e9d,_0x19565a);};}exports[_0xc136('0x5')]=function(_0x586570){for(var _0x1ac41b=0x0,_0x594112=events[_0xc136('0x6')];_0x1ac41b<_0x594112;_0x1ac41b++){var _0x3993f2=events[_0x1ac41b];var _0x1804c1=createListener('voicePrefix:'+_0x3993f2,_0x586570);VoicePrefixEvents['on'](_0x3993f2,_0x1804c1);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d685319..ec540f2 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d763d,_0x2e9bec){_0x4d763d=_0x4d763d-0x0;var _0x3e74b7=_0xb10b[_0x4d763d];return _0x3e74b7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _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(_0x445d92,_0x22c321){var _0x2bac4d=function(_0xe6f1a1){while(--_0xe6f1a1){_0x445d92['push'](_0x445d92['shift']());}};_0x2bac4d(++_0x22c321);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 410404d..fb7705c 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 _0x043f=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','linear','rrordered','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','leavewhenempty','join','acw','BOOLEAN','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always'];(function(_0x19d24c,_0x62bc50){var _0x2fae8d=function(_0x419856){while(--_0x419856){_0x19d24c['push'](_0x19d24c['shift']());}};_0x2fae8d(++_0x62bc50);}(_0x043f,0x14f));var _0xf043=function(_0x4108f7,_0x51d271){_0x4108f7=_0x4108f7-0x0;var _0x4c394c=_0x043f[_0x4108f7];return _0x4c394c;};'use strict';var Sequelize=require(_0xf043('0x0'));module[_0xf043('0x1')]={'name':{'type':Sequelize[_0xf043('0x2')],'allowNull':![],'unique':_0xf043('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x5'),_0xf043('0x6')),'allowNull':![],'defaultValue':_0xf043('0x5')},'musiconhold':{'type':Sequelize[_0xf043('0x2')],'defaultValue':_0xf043('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xf043('0x4')]('rr',_0xf043('0x8'),'leastrecent',_0xf043('0x9'),'random','rrmemory',_0xf043('0xa'),'wrandom',_0xf043('0xb')),'allowNull':![],'defaultValue':_0xf043('0x8'),'set':function(_0x49b02c){this[_0xf043('0xc')](_0xf043('0xd'),_0x49b02c?_0x49b02c:_0xf043('0xe'));},'get':function(){var _0x4cfbd8=this[_0xf043('0xf')](_0xf043('0x10'));var _0xffbf13=this[_0xf043('0xf')](_0xf043('0x11'));var _0x2e3fb2=this[_0xf043('0xf')](_0xf043('0xd'));if(_0x4cfbd8===_0xf043('0x5')){return _0x2e3fb2;}if(_0xffbf13==='booked'&&_0x2e3fb2===_0xf043('0xe')||_0xffbf13===_0xf043('0x12')&&_0x2e3fb2===_0xf043('0x13')){return _0x2e3fb2;}if(_0xffbf13===_0xf043('0x14')||_0xffbf13===_0xf043('0x15')||_0xffbf13===_0xf043('0x16')){return _0x2e3fb2;}return null;}},'servicelevel':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xf043('0x17')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xf043('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xf043('0x4')]('yes','no'),'defaultValue':_0xf043('0x18')},'autopause':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x18'),'no',_0xf043('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xf043('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xf043('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xf043('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xf043('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xf043('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xf043('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xf043('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xf043('0x4')]('yes','no'),'defaultValue':_0xf043('0x18')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xf043('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xf043('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xf043('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xf043('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xf043('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xf043('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xf043('0x2')]},'queue_quantity1':{'type':Sequelize[_0xf043('0x2')]},'queue_quantity2':{'type':Sequelize[_0xf043('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xf043('0x2')]},'queue_less_than':{'type':Sequelize[_0xf043('0x2')]},'periodic_announce':{'type':Sequelize[_0xf043('0x1b')],'set':function(_0x48288f){this[_0xf043('0xc')](_0xf043('0x1c'),_0x48288f?_0x48288f['join'](','):[]);},'get':function(){return this[_0xf043('0xf')](_0xf043('0x1c'))?this['getDataValue'](_0xf043('0x1c'))[_0xf043('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xf043('0x2')],'defaultValue':'yes','set':function(_0xcbeb5f){this[_0xf043('0xc')](_0xf043('0x1e'),_0xcbeb5f?_0xcbeb5f['join'](','):undefined);},'get':function(){return this[_0xf043('0xf')](_0xf043('0x1e'))?this[_0xf043('0xf')](_0xf043('0x1e'))[_0xf043('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xf043('0x2')],'defaultValue':'no','set':function(_0x5d6707){this[_0xf043('0xc')](_0xf043('0x1f'),_0x5d6707?_0x5d6707[_0xf043('0x20')](','):undefined);},'get':function(){return this[_0xf043('0xf')](_0xf043('0x1f'))?this[_0xf043('0xf')](_0xf043('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0xf043('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xf043('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xf043('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x355d7e){this[_0xf043('0xc')](_0xf043('0x21'),_0x355d7e);if(_0x355d7e){if(this[_0xf043('0xf')]('wrapuptime')<0x2){this[_0xf043('0xc')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xf043('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xf043('0x22')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x23'),_0xf043('0x14'),_0xf043('0x16'),_0xf043('0x15'),_0xf043('0x12')),'defaultValue':_0xf043('0x14'),'comment':_0xf043('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xf043('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf043('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xf043('0x27')},'dialPowerLevel':{'type':Sequelize[_0xf043('0x28')](0x2)[_0xf043('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xf043('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x2a'),_0xf043('0x2b')),'defaultValue':_0xf043('0x2b'),'comment':_0xf043('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xf043('0x28')](0x2)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xf043('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xf043('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xf043('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xf043('0x2')],'defaultValue':_0xf043('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x31')},'dialQueueProject':{'type':Sequelize[_0xf043('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf043('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x34')},'dialBusyRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xf043('0x2')],'defaultValue':_0xf043('0x35')},'dialPrefix':{'type':Sequelize[_0xf043('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x36'),_0xf043('0x37'),_0xf043('0x38')),'defaultValue':_0xf043('0x36')},'dialAMDActive':{'type':Sequelize[_0xf043('0x22')],'defaultValue':0x0,'comment':_0xf043('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0xf043('0x17')](0x9)[_0xf043('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xf043('0x17')](0x9)[_0xf043('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xf043('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xf043('0x17')](0x9)[_0xf043('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xf043('0x17')](0x9)[_0xf043('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xf043('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xf043('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xf043('0x17')](0x9)[_0xf043('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xf043('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xf043('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xf043('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xf043('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xf043('0x22')],'defaultValue':0x0,'comment':_0xf043('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xf043('0x4')](_0xf043('0x3f'),_0xf043('0x40')),'defaultValue':_0xf043('0x3f')},'dialQueueProject2':{'type':Sequelize[_0xf043('0x2')],'comment':_0xf043('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xf043('0x22')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xf043('0x22')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xf043('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xf043('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf043('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf043('0x45')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x46')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf043('0x47')},'dialMachineMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)[_0xf043('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xf043('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xf043('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xf043('0x17')](0x5)[_0xf043('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xf043('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf043('0x22')],'defaultValue':![],'comment':_0xf043('0x4b'),'set':function(_0x15efc9){if(!_0x15efc9)this['setDataValue'](_0xf043('0x4c'),null);this['setDataValue'](_0xf043('0x4d'),_0x15efc9);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xf043('0x17')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xf043('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xf043('0x22')],'defaultValue':![]}}; \ No newline at end of file +var _0x0fce=['power','INTEGER','yes','ENUM','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\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\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','STRING','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','progressive'];(function(_0x54b5da,_0x7a8714){var _0x2d016f=function(_0x56ccd5){while(--_0x56ccd5){_0x54b5da['push'](_0x54b5da['shift']());}};_0x2d016f(++_0x7a8714);}(_0x0fce,0x178));var _0xe0fc=function(_0x5dae6e,_0x41b791){_0x5dae6e=_0x5dae6e-0x0;var _0x4b8419=_0x0fce[_0x5dae6e];return _0x4b8419;};'use strict';var Sequelize=require(_0xe0fc('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0fc('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0xe0fc('0x2')),'allowNull':![],'defaultValue':_0xe0fc('0x3')},'musiconhold':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':_0xe0fc('0x4')},'announce':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xe0fc('0x5'),_0xe0fc('0x6'),_0xe0fc('0x7'),_0xe0fc('0x8'),_0xe0fc('0x9'),'linear','wrandom',_0xe0fc('0xa')),'allowNull':![],'defaultValue':_0xe0fc('0x5'),'set':function(_0x5adb7b){this[_0xe0fc('0xb')](_0xe0fc('0xc'),_0x5adb7b?_0x5adb7b:'rrmemory');},'get':function(){var _0x39a7a0=this[_0xe0fc('0xd')](_0xe0fc('0xe'));var _0xd2e6b0=this[_0xe0fc('0xd')](_0xe0fc('0xf'));var _0xfbea90=this[_0xe0fc('0xd')]('strategy');if(_0x39a7a0===_0xe0fc('0x3')){return _0xfbea90;}if(_0xd2e6b0===_0xe0fc('0x10')&&_0xfbea90===_0xe0fc('0x9')||_0xd2e6b0==='booked'&&_0xfbea90===_0xe0fc('0x11')){return _0xfbea90;}if(_0xd2e6b0===_0xe0fc('0x12')||_0xd2e6b0==='predictive'||_0xd2e6b0===_0xe0fc('0x13')){return _0xfbea90;}return null;}},'servicelevel':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe0fc('0x1')]},'weight':{'type':Sequelize[_0xe0fc('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0xe0fc('0x15'),'no'),'defaultValue':_0xe0fc('0x15')},'autopause':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe0fc('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe0fc('0x16')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe0fc('0x16')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe0fc('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe0fc('0x16')]('yes','no'),'defaultValue':_0xe0fc('0x15')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0xe0fc('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe0fc('0x16')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe0fc('0x1')]},'queue_youarenext':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe0fc('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xe0fc('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xe0fc('0x1')]},'periodic_announce':{'type':Sequelize[_0xe0fc('0x18')],'set':function(_0x197ee0){this[_0xe0fc('0xb')](_0xe0fc('0x19'),_0x197ee0?_0x197ee0['join'](','):[]);},'get':function(){return this[_0xe0fc('0xd')](_0xe0fc('0x19'))?this[_0xe0fc('0xd')](_0xe0fc('0x19'))[_0xe0fc('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':'yes','set':function(_0x195daa){this[_0xe0fc('0xb')]('joinempty',_0x195daa?_0x195daa[_0xe0fc('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xe0fc('0x1c'))?this[_0xe0fc('0xd')](_0xe0fc('0x1c'))[_0xe0fc('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':'no','set':function(_0x44cd40){this[_0xe0fc('0xb')](_0xe0fc('0x1d'),_0x44cd40?_0x44cd40[_0xe0fc('0x1b')](','):undefined);},'get':function(){return this[_0xe0fc('0xd')](_0xe0fc('0x1d'))?this[_0xe0fc('0xd')]('leavewhenempty')[_0xe0fc('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe0fc('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xe0fc('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe0fc('0x1')]},'description':{'type':Sequelize[_0xe0fc('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x17c011){this[_0xe0fc('0xb')](_0xe0fc('0x1e'),_0x17c011);if(_0x17c011){if(this['getDataValue'](_0xe0fc('0x1f'))<0x2){this[_0xe0fc('0xb')](_0xe0fc('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe0fc('0x20')],'defaultValue':0x0,'comment':_0xe0fc('0x21')},'dialMethod':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x22'),_0xe0fc('0x12'),_0xe0fc('0x13'),_0xe0fc('0x23'),_0xe0fc('0x10')),'defaultValue':_0xe0fc('0x12'),'comment':_0xe0fc('0x24')},'dialLimitChannel':{'type':Sequelize[_0xe0fc('0x14')](0x4)[_0xe0fc('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0xe0fc('0x14')](0x4)[_0xe0fc('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe0fc('0x26')},'dialPowerLevel':{'type':Sequelize[_0xe0fc('0x27')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe0fc('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x29'),_0xe0fc('0x2a')),'defaultValue':_0xe0fc('0x2a'),'comment':_0xe0fc('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe0fc('0x27')](0x2)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe0fc('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe0fc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe0fc('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xe0fc('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':_0xe0fc('0x2e'),'comment':_0xe0fc('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xe0fc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x30')},'dialQueueProject':{'type':Sequelize[_0xe0fc('0x1')],'comment':_0xe0fc('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0fc('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe0fc('0x25')],'defaultValue':0x3,'comment':_0xe0fc('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0fc('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe0fc('0x36')},'dialTimezone':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':_0xe0fc('0x37')},'dialPrefix':{'type':Sequelize[_0xe0fc('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x38'),_0xe0fc('0x39'),_0xe0fc('0x3a')),'defaultValue':_0xe0fc('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe0fc('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe0fc('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe0fc('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe0fc('0x3d')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xe0fc('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe0fc('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe0fc('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe0fc('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe0fc('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe0fc('0x14')](0x9)[_0xe0fc('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe0fc('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xe0fc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xe0fc('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe0fc('0x16')](_0xe0fc('0x43'),_0xe0fc('0x44')),'defaultValue':_0xe0fc('0x43')},'dialQueueProject2':{'type':Sequelize[_0xe0fc('0x1')],'comment':_0xe0fc('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe0fc('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe0fc('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x47')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0fc('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe0fc('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe0fc('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe0fc('0x14')](0x5)[_0xe0fc('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe0fc('0x14')],'allowNull':!![],'comment':_0xe0fc('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xe0fc('0x20')],'defaultValue':![],'comment':_0xe0fc('0x4d'),'set':function(_0xbdc1f){if(!_0xbdc1f)this[_0xe0fc('0xb')]('mandatoryDispositionPauseId',null);this[_0xe0fc('0xb')](_0xe0fc('0x4e'),_0xbdc1f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe0fc('0x14')](0x3)[_0xe0fc('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xe0fc('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe0fc('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 371491a..bbccf96 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 _0xd117=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','limit','offset','count','Content-Range','apply','reject','save','update','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','then','stack','index','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','merge','VIRTUAL','options','where','VoiceQueue','includeAll','include','rows','catch','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','updatedAt','body','omit','createdAt','error','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','nolimit','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','all','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','push','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd117,0x182));var _0x7d11=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0xd117[_0x1d50f2];return _0x3769b8;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];config[_0x7d11('0x18')]=_[_0x7d11('0x19')](config['redis'],{'host':_0x7d11('0x1a'),'port':0x18eb});var socket=require(_0x7d11('0x1b'))(new Redis(config['redis']));require(_0x7d11('0x1c'))[_0x7d11('0x1d')](socket);function respondWithStatusCode(_0x20a2df,_0x2978da){_0x2978da=_0x2978da||0xcc;return function(_0x417e2d){if(_0x417e2d){return _0x20a2df[_0x7d11('0x1e')](_0x2978da);}return _0x20a2df[_0x7d11('0x1f')](_0x2978da)[_0x7d11('0x20')]();};}function respondWithResult(_0x4aa795,_0x1db0df){_0x1db0df=_0x1db0df||0xc8;return function(_0x12c2ff){if(_0x12c2ff){return _0x4aa795[_0x7d11('0x1f')](_0x1db0df)[_0x7d11('0x21')](_0x12c2ff);}};}function respondWithFilteredResult(_0x45f916,_0x528fdc){return function(_0x456cb9){if(_0x456cb9){var _0x49a34b=typeof _0x528fdc['offset']==='undefined'&&typeof _0x528fdc[_0x7d11('0x22')]==='undefined';var _0x1f9990=_0x456cb9['count'];var _0xbe0a79=_0x49a34b?0x0:_0x528fdc[_0x7d11('0x23')];var _0x328f8e=_0x49a34b?_0x456cb9[_0x7d11('0x24')]:_0x528fdc[_0x7d11('0x23')]+_0x528fdc[_0x7d11('0x22')];var _0x4297f8;if(_0x328f8e>=_0x1f9990){_0x328f8e=_0x1f9990;_0x4297f8=0xc8;}else{_0x4297f8=0xce;}_0x45f916[_0x7d11('0x1f')](_0x4297f8);return _0x45f916['set'](_0x7d11('0x25'),_0xbe0a79+'-'+_0x328f8e+'/'+_0x1f9990)['json'](_0x456cb9);}return null;};}function patchUpdates(_0x58455b){return function(_0x5c3898){try{jsonpatch[_0x7d11('0x26')](_0x5c3898,_0x58455b,!![]);}catch(_0x3545dc){return BPromise[_0x7d11('0x27')](_0x3545dc);}return _0x5c3898[_0x7d11('0x28')]();};}function saveUpdates(_0x355d14,_0xd938df){return function(_0x282e5c){if(_0x282e5c){return _0x282e5c[_0x7d11('0x29')](_0x355d14)['then'](function(_0x36c2b4){return _0x36c2b4;});}return null;};}function removeEntity(_0x577ca9,_0x4bfa76){return function(_0x5126cf){if(_0x5126cf){return _0x5126cf[_0x7d11('0x2a')]()['then'](function(){var _0x180e1e=_0x5126cf[_0x7d11('0x2b')]({'plain':!![]});var _0x328ab7=[{'name':'VoiceQueues','value':_0x7d11('0x2c'),'ignore':![]},{'name':_0x7d11('0x2d'),'value':_0x7d11('0x2e'),'ignore':![]}];var _0x5d38dd=_(_0x328ab7)[_0x7d11('0x2f')](_0x7d11('0x30'))[_0x7d11('0x31')](_0x7d11('0x32'))['value']();if(_[_0x7d11('0x33')](_0x5d38dd,_0x180e1e['type'])){return;}var _0x1bc218=_['find'](_0x328ab7,[_0x7d11('0x32'),_0x180e1e[_0x7d11('0x34')]])[_0x7d11('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1bc218,'resourceId':_0x180e1e['id']}})[_0x7d11('0x36')](function(){return _0x5126cf;});})[_0x7d11('0x36')](function(){_0x577ca9['status'](0xcc)[_0x7d11('0x20')]();});}};}function handleEntityNotFound(_0x1d3d86,_0x3eff9c){return function(_0x53ec4c){if(!_0x53ec4c){_0x1d3d86[_0x7d11('0x1e')](0x194);}return _0x53ec4c;};}function handleError(_0x553117,_0x507465){_0x507465=_0x507465||0x1f4;return function(_0x3a88c9){logger['error'](_0x3a88c9[_0x7d11('0x37')]);if(_0x3a88c9[_0x7d11('0x35')]){delete _0x3a88c9[_0x7d11('0x35')];}_0x553117[_0x7d11('0x1f')](_0x507465)['send'](_0x3a88c9);};}exports[_0x7d11('0x38')]=function(_0x1f282b,_0x55a029){var _0x57aa8a={},_0x10ac2a={},_0x21bac1={'count':0x0,'rows':[]};var _0x5b7d3a=_[_0x7d11('0x31')](db['VoiceQueue']['rawAttributes'],function(_0x1286d6){return{'name':_0x1286d6['fieldName'],'type':_0x1286d6['type'][_0x7d11('0x39')]};});_0x10ac2a[_0x7d11('0x3a')]=_[_0x7d11('0x31')](_0x5b7d3a,_0x7d11('0x35'));_0x10ac2a[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x1f282b[_0x7d11('0x3b')]);_0x10ac2a[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x10ac2a[_0x7d11('0x3a')],_0x10ac2a[_0x7d11('0x3b')]);_0x57aa8a[_0x7d11('0x3f')]=_['intersection'](_0x10ac2a[_0x7d11('0x3a')],qs['fields'](_0x1f282b[_0x7d11('0x3b')][_0x7d11('0x40')]));_0x57aa8a[_0x7d11('0x3f')]=_0x57aa8a[_0x7d11('0x3f')]['length']?_0x57aa8a[_0x7d11('0x3f')]:_0x10ac2a[_0x7d11('0x3a')];if(!_0x1f282b[_0x7d11('0x3b')][_0x7d11('0x41')]('nolimit')){_0x57aa8a[_0x7d11('0x22')]=qs['limit'](_0x1f282b[_0x7d11('0x3b')]['limit']);_0x57aa8a[_0x7d11('0x23')]=qs[_0x7d11('0x23')](_0x1f282b[_0x7d11('0x3b')][_0x7d11('0x23')]);}_0x57aa8a['order']=qs['sort'](_0x1f282b[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x57aa8a['where']=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x1f282b[_0x7d11('0x3b')],_0x10ac2a[_0x7d11('0x3d')]),_0x5b7d3a);if(_0x1f282b[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x57aa8a['where']=_[_0x7d11('0x44')](_0x57aa8a['where'],{'$or':_[_0x7d11('0x31')](_0x5b7d3a,function(_0x44eeed){if(_0x44eeed[_0x7d11('0x34')]!==_0x7d11('0x45')){var _0x2a0c2f={};_0x2a0c2f[_0x44eeed[_0x7d11('0x35')]]={'$like':'%'+_0x1f282b['query']['filter']+'%'};return _0x2a0c2f;}})});}_0x57aa8a=_['merge']({},_0x57aa8a,_0x1f282b[_0x7d11('0x46')]);var _0x16d92a={'where':_0x57aa8a[_0x7d11('0x47')]};return db[_0x7d11('0x48')][_0x7d11('0x24')](_0x16d92a)['then'](function(_0x347b8e){_0x21bac1[_0x7d11('0x24')]=_0x347b8e;if(_0x1f282b['query'][_0x7d11('0x49')]){_0x57aa8a[_0x7d11('0x4a')]=[{'all':!![]}];}return db[_0x7d11('0x48')]['findAll'](_0x57aa8a);})[_0x7d11('0x36')](function(_0x3bbc14){_0x21bac1[_0x7d11('0x4b')]=_0x3bbc14;return _0x21bac1;})['then'](respondWithFilteredResult(_0x55a029,_0x57aa8a))[_0x7d11('0x4c')](handleError(_0x55a029,null));};exports['show']=function(_0xe5d2fe,_0x69dbd1){var _0x3f33d9={'raw':![],'where':{'id':_0xe5d2fe[_0x7d11('0x4d')]['id']}},_0xbe357={};_0xbe357[_0x7d11('0x3a')]=_[_0x7d11('0x3c')](db[_0x7d11('0x48')][_0x7d11('0x4e')]);_0xbe357['query']=_['keys'](_0xe5d2fe['query']);_0xbe357[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0xbe357[_0x7d11('0x3a')],_0xbe357[_0x7d11('0x3b')]);_0x3f33d9[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0xbe357[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0xe5d2fe[_0x7d11('0x3b')][_0x7d11('0x40')]));_0x3f33d9[_0x7d11('0x3f')]=_0x3f33d9[_0x7d11('0x3f')]['length']?_0x3f33d9[_0x7d11('0x3f')]:_0xbe357[_0x7d11('0x3a')];if(_0xe5d2fe[_0x7d11('0x3b')]['includeAll']){_0x3f33d9['include']=[{'all':!![]}];}_0x3f33d9=_[_0x7d11('0x44')]({},_0x3f33d9,_0xe5d2fe[_0x7d11('0x46')]);return db[_0x7d11('0x48')]['find'](_0x3f33d9)['then'](handleEntityNotFound(_0x69dbd1,null))[_0x7d11('0x36')](respondWithResult(_0x69dbd1,null))[_0x7d11('0x4c')](handleError(_0x69dbd1,null));};exports['create']=function(_0x3a2102,_0x29dfad){return db[_0x7d11('0x48')][_0x7d11('0x4f')](_0x3a2102['body'],{})[_0x7d11('0x36')](function(_0x3e3083){var _0x4203df=_0x3a2102['user']['get']({'plain':!![]});if(!_0x4203df)throw new Error(_0x7d11('0x50'));if(_0x4203df[_0x7d11('0x51')]===_0x7d11('0x52')){var _0x1129db=_0x3e3083[_0x7d11('0x2b')]({'plain':!![]});var _0x4c7d7a=[{'name':_0x7d11('0x53'),'value':_0x7d11('0x2c')},{'name':_0x7d11('0x2d'),'value':_0x7d11('0x2e')}];var _0x55a400=_['find'](_0x4c7d7a,[_0x7d11('0x32'),_0x1129db[_0x7d11('0x34')]])[_0x7d11('0x35')];return db[_0x7d11('0x54')][_0x7d11('0x55')]({'where':{'name':_0x55a400,'userProfileId':_0x4203df[_0x7d11('0x56')]},'raw':!![]})[_0x7d11('0x36')](function(_0x3d6271){if(_0x3d6271&&_0x3d6271[_0x7d11('0x57')]===0x0){return db[_0x7d11('0x58')]['create']({'name':_0x1129db['name'],'resourceId':_0x1129db['id'],'type':_0x3d6271['name'],'sectionId':_0x3d6271['id']},{})[_0x7d11('0x36')](function(){return _0x3e3083;});}else{return _0x3e3083;}})[_0x7d11('0x4c')](function(_0x21da6a){logger['error'](_0x7d11('0x59'),_0x21da6a);throw _0x21da6a;});}return _0x3e3083;})[_0x7d11('0x36')](respondWithResult(_0x29dfad,0xc9))[_0x7d11('0x4c')](handleError(_0x29dfad,null));};exports[_0x7d11('0x5a')]=function(_0x1f29f7,_0x178a3a){var _0x505573={'where':{'id':_0x1f29f7[_0x7d11('0x4d')]['id']}},_0xef9bbc={};_0xef9bbc[_0x7d11('0x3a')]=_['keys'](db['VoiceQueue']['rawAttributes']);_0x505573['attributes']=_[_0x7d11('0x3e')](_0xef9bbc['model'],qs['fields'](_0x1f29f7['query'][_0x7d11('0x40')]));_0x505573[_0x7d11('0x3f')]=_0x505573[_0x7d11('0x3f')][_0x7d11('0x5b')]?_0x505573[_0x7d11('0x3f')]:_0xef9bbc[_0x7d11('0x3a')];if(_0x1f29f7['query'][_0x7d11('0x49')]){_0x505573['include']=[{'all':!![]}];}_0x505573=_[_0x7d11('0x44')]({},_0x505573,_0x1f29f7['options']);return db[_0x7d11('0x48')][_0x7d11('0x55')](_0x505573)['then'](handleEntityNotFound(_0x178a3a,null))[_0x7d11('0x36')](function(_0x49c9b6){if(_0x49c9b6){var _0x2581d5=_0x49c9b6[_0x7d11('0x2b')]({'plain':!![]});_0x2581d5=qs['omit'](_0x2581d5,['id','createdAt',_0x7d11('0x5c')]);_0x1f29f7[_0x7d11('0x5d')]=_[_0x7d11('0x5e')](_0x1f29f7[_0x7d11('0x5d')],['id',_0x7d11('0x5f'),'updatedAt']);return db[_0x7d11('0x48')]['create'](_[_0x7d11('0x44')](_0x2581d5,_0x1f29f7[_0x7d11('0x5d')]),{'include':_0x1f29f7[_0x7d11('0x3b')][_0x7d11('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x17a141){var _0x5246ca=_0x1f29f7[_0x7d11('0x52')][_0x7d11('0x2b')]({'plain':!![]});if(!_0x5246ca)throw new Error(_0x7d11('0x50'));if(_0x5246ca[_0x7d11('0x51')]===_0x7d11('0x52')){var _0x776b20=_0x17a141[_0x7d11('0x2b')]({'plain':!![]});var _0x390f08=[{'name':_0x7d11('0x53'),'value':_0x7d11('0x2c')},{'name':_0x7d11('0x2d'),'value':_0x7d11('0x2e')}];var _0x346250=_[_0x7d11('0x55')](_0x390f08,['value',_0x776b20[_0x7d11('0x34')]])['name'];return db[_0x7d11('0x54')]['find']({'where':{'name':_0x346250,'userProfileId':_0x5246ca[_0x7d11('0x56')]},'raw':!![]})[_0x7d11('0x36')](function(_0x362030){if(_0x362030&&_0x362030[_0x7d11('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x776b20[_0x7d11('0x35')],'resourceId':_0x776b20['id'],'type':_0x362030[_0x7d11('0x35')],'sectionId':_0x362030['id']},{})[_0x7d11('0x36')](function(){return _0x17a141;});}else{return _0x17a141;}})['catch'](function(_0x2e552c){logger[_0x7d11('0x60')](_0x7d11('0x59'),_0x2e552c);throw _0x2e552c;});}return _0x17a141;});}})[_0x7d11('0x36')](respondWithResult(_0x178a3a,0xc9))[_0x7d11('0x4c')](handleError(_0x178a3a,null));};exports[_0x7d11('0x29')]=function(_0x59f63f,_0xc63022){if(_0x59f63f['body']['id']){delete _0x59f63f[_0x7d11('0x5d')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x59f63f[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0xc63022,null))[_0x7d11('0x36')](saveUpdates(_0x59f63f[_0x7d11('0x5d')],null))[_0x7d11('0x36')](respondWithResult(_0xc63022,null))[_0x7d11('0x4c')](handleError(_0xc63022,null));};exports[_0x7d11('0x2a')]=function(_0x1fe34d,_0x109aa2){return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x1fe34d['params']['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x109aa2,null))['then'](removeEntity(_0x109aa2,null))[_0x7d11('0x4c')](handleError(_0x109aa2,null));};exports[_0x7d11('0x61')]=function(_0x13e58c,_0x34363f,_0x3af18d){var _0x3a7f06={'raw':![],'where':{}};var _0x1f852a={};var _0x58fba4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x7d11('0x62')]({'where':{'id':_0x13e58c[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x34363f,null))[_0x7d11('0x36')](function(_0x7edc36){if(_0x7edc36){_0x1f852a['model']=_[_0x7d11('0x3c')](db['CmHopper'][_0x7d11('0x4e')]);_0x1f852a[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x13e58c[_0x7d11('0x3b')]);_0x1f852a[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x1f852a[_0x7d11('0x3a')],_0x1f852a[_0x7d11('0x3b')]);_0x3a7f06['attributes']=_['intersection'](_0x1f852a[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0x13e58c[_0x7d11('0x3b')]['fields']));_0x3a7f06['attributes']=_0x3a7f06[_0x7d11('0x3f')]['length']?_0x3a7f06[_0x7d11('0x3f')]:_0x1f852a[_0x7d11('0x3a')];if(!_0x13e58c[_0x7d11('0x3b')][_0x7d11('0x41')]('nolimit')){_0x3a7f06[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x13e58c[_0x7d11('0x3b')][_0x7d11('0x22')]);_0x3a7f06[_0x7d11('0x23')]=qs[_0x7d11('0x23')](_0x13e58c[_0x7d11('0x3b')][_0x7d11('0x23')]);}_0x3a7f06['order']=qs[_0x7d11('0x42')](_0x13e58c[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x3a7f06[_0x7d11('0x47')]=qs[_0x7d11('0x3d')](_['pick'](_0x13e58c[_0x7d11('0x3b')],_0x1f852a[_0x7d11('0x3d')]));_0x3a7f06[_0x7d11('0x47')][_0x7d11('0x63')]=_0x7edc36['id'];if(_0x13e58c[_0x7d11('0x3b')]['filter']){_0x3a7f06['where']=_['merge'](_0x3a7f06[_0x7d11('0x47')],{'$or':_['map'](_0x3a7f06[_0x7d11('0x3f')],function(_0x5459d1){var _0x51824d={};_0x51824d[_0x5459d1]={'$like':'%'+_0x13e58c[_0x7d11('0x3b')][_0x7d11('0x2f')]+'%'};return _0x51824d;})});}_0x3a7f06=_[_0x7d11('0x44')]({},_0x3a7f06,_0x13e58c[_0x7d11('0x46')]);return db[_0x7d11('0x64')][_0x7d11('0x24')]({'where':_0x3a7f06[_0x7d11('0x47')]})[_0x7d11('0x36')](function(_0xd0d599){_0x58fba4[_0x7d11('0x24')]=_0xd0d599;if(_0x13e58c['query'][_0x7d11('0x49')]){_0x3a7f06[_0x7d11('0x4a')]=[{'all':!![]}];}return db['CmHopper'][_0x7d11('0x65')](_0x3a7f06);})[_0x7d11('0x36')](function(_0x19e4a9){_0x58fba4[_0x7d11('0x4b')]=_0x19e4a9;return _0x58fba4;});}})['then'](respondWithFilteredResult(_0x34363f,_0x3a7f06))['catch'](handleError(_0x34363f,null));};exports[_0x7d11('0x66')]=function(_0x55b723,_0xb576ec,_0x471bf4){var _0xa4317f={'raw':!![],'where':{}};var _0x13ccd5={};var _0x1565d9={'count':0x0,'rows':[]};return db[_0x7d11('0x48')][_0x7d11('0x62')]({'where':{'id':_0x55b723['params']['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0xb576ec,null))[_0x7d11('0x36')](function(_0x22121e){if(_0x22121e){_0x13ccd5[_0x7d11('0x3a')]=_['keys'](db[_0x7d11('0x67')][_0x7d11('0x4e')]);_0x13ccd5['query']=_[_0x7d11('0x3c')](_0x55b723[_0x7d11('0x3b')]);_0x13ccd5[_0x7d11('0x3d')]=_['intersection'](_0x13ccd5[_0x7d11('0x3a')],_0x13ccd5[_0x7d11('0x3b')]);_0xa4317f['attributes']=_[_0x7d11('0x3e')](_0x13ccd5[_0x7d11('0x3a')],qs['fields'](_0x55b723[_0x7d11('0x3b')]['fields']));_0xa4317f['attributes']=_0xa4317f['attributes']['length']?_0xa4317f[_0x7d11('0x3f')]:_0x13ccd5[_0x7d11('0x3a')];if(!_0x55b723[_0x7d11('0x3b')][_0x7d11('0x41')](_0x7d11('0x68'))){_0xa4317f[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x55b723[_0x7d11('0x3b')][_0x7d11('0x22')]);_0xa4317f[_0x7d11('0x23')]=qs['offset'](_0x55b723['query'][_0x7d11('0x23')]);}_0xa4317f[_0x7d11('0x69')]=qs['sort'](_0x55b723['query'][_0x7d11('0x42')]);_0xa4317f[_0x7d11('0x47')]=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x55b723['query'],_0x13ccd5['filters']));_0xa4317f['where'][_0x7d11('0x63')]=_0x22121e['id'];if(_0x55b723[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0xa4317f['where']=_[_0x7d11('0x44')](_0xa4317f[_0x7d11('0x47')],{'$or':_['map'](_0xa4317f[_0x7d11('0x3f')],function(_0x1cb457){var _0x59f0db={};_0x59f0db[_0x1cb457]={'$like':'%'+_0x55b723['query'][_0x7d11('0x2f')]+'%'};return _0x59f0db;})});}_0xa4317f=_[_0x7d11('0x44')]({},_0xa4317f,_0x55b723['options']);return db['CmHopperHistory'][_0x7d11('0x24')]({'where':_0xa4317f[_0x7d11('0x47')]})[_0x7d11('0x36')](function(_0x2aa13b){_0x1565d9['count']=_0x2aa13b;if(_0x55b723[_0x7d11('0x3b')][_0x7d11('0x49')]){_0xa4317f[_0x7d11('0x4a')]=[{'all':!![]}];}return db[_0x7d11('0x67')]['findAll'](_0xa4317f);})[_0x7d11('0x36')](function(_0x23fe57){_0x1565d9[_0x7d11('0x4b')]=_0x23fe57;return _0x1565d9;});}})['then'](respondWithFilteredResult(_0xb576ec,_0xa4317f))[_0x7d11('0x4c')](handleError(_0xb576ec,null));};exports['getHopperFinals']=function(_0x3b3a6b,_0x5b690f,_0x1a0e19){var _0x4409a9={'raw':!![],'where':{}};var _0x1fd09b={};var _0x1a548f={'count':0x0,'rows':[]};return db[_0x7d11('0x48')][_0x7d11('0x62')]({'where':{'id':_0x3b3a6b['params']['id']}})['then'](handleEntityNotFound(_0x5b690f,null))[_0x7d11('0x36')](function(_0x1191da){if(_0x1191da){_0x1fd09b[_0x7d11('0x3a')]=_[_0x7d11('0x3c')](db['CmHopperFinal'][_0x7d11('0x4e')]);_0x1fd09b[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x3b3a6b[_0x7d11('0x3b')]);_0x1fd09b['filters']=_[_0x7d11('0x3e')](_0x1fd09b[_0x7d11('0x3a')],_0x1fd09b[_0x7d11('0x3b')]);_0x4409a9[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0x1fd09b[_0x7d11('0x3a')],qs['fields'](_0x3b3a6b[_0x7d11('0x3b')]['fields']));_0x4409a9[_0x7d11('0x3f')]=_0x4409a9['attributes'][_0x7d11('0x5b')]?_0x4409a9[_0x7d11('0x3f')]:_0x1fd09b[_0x7d11('0x3a')];if(!_0x3b3a6b[_0x7d11('0x3b')][_0x7d11('0x41')](_0x7d11('0x68'))){_0x4409a9[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x3b3a6b[_0x7d11('0x3b')][_0x7d11('0x22')]);_0x4409a9['offset']=qs[_0x7d11('0x23')](_0x3b3a6b['query'][_0x7d11('0x23')]);}_0x4409a9[_0x7d11('0x69')]=qs[_0x7d11('0x42')](_0x3b3a6b[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x4409a9['where']=qs['filters'](_[_0x7d11('0x43')](_0x3b3a6b[_0x7d11('0x3b')],_0x1fd09b['filters']));_0x4409a9[_0x7d11('0x47')][_0x7d11('0x63')]=_0x1191da['id'];if(_0x3b3a6b[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x4409a9[_0x7d11('0x47')]=_['merge'](_0x4409a9['where'],{'$or':_['map'](_0x4409a9['attributes'],function(_0x2a71ed){var _0x454ed8={};_0x454ed8[_0x2a71ed]={'$like':'%'+_0x3b3a6b['query'][_0x7d11('0x2f')]+'%'};return _0x454ed8;})});}_0x4409a9=_[_0x7d11('0x44')]({},_0x4409a9,_0x3b3a6b[_0x7d11('0x46')]);return db[_0x7d11('0x6a')][_0x7d11('0x24')]({'where':_0x4409a9[_0x7d11('0x47')]})[_0x7d11('0x36')](function(_0x27920c){_0x1a548f['count']=_0x27920c;if(_0x3b3a6b[_0x7d11('0x3b')][_0x7d11('0x49')]){_0x4409a9['include']=[{'all':!![]}];}return db[_0x7d11('0x6a')][_0x7d11('0x65')](_0x4409a9);})[_0x7d11('0x36')](function(_0x3f0b22){_0x1a548f[_0x7d11('0x4b')]=_0x3f0b22;return _0x1a548f;});}})[_0x7d11('0x36')](respondWithFilteredResult(_0x5b690f,_0x4409a9))[_0x7d11('0x4c')](handleError(_0x5b690f,null));};exports[_0x7d11('0x6b')]=function(_0x3f7672,_0x1d960f,_0x17bc30){var _0xbb22b1={'raw':!![],'where':{}};var _0x5c4fcb={};var _0x487b89={'count':0x0,'rows':[]};return db[_0x7d11('0x48')][_0x7d11('0x62')]({'where':{'id':_0x3f7672[_0x7d11('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d960f,null))[_0x7d11('0x36')](function(_0x513a03){if(_0x513a03){_0x5c4fcb[_0x7d11('0x3a')]=_[_0x7d11('0x3c')](db[_0x7d11('0x6c')][_0x7d11('0x4e')]);_0x5c4fcb[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x3f7672[_0x7d11('0x3b')]);_0x5c4fcb[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x5c4fcb[_0x7d11('0x3a')],_0x5c4fcb[_0x7d11('0x3b')]);_0xbb22b1[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0x5c4fcb[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x40')]));_0xbb22b1[_0x7d11('0x3f')]=_0xbb22b1['attributes']['length']?_0xbb22b1[_0x7d11('0x3f')]:_0x5c4fcb[_0x7d11('0x3a')];if(!_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x41')](_0x7d11('0x68'))){_0xbb22b1['limit']=qs[_0x7d11('0x22')](_0x3f7672['query']['limit']);_0xbb22b1['offset']=qs['offset'](_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x23')]);}_0xbb22b1[_0x7d11('0x69')]=qs[_0x7d11('0x42')](_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x42')]);_0xbb22b1[_0x7d11('0x47')]=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x3f7672[_0x7d11('0x3b')],_0x5c4fcb[_0x7d11('0x3d')]));_0xbb22b1[_0x7d11('0x47')][_0x7d11('0x63')]=_0x513a03['id'];if(_0x3f7672['query']['filter']){_0xbb22b1['where']=_['merge'](_0xbb22b1['where'],{'$or':_[_0x7d11('0x31')](_0xbb22b1[_0x7d11('0x3f')],function(_0x3df27f){var _0x30df0a={};_0x30df0a[_0x3df27f]={'$like':'%'+_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x2f')]+'%'};return _0x30df0a;})});}_0xbb22b1=_[_0x7d11('0x44')]({},_0xbb22b1,_0x3f7672[_0x7d11('0x46')]);return db[_0x7d11('0x6c')][_0x7d11('0x24')]({'where':_0xbb22b1['where']})[_0x7d11('0x36')](function(_0x65785f){_0x487b89[_0x7d11('0x24')]=_0x65785f;if(_0x3f7672[_0x7d11('0x3b')][_0x7d11('0x49')]){_0xbb22b1[_0x7d11('0x4a')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7d11('0x65')](_0xbb22b1);})[_0x7d11('0x36')](function(_0x439387){_0x487b89[_0x7d11('0x4b')]=_0x439387;return _0x487b89;});}})['then'](respondWithFilteredResult(_0x1d960f,_0xbb22b1))[_0x7d11('0x4c')](handleError(_0x1d960f,null));};exports[_0x7d11('0x6d')]=function(_0x5e53c2,_0x4e3ce4,_0x3b0b3a){var _0x39af68={};var _0x586112={};var _0x806200;var _0x35b6c0;return db['VoiceQueue'][_0x7d11('0x62')]({'where':{'id':_0x5e53c2[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x4e3ce4,null))[_0x7d11('0x36')](function(_0x52fe71){if(_0x52fe71){_0x806200=_0x52fe71;_0x586112['model']=_[_0x7d11('0x3c')](db[_0x7d11('0x6e')][_0x7d11('0x4e')]);_0x586112[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x5e53c2['query']);_0x586112[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x586112[_0x7d11('0x3a')],_0x586112[_0x7d11('0x3b')]);_0x39af68['attributes']=_[_0x7d11('0x3e')](_0x586112[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0x5e53c2['query'][_0x7d11('0x40')]));_0x39af68[_0x7d11('0x3f')]=_0x39af68[_0x7d11('0x3f')]['length']?_0x39af68[_0x7d11('0x3f')]:_0x586112[_0x7d11('0x3a')];_0x39af68[_0x7d11('0x69')]=qs[_0x7d11('0x42')](_0x5e53c2[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x39af68[_0x7d11('0x47')]=qs['filters'](_[_0x7d11('0x43')](_0x5e53c2['query'],_0x586112[_0x7d11('0x3d')]));if(_0x5e53c2[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x39af68[_0x7d11('0x47')]=_['merge'](_0x39af68[_0x7d11('0x47')],{'$or':_['map'](_0x39af68['attributes'],function(_0x13b222){var _0x1ebd24={};_0x1ebd24[_0x13b222]={'$like':'%'+_0x5e53c2['query'][_0x7d11('0x2f')]+'%'};return _0x1ebd24;})});}_0x39af68=_['merge']({},_0x39af68,_0x5e53c2[_0x7d11('0x46')]);return _0x806200['getTeams'](_0x39af68);}})['then'](function(_0x231c80){if(_0x231c80){_0x35b6c0=_0x231c80['length'];if(!_0x5e53c2[_0x7d11('0x3b')][_0x7d11('0x41')]('nolimit')){_0x39af68[_0x7d11('0x22')]=qs['limit'](_0x5e53c2['query'][_0x7d11('0x22')]);_0x39af68['offset']=qs['offset'](_0x5e53c2['query'][_0x7d11('0x23')]);}return _0x806200[_0x7d11('0x6d')](_0x39af68);}})[_0x7d11('0x36')](function(_0x251805){if(_0x251805){return _0x251805?{'count':_0x35b6c0,'rows':_0x251805}:null;}})[_0x7d11('0x36')](respondWithResult(_0x4e3ce4,null))['catch'](handleError(_0x4e3ce4,null));};exports[_0x7d11('0x6f')]=function(_0x39a722,_0x30eb29,_0x36d3e1){var _0x164694=_0x39a722[_0x7d11('0x5d')]['teams'];var _0x2c2c80=_[_0x7d11('0x31')](_0x164694,'id');return db[_0x7d11('0x6e')][_0x7d11('0x65')]({'where':{'id':_0x2c2c80},'attributes':['id'],'include':[{'model':db[_0x7d11('0x70')],'as':_0x7d11('0x71'),'attributes':['id','name',_0x7d11('0x72'),_0x7d11('0x73'),_0x7d11('0x74')],'raw':!![]}]})['then'](function(_0x8cfdc8){if(_0x8cfdc8){var _0x3f8198=_[_0x7d11('0x75')](_0x8cfdc8,function(_0x5c53d0){var _0x384b54=_0x5c53d0[_0x7d11('0x2b')]({'plain':!![]});_0x384b54[_0x7d11('0x71')][_0x7d11('0x76')](function(_0x110a75){_0x110a75['penalty']=_[_0x7d11('0x55')](_0x164694,{'id':_0x384b54['id']})[_0x7d11('0x77')];});return _0x384b54[_0x7d11('0x71')];});return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x39a722['params']['id']}})['then'](function(_0x2a98f5){return db[_0x7d11('0x78')][_0x7d11('0x79')](function(_0x409fac){return _0x2a98f5[_0x7d11('0x6f')](_0x2c2c80,{'transaction':_0x409fac})[_0x7d11('0x36')](function(){return BPromise[_0x7d11('0x7a')](_0x164694,function(_0x14f0f1){return db[_0x7d11('0x7b')][_0x7d11('0x7c')]({'TeamId':_0x14f0f1['id'],'VoiceQueueId':_0x39a722[_0x7d11('0x4d')]['id'],'penalty':_0x14f0f1[_0x7d11('0x77')]},{'transaction':_0x409fac});});})['then'](function(){return BPromise['each'](_0x3f8198,function(_0x560358){return db[_0x7d11('0x7d')][_0x7d11('0x7e')]({'where':{'UserId':_0x560358['id'],'VoiceQueueId':_0x39a722[_0x7d11('0x4d')]['id']},'defaults':{'penalty':_0x560358[_0x7d11('0x77')]},'transaction':_0x409fac});});})[_0x7d11('0x36')](function(){return BPromise[_0x7d11('0x7a')](_[_0x7d11('0x2f')](_0x3f8198,{'online':!![]}),function(_0x27118a){return db[_0x7d11('0x7f')]['upsert']({'membername':_0x27118a[_0x7d11('0x35')],'UserId':_0x27118a['id'],'queue_name':_0x2a98f5[_0x7d11('0x35')],'VoiceQueueId':_0x2a98f5['id'],'interface':_[_0x7d11('0x80')](_0x27118a['interface'])?util[_0x7d11('0x81')](_0x7d11('0x82'),_0x27118a[_0x7d11('0x35')]):_0x27118a[_0x7d11('0x74')],'paused':_0x27118a[_0x7d11('0x73')]||![],'penalty':_0x27118a[_0x7d11('0x77')]},{'transaction':_0x409fac});});})['then'](function(){_0x3f8198[_0x7d11('0x76')](function(_0x50e62a){socket[_0x7d11('0x83')](_0x7d11('0x84'),{'UserId':_0x50e62a['id'],'VoiceQueueId':_0x2a98f5['id']});});});});});}})[_0x7d11('0x36')](respondWithStatusCode(_0x30eb29,null))[_0x7d11('0x4c')](handleError(_0x30eb29,null));};exports[_0x7d11('0x85')]=function(_0x47fd72,_0x492c4a,_0x5a143f){return db[_0x7d11('0x6e')][_0x7d11('0x65')]({'where':{'id':_0x47fd72[_0x7d11('0x3b')][_0x7d11('0x86')]},'attributes':['id'],'include':[{'model':db[_0x7d11('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x7d11('0x36')](handleEntityNotFound(_0x492c4a,null))[_0x7d11('0x36')](function(_0x51a9f9){var _0x29634c=_[_0x7d11('0x31')](_0x51a9f9,'id');var _0x45da8e=[];var _0x3d96dd=[];var _0x5aadcd=squel['select']();_0x5aadcd[_0x7d11('0x87')]('tq.TeamId')[_0x7d11('0x88')]('team_has_voice_queues','tq')[_0x7d11('0x89')](_0x7d11('0x8a'),'ut',_0x7d11('0x8b'))[_0x7d11('0x47')](_0x7d11('0x8c'),_0x47fd72[_0x7d11('0x4d')]['id']);for(var _0x59a94c=0x0;_0x59a94c<_0x51a9f9[_0x7d11('0x5b')];_0x59a94c+=0x1){let _0x3074c2=_0x51a9f9[_0x59a94c];for(var _0xf05034=0x0;_0xf05034<_0x3074c2['Agents'][_0x7d11('0x5b')];_0xf05034+=0x1){let _0x412016=_0x3074c2[_0x7d11('0x71')][_0xf05034];var _0x5891b4=_0x5aadcd[_0x7d11('0x5a')]();_0x5891b4[_0x7d11('0x47')](_0x7d11('0x8d'),_0x412016['id']);_0x3d96dd['push'](db[_0x7d11('0x78')][_0x7d11('0x3b')](_0x5891b4[_0x7d11('0x8e')](),{'type':db[_0x7d11('0x78')][_0x7d11('0x8f')][_0x7d11('0x90')]})[_0x7d11('0x36')](function(_0x257819){if(_0x257819[_0x7d11('0x5b')]===0x1){return _0x412016['id'];}else{var _0x3dbe19=_[_0x7d11('0x91')](_['map'](_0x257819,_0x7d11('0x92')),function(_0x15d350){return _[_0x7d11('0x33')](_0x29634c,_0x15d350);});if(_0x3dbe19){return _0x412016['id'];}}}));}}return BPromise['all'](_0x3d96dd)[_0x7d11('0x36')](function(_0x3f2372){_0x45da8e=_(_0x45da8e)[_0x7d11('0x93')](_0x3f2372)[_0x7d11('0x94')]()['value']();return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x47fd72[_0x7d11('0x4d')]['id']}})['then'](function(_0x1d8ac9){return db[_0x7d11('0x78')]['transaction'](function(_0x38e72d){return _0x1d8ac9[_0x7d11('0x85')](_0x47fd72[_0x7d11('0x3b')]['ids'],{'transaction':_0x38e72d})[_0x7d11('0x36')](function(){if(!_[_0x7d11('0x95')](_0x45da8e)){return _0x1d8ac9['removeAgents'](_0x45da8e,{'transaction':_0x38e72d})[_0x7d11('0x36')](function(){return db['UserVoiceQueueRt'][_0x7d11('0x2a')]({'where':{'VoiceQueueId':_0x47fd72[_0x7d11('0x4d')]['id'],'UserId':_0x45da8e},'transaction':_0x38e72d});});}})[_0x7d11('0x36')](function(){_0x45da8e[_0x7d11('0x76')](function(_0x22465a){socket['emit'](_0x7d11('0x96'),{'UserId':_0x22465a,'VoiceQueueId':_0x1d8ac9['id']});});});});});});})[_0x7d11('0x36')](respondWithStatusCode(_0x492c4a,null))[_0x7d11('0x4c')](handleError(_0x492c4a,null));};exports[_0x7d11('0x97')]=function(_0x2b19c5,_0x33ad03,_0x509163){var _0xd7c8cc,_0x508c61;return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x2b19c5['params']['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x33ad03,null))[_0x7d11('0x36')](function(_0x15bc6c){if(_0x15bc6c){_0x508c61=_0x15bc6c;return _0x15bc6c[_0x7d11('0x97')](_0x2b19c5[_0x7d11('0x5d')]['ids'],_['omit'](_0x2b19c5[_0x7d11('0x5d')],[_0x7d11('0x86'),'id'])||{})[_0x7d11('0x98')](function(_0x55829b){for(var _0x763482=0x0;_0x763482<_0x2b19c5[_0x7d11('0x5d')][_0x7d11('0x86')]['length'];_0x763482+=0x1){socket[_0x7d11('0x83')](_0x7d11('0x84'),{'UserId':Number(_0x2b19c5[_0x7d11('0x5d')][_0x7d11('0x86')][_0x763482]),'VoiceQueueId':Number(_0x2b19c5[_0x7d11('0x4d')]['id'])});}return _0x55829b;});}})[_0x7d11('0x36')](function(_0x2c9c5d){_0xd7c8cc=_0x2c9c5d||[];if(_0x508c61){return db[_0x7d11('0x70')][_0x7d11('0x65')]({'where':{'id':_0x2b19c5['body'][_0x7d11('0x86')]},'attributes':['id','name',_0x7d11('0x72'),_0x7d11('0x73'),'interface'],'raw':!![]});}})[_0x7d11('0x36')](function(_0x28b950){if(!_[_0x7d11('0x95')](_0x28b950)){var _0x47df13=[];for(var _0x63845a=0x0;_0x63845a<_0x28b950['length'];_0x63845a++){if(_0x28b950[_0x63845a][_0x7d11('0x72')]){_0x47df13['push'](db[_0x7d11('0x7f')][_0x7d11('0x7c')]({'membername':_0x28b950[_0x63845a]['name'],'UserId':_0x28b950[_0x63845a]['id'],'queue_name':_0x508c61['name'],'VoiceQueueId':_0x508c61['id'],'interface':_[_0x7d11('0x80')](_0x28b950[_0x63845a][_0x7d11('0x74')])?util['format'](_0x7d11('0x82'),_0x28b950[_0x63845a]['name']):_0x28b950[_0x63845a][_0x7d11('0x74')],'paused':_0x28b950[_0x63845a][_0x7d11('0x73')]||![],'penalty':_0x2b19c5[_0x7d11('0x5d')][_0x7d11('0x77')]||0x0}));}}return BPromise[_0x7d11('0x99')](_0x47df13);}})['then'](function(){return _0xd7c8cc;})[_0x7d11('0x36')](respondWithResult(_0x33ad03,null))['catch'](handleError(_0x33ad03,null));};exports[_0x7d11('0x9a')]=function(_0x549f7a,_0x5f302d,_0x5eb06e){return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x549f7a['params']['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x5f302d,null))[_0x7d11('0x36')](function(_0x5157f6){if(_0x5157f6){return _0x5157f6[_0x7d11('0x9a')](_0x549f7a[_0x7d11('0x3b')][_0x7d11('0x86')])[_0x7d11('0x36')](function(){if(_[_0x7d11('0x9b')](_0x549f7a[_0x7d11('0x3b')]['ids'])){for(var _0x5963bb=0x0;_0x5963bb<_0x549f7a['query'][_0x7d11('0x86')][_0x7d11('0x5b')];_0x5963bb+=0x1){socket[_0x7d11('0x83')](_0x7d11('0x96'),{'UserId':Number(_0x549f7a[_0x7d11('0x3b')][_0x7d11('0x86')][_0x5963bb]),'VoiceQueueId':Number(_0x549f7a[_0x7d11('0x4d')]['id'])});}}else{socket[_0x7d11('0x83')](_0x7d11('0x96'),{'UserId':Number(_0x549f7a[_0x7d11('0x3b')]['ids']),'VoiceQueueId':Number(_0x549f7a['params']['id'])});}});}})[_0x7d11('0x36')](function(_0x2a9a2e){return db[_0x7d11('0x7f')][_0x7d11('0x2a')]({'where':{'VoiceQueueId':_0x549f7a[_0x7d11('0x4d')]['id'],'UserId':_0x549f7a['query'][_0x7d11('0x86')]}})['then'](function(){return _0x2a9a2e;});})[_0x7d11('0x36')](respondWithStatusCode(_0x5f302d,null))['catch'](handleError(_0x5f302d,null));};exports[_0x7d11('0x9c')]=function(_0x363ec5,_0x542c6d,_0x5f1128){var _0x23ca57={};var _0x3c13ed={};var _0x30831b;var _0x460240;return db[_0x7d11('0x48')][_0x7d11('0x62')]({'where':{'id':_0x363ec5[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x542c6d,null))[_0x7d11('0x36')](function(_0x26a618){if(_0x26a618){_0x30831b=_0x26a618;_0x3c13ed[_0x7d11('0x3a')]=_[_0x7d11('0x3c')](db[_0x7d11('0x70')]['rawAttributes']);_0x3c13ed[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x363ec5['query']);_0x3c13ed['filters']=_[_0x7d11('0x3e')](_0x3c13ed['model'],_0x3c13ed[_0x7d11('0x3b')]);_0x23ca57[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0x3c13ed[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0x363ec5['query']['fields']));_0x23ca57['attributes']=_0x23ca57[_0x7d11('0x3f')]['length']?_0x23ca57['attributes']:_0x3c13ed['model'];_0x23ca57['order']=qs['sort'](_0x363ec5[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x23ca57['where']=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x363ec5[_0x7d11('0x3b')],_0x3c13ed['filters']));if(_0x363ec5[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x23ca57[_0x7d11('0x47')]=_[_0x7d11('0x44')](_0x23ca57[_0x7d11('0x47')],{'$or':_[_0x7d11('0x31')](_0x23ca57[_0x7d11('0x3f')],function(_0x9138c){var _0x566fc5={};_0x566fc5[_0x9138c]={'$like':'%'+_0x363ec5[_0x7d11('0x3b')]['filter']+'%'};return _0x566fc5;})});}_0x23ca57=_['merge']({},_0x23ca57,_0x363ec5['options']);return _0x30831b[_0x7d11('0x9c')](_0x23ca57);}})[_0x7d11('0x36')](function(_0x44b08c){if(_0x44b08c){_0x460240=_0x44b08c[_0x7d11('0x5b')];if(!_0x363ec5[_0x7d11('0x3b')][_0x7d11('0x41')]('nolimit')){_0x23ca57[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x363ec5[_0x7d11('0x3b')]['limit']);_0x23ca57[_0x7d11('0x23')]=qs['offset'](_0x363ec5[_0x7d11('0x3b')][_0x7d11('0x23')]);}return _0x30831b[_0x7d11('0x9c')](_0x23ca57);}})[_0x7d11('0x36')](function(_0x26b347){if(_0x26b347){return _0x26b347?{'count':_0x460240,'rows':_0x26b347}:null;}})[_0x7d11('0x36')](respondWithResult(_0x542c6d,null))[_0x7d11('0x4c')](handleError(_0x542c6d,null));};exports[_0x7d11('0x9d')]=function(_0x1f0c82,_0x3d7577,_0x10fbae){var _0x3a2ba3={};var _0x7cc9d9={};var _0x432ceb;var _0x2324fe;return db[_0x7d11('0x48')][_0x7d11('0x62')]({'where':{'id':_0x1f0c82['params']['id']}})['then'](handleEntityNotFound(_0x3d7577,null))['then'](function(_0x14b832){if(_0x14b832){_0x432ceb=_0x14b832;_0x7cc9d9['model']=_[_0x7d11('0x3c')](db[_0x7d11('0x7f')][_0x7d11('0x4e')]);_0x7cc9d9[_0x7d11('0x3b')]=_['keys'](_0x1f0c82[_0x7d11('0x3b')]);_0x7cc9d9[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x7cc9d9[_0x7d11('0x3a')],_0x7cc9d9[_0x7d11('0x3b')]);_0x3a2ba3[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0x7cc9d9['model'],qs[_0x7d11('0x40')](_0x1f0c82[_0x7d11('0x3b')][_0x7d11('0x40')]));_0x3a2ba3[_0x7d11('0x3f')]=_0x3a2ba3['attributes'][_0x7d11('0x5b')]?_0x3a2ba3[_0x7d11('0x3f')]:_0x7cc9d9['model'];_0x3a2ba3['order']=qs['sort'](_0x1f0c82[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x3a2ba3[_0x7d11('0x47')]=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x1f0c82['query'],_0x7cc9d9['filters']));if(_0x1f0c82[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x3a2ba3[_0x7d11('0x47')]=_[_0x7d11('0x44')](_0x3a2ba3[_0x7d11('0x47')],{'$or':_[_0x7d11('0x31')](_0x3a2ba3[_0x7d11('0x3f')],function(_0x1d5a10){var _0x5835a5={};_0x5835a5[_0x1d5a10]={'$like':'%'+_0x1f0c82[_0x7d11('0x3b')][_0x7d11('0x2f')]+'%'};return _0x5835a5;})});}_0x3a2ba3=_[_0x7d11('0x44')]({},_0x3a2ba3,_0x1f0c82[_0x7d11('0x46')]);return _0x432ceb[_0x7d11('0x9d')](_0x3a2ba3);}})[_0x7d11('0x36')](function(_0x5f4f7f){if(_0x5f4f7f){_0x2324fe=_0x5f4f7f[_0x7d11('0x5b')];if(!_0x1f0c82['query'][_0x7d11('0x41')](_0x7d11('0x68'))){_0x3a2ba3['limit']=qs['limit'](_0x1f0c82[_0x7d11('0x3b')]['limit']);_0x3a2ba3[_0x7d11('0x23')]=qs[_0x7d11('0x23')](_0x1f0c82[_0x7d11('0x3b')][_0x7d11('0x23')]);}return _0x432ceb['getMembers'](_0x3a2ba3);}})[_0x7d11('0x36')](function(_0x16f396){return _0x16f396?{'count':_0x2324fe,'rows':_0x16f396}:null;})[_0x7d11('0x36')](respondWithResult(_0x3d7577,null))[_0x7d11('0x4c')](handleError(_0x3d7577,null));};exports['getLists']=function(_0x2cd146,_0xb5ae2,_0x30afe1){var _0x18a533={};var _0x556c10={};var _0x3067ae;var _0x59730a;return db['VoiceQueue'][_0x7d11('0x62')]({'where':{'id':_0x2cd146[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0xb5ae2,null))[_0x7d11('0x36')](function(_0x5b77aa){if(_0x5b77aa){_0x3067ae=_0x5b77aa;_0x556c10[_0x7d11('0x3a')]=_[_0x7d11('0x3c')](db['CmList'][_0x7d11('0x4e')]);_0x556c10[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x2cd146[_0x7d11('0x3b')]);_0x556c10[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x556c10['model'],_0x556c10[_0x7d11('0x3b')]);_0x18a533[_0x7d11('0x3f')]=_[_0x7d11('0x3e')](_0x556c10[_0x7d11('0x3a')],qs[_0x7d11('0x40')](_0x2cd146['query']['fields']));_0x18a533['attributes']=_0x18a533[_0x7d11('0x3f')][_0x7d11('0x5b')]?_0x18a533[_0x7d11('0x3f')]:_0x556c10[_0x7d11('0x3a')];_0x18a533[_0x7d11('0x69')]=qs[_0x7d11('0x42')](_0x2cd146[_0x7d11('0x3b')][_0x7d11('0x42')]);_0x18a533[_0x7d11('0x47')]=qs[_0x7d11('0x3d')](_['pick'](_0x2cd146[_0x7d11('0x3b')],_0x556c10[_0x7d11('0x3d')]));if(_0x2cd146[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x18a533[_0x7d11('0x47')]=_[_0x7d11('0x44')](_0x18a533[_0x7d11('0x47')],{'$or':_[_0x7d11('0x31')](_0x18a533[_0x7d11('0x3f')],function(_0x505e85){var _0x557b4f={};_0x557b4f[_0x505e85]={'$like':'%'+_0x2cd146[_0x7d11('0x3b')][_0x7d11('0x2f')]+'%'};return _0x557b4f;})});}_0x18a533=_[_0x7d11('0x44')]({},_0x18a533,_0x2cd146['options']);return _0x3067ae[_0x7d11('0x9e')](_0x18a533);}})[_0x7d11('0x36')](function(_0x240290){if(_0x240290){_0x59730a=_0x240290[_0x7d11('0x5b')];if(!_0x2cd146['query'][_0x7d11('0x41')]('nolimit')){_0x18a533[_0x7d11('0x22')]=qs[_0x7d11('0x22')](_0x2cd146[_0x7d11('0x3b')][_0x7d11('0x22')]);_0x18a533[_0x7d11('0x23')]=qs[_0x7d11('0x23')](_0x2cd146[_0x7d11('0x3b')][_0x7d11('0x23')]);}return _0x3067ae[_0x7d11('0x9e')](_0x18a533);}})[_0x7d11('0x36')](function(_0x1cde90){if(_0x1cde90){return _0x1cde90?{'count':_0x59730a,'rows':_0x1cde90}:null;}})[_0x7d11('0x36')](respondWithResult(_0xb5ae2,null))[_0x7d11('0x4c')](handleError(_0xb5ae2,null));};exports[_0x7d11('0x9f')]=function(_0x13fffe,_0x407ac5,_0x4b119f){var _0xcc64bf=moment()[_0x7d11('0x81')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4277ba,_0x4be25f;return db[_0x7d11('0x48')][_0x7d11('0x55')]({'where':{'id':_0x13fffe[_0x7d11('0x4d')]['id']}})['then'](handleEntityNotFound(_0x407ac5,null))[_0x7d11('0x36')](function(_0x138ec0){if(_0x138ec0){_0x4be25f=_0x138ec0;return _0x138ec0['addLists'](_0x13fffe[_0x7d11('0x5d')][_0x7d11('0x86')],_[_0x7d11('0x5e')](_0x13fffe[_0x7d11('0x5d')],[_0x7d11('0x86'),'id'])||{});}return null;})[_0x7d11('0x98')](function(_0x58acc9){var _0x566964;_0x4277ba=_0x58acc9||[];var _0x5cf06a=[];if(_0x58acc9){for(var _0x3b7869=0x0;_0x3b7869<_0x58acc9[_0x7d11('0x5b')];_0x3b7869+=0x1){var _0x21eb3c=_0x58acc9[_0x3b7869]['get']({'plain':!![]});_0x4be25f[_0x7d11('0xa0')]=_0x13fffe[_0x7d11('0x5d')][_0x7d11('0xa0')]?_0x13fffe[_0x7d11('0x5d')][_0x7d11('0xa0')]:_0x4be25f['dialCheckDuplicateType'];switch(_0x4be25f[_0x7d11('0xa0')]){case _0x7d11('0xa1'):_0x566964=squel[_0x7d11('0xa2')]()[_0x7d11('0xa3')](_0x7d11('0xa4'))['fromQuery']([_0x7d11('0xa5'),_0x7d11('0xa6'),_0x7d11('0xa7'),_0x7d11('0xa8'),_0x7d11('0x63'),_0x7d11('0x5f'),_0x7d11('0x5c')],squel[_0x7d11('0xa9')]()[_0x7d11('0x87')](_0x7d11('0xa5'),_0x7d11('0xa5'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27','scheduledAt')[_0x7d11('0x87')]('id',_0x7d11('0xa7'))[_0x7d11('0x87')](_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')](),_0x7d11('0xa8'))[_0x7d11('0x87')](_0x13fffe['params']['id'][_0x7d11('0x8e')](),_0x7d11('0x63'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0x5f'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27','updatedAt')[_0x7d11('0x88')](_0x7d11('0xab'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')]())[_0x7d11('0x47')](_0x7d11('0xac'))[_0x7d11('0x47')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7d11('0x87')](_0x7d11('0xad'))['from'](_0x7d11('0xae'))[_0x7d11('0x47')](_0x7d11('0x8c'),_0x13fffe[_0x7d11('0x4d')]['id'][_0x7d11('0x8e')]()))[_0x7d11('0x47')](_0x7d11('0xaf'),squel[_0x7d11('0xa9')]()[_0x7d11('0x87')]('COALESCE(phone,\x27\x27)')['from'](_0x7d11('0xa4'))['where']('VoiceQueueId\x20=\x20?',_0x13fffe['params']['id'][_0x7d11('0x8e')]())))[_0x7d11('0x8e')]();break;case _0x7d11('0xb0'):_0x566964=squel[_0x7d11('0xa2')]()[_0x7d11('0xa3')](_0x7d11('0xa4'))[_0x7d11('0xb1')]([_0x7d11('0xa5'),'scheduledAt',_0x7d11('0xa7'),_0x7d11('0xa8'),'VoiceQueueId',_0x7d11('0x5f'),_0x7d11('0x5c')],squel[_0x7d11('0xa9')]()[_0x7d11('0x87')](_0x7d11('0xa5'),_0x7d11('0xa5'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0xa6'))[_0x7d11('0x87')]('id','ContactId')[_0x7d11('0x87')](_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')](),'ListId')[_0x7d11('0x87')](_0x13fffe['params']['id']['toString'](),_0x7d11('0x63'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27','createdAt')[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0x5c'))[_0x7d11('0x88')]('cm_contacts')[_0x7d11('0x47')](_0x7d11('0xb2'))[_0x7d11('0x47')](_0x7d11('0xb3'),_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')]())[_0x7d11('0x47')](_0x7d11('0xac'))[_0x7d11('0x47')](_0x7d11('0xaf'),squel[_0x7d11('0xa9')]()['field']('COALESCE(phone,\x27\x27)')[_0x7d11('0x88')](_0x7d11('0xa4'))['where'](_0x7d11('0x8c'),_0x13fffe[_0x7d11('0x4d')]['id'][_0x7d11('0x8e')]())))[_0x7d11('0x8e')]();break;default:_0x566964=squel[_0x7d11('0xa2')]()['into'](_0x7d11('0xa4'))[_0x7d11('0xb1')]([_0x7d11('0xa5'),_0x7d11('0xa6'),'ContactId',_0x7d11('0xa8'),_0x7d11('0x63'),_0x7d11('0x5f'),'updatedAt'],squel[_0x7d11('0xa9')]()['field'](_0x7d11('0xa5'),_0x7d11('0xa5'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0xa6'))[_0x7d11('0x87')]('id',_0x7d11('0xa7'))[_0x7d11('0x87')](_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')](),_0x7d11('0xa8'))[_0x7d11('0x87')](_0x13fffe['params']['id']['toString'](),_0x7d11('0x63'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0x5f'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0x5c'))[_0x7d11('0x88')](_0x7d11('0xab'))[_0x7d11('0x47')](_0x7d11('0xb2'))['where'](_0x7d11('0xb3'),_0x21eb3c[_0x7d11('0xaa')][_0x7d11('0x8e')]())[_0x7d11('0x47')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x5cf06a[_0x7d11('0xb4')](db[_0x7d11('0x78')][_0x7d11('0x3b')](_0x566964));}return BPromise[_0x7d11('0x99')](_0x5cf06a);}})['then'](function(){var _0x302758=[];var _0x223329=squel['insert']()[_0x7d11('0xa3')](_0x7d11('0xb5'))[_0x7d11('0xb1')](['CmHopperId',_0x7d11('0xa5'),_0x7d11('0xb6'),_0x7d11('0x5f'),_0x7d11('0x5c')],squel[_0x7d11('0xa9')]()['field']('h.id')['field']('ci.item')[_0x7d11('0x87')]('ci.OrderBy+1')[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27',_0x7d11('0x5f'))[_0x7d11('0x87')]('\x27'+_0xcc64bf+'\x27','updatedAt')[_0x7d11('0x88')](_0x7d11('0xb7'),'ci')[_0x7d11('0x89')](_0x7d11('0xa4'),'h',_0x7d11('0xb8'))[_0x7d11('0x47')](_0x7d11('0xb9'),_0xcc64bf)['where'](_0x7d11('0xba'),_0x7d11('0xbb')))[_0x7d11('0x8e')]();_0x302758['push'](db[_0x7d11('0x78')]['query'](_0x223329));return BPromise[_0x7d11('0x99')](_0x302758);})[_0x7d11('0x36')](function(){return _0x4277ba;})[_0x7d11('0x36')](respondWithResult(_0x407ac5,null))[_0x7d11('0x4c')](handleError(_0x407ac5,null));};exports[_0x7d11('0xbc')]=function(_0x4ab8c2,_0x1e42ca,_0xe090b1){return db['VoiceQueue'][_0x7d11('0x55')]({'where':{'id':_0x4ab8c2[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x1e42ca,null))['then'](function(_0x2b8813){if(_0x2b8813){return _0x2b8813[_0x7d11('0xbc')](_0x4ab8c2[_0x7d11('0x3b')][_0x7d11('0x86')]);}})[_0x7d11('0x36')](function(_0x100f44){if(_0x100f44){return db['CmHopper']['destroy']({'where':{'ListId':_0x4ab8c2['query']['ids'],'VoiceQueueId':_0x4ab8c2[_0x7d11('0x4d')]['id']}})['then'](function(){return _0x100f44;});}})[_0x7d11('0x36')](respondWithStatusCode(_0x1e42ca,null))[_0x7d11('0x4c')](handleError(_0x1e42ca,null));};exports[_0x7d11('0xbd')]=function(_0x105505,_0x5018bf,_0x27b942){var _0x189637={};var _0x17159c={};var _0x50f00d;var _0x4425ee;return db[_0x7d11('0x48')]['findOne']({'where':{'id':_0x105505[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](handleEntityNotFound(_0x5018bf,null))[_0x7d11('0x36')](function(_0x5d1f20){if(_0x5d1f20){_0x50f00d=_0x5d1f20;_0x17159c[_0x7d11('0x3a')]=_['keys'](db[_0x7d11('0xbe')][_0x7d11('0x4e')]);_0x17159c[_0x7d11('0x3b')]=_[_0x7d11('0x3c')](_0x105505['query']);_0x17159c[_0x7d11('0x3d')]=_[_0x7d11('0x3e')](_0x17159c['model'],_0x17159c[_0x7d11('0x3b')]);_0x189637[_0x7d11('0x3f')]=_['intersection'](_0x17159c['model'],qs[_0x7d11('0x40')](_0x105505[_0x7d11('0x3b')]['fields']));_0x189637[_0x7d11('0x3f')]=_0x189637[_0x7d11('0x3f')][_0x7d11('0x5b')]?_0x189637[_0x7d11('0x3f')]:_0x17159c[_0x7d11('0x3a')];_0x189637[_0x7d11('0x69')]=qs['sort'](_0x105505[_0x7d11('0x3b')]['sort']);_0x189637['where']=qs[_0x7d11('0x3d')](_[_0x7d11('0x43')](_0x105505[_0x7d11('0x3b')],_0x17159c[_0x7d11('0x3d')]));if(_0x105505[_0x7d11('0x3b')][_0x7d11('0x2f')]){_0x189637['where']=_['merge'](_0x189637[_0x7d11('0x47')],{'$or':_[_0x7d11('0x31')](_0x189637[_0x7d11('0x3f')],function(_0x507fc3){var _0x509d00={};_0x509d00[_0x507fc3]={'$like':'%'+_0x105505[_0x7d11('0x3b')]['filter']+'%'};return _0x509d00;})});}_0x189637=_[_0x7d11('0x44')]({},_0x189637,_0x105505[_0x7d11('0x46')]);return _0x50f00d[_0x7d11('0xbd')](_0x189637);}})['then'](function(_0x341ae5){if(_0x341ae5){_0x4425ee=_0x341ae5[_0x7d11('0x5b')];if(!_0x105505[_0x7d11('0x3b')][_0x7d11('0x41')](_0x7d11('0x68'))){_0x189637[_0x7d11('0x22')]=qs['limit'](_0x105505['query'][_0x7d11('0x22')]);_0x189637['offset']=qs[_0x7d11('0x23')](_0x105505[_0x7d11('0x3b')]['offset']);}return _0x50f00d['getBlackLists'](_0x189637);}})[_0x7d11('0x36')](function(_0x45563b){if(_0x45563b){return _0x45563b?{'count':_0x4425ee,'rows':_0x45563b}:null;}})['then'](respondWithResult(_0x5018bf,null))[_0x7d11('0x4c')](handleError(_0x5018bf,null));};exports[_0x7d11('0xbf')]=function(_0x54c3b3,_0x1dac54,_0x396cf1){var _0x114599,_0x3d3578;return db[_0x7d11('0x48')]['find']({'where':{'id':_0x54c3b3[_0x7d11('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1dac54,null))[_0x7d11('0x36')](function(_0x1b29d7){if(_0x1b29d7){_0x3d3578=_0x1b29d7;return _0x1b29d7['addBlackLists'](_0x54c3b3[_0x7d11('0x5d')]['ids'],_[_0x7d11('0x5e')](_0x54c3b3[_0x7d11('0x5d')],[_0x7d11('0x86'),'id'])||{});}return null;})['spread'](function(_0x13e9c3){var _0xcf9bb7;_0x114599=_0x13e9c3||[];var _0x4ad3f3=[];if(_0x13e9c3){for(var _0xb853c8=0x0;_0xb853c8<_0x13e9c3[_0x7d11('0x5b')];_0xb853c8+=0x1){var _0x2ef995=_0x13e9c3[_0xb853c8][_0x7d11('0x2b')]({'plain':!![]});_0xcf9bb7=squel[_0x7d11('0xa2')]()[_0x7d11('0xa3')](_0x7d11('0xc0'))[_0x7d11('0xb1')]([_0x7d11('0xa5'),_0x7d11('0xa7'),'ListId',_0x7d11('0x63'),'createdAt',_0x7d11('0x5c')],squel['select']()[_0x7d11('0x87')]('phone','phone')[_0x7d11('0x87')]('id',_0x7d11('0xa7'))['field'](_0x2ef995['CmListId'][_0x7d11('0x8e')](),'ListId')[_0x7d11('0x87')](_0x54c3b3[_0x7d11('0x4d')]['id']['toString'](),_0x7d11('0x63'))[_0x7d11('0x87')]('NOW()',_0x7d11('0x5f'))[_0x7d11('0x87')]('NOW()','updatedAt')[_0x7d11('0x88')](_0x7d11('0xab'))[_0x7d11('0x47')](_0x7d11('0xb2'))[_0x7d11('0x47')](_0x7d11('0xb3'),_0x2ef995[_0x7d11('0xaa')][_0x7d11('0x8e')]())[_0x7d11('0x47')](_0x7d11('0xac')))[_0x7d11('0x8e')]();_0x4ad3f3[_0x7d11('0xb4')](db[_0x7d11('0x78')][_0x7d11('0x3b')](_0xcf9bb7));}return BPromise[_0x7d11('0x99')](_0x4ad3f3);}})['then'](function(){return _0x114599;})['then'](respondWithResult(_0x1dac54,null))['catch'](handleError(_0x1dac54,null));};exports[_0x7d11('0xc1')]=function(_0x84a36c,_0x3ba303,_0x5d7fc4){return db[_0x7d11('0x48')]['find']({'where':{'id':_0x84a36c[_0x7d11('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3ba303,null))['then'](function(_0x59fc44){if(_0x59fc44){return _0x59fc44[_0x7d11('0xc1')](_0x84a36c['query'][_0x7d11('0x86')]);}})[_0x7d11('0x36')](function(_0x4cb884){if(_0x4cb884){return db[_0x7d11('0x6c')]['destroy']({'where':{'ListId':_0x84a36c[_0x7d11('0x3b')][_0x7d11('0x86')],'VoiceQueueId':_0x84a36c[_0x7d11('0x4d')]['id']}})[_0x7d11('0x36')](function(){return _0x4cb884;});}})['then'](respondWithStatusCode(_0x3ba303,null))['catch'](handleError(_0x3ba303,null));}; \ No newline at end of file +var _0x8c46=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./voiceQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','then','end','sendStatus','error','send','index','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','userProfileId','autoAssociation','findOne','CmHopper','order','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','User','Agents','online','interface','flatMap','forEach','penalty','transaction','each','upsert','findOrCreate','isNil','format','SIP/%s','voicePause','emit','Team','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','removeTeams','ids','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','push','all','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse'];(function(_0x1e1650,_0x442152){var _0x32554a=function(_0x299d70){while(--_0x299d70){_0x1e1650['push'](_0x1e1650['shift']());}};_0x32554a(++_0x442152);}(_0x8c46,0x171));var _0x68c4=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0x8c46[_0x57014b];return _0x2b258a;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];config['redis']=_[_0x68c4('0x16')](config[_0x68c4('0x17')],{'host':_0x68c4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x68c4('0x17')]));require(_0x68c4('0x19'))[_0x68c4('0x1a')](socket);function respondWithStatusCode(_0x52f031,_0x211793){_0x211793=_0x211793||0xcc;return function(_0x38fd57){if(_0x38fd57){return _0x52f031['sendStatus'](_0x211793);}return _0x52f031[_0x68c4('0x1b')](_0x211793)['end']();};}function respondWithResult(_0x1a7045,_0x556aa6){_0x556aa6=_0x556aa6||0xc8;return function(_0x5497bf){if(_0x5497bf){return _0x1a7045[_0x68c4('0x1b')](_0x556aa6)[_0x68c4('0x1c')](_0x5497bf);}};}function respondWithFilteredResult(_0x4f4797,_0x2d6c1b){return function(_0x1d757c){if(_0x1d757c){var _0x38ac38=typeof _0x2d6c1b[_0x68c4('0x1d')]===_0x68c4('0x1e')&&typeof _0x2d6c1b[_0x68c4('0x1f')]===_0x68c4('0x1e');var _0x415ef2=_0x1d757c[_0x68c4('0x20')];var _0x3befda=_0x38ac38?0x0:_0x2d6c1b[_0x68c4('0x1d')];var _0x58f87d=_0x38ac38?_0x1d757c[_0x68c4('0x20')]:_0x2d6c1b['offset']+_0x2d6c1b['limit'];var _0x34d3a6;if(_0x58f87d>=_0x415ef2){_0x58f87d=_0x415ef2;_0x34d3a6=0xc8;}else{_0x34d3a6=0xce;}_0x4f4797[_0x68c4('0x1b')](_0x34d3a6);return _0x4f4797[_0x68c4('0x21')](_0x68c4('0x22'),_0x3befda+'-'+_0x58f87d+'/'+_0x415ef2)['json'](_0x1d757c);}return null;};}function patchUpdates(_0x35e865){return function(_0x310bc6){try{jsonpatch['apply'](_0x310bc6,_0x35e865,!![]);}catch(_0x201742){return BPromise[_0x68c4('0x23')](_0x201742);}return _0x310bc6[_0x68c4('0x24')]();};}function saveUpdates(_0x10278e,_0x12ecd1){return function(_0x20e78b){if(_0x20e78b){return _0x20e78b[_0x68c4('0x25')](_0x10278e)['then'](function(_0x2ff4a5){return _0x2ff4a5;});}return null;};}function removeEntity(_0x55355d,_0xf16a78){return function(_0x10c67e){if(_0x10c67e){return _0x10c67e[_0x68c4('0x26')]()['then'](function(){var _0x1e14db=_0x10c67e[_0x68c4('0x27')]({'plain':!![]});var _0x496f4d=[{'name':_0x68c4('0x28'),'value':_0x68c4('0x29'),'ignore':![]},{'name':_0x68c4('0x2a'),'value':_0x68c4('0x2b'),'ignore':![]}];var _0x5589d6=_(_0x496f4d)[_0x68c4('0x2c')]('ignore')[_0x68c4('0x2d')](_0x68c4('0x2e'))['value']();if(_[_0x68c4('0x2f')](_0x5589d6,_0x1e14db[_0x68c4('0x30')])){return;}var _0x48e4bd=_[_0x68c4('0x31')](_0x496f4d,[_0x68c4('0x2e'),_0x1e14db[_0x68c4('0x30')]])[_0x68c4('0x32')];return db[_0x68c4('0x33')][_0x68c4('0x26')]({'where':{'type':_0x48e4bd,'resourceId':_0x1e14db['id']}})[_0x68c4('0x34')](function(){return _0x10c67e;});})[_0x68c4('0x34')](function(){_0x55355d[_0x68c4('0x1b')](0xcc)[_0x68c4('0x35')]();});}};}function handleEntityNotFound(_0x19bc4a,_0x925289){return function(_0x302237){if(!_0x302237){_0x19bc4a[_0x68c4('0x36')](0x194);}return _0x302237;};}function handleError(_0x3ce082,_0x3a3a75){_0x3a3a75=_0x3a3a75||0x1f4;return function(_0x33fcc7){logger[_0x68c4('0x37')](_0x33fcc7['stack']);if(_0x33fcc7[_0x68c4('0x32')]){delete _0x33fcc7[_0x68c4('0x32')];}_0x3ce082[_0x68c4('0x1b')](_0x3a3a75)[_0x68c4('0x38')](_0x33fcc7);};}exports[_0x68c4('0x39')]=function(_0x5a4e0c,_0x32fef0){var _0x4f4672={},_0x586e9c={},_0x4dcd5b={'count':0x0,'rows':[]};var _0xb86553=_[_0x68c4('0x2d')](db[_0x68c4('0x3a')][_0x68c4('0x3b')],function(_0x5953cc){return{'name':_0x5953cc[_0x68c4('0x3c')],'type':_0x5953cc[_0x68c4('0x30')][_0x68c4('0x3d')]};});_0x586e9c['model']=_[_0x68c4('0x2d')](_0xb86553,_0x68c4('0x32'));_0x586e9c[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0x5a4e0c[_0x68c4('0x3e')]);_0x586e9c[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x586e9c[_0x68c4('0x42')],_0x586e9c[_0x68c4('0x3e')]);_0x4f4672[_0x68c4('0x43')]=_['intersection'](_0x586e9c['model'],qs[_0x68c4('0x44')](_0x5a4e0c[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x4f4672[_0x68c4('0x43')]=_0x4f4672[_0x68c4('0x43')][_0x68c4('0x45')]?_0x4f4672[_0x68c4('0x43')]:_0x586e9c[_0x68c4('0x42')];if(!_0x5a4e0c[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x4f4672[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0x5a4e0c['query']['limit']);_0x4f4672[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0x5a4e0c[_0x68c4('0x3e')][_0x68c4('0x1d')]);}_0x4f4672['order']=qs[_0x68c4('0x48')](_0x5a4e0c[_0x68c4('0x3e')]['sort']);_0x4f4672['where']=qs['filters'](_[_0x68c4('0x49')](_0x5a4e0c['query'],_0x586e9c[_0x68c4('0x40')]),_0xb86553);if(_0x5a4e0c['query'][_0x68c4('0x2c')]){_0x4f4672[_0x68c4('0x4a')]=_[_0x68c4('0x4b')](_0x4f4672[_0x68c4('0x4a')],{'$or':_['map'](_0xb86553,function(_0x3d82be){if(_0x3d82be[_0x68c4('0x30')]!==_0x68c4('0x4c')){var _0x10cf85={};_0x10cf85[_0x3d82be['name']]={'$like':'%'+_0x5a4e0c[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x10cf85;}})});}_0x4f4672=_[_0x68c4('0x4b')]({},_0x4f4672,_0x5a4e0c[_0x68c4('0x4d')]);var _0x215183={'where':_0x4f4672['where']};return db['VoiceQueue']['count'](_0x215183)[_0x68c4('0x34')](function(_0x268bf4){_0x4dcd5b[_0x68c4('0x20')]=_0x268bf4;if(_0x5a4e0c[_0x68c4('0x3e')]['includeAll']){_0x4f4672[_0x68c4('0x4e')]=[{'all':!![]}];}return db[_0x68c4('0x3a')][_0x68c4('0x4f')](_0x4f4672);})[_0x68c4('0x34')](function(_0x25be7a){_0x4dcd5b[_0x68c4('0x50')]=_0x25be7a;return _0x4dcd5b;})[_0x68c4('0x34')](respondWithFilteredResult(_0x32fef0,_0x4f4672))[_0x68c4('0x51')](handleError(_0x32fef0,null));};exports[_0x68c4('0x52')]=function(_0x9d03e6,_0x1ba892){var _0x4eb9bb={'raw':![],'where':{'id':_0x9d03e6['params']['id']}},_0x1c5206={};_0x1c5206[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x3a')][_0x68c4('0x3b')]);_0x1c5206['query']=_[_0x68c4('0x3f')](_0x9d03e6['query']);_0x1c5206[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x1c5206['model'],_0x1c5206[_0x68c4('0x3e')]);_0x4eb9bb[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x1c5206[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x9d03e6[_0x68c4('0x3e')]['fields']));_0x4eb9bb[_0x68c4('0x43')]=_0x4eb9bb[_0x68c4('0x43')][_0x68c4('0x45')]?_0x4eb9bb[_0x68c4('0x43')]:_0x1c5206['model'];if(_0x9d03e6[_0x68c4('0x3e')][_0x68c4('0x53')]){_0x4eb9bb[_0x68c4('0x4e')]=[{'all':!![]}];}_0x4eb9bb=_[_0x68c4('0x4b')]({},_0x4eb9bb,_0x9d03e6[_0x68c4('0x4d')]);return db[_0x68c4('0x3a')]['find'](_0x4eb9bb)[_0x68c4('0x34')](handleEntityNotFound(_0x1ba892,null))[_0x68c4('0x34')](respondWithResult(_0x1ba892,null))[_0x68c4('0x51')](handleError(_0x1ba892,null));};exports['create']=function(_0x354035,_0x2e98b0){return db['VoiceQueue']['create'](_0x354035[_0x68c4('0x54')],{})[_0x68c4('0x34')](function(_0xa727fc){var _0x31eda2=_0x354035[_0x68c4('0x55')][_0x68c4('0x27')]({'plain':!![]});if(!_0x31eda2)throw new Error(_0x68c4('0x56'));if(_0x31eda2[_0x68c4('0x57')]==='user'){var _0xb62438=_0xa727fc['get']({'plain':!![]});var _0x59157e=[{'name':'VoiceQueues','value':_0x68c4('0x29')},{'name':_0x68c4('0x2a'),'value':_0x68c4('0x2b')}];var _0x50d030=_[_0x68c4('0x31')](_0x59157e,[_0x68c4('0x2e'),_0xb62438['type']])[_0x68c4('0x32')];return db['UserProfileSection'][_0x68c4('0x31')]({'where':{'name':_0x50d030,'userProfileId':_0x31eda2['userProfileId']},'raw':!![]})[_0x68c4('0x34')](function(_0x21bfb8){if(_0x21bfb8&&_0x21bfb8['autoAssociation']===0x0){return db[_0x68c4('0x33')][_0x68c4('0x58')]({'name':_0xb62438['name'],'resourceId':_0xb62438['id'],'type':_0x21bfb8[_0x68c4('0x32')],'sectionId':_0x21bfb8['id']},{})[_0x68c4('0x34')](function(){return _0xa727fc;});}else{return _0xa727fc;}})['catch'](function(_0x1511f0){logger[_0x68c4('0x37')](_0x68c4('0x59'),_0x1511f0);throw _0x1511f0;});}return _0xa727fc;})[_0x68c4('0x34')](respondWithResult(_0x2e98b0,0xc9))[_0x68c4('0x51')](handleError(_0x2e98b0,null));};exports[_0x68c4('0x5a')]=function(_0x1a2ede,_0x22424b){var _0x24bb5d={'where':{'id':_0x1a2ede[_0x68c4('0x5b')]['id']}},_0x52aa52={};_0x52aa52[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x3a')][_0x68c4('0x3b')]);_0x24bb5d[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x52aa52['model'],qs['fields'](_0x1a2ede[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x24bb5d['attributes']=_0x24bb5d[_0x68c4('0x43')][_0x68c4('0x45')]?_0x24bb5d[_0x68c4('0x43')]:_0x52aa52[_0x68c4('0x42')];if(_0x1a2ede[_0x68c4('0x3e')][_0x68c4('0x53')]){_0x24bb5d['include']=[{'all':!![]}];}_0x24bb5d=_[_0x68c4('0x4b')]({},_0x24bb5d,_0x1a2ede[_0x68c4('0x4d')]);return db[_0x68c4('0x3a')][_0x68c4('0x31')](_0x24bb5d)[_0x68c4('0x34')](handleEntityNotFound(_0x22424b,null))['then'](function(_0x4bb60c){if(_0x4bb60c){var _0x200dba=_0x4bb60c[_0x68c4('0x27')]({'plain':!![]});_0x200dba=qs[_0x68c4('0x5c')](_0x200dba,['id',_0x68c4('0x5d'),_0x68c4('0x5e')]);_0x1a2ede['body']=_[_0x68c4('0x5c')](_0x1a2ede[_0x68c4('0x54')],['id',_0x68c4('0x5d'),_0x68c4('0x5e')]);return db[_0x68c4('0x3a')][_0x68c4('0x58')](_[_0x68c4('0x4b')](_0x200dba,_0x1a2ede[_0x68c4('0x54')]),{'include':_0x1a2ede[_0x68c4('0x3e')][_0x68c4('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x418647){var _0x482e3e=_0x1a2ede[_0x68c4('0x55')][_0x68c4('0x27')]({'plain':!![]});if(!_0x482e3e)throw new Error(_0x68c4('0x56'));if(_0x482e3e['role']===_0x68c4('0x55')){var _0x4fa64d=_0x418647[_0x68c4('0x27')]({'plain':!![]});var _0x1a6594=[{'name':_0x68c4('0x28'),'value':_0x68c4('0x29')},{'name':_0x68c4('0x2a'),'value':'outbound'}];var _0x3882ca=_[_0x68c4('0x31')](_0x1a6594,[_0x68c4('0x2e'),_0x4fa64d[_0x68c4('0x30')]])[_0x68c4('0x32')];return db['UserProfileSection'][_0x68c4('0x31')]({'where':{'name':_0x3882ca,'userProfileId':_0x482e3e[_0x68c4('0x5f')]},'raw':!![]})[_0x68c4('0x34')](function(_0x550ed2){if(_0x550ed2&&_0x550ed2[_0x68c4('0x60')]===0x0){return db[_0x68c4('0x33')][_0x68c4('0x58')]({'name':_0x4fa64d['name'],'resourceId':_0x4fa64d['id'],'type':_0x550ed2[_0x68c4('0x32')],'sectionId':_0x550ed2['id']},{})['then'](function(){return _0x418647;});}else{return _0x418647;}})['catch'](function(_0x43af21){logger[_0x68c4('0x37')](_0x68c4('0x59'),_0x43af21);throw _0x43af21;});}return _0x418647;});}})['then'](respondWithResult(_0x22424b,0xc9))['catch'](handleError(_0x22424b,null));};exports[_0x68c4('0x25')]=function(_0x1ead72,_0x4b0788){if(_0x1ead72[_0x68c4('0x54')]['id']){delete _0x1ead72[_0x68c4('0x54')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x1ead72[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x4b0788,null))[_0x68c4('0x34')](saveUpdates(_0x1ead72[_0x68c4('0x54')],null))['then'](respondWithResult(_0x4b0788,null))[_0x68c4('0x51')](handleError(_0x4b0788,null));};exports['destroy']=function(_0x220ac8,_0x4208a4){return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0x220ac8[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x4208a4,null))[_0x68c4('0x34')](removeEntity(_0x4208a4,null))[_0x68c4('0x51')](handleError(_0x4208a4,null));};exports['getHoppers']=function(_0x2d4c32,_0x4a0f4e,_0x60af6f){var _0x2314b2={'raw':![],'where':{}};var _0xce0b25={};var _0x242b48={'count':0x0,'rows':[]};return db[_0x68c4('0x3a')][_0x68c4('0x61')]({'where':{'id':_0x2d4c32[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x4a0f4e,null))[_0x68c4('0x34')](function(_0x227358){if(_0x227358){_0xce0b25[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x62')][_0x68c4('0x3b')]);_0xce0b25[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0x2d4c32[_0x68c4('0x3e')]);_0xce0b25[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0xce0b25[_0x68c4('0x42')],_0xce0b25[_0x68c4('0x3e')]);_0x2314b2[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0xce0b25[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x2d4c32['query'][_0x68c4('0x44')]));_0x2314b2[_0x68c4('0x43')]=_0x2314b2['attributes'][_0x68c4('0x45')]?_0x2314b2[_0x68c4('0x43')]:_0xce0b25['model'];if(!_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x2314b2[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x2314b2['offset']=qs[_0x68c4('0x1d')](_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x1d')]);}_0x2314b2[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0x2d4c32['query']['sort']);_0x2314b2[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_[_0x68c4('0x49')](_0x2d4c32[_0x68c4('0x3e')],_0xce0b25[_0x68c4('0x40')]));_0x2314b2[_0x68c4('0x4a')]['VoiceQueueId']=_0x227358['id'];if(_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x2314b2['where']=_[_0x68c4('0x4b')](_0x2314b2[_0x68c4('0x4a')],{'$or':_[_0x68c4('0x2d')](_0x2314b2[_0x68c4('0x43')],function(_0x4645e9){var _0x3aebef={};_0x3aebef[_0x4645e9]={'$like':'%'+_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x3aebef;})});}_0x2314b2=_[_0x68c4('0x4b')]({},_0x2314b2,_0x2d4c32[_0x68c4('0x4d')]);return db[_0x68c4('0x62')][_0x68c4('0x20')]({'where':_0x2314b2[_0x68c4('0x4a')]})[_0x68c4('0x34')](function(_0x562722){_0x242b48['count']=_0x562722;if(_0x2d4c32[_0x68c4('0x3e')][_0x68c4('0x53')]){_0x2314b2[_0x68c4('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x2314b2);})[_0x68c4('0x34')](function(_0x2ec0af){_0x242b48['rows']=_0x2ec0af;return _0x242b48;});}})[_0x68c4('0x34')](respondWithFilteredResult(_0x4a0f4e,_0x2314b2))[_0x68c4('0x51')](handleError(_0x4a0f4e,null));};exports[_0x68c4('0x64')]=function(_0x141acd,_0x59f44a,_0x2a5570){var _0x3172dd={'raw':!![],'where':{}};var _0x281a26={};var _0x36e5dc={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x68c4('0x61')]({'where':{'id':_0x141acd[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x59f44a,null))[_0x68c4('0x34')](function(_0x2cbfad){if(_0x2cbfad){_0x281a26[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x65')]['rawAttributes']);_0x281a26['query']=_[_0x68c4('0x3f')](_0x141acd[_0x68c4('0x3e')]);_0x281a26[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x281a26[_0x68c4('0x42')],_0x281a26[_0x68c4('0x3e')]);_0x3172dd[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x281a26[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x141acd['query'][_0x68c4('0x44')]));_0x3172dd[_0x68c4('0x43')]=_0x3172dd['attributes'][_0x68c4('0x45')]?_0x3172dd[_0x68c4('0x43')]:_0x281a26[_0x68c4('0x42')];if(!_0x141acd['query'][_0x68c4('0x46')](_0x68c4('0x47'))){_0x3172dd['limit']=qs[_0x68c4('0x1f')](_0x141acd[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x3172dd[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0x141acd[_0x68c4('0x3e')][_0x68c4('0x1d')]);}_0x3172dd['order']=qs[_0x68c4('0x48')](_0x141acd['query'][_0x68c4('0x48')]);_0x3172dd[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_['pick'](_0x141acd[_0x68c4('0x3e')],_0x281a26[_0x68c4('0x40')]));_0x3172dd['where'][_0x68c4('0x66')]=_0x2cbfad['id'];if(_0x141acd[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x3172dd[_0x68c4('0x4a')]=_[_0x68c4('0x4b')](_0x3172dd['where'],{'$or':_[_0x68c4('0x2d')](_0x3172dd[_0x68c4('0x43')],function(_0x580c01){var _0x27f038={};_0x27f038[_0x580c01]={'$like':'%'+_0x141acd[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x27f038;})});}_0x3172dd=_[_0x68c4('0x4b')]({},_0x3172dd,_0x141acd[_0x68c4('0x4d')]);return db['CmHopperHistory'][_0x68c4('0x20')]({'where':_0x3172dd[_0x68c4('0x4a')]})[_0x68c4('0x34')](function(_0x14f058){_0x36e5dc[_0x68c4('0x20')]=_0x14f058;if(_0x141acd['query']['includeAll']){_0x3172dd[_0x68c4('0x4e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x68c4('0x4f')](_0x3172dd);})[_0x68c4('0x34')](function(_0x34e3a2){_0x36e5dc[_0x68c4('0x50')]=_0x34e3a2;return _0x36e5dc;});}})[_0x68c4('0x34')](respondWithFilteredResult(_0x59f44a,_0x3172dd))[_0x68c4('0x51')](handleError(_0x59f44a,null));};exports[_0x68c4('0x67')]=function(_0xf08f80,_0x2f671c,_0x51d2dd){var _0x340634={'raw':!![],'where':{}};var _0x2313a2={};var _0x33c4fb={'count':0x0,'rows':[]};return db[_0x68c4('0x3a')][_0x68c4('0x61')]({'where':{'id':_0xf08f80['params']['id']}})['then'](handleEntityNotFound(_0x2f671c,null))[_0x68c4('0x34')](function(_0x3154da){if(_0x3154da){_0x2313a2[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x68')][_0x68c4('0x3b')]);_0x2313a2[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0xf08f80[_0x68c4('0x3e')]);_0x2313a2['filters']=_[_0x68c4('0x41')](_0x2313a2[_0x68c4('0x42')],_0x2313a2[_0x68c4('0x3e')]);_0x340634[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x2313a2[_0x68c4('0x42')],qs['fields'](_0xf08f80[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x340634[_0x68c4('0x43')]=_0x340634[_0x68c4('0x43')][_0x68c4('0x45')]?_0x340634[_0x68c4('0x43')]:_0x2313a2[_0x68c4('0x42')];if(!_0xf08f80[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x340634[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0xf08f80['query'][_0x68c4('0x1f')]);_0x340634[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0xf08f80[_0x68c4('0x3e')][_0x68c4('0x1d')]);}_0x340634[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0xf08f80[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x340634[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_[_0x68c4('0x49')](_0xf08f80[_0x68c4('0x3e')],_0x2313a2['filters']));_0x340634[_0x68c4('0x4a')][_0x68c4('0x66')]=_0x3154da['id'];if(_0xf08f80['query'][_0x68c4('0x2c')]){_0x340634[_0x68c4('0x4a')]=_[_0x68c4('0x4b')](_0x340634[_0x68c4('0x4a')],{'$or':_[_0x68c4('0x2d')](_0x340634[_0x68c4('0x43')],function(_0x10686a){var _0x25508e={};_0x25508e[_0x10686a]={'$like':'%'+_0xf08f80['query'][_0x68c4('0x2c')]+'%'};return _0x25508e;})});}_0x340634=_['merge']({},_0x340634,_0xf08f80[_0x68c4('0x4d')]);return db[_0x68c4('0x68')][_0x68c4('0x20')]({'where':_0x340634['where']})[_0x68c4('0x34')](function(_0x1419fb){_0x33c4fb[_0x68c4('0x20')]=_0x1419fb;if(_0xf08f80['query'][_0x68c4('0x53')]){_0x340634['include']=[{'all':!![]}];}return db[_0x68c4('0x68')][_0x68c4('0x4f')](_0x340634);})[_0x68c4('0x34')](function(_0x567979){_0x33c4fb[_0x68c4('0x50')]=_0x567979;return _0x33c4fb;});}})[_0x68c4('0x34')](respondWithFilteredResult(_0x2f671c,_0x340634))[_0x68c4('0x51')](handleError(_0x2f671c,null));};exports[_0x68c4('0x69')]=function(_0x28839e,_0x1c545c,_0x57b5cd){var _0x643ed4={'raw':!![],'where':{}};var _0x52d4e3={};var _0x442171={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x68c4('0x61')]({'where':{'id':_0x28839e['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x1c545c,null))['then'](function(_0x92fe39){if(_0x92fe39){_0x52d4e3[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db['CmHopperBlack'][_0x68c4('0x3b')]);_0x52d4e3[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0x28839e[_0x68c4('0x3e')]);_0x52d4e3['filters']=_[_0x68c4('0x41')](_0x52d4e3[_0x68c4('0x42')],_0x52d4e3[_0x68c4('0x3e')]);_0x643ed4[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x52d4e3[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x28839e['query'][_0x68c4('0x44')]));_0x643ed4['attributes']=_0x643ed4[_0x68c4('0x43')][_0x68c4('0x45')]?_0x643ed4['attributes']:_0x52d4e3[_0x68c4('0x42')];if(!_0x28839e[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x643ed4[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0x28839e['query'][_0x68c4('0x1f')]);_0x643ed4['offset']=qs[_0x68c4('0x1d')](_0x28839e[_0x68c4('0x3e')]['offset']);}_0x643ed4[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0x28839e[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x643ed4[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_['pick'](_0x28839e[_0x68c4('0x3e')],_0x52d4e3[_0x68c4('0x40')]));_0x643ed4[_0x68c4('0x4a')][_0x68c4('0x66')]=_0x92fe39['id'];if(_0x28839e[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x643ed4[_0x68c4('0x4a')]=_['merge'](_0x643ed4[_0x68c4('0x4a')],{'$or':_[_0x68c4('0x2d')](_0x643ed4[_0x68c4('0x43')],function(_0x23b1fa){var _0x4194ed={};_0x4194ed[_0x23b1fa]={'$like':'%'+_0x28839e[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x4194ed;})});}_0x643ed4=_[_0x68c4('0x4b')]({},_0x643ed4,_0x28839e[_0x68c4('0x4d')]);return db[_0x68c4('0x6a')][_0x68c4('0x20')]({'where':_0x643ed4[_0x68c4('0x4a')]})[_0x68c4('0x34')](function(_0x2d7f6b){_0x442171[_0x68c4('0x20')]=_0x2d7f6b;if(_0x28839e[_0x68c4('0x3e')][_0x68c4('0x53')]){_0x643ed4[_0x68c4('0x4e')]=[{'all':!![]}];}return db[_0x68c4('0x6a')][_0x68c4('0x4f')](_0x643ed4);})[_0x68c4('0x34')](function(_0x2337c5){_0x442171[_0x68c4('0x50')]=_0x2337c5;return _0x442171;});}})[_0x68c4('0x34')](respondWithFilteredResult(_0x1c545c,_0x643ed4))['catch'](handleError(_0x1c545c,null));};exports[_0x68c4('0x6b')]=function(_0xcfff56,_0x5a4431,_0x1b2d21){var _0x28d484={};var _0x5f5c87={};var _0x224b46;var _0x54f69a;return db[_0x68c4('0x3a')][_0x68c4('0x61')]({'where':{'id':_0xcfff56[_0x68c4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5a4431,null))['then'](function(_0x45332b){if(_0x45332b){_0x224b46=_0x45332b;_0x5f5c87[_0x68c4('0x42')]=_['keys'](db['Team'][_0x68c4('0x3b')]);_0x5f5c87[_0x68c4('0x3e')]=_['keys'](_0xcfff56[_0x68c4('0x3e')]);_0x5f5c87[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x5f5c87[_0x68c4('0x42')],_0x5f5c87[_0x68c4('0x3e')]);_0x28d484[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x5f5c87['model'],qs['fields'](_0xcfff56['query']['fields']));_0x28d484[_0x68c4('0x43')]=_0x28d484[_0x68c4('0x43')][_0x68c4('0x45')]?_0x28d484[_0x68c4('0x43')]:_0x5f5c87[_0x68c4('0x42')];_0x28d484[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x28d484['where']=qs[_0x68c4('0x40')](_['pick'](_0xcfff56[_0x68c4('0x3e')],_0x5f5c87[_0x68c4('0x40')]));if(_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x28d484[_0x68c4('0x4a')]=_['merge'](_0x28d484[_0x68c4('0x4a')],{'$or':_['map'](_0x28d484[_0x68c4('0x43')],function(_0x4b7d22){var _0x11b33e={};_0x11b33e[_0x4b7d22]={'$like':'%'+_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x11b33e;})});}_0x28d484=_['merge']({},_0x28d484,_0xcfff56['options']);return _0x224b46['getTeams'](_0x28d484);}})[_0x68c4('0x34')](function(_0x5abcc4){if(_0x5abcc4){_0x54f69a=_0x5abcc4[_0x68c4('0x45')];if(!_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x28d484[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x28d484[_0x68c4('0x1d')]=qs['offset'](_0xcfff56[_0x68c4('0x3e')][_0x68c4('0x1d')]);}return _0x224b46[_0x68c4('0x6b')](_0x28d484);}})['then'](function(_0x563f64){if(_0x563f64){return _0x563f64?{'count':_0x54f69a,'rows':_0x563f64}:null;}})[_0x68c4('0x34')](respondWithResult(_0x5a4431,null))[_0x68c4('0x51')](handleError(_0x5a4431,null));};exports['addTeams']=function(_0x47551d,_0x69c698,_0x58ec57){var _0x321c91=_0x47551d['body'][_0x68c4('0x6c')];var _0x18a99e=_[_0x68c4('0x2d')](_0x321c91,'id');return db['Team'][_0x68c4('0x4f')]({'where':{'id':_0x18a99e},'attributes':['id'],'include':[{'model':db[_0x68c4('0x6d')],'as':_0x68c4('0x6e'),'attributes':['id',_0x68c4('0x32'),_0x68c4('0x6f'),'voicePause',_0x68c4('0x70')],'raw':!![]}]})['then'](function(_0x317d54){if(_0x317d54){var _0xb218aa=_[_0x68c4('0x71')](_0x317d54,function(_0x366836){var _0x32b8ec=_0x366836['get']({'plain':!![]});_0x32b8ec['Agents'][_0x68c4('0x72')](function(_0x3a9b30){_0x3a9b30[_0x68c4('0x73')]=_[_0x68c4('0x31')](_0x321c91,{'id':_0x32b8ec['id']})[_0x68c4('0x73')];});return _0x32b8ec['Agents'];});return db['VoiceQueue'][_0x68c4('0x31')]({'where':{'id':_0x47551d['params']['id']}})['then'](function(_0x1f64bb){return db['sequelize'][_0x68c4('0x74')](function(_0xdd470){return _0x1f64bb['addTeams'](_0x18a99e,{'transaction':_0xdd470})[_0x68c4('0x34')](function(){return BPromise[_0x68c4('0x75')](_0x321c91,function(_0x13cf3a){return db['TeamVoiceQueue'][_0x68c4('0x76')]({'TeamId':_0x13cf3a['id'],'VoiceQueueId':_0x47551d[_0x68c4('0x5b')]['id'],'penalty':_0x13cf3a[_0x68c4('0x73')]},{'transaction':_0xdd470});});})[_0x68c4('0x34')](function(){return BPromise[_0x68c4('0x75')](_0xb218aa,function(_0x23d953){return db['UserVoiceQueue'][_0x68c4('0x77')]({'where':{'UserId':_0x23d953['id'],'VoiceQueueId':_0x47551d[_0x68c4('0x5b')]['id']},'defaults':{'penalty':_0x23d953[_0x68c4('0x73')]},'transaction':_0xdd470});});})[_0x68c4('0x34')](function(){return BPromise[_0x68c4('0x75')](_[_0x68c4('0x2c')](_0xb218aa,{'online':!![]}),function(_0x424b09){return db['UserVoiceQueueRt'][_0x68c4('0x76')]({'membername':_0x424b09[_0x68c4('0x32')],'UserId':_0x424b09['id'],'queue_name':_0x1f64bb[_0x68c4('0x32')],'VoiceQueueId':_0x1f64bb['id'],'interface':_[_0x68c4('0x78')](_0x424b09[_0x68c4('0x70')])?util[_0x68c4('0x79')](_0x68c4('0x7a'),_0x424b09[_0x68c4('0x32')]):_0x424b09[_0x68c4('0x70')],'paused':_0x424b09[_0x68c4('0x7b')]||![],'penalty':_0x424b09[_0x68c4('0x73')]},{'transaction':_0xdd470});});})['then'](function(){_0xb218aa[_0x68c4('0x72')](function(_0x2622d5){socket[_0x68c4('0x7c')]('userVoiceQueue:save',{'UserId':_0x2622d5['id'],'VoiceQueueId':_0x1f64bb['id']});});});});});}})[_0x68c4('0x34')](respondWithStatusCode(_0x69c698,null))[_0x68c4('0x51')](handleError(_0x69c698,null));};exports['removeTeams']=function(_0xb5cc8,_0x44ed2d,_0x31d3ce){return db[_0x68c4('0x7d')][_0x68c4('0x4f')]({'where':{'id':_0xb5cc8[_0x68c4('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0x68c4('0x6d')],'as':_0x68c4('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x44ed2d,null))['then'](function(_0x28dcc4){var _0xffc880=_[_0x68c4('0x2d')](_0x28dcc4,'id');var _0x367bf5=[];var _0x5758bd=[];var _0x5e338a=squel['select']();_0x5e338a[_0x68c4('0x7e')]('tq.TeamId')[_0x68c4('0x7f')](_0x68c4('0x80'),'tq')[_0x68c4('0x81')](_0x68c4('0x82'),'ut',_0x68c4('0x83'))['where'](_0x68c4('0x84'),_0xb5cc8[_0x68c4('0x5b')]['id']);for(var _0x324b7b=0x0;_0x324b7b<_0x28dcc4['length'];_0x324b7b+=0x1){let _0x299cb2=_0x28dcc4[_0x324b7b];for(var _0xf58301=0x0;_0xf58301<_0x299cb2[_0x68c4('0x6e')][_0x68c4('0x45')];_0xf58301+=0x1){let _0x433d01=_0x299cb2[_0x68c4('0x6e')][_0xf58301];var _0x15e67c=_0x5e338a[_0x68c4('0x5a')]();_0x15e67c[_0x68c4('0x4a')](_0x68c4('0x85'),_0x433d01['id']);_0x5758bd['push'](db[_0x68c4('0x86')][_0x68c4('0x3e')](_0x15e67c['toString'](),{'type':db['sequelize'][_0x68c4('0x87')][_0x68c4('0x88')]})['then'](function(_0x1697bb){if(_0x1697bb[_0x68c4('0x45')]===0x1){return _0x433d01['id'];}else{var _0x575880=_[_0x68c4('0x89')](_[_0x68c4('0x2d')](_0x1697bb,_0x68c4('0x8a')),function(_0x2501eb){return _['includes'](_0xffc880,_0x2501eb);});if(_0x575880){return _0x433d01['id'];}}}));}}return BPromise['all'](_0x5758bd)['then'](function(_0x52a09c){_0x367bf5=_(_0x367bf5)[_0x68c4('0x8b')](_0x52a09c)[_0x68c4('0x8c')]()[_0x68c4('0x2e')]();return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0xb5cc8[_0x68c4('0x5b')]['id']}})['then'](function(_0x27a611){return db[_0x68c4('0x86')][_0x68c4('0x74')](function(_0x522239){return _0x27a611[_0x68c4('0x8d')](_0xb5cc8[_0x68c4('0x3e')][_0x68c4('0x8e')],{'transaction':_0x522239})[_0x68c4('0x34')](function(){if(!_[_0x68c4('0x8f')](_0x367bf5)){return _0x27a611[_0x68c4('0x90')](_0x367bf5,{'transaction':_0x522239})[_0x68c4('0x34')](function(){return db[_0x68c4('0x91')][_0x68c4('0x26')]({'where':{'VoiceQueueId':_0xb5cc8['params']['id'],'UserId':_0x367bf5},'transaction':_0x522239});});}})['then'](function(){_0x367bf5[_0x68c4('0x72')](function(_0x3eb8fe){socket[_0x68c4('0x7c')](_0x68c4('0x92'),{'UserId':_0x3eb8fe,'VoiceQueueId':_0x27a611['id']});});});});});});})['then'](respondWithStatusCode(_0x44ed2d,null))[_0x68c4('0x51')](handleError(_0x44ed2d,null));};exports[_0x68c4('0x93')]=function(_0x1a7057,_0x2d6c9a,_0x5a75fd){var _0x51d63d,_0x22276a;return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0x1a7057[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x2d6c9a,null))['then'](function(_0x3eae09){if(_0x3eae09){_0x22276a=_0x3eae09;return _0x3eae09[_0x68c4('0x93')](_0x1a7057[_0x68c4('0x54')][_0x68c4('0x8e')],_[_0x68c4('0x5c')](_0x1a7057['body'],[_0x68c4('0x8e'),'id'])||{})['spread'](function(_0x5343f1){for(var _0x2a515a=0x0;_0x2a515a<_0x1a7057[_0x68c4('0x54')]['ids'][_0x68c4('0x45')];_0x2a515a+=0x1){socket[_0x68c4('0x7c')]('userVoiceQueue:save',{'UserId':Number(_0x1a7057[_0x68c4('0x54')]['ids'][_0x2a515a]),'VoiceQueueId':Number(_0x1a7057[_0x68c4('0x5b')]['id'])});}return _0x5343f1;});}})[_0x68c4('0x34')](function(_0x4769d0){_0x51d63d=_0x4769d0||[];if(_0x22276a){return db[_0x68c4('0x6d')][_0x68c4('0x4f')]({'where':{'id':_0x1a7057[_0x68c4('0x54')]['ids']},'attributes':['id',_0x68c4('0x32'),_0x68c4('0x6f'),_0x68c4('0x7b'),_0x68c4('0x70')],'raw':!![]});}})['then'](function(_0x525c3f){if(!_[_0x68c4('0x8f')](_0x525c3f)){var _0x38ff95=[];for(var _0x4db93c=0x0;_0x4db93c<_0x525c3f['length'];_0x4db93c++){if(_0x525c3f[_0x4db93c]['online']){_0x38ff95[_0x68c4('0x94')](db['UserVoiceQueueRt'][_0x68c4('0x76')]({'membername':_0x525c3f[_0x4db93c][_0x68c4('0x32')],'UserId':_0x525c3f[_0x4db93c]['id'],'queue_name':_0x22276a[_0x68c4('0x32')],'VoiceQueueId':_0x22276a['id'],'interface':_['isNil'](_0x525c3f[_0x4db93c]['interface'])?util[_0x68c4('0x79')](_0x68c4('0x7a'),_0x525c3f[_0x4db93c][_0x68c4('0x32')]):_0x525c3f[_0x4db93c][_0x68c4('0x70')],'paused':_0x525c3f[_0x4db93c][_0x68c4('0x7b')]||![],'penalty':_0x1a7057[_0x68c4('0x54')][_0x68c4('0x73')]||0x0}));}}return BPromise[_0x68c4('0x95')](_0x38ff95);}})['then'](function(){return _0x51d63d;})[_0x68c4('0x34')](respondWithResult(_0x2d6c9a,null))[_0x68c4('0x51')](handleError(_0x2d6c9a,null));};exports[_0x68c4('0x90')]=function(_0x5afc0a,_0x47f307,_0x2cc6ae){return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0x5afc0a['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x47f307,null))[_0x68c4('0x34')](function(_0x32a565){if(_0x32a565){return _0x32a565[_0x68c4('0x90')](_0x5afc0a[_0x68c4('0x3e')][_0x68c4('0x8e')])[_0x68c4('0x34')](function(){if(_['isArray'](_0x5afc0a[_0x68c4('0x3e')]['ids'])){for(var _0x410973=0x0;_0x410973<_0x5afc0a[_0x68c4('0x3e')][_0x68c4('0x8e')][_0x68c4('0x45')];_0x410973+=0x1){socket[_0x68c4('0x7c')]('userVoiceQueue:remove',{'UserId':Number(_0x5afc0a[_0x68c4('0x3e')][_0x68c4('0x8e')][_0x410973]),'VoiceQueueId':Number(_0x5afc0a[_0x68c4('0x5b')]['id'])});}}else{socket['emit'](_0x68c4('0x92'),{'UserId':Number(_0x5afc0a[_0x68c4('0x3e')][_0x68c4('0x8e')]),'VoiceQueueId':Number(_0x5afc0a[_0x68c4('0x5b')]['id'])});}});}})[_0x68c4('0x34')](function(_0x3f4c7b){return db['UserVoiceQueueRt'][_0x68c4('0x26')]({'where':{'VoiceQueueId':_0x5afc0a[_0x68c4('0x5b')]['id'],'UserId':_0x5afc0a[_0x68c4('0x3e')]['ids']}})[_0x68c4('0x34')](function(){return _0x3f4c7b;});})[_0x68c4('0x34')](respondWithStatusCode(_0x47f307,null))['catch'](handleError(_0x47f307,null));};exports['getAgents']=function(_0x53e78d,_0x2bde6f,_0x297f5a){var _0x792f08={};var _0x754694={};var _0x4843cb;var _0x5cb555;return db['VoiceQueue'][_0x68c4('0x61')]({'where':{'id':_0x53e78d[_0x68c4('0x5b')]['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x2bde6f,null))[_0x68c4('0x34')](function(_0x42c0ab){if(_0x42c0ab){_0x4843cb=_0x42c0ab;_0x754694[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db['User'][_0x68c4('0x3b')]);_0x754694[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0x53e78d[_0x68c4('0x3e')]);_0x754694[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x754694[_0x68c4('0x42')],_0x754694[_0x68c4('0x3e')]);_0x792f08[_0x68c4('0x43')]=_['intersection'](_0x754694[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x792f08[_0x68c4('0x43')]=_0x792f08[_0x68c4('0x43')][_0x68c4('0x45')]?_0x792f08[_0x68c4('0x43')]:_0x754694[_0x68c4('0x42')];_0x792f08[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x792f08[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_['pick'](_0x53e78d['query'],_0x754694[_0x68c4('0x40')]));if(_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x792f08[_0x68c4('0x4a')]=_[_0x68c4('0x4b')](_0x792f08['where'],{'$or':_['map'](_0x792f08[_0x68c4('0x43')],function(_0x525839){var _0x4285b1={};_0x4285b1[_0x525839]={'$like':'%'+_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x4285b1;})});}_0x792f08=_[_0x68c4('0x4b')]({},_0x792f08,_0x53e78d[_0x68c4('0x4d')]);return _0x4843cb[_0x68c4('0x96')](_0x792f08);}})['then'](function(_0x3c008a){if(_0x3c008a){_0x5cb555=_0x3c008a['length'];if(!_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x792f08[_0x68c4('0x1f')]=qs['limit'](_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x792f08[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0x53e78d[_0x68c4('0x3e')][_0x68c4('0x1d')]);}return _0x4843cb['getAgents'](_0x792f08);}})['then'](function(_0x44f028){if(_0x44f028){return _0x44f028?{'count':_0x5cb555,'rows':_0x44f028}:null;}})['then'](respondWithResult(_0x2bde6f,null))[_0x68c4('0x51')](handleError(_0x2bde6f,null));};exports[_0x68c4('0x97')]=function(_0x536262,_0x761be5,_0x14f02f){var _0x574f30={};var _0x16e4a1={};var _0x5ace9e;var _0x29f9dd;return db[_0x68c4('0x3a')]['findOne']({'where':{'id':_0x536262['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x761be5,null))['then'](function(_0x26a719){if(_0x26a719){_0x5ace9e=_0x26a719;_0x16e4a1[_0x68c4('0x42')]=_['keys'](db['UserVoiceQueueRt'][_0x68c4('0x3b')]);_0x16e4a1[_0x68c4('0x3e')]=_[_0x68c4('0x3f')](_0x536262[_0x68c4('0x3e')]);_0x16e4a1[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x16e4a1['model'],_0x16e4a1[_0x68c4('0x3e')]);_0x574f30[_0x68c4('0x43')]=_['intersection'](_0x16e4a1[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x536262[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x574f30[_0x68c4('0x43')]=_0x574f30[_0x68c4('0x43')]['length']?_0x574f30[_0x68c4('0x43')]:_0x16e4a1[_0x68c4('0x42')];_0x574f30[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0x536262[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x574f30[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_[_0x68c4('0x49')](_0x536262[_0x68c4('0x3e')],_0x16e4a1['filters']));if(_0x536262['query']['filter']){_0x574f30[_0x68c4('0x4a')]=_[_0x68c4('0x4b')](_0x574f30['where'],{'$or':_[_0x68c4('0x2d')](_0x574f30['attributes'],function(_0x450986){var _0xe4914b={};_0xe4914b[_0x450986]={'$like':'%'+_0x536262[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0xe4914b;})});}_0x574f30=_[_0x68c4('0x4b')]({},_0x574f30,_0x536262['options']);return _0x5ace9e[_0x68c4('0x97')](_0x574f30);}})['then'](function(_0x8e4a98){if(_0x8e4a98){_0x29f9dd=_0x8e4a98[_0x68c4('0x45')];if(!_0x536262[_0x68c4('0x3e')][_0x68c4('0x46')](_0x68c4('0x47'))){_0x574f30[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0x536262['query'][_0x68c4('0x1f')]);_0x574f30['offset']=qs[_0x68c4('0x1d')](_0x536262[_0x68c4('0x3e')][_0x68c4('0x1d')]);}return _0x5ace9e[_0x68c4('0x97')](_0x574f30);}})[_0x68c4('0x34')](function(_0x6150c6){return _0x6150c6?{'count':_0x29f9dd,'rows':_0x6150c6}:null;})[_0x68c4('0x34')](respondWithResult(_0x761be5,null))[_0x68c4('0x51')](handleError(_0x761be5,null));};exports[_0x68c4('0x98')]=function(_0x32cfa8,_0x5be923,_0x3e07fa){var _0x4b6321={};var _0x3c982a={};var _0x1f91b7;var _0x3f5d06;return db['VoiceQueue']['findOne']({'where':{'id':_0x32cfa8[_0x68c4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5be923,null))[_0x68c4('0x34')](function(_0x1abafa){if(_0x1abafa){_0x1f91b7=_0x1abafa;_0x3c982a[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x99')][_0x68c4('0x3b')]);_0x3c982a[_0x68c4('0x3e')]=_['keys'](_0x32cfa8['query']);_0x3c982a['filters']=_[_0x68c4('0x41')](_0x3c982a[_0x68c4('0x42')],_0x3c982a['query']);_0x4b6321[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x3c982a[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x4b6321[_0x68c4('0x43')]=_0x4b6321[_0x68c4('0x43')][_0x68c4('0x45')]?_0x4b6321[_0x68c4('0x43')]:_0x3c982a['model'];_0x4b6321[_0x68c4('0x63')]=qs[_0x68c4('0x48')](_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x48')]);_0x4b6321['where']=qs[_0x68c4('0x40')](_[_0x68c4('0x49')](_0x32cfa8[_0x68c4('0x3e')],_0x3c982a[_0x68c4('0x40')]));if(_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x4b6321[_0x68c4('0x4a')]=_['merge'](_0x4b6321[_0x68c4('0x4a')],{'$or':_['map'](_0x4b6321[_0x68c4('0x43')],function(_0x462b58){var _0x2de851={};_0x2de851[_0x462b58]={'$like':'%'+_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0x2de851;})});}_0x4b6321=_[_0x68c4('0x4b')]({},_0x4b6321,_0x32cfa8[_0x68c4('0x4d')]);return _0x1f91b7[_0x68c4('0x98')](_0x4b6321);}})['then'](function(_0x3f45be){if(_0x3f45be){_0x3f5d06=_0x3f45be['length'];if(!_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x46')]('nolimit')){_0x4b6321['limit']=qs[_0x68c4('0x1f')](_0x32cfa8[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x4b6321[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0x32cfa8['query'][_0x68c4('0x1d')]);}return _0x1f91b7[_0x68c4('0x98')](_0x4b6321);}})[_0x68c4('0x34')](function(_0x5ed4c0){if(_0x5ed4c0){return _0x5ed4c0?{'count':_0x3f5d06,'rows':_0x5ed4c0}:null;}})[_0x68c4('0x34')](respondWithResult(_0x5be923,null))['catch'](handleError(_0x5be923,null));};exports[_0x68c4('0x9a')]=function(_0x14538e,_0x44ff59,_0x2d3def){var _0x35e37a=moment()[_0x68c4('0x79')]('YYYY-MM-DD\x20HH:mm:ss');var _0x76cd3,_0x24fab4;return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0x14538e[_0x68c4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x44ff59,null))[_0x68c4('0x34')](function(_0x4e4ffa){if(_0x4e4ffa){_0x24fab4=_0x4e4ffa;return _0x4e4ffa['addLists'](_0x14538e[_0x68c4('0x54')][_0x68c4('0x8e')],_[_0x68c4('0x5c')](_0x14538e[_0x68c4('0x54')],[_0x68c4('0x8e'),'id'])||{});}return null;})[_0x68c4('0x9b')](function(_0x136782){var _0x2782c5;_0x76cd3=_0x136782||[];var _0x204e20=[];if(_0x136782){for(var _0x5cd266=0x0;_0x5cd266<_0x136782[_0x68c4('0x45')];_0x5cd266+=0x1){var _0x3757ea=_0x136782[_0x5cd266]['get']({'plain':!![]});_0x24fab4[_0x68c4('0x9c')]=_0x14538e['body']['dialCheckDuplicateType']?_0x14538e[_0x68c4('0x54')][_0x68c4('0x9c')]:_0x24fab4[_0x68c4('0x9c')];switch(_0x24fab4[_0x68c4('0x9c')]){case'always':_0x2782c5=squel[_0x68c4('0x9d')]()[_0x68c4('0x9e')](_0x68c4('0x9f'))[_0x68c4('0xa0')]([_0x68c4('0xa1'),_0x68c4('0xa2'),_0x68c4('0xa3'),_0x68c4('0xa4'),_0x68c4('0x66'),_0x68c4('0x5d'),'updatedAt'],squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')](_0x68c4('0xa1'),_0x68c4('0xa1'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27',_0x68c4('0xa2'))[_0x68c4('0x7e')]('id',_0x68c4('0xa3'))[_0x68c4('0x7e')](_0x3757ea[_0x68c4('0xa6')][_0x68c4('0xa7')](),'ListId')[_0x68c4('0x7e')](_0x14538e[_0x68c4('0x5b')]['id']['toString'](),_0x68c4('0x66'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27',_0x68c4('0x5d'))['field']('\x27'+_0x35e37a+'\x27',_0x68c4('0x5e'))[_0x68c4('0x7f')](_0x68c4('0xa8'))[_0x68c4('0x4a')](_0x68c4('0xa9'))[_0x68c4('0x4a')]('ListId\x20=\x20?',_0x3757ea[_0x68c4('0xa6')]['toString']())['where'](_0x68c4('0xaa'))[_0x68c4('0x4a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')](_0x68c4('0xab'))[_0x68c4('0x7f')](_0x68c4('0xac'))['where'](_0x68c4('0x84'),_0x14538e['params']['id'][_0x68c4('0xa7')]()))['where'](_0x68c4('0xad'),squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')]('COALESCE(phone,\x27\x27)')[_0x68c4('0x7f')](_0x68c4('0x9f'))[_0x68c4('0x4a')](_0x68c4('0x84'),_0x14538e[_0x68c4('0x5b')]['id'][_0x68c4('0xa7')]())))['toString']();break;case _0x68c4('0xae'):_0x2782c5=squel['insert']()[_0x68c4('0x9e')]('cm_hopper')['fromQuery']([_0x68c4('0xa1'),_0x68c4('0xa2'),'ContactId',_0x68c4('0xa4'),'VoiceQueueId',_0x68c4('0x5d'),'updatedAt'],squel['select']()[_0x68c4('0x7e')](_0x68c4('0xa1'),_0x68c4('0xa1'))['field']('\x27'+_0x35e37a+'\x27','scheduledAt')[_0x68c4('0x7e')]('id',_0x68c4('0xa3'))[_0x68c4('0x7e')](_0x3757ea[_0x68c4('0xa6')][_0x68c4('0xa7')](),_0x68c4('0xa4'))[_0x68c4('0x7e')](_0x14538e['params']['id']['toString'](),_0x68c4('0x66'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27','createdAt')[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27',_0x68c4('0x5e'))[_0x68c4('0x7f')]('cm_contacts')[_0x68c4('0x4a')](_0x68c4('0xa9'))[_0x68c4('0x4a')](_0x68c4('0xaf'),_0x3757ea[_0x68c4('0xa6')][_0x68c4('0xa7')]())['where'](_0x68c4('0xaa'))[_0x68c4('0x4a')](_0x68c4('0xad'),squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')](_0x68c4('0xb0'))[_0x68c4('0x7f')](_0x68c4('0x9f'))[_0x68c4('0x4a')]('VoiceQueueId\x20=\x20?',_0x14538e[_0x68c4('0x5b')]['id'][_0x68c4('0xa7')]())))[_0x68c4('0xa7')]();break;default:_0x2782c5=squel[_0x68c4('0x9d')]()[_0x68c4('0x9e')](_0x68c4('0x9f'))[_0x68c4('0xa0')]([_0x68c4('0xa1'),_0x68c4('0xa2'),_0x68c4('0xa3'),_0x68c4('0xa4'),_0x68c4('0x66'),_0x68c4('0x5d'),_0x68c4('0x5e')],squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')](_0x68c4('0xa1'),_0x68c4('0xa1'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27','scheduledAt')['field']('id',_0x68c4('0xa3'))['field'](_0x3757ea[_0x68c4('0xa6')][_0x68c4('0xa7')](),'ListId')[_0x68c4('0x7e')](_0x14538e['params']['id'][_0x68c4('0xa7')](),_0x68c4('0x66'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27',_0x68c4('0x5d'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27','updatedAt')[_0x68c4('0x7f')](_0x68c4('0xa8'))['where'](_0x68c4('0xa9'))[_0x68c4('0x4a')]('ListId\x20=\x20?',_0x3757ea[_0x68c4('0xa6')]['toString']())['where'](_0x68c4('0xaa')))['toString']();}_0x204e20[_0x68c4('0x94')](db['sequelize'][_0x68c4('0x3e')](_0x2782c5));}return BPromise['all'](_0x204e20);}})['then'](function(){var _0x131281=[];var _0xa46915=squel['insert']()[_0x68c4('0x9e')]('cm_hopper_additional_phones')[_0x68c4('0xa0')](['CmHopperId',_0x68c4('0xa1'),_0x68c4('0xb1'),_0x68c4('0x5d'),_0x68c4('0x5e')],squel['select']()[_0x68c4('0x7e')](_0x68c4('0xb2'))[_0x68c4('0x7e')](_0x68c4('0xb3'))[_0x68c4('0x7e')](_0x68c4('0xb4'))['field']('\x27'+_0x35e37a+'\x27',_0x68c4('0x5d'))[_0x68c4('0x7e')]('\x27'+_0x35e37a+'\x27',_0x68c4('0x5e'))[_0x68c4('0x7f')](_0x68c4('0xb5'),'ci')['join'](_0x68c4('0x9f'),'h',_0x68c4('0xb6'))[_0x68c4('0x4a')](_0x68c4('0xb7'),_0x35e37a)[_0x68c4('0x4a')](_0x68c4('0xb8'),_0x68c4('0xb9')))['toString']();_0x131281[_0x68c4('0x94')](db[_0x68c4('0x86')][_0x68c4('0x3e')](_0xa46915));return BPromise[_0x68c4('0x95')](_0x131281);})['then'](function(){return _0x76cd3;})[_0x68c4('0x34')](respondWithResult(_0x44ff59,null))[_0x68c4('0x51')](handleError(_0x44ff59,null));};exports[_0x68c4('0xba')]=function(_0x209ae8,_0x421a7b,_0x5430b1){return db[_0x68c4('0x3a')]['find']({'where':{'id':_0x209ae8['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x421a7b,null))[_0x68c4('0x34')](function(_0x45f198){if(_0x45f198){return _0x45f198[_0x68c4('0xba')](_0x209ae8[_0x68c4('0x3e')][_0x68c4('0x8e')]);}})[_0x68c4('0x34')](function(_0x18236e){if(_0x18236e){return db['CmHopper'][_0x68c4('0x26')]({'where':{'ListId':_0x209ae8[_0x68c4('0x3e')][_0x68c4('0x8e')],'VoiceQueueId':_0x209ae8['params']['id']}})['then'](function(){return _0x18236e;});}})['then'](respondWithStatusCode(_0x421a7b,null))['catch'](handleError(_0x421a7b,null));};exports[_0x68c4('0xbb')]=function(_0x4191fe,_0x5d1d0,_0x2682e6){var _0x5e1014={};var _0x2ed260={};var _0x2cbb90;var _0x5c09ef;return db['VoiceQueue'][_0x68c4('0x61')]({'where':{'id':_0x4191fe['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x5d1d0,null))[_0x68c4('0x34')](function(_0x16d537){if(_0x16d537){_0x2cbb90=_0x16d537;_0x2ed260[_0x68c4('0x42')]=_[_0x68c4('0x3f')](db[_0x68c4('0x99')][_0x68c4('0x3b')]);_0x2ed260['query']=_[_0x68c4('0x3f')](_0x4191fe[_0x68c4('0x3e')]);_0x2ed260[_0x68c4('0x40')]=_[_0x68c4('0x41')](_0x2ed260['model'],_0x2ed260[_0x68c4('0x3e')]);_0x5e1014[_0x68c4('0x43')]=_[_0x68c4('0x41')](_0x2ed260[_0x68c4('0x42')],qs[_0x68c4('0x44')](_0x4191fe[_0x68c4('0x3e')][_0x68c4('0x44')]));_0x5e1014['attributes']=_0x5e1014[_0x68c4('0x43')][_0x68c4('0x45')]?_0x5e1014['attributes']:_0x2ed260[_0x68c4('0x42')];_0x5e1014['order']=qs[_0x68c4('0x48')](_0x4191fe['query'][_0x68c4('0x48')]);_0x5e1014[_0x68c4('0x4a')]=qs[_0x68c4('0x40')](_[_0x68c4('0x49')](_0x4191fe['query'],_0x2ed260[_0x68c4('0x40')]));if(_0x4191fe[_0x68c4('0x3e')][_0x68c4('0x2c')]){_0x5e1014['where']=_[_0x68c4('0x4b')](_0x5e1014[_0x68c4('0x4a')],{'$or':_[_0x68c4('0x2d')](_0x5e1014[_0x68c4('0x43')],function(_0x16869a){var _0xadc66d={};_0xadc66d[_0x16869a]={'$like':'%'+_0x4191fe[_0x68c4('0x3e')][_0x68c4('0x2c')]+'%'};return _0xadc66d;})});}_0x5e1014=_[_0x68c4('0x4b')]({},_0x5e1014,_0x4191fe[_0x68c4('0x4d')]);return _0x2cbb90[_0x68c4('0xbb')](_0x5e1014);}})[_0x68c4('0x34')](function(_0x3244d8){if(_0x3244d8){_0x5c09ef=_0x3244d8[_0x68c4('0x45')];if(!_0x4191fe[_0x68c4('0x3e')]['hasOwnProperty'](_0x68c4('0x47'))){_0x5e1014[_0x68c4('0x1f')]=qs[_0x68c4('0x1f')](_0x4191fe[_0x68c4('0x3e')][_0x68c4('0x1f')]);_0x5e1014[_0x68c4('0x1d')]=qs[_0x68c4('0x1d')](_0x4191fe[_0x68c4('0x3e')][_0x68c4('0x1d')]);}return _0x2cbb90[_0x68c4('0xbb')](_0x5e1014);}})[_0x68c4('0x34')](function(_0x41e6c4){if(_0x41e6c4){return _0x41e6c4?{'count':_0x5c09ef,'rows':_0x41e6c4}:null;}})[_0x68c4('0x34')](respondWithResult(_0x5d1d0,null))[_0x68c4('0x51')](handleError(_0x5d1d0,null));};exports['addBlackLists']=function(_0x3d155a,_0x8e3fd9,_0x1b3554){var _0x28e0c4,_0x12c06a;return db[_0x68c4('0x3a')][_0x68c4('0x31')]({'where':{'id':_0x3d155a['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x8e3fd9,null))[_0x68c4('0x34')](function(_0x35ad90){if(_0x35ad90){_0x12c06a=_0x35ad90;return _0x35ad90[_0x68c4('0xbc')](_0x3d155a[_0x68c4('0x54')][_0x68c4('0x8e')],_['omit'](_0x3d155a[_0x68c4('0x54')],[_0x68c4('0x8e'),'id'])||{});}return null;})[_0x68c4('0x9b')](function(_0x14555a){var _0xe8c33f;_0x28e0c4=_0x14555a||[];var _0x27a10c=[];if(_0x14555a){for(var _0x4e1bc5=0x0;_0x4e1bc5<_0x14555a[_0x68c4('0x45')];_0x4e1bc5+=0x1){var _0x8fc106=_0x14555a[_0x4e1bc5][_0x68c4('0x27')]({'plain':!![]});_0xe8c33f=squel[_0x68c4('0x9d')]()['into'](_0x68c4('0xbd'))[_0x68c4('0xa0')]([_0x68c4('0xa1'),_0x68c4('0xa3'),_0x68c4('0xa4'),_0x68c4('0x66'),_0x68c4('0x5d'),_0x68c4('0x5e')],squel[_0x68c4('0xa5')]()[_0x68c4('0x7e')](_0x68c4('0xa1'),'phone')[_0x68c4('0x7e')]('id','ContactId')['field'](_0x8fc106[_0x68c4('0xa6')][_0x68c4('0xa7')](),'ListId')[_0x68c4('0x7e')](_0x3d155a[_0x68c4('0x5b')]['id'][_0x68c4('0xa7')](),_0x68c4('0x66'))[_0x68c4('0x7e')]('NOW()',_0x68c4('0x5d'))['field'](_0x68c4('0xbe'),_0x68c4('0x5e'))[_0x68c4('0x7f')](_0x68c4('0xa8'))[_0x68c4('0x4a')]('deletedAt\x20IS\x20NULL')[_0x68c4('0x4a')](_0x68c4('0xaf'),_0x8fc106['CmListId'][_0x68c4('0xa7')]())[_0x68c4('0x4a')](_0x68c4('0xaa')))[_0x68c4('0xa7')]();_0x27a10c[_0x68c4('0x94')](db[_0x68c4('0x86')][_0x68c4('0x3e')](_0xe8c33f));}return BPromise['all'](_0x27a10c);}})[_0x68c4('0x34')](function(){return _0x28e0c4;})[_0x68c4('0x34')](respondWithResult(_0x8e3fd9,null))['catch'](handleError(_0x8e3fd9,null));};exports[_0x68c4('0xbf')]=function(_0x4647cd,_0x58cc75,_0xc4f30){return db[_0x68c4('0x3a')]['find']({'where':{'id':_0x4647cd['params']['id']}})[_0x68c4('0x34')](handleEntityNotFound(_0x58cc75,null))[_0x68c4('0x34')](function(_0x20e00f){if(_0x20e00f){return _0x20e00f[_0x68c4('0xbf')](_0x4647cd[_0x68c4('0x3e')]['ids']);}})[_0x68c4('0x34')](function(_0x349564){if(_0x349564){return db['CmHopperBlack'][_0x68c4('0x26')]({'where':{'ListId':_0x4647cd[_0x68c4('0x3e')][_0x68c4('0x8e')],'VoiceQueueId':_0x4647cd['params']['id']}})[_0x68c4('0x34')](function(){return _0x349564;});}})[_0x68c4('0x34')](respondWithStatusCode(_0x58cc75,null))[_0x68c4('0x51')](handleError(_0x58cc75,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1413f16..22f055f 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 _0xd7d2=['hook','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x439f6c,_0x589244){var _0xe7556a=function(_0x413d40){while(--_0x413d40){_0x439f6c['push'](_0x439f6c['shift']());}};_0xe7556a(++_0x589244);}(_0xd7d2,0x13c));var _0x2d7d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd7d2[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2d7d('0x0'))['db'][_0x2d7d('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2d7d('0x2')](0x0);var events={'afterCreate':_0x2d7d('0x3'),'afterUpdate':_0x2d7d('0x4'),'afterDestroy':_0x2d7d('0x5')};function emitEvent(_0xe328bd){return function(_0x53cf39,_0x4b1154,_0x40a945){VoiceQueueEvents['emit'](_0xe328bd+':'+_0x53cf39['id'],_0x53cf39);VoiceQueueEvents[_0x2d7d('0x6')](_0xe328bd,_0x53cf39);_0x40a945(null);};}for(var e in events){if(events[_0x2d7d('0x7')](e)){var event=events[e];VoiceQueue[_0x2d7d('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xed99=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xed99,0xbe));var _0x9ed9=function(_0x596c69,_0x552fba){_0x596c69=_0x596c69-0x0;var _0x57ee18=_0xed99[_0x596c69];return _0x57ee18;};'use strict';var EventEmitter=require(_0x9ed9('0x0'));var VoiceQueue=require(_0x9ed9('0x1'))['db'][_0x9ed9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9ed9('0x3')](0x0);var events={'afterCreate':_0x9ed9('0x4'),'afterUpdate':_0x9ed9('0x5'),'afterDestroy':_0x9ed9('0x6')};function emitEvent(_0x3569e1){return function(_0x3d47c0,_0x48bc1d,_0x16639b){VoiceQueueEvents[_0x9ed9('0x7')](_0x3569e1+':'+_0x3d47c0['id'],_0x3d47c0);VoiceQueueEvents[_0x9ed9('0x7')](_0x3569e1,_0x3d47c0);_0x16639b(null);};}for(var e in events){if(events[_0x9ed9('0x8')](e)){var event=events[e];VoiceQueue[_0x9ed9('0x9')](e,emitEvent(event));}}module[_0x9ed9('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c390aaa..1aaa7ec 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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3710a7,_0x1cb137){var _0x3ad311=function(_0x92546d){while(--_0x92546d){_0x3710a7['push'](_0x3710a7['shift']());}};_0x3ad311(++_0x1cb137);}(_0x34e8,0x12c));var _0x834e=function(_0xf1486,_0x4d28f4){_0xf1486=_0xf1486-0x0;var _0x1ab4ed=_0x34e8[_0xf1486];return _0x1ab4ed;};'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 +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3366fe,_0x38176d){var _0x17c365=function(_0x553fee){while(--_0x553fee){_0x3366fe['push'](_0x3366fe['shift']());}};_0x17c365(++_0x38176d);}(_0x34e8,0x12c));var _0x834e=function(_0x3643bc,_0x73dec3){_0x3643bc=_0x3643bc-0x0;var _0x5ddc8f=_0x34e8[_0x3643bc];return _0x5ddc8f;};'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 69af2e3..fb4a184 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 _0x49a5=['client','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','include','map','model','debug','where','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x49a5,0x16e));var _0x549a=function(_0x4246fe,_0x4a75f8){_0x4246fe=_0x4246fe-0x0;var _0x13b040=_0x49a5[_0x4246fe];return _0x13b040;};'use strict';var _=require(_0x549a('0x0'));var util=require(_0x549a('0x1'));var moment=require(_0x549a('0x2'));var BPromise=require(_0x549a('0x3'));var rs=require(_0x549a('0x4'));var fs=require('fs');var Redis=require(_0x549a('0x5'));var db=require(_0x549a('0x6'))['db'];var utils=require(_0x549a('0x7'));var logger=require(_0x549a('0x8'))(_0x549a('0x9'));var config=require(_0x549a('0xa'));var jayson=require(_0x549a('0xb'));var client=jayson[_0x549a('0xc')]['http']({'port':0x232a});config['redis']=_[_0x549a('0xd')](config[_0x549a('0xe')],{'host':_0x549a('0xf'),'port':0x18eb});var socket=require(_0x549a('0x10'))(new Redis(config[_0x549a('0xe')]));require(_0x549a('0x11'))[_0x549a('0x12')](socket);function respondWithRpcPromise(_0x4b5225,_0x3cc280,_0x2a1a77){return new BPromise(function(_0x30df56,_0x2b2070){return client[_0x549a('0x13')](_0x4b5225,_0x2a1a77)[_0x549a('0x14')](function(_0x56bf6b){logger[_0x549a('0x15')](_0x549a('0x16'),_0x3cc280,_0x549a('0x17'));logger['debug'](_0x549a('0x18'),_0x3cc280,_0x549a('0x17'),JSON[_0x549a('0x19')](_0x56bf6b));if(_0x56bf6b[_0x549a('0x1a')]){if(_0x56bf6b[_0x549a('0x1a')][_0x549a('0x1b')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3cc280,_0x56bf6b[_0x549a('0x1a')][_0x549a('0x1c')]);return _0x2b2070(_0x56bf6b[_0x549a('0x1a')][_0x549a('0x1c')]);}logger[_0x549a('0x1a')](_0x549a('0x16'),_0x3cc280,_0x56bf6b['error']['message']);return _0x30df56(_0x56bf6b['error'][_0x549a('0x1c')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x3cc280,_0x549a('0x17'));_0x30df56(_0x56bf6b[_0x549a('0x1d')]['message']);}})['catch'](function(_0x320e23){logger[_0x549a('0x1a')](_0x549a('0x16'),_0x3cc280,_0x320e23);_0x2b2070(_0x320e23);});});}exports[_0x549a('0x1e')]=function(_0x468462){var _0x496920=this;return new Promise(function(_0x31c7a7,_0x2b4a05){return db[_0x549a('0x1f')][_0x549a('0x20')]({'raw':_0x468462['options']?_0x468462[_0x549a('0x21')][_0x549a('0x22')]===undefined?!![]:![]:!![],'where':_0x468462[_0x549a('0x21')]?_0x468462['options']['where']||null:null,'attributes':_0x468462[_0x549a('0x21')]?_0x468462[_0x549a('0x21')][_0x549a('0x23')]||null:null,'limit':_0x468462['options']?_0x468462[_0x549a('0x21')]['limit']||null:null,'include':_0x468462['options']?_0x468462[_0x549a('0x21')][_0x549a('0x24')]?_[_0x549a('0x25')](_0x468462[_0x549a('0x21')][_0x549a('0x24')],function(_0x5ecdb3){return{'model':db[_0x5ecdb3['model']],'as':_0x5ecdb3['as'],'attributes':_0x5ecdb3['attributes'],'include':_0x5ecdb3['include']?_[_0x549a('0x25')](_0x5ecdb3[_0x549a('0x24')],function(_0x18815a){return{'model':db[_0x18815a['model']],'as':_0x18815a['as'],'attributes':_0x18815a['attributes'],'include':_0x18815a['include']?_[_0x549a('0x25')](_0x18815a[_0x549a('0x24')],function(_0x45a5dc){return{'model':db[_0x45a5dc[_0x549a('0x26')]],'as':_0x45a5dc['as'],'attributes':_0x45a5dc[_0x549a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x549a('0x14')](function(_0x6f911b){logger[_0x549a('0x15')](_0x549a('0x1e'),_0x468462);logger[_0x549a('0x27')]('GetVoiceQueue',_0x468462,JSON[_0x549a('0x19')](_0x6f911b));_0x31c7a7(_0x6f911b);})['catch'](function(_0x7ef61a){logger[_0x549a('0x1a')](_0x549a('0x1e'),_0x7ef61a[_0x549a('0x1c')],_0x468462);_0x2b4a05(_0x496920[_0x549a('0x1a')](0x1f4,_0x7ef61a['message']));});});};exports['ShowVoiceQueue']=function(_0x1b0f68){var _0x55d10c=this;return new Promise(function(_0x6b2ec6,_0x5465b5){return db['VoiceQueue']['find']({'raw':_0x1b0f68[_0x549a('0x21')]?_0x1b0f68[_0x549a('0x21')][_0x549a('0x22')]===undefined?!![]:![]:!![],'where':_0x1b0f68[_0x549a('0x21')]?_0x1b0f68['options'][_0x549a('0x28')]||null:null,'attributes':_0x1b0f68[_0x549a('0x21')]?_0x1b0f68[_0x549a('0x21')][_0x549a('0x23')]||null:null,'include':_0x1b0f68['options']?_0x1b0f68[_0x549a('0x21')]['include']?_[_0x549a('0x25')](_0x1b0f68[_0x549a('0x21')][_0x549a('0x24')],function(_0x28a7ee){return{'model':db[_0x28a7ee['model']],'as':_0x28a7ee['as'],'attributes':_0x28a7ee[_0x549a('0x23')],'include':_0x28a7ee['include']?_['map'](_0x28a7ee[_0x549a('0x24')],function(_0xa5e135){return{'model':db[_0xa5e135[_0x549a('0x26')]],'as':_0xa5e135['as'],'attributes':_0xa5e135[_0x549a('0x23')],'include':_0xa5e135[_0x549a('0x24')]?_[_0x549a('0x25')](_0xa5e135[_0x549a('0x24')],function(_0xe748a7){return{'model':db[_0xe748a7[_0x549a('0x26')]],'as':_0xe748a7['as'],'attributes':_0xe748a7[_0x549a('0x23')]};}):[]};}):[]};}):[]:[]})[_0x549a('0x14')](function(_0x457591){logger[_0x549a('0x15')](_0x549a('0x29'),_0x1b0f68);logger['debug'](_0x549a('0x29'),_0x1b0f68,JSON['stringify'](_0x457591));_0x6b2ec6(_0x457591);})['catch'](function(_0x28431a){logger[_0x549a('0x1a')](_0x549a('0x29'),_0x28431a[_0x549a('0x1c')],_0x1b0f68);_0x5465b5(_0x55d10c[_0x549a('0x1a')](0x1f4,_0x28431a[_0x549a('0x1c')]));});});}; \ No newline at end of file +var _0x7b6a=['defaults','localhost','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','VoiceQueue','findAll','options','raw','where','include','model','attributes','map','GetVoiceQueue','catch','ShowVoiceQueue','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x35d9fd,_0xe4358e){var _0x232ab4=function(_0x3cc5e5){while(--_0x3cc5e5){_0x35d9fd['push'](_0x35d9fd['shift']());}};_0x232ab4(++_0xe4358e);}(_0x7b6a,0x164));var _0xa7b6=function(_0x4f4344,_0x389530){_0x4f4344=_0x4f4344-0x0;var _0x4af79b=_0x7b6a[_0x4f4344];return _0x4af79b;};'use strict';var _=require(_0xa7b6('0x0'));var util=require(_0xa7b6('0x1'));var moment=require('moment');var BPromise=require(_0xa7b6('0x2'));var rs=require(_0xa7b6('0x3'));var fs=require('fs');var Redis=require(_0xa7b6('0x4'));var db=require(_0xa7b6('0x5'))['db'];var utils=require(_0xa7b6('0x6'));var logger=require(_0xa7b6('0x7'))(_0xa7b6('0x8'));var config=require(_0xa7b6('0x9'));var jayson=require(_0xa7b6('0xa'));var client=jayson[_0xa7b6('0xb')]['http']({'port':0x232a});config[_0xa7b6('0xc')]=_[_0xa7b6('0xd')](config[_0xa7b6('0xc')],{'host':_0xa7b6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7b6('0xc')]));require(_0xa7b6('0xf'))[_0xa7b6('0x10')](socket);function respondWithRpcPromise(_0x26f55a,_0xc5c070,_0x1e44da){return new BPromise(function(_0x326411,_0x51174a){return client[_0xa7b6('0x11')](_0x26f55a,_0x1e44da)[_0xa7b6('0x12')](function(_0x3f1e4c){logger[_0xa7b6('0x13')](_0xa7b6('0x14'),_0xc5c070,_0xa7b6('0x15'));logger[_0xa7b6('0x16')](_0xa7b6('0x17'),_0xc5c070,'request\x20sent',JSON['stringify'](_0x3f1e4c));if(_0x3f1e4c['error']){if(_0x3f1e4c['error'][_0xa7b6('0x18')]===0x1f4){logger[_0xa7b6('0x19')](_0xa7b6('0x14'),_0xc5c070,_0x3f1e4c[_0xa7b6('0x19')]['message']);return _0x51174a(_0x3f1e4c[_0xa7b6('0x19')][_0xa7b6('0x1a')]);}logger[_0xa7b6('0x19')](_0xa7b6('0x14'),_0xc5c070,_0x3f1e4c[_0xa7b6('0x19')][_0xa7b6('0x1a')]);return _0x326411(_0x3f1e4c[_0xa7b6('0x19')][_0xa7b6('0x1a')]);}else{logger[_0xa7b6('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xc5c070,_0xa7b6('0x15'));_0x326411(_0x3f1e4c[_0xa7b6('0x1b')][_0xa7b6('0x1a')]);}})['catch'](function(_0x4b69c6){logger[_0xa7b6('0x19')](_0xa7b6('0x14'),_0xc5c070,_0x4b69c6);_0x51174a(_0x4b69c6);});});}exports['GetVoiceQueue']=function(_0x54df7a){var _0x2e2651=this;return new Promise(function(_0x39e5ab,_0x1ba819){return db[_0xa7b6('0x1c')][_0xa7b6('0x1d')]({'raw':_0x54df7a[_0xa7b6('0x1e')]?_0x54df7a[_0xa7b6('0x1e')][_0xa7b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x54df7a[_0xa7b6('0x1e')]?_0x54df7a[_0xa7b6('0x1e')][_0xa7b6('0x20')]||null:null,'attributes':_0x54df7a[_0xa7b6('0x1e')]?_0x54df7a[_0xa7b6('0x1e')]['attributes']||null:null,'limit':_0x54df7a[_0xa7b6('0x1e')]?_0x54df7a[_0xa7b6('0x1e')]['limit']||null:null,'include':_0x54df7a[_0xa7b6('0x1e')]?_0x54df7a[_0xa7b6('0x1e')][_0xa7b6('0x21')]?_['map'](_0x54df7a['options'][_0xa7b6('0x21')],function(_0x3f81a1){return{'model':db[_0x3f81a1[_0xa7b6('0x22')]],'as':_0x3f81a1['as'],'attributes':_0x3f81a1[_0xa7b6('0x23')],'include':_0x3f81a1[_0xa7b6('0x21')]?_[_0xa7b6('0x24')](_0x3f81a1[_0xa7b6('0x21')],function(_0x4f095f){return{'model':db[_0x4f095f[_0xa7b6('0x22')]],'as':_0x4f095f['as'],'attributes':_0x4f095f['attributes'],'include':_0x4f095f[_0xa7b6('0x21')]?_[_0xa7b6('0x24')](_0x4f095f['include'],function(_0x1e4899){return{'model':db[_0x1e4899[_0xa7b6('0x22')]],'as':_0x1e4899['as'],'attributes':_0x1e4899['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x155e29){logger['info'](_0xa7b6('0x25'),_0x54df7a);logger[_0xa7b6('0x16')](_0xa7b6('0x25'),_0x54df7a,JSON['stringify'](_0x155e29));_0x39e5ab(_0x155e29);})[_0xa7b6('0x26')](function(_0x2d129d){logger[_0xa7b6('0x19')]('GetVoiceQueue',_0x2d129d['message'],_0x54df7a);_0x1ba819(_0x2e2651[_0xa7b6('0x19')](0x1f4,_0x2d129d[_0xa7b6('0x1a')]));});});};exports['ShowVoiceQueue']=function(_0x28edf5){var _0x5799a2=this;return new Promise(function(_0x2e1856,_0x2e1937){return db[_0xa7b6('0x1c')]['find']({'raw':_0x28edf5[_0xa7b6('0x1e')]?_0x28edf5[_0xa7b6('0x1e')][_0xa7b6('0x1f')]===undefined?!![]:![]:!![],'where':_0x28edf5[_0xa7b6('0x1e')]?_0x28edf5[_0xa7b6('0x1e')][_0xa7b6('0x20')]||null:null,'attributes':_0x28edf5[_0xa7b6('0x1e')]?_0x28edf5[_0xa7b6('0x1e')]['attributes']||null:null,'include':_0x28edf5[_0xa7b6('0x1e')]?_0x28edf5[_0xa7b6('0x1e')][_0xa7b6('0x21')]?_[_0xa7b6('0x24')](_0x28edf5[_0xa7b6('0x1e')][_0xa7b6('0x21')],function(_0x51131f){return{'model':db[_0x51131f[_0xa7b6('0x22')]],'as':_0x51131f['as'],'attributes':_0x51131f[_0xa7b6('0x23')],'include':_0x51131f[_0xa7b6('0x21')]?_['map'](_0x51131f[_0xa7b6('0x21')],function(_0x3933b5){return{'model':db[_0x3933b5['model']],'as':_0x3933b5['as'],'attributes':_0x3933b5[_0xa7b6('0x23')],'include':_0x3933b5[_0xa7b6('0x21')]?_[_0xa7b6('0x24')](_0x3933b5[_0xa7b6('0x21')],function(_0x5160e9){return{'model':db[_0x5160e9[_0xa7b6('0x22')]],'as':_0x5160e9['as'],'attributes':_0x5160e9[_0xa7b6('0x23')]};}):[]};}):[]};}):[]:[]})[_0xa7b6('0x12')](function(_0x2ab2a7){logger['info'](_0xa7b6('0x27'),_0x28edf5);logger[_0xa7b6('0x16')](_0xa7b6('0x27'),_0x28edf5,JSON[_0xa7b6('0x28')](_0x2ab2a7));_0x2e1856(_0x2ab2a7);})[_0xa7b6('0x26')](function(_0x3dcba1){logger[_0xa7b6('0x19')](_0xa7b6('0x27'),_0x3dcba1[_0xa7b6('0x1a')],_0x28edf5);_0x2e1937(_0x5799a2[_0xa7b6('0x19')](0x1f4,_0x3dcba1['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ee2bdf5..6579364 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 _0xec66=['update','emit','register','voiceQueue:','remove'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0xec66,0x18f));var _0x6ec6=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xec66[_0x18ab2a];return _0x16dcee;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x6ec6('0x0'),_0x6ec6('0x1')];function createListener(_0x38effd,_0x1f3241){return function(_0x1074cb){_0x1f3241[_0x6ec6('0x2')](_0x38effd,_0x1074cb);};}function removeListener(_0x3f8c09,_0x20e57a){return function(){VoiceQueueEvents['removeListener'](_0x3f8c09,_0x20e57a);};}exports[_0x6ec6('0x3')]=function(_0x405c21){for(var _0x1eee53=0x0,_0x2d355c=events['length'];_0x1eee53<_0x2d355c;_0x1eee53++){var _0x54f7b6=events[_0x1eee53];var _0x6cb6f6=createListener(_0x6ec6('0x4')+_0x54f7b6,_0x405c21);VoiceQueueEvents['on'](_0x54f7b6,_0x6cb6f6);}}; \ No newline at end of file +var _0xdc35=['./voiceQueue.events','save','removeListener','length','voiceQueue:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc35,0x1e0));var _0x5dc3=function(_0x487460,_0x57bf7b){_0x487460=_0x487460-0x0;var _0x5117c8=_0xdc35[_0x487460];return _0x5117c8;};'use strict';var VoiceQueueEvents=require(_0x5dc3('0x0'));var events=[_0x5dc3('0x1'),'remove','update'];function createListener(_0x352916,_0x1dd8da){return function(_0x4724ce){_0x1dd8da['emit'](_0x352916,_0x4724ce);};}function removeListener(_0x2e6d19,_0x44f129){return function(){VoiceQueueEvents[_0x5dc3('0x2')](_0x2e6d19,_0x44f129);};}exports['register']=function(_0x1fdb3d){for(var _0x9db608=0x0,_0x58500a=events[_0x5dc3('0x3')];_0x9db608<_0x58500a;_0x9db608++){var _0x48e2f1=events[_0x9db608];var _0x35e44e=createListener(_0x5dc3('0x4')+_0x48e2f1,_0x1fdb3d);VoiceQueueEvents['on'](_0x48e2f1,_0x35e44e);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e9976cd..e207eab 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 _0x6300=['getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x6300,0x1ae));var _0x0630=function(_0x5b92d7,_0x4dbdeb){_0x5b92d7=_0x5b92d7-0x0;var _0x174bca=_0x6300[_0x5b92d7];return _0x174bca;};'use strict';var multer=require(_0x0630('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0630('0x1'));var express=require('express');var router=express[_0x0630('0x2')]();var fs_extra=require(_0x0630('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0630('0x4'));var controller=require(_0x0630('0x5'));router['get']('/',auth[_0x0630('0x6')](),controller[_0x0630('0x7')]);router[_0x0630('0x8')](_0x0630('0x9'),auth[_0x0630('0x6')](),controller[_0x0630('0xa')]);router[_0x0630('0x8')]('/index',auth['isAuthenticated'](),controller[_0x0630('0xb')]);router[_0x0630('0x8')]('/:id',auth[_0x0630('0x6')](),controller[_0x0630('0xc')]);router[_0x0630('0xd')]('/',auth[_0x0630('0x6')](),controller[_0x0630('0xe')]);router[_0x0630('0xf')](_0x0630('0x10'),auth[_0x0630('0x6')](),controller[_0x0630('0x11')]);router[_0x0630('0x12')](_0x0630('0x10'),auth[_0x0630('0x6')](),controller[_0x0630('0x13')]);module[_0x0630('0x14')]=router; \ No newline at end of file +var _0x905b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x4989d2,_0x3e849d){var _0x28f763=function(_0x197c4d){while(--_0x197c4d){_0x4989d2['push'](_0x4989d2['shift']());}};_0x28f763(++_0x3e849d);}(_0x905b,0x87));var _0xb905=function(_0x10f62c,_0x347b25){_0x10f62c=_0x10f62c-0x0;var _0x33c8c5=_0x905b[_0x10f62c];return _0x33c8c5;};'use strict';var multer=require(_0xb905('0x0'));var util=require(_0xb905('0x1'));var path=require(_0xb905('0x2'));var timeout=require(_0xb905('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb905('0x4'));var auth=require(_0xb905('0x5'));var interaction=require(_0xb905('0x6'));var config=require(_0xb905('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xb905('0x8')]('/',auth[_0xb905('0x9')](),controller['index']);router['get']('/describe',auth[_0xb905('0x9')](),controller[_0xb905('0xa')]);router[_0xb905('0x8')](_0xb905('0xb'),auth[_0xb905('0x9')](),controller[_0xb905('0xc')]);router[_0xb905('0x8')](_0xb905('0xd'),auth['isAuthenticated'](),controller[_0xb905('0xe')]);router[_0xb905('0xf')]('/',auth[_0xb905('0x9')](),controller['create']);router[_0xb905('0x10')](_0xb905('0xd'),auth[_0xb905('0x9')](),controller['update']);router[_0xb905('0x11')]('/:id',auth[_0xb905('0x9')](),controller[_0xb905('0x12')]);module[_0xb905('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ac62731..82e2a32 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 _0x024f=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports'];(function(_0xbf37c6,_0x3dabf3){var _0x4f37b6=function(_0x447524){while(--_0x447524){_0xbf37c6['push'](_0xbf37c6['shift']());}};_0x4f37b6(++_0x3dabf3);}(_0x024f,0x10c));var _0xf024=function(_0x42327c,_0x48faaa){_0x42327c=_0x42327c-0x0;var _0x4e55d2=_0x024f[_0x42327c];return _0x4e55d2;};'use strict';var Sequelize=require(_0xf024('0x0'));var moment=require('moment');module[_0xf024('0x1')]={'type':{'type':Sequelize[_0xf024('0x2')]},'uniqueid':{'type':Sequelize[_0xf024('0x2')]},'calleridnum':{'type':Sequelize[_0xf024('0x2')]},'calleridname':{'type':Sequelize[_0xf024('0x2')]},'queue':{'type':Sequelize[_0xf024('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xf024('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xf024('0x3')],'set':function(_0x924978){var _0x1e595f=moment(_0x924978);var _0x3c412a=moment(this[_0xf024('0x4')](_0xf024('0x5')))[_0xf024('0x6')](_0xf024('0x7'));var _0xfee0e5=_0x1e595f[_0xf024('0x8')](_0x3c412a,_0xf024('0x9'));this['setDataValue']('queuecallerleaveAt',_0x924978);this[_0xf024('0xa')](_0xf024('0xb'),_0xfee0e5||null);}},'position':{'type':Sequelize[_0xf024('0xc')]},'count':{'type':Sequelize[_0xf024('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xf024('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xf024('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xf024('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xf024('0x3')]},'queuecallerexit':{'type':Sequelize[_0xf024('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xf024('0x2')],'comment':_0xf024('0xe')},'originalposition':{'type':Sequelize[_0xf024('0xc')]},'channel':{'type':Sequelize[_0xf024('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf024('0x2')]},'accountcode':{'type':Sequelize[_0xf024('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xf024('0x2')]},'holdtime':{'type':Sequelize[_0xf024('0xc')]},'mohtime':{'type':Sequelize[_0xf024('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf024('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xf024('0x2')]},'transfer':{'type':Sequelize[_0xf024('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf024('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xf024('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xf024('0x2')]},'secondDisposition':{'type':Sequelize[_0xf024('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf024('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xf024('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3369=['YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format'];(function(_0x31dd7e,_0x72d5da){var _0x2a6bfd=function(_0x34a241){while(--_0x34a241){_0x31dd7e['push'](_0x31dd7e['shift']());}};_0x2a6bfd(++_0x72d5da);}(_0x3369,0xe9));var _0x9336=function(_0x10fcde,_0x55c5c4){_0x10fcde=_0x10fcde-0x0;var _0x2f9657=_0x3369[_0x10fcde];return _0x2f9657;};'use strict';var Sequelize=require(_0x9336('0x0'));var moment=require(_0x9336('0x1'));module[_0x9336('0x2')]={'type':{'type':Sequelize[_0x9336('0x3')]},'uniqueid':{'type':Sequelize[_0x9336('0x3')]},'calleridnum':{'type':Sequelize[_0x9336('0x3')]},'calleridname':{'type':Sequelize[_0x9336('0x3')]},'queue':{'type':Sequelize[_0x9336('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x9336('0x4')],'set':function(_0x5bc722){var _0x555a68=moment(_0x5bc722);var _0x394b5a=moment(this['getDataValue'](_0x9336('0x5')))[_0x9336('0x6')](_0x9336('0x7'));var _0x16c168=_0x555a68['diff'](_0x394b5a,_0x9336('0x8'));this[_0x9336('0x9')](_0x9336('0xa'),_0x5bc722);this[_0x9336('0x9')](_0x9336('0xb'),_0x16c168||null);}},'position':{'type':Sequelize[_0x9336('0xc')]},'count':{'type':Sequelize[_0x9336('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x9336('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9336('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9336('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x9336('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9336('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x9336('0x3')],'comment':_0x9336('0xe')},'originalposition':{'type':Sequelize[_0x9336('0xc')]},'channel':{'type':Sequelize[_0x9336('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9336('0x3')]},'connectedlinename':{'type':Sequelize[_0x9336('0x3')]},'accountcode':{'type':Sequelize[_0x9336('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9336('0x3')]},'priority':{'type':Sequelize[_0x9336('0x3')]},'holdtime':{'type':Sequelize[_0x9336('0xc')]},'mohtime':{'type':Sequelize[_0x9336('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9336('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9336('0x3')]},'transfer':{'type':Sequelize[_0x9336('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9336('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x9336('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9336('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9336('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x9336('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 413409a..58d3033 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 _0x0e47=['then','stack','name','send','map','rawAttributes','key','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x17f8f3,_0x261d99){var _0x553e9b=function(_0x4c0ee1){while(--_0x4c0ee1){_0x17f8f3['push'](_0x17f8f3['shift']());}};_0x553e9b(++_0x261d99);}(_0x0e47,0x11c));var _0x70e4=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0x0e47[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0x70e4('0x0'));var rimraf=require(_0x70e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70e4('0x2'));var rp=require(_0x70e4('0x3'));var moment=require(_0x70e4('0x4'));var BPromise=require(_0x70e4('0x5'));var Mustache=require(_0x70e4('0x6'));var util=require(_0x70e4('0x7'));var path=require(_0x70e4('0x8'));var sox=require(_0x70e4('0x9'));var csv=require(_0x70e4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70e4('0xb'));var squel=require(_0x70e4('0xc'));var crypto=require(_0x70e4('0xd'));var jsforce=require(_0x70e4('0xe'));var deskjs=require(_0x70e4('0xf'));var toCsv=require(_0x70e4('0xa'));var querystring=require(_0x70e4('0x10'));var Papa=require(_0x70e4('0x11'));var Redis=require(_0x70e4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x70e4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x70e4('0x14'));var logger=require(_0x70e4('0x15'))(_0x70e4('0x16'));var utils=require(_0x70e4('0x17'));var config=require(_0x70e4('0x18'));var licenseUtil=require(_0x70e4('0x19'));var db=require(_0x70e4('0x1a'))['db'];config[_0x70e4('0x1b')]=_[_0x70e4('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x70e4('0x1d'))(new Redis(config[_0x70e4('0x1b')]));require('./voiceQueueReport.socket')[_0x70e4('0x1e')](socket);function respondWithStatusCode(_0x551d8a,_0x40521b){_0x40521b=_0x40521b||0xcc;return function(_0x246b6c){if(_0x246b6c){return _0x551d8a[_0x70e4('0x1f')](_0x40521b);}return _0x551d8a[_0x70e4('0x20')](_0x40521b)[_0x70e4('0x21')]();};}function respondWithResult(_0x5bb6d2,_0x2f23d6){_0x2f23d6=_0x2f23d6||0xc8;return function(_0x648c52){if(_0x648c52){return _0x5bb6d2['status'](_0x2f23d6)[_0x70e4('0x22')](_0x648c52);}};}function respondWithFilteredResult(_0x3d19ba,_0x38f6dc){return function(_0x5d1f7c){if(_0x5d1f7c){var _0x5412d3=typeof _0x38f6dc[_0x70e4('0x23')]===_0x70e4('0x24')&&typeof _0x38f6dc[_0x70e4('0x25')]===_0x70e4('0x24');var _0x277d2c=_0x5d1f7c['count'];var _0x1b3fd6=_0x5412d3?0x0:_0x38f6dc['offset'];var _0x17d169=_0x5412d3?_0x5d1f7c[_0x70e4('0x26')]:_0x38f6dc[_0x70e4('0x23')]+_0x38f6dc[_0x70e4('0x25')];var _0x57dbab;if(_0x17d169>=_0x277d2c){_0x17d169=_0x277d2c;_0x57dbab=0xc8;}else{_0x57dbab=0xce;}_0x3d19ba[_0x70e4('0x20')](_0x57dbab);return _0x3d19ba[_0x70e4('0x27')](_0x70e4('0x28'),_0x1b3fd6+'-'+_0x17d169+'/'+_0x277d2c)['json'](_0x5d1f7c);}return null;};}function patchUpdates(_0x1d914f){return function(_0x3baece){try{jsonpatch[_0x70e4('0x29')](_0x3baece,_0x1d914f,!![]);}catch(_0x288249){return BPromise[_0x70e4('0x2a')](_0x288249);}return _0x3baece[_0x70e4('0x2b')]();};}function saveUpdates(_0x419d12,_0x4db83a){return function(_0x15ec88){if(_0x15ec88){return _0x15ec88['update'](_0x419d12)[_0x70e4('0x2c')](function(_0x5977d7){return _0x5977d7;});}return null;};}function removeEntity(_0x53e140,_0x352995){return function(_0x3ec4c4){if(_0x3ec4c4){return _0x3ec4c4['destroy']()[_0x70e4('0x2c')](function(){_0x53e140['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f4c8,_0x1db740){return function(_0x4693a2){if(!_0x4693a2){_0x17f4c8[_0x70e4('0x1f')](0x194);}return _0x4693a2;};}function handleError(_0xd6e7ca,_0x3b5633){_0x3b5633=_0x3b5633||0x1f4;return function(_0xbe36fc){logger['error'](_0xbe36fc[_0x70e4('0x2d')]);if(_0xbe36fc[_0x70e4('0x2e')]){delete _0xbe36fc['name'];}_0xd6e7ca['status'](_0x3b5633)[_0x70e4('0x2f')](_0xbe36fc);};}exports['index']=function(_0x2e83e1,_0x46647a){var _0x75dd43={},_0x366ccc={},_0x18237e={'count':0x0,'rows':[]};var _0x454255=_[_0x70e4('0x30')](db['VoiceQueueReport'][_0x70e4('0x31')],function(_0x864fdf){return{'name':_0x864fdf['fieldName'],'type':_0x864fdf['type'][_0x70e4('0x32')]};});_0x366ccc['model']=_[_0x70e4('0x30')](_0x454255,_0x70e4('0x2e'));_0x366ccc['query']=_[_0x70e4('0x33')](_0x2e83e1[_0x70e4('0x34')]);_0x366ccc[_0x70e4('0x35')]=_[_0x70e4('0x36')](_0x366ccc[_0x70e4('0x37')],_0x366ccc[_0x70e4('0x34')]);_0x75dd43['attributes']=_[_0x70e4('0x36')](_0x366ccc[_0x70e4('0x37')],qs[_0x70e4('0x38')](_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x38')]));_0x75dd43['attributes']=_0x75dd43['attributes'][_0x70e4('0x39')]?_0x75dd43[_0x70e4('0x3a')]:_0x366ccc[_0x70e4('0x37')];if(!_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x3b')](_0x70e4('0x3c'))){_0x75dd43['limit']=qs[_0x70e4('0x25')](_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x25')]);_0x75dd43[_0x70e4('0x23')]=qs[_0x70e4('0x23')](_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x23')]);}_0x75dd43['order']=qs[_0x70e4('0x3d')](_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x3d')]);_0x75dd43[_0x70e4('0x3e')]=qs[_0x70e4('0x35')](_[_0x70e4('0x3f')](_0x2e83e1[_0x70e4('0x34')],_0x366ccc[_0x70e4('0x35')]),_0x454255);if(_0x2e83e1[_0x70e4('0x34')]['filter']){_0x75dd43['where']=_['merge'](_0x75dd43[_0x70e4('0x3e')],{'$or':_[_0x70e4('0x30')](_0x454255,function(_0x16c9e7){if(_0x16c9e7['type']!==_0x70e4('0x40')){var _0x48b896={};_0x48b896[_0x16c9e7['name']]={'$like':'%'+_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x41')]+'%'};return _0x48b896;}})});}_0x75dd43=_[_0x70e4('0x42')]({},_0x75dd43,_0x2e83e1[_0x70e4('0x43')]);var _0x34e0d3={'where':_0x75dd43[_0x70e4('0x3e')]};return db[_0x70e4('0x44')][_0x70e4('0x26')](_0x34e0d3)[_0x70e4('0x2c')](function(_0x2988d3){_0x18237e[_0x70e4('0x26')]=_0x2988d3;if(_0x2e83e1[_0x70e4('0x34')][_0x70e4('0x45')]){_0x75dd43[_0x70e4('0x46')]=[{'all':!![]}];}return db[_0x70e4('0x44')][_0x70e4('0x47')](_0x75dd43);})[_0x70e4('0x2c')](function(_0x2f6340){_0x18237e[_0x70e4('0x48')]=_0x2f6340;return _0x18237e;})[_0x70e4('0x2c')](respondWithFilteredResult(_0x46647a,_0x75dd43))[_0x70e4('0x49')](handleError(_0x46647a,null));};exports[_0x70e4('0x4a')]=function(_0xd462e2,_0x345dad){var _0x59ce4f={'raw':![],'where':{'id':_0xd462e2[_0x70e4('0x4b')]['id']}},_0x4dc764={};_0x4dc764[_0x70e4('0x37')]=_['keys'](db[_0x70e4('0x44')]['rawAttributes']);_0x4dc764[_0x70e4('0x34')]=_[_0x70e4('0x33')](_0xd462e2[_0x70e4('0x34')]);_0x4dc764[_0x70e4('0x35')]=_[_0x70e4('0x36')](_0x4dc764[_0x70e4('0x37')],_0x4dc764[_0x70e4('0x34')]);_0x59ce4f[_0x70e4('0x3a')]=_[_0x70e4('0x36')](_0x4dc764[_0x70e4('0x37')],qs['fields'](_0xd462e2['query'][_0x70e4('0x38')]));_0x59ce4f[_0x70e4('0x3a')]=_0x59ce4f[_0x70e4('0x3a')][_0x70e4('0x39')]?_0x59ce4f[_0x70e4('0x3a')]:_0x4dc764[_0x70e4('0x37')];if(_0xd462e2[_0x70e4('0x34')][_0x70e4('0x45')]){_0x59ce4f[_0x70e4('0x46')]=[{'all':!![]}];}_0x59ce4f=_[_0x70e4('0x42')]({},_0x59ce4f,_0xd462e2[_0x70e4('0x43')]);return db[_0x70e4('0x44')][_0x70e4('0x4c')](_0x59ce4f)[_0x70e4('0x2c')](handleEntityNotFound(_0x345dad,null))[_0x70e4('0x2c')](respondWithResult(_0x345dad,null))[_0x70e4('0x49')](handleError(_0x345dad,null));};exports[_0x70e4('0x4d')]=function(_0x3cbf0b,_0xd06aa){return db[_0x70e4('0x44')][_0x70e4('0x4d')](_0x3cbf0b[_0x70e4('0x4e')],{})[_0x70e4('0x2c')](respondWithResult(_0xd06aa,0xc9))['catch'](handleError(_0xd06aa,null));};exports[_0x70e4('0x4f')]=function(_0x486b89,_0x3b18ac){if(_0x486b89[_0x70e4('0x4e')]['id']){delete _0x486b89[_0x70e4('0x4e')]['id'];}return db[_0x70e4('0x44')]['find']({'where':{'id':_0x486b89['params']['id']}})[_0x70e4('0x2c')](handleEntityNotFound(_0x3b18ac,null))[_0x70e4('0x2c')](saveUpdates(_0x486b89[_0x70e4('0x4e')],null))[_0x70e4('0x2c')](respondWithResult(_0x3b18ac,null))[_0x70e4('0x49')](handleError(_0x3b18ac,null));};exports['destroy']=function(_0x103307,_0x1386ce){return db[_0x70e4('0x44')][_0x70e4('0x4c')]({'where':{'id':_0x103307['params']['id']}})[_0x70e4('0x2c')](handleEntityNotFound(_0x1386ce,null))[_0x70e4('0x2c')](removeEntity(_0x1386ce,null))[_0x70e4('0x49')](handleError(_0x1386ce,null));};exports[_0x70e4('0x50')]=function(_0x5bd887,_0x3dfea9){return db[_0x70e4('0x44')][_0x70e4('0x50')]()['then'](respondWithResult(_0x3dfea9,null))[_0x70e4('0x49')](handleError(_0x3dfea9,null));};exports['getVoiceQueuesReport']=function(_0x1561ef,_0x55f4c7){var _0x4e837f={},_0x10a295={},_0x107c45={'count':0x0,'rows':[]};_0x10a295[_0x70e4('0x37')]=_['keys'](db[_0x70e4('0x44')][_0x70e4('0x31')]);_0x10a295[_0x70e4('0x34')]=_[_0x70e4('0x33')](_0x1561ef[_0x70e4('0x34')]);_0x10a295[_0x70e4('0x35')]=_[_0x70e4('0x36')](_0x10a295['model'],_0x10a295[_0x70e4('0x34')]);_0x4e837f[_0x70e4('0x3a')]=_[_0x70e4('0x36')](_0x10a295[_0x70e4('0x37')],qs[_0x70e4('0x38')](_0x1561ef[_0x70e4('0x34')][_0x70e4('0x38')]));_0x4e837f[_0x70e4('0x3a')]=_0x4e837f[_0x70e4('0x3a')]['length']?_0x4e837f[_0x70e4('0x3a')]:_0x10a295[_0x70e4('0x37')];if(!_0x1561ef[_0x70e4('0x34')][_0x70e4('0x3b')](_0x70e4('0x3c'))){_0x4e837f[_0x70e4('0x25')]=qs[_0x70e4('0x25')](_0x1561ef[_0x70e4('0x34')][_0x70e4('0x25')]);_0x4e837f[_0x70e4('0x23')]=qs['offset'](_0x1561ef[_0x70e4('0x34')][_0x70e4('0x23')]);}_0x4e837f['order']=qs['sort'](_0x1561ef[_0x70e4('0x34')][_0x70e4('0x3d')]);_0x4e837f[_0x70e4('0x3e')]=qs['filters'](_[_0x70e4('0x3f')](_0x1561ef['query'],_0x10a295['filters']));if(_0x1561ef[_0x70e4('0x34')][_0x70e4('0x41')]){_0x4e837f[_0x70e4('0x3e')]=_['merge'](_0x4e837f[_0x70e4('0x3e')],{'$or':_[_0x70e4('0x30')](_0x4e837f['attributes'],function(_0x2fdea3){var _0x307740={};_0x307740[_0x2fdea3]={'$like':'%'+_0x1561ef[_0x70e4('0x34')][_0x70e4('0x41')]+'%'};return _0x307740;})});}_0x4e837f=_[_0x70e4('0x42')]({},_0x4e837f,_0x1561ef[_0x70e4('0x43')]);var _0x5569e9={'where':_0x4e837f['where']};return db['VoiceQueueReport'][_0x70e4('0x26')](_0x5569e9)[_0x70e4('0x2c')](function(_0x59caac){_0x107c45[_0x70e4('0x26')]=_0x59caac;if(_0x1561ef[_0x70e4('0x34')][_0x70e4('0x45')]){_0x4e837f[_0x70e4('0x46')]=[{'all':!![]}];}return db[_0x70e4('0x44')][_0x70e4('0x47')](_0x4e837f);})[_0x70e4('0x2c')](function(_0x5f078a){_0x107c45[_0x70e4('0x48')]=_0x5f078a;return _0x107c45;})['then'](respondWithFilteredResult(_0x55f4c7,_0x4e837f,'getVoiceQueuesReport'))[_0x70e4('0x49')](handleError(_0x55f4c7,null,_0x70e4('0x51')));}; \ No newline at end of file +var _0x0f95=['mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','show','params','keys','find','create','body','catch','describe','getVoiceQueuesReport','fields','nolimit','pick','rows','eml-format','rimraf','moment','bluebird'];(function(_0xde5289,_0xa05cf9){var _0x1d27f3=function(_0x186a91){while(--_0x186a91){_0xde5289['push'](_0xde5289['shift']());}};_0x1d27f3(++_0xa05cf9);}(_0x0f95,0xec));var _0x50f9=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x0f95[_0x1d426f];return _0x17f71a;};'use strict';var emlformat=require(_0x50f9('0x0'));var rimraf=require(_0x50f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x50f9('0x2'));var BPromise=require(_0x50f9('0x3'));var Mustache=require(_0x50f9('0x4'));var util=require(_0x50f9('0x5'));var path=require(_0x50f9('0x6'));var sox=require('sox');var csv=require(_0x50f9('0x7'));var ejs=require(_0x50f9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50f9('0x9'));var squel=require(_0x50f9('0xa'));var crypto=require(_0x50f9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x50f9('0xc'));var toCsv=require(_0x50f9('0x7'));var querystring=require(_0x50f9('0xd'));var Papa=require(_0x50f9('0xe'));var Redis=require(_0x50f9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x50f9('0x10'));var as=require(_0x50f9('0x11'));var hardwareService=require(_0x50f9('0x12'));var logger=require(_0x50f9('0x13'))('api');var utils=require(_0x50f9('0x14'));var config=require(_0x50f9('0x15'));var licenseUtil=require(_0x50f9('0x16'));var db=require('../../mysqldb')['db'];config[_0x50f9('0x17')]=_[_0x50f9('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x50f9('0x19'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x10e74a,_0x639d85){_0x639d85=_0x639d85||0xcc;return function(_0x2c020f){if(_0x2c020f){return _0x10e74a[_0x50f9('0x1a')](_0x639d85);}return _0x10e74a[_0x50f9('0x1b')](_0x639d85)['end']();};}function respondWithResult(_0x39e87d,_0x3c9855){_0x3c9855=_0x3c9855||0xc8;return function(_0x35a775){if(_0x35a775){return _0x39e87d[_0x50f9('0x1b')](_0x3c9855)[_0x50f9('0x1c')](_0x35a775);}};}function respondWithFilteredResult(_0x29353d,_0x2aba4f){return function(_0x14fcfb){if(_0x14fcfb){var _0x475a99=typeof _0x2aba4f['offset']===_0x50f9('0x1d')&&typeof _0x2aba4f[_0x50f9('0x1e')]==='undefined';var _0x1c8052=_0x14fcfb[_0x50f9('0x1f')];var _0x2b5f79=_0x475a99?0x0:_0x2aba4f[_0x50f9('0x20')];var _0x4f1474=_0x475a99?_0x14fcfb[_0x50f9('0x1f')]:_0x2aba4f[_0x50f9('0x20')]+_0x2aba4f[_0x50f9('0x1e')];var _0x31ed68;if(_0x4f1474>=_0x1c8052){_0x4f1474=_0x1c8052;_0x31ed68=0xc8;}else{_0x31ed68=0xce;}_0x29353d[_0x50f9('0x1b')](_0x31ed68);return _0x29353d[_0x50f9('0x21')](_0x50f9('0x22'),_0x2b5f79+'-'+_0x4f1474+'/'+_0x1c8052)[_0x50f9('0x1c')](_0x14fcfb);}return null;};}function patchUpdates(_0x8c5a66){return function(_0xc0212d){try{jsonpatch[_0x50f9('0x23')](_0xc0212d,_0x8c5a66,!![]);}catch(_0x548ba7){return BPromise[_0x50f9('0x24')](_0x548ba7);}return _0xc0212d[_0x50f9('0x25')]();};}function saveUpdates(_0x42c7ad,_0x203eeb){return function(_0x26dbe4){if(_0x26dbe4){return _0x26dbe4[_0x50f9('0x26')](_0x42c7ad)[_0x50f9('0x27')](function(_0x5318d5){return _0x5318d5;});}return null;};}function removeEntity(_0x253068,_0x332b05){return function(_0x36c0ed){if(_0x36c0ed){return _0x36c0ed[_0x50f9('0x28')]()['then'](function(){_0x253068[_0x50f9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3caea2,_0x48872f){return function(_0x22115a){if(!_0x22115a){_0x3caea2[_0x50f9('0x1a')](0x194);}return _0x22115a;};}function handleError(_0x323813,_0x15b6da){_0x15b6da=_0x15b6da||0x1f4;return function(_0xbf81d7){logger[_0x50f9('0x29')](_0xbf81d7[_0x50f9('0x2a')]);if(_0xbf81d7[_0x50f9('0x2b')]){delete _0xbf81d7[_0x50f9('0x2b')];}_0x323813[_0x50f9('0x1b')](_0x15b6da)[_0x50f9('0x2c')](_0xbf81d7);};}exports[_0x50f9('0x2d')]=function(_0x866622,_0x570c3a){var _0x5aab1e={},_0x5e3bd6={},_0x1391d7={'count':0x0,'rows':[]};var _0x3c257a=_[_0x50f9('0x2e')](db['VoiceQueueReport'][_0x50f9('0x2f')],function(_0x8cb448){return{'name':_0x8cb448[_0x50f9('0x30')],'type':_0x8cb448['type'][_0x50f9('0x31')]};});_0x5e3bd6['model']=_[_0x50f9('0x2e')](_0x3c257a,_0x50f9('0x2b'));_0x5e3bd6['query']=_['keys'](_0x866622[_0x50f9('0x32')]);_0x5e3bd6[_0x50f9('0x33')]=_[_0x50f9('0x34')](_0x5e3bd6[_0x50f9('0x35')],_0x5e3bd6['query']);_0x5aab1e[_0x50f9('0x36')]=_['intersection'](_0x5e3bd6[_0x50f9('0x35')],qs['fields'](_0x866622[_0x50f9('0x32')]['fields']));_0x5aab1e['attributes']=_0x5aab1e['attributes'][_0x50f9('0x37')]?_0x5aab1e[_0x50f9('0x36')]:_0x5e3bd6[_0x50f9('0x35')];if(!_0x866622['query'][_0x50f9('0x38')]('nolimit')){_0x5aab1e[_0x50f9('0x1e')]=qs[_0x50f9('0x1e')](_0x866622['query'][_0x50f9('0x1e')]);_0x5aab1e[_0x50f9('0x20')]=qs['offset'](_0x866622[_0x50f9('0x32')]['offset']);}_0x5aab1e[_0x50f9('0x39')]=qs[_0x50f9('0x3a')](_0x866622[_0x50f9('0x32')][_0x50f9('0x3a')]);_0x5aab1e[_0x50f9('0x3b')]=qs['filters'](_['pick'](_0x866622['query'],_0x5e3bd6[_0x50f9('0x33')]),_0x3c257a);if(_0x866622[_0x50f9('0x32')][_0x50f9('0x3c')]){_0x5aab1e[_0x50f9('0x3b')]=_[_0x50f9('0x3d')](_0x5aab1e['where'],{'$or':_[_0x50f9('0x2e')](_0x3c257a,function(_0x5226d8){if(_0x5226d8['type']!=='VIRTUAL'){var _0x12d5eb={};_0x12d5eb[_0x5226d8['name']]={'$like':'%'+_0x866622['query'][_0x50f9('0x3c')]+'%'};return _0x12d5eb;}})});}_0x5aab1e=_[_0x50f9('0x3d')]({},_0x5aab1e,_0x866622[_0x50f9('0x3e')]);var _0x5e13a8={'where':_0x5aab1e['where']};return db[_0x50f9('0x3f')][_0x50f9('0x1f')](_0x5e13a8)['then'](function(_0x1a303a){_0x1391d7[_0x50f9('0x1f')]=_0x1a303a;if(_0x866622['query'][_0x50f9('0x40')]){_0x5aab1e[_0x50f9('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x50f9('0x42')](_0x5aab1e);})[_0x50f9('0x27')](function(_0x4bd5b7){_0x1391d7['rows']=_0x4bd5b7;return _0x1391d7;})[_0x50f9('0x27')](respondWithFilteredResult(_0x570c3a,_0x5aab1e))['catch'](handleError(_0x570c3a,null));};exports[_0x50f9('0x43')]=function(_0x37b7c0,_0x34c143){var _0x28e9d6={'raw':![],'where':{'id':_0x37b7c0[_0x50f9('0x44')]['id']}},_0x3119d8={};_0x3119d8['model']=_[_0x50f9('0x45')](db[_0x50f9('0x3f')][_0x50f9('0x2f')]);_0x3119d8['query']=_['keys'](_0x37b7c0[_0x50f9('0x32')]);_0x3119d8[_0x50f9('0x33')]=_['intersection'](_0x3119d8[_0x50f9('0x35')],_0x3119d8[_0x50f9('0x32')]);_0x28e9d6[_0x50f9('0x36')]=_[_0x50f9('0x34')](_0x3119d8[_0x50f9('0x35')],qs['fields'](_0x37b7c0[_0x50f9('0x32')]['fields']));_0x28e9d6[_0x50f9('0x36')]=_0x28e9d6[_0x50f9('0x36')][_0x50f9('0x37')]?_0x28e9d6['attributes']:_0x3119d8['model'];if(_0x37b7c0[_0x50f9('0x32')][_0x50f9('0x40')]){_0x28e9d6[_0x50f9('0x41')]=[{'all':!![]}];}_0x28e9d6=_[_0x50f9('0x3d')]({},_0x28e9d6,_0x37b7c0['options']);return db[_0x50f9('0x3f')][_0x50f9('0x46')](_0x28e9d6)[_0x50f9('0x27')](handleEntityNotFound(_0x34c143,null))[_0x50f9('0x27')](respondWithResult(_0x34c143,null))['catch'](handleError(_0x34c143,null));};exports['create']=function(_0x525e5b,_0x228a65){return db[_0x50f9('0x3f')][_0x50f9('0x47')](_0x525e5b['body'],{})[_0x50f9('0x27')](respondWithResult(_0x228a65,0xc9))['catch'](handleError(_0x228a65,null));};exports['update']=function(_0x461d86,_0x1c4cb4){if(_0x461d86[_0x50f9('0x48')]['id']){delete _0x461d86[_0x50f9('0x48')]['id'];}return db[_0x50f9('0x3f')]['find']({'where':{'id':_0x461d86['params']['id']}})[_0x50f9('0x27')](handleEntityNotFound(_0x1c4cb4,null))[_0x50f9('0x27')](saveUpdates(_0x461d86['body'],null))[_0x50f9('0x27')](respondWithResult(_0x1c4cb4,null))[_0x50f9('0x49')](handleError(_0x1c4cb4,null));};exports[_0x50f9('0x28')]=function(_0x1d2ad1,_0x5d2680){return db[_0x50f9('0x3f')][_0x50f9('0x46')]({'where':{'id':_0x1d2ad1[_0x50f9('0x44')]['id']}})[_0x50f9('0x27')](handleEntityNotFound(_0x5d2680,null))[_0x50f9('0x27')](removeEntity(_0x5d2680,null))[_0x50f9('0x49')](handleError(_0x5d2680,null));};exports[_0x50f9('0x4a')]=function(_0x50ccec,_0xd19a8f){return db[_0x50f9('0x3f')][_0x50f9('0x4a')]()['then'](respondWithResult(_0xd19a8f,null))['catch'](handleError(_0xd19a8f,null));};exports[_0x50f9('0x4b')]=function(_0x5a95ec,_0x457a73){var _0x569dde={},_0x53c1e3={},_0x57040a={'count':0x0,'rows':[]};_0x53c1e3[_0x50f9('0x35')]=_[_0x50f9('0x45')](db['VoiceQueueReport'][_0x50f9('0x2f')]);_0x53c1e3['query']=_[_0x50f9('0x45')](_0x5a95ec[_0x50f9('0x32')]);_0x53c1e3['filters']=_[_0x50f9('0x34')](_0x53c1e3[_0x50f9('0x35')],_0x53c1e3['query']);_0x569dde['attributes']=_[_0x50f9('0x34')](_0x53c1e3[_0x50f9('0x35')],qs[_0x50f9('0x4c')](_0x5a95ec['query'][_0x50f9('0x4c')]));_0x569dde[_0x50f9('0x36')]=_0x569dde[_0x50f9('0x36')]['length']?_0x569dde[_0x50f9('0x36')]:_0x53c1e3['model'];if(!_0x5a95ec['query'][_0x50f9('0x38')](_0x50f9('0x4d'))){_0x569dde[_0x50f9('0x1e')]=qs[_0x50f9('0x1e')](_0x5a95ec[_0x50f9('0x32')][_0x50f9('0x1e')]);_0x569dde[_0x50f9('0x20')]=qs['offset'](_0x5a95ec[_0x50f9('0x32')][_0x50f9('0x20')]);}_0x569dde[_0x50f9('0x39')]=qs[_0x50f9('0x3a')](_0x5a95ec['query'][_0x50f9('0x3a')]);_0x569dde[_0x50f9('0x3b')]=qs[_0x50f9('0x33')](_[_0x50f9('0x4e')](_0x5a95ec[_0x50f9('0x32')],_0x53c1e3[_0x50f9('0x33')]));if(_0x5a95ec[_0x50f9('0x32')]['filter']){_0x569dde[_0x50f9('0x3b')]=_[_0x50f9('0x3d')](_0x569dde[_0x50f9('0x3b')],{'$or':_[_0x50f9('0x2e')](_0x569dde[_0x50f9('0x36')],function(_0x764b09){var _0xd11141={};_0xd11141[_0x764b09]={'$like':'%'+_0x5a95ec[_0x50f9('0x32')][_0x50f9('0x3c')]+'%'};return _0xd11141;})});}_0x569dde=_[_0x50f9('0x3d')]({},_0x569dde,_0x5a95ec[_0x50f9('0x3e')]);var _0x19c963={'where':_0x569dde[_0x50f9('0x3b')]};return db[_0x50f9('0x3f')][_0x50f9('0x1f')](_0x19c963)[_0x50f9('0x27')](function(_0xf0c1b0){_0x57040a[_0x50f9('0x1f')]=_0xf0c1b0;if(_0x5a95ec[_0x50f9('0x32')][_0x50f9('0x40')]){_0x569dde[_0x50f9('0x41')]=[{'all':!![]}];}return db[_0x50f9('0x3f')]['findAll'](_0x569dde);})[_0x50f9('0x27')](function(_0x2c981d){_0x57040a[_0x50f9('0x4f')]=_0x2c981d;return _0x57040a;})[_0x50f9('0x27')](respondWithFilteredResult(_0x457a73,_0x569dde,_0x50f9('0x4b')))['catch'](handleError(_0x457a73,null,_0x50f9('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 58192fd..861fa20 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 _0x8bf4=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4727b8,_0x38988b){var _0x5edded=function(_0x34e330){while(--_0x34e330){_0x4727b8['push'](_0x4727b8['shift']());}};_0x5edded(++_0x38988b);}(_0x8bf4,0x1ea));var _0x48bf=function(_0x5c0368,_0x423cf2){_0x5c0368=_0x5c0368-0x0;var _0x5b31b9=_0x8bf4[_0x5c0368];return _0x5b31b9;};'use strict';var EventEmitter=require(_0x48bf('0x0'));var VoiceQueueReport=require(_0x48bf('0x1'))['db'][_0x48bf('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x48bf('0x3')](0x0);var events={'afterCreate':_0x48bf('0x4'),'afterUpdate':_0x48bf('0x5'),'afterDestroy':_0x48bf('0x6')};function emitEvent(_0x3353f6){return function(_0x4f6ff3,_0x4fe82a,_0x1871b1){VoiceQueueReportEvents[_0x48bf('0x7')](_0x3353f6+':'+_0x4f6ff3['id'],_0x4f6ff3);VoiceQueueReportEvents['emit'](_0x3353f6,_0x4f6ff3);_0x1871b1(null);};}for(var e in events){if(events[_0x48bf('0x8')](e)){var event=events[e];VoiceQueueReport[_0x48bf('0x9')](e,emitEvent(event));}}module[_0x48bf('0xa')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xdddd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x5c1e74,_0x49dece){var _0xa60bd9=function(_0xa80fb9){while(--_0xa80fb9){_0x5c1e74['push'](_0x5c1e74['shift']());}};_0xa60bd9(++_0x49dece);}(_0xdddd,0x177));var _0xdddd=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xdddd[_0x133277];return _0x5b4a22;};'use strict';var EventEmitter=require(_0xdddd('0x0'));var VoiceQueueReport=require(_0xdddd('0x1'))['db'][_0xdddd('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdddd('0x3'),'afterUpdate':_0xdddd('0x4'),'afterDestroy':_0xdddd('0x5')};function emitEvent(_0x431ca1){return function(_0x109722,_0x193c73,_0x49cb0c){VoiceQueueReportEvents[_0xdddd('0x6')](_0x431ca1+':'+_0x109722['id'],_0x109722);VoiceQueueReportEvents[_0xdddd('0x6')](_0x431ca1,_0x109722);_0x49cb0c(null);};}for(var e in events){if(events[_0xdddd('0x7')](e)){var event=events[e];VoiceQueueReport[_0xdddd('0x8')](e,emitEvent(event));}}module[_0xdddd('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3c7858d..87be5fc 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 _0x2b73=['VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x527a20,_0x347399){var _0x21f5e0=function(_0x2e01f8){while(--_0x2e01f8){_0x527a20['push'](_0x527a20['shift']());}};_0x21f5e0(++_0x347399);}(_0x2b73,0x10e));var _0x32b7=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2b73[_0x311c35];return _0x5cc50c;};'use strict';var _=require('lodash');var util=require(_0x32b7('0x0'));var logger=require('../../config/logger')(_0x32b7('0x1'));var moment=require(_0x32b7('0x2'));var BPromise=require(_0x32b7('0x3'));var rp=require(_0x32b7('0x4'));var fs=require('fs');var path=require(_0x32b7('0x5'));var rimraf=require(_0x32b7('0x6'));var config=require(_0x32b7('0x7'));var attributes=require(_0x32b7('0x8'));module[_0x32b7('0x9')]=function(_0x55c6b2,_0x236253){return _0x55c6b2['define'](_0x32b7('0xa'),attributes,{'tableName':_0x32b7('0xb'),'paranoid':![],'indexes':[{'fields':[_0x32b7('0xc')]},{'fields':[_0x32b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ffb=['calleridnum','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x2f2201,_0xa80b1e){var _0x54e5f7=function(_0x14506b){while(--_0x14506b){_0x2f2201['push'](_0x2f2201['shift']());}};_0x54e5f7(++_0xa80b1e);}(_0x6ffb,0x181));var _0xb6ff=function(_0x1bf897,_0x5f2bc0){_0x1bf897=_0x1bf897-0x0;var _0x4fdab0=_0x6ffb[_0x1bf897];return _0x4fdab0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6ff('0x0'))(_0xb6ff('0x1'));var moment=require(_0xb6ff('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6ff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6ff('0x4'));var config=require(_0xb6ff('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xb6ff('0x6')]=function(_0x21fdd9,_0x58c5f1){return _0x21fdd9['define']('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb6ff('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index dff077e..b812255 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 _0xd1d0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','raw','UpdateVoiceQueueReport','update','util','moment','randomstring'];(function(_0x650042,_0x5b545a){var _0x194087=function(_0x12413c){while(--_0x12413c){_0x650042['push'](_0x650042['shift']());}};_0x194087(++_0x5b545a);}(_0xd1d0,0xd4));var _0x0d1d=function(_0x291d81,_0x9fe590){_0x291d81=_0x291d81-0x0;var _0x5ea1b5=_0xd1d0[_0x291d81];return _0x5ea1b5;};'use strict';var _=require('lodash');var util=require(_0x0d1d('0x0'));var moment=require(_0x0d1d('0x1'));var BPromise=require('bluebird');var rs=require(_0x0d1d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d1d('0x3'))['db'];var utils=require(_0x0d1d('0x4'));var logger=require(_0x0d1d('0x5'))(_0x0d1d('0x6'));var config=require(_0x0d1d('0x7'));var jayson=require(_0x0d1d('0x8'));var client=jayson[_0x0d1d('0x9')]['http']({'port':0x232a});config[_0x0d1d('0xa')]=_[_0x0d1d('0xb')](config[_0x0d1d('0xa')],{'host':_0x0d1d('0xc'),'port':0x18eb});var socket=require(_0x0d1d('0xd'))(new Redis(config[_0x0d1d('0xa')]));require(_0x0d1d('0xe'))[_0x0d1d('0xf')](socket);function respondWithRpcPromise(_0x212e2e,_0x2ff389,_0x34f84b){return new BPromise(function(_0x5716f1,_0x5d4aae){return client[_0x0d1d('0x10')](_0x212e2e,_0x34f84b)[_0x0d1d('0x11')](function(_0x38edbc){logger[_0x0d1d('0x12')](_0x0d1d('0x13'),_0x2ff389,'request\x20sent');logger[_0x0d1d('0x14')](_0x0d1d('0x15'),_0x2ff389,'request\x20sent',JSON[_0x0d1d('0x16')](_0x38edbc));if(_0x38edbc[_0x0d1d('0x17')]){if(_0x38edbc['error'][_0x0d1d('0x18')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2ff389,_0x38edbc[_0x0d1d('0x17')]['message']);return _0x5d4aae(_0x38edbc[_0x0d1d('0x17')][_0x0d1d('0x19')]);}logger[_0x0d1d('0x17')](_0x0d1d('0x13'),_0x2ff389,_0x38edbc[_0x0d1d('0x17')]['message']);return _0x5716f1(_0x38edbc['error'][_0x0d1d('0x19')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x2ff389,'request\x20sent');_0x5716f1(_0x38edbc[_0x0d1d('0x1a')][_0x0d1d('0x19')]);}})[_0x0d1d('0x1b')](function(_0x36b109){logger[_0x0d1d('0x17')](_0x0d1d('0x13'),_0x2ff389,_0x36b109);_0x5d4aae(_0x36b109);});});}exports['GetVoiceQueueReport']=function(_0x115968){var _0x3a6393=this;return new Promise(function(_0x6f41cd,_0x237f62){return db[_0x0d1d('0x1c')][_0x0d1d('0x1d')]({'raw':_0x115968[_0x0d1d('0x1e')]?_0x115968[_0x0d1d('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x115968[_0x0d1d('0x1e')]?_0x115968[_0x0d1d('0x1e')][_0x0d1d('0x1f')]||null:null,'attributes':_0x115968[_0x0d1d('0x1e')]?_0x115968['options'][_0x0d1d('0x20')]||null:null,'limit':_0x115968[_0x0d1d('0x1e')]?_0x115968[_0x0d1d('0x1e')][_0x0d1d('0x21')]||null:null,'include':_0x115968[_0x0d1d('0x1e')]?_0x115968[_0x0d1d('0x1e')][_0x0d1d('0x22')]?_[_0x0d1d('0x23')](_0x115968['options'][_0x0d1d('0x22')],function(_0x6b548){return{'model':db[_0x6b548[_0x0d1d('0x24')]],'as':_0x6b548['as'],'attributes':_0x6b548[_0x0d1d('0x20')],'include':_0x6b548[_0x0d1d('0x22')]?_[_0x0d1d('0x23')](_0x6b548['include'],function(_0xd49a9d){return{'model':db[_0xd49a9d[_0x0d1d('0x24')]],'as':_0xd49a9d['as'],'attributes':_0xd49a9d[_0x0d1d('0x20')],'include':_0xd49a9d[_0x0d1d('0x22')]?_[_0x0d1d('0x23')](_0xd49a9d[_0x0d1d('0x22')],function(_0x20b8c8){return{'model':db[_0x20b8c8[_0x0d1d('0x24')]],'as':_0x20b8c8['as'],'attributes':_0x20b8c8[_0x0d1d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0d1d('0x11')](function(_0x2de37a){logger['info'](_0x0d1d('0x25'),_0x115968);logger[_0x0d1d('0x14')](_0x0d1d('0x25'),_0x115968,JSON[_0x0d1d('0x16')](_0x2de37a));_0x6f41cd(_0x2de37a);})['catch'](function(_0x1a95cf){logger[_0x0d1d('0x17')](_0x0d1d('0x25'),_0x1a95cf[_0x0d1d('0x19')],_0x115968);_0x237f62(_0x3a6393['error'](0x1f4,_0x1a95cf[_0x0d1d('0x19')]));});});};exports[_0x0d1d('0x26')]=function(_0x34cb92){var _0x3cb05e=this;return new Promise(function(_0x431586,_0x310f50){return db['VoiceQueueReport'][_0x0d1d('0x27')](_0x34cb92['body'],{'raw':_0x34cb92['options']?_0x34cb92['options'][_0x0d1d('0x28')]===undefined?!![]:![]:!![]})[_0x0d1d('0x11')](function(_0x5392bc){logger[_0x0d1d('0x12')]('CreateVoiceQueueReport',_0x34cb92);logger['debug'](_0x0d1d('0x26'),_0x34cb92,JSON[_0x0d1d('0x16')](_0x5392bc));_0x431586(_0x5392bc);})[_0x0d1d('0x1b')](function(_0x1f83b9){logger[_0x0d1d('0x17')](_0x0d1d('0x26'),_0x1f83b9[_0x0d1d('0x19')],_0x34cb92);_0x310f50(_0x3cb05e[_0x0d1d('0x17')](0x1f4,_0x1f83b9['message']));});});};exports[_0x0d1d('0x29')]=function(_0x59a93a){var _0x384214=this;return new Promise(function(_0x1f0b4c,_0x20fc9b){return db[_0x0d1d('0x1c')][_0x0d1d('0x2a')](_0x59a93a['body'],{'raw':_0x59a93a[_0x0d1d('0x1e')]?_0x59a93a[_0x0d1d('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59a93a['options']?_0x59a93a[_0x0d1d('0x1e')]['where']||null:null,'attributes':_0x59a93a[_0x0d1d('0x1e')]?_0x59a93a[_0x0d1d('0x1e')][_0x0d1d('0x20')]||null:null,'limit':_0x59a93a[_0x0d1d('0x1e')]?_0x59a93a[_0x0d1d('0x1e')]['limit']||null:null})[_0x0d1d('0x11')](function(_0x432c20){logger['info']('UpdateVoiceQueueReport',_0x59a93a);logger[_0x0d1d('0x14')](_0x0d1d('0x29'),_0x59a93a,JSON[_0x0d1d('0x16')](_0x432c20));_0x1f0b4c(_0x432c20);})[_0x0d1d('0x1b')](function(_0x4424b5){logger[_0x0d1d('0x17')](_0x0d1d('0x29'),_0x4424b5[_0x0d1d('0x19')],_0x59a93a);_0x20fc9b(_0x384214['error'](0x1f4,_0x4424b5['message']));});});}; \ No newline at end of file +var _0x5338=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0x5338,0x81));var _0x8533=function(_0x36d586,_0x419ab7){_0x36d586=_0x36d586-0x0;var _0x130e2e=_0x5338[_0x36d586];return _0x130e2e;};'use strict';var _=require(_0x8533('0x0'));var util=require(_0x8533('0x1'));var moment=require(_0x8533('0x2'));var BPromise=require('bluebird');var rs=require(_0x8533('0x3'));var fs=require('fs');var Redis=require(_0x8533('0x4'));var db=require(_0x8533('0x5'))['db'];var utils=require(_0x8533('0x6'));var logger=require('../../config/logger')(_0x8533('0x7'));var config=require(_0x8533('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8533('0x9')]['http']({'port':0x232a});config[_0x8533('0xa')]=_['defaults'](config[_0x8533('0xa')],{'host':_0x8533('0xb'),'port':0x18eb});var socket=require(_0x8533('0xc'))(new Redis(config[_0x8533('0xa')]));require(_0x8533('0xd'))[_0x8533('0xe')](socket);function respondWithRpcPromise(_0x2a177d,_0x262d84,_0x25099f){return new BPromise(function(_0xe9d6a,_0x416be3){return client[_0x8533('0xf')](_0x2a177d,_0x25099f)['then'](function(_0x4b4a4e){logger['info'](_0x8533('0x10'),_0x262d84,_0x8533('0x11'));logger['debug'](_0x8533('0x12'),_0x262d84,_0x8533('0x11'),JSON[_0x8533('0x13')](_0x4b4a4e));if(_0x4b4a4e[_0x8533('0x14')]){if(_0x4b4a4e['error'][_0x8533('0x15')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x262d84,_0x4b4a4e['error'][_0x8533('0x16')]);return _0x416be3(_0x4b4a4e[_0x8533('0x14')][_0x8533('0x16')]);}logger[_0x8533('0x14')](_0x8533('0x10'),_0x262d84,_0x4b4a4e[_0x8533('0x14')]['message']);return _0xe9d6a(_0x4b4a4e[_0x8533('0x14')][_0x8533('0x16')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x262d84,_0x8533('0x11'));_0xe9d6a(_0x4b4a4e[_0x8533('0x17')]['message']);}})[_0x8533('0x18')](function(_0x2fa7c9){logger[_0x8533('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x262d84,_0x2fa7c9);_0x416be3(_0x2fa7c9);});});}exports[_0x8533('0x19')]=function(_0x3f0858){var _0x5c01aa=this;return new Promise(function(_0x4c5370,_0x5b2ba2){return db[_0x8533('0x1a')][_0x8533('0x1b')]({'raw':_0x3f0858[_0x8533('0x1c')]?_0x3f0858[_0x8533('0x1c')][_0x8533('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f0858[_0x8533('0x1c')]?_0x3f0858[_0x8533('0x1c')][_0x8533('0x1e')]||null:null,'attributes':_0x3f0858[_0x8533('0x1c')]?_0x3f0858[_0x8533('0x1c')][_0x8533('0x1f')]||null:null,'limit':_0x3f0858['options']?_0x3f0858['options'][_0x8533('0x20')]||null:null,'include':_0x3f0858[_0x8533('0x1c')]?_0x3f0858['options'][_0x8533('0x21')]?_[_0x8533('0x22')](_0x3f0858[_0x8533('0x1c')][_0x8533('0x21')],function(_0x2301b1){return{'model':db[_0x2301b1[_0x8533('0x23')]],'as':_0x2301b1['as'],'attributes':_0x2301b1[_0x8533('0x1f')],'include':_0x2301b1[_0x8533('0x21')]?_['map'](_0x2301b1['include'],function(_0x38db85){return{'model':db[_0x38db85[_0x8533('0x23')]],'as':_0x38db85['as'],'attributes':_0x38db85[_0x8533('0x1f')],'include':_0x38db85[_0x8533('0x21')]?_[_0x8533('0x22')](_0x38db85['include'],function(_0x4ff6bd){return{'model':db[_0x4ff6bd[_0x8533('0x23')]],'as':_0x4ff6bd['as'],'attributes':_0x4ff6bd[_0x8533('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8533('0x24')](function(_0x513675){logger[_0x8533('0x25')](_0x8533('0x19'),_0x3f0858);logger[_0x8533('0x26')](_0x8533('0x19'),_0x3f0858,JSON[_0x8533('0x13')](_0x513675));_0x4c5370(_0x513675);})[_0x8533('0x18')](function(_0x7daaf8){logger['error']('GetVoiceQueueReport',_0x7daaf8['message'],_0x3f0858);_0x5b2ba2(_0x5c01aa[_0x8533('0x14')](0x1f4,_0x7daaf8[_0x8533('0x16')]));});});};exports[_0x8533('0x27')]=function(_0x466a95){var _0x47bb6b=this;return new Promise(function(_0x5947b7,_0x570d0){return db[_0x8533('0x1a')]['create'](_0x466a95[_0x8533('0x28')],{'raw':_0x466a95[_0x8533('0x1c')]?_0x466a95['options'][_0x8533('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x511731){logger[_0x8533('0x25')](_0x8533('0x27'),_0x466a95);logger[_0x8533('0x26')](_0x8533('0x27'),_0x466a95,JSON[_0x8533('0x13')](_0x511731));_0x5947b7(_0x511731);})[_0x8533('0x18')](function(_0x5dff46){logger[_0x8533('0x14')](_0x8533('0x27'),_0x5dff46[_0x8533('0x16')],_0x466a95);_0x570d0(_0x47bb6b[_0x8533('0x14')](0x1f4,_0x5dff46[_0x8533('0x16')]));});});};exports[_0x8533('0x29')]=function(_0x51c9f3){var _0x353f70=this;return new Promise(function(_0x16bfa1,_0x3781fb){return db[_0x8533('0x1a')][_0x8533('0x2a')](_0x51c9f3['body'],{'raw':_0x51c9f3[_0x8533('0x1c')]?_0x51c9f3[_0x8533('0x1c')][_0x8533('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51c9f3[_0x8533('0x1c')]?_0x51c9f3['options'][_0x8533('0x1e')]||null:null,'attributes':_0x51c9f3[_0x8533('0x1c')]?_0x51c9f3[_0x8533('0x1c')][_0x8533('0x1f')]||null:null,'limit':_0x51c9f3[_0x8533('0x1c')]?_0x51c9f3[_0x8533('0x1c')][_0x8533('0x20')]||null:null})[_0x8533('0x24')](function(_0x2db4fa){logger[_0x8533('0x25')](_0x8533('0x29'),_0x51c9f3);logger['debug'](_0x8533('0x29'),_0x51c9f3,JSON[_0x8533('0x13')](_0x2db4fa));_0x16bfa1(_0x2db4fa);})[_0x8533('0x18')](function(_0x2e0de8){logger['error']('UpdateVoiceQueueReport',_0x2e0de8['message'],_0x51c9f3);_0x3781fb(_0x353f70[_0x8533('0x14')](0x1f4,_0x2e0de8[_0x8533('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index fb93714..aaaf938 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 _0xd9c8=['./voiceQueueReport.events','save','update','emit','length','voiceQueueReport:'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xd9c8[_0x580576];return _0x3f55a0;};'use strict';var VoiceQueueReportEvents=require(_0x8d9c('0x0'));var events=[_0x8d9c('0x1'),'remove',_0x8d9c('0x2')];function createListener(_0x240e64,_0x2140c9){return function(_0xaecd58){_0x2140c9[_0x8d9c('0x3')](_0x240e64,_0xaecd58);};}function removeListener(_0x376ce5,_0xa7b017){return function(){VoiceQueueReportEvents['removeListener'](_0x376ce5,_0xa7b017);};}exports['register']=function(_0x53567f){for(var _0x2c083c=0x0,_0x1ebb5a=events[_0x8d9c('0x4')];_0x2c083c<_0x1ebb5a;_0x2c083c++){var _0x49c96f=events[_0x2c083c];var _0x3790f6=createListener(_0x8d9c('0x5')+_0x49c96f,_0x53567f);VoiceQueueReportEvents['on'](_0x49c96f,_0x3790f6);}}; \ No newline at end of file +var _0xc0a4=['update','emit','register','length','voiceQueueReport:','save','remove'];(function(_0x237226,_0xe3b3b1){var _0x173884=function(_0x204489){while(--_0x204489){_0x237226['push'](_0x237226['shift']());}};_0x173884(++_0xe3b3b1);}(_0xc0a4,0x147));var _0x4c0a=function(_0x22fc32,_0x4aa409){_0x22fc32=_0x22fc32-0x0;var _0x1c0680=_0xc0a4[_0x22fc32];return _0x1c0680;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4c0a('0x0'),_0x4c0a('0x1'),_0x4c0a('0x2')];function createListener(_0x489d78,_0x1afa7c){return function(_0x4727a9){_0x1afa7c[_0x4c0a('0x3')](_0x489d78,_0x4727a9);};}function removeListener(_0x23a18d,_0x44b0e7){return function(){VoiceQueueReportEvents['removeListener'](_0x23a18d,_0x44b0e7);};}exports[_0x4c0a('0x4')]=function(_0x1a78a1){for(var _0x12af4b=0x0,_0x457ef9=events[_0x4c0a('0x5')];_0x12af4b<_0x457ef9;_0x12af4b++){var _0x1a64e7=events[_0x12af4b];var _0x4093d5=createListener(_0x4c0a('0x6')+_0x1a64e7,_0x1a78a1);VoiceQueueReportEvents['on'](_0x1a64e7,_0x4093d5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index f0dfda1..8610e2a 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 _0x0531=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','multer','util','express'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x0531,0xde));var _0x1053=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x0531[_0xfb0281];return _0x408dd3;};'use strict';var multer=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1053('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1053('0x3'));var interaction=require(_0x1053('0x4'));var config=require(_0x1053('0x5'));var controller=require(_0x1053('0x6'));router[_0x1053('0x7')]('/',auth[_0x1053('0x8')](),controller[_0x1053('0x9')]);router[_0x1053('0x7')](_0x1053('0xa'),auth[_0x1053('0x8')](),controller['show']);router[_0x1053('0xb')]('/',auth[_0x1053('0x8')](),controller[_0x1053('0xc')]);router['put'](_0x1053('0xa'),auth[_0x1053('0x8')](),controller[_0x1053('0xd')]);router['delete']('/:id',auth[_0x1053('0x8')](),controller[_0x1053('0xe')]);module['exports']=router; \ No newline at end of file +var _0x481a=['isAuthenticated','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id'];(function(_0x1f7a55,_0x352d22){var _0x2a291b=function(_0xc9d9f6){while(--_0xc9d9f6){_0x1f7a55['push'](_0x1f7a55['shift']());}};_0x2a291b(++_0x352d22);}(_0x481a,0xbb));var _0xa481=function(_0x3bc72d,_0x5aaa33){_0x3bc72d=_0x3bc72d-0x0;var _0x3b7fbf=_0x481a[_0x3bc72d];return _0x3b7fbf;};'use strict';var multer=require(_0xa481('0x0'));var util=require(_0xa481('0x1'));var path=require(_0xa481('0x2'));var timeout=require(_0xa481('0x3'));var express=require(_0xa481('0x4'));var router=express['Router']();var fs_extra=require(_0xa481('0x5'));var auth=require(_0xa481('0x6'));var interaction=require(_0xa481('0x7'));var config=require(_0xa481('0x8'));var controller=require(_0xa481('0x9'));router[_0xa481('0xa')]('/',auth['isAuthenticated'](),controller[_0xa481('0xb')]);router[_0xa481('0xa')](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0xe')]);router[_0xa481('0xf')]('/',auth[_0xa481('0xd')](),controller[_0xa481('0x10')]);router['put'](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0x11')]);router['delete'](_0xa481('0xc'),auth[_0xa481('0xd')](),controller[_0xa481('0x12')]);module[_0xa481('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 23953bd..4e5131a 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 _0x2cce=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x178728,_0x3257cd){var _0x17a2da=function(_0x2bbc66){while(--_0x2bbc66){_0x178728['push'](_0x178728['shift']());}};_0x17a2da(++_0x3257cd);}(_0x2cce,0x8e));var _0xe2cc=function(_0x33fba4,_0x11136a){_0x33fba4=_0x33fba4-0x0;var _0xe3feb2=_0x2cce[_0x33fba4];return _0xe3feb2;};'use strict';var Sequelize=require(_0xe2cc('0x0'));var moment=require(_0xe2cc('0x1'));module[_0xe2cc('0x2')]={'time':{'type':Sequelize[_0xe2cc('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe2cc('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe2cc('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe2cc('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe2cc('0x4')],'allowNull':![],'defaultValue':moment()[_0xe2cc('0x5')](_0xe2cc('0x6'))}}; \ No newline at end of file +var _0x9e3e=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x495f4b,_0x185442){var _0x412c0e=function(_0x339ef0){while(--_0x339ef0){_0x495f4b['push'](_0x495f4b['shift']());}};_0x412c0e(++_0x185442);}(_0x9e3e,0x1c6));var _0xe9e3=function(_0x1fd155,_0x340af9){_0x1fd155=_0x1fd155-0x0;var _0x250e2f=_0x9e3e[_0x1fd155];return _0x250e2f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe9e3('0x0'));module['exports']={'time':{'type':Sequelize[_0xe9e3('0x1')]},'callid':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xe9e3('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xe9e3('0x2')],'allowNull':![],'defaultValue':moment()[_0xe9e3('0x3')](_0xe9e3('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2ab2073..5361777 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 _0xa6e8=['send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','undefined','limit','offset','count','status','set','Content-Range','apply','update','destroy','sendStatus','error','stack','name'];(function(_0x293444,_0x3c3bc6){var _0x11fefc=function(_0x13d349){while(--_0x13d349){_0x293444['push'](_0x293444['shift']());}};_0x11fefc(++_0x3c3bc6);}(_0xa6e8,0xb8));var _0x8a6e=function(_0x2fbb29,_0x5d6230){_0x2fbb29=_0x2fbb29-0x0;var _0x54c683=_0xa6e8[_0x2fbb29];return _0x54c683;};'use strict';var emlformat=require(_0x8a6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a6e('0x1'));var jsonpatch=require(_0x8a6e('0x2'));var rp=require(_0x8a6e('0x3'));var moment=require(_0x8a6e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a6e('0x5'));var util=require(_0x8a6e('0x6'));var path=require('path');var sox=require(_0x8a6e('0x7'));var csv=require(_0x8a6e('0x8'));var ejs=require(_0x8a6e('0x9'));var fs=require('fs');var fs_extra=require(_0x8a6e('0xa'));var _=require('lodash');var squel=require(_0x8a6e('0xb'));var crypto=require('crypto');var jsforce=require(_0x8a6e('0xc'));var deskjs=require(_0x8a6e('0xd'));var toCsv=require(_0x8a6e('0x8'));var querystring=require('querystring');var Papa=require(_0x8a6e('0xe'));var Redis=require(_0x8a6e('0xf'));var authService=require(_0x8a6e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8a6e('0x11'));var hardwareService=require(_0x8a6e('0x12'));var logger=require(_0x8a6e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8a6e('0x14'));var licenseUtil=require(_0x8a6e('0x15'));var db=require(_0x8a6e('0x16'))['db'];function respondWithStatusCode(_0x1435e0,_0x20cce5){_0x20cce5=_0x20cce5||0xcc;return function(_0xa53a31){if(_0xa53a31){return _0x1435e0['sendStatus'](_0x20cce5);}return _0x1435e0['status'](_0x20cce5)[_0x8a6e('0x17')]();};}function respondWithResult(_0x532a62,_0x1a067d){_0x1a067d=_0x1a067d||0xc8;return function(_0x661467){if(_0x661467){return _0x532a62['status'](_0x1a067d)['json'](_0x661467);}};}function respondWithFilteredResult(_0x22617b,_0x2a211e){return function(_0x2d54a0){if(_0x2d54a0){var _0xc6802b=typeof _0x2a211e['offset']===_0x8a6e('0x18')&&typeof _0x2a211e[_0x8a6e('0x19')]==='undefined';var _0x3e4d64=_0x2d54a0['count'];var _0xc66f40=_0xc6802b?0x0:_0x2a211e[_0x8a6e('0x1a')];var _0x660dd0=_0xc6802b?_0x2d54a0[_0x8a6e('0x1b')]:_0x2a211e[_0x8a6e('0x1a')]+_0x2a211e[_0x8a6e('0x19')];var _0xac1f94;if(_0x660dd0>=_0x3e4d64){_0x660dd0=_0x3e4d64;_0xac1f94=0xc8;}else{_0xac1f94=0xce;}_0x22617b[_0x8a6e('0x1c')](_0xac1f94);return _0x22617b[_0x8a6e('0x1d')](_0x8a6e('0x1e'),_0xc66f40+'-'+_0x660dd0+'/'+_0x3e4d64)['json'](_0x2d54a0);}return null;};}function patchUpdates(_0x18d190){return function(_0x1fa5c5){try{jsonpatch[_0x8a6e('0x1f')](_0x1fa5c5,_0x18d190,!![]);}catch(_0x6a79b3){return BPromise['reject'](_0x6a79b3);}return _0x1fa5c5['save']();};}function saveUpdates(_0xaf5678,_0x1047bb){return function(_0x345f4e){if(_0x345f4e){return _0x345f4e[_0x8a6e('0x20')](_0xaf5678)['then'](function(_0x510702){return _0x510702;});}return null;};}function removeEntity(_0x1d3d8c,_0x12eedf){return function(_0x23ed53){if(_0x23ed53){return _0x23ed53[_0x8a6e('0x21')]()['then'](function(){_0x1d3d8c[_0x8a6e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eeabe,_0x1e84e9){return function(_0x370605){if(!_0x370605){_0x1eeabe[_0x8a6e('0x22')](0x194);}return _0x370605;};}function handleError(_0x5070ad,_0x4bb68b){_0x4bb68b=_0x4bb68b||0x1f4;return function(_0x239150){logger[_0x8a6e('0x23')](_0x239150[_0x8a6e('0x24')]);if(_0x239150[_0x8a6e('0x25')]){delete _0x239150['name'];}_0x5070ad[_0x8a6e('0x1c')](_0x4bb68b)[_0x8a6e('0x26')](_0x239150);};}exports[_0x8a6e('0x27')]=function(_0x212c0b,_0x136fdd){var _0x1e20e2={},_0xb3897a={},_0x2137af={'count':0x0,'rows':[]};var _0x4d6171=_['map'](db[_0x8a6e('0x28')][_0x8a6e('0x29')],function(_0x47c8d6){return{'name':_0x47c8d6[_0x8a6e('0x2a')],'type':_0x47c8d6[_0x8a6e('0x2b')][_0x8a6e('0x2c')]};});_0xb3897a[_0x8a6e('0x2d')]=_['map'](_0x4d6171,_0x8a6e('0x25'));_0xb3897a[_0x8a6e('0x2e')]=_[_0x8a6e('0x2f')](_0x212c0b[_0x8a6e('0x2e')]);_0xb3897a[_0x8a6e('0x30')]=_[_0x8a6e('0x31')](_0xb3897a['model'],_0xb3897a[_0x8a6e('0x2e')]);_0x1e20e2[_0x8a6e('0x32')]=_[_0x8a6e('0x31')](_0xb3897a['model'],qs[_0x8a6e('0x33')](_0x212c0b[_0x8a6e('0x2e')][_0x8a6e('0x33')]));_0x1e20e2['attributes']=_0x1e20e2['attributes'][_0x8a6e('0x34')]?_0x1e20e2[_0x8a6e('0x32')]:_0xb3897a['model'];if(!_0x212c0b['query'][_0x8a6e('0x35')](_0x8a6e('0x36'))){_0x1e20e2['limit']=qs['limit'](_0x212c0b['query'][_0x8a6e('0x19')]);_0x1e20e2[_0x8a6e('0x1a')]=qs['offset'](_0x212c0b['query'][_0x8a6e('0x1a')]);}_0x1e20e2[_0x8a6e('0x37')]=qs[_0x8a6e('0x38')](_0x212c0b[_0x8a6e('0x2e')][_0x8a6e('0x38')]);_0x1e20e2[_0x8a6e('0x39')]=qs['filters'](_['pick'](_0x212c0b[_0x8a6e('0x2e')],_0xb3897a[_0x8a6e('0x30')]),_0x4d6171);if(_0x212c0b[_0x8a6e('0x2e')][_0x8a6e('0x3a')]){_0x1e20e2[_0x8a6e('0x39')]=_['merge'](_0x1e20e2[_0x8a6e('0x39')],{'$or':_[_0x8a6e('0x3b')](_0x4d6171,function(_0x520867){if(_0x520867[_0x8a6e('0x2b')]!==_0x8a6e('0x3c')){var _0x54217a={};_0x54217a[_0x520867['name']]={'$like':'%'+_0x212c0b[_0x8a6e('0x2e')]['filter']+'%'};return _0x54217a;}})});}_0x1e20e2=_['merge']({},_0x1e20e2,_0x212c0b[_0x8a6e('0x3d')]);var _0x1ef11e={'where':_0x1e20e2[_0x8a6e('0x39')]};return db[_0x8a6e('0x28')][_0x8a6e('0x1b')](_0x1ef11e)[_0x8a6e('0x3e')](function(_0x35e605){_0x2137af[_0x8a6e('0x1b')]=_0x35e605;if(_0x212c0b['query'][_0x8a6e('0x3f')]){_0x1e20e2[_0x8a6e('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x8a6e('0x41')](_0x1e20e2);})[_0x8a6e('0x3e')](function(_0x42f750){_0x2137af[_0x8a6e('0x42')]=_0x42f750;return _0x2137af;})['then'](respondWithFilteredResult(_0x136fdd,_0x1e20e2))[_0x8a6e('0x43')](handleError(_0x136fdd,null));};exports[_0x8a6e('0x44')]=function(_0x3c0cb3,_0x3a463d){var _0x17fd82={'raw':!![],'where':{'id':_0x3c0cb3[_0x8a6e('0x45')]['id']}},_0x4cd327={};_0x4cd327[_0x8a6e('0x2d')]=_[_0x8a6e('0x2f')](db['VoiceQueuesLog'][_0x8a6e('0x29')]);_0x4cd327[_0x8a6e('0x2e')]=_['keys'](_0x3c0cb3[_0x8a6e('0x2e')]);_0x4cd327['filters']=_[_0x8a6e('0x31')](_0x4cd327[_0x8a6e('0x2d')],_0x4cd327[_0x8a6e('0x2e')]);_0x17fd82['attributes']=_['intersection'](_0x4cd327[_0x8a6e('0x2d')],qs[_0x8a6e('0x33')](_0x3c0cb3['query'][_0x8a6e('0x33')]));_0x17fd82[_0x8a6e('0x32')]=_0x17fd82[_0x8a6e('0x32')][_0x8a6e('0x34')]?_0x17fd82[_0x8a6e('0x32')]:_0x4cd327[_0x8a6e('0x2d')];if(_0x3c0cb3[_0x8a6e('0x2e')][_0x8a6e('0x3f')]){_0x17fd82[_0x8a6e('0x40')]=[{'all':!![]}];}_0x17fd82=_[_0x8a6e('0x46')]({},_0x17fd82,_0x3c0cb3[_0x8a6e('0x3d')]);return db[_0x8a6e('0x28')][_0x8a6e('0x47')](_0x17fd82)[_0x8a6e('0x3e')](handleEntityNotFound(_0x3a463d,null))[_0x8a6e('0x3e')](respondWithResult(_0x3a463d,null))[_0x8a6e('0x43')](handleError(_0x3a463d,null));};exports[_0x8a6e('0x48')]=function(_0x5ee0c5,_0x2cc0b9){return db[_0x8a6e('0x28')][_0x8a6e('0x48')](_0x5ee0c5[_0x8a6e('0x49')],{})[_0x8a6e('0x3e')](respondWithResult(_0x2cc0b9,0xc9))[_0x8a6e('0x43')](handleError(_0x2cc0b9,null));};exports[_0x8a6e('0x20')]=function(_0x58c2ae,_0x210fb9){if(_0x58c2ae[_0x8a6e('0x49')]['id']){delete _0x58c2ae[_0x8a6e('0x49')]['id'];}return db['VoiceQueuesLog'][_0x8a6e('0x47')]({'where':{'id':_0x58c2ae['params']['id']}})[_0x8a6e('0x3e')](handleEntityNotFound(_0x210fb9,null))['then'](saveUpdates(_0x58c2ae[_0x8a6e('0x49')],null))[_0x8a6e('0x3e')](respondWithResult(_0x210fb9,null))[_0x8a6e('0x43')](handleError(_0x210fb9,null));};exports[_0x8a6e('0x21')]=function(_0x4dae20,_0x265c62){return db['VoiceQueuesLog'][_0x8a6e('0x47')]({'where':{'id':_0x4dae20[_0x8a6e('0x45')]['id']}})[_0x8a6e('0x3e')](handleEntityNotFound(_0x265c62,null))[_0x8a6e('0x3e')](removeEntity(_0x265c62,null))['catch'](handleError(_0x265c62,null));}; \ No newline at end of file +var _0x5e72=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','merge','catch','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','then','destroy','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','model','query'];(function(_0x32a9da,_0xd7a4bc){var _0x3b3998=function(_0x3a8d48){while(--_0x3a8d48){_0x32a9da['push'](_0x32a9da['shift']());}};_0x3b3998(++_0xd7a4bc);}(_0x5e72,0x136));var _0x25e7=function(_0x36e1a8,_0x3cfec8){_0x36e1a8=_0x36e1a8-0x0;var _0x9585d2=_0x5e72[_0x36e1a8];return _0x9585d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x25e7('0x0'));var zipdir=require(_0x25e7('0x1'));var jsonpatch=require(_0x25e7('0x2'));var rp=require(_0x25e7('0x3'));var moment=require(_0x25e7('0x4'));var BPromise=require(_0x25e7('0x5'));var Mustache=require(_0x25e7('0x6'));var util=require('util');var path=require(_0x25e7('0x7'));var sox=require('sox');var csv=require(_0x25e7('0x8'));var ejs=require(_0x25e7('0x9'));var fs=require('fs');var fs_extra=require(_0x25e7('0xa'));var _=require(_0x25e7('0xb'));var squel=require('squel');var crypto=require(_0x25e7('0xc'));var jsforce=require(_0x25e7('0xd'));var deskjs=require(_0x25e7('0xe'));var toCsv=require(_0x25e7('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x25e7('0xf'));var authService=require(_0x25e7('0x10'));var qs=require(_0x25e7('0x11'));var as=require(_0x25e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x25e7('0x13'))(_0x25e7('0x14'));var utils=require('../../config/utils');var config=require(_0x25e7('0x15'));var licenseUtil=require(_0x25e7('0x16'));var db=require(_0x25e7('0x17'))['db'];function respondWithStatusCode(_0x4a39b0,_0x559bbc){_0x559bbc=_0x559bbc||0xcc;return function(_0x56e0b5){if(_0x56e0b5){return _0x4a39b0[_0x25e7('0x18')](_0x559bbc);}return _0x4a39b0[_0x25e7('0x19')](_0x559bbc)[_0x25e7('0x1a')]();};}function respondWithResult(_0x4db28c,_0x1a84de){_0x1a84de=_0x1a84de||0xc8;return function(_0x294a6d){if(_0x294a6d){return _0x4db28c[_0x25e7('0x19')](_0x1a84de)[_0x25e7('0x1b')](_0x294a6d);}};}function respondWithFilteredResult(_0x5ab6ce,_0x268f05){return function(_0x5b1582){if(_0x5b1582){var _0x4acf05=typeof _0x268f05['offset']===_0x25e7('0x1c')&&typeof _0x268f05['limit']==='undefined';var _0x190195=_0x5b1582[_0x25e7('0x1d')];var _0x591e6a=_0x4acf05?0x0:_0x268f05[_0x25e7('0x1e')];var _0x339309=_0x4acf05?_0x5b1582[_0x25e7('0x1d')]:_0x268f05[_0x25e7('0x1e')]+_0x268f05['limit'];var _0x1fe152;if(_0x339309>=_0x190195){_0x339309=_0x190195;_0x1fe152=0xc8;}else{_0x1fe152=0xce;}_0x5ab6ce['status'](_0x1fe152);return _0x5ab6ce[_0x25e7('0x1f')]('Content-Range',_0x591e6a+'-'+_0x339309+'/'+_0x190195)[_0x25e7('0x1b')](_0x5b1582);}return null;};}function patchUpdates(_0x350d67){return function(_0x3c14d2){try{jsonpatch[_0x25e7('0x20')](_0x3c14d2,_0x350d67,!![]);}catch(_0x2344e1){return BPromise['reject'](_0x2344e1);}return _0x3c14d2['save']();};}function saveUpdates(_0x4a1789,_0x63d75e){return function(_0x46827d){if(_0x46827d){return _0x46827d['update'](_0x4a1789)[_0x25e7('0x21')](function(_0x488f34){return _0x488f34;});}return null;};}function removeEntity(_0x2eff18,_0x409097){return function(_0x579f2e){if(_0x579f2e){return _0x579f2e[_0x25e7('0x22')]()['then'](function(){_0x2eff18[_0x25e7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53323f,_0x303bdf){return function(_0x158217){if(!_0x158217){_0x53323f[_0x25e7('0x18')](0x194);}return _0x158217;};}function handleError(_0x5dc51c,_0x50d1c0){_0x50d1c0=_0x50d1c0||0x1f4;return function(_0x2d32ab){logger[_0x25e7('0x23')](_0x2d32ab[_0x25e7('0x24')]);if(_0x2d32ab[_0x25e7('0x25')]){delete _0x2d32ab[_0x25e7('0x25')];}_0x5dc51c[_0x25e7('0x19')](_0x50d1c0)[_0x25e7('0x26')](_0x2d32ab);};}exports['index']=function(_0x73a2fa,_0xcf7462){var _0x524afd={},_0x5565bd={},_0x3a915d={'count':0x0,'rows':[]};var _0x94f040=_[_0x25e7('0x27')](db[_0x25e7('0x28')]['rawAttributes'],function(_0x390e2e){return{'name':_0x390e2e[_0x25e7('0x29')],'type':_0x390e2e[_0x25e7('0x2a')]['key']};});_0x5565bd[_0x25e7('0x2b')]=_[_0x25e7('0x27')](_0x94f040,_0x25e7('0x25'));_0x5565bd[_0x25e7('0x2c')]=_['keys'](_0x73a2fa['query']);_0x5565bd[_0x25e7('0x2d')]=_['intersection'](_0x5565bd[_0x25e7('0x2b')],_0x5565bd[_0x25e7('0x2c')]);_0x524afd[_0x25e7('0x2e')]=_[_0x25e7('0x2f')](_0x5565bd[_0x25e7('0x2b')],qs[_0x25e7('0x30')](_0x73a2fa[_0x25e7('0x2c')][_0x25e7('0x30')]));_0x524afd[_0x25e7('0x2e')]=_0x524afd[_0x25e7('0x2e')][_0x25e7('0x31')]?_0x524afd[_0x25e7('0x2e')]:_0x5565bd['model'];if(!_0x73a2fa['query'][_0x25e7('0x32')]('nolimit')){_0x524afd[_0x25e7('0x33')]=qs[_0x25e7('0x33')](_0x73a2fa[_0x25e7('0x2c')][_0x25e7('0x33')]);_0x524afd[_0x25e7('0x1e')]=qs[_0x25e7('0x1e')](_0x73a2fa[_0x25e7('0x2c')][_0x25e7('0x1e')]);}_0x524afd[_0x25e7('0x34')]=qs[_0x25e7('0x35')](_0x73a2fa[_0x25e7('0x2c')][_0x25e7('0x35')]);_0x524afd[_0x25e7('0x36')]=qs[_0x25e7('0x2d')](_[_0x25e7('0x37')](_0x73a2fa[_0x25e7('0x2c')],_0x5565bd[_0x25e7('0x2d')]),_0x94f040);if(_0x73a2fa[_0x25e7('0x2c')]['filter']){_0x524afd['where']=_['merge'](_0x524afd['where'],{'$or':_[_0x25e7('0x27')](_0x94f040,function(_0x58b22b){if(_0x58b22b[_0x25e7('0x2a')]!==_0x25e7('0x38')){var _0x385639={};_0x385639[_0x58b22b['name']]={'$like':'%'+_0x73a2fa[_0x25e7('0x2c')][_0x25e7('0x39')]+'%'};return _0x385639;}})});}_0x524afd=_['merge']({},_0x524afd,_0x73a2fa[_0x25e7('0x3a')]);var _0x126e00={'where':_0x524afd['where']};return db[_0x25e7('0x28')]['count'](_0x126e00)[_0x25e7('0x21')](function(_0x7c8634){_0x3a915d['count']=_0x7c8634;if(_0x73a2fa['query'][_0x25e7('0x3b')]){_0x524afd[_0x25e7('0x3c')]=[{'all':!![]}];}return db[_0x25e7('0x28')][_0x25e7('0x3d')](_0x524afd);})['then'](function(_0x1bf5ad){_0x3a915d[_0x25e7('0x3e')]=_0x1bf5ad;return _0x3a915d;})[_0x25e7('0x21')](respondWithFilteredResult(_0xcf7462,_0x524afd))['catch'](handleError(_0xcf7462,null));};exports[_0x25e7('0x3f')]=function(_0x46d4c5,_0x55aaa8){var _0x2b7d95={'raw':!![],'where':{'id':_0x46d4c5[_0x25e7('0x40')]['id']}},_0x4dc71d={};_0x4dc71d[_0x25e7('0x2b')]=_[_0x25e7('0x41')](db[_0x25e7('0x28')]['rawAttributes']);_0x4dc71d[_0x25e7('0x2c')]=_[_0x25e7('0x41')](_0x46d4c5['query']);_0x4dc71d[_0x25e7('0x2d')]=_[_0x25e7('0x2f')](_0x4dc71d[_0x25e7('0x2b')],_0x4dc71d['query']);_0x2b7d95[_0x25e7('0x2e')]=_[_0x25e7('0x2f')](_0x4dc71d[_0x25e7('0x2b')],qs[_0x25e7('0x30')](_0x46d4c5['query'][_0x25e7('0x30')]));_0x2b7d95[_0x25e7('0x2e')]=_0x2b7d95[_0x25e7('0x2e')][_0x25e7('0x31')]?_0x2b7d95[_0x25e7('0x2e')]:_0x4dc71d[_0x25e7('0x2b')];if(_0x46d4c5[_0x25e7('0x2c')][_0x25e7('0x3b')]){_0x2b7d95[_0x25e7('0x3c')]=[{'all':!![]}];}_0x2b7d95=_[_0x25e7('0x42')]({},_0x2b7d95,_0x46d4c5[_0x25e7('0x3a')]);return db[_0x25e7('0x28')]['find'](_0x2b7d95)['then'](handleEntityNotFound(_0x55aaa8,null))['then'](respondWithResult(_0x55aaa8,null))[_0x25e7('0x43')](handleError(_0x55aaa8,null));};exports[_0x25e7('0x44')]=function(_0x1ea944,_0x36f7d9){return db[_0x25e7('0x28')][_0x25e7('0x44')](_0x1ea944[_0x25e7('0x45')],{})[_0x25e7('0x21')](respondWithResult(_0x36f7d9,0xc9))[_0x25e7('0x43')](handleError(_0x36f7d9,null));};exports['update']=function(_0x3a098a,_0x5c2d15){if(_0x3a098a[_0x25e7('0x45')]['id']){delete _0x3a098a['body']['id'];}return db[_0x25e7('0x28')][_0x25e7('0x46')]({'where':{'id':_0x3a098a[_0x25e7('0x40')]['id']}})[_0x25e7('0x21')](handleEntityNotFound(_0x5c2d15,null))[_0x25e7('0x21')](saveUpdates(_0x3a098a[_0x25e7('0x45')],null))['then'](respondWithResult(_0x5c2d15,null))['catch'](handleError(_0x5c2d15,null));};exports['destroy']=function(_0x197765,_0x17fdb4){return db['VoiceQueuesLog'][_0x25e7('0x46')]({'where':{'id':_0x197765['params']['id']}})['then'](handleEntityNotFound(_0x17fdb4,null))[_0x25e7('0x21')](removeEntity(_0x17fdb4,null))[_0x25e7('0x43')](handleError(_0x17fdb4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index be28b15..3a4e6a8 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x1bbb90,_0x2a1948){var _0x430b23=function(_0x13ffd8){while(--_0x13ffd8){_0x1bbb90['push'](_0x1bbb90['shift']());}};_0x430b23(++_0x2a1948);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x4ade37,_0x2270a2){_0x4ade37=_0x4ade37-0x0;var _0x397049=_0x4fdb[_0x4ade37];return _0x397049;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[{'name':_0xb4fd('0xc'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x0a73=['lodash','util','api','moment','bluebird','path','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event'];(function(_0x279645,_0x2ed6c5){var _0x1b6272=function(_0x5ec356){while(--_0x5ec356){_0x279645['push'](_0x279645['shift']());}};_0x1b6272(++_0x2ed6c5);}(_0x0a73,0x1e0));var _0x30a7=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0x0a73[_0x54ccd7];return _0x4e667b;};'use strict';var _=require(_0x30a7('0x0'));var util=require(_0x30a7('0x1'));var logger=require('../../config/logger')(_0x30a7('0x2'));var moment=require(_0x30a7('0x3'));var BPromise=require(_0x30a7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x30a7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x30a7('0x6'));module['exports']=function(_0xd84788,_0xe4e5ca){return _0xd84788[_0x30a7('0x7')](_0x30a7('0x8'),attributes,{'tableName':_0x30a7('0x9'),'paranoid':![],'indexes':[{'name':_0x30a7('0xa'),'fields':[_0x30a7('0xb'),'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 fe8df2e..89bd38b 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 _0x5145=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5e66b7,_0x13f93b){var _0x16a8f8=function(_0x528107){while(--_0x528107){_0x5e66b7['push'](_0x5e66b7['shift']());}};_0x16a8f8(++_0x13f93b);}(_0x5145,0x1bf));var _0x5514=function(_0x90612a,_0x2b6c25){_0x90612a=_0x90612a-0x0;var _0x1d411a=_0x5145[_0x90612a];return _0x1d411a;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var moment=require(_0x5514('0x2'));var BPromise=require(_0x5514('0x3'));var rs=require(_0x5514('0x4'));var fs=require('fs');var Redis=require(_0x5514('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5514('0x6'));var logger=require(_0x5514('0x7'))(_0x5514('0x8'));var config=require(_0x5514('0x9'));var jayson=require(_0x5514('0xa'));var client=jayson[_0x5514('0xb')][_0x5514('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a9b51,_0x4a57a0,_0x1177cf){return new BPromise(function(_0x357f2b,_0x3dc3d7){return client[_0x5514('0xd')](_0x5a9b51,_0x1177cf)[_0x5514('0xe')](function(_0x2448ca){logger[_0x5514('0xf')](_0x5514('0x10'),_0x4a57a0,'request\x20sent');logger[_0x5514('0x11')](_0x5514('0x12'),_0x4a57a0,'request\x20sent',JSON['stringify'](_0x2448ca));if(_0x2448ca['error']){if(_0x2448ca[_0x5514('0x13')]['code']===0x1f4){logger[_0x5514('0x13')](_0x5514('0x10'),_0x4a57a0,_0x2448ca['error'][_0x5514('0x14')]);return _0x3dc3d7(_0x2448ca[_0x5514('0x13')]['message']);}logger[_0x5514('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x4a57a0,_0x2448ca[_0x5514('0x13')]['message']);return _0x357f2b(_0x2448ca['error'][_0x5514('0x14')]);}else{logger['info'](_0x5514('0x10'),_0x4a57a0,_0x5514('0x15'));_0x357f2b(_0x2448ca[_0x5514('0x16')][_0x5514('0x14')]);}})['catch'](function(_0x21f7ab){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4a57a0,_0x21f7ab);_0x3dc3d7(_0x21f7ab);});});} \ No newline at end of file +var _0xb887=['../../config/environment','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../config/logger','rpc'];(function(_0x4dab93,_0x5b8463){var _0xad632b=function(_0x23150b){while(--_0x23150b){_0x4dab93['push'](_0x4dab93['shift']());}};_0xad632b(++_0x5b8463);}(_0xb887,0xaf));var _0x7b88=function(_0x2be367,_0x4504d2){_0x2be367=_0x2be367-0x0;var _0x3589fd=_0xb887[_0x2be367];return _0x3589fd;};'use strict';var _=require(_0x7b88('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7b88('0x1'));var rs=require(_0x7b88('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7b88('0x3'))(_0x7b88('0x4'));var config=require(_0x7b88('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7b88('0x6')][_0x7b88('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x57f8a6,_0x35e94f,_0x4b356f){return new BPromise(function(_0x2f4ca0,_0x1add10){return client[_0x7b88('0x8')](_0x57f8a6,_0x4b356f)[_0x7b88('0x9')](function(_0x3d0452){logger[_0x7b88('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x35e94f,'request\x20sent');logger['debug'](_0x7b88('0xb'),_0x35e94f,_0x7b88('0xc'),JSON[_0x7b88('0xd')](_0x3d0452));if(_0x3d0452['error']){if(_0x3d0452['error'][_0x7b88('0xe')]===0x1f4){logger[_0x7b88('0xf')](_0x7b88('0x10'),_0x35e94f,_0x3d0452['error'][_0x7b88('0x11')]);return _0x1add10(_0x3d0452[_0x7b88('0xf')][_0x7b88('0x11')]);}logger[_0x7b88('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x35e94f,_0x3d0452[_0x7b88('0xf')][_0x7b88('0x11')]);return _0x2f4ca0(_0x3d0452[_0x7b88('0xf')][_0x7b88('0x11')]);}else{logger[_0x7b88('0xa')](_0x7b88('0x10'),_0x35e94f,'request\x20sent');_0x2f4ca0(_0x3d0452[_0x7b88('0x12')][_0x7b88('0x11')]);}})[_0x7b88('0x13')](function(_0x4c3e58){logger['error'](_0x7b88('0x10'),_0x35e94f,_0x4c3e58);_0x1add10(_0x4c3e58);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 712e0c4..066c963 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 _0x4bcf=['post','/:id/transcribe','runTranscribe','put','update','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','show','/:id/download','/:id/downloads','downloads','downloadTranscribe'];(function(_0x539fb9,_0x2bf5e3){var _0x18659b=function(_0x21f17a){while(--_0x21f17a){_0x539fb9['push'](_0x539fb9['shift']());}};_0x18659b(++_0x2bf5e3);}(_0x4bcf,0x126));var _0xf4bc=function(_0x2f48e9,_0x1bd1b4){_0x2f48e9=_0x2f48e9-0x0;var _0x34d5bb=_0x4bcf[_0x2f48e9];return _0x34d5bb;};'use strict';var multer=require('multer');var util=require(_0xf4bc('0x0'));var path=require(_0xf4bc('0x1'));var timeout=require(_0xf4bc('0x2'));var express=require('express');var router=express[_0xf4bc('0x3')]();var fs_extra=require(_0xf4bc('0x4'));var auth=require(_0xf4bc('0x5'));var interaction=require(_0xf4bc('0x6'));var config=require(_0xf4bc('0x7'));var controller=require(_0xf4bc('0x8'));router[_0xf4bc('0x9')]('/',auth[_0xf4bc('0xa')](),controller[_0xf4bc('0xb')]);router[_0xf4bc('0x9')](_0xf4bc('0xc'),auth[_0xf4bc('0xa')](),controller['describe']);router[_0xf4bc('0x9')]('/:id',auth[_0xf4bc('0xa')](),controller[_0xf4bc('0xd')]);router[_0xf4bc('0x9')](_0xf4bc('0xe'),auth['isAuthenticated'](),controller['download']);router['get'](_0xf4bc('0xf'),controller[_0xf4bc('0x10')]);router['get']('/:id/transcribe',auth[_0xf4bc('0xa')](),controller[_0xf4bc('0x11')]);router[_0xf4bc('0x12')]('/',auth[_0xf4bc('0xa')](),controller['create']);router[_0xf4bc('0x12')](_0xf4bc('0x13'),auth[_0xf4bc('0xa')](),controller[_0xf4bc('0x14')]);router[_0xf4bc('0x15')]('/:id',auth[_0xf4bc('0xa')](),controller[_0xf4bc('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf4bc('0x17')]=router; \ No newline at end of file +var _0x7057=['runTranscribe','put','/:id','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x49a0bf,_0x3a2db9){var _0x47d5ed=function(_0xcb6025){while(--_0xcb6025){_0x49a0bf['push'](_0x49a0bf['shift']());}};_0x47d5ed(++_0x3a2db9);}(_0x7057,0xc3));var _0x7705=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x7057[_0x1e4360];return _0x31e6b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7705('0x0'));var timeout=require(_0x7705('0x1'));var express=require(_0x7705('0x2'));var router=express[_0x7705('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7705('0x4'));var interaction=require(_0x7705('0x5'));var config=require(_0x7705('0x6'));var controller=require(_0x7705('0x7'));router[_0x7705('0x8')]('/',auth['isAuthenticated'](),controller[_0x7705('0x9')]);router[_0x7705('0x8')](_0x7705('0xa'),auth[_0x7705('0xb')](),controller[_0x7705('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7705('0xd')]);router[_0x7705('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x7705('0xe')]);router[_0x7705('0x8')](_0x7705('0xf'),controller[_0x7705('0x10')]);router[_0x7705('0x8')](_0x7705('0x11'),auth['isAuthenticated'](),controller[_0x7705('0x12')]);router[_0x7705('0x13')]('/',auth[_0x7705('0xb')](),controller[_0x7705('0x14')]);router[_0x7705('0x13')](_0x7705('0x11'),auth[_0x7705('0xb')](),controller[_0x7705('0x15')]);router[_0x7705('0x16')](_0x7705('0x17'),auth[_0x7705('0xb')](),controller['update']);router[_0x7705('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x7705('0x19')]);module[_0x7705('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 94eab31..a0de9fa 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(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 ad915cc..c76e3fc 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 _0x7aeb=['language','runSentiment','sentiment','bucket','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','name','includeAll','rows','catch','show','include','options','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','push','$and','%s.cypher','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion'];(function(_0x2d31c9,_0x12d506){var _0x583ba4=function(_0x2bab3b){while(--_0x2bab3b){_0x2d31c9['push'](_0x2d31c9['shift']());}};_0x583ba4(++_0x12d506);}(_0x7aeb,0x142));var _0xb7ae=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7aeb[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb7ae('0x0'));var zipdir=require(_0xb7ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb7ae('0x2'));var moment=require(_0xb7ae('0x3'));var BPromise=require(_0xb7ae('0x4'));var Mustache=require('mustache');var util=require(_0xb7ae('0x5'));var path=require(_0xb7ae('0x6'));var sox=require(_0xb7ae('0x7'));var csv=require(_0xb7ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb7ae('0x9'));var _=require(_0xb7ae('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb7ae('0xb'));var deskjs=require(_0xb7ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb7ae('0xd'));var Papa=require(_0xb7ae('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0xb7ae('0xf'));var Redis=require(_0xb7ae('0x10'));var authService=require(_0xb7ae('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7ae('0x12'))(_0xb7ae('0x13'));var utils=require(_0xb7ae('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb7ae('0x15'))['db'];function respondWithStatusCode(_0xa220be,_0x33b95){_0x33b95=_0x33b95||0xcc;return function(_0x574584){if(_0x574584){return _0xa220be['sendStatus'](_0x33b95);}return _0xa220be[_0xb7ae('0x16')](_0x33b95)['end']();};}function respondWithResult(_0x546d7d,_0x4e95de){_0x4e95de=_0x4e95de||0xc8;return function(_0x231254){if(_0x231254){return _0x546d7d['status'](_0x4e95de)[_0xb7ae('0x17')](_0x231254);}};}function respondWithFilteredResult(_0x412af3,_0x3bff83){return function(_0x2b864f){if(_0x2b864f){var _0x43f747=typeof _0x3bff83[_0xb7ae('0x18')]===_0xb7ae('0x19')&&typeof _0x3bff83[_0xb7ae('0x1a')]===_0xb7ae('0x19');var _0x1f69af=_0x2b864f['count'];var _0x25e03e=_0x43f747?0x0:_0x3bff83[_0xb7ae('0x18')];var _0x3ea5ff=_0x43f747?_0x2b864f[_0xb7ae('0x1b')]:_0x3bff83[_0xb7ae('0x18')]+_0x3bff83[_0xb7ae('0x1a')];var _0x51430d;if(_0x3ea5ff>=_0x1f69af){_0x3ea5ff=_0x1f69af;_0x51430d=0xc8;}else{_0x51430d=0xce;}_0x412af3[_0xb7ae('0x16')](_0x51430d);return _0x412af3[_0xb7ae('0x1c')]('Content-Range',_0x25e03e+'-'+_0x3ea5ff+'/'+_0x1f69af)[_0xb7ae('0x17')](_0x2b864f);}return null;};}function patchUpdates(_0x55598c){return function(_0x588519){try{jsonpatch[_0xb7ae('0x1d')](_0x588519,_0x55598c,!![]);}catch(_0x35c9ef){return BPromise[_0xb7ae('0x1e')](_0x35c9ef);}return _0x588519[_0xb7ae('0x1f')]();};}function saveUpdates(_0x39524d,_0x442ed1){return function(_0x533379){if(_0x533379){return _0x533379[_0xb7ae('0x20')](_0x39524d)[_0xb7ae('0x21')](function(_0x5a0a90){return _0x5a0a90;});}return null;};}function removeEntity(_0x3fd8f9,_0x436107){return function(_0x1f624f){if(_0x1f624f){return _0x1f624f[_0xb7ae('0x22')]()[_0xb7ae('0x21')](function(){_0x3fd8f9[_0xb7ae('0x16')](0xcc)[_0xb7ae('0x23')]();});}};}function handleEntityNotFound(_0x22e39f,_0x11fd1f){return function(_0x1f27a1){if(!_0x1f27a1){_0x22e39f['sendStatus'](0x194);}return _0x1f27a1;};}function handleError(_0x3ca802,_0x4d9ef1){_0x4d9ef1=_0x4d9ef1||0x1f4;return function(_0x51c5e0){logger[_0xb7ae('0x24')](_0x51c5e0[_0xb7ae('0x25')]);if(_0x51c5e0['name']){delete _0x51c5e0['name'];}_0x3ca802[_0xb7ae('0x16')](_0x4d9ef1)[_0xb7ae('0x26')](_0x51c5e0);};}exports[_0xb7ae('0x27')]=function(_0x2c1ec8,_0x4ff7f3){var _0x4115de={},_0xbede18={},_0x1b9dde={'count':0x0,'rows':[]};var _0x49b5d8=_[_0xb7ae('0x28')](db[_0xb7ae('0x29')][_0xb7ae('0x2a')],function(_0x420352){return{'name':_0x420352[_0xb7ae('0x2b')],'type':_0x420352[_0xb7ae('0x2c')][_0xb7ae('0x2d')]};});_0xbede18[_0xb7ae('0x2e')]=_[_0xb7ae('0x2f')](_['map'](_0x49b5d8,'name'),['format']);_0xbede18[_0xb7ae('0x30')]=_[_0xb7ae('0x31')](_0x2c1ec8['query']);_0xbede18[_0xb7ae('0x32')]=_[_0xb7ae('0x33')](_0xbede18[_0xb7ae('0x2e')],_0xbede18[_0xb7ae('0x30')]);_0x4115de[_0xb7ae('0x34')]=_['intersection'](_0xbede18[_0xb7ae('0x2e')],qs['fields'](_0x2c1ec8[_0xb7ae('0x30')][_0xb7ae('0x35')]));_0x4115de[_0xb7ae('0x34')]=_0x4115de['attributes'][_0xb7ae('0x36')]?_0x4115de['attributes']:_0xbede18['model'];if(!_0x2c1ec8[_0xb7ae('0x30')]['hasOwnProperty'](_0xb7ae('0x37'))){_0x4115de['limit']=qs[_0xb7ae('0x1a')](_0x2c1ec8[_0xb7ae('0x30')]['limit']);_0x4115de[_0xb7ae('0x18')]=qs[_0xb7ae('0x18')](_0x2c1ec8[_0xb7ae('0x30')][_0xb7ae('0x18')]);}_0x4115de['order']=qs[_0xb7ae('0x38')](_0x2c1ec8[_0xb7ae('0x30')][_0xb7ae('0x38')]);_0x4115de[_0xb7ae('0x39')]=qs['filters'](_['pick'](_0x2c1ec8['query'],_0xbede18[_0xb7ae('0x32')]),_0x49b5d8);if(_0x2c1ec8['query'][_0xb7ae('0x3a')]){_0x4115de['where']=_[_0xb7ae('0x3b')](_0x4115de[_0xb7ae('0x39')],{'$or':_[_0xb7ae('0x28')](_0x49b5d8,function(_0x316ddc){if(_0x316ddc['type']!==_0xb7ae('0x3c')){var _0x2d6b71={};_0x2d6b71[_0x316ddc[_0xb7ae('0x3d')]]={'$like':'%'+_0x2c1ec8[_0xb7ae('0x30')][_0xb7ae('0x3a')]+'%'};return _0x2d6b71;}})});}_0x4115de=_[_0xb7ae('0x3b')]({},_0x4115de,_0x2c1ec8['options']);var _0x49c54d={'where':_0x4115de['where']};return db['VoiceRecording'][_0xb7ae('0x1b')](_0x49c54d)[_0xb7ae('0x21')](function(_0x3b2bfc){_0x1b9dde[_0xb7ae('0x1b')]=_0x3b2bfc;if(_0x2c1ec8[_0xb7ae('0x30')][_0xb7ae('0x3e')]){_0x4115de['include']=[{'all':!![]}];}return db[_0xb7ae('0x29')]['findAll'](_0x4115de);})[_0xb7ae('0x21')](function(_0x48df00){_0x1b9dde[_0xb7ae('0x3f')]=_0x48df00;return _0x1b9dde;})[_0xb7ae('0x21')](respondWithFilteredResult(_0x4ff7f3,_0x4115de))[_0xb7ae('0x40')](handleError(_0x4ff7f3,null));};exports[_0xb7ae('0x41')]=function(_0x40af2b,_0x5c9216){var _0x5a7481={'raw':![],'where':{'id':_0x40af2b['params']['id']}},_0xf57589={};_0xf57589[_0xb7ae('0x2e')]=_[_0xb7ae('0x31')](db[_0xb7ae('0x29')][_0xb7ae('0x2a')]);_0xf57589[_0xb7ae('0x30')]=_[_0xb7ae('0x31')](_0x40af2b[_0xb7ae('0x30')]);_0xf57589['filters']=_[_0xb7ae('0x33')](_0xf57589['model'],_0xf57589[_0xb7ae('0x30')]);_0x5a7481['attributes']=_[_0xb7ae('0x33')](_0xf57589['model'],qs[_0xb7ae('0x35')](_0x40af2b['query']['fields']));_0x5a7481[_0xb7ae('0x34')]=_0x5a7481[_0xb7ae('0x34')][_0xb7ae('0x36')]?_0x5a7481[_0xb7ae('0x34')]:_0xf57589[_0xb7ae('0x2e')];if(_0x40af2b[_0xb7ae('0x30')][_0xb7ae('0x3e')]){_0x5a7481[_0xb7ae('0x42')]=[{'all':!![]}];}_0x5a7481=_['merge']({},_0x5a7481,_0x40af2b[_0xb7ae('0x43')]);return db[_0xb7ae('0x29')][_0xb7ae('0x44')](_0x5a7481)[_0xb7ae('0x21')](handleEntityNotFound(_0x5c9216,null))['then'](respondWithResult(_0x5c9216,null))[_0xb7ae('0x40')](handleError(_0x5c9216,null));};exports[_0xb7ae('0x45')]=function(_0x397972,_0xe8fddb){return db[_0xb7ae('0x29')][_0xb7ae('0x45')](_0x397972[_0xb7ae('0x46')],{})[_0xb7ae('0x21')](respondWithResult(_0xe8fddb,0xc9))[_0xb7ae('0x40')](handleError(_0xe8fddb,null));};exports['update']=function(_0xd24f,_0x20ffc1){if(_0xd24f[_0xb7ae('0x46')]['id']){delete _0xd24f[_0xb7ae('0x46')]['id'];}return db[_0xb7ae('0x29')][_0xb7ae('0x44')]({'where':{'id':_0xd24f[_0xb7ae('0x47')]['id']}})[_0xb7ae('0x21')](handleEntityNotFound(_0x20ffc1,null))[_0xb7ae('0x21')](saveUpdates(_0xd24f[_0xb7ae('0x46')],null))['then'](respondWithResult(_0x20ffc1,null))[_0xb7ae('0x40')](handleError(_0x20ffc1,null));};exports[_0xb7ae('0x48')]=function(_0x19970a,_0x13db09){return db['VoiceRecording'][_0xb7ae('0x48')]()[_0xb7ae('0x21')](respondWithResult(_0x13db09,null))[_0xb7ae('0x40')](handleError(_0x13db09,null));};exports[_0xb7ae('0x49')]=function(_0x34b13a,_0x17d2fa,_0x4a182f){var _0x5ce246=require(_0xb7ae('0x4a'));var _0x11823e=![];var _0x6bf764={};if(_0x34b13a['query'][_0xb7ae('0x2c')]&&_0x34b13a['query'][_0xb7ae('0x2c')]===_0xb7ae('0x4b')){_0x6bf764[_0xb7ae('0x4b')]=_0x34b13a[_0xb7ae('0x47')]['id'];}else{_0x6bf764['id']=_0x34b13a[_0xb7ae('0x47')]['id'];}return db[_0xb7ae('0x29')][_0xb7ae('0x44')]({'where':_0x6bf764,'attributes':['id',_0xb7ae('0x4c')],'raw':!![]})[_0xb7ae('0x21')](handleEntityNotFound(_0x17d2fa,null))[_0xb7ae('0x21')](function(_0xd79ae2){if(_0xd79ae2){var _0x3b0ff3=_0xd79ae2[_0xb7ae('0x4c')];var _0x222e94=util[_0xb7ae('0x4d')]('%s.cypher',_0x3b0ff3);if(fs['existsSync'](_0x222e94)){_0x11823e=!![];return _0x5ce246[_0xb7ae('0x4e')](_0x222e94,_0x3b0ff3,config[_0xb7ae('0x4f')][_0xb7ae('0x50')])[_0xb7ae('0x21')](function(){return _0xd79ae2;});}return _0xd79ae2;}})[_0xb7ae('0x21')](function(_0x2b0a08){if(_0x2b0a08){var _0x15ba41=_0x2b0a08[_0xb7ae('0x4c')];if(!fs[_0xb7ae('0x51')](_0x15ba41)){throw new db[(_0xb7ae('0x52'))][(_0xb7ae('0x53'))](_0xb7ae('0x54'));}if(_0x2b0a08['filename']){return _0x17d2fa[_0xb7ae('0x49')](_0x15ba41,_0x2b0a08[_0xb7ae('0x55')]+path[_0xb7ae('0x56')](_0x15ba41),function(){if(_0x11823e){fs[_0xb7ae('0x57')](_0x15ba41);}});}else{return _0x17d2fa['download'](_0x15ba41,function(_0x30c3c9){if(_0x11823e){fs[_0xb7ae('0x57')](_0x15ba41);}});}}})[_0xb7ae('0x40')](function(_0x291e95){if(_0x291e95[_0xb7ae('0x58')]===_0xb7ae('0x54')){_0x17d2fa[_0xb7ae('0x16')](0x194)['send'](_0xb7ae('0x59'));}else{return handleError(_0x17d2fa,null);}});};exports[_0xb7ae('0x5a')]=function(_0x5af183,_0x3d15c4,_0x57d1b0){var _0x24e490=require('../../components/encryptor');var _0x488deb=![];var _0x46bcd2={'$and':[db[_0xb7ae('0x5b')]['where'](db[_0xb7ae('0x5b')]['fn'](_0xb7ae('0x5c'),db[_0xb7ae('0x5b')][_0xb7ae('0x5d')](_0xb7ae('0x4b'))),_0x5af183[_0xb7ae('0x30')]['token'])]};if(_0x5af183['query']['type']&&_0x5af183[_0xb7ae('0x30')][_0xb7ae('0x2c')]===_0xb7ae('0x4b')){_0x46bcd2['$and'][_0xb7ae('0x5e')]({'uniqueid':_0x5af183['params']['id']});}else{_0x46bcd2[_0xb7ae('0x5f')][_0xb7ae('0x5e')]({'id':_0x5af183[_0xb7ae('0x47')]['id']});}return db[_0xb7ae('0x29')]['find']({'where':_0x46bcd2,'attributes':['id',_0xb7ae('0x4c')],'raw':!![]})[_0xb7ae('0x21')](handleEntityNotFound(_0x3d15c4,null))[_0xb7ae('0x21')](function(_0x2bca39){if(_0x2bca39){var _0x350783=util[_0xb7ae('0x4d')](_0xb7ae('0x60'),_0x2bca39[_0xb7ae('0x4c')]);if(fs[_0xb7ae('0x51')](_0x350783)){_0x488deb=!![];return _0x24e490['decryptFile'](_0x350783,_0x2bca39[_0xb7ae('0x4c')],config[_0xb7ae('0x4f')]['recording'])[_0xb7ae('0x21')](function(){return _0x2bca39;});}return _0x2bca39;}})[_0xb7ae('0x21')](function(_0x5e55fa){if(_0x5e55fa){if(!fs[_0xb7ae('0x51')](_0x5e55fa[_0xb7ae('0x4c')])){throw new db[(_0xb7ae('0x52'))][(_0xb7ae('0x53'))](_0xb7ae('0x54'));}if(_0x5e55fa[_0xb7ae('0x55')]){return _0x3d15c4[_0xb7ae('0x49')](_0x5e55fa[_0xb7ae('0x4c')],_0x5e55fa[_0xb7ae('0x55')]+path[_0xb7ae('0x56')](_0x5e55fa[_0xb7ae('0x4c')]),function(){if(_0x488deb){fs[_0xb7ae('0x57')](_0x5e55fa['value']);}});}else{return _0x3d15c4[_0xb7ae('0x49')](_0x5e55fa[_0xb7ae('0x4c')],function(_0x4bacf5){if(_0x488deb){fs[_0xb7ae('0x57')](_0x5e55fa[_0xb7ae('0x4c')]);}});}}})['catch'](handleError(_0x3d15c4,null));};exports[_0xb7ae('0x22')]=function(_0x1b98e4,_0x363c5e){return db[_0xb7ae('0x29')][_0xb7ae('0x44')]({'where':{'id':_0x1b98e4[_0xb7ae('0x47')]['id']}})[_0xb7ae('0x21')](function(_0x2a86c6){if(_[_0xb7ae('0x61')](_0x2a86c6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a86c6;})[_0xb7ae('0x21')](function(_0x3c93ac){var _0x15c0d9=_0x3c93ac['value'];logger[_0xb7ae('0x62')](_0xb7ae('0x63'),_0x15c0d9);if(!_[_0xb7ae('0x61')](_0x3c93ac[_0xb7ae('0x4c')])&&fs[_0xb7ae('0x51')](_0x15c0d9)){logger[_0xb7ae('0x62')](_0xb7ae('0x64')+_0x15c0d9+_0xb7ae('0x65'));fs['unlinkSync'](_0x15c0d9);}_0x15c0d9=_0x15c0d9+_0xb7ae('0x66');if(!_['isNil'](_0x3c93ac['value'])&&fs[_0xb7ae('0x51')](_0x15c0d9)){logger['info'](_0xb7ae('0x64')+_0x15c0d9+_0xb7ae('0x65'));fs['unlinkSync'](_0x15c0d9);}return _0x3c93ac;})['then'](function(_0x226e47){if(!_0x226e47)throw new InternalError();return _0x226e47[_0xb7ae('0x22')]();})[_0xb7ae('0x21')](function(){_0x363c5e[_0xb7ae('0x16')](0xcc)[_0xb7ae('0x23')]();})[_0xb7ae('0x40')](handleError(_0x363c5e,null));};function getBucketslist(_0x3e1244,_0xb5bd3b,_0xd3ee83){return new Promise(function(_0x11c09e,_0x130e09){var _0x23bff1=new AWS['S3']({'accessKeyId':_0xb5bd3b,'secretAccessKey':_0x3e1244,'region':_0xd3ee83});_0x23bff1[_0xb7ae('0x67')]({},function(_0x5ed261,_0x48c651){if(_0x5ed261){return _0x130e09(_0x5ed261);}else{return _0x11c09e(_0x48c651);}});});}function createBucket(_0x4823f9,_0x2c33b2,_0x270d25,_0x310217){return new Promise(function(_0x2a638d,_0x50cdb1){var _0x26324b=new AWS['S3']({'accessKeyId':_0x2c33b2,'secretAccessKey':_0x4823f9,'region':_0x270d25});_0x26324b[_0xb7ae('0x68')]({'Bucket':_0x310217},function(_0x3c3322,_0x54c1c3){if(_0x3c3322){return _0x50cdb1(_0x3c3322);}else{return _0x2a638d(_0x54c1c3);}});});}function uploadFile(_0x1ed1c1,_0x15fdd3,_0x2d6dc1,_0x3c1a17,_0x1328ef,_0xc1620d){return new Promise(function(_0x23309a,_0x4d7dd3){var _0x1ac21f=new AWS['S3']({'accessKeyId':_0x15fdd3,'secretAccessKey':_0x1ed1c1,'region':_0x2d6dc1});_0x1ac21f[_0xb7ae('0x69')]({'Bucket':_0x3c1a17,'Key':_0x1328ef,'Body':_0xc1620d},function(_0x3c4c23,_0x3404e1){if(_0x3c4c23){return _0x4d7dd3(_0x3c4c23);}else{return _0x23309a(_0x3404e1);}});});}function startTranscribe(_0x3437e5,_0x2c1b1a,_0x4b0d8a,_0x50519b,_0x41344e,_0x722c62){return new Promise(function(_0x21866e,_0x44a365){var _0x38b4f1=new AWS[(_0xb7ae('0x6a'))]({'accessKeyId':_0x2c1b1a,'secretAccessKey':_0x3437e5,'region':_0x4b0d8a});_0x38b4f1[_0xb7ae('0x6b')]({'TranscriptionJobName':_0x50519b,'LanguageCode':_0x41344e,'Media':{'MediaFileUri':_0x722c62}},function(_0x13a8b1,_0x45fb65){if(_0x13a8b1){return _0x44a365(_0x13a8b1);}else{return _0x21866e(_0x45fb65);}});});}function transcribe(_0x1f3bb4,_0x4fe170,_0x30a0f2,_0x1cfaf5,_0x24dfd3,_0x166278,_0x14775d){return new Promise(function(_0x57676f,_0x40668d){var _0x7b5e4f={};logger['info'](util[_0xb7ae('0x4d')](_0xb7ae('0x6c'),_0x1f3bb4,_0x24dfd3));return uploadFile(_0x4fe170,_0x30a0f2,_0x1cfaf5,_0x24dfd3,path['basename'](_0x166278),fs[_0xb7ae('0x6d')](_0x166278))[_0xb7ae('0x21')](function(_0x5a78e5){logger['info'](util['format'](_0xb7ae('0x6e'),_0x1f3bb4,_0x24dfd3,_0x5a78e5['Location']));_0x7b5e4f['bucket']=_0x5a78e5[_0xb7ae('0x6f')];_0x7b5e4f[_0xb7ae('0x70')]=_0x5a78e5[_0xb7ae('0x71')];logger[_0xb7ae('0x62')](util[_0xb7ae('0x4d')](_0xb7ae('0x72'),_0x1f3bb4));return startTranscribe(_0x4fe170,_0x30a0f2,_0x1cfaf5,uuidv4(),_0x14775d,_0x5a78e5[_0xb7ae('0x71')]);})['then'](function(_0x72700b){logger[_0xb7ae('0x62')](util[_0xb7ae('0x4d')](_0xb7ae('0x73'),_0x1f3bb4,_0x72700b[_0xb7ae('0x74')][_0xb7ae('0x75')]));_0x7b5e4f['transcribeName']=_0x72700b['TranscriptionJob'][_0xb7ae('0x75')];_0x7b5e4f['transcribeStatus']=_0x72700b['TranscriptionJob'][_0xb7ae('0x76')];return _0x57676f(_0x7b5e4f);})[_0xb7ae('0x40')](function(_0x472ad4){return _0x40668d(_0x472ad4);});});}exports[_0xb7ae('0x77')]=function(_0x5a3624,_0x112573,_0x4f11bd){var _0x317831;var _0x209848;var _0x1f2d61;var _0x2761d6=require(_0xb7ae('0x4a'));return db[_0xb7ae('0x29')][_0xb7ae('0x78')]({'where':{'id':_0x5a3624[_0xb7ae('0x47')]['id']}})[_0xb7ae('0x21')](function(_0x30f26a){if(_0x30f26a){var _0x85292=util[_0xb7ae('0x4d')](_0xb7ae('0x60'),_0x30f26a[_0xb7ae('0x4c')]);if(fs[_0xb7ae('0x51')](_0x85292)){cypher=!![];return _0x2761d6[_0xb7ae('0x4e')](_0x85292,_0x30f26a['value'],config['secrets'][_0xb7ae('0x50')])[_0xb7ae('0x21')](function(){return _0x30f26a;});}return _0x30f26a;}})[_0xb7ae('0x21')](function(_0x51eef3){if(!_0x51eef3){throw new db['Sequelize'][(_0xb7ae('0x53'))](_0xb7ae('0x79'));}_0x209848=_0x51eef3;return db[_0xb7ae('0x7a')][_0xb7ae('0x78')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x112573,null))[_0xb7ae('0x21')](function(_0x15d64b){if(_0x15d64b){_0x317831=_0x15d64b;if(!_0x317831['transcribe']||!_0x317831[_0xb7ae('0x7b')]||!_0x317831[_0xb7ae('0x7c')]||!_0x317831[_0xb7ae('0x7d')]||!_0x317831['bucket']){throw new db[(_0xb7ae('0x52'))][(_0xb7ae('0x53'))]('Transcribe\x20not\x20configured');}if(_0x5a3624[_0xb7ae('0x46')][_0xb7ae('0x7e')]&&(!_0x317831[_0xb7ae('0x7f')]||!_0x317831['sentimentAccountId']||!_0x317831['sentimentRegion']||!_0x317831['language']||!_0x317831[_0xb7ae('0x80')])){throw new db['Sequelize'][(_0xb7ae('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xb7ae('0x81')][_0xb7ae('0x78')]({'where':{'id':_0x317831[_0xb7ae('0x7b')]}});}})['then'](function(_0x3c28b5){if(!_0x3c28b5){throw new db[(_0xb7ae('0x52'))]['ValidationError'](_0xb7ae('0x82'));}if(!_0x3c28b5[_0xb7ae('0x83')]||!_0x3c28b5[_0xb7ae('0x84')]){throw new db[(_0xb7ae('0x52'))][(_0xb7ae('0x53'))](_0xb7ae('0x85'));}_0x1f2d61=_0x3c28b5;return getBucketslist(_0x1f2d61[_0xb7ae('0x83')],_0x1f2d61['data2'],_0x317831[_0xb7ae('0x7c')]);})[_0xb7ae('0x21')](function(_0xd91d89){if(_0xd91d89&&_0xd91d89[_0xb7ae('0x86')]){var _0x5cce42=_[_0xb7ae('0x44')](_0xd91d89[_0xb7ae('0x86')],function(_0xd970b8){return _0xd970b8[_0xb7ae('0x87')]===_0x317831[_0xb7ae('0x80')];});if(!_0x5cce42){logger[_0xb7ae('0x62')](util[_0xb7ae('0x4d')](_0xb7ae('0x88'),_0x5a3624[_0xb7ae('0x47')]['id'],_0x317831[_0xb7ae('0x80')]));return createBucket(_0x1f2d61[_0xb7ae('0x83')],_0x1f2d61[_0xb7ae('0x84')],_0x317831[_0xb7ae('0x7c')],_0x317831[_0xb7ae('0x80')]);}logger[_0xb7ae('0x62')](util[_0xb7ae('0x4d')](_0xb7ae('0x89'),_0x5a3624['params']['id'],_0x317831[_0xb7ae('0x80')]));return;}})['then'](function(_0xd64b16){if(_0x209848[_0xb7ae('0x8a')]==='NEW'){return transcribe(_0x5a3624[_0xb7ae('0x47')]['id'],_0x1f2d61['data1'],_0x1f2d61[_0xb7ae('0x84')],_0x317831[_0xb7ae('0x7c')],_0x317831[_0xb7ae('0x80')],_0x209848[_0xb7ae('0x4c')],_0x317831[_0xb7ae('0x7d')]);}else{logger['info'](util['format'](_0xb7ae('0x8b'),_0x5a3624['params']['id']));return{'transcribeStatus':_0xb7ae('0x8c')};}})['then'](function(_0x4c5c2a){if(_0x4c5c2a){_0x4c5c2a[_0xb7ae('0x8d')]=_0x5a3624['body'][_0xb7ae('0x7e')];return _0x209848[_0xb7ae('0x8e')](_0x4c5c2a);}})[_0xb7ae('0x21')](respondWithResult(_0x112573,null))[_0xb7ae('0x40')](handleError(_0x112573,null));};function writeFile(_0x383b66,_0x46b026){return new Promise(function(_0x5ef66e,_0x5a2dc6){fs[_0xb7ae('0x8f')](_0x46b026,_0x383b66,function(_0x59cc43,_0x36af86){if(_0x59cc43){return _0x5a2dc6(_0x59cc43);}else{return _0x5ef66e(_0x36af86);}});});}exports[_0xb7ae('0x90')]=function(_0x394242,_0x2b3520,_0x39dd34){return db[_0xb7ae('0x29')][_0xb7ae('0x78')]({'where':{'id':_0x394242[_0xb7ae('0x47')]['id']}})[_0xb7ae('0x21')](handleEntityNotFound(_0x2b3520))[_0xb7ae('0x21')](function(_0x418f1e){if(_0x418f1e&&_0x418f1e[_0xb7ae('0x91')]){var _0x480c6e=_0x418f1e[_0xb7ae('0x91')];var _0x426a21=config[_0xb7ae('0x92')]+_0xb7ae('0x93')+_0x418f1e['id']+_0xb7ae('0x94');if(fs[_0xb7ae('0x51')](_0x426a21)){return _0x426a21;}return writeFile(_0x480c6e,_0x426a21)[_0xb7ae('0x21')](function(){return _0x426a21;});}else{throw new db[(_0xb7ae('0x52'))][(_0xb7ae('0x53'))]('Transcript\x20not\x20available');}})[_0xb7ae('0x21')](function(_0x45a356){return _0x2b3520[_0xb7ae('0x49')](_0x45a356);})[_0xb7ae('0x40')](handleError(_0x2b3520));}; \ No newline at end of file +var _0xb805=['data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','format','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','MD5','sequelize','col','token','$and','push','VoiceRecording\x20not\x20found','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','end','listBuckets','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1'];(function(_0x5eb154,_0x1c851e){var _0x1ec3b6=function(_0x4069f1){while(--_0x4069f1){_0x5eb154['push'](_0x5eb154['shift']());}};_0x1ec3b6(++_0x1c851e);}(_0xb805,0xa2));var _0x5b80=function(_0x1b08c9,_0x1f0f3e){_0x1b08c9=_0x1b08c9-0x0;var _0x1b09d6=_0xb805[_0x1b08c9];return _0x1b09d6;};'use strict';var emlformat=require(_0x5b80('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b80('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b80('0x2'));var moment=require(_0x5b80('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5b80('0x4'));var util=require(_0x5b80('0x5'));var path=require(_0x5b80('0x6'));var sox=require(_0x5b80('0x7'));var csv=require(_0x5b80('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b80('0x9'));var _=require(_0x5b80('0xa'));var squel=require(_0x5b80('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5b80('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5b80('0xd'));var Papa=require(_0x5b80('0xe'));var AWS=require(_0x5b80('0xf'));var uuidv4=require(_0x5b80('0x10'));var Redis=require('ioredis');var authService=require(_0x5b80('0x11'));var qs=require(_0x5b80('0x12'));var as=require(_0x5b80('0x13'));var hardwareService=require(_0x5b80('0x14'));var logger=require(_0x5b80('0x15'))(_0x5b80('0x16'));var utils=require(_0x5b80('0x17'));var config=require(_0x5b80('0x18'));var licenseUtil=require(_0x5b80('0x19'));var db=require(_0x5b80('0x1a'))['db'];function respondWithStatusCode(_0x4b3fb9,_0x2b50d1){_0x2b50d1=_0x2b50d1||0xcc;return function(_0x17d2ee){if(_0x17d2ee){return _0x4b3fb9[_0x5b80('0x1b')](_0x2b50d1);}return _0x4b3fb9[_0x5b80('0x1c')](_0x2b50d1)['end']();};}function respondWithResult(_0x5630be,_0x1448ec){_0x1448ec=_0x1448ec||0xc8;return function(_0x2b9126){if(_0x2b9126){return _0x5630be['status'](_0x1448ec)['json'](_0x2b9126);}};}function respondWithFilteredResult(_0x20b1e4,_0x1a92c6){return function(_0xbd7d2e){if(_0xbd7d2e){var _0x57f296=typeof _0x1a92c6[_0x5b80('0x1d')]===_0x5b80('0x1e')&&typeof _0x1a92c6['limit']===_0x5b80('0x1e');var _0x71ab4a=_0xbd7d2e[_0x5b80('0x1f')];var _0x2802b0=_0x57f296?0x0:_0x1a92c6[_0x5b80('0x1d')];var _0x46b34b=_0x57f296?_0xbd7d2e[_0x5b80('0x1f')]:_0x1a92c6[_0x5b80('0x1d')]+_0x1a92c6[_0x5b80('0x20')];var _0x2b8541;if(_0x46b34b>=_0x71ab4a){_0x46b34b=_0x71ab4a;_0x2b8541=0xc8;}else{_0x2b8541=0xce;}_0x20b1e4['status'](_0x2b8541);return _0x20b1e4['set'](_0x5b80('0x21'),_0x2802b0+'-'+_0x46b34b+'/'+_0x71ab4a)[_0x5b80('0x22')](_0xbd7d2e);}return null;};}function patchUpdates(_0x47a048){return function(_0x9ca52e){try{jsonpatch[_0x5b80('0x23')](_0x9ca52e,_0x47a048,!![]);}catch(_0x2b8994){return BPromise[_0x5b80('0x24')](_0x2b8994);}return _0x9ca52e['save']();};}function saveUpdates(_0x1691cc,_0x3f0da1){return function(_0x3c738a){if(_0x3c738a){return _0x3c738a['update'](_0x1691cc)[_0x5b80('0x25')](function(_0x105863){return _0x105863;});}return null;};}function removeEntity(_0xf0c044,_0x49afa4){return function(_0x27b268){if(_0x27b268){return _0x27b268[_0x5b80('0x26')]()['then'](function(){_0xf0c044[_0x5b80('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x220b88,_0x19faab){return function(_0x526f5d){if(!_0x526f5d){_0x220b88[_0x5b80('0x1b')](0x194);}return _0x526f5d;};}function handleError(_0x96086a,_0x106a93){_0x106a93=_0x106a93||0x1f4;return function(_0x53e52b){logger[_0x5b80('0x27')](_0x53e52b[_0x5b80('0x28')]);if(_0x53e52b[_0x5b80('0x29')]){delete _0x53e52b['name'];}_0x96086a['status'](_0x106a93)[_0x5b80('0x2a')](_0x53e52b);};}exports['index']=function(_0x2b9c98,_0x2c15e5){var _0x2970f0={},_0x47c871={},_0x122d6c={'count':0x0,'rows':[]};var _0x273fa6=_[_0x5b80('0x2b')](db[_0x5b80('0x2c')][_0x5b80('0x2d')],function(_0x11fd8b){return{'name':_0x11fd8b[_0x5b80('0x2e')],'type':_0x11fd8b[_0x5b80('0x2f')][_0x5b80('0x30')]};});_0x47c871[_0x5b80('0x31')]=_['differenceBy'](_[_0x5b80('0x2b')](_0x273fa6,_0x5b80('0x29')),[_0x5b80('0x32')]);_0x47c871['query']=_[_0x5b80('0x33')](_0x2b9c98[_0x5b80('0x34')]);_0x47c871[_0x5b80('0x35')]=_['intersection'](_0x47c871[_0x5b80('0x31')],_0x47c871[_0x5b80('0x34')]);_0x2970f0[_0x5b80('0x36')]=_['intersection'](_0x47c871[_0x5b80('0x31')],qs['fields'](_0x2b9c98[_0x5b80('0x34')][_0x5b80('0x37')]));_0x2970f0[_0x5b80('0x36')]=_0x2970f0[_0x5b80('0x36')][_0x5b80('0x38')]?_0x2970f0[_0x5b80('0x36')]:_0x47c871[_0x5b80('0x31')];if(!_0x2b9c98[_0x5b80('0x34')][_0x5b80('0x39')](_0x5b80('0x3a'))){_0x2970f0['limit']=qs[_0x5b80('0x20')](_0x2b9c98[_0x5b80('0x34')]['limit']);_0x2970f0[_0x5b80('0x1d')]=qs[_0x5b80('0x1d')](_0x2b9c98[_0x5b80('0x34')][_0x5b80('0x1d')]);}_0x2970f0['order']=qs['sort'](_0x2b9c98[_0x5b80('0x34')][_0x5b80('0x3b')]);_0x2970f0[_0x5b80('0x3c')]=qs[_0x5b80('0x35')](_[_0x5b80('0x3d')](_0x2b9c98[_0x5b80('0x34')],_0x47c871[_0x5b80('0x35')]),_0x273fa6);if(_0x2b9c98['query'][_0x5b80('0x3e')]){_0x2970f0['where']=_[_0x5b80('0x3f')](_0x2970f0['where'],{'$or':_[_0x5b80('0x2b')](_0x273fa6,function(_0x3a09bc){if(_0x3a09bc[_0x5b80('0x2f')]!==_0x5b80('0x40')){var _0x978def={};_0x978def[_0x3a09bc[_0x5b80('0x29')]]={'$like':'%'+_0x2b9c98[_0x5b80('0x34')][_0x5b80('0x3e')]+'%'};return _0x978def;}})});}_0x2970f0=_[_0x5b80('0x3f')]({},_0x2970f0,_0x2b9c98[_0x5b80('0x41')]);var _0x2c0088={'where':_0x2970f0[_0x5b80('0x3c')]};return db[_0x5b80('0x2c')][_0x5b80('0x1f')](_0x2c0088)[_0x5b80('0x25')](function(_0x319684){_0x122d6c[_0x5b80('0x1f')]=_0x319684;if(_0x2b9c98['query']['includeAll']){_0x2970f0['include']=[{'all':!![]}];}return db[_0x5b80('0x2c')][_0x5b80('0x42')](_0x2970f0);})[_0x5b80('0x25')](function(_0x1b07ae){_0x122d6c[_0x5b80('0x43')]=_0x1b07ae;return _0x122d6c;})[_0x5b80('0x25')](respondWithFilteredResult(_0x2c15e5,_0x2970f0))[_0x5b80('0x44')](handleError(_0x2c15e5,null));};exports[_0x5b80('0x45')]=function(_0x4973d5,_0x499388){var _0x21fc50={'raw':![],'where':{'id':_0x4973d5[_0x5b80('0x46')]['id']}},_0x10e9b0={};_0x10e9b0[_0x5b80('0x31')]=_[_0x5b80('0x33')](db[_0x5b80('0x2c')]['rawAttributes']);_0x10e9b0['query']=_['keys'](_0x4973d5['query']);_0x10e9b0[_0x5b80('0x35')]=_[_0x5b80('0x47')](_0x10e9b0['model'],_0x10e9b0[_0x5b80('0x34')]);_0x21fc50[_0x5b80('0x36')]=_[_0x5b80('0x47')](_0x10e9b0['model'],qs[_0x5b80('0x37')](_0x4973d5['query']['fields']));_0x21fc50[_0x5b80('0x36')]=_0x21fc50[_0x5b80('0x36')]['length']?_0x21fc50['attributes']:_0x10e9b0[_0x5b80('0x31')];if(_0x4973d5[_0x5b80('0x34')][_0x5b80('0x48')]){_0x21fc50[_0x5b80('0x49')]=[{'all':!![]}];}_0x21fc50=_[_0x5b80('0x3f')]({},_0x21fc50,_0x4973d5[_0x5b80('0x41')]);return db[_0x5b80('0x2c')][_0x5b80('0x4a')](_0x21fc50)[_0x5b80('0x25')](handleEntityNotFound(_0x499388,null))['then'](respondWithResult(_0x499388,null))[_0x5b80('0x44')](handleError(_0x499388,null));};exports[_0x5b80('0x4b')]=function(_0x3cedbb,_0x4b262b){return db['VoiceRecording']['create'](_0x3cedbb[_0x5b80('0x4c')],{})[_0x5b80('0x25')](respondWithResult(_0x4b262b,0xc9))[_0x5b80('0x44')](handleError(_0x4b262b,null));};exports['update']=function(_0x1ed037,_0x382a0f){if(_0x1ed037['body']['id']){delete _0x1ed037['body']['id'];}return db[_0x5b80('0x2c')][_0x5b80('0x4a')]({'where':{'id':_0x1ed037[_0x5b80('0x46')]['id']}})[_0x5b80('0x25')](handleEntityNotFound(_0x382a0f,null))[_0x5b80('0x25')](saveUpdates(_0x1ed037[_0x5b80('0x4c')],null))[_0x5b80('0x25')](respondWithResult(_0x382a0f,null))[_0x5b80('0x44')](handleError(_0x382a0f,null));};exports['describe']=function(_0x2b3a1c,_0x5b3701){return db['VoiceRecording'][_0x5b80('0x4d')]()[_0x5b80('0x25')](respondWithResult(_0x5b3701,null))[_0x5b80('0x44')](handleError(_0x5b3701,null));};exports[_0x5b80('0x4e')]=function(_0x286d09,_0x1c804a,_0x2dc8a1){var _0x463023=require(_0x5b80('0x4f'));var _0x2c958b=![];var _0x596cb3={};if(_0x286d09[_0x5b80('0x34')][_0x5b80('0x2f')]&&_0x286d09[_0x5b80('0x34')][_0x5b80('0x2f')]===_0x5b80('0x50')){_0x596cb3[_0x5b80('0x50')]=_0x286d09[_0x5b80('0x46')]['id'];}else{_0x596cb3['id']=_0x286d09[_0x5b80('0x46')]['id'];}return db[_0x5b80('0x2c')][_0x5b80('0x4a')]({'where':_0x596cb3,'attributes':['id',_0x5b80('0x51')],'raw':!![]})[_0x5b80('0x25')](handleEntityNotFound(_0x1c804a,null))[_0x5b80('0x25')](function(_0x49c43e){if(_0x49c43e){var _0x337e54=_0x49c43e[_0x5b80('0x51')];var _0x170abb=util[_0x5b80('0x32')](_0x5b80('0x52'),_0x337e54);if(fs['existsSync'](_0x170abb)){_0x2c958b=!![];return _0x463023[_0x5b80('0x53')](_0x170abb,_0x337e54,config[_0x5b80('0x54')][_0x5b80('0x55')])[_0x5b80('0x25')](function(){return _0x49c43e;});}return _0x49c43e;}})['then'](function(_0x233320){if(_0x233320){var _0x2d3616=_0x233320[_0x5b80('0x51')];if(!fs[_0x5b80('0x56')](_0x2d3616)){throw new db[(_0x5b80('0x57'))][(_0x5b80('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x233320[_0x5b80('0x59')]){return _0x1c804a['download'](_0x2d3616,_0x233320[_0x5b80('0x59')]+path[_0x5b80('0x5a')](_0x2d3616),function(){if(_0x2c958b){fs['unlink'](_0x2d3616);}});}else{return _0x1c804a[_0x5b80('0x4e')](_0x2d3616,function(_0x1b3585){if(_0x2c958b){fs[_0x5b80('0x5b')](_0x2d3616);}});}}})[_0x5b80('0x44')](function(_0x513aa0){if(_0x513aa0[_0x5b80('0x5c')]==='VoiceRecording\x20not\x20found'){_0x1c804a['status'](0x194)[_0x5b80('0x2a')]('Not\x20found');}else{return handleError(_0x1c804a,null);}});};exports['downloads']=function(_0x2f4dc5,_0x2ce7a8,_0x380a33){var _0x3fe378=require('../../components/encryptor');var _0x30aaba=![];var _0x2982f2={'$and':[db['sequelize'][_0x5b80('0x3c')](db['sequelize']['fn'](_0x5b80('0x5d'),db[_0x5b80('0x5e')][_0x5b80('0x5f')](_0x5b80('0x50'))),_0x2f4dc5[_0x5b80('0x34')][_0x5b80('0x60')])]};if(_0x2f4dc5['query'][_0x5b80('0x2f')]&&_0x2f4dc5['query'][_0x5b80('0x2f')]==='uniqueid'){_0x2982f2[_0x5b80('0x61')]['push']({'uniqueid':_0x2f4dc5[_0x5b80('0x46')]['id']});}else{_0x2982f2['$and'][_0x5b80('0x62')]({'id':_0x2f4dc5[_0x5b80('0x46')]['id']});}return db[_0x5b80('0x2c')][_0x5b80('0x4a')]({'where':_0x2982f2,'attributes':['id','value'],'raw':!![]})[_0x5b80('0x25')](handleEntityNotFound(_0x2ce7a8,null))[_0x5b80('0x25')](function(_0xc62f5c){if(_0xc62f5c){var _0x2e8ddf=util[_0x5b80('0x32')](_0x5b80('0x52'),_0xc62f5c[_0x5b80('0x51')]);if(fs[_0x5b80('0x56')](_0x2e8ddf)){_0x30aaba=!![];return _0x3fe378[_0x5b80('0x53')](_0x2e8ddf,_0xc62f5c[_0x5b80('0x51')],config[_0x5b80('0x54')][_0x5b80('0x55')])[_0x5b80('0x25')](function(){return _0xc62f5c;});}return _0xc62f5c;}})[_0x5b80('0x25')](function(_0x37bf24){if(_0x37bf24){if(!fs[_0x5b80('0x56')](_0x37bf24[_0x5b80('0x51')])){throw new db['Sequelize'][(_0x5b80('0x58'))](_0x5b80('0x63'));}if(_0x37bf24['filename']){return _0x2ce7a8[_0x5b80('0x4e')](_0x37bf24[_0x5b80('0x51')],_0x37bf24[_0x5b80('0x59')]+path[_0x5b80('0x5a')](_0x37bf24[_0x5b80('0x51')]),function(){if(_0x30aaba){fs[_0x5b80('0x5b')](_0x37bf24[_0x5b80('0x51')]);}});}else{return _0x2ce7a8['download'](_0x37bf24[_0x5b80('0x51')],function(_0x4d5a94){if(_0x30aaba){fs['unlink'](_0x37bf24['value']);}});}}})[_0x5b80('0x44')](handleError(_0x2ce7a8,null));};exports[_0x5b80('0x26')]=function(_0x365018,_0x435076){return db[_0x5b80('0x2c')]['find']({'where':{'id':_0x365018[_0x5b80('0x46')]['id']}})[_0x5b80('0x25')](function(_0x5f3dba){if(_[_0x5b80('0x64')](_0x5f3dba)){throw new ReferenceError(_0x5b80('0x65'));}return _0x5f3dba;})[_0x5b80('0x25')](function(_0x2f3c2f){var _0x4b26f4=_0x2f3c2f[_0x5b80('0x51')];logger['info'](_0x5b80('0x66'),_0x4b26f4);if(!_[_0x5b80('0x64')](_0x2f3c2f[_0x5b80('0x51')])&&fs[_0x5b80('0x56')](_0x4b26f4)){logger[_0x5b80('0x67')](_0x5b80('0x68')+_0x4b26f4+_0x5b80('0x69'));fs[_0x5b80('0x6a')](_0x4b26f4);}_0x4b26f4=_0x4b26f4+_0x5b80('0x6b');if(!_['isNil'](_0x2f3c2f['value'])&&fs[_0x5b80('0x56')](_0x4b26f4)){logger[_0x5b80('0x67')](_0x5b80('0x68')+_0x4b26f4+_0x5b80('0x69'));fs[_0x5b80('0x6a')](_0x4b26f4);}return _0x2f3c2f;})[_0x5b80('0x25')](function(_0x1b0eb0){if(!_0x1b0eb0)throw new InternalError();return _0x1b0eb0[_0x5b80('0x26')]();})['then'](function(){_0x435076[_0x5b80('0x1c')](0xcc)[_0x5b80('0x6c')]();})[_0x5b80('0x44')](handleError(_0x435076,null));};function getBucketslist(_0x6a2543,_0x54d122,_0x3dc282){return new Promise(function(_0x2f60a1,_0x103345){var _0x4ad326=new AWS['S3']({'accessKeyId':_0x54d122,'secretAccessKey':_0x6a2543,'region':_0x3dc282});_0x4ad326[_0x5b80('0x6d')]({},function(_0x9b7b88,_0x271a29){if(_0x9b7b88){return _0x103345(_0x9b7b88);}else{return _0x2f60a1(_0x271a29);}});});}function createBucket(_0xfe979,_0x151c76,_0x177430,_0x1717fd){return new Promise(function(_0x27bf2a,_0x473f1c){var _0x52c04c=new AWS['S3']({'accessKeyId':_0x151c76,'secretAccessKey':_0xfe979,'region':_0x177430});_0x52c04c['createBucket']({'Bucket':_0x1717fd},function(_0x48ad9d,_0x41ca75){if(_0x48ad9d){return _0x473f1c(_0x48ad9d);}else{return _0x27bf2a(_0x41ca75);}});});}function uploadFile(_0x13eee6,_0x1d9719,_0x41430a,_0x2b7940,_0x3b5c99,_0x54123b){return new Promise(function(_0x4fe95d,_0x4fb4e3){var _0x325a88=new AWS['S3']({'accessKeyId':_0x1d9719,'secretAccessKey':_0x13eee6,'region':_0x41430a});_0x325a88['upload']({'Bucket':_0x2b7940,'Key':_0x3b5c99,'Body':_0x54123b},function(_0x1ae290,_0x5c80a6){if(_0x1ae290){return _0x4fb4e3(_0x1ae290);}else{return _0x4fe95d(_0x5c80a6);}});});}function startTranscribe(_0x268d3f,_0x22081d,_0x51e367,_0x3af85d,_0x25a112,_0x11b6dd){return new Promise(function(_0x5c503a,_0x3e7252){var _0xc27c36=new AWS[(_0x5b80('0x6e'))]({'accessKeyId':_0x22081d,'secretAccessKey':_0x268d3f,'region':_0x51e367});_0xc27c36['startTranscriptionJob']({'TranscriptionJobName':_0x3af85d,'LanguageCode':_0x25a112,'Media':{'MediaFileUri':_0x11b6dd}},function(_0x1bc020,_0x547d53){if(_0x1bc020){return _0x3e7252(_0x1bc020);}else{return _0x5c503a(_0x547d53);}});});}function transcribe(_0x4c256f,_0x386992,_0x24115b,_0x5033fc,_0xc3512a,_0x5b0af1,_0x2b425d){return new Promise(function(_0x380126,_0xa1524e){var _0x10b8fb={};logger[_0x5b80('0x67')](util[_0x5b80('0x32')](_0x5b80('0x6f'),_0x4c256f,_0xc3512a));return uploadFile(_0x386992,_0x24115b,_0x5033fc,_0xc3512a,path[_0x5b80('0x70')](_0x5b0af1),fs[_0x5b80('0x71')](_0x5b0af1))['then'](function(_0x31e2e1){logger[_0x5b80('0x67')](util[_0x5b80('0x32')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4c256f,_0xc3512a,_0x31e2e1['Location']));_0x10b8fb[_0x5b80('0x72')]=_0x31e2e1['Bucket'];_0x10b8fb['location']=_0x31e2e1[_0x5b80('0x73')];logger[_0x5b80('0x67')](util['format'](_0x5b80('0x74'),_0x4c256f));return startTranscribe(_0x386992,_0x24115b,_0x5033fc,uuidv4(),_0x2b425d,_0x31e2e1['Location']);})[_0x5b80('0x25')](function(_0x10f959){logger[_0x5b80('0x67')](util[_0x5b80('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4c256f,_0x10f959[_0x5b80('0x75')]['TranscriptionJobName']));_0x10b8fb[_0x5b80('0x76')]=_0x10f959[_0x5b80('0x75')][_0x5b80('0x77')];_0x10b8fb[_0x5b80('0x78')]=_0x10f959[_0x5b80('0x75')][_0x5b80('0x79')];return _0x380126(_0x10b8fb);})['catch'](function(_0x382b19){return _0xa1524e(_0x382b19);});});}exports[_0x5b80('0x7a')]=function(_0x1d5580,_0x55cb39,_0x5e9648){var _0x278b2f;var _0x49452f;var _0x5a338c;var _0x1f6647=require(_0x5b80('0x4f'));return db[_0x5b80('0x2c')][_0x5b80('0x7b')]({'where':{'id':_0x1d5580['params']['id']}})[_0x5b80('0x25')](function(_0x16ca0d){if(_0x16ca0d){var _0x1e1226=util[_0x5b80('0x32')]('%s.cypher',_0x16ca0d[_0x5b80('0x51')]);if(fs[_0x5b80('0x56')](_0x1e1226)){cypher=!![];return _0x1f6647['decryptFile'](_0x1e1226,_0x16ca0d[_0x5b80('0x51')],config[_0x5b80('0x54')][_0x5b80('0x55')])[_0x5b80('0x25')](function(){return _0x16ca0d;});}return _0x16ca0d;}})[_0x5b80('0x25')](function(_0x1be572){if(!_0x1be572){throw new db[(_0x5b80('0x57'))][(_0x5b80('0x58'))](_0x5b80('0x7c'));}_0x49452f=_0x1be572;return db[_0x5b80('0x7d')][_0x5b80('0x7b')]({'where':{'id':0x1}});})[_0x5b80('0x25')](handleEntityNotFound(_0x55cb39,null))['then'](function(_0x397d34){if(_0x397d34){_0x278b2f=_0x397d34;if(!_0x278b2f['transcribe']||!_0x278b2f['transcribeAccountId']||!_0x278b2f[_0x5b80('0x7e')]||!_0x278b2f[_0x5b80('0x7f')]||!_0x278b2f['bucket']){throw new db[(_0x5b80('0x57'))][(_0x5b80('0x58'))](_0x5b80('0x80'));}if(_0x1d5580['body']['runSentiment']&&(!_0x278b2f[_0x5b80('0x81')]||!_0x278b2f[_0x5b80('0x82')]||!_0x278b2f[_0x5b80('0x83')]||!_0x278b2f['language']||!_0x278b2f[_0x5b80('0x72')])){throw new db[(_0x5b80('0x57'))]['ValidationError'](_0x5b80('0x84'));}return db[_0x5b80('0x85')][_0x5b80('0x7b')]({'where':{'id':_0x278b2f[_0x5b80('0x86')]}});}})[_0x5b80('0x25')](function(_0x777fe1){if(!_0x777fe1){throw new db[(_0x5b80('0x57'))][(_0x5b80('0x58'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x777fe1[_0x5b80('0x87')]||!_0x777fe1[_0x5b80('0x88')]){throw new db[(_0x5b80('0x57'))][(_0x5b80('0x58'))](_0x5b80('0x89'));}_0x5a338c=_0x777fe1;return getBucketslist(_0x5a338c[_0x5b80('0x87')],_0x5a338c['data2'],_0x278b2f['transcribeRegion']);})['then'](function(_0x9841aa){if(_0x9841aa&&_0x9841aa[_0x5b80('0x8a')]){var _0x4acfa1=_[_0x5b80('0x4a')](_0x9841aa[_0x5b80('0x8a')],function(_0x37dc8d){return _0x37dc8d[_0x5b80('0x8b')]===_0x278b2f[_0x5b80('0x72')];});if(!_0x4acfa1){logger[_0x5b80('0x67')](util[_0x5b80('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x1d5580['params']['id'],_0x278b2f[_0x5b80('0x72')]));return createBucket(_0x5a338c[_0x5b80('0x87')],_0x5a338c['data2'],_0x278b2f[_0x5b80('0x7e')],_0x278b2f[_0x5b80('0x72')]);}logger[_0x5b80('0x67')](util['format'](_0x5b80('0x8c'),_0x1d5580['params']['id'],_0x278b2f[_0x5b80('0x72')]));return;}})[_0x5b80('0x25')](function(_0x511db6){if(_0x49452f[_0x5b80('0x78')]===_0x5b80('0x8d')){return transcribe(_0x1d5580[_0x5b80('0x46')]['id'],_0x5a338c[_0x5b80('0x87')],_0x5a338c[_0x5b80('0x88')],_0x278b2f[_0x5b80('0x7e')],_0x278b2f['bucket'],_0x49452f[_0x5b80('0x51')],_0x278b2f[_0x5b80('0x7f')]);}else{logger[_0x5b80('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1d5580[_0x5b80('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x5b80('0x25')](function(_0x4771f2){if(_0x4771f2){_0x4771f2['tempSentiment']=_0x1d5580[_0x5b80('0x4c')][_0x5b80('0x8e')];return _0x49452f['updateAttributes'](_0x4771f2);}})[_0x5b80('0x25')](respondWithResult(_0x55cb39,null))[_0x5b80('0x44')](handleError(_0x55cb39,null));};function writeFile(_0x36d39a,_0x4dc069){return new Promise(function(_0x4c4c8f,_0x1bfb4d){fs[_0x5b80('0x8f')](_0x4dc069,_0x36d39a,function(_0x26a9bc,_0x137efc){if(_0x26a9bc){return _0x1bfb4d(_0x26a9bc);}else{return _0x4c4c8f(_0x137efc);}});});}exports[_0x5b80('0x90')]=function(_0xd46079,_0x3e703b,_0x2aaee2){return db[_0x5b80('0x2c')]['findOne']({'where':{'id':_0xd46079[_0x5b80('0x46')]['id']}})[_0x5b80('0x25')](handleEntityNotFound(_0x3e703b))[_0x5b80('0x25')](function(_0x4e2d88){if(_0x4e2d88&&_0x4e2d88[_0x5b80('0x91')]){var _0x18fe58=_0x4e2d88[_0x5b80('0x91')];var _0x13442b=config[_0x5b80('0x92')]+_0x5b80('0x93')+_0x4e2d88['id']+'.txt';if(fs[_0x5b80('0x56')](_0x13442b)){return _0x13442b;}return writeFile(_0x18fe58,_0x13442b)['then'](function(){return _0x13442b;});}else{throw new db['Sequelize'][(_0x5b80('0x58'))](_0x5b80('0x94'));}})[_0x5b80('0x25')](function(_0x50619b){return _0x3e703b[_0x5b80('0x4e')](_0x50619b);})[_0x5b80('0x44')](handleError(_0x3e703b));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 656a365..8d7e69e 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 _0xbd3b=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x3b9c16,_0x3a3f49){var _0x5a2683=function(_0x4b1614){while(--_0x4b1614){_0x3b9c16['push'](_0x3b9c16['shift']());}};_0x5a2683(++_0x3a3f49);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x3ab164,_0x2fa5e9){_0x3ab164=_0x3ab164-0x0;var _0x39565e=_0xbd3b[_0x3ab164];return _0x39565e;};'use strict';var attributes=require(_0xbbd3('0x0'));module[_0xbbd3('0x1')]=function(_0x41cb28,_0x56e668){return _0x41cb28[_0xbbd3('0x2')](_0xbbd3('0x3'),attributes,{'tableName':_0xbbd3('0x4'),'paranoid':![],'indexes':[{'name':_0xbbd3('0x5'),'fields':['uniqueid']},{'name':_0xbbd3('0x6'),'fields':[_0xbbd3('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x50c1=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0x581160,_0x4b5a6a){var _0x28941c=function(_0x18b860){while(--_0x18b860){_0x581160['push'](_0x581160['shift']());}};_0x28941c(++_0x4b5a6a);}(_0x50c1,0x1a5));var _0x150c=function(_0xa75988,_0x38016c){_0xa75988=_0xa75988-0x0;var _0x504698=_0x50c1[_0xa75988];return _0x504698;};'use strict';var attributes=require(_0x150c('0x0'));module['exports']=function(_0x47d48d,_0x33d11f){return _0x47d48d[_0x150c('0x1')](_0x150c('0x2'),attributes,{'tableName':_0x150c('0x3'),'paranoid':![],'indexes':[{'name':_0x150c('0x4'),'fields':[_0x150c('0x4')]},{'name':_0x150c('0x5'),'fields':[_0x150c('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 fa2502b..49eaad2 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 _0x896e=['body','options','raw','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','unlink','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','update'];(function(_0xb5927,_0x3d6e5e){var _0x287504=function(_0x27020d){while(--_0x27020d){_0xb5927['push'](_0xb5927['shift']());}};_0x287504(++_0x3d6e5e);}(_0x896e,0x1e9));var _0xe896=function(_0x3a8b4f,_0x4e7878){_0x3a8b4f=_0x3a8b4f-0x0;var _0x363354=_0x896e[_0x3a8b4f];return _0x363354;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});}exports[_0xe896('0x18')]=function(_0x32f86d){var _0x2d4cf0=this;return new Promise(function(_0x5dc89d,_0x782813){return db[_0xe896('0x19')][_0xe896('0x1a')](_0x32f86d[_0xe896('0x1b')],{'raw':_0x32f86d[_0xe896('0x1c')]?_0x32f86d[_0xe896('0x1c')][_0xe896('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32f86d[_0xe896('0x1c')]?_0x32f86d['options'][_0xe896('0x1e')]||null:null,'attributes':_0x32f86d['options']?_0x32f86d['options'][_0xe896('0x1f')]||null:null,'limit':_0x32f86d[_0xe896('0x1c')]?_0x32f86d[_0xe896('0x1c')][_0xe896('0x20')]||null:null})['then'](function(_0x468479){logger['info']('UpdateVoiceRecording',_0x32f86d);logger[_0xe896('0x10')](_0xe896('0x18'),_0x32f86d,JSON[_0xe896('0x12')](_0x468479));_0x5dc89d(_0x468479);})[_0xe896('0x17')](function(_0x20e295){logger[_0xe896('0x13')](_0xe896('0x18'),_0x20e295['message'],_0x32f86d);_0x782813(_0x2d4cf0[_0xe896('0x13')](0x1f4,_0x20e295[_0xe896('0x15')]));});});};exports[_0xe896('0x21')]=function(_0x569d5f){var _0x26635e=this;return new Promise(function(_0xd50fe2,_0x2bc11d){var _0xe93aa0=require(_0xe896('0x22'));var _0x3f8ceb;return db['Setting'][_0xe896('0x23')]({'attributes':['id',_0xe896('0x24')],'where':{'id':0x1},'raw':!![]})[_0xe896('0xe')](function(_0xbfb15b){_0x3f8ceb=_0xbfb15b;return db[_0xe896('0x19')]['create'](_0x569d5f['body']);})['then'](function(_0x504d7c){if(_0x3f8ceb['callRecordingEncryption']&&fs[_0xe896('0x25')](_0x504d7c[_0xe896('0x26')])){var _0x10fd26=util[_0xe896('0x27')](_0xe896('0x28'),_0x504d7c[_0xe896('0x26')]);return _0xe93aa0[_0xe896('0x29')](_0x504d7c[_0xe896('0x26')],_0x10fd26,config['secrets']['recording'])[_0xe896('0xe')](function(){fs[_0xe896('0x2a')](_0x504d7c[_0xe896('0x26')]);logger[_0xe896('0x16')]('CreateVoiceRecording\x20file\x20encrypted');return _0x504d7c;});}return _0x504d7c;})[_0xe896('0xe')](function(_0x571e4d){logger['info'](_0xe896('0x21'),_0x569d5f);logger[_0xe896('0x10')](_0xe896('0x21'),_0x569d5f,JSON['stringify'](_0x571e4d));_0xd50fe2(_0x571e4d);})['catch'](function(_0x567589){logger[_0xe896('0x13')](_0xe896('0x21'),_0x567589[_0xe896('0x15')],_0x569d5f);_0x2bc11d(_0x26635e[_0xe896('0x13')](0x1f4,_0x567589[_0xe896('0x15')]));});});}; \ No newline at end of file +var _0xcaf2=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','stringify','catch'];(function(_0xac87ee,_0x1c5811){var _0xc42431=function(_0xd5fb42){while(--_0xd5fb42){_0xac87ee['push'](_0xac87ee['shift']());}};_0xc42431(++_0x1c5811);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1d13c8,_0x1554e6){_0x1d13c8=_0x1d13c8-0x0;var _0x3a3b03=_0xcaf2[_0x1d13c8];return _0x3a3b03;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['UpdateVoiceRecording']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['update'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc['options'][_0x2caf('0x18')]||null:null,'attributes':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x19')]||null:null,'limit':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x1a')]||null:null})[_0x2caf('0xa')](function(_0x3332b1){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x4a33fc);logger['debug'](_0x2caf('0x1b'),_0x4a33fc,JSON[_0x2caf('0x1c')](_0x3332b1));_0x58047b(_0x3332b1);})[_0x2caf('0x1d')](function(_0x401ea2){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x401ea2[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x401ea2[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1e')]=function(_0x5ad211){var _0x6a32ac=this;return new Promise(function(_0x325eda,_0xbefce6){var _0x37b08f=require(_0x2caf('0x1f'));var _0x17d3c6;return db[_0x2caf('0x20')][_0x2caf('0x21')]({'attributes':['id',_0x2caf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x2caf('0xa')](function(_0x30da75){_0x17d3c6=_0x30da75;return db[_0x2caf('0x14')][_0x2caf('0x23')](_0x5ad211['body']);})[_0x2caf('0xa')](function(_0xda0ec5){if(_0x17d3c6[_0x2caf('0x22')]&&fs[_0x2caf('0x24')](_0xda0ec5[_0x2caf('0x25')])){var _0x1f52bf=util[_0x2caf('0x26')]('%s.cypher',_0xda0ec5[_0x2caf('0x25')]);return _0x37b08f[_0x2caf('0x27')](_0xda0ec5['value'],_0x1f52bf,config[_0x2caf('0x28')][_0x2caf('0x29')])[_0x2caf('0xa')](function(){fs['unlink'](_0xda0ec5[_0x2caf('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xda0ec5;});}return _0xda0ec5;})[_0x2caf('0xa')](function(_0x28b715){logger[_0x2caf('0xb')](_0x2caf('0x1e'),_0x5ad211);logger[_0x2caf('0xe')](_0x2caf('0x1e'),_0x5ad211,JSON[_0x2caf('0x1c')](_0x28b715));_0x325eda(_0x28b715);})[_0x2caf('0x1d')](function(_0x20818e){logger['error'](_0x2caf('0x1e'),_0x20818e[_0x2caf('0x12')],_0x5ad211);_0xbefce6(_0x6a32ac[_0x2caf('0x10')](0x1f4,_0x20818e[_0x2caf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 71a0bfd..e2aff2e 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 _0xffa6=['util','express','Router','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x244628,_0xdbac49){var _0x33c2d3=function(_0x49bdc2){while(--_0x49bdc2){_0x244628['push'](_0x244628['shift']());}};_0x33c2d3(++_0xdbac49);}(_0xffa6,0x10f));var _0x6ffa=function(_0x4f13a4,_0x2a6424){_0x4f13a4=_0x4f13a4-0x0;var _0x16703e=_0xffa6[_0x4f13a4];return _0x16703e;};'use strict';var multer=require(_0x6ffa('0x0'));var util=require(_0x6ffa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ffa('0x2'));var router=express[_0x6ffa('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ffa('0x4'));var controller=require(_0x6ffa('0x5'));router[_0x6ffa('0x6')]('/',auth[_0x6ffa('0x7')](),controller['index']);router[_0x6ffa('0x6')]('/describe',auth[_0x6ffa('0x7')](),controller[_0x6ffa('0x8')]);router['get'](_0x6ffa('0x9'),auth[_0x6ffa('0x7')](),controller[_0x6ffa('0xa')]);router[_0x6ffa('0xb')]('/',auth[_0x6ffa('0x7')](),controller[_0x6ffa('0xc')]);router[_0x6ffa('0xd')]('/:id',auth[_0x6ffa('0x7')](),controller[_0x6ffa('0xe')]);router[_0x6ffa('0xf')]('/:id',auth[_0x6ffa('0x7')](),controller[_0x6ffa('0x10')]);module['exports']=router; \ No newline at end of file +var _0x48b8=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x1f8f97,_0x1c8de4){var _0x59871e=function(_0x4513ad){while(--_0x4513ad){_0x1f8f97['push'](_0x1f8f97['shift']());}};_0x59871e(++_0x1c8de4);}(_0x48b8,0x1ab));var _0x848b=function(_0x11c50d,_0x318b9d){_0x11c50d=_0x11c50d-0x0;var _0x5cce3c=_0x48b8[_0x11c50d];return _0x5cce3c;};'use strict';var multer=require(_0x848b('0x0'));var util=require('util');var path=require(_0x848b('0x1'));var timeout=require(_0x848b('0x2'));var express=require(_0x848b('0x3'));var router=express['Router']();var fs_extra=require(_0x848b('0x4'));var auth=require(_0x848b('0x5'));var interaction=require(_0x848b('0x6'));var config=require(_0x848b('0x7'));var controller=require('./voiceTransferReport.controller');router[_0x848b('0x8')]('/',auth[_0x848b('0x9')](),controller[_0x848b('0xa')]);router['get']('/describe',auth[_0x848b('0x9')](),controller[_0x848b('0xb')]);router[_0x848b('0x8')](_0x848b('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x848b('0xd')]('/',auth['isAuthenticated'](),controller[_0x848b('0xe')]);router[_0x848b('0xf')](_0x848b('0xc'),auth['isAuthenticated'](),controller[_0x848b('0x10')]);router[_0x848b('0x11')]('/:id',auth[_0x848b('0x9')](),controller[_0x848b('0x12')]);module[_0x848b('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 0a89d20..c021362 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 _0x0c8e=['ENUM','blind','attended','STRING','Yes','sequelize','exports'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x0c8e,0x83));var _0xe0c8=function(_0xd23f35,_0x5f08eb){_0xd23f35=_0xd23f35-0x0;var _0x19102f=_0x0c8e[_0xd23f35];return _0x19102f;};'use strict';var Sequelize=require(_0xe0c8('0x0'));var moment=require('moment');module[_0xe0c8('0x1')]={'type':{'type':Sequelize[_0xe0c8('0x2')](_0xe0c8('0x3'),_0xe0c8('0x4'))},'result':{'type':Sequelize[_0xe0c8('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe0c8('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xe0c8('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xe0c8('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xe0c8('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xe0c8('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xe0c8('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe0c8('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe0c8('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe0c8('0x5')]},'isexternal':{'type':Sequelize[_0xe0c8('0x2')](_0xe0c8('0x6'),'No')},'context':{'type':Sequelize[_0xe0c8('0x5')]},'extension':{'type':Sequelize[_0xe0c8('0x5')]}}; \ No newline at end of file +var _0xd511=['exports','blind','attended','STRING','Yes'];(function(_0x350b50,_0x11b5bf){var _0x5f589b=function(_0x215adf){while(--_0x215adf){_0x350b50['push'](_0x350b50['shift']());}};_0x5f589b(++_0x11b5bf);}(_0xd511,0x1ef));var _0x1d51=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd511[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1d51('0x0')]={'type':{'type':Sequelize['ENUM'](_0x1d51('0x1'),_0x1d51('0x2'))},'result':{'type':Sequelize[_0x1d51('0x3')]},'transfererchannel':{'type':Sequelize[_0x1d51('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x1d51('0x3')]},'transferercalleridname':{'type':Sequelize[_0x1d51('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x1d51('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x1d51('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x1d51('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1d51('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1d51('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1d51('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0x1d51('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1d51('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x1d51('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x1d51('0x4'),'No')},'context':{'type':Sequelize[_0x1d51('0x3')]},'extension':{'type':Sequelize[_0x1d51('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 22ab024..fac7e1e 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 _0x544d=['reject','save','then','destroy','error','stack','name','send','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','params','fields','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x5c17be,_0x49b16a){var _0x326497=function(_0x4befe9){while(--_0x4befe9){_0x5c17be['push'](_0x5c17be['shift']());}};_0x326497(++_0x49b16a);}(_0x544d,0x196));var _0xd544=function(_0x3ced3e,_0x4c423e){_0x3ced3e=_0x3ced3e-0x0;var _0x51118b=_0x544d[_0x3ced3e];return _0x51118b;};'use strict';var emlformat=require(_0xd544('0x0'));var rimraf=require(_0xd544('0x1'));var zipdir=require(_0xd544('0x2'));var jsonpatch=require(_0xd544('0x3'));var rp=require(_0xd544('0x4'));var moment=require('moment');var BPromise=require(_0xd544('0x5'));var Mustache=require(_0xd544('0x6'));var util=require(_0xd544('0x7'));var path=require(_0xd544('0x8'));var sox=require(_0xd544('0x9'));var csv=require(_0xd544('0xa'));var ejs=require(_0xd544('0xb'));var fs=require('fs');var fs_extra=require(_0xd544('0xc'));var _=require(_0xd544('0xd'));var squel=require(_0xd544('0xe'));var crypto=require(_0xd544('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd544('0x10'));var toCsv=require(_0xd544('0xa'));var querystring=require(_0xd544('0x11'));var Papa=require('papaparse');var Redis=require(_0xd544('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd544('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd544('0x14'))(_0xd544('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd544('0x16'))['db'];function respondWithStatusCode(_0x546cf8,_0x3ad3e5){_0x3ad3e5=_0x3ad3e5||0xcc;return function(_0x29686d){if(_0x29686d){return _0x546cf8['sendStatus'](_0x3ad3e5);}return _0x546cf8[_0xd544('0x17')](_0x3ad3e5)[_0xd544('0x18')]();};}function respondWithResult(_0x10d805,_0x477fa1){_0x477fa1=_0x477fa1||0xc8;return function(_0x55a6f3){if(_0x55a6f3){return _0x10d805[_0xd544('0x17')](_0x477fa1)['json'](_0x55a6f3);}};}function respondWithFilteredResult(_0x4be37a,_0x483a75){return function(_0x480e88){if(_0x480e88){var _0x5a3eb3=typeof _0x483a75['offset']===_0xd544('0x19')&&typeof _0x483a75[_0xd544('0x1a')]==='undefined';var _0x30f406=_0x480e88[_0xd544('0x1b')];var _0x1a27ce=_0x5a3eb3?0x0:_0x483a75[_0xd544('0x1c')];var _0x394b9a=_0x5a3eb3?_0x480e88[_0xd544('0x1b')]:_0x483a75[_0xd544('0x1c')]+_0x483a75['limit'];var _0x40fbdf;if(_0x394b9a>=_0x30f406){_0x394b9a=_0x30f406;_0x40fbdf=0xc8;}else{_0x40fbdf=0xce;}_0x4be37a[_0xd544('0x17')](_0x40fbdf);return _0x4be37a[_0xd544('0x1d')](_0xd544('0x1e'),_0x1a27ce+'-'+_0x394b9a+'/'+_0x30f406)[_0xd544('0x1f')](_0x480e88);}return null;};}function patchUpdates(_0x3467fa){return function(_0x876551){try{jsonpatch['apply'](_0x876551,_0x3467fa,!![]);}catch(_0x48b4a){return BPromise[_0xd544('0x20')](_0x48b4a);}return _0x876551[_0xd544('0x21')]();};}function saveUpdates(_0x1f8f98,_0x21d803){return function(_0x3ce299){if(_0x3ce299){return _0x3ce299['update'](_0x1f8f98)[_0xd544('0x22')](function(_0x28d594){return _0x28d594;});}return null;};}function removeEntity(_0x2586b0,_0x113060){return function(_0x55774c){if(_0x55774c){return _0x55774c[_0xd544('0x23')]()[_0xd544('0x22')](function(){_0x2586b0[_0xd544('0x17')](0xcc)[_0xd544('0x18')]();});}};}function handleEntityNotFound(_0x3995d1,_0x32b98b){return function(_0x1cb127){if(!_0x1cb127){_0x3995d1['sendStatus'](0x194);}return _0x1cb127;};}function handleError(_0x1e15b0,_0xde4a41){_0xde4a41=_0xde4a41||0x1f4;return function(_0x5970de){logger[_0xd544('0x24')](_0x5970de[_0xd544('0x25')]);if(_0x5970de[_0xd544('0x26')]){delete _0x5970de[_0xd544('0x26')];}_0x1e15b0['status'](_0xde4a41)[_0xd544('0x27')](_0x5970de);};}exports['index']=function(_0x405730,_0x19ffa9){var _0xf12a9e={},_0x364c6f={},_0x21afef={'count':0x0,'rows':[]};var _0x15430c=_['map'](db[_0xd544('0x28')][_0xd544('0x29')],function(_0x2af9fd){return{'name':_0x2af9fd[_0xd544('0x2a')],'type':_0x2af9fd[_0xd544('0x2b')][_0xd544('0x2c')]};});_0x364c6f[_0xd544('0x2d')]=_[_0xd544('0x2e')](_0x15430c,_0xd544('0x26'));_0x364c6f['query']=_[_0xd544('0x2f')](_0x405730[_0xd544('0x30')]);_0x364c6f[_0xd544('0x31')]=_['intersection'](_0x364c6f[_0xd544('0x2d')],_0x364c6f[_0xd544('0x30')]);_0xf12a9e['attributes']=_[_0xd544('0x32')](_0x364c6f[_0xd544('0x2d')],qs['fields'](_0x405730[_0xd544('0x30')]['fields']));_0xf12a9e[_0xd544('0x33')]=_0xf12a9e[_0xd544('0x33')][_0xd544('0x34')]?_0xf12a9e[_0xd544('0x33')]:_0x364c6f[_0xd544('0x2d')];if(!_0x405730[_0xd544('0x30')][_0xd544('0x35')](_0xd544('0x36'))){_0xf12a9e[_0xd544('0x1a')]=qs[_0xd544('0x1a')](_0x405730[_0xd544('0x30')][_0xd544('0x1a')]);_0xf12a9e[_0xd544('0x1c')]=qs[_0xd544('0x1c')](_0x405730[_0xd544('0x30')][_0xd544('0x1c')]);}_0xf12a9e[_0xd544('0x37')]=qs[_0xd544('0x38')](_0x405730[_0xd544('0x30')][_0xd544('0x38')]);_0xf12a9e[_0xd544('0x39')]=qs[_0xd544('0x31')](_[_0xd544('0x3a')](_0x405730['query'],_0x364c6f[_0xd544('0x31')]),_0x15430c);if(_0x405730[_0xd544('0x30')][_0xd544('0x3b')]){_0xf12a9e[_0xd544('0x39')]=_[_0xd544('0x3c')](_0xf12a9e['where'],{'$or':_[_0xd544('0x2e')](_0x15430c,function(_0x58ca16){if(_0x58ca16[_0xd544('0x2b')]!==_0xd544('0x3d')){var _0x29faa7={};_0x29faa7[_0x58ca16['name']]={'$like':'%'+_0x405730[_0xd544('0x30')][_0xd544('0x3b')]+'%'};return _0x29faa7;}})});}_0xf12a9e=_['merge']({},_0xf12a9e,_0x405730[_0xd544('0x3e')]);var _0x35640b={'where':_0xf12a9e[_0xd544('0x39')]};return db[_0xd544('0x28')]['count'](_0x35640b)[_0xd544('0x22')](function(_0x3e152e){_0x21afef[_0xd544('0x1b')]=_0x3e152e;if(_0x405730[_0xd544('0x30')]['includeAll']){_0xf12a9e[_0xd544('0x3f')]=[{'all':!![]}];}return db[_0xd544('0x28')]['findAll'](_0xf12a9e);})[_0xd544('0x22')](function(_0x30a43e){_0x21afef['rows']=_0x30a43e;return _0x21afef;})['then'](respondWithFilteredResult(_0x19ffa9,_0xf12a9e))['catch'](handleError(_0x19ffa9,null));};exports[_0xd544('0x40')]=function(_0x5b1725,_0x2eef15){var _0x116e47={'raw':!![],'where':{'id':_0x5b1725[_0xd544('0x41')]['id']}},_0x38c548={};_0x38c548[_0xd544('0x2d')]=_[_0xd544('0x2f')](db[_0xd544('0x28')][_0xd544('0x29')]);_0x38c548[_0xd544('0x30')]=_[_0xd544('0x2f')](_0x5b1725[_0xd544('0x30')]);_0x38c548[_0xd544('0x31')]=_[_0xd544('0x32')](_0x38c548[_0xd544('0x2d')],_0x38c548[_0xd544('0x30')]);_0x116e47[_0xd544('0x33')]=_[_0xd544('0x32')](_0x38c548['model'],qs[_0xd544('0x42')](_0x5b1725[_0xd544('0x30')]['fields']));_0x116e47[_0xd544('0x33')]=_0x116e47['attributes']['length']?_0x116e47[_0xd544('0x33')]:_0x38c548['model'];if(_0x5b1725[_0xd544('0x30')]['includeAll']){_0x116e47[_0xd544('0x3f')]=[{'all':!![]}];}_0x116e47=_['merge']({},_0x116e47,_0x5b1725[_0xd544('0x3e')]);return db[_0xd544('0x28')][_0xd544('0x43')](_0x116e47)['then'](handleEntityNotFound(_0x2eef15,null))[_0xd544('0x22')](respondWithResult(_0x2eef15,null))[_0xd544('0x44')](handleError(_0x2eef15,null));};exports[_0xd544('0x45')]=function(_0x4d4a4a,_0xc0b91c){return db['VoiceTransferReport'][_0xd544('0x45')](_0x4d4a4a[_0xd544('0x46')],{})[_0xd544('0x22')](respondWithResult(_0xc0b91c,0xc9))[_0xd544('0x44')](handleError(_0xc0b91c,null));};exports[_0xd544('0x47')]=function(_0x4b6eab,_0x1084a4){if(_0x4b6eab[_0xd544('0x46')]['id']){delete _0x4b6eab[_0xd544('0x46')]['id'];}return db[_0xd544('0x28')][_0xd544('0x43')]({'where':{'id':_0x4b6eab[_0xd544('0x41')]['id']}})[_0xd544('0x22')](handleEntityNotFound(_0x1084a4,null))[_0xd544('0x22')](saveUpdates(_0x4b6eab[_0xd544('0x46')],null))[_0xd544('0x22')](respondWithResult(_0x1084a4,null))[_0xd544('0x44')](handleError(_0x1084a4,null));};exports[_0xd544('0x23')]=function(_0x56ead0,_0x3e09e3){return db[_0xd544('0x28')][_0xd544('0x43')]({'where':{'id':_0x56ead0[_0xd544('0x41')]['id']}})[_0xd544('0x22')](handleEntityNotFound(_0x3e09e3,null))['then'](removeEntity(_0x3e09e3,null))[_0xd544('0x44')](handleError(_0x3e09e3,null));};exports[_0xd544('0x48')]=function(_0x657b0c,_0x4f670d){return db[_0xd544('0x28')]['describe']()[_0xd544('0x22')](respondWithResult(_0x4f670d,null))['catch'](handleError(_0x4f670d,null));}; \ No newline at end of file +var _0x5de5=['Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set'];(function(_0x41ca41,_0x2a2e62){var _0x22a2f0=function(_0x5bfcdb){while(--_0x5bfcdb){_0x41ca41['push'](_0x41ca41['shift']());}};_0x22a2f0(++_0x2a2e62);}(_0x5de5,0x1b5));var _0x55de=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5de5[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x55de('0x0'));var rimraf=require(_0x55de('0x1'));var zipdir=require(_0x55de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x55de('0x3'));var moment=require(_0x55de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x55de('0x5'));var util=require(_0x55de('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x55de('0x7'));var ejs=require(_0x55de('0x8'));var fs=require('fs');var fs_extra=require(_0x55de('0x9'));var _=require('lodash');var squel=require(_0x55de('0xa'));var crypto=require(_0x55de('0xb'));var jsforce=require(_0x55de('0xc'));var deskjs=require(_0x55de('0xd'));var toCsv=require(_0x55de('0x7'));var querystring=require(_0x55de('0xe'));var Papa=require(_0x55de('0xf'));var Redis=require(_0x55de('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x55de('0x11'));var as=require(_0x55de('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55de('0x13'))(_0x55de('0x14'));var utils=require(_0x55de('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x55de('0x16'));var db=require(_0x55de('0x17'))['db'];function respondWithStatusCode(_0x19c20c,_0x28ccfe){_0x28ccfe=_0x28ccfe||0xcc;return function(_0x1fd077){if(_0x1fd077){return _0x19c20c[_0x55de('0x18')](_0x28ccfe);}return _0x19c20c[_0x55de('0x19')](_0x28ccfe)['end']();};}function respondWithResult(_0x25e322,_0x155c87){_0x155c87=_0x155c87||0xc8;return function(_0x2c0f3b){if(_0x2c0f3b){return _0x25e322['status'](_0x155c87)['json'](_0x2c0f3b);}};}function respondWithFilteredResult(_0x5abbb5,_0x9b7532){return function(_0x376a55){if(_0x376a55){var _0x1d9476=typeof _0x9b7532[_0x55de('0x1a')]===_0x55de('0x1b')&&typeof _0x9b7532[_0x55de('0x1c')]===_0x55de('0x1b');var _0x5f2eb5=_0x376a55[_0x55de('0x1d')];var _0x5867ea=_0x1d9476?0x0:_0x9b7532[_0x55de('0x1a')];var _0x290ea6=_0x1d9476?_0x376a55[_0x55de('0x1d')]:_0x9b7532['offset']+_0x9b7532[_0x55de('0x1c')];var _0x4136f0;if(_0x290ea6>=_0x5f2eb5){_0x290ea6=_0x5f2eb5;_0x4136f0=0xc8;}else{_0x4136f0=0xce;}_0x5abbb5['status'](_0x4136f0);return _0x5abbb5[_0x55de('0x1e')](_0x55de('0x1f'),_0x5867ea+'-'+_0x290ea6+'/'+_0x5f2eb5)[_0x55de('0x20')](_0x376a55);}return null;};}function patchUpdates(_0x536ee6){return function(_0x177a20){try{jsonpatch[_0x55de('0x21')](_0x177a20,_0x536ee6,!![]);}catch(_0x55fad1){return BPromise[_0x55de('0x22')](_0x55fad1);}return _0x177a20[_0x55de('0x23')]();};}function saveUpdates(_0x13dfb1,_0x35711d){return function(_0x3f79ae){if(_0x3f79ae){return _0x3f79ae[_0x55de('0x24')](_0x13dfb1)[_0x55de('0x25')](function(_0x78189b){return _0x78189b;});}return null;};}function removeEntity(_0x2da065,_0x146526){return function(_0x2b3b38){if(_0x2b3b38){return _0x2b3b38[_0x55de('0x26')]()[_0x55de('0x25')](function(){_0x2da065['status'](0xcc)[_0x55de('0x27')]();});}};}function handleEntityNotFound(_0x54372f,_0x5b55c7){return function(_0x3ba0bc){if(!_0x3ba0bc){_0x54372f[_0x55de('0x18')](0x194);}return _0x3ba0bc;};}function handleError(_0x341f61,_0x13df0f){_0x13df0f=_0x13df0f||0x1f4;return function(_0x55eb1d){logger[_0x55de('0x28')](_0x55eb1d[_0x55de('0x29')]);if(_0x55eb1d[_0x55de('0x2a')]){delete _0x55eb1d[_0x55de('0x2a')];}_0x341f61[_0x55de('0x19')](_0x13df0f)[_0x55de('0x2b')](_0x55eb1d);};}exports[_0x55de('0x2c')]=function(_0xf4ab91,_0x1ab25c){var _0x186a15={},_0x5b4af5={},_0x2d8334={'count':0x0,'rows':[]};var _0x2fec69=_[_0x55de('0x2d')](db[_0x55de('0x2e')][_0x55de('0x2f')],function(_0xe949d1){return{'name':_0xe949d1[_0x55de('0x30')],'type':_0xe949d1[_0x55de('0x31')][_0x55de('0x32')]};});_0x5b4af5[_0x55de('0x33')]=_[_0x55de('0x2d')](_0x2fec69,'name');_0x5b4af5['query']=_['keys'](_0xf4ab91[_0x55de('0x34')]);_0x5b4af5[_0x55de('0x35')]=_[_0x55de('0x36')](_0x5b4af5[_0x55de('0x33')],_0x5b4af5['query']);_0x186a15[_0x55de('0x37')]=_['intersection'](_0x5b4af5['model'],qs[_0x55de('0x38')](_0xf4ab91[_0x55de('0x34')][_0x55de('0x38')]));_0x186a15[_0x55de('0x37')]=_0x186a15[_0x55de('0x37')][_0x55de('0x39')]?_0x186a15['attributes']:_0x5b4af5[_0x55de('0x33')];if(!_0xf4ab91[_0x55de('0x34')][_0x55de('0x3a')](_0x55de('0x3b'))){_0x186a15[_0x55de('0x1c')]=qs[_0x55de('0x1c')](_0xf4ab91[_0x55de('0x34')][_0x55de('0x1c')]);_0x186a15['offset']=qs['offset'](_0xf4ab91['query'][_0x55de('0x1a')]);}_0x186a15[_0x55de('0x3c')]=qs[_0x55de('0x3d')](_0xf4ab91[_0x55de('0x34')]['sort']);_0x186a15[_0x55de('0x3e')]=qs[_0x55de('0x35')](_[_0x55de('0x3f')](_0xf4ab91[_0x55de('0x34')],_0x5b4af5[_0x55de('0x35')]),_0x2fec69);if(_0xf4ab91['query']['filter']){_0x186a15['where']=_[_0x55de('0x40')](_0x186a15[_0x55de('0x3e')],{'$or':_[_0x55de('0x2d')](_0x2fec69,function(_0x3fa160){if(_0x3fa160[_0x55de('0x31')]!==_0x55de('0x41')){var _0x3d3d81={};_0x3d3d81[_0x3fa160[_0x55de('0x2a')]]={'$like':'%'+_0xf4ab91['query'][_0x55de('0x42')]+'%'};return _0x3d3d81;}})});}_0x186a15=_[_0x55de('0x40')]({},_0x186a15,_0xf4ab91['options']);var _0xc4fb29={'where':_0x186a15[_0x55de('0x3e')]};return db[_0x55de('0x2e')]['count'](_0xc4fb29)[_0x55de('0x25')](function(_0x368c03){_0x2d8334['count']=_0x368c03;if(_0xf4ab91[_0x55de('0x34')][_0x55de('0x43')]){_0x186a15[_0x55de('0x44')]=[{'all':!![]}];}return db[_0x55de('0x2e')][_0x55de('0x45')](_0x186a15);})[_0x55de('0x25')](function(_0x50dcda){_0x2d8334['rows']=_0x50dcda;return _0x2d8334;})[_0x55de('0x25')](respondWithFilteredResult(_0x1ab25c,_0x186a15))[_0x55de('0x46')](handleError(_0x1ab25c,null));};exports['show']=function(_0x2da375,_0x385128){var _0x404062={'raw':!![],'where':{'id':_0x2da375[_0x55de('0x47')]['id']}},_0x12ee8c={};_0x12ee8c['model']=_[_0x55de('0x48')](db[_0x55de('0x2e')][_0x55de('0x2f')]);_0x12ee8c[_0x55de('0x34')]=_[_0x55de('0x48')](_0x2da375['query']);_0x12ee8c['filters']=_['intersection'](_0x12ee8c[_0x55de('0x33')],_0x12ee8c[_0x55de('0x34')]);_0x404062[_0x55de('0x37')]=_['intersection'](_0x12ee8c[_0x55de('0x33')],qs[_0x55de('0x38')](_0x2da375[_0x55de('0x34')][_0x55de('0x38')]));_0x404062[_0x55de('0x37')]=_0x404062[_0x55de('0x37')]['length']?_0x404062[_0x55de('0x37')]:_0x12ee8c[_0x55de('0x33')];if(_0x2da375[_0x55de('0x34')][_0x55de('0x43')]){_0x404062[_0x55de('0x44')]=[{'all':!![]}];}_0x404062=_[_0x55de('0x40')]({},_0x404062,_0x2da375[_0x55de('0x49')]);return db[_0x55de('0x2e')][_0x55de('0x4a')](_0x404062)['then'](handleEntityNotFound(_0x385128,null))[_0x55de('0x25')](respondWithResult(_0x385128,null))['catch'](handleError(_0x385128,null));};exports[_0x55de('0x4b')]=function(_0x1a19d7,_0x231029){return db[_0x55de('0x2e')][_0x55de('0x4b')](_0x1a19d7[_0x55de('0x4c')],{})['then'](respondWithResult(_0x231029,0xc9))[_0x55de('0x46')](handleError(_0x231029,null));};exports[_0x55de('0x24')]=function(_0x21e60e,_0x27b1ad){if(_0x21e60e['body']['id']){delete _0x21e60e[_0x55de('0x4c')]['id'];}return db[_0x55de('0x2e')][_0x55de('0x4a')]({'where':{'id':_0x21e60e[_0x55de('0x47')]['id']}})[_0x55de('0x25')](handleEntityNotFound(_0x27b1ad,null))[_0x55de('0x25')](saveUpdates(_0x21e60e[_0x55de('0x4c')],null))[_0x55de('0x25')](respondWithResult(_0x27b1ad,null))[_0x55de('0x46')](handleError(_0x27b1ad,null));};exports['destroy']=function(_0x415466,_0x42f4b9){return db[_0x55de('0x2e')][_0x55de('0x4a')]({'where':{'id':_0x415466[_0x55de('0x47')]['id']}})['then'](handleEntityNotFound(_0x42f4b9,null))['then'](removeEntity(_0x42f4b9,null))[_0x55de('0x46')](handleError(_0x42f4b9,null));};exports[_0x55de('0x4d')]=function(_0x19ba0f,_0xde0ae2){return db[_0x55de('0x2e')][_0x55de('0x4d')]()[_0x55de('0x25')](respondWithResult(_0xde0ae2,null))[_0x55de('0x46')](handleError(_0xde0ae2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9c8f8c0..3d034a2 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 _0x5c0f=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport'];(function(_0x2a33e1,_0x43ef5d){var _0x5f3860=function(_0x2f3eae){while(--_0x2f3eae){_0x2a33e1['push'](_0x2a33e1['shift']());}};_0x5f3860(++_0x43ef5d);}(_0x5c0f,0x108));var _0xf5c0=function(_0x10530b,_0x305795){_0x10530b=_0x10530b-0x0;var _0x37ccf7=_0x5c0f[_0x10530b];return _0x37ccf7;};'use strict';var _=require(_0xf5c0('0x0'));var util=require(_0xf5c0('0x1'));var logger=require('../../config/logger')(_0xf5c0('0x2'));var moment=require(_0xf5c0('0x3'));var BPromise=require(_0xf5c0('0x4'));var rp=require(_0xf5c0('0x5'));var fs=require('fs');var path=require(_0xf5c0('0x6'));var rimraf=require('rimraf');var config=require(_0xf5c0('0x7'));var attributes=require(_0xf5c0('0x8'));module['exports']=function(_0x466a5c,_0x3887bf){return _0x466a5c[_0xf5c0('0x9')](_0xf5c0('0xa'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3130=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x24af3e,_0x33622f){var _0x1f775d=function(_0x4e00b8){while(--_0x4e00b8){_0x24af3e['push'](_0x24af3e['shift']());}};_0x1f775d(++_0x33622f);}(_0x3130,0x1ee));var _0x0313=function(_0x2734e7,_0x51bf0d){_0x2734e7=_0x2734e7-0x0;var _0x253864=_0x3130[_0x2734e7];return _0x253864;};'use strict';var _=require('lodash');var util=require(_0x0313('0x0'));var logger=require(_0x0313('0x1'))(_0x0313('0x2'));var moment=require(_0x0313('0x3'));var BPromise=require(_0x0313('0x4'));var rp=require(_0x0313('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0313('0x6'));var config=require(_0x0313('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x0313('0x8')]=function(_0x5b539d,_0x3d2843){return _0x5b539d[_0x0313('0x9')](_0x0313('0xa'),attributes,{'tableName':_0x0313('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index c4efe77..4f550a2 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 _0xd1b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','VoiceTransferReport,\x20%s,\x20%s','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','randomstring'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd1b9,0x1b7));var _0x9d1b=function(_0x183b97,_0x2d297c){_0x183b97=_0x183b97-0x0;var _0x629cf7=_0xd1b9[_0x183b97];return _0x629cf7;};'use strict';var _=require(_0x9d1b('0x0'));var util=require(_0x9d1b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9d1b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d1b('0x3'))['db'];var utils=require(_0x9d1b('0x4'));var logger=require(_0x9d1b('0x5'))(_0x9d1b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d1b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4769af,_0xe1fd0a,_0x3b5969){return new BPromise(function(_0x2176f6,_0x5c2b25){return client[_0x9d1b('0x8')](_0x4769af,_0x3b5969)['then'](function(_0x490cea){logger[_0x9d1b('0x9')]('VoiceTransferReport,\x20%s,\x20%s',_0xe1fd0a,'request\x20sent');logger[_0x9d1b('0xa')](_0x9d1b('0xb'),_0xe1fd0a,_0x9d1b('0xc'),JSON[_0x9d1b('0xd')](_0x490cea));if(_0x490cea[_0x9d1b('0xe')]){if(_0x490cea[_0x9d1b('0xe')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xe1fd0a,_0x490cea[_0x9d1b('0xe')][_0x9d1b('0xf')]);return _0x5c2b25(_0x490cea[_0x9d1b('0xe')][_0x9d1b('0xf')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xe1fd0a,_0x490cea['error'][_0x9d1b('0xf')]);return _0x2176f6(_0x490cea[_0x9d1b('0xe')]['message']);}else{logger['info'](_0x9d1b('0x10'),_0xe1fd0a,_0x9d1b('0xc'));_0x2176f6(_0x490cea[_0x9d1b('0x11')][_0x9d1b('0xf')]);}})[_0x9d1b('0x12')](function(_0x5564ac){logger[_0x9d1b('0xe')](_0x9d1b('0x10'),_0xe1fd0a,_0x5564ac);_0x5c2b25(_0x5564ac);});});}exports[_0x9d1b('0x13')]=function(_0x593aac){var _0x844d80=this;return new Promise(function(_0x273660,_0x21648e){return db[_0x9d1b('0x14')][_0x9d1b('0x15')](_0x593aac[_0x9d1b('0x16')],{'raw':_0x593aac[_0x9d1b('0x17')]?_0x593aac[_0x9d1b('0x17')][_0x9d1b('0x18')]===undefined?!![]:![]:!![]})[_0x9d1b('0x19')](function(_0x49ab0b){logger['info']('CreateVoiceTransferReport',_0x593aac);logger[_0x9d1b('0xa')](_0x9d1b('0x13'),_0x593aac,JSON['stringify'](_0x49ab0b));_0x273660(_0x49ab0b);})[_0x9d1b('0x12')](function(_0x5d3526){logger[_0x9d1b('0xe')](_0x9d1b('0x13'),_0x5d3526[_0x9d1b('0xf')],_0x593aac);_0x21648e(_0x844d80[_0x9d1b('0xe')](0x1f4,_0x5d3526[_0x9d1b('0xf')]));});});}; \ No newline at end of file +var _0x8bb1=['create','body','options','raw','debug','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceTransferReport'];(function(_0x42730e,_0x624c6a){var _0x1472e3=function(_0x71b562){while(--_0x71b562){_0x42730e['push'](_0x42730e['shift']());}};_0x1472e3(++_0x624c6a);}(_0x8bb1,0x1b6));var _0x18bb=function(_0x3b407e,_0xb256f4){_0x3b407e=_0x3b407e-0x0;var _0xcbba9f=_0x8bb1[_0x3b407e];return _0xcbba9f;};'use strict';var _=require(_0x18bb('0x0'));var util=require(_0x18bb('0x1'));var moment=require(_0x18bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x18bb('0x3'));var fs=require('fs');var Redis=require(_0x18bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18bb('0x5'));var logger=require('../../config/logger')(_0x18bb('0x6'));var config=require('../../config/environment');var jayson=require(_0x18bb('0x7'));var client=jayson[_0x18bb('0x8')][_0x18bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f65e2,_0xf49083,_0x2788b6){return new BPromise(function(_0x18ce76,_0x1a5970){return client[_0x18bb('0xa')](_0x4f65e2,_0x2788b6)[_0x18bb('0xb')](function(_0xdc4eeb){logger[_0x18bb('0xc')](_0x18bb('0xd'),_0xf49083,_0x18bb('0xe'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xf49083,_0x18bb('0xe'),JSON['stringify'](_0xdc4eeb));if(_0xdc4eeb[_0x18bb('0xf')]){if(_0xdc4eeb['error'][_0x18bb('0x10')]===0x1f4){logger[_0x18bb('0xf')](_0x18bb('0xd'),_0xf49083,_0xdc4eeb[_0x18bb('0xf')]['message']);return _0x1a5970(_0xdc4eeb[_0x18bb('0xf')][_0x18bb('0x11')]);}logger[_0x18bb('0xf')](_0x18bb('0xd'),_0xf49083,_0xdc4eeb[_0x18bb('0xf')][_0x18bb('0x11')]);return _0x18ce76(_0xdc4eeb['error'][_0x18bb('0x11')]);}else{logger[_0x18bb('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xf49083,'request\x20sent');_0x18ce76(_0xdc4eeb[_0x18bb('0x12')][_0x18bb('0x11')]);}})[_0x18bb('0x13')](function(_0x1e9f2c){logger[_0x18bb('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xf49083,_0x1e9f2c);_0x1a5970(_0x1e9f2c);});});}exports[_0x18bb('0x14')]=function(_0x327ee5){var _0x5153f9=this;return new Promise(function(_0x2db5e0,_0x47e6e4){return db['VoiceTransferReport'][_0x18bb('0x15')](_0x327ee5[_0x18bb('0x16')],{'raw':_0x327ee5[_0x18bb('0x17')]?_0x327ee5[_0x18bb('0x17')][_0x18bb('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4cde16){logger[_0x18bb('0xc')](_0x18bb('0x14'),_0x327ee5);logger[_0x18bb('0x19')](_0x18bb('0x14'),_0x327ee5,JSON[_0x18bb('0x1a')](_0x4cde16));_0x2db5e0(_0x4cde16);})[_0x18bb('0x13')](function(_0x1c6d2e){logger['error'](_0x18bb('0x14'),_0x1c6d2e[_0x18bb('0x11')],_0x327ee5);_0x47e6e4(_0x5153f9[_0x18bb('0xf')](0x1f4,_0x1c6d2e[_0x18bb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 7977a04..c250e77 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x3f8f8d,_0x240792){var _0x1b117b=function(_0x244fce){while(--_0x244fce){_0x3f8f8d['push'](_0x3f8f8d['shift']());}};_0x1b117b(++_0x240792);}(_0xf109,0xce));var _0x9f10=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0xf109[_0x28aea5];return _0x6a55f9;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);module['exports']=router; \ No newline at end of file +var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x1c6f8,_0x18af22){var _0xc47f94=function(_0x280668){while(--_0x280668){_0x1c6f8['push'](_0x1c6f8['shift']());}};_0xc47f94(++_0x18af22);}(_0x91a7,0xe7));var _0x791a=function(_0x2b4d26,_0x279b45){_0x2b4d26=_0x2b4d26-0x0;var _0x1b5a40=_0x91a7[_0x2b4d26];return _0x1b5a40;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index aea636c..d758896 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 _0xac55=['stack','name','status','send','NotFound','request','then','error','message','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','json','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','format','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:'];(function(_0x53c75c,_0x415c22){var _0x1f709f=function(_0x4fd8df){while(--_0x4fd8df){_0x53c75c['push'](_0x53c75c['shift']());}};_0x1f709f(++_0x415c22);}(_0xac55,0x1c8));var _0x5ac5=function(_0x55cb04,_0x2c95d6){_0x55cb04=_0x55cb04-0x0;var _0x369784=_0xac55[_0x55cb04];return _0x369784;};'use strict';var path=require(_0x5ac5('0x0'));var fs=require('fs');var _=require(_0x5ac5('0x1'));var db=require(_0x5ac5('0x2'))['db'];var config=require(_0x5ac5('0x3'));var util=require('util');var BPromise=require(_0x5ac5('0x4'));var jayson=require(_0x5ac5('0x5'));var amiClient=jayson[_0x5ac5('0x6')][_0x5ac5('0x7')]({'port':0x232a});var logger=require(_0x5ac5('0x8'))(_0x5ac5('0x9'));var Redis=require(_0x5ac5('0xa'));config['redis']=_['defaults'](config[_0x5ac5('0xb')],{'host':_0x5ac5('0xc'),'port':0x18eb});var io=require(_0x5ac5('0xd'))(new Redis(config[_0x5ac5('0xb')]));var Schema=require(_0x5ac5('0xe'));var originateValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'callNumber':{'type':'string','required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x5ac5('0x11')},'callbackUrl':{'type':_0x5ac5('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x12')]},'transferNumber':{'type':_0x5ac5('0x11'),'required':[!![],_0x5ac5('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x5ac5('0xf'),'required':[!![],_0x5ac5('0x10')]}});function emit(_0x30244d,_0x1282be,_0x34a95e){logger[_0x5ac5('0x14')](_0x30244d,_0x1282be,JSON[_0x5ac5('0x15')](_0x34a95e));io['to'](_0x30244d)['emit'](_0x1282be,_0x34a95e);}function handleError(_0x4e186a){return function(_0x5364a6){console[_0x5ac5('0x16')](_0x5ac5('0x17'),_0x5364a6,_0x5364a6 instanceof RangeError);logger['error'](_0x5364a6[_0x5ac5('0x18')]);if(_0x5364a6 instanceof RangeError){if(_0x5364a6['name']){delete _0x5364a6[_0x5ac5('0x19')];}_0x4e186a['status'](0x194)['send'](_0x5364a6);}else{if(_0x5364a6[_0x5ac5('0x19')]){delete _0x5364a6['name'];}_0x4e186a[_0x5ac5('0x1a')](0x1f4)[_0x5ac5('0x1b')](_0x5364a6);}};}function checkError(){return function(_0x5c21d8){if(!_0x5c21d8){throw new RangeError(_0x5ac5('0x1c'));}return _0x5c21d8;};}function respondWithRpcPromise(_0x4ac526,_0x29a44c){return new BPromise(function(_0x40bdbc,_0x47993e){var _0x47a898=amiClient;return _0x47a898[_0x5ac5('0x1d')](_0x4ac526,_0x29a44c)[_0x5ac5('0x1e')](function(_0x400308){if(_0x400308[_0x5ac5('0x1f')]){if(_0x400308[_0x5ac5('0x1f')]['code']===0x1f4){return _0x47993e(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}return _0x40bdbc(_0x400308[_0x5ac5('0x1f')][_0x5ac5('0x20')]);}else{_0x40bdbc(_0x400308['result']);}})[_0x5ac5('0x21')](function(_0x4eda97){_0x47993e(_0x4eda97);});});}function getAgent(_0x17c507){return db[_0x5ac5('0x22')][_0x5ac5('0x23')]({'where':{'id':_0x17c507,'role':_0x5ac5('0x24')}})[_0x5ac5('0x1e')](checkError());}function getAgentCheckSession(_0x3b3ec0,_0x5ce67c){return new BPromise(function(_0x31f9cc,_0x4a5f4d){var _0x24e8c7=respondWithRpcPromise(_0x5ac5('0x25'));var _0x35535f=getAgent(_0x3b3ec0);Promise['all']([_0x24e8c7,_0x35535f])[_0x5ac5('0x1e')](function(_0x229941){var _0x21df31=_0x229941[0x0];var _0x21307c=_0x229941[0x1];var _0x4eafa1=_[_0x5ac5('0x26')](_0x21df31['rows'],function(_0x3414ba){return _0x3414ba[_0x5ac5('0x27')]==_0x21307c['id']&&_0x3414ba[_0x5ac5('0x28')]==_0x5ce67c;});if(_0x4eafa1[_0x5ac5('0x29')]==0x1){_0x31f9cc(_0x21307c);}else{_0x4a5f4d(new RangeError(_0x5ac5('0x2a')+_0x5ce67c+'\x20not\x20found!'));}});});}exports[_0x5ac5('0x2b')]=function(_0x21116,_0x36285d){logger['info'](_0x5ac5('0x2c'),_0x21116['body']);var _0x472782=originateValidation[_0x5ac5('0xe')](_0x21116[_0x5ac5('0x2d')]);if(_0x472782[_0x5ac5('0x29')]>0x0){return _0x36285d[_0x5ac5('0x1a')](0x190)['json'](_0x472782);}var _0x39a895=_0x21116['body'][_0x5ac5('0x2e')];var _0x5ae4af=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x2f')];var _0x47a5d8=_0x21116[_0x5ac5('0x2d')][_0x5ac5('0x30')];var _0x585e4b=_0x21116['body'][_0x5ac5('0x31')];return getAgent(_0x39a895)[_0x5ac5('0x1e')](function(_0x243204){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x243204[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x243204['name']),_0x5ac5('0x33'),{'callNumber':_0x5ae4af,'callerId':_0x47a5d8,'callbackUrl':_0x585e4b});return _0x36285d[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x34')});})[_0x5ac5('0x21')](handleError(_0x36285d));};exports[_0x5ac5('0x35')]=function(_0x38667d,_0x46290f){logger[_0x5ac5('0x14')](_0x5ac5('0x36'),_0x38667d[_0x5ac5('0x2d')]);var _0x2d726e=hangupValidation['validate'](_0x38667d[_0x5ac5('0x2d')]);if(_0x2d726e['length']>0x0){return _0x46290f[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x2d726e);}var _0x1ca0f0=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x1ec79a=_0x38667d[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x1ca0f0)[_0x5ac5('0x1e')](function(_0x5105fc){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x5105fc['name']);emit(util['format'](_0x5ac5('0x38'),_0x5105fc['name']),_0x5ac5('0x39'),{'sessionId':_0x1ec79a});return _0x46290f[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x5ac5('0x21')](handleError(_0x46290f));};exports[_0x5ac5('0x3a')]=function(_0x32cc92,_0x1475b0){logger[_0x5ac5('0x14')](_0x5ac5('0x3b'),_0x32cc92[_0x5ac5('0x2d')]);var _0x5a86a0=answerValidation[_0x5ac5('0xe')](_0x32cc92[_0x5ac5('0x2d')]);if(_0x5a86a0[_0x5ac5('0x29')]>0x0){return _0x1475b0[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x5a86a0);}var _0x3abf39=_0x32cc92['body'][_0x5ac5('0x2e')];var _0x24657d=_0x32cc92[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0x3abf39)['then'](function(_0x228179){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x228179['name']);emit(util['format'](_0x5ac5('0x38'),_0x228179[_0x5ac5('0x19')]),_0x5ac5('0x3c'),{'sessionId':_0x24657d});return _0x1475b0[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x3d')});})['catch'](handleError(_0x1475b0));};exports[_0x5ac5('0x3e')]=function(_0x3dfeba,_0x4d90cf){logger[_0x5ac5('0x14')]('hold\x20fired:',_0x3dfeba[_0x5ac5('0x2d')]);var _0x3f26e0=holdValidation[_0x5ac5('0xe')](_0x3dfeba['body']);if(_0x3f26e0['length']>0x0){return _0x4d90cf[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x3f26e0);}var _0xd6ae55=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x3534ce=_0x3dfeba[_0x5ac5('0x2d')][_0x5ac5('0x28')];return getAgent(_0xd6ae55)[_0x5ac5('0x1e')](function(_0x536765){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x536765[_0x5ac5('0x19')]);emit(util['format']('user:%s',_0x536765[_0x5ac5('0x19')]),_0x5ac5('0x3f'),{'sessionId':_0x3534ce});return _0x4d90cf[_0x5ac5('0x1a')](0xc8)['json']({'error':![],'message':_0x5ac5('0x40')});})[_0x5ac5('0x21')](handleError(_0x4d90cf));};exports[_0x5ac5('0x41')]=function(_0x2a3396,_0x326f60){logger[_0x5ac5('0x14')](_0x5ac5('0x42'),_0x2a3396['body']);var _0x5ac4e3=unholdValidation['validate'](_0x2a3396[_0x5ac5('0x2d')]);if(_0x5ac4e3[_0x5ac5('0x29')]>0x0){return _0x326f60[_0x5ac5('0x1a')](0x190)['json'](_0x5ac4e3);}var _0x1973f6=_0x2a3396[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x286304=_0x2a3396[_0x5ac5('0x2d')]['sessionId'];return getAgent(_0x1973f6)['then'](function(_0x516ffd){logger[_0x5ac5('0x14')](_0x5ac5('0x32'),_0x516ffd[_0x5ac5('0x19')]);emit(util[_0x5ac5('0x43')](_0x5ac5('0x38'),_0x516ffd[_0x5ac5('0x19')]),_0x5ac5('0x44'),{'sessionId':_0x286304});return _0x326f60[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x45')});})[_0x5ac5('0x21')](handleError(_0x326f60));};exports[_0x5ac5('0x46')]=function(_0x447603,_0x252030){logger[_0x5ac5('0x14')]('calls\x20fired:',_0x252030[_0x5ac5('0x2d')]);var _0x360fb8=callsValidation['validate'](_0x447603[_0x5ac5('0x2d')]);if(_0x360fb8[_0x5ac5('0x29')]>0x0){return _0x252030[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x360fb8);}var _0x316af1=_0x447603[_0x5ac5('0x2d')]['userId'];var _0x2b5329=respondWithRpcPromise(_0x5ac5('0x25'));var _0x424bed=getAgent(_0x316af1);return Promise['all']([_0x2b5329,_0x424bed])[_0x5ac5('0x1e')](function(_0x44e349){var _0x4dd8be=_0x44e349[0x0];var _0x1a6428=_0x44e349[0x1];var _0x3227dc=_['filter'](_0x4dd8be['rows'],function(_0x4d1346){return _0x4d1346[_0x5ac5('0x27')]==_0x1a6428['id'];});return _0x252030[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'count':_0x3227dc[_0x5ac5('0x29')],'rows':_0x3227dc});})[_0x5ac5('0x21')](handleError(_0x252030));};exports[_0x5ac5('0x47')]=function(_0x4ee231,_0x75ca64){logger[_0x5ac5('0x14')](_0x5ac5('0x48'),_0x4ee231[_0x5ac5('0x2d')]);var _0x1f9b9b=conferenceValidation['validate'](_0x4ee231['body']);if(_0x1f9b9b['length']>0x0){return _0x75ca64[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x1f9b9b);}var _0x334a1c=_0x4ee231[_0x5ac5('0x2d')]['userId'];return getAgent(_0x334a1c)[_0x5ac5('0x1e')](function(_0x38b128){logger[_0x5ac5('0x14')]('entityFound:',_0x38b128['name']);emit(util['format'](_0x5ac5('0x38'),_0x38b128[_0x5ac5('0x19')]),_0x5ac5('0x49'));return _0x75ca64[_0x5ac5('0x1a')](0xc8)[_0x5ac5('0x37')]({'error':![],'message':_0x5ac5('0x4a')});})['catch'](handleError(_0x75ca64));};exports[_0x5ac5('0x4b')]=function(_0x5532d6,_0x492179){logger[_0x5ac5('0x14')](_0x5ac5('0x4c'),_0x5532d6[_0x5ac5('0x2d')]);var _0x324ec9=transferValidation[_0x5ac5('0xe')](_0x5532d6[_0x5ac5('0x2d')]);if(_0x324ec9[_0x5ac5('0x29')]>0x0){return _0x492179[_0x5ac5('0x1a')](0x190)[_0x5ac5('0x37')](_0x324ec9);}var _0x130c67=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x2e')];var _0x299b02=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x28')];var _0x46315b=_0x5532d6[_0x5ac5('0x2d')][_0x5ac5('0x4d')];return getAgent(_0x130c67)[_0x5ac5('0x1e')](function(_0xc95ae5){logger[_0x5ac5('0x14')]('entityFound:',_0xc95ae5[_0x5ac5('0x19')]);emit(util['format'](_0x5ac5('0x38'),_0xc95ae5['name']),_0x5ac5('0x4e'),{'sessionId':_0x299b02,'transferNumber':_0x46315b});return _0x492179['status'](0xc8)['json']({'error':![],'message':_0x5ac5('0x4f')});})['catch'](handleError(_0x492179));}; \ No newline at end of file +var _0x0a9a=['hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','send','NotFound','request','then','code','message','result','User','findOne','VoiceChannels','all','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','body','length','status','json','userId','callNumber','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','webbar:hangup','answer','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:'];(function(_0x4d9988,_0x457f30){var _0x32bf83=function(_0x3c53cc){while(--_0x3c53cc){_0x4d9988['push'](_0x4d9988['shift']());}};_0x32bf83(++_0x457f30);}(_0x0a9a,0x183));var _0xa0a9=function(_0x5daae7,_0x7edb4e){_0x5daae7=_0x5daae7-0x0;var _0x5ad5dd=_0x0a9a[_0x5daae7];return _0x5ad5dd;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xa0a9('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xa0a9('0x1'));var util=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var jayson=require(_0xa0a9('0x4'));var amiClient=jayson['client'][_0xa0a9('0x5')]({'port':0x232a});var logger=require(_0xa0a9('0x6'))('webbarapi');var Redis=require(_0xa0a9('0x7'));config[_0xa0a9('0x8')]=_[_0xa0a9('0x9')](config[_0xa0a9('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa0a9('0xa'))(new Redis(config['redis']));var Schema=require(_0xa0a9('0xb'));var originateValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'callNumber':{'type':_0xa0a9('0xe'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0xa0a9('0xe')},'callbackUrl':{'type':_0xa0a9('0xe')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':[!![],_0xa0a9('0xf')]},'transferNumber':{'type':_0xa0a9('0xe'),'required':[!![],_0xa0a9('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]},'sessionId':{'type':_0xa0a9('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],_0xa0a9('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0xa0a9('0xc'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x176faa,_0x48c315,_0x4a57dd){logger[_0xa0a9('0x11')](_0x176faa,_0x48c315,JSON[_0xa0a9('0x12')](_0x4a57dd));io['to'](_0x176faa)[_0xa0a9('0x13')](_0x48c315,_0x4a57dd);}function handleError(_0x16c3e3){return function(_0x568409){console[_0xa0a9('0x14')](_0xa0a9('0x15'),_0x568409,_0x568409 instanceof RangeError);logger[_0xa0a9('0x16')](_0x568409[_0xa0a9('0x17')]);if(_0x568409 instanceof RangeError){if(_0x568409[_0xa0a9('0x18')]){delete _0x568409[_0xa0a9('0x18')];}_0x16c3e3['status'](0x194)[_0xa0a9('0x19')](_0x568409);}else{if(_0x568409[_0xa0a9('0x18')]){delete _0x568409['name'];}_0x16c3e3['status'](0x1f4)[_0xa0a9('0x19')](_0x568409);}};}function checkError(){return function(_0x1f6955){if(!_0x1f6955){throw new RangeError(_0xa0a9('0x1a'));}return _0x1f6955;};}function respondWithRpcPromise(_0x54a9a9,_0x307d7e){return new BPromise(function(_0x4e6f4c,_0x1fb36b){var _0x5e6148=amiClient;return _0x5e6148[_0xa0a9('0x1b')](_0x54a9a9,_0x307d7e)[_0xa0a9('0x1c')](function(_0x2f0b14){if(_0x2f0b14[_0xa0a9('0x16')]){if(_0x2f0b14['error'][_0xa0a9('0x1d')]===0x1f4){return _0x1fb36b(_0x2f0b14['error'][_0xa0a9('0x1e')]);}return _0x4e6f4c(_0x2f0b14[_0xa0a9('0x16')][_0xa0a9('0x1e')]);}else{_0x4e6f4c(_0x2f0b14[_0xa0a9('0x1f')]);}})['catch'](function(_0x7c1502){_0x1fb36b(_0x7c1502);});});}function getAgent(_0xe49d3b){return db[_0xa0a9('0x20')][_0xa0a9('0x21')]({'where':{'id':_0xe49d3b,'role':'agent'}})[_0xa0a9('0x1c')](checkError());}function getAgentCheckSession(_0x38e454,_0x2eae30){return new BPromise(function(_0x5c446e,_0x54125d){var _0x2b3cbb=respondWithRpcPromise(_0xa0a9('0x22'));var _0x10bbfd=getAgent(_0x38e454);Promise[_0xa0a9('0x23')]([_0x2b3cbb,_0x10bbfd])[_0xa0a9('0x1c')](function(_0xe218ff){var _0x2386c9=_0xe218ff[0x0];var _0x24e744=_0xe218ff[0x1];var _0xc6a4=_[_0xa0a9('0x24')](_0x2386c9[_0xa0a9('0x25')],function(_0x554191){return _0x554191[_0xa0a9('0x26')]==_0x24e744['id']&&_0x554191[_0xa0a9('0x27')]==_0x2eae30;});if(_0xc6a4['length']==0x1){_0x5c446e(_0x24e744);}else{_0x54125d(new RangeError(_0xa0a9('0x28')+_0x2eae30+_0xa0a9('0x29')));}});});}exports['originate']=function(_0x47c19b,_0x45374e){logger['info']('originate\x20fired:',_0x47c19b[_0xa0a9('0x2a')]);var _0x104936=originateValidation[_0xa0a9('0xb')](_0x47c19b[_0xa0a9('0x2a')]);if(_0x104936[_0xa0a9('0x2b')]>0x0){return _0x45374e[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x104936);}var _0x4bbcc2=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x539807=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x2f')];var _0x2363e6=_0x47c19b['body']['callerId'];var _0x3b1a11=_0x47c19b[_0xa0a9('0x2a')][_0xa0a9('0x30')];return getAgent(_0x4bbcc2)[_0xa0a9('0x1c')](function(_0x520817){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x520817[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x520817[_0xa0a9('0x18')]),_0xa0a9('0x33'),{'callNumber':_0x539807,'callerId':_0x2363e6,'callbackUrl':_0x3b1a11});return _0x45374e['status'](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x34')});})[_0xa0a9('0x35')](handleError(_0x45374e));};exports[_0xa0a9('0x36')]=function(_0x2e11dc,_0x1d6bae){logger[_0xa0a9('0x11')](_0xa0a9('0x37'),_0x2e11dc[_0xa0a9('0x2a')]);var _0x2ea301=hangupValidation[_0xa0a9('0xb')](_0x2e11dc[_0xa0a9('0x2a')]);if(_0x2ea301[_0xa0a9('0x2b')]>0x0){return _0x1d6bae[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x2ea301);}var _0x1b1aff=_0x2e11dc[_0xa0a9('0x2a')]['userId'];var _0x3f1e4f=_0x2e11dc[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1b1aff)['then'](function(_0x757e10){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x757e10[_0xa0a9('0x18')]);emit(util['format'](_0xa0a9('0x32'),_0x757e10[_0xa0a9('0x18')]),_0xa0a9('0x38'),{'sessionId':_0x3f1e4f});return _0x1d6bae[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0xa0a9('0x35')](handleError(_0x1d6bae));};exports[_0xa0a9('0x39')]=function(_0x39c02a,_0x32d926){logger[_0xa0a9('0x11')]('answer\x20fired:',_0x39c02a[_0xa0a9('0x2a')]);var _0x11c130=answerValidation[_0xa0a9('0xb')](_0x39c02a[_0xa0a9('0x2a')]);if(_0x11c130[_0xa0a9('0x2b')]>0x0){return _0x32d926['status'](0x190)[_0xa0a9('0x2d')](_0x11c130);}var _0x1c8760=_0x39c02a['body']['userId'];var _0x41cd22=_0x39c02a[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x1c8760)[_0xa0a9('0x1c')](function(_0x4a128f){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x4a128f[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x4a128f[_0xa0a9('0x18')]),_0xa0a9('0x3b'),{'sessionId':_0x41cd22});return _0x32d926[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3c')});})[_0xa0a9('0x35')](handleError(_0x32d926));};exports[_0xa0a9('0x3d')]=function(_0x2fcc76,_0x3bb0fb){logger[_0xa0a9('0x11')](_0xa0a9('0x3e'),_0x2fcc76[_0xa0a9('0x2a')]);var _0x54e917=holdValidation[_0xa0a9('0xb')](_0x2fcc76['body']);if(_0x54e917[_0xa0a9('0x2b')]>0x0){return _0x3bb0fb[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x54e917);}var _0x132eca=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x38cb0d=_0x2fcc76[_0xa0a9('0x2a')][_0xa0a9('0x27')];return getAgent(_0x132eca)['then'](function(_0x5d4162){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5d4162['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5d4162[_0xa0a9('0x18')]),'webbar:hold',{'sessionId':_0x38cb0d});return _0x3bb0fb[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x3f')});})[_0xa0a9('0x35')](handleError(_0x3bb0fb));};exports['unhold']=function(_0x398501,_0x45db88){logger[_0xa0a9('0x11')](_0xa0a9('0x40'),_0x398501[_0xa0a9('0x2a')]);var _0x41128b=unholdValidation[_0xa0a9('0xb')](_0x398501['body']);if(_0x41128b[_0xa0a9('0x2b')]>0x0){return _0x45db88[_0xa0a9('0x2c')](0x190)['json'](_0x41128b);}var _0x2cbd5e=_0x398501[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x506168=_0x398501['body'][_0xa0a9('0x27')];return getAgent(_0x2cbd5e)[_0xa0a9('0x1c')](function(_0x3f67ac){logger[_0xa0a9('0x11')]('entityFound:',_0x3f67ac['name']);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x3f67ac['name']),'webbar:unhold',{'sessionId':_0x506168});return _0x45db88[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x41')});})[_0xa0a9('0x35')](handleError(_0x45db88));};exports[_0xa0a9('0x42')]=function(_0x361bf1,_0x24af09){logger[_0xa0a9('0x11')](_0xa0a9('0x43'),_0x24af09[_0xa0a9('0x2a')]);var _0x2da124=callsValidation['validate'](_0x361bf1[_0xa0a9('0x2a')]);if(_0x2da124[_0xa0a9('0x2b')]>0x0){return _0x24af09[_0xa0a9('0x2c')](0x190)['json'](_0x2da124);}var _0x426ddc=_0x361bf1[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x4a1912=respondWithRpcPromise(_0xa0a9('0x22'));var _0x18893f=getAgent(_0x426ddc);return Promise[_0xa0a9('0x23')]([_0x4a1912,_0x18893f])[_0xa0a9('0x1c')](function(_0x3d47b3){var _0x47107f=_0x3d47b3[0x0];var _0x12f97d=_0x3d47b3[0x1];var _0x577c1f=_[_0xa0a9('0x24')](_0x47107f[_0xa0a9('0x25')],function(_0x3f6ef4){return _0x3f6ef4[_0xa0a9('0x26')]==_0x12f97d['id'];});return _0x24af09[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'count':_0x577c1f[_0xa0a9('0x2b')],'rows':_0x577c1f});})['catch'](handleError(_0x24af09));};exports['conference']=function(_0x4a2307,_0x40d0f5){logger['info'](_0xa0a9('0x44'),_0x4a2307['body']);var _0x349f1b=conferenceValidation[_0xa0a9('0xb')](_0x4a2307[_0xa0a9('0x2a')]);if(_0x349f1b[_0xa0a9('0x2b')]>0x0){return _0x40d0f5[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x349f1b);}var _0x1c7191=_0x4a2307[_0xa0a9('0x2a')]['userId'];return getAgent(_0x1c7191)['then'](function(_0x471e1a){logger['info'](_0xa0a9('0x31'),_0x471e1a[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')]('user:%s',_0x471e1a[_0xa0a9('0x18')]),'webbar:conference');return _0x40d0f5[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x45')});})['catch'](handleError(_0x40d0f5));};exports[_0xa0a9('0x46')]=function(_0x478b4e,_0x2648e4){logger['info'](_0xa0a9('0x47'),_0x478b4e['body']);var _0x662a0=transferValidation[_0xa0a9('0xb')](_0x478b4e[_0xa0a9('0x2a')]);if(_0x662a0[_0xa0a9('0x2b')]>0x0){return _0x2648e4[_0xa0a9('0x2c')](0x190)[_0xa0a9('0x2d')](_0x662a0);}var _0x4cc06d=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x2e')];var _0x2e6d3f=_0x478b4e['body'][_0xa0a9('0x27')];var _0x184b0e=_0x478b4e[_0xa0a9('0x2a')][_0xa0a9('0x48')];return getAgent(_0x4cc06d)[_0xa0a9('0x1c')](function(_0x5581c7){logger[_0xa0a9('0x11')](_0xa0a9('0x31'),_0x5581c7[_0xa0a9('0x18')]);emit(util[_0xa0a9('0x3a')](_0xa0a9('0x32'),_0x5581c7[_0xa0a9('0x18')]),_0xa0a9('0x49'),{'sessionId':_0x2e6d3f,'transferNumber':_0x184b0e});return _0x2648e4[_0xa0a9('0x2c')](0xc8)[_0xa0a9('0x2d')]({'error':![],'message':_0xa0a9('0x4a')});})['catch'](handleError(_0x2648e4));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index a073964..56312fd 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 _0xba34=['getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions'];(function(_0x5846a0,_0x1ddf58){var _0x34d8af=function(_0x7ba74){while(--_0x7ba74){_0x5846a0['push'](_0x5846a0['shift']());}};_0x34d8af(++_0x1ddf58);}(_0xba34,0x119));var _0x4ba3=function(_0x14c5c5,_0x168f47){_0x14c5c5=_0x14c5c5-0x0;var _0x1fe27f=_0xba34[_0x14c5c5];return _0x1fe27f;};'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('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/canned_answers',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['get'](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x14')]);router[_0x4ba3('0x15')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x15')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x15')](_0x4ba3('0x18'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x15')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x15')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller['addApplications']);router[_0x4ba3('0x15')](_0x4ba3('0x1b'),controller[_0x4ba3('0x1c')]);router[_0x4ba3('0x15')](_0x4ba3('0x1d'),auth[_0x4ba3('0x9')](),controller['send']);router['put'](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1e')]);router[_0x4ba3('0x1f')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x20')]);router[_0x4ba3('0x1f')]('/:id/dispositions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router['delete'](_0x4ba3('0x18'),auth['isAuthenticated'](),controller[_0x4ba3('0x22')]);router[_0x4ba3('0x1f')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);module[_0x4ba3('0x24')]=router; \ No newline at end of file +var _0x7708=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','notify','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','../../components/interaction/service'];(function(_0x17edf9,_0x7f2c1f){var _0x38a53e=function(_0x2e8a3d){while(--_0x2e8a3d){_0x17edf9['push'](_0x17edf9['shift']());}};_0x38a53e(++_0x7f2c1f);}(_0x7708,0x188));var _0x8770=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x7708[_0x8e8ca7];return _0x561381;};'use strict';var multer=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var path=require('path');var timeout=require(_0x8770('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var controller=require('./whatsappAccount.controller');router[_0x8770('0x5')]('/',auth['isAuthenticated'](),controller[_0x8770('0x6')]);router[_0x8770('0x5')](_0x8770('0x7'),auth[_0x8770('0x8')](),controller[_0x8770('0x9')]);router[_0x8770('0x5')](_0x8770('0xa'),auth['isAuthenticated'](),controller[_0x8770('0xb')]);router[_0x8770('0x5')](_0x8770('0xc'),auth['isAuthenticated'](),controller[_0x8770('0xd')]);router[_0x8770('0x5')](_0x8770('0xe'),auth[_0x8770('0x8')](),controller['getAnswers']);router[_0x8770('0x5')](_0x8770('0xf'),auth[_0x8770('0x8')](),controller['getAgents']);router[_0x8770('0x5')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller[_0x8770('0x11')]);router[_0x8770('0x12')]('/',auth[_0x8770('0x8')](),controller[_0x8770('0x13')]);router[_0x8770('0x12')]('/:id/dispositions',auth[_0x8770('0x8')](),controller[_0x8770('0x14')]);router['post'](_0x8770('0xe'),auth['isAuthenticated'](),controller[_0x8770('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x8770('0x16')]);router[_0x8770('0x12')](_0x8770('0x10'),auth[_0x8770('0x8')](),controller['addApplications']);router['post'](_0x8770('0x17'),controller[_0x8770('0x18')]);router[_0x8770('0x12')](_0x8770('0x19'),auth[_0x8770('0x8')](),controller['send']);router[_0x8770('0x1a')](_0x8770('0xa'),auth[_0x8770('0x8')](),controller[_0x8770('0x1b')]);router['delete']('/:id',auth[_0x8770('0x8')](),controller[_0x8770('0x1c')]);router[_0x8770('0x1d')](_0x8770('0xc'),auth[_0x8770('0x8')](),controller[_0x8770('0x1e')]);router['delete'](_0x8770('0xe'),auth[_0x8770('0x8')](),controller[_0x8770('0x1f')]);router[_0x8770('0x1d')]('/:id/users',auth[_0x8770('0x8')](),controller['removeAgents']);module[_0x8770('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f70ffc8..3a07705 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 _0x417b=['sequelize','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0x417b,0x187));var _0xb417=function(_0x567725,_0x408cdf){_0x567725=_0x567725-0x0;var _0x360554=_0x417b[_0x567725];return _0x360554;};'use strict';var Sequelize=require(_0xb417('0x0'));var rs=require(_0xb417('0x1'));module[_0xb417('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xb417('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb417('0x4')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb417('0x5')]();}},'phone':{'type':Sequelize[_0xb417('0x4')]},'type':{'type':Sequelize[_0xb417('0x6')](_0xb417('0x7'),_0xb417('0x8'))},'accountSid':{'type':Sequelize[_0xb417('0x4')]},'baseUrl':{'type':Sequelize[_0xb417('0x4')]},'authToken':{'type':Sequelize[_0xb417('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb417('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb417('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb417('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb417('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb417('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb417('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb417('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb417('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xb417('0xa')],'defaultValue':![],'comment':_0xb417('0xd'),'set':function(_0x5a1fa0){if(!_0x5a1fa0){this[_0xb417('0xe')](_0xb417('0xf'),null);}this[_0xb417('0xe')](_0xb417('0x10'),_0x5a1fa0);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b22=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x1b22,0x9d));var _0x21b2=function(_0x3c02e0,_0x49fbc5){_0x3c02e0=_0x3c02e0-0x0;var _0x344759=_0x1b22[_0x3c02e0];return _0x344759;};'use strict';var Sequelize=require(_0x21b2('0x0'));var rs=require(_0x21b2('0x1'));module[_0x21b2('0x2')]={'name':{'type':Sequelize[_0x21b2('0x3')],'unique':_0x21b2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x21b2('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x21b2('0x3')],'defaultValue':function(){return rs[_0x21b2('0x5')]();}},'phone':{'type':Sequelize[_0x21b2('0x3')]},'type':{'type':Sequelize[_0x21b2('0x6')](_0x21b2('0x7'),_0x21b2('0x8'))},'accountSid':{'type':Sequelize[_0x21b2('0x3')]},'baseUrl':{'type':Sequelize[_0x21b2('0x3')]},'authToken':{'type':Sequelize[_0x21b2('0x3')]},'notificationTemplate':{'type':Sequelize[_0x21b2('0x9')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x21b2('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x21b2('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x21b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x21b2('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x21b2('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x21b2('0xb')],'comment':_0x21b2('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x21b2('0xa')],'defaultValue':![],'comment':_0x21b2('0xd'),'set':function(_0x5c6509){if(!_0x5c6509){this[_0x21b2('0xe')](_0x21b2('0xf'),null);}this[_0x21b2('0xe')](_0x21b2('0x10'),_0x5c6509);}},'description':{'type':Sequelize[_0x21b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c8e7be6..00e3b8c 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 _0x0440=['created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','then','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','UserProfileResource','destroy','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','name','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','WhatsappAccount','include','findAll','rows','show','includeAll','find','create','body','user','role','get','WhatsappAccounts','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','order','filter','options','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','sendStatus','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','timestamp','message_id','orderBy','asc','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','whatsapp:','Body','notifications','messageId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','defaults','WhatsappInteraction','spread','interaction','autoclose','applications','push','*,*,*,*'];(function(_0x4b37cc,_0x200d2d){var _0x3848f5=function(_0xb21ef6){while(--_0xb21ef6){_0x4b37cc['push'](_0x4b37cc['shift']());}};_0x3848f5(++_0x200d2d);}(_0x0440,0x186));var _0x0044=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x0440[_0x36f243];return _0x426436;};'use strict';var emlformat=require(_0x0044('0x0'));var rimraf=require(_0x0044('0x1'));var zipdir=require(_0x0044('0x2'));var jsonpatch=require(_0x0044('0x3'));var rp=require('request-promise');var moment=require(_0x0044('0x4'));var BPromise=require(_0x0044('0x5'));var Mustache=require(_0x0044('0x6'));var util=require(_0x0044('0x7'));var path=require(_0x0044('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0044('0x9'));var fs=require('fs');var fs_extra=require(_0x0044('0xa'));var _=require(_0x0044('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0044('0xc'));var deskjs=require(_0x0044('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0044('0xe'));var Papa=require(_0x0044('0xf'));var Redis=require('ioredis');var authService=require(_0x0044('0x10'));var qs=require(_0x0044('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0044('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x0044('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0044('0x14'));var db=require(_0x0044('0x15'))['db'];config[_0x0044('0x16')]=_['defaults'](config[_0x0044('0x16')],{'host':_0x0044('0x17'),'port':0x18eb});var socket=require(_0x0044('0x18'))(new Redis(config[_0x0044('0x16')]));require(_0x0044('0x19'))[_0x0044('0x1a')](socket);var jayson=require(_0x0044('0x1b'));var client=jayson[_0x0044('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x198236,_0x1c03db,_0x38cae6,_0x98acba){return new BPromise(function(_0x3f380f,_0x2d2ce6){var _0x3d67ed=_0x98acba||client;return _0x3d67ed['request'](_0x198236,_0x38cae6)[_0x0044('0x1d')](function(_0x2eef45){logger['info'](_0x0044('0x1e'),_0x1c03db,'request\x20sent');logger[_0x0044('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1c03db,_0x0044('0x20'),JSON[_0x0044('0x21')](_0x2eef45));if(_0x2eef45[_0x0044('0x22')]){if(_0x2eef45[_0x0044('0x22')][_0x0044('0x23')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1c03db,_0x2eef45[_0x0044('0x22')][_0x0044('0x24')]);return _0x2d2ce6(_0x2eef45['error']['message']);}logger[_0x0044('0x22')](_0x0044('0x1e'),_0x1c03db,_0x2eef45[_0x0044('0x22')][_0x0044('0x24')]);return _0x3f380f(_0x2eef45[_0x0044('0x22')]['message']);}else{logger[_0x0044('0x25')](_0x0044('0x1e'),_0x1c03db,_0x0044('0x20'));_0x3f380f(_0x2eef45[_0x0044('0x26')][_0x0044('0x24')]);}})[_0x0044('0x27')](function(_0x4621df){logger[_0x0044('0x22')](_0x0044('0x1e'),_0x1c03db,_0x4621df);_0x2d2ce6(_0x4621df);});});}function respondWithStatusCode(_0xa1f7e7,_0x18e4e3){_0x18e4e3=_0x18e4e3||0xcc;return function(_0x2849e9){if(_0x2849e9){return _0xa1f7e7['sendStatus'](_0x18e4e3);}return _0xa1f7e7[_0x0044('0x28')](_0x18e4e3)[_0x0044('0x29')]();};}function respondWithResult(_0x50ad23,_0x3c0bc5){_0x3c0bc5=_0x3c0bc5||0xc8;return function(_0x5c213b){if(_0x5c213b){return _0x50ad23[_0x0044('0x28')](_0x3c0bc5)[_0x0044('0x2a')](_0x5c213b);}};}function respondWithFilteredResult(_0x4d206a,_0x4a6d48){return function(_0x34e1e5){if(_0x34e1e5){var _0xbb9188=typeof _0x4a6d48[_0x0044('0x2b')]===_0x0044('0x2c')&&typeof _0x4a6d48['limit']===_0x0044('0x2c');var _0x10c9b1=_0x34e1e5[_0x0044('0x2d')];var _0x585066=_0xbb9188?0x0:_0x4a6d48['offset'];var _0x3ddecc=_0xbb9188?_0x34e1e5[_0x0044('0x2d')]:_0x4a6d48['offset']+_0x4a6d48[_0x0044('0x2e')];var _0x19294b;if(_0x3ddecc>=_0x10c9b1){_0x3ddecc=_0x10c9b1;_0x19294b=0xc8;}else{_0x19294b=0xce;}_0x4d206a[_0x0044('0x28')](_0x19294b);return _0x4d206a[_0x0044('0x2f')](_0x0044('0x30'),_0x585066+'-'+_0x3ddecc+'/'+_0x10c9b1)['json'](_0x34e1e5);}return null;};}function patchUpdates(_0x21928c){return function(_0x4131e4){try{jsonpatch['apply'](_0x4131e4,_0x21928c,!![]);}catch(_0x8730e8){return BPromise[_0x0044('0x31')](_0x8730e8);}return _0x4131e4[_0x0044('0x32')]();};}function saveUpdates(_0x4903dc,_0xb50536){return function(_0x3e374b){if(_0x3e374b){return _0x3e374b[_0x0044('0x33')](_0x4903dc)[_0x0044('0x1d')](function(_0x400d83){return _0x400d83;});}return null;};}function removeEntity(_0x39e3af,_0x19b159){return function(_0x57bdd4){if(_0x57bdd4){return _0x57bdd4['destroy']()[_0x0044('0x1d')](function(){var _0xe130b3=_0x57bdd4['get']({'plain':!![]});var _0x132725='WhatsappAccounts';return db[_0x0044('0x34')][_0x0044('0x35')]({'where':{'type':_0x132725,'resourceId':_0xe130b3['id']}})['then'](function(){return _0x57bdd4;});})['then'](function(){_0x39e3af['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22771b,_0x11003b){return function(_0x3443da){if(!_0x3443da){_0x22771b['sendStatus'](0x194);}return _0x3443da;};}function handleError(_0x4b8e3c,_0x3ff3d){_0x3ff3d=_0x3ff3d||0x1f4;return function(_0x1e2783){logger['error'](_0x1e2783['stack']);if(_0x1e2783['name']){delete _0x1e2783['name'];}_0x4b8e3c[_0x0044('0x28')](_0x3ff3d)[_0x0044('0x36')](_0x1e2783);};}exports[_0x0044('0x37')]=function(_0x42608b,_0x1e15e3){var _0x444fc9={'include':[{'model':db[_0x0044('0x38')],'as':_0x0044('0x39')}]},_0x7dd292={},_0x442802={'count':0x0,'rows':[]};var _0x3668f2=_[_0x0044('0x3a')](db['WhatsappAccount'][_0x0044('0x3b')],function(_0x126f44){return{'name':_0x126f44[_0x0044('0x3c')],'type':_0x126f44['type'][_0x0044('0x3d')]};});_0x7dd292['model']=_['map'](_0x3668f2,_0x0044('0x3e'));_0x7dd292['query']=_[_0x0044('0x3f')](_0x42608b['query']);_0x7dd292[_0x0044('0x40')]=_[_0x0044('0x41')](_0x7dd292[_0x0044('0x42')],_0x7dd292[_0x0044('0x43')]);_0x444fc9[_0x0044('0x44')]=_[_0x0044('0x41')](_0x7dd292[_0x0044('0x42')],qs[_0x0044('0x45')](_0x42608b['query'][_0x0044('0x45')]));_0x444fc9['attributes']=_0x444fc9['attributes'][_0x0044('0x46')]?_0x444fc9[_0x0044('0x44')]:_0x7dd292[_0x0044('0x42')];if(!_0x42608b[_0x0044('0x43')][_0x0044('0x47')](_0x0044('0x48'))){_0x444fc9[_0x0044('0x2e')]=qs[_0x0044('0x2e')](_0x42608b[_0x0044('0x43')][_0x0044('0x2e')]);_0x444fc9[_0x0044('0x2b')]=qs[_0x0044('0x2b')](_0x42608b['query']['offset']);}_0x444fc9['order']=qs[_0x0044('0x49')](_0x42608b[_0x0044('0x43')][_0x0044('0x49')]);_0x444fc9[_0x0044('0x4a')]=qs[_0x0044('0x40')](_[_0x0044('0x4b')](_0x42608b['query'],_0x7dd292['filters']),_0x3668f2);if(_0x42608b[_0x0044('0x43')]['filter']){_0x444fc9[_0x0044('0x4a')]=_[_0x0044('0x4c')](_0x444fc9['where'],{'$or':_[_0x0044('0x3a')](_0x3668f2,function(_0x5ba837){if(_0x5ba837[_0x0044('0x4d')]!==_0x0044('0x4e')){var _0x51cff6={};_0x51cff6[_0x5ba837[_0x0044('0x3e')]]={'$like':'%'+_0x42608b['query']['filter']+'%'};return _0x51cff6;}})});}_0x444fc9=_['merge']({},_0x444fc9,_0x42608b['options']);var _0x1b5683={'where':_0x444fc9['where']};return db[_0x0044('0x4f')][_0x0044('0x2d')](_0x1b5683)[_0x0044('0x1d')](function(_0x5b0850){_0x442802[_0x0044('0x2d')]=_0x5b0850;if(_0x42608b[_0x0044('0x43')]['includeAll']){_0x444fc9[_0x0044('0x50')]=[{'all':!![]}];}return db[_0x0044('0x4f')][_0x0044('0x51')](_0x444fc9);})[_0x0044('0x1d')](function(_0x226078){_0x442802[_0x0044('0x52')]=_0x226078;return _0x442802;})[_0x0044('0x1d')](respondWithFilteredResult(_0x1e15e3,_0x444fc9))[_0x0044('0x27')](handleError(_0x1e15e3,null));};exports[_0x0044('0x53')]=function(_0x4f08d2,_0x1ecdb2){var _0x2106c4={'raw':![],'where':{'id':_0x4f08d2['params']['id']},'include':[{'model':db[_0x0044('0x38')],'as':_0x0044('0x39')}]},_0x561e99={};_0x561e99['model']=_[_0x0044('0x3f')](db[_0x0044('0x4f')]['rawAttributes']);_0x561e99[_0x0044('0x43')]=_['keys'](_0x4f08d2[_0x0044('0x43')]);_0x561e99[_0x0044('0x40')]=_[_0x0044('0x41')](_0x561e99[_0x0044('0x42')],_0x561e99[_0x0044('0x43')]);_0x2106c4[_0x0044('0x44')]=_[_0x0044('0x41')](_0x561e99[_0x0044('0x42')],qs['fields'](_0x4f08d2['query'][_0x0044('0x45')]));_0x2106c4[_0x0044('0x44')]=_0x2106c4[_0x0044('0x44')][_0x0044('0x46')]?_0x2106c4[_0x0044('0x44')]:_0x561e99[_0x0044('0x42')];if(_0x4f08d2[_0x0044('0x43')][_0x0044('0x54')]){_0x2106c4[_0x0044('0x50')]=[{'all':!![]}];}_0x2106c4=_[_0x0044('0x4c')]({},_0x2106c4,_0x4f08d2['options']);return db[_0x0044('0x4f')][_0x0044('0x55')](_0x2106c4)[_0x0044('0x1d')](handleEntityNotFound(_0x1ecdb2,null))[_0x0044('0x1d')](respondWithResult(_0x1ecdb2,null))[_0x0044('0x27')](handleError(_0x1ecdb2,null));};exports[_0x0044('0x56')]=function(_0x485f43,_0x14eac4){return db[_0x0044('0x4f')][_0x0044('0x56')](_0x485f43[_0x0044('0x57')],{})[_0x0044('0x1d')](function(_0x14c953){var _0x40b19c=_0x485f43[_0x0044('0x58')]['get']({'plain':!![]});if(!_0x40b19c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40b19c[_0x0044('0x59')]==='user'){var _0x27d027=_0x14c953[_0x0044('0x5a')]({'plain':!![]});var _0x3f1d71=_0x0044('0x5b');return db['UserProfileSection'][_0x0044('0x55')]({'where':{'name':_0x3f1d71,'userProfileId':_0x40b19c['userProfileId']},'raw':!![]})[_0x0044('0x1d')](function(_0x353869){if(_0x353869&&_0x353869[_0x0044('0x5c')]===0x0){return db[_0x0044('0x34')][_0x0044('0x56')]({'name':_0x27d027['name'],'resourceId':_0x27d027['id'],'type':_0x353869[_0x0044('0x3e')],'sectionId':_0x353869['id']},{})[_0x0044('0x1d')](function(){return _0x14c953;});}else{return _0x14c953;}})['catch'](function(_0x206cb7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x206cb7);throw _0x206cb7;});}return _0x14c953;})[_0x0044('0x1d')](respondWithResult(_0x14eac4,0xc9))[_0x0044('0x27')](handleError(_0x14eac4,null));};exports[_0x0044('0x33')]=function(_0x185125,_0x2a6b37){if(_0x185125['body']['id']){delete _0x185125[_0x0044('0x57')]['id'];}return db['WhatsappAccount'][_0x0044('0x55')]({'where':{'id':_0x185125[_0x0044('0x5d')]['id']},'include':[{'model':db[_0x0044('0x38')],'as':'mandatoryDispositionPause'}]})[_0x0044('0x1d')](handleEntityNotFound(_0x2a6b37,null))['then'](saveUpdates(_0x185125['body'],null))[_0x0044('0x1d')](respondWithResult(_0x2a6b37,null))[_0x0044('0x27')](handleError(_0x2a6b37,null));};exports['destroy']=function(_0x2d3ce5,_0x1d1a90){return db[_0x0044('0x4f')]['find']({'where':{'id':_0x2d3ce5[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x1d1a90,null))[_0x0044('0x1d')](removeEntity(_0x1d1a90,null))[_0x0044('0x27')](handleError(_0x1d1a90,null));};exports[_0x0044('0x5e')]=function(_0x21704a,_0x175666){return db[_0x0044('0x4f')][_0x0044('0x5e')]()[_0x0044('0x1d')](respondWithResult(_0x175666,null))[_0x0044('0x27')](handleError(_0x175666,null));};exports[_0x0044('0x5f')]=function(_0x149c9f,_0xd2c705,_0x2f9987){if(_0x149c9f[_0x0044('0x57')]['id']){delete _0x149c9f[_0x0044('0x57')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x149c9f['params']['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0xd2c705,null))[_0x0044('0x1d')](function(_0x2c519a){if(_0x2c519a){_0x149c9f[_0x0044('0x57')][_0x0044('0x60')]=_0x2c519a['id'];return db[_0x0044('0x61')][_0x0044('0x56')](_0x149c9f[_0x0044('0x57')]);}})['then'](respondWithResult(_0xd2c705,null))['catch'](handleError(_0xd2c705,null));};exports[_0x0044('0x62')]=function(_0x2133cf,_0x3bb15d,_0xcc4ded){var _0x386d28={'raw':![],'where':{}};var _0x437389={};var _0xc4d4b0={'count':0x0,'rows':[]};return db[_0x0044('0x4f')][_0x0044('0x63')]({'where':{'id':_0x2133cf[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x3bb15d,null))[_0x0044('0x1d')](function(_0x4a36a7){if(_0x4a36a7){_0x437389[_0x0044('0x42')]=_[_0x0044('0x3f')](db[_0x0044('0x61')][_0x0044('0x3b')]);_0x437389['query']=_[_0x0044('0x3f')](_0x2133cf[_0x0044('0x43')]);_0x437389[_0x0044('0x40')]=_[_0x0044('0x41')](_0x437389[_0x0044('0x42')],_0x437389[_0x0044('0x43')]);_0x386d28['attributes']=_['intersection'](_0x437389[_0x0044('0x42')],qs[_0x0044('0x45')](_0x2133cf[_0x0044('0x43')]['fields']));_0x386d28[_0x0044('0x44')]=_0x386d28[_0x0044('0x44')][_0x0044('0x46')]?_0x386d28[_0x0044('0x44')]:_0x437389[_0x0044('0x42')];if(!_0x2133cf[_0x0044('0x43')][_0x0044('0x47')](_0x0044('0x48'))){_0x386d28[_0x0044('0x2e')]=qs[_0x0044('0x2e')](_0x2133cf['query'][_0x0044('0x2e')]);_0x386d28[_0x0044('0x2b')]=qs[_0x0044('0x2b')](_0x2133cf[_0x0044('0x43')][_0x0044('0x2b')]);}_0x386d28[_0x0044('0x64')]=qs[_0x0044('0x49')](_0x2133cf['query'][_0x0044('0x49')]);_0x386d28[_0x0044('0x4a')]=qs[_0x0044('0x40')](_[_0x0044('0x4b')](_0x2133cf[_0x0044('0x43')],_0x437389[_0x0044('0x40')]));_0x386d28[_0x0044('0x4a')][_0x0044('0x60')]=_0x4a36a7['id'];if(_0x2133cf['query'][_0x0044('0x65')]){_0x386d28[_0x0044('0x4a')]=_[_0x0044('0x4c')](_0x386d28['where'],{'$or':_[_0x0044('0x3a')](_0x386d28[_0x0044('0x44')],function(_0x4d1694){var _0x335fcb={};_0x335fcb[_0x4d1694]={'$like':'%'+_0x2133cf[_0x0044('0x43')]['filter']+'%'};return _0x335fcb;})});}_0x386d28=_[_0x0044('0x4c')]({},_0x386d28,_0x2133cf[_0x0044('0x66')]);return db[_0x0044('0x61')][_0x0044('0x2d')]({'where':_0x386d28[_0x0044('0x4a')]})[_0x0044('0x1d')](function(_0x102526){_0xc4d4b0[_0x0044('0x2d')]=_0x102526;if(_0x2133cf[_0x0044('0x43')][_0x0044('0x54')]){_0x386d28[_0x0044('0x50')]=[{'all':!![]}];}return db[_0x0044('0x61')][_0x0044('0x51')](_0x386d28);})[_0x0044('0x1d')](function(_0x50d9d4){_0xc4d4b0[_0x0044('0x52')]=_0x50d9d4;return _0xc4d4b0;});}})[_0x0044('0x1d')](respondWithFilteredResult(_0x3bb15d,_0x386d28))[_0x0044('0x27')](handleError(_0x3bb15d,null));};exports[_0x0044('0x67')]=function(_0x36a882,_0x4aedb1,_0x25aeb8){return db[_0x0044('0x4f')][_0x0044('0x55')]({'where':{'id':_0x36a882['params']['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x4aedb1,null))[_0x0044('0x1d')](function(_0x52902c){if(_0x52902c){return _0x52902c[_0x0044('0x67')](_0x36a882[_0x0044('0x43')]['ids']);}})[_0x0044('0x1d')](respondWithStatusCode(_0x4aedb1,null))[_0x0044('0x27')](handleError(_0x4aedb1,null));};exports[_0x0044('0x68')]=function(_0x2c5604,_0x5375fd,_0x4e5e11){if(_0x2c5604['body']['id']){delete _0x2c5604['body']['id'];}return db['WhatsappAccount'][_0x0044('0x55')]({'where':{'id':_0x2c5604['params']['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x5375fd,null))[_0x0044('0x1d')](function(_0x3ceeb8){if(_0x3ceeb8){_0x2c5604[_0x0044('0x57')][_0x0044('0x60')]=_0x3ceeb8['id'];return db['CannedAnswer'][_0x0044('0x56')](_0x2c5604[_0x0044('0x57')]);}})[_0x0044('0x1d')](respondWithResult(_0x5375fd,null))[_0x0044('0x27')](handleError(_0x5375fd,null));};exports[_0x0044('0x69')]=function(_0x24f8d1,_0xb0c1ab,_0x59fd47){var _0x49e8ac={'raw':![],'where':{}};var _0x3ed3da={};var _0x1dfb08={'count':0x0,'rows':[]};return db[_0x0044('0x4f')]['findOne']({'where':{'id':_0x24f8d1['params']['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0xb0c1ab,null))[_0x0044('0x1d')](function(_0x4a75e8){if(_0x4a75e8){_0x3ed3da[_0x0044('0x42')]=_[_0x0044('0x3f')](db[_0x0044('0x6a')][_0x0044('0x3b')]);_0x3ed3da[_0x0044('0x43')]=_[_0x0044('0x3f')](_0x24f8d1[_0x0044('0x43')]);_0x3ed3da['filters']=_['intersection'](_0x3ed3da[_0x0044('0x42')],_0x3ed3da[_0x0044('0x43')]);_0x49e8ac[_0x0044('0x44')]=_[_0x0044('0x41')](_0x3ed3da[_0x0044('0x42')],qs['fields'](_0x24f8d1[_0x0044('0x43')][_0x0044('0x45')]));_0x49e8ac['attributes']=_0x49e8ac[_0x0044('0x44')]['length']?_0x49e8ac[_0x0044('0x44')]:_0x3ed3da[_0x0044('0x42')];if(!_0x24f8d1[_0x0044('0x43')][_0x0044('0x47')](_0x0044('0x48'))){_0x49e8ac['limit']=qs['limit'](_0x24f8d1[_0x0044('0x43')][_0x0044('0x2e')]);_0x49e8ac[_0x0044('0x2b')]=qs['offset'](_0x24f8d1[_0x0044('0x43')]['offset']);}_0x49e8ac[_0x0044('0x64')]=qs['sort'](_0x24f8d1['query'][_0x0044('0x49')]);_0x49e8ac[_0x0044('0x4a')]=qs[_0x0044('0x40')](_[_0x0044('0x4b')](_0x24f8d1['query'],_0x3ed3da[_0x0044('0x40')]));_0x49e8ac['where']['WhatsappAccountId']=_0x4a75e8['id'];if(_0x24f8d1[_0x0044('0x43')][_0x0044('0x65')]){_0x49e8ac[_0x0044('0x4a')]=_[_0x0044('0x4c')](_0x49e8ac[_0x0044('0x4a')],{'$or':_[_0x0044('0x3a')](_0x49e8ac[_0x0044('0x44')],function(_0xc83aed){var _0x2e343a={};_0x2e343a[_0xc83aed]={'$like':'%'+_0x24f8d1['query'][_0x0044('0x65')]+'%'};return _0x2e343a;})});}_0x49e8ac=_[_0x0044('0x4c')]({},_0x49e8ac,_0x24f8d1['options']);return db[_0x0044('0x6a')][_0x0044('0x2d')]({'where':_0x49e8ac[_0x0044('0x4a')]})[_0x0044('0x1d')](function(_0xe4b5bd){_0x1dfb08['count']=_0xe4b5bd;if(_0x24f8d1[_0x0044('0x43')]['includeAll']){_0x49e8ac[_0x0044('0x50')]=[{'all':!![]}];}return db[_0x0044('0x6a')][_0x0044('0x51')](_0x49e8ac);})[_0x0044('0x1d')](function(_0x5c7176){_0x1dfb08['rows']=_0x5c7176;return _0x1dfb08;});}})[_0x0044('0x1d')](respondWithFilteredResult(_0xb0c1ab,_0x49e8ac))[_0x0044('0x27')](handleError(_0xb0c1ab,null));};exports[_0x0044('0x6b')]=function(_0x24a8ad,_0x4cc7ce,_0x33f3b8){return db[_0x0044('0x4f')][_0x0044('0x55')]({'where':{'id':_0x24a8ad[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x4cc7ce,null))['then'](function(_0x25f134){if(_0x25f134){return _0x25f134['removeAnswers'](_0x24a8ad['query'][_0x0044('0x6c')]);}})[_0x0044('0x1d')](respondWithStatusCode(_0x4cc7ce,null))[_0x0044('0x27')](handleError(_0x4cc7ce,null));};exports[_0x0044('0x6d')]=function(_0x21ebaf,_0x489c0f,_0x188222){return db[_0x0044('0x4f')][_0x0044('0x55')]({'where':{'id':_0x21ebaf[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x489c0f,null))[_0x0044('0x1d')](function(_0x205780){if(_0x205780){return _0x205780[_0x0044('0x6d')](_0x21ebaf[_0x0044('0x57')]['ids'],_['omit'](_0x21ebaf[_0x0044('0x57')],[_0x0044('0x6c'),'id'])||{})['spread'](function(_0x3ead98){for(var _0x13f0c4=0x0;_0x13f0c4<_0x21ebaf[_0x0044('0x57')][_0x0044('0x6c')][_0x0044('0x46')];_0x13f0c4+=0x1){socket[_0x0044('0x6e')]('userWhatsappAccount:save',{'UserId':Number(_0x21ebaf['body'][_0x0044('0x6c')][_0x13f0c4]),'WhatsappAccountId':Number(_0x21ebaf[_0x0044('0x5d')]['id'])});}return _0x3ead98;});}})[_0x0044('0x1d')](respondWithResult(_0x489c0f,null))[_0x0044('0x27')](handleError(_0x489c0f,null));};exports[_0x0044('0x6f')]=function(_0x5c8cf7,_0x460105,_0xee3b0c){return db[_0x0044('0x4f')]['find']({'where':{'id':_0x5c8cf7[_0x0044('0x5d')]['id']}})['then'](handleEntityNotFound(_0x460105,null))[_0x0044('0x1d')](function(_0x5b0db4){if(_0x5b0db4){return _0x5b0db4[_0x0044('0x6f')](_0x5c8cf7[_0x0044('0x43')][_0x0044('0x6c')])[_0x0044('0x1d')](function(){if(_[_0x0044('0x70')](_0x5c8cf7[_0x0044('0x43')][_0x0044('0x6c')])){for(var _0x1a4b93=0x0;_0x1a4b93<_0x5c8cf7[_0x0044('0x43')][_0x0044('0x6c')][_0x0044('0x46')];_0x1a4b93+=0x1){socket[_0x0044('0x6e')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c8cf7[_0x0044('0x43')][_0x0044('0x6c')][_0x1a4b93]),'WhatsappAccountId':Number(_0x5c8cf7['params']['id'])});}}else{socket[_0x0044('0x6e')](_0x0044('0x71'),{'UserId':Number(_0x5c8cf7['query'][_0x0044('0x6c')]),'WhatsappAccountId':Number(_0x5c8cf7['params']['id'])});}});}})[_0x0044('0x1d')](respondWithStatusCode(_0x460105,null))['catch'](handleError(_0x460105,null));};exports[_0x0044('0x72')]=function(_0x41f2ae,_0x28f5bd,_0x40ca2e){var _0xb55085={};var _0x50a15a={};var _0x9de65;var _0x3c2096;return db[_0x0044('0x4f')][_0x0044('0x63')]({'where':{'id':_0x41f2ae[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x28f5bd,null))['then'](function(_0x5aeba1){if(_0x5aeba1){_0x9de65=_0x5aeba1;_0x50a15a[_0x0044('0x42')]=_[_0x0044('0x3f')](db[_0x0044('0x73')][_0x0044('0x3b')]);_0x50a15a[_0x0044('0x43')]=_[_0x0044('0x3f')](_0x41f2ae[_0x0044('0x43')]);_0x50a15a[_0x0044('0x40')]=_[_0x0044('0x41')](_0x50a15a[_0x0044('0x42')],_0x50a15a[_0x0044('0x43')]);_0xb55085['attributes']=_['intersection'](_0x50a15a['model'],qs[_0x0044('0x45')](_0x41f2ae['query'][_0x0044('0x45')]));_0xb55085[_0x0044('0x44')]=_0xb55085[_0x0044('0x44')][_0x0044('0x46')]?_0xb55085[_0x0044('0x44')]:_0x50a15a[_0x0044('0x42')];_0xb55085[_0x0044('0x64')]=qs[_0x0044('0x49')](_0x41f2ae[_0x0044('0x43')][_0x0044('0x49')]);_0xb55085[_0x0044('0x4a')]=qs[_0x0044('0x40')](_['pick'](_0x41f2ae['query'],_0x50a15a[_0x0044('0x40')]));if(_0x41f2ae[_0x0044('0x43')][_0x0044('0x65')]){_0xb55085['where']=_[_0x0044('0x4c')](_0xb55085[_0x0044('0x4a')],{'$or':_[_0x0044('0x3a')](_0xb55085[_0x0044('0x44')],function(_0x1d7ce0){var _0x21fef8={};_0x21fef8[_0x1d7ce0]={'$like':'%'+_0x41f2ae[_0x0044('0x43')]['filter']+'%'};return _0x21fef8;})});}_0xb55085=_[_0x0044('0x4c')]({},_0xb55085,_0x41f2ae[_0x0044('0x66')]);return _0x9de65[_0x0044('0x72')](_0xb55085);}})[_0x0044('0x1d')](function(_0x496b6c){if(_0x496b6c){_0x3c2096=_0x496b6c[_0x0044('0x46')];if(!_0x41f2ae[_0x0044('0x43')][_0x0044('0x47')](_0x0044('0x48'))){_0xb55085['limit']=qs[_0x0044('0x2e')](_0x41f2ae[_0x0044('0x43')]['limit']);_0xb55085[_0x0044('0x2b')]=qs[_0x0044('0x2b')](_0x41f2ae[_0x0044('0x43')][_0x0044('0x2b')]);}return _0x9de65['getAgents'](_0xb55085);}})[_0x0044('0x1d')](function(_0x491586){if(_0x491586){return _0x491586?{'count':_0x3c2096,'rows':_0x491586}:null;}})['then'](respondWithResult(_0x28f5bd,null))[_0x0044('0x27')](handleError(_0x28f5bd,null));};exports['addApplications']=function(_0x1eaecb,_0x44423e){var _0x1d409a=_0x1eaecb['params']['id'];var _0x4b2577=_0x1eaecb[_0x0044('0x57')];var _0x1ecf95=0xc8;var _0x250f19=null;return db[_0x0044('0x74')]['transaction']({'isolationLevel':db['sequelize'][_0x0044('0x75')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1aeacd){return db['WhatsappAccount'][_0x0044('0x63')]({'where':{'id':_0x1d409a},'transaction':_0x1aeacd})[_0x0044('0x1d')](function(_0x304567){if(_0x304567){return db['WhatsappApplication'][_0x0044('0x35')]({'where':{'WhatsappAccountId':_0x1d409a},'transaction':_0x1aeacd})[_0x0044('0x1d')](function(){var _0x168810=_[_0x0044('0x3a')](_0x4b2577,function(_0x28ad42){_0x28ad42['WhatsappAccountId']=_0x1d409a;return _0x28ad42;});return db[_0x0044('0x76')][_0x0044('0x77')](_0x168810,{'transaction':_0x1aeacd});});}else{_0x1ecf95=0x194;_0x250f19=[];}});})[_0x0044('0x1d')](function(){if(_0x1ecf95!==0x194){return db['WhatsappApplication'][_0x0044('0x78')]({'where':{'WhatsappAccountId':_0x1d409a},'order':_0x0044('0x79')})['then'](function(_0x183296){_0x250f19=_0x183296;});}})[_0x0044('0x27')](function(_0x51a245){_0x1ecf95=0x1f4;logger[_0x0044('0x22')](_0x51a245['stack']);if(_0x51a245['name']){delete _0x51a245[_0x0044('0x3e')];}_0x250f19=_0x51a245;})[_0x0044('0x7a')](function(){if(_0x250f19===null){_0x44423e[_0x0044('0x7b')](_0x1ecf95);}else{if(_0x1ecf95===0x1f4){_0x44423e[_0x0044('0x28')](_0x1ecf95)[_0x0044('0x36')](_0x250f19);}else{_0x44423e[_0x0044('0x28')](_0x1ecf95)[_0x0044('0x2a')](_0x250f19);}}});};exports['getApplications']=function(_0xc798f5,_0x47cb51,_0x553aad){var _0x5e90db={};var _0x2c9ecc={};var _0x3d6f94;var _0x53cb8e;return db[_0x0044('0x4f')][_0x0044('0x63')]({'where':{'id':_0xc798f5[_0x0044('0x5d')]['id']}})[_0x0044('0x1d')](handleEntityNotFound(_0x47cb51,null))['then'](function(_0x546ae8){if(_0x546ae8){_0x3d6f94=_0x546ae8;_0x2c9ecc[_0x0044('0x42')]=_[_0x0044('0x3f')](db[_0x0044('0x76')][_0x0044('0x3b')]);_0x2c9ecc[_0x0044('0x43')]=_[_0x0044('0x3f')](_0xc798f5[_0x0044('0x43')]);_0x2c9ecc[_0x0044('0x40')]=_[_0x0044('0x41')](_0x2c9ecc[_0x0044('0x42')],_0x2c9ecc[_0x0044('0x43')]);_0x5e90db['attributes']=_[_0x0044('0x41')](_0x2c9ecc[_0x0044('0x42')],qs[_0x0044('0x45')](_0xc798f5[_0x0044('0x43')]['fields']));_0x5e90db[_0x0044('0x44')]=_0x5e90db[_0x0044('0x44')][_0x0044('0x46')]?_0x5e90db[_0x0044('0x44')]:_0x2c9ecc[_0x0044('0x42')];_0x5e90db[_0x0044('0x64')]=qs[_0x0044('0x49')](_0xc798f5[_0x0044('0x43')][_0x0044('0x49')]);_0x5e90db[_0x0044('0x4a')]=qs['filters'](_[_0x0044('0x4b')](_0xc798f5[_0x0044('0x43')],_0x2c9ecc[_0x0044('0x40')]));if(_0xc798f5[_0x0044('0x43')][_0x0044('0x65')]){_0x5e90db[_0x0044('0x4a')]=_[_0x0044('0x4c')](_0x5e90db['where'],{'$or':_[_0x0044('0x3a')](_0x5e90db[_0x0044('0x44')],function(_0x46afba){var _0x13bd3d={};_0x13bd3d[_0x46afba]={'$like':'%'+_0xc798f5[_0x0044('0x43')][_0x0044('0x65')]+'%'};return _0x13bd3d;})});}_0x5e90db=_[_0x0044('0x4c')]({},_0x5e90db,_0xc798f5[_0x0044('0x66')]);return _0x3d6f94[_0x0044('0x7c')](_0x5e90db);}})[_0x0044('0x1d')](function(_0x14290e){if(_0x14290e){_0x53cb8e=_0x14290e[_0x0044('0x46')];if(!_0xc798f5['query']['hasOwnProperty'](_0x0044('0x48'))){_0x5e90db[_0x0044('0x2e')]=qs[_0x0044('0x2e')](_0xc798f5[_0x0044('0x43')][_0x0044('0x2e')]);_0x5e90db[_0x0044('0x2b')]=qs[_0x0044('0x2b')](_0xc798f5[_0x0044('0x43')][_0x0044('0x2b')]);}return _0x3d6f94[_0x0044('0x7c')](_0x5e90db);}})[_0x0044('0x1d')](function(_0xb08834){if(_0xb08834){return _0xb08834?{'count':_0x53cb8e,'rows':_0xb08834}:null;}})['then'](respondWithResult(_0x47cb51,null))['catch'](handleError(_0x47cb51,null));};exports['notify']=function(_0x28352f,_0x1cb6ec,_0x2ea6ae){var _0x5d75fd={'channel':_0x0044('0x7d')};var _0x1b5cc3=[];var _0x44bfa6=[];var _0x1e4cf7={};return db[_0x0044('0x4f')][_0x0044('0x55')]({'where':{'id':_0x28352f[_0x0044('0x5d')]['id']},'include':[{'model':db[_0x0044('0x76')],'as':_0x0044('0x7e')}]})[_0x0044('0x1d')](handleEntityNotFound(_0x1cb6ec,null))['then'](function(_0x214331){_0x5d75fd[_0x0044('0x7f')]=_0x214331;if(_0x5d75fd[_0x0044('0x7f')]&&_0x5d75fd[_0x0044('0x7f')][_0x0044('0x4d')]===_0x0044('0x80')&&_0x28352f['body'][_0x0044('0x81')]){if(_0x28352f[_0x0044('0x57')][_0x0044('0x81')][_0x0044('0x46')]===0x0)return;if(_0x28352f[_0x0044('0x57')]['statuses'][0x0][_0x0044('0x82')]!==_0x0044('0x83'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x28352f[_0x0044('0x57')][_0x0044('0x81')][0x0][_0x0044('0x84')]},{'where':{'messageId':_0x28352f['body'][_0x0044('0x81')][0x0][_0x0044('0x85')]},'individualHooks':!![]})[_0x0044('0x1d')](function(_0x597d2b){return _0x1cb6ec[_0x0044('0x28')](0xc8)['json'](_0x597d2b);});}_0x5d75fd['applications']=_[_0x0044('0x86')](_0x214331[_0x0044('0x7e')],[_0x0044('0x79')],[_0x0044('0x87')]);if(_0x5d75fd[_0x0044('0x7f')][_0x0044('0x7e')]){delete _0x5d75fd[_0x0044('0x7f')][_0x0044('0x7e')];}return db[_0x0044('0x88')][_0x0044('0x5e')]()[_0x0044('0x1d')](function(_0x2754e3){if(!_0x2754e3){throw new db[(_0x0044('0x89'))]['ValidationError']('no\x20available\x20attributes');}_0x1b5cc3=_[_0x0044('0x8a')](_[_0x0044('0x3f')](_0x2754e3),[_0x0044('0x8b'),_0x0044('0x8c')]);_0x44bfa6=_['difference'](_[_0x0044('0x3f')](_0x2754e3),[_0x0044('0x8b'),_0x0044('0x8c'),'CompanyId',_0x0044('0x8d')]);_0x5d75fd['body']={'mapKey':_0x0044('0x8e')};if(_0x5d75fd['account']&&_0x5d75fd[_0x0044('0x7f')][_0x0044('0x4d')]===_0x0044('0x8f')){_0x5d75fd[_0x0044('0x57')][_0x0044('0x90')]=_0x28352f['body'][_0x0044('0x91')]['replace'](_0x0044('0x92'),'');_0x5d75fd[_0x0044('0x57')][_0x0044('0x57')]=_0x28352f[_0x0044('0x57')][_0x0044('0x93')];_0x5d75fd['body']['messageId']=_0x28352f[_0x0044('0x57')]['MessageSid'];}if(_0x5d75fd[_0x0044('0x7f')]&&_0x5d75fd['account'][_0x0044('0x4d')]===_0x0044('0x80')){_0x5d75fd[_0x0044('0x57')]['from']=_0x28352f['body'][_0x0044('0x94')][0x0][_0x0044('0x90')];_0x5d75fd[_0x0044('0x57')][_0x0044('0x57')]=_0x28352f[_0x0044('0x57')][_0x0044('0x94')][0x0][_0x0044('0x24')][_0x0044('0x57')];_0x5d75fd[_0x0044('0x57')][_0x0044('0x95')]=_0x28352f[_0x0044('0x57')][_0x0044('0x94')][0x0][_0x0044('0x85')];}if(_0x5d75fd['body']['id']){delete _0x5d75fd[_0x0044('0x57')]['id'];}if(_[_0x0044('0x96')](_0x5d75fd['body'][_0x0044('0x90')])){throw new db[(_0x0044('0x89'))][(_0x0044('0x97'))]('from\x20is\x20mandatory');}if(_[_0x0044('0x96')](_0x5d75fd[_0x0044('0x57')]['body'])||_0x5d75fd[_0x0044('0x57')][_0x0044('0x57')]===''){throw new db[(_0x0044('0x89'))][(_0x0044('0x97'))](_0x0044('0x98'));}if(_['isNil'](_0x5d75fd['body'][_0x0044('0x99')])){throw new db['Sequelize'][(_0x0044('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x44bfa6);}if(!_['includes'](_0x44bfa6,_0x5d75fd[_0x0044('0x57')][_0x0044('0x99')])){throw new db[(_0x0044('0x89'))][(_0x0044('0x97'))](_0x0044('0x9a')+_0x44bfa6);}_0x1e4cf7[_0x5d75fd[_0x0044('0x57')]['mapKey']]=_0x5d75fd[_0x0044('0x57')][_0x0044('0x90')];return db[_0x0044('0x9b')][_0x0044('0x55')]({'where':{'id':_0x5d75fd['account'][_0x0044('0x8d')]},'include':[{'model':db[_0x0044('0x88')],'as':_0x0044('0x9c'),'where':_0x1e4cf7,'limit':0x1,'order':[['updatedAt',_0x0044('0x9d')]]}]});})['then'](handleEntityNotFound(_0x1cb6ec,null))['then'](function(_0x3a986){if(_0x3a986){_0x5d75fd[_0x0044('0x9e')]=_[_0x0044('0x9f')](_0x3a986,[_0x0044('0x9c')]);if(_0x3a986[_0x0044('0x9c')][_0x0044('0x46')]){return _0x3a986['Contacts'][0x0];}var _0x163b29=_[_0x0044('0xa0')](_0x5d75fd[_0x0044('0x57')],{'firstName':_0x5d75fd[_0x0044('0x57')]['from'],'ListId':_0x3a986['id']});_0x163b29[_0x5d75fd[_0x0044('0x57')][_0x0044('0x99')]]=_0x5d75fd['body'][_0x0044('0x90')];return db[_0x0044('0x88')][_0x0044('0x56')](_0x163b29,{'fields':_0x1b5cc3,'raw':!![]});}})[_0x0044('0x1d')](handleEntityNotFound(_0x1cb6ec,null))[_0x0044('0x1d')](function(_0x543550){if(_0x543550){_0x5d75fd['contact']=_0x543550;var _0x18e922={'ContactId':_0x543550['id'],'phone':_0x5d75fd['body'][_0x0044('0x90')],'WhatsappAccountId':_0x28352f[_0x0044('0x5d')]['id']};var _0x244c4b={'ContactId':_0x543550['id'],'WhatsappAccountId':_0x28352f[_0x0044('0x5d')]['id'],'closed':![]};return db[_0x0044('0xa1')][_0x0044('0x55')]({'where':_0x244c4b})[_0x0044('0x1d')](function(_0x11736a){if(_0x11736a){return[_0x11736a,![]];}return db[_0x0044('0xa1')]['create'](_0x18e922)[_0x0044('0x1d')](function(_0x13d6ba){return[_0x13d6ba,!![]];});});}})[_0x0044('0xa2')](function(_0x141fe4,_0x34cd51){_0x5d75fd[_0x0044('0xa3')]=_0x141fe4[_0x0044('0x5a')]({'plain':!![]});_0x5d75fd[_0x0044('0xa3')]['created']=![];if(_0x34cd51){if(_0x5d75fd['account'][_0x0044('0xa4')]){_0x5d75fd[_0x0044('0xa5')][_0x0044('0xa6')]({'id':0x0,'priority':_0x5d75fd[_0x0044('0xa5')][_0x0044('0x46')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x0044('0xa7')});}_0x5d75fd['interaction'][_0x0044('0xa8')]=!![];}return db[_0x0044('0xa9')][_0x0044('0x56')]({'phone':_0x5d75fd[_0x0044('0x57')][_0x0044('0x90')],'messageId':_0x5d75fd['body'][_0x0044('0x95')],'body':_0x5d75fd[_0x0044('0x57')][_0x0044('0x57')],'WhatsappAccountId':_0x28352f[_0x0044('0x5d')]['id'],'WhatsappInteractionId':_0x141fe4['id'],'direction':'in','ContactId':_0x141fe4[_0x0044('0xaa')],'AttachmentId':_0x5d75fd['body'][_0x0044('0xab')]});})[_0x0044('0x1d')](function(_0x418db5){_0x5d75fd[_0x0044('0x24')]=_0x418db5;if(_0x5d75fd['interaction'][_0x0044('0xac')]){return db[_0x0044('0x73')][_0x0044('0x55')]({'attributes':['id','name'],'where':{'id':_0x5d75fd[_0x0044('0xa3')][_0x0044('0xac')]}})[_0x0044('0x1d')](function(_0x315029){if(_0x315029){_0x5d75fd['applications'][_0x0044('0xad')]({'id':0x0,'priority':0x0,'app':_0x0044('0xae'),'appdata':_0x315029[_0x0044('0x3e')]+','+(_0x5d75fd[_0x0044('0x7f')]['waitForTheAssignedAgent']||0xa),'interval':_0x0044('0xa7')});}return respondWithRpcPromise(_0x0044('0xaf'),_0x0044('0xb0'),_0x5d75fd);});}return respondWithRpcPromise(_0x0044('0xaf'),_0x0044('0xb0'),_0x5d75fd);})[_0x0044('0x1d')](function(_0xa1467c){if(_0xa1467c){var _0x331e73=0xc8;var _0x4ceb72='receiveMessage';logger[_0x0044('0x25')](_0x0044('0xb1'),_0x4ceb72,_0x331e73,_0x0044('0xb2'));logger[_0x0044('0x1f')](_0x0044('0xb3'),_0x4ceb72,_0x331e73,_0x0044('0xb2'),JSON['stringify'](_0xa1467c));if(_0x5d75fd[_0x0044('0x7f')][_0x0044('0x4d')]==='twilio'){return _0x1cb6ec[_0x0044('0x28')](_0x331e73)[_0x0044('0x2f')]('Content-Type',_0x0044('0xb4'))[_0x0044('0x36')](_0x0044('0xb5'));}else{return _0x1cb6ec['status'](_0x331e73)['json'](_0xa1467c);}}});})[_0x0044('0x27')](handleError(_0x1cb6ec,null));};exports[_0x0044('0x36')]=function(_0x355e2f,_0x4fe1ce,_0x1fc360){var _0x48360c,_0x5d4d46,_0x40702f;if(_['isNil'](_0x355e2f[_0x0044('0x57')][_0x0044('0x57')])||_0x355e2f[_0x0044('0x57')]['body']===''){throw new db[(_0x0044('0x89'))][(_0x0044('0x97'))](_0x0044('0x98'));}if(_[_0x0044('0x96')](_0x355e2f['body']['to'])){throw new db[(_0x0044('0x89'))][(_0x0044('0x97'))](_0x0044('0xb6'));}_0x48360c=_0x355e2f[_0x0044('0x57')]['to'];return db[_0x0044('0x4f')][_0x0044('0x55')]({'where':{'id':_0x355e2f[_0x0044('0x5d')]['id']},'include':[{'model':db[_0x0044('0x9b')],'as':'List','include':[{'model':db[_0x0044('0x88')],'as':'Contacts','where':{'mobile':_0x48360c},'limit':0x1,'order':[[_0x0044('0x8c'),_0x0044('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x4fe1ce,null))['then'](function(_0x4fc512){if(_0x4fc512&&_0x4fc512[_0x0044('0xb7')]){_0x5d4d46=_0x4fc512[_0x0044('0x5a')]({'plain':!![]});if(_0x5d4d46[_0x0044('0xb7')]&&_0x5d4d46[_0x0044('0xb7')]['Contacts'][_0x0044('0x46')]){return _0x5d4d46[_0x0044('0xb7')]['Contacts'][0x0];}return db[_0x0044('0x88')]['create'](_[_0x0044('0xa0')](_0x355e2f['body'],{'firstName':_0x48360c,'mobile':_0x48360c,'phone':_0x48360c,'ListId':_0x5d4d46[_0x0044('0x8d')]}));}})[_0x0044('0x1d')](handleEntityNotFound(_0x4fe1ce,null))['then'](function(_0x29db9f){if(_0x29db9f){_0x40702f=_0x29db9f;return db[_0x0044('0xa1')][_0x0044('0x55')]({'where':{'ContactId':_0x40702f['id'],'closed':![],'WhatsappAccountId':_0x5d4d46['id']}})[_0x0044('0x1d')](function(_0xc0970a){if(_0xc0970a){return[_0xc0970a,![]];}return db[_0x0044('0xa1')][_0x0044('0x56')]({'UserId':_0x355e2f['user']['id'],'ContactId':_0x40702f['id'],'WhatsappAccountId':_0x5d4d46['id'],'phone':_0x48360c,'firstMsgDirection':'out','Messages':[_[_0x0044('0x4c')](_0x355e2f[_0x0044('0x57')],{'read':![],'body':_0x355e2f[_0x0044('0x57')][_0x0044('0x57')],'phone':_0x48360c,'WhatsappAccountId':_0x5d4d46['id'],'UserId':_0x355e2f['user']['id'],'ContactId':_0x40702f['id']})]},{'include':[{'model':db[_0x0044('0xa9')],'as':_0x0044('0xb8')}]})['then'](function(_0x567096){return[_0x567096,!![]];});});}})['spread'](function(_0x5f00ec,_0x190b35){if(_0x190b35){return _0x5f00ec;}return db[_0x0044('0xa9')][_0x0044('0x56')](_[_0x0044('0x4c')](_0x355e2f['body'],{'read':![],'body':_0x355e2f[_0x0044('0x57')][_0x0044('0x57')],'phone':_0x48360c,'WhatsappAccountId':_0x5d4d46['id'],'WhatsappInteractionId':_0x5f00ec['id'],'UserId':_0x355e2f[_0x0044('0x58')]['id'],'ContactId':_0x40702f['id']}))[_0x0044('0x1d')](function(_0x4b156b){_0x5f00ec['dataValues'][_0x0044('0xb8')]=[];_0x5f00ec[_0x0044('0xb9')][_0x0044('0xb8')][_0x0044('0xa6')](_0x4b156b['dataValues']);return _0x5f00ec;});})[_0x0044('0x1d')](respondWithResult(_0x4fe1ce,null))[_0x0044('0x27')](handleError(_0x4fe1ce,null));}; \ No newline at end of file +var _0x0f55=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','include','rows','params','Pause','includeAll','create','WhatsappAccount','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','filter','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','statuses','WhatsappMessage','timestamp','applications','orderBy','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','From','whatsapp:','Body','MessageSid','sinch','from','notifications','messageId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x4fabbe,_0xc514f3){var _0x5510dd=function(_0x1e7d23){while(--_0x1e7d23){_0x4fabbe['push'](_0x4fabbe['shift']());}};_0x5510dd(++_0xc514f3);}(_0x0f55,0x170));var _0x50f5=function(_0x8b1a5e,_0x2744eb){_0x8b1a5e=_0x8b1a5e-0x0;var _0x1146b1=_0x0f55[_0x8b1a5e];return _0x1146b1;};'use strict';var emlformat=require(_0x50f5('0x0'));var rimraf=require(_0x50f5('0x1'));var zipdir=require(_0x50f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50f5('0x3'));var moment=require(_0x50f5('0x4'));var BPromise=require(_0x50f5('0x5'));var Mustache=require(_0x50f5('0x6'));var util=require(_0x50f5('0x7'));var path=require(_0x50f5('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x50f5('0x9'));var fs=require('fs');var fs_extra=require(_0x50f5('0xa'));var _=require('lodash');var squel=require(_0x50f5('0xb'));var crypto=require('crypto');var jsforce=require(_0x50f5('0xc'));var deskjs=require(_0x50f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50f5('0xe'));var Papa=require(_0x50f5('0xf'));var Redis=require('ioredis');var authService=require(_0x50f5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x50f5('0x11'));var hardwareService=require(_0x50f5('0x12'));var logger=require(_0x50f5('0x13'))(_0x50f5('0x14'));var utils=require('../../config/utils');var config=require(_0x50f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x50f5('0x16'))['db'];config['redis']=_['defaults'](config[_0x50f5('0x17')],{'host':_0x50f5('0x18'),'port':0x18eb});var socket=require(_0x50f5('0x19'))(new Redis(config['redis']));require(_0x50f5('0x1a'))[_0x50f5('0x1b')](socket);var jayson=require(_0x50f5('0x1c'));var client=jayson[_0x50f5('0x1d')][_0x50f5('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x4c99d4,_0x2ce7f7,_0x5e185d,_0xde47c6){return new BPromise(function(_0x506e46,_0x78d6f4){var _0x369ce5=_0xde47c6||client;return _0x369ce5[_0x50f5('0x1f')](_0x4c99d4,_0x5e185d)[_0x50f5('0x20')](function(_0x2ac2a8){logger[_0x50f5('0x21')](_0x50f5('0x22'),_0x2ce7f7,_0x50f5('0x23'));logger['debug'](_0x50f5('0x24'),_0x2ce7f7,'request\x20sent',JSON[_0x50f5('0x25')](_0x2ac2a8));if(_0x2ac2a8[_0x50f5('0x26')]){if(_0x2ac2a8[_0x50f5('0x26')]['code']===0x1f4){logger[_0x50f5('0x26')](_0x50f5('0x22'),_0x2ce7f7,_0x2ac2a8[_0x50f5('0x26')]['message']);return _0x78d6f4(_0x2ac2a8['error'][_0x50f5('0x27')]);}logger['error'](_0x50f5('0x22'),_0x2ce7f7,_0x2ac2a8[_0x50f5('0x26')][_0x50f5('0x27')]);return _0x506e46(_0x2ac2a8[_0x50f5('0x26')][_0x50f5('0x27')]);}else{logger['info'](_0x50f5('0x22'),_0x2ce7f7,'request\x20sent');_0x506e46(_0x2ac2a8[_0x50f5('0x28')][_0x50f5('0x27')]);}})[_0x50f5('0x29')](function(_0x2a3d90){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x2ce7f7,_0x2a3d90);_0x78d6f4(_0x2a3d90);});});}function respondWithStatusCode(_0x4a65d4,_0x2de7fa){_0x2de7fa=_0x2de7fa||0xcc;return function(_0x28e6d1){if(_0x28e6d1){return _0x4a65d4[_0x50f5('0x2a')](_0x2de7fa);}return _0x4a65d4['status'](_0x2de7fa)[_0x50f5('0x2b')]();};}function respondWithResult(_0x2fa2c1,_0x16acb9){_0x16acb9=_0x16acb9||0xc8;return function(_0x4081be){if(_0x4081be){return _0x2fa2c1[_0x50f5('0x2c')](_0x16acb9)[_0x50f5('0x2d')](_0x4081be);}};}function respondWithFilteredResult(_0x511564,_0x3a5a3a){return function(_0x3d37c1){if(_0x3d37c1){var _0x48b45c=typeof _0x3a5a3a[_0x50f5('0x2e')]===_0x50f5('0x2f')&&typeof _0x3a5a3a['limit']===_0x50f5('0x2f');var _0x18680a=_0x3d37c1['count'];var _0x4b39a8=_0x48b45c?0x0:_0x3a5a3a[_0x50f5('0x2e')];var _0x28e6b0=_0x48b45c?_0x3d37c1[_0x50f5('0x30')]:_0x3a5a3a[_0x50f5('0x2e')]+_0x3a5a3a[_0x50f5('0x31')];var _0x5cf25b;if(_0x28e6b0>=_0x18680a){_0x28e6b0=_0x18680a;_0x5cf25b=0xc8;}else{_0x5cf25b=0xce;}_0x511564[_0x50f5('0x2c')](_0x5cf25b);return _0x511564[_0x50f5('0x32')]('Content-Range',_0x4b39a8+'-'+_0x28e6b0+'/'+_0x18680a)[_0x50f5('0x2d')](_0x3d37c1);}return null;};}function patchUpdates(_0x315cc2){return function(_0x5abdff){try{jsonpatch[_0x50f5('0x33')](_0x5abdff,_0x315cc2,!![]);}catch(_0x13408f){return BPromise[_0x50f5('0x34')](_0x13408f);}return _0x5abdff[_0x50f5('0x35')]();};}function saveUpdates(_0x454058,_0x3d2ce2){return function(_0x324790){if(_0x324790){return _0x324790[_0x50f5('0x36')](_0x454058)[_0x50f5('0x20')](function(_0x2b7076){return _0x2b7076;});}return null;};}function removeEntity(_0x1571b2,_0x304863){return function(_0x1bfd8e){if(_0x1bfd8e){return _0x1bfd8e[_0x50f5('0x37')]()[_0x50f5('0x20')](function(){var _0x457ecd=_0x1bfd8e[_0x50f5('0x38')]({'plain':!![]});var _0x1b120f=_0x50f5('0x39');return db[_0x50f5('0x3a')][_0x50f5('0x37')]({'where':{'type':_0x1b120f,'resourceId':_0x457ecd['id']}})[_0x50f5('0x20')](function(){return _0x1bfd8e;});})[_0x50f5('0x20')](function(){_0x1571b2[_0x50f5('0x2c')](0xcc)[_0x50f5('0x2b')]();});}};}function handleEntityNotFound(_0x34d37e,_0x3389f4){return function(_0x4fe1d6){if(!_0x4fe1d6){_0x34d37e[_0x50f5('0x2a')](0x194);}return _0x4fe1d6;};}function handleError(_0x3a923f,_0x24d11f){_0x24d11f=_0x24d11f||0x1f4;return function(_0xb674aa){logger[_0x50f5('0x26')](_0xb674aa[_0x50f5('0x3b')]);if(_0xb674aa[_0x50f5('0x3c')]){delete _0xb674aa['name'];}_0x3a923f['status'](_0x24d11f)[_0x50f5('0x3d')](_0xb674aa);};}exports['index']=function(_0xf184cb,_0x5801c9){var _0x3b3d15={'include':[{'model':db['Pause'],'as':_0x50f5('0x3e')}]},_0x47939e={},_0x44def0={'count':0x0,'rows':[]};var _0x5e5e60=_[_0x50f5('0x3f')](db['WhatsappAccount'][_0x50f5('0x40')],function(_0x311434){return{'name':_0x311434[_0x50f5('0x41')],'type':_0x311434[_0x50f5('0x42')]['key']};});_0x47939e[_0x50f5('0x43')]=_[_0x50f5('0x3f')](_0x5e5e60,_0x50f5('0x3c'));_0x47939e[_0x50f5('0x44')]=_[_0x50f5('0x45')](_0xf184cb['query']);_0x47939e['filters']=_[_0x50f5('0x46')](_0x47939e['model'],_0x47939e[_0x50f5('0x44')]);_0x3b3d15[_0x50f5('0x47')]=_[_0x50f5('0x46')](_0x47939e[_0x50f5('0x43')],qs[_0x50f5('0x48')](_0xf184cb['query'][_0x50f5('0x48')]));_0x3b3d15[_0x50f5('0x47')]=_0x3b3d15['attributes'][_0x50f5('0x49')]?_0x3b3d15[_0x50f5('0x47')]:_0x47939e[_0x50f5('0x43')];if(!_0xf184cb[_0x50f5('0x44')][_0x50f5('0x4a')](_0x50f5('0x4b'))){_0x3b3d15[_0x50f5('0x31')]=qs[_0x50f5('0x31')](_0xf184cb[_0x50f5('0x44')][_0x50f5('0x31')]);_0x3b3d15['offset']=qs[_0x50f5('0x2e')](_0xf184cb[_0x50f5('0x44')][_0x50f5('0x2e')]);}_0x3b3d15[_0x50f5('0x4c')]=qs['sort'](_0xf184cb['query'][_0x50f5('0x4d')]);_0x3b3d15[_0x50f5('0x4e')]=qs['filters'](_[_0x50f5('0x4f')](_0xf184cb['query'],_0x47939e[_0x50f5('0x50')]),_0x5e5e60);if(_0xf184cb['query']['filter']){_0x3b3d15['where']=_[_0x50f5('0x51')](_0x3b3d15['where'],{'$or':_[_0x50f5('0x3f')](_0x5e5e60,function(_0x56cc6c){if(_0x56cc6c[_0x50f5('0x42')]!==_0x50f5('0x52')){var _0x27b092={};_0x27b092[_0x56cc6c[_0x50f5('0x3c')]]={'$like':'%'+_0xf184cb[_0x50f5('0x44')]['filter']+'%'};return _0x27b092;}})});}_0x3b3d15=_[_0x50f5('0x51')]({},_0x3b3d15,_0xf184cb[_0x50f5('0x53')]);var _0x2b6650={'where':_0x3b3d15[_0x50f5('0x4e')]};return db['WhatsappAccount']['count'](_0x2b6650)[_0x50f5('0x20')](function(_0x4f5cae){_0x44def0[_0x50f5('0x30')]=_0x4f5cae;if(_0xf184cb[_0x50f5('0x44')]['includeAll']){_0x3b3d15[_0x50f5('0x54')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x3b3d15);})[_0x50f5('0x20')](function(_0x2d892b){_0x44def0[_0x50f5('0x55')]=_0x2d892b;return _0x44def0;})[_0x50f5('0x20')](respondWithFilteredResult(_0x5801c9,_0x3b3d15))[_0x50f5('0x29')](handleError(_0x5801c9,null));};exports['show']=function(_0x5ed2ab,_0x21ce0b){var _0x22a462={'raw':![],'where':{'id':_0x5ed2ab[_0x50f5('0x56')]['id']},'include':[{'model':db[_0x50f5('0x57')],'as':_0x50f5('0x3e')}]},_0x55fb09={};_0x55fb09[_0x50f5('0x43')]=_[_0x50f5('0x45')](db['WhatsappAccount'][_0x50f5('0x40')]);_0x55fb09[_0x50f5('0x44')]=_[_0x50f5('0x45')](_0x5ed2ab[_0x50f5('0x44')]);_0x55fb09['filters']=_[_0x50f5('0x46')](_0x55fb09['model'],_0x55fb09[_0x50f5('0x44')]);_0x22a462['attributes']=_[_0x50f5('0x46')](_0x55fb09['model'],qs[_0x50f5('0x48')](_0x5ed2ab[_0x50f5('0x44')]['fields']));_0x22a462[_0x50f5('0x47')]=_0x22a462['attributes'][_0x50f5('0x49')]?_0x22a462['attributes']:_0x55fb09[_0x50f5('0x43')];if(_0x5ed2ab[_0x50f5('0x44')][_0x50f5('0x58')]){_0x22a462[_0x50f5('0x54')]=[{'all':!![]}];}_0x22a462=_[_0x50f5('0x51')]({},_0x22a462,_0x5ed2ab[_0x50f5('0x53')]);return db['WhatsappAccount']['find'](_0x22a462)[_0x50f5('0x20')](handleEntityNotFound(_0x21ce0b,null))[_0x50f5('0x20')](respondWithResult(_0x21ce0b,null))[_0x50f5('0x29')](handleError(_0x21ce0b,null));};exports[_0x50f5('0x59')]=function(_0x1debfa,_0x5500a0){return db[_0x50f5('0x5a')][_0x50f5('0x59')](_0x1debfa['body'],{})[_0x50f5('0x20')](function(_0x432392){var _0x45b4fe=_0x1debfa[_0x50f5('0x5b')][_0x50f5('0x38')]({'plain':!![]});if(!_0x45b4fe)throw new Error(_0x50f5('0x5c'));if(_0x45b4fe[_0x50f5('0x5d')]===_0x50f5('0x5b')){var _0x57ca19=_0x432392[_0x50f5('0x38')]({'plain':!![]});var _0x5abfda=_0x50f5('0x39');return db['UserProfileSection'][_0x50f5('0x5e')]({'where':{'name':_0x5abfda,'userProfileId':_0x45b4fe['userProfileId']},'raw':!![]})[_0x50f5('0x20')](function(_0x517527){if(_0x517527&&_0x517527[_0x50f5('0x5f')]===0x0){return db[_0x50f5('0x3a')][_0x50f5('0x59')]({'name':_0x57ca19[_0x50f5('0x3c')],'resourceId':_0x57ca19['id'],'type':_0x517527['name'],'sectionId':_0x517527['id']},{})[_0x50f5('0x20')](function(){return _0x432392;});}else{return _0x432392;}})['catch'](function(_0x32cfd7){logger[_0x50f5('0x26')](_0x50f5('0x60'),_0x32cfd7);throw _0x32cfd7;});}return _0x432392;})[_0x50f5('0x20')](respondWithResult(_0x5500a0,0xc9))['catch'](handleError(_0x5500a0,null));};exports['update']=function(_0xf7a498,_0x2f7e24){if(_0xf7a498['body']['id']){delete _0xf7a498[_0x50f5('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0xf7a498['params']['id']},'include':[{'model':db[_0x50f5('0x57')],'as':'mandatoryDispositionPause'}]})[_0x50f5('0x20')](handleEntityNotFound(_0x2f7e24,null))[_0x50f5('0x20')](saveUpdates(_0xf7a498['body'],null))[_0x50f5('0x20')](respondWithResult(_0x2f7e24,null))[_0x50f5('0x29')](handleError(_0x2f7e24,null));};exports[_0x50f5('0x37')]=function(_0x364267,_0x1519bd){return db[_0x50f5('0x5a')]['find']({'where':{'id':_0x364267[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x1519bd,null))[_0x50f5('0x20')](removeEntity(_0x1519bd,null))[_0x50f5('0x29')](handleError(_0x1519bd,null));};exports['describe']=function(_0x1fcbaf,_0x477ba3){return db[_0x50f5('0x5a')][_0x50f5('0x62')]()[_0x50f5('0x20')](respondWithResult(_0x477ba3,null))[_0x50f5('0x29')](handleError(_0x477ba3,null));};exports[_0x50f5('0x63')]=function(_0x3912e4,_0x2aba15,_0x3349bd){if(_0x3912e4[_0x50f5('0x61')]['id']){delete _0x3912e4[_0x50f5('0x61')]['id'];}return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x3912e4[_0x50f5('0x56')]['id']}})['then'](handleEntityNotFound(_0x2aba15,null))[_0x50f5('0x20')](function(_0x1d8a85){if(_0x1d8a85){_0x3912e4[_0x50f5('0x61')][_0x50f5('0x64')]=_0x1d8a85['id'];return db[_0x50f5('0x65')][_0x50f5('0x59')](_0x3912e4[_0x50f5('0x61')]);}})['then'](respondWithResult(_0x2aba15,null))['catch'](handleError(_0x2aba15,null));};exports[_0x50f5('0x66')]=function(_0x42858b,_0x4e76ed,_0x1d5813){var _0x57ba70={'raw':![],'where':{}};var _0x328977={};var _0x180403={'count':0x0,'rows':[]};return db[_0x50f5('0x5a')][_0x50f5('0x67')]({'where':{'id':_0x42858b[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x4e76ed,null))[_0x50f5('0x20')](function(_0x45002d){if(_0x45002d){_0x328977['model']=_[_0x50f5('0x45')](db[_0x50f5('0x65')][_0x50f5('0x40')]);_0x328977[_0x50f5('0x44')]=_[_0x50f5('0x45')](_0x42858b[_0x50f5('0x44')]);_0x328977[_0x50f5('0x50')]=_[_0x50f5('0x46')](_0x328977[_0x50f5('0x43')],_0x328977[_0x50f5('0x44')]);_0x57ba70[_0x50f5('0x47')]=_[_0x50f5('0x46')](_0x328977[_0x50f5('0x43')],qs[_0x50f5('0x48')](_0x42858b[_0x50f5('0x44')]['fields']));_0x57ba70[_0x50f5('0x47')]=_0x57ba70[_0x50f5('0x47')][_0x50f5('0x49')]?_0x57ba70[_0x50f5('0x47')]:_0x328977[_0x50f5('0x43')];if(!_0x42858b[_0x50f5('0x44')][_0x50f5('0x4a')](_0x50f5('0x4b'))){_0x57ba70['limit']=qs['limit'](_0x42858b[_0x50f5('0x44')][_0x50f5('0x31')]);_0x57ba70[_0x50f5('0x2e')]=qs[_0x50f5('0x2e')](_0x42858b['query'][_0x50f5('0x2e')]);}_0x57ba70[_0x50f5('0x4c')]=qs[_0x50f5('0x4d')](_0x42858b['query'][_0x50f5('0x4d')]);_0x57ba70[_0x50f5('0x4e')]=qs['filters'](_[_0x50f5('0x4f')](_0x42858b['query'],_0x328977['filters']));_0x57ba70[_0x50f5('0x4e')][_0x50f5('0x64')]=_0x45002d['id'];if(_0x42858b[_0x50f5('0x44')][_0x50f5('0x68')]){_0x57ba70[_0x50f5('0x4e')]=_[_0x50f5('0x51')](_0x57ba70[_0x50f5('0x4e')],{'$or':_[_0x50f5('0x3f')](_0x57ba70[_0x50f5('0x47')],function(_0x5c32c4){var _0x1aa080={};_0x1aa080[_0x5c32c4]={'$like':'%'+_0x42858b[_0x50f5('0x44')][_0x50f5('0x68')]+'%'};return _0x1aa080;})});}_0x57ba70=_[_0x50f5('0x51')]({},_0x57ba70,_0x42858b[_0x50f5('0x53')]);return db[_0x50f5('0x65')][_0x50f5('0x30')]({'where':_0x57ba70[_0x50f5('0x4e')]})[_0x50f5('0x20')](function(_0x9073ad){_0x180403['count']=_0x9073ad;if(_0x42858b[_0x50f5('0x44')][_0x50f5('0x58')]){_0x57ba70['include']=[{'all':!![]}];}return db['Disposition'][_0x50f5('0x69')](_0x57ba70);})['then'](function(_0x5bfef2){_0x180403[_0x50f5('0x55')]=_0x5bfef2;return _0x180403;});}})['then'](respondWithFilteredResult(_0x4e76ed,_0x57ba70))[_0x50f5('0x29')](handleError(_0x4e76ed,null));};exports[_0x50f5('0x6a')]=function(_0x472c39,_0x409989,_0x194aef){return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x472c39[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x409989,null))[_0x50f5('0x20')](function(_0x144071){if(_0x144071){return _0x144071[_0x50f5('0x6a')](_0x472c39[_0x50f5('0x44')][_0x50f5('0x6b')]);}})['then'](respondWithStatusCode(_0x409989,null))['catch'](handleError(_0x409989,null));};exports[_0x50f5('0x6c')]=function(_0xe0d135,_0xd48c6d,_0x59eb5f){if(_0xe0d135[_0x50f5('0x61')]['id']){delete _0xe0d135[_0x50f5('0x61')]['id'];}return db[_0x50f5('0x5a')]['find']({'where':{'id':_0xe0d135[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0xd48c6d,null))[_0x50f5('0x20')](function(_0x4c50d2){if(_0x4c50d2){_0xe0d135['body'][_0x50f5('0x64')]=_0x4c50d2['id'];return db['CannedAnswer'][_0x50f5('0x59')](_0xe0d135[_0x50f5('0x61')]);}})[_0x50f5('0x20')](respondWithResult(_0xd48c6d,null))[_0x50f5('0x29')](handleError(_0xd48c6d,null));};exports[_0x50f5('0x6d')]=function(_0x4dad3a,_0x541dc0,_0xe1272a){var _0x584154={'raw':![],'where':{}};var _0x20e25c={};var _0x7f20a8={'count':0x0,'rows':[]};return db[_0x50f5('0x5a')]['findOne']({'where':{'id':_0x4dad3a[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x541dc0,null))['then'](function(_0x267586){if(_0x267586){_0x20e25c[_0x50f5('0x43')]=_['keys'](db[_0x50f5('0x6e')][_0x50f5('0x40')]);_0x20e25c[_0x50f5('0x44')]=_[_0x50f5('0x45')](_0x4dad3a[_0x50f5('0x44')]);_0x20e25c[_0x50f5('0x50')]=_[_0x50f5('0x46')](_0x20e25c[_0x50f5('0x43')],_0x20e25c[_0x50f5('0x44')]);_0x584154['attributes']=_[_0x50f5('0x46')](_0x20e25c[_0x50f5('0x43')],qs[_0x50f5('0x48')](_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x48')]));_0x584154[_0x50f5('0x47')]=_0x584154[_0x50f5('0x47')][_0x50f5('0x49')]?_0x584154[_0x50f5('0x47')]:_0x20e25c['model'];if(!_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x4a')](_0x50f5('0x4b'))){_0x584154[_0x50f5('0x31')]=qs['limit'](_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x31')]);_0x584154[_0x50f5('0x2e')]=qs[_0x50f5('0x2e')](_0x4dad3a[_0x50f5('0x44')]['offset']);}_0x584154['order']=qs['sort'](_0x4dad3a[_0x50f5('0x44')]['sort']);_0x584154['where']=qs[_0x50f5('0x50')](_[_0x50f5('0x4f')](_0x4dad3a[_0x50f5('0x44')],_0x20e25c[_0x50f5('0x50')]));_0x584154[_0x50f5('0x4e')][_0x50f5('0x64')]=_0x267586['id'];if(_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x68')]){_0x584154['where']=_[_0x50f5('0x51')](_0x584154[_0x50f5('0x4e')],{'$or':_['map'](_0x584154[_0x50f5('0x47')],function(_0x4633bc){var _0x5d0511={};_0x5d0511[_0x4633bc]={'$like':'%'+_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x68')]+'%'};return _0x5d0511;})});}_0x584154=_['merge']({},_0x584154,_0x4dad3a[_0x50f5('0x53')]);return db['CannedAnswer'][_0x50f5('0x30')]({'where':_0x584154[_0x50f5('0x4e')]})['then'](function(_0xc28357){_0x7f20a8[_0x50f5('0x30')]=_0xc28357;if(_0x4dad3a[_0x50f5('0x44')][_0x50f5('0x58')]){_0x584154[_0x50f5('0x54')]=[{'all':!![]}];}return db[_0x50f5('0x6e')][_0x50f5('0x69')](_0x584154);})[_0x50f5('0x20')](function(_0x23ba44){_0x7f20a8[_0x50f5('0x55')]=_0x23ba44;return _0x7f20a8;});}})[_0x50f5('0x20')](respondWithFilteredResult(_0x541dc0,_0x584154))['catch'](handleError(_0x541dc0,null));};exports['removeAnswers']=function(_0x41dc07,_0x4a5d76,_0x10233a){return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x41dc07['params']['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x4a5d76,null))[_0x50f5('0x20')](function(_0x34aa14){if(_0x34aa14){return _0x34aa14[_0x50f5('0x6f')](_0x41dc07[_0x50f5('0x44')]['ids']);}})[_0x50f5('0x20')](respondWithStatusCode(_0x4a5d76,null))['catch'](handleError(_0x4a5d76,null));};exports['addAgents']=function(_0x27e4cd,_0x282516,_0x103e41){return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x27e4cd['params']['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x282516,null))['then'](function(_0x3463af){if(_0x3463af){return _0x3463af[_0x50f5('0x70')](_0x27e4cd['body'][_0x50f5('0x6b')],_[_0x50f5('0x71')](_0x27e4cd[_0x50f5('0x61')],[_0x50f5('0x6b'),'id'])||{})[_0x50f5('0x72')](function(_0xcfa34b){for(var _0xe0ddd7=0x0;_0xe0ddd7<_0x27e4cd[_0x50f5('0x61')]['ids'][_0x50f5('0x49')];_0xe0ddd7+=0x1){socket[_0x50f5('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x27e4cd[_0x50f5('0x61')][_0x50f5('0x6b')][_0xe0ddd7]),'WhatsappAccountId':Number(_0x27e4cd['params']['id'])});}return _0xcfa34b;});}})[_0x50f5('0x20')](respondWithResult(_0x282516,null))['catch'](handleError(_0x282516,null));};exports[_0x50f5('0x74')]=function(_0x2eaa71,_0x19fb2a,_0x49def7){return db[_0x50f5('0x5a')]['find']({'where':{'id':_0x2eaa71['params']['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x19fb2a,null))[_0x50f5('0x20')](function(_0x552969){if(_0x552969){return _0x552969[_0x50f5('0x74')](_0x2eaa71['query']['ids'])['then'](function(){if(_[_0x50f5('0x75')](_0x2eaa71[_0x50f5('0x44')]['ids'])){for(var _0x50f349=0x0;_0x50f349<_0x2eaa71['query'][_0x50f5('0x6b')][_0x50f5('0x49')];_0x50f349+=0x1){socket[_0x50f5('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x2eaa71[_0x50f5('0x44')][_0x50f5('0x6b')][_0x50f349]),'WhatsappAccountId':Number(_0x2eaa71[_0x50f5('0x56')]['id'])});}}else{socket[_0x50f5('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x2eaa71[_0x50f5('0x44')][_0x50f5('0x6b')]),'WhatsappAccountId':Number(_0x2eaa71[_0x50f5('0x56')]['id'])});}});}})[_0x50f5('0x20')](respondWithStatusCode(_0x19fb2a,null))[_0x50f5('0x29')](handleError(_0x19fb2a,null));};exports[_0x50f5('0x76')]=function(_0x2d3107,_0x2ce244,_0x652e39){var _0x5c4b38={};var _0x1a34ae={};var _0x55f253;var _0xef540;return db[_0x50f5('0x5a')]['findOne']({'where':{'id':_0x2d3107[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x2ce244,null))[_0x50f5('0x20')](function(_0x5b5d3b){if(_0x5b5d3b){_0x55f253=_0x5b5d3b;_0x1a34ae[_0x50f5('0x43')]=_[_0x50f5('0x45')](db[_0x50f5('0x77')][_0x50f5('0x40')]);_0x1a34ae[_0x50f5('0x44')]=_['keys'](_0x2d3107[_0x50f5('0x44')]);_0x1a34ae[_0x50f5('0x50')]=_[_0x50f5('0x46')](_0x1a34ae['model'],_0x1a34ae[_0x50f5('0x44')]);_0x5c4b38[_0x50f5('0x47')]=_[_0x50f5('0x46')](_0x1a34ae[_0x50f5('0x43')],qs[_0x50f5('0x48')](_0x2d3107[_0x50f5('0x44')]['fields']));_0x5c4b38[_0x50f5('0x47')]=_0x5c4b38[_0x50f5('0x47')][_0x50f5('0x49')]?_0x5c4b38['attributes']:_0x1a34ae['model'];_0x5c4b38['order']=qs[_0x50f5('0x4d')](_0x2d3107[_0x50f5('0x44')]['sort']);_0x5c4b38[_0x50f5('0x4e')]=qs[_0x50f5('0x50')](_['pick'](_0x2d3107[_0x50f5('0x44')],_0x1a34ae[_0x50f5('0x50')]));if(_0x2d3107[_0x50f5('0x44')][_0x50f5('0x68')]){_0x5c4b38[_0x50f5('0x4e')]=_[_0x50f5('0x51')](_0x5c4b38[_0x50f5('0x4e')],{'$or':_[_0x50f5('0x3f')](_0x5c4b38[_0x50f5('0x47')],function(_0x1b4228){var _0x28a682={};_0x28a682[_0x1b4228]={'$like':'%'+_0x2d3107[_0x50f5('0x44')][_0x50f5('0x68')]+'%'};return _0x28a682;})});}_0x5c4b38=_[_0x50f5('0x51')]({},_0x5c4b38,_0x2d3107[_0x50f5('0x53')]);return _0x55f253['getAgents'](_0x5c4b38);}})[_0x50f5('0x20')](function(_0xc44c00){if(_0xc44c00){_0xef540=_0xc44c00[_0x50f5('0x49')];if(!_0x2d3107[_0x50f5('0x44')][_0x50f5('0x4a')]('nolimit')){_0x5c4b38[_0x50f5('0x31')]=qs[_0x50f5('0x31')](_0x2d3107[_0x50f5('0x44')]['limit']);_0x5c4b38[_0x50f5('0x2e')]=qs[_0x50f5('0x2e')](_0x2d3107[_0x50f5('0x44')]['offset']);}return _0x55f253[_0x50f5('0x76')](_0x5c4b38);}})[_0x50f5('0x20')](function(_0xacf8f4){if(_0xacf8f4){return _0xacf8f4?{'count':_0xef540,'rows':_0xacf8f4}:null;}})['then'](respondWithResult(_0x2ce244,null))[_0x50f5('0x29')](handleError(_0x2ce244,null));};exports[_0x50f5('0x78')]=function(_0x5239d0,_0x31ca4a){var _0x402ea9=_0x5239d0[_0x50f5('0x56')]['id'];var _0x18d4f5=_0x5239d0[_0x50f5('0x61')];var _0x19dc86=0xc8;var _0x476edd=null;return db[_0x50f5('0x79')][_0x50f5('0x7a')]({'isolationLevel':db[_0x50f5('0x79')][_0x50f5('0x7b')][_0x50f5('0x7c')][_0x50f5('0x7d')]},function(_0x68477d){return db[_0x50f5('0x5a')]['findOne']({'where':{'id':_0x402ea9},'transaction':_0x68477d})[_0x50f5('0x20')](function(_0x5c3672){if(_0x5c3672){return db[_0x50f5('0x7e')][_0x50f5('0x37')]({'where':{'WhatsappAccountId':_0x402ea9},'transaction':_0x68477d})['then'](function(){var _0x152746=_[_0x50f5('0x3f')](_0x18d4f5,function(_0x3c9b9b){_0x3c9b9b[_0x50f5('0x64')]=_0x402ea9;return _0x3c9b9b;});return db[_0x50f5('0x7e')][_0x50f5('0x7f')](_0x152746,{'transaction':_0x68477d});});}else{_0x19dc86=0x194;_0x476edd=[];}});})[_0x50f5('0x20')](function(){if(_0x19dc86!==0x194){return db[_0x50f5('0x7e')][_0x50f5('0x80')]({'where':{'WhatsappAccountId':_0x402ea9},'order':_0x50f5('0x81')})['then'](function(_0x164213){_0x476edd=_0x164213;});}})['catch'](function(_0x4c68e4){_0x19dc86=0x1f4;logger[_0x50f5('0x26')](_0x4c68e4['stack']);if(_0x4c68e4[_0x50f5('0x3c')]){delete _0x4c68e4[_0x50f5('0x3c')];}_0x476edd=_0x4c68e4;})['finally'](function(){if(_0x476edd===null){_0x31ca4a[_0x50f5('0x2a')](_0x19dc86);}else{if(_0x19dc86===0x1f4){_0x31ca4a[_0x50f5('0x2c')](_0x19dc86)[_0x50f5('0x3d')](_0x476edd);}else{_0x31ca4a[_0x50f5('0x2c')](_0x19dc86)[_0x50f5('0x2d')](_0x476edd);}}});};exports['getApplications']=function(_0x366809,_0x5dfef3,_0xcc77d){var _0x3774ce={};var _0x573874={};var _0x45f7d5;var _0x21982a;return db[_0x50f5('0x5a')][_0x50f5('0x67')]({'where':{'id':_0x366809[_0x50f5('0x56')]['id']}})[_0x50f5('0x20')](handleEntityNotFound(_0x5dfef3,null))[_0x50f5('0x20')](function(_0x6e425c){if(_0x6e425c){_0x45f7d5=_0x6e425c;_0x573874['model']=_['keys'](db['WhatsappApplication'][_0x50f5('0x40')]);_0x573874[_0x50f5('0x44')]=_[_0x50f5('0x45')](_0x366809[_0x50f5('0x44')]);_0x573874['filters']=_['intersection'](_0x573874['model'],_0x573874[_0x50f5('0x44')]);_0x3774ce[_0x50f5('0x47')]=_[_0x50f5('0x46')](_0x573874['model'],qs[_0x50f5('0x48')](_0x366809[_0x50f5('0x44')][_0x50f5('0x48')]));_0x3774ce[_0x50f5('0x47')]=_0x3774ce[_0x50f5('0x47')][_0x50f5('0x49')]?_0x3774ce[_0x50f5('0x47')]:_0x573874[_0x50f5('0x43')];_0x3774ce[_0x50f5('0x4c')]=qs[_0x50f5('0x4d')](_0x366809[_0x50f5('0x44')]['sort']);_0x3774ce[_0x50f5('0x4e')]=qs[_0x50f5('0x50')](_[_0x50f5('0x4f')](_0x366809[_0x50f5('0x44')],_0x573874[_0x50f5('0x50')]));if(_0x366809[_0x50f5('0x44')][_0x50f5('0x68')]){_0x3774ce[_0x50f5('0x4e')]=_[_0x50f5('0x51')](_0x3774ce[_0x50f5('0x4e')],{'$or':_['map'](_0x3774ce[_0x50f5('0x47')],function(_0x3b1a9d){var _0x4bfdf6={};_0x4bfdf6[_0x3b1a9d]={'$like':'%'+_0x366809[_0x50f5('0x44')][_0x50f5('0x68')]+'%'};return _0x4bfdf6;})});}_0x3774ce=_[_0x50f5('0x51')]({},_0x3774ce,_0x366809['options']);return _0x45f7d5['getApplications'](_0x3774ce);}})[_0x50f5('0x20')](function(_0x1326f8){if(_0x1326f8){_0x21982a=_0x1326f8[_0x50f5('0x49')];if(!_0x366809[_0x50f5('0x44')][_0x50f5('0x4a')]('nolimit')){_0x3774ce[_0x50f5('0x31')]=qs[_0x50f5('0x31')](_0x366809[_0x50f5('0x44')][_0x50f5('0x31')]);_0x3774ce[_0x50f5('0x2e')]=qs[_0x50f5('0x2e')](_0x366809[_0x50f5('0x44')][_0x50f5('0x2e')]);}return _0x45f7d5[_0x50f5('0x82')](_0x3774ce);}})[_0x50f5('0x20')](function(_0xd639d1){if(_0xd639d1){return _0xd639d1?{'count':_0x21982a,'rows':_0xd639d1}:null;}})[_0x50f5('0x20')](respondWithResult(_0x5dfef3,null))['catch'](handleError(_0x5dfef3,null));};exports[_0x50f5('0x83')]=function(_0x416f28,_0x539498,_0x158bcc){var _0x3f8ff5={'channel':'whatsapp'};var _0x104801=[];var _0x2a463b=[];var _0x2ed8c1={};return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x416f28[_0x50f5('0x56')]['id']},'include':[{'model':db[_0x50f5('0x7e')],'as':_0x50f5('0x84')}]})[_0x50f5('0x20')](handleEntityNotFound(_0x539498,null))['then'](function(_0x42095a){_0x3f8ff5['account']=_0x42095a;if(_0x3f8ff5['account']&&_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x42')]==='sinch'&&_0x416f28[_0x50f5('0x61')][_0x50f5('0x86')]){if(_0x416f28['body'][_0x50f5('0x86')]['length']===0x0)return;if(_0x416f28[_0x50f5('0x61')][_0x50f5('0x86')][0x0]['state']!=='read')return;return db[_0x50f5('0x87')]['update']({'read':!![],'readAt':_0x416f28['body'][_0x50f5('0x86')][0x0][_0x50f5('0x88')]},{'where':{'messageId':_0x416f28[_0x50f5('0x61')][_0x50f5('0x86')][0x0]['message_id']},'individualHooks':!![]})[_0x50f5('0x20')](function(_0x19b1d8){return _0x539498[_0x50f5('0x2c')](0xc8)[_0x50f5('0x2d')](_0x19b1d8);});}_0x3f8ff5[_0x50f5('0x89')]=_[_0x50f5('0x8a')](_0x42095a[_0x50f5('0x84')],['priority'],['asc']);if(_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x84')]){delete _0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x84')];}return db[_0x50f5('0x8b')][_0x50f5('0x62')]()[_0x50f5('0x20')](function(_0x25d9b0){if(!_0x25d9b0){throw new db['Sequelize'][(_0x50f5('0x8c'))](_0x50f5('0x8d'));}_0x104801=_[_0x50f5('0x8e')](_[_0x50f5('0x45')](_0x25d9b0),[_0x50f5('0x8f'),_0x50f5('0x90')]);_0x2a463b=_[_0x50f5('0x8e')](_['keys'](_0x25d9b0),[_0x50f5('0x8f'),_0x50f5('0x90'),'CompanyId',_0x50f5('0x91')]);_0x3f8ff5['body']={'mapKey':_0x50f5('0x92')};if(_0x3f8ff5['account']&&_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x42')]==='twilio'){_0x3f8ff5[_0x50f5('0x61')]['from']=_0x416f28[_0x50f5('0x61')][_0x50f5('0x93')]['replace'](_0x50f5('0x94'),'');_0x3f8ff5[_0x50f5('0x61')]['body']=_0x416f28['body'][_0x50f5('0x95')];_0x3f8ff5[_0x50f5('0x61')]['messageId']=_0x416f28[_0x50f5('0x61')][_0x50f5('0x96')];}if(_0x3f8ff5[_0x50f5('0x85')]&&_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x42')]===_0x50f5('0x97')){_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')]=_0x416f28[_0x50f5('0x61')][_0x50f5('0x99')][0x0][_0x50f5('0x98')];_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x61')]=_0x416f28[_0x50f5('0x61')][_0x50f5('0x99')][0x0][_0x50f5('0x27')]['body'];_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x9a')]=_0x416f28['body'][_0x50f5('0x99')][0x0]['message_id'];}if(_0x3f8ff5[_0x50f5('0x61')]['id']){delete _0x3f8ff5[_0x50f5('0x61')]['id'];}if(_[_0x50f5('0x9b')](_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')])){throw new db[(_0x50f5('0x9c'))][(_0x50f5('0x8c'))](_0x50f5('0x9d'));}if(_[_0x50f5('0x9b')](_0x3f8ff5[_0x50f5('0x61')]['body'])||_0x3f8ff5['body'][_0x50f5('0x61')]===''){throw new db[(_0x50f5('0x9c'))]['ValidationError'](_0x50f5('0x9e'));}if(_[_0x50f5('0x9b')](_0x3f8ff5[_0x50f5('0x61')]['mapKey'])){throw new db[(_0x50f5('0x9c'))][(_0x50f5('0x8c'))](_0x50f5('0x9f')+_0x2a463b);}if(!_['includes'](_0x2a463b,_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0xa0')])){throw new db['Sequelize'][(_0x50f5('0x8c'))](_0x50f5('0xa1')+_0x2a463b);}_0x2ed8c1[_0x3f8ff5['body'][_0x50f5('0xa0')]]=_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')];return db[_0x50f5('0xa2')][_0x50f5('0x5e')]({'where':{'id':_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x91')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2ed8c1,'limit':0x1,'order':[[_0x50f5('0x90'),'DESC']]}]});})[_0x50f5('0x20')](handleEntityNotFound(_0x539498,null))[_0x50f5('0x20')](function(_0x46505c){if(_0x46505c){_0x3f8ff5['list']=_[_0x50f5('0x71')](_0x46505c,['Contacts']);if(_0x46505c[_0x50f5('0xa3')]['length']){return _0x46505c[_0x50f5('0xa3')][0x0];}var _0x579629=_[_0x50f5('0xa4')](_0x3f8ff5['body'],{'firstName':_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')],'ListId':_0x46505c['id']});_0x579629[_0x3f8ff5[_0x50f5('0x61')]['mapKey']]=_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')];return db['CmContact'][_0x50f5('0x59')](_0x579629,{'fields':_0x104801,'raw':!![]});}})[_0x50f5('0x20')](handleEntityNotFound(_0x539498,null))[_0x50f5('0x20')](function(_0x21602a){if(_0x21602a){_0x3f8ff5[_0x50f5('0xa5')]=_0x21602a;var _0x44e598={'ContactId':_0x21602a['id'],'phone':_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')],'WhatsappAccountId':_0x416f28[_0x50f5('0x56')]['id']};var _0x51cf5b={'ContactId':_0x21602a['id'],'WhatsappAccountId':_0x416f28[_0x50f5('0x56')]['id'],'closed':![]};return db[_0x50f5('0xa6')][_0x50f5('0x5e')]({'where':_0x51cf5b})[_0x50f5('0x20')](function(_0x2fc965){if(_0x2fc965){return[_0x2fc965,![]];}return db[_0x50f5('0xa6')]['create'](_0x44e598)[_0x50f5('0x20')](function(_0x50bb91){return[_0x50bb91,!![]];});});}})[_0x50f5('0x72')](function(_0x44cda5,_0x460e7d){_0x3f8ff5[_0x50f5('0xa7')]=_0x44cda5['get']({'plain':!![]});_0x3f8ff5[_0x50f5('0xa7')][_0x50f5('0xa8')]=![];if(_0x460e7d){if(_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0xa9')]){_0x3f8ff5[_0x50f5('0x89')]['push']({'id':0x0,'priority':_0x3f8ff5['applications'][_0x50f5('0x49')]+0x1,'app':_0x50f5('0xaa'),'appdata':'unmanaged','interval':_0x50f5('0xab')});}_0x3f8ff5[_0x50f5('0xa7')][_0x50f5('0xa8')]=!![];}return db[_0x50f5('0x87')][_0x50f5('0x59')]({'phone':_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x98')],'messageId':_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x9a')],'body':_0x3f8ff5[_0x50f5('0x61')][_0x50f5('0x61')],'WhatsappAccountId':_0x416f28[_0x50f5('0x56')]['id'],'WhatsappInteractionId':_0x44cda5['id'],'direction':'in','ContactId':_0x44cda5[_0x50f5('0xac')],'AttachmentId':_0x3f8ff5[_0x50f5('0x61')]['AttachmentId']});})['then'](function(_0x44a78d){_0x3f8ff5[_0x50f5('0x27')]=_0x44a78d;if(_0x3f8ff5['interaction'][_0x50f5('0xad')]){return db['User'][_0x50f5('0x5e')]({'attributes':['id',_0x50f5('0x3c')],'where':{'id':_0x3f8ff5['interaction'][_0x50f5('0xad')]}})[_0x50f5('0x20')](function(_0x6d696b){if(_0x6d696b){_0x3f8ff5[_0x50f5('0x89')][_0x50f5('0xae')]({'id':0x0,'priority':0x0,'app':_0x50f5('0xaf'),'appdata':_0x6d696b[_0x50f5('0x3c')]+','+(_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0xb0')]||0xa),'interval':_0x50f5('0xab')});}return respondWithRpcPromise(_0x50f5('0xb1'),_0x50f5('0xb2'),_0x3f8ff5);});}return respondWithRpcPromise('Start',_0x50f5('0xb2'),_0x3f8ff5);})[_0x50f5('0x20')](function(_0xa3fe8e){if(_0xa3fe8e){var _0x40a1d7=0xc8;var _0x133940=_0x50f5('0xb3');logger[_0x50f5('0x21')](_0x50f5('0x24'),_0x133940,_0x40a1d7,_0x50f5('0xb4'));logger['debug'](_0x50f5('0xb5'),_0x133940,_0x40a1d7,'entity\x20found',JSON[_0x50f5('0x25')](_0xa3fe8e));if(_0x3f8ff5[_0x50f5('0x85')][_0x50f5('0x42')]===_0x50f5('0xb6')){return _0x539498['status'](_0x40a1d7)[_0x50f5('0x32')](_0x50f5('0xb7'),_0x50f5('0xb8'))[_0x50f5('0x3d')](_0x50f5('0xb9'));}else{return _0x539498[_0x50f5('0x2c')](_0x40a1d7)['json'](_0xa3fe8e);}}});})[_0x50f5('0x29')](handleError(_0x539498,null));};exports[_0x50f5('0x3d')]=function(_0x16e5f1,_0x41a0c3,_0x29783c){var _0x18dd60,_0x335bd8,_0x1e862c;if(_[_0x50f5('0x9b')](_0x16e5f1[_0x50f5('0x61')][_0x50f5('0x61')])||_0x16e5f1['body'][_0x50f5('0x61')]===''){throw new db[(_0x50f5('0x9c'))]['ValidationError'](_0x50f5('0x9e'));}if(_['isNil'](_0x16e5f1[_0x50f5('0x61')]['to'])){throw new db[(_0x50f5('0x9c'))][(_0x50f5('0x8c'))](_0x50f5('0xba'));}_0x18dd60=_0x16e5f1[_0x50f5('0x61')]['to'];return db[_0x50f5('0x5a')][_0x50f5('0x5e')]({'where':{'id':_0x16e5f1[_0x50f5('0x56')]['id']},'include':[{'model':db[_0x50f5('0xa2')],'as':_0x50f5('0xbb'),'include':[{'model':db[_0x50f5('0x8b')],'as':_0x50f5('0xa3'),'where':{'mobile':_0x18dd60},'limit':0x1,'order':[[_0x50f5('0x90'),'DESC']]}]}]})[_0x50f5('0x20')](handleEntityNotFound(_0x41a0c3,null))[_0x50f5('0x20')](function(_0x3828f6){if(_0x3828f6&&_0x3828f6[_0x50f5('0xbb')]){_0x335bd8=_0x3828f6[_0x50f5('0x38')]({'plain':!![]});if(_0x335bd8[_0x50f5('0xbb')]&&_0x335bd8['List'][_0x50f5('0xa3')]['length']){return _0x335bd8['List'][_0x50f5('0xa3')][0x0];}return db[_0x50f5('0x8b')][_0x50f5('0x59')](_[_0x50f5('0xa4')](_0x16e5f1[_0x50f5('0x61')],{'firstName':_0x18dd60,'mobile':_0x18dd60,'phone':_0x18dd60,'ListId':_0x335bd8[_0x50f5('0x91')]}));}})[_0x50f5('0x20')](handleEntityNotFound(_0x41a0c3,null))[_0x50f5('0x20')](function(_0x2dff74){if(_0x2dff74){_0x1e862c=_0x2dff74;return db[_0x50f5('0xa6')][_0x50f5('0x5e')]({'where':{'ContactId':_0x1e862c['id'],'closed':![],'WhatsappAccountId':_0x335bd8['id']}})[_0x50f5('0x20')](function(_0x22cbd7){if(_0x22cbd7){return[_0x22cbd7,![]];}return db[_0x50f5('0xa6')][_0x50f5('0x59')]({'UserId':_0x16e5f1['user']['id'],'ContactId':_0x1e862c['id'],'WhatsappAccountId':_0x335bd8['id'],'phone':_0x18dd60,'firstMsgDirection':_0x50f5('0xbc'),'Messages':[_[_0x50f5('0x51')](_0x16e5f1[_0x50f5('0x61')],{'read':![],'body':_0x16e5f1['body'][_0x50f5('0x61')],'phone':_0x18dd60,'WhatsappAccountId':_0x335bd8['id'],'UserId':_0x16e5f1['user']['id'],'ContactId':_0x1e862c['id']})]},{'include':[{'model':db[_0x50f5('0x87')],'as':_0x50f5('0xbd')}]})[_0x50f5('0x20')](function(_0x3402f7){return[_0x3402f7,!![]];});});}})[_0x50f5('0x72')](function(_0x53642a,_0x559214){if(_0x559214){return _0x53642a;}return db[_0x50f5('0x87')][_0x50f5('0x59')](_[_0x50f5('0x51')](_0x16e5f1['body'],{'read':![],'body':_0x16e5f1['body'][_0x50f5('0x61')],'phone':_0x18dd60,'WhatsappAccountId':_0x335bd8['id'],'WhatsappInteractionId':_0x53642a['id'],'UserId':_0x16e5f1[_0x50f5('0x5b')]['id'],'ContactId':_0x1e862c['id']}))[_0x50f5('0x20')](function(_0x20538f){_0x53642a[_0x50f5('0xbe')][_0x50f5('0xbd')]=[];_0x53642a[_0x50f5('0xbe')]['Messages'][_0x50f5('0xbf')](_0x20538f[_0x50f5('0xbe')]);return _0x53642a;});})['then'](respondWithResult(_0x41a0c3,null))['catch'](handleError(_0x41a0c3,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 13c00ce..ad18f9d 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 _0xdbf8=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x5950e7,_0x43a5bb){var _0x47494d=function(_0x275377){while(--_0x275377){_0x5950e7['push'](_0x5950e7['shift']());}};_0x47494d(++_0x43a5bb);}(_0xdbf8,0x179));var _0x8dbf=function(_0x5de503,_0x377081){_0x5de503=_0x5de503-0x0;var _0x1ab941=_0xdbf8[_0x5de503];return _0x1ab941;};'use strict';var EventEmitter=require(_0x8dbf('0x0'));var WhatsappAccount=require(_0x8dbf('0x1'))['db'][_0x8dbf('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8dbf('0x3'),'afterUpdate':_0x8dbf('0x4'),'afterDestroy':_0x8dbf('0x5')};function emitEvent(_0x57a1d9){return function(_0xcf5b06,_0x4bdcea,_0x58c2e9){WhatsappAccountEvents[_0x8dbf('0x6')](_0x57a1d9+':'+_0xcf5b06['id'],_0xcf5b06);WhatsappAccountEvents[_0x8dbf('0x6')](_0x57a1d9,_0xcf5b06);_0x58c2e9(null);};}for(var e in events){if(events[_0x8dbf('0x7')](e)){var event=events[e];WhatsappAccount[_0x8dbf('0x8')](e,emitEvent(event));}}module[_0x8dbf('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xda72=['exports','WhatsappAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x394200,_0x41c5b9){var _0x3c08b3=function(_0x4fee64){while(--_0x4fee64){_0x394200['push'](_0x394200['shift']());}};_0x3c08b3(++_0x41c5b9);}(_0xda72,0x197));var _0x2da7=function(_0x13b5c0,_0x5f3fdf){_0x13b5c0=_0x13b5c0-0x0;var _0x34341f=_0xda72[_0x13b5c0];return _0x34341f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x2da7('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2da7('0x1'),'afterUpdate':_0x2da7('0x2'),'afterDestroy':_0x2da7('0x3')};function emitEvent(_0x435624){return function(_0x29084e,_0xaf7b2a,_0x5d01d){WhatsappAccountEvents[_0x2da7('0x4')](_0x435624+':'+_0x29084e['id'],_0x29084e);WhatsappAccountEvents[_0x2da7('0x4')](_0x435624,_0x29084e);_0x5d01d(null);};}for(var e in events){if(events[_0x2da7('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2da7('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index dce16f5..56717b3 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 _0x498c=['../../config/environment','./whatsappAccount.attributes','define','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x458ced,_0x25a6f1){var _0x2ee991=function(_0x4bd326){while(--_0x4bd326){_0x458ced['push'](_0x458ced['shift']());}};_0x2ee991(++_0x25a6f1);}(_0x498c,0x197));var _0xc498=function(_0x1245c1,_0x4d0f6e){_0x1245c1=_0x1245c1-0x0;var _0x140053=_0x498c[_0x1245c1];return _0x140053;};'use strict';var _=require(_0xc498('0x0'));var util=require(_0xc498('0x1'));var logger=require(_0xc498('0x2'))(_0xc498('0x3'));var moment=require(_0xc498('0x4'));var BPromise=require(_0xc498('0x5'));var rp=require(_0xc498('0x6'));var fs=require('fs');var path=require(_0xc498('0x7'));var rimraf=require(_0xc498('0x8'));var config=require(_0xc498('0x9'));var attributes=require(_0xc498('0xa'));module['exports']=function(_0x4cbd58,_0x40af5e){return _0x4cbd58[_0xc498('0xb')]('WhatsappAccount',attributes,{'tableName':_0xc498('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61e4=['path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','bluebird'];(function(_0x345517,_0x52222e){var _0x23d441=function(_0x2df73c){while(--_0x2df73c){_0x345517['push'](_0x345517['shift']());}};_0x23d441(++_0x52222e);}(_0x61e4,0x147));var _0x461e=function(_0x4aec3f,_0x2de89f){_0x4aec3f=_0x4aec3f-0x0;var _0x4f10cc=_0x61e4[_0x4aec3f];return _0x4f10cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x461e('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x461e('0x1'));var rimraf=require('rimraf');var config=require(_0x461e('0x2'));var attributes=require(_0x461e('0x3'));module[_0x461e('0x4')]=function(_0x3ba700,_0x1bd771){return _0x3ba700[_0x461e('0x5')](_0x461e('0x6'),attributes,{'tableName':_0x461e('0x7'),'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 82a3e29..c29c3e0 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 _0xe0bf=['find','options','raw','where','attributes','include','map','model','ShowWhatsappAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','defaults','redis','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','WhatsappAccount'];(function(_0x3e6b2f,_0x1ffa07){var _0x323215=function(_0x5c4d82){while(--_0x5c4d82){_0x3e6b2f['push'](_0x3e6b2f['shift']());}};_0x323215(++_0x1ffa07);}(_0xe0bf,0x75));var _0xfe0b=function(_0x20fc9d,_0xf1ebd7){_0x20fc9d=_0x20fc9d-0x0;var _0x5ca40a=_0xe0bf[_0x20fc9d];return _0x5ca40a;};'use strict';var _=require(_0xfe0b('0x0'));var util=require(_0xfe0b('0x1'));var moment=require(_0xfe0b('0x2'));var BPromise=require(_0xfe0b('0x3'));var rs=require(_0xfe0b('0x4'));var fs=require('fs');var Redis=require(_0xfe0b('0x5'));var db=require(_0xfe0b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfe0b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe0b('0x8')][_0xfe0b('0x9')]({'port':0x232a});config['redis']=_[_0xfe0b('0xa')](config[_0xfe0b('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfe0b('0xb')]));require('./whatsappAccount.socket')[_0xfe0b('0xc')](socket);function respondWithRpcPromise(_0x295dd9,_0x102e4d,_0x18507c){return new BPromise(function(_0x184b4f,_0x278e90){return client[_0xfe0b('0xd')](_0x295dd9,_0x18507c)[_0xfe0b('0xe')](function(_0x40d9f9){logger['info'](_0xfe0b('0xf'),_0x102e4d,_0xfe0b('0x10'));logger[_0xfe0b('0x11')](_0xfe0b('0x12'),_0x102e4d,_0xfe0b('0x10'),JSON[_0xfe0b('0x13')](_0x40d9f9));if(_0x40d9f9[_0xfe0b('0x14')]){if(_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x15')]===0x1f4){logger[_0xfe0b('0x14')](_0xfe0b('0xf'),_0x102e4d,_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x16')]);return _0x278e90(_0x40d9f9[_0xfe0b('0x14')]['message']);}logger[_0xfe0b('0x14')](_0xfe0b('0xf'),_0x102e4d,_0x40d9f9['error'][_0xfe0b('0x16')]);return _0x184b4f(_0x40d9f9[_0xfe0b('0x14')][_0xfe0b('0x16')]);}else{logger[_0xfe0b('0x17')](_0xfe0b('0xf'),_0x102e4d,_0xfe0b('0x10'));_0x184b4f(_0x40d9f9[_0xfe0b('0x18')][_0xfe0b('0x16')]);}})[_0xfe0b('0x19')](function(_0x1dea71){logger['error'](_0xfe0b('0xf'),_0x102e4d,_0x1dea71);_0x278e90(_0x1dea71);});});}exports['ShowWhatsappAccount']=function(_0x4ec272){var _0x396487=this;return new Promise(function(_0x1b0e9a,_0x1ecdff){return db[_0xfe0b('0x1a')][_0xfe0b('0x1b')]({'raw':_0x4ec272[_0xfe0b('0x1c')]?_0x4ec272['options'][_0xfe0b('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ec272[_0xfe0b('0x1c')]?_0x4ec272['options'][_0xfe0b('0x1e')]||null:null,'attributes':_0x4ec272['options']?_0x4ec272['options'][_0xfe0b('0x1f')]||null:null,'include':_0x4ec272['options']?_0x4ec272[_0xfe0b('0x1c')][_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x4ec272[_0xfe0b('0x1c')]['include'],function(_0x4261c4){return{'model':db[_0x4261c4[_0xfe0b('0x22')]],'as':_0x4261c4['as'],'attributes':_0x4261c4[_0xfe0b('0x1f')],'include':_0x4261c4[_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x4261c4[_0xfe0b('0x20')],function(_0x2cf3d5){return{'model':db[_0x2cf3d5[_0xfe0b('0x22')]],'as':_0x2cf3d5['as'],'attributes':_0x2cf3d5['attributes'],'include':_0x2cf3d5[_0xfe0b('0x20')]?_[_0xfe0b('0x21')](_0x2cf3d5['include'],function(_0x449b44){return{'model':db[_0x449b44[_0xfe0b('0x22')]],'as':_0x449b44['as'],'attributes':_0x449b44[_0xfe0b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfe0b('0xe')](function(_0x596f41){logger[_0xfe0b('0x17')]('ShowWhatsappAccount',_0x4ec272);logger['debug'](_0xfe0b('0x23'),_0x4ec272,JSON[_0xfe0b('0x13')](_0x596f41));_0x1b0e9a(_0x596f41);})[_0xfe0b('0x19')](function(_0x9780b4){logger['error']('ShowWhatsappAccount',_0x9780b4[_0xfe0b('0x16')],_0x4ec272);_0x1ecdff(_0x396487['error'](0x1f4,_0x9780b4[_0xfe0b('0x16')]));});});}; \ No newline at end of file +var _0x4171=['stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','debug','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4171,0xcf));var _0x1417=function(_0x59b4d3,_0x90b95e){_0x59b4d3=_0x59b4d3-0x0;var _0x21f4ce=_0x4171[_0x59b4d3];return _0x21f4ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1417('0x0'));var BPromise=require('bluebird');var rs=require(_0x1417('0x1'));var fs=require('fs');var Redis=require(_0x1417('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1417('0x3'));var logger=require(_0x1417('0x4'))(_0x1417('0x5'));var config=require(_0x1417('0x6'));var jayson=require(_0x1417('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x1417('0x8')]=_[_0x1417('0x9')](config[_0x1417('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1417('0xa'))(new Redis(config[_0x1417('0x8')]));require('./whatsappAccount.socket')[_0x1417('0xb')](socket);function respondWithRpcPromise(_0x4d1a9e,_0x486e65,_0x1dcdbe){return new BPromise(function(_0x575599,_0x1fa0b){return client[_0x1417('0xc')](_0x4d1a9e,_0x1dcdbe)[_0x1417('0xd')](function(_0x1a2a84){logger[_0x1417('0xe')](_0x1417('0xf'),_0x486e65,_0x1417('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x486e65,_0x1417('0x10'),JSON[_0x1417('0x11')](_0x1a2a84));if(_0x1a2a84[_0x1417('0x12')]){if(_0x1a2a84[_0x1417('0x12')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x486e65,_0x1a2a84[_0x1417('0x12')][_0x1417('0x13')]);return _0x1fa0b(_0x1a2a84[_0x1417('0x12')][_0x1417('0x13')]);}logger[_0x1417('0x12')](_0x1417('0xf'),_0x486e65,_0x1a2a84[_0x1417('0x12')][_0x1417('0x13')]);return _0x575599(_0x1a2a84['error'][_0x1417('0x13')]);}else{logger[_0x1417('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x486e65,_0x1417('0x10'));_0x575599(_0x1a2a84[_0x1417('0x14')][_0x1417('0x13')]);}})[_0x1417('0x15')](function(_0x3a9755){logger[_0x1417('0x12')](_0x1417('0xf'),_0x486e65,_0x3a9755);_0x1fa0b(_0x3a9755);});});}exports[_0x1417('0x16')]=function(_0x5c4896){var _0x3868e1=this;return new Promise(function(_0x3e54ea,_0x442dc8){return db[_0x1417('0x17')]['find']({'raw':_0x5c4896['options']?_0x5c4896[_0x1417('0x18')][_0x1417('0x19')]===undefined?!![]:![]:!![],'where':_0x5c4896[_0x1417('0x18')]?_0x5c4896[_0x1417('0x18')][_0x1417('0x1a')]||null:null,'attributes':_0x5c4896[_0x1417('0x18')]?_0x5c4896[_0x1417('0x18')][_0x1417('0x1b')]||null:null,'include':_0x5c4896['options']?_0x5c4896[_0x1417('0x18')][_0x1417('0x1c')]?_[_0x1417('0x1d')](_0x5c4896['options'][_0x1417('0x1c')],function(_0x42e209){return{'model':db[_0x42e209[_0x1417('0x1e')]],'as':_0x42e209['as'],'attributes':_0x42e209['attributes'],'include':_0x42e209[_0x1417('0x1c')]?_['map'](_0x42e209[_0x1417('0x1c')],function(_0x1b7e7b){return{'model':db[_0x1b7e7b['model']],'as':_0x1b7e7b['as'],'attributes':_0x1b7e7b[_0x1417('0x1b')],'include':_0x1b7e7b[_0x1417('0x1c')]?_['map'](_0x1b7e7b[_0x1417('0x1c')],function(_0x3d3847){return{'model':db[_0x3d3847[_0x1417('0x1e')]],'as':_0x3d3847['as'],'attributes':_0x3d3847[_0x1417('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1417('0xd')](function(_0x2018ec){logger[_0x1417('0xe')](_0x1417('0x16'),_0x5c4896);logger[_0x1417('0x1f')]('ShowWhatsappAccount',_0x5c4896,JSON[_0x1417('0x11')](_0x2018ec));_0x3e54ea(_0x2018ec);})[_0x1417('0x15')](function(_0x336878){logger[_0x1417('0x12')](_0x1417('0x16'),_0x336878['message'],_0x5c4896);_0x442dc8(_0x3868e1[_0x1417('0x12')](0x1f4,_0x336878['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index df2b89c..900d890 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 _0x6731=['whatsappAccount:','./whatsappAccount.events','remove','register','length'];(function(_0x500ae4,_0x58892b){var _0x218f60=function(_0x1bc3c6){while(--_0x1bc3c6){_0x500ae4['push'](_0x500ae4['shift']());}};_0x218f60(++_0x58892b);}(_0x6731,0xe7));var _0x1673=function(_0x4fe496,_0x1d8673){_0x4fe496=_0x4fe496-0x0;var _0x422b24=_0x6731[_0x4fe496];return _0x422b24;};'use strict';var WhatsappAccountEvents=require(_0x1673('0x0'));var events=['save',_0x1673('0x1'),'update'];function createListener(_0x2d31aa,_0x1b9984){return function(_0x1c2e1d){_0x1b9984['emit'](_0x2d31aa,_0x1c2e1d);};}function removeListener(_0x187efc,_0x3cf02f){return function(){WhatsappAccountEvents['removeListener'](_0x187efc,_0x3cf02f);};}exports[_0x1673('0x2')]=function(_0x2d4c31){for(var _0x490f5e=0x0,_0x3a2404=events[_0x1673('0x3')];_0x490f5e<_0x3a2404;_0x490f5e++){var _0x1bdd4a=events[_0x490f5e];var _0x1e7ec9=createListener(_0x1673('0x4')+_0x1bdd4a,_0x2d4c31);WhatsappAccountEvents['on'](_0x1bdd4a,_0x1e7ec9);}}; \ No newline at end of file +var _0x5b5b=['removeListener','register','whatsappAccount:','remove','emit'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5b5b,0x102));var _0xb5b5=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x5b5b[_0x50e593];return _0x3821d0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0xb5b5('0x0'),'update'];function createListener(_0xd42807,_0x17e6a3){return function(_0x471332){_0x17e6a3[_0xb5b5('0x1')](_0xd42807,_0x471332);};}function removeListener(_0x298535,_0x1fcc76){return function(){WhatsappAccountEvents[_0xb5b5('0x2')](_0x298535,_0x1fcc76);};}exports[_0xb5b5('0x3')]=function(_0x48993e){for(var _0x3f21c3=0x0,_0x4983bc=events['length'];_0x3f21c3<_0x4983bc;_0x3f21c3++){var _0x443267=events[_0x3f21c3];var _0x6d28c5=createListener(_0xb5b5('0x4')+_0x443267,_0x48993e);WhatsappAccountEvents['on'](_0x443267,_0x6d28c5);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index dd49383..aebd68f 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 _0xabdd=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','connect-timeout','express','../../components/interaction/service'];(function(_0x12b294,_0x192e53){var _0x7b92cb=function(_0x16898e){while(--_0x16898e){_0x12b294['push'](_0x12b294['shift']());}};_0x7b92cb(++_0x192e53);}(_0xabdd,0x13b));var _0xdabd=function(_0x5ba857,_0x4adf38){_0x5ba857=_0x5ba857-0x0;var _0x22fe8f=_0xabdd[_0x5ba857];return _0x22fe8f;};'use strict';var multer=require(_0xdabd('0x0'));var util=require(_0xdabd('0x1'));var path=require('path');var timeout=require(_0xdabd('0x2'));var express=require(_0xdabd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdabd('0x4'));var config=require(_0xdabd('0x5'));var controller=require(_0xdabd('0x6'));router[_0xdabd('0x7')]('/',auth[_0xdabd('0x8')](),controller[_0xdabd('0x9')]);router['get'](_0xdabd('0xa'),auth[_0xdabd('0x8')](),controller[_0xdabd('0xb')]);router[_0xdabd('0xc')]('/',auth[_0xdabd('0x8')](),controller[_0xdabd('0xd')]);router['put'](_0xdabd('0xa'),auth[_0xdabd('0x8')](),controller[_0xdabd('0xe')]);router[_0xdabd('0xf')]('/:id',auth[_0xdabd('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xea72=['destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xea72,0xc7));var _0x2ea7=function(_0xb041f9,_0x4f2970){_0xb041f9=_0xb041f9-0x0;var _0x69399d=_0xea72[_0xb041f9];return _0x69399d;};'use strict';var multer=require(_0x2ea7('0x0'));var util=require('util');var path=require(_0x2ea7('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ea7('0x2'));var router=express[_0x2ea7('0x3')]();var fs_extra=require(_0x2ea7('0x4'));var auth=require(_0x2ea7('0x5'));var interaction=require(_0x2ea7('0x6'));var config=require('../../config/environment');var controller=require(_0x2ea7('0x7'));router[_0x2ea7('0x8')]('/',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xa')]);router[_0x2ea7('0x8')](_0x2ea7('0xb'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xc')]);router[_0x2ea7('0xd')]('/',auth[_0x2ea7('0x9')](),controller[_0x2ea7('0xe')]);router[_0x2ea7('0xf')](_0x2ea7('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2ea7('0x10')](_0x2ea7('0xb'),auth[_0x2ea7('0x9')](),controller[_0x2ea7('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6e2f1b3..102af27 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 _0xec1f=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x11d326,_0x1ef17a){var _0x2b345c=function(_0x26e8b1){while(--_0x26e8b1){_0x11d326['push'](_0x11d326['shift']());}};_0x2b345c(++_0x1ef17a);}(_0xec1f,0x19c));var _0xfec1=function(_0x2d5978,_0x48399f){_0x2d5978=_0x2d5978-0x0;var _0x495bec=_0xec1f[_0x2d5978];return _0x495bec;};'use strict';var Sequelize=require(_0xfec1('0x0'));module[_0xfec1('0x1')]={'priority':{'type':Sequelize[_0xfec1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfec1('0x3')],'allowNull':![],'defaultValue':_0xfec1('0x4')},'appdata':{'type':Sequelize[_0xfec1('0x5')]()},'description':{'type':Sequelize[_0xfec1('0x3')]},'interval':{'type':Sequelize[_0xfec1('0x3')],'defaultValue':_0xfec1('0x6')}}; \ No newline at end of file +var _0xbc76=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4d830e,_0x4bb30e){var _0x4c0515=function(_0x2ec963){while(--_0x2ec963){_0x4d830e['push'](_0x4d830e['shift']());}};_0x4c0515(++_0x4bb30e);}(_0xbc76,0xbd));var _0x6bc7=function(_0x269a5e,_0x232106){_0x269a5e=_0x269a5e-0x0;var _0x9ef8ee=_0xbc76[_0x269a5e];return _0x9ef8ee;};'use strict';var Sequelize=require(_0x6bc7('0x0'));module[_0x6bc7('0x1')]={'priority':{'type':Sequelize[_0x6bc7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6bc7('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6bc7('0x4')]()},'description':{'type':Sequelize[_0x6bc7('0x3')]},'interval':{'type':Sequelize[_0x6bc7('0x3')],'defaultValue':_0x6bc7('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index dfb7483..a96a145 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 _0x3014=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where'];(function(_0x157e96,_0x53b333){var _0x25596d=function(_0x7b4fc8){while(--_0x7b4fc8){_0x157e96['push'](_0x157e96['shift']());}};_0x25596d(++_0x53b333);}(_0x3014,0x1d7));var _0x4301=function(_0x14fcc4,_0x450ca5){_0x14fcc4=_0x14fcc4-0x0;var _0x2ac4a3=_0x3014[_0x14fcc4];return _0x2ac4a3;};'use strict';var emlformat=require(_0x4301('0x0'));var rimraf=require(_0x4301('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4301('0x2'));var rp=require(_0x4301('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4301('0x4'));var util=require(_0x4301('0x5'));var path=require(_0x4301('0x6'));var sox=require(_0x4301('0x7'));var csv=require(_0x4301('0x8'));var ejs=require(_0x4301('0x9'));var fs=require('fs');var fs_extra=require(_0x4301('0xa'));var _=require(_0x4301('0xb'));var squel=require(_0x4301('0xc'));var crypto=require(_0x4301('0xd'));var jsforce=require(_0x4301('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4301('0xf'));var Papa=require(_0x4301('0x10'));var Redis=require('ioredis');var authService=require(_0x4301('0x11'));var qs=require(_0x4301('0x12'));var as=require(_0x4301('0x13'));var hardwareService=require(_0x4301('0x14'));var logger=require('../../config/logger')(_0x4301('0x15'));var utils=require('../../config/utils');var config=require(_0x4301('0x16'));var licenseUtil=require(_0x4301('0x17'));var db=require(_0x4301('0x18'))['db'];function respondWithStatusCode(_0x103b6a,_0x2ee382){_0x2ee382=_0x2ee382||0xcc;return function(_0x312028){if(_0x312028){return _0x103b6a[_0x4301('0x19')](_0x2ee382);}return _0x103b6a[_0x4301('0x1a')](_0x2ee382)[_0x4301('0x1b')]();};}function respondWithResult(_0x2bf62e,_0x3f2d5d){_0x3f2d5d=_0x3f2d5d||0xc8;return function(_0x2a97ce){if(_0x2a97ce){return _0x2bf62e[_0x4301('0x1a')](_0x3f2d5d)['json'](_0x2a97ce);}};}function respondWithFilteredResult(_0x5ee1fb,_0x5ab000){return function(_0x4359a6){if(_0x4359a6){var _0x3f8604=typeof _0x5ab000[_0x4301('0x1c')]===_0x4301('0x1d')&&typeof _0x5ab000['limit']==='undefined';var _0x2d3281=_0x4359a6[_0x4301('0x1e')];var _0x13b229=_0x3f8604?0x0:_0x5ab000['offset'];var _0xa1cbea=_0x3f8604?_0x4359a6[_0x4301('0x1e')]:_0x5ab000[_0x4301('0x1c')]+_0x5ab000[_0x4301('0x1f')];var _0x86d885;if(_0xa1cbea>=_0x2d3281){_0xa1cbea=_0x2d3281;_0x86d885=0xc8;}else{_0x86d885=0xce;}_0x5ee1fb[_0x4301('0x1a')](_0x86d885);return _0x5ee1fb['set'](_0x4301('0x20'),_0x13b229+'-'+_0xa1cbea+'/'+_0x2d3281)[_0x4301('0x21')](_0x4359a6);}return null;};}function patchUpdates(_0x1e7601){return function(_0x571b3f){try{jsonpatch[_0x4301('0x22')](_0x571b3f,_0x1e7601,!![]);}catch(_0x4b030c){return BPromise[_0x4301('0x23')](_0x4b030c);}return _0x571b3f[_0x4301('0x24')]();};}function saveUpdates(_0x471f94,_0x1b3ebf){return function(_0x5a86a1){if(_0x5a86a1){return _0x5a86a1[_0x4301('0x25')](_0x471f94)[_0x4301('0x26')](function(_0x4f7fe3){return _0x4f7fe3;});}return null;};}function removeEntity(_0x112769,_0x5d47d1){return function(_0x4213a1){if(_0x4213a1){return _0x4213a1[_0x4301('0x27')]()[_0x4301('0x26')](function(){_0x112769[_0x4301('0x1a')](0xcc)[_0x4301('0x1b')]();});}};}function handleEntityNotFound(_0x11fe82,_0x856e6a){return function(_0x3de609){if(!_0x3de609){_0x11fe82[_0x4301('0x19')](0x194);}return _0x3de609;};}function handleError(_0x344394,_0x2ea6e4){_0x2ea6e4=_0x2ea6e4||0x1f4;return function(_0x4a60d7){logger[_0x4301('0x28')](_0x4a60d7[_0x4301('0x29')]);if(_0x4a60d7[_0x4301('0x2a')]){delete _0x4a60d7[_0x4301('0x2a')];}_0x344394['status'](_0x2ea6e4)[_0x4301('0x2b')](_0x4a60d7);};}exports[_0x4301('0x2c')]=function(_0x28f36a,_0x5b4a07){var _0xcf5923={},_0x10a967={},_0x4cbb69={'count':0x0,'rows':[]};var _0x30b6a9=_['map'](db[_0x4301('0x2d')][_0x4301('0x2e')],function(_0x2854fb){return{'name':_0x2854fb[_0x4301('0x2f')],'type':_0x2854fb['type'][_0x4301('0x30')]};});_0x10a967['model']=_[_0x4301('0x31')](_0x30b6a9,'name');_0x10a967['query']=_[_0x4301('0x32')](_0x28f36a[_0x4301('0x33')]);_0x10a967[_0x4301('0x34')]=_[_0x4301('0x35')](_0x10a967[_0x4301('0x36')],_0x10a967[_0x4301('0x33')]);_0xcf5923[_0x4301('0x37')]=_['intersection'](_0x10a967[_0x4301('0x36')],qs[_0x4301('0x38')](_0x28f36a[_0x4301('0x33')]['fields']));_0xcf5923['attributes']=_0xcf5923['attributes'][_0x4301('0x39')]?_0xcf5923[_0x4301('0x37')]:_0x10a967[_0x4301('0x36')];if(!_0x28f36a['query']['hasOwnProperty']('nolimit')){_0xcf5923[_0x4301('0x1f')]=qs[_0x4301('0x1f')](_0x28f36a[_0x4301('0x33')][_0x4301('0x1f')]);_0xcf5923[_0x4301('0x1c')]=qs[_0x4301('0x1c')](_0x28f36a[_0x4301('0x33')][_0x4301('0x1c')]);}_0xcf5923[_0x4301('0x3a')]=qs[_0x4301('0x3b')](_0x28f36a[_0x4301('0x33')]['sort']);_0xcf5923[_0x4301('0x3c')]=qs[_0x4301('0x34')](_['pick'](_0x28f36a[_0x4301('0x33')],_0x10a967[_0x4301('0x34')]),_0x30b6a9);if(_0x28f36a['query'][_0x4301('0x3d')]){_0xcf5923[_0x4301('0x3c')]=_[_0x4301('0x3e')](_0xcf5923[_0x4301('0x3c')],{'$or':_[_0x4301('0x31')](_0x30b6a9,function(_0x4b2ce8){if(_0x4b2ce8[_0x4301('0x3f')]!==_0x4301('0x40')){var _0x5049dd={};_0x5049dd[_0x4b2ce8[_0x4301('0x2a')]]={'$like':'%'+_0x28f36a['query']['filter']+'%'};return _0x5049dd;}})});}_0xcf5923=_['merge']({},_0xcf5923,_0x28f36a[_0x4301('0x41')]);var _0x2a9824={'where':_0xcf5923['where']};return db[_0x4301('0x2d')][_0x4301('0x1e')](_0x2a9824)[_0x4301('0x26')](function(_0x5d4dbb){_0x4cbb69['count']=_0x5d4dbb;if(_0x28f36a[_0x4301('0x33')][_0x4301('0x42')]){_0xcf5923[_0x4301('0x43')]=[{'all':!![]}];}return db[_0x4301('0x2d')][_0x4301('0x44')](_0xcf5923);})['then'](function(_0xde0195){_0x4cbb69[_0x4301('0x45')]=_0xde0195;return _0x4cbb69;})[_0x4301('0x26')](respondWithFilteredResult(_0x5b4a07,_0xcf5923))[_0x4301('0x46')](handleError(_0x5b4a07,null));};exports[_0x4301('0x47')]=function(_0x2f75c9,_0xe31883){var _0x561393={'raw':!![],'where':{'id':_0x2f75c9[_0x4301('0x48')]['id']}},_0x28230e={};_0x28230e['model']=_[_0x4301('0x32')](db[_0x4301('0x2d')][_0x4301('0x2e')]);_0x28230e['query']=_['keys'](_0x2f75c9[_0x4301('0x33')]);_0x28230e[_0x4301('0x34')]=_[_0x4301('0x35')](_0x28230e['model'],_0x28230e['query']);_0x561393[_0x4301('0x37')]=_[_0x4301('0x35')](_0x28230e[_0x4301('0x36')],qs['fields'](_0x2f75c9[_0x4301('0x33')][_0x4301('0x38')]));_0x561393[_0x4301('0x37')]=_0x561393[_0x4301('0x37')][_0x4301('0x39')]?_0x561393[_0x4301('0x37')]:_0x28230e['model'];if(_0x2f75c9[_0x4301('0x33')]['includeAll']){_0x561393[_0x4301('0x43')]=[{'all':!![]}];}_0x561393=_[_0x4301('0x3e')]({},_0x561393,_0x2f75c9['options']);return db[_0x4301('0x2d')][_0x4301('0x49')](_0x561393)[_0x4301('0x26')](handleEntityNotFound(_0xe31883,null))[_0x4301('0x26')](respondWithResult(_0xe31883,null))['catch'](handleError(_0xe31883,null));};exports['create']=function(_0x28469b,_0x5e4d47){return db[_0x4301('0x2d')][_0x4301('0x4a')](_0x28469b[_0x4301('0x4b')],{})[_0x4301('0x26')](respondWithResult(_0x5e4d47,0xc9))[_0x4301('0x46')](handleError(_0x5e4d47,null));};exports[_0x4301('0x25')]=function(_0x1e62d3,_0x3fc314){if(_0x1e62d3['body']['id']){delete _0x1e62d3[_0x4301('0x4b')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x1e62d3[_0x4301('0x48')]['id']}})[_0x4301('0x26')](handleEntityNotFound(_0x3fc314,null))[_0x4301('0x26')](saveUpdates(_0x1e62d3[_0x4301('0x4b')],null))[_0x4301('0x26')](respondWithResult(_0x3fc314,null))[_0x4301('0x46')](handleError(_0x3fc314,null));};exports[_0x4301('0x27')]=function(_0x1765df,_0x56e892){return db[_0x4301('0x2d')][_0x4301('0x49')]({'where':{'id':_0x1765df[_0x4301('0x48')]['id']}})[_0x4301('0x26')](handleEntityNotFound(_0x56e892,null))[_0x4301('0x26')](removeEntity(_0x56e892,null))[_0x4301('0x46')](handleError(_0x56e892,null));}; \ No newline at end of file +var _0xb7f0=['type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x2d9535,_0x4bc592){_0x2d9535=_0x2d9535-0x0;var _0xb4e710=_0xb7f0[_0x2d9535];return _0xb4e710;};'use strict';var emlformat=require(_0x0b7f('0x0'));var rimraf=require(_0x0b7f('0x1'));var zipdir=require(_0x0b7f('0x2'));var jsonpatch=require(_0x0b7f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b7f('0x4'));var Mustache=require(_0x0b7f('0x5'));var util=require(_0x0b7f('0x6'));var path=require(_0x0b7f('0x7'));var sox=require(_0x0b7f('0x8'));var csv=require(_0x0b7f('0x9'));var ejs=require(_0x0b7f('0xa'));var fs=require('fs');var fs_extra=require(_0x0b7f('0xb'));var _=require(_0x0b7f('0xc'));var squel=require(_0x0b7f('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b7f('0xe'));var deskjs=require(_0x0b7f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0b7f('0x10'));var Papa=require(_0x0b7f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b7f('0x12'));var hardwareService=require(_0x0b7f('0x13'));var logger=require(_0x0b7f('0x14'))(_0x0b7f('0x15'));var utils=require(_0x0b7f('0x16'));var config=require(_0x0b7f('0x17'));var licenseUtil=require(_0x0b7f('0x18'));var db=require(_0x0b7f('0x19'))['db'];function respondWithStatusCode(_0x1af907,_0x34121a){_0x34121a=_0x34121a||0xcc;return function(_0x930432){if(_0x930432){return _0x1af907['sendStatus'](_0x34121a);}return _0x1af907[_0x0b7f('0x1a')](_0x34121a)[_0x0b7f('0x1b')]();};}function respondWithResult(_0x1e3f86,_0x19ddf2){_0x19ddf2=_0x19ddf2||0xc8;return function(_0x294db5){if(_0x294db5){return _0x1e3f86[_0x0b7f('0x1a')](_0x19ddf2)[_0x0b7f('0x1c')](_0x294db5);}};}function respondWithFilteredResult(_0x18069a,_0x5a2b0b){return function(_0x20e15d){if(_0x20e15d){var _0x1d223f=typeof _0x5a2b0b[_0x0b7f('0x1d')]===_0x0b7f('0x1e')&&typeof _0x5a2b0b['limit']===_0x0b7f('0x1e');var _0x3f6463=_0x20e15d[_0x0b7f('0x1f')];var _0x168e7e=_0x1d223f?0x0:_0x5a2b0b[_0x0b7f('0x1d')];var _0x50cee2=_0x1d223f?_0x20e15d[_0x0b7f('0x1f')]:_0x5a2b0b['offset']+_0x5a2b0b['limit'];var _0x36a619;if(_0x50cee2>=_0x3f6463){_0x50cee2=_0x3f6463;_0x36a619=0xc8;}else{_0x36a619=0xce;}_0x18069a[_0x0b7f('0x1a')](_0x36a619);return _0x18069a[_0x0b7f('0x20')](_0x0b7f('0x21'),_0x168e7e+'-'+_0x50cee2+'/'+_0x3f6463)[_0x0b7f('0x1c')](_0x20e15d);}return null;};}function patchUpdates(_0x52abc6){return function(_0x55362c){try{jsonpatch[_0x0b7f('0x22')](_0x55362c,_0x52abc6,!![]);}catch(_0x3ca024){return BPromise[_0x0b7f('0x23')](_0x3ca024);}return _0x55362c['save']();};}function saveUpdates(_0xb130f0,_0x1ec1d3){return function(_0x26f974){if(_0x26f974){return _0x26f974[_0x0b7f('0x24')](_0xb130f0)[_0x0b7f('0x25')](function(_0x44a0ae){return _0x44a0ae;});}return null;};}function removeEntity(_0x459389,_0x45ab0e){return function(_0xc74a5d){if(_0xc74a5d){return _0xc74a5d['destroy']()[_0x0b7f('0x25')](function(){_0x459389[_0x0b7f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50776a,_0x4a2841){return function(_0x37a5e5){if(!_0x37a5e5){_0x50776a[_0x0b7f('0x26')](0x194);}return _0x37a5e5;};}function handleError(_0x4e61be,_0xd3cb99){_0xd3cb99=_0xd3cb99||0x1f4;return function(_0x3cda59){logger[_0x0b7f('0x27')](_0x3cda59[_0x0b7f('0x28')]);if(_0x3cda59[_0x0b7f('0x29')]){delete _0x3cda59[_0x0b7f('0x29')];}_0x4e61be[_0x0b7f('0x1a')](_0xd3cb99)[_0x0b7f('0x2a')](_0x3cda59);};}exports[_0x0b7f('0x2b')]=function(_0x4ae467,_0x599bae){var _0x4ada58={},_0x3ea675={},_0x4f7e74={'count':0x0,'rows':[]};var _0x34b54c=_[_0x0b7f('0x2c')](db[_0x0b7f('0x2d')][_0x0b7f('0x2e')],function(_0x2d4727){return{'name':_0x2d4727[_0x0b7f('0x2f')],'type':_0x2d4727[_0x0b7f('0x30')]['key']};});_0x3ea675['model']=_[_0x0b7f('0x2c')](_0x34b54c,'name');_0x3ea675[_0x0b7f('0x31')]=_[_0x0b7f('0x32')](_0x4ae467[_0x0b7f('0x31')]);_0x3ea675[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x3ea675[_0x0b7f('0x35')],_0x3ea675[_0x0b7f('0x31')]);_0x4ada58[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x3ea675['model'],qs['fields'](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x4ada58[_0x0b7f('0x36')]=_0x4ada58[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x4ada58[_0x0b7f('0x36')]:_0x3ea675[_0x0b7f('0x35')];if(!_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x39')]('nolimit')){_0x4ada58['limit']=qs[_0x0b7f('0x3a')](_0x4ae467['query'][_0x0b7f('0x3a')]);_0x4ada58['offset']=qs[_0x0b7f('0x1d')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x1d')]);}_0x4ada58[_0x0b7f('0x3b')]=qs[_0x0b7f('0x3c')](_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x3c')]);_0x4ada58[_0x0b7f('0x3d')]=qs[_0x0b7f('0x33')](_['pick'](_0x4ae467['query'],_0x3ea675['filters']),_0x34b54c);if(_0x4ae467[_0x0b7f('0x31')]['filter']){_0x4ada58[_0x0b7f('0x3d')]=_[_0x0b7f('0x3e')](_0x4ada58[_0x0b7f('0x3d')],{'$or':_[_0x0b7f('0x2c')](_0x34b54c,function(_0x1e2f6c){if(_0x1e2f6c['type']!==_0x0b7f('0x3f')){var _0x2eafb6={};_0x2eafb6[_0x1e2f6c[_0x0b7f('0x29')]]={'$like':'%'+_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x40')]+'%'};return _0x2eafb6;}})});}_0x4ada58=_['merge']({},_0x4ada58,_0x4ae467[_0x0b7f('0x41')]);var _0x2f5351={'where':_0x4ada58[_0x0b7f('0x3d')]};return db[_0x0b7f('0x2d')][_0x0b7f('0x1f')](_0x2f5351)[_0x0b7f('0x25')](function(_0x40b1c5){_0x4f7e74[_0x0b7f('0x1f')]=_0x40b1c5;if(_0x4ae467[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x4ada58[_0x0b7f('0x43')]=[{'all':!![]}];}return db[_0x0b7f('0x2d')][_0x0b7f('0x44')](_0x4ada58);})['then'](function(_0x4aaf15){_0x4f7e74[_0x0b7f('0x45')]=_0x4aaf15;return _0x4f7e74;})[_0x0b7f('0x25')](respondWithFilteredResult(_0x599bae,_0x4ada58))[_0x0b7f('0x46')](handleError(_0x599bae,null));};exports[_0x0b7f('0x47')]=function(_0x2c25fc,_0x230c6b){var _0x57c147={'raw':!![],'where':{'id':_0x2c25fc[_0x0b7f('0x48')]['id']}},_0x2176c6={};_0x2176c6[_0x0b7f('0x35')]=_[_0x0b7f('0x32')](db['WhatsappApplication'][_0x0b7f('0x2e')]);_0x2176c6['query']=_[_0x0b7f('0x32')](_0x2c25fc[_0x0b7f('0x31')]);_0x2176c6[_0x0b7f('0x33')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],_0x2176c6['query']);_0x57c147[_0x0b7f('0x36')]=_[_0x0b7f('0x34')](_0x2176c6[_0x0b7f('0x35')],qs[_0x0b7f('0x37')](_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x37')]));_0x57c147[_0x0b7f('0x36')]=_0x57c147[_0x0b7f('0x36')][_0x0b7f('0x38')]?_0x57c147[_0x0b7f('0x36')]:_0x2176c6[_0x0b7f('0x35')];if(_0x2c25fc[_0x0b7f('0x31')][_0x0b7f('0x42')]){_0x57c147['include']=[{'all':!![]}];}_0x57c147=_[_0x0b7f('0x3e')]({},_0x57c147,_0x2c25fc[_0x0b7f('0x41')]);return db[_0x0b7f('0x2d')][_0x0b7f('0x49')](_0x57c147)[_0x0b7f('0x25')](handleEntityNotFound(_0x230c6b,null))[_0x0b7f('0x25')](respondWithResult(_0x230c6b,null))[_0x0b7f('0x46')](handleError(_0x230c6b,null));};exports['create']=function(_0x4d432b,_0x562843){return db[_0x0b7f('0x2d')][_0x0b7f('0x4a')](_0x4d432b['body'],{})[_0x0b7f('0x25')](respondWithResult(_0x562843,0xc9))[_0x0b7f('0x46')](handleError(_0x562843,null));};exports['update']=function(_0x2469e2,_0x4a825c){if(_0x2469e2[_0x0b7f('0x4b')]['id']){delete _0x2469e2['body']['id'];}return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x2469e2[_0x0b7f('0x48')]['id']}})[_0x0b7f('0x25')](handleEntityNotFound(_0x4a825c,null))[_0x0b7f('0x25')](saveUpdates(_0x2469e2[_0x0b7f('0x4b')],null))[_0x0b7f('0x25')](respondWithResult(_0x4a825c,null))[_0x0b7f('0x46')](handleError(_0x4a825c,null));};exports[_0x0b7f('0x4c')]=function(_0x3cfa81,_0x23e3ef){return db[_0x0b7f('0x2d')][_0x0b7f('0x49')]({'where':{'id':_0x3cfa81[_0x0b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x23e3ef,null))[_0x0b7f('0x25')](removeEntity(_0x23e3ef,null))[_0x0b7f('0x46')](handleError(_0x23e3ef,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2e81357..5e7fecc 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 _0x8d9b=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./whatsappApplication.attributes','define','utf8mb4_unicode_ci'];(function(_0x1832ac,_0x31513){var _0x1486e5=function(_0x29d66d){while(--_0x29d66d){_0x1832ac['push'](_0x1832ac['shift']());}};_0x1486e5(++_0x31513);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var logger=require(_0xb8d9('0x2'))(_0xb8d9('0x3'));var moment=require(_0xb8d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d9('0x5'));var rimraf=require('rimraf');var config=require(_0xb8d9('0x6'));var attributes=require(_0xb8d9('0x7'));module['exports']=function(_0x5996e9,_0x529b0a){return _0x5996e9[_0xb8d9('0x8')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xb8d9('0x9')});}; \ No newline at end of file +var _0x885e=['lodash','util','api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x10c842,_0x347cbc){var _0x4af982=function(_0x1a0308){while(--_0x1a0308){_0x10c842['push'](_0x10c842['shift']());}};_0x4af982(++_0x347cbc);}(_0x885e,0xe4));var _0xe885=function(_0x3db084,_0x21a397){_0x3db084=_0x3db084-0x0;var _0x400818=_0x885e[_0x3db084];return _0x400818;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var logger=require('../../config/logger')(_0xe885('0x2'));var moment=require(_0xe885('0x3'));var BPromise=require(_0xe885('0x4'));var rp=require(_0xe885('0x5'));var fs=require('fs');var path=require(_0xe885('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe885('0x7'));module[_0xe885('0x8')]=function(_0x33286a,_0x1a5fd6){return _0x33286a['define'](_0xe885('0x9'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe885('0xa'),'collate':_0xe885('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 5404044..14c37ee 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 _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2f0a46,_0x1691ba){var _0x255ea9=function(_0x4ac39c){while(--_0x4ac39c){_0x2f0a46['push'](_0x2f0a46['shift']());}};_0x255ea9(++_0x1691ba);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1a3751,_0x447401){_0x1a3751=_0x1a3751-0x0;var _0x16634c=_0xd6d6[_0x1a3751];return _0x16634c;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file +var _0xed1f=['request','then','info','WhatsappApplication,\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(_0xdc5668,_0x153111){var _0x2561a7=function(_0x3bbcba){while(--_0x3bbcba){_0xdc5668['push'](_0xdc5668['shift']());}};_0x2561a7(++_0x153111);}(_0xed1f,0x6a));var _0xfed1=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xed1f[_0xe73080];return _0x12cbc4;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fd47f51..51fe3c0 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 _0x5d58=['create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post'];(function(_0x1f1496,_0x20ca59){var _0x4ac2be=function(_0x39d669){while(--_0x39d669){_0x1f1496['push'](_0x1f1496['shift']());}};_0x4ac2be(++_0x20ca59);}(_0x5d58,0x187));var _0x85d5=function(_0x57e864,_0xc579d1){_0x57e864=_0x57e864-0x0;var _0x13b734=_0x5d58[_0x57e864];return _0x13b734;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./whatsappInteraction.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0x4')](_0x85d5('0xa'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xc')]);router[_0x85d5('0xd')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0xe')]);router[_0x85d5('0xd')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x85d5('0xd')](_0x85d5('0xf'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x12')),controller[_0x85d5('0x13')]);router['put'](_0x85d5('0x8'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x14')),controller[_0x85d5('0x15')]);router[_0x85d5('0x16')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x17')),controller[_0x85d5('0x18')]);router[_0x85d5('0x16')](_0x85d5('0xf'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x19')]);module[_0x85d5('0x1a')]=router; \ No newline at end of file +var _0x5d58=['create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','/:id/download','download','post'];(function(_0x54abda,_0x49b261){var _0xeea0e6=function(_0x39f701){while(--_0x39f701){_0x54abda['push'](_0x54abda['shift']());}};_0xeea0e6(++_0x49b261);}(_0x5d58,0x187));var _0x85d5=function(_0x133c32,_0x487339){_0x133c32=_0x133c32-0x0;var _0x23d797=_0x5d58[_0x133c32];return _0x23d797;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x85d5('0x0')]();var fs_extra=require(_0x85d5('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var controller=require('./whatsappInteraction.controller');router[_0x85d5('0x4')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0x6')]);router[_0x85d5('0x4')]('/describe',auth[_0x85d5('0x5')](),controller[_0x85d5('0x7')]);router['get'](_0x85d5('0x8'),auth['isAuthenticated'](),controller[_0x85d5('0x9')]);router[_0x85d5('0x4')](_0x85d5('0xa'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x85d5('0xb'),auth[_0x85d5('0x5')](),controller[_0x85d5('0xc')]);router[_0x85d5('0xd')]('/',auth[_0x85d5('0x5')](),controller[_0x85d5('0xe')]);router[_0x85d5('0xd')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x85d5('0xd')](_0x85d5('0xf'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x12')),controller[_0x85d5('0x13')]);router['put'](_0x85d5('0x8'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x14')),controller[_0x85d5('0x15')]);router[_0x85d5('0x16')](_0x85d5('0x8'),auth[_0x85d5('0x5')](),interaction[_0x85d5('0x10')](_0x85d5('0x11'),_0x85d5('0x17')),controller[_0x85d5('0x18')]);router[_0x85d5('0x16')](_0x85d5('0xf'),auth[_0x85d5('0x5')](),controller[_0x85d5('0x19')]);module[_0x85d5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9e43fd0..92fbd21 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 _0x8d0a=['STRING','out','ENUM','sequelize','exports','BOOLEAN','DATE'];(function(_0x4674e2,_0x55e994){var _0xe5f117=function(_0x1d8378){while(--_0x1d8378){_0x4674e2['push'](_0x4674e2['shift']());}};_0xe5f117(++_0x55e994);}(_0x8d0a,0x65));var _0xa8d0=function(_0x3072b2,_0x3a087a){_0x3072b2=_0x3072b2-0x0;var _0x24cb40=_0x8d0a[_0x3072b2];return _0x24cb40;};'use strict';var Sequelize=require(_0xa8d0('0x0'));var moment=require('moment');module[_0xa8d0('0x1')]={'closed':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa8d0('0x3')]},'disposition':{'type':Sequelize[_0xa8d0('0x4')]},'secondDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa8d0('0x4')]},'note':{'type':Sequelize[_0xa8d0('0x4')]},'phone':{'type':Sequelize[_0xa8d0('0x4')]},'read1stAt':{'type':Sequelize[_0xa8d0('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa8d0('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa8d0('0x6')]('in',_0xa8d0('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa8d0('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xf8b2=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x12b650,_0x22418f){_0x12b650=_0x12b650-0x0;var _0x39c3d5=_0xf8b2[_0x12b650];return _0x39c3d5;};'use strict';var Sequelize=require(_0x2f8b('0x0'));var moment=require(_0x2f8b('0x1'));module[_0x2f8b('0x2')]={'closed':{'type':Sequelize[_0x2f8b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2f8b('0x4')]},'disposition':{'type':Sequelize[_0x2f8b('0x5')]},'secondDisposition':{'type':Sequelize[_0x2f8b('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2f8b('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2f8b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2f8b('0x6')]('in',_0x2f8b('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2f8b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2f8b('0x6')]('in',_0x2f8b('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2f8b('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 724966e..88c64b0 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 _0x93cf=['./whatsappInteraction.socket','register','end','status','json','offset','limit','undefined','count','set','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','keys','WhatsappInteraction','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','create','body','find','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','spread','color','emit','whatsappInteractionTags:save','removeTags','download','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','fullname','N.A.','toString','closed','closedAt','disposition','basename','createReadStream','pipe','createWriteStream','out','System','secret','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x42a387,_0x1b27a0){var _0x43718e=function(_0x134d3d){while(--_0x134d3d){_0x42a387['push'](_0x42a387['shift']());}};_0x43718e(++_0x1b27a0);}(_0x93cf,0x181));var _0xf93c=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x93cf[_0x5bd426];return _0x23a7eb;};'use strict';var rimraf=require(_0xf93c('0x0'));var zipdir=require(_0xf93c('0x1'));var moment=require(_0xf93c('0x2'));var BPromise=require(_0xf93c('0x3'));var util=require(_0xf93c('0x4'));var path=require(_0xf93c('0x5'));var ejs=require(_0xf93c('0x6'));var fs=require('fs');var _=require(_0xf93c('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xf93c('0x8'));var logger=require(_0xf93c('0x9'))(_0xf93c('0xa'));var config=require(_0xf93c('0xb'));var db=require(_0xf93c('0xc'))['db'];config[_0xf93c('0xd')]=_[_0xf93c('0xe')](config[_0xf93c('0xd')],{'host':_0xf93c('0xf'),'port':0x18eb});var socket=require(_0xf93c('0x10'))(new Redis(config[_0xf93c('0xd')]));require(_0xf93c('0x11'))[_0xf93c('0x12')](socket);function respondWithStatusCode(_0x8581ae,_0x1dd0fe){_0x1dd0fe=_0x1dd0fe||0xcc;return function(_0x2bc7fb){if(_0x2bc7fb){return _0x8581ae['sendStatus'](_0x1dd0fe);}return _0x8581ae['status'](_0x1dd0fe)[_0xf93c('0x13')]();};}function respondWithResult(_0x438efd,_0x503c2d){_0x503c2d=_0x503c2d||0xc8;return function(_0x28769f){if(_0x28769f){return _0x438efd[_0xf93c('0x14')](_0x503c2d)[_0xf93c('0x15')](_0x28769f);}};}function respondWithFilteredResult(_0x29f533,_0x467d5e){return function(_0x43c7a4){if(_0x43c7a4){var _0x4cec4b=typeof _0x467d5e[_0xf93c('0x16')]==='undefined'&&typeof _0x467d5e[_0xf93c('0x17')]===_0xf93c('0x18');var _0x30e4d8=_0x43c7a4[_0xf93c('0x19')];var _0x45fcd4=_0x4cec4b?0x0:_0x467d5e[_0xf93c('0x16')];var _0x4ca9d4=_0x4cec4b?_0x43c7a4[_0xf93c('0x19')]:_0x467d5e[_0xf93c('0x16')]+_0x467d5e[_0xf93c('0x17')];var _0x3cff41;if(_0x4ca9d4>=_0x30e4d8){_0x4ca9d4=_0x30e4d8;_0x3cff41=0xc8;}else{_0x3cff41=0xce;}_0x29f533['status'](_0x3cff41);return _0x29f533[_0xf93c('0x1a')]('Content-Range',_0x45fcd4+'-'+_0x4ca9d4+'/'+_0x30e4d8)[_0xf93c('0x15')](_0x43c7a4);}return null;};}function saveUpdates(_0x22376e){return function(_0x7c7175){if(_0x7c7175){return _0x7c7175[_0xf93c('0x1b')](_0x22376e)['then'](function(_0x5e5c1d){return _0x5e5c1d;});}return null;};}function removeEntity(_0x2ba75e){return function(_0x3503bc){if(_0x3503bc){return _0x3503bc[_0xf93c('0x1c')]()[_0xf93c('0x1d')](function(){_0x2ba75e[_0xf93c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c257e){return function(_0x3b6d51){if(!_0x3b6d51){_0x5c257e['sendStatus'](0x194);}return _0x3b6d51;};}function handleError(_0x2ba9b7,_0x6e6f02){_0x6e6f02=_0x6e6f02||0x1f4;return function(_0x27ce99){logger[_0xf93c('0x1e')](_0x27ce99[_0xf93c('0x1f')]);if(_0x27ce99[_0xf93c('0x20')]){delete _0x27ce99['name'];}_0x2ba9b7[_0xf93c('0x14')](_0x6e6f02)[_0xf93c('0x21')](_0x27ce99);};}exports[_0xf93c('0x22')]=function(_0x588e9a,_0x5b24b6){var _0x2709e0={};var _0x139289=_[_0xf93c('0x23')](db['WhatsappInteraction'][_0xf93c('0x24')],function(_0x279509){return{'name':_0x279509[_0xf93c('0x25')],'type':_0x279509[_0xf93c('0x26')][_0xf93c('0x27')]};});_0x2709e0=qs[_0xf93c('0x28')](_0x139289,_0x588e9a);return interaction[_0xf93c('0x29')](_0xf93c('0x2a'),_0x588e9a[_0xf93c('0x2b')],_0x588e9a[_0xf93c('0x2c')],_0x2709e0,_0x139289)[_0xf93c('0x1d')](respondWithFilteredResult(_0x5b24b6,_0x2709e0))[_0xf93c('0x2d')](handleError(_0x5b24b6,null));};exports[_0xf93c('0x2e')]=function(_0x5e6cd4,_0x4536a9){var _0xed81a1={'raw':![],'where':{'id':_0x5e6cd4['params']['id']}},_0x2a2b54={};_0x2a2b54['model']=_[_0xf93c('0x2f')](db[_0xf93c('0x30')][_0xf93c('0x24')]);_0x2a2b54[_0xf93c('0x2b')]=_['keys'](_0x5e6cd4[_0xf93c('0x2b')]);_0x2a2b54[_0xf93c('0x31')]=_[_0xf93c('0x32')](_0x2a2b54[_0xf93c('0x33')],_0x2a2b54[_0xf93c('0x2b')]);_0xed81a1['attributes']=_[_0xf93c('0x32')](_0x2a2b54['model'],qs[_0xf93c('0x34')](_0x5e6cd4[_0xf93c('0x2b')][_0xf93c('0x34')]));_0xed81a1['attributes']=_0xed81a1[_0xf93c('0x35')][_0xf93c('0x36')]?_0xed81a1['attributes']:_0x2a2b54[_0xf93c('0x33')];if(_0x5e6cd4['query'][_0xf93c('0x37')]){_0xed81a1[_0xf93c('0x38')]=[{'all':!![]}];}_0xed81a1=_[_0xf93c('0x39')]({},_0xed81a1,_0x5e6cd4[_0xf93c('0x3a')]);return db[_0xf93c('0x30')]['find'](_0xed81a1)[_0xf93c('0x1d')](handleEntityNotFound(_0x4536a9,null))['then'](respondWithResult(_0x4536a9,null))[_0xf93c('0x2d')](handleError(_0x4536a9,null));};exports[_0xf93c('0x3b')]=function(_0x111322,_0x429806){return db[_0xf93c('0x30')][_0xf93c('0x3b')](_0x111322[_0xf93c('0x3c')],{})[_0xf93c('0x1d')](respondWithResult(_0x429806,0xc9))[_0xf93c('0x2d')](handleError(_0x429806,null));};exports['update']=function(_0x12943e,_0x4099f5){if(_0x12943e[_0xf93c('0x3c')]['id']){delete _0x12943e['body']['id'];}return db[_0xf93c('0x30')]['find']({'where':{'id':_0x12943e['params']['id']}})['then'](handleEntityNotFound(_0x4099f5,null))[_0xf93c('0x1d')](saveUpdates(_0x12943e[_0xf93c('0x3c')],null))['then'](respondWithResult(_0x4099f5,null))[_0xf93c('0x2d')](handleError(_0x4099f5,null));};exports[_0xf93c('0x1c')]=function(_0x393280,_0x37c992){return db[_0xf93c('0x30')][_0xf93c('0x3d')]({'where':{'id':_0x393280[_0xf93c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x37c992,null))[_0xf93c('0x1d')](removeEntity(_0x37c992,null))[_0xf93c('0x2d')](handleError(_0x37c992,null));};exports['describe']=function(_0x550570,_0x46dcfc){return db[_0xf93c('0x30')][_0xf93c('0x3f')]()['then'](respondWithResult(_0x46dcfc,null))['catch'](handleError(_0x46dcfc,null));};exports[_0xf93c('0x40')]=function(_0x157de9,_0x3fe8da){return db[_0xf93c('0x41')][_0xf93c('0x3d')]({'where':{'id':_0x157de9[_0xf93c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3fe8da,null))['then'](function(_0x3db21a){if(_0x3db21a){return _0x3db21a['addMessage'](_0x157de9[_0xf93c('0x3c')][_0xf93c('0x42')],_[_0xf93c('0x43')](_0x157de9[_0xf93c('0x3c')],[_0xf93c('0x42'),'id'])||{});}})['then'](respondWithResult(_0x3fe8da,null))[_0xf93c('0x2d')](handleError(_0x3fe8da,null));};exports[_0xf93c('0x44')]=function(_0x44c160,_0x1be7d6){var _0x339f13={'raw':![],'where':{}};var _0x2facf8={};var _0xd52c52={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x44c160['params']['id']}})[_0xf93c('0x1d')](handleEntityNotFound(_0x1be7d6,null))['then'](function(_0x3559c1){if(_0x3559c1){_0x2facf8[_0xf93c('0x33')]=_[_0xf93c('0x2f')](db['WhatsappMessage']['rawAttributes']);_0x2facf8[_0xf93c('0x2b')]=_[_0xf93c('0x2f')](_0x44c160[_0xf93c('0x2b')]);_0x2facf8['filters']=_[_0xf93c('0x32')](_0x2facf8['model'],_0x2facf8[_0xf93c('0x2b')]);_0x339f13[_0xf93c('0x35')]=_[_0xf93c('0x32')](_0x2facf8[_0xf93c('0x33')],qs['fields'](_0x44c160[_0xf93c('0x2b')][_0xf93c('0x34')]));_0x339f13[_0xf93c('0x35')]=_0x339f13[_0xf93c('0x35')][_0xf93c('0x36')]?_0x339f13[_0xf93c('0x35')]:_0x2facf8[_0xf93c('0x33')];if(!_0x44c160[_0xf93c('0x2b')][_0xf93c('0x45')](_0xf93c('0x46'))){_0x339f13[_0xf93c('0x17')]=qs[_0xf93c('0x17')](_0x44c160['query']['limit']);_0x339f13[_0xf93c('0x16')]=qs[_0xf93c('0x16')](_0x44c160[_0xf93c('0x2b')][_0xf93c('0x16')]);}_0x339f13[_0xf93c('0x47')]=qs[_0xf93c('0x48')](_0x44c160['query'][_0xf93c('0x48')]);_0x339f13[_0xf93c('0x49')]=qs[_0xf93c('0x31')](_[_0xf93c('0x4a')](_0x44c160[_0xf93c('0x2b')],_0x2facf8[_0xf93c('0x31')]));_0x339f13[_0xf93c('0x49')]['WhatsappInteractionId']=_0x3559c1['id'];if(_0x44c160[_0xf93c('0x2b')][_0xf93c('0x4b')]){_0x339f13['where']=_[_0xf93c('0x39')](_0x339f13[_0xf93c('0x49')],{'$or':_['map'](_0x339f13[_0xf93c('0x35')],function(_0x3a2387){var _0x28cbe8={};_0x28cbe8[_0x3a2387]={'$like':'%'+_0x44c160['query']['filter']+'%'};return _0x28cbe8;})});}if(_0x44c160[_0xf93c('0x2b')][_0xf93c('0x4c')]){var _0x598d5c=_0x44c160[_0xf93c('0x2b')][_0xf93c('0x4c')][_0xf93c('0x4d')](',');var _0x1912f7={};_0x1912f7[_0x598d5c[0x0]]={'$gte':moment(_0x598d5c[0x1])[_0xf93c('0x4e')](_0xf93c('0x4f'))};_0x339f13[_0xf93c('0x49')]=_[_0xf93c('0x39')](_0x339f13[_0xf93c('0x49')],_0x1912f7);}_0x339f13=_[_0xf93c('0x39')]({},_0x339f13,_0x44c160['options']);return db['WhatsappMessage']['count']({'where':_0x339f13[_0xf93c('0x49')]})['then'](function(_0x2929aa){_0xd52c52[_0xf93c('0x19')]=_0x2929aa;if(_0x44c160[_0xf93c('0x2b')][_0xf93c('0x37')]){_0x339f13[_0xf93c('0x38')]=[{'all':!![]}];}return db[_0xf93c('0x41')]['findAll'](_0x339f13);})[_0xf93c('0x1d')](function(_0x499e79){_0xd52c52[_0xf93c('0x50')]=_0x499e79;return _0xd52c52;});}})[_0xf93c('0x1d')](respondWithFilteredResult(_0x1be7d6,_0x339f13))['catch'](handleError(_0x1be7d6,null));};exports['addTags']=function(_0x5e8e16,_0x552802){return db['WhatsappInteraction'][_0xf93c('0x3d')]({'where':{'id':_0x5e8e16[_0xf93c('0x3e')]['id']}})[_0xf93c('0x1d')](handleEntityNotFound(_0x552802,null))[_0xf93c('0x1d')](function(_0x5ef9c0){if(_0x5ef9c0){return _0x5ef9c0['setTags'](_0x5e8e16[_0xf93c('0x3c')][_0xf93c('0x42')],_['omit'](_0x5e8e16[_0xf93c('0x3c')],['ids','id'])||{})[_0xf93c('0x51')](function(){return db['Tag'][_0xf93c('0x29')]({'attributes':['id','name',_0xf93c('0x52')],'where':{'id':_0x5e8e16[_0xf93c('0x3c')][_0xf93c('0x42')]}});})[_0xf93c('0x1d')](function(_0x4b208e){socket[_0xf93c('0x53')](_0xf93c('0x54'),{'id':Number(_0x5e8e16[_0xf93c('0x3e')]['id']),'tags':_0x4b208e||[]});return{'id':Number(_0x5e8e16[_0xf93c('0x3e')]['id']),'tags':_0x4b208e||[]};});}})[_0xf93c('0x1d')](respondWithResult(_0x552802,null))[_0xf93c('0x2d')](handleError(_0x552802,null));};exports[_0xf93c('0x55')]=function(_0xaed348,_0x1edf20){return db[_0xf93c('0x30')]['find']({'where':{'id':_0xaed348['params']['id']}})[_0xf93c('0x1d')](handleEntityNotFound(_0x1edf20,null))[_0xf93c('0x1d')](function(_0x495269){if(_0x495269){return _0x495269[_0xf93c('0x55')](_0xaed348[_0xf93c('0x2b')][_0xf93c('0x42')]);}})['then'](respondWithStatusCode(_0x1edf20,null))[_0xf93c('0x2d')](handleError(_0x1edf20,null));};exports[_0xf93c('0x56')]=function(_0x22ac64,_0x3d181f){var _0xc6d2b=moment()['unix']()['toString']();var _0x2562b9=path[_0xf93c('0x57')](config['root'],_0xf93c('0x58'),_0xf93c('0x59'),_0xf93c('0x5a'));var _0x30d562=path[_0xf93c('0x57')](config[_0xf93c('0x5b')],_0xf93c('0x58'),_0xf93c('0x59'),_0xf93c('0x5c'));var _0x33e532=path[_0xf93c('0x57')](_0x2562b9,_0xc6d2b);var _0xdb9a60=util[_0xf93c('0x4e')](_0xf93c('0x5d'),_0x22ac64[_0xf93c('0x3e')]['id'],_0xc6d2b);var _0x26cc46=path['join'](_0x2562b9,_0xdb9a60);var _0x14fdb6=[];_0x14fdb6[_0xf93c('0x5e')]({'model':db['User'],'as':_0xf93c('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x14fdb6['push']({'model':db[_0xf93c('0x60')],'as':_0xf93c('0x61'),'attributes':['id',_0xf93c('0x62'),_0xf93c('0x63')],'raw':!![]});if(_0x22ac64[_0xf93c('0x2b')][_0xf93c('0x5c')]){_0x14fdb6['push']({'model':db['Attachment'],'as':_0xf93c('0x64'),'raw':!![]});}var _0x1c90d7=[{'model':db['WhatsappMessage'],'as':_0xf93c('0x65'),'attributes':['id','body',_0xf93c('0x66'),_0xf93c('0x67'),'secret','read'],'include':_0x14fdb6}];_0x1c90d7['push']({'model':db[_0xf93c('0x68')],'as':_0xf93c('0x69'),'attributes':['id',_0xf93c('0x20')]});_0x1c90d7[_0xf93c('0x5e')]({'model':db[_0xf93c('0x5f')],'as':_0xf93c('0x6a'),'attributes':['id','fullname']});return db[_0xf93c('0x30')]['find']({'where':{'id':_0x22ac64[_0xf93c('0x3e')]['id']},'include':_0x1c90d7})[_0xf93c('0x1d')](handleEntityNotFound(_0x3d181f,null))[_0xf93c('0x1d')](function(_0x30b44a){if(_0x30b44a){var _0x7b9669=_0x30b44a[_0xf93c('0x6b')]({'plain':!![]});fs[_0xf93c('0x6c')](_0x33e532);var _0x93d0c6={'channel':_0xf93c('0x6d'),'account':_0x7b9669[_0xf93c('0x69')]['name'],'agent':_0x7b9669[_0xf93c('0x6a')]?_0x7b9669[_0xf93c('0x6a')][_0xf93c('0x6e')]:_0xf93c('0x6f'),'createdAt':moment(_0x7b9669[_0xf93c('0x66')])[_0xf93c('0x4e')](_0xf93c('0x4f'))[_0xf93c('0x70')](),'closedAt':_0x7b9669[_0xf93c('0x71')]?moment(_0x7b9669[_0xf93c('0x72')])['format'](_0xf93c('0x4f'))[_0xf93c('0x70')]():'','disposition':_0x7b9669[_0xf93c('0x73')],'messages':_(_0x7b9669[_0xf93c('0x65')])['filter']({'secret':![]})['map'](function(_0x5487e1){if(_0x5487e1[_0xf93c('0x64')]){var _0x4b3ebc=path[_0xf93c('0x57')](_0x30d562,_0x5487e1[_0xf93c('0x64')][_0xf93c('0x74')]);if(fs['existsSync'](_0x4b3ebc)){fs[_0xf93c('0x75')](_0x4b3ebc)[_0xf93c('0x76')](fs[_0xf93c('0x77')](path[_0xf93c('0x57')](_0x33e532,_0x5487e1[_0xf93c('0x64')]['basename'])));}}return{'date':moment(_0x5487e1[_0xf93c('0x66')])[_0xf93c('0x4e')](_0xf93c('0x4f'))[_0xf93c('0x70')](),'sender':_0x5487e1[_0xf93c('0x67')]===_0xf93c('0x78')?_0x5487e1['User']?_0x5487e1[_0xf93c('0x5f')][_0xf93c('0x6e')]:_0xf93c('0x79'):_0x5487e1[_0xf93c('0x61')]['firstName']+(_0x5487e1['Contact'][_0xf93c('0x63')]?'\x20'+_0x5487e1[_0xf93c('0x61')][_0xf93c('0x63')]:''),'body':_0x5487e1[_0xf93c('0x64')]?_0x5487e1[_0xf93c('0x64')][_0xf93c('0x74')]:_0x5487e1[_0xf93c('0x3c')],'direction':_0x5487e1[_0xf93c('0x67')]===_0xf93c('0x78')?'A':'C','secret':_0x5487e1[_0xf93c('0x7a')],'read':_0x5487e1[_0xf93c('0x7b')],'attachment':_0x5487e1['Attachment']};})[_0xf93c('0x7c')]()};return ejs[_0xf93c('0x7d')](path[_0xf93c('0x57')](config[_0xf93c('0x5b')],_0xf93c('0x58'),_0xf93c('0x7e'),_0xf93c('0x7f')),{'interaction':_0x93d0c6})[_0xf93c('0x1d')](function(_0xc5e765){var _0x3202d6=path[_0xf93c('0x57')](_0x33e532,_0xf93c('0x80')+_0x7b9669['id']+'-'+_0xc6d2b+_0xf93c('0x81'));var _0x13f08a={'path':_0x3202d6,'channel':_0xf93c('0x6d'),'interactionId':_0x7b9669['id']};return pdf[_0xf93c('0x82')](_0xc5e765,_0x13f08a);})[_0xf93c('0x1d')](function(){return new BPromise(function(_0x29281f,_0x917bbf){zipdir(_0x33e532,{'saveTo':_0x26cc46},function(_0x49484a,_0x3c0ad8){if(_0x49484a)return _0x917bbf(_0x49484a);return _0x29281f(_0x3c0ad8);});})['then'](function(){return new BPromise(function(_0xecc9b0,_0x5d824b){rimraf(_0x33e532,function(_0x490f66){if(_0x490f66)_0x5d824b(_0x490f66);return _0xecc9b0();});});})[_0xf93c('0x1d')](function(){return _0x3d181f['download'](_0x26cc46,_0xdb9a60,function(_0x5527cd){if(_0x5527cd){console['log'](_0xf93c('0x83'),_0x5527cd);}else{fs[_0xf93c('0x84')](_0x26cc46);}});});});}else{return _0x3d181f[_0xf93c('0x85')](0xc8);}})[_0xf93c('0x2d')](handleError(_0x3d181f,null));}; \ No newline at end of file +var _0xc759=['unix','toString','join','server','root','files','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','read','Account','Owner','fullname','get','mkdirSync','Whatsapp','closed','closedAt','disposition','existsSync','basename','out','Contact','secret','value','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','log','zip-dir','moment','bluebird','util','ejs','lodash','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','then','error','name','index','map','WhatsappInteraction','fieldName','type','key','whatsapp','query','user','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags'];(function(_0x349bdf,_0x33136){var _0x1fb731=function(_0x26d361){while(--_0x26d361){_0x349bdf['push'](_0x349bdf['shift']());}};_0x1fb731(++_0x33136);}(_0xc759,0xa0));var _0x9c75=function(_0x479498,_0x3d069c){_0x479498=_0x479498-0x0;var _0x28129d=_0xc759[_0x479498];return _0x28129d;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9c75('0x0'));var moment=require(_0x9c75('0x1'));var BPromise=require(_0x9c75('0x2'));var util=require(_0x9c75('0x3'));var path=require('path');var ejs=require(_0x9c75('0x4'));var fs=require('fs');var _=require(_0x9c75('0x5'));var Redis=require(_0x9c75('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x9c75('0x7'));var logger=require(_0x9c75('0x8'))('api');var config=require(_0x9c75('0x9'));var db=require(_0x9c75('0xa'))['db'];config[_0x9c75('0xb')]=_['defaults'](config[_0x9c75('0xb')],{'host':_0x9c75('0xc'),'port':0x18eb});var socket=require(_0x9c75('0xd'))(new Redis(config['redis']));require(_0x9c75('0xe'))[_0x9c75('0xf')](socket);function respondWithStatusCode(_0x37cf93,_0x487ec8){_0x487ec8=_0x487ec8||0xcc;return function(_0xbbda45){if(_0xbbda45){return _0x37cf93[_0x9c75('0x10')](_0x487ec8);}return _0x37cf93[_0x9c75('0x11')](_0x487ec8)[_0x9c75('0x12')]();};}function respondWithResult(_0x24e834,_0x187cd1){_0x187cd1=_0x187cd1||0xc8;return function(_0x207464){if(_0x207464){return _0x24e834[_0x9c75('0x11')](_0x187cd1)[_0x9c75('0x13')](_0x207464);}};}function respondWithFilteredResult(_0x5b06f9,_0x40a55c){return function(_0x3b9356){if(_0x3b9356){var _0x396a00=typeof _0x40a55c['offset']===_0x9c75('0x14')&&typeof _0x40a55c[_0x9c75('0x15')]==='undefined';var _0x45c7f7=_0x3b9356[_0x9c75('0x16')];var _0x133b60=_0x396a00?0x0:_0x40a55c[_0x9c75('0x17')];var _0xd79dcd=_0x396a00?_0x3b9356[_0x9c75('0x16')]:_0x40a55c[_0x9c75('0x17')]+_0x40a55c[_0x9c75('0x15')];var _0x244549;if(_0xd79dcd>=_0x45c7f7){_0xd79dcd=_0x45c7f7;_0x244549=0xc8;}else{_0x244549=0xce;}_0x5b06f9[_0x9c75('0x11')](_0x244549);return _0x5b06f9['set'](_0x9c75('0x18'),_0x133b60+'-'+_0xd79dcd+'/'+_0x45c7f7)[_0x9c75('0x13')](_0x3b9356);}return null;};}function saveUpdates(_0x4cc6a1){return function(_0x545977){if(_0x545977){return _0x545977[_0x9c75('0x19')](_0x4cc6a1)['then'](function(_0x429ecb){return _0x429ecb;});}return null;};}function removeEntity(_0x2df2a2){return function(_0x7dd3ef){if(_0x7dd3ef){return _0x7dd3ef[_0x9c75('0x1a')]()[_0x9c75('0x1b')](function(){_0x2df2a2[_0x9c75('0x11')](0xcc)[_0x9c75('0x12')]();});}};}function handleEntityNotFound(_0x23368d){return function(_0x60e278){if(!_0x60e278){_0x23368d['sendStatus'](0x194);}return _0x60e278;};}function handleError(_0x25c331,_0x38d1d9){_0x38d1d9=_0x38d1d9||0x1f4;return function(_0x507b9d){logger[_0x9c75('0x1c')](_0x507b9d['stack']);if(_0x507b9d[_0x9c75('0x1d')]){delete _0x507b9d['name'];}_0x25c331[_0x9c75('0x11')](_0x38d1d9)['send'](_0x507b9d);};}exports[_0x9c75('0x1e')]=function(_0x51673a,_0x307f8a){var _0x17ea5a={};var _0x5331b9=_[_0x9c75('0x1f')](db[_0x9c75('0x20')]['rawAttributes'],function(_0x147079){return{'name':_0x147079[_0x9c75('0x21')],'type':_0x147079[_0x9c75('0x22')][_0x9c75('0x23')]};});_0x17ea5a=qs['getOptions'](_0x5331b9,_0x51673a);return interaction['findAll'](_0x9c75('0x24'),_0x51673a[_0x9c75('0x25')],_0x51673a[_0x9c75('0x26')],_0x17ea5a,_0x5331b9)['then'](respondWithFilteredResult(_0x307f8a,_0x17ea5a))['catch'](handleError(_0x307f8a,null));};exports[_0x9c75('0x27')]=function(_0x34fe89,_0xfff582){var _0x5b4dee={'raw':![],'where':{'id':_0x34fe89[_0x9c75('0x28')]['id']}},_0x8ec01c={};_0x8ec01c[_0x9c75('0x29')]=_[_0x9c75('0x2a')](db[_0x9c75('0x20')][_0x9c75('0x2b')]);_0x8ec01c[_0x9c75('0x25')]=_[_0x9c75('0x2a')](_0x34fe89[_0x9c75('0x25')]);_0x8ec01c[_0x9c75('0x2c')]=_[_0x9c75('0x2d')](_0x8ec01c[_0x9c75('0x29')],_0x8ec01c[_0x9c75('0x25')]);_0x5b4dee['attributes']=_[_0x9c75('0x2d')](_0x8ec01c[_0x9c75('0x29')],qs[_0x9c75('0x2e')](_0x34fe89['query'][_0x9c75('0x2e')]));_0x5b4dee[_0x9c75('0x2f')]=_0x5b4dee[_0x9c75('0x2f')][_0x9c75('0x30')]?_0x5b4dee['attributes']:_0x8ec01c[_0x9c75('0x29')];if(_0x34fe89[_0x9c75('0x25')][_0x9c75('0x31')]){_0x5b4dee[_0x9c75('0x32')]=[{'all':!![]}];}_0x5b4dee=_[_0x9c75('0x33')]({},_0x5b4dee,_0x34fe89[_0x9c75('0x34')]);return db['WhatsappInteraction'][_0x9c75('0x35')](_0x5b4dee)[_0x9c75('0x1b')](handleEntityNotFound(_0xfff582,null))[_0x9c75('0x1b')](respondWithResult(_0xfff582,null))[_0x9c75('0x36')](handleError(_0xfff582,null));};exports[_0x9c75('0x37')]=function(_0xd3a66f,_0x3c8ca7){return db[_0x9c75('0x20')][_0x9c75('0x37')](_0xd3a66f[_0x9c75('0x38')],{})[_0x9c75('0x1b')](respondWithResult(_0x3c8ca7,0xc9))[_0x9c75('0x36')](handleError(_0x3c8ca7,null));};exports[_0x9c75('0x19')]=function(_0x1a7c18,_0x5ccf7e){if(_0x1a7c18[_0x9c75('0x38')]['id']){delete _0x1a7c18['body']['id'];}return db[_0x9c75('0x20')][_0x9c75('0x35')]({'where':{'id':_0x1a7c18['params']['id']}})[_0x9c75('0x1b')](handleEntityNotFound(_0x5ccf7e,null))[_0x9c75('0x1b')](saveUpdates(_0x1a7c18[_0x9c75('0x38')],null))[_0x9c75('0x1b')](respondWithResult(_0x5ccf7e,null))[_0x9c75('0x36')](handleError(_0x5ccf7e,null));};exports[_0x9c75('0x1a')]=function(_0x224c3b,_0x1e3b34){return db[_0x9c75('0x20')][_0x9c75('0x35')]({'where':{'id':_0x224c3b['params']['id']}})['then'](handleEntityNotFound(_0x1e3b34,null))[_0x9c75('0x1b')](removeEntity(_0x1e3b34,null))[_0x9c75('0x36')](handleError(_0x1e3b34,null));};exports[_0x9c75('0x39')]=function(_0x2a06d1,_0x5f3479){return db[_0x9c75('0x20')][_0x9c75('0x39')]()[_0x9c75('0x1b')](respondWithResult(_0x5f3479,null))[_0x9c75('0x36')](handleError(_0x5f3479,null));};exports[_0x9c75('0x3a')]=function(_0x2f7570,_0x563b35){return db[_0x9c75('0x3b')][_0x9c75('0x35')]({'where':{'id':_0x2f7570[_0x9c75('0x28')]['id']}})[_0x9c75('0x1b')](handleEntityNotFound(_0x563b35,null))[_0x9c75('0x1b')](function(_0x153a3a){if(_0x153a3a){return _0x153a3a['addMessage'](_0x2f7570[_0x9c75('0x38')][_0x9c75('0x3c')],_[_0x9c75('0x3d')](_0x2f7570[_0x9c75('0x38')],[_0x9c75('0x3c'),'id'])||{});}})[_0x9c75('0x1b')](respondWithResult(_0x563b35,null))[_0x9c75('0x36')](handleError(_0x563b35,null));};exports[_0x9c75('0x3e')]=function(_0x184dcd,_0x871a92){var _0x6dad39={'raw':![],'where':{}};var _0x1cc7d6={};var _0x2a5874={'count':0x0,'rows':[]};return db[_0x9c75('0x20')][_0x9c75('0x3f')]({'where':{'id':_0x184dcd[_0x9c75('0x28')]['id']}})['then'](handleEntityNotFound(_0x871a92,null))[_0x9c75('0x1b')](function(_0x278537){if(_0x278537){_0x1cc7d6[_0x9c75('0x29')]=_[_0x9c75('0x2a')](db[_0x9c75('0x3b')][_0x9c75('0x2b')]);_0x1cc7d6[_0x9c75('0x25')]=_['keys'](_0x184dcd['query']);_0x1cc7d6[_0x9c75('0x2c')]=_[_0x9c75('0x2d')](_0x1cc7d6[_0x9c75('0x29')],_0x1cc7d6[_0x9c75('0x25')]);_0x6dad39[_0x9c75('0x2f')]=_[_0x9c75('0x2d')](_0x1cc7d6[_0x9c75('0x29')],qs[_0x9c75('0x2e')](_0x184dcd['query']['fields']));_0x6dad39[_0x9c75('0x2f')]=_0x6dad39[_0x9c75('0x2f')][_0x9c75('0x30')]?_0x6dad39[_0x9c75('0x2f')]:_0x1cc7d6['model'];if(!_0x184dcd[_0x9c75('0x25')][_0x9c75('0x40')](_0x9c75('0x41'))){_0x6dad39['limit']=qs[_0x9c75('0x15')](_0x184dcd[_0x9c75('0x25')][_0x9c75('0x15')]);_0x6dad39[_0x9c75('0x17')]=qs['offset'](_0x184dcd[_0x9c75('0x25')][_0x9c75('0x17')]);}_0x6dad39[_0x9c75('0x42')]=qs[_0x9c75('0x43')](_0x184dcd[_0x9c75('0x25')]['sort']);_0x6dad39['where']=qs['filters'](_[_0x9c75('0x44')](_0x184dcd[_0x9c75('0x25')],_0x1cc7d6[_0x9c75('0x2c')]));_0x6dad39[_0x9c75('0x45')][_0x9c75('0x46')]=_0x278537['id'];if(_0x184dcd[_0x9c75('0x25')][_0x9c75('0x47')]){_0x6dad39[_0x9c75('0x45')]=_[_0x9c75('0x33')](_0x6dad39[_0x9c75('0x45')],{'$or':_[_0x9c75('0x1f')](_0x6dad39[_0x9c75('0x2f')],function(_0x2b22c2){var _0x384b3b={};_0x384b3b[_0x2b22c2]={'$like':'%'+_0x184dcd[_0x9c75('0x25')][_0x9c75('0x47')]+'%'};return _0x384b3b;})});}if(_0x184dcd[_0x9c75('0x25')][_0x9c75('0x48')]){var _0x4f01ee=_0x184dcd['query']['$gte']['split'](',');var _0x2534f8={};_0x2534f8[_0x4f01ee[0x0]]={'$gte':moment(_0x4f01ee[0x1])[_0x9c75('0x49')](_0x9c75('0x4a'))};_0x6dad39['where']=_[_0x9c75('0x33')](_0x6dad39[_0x9c75('0x45')],_0x2534f8);}_0x6dad39=_[_0x9c75('0x33')]({},_0x6dad39,_0x184dcd['options']);return db[_0x9c75('0x3b')][_0x9c75('0x16')]({'where':_0x6dad39[_0x9c75('0x45')]})[_0x9c75('0x1b')](function(_0x12d799){_0x2a5874['count']=_0x12d799;if(_0x184dcd[_0x9c75('0x25')][_0x9c75('0x31')]){_0x6dad39[_0x9c75('0x32')]=[{'all':!![]}];}return db[_0x9c75('0x3b')][_0x9c75('0x4b')](_0x6dad39);})['then'](function(_0x534704){_0x2a5874[_0x9c75('0x4c')]=_0x534704;return _0x2a5874;});}})['then'](respondWithFilteredResult(_0x871a92,_0x6dad39))[_0x9c75('0x36')](handleError(_0x871a92,null));};exports['addTags']=function(_0x262166,_0xfc3e9a){return db[_0x9c75('0x20')][_0x9c75('0x35')]({'where':{'id':_0x262166[_0x9c75('0x28')]['id']}})['then'](handleEntityNotFound(_0xfc3e9a,null))[_0x9c75('0x1b')](function(_0x44fde2){if(_0x44fde2){return _0x44fde2[_0x9c75('0x4d')](_0x262166[_0x9c75('0x38')][_0x9c75('0x3c')],_[_0x9c75('0x3d')](_0x262166[_0x9c75('0x38')],['ids','id'])||{})[_0x9c75('0x4e')](function(){return db[_0x9c75('0x4f')]['findAll']({'attributes':['id','name',_0x9c75('0x50')],'where':{'id':_0x262166['body'][_0x9c75('0x3c')]}});})['then'](function(_0x41a817){socket[_0x9c75('0x51')](_0x9c75('0x52'),{'id':Number(_0x262166[_0x9c75('0x28')]['id']),'tags':_0x41a817||[]});return{'id':Number(_0x262166[_0x9c75('0x28')]['id']),'tags':_0x41a817||[]};});}})[_0x9c75('0x1b')](respondWithResult(_0xfc3e9a,null))[_0x9c75('0x36')](handleError(_0xfc3e9a,null));};exports[_0x9c75('0x53')]=function(_0x4ad22a,_0xe7c16d){return db['WhatsappInteraction'][_0x9c75('0x35')]({'where':{'id':_0x4ad22a[_0x9c75('0x28')]['id']}})[_0x9c75('0x1b')](handleEntityNotFound(_0xe7c16d,null))['then'](function(_0x448c22){if(_0x448c22){return _0x448c22[_0x9c75('0x53')](_0x4ad22a[_0x9c75('0x25')][_0x9c75('0x3c')]);}})[_0x9c75('0x1b')](respondWithStatusCode(_0xe7c16d,null))['catch'](handleError(_0xe7c16d,null));};exports['download']=function(_0x17425e,_0x4ce8c9){var _0x64d198=moment()[_0x9c75('0x54')]()[_0x9c75('0x55')]();var _0x590154=path[_0x9c75('0x56')](config['root'],_0x9c75('0x57'),'files','tmp');var _0x5ce2db=path[_0x9c75('0x56')](config[_0x9c75('0x58')],_0x9c75('0x57'),_0x9c75('0x59'),'attachments');var _0x5542ef=path[_0x9c75('0x56')](_0x590154,_0x64d198);var _0x4c399e=util[_0x9c75('0x49')](_0x9c75('0x5a'),_0x17425e[_0x9c75('0x28')]['id'],_0x64d198);var _0x30742f=path[_0x9c75('0x56')](_0x590154,_0x4c399e);var _0x5c06e1=[];_0x5c06e1[_0x9c75('0x5b')]({'model':db[_0x9c75('0x5c')],'as':_0x9c75('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x5c06e1['push']({'model':db[_0x9c75('0x5d')],'as':'Contact','attributes':['id',_0x9c75('0x5e'),_0x9c75('0x5f')],'raw':!![]});if(_0x17425e[_0x9c75('0x25')][_0x9c75('0x60')]){_0x5c06e1['push']({'model':db[_0x9c75('0x61')],'as':'Attachment','raw':!![]});}var _0x416414=[{'model':db['WhatsappMessage'],'as':_0x9c75('0x62'),'attributes':['id',_0x9c75('0x38'),_0x9c75('0x63'),_0x9c75('0x64'),'secret',_0x9c75('0x65')],'include':_0x5c06e1}];_0x416414['push']({'model':db['WhatsappAccount'],'as':_0x9c75('0x66'),'attributes':['id',_0x9c75('0x1d')]});_0x416414[_0x9c75('0x5b')]({'model':db[_0x9c75('0x5c')],'as':_0x9c75('0x67'),'attributes':['id',_0x9c75('0x68')]});return db['WhatsappInteraction'][_0x9c75('0x35')]({'where':{'id':_0x17425e[_0x9c75('0x28')]['id']},'include':_0x416414})[_0x9c75('0x1b')](handleEntityNotFound(_0x4ce8c9,null))[_0x9c75('0x1b')](function(_0x569af2){if(_0x569af2){var _0x48ab3f=_0x569af2[_0x9c75('0x69')]({'plain':!![]});fs[_0x9c75('0x6a')](_0x5542ef);var _0x3f7913={'channel':_0x9c75('0x6b'),'account':_0x48ab3f[_0x9c75('0x66')][_0x9c75('0x1d')],'agent':_0x48ab3f['Owner']?_0x48ab3f[_0x9c75('0x67')][_0x9c75('0x68')]:'N.A.','createdAt':moment(_0x48ab3f[_0x9c75('0x63')])[_0x9c75('0x49')](_0x9c75('0x4a'))[_0x9c75('0x55')](),'closedAt':_0x48ab3f[_0x9c75('0x6c')]?moment(_0x48ab3f[_0x9c75('0x6d')])['format'](_0x9c75('0x4a'))['toString']():'','disposition':_0x48ab3f[_0x9c75('0x6e')],'messages':_(_0x48ab3f['Messages'])[_0x9c75('0x47')]({'secret':![]})[_0x9c75('0x1f')](function(_0x1775fd){if(_0x1775fd['Attachment']){var _0x8bacc=path[_0x9c75('0x56')](_0x5ce2db,_0x1775fd[_0x9c75('0x61')]['basename']);if(fs[_0x9c75('0x6f')](_0x8bacc)){fs['createReadStream'](_0x8bacc)['pipe'](fs['createWriteStream'](path[_0x9c75('0x56')](_0x5542ef,_0x1775fd[_0x9c75('0x61')][_0x9c75('0x70')])));}}return{'date':moment(_0x1775fd[_0x9c75('0x63')])['format'](_0x9c75('0x4a'))[_0x9c75('0x55')](),'sender':_0x1775fd[_0x9c75('0x64')]===_0x9c75('0x71')?_0x1775fd['User']?_0x1775fd[_0x9c75('0x5c')][_0x9c75('0x68')]:'System':_0x1775fd[_0x9c75('0x72')][_0x9c75('0x5e')]+(_0x1775fd[_0x9c75('0x72')][_0x9c75('0x5f')]?'\x20'+_0x1775fd['Contact']['lastName']:''),'body':_0x1775fd['Attachment']?_0x1775fd[_0x9c75('0x61')][_0x9c75('0x70')]:_0x1775fd[_0x9c75('0x38')],'direction':_0x1775fd[_0x9c75('0x64')]==='out'?'A':'C','secret':_0x1775fd[_0x9c75('0x73')],'read':_0x1775fd['read'],'attachment':_0x1775fd['Attachment']};})[_0x9c75('0x74')]()};return ejs[_0x9c75('0x75')](path[_0x9c75('0x56')](config['root'],'server',_0x9c75('0x76'),_0x9c75('0x77')),{'interaction':_0x3f7913})[_0x9c75('0x1b')](function(_0x139f9e){var _0x2a9c49=path['join'](_0x5542ef,'transcript-'+_0x48ab3f['id']+'-'+_0x64d198+'.pdf');var _0x2a6819={'path':_0x2a9c49,'channel':_0x9c75('0x6b'),'interactionId':_0x48ab3f['id']};return pdf[_0x9c75('0x78')](_0x139f9e,_0x2a6819);})[_0x9c75('0x1b')](function(){return new BPromise(function(_0x26f3d7,_0x4ff023){zipdir(_0x5542ef,{'saveTo':_0x30742f},function(_0x4718b7,_0x54cb01){if(_0x4718b7)return _0x4ff023(_0x4718b7);return _0x26f3d7(_0x54cb01);});})[_0x9c75('0x1b')](function(){return new BPromise(function(_0x2112ba,_0x328cb3){rimraf(_0x5542ef,function(_0x301796){if(_0x301796)_0x328cb3(_0x301796);return _0x2112ba();});});})['then'](function(){return _0x4ce8c9['download'](_0x30742f,_0x4c399e,function(_0x4e9545){if(_0x4e9545){console[_0x9c75('0x79')]('err',_0x4e9545);}else{fs['unlinkSync'](_0x30742f);}});});});}else{return _0x4ce8c9[_0x9c75('0x10')](0xc8);}})[_0x9c75('0x36')](handleError(_0x4ce8c9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5075d3e..9a2e5e3 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 _0x1306=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb'];(function(_0x4b4e8e,_0x525742){var _0x518cde=function(_0x1274ee){while(--_0x1274ee){_0x4b4e8e['push'](_0x4b4e8e['shift']());}};_0x518cde(++_0x525742);}(_0x1306,0x17a));var _0x6130=function(_0x3593d7,_0x5a96a2){_0x3593d7=_0x3593d7-0x0;var _0x3a2754=_0x1306[_0x3593d7];return _0x3a2754;};'use strict';var EventEmitter=require(_0x6130('0x0'));var WhatsappInteraction=require(_0x6130('0x1'))['db'][_0x6130('0x2')];var WhatsappMessage=require(_0x6130('0x1'))['db'][_0x6130('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6130('0x4')](0x0);var events={'afterCreate':_0x6130('0x5'),'afterUpdate':_0x6130('0x6'),'afterDestroy':_0x6130('0x7')};function emitEvent(_0x33f042){return function(_0x447c7f,_0x181070,_0x213e6a){_0x447c7f[_0x6130('0x8')]({'attributes':['id'],'raw':!![]})[_0x6130('0x9')](function(_0x25469a){_0x447c7f[_0x6130('0xa')](_0x6130('0xb'),_0x25469a[_0x6130('0xc')](function(_0x2854a1){return{'id':_0x2854a1['id']};}));return WhatsappMessage[_0x6130('0xd')]({'where':{'WhatsappInteractionId':_0x447c7f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6130('0x9')](function(_0xb9c7e6){_0x447c7f[_0x6130('0xa')](_0x6130('0xe'),_0xb9c7e6[_0x6130('0xf')]);WhatsappInteractionEvents[_0x6130('0x10')](_0x33f042+':'+_0x447c7f['id'],_0x447c7f);WhatsappInteractionEvents[_0x6130('0x10')](_0x33f042,_0x447c7f);_0x213e6a(null);})[_0x6130('0x11')](_0x213e6a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x6130('0x12')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xcab6=['Users','map','then','unreadMessages','length','emit','catch','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcab6,0xd4));var _0x6cab=function(_0x53aa8e,_0x4bf1a1){_0x53aa8e=_0x53aa8e-0x0;var _0x4bbc78=_0xcab6[_0x53aa8e];return _0x4bbc78;};'use strict';var EventEmitter=require(_0x6cab('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x6cab('0x1')];var WhatsappMessage=require(_0x6cab('0x2'))['db'][_0x6cab('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6cab('0x4')](0x0);var events={'afterCreate':_0x6cab('0x5'),'afterUpdate':_0x6cab('0x6'),'afterDestroy':'remove'};function emitEvent(_0xa8b534){return function(_0x4c79f1,_0xb84505,_0x1953cd){_0x4c79f1[_0x6cab('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xdcd26b){_0x4c79f1[_0x6cab('0x8')](_0x6cab('0x9'),_0xdcd26b[_0x6cab('0xa')](function(_0x58d0ee){return{'id':_0x58d0ee['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x4c79f1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6cab('0xb')](function(_0x37f00d){_0x4c79f1[_0x6cab('0x8')](_0x6cab('0xc'),_0x37f00d[_0x6cab('0xd')]);WhatsappInteractionEvents[_0x6cab('0xe')](_0xa8b534+':'+_0x4c79f1['id'],_0x4c79f1);WhatsappInteractionEvents['emit'](_0xa8b534,_0x4c79f1);_0x1953cd(null);})[_0x6cab('0xf')](_0x1953cd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x6cab('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index d1d3931..0b950d8 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 _0x5e02=['define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise','path','./whatsappInteraction.attributes','exports'];(function(_0x2698c5,_0x3eb2b1){var _0xdbf909=function(_0x11befe){while(--_0x11befe){_0x2698c5['push'](_0x2698c5['shift']());}};_0xdbf909(++_0x3eb2b1);}(_0x5e02,0x1c7));var _0x25e0=function(_0x35cf12,_0x2ffb85){_0x35cf12=_0x35cf12-0x0;var _0x44f186=_0x5e02[_0x35cf12];return _0x44f186;};'use strict';var _=require(_0x25e0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x25e0('0x1'));var BPromise=require(_0x25e0('0x2'));var rp=require(_0x25e0('0x3'));var fs=require('fs');var path=require(_0x25e0('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x25e0('0x5'));module[_0x25e0('0x6')]=function(_0x59be92,_0x18e534){return _0x59be92[_0x25e0('0x7')](_0x25e0('0x8'),attributes,{'tableName':_0x25e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bda31,_0x2b2101,_0x4fd433){if(_0x2bda31['changed'](_0x25e0('0xa'))){_0x2bda31[_0x25e0('0xb')]=moment()[_0x25e0('0xc')](_0x25e0('0xd'));}_0x4fd433(null,_0x2bda31);}}});}; \ No newline at end of file +var _0x8277=['WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','define'];(function(_0x5b7e20,_0x17cfec){var _0x57eddf=function(_0x486ca0){while(--_0x486ca0){_0x5b7e20['push'](_0x5b7e20['shift']());}};_0x57eddf(++_0x17cfec);}(_0x8277,0x1d4));var _0x7827=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x8277[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x7827('0x0'));var util=require(_0x7827('0x1'));var logger=require(_0x7827('0x2'))(_0x7827('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7827('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7827('0x5'));var config=require(_0x7827('0x6'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x1c04b6,_0x1386b1){return _0x1c04b6[_0x7827('0x7')](_0x7827('0x8'),attributes,{'tableName':_0x7827('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1620b3,_0x14da38,_0x198152){if(_0x1620b3[_0x7827('0xa')](_0x7827('0xb'))){_0x1620b3['closedAt']=moment()[_0x7827('0xc')](_0x7827('0xd'));}_0x198152(null,_0x1620b3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index d872a92..3f1d312 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 _0x89d9=['body','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','WhatsappInteraction','update','options','raw','where','UpdateWhatsappInteraction','stringify'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x89d9,0xa5));var _0x989d=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x89d9[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x989d('0x0'));var util=require(_0x989d('0x1'));var moment=require(_0x989d('0x2'));var BPromise=require(_0x989d('0x3'));var rs=require(_0x989d('0x4'));var fs=require('fs');var Redis=require(_0x989d('0x5'));var db=require(_0x989d('0x6'))['db'];var utils=require(_0x989d('0x7'));var logger=require(_0x989d('0x8'))('rpc');var config=require(_0x989d('0x9'));var jayson=require(_0x989d('0xa'));var client=jayson[_0x989d('0xb')]['http']({'port':0x232a});config[_0x989d('0xc')]=_[_0x989d('0xd')](config['redis'],{'host':_0x989d('0xe'),'port':0x18eb});var socket=require(_0x989d('0xf'))(new Redis(config['redis']));require(_0x989d('0x10'))['register'](socket);function respondWithRpcPromise(_0x55d75f,_0x587a6f,_0x39c9d0){return new BPromise(function(_0x5b4d73,_0x1e0f59){return client[_0x989d('0x11')](_0x55d75f,_0x39c9d0)[_0x989d('0x12')](function(_0x3b5b3f){logger[_0x989d('0x13')](_0x989d('0x14'),_0x587a6f,_0x989d('0x15'));logger[_0x989d('0x16')](_0x989d('0x17'),_0x587a6f,_0x989d('0x15'),JSON['stringify'](_0x3b5b3f));if(_0x3b5b3f[_0x989d('0x18')]){if(_0x3b5b3f['error']['code']===0x1f4){logger[_0x989d('0x18')](_0x989d('0x14'),_0x587a6f,_0x3b5b3f['error'][_0x989d('0x19')]);return _0x1e0f59(_0x3b5b3f[_0x989d('0x18')][_0x989d('0x19')]);}logger[_0x989d('0x18')](_0x989d('0x14'),_0x587a6f,_0x3b5b3f[_0x989d('0x18')]['message']);return _0x5b4d73(_0x3b5b3f[_0x989d('0x18')][_0x989d('0x19')]);}else{logger[_0x989d('0x13')](_0x989d('0x14'),_0x587a6f,'request\x20sent');_0x5b4d73(_0x3b5b3f[_0x989d('0x1a')][_0x989d('0x19')]);}})[_0x989d('0x1b')](function(_0x6be9bb){logger[_0x989d('0x18')](_0x989d('0x14'),_0x587a6f,_0x6be9bb);_0x1e0f59(_0x6be9bb);});});}exports['UpdateWhatsappInteraction']=function(_0x52c836){var _0xbad585=this;return new Promise(function(_0x24638e,_0x52c7a8){return db[_0x989d('0x1c')][_0x989d('0x1d')](_0x52c836['body'],{'raw':_0x52c836[_0x989d('0x1e')]?_0x52c836[_0x989d('0x1e')][_0x989d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52c836['options']?_0x52c836[_0x989d('0x1e')][_0x989d('0x20')]||null:null,'attributes':_0x52c836['options']?_0x52c836[_0x989d('0x1e')]['attributes']||null:null,'limit':_0x52c836[_0x989d('0x1e')]?_0x52c836[_0x989d('0x1e')]['limit']||null:null})[_0x989d('0x12')](function(_0x452eb1){logger[_0x989d('0x13')](_0x989d('0x21'),_0x52c836);logger[_0x989d('0x16')](_0x989d('0x21'),_0x52c836,JSON[_0x989d('0x22')](_0x452eb1));_0x24638e(_0x452eb1);})[_0x989d('0x1b')](function(_0x4c5be2){logger['error'](_0x989d('0x21'),_0x4c5be2[_0x989d('0x19')],_0x52c836);_0x52c7a8(_0xbad585[_0x989d('0x18')](0x1f4,_0x4c5be2[_0x989d('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x144d2e){return new Promise(function(_0xc48932,_0x7b70d4){return db['WhatsappInteraction']['find']({'where':_0x144d2e[_0x989d('0x1e')]?_0x144d2e[_0x989d('0x1e')][_0x989d('0x20')]||null:null})[_0x989d('0x12')](function(_0x2cb00){if(_0x2cb00){return _0x2cb00['addTags'](_0x144d2e[_0x989d('0x23')]['ids'],_[_0x989d('0x24')](_0x144d2e[_0x989d('0x23')],[_0x989d('0x25'),'id'])||{});}})[_0x989d('0x26')](function(_0x43de5f){logger[_0x989d('0x13')](_0x989d('0x27'),_0x144d2e);logger['debug']('AddTags',_0x144d2e,JSON[_0x989d('0x22')](_0x43de5f));_0xc48932(_0x43de5f);})['catch'](function(_0x4dc67){logger[_0x989d('0x18')]('AddTags',_0x4dc67[_0x989d('0x19')],_0x144d2e);_0x7b70d4(_this[_0x989d('0x18')](0x1f4,_0x4dc67[_0x989d('0x19')]));});});}; \ No newline at end of file +var _0xe079=['redis','localhost','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0xe079,0x13f));var _0x9e07=function(_0x70b15e,_0x5321a0){_0x70b15e=_0x70b15e-0x0;var _0x12010f=_0xe079[_0x70b15e];return _0x12010f;};'use strict';var _=require(_0x9e07('0x0'));var util=require('util');var moment=require(_0x9e07('0x1'));var BPromise=require(_0x9e07('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e07('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9e07('0x4'));var config=require(_0x9e07('0x5'));var jayson=require(_0x9e07('0x6'));var client=jayson[_0x9e07('0x7')][_0x9e07('0x8')]({'port':0x232a});config[_0x9e07('0x9')]=_['defaults'](config[_0x9e07('0x9')],{'host':_0x9e07('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e07('0x9')]));require(_0x9e07('0xb'))['register'](socket);function respondWithRpcPromise(_0x205bc9,_0x340411,_0x2e9323){return new BPromise(function(_0x342ae9,_0x589c8d){return client[_0x9e07('0xc')](_0x205bc9,_0x2e9323)[_0x9e07('0xd')](function(_0x2225fb){logger[_0x9e07('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x340411,_0x9e07('0xf'));logger[_0x9e07('0x10')](_0x9e07('0x11'),_0x340411,_0x9e07('0xf'),JSON['stringify'](_0x2225fb));if(_0x2225fb[_0x9e07('0x12')]){if(_0x2225fb['error'][_0x9e07('0x13')]===0x1f4){logger[_0x9e07('0x12')](_0x9e07('0x14'),_0x340411,_0x2225fb['error'][_0x9e07('0x15')]);return _0x589c8d(_0x2225fb['error'][_0x9e07('0x15')]);}logger[_0x9e07('0x12')](_0x9e07('0x14'),_0x340411,_0x2225fb['error'][_0x9e07('0x15')]);return _0x342ae9(_0x2225fb[_0x9e07('0x12')][_0x9e07('0x15')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x340411,'request\x20sent');_0x342ae9(_0x2225fb[_0x9e07('0x16')][_0x9e07('0x15')]);}})[_0x9e07('0x17')](function(_0x179945){logger['error'](_0x9e07('0x14'),_0x340411,_0x179945);_0x589c8d(_0x179945);});});}exports[_0x9e07('0x18')]=function(_0x590a0c){var _0x43140f=this;return new Promise(function(_0x2e4f96,_0x403315){return db[_0x9e07('0x19')][_0x9e07('0x1a')](_0x590a0c['body'],{'raw':_0x590a0c[_0x9e07('0x1b')]?_0x590a0c[_0x9e07('0x1b')][_0x9e07('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590a0c[_0x9e07('0x1b')]?_0x590a0c[_0x9e07('0x1b')][_0x9e07('0x1d')]||null:null,'attributes':_0x590a0c[_0x9e07('0x1b')]?_0x590a0c[_0x9e07('0x1b')][_0x9e07('0x1e')]||null:null,'limit':_0x590a0c[_0x9e07('0x1b')]?_0x590a0c[_0x9e07('0x1b')][_0x9e07('0x1f')]||null:null})[_0x9e07('0xd')](function(_0x304bc4){logger[_0x9e07('0xe')](_0x9e07('0x18'),_0x590a0c);logger['debug'](_0x9e07('0x18'),_0x590a0c,JSON[_0x9e07('0x20')](_0x304bc4));_0x2e4f96(_0x304bc4);})[_0x9e07('0x17')](function(_0x42ca73){logger['error'](_0x9e07('0x18'),_0x42ca73[_0x9e07('0x15')],_0x590a0c);_0x403315(_0x43140f[_0x9e07('0x12')](0x1f4,_0x42ca73[_0x9e07('0x15')]));});});};exports[_0x9e07('0x21')]=function(_0x1eefb6){return new Promise(function(_0x1ea421,_0x3ebd96){return db[_0x9e07('0x19')][_0x9e07('0x22')]({'where':_0x1eefb6[_0x9e07('0x1b')]?_0x1eefb6[_0x9e07('0x1b')][_0x9e07('0x1d')]||null:null})[_0x9e07('0xd')](function(_0x260f97){if(_0x260f97){return _0x260f97[_0x9e07('0x23')](_0x1eefb6[_0x9e07('0x24')][_0x9e07('0x25')],_[_0x9e07('0x26')](_0x1eefb6['body'],[_0x9e07('0x25'),'id'])||{});}})[_0x9e07('0x27')](function(_0x250ff1){logger[_0x9e07('0xe')](_0x9e07('0x28'),_0x1eefb6);logger[_0x9e07('0x10')](_0x9e07('0x28'),_0x1eefb6,JSON['stringify'](_0x250ff1));_0x1ea421(_0x250ff1);})['catch'](function(_0x50d1a2){logger[_0x9e07('0x12')](_0x9e07('0x28'),_0x50d1a2['message'],_0x1eefb6);_0x3ebd96(_this[_0x9e07('0x12')](0x1f4,_0x50d1a2[_0x9e07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7169a0f..7081e74 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 _0xefe9=['./whatsappInteraction.events','save','remove','update','removeListener','register','length','whatsappInteraction:'];(function(_0x227427,_0x3159c8){var _0x51d536=function(_0x4d7244){while(--_0x4d7244){_0x227427['push'](_0x227427['shift']());}};_0x51d536(++_0x3159c8);}(_0xefe9,0x180));var _0x9efe=function(_0x50cbb4,_0x196b3b){_0x50cbb4=_0x50cbb4-0x0;var _0x246938=_0xefe9[_0x50cbb4];return _0x246938;};'use strict';var WhatsappInteractionEvents=require(_0x9efe('0x0'));var events=[_0x9efe('0x1'),_0x9efe('0x2'),_0x9efe('0x3')];function createListener(_0x44de2f,_0x28eef3){return function(_0x1b309e){_0x28eef3['emit'](_0x44de2f,_0x1b309e);};}function removeListener(_0x5a51e3,_0x32b2e1){return function(){WhatsappInteractionEvents[_0x9efe('0x4')](_0x5a51e3,_0x32b2e1);};}exports[_0x9efe('0x5')]=function(_0x326780){for(var _0x436269=0x0,_0x5b5392=events[_0x9efe('0x6')];_0x436269<_0x5b5392;_0x436269++){var _0x6523bc=events[_0x436269];var _0x15ce2d=createListener(_0x9efe('0x7')+_0x6523bc,_0x326780);WhatsappInteractionEvents['on'](_0x6523bc,_0x15ce2d);}}; \ No newline at end of file +var _0x5013=['save','remove','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x19365f,_0xfb856c){var _0x394e62=function(_0x258f06){while(--_0x258f06){_0x19365f['push'](_0x19365f['shift']());}};_0x394e62(++_0xfb856c);}(_0x5013,0x1dc));var _0x3501=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x5013[_0x3ce3c];return _0x55a2c9;};'use strict';var WhatsappInteractionEvents=require(_0x3501('0x0'));var events=[_0x3501('0x1'),_0x3501('0x2'),_0x3501('0x3')];function createListener(_0x54f2ae,_0x5f3802){return function(_0x5dae06){_0x5f3802[_0x3501('0x4')](_0x54f2ae,_0x5dae06);};}function removeListener(_0x1a5dd8,_0x563b8b){return function(){WhatsappInteractionEvents[_0x3501('0x5')](_0x1a5dd8,_0x563b8b);};}exports[_0x3501('0x6')]=function(_0x2e66b0){for(var _0x4c5dd9=0x0,_0x45da3c=events[_0x3501('0x7')];_0x4c5dd9<_0x45da3c;_0x4c5dd9++){var _0x3be614=events[_0x4c5dd9];var _0x851425=createListener(_0x3501('0x8')+_0x3be614,_0x2e66b0);WhatsappInteractionEvents['on'](_0x3be614,_0x851425);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3a69efa..eaeea8e 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 _0x7f82=['accept','delete','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','describe','post','tracked','whatsappmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept'];(function(_0x519835,_0xcbbf){var _0x4c7163=function(_0x16e37f){while(--_0x16e37f){_0x519835['push'](_0x519835['shift']());}};_0x4c7163(++_0xcbbf);}(_0x7f82,0x172));var _0x27f8=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x7f82[_0x4394b6];return _0x360244;};'use strict';var multer=require(_0x27f8('0x0'));var util=require(_0x27f8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x27f8('0x2')]();var fs_extra=require(_0x27f8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x27f8('0x4'));var config=require(_0x27f8('0x5'));var controller=require(_0x27f8('0x6'));router[_0x27f8('0x7')]('/',auth['isAuthenticated'](),controller[_0x27f8('0x8')]);router[_0x27f8('0x7')]('/describe',auth[_0x27f8('0x9')](),controller[_0x27f8('0xa')]);router[_0x27f8('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x27f8('0xb')]('/',auth[_0x27f8('0x9')](),interaction[_0x27f8('0xc')]('whatsapp',_0x27f8('0xd')),controller[_0x27f8('0xe')]);router[_0x27f8('0xb')](_0x27f8('0xf'),controller[_0x27f8('0x10')]);router[_0x27f8('0x11')](_0x27f8('0x12'),auth['isAuthenticated'](),controller[_0x27f8('0x13')]);router['put'](_0x27f8('0x14'),auth[_0x27f8('0x9')](),controller[_0x27f8('0x15')]);router[_0x27f8('0x11')]('/:id/reject',auth[_0x27f8('0x9')](),controller['reject']);router[_0x27f8('0x16')](_0x27f8('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1185=['isAuthenticated','describe','/:id','show','whatsapp','whatsappmessage:create','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe'];(function(_0xb8e886,_0x2766b5){var _0x3e404e=function(_0x198513){while(--_0x198513){_0xb8e886['push'](_0xb8e886['shift']());}};_0x3e404e(++_0x2766b5);}(_0x1185,0x6c));var _0x5118=function(_0x15e7ca,_0x218215){_0x15e7ca=_0x15e7ca-0x0;var _0x5565d6=_0x1185[_0x15e7ca];return _0x5565d6;};'use strict';var multer=require(_0x5118('0x0'));var util=require(_0x5118('0x1'));var path=require(_0x5118('0x2'));var timeout=require('connect-timeout');var express=require(_0x5118('0x3'));var router=express[_0x5118('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5118('0x5'));var interaction=require(_0x5118('0x6'));var config=require(_0x5118('0x7'));var controller=require(_0x5118('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5118('0x9')]);router[_0x5118('0xa')](_0x5118('0xb'),auth[_0x5118('0xc')](),controller[_0x5118('0xd')]);router[_0x5118('0xa')](_0x5118('0xe'),auth[_0x5118('0xc')](),controller[_0x5118('0xf')]);router['post']('/',auth[_0x5118('0xc')](),interaction['tracked'](_0x5118('0x10'),_0x5118('0x11')),controller['create']);router['post']('/:id/status',controller['status']);router[_0x5118('0x12')](_0x5118('0xe'),auth[_0x5118('0xc')](),controller['update']);router[_0x5118('0x12')]('/:id/accept',auth[_0x5118('0xc')](),controller[_0x5118('0x13')]);router[_0x5118('0x12')](_0x5118('0x14'),auth['isAuthenticated'](),controller[_0x5118('0x15')]);router['delete'](_0x5118('0xe'),auth['isAuthenticated'](),controller[_0x5118('0x16')]);module[_0x5118('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 3c546ea..bcd0f15 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 _0x9432=['STRING','DATE','TEXT','sequelize','exports','medium','BOOLEAN','out'];(function(_0x1fde1b,_0x35dc0a){var _0x453285=function(_0x58951f){while(--_0x58951f){_0x1fde1b['push'](_0x1fde1b['shift']());}};_0x453285(++_0x35dc0a);}(_0x9432,0x1e3));var _0x2943=function(_0x47e74f,_0x2ccb54){_0x47e74f=_0x47e74f-0x0;var _0x398c8f=_0x9432[_0x47e74f];return _0x398c8f;};'use strict';var Sequelize=require(_0x2943('0x0'));module[_0x2943('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2943('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2943('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2943('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2943('0x5')]},'readAt':{'type':Sequelize[_0x2943('0x6')]},'secret':{'type':Sequelize[_0x2943('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2943('0x5')]},'providerResponse':{'type':Sequelize[_0x2943('0x7')]}}; \ No newline at end of file +var _0x4c85=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x4cfc34,_0x2cd11e){var _0x8e6a43=function(_0x52a49f){while(--_0x52a49f){_0x4cfc34['push'](_0x4cfc34['shift']());}};_0x8e6a43(++_0x2cd11e);}(_0x4c85,0xa5));var _0x54c8=function(_0x30d624,_0x160d06){_0x30d624=_0x30d624-0x0;var _0x16f949=_0x4c85[_0x30d624];return _0x16f949;};'use strict';var Sequelize=require(_0x54c8('0x0'));module['exports']={'body':{'type':Sequelize[_0x54c8('0x1')](_0x54c8('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x54c8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x54c8('0x4')]('in',_0x54c8('0x5')),'defaultValue':_0x54c8('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x54c8('0x6')](0xbe)},'phone':{'type':Sequelize[_0x54c8('0x6')]},'readAt':{'type':Sequelize[_0x54c8('0x7')]},'secret':{'type':Sequelize[_0x54c8('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'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 20c226a..a177832 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 _0x3fba=['[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','channel','motionChannel','rejectmessage','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteraction','WhatsappInteractionId','isNil','format','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','SIP/%s','event','EventManager','acceptmessage','whatsapp-interactions','get'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3fba,0x11c));var _0xa3fb=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3fba[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xa3fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3fb('0x1'));var jsonpatch=require(_0xa3fb('0x2'));var rp=require(_0xa3fb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa3fb('0x4'));var util=require('util');var path=require(_0xa3fb('0x5'));var sox=require(_0xa3fb('0x6'));var csv=require(_0xa3fb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3fb('0x8'));var _=require(_0xa3fb('0x9'));var squel=require(_0xa3fb('0xa'));var crypto=require(_0xa3fb('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3fb('0xc'));var Papa=require(_0xa3fb('0xd'));var Redis=require(_0xa3fb('0xe'));var authService=require(_0xa3fb('0xf'));var qs=require(_0xa3fb('0x10'));var as=require(_0xa3fb('0x11'));var hardwareService=require(_0xa3fb('0x12'));var logger=require(_0xa3fb('0x13'))('api');var utils=require(_0xa3fb('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa3fb('0x15')]=_[_0xa3fb('0x16')](config['redis'],{'host':_0xa3fb('0x17'),'port':0x18eb});var socket=require(_0xa3fb('0x18'))(new Redis(config[_0xa3fb('0x15')]));require(_0xa3fb('0x19'))[_0xa3fb('0x1a')](socket);var jayson=require(_0xa3fb('0x1b'));var client=jayson[_0xa3fb('0x1c')][_0xa3fb('0x1d')]({'port':0x232c});var client9002=jayson[_0xa3fb('0x1c')][_0xa3fb('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x27ed5f,_0x419cdb,_0x269bcc,_0x14203f){return new BPromise(function(_0x3c6d35,_0x303030){var _0xf9096c=_0x14203f||client;return _0xf9096c['request'](_0x27ed5f,_0x269bcc)['then'](function(_0x22632f){logger[_0xa3fb('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x419cdb,_0xa3fb('0x1f'));logger['debug'](_0xa3fb('0x20'),_0x419cdb,_0xa3fb('0x1f'),JSON[_0xa3fb('0x21')](_0x22632f));if(_0x22632f[_0xa3fb('0x22')]){if(_0x22632f[_0xa3fb('0x22')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x419cdb,_0x22632f[_0xa3fb('0x22')][_0xa3fb('0x23')]);return _0x303030(_0x22632f[_0xa3fb('0x22')][_0xa3fb('0x23')]);}logger[_0xa3fb('0x22')](_0xa3fb('0x24'),_0x419cdb,_0x22632f[_0xa3fb('0x22')][_0xa3fb('0x23')]);return _0x3c6d35(_0x22632f[_0xa3fb('0x22')]['message']);}else{logger[_0xa3fb('0x1e')](_0xa3fb('0x24'),_0x419cdb,_0xa3fb('0x1f'));_0x3c6d35(_0x22632f[_0xa3fb('0x25')][_0xa3fb('0x23')]);}})[_0xa3fb('0x26')](function(_0x3d2bf7){logger[_0xa3fb('0x22')](_0xa3fb('0x24'),_0x419cdb,_0x3d2bf7);_0x303030(_0x3d2bf7);});});}function respondWithStatusCode(_0x4cfcc1,_0x5ed787){_0x5ed787=_0x5ed787||0xcc;return function(_0x3b53a8){if(_0x3b53a8){return _0x4cfcc1[_0xa3fb('0x27')](_0x5ed787);}return _0x4cfcc1[_0xa3fb('0x28')](_0x5ed787)['end']();};}function respondWithResult(_0xffe48e,_0x225b34){_0x225b34=_0x225b34||0xc8;return function(_0x450c49){if(_0x450c49){return _0xffe48e[_0xa3fb('0x28')](_0x225b34)[_0xa3fb('0x29')](_0x450c49);}};}function respondWithFilteredResult(_0x39701f,_0x2db7b2){return function(_0x54077e){if(_0x54077e){var _0x525295=typeof _0x2db7b2[_0xa3fb('0x2a')]===_0xa3fb('0x2b')&&typeof _0x2db7b2[_0xa3fb('0x2c')]==='undefined';var _0x5bbf5b=_0x54077e[_0xa3fb('0x2d')];var _0x3d0936=_0x525295?0x0:_0x2db7b2[_0xa3fb('0x2a')];var _0x3b0dd6=_0x525295?_0x54077e[_0xa3fb('0x2d')]:_0x2db7b2[_0xa3fb('0x2a')]+_0x2db7b2[_0xa3fb('0x2c')];var _0x73de8e;if(_0x3b0dd6>=_0x5bbf5b){_0x3b0dd6=_0x5bbf5b;_0x73de8e=0xc8;}else{_0x73de8e=0xce;}_0x39701f[_0xa3fb('0x28')](_0x73de8e);return _0x39701f[_0xa3fb('0x2e')](_0xa3fb('0x2f'),_0x3d0936+'-'+_0x3b0dd6+'/'+_0x5bbf5b)['json'](_0x54077e);}return null;};}function patchUpdates(_0x598524){return function(_0x546d0b){try{jsonpatch[_0xa3fb('0x30')](_0x546d0b,_0x598524,!![]);}catch(_0x94590a){return BPromise[_0xa3fb('0x31')](_0x94590a);}return _0x546d0b[_0xa3fb('0x32')]();};}function saveUpdates(_0xb34ba5,_0x2de744){return function(_0x3edd75){if(_0x3edd75){return _0x3edd75[_0xa3fb('0x33')](_0xb34ba5)[_0xa3fb('0x34')](function(_0x2a9fce){return _0x2a9fce;});}return null;};}function removeEntity(_0x1cf33d,_0x3030ca){return function(_0x3966c2){if(_0x3966c2){return _0x3966c2[_0xa3fb('0x35')]()[_0xa3fb('0x34')](function(){_0x1cf33d[_0xa3fb('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5415ca,_0x56b13b){return function(_0x379b94){if(!_0x379b94){_0x5415ca[_0xa3fb('0x27')](0x194);}return _0x379b94;};}function handleError(_0x112a0a,_0xaf234c){_0xaf234c=_0xaf234c||0x1f4;return function(_0x5224e7){logger['error'](_0x5224e7['stack']);if(_0x5224e7['name']){delete _0x5224e7['name'];}_0x112a0a[_0xa3fb('0x28')](_0xaf234c)[_0xa3fb('0x36')](_0x5224e7);};}exports[_0xa3fb('0x37')]=function(_0x10ce7b,_0x416b03){var _0x528632={},_0x5ad1d1={},_0x470f4b={'count':0x0,'rows':[]};var _0xc98bc1=_[_0xa3fb('0x38')](db[_0xa3fb('0x39')][_0xa3fb('0x3a')],function(_0x19961e){return{'name':_0x19961e[_0xa3fb('0x3b')],'type':_0x19961e[_0xa3fb('0x3c')][_0xa3fb('0x3d')]};});_0x5ad1d1[_0xa3fb('0x3e')]=_[_0xa3fb('0x38')](_0xc98bc1,_0xa3fb('0x3f'));_0x5ad1d1[_0xa3fb('0x40')]=_[_0xa3fb('0x41')](_0x10ce7b['query']);_0x5ad1d1['filters']=_[_0xa3fb('0x42')](_0x5ad1d1[_0xa3fb('0x3e')],_0x5ad1d1[_0xa3fb('0x40')]);_0x528632[_0xa3fb('0x43')]=_[_0xa3fb('0x42')](_0x5ad1d1[_0xa3fb('0x3e')],qs['fields'](_0x10ce7b['query'][_0xa3fb('0x44')]));_0x528632[_0xa3fb('0x43')]=_0x528632[_0xa3fb('0x43')][_0xa3fb('0x45')]?_0x528632[_0xa3fb('0x43')]:_0x5ad1d1[_0xa3fb('0x3e')];if(!_0x10ce7b[_0xa3fb('0x40')][_0xa3fb('0x46')](_0xa3fb('0x47'))){_0x528632[_0xa3fb('0x2c')]=qs[_0xa3fb('0x2c')](_0x10ce7b[_0xa3fb('0x40')]['limit']);_0x528632[_0xa3fb('0x2a')]=qs[_0xa3fb('0x2a')](_0x10ce7b['query'][_0xa3fb('0x2a')]);}_0x528632[_0xa3fb('0x48')]=qs['sort'](_0x10ce7b['query'][_0xa3fb('0x49')]);_0x528632['where']=qs[_0xa3fb('0x4a')](_['pick'](_0x10ce7b[_0xa3fb('0x40')],_0x5ad1d1[_0xa3fb('0x4a')]),_0xc98bc1);if(_0x10ce7b[_0xa3fb('0x40')]['filter']){_0x528632[_0xa3fb('0x4b')]=_[_0xa3fb('0x4c')](_0x528632[_0xa3fb('0x4b')],{'$or':_[_0xa3fb('0x38')](_0xc98bc1,function(_0x547a30){if(_0x547a30['type']!==_0xa3fb('0x4d')){var _0x6ff998={};_0x6ff998[_0x547a30[_0xa3fb('0x3f')]]={'$like':'%'+_0x10ce7b[_0xa3fb('0x40')][_0xa3fb('0x4e')]+'%'};return _0x6ff998;}})});}_0x528632=_[_0xa3fb('0x4c')]({},_0x528632,_0x10ce7b[_0xa3fb('0x4f')]);var _0x2b1bce={'where':_0x528632[_0xa3fb('0x4b')]};return db[_0xa3fb('0x39')][_0xa3fb('0x2d')](_0x2b1bce)[_0xa3fb('0x34')](function(_0x5f4695){_0x470f4b[_0xa3fb('0x2d')]=_0x5f4695;if(_0x10ce7b[_0xa3fb('0x40')][_0xa3fb('0x50')]){_0x528632[_0xa3fb('0x51')]=[{'all':!![]}];}return db[_0xa3fb('0x39')][_0xa3fb('0x52')](_0x528632);})['then'](function(_0x59370a){_0x470f4b[_0xa3fb('0x53')]=_0x59370a;return _0x470f4b;})[_0xa3fb('0x34')](respondWithFilteredResult(_0x416b03,_0x528632))[_0xa3fb('0x26')](handleError(_0x416b03,null));};exports[_0xa3fb('0x54')]=function(_0x4930d7,_0x5f8fbe){var _0x48fb75={'raw':!![],'where':{'id':_0x4930d7[_0xa3fb('0x55')]['id']}},_0x30a606={};_0x30a606[_0xa3fb('0x3e')]=_[_0xa3fb('0x41')](db[_0xa3fb('0x39')][_0xa3fb('0x3a')]);_0x30a606['query']=_[_0xa3fb('0x41')](_0x4930d7[_0xa3fb('0x40')]);_0x30a606['filters']=_[_0xa3fb('0x42')](_0x30a606['model'],_0x30a606[_0xa3fb('0x40')]);_0x48fb75[_0xa3fb('0x43')]=_[_0xa3fb('0x42')](_0x30a606[_0xa3fb('0x3e')],qs['fields'](_0x4930d7['query'][_0xa3fb('0x44')]));_0x48fb75[_0xa3fb('0x43')]=_0x48fb75[_0xa3fb('0x43')][_0xa3fb('0x45')]?_0x48fb75[_0xa3fb('0x43')]:_0x30a606['model'];if(_0x4930d7['query']['includeAll']){_0x48fb75['include']=[{'all':!![]}];}_0x48fb75=_[_0xa3fb('0x4c')]({},_0x48fb75,_0x4930d7['options']);return db[_0xa3fb('0x39')]['find'](_0x48fb75)[_0xa3fb('0x34')](handleEntityNotFound(_0x5f8fbe,null))[_0xa3fb('0x34')](respondWithResult(_0x5f8fbe,null))[_0xa3fb('0x26')](handleError(_0x5f8fbe,null));};exports[_0xa3fb('0x56')]=function(_0x104812,_0x225c66){return db[_0xa3fb('0x39')][_0xa3fb('0x56')](_0x104812['body'],{})['then'](respondWithResult(_0x225c66,0xc9))['catch'](handleError(_0x225c66,null));};exports['update']=function(_0x38ff82,_0x5d1243){if(_0x38ff82[_0xa3fb('0x57')]['id']){delete _0x38ff82[_0xa3fb('0x57')]['id'];}return db[_0xa3fb('0x39')][_0xa3fb('0x58')]({'where':{'id':_0x38ff82[_0xa3fb('0x55')]['id']}})[_0xa3fb('0x34')](handleEntityNotFound(_0x5d1243,null))[_0xa3fb('0x34')](saveUpdates(_0x38ff82[_0xa3fb('0x57')],null))['then'](respondWithResult(_0x5d1243,null))[_0xa3fb('0x26')](handleError(_0x5d1243,null));};exports[_0xa3fb('0x35')]=function(_0x58a635,_0x53c2c9){return db[_0xa3fb('0x39')][_0xa3fb('0x58')]({'where':{'id':_0x58a635['params']['id']}})[_0xa3fb('0x34')](handleEntityNotFound(_0x53c2c9,null))[_0xa3fb('0x34')](removeEntity(_0x53c2c9,null))['catch'](handleError(_0x53c2c9,null));};exports[_0xa3fb('0x59')]=function(_0x4f14e9,_0x35de1e){return db[_0xa3fb('0x39')]['describe']()[_0xa3fb('0x34')](respondWithResult(_0x35de1e,null))[_0xa3fb('0x26')](handleError(_0x35de1e,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xa3fb('0x5a')]=function(_0x126f8a,_0x2712dc,_0x3fe8d2){var _0x2c4b28={'agent':{},'channel':_0xa3fb('0x5b')};if(_0x126f8a[_0xa3fb('0x57')]['id']){delete _0x126f8a[_0xa3fb('0x57')]['id'];}_0x126f8a[_0xa3fb('0x57')][_0xa3fb('0x5c')]=!![];_0x126f8a[_0xa3fb('0x57')]['readAt']=moment()['format'](_0xa3fb('0x5d'));_0x126f8a[_0xa3fb('0x57')][_0xa3fb('0x5e')]=_0x126f8a['body'][_0xa3fb('0x5e')]||_0x126f8a[_0xa3fb('0x5f')]['id'];_0x2c4b28[_0xa3fb('0x60')]['id']=_0x126f8a[_0xa3fb('0x57')][_0xa3fb('0x5e')];return db[_0xa3fb('0x39')]['find']({'where':{'id':_0x126f8a['params']['id'],'UserId':null}})[_0xa3fb('0x34')](handleEntityNotFound(_0x2712dc,null))[_0xa3fb('0x34')](saveUpdates(_0x126f8a[_0xa3fb('0x57')],null))[_0xa3fb('0x34')](function(_0x55a1c0){if(_0x55a1c0){_0x2c4b28[_0xa3fb('0x23')]=_0x55a1c0['get']({'plain':!![]});return db[_0xa3fb('0x61')]['find']({'where':{'id':_0x55a1c0[_0xa3fb('0x62')]}});}return null;})[_0xa3fb('0x34')](handleEntityNotFound(_0x2712dc,null))[_0xa3fb('0x34')](function(_0x4f7e38){if(_0x4f7e38){return _0x4f7e38[_0xa3fb('0x33')]({'UserId':_0x126f8a[_0xa3fb('0x57')][_0xa3fb('0x5e')],'read1stAt':_[_0xa3fb('0x63')](_0x4f7e38['read1stAt'])?moment()[_0xa3fb('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa3fb('0x34')](function(_0x44fd14){if(_0x44fd14){_0x2c4b28['interaction']=_0x44fd14['get']({'plain':!![]});interaction_log[_0xa3fb('0x1e')](_0xa3fb('0x65'),_0x126f8a['user']['id'],_0x126f8a[_0xa3fb('0x5f')][_0xa3fb('0x3f')],_0x126f8a[_0xa3fb('0x5f')][_0xa3fb('0x66')],_0x2c4b28[_0xa3fb('0x67')]['id'],_0x126f8a[_0xa3fb('0x57')]?JSON[_0xa3fb('0x21')](_0x126f8a[_0xa3fb('0x57')]):_0xa3fb('0x68'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2c4b28);}return null;})[_0xa3fb('0x34')](function(_0x1f057d){var _0x314413=_0xa3fb('0x69')+_0x1f057d[_0xa3fb('0x23')][_0xa3fb('0x6a')];return db[_0xa3fb('0x6b')][_0xa3fb('0x40')](_0x314413,{'type':db['Sequelize'][_0xa3fb('0x6c')][_0xa3fb('0x6d')],'raw':!![]})[_0xa3fb('0x34')](function(_0x5509c7){return _0x5509c7;});})[_0xa3fb('0x34')](function(_0xddaa4f){if(_0xddaa4f){_0x2c4b28[_0xa3fb('0x23')]['contact']=_0xddaa4f[0x0];if(!_0x126f8a[_0xa3fb('0x57')][_0xa3fb('0x5e')])return;return db[_0xa3fb('0x6e')]['find']({'where':{'id':_0x126f8a[_0xa3fb('0x57')]['UserId'],'role':_0xa3fb('0x60')},'attributes':['id',_0xa3fb('0x3f'),_0xa3fb('0x6f'),_0xa3fb('0x70'),_0xa3fb('0x71')],'raw':!![]});}return null;})[_0xa3fb('0x34')](function(_0x5a4730){if(!_0x5a4730)return null;_0x2c4b28[_0xa3fb('0x23')][_0xa3fb('0x60')]=_0x5a4730;return _0x2c4b28;})[_0xa3fb('0x34')](function(_0x11ebc2){if(_0x11ebc2){if(_0x126f8a['body'][_0xa3fb('0x72')]){_0x2c4b28[_0xa3fb('0x23')]['interface']=util[_0xa3fb('0x64')](_0xa3fb('0x73'),_0x126f8a['user'][_0xa3fb('0x3f')]);_0x2c4b28['message']['channel']=_0x2c4b28['channel'];_0x2c4b28[_0xa3fb('0x23')]['motionChannel']=_0x2c4b28['channel'];_0x2c4b28['message'][_0xa3fb('0x74')]=_0xa3fb('0x5a');return respondWithRpcPromise(_0xa3fb('0x75'),'EventManager',{'event':_0xa3fb('0x76'),'message':_0x2c4b28['message']},client9002)['then'](function(){return _0x2c4b28;});}return _0x2c4b28;}return null;})['then'](respondWithResult(_0x2712dc,null))[_0xa3fb('0x26')](handleError(_0x2712dc,null));};var interaction_log=require(_0xa3fb('0x13'))(_0xa3fb('0x77'));exports[_0xa3fb('0x31')]=function(_0x4efeb1,_0x3ee1a8,_0x414941){var _0x52e61d={'agent':{},'channel':_0xa3fb('0x5b')};if(_0x4efeb1['body']['id']){delete _0x4efeb1['body']['id'];}_0x4efeb1['body']['UserId']=_0x4efeb1[_0xa3fb('0x57')][_0xa3fb('0x5e')]||_0x4efeb1[_0xa3fb('0x5f')]['id'];_0x52e61d[_0xa3fb('0x60')]['id']=_0x4efeb1['body'][_0xa3fb('0x5e')];return db['WhatsappMessage']['find']({'where':{'id':_0x4efeb1[_0xa3fb('0x55')]['id'],'UserId':null}})[_0xa3fb('0x34')](handleEntityNotFound(_0x3ee1a8,null))['then'](function(_0x49dc36){if(_0x49dc36){_0x52e61d['message']=_0x49dc36[_0xa3fb('0x78')]({'plain':!![]});return db[_0xa3fb('0x61')][_0xa3fb('0x58')]({'where':{'id':_0x49dc36[_0xa3fb('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x3ee1a8,null))[_0xa3fb('0x34')](function(_0x4553e1){if(_0x4553e1){_0x52e61d[_0xa3fb('0x67')]=_0x4553e1['get']({'plain':!![]});interaction_log['info'](_0xa3fb('0x79'),_0x4efeb1[_0xa3fb('0x5f')]['id'],_0x4efeb1['user'][_0xa3fb('0x3f')],_0x4efeb1['user'][_0xa3fb('0x66')],_0x52e61d[_0xa3fb('0x67')]['id'],_0x4efeb1[_0xa3fb('0x57')]?JSON[_0xa3fb('0x21')](_0x4efeb1[_0xa3fb('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0xa3fb('0x7a'),_0x52e61d);}return null;})[_0xa3fb('0x34')](function(_0x13bfb9){var _0x38ee6d=_0xa3fb('0x69')+_0x13bfb9['message'][_0xa3fb('0x6a')];return db[_0xa3fb('0x6b')][_0xa3fb('0x40')](_0x38ee6d,{'type':db['Sequelize'][_0xa3fb('0x6c')]['SELECT'],'raw':!![]})[_0xa3fb('0x34')](function(_0x3ad6dd){return _0x3ad6dd;});})[_0xa3fb('0x34')](function(_0x4ac517){if(_0x4ac517){_0x52e61d[_0xa3fb('0x23')]['contact']=_0x4ac517[0x0];if(!_0x4efeb1[_0xa3fb('0x57')][_0xa3fb('0x5e')])return;return db[_0xa3fb('0x6e')]['find']({'where':{'id':_0x4efeb1[_0xa3fb('0x57')][_0xa3fb('0x5e')],'role':_0xa3fb('0x60')},'attributes':['id','name',_0xa3fb('0x6f'),_0xa3fb('0x70'),_0xa3fb('0x71')],'raw':!![]});}return null;})[_0xa3fb('0x34')](function(_0xb958e0){if(!_0xb958e0)return null;_0x52e61d[_0xa3fb('0x23')]['agent']=_0xb958e0;return _0x52e61d;})['then'](function(_0x52e47a){if(_0x52e47a){_0x52e47a[_0xa3fb('0x23')][_0xa3fb('0x7b')]=util[_0xa3fb('0x64')](_0xa3fb('0x73'),_0x4efeb1[_0xa3fb('0x5f')][_0xa3fb('0x3f')]);_0x52e47a[_0xa3fb('0x23')][_0xa3fb('0x7c')]=_0x52e61d[_0xa3fb('0x7c')];_0x52e47a[_0xa3fb('0x23')][_0xa3fb('0x7d')]=_0x52e61d[_0xa3fb('0x7c')];_0x52e47a[_0xa3fb('0x23')]['event']=_0xa3fb('0x31');respondWithRpcPromise(_0xa3fb('0x75'),'EventManager',{'event':_0xa3fb('0x7e'),'message':_0x52e47a['message']},client9002);return _0x52e61d;}return null;})[_0xa3fb('0x34')](respondWithResult(_0x3ee1a8,null))[_0xa3fb('0x26')](handleError(_0x3ee1a8,null));};exports[_0xa3fb('0x28')]=function(_0x5a22e1,_0x5e7293,_0x545663){if(_0x5a22e1[_0xa3fb('0x57')]['id']){delete _0x5a22e1[_0xa3fb('0x57')]['id'];}var _0x370116;return db[_0xa3fb('0x39')]['find']({'where':{'id':_0x5a22e1[_0xa3fb('0x55')]['id']}})[_0xa3fb('0x34')](handleEntityNotFound(_0x5e7293,null))['then'](function(_0x219614){if(_0x219614){_0x370116=_0x219614;return db['WhatsappAccount'][_0xa3fb('0x58')]({'where':{'id':_0x219614['WhatsappAccountId']}});}})[_0xa3fb('0x34')](handleEntityNotFound(_0x5e7293,null))[_0xa3fb('0x34')](function(_0x518d07){if(_0x518d07){logger[_0xa3fb('0x7f')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa3fb('0x28'),_0xa3fb('0x80'),_0x518d07[_0xa3fb('0x3c')],util[_0xa3fb('0x81')](_0x5a22e1[_0xa3fb('0x57')],{'showHidden':![],'depth':null}));switch(_0x518d07[_0xa3fb('0x3c')]){case _0xa3fb('0x82'):if(_0x5a22e1[_0xa3fb('0x57')][_0xa3fb('0x83')]&&_0x5a22e1[_0xa3fb('0x57')][_0xa3fb('0x83')]===_0x370116[_0xa3fb('0x84')]&&_0x5a22e1[_0xa3fb('0x57')][_0xa3fb('0x85')]&&_0x5a22e1[_0xa3fb('0x57')][_0xa3fb('0x85')]==='read'){return _0x370116[_0xa3fb('0x33')]({'read':!![]});}else{logger[_0xa3fb('0x22')](_0xa3fb('0x86'),_0xa3fb('0x28'),'twilio',util[_0xa3fb('0x81')](_0x5a22e1[_0xa3fb('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x370116;}})[_0xa3fb('0x34')](respondWithResult(_0x5e7293,null))[_0xa3fb('0x26')](handleError(_0x5e7293,null));}; \ No newline at end of file +var _0xf523=['sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','create','body','find','params','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','QueryTypes','SELECT','User','fullname','internal','manual','interface','SIP/%s','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','channel','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x153800,_0x545190){var _0xc7d350=function(_0x5e5744){while(--_0x5e5744){_0x153800['push'](_0x153800['shift']());}};_0xc7d350(++_0x545190);}(_0xf523,0xd4));var _0x3f52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf523[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3f52('0x0'));var rimraf=require(_0x3f52('0x1'));var zipdir=require(_0x3f52('0x2'));var jsonpatch=require(_0x3f52('0x3'));var rp=require(_0x3f52('0x4'));var moment=require('moment');var BPromise=require(_0x3f52('0x5'));var Mustache=require('mustache');var util=require(_0x3f52('0x6'));var path=require(_0x3f52('0x7'));var sox=require(_0x3f52('0x8'));var csv=require(_0x3f52('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f52('0xa'));var _=require(_0x3f52('0xb'));var squel=require(_0x3f52('0xc'));var crypto=require(_0x3f52('0xd'));var jsforce=require(_0x3f52('0xe'));var deskjs=require(_0x3f52('0xf'));var toCsv=require(_0x3f52('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f52('0x10'));var authService=require(_0x3f52('0x11'));var qs=require(_0x3f52('0x12'));var as=require(_0x3f52('0x13'));var hardwareService=require(_0x3f52('0x14'));var logger=require(_0x3f52('0x15'))(_0x3f52('0x16'));var utils=require('../../config/utils');var config=require(_0x3f52('0x17'));var licenseUtil=require(_0x3f52('0x18'));var db=require(_0x3f52('0x19'))['db'];config[_0x3f52('0x1a')]=_[_0x3f52('0x1b')](config[_0x3f52('0x1a')],{'host':_0x3f52('0x1c'),'port':0x18eb});var socket=require(_0x3f52('0x1d'))(new Redis(config[_0x3f52('0x1a')]));require(_0x3f52('0x1e'))[_0x3f52('0x1f')](socket);var jayson=require(_0x3f52('0x20'));var client=jayson[_0x3f52('0x21')][_0x3f52('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x3f52('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x11b277,_0x3c0978,_0x3e5c59,_0x4f6d4e){return new BPromise(function(_0x5cdb3c,_0x36ad13){var _0xb84222=_0x4f6d4e||client;return _0xb84222[_0x3f52('0x23')](_0x11b277,_0x3e5c59)[_0x3f52('0x24')](function(_0x1e3af4){logger[_0x3f52('0x25')](_0x3f52('0x26'),_0x3c0978,_0x3f52('0x27'));logger[_0x3f52('0x28')](_0x3f52('0x29'),_0x3c0978,_0x3f52('0x27'),JSON[_0x3f52('0x2a')](_0x1e3af4));if(_0x1e3af4['error']){if(_0x1e3af4[_0x3f52('0x2b')][_0x3f52('0x2c')]===0x1f4){logger['error'](_0x3f52('0x26'),_0x3c0978,_0x1e3af4['error'][_0x3f52('0x2d')]);return _0x36ad13(_0x1e3af4['error']['message']);}logger[_0x3f52('0x2b')](_0x3f52('0x26'),_0x3c0978,_0x1e3af4[_0x3f52('0x2b')][_0x3f52('0x2d')]);return _0x5cdb3c(_0x1e3af4['error']['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3c0978,_0x3f52('0x27'));_0x5cdb3c(_0x1e3af4[_0x3f52('0x2e')][_0x3f52('0x2d')]);}})[_0x3f52('0x2f')](function(_0x141858){logger[_0x3f52('0x2b')](_0x3f52('0x26'),_0x3c0978,_0x141858);_0x36ad13(_0x141858);});});}function respondWithStatusCode(_0x21f814,_0x522b99){_0x522b99=_0x522b99||0xcc;return function(_0x41d597){if(_0x41d597){return _0x21f814[_0x3f52('0x30')](_0x522b99);}return _0x21f814[_0x3f52('0x31')](_0x522b99)[_0x3f52('0x32')]();};}function respondWithResult(_0x134c28,_0x1dfb23){_0x1dfb23=_0x1dfb23||0xc8;return function(_0x18099c){if(_0x18099c){return _0x134c28[_0x3f52('0x31')](_0x1dfb23)['json'](_0x18099c);}};}function respondWithFilteredResult(_0x31c9f2,_0x5e38c8){return function(_0x42a937){if(_0x42a937){var _0x36bb5d=typeof _0x5e38c8[_0x3f52('0x33')]===_0x3f52('0x34')&&typeof _0x5e38c8['limit']==='undefined';var _0x4b4ad6=_0x42a937[_0x3f52('0x35')];var _0x18a21e=_0x36bb5d?0x0:_0x5e38c8['offset'];var _0xf67c7e=_0x36bb5d?_0x42a937[_0x3f52('0x35')]:_0x5e38c8[_0x3f52('0x33')]+_0x5e38c8['limit'];var _0x4dee14;if(_0xf67c7e>=_0x4b4ad6){_0xf67c7e=_0x4b4ad6;_0x4dee14=0xc8;}else{_0x4dee14=0xce;}_0x31c9f2[_0x3f52('0x31')](_0x4dee14);return _0x31c9f2[_0x3f52('0x36')](_0x3f52('0x37'),_0x18a21e+'-'+_0xf67c7e+'/'+_0x4b4ad6)[_0x3f52('0x38')](_0x42a937);}return null;};}function patchUpdates(_0xefd560){return function(_0x2f4ae6){try{jsonpatch[_0x3f52('0x39')](_0x2f4ae6,_0xefd560,!![]);}catch(_0x438e9f){return BPromise[_0x3f52('0x3a')](_0x438e9f);}return _0x2f4ae6[_0x3f52('0x3b')]();};}function saveUpdates(_0x4fef5d,_0x35ec7f){return function(_0x3afaac){if(_0x3afaac){return _0x3afaac[_0x3f52('0x3c')](_0x4fef5d)['then'](function(_0x4e57e0){return _0x4e57e0;});}return null;};}function removeEntity(_0x578337,_0x5e8463){return function(_0x3e8309){if(_0x3e8309){return _0x3e8309[_0x3f52('0x3d')]()[_0x3f52('0x24')](function(){_0x578337['status'](0xcc)[_0x3f52('0x32')]();});}};}function handleEntityNotFound(_0x462709,_0x609fc6){return function(_0x4c601a){if(!_0x4c601a){_0x462709[_0x3f52('0x30')](0x194);}return _0x4c601a;};}function handleError(_0x306839,_0x59a50){_0x59a50=_0x59a50||0x1f4;return function(_0x228244){logger[_0x3f52('0x2b')](_0x228244[_0x3f52('0x3e')]);if(_0x228244[_0x3f52('0x3f')]){delete _0x228244[_0x3f52('0x3f')];}_0x306839[_0x3f52('0x31')](_0x59a50)['send'](_0x228244);};}exports[_0x3f52('0x40')]=function(_0x490428,_0x11325a){var _0x4fee96={},_0x137aee={},_0x25c44a={'count':0x0,'rows':[]};var _0x25dc08=_['map'](db[_0x3f52('0x41')][_0x3f52('0x42')],function(_0x401b47){return{'name':_0x401b47[_0x3f52('0x43')],'type':_0x401b47[_0x3f52('0x44')][_0x3f52('0x45')]};});_0x137aee[_0x3f52('0x46')]=_[_0x3f52('0x47')](_0x25dc08,_0x3f52('0x3f'));_0x137aee[_0x3f52('0x48')]=_[_0x3f52('0x49')](_0x490428[_0x3f52('0x48')]);_0x137aee['filters']=_[_0x3f52('0x4a')](_0x137aee['model'],_0x137aee[_0x3f52('0x48')]);_0x4fee96[_0x3f52('0x4b')]=_[_0x3f52('0x4a')](_0x137aee[_0x3f52('0x46')],qs[_0x3f52('0x4c')](_0x490428[_0x3f52('0x48')][_0x3f52('0x4c')]));_0x4fee96[_0x3f52('0x4b')]=_0x4fee96['attributes'][_0x3f52('0x4d')]?_0x4fee96['attributes']:_0x137aee[_0x3f52('0x46')];if(!_0x490428['query'][_0x3f52('0x4e')](_0x3f52('0x4f'))){_0x4fee96[_0x3f52('0x50')]=qs[_0x3f52('0x50')](_0x490428['query'][_0x3f52('0x50')]);_0x4fee96['offset']=qs['offset'](_0x490428[_0x3f52('0x48')][_0x3f52('0x33')]);}_0x4fee96[_0x3f52('0x51')]=qs[_0x3f52('0x52')](_0x490428[_0x3f52('0x48')][_0x3f52('0x52')]);_0x4fee96[_0x3f52('0x53')]=qs[_0x3f52('0x54')](_[_0x3f52('0x55')](_0x490428[_0x3f52('0x48')],_0x137aee[_0x3f52('0x54')]),_0x25dc08);if(_0x490428[_0x3f52('0x48')][_0x3f52('0x56')]){_0x4fee96['where']=_[_0x3f52('0x57')](_0x4fee96['where'],{'$or':_[_0x3f52('0x47')](_0x25dc08,function(_0x35fc2c){if(_0x35fc2c['type']!==_0x3f52('0x58')){var _0x568939={};_0x568939[_0x35fc2c['name']]={'$like':'%'+_0x490428[_0x3f52('0x48')][_0x3f52('0x56')]+'%'};return _0x568939;}})});}_0x4fee96=_[_0x3f52('0x57')]({},_0x4fee96,_0x490428[_0x3f52('0x59')]);var _0x2a0bfd={'where':_0x4fee96['where']};return db['WhatsappMessage'][_0x3f52('0x35')](_0x2a0bfd)['then'](function(_0x71fb3a){_0x25c44a[_0x3f52('0x35')]=_0x71fb3a;if(_0x490428[_0x3f52('0x48')][_0x3f52('0x5a')]){_0x4fee96['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x3f52('0x5b')](_0x4fee96);})[_0x3f52('0x24')](function(_0x37a4e9){_0x25c44a[_0x3f52('0x5c')]=_0x37a4e9;return _0x25c44a;})[_0x3f52('0x24')](respondWithFilteredResult(_0x11325a,_0x4fee96))[_0x3f52('0x2f')](handleError(_0x11325a,null));};exports[_0x3f52('0x5d')]=function(_0x3ebe24,_0x49fc85){var _0x13e3f4={'raw':!![],'where':{'id':_0x3ebe24['params']['id']}},_0x36bae2={};_0x36bae2[_0x3f52('0x46')]=_[_0x3f52('0x49')](db[_0x3f52('0x41')][_0x3f52('0x42')]);_0x36bae2[_0x3f52('0x48')]=_[_0x3f52('0x49')](_0x3ebe24[_0x3f52('0x48')]);_0x36bae2['filters']=_['intersection'](_0x36bae2[_0x3f52('0x46')],_0x36bae2[_0x3f52('0x48')]);_0x13e3f4['attributes']=_[_0x3f52('0x4a')](_0x36bae2[_0x3f52('0x46')],qs['fields'](_0x3ebe24[_0x3f52('0x48')][_0x3f52('0x4c')]));_0x13e3f4[_0x3f52('0x4b')]=_0x13e3f4[_0x3f52('0x4b')][_0x3f52('0x4d')]?_0x13e3f4[_0x3f52('0x4b')]:_0x36bae2[_0x3f52('0x46')];if(_0x3ebe24[_0x3f52('0x48')][_0x3f52('0x5a')]){_0x13e3f4[_0x3f52('0x5e')]=[{'all':!![]}];}_0x13e3f4=_[_0x3f52('0x57')]({},_0x13e3f4,_0x3ebe24[_0x3f52('0x59')]);return db[_0x3f52('0x41')]['find'](_0x13e3f4)['then'](handleEntityNotFound(_0x49fc85,null))[_0x3f52('0x24')](respondWithResult(_0x49fc85,null))['catch'](handleError(_0x49fc85,null));};exports[_0x3f52('0x5f')]=function(_0x32eff2,_0x486664){return db[_0x3f52('0x41')][_0x3f52('0x5f')](_0x32eff2[_0x3f52('0x60')],{})[_0x3f52('0x24')](respondWithResult(_0x486664,0xc9))['catch'](handleError(_0x486664,null));};exports['update']=function(_0x426003,_0x101ee0){if(_0x426003[_0x3f52('0x60')]['id']){delete _0x426003[_0x3f52('0x60')]['id'];}return db[_0x3f52('0x41')][_0x3f52('0x61')]({'where':{'id':_0x426003[_0x3f52('0x62')]['id']}})['then'](handleEntityNotFound(_0x101ee0,null))[_0x3f52('0x24')](saveUpdates(_0x426003[_0x3f52('0x60')],null))[_0x3f52('0x24')](respondWithResult(_0x101ee0,null))[_0x3f52('0x2f')](handleError(_0x101ee0,null));};exports[_0x3f52('0x3d')]=function(_0x307e2b,_0x4c5e86){return db[_0x3f52('0x41')][_0x3f52('0x61')]({'where':{'id':_0x307e2b['params']['id']}})[_0x3f52('0x24')](handleEntityNotFound(_0x4c5e86,null))[_0x3f52('0x24')](removeEntity(_0x4c5e86,null))[_0x3f52('0x2f')](handleError(_0x4c5e86,null));};exports[_0x3f52('0x63')]=function(_0x86a7f5,_0x46d429){return db['WhatsappMessage'][_0x3f52('0x63')]()['then'](respondWithResult(_0x46d429,null))['catch'](handleError(_0x46d429,null));};var interaction_log=require('../../config/logger')(_0x3f52('0x64'));exports[_0x3f52('0x65')]=function(_0x4f29f6,_0x4ce432,_0x513682){var _0x447ddc={'agent':{},'channel':_0x3f52('0x66')};if(_0x4f29f6['body']['id']){delete _0x4f29f6[_0x3f52('0x60')]['id'];}_0x4f29f6[_0x3f52('0x60')][_0x3f52('0x67')]=!![];_0x4f29f6[_0x3f52('0x60')]['readAt']=moment()[_0x3f52('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x4f29f6['body'][_0x3f52('0x69')]=_0x4f29f6[_0x3f52('0x60')][_0x3f52('0x69')]||_0x4f29f6[_0x3f52('0x6a')]['id'];_0x447ddc[_0x3f52('0x6b')]['id']=_0x4f29f6[_0x3f52('0x60')][_0x3f52('0x69')];return db['WhatsappMessage'][_0x3f52('0x61')]({'where':{'id':_0x4f29f6[_0x3f52('0x62')]['id'],'UserId':null}})[_0x3f52('0x24')](handleEntityNotFound(_0x4ce432,null))[_0x3f52('0x24')](saveUpdates(_0x4f29f6[_0x3f52('0x60')],null))['then'](function(_0xa33cbf){if(_0xa33cbf){_0x447ddc[_0x3f52('0x2d')]=_0xa33cbf[_0x3f52('0x6c')]({'plain':!![]});return db[_0x3f52('0x6d')][_0x3f52('0x61')]({'where':{'id':_0xa33cbf[_0x3f52('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x4ce432,null))[_0x3f52('0x24')](function(_0x3e9d80){if(_0x3e9d80){return _0x3e9d80[_0x3f52('0x3c')]({'UserId':_0x4f29f6[_0x3f52('0x60')][_0x3f52('0x69')],'read1stAt':_[_0x3f52('0x6f')](_0x3e9d80[_0x3f52('0x70')])?moment()[_0x3f52('0x68')](_0x3f52('0x71')):undefined});}return null;})[_0x3f52('0x24')](function(_0x17014b){if(_0x17014b){_0x447ddc[_0x3f52('0x72')]=_0x17014b['get']({'plain':!![]});interaction_log[_0x3f52('0x25')](_0x3f52('0x73'),_0x4f29f6['user']['id'],_0x4f29f6[_0x3f52('0x6a')][_0x3f52('0x3f')],_0x4f29f6[_0x3f52('0x6a')][_0x3f52('0x74')],_0x447ddc[_0x3f52('0x72')]['id'],_0x4f29f6[_0x3f52('0x60')]?JSON[_0x3f52('0x2a')](_0x4f29f6[_0x3f52('0x60')]):_0x3f52('0x75'));return respondWithRpcPromise('AcceptMessage',_0x3f52('0x76'),_0x447ddc);}return null;})[_0x3f52('0x24')](function(_0x4d5573){var _0x1ffde7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4d5573['message'][_0x3f52('0x77')];return db['sequelize'][_0x3f52('0x48')](_0x1ffde7,{'type':db['Sequelize'][_0x3f52('0x78')][_0x3f52('0x79')],'raw':!![]})[_0x3f52('0x24')](function(_0x315c5a){return _0x315c5a;});})['then'](function(_0x3788df){if(_0x3788df){_0x447ddc[_0x3f52('0x2d')]['contact']=_0x3788df[0x0];if(!_0x4f29f6[_0x3f52('0x60')][_0x3f52('0x69')])return;return db[_0x3f52('0x7a')]['find']({'where':{'id':_0x4f29f6[_0x3f52('0x60')]['UserId'],'role':'agent'},'attributes':['id',_0x3f52('0x3f'),_0x3f52('0x7b'),'email',_0x3f52('0x7c')],'raw':!![]});}return null;})[_0x3f52('0x24')](function(_0x313f69){if(!_0x313f69)return null;_0x447ddc['message']['agent']=_0x313f69;return _0x447ddc;})[_0x3f52('0x24')](function(_0x5db8ec){if(_0x5db8ec){if(_0x4f29f6['body'][_0x3f52('0x7d')]){_0x447ddc['message'][_0x3f52('0x7e')]=util[_0x3f52('0x68')](_0x3f52('0x7f'),_0x4f29f6[_0x3f52('0x6a')][_0x3f52('0x3f')]);_0x447ddc[_0x3f52('0x2d')]['channel']=_0x447ddc['channel'];_0x447ddc[_0x3f52('0x2d')]['motionChannel']=_0x447ddc['channel'];_0x447ddc[_0x3f52('0x2d')]['event']=_0x3f52('0x65');return respondWithRpcPromise(_0x3f52('0x80'),_0x3f52('0x80'),{'event':'acceptmessage','message':_0x447ddc[_0x3f52('0x2d')]},client9002)[_0x3f52('0x24')](function(){return _0x447ddc;});}return _0x447ddc;}return null;})[_0x3f52('0x24')](respondWithResult(_0x4ce432,null))['catch'](handleError(_0x4ce432,null));};var interaction_log=require(_0x3f52('0x15'))(_0x3f52('0x64'));exports[_0x3f52('0x3a')]=function(_0x1f45df,_0x301ad9,_0x281a17){var _0x2f7c15={'agent':{},'channel':_0x3f52('0x66')};if(_0x1f45df['body']['id']){delete _0x1f45df['body']['id'];}_0x1f45df[_0x3f52('0x60')][_0x3f52('0x69')]=_0x1f45df[_0x3f52('0x60')][_0x3f52('0x69')]||_0x1f45df[_0x3f52('0x6a')]['id'];_0x2f7c15['agent']['id']=_0x1f45df[_0x3f52('0x60')][_0x3f52('0x69')];return db['WhatsappMessage'][_0x3f52('0x61')]({'where':{'id':_0x1f45df['params']['id'],'UserId':null}})[_0x3f52('0x24')](handleEntityNotFound(_0x301ad9,null))['then'](function(_0x2ffe9e){if(_0x2ffe9e){_0x2f7c15['message']=_0x2ffe9e[_0x3f52('0x6c')]({'plain':!![]});return db[_0x3f52('0x6d')][_0x3f52('0x61')]({'where':{'id':_0x2ffe9e[_0x3f52('0x6e')]}});}return null;})[_0x3f52('0x24')](handleEntityNotFound(_0x301ad9,null))[_0x3f52('0x24')](function(_0x8cebd6){if(_0x8cebd6){_0x2f7c15['interaction']=_0x8cebd6[_0x3f52('0x6c')]({'plain':!![]});interaction_log[_0x3f52('0x25')](_0x3f52('0x81'),_0x1f45df[_0x3f52('0x6a')]['id'],_0x1f45df[_0x3f52('0x6a')][_0x3f52('0x3f')],_0x1f45df[_0x3f52('0x6a')][_0x3f52('0x74')],_0x2f7c15[_0x3f52('0x72')]['id'],_0x1f45df[_0x3f52('0x60')]?JSON[_0x3f52('0x2a')](_0x1f45df[_0x3f52('0x60')]):_0x3f52('0x75'));return respondWithRpcPromise(_0x3f52('0x82'),_0x3f52('0x83'),_0x2f7c15);}return null;})[_0x3f52('0x24')](function(_0x1dd71f){var _0x103115=_0x3f52('0x84')+_0x1dd71f[_0x3f52('0x2d')][_0x3f52('0x77')];return db[_0x3f52('0x85')][_0x3f52('0x48')](_0x103115,{'type':db[_0x3f52('0x86')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3f52('0x24')](function(_0x2fd785){return _0x2fd785;});})[_0x3f52('0x24')](function(_0x2c1c48){if(_0x2c1c48){_0x2f7c15[_0x3f52('0x2d')][_0x3f52('0x87')]=_0x2c1c48[0x0];if(!_0x1f45df['body']['UserId'])return;return db[_0x3f52('0x7a')][_0x3f52('0x61')]({'where':{'id':_0x1f45df[_0x3f52('0x60')]['UserId'],'role':_0x3f52('0x6b')},'attributes':['id',_0x3f52('0x3f'),'fullname','email',_0x3f52('0x7c')],'raw':!![]});}return null;})[_0x3f52('0x24')](function(_0x512352){if(!_0x512352)return null;_0x2f7c15[_0x3f52('0x2d')]['agent']=_0x512352;return _0x2f7c15;})['then'](function(_0x48cb93){if(_0x48cb93){_0x48cb93['message'][_0x3f52('0x7e')]=util[_0x3f52('0x68')](_0x3f52('0x7f'),_0x1f45df[_0x3f52('0x6a')][_0x3f52('0x3f')]);_0x48cb93[_0x3f52('0x2d')][_0x3f52('0x88')]=_0x2f7c15[_0x3f52('0x88')];_0x48cb93[_0x3f52('0x2d')]['motionChannel']=_0x2f7c15[_0x3f52('0x88')];_0x48cb93['message'][_0x3f52('0x89')]='reject';respondWithRpcPromise('EventManager',_0x3f52('0x80'),{'event':_0x3f52('0x8a'),'message':_0x48cb93[_0x3f52('0x2d')]},client9002);return _0x2f7c15;}return null;})['then'](respondWithResult(_0x301ad9,null))['catch'](handleError(_0x301ad9,null));};exports[_0x3f52('0x31')]=function(_0x23f1cf,_0x11b177,_0x4104df){if(_0x23f1cf[_0x3f52('0x60')]['id']){delete _0x23f1cf['body']['id'];}var _0xf1eef4;return db[_0x3f52('0x41')][_0x3f52('0x61')]({'where':{'id':_0x23f1cf[_0x3f52('0x62')]['id']}})[_0x3f52('0x24')](handleEntityNotFound(_0x11b177,null))[_0x3f52('0x24')](function(_0x137f9d){if(_0x137f9d){_0xf1eef4=_0x137f9d;return db[_0x3f52('0x8b')][_0x3f52('0x61')]({'where':{'id':_0x137f9d[_0x3f52('0x8c')]}});}})[_0x3f52('0x24')](handleEntityNotFound(_0x11b177,null))[_0x3f52('0x24')](function(_0x3ae85d){if(_0x3ae85d){logger[_0x3f52('0x28')](_0x3f52('0x8d'),'status',_0x3f52('0x8e'),_0x3ae85d[_0x3f52('0x44')],util[_0x3f52('0x8f')](_0x23f1cf[_0x3f52('0x60')],{'showHidden':![],'depth':null}));switch(_0x3ae85d[_0x3f52('0x44')]){case'twilio':if(_0x23f1cf[_0x3f52('0x60')]['MessageSid']&&_0x23f1cf[_0x3f52('0x60')]['MessageSid']===_0xf1eef4['messageId']&&_0x23f1cf[_0x3f52('0x60')][_0x3f52('0x90')]&&_0x23f1cf[_0x3f52('0x60')][_0x3f52('0x90')]==='read'){return _0xf1eef4['update']({'read':!![]});}else{logger['error'](_0x3f52('0x91'),'status',_0x3f52('0x92'),util[_0x3f52('0x8f')](_0x23f1cf[_0x3f52('0x60')],{'showHidden':![],'depth':null}));}break;}return _0xf1eef4;}})[_0x3f52('0x24')](respondWithResult(_0x11b177,null))['catch'](handleError(_0x11b177,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 637577f..7156e9d 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 _0x4bde=['hook','events','../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x2c1a19,_0x2cab87){var _0x3ce9c5=function(_0x26c281){while(--_0x26c281){_0x2c1a19['push'](_0x2c1a19['shift']());}};_0x3ce9c5(++_0x2cab87);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x427bae,_0x3a3fb0){_0x427bae=_0x427bae-0x0;var _0x4a38d4=_0x4bde[_0x427bae];return _0x4a38d4;};'use strict';var EventEmitter=require(_0xe4bd('0x0'));var WhatsappMessage=require(_0xe4bd('0x1'))['db'][_0xe4bd('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe4bd('0x3'),'afterUpdate':_0xe4bd('0x4'),'afterDestroy':_0xe4bd('0x5')};function emitEvent(_0x3108bd){return function(_0x5741e5,_0x210d47,_0x1b8621){WhatsappMessageEvents[_0xe4bd('0x6')](_0x3108bd+':'+_0x5741e5['id'],_0x5741e5);WhatsappMessageEvents[_0xe4bd('0x6')](_0x3108bd,_0x5741e5);_0x1b8621(null);};}for(var e in events){if(events[_0xe4bd('0x7')](e)){var event=events[e];WhatsappMessage[_0xe4bd('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x16d2=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x37ea15,_0x5a0470){var _0x453798=function(_0x47b5f9){while(--_0x47b5f9){_0x37ea15['push'](_0x37ea15['shift']());}};_0x453798(++_0x5a0470);}(_0x16d2,0x123));var _0x216d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x16d2[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x216d('0x0'));var WhatsappMessage=require(_0x216d('0x1'))['db'][_0x216d('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x216d('0x3')](0x0);var events={'afterCreate':_0x216d('0x4'),'afterUpdate':_0x216d('0x5'),'afterDestroy':_0x216d('0x6')};function emitEvent(_0x239b49){return function(_0xfd7306,_0x593bb0,_0x2c662d){WhatsappMessageEvents[_0x216d('0x7')](_0x239b49+':'+_0xfd7306['id'],_0xfd7306);WhatsappMessageEvents[_0x216d('0x7')](_0x239b49,_0xfd7306);_0x2c662d(null);};}for(var e in events){if(events[_0x216d('0x8')](e)){var event=events[e];WhatsappMessage[_0x216d('0x9')](e,emitEvent(event));}}module[_0x216d('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 80eff5a..b4996e3 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 _0xb950=['message_id','statuses','err','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','messages','create','phone','/api/whatsapp/messages/','/status?token=','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','text','POST','Bearer\x20','application/json'];(function(_0x4629ee,_0x5802d8){var _0x47fb5b=function(_0xf899cd){while(--_0xf899cd){_0x4629ee['push'](_0x4629ee['shift']());}};_0x47fb5b(++_0x5802d8);}(_0xb950,0x18d));var _0x0b95=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb950[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x0b95('0x0'));var util=require('util');var logger=require(_0x0b95('0x1'))('api');var moment=require(_0x0b95('0x2'));var BPromise=require(_0x0b95('0x3'));var rp=require(_0x0b95('0x4'));var fetch=require(_0x0b95('0x5'));var fs=require('fs');var path=require(_0x0b95('0x6'));var rimraf=require(_0x0b95('0x7'));var config=require(_0x0b95('0x8'));var attributes=require(_0x0b95('0x9'));module['exports']=function(_0x50fd5e,_0x272f1d){return _0x50fd5e[_0x0b95('0xa')](_0x0b95('0xb'),attributes,{'tableName':_0x0b95('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0b95('0xd')]},{'name':_0x0b95('0xe'),'fields':[_0x0b95('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52a716,_0x5161ec,_0xb4a0ed){var _0xfe8d2f=_0x50fd5e[_0x0b95('0x10')];var _0x2fa3bd=_0x52a716[_0x0b95('0x11')]({'plain':!![]});if(_0x2fa3bd[_0x0b95('0x12')][_0x0b95('0x13')]()==='in'||_0x2fa3bd[_0x0b95('0x12')][_0x0b95('0x13')]()===_0x0b95('0x14')&&!_0x2fa3bd[_0x0b95('0x15')]&&!_[_0x0b95('0x16')](_0x2fa3bd['UserId'])){_0xfe8d2f[_0x0b95('0x17')]['findOne']({'where':{'id':_0x2fa3bd['WhatsappInteractionId']}})['then'](function(_0x736b92){if(_0x736b92){_0x736b92['update']({'lastMsgAt':_0x2fa3bd[_0x0b95('0x18')],'lastMsgDirection':_0x2fa3bd[_0x0b95('0x12')][_0x0b95('0x13')]()});}})[_0x0b95('0x19')](function(_0xc5faf4){console[_0x0b95('0x1a')](_0xc5faf4);});}if(_0x2fa3bd[_0x0b95('0x12')]==='out'&&!_0x2fa3bd['secret']){var _0x124411;_0xfe8d2f[_0x0b95('0x1b')][_0x0b95('0x1c')]({'where':{'id':_0x2fa3bd[_0x0b95('0x1d')]},'raw':!![]})[_0x0b95('0x1e')](function(_0x1d94ad){_0x124411=_0x1d94ad;if(_0x124411&&_0x124411[_0x0b95('0x1f')]){switch(_0x124411[_0x0b95('0x1f')]){case _0x0b95('0x20'):var _0x466141=require(_0x0b95('0x20'));if(_0x124411['accountSid']&&_0x124411['authToken']&&_0x124411['phone']){var _0x1dcba7=new _0x466141(_0x124411[_0x0b95('0x21')],_0x124411[_0x0b95('0x22')]);_0x1dcba7[_0x0b95('0x23')][_0x0b95('0x24')]({'body':_0x2fa3bd[_0x0b95('0xf')],'to':'whatsapp:'+_0x2fa3bd[_0x0b95('0x25')],'from':'whatsapp:'+_0x124411[_0x0b95('0x25')],'statusCallback':_0x124411['remote']+_0x0b95('0x26')+_0x2fa3bd['id']+_0x0b95('0x27')+_0x124411['token']})[_0x0b95('0x1e')](function(_0x26d123){if(_0x26d123['sid']){return _0x52a716[_0x0b95('0x28')]({'messageId':_0x26d123[_0x0b95('0x29')]});}})['catch'](function(_0x504c87){logger[_0x0b95('0x1a')](_0x0b95('0x2a'),'afterCreate',_0x0b95('0x20'),util[_0x0b95('0x2b')](_0x504c87,{'showHidden':![],'depth':null}));});}else{logger[_0x0b95('0x1a')](_0x0b95('0x2a'),_0x0b95('0x2c'),_0x0b95('0x20'),_0x0b95('0x2d'));}break;case'sinch':var _0x10b585=_0x124411[_0x0b95('0x21')];var _0x4ec9d2=_0x124411['authToken'];var _0x75e735=_0x124411[_0x0b95('0x2e')]+'/whatsapp/v1/'+_0x10b585+'/messages/';var _0x4db4ed={'to':[_0x2fa3bd[_0x0b95('0x25')]],'message':{'type':_0x0b95('0x2f'),'text':_0x2fa3bd['body']}};var _0x45d47e={'method':_0x0b95('0x30'),'uri':_0x75e735,'headers':{'Authorization':_0x0b95('0x31')+_0x4ec9d2,'Content-Type':_0x0b95('0x32')},'body':_0x4db4ed,'json':!![]};rp(_0x45d47e)[_0x0b95('0x1e')](function(_0x2d7770){if(_0x2d7770['statuses'][0x0][_0x0b95('0x33')]){return _0x52a716['update']({'messageId':_0x2d7770[_0x0b95('0x34')][0x0][_0x0b95('0x33')]});}})[_0x0b95('0x19')](function(_0x945be){logger[_0x0b95('0x35')]('WhatsappMessage,\x20%s',_0x945be);});break;}}})[_0x0b95('0x36')](function(){_0xb4a0ed();});}else{_0xb4a0ed();}}},'charset':'utf8mb4','collate':_0x0b95('0x37')});}; \ No newline at end of file +var _0x182e=['lodash','util','../../config/logger','api','moment','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','catch','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x182e,0x1d0));var _0xe182=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x182e[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xe182('0x0'));var util=require(_0xe182('0x1'));var logger=require(_0xe182('0x2'))(_0xe182('0x3'));var moment=require(_0xe182('0x4'));var BPromise=require('bluebird');var rp=require(_0xe182('0x5'));var fetch=require(_0xe182('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe182('0x7'));var config=require(_0xe182('0x8'));var attributes=require(_0xe182('0x9'));module[_0xe182('0xa')]=function(_0x1cebfb,_0x536fc5){return _0x1cebfb[_0xe182('0xb')]('WhatsappMessage',attributes,{'tableName':_0xe182('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0xe182('0xd')],'type':_0xe182('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xbac502,_0x1d5672,_0x3014d2){var _0x463319=_0x1cebfb[_0xe182('0xf')];var _0x383419=_0xbac502[_0xe182('0x10')]({'plain':!![]});if(_0x383419[_0xe182('0x11')][_0xe182('0x12')]()==='in'||_0x383419['direction'][_0xe182('0x12')]()===_0xe182('0x13')&&!_0x383419['secret']&&!_[_0xe182('0x14')](_0x383419['UserId'])){_0x463319[_0xe182('0x15')][_0xe182('0x16')]({'where':{'id':_0x383419[_0xe182('0x17')]}})[_0xe182('0x18')](function(_0x10e3e0){if(_0x10e3e0){_0x10e3e0[_0xe182('0x19')]({'lastMsgAt':_0x383419['createdAt'],'lastMsgDirection':_0x383419[_0xe182('0x11')][_0xe182('0x12')]()});}})[_0xe182('0x1a')](function(_0x29f023){console['error'](_0x29f023);});}if(_0x383419[_0xe182('0x11')]===_0xe182('0x13')&&!_0x383419[_0xe182('0x1b')]){var _0x204160;_0x463319[_0xe182('0x1c')][_0xe182('0x1d')]({'where':{'id':_0x383419[_0xe182('0x1e')]},'raw':!![]})[_0xe182('0x18')](function(_0x4edaf3){_0x204160=_0x4edaf3;if(_0x204160&&_0x204160[_0xe182('0x1f')]){switch(_0x204160[_0xe182('0x1f')]){case _0xe182('0x20'):var _0x24a337=require(_0xe182('0x20'));if(_0x204160[_0xe182('0x21')]&&_0x204160[_0xe182('0x22')]&&_0x204160[_0xe182('0x23')]){var _0x4cb8b1=new _0x24a337(_0x204160[_0xe182('0x21')],_0x204160[_0xe182('0x22')]);_0x4cb8b1['messages'][_0xe182('0x24')]({'body':_0x383419[_0xe182('0xd')],'to':'whatsapp:'+_0x383419['phone'],'from':_0xe182('0x25')+_0x204160[_0xe182('0x23')],'statusCallback':_0x204160[_0xe182('0x26')]+_0xe182('0x27')+_0x383419['id']+_0xe182('0x28')+_0x204160[_0xe182('0x29')]})[_0xe182('0x18')](function(_0x227606){if(_0x227606[_0xe182('0x2a')]){return _0xbac502[_0xe182('0x19')]({'messageId':_0x227606['sid']});}})[_0xe182('0x1a')](function(_0x522627){logger['error'](_0xe182('0x2b'),'afterCreate','twilio',util[_0xe182('0x2c')](_0x522627,{'showHidden':![],'depth':null}));});}else{logger[_0xe182('0x2d')](_0xe182('0x2b'),'afterCreate',_0xe182('0x20'),_0xe182('0x2e'));}break;case _0xe182('0x2f'):var _0x2e9e1c=_0x204160[_0xe182('0x21')];var _0x5087b8=_0x204160[_0xe182('0x22')];var _0x497e83=_0x204160['baseUrl']+_0xe182('0x30')+_0x2e9e1c+'/messages/';var _0x1dcbbc={'to':[_0x383419[_0xe182('0x23')]],'message':{'type':_0xe182('0x31'),'text':_0x383419[_0xe182('0xd')]}};var _0x5aeacc={'method':'POST','uri':_0x497e83,'headers':{'Authorization':_0xe182('0x32')+_0x5087b8,'Content-Type':_0xe182('0x33')},'body':_0x1dcbbc,'json':!![]};rp(_0x5aeacc)[_0xe182('0x18')](function(_0x2bd633){if(_0x2bd633[_0xe182('0x34')][0x0][_0xe182('0x35')]){return _0xbac502[_0xe182('0x19')]({'messageId':_0x2bd633['statuses'][0x0][_0xe182('0x35')]});}})[_0xe182('0x1a')](function(_0x1d214f){logger[_0xe182('0x36')](_0xe182('0x37'),_0x1d214f);});break;}}})[_0xe182('0x38')](function(){_0x3014d2();});}else{_0x3014d2();}}},'charset':_0xe182('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 90240e6..72d0e8b 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 _0xe18a=['socket.io-emitter','./whatsappMessage.socket','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','create','options','raw','info','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults'];(function(_0x4bcf6a,_0x2ff357){var _0x5f0d70=function(_0x40908e){while(--_0x40908e){_0x4bcf6a['push'](_0x4bcf6a['shift']());}};_0x5f0d70(++_0x2ff357);}(_0xe18a,0x155));var _0xae18=function(_0x129b32,_0x34164e){_0x129b32=_0x129b32-0x0;var _0x3eaf91=_0xe18a[_0x129b32];return _0x3eaf91;};'use strict';var _=require(_0xae18('0x0'));var util=require(_0xae18('0x1'));var moment=require('moment');var BPromise=require(_0xae18('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae18('0x3'))['db'];var utils=require(_0xae18('0x4'));var logger=require('../../config/logger')(_0xae18('0x5'));var config=require('../../config/environment');var jayson=require(_0xae18('0x6'));var client=jayson['client'][_0xae18('0x7')]({'port':0x232a});config[_0xae18('0x8')]=_[_0xae18('0x9')](config[_0xae18('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xae18('0xa'))(new Redis(config['redis']));require(_0xae18('0xb'))['register'](socket);function respondWithRpcPromise(_0x94fffe,_0x534746,_0xbd3630){return new BPromise(function(_0x5edd50,_0x2a9d94){return client['request'](_0x94fffe,_0xbd3630)[_0xae18('0xc')](function(_0x48de55){logger['info'](_0xae18('0xd'),_0x534746,_0xae18('0xe'));logger[_0xae18('0xf')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x534746,'request\x20sent',JSON[_0xae18('0x10')](_0x48de55));if(_0x48de55[_0xae18('0x11')]){if(_0x48de55[_0xae18('0x11')][_0xae18('0x12')]===0x1f4){logger[_0xae18('0x11')](_0xae18('0xd'),_0x534746,_0x48de55['error'][_0xae18('0x13')]);return _0x2a9d94(_0x48de55[_0xae18('0x11')][_0xae18('0x13')]);}logger['error'](_0xae18('0xd'),_0x534746,_0x48de55[_0xae18('0x11')][_0xae18('0x13')]);return _0x5edd50(_0x48de55[_0xae18('0x11')][_0xae18('0x13')]);}else{logger['info'](_0xae18('0xd'),_0x534746,_0xae18('0xe'));_0x5edd50(_0x48de55[_0xae18('0x14')][_0xae18('0x13')]);}})[_0xae18('0x15')](function(_0x5846bc){logger[_0xae18('0x11')](_0xae18('0xd'),_0x534746,_0x5846bc);_0x2a9d94(_0x5846bc);});});}exports[_0xae18('0x16')]=function(_0x407734){var _0x84e975=this;return new Promise(function(_0x2e572a,_0x2410ce){return db['WhatsappMessage'][_0xae18('0x17')](_0x407734['body'],{'raw':_0x407734[_0xae18('0x18')]?_0x407734[_0xae18('0x18')][_0xae18('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x84add){logger[_0xae18('0x1a')](_0xae18('0x16'),_0x407734);logger[_0xae18('0xf')](_0xae18('0x16'),_0x407734,JSON[_0xae18('0x10')](_0x84add));_0x2e572a(_0x84add);})[_0xae18('0x15')](function(_0x5afc49){logger['error'](_0xae18('0x16'),_0x5afc49['message'],_0x407734);_0x2410ce(_0x84e975[_0xae18('0x11')](0x1f4,_0x5afc49[_0xae18('0x13')]));});});}; \ No newline at end of file +var _0x9ba4=['catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x12f9e3,_0x3fadc1){var _0x2de0c8=function(_0x31b5c5){while(--_0x31b5c5){_0x12f9e3['push'](_0x12f9e3['shift']());}};_0x2de0c8(++_0x3fadc1);}(_0x9ba4,0x130));var _0x49ba=function(_0x5e6260,_0x5cdea0){_0x5e6260=_0x5e6260-0x0;var _0x436ae2=_0x9ba4[_0x5e6260];return _0x436ae2;};'use strict';var _=require(_0x49ba('0x0'));var util=require('util');var moment=require(_0x49ba('0x1'));var BPromise=require(_0x49ba('0x2'));var rs=require(_0x49ba('0x3'));var fs=require('fs');var Redis=require(_0x49ba('0x4'));var db=require(_0x49ba('0x5'))['db'];var utils=require(_0x49ba('0x6'));var logger=require(_0x49ba('0x7'))(_0x49ba('0x8'));var config=require(_0x49ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x49ba('0xa')][_0x49ba('0xb')]({'port':0x232a});config[_0x49ba('0xc')]=_[_0x49ba('0xd')](config[_0x49ba('0xc')],{'host':_0x49ba('0xe'),'port':0x18eb});var socket=require(_0x49ba('0xf'))(new Redis(config[_0x49ba('0xc')]));require(_0x49ba('0x10'))[_0x49ba('0x11')](socket);function respondWithRpcPromise(_0x2a50cc,_0x4b3918,_0x2b89b9){return new BPromise(function(_0x364c90,_0x3df454){return client[_0x49ba('0x12')](_0x2a50cc,_0x2b89b9)[_0x49ba('0x13')](function(_0x31a182){logger[_0x49ba('0x14')](_0x49ba('0x15'),_0x4b3918,_0x49ba('0x16'));logger['debug'](_0x49ba('0x17'),_0x4b3918,_0x49ba('0x16'),JSON[_0x49ba('0x18')](_0x31a182));if(_0x31a182['error']){if(_0x31a182[_0x49ba('0x19')][_0x49ba('0x1a')]===0x1f4){logger['error'](_0x49ba('0x15'),_0x4b3918,_0x31a182['error'][_0x49ba('0x1b')]);return _0x3df454(_0x31a182['error'][_0x49ba('0x1b')]);}logger['error'](_0x49ba('0x15'),_0x4b3918,_0x31a182[_0x49ba('0x19')][_0x49ba('0x1b')]);return _0x364c90(_0x31a182['error'][_0x49ba('0x1b')]);}else{logger[_0x49ba('0x14')](_0x49ba('0x15'),_0x4b3918,_0x49ba('0x16'));_0x364c90(_0x31a182[_0x49ba('0x1c')][_0x49ba('0x1b')]);}})[_0x49ba('0x1d')](function(_0x4c286d){logger[_0x49ba('0x19')]('WhatsappMessage,\x20%s,\x20%s',_0x4b3918,_0x4c286d);_0x3df454(_0x4c286d);});});}exports['CreateWhatsappMessage']=function(_0x5974f8){var _0x58f0f9=this;return new Promise(function(_0x2fe38f,_0x19749d){return db[_0x49ba('0x1e')][_0x49ba('0x1f')](_0x5974f8[_0x49ba('0x20')],{'raw':_0x5974f8['options']?_0x5974f8[_0x49ba('0x21')][_0x49ba('0x22')]===undefined?!![]:![]:!![]})[_0x49ba('0x13')](function(_0x171637){logger[_0x49ba('0x14')](_0x49ba('0x23'),_0x5974f8);logger[_0x49ba('0x24')](_0x49ba('0x23'),_0x5974f8,JSON[_0x49ba('0x18')](_0x171637));_0x2fe38f(_0x171637);})[_0x49ba('0x1d')](function(_0x34390b){logger[_0x49ba('0x19')](_0x49ba('0x23'),_0x34390b['message'],_0x5974f8);_0x19749d(_0x58f0f9[_0x49ba('0x19')](0x1f4,_0x34390b[_0x49ba('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 59b1c14..aea9bf6 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 _0x5f67=['./whatsappMessage.events','remove','update','removeListener','register'];(function(_0x1e2088,_0x25d9ed){var _0x17e519=function(_0x5ecb3b){while(--_0x5ecb3b){_0x1e2088['push'](_0x1e2088['shift']());}};_0x17e519(++_0x25d9ed);}(_0x5f67,0x1ae));var _0x75f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f67[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x75f6('0x0'));var events=['save',_0x75f6('0x1'),_0x75f6('0x2')];function createListener(_0x587c3b,_0x5766f4){return function(_0x5585ba){_0x5766f4['emit'](_0x587c3b,_0x5585ba);};}function removeListener(_0x69948,_0xa3c425){return function(){WhatsappMessageEvents[_0x75f6('0x3')](_0x69948,_0xa3c425);};}exports[_0x75f6('0x4')]=function(_0x13b32d){for(var _0x3cdc35=0x0,_0x1fe345=events['length'];_0x3cdc35<_0x1fe345;_0x3cdc35++){var _0x1b6166=events[_0x3cdc35];var _0xa4eb53=createListener('whatsappMessage:'+_0x1b6166,_0x13b32d);WhatsappMessageEvents['on'](_0x1b6166,_0xa4eb53);}}; \ No newline at end of file +var _0x642c=['emit','removeListener','whatsappMessage:','save'];(function(_0x43fb7a,_0x3807f1){var _0x1be693=function(_0x4e12f8){while(--_0x4e12f8){_0x43fb7a['push'](_0x43fb7a['shift']());}};_0x1be693(++_0x3807f1);}(_0x642c,0xa3));var _0xc642=function(_0x1bfea2,_0x57755c){_0x1bfea2=_0x1bfea2-0x0;var _0x163d77=_0x642c[_0x1bfea2];return _0x163d77;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xc642('0x0'),'remove','update'];function createListener(_0x5b1d05,_0x4d65d9){return function(_0x55114e){_0x4d65d9[_0xc642('0x1')](_0x5b1d05,_0x55114e);};}function removeListener(_0x26849f,_0x57b472){return function(){WhatsappMessageEvents[_0xc642('0x2')](_0x26849f,_0x57b472);};}exports['register']=function(_0x4d1562){for(var _0xdb5adc=0x0,_0x47fcf3=events['length'];_0xdb5adc<_0x47fcf3;_0xdb5adc++){var _0x535202=events[_0xdb5adc];var _0x2fe331=createListener(_0xc642('0x3')+_0x535202,_0x4d1562);WhatsappMessageEvents['on'](_0x535202,_0x2fe331);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 965e4da..3c6132e 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 _0xd471=['/:id','update','destroy','delete','removeTeams','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put'];(function(_0x4a9df2,_0x2c7b6f){var _0x4191ad=function(_0x3ced6a){while(--_0x3ced6a){_0x4a9df2['push'](_0x4a9df2['shift']());}};_0x4191ad(++_0x2c7b6f);}(_0xd471,0xf6));var _0x1d47=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd471[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1d47('0x0'));var timeout=require(_0x1d47('0x1'));var express=require(_0x1d47('0x2'));var router=express[_0x1d47('0x3')]();var fs_extra=require(_0x1d47('0x4'));var auth=require(_0x1d47('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0x1d47('0x6')]('/',auth[_0x1d47('0x7')](),controller['index']);router['get'](_0x1d47('0x8'),auth[_0x1d47('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1d47('0x6')]('/:id/members',auth['isAuthenticated'](),controller[_0x1d47('0x9')]);router[_0x1d47('0x6')]('/:id/teams',auth[_0x1d47('0x7')](),controller[_0x1d47('0xa')]);router[_0x1d47('0x6')](_0x1d47('0xb'),auth['isAuthenticated'](),controller[_0x1d47('0xc')]);router[_0x1d47('0xd')]('/',auth[_0x1d47('0x7')](),controller['create']);router[_0x1d47('0xd')](_0x1d47('0xe'),auth[_0x1d47('0x7')](),controller[_0x1d47('0xf')]);router[_0x1d47('0xd')](_0x1d47('0xb'),auth[_0x1d47('0x7')](),controller[_0x1d47('0x10')]);router[_0x1d47('0x11')](_0x1d47('0x12'),auth[_0x1d47('0x7')](),controller[_0x1d47('0x13')]);router['delete'](_0x1d47('0x12'),auth[_0x1d47('0x7')](),controller[_0x1d47('0x14')]);router[_0x1d47('0x15')](_0x1d47('0xe'),auth[_0x1d47('0x7')](),controller[_0x1d47('0x16')]);router[_0x1d47('0x15')]('/:id/users',auth[_0x1d47('0x7')](),controller['removeAgents']);module[_0x1d47('0x17')]=router; \ No newline at end of file +var _0x6d4b=['destroy','removeAgents','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','post','addTeams','addAgents','put','delete'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x6d4b,0xc3));var _0xb6d4=function(_0x1ab020,_0x154ce0){_0x1ab020=_0x1ab020-0x0;var _0x145fd6=_0x6d4b[_0x1ab020];return _0x145fd6;};'use strict';var multer=require('multer');var util=require(_0xb6d4('0x0'));var path=require('path');var timeout=require(_0xb6d4('0x1'));var express=require('express');var router=express[_0xb6d4('0x2')]();var fs_extra=require(_0xb6d4('0x3'));var auth=require(_0xb6d4('0x4'));var interaction=require(_0xb6d4('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xb6d4('0x6')]('/',auth['isAuthenticated'](),controller[_0xb6d4('0x7')]);router[_0xb6d4('0x6')]('/describe',auth[_0xb6d4('0x8')](),controller['describe']);router[_0xb6d4('0x6')](_0xb6d4('0x9'),auth['isAuthenticated'](),controller[_0xb6d4('0xa')]);router['get'](_0xb6d4('0xb'),auth[_0xb6d4('0x8')](),controller[_0xb6d4('0xc')]);router[_0xb6d4('0x6')]('/:id/teams',auth[_0xb6d4('0x8')](),controller[_0xb6d4('0xd')]);router[_0xb6d4('0x6')](_0xb6d4('0xe'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xb6d4('0x8')](),controller[_0xb6d4('0xf')]);router[_0xb6d4('0x10')]('/:id/teams',auth[_0xb6d4('0x8')](),controller[_0xb6d4('0x11')]);router[_0xb6d4('0x10')](_0xb6d4('0xe'),auth[_0xb6d4('0x8')](),controller[_0xb6d4('0x12')]);router[_0xb6d4('0x13')](_0xb6d4('0x9'),auth[_0xb6d4('0x8')](),controller['update']);router[_0xb6d4('0x14')](_0xb6d4('0x9'),auth[_0xb6d4('0x8')](),controller[_0xb6d4('0x15')]);router['delete']('/:id/teams',auth[_0xb6d4('0x8')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xb6d4('0x8')](),controller[_0xb6d4('0x16')]);module[_0xb6d4('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index b764f8f..751b67c 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 _0x1a5c=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x430d5a,_0x369a60){var _0x530fbd=function(_0x416d94){while(--_0x416d94){_0x430d5a['push'](_0x430d5a['shift']());}};_0x530fbd(++_0x369a60);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x1a5c[_0x186376];return _0x2dbdd9;};'use strict';var Sequelize=require(_0xc1a5('0x0'));module[_0xc1a5('0x1')]={'name':{'type':Sequelize[_0xc1a5('0x2')],'unique':_0xc1a5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc1a5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc1a5('0x5')](_0xc1a5('0x6'),_0xc1a5('0x7'),_0xc1a5('0x8'))},'description':{'type':Sequelize[_0xc1a5('0x2')]}}; \ No newline at end of file +var _0xa98d=['roundrobin','sequelize','STRING','INTEGER','ENUM','beepall'];(function(_0x3ec873,_0x49b01e){var _0x44c08e=function(_0x3006ec){while(--_0x3006ec){_0x3ec873['push'](_0x3ec873['shift']());}};_0x44c08e(++_0x49b01e);}(_0xa98d,0xa3));var _0xda98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xda98('0x0'));module['exports']={'name':{'type':Sequelize[_0xda98('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xda98('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda98('0x3')]('rrmemory',_0xda98('0x4'),_0xda98('0x5'))},'description':{'type':Sequelize[_0xda98('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2f03276..a38a142 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 _0xfca0=['../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','get','WhatsappQueues','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','WhatsappQueueId','options','User','findAndCountAll','agent','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','transaction','UserWhatsappQueue','userWhatsappQueue:save','removeTeams','Team','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2d0077,_0x5c7505){var _0x1b23d4=function(_0x3a38b3){while(--_0x3a38b3){_0x2d0077['push'](_0x2d0077['shift']());}};_0x1b23d4(++_0x5c7505);}(_0xfca0,0x199));var _0x0fca=function(_0x420f45,_0x82ba43){_0x420f45=_0x420f45-0x0;var _0x115f02=_0xfca0[_0x420f45];return _0x115f02;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0fca('0x0'));var rp=require(_0x0fca('0x1'));var moment=require(_0x0fca('0x2'));var BPromise=require(_0x0fca('0x3'));var Mustache=require(_0x0fca('0x4'));var util=require(_0x0fca('0x5'));var path=require(_0x0fca('0x6'));var sox=require(_0x0fca('0x7'));var csv=require(_0x0fca('0x8'));var ejs=require(_0x0fca('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fca('0xa'));var squel=require('squel');var crypto=require(_0x0fca('0xb'));var jsforce=require(_0x0fca('0xc'));var deskjs=require(_0x0fca('0xd'));var toCsv=require(_0x0fca('0x8'));var querystring=require(_0x0fca('0xe'));var Papa=require(_0x0fca('0xf'));var Redis=require(_0x0fca('0x10'));var authService=require(_0x0fca('0x11'));var qs=require(_0x0fca('0x12'));var as=require(_0x0fca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fca('0x14'))(_0x0fca('0x15'));var utils=require(_0x0fca('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fca('0x17'))['db'];config[_0x0fca('0x18')]=_['defaults'](config[_0x0fca('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fca('0x19'))(new Redis(config[_0x0fca('0x18')]));require(_0x0fca('0x1a'))[_0x0fca('0x1b')](socket);function respondWithStatusCode(_0x20cb76,_0x5bbfc3){_0x5bbfc3=_0x5bbfc3||0xcc;return function(_0x5bf26c){if(_0x5bf26c){return _0x20cb76[_0x0fca('0x1c')](_0x5bbfc3);}return _0x20cb76[_0x0fca('0x1d')](_0x5bbfc3)[_0x0fca('0x1e')]();};}function respondWithResult(_0x3bdccd,_0x9e2277){_0x9e2277=_0x9e2277||0xc8;return function(_0x1cd2b0){if(_0x1cd2b0){return _0x3bdccd[_0x0fca('0x1d')](_0x9e2277)[_0x0fca('0x1f')](_0x1cd2b0);}};}function respondWithFilteredResult(_0x1b3aa5,_0x4318cc){return function(_0x190aad){if(_0x190aad){var _0x1dab89=typeof _0x4318cc[_0x0fca('0x20')]===_0x0fca('0x21')&&typeof _0x4318cc[_0x0fca('0x22')]==='undefined';var _0x4bfe5a=_0x190aad[_0x0fca('0x23')];var _0x328b5d=_0x1dab89?0x0:_0x4318cc[_0x0fca('0x20')];var _0x5363e6=_0x1dab89?_0x190aad[_0x0fca('0x23')]:_0x4318cc[_0x0fca('0x20')]+_0x4318cc[_0x0fca('0x22')];var _0x594c07;if(_0x5363e6>=_0x4bfe5a){_0x5363e6=_0x4bfe5a;_0x594c07=0xc8;}else{_0x594c07=0xce;}_0x1b3aa5[_0x0fca('0x1d')](_0x594c07);return _0x1b3aa5['set'](_0x0fca('0x24'),_0x328b5d+'-'+_0x5363e6+'/'+_0x4bfe5a)[_0x0fca('0x1f')](_0x190aad);}return null;};}function patchUpdates(_0x323425){return function(_0x382460){try{jsonpatch[_0x0fca('0x25')](_0x382460,_0x323425,!![]);}catch(_0x257739){return BPromise[_0x0fca('0x26')](_0x257739);}return _0x382460['save']();};}function saveUpdates(_0x283585,_0x2612ac){return function(_0x48a99b){if(_0x48a99b){return _0x48a99b[_0x0fca('0x27')](_0x283585)['then'](function(_0x388c72){return _0x388c72;});}return null;};}function removeEntity(_0x539aa5,_0x460e14){return function(_0x565faa){if(_0x565faa){return _0x565faa[_0x0fca('0x28')]()[_0x0fca('0x29')](function(){var _0x525b40=_0x565faa[_0x0fca('0x2a')]({'plain':!![]});var _0x445ddc=_0x0fca('0x2b');return db['UserProfileResource'][_0x0fca('0x28')]({'where':{'type':_0x445ddc,'resourceId':_0x525b40['id']}})[_0x0fca('0x29')](function(){return _0x565faa;});})['then'](function(){_0x539aa5[_0x0fca('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x104366,_0x26ab89){return function(_0x48e898){if(!_0x48e898){_0x104366['sendStatus'](0x194);}return _0x48e898;};}function handleError(_0x287408,_0xd4ed79){_0xd4ed79=_0xd4ed79||0x1f4;return function(_0x4a91b0){logger[_0x0fca('0x2c')](_0x4a91b0[_0x0fca('0x2d')]);if(_0x4a91b0[_0x0fca('0x2e')]){delete _0x4a91b0['name'];}_0x287408['status'](_0xd4ed79)[_0x0fca('0x2f')](_0x4a91b0);};}exports[_0x0fca('0x30')]=function(_0x54003e,_0xc5c19b){var _0x3adf4b={},_0x51506f={},_0x43912f={'count':0x0,'rows':[]};var _0x5253a5=_[_0x0fca('0x31')](db[_0x0fca('0x32')][_0x0fca('0x33')],function(_0x994c72){return{'name':_0x994c72[_0x0fca('0x34')],'type':_0x994c72[_0x0fca('0x35')][_0x0fca('0x36')]};});_0x51506f[_0x0fca('0x37')]=_[_0x0fca('0x31')](_0x5253a5,_0x0fca('0x2e'));_0x51506f['query']=_[_0x0fca('0x38')](_0x54003e[_0x0fca('0x39')]);_0x51506f[_0x0fca('0x3a')]=_[_0x0fca('0x3b')](_0x51506f[_0x0fca('0x37')],_0x51506f[_0x0fca('0x39')]);_0x3adf4b['attributes']=_[_0x0fca('0x3b')](_0x51506f[_0x0fca('0x37')],qs[_0x0fca('0x3c')](_0x54003e[_0x0fca('0x39')]['fields']));_0x3adf4b[_0x0fca('0x3d')]=_0x3adf4b[_0x0fca('0x3d')][_0x0fca('0x3e')]?_0x3adf4b['attributes']:_0x51506f[_0x0fca('0x37')];if(!_0x54003e['query'][_0x0fca('0x3f')](_0x0fca('0x40'))){_0x3adf4b[_0x0fca('0x22')]=qs[_0x0fca('0x22')](_0x54003e[_0x0fca('0x39')][_0x0fca('0x22')]);_0x3adf4b['offset']=qs[_0x0fca('0x20')](_0x54003e['query'][_0x0fca('0x20')]);}_0x3adf4b[_0x0fca('0x41')]=qs[_0x0fca('0x42')](_0x54003e[_0x0fca('0x39')][_0x0fca('0x42')]);_0x3adf4b[_0x0fca('0x43')]=qs[_0x0fca('0x3a')](_[_0x0fca('0x44')](_0x54003e[_0x0fca('0x39')],_0x51506f[_0x0fca('0x3a')]),_0x5253a5);if(_0x54003e[_0x0fca('0x39')][_0x0fca('0x45')]){_0x3adf4b[_0x0fca('0x43')]=_[_0x0fca('0x46')](_0x3adf4b[_0x0fca('0x43')],{'$or':_[_0x0fca('0x31')](_0x5253a5,function(_0x1bc320){if(_0x1bc320[_0x0fca('0x35')]!==_0x0fca('0x47')){var _0x21e4d8={};_0x21e4d8[_0x1bc320['name']]={'$like':'%'+_0x54003e[_0x0fca('0x39')][_0x0fca('0x45')]+'%'};return _0x21e4d8;}})});}_0x3adf4b=_['merge']({},_0x3adf4b,_0x54003e['options']);var _0x340802={'where':_0x3adf4b[_0x0fca('0x43')]};return db[_0x0fca('0x32')]['count'](_0x340802)[_0x0fca('0x29')](function(_0x406791){_0x43912f[_0x0fca('0x23')]=_0x406791;if(_0x54003e[_0x0fca('0x39')][_0x0fca('0x48')]){_0x3adf4b[_0x0fca('0x49')]=[{'all':!![]}];}return db[_0x0fca('0x32')][_0x0fca('0x4a')](_0x3adf4b);})[_0x0fca('0x29')](function(_0x589500){_0x43912f[_0x0fca('0x4b')]=_0x589500;return _0x43912f;})[_0x0fca('0x29')](respondWithFilteredResult(_0xc5c19b,_0x3adf4b))[_0x0fca('0x4c')](handleError(_0xc5c19b,null));};exports['show']=function(_0x55cc4a,_0x557774){var _0x121c62={'raw':!![],'where':{'id':_0x55cc4a['params']['id']}},_0x430078={};_0x430078['model']=_[_0x0fca('0x38')](db[_0x0fca('0x32')][_0x0fca('0x33')]);_0x430078[_0x0fca('0x39')]=_[_0x0fca('0x38')](_0x55cc4a[_0x0fca('0x39')]);_0x430078['filters']=_[_0x0fca('0x3b')](_0x430078['model'],_0x430078[_0x0fca('0x39')]);_0x121c62['attributes']=_['intersection'](_0x430078['model'],qs[_0x0fca('0x3c')](_0x55cc4a[_0x0fca('0x39')][_0x0fca('0x3c')]));_0x121c62[_0x0fca('0x3d')]=_0x121c62[_0x0fca('0x3d')]['length']?_0x121c62['attributes']:_0x430078[_0x0fca('0x37')];if(_0x55cc4a['query'][_0x0fca('0x48')]){_0x121c62[_0x0fca('0x49')]=[{'all':!![]}];}_0x121c62=_[_0x0fca('0x46')]({},_0x121c62,_0x55cc4a['options']);return db['WhatsappQueue'][_0x0fca('0x4d')](_0x121c62)[_0x0fca('0x29')](handleEntityNotFound(_0x557774,null))['then'](respondWithResult(_0x557774,null))[_0x0fca('0x4c')](handleError(_0x557774,null));};exports[_0x0fca('0x4e')]=function(_0x1ab38,_0x1abb39){return db['WhatsappQueue'][_0x0fca('0x4e')](_0x1ab38[_0x0fca('0x4f')],{})[_0x0fca('0x29')](function(_0x4aed26){var _0x2a263a=_0x1ab38['user'][_0x0fca('0x2a')]({'plain':!![]});if(!_0x2a263a)throw new Error(_0x0fca('0x50'));if(_0x2a263a[_0x0fca('0x51')]===_0x0fca('0x52')){var _0x178229=_0x4aed26['get']({'plain':!![]});var _0x7068c=_0x0fca('0x2b');return db[_0x0fca('0x53')][_0x0fca('0x4d')]({'where':{'name':_0x7068c,'userProfileId':_0x2a263a[_0x0fca('0x54')]},'raw':!![]})['then'](function(_0x3cd6f9){if(_0x3cd6f9&&_0x3cd6f9[_0x0fca('0x55')]===0x0){return db[_0x0fca('0x56')]['create']({'name':_0x178229[_0x0fca('0x2e')],'resourceId':_0x178229['id'],'type':_0x3cd6f9[_0x0fca('0x2e')],'sectionId':_0x3cd6f9['id']},{})[_0x0fca('0x29')](function(){return _0x4aed26;});}else{return _0x4aed26;}})['catch'](function(_0xad6107){logger['error'](_0x0fca('0x57'),_0xad6107);throw _0xad6107;});}return _0x4aed26;})[_0x0fca('0x29')](respondWithResult(_0x1abb39,0xc9))[_0x0fca('0x4c')](handleError(_0x1abb39,null));};exports[_0x0fca('0x27')]=function(_0x2f27a7,_0x54d582){if(_0x2f27a7[_0x0fca('0x4f')]['id']){delete _0x2f27a7[_0x0fca('0x4f')]['id'];}return db['WhatsappQueue'][_0x0fca('0x4d')]({'where':{'id':_0x2f27a7['params']['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x54d582,null))[_0x0fca('0x29')](saveUpdates(_0x2f27a7[_0x0fca('0x4f')],null))[_0x0fca('0x29')](respondWithResult(_0x54d582,null))[_0x0fca('0x4c')](handleError(_0x54d582,null));};exports[_0x0fca('0x28')]=function(_0x424328,_0x31ceb9){return db[_0x0fca('0x32')][_0x0fca('0x4d')]({'where':{'id':_0x424328[_0x0fca('0x58')]['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x31ceb9,null))['then'](removeEntity(_0x31ceb9,null))[_0x0fca('0x4c')](handleError(_0x31ceb9,null));};exports[_0x0fca('0x59')]=function(_0x3e847a,_0x418535){return db['WhatsappQueue'][_0x0fca('0x59')]()[_0x0fca('0x29')](respondWithResult(_0x418535,null))[_0x0fca('0x4c')](handleError(_0x418535,null));};exports['getMembers']=function(_0x5bb208,_0x45247c,_0x146d05){var _0x1def00={'raw':!![],'where':{}},_0x36aa8d={},_0x2682b4;return db[_0x0fca('0x32')][_0x0fca('0x5a')]({'where':{'id':_0x5bb208[_0x0fca('0x58')]['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x45247c,null))[_0x0fca('0x29')](function(_0x4d18e4){if(_0x4d18e4){_0x2682b4=_0x4d18e4[_0x0fca('0x2a')]({'plain':!![]});_0x36aa8d[_0x0fca('0x37')]=_['keys'](db['UserWhatsappQueue'][_0x0fca('0x33')]);_0x36aa8d[_0x0fca('0x39')]=_['keys'](_0x5bb208['query']);_0x36aa8d[_0x0fca('0x3a')]=_[_0x0fca('0x3b')](_0x36aa8d[_0x0fca('0x37')],_0x36aa8d[_0x0fca('0x39')]);_0x1def00[_0x0fca('0x3d')]=_[_0x0fca('0x3b')](_0x36aa8d['model'],qs[_0x0fca('0x3c')](_0x5bb208[_0x0fca('0x39')][_0x0fca('0x3c')]));_0x1def00['attributes']=_0x1def00[_0x0fca('0x3d')][_0x0fca('0x3e')]?_0x1def00[_0x0fca('0x3d')]:_0x36aa8d[_0x0fca('0x37')];if(!_0x5bb208[_0x0fca('0x39')][_0x0fca('0x3f')]('nolimit')){_0x1def00[_0x0fca('0x22')]=qs['limit'](_0x5bb208[_0x0fca('0x39')][_0x0fca('0x22')]);_0x1def00[_0x0fca('0x20')]=qs[_0x0fca('0x20')](_0x5bb208[_0x0fca('0x39')][_0x0fca('0x20')]);}_0x1def00[_0x0fca('0x41')]=qs[_0x0fca('0x42')](_0x5bb208[_0x0fca('0x39')][_0x0fca('0x42')]);_0x1def00[_0x0fca('0x43')]=qs['filters'](_['pick'](_0x5bb208[_0x0fca('0x39')],_0x36aa8d['filters']));_0x1def00[_0x0fca('0x43')][_0x0fca('0x5b')]=_0x4d18e4['id'];if(_0x5bb208[_0x0fca('0x39')]['filter']){_0x1def00[_0x0fca('0x43')]=_[_0x0fca('0x46')](_0x1def00['where'],{'$or':_[_0x0fca('0x31')](_0x1def00['attributes'],function(_0x4261e8){var _0x17de2f={};_0x17de2f[_0x4261e8]={'$like':'%'+_0x5bb208['query'][_0x0fca('0x45')]+'%'};return _0x17de2f;})});}_0x1def00=_[_0x0fca('0x46')]({},_0x1def00,_0x5bb208[_0x0fca('0x5c')]);return db['UserWhatsappQueue'][_0x0fca('0x4a')](_0x1def00);}})[_0x0fca('0x29')](function(_0x315130){if(_0x315130){return db[_0x0fca('0x5d')][_0x0fca('0x5e')]({'where':{'id':_['map'](_0x315130,'UserId'),'role':_0x0fca('0x5f')},'attributes':['id',_0x0fca('0x2e'),'whatsappPause',_0x0fca('0x60'),_0x0fca('0x61')]});}})['then'](function(_0xcc2ff){if(_0xcc2ff){return{'count':_0xcc2ff['count'],'rows':_[_0x0fca('0x31')](_0xcc2ff[_0x0fca('0x4b')],function(_0x3e680d){return{'membername':_0x3e680d[_0x0fca('0x2e')],'UserId':_0x3e680d['id'],'queue_name':_0x2682b4['name'],'WhatsappQueueId':_0x2682b4['id'],'interface':util[_0x0fca('0x62')](_0x0fca('0x63'),_0x0fca('0x64'),_0x3e680d['name']),'penalty':0x0,'paused':_0x3e680d[_0x0fca('0x65')],'createdAt':_0x3e680d[_0x0fca('0x61')],'updatedAt':_0x3e680d[_0x0fca('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0fca('0x29')](respondWithFilteredResult(_0x45247c,_0x1def00))[_0x0fca('0x4c')](handleError(_0x45247c,null));};exports[_0x0fca('0x66')]=function(_0x4c259f,_0x39739e,_0x3126d9){var _0x23eac9={};var _0xaa0ac0={};var _0x3da52b;var _0x3faf19;return db[_0x0fca('0x32')]['findOne']({'where':{'id':_0x4c259f['params']['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x39739e,null))[_0x0fca('0x29')](function(_0x56eb9e){if(_0x56eb9e){_0x3da52b=_0x56eb9e;_0xaa0ac0[_0x0fca('0x37')]=_[_0x0fca('0x38')](db['Team']['rawAttributes']);_0xaa0ac0[_0x0fca('0x39')]=_['keys'](_0x4c259f['query']);_0xaa0ac0[_0x0fca('0x3a')]=_[_0x0fca('0x3b')](_0xaa0ac0['model'],_0xaa0ac0[_0x0fca('0x39')]);_0x23eac9[_0x0fca('0x3d')]=_[_0x0fca('0x3b')](_0xaa0ac0[_0x0fca('0x37')],qs[_0x0fca('0x3c')](_0x4c259f[_0x0fca('0x39')][_0x0fca('0x3c')]));_0x23eac9[_0x0fca('0x3d')]=_0x23eac9[_0x0fca('0x3d')][_0x0fca('0x3e')]?_0x23eac9[_0x0fca('0x3d')]:_0xaa0ac0[_0x0fca('0x37')];_0x23eac9['order']=qs[_0x0fca('0x42')](_0x4c259f['query'][_0x0fca('0x42')]);_0x23eac9[_0x0fca('0x43')]=qs[_0x0fca('0x3a')](_[_0x0fca('0x44')](_0x4c259f[_0x0fca('0x39')],_0xaa0ac0['filters']));if(_0x4c259f[_0x0fca('0x39')][_0x0fca('0x45')]){_0x23eac9['where']=_[_0x0fca('0x46')](_0x23eac9[_0x0fca('0x43')],{'$or':_[_0x0fca('0x31')](_0x23eac9[_0x0fca('0x3d')],function(_0x320f98){var _0x321b72={};_0x321b72[_0x320f98]={'$like':'%'+_0x4c259f[_0x0fca('0x39')][_0x0fca('0x45')]+'%'};return _0x321b72;})});}_0x23eac9=_[_0x0fca('0x46')]({},_0x23eac9,_0x4c259f[_0x0fca('0x5c')]);return _0x3da52b['getTeams'](_0x23eac9);}})['then'](function(_0x41088c){if(_0x41088c){_0x3faf19=_0x41088c['length'];if(!_0x4c259f[_0x0fca('0x39')]['hasOwnProperty']('nolimit')){_0x23eac9[_0x0fca('0x22')]=qs['limit'](_0x4c259f['query']['limit']);_0x23eac9[_0x0fca('0x20')]=qs[_0x0fca('0x20')](_0x4c259f[_0x0fca('0x39')][_0x0fca('0x20')]);}return _0x3da52b[_0x0fca('0x66')](_0x23eac9);}})[_0x0fca('0x29')](function(_0x339311){if(_0x339311){return _0x339311?{'count':_0x3faf19,'rows':_0x339311}:null;}})[_0x0fca('0x29')](respondWithResult(_0x39739e,null))[_0x0fca('0x4c')](handleError(_0x39739e,null));};exports[_0x0fca('0x67')]=function(_0x9bd06a,_0x363ec2,_0x603e28){var _0x5447a3=_0x9bd06a[_0x0fca('0x4f')][_0x0fca('0x68')];return db['Team'][_0x0fca('0x4a')]({'where':{'id':_0x5447a3},'attributes':['id'],'include':[{'model':db[_0x0fca('0x5d')],'as':_0x0fca('0x69'),'attributes':['id','name',_0x0fca('0x6a'),_0x0fca('0x6b'),'interface'],'raw':!![]}]})[_0x0fca('0x29')](function(_0x417907){if(_0x417907){var _0x5259e8=_[_0x0fca('0x6c')](_0x417907,function(_0x4d6c99){var _0x5dcc8b=_0x4d6c99[_0x0fca('0x2a')]({'plain':!![]});return _0x5dcc8b['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x9bd06a['params']['id']}})[_0x0fca('0x29')](function(_0x24585d){return db['sequelize'][_0x0fca('0x6d')](function(_0x1c5ae0){return _0x24585d[_0x0fca('0x67')](_0x5447a3,{'transaction':_0x1c5ae0})['then'](function(){return BPromise['each'](_0x5259e8,function(_0x4d935c){return db[_0x0fca('0x6e')]['findOrCreate']({'where':{'UserId':_0x4d935c['id'],'WhatsappQueueId':_0x9bd06a['params']['id']},'transaction':_0x1c5ae0});});})['then'](function(){_0x5259e8['forEach'](function(_0x2d24da){socket['emit'](_0x0fca('0x6f'),{'UserId':_0x2d24da['id'],'WhatsappQueueId':_0x24585d['id']});});});});});}})[_0x0fca('0x29')](respondWithStatusCode(_0x363ec2,null))[_0x0fca('0x4c')](handleError(_0x363ec2,null));};exports[_0x0fca('0x70')]=function(_0x4f2a80,_0x47eb51,_0x5715b6){return db[_0x0fca('0x71')][_0x0fca('0x4a')]({'where':{'id':_0x4f2a80['query'][_0x0fca('0x68')]},'attributes':['id'],'include':[{'model':db[_0x0fca('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0fca('0x29')](handleEntityNotFound(_0x47eb51,null))[_0x0fca('0x29')](function(_0x14d807){var _0xe600cf=_[_0x0fca('0x31')](_0x14d807,'id');var _0x2d705e=[];var _0x2c49a8=[];var _0x24ca41=squel[_0x0fca('0x72')]();_0x24ca41[_0x0fca('0x73')](_0x0fca('0x74'))[_0x0fca('0x75')]('team_has_whatsapp_queues','tq')[_0x0fca('0x76')]('user_has_teams','ut',_0x0fca('0x77'))[_0x0fca('0x43')](_0x0fca('0x78'),_0x4f2a80['params']['id']);for(var _0x194915=0x0;_0x194915<_0x14d807[_0x0fca('0x3e')];_0x194915+=0x1){let _0x935136=_0x14d807[_0x194915];for(var _0x132873=0x0;_0x132873<_0x935136['Agents'][_0x0fca('0x3e')];_0x132873+=0x1){let _0x484930=_0x935136[_0x0fca('0x69')][_0x132873];var _0x2b5089=_0x24ca41[_0x0fca('0x79')]();_0x2b5089[_0x0fca('0x43')](_0x0fca('0x7a'),_0x484930['id']);_0x2c49a8[_0x0fca('0x7b')](db[_0x0fca('0x7c')][_0x0fca('0x39')](_0x2b5089[_0x0fca('0x7d')](),{'type':db[_0x0fca('0x7c')]['QueryTypes'][_0x0fca('0x7e')]})[_0x0fca('0x29')](function(_0x4a55cb){if(_0x4a55cb['length']===0x1){return _0x484930['id'];}else{var _0x1cab53=_[_0x0fca('0x7f')](_[_0x0fca('0x31')](_0x4a55cb,_0x0fca('0x80')),function(_0x298c81){return _['includes'](_0xe600cf,_0x298c81);});if(_0x1cab53){return _0x484930['id'];}}}));}}return BPromise[_0x0fca('0x81')](_0x2c49a8)[_0x0fca('0x29')](function(_0x56ac74){_0x2d705e=_(_0x2d705e)[_0x0fca('0x82')](_0x56ac74)[_0x0fca('0x83')]()[_0x0fca('0x84')]();return db['WhatsappQueue'][_0x0fca('0x4d')]({'where':{'id':_0x4f2a80[_0x0fca('0x58')]['id']}})[_0x0fca('0x29')](function(_0x291fb8){return db[_0x0fca('0x7c')][_0x0fca('0x6d')](function(_0x20bfd1){return _0x291fb8[_0x0fca('0x70')](_0x4f2a80['query']['ids'],{'transaction':_0x20bfd1})[_0x0fca('0x29')](function(){if(!_[_0x0fca('0x85')](_0x2d705e)){return _0x291fb8[_0x0fca('0x86')](_0x2d705e,{'transaction':_0x20bfd1});}})[_0x0fca('0x29')](function(){_0x2d705e[_0x0fca('0x87')](function(_0xe8ac98){socket[_0x0fca('0x88')](_0x0fca('0x89'),{'UserId':_0xe8ac98,'WhatsappQueueId':_0x291fb8['id']});});});});});});})['then'](respondWithStatusCode(_0x47eb51,null))['catch'](handleError(_0x47eb51,null));};exports[_0x0fca('0x8a')]=function(_0x52fda0,_0x3b780f,_0x28b724){return db[_0x0fca('0x32')][_0x0fca('0x4d')]({'where':{'id':_0x52fda0[_0x0fca('0x58')]['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x3b780f,null))[_0x0fca('0x29')](function(_0x2cc728){if(_0x2cc728){return _0x2cc728['addAgents'](_0x52fda0[_0x0fca('0x4f')][_0x0fca('0x68')],_[_0x0fca('0x8b')](_0x52fda0[_0x0fca('0x4f')],['ids','id'])||{})[_0x0fca('0x8c')](function(_0x34c1c5){for(var _0x13ede3=0x0;_0x13ede3<_0x52fda0['body']['ids']['length'];_0x13ede3+=0x1){socket[_0x0fca('0x88')](_0x0fca('0x6f'),{'UserId':Number(_0x52fda0[_0x0fca('0x4f')]['ids'][_0x13ede3]),'WhatsappQueueId':Number(_0x52fda0[_0x0fca('0x58')]['id'])});}return _0x34c1c5;});}})[_0x0fca('0x29')](respondWithResult(_0x3b780f,null))[_0x0fca('0x4c')](handleError(_0x3b780f,null));};exports[_0x0fca('0x86')]=function(_0x5146f6,_0x322304,_0x3bbe00){return db[_0x0fca('0x32')][_0x0fca('0x4d')]({'where':{'id':_0x5146f6[_0x0fca('0x58')]['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x322304,null))[_0x0fca('0x29')](function(_0x3865c5){if(_0x3865c5){return _0x3865c5[_0x0fca('0x86')](_0x5146f6[_0x0fca('0x39')][_0x0fca('0x68')])[_0x0fca('0x29')](function(){if(_[_0x0fca('0x8d')](_0x5146f6[_0x0fca('0x39')]['ids'])){for(var _0x584a13=0x0;_0x584a13<_0x5146f6['query'][_0x0fca('0x68')]['length'];_0x584a13+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x5146f6[_0x0fca('0x39')]['ids'][_0x584a13]),'WhatsappQueueId':Number(_0x5146f6[_0x0fca('0x58')]['id'])});}}else{socket[_0x0fca('0x88')](_0x0fca('0x89'),{'UserId':Number(_0x5146f6[_0x0fca('0x39')]['ids']),'WhatsappQueueId':Number(_0x5146f6[_0x0fca('0x58')]['id'])});}});}})[_0x0fca('0x29')](respondWithStatusCode(_0x322304,null))['catch'](handleError(_0x322304,null));};exports[_0x0fca('0x8e')]=function(_0xc63711,_0x595e74,_0x24977b){var _0x4949dc={};var _0x51118b={};var _0x135195;var _0x42d551;return db[_0x0fca('0x32')][_0x0fca('0x5a')]({'where':{'id':_0xc63711['params']['id']}})[_0x0fca('0x29')](handleEntityNotFound(_0x595e74,null))[_0x0fca('0x29')](function(_0x566274){if(_0x566274){_0x135195=_0x566274;_0x51118b[_0x0fca('0x37')]=_[_0x0fca('0x38')](db[_0x0fca('0x5d')][_0x0fca('0x33')]);_0x51118b['query']=_[_0x0fca('0x38')](_0xc63711[_0x0fca('0x39')]);_0x51118b[_0x0fca('0x3a')]=_[_0x0fca('0x3b')](_0x51118b[_0x0fca('0x37')],_0x51118b['query']);_0x4949dc['attributes']=_[_0x0fca('0x3b')](_0x51118b[_0x0fca('0x37')],qs[_0x0fca('0x3c')](_0xc63711[_0x0fca('0x39')][_0x0fca('0x3c')]));_0x4949dc[_0x0fca('0x3d')]=_0x4949dc['attributes'][_0x0fca('0x3e')]?_0x4949dc[_0x0fca('0x3d')]:_0x51118b['model'];_0x4949dc[_0x0fca('0x41')]=qs[_0x0fca('0x42')](_0xc63711[_0x0fca('0x39')][_0x0fca('0x42')]);_0x4949dc[_0x0fca('0x43')]=qs[_0x0fca('0x3a')](_['pick'](_0xc63711['query'],_0x51118b[_0x0fca('0x3a')]));if(_0xc63711[_0x0fca('0x39')]['filter']){_0x4949dc[_0x0fca('0x43')]=_[_0x0fca('0x46')](_0x4949dc[_0x0fca('0x43')],{'$or':_[_0x0fca('0x31')](_0x4949dc['attributes'],function(_0x59802b){var _0x3487b7={};_0x3487b7[_0x59802b]={'$like':'%'+_0xc63711[_0x0fca('0x39')]['filter']+'%'};return _0x3487b7;})});}_0x4949dc=_['merge']({},_0x4949dc,_0xc63711[_0x0fca('0x5c')]);return _0x135195[_0x0fca('0x8e')](_0x4949dc);}})[_0x0fca('0x29')](function(_0x84ec24){if(_0x84ec24){_0x42d551=_0x84ec24[_0x0fca('0x3e')];if(!_0xc63711[_0x0fca('0x39')][_0x0fca('0x3f')](_0x0fca('0x40'))){_0x4949dc['limit']=qs[_0x0fca('0x22')](_0xc63711[_0x0fca('0x39')][_0x0fca('0x22')]);_0x4949dc[_0x0fca('0x20')]=qs[_0x0fca('0x20')](_0xc63711[_0x0fca('0x39')][_0x0fca('0x20')]);}return _0x135195['getAgents'](_0x4949dc);}})[_0x0fca('0x29')](function(_0x291e67){if(_0x291e67){return _0x291e67?{'count':_0x42d551,'rows':_0x291e67}:null;}})['then'](respondWithResult(_0x595e74,null))['catch'](handleError(_0x595e74,null));}; \ No newline at end of file +var _0xf52d=['sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','WhatsappQueueId','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Team','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','includes','all','value','isEmpty','removeAgents','addAgents','spread','isArray','userWhatsappQueue:remove','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','offset','count','set','Content-Range','reject','save','update','then','destroy','get','WhatsappQueues','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','limit'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xf52d,0x1e9));var _0xdf52=function(_0x4b73b9,_0x1dea25){_0x4b73b9=_0x4b73b9-0x0;var _0x5caf19=_0xf52d[_0x4b73b9];return _0x5caf19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf52('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdf52('0x1'));var rp=require('request-promise');var moment=require(_0xdf52('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdf52('0x3'));var util=require('util');var path=require(_0xdf52('0x4'));var sox=require(_0xdf52('0x5'));var csv=require(_0xdf52('0x6'));var ejs=require(_0xdf52('0x7'));var fs=require('fs');var fs_extra=require(_0xdf52('0x8'));var _=require(_0xdf52('0x9'));var squel=require(_0xdf52('0xa'));var crypto=require(_0xdf52('0xb'));var jsforce=require(_0xdf52('0xc'));var deskjs=require(_0xdf52('0xd'));var toCsv=require(_0xdf52('0x6'));var querystring=require(_0xdf52('0xe'));var Papa=require(_0xdf52('0xf'));var Redis=require(_0xdf52('0x10'));var authService=require(_0xdf52('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf52('0x12'));var logger=require(_0xdf52('0x13'))(_0xdf52('0x14'));var utils=require(_0xdf52('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdf52('0x16'));var db=require(_0xdf52('0x17'))['db'];config[_0xdf52('0x18')]=_[_0xdf52('0x19')](config[_0xdf52('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf52('0x1a'))(new Redis(config[_0xdf52('0x18')]));require(_0xdf52('0x1b'))[_0xdf52('0x1c')](socket);function respondWithStatusCode(_0x4510db,_0x31c5a8){_0x31c5a8=_0x31c5a8||0xcc;return function(_0x30d870){if(_0x30d870){return _0x4510db[_0xdf52('0x1d')](_0x31c5a8);}return _0x4510db['status'](_0x31c5a8)['end']();};}function respondWithResult(_0x4745b7,_0x1d9ea4){_0x1d9ea4=_0x1d9ea4||0xc8;return function(_0x4d02e9){if(_0x4d02e9){return _0x4745b7[_0xdf52('0x1e')](_0x1d9ea4)[_0xdf52('0x1f')](_0x4d02e9);}};}function respondWithFilteredResult(_0x3c54c8,_0x350b62){return function(_0x389c46){if(_0x389c46){var _0x143bca=typeof _0x350b62['offset']===_0xdf52('0x20')&&typeof _0x350b62['limit']==='undefined';var _0x5e2456=_0x389c46['count'];var _0x2086dd=_0x143bca?0x0:_0x350b62[_0xdf52('0x21')];var _0xdc5571=_0x143bca?_0x389c46[_0xdf52('0x22')]:_0x350b62[_0xdf52('0x21')]+_0x350b62['limit'];var _0x3f184f;if(_0xdc5571>=_0x5e2456){_0xdc5571=_0x5e2456;_0x3f184f=0xc8;}else{_0x3f184f=0xce;}_0x3c54c8[_0xdf52('0x1e')](_0x3f184f);return _0x3c54c8[_0xdf52('0x23')](_0xdf52('0x24'),_0x2086dd+'-'+_0xdc5571+'/'+_0x5e2456)['json'](_0x389c46);}return null;};}function patchUpdates(_0x2f3c7f){return function(_0x416e78){try{jsonpatch['apply'](_0x416e78,_0x2f3c7f,!![]);}catch(_0x24c340){return BPromise[_0xdf52('0x25')](_0x24c340);}return _0x416e78[_0xdf52('0x26')]();};}function saveUpdates(_0x96edac,_0x417724){return function(_0x11671c){if(_0x11671c){return _0x11671c[_0xdf52('0x27')](_0x96edac)[_0xdf52('0x28')](function(_0x4d665e){return _0x4d665e;});}return null;};}function removeEntity(_0x45cea4,_0x4390ff){return function(_0x5b458e){if(_0x5b458e){return _0x5b458e[_0xdf52('0x29')]()[_0xdf52('0x28')](function(){var _0x22f3d2=_0x5b458e[_0xdf52('0x2a')]({'plain':!![]});var _0x37d28d=_0xdf52('0x2b');return db['UserProfileResource'][_0xdf52('0x29')]({'where':{'type':_0x37d28d,'resourceId':_0x22f3d2['id']}})[_0xdf52('0x28')](function(){return _0x5b458e;});})[_0xdf52('0x28')](function(){_0x45cea4[_0xdf52('0x1e')](0xcc)[_0xdf52('0x2c')]();});}};}function handleEntityNotFound(_0x2ccce8,_0x4df699){return function(_0x38ec18){if(!_0x38ec18){_0x2ccce8[_0xdf52('0x1d')](0x194);}return _0x38ec18;};}function handleError(_0x50b4b2,_0x59ba7d){_0x59ba7d=_0x59ba7d||0x1f4;return function(_0x40d6b4){logger[_0xdf52('0x2d')](_0x40d6b4[_0xdf52('0x2e')]);if(_0x40d6b4[_0xdf52('0x2f')]){delete _0x40d6b4[_0xdf52('0x2f')];}_0x50b4b2[_0xdf52('0x1e')](_0x59ba7d)[_0xdf52('0x30')](_0x40d6b4);};}exports[_0xdf52('0x31')]=function(_0x1ea229,_0x1da614){var _0x52c528={},_0x159006={},_0x1022c6={'count':0x0,'rows':[]};var _0x77ad4f=_[_0xdf52('0x32')](db[_0xdf52('0x33')][_0xdf52('0x34')],function(_0x3fbdab){return{'name':_0x3fbdab[_0xdf52('0x35')],'type':_0x3fbdab['type'][_0xdf52('0x36')]};});_0x159006[_0xdf52('0x37')]=_[_0xdf52('0x32')](_0x77ad4f,_0xdf52('0x2f'));_0x159006[_0xdf52('0x38')]=_['keys'](_0x1ea229['query']);_0x159006[_0xdf52('0x39')]=_[_0xdf52('0x3a')](_0x159006[_0xdf52('0x37')],_0x159006[_0xdf52('0x38')]);_0x52c528[_0xdf52('0x3b')]=_[_0xdf52('0x3a')](_0x159006[_0xdf52('0x37')],qs[_0xdf52('0x3c')](_0x1ea229[_0xdf52('0x38')]['fields']));_0x52c528[_0xdf52('0x3b')]=_0x52c528['attributes'][_0xdf52('0x3d')]?_0x52c528['attributes']:_0x159006['model'];if(!_0x1ea229[_0xdf52('0x38')]['hasOwnProperty']('nolimit')){_0x52c528[_0xdf52('0x3e')]=qs[_0xdf52('0x3e')](_0x1ea229[_0xdf52('0x38')][_0xdf52('0x3e')]);_0x52c528['offset']=qs[_0xdf52('0x21')](_0x1ea229[_0xdf52('0x38')]['offset']);}_0x52c528['order']=qs[_0xdf52('0x3f')](_0x1ea229[_0xdf52('0x38')][_0xdf52('0x3f')]);_0x52c528['where']=qs[_0xdf52('0x39')](_[_0xdf52('0x40')](_0x1ea229[_0xdf52('0x38')],_0x159006['filters']),_0x77ad4f);if(_0x1ea229[_0xdf52('0x38')]['filter']){_0x52c528[_0xdf52('0x41')]=_[_0xdf52('0x42')](_0x52c528[_0xdf52('0x41')],{'$or':_[_0xdf52('0x32')](_0x77ad4f,function(_0x27e3f8){if(_0x27e3f8['type']!==_0xdf52('0x43')){var _0x5aa160={};_0x5aa160[_0x27e3f8[_0xdf52('0x2f')]]={'$like':'%'+_0x1ea229[_0xdf52('0x38')][_0xdf52('0x44')]+'%'};return _0x5aa160;}})});}_0x52c528=_[_0xdf52('0x42')]({},_0x52c528,_0x1ea229[_0xdf52('0x45')]);var _0xd7f896={'where':_0x52c528[_0xdf52('0x41')]};return db['WhatsappQueue']['count'](_0xd7f896)[_0xdf52('0x28')](function(_0x40a98d){_0x1022c6['count']=_0x40a98d;if(_0x1ea229[_0xdf52('0x38')]['includeAll']){_0x52c528['include']=[{'all':!![]}];}return db[_0xdf52('0x33')][_0xdf52('0x46')](_0x52c528);})[_0xdf52('0x28')](function(_0x1663b){_0x1022c6[_0xdf52('0x47')]=_0x1663b;return _0x1022c6;})[_0xdf52('0x28')](respondWithFilteredResult(_0x1da614,_0x52c528))[_0xdf52('0x48')](handleError(_0x1da614,null));};exports[_0xdf52('0x49')]=function(_0x2b909d,_0x18381a){var _0x17461f={'raw':!![],'where':{'id':_0x2b909d[_0xdf52('0x4a')]['id']}},_0xe7c5ad={};_0xe7c5ad['model']=_[_0xdf52('0x4b')](db['WhatsappQueue'][_0xdf52('0x34')]);_0xe7c5ad[_0xdf52('0x38')]=_[_0xdf52('0x4b')](_0x2b909d[_0xdf52('0x38')]);_0xe7c5ad['filters']=_[_0xdf52('0x3a')](_0xe7c5ad[_0xdf52('0x37')],_0xe7c5ad[_0xdf52('0x38')]);_0x17461f['attributes']=_['intersection'](_0xe7c5ad['model'],qs[_0xdf52('0x3c')](_0x2b909d[_0xdf52('0x38')][_0xdf52('0x3c')]));_0x17461f['attributes']=_0x17461f['attributes'][_0xdf52('0x3d')]?_0x17461f[_0xdf52('0x3b')]:_0xe7c5ad[_0xdf52('0x37')];if(_0x2b909d[_0xdf52('0x38')][_0xdf52('0x4c')]){_0x17461f['include']=[{'all':!![]}];}_0x17461f=_[_0xdf52('0x42')]({},_0x17461f,_0x2b909d[_0xdf52('0x45')]);return db[_0xdf52('0x33')][_0xdf52('0x4d')](_0x17461f)[_0xdf52('0x28')](handleEntityNotFound(_0x18381a,null))[_0xdf52('0x28')](respondWithResult(_0x18381a,null))['catch'](handleError(_0x18381a,null));};exports['create']=function(_0x32901c,_0x4eb777){return db[_0xdf52('0x33')]['create'](_0x32901c[_0xdf52('0x4e')],{})[_0xdf52('0x28')](function(_0x361f42){var _0x56a60f=_0x32901c[_0xdf52('0x4f')][_0xdf52('0x2a')]({'plain':!![]});if(!_0x56a60f)throw new Error(_0xdf52('0x50'));if(_0x56a60f[_0xdf52('0x51')]===_0xdf52('0x4f')){var _0x2b8329=_0x361f42[_0xdf52('0x2a')]({'plain':!![]});var _0x1c0f58='WhatsappQueues';return db[_0xdf52('0x52')][_0xdf52('0x4d')]({'where':{'name':_0x1c0f58,'userProfileId':_0x56a60f['userProfileId']},'raw':!![]})[_0xdf52('0x28')](function(_0x2b9b15){if(_0x2b9b15&&_0x2b9b15[_0xdf52('0x53')]===0x0){return db[_0xdf52('0x54')][_0xdf52('0x55')]({'name':_0x2b8329[_0xdf52('0x2f')],'resourceId':_0x2b8329['id'],'type':_0x2b9b15[_0xdf52('0x2f')],'sectionId':_0x2b9b15['id']},{})[_0xdf52('0x28')](function(){return _0x361f42;});}else{return _0x361f42;}})[_0xdf52('0x48')](function(_0x76513f){logger[_0xdf52('0x2d')](_0xdf52('0x56'),_0x76513f);throw _0x76513f;});}return _0x361f42;})[_0xdf52('0x28')](respondWithResult(_0x4eb777,0xc9))[_0xdf52('0x48')](handleError(_0x4eb777,null));};exports['update']=function(_0x3f3b15,_0x368343){if(_0x3f3b15[_0xdf52('0x4e')]['id']){delete _0x3f3b15['body']['id'];}return db[_0xdf52('0x33')]['find']({'where':{'id':_0x3f3b15[_0xdf52('0x4a')]['id']}})['then'](handleEntityNotFound(_0x368343,null))['then'](saveUpdates(_0x3f3b15[_0xdf52('0x4e')],null))['then'](respondWithResult(_0x368343,null))[_0xdf52('0x48')](handleError(_0x368343,null));};exports[_0xdf52('0x29')]=function(_0x371682,_0x437855){return db[_0xdf52('0x33')][_0xdf52('0x4d')]({'where':{'id':_0x371682[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x437855,null))[_0xdf52('0x28')](removeEntity(_0x437855,null))['catch'](handleError(_0x437855,null));};exports['describe']=function(_0x23f2e6,_0xee625d){return db[_0xdf52('0x33')][_0xdf52('0x57')]()[_0xdf52('0x28')](respondWithResult(_0xee625d,null))[_0xdf52('0x48')](handleError(_0xee625d,null));};exports[_0xdf52('0x58')]=function(_0x27c668,_0x4113a7,_0x579372){var _0xe627f7={'raw':!![],'where':{}},_0x53a86c={},_0x81a6a1;return db[_0xdf52('0x33')][_0xdf52('0x59')]({'where':{'id':_0x27c668[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x4113a7,null))['then'](function(_0x50a505){if(_0x50a505){_0x81a6a1=_0x50a505['get']({'plain':!![]});_0x53a86c[_0xdf52('0x37')]=_[_0xdf52('0x4b')](db[_0xdf52('0x5a')]['rawAttributes']);_0x53a86c[_0xdf52('0x38')]=_[_0xdf52('0x4b')](_0x27c668[_0xdf52('0x38')]);_0x53a86c[_0xdf52('0x39')]=_['intersection'](_0x53a86c['model'],_0x53a86c[_0xdf52('0x38')]);_0xe627f7[_0xdf52('0x3b')]=_[_0xdf52('0x3a')](_0x53a86c[_0xdf52('0x37')],qs['fields'](_0x27c668[_0xdf52('0x38')]['fields']));_0xe627f7[_0xdf52('0x3b')]=_0xe627f7[_0xdf52('0x3b')][_0xdf52('0x3d')]?_0xe627f7[_0xdf52('0x3b')]:_0x53a86c[_0xdf52('0x37')];if(!_0x27c668['query'][_0xdf52('0x5b')](_0xdf52('0x5c'))){_0xe627f7['limit']=qs[_0xdf52('0x3e')](_0x27c668['query']['limit']);_0xe627f7['offset']=qs[_0xdf52('0x21')](_0x27c668[_0xdf52('0x38')][_0xdf52('0x21')]);}_0xe627f7[_0xdf52('0x5d')]=qs[_0xdf52('0x3f')](_0x27c668[_0xdf52('0x38')][_0xdf52('0x3f')]);_0xe627f7['where']=qs[_0xdf52('0x39')](_['pick'](_0x27c668[_0xdf52('0x38')],_0x53a86c[_0xdf52('0x39')]));_0xe627f7[_0xdf52('0x41')][_0xdf52('0x5e')]=_0x50a505['id'];if(_0x27c668[_0xdf52('0x38')][_0xdf52('0x44')]){_0xe627f7['where']=_[_0xdf52('0x42')](_0xe627f7[_0xdf52('0x41')],{'$or':_[_0xdf52('0x32')](_0xe627f7[_0xdf52('0x3b')],function(_0x35e404){var _0x1782e9={};_0x1782e9[_0x35e404]={'$like':'%'+_0x27c668[_0xdf52('0x38')][_0xdf52('0x44')]+'%'};return _0x1782e9;})});}_0xe627f7=_[_0xdf52('0x42')]({},_0xe627f7,_0x27c668['options']);return db['UserWhatsappQueue'][_0xdf52('0x46')](_0xe627f7);}})['then'](function(_0x1daa2e){if(_0x1daa2e){return db[_0xdf52('0x5f')][_0xdf52('0x60')]({'where':{'id':_['map'](_0x1daa2e,_0xdf52('0x61')),'role':'agent'},'attributes':['id',_0xdf52('0x2f'),_0xdf52('0x62'),_0xdf52('0x63'),_0xdf52('0x64')]});}})[_0xdf52('0x28')](function(_0x209b3e){if(_0x209b3e){return{'count':_0x209b3e[_0xdf52('0x22')],'rows':_['map'](_0x209b3e[_0xdf52('0x47')],function(_0x1ef851){return{'membername':_0x1ef851[_0xdf52('0x2f')],'UserId':_0x1ef851['id'],'queue_name':_0x81a6a1[_0xdf52('0x2f')],'WhatsappQueueId':_0x81a6a1['id'],'interface':util['format'](_0xdf52('0x65'),_0xdf52('0x66'),_0x1ef851[_0xdf52('0x2f')]),'penalty':0x0,'paused':_0x1ef851[_0xdf52('0x62')],'createdAt':_0x1ef851['createdAt'],'updatedAt':_0x1ef851['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xdf52('0x28')](respondWithFilteredResult(_0x4113a7,_0xe627f7))[_0xdf52('0x48')](handleError(_0x4113a7,null));};exports[_0xdf52('0x67')]=function(_0x22be5d,_0x17107d,_0x51a5b5){var _0x2fe32c={};var _0x263be3={};var _0x5b08de;var _0x55452e;return db['WhatsappQueue'][_0xdf52('0x59')]({'where':{'id':_0x22be5d[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x17107d,null))[_0xdf52('0x28')](function(_0x72b09b){if(_0x72b09b){_0x5b08de=_0x72b09b;_0x263be3['model']=_[_0xdf52('0x4b')](db['Team'][_0xdf52('0x34')]);_0x263be3['query']=_[_0xdf52('0x4b')](_0x22be5d['query']);_0x263be3['filters']=_[_0xdf52('0x3a')](_0x263be3[_0xdf52('0x37')],_0x263be3[_0xdf52('0x38')]);_0x2fe32c[_0xdf52('0x3b')]=_[_0xdf52('0x3a')](_0x263be3[_0xdf52('0x37')],qs[_0xdf52('0x3c')](_0x22be5d['query'][_0xdf52('0x3c')]));_0x2fe32c['attributes']=_0x2fe32c[_0xdf52('0x3b')][_0xdf52('0x3d')]?_0x2fe32c[_0xdf52('0x3b')]:_0x263be3[_0xdf52('0x37')];_0x2fe32c[_0xdf52('0x5d')]=qs['sort'](_0x22be5d[_0xdf52('0x38')]['sort']);_0x2fe32c[_0xdf52('0x41')]=qs[_0xdf52('0x39')](_[_0xdf52('0x40')](_0x22be5d[_0xdf52('0x38')],_0x263be3['filters']));if(_0x22be5d[_0xdf52('0x38')][_0xdf52('0x44')]){_0x2fe32c[_0xdf52('0x41')]=_[_0xdf52('0x42')](_0x2fe32c[_0xdf52('0x41')],{'$or':_[_0xdf52('0x32')](_0x2fe32c[_0xdf52('0x3b')],function(_0x4eb964){var _0x3bcae9={};_0x3bcae9[_0x4eb964]={'$like':'%'+_0x22be5d[_0xdf52('0x38')][_0xdf52('0x44')]+'%'};return _0x3bcae9;})});}_0x2fe32c=_[_0xdf52('0x42')]({},_0x2fe32c,_0x22be5d[_0xdf52('0x45')]);return _0x5b08de['getTeams'](_0x2fe32c);}})[_0xdf52('0x28')](function(_0x445691){if(_0x445691){_0x55452e=_0x445691[_0xdf52('0x3d')];if(!_0x22be5d[_0xdf52('0x38')][_0xdf52('0x5b')]('nolimit')){_0x2fe32c['limit']=qs[_0xdf52('0x3e')](_0x22be5d[_0xdf52('0x38')][_0xdf52('0x3e')]);_0x2fe32c[_0xdf52('0x21')]=qs['offset'](_0x22be5d[_0xdf52('0x38')][_0xdf52('0x21')]);}return _0x5b08de[_0xdf52('0x67')](_0x2fe32c);}})[_0xdf52('0x28')](function(_0x454fba){if(_0x454fba){return _0x454fba?{'count':_0x55452e,'rows':_0x454fba}:null;}})[_0xdf52('0x28')](respondWithResult(_0x17107d,null))[_0xdf52('0x48')](handleError(_0x17107d,null));};exports[_0xdf52('0x68')]=function(_0x5d918e,_0x46f080,_0x32b9a9){var _0x3e804c=_0x5d918e['body'][_0xdf52('0x69')];return db['Team']['findAll']({'where':{'id':_0x3e804c},'attributes':['id'],'include':[{'model':db[_0xdf52('0x5f')],'as':_0xdf52('0x6a'),'attributes':['id','name',_0xdf52('0x6b'),_0xdf52('0x6c'),'interface'],'raw':!![]}]})[_0xdf52('0x28')](function(_0x322138){if(_0x322138){var _0xb0b257=_[_0xdf52('0x6d')](_0x322138,function(_0x1608fb){var _0x1ab5c1=_0x1608fb[_0xdf52('0x2a')]({'plain':!![]});return _0x1ab5c1[_0xdf52('0x6a')];});return db[_0xdf52('0x33')]['find']({'where':{'id':_0x5d918e[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](function(_0x480e36){return db[_0xdf52('0x6e')][_0xdf52('0x6f')](function(_0x22736f){return _0x480e36[_0xdf52('0x68')](_0x3e804c,{'transaction':_0x22736f})[_0xdf52('0x28')](function(){return BPromise['each'](_0xb0b257,function(_0x5e6884){return db['UserWhatsappQueue'][_0xdf52('0x70')]({'where':{'UserId':_0x5e6884['id'],'WhatsappQueueId':_0x5d918e[_0xdf52('0x4a')]['id']},'transaction':_0x22736f});});})[_0xdf52('0x28')](function(){_0xb0b257[_0xdf52('0x71')](function(_0x1bd1db){socket[_0xdf52('0x72')](_0xdf52('0x73'),{'UserId':_0x1bd1db['id'],'WhatsappQueueId':_0x480e36['id']});});});});});}})[_0xdf52('0x28')](respondWithStatusCode(_0x46f080,null))['catch'](handleError(_0x46f080,null));};exports[_0xdf52('0x74')]=function(_0x1fb0b5,_0x1fa31e,_0x432598){return db[_0xdf52('0x75')][_0xdf52('0x46')]({'where':{'id':_0x1fb0b5[_0xdf52('0x38')][_0xdf52('0x69')]},'attributes':['id'],'include':[{'model':db[_0xdf52('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xdf52('0x28')](handleEntityNotFound(_0x1fa31e,null))['then'](function(_0x35edf0){var _0x3bb340=_[_0xdf52('0x32')](_0x35edf0,'id');var _0x3130e2=[];var _0x18e403=[];var _0x36ed27=squel['select']();_0x36ed27['field'](_0xdf52('0x76'))[_0xdf52('0x77')]('team_has_whatsapp_queues','tq')[_0xdf52('0x78')](_0xdf52('0x79'),'ut',_0xdf52('0x7a'))['where'](_0xdf52('0x7b'),_0x1fb0b5[_0xdf52('0x4a')]['id']);for(var _0x1644b4=0x0;_0x1644b4<_0x35edf0[_0xdf52('0x3d')];_0x1644b4+=0x1){let _0x17001a=_0x35edf0[_0x1644b4];for(var _0x2ea252=0x0;_0x2ea252<_0x17001a[_0xdf52('0x6a')][_0xdf52('0x3d')];_0x2ea252+=0x1){let _0x132657=_0x17001a[_0xdf52('0x6a')][_0x2ea252];var _0x1acab2=_0x36ed27[_0xdf52('0x7c')]();_0x1acab2['where'](_0xdf52('0x7d'),_0x132657['id']);_0x18e403[_0xdf52('0x7e')](db[_0xdf52('0x6e')][_0xdf52('0x38')](_0x1acab2[_0xdf52('0x7f')](),{'type':db[_0xdf52('0x6e')]['QueryTypes']['SELECT']})['then'](function(_0xe09b74){if(_0xe09b74['length']===0x1){return _0x132657['id'];}else{var _0x23ad44=_[_0xdf52('0x80')](_[_0xdf52('0x32')](_0xe09b74,'TeamId'),function(_0x15a3f6){return _[_0xdf52('0x81')](_0x3bb340,_0x15a3f6);});if(_0x23ad44){return _0x132657['id'];}}}));}}return BPromise[_0xdf52('0x82')](_0x18e403)[_0xdf52('0x28')](function(_0x5170ed){_0x3130e2=_(_0x3130e2)['union'](_0x5170ed)['compact']()[_0xdf52('0x83')]();return db['WhatsappQueue'][_0xdf52('0x4d')]({'where':{'id':_0x1fb0b5[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](function(_0x1c978a){return db[_0xdf52('0x6e')][_0xdf52('0x6f')](function(_0x536835){return _0x1c978a[_0xdf52('0x74')](_0x1fb0b5[_0xdf52('0x38')][_0xdf52('0x69')],{'transaction':_0x536835})['then'](function(){if(!_[_0xdf52('0x84')](_0x3130e2)){return _0x1c978a[_0xdf52('0x85')](_0x3130e2,{'transaction':_0x536835});}})['then'](function(){_0x3130e2[_0xdf52('0x71')](function(_0x4b8ceb){socket[_0xdf52('0x72')]('userWhatsappQueue:remove',{'UserId':_0x4b8ceb,'WhatsappQueueId':_0x1c978a['id']});});});});});});})[_0xdf52('0x28')](respondWithStatusCode(_0x1fa31e,null))[_0xdf52('0x48')](handleError(_0x1fa31e,null));};exports[_0xdf52('0x86')]=function(_0x4c7bff,_0x4069fe,_0x1d7d3e){return db['WhatsappQueue'][_0xdf52('0x4d')]({'where':{'id':_0x4c7bff[_0xdf52('0x4a')]['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x4069fe,null))[_0xdf52('0x28')](function(_0x31f666){if(_0x31f666){return _0x31f666[_0xdf52('0x86')](_0x4c7bff[_0xdf52('0x4e')][_0xdf52('0x69')],_['omit'](_0x4c7bff[_0xdf52('0x4e')],[_0xdf52('0x69'),'id'])||{})[_0xdf52('0x87')](function(_0x5f3d77){for(var _0x46d34e=0x0;_0x46d34e<_0x4c7bff[_0xdf52('0x4e')][_0xdf52('0x69')][_0xdf52('0x3d')];_0x46d34e+=0x1){socket[_0xdf52('0x72')](_0xdf52('0x73'),{'UserId':Number(_0x4c7bff[_0xdf52('0x4e')][_0xdf52('0x69')][_0x46d34e]),'WhatsappQueueId':Number(_0x4c7bff[_0xdf52('0x4a')]['id'])});}return _0x5f3d77;});}})[_0xdf52('0x28')](respondWithResult(_0x4069fe,null))[_0xdf52('0x48')](handleError(_0x4069fe,null));};exports[_0xdf52('0x85')]=function(_0x4fb43c,_0x3812e3,_0x25a7c3){return db[_0xdf52('0x33')]['find']({'where':{'id':_0x4fb43c['params']['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x3812e3,null))['then'](function(_0x58d18f){if(_0x58d18f){return _0x58d18f[_0xdf52('0x85')](_0x4fb43c[_0xdf52('0x38')][_0xdf52('0x69')])['then'](function(){if(_[_0xdf52('0x88')](_0x4fb43c[_0xdf52('0x38')][_0xdf52('0x69')])){for(var _0x518a2e=0x0;_0x518a2e<_0x4fb43c[_0xdf52('0x38')][_0xdf52('0x69')][_0xdf52('0x3d')];_0x518a2e+=0x1){socket[_0xdf52('0x72')](_0xdf52('0x89'),{'UserId':Number(_0x4fb43c[_0xdf52('0x38')][_0xdf52('0x69')][_0x518a2e]),'WhatsappQueueId':Number(_0x4fb43c['params']['id'])});}}else{socket[_0xdf52('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x4fb43c[_0xdf52('0x38')][_0xdf52('0x69')]),'WhatsappQueueId':Number(_0x4fb43c[_0xdf52('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3812e3,null))[_0xdf52('0x48')](handleError(_0x3812e3,null));};exports['getAgents']=function(_0x34908f,_0x10c483,_0x533fb5){var _0x58de70={};var _0x13235a={};var _0x2825ec;var _0x4fb6b8;return db[_0xdf52('0x33')]['findOne']({'where':{'id':_0x34908f['params']['id']}})[_0xdf52('0x28')](handleEntityNotFound(_0x10c483,null))[_0xdf52('0x28')](function(_0x43eb4b){if(_0x43eb4b){_0x2825ec=_0x43eb4b;_0x13235a['model']=_[_0xdf52('0x4b')](db[_0xdf52('0x5f')][_0xdf52('0x34')]);_0x13235a['query']=_['keys'](_0x34908f[_0xdf52('0x38')]);_0x13235a[_0xdf52('0x39')]=_[_0xdf52('0x3a')](_0x13235a[_0xdf52('0x37')],_0x13235a['query']);_0x58de70[_0xdf52('0x3b')]=_[_0xdf52('0x3a')](_0x13235a[_0xdf52('0x37')],qs[_0xdf52('0x3c')](_0x34908f[_0xdf52('0x38')][_0xdf52('0x3c')]));_0x58de70['attributes']=_0x58de70[_0xdf52('0x3b')]['length']?_0x58de70['attributes']:_0x13235a[_0xdf52('0x37')];_0x58de70[_0xdf52('0x5d')]=qs['sort'](_0x34908f[_0xdf52('0x38')][_0xdf52('0x3f')]);_0x58de70[_0xdf52('0x41')]=qs['filters'](_[_0xdf52('0x40')](_0x34908f[_0xdf52('0x38')],_0x13235a[_0xdf52('0x39')]));if(_0x34908f[_0xdf52('0x38')][_0xdf52('0x44')]){_0x58de70[_0xdf52('0x41')]=_[_0xdf52('0x42')](_0x58de70[_0xdf52('0x41')],{'$or':_[_0xdf52('0x32')](_0x58de70[_0xdf52('0x3b')],function(_0x65b03e){var _0x5e267a={};_0x5e267a[_0x65b03e]={'$like':'%'+_0x34908f[_0xdf52('0x38')][_0xdf52('0x44')]+'%'};return _0x5e267a;})});}_0x58de70=_[_0xdf52('0x42')]({},_0x58de70,_0x34908f[_0xdf52('0x45')]);return _0x2825ec['getAgents'](_0x58de70);}})['then'](function(_0x5a15cf){if(_0x5a15cf){_0x4fb6b8=_0x5a15cf[_0xdf52('0x3d')];if(!_0x34908f[_0xdf52('0x38')][_0xdf52('0x5b')](_0xdf52('0x5c'))){_0x58de70[_0xdf52('0x3e')]=qs['limit'](_0x34908f[_0xdf52('0x38')][_0xdf52('0x3e')]);_0x58de70[_0xdf52('0x21')]=qs[_0xdf52('0x21')](_0x34908f['query'][_0xdf52('0x21')]);}return _0x2825ec['getAgents'](_0x58de70);}})[_0xdf52('0x28')](function(_0x5552da){if(_0x5552da){return _0x5552da?{'count':_0x4fb6b8,'rows':_0x5552da}:null;}})[_0xdf52('0x28')](respondWithResult(_0x10c483,null))[_0xdf52('0x48')](handleError(_0x10c483,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d3d5ba6..666f135 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 _0x9d18=['events','../../mysqldb','WhatsappQueue','update','emit','hasOwnProperty','hook','exports'];(function(_0x4f1e9c,_0x3e6518){var _0x11ee26=function(_0x112bd4){while(--_0x112bd4){_0x4f1e9c['push'](_0x4f1e9c['shift']());}};_0x11ee26(++_0x3e6518);}(_0x9d18,0x138));var _0x89d1=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0x9d18[_0x5a47de];return _0x400ee6;};'use strict';var EventEmitter=require(_0x89d1('0x0'));var WhatsappQueue=require(_0x89d1('0x1'))['db'][_0x89d1('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x89d1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x473854){return function(_0x26a778,_0x30d668,_0x15a819){WhatsappQueueEvents[_0x89d1('0x4')](_0x473854+':'+_0x26a778['id'],_0x26a778);WhatsappQueueEvents[_0x89d1('0x4')](_0x473854,_0x26a778);_0x15a819(null);};}for(var e in events){if(events[_0x89d1('0x5')](e)){var event=events[e];WhatsappQueue[_0x89d1('0x6')](e,emitEvent(event));}}module[_0x89d1('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa2bb=['WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4b8b2b,_0x5baf28){var _0x1a9408=function(_0x567920){while(--_0x567920){_0x4b8b2b['push'](_0x4b8b2b['shift']());}};_0x1a9408(++_0x5baf28);}(_0xa2bb,0x17a));var _0xba2b=function(_0x5c133e,_0x237af1){_0x5c133e=_0x5c133e-0x0;var _0x43056d=_0xa2bb[_0x5c133e];return _0x43056d;};'use strict';var EventEmitter=require(_0xba2b('0x0'));var WhatsappQueue=require(_0xba2b('0x1'))['db'][_0xba2b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xba2b('0x3')](0x0);var events={'afterCreate':_0xba2b('0x4'),'afterUpdate':_0xba2b('0x5'),'afterDestroy':'remove'};function emitEvent(_0xbb8827){return function(_0x4b29e3,_0x1df5aa,_0x34f6a7){WhatsappQueueEvents[_0xba2b('0x6')](_0xbb8827+':'+_0x4b29e3['id'],_0x4b29e3);WhatsappQueueEvents[_0xba2b('0x6')](_0xbb8827,_0x4b29e3);_0x34f6a7(null);};}for(var e in events){if(events[_0xba2b('0x7')](e)){var event=events[e];WhatsappQueue[_0xba2b('0x8')](e,emitEvent(event));}}module[_0xba2b('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 412ae62..831ba6f 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 _0x076a=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x076a,0x146));var _0xa076=function(_0x3ae38e,_0x3aaa14){_0x3ae38e=_0x3ae38e-0x0;var _0x483595=_0x076a[_0x3ae38e];return _0x483595;};'use strict';var _=require(_0xa076('0x0'));var util=require(_0xa076('0x1'));var logger=require(_0xa076('0x2'))(_0xa076('0x3'));var moment=require(_0xa076('0x4'));var BPromise=require('bluebird');var rp=require(_0xa076('0x5'));var fs=require('fs');var path=require(_0xa076('0x6'));var rimraf=require(_0xa076('0x7'));var config=require(_0xa076('0x8'));var attributes=require(_0xa076('0x9'));module[_0xa076('0xa')]=function(_0x34cd95,_0x31bfd8){return _0x34cd95[_0xa076('0xb')](_0xa076('0xc'),attributes,{'tableName':_0xa076('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe95a=['path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b506f,_0x36349a){var _0x350cfa=function(_0x4a8012){while(--_0x4a8012){_0x1b506f['push'](_0x1b506f['shift']());}};_0x350cfa(++_0x36349a);}(_0xe95a,0x149));var _0xae95=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe95a[_0xa8883];return _0x479426;};'use strict';var _=require(_0xae95('0x0'));var util=require(_0xae95('0x1'));var logger=require(_0xae95('0x2'))(_0xae95('0x3'));var moment=require(_0xae95('0x4'));var BPromise=require(_0xae95('0x5'));var rp=require(_0xae95('0x6'));var fs=require('fs');var path=require(_0xae95('0x7'));var rimraf=require(_0xae95('0x8'));var config=require(_0xae95('0x9'));var attributes=require('./whatsappQueue.attributes');module[_0xae95('0xa')]=function(_0x541c53,_0x65f722){return _0x541c53[_0xae95('0xb')](_0xae95('0xc'),attributes,{'tableName':_0xae95('0xd'),'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 2b1d176..c823369 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 _0xc5d5=['ShowWhatsappQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','info','result','message','catch','GetWhatsappQueue','findAll','options','attributes','limit','include','map','model','then','raw'];(function(_0x34501b,_0x264e47){var _0xdcbacd=function(_0x47bfbe){while(--_0x47bfbe){_0x34501b['push'](_0x34501b['shift']());}};_0xdcbacd(++_0x264e47);}(_0xc5d5,0x99));var _0x5c5d=function(_0x3d5acc,_0x6c2701){_0x3d5acc=_0x3d5acc-0x0;var _0x490393=_0xc5d5[_0x3d5acc];return _0x490393;};'use strict';var _=require(_0x5c5d('0x0'));var util=require(_0x5c5d('0x1'));var moment=require(_0x5c5d('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c5d('0x3'));var fs=require('fs');var Redis=require(_0x5c5d('0x4'));var db=require(_0x5c5d('0x5'))['db'];var utils=require(_0x5c5d('0x6'));var logger=require(_0x5c5d('0x7'))('rpc');var config=require(_0x5c5d('0x8'));var jayson=require(_0x5c5d('0x9'));var client=jayson[_0x5c5d('0xa')][_0x5c5d('0xb')]({'port':0x232a});config[_0x5c5d('0xc')]=_[_0x5c5d('0xd')](config[_0x5c5d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c5d('0xe'))(new Redis(config[_0x5c5d('0xc')]));require(_0x5c5d('0xf'))[_0x5c5d('0x10')](socket);function respondWithRpcPromise(_0x492742,_0x1e09c6,_0x2444ca){return new BPromise(function(_0x1d8559,_0x4e7b36){return client['request'](_0x492742,_0x2444ca)['then'](function(_0x383546){logger['info'](_0x5c5d('0x11'),_0x1e09c6,_0x5c5d('0x12'));logger[_0x5c5d('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1e09c6,_0x5c5d('0x12'),JSON[_0x5c5d('0x14')](_0x383546));if(_0x383546[_0x5c5d('0x15')]){if(_0x383546[_0x5c5d('0x15')][_0x5c5d('0x16')]===0x1f4){logger[_0x5c5d('0x15')](_0x5c5d('0x11'),_0x1e09c6,_0x383546[_0x5c5d('0x15')]['message']);return _0x4e7b36(_0x383546[_0x5c5d('0x15')]['message']);}logger[_0x5c5d('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x1e09c6,_0x383546[_0x5c5d('0x15')]['message']);return _0x1d8559(_0x383546[_0x5c5d('0x15')]['message']);}else{logger[_0x5c5d('0x17')](_0x5c5d('0x11'),_0x1e09c6,'request\x20sent');_0x1d8559(_0x383546[_0x5c5d('0x18')][_0x5c5d('0x19')]);}})[_0x5c5d('0x1a')](function(_0x212faa){logger[_0x5c5d('0x15')](_0x5c5d('0x11'),_0x1e09c6,_0x212faa);_0x4e7b36(_0x212faa);});});}exports[_0x5c5d('0x1b')]=function(_0x183030){var _0xfe9333=this;return new Promise(function(_0x3dfdc9,_0x53d20c){return db['WhatsappQueue'][_0x5c5d('0x1c')]({'raw':_0x183030[_0x5c5d('0x1d')]?_0x183030[_0x5c5d('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x183030[_0x5c5d('0x1d')]?_0x183030[_0x5c5d('0x1d')]['where']||null:null,'attributes':_0x183030[_0x5c5d('0x1d')]?_0x183030[_0x5c5d('0x1d')][_0x5c5d('0x1e')]||null:null,'limit':_0x183030[_0x5c5d('0x1d')]?_0x183030[_0x5c5d('0x1d')][_0x5c5d('0x1f')]||null:null,'include':_0x183030[_0x5c5d('0x1d')]?_0x183030[_0x5c5d('0x1d')][_0x5c5d('0x20')]?_[_0x5c5d('0x21')](_0x183030[_0x5c5d('0x1d')][_0x5c5d('0x20')],function(_0xf74577){return{'model':db[_0xf74577[_0x5c5d('0x22')]],'as':_0xf74577['as'],'attributes':_0xf74577[_0x5c5d('0x1e')],'include':_0xf74577['include']?_['map'](_0xf74577[_0x5c5d('0x20')],function(_0x4e1d76){return{'model':db[_0x4e1d76[_0x5c5d('0x22')]],'as':_0x4e1d76['as'],'attributes':_0x4e1d76[_0x5c5d('0x1e')],'include':_0x4e1d76[_0x5c5d('0x20')]?_['map'](_0x4e1d76[_0x5c5d('0x20')],function(_0x5df135){return{'model':db[_0x5df135[_0x5c5d('0x22')]],'as':_0x5df135['as'],'attributes':_0x5df135[_0x5c5d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c5d('0x23')](function(_0x3e90e0){logger['info'](_0x5c5d('0x1b'),_0x183030);logger[_0x5c5d('0x13')](_0x5c5d('0x1b'),_0x183030,JSON['stringify'](_0x3e90e0));_0x3dfdc9(_0x3e90e0);})['catch'](function(_0x2b9aea){logger[_0x5c5d('0x15')](_0x5c5d('0x1b'),_0x2b9aea['message'],_0x183030);_0x53d20c(_0xfe9333[_0x5c5d('0x15')](0x1f4,_0x2b9aea['message']));});});};exports['ShowWhatsappQueue']=function(_0x3569ef){var _0x215df3=this;return new Promise(function(_0x4f289f,_0x528cee){return db['WhatsappQueue']['find']({'raw':_0x3569ef[_0x5c5d('0x1d')]?_0x3569ef['options'][_0x5c5d('0x24')]===undefined?!![]:![]:!![],'where':_0x3569ef['options']?_0x3569ef[_0x5c5d('0x1d')]['where']||null:null,'attributes':_0x3569ef['options']?_0x3569ef[_0x5c5d('0x1d')][_0x5c5d('0x1e')]||null:null,'include':_0x3569ef['options']?_0x3569ef['options'][_0x5c5d('0x20')]?_[_0x5c5d('0x21')](_0x3569ef[_0x5c5d('0x1d')][_0x5c5d('0x20')],function(_0x4696ba){return{'model':db[_0x4696ba[_0x5c5d('0x22')]],'as':_0x4696ba['as'],'attributes':_0x4696ba[_0x5c5d('0x1e')],'include':_0x4696ba[_0x5c5d('0x20')]?_[_0x5c5d('0x21')](_0x4696ba[_0x5c5d('0x20')],function(_0x1ff0a4){return{'model':db[_0x1ff0a4[_0x5c5d('0x22')]],'as':_0x1ff0a4['as'],'attributes':_0x1ff0a4['attributes'],'include':_0x1ff0a4[_0x5c5d('0x20')]?_[_0x5c5d('0x21')](_0x1ff0a4[_0x5c5d('0x20')],function(_0x25645c){return{'model':db[_0x25645c[_0x5c5d('0x22')]],'as':_0x25645c['as'],'attributes':_0x25645c[_0x5c5d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5c5d('0x23')](function(_0x4906bc){logger[_0x5c5d('0x17')]('ShowWhatsappQueue',_0x3569ef);logger[_0x5c5d('0x13')](_0x5c5d('0x25'),_0x3569ef,JSON[_0x5c5d('0x14')](_0x4906bc));_0x4f289f(_0x4906bc);})[_0x5c5d('0x1a')](function(_0x453ac4){logger[_0x5c5d('0x15')](_0x5c5d('0x25'),_0x453ac4['message'],_0x3569ef);_0x528cee(_0x215df3[_0x5c5d('0x15')](0x1f4,_0x453ac4['message']));});});}; \ No newline at end of file +var _0x5938=['WhatsappQueue','options','where','attributes','limit','include','map','model','debug','ShowWhatsappQueue','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetWhatsappQueue'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x5938,0x172));var _0x8593=function(_0x2dc044,_0x4bdf2d){_0x2dc044=_0x2dc044-0x0;var _0x2398cf=_0x5938[_0x2dc044];return _0x2398cf;};'use strict';var _=require(_0x8593('0x0'));var util=require('util');var moment=require(_0x8593('0x1'));var BPromise=require(_0x8593('0x2'));var rs=require(_0x8593('0x3'));var fs=require('fs');var Redis=require(_0x8593('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8593('0x5'))(_0x8593('0x6'));var config=require(_0x8593('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8593('0x8')]({'port':0x232a});config[_0x8593('0x9')]=_[_0x8593('0xa')](config[_0x8593('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8593('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x8593('0xc')](socket);function respondWithRpcPromise(_0x238f60,_0x4238b4,_0x233544){return new BPromise(function(_0x17f614,_0x5735af){return client[_0x8593('0xd')](_0x238f60,_0x233544)[_0x8593('0xe')](function(_0x89a934){logger[_0x8593('0xf')](_0x8593('0x10'),_0x4238b4,'request\x20sent');logger['debug'](_0x8593('0x11'),_0x4238b4,_0x8593('0x12'),JSON[_0x8593('0x13')](_0x89a934));if(_0x89a934[_0x8593('0x14')]){if(_0x89a934[_0x8593('0x14')][_0x8593('0x15')]===0x1f4){logger[_0x8593('0x14')](_0x8593('0x10'),_0x4238b4,_0x89a934['error'][_0x8593('0x16')]);return _0x5735af(_0x89a934[_0x8593('0x14')]['message']);}logger[_0x8593('0x14')](_0x8593('0x10'),_0x4238b4,_0x89a934[_0x8593('0x14')][_0x8593('0x16')]);return _0x17f614(_0x89a934[_0x8593('0x14')][_0x8593('0x16')]);}else{logger[_0x8593('0xf')](_0x8593('0x10'),_0x4238b4,_0x8593('0x12'));_0x17f614(_0x89a934[_0x8593('0x17')][_0x8593('0x16')]);}})[_0x8593('0x18')](function(_0x269d3f){logger[_0x8593('0x14')](_0x8593('0x10'),_0x4238b4,_0x269d3f);_0x5735af(_0x269d3f);});});}exports[_0x8593('0x19')]=function(_0x5a1bbe){var _0x509f1f=this;return new Promise(function(_0x11ae47,_0x6e0750){return db[_0x8593('0x1a')]['findAll']({'raw':_0x5a1bbe[_0x8593('0x1b')]?_0x5a1bbe[_0x8593('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5a1bbe['options']?_0x5a1bbe[_0x8593('0x1b')][_0x8593('0x1c')]||null:null,'attributes':_0x5a1bbe[_0x8593('0x1b')]?_0x5a1bbe[_0x8593('0x1b')][_0x8593('0x1d')]||null:null,'limit':_0x5a1bbe[_0x8593('0x1b')]?_0x5a1bbe['options'][_0x8593('0x1e')]||null:null,'include':_0x5a1bbe['options']?_0x5a1bbe[_0x8593('0x1b')][_0x8593('0x1f')]?_[_0x8593('0x20')](_0x5a1bbe['options'][_0x8593('0x1f')],function(_0x1f7566){return{'model':db[_0x1f7566['model']],'as':_0x1f7566['as'],'attributes':_0x1f7566[_0x8593('0x1d')],'include':_0x1f7566[_0x8593('0x1f')]?_[_0x8593('0x20')](_0x1f7566[_0x8593('0x1f')],function(_0x2a2f25){return{'model':db[_0x2a2f25[_0x8593('0x21')]],'as':_0x2a2f25['as'],'attributes':_0x2a2f25[_0x8593('0x1d')],'include':_0x2a2f25[_0x8593('0x1f')]?_[_0x8593('0x20')](_0x2a2f25[_0x8593('0x1f')],function(_0x553b22){return{'model':db[_0x553b22[_0x8593('0x21')]],'as':_0x553b22['as'],'attributes':_0x553b22[_0x8593('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8593('0xe')](function(_0x2371a8){logger['info'](_0x8593('0x19'),_0x5a1bbe);logger[_0x8593('0x22')](_0x8593('0x19'),_0x5a1bbe,JSON[_0x8593('0x13')](_0x2371a8));_0x11ae47(_0x2371a8);})[_0x8593('0x18')](function(_0x1b2ff1){logger['error'](_0x8593('0x19'),_0x1b2ff1[_0x8593('0x16')],_0x5a1bbe);_0x6e0750(_0x509f1f['error'](0x1f4,_0x1b2ff1[_0x8593('0x16')]));});});};exports[_0x8593('0x23')]=function(_0x27e8b6){var _0xa50cb0=this;return new Promise(function(_0x34c187,_0x2d7754){return db['WhatsappQueue']['find']({'raw':_0x27e8b6[_0x8593('0x1b')]?_0x27e8b6[_0x8593('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x27e8b6[_0x8593('0x1b')]?_0x27e8b6[_0x8593('0x1b')][_0x8593('0x1c')]||null:null,'attributes':_0x27e8b6[_0x8593('0x1b')]?_0x27e8b6[_0x8593('0x1b')][_0x8593('0x1d')]||null:null,'include':_0x27e8b6[_0x8593('0x1b')]?_0x27e8b6[_0x8593('0x1b')][_0x8593('0x1f')]?_['map'](_0x27e8b6['options'][_0x8593('0x1f')],function(_0x47d77c){return{'model':db[_0x47d77c[_0x8593('0x21')]],'as':_0x47d77c['as'],'attributes':_0x47d77c[_0x8593('0x1d')],'include':_0x47d77c[_0x8593('0x1f')]?_['map'](_0x47d77c['include'],function(_0x596fc8){return{'model':db[_0x596fc8[_0x8593('0x21')]],'as':_0x596fc8['as'],'attributes':_0x596fc8[_0x8593('0x1d')],'include':_0x596fc8[_0x8593('0x1f')]?_['map'](_0x596fc8[_0x8593('0x1f')],function(_0x57dfba){return{'model':db[_0x57dfba[_0x8593('0x21')]],'as':_0x57dfba['as'],'attributes':_0x57dfba[_0x8593('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x336326){logger[_0x8593('0xf')](_0x8593('0x23'),_0x27e8b6);logger[_0x8593('0x22')](_0x8593('0x23'),_0x27e8b6,JSON[_0x8593('0x13')](_0x336326));_0x34c187(_0x336326);})[_0x8593('0x18')](function(_0x581e40){logger[_0x8593('0x14')](_0x8593('0x23'),_0x581e40[_0x8593('0x16')],_0x27e8b6);_0x2d7754(_0xa50cb0[_0x8593('0x14')](0x1f4,_0x581e40[_0x8593('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index eb22263..dde46d6 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 _0xb5a9=['save','remove','emit','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x23bed6,_0x45f84f){var _0x1f9d5b=function(_0x96df66){while(--_0x96df66){_0x23bed6['push'](_0x23bed6['shift']());}};_0x1f9d5b(++_0x45f84f);}(_0xb5a9,0xc3));var _0x9b5a=function(_0x97ba3b,_0x3ef155){_0x97ba3b=_0x97ba3b-0x0;var _0x4a50de=_0xb5a9[_0x97ba3b];return _0x4a50de;};'use strict';var WhatsappQueueEvents=require(_0x9b5a('0x0'));var events=[_0x9b5a('0x1'),_0x9b5a('0x2'),'update'];function createListener(_0x2e471f,_0x57d61f){return function(_0x2bfe8d){_0x57d61f[_0x9b5a('0x3')](_0x2e471f,_0x2bfe8d);};}function removeListener(_0x5227b0,_0x43c33f){return function(){WhatsappQueueEvents['removeListener'](_0x5227b0,_0x43c33f);};}exports[_0x9b5a('0x4')]=function(_0x99901e){for(var _0x3f0a4f=0x0,_0x2e4a31=events[_0x9b5a('0x5')];_0x3f0a4f<_0x2e4a31;_0x3f0a4f++){var _0x19ddfd=events[_0x3f0a4f];var _0x564875=createListener(_0x9b5a('0x6')+_0x19ddfd,_0x99901e);WhatsappQueueEvents['on'](_0x19ddfd,_0x564875);}}; \ No newline at end of file +var _0x1c02=['register','length','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener'];(function(_0x210e0f,_0x2e40f7){var _0x2fa362=function(_0x2e3e74){while(--_0x2e3e74){_0x210e0f['push'](_0x210e0f['shift']());}};_0x2fa362(++_0x2e40f7);}(_0x1c02,0x1e3));var _0x21c0=function(_0x1cd65c,_0x4fcead){_0x1cd65c=_0x1cd65c-0x0;var _0x59c529=_0x1c02[_0x1cd65c];return _0x59c529;};'use strict';var WhatsappQueueEvents=require(_0x21c0('0x0'));var events=['save',_0x21c0('0x1'),_0x21c0('0x2')];function createListener(_0x5674c9,_0x48616f){return function(_0x16152f){_0x48616f[_0x21c0('0x3')](_0x5674c9,_0x16152f);};}function removeListener(_0x34386e,_0x60aefc){return function(){WhatsappQueueEvents[_0x21c0('0x4')](_0x34386e,_0x60aefc);};}exports[_0x21c0('0x5')]=function(_0x4471aa){for(var _0x47b344=0x0,_0x474fd6=events[_0x21c0('0x6')];_0x47b344<_0x474fd6;_0x47b344++){var _0x5c14d2=events[_0x47b344];var _0x418d13=createListener(_0x21c0('0x7')+_0x5c14d2,_0x4471aa);WhatsappQueueEvents['on'](_0x5c14d2,_0x418d13);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 3c600a8..47b7477 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 _0x7778=['/describe','describe','show','post','create','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7778,0x136));var _0x8777=function(_0x3883a8,_0x4d264f){_0x3883a8=_0x3883a8-0x0;var _0x148071=_0x7778[_0x3883a8];return _0x148071;};'use strict';var multer=require(_0x8777('0x0'));var util=require(_0x8777('0x1'));var path=require(_0x8777('0x2'));var timeout=require(_0x8777('0x3'));var express=require('express');var router=express[_0x8777('0x4')]();var fs_extra=require(_0x8777('0x5'));var auth=require(_0x8777('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8777('0x7'));var controller=require(_0x8777('0x8'));router[_0x8777('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8777('0x9')](_0x8777('0xa'),auth['isAuthenticated'](),controller[_0x8777('0xb')]);router[_0x8777('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x8777('0xc')]);router[_0x8777('0xd')]('/',auth['isAuthenticated'](),controller[_0x8777('0xe')]);router[_0x8777('0xf')](_0x8777('0x10'),auth[_0x8777('0x11')](),controller[_0x8777('0x12')]);router['delete'](_0x8777('0x10'),auth[_0x8777('0x11')](),controller['destroy']);module[_0x8777('0x13')]=router; \ No newline at end of file +var _0x29a2=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','/:id','delete','destroy','util','connect-timeout'];(function(_0x3970e5,_0xfea9be){var _0x2c9616=function(_0x9e835a){while(--_0x9e835a){_0x3970e5['push'](_0x3970e5['shift']());}};_0x2c9616(++_0xfea9be);}(_0x29a2,0x18d));var _0x229a=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x29a2[_0x68ee8b];return _0x5148f7;};'use strict';var multer=require('multer');var util=require(_0x229a('0x0'));var path=require('path');var timeout=require(_0x229a('0x1'));var express=require(_0x229a('0x2'));var router=express[_0x229a('0x3')]();var fs_extra=require(_0x229a('0x4'));var auth=require(_0x229a('0x5'));var interaction=require(_0x229a('0x6'));var config=require('../../config/environment');var controller=require(_0x229a('0x7'));router[_0x229a('0x8')]('/',auth[_0x229a('0x9')](),controller[_0x229a('0xa')]);router[_0x229a('0x8')](_0x229a('0xb'),auth['isAuthenticated'](),controller[_0x229a('0xc')]);router[_0x229a('0x8')]('/:id',auth[_0x229a('0x9')](),controller[_0x229a('0xd')]);router[_0x229a('0xe')]('/',auth[_0x229a('0x9')](),controller['create']);router[_0x229a('0xf')](_0x229a('0x10'),auth[_0x229a('0x9')](),controller['update']);router[_0x229a('0x11')](_0x229a('0x10'),auth[_0x229a('0x9')](),controller[_0x229a('0x12')]);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 b9131b5..c873f73 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(_0x4287ec,_0x430a9e){var _0x33d8b1=function(_0xb7cb95){while(--_0xb7cb95){_0x4287ec['push'](_0x4287ec['shift']());}};_0x33d8b1(++_0x430a9e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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(_0x486171,_0x554e25){var _0x43d0f1=function(_0x10ccbc){while(--_0x10ccbc){_0x486171['push'](_0x486171['shift']());}};_0x43d0f1(++_0x554e25);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 b36269d..1689325 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 _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xfff0,0x139));var _0x0fff=function(_0x1cf243,_0x164b9c){_0x1cf243=_0x1cf243-0x0;var _0x1ceacb=_0xfff0[_0x1cf243];return _0x1ceacb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file +var _0xf4f4=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x36cb4d,_0x2dc7aa){var _0x35ca7c=function(_0x3e8fbf){while(--_0x3e8fbf){_0x36cb4d['push'](_0x36cb4d['shift']());}};_0x35ca7c(++_0x2dc7aa);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x28635a,_0xa51d49){_0x28635a=_0x28635a-0x0;var _0x2e8c5b=_0xf4f4[_0x28635a];return _0x2e8c5b;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x28')]();});}};}function handleEntityNotFound(_0x2ec92a,_0x113ff7){return function(_0x31b30e){if(!_0x31b30e){_0x2ec92a[_0x4f4f('0x29')](0x194);}return _0x31b30e;};}function handleError(_0x50a8ce,_0x39fb9f){_0x39fb9f=_0x39fb9f||0x1f4;return function(_0x237cf9){logger[_0x4f4f('0x2a')](_0x237cf9[_0x4f4f('0x2b')]);if(_0x237cf9[_0x4f4f('0x2c')]){delete _0x237cf9['name'];}_0x50a8ce[_0x4f4f('0x1b')](_0x39fb9f)[_0x4f4f('0x2d')](_0x237cf9);};}exports[_0x4f4f('0x2e')]=function(_0x5deda9,_0x534075){var _0x4c2490={},_0x73b8bb={},_0x5b4f6a={'count':0x0,'rows':[]};var _0x354266=_[_0x4f4f('0x2f')](db[_0x4f4f('0x30')]['rawAttributes'],function(_0x460546){return{'name':_0x460546[_0x4f4f('0x31')],'type':_0x460546['type'][_0x4f4f('0x32')]};});_0x73b8bb[_0x4f4f('0x33')]=_[_0x4f4f('0x2f')](_0x354266,'name');_0x73b8bb[_0x4f4f('0x34')]=_[_0x4f4f('0x35')](_0x5deda9['query']);_0x73b8bb['filters']=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],_0x73b8bb[_0x4f4f('0x34')]);_0x4c2490[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x4c2490[_0x4f4f('0x37')]=_0x4c2490['attributes']['length']?_0x4c2490[_0x4f4f('0x37')]:_0x73b8bb['model'];if(!_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x39')](_0x4f4f('0x3a'))){_0x4c2490[_0x4f4f('0x1e')]=qs[_0x4f4f('0x1e')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1e')]);_0x4c2490[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1c')]);}_0x4c2490[_0x4f4f('0x3b')]=qs['sort'](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x3c')]);_0x4c2490[_0x4f4f('0x3d')]=qs[_0x4f4f('0x3e')](_[_0x4f4f('0x3f')](_0x5deda9[_0x4f4f('0x34')],_0x73b8bb[_0x4f4f('0x3e')]),_0x354266);if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]){_0x4c2490['where']=_[_0x4f4f('0x41')](_0x4c2490[_0x4f4f('0x3d')],{'$or':_[_0x4f4f('0x2f')](_0x354266,function(_0x5eb174){if(_0x5eb174['type']!==_0x4f4f('0x42')){var _0x95a296={};_0x95a296[_0x5eb174[_0x4f4f('0x2c')]]={'$like':'%'+_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]+'%'};return _0x95a296;}})});}_0x4c2490=_[_0x4f4f('0x41')]({},_0x4c2490,_0x5deda9[_0x4f4f('0x43')]);var _0x1ff7f3={'where':_0x4c2490[_0x4f4f('0x3d')]};return db[_0x4f4f('0x30')][_0x4f4f('0x1f')](_0x1ff7f3)[_0x4f4f('0x27')](function(_0x4e352e){_0x5b4f6a[_0x4f4f('0x1f')]=_0x4e352e;if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x44')]){_0x4c2490[_0x4f4f('0x45')]=[{'all':!![]}];}return db[_0x4f4f('0x30')]['findAll'](_0x4c2490);})['then'](function(_0x134710){_0x5b4f6a[_0x4f4f('0x46')]=_0x134710;return _0x5b4f6a;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x534075,_0x4c2490))[_0x4f4f('0x47')](handleError(_0x534075,null));};exports['show']=function(_0x1aaf2c,_0x480919){var _0x10de24={'raw':!![],'where':{'id':_0x1aaf2c['params']['id']}},_0x5a7c94={};_0x5a7c94[_0x4f4f('0x33')]=_['keys'](db[_0x4f4f('0x30')][_0x4f4f('0x48')]);_0x5a7c94['query']=_[_0x4f4f('0x35')](_0x1aaf2c[_0x4f4f('0x34')]);_0x5a7c94['filters']=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],_0x5a7c94[_0x4f4f('0x34')]);_0x10de24[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x1aaf2c[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x10de24[_0x4f4f('0x37')]=_0x10de24[_0x4f4f('0x37')][_0x4f4f('0x49')]?_0x10de24[_0x4f4f('0x37')]:_0x5a7c94[_0x4f4f('0x33')];if(_0x1aaf2c[_0x4f4f('0x34')]['includeAll']){_0x10de24[_0x4f4f('0x45')]=[{'all':!![]}];}_0x10de24=_['merge']({},_0x10de24,_0x1aaf2c['options']);return db[_0x4f4f('0x30')][_0x4f4f('0x4a')](_0x10de24)['then'](handleEntityNotFound(_0x480919,null))[_0x4f4f('0x27')](respondWithResult(_0x480919,null))[_0x4f4f('0x47')](handleError(_0x480919,null));};exports[_0x4f4f('0x4b')]=function(_0x2721b5,_0x222511){return db['WhatsappQueueReport'][_0x4f4f('0x4b')](_0x2721b5[_0x4f4f('0x4c')],{})[_0x4f4f('0x27')](respondWithResult(_0x222511,0xc9))[_0x4f4f('0x47')](handleError(_0x222511,null));};exports[_0x4f4f('0x26')]=function(_0x433787,_0x29314b){if(_0x433787[_0x4f4f('0x4c')]['id']){delete _0x433787[_0x4f4f('0x4c')]['id'];}return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x433787[_0x4f4f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29314b,null))['then'](saveUpdates(_0x433787['body'],null))[_0x4f4f('0x27')](respondWithResult(_0x29314b,null))[_0x4f4f('0x47')](handleError(_0x29314b,null));};exports[_0x4f4f('0x4e')]=function(_0x5c5077,_0x389ec6){return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x5c5077[_0x4f4f('0x4d')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x389ec6,null))[_0x4f4f('0x27')](removeEntity(_0x389ec6,null))[_0x4f4f('0x47')](handleError(_0x389ec6,null));};exports[_0x4f4f('0x4f')]=function(_0x21408b,_0x88054a){return db[_0x4f4f('0x30')]['describe']()['then'](respondWithResult(_0x88054a,null))[_0x4f4f('0x47')](handleError(_0x88054a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 4b3ffd6..91a8c4c 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 _0xb3f2=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define'];(function(_0x28786b,_0x392847){var _0x1f8749=function(_0x4a1f15){while(--_0x4a1f15){_0x28786b['push'](_0x28786b['shift']());}};_0x1f8749(++_0x392847);}(_0xb3f2,0x16b));var _0x2b3f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb3f2[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x2b3f('0x0'));var logger=require(_0x2b3f('0x1'))(_0x2b3f('0x2'));var moment=require('moment');var BPromise=require(_0x2b3f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b3f('0x4'));var rimraf=require(_0x2b3f('0x5'));var config=require(_0x2b3f('0x6'));var attributes=require(_0x2b3f('0x7'));module['exports']=function(_0x4c7ca7,_0x408659){return _0x4c7ca7[_0x2b3f('0x8')](_0x2b3f('0x9'),attributes,{'tableName':_0x2b3f('0xa'),'paranoid':![],'indexes':[{'name':_0x2b3f('0xb'),'fields':[_0x2b3f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe73=['moment','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x532aa1,_0x2bf907){var _0x929040=function(_0x3e5880){while(--_0x3e5880){_0x532aa1['push'](_0x532aa1['shift']());}};_0x929040(++_0x2bf907);}(_0xfe73,0x64));var _0x3fe7=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xfe73[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x3fe7('0x0'));var util=require(_0x3fe7('0x1'));var logger=require(_0x3fe7('0x2'))(_0x3fe7('0x3'));var moment=require(_0x3fe7('0x4'));var BPromise=require('bluebird');var rp=require(_0x3fe7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fe7('0x6'));var config=require('../../config/environment');var attributes=require(_0x3fe7('0x7'));module[_0x3fe7('0x8')]=function(_0x100c9c,_0x589804){return _0x100c9c[_0x3fe7('0x9')](_0x3fe7('0xa'),attributes,{'tableName':_0x3fe7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3fe7('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 fe1bb1a..81e5cd0 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 _0x6f0d=['where','limit','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','WhatsappQueueReport','update','body'];(function(_0x5a1cdb,_0x446c8c){var _0x3c2982=function(_0x342d57){while(--_0x342d57){_0x5a1cdb['push'](_0x5a1cdb['shift']());}};_0x3c2982(++_0x446c8c);}(_0x6f0d,0x8f));var _0xd6f0=function(_0x2daef2,_0x59ac3b){_0x2daef2=_0x2daef2-0x0;var _0x2f84e1=_0x6f0d[_0x2daef2];return _0x2f84e1;};'use strict';var _=require(_0xd6f0('0x0'));var util=require(_0xd6f0('0x1'));var moment=require(_0xd6f0('0x2'));var BPromise=require(_0xd6f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6f0('0x4'));var db=require(_0xd6f0('0x5'))['db'];var utils=require(_0xd6f0('0x6'));var logger=require(_0xd6f0('0x7'))(_0xd6f0('0x8'));var config=require('../../config/environment');var jayson=require(_0xd6f0('0x9'));var client=jayson[_0xd6f0('0xa')][_0xd6f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17b882,_0x5569ca,_0x4d745a){return new BPromise(function(_0x19b176,_0x1809aa){return client[_0xd6f0('0xc')](_0x17b882,_0x4d745a)['then'](function(_0x1311c3){logger[_0xd6f0('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5569ca,'request\x20sent');logger[_0xd6f0('0xe')](_0xd6f0('0xf'),_0x5569ca,_0xd6f0('0x10'),JSON[_0xd6f0('0x11')](_0x1311c3));if(_0x1311c3['error']){if(_0x1311c3['error'][_0xd6f0('0x12')]===0x1f4){logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x5569ca,_0x1311c3[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x1809aa(_0x1311c3[_0xd6f0('0x13')][_0xd6f0('0x15')]);}logger[_0xd6f0('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5569ca,_0x1311c3[_0xd6f0('0x13')][_0xd6f0('0x15')]);return _0x19b176(_0x1311c3[_0xd6f0('0x13')][_0xd6f0('0x15')]);}else{logger[_0xd6f0('0xd')](_0xd6f0('0x14'),_0x5569ca,_0xd6f0('0x10'));_0x19b176(_0x1311c3[_0xd6f0('0x16')]['message']);}})[_0xd6f0('0x17')](function(_0x50c5d7){logger[_0xd6f0('0x13')](_0xd6f0('0x14'),_0x5569ca,_0x50c5d7);_0x1809aa(_0x50c5d7);});});}exports[_0xd6f0('0x18')]=function(_0x118ce1){var _0x52ed26=this;return new Promise(function(_0x1fb5c8,_0x3b7671){return db['WhatsappQueueReport'][_0xd6f0('0x19')](_0x118ce1['body'],{'raw':_0x118ce1[_0xd6f0('0x1a')]?_0x118ce1['options'][_0xd6f0('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3a13cd){logger[_0xd6f0('0xd')](_0xd6f0('0x18'),_0x118ce1);logger[_0xd6f0('0xe')](_0xd6f0('0x18'),_0x118ce1,JSON[_0xd6f0('0x11')](_0x3a13cd));_0x1fb5c8(_0x3a13cd);})[_0xd6f0('0x17')](function(_0x3e9468){logger[_0xd6f0('0x13')](_0xd6f0('0x18'),_0x3e9468[_0xd6f0('0x15')],_0x118ce1);_0x3b7671(_0x52ed26[_0xd6f0('0x13')](0x1f4,_0x3e9468[_0xd6f0('0x15')]));});});};exports[_0xd6f0('0x1c')]=function(_0x12a214){var _0x413849=this;return new Promise(function(_0x19486d,_0x36b6c1){return db[_0xd6f0('0x1d')][_0xd6f0('0x1e')](_0x12a214[_0xd6f0('0x1f')],{'raw':_0x12a214['options']?_0x12a214[_0xd6f0('0x1a')][_0xd6f0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12a214['options']?_0x12a214[_0xd6f0('0x1a')][_0xd6f0('0x20')]||null:null,'attributes':_0x12a214['options']?_0x12a214[_0xd6f0('0x1a')]['attributes']||null:null,'limit':_0x12a214[_0xd6f0('0x1a')]?_0x12a214[_0xd6f0('0x1a')][_0xd6f0('0x21')]||null:null})[_0xd6f0('0x22')](function(_0x24da33){logger[_0xd6f0('0xd')]('UpdateWhatsappQueueReport',_0x12a214);logger[_0xd6f0('0xe')](_0xd6f0('0x1c'),_0x12a214,JSON[_0xd6f0('0x11')](_0x24da33));_0x19486d(_0x24da33);})[_0xd6f0('0x17')](function(_0x309938){logger[_0xd6f0('0x13')](_0xd6f0('0x1c'),_0x309938['message'],_0x12a214);_0x36b6c1(_0x413849[_0xd6f0('0x13')](0x1f4,_0x309938['message']));});});}; \ No newline at end of file +var _0x6ce5=['jayson/promise','client','http','request','then','info','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','request\x20sent','catch','WhatsappQueueReport','create','body','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x33be75,_0xe5379){var _0x11bbbc=function(_0x5456a8){while(--_0x5456a8){_0x33be75['push'](_0x33be75['shift']());}};_0x11bbbc(++_0xe5379);}(_0x6ce5,0xff));var _0x56ce=function(_0x2ebdc5,_0x3c111c){_0x2ebdc5=_0x2ebdc5-0x0;var _0x236fdc=_0x6ce5[_0x2ebdc5];return _0x236fdc;};'use strict';var _=require(_0x56ce('0x0'));var util=require(_0x56ce('0x1'));var moment=require(_0x56ce('0x2'));var BPromise=require('bluebird');var rs=require(_0x56ce('0x3'));var fs=require('fs');var Redis=require(_0x56ce('0x4'));var db=require(_0x56ce('0x5'))['db'];var utils=require(_0x56ce('0x6'));var logger=require('../../config/logger')(_0x56ce('0x7'));var config=require(_0x56ce('0x8'));var jayson=require(_0x56ce('0x9'));var client=jayson[_0x56ce('0xa')][_0x56ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4908c3,_0x167ef9,_0x15ae04){return new BPromise(function(_0x546c31,_0x3ff7ff){return client[_0x56ce('0xc')](_0x4908c3,_0x15ae04)[_0x56ce('0xd')](function(_0x56a82f){logger[_0x56ce('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x167ef9,'request\x20sent');logger[_0x56ce('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x167ef9,'request\x20sent',JSON[_0x56ce('0x10')](_0x56a82f));if(_0x56a82f[_0x56ce('0x11')]){if(_0x56a82f[_0x56ce('0x11')][_0x56ce('0x12')]===0x1f4){logger['error'](_0x56ce('0x13'),_0x167ef9,_0x56a82f[_0x56ce('0x11')]['message']);return _0x3ff7ff(_0x56a82f['error'][_0x56ce('0x14')]);}logger[_0x56ce('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x167ef9,_0x56a82f[_0x56ce('0x11')][_0x56ce('0x14')]);return _0x546c31(_0x56a82f[_0x56ce('0x11')]['message']);}else{logger[_0x56ce('0xe')](_0x56ce('0x13'),_0x167ef9,_0x56ce('0x15'));_0x546c31(_0x56a82f['result']['message']);}})[_0x56ce('0x16')](function(_0x10b0b2){logger[_0x56ce('0x11')](_0x56ce('0x13'),_0x167ef9,_0x10b0b2);_0x3ff7ff(_0x10b0b2);});});}exports['CreateWhatsappQueueReport']=function(_0x2c83f5){var _0x2cd352=this;return new Promise(function(_0x43d876,_0x365f99){return db[_0x56ce('0x17')][_0x56ce('0x18')](_0x2c83f5[_0x56ce('0x19')],{'raw':_0x2c83f5[_0x56ce('0x1a')]?_0x2c83f5[_0x56ce('0x1a')][_0x56ce('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5889ea){logger[_0x56ce('0xe')]('CreateWhatsappQueueReport',_0x2c83f5);logger[_0x56ce('0xf')]('CreateWhatsappQueueReport',_0x2c83f5,JSON[_0x56ce('0x10')](_0x5889ea));_0x43d876(_0x5889ea);})[_0x56ce('0x16')](function(_0x1fa213){logger[_0x56ce('0x11')](_0x56ce('0x1c'),_0x1fa213[_0x56ce('0x14')],_0x2c83f5);_0x365f99(_0x2cd352[_0x56ce('0x11')](0x1f4,_0x1fa213[_0x56ce('0x14')]));});});};exports[_0x56ce('0x1d')]=function(_0x347b4b){var _0x1c61f9=this;return new Promise(function(_0x2c45ba,_0x1b4637){return db['WhatsappQueueReport']['update'](_0x347b4b[_0x56ce('0x19')],{'raw':_0x347b4b['options']?_0x347b4b[_0x56ce('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x347b4b[_0x56ce('0x1a')]?_0x347b4b['options'][_0x56ce('0x1e')]||null:null,'attributes':_0x347b4b[_0x56ce('0x1a')]?_0x347b4b['options'][_0x56ce('0x1f')]||null:null,'limit':_0x347b4b[_0x56ce('0x1a')]?_0x347b4b['options'][_0x56ce('0x20')]||null:null})[_0x56ce('0xd')](function(_0x2b2a72){logger['info'](_0x56ce('0x1d'),_0x347b4b);logger[_0x56ce('0xf')](_0x56ce('0x1d'),_0x347b4b,JSON[_0x56ce('0x10')](_0x2b2a72));_0x2c45ba(_0x2b2a72);})[_0x56ce('0x16')](function(_0x694e5f){logger[_0x56ce('0x11')](_0x56ce('0x1d'),_0x694e5f['message'],_0x347b4b);_0x1b4637(_0x1c61f9[_0x56ce('0x11')](0x1f4,_0x694e5f[_0x56ce('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f726759..19ccb45 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 _0x6bdb=['describe','isAuthenticated','post','put','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6bdb,0x1ce));var _0xb6bd=function(_0x1c4346,_0x196dc5){_0x1c4346=_0x1c4346-0x0;var _0x2c8c6d=_0x6bdb[_0x1c4346];return _0x2c8c6d;};'use strict';var multer=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var path=require('path');var timeout=require(_0xb6bd('0x2'));var express=require(_0xb6bd('0x3'));var router=express[_0xb6bd('0x4')]();var fs_extra=require(_0xb6bd('0x5'));var auth=require(_0xb6bd('0x6'));var interaction=require(_0xb6bd('0x7'));var config=require(_0xb6bd('0x8'));var controller=require(_0xb6bd('0x9'));router[_0xb6bd('0xa')]('/',auth['isAuthenticated'](),controller[_0xb6bd('0xb')]);router[_0xb6bd('0xa')](_0xb6bd('0xc'),auth['isAuthenticated'](),controller[_0xb6bd('0xd')]);router[_0xb6bd('0xa')]('/:id',auth[_0xb6bd('0xe')](),controller['show']);router[_0xb6bd('0xf')]('/',auth[_0xb6bd('0xe')](),controller['create']);router[_0xb6bd('0x10')](_0xb6bd('0x11'),auth[_0xb6bd('0xe')](),controller['update']);router['delete'](_0xb6bd('0x11'),auth['isAuthenticated'](),controller[_0xb6bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa624=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcf0add,_0x7d6f7){var _0x5479e9=function(_0x13ec62){while(--_0x13ec62){_0xcf0add['push'](_0xcf0add['shift']());}};_0x5479e9(++_0x7d6f7);}(_0xa624,0xab));var _0x4a62=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xa624[_0x3cc9d9];return _0x1a425d;};'use strict';var multer=require(_0x4a62('0x0'));var util=require(_0x4a62('0x1'));var path=require(_0x4a62('0x2'));var timeout=require(_0x4a62('0x3'));var express=require(_0x4a62('0x4'));var router=express[_0x4a62('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4a62('0x6'));var interaction=require(_0x4a62('0x7'));var config=require(_0x4a62('0x8'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x4a62('0x9')](),controller[_0x4a62('0xa')]);router[_0x4a62('0xb')]('/describe',auth[_0x4a62('0x9')](),controller['describe']);router[_0x4a62('0xb')](_0x4a62('0xc'),auth['isAuthenticated'](),controller[_0x4a62('0xd')]);router[_0x4a62('0xe')]('/',auth['isAuthenticated'](),controller[_0x4a62('0xf')]);router[_0x4a62('0x10')]('/:id',auth[_0x4a62('0x9')](),controller[_0x4a62('0x11')]);router[_0x4a62('0x12')](_0x4a62('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4a62('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index dd0e4ac..3fd32aa 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 _0x3264=['account','DATE','exports','STRING','ENUM'];(function(_0x2993e4,_0x2af2db){var _0x4167b5=function(_0x2150a5){while(--_0x2150a5){_0x2993e4['push'](_0x2993e4['shift']());}};_0x4167b5(++_0x2af2db);}(_0x3264,0x7f));var _0x4326=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x3264[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'uniqueid':{'type':Sequelize[_0x4326('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4326('0x2')](_0x4326('0x3'),'agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4326('0x4')]}}; \ No newline at end of file +var _0x5f7b=['DATE','sequelize','exports','ENUM','account','agent','queue'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x5f7b[_0x49b207];return _0x2dc8fa;};'use strict';var Sequelize=require(_0xb5f7('0x0'));module[_0xb5f7('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb5f7('0x2')](_0xb5f7('0x3'),_0xb5f7('0x4'),_0xb5f7('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb5f7('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 21f950a..e93681c 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 _0xe950=['squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','name','send','map','WhatsappTransferReport','fieldName','key','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','findAll','rows','params','rawAttributes','intersection','include','options','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash'];(function(_0x31acb7,_0x160876){var _0x41754a=function(_0xca8647){while(--_0xca8647){_0x31acb7['push'](_0x31acb7['shift']());}};_0x41754a(++_0x160876);}(_0xe950,0x1f3));var _0x0e95=function(_0x5ed537,_0x55e79e){_0x5ed537=_0x5ed537-0x0;var _0x163bba=_0xe950[_0x5ed537];return _0x163bba;};'use strict';var emlformat=require(_0x0e95('0x0'));var rimraf=require(_0x0e95('0x1'));var zipdir=require(_0x0e95('0x2'));var jsonpatch=require(_0x0e95('0x3'));var rp=require(_0x0e95('0x4'));var moment=require(_0x0e95('0x5'));var BPromise=require(_0x0e95('0x6'));var Mustache=require(_0x0e95('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0e95('0x8'));var csv=require(_0x0e95('0x9'));var ejs=require(_0x0e95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e95('0xb'));var squel=require(_0x0e95('0xc'));var crypto=require('crypto');var jsforce=require(_0x0e95('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0e95('0x9'));var querystring=require(_0x0e95('0xe'));var Papa=require(_0x0e95('0xf'));var Redis=require(_0x0e95('0x10'));var authService=require(_0x0e95('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0e95('0x12'));var hardwareService=require(_0x0e95('0x13'));var logger=require(_0x0e95('0x14'))(_0x0e95('0x15'));var utils=require(_0x0e95('0x16'));var config=require(_0x0e95('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5dfc,_0x364470){_0x364470=_0x364470||0xcc;return function(_0x34a1fd){if(_0x34a1fd){return _0x3b5dfc['sendStatus'](_0x364470);}return _0x3b5dfc[_0x0e95('0x18')](_0x364470)[_0x0e95('0x19')]();};}function respondWithResult(_0xf701ca,_0xcd458b){_0xcd458b=_0xcd458b||0xc8;return function(_0x819e87){if(_0x819e87){return _0xf701ca[_0x0e95('0x18')](_0xcd458b)['json'](_0x819e87);}};}function respondWithFilteredResult(_0x4c1afa,_0x3fdaca){return function(_0x3fc363){if(_0x3fc363){var _0x1d79a3=typeof _0x3fdaca[_0x0e95('0x1a')]===_0x0e95('0x1b')&&typeof _0x3fdaca[_0x0e95('0x1c')]==='undefined';var _0x251d6d=_0x3fc363[_0x0e95('0x1d')];var _0x33f666=_0x1d79a3?0x0:_0x3fdaca['offset'];var _0x19225a=_0x1d79a3?_0x3fc363['count']:_0x3fdaca[_0x0e95('0x1a')]+_0x3fdaca[_0x0e95('0x1c')];var _0x20bd16;if(_0x19225a>=_0x251d6d){_0x19225a=_0x251d6d;_0x20bd16=0xc8;}else{_0x20bd16=0xce;}_0x4c1afa[_0x0e95('0x18')](_0x20bd16);return _0x4c1afa[_0x0e95('0x1e')](_0x0e95('0x1f'),_0x33f666+'-'+_0x19225a+'/'+_0x251d6d)[_0x0e95('0x20')](_0x3fc363);}return null;};}function patchUpdates(_0x186c4a){return function(_0x15ed70){try{jsonpatch[_0x0e95('0x21')](_0x15ed70,_0x186c4a,!![]);}catch(_0x5e7353){return BPromise['reject'](_0x5e7353);}return _0x15ed70[_0x0e95('0x22')]();};}function saveUpdates(_0x265602,_0x5d733d){return function(_0x35f87b){if(_0x35f87b){return _0x35f87b['update'](_0x265602)[_0x0e95('0x23')](function(_0x145cd3){return _0x145cd3;});}return null;};}function removeEntity(_0x4d356a,_0x432bef){return function(_0x1af314){if(_0x1af314){return _0x1af314[_0x0e95('0x24')]()[_0x0e95('0x23')](function(){_0x4d356a[_0x0e95('0x18')](0xcc)[_0x0e95('0x19')]();});}};}function handleEntityNotFound(_0x56a4ac,_0x5e4b29){return function(_0x578d56){if(!_0x578d56){_0x56a4ac[_0x0e95('0x25')](0x194);}return _0x578d56;};}function handleError(_0x38a65d,_0x584dd3){_0x584dd3=_0x584dd3||0x1f4;return function(_0x29cc68){logger['error'](_0x29cc68[_0x0e95('0x26')]);if(_0x29cc68[_0x0e95('0x27')]){delete _0x29cc68[_0x0e95('0x27')];}_0x38a65d[_0x0e95('0x18')](_0x584dd3)[_0x0e95('0x28')](_0x29cc68);};}exports['index']=function(_0x3899e9,_0x13b99a){var _0x50ccb1={},_0x47ba67={},_0x70373d={'count':0x0,'rows':[]};var _0x17d4b3=_[_0x0e95('0x29')](db[_0x0e95('0x2a')]['rawAttributes'],function(_0x5a3a6e){return{'name':_0x5a3a6e[_0x0e95('0x2b')],'type':_0x5a3a6e['type'][_0x0e95('0x2c')]};});_0x47ba67[_0x0e95('0x2d')]=_[_0x0e95('0x29')](_0x17d4b3,_0x0e95('0x27'));_0x47ba67['query']=_[_0x0e95('0x2e')](_0x3899e9[_0x0e95('0x2f')]);_0x47ba67[_0x0e95('0x30')]=_['intersection'](_0x47ba67['model'],_0x47ba67[_0x0e95('0x2f')]);_0x50ccb1[_0x0e95('0x31')]=_['intersection'](_0x47ba67[_0x0e95('0x2d')],qs[_0x0e95('0x32')](_0x3899e9[_0x0e95('0x2f')][_0x0e95('0x32')]));_0x50ccb1['attributes']=_0x50ccb1[_0x0e95('0x31')][_0x0e95('0x33')]?_0x50ccb1['attributes']:_0x47ba67[_0x0e95('0x2d')];if(!_0x3899e9[_0x0e95('0x2f')]['hasOwnProperty'](_0x0e95('0x34'))){_0x50ccb1[_0x0e95('0x1c')]=qs['limit'](_0x3899e9['query'][_0x0e95('0x1c')]);_0x50ccb1[_0x0e95('0x1a')]=qs[_0x0e95('0x1a')](_0x3899e9[_0x0e95('0x2f')][_0x0e95('0x1a')]);}_0x50ccb1[_0x0e95('0x35')]=qs[_0x0e95('0x36')](_0x3899e9['query']['sort']);_0x50ccb1[_0x0e95('0x37')]=qs[_0x0e95('0x30')](_[_0x0e95('0x38')](_0x3899e9[_0x0e95('0x2f')],_0x47ba67[_0x0e95('0x30')]),_0x17d4b3);if(_0x3899e9[_0x0e95('0x2f')][_0x0e95('0x39')]){_0x50ccb1['where']=_[_0x0e95('0x3a')](_0x50ccb1['where'],{'$or':_[_0x0e95('0x29')](_0x17d4b3,function(_0xb7491){if(_0xb7491[_0x0e95('0x3b')]!=='VIRTUAL'){var _0x514990={};_0x514990[_0xb7491[_0x0e95('0x27')]]={'$like':'%'+_0x3899e9['query'][_0x0e95('0x39')]+'%'};return _0x514990;}})});}_0x50ccb1=_[_0x0e95('0x3a')]({},_0x50ccb1,_0x3899e9['options']);var _0x7c426={'where':_0x50ccb1['where']};return db['WhatsappTransferReport'][_0x0e95('0x1d')](_0x7c426)[_0x0e95('0x23')](function(_0x500c03){_0x70373d[_0x0e95('0x1d')]=_0x500c03;if(_0x3899e9[_0x0e95('0x2f')][_0x0e95('0x3c')]){_0x50ccb1['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x0e95('0x3d')](_0x50ccb1);})['then'](function(_0x13afb1){_0x70373d[_0x0e95('0x3e')]=_0x13afb1;return _0x70373d;})[_0x0e95('0x23')](respondWithFilteredResult(_0x13b99a,_0x50ccb1))['catch'](handleError(_0x13b99a,null));};exports['show']=function(_0x15ac70,_0x31c87b){var _0x299702={'raw':!![],'where':{'id':_0x15ac70[_0x0e95('0x3f')]['id']}},_0x111808={};_0x111808[_0x0e95('0x2d')]=_[_0x0e95('0x2e')](db[_0x0e95('0x2a')][_0x0e95('0x40')]);_0x111808[_0x0e95('0x2f')]=_['keys'](_0x15ac70[_0x0e95('0x2f')]);_0x111808['filters']=_[_0x0e95('0x41')](_0x111808[_0x0e95('0x2d')],_0x111808[_0x0e95('0x2f')]);_0x299702['attributes']=_['intersection'](_0x111808[_0x0e95('0x2d')],qs[_0x0e95('0x32')](_0x15ac70[_0x0e95('0x2f')]['fields']));_0x299702[_0x0e95('0x31')]=_0x299702[_0x0e95('0x31')][_0x0e95('0x33')]?_0x299702[_0x0e95('0x31')]:_0x111808[_0x0e95('0x2d')];if(_0x15ac70[_0x0e95('0x2f')][_0x0e95('0x3c')]){_0x299702[_0x0e95('0x42')]=[{'all':!![]}];}_0x299702=_[_0x0e95('0x3a')]({},_0x299702,_0x15ac70[_0x0e95('0x43')]);return db[_0x0e95('0x2a')]['find'](_0x299702)['then'](handleEntityNotFound(_0x31c87b,null))[_0x0e95('0x23')](respondWithResult(_0x31c87b,null))['catch'](handleError(_0x31c87b,null));};exports[_0x0e95('0x44')]=function(_0x4d0f73,_0x24fc9e){return db['WhatsappTransferReport'][_0x0e95('0x44')](_0x4d0f73[_0x0e95('0x45')],{})[_0x0e95('0x23')](respondWithResult(_0x24fc9e,0xc9))[_0x0e95('0x46')](handleError(_0x24fc9e,null));};exports['update']=function(_0x1825d4,_0x57fb49){if(_0x1825d4[_0x0e95('0x45')]['id']){delete _0x1825d4[_0x0e95('0x45')]['id'];}return db[_0x0e95('0x2a')]['find']({'where':{'id':_0x1825d4[_0x0e95('0x3f')]['id']}})['then'](handleEntityNotFound(_0x57fb49,null))[_0x0e95('0x23')](saveUpdates(_0x1825d4[_0x0e95('0x45')],null))['then'](respondWithResult(_0x57fb49,null))[_0x0e95('0x46')](handleError(_0x57fb49,null));};exports[_0x0e95('0x24')]=function(_0x4e57e4,_0x33f1d3){return db[_0x0e95('0x2a')][_0x0e95('0x47')]({'where':{'id':_0x4e57e4[_0x0e95('0x3f')]['id']}})['then'](handleEntityNotFound(_0x33f1d3,null))[_0x0e95('0x23')](removeEntity(_0x33f1d3,null))[_0x0e95('0x46')](handleError(_0x33f1d3,null));};exports[_0x0e95('0x48')]=function(_0xfd2693,_0x2df7c7){return db['WhatsappTransferReport'][_0x0e95('0x48')]()[_0x0e95('0x23')](respondWithResult(_0x2df7c7,null))['catch'](handleError(_0x2df7c7,null));}; \ No newline at end of file +var _0x2fc0=['map','WhatsappTransferReport','rawAttributes','type','key','query','intersection','model','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','attributes','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','end','name','send','index'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x2fc0,0x192));var _0x02fc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2fc0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02fc('0x0'));var zipdir=require(_0x02fc('0x1'));var jsonpatch=require(_0x02fc('0x2'));var rp=require(_0x02fc('0x3'));var moment=require(_0x02fc('0x4'));var BPromise=require(_0x02fc('0x5'));var Mustache=require('mustache');var util=require(_0x02fc('0x6'));var path=require(_0x02fc('0x7'));var sox=require(_0x02fc('0x8'));var csv=require('to-csv');var ejs=require(_0x02fc('0x9'));var fs=require('fs');var fs_extra=require(_0x02fc('0xa'));var _=require(_0x02fc('0xb'));var squel=require(_0x02fc('0xc'));var crypto=require('crypto');var jsforce=require(_0x02fc('0xd'));var deskjs=require(_0x02fc('0xe'));var toCsv=require(_0x02fc('0xf'));var querystring=require(_0x02fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x02fc('0x11'));var authService=require(_0x02fc('0x12'));var qs=require(_0x02fc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02fc('0x14'));var logger=require(_0x02fc('0x15'))('api');var utils=require(_0x02fc('0x16'));var config=require(_0x02fc('0x17'));var licenseUtil=require(_0x02fc('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56a057,_0x253327){_0x253327=_0x253327||0xcc;return function(_0x2326f0){if(_0x2326f0){return _0x56a057[_0x02fc('0x19')](_0x253327);}return _0x56a057[_0x02fc('0x1a')](_0x253327)['end']();};}function respondWithResult(_0xecc48d,_0x502309){_0x502309=_0x502309||0xc8;return function(_0x1760ee){if(_0x1760ee){return _0xecc48d[_0x02fc('0x1a')](_0x502309)['json'](_0x1760ee);}};}function respondWithFilteredResult(_0x35ebfe,_0x155bb7){return function(_0x3d48a9){if(_0x3d48a9){var _0x88e6be=typeof _0x155bb7['offset']==='undefined'&&typeof _0x155bb7[_0x02fc('0x1b')]===_0x02fc('0x1c');var _0x16c527=_0x3d48a9[_0x02fc('0x1d')];var _0x37f13a=_0x88e6be?0x0:_0x155bb7[_0x02fc('0x1e')];var _0x295ea1=_0x88e6be?_0x3d48a9[_0x02fc('0x1d')]:_0x155bb7['offset']+_0x155bb7[_0x02fc('0x1b')];var _0x182bb5;if(_0x295ea1>=_0x16c527){_0x295ea1=_0x16c527;_0x182bb5=0xc8;}else{_0x182bb5=0xce;}_0x35ebfe[_0x02fc('0x1a')](_0x182bb5);return _0x35ebfe[_0x02fc('0x1f')](_0x02fc('0x20'),_0x37f13a+'-'+_0x295ea1+'/'+_0x16c527)[_0x02fc('0x21')](_0x3d48a9);}return null;};}function patchUpdates(_0x1c892d){return function(_0x5949a0){try{jsonpatch['apply'](_0x5949a0,_0x1c892d,!![]);}catch(_0x2e2f2f){return BPromise[_0x02fc('0x22')](_0x2e2f2f);}return _0x5949a0[_0x02fc('0x23')]();};}function saveUpdates(_0x574e9e,_0x4d1408){return function(_0x58e3ba){if(_0x58e3ba){return _0x58e3ba['update'](_0x574e9e)[_0x02fc('0x24')](function(_0x1bd8cd){return _0x1bd8cd;});}return null;};}function removeEntity(_0x21ff43,_0x2661e8){return function(_0x56239b){if(_0x56239b){return _0x56239b[_0x02fc('0x25')]()[_0x02fc('0x24')](function(){_0x21ff43[_0x02fc('0x1a')](0xcc)[_0x02fc('0x26')]();});}};}function handleEntityNotFound(_0x582355,_0x82434e){return function(_0x3acfb6){if(!_0x3acfb6){_0x582355[_0x02fc('0x19')](0x194);}return _0x3acfb6;};}function handleError(_0x2234d7,_0x2e773c){_0x2e773c=_0x2e773c||0x1f4;return function(_0x1d5d4b){logger['error'](_0x1d5d4b['stack']);if(_0x1d5d4b[_0x02fc('0x27')]){delete _0x1d5d4b[_0x02fc('0x27')];}_0x2234d7['status'](_0x2e773c)[_0x02fc('0x28')](_0x1d5d4b);};}exports[_0x02fc('0x29')]=function(_0x8d821e,_0x515663){var _0x15f069={},_0x41fe7f={},_0xb21002={'count':0x0,'rows':[]};var _0x243b78=_[_0x02fc('0x2a')](db[_0x02fc('0x2b')][_0x02fc('0x2c')],function(_0x50b646){return{'name':_0x50b646['fieldName'],'type':_0x50b646[_0x02fc('0x2d')][_0x02fc('0x2e')]};});_0x41fe7f['model']=_[_0x02fc('0x2a')](_0x243b78,_0x02fc('0x27'));_0x41fe7f[_0x02fc('0x2f')]=_['keys'](_0x8d821e[_0x02fc('0x2f')]);_0x41fe7f['filters']=_[_0x02fc('0x30')](_0x41fe7f['model'],_0x41fe7f['query']);_0x15f069['attributes']=_['intersection'](_0x41fe7f[_0x02fc('0x31')],qs['fields'](_0x8d821e[_0x02fc('0x2f')][_0x02fc('0x32')]));_0x15f069['attributes']=_0x15f069['attributes'][_0x02fc('0x33')]?_0x15f069['attributes']:_0x41fe7f['model'];if(!_0x8d821e[_0x02fc('0x2f')]['hasOwnProperty'](_0x02fc('0x34'))){_0x15f069['limit']=qs[_0x02fc('0x1b')](_0x8d821e['query'][_0x02fc('0x1b')]);_0x15f069[_0x02fc('0x1e')]=qs['offset'](_0x8d821e[_0x02fc('0x2f')][_0x02fc('0x1e')]);}_0x15f069[_0x02fc('0x35')]=qs[_0x02fc('0x36')](_0x8d821e['query'][_0x02fc('0x36')]);_0x15f069[_0x02fc('0x37')]=qs[_0x02fc('0x38')](_['pick'](_0x8d821e[_0x02fc('0x2f')],_0x41fe7f[_0x02fc('0x38')]),_0x243b78);if(_0x8d821e[_0x02fc('0x2f')][_0x02fc('0x39')]){_0x15f069[_0x02fc('0x37')]=_[_0x02fc('0x3a')](_0x15f069['where'],{'$or':_['map'](_0x243b78,function(_0x49bf00){if(_0x49bf00[_0x02fc('0x2d')]!==_0x02fc('0x3b')){var _0x46fb84={};_0x46fb84[_0x49bf00[_0x02fc('0x27')]]={'$like':'%'+_0x8d821e['query']['filter']+'%'};return _0x46fb84;}})});}_0x15f069=_[_0x02fc('0x3a')]({},_0x15f069,_0x8d821e[_0x02fc('0x3c')]);var _0x1824c5={'where':_0x15f069[_0x02fc('0x37')]};return db['WhatsappTransferReport'][_0x02fc('0x1d')](_0x1824c5)['then'](function(_0x56f4dc){_0xb21002[_0x02fc('0x1d')]=_0x56f4dc;if(_0x8d821e['query'][_0x02fc('0x3d')]){_0x15f069[_0x02fc('0x3e')]=[{'all':!![]}];}return db[_0x02fc('0x2b')][_0x02fc('0x3f')](_0x15f069);})[_0x02fc('0x24')](function(_0x14e67f){_0xb21002[_0x02fc('0x40')]=_0x14e67f;return _0xb21002;})[_0x02fc('0x24')](respondWithFilteredResult(_0x515663,_0x15f069))[_0x02fc('0x41')](handleError(_0x515663,null));};exports['show']=function(_0x5e08a5,_0x5aee0e){var _0xe81961={'raw':!![],'where':{'id':_0x5e08a5[_0x02fc('0x42')]['id']}},_0x11133b={};_0x11133b[_0x02fc('0x31')]=_[_0x02fc('0x43')](db[_0x02fc('0x2b')][_0x02fc('0x2c')]);_0x11133b[_0x02fc('0x2f')]=_[_0x02fc('0x43')](_0x5e08a5[_0x02fc('0x2f')]);_0x11133b[_0x02fc('0x38')]=_[_0x02fc('0x30')](_0x11133b[_0x02fc('0x31')],_0x11133b[_0x02fc('0x2f')]);_0xe81961[_0x02fc('0x44')]=_[_0x02fc('0x30')](_0x11133b[_0x02fc('0x31')],qs[_0x02fc('0x32')](_0x5e08a5[_0x02fc('0x2f')][_0x02fc('0x32')]));_0xe81961[_0x02fc('0x44')]=_0xe81961[_0x02fc('0x44')][_0x02fc('0x33')]?_0xe81961[_0x02fc('0x44')]:_0x11133b['model'];if(_0x5e08a5[_0x02fc('0x2f')][_0x02fc('0x3d')]){_0xe81961[_0x02fc('0x3e')]=[{'all':!![]}];}_0xe81961=_[_0x02fc('0x3a')]({},_0xe81961,_0x5e08a5[_0x02fc('0x3c')]);return db[_0x02fc('0x2b')][_0x02fc('0x45')](_0xe81961)[_0x02fc('0x24')](handleEntityNotFound(_0x5aee0e,null))[_0x02fc('0x24')](respondWithResult(_0x5aee0e,null))[_0x02fc('0x41')](handleError(_0x5aee0e,null));};exports[_0x02fc('0x46')]=function(_0x2ec42c,_0x2ae925){return db['WhatsappTransferReport'][_0x02fc('0x46')](_0x2ec42c[_0x02fc('0x47')],{})['then'](respondWithResult(_0x2ae925,0xc9))[_0x02fc('0x41')](handleError(_0x2ae925,null));};exports[_0x02fc('0x48')]=function(_0x1d2f52,_0x53a4a3){if(_0x1d2f52[_0x02fc('0x47')]['id']){delete _0x1d2f52['body']['id'];}return db[_0x02fc('0x2b')]['find']({'where':{'id':_0x1d2f52[_0x02fc('0x42')]['id']}})[_0x02fc('0x24')](handleEntityNotFound(_0x53a4a3,null))[_0x02fc('0x24')](saveUpdates(_0x1d2f52[_0x02fc('0x47')],null))['then'](respondWithResult(_0x53a4a3,null))[_0x02fc('0x41')](handleError(_0x53a4a3,null));};exports[_0x02fc('0x25')]=function(_0x254cee,_0x3ac4fe){return db[_0x02fc('0x2b')]['find']({'where':{'id':_0x254cee[_0x02fc('0x42')]['id']}})[_0x02fc('0x24')](handleEntityNotFound(_0x3ac4fe,null))[_0x02fc('0x24')](removeEntity(_0x3ac4fe,null))['catch'](handleError(_0x3ac4fe,null));};exports[_0x02fc('0x49')]=function(_0x4df1a3,_0x264ede){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x264ede,null))[_0x02fc('0x41')](handleError(_0x264ede,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 21db353..f6d32b8 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 _0x17cb=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x5acf1d,_0x17f4d3){var _0x380572=function(_0x887ebe){while(--_0x887ebe){_0x5acf1d['push'](_0x5acf1d['shift']());}};_0x380572(++_0x17f4d3);}(_0x17cb,0x1a5));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb17c('0x0'));var util=require(_0xb17c('0x1'));var logger=require(_0xb17c('0x2'))(_0xb17c('0x3'));var moment=require(_0xb17c('0x4'));var BPromise=require(_0xb17c('0x5'));var rp=require(_0xb17c('0x6'));var fs=require('fs');var path=require(_0xb17c('0x7'));var rimraf=require(_0xb17c('0x8'));var config=require(_0xb17c('0x9'));var attributes=require(_0xb17c('0xa'));module['exports']=function(_0xa5d7cf,_0x3e02e4){return _0xa5d7cf[_0xb17c('0xb')](_0xb17c('0xc'),attributes,{'tableName':_0xb17c('0xd'),'paranoid':![],'indexes':[{'name':_0xb17c('0xe'),'fields':[_0xb17c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8ec=['api','moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xd8ec,0x6e));var _0xcd8e=function(_0x261318,_0x47ca22){_0x261318=_0x261318-0x0;var _0x3a479b=_0xd8ec[_0x261318];return _0x3a479b;};'use strict';var _=require(_0xcd8e('0x0'));var util=require(_0xcd8e('0x1'));var logger=require('../../config/logger')(_0xcd8e('0x2'));var moment=require(_0xcd8e('0x3'));var BPromise=require(_0xcd8e('0x4'));var rp=require(_0xcd8e('0x5'));var fs=require('fs');var path=require(_0xcd8e('0x6'));var rimraf=require('rimraf');var config=require(_0xcd8e('0x7'));var attributes=require(_0xcd8e('0x8'));module[_0xcd8e('0x9')]=function(_0xc4f59b,_0x3be1b4){return _0xc4f59b[_0xcd8e('0xa')](_0xcd8e('0xb'),attributes,{'tableName':_0xcd8e('0xc'),'paranoid':![],'indexes':[{'name':_0xcd8e('0xd'),'fields':[_0xcd8e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 073f94c..8f03520 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 _0x09d0=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x09d0,0xe3));var _0x009d=function(_0x7a42d9,_0x5a0c72){_0x7a42d9=_0x7a42d9-0x0;var _0x278b78=_0x09d0[_0x7a42d9];return _0x278b78;};'use strict';var _=require(_0x009d('0x0'));var util=require(_0x009d('0x1'));var moment=require(_0x009d('0x2'));var BPromise=require(_0x009d('0x3'));var rs=require(_0x009d('0x4'));var fs=require('fs');var Redis=require(_0x009d('0x5'));var db=require(_0x009d('0x6'))['db'];var utils=require(_0x009d('0x7'));var logger=require('../../config/logger')(_0x009d('0x8'));var config=require(_0x009d('0x9'));var jayson=require(_0x009d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48663e,_0x3a6619,_0x445c04){return new BPromise(function(_0x47f2dd,_0x430050){return client['request'](_0x48663e,_0x445c04)['then'](function(_0x1290d3){logger['info'](_0x009d('0xb'),_0x3a6619,_0x009d('0xc'));logger[_0x009d('0xd')](_0x009d('0xe'),_0x3a6619,_0x009d('0xc'),JSON['stringify'](_0x1290d3));if(_0x1290d3[_0x009d('0xf')]){if(_0x1290d3['error'][_0x009d('0x10')]===0x1f4){logger[_0x009d('0xf')](_0x009d('0xb'),_0x3a6619,_0x1290d3['error'][_0x009d('0x11')]);return _0x430050(_0x1290d3[_0x009d('0xf')][_0x009d('0x11')]);}logger[_0x009d('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3a6619,_0x1290d3[_0x009d('0xf')][_0x009d('0x11')]);return _0x47f2dd(_0x1290d3[_0x009d('0xf')]['message']);}else{logger[_0x009d('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3a6619,_0x009d('0xc'));_0x47f2dd(_0x1290d3[_0x009d('0x13')]['message']);}})[_0x009d('0x14')](function(_0x17f392){logger[_0x009d('0xf')](_0x009d('0xb'),_0x3a6619,_0x17f392);_0x430050(_0x17f392);});});} \ No newline at end of file +var _0x7e43=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x7e43,0x1bf));var _0x37e4=function(_0x4829a3,_0x39dd5f){_0x4829a3=_0x4829a3-0x0;var _0x59964f=_0x7e43[_0x4829a3];return _0x59964f;};'use strict';var _=require('lodash');var util=require(_0x37e4('0x0'));var moment=require(_0x37e4('0x1'));var BPromise=require(_0x37e4('0x2'));var rs=require(_0x37e4('0x3'));var fs=require('fs');var Redis=require(_0x37e4('0x4'));var db=require(_0x37e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x37e4('0x6'))(_0x37e4('0x7'));var config=require(_0x37e4('0x8'));var jayson=require(_0x37e4('0x9'));var client=jayson[_0x37e4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d4e75,_0x1f6e59,_0x341702){return new BPromise(function(_0x31bf56,_0x4cc894){return client[_0x37e4('0xb')](_0x1d4e75,_0x341702)[_0x37e4('0xc')](function(_0x551308){logger[_0x37e4('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1f6e59,'request\x20sent');logger['debug'](_0x37e4('0xe'),_0x1f6e59,'request\x20sent',JSON['stringify'](_0x551308));if(_0x551308[_0x37e4('0xf')]){if(_0x551308[_0x37e4('0xf')][_0x37e4('0x10')]===0x1f4){logger[_0x37e4('0xf')](_0x37e4('0x11'),_0x1f6e59,_0x551308[_0x37e4('0xf')][_0x37e4('0x12')]);return _0x4cc894(_0x551308[_0x37e4('0xf')][_0x37e4('0x12')]);}logger[_0x37e4('0xf')](_0x37e4('0x11'),_0x1f6e59,_0x551308[_0x37e4('0xf')][_0x37e4('0x12')]);return _0x31bf56(_0x551308[_0x37e4('0xf')][_0x37e4('0x12')]);}else{logger[_0x37e4('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1f6e59,_0x37e4('0x13'));_0x31bf56(_0x551308['result']['message']);}})[_0x37e4('0x14')](function(_0x384d53){logger[_0x37e4('0xf')](_0x37e4('0x11'),_0x1f6e59,_0x384d53);_0x4cc894(_0x384d53);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8741c37..98b1fce 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1db9=['map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','status','online','None','log','App\x20Ready!','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20'];(function(_0x28eeca,_0x5cbe53){var _0x30c7d9=function(_0x28bc89){while(--_0x28bc89){_0x28eeca['push'](_0x28eeca['shift']());}};_0x30c7d9(++_0x5cbe53);}(_0x1db9,0x176));var _0x91db=function(_0x34776f,_0x31bba2){_0x34776f=_0x34776f-0x0;var _0x274757=_0x1db9[_0x34776f];return _0x274757;};'use strict';var _=require(_0x91db('0x0'));var db=require(_0x91db('0x1'))['db'];var seedDb=require(_0x91db('0x2'));var checkLicense=require(_0x91db('0x3'));var rpc=require(_0x91db('0x4'));var config=require(_0x91db('0x5'));var logger=require('./config/logger')(_0x91db('0x6'));var pm2=require(_0x91db('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require(_0x91db('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x91db('0x9'));function main(){return db[_0x91db('0xa')][_0x91db('0xb')]()[_0x91db('0xc')](function(){if(config[_0x91db('0xd')]){return seedDb['default']();}})[_0x91db('0xc')](function(){return checkLicense['default']();})[_0x91db('0xc')](function(){return rpc[_0x91db('0xe')]();})[_0x91db('0xc')](function(_0x5102ab){logger[_0x91db('0xf')](_0x5102ab);return chat['start']();})['then'](function(){return whatsapp['start']();})[_0x91db('0xc')](function(){return schedule[_0x91db('0x10')]();})['then'](function(){return transcribe['start']();})[_0x91db('0xc')](function(){return provider[_0x91db('0x10')]();})[_0x91db('0xc')](function(_0x261721){logger[_0x91db('0xf')](_0x261721);return pm2['start'](pm2Config);})[_0x91db('0xc')](function(_0x285052){var _0x3cadc4=_0x285052[_0x91db('0x11')](function(_0x2df307){return typeof _0x2df307[_0x91db('0x12')]===_0x91db('0x13')&&_0x2df307[_0x91db('0x12')]>=0x0;});if(_0x3cadc4[_0x91db('0x14')]>0x0){throw new Error(_0x3cadc4[_0x91db('0x14')]+_0x91db('0x15')+_[_0x91db('0x16')](_0x3cadc4,function(_0x5f5440){return'\x22'+_0x5f5440[_0x91db('0x17')][_0x91db('0x18')]+'\x22';}));}logger[_0x91db('0xf')](_0x91db('0x19'),_[_0x91db('0x16')](_[_0x91db('0x11')](_0x285052,{'status':'online'}),'name')[_0x91db('0x1a')]());logger[_0x91db('0xf')](_0x91db('0x1b'),_[_0x91db('0x16')](_['filter'](_0x285052,function(_0x168dea){return _0x168dea[_0x91db('0x1c')]!==_0x91db('0x1d');}),_0x91db('0x18'))[_0x91db('0x1a')]()||_0x91db('0x1e'));console[_0x91db('0x1f')](_0x91db('0x20'));})[_0x91db('0x21')](function(_0x31295f){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x31295f);logger[_0x91db('0x22')](_0x91db('0x23'),_0x31295f);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x81bd=['join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x311fd4,_0x2fc056){var _0x2a7835=function(_0x4945e7){while(--_0x4945e7){_0x311fd4['push'](_0x311fd4['shift']());}};_0x2a7835(++_0x2fc056);}(_0x81bd,0x7c));var _0xd81b=function(_0x4e77c6,_0x4c359c){_0x4e77c6=_0x4e77c6-0x0;var _0x3e326c=_0x81bd[_0x4e77c6];return _0x3e326c;};'use strict';var _=require(_0xd81b('0x0'));var db=require(_0xd81b('0x1'))['db'];var seedDb=require(_0xd81b('0x2'));var checkLicense=require(_0xd81b('0x3'));var rpc=require(_0xd81b('0x4'));var config=require(_0xd81b('0x5'));var logger=require(_0xd81b('0x6'))('app');var pm2=require(_0xd81b('0x7'));var pm2Config=require(_0xd81b('0x8'));var schedule=require(_0xd81b('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xd81b('0xa'));var transcribe=require(_0xd81b('0xb'));var provider=require(_0xd81b('0xc'));function main(){return db['sequelize']['sync']()[_0xd81b('0xd')](function(){if(config['seedDB']){return seedDb[_0xd81b('0xe')]();}})[_0xd81b('0xd')](function(){return checkLicense[_0xd81b('0xe')]();})[_0xd81b('0xd')](function(){return rpc[_0xd81b('0xf')]();})[_0xd81b('0xd')](function(_0x4391be){logger[_0xd81b('0x10')](_0x4391be);return chat[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return whatsapp[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return schedule[_0xd81b('0x11')]();})['then'](function(){return transcribe[_0xd81b('0x11')]();})['then'](function(){return provider[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(_0x5f0b6b){logger[_0xd81b('0x10')](_0x5f0b6b);return pm2['start'](pm2Config);})[_0xd81b('0xd')](function(_0x41bf7a){var _0x6c6041=_0x41bf7a[_0xd81b('0x12')](function(_0x128162){return typeof _0x128162['exitCode']===_0xd81b('0x13')&&_0x128162[_0xd81b('0x14')]>=0x0;});if(_0x6c6041['length']>0x0){throw new Error(_0x6c6041[_0xd81b('0x15')]+_0xd81b('0x16')+_[_0xd81b('0x17')](_0x6c6041,function(_0x15e860){return'\x22'+_0x15e860[_0xd81b('0x18')][_0xd81b('0x19')]+'\x22';}));}logger[_0xd81b('0x10')](_0xd81b('0x1a'),_[_0xd81b('0x17')](_[_0xd81b('0x12')](_0x41bf7a,{'status':_0xd81b('0x1b')}),_0xd81b('0x19'))[_0xd81b('0x1c')]());logger[_0xd81b('0x10')](_0xd81b('0x1d'),_[_0xd81b('0x17')](_['filter'](_0x41bf7a,function(_0x4d566e){return _0x4d566e[_0xd81b('0x1e')]!==_0xd81b('0x1b');}),_0xd81b('0x19'))['join']()||_0xd81b('0x1f'));console[_0xd81b('0x20')]('App\x20Ready!');})[_0xd81b('0x21')](function(_0x13d687){console[_0xd81b('0x20')](_0xd81b('0x22'),_0x13d687);logger[_0xd81b('0x23')](_0xd81b('0x24'),_0x13d687);process[_0xd81b('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 4ae598a..5577a83 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 _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0x2d87d8,_0x4cfb62){var _0x398d57=function(_0x36fe43){while(--_0x36fe43){_0x2d87d8['push'](_0x2d87d8['shift']());}};_0x398d57(++_0x4cfb62);}(_0x3e74,0x175));var _0x43e7=function(_0x47936d,_0x146d9a){_0x47936d=_0x47936d-0x0;var _0x1e8aa7=_0x3e74[_0x47936d];return _0x1e8aa7;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0xa9e0=['role','redirect','/dashboards/general','send','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','apiKeyNonce','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','validatePasswordHistory','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','decryptString','length','unshift','encryptString','promisify','payload','options','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','name','userpic','permissions','md5secret','voicePause','chatPause','mailPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','isAuthenticated','headers','startsWith','authorization','Basic','User','find','authenticate','pass','status','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'];(function(_0x29964c,_0x2decf9){var _0xb80e17=function(_0xdb3088){while(--_0xdb3088){_0x29964c['push'](_0x29964c['shift']());}};_0xb80e17(++_0x2decf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var db=require(_0x0a9e('0x0'))['db'];var config=require(_0x0a9e('0x1'));var hardwareConf=require(_0x0a9e('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0x0a9e('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x0a9e('0x4'));var compose=require(_0x0a9e('0x5'));var basicAuth=require(_0x0a9e('0x6'));var crypto=require(_0x0a9e('0x7'));var BPromise=require(_0x0a9e('0x8'));var util=require('util');var moment=require(_0x0a9e('0x9'));var validateJwt=expressJwt({'secret':config[_0x0a9e('0xa')][_0x0a9e('0xb')]});var userAttributes=['id','role','fullname',_0x0a9e('0xc'),'internal','email',_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),_0x0a9e('0x11'),_0x0a9e('0x12'),'faxPause','smsPause','openchannelPause','pauseType',_0x0a9e('0x13'),_0x0a9e('0x14'),_0x0a9e('0x15'),_0x0a9e('0x16'),_0x0a9e('0x17'),_0x0a9e('0x18'),'alias',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'phoneBarExpires',_0x0a9e('0x1f'),'phoneBarRemoteControl',_0x0a9e('0x20'),'hotdesk',_0x0a9e('0x21'),_0x0a9e('0x22'),'privacyEnabled',_0x0a9e('0x23'),'wssPort',_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28'),_0x0a9e('0x29'),_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x0a9e('0x2c'),_0x0a9e('0x2d'),_0x0a9e('0x2e'),_0x0a9e('0x2f'),'openchannelAutoanswerDelay',_0x0a9e('0x30'),_0x0a9e('0x31'),'whatsappAutoanswer',_0x0a9e('0x32')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x0a9e('0x33')](function(_0x432e56,_0x38e7c4,_0x30bae6){if(_0x432e56['user']){_0x30bae6();}else{return db[_0x0a9e('0x34')][_0x0a9e('0x35')]({'where':{'id':_0x432e56[_0x0a9e('0x36')]['id']},'attributes':['id',_0x0a9e('0x37'),_0x0a9e('0x38')],'raw':!![]})[_0x0a9e('0x39')](function(_0x16b1ca){if(_0x16b1ca&&_0x16b1ca['closed']){return _0x38e7c4['status'](_0x16b1ca[_0x0a9e('0x38')]===_0x0a9e('0x3a')?0x195:0x193)[_0x0a9e('0x3b')]({'message':_0x16b1ca[_0x0a9e('0x38')]==='unmanaged'?_0x0a9e('0x3c'):'Forbidden.'});}else{_0x30bae6();}})[_0x0a9e('0x3d')](function(_0x5bfb33){_0x30bae6(_0x5bfb33);});}});};exports[_0x0a9e('0x3e')]=function isAuthenticated(_0x34dc65){return compose()[_0x0a9e('0x33')](function(_0x14433c,_0x140511,_0x1538a4){var _0x11c3b6;if(_0x14433c[_0x0a9e('0x3f')]['authorization']){if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x42'))){var _0x5c877d=basicAuth(_0x14433c);db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'name':_0x5c877d[_0x0a9e('0xc')]}})[_0x0a9e('0x39')](function(_0x58b06f){if(!_0x58b06f||!_0x58b06f[_0x0a9e('0x45')](_0x5c877d[_0x0a9e('0x46')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Wrong\x20credentials.'});}_0x14433c[_0x0a9e('0x48')]={'id':_0x58b06f['id']};_0x1538a4();})['catch'](function(_0x2407f9){_0x1538a4(_0x2407f9);});}else if(_[_0x0a9e('0x40')](_0x14433c[_0x0a9e('0x3f')][_0x0a9e('0x41')],_0x0a9e('0x49'))){validateJwt(_0x14433c,_0x140511,_0x1538a4);}else{if(_0x34dc65){_0x1538a4();}else{return _0x140511['status'](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}}}else if(_0x14433c[_0x0a9e('0x4b')][_0x0a9e('0x4c')]){try{var _0x2b45ea={'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf[_0x0a9e('0x4d')]()};verifyJwt(_0x14433c[_0x0a9e('0x4b')]['apikey'],_0x2b45ea)[_0x0a9e('0x39')](function(_0x5e7238){return db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x5e7238[_0x0a9e('0x4e')]}})[_0x0a9e('0x39')](function(_0x567193){_0x11c3b6=_0x567193;return db[_0x0a9e('0x4f')][_0x0a9e('0x35')]({'where':{'id':0x1},'attributes':[_0x0a9e('0x50'),_0x0a9e('0x51')],'raw':!![]});})['then'](function(_0x54135e){if(!_0x11c3b6||!_[_0x0a9e('0x52')](_0x11c3b6['apiKeyNonce'],_0x5e7238[_0x0a9e('0x53')])){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x54')});}if(_0x11c3b6['disabled']){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}if(_0x11c3b6['blocked']){if(_0x54135e[_0x0a9e('0x51')]>0x0){if(moment(_0x11c3b6[_0x0a9e('0x56')])[_0x0a9e('0x57')](_0x54135e['blockDuration'],'minutes')>moment()){return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x140511[_0x0a9e('0x47')](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});}}_0x14433c[_0x0a9e('0x48')]={'id':_0x11c3b6['id']};_0x1538a4();});})['catch'](function(){return _0x140511['status'](0x191)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x55')});});}catch(_0x53f3ee){_0x1538a4(_0x53f3ee);}}else if(_0x34dc65){_0x1538a4();}else{return _0x140511[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x4a')});}})['use'](function(_0x316c8f,_0x2cfea9,_0x274e8e){if(_0x316c8f[_0x0a9e('0x48')]){db[_0x0a9e('0x43')][_0x0a9e('0x44')]({'where':{'id':_0x316c8f[_0x0a9e('0x48')]['id']},'attributes':userAttributes})[_0x0a9e('0x39')](function(_0x23b089){if(!_0x23b089){return _0x2cfea9[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x58')});}_0x316c8f[_0x0a9e('0x48')]=_0x23b089;_0x274e8e();})[_0x0a9e('0x3d')](function(_0x37f6cc){_0x274e8e(_0x37f6cc);});}else if(_0x34dc65){_0x274e8e();}else{return _0x2cfea9['status'](0x194)['json']({'message':_0x0a9e('0x59')});}});};exports[_0x0a9e('0x5a')]=function canUpdate(){return compose()[_0x0a9e('0x33')](function(_0x315881,_0x1a69dd,_0xc9a702){return licenseUtil[_0x0a9e('0x5b')]()[_0x0a9e('0x39')](function(_0x432fcc){if(_0x432fcc[_0x0a9e('0x5c')]){_0xc9a702();}else{return _0x1a69dd[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':'Forbidden'});}})[_0x0a9e('0x3d')](function(_0x138b8b){_0xc9a702(_0x138b8b);});});};exports[_0x0a9e('0x5d')]=function isWebrtcLicence(){return compose()[_0x0a9e('0x33')](function(_0x2e8caf,_0xbe9d19,_0x21eb86){return licenseUtil[_0x0a9e('0x5b')]()['then'](function(_0x2e9d90){if(_0x2e9d90['webrtc']){_0x21eb86();}else{return _0xbe9d19[_0x0a9e('0x47')](0x193)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x5e')});}})['catch'](function(_0x14bec2){_0x21eb86(_0x14bec2);});});};exports[_0x0a9e('0x5f')]=function(_0x4774f4,_0x34aa5a,_0x45c845){_0x4774f4[_0x0a9e('0x5f')]=!![];return _0x45c845();};exports[_0x0a9e('0x60')]=function signToken(_0x5bbcde){return signJwt(_0x5bbcde);};exports[_0x0a9e('0x61')]=function(_0x1bde3c,_0x1b5e80){if(!_0x1bde3c[_0x0a9e('0x48')]){return _0x1b5e80[_0x0a9e('0x47')](0x194)[_0x0a9e('0x3b')]({'message':_0x0a9e('0x62')});}var _0x19383e={'payload':{'id':_0x1bde3c[_0x0a9e('0x48')]['id'],'role':_0x1bde3c['user'][_0x0a9e('0x63')]},'options':{'expiresIn':0x15180}};return signJwt(_0x19383e)[_0x0a9e('0x39')](function(_0x4f7240){_0x1b5e80['cookie']('motion.token',_0x4f7240);_0x1b5e80[_0x0a9e('0x64')](_0x0a9e('0x65'));})[_0x0a9e('0x3d')](function(_0x11545a){return _0x1b5e80[_0x0a9e('0x47')](0x1f4)[_0x0a9e('0x66')](_0x11545a);});};exports[_0x0a9e('0x67')]=function(_0x375c18){if(_['isNil'](_0x375c18['apiKeyNonce'])||_['isNil'](_0x375c18[_0x0a9e('0x68')])){return null;}else{return createJwt(_0x375c18);}};exports[_0x0a9e('0x69')]=function(_0x14d602){_0x14d602['apiKeyNonce']=generateNonce();_0x14d602[_0x0a9e('0x68')]=generateIssuedAt();return createJwt(_0x14d602);};exports[_0x0a9e('0x6a')]=function(_0x53d113,_0x5a88da){var _0x2ef381=_0x53d113['query'][_0x0a9e('0x4c')];if(_0x2ef381){var _0x4c3845={'nonce':_0x5a88da[_0x0a9e('0x6b')],'iat':_0x5a88da[_0x0a9e('0x68')],'audience':hardwareConf[_0x0a9e('0x4d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x2ef381,_0x4c3845)[_0x0a9e('0x39')](function(){return generateApiKey(_0x5a88da);});}else{throw{'message':_0x0a9e('0x6c')};}};exports['validatePasswordPattern']=function(_0x50f687){var _0x128aa6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x128aa6[_0x0a9e('0x6d')](_0x50f687))throw new db['Sequelize'][(_0x0a9e('0x6e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x0a9e('0x6f')]=function(_0x523cd2,_0xe22ccc,_0x4a6deb){var _0x5da27d=encryptor['decryptString'](_0xe22ccc)[_0x0a9e('0x70')](',');for(var _0x47de4c=0x0;_0x47de4c<_0x4a6deb;_0x47de4c++){if(!_0x5da27d[_0x47de4c])break;if(_0x523cd2[_0x0a9e('0x71')]()===_0x5da27d[_0x47de4c][_0x0a9e('0x71')]()){var _0x3cfd00=util[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x4a6deb);if(_0x4a6deb===0x1){_0x3cfd00=_0x0a9e('0x74');}throw new db[(_0x0a9e('0x75'))][(_0x0a9e('0x6e'))](_0x3cfd00);}}return;};exports['updatePasswordsHistory']=function(_0x1c693e,_0x121cef){var _0x2642bb=_0x121cef?encryptor[_0x0a9e('0x76')](_0x121cef)[_0x0a9e('0x70')](','):[];if(_0x2642bb[_0x0a9e('0x77')]===0x5){_0x2642bb['splice'](-0x1,0x1);}_0x2642bb[_0x0a9e('0x78')](_0x1c693e);return encryptor[_0x0a9e('0x79')](_0x2642bb['join'](','));};function signJwt(_0x3649cc){var _0x5cc8fb=BPromise[_0x0a9e('0x7a')](jwt['sign'],{'context':jwt});var _0x4b3c1a=_0x3649cc['secret']||config[_0x0a9e('0xa')]['session'];return new BPromise(function(_0x2244d6,_0x1fc70e){_0x5cc8fb(_0x3649cc[_0x0a9e('0x7b')],_0x4b3c1a,_0x3649cc[_0x0a9e('0x7c')])[_0x0a9e('0x39')](function(_0x26d7db){_0x2244d6(_0x26d7db);})['catch'](function(_0x1627a7){_0x1fc70e(_0x1627a7);});});}function verifyJwt(_0x5854cc,_0xca4ade,_0x1f07cb){var _0x51aaf7=BPromise['promisify'](jwt[_0x0a9e('0x7d')],{'context':jwt});var _0x156f1c=_0x1f07cb||config[_0x0a9e('0xa')][_0x0a9e('0xb')];return new BPromise(function(_0x497d91,_0x1d0dc8){_0x51aaf7(_0x5854cc,_0x156f1c,_0xca4ade)[_0x0a9e('0x39')](function(_0x54327c){_0x497d91(_0x54327c);})[_0x0a9e('0x3d')](function(_0x17e88c){_0x1d0dc8(_0x17e88c);});});}function generateNonce(){return crypto[_0x0a9e('0x7e')](0x10)[_0x0a9e('0x7f')](_0x0a9e('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x0a9e('0x81')]()/0x3e8)[_0x0a9e('0x7f')]();}function createJwt(_0x281c7d){var _0x47bb43={'payload':{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x281c7d['id'][_0x0a9e('0x7f')](),'issuer':hardwareConf[_0x0a9e('0x4d')](),'audience':hardwareConf[_0x0a9e('0x4d')]()}};return signJwt(_0x47bb43)[_0x0a9e('0x39')](function(_0x186f39){return{'iat':_0x281c7d[_0x0a9e('0x68')],'nonce':_0x281c7d[_0x0a9e('0x6b')],'token':_0x186f39};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 54fa977..b9e9c87 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 _0xbaf0=['skip','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','startsWith','slice','length','cf_','type','map','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','fields','filter','clause','tags','user'];(function(_0x689ce6,_0xfacbbb){var _0x29d110=function(_0x49d6e2){while(--_0x49d6e2){_0x689ce6['push'](_0x689ce6['shift']());}};_0x29d110(++_0xfacbbb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0baf('0x0'));var db=require(_0x0baf('0x1'))['db'];exports[_0x0baf('0x2')]=function(_0x263f79,_0x1688bc,_0x4d2e72,_0x5a3e42){var _0x232cc7={'count':0x0,'rows':[]};var _0x1c383e=sqlUtils[_0x0baf('0x3')](_0x1688bc,_0x263f79);if(_0x1c383e){return Promise[_0x0baf('0x4')](_0x232cc7);}var _0xe4c3c4=sqlUtils[_0x0baf('0x5')]();var _0x1a10b1={};var _0x2dcaac=![];var _0x1d0a0d=![];return Promise['resolve']()[_0x0baf('0x6')](function(){if(_0x263f79['search']){return sqlUtils[_0x0baf('0x7')](_0x263f79[_0x0baf('0x8')],_0x5a3e42);}else{return sqlUtils[_0x0baf('0x9')](_0x263f79,_0x5a3e42);}})[_0x0baf('0x6')](function(_0x7f54d4){_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xb')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xc')]);_0xe4c3c4[_0x0baf('0xa')](_0x7f54d4[_0x0baf('0xd')]);_0xe4c3c4['where'](_0x7f54d4['user'][_0x0baf('0xe')]);_0x1a10b1=_0x7f54d4[_0x0baf('0xf')];_0x1d0a0d=_0x7f54d4[_0x0baf('0x10')][_0x0baf('0x11')];return sqlUtils['checkListsRestrictions'](_0x1688bc,_0x263f79,_0x1d0a0d);})[_0x0baf('0x6')](function(_0x49e44b){_0xe4c3c4[_0x0baf('0xa')](_0x49e44b);var _0x1f50c3=_0x263f79[_0x0baf('0x8')]?_0x1a10b1[_0x0baf('0x12')]:_0x263f79[_0x0baf('0x13')];_0x2dcaac=_0x1f50c3?!![]:![];return sqlUtils[_0x0baf('0x14')](_0xe4c3c4,_0x1f50c3);})['then'](function(_0x4cd79d){_0x232cc7[_0x0baf('0x15')]=_0x4cd79d;if(_0x232cc7[_0x0baf('0x15')]===0x0){return;}return sqlUtils[_0x0baf('0x16')](_0xe4c3c4,_0x263f79[_0x0baf('0xc')],_0x4d2e72,_0x2dcaac,_0x1a10b1[_0x0baf('0xe')],_0x1d0a0d);})[_0x0baf('0x6')](function(_0x53c338){if(!_0x53c338){return[];}return sqlUtils[_0x0baf('0x17')](_0x53c338,_0x263f79,_0x4d2e72);})[_0x0baf('0x6')](function(_0x1ef0e5){_0x232cc7[_0x0baf('0x18')]=_0x1ef0e5;return _0x232cc7;})[_0x0baf('0x19')](function(_0x42b7f2){throw _0x42b7f2;});};exports['describe']=function(){var _0x5cff5d={};var _0x1410ec=[];return db[_0x0baf('0x1a')][_0x0baf('0x1b')]()[_0x0baf('0x6')](function(_0x1fa92b){_0x5cff5d=_0x1fa92b;var _0x3e3e20=Object[_0x0baf('0x1c')](_0x5cff5d)[_0x0baf('0xd')](function(_0x2c42e2){return _[_0x0baf('0x1d')](_0x2c42e2,'cf_')?_0x2c42e2:undefined;});var _0x334bd6=_0x3e3e20['map'](function(_0xf6c158){return db['CmCustomField']['findOne']({'where':{'id':_0xf6c158[_0x0baf('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x334bd6);})['then'](function(_0x47c4b){for(var _0x27b59c=0x0;_0x27b59c<_0x47c4b[_0x0baf('0x1f')];_0x27b59c++){if(_0x47c4b[_0x27b59c]){var _0x19d9fd=_0x0baf('0x20')+_0x47c4b[_0x27b59c]['id'];_0x5cff5d[_0x19d9fd]['fieldType']=_0x47c4b[_0x27b59c][_0x0baf('0x21')];}}_0x1410ec=_[_0x0baf('0x22')](Object[_0x0baf('0x1c')](_0x5cff5d),function(_0x366e71){return{'name':_0x366e71,'type':_0x5cff5d[_0x366e71][_0x0baf('0x21')]};});return _0x1410ec;})[_0x0baf('0x19')](function(_0x453525){throw _0x453525;});}; \ No newline at end of file +var _0xb10b=['user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter'];(function(_0x422bd6,_0x235eb0){var _0x294032=function(_0x2af909){while(--_0x2af909){_0x422bd6['push'](_0x422bd6['shift']());}};_0x294032(++_0x235eb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a864,_0x3303e2){_0x50a864=_0x50a864-0x0;var _0x2fb82f=_0xb10b[_0x50a864];return _0x2fb82f;};'use strict';var _=require(_0xbb10('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xbb10('0x1'))['db'];exports[_0xbb10('0x2')]=function(_0x1dcb08,_0x4d688c,_0x4541ae,_0x9bbed){var _0x460981={'count':0x0,'rows':[]};var _0x22320e=sqlUtils[_0xbb10('0x3')](_0x4d688c,_0x1dcb08);if(_0x22320e){return Promise[_0xbb10('0x4')](_0x460981);}var _0x481979=sqlUtils[_0xbb10('0x5')]();var _0x3cdd53={};var _0x513741=![];var _0x1b9e94=![];return Promise[_0xbb10('0x4')]()[_0xbb10('0x6')](function(){if(_0x1dcb08[_0xbb10('0x7')]){return sqlUtils[_0xbb10('0x8')](_0x1dcb08[_0xbb10('0x7')],_0x9bbed);}else{return sqlUtils[_0xbb10('0x9')](_0x1dcb08,_0x9bbed);}})[_0xbb10('0x6')](function(_0x5ab04a){_0x481979['where'](_0x5ab04a[_0xbb10('0xa')]);_0x481979[_0xbb10('0xb')](_0x5ab04a[_0xbb10('0xc')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xd')]);_0x481979['where'](_0x5ab04a[_0xbb10('0xe')][_0xbb10('0xf')]);_0x3cdd53=_0x5ab04a[_0xbb10('0x10')];_0x1b9e94=_0x5ab04a[_0xbb10('0xe')][_0xbb10('0x11')];return sqlUtils[_0xbb10('0x12')](_0x4d688c,_0x1dcb08,_0x1b9e94);})['then'](function(_0x26e021){_0x481979[_0xbb10('0xb')](_0x26e021);var _0x45b9d6=_0x1dcb08[_0xbb10('0x7')]?_0x3cdd53[_0xbb10('0x13')]:_0x1dcb08[_0xbb10('0x14')];_0x513741=_0x45b9d6?!![]:![];return sqlUtils[_0xbb10('0x15')](_0x481979,_0x45b9d6);})[_0xbb10('0x6')](function(_0x3e26f4){_0x460981[_0xbb10('0x16')]=_0x3e26f4;if(_0x460981['count']===0x0){return;}return sqlUtils[_0xbb10('0x17')](_0x481979,_0x1dcb08[_0xbb10('0xc')],_0x4541ae,_0x513741,_0x3cdd53[_0xbb10('0xf')],_0x1b9e94);})[_0xbb10('0x6')](function(_0x378da8){if(!_0x378da8){return[];}return sqlUtils[_0xbb10('0x18')](_0x378da8,_0x1dcb08,_0x4541ae);})[_0xbb10('0x6')](function(_0x30efc6){_0x460981[_0xbb10('0x19')]=_0x30efc6;return _0x460981;})[_0xbb10('0x1a')](function(_0x48b6e9){throw _0x48b6e9;});};exports[_0xbb10('0x1b')]=function(){var _0x19f48d={};var _0x388fab=[];return db[_0xbb10('0x1c')][_0xbb10('0x1b')]()[_0xbb10('0x6')](function(_0x4deb49){_0x19f48d=_0x4deb49;var _0x12f888=Object[_0xbb10('0x1d')](_0x19f48d)['filter'](function(_0x4c4b0d){return _[_0xbb10('0x1e')](_0x4c4b0d,_0xbb10('0x1f'))?_0x4c4b0d:undefined;});var _0x2e911d=_0x12f888[_0xbb10('0x20')](function(_0x445761){return db[_0xbb10('0x21')][_0xbb10('0x22')]({'where':{'id':_0x445761[_0xbb10('0x23')](0x3)},'raw':!![]});});return Promise[_0xbb10('0x24')](_0x2e911d);})[_0xbb10('0x6')](function(_0x3ba6cd){for(var _0x26ad93=0x0;_0x26ad93<_0x3ba6cd['length'];_0x26ad93++){if(_0x3ba6cd[_0x26ad93]){var _0x4fedac='cf_'+_0x3ba6cd[_0x26ad93]['id'];_0x19f48d[_0x4fedac][_0xbb10('0x25')]=_0x3ba6cd[_0x26ad93][_0xbb10('0x26')];}}_0x388fab=_[_0xbb10('0x20')](Object['keys'](_0x19f48d),function(_0x2fdde9){return{'name':_0x2fdde9,'type':_0x19f48d[_0x2fdde9][_0xbb10('0x26')]};});return _0x388fab;})[_0xbb10('0x1a')](function(_0x1d5e95){throw _0x1d5e95;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d96f34e..1026a32 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 _0xffe1=['parseSearch','sqlOperator','conditions','length','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','Tag','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','name','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','having','order','subqry.','from','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','split','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','deletedAt','forEach','TagIds','field','expr','getSelectedTags','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?'];(function(_0x5ee70f,_0x39f1e1){var _0x48335c=function(_0x613932){while(--_0x613932){_0x5ee70f['push'](_0x5ee70f['shift']());}};_0x48335c(++_0x39f1e1);}(_0xffe1,0x187));var _0x1ffe=function(_0x1715d3,_0x379a40){_0x1715d3=_0x1715d3-0x0;var _0x2290f6=_0xffe1[_0x1715d3];return _0x2290f6;};'use strict';var _=require(_0x1ffe('0x0'));var squel=require(_0x1ffe('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x1ffe('0x2'));var utils=require('../interaction/utils');var db=require(_0x1ffe('0x3'))['db'];function skipContactsQuery(_0x492bbc,_0x26b457){var _0x15e0d1=![];if(_0x492bbc[_0x1ffe('0x4')]===_0x1ffe('0x5')&&!_0x26b457[_0x1ffe('0x6')]&&!_0x26b457[_0x1ffe('0x7')]&&_0x26b457[_0x1ffe('0x8')]!==_0x1ffe('0x9')){_0x15e0d1=!![];}return _0x15e0d1;}function getContactsSubquery(){return squel[_0x1ffe('0xa')]()['from'](_0x1ffe('0xb'),'c')['where'](_0x1ffe('0xc'));}function applyJoinClauses(_0x5cb212,_0x29f784){var _0x5b21eb=_0x29f784?'c':_0x1ffe('0xd');_0x5cb212[_0x1ffe('0xe')](_0x1ffe('0xf'),'uc',_0x1ffe('0x10')+_0x5b21eb+_0x1ffe('0x11'))[_0x1ffe('0xe')](_0x1ffe('0x12'),'ct',_0x1ffe('0x13')+_0x5b21eb+_0x1ffe('0x11'))['left_join']('tools_tags','t',_0x1ffe('0x14'));return _0x5cb212;}function addFieldsToQuery(_0x32c382,_0x4669e4,_0x2e585f,_0x17360b,_0x3470a8){var _0x3fc73c=_0x3470a8?'c':'subqry';if(!_0x4669e4){_0x4669e4=['id',_0x1ffe('0x15'),_0x1ffe('0x16'),_0x1ffe('0x17'),_0x1ffe('0x18'),_0x1ffe('0x19'),_0x1ffe('0x1a'),_0x1ffe('0x7'),'CompanyId','createdAt','updatedAt',_0x1ffe('0x1b'),'TagIds'];}var _0x37ce73=_0x2e585f&&_0x3470a8||!_0x2e585f&&!_0x3470a8;if(_0x17360b){_0x37ce73=_0x17360b&&_0x3470a8||!_0x17360b&&!_0x3470a8;}_0x4669e4[_0x1ffe('0x1c')](function(_0x762656){if(_0x762656===_0x1ffe('0x1d')){if(_0x37ce73){_0x32c382[_0x1ffe('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x762656);}else if(_0x2e585f||_0x17360b){_0x32c382[_0x1ffe('0x1e')](_0x3fc73c+'.'+_0x762656);}}else{_0x32c382[_0x1ffe('0x1e')](_0x3fc73c+'.'+_0x762656);}});return _0x32c382;}function getSqlClauses(){var _0x473018={'default':squel[_0x1ffe('0x1f')](),'fields':squel[_0x1ffe('0x1f')](),'filter':squel[_0x1ffe('0x1f')](),'tags':{'clause':squel[_0x1ffe('0x1f')](),'ids':null},'user':{'clause':squel[_0x1ffe('0x1f')](),'skip':![]}};return _0x473018;}function parseTagParameter(_0x400160){var _0x5a232d=squel['expr']();if(_0x400160){var _0x161c9e=utils[_0x1ffe('0x20')](_0x400160);_0x161c9e[_0x1ffe('0x1c')](function(_0xcf23c1){_0x5a232d['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xcf23c1+',%');});}return _0x5a232d;}function parseSearchFilter(_0x5c5515){var _0x42fb48=squel['expr']();if(_0x5c5515){var _0x49d68b=_0x5c5515[_0x1ffe('0x21')]('\x5c','\x5c\x5c')[_0x1ffe('0x21')](/'/g,'\x27\x27');if(_0x49d68b['split']('\x20')['length']>0x1){_0x42fb48['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1ffe('0x22')](_0x49d68b),null);}else{if(qs[_0x1ffe('0x23')](_0x49d68b)){_0x42fb48['or'](_0x1ffe('0x24'),_0x49d68b+'%');_0x42fb48['or'](_0x1ffe('0x25'),_0x49d68b+'%');_0x42fb48['or']('c.mobile\x20LIKE\x20?',_0x49d68b+'%');_0x42fb48['or'](_0x1ffe('0x26'),_0x49d68b+'%');}else if(qs['isEmail'](_0x49d68b)){_0x42fb48['or'](_0x1ffe('0x27'),_0x49d68b+'%');}else{_0x42fb48['or']('c.firstName\x20LIKE\x20?','%'+_0x49d68b+'%');_0x42fb48['or'](_0x1ffe('0x28'),'%'+_0x49d68b+'%');_0x42fb48['or'](_0x1ffe('0x27'),'%'+_0x49d68b+'%');}}}return _0x42fb48;}function parseAdvancedSearchFilter(_0xf9381f,_0x246e86){var _0x56bee3=getSqlClauses();var _0x820365=as[_0x1ffe('0x29')](_0xf9381f);var _0x460046=_0x820365[_0x1ffe('0x2a')];for(var _0x1c57ca=0x0;_0x1c57ca<_0x820365[_0x1ffe('0x2b')][_0x1ffe('0x2c')];_0x1c57ca++){var _0x36feeb=_0x820365[_0x1ffe('0x2b')][_0x1c57ca];var _0x1edb78='c';var _0x1e697f=_[_0x1ffe('0x2d')](_0x246e86,['name',_0x36feeb[_0x1ffe('0x1e')]]);if(_0x1e697f){if(_0x36feeb[_0x1ffe('0x1e')]===_0x1ffe('0x2e')||_0x1e697f[_0x1ffe('0x2f')]===_0x1ffe('0x30')){_0x36feeb[_0x1ffe('0x31')]=_0x1ffe('0x32');}var _0x200669=as[_0x1ffe('0x33')](_0x1edb78,_0x1e697f[_0x1ffe('0x34')],_0x36feeb);_0x56bee3[_0x1ffe('0x35')][_0x460046](_0x200669[_0x1ffe('0x36')],_0x200669[_0x1ffe('0x37')][_0x1ffe('0x38')],_0x200669[_0x1ffe('0x37')]['end']);}else{if(_0x36feeb[_0x1ffe('0x1e')]===_0x1ffe('0x39')){var _0x5138cd=_0x36feeb['value']['split'](',')[_0x1ffe('0x3a')](function(_0x259ebf){return Number(_0x259ebf);});var _0x2b56a3=parseTagParameter(_0x5138cd);_0x56bee3['tags'][_0x1ffe('0x3b')][_0x1ffe('0x3c')](_0x2b56a3);_0x56bee3[_0x1ffe('0x3d')][_0x1ffe('0x3e')]=_0x5138cd;}else if(_0x36feeb[_0x1ffe('0x1e')]===_0x1ffe('0x3f')){_0x56bee3[_0x1ffe('0x40')][_0x1ffe('0x3b')]['and'](_0x1ffe('0x41'),_0x36feeb[_0x1ffe('0x37')]);_0x56bee3['user'][_0x1ffe('0x42')]=!![];}}}return _0x56bee3;}function parseModelFields(_0xaa6389,_0x16bb07){var _0x2f072b=squel[_0x1ffe('0x1f')]();var _0x50220f=_(_0xaa6389)[_0x1ffe('0x43')]()[_0x1ffe('0x3a')](function(_0x1b405a){return _[_0x1ffe('0x44')](_0x16bb07,[_0x1ffe('0x45'),_0x1b405a])?_0x1b405a:undefined;})['compact']()[_0x1ffe('0x37')]();if(_0xaa6389[_0x1ffe('0x46')]){_0x50220f[_0x1ffe('0x47')](_0x1ffe('0x46'));}if(_0x50220f[_0x1ffe('0x2c')]>0x0){_0x50220f[_0x1ffe('0x1c')](function(_0xcbda53){if(_0xcbda53===_0x1ffe('0x7')){_0x2f072b[_0x1ffe('0x3c')](_0x1ffe('0x48'),[][_0x1ffe('0x49')](_0xaa6389[_0xcbda53]));}else if(_0xcbda53===_0x1ffe('0x46')){var _0x2935f='%'+_0xaa6389[_0xcbda53]+'%';_0x2f072b[_0x1ffe('0x3c')](_0x1ffe('0x4a'),_0x2935f);}else{_0x2f072b[_0x1ffe('0x3c')]('c.'+_0xcbda53+_0x1ffe('0x4b'),_0xaa6389[_0xcbda53]);}});}return _0x2f072b;}function parseQueryParameters(_0x204362,_0x121d8d){var _0x2ed943=getSqlClauses();return Promise['resolve']()[_0x1ffe('0x4c')](function(){return parseModelFields(_0x204362,_0x121d8d);})[_0x1ffe('0x4c')](function(_0x45a497){_0x2ed943['fields'][_0x1ffe('0x3c')](_0x45a497);return parseTagParameter(_0x204362[_0x1ffe('0x4d')]);})[_0x1ffe('0x4c')](function(_0x1336d9){_0x2ed943[_0x1ffe('0x3d')][_0x1ffe('0x3b')][_0x1ffe('0x3c')](_0x1336d9);return parseSearchFilter(_0x204362[_0x1ffe('0x4e')]);})[_0x1ffe('0x4c')](function(_0x4146e6){_0x2ed943['filter']=_0x4146e6;return _0x2ed943;});}function checkListsRestrictions(_0x712595,_0xaaae8c,_0x1dab77){var _0x381aeb=squel[_0x1ffe('0x1f')]();return Promise[_0x1ffe('0x4f')]()['then'](function(){if(_0xaaae8c['search']&&_0x712595[_0x1ffe('0x4')]===_0x1ffe('0x5')&&!_0x1dab77){return _0x712595[_0x1ffe('0x50')]({'attributes':['id'],'raw':!![]});}})[_0x1ffe('0x4c')](function(_0x26ab42){if(_0x26ab42){if(_0x26ab42['length']===0x0){_0x381aeb['and'](_0x1ffe('0x51'));}else{_0x381aeb[_0x1ffe('0x3c')](_0x1ffe('0x48'),_['map'](_0x26ab42,'id'));}}})['then'](function(){return _0x381aeb;});}function buildContactsQuery(_0xe908b6,_0x42f220,_0xffb04c,_0x2ee214,_0x258a79,_0x370a57){if(_0x42f220){_0x42f220=_0xffb04c[_0x1ffe('0x52')];}_0xe908b6=addFieldsToQuery(_0xe908b6,_0x42f220,_0x2ee214,_0x370a57,!![]);var _0x4c8961=squel[_0x1ffe('0xa')]();_0x4c8961=addFieldsToQuery(_0x4c8961,_0x42f220,_0x2ee214,_0x370a57,![]);if(_0x2ee214||_0x370a57){_0xe908b6=applyJoinClauses(_0xe908b6,!![]);_0xe908b6['group'](_0x1ffe('0x53'));if(_0xffb04c[_0x1ffe('0x54')]){_0x4c8961[_0x1ffe('0x54')](_0xffb04c[_0x1ffe('0x54')]);}if(_0xffb04c[_0x1ffe('0x55')]){_0x4c8961[_0x1ffe('0x55')](_0xffb04c[_0x1ffe('0x55')]);}}else{_0x4c8961=applyJoinClauses(_0x4c8961,![]);_0x4c8961[_0x1ffe('0x56')](_0x1ffe('0x57'));if(_0xffb04c['limit']){_0xe908b6['limit'](_0xffb04c[_0x1ffe('0x54')]);}if(_0xffb04c[_0x1ffe('0x55')]){_0xe908b6['offset'](_0xffb04c[_0x1ffe('0x55')]);}}_0x4c8961[_0x1ffe('0x58')](_0x258a79);if(_0xffb04c[_0x1ffe('0x59')]){_0xffb04c['order']['forEach'](function(_0x116be0){_0xe908b6[_0x1ffe('0x59')]('c.'+_0x116be0[0x0],_0x116be0[0x1]==='DESC'?![]:!![]);_0x4c8961['order'](_0x1ffe('0x5a')+_0x116be0[0x0],_0x116be0[0x1]==='DESC'?![]:!![]);});}_0x4c8961[_0x1ffe('0x5b')](_0xe908b6,_0x1ffe('0xd'));return _0x4c8961;}function getFilteredContacts(_0x1d8f5a){var _0x5a0377=[];return db[_0x1ffe('0x39')][_0x1ffe('0x5c')]({'attributes':['id',_0x1ffe('0x45'),_0x1ffe('0x5d')],'raw':!![]})[_0x1ffe('0x4c')](function(_0x276d97){_0x5a0377=_['keyBy'](_0x276d97,'id');var _0x59e7aa={'type':db[_0x1ffe('0x5e')][_0x1ffe('0x5f')][_0x1ffe('0x60')],'model':db[_0x1ffe('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x1ffe('0x62')]['query'](_0x1d8f5a[_0x1ffe('0x63')](),_0x59e7aa);})[_0x1ffe('0x4c')](function(_0x269725){_0x269725['forEach'](function(_0x1fc23d){if(_0x1fc23d[_0x1ffe('0x1d')]){_0x1fc23d[_0x1ffe('0x64')]=[];_0x1fc23d[_0x1ffe('0x1d')][_0x1ffe('0x65')](',')[_0x1ffe('0x1c')](function(_0x5da9be){_0x1fc23d[_0x1ffe('0x64')][_0x1ffe('0x47')](_0x5a0377[_0x5da9be]);});}delete _0x1fc23d[_0x1ffe('0x1d')];});return _0x269725;});}function countFilteredContacts(_0x24d92a,_0x3194e6){var _0x6489fe=_0x24d92a[_0x1ffe('0x66')]();_0x6489fe[_0x1ffe('0x1e')](_0x1ffe('0x67'));_0x6489fe=applyJoinClauses(_0x6489fe,!![]);_0x24d92a[_0x1ffe('0x56')](_0x1ffe('0x53'));var _0x21de5a=utils['getSelectedTags'](_0x3194e6);if(!_[_0x1ffe('0x68')](_0x21de5a)){_0x6489fe[_0x1ffe('0x69')](_0x1ffe('0x6a'),_0x21de5a);}var _0x5d8372={'type':db[_0x1ffe('0x5e')][_0x1ffe('0x5f')][_0x1ffe('0x60')],'raw':!![]};return db[_0x1ffe('0x62')]['query'](_0x6489fe[_0x1ffe('0x63')](),_0x5d8372)['then'](function(_0xd3a77b){return _0xd3a77b[0x0][_0x1ffe('0x67')];});}module[_0x1ffe('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x8b29=['autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','phone','mobile','fax','createdAt','updatedAt','deletedAt','TagIds','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','length','name','dateOfBirth','castTo','DATE','buildExpression','type','default','value','start','end','Tag','split','map','tags','ids','User','user','clause','uc.UserId\x20=\x20?','skip','keys','Contact','push','and','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','then','fields','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','QueryTypes','exports','lodash','../parsers/advancedSearch','../parsers/qs','role','search','ListId'];(function(_0x65f140,_0x45cbc7){var _0x18fbda=function(_0x26fb39){while(--_0x26fb39){_0x65f140['push'](_0x65f140['shift']());}};_0x18fbda(++_0x45cbc7);}(_0x8b29,0xbe));var _0x98b2=function(_0x94a3c8,_0x17ffe5){_0x94a3c8=_0x94a3c8-0x0;var _0x3e3949=_0x8b29[_0x94a3c8];return _0x3e3949;};'use strict';var _=require(_0x98b2('0x0'));var squel=require('squel');var as=require(_0x98b2('0x1'));var qs=require(_0x98b2('0x2'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2363fe,_0x20afa9){var _0x5bf7df=![];if(_0x2363fe[_0x98b2('0x3')]==='agent'&&!_0x20afa9[_0x98b2('0x4')]&&!_0x20afa9[_0x98b2('0x5')]&&_0x20afa9[_0x98b2('0x6')]!==_0x98b2('0x7')){_0x5bf7df=!![];}return _0x5bf7df;}function getContactsSubquery(){return squel[_0x98b2('0x8')]()[_0x98b2('0x9')](_0x98b2('0xa'),'c')[_0x98b2('0xb')](_0x98b2('0xc'));}function applyJoinClauses(_0x4481b3,_0x501b51){var _0x48a17e=_0x501b51?'c':_0x98b2('0xd');_0x4481b3[_0x98b2('0xe')](_0x98b2('0xf'),'uc',_0x98b2('0x10')+_0x48a17e+_0x98b2('0x11'))[_0x98b2('0xe')]('cm_contact_has_tags','ct',_0x98b2('0x12')+_0x48a17e+_0x98b2('0x11'))['left_join'](_0x98b2('0x13'),'t',_0x98b2('0x14'));return _0x4481b3;}function addFieldsToQuery(_0x2a6337,_0x4b869a,_0x525889,_0x2d19ee,_0x56bcbd){var _0x2966e2=_0x56bcbd?'c':'subqry';if(!_0x4b869a){_0x4b869a=['id','firstName','lastName',_0x98b2('0x15'),_0x98b2('0x16'),_0x98b2('0x17'),'email','ListId','CompanyId',_0x98b2('0x18'),_0x98b2('0x19'),_0x98b2('0x1a'),_0x98b2('0x1b')];}var _0x4b9f2c=_0x525889&&_0x56bcbd||!_0x525889&&!_0x56bcbd;if(_0x2d19ee){_0x4b9f2c=_0x2d19ee&&_0x56bcbd||!_0x2d19ee&&!_0x56bcbd;}_0x4b869a[_0x98b2('0x1c')](function(_0x588837){if(_0x588837===_0x98b2('0x1b')){if(_0x4b9f2c){_0x2a6337['field'](_0x98b2('0x1d'),_0x588837);}else if(_0x525889||_0x2d19ee){_0x2a6337[_0x98b2('0x1e')](_0x2966e2+'.'+_0x588837);}}else{_0x2a6337[_0x98b2('0x1e')](_0x2966e2+'.'+_0x588837);}});return _0x2a6337;}function getSqlClauses(){var _0x16f5c1={'default':squel['expr'](),'fields':squel[_0x98b2('0x1f')](),'filter':squel[_0x98b2('0x1f')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x16f5c1;}function parseTagParameter(_0x5d6b38){var _0xf45da9=squel['expr']();if(_0x5d6b38){var _0x4ddded=utils[_0x98b2('0x20')](_0x5d6b38);_0x4ddded[_0x98b2('0x1c')](function(_0x4bb825){_0xf45da9['or'](_0x98b2('0x21'),'%,'+_0x4bb825+',%');});}return _0xf45da9;}function parseSearchFilter(_0x13d149){var _0xfae112=squel['expr']();if(_0x13d149){var _0x2a5587=_0x13d149['replace']('\x5c','\x5c\x5c')[_0x98b2('0x22')](/'/g,'\x27\x27');if(_0x2a5587['split']('\x20')['length']>0x1){_0xfae112['or'](_0x98b2('0x23'),qs[_0x98b2('0x24')](_0x2a5587),null);}else{if(qs[_0x98b2('0x25')](_0x2a5587)){_0xfae112['or']('c.id\x20LIKE\x20?',_0x2a5587+'%');_0xfae112['or']('c.phone\x20LIKE\x20?',_0x2a5587+'%');_0xfae112['or']('c.mobile\x20LIKE\x20?',_0x2a5587+'%');_0xfae112['or'](_0x98b2('0x26'),_0x2a5587+'%');}else if(qs[_0x98b2('0x27')](_0x2a5587)){_0xfae112['or']('c.email\x20LIKE\x20?',_0x2a5587+'%');}else{_0xfae112['or'](_0x98b2('0x28'),'%'+_0x2a5587+'%');_0xfae112['or'](_0x98b2('0x29'),'%'+_0x2a5587+'%');_0xfae112['or'](_0x98b2('0x2a'),'%'+_0x2a5587+'%');}}}return _0xfae112;}function parseAdvancedSearchFilter(_0x56efb6,_0x2e1ea4){var _0x1dee11=getSqlClauses();var _0x1f1c55=as[_0x98b2('0x2b')](_0x56efb6);var _0x25393d=_0x1f1c55['sqlOperator'];for(var _0x23883f=0x0;_0x23883f<_0x1f1c55['conditions'][_0x98b2('0x2c')];_0x23883f++){var _0x1aa42a=_0x1f1c55['conditions'][_0x23883f];var _0x2f5156='c';var _0x363174=_['find'](_0x2e1ea4,[_0x98b2('0x2d'),_0x1aa42a[_0x98b2('0x1e')]]);if(_0x363174){if(_0x1aa42a[_0x98b2('0x1e')]===_0x98b2('0x2e')||_0x363174['fieldType']==='datetime'){_0x1aa42a[_0x98b2('0x2f')]=_0x98b2('0x30');}var _0x22b52c=as[_0x98b2('0x31')](_0x2f5156,_0x363174[_0x98b2('0x32')],_0x1aa42a);_0x1dee11[_0x98b2('0x33')][_0x25393d](_0x22b52c['text'],_0x22b52c[_0x98b2('0x34')][_0x98b2('0x35')],_0x22b52c[_0x98b2('0x34')][_0x98b2('0x36')]);}else{if(_0x1aa42a[_0x98b2('0x1e')]===_0x98b2('0x37')){var _0x449fca=_0x1aa42a[_0x98b2('0x34')][_0x98b2('0x38')](',')[_0x98b2('0x39')](function(_0x226b19){return Number(_0x226b19);});var _0x3c470c=parseTagParameter(_0x449fca);_0x1dee11[_0x98b2('0x3a')]['clause']['and'](_0x3c470c);_0x1dee11[_0x98b2('0x3a')][_0x98b2('0x3b')]=_0x449fca;}else if(_0x1aa42a[_0x98b2('0x1e')]===_0x98b2('0x3c')){_0x1dee11[_0x98b2('0x3d')][_0x98b2('0x3e')]['and'](_0x98b2('0x3f'),_0x1aa42a[_0x98b2('0x34')]);_0x1dee11[_0x98b2('0x3d')][_0x98b2('0x40')]=!![];}}}return _0x1dee11;}function parseModelFields(_0x4b9c32,_0x13fe8b){var _0x193d40=squel[_0x98b2('0x1f')]();var _0x178ad1=_(_0x4b9c32)[_0x98b2('0x41')]()[_0x98b2('0x39')](function(_0x3b2808){return _['some'](_0x13fe8b,[_0x98b2('0x2d'),_0x3b2808])?_0x3b2808:undefined;})['compact']()[_0x98b2('0x34')]();if(_0x4b9c32[_0x98b2('0x42')]){_0x178ad1[_0x98b2('0x43')](_0x98b2('0x42'));}if(_0x178ad1['length']>0x0){_0x178ad1['forEach'](function(_0x3d8bc7){if(_0x3d8bc7===_0x98b2('0x5')){_0x193d40[_0x98b2('0x44')]('c.ListId\x20IN\x20?',[][_0x98b2('0x45')](_0x4b9c32[_0x3d8bc7]));}else if(_0x3d8bc7===_0x98b2('0x42')){var _0xeea095='%'+_0x4b9c32[_0x3d8bc7]+'%';_0x193d40[_0x98b2('0x44')](_0x98b2('0x46'),_0xeea095);}else{_0x193d40[_0x98b2('0x44')]('c.'+_0x3d8bc7+'\x20=\x20?',_0x4b9c32[_0x3d8bc7]);}});}return _0x193d40;}function parseQueryParameters(_0xcc7826,_0xbee228){var _0x197749=getSqlClauses();return Promise['resolve']()[_0x98b2('0x47')](function(){return parseModelFields(_0xcc7826,_0xbee228);})[_0x98b2('0x47')](function(_0x3ec182){_0x197749[_0x98b2('0x48')][_0x98b2('0x44')](_0x3ec182);return parseTagParameter(_0xcc7826[_0x98b2('0x49')]);})['then'](function(_0x869644){_0x197749['tags'][_0x98b2('0x3e')][_0x98b2('0x44')](_0x869644);return parseSearchFilter(_0xcc7826[_0x98b2('0x4a')]);})[_0x98b2('0x47')](function(_0x44d858){_0x197749[_0x98b2('0x4a')]=_0x44d858;return _0x197749;});}function checkListsRestrictions(_0x28a742,_0x14f45d,_0x439b5d){var _0x53508e=squel[_0x98b2('0x1f')]();return Promise['resolve']()[_0x98b2('0x47')](function(){if(_0x14f45d[_0x98b2('0x4')]&&_0x28a742[_0x98b2('0x3')]===_0x98b2('0x4b')&&!_0x439b5d){return _0x28a742[_0x98b2('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x98b2('0x47')](function(_0x53f148){if(_0x53f148){if(_0x53f148[_0x98b2('0x2c')]===0x0){_0x53508e[_0x98b2('0x44')](_0x98b2('0x4d'));}else{_0x53508e[_0x98b2('0x44')](_0x98b2('0x4e'),_['map'](_0x53f148,'id'));}}})['then'](function(){return _0x53508e;});}function buildContactsQuery(_0x133753,_0x3f902e,_0x54f8b7,_0x389581,_0x598bbc,_0x483111){if(_0x3f902e){_0x3f902e=_0x54f8b7['attributes'];}_0x133753=addFieldsToQuery(_0x133753,_0x3f902e,_0x389581,_0x483111,!![]);var _0xea5f5d=squel[_0x98b2('0x8')]();_0xea5f5d=addFieldsToQuery(_0xea5f5d,_0x3f902e,_0x389581,_0x483111,![]);if(_0x389581||_0x483111){_0x133753=applyJoinClauses(_0x133753,!![]);_0x133753[_0x98b2('0x4f')](_0x98b2('0x50'));if(_0x54f8b7[_0x98b2('0x51')]){_0xea5f5d[_0x98b2('0x51')](_0x54f8b7[_0x98b2('0x51')]);}if(_0x54f8b7[_0x98b2('0x52')]){_0xea5f5d[_0x98b2('0x52')](_0x54f8b7['offset']);}}else{_0xea5f5d=applyJoinClauses(_0xea5f5d,![]);_0xea5f5d[_0x98b2('0x4f')]('subqry.id');if(_0x54f8b7[_0x98b2('0x51')]){_0x133753[_0x98b2('0x51')](_0x54f8b7[_0x98b2('0x51')]);}if(_0x54f8b7[_0x98b2('0x52')]){_0x133753['offset'](_0x54f8b7[_0x98b2('0x52')]);}}_0xea5f5d[_0x98b2('0x53')](_0x598bbc);if(_0x54f8b7[_0x98b2('0x54')]){_0x54f8b7[_0x98b2('0x54')][_0x98b2('0x1c')](function(_0x54f7ba){_0x133753[_0x98b2('0x54')]('c.'+_0x54f7ba[0x0],_0x54f7ba[0x1]===_0x98b2('0x55')?![]:!![]);_0xea5f5d[_0x98b2('0x54')](_0x98b2('0x56')+_0x54f7ba[0x0],_0x54f7ba[0x1]===_0x98b2('0x55')?![]:!![]);});}_0xea5f5d[_0x98b2('0x9')](_0x133753,_0x98b2('0xd'));return _0xea5f5d;}function getFilteredContacts(_0x144b62){var _0x175a1b=[];return db[_0x98b2('0x37')][_0x98b2('0x57')]({'attributes':['id',_0x98b2('0x2d'),'color'],'raw':!![]})[_0x98b2('0x47')](function(_0x1cb110){_0x175a1b=_['keyBy'](_0x1cb110,'id');var _0x5116d5={'type':db[_0x98b2('0x58')]['QueryTypes'][_0x98b2('0x59')],'model':db[_0x98b2('0x5a')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x98b2('0x5b')][_0x98b2('0x5c')](_0x144b62[_0x98b2('0x5d')](),_0x5116d5);})[_0x98b2('0x47')](function(_0x5e1272){_0x5e1272[_0x98b2('0x1c')](function(_0x54ab16){if(_0x54ab16['TagIds']){_0x54ab16[_0x98b2('0x5e')]=[];_0x54ab16[_0x98b2('0x1b')]['split'](',')[_0x98b2('0x1c')](function(_0x1253e2){_0x54ab16['Tags'][_0x98b2('0x43')](_0x175a1b[_0x1253e2]);});}delete _0x54ab16[_0x98b2('0x1b')];});return _0x5e1272;});}function countFilteredContacts(_0x14327e,_0x1c9533){var _0x48ed1d=_0x14327e['clone']();_0x48ed1d[_0x98b2('0x1e')](_0x98b2('0x5f'));_0x48ed1d=applyJoinClauses(_0x48ed1d,!![]);_0x14327e[_0x98b2('0x4f')](_0x98b2('0x50'));var _0x3aceb2=utils['getSelectedTags'](_0x1c9533);if(!_['isEmpty'](_0x3aceb2)){_0x48ed1d[_0x98b2('0xb')]('t.id\x20IN\x20?',_0x3aceb2);}var _0x357b04={'type':db[_0x98b2('0x58')][_0x98b2('0x60')][_0x98b2('0x59')],'raw':!![]};return db[_0x98b2('0x5b')][_0x98b2('0x5c')](_0x48ed1d['toString'](),_0x357b04)[_0x98b2('0x47')](function(_0x2663be){return _0x2663be[0x0][_0x98b2('0x5f')];});}module[_0x98b2('0x61')]={'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 e6f27d4..55ec8d5 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 _0x90ed=['update','binary','write','end','close','unlink','decryptFile','createDecipher','encryptString','secret','base64','final','utf8','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','aes192','algorithm','join','error','encrypt','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data'];(function(_0x1db5aa,_0x541106){var _0x43ba30=function(_0x103bd2){while(--_0x103bd2){_0x1db5aa['push'](_0x1db5aa['shift']());}};_0x43ba30(++_0x541106);}(_0x90ed,0x1e9));var _0xd90e=function(_0x3c8e10,_0x22ee9f){_0x3c8e10=_0x3c8e10-0x0;var _0x5bd363=_0x90ed[_0x3c8e10];return _0x5bd363;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xd90e('0x0'));var config=require(_0xd90e('0x1'));var logger=require(_0xd90e('0x2'))(_0xd90e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xd90e('0x4')],'algorithm':_0xd90e('0x5')};const fileOptions={'algorithm':_0xd90e('0x6')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0xd90e('0x7')]);if(isSupported){fileOptions[_0xd90e('0x7')]=config['encrypt'][_0xd90e('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xd90e('0x8')](',\x20');logger[_0xd90e('0x9')](config[_0xd90e('0xa')][_0xd90e('0x7')],_0xd90e('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x8cf808){return AES_SUPPORTED_RX[_0xd90e('0xc')](_0x8cf808);}function getSupportedCiphers(){return crypto[_0xd90e('0xd')]()[_0xd90e('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x372608){return getSupportedCiphers()[_0xd90e('0xf')](_0x372608)>-0x1;}function combineOptions(_0x4ced2f){var _0x4f22cf={};for(var _0x43ca8a in fileOptions){if(fileOptions[_0xd90e('0x10')](_0x43ca8a)){_0x4f22cf[_0x43ca8a]=fileOptions[_0x43ca8a];}}if(_0x4ced2f){for(var _0x2991ca in _0x4ced2f){if(_0x4ced2f[_0xd90e('0x10')](_0x2991ca)){_0x4f22cf[_0x2991ca]=_0x4ced2f[_0x2991ca];}}}return _0x4f22cf;}exports[_0xd90e('0x11')]=function(_0x1c52a9,_0x27c207,_0xab9d5,_0x1dc3a7){return new BPromise(function(_0x46d0c8,_0xdfe3a7){_0x1dc3a7=combineOptions(_0x1dc3a7);var _0x68c249=new Buffer(_0xab9d5);var _0x38d547=fs['createReadStream'](_0x1c52a9);var _0x45e6c6=fs[_0xd90e('0x12')](_0x27c207);var _0x47ca1e=crypto[_0xd90e('0x13')](_0x1dc3a7['algorithm'],_0x68c249);_0x38d547['on'](_0xd90e('0x14'),function(_0x4b9cd8){var _0x2e181e=new Buffer(_0x47ca1e[_0xd90e('0x15')](_0x4b9cd8),_0xd90e('0x16'));_0x45e6c6[_0xd90e('0x17')](_0x2e181e);});_0x38d547['on'](_0xd90e('0x18'),function(){try{var _0x1b9622=new Buffer(_0x47ca1e['final']('binary'),_0xd90e('0x16'));_0x45e6c6[_0xd90e('0x17')](_0x1b9622);_0x45e6c6[_0xd90e('0x18')]();_0x45e6c6['on'](_0xd90e('0x19'),function(){return _0x46d0c8(_0x27c207);});}catch(_0x191eb7){fs[_0xd90e('0x1a')](_0x27c207);return _0xdfe3a7(_0x191eb7);}});});};exports[_0xd90e('0x1b')]=function(_0x5507c0,_0x5e2988,_0x22ca1e,_0x4c2db4){return new BPromise(function(_0xa15876,_0x393097){_0x4c2db4=combineOptions(_0x4c2db4);var _0x3ee391=new Buffer(_0x22ca1e);var _0x3f1e0b=fs['createReadStream'](_0x5507c0);var _0x49c094=fs[_0xd90e('0x12')](_0x5e2988);var _0x223156=crypto[_0xd90e('0x1c')](_0x4c2db4[_0xd90e('0x7')],_0x3ee391);_0x3f1e0b['on']('data',function(_0x24cc91){var _0x130606=new Buffer(_0x223156[_0xd90e('0x15')](_0x24cc91),'binary');_0x49c094[_0xd90e('0x17')](_0x130606);});_0x3f1e0b['on']('end',function(){try{var _0x59ce72=new Buffer(_0x223156['final'](_0xd90e('0x16')),'binary');_0x49c094['write'](_0x59ce72);_0x49c094[_0xd90e('0x18')]();_0x49c094['on'](_0xd90e('0x19'),function(){return _0xa15876(_0x5e2988);});}catch(_0xf020b2){fs['unlink'](_0x5e2988);return _0x393097(_0xf020b2);}});});};exports[_0xd90e('0x1d')]=function(_0x748305,_0x156bf9,_0x40bc4c){var _0x16d78b=_0x40bc4c||stringOptions['algorithm'];var _0x59d547=_0x156bf9||stringOptions[_0xd90e('0x1e')];var _0x29982c=crypto[_0xd90e('0x13')](_0x16d78b,_0x59d547);var _0x20da3e=_0x29982c['update'](_0x748305,'utf8',_0xd90e('0x1f'));_0x20da3e+=_0x29982c[_0xd90e('0x20')](_0xd90e('0x1f'));return _0x20da3e;};exports['decryptString']=function(_0x3db435,_0x27bb9d,_0x3766bb){var _0x7d8b05=_0x3766bb||stringOptions[_0xd90e('0x7')];var _0x4e5af0=_0x27bb9d||stringOptions[_0xd90e('0x1e')];var _0x3e59e6=crypto[_0xd90e('0x1c')](_0x7d8b05,_0x4e5af0);var _0xcdcb65=_0x3e59e6[_0xd90e('0x15')](_0x3db435,'base64','utf8');_0xcdcb65+=_0x3e59e6[_0xd90e('0x20')](_0xd90e('0x21'));return _0xcdcb65;}; \ No newline at end of file +var _0x16ab=['encryptFile','createReadStream','createWriteStream','createCipher','binary','end','final','write','close','createDecipher','encryptString','update','base64','decryptString','secret','utf8','crypto','lodash','../../config/environment','../../config/logger','app','aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x16ab,0x6d));var _0xb16a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x16ab[_0x11005e];return _0x29338f;};'use strict';var crypto=require(_0xb16a('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0xb16a('0x1'));var config=require(_0xb16a('0x2'));var logger=require(_0xb16a('0x3'))(_0xb16a('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':_0xb16a('0x5')};const fileOptions={'algorithm':'aes192'};if(config[_0xb16a('0x6')]&&config[_0xb16a('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb16a('0x6')][_0xb16a('0x7')]);if(isSupported){fileOptions[_0xb16a('0x7')]=config['encrypt'][_0xb16a('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0xb16a('0x8')](config[_0xb16a('0x6')]['algorithm'],_0xb16a('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x1dc0bd){return AES_SUPPORTED_RX[_0xb16a('0xa')](_0x1dc0bd);}function getSupportedCiphers(){return crypto[_0xb16a('0xb')]()[_0xb16a('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x3cdf23){return getSupportedCiphers()[_0xb16a('0xd')](_0x3cdf23)>-0x1;}function combineOptions(_0x497225){var _0x384561={};for(var _0x35d2c6 in fileOptions){if(fileOptions['hasOwnProperty'](_0x35d2c6)){_0x384561[_0x35d2c6]=fileOptions[_0x35d2c6];}}if(_0x497225){for(var _0x1bdbe1 in _0x497225){if(_0x497225[_0xb16a('0xe')](_0x1bdbe1)){_0x384561[_0x1bdbe1]=_0x497225[_0x1bdbe1];}}}return _0x384561;}exports[_0xb16a('0xf')]=function(_0x511a93,_0x18e8fe,_0x437ed4,_0x2ffa71){return new BPromise(function(_0x5d4186,_0x45e502){_0x2ffa71=combineOptions(_0x2ffa71);var _0x154e29=new Buffer(_0x437ed4);var _0x572600=fs[_0xb16a('0x10')](_0x511a93);var _0x5727d5=fs[_0xb16a('0x11')](_0x18e8fe);var _0x1a8974=crypto[_0xb16a('0x12')](_0x2ffa71[_0xb16a('0x7')],_0x154e29);_0x572600['on']('data',function(_0x1c78bb){var _0x4abf6f=new Buffer(_0x1a8974['update'](_0x1c78bb),_0xb16a('0x13'));_0x5727d5['write'](_0x4abf6f);});_0x572600['on'](_0xb16a('0x14'),function(){try{var _0x2fd916=new Buffer(_0x1a8974[_0xb16a('0x15')](_0xb16a('0x13')),'binary');_0x5727d5[_0xb16a('0x16')](_0x2fd916);_0x5727d5['end']();_0x5727d5['on'](_0xb16a('0x17'),function(){return _0x5d4186(_0x18e8fe);});}catch(_0x313c39){fs['unlink'](_0x18e8fe);return _0x45e502(_0x313c39);}});});};exports['decryptFile']=function(_0x2de5df,_0xd225e6,_0x4d6618,_0x5d0386){return new BPromise(function(_0x4781e2,_0x12ab49){_0x5d0386=combineOptions(_0x5d0386);var _0x8c63f2=new Buffer(_0x4d6618);var _0x2e46d3=fs[_0xb16a('0x10')](_0x2de5df);var _0x5cda06=fs['createWriteStream'](_0xd225e6);var _0x1867b5=crypto[_0xb16a('0x18')](_0x5d0386[_0xb16a('0x7')],_0x8c63f2);_0x2e46d3['on']('data',function(_0x3e3125){var _0x3b0232=new Buffer(_0x1867b5['update'](_0x3e3125),_0xb16a('0x13'));_0x5cda06['write'](_0x3b0232);});_0x2e46d3['on']('end',function(){try{var _0x1eb81f=new Buffer(_0x1867b5[_0xb16a('0x15')](_0xb16a('0x13')),'binary');_0x5cda06[_0xb16a('0x16')](_0x1eb81f);_0x5cda06[_0xb16a('0x14')]();_0x5cda06['on'](_0xb16a('0x17'),function(){return _0x4781e2(_0xd225e6);});}catch(_0x5b6745){fs['unlink'](_0xd225e6);return _0x12ab49(_0x5b6745);}});});};exports[_0xb16a('0x19')]=function(_0x1754d9,_0x1d3aae,_0xbe4bb){var _0x7066bc=_0xbe4bb||stringOptions[_0xb16a('0x7')];var _0x4ee673=_0x1d3aae||stringOptions['secret'];var _0x40bc28=crypto[_0xb16a('0x12')](_0x7066bc,_0x4ee673);var _0x22985f=_0x40bc28[_0xb16a('0x1a')](_0x1754d9,'utf8',_0xb16a('0x1b'));_0x22985f+=_0x40bc28[_0xb16a('0x15')](_0xb16a('0x1b'));return _0x22985f;};exports[_0xb16a('0x1c')]=function(_0x4f6f32,_0x35a333,_0x3c3e27){var _0x55fb06=_0x3c3e27||stringOptions[_0xb16a('0x7')];var _0x335634=_0x35a333||stringOptions[_0xb16a('0x1d')];var _0x42337e=crypto[_0xb16a('0x18')](_0x55fb06,_0x335634);var _0x315cfa=_0x42337e[_0xb16a('0x1a')](_0x4f6f32,'base64',_0xb16a('0x1e'));_0x315cfa+=_0x42337e[_0xb16a('0x15')]('utf8');return _0x315cfa;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9dca7ea..22f5dc9 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 _0x50e9=['find','split','splitSizeCsv','then','sequelize','query','num','Empty','length','range','isInteger','forEach','push','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x50e9,0x190));var _0x950e=function(_0x3f97ea,_0x132277){_0x3f97ea=_0x3f97ea-0x0;var _0x12a9c4=_0x50e9[_0x3f97ea];return _0x12a9c4;};'use strict';var util=require(_0x950e('0x0'));var path=require(_0x950e('0x1'));var _=require(_0x950e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x950e('0x3'));var zipdir=require(_0x950e('0x4'));var rimraf=require(_0x950e('0x5'));var db=require(_0x950e('0x6'))['db'];var dbH=require(_0x950e('0x6'))[_0x950e('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x950e('0x8')][0x2]);var QUERY=process[_0x950e('0x8')][0x3];var PATH=process[_0x950e('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5de7de,_0x60a195){var _0x5ae2cc={'status':_0x5de7de};var _0x2b96a3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x60a195){_0x5ae2cc[_0x950e('0x9')]=_0x60a195;}return db[_0x950e('0xa')][_0x950e('0xb')](_0x5ae2cc,_0x2b96a3);}function main(){var _0x190ca2=0x1388;var _0x2386a3;logger[_0x950e('0xc')](util[_0x950e('0xd')](_0x950e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x950e('0xf')][_0x950e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x950e('0x11'),_0x950e('0x12')]})[_0x950e('0x13')](function(_0x39369f){if(_0x39369f){_0x2386a3=_0x39369f;_0x190ca2=_0x2386a3[_0x950e('0x12')]||0x1388;}})[_0x950e('0x13')](function(){return dbH[_0x950e('0x14')][_0x950e('0x15')](util[_0x950e('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x950e('0x14')]['QueryTypes']['SELECT']});})[_0x950e('0x13')](function(_0x3c9579){if(!_0x3c9579[0x0][_0x950e('0x16')]){return analyticExtractedReport(_0x950e('0x17'));}var _0x4989a6=[];var _0x33008f=0x0;if(_0x2386a3[_0x950e('0x11')]){if(_0x3c9579&&_0x3c9579[_0x950e('0x18')]){var _0x15a17f=_[_0x950e('0x19')](_0x3c9579[0x0][_0x950e('0x16')]/_0x190ca2);var _0xf1013=Number[_0x950e('0x1a')](_0x3c9579[0x0]['num']/_0x190ca2)?_0x3c9579[0x0][_0x950e('0x16')]%_0x190ca2:0x0;_0x15a17f[_0x950e('0x1b')](function(_0x304a31){if(_0x304a31>0x0){_0x33008f+=_0x190ca2;}_0x4989a6[_0x950e('0x1c')](dbH[_0x950e('0x14')][_0x950e('0x15')](util[_0x950e('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x190ca2,_0x33008f),{'type':dbH[_0x950e('0x14')][_0x950e('0x1d')][_0x950e('0x1e')]}));});if(_0xf1013>0x0){_0x33008f+=_0x190ca2;_0x4989a6[_0x950e('0x1c')](dbH[_0x950e('0x14')][_0x950e('0x15')](util[_0x950e('0xd')](_0x950e('0x1f'),QUERY,_0xf1013,_0x33008f),{'type':dbH[_0x950e('0x14')]['QueryTypes'][_0x950e('0x1e')]}));}}}else{_0x4989a6[_0x950e('0x1c')](dbH[_0x950e('0x14')][_0x950e('0x15')](QUERY,{'type':dbH[_0x950e('0x14')][_0x950e('0x1d')][_0x950e('0x1e')]}));}var _0x10fce3=path[_0x950e('0x20')](PATH);var _0x3fa23a=path[_0x950e('0x21')](PATH,_0x950e('0x22'));var _0x3c2838=_0x2386a3[_0x950e('0x11')]&&_0x4989a6[_0x950e('0x18')]>0x1;var _0x17064a=[];if(!fs[_0x950e('0x23')](path[_0x950e('0x24')](_0x10fce3,_0x3fa23a))&&_0x3c2838){fs[_0x950e('0x25')](path[_0x950e('0x24')](_0x10fce3,_0x3fa23a));}return BPromise[_0x950e('0x26')](_0x4989a6,function(_0x422221){_0x17064a['push'](_0x422221);})[_0x950e('0x13')](function(){for(var _0x25ee8d=0x0;_0x25ee8d<_0x17064a[_0x950e('0x18')];_0x25ee8d+=0x1){var _0x54be9f;var _0xac1432=_0x17064a[_0x25ee8d];if(_0x3c2838){_0x54be9f=path[_0x950e('0x24')](_0x10fce3,_0x3fa23a,util[_0x950e('0xd')](_0x950e('0x27'),_0x3fa23a,_0x25ee8d,_0x950e('0x28')));}else{_0x54be9f=path[_0x950e('0x24')](_0x10fce3,util[_0x950e('0xd')](_0x950e('0x29'),_0x3fa23a,_0x950e('0x28')));}fs[_0x950e('0x2a')](_0x54be9f,csv(_0xac1432));}})[_0x950e('0x13')](function(){if(_0x3c2838){return new Promise(function(_0x51cfa5){zipdir(path['join'](_0x10fce3,_0x3fa23a),{'saveTo':path[_0x950e('0x24')](_0x10fce3,util[_0x950e('0xd')](_0x950e('0x29'),_0x3fa23a,_0x950e('0x2b')))},function(_0xd96868,_0x3f9031){rimraf(path[_0x950e('0x24')](_0x10fce3,_0x3fa23a),function(){});_0x51cfa5(_0x950e('0x2c'));});});}})[_0x950e('0x13')](function(){logger['info'](util[_0x950e('0xd')](_0x950e('0x2d'),EXTRACTED_REPORT_ID,_0x950e('0x2e')));return analyticExtractedReport(_0x950e('0x2f'),_0x3c2838?util['format'](_0x950e('0x29'),_0x3fa23a,_0x3c2838?_0x950e('0x2b'):_0x950e('0x28')):null);});})['catch'](function(_0x114965){logger[_0x950e('0xc')](util[_0x950e('0xd')](_0x950e('0x30'),EXTRACTED_REPORT_ID,'CSV'),util[_0x950e('0x31')](_0x114965,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x950e('0x32'));})[_0x950e('0x33')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7bf5=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','mkdirSync','join','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','inspect','Failed','finally','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','CSV','Setting','find'];(function(_0x105aaa,_0x358e95){var _0xe4b1fa=function(_0x52b5aa){while(--_0x52b5aa){_0x105aaa['push'](_0x105aaa['shift']());}};_0xe4b1fa(++_0x358e95);}(_0x7bf5,0x167));var _0x57bf=function(_0xf17965,_0x31747d){_0xf17965=_0xf17965-0x0;var _0x398a12=_0x7bf5[_0xf17965];return _0x398a12;};'use strict';var util=require(_0x57bf('0x0'));var path=require(_0x57bf('0x1'));var _=require(_0x57bf('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x57bf('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x57bf('0x4'));var db=require(_0x57bf('0x5'))['db'];var dbH=require('../../mysqldb')[_0x57bf('0x6')];var logger=require(_0x57bf('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x57bf('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x57bf('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2331f0,_0x19fabe){var _0x1c6c0d={'status':_0x2331f0};var _0x284e67={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19fabe){_0x1c6c0d[_0x57bf('0x9')]=_0x19fabe;}return db[_0x57bf('0xa')][_0x57bf('0xb')](_0x1c6c0d,_0x284e67);}function main(){var _0x1a1766=0x1388;var _0x4f687e;logger[_0x57bf('0xc')](util[_0x57bf('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x57bf('0xe')));return db[_0x57bf('0xf')][_0x57bf('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x57bf('0x11')]})[_0x57bf('0x12')](function(_0x18b677){if(_0x18b677){_0x4f687e=_0x18b677;_0x1a1766=_0x4f687e[_0x57bf('0x11')]||0x1388;}})[_0x57bf('0x12')](function(){return dbH[_0x57bf('0x13')][_0x57bf('0x14')](util['format'](_0x57bf('0x15'),QUERY),{'type':dbH[_0x57bf('0x13')][_0x57bf('0x16')][_0x57bf('0x17')]});})['then'](function(_0x3903cd){if(!_0x3903cd[0x0][_0x57bf('0x18')]){return analyticExtractedReport(_0x57bf('0x19'));}var _0x412aa6=[];var _0x357233=0x0;if(_0x4f687e[_0x57bf('0x1a')]){if(_0x3903cd&&_0x3903cd[_0x57bf('0x1b')]){var _0x272ef4=_['range'](_0x3903cd[0x0][_0x57bf('0x18')]/_0x1a1766);var _0x30b714=Number['isInteger'](_0x3903cd[0x0][_0x57bf('0x18')]/_0x1a1766)?_0x3903cd[0x0][_0x57bf('0x18')]%_0x1a1766:0x0;_0x272ef4[_0x57bf('0x1c')](function(_0x609879){if(_0x609879>0x0){_0x357233+=_0x1a1766;}_0x412aa6['push'](dbH[_0x57bf('0x13')]['query'](util['format'](_0x57bf('0x1d'),QUERY,_0x1a1766,_0x357233),{'type':dbH[_0x57bf('0x13')][_0x57bf('0x16')][_0x57bf('0x17')]}));});if(_0x30b714>0x0){_0x357233+=_0x1a1766;_0x412aa6[_0x57bf('0x1e')](dbH[_0x57bf('0x13')]['query'](util[_0x57bf('0xd')](_0x57bf('0x1d'),QUERY,_0x30b714,_0x357233),{'type':dbH['sequelize'][_0x57bf('0x16')][_0x57bf('0x17')]}));}}}else{_0x412aa6[_0x57bf('0x1e')](dbH[_0x57bf('0x13')][_0x57bf('0x14')](QUERY,{'type':dbH['sequelize'][_0x57bf('0x16')][_0x57bf('0x17')]}));}var _0xf312a=path[_0x57bf('0x1f')](PATH);var _0x4726bd=path[_0x57bf('0x20')](PATH,_0x57bf('0x21'));var _0x3c05f1=_0x4f687e['split']&&_0x412aa6[_0x57bf('0x1b')]>0x1;var _0x2338da=[];if(!fs['existsSync'](path['join'](_0xf312a,_0x4726bd))&&_0x3c05f1){fs[_0x57bf('0x22')](path[_0x57bf('0x23')](_0xf312a,_0x4726bd));}return BPromise[_0x57bf('0x24')](_0x412aa6,function(_0x51851e){_0x2338da[_0x57bf('0x1e')](_0x51851e);})[_0x57bf('0x12')](function(){for(var _0x3f6bc3=0x0;_0x3f6bc3<_0x2338da[_0x57bf('0x1b')];_0x3f6bc3+=0x1){var _0x4a76fa;var _0x23b332=_0x2338da[_0x3f6bc3];if(_0x3c05f1){_0x4a76fa=path['join'](_0xf312a,_0x4726bd,util[_0x57bf('0xd')](_0x57bf('0x25'),_0x4726bd,_0x3f6bc3,_0x57bf('0x26')));}else{_0x4a76fa=path[_0x57bf('0x23')](_0xf312a,util[_0x57bf('0xd')](_0x57bf('0x27'),_0x4726bd,_0x57bf('0x26')));}fs['writeFileSync'](_0x4a76fa,csv(_0x23b332));}})[_0x57bf('0x12')](function(){if(_0x3c05f1){return new Promise(function(_0x13c2f0){zipdir(path[_0x57bf('0x23')](_0xf312a,_0x4726bd),{'saveTo':path[_0x57bf('0x23')](_0xf312a,util[_0x57bf('0xd')](_0x57bf('0x27'),_0x4726bd,_0x57bf('0x28')))},function(_0x519dc9,_0x585f46){rimraf(path[_0x57bf('0x23')](_0xf312a,_0x4726bd),function(){});_0x13c2f0('zip\x20finished');});});}})['then'](function(){logger['info'](util[_0x57bf('0xd')](_0x57bf('0x29'),EXTRACTED_REPORT_ID,_0x57bf('0xe')));return analyticExtractedReport('Completed',_0x3c05f1?util[_0x57bf('0xd')](_0x57bf('0x27'),_0x4726bd,_0x3c05f1?_0x57bf('0x28'):_0x57bf('0x26')):null);});})[_0x57bf('0x2a')](function(_0x4b689d){logger['info'](util[_0x57bf('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x57bf('0xe')),util[_0x57bf('0x2b')](_0x4b689d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x57bf('0x2c'));})[_0x57bf('0x2d')](function(){process[_0x57bf('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ef714d6..f5f8c1a 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 _0x1acd=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','push','concat','keys','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','endDate','header','pageBreak','before','margin','footer','black','Setting','splitSizePdf','then','split','range','num','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','query','basename','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x1acd,0x68));var _0xd1ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1acd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1ac('0x0'));var fs=require('fs');var util=require(_0xd1ac('0x1'));var path=require(_0xd1ac('0x2'));var moment=require(_0xd1ac('0x3'));var htmlToPdfmake=require(_0xd1ac('0x4'));var PdfPrinter=require(_0xd1ac('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0xd1ac('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xd1ac('0x7')];var BPromise=require(_0xd1ac('0x8'));var db=require(_0xd1ac('0x9'))['db'];var dbH=require(_0xd1ac('0x9'))[_0xd1ac('0xa')];var logger=require('../../config/logger')(_0xd1ac('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd1ac('0xc')][0x3];var PATH=process['argv'][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xd1ac('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xd00531,_0x3c315f){var _0x5ade42={'status':_0xd00531};var _0x1ab00d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c315f){_0x5ade42[_0xd1ac('0xe')]=_0x3c315f;}return db[_0xd1ac('0xf')][_0xd1ac('0x10')](_0x5ade42,_0x1ab00d);}function getHeaders(_0x59a55e){return _['map'](_0x59a55e,function(_0x3261f3){return{'text':_0x3261f3,'style':_0xd1ac('0x11')};});}function getRows(_0x40baef,_0x1d62eb){return _[_0xd1ac('0x12')](_0x1d62eb,function(_0x42e6b0){return _(_0x42e6b0)['pick'](_0x40baef)[_0xd1ac('0x12')](function(_0x12e075){return _0x12e075?_[_0xd1ac('0x13')](_0x12e075):'';})[_0xd1ac('0x14')]();});}function createTable(_0x404840,_0x387448){var _0x13d87d={'widths':_[_0xd1ac('0x15')](Array(_0x404840[_0xd1ac('0x16')]),0x91),'heights':function(_0x26a6d8){return _0x26a6d8===0x0?_0xd1ac('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x48f427=getHeaders(_0x404840);_0x13d87d[_0xd1ac('0x18')][_0xd1ac('0x19')](_0x48f427);var _0x59795a=getRows(_0x404840,_0x387448);_0x13d87d[_0xd1ac('0x18')]=_0x13d87d['body'][_0xd1ac('0x1a')](_0x59795a);return _0x13d87d;}function createTables(_0x282dd3){var _0x42d468=[];var _0x204782=_['chunk'](Object[_0xd1ac('0x1b')](_0x282dd3[0x0]),0x5);_0x204782['forEach'](function(_0x2791e3){_0x42d468['push'](createTable(_0x2791e3,_0x282dd3));});return _0x42d468;}function getPDFDocDefinition(_0x8715c6){var _0x5b99de=util['format'](_0xd1ac('0x1c'),NAME,EXTRACTED_REPORT[_0xd1ac('0x1d')],moment(EXTRACTED_REPORT[_0xd1ac('0x1e')])[_0xd1ac('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xd1ac('0x20')])['format'](FORMAT));var _0x41efe7=[];for(var _0x1a3001=0x0;_0x1a3001<_0x8715c6[_0xd1ac('0x16')];_0x1a3001++){var _0x5437a5=[];if(_0x1a3001===0x0){_0x5437a5[_0xd1ac('0x19')]({'text':_0x5b99de,'style':_0xd1ac('0x21')});}var _0x4ae7fc={'table':_0x8715c6[_0x1a3001]};if(_0x1a3001>0x0){_0x4ae7fc[_0xd1ac('0x22')]=_0xd1ac('0x23');_0x4ae7fc[_0xd1ac('0x24')]=[0x0,0x46,0x0,0x0];}_0x5437a5[_0xd1ac('0x19')](_0x4ae7fc);_0x41efe7[_0xd1ac('0x19')](_0x5437a5);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x41efe7,'footer':function(_0x569579,_0xa7e522){return{'text':_0x569579[_0xd1ac('0x13')]()+'\x20/\x20'+_0xa7e522,'style':_0xd1ac('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd1ac('0x26')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xc14cfa){var _0x694425=0x1388;var _0x5d1f22;if(!_0xc14cfa[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xd1ac('0x27')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd1ac('0x28')]})[_0xd1ac('0x29')](function(_0x1622ee){if(_0x1622ee){_0x5d1f22=_0x1622ee;_0x694425=_0x5d1f22['splitSizePdf']||0x3e8;}})[_0xd1ac('0x29')](function(){var _0x5c6f31=[];var _0x5165b5=0x0;if(_0x5d1f22[_0xd1ac('0x2a')]){if(_0xc14cfa&&_0xc14cfa[_0xd1ac('0x16')]){var _0x5a44c9=_[_0xd1ac('0x2b')](_0xc14cfa[0x0][_0xd1ac('0x2c')]/_0x694425);var _0x4050e4=Number['isInteger'](_0xc14cfa[0x0][_0xd1ac('0x2c')]/_0x694425)?_0xc14cfa[0x0][_0xd1ac('0x2c')]%_0x694425:0x0;_0x5a44c9[_0xd1ac('0x2d')](function(_0x4cc74e){if(_0x4cc74e>0x0){_0x5165b5+=_0x694425;}_0x5c6f31[_0xd1ac('0x19')](dbH[_0xd1ac('0x2e')]['query'](util[_0xd1ac('0x1f')](_0xd1ac('0x2f'),QUERY,_0x694425,_0x5165b5),{'type':dbH['sequelize'][_0xd1ac('0x30')][_0xd1ac('0x31')]}));});if(_0x4050e4>0x0){_0x5165b5+=_0x694425;_0x5c6f31[_0xd1ac('0x19')](dbH[_0xd1ac('0x2e')][_0xd1ac('0x32')](util[_0xd1ac('0x1f')](_0xd1ac('0x2f'),QUERY,_0x4050e4,_0x5165b5),{'type':dbH[_0xd1ac('0x2e')]['QueryTypes'][_0xd1ac('0x31')]}));}}}else{_0x5c6f31['push'](dbH[_0xd1ac('0x2e')]['query'](QUERY,{'type':dbH[_0xd1ac('0x2e')]['QueryTypes'][_0xd1ac('0x31')]}));}var _0x10af1b=path['dirname'](PATH);var _0x5720e9=path[_0xd1ac('0x33')](PATH,'.pdf');var _0x4e404c=_0x5d1f22['split']&&_0x5c6f31[_0xd1ac('0x16')]>0x1;var _0x3ea48b=[];if(!fs[_0xd1ac('0x34')](path[_0xd1ac('0x35')](_0x10af1b,_0x5720e9))&&_0x4e404c){fs[_0xd1ac('0x36')](path[_0xd1ac('0x35')](_0x10af1b,_0x5720e9));}return BPromise[_0xd1ac('0x37')](_0x5c6f31,function(_0x1e90c5){_0x3ea48b['push'](_0x1e90c5);})[_0xd1ac('0x29')](function(){var _0x18d142=[];for(var _0x8fbf1=0x0;_0x8fbf1<_0x3ea48b['length'];_0x8fbf1+=0x1){var _0x4a254c=_0x3ea48b[_0x8fbf1];var _0x3686f3=createTables(_[_0xd1ac('0x38')](_0x4a254c));var _0x534590;var _0x40137a=getPDFDocDefinition(_0x3686f3);var _0x11044d=getPDFPrinter();var _0x365a7c=_0x11044d['createPdfKitDocument'](_0x40137a);if(_0x4e404c){_0x534590=path[_0xd1ac('0x35')](_0x10af1b,_0x5720e9,util[_0xd1ac('0x1f')](_0xd1ac('0x39'),_0x5720e9,_0x8fbf1,_0xd1ac('0x3a')));}else{_0x534590=path[_0xd1ac('0x35')](_0x10af1b,util[_0xd1ac('0x1f')]('%s.%s',_0x5720e9,_0xd1ac('0x3a')));}_0x18d142[_0xd1ac('0x19')](writePDFDocument(_0x365a7c,_0x534590));}return Promise[_0xd1ac('0x3b')](_0x18d142);})[_0xd1ac('0x29')](function(){if(_0x4e404c){return new Promise(function(_0x2d21a){zipdir(path['join'](_0x10af1b,_0x5720e9),{'saveTo':path[_0xd1ac('0x35')](_0x10af1b,util[_0xd1ac('0x1f')](_0xd1ac('0x3c'),_0x5720e9,_0xd1ac('0x3d')))},function(){rimraf(path[_0xd1ac('0x35')](_0x10af1b,_0x5720e9),function(){});_0x2d21a(_0xd1ac('0x3e'));});});}})[_0xd1ac('0x29')](function(){if(!_0x4e404c)return;rimraf(path['join'](_0x10af1b,_0x5720e9),function(){});})[_0xd1ac('0x29')](function(){logger[_0xd1ac('0x3f')](util[_0xd1ac('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd1ac('0x40')));return analyticExtractedReport(_0xd1ac('0x41'),_0x4e404c?util['format']('%s.%s',_0x5720e9,_0x4e404c?'zip':_0xd1ac('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xd1ac('0x3f')](util[_0xd1ac('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xd1ac('0x40')));return db[_0xd1ac('0xf')][_0xd1ac('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x25ab5e){EXTRACTED_REPORT=_0x25ab5e;return dbH[_0xd1ac('0x2e')][_0xd1ac('0x32')](util[_0xd1ac('0x1f')](_0xd1ac('0x43'),QUERY),{'type':dbH[_0xd1ac('0x2e')][_0xd1ac('0x30')][_0xd1ac('0x31')]});})[_0xd1ac('0x29')](extractReport)['catch'](function(_0x5b0c67){logger[_0xd1ac('0x3f')](util[_0xd1ac('0x1f')](_0xd1ac('0x44'),EXTRACTED_REPORT_ID,_0xd1ac('0x40')),util['inspect'](_0x5b0c67,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd1ac('0x45')](function(){process[_0xd1ac('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x493202=new PdfPrinter({'Arial':{'normal':__dirname+_0xd1ac('0x47'),'bold':__dirname+_0xd1ac('0x48'),'italics':__dirname+_0xd1ac('0x49'),'bolditalics':__dirname+_0xd1ac('0x4a')}});return _0x493202;}function getPDFDocDefinitionFromHTML(_0x25821b,_0x261da2){var _0x24edd5=util[_0xd1ac('0x1f')](_0xd1ac('0x4b'),_0x261da2[_0xd1ac('0x4c')],_0x261da2['interactionId']);var _0x290105=moment()[_0xd1ac('0x1f')]('YYYY-MM-DD')[_0xd1ac('0x13')]();var _0x18cf88=htmlToPdfmake(_0x25821b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x18cf88],'defaultStyle':{'font':_0xd1ac('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd1ac('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd1ac('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd1ac('0x4e')}},'header':function(){return[{'text':_0xd1ac('0x4f'),'style':_0xd1ac('0x21')}];},'footer':function(_0x4c02d2,_0x443563){return[{'text':util[_0xd1ac('0x1f')](_0xd1ac('0x50'),_0x24edd5,_0x4c02d2,_0x443563,_0x290105),'style':'footer'}];}};}function writePDFDocument(_0x15a5a7,_0x2573ff){return new Promise(function(_0x41bae4,_0x4e5fd2){var _0x3162cb=_0x15a5a7['pipe'](fs[_0xd1ac('0x51')](_0x2573ff));_0x3162cb['on'](_0xd1ac('0x52'),function(){_0x41bae4(_0xd1ac('0x52'));});_0x3162cb['on']('error',function(_0x46ed99){_0x4e5fd2(_0x46ed99);});_0x15a5a7['end']();});}exports[_0xd1ac('0x53')]=function(_0x4e9255,_0x40bf36){var _0x592b86=getPDFPrinter();var _0x9a70e=getPDFDocDefinitionFromHTML(_0x4e9255,_0x40bf36);var _0x44d7a5=_0x592b86[_0xd1ac('0x54')](_0x9a70e);return writePDFDocument(_0x44d7a5,_0x40bf36[_0xd1ac('0x2')])[_0xd1ac('0x55')](function(_0xaf1757){throw _0xaf1757;});}; \ No newline at end of file +var _0xb07e=['isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','basename','.pdf','join','mkdirSync','each','createPdfKitDocument','pdf','all','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','toString','value','fill','length','auto','body','concat','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','landscape','\x20/\x20','Arial','black','right','Setting','find','split','splitSizePdf','then','range','num'];(function(_0x20f574,_0x225472){var _0x2048ed=function(_0x33d888){while(--_0x33d888){_0x20f574['push'](_0x20f574['shift']());}};_0x2048ed(++_0x225472);}(_0xb07e,0x83));var _0xeb07=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xb07e[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xeb07('0x0'));var fs=require('fs');var util=require(_0xeb07('0x1'));var path=require(_0xeb07('0x2'));var moment=require(_0xeb07('0x3'));var htmlToPdfmake=require(_0xeb07('0x4'));var PdfPrinter=require(_0xeb07('0x5'));var zipdir=require(_0xeb07('0x6'));var rimraf=require(_0xeb07('0x7'));var JSDOM=require(_0xeb07('0x8'))['JSDOM'];var window=new JSDOM('')[_0xeb07('0x9')];var BPromise=require(_0xeb07('0xa'));var db=require(_0xeb07('0xb'))['db'];var dbH=require(_0xeb07('0xb'))['dbH'];var logger=require(_0xeb07('0xc'))(_0xeb07('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xeb07('0xe')][0x3];var PATH=process[_0xeb07('0xe')][0x4];var NAME=process[_0xeb07('0xe')][0x5];var FORMAT=_0xeb07('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e4615,_0x45e05c){var _0x3b5a8f={'status':_0x2e4615};var _0x24cdfa={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x45e05c){_0x3b5a8f[_0xeb07('0x10')]=_0x45e05c;}return db[_0xeb07('0x11')]['update'](_0x3b5a8f,_0x24cdfa);}function getHeaders(_0x3debfd){return _[_0xeb07('0x12')](_0x3debfd,function(_0x3c3896){return{'text':_0x3c3896,'style':'tableHeader'};});}function getRows(_0x4dab7f,_0x5f27c1){return _['map'](_0x5f27c1,function(_0x12c285){return _(_0x12c285)['pick'](_0x4dab7f)['map'](function(_0x30d05c){return _0x30d05c?_[_0xeb07('0x13')](_0x30d05c):'';})[_0xeb07('0x14')]();});}function createTable(_0x1125e8,_0x1803aa){var _0x532294={'widths':_[_0xeb07('0x15')](Array(_0x1125e8[_0xeb07('0x16')]),0x91),'heights':function(_0x4ea475){return _0x4ea475===0x0?_0xeb07('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x58ba82=getHeaders(_0x1125e8);_0x532294[_0xeb07('0x18')]['push'](_0x58ba82);var _0x18fb37=getRows(_0x1125e8,_0x1803aa);_0x532294['body']=_0x532294[_0xeb07('0x18')][_0xeb07('0x19')](_0x18fb37);return _0x532294;}function createTables(_0x515072){var _0xbec7a1=[];var _0x44689a=_['chunk'](Object['keys'](_0x515072[0x0]),0x5);_0x44689a[_0xeb07('0x1a')](function(_0x20f371){_0xbec7a1[_0xeb07('0x1b')](createTable(_0x20f371,_0x515072));});return _0xbec7a1;}function getPDFDocDefinition(_0x196b9){var _0x53f3a6=util[_0xeb07('0x1c')](_0xeb07('0x1d'),NAME,EXTRACTED_REPORT[_0xeb07('0x1e')],moment(EXTRACTED_REPORT[_0xeb07('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xeb07('0x1c')](FORMAT));var _0x282de6=[];for(var _0x4fb5b2=0x0;_0x4fb5b2<_0x196b9[_0xeb07('0x16')];_0x4fb5b2++){var _0x384d2f=[];if(_0x4fb5b2===0x0){_0x384d2f[_0xeb07('0x1b')]({'text':_0x53f3a6,'style':_0xeb07('0x20')});}var _0x242f42={'table':_0x196b9[_0x4fb5b2]};if(_0x4fb5b2>0x0){_0x242f42[_0xeb07('0x21')]=_0xeb07('0x22');_0x242f42['margin']=[0x0,0x46,0x0,0x0];}_0x384d2f['push'](_0x242f42);_0x282de6[_0xeb07('0x1b')](_0x384d2f);}return{'pageSize':'A4','pageOrientation':_0xeb07('0x23'),'content':_0x282de6,'footer':function(_0x357109,_0x2f1d29){return{'text':_0x357109[_0xeb07('0x13')]()+_0xeb07('0x24')+_0x2f1d29,'style':'footer'};},'defaultStyle':{'font':_0xeb07('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xeb07('0x26')},'footer':{'alignment':_0xeb07('0x27'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4f4f80){var _0x1f28fa=0x1388;var _0x2767e0;if(!_0x4f4f80[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xeb07('0x28')][_0xeb07('0x29')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xeb07('0x2a'),_0xeb07('0x2b')]})[_0xeb07('0x2c')](function(_0x395258){if(_0x395258){_0x2767e0=_0x395258;_0x1f28fa=_0x2767e0[_0xeb07('0x2b')]||0x3e8;}})[_0xeb07('0x2c')](function(){var _0x56aeb7=[];var _0x433e4b=0x0;if(_0x2767e0[_0xeb07('0x2a')]){if(_0x4f4f80&&_0x4f4f80[_0xeb07('0x16')]){var _0x58c123=_[_0xeb07('0x2d')](_0x4f4f80[0x0][_0xeb07('0x2e')]/_0x1f28fa);var _0x2b674f=Number[_0xeb07('0x2f')](_0x4f4f80[0x0][_0xeb07('0x2e')]/_0x1f28fa)?_0x4f4f80[0x0]['num']%_0x1f28fa:0x0;_0x58c123[_0xeb07('0x1a')](function(_0x5d1063){if(_0x5d1063>0x0){_0x433e4b+=_0x1f28fa;}_0x56aeb7[_0xeb07('0x1b')](dbH[_0xeb07('0x30')][_0xeb07('0x31')](util[_0xeb07('0x1c')](_0xeb07('0x32'),QUERY,_0x1f28fa,_0x433e4b),{'type':dbH[_0xeb07('0x30')]['QueryTypes'][_0xeb07('0x33')]}));});if(_0x2b674f>0x0){_0x433e4b+=_0x1f28fa;_0x56aeb7['push'](dbH[_0xeb07('0x30')][_0xeb07('0x31')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b674f,_0x433e4b),{'type':dbH['sequelize'][_0xeb07('0x34')][_0xeb07('0x33')]}));}}}else{_0x56aeb7[_0xeb07('0x1b')](dbH[_0xeb07('0x30')][_0xeb07('0x31')](QUERY,{'type':dbH[_0xeb07('0x30')][_0xeb07('0x34')][_0xeb07('0x33')]}));}var _0x5b3b59=path['dirname'](PATH);var _0x4e6fc3=path[_0xeb07('0x35')](PATH,_0xeb07('0x36'));var _0x3f82b9=_0x2767e0['split']&&_0x56aeb7[_0xeb07('0x16')]>0x1;var _0x670fbf=[];if(!fs['existsSync'](path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3))&&_0x3f82b9){fs[_0xeb07('0x38')](path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3));}return BPromise[_0xeb07('0x39')](_0x56aeb7,function(_0x179485){_0x670fbf['push'](_0x179485);})['then'](function(){var _0x53003e=[];for(var _0x52301a=0x0;_0x52301a<_0x670fbf[_0xeb07('0x16')];_0x52301a+=0x1){var _0x183135=_0x670fbf[_0x52301a];var _0x3da5be=createTables(_['flatten'](_0x183135));var _0x544372;var _0x2715ec=getPDFDocDefinition(_0x3da5be);var _0x2a7dde=getPDFPrinter();var _0x339c2a=_0x2a7dde[_0xeb07('0x3a')](_0x2715ec);if(_0x3f82b9){_0x544372=path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3,util[_0xeb07('0x1c')]('%s%d.%s',_0x4e6fc3,_0x52301a,_0xeb07('0x3b')));}else{_0x544372=path[_0xeb07('0x37')](_0x5b3b59,util['format']('%s.%s',_0x4e6fc3,'pdf'));}_0x53003e[_0xeb07('0x1b')](writePDFDocument(_0x339c2a,_0x544372));}return Promise[_0xeb07('0x3c')](_0x53003e);})[_0xeb07('0x2c')](function(){if(_0x3f82b9){return new Promise(function(_0x5cfa4b){zipdir(path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3),{'saveTo':path[_0xeb07('0x37')](_0x5b3b59,util[_0xeb07('0x1c')](_0xeb07('0x3d'),_0x4e6fc3,_0xeb07('0x3e')))},function(){rimraf(path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3),function(){});_0x5cfa4b(_0xeb07('0x3f'));});});}})[_0xeb07('0x2c')](function(){if(!_0x3f82b9)return;rimraf(path[_0xeb07('0x37')](_0x5b3b59,_0x4e6fc3),function(){});})[_0xeb07('0x2c')](function(){logger[_0xeb07('0x40')](util[_0xeb07('0x1c')](_0xeb07('0x41'),EXTRACTED_REPORT_ID,_0xeb07('0x42')));return analyticExtractedReport(_0xeb07('0x43'),_0x3f82b9?util[_0xeb07('0x1c')](_0xeb07('0x3d'),_0x4e6fc3,_0x3f82b9?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xeb07('0x1c')](_0xeb07('0x44'),EXTRACTED_REPORT_ID,_0xeb07('0x42')));return db[_0xeb07('0x11')][_0xeb07('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xeb07('0x2c')](function(_0x5e456c){EXTRACTED_REPORT=_0x5e456c;return dbH[_0xeb07('0x30')]['query'](util['format'](_0xeb07('0x46'),QUERY),{'type':dbH[_0xeb07('0x30')][_0xeb07('0x34')][_0xeb07('0x33')]});})[_0xeb07('0x2c')](extractReport)[_0xeb07('0x47')](function(_0xa19ba6){logger[_0xeb07('0x40')](util[_0xeb07('0x1c')](_0xeb07('0x48'),EXTRACTED_REPORT_ID,_0xeb07('0x42')),util[_0xeb07('0x49')](_0xa19ba6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xeb07('0x4a'));})['finally'](function(){process[_0xeb07('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x134eba=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xeb07('0x4c'),'italics':__dirname+_0xeb07('0x4d'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x134eba;}function getPDFDocDefinitionFromHTML(_0x314b4e,_0x47f8f8){var _0x191475=util[_0xeb07('0x1c')](_0xeb07('0x4e'),_0x47f8f8[_0xeb07('0x4f')],_0x47f8f8['interactionId']);var _0x391474=moment()['format']('YYYY-MM-DD')[_0xeb07('0x13')]();var _0x1c58d5=htmlToPdfmake(_0x314b4e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1c58d5],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xeb07('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xeb07('0x50')}},'header':function(){return[{'text':_0xeb07('0x51'),'style':_0xeb07('0x20')}];},'footer':function(_0xeb91fe,_0x5a3878){return[{'text':util['format'](_0xeb07('0x52'),_0x191475,_0xeb91fe,_0x5a3878,_0x391474),'style':_0xeb07('0x53')}];}};}function writePDFDocument(_0x4888f6,_0xfa237e){return new Promise(function(_0x5a9387,_0x34401f){var _0x4b624f=_0x4888f6['pipe'](fs[_0xeb07('0x54')](_0xfa237e));_0x4b624f['on']('finish',function(){_0x5a9387(_0xeb07('0x55'));});_0x4b624f['on'](_0xeb07('0x56'),function(_0x51a24a){_0x34401f(_0x51a24a);});_0x4888f6[_0xeb07('0x57')]();});}exports[_0xeb07('0x58')]=function(_0x592fac,_0xa5a229){var _0x981fbd=getPDFPrinter();var _0x46dfbc=getPDFDocDefinitionFromHTML(_0x592fac,_0xa5a229);var _0x1f9be4=_0x981fbd[_0xeb07('0x3a')](_0x46dfbc);return writePDFDocument(_0x1f9be4,_0xa5a229[_0xeb07('0x2')])[_0xeb07('0x47')](function(_0xf2f2a8){throw _0xf2f2a8;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index eedffe4..571f5f1 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 _0x608a=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','length','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed'];(function(_0x453f0a,_0x107c3d){var _0x38c359=function(_0x5ab621){while(--_0x5ab621){_0x453f0a['push'](_0x453f0a['shift']());}};_0x38c359(++_0x107c3d);}(_0x608a,0xff));var _0xa608=function(_0x454e59,_0x29181d){_0x454e59=_0x454e59-0x0;var _0x34b913=_0x608a[_0x454e59];return _0x34b913;};'use strict';var util=require('util');var path=require(_0xa608('0x0'));var _=require(_0xa608('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xa608('0x2'));var zipdir=require(_0xa608('0x3'));var rimraf=require(_0xa608('0x4'));var db=require(_0xa608('0x5'))['db'];var dbH=require('../../mysqldb')[_0xa608('0x6')];var logger=require(_0xa608('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xa608('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2a2408,_0x46d6a7){var _0x6d5537={'status':_0x2a2408};var _0x516260={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x46d6a7){_0x6d5537[_0xa608('0x9')]=_0x46d6a7;}return db['AnalyticExtractedReport'][_0xa608('0xa')](_0x6d5537,_0x516260);}function main(){var _0x3d05c3=0x1388;var _0x5471fc;logger[_0xa608('0xb')](util[_0xa608('0xc')](_0xa608('0xd'),EXTRACTED_REPORT_ID,_0xa608('0xe')));return db['Setting'][_0xa608('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa608('0x10'),_0xa608('0x11')]})[_0xa608('0x12')](function(_0x30d74b){if(_0x30d74b){_0x5471fc=_0x30d74b;_0x3d05c3=_0x5471fc['splitSizeXlsx']||0x1388;}})[_0xa608('0x12')](function(){return dbH[_0xa608('0x13')]['query'](util['format'](_0xa608('0x14'),QUERY),{'type':dbH[_0xa608('0x13')][_0xa608('0x15')][_0xa608('0x16')]});})['then'](function(_0x35cd7a){if(!_0x35cd7a[0x0][_0xa608('0x17')]){return analyticExtractedReport('Empty');}var _0xf4fcf6=[];var _0x2d6790=0x0;if(_0x5471fc['split']){if(_0x35cd7a&&_0x35cd7a['length']){var _0x577f36=_[_0xa608('0x18')](_0x35cd7a[0x0][_0xa608('0x17')]/_0x3d05c3);var _0x34c145=Number[_0xa608('0x19')](_0x35cd7a[0x0]['num']/_0x3d05c3)?_0x35cd7a[0x0]['num']%_0x3d05c3:0x0;_0x577f36[_0xa608('0x1a')](function(_0x4ca138){if(_0x4ca138>0x0){_0x2d6790+=_0x3d05c3;}_0xf4fcf6[_0xa608('0x1b')](dbH[_0xa608('0x13')][_0xa608('0x1c')](util[_0xa608('0xc')](_0xa608('0x1d'),QUERY,_0x3d05c3,_0x2d6790),{'type':dbH[_0xa608('0x13')][_0xa608('0x15')][_0xa608('0x16')]}));});if(_0x34c145>0x0){_0x2d6790+=_0x3d05c3;_0xf4fcf6[_0xa608('0x1b')](dbH[_0xa608('0x13')][_0xa608('0x1c')](util[_0xa608('0xc')](_0xa608('0x1d'),QUERY,_0x34c145,_0x2d6790),{'type':dbH[_0xa608('0x13')]['QueryTypes'][_0xa608('0x16')]}));}}}else{_0xf4fcf6['push'](dbH[_0xa608('0x13')][_0xa608('0x1c')](QUERY,{'type':dbH[_0xa608('0x13')][_0xa608('0x15')][_0xa608('0x16')]}));}var _0x243f71=path[_0xa608('0x1e')](PATH);var _0x121119=path[_0xa608('0x1f')](PATH,'.xlsx');var _0x491f35=_0x5471fc[_0xa608('0x10')]&&_0xf4fcf6[_0xa608('0x20')]>0x1;var _0x38d67b=[];if(!fs[_0xa608('0x21')](path['join'](_0x243f71,_0x121119))&&_0x491f35){fs[_0xa608('0x22')](path[_0xa608('0x23')](_0x243f71,_0x121119));}return BPromise[_0xa608('0x24')](_0xf4fcf6,function(_0xf1de10){_0x38d67b[_0xa608('0x1b')](_0xf1de10);})['then'](function(){for(var _0x449633=0x0;_0x449633<_0x38d67b[_0xa608('0x20')];_0x449633+=0x1){var _0x529f42;var _0x2d6ca4=_0x38d67b[_0x449633];if(_0x491f35){_0x529f42=path['join'](_0x243f71,_0x121119,util[_0xa608('0xc')](_0xa608('0x25'),_0x121119,_0x449633,_0xa608('0x26')));}else{_0x529f42=path[_0xa608('0x23')](_0x243f71,util['format']('%s.%s',_0x121119,'xlsx'));}fs[_0xa608('0x27')](_0x529f42,json2xls(_0x2d6ca4),_0xa608('0x28'));}})['then'](function(){if(_0x491f35){return new Promise(function(_0x59294f){zipdir(path['join'](_0x243f71,_0x121119),{'saveTo':path['join'](_0x243f71,util[_0xa608('0xc')](_0xa608('0x29'),_0x121119,_0xa608('0x2a')))},function(_0x70483a,_0x36d0a1){rimraf(path['join'](_0x243f71,_0x121119),function(){});_0x59294f('zip\x20finished');});});}})[_0xa608('0x12')](function(){logger['info'](util[_0xa608('0xc')](_0xa608('0x2b'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa608('0x2c'),_0x491f35?util[_0xa608('0xc')]('%s.%s',_0x121119,_0x491f35?'zip':_0xa608('0x26')):null);});})[_0xa608('0x2d')](function(_0x35a305){logger['info'](util[_0xa608('0xc')](_0xa608('0x2e'),EXTRACTED_REPORT_ID,_0xa608('0xe')),util[_0xa608('0x2f')](_0x35a305,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa608('0x30'));})['finally'](function(){process[_0xa608('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf9d7=['analytics','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','inspect','Failed','finally','exit','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger'];(function(_0x35ba43,_0x551bfc){var _0x53c96a=function(_0x3f58ef){while(--_0x3f58ef){_0x35ba43['push'](_0x35ba43['shift']());}};_0x53c96a(++_0x551bfc);}(_0xf9d7,0xe4));var _0x7f9d=function(_0x34ab65,_0x356d84){_0x34ab65=_0x34ab65-0x0;var _0x31532c=_0xf9d7[_0x34ab65];return _0x31532c;};'use strict';var util=require('util');var path=require(_0x7f9d('0x0'));var _=require(_0x7f9d('0x1'));var fs=require('fs');var json2xls=require(_0x7f9d('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x7f9d('0x3'));var rimraf=require(_0x7f9d('0x4'));var db=require(_0x7f9d('0x5'))['db'];var dbH=require(_0x7f9d('0x5'))['dbH'];var logger=require(_0x7f9d('0x6'))(_0x7f9d('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dfd4b,_0x2398da){var _0x67afd5={'status':_0x2dfd4b};var _0x15ae2b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2398da){_0x67afd5[_0x7f9d('0x8')]=_0x2398da;}return db[_0x7f9d('0x9')][_0x7f9d('0xa')](_0x67afd5,_0x15ae2b);}function main(){var _0x30bd7e=0x1388;var _0x3a65d2;logger[_0x7f9d('0xb')](util['format'](_0x7f9d('0xc'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x7f9d('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7f9d('0xe'),'splitSizeXlsx']})[_0x7f9d('0xf')](function(_0x451dfd){if(_0x451dfd){_0x3a65d2=_0x451dfd;_0x30bd7e=_0x3a65d2[_0x7f9d('0x10')]||0x1388;}})['then'](function(){return dbH[_0x7f9d('0x11')][_0x7f9d('0x12')](util['format'](_0x7f9d('0x13'),QUERY),{'type':dbH[_0x7f9d('0x11')][_0x7f9d('0x14')]['SELECT']});})[_0x7f9d('0xf')](function(_0x33c658){if(!_0x33c658[0x0][_0x7f9d('0x15')]){return analyticExtractedReport(_0x7f9d('0x16'));}var _0x23f8d4=[];var _0x4fe549=0x0;if(_0x3a65d2[_0x7f9d('0xe')]){if(_0x33c658&&_0x33c658[_0x7f9d('0x17')]){var _0x80e9de=_[_0x7f9d('0x18')](_0x33c658[0x0][_0x7f9d('0x15')]/_0x30bd7e);var _0x2c67f1=Number['isInteger'](_0x33c658[0x0][_0x7f9d('0x15')]/_0x30bd7e)?_0x33c658[0x0][_0x7f9d('0x15')]%_0x30bd7e:0x0;_0x80e9de[_0x7f9d('0x19')](function(_0x512fa9){if(_0x512fa9>0x0){_0x4fe549+=_0x30bd7e;}_0x23f8d4['push'](dbH[_0x7f9d('0x11')]['query'](util[_0x7f9d('0x1a')](_0x7f9d('0x1b'),QUERY,_0x30bd7e,_0x4fe549),{'type':dbH[_0x7f9d('0x11')][_0x7f9d('0x14')][_0x7f9d('0x1c')]}));});if(_0x2c67f1>0x0){_0x4fe549+=_0x30bd7e;_0x23f8d4[_0x7f9d('0x1d')](dbH[_0x7f9d('0x11')][_0x7f9d('0x12')](util[_0x7f9d('0x1a')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2c67f1,_0x4fe549),{'type':dbH['sequelize'][_0x7f9d('0x14')]['SELECT']}));}}}else{_0x23f8d4[_0x7f9d('0x1d')](dbH[_0x7f9d('0x11')][_0x7f9d('0x12')](QUERY,{'type':dbH[_0x7f9d('0x11')][_0x7f9d('0x14')][_0x7f9d('0x1c')]}));}var _0x38b92a=path[_0x7f9d('0x1e')](PATH);var _0x50729e=path[_0x7f9d('0x1f')](PATH,'.xlsx');var _0x575951=_0x3a65d2[_0x7f9d('0xe')]&&_0x23f8d4['length']>0x1;var _0x40ac2e=[];if(!fs['existsSync'](path[_0x7f9d('0x20')](_0x38b92a,_0x50729e))&&_0x575951){fs['mkdirSync'](path[_0x7f9d('0x20')](_0x38b92a,_0x50729e));}return BPromise[_0x7f9d('0x21')](_0x23f8d4,function(_0x4f2b6b){_0x40ac2e[_0x7f9d('0x1d')](_0x4f2b6b);})['then'](function(){for(var _0x3a5e13=0x0;_0x3a5e13<_0x40ac2e[_0x7f9d('0x17')];_0x3a5e13+=0x1){var _0x77dec5;var _0x1c5829=_0x40ac2e[_0x3a5e13];if(_0x575951){_0x77dec5=path[_0x7f9d('0x20')](_0x38b92a,_0x50729e,util[_0x7f9d('0x1a')](_0x7f9d('0x22'),_0x50729e,_0x3a5e13,'xlsx'));}else{_0x77dec5=path[_0x7f9d('0x20')](_0x38b92a,util['format'](_0x7f9d('0x23'),_0x50729e,_0x7f9d('0x24')));}fs[_0x7f9d('0x25')](_0x77dec5,json2xls(_0x1c5829),_0x7f9d('0x26'));}})['then'](function(){if(_0x575951){return new Promise(function(_0x3792aa){zipdir(path[_0x7f9d('0x20')](_0x38b92a,_0x50729e),{'saveTo':path[_0x7f9d('0x20')](_0x38b92a,util[_0x7f9d('0x1a')](_0x7f9d('0x23'),_0x50729e,'zip'))},function(_0x1167f0,_0x3efa48){rimraf(path[_0x7f9d('0x20')](_0x38b92a,_0x50729e),function(){});_0x3792aa(_0x7f9d('0x27'));});});}})['then'](function(){logger['info'](util[_0x7f9d('0x1a')](_0x7f9d('0x28'),EXTRACTED_REPORT_ID,_0x7f9d('0x29')));return analyticExtractedReport(_0x7f9d('0x2a'),_0x575951?util['format'](_0x7f9d('0x23'),_0x50729e,_0x575951?'zip':'xlsx'):null);});})['catch'](function(_0x1c06db){logger['info'](util[_0x7f9d('0x1a')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7f9d('0x29')),util[_0x7f9d('0x2b')](_0x1c06db,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7f9d('0x2c'));})[_0x7f9d('0x2d')](function(){process[_0x7f9d('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f4e8ec4..965a191 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 _0x33fb=['VoiceExtensionId','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','IntervalId','map','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','findAll','then','intervals','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context'];(function(_0x7d1cf4,_0x1807db){var _0x2a6435=function(_0xa58eac){while(--_0xa58eac){_0x7d1cf4['push'](_0x7d1cf4['shift']());}};_0x2a6435(++_0x1807db);}(_0x33fb,0xb2));var _0xb33f=function(_0x21f3ed,_0x46e263){_0x21f3ed=_0x21f3ed-0x0;var _0x551aec=_0x33fb[_0x21f3ed];return _0x551aec;};'use strict';var _=require(_0xb33f('0x0'));var util=require('util');function rewrite(_0x27eddd,_0x58b391){var _0x270e31=this;return _0x27eddd[_0xb33f('0x1')]['Interval'][_0xb33f('0x2')]({'raw':!![]})[_0xb33f('0x3')](function(_0x427a88){_0x270e31[_0xb33f('0x4')]=_0x427a88;return _0x27eddd[_0xb33f('0x1')][_0xb33f('0x5')][_0xb33f('0x2')]({'where':{'IntervalId':_0x58b391['IntervalId']},'raw':!![]});})[_0xb33f('0x3')](function(_0x13d95b){return _0x27eddd[_0xb33f('0x1')][_0xb33f('0x5')][_0xb33f('0x2')]({'where':{'exten':{'$in':_[_0xb33f('0x6')](_['map'](_0x13d95b,'exten'))}},'order':[{'raw':_0xb33f('0x7')}],'raw':!![]});})[_0xb33f('0x3')](function(_0x142e6a){var _0x47ff91=_[_0xb33f('0x8')](_0x142e6a,{'priority':'1'});var _0x5a3830=_[_0xb33f('0x8')](_0x142e6a,{'isApp':0x1});var _0x4bac23=_[_0xb33f('0x9')](_0x5a3830,_0xb33f('0xa'));var _0x157a68=[_0xb33f('0xb'),_0xb33f('0xc')];var _0x1b056b=[];var _0x8c1436=[];for(var _0x452ebc in _0x4bac23){if(_0x4bac23['hasOwnProperty'](_0x452ebc)){_0x270e31[_0xb33f('0xd')]=0x2;_0x270e31[_0xb33f('0xe')]=[];_0x270e31[_0xb33f('0xf')]=_[_0xb33f('0x10')](_0x47ff91,{'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')]});_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':util[_0xb33f('0x14')](_0xb33f('0x15'),_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')]),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});if(_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')]==='inbound'){_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':_0xb33f('0x18')+_0x4bac23[_0x452ebc][0x0]['VoiceExtensionId'],'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31['priority']++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});}else if(_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')]===_0xb33f('0x19')){if(_0x270e31[_0xb33f('0xf')]){_0x270e31['extensions'][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':'CDR(destination)='+(_0x270e31[_0xb33f('0xf')][_0xb33f('0x1a')]?'${EXTEN:'+_0x270e31[_0xb33f('0xf')][_0xb33f('0x1a')]+'}':_0xb33f('0x1b')),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});}_0x270e31[_0xb33f('0xe')]['push']({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')],'context':_0x4bac23[_0x452ebc][0x0]['context'],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});var _0x455022=_0x270e31[_0xb33f('0xd')]++;_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0]['type'],'app':_0xb33f('0x1c'),'appdata':_0xb33f('0x1d')+(_0x455022+0x2)+_0xb33f('0x1e')+(_0x455022+0x1)+')','context':_0x4bac23[_0x452ebc][0x0]['context'],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x455022,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});if(_0x270e31[_0xb33f('0xf')]){_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':_0x270e31[_0xb33f('0xf')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x270e31['extension'][_0xb33f('0x1a')]+'}':_0xb33f('0x1f'),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0]['VoiceExtensionId']});}_0x270e31['extensions'][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':'Set','appdata':'outboundrouteid='+_0x4bac23[_0x452ebc][0x0]['VoiceExtensionId'],'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31['priority']++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});if(_0x270e31[_0xb33f('0xf')]&&_0x270e31['extension'][_0xb33f('0x20')](_0xb33f('0x21'))&&_0x270e31[_0xb33f('0xf')]['recordingFormat']!=='none'){_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':_0xb33f('0x22'),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});_0x270e31[_0xb33f('0xe')]['push']({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x270e31[_0xb33f('0xf')][_0xb33f('0x21')]||_0xb33f('0x23'),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});}}_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':'Set','appdata':_0xb33f('0x24'),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});_0x270e31[_0xb33f('0xe')][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':_0xb33f('0x25'),'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'exten':_0x4bac23[_0x452ebc][0x0][_0xb33f('0xa')],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0]['VoiceExtensionId']});_0x270e31['extensions'][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':'Set','appdata':_0xb33f('0x26'),'context':_0x4bac23[_0x452ebc][0x0]['context'],'exten':_0x4bac23[_0x452ebc][0x0]['exten'],'priority':_0x270e31[_0xb33f('0xd')]++,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});for(var _0x2d4194=0x0,_0x2508b6=0x0;_0x2d4194<_0x4bac23[_0x452ebc][_0xb33f('0x27')];_0x2d4194+=0x1,_0x2508b6=0x0){var _0x3e0189=_0x4bac23[_0x452ebc][_0x2d4194];if(_0x3e0189[_0xb33f('0x12')]){_0x3e0189[_0xb33f('0x12')]=_0x3e0189[_0xb33f('0x12')][_0xb33f('0x28')]();}var _0x234e8d=[];var _0x55caad=[];delete _0x3e0189['id'];delete _0x3e0189[_0xb33f('0x29')];delete _0x3e0189[_0xb33f('0x2a')];var _0x5c2d99=_0x3e0189[_0xb33f('0x2b')]!=='*,*,*,*'?[_0x3e0189[_0xb33f('0x2b')]]:_0x3e0189[_0xb33f('0x2c')]?_[_0xb33f('0x2d')](_[_0xb33f('0x8')](_0x270e31[_0xb33f('0x4')],{'IntervalId':_0x3e0189['IntervalId']}),_0xb33f('0x2b')):[];if(_0x3e0189[_0xb33f('0x20')]('tag')){if(_0x3e0189[_0xb33f('0x2e')]&&_0x3e0189['tag']!=='--'){_0x234e8d[_0xb33f('0x11')]({'type':_0x3e0189['type'],'app':_0xb33f('0x13'),'appdata':'CDR(tag)='+_0x3e0189['tag'],'context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99[_0xb33f('0x27')]+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});}}if(_0x3e0189[_0xb33f('0x12')]===_0xb33f('0x19')&&_0x3e0189[_0xb33f('0x20')]('callerID')){if(_0x3e0189['callerID']){_0x234e8d['push']({'type':_0x3e0189[_0xb33f('0x12')],'app':'ExecIf','appdata':_0xb33f('0x2f')+_0x3e0189[_0xb33f('0x30')]+')','context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99['length']+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189['VoiceExtensionId']});}else{_0x234e8d[_0xb33f('0x11')]({'type':_0x3e0189[_0xb33f('0x12')],'app':'ExecIf','appdata':_0xb33f('0x31'),'context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99['length']+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});}}if(_0x3e0189[_0xb33f('0x20')]('answer')){if(_0x157a68[_0xb33f('0x32')](_0x3e0189[_0xb33f('0x33')][_0xb33f('0x28')]())>=0x0&&_0x3e0189[_0xb33f('0x34')]!=='custom'){if(_0x3e0189[_0xb33f('0x35')]){_0x234e8d['push']({'type':_0x3e0189['type'],'app':_0xb33f('0x1c'),'appdata':_0xb33f('0x36'),'context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99[_0xb33f('0x27')]+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});_0x234e8d[_0xb33f('0x11')]({'type':_0x3e0189[_0xb33f('0x12')],'app':_0xb33f('0x13'),'appdata':_0xb33f('0x37'),'context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99[_0xb33f('0x27')]+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});}else{_0x234e8d['push']({'type':_0x3e0189[_0xb33f('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3e0189[_0xb33f('0x16')],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99[_0xb33f('0x27')]+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});_0x234e8d[_0xb33f('0x11')]({'type':_0x3e0189['type'],'app':_0xb33f('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3e0189['context'],'exten':_0x3e0189[_0xb33f('0xa')],'priority':_0x5c2d99[_0xb33f('0x27')]+_0x270e31[_0xb33f('0xd')]+_0x2508b6++,'VoiceExtensionId':_0x3e0189[_0xb33f('0x17')]});}}}for(var _0x36bbee=0x0;_0x36bbee<_0x5c2d99[_0xb33f('0x27')];_0x36bbee+=0x1){var _0x1c8fbc=_0x270e31[_0xb33f('0xd')]+_0x5c2d99[_0xb33f('0x27')];var _0x541020=_0x36bbee===_0x5c2d99[_0xb33f('0x27')]-0x1?_0x270e31[_0xb33f('0xd')]+_0x234e8d[_0xb33f('0x27')]+_0x55caad[_0xb33f('0x27')]+0x2:_0x270e31['priority']+_0x36bbee+0x1;_0x234e8d[_0xb33f('0x38')](_0x36bbee,0x0,{'type':_0x3e0189['type'],'app':'GotoIfTime','appdata':_0x5c2d99[_0x36bbee]+'?'+_0x3e0189[_0xb33f('0x16')]+_0xb33f('0x39')+_0x1c8fbc+':'+_0x3e0189[_0xb33f('0x16')]+_0xb33f('0x39')+_0x541020,'exten':_0x3e0189[_0xb33f('0xa')],'context':_0x3e0189['context'],'priority':_0x270e31[_0xb33f('0xd')]+_0x36bbee,'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});}_0x3e0189['priority']=_0x234e8d[_0xb33f('0x27')]?_[_0xb33f('0x3a')](_0x234e8d)[_0xb33f('0xd')]+0x1:_0x270e31[_0xb33f('0xd')];_0x270e31[_0xb33f('0xd')]=(_0x55caad[_0xb33f('0x27')]?_[_0xb33f('0x3a')](_0x55caad)['priority']:_0x3e0189[_0xb33f('0xd')])+0x1;_0x270e31['extensions']=_[_0xb33f('0x3b')](_0x270e31['extensions'],_0x234e8d,[_0x3e0189],_0x55caad);}_0x270e31['extensions'][_0xb33f('0x11')]({'type':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x12')],'app':_0xb33f('0x3c'),'exten':_0x4bac23[_0x452ebc][0x0]['exten'],'context':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x16')],'priority':_0x270e31[_0xb33f('0xd')],'VoiceExtensionId':_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]});_0x1b056b['push'](_0x4bac23[_0x452ebc][0x0][_0xb33f('0x17')]);_0x8c1436=_[_0xb33f('0x3b')](_0x8c1436,_0x270e31[_0xb33f('0xe')]);}}return _0x27eddd['transaction'](function(_0x572e22){return _0x27eddd[_0xb33f('0x1')]['VoiceExtension'][_0xb33f('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x1b056b}},'transaction':_0x572e22})[_0xb33f('0x3')](function(_0x57dbc0){return _0x27eddd[_0xb33f('0x1')]['VoiceExtension'][_0xb33f('0x3e')](_[_0xb33f('0x3f')](_0x8c1436,_0xb33f('0xd')),{'transaction':_0x572e22});});});})[_0xb33f('0x40')](function(_0x1e7f94){console[_0xb33f('0x41')](_0x1e7f94);});}exports[_0xb33f('0x42')]=rewrite; \ No newline at end of file +var _0xe7ca=[',${EXTEN},','last','Hangup','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','VoiceExtensionId','inbound','Set','CDR(routeid)=','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','*,*,*,*','interval','tag','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime'];(function(_0x517ef4,_0x2592d1){var _0x26f4d3=function(_0x1267e6){while(--_0x1267e6){_0x517ef4['push'](_0x517ef4['shift']());}};_0x26f4d3(++_0x2592d1);}(_0xe7ca,0x172));var _0xae7c=function(_0x18bcc0,_0x3613db){_0x18bcc0=_0x18bcc0-0x0;var _0x40bdcb=_0xe7ca[_0x18bcc0];return _0x40bdcb;};'use strict';var _=require(_0xae7c('0x0'));var util=require(_0xae7c('0x1'));function rewrite(_0x5ae80b,_0x2e5fce){var _0x267454=this;return _0x5ae80b[_0xae7c('0x2')][_0xae7c('0x3')][_0xae7c('0x4')]({'raw':!![]})[_0xae7c('0x5')](function(_0x57395d){_0x267454['intervals']=_0x57395d;return _0x5ae80b[_0xae7c('0x2')][_0xae7c('0x6')][_0xae7c('0x4')]({'where':{'IntervalId':_0x2e5fce[_0xae7c('0x7')]},'raw':!![]});})[_0xae7c('0x5')](function(_0x23f417){return _0x5ae80b[_0xae7c('0x2')]['VoiceExtension'][_0xae7c('0x4')]({'where':{'exten':{'$in':_[_0xae7c('0x8')](_[_0xae7c('0x9')](_0x23f417,'exten'))}},'order':[{'raw':_0xae7c('0xa')}],'raw':!![]});})[_0xae7c('0x5')](function(_0x3f1d14){var _0xf5582=_[_0xae7c('0xb')](_0x3f1d14,{'priority':'1'});var _0x27a7a5=_['filter'](_0x3f1d14,{'isApp':0x1});var _0x3c73ac=_[_0xae7c('0xc')](_0x27a7a5,_0xae7c('0xd'));var _0x346b85=[_0xae7c('0xe'),_0xae7c('0xf')];var _0x5f1b19=[];var _0x40d508=[];for(var _0x5662d5 in _0x3c73ac){if(_0x3c73ac[_0xae7c('0x10')](_0x5662d5)){_0x267454[_0xae7c('0x11')]=0x2;_0x267454[_0xae7c('0x12')]=[];_0x267454[_0xae7c('0x13')]=_[_0xae7c('0x14')](_0xf5582,{'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')]});_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':'Set','appdata':util[_0xae7c('0x17')](_0xae7c('0x18'),_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')]),'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});if(_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')]===_0xae7c('0x1a')){_0x267454['extensions'][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x1c')+_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')],'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0]['exten'],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});}else if(_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')]==='outbound'){if(_0x267454[_0xae7c('0x13')]){_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':'Set','appdata':'CDR(destination)='+(_0x267454[_0xae7c('0x13')][_0xae7c('0x1d')]?_0xae7c('0x1e')+_0x267454['extension'][_0xae7c('0x1d')]+'}':_0xae7c('0x1f')),'context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});}_0x267454['extensions'][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':'Set','appdata':_0xae7c('0x1c')+_0x3c73ac[_0x5662d5][0x0]['VoiceExtensionId'],'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});var _0x48a23d=_0x267454[_0xae7c('0x11')]++;_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x21'),'appdata':_0xae7c('0x22')+(_0x48a23d+0x2)+'):Goto('+(_0x48a23d+0x1)+')','context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x48a23d,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});if(_0x267454[_0xae7c('0x13')]){_0x267454['extensions'][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':_0x267454[_0xae7c('0x13')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x267454[_0xae7c('0x13')]['cutdigits']+'}':_0xae7c('0x23'),'context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});}_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x24')+_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')],'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454['priority']++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});if(_0x267454[_0xae7c('0x13')]&&_0x267454['extension']['hasOwnProperty'](_0xae7c('0x25'))&&_0x267454[_0xae7c('0x13')][_0xae7c('0x25')]!==_0xae7c('0x26')){_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0]['type'],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x27'),'context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0]['VoiceExtensionId']});_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0]['type'],'app':'Set','appdata':_0xae7c('0x28')+_0x267454[_0xae7c('0x13')][_0xae7c('0x25')]||_0xae7c('0x29'),'context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});}}_0x267454[_0xae7c('0x12')][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x2a'),'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});_0x267454[_0xae7c('0x12')]['push']({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x2b'),'context':_0x3c73ac[_0x5662d5][0x0]['context'],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});_0x267454['extensions'][_0xae7c('0x15')]({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x1b'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'priority':_0x267454[_0xae7c('0x11')]++,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});for(var _0x59a932=0x0,_0x21935a=0x0;_0x59a932<_0x3c73ac[_0x5662d5]['length'];_0x59a932+=0x1,_0x21935a=0x0){var _0x5bb63a=_0x3c73ac[_0x5662d5][_0x59a932];if(_0x5bb63a['type']){_0x5bb63a['type']=_0x5bb63a[_0xae7c('0x16')][_0xae7c('0x2c')]();}var _0x3981a4=[];var _0x1de0b8=[];delete _0x5bb63a['id'];delete _0x5bb63a['createdAt'];delete _0x5bb63a['updatedAt'];var _0x12d7b3=_0x5bb63a['interval']!==_0xae7c('0x2d')?[_0x5bb63a[_0xae7c('0x2e')]]:_0x5bb63a[_0xae7c('0x7')]?_[_0xae7c('0x9')](_[_0xae7c('0xb')](_0x267454['intervals'],{'IntervalId':_0x5bb63a[_0xae7c('0x7')]}),'interval'):[];if(_0x5bb63a[_0xae7c('0x10')]('tag')){if(_0x5bb63a[_0xae7c('0x2f')]&&_0x5bb63a['tag']!=='--'){_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a['type'],'app':'Set','appdata':'CDR(tag)='+_0x5bb63a[_0xae7c('0x2f')],'context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454[_0xae7c('0x11')]+_0x21935a++,'VoiceExtensionId':_0x5bb63a[_0xae7c('0x19')]});}}if(_0x5bb63a['type']===_0xae7c('0x31')&&_0x5bb63a[_0xae7c('0x10')](_0xae7c('0x32'))){if(_0x5bb63a['callerID']){_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a[_0xae7c('0x16')],'app':_0xae7c('0x21'),'appdata':_0xae7c('0x33')+_0x5bb63a[_0xae7c('0x32')]+')','context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454[_0xae7c('0x11')]+_0x21935a++,'VoiceExtensionId':_0x5bb63a[_0xae7c('0x19')]});}else{_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a[_0xae7c('0x16')],'app':'ExecIf','appdata':_0xae7c('0x34'),'context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454[_0xae7c('0x11')]+_0x21935a++,'VoiceExtensionId':_0x5bb63a[_0xae7c('0x19')]});}}if(_0x5bb63a[_0xae7c('0x10')]('answer')){if(_0x346b85[_0xae7c('0x35')](_0x5bb63a[_0xae7c('0x36')]['toLowerCase']())>=0x0&&_0x5bb63a[_0xae7c('0x37')]!==_0xae7c('0x38')){if(_0x5bb63a[_0xae7c('0x39')]){_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a[_0xae7c('0x16')],'app':_0xae7c('0x21'),'appdata':_0xae7c('0x3a'),'context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a['exten'],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454['priority']+_0x21935a++,'VoiceExtensionId':_0x5bb63a['VoiceExtensionId']});_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a['type'],'app':_0xae7c('0x1b'),'appdata':_0xae7c('0x3b'),'context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454[_0xae7c('0x11')]+_0x21935a++,'VoiceExtensionId':_0x5bb63a['VoiceExtensionId']});}else{_0x3981a4[_0xae7c('0x15')]({'type':_0x5bb63a[_0xae7c('0x16')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5bb63a['context'],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3['length']+_0x267454[_0xae7c('0x11')]+_0x21935a++,'VoiceExtensionId':_0x5bb63a[_0xae7c('0x19')]});_0x3981a4['push']({'type':_0x5bb63a[_0xae7c('0x16')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x5bb63a[_0xae7c('0x20')],'exten':_0x5bb63a[_0xae7c('0xd')],'priority':_0x12d7b3[_0xae7c('0x30')]+_0x267454['priority']+_0x21935a++,'VoiceExtensionId':_0x5bb63a['VoiceExtensionId']});}}}for(var _0x4da959=0x0;_0x4da959<_0x12d7b3[_0xae7c('0x30')];_0x4da959+=0x1){var _0x17724f=_0x267454[_0xae7c('0x11')]+_0x12d7b3[_0xae7c('0x30')];var _0x51cb59=_0x4da959===_0x12d7b3[_0xae7c('0x30')]-0x1?_0x267454[_0xae7c('0x11')]+_0x3981a4[_0xae7c('0x30')]+_0x1de0b8[_0xae7c('0x30')]+0x2:_0x267454[_0xae7c('0x11')]+_0x4da959+0x1;_0x3981a4[_0xae7c('0x3c')](_0x4da959,0x0,{'type':_0x5bb63a[_0xae7c('0x16')],'app':_0xae7c('0x3d'),'appdata':_0x12d7b3[_0x4da959]+'?'+_0x5bb63a['context']+_0xae7c('0x3e')+_0x17724f+':'+_0x5bb63a[_0xae7c('0x20')]+_0xae7c('0x3e')+_0x51cb59,'exten':_0x5bb63a['exten'],'context':_0x5bb63a[_0xae7c('0x20')],'priority':_0x267454[_0xae7c('0x11')]+_0x4da959,'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0]['VoiceExtensionId']});}_0x5bb63a['priority']=_0x3981a4[_0xae7c('0x30')]?_['last'](_0x3981a4)[_0xae7c('0x11')]+0x1:_0x267454[_0xae7c('0x11')];_0x267454[_0xae7c('0x11')]=(_0x1de0b8[_0xae7c('0x30')]?_[_0xae7c('0x3f')](_0x1de0b8)['priority']:_0x5bb63a[_0xae7c('0x11')])+0x1;_0x267454[_0xae7c('0x12')]=_['concat'](_0x267454[_0xae7c('0x12')],_0x3981a4,[_0x5bb63a],_0x1de0b8);}_0x267454['extensions']['push']({'type':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x16')],'app':_0xae7c('0x40'),'exten':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0xd')],'context':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x20')],'priority':_0x267454[_0xae7c('0x11')],'VoiceExtensionId':_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]});_0x5f1b19[_0xae7c('0x15')](_0x3c73ac[_0x5662d5][0x0][_0xae7c('0x19')]);_0x40d508=_[_0xae7c('0x41')](_0x40d508,_0x267454[_0xae7c('0x12')]);}}return _0x5ae80b[_0xae7c('0x42')](function(_0x2378ac){return _0x5ae80b[_0xae7c('0x2')][_0xae7c('0x6')][_0xae7c('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x5f1b19}},'transaction':_0x2378ac})[_0xae7c('0x5')](function(_0x24067d){return _0x5ae80b['models'][_0xae7c('0x6')]['bulkCreate'](_[_0xae7c('0x44')](_0x40d508,_0xae7c('0x11')),{'transaction':_0x2378ac});});});})[_0xae7c('0x45')](function(_0x7cd8e7){console[_0xae7c('0x46')](_0x7cd8e7);});}exports[_0xae7c('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c652887..c883b6e 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 _0xa4be=['finally','contact:csv_','resume','resolve','emit','exit','info','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','errors','length','map','message','join','data','firstName','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','CmContact','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','into','cm_contacts','id\x20IN\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CmList','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:'];(function(_0x5e5d99,_0xbd1656){var _0x1b568e=function(_0x1ffcc1){while(--_0x1ffcc1){_0x5e5d99['push'](_0x5e5d99['shift']());}};_0x1b568e(++_0xbd1656);}(_0xa4be,0x76));var _0xea4b=function(_0x5736a4,_0x6cc10a){_0x5736a4=_0x5736a4-0x0;var _0x8e9571=_0xa4be[_0x5736a4];return _0x8e9571;};'use strict';var BPromise=require(_0xea4b('0x0'));var util=require(_0xea4b('0x1'));var _=require(_0xea4b('0x2'));var fs=require('fs');var squel=require(_0xea4b('0x3'));var Papa=require(_0xea4b('0x4'));var Redis=require(_0xea4b('0x5'));var db=require(_0xea4b('0x6'))['db'];var config=require(_0xea4b('0x7'));var logger=require(_0xea4b('0x8'))('api');config[_0xea4b('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xea4b('0xa'))[_0xea4b('0xb')](socket);try{if(!process[_0xea4b('0xc')][0x2]||process[_0xea4b('0xc')][0x2]===_0xea4b('0xd')||process['argv'][0x2]===_0xea4b('0xe')){throw new Error(_0xea4b('0xf'));}var FILEPATH=process[_0xea4b('0xc')][0x2];if(!process[_0xea4b('0xc')][0x3]||process[_0xea4b('0xc')][0x3]===_0xea4b('0xd')||process[_0xea4b('0xc')][0x3]===_0xea4b('0xe')||!process[_0xea4b('0xc')][0x4]||process['argv'][0x4]==='undefined'||process[_0xea4b('0xc')][0x4]===_0xea4b('0xe')){throw new Error(_0xea4b('0x10'));}var FIELDS=_[_0xea4b('0x11')](process['argv'][0x3][_0xea4b('0x12')](','),process[_0xea4b('0xc')][0x4][_0xea4b('0x12')](','));if(!process[_0xea4b('0xc')][0x5]||process['argv'][0x5]===_0xea4b('0xd')||process[_0xea4b('0xc')][0x5]===_0xea4b('0xe')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xea4b('0xc')][0x6]&&process[_0xea4b('0xc')][0x6]!==_0xea4b('0xd')&&process[_0xea4b('0xc')][0x6]!==_0xea4b('0xe')?process[_0xea4b('0xc')][0x6]:null;var DUPLICATES=process[_0xea4b('0xc')][0x7]&&process[_0xea4b('0xc')][0x7]!==_0xea4b('0xd')&&process[_0xea4b('0xc')][0x7]!=='null'?process[_0xea4b('0xc')][0x7]:null;if(!process[_0xea4b('0xc')][0x8]||process[_0xea4b('0xc')][0x8]==='undefined'||process['argv'][0x8]===_0xea4b('0xe')){throw new Error(_0xea4b('0x13'));}var SOCKET_TIMESTAMP=process[_0xea4b('0xc')][0x8];}catch(_0x21188a){logger[_0xea4b('0x14')](_0x21188a);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(_0x1f970a,_0x5d3f27,_0x9e07e1,_0x3a3c4d){var _0x4c2df1={'message':_0x5d3f27};_0x4c2df1[_0x1f970a]=!![];if(_0x9e07e1){_0x4c2df1[_0xea4b('0x15')]=_0x9e07e1;}if(_0x3a3c4d){_0x4c2df1[_0xea4b('0x16')]=_0x3a3c4d;}return _0x4c2df1;}function isEmail(_0x26429b){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))*$/[_0xea4b('0x17')](_0x26429b);}function checkRow(_0x23d326,_0x320b1c,_0x8ab725){return new BPromise(function(_0x4e6ee0,_0x471bd0){if(_[_0xea4b('0x18')](_0x23d326)){return _0x471bd0(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x8ab725));}if(_0x23d326[_0xea4b('0x19')]&&_0x23d326[_0xea4b('0x19')][_0xea4b('0x1a')]){var _0x4da107=_[_0xea4b('0x1b')](_0x23d326[_0xea4b('0x19')],_0xea4b('0x1c'))[_0xea4b('0x1d')](';');return _0x471bd0(handleCheckRowError(_0xea4b('0x14'),_0x4da107,null,_0x8ab725));}var _0x289cc0={};for(var _0xaf2fb6 in FIELDS){if(FIELDS['hasOwnProperty'](_0xaf2fb6)&&FIELDS[_0xaf2fb6]){_0x289cc0[_0xaf2fb6]=_0x23d326[_0xea4b('0x1e')][0x0][FIELDS[_0xaf2fb6]]||_0x23d326['data'][0x0]['\ufeff'+FIELDS[_0xaf2fb6]];}}if(!_0x289cc0[_0xea4b('0x1f')]){return _0x471bd0(handleCheckRowError(_0xea4b('0x14'),'firstName\x20not\x20specified!',null,_0x8ab725));}if(!_0x289cc0[_0xea4b('0x20')]){return _0x471bd0(handleCheckRowError(_0xea4b('0x14'),_0xea4b('0x21'),null,_0x8ab725));}if(_0x289cc0[_0xea4b('0x22')]){var _0x5b95d7=moment(_0x289cc0['birthDate'],_0xea4b('0x23'));if(!_0x5b95d7[_0xea4b('0x24')]()){return _0x471bd0(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x8ab725));}}if(_0x289cc0[_0xea4b('0x25')]){if(!isEmail(_0x289cc0['email'])){return _0x471bd0(handleCheckRowError('error',_0xea4b('0x26'),null,_0x8ab725));}}_0x289cc0[_0xea4b('0x27')]=LISTID;_0x289cc0['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xea4b('0x1a')]&&_0x320b1c){var _0x158cdc={};for(var _0x37c13e=0x0,_0x50eea9=DUPLICATES[_0xea4b('0x1a')];_0x37c13e<_0x50eea9;_0x37c13e+=0x1){_0x158cdc[DUPLICATES[_0x37c13e]]=_0x289cc0[DUPLICATES[_0x37c13e]];}var _0x324086=_[_0xea4b('0x28')](_0x320b1c,_0x158cdc);if(_0x324086){return _0x471bd0(handleCheckRowError(_0xea4b('0x29'),'Duplicate\x20Contact',_0x324086,_0x8ab725));}}return db[_0xea4b('0x2a')]['create'](_0x289cc0,{'raw':!![],'hooks':![],'fields':_['keys'](_0x289cc0)})[_0xea4b('0x2b')](function(_0x511d65){if(DUPLICATES&&DUPLICATES[_0xea4b('0x1a')]&&_0x320b1c){_0x320b1c[_0xea4b('0x2c')](_[_0xea4b('0x2d')](_0x289cc0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x511d65['id'];return _0x4e6ee0();})[_0xea4b('0x2e')](function(_0x547b09){return _0x471bd0(handleCheckRowError(_0xea4b('0x14'),_0xea4b('0x2f')+(_0x547b09['message']||JSON[_0xea4b('0x30')](_0x547b09)),null,_0x8ab725));});});}function checkHopper(){function _0x35f574(){return function(_0x37a5c0){logger['error'](_0xea4b('0x31'),_0xea4b('0x32'),util['inspect'](_0x37a5c0,{'showHidden':![],'depth':null}));};}var _0x52cf8c=function(_0x17da43,_0xa08784){var _0x4bff74=squel[_0xea4b('0x33')]()['into'](_0xea4b('0x34'))[_0xea4b('0x35')]([_0xea4b('0x20'),_0xea4b('0x36'),_0xea4b('0x37'),_0xea4b('0x27'),_0xa08784,_0xea4b('0x38'),_0xea4b('0x39')],squel['select']()[_0xea4b('0x3a')](_0xea4b('0x20'),_0xea4b('0x20'))[_0xea4b('0x3a')](_0xea4b('0x3b'),_0xea4b('0x36'))[_0xea4b('0x3a')]('id',_0xea4b('0x37'))[_0xea4b('0x3a')](LISTID[_0xea4b('0x3c')](),_0xea4b('0x27'))['field'](_0x17da43['id']['toString'](),_0xa08784)['field'](_0xea4b('0x3b'),_0xea4b('0x38'))[_0xea4b('0x3a')](_0xea4b('0x3b'),'updatedAt')[_0xea4b('0x3d')]('cm_contacts')['where'](_0xea4b('0x3e'))[_0xea4b('0x3f')](_0xea4b('0x40'),LISTID[_0xea4b('0x3c')]())[_0xea4b('0x3f')](_0xea4b('0x41'))[_0xea4b('0x3f')](_0xea4b('0x42'),squel[_0xea4b('0x43')]()[_0xea4b('0x3a')]('phone')[_0xea4b('0x3d')](_0xea4b('0x34'))[_0xea4b('0x3f')](_0xa08784+'\x20=\x20?',_0x17da43['id'][_0xea4b('0x3c')]())))[_0xea4b('0x3c')]();return _0x4bff74;};var _0x686666=function(_0x4190cb,_0x26c91d){var _0x2637fe=squel[_0xea4b('0x33')]()[_0xea4b('0x44')](_0xea4b('0x34'))['fromQuery'](['phone',_0xea4b('0x36'),_0xea4b('0x37'),_0xea4b('0x27'),_0x26c91d,_0xea4b('0x38'),_0xea4b('0x39')],squel[_0xea4b('0x43')]()[_0xea4b('0x3a')](_0xea4b('0x20'),'phone')[_0xea4b('0x3a')](_0xea4b('0x3b'),'scheduledAt')[_0xea4b('0x3a')]('id',_0xea4b('0x37'))['field'](LISTID['toString'](),_0xea4b('0x27'))[_0xea4b('0x3a')](_0x4190cb['id'][_0xea4b('0x3c')](),_0x26c91d)[_0xea4b('0x3a')](_0xea4b('0x3b'),_0xea4b('0x38'))['field'](_0xea4b('0x3b'),'updatedAt')[_0xea4b('0x3d')](_0xea4b('0x45'))[_0xea4b('0x3f')](_0xea4b('0x3e'))['where'](_0xea4b('0x40'),LISTID['toString']())[_0xea4b('0x3f')](_0xea4b('0x46'),squel['str'](hopperContacts))[_0xea4b('0x3f')](_0xea4b('0x41'))[_0xea4b('0x3f')](_0xea4b('0x42'),squel[_0xea4b('0x43')]()[_0xea4b('0x3a')](_0xea4b('0x47'))['from']('cm_hopper_final')[_0xea4b('0x3f')](_0x26c91d+'\x20=\x20?',_0x4190cb['id'][_0xea4b('0x3c')]()))[_0xea4b('0x3f')](_0xea4b('0x42'),squel[_0xea4b('0x43')]()[_0xea4b('0x3a')](_0xea4b('0x20'))[_0xea4b('0x3d')](_0xea4b('0x34'))[_0xea4b('0x3f')](_0x26c91d+_0xea4b('0x48'),_0x4190cb['id'][_0xea4b('0x3c')]())))['toString']();return _0x2637fe;};function _0x40bc95(_0x493071,_0x42167f){var _0x18db86=squel[_0xea4b('0x33')]()['into'](_0xea4b('0x34'))[_0xea4b('0x35')]([_0xea4b('0x20'),'scheduledAt','ContactId',_0xea4b('0x27'),_0x42167f,_0xea4b('0x38'),_0xea4b('0x39')],squel[_0xea4b('0x43')]()[_0xea4b('0x3a')](_0xea4b('0x20'),_0xea4b('0x20'))['field'](_0xea4b('0x3b'),_0xea4b('0x36'))['field']('id',_0xea4b('0x37'))[_0xea4b('0x3a')](LISTID[_0xea4b('0x3c')](),_0xea4b('0x27'))['field'](_0x493071['id'][_0xea4b('0x3c')](),_0x42167f)[_0xea4b('0x3a')](_0xea4b('0x3b'),_0xea4b('0x38'))[_0xea4b('0x3a')](_0xea4b('0x3b'),_0xea4b('0x39'))[_0xea4b('0x3d')]('cm_contacts')['where'](_0xea4b('0x3e'))[_0xea4b('0x3f')](_0xea4b('0x40'),LISTID[_0xea4b('0x3c')]())[_0xea4b('0x3f')](_0xea4b('0x46'),squel[_0xea4b('0x49')](hopperContacts))[_0xea4b('0x3f')](_0xea4b('0x41')))['toString']();return _0x18db86;}function _0x438b0b(_0x5957b8,_0x5ea50a){var _0x5103bf=squel[_0xea4b('0x33')]()['into'](_0xea4b('0x4a'))[_0xea4b('0x35')]([_0xea4b('0x20'),_0xea4b('0x37'),_0xea4b('0x27'),_0x5ea50a,_0xea4b('0x38'),_0xea4b('0x39')],squel[_0xea4b('0x43')]()[_0xea4b('0x3a')](_0xea4b('0x20'),'phone')[_0xea4b('0x3a')]('id','ContactId')[_0xea4b('0x3a')](LISTID[_0xea4b('0x3c')](),_0xea4b('0x27'))['field'](_0x5957b8['id'][_0xea4b('0x3c')](),_0x5ea50a)[_0xea4b('0x3a')](_0xea4b('0x3b'),_0xea4b('0x38'))['field'](_0xea4b('0x3b'),_0xea4b('0x39'))[_0xea4b('0x3d')](_0xea4b('0x45'))[_0xea4b('0x3f')](_0xea4b('0x3e'))[_0xea4b('0x3f')](_0xea4b('0x40'),LISTID[_0xea4b('0x3c')]())[_0xea4b('0x3f')](_0xea4b('0x46'),squel[_0xea4b('0x49')](hopperContacts))[_0xea4b('0x3f')](_0xea4b('0x41')))['toString']();return _0x5103bf;}return db[_0xea4b('0x4b')][_0xea4b('0x4c')]({'where':{'type':_0xea4b('0x4d')},'attributes':['id',_0xea4b('0x4e')],'include':[{'model':db['CmList'],'as':_0xea4b('0x4f'),'where':{'id':LISTID}}]})[_0xea4b('0x2b')](function(_0x1e0ecb){var _0x29e0b0=[];if(_0x1e0ecb){var _0x443e40;for(var _0x34e6ee=0x0,_0x48794e;_0x34e6ee<_0x1e0ecb['length'];_0x34e6ee+=0x1){_0x48794e=_0x1e0ecb[_0x34e6ee][_0xea4b('0x50')]({'plain':!![]});switch(_0x48794e[_0xea4b('0x4e')]){case'always':_0x29e0b0[_0xea4b('0x2c')](db[_0xea4b('0x51')][_0xea4b('0x52')](_0x686666(_0x48794e,_0xea4b('0x53')))['then'](function(){})[_0xea4b('0x2e')](_0x35f574()));break;case _0xea4b('0x54'):_0x29e0b0[_0xea4b('0x2c')](db[_0xea4b('0x51')]['query'](_0x52cf8c(_0x48794e,_0xea4b('0x53')))[_0xea4b('0x2b')](function(){})[_0xea4b('0x2e')](_0x35f574()));break;default:_0x29e0b0[_0xea4b('0x2c')](db[_0xea4b('0x51')][_0xea4b('0x52')](_0x40bc95(_0x48794e,'VoiceQueueId'))[_0xea4b('0x2b')](function(){})['catch'](_0x35f574()));}}}return _0x29e0b0;})[_0xea4b('0x55')]()[_0xea4b('0x2b')](function(){return db['VoiceQueue'][_0xea4b('0x4c')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xea4b('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x3e6531){var _0x3ce7fc=[];if(_0x3e6531){var _0x22ffcf;for(var _0x32f34f=0x0,_0x2aef0e;_0x32f34f<_0x3e6531['length'];_0x32f34f+=0x1){_0x2aef0e=_0x3e6531[_0x32f34f][_0xea4b('0x50')]({'plain':!![]});_0x3ce7fc[_0xea4b('0x2c')](db[_0xea4b('0x51')]['query'](_0x438b0b(_0x2aef0e,_0xea4b('0x53')))[_0xea4b('0x2b')](function(){})[_0xea4b('0x2e')](_0x35f574()));}}return _0x3ce7fc;})['all']();})[_0xea4b('0x2b')](function(){return db[_0xea4b('0x57')][_0xea4b('0x4c')]({'attributes':['id',_0xea4b('0x4e')],'include':[{'model':db[_0xea4b('0x58')],'as':_0xea4b('0x4f'),'where':{'id':LISTID}}]})[_0xea4b('0x2b')](function(_0x5ea99c){var _0x290993=[];if(_0x5ea99c){for(var _0x351c6f=0x0,_0x4b4318;_0x351c6f<_0x5ea99c[_0xea4b('0x1a')];_0x351c6f+=0x1){_0x4b4318=_0x5ea99c[_0x351c6f][_0xea4b('0x50')]({'plain':!![]});switch(_0x4b4318[_0xea4b('0x4e')]){case _0xea4b('0x59'):_0x290993[_0xea4b('0x2c')](db['sequelize'][_0xea4b('0x52')](_0x686666(_0x4b4318,_0xea4b('0x5a')))[_0xea4b('0x2b')](function(){})[_0xea4b('0x2e')](_0x35f574()));break;case _0xea4b('0x54'):_0x290993[_0xea4b('0x2c')](db['sequelize'][_0xea4b('0x52')](_0x52cf8c(_0x4b4318,_0xea4b('0x5a')))[_0xea4b('0x2b')](function(){})['catch'](_0x35f574()));break;default:_0x290993[_0xea4b('0x2c')](db[_0xea4b('0x51')]['query'](_0x40bc95(_0x4b4318,'CampaignId'))['then'](function(){})[_0xea4b('0x2e')](_0x35f574()));}}}return _0x290993;})[_0xea4b('0x55')]();})[_0xea4b('0x2b')](function(){return db[_0xea4b('0x57')][_0xea4b('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xea4b('0x58')],'as':_0xea4b('0x56'),'where':{'id':LISTID}}]})['then'](function(_0xec871d){var _0x4faaec=[];if(_0xec871d){for(var _0x52e873=0x0,_0x534805;_0x52e873<_0xec871d['length'];_0x52e873+=0x1){_0x534805=_0xec871d[_0x52e873][_0xea4b('0x50')]({'plain':!![]});_0x4faaec[_0xea4b('0x2c')](db[_0xea4b('0x51')][_0xea4b('0x52')](_0x438b0b(_0x534805,_0xea4b('0x5a')))[_0xea4b('0x2b')](function(){})[_0xea4b('0x2e')](_0x35f574()));}}return _0x4faaec;})[_0xea4b('0x55')]();})[_0xea4b('0x2e')](function(_0x2bcd26){logger[_0xea4b('0x14')](_0xea4b('0x5b'),_0xea4b('0x5c'),_0x2bcd26[_0xea4b('0x1c')]);});}var processPromises=function(_0xcfa4c9){return BPromise[_0xea4b('0x55')](promises)[_0xea4b('0x2b')](function(_0x500c8c){})[_0xea4b('0x2e')](function(_0x3c0c40){logger[_0xea4b('0x14')](_0xea4b('0x5d'),JSON['stringify'](_0x3c0c40));})[_0xea4b('0x5e')](function(){socket['emit'](_0xea4b('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xcfa4c9){return _0xcfa4c9[_0xea4b('0x60')]();}});};var endCsv=function(){return BPromise[_0xea4b('0x61')]()[_0xea4b('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0xea4b('0x2b')](function(){socket[_0xea4b('0x62')](_0xea4b('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x15ebc5){logger[_0xea4b('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xea4b('0x30')](_0x15ebc5));}finally{process[_0xea4b('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0xea4b('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xea4b('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xea4b('0x12')](',');return db[_0xea4b('0x2a')][_0xea4b('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x5889a8){var _0x3e9e4f=fs[_0xea4b('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3e9e4f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4899bd,_0x3ce081){total+=0x1;var _0x52fdbb=total;promises[_0xea4b('0x2c')](checkRow(_0x4899bd,_0x5889a8,_0x52fdbb)['then'](function(){success+=0x1;})[_0xea4b('0x2e')](function(_0x49b2f7){if(_0x49b2f7[_0xea4b('0x14')]){errors+=0x1;delete _0x49b2f7[_0xea4b('0x14')];}else if(_0x49b2f7[_0xea4b('0x29')]){duplicates+=0x1;delete _0x49b2f7['duplicate'];}rows['push'](_0x49b2f7);}));if(total%0xc8===0x0){_0x3ce081[_0xea4b('0x66')]();return processPromises(_0x3ce081);}},'complete':function(){return processPromises()[_0xea4b('0x2b')](function(){logger[_0xea4b('0x64')](_0xea4b('0x67'));endCsv();});},'error':function(_0x1d9282,_0x528f97){logger[_0xea4b('0x64')](_0xea4b('0x68'),JSON[_0xea4b('0x30')](_0x1d9282));endCsv();}});})[_0xea4b('0x2e')](function(_0x44423e){logger[_0xea4b('0x14')](_0xea4b('0x69'),JSON[_0xea4b('0x30')](_0x44423e));});}main(); \ No newline at end of file +var _0x2b0a=['CompanyId','length','find','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','ContactId','createdAt','updatedAt','field','NOW()','scheduledAt','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','select','id\x20IN\x20?','str','calleridnum','cm_hopper_final','fromQuery','cm_hopper_black','findAll','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','all','outbound','get','Campaign','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','stringify','emit','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','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'];(function(_0x2f01d6,_0x683f0e){var _0x31e1e6=function(_0x28e2d5){while(--_0x28e2d5){_0x2f01d6['push'](_0x2f01d6['shift']());}};_0x31e1e6(++_0x683f0e);}(_0x2b0a,0x193));var _0xa2b0=function(_0x14f4a2,_0x3bdb55){_0x14f4a2=_0x14f4a2-0x0;var _0x9cefa=_0x2b0a[_0x14f4a2];return _0x9cefa;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xa2b0('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xa2b0('0x1'));var Redis=require(_0xa2b0('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0xa2b0('0x3'));var logger=require(_0xa2b0('0x4'))(_0xa2b0('0x5'));config[_0xa2b0('0x6')]=_[_0xa2b0('0x7')](config[_0xa2b0('0x6')],{'host':_0xa2b0('0x8'),'port':0x18eb});var socket=require(_0xa2b0('0x9'))(new Redis(config[_0xa2b0('0x6')]));require(_0xa2b0('0xa'))[_0xa2b0('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xa2b0('0xc')][0x2]===_0xa2b0('0xd')||process[_0xa2b0('0xc')][0x2]===_0xa2b0('0xe')){throw new Error(_0xa2b0('0xf'));}var FILEPATH=process[_0xa2b0('0xc')][0x2];if(!process[_0xa2b0('0xc')][0x3]||process[_0xa2b0('0xc')][0x3]===_0xa2b0('0xd')||process[_0xa2b0('0xc')][0x3]==='null'||!process['argv'][0x4]||process[_0xa2b0('0xc')][0x4]===_0xa2b0('0xd')||process[_0xa2b0('0xc')][0x4]===_0xa2b0('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xa2b0('0x10')](process[_0xa2b0('0xc')][0x3][_0xa2b0('0x11')](','),process['argv'][0x4][_0xa2b0('0x11')](','));if(!process[_0xa2b0('0xc')][0x5]||process['argv'][0x5]===_0xa2b0('0xd')||process['argv'][0x5]===_0xa2b0('0xe')){throw new Error(_0xa2b0('0x12'));}var LISTID=process[_0xa2b0('0xc')][0x5];var COMPANYID=process[_0xa2b0('0xc')][0x6]&&process['argv'][0x6]!==_0xa2b0('0xd')&&process[_0xa2b0('0xc')][0x6]!==_0xa2b0('0xe')?process[_0xa2b0('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xa2b0('0xc')][0x7]!==_0xa2b0('0xd')&&process['argv'][0x7]!==_0xa2b0('0xe')?process[_0xa2b0('0xc')][0x7]:null;if(!process[_0xa2b0('0xc')][0x8]||process[_0xa2b0('0xc')][0x8]==='undefined'||process[_0xa2b0('0xc')][0x8]==='null'){throw new Error(_0xa2b0('0x13'));}var SOCKET_TIMESTAMP=process[_0xa2b0('0xc')][0x8];}catch(_0x540988){logger[_0xa2b0('0x14')](_0x540988);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(_0x586353,_0x4e82e6,_0x5c7ecb,_0x46c355){var _0x396c03={'message':_0x4e82e6};_0x396c03[_0x586353]=!![];if(_0x5c7ecb){_0x396c03[_0xa2b0('0x15')]=_0x5c7ecb;}if(_0x46c355){_0x396c03[_0xa2b0('0x16')]=_0x46c355;}return _0x396c03;}function isEmail(_0x117454){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))*$/[_0xa2b0('0x17')](_0x117454);}function checkRow(_0x42469d,_0x15b13f,_0x4f9687){return new BPromise(function(_0x7cef73,_0x4346b4){if(_[_0xa2b0('0x18')](_0x42469d)){return _0x4346b4(handleCheckRowError(_0xa2b0('0x14'),_0xa2b0('0x19'),null,_0x4f9687));}if(_0x42469d[_0xa2b0('0x1a')]&&_0x42469d[_0xa2b0('0x1a')]['length']){var _0x18bbdb=_[_0xa2b0('0x1b')](_0x42469d[_0xa2b0('0x1a')],_0xa2b0('0x1c'))['join'](';');return _0x4346b4(handleCheckRowError('error',_0x18bbdb,null,_0x4f9687));}var _0x49cc9d={};for(var _0x561bc5 in FIELDS){if(FIELDS[_0xa2b0('0x1d')](_0x561bc5)&&FIELDS[_0x561bc5]){_0x49cc9d[_0x561bc5]=_0x42469d[_0xa2b0('0x1e')][0x0][FIELDS[_0x561bc5]]||_0x42469d[_0xa2b0('0x1e')][0x0]['\ufeff'+FIELDS[_0x561bc5]];}}if(!_0x49cc9d[_0xa2b0('0x1f')]){return _0x4346b4(handleCheckRowError('error',_0xa2b0('0x20'),null,_0x4f9687));}if(!_0x49cc9d[_0xa2b0('0x21')]){return _0x4346b4(handleCheckRowError(_0xa2b0('0x14'),_0xa2b0('0x22'),null,_0x4f9687));}if(_0x49cc9d[_0xa2b0('0x23')]){var _0x55e4aa=moment(_0x49cc9d['birthDate'],_0xa2b0('0x24'));if(!_0x55e4aa['isValid']()){return _0x4346b4(handleCheckRowError(_0xa2b0('0x14'),_0xa2b0('0x25'),null,_0x4f9687));}}if(_0x49cc9d[_0xa2b0('0x26')]){if(!isEmail(_0x49cc9d[_0xa2b0('0x26')])){return _0x4346b4(handleCheckRowError(_0xa2b0('0x14'),_0xa2b0('0x27'),null,_0x4f9687));}}_0x49cc9d[_0xa2b0('0x28')]=LISTID;_0x49cc9d[_0xa2b0('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x15b13f){var _0x1c4466={};for(var _0x358162=0x0,_0x2e4c42=DUPLICATES[_0xa2b0('0x2a')];_0x358162<_0x2e4c42;_0x358162+=0x1){_0x1c4466[DUPLICATES[_0x358162]]=_0x49cc9d[DUPLICATES[_0x358162]];}var _0x3b89d4=_[_0xa2b0('0x2b')](_0x15b13f,_0x1c4466);if(_0x3b89d4){return _0x4346b4(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x3b89d4,_0x4f9687));}}return db[_0xa2b0('0x2c')][_0xa2b0('0x2d')](_0x49cc9d,{'raw':!![],'hooks':![],'fields':_[_0xa2b0('0x2e')](_0x49cc9d)})[_0xa2b0('0x2f')](function(_0x444d6f){if(DUPLICATES&&DUPLICATES[_0xa2b0('0x2a')]&&_0x15b13f){_0x15b13f[_0xa2b0('0x30')](_[_0xa2b0('0x31')](_0x49cc9d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x444d6f['id'];return _0x7cef73();})[_0xa2b0('0x32')](function(_0x33f4d8){return _0x4346b4(handleCheckRowError('error',_0xa2b0('0x33')+(_0x33f4d8[_0xa2b0('0x1c')]||JSON['stringify'](_0x33f4d8)),null,_0x4f9687));});});}function checkHopper(){function _0x45c319(){return function(_0xe915e3){logger['error'](_0xa2b0('0x34'),_0xa2b0('0x35'),util[_0xa2b0('0x36')](_0xe915e3,{'showHidden':![],'depth':null}));};}var _0x437ae6=function(_0x47d64f,_0x49adce){var _0xb68cdd=squel[_0xa2b0('0x37')]()[_0xa2b0('0x38')](_0xa2b0('0x39'))['fromQuery'](['phone','scheduledAt',_0xa2b0('0x3a'),_0xa2b0('0x28'),_0x49adce,_0xa2b0('0x3b'),_0xa2b0('0x3c')],squel['select']()[_0xa2b0('0x3d')](_0xa2b0('0x21'),_0xa2b0('0x21'))['field'](_0xa2b0('0x3e'),_0xa2b0('0x3f'))['field']('id','ContactId')[_0xa2b0('0x3d')](LISTID[_0xa2b0('0x40')](),_0xa2b0('0x28'))[_0xa2b0('0x3d')](_0x47d64f['id'][_0xa2b0('0x40')](),_0x49adce)[_0xa2b0('0x3d')](_0xa2b0('0x3e'),'createdAt')[_0xa2b0('0x3d')](_0xa2b0('0x3e'),'updatedAt')[_0xa2b0('0x41')](_0xa2b0('0x42'))[_0xa2b0('0x43')](_0xa2b0('0x44'))['where'](_0xa2b0('0x45'),LISTID[_0xa2b0('0x40')]())[_0xa2b0('0x43')](_0xa2b0('0x46'))[_0xa2b0('0x43')](_0xa2b0('0x47'),squel['select']()['field']('phone')[_0xa2b0('0x41')](_0xa2b0('0x39'))[_0xa2b0('0x43')](_0x49adce+_0xa2b0('0x48'),_0x47d64f['id'][_0xa2b0('0x40')]())))['toString']();return _0xb68cdd;};var _0x564e6e=function(_0x28c193,_0x30c1de){var _0x5487a5=squel[_0xa2b0('0x37')]()[_0xa2b0('0x38')](_0xa2b0('0x39'))['fromQuery']([_0xa2b0('0x21'),'scheduledAt','ContactId','ListId',_0x30c1de,_0xa2b0('0x3b'),_0xa2b0('0x3c')],squel[_0xa2b0('0x49')]()['field']('phone','phone')['field'](_0xa2b0('0x3e'),'scheduledAt')['field']('id',_0xa2b0('0x3a'))[_0xa2b0('0x3d')](LISTID['toString'](),_0xa2b0('0x28'))[_0xa2b0('0x3d')](_0x28c193['id'][_0xa2b0('0x40')](),_0x30c1de)[_0xa2b0('0x3d')](_0xa2b0('0x3e'),_0xa2b0('0x3b'))[_0xa2b0('0x3d')](_0xa2b0('0x3e'),'updatedAt')[_0xa2b0('0x41')](_0xa2b0('0x42'))[_0xa2b0('0x43')](_0xa2b0('0x44'))[_0xa2b0('0x43')](_0xa2b0('0x45'),LISTID[_0xa2b0('0x40')]())[_0xa2b0('0x43')](_0xa2b0('0x4a'),squel[_0xa2b0('0x4b')](hopperContacts))[_0xa2b0('0x43')](_0xa2b0('0x46'))['where'](_0xa2b0('0x47'),squel[_0xa2b0('0x49')]()[_0xa2b0('0x3d')](_0xa2b0('0x4c'))['from'](_0xa2b0('0x4d'))[_0xa2b0('0x43')](_0x30c1de+_0xa2b0('0x48'),_0x28c193['id'][_0xa2b0('0x40')]()))[_0xa2b0('0x43')](_0xa2b0('0x47'),squel[_0xa2b0('0x49')]()['field']('phone')[_0xa2b0('0x41')]('cm_hopper')[_0xa2b0('0x43')](_0x30c1de+_0xa2b0('0x48'),_0x28c193['id'][_0xa2b0('0x40')]())))[_0xa2b0('0x40')]();return _0x5487a5;};function _0x5c0d91(_0xdc53d8,_0x467168){var _0x568a40=squel[_0xa2b0('0x37')]()['into'](_0xa2b0('0x39'))[_0xa2b0('0x4e')](['phone',_0xa2b0('0x3f'),_0xa2b0('0x3a'),_0xa2b0('0x28'),_0x467168,_0xa2b0('0x3b'),'updatedAt'],squel[_0xa2b0('0x49')]()[_0xa2b0('0x3d')]('phone',_0xa2b0('0x21'))[_0xa2b0('0x3d')](_0xa2b0('0x3e'),_0xa2b0('0x3f'))[_0xa2b0('0x3d')]('id',_0xa2b0('0x3a'))[_0xa2b0('0x3d')](LISTID[_0xa2b0('0x40')](),'ListId')['field'](_0xdc53d8['id'][_0xa2b0('0x40')](),_0x467168)[_0xa2b0('0x3d')]('NOW()',_0xa2b0('0x3b'))[_0xa2b0('0x3d')](_0xa2b0('0x3e'),_0xa2b0('0x3c'))[_0xa2b0('0x41')](_0xa2b0('0x42'))['where'](_0xa2b0('0x44'))[_0xa2b0('0x43')](_0xa2b0('0x45'),LISTID[_0xa2b0('0x40')]())[_0xa2b0('0x43')](_0xa2b0('0x4a'),squel['str'](hopperContacts))[_0xa2b0('0x43')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x568a40;}function _0x3bb8b2(_0x23886c,_0x20f091){var _0x202f5d=squel[_0xa2b0('0x37')]()[_0xa2b0('0x38')](_0xa2b0('0x4f'))[_0xa2b0('0x4e')]([_0xa2b0('0x21'),_0xa2b0('0x3a'),_0xa2b0('0x28'),_0x20f091,'createdAt',_0xa2b0('0x3c')],squel[_0xa2b0('0x49')]()[_0xa2b0('0x3d')](_0xa2b0('0x21'),_0xa2b0('0x21'))['field']('id',_0xa2b0('0x3a'))[_0xa2b0('0x3d')](LISTID[_0xa2b0('0x40')](),'ListId')['field'](_0x23886c['id'][_0xa2b0('0x40')](),_0x20f091)[_0xa2b0('0x3d')]('NOW()',_0xa2b0('0x3b'))[_0xa2b0('0x3d')](_0xa2b0('0x3e'),_0xa2b0('0x3c'))[_0xa2b0('0x41')](_0xa2b0('0x42'))[_0xa2b0('0x43')](_0xa2b0('0x44'))['where'](_0xa2b0('0x45'),LISTID['toString']())['where'](_0xa2b0('0x4a'),squel['str'](hopperContacts))[_0xa2b0('0x43')](_0xa2b0('0x46')))[_0xa2b0('0x40')]();return _0x202f5d;}return db['VoiceQueue'][_0xa2b0('0x50')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xa2b0('0x51')],'as':_0xa2b0('0x52'),'where':{'id':LISTID}}]})[_0xa2b0('0x2f')](function(_0x509f3f){var _0x35a164=[];if(_0x509f3f){var _0x3dcd51;for(var _0x580a64=0x0,_0x54eb0f;_0x580a64<_0x509f3f[_0xa2b0('0x2a')];_0x580a64+=0x1){_0x54eb0f=_0x509f3f[_0x580a64]['get']({'plain':!![]});switch(_0x54eb0f[_0xa2b0('0x53')]){case _0xa2b0('0x54'):_0x35a164['push'](db[_0xa2b0('0x55')][_0xa2b0('0x56')](_0x564e6e(_0x54eb0f,'VoiceQueueId'))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));break;case'onlyIfOpen':_0x35a164[_0xa2b0('0x30')](db['sequelize'][_0xa2b0('0x56')](_0x437ae6(_0x54eb0f,_0xa2b0('0x57')))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));break;default:_0x35a164['push'](db['sequelize'][_0xa2b0('0x56')](_0x5c0d91(_0x54eb0f,_0xa2b0('0x57')))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));}}}return _0x35a164;})[_0xa2b0('0x58')]()[_0xa2b0('0x2f')](function(){return db['VoiceQueue'][_0xa2b0('0x50')]({'where':{'type':_0xa2b0('0x59')},'attributes':['id'],'include':[{'model':db[_0xa2b0('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa2b0('0x2f')](function(_0x4e1363){var _0x357215=[];if(_0x4e1363){var _0x43e495;for(var _0x9b6476=0x0,_0x10fc77;_0x9b6476<_0x4e1363[_0xa2b0('0x2a')];_0x9b6476+=0x1){_0x10fc77=_0x4e1363[_0x9b6476][_0xa2b0('0x5a')]({'plain':!![]});_0x357215[_0xa2b0('0x30')](db[_0xa2b0('0x55')][_0xa2b0('0x56')](_0x3bb8b2(_0x10fc77,_0xa2b0('0x57')))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));}}return _0x357215;})[_0xa2b0('0x58')]();})[_0xa2b0('0x2f')](function(){return db[_0xa2b0('0x5b')][_0xa2b0('0x50')]({'attributes':['id',_0xa2b0('0x53')],'include':[{'model':db[_0xa2b0('0x51')],'as':_0xa2b0('0x52'),'where':{'id':LISTID}}]})[_0xa2b0('0x2f')](function(_0x54f939){var _0x3666d0=[];if(_0x54f939){for(var _0x231e30=0x0,_0x10b38b;_0x231e30<_0x54f939[_0xa2b0('0x2a')];_0x231e30+=0x1){_0x10b38b=_0x54f939[_0x231e30][_0xa2b0('0x5a')]({'plain':!![]});switch(_0x10b38b[_0xa2b0('0x53')]){case _0xa2b0('0x54'):_0x3666d0[_0xa2b0('0x30')](db[_0xa2b0('0x55')][_0xa2b0('0x56')](_0x564e6e(_0x10b38b,_0xa2b0('0x5c')))[_0xa2b0('0x2f')](function(){})['catch'](_0x45c319()));break;case _0xa2b0('0x5d'):_0x3666d0['push'](db['sequelize'][_0xa2b0('0x56')](_0x437ae6(_0x10b38b,_0xa2b0('0x5c')))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));break;default:_0x3666d0[_0xa2b0('0x30')](db['sequelize'][_0xa2b0('0x56')](_0x5c0d91(_0x10b38b,_0xa2b0('0x5c')))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));}}}return _0x3666d0;})[_0xa2b0('0x58')]();})['then'](function(){return db[_0xa2b0('0x5b')][_0xa2b0('0x50')]({'attributes':['id'],'include':[{'model':db[_0xa2b0('0x51')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xa2b0('0x2f')](function(_0x2e8491){var _0x313c12=[];if(_0x2e8491){for(var _0x57990c=0x0,_0x523fa9;_0x57990c<_0x2e8491[_0xa2b0('0x2a')];_0x57990c+=0x1){_0x523fa9=_0x2e8491[_0x57990c][_0xa2b0('0x5a')]({'plain':!![]});_0x313c12[_0xa2b0('0x30')](db[_0xa2b0('0x55')]['query'](_0x3bb8b2(_0x523fa9,'CampaignId'))[_0xa2b0('0x2f')](function(){})[_0xa2b0('0x32')](_0x45c319()));}}return _0x313c12;})[_0xa2b0('0x58')]();})[_0xa2b0('0x32')](function(_0x4091f6){logger[_0xa2b0('0x14')](_0xa2b0('0x5e'),_0xa2b0('0x5f'),_0x4091f6[_0xa2b0('0x1c')]);});}var processPromises=function(_0x5e33dc){return BPromise[_0xa2b0('0x58')](promises)[_0xa2b0('0x2f')](function(_0x408fc6){})[_0xa2b0('0x32')](function(_0x3cb8be){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xa2b0('0x60')](_0x3cb8be));})['finally'](function(){socket[_0xa2b0('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5e33dc){return _0x5e33dc['resume']();}});};var endCsv=function(){return BPromise[_0xa2b0('0x62')]()[_0xa2b0('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0xa2b0('0x2f')](function(){socket[_0xa2b0('0x61')](_0xa2b0('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xa2b0('0x64')](FILEPATH);}catch(_0x67e2e8){logger[_0xa2b0('0x14')](_0xa2b0('0x65'),JSON['stringify'](_0x67e2e8));}finally{process['exit'](0x0);}});};process['on'](_0xa2b0('0x66'),function(){logger['info'](_0xa2b0('0x67'));endCsv();});function main(){return BPromise[_0xa2b0('0x62')]()[_0xa2b0('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xa2b0('0x11')](',');return db['CmContact'][_0xa2b0('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa2b0('0x2f')](function(_0x4d7498){var _0x366c6c=fs[_0xa2b0('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa2b0('0x69')](_0x366c6c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x7ad87,_0x5118fc){total+=0x1;var _0x38bcc0=total;promises[_0xa2b0('0x30')](checkRow(_0x7ad87,_0x4d7498,_0x38bcc0)[_0xa2b0('0x2f')](function(){success+=0x1;})['catch'](function(_0x1fbdde){if(_0x1fbdde[_0xa2b0('0x14')]){errors+=0x1;delete _0x1fbdde['error'];}else if(_0x1fbdde[_0xa2b0('0x6a')]){duplicates+=0x1;delete _0x1fbdde[_0xa2b0('0x6a')];}rows[_0xa2b0('0x30')](_0x1fbdde);}));if(total%0xc8===0x0){_0x5118fc[_0xa2b0('0x6b')]();return processPromises(_0x5118fc);}},'complete':function(){return processPromises()['then'](function(){logger[_0xa2b0('0x6c')](_0xa2b0('0x6d'));endCsv();});},'error':function(_0x19f696,_0x47446a){logger[_0xa2b0('0x6c')](_0xa2b0('0x6e'),JSON[_0xa2b0('0x60')](_0x19f696));endCsv();}});})['catch'](function(_0x3e8c01){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x3e8c01));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index a86dad5..fc8d1d4 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 _0x4549=['all','then','split','isNil','filter','findOne','update','updated','CmContactHasItem','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','updatedAt','priority','recallme','fields','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','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?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','error','exit','errors','code','sequelize','query','catch','message','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','spread','voice_queues.id','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','utcOffset','set','offset','dialTimezone','main','start','binding','root','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','find','itemTypeId','description','SystemRow','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','orderBy','VoiceQueueId','campaigns_has_cm_blacklists','CampaignId','voice_queues_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','where','CmContact','findAll','AdditionalPhones','length','push'];(function(_0x7e573b,_0x433cea){var _0xe9c0d9=function(_0x40de59){while(--_0x40de59){_0x7e573b['push'](_0x7e573b['shift']());}};_0xe9c0d9(++_0x433cea);}(_0x4549,0x14e));var _0x9454=function(_0x1f09e5,_0xccb462){_0x1f09e5=_0x1f09e5-0x0;var _0x352796=_0x4549[_0x1f09e5];return _0x352796;};'use strict';var fs=require('fs');var path=require(_0x9454('0x0'));var _=require(_0x9454('0x1'));var Papa=require(_0x9454('0x2'));var util=require(_0x9454('0x3'));var BPromise=require(_0x9454('0x4'));var moment=require('moment');var squel=require(_0x9454('0x5'));var Redis=require(_0x9454('0x6'));var db=require(_0x9454('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x9454('0x8'));var logger=require('../../../config/logger')(_0x9454('0x9'));config['redis']=_['defaults'](config[_0x9454('0xa')],{'host':_0x9454('0xb'),'port':0x18eb});var socket=require(_0x9454('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x9454('0xd')](_0x9454('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x9454('0xd')](_0x9454('0xe'));function isEmail(_0x5e647f){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'](_0x5e647f);}function selectNotIn(_0x48383b,_0x2cf7d6,_0x48ef24,_0x4d90e0,_0x1f14a2){return squel[_0x9454('0xf')]()[_0x9454('0x10')](_0x9454('0x11'))[_0x9454('0x12')](_0x4d90e0)[_0x9454('0x13')](_0x2cf7d6,null,_0x2cf7d6+'.id\x20=\x20'+_0x4d90e0+'.'+_0x48ef24)[_0x9454('0x14')](_0x4d90e0+'.'+_0x48ef24+'\x20=\x20'+_0x48383b+'.'+_0x48ef24)[_0x9454('0x14')](_0x2cf7d6+'.dialCheckDuplicateType\x20IN\x20('+_0x1f14a2[_0x9454('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x35527e,_0x3a94e0){promisesAdditionalPhones=[];return db[_0x9454('0x15')][_0x9454('0x16')]({'raw':!![],'attributes':['id',_0x9454('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x52f7da){if(_0x52f7da!==null){var _0x24d19b=[];for(var _0x325b82=0x0;_0x325b82<_0x52f7da[_0x9454('0x18')];_0x325b82++){var _0xa3bca3=_0x52f7da[_0x325b82];_0x24d19b[_0x9454('0x19')](insertAdditionalPhones(_0xa3bca3));}}Promise[_0x9454('0x1a')](_0x24d19b)[_0x9454('0x1b')](function(){_0x35527e({'val':0x1});});});});}function insertAdditionalPhones(_0x59b868){return new Promise(function(_0x26d08d,_0x481b00){var _0x5629c8=_0x59b868['AdditionalPhones'];var _0x3cee4d=_0x5629c8[_0x9454('0x1c')](';');var _0x521fc0=[];orderBy=0x0;for(var _0x46545e=0x0;_0x46545e<_0x3cee4d[_0x9454('0x18')];_0x46545e++){_0x521fc0[_0x9454('0x19')](splitAdditionalPhone(_0x59b868['id'],_0x3cee4d[_0x46545e]));}Promise['all'](_0x521fc0)[_0x9454('0x1b')](function(){_0x26d08d({'val':_0x3cee4d[_0x9454('0x18')]});});});}function splitAdditionalPhone(_0x5744bf,_0x34bb16){return new Promise(function(_0x2579b6,_0x14d383){var _0x4d9a77=_0x34bb16['split'](':');var _0x4e7eb5=_0x4d9a77[0x0];var _0xa7e108=_0x4d9a77[0x1];if(!_[_0x9454('0x1d')](_0xa7e108)){var _0x26153c=_0xa7e108['split']('|');var _0x359dae=[];for(var _0xad2301=0x0;_0xad2301<_0x26153c[_0x9454('0x18')];_0xad2301++){if(_0x26153c[_0xad2301]!==''){var _0x1aaffb=_[_0x9454('0x1e')](promisesAdditionalPhones,{'contactId':_0x5744bf,'phone':_0x26153c[_0xad2301]});if(_0x1aaffb[_0x9454('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5744bf,'contactTypeId':_0x4e7eb5,'phone':_0x26153c[_0xad2301],'orderBy':orderBy});}}}_0x2579b6({'ok':0x1});}else _0x2579b6({'res':0x0});});}function createAdditionalPhone(_0x2bf7af,_0x350cdd,_0x5f3a64,_0x29ce76){var _0x7207ac='';var _0x3328ab='';var _0x57016a=_0x5f3a64['split']('§');_0x7207ac=_0x57016a[0x0];if(_0x57016a[_0x9454('0x18')]==0x2)_0x3328ab=_0x57016a[0x1];return new Promise(function(_0x553d2f,_0x97b49){return db['CmContactHasItem'][_0x9454('0x1f')]({'where':{'CmContactId':_0x2bf7af,'item':_0x7207ac}})[_0x9454('0x1b')](function(_0x1b0288){if(_0x1b0288){return db['CmContactHasItem'][_0x9454('0x20')]({'ItemTypeId':_0x350cdd,'description':_0x3328ab,'OrderBy':_0x29ce76},{'where':{'CmContactId':_0x2bf7af,'item':_0x7207ac}})['then'](function(_0x53720e){_0x553d2f({'res':_0x9454('0x21')});});}else{return db[_0x9454('0x22')][_0x9454('0x23')]({'CmContactId':_0x2bf7af,'item':_0x7207ac,'description':_0x3328ab,'ItemTypeId':_0x350cdd,'OrderBy':_0x29ce76,'ItemClass':'PHONE'})[_0x9454('0x1b')](function(_0x1e46a2){_0x553d2f({'res':_0x9454('0x24')});});}});});}function insertCmHopper(_0x3a98b7,_0x30effc,_0x830b18,_0x40c2f4,_0x40322d){var _0x16ac35=[_0x9454('0x25'),_0x9454('0x26'),_0x9454('0x27'),_0x9454('0x28'),_0x30effc+'.'+_0x40c2f4,_0x9454('0x29'),'cm_contacts.updatedAt',_0x9454('0x2a'),_0x9454('0x2b'),'\x22'+_0x40322d+'\x22'];return squel[_0x9454('0x2c')]()[_0x9454('0x2d')](_0x9454('0x2e'))[_0x9454('0x2f')]([_0x9454('0x11'),_0x9454('0x30'),'ContactId',_0x9454('0x31'),_0x40c2f4,'createdAt',_0x9454('0x32'),_0x9454('0x33'),'UserId',_0x9454('0x34')],squel[_0x9454('0xf')]()[_0x9454('0x35')](_0x16ac35)[_0x9454('0x12')](_0x30effc)[_0x9454('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x30effc+_0x9454('0x36'))[_0x9454('0x13')](_0x830b18,null,_0x830b18+_0x9454('0x37')+_0x30effc+'.'+_0x40c2f4)[_0x9454('0x14')](_0x30effc+_0x9454('0x38'),_0x3a98b7)[_0x9454('0x14')](_0x9454('0x39'),NOW)[_0x9454('0x14')](_0x9454('0x3a'),selectNotIn(_0x30effc,_0x830b18,_0x40c2f4,_0x9454('0x2e'),[_0x9454('0x3b'),_0x9454('0x3c')]))[_0x9454('0x14')](_0x9454('0x3a'),selectNotIn(_0x30effc,_0x830b18,_0x40c2f4,_0x9454('0x2e'),['\x22always\x22'])))[_0x9454('0x3d')]();}function insertCmHopperBlack(_0x125c62,_0x160268,_0x5be978,_0x5548a4){var _0x129b1b=[_0x9454('0x25'),_0x9454('0x27'),_0x9454('0x28'),_0x160268+'.'+_0x5548a4,_0x9454('0x29'),_0x9454('0x3e')];return squel[_0x9454('0x2c')]()['into'](_0x9454('0x3f'))[_0x9454('0x2f')]([_0x9454('0x11'),'ContactId','ListId',_0x5548a4,_0x9454('0x40'),_0x9454('0x32')],squel[_0x9454('0xf')]()[_0x9454('0x35')](_0x129b1b)['from'](_0x160268)['join'](_0x9454('0x41'),null,_0x9454('0x42')+_0x160268+_0x9454('0x36'))[_0x9454('0x13')](_0x5be978,null,_0x5be978+'.id\x20=\x20'+_0x160268+'.'+_0x5548a4)[_0x9454('0x14')](_0x160268+_0x9454('0x38'),_0x125c62)['where'](_0x9454('0x39'),NOW)[_0x9454('0x14')](_0x9454('0x3a'),squel[_0x9454('0xf')]()['field'](_0x9454('0x11'))[_0x9454('0x12')](_0x9454('0x3f'))['where'](_0x9454('0x43'),_0x125c62)[_0x9454('0x14')](_0x5548a4+_0x9454('0x44')+_0x160268+'.'+_0x5548a4)))['toString']();}function insertTzCmHopper(_0x196544,_0x5562b1,_0xafba99,_0x12bdd5,_0x53a6da,_0x1f5214){var _0x148126=[_0x9454('0x25'),_0x9454('0x45')+_0x1f5214+_0x9454('0x46'),_0x9454('0x27'),'cm_contacts.ListId',_0x5562b1+'.'+_0x12bdd5,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x9454('0x2a'),_0x9454('0x2b'),'\x22'+_0x53a6da+'\x22'];var _0x3bd844=squel['insert']()[_0x9454('0x2d')](_0x9454('0x2e'))[_0x9454('0x2f')]([_0x9454('0x11'),'scheduledat',_0x9454('0x47'),'ListId',_0x12bdd5,_0x9454('0x40'),_0x9454('0x32'),_0x9454('0x33'),'UserId','recallme'],squel['select']()['fields'](_0x148126)[_0x9454('0x12')](_0x5562b1)[_0x9454('0x13')](_0x9454('0x41'),null,_0x9454('0x42')+_0x5562b1+_0x9454('0x36'))[_0x9454('0x13')](_0xafba99,null,_0xafba99+_0x9454('0x37')+_0x5562b1+'.'+_0x12bdd5)[_0x9454('0x13')](_0x1f5214,null,_0x1f5214+_0x9454('0x37')+_0x5562b1+'.'+_0x12bdd5)[_0x9454('0x14')](_0x5562b1+_0x9454('0x38'),_0x196544)[_0x9454('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9454('0x14')](_0x9454('0x3a'),selectNotIn(_0x5562b1,_0xafba99,_0x12bdd5,_0x9454('0x2e'),[_0x9454('0x3b'),_0x9454('0x3c')]))[_0x9454('0x14')](_0x9454('0x3a'),selectNotIn(_0x5562b1,_0xafba99,_0x12bdd5,_0x9454('0x2e'),[_0x9454('0x3b')])))[_0x9454('0x3d')]();return _0x3bd844;}function insertTzCmHopperBlack(_0x1d56ee,_0x30f4b9,_0x1f04b3,_0x480ea2){var _0x17f635=[_0x9454('0x25'),_0x9454('0x27'),_0x9454('0x28'),_0x30f4b9+'.'+_0x480ea2,_0x9454('0x29'),_0x9454('0x3e')];return squel[_0x9454('0x2c')]()['into']('cm_hopper_black')[_0x9454('0x2f')](['phone',_0x9454('0x47'),_0x9454('0x31'),_0x480ea2,'createdAt',_0x9454('0x32')],squel['select']()[_0x9454('0x35')](_0x17f635)['from'](_0x30f4b9)[_0x9454('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x30f4b9+'.CmListId')['join'](_0x1f04b3,null,_0x1f04b3+_0x9454('0x37')+_0x30f4b9+'.'+_0x480ea2)[_0x9454('0x14')](_0x30f4b9+_0x9454('0x38'),_0x1d56ee)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x9454('0x14')](_0x9454('0x3a'),squel[_0x9454('0xf')]()['field']('phone')[_0x9454('0x12')]('cm_hopper_black')[_0x9454('0x14')](_0x9454('0x43'),_0x1d56ee)['where'](_0x480ea2+_0x9454('0x44')+_0x30f4b9+'.'+_0x480ea2)))[_0x9454('0x3d')]();}function insertCmHopperAdditionalPhones(_0x4d4ff6){var _0x3da3f7=['cm_hopper.id','cm_contact_has_items.item',_0x9454('0x48'),_0x9454('0x49'),_0x9454('0x4a')];return squel['insert']()[_0x9454('0x2d')](_0x9454('0x4b'))[_0x9454('0x2f')](['CmHopperId',_0x9454('0x11'),_0x9454('0x4c'),_0x9454('0x40'),_0x9454('0x32')],squel['select']()[_0x9454('0x35')](_0x3da3f7)[_0x9454('0x12')](_0x9454('0x2e'))[_0x9454('0x13')](_0x9454('0x41'),null,_0x9454('0x4d'))[_0x9454('0x13')](_0x9454('0x4e'),null,_0x9454('0x4f'))[_0x9454('0x14')](_0x9454('0x50'),_0x4d4ff6)[_0x9454('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0xd64060,_0x308edb,_0xfdcb88,_0xb81ac){var _0x3ce59c=_['concat'](_[_0x9454('0x51')](_0xb81ac),['ListId',_0x9454('0x52'),_0x9454('0x40'),_0x9454('0x32')]);return squel['insert']()['into'](_0x9454('0x41'))[_0x9454('0x2f')](_0x3ce59c,squel['select']()[_0x9454('0x35')](_0x3ce59c)[_0x9454('0x12')](_0x308edb)[_0x9454('0x14')]('('+_0xfdcb88[_0x9454('0x13')](',')+_0x9454('0x53'),squel[_0x9454('0xf')]()['fields'](_0xfdcb88)[_0x9454('0x12')](_0x9454('0x41'))['where'](_0x9454('0x43'),_0xd64060)['where'](_0x9454('0x54')))[_0x9454('0x14')](_0x9454('0x55'),squel[_0x9454('0xf')]()['field'](_0x9454('0x56'),_0x9454('0x57'))['from'](_0x308edb)['group'](_0xfdcb88[_0x9454('0x13')](','))))[_0x9454('0x3d')]();}function handleStop(){logger[_0x9454('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1008ba){logger[_0x9454('0x59')](_0x1008ba['message']);process[_0x9454('0x5a')](0x1);}function handleError(_0x59d04d,_0x4e95dd){stats[_0x9454('0x5b')]['push']({'name':_0x4e95dd[_0x9454('0x5c')],'message':_0x4e95dd['message'],'row':_0x59d04d});}function handleQuery(_0x1c5c1f){logger[_0x9454('0x58')](_0x1c5c1f);return db[_0x9454('0x5d')][_0x9454('0x5e')](_0x1c5c1f)['spread'](function(_0x3d3a1a){results[_0x9454('0x19')](_0x3d3a1a);})[_0x9454('0x5f')](function(_0x3441a3){logger['error'](_0x3441a3[_0x9454('0x60')]);});}function updateTzCampaigns(_0x2a24e2){return new Promise(function(_0xa198c8,_0x3cd662){var _0x3594b2=squel[_0x9454('0xf')]()['fields']([_0x9454('0x61'),_0x9454('0x62')])[_0x9454('0x12')](_0x9454('0x63'))['join'](_0x9454('0x64'),null,_0x9454('0x65'))['where']('campaigns_has_cm_lists.CmListId='+_0x2a24e2);db['sequelize']['query'](_0x3594b2[_0x9454('0x3d')]())[_0x9454('0x66')](function(_0x1349dc){var _0x3af5bf=[];for(var _0x564feb=0x0;_0x564feb<_0x1349dc['length'];_0x564feb++){_0x3af5bf[_0x9454('0x19')](getTimezoneData(_0x1349dc[_0x564feb],tmp_campaigns));}BPromise[_0x9454('0x1a')](_0x3af5bf)[_0x9454('0x1b')](function(){_0xa198c8({'val':0x1});});})[_0x9454('0x5f')](function(_0x43d165){logger[_0x9454('0x59')](_0x43d165[_0x9454('0x60')]);_0xa198c8({'val':0x0});});});}function updateTzVoiceQueues(_0x5375a4){return new Promise(function(_0x7d8f10,_0x22a425){var _0x14e751=squel[_0x9454('0xf')]()['fields']([_0x9454('0x67'),'voice_queues.dialTimezone'])['from'](_0x9454('0x68'))[_0x9454('0x13')](_0x9454('0x69'),null,_0x9454('0x6a'))[_0x9454('0x14')](_0x9454('0x6b')+_0x5375a4);db['sequelize'][_0x9454('0x5e')](_0x14e751[_0x9454('0x3d')]())[_0x9454('0x66')](function(_0x34a835){var _0x965122=[];for(var _0x3d731a=0x0;_0x3d731a<_0x34a835['length'];_0x3d731a++){_0x965122[_0x9454('0x19')](getTimezoneData(_0x34a835[_0x3d731a],tmp_voice_queues));}BPromise[_0x9454('0x1a')](_0x965122)[_0x9454('0x1b')](function(){_0x7d8f10({'val':0x1});});})['catch'](function(_0x4e0fee){logger[_0x9454('0x59')](_0x4e0fee[_0x9454('0x60')]);_0x7d8f10({'val':0x0});});});}function getTimezoneData(_0x3782fe,_0x23c9b5){return new Promise(function(_0x579bb8,_0x452351){var _0x2dcf33=shared['timezones'];var _0x4fa355=_0x2dcf33[_0x3782fe['dialTimezone']];if(_[_0x9454('0x1d')](_0x4fa355)){_0x579bb8({'ret':0x1});}else{var _0x349fa7=_0x4fa355[_0x9454('0x6c')];var _0x30dde0=squel['insert']()['into'](_0x23c9b5)[_0x9454('0x6d')]('id',_0x3782fe['id'])[_0x9454('0x6d')](_0x9454('0x6e'),_0x349fa7)[_0x9454('0x6d')](_0x9454('0x6f'),_0x3782fe[_0x9454('0x6f')])[_0x9454('0x3d')]();return db[_0x9454('0x5d')][_0x9454('0x5e')](_0x30dde0)[_0x9454('0x66')](function(_0x2bcb1b){_0x579bb8({'ret':0x1});})[_0x9454('0x5f')](function(_0x373d93){logger[_0x9454('0x59')](_0x373d93[_0x9454('0x60')]);_0x452351({'ret':0x1});});}});}function handleTZQuery(_0x309061){logger['info'](_0x309061);return db['sequelize'][_0x9454('0x5e')](_0x309061)[_0x9454('0x66')](function(_0x5d5c85){})['catch'](function(_0x2ba4f5){logger['error'](_0x2ba4f5['message']);});}function main(_0x407806,_0x5c5c13,_0x4d0a4f,_0x59f9a9){logger[_0x9454('0x58')](_0x9454('0x70'),_0x407806,JSON['stringify'](_0x5c5c13));process['send'](_0x9454('0x71'));var _0x1e21ca=_0x5c5c13[_0x9454('0x72')];var _0x2ffbe1=_['clone'](_0x1e21ca);var _0x50a326=_0x5c5c13['socket_timestamp'];var _0x20c559=path[_0x9454('0x13')](config[_0x9454('0x73')],'server/files/tmp',_0x50a326+_0x9454('0x74'));hasTZ=_['keys'](_0x1e21ca)[_0x9454('0x75')]('dialTimezone');var _0x255a8b=_[_0x9454('0x51')](_0x1e21ca)['join']();logger['info'](_0x9454('0x76'),_0x255a8b);db[_0x9454('0x77')][_0x9454('0x16')]({'raw':!![],'attributes':['id',_0x9454('0x78')]})['then'](function(_0x1f3209){for(var _0x406e67=0x0;_0x406e67<_0x1f3209[_0x9454('0x18')];_0x406e67++){if(_0x1f3209[_0x406e67][_0x9454('0x78')]in _0x1e21ca){contactItemTypes['push'](_0x1f3209[_0x406e67]);delete _0x2ffbe1[_0x1f3209[_0x406e67][_0x9454('0x78')]];hasAdditionalPhones=!![];}for(var _0x7e691 in _0x1e21ca){if(_0x1f3209[_0x406e67][_0x9454('0x78')]+_0x9454('0x79')===_0x7e691){phoneDescriptions[_0x9454('0x19')]({'itemTypeId':_0x1f3209[_0x406e67]['id'],'description':_0x7e691});delete _0x2ffbe1[_0x7e691];}}}if(hasAdditionalPhones)_0x2ffbe1[_0x9454('0x17')]='';var _0x3d09be=_[_0x9454('0x51')](_0x2ffbe1)[_0x9454('0x13')]();logger[_0x9454('0x58')](_0x9454('0x76'),_0x3d09be);fs[_0x9454('0x7a')](_0x20c559,_0x3d09be+'\x0a');Papa[_0x9454('0x7b')](fs[_0x9454('0x7c')](_0x407806),{'header':!![],'skipEmptyLines':!![],'step':function(_0x432bed,_0x31a590){try{for(var _0x4ca966=0x0,_0x1203b5=[];_0x4ca966<_0x432bed[_0x9454('0x7d')][_0x9454('0x18')];_0x4ca966++){stats[_0x9454('0x7e')]+=0x1;if(_0x432bed[_0x9454('0x5b')][_0x4ca966]){handleError(_0x432bed['data'][_0x4ca966],_0x432bed['errors'][_0x4ca966]);}else{var _0x21fe6a=[];var _0x46c662=[];var _0x1b4210={};for(var _0x248909 in _0x1e21ca){let _0x5964cc=contactItemTypes['find'](_0x1dd676=>_0x1dd676[_0x9454('0x78')]===_0x248909);let _0x28d60c=contactItemTypes['find'](_0xd5c758=>_0xd5c758[_0x9454('0x78')]+'_description'===_0x248909);if(_[_0x9454('0x1d')](_0x5964cc)&&_['isNil'](_0x28d60c)){if(_0x1e21ca[_0x9454('0x7f')](_0x248909)){if(_0x432bed[_0x9454('0x7d')][_0x4ca966][_0x1e21ca[_0x248909]]){var _0x4de98d=_[_0x9454('0x80')](_0x432bed[_0x9454('0x7d')][_0x4ca966][_0x1e21ca[_0x248909]][_0x9454('0x81')](/"/g,'\x27'));switch(_0x248909){case _0x9454('0x30'):var _0x3fa6d6=moment(_0x4de98d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3fa6d6[_0x9454('0x82')]()){_0x1203b5['push']('\x22'+_0x4de98d+'\x22');}else{_0x21fe6a[_0x9454('0x19')](_0x9454('0x83'));}break;case'priority':var _0x2a8ac4=parseInt(_0x4de98d);_0x4de98d=_[_0x9454('0x84')](_0x2a8ac4)||_0x2a8ac4<0x0||_0x2a8ac4>0x4?_0x59f9a9?0x3:0x2:_0x2a8ac4;_0x1203b5[_0x9454('0x19')]('\x22'+_0x4de98d+'\x22');break;case _0x9454('0x85'):var _0x5567c7=parseInt(_0x4de98d);if(_[_0x9454('0x86')](_0x5567c7)&&_[_0x9454('0x75')](_0x4d0a4f,_0x5567c7)){_0x1203b5[_0x9454('0x19')]('\x22'+_0x5567c7+'\x22');}else{_0x21fe6a[_0x9454('0x19')](_0x9454('0x87'));}break;case'email':if(isEmail(_0x4de98d)){_0x1203b5[_0x9454('0x19')]('\x22'+_0x4de98d+'\x22');}else{_0x21fe6a[_0x9454('0x19')](_0x9454('0x88'));}break;case'dateOfBirth':var _0x2eb42e=moment(_0x4de98d,_0x9454('0x89'),!![]);if(_0x2eb42e[_0x9454('0x82')]()){_0x1203b5[_0x9454('0x19')]('\x22'+_0x4de98d+'\x22');}else{_0x21fe6a[_0x9454('0x19')](_0x9454('0x8a'));}break;case _0x9454('0x6f'):var _0x5b8ca9=shared[_0x9454('0x8b')];var _0x55a482=_0x5b8ca9[_0x4de98d];if(!_[_0x9454('0x1d')](_0x55a482)){var _0x402fc7=_0x55a482[_0x9454('0x6c')];_0x1203b5['push']('\x22'+_0x4de98d+'\x22');_0x1203b5[_0x9454('0x19')]('\x22'+_0x402fc7+'\x22');}break;default:_0x1203b5[_0x9454('0x19')]('\x22'+_0x4de98d+'\x22');}}else{switch(_0x248909){case _0x9454('0x8c'):case _0x9454('0x11'):_0x21fe6a[_0x9454('0x19')](_0x248909+_0x9454('0x8d'));break;default:_0x1203b5['push']('\x22\x22');}}}}else{var _0x47a35d='';if(!_['isNil'](_0x5964cc)){if(!_0x1b4210[_0x9454('0x7f')](_0x5964cc['id'])){if(!_[_0x9454('0x1d')](_0x432bed[_0x9454('0x7d')][_0x4ca966][_0x1e21ca[_0x248909]])){var _0x4de98d=_['trim'](_0x432bed[_0x9454('0x7d')][_0x4ca966][_0x1e21ca[_0x248909]]['replace'](/"/g,'\x27'));var _0x3b071b=phoneDescriptions[_0x9454('0x8e')](_0x3d0479=>_0x3d0479[_0x9454('0x8f')]===_0x5964cc['id']);if(!_[_0x9454('0x1d')](_0x3b071b)){var _0x3ef46e=_['trim'](_0x432bed[_0x9454('0x7d')][_0x4ca966][_0x1e21ca[_0x3b071b[_0x9454('0x90')]]][_0x9454('0x81')](/"/g,'\x27'));if(!_[_0x9454('0x1d')](_0x3ef46e))_0x4de98d=_0x4de98d+'§'+_0x3ef46e;}if(_0x47a35d=='')_0x47a35d=_0x4de98d;else _0x47a35d+='|'+_0x4de98d;}_0x46c662[_0x9454('0x19')](_0x5964cc['id']+':'+_0x47a35d);_0x1b4210[_0x5964cc['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1203b5[_0x9454('0x19')]('\x22'+_0x46c662[_0x9454('0x13')](';')+'\x22');}if(_0x21fe6a[_0x9454('0x18')]){handleError(_0x432bed[_0x9454('0x7d')][_0x4ca966],{'code':_0x9454('0x91'),'message':_0x21fe6a[_0x9454('0x13')]()});}else{fs['appendFileSync'](_0x20c559,_0x1203b5[_0x9454('0x13')]()+'\x0a');}_0x1203b5=[];}if(!(stats[_0x9454('0x7e')]%0xc8)){socket['emit']('contact:import:'+_0x50a326,stats);stats[_0x9454('0x5b')]=[];}}if(stopped){logger[_0x9454('0x58')]('Abort\x20parser');_0x31a590[_0x9454('0x92')]();}}catch(_0x26dc90){handleError(_0x432bed[_0x9454('0x7d')][_0x4ca966],{'code':_0x9454('0x93'),'message':_0x26dc90[_0x9454('0x60')]});logger[_0x9454('0x59')](_0x9454('0x94'),_0x26dc90[_0x9454('0x60')]);}},'complete':function(){try{var _0x496427=[];var _0xbb6d54=[];var _0x3380ef=_0x9454('0x41');if(_0x5c5c13[_0x9454('0x95')]&&_0x5c5c13[_0x9454('0x95')]['length']){_0x3380ef='cm_contacts_'+_0x50a326;_0x496427[_0x9454('0x19')](_0x9454('0x96')+_0x3380ef+_0x9454('0x97'));}tmp_campaigns=_0x9454('0x98')+_0x50a326;tmp_voice_queues=_0x9454('0x99')+_0x50a326;_0xbb6d54[_0x9454('0x19')](_0x9454('0x96')+tmp_campaigns+_0x9454('0x9a'));_0xbb6d54[_0x9454('0x19')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x9454('0x9a'));BPromise[_0x9454('0x9b')](_0xbb6d54,handleTZQuery)[_0x9454('0x1b')](function(_0x512663){updateTzCampaigns(_0x5c5c13['ListId'])[_0x9454('0x1b')](function(_0x380af5){updateTzVoiceQueues(_0x5c5c13['ListId'])[_0x9454('0x1b')](function(_0x34cb24){if(hasTZ)_0x3d09be=_0x3d09be[_0x9454('0x81')](_0x9454('0x6f'),_0x9454('0x9c'));var _0xcabea5=util[_0x9454('0xd')](_0x9454('0x9d'),_0x20c559,_0x3380ef,_0x3d09be,_0x5c5c13['ListId'],_0x5c5c13[_0x9454('0x52')]||null,NOW,NOW);if(_['isNil'](_0x1e21ca[_0x9454('0x30')])){_0xcabea5+=_0x9454('0x9e');}_0x496427[_0x9454('0x19')](_0xcabea5);if(_0x5c5c13[_0x9454('0x95')]&&_0x5c5c13[_0x9454('0x95')][_0x9454('0x18')]){_0x496427[_0x9454('0x19')](insertCmContact(_0x5c5c13[_0x9454('0x31')],_0x3380ef,_0x5c5c13['duplicates'],_0x1e21ca));_0x496427[_0x9454('0x19')]('DROP\x20TABLE\x20'+_0x3380ef+';');}BPromise[_0x9454('0x9b')](_0x496427,handleQuery)['then'](function(_0x581123){BPromise[_0x9454('0x1a')]([handleAdditionalPhones()])[_0x9454('0x1b')](function(){_0x496427=[];for(var _0x3314ff=0x0;_0x3314ff\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','uncaughtException','path','bluebird','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test'];(function(_0x1f76d2,_0x25dd22){var _0xee6ccb=function(_0x21c316){while(--_0x21c316){_0x1f76d2['push'](_0x1f76d2['shift']());}};_0xee6ccb(++_0x25dd22);}(_0xe452,0x159));var _0x2e45=function(_0x385fd6,_0x36adfd){_0x385fd6=_0x385fd6-0x0;var _0x3145c1=_0xe452[_0x385fd6];return _0x3145c1;};'use strict';var fs=require('fs');var path=require(_0x2e45('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x2e45('0x1'));var moment=require('moment');var squel=require(_0x2e45('0x2'));var Redis=require('ioredis');var db=require(_0x2e45('0x3'))['db'];var config=require(_0x2e45('0x4'));var shared=require(_0x2e45('0x5'));var logger=require('../../../config/logger')(_0x2e45('0x6'));config[_0x2e45('0x7')]=_['defaults'](config[_0x2e45('0x7')],{'host':_0x2e45('0x8'),'port':0x18eb});var socket=require(_0x2e45('0x9'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x2e45('0xa')](_0x2e45('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x2e45('0xa')](_0x2e45('0xb'));function isEmail(_0x15f512){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))*$/[_0x2e45('0xc')](_0x15f512);}function selectNotIn(_0x33406d,_0x4afa6c,_0xa23f0a,_0xf51b3b,_0xf3f2c5){return squel[_0x2e45('0xd')]()['field']('phone')['from'](_0xf51b3b)[_0x2e45('0xe')](_0x4afa6c,null,_0x4afa6c+_0x2e45('0xf')+_0xf51b3b+'.'+_0xa23f0a)['where'](_0xf51b3b+'.'+_0xa23f0a+_0x2e45('0x10')+_0x33406d+'.'+_0xa23f0a)[_0x2e45('0x11')](_0x4afa6c+_0x2e45('0x12')+_0xf3f2c5[_0x2e45('0xe')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4643ae,_0x1e2052){promisesAdditionalPhones=[];return db['CmContact'][_0x2e45('0x13')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x2e45('0x14')](function(_0x2b0b1d){if(_0x2b0b1d!==null){var _0x8b1d1e=[];for(var _0x38bfa6=0x0;_0x38bfa6<_0x2b0b1d['length'];_0x38bfa6++){var _0x19c0ca=_0x2b0b1d[_0x38bfa6];_0x8b1d1e[_0x2e45('0x15')](insertAdditionalPhones(_0x19c0ca));}}Promise[_0x2e45('0x16')](_0x8b1d1e)[_0x2e45('0x14')](function(){_0x4643ae({'val':0x1});});});});}function insertAdditionalPhones(_0x57e915){return new Promise(function(_0x1c65aa,_0x59f3d5){var _0x525d2e=_0x57e915[_0x2e45('0x17')];var _0x12b2ef=_0x525d2e[_0x2e45('0x18')](';');var _0x5dc116=[];orderBy=0x0;for(var _0x2ce185=0x0;_0x2ce185<_0x12b2ef[_0x2e45('0x19')];_0x2ce185++){_0x5dc116[_0x2e45('0x15')](splitAdditionalPhone(_0x57e915['id'],_0x12b2ef[_0x2ce185]));}Promise[_0x2e45('0x16')](_0x5dc116)[_0x2e45('0x14')](function(){_0x1c65aa({'val':_0x12b2ef[_0x2e45('0x19')]});});});}function splitAdditionalPhone(_0x259f42,_0x2427ea){return new Promise(function(_0x2a8ee6,_0x172bdf){var _0x45c737=_0x2427ea['split'](':');var _0xa1af81=_0x45c737[0x0];var _0x3f66b7=_0x45c737[0x1];if(!_[_0x2e45('0x1a')](_0x3f66b7)){var _0x3df923=_0x3f66b7[_0x2e45('0x18')]('|');var _0xcfdb0b=[];for(var _0x5a9d0c=0x0;_0x5a9d0c<_0x3df923[_0x2e45('0x19')];_0x5a9d0c++){if(_0x3df923[_0x5a9d0c]!==''){var _0x4e59cd=_[_0x2e45('0x1b')](promisesAdditionalPhones,{'contactId':_0x259f42,'phone':_0x3df923[_0x5a9d0c]});if(_0x4e59cd['length']==0x0){orderBy++;promisesAdditionalPhones[_0x2e45('0x15')]({'contactId':_0x259f42,'contactTypeId':_0xa1af81,'phone':_0x3df923[_0x5a9d0c],'orderBy':orderBy});}}}_0x2a8ee6({'ok':0x1});}else _0x2a8ee6({'res':0x0});});}function createAdditionalPhone(_0x137b35,_0x1facb8,_0x1a3c7b,_0x1ba471){var _0x58d224='';var _0x36169f='';var _0x1eef6c=_0x1a3c7b[_0x2e45('0x18')]('§');_0x58d224=_0x1eef6c[0x0];if(_0x1eef6c['length']==0x2)_0x36169f=_0x1eef6c[0x1];return new Promise(function(_0x320d73,_0x4c968f){return db['CmContactHasItem'][_0x2e45('0x1c')]({'where':{'CmContactId':_0x137b35,'item':_0x58d224}})[_0x2e45('0x14')](function(_0x21b33d){if(_0x21b33d){return db['CmContactHasItem'][_0x2e45('0x1d')]({'ItemTypeId':_0x1facb8,'description':_0x36169f,'OrderBy':_0x1ba471},{'where':{'CmContactId':_0x137b35,'item':_0x58d224}})[_0x2e45('0x14')](function(_0x1e15a0){_0x320d73({'res':_0x2e45('0x1e')});});}else{return db[_0x2e45('0x1f')][_0x2e45('0x20')]({'CmContactId':_0x137b35,'item':_0x58d224,'description':_0x36169f,'ItemTypeId':_0x1facb8,'OrderBy':_0x1ba471,'ItemClass':'PHONE'})['then'](function(_0x79ab8a){_0x320d73({'res':_0x2e45('0x21')});});}});});}function insertCmHopper(_0x569d73,_0x385a4b,_0x5a5934,_0x4e8960,_0x25c4c7){var _0x4c6116=['cm_contacts.phone','cm_contacts.scheduledat',_0x2e45('0x22'),_0x2e45('0x23'),_0x385a4b+'.'+_0x4e8960,'cm_contacts.createdAt',_0x2e45('0x24'),_0x2e45('0x25'),'cm_contacts.UserId','\x22'+_0x25c4c7+'\x22'];return squel[_0x2e45('0x26')]()[_0x2e45('0x27')](_0x2e45('0x28'))[_0x2e45('0x29')]([_0x2e45('0x2a'),_0x2e45('0x2b'),_0x2e45('0x2c'),'ListId',_0x4e8960,_0x2e45('0x2d'),_0x2e45('0x2e'),_0x2e45('0x2f'),_0x2e45('0x30'),_0x2e45('0x31')],squel[_0x2e45('0xd')]()[_0x2e45('0x32')](_0x4c6116)['from'](_0x385a4b)[_0x2e45('0xe')](_0x2e45('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x385a4b+'.CmListId')[_0x2e45('0xe')](_0x5a5934,null,_0x5a5934+_0x2e45('0xf')+_0x385a4b+'.'+_0x4e8960)[_0x2e45('0x11')](_0x385a4b+_0x2e45('0x34'),_0x569d73)[_0x2e45('0x11')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x2e45('0x35'),selectNotIn(_0x385a4b,_0x5a5934,_0x4e8960,'cm_hopper',['\x22always\x22',_0x2e45('0x36')]))[_0x2e45('0x11')](_0x2e45('0x35'),selectNotIn(_0x385a4b,_0x5a5934,_0x4e8960,_0x2e45('0x28'),[_0x2e45('0x37')])))[_0x2e45('0x38')]();}function insertCmHopperBlack(_0x40aae7,_0x178133,_0x5f48c6,_0x25bb95){var _0x4fc7bd=['cm_contacts.phone',_0x2e45('0x22'),'cm_contacts.ListId',_0x178133+'.'+_0x25bb95,_0x2e45('0x39'),_0x2e45('0x24')];return squel[_0x2e45('0x26')]()[_0x2e45('0x27')]('cm_hopper_black')[_0x2e45('0x29')]([_0x2e45('0x2a'),'ContactId',_0x2e45('0x3a'),_0x25bb95,'createdAt',_0x2e45('0x2e')],squel['select']()[_0x2e45('0x32')](_0x4fc7bd)[_0x2e45('0x3b')](_0x178133)[_0x2e45('0xe')](_0x2e45('0x33'),null,_0x2e45('0x3c')+_0x178133+_0x2e45('0x3d'))[_0x2e45('0xe')](_0x5f48c6,null,_0x5f48c6+_0x2e45('0xf')+_0x178133+'.'+_0x25bb95)[_0x2e45('0x11')](_0x178133+_0x2e45('0x34'),_0x40aae7)[_0x2e45('0x11')](_0x2e45('0x3e'),NOW)['where'](_0x2e45('0x35'),squel[_0x2e45('0xd')]()[_0x2e45('0x3f')](_0x2e45('0x2a'))[_0x2e45('0x3b')](_0x2e45('0x40'))[_0x2e45('0x11')](_0x2e45('0x41'),_0x40aae7)['where'](_0x25bb95+_0x2e45('0x10')+_0x178133+'.'+_0x25bb95)))[_0x2e45('0x38')]();}function insertTzCmHopper(_0x4dbee9,_0x3fd39d,_0x59bf29,_0x15a2e0,_0x57bea9,_0x474c62){var _0x22d891=[_0x2e45('0x42'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x474c62+_0x2e45('0x43'),_0x2e45('0x22'),'cm_contacts.ListId',_0x3fd39d+'.'+_0x15a2e0,'cm_contacts.createdAt',_0x2e45('0x24'),_0x2e45('0x25'),_0x2e45('0x44'),'\x22'+_0x57bea9+'\x22'];var _0x79fd6b=squel[_0x2e45('0x26')]()[_0x2e45('0x27')](_0x2e45('0x28'))['fromQuery']([_0x2e45('0x2a'),_0x2e45('0x2b'),_0x2e45('0x2c'),_0x2e45('0x3a'),_0x15a2e0,_0x2e45('0x2d'),'updatedAt',_0x2e45('0x2f'),_0x2e45('0x30'),'recallme'],squel[_0x2e45('0xd')]()['fields'](_0x22d891)[_0x2e45('0x3b')](_0x3fd39d)[_0x2e45('0xe')](_0x2e45('0x33'),null,_0x2e45('0x3c')+_0x3fd39d+_0x2e45('0x3d'))[_0x2e45('0xe')](_0x59bf29,null,_0x59bf29+_0x2e45('0xf')+_0x3fd39d+'.'+_0x15a2e0)[_0x2e45('0xe')](_0x474c62,null,_0x474c62+_0x2e45('0xf')+_0x3fd39d+'.'+_0x15a2e0)[_0x2e45('0x11')](_0x3fd39d+_0x2e45('0x34'),_0x4dbee9)[_0x2e45('0x11')](_0x2e45('0x3e'),NOW)[_0x2e45('0x11')](_0x2e45('0x35'),selectNotIn(_0x3fd39d,_0x59bf29,_0x15a2e0,_0x2e45('0x28'),[_0x2e45('0x37'),_0x2e45('0x36')]))[_0x2e45('0x11')](_0x2e45('0x35'),selectNotIn(_0x3fd39d,_0x59bf29,_0x15a2e0,_0x2e45('0x28'),[_0x2e45('0x37')])))['toString']();return _0x79fd6b;}function insertTzCmHopperBlack(_0x422bc3,_0x4ddb04,_0x118be0,_0x1b5c48){var _0x4e1f3d=[_0x2e45('0x42'),_0x2e45('0x22'),_0x2e45('0x23'),_0x4ddb04+'.'+_0x1b5c48,_0x2e45('0x39'),_0x2e45('0x24')];return squel[_0x2e45('0x26')]()[_0x2e45('0x27')](_0x2e45('0x40'))[_0x2e45('0x29')]([_0x2e45('0x2a'),'ContactId','ListId',_0x1b5c48,'createdAt','updatedAt'],squel[_0x2e45('0xd')]()['fields'](_0x4e1f3d)[_0x2e45('0x3b')](_0x4ddb04)[_0x2e45('0xe')](_0x2e45('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x4ddb04+_0x2e45('0x3d'))[_0x2e45('0xe')](_0x118be0,null,_0x118be0+_0x2e45('0xf')+_0x4ddb04+'.'+_0x1b5c48)['where'](_0x4ddb04+_0x2e45('0x34'),_0x422bc3)[_0x2e45('0x11')](_0x2e45('0x3e'),NOW)[_0x2e45('0x11')](_0x2e45('0x35'),squel[_0x2e45('0xd')]()[_0x2e45('0x3f')](_0x2e45('0x2a'))[_0x2e45('0x3b')](_0x2e45('0x40'))[_0x2e45('0x11')](_0x2e45('0x41'),_0x422bc3)[_0x2e45('0x11')](_0x1b5c48+_0x2e45('0x10')+_0x4ddb04+'.'+_0x1b5c48)))[_0x2e45('0x38')]();}function insertCmHopperAdditionalPhones(_0x32dc61){var _0x142ef3=[_0x2e45('0x45'),_0x2e45('0x46'),'cm_contact_has_items.OrderBy',_0x2e45('0x47'),_0x2e45('0x48')];return squel[_0x2e45('0x26')]()[_0x2e45('0x27')]('cm_hopper_additional_phones')[_0x2e45('0x29')]([_0x2e45('0x49'),_0x2e45('0x2a'),_0x2e45('0x4a'),'createdAt',_0x2e45('0x2e')],squel[_0x2e45('0xd')]()[_0x2e45('0x32')](_0x142ef3)[_0x2e45('0x3b')](_0x2e45('0x28'))['join'](_0x2e45('0x33'),null,_0x2e45('0x4b'))[_0x2e45('0xe')](_0x2e45('0x4c'),null,_0x2e45('0x4d'))[_0x2e45('0x11')](_0x2e45('0x4e'),_0x32dc61)[_0x2e45('0x11')](_0x2e45('0x3e'),NOW))[_0x2e45('0x38')]();}function insertCmContact(_0x1fe5b4,_0x593fb3,_0x24905d,_0x43f051){var _0x3a883a=_[_0x2e45('0x4f')](_[_0x2e45('0x50')](_0x43f051),[_0x2e45('0x3a'),_0x2e45('0x51'),'createdAt',_0x2e45('0x2e')]);return squel[_0x2e45('0x26')]()[_0x2e45('0x27')]('cm_contacts')['fromQuery'](_0x3a883a,squel[_0x2e45('0xd')]()['fields'](_0x3a883a)[_0x2e45('0x3b')](_0x593fb3)[_0x2e45('0x11')]('('+_0x24905d['join'](',')+_0x2e45('0x52'),squel[_0x2e45('0xd')]()[_0x2e45('0x32')](_0x24905d)[_0x2e45('0x3b')](_0x2e45('0x33'))[_0x2e45('0x11')](_0x2e45('0x41'),_0x1fe5b4)[_0x2e45('0x11')]('deletedAt\x20IS\x20NULL'))[_0x2e45('0x11')](_0x2e45('0x53'),squel['select']()[_0x2e45('0x3f')](_0x2e45('0x54'),_0x2e45('0x55'))[_0x2e45('0x3b')](_0x593fb3)[_0x2e45('0x56')](_0x24905d[_0x2e45('0xe')](','))))[_0x2e45('0x38')]();}function handleStop(){logger['info'](_0x2e45('0x57'));stopped=!![];}function handleUncaughtException(_0x10f08b){logger[_0x2e45('0x58')](_0x10f08b[_0x2e45('0x59')]);process[_0x2e45('0x5a')](0x1);}function handleError(_0x164eba,_0xb2d6c6){stats[_0x2e45('0x5b')]['push']({'name':_0xb2d6c6['code'],'message':_0xb2d6c6[_0x2e45('0x59')],'row':_0x164eba});}function handleQuery(_0x2a356a){logger[_0x2e45('0x5c')](_0x2a356a);return db['sequelize'][_0x2e45('0x5d')](_0x2a356a)[_0x2e45('0x5e')](function(_0x181730){results[_0x2e45('0x15')](_0x181730);})[_0x2e45('0x5f')](function(_0x23ca56){logger[_0x2e45('0x58')](_0x23ca56[_0x2e45('0x59')]);});}function updateTzCampaigns(_0x418d62){return new Promise(function(_0x22e728,_0x342f1d){var _0x335159=squel[_0x2e45('0xd')]()[_0x2e45('0x32')]([_0x2e45('0x60'),'campaigns.dialTimezone'])[_0x2e45('0x3b')]('campaigns')[_0x2e45('0xe')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x2e45('0x11')](_0x2e45('0x61')+_0x418d62);db[_0x2e45('0x62')][_0x2e45('0x5d')](_0x335159[_0x2e45('0x38')]())['spread'](function(_0x331d2e){var _0x2f961f=[];for(var _0x59ace5=0x0;_0x59ace5<_0x331d2e[_0x2e45('0x19')];_0x59ace5++){_0x2f961f[_0x2e45('0x15')](getTimezoneData(_0x331d2e[_0x59ace5],tmp_campaigns));}BPromise[_0x2e45('0x16')](_0x2f961f)[_0x2e45('0x14')](function(){_0x22e728({'val':0x1});});})[_0x2e45('0x5f')](function(_0x5d93d2){logger['error'](_0x5d93d2['message']);_0x22e728({'val':0x0});});});}function updateTzVoiceQueues(_0x27500b){return new Promise(function(_0x56344b,_0x18649f){var _0x5def9d=squel[_0x2e45('0xd')]()[_0x2e45('0x32')]([_0x2e45('0x63'),_0x2e45('0x64')])['from'](_0x2e45('0x65'))['join'](_0x2e45('0x66'),null,_0x2e45('0x67'))['where']('voice_queues_has_cm_lists.CmListId='+_0x27500b);db[_0x2e45('0x62')][_0x2e45('0x5d')](_0x5def9d[_0x2e45('0x38')]())[_0x2e45('0x5e')](function(_0x35258c){var _0x4af175=[];for(var _0x5eff00=0x0;_0x5eff00<_0x35258c[_0x2e45('0x19')];_0x5eff00++){_0x4af175[_0x2e45('0x15')](getTimezoneData(_0x35258c[_0x5eff00],tmp_voice_queues));}BPromise[_0x2e45('0x16')](_0x4af175)[_0x2e45('0x14')](function(){_0x56344b({'val':0x1});});})[_0x2e45('0x5f')](function(_0x3a776d){logger['error'](_0x3a776d[_0x2e45('0x59')]);_0x56344b({'val':0x0});});});}function getTimezoneData(_0x1a83ca,_0x5a2f82){return new Promise(function(_0x20dbc2,_0x23533f){var _0x5aa163=shared[_0x2e45('0x68')];var _0x41b00e=_0x5aa163[_0x1a83ca[_0x2e45('0x69')]];if(_['isNil'](_0x41b00e)){_0x20dbc2({'ret':0x1});}else{var _0x2eb7a7=_0x41b00e[_0x2e45('0x6a')];var _0x4bd3b9=squel[_0x2e45('0x26')]()['into'](_0x5a2f82)[_0x2e45('0x6b')]('id',_0x1a83ca['id'])['set']('offset',_0x2eb7a7)[_0x2e45('0x6b')](_0x2e45('0x69'),_0x1a83ca[_0x2e45('0x69')])[_0x2e45('0x38')]();return db['sequelize'][_0x2e45('0x5d')](_0x4bd3b9)[_0x2e45('0x5e')](function(_0x5b039a){_0x20dbc2({'ret':0x1});})[_0x2e45('0x5f')](function(_0xd1ee53){logger[_0x2e45('0x58')](_0xd1ee53['message']);_0x23533f({'ret':0x1});});}});}function handleTZQuery(_0x2f5699){logger['info'](_0x2f5699);return db[_0x2e45('0x62')][_0x2e45('0x5d')](_0x2f5699)[_0x2e45('0x5e')](function(_0x45fadf){})[_0x2e45('0x5f')](function(_0x3e9390){logger['error'](_0x3e9390[_0x2e45('0x59')]);});}function main(_0x3f830a,_0x34e977,_0x3cbc08,_0x2d1f83){logger['info'](_0x2e45('0x6c'),_0x3f830a,JSON[_0x2e45('0x6d')](_0x34e977));process[_0x2e45('0x6e')](_0x2e45('0x6f'));var _0x42b427=_0x34e977[_0x2e45('0x70')];var _0x5d3bc8=_[_0x2e45('0x71')](_0x42b427);var _0x298595=_0x34e977[_0x2e45('0x72')];var _0x374c0e=path[_0x2e45('0xe')](config[_0x2e45('0x73')],_0x2e45('0x74'),_0x298595+_0x2e45('0x75'));hasTZ=_[_0x2e45('0x50')](_0x42b427)[_0x2e45('0x76')](_0x2e45('0x69'));var _0x44f113=_['keys'](_0x42b427)[_0x2e45('0xe')]();logger[_0x2e45('0x5c')](_0x2e45('0x77'),_0x44f113);db[_0x2e45('0x78')][_0x2e45('0x13')]({'raw':!![],'attributes':['id','name']})[_0x2e45('0x14')](function(_0x27372c){for(var _0x4b8a23=0x0;_0x4b8a23<_0x27372c[_0x2e45('0x19')];_0x4b8a23++){if(_0x27372c[_0x4b8a23][_0x2e45('0x79')]in _0x42b427){contactItemTypes[_0x2e45('0x15')](_0x27372c[_0x4b8a23]);delete _0x5d3bc8[_0x27372c[_0x4b8a23][_0x2e45('0x79')]];hasAdditionalPhones=!![];}for(var _0x16e41c in _0x42b427){if(_0x27372c[_0x4b8a23][_0x2e45('0x79')]+_0x2e45('0x7a')===_0x16e41c){phoneDescriptions[_0x2e45('0x15')]({'itemTypeId':_0x27372c[_0x4b8a23]['id'],'description':_0x16e41c});delete _0x5d3bc8[_0x16e41c];}}}if(hasAdditionalPhones)_0x5d3bc8[_0x2e45('0x17')]='';var _0x2048bc=_[_0x2e45('0x50')](_0x5d3bc8)[_0x2e45('0xe')]();logger['info'](_0x2e45('0x77'),_0x2048bc);fs[_0x2e45('0x7b')](_0x374c0e,_0x2048bc+'\x0a');Papa[_0x2e45('0x7c')](fs[_0x2e45('0x7d')](_0x3f830a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x205c6a,_0x13c075){try{for(var _0x3848d3=0x0,_0x503248=[];_0x3848d3<_0x205c6a['data'][_0x2e45('0x19')];_0x3848d3++){stats[_0x2e45('0x7e')]+=0x1;if(_0x205c6a[_0x2e45('0x5b')][_0x3848d3]){handleError(_0x205c6a[_0x2e45('0x7f')][_0x3848d3],_0x205c6a['errors'][_0x3848d3]);}else{var _0x35e33f=[];var _0x5c97d6=[];var _0x4c1f02={};for(var _0x4f05e9 in _0x42b427){let _0x380cf2=contactItemTypes[_0x2e45('0x80')](_0x287f04=>_0x287f04[_0x2e45('0x79')]===_0x4f05e9);let _0x4c695d=contactItemTypes[_0x2e45('0x80')](_0x5f08f8=>_0x5f08f8[_0x2e45('0x79')]+_0x2e45('0x7a')===_0x4f05e9);if(_[_0x2e45('0x1a')](_0x380cf2)&&_[_0x2e45('0x1a')](_0x4c695d)){if(_0x42b427[_0x2e45('0x81')](_0x4f05e9)){if(_0x205c6a[_0x2e45('0x7f')][_0x3848d3][_0x42b427[_0x4f05e9]]){var _0x34ecf6=_[_0x2e45('0x82')](_0x205c6a[_0x2e45('0x7f')][_0x3848d3][_0x42b427[_0x4f05e9]][_0x2e45('0x83')](/"/g,'\x27'));switch(_0x4f05e9){case _0x2e45('0x2b'):var _0xe0bfec=moment(_0x34ecf6,_0x2e45('0xb'),!![]);if(_0xe0bfec[_0x2e45('0x84')]()){_0x503248[_0x2e45('0x15')]('\x22'+_0x34ecf6+'\x22');}else{_0x35e33f['push'](_0x2e45('0x85'));}break;case _0x2e45('0x2f'):var _0x11f339=parseInt(_0x34ecf6);_0x34ecf6=_['isNaN'](_0x11f339)||_0x11f339<0x0||_0x11f339>0x4?_0x2d1f83?0x3:0x2:_0x11f339;_0x503248[_0x2e45('0x15')]('\x22'+_0x34ecf6+'\x22');break;case _0x2e45('0x30'):var _0x33566c=parseInt(_0x34ecf6);if(_[_0x2e45('0x86')](_0x33566c)&&_[_0x2e45('0x76')](_0x3cbc08,_0x33566c)){_0x503248[_0x2e45('0x15')]('\x22'+_0x33566c+'\x22');}else{_0x35e33f[_0x2e45('0x15')]('agent\x20not\x20exists');}break;case _0x2e45('0x87'):if(isEmail(_0x34ecf6)){_0x503248[_0x2e45('0x15')]('\x22'+_0x34ecf6+'\x22');}else{_0x35e33f['push'](_0x2e45('0x88'));}break;case _0x2e45('0x89'):var _0x1e7d34=moment(_0x34ecf6,_0x2e45('0x8a'),!![]);if(_0x1e7d34[_0x2e45('0x84')]()){_0x503248['push']('\x22'+_0x34ecf6+'\x22');}else{_0x35e33f[_0x2e45('0x15')](_0x2e45('0x8b'));}break;case _0x2e45('0x69'):var _0x54e5c8=shared[_0x2e45('0x68')];var _0x19db14=_0x54e5c8[_0x34ecf6];if(!_['isNil'](_0x19db14)){var _0x2391c6=_0x19db14[_0x2e45('0x6a')];_0x503248[_0x2e45('0x15')]('\x22'+_0x34ecf6+'\x22');_0x503248[_0x2e45('0x15')]('\x22'+_0x2391c6+'\x22');}break;default:_0x503248[_0x2e45('0x15')]('\x22'+_0x34ecf6+'\x22');}}else{switch(_0x4f05e9){case _0x2e45('0x8c'):case _0x2e45('0x2a'):_0x35e33f[_0x2e45('0x15')](_0x4f05e9+_0x2e45('0x8d'));break;default:_0x503248[_0x2e45('0x15')]('\x22\x22');}}}}else{var _0x5270d0='';if(!_[_0x2e45('0x1a')](_0x380cf2)){if(!_0x4c1f02[_0x2e45('0x81')](_0x380cf2['id'])){if(!_['isNil'](_0x205c6a[_0x2e45('0x7f')][_0x3848d3][_0x42b427[_0x4f05e9]])){var _0x34ecf6=_[_0x2e45('0x82')](_0x205c6a['data'][_0x3848d3][_0x42b427[_0x4f05e9]]['replace'](/"/g,'\x27'));var _0x2907ae=phoneDescriptions[_0x2e45('0x80')](_0x31fc84=>_0x31fc84['itemTypeId']===_0x380cf2['id']);if(!_['isNil'](_0x2907ae)){var _0x24ca5d=_[_0x2e45('0x82')](_0x205c6a['data'][_0x3848d3][_0x42b427[_0x2907ae['description']]][_0x2e45('0x83')](/"/g,'\x27'));if(!_[_0x2e45('0x1a')](_0x24ca5d))_0x34ecf6=_0x34ecf6+'§'+_0x24ca5d;}if(_0x5270d0=='')_0x5270d0=_0x34ecf6;else _0x5270d0+='|'+_0x34ecf6;}_0x5c97d6[_0x2e45('0x15')](_0x380cf2['id']+':'+_0x5270d0);_0x4c1f02[_0x380cf2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x503248[_0x2e45('0x15')]('\x22'+_0x5c97d6['join'](';')+'\x22');}if(_0x35e33f[_0x2e45('0x19')]){handleError(_0x205c6a[_0x2e45('0x7f')][_0x3848d3],{'code':'SystemRow','message':_0x35e33f[_0x2e45('0xe')]()});}else{fs[_0x2e45('0x8e')](_0x374c0e,_0x503248[_0x2e45('0xe')]()+'\x0a');}_0x503248=[];}if(!(stats['rows']%0xc8)){socket[_0x2e45('0x8f')](_0x2e45('0x90')+_0x298595,stats);stats[_0x2e45('0x5b')]=[];}}if(stopped){logger[_0x2e45('0x5c')](_0x2e45('0x91'));_0x13c075[_0x2e45('0x92')]();}}catch(_0x141ecc){handleError(_0x205c6a[_0x2e45('0x7f')][_0x3848d3],{'code':_0x2e45('0x93'),'message':_0x141ecc[_0x2e45('0x59')]});logger[_0x2e45('0x58')](_0x2e45('0x94'),_0x141ecc[_0x2e45('0x59')]);}},'complete':function(){try{var _0xa779fd=[];var _0x2fc3de=[];var _0x156691=_0x2e45('0x33');if(_0x34e977['duplicates']&&_0x34e977[_0x2e45('0x95')][_0x2e45('0x19')]){_0x156691=_0x2e45('0x96')+_0x298595;_0xa779fd['push'](_0x2e45('0x97')+_0x156691+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x298595;tmp_voice_queues='voice_queues_'+_0x298595;_0x2fc3de[_0x2e45('0x15')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0x2e45('0x98'));_0x2fc3de[_0x2e45('0x15')](_0x2e45('0x97')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x2e45('0x99')](_0x2fc3de,handleTZQuery)['then'](function(_0x319d1e){updateTzCampaigns(_0x34e977[_0x2e45('0x3a')])[_0x2e45('0x14')](function(_0x1897db){updateTzVoiceQueues(_0x34e977[_0x2e45('0x3a')])['then'](function(_0x37d82a){if(hasTZ)_0x2048bc=_0x2048bc['replace'](_0x2e45('0x69'),_0x2e45('0x9a'));var _0x240e67=util[_0x2e45('0xa')](_0x2e45('0x9b'),_0x374c0e,_0x156691,_0x2048bc,_0x34e977[_0x2e45('0x3a')],_0x34e977[_0x2e45('0x51')]||null,NOW,NOW);if(_[_0x2e45('0x1a')](_0x42b427[_0x2e45('0x2b')])){_0x240e67+=_0x2e45('0x9c');}_0xa779fd[_0x2e45('0x15')](_0x240e67);if(_0x34e977[_0x2e45('0x95')]&&_0x34e977['duplicates'][_0x2e45('0x19')]){_0xa779fd['push'](insertCmContact(_0x34e977[_0x2e45('0x3a')],_0x156691,_0x34e977[_0x2e45('0x95')],_0x42b427));_0xa779fd[_0x2e45('0x15')](_0x2e45('0x9d')+_0x156691+';');}BPromise[_0x2e45('0x99')](_0xa779fd,handleQuery)[_0x2e45('0x14')](function(_0x264966){BPromise[_0x2e45('0x16')]([handleAdditionalPhones()])[_0x2e45('0x14')](function(){_0xa779fd=[];for(var _0x11a12b=0x0;_0x11a12b_0x499987[_0x402a('0x64')]===_0x5a1443);let _0x544a75=contactItemTypes['find'](_0x3135f2=>_0x3135f2[_0x402a('0x64')]+_0x402a('0x65')===_0x5a1443);if(_[_0x402a('0x1c')](_0x14bade)&&_[_0x402a('0x1c')](_0x544a75)){if(_0x160a63['hasOwnProperty'](_0x5a1443)){if(_0x56b02e[_0x402a('0x6a')][_0x282c50][_0x160a63[_0x5a1443]]){var _0x427b3a=_['trim'](_0x56b02e[_0x402a('0x6a')][_0x282c50][_0x160a63[_0x5a1443]]['replace'](/"/g,'\x27'));switch(_0x5a1443){case _0x402a('0x2e'):var _0x538140=moment(_0x427b3a,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x538140['isValid']()){_0xe7ade4['push']('\x22'+_0x427b3a+'\x22');}else{_0x5db717['push'](_0x402a('0x6d'));}break;case'priority':var _0x56df55=parseInt(_0x427b3a);_0x427b3a=_['isNaN'](_0x56df55)||_0x56df55<0x0||_0x56df55>0x4?_0x3bb646?0x3:0x2:_0x56df55;_0xe7ade4[_0x402a('0x19')]('\x22'+_0x427b3a+'\x22');break;case _0x402a('0x6e'):var _0x4fcad4=parseInt(_0x427b3a);if(_[_0x402a('0x6f')](_0x4fcad4)&&_['includes'](_0x547b71,_0x4fcad4)){_0xe7ade4[_0x402a('0x19')]('\x22'+_0x4fcad4+'\x22');}else{_0x5db717[_0x402a('0x19')](_0x402a('0x70'));}break;case _0x402a('0x71'):if(isEmail(_0x427b3a)){_0xe7ade4['push']('\x22'+_0x427b3a+'\x22');}else{_0x5db717['push'](_0x402a('0x72'));}break;case _0x402a('0x73'):var _0x49ff67=moment(_0x427b3a,'YYYY-MM-DD',!![]);if(_0x49ff67[_0x402a('0x74')]()){_0xe7ade4[_0x402a('0x19')]('\x22'+_0x427b3a+'\x22');}else{_0x5db717['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0xe7ade4[_0x402a('0x19')]('\x22'+_0x427b3a+'\x22');}}else{switch(_0x5a1443){case _0x402a('0x75'):case _0x402a('0x10'):_0x5db717[_0x402a('0x19')](_0x5a1443+_0x402a('0x76'));break;default:_0xe7ade4[_0x402a('0x19')]('\x22\x22');}}}}else{var _0x661223='';if(!_[_0x402a('0x1c')](_0x14bade)){if(!_0x1075dd[_0x402a('0x77')](_0x14bade['id'])){for(var _0x2930d1=0x0;_0x2930d1<_0x160a63[_0x5a1443]['length'];_0x2930d1++){var _0x427b3a=_[_0x402a('0x78')](_0x56b02e['data'][_0x282c50][_0x160a63[_0x5a1443][_0x2930d1]][_0x402a('0x79')](/"/g,'\x27'));var _0x1d92ee=phoneDescriptions['find'](_0x48c65d=>_0x48c65d['itemTypeId']===_0x14bade['id']);if(!_[_0x402a('0x1c')](_0x1d92ee)){var _0x2dfb32=_[_0x402a('0x78')](_0x56b02e[_0x402a('0x6a')][_0x282c50][_0x160a63[_0x1d92ee[_0x402a('0x7a')]][0x0]][_0x402a('0x79')](/"/g,'\x27'));if(!_['isNil'](_0x2dfb32))_0x427b3a=_0x427b3a+'§'+_0x2dfb32;}if(_0x661223=='')_0x661223=_0x427b3a;else _0x661223+='|'+_0x427b3a;}_0x31c575[_0x402a('0x19')](_0x14bade['id']+':'+_0x661223);_0x1075dd[_0x14bade['id']]=0x1;}}}}if(hasAdditionalPhones){_0xe7ade4[_0x402a('0x19')]('\x22'+_0x31c575['join'](';')+'\x22');}if(_0x5db717[_0x402a('0x17')]){handleError(_0x56b02e['data'][_0x282c50],{'code':_0x402a('0x7b'),'message':_0x5db717[_0x402a('0x11')]()});}else{fs[_0x402a('0x7c')](_0x43ae73,_0xe7ade4[_0x402a('0x11')]()+'\x0a');}_0xe7ade4=[];}if(!(stats[_0x402a('0x6b')]%0xc8)){socket[_0x402a('0x7d')](_0x402a('0x7e')+_0x10cf72,stats);stats[_0x402a('0x55')]=[];}}if(stopped){logger['info']('Abort\x20parser');_0x5c38b2[_0x402a('0x7f')]();}}catch(_0x12af62){handleError(_0x56b02e[_0x402a('0x6a')][_0x282c50],{'code':_0x402a('0x80'),'message':_0x12af62['message']});logger[_0x402a('0x52')](_0x402a('0x81'),_0x12af62[_0x402a('0x53')]);}},'complete':function(){try{var _0x478e17=[];var _0x1e1b0d=tempTableName;_0x478e17['push'](_0x402a('0x82')+_0x1e1b0d+_0x402a('0x83'));logger[_0x402a('0x51')]('CIS\x20len',contactItemTypes[_0x402a('0x17')]);var _0x20cbe2=util['format'](_0x402a('0x84'),_0x43ae73,_0x1e1b0d,_0x1322d6,_0x3fdbe5[_0x402a('0x30')],_0x3fdbe5[_0x402a('0x4c')]||null,NOW,NOW);if(_['isNil'](_0x160a63['scheduledat'])){_0x20cbe2+=_0x402a('0x85');}_0x478e17['push'](_0x20cbe2);BPromise['each'](_0x478e17,handleQuery)['then'](function(_0x56a441){BPromise[_0x402a('0x1a')]([handleAdditionalPhones()])[_0x402a('0x1b')](function(){_0x478e17=[];for(var _0x1c06cc=0x0;_0x1c06cc\x20\x20');}var _0xef5d1a=path['join'](config[_0x402a('0x5f')],_0x402a('0x60'),process[_0x402a('0x8c')][0x2]);if(!fs[_0x402a('0x8d')](_0xef5d1a)){throw new Error(_0x402a('0x8e'));}var _0x1f32fd={};try{_0x1f32fd=JSON[_0x402a('0x68')](process['argv'][0x3]);if(!_0x1f32fd['binding']){throw new Error(_0x402a('0x8f'));}var _0x1b884c=0x0;if(_0x1f32fd[_0x402a('0x5c')][_0x402a('0x6e')]){_0x1b884c=0x1;}if(!_0x1f32fd[_0x402a('0x30')]){throw new Error(_0x402a('0x90'));}}catch(_0x5887a7){throw new Error(_0x402a('0x91'));}var _0x192f53=[];try{_0x192f53=_[_0x402a('0x92')](JSON[_0x402a('0x68')](process['argv'][0x4]),'id');}catch(_0x5c6630){logger['info'](_0x402a('0x93'));}main(_0xef5d1a,_0x1f32fd,_0x192f53,_0x1b884c);}validate();process['on']('SIGINT',handleStop);process['on'](_0x402a('0x94'),handleUncaughtException); \ No newline at end of file +var _0x6eb2=['UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','into','cm_hopper_black','createdAt','cm_contacts.ListId\x20=\x20','field','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','updatedAt','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','message','errors','code','main','stringify','start','clone','socket_timestamp','root','server/files/tmp','ContactItemType','name','_description','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','exit','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','cm_contacts_temp_','test','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','length','isNil','AdditionalPhones','push','all','catch','error','split','then','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','phone','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','priority'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x6eb2,0x10a));var _0x26eb=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x6eb2[_0x2a558d];return _0xa7bc9c;};'use strict';var fs=require('fs');var path=require(_0x26eb('0x0'));var _=require('lodash');var Papa=require(_0x26eb('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x26eb('0x2'));var squel=require(_0x26eb('0x3'));var Redis=require(_0x26eb('0x4'));var db=require(_0x26eb('0x5'))['db'];var config=require(_0x26eb('0x6'));var logger=require(_0x26eb('0x7'))(_0x26eb('0x8'));config['redis']=_[_0x26eb('0x9')](config[_0x26eb('0xa')],{'host':_0x26eb('0xb'),'port':0x18eb});var socket=require(_0x26eb('0xc'))(new Redis(config['redis']));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()[_0x26eb('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x26eb('0xe')+moment()[_0x26eb('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x3d010f){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))*$/[_0x26eb('0xf')](_0x3d010f);}function selectNotIn(_0x14d022,_0x5db75f,_0x32404e,_0xe45bc6,_0x26ead1){return squel['select']()['field']('phone')[_0x26eb('0x10')](_0xe45bc6)[_0x26eb('0x11')](_0x5db75f,null,_0x5db75f+_0x26eb('0x12')+_0xe45bc6+'.'+_0x32404e)[_0x26eb('0x13')](_0xe45bc6+'.'+_0x32404e+_0x26eb('0x14')+_0x14d022+'.'+_0x32404e)[_0x26eb('0x13')](_0x5db75f+_0x26eb('0x15')+_0x26ead1[_0x26eb('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x59b877,_0x22f874){promisesAdditionalPhones=[];promisesContact=[];return db[_0x26eb('0x16')][_0x26eb('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x26eb('0x18')](function(_0x361085){if(_0x361085!==null){var _0x3898f5=[];for(var _0x450bf9=0x0;_0x450bf9<_0x361085[_0x26eb('0x19')];_0x450bf9++){var _0x258fff=_0x361085[_0x450bf9];if(!_[_0x26eb('0x1a')](_0x258fff['phone'])){if(!_['isNil'](_0x258fff[_0x26eb('0x1b')]))_0x3898f5['push'](insertAdditionalPhones(_0x258fff));promisesContact[_0x26eb('0x1c')]({'contact':_0x258fff});}}}Promise[_0x26eb('0x1d')](_0x3898f5)['then'](function(){_0x59b877({'val':0x1});});})[_0x26eb('0x1e')](function(_0x370c66){logger[_0x26eb('0x1f')](_0x370c66['message']);});});}function insertAdditionalPhones(_0x185dff){return new Promise(function(_0x3eb486,_0x320bbe){var _0x3a894d=_0x185dff['AdditionalPhones'];if(_[_0x26eb('0x1a')](_0x3a894d))_0x320bbe({'val':0x0});else{var _0x29c01a=_0x3a894d[_0x26eb('0x20')](';');var _0x1c34b3=[];orderBy=0x0;for(var _0x4daf8e=0x0;_0x4daf8e<_0x29c01a[_0x26eb('0x19')];_0x4daf8e++){_0x1c34b3[_0x26eb('0x1c')](splitAdditionalPhone(_0x185dff['id'],_0x29c01a[_0x4daf8e]));}Promise[_0x26eb('0x1d')](_0x1c34b3)[_0x26eb('0x21')](function(){_0x3eb486({'val':_0x29c01a[_0x26eb('0x19')]});});}});}function splitAdditionalPhone(_0x18ddc4,_0x31127e){return new Promise(function(_0x317e16,_0xc5adb6){var _0x2c41c8=_0x31127e[_0x26eb('0x20')](':');var _0x4a3e03=_0x2c41c8[0x0];var _0xa93eaf=_0x2c41c8[0x1];if(_0xa93eaf!==''){var _0x521c4b=_0xa93eaf[_0x26eb('0x20')]('|');var _0x317928=[];for(var _0x575f61=0x0;_0x575f61<_0x521c4b[_0x26eb('0x19')];_0x575f61++){if(_0x521c4b[_0x575f61]!==''){var _0x457c8f=_[_0x26eb('0x22')](promisesAdditionalPhones,{'contactId':_0x18ddc4,'phone':_0x521c4b[_0x575f61]});if(_0x457c8f[_0x26eb('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x26eb('0x1c')]({'contactId':_0x18ddc4,'contactTypeId':_0x4a3e03,'phone':_0x521c4b[_0x575f61],'orderBy':orderBy});}}}_0x317e16({'ok':0x1});}else _0x317e16({'res':0x0});});}function createAdditionalPhone(_0x352e16,_0x45ca23,_0x4925f0,_0x3091d6){var _0x5b180f='';var _0x44b90e='';var _0x52473d=_0x4925f0[_0x26eb('0x20')]('§');_0x5b180f=_0x52473d[0x0];if(_0x52473d[_0x26eb('0x19')]==0x2)_0x44b90e=_0x52473d[0x1];return new Promise(function(_0x231949,_0x40fbf2){return db[_0x26eb('0x23')][_0x26eb('0x24')]({'where':{'CmContactId':_0x352e16,'item':_0x5b180f}})['then'](function(_0x123a65){if(_0x123a65){return db[_0x26eb('0x23')][_0x26eb('0x25')]({'ItemTypeId':_0x45ca23,'description':_0x44b90e,'OrderBy':_0x3091d6},{'where':{'CmContactId':_0x352e16,'item':_0x5b180f}})[_0x26eb('0x21')](function(_0x23c774){_0x231949({'res':'updated'});});}else{return db['CmContactHasItem'][_0x26eb('0x26')]({'CmContactId':_0x352e16,'item':_0x5b180f,'ItemTypeId':_0x45ca23,'description':_0x44b90e,'OrderBy':_0x3091d6,'ItemClass':_0x26eb('0x27')})['then'](function(_0x950e2b){_0x231949({'res':_0x26eb('0x28')});});}});});}function updateContact(_0x53e0ed){return new Promise(function(_0x48eb14,_0x3d3ded){var _0x4d9b46=_0x53e0ed['id'];delete _0x53e0ed['id'];return db[_0x26eb('0x29')][_0x26eb('0x25')](_0x53e0ed,{'where':{'id':_0x4d9b46}})[_0x26eb('0x21')](function(_0x3b0b5f){updatedRows+=0x1;return db['CmHopper'][_0x26eb('0x25')]({'phone':_0x53e0ed[_0x26eb('0x2a')]},{'where':{'ContactId':_0x4d9b46}})[_0x26eb('0x21')](function(_0x57105f){_0x48eb14({'ret':'OK'});});});});}function insertCmHopper(_0x7f2963,_0x24df8e,_0x22e1f8,_0x574f74,_0x25f6e6){var _0x5b169e=[_0x26eb('0x2b'),_0x26eb('0x2c'),_0x26eb('0x2d'),_0x26eb('0x2e'),_0x24df8e+'.'+_0x574f74,_0x26eb('0x2f'),'cm_contacts.updatedAt',_0x26eb('0x30'),'cm_contacts.UserId','\x22'+_0x25f6e6+'\x22'];return squel[_0x26eb('0x31')]()['into'](_0x26eb('0x32'))[_0x26eb('0x33')](['phone',_0x26eb('0x34'),_0x26eb('0x35'),_0x26eb('0x36'),_0x574f74,'createdAt','updatedAt',_0x26eb('0x37'),_0x26eb('0x38'),_0x26eb('0x39')],squel[_0x26eb('0x3a')]()[_0x26eb('0x3b')](_0x5b169e)[_0x26eb('0x10')](_0x24df8e)[_0x26eb('0x11')](_0x26eb('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x24df8e+_0x26eb('0x3d'))['join'](_0x22e1f8,null,_0x22e1f8+_0x26eb('0x12')+_0x24df8e+'.'+_0x574f74)[_0x26eb('0x13')](_0x24df8e+_0x26eb('0x3e'),_0x7f2963)[_0x26eb('0x13')](_0x26eb('0x3f'),NOW)['where'](_0x26eb('0x40'),selectNotIn(_0x24df8e,_0x22e1f8,_0x574f74,'cm_hopper',[_0x26eb('0x41'),_0x26eb('0x42')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x24df8e,_0x22e1f8,_0x574f74,_0x26eb('0x32'),[_0x26eb('0x41')])))['toString']();}function insertCmHopperBlack(_0x3c9211,_0x37a2cf,_0x331ad0,_0x10b40b){var _0x2938fe=[_0x26eb('0x2b'),'cm_contacts.id',_0x26eb('0x2e'),_0x37a2cf+'.'+_0x10b40b,'cm_contacts.createdAt',_0x26eb('0x43')];return squel[_0x26eb('0x31')]()[_0x26eb('0x44')](_0x26eb('0x45'))[_0x26eb('0x33')]([_0x26eb('0x2a'),'ContactId',_0x26eb('0x36'),_0x10b40b,_0x26eb('0x46'),'updatedAt'],squel['select']()[_0x26eb('0x3b')](_0x2938fe)[_0x26eb('0x10')](_0x37a2cf)['join'](_0x26eb('0x3c'),null,_0x26eb('0x47')+_0x37a2cf+'.CmListId')[_0x26eb('0x11')](_0x331ad0,null,_0x331ad0+'.id\x20=\x20'+_0x37a2cf+'.'+_0x10b40b)[_0x26eb('0x13')](_0x37a2cf+'.CmListId\x20=\x20?',_0x3c9211)[_0x26eb('0x13')](_0x26eb('0x3f'),NOW)[_0x26eb('0x13')](_0x26eb('0x40'),squel['select']()[_0x26eb('0x48')]('phone')[_0x26eb('0x10')](_0x26eb('0x45'))['where']('ListId\x20=\x20?',_0x3c9211)[_0x26eb('0x13')](_0x10b40b+_0x26eb('0x49'),_0x37a2cf+'.'+_0x10b40b)))[_0x26eb('0x4a')]();}function insertCmHopperAdditionalPhones(_0x36dbe0){var _0x3245c5=[_0x26eb('0x4b'),_0x26eb('0x4c'),_0x26eb('0x4d'),_0x26eb('0x4e'),_0x26eb('0x4f')];return squel[_0x26eb('0x31')]()[_0x26eb('0x44')](_0x26eb('0x50'))[_0x26eb('0x33')](['CmHopperId',_0x26eb('0x2a'),_0x26eb('0x51'),_0x26eb('0x46'),_0x26eb('0x52')],squel[_0x26eb('0x3a')]()[_0x26eb('0x3b')](_0x3245c5)['from'](_0x26eb('0x32'))['join'](_0x26eb('0x3c'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x26eb('0x11')](_0x26eb('0x53'),null,_0x26eb('0x54'))['where'](_0x26eb('0x55'),_0x36dbe0)[_0x26eb('0x13')](_0x26eb('0x3f'),NOW))['toString']();}function insertCmContact(_0x343458,_0x396fc1,_0xe531b4,_0x38f53b){var _0x394ac4=_[_0x26eb('0x56')](_[_0x26eb('0x57')](_0x38f53b),[_0x26eb('0x36'),_0x26eb('0x58'),'createdAt',_0x26eb('0x52')]);return squel[_0x26eb('0x31')]()['into']('cm_contacts')['fromQuery'](_0x394ac4,squel[_0x26eb('0x3a')]()[_0x26eb('0x3b')](_0x394ac4)[_0x26eb('0x10')](_0x396fc1)[_0x26eb('0x13')]('('+_0xe531b4['join'](',')+_0x26eb('0x59'),squel[_0x26eb('0x3a')]()['fields'](_0xe531b4)[_0x26eb('0x10')](_0x26eb('0x3c'))[_0x26eb('0x13')]('ListId\x20=\x20?',_0x343458))[_0x26eb('0x13')](_0x26eb('0x5a'),squel[_0x26eb('0x3a')]()[_0x26eb('0x48')](_0x26eb('0x5b'),'min_id')[_0x26eb('0x10')](_0x396fc1)['group'](_0xe531b4['join'](','))))['toString']();}function handleStop(){logger[_0x26eb('0x5c')](_0x26eb('0x5d'));stopped=!![];}function handleUncaughtException(_0x3108b6){logger[_0x26eb('0x1f')](_0x3108b6[_0x26eb('0x5e')]);process['exit'](0x1);}function handleError(_0x3cda1a,_0x20f065){stats[_0x26eb('0x5f')][_0x26eb('0x1c')]({'name':_0x20f065[_0x26eb('0x60')],'message':_0x20f065[_0x26eb('0x5e')],'row':_0x3cda1a});}function handleQuery(_0x237218){logger[_0x26eb('0x5c')](_0x237218);return db[_0x26eb('0x16')][_0x26eb('0x17')](_0x237218)[_0x26eb('0x18')](function(_0x408e4f){results[_0x26eb('0x1c')](_0x408e4f);})[_0x26eb('0x1e')](function(_0x163977){logger[_0x26eb('0x1f')](_0x163977['message']);});}function main(_0x37b74b,_0x22b535,_0x3fcc66,_0x19558f){logger[_0x26eb('0x5c')](_0x26eb('0x61'),_0x37b74b,JSON[_0x26eb('0x62')](_0x22b535));process['send'](_0x26eb('0x63'));var _0x3c6516=_0x22b535['binding'];var _0x42789e=_[_0x26eb('0x64')](_0x3c6516);var _0x22ecaf=_0x22b535[_0x26eb('0x65')];var _0x2c1845=path['join'](config[_0x26eb('0x66')],_0x26eb('0x67'),_0x22ecaf+'.csv');logger['info']('body',_0x22b535);db[_0x26eb('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x26eb('0x69')]})[_0x26eb('0x21')](function(_0x1bc29c){for(var _0x46f944=0x0;_0x46f944<_0x1bc29c[_0x26eb('0x19')];_0x46f944++){if(_0x1bc29c[_0x46f944]['name']in _0x3c6516){contactItemTypes[_0x26eb('0x1c')](_0x1bc29c[_0x46f944]);delete _0x42789e[_0x1bc29c[_0x46f944][_0x26eb('0x69')]];hasAdditionalPhones=!![];}for(var _0x5b7bbd in _0x3c6516){if(_0x1bc29c[_0x46f944]['name']+_0x26eb('0x6a')===_0x5b7bbd){phoneDescriptions[_0x26eb('0x1c')]({'itemTypeId':_0x1bc29c[_0x46f944]['id'],'description':_0x5b7bbd});delete _0x42789e[_0x5b7bbd];}}}if(hasAdditionalPhones)_0x42789e[_0x26eb('0x1b')]='';var _0x27402c=_[_0x26eb('0x57')](_0x42789e)[_0x26eb('0x11')]();logger[_0x26eb('0x5c')](_0x26eb('0x6b'),_0x27402c);fs[_0x26eb('0x6c')](_0x2c1845,_0x27402c+'\x0a');Papa['parse'](fs[_0x26eb('0x6d')](_0x37b74b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x31cac2,_0x33a77a){try{for(var _0x21c7ec=0x0,_0x37cea3=[];_0x21c7ec<_0x31cac2[_0x26eb('0x6e')][_0x26eb('0x19')];_0x21c7ec++){stats[_0x26eb('0x6f')]+=0x1;if(_0x31cac2['errors'][_0x21c7ec]){handleError(_0x31cac2[_0x26eb('0x6e')][_0x21c7ec],_0x31cac2[_0x26eb('0x5f')][_0x21c7ec]);}else{var _0xd1650e=[];var _0x1182b2=[];var _0xa9e20b={};for(var _0x5ef666 in _0x3c6516){let _0xa5c61=contactItemTypes[_0x26eb('0x70')](_0x1d4e0c=>_0x1d4e0c[_0x26eb('0x69')]===_0x5ef666);let _0x27b09f=contactItemTypes[_0x26eb('0x70')](_0x171f88=>_0x171f88['name']+_0x26eb('0x6a')===_0x5ef666);if(_[_0x26eb('0x1a')](_0xa5c61)&&_[_0x26eb('0x1a')](_0x27b09f)){if(_0x3c6516[_0x26eb('0x71')](_0x5ef666)){if(_0x31cac2[_0x26eb('0x6e')][_0x21c7ec][_0x3c6516[_0x5ef666]]){var _0x49f0e6=_['trim'](_0x31cac2[_0x26eb('0x6e')][_0x21c7ec][_0x3c6516[_0x5ef666]][_0x26eb('0x72')](/"/g,'\x27'));switch(_0x5ef666){case _0x26eb('0x34'):var _0x3bffaf=moment(_0x49f0e6,_0x26eb('0x73'),!![]);if(_0x3bffaf[_0x26eb('0x74')]()){_0x37cea3['push']('\x22'+_0x49f0e6+'\x22');}else{_0xd1650e['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x26eb('0x37'):var _0x22b874=parseInt(_0x49f0e6);_0x49f0e6=_['isNaN'](_0x22b874)||_0x22b874<0x0||_0x22b874>0x4?_0x19558f?0x3:0x2:_0x22b874;_0x37cea3['push']('\x22'+_0x49f0e6+'\x22');break;case _0x26eb('0x38'):var _0x4ab41b=parseInt(_0x49f0e6);if(_[_0x26eb('0x75')](_0x4ab41b)&&_['includes'](_0x3fcc66,_0x4ab41b)){_0x37cea3[_0x26eb('0x1c')]('\x22'+_0x4ab41b+'\x22');}else{_0xd1650e[_0x26eb('0x1c')](_0x26eb('0x76'));}break;case _0x26eb('0x77'):if(isEmail(_0x49f0e6)){_0x37cea3[_0x26eb('0x1c')]('\x22'+_0x49f0e6+'\x22');}else{_0xd1650e[_0x26eb('0x1c')](_0x26eb('0x78'));}break;case'dateOfBirth':var _0x439129=moment(_0x49f0e6,_0x26eb('0x79'),!![]);if(_0x439129[_0x26eb('0x74')]()){_0x37cea3[_0x26eb('0x1c')]('\x22'+_0x49f0e6+'\x22');}else{_0xd1650e[_0x26eb('0x1c')](_0x26eb('0x7a'));}break;default:_0x37cea3[_0x26eb('0x1c')]('\x22'+_0x49f0e6+'\x22');}}else{switch(_0x5ef666){case _0x26eb('0x7b'):case'phone':_0xd1650e[_0x26eb('0x1c')](_0x5ef666+_0x26eb('0x7c'));break;default:_0x37cea3[_0x26eb('0x1c')]('\x22\x22');}}}}else{var _0x32e9d3='';if(!_['isNil'](_0xa5c61)){if(!_0xa9e20b[_0x26eb('0x71')](_0xa5c61['id'])){for(var _0x4c7d44=0x0;_0x4c7d44<_0x3c6516[_0x5ef666][_0x26eb('0x19')];_0x4c7d44++){var _0x49f0e6=_[_0x26eb('0x7d')](_0x31cac2[_0x26eb('0x6e')][_0x21c7ec][_0x3c6516[_0x5ef666][_0x4c7d44]]['replace'](/"/g,'\x27'));var _0x41a063=phoneDescriptions['find'](_0x31a341=>_0x31a341[_0x26eb('0x7e')]===_0xa5c61['id']);if(!_[_0x26eb('0x1a')](_0x41a063)){var _0x41c7eb=_[_0x26eb('0x7d')](_0x31cac2['data'][_0x21c7ec][_0x3c6516[_0x41a063[_0x26eb('0x7f')]][0x0]][_0x26eb('0x72')](/"/g,'\x27'));if(!_['isNil'](_0x41c7eb))_0x49f0e6=_0x49f0e6+'§'+_0x41c7eb;}if(_0x32e9d3=='')_0x32e9d3=_0x49f0e6;else _0x32e9d3+='|'+_0x49f0e6;}_0x1182b2[_0x26eb('0x1c')](_0xa5c61['id']+':'+_0x32e9d3);_0xa9e20b[_0xa5c61['id']]=0x1;}}}}if(hasAdditionalPhones){_0x37cea3[_0x26eb('0x1c')]('\x22'+_0x1182b2[_0x26eb('0x11')](';')+'\x22');}if(_0xd1650e[_0x26eb('0x19')]){handleError(_0x31cac2['data'][_0x21c7ec],{'code':_0x26eb('0x80'),'message':_0xd1650e[_0x26eb('0x11')]()});}else{fs[_0x26eb('0x81')](_0x2c1845,_0x37cea3[_0x26eb('0x11')]()+'\x0a');}_0x37cea3=[];}if(!(stats[_0x26eb('0x6f')]%0xc8)){socket[_0x26eb('0x82')](_0x26eb('0x83')+_0x22ecaf,stats);stats['errors']=[];}}if(stopped){logger[_0x26eb('0x5c')](_0x26eb('0x84'));_0x33a77a[_0x26eb('0x85')]();}}catch(_0x3b0ed1){handleError(_0x31cac2['data'][_0x21c7ec],{'code':'SystemError','message':_0x3b0ed1[_0x26eb('0x5e')]});logger[_0x26eb('0x1f')](_0x26eb('0x86'),_0x3b0ed1[_0x26eb('0x5e')]);}},'complete':function(){try{var _0x14a822=[];var _0x497ad9=tempTableName;_0x14a822['push'](_0x26eb('0x87')+_0x497ad9+_0x26eb('0x88'));logger['info'](_0x26eb('0x89'),contactItemTypes['length']);var _0x24aaf8=util['format'](_0x26eb('0x8a'),_0x2c1845,_0x497ad9,_0x27402c,_0x22b535[_0x26eb('0x36')],_0x22b535['CompanyId']||null,NOW,NOW);if(_[_0x26eb('0x1a')](_0x3c6516[_0x26eb('0x34')])){_0x24aaf8+=',\x20scheduledAt\x20=\x20NOW()';}_0x14a822[_0x26eb('0x1c')](_0x24aaf8);BPromise[_0x26eb('0x8b')](_0x14a822,handleQuery)[_0x26eb('0x21')](function(_0x21be1f){BPromise[_0x26eb('0x1d')]([handleAdditionalPhones()])[_0x26eb('0x21')](function(){_0x14a822=[];for(var _0x613c1=0x0;_0x613c1\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','contactName','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','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','Setting','findOne','enableEmailPreview','all','isEmpty','t.id\x20IN\x20?','query','exports','lodash','squel','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','me.','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','isEmail','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','type','default','start','end','unreadMessages','value','read','and','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','split'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x180f,0xf3));var _0xf180=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x180f[_0x594ece];return _0x471bc4;};'use strict';var _=require(_0xf180('0x0'));var squel=require(_0xf180('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xf180('0x2'));var updateInteraction=require(_0xf180('0x3'))['updateInteraction'];var utils=require(_0xf180('0x4'));var db=require(_0xf180('0x5'))['db'];function skipInteractionsQuery(_0x472213,_0x39895a,_0x10b776){var _0x5f269f=![];var _0x2ef675=utils[_0xf180('0x6')](_0x472213);if(_0x39895a['role']==='agent'&&!_0x10b776[_0xf180('0x7')]&&!_0x10b776[_0x2ef675]){_0x5f269f=!![];}return _0x5f269f;}function getTagsQuery(){return squel[_0xf180('0x8')]()[_0xf180('0x9')]('id')[_0xf180('0x9')](_0xf180('0xa'))[_0xf180('0x9')](_0xf180('0xb'))[_0xf180('0xc')](_0xf180('0xd'));}function getUsersQuery(_0x5a242b,_0x43d390){var _0x460472=utils[_0xf180('0xe')](_0x5a242b);var _0x18bde3=_0xf180('0xf')+_0x5a242b+_0xf180('0x10');var _0x422e7e=squel[_0xf180('0x8')]()[_0xf180('0x9')](_0xf180('0x11'))[_0xf180('0x9')]('u.fullname')[_0xf180('0x9')](_0xf180('0x12')+_0x460472)[_0xf180('0xc')](_0x18bde3,'ui')[_0xf180('0x13')]('users','u',_0xf180('0x14'));if(_0x43d390[_0xf180('0x15')]>0x0){_0x422e7e[_0xf180('0x16')]('ui.'+_0x460472+_0xf180('0x17'),_[_0xf180('0x18')](_0x43d390,'id'));}return _0x422e7e;}function getInteractionsQuery(_0x496e65){var _0x115b86=utils[_0xf180('0x19')](_0x496e65);var _0x492c22=utils[_0xf180('0x6')](_0x496e65);var _0x14ddc6=utils[_0xf180('0xe')](_0x496e65);return squel[_0xf180('0x8')]()[_0xf180('0xc')](_0x115b86[_0xf180('0x1a')],'i')[_0xf180('0x13')](_0xf180('0x1b'),'c',_0xf180('0x1c'))[_0xf180('0x13')](_0xf180('0x1d'),'o',_0xf180('0x1e'))[_0xf180('0x13')](_0x115b86['accounts'],'a',_0xf180('0x1f')+_0x492c22)[_0xf180('0x13')](_0x115b86['messages'],'me',_0xf180('0x20')+_0x14ddc6+'\x20=\x20i.id')[_0xf180('0x13')](_0x115b86['interactionsTags'],'it',_0xf180('0x21')+_0x14ddc6+_0xf180('0x22'))['left_join']('tools_tags','t',_0xf180('0x23'));}function getSqlClauses(){var _0x932e29={'body':squel['expr'](),'contact':squel[_0xf180('0x24')](),'default':squel[_0xf180('0x24')](),'fields':squel[_0xf180('0x24')](),'filter':squel[_0xf180('0x24')](),'read':squel[_0xf180('0x24')](),'tags':{'clause':squel[_0xf180('0x24')](),'ids':null},'user':squel[_0xf180('0x24')]()};return _0x932e29;}function parseTagParameter(_0x806b84){var _0x3d20bc=squel[_0xf180('0x24')]();if(_0x806b84){var _0x4ff4f9=utils[_0xf180('0x25')](_0x806b84);_0x4ff4f9[_0xf180('0x26')](function(_0x151b90){_0x3d20bc['or'](_0xf180('0x27'),'%,'+_0x151b90+',%');});}return _0x3d20bc;}function parseReadParameter(_0x37379c){var _0x2aeee4='';if(_0x37379c){_0x2aeee4=_0xf180('0x28');if(_0x37379c==='1'){_0x2aeee4=_0x2aeee4[_0xf180('0x29')](_0xf180('0x2a'),'=');}else{_0x2aeee4=_0x2aeee4[_0xf180('0x29')]('{OPERATOR}','>');}}return _0x2aeee4;}function parseSearchFilter(_0x323482,_0xe9a66b){var _0x3dc187=squel[_0xf180('0x24')]();if(_0xe9a66b){var _0x466895=_0xe9a66b[_0xf180('0x29')]('\x5c','\x5c\x5c')[_0xf180('0x29')](/'/g,'\x27\x27');if(qs[_0xf180('0x2b')](_0x466895)){_0x3dc187['or'](_0xf180('0x2c'),_0x466895+'%');if([_0xf180('0x2d'),_0xf180('0x2e')][_0xf180('0x2f')](_0x323482)){_0x3dc187['or'](_0xf180('0x30'),_0x466895+'%');}else if(_0x323482===_0xf180('0x31')){_0x3dc187['or']('i.fax\x20LIKE\x20?',_0x466895+'%');}else if(_0x323482===_0xf180('0x32')){_0x3dc187['or'](_0xf180('0x33'),_0x466895+'%');}}else if(_0x323482==='mail'&&qs[_0xf180('0x34')](_0x466895)){_0x3dc187['or']('c.email\x20LIKE\x20?',_0x466895+'%');}else{if(_0x323482===_0xf180('0x35')){_0x3dc187['or'](_0xf180('0x36'),qs[_0xf180('0x37')](_0x466895))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf180('0x37')](_0x466895));}else{if(_0x323482!==_0xf180('0x31')){_0x3dc187['or'](_0xf180('0x38'),qs[_0xf180('0x37')](_0x466895));}_0x3dc187['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x466895+'%');}}}return _0x3dc187;}function parseAdvancedSearchFilter(_0xc5ec8a,_0x217813){var _0x438d2c=getSqlClauses();var _0x2e8830=as[_0xf180('0x39')](_0xc5ec8a);var _0xc73271=_0x2e8830[_0xf180('0x3a')];for(var _0x1eb817=0x0;_0x1eb817<_0x2e8830[_0xf180('0x3b')][_0xf180('0x15')];_0x1eb817++){var _0x50d5c5=_0x2e8830[_0xf180('0x3b')][_0x1eb817];var _0x4ac1b1='i';var _0x553587=_[_0xf180('0x3c')](_0x217813,['name',_0x50d5c5['field']]);if(_0x553587){var _0x3f8313=as[_0xf180('0x3d')](_0x4ac1b1,_0x553587[_0xf180('0x3e')],_0x50d5c5);_0x438d2c[_0xf180('0x3f')][_0xc73271](_0x3f8313['text'],_0x3f8313['value'][_0xf180('0x40')],_0x3f8313['value'][_0xf180('0x41')]);}else{switch(_0x50d5c5['field']){case _0xf180('0x42'):var _0x2c2a1f=parseReadParameter(_0x50d5c5[_0xf180('0x43')]);_0x438d2c[_0xf180('0x44')][_0xf180('0x45')](_0x2c2a1f);break;case _0xf180('0x46'):if(_0x50d5c5[_0xf180('0x47')]===_0xf180('0x48')){if(_0x50d5c5[_0xf180('0x43')]['split']('\x20')[_0xf180('0x15')]>0x1){_0x438d2c[_0xf180('0x49')][_0xc73271]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf180('0x37')](_0x50d5c5[_0xf180('0x43')]),null);}else{var _0x38ba6d='%'+_0x50d5c5[_0xf180('0x43')]+'%';_0x438d2c['contact'][_0xc73271](_0xf180('0x4a'),_0x38ba6d,_0x38ba6d,_0x38ba6d);}}else{_0x553587=_['find'](_0x217813,[_0xf180('0xa'),_0xf180('0x4b')]);_0x50d5c5[_0xf180('0x9')]=_0xf180('0x4b');_0x3f8313=as['buildExpression'](_0x4ac1b1,_0x553587['type'],_0x50d5c5);_0x438d2c[_0xf180('0x49')][_0xc73271](_0x3f8313[_0xf180('0x4c')],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);}break;case _0xf180('0x4d'):var _0x2cf9c1=_0x50d5c5[_0xf180('0x43')][_0xf180('0x4e')](',')['map'](function(_0x1c4821){return Number(_0x1c4821);});var _0x5311c6=parseTagParameter(_0x2cf9c1);_0x438d2c[_0xf180('0x4f')][_0xf180('0x50')][_0xf180('0x45')](_0x5311c6);_0x438d2c['tags'][_0xf180('0x51')]=_0x2cf9c1;break;case _0xf180('0x52'):if(_0x50d5c5['operator']===_0xf180('0x48')){_0x438d2c[_0xf180('0x53')][_0xc73271](_0xf180('0x54'),'%'+_0x50d5c5[_0xf180('0x43')]+'%',null);}else{_0x553587=_[_0xf180('0x3c')](_0x217813,[_0xf180('0xa'),_0xf180('0x55')]);_0x50d5c5[_0xf180('0x9')]=_0xf180('0x55');_0x3f8313=as[_0xf180('0x3d')](_0x4ac1b1,_0x553587[_0xf180('0x3e')],_0x50d5c5);_0x438d2c[_0xf180('0x53')][_0xc73271](_0x3f8313[_0xf180('0x4c')],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);}break;case _0xf180('0x56'):case _0xf180('0x57'):_0x3f8313=as[_0xf180('0x3d')]('me',null,_0x50d5c5);_0x438d2c['body'][_0xc73271](_0x3f8313['text'],_0x3f8313[_0xf180('0x43')][_0xf180('0x40')],_0x3f8313[_0xf180('0x43')][_0xf180('0x41')]);break;}}}return _0x438d2c;}function parseModelFields(_0x1915b4,_0x30e469,_0x1acc63){var _0x177c6d=utils[_0xf180('0x6')](_0x1915b4);var _0x441e90=squel[_0xf180('0x24')]();var _0x16bc09=_(_0x30e469)[_0xf180('0x58')]()[_0xf180('0x18')](function(_0x42c9dd){return _['some'](_0x1acc63,[_0xf180('0xa'),_0x42c9dd])?_0x42c9dd:undefined;})[_0xf180('0x59')]()['value']();if(_0x16bc09[_0xf180('0x15')]>0x0){_0x16bc09[_0xf180('0x26')](function(_0x4379af){if(_0x4379af===_0x177c6d){_0x441e90[_0xf180('0x45')]('i.'+_0x177c6d+_0xf180('0x17'),[][_0xf180('0x5a')](_0x30e469[_0x4379af]));}else if(_0x4379af===_0xf180('0x5b')){var _0x639114=JSON[_0xf180('0x5c')](_0x30e469[_0x4379af])[_0xf180('0x5d')];var _0x1e2be5=JSON[_0xf180('0x5c')](_0x30e469[_0x4379af])['$lte'];_0x441e90[_0xf180('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x639114,_0x1e2be5);}else{if(_0x30e469[_0x4379af]===_0xf180('0x5e')){_0x441e90['and']('i.'+_0x4379af+'\x20IS\x20NULL');}else{_0x441e90['and']('i.'+_0x4379af+'\x20=\x20?',_0x30e469[_0x4379af]);}}});}return _0x441e90;}function parseQueryParameters(_0x225c82,_0x3e0e1a,_0x579d14){var _0x242c69=getSqlClauses();return Promise[_0xf180('0x5f')]()['then'](function(){return parseModelFields(_0x225c82,_0x3e0e1a,_0x579d14);})[_0xf180('0x60')](function(_0x5b4f70){_0x242c69['fields']['and'](_0x5b4f70);return parseReadParameter(_0x3e0e1a[_0xf180('0x44')]);})[_0xf180('0x60')](function(_0x26a748){_0x242c69['read'][_0xf180('0x45')](_0x26a748);return parseTagParameter(_0x3e0e1a[_0xf180('0x61')]);})[_0xf180('0x60')](function(_0x44f63){_0x242c69[_0xf180('0x4f')]['clause'][_0xf180('0x45')](_0x44f63);return parseSearchFilter(_0x225c82,_0x3e0e1a[_0xf180('0x62')]);})['then'](function(_0x2f4899){_0x242c69[_0xf180('0x62')]=_0x2f4899;return _0x242c69;});}function checkAccountsRestrictions(_0x2d3ce7,_0xfaaa96,_0x20077a){var _0x516365=utils[_0xf180('0x6')](_0x2d3ce7);var _0x3edc18=_0xf180('0x63')+_[_0xf180('0x64')](_0x2d3ce7)+(_0x2d3ce7==='chat'?_0xf180('0x65'):_0xf180('0x66'));var _0x35897=squel[_0xf180('0x24')]();return Promise[_0xf180('0x5f')]()['then'](function(){if(_0x20077a[_0xf180('0x7')]&&_0xfaaa96['role']===_0xf180('0x67')){return _0xfaaa96[_0x3edc18]({'attributes':['id'],'raw':!![]});}})[_0xf180('0x60')](function(_0x496b94){if(_0x496b94){if(_0x496b94['length']===0x0){_0x35897['and']('i.'+_0x516365+_0xf180('0x68'));}else{_0x35897[_0xf180('0x45')]('i.'+_0x516365+_0xf180('0x17'),_[_0xf180('0x18')](_0x496b94,'id'));}}else if(!_0x20077a[_0x516365]){_0x35897[_0xf180('0x45')]('i.'+_0x516365+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x35897;});}function getClosedOrderClause(_0x343e3f,_0x4e8f46){var _0x348984='';var _0xdb28d=[_0xf180('0x69'),_0xf180('0x6a'),_0xf180('0x6b')];if(_0x343e3f===_0xf180('0x35')){_0xdb28d[_0xf180('0x6c')]('i.substatus');}if(_0x4e8f46[_0xf180('0x6d')]==='0'&&_0x343e3f===_0xf180('0x35')){_0x348984=_0xf180('0x6e');}else{if(_0x4e8f46['closed']==='1'){_0xdb28d[_0xf180('0x6f')]();}_0x348984=_0xf180('0x70')+_0xdb28d[_0xf180('0x71')](',\x20')+')';}return _0x348984;}function getFilteredInteractions(_0x5874aa,_0x31fc7e,_0x4269e2,_0x41fde4){var _0x321136=utils[_0xf180('0xe')](_0x5874aa);var _0x523d14=_[_0xf180('0x64')](_0x5874aa)+_0xf180('0x72');var _0x2ff5d1=[];var _0x5841b0=getTagsQuery();var _0x1ff9a1={'type':db[_0xf180('0x73')]['QueryTypes'][_0xf180('0x74')],'raw':!![]};var _0x4bd8b6=[];var _0x4157be=[];return db[_0xf180('0x75')]['query'](_0x5841b0[_0xf180('0x76')](),_0x1ff9a1)[_0xf180('0x60')](function(_0x2ac72b){_0x2ff5d1=_[_0xf180('0x77')](_0x2ac72b,'id');_0x1ff9a1=_[_0xf180('0x78')](_0x1ff9a1,{'model':db[_0x523d14],'mapToModel':!![],'nest':!![]});if(_0x4269e2[_0xf180('0x79')]){_0x41fde4['attributes']['forEach'](function(_0xfa796a){_0x31fc7e[_0xf180('0x9')]('i.'+_0xfa796a);});}else{_0x31fc7e[_0xf180('0x9')](_0xf180('0x7a'),_0xf180('0x42'));_0x31fc7e[_0xf180('0x9')]('a.key',_0xf180('0x7b'));_0x31fc7e[_0xf180('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0x5874aa===_0xf180('0x35')){_0x31fc7e['field']('a.email','Account.email');_0x31fc7e[_0xf180('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','contactName');_0x31fc7e[_0xf180('0x9')](_0xf180('0x7c'));_0x31fc7e['field'](_0xf180('0x7d'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x7e'));_0x31fc7e['field'](_0xf180('0x7f'));_0x31fc7e[_0xf180('0x9')]('i.closedAt');_0x31fc7e[_0xf180('0x9')]('i.attach');_0x31fc7e[_0xf180('0x9')](_0xf180('0x80'));_0x31fc7e['field']('i.lastMsgDirection');_0x31fc7e[_0xf180('0x9')](_0xf180('0x81'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x6b'));_0x31fc7e[_0xf180('0x9')]('i.secondDisposition');_0x31fc7e['field'](_0xf180('0x69'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x6e'));_0x31fc7e['field']('i.to');_0x31fc7e[_0xf180('0x9')]('i.ContactId');_0x31fc7e[_0xf180('0x9')](_0xf180('0x82'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x83'));}else if(_0x5874aa==='openchannel'){_0x31fc7e[_0xf180('0x9')](_0xf180('0x84'),_0xf180('0x85'));}else{_0x31fc7e[_0xf180('0x9')](_0xf180('0x86'),_0xf180('0x85'));}if(_0x5874aa!=='mail'){_0x31fc7e[_0xf180('0x9')](_0xf180('0x87'));}_0x31fc7e[_0xf180('0x9')](_0xf180('0x88'),_0xf180('0x89'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x8a'),_0xf180('0x8b'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x8c'),'Contact.email');_0x31fc7e[_0xf180('0x9')](_0xf180('0x8d'),_0xf180('0x8e'));_0x31fc7e[_0xf180('0x9')]('c.mobile','Contact.mobile');_0x31fc7e[_0xf180('0x9')](_0xf180('0x8f'),_0xf180('0x90'));_0x31fc7e['field'](_0xf180('0x91'),_0xf180('0x92'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x93'),_0xf180('0x94'));_0x31fc7e[_0xf180('0x9')](_0xf180('0x95'),_0xf180('0x96'));}if(_0x41fde4[_0xf180('0x97')]){_0x31fc7e[_0xf180('0x97')](_0x41fde4[_0xf180('0x97')]);}if(_0x41fde4[_0xf180('0x98')]){_0x31fc7e[_0xf180('0x98')](_0x41fde4[_0xf180('0x98')]);}return db[_0xf180('0x75')]['query'](_0x31fc7e[_0xf180('0x76')](),_0x1ff9a1);})[_0xf180('0x60')](function(_0x5f811){_0x4bd8b6=_0x5f811;var _0x504850=getUsersQuery(_0x5874aa,_0x4bd8b6);return db[_0xf180('0x75')]['query'](_0x504850[_0xf180('0x76')](),_0x1ff9a1);})['then'](function(_0x3116c0){_0x4157be=_['groupBy'](_0x3116c0,_0x321136);if(_0x5874aa===_0xf180('0x35')){return db[_0xf180('0x99')][_0xf180('0x9a')]({'attributes':[_0xf180('0x9b')],'raw':!![]});}})[_0xf180('0x60')](function(_0x19db8a){var _0x43c975=_0x19db8a?_0x19db8a[_0xf180('0x9b')]:undefined;var _0xb7f21=_0x4bd8b6[_0xf180('0x18')](function(_0x27f527){return updateInteraction(_0x27f527,_0x2ff5d1,_0x4157be,_0x43c975);});return Promise[_0xf180('0x9c')](_0xb7f21);});}function countFilteredInteractions(_0xd67b4d,_0x2e64ff){var _0x2ee13e=_0xd67b4d['clone']();_0x2ee13e[_0xf180('0x9')]('COUNT(*)');_0x2ee13e[_0xf180('0x9')](_0xf180('0x7a'),_0xf180('0x42'));var _0x34230b=utils[_0xf180('0x25')](_0x2e64ff);if(!_[_0xf180('0x9d')](_0x34230b)){_0x2ee13e[_0xf180('0x16')](_0xf180('0x9e'),_0x34230b);}var _0x280201={'type':db[_0xf180('0x73')]['QueryTypes'][_0xf180('0x74')],'raw':!![]};return db[_0xf180('0x75')][_0xf180('0x9f')](_0x2ee13e[_0xf180('0x76')](),_0x280201);}module[_0xf180('0xa0')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xc6d8=['QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','lodash','../parsers/advancedSearch','./update-interaction','./utils','getAccountFK','role','agent','select','field','color','from','tools_tags','getInteractionFK','user_has_','u.id','u.fullname','ui.','left_join','users','length','map','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.','messages','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','default','text','start','value','end','unreadMessages','read','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','clause','and','tags','ids','User','UserId','plainBody','body','some','compact','\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','then','fields','tag','filter','get','capitalize','Websites','search','\x20IS\x20NOT\x20NULL','i.secondDisposition','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction'];(function(_0x3e7627,_0x123b27){var _0x5be59b=function(_0x172575){while(--_0x172575){_0x3e7627['push'](_0x3e7627['shift']());}};_0x5be59b(++_0x123b27);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x458a20,_0x206f85){_0x458a20=_0x458a20-0x0;var _0x3cce8a=_0xc6d8[_0x458a20];return _0x3cce8a;};'use strict';var _=require(_0x8c6d('0x0'));var squel=require('squel');var as=require(_0x8c6d('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x8c6d('0x2'))['updateInteraction'];var utils=require(_0x8c6d('0x3'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x5b6b04,_0x352b8c,_0xdff6f){var _0x17781d=![];var _0x4f5e8f=utils[_0x8c6d('0x4')](_0x5b6b04);if(_0x352b8c[_0x8c6d('0x5')]===_0x8c6d('0x6')&&!_0xdff6f['search']&&!_0xdff6f[_0x4f5e8f]){_0x17781d=!![];}return _0x17781d;}function getTagsQuery(){return squel[_0x8c6d('0x7')]()[_0x8c6d('0x8')]('id')[_0x8c6d('0x8')]('name')[_0x8c6d('0x8')](_0x8c6d('0x9'))[_0x8c6d('0xa')](_0x8c6d('0xb'));}function getUsersQuery(_0x426a82,_0x43a7ab){var _0x60cd5c=utils[_0x8c6d('0xc')](_0x426a82);var _0x50af75=_0x8c6d('0xd')+_0x426a82+'_interactions';var _0x4c0878=squel[_0x8c6d('0x7')]()[_0x8c6d('0x8')](_0x8c6d('0xe'))[_0x8c6d('0x8')](_0x8c6d('0xf'))[_0x8c6d('0x8')](_0x8c6d('0x10')+_0x60cd5c)[_0x8c6d('0xa')](_0x50af75,'ui')[_0x8c6d('0x11')](_0x8c6d('0x12'),'u','u.id\x20=\x20ui.UserId');if(_0x43a7ab[_0x8c6d('0x13')]>0x0){_0x4c0878['where'](_0x8c6d('0x10')+_0x60cd5c+'\x20IN\x20?',_[_0x8c6d('0x14')](_0x43a7ab,'id'));}return _0x4c0878;}function getInteractionsQuery(_0x3d95a6){var _0x52ed7b=utils[_0x8c6d('0x15')](_0x3d95a6);var _0x2b8a26=utils['getAccountFK'](_0x3d95a6);var _0x3e5495=utils['getInteractionFK'](_0x3d95a6);return squel['select']()[_0x8c6d('0xa')](_0x52ed7b['interactions'],'i')[_0x8c6d('0x11')](_0x8c6d('0x16'),'c',_0x8c6d('0x17'))[_0x8c6d('0x11')](_0x8c6d('0x12'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x52ed7b['accounts'],'a',_0x8c6d('0x18')+_0x2b8a26)['left_join'](_0x52ed7b[_0x8c6d('0x19')],'me','me.'+_0x3e5495+'\x20=\x20i.id')[_0x8c6d('0x11')](_0x52ed7b[_0x8c6d('0x1a')],'it','it.'+_0x3e5495+'\x20=\x20i.id')['left_join']('tools_tags','t',_0x8c6d('0x1b'));}function getSqlClauses(){var _0xd16c91={'body':squel[_0x8c6d('0x1c')](),'contact':squel['expr'](),'default':squel[_0x8c6d('0x1c')](),'fields':squel['expr'](),'filter':squel[_0x8c6d('0x1c')](),'read':squel['expr'](),'tags':{'clause':squel[_0x8c6d('0x1c')](),'ids':null},'user':squel[_0x8c6d('0x1c')]()};return _0xd16c91;}function parseTagParameter(_0x353ba5){var _0x2b6d18=squel[_0x8c6d('0x1c')]();if(_0x353ba5){var _0x3e3cd3=utils[_0x8c6d('0x1d')](_0x353ba5);_0x3e3cd3[_0x8c6d('0x1e')](function(_0x3eab38){_0x2b6d18['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3eab38+',%');});}return _0x2b6d18;}function parseReadParameter(_0x544143){var _0x342d8e='';if(_0x544143){_0x342d8e=_0x8c6d('0x1f');if(_0x544143==='1'){_0x342d8e=_0x342d8e[_0x8c6d('0x20')](_0x8c6d('0x21'),'=');}else{_0x342d8e=_0x342d8e[_0x8c6d('0x20')](_0x8c6d('0x21'),'>');}}return _0x342d8e;}function parseSearchFilter(_0x2bc94a,_0x2d028f){var _0x407234=squel[_0x8c6d('0x1c')]();if(_0x2d028f){var _0x3375dd=_0x2d028f[_0x8c6d('0x20')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8c6d('0x22')](_0x3375dd)){_0x407234['or'](_0x8c6d('0x23'),_0x3375dd+'%');if([_0x8c6d('0x24'),_0x8c6d('0x25')][_0x8c6d('0x26')](_0x2bc94a)){_0x407234['or'](_0x8c6d('0x27'),_0x3375dd+'%');}else if(_0x2bc94a===_0x8c6d('0x28')){_0x407234['or'](_0x8c6d('0x29'),_0x3375dd+'%');}else if(_0x2bc94a===_0x8c6d('0x2a')){_0x407234['or']('i.from\x20LIKE\x20?',_0x3375dd+'%');}}else if(_0x2bc94a===_0x8c6d('0x2b')&&qs['isEmail'](_0x3375dd)){_0x407234['or'](_0x8c6d('0x2c'),_0x3375dd+'%');}else{if(_0x2bc94a===_0x8c6d('0x2b')){_0x407234['or'](_0x8c6d('0x2d'),qs[_0x8c6d('0x2e')](_0x3375dd))['or'](_0x8c6d('0x2f'),qs[_0x8c6d('0x2e')](_0x3375dd));}else{if(_0x2bc94a!=='fax'){_0x407234['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8c6d('0x2e')](_0x3375dd));}_0x407234['or'](_0x8c6d('0x30'),_0x3375dd+'%');}}}return _0x407234;}function parseAdvancedSearchFilter(_0x3df42f,_0x8b4562){var _0x5638f4=getSqlClauses();var _0x2818fa=as[_0x8c6d('0x31')](_0x3df42f);var _0xdc33f5=_0x2818fa[_0x8c6d('0x32')];for(var _0x42a92e=0x0;_0x42a92e<_0x2818fa[_0x8c6d('0x33')]['length'];_0x42a92e++){var _0x3c16d3=_0x2818fa[_0x8c6d('0x33')][_0x42a92e];var _0x1349be='i';var _0x2ef932=_[_0x8c6d('0x34')](_0x8b4562,[_0x8c6d('0x35'),_0x3c16d3[_0x8c6d('0x8')]]);if(_0x2ef932){var _0x301332=as[_0x8c6d('0x36')](_0x1349be,_0x2ef932[_0x8c6d('0x37')],_0x3c16d3);_0x5638f4[_0x8c6d('0x38')][_0xdc33f5](_0x301332[_0x8c6d('0x39')],_0x301332['value'][_0x8c6d('0x3a')],_0x301332[_0x8c6d('0x3b')][_0x8c6d('0x3c')]);}else{switch(_0x3c16d3[_0x8c6d('0x8')]){case _0x8c6d('0x3d'):var _0x4e7cb7=parseReadParameter(_0x3c16d3[_0x8c6d('0x3b')]);_0x5638f4[_0x8c6d('0x3e')]['and'](_0x4e7cb7);break;case _0x8c6d('0x3f'):if(_0x3c16d3[_0x8c6d('0x40')]===_0x8c6d('0x41')){if(_0x3c16d3['value'][_0x8c6d('0x42')]('\x20')[_0x8c6d('0x13')]>0x1){_0x5638f4[_0x8c6d('0x43')][_0xdc33f5](_0x8c6d('0x44'),qs[_0x8c6d('0x2e')](_0x3c16d3[_0x8c6d('0x3b')]),null);}else{var _0x305910='%'+_0x3c16d3[_0x8c6d('0x3b')]+'%';_0x5638f4[_0x8c6d('0x43')][_0xdc33f5](_0x8c6d('0x45'),_0x305910,_0x305910,_0x305910);}}else{_0x2ef932=_[_0x8c6d('0x34')](_0x8b4562,['name','ContactId']);_0x3c16d3['field']=_0x8c6d('0x46');_0x301332=as[_0x8c6d('0x36')](_0x1349be,_0x2ef932[_0x8c6d('0x37')],_0x3c16d3);_0x5638f4[_0x8c6d('0x43')][_0xdc33f5](_0x301332[_0x8c6d('0x39')],_0x301332['value'][_0x8c6d('0x3a')],_0x301332[_0x8c6d('0x3b')][_0x8c6d('0x3c')]);}break;case'Tag':var _0xf8d466=_0x3c16d3[_0x8c6d('0x3b')]['split'](',')['map'](function(_0x4bd626){return Number(_0x4bd626);});var _0x5d598d=parseTagParameter(_0xf8d466);_0x5638f4['tags'][_0x8c6d('0x47')][_0x8c6d('0x48')](_0x5d598d);_0x5638f4[_0x8c6d('0x49')][_0x8c6d('0x4a')]=_0xf8d466;break;case _0x8c6d('0x4b'):if(_0x3c16d3['operator']==='$substring'){_0x5638f4['user'][_0xdc33f5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3c16d3[_0x8c6d('0x3b')]+'%',null);}else{_0x2ef932=_['find'](_0x8b4562,[_0x8c6d('0x35'),_0x8c6d('0x4c')]);_0x3c16d3[_0x8c6d('0x8')]=_0x8c6d('0x4c');_0x301332=as[_0x8c6d('0x36')](_0x1349be,_0x2ef932[_0x8c6d('0x37')],_0x3c16d3);_0x5638f4['user'][_0xdc33f5](_0x301332[_0x8c6d('0x39')],_0x301332[_0x8c6d('0x3b')]['start'],_0x301332[_0x8c6d('0x3b')][_0x8c6d('0x3c')]);}break;case'body':case _0x8c6d('0x4d'):_0x301332=as[_0x8c6d('0x36')]('me',null,_0x3c16d3);_0x5638f4[_0x8c6d('0x4e')][_0xdc33f5](_0x301332[_0x8c6d('0x39')],_0x301332[_0x8c6d('0x3b')][_0x8c6d('0x3a')],_0x301332[_0x8c6d('0x3b')][_0x8c6d('0x3c')]);break;}}}return _0x5638f4;}function parseModelFields(_0x1f1609,_0x1d6c29,_0x361956){var _0x23792d=utils[_0x8c6d('0x4')](_0x1f1609);var _0x10bfad=squel[_0x8c6d('0x1c')]();var _0x337e37=_(_0x1d6c29)['keys']()['map'](function(_0x5be031){return _[_0x8c6d('0x4f')](_0x361956,[_0x8c6d('0x35'),_0x5be031])?_0x5be031:undefined;})[_0x8c6d('0x50')]()[_0x8c6d('0x3b')]();if(_0x337e37['length']>0x0){_0x337e37[_0x8c6d('0x1e')](function(_0x5972db){if(_0x5972db===_0x23792d){_0x10bfad[_0x8c6d('0x48')]('i.'+_0x23792d+_0x8c6d('0x51'),[][_0x8c6d('0x52')](_0x1d6c29[_0x5972db]));}else if(_0x5972db==='createdAt'){var _0xc4e1a0=JSON['parse'](_0x1d6c29[_0x5972db])[_0x8c6d('0x53')];var _0x4c4ad1=JSON[_0x8c6d('0x54')](_0x1d6c29[_0x5972db])[_0x8c6d('0x55')];_0x10bfad[_0x8c6d('0x48')](_0x8c6d('0x56'),_0xc4e1a0,_0x4c4ad1);}else{if(_0x1d6c29[_0x5972db]==='null'){_0x10bfad[_0x8c6d('0x48')]('i.'+_0x5972db+_0x8c6d('0x57'));}else{_0x10bfad[_0x8c6d('0x48')]('i.'+_0x5972db+_0x8c6d('0x58'),_0x1d6c29[_0x5972db]);}}});}return _0x10bfad;}function parseQueryParameters(_0x309396,_0x219a8b,_0x159d36){var _0x11a87b=getSqlClauses();return Promise['resolve']()[_0x8c6d('0x59')](function(){return parseModelFields(_0x309396,_0x219a8b,_0x159d36);})[_0x8c6d('0x59')](function(_0x82aab){_0x11a87b[_0x8c6d('0x5a')]['and'](_0x82aab);return parseReadParameter(_0x219a8b[_0x8c6d('0x3e')]);})['then'](function(_0x5c8550){_0x11a87b[_0x8c6d('0x3e')][_0x8c6d('0x48')](_0x5c8550);return parseTagParameter(_0x219a8b[_0x8c6d('0x5b')]);})[_0x8c6d('0x59')](function(_0xbbd13c){_0x11a87b[_0x8c6d('0x49')][_0x8c6d('0x47')]['and'](_0xbbd13c);return parseSearchFilter(_0x309396,_0x219a8b[_0x8c6d('0x5c')]);})[_0x8c6d('0x59')](function(_0x3af565){_0x11a87b['filter']=_0x3af565;return _0x11a87b;});}function checkAccountsRestrictions(_0x445d56,_0x2b9717,_0x30e32f){var _0x26bb3c=utils[_0x8c6d('0x4')](_0x445d56);var _0x53a333=_0x8c6d('0x5d')+_[_0x8c6d('0x5e')](_0x445d56)+(_0x445d56==='chat'?_0x8c6d('0x5f'):'Accounts');var _0x3d7071=squel['expr']();return Promise['resolve']()[_0x8c6d('0x59')](function(){if(_0x30e32f[_0x8c6d('0x60')]&&_0x2b9717[_0x8c6d('0x5')]===_0x8c6d('0x6')){return _0x2b9717[_0x53a333]({'attributes':['id'],'raw':!![]});}})[_0x8c6d('0x59')](function(_0x3090a9){if(_0x3090a9){if(_0x3090a9[_0x8c6d('0x13')]===0x0){_0x3d7071[_0x8c6d('0x48')]('i.'+_0x26bb3c+_0x8c6d('0x57'));}else{_0x3d7071[_0x8c6d('0x48')]('i.'+_0x26bb3c+_0x8c6d('0x51'),_['map'](_0x3090a9,'id'));}}else if(!_0x30e32f[_0x26bb3c]){_0x3d7071[_0x8c6d('0x48')]('i.'+_0x26bb3c+_0x8c6d('0x61'));}})[_0x8c6d('0x59')](function(){return _0x3d7071;});}function getClosedOrderClause(_0x4c7e3a,_0x334b8e){var _0x1695b3='';var _0x19d781=['i.thirdDisposition',_0x8c6d('0x62'),'i.disposition'];if(_0x4c7e3a===_0x8c6d('0x2b')){_0x19d781['unshift']('i.substatus');}if(_0x334b8e[_0x8c6d('0x63')]==='0'&&_0x4c7e3a===_0x8c6d('0x2b')){_0x1695b3='i.substatus';}else{if(_0x334b8e['closed']==='1'){_0x19d781['shift']();}_0x1695b3=_0x8c6d('0x64')+_0x19d781[_0x8c6d('0x65')](',\x20')+')';}return _0x1695b3;}function getFilteredInteractions(_0x2d9750,_0x194ffc,_0x5e44d7,_0x5d48b8){var _0x3d6804=utils[_0x8c6d('0xc')](_0x2d9750);var _0x276e89=_[_0x8c6d('0x5e')](_0x2d9750)+_0x8c6d('0x66');var _0x455a6d=[];var _0x2d3dd3=getTagsQuery();var _0x3c6a3c={'type':db['Sequelize'][_0x8c6d('0x67')][_0x8c6d('0x68')],'raw':!![]};var _0x1d7be0=[];var _0x361c40=[];return db['sequelize'][_0x8c6d('0x69')](_0x2d3dd3[_0x8c6d('0x6a')](),_0x3c6a3c)['then'](function(_0x2608ac){_0x455a6d=_[_0x8c6d('0x6b')](_0x2608ac,'id');_0x3c6a3c=_[_0x8c6d('0x6c')](_0x3c6a3c,{'model':db[_0x276e89],'mapToModel':!![],'nest':!![]});if(_0x5e44d7['fields']){_0x5d48b8[_0x8c6d('0x6d')][_0x8c6d('0x1e')](function(_0x4861ec){_0x194ffc[_0x8c6d('0x8')]('i.'+_0x4861ec);});}else{_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x6e'),_0x8c6d('0x3d'));_0x194ffc[_0x8c6d('0x8')]('a.key','Account.key');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x6f'),_0x8c6d('0x70'));if(_0x2d9750===_0x8c6d('0x2b')){_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x71'),_0x8c6d('0x72'));_0x194ffc['field'](_0x8c6d('0x73'),_0x8c6d('0x74'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x75'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x76'));_0x194ffc[_0x8c6d('0x8')]('i.updatedAt');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x77'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x78'));_0x194ffc['field'](_0x8c6d('0x79'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x7a'));_0x194ffc[_0x8c6d('0x8')]('i.lastMsgDirection');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x7b'));_0x194ffc['field'](_0x8c6d('0x7c'));_0x194ffc[_0x8c6d('0x8')]('i.secondDisposition');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x7d'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x7e'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x7f'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x80'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x81'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x82'));}else if(_0x2d9750===_0x8c6d('0x2a')){_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x83'),_0x8c6d('0x74'));}else{_0x194ffc[_0x8c6d('0x8')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x8c6d('0x74'));}if(_0x2d9750!==_0x8c6d('0x2b')){_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x84'));}_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x85'),_0x8c6d('0x86'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x87'),_0x8c6d('0x88'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x89'),_0x8c6d('0x8a'));_0x194ffc['field'](_0x8c6d('0x8b'),_0x8c6d('0x8c'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x8d'),'Contact.mobile');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x8e'),_0x8c6d('0x8f'));_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x90'),'Owner.fullname');_0x194ffc[_0x8c6d('0x8')](_0x8c6d('0x91'),'Owner.internal');_0x194ffc['field'](_0x8c6d('0x92'),_0x8c6d('0x93'));}if(_0x5d48b8[_0x8c6d('0x94')]){_0x194ffc[_0x8c6d('0x94')](_0x5d48b8[_0x8c6d('0x94')]);}if(_0x5d48b8[_0x8c6d('0x95')]){_0x194ffc[_0x8c6d('0x95')](_0x5d48b8[_0x8c6d('0x95')]);}return db[_0x8c6d('0x96')][_0x8c6d('0x69')](_0x194ffc[_0x8c6d('0x6a')](),_0x3c6a3c);})['then'](function(_0x5589ff){_0x1d7be0=_0x5589ff;var _0x59b5f8=getUsersQuery(_0x2d9750,_0x1d7be0);return db[_0x8c6d('0x96')][_0x8c6d('0x69')](_0x59b5f8['toString'](),_0x3c6a3c);})[_0x8c6d('0x59')](function(_0x55e00e){_0x361c40=_[_0x8c6d('0x97')](_0x55e00e,_0x3d6804);if(_0x2d9750===_0x8c6d('0x2b')){return db[_0x8c6d('0x98')][_0x8c6d('0x99')]({'attributes':[_0x8c6d('0x9a')],'raw':!![]});}})[_0x8c6d('0x59')](function(_0xc233cb){var _0x5d7717=_0xc233cb?_0xc233cb['enableEmailPreview']:undefined;var _0xc683a3=_0x1d7be0[_0x8c6d('0x14')](function(_0x255b97){return updateInteraction(_0x255b97,_0x455a6d,_0x361c40,_0x5d7717);});return Promise[_0x8c6d('0x9b')](_0xc683a3);});}function countFilteredInteractions(_0x299507,_0x2b9d6b){var _0x2929b5=_0x299507[_0x8c6d('0x9c')]();_0x2929b5[_0x8c6d('0x8')](_0x8c6d('0x9d'));_0x2929b5['field'](_0x8c6d('0x6e'),_0x8c6d('0x3d'));var _0x281ee5=utils[_0x8c6d('0x1d')](_0x2b9d6b);if(!_[_0x8c6d('0x9e')](_0x281ee5)){_0x2929b5['where']('t.id\x20IN\x20?',_0x281ee5);}var _0x39b47c={'type':db['Sequelize']['QueryTypes'][_0x8c6d('0x68')],'raw':!![]};return db[_0x8c6d('0x96')][_0x8c6d('0x69')](_0x2929b5[_0x8c6d('0x6a')](),_0x39b47c);}module['exports']={'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 48e1fa3..5a12341 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 _0x9486=['map','forEach','push','waiting','talking','answered','unmanaged','abandoned','closed','disposition','UserId','total','MailMessage','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','Tags','TagIds','lodash','../../mysqldb'];(function(_0x37e18c,_0x13753c){var _0x1dee91=function(_0x1869ac){while(--_0x1869ac){_0x37e18c['push'](_0x37e18c['shift']());}};_0x1dee91(++_0x13753c);}(_0x9486,0xd6));var _0x6948=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9486[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6948('0x0'));var db=require(_0x6948('0x1'))['db'];function getInteractionUsers(_0x19e7fa,_0x17f5af){return new Promise(function(_0x3c1f52,_0x4b8c7a){try{var _0x4c1350=[];if(_0x17f5af[_0x19e7fa]){_0x4c1350=_0x17f5af[_0x19e7fa][_0x6948('0x2')](function(_0x41a570){return{'id':_0x41a570['id'],'fullname':_0x41a570['fullname']};});}return _0x3c1f52(_0x4c1350);}catch(_0x19910b){_0x4b8c7a(_0x19910b);}});}function getInteractionTags(_0x21a95a,_0x518fba){var _0x355ec7=[];if(_0x21a95a){_0x21a95a['split'](',')[_0x6948('0x3')](function(_0x4811cf){_0x355ec7[_0x6948('0x4')](_0x518fba[_0x4811cf]);});}return _0x355ec7;}function updateWaitingCounter(_0x509727){if(_0x509727[_0x6948('0x5')]){_0x509727[_0x6948('0x5')]-=0x1;}}function updateInteractionCounters(_0x54841d){_0x54841d[_0x6948('0x5')]=0x0;_0x54841d[_0x6948('0x6')]=0x0;_0x54841d[_0x6948('0x7')]=0x0;_0x54841d[_0x6948('0x8')]=0x0;_0x54841d[_0x6948('0x9')]=0x0;_0x54841d['total']=0x0;if(_0x54841d[_0x6948('0xa')]){if(_0x54841d[_0x6948('0xb')]===_0x6948('0x9')){_0x54841d[_0x6948('0x9')]+=0x1;updateWaitingCounter(_0x54841d);}if(_0x54841d[_0x6948('0xc')]){_0x54841d['answered']+=0x1;if(_0x54841d[_0x6948('0x6')]){_0x54841d[_0x6948('0x6')]-=0x1;}}else{if(_0x54841d[_0x6948('0xb')]){_0x54841d[_0x6948('0x8')]+=0x1;updateWaitingCounter(_0x54841d);}}}else{if(!_0x54841d[_0x6948('0xc')]){_0x54841d[_0x6948('0x5')]+=0x1;}if(_0x54841d['UserId']){_0x54841d[_0x6948('0x6')]+=0x1;updateWaitingCounter(_0x54841d);}}_0x54841d[_0x6948('0xd')]+=0x1;return _0x54841d;}function getLastMessageText(_0x54fd34){return db[_0x6948('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x54fd34['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6948('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6948('0x10')],'order':_0x6948('0x11'),'raw':!![]})[_0x6948('0x12')](function(_0x5d8e87){if(_0x5d8e87&&_0x5d8e87[_0x6948('0x10')]){_0x54fd34[_0x6948('0x13')]=_['trimStart'](_0x5d8e87[_0x6948('0x10')]);}return _0x54fd34;})[_0x6948('0x14')](function(_0x4d0cc8){throw _0x4d0cc8;});}exports[_0x6948('0x15')]=function(_0x347de0,_0x1b3183,_0x111f96,_0x23aa42){return new Promise(function(_0x2db72d,_0x8f43a8){return getInteractionUsers(_0x347de0['id'],_0x111f96)[_0x6948('0x12')](function(_0x528c51){_0x347de0['Users']=_0x528c51;return getInteractionTags(_0x347de0['TagIds'],_0x1b3183);})[_0x6948('0x12')](function(_0xf8d33d){_0x347de0[_0x6948('0x16')]=_0xf8d33d;delete _0x347de0[_0x6948('0x17')];return updateInteractionCounters(_0x347de0);})[_0x6948('0x12')](function(_0x2bb898){if(_0x23aa42){return getLastMessageText(_0x2bb898);}else{return _0x2bb898;}})[_0x6948('0x12')](function(_0x798fb2){_0x2db72d(_0x798fb2);})[_0x6948('0x14')](function(_0x4cd685){_0x8f43a8(_0x4cd685);});});}; \ No newline at end of file +var _0xcbe2=['Tags','TagIds','../../mysqldb','map','fullname','split','forEach','waiting','talking','unmanaged','closed','disposition','abandoned','UserId','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','updateInteraction','Users'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xcbe2,0xc2));var _0x2cbe=function(_0x1b6b8d,_0x59e58b){_0x1b6b8d=_0x1b6b8d-0x0;var _0xf49704=_0xcbe2[_0x1b6b8d];return _0xf49704;};'use strict';var _=require('lodash');var db=require(_0x2cbe('0x0'))['db'];function getInteractionUsers(_0x3af566,_0x558d8d){return new Promise(function(_0x560aa9,_0x29d5af){try{var _0x296616=[];if(_0x558d8d[_0x3af566]){_0x296616=_0x558d8d[_0x3af566][_0x2cbe('0x1')](function(_0x5d77c3){return{'id':_0x5d77c3['id'],'fullname':_0x5d77c3[_0x2cbe('0x2')]};});}return _0x560aa9(_0x296616);}catch(_0x17d2fe){_0x29d5af(_0x17d2fe);}});}function getInteractionTags(_0x1b08c9,_0x579c64){var _0x24a5fb=[];if(_0x1b08c9){_0x1b08c9[_0x2cbe('0x3')](',')[_0x2cbe('0x4')](function(_0x5b6b7e){_0x24a5fb['push'](_0x579c64[_0x5b6b7e]);});}return _0x24a5fb;}function updateWaitingCounter(_0x39b883){if(_0x39b883[_0x2cbe('0x5')]){_0x39b883[_0x2cbe('0x5')]-=0x1;}}function updateInteractionCounters(_0x14dd4b){_0x14dd4b['waiting']=0x0;_0x14dd4b[_0x2cbe('0x6')]=0x0;_0x14dd4b['answered']=0x0;_0x14dd4b[_0x2cbe('0x7')]=0x0;_0x14dd4b['abandoned']=0x0;_0x14dd4b['total']=0x0;if(_0x14dd4b[_0x2cbe('0x8')]){if(_0x14dd4b[_0x2cbe('0x9')]===_0x2cbe('0xa')){_0x14dd4b[_0x2cbe('0xa')]+=0x1;updateWaitingCounter(_0x14dd4b);}if(_0x14dd4b[_0x2cbe('0xb')]){_0x14dd4b['answered']+=0x1;if(_0x14dd4b['talking']){_0x14dd4b[_0x2cbe('0x6')]-=0x1;}}else{if(_0x14dd4b['disposition']){_0x14dd4b[_0x2cbe('0x7')]+=0x1;updateWaitingCounter(_0x14dd4b);}}}else{if(!_0x14dd4b[_0x2cbe('0xb')]){_0x14dd4b['waiting']+=0x1;}if(_0x14dd4b[_0x2cbe('0xb')]){_0x14dd4b[_0x2cbe('0x6')]+=0x1;updateWaitingCounter(_0x14dd4b);}}_0x14dd4b['total']+=0x1;return _0x14dd4b;}function getLastMessageText(_0x28ec65){return db[_0x2cbe('0xc')][_0x2cbe('0xd')]({'where':{'$and':[{'MailInteractionId':_0x28ec65['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2cbe('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2cbe('0xf')],'order':'-id','raw':!![]})[_0x2cbe('0x10')](function(_0x33d2db){if(_0x33d2db&&_0x33d2db[_0x2cbe('0xf')]){_0x28ec65[_0x2cbe('0x11')]=_[_0x2cbe('0x12')](_0x33d2db['plainBody']);}return _0x28ec65;})[_0x2cbe('0x13')](function(_0x687ebb){throw _0x687ebb;});}exports[_0x2cbe('0x14')]=function(_0x379dd5,_0x39dc45,_0x3d0135,_0x48f97d){return new Promise(function(_0x4b4f2b,_0x4dd56d){return getInteractionUsers(_0x379dd5['id'],_0x3d0135)[_0x2cbe('0x10')](function(_0x3b0f55){_0x379dd5[_0x2cbe('0x15')]=_0x3b0f55;return getInteractionTags(_0x379dd5['TagIds'],_0x39dc45);})[_0x2cbe('0x10')](function(_0x233a57){_0x379dd5[_0x2cbe('0x16')]=_0x233a57;delete _0x379dd5[_0x2cbe('0x17')];return updateInteractionCounters(_0x379dd5);})['then'](function(_0x4ad0c4){if(_0x48f97d){return getLastMessageText(_0x4ad0c4);}else{return _0x4ad0c4;}})[_0x2cbe('0x10')](function(_0x5324de){_0x4b4f2b(_0x5324de);})[_0x2cbe('0x13')](function(_0x224647){_0x4dd56d(_0x224647);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d143ed3..ed42cf2 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 _0xe965=['_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','then','update','info','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','chat','Account','capitalize','InteractionId','upperFirst','unknown','websites','_interactions'];(function(_0x3fb067,_0xafdf1e){var _0x28fb3a=function(_0x43d65a){while(--_0x43d65a){_0x3fb067['push'](_0x3fb067['shift']());}};_0x28fb3a(++_0xafdf1e);}(_0xe965,0x15d));var _0x5e96=function(_0x163c37,_0x42ca0c){_0x163c37=_0x163c37-0x0;var _0x412ce2=_0xe965[_0x163c37];return _0x412ce2;};'use strict';var _=require(_0x5e96('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x5e96('0x1'))(_0x5e96('0x2')),'mail':require(_0x5e96('0x1'))(_0x5e96('0x3')),'fax':require(_0x5e96('0x1'))(_0x5e96('0x4')),'sms':require(_0x5e96('0x1'))(_0x5e96('0x5')),'chat':require(_0x5e96('0x1'))(_0x5e96('0x6')),'whatsapp':require(_0x5e96('0x1'))('whatsapp-interactions')};function getAccountFK(_0x4fa2eb){return _['capitalize'](_0x4fa2eb)+(_0x4fa2eb===_0x5e96('0x7')?'Website':_0x5e96('0x8'))+'Id';}function getInteractionFK(_0x56f068){return _[_0x5e96('0x9')](_0x56f068)+_0x5e96('0xa');}function getInteractionId(_0xc37102,_0x325fe5,_0x1e5eac){if(_0xc37102&&_0xc37102[_[_0x5e96('0xb')](_0x1e5eac)+_0x5e96('0xa')]){return _0xc37102[_[_0x5e96('0xb')](_0x1e5eac)+_0x5e96('0xa')];}else if(_0xc37102&&_0xc37102['id']){return _0xc37102['id'];}else if(_0x325fe5&&_0x325fe5['id']){return _0x325fe5['id'];}else{return _0x5e96('0xc');}}function getInteractionsTables(_0x3846cb){return{'accounts':_0x3846cb+'_'+(_0x3846cb===_0x5e96('0x7')?_0x5e96('0xd'):'accounts'),'interactions':_0x3846cb+_0x5e96('0xe'),'interactionsTags':_0x3846cb+_0x5e96('0xf'),'messages':_0x3846cb+_0x5e96('0x10'),'userInteractions':_0x5e96('0x11')+_0x3846cb+_0x5e96('0xe')};}function getSelectedTags(_0x14a692){var _0x27c922=[];if(_0x14a692){_0x27c922=Array['isArray'](_0x14a692)?_0x14a692:[_0x14a692];}return _0x27c922;}function log(_0x5ca774,_0x461537,_0x5b5f37,_0x428d72,_0x57507f,_0x57f835){loggers[_0x57507f[_0x5e96('0x12')]()][_0x5ca774](_0x5e96('0x13'),_0x57f835['toUpperCase'](),_0x461537?_0x461537['id']:null,_0x461537?_0x461537['name']:null,_0x461537?_0x461537[_0x5e96('0x14')]:null,getInteractionId(_0x5b5f37,_0x428d72,_0x57507f),_0x5b5f37?JSON[_0x5e96('0x15')](_0x5b5f37):_0x5e96('0x16'));}function updateUser(_0x10597b,_0x457c48,_0xf45fbb,_0x17d6bb,_0x16c62f){db[_[_0x5e96('0xb')](_0x17d6bb)+_0x5e96('0x17')]['findOne']({'where':{'id':getInteractionId(_0x457c48,_0xf45fbb,_0x17d6bb)}})[_0x5e96('0x18')](function(_0x317636){if(_0x317636){return _0x317636[_0x5e96('0x19')]({'UserId':_0x10597b?_0x10597b['id']:null});}})[_0x5e96('0x18')](function(_0x385c1d){if(_0x385c1d){log(_0x5e96('0x1a'),_0x10597b,_0x457c48,_0xf45fbb,_0x17d6bb,_0x16c62f);}})['catch'](function(){log('error',_0x10597b,_0x457c48,_0xf45fbb,_0x17d6bb,_0x16c62f);});}module[_0x5e96('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x35d9=['chat-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions'];(function(_0x545396,_0x301e2e){var _0x4e3a04=function(_0x4338d8){while(--_0x4338d8){_0x545396['push'](_0x545396['shift']());}};_0x4e3a04(++_0x301e2e);}(_0x35d9,0xae));var _0x935d=function(_0x591695,_0x1d60b4){_0x591695=_0x591695-0x0;var _0x155dc2=_0x35d9[_0x591695];return _0x155dc2;};'use strict';var _=require(_0x935d('0x0'));var db=require(_0x935d('0x1'))['db'];var loggers={'openchannel':require(_0x935d('0x2'))(_0x935d('0x3')),'mail':require(_0x935d('0x2'))(_0x935d('0x4')),'fax':require(_0x935d('0x2'))(_0x935d('0x5')),'sms':require(_0x935d('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x935d('0x6')),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getAccountFK(_0x11c663){return _[_0x935d('0x7')](_0x11c663)+(_0x11c663===_0x935d('0x8')?'Website':_0x935d('0x9'))+'Id';}function getInteractionFK(_0x3f691d){return _[_0x935d('0x7')](_0x3f691d)+_0x935d('0xa');}function getInteractionId(_0x2e2230,_0x260354,_0x3f1696){if(_0x2e2230&&_0x2e2230[_[_0x935d('0xb')](_0x3f1696)+'InteractionId']){return _0x2e2230[_[_0x935d('0xb')](_0x3f1696)+'InteractionId'];}else if(_0x2e2230&&_0x2e2230['id']){return _0x2e2230['id'];}else if(_0x260354&&_0x260354['id']){return _0x260354['id'];}else{return _0x935d('0xc');}}function getInteractionsTables(_0xfb6517){return{'accounts':_0xfb6517+'_'+(_0xfb6517==='chat'?'websites':_0x935d('0xd')),'interactions':_0xfb6517+_0x935d('0xe'),'interactionsTags':_0xfb6517+_0x935d('0xf'),'messages':_0xfb6517+_0x935d('0x10'),'userInteractions':_0x935d('0x11')+_0xfb6517+'_interactions'};}function getSelectedTags(_0xa46a){var _0x50cabc=[];if(_0xa46a){_0x50cabc=Array[_0x935d('0x12')](_0xa46a)?_0xa46a:[_0xa46a];}return _0x50cabc;}function log(_0x4f70ec,_0x1e0059,_0x693bb2,_0xf9cffb,_0x2f85a3,_0x566dad){loggers[_0x2f85a3['toLowerCase']()][_0x4f70ec](_0x935d('0x13'),_0x566dad[_0x935d('0x14')](),_0x1e0059?_0x1e0059['id']:null,_0x1e0059?_0x1e0059[_0x935d('0x15')]:null,_0x1e0059?_0x1e0059[_0x935d('0x16')]:null,getInteractionId(_0x693bb2,_0xf9cffb,_0x2f85a3),_0x693bb2?JSON['stringify'](_0x693bb2):'null');}function updateUser(_0x194c03,_0x36b13b,_0x34b814,_0x29d616,_0x3c75b4){db[_[_0x935d('0xb')](_0x29d616)+_0x935d('0x17')]['findOne']({'where':{'id':getInteractionId(_0x36b13b,_0x34b814,_0x29d616)}})[_0x935d('0x18')](function(_0x1a35f3){if(_0x1a35f3){return _0x1a35f3[_0x935d('0x19')]({'UserId':_0x194c03?_0x194c03['id']:null});}})[_0x935d('0x18')](function(_0x445f79){if(_0x445f79){log(_0x935d('0x1a'),_0x194c03,_0x36b13b,_0x34b814,_0x29d616,_0x3c75b4);}})[_0x935d('0x1b')](function(){log(_0x935d('0x1c'),_0x194c03,_0x36b13b,_0x34b814,_0x29d616,_0x3c75b4);});}module[_0x935d('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 729d6f6..286f40d 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 _0xa40b=['catch','users','admin','user','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','split','createDecipher','aes-256-ctr','format','%s:%s:%s','final','parse','hasOwnProperty','use','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0x23ffc3,_0x547872){var _0x2d691b=function(_0x4801aa){while(--_0x4801aa){_0x23ffc3['push'](_0x23ffc3['shift']());}};_0x2d691b(++_0x547872);}(_0xa40b,0x191));var _0xba40=function(_0xcfcc8,_0x55b335){_0xcfcc8=_0xcfcc8-0x0;var _0x1ce769=_0xa40b[_0xcfcc8];return _0x1ce769;};'use strict';var crypto=require(_0xba40('0x0'));var util=require('util');var compose=require(_0xba40('0x1'));var db=require(_0xba40('0x2'))['db'];var config=require(_0xba40('0x3'));function getValueFromLicense(_0x3fbc11,_0x50de75){if(_0x3fbc11&&_0x50de75){if(_0x50de75['data1']&&_0x50de75['license']){var _0x4429f6=_0x50de75['data1'];var _0x29d92b=_0x50de75['license'];var _0x38cb44=_0x4429f6['split']('-')[0x4];var _0x48a637=_0x4429f6[_0xba40('0x4')]('-')[0x0];var _0x813f6a=crypto[_0xba40('0x5')](_0xba40('0x6'),util[_0xba40('0x7')](_0xba40('0x8'),_0x38cb44,_0x4429f6,_0x48a637));var _0x1a6b7d=_0x813f6a['update'](_0x29d92b,'base64','utf8');_0x1a6b7d+=_0x813f6a[_0xba40('0x9')]('utf8');var _0xc6ea58=JSON[_0xba40('0xa')](_0x1a6b7d);return _0xc6ea58[_0xba40('0xb')](_0x3fbc11)?_0xc6ea58[_0x3fbc11]:null;}}return null;}function isLimit(_0x2524b7,_0xb3c5d3,_0x4e67bf,_0x26ae5a){var _0x5ecafe=_0xb3c5d3;return compose()[_0xba40('0xc')](function(_0x440c0d,_0x4ce4ca,_0x582062){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xba40('0xd')](function(_0x19e676){var _0x38dc2c=getValueFromLicense(_0x2524b7,_0x19e676);return _0x38dc2c?_0x38dc2c:_0x5ecafe;})[_0xba40('0xd')](function(_0x58079d){_0x5ecafe=_0x58079d;return _0x4e67bf['count'](_0x26ae5a);})[_0xba40('0xd')](function(_0xd2ae14){if(_0xd2ae14>=_0x5ecafe){return _0x4ce4ca[_0xba40('0xe')](0x193)[_0xba40('0xf')]({'message':util['format'](_0xba40('0x10'),_0x2524b7)});}_0x582062();})[_0xba40('0x11')](function(_0x53e735){_0x582062(_0x53e735);});});}function isUserLimit(){return isLimit(_0xba40('0x12'),0x1,db['User'],{'where':{'$or':[{'role':_0xba40('0x13')},{'role':_0xba40('0x14')}]}});}exports[_0xba40('0x15')]=isUserLimit; \ No newline at end of file +var _0x00ea=['final','utf8','parse','hasOwnProperty','use','License','findOne','then','status','catch','users','User','admin','user','crypto','util','../../mysqldb','../../config/environment','data1','license','format','%s:%s:%s','update','base64'];(function(_0x52a887,_0x4dbc2c){var _0x267daa=function(_0x4bd395){while(--_0x4bd395){_0x52a887['push'](_0x52a887['shift']());}};_0x267daa(++_0x4dbc2c);}(_0x00ea,0x176));var _0xa00e=function(_0x22bb05,_0xeb6156){_0x22bb05=_0x22bb05-0x0;var _0x4a5631=_0x00ea[_0x22bb05];return _0x4a5631;};'use strict';var crypto=require(_0xa00e('0x0'));var util=require(_0xa00e('0x1'));var compose=require('composable-middleware');var db=require(_0xa00e('0x2'))['db'];var config=require(_0xa00e('0x3'));function getValueFromLicense(_0x18b624,_0x297454){if(_0x18b624&&_0x297454){if(_0x297454[_0xa00e('0x4')]&&_0x297454[_0xa00e('0x5')]){var _0x44d271=_0x297454[_0xa00e('0x4')];var _0x11047e=_0x297454[_0xa00e('0x5')];var _0x578ce1=_0x44d271['split']('-')[0x4];var _0x1750c3=_0x44d271['split']('-')[0x0];var _0x23dd58=crypto['createDecipher']('aes-256-ctr',util[_0xa00e('0x6')](_0xa00e('0x7'),_0x578ce1,_0x44d271,_0x1750c3));var _0x58002f=_0x23dd58[_0xa00e('0x8')](_0x11047e,_0xa00e('0x9'),'utf8');_0x58002f+=_0x23dd58[_0xa00e('0xa')](_0xa00e('0xb'));var _0x2eccb1=JSON[_0xa00e('0xc')](_0x58002f);return _0x2eccb1[_0xa00e('0xd')](_0x18b624)?_0x2eccb1[_0x18b624]:null;}}return null;}function isLimit(_0x1a11dd,_0x1cf28b,_0x1771f4,_0x51b55b){var _0x3db871=_0x1cf28b;return compose()[_0xa00e('0xe')](function(_0x70b731,_0x2a2587,_0x4040fa){return db[_0xa00e('0xf')][_0xa00e('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xa00e('0x11')](function(_0x297576){var _0x5ce80c=getValueFromLicense(_0x1a11dd,_0x297576);return _0x5ce80c?_0x5ce80c:_0x3db871;})[_0xa00e('0x11')](function(_0x30c64b){_0x3db871=_0x30c64b;return _0x1771f4['count'](_0x51b55b);})[_0xa00e('0x11')](function(_0x37de74){if(_0x37de74>=_0x3db871){return _0x2a2587[_0xa00e('0x12')](0x193)['json']({'message':util[_0xa00e('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x1a11dd)});}_0x4040fa();})[_0xa00e('0x13')](function(_0xe5af81){_0x4040fa(_0xe5af81);});});}function isUserLimit(){return isLimit(_0xa00e('0x14'),0x1,db[_0xa00e('0x15')],{'where':{'$or':[{'role':_0xa00e('0x16')},{'role':_0xa00e('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 52869fb..fae382f 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 _0x6bfd=['shift','match','filter','map','conditions','buildExpression','operator','$eq','$between','value','$gt','$lte','add','days','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','includes','$ne','$notIn','text','\x20OR\x20','$in','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','forEach'];(function(_0x1b9efc,_0x31bb67){var _0x1c9db0=function(_0x4c5a8d){while(--_0x4c5a8d){_0x1b9efc['push'](_0x1b9efc['shift']());}};_0x1c9db0(++_0x31bb67);}(_0x6bfd,0x1d3));var _0xd6bf=function(_0x4b8067,_0x2b33f6){_0x4b8067=_0x4b8067-0x0;var _0x24ca10=_0x6bfd[_0x4b8067];return _0x24ca10;};'use strict';var _=require(_0xd6bf('0x0'));var moment=require(_0xd6bf('0x1'));exports[_0xd6bf('0x2')]=function(_0x53aeb5){var _0x309453={'conditions':[]};_0x309453[_0xd6bf('0x3')]=_[_0xd6bf('0x4')](_0x53aeb5,'[$or]')?'or':_0xd6bf('0x5');var _0x5189e4=_0x53aeb5[_0xd6bf('0x6')]('[$and]','')[_0xd6bf('0x6')](_0xd6bf('0x7'),'')['split']('||');for(var _0x5e4361=0x0;_0x5e4361<_0x5189e4['length'];_0x5e4361++){var _0x214176=_0x5189e4[_0x5e4361][_0xd6bf('0x8')](':=');var _0xb06953=_0x214176[0x0];var _0x446650=_0x214176['slice'](0x1);_0x446650[_0xd6bf('0x9')](function(_0x401293){var _0x36e50e=_0x401293[_0xd6bf('0x8')]('[')[_0xd6bf('0xa')]();var _0x495059=_0x401293[_0xd6bf('0xb')](/\[(.*?)\]/g);_0x495059[_0xd6bf('0x9')](function(_0x3478e6){var _0x839c96=_0x3478e6[_0xd6bf('0x8')]('[')[_0xd6bf('0xc')](function(_0xb28a0d){return _0xb28a0d['indexOf'](']')>-0x1;})[_0xd6bf('0xd')](function(_0x507bb3){return _0x507bb3['split'](']')[0x0];})[0x0];_0x309453[_0xd6bf('0xe')]['push']({'field':_0xb06953,'operator':_0x36e50e,'value':_0x839c96});});});}return _0x309453;};exports[_0xd6bf('0xf')]=function(_0x5d4a17,_0x3768a6,_0x42ae80){var _0x470931={};if(_0x3768a6==='DATE'){if(_0x42ae80[_0xd6bf('0x10')]===_0xd6bf('0x11')){_0x42ae80['operator']=_0xd6bf('0x12');_0x42ae80[_0xd6bf('0x13')]+=','+_0x42ae80[_0xd6bf('0x13')];}else if(_['includes']([_0xd6bf('0x14'),_0xd6bf('0x15')],_0x42ae80[_0xd6bf('0x10')])){_0x42ae80['value']=moment(_0x42ae80['value'])[_0xd6bf('0x16')](0x1,_0xd6bf('0x17'))['format'](_0xd6bf('0x18'));}}if(_0x42ae80[_0xd6bf('0x19')]){_0x3768a6=_0x42ae80[_0xd6bf('0x19')];_0x470931['text']=_0xd6bf('0x1a')+_0x5d4a17+'.'+_0x42ae80[_0xd6bf('0x1b')]+_0xd6bf('0x1c')+_0x42ae80[_0xd6bf('0x19')]+')\x20'+parseOperator(_0x42ae80[_0xd6bf('0x10')]);}else{_0x470931['text']=_0x5d4a17+'.'+_0x42ae80['field']+'\x20'+parseOperator(_0x42ae80['operator']);}if(_[_0xd6bf('0x1d')]([_0xd6bf('0x1e'),_0xd6bf('0x1f')],_0x42ae80['operator']))_0x470931[_0xd6bf('0x20')]='('+_0x470931[_0xd6bf('0x20')]+_0xd6bf('0x21')+_0x5d4a17+'.'+_0x42ae80[_0xd6bf('0x1b')]+'\x20IS\x20NULL)';_0x470931[_0xd6bf('0x13')]=parseValue(_0x3768a6,_0x42ae80[_0xd6bf('0x10')],_0x42ae80[_0xd6bf('0x13')]);return _0x470931;};function parseOperator(_0x1dd29c){var _0x570c8c;switch(_0x1dd29c){case _0xd6bf('0x22'):_0x570c8c='IN\x20?';break;case _0xd6bf('0x1f'):_0x570c8c=_0xd6bf('0x23');break;case _0xd6bf('0x11'):_0x570c8c=_0xd6bf('0x24');break;case _0xd6bf('0x1e'):_0x570c8c='<>\x20?';break;case _0xd6bf('0x25'):case _0xd6bf('0x26'):case _0xd6bf('0x27'):_0x570c8c=_0xd6bf('0x28');break;case _0xd6bf('0x29'):_0x570c8c=_0xd6bf('0x2a');break;case'$gt':_0x570c8c='>\x20?';break;case _0xd6bf('0x15'):_0x570c8c='<=\x20?';break;case'$gte':_0x570c8c=_0xd6bf('0x2b');break;case _0xd6bf('0x12'):_0x570c8c=_0xd6bf('0x2c');break;}return _0x570c8c;}function parseValue(_0x57e5db,_0x2468ba,_0x3c657b){var _0x5804df={'start':undefined,'end':undefined};switch(_0x2468ba){case _0xd6bf('0x22'):case _0xd6bf('0x1f'):_0x5804df[_0xd6bf('0x2d')]=_0x3c657b[_0xd6bf('0x8')](',');break;case _0xd6bf('0x25'):_0x5804df['start']='%'+_0x3c657b+'%';break;case _0xd6bf('0x26'):_0x5804df[_0xd6bf('0x2d')]=_0x3c657b+'%';break;case _0xd6bf('0x27'):_0x5804df[_0xd6bf('0x2d')]='%'+_0x3c657b;break;case _0xd6bf('0x12'):var _0x38338f=_0x3c657b[_0xd6bf('0x8')](',');var _0x3c657b=_0x38338f[_0xd6bf('0xa')]();var _0x5374b3=_0x38338f[_0xd6bf('0x2e')]();if(_0x57e5db===_0xd6bf('0x2f')){_0x3c657b=moment(_0x3c657b)[_0xd6bf('0x30')](0x0,!![])[_0xd6bf('0x31')]();_0x5374b3=moment(_0x5374b3)[_0xd6bf('0x30')](0x0,!![])[_0xd6bf('0x16')](0x17,_0xd6bf('0x32'))[_0xd6bf('0x16')](0x3b,_0xd6bf('0x33'))[_0xd6bf('0x16')](0x3b,_0xd6bf('0x34'))[_0xd6bf('0x31')]();}_0x5804df={'start':_0x3c657b,'end':_0x5374b3};break;default:_0x5804df['start']=_0x3c657b;break;}return _0x5804df;} \ No newline at end of file +var _0xe387=['add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20IS\x20NULL)','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','split','slice','shift','match','forEach','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte'];(function(_0x247e84,_0x4e7ac0){var _0x370879=function(_0x1d45bb){while(--_0x1d45bb){_0x247e84['push'](_0x247e84['shift']());}};_0x370879(++_0x4e7ac0);}(_0xe387,0x12c));var _0x7e38=function(_0x587ed2,_0x5eb91d){_0x587ed2=_0x587ed2-0x0;var _0x55ea1c=_0xe387[_0x587ed2];return _0x55ea1c;};'use strict';var _=require(_0x7e38('0x0'));var moment=require(_0x7e38('0x1'));exports[_0x7e38('0x2')]=function(_0x18fef6){var _0xc1079d={'conditions':[]};_0xc1079d[_0x7e38('0x3')]=_['startsWith'](_0x18fef6,_0x7e38('0x4'))?'or':_0x7e38('0x5');var _0x2d876c=_0x18fef6['replace'](_0x7e38('0x6'),'')['replace']('[$or]','')[_0x7e38('0x7')]('||');for(var _0x2ad84d=0x0;_0x2ad84d<_0x2d876c['length'];_0x2ad84d++){var _0x143a52=_0x2d876c[_0x2ad84d][_0x7e38('0x7')](':=');var _0xf4b9f1=_0x143a52[0x0];var _0x5b1e9c=_0x143a52[_0x7e38('0x8')](0x1);_0x5b1e9c['forEach'](function(_0x4b532a){var _0x2858cc=_0x4b532a[_0x7e38('0x7')]('[')[_0x7e38('0x9')]();var _0x595942=_0x4b532a[_0x7e38('0xa')](/\[(.*?)\]/g);_0x595942[_0x7e38('0xb')](function(_0x14cb43){var _0x2785b1=_0x14cb43[_0x7e38('0x7')]('[')[_0x7e38('0xc')](function(_0x3aaab3){return _0x3aaab3[_0x7e38('0xd')](']')>-0x1;})[_0x7e38('0xe')](function(_0x4136df){return _0x4136df[_0x7e38('0x7')](']')[0x0];})[0x0];_0xc1079d[_0x7e38('0xf')]['push']({'field':_0xf4b9f1,'operator':_0x2858cc,'value':_0x2785b1});});});}return _0xc1079d;};exports[_0x7e38('0x10')]=function(_0x2f8072,_0x59e0c1,_0x4fc64){var _0x82dbca={};if(_0x59e0c1==='DATE'){if(_0x4fc64[_0x7e38('0x11')]===_0x7e38('0x12')){_0x4fc64['operator']=_0x7e38('0x13');_0x4fc64[_0x7e38('0x14')]+=','+_0x4fc64[_0x7e38('0x14')];}else if(_[_0x7e38('0x15')]([_0x7e38('0x16'),_0x7e38('0x17')],_0x4fc64[_0x7e38('0x11')])){_0x4fc64[_0x7e38('0x14')]=moment(_0x4fc64['value'])[_0x7e38('0x18')](0x1,_0x7e38('0x19'))[_0x7e38('0x1a')](_0x7e38('0x1b'));}}if(_0x4fc64['castTo']){_0x59e0c1=_0x4fc64[_0x7e38('0x1c')];_0x82dbca[_0x7e38('0x1d')]=_0x7e38('0x1e')+_0x2f8072+'.'+_0x4fc64[_0x7e38('0x1f')]+'\x20AS\x20'+_0x4fc64[_0x7e38('0x1c')]+')\x20'+parseOperator(_0x4fc64['operator']);}else{_0x82dbca[_0x7e38('0x1d')]=_0x2f8072+'.'+_0x4fc64[_0x7e38('0x1f')]+'\x20'+parseOperator(_0x4fc64[_0x7e38('0x11')]);}if(_[_0x7e38('0x15')](['$ne','$notIn'],_0x4fc64['operator']))_0x82dbca[_0x7e38('0x1d')]='('+_0x82dbca[_0x7e38('0x1d')]+'\x20OR\x20'+_0x2f8072+'.'+_0x4fc64[_0x7e38('0x1f')]+_0x7e38('0x20');_0x82dbca[_0x7e38('0x14')]=parseValue(_0x59e0c1,_0x4fc64[_0x7e38('0x11')],_0x4fc64['value']);return _0x82dbca;};function parseOperator(_0x46cfe5){var _0x315560;switch(_0x46cfe5){case'$in':_0x315560=_0x7e38('0x21');break;case _0x7e38('0x22'):_0x315560=_0x7e38('0x23');break;case'$eq':_0x315560=_0x7e38('0x24');break;case _0x7e38('0x25'):_0x315560=_0x7e38('0x26');break;case _0x7e38('0x27'):case _0x7e38('0x28'):case'$endsWith':_0x315560=_0x7e38('0x29');break;case _0x7e38('0x2a'):_0x315560='<\x20?';break;case _0x7e38('0x16'):_0x315560=_0x7e38('0x2b');break;case _0x7e38('0x17'):_0x315560='<=\x20?';break;case _0x7e38('0x2c'):_0x315560='>=\x20?';break;case _0x7e38('0x13'):_0x315560=_0x7e38('0x2d');break;}return _0x315560;}function parseValue(_0xd5807c,_0x2f01c8,_0x1c3930){var _0x1a9cf7={'start':undefined,'end':undefined};switch(_0x2f01c8){case'$in':case _0x7e38('0x22'):_0x1a9cf7[_0x7e38('0x2e')]=_0x1c3930[_0x7e38('0x7')](',');break;case _0x7e38('0x27'):_0x1a9cf7[_0x7e38('0x2e')]='%'+_0x1c3930+'%';break;case _0x7e38('0x28'):_0x1a9cf7['start']=_0x1c3930+'%';break;case _0x7e38('0x2f'):_0x1a9cf7[_0x7e38('0x2e')]='%'+_0x1c3930;break;case _0x7e38('0x13'):var _0x2cc20d=_0x1c3930[_0x7e38('0x7')](',');var _0x1c3930=_0x2cc20d[_0x7e38('0x9')]();var _0x16ef9b=_0x2cc20d[_0x7e38('0x30')]();if(_0xd5807c===_0x7e38('0x31')){_0x1c3930=moment(_0x1c3930)['utcOffset'](0x0,!![])['format']();_0x16ef9b=moment(_0x16ef9b)[_0x7e38('0x32')](0x0,!![])[_0x7e38('0x18')](0x17,_0x7e38('0x33'))[_0x7e38('0x18')](0x3b,_0x7e38('0x34'))[_0x7e38('0x18')](0x3b,_0x7e38('0x35'))[_0x7e38('0x1a')]();}_0x1a9cf7={'start':_0x1c3930,'end':_0x16ef9b};break;default:_0x1a9cf7['start']=_0x1c3930;break;}return _0x1a9cf7;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e539376..98ba714 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 _0x24ca=['omit','isEmpty','isObject','isString','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','replace','push','join','query','$id','intersection','model','attributes','length','order','sort','where','filters','filter','object','value','merge','VIRTUAL','lower','lodash','parse','includes','keys','fields','split','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','priority','cast','col','unsigned','substr','ASC'];(function(_0x1d07bd,_0x5453f1){var _0x58ffa1=function(_0x4bf1ad){while(--_0x4bf1ad){_0x1d07bd['push'](_0x1d07bd['shift']());}};_0x58ffa1(++_0x5453f1);}(_0x24ca,0x8c));var _0xa24c=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x24ca[_0x328534];return _0x2796c0;};'use strict';var _=require(_0xa24c('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1f4ee1){var _0x4e90b0=['ne'];try{var _0x155c49=JSON[_0xa24c('0x1')](_0x1f4ee1);var _0xe69cdd=Object['keys'](_0x155c49)[0x0];return _0x4e90b0[_0xa24c('0x2')](_0xe69cdd);}catch(_0x89148d){return![];}}function getOperatorValue(_0x4707f9){var _0x5a37ae=JSON['parse'](_0x4707f9);var _0x52147a=Object[_0xa24c('0x3')](_0x5a37ae)[0x0];var _0x3c10d9=_0x5a37ae[_0x52147a];return{['$'+_0x52147a]:_0x3c10d9};}exports[_0xa24c('0x4')]=function(_0x3c3959){var _0x34288c=null;if(_0x3c3959){_0x34288c=_0x3c3959[_0xa24c('0x5')](',');}return _0x34288c;};exports['filters']=function(_0x101ca7,_0x413b3d){var _0x355882={};if(!_['isEmpty'](_0x101ca7)){_['forOwn'](_0x101ca7,function(_0x1331f4,_0x73a132){try{if(_0x413b3d){var _0x2da0c3=_[_0xa24c('0x6')](_0x413b3d,{'name':_0x73a132})||{};if(hasSequelizeOperator(_0x1331f4)){_0x355882[_0x73a132]=getOperatorValue(_0x1331f4);}else if(_0x2da0c3[_0xa24c('0x7')]===_0xa24c('0x8')&&_['isPlainObject'](_0x1331f4)){var _0x5bb631=JSON['parse'](_0x1331f4);var _0x2444b7={'$gte':moment(moment(_0x5bb631[_0xa24c('0x9')])[_0xa24c('0xa')](_0xa24c('0xb')))[_0xa24c('0xc')]()['format'](),'$lte':moment(moment(_0x5bb631[_0xa24c('0xd')])['format']('YYYY-MM-DD'))['utc']()[_0xa24c('0xe')](0x1,'s')[_0xa24c('0xa')]()};_0x355882[_0x73a132]=_0x2444b7;}else if(_0x2da0c3[_0xa24c('0xf')]===_0xa24c('0x10')){_0x355882[_0x73a132]=_0x1331f4;}else{_0x355882[_0x73a132]=_[_0xa24c('0x11')](_0x1331f4)?_0x1331f4:JSON[_0xa24c('0x1')](_0x1331f4);}}else{_0x355882[_0x73a132]=_[_0xa24c('0x11')](_0x1331f4)?_0x1331f4:JSON[_0xa24c('0x1')](_0x1331f4);}}catch(_0x14f0aa){_0x355882[_0x73a132]=_0x1331f4[_0xa24c('0x5')](',');}});}return _0x355882;};exports[_0xa24c('0x12')]=function(_0x1a667b){_0x1a667b=parseInt(_0x1a667b,0xa);if(!_0x1a667b||_0x1a667b<0x0){_0x1a667b=LIMIT_VALUE;}return _0x1a667b;};exports[_0xa24c('0x13')]=function(_0x3e4e81){_0x3e4e81=parseInt(_0x3e4e81,0xa);if(!_0x3e4e81||_0x3e4e81<0x0){_0x3e4e81=0x0;}return _0x3e4e81;};exports['sort']=function(_0x167a76){var _0x48fb65,_0x98802d=null;if(_0x167a76){_0x48fb65=_0x167a76[_0xa24c('0x5')](',');_0x98802d=_[_0xa24c('0x14')](_0x48fb65,function(_0x37e20e){if(_0x37e20e[_0xa24c('0x15')]('-')===0x0){return[_0x37e20e===_0xa24c('0x16')?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x37e20e[_0xa24c('0x1a')](0x1),'DESC'];}else{return[_0x37e20e==='priority'?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x37e20e,_0xa24c('0x1b')];}});}return _0x98802d;};exports[_0xa24c('0x1c')]=function(_0x16bd20,_0x3106ff){if(_[_0xa24c('0x1d')](_0x16bd20)){return _0x16bd20;}if(_['isArray'](_0x16bd20)){for(var _0x2290e1=0x0;_0x2290e1<_0x16bd20['length'];_0x2290e1+=0x1){_0x16bd20[_0x2290e1]=this[_0xa24c('0x1c')](_0x16bd20[_0x2290e1],_0x3106ff);}return _0x16bd20;}if(!_[_0xa24c('0x1e')](_0x16bd20)){return _0x16bd20;}if(_[_0xa24c('0x1f')](_0x3106ff)){_0x3106ff=[_0x3106ff];}if(!_[_0xa24c('0x11')](_0x3106ff)){return _0x16bd20;}for(var _0x54b8a6=0x0;_0x54b8a6<_0x3106ff['length'];_0x54b8a6+=0x1){_['unset'](_0x16bd20,_0x3106ff[_0x54b8a6]);}for(var _0x4e5d2c in _0x16bd20){if(_0x16bd20[_0xa24c('0x20')](_0x4e5d2c)){_0x16bd20[_0x4e5d2c]=this[_0xa24c('0x1c')](_0x16bd20[_0x4e5d2c],_0x3106ff);}}return _0x16bd20;};exports[_0xa24c('0x21')]=function(_0x1cdee4){return _0x1cdee4[_0xa24c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x33c208){return _0x33c208[_0xa24c('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xa24c('0x23')]=function(_0x1d500e){var _0x4566dc=[];_0x1d500e[_0xa24c('0x5')](/[ ,]+/)[_0xa24c('0x24')](function(_0x1e30a9){_0x1e30a9=_0x1e30a9[_0xa24c('0x25')](/([^:]")"+/g,'$1');_0x1e30a9='+'+_0x1e30a9+'*';var _0x17a001=/[ `!@#$%^&*()_\-?~]/;if(_0x1e30a9['match'](_0x17a001))_0x1e30a9='\x22'+_0x1e30a9+'\x22';_0x4566dc[_0xa24c('0x26')](_0x1e30a9);});return _0x4566dc[_0xa24c('0x27')]('\x20');};exports['getOptions']=function(_0x3c9649,_0x3e8b0f,_0x33f0c9){var _0x1de2ef={},_0x26f2fe={};if(_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x29')]){_0x3e8b0f[_0xa24c('0x28')]['id']=_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x29')];delete _0x3e8b0f['query']['$id'];}_0x1de2ef['model']=_[_0xa24c('0x14')](_0x3c9649,'name');_0x1de2ef[_0xa24c('0x28')]=_[_0xa24c('0x3')](_0x3e8b0f[_0xa24c('0x28')]);_0x1de2ef['filters']=_[_0xa24c('0x2a')](_0x1de2ef[_0xa24c('0x2b')],_0x1de2ef[_0xa24c('0x28')]);_0x26f2fe['attributes']=_[_0xa24c('0x2a')](_0x1de2ef[_0xa24c('0x2b')],this['fields'](_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x4')]));_0x26f2fe[_0xa24c('0x2c')]=_0x26f2fe['attributes'][_0xa24c('0x2d')]?_0x26f2fe[_0xa24c('0x2c')]:_0x1de2ef[_0xa24c('0x2b')];if(!_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x20')]('nolimit')){_0x26f2fe[_0xa24c('0x12')]=this[_0xa24c('0x12')](_0x3e8b0f['query'][_0xa24c('0x12')]);_0x26f2fe[_0xa24c('0x13')]=this[_0xa24c('0x13')](_0x3e8b0f['query']['offset']);}_0x26f2fe[_0xa24c('0x2e')]=this[_0xa24c('0x2f')](_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x2f')]);_0x26f2fe[_0xa24c('0x30')]=this[_0xa24c('0x31')](_['pick'](_0x3e8b0f[_0xa24c('0x28')],_0x1de2ef[_0xa24c('0x31')]),_0x3c9649);if(_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]){var _0x5f3cd4=_0x3c9649;var _0x34026c=_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')];if(typeof _0x34026c===_0xa24c('0x33')){_0x5f3cd4=_[_0xa24c('0x32')](_0x3c9649,function(_0x7d16aa){return _[_0xa24c('0x2')](_0x34026c['columns'],_0x7d16aa['name']);});_0x34026c=_0x34026c[_0xa24c('0x34')];}_0x26f2fe['where']=_[_0xa24c('0x35')](_0x26f2fe['where'],{'$or':_[_0xa24c('0x14')](_0x5f3cd4,function(_0x214627){if(_0x214627[_0xa24c('0x7')]!==_0xa24c('0x36')){if(_0x33f0c9){return sequelize[_0xa24c('0x30')](sequelize['fn'](_0xa24c('0x37'),sequelize[_0xa24c('0x18')](_0x214627[_0xa24c('0xf')])),{'$like':sequelize['fn'](_0xa24c('0x37'),'%'+_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]+'%')});}else{var _0x1f87b7={};_0x1f87b7[_0x214627[_0xa24c('0xf')]]={'$like':'%'+_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]+'%'};return _0x1f87b7;}}})});}_0x26f2fe=_[_0xa24c('0x35')]({},_0x26f2fe,_0x3e8b0f['options']);return _0x26f2fe;}; \ No newline at end of file +var _0x814b=['unset','hasOwnProperty','match','^[+]?[0-9]*$','replace','push','join','query','$id','model','attributes','offset','where','filter','object','VIRTUAL','lower','merge','options','lodash','sequelize','moment','keys','includes','fields','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','sort','map','indexOf','cast','col','priority','unsigned','substr','DESC','ASC','omit','length','isObject','isString'];(function(_0x444c1c,_0x42db44){var _0x39ae49=function(_0x41a89f){while(--_0x41a89f){_0x444c1c['push'](_0x444c1c['shift']());}};_0x39ae49(++_0x42db44);}(_0x814b,0x1a2));var _0xb814=function(_0xc5a279,_0x155360){_0xc5a279=_0xc5a279-0x0;var _0xc755d3=_0x814b[_0xc5a279];return _0xc755d3;};'use strict';var _=require(_0xb814('0x0'));var sequelize=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2f4ece){var _0xfbb64b=['ne'];try{var _0x477725=JSON['parse'](_0x2f4ece);var _0x38c21a=Object[_0xb814('0x3')](_0x477725)[0x0];return _0xfbb64b[_0xb814('0x4')](_0x38c21a);}catch(_0x4237bc){return![];}}function getOperatorValue(_0x44931c){var _0x322a70=JSON['parse'](_0x44931c);var _0x3b0829=Object[_0xb814('0x3')](_0x322a70)[0x0];var _0x5c8539=_0x322a70[_0x3b0829];return{['$'+_0x3b0829]:_0x5c8539};}exports[_0xb814('0x5')]=function(_0x2913a6){var _0x186d5a=null;if(_0x2913a6){_0x186d5a=_0x2913a6[_0xb814('0x6')](',');}return _0x186d5a;};exports[_0xb814('0x7')]=function(_0x21d4a5,_0x1086f8){var _0x19aad8={};if(!_[_0xb814('0x8')](_0x21d4a5)){_[_0xb814('0x9')](_0x21d4a5,function(_0x10e4a6,_0x4b5f14){try{if(_0x1086f8){var _0x43dfe6=_['find'](_0x1086f8,{'name':_0x4b5f14})||{};if(hasSequelizeOperator(_0x10e4a6)){_0x19aad8[_0x4b5f14]=getOperatorValue(_0x10e4a6);}else if(_0x43dfe6[_0xb814('0xa')]===_0xb814('0xb')&&_[_0xb814('0xc')](_0x10e4a6)){var _0x2cc46b=JSON[_0xb814('0xd')](_0x10e4a6);var _0x3bde14={'$gte':moment(moment(_0x2cc46b[_0xb814('0xe')])[_0xb814('0xf')](_0xb814('0x10')))[_0xb814('0x11')]()[_0xb814('0xf')](),'$lte':moment(moment(_0x2cc46b[_0xb814('0x12')])[_0xb814('0xf')](_0xb814('0x10')))[_0xb814('0x11')]()[_0xb814('0x13')](0x1,'s')[_0xb814('0xf')]()};_0x19aad8[_0x4b5f14]=_0x3bde14;}else if(_0x43dfe6[_0xb814('0x14')]===_0xb814('0x15')){_0x19aad8[_0x4b5f14]=_0x10e4a6;}else{_0x19aad8[_0x4b5f14]=_[_0xb814('0x16')](_0x10e4a6)?_0x10e4a6:JSON[_0xb814('0xd')](_0x10e4a6);}}else{_0x19aad8[_0x4b5f14]=_['isArray'](_0x10e4a6)?_0x10e4a6:JSON[_0xb814('0xd')](_0x10e4a6);}}catch(_0x55ba16){_0x19aad8[_0x4b5f14]=_0x10e4a6[_0xb814('0x6')](',');}});}return _0x19aad8;};exports[_0xb814('0x17')]=function(_0x4c3007){_0x4c3007=parseInt(_0x4c3007,0xa);if(!_0x4c3007||_0x4c3007<0x0){_0x4c3007=LIMIT_VALUE;}return _0x4c3007;};exports['offset']=function(_0x55d63c){_0x55d63c=parseInt(_0x55d63c,0xa);if(!_0x55d63c||_0x55d63c<0x0){_0x55d63c=0x0;}return _0x55d63c;};exports[_0xb814('0x18')]=function(_0x4d5276){var _0x57c128,_0xb684ea=null;if(_0x4d5276){_0x57c128=_0x4d5276[_0xb814('0x6')](',');_0xb684ea=_[_0xb814('0x19')](_0x57c128,function(_0x4e139e){if(_0x4e139e[_0xb814('0x1a')]('-')===0x0){return[_0x4e139e==='priority'?sequelize[_0xb814('0x1b')](sequelize[_0xb814('0x1c')](_0xb814('0x1d')),_0xb814('0x1e')):_0x4e139e[_0xb814('0x1f')](0x1),_0xb814('0x20')];}else{return[_0x4e139e===_0xb814('0x1d')?sequelize['cast'](sequelize[_0xb814('0x1c')]('priority'),_0xb814('0x1e')):_0x4e139e,_0xb814('0x21')];}});}return _0xb684ea;};exports[_0xb814('0x22')]=function(_0x208927,_0x1c8a2e){if(_[_0xb814('0x8')](_0x208927)){return _0x208927;}if(_[_0xb814('0x16')](_0x208927)){for(var _0x5755ea=0x0;_0x5755ea<_0x208927[_0xb814('0x23')];_0x5755ea+=0x1){_0x208927[_0x5755ea]=this[_0xb814('0x22')](_0x208927[_0x5755ea],_0x1c8a2e);}return _0x208927;}if(!_[_0xb814('0x24')](_0x208927)){return _0x208927;}if(_[_0xb814('0x25')](_0x1c8a2e)){_0x1c8a2e=[_0x1c8a2e];}if(!_[_0xb814('0x16')](_0x1c8a2e)){return _0x208927;}for(var _0x1d5965=0x0;_0x1d5965<_0x1c8a2e[_0xb814('0x23')];_0x1d5965+=0x1){_[_0xb814('0x26')](_0x208927,_0x1c8a2e[_0x1d5965]);}for(var _0x5a6291 in _0x208927){if(_0x208927[_0xb814('0x27')](_0x5a6291)){_0x208927[_0x5a6291]=this[_0xb814('0x22')](_0x208927[_0x5a6291],_0x1c8a2e);}}return _0x208927;};exports['isNumeric']=function(_0x9008b2){return _0x9008b2[_0xb814('0x28')](RegExp(_0xb814('0x29')))?!![]:![];};exports['isEmail']=function(_0x20577b){return _0x20577b[_0xb814('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x338a28){var _0x526610=[];_0x338a28[_0xb814('0x6')](/[ ,]+/)['forEach'](function(_0x4cfc58){_0x4cfc58=_0x4cfc58[_0xb814('0x2a')](/([^:]")"+/g,'$1');_0x4cfc58='+'+_0x4cfc58+'*';var _0x4a4f27=/[ `!@#$%^&*()_\-?~]/;if(_0x4cfc58[_0xb814('0x28')](_0x4a4f27))_0x4cfc58='\x22'+_0x4cfc58+'\x22';_0x526610[_0xb814('0x2b')](_0x4cfc58);});return _0x526610[_0xb814('0x2c')]('\x20');};exports['getOptions']=function(_0x51d5ae,_0x26d3a9,_0x336e2b){var _0x523566={},_0x2c8943={};if(_0x26d3a9[_0xb814('0x2d')][_0xb814('0x2e')]){_0x26d3a9[_0xb814('0x2d')]['id']=_0x26d3a9[_0xb814('0x2d')][_0xb814('0x2e')];delete _0x26d3a9[_0xb814('0x2d')]['$id'];}_0x523566[_0xb814('0x2f')]=_[_0xb814('0x19')](_0x51d5ae,_0xb814('0x14'));_0x523566[_0xb814('0x2d')]=_[_0xb814('0x3')](_0x26d3a9['query']);_0x523566[_0xb814('0x7')]=_['intersection'](_0x523566[_0xb814('0x2f')],_0x523566[_0xb814('0x2d')]);_0x2c8943[_0xb814('0x30')]=_['intersection'](_0x523566[_0xb814('0x2f')],this[_0xb814('0x5')](_0x26d3a9['query'][_0xb814('0x5')]));_0x2c8943[_0xb814('0x30')]=_0x2c8943[_0xb814('0x30')][_0xb814('0x23')]?_0x2c8943[_0xb814('0x30')]:_0x523566[_0xb814('0x2f')];if(!_0x26d3a9['query'][_0xb814('0x27')]('nolimit')){_0x2c8943[_0xb814('0x17')]=this['limit'](_0x26d3a9[_0xb814('0x2d')]['limit']);_0x2c8943[_0xb814('0x31')]=this[_0xb814('0x31')](_0x26d3a9['query']['offset']);}_0x2c8943['order']=this['sort'](_0x26d3a9[_0xb814('0x2d')][_0xb814('0x18')]);_0x2c8943[_0xb814('0x32')]=this[_0xb814('0x7')](_['pick'](_0x26d3a9['query'],_0x523566[_0xb814('0x7')]),_0x51d5ae);if(_0x26d3a9['query'][_0xb814('0x33')]){var _0x1098eb=_0x51d5ae;var _0x178823=_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')];if(typeof _0x178823===_0xb814('0x34')){_0x1098eb=_[_0xb814('0x33')](_0x51d5ae,function(_0x28b2b4){return _[_0xb814('0x4')](_0x178823['columns'],_0x28b2b4['name']);});_0x178823=_0x178823['value'];}_0x2c8943[_0xb814('0x32')]=_['merge'](_0x2c8943[_0xb814('0x32')],{'$or':_['map'](_0x1098eb,function(_0x411723){if(_0x411723[_0xb814('0xa')]!==_0xb814('0x35')){if(_0x336e2b){return sequelize[_0xb814('0x32')](sequelize['fn']('lower',sequelize[_0xb814('0x1c')](_0x411723[_0xb814('0x14')])),{'$like':sequelize['fn'](_0xb814('0x36'),'%'+_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')]+'%')});}else{var _0x450a08={};_0x450a08[_0x411723['name']]={'$like':'%'+_0x26d3a9[_0xb814('0x2d')][_0xb814('0x33')]+'%'};return _0x450a08;}}})});}_0x2c8943=_[_0xb814('0x37')]({},_0x2c8943,_0x26d3a9[_0xb814('0x38')]);return _0x2c8943;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index cc6a0ba..f0d7e0b 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 _0xeb7f=['smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','lodash','jayson/promise','../../mysqldb','http','client','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','getAgentStatus','isArray','startCase','Queue','map','getAgents','all','flatten','value','includes','busy','resolve','User','findAll','name','chatPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','DESC','getUpdatedSortOptions','internal','substring','indexOf','fullname','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime'];(function(_0x422644,_0x44c944){var _0x55da65=function(_0x4c6413){while(--_0x4c6413){_0x422644['push'](_0x422644['shift']());}};_0x55da65(++_0x44c944);}(_0xeb7f,0x6c));var _0xfeb7=function(_0x32f250,_0x1fbca3){_0x32f250=_0x32f250-0x0;var _0x39ead3=_0xeb7f[_0x32f250];return _0x39ead3;};'use strict';var _=require(_0xfeb7('0x0'));var jayson=require(_0xfeb7('0x1'));var db=require(_0xfeb7('0x2'))['db'];var amiClient=jayson['client'][_0xfeb7('0x3')]({'port':0x232a});var routingClient=jayson[_0xfeb7('0x4')][_0xfeb7('0x3')]({'port':0x232c});function isAgentPaused(_0x3896ef,_0x2317ae){var _0x679ca8=[_0x3896ef['chatPause'],_0x3896ef[_0xfeb7('0x5')],_0x3896ef[_0xfeb7('0x6')],_0x3896ef[_0xfeb7('0x7')],_0x3896ef[_0xfeb7('0x8')],_0x3896ef[_0xfeb7('0x9')],_0x3896ef[_0xfeb7('0xa')]];if(!_0x2317ae)return _[_0xfeb7('0xb')](_0x679ca8);var _0x117a74=_[_0xfeb7('0xc')](_0x679ca8);return _0x117a74['length']>0x0&&_0x117a74[_0xfeb7('0xd')]<_0x679ca8[_0xfeb7('0xd')]?!![]:![];}function isIdle(_0x235953){return _0x235953===_0xfeb7('0xe')||_0x235953===_0xfeb7('0xf')||_0x235953==='unavailable'||_0x235953===_0xfeb7('0x10')||_[_0xfeb7('0x11')](_0x235953);}function isAgentIdle(_0x480fe8){if(_0x480fe8[_0xfeb7('0x12')]!==_0xfeb7('0xe')&&_0x480fe8[_0xfeb7('0x9')]){_0x480fe8[_0xfeb7('0x12')]=_0xfeb7('0x13');return![];}return _[_0xfeb7('0xb')]([_0x480fe8[_0xfeb7('0x14')],_0x480fe8[_0xfeb7('0x15')],_0x480fe8['mailStatus'],_0x480fe8['openchannelStatus'],_0x480fe8[_0xfeb7('0x16')],_0x480fe8[_0xfeb7('0x12')],_0x480fe8[_0xfeb7('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xfeb7('0x18')](_0xfeb7('0x19'),{})[_0xfeb7('0x1a')](function(_0x165b6a){if(_0x165b6a[_0xfeb7('0x1b')]){throw new Error(_0xfeb7('0x1c'));}var _0x4d6f8d=_0x165b6a[_0xfeb7('0x1d')];return routingClient[_0xfeb7('0x18')](_0xfeb7('0x19'),{})[_0xfeb7('0x1a')](function(_0x4a1658){if(_0x4a1658['error']){throw new Error(_0xfeb7('0x1e'));}var _0x19b91c=_0x4a1658['result'];return _[_0xfeb7('0x1f')]({},_0x4d6f8d,_0x19b91c);});})[_0xfeb7('0x20')](function(_0x20a7b3){throw _0x20a7b3;});}exports[_0xfeb7('0x21')]=getRealtimeAgents;function getAgentStatus(_0x2f670a){var _0x2aef14=_0xfeb7('0xf');if(isAgentPaused(_0x2f670a))_0x2aef14=_0xfeb7('0x13');else if(isAgentPaused(_0x2f670a,!![]))_0x2aef14='*pause';else if(isAgentIdle(_0x2f670a))_0x2aef14=_0xfeb7('0xe');else _0x2aef14='busy';return _0x2aef14;}exports[_0xfeb7('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x1fe2ec,_0xdae6af){var _0x3f2aaf=_[_0xfeb7('0x23')](_0x1fe2ec)?_0x1fe2ec:[_0x1fe2ec];var _0xdf230a=_[_0xfeb7('0x24')](_0xdae6af)+_0xfeb7('0x25');var _0x4c0f7e=_[_0xfeb7('0x26')](_0x3f2aaf,function(_0x2c8c82){return db[_0xdf230a]['findOne']({'where':{'id':_0x2c8c82}})['then'](function(_0x328258){if(!_0x328258)return[];return _0x328258[_0xfeb7('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xfeb7('0x28')](_0x4c0f7e)[_0xfeb7('0x1a')](function(_0x201a75){var _0x28d6d3=_(_0x201a75)[_0xfeb7('0x29')]()[_0xfeb7('0x26')]('id')['uniq']()[_0xfeb7('0x2a')]();return _0x28d6d3;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x2e132f,_0x409119,_0x35c50b){try{if(_0x409119[_0xfeb7('0xd')]>0x0){_0x2e132f=_0x2e132f['filter'](function(_0x41adcd){return _0x409119[_0xfeb7('0x2b')](_0x41adcd['id']);});}var _0x1adc17=_0x2e132f['filter'](function(_0x2a23ad){var _0x562b89=_0xfeb7('0x2c');if(isAgentIdle(_0x2a23ad)){_0x562b89=_0xfeb7('0xe');}return _0x562b89===_0x35c50b;});return _[_0xfeb7('0x26')](_0x1adc17,'id');}catch(_0xa60eb2){throw _0xa60eb2;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x452bf0,_0xa4768e,_0x35ab08){return Promise[_0xfeb7('0x2d')]()[_0xfeb7('0x1a')](function(){if(_0xa4768e[_0xfeb7('0xd')]>0x0){_0x452bf0=_0x452bf0[_0xfeb7('0xc')](function(_0x398f2){return _0xa4768e[_0xfeb7('0x2b')](_0x398f2['id']);});}return _0x452bf0;})[_0xfeb7('0x1a')](function(){return db[_0xfeb7('0x2e')][_0xfeb7('0x2f')]({'attributes':['id',_0xfeb7('0x30'),'fullname',_0xfeb7('0x31'),'faxPause','mailPause','openchannelPause',_0xfeb7('0x8'),_0xfeb7('0x9'),_0xfeb7('0xa'),_0xfeb7('0x32')],'where':{'id':{'$in':_[_0xfeb7('0x26')](_0x452bf0,'id')}},'raw':!![]});})[_0xfeb7('0x1a')](function(_0x246bfa){return _0x246bfa[_0xfeb7('0x26')](function(_0x51e496){var _0x4e3a67=_[_0xfeb7('0x33')](_0x452bf0,['id',_0x51e496['id']]);var _0x281e83=filterAgentAttributes(_0x4e3a67);_[_0xfeb7('0x1f')](_0x51e496,_0x281e83);_0x51e496[_0xfeb7('0x34')]=getAgentStatus(_0x51e496);return _0x51e496;});})[_0xfeb7('0x1a')](function(_0x106118){var _0x1cc1d4=sortAgentsByStatus(_0x106118,_0x35ab08);return _[_0xfeb7('0x26')](_0x1cc1d4,'id');})['catch'](function(_0x4bcde0){throw _0x4bcde0;});}exports[_0xfeb7('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x248ff3){var _0x4427b7={'fields':[],'order':null};var _0x3f2037=_0x248ff3['split'](',');_0x4427b7[_0xfeb7('0x36')]=_[_0xfeb7('0xc')](_0x3f2037,function(_0x3c2854){if(!_0x3c2854[_0xfeb7('0x2b')](_0xfeb7('0x34'))){return!![];}_0x4427b7['order']=_[_0xfeb7('0x37')](_0x3c2854,'-')?_0xfeb7('0x38'):'ASC';return![];});return _0x4427b7;}exports[_0xfeb7('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x16404c){if(_0x16404c[_0xfeb7('0x2b')]('fullname')&&!_0x16404c[_0xfeb7('0x2b')](_0xfeb7('0x3a'))){var _0x5c5786=_0x16404c[_0xfeb7('0x3b')](0x0,_0x16404c[_0xfeb7('0x3c')](_0xfeb7('0x3d')));_0x16404c+=','+_0x5c5786+'internal';}return _0x16404c;}exports[_0xfeb7('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x14156f,_0x5f1fa5){var _0x1298ad=_0x14156f[_0xfeb7('0x3f')](function(_0x370dee,_0x580d5d){if(_0x370dee[_0xfeb7('0x34')]===_0x580d5d[_0xfeb7('0x34')]){if(_0x370dee[_0xfeb7('0x34')]===_0xfeb7('0x13')){if(_0x5f1fa5===_0xfeb7('0x38')){return(_0x370dee[_0xfeb7('0x32')]||'')<(_0x580d5d[_0xfeb7('0x32')]||'')||_0x370dee[_0xfeb7('0x3d')][_0xfeb7('0x40')]()>_0x580d5d['fullname'][_0xfeb7('0x40')]()?0x1:-0x1;}else{return(_0x370dee['pauseType']||'')<(_0x580d5d['pauseType']||'')||_0x370dee[_0xfeb7('0x3d')][_0xfeb7('0x40')]()>_0x580d5d[_0xfeb7('0x3d')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x5f1fa5===_0xfeb7('0x38')){return _0x370dee['fullname'][_0xfeb7('0x40')]()<_0x580d5d[_0xfeb7('0x3d')][_0xfeb7('0x40')]()?0x1:-0x1;}else{return _0x370dee['fullname']['toLowerCase']()<_0x580d5d[_0xfeb7('0x3d')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x5f1fa5===_0xfeb7('0x38')){return _0x370dee[_0xfeb7('0x34')]<_0x580d5d[_0xfeb7('0x34')]?0x1:-0x1;}else{return _0x370dee['globalStatus']<_0x580d5d[_0xfeb7('0x34')]?-0x1:0x1;}}});return _0x1298ad;}exports[_0xfeb7('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x4ba3be){var _0x4e8102=[_0xfeb7('0x42'),_0xfeb7('0x43'),_0xfeb7('0x44'),_0xfeb7('0x45'),_0xfeb7('0x32'),'lastPauseAt','internal','address',_0xfeb7('0x31'),_0xfeb7('0x7'),_0xfeb7('0x6'),_0xfeb7('0x8'),_0xfeb7('0xa'),_0xfeb7('0x5'),_0xfeb7('0x9'),_0xfeb7('0x46'),_0xfeb7('0x47'),_0xfeb7('0x48'),_0xfeb7('0x49'),'whatsappCapacity',_0xfeb7('0x4a'),_0xfeb7('0x4b'),'openchannelCurrentCapacity',_0xfeb7('0x4c'),_0xfeb7('0x4d'),'whatsappCurrentCapacity',_0xfeb7('0x4e'),_0xfeb7('0x14'),_0xfeb7('0x4f'),_0xfeb7('0x50'),'smsStatus',_0xfeb7('0x17'),_0xfeb7('0x15'),'voiceStatus',_0xfeb7('0x51'),_0xfeb7('0x52'),_0xfeb7('0x53'),_0xfeb7('0x54'),_0xfeb7('0x55'),_0xfeb7('0x56'),_0xfeb7('0x57'),_0xfeb7('0x58'),_0xfeb7('0x59'),_0xfeb7('0x5a'),_0xfeb7('0x5b'),_0xfeb7('0x5c'),_0xfeb7('0x5d')];var _0x1d6b57=['chatPause',_0xfeb7('0x7'),_0xfeb7('0x6'),_0xfeb7('0x8'),_0xfeb7('0xa'),_0xfeb7('0x5'),_0xfeb7('0x9'),_0xfeb7('0x43')];var _0x3bceec=_(_0x4ba3be)[_0xfeb7('0x5e')](_0x1d6b57)[_0xfeb7('0x5f')](_0x4e8102)[_0xfeb7('0x2a')]();return _0x3bceec;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x02ea=['mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','lodash','client','http','chatPause','faxPause','mailPause','smsPause','whatsappPause','every','filter','length','idle','ringing','voicePause','voiceStatus','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','pause','getAgentStatus','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','busy','getAgentIdsByStatus','includes','User','fullname','openchannelPause','pauseType','find','globalStatus','split','startsWith','ASC','internal','substring','validateSortParameter','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity'];(function(_0x19382f,_0x1da665){var _0x4c0b4d=function(_0x514a85){while(--_0x514a85){_0x19382f['push'](_0x19382f['shift']());}};_0x4c0b4d(++_0x1da665);}(_0x02ea,0x1c4));var _0xa02e=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x02ea[_0x2ce6d5];return _0x32d272;};'use strict';var _=require(_0xa02e('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa02e('0x1')]['http']({'port':0x232a});var routingClient=jayson[_0xa02e('0x1')][_0xa02e('0x2')]({'port':0x232c});function isAgentPaused(_0x4fe342,_0x4735e4){var _0x4355b6=[_0x4fe342[_0xa02e('0x3')],_0x4fe342[_0xa02e('0x4')],_0x4fe342[_0xa02e('0x5')],_0x4fe342['openchannelPause'],_0x4fe342[_0xa02e('0x6')],_0x4fe342['voicePause'],_0x4fe342[_0xa02e('0x7')]];if(!_0x4735e4)return _[_0xa02e('0x8')](_0x4355b6);var _0x130334=_[_0xa02e('0x9')](_0x4355b6);return _0x130334[_0xa02e('0xa')]>0x0&&_0x130334[_0xa02e('0xa')]<_0x4355b6[_0xa02e('0xa')]?!![]:![];}function isIdle(_0x487744){return _0x487744===_0xa02e('0xb')||_0x487744==='unknown'||_0x487744==='unavailable'||_0x487744===_0xa02e('0xc')||_['isNil'](_0x487744);}function isAgentIdle(_0x45c405){if(_0x45c405['voiceStatus']!=='idle'&&_0x45c405[_0xa02e('0xd')]){_0x45c405[_0xa02e('0xe')]='pause';return![];}return _[_0xa02e('0x8')]([_0x45c405[_0xa02e('0xf')],_0x45c405[_0xa02e('0x10')],_0x45c405[_0xa02e('0x11')],_0x45c405[_0xa02e('0x12')],_0x45c405[_0xa02e('0x13')],_0x45c405[_0xa02e('0xe')],_0x45c405[_0xa02e('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa02e('0x15')](_0xa02e('0x16'),{})[_0xa02e('0x17')](function(_0x5a027b){if(_0x5a027b[_0xa02e('0x18')]){throw new Error(_0xa02e('0x19'));}var _0xb7f613=_0x5a027b[_0xa02e('0x1a')];return routingClient['request'](_0xa02e('0x16'),{})[_0xa02e('0x17')](function(_0x9d6a0){if(_0x9d6a0[_0xa02e('0x18')]){throw new Error(_0xa02e('0x1b'));}var _0x4d59b9=_0x9d6a0[_0xa02e('0x1a')];return _[_0xa02e('0x1c')]({},_0xb7f613,_0x4d59b9);});})[_0xa02e('0x1d')](function(_0x469ba8){throw _0x469ba8;});}exports[_0xa02e('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x10345d){var _0x26b591=_0xa02e('0x1f');if(isAgentPaused(_0x10345d))_0x26b591=_0xa02e('0x20');else if(isAgentPaused(_0x10345d,!![]))_0x26b591='*pause';else if(isAgentIdle(_0x10345d))_0x26b591=_0xa02e('0xb');else _0x26b591='busy';return _0x26b591;}exports[_0xa02e('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x2875aa,_0x5807c1){var _0x6dc078=_['isArray'](_0x2875aa)?_0x2875aa:[_0x2875aa];var _0x3eb6e1=_['startCase'](_0x5807c1)+_0xa02e('0x22');var _0x226be4=_[_0xa02e('0x23')](_0x6dc078,function(_0x1ff788){return db[_0x3eb6e1][_0xa02e('0x24')]({'where':{'id':_0x1ff788}})[_0xa02e('0x17')](function(_0xee36bd){if(!_0xee36bd)return[];return _0xee36bd[_0xa02e('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xa02e('0x26')](_0x226be4)[_0xa02e('0x17')](function(_0x26f94e){var _0x3b3d27=_(_0x26f94e)[_0xa02e('0x27')]()[_0xa02e('0x23')]('id')[_0xa02e('0x28')]()[_0xa02e('0x29')]();return _0x3b3d27;});}exports[_0xa02e('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x52fc9e,_0x51aef1,_0x404260){try{if(_0x51aef1[_0xa02e('0xa')]>0x0){_0x52fc9e=_0x52fc9e[_0xa02e('0x9')](function(_0x1c5d4d){return _0x51aef1['includes'](_0x1c5d4d['id']);});}var _0x5b1a53=_0x52fc9e[_0xa02e('0x9')](function(_0x353530){var _0x40c8a1=_0xa02e('0x2b');if(isAgentIdle(_0x353530)){_0x40c8a1=_0xa02e('0xb');}return _0x40c8a1===_0x404260;});return _[_0xa02e('0x23')](_0x5b1a53,'id');}catch(_0x3b7b69){throw _0x3b7b69;}}exports[_0xa02e('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x149a47,_0x5b91f8,_0x57f0d5){return Promise['resolve']()[_0xa02e('0x17')](function(){if(_0x5b91f8['length']>0x0){_0x149a47=_0x149a47[_0xa02e('0x9')](function(_0x1d9132){return _0x5b91f8[_0xa02e('0x2d')](_0x1d9132['id']);});}return _0x149a47;})[_0xa02e('0x17')](function(){return db[_0xa02e('0x2e')]['findAll']({'attributes':['id','name',_0xa02e('0x2f'),_0xa02e('0x3'),_0xa02e('0x4'),'mailPause',_0xa02e('0x30'),'smsPause',_0xa02e('0xd'),_0xa02e('0x7'),_0xa02e('0x31')],'where':{'id':{'$in':_[_0xa02e('0x23')](_0x149a47,'id')}},'raw':!![]});})[_0xa02e('0x17')](function(_0x349785){return _0x349785['map'](function(_0x2f120a){var _0x15b525=_[_0xa02e('0x32')](_0x149a47,['id',_0x2f120a['id']]);var _0x193f3f=filterAgentAttributes(_0x15b525);_['merge'](_0x2f120a,_0x193f3f);_0x2f120a[_0xa02e('0x33')]=getAgentStatus(_0x2f120a);return _0x2f120a;});})[_0xa02e('0x17')](function(_0x595071){var _0x3e02d3=sortAgentsByStatus(_0x595071,_0x57f0d5);return _[_0xa02e('0x23')](_0x3e02d3,'id');})['catch'](function(_0x30df98){throw _0x30df98;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x3ced45){var _0xe3ad5e={'fields':[],'order':null};var _0xe08070=_0x3ced45[_0xa02e('0x34')](',');_0xe3ad5e['fields']=_['filter'](_0xe08070,function(_0x3aceed){if(!_0x3aceed[_0xa02e('0x2d')](_0xa02e('0x33'))){return!![];}_0xe3ad5e['order']=_[_0xa02e('0x35')](_0x3aceed,'-')?'DESC':_0xa02e('0x36');return![];});return _0xe3ad5e;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x4344b2){if(_0x4344b2['includes'](_0xa02e('0x2f'))&&!_0x4344b2[_0xa02e('0x2d')](_0xa02e('0x37'))){var _0x53327d=_0x4344b2[_0xa02e('0x38')](0x0,_0x4344b2['indexOf'](_0xa02e('0x2f')));_0x4344b2+=','+_0x53327d+_0xa02e('0x37');}return _0x4344b2;}exports[_0xa02e('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x232dcd,_0x5a643f){var _0x2e69c2=_0x232dcd[_0xa02e('0x3a')](function(_0x495fdf,_0x59489d){if(_0x495fdf['globalStatus']===_0x59489d[_0xa02e('0x33')]){if(_0x495fdf['globalStatus']==='pause'){if(_0x5a643f===_0xa02e('0x3b')){return(_0x495fdf['pauseType']||'')<(_0x59489d[_0xa02e('0x31')]||'')||_0x495fdf[_0xa02e('0x2f')][_0xa02e('0x3c')]()>_0x59489d[_0xa02e('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x495fdf[_0xa02e('0x31')]||'')<(_0x59489d[_0xa02e('0x31')]||'')||_0x495fdf['fullname'][_0xa02e('0x3c')]()>_0x59489d[_0xa02e('0x2f')][_0xa02e('0x3c')]()?-0x1:0x1;}}else{if(_0x5a643f===_0xa02e('0x3b')){return _0x495fdf[_0xa02e('0x2f')][_0xa02e('0x3c')]()<_0x59489d[_0xa02e('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return _0x495fdf[_0xa02e('0x2f')]['toLowerCase']()<_0x59489d[_0xa02e('0x2f')][_0xa02e('0x3c')]()?-0x1:0x1;}}}else{if(_0x5a643f==='DESC'){return _0x495fdf[_0xa02e('0x33')]<_0x59489d[_0xa02e('0x33')]?0x1:-0x1;}else{return _0x495fdf[_0xa02e('0x33')]<_0x59489d[_0xa02e('0x33')]?-0x1:0x1;}}});return _0x2e69c2;}exports[_0xa02e('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x29be86){var _0x5192fa=[_0xa02e('0x3e'),'online',_0xa02e('0x3f'),_0xa02e('0x40'),'pauseType',_0xa02e('0x40'),'internal','address',_0xa02e('0x3'),_0xa02e('0x30'),'mailPause',_0xa02e('0x6'),_0xa02e('0x7'),_0xa02e('0x4'),_0xa02e('0xd'),_0xa02e('0x41'),_0xa02e('0x42'),_0xa02e('0x43'),'smsCapacity','whatsappCapacity',_0xa02e('0x44'),'chatCurrentCapacity',_0xa02e('0x45'),_0xa02e('0x46'),_0xa02e('0x47'),_0xa02e('0x48'),_0xa02e('0x49'),'chatStatus',_0xa02e('0x12'),_0xa02e('0x11'),_0xa02e('0x13'),_0xa02e('0x14'),_0xa02e('0x10'),'voiceStatus',_0xa02e('0x4a'),_0xa02e('0x4b'),'mailStatusTime',_0xa02e('0x4c'),'whatsappStatusTime',_0xa02e('0x4d'),_0xa02e('0x4e'),_0xa02e('0x4f'),'destconnectedlinenum',_0xa02e('0x50'),_0xa02e('0x51'),_0xa02e('0x52'),_0xa02e('0x53')];var _0x1ea256=[_0xa02e('0x3'),_0xa02e('0x30'),_0xa02e('0x5'),_0xa02e('0x6'),_0xa02e('0x7'),_0xa02e('0x4'),_0xa02e('0xd'),_0xa02e('0x54')];var _0x12f95e=_(_0x29be86)[_0xa02e('0x55')](_0x1ea256)[_0xa02e('0x56')](_0x5192fa)[_0xa02e('0x29')]();return _0x12f95e;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index c9d3772..7ea9315 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x2f1171,_0x128d87){var _0x561e07=function(_0x1957d8){while(--_0x1957d8){_0x2f1171['push'](_0x2f1171['shift']());}};_0x561e07(++_0x128d87);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4f004f,_0x3ec1ca){var _0x3cd3bf=function(_0x3e7ad8){while(--_0x3e7ad8){_0x4f004f['push'](_0x4f004f['shift']());}};_0x3cd3bf(++_0x3ec1ca);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 18c9ac2..54fc427 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 _0x8c1e=['orderBy','cpus','model','join','createHash','update','digest','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','replace','macAddress','ipAddress','md5','hex','substring','lodash','crypto','networkInterfaces','keys','filter','family','concat','head','mac','address','getFirstInterface'];(function(_0x27d341,_0x3d4c96){var _0x22e218=function(_0x5c2e9f){while(--_0x5c2e9f){_0x27d341['push'](_0x27d341['shift']());}};_0x22e218(++_0x3d4c96);}(_0x8c1e,0x18b));var _0xe8c1=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x8c1e[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xe8c1('0x0'));var os=require('os');var crypto=require(_0xe8c1('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require('../environment');function getInterfaces(){var _0xbabaec=[];var _0x3c64ec=os[_0xe8c1('0x2')]();var _0x71977c=_['orderBy'](_[_0xe8c1('0x3')](_0x3c64ec));for(var _0x25fb4e=0x0;_0x25fb4e<_0x71977c['length'];_0x25fb4e++){var _0x8d5bdf=_0x3c64ec[_0x71977c[_0x25fb4e]][_0xe8c1('0x4')](function(_0x47f543){return _0x47f543[_0xe8c1('0x5')]==='IPv4'&&_0x47f543['internal']===![];});_0xbabaec=_0xbabaec[_0xe8c1('0x6')](_0x8d5bdf);}return _0xbabaec;}function getFirstInterface(){var _0xd249b1=_[_0xe8c1('0x7')](getInterfaces());return{'macAddress':_0xd249b1&&_0xd249b1[_0xe8c1('0x8')]?_0xd249b1[_0xe8c1('0x8')]:'00:00:00:00:00:00','ipAddress':_0xd249b1&&_0xd249b1[_0xe8c1('0x9')]?_0xd249b1[_0xe8c1('0x9')]:'127.0.0.1'};}exports[_0xe8c1('0xa')]=getFirstInterface;function getCPUhash(){var _0x9a7a9a=_[_0xe8c1('0xb')](os[_0xe8c1('0xc')]()['map'](function(_0xfbfe30){return _0xfbfe30[_0xe8c1('0xd')];}))[_0xe8c1('0xe')](':');return crypto[_0xe8c1('0xf')]('md5')[_0xe8c1('0x10')](_0x9a7a9a)[_0xe8c1('0x11')]('hex');}exports['getUuid']=function(){var _0x556a4a=os[_0xe8c1('0x12')]();var _0x1cc160=/[0-9a-f-]{36}/;if(config[_0xe8c1('0x13')]&&_0x1cc160[_0xe8c1('0x14')](config[_0xe8c1('0x13')])){return config[_0xe8c1('0x13')];}else if(_0x556a4a===_0xe8c1('0x15')){return exec(_0xe8c1('0x16'),{'encoding':'utf8'})[_0xe8c1('0x17')]('\x0d\x0a','');}else{var _0x441255=getFirstInterface();var _0x48019b=getCPUhash();var _0x3c7dcd=_0x48019b+'|'+os['hostname']()+'|'+_0x441255[_0xe8c1('0x18')]+'|'+_0x441255[_0xe8c1('0x19')];var _0x2f8ebd=crypto[_0xe8c1('0xf')](_0xe8c1('0x1a'))[_0xe8c1('0x10')](_0x3c7dcd)['digest'](_0xe8c1('0x1b'));return _0x2f8ebd[_0xe8c1('0x1c')](0x0,0x8)+'-'+_0x2f8ebd[_0xe8c1('0x1c')](0x8,0xc)+'-'+_0x2f8ebd['substring'](0xc,0x10)+'-'+_0x2f8ebd[_0xe8c1('0x1c')](0x10,0x14)+'-'+_0x2f8ebd[_0xe8c1('0x1c')](0x14);}}; \ No newline at end of file +var _0x28e2=['filter','family','IPv4','internal','concat','mac','00:00:00:00:00:00','address','orderBy','cpus','map','model','createHash','md5','update','digest','hex','getUuid','licenseToken','win32','utf8','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','length'];(function(_0x53ceef,_0x38c0f0){var _0x257980=function(_0x2dd67d){while(--_0x2dd67d){_0x53ceef['push'](_0x53ceef['shift']());}};_0x257980(++_0x38c0f0);}(_0x28e2,0x143));var _0x228e=function(_0x470fad,_0x24e8ad){_0x470fad=_0x470fad-0x0;var _0x106d4f=_0x28e2[_0x470fad];return _0x106d4f;};'use strict';var _=require(_0x228e('0x0'));var os=require('os');var crypto=require(_0x228e('0x1'));var machine=require(_0x228e('0x2'));var exec=require(_0x228e('0x3'))['execSync'];var config=require(_0x228e('0x4'));function getInterfaces(){var _0x48e6df=[];var _0x267f3c=os[_0x228e('0x5')]();var _0x21e7f1=_['orderBy'](_['keys'](_0x267f3c));for(var _0x7102ac=0x0;_0x7102ac<_0x21e7f1[_0x228e('0x6')];_0x7102ac++){var _0x2b0778=_0x267f3c[_0x21e7f1[_0x7102ac]][_0x228e('0x7')](function(_0x59e0e7){return _0x59e0e7[_0x228e('0x8')]===_0x228e('0x9')&&_0x59e0e7[_0x228e('0xa')]===![];});_0x48e6df=_0x48e6df[_0x228e('0xb')](_0x2b0778);}return _0x48e6df;}function getFirstInterface(){var _0x5592f1=_['head'](getInterfaces());return{'macAddress':_0x5592f1&&_0x5592f1[_0x228e('0xc')]?_0x5592f1['mac']:_0x228e('0xd'),'ipAddress':_0x5592f1&&_0x5592f1[_0x228e('0xe')]?_0x5592f1[_0x228e('0xe')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x15d797=_[_0x228e('0xf')](os[_0x228e('0x10')]()[_0x228e('0x11')](function(_0x56ced7){return _0x56ced7[_0x228e('0x12')];}))['join'](':');return crypto[_0x228e('0x13')](_0x228e('0x14'))[_0x228e('0x15')](_0x15d797)[_0x228e('0x16')](_0x228e('0x17'));}exports[_0x228e('0x18')]=function(){var _0x374b69=os['platform']();var _0x57e63f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x57e63f['test'](config[_0x228e('0x19')])){return config[_0x228e('0x19')];}else if(_0x374b69===_0x228e('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x228e('0x1b')})[_0x228e('0x1c')]('\x0d\x0a','');}else{var _0x5c6718=getFirstInterface();var _0xb09438=getCPUhash();var _0x1ecc39=_0xb09438+'|'+os[_0x228e('0x1d')]()+'|'+_0x5c6718[_0x228e('0x1e')]+'|'+_0x5c6718[_0x228e('0x1f')];var _0x47e4e8=crypto[_0x228e('0x13')](_0x228e('0x14'))[_0x228e('0x15')](_0x1ecc39)[_0x228e('0x16')](_0x228e('0x17'));return _0x47e4e8['substring'](0x0,0x8)+'-'+_0x47e4e8[_0x228e('0x20')](0x8,0xc)+'-'+_0x47e4e8[_0x228e('0x20')](0xc,0x10)+'-'+_0x47e4e8[_0x228e('0x20')](0x10,0x14)+'-'+_0x47e4e8[_0x228e('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b14ca93..3a78e79 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 _0x5e78=['toUpperCase','format','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','version','../../mysqldb','../../components/encryptor','https://www.xcallymotion.com','exports','GET','get','data2','data1','then','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s'];(function(_0xc0cbf,_0x22f493){var _0x24a0ac=function(_0x33e3c9){while(--_0x33e3c9){_0xc0cbf['push'](_0xc0cbf['shift']());}};_0x24a0ac(++_0x22f493);}(_0x5e78,0xc2));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x85e7('0x0'));var moment=require(_0x85e7('0x1'));var rp=require(_0x85e7('0x2'));var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0x85e7('0x3'));var db=require(_0x85e7('0x4'))['db'];var encryptor=require(_0x85e7('0x5'));var hardware=require('./hardware');var logger=require('../logger')('license');var HOST=_0x85e7('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4145a3){return new BPromise(function(_0x20ae40,_0x48ea41){var _0x2cecca=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x4145a3,module[_0x85e7('0x7')][_0x85e7('0x3')]);if(oldToken){_0x2cecca=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4145a3,module[_0x85e7('0x7')][_0x85e7('0x3')],oldToken);}var _0x451593={'uri':_0x2cecca,'method':_0x85e7('0x8'),'timeout':0xea60,'json':!![]};return rp(_0x451593)['then'](function(_0x43f9cb){_0x20ae40(_0x43f9cb);})['catch'](function(_0x2b4d0e){_0x48ea41(_0x2b4d0e);});});}function manageLicense(_0x36d6e1,_0x1d61c4){var _0x5bcfe2=_0x1d61c4[_0x85e7('0x9')]({'plain':!![]});if(!isOldTokenSent&&_0x5bcfe2['data1']!==_0x36d6e1&&!_0x5bcfe2[_0x85e7('0xa')]){oldToken=_0x5bcfe2[_0x85e7('0xb')];}httpRequest(_0x36d6e1)[_0x85e7('0xc')](function(_0x511e0f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x511e0f['active']){isOldTokenSent=![];if(!_0x5bcfe2[_0x85e7('0xd')]&&_0x5bcfe2['license']!=_0x511e0f[_0x85e7('0xd')]||_0x5bcfe2[_0x85e7('0xd')]&&_0x5bcfe2['data2']){logger['info'](_0x85e7('0xe'));}if(_0x5bcfe2[_0x85e7('0xd')]&&!_0x5bcfe2[_0x85e7('0xa')]&&_0x5bcfe2['license']!=_0x511e0f[_0x85e7('0xd')]){logger[_0x85e7('0xf')](_0x85e7('0x10'));}if(_0x5bcfe2[_0x85e7('0xd')]&&!_0x5bcfe2[_0x85e7('0xa')]&&_0x5bcfe2[_0x85e7('0xd')]==_0x511e0f['license']){return _0x1d61c4;}return _0x1d61c4[_0x85e7('0x11')]({'data1':_0x36d6e1,'data2':null,'license':_0x511e0f[_0x85e7('0xd')]});}else{if(_0x511e0f['license']||_0x5bcfe2['license']){if(!_0x5bcfe2[_0x85e7('0xa')]){if(_0x5bcfe2['data1']==_0x36d6e1){GRAY_PERIOD_REASON=_0x85e7('0x12');logger[_0x85e7('0xf')](_0x85e7('0x13'));}else{GRAY_PERIOD_REASON=_0x85e7('0x14');logger[_0x85e7('0xf')](_0x85e7('0x15'),_0x5bcfe2[_0x85e7('0xb')],_0x36d6e1);}logger[_0x85e7('0xf')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x85e7('0x16')](),moment()[_0x85e7('0x17')]('YYYY-MM-DD\x20HH:mm'));return _0x1d61c4[_0x85e7('0x11')]({'data2':encryptor['encryptString'](moment()[_0x85e7('0x17')](_0x85e7('0x18')))});}else{if(moment()[_0x85e7('0x19')](encryptor['decryptString'](_0x5bcfe2[_0x85e7('0xa')]),'days')>DAYS){logger[_0x85e7('0xf')](_0x85e7('0x1a'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1d61c4[_0x85e7('0x11')]({'data1':_0x36d6e1,'data2':null,'license':null});}}}else{if(_0x5bcfe2[_0x85e7('0xb')]!=_0x36d6e1){logger[_0x85e7('0xf')](_0x85e7('0x15'),_0x5bcfe2[_0x85e7('0xb')],_0x36d6e1);return _0x1d61c4['update']({'data1':_0x36d6e1,'data2':null,'license':null});}}}return _0x1d61c4;})[_0x85e7('0xc')](function(_0x5eb92b){_0x1d61c4=_0x5eb92b;})[_0x85e7('0x1b')](function(_0x2f2fe1){logger[_0x85e7('0x1c')](_0x2f2fe1[_0x85e7('0x1d')]);})[_0x85e7('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0x85e7('0x1f')](),_0x1d61c4);},TIME);});}function defaultLicense(){var _0x20d46f=hardware[_0x85e7('0x1f')]();if(_0x20d46f){return db[_0x85e7('0x20')][_0x85e7('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x20d46f}})[_0x85e7('0x22')](function(_0x43f2dd,_0x244974){logger[_0x85e7('0xf')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x20d46f);manageLicense(_0x20d46f,_0x43f2dd);})[_0x85e7('0x1b')](function(_0x3d61d1){logger[_0x85e7('0x1c')](_0x3d61d1[_0x85e7('0x1d')]);});}}exports[_0x85e7('0x23')]=defaultLicense; \ No newline at end of file +var _0x6929=['./hardware','../logger','https://www.xcallymotion.com','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','getUuid','License','spread','default','util','moment','request-promise','pkginfo','version','../../components/encryptor'];(function(_0x3086ee,_0x4634db){var _0x457fad=function(_0x227428){while(--_0x227428){_0x3086ee['push'](_0x3086ee['shift']());}};_0x457fad(++_0x4634db);}(_0x6929,0x150));var _0x9692=function(_0x235f4f,_0x349f61){_0x235f4f=_0x235f4f-0x0;var _0x44afdb=_0x6929[_0x235f4f];return _0x44afdb;};'use strict';var util=require(_0x9692('0x0'));var moment=require(_0x9692('0x1'));var rp=require(_0x9692('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x9692('0x3'))(module,_0x9692('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x9692('0x5'));var hardware=require(_0x9692('0x6'));var logger=require(_0x9692('0x7'))('license');var HOST=_0x9692('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x341bb1){return new BPromise(function(_0x1b6c70,_0x35e209){var _0x3f1f9d=util[_0x9692('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x341bb1,module[_0x9692('0xa')][_0x9692('0x4')]);if(oldToken){_0x3f1f9d=util[_0x9692('0x9')](_0x9692('0xb'),HOST,_0x341bb1,module[_0x9692('0xa')][_0x9692('0x4')],oldToken);}var _0x3dffff={'uri':_0x3f1f9d,'method':_0x9692('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3dffff)['then'](function(_0x7da5c2){_0x1b6c70(_0x7da5c2);})[_0x9692('0xd')](function(_0x579577){_0x35e209(_0x579577);});});}function manageLicense(_0x3578ab,_0x19b266){var _0x29f48b=_0x19b266[_0x9692('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x29f48b[_0x9692('0xf')]!==_0x3578ab&&!_0x29f48b[_0x9692('0x10')]){oldToken=_0x29f48b[_0x9692('0xf')];}httpRequest(_0x3578ab)[_0x9692('0x11')](function(_0x4dd502){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4dd502[_0x9692('0x12')]){isOldTokenSent=![];if(!_0x29f48b[_0x9692('0x13')]&&_0x29f48b[_0x9692('0x13')]!=_0x4dd502[_0x9692('0x13')]||_0x29f48b[_0x9692('0x13')]&&_0x29f48b[_0x9692('0x10')]){logger['info'](_0x9692('0x14'));}if(_0x29f48b[_0x9692('0x13')]&&!_0x29f48b[_0x9692('0x10')]&&_0x29f48b[_0x9692('0x13')]!=_0x4dd502[_0x9692('0x13')]){logger[_0x9692('0x15')](_0x9692('0x16'));}if(_0x29f48b[_0x9692('0x13')]&&!_0x29f48b['data2']&&_0x29f48b[_0x9692('0x13')]==_0x4dd502[_0x9692('0x13')]){return _0x19b266;}return _0x19b266[_0x9692('0x17')]({'data1':_0x3578ab,'data2':null,'license':_0x4dd502['license']});}else{if(_0x4dd502[_0x9692('0x13')]||_0x29f48b[_0x9692('0x13')]){if(!_0x29f48b[_0x9692('0x10')]){if(_0x29f48b[_0x9692('0xf')]==_0x3578ab){GRAY_PERIOD_REASON=_0x9692('0x18');logger[_0x9692('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x9692('0x19');logger[_0x9692('0x15')](_0x9692('0x1a'),_0x29f48b[_0x9692('0xf')],_0x3578ab);}logger[_0x9692('0x15')](_0x9692('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x9692('0x9')](_0x9692('0x1c')));return _0x19b266['update']({'data2':encryptor[_0x9692('0x1d')](moment()[_0x9692('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x9692('0x1e')](encryptor[_0x9692('0x1f')](_0x29f48b[_0x9692('0x10')]),_0x9692('0x20'))>DAYS){logger[_0x9692('0x15')]('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x9692('0x1c')));isOldTokenSent=![];return _0x19b266[_0x9692('0x17')]({'data1':_0x3578ab,'data2':null,'license':null});}}}else{if(_0x29f48b['data1']!=_0x3578ab){logger[_0x9692('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x29f48b[_0x9692('0xf')],_0x3578ab);return _0x19b266[_0x9692('0x17')]({'data1':_0x3578ab,'data2':null,'license':null});}}}return _0x19b266;})[_0x9692('0x11')](function(_0x10faac){_0x19b266=_0x10faac;})['catch'](function(_0x44c588){logger[_0x9692('0x21')](_0x44c588['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x9692('0x22')](),_0x19b266);},TIME);});}function defaultLicense(){var _0x4fe3e6=hardware[_0x9692('0x22')]();if(_0x4fe3e6){return db[_0x9692('0x23')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4fe3e6}})[_0x9692('0x24')](function(_0x31069c,_0x261001){logger[_0x9692('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4fe3e6);manageLicense(_0x4fe3e6,_0x31069c);})[_0x9692('0xd')](function(_0x364af0){logger[_0x9692('0x21')](_0x364af0['message']);});}}exports[_0x9692('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0b58431..e50c66f 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 _0xad3e=['machineUuid','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','telephones','forEach','user','License\x20limit\x20reached\x20for\x20telephones','util','moment','bluebird','./hardware','../../components/encryptor','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','parse'];(function(_0x461206,_0x1745e3){var _0x317e8e=function(_0x300cce){while(--_0x300cce){_0x461206['push'](_0x461206['shift']());}};_0x317e8e(++_0x1745e3);}(_0xad3e,0x1b9));var _0xead3=function(_0x2f743e,_0x31329c){_0x2f743e=_0x2f743e-0x0;var _0x1b4ce2=_0xad3e[_0x2f743e];return _0x1b4ce2;};'use strict';var util=require(_0xead3('0x0'));var _=require('lodash');var moment=require(_0xead3('0x1'));var BPromise=require(_0xead3('0x2'));var hardware=require(_0xead3('0x3'));var encryptor=require(_0xead3('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xead3('0x5'),'machineUuid':hardware[_0xead3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xead3('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xead3('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x17e414){return new BPromise(function(_0x30f4d3,_0x16c808){return db['License'][_0xead3('0x8')](_[_0xead3('0x9')](_0x17e414,{'raw':!![],'where':{'id':0x1}}))[_0xead3('0xa')](function(_0x4dce11){return checkLicense(_0x4dce11,null);})[_0xead3('0xa')](function(_0x2a9980){_0x30f4d3(_0x2a9980);return;})[_0xead3('0xb')](function(_0x1f4c67){_0x16c808(_0x1f4c67);});});}function checkLicense(_0x3424f9,_0x3f8d3a){if(!_0x3424f9){demoLicense[_0xead3('0xc')]=_0x3424f9[_0xead3('0xd')];return demoLicense;}try{var _0x2704e3=_0x3f8d3a||_0x3424f9[_0xead3('0xe')];if(_[_0xead3('0xf')](_0x2704e3)){throw new Error(_0xead3('0x10'));}var _0x4f2a73=_0x3424f9[_0xead3('0xd')];var _0x49a161=_0x3424f9['data2'];var _0x5cf14=_0x4f2a73[_0xead3('0x11')]('-')[0x4];var _0x4ce635=_0x4f2a73['split']('-')[0x0];var _0x89178=encryptor[_0xead3('0x12')](_0x2704e3,util[_0xead3('0x13')]('%s:%s:%s',_0x5cf14,_0x4f2a73,_0x4ce635));var _0x513e0a=JSON[_0xead3('0x14')](_0x89178);_0x513e0a['demo']=![];_0x513e0a[_0xead3('0xc')]=_0x4f2a73;_0x513e0a[_0xead3('0x15')]=hardware[_0xead3('0x6')]();if(_0x49a161){var _0x58fd4d=encryptor[_0xead3('0x12')](_0x49a161);_0x513e0a['gray']=_0x58fd4d;_0x513e0a['deadline']=moment(_0x58fd4d)[_0xead3('0x16')](0x7,_0xead3('0x17'))[_0xead3('0x13')]();_0x513e0a[_0xead3('0x18')]=_0x513e0a[_0xead3('0xc')]!=_0x513e0a[_0xead3('0x15')]?_0xead3('0x19'):_0xead3('0x1a');}return _0x513e0a;}catch(_0x52cd0b){breakingLicense[_0xead3('0xc')]=_0x3424f9[_0xead3('0xd')];breakingLicense[_0xead3('0x1b')]=_0x52cd0b[_0xead3('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xb0b12b,_0x3fe5fc){getLicense()[_0xead3('0xa')](function(_0x21a3d9){return db[_0xead3('0x1c')][_0xead3('0x1d')]({'attributes':[_0xead3('0x1e'),[db[_0xead3('0x1f')]['fn'](_0xead3('0x20'),db['sequelize'][_0xead3('0x21')](_0xead3('0x1e'))),_0xead3('0x22')]],'group':_0xead3('0x1e'),'where':{'role':{'$or':[_0xead3('0x23'),'user',_0xead3('0x24')]}},'raw':!![]})[_0xead3('0xa')](function(_0x1b6385){var _0x460a1a={'user':_0x21a3d9[_0xead3('0x25')]||0x0,'telephone':_0x21a3d9[_0xead3('0x26')]||0x0};_0x1b6385[_0xead3('0x27')](function(_0x4e5f3f){var _0x9a41cd=_0x4e5f3f[_0xead3('0x1e')]===_0xead3('0x23')?_0xead3('0x28'):_0x4e5f3f[_0xead3('0x1e')];_0x460a1a[_0x9a41cd]-=_0x4e5f3f['count'];if(_0x460a1a[_0x9a41cd]<0x0)_0x460a1a[_0x9a41cd]=0x0;});_0xb0b12b(_0x460a1a);return;});})[_0xead3('0xb')](function(_0xa641c){_0x3fe5fc(_0xa641c);});});}function checkUserLimits(_0x2acd61){return new BPromise(function(_0x388297,_0x5e13fe){getLimits()[_0xead3('0xa')](function(_0x8d3925){var _0x5457c2=_['pick'](_['countBy'](_0x2acd61,_0xead3('0x1e')),[_0xead3('0x23'),_0xead3('0x28'),_0xead3('0x24')]);var _0x1e5699=(_0x5457c2[_0xead3('0x23')]||0x0)+(_0x5457c2[_0xead3('0x28')]||0x0);var _0xcf4457=_0x5457c2[_0xead3('0x24')]||0x0;if(_0x1e5699>_0x8d3925['user'])return _0x5e13fe('License\x20limit\x20reached\x20for\x20users');if(_0xcf4457>_0x8d3925[_0xead3('0x24')])return _0x5e13fe(_0xead3('0x29'));return _0x388297();})[_0xead3('0xb')](function(_0x4ee937){_0x5e13fe(_0x4ee937);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x814e=['Breaking\x20license','find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','message','User','findAll','sequelize','COUNT','admin','user','telephone','telephones','forEach','role','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid'];(function(_0x2deb2b,_0x35f4e5){var _0x5836a0=function(_0x10d89b){while(--_0x10d89b){_0x2deb2b['push'](_0x2deb2b['shift']());}};_0x5836a0(++_0x35f4e5);}(_0x814e,0xb2));var _0xe814=function(_0x3db65a,_0x5b8b81){_0x3db65a=_0x3db65a-0x0;var _0x58e92b=_0x814e[_0x3db65a];return _0x58e92b;};'use strict';var util=require('util');var _=require(_0xe814('0x0'));var moment=require(_0xe814('0x1'));var BPromise=require('bluebird');var hardware=require(_0xe814('0x2'));var encryptor=require(_0xe814('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe814('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xe814('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe814('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe814('0x6'),'machineUuid':hardware[_0xe814('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4760ea){return new BPromise(function(_0x1f2c41,_0x4e85a1){return db['License'][_0xe814('0x7')](_[_0xe814('0x8')](_0x4760ea,{'raw':!![],'where':{'id':0x1}}))[_0xe814('0x9')](function(_0x5529dc){return checkLicense(_0x5529dc,null);})[_0xe814('0x9')](function(_0x544660){_0x1f2c41(_0x544660);return;})['catch'](function(_0x269a2c){_0x4e85a1(_0x269a2c);});});}function checkLicense(_0x437dff,_0x44b485){if(!_0x437dff){demoLicense[_0xe814('0xa')]=_0x437dff[_0xe814('0xb')];return demoLicense;}try{var _0x5e21e8=_0x44b485||_0x437dff[_0xe814('0xc')];if(_[_0xe814('0xd')](_0x5e21e8)){throw new Error(_0xe814('0xe'));}var _0x488f0a=_0x437dff['data1'];var _0x10548f=_0x437dff[_0xe814('0xf')];var _0x32811e=_0x488f0a[_0xe814('0x10')]('-')[0x4];var _0x46b6b9=_0x488f0a[_0xe814('0x10')]('-')[0x0];var _0x5c057d=encryptor[_0xe814('0x11')](_0x5e21e8,util[_0xe814('0x12')](_0xe814('0x13'),_0x32811e,_0x488f0a,_0x46b6b9));var _0x4cb9e5=JSON[_0xe814('0x14')](_0x5c057d);_0x4cb9e5[_0xe814('0x15')]=![];_0x4cb9e5[_0xe814('0xa')]=_0x488f0a;_0x4cb9e5[_0xe814('0x16')]=hardware[_0xe814('0x5')]();if(_0x10548f){var _0x22806a=encryptor[_0xe814('0x11')](_0x10548f);_0x4cb9e5[_0xe814('0x17')]=_0x22806a;_0x4cb9e5[_0xe814('0x18')]=moment(_0x22806a)[_0xe814('0x19')](0x7,_0xe814('0x1a'))[_0xe814('0x12')]();_0x4cb9e5[_0xe814('0x1b')]=_0x4cb9e5['uuid']!=_0x4cb9e5[_0xe814('0x16')]?_0xe814('0x1c'):'disabled';}return _0x4cb9e5;}catch(_0x5b3895){breakingLicense[_0xe814('0xa')]=_0x437dff[_0xe814('0xb')];breakingLicense[_0xe814('0x1d')]=_0x5b3895['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0xdb7104,_0x43a738){getLicense()[_0xe814('0x9')](function(_0x583411){return db[_0xe814('0x1e')][_0xe814('0x1f')]({'attributes':['role',[db[_0xe814('0x20')]['fn'](_0xe814('0x21'),db['sequelize']['col']('role')),'count']],'group':'role','where':{'role':{'$or':[_0xe814('0x22'),_0xe814('0x23'),_0xe814('0x24')]}},'raw':!![]})[_0xe814('0x9')](function(_0x705d75){var _0x1c16ed={'user':_0x583411['users']||0x0,'telephone':_0x583411[_0xe814('0x25')]||0x0};_0x705d75[_0xe814('0x26')](function(_0x5457a9){var _0x269889=_0x5457a9[_0xe814('0x27')]===_0xe814('0x22')?'user':_0x5457a9[_0xe814('0x27')];_0x1c16ed[_0x269889]-=_0x5457a9['count'];if(_0x1c16ed[_0x269889]<0x0)_0x1c16ed[_0x269889]=0x0;});_0xdb7104(_0x1c16ed);return;});})[_0xe814('0x28')](function(_0x551522){_0x43a738(_0x551522);});});}function checkUserLimits(_0x47b5a1){return new BPromise(function(_0x4eb7e6,_0x189655){getLimits()['then'](function(_0x244325){var _0x9edca=_[_0xe814('0x29')](_[_0xe814('0x2a')](_0x47b5a1,_0xe814('0x27')),[_0xe814('0x22'),_0xe814('0x23'),_0xe814('0x24')]);var _0x41987d=(_0x9edca[_0xe814('0x22')]||0x0)+(_0x9edca[_0xe814('0x23')]||0x0);var _0x42b592=_0x9edca[_0xe814('0x24')]||0x0;if(_0x41987d>_0x244325['user'])return _0x189655(_0xe814('0x2b'));if(_0x42b592>_0x244325[_0xe814('0x24')])return _0x189655(_0xe814('0x2c'));return _0x4eb7e6();})[_0xe814('0x28')](function(_0x57967e){_0x189655(_0x57967e);});});}module[_0xe814('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 5c6e89c..f3acc98 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 _0x66fa=['http://localhost:9000','app-id','secret','exports'];(function(_0x2cd9a5,_0x4ccf41){var _0x33cb6e=function(_0x5f2843){while(--_0x5f2843){_0x2cd9a5['push'](_0x2cd9a5['shift']());}};_0x33cb6e(++_0x4ccf41);}(_0x66fa,0x117));var _0xa66f=function(_0x14ca6d,_0x8253d2){_0x14ca6d=_0x14ca6d-0x0;var _0x482c4d=_0x66fa[_0x14ca6d];return _0x482c4d;};'use strict';module[_0xa66f('0x0')]={'DOMAIN':_0xa66f('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0xa66f('0x2'),'GOOGLE_SECRET':_0xa66f('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x59616b,_0x38e534){var _0x5c4523=function(_0x166f2e){while(--_0x166f2e){_0x59616b['push'](_0x59616b['shift']());}};_0x5c4523(++_0x38e534);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x5c3c[_0x5037ab];return _0x512adb;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f441546..ea1598a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01b2=['../utils/loggers','fileLogger','exports'];(function(_0x2e281e,_0x2c574a){var _0x594f3c=function(_0x3ae01a){while(--_0x3ae01a){_0x2e281e['push'](_0x2e281e['shift']());}};_0x594f3c(++_0x2c574a);}(_0x01b2,0x1e3));var _0x201b=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x01b2[_0x2b9e8a];return _0x520e67;};'use strict';var fileLogger=require(_0x201b('0x0'))[_0x201b('0x1')];module[_0x201b('0x2')]=fileLogger; \ No newline at end of file +var _0x4c2b=['../utils/loggers','fileLogger','exports'];(function(_0x30e248,_0x184cce){var _0x4deedd=function(_0x574a7d){while(--_0x574a7d){_0x30e248['push'](_0x30e248['shift']());}};_0x4deedd(++_0x184cce);}(_0x4c2b,0xed));var _0xb4c2=function(_0x23ea5f,_0x19658a){_0x23ea5f=_0x23ea5f-0x0;var _0x45a899=_0x4c2b[_0x23ea5f];return _0x45a899;};'use strict';var fileLogger=require(_0xb4c2('0x0'))[_0xb4c2('0x1')];module[_0xb4c2('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index b61c69a..5880709 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 _0xc70f=['../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','express'];(function(_0x7ed0b0,_0x49a500){var _0x56fd39=function(_0x3416e9){while(--_0x3416e9){_0x7ed0b0['push'](_0x7ed0b0['shift']());}};_0x56fd39(++_0x49a500);}(_0xc70f,0x73));var _0xfc70=function(_0x4a62cd,_0xc77f99){_0x4a62cd=_0x4a62cd-0x0;var _0x7c947e=_0xc70f[_0x4a62cd];return _0x7c947e;};'use strict';var path=require(_0xfc70('0x0'));var os=require('os');var config={'apps':[{'name':_0xfc70('0x1'),'script':path['join'](__dirname,_0xfc70('0x2'))},{'name':_0xfc70('0x3'),'script':path[_0xfc70('0x4')](__dirname,_0xfc70('0x5'))},{'name':_0xfc70('0x6'),'script':path[_0xfc70('0x4')](__dirname,_0xfc70('0x7'))},{'name':_0xfc70('0x8'),'script':path[_0xfc70('0x4')](__dirname,_0xfc70('0x9'))},{'name':'routing','script':path[_0xfc70('0x4')](__dirname,_0xfc70('0xa'))},{'name':_0xfc70('0xb'),'script':path[_0xfc70('0x4')](__dirname,_0xfc70('0xc'))}]};module['exports']=config; \ No newline at end of file +var _0x7f64=['../../services/express/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','path','join'];(function(_0x240984,_0xd35102){var _0x36f7a6=function(_0x115759){while(--_0x115759){_0x240984['push'](_0x240984['shift']());}};_0x36f7a6(++_0xd35102);}(_0x7f64,0x1b6));var _0x47f6=function(_0xf6aed6,_0x48a505){_0xf6aed6=_0xf6aed6-0x0;var _0x4834b7=_0x7f64[_0xf6aed6];return _0x4834b7;};'use strict';var path=require(_0x47f6('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x47f6('0x1')](__dirname,_0x47f6('0x2'))},{'name':'ami','script':path[_0x47f6('0x1')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x47f6('0x1')](__dirname,_0x47f6('0x3'))},{'name':_0x47f6('0x4'),'script':path[_0x47f6('0x1')](__dirname,_0x47f6('0x5'))},{'name':_0x47f6('0x6'),'script':path[_0x47f6('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0x47f6('0x7'),'script':path[_0x47f6('0x1')](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9c74a46..a1584e1 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 _0x5133=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect'];(function(_0x493c7a,_0x30ea93){var _0x1ad499=function(_0x5c8318){while(--_0x5c8318){_0x493c7a['push'](_0x493c7a['shift']());}};_0x1ad499(++_0x30ea93);}(_0x5133,0xbd));var _0x3513=function(_0x412e1f,_0x1d3bbb){_0x412e1f=_0x412e1f-0x0;var _0x85aca7=_0x5133[_0x412e1f];return _0x85aca7;};'use strict';var pm2=require(_0x3513('0x0'));var BPromise=require(_0x3513('0x1'));var config=require(_0x3513('0x2'));function connect(){return new BPromise(function(_0x2a3885,_0x21baf2){return pm2['connect'](function(_0x4b61ef){if(_0x4b61ef){return _0x21baf2(_0x4b61ef);}return _0x2a3885(_0x3513('0x3'));});});};exports[_0x3513('0x4')]=function(_0x2bea28){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x264dbf,_0x21d729){return pm2['start'](_0x2bea28,function(_0x179902,_0x563e25){if(_0x179902){return _0x21d729(_0x179902);}pm2[_0x3513('0x6')]();return _0x264dbf(_0x563e25);});});});};exports['stop']=function(_0x56407e){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x885a14,_0x10a125){return pm2[_0x3513('0x7')](_0x56407e,function(_0x29055c,_0x268490){if(_0x29055c){return _0x10a125(_0x29055c);}pm2[_0x3513('0x6')]();return _0x885a14(_0x268490);});});});};exports[_0x3513('0x8')]=function(_0xb1b59f){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x5b4e10,_0x1117b7){return pm2['restart'](_0xb1b59f,function(_0x28c3f3,_0x4f0dfa){if(_0x28c3f3){return _0x1117b7(_0x28c3f3);}pm2['disconnect']();return _0x5b4e10(_0x4f0dfa);});});});};exports[_0x3513('0x9')]=function(){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x47cd3,_0x51a6af){return pm2[_0x3513('0x9')](function(_0x469733,_0x3a4420){if(_0x469733){return _0x51a6af(_0x469733);}pm2['disconnect']();return _0x47cd3(_0x3a4420);});});});};exports['describe']=function(_0xd19c9a){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x27a60d,_0xd0cb10){return pm2[_0x3513('0xa')](_0xd19c9a,function(_0x4df203,_0x3d159f){if(_0x4df203){return _0xd0cb10(_0x4df203);}pm2[_0x3513('0x6')]();return _0x27a60d(_0x3d159f);});});});};exports[_0x3513('0xb')]=function(_0x295094){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x5cb668,_0x2b82ad){return pm2[_0x3513('0xb')](_0x295094,function(_0x278ba1,_0x25a9ce){if(_0x278ba1){return _0x2b82ad(_0x278ba1);}pm2['disconnect']();return _0x5cb668(_0x25a9ce);});});});};exports[_0x3513('0xc')]=function(){return connect()[_0x3513('0x5')](function(){return new BPromise(function(_0x1c0a20,_0x4e44ab){return pm2[_0x3513('0xc')](function(_0x2bd210){if(_0x2bd210){return _0x4e44ab(_0x2bd210);}return _0x1c0a20(_0x3513('0xd'));});});});}; \ No newline at end of file +var _0xb589=['describe','delete','dump','saved','pm2','bluebird','./config','connected','start','then','disconnect','stop','restart','list'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xb589,0x138));var _0x9b58=function(_0x510b08,_0x16cd04){_0x510b08=_0x510b08-0x0;var _0xbf9488=_0xb589[_0x510b08];return _0xbf9488;};'use strict';var pm2=require(_0x9b58('0x0'));var BPromise=require(_0x9b58('0x1'));var config=require(_0x9b58('0x2'));function connect(){return new BPromise(function(_0x3fa882,_0x2c2f91){return pm2['connect'](function(_0x5ab8c3){if(_0x5ab8c3){return _0x2c2f91(_0x5ab8c3);}return _0x3fa882(_0x9b58('0x3'));});});};exports[_0x9b58('0x4')]=function(_0x1dea6b){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0x5325d0,_0x238bb2){return pm2[_0x9b58('0x4')](_0x1dea6b,function(_0xdd1cb5,_0x2d53b7){if(_0xdd1cb5){return _0x238bb2(_0xdd1cb5);}pm2[_0x9b58('0x6')]();return _0x5325d0(_0x2d53b7);});});});};exports['stop']=function(_0x2f5e4a){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0x2e0a14,_0x8288e){return pm2[_0x9b58('0x7')](_0x2f5e4a,function(_0x525407,_0x366419){if(_0x525407){return _0x8288e(_0x525407);}pm2[_0x9b58('0x6')]();return _0x2e0a14(_0x366419);});});});};exports[_0x9b58('0x8')]=function(_0x57ee63){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0xe2d315,_0x2a174c){return pm2[_0x9b58('0x8')](_0x57ee63,function(_0x2fd5d5,_0x3558ad){if(_0x2fd5d5){return _0x2a174c(_0x2fd5d5);}pm2[_0x9b58('0x6')]();return _0xe2d315(_0x3558ad);});});});};exports[_0x9b58('0x9')]=function(){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0x391967,_0x50d4c9){return pm2['list'](function(_0x309683,_0x427c94){if(_0x309683){return _0x50d4c9(_0x309683);}pm2[_0x9b58('0x6')]();return _0x391967(_0x427c94);});});});};exports[_0x9b58('0xa')]=function(_0x2455c5){return connect()['then'](function(){return new BPromise(function(_0x396e15,_0x1233c4){return pm2[_0x9b58('0xa')](_0x2455c5,function(_0x48e18e,_0x44399a){if(_0x48e18e){return _0x1233c4(_0x48e18e);}pm2[_0x9b58('0x6')]();return _0x396e15(_0x44399a);});});});};exports[_0x9b58('0xb')]=function(_0x243989){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0xb82260,_0x25e262){return pm2['delete'](_0x243989,function(_0x39f0ac,_0x21ba20){if(_0x39f0ac){return _0x25e262(_0x39f0ac);}pm2[_0x9b58('0x6')]();return _0xb82260(_0x21ba20);});});});};exports['dump']=function(){return connect()[_0x9b58('0x5')](function(){return new BPromise(function(_0x86e403,_0x3c8b50){return pm2[_0x9b58('0xc')](function(_0x8c2572){if(_0x8c2572){return _0x3c8b50(_0x8c2572);}return _0x86e403(_0x9b58('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f649067..fee1edb 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 _0x60ef=['subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x279b47,_0x498ac7){var _0x1dd61a=function(_0xc56463){while(--_0xc56463){_0x279b47['push'](_0x279b47['shift']());}};_0x1dd61a(++_0x498ac7);}(_0x60ef,0x6b));var _0xf60e=function(_0x2a62b7,_0x2bda4e){_0x2a62b7=_0x2a62b7-0x0;var _0x1fcdf3=_0x60ef[_0x2a62b7];return _0x1fcdf3;};'use strict';var _=require(_0xf60e('0x0'));var moment=require('moment');var Redis=require(_0xf60e('0x1'));var util=require(_0xf60e('0x2'));var config=require(_0xf60e('0x3'));var db=require(_0xf60e('0x4'))['db'];var logger=require(_0xf60e('0x5'))(_0xf60e('0x6'));config[_0xf60e('0x7')]=_[_0xf60e('0x8')](config[_0xf60e('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xf60e('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x13835f=0x0;var _0x13974c=[];return db[_0xf60e('0xa')][_0xf60e('0xb')]({'raw':!![],'attributes':['id',_0xf60e('0xc')],'where':{'id':0x1}})[_0xf60e('0xd')](function(_0x14423c){_0x13835f=_0x14423c[_0xf60e('0xc')];if(_0x13835f){return db[_0xf60e('0xe')][_0xf60e('0xf')]({'raw':!![],'attributes':['id',_0xf60e('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf60e('0x11')](_0x14423c[_0xf60e('0xc')],_0xf60e('0x12'))}}});}else{return[];}})['then'](function(_0x205d02){if(_0x205d02&&_0x205d02[_0xf60e('0x13')]){_0x13974c=_['map'](_0x205d02||[],'id');logger[_0xf60e('0x14')](_0xf60e('0x15'),_0x13974c[_0xf60e('0x16')]());return db['ChatInteraction'][_0xf60e('0x17')]({'closeReason':_0xf60e('0x18'),'disposition':'timeout','closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x13974c}});}})[_0xf60e('0xd')](function(){if(_0x13974c&&_0x13974c[_0xf60e('0x13')]){logger[_0xf60e('0x14')](_0xf60e('0x19'),_0x13974c[_0xf60e('0x16')]());for(var _0x5a3596=0x0;_0x5a3596<_0x13974c[_0xf60e('0x13')];_0x5a3596++){io[_0xf60e('0x1a')](_0xf60e('0x1b'),{'id':_0x13974c[_0x5a3596],'closed':!![]});}}})['catch'](function(_0x3fe60c){logger[_0xf60e('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x3fe60c?util[_0xf60e('0x1d')](_0x3fe60c,{'showHidden':![],'depth':null}):'');});}exports[_0xf60e('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf195=['[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','lodash','ioredis','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf195,0x95));var _0x5f19=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0xf195[_0x202d24];return _0x2b3a8e;};'use strict';var _=require(_0x5f19('0x0'));var moment=require('moment');var Redis=require(_0x5f19('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0x5f19('0x2'))['db'];var logger=require(_0x5f19('0x3'))(_0x5f19('0x4'));config[_0x5f19('0x5')]=_[_0x5f19('0x6')](config[_0x5f19('0x5')],{'host':_0x5f19('0x7'),'port':0x18eb});var io=require(_0x5f19('0x8'))(new Redis(config[_0x5f19('0x5')]));function closeInteractions(){var _0x3a6801=0x0;var _0x43e1dd=[];return db[_0x5f19('0x9')][_0x5f19('0xa')]({'raw':!![],'attributes':['id',_0x5f19('0xb')],'where':{'id':0x1}})[_0x5f19('0xc')](function(_0x557218){_0x3a6801=_0x557218['chatTimeout'];if(_0x3a6801){return db[_0x5f19('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x5f19('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x557218[_0x5f19('0xb')],_0x5f19('0xf'))}}});}else{return[];}})[_0x5f19('0xc')](function(_0x2c8535){if(_0x2c8535&&_0x2c8535[_0x5f19('0x10')]){_0x43e1dd=_[_0x5f19('0x11')](_0x2c8535||[],'id');logger[_0x5f19('0x12')](_0x5f19('0x13'),_0x43e1dd[_0x5f19('0x14')]());return db['ChatInteraction'][_0x5f19('0x15')]({'closeReason':_0x5f19('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x5f19('0x17')](_0x5f19('0x18'))},{'where':{'id':_0x43e1dd}});}})[_0x5f19('0xc')](function(){if(_0x43e1dd&&_0x43e1dd[_0x5f19('0x10')]){logger[_0x5f19('0x12')](_0x5f19('0x19'),_0x43e1dd[_0x5f19('0x14')]());for(var _0x5b50de=0x0;_0x5b50de<_0x43e1dd['length'];_0x5b50de++){io['emit'](_0x5f19('0x1a'),{'id':_0x43e1dd[_0x5b50de],'closed':!![]});}}})[_0x5f19('0x1b')](function(_0x1eb1c4){logger[_0x5f19('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1eb1c4?util['inspect'](_0x1eb1c4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 6bd15af..2db98f4 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 _0x3dbd=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x42e7e1,_0x15d392){var _0x39995b=function(_0x5ee15d){while(--_0x5ee15d){_0x42e7e1['push'](_0x42e7e1['shift']());}};_0x39995b(++_0x15d392);}(_0x3dbd,0x18f));var _0xd3db=function(_0x5ab90e,_0x9d6d92){_0x5ab90e=_0x5ab90e-0x0;var _0x546739=_0x3dbd[_0x5ab90e];return _0x546739;};'use strict';function start(){var _0x5af5d8=require(_0xd3db('0x0'));return _0x5af5d8[_0xd3db('0x1')]();}module[_0xd3db('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x2916=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x30b05a,_0x2ba28f){var _0x271b17=function(_0x21de41){while(--_0x21de41){_0x30b05a['push'](_0x30b05a['shift']());}};_0x271b17(++_0x2ba28f);}(_0x2916,0x18e));var _0x6291=function(_0x2efe86,_0x4b6c3f){_0x2efe86=_0x2efe86-0x0;var _0x48e01c=_0x2916[_0x2efe86];return _0x48e01c;};'use strict';function start(){var _0x4fdf7b=require(_0x6291('0x0'));return _0x4fdf7b['startAllRefreshIntervals']();}module[_0x6291('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index d13c6e2..2fd1127 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 _0x365f=['Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','catch','CustomReportId','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','toString','keyBy','difference','intersection','exists','delete\x20cron','my\x20id','resolve','cron','active','startAt','endAt','add','start','add\x20cron','stop','deleteJob','length','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','email\x20sent','data'];(function(_0xb0ad22,_0x27723b){var _0x40de30=function(_0x144c29){while(--_0x144c29){_0xb0ad22['push'](_0xb0ad22['shift']());}};_0x40de30(++_0x27723b);}(_0x365f,0x7c));var _0xf365=function(_0x2accf7,_0x24ee91){_0x2accf7=_0x2accf7-0x0;var _0x2b18e0=_0x365f[_0x2accf7];return _0x2b18e0;};'use strict';var fs=require('fs');var util=require(_0xf365('0x0'));var path=require(_0xf365('0x1'));var _=require(_0xf365('0x2'));var moment=require(_0xf365('0x3'));var CronJobManager=require(_0xf365('0x4'));var jayson=require(_0xf365('0x5'));var BPromise=require(_0xf365('0x6'));var logger=require(_0xf365('0x7'))(_0xf365('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xf365('0x9'));var analyticDefaultReportController=require(_0xf365('0xa'));var client=jayson[_0xf365('0xb')][_0xf365('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3029d2,_0x23eabd){return function(){logger[_0xf365('0xd')](_0xf365('0xe'),_0x3029d2['email']);var _0x1ee059=!![];var _0x2f2f4e=_0x3029d2['MailAccount'][_0xf365('0xf')]();var _0x3fd9f1={'account':_0x2f2f4e,'message':{'from':util[_0xf365('0x10')](_0xf365('0x11'),_0x3029d2[_0xf365('0x12')][_0xf365('0x13')],_0x3029d2[_0xf365('0x12')][_0xf365('0x14')]||_0x3029d2['MailAccount']['Smtp'][_0xf365('0x15')]),'to':_0x3029d2['email'],'cc':_0x3029d2['cc'],'bcc':_0x3029d2[_0xf365('0x16')],'subject':util['format'](_0xf365('0x17'),_0x23eabd[_0xf365('0x13')],_0x3029d2[_0xf365('0x18')],_0x3029d2[_0xf365('0x19')])}};var _0x3b9a42=path[_0xf365('0x1a')](__dirname,_0xf365('0x1b'));var _0x29f0a3=_0x23eabd[_0xf365('0x1c')];var _0x255d0d=util[_0xf365('0x10')](_0xf365('0x1d'),path[_0xf365('0x1e')](_0x23eabd['savename'],path[_0xf365('0x1f')](_0x23eabd[_0xf365('0x1c')])),'zip');var _0x427d6a=path[_0xf365('0x1a')](_0x3b9a42,_0x29f0a3);var _0x96d757=path[_0xf365('0x1a')](_0x3b9a42,_0x255d0d);if(fs[_0xf365('0x20')](_0x427d6a)){_0x23eabd[_0xf365('0x21')]=_0xf365('0x22');_0x3fd9f1[_0xf365('0x23')][_0xf365('0x24')]=[{'filename':_0x29f0a3,'path':_0x427d6a}];_0x3fd9f1[_0xf365('0x23')][_0xf365('0x25')]=util[_0xf365('0x10')](_0xf365('0x26'),JSON[_0xf365('0x27')](_0x23eabd,null,0x2));}else if(fs[_0xf365('0x20')](_0x96d757)){_0x23eabd[_0xf365('0x21')]=_0xf365('0x22');_0x3fd9f1['message'][_0xf365('0x24')]=[{'filename':_0x255d0d,'path':_0x96d757}];}else{_0x3fd9f1['message'][_0xf365('0x25')]=_0xf365('0x28');if(!_0x3029d2['sendIfEmpty']){_0x1ee059=![];logger[_0xf365('0xd')](_0xf365('0x29'));}}if(_0x1ee059){return client['request']('SendMail',_0x3fd9f1)['then'](function(_0x374ebd){if(_0x374ebd[_0xf365('0x2a')]){return logger['error'](_0xf365('0x2b'),JSON[_0xf365('0x27')](_0x374ebd));}return logger[_0xf365('0xd')](_0xf365('0x2c'));})['catch'](function(_0x3d6c2e){return logger['error'](_0xf365('0x2b'),JSON[_0xf365('0x27')](_0x3d6c2e));});}};}function handleError(){return function(_0x376986){return logger[_0xf365('0x2a')](JSON[_0xf365('0x27')](_0x376986));};}function handleResult(_0x8b897b){return function(_0x21ecf0){logger[_0xf365('0xd')](_0xf365('0x2d'),JSON['stringify'](_0x21ecf0));if(_0x8b897b[_0xf365('0x12')]&&_0x8b897b[_0xf365('0x12')][_0xf365('0x2e')]&&!_[_0xf365('0x2f')](_0x8b897b[_0xf365('0x14')])){setTimeout(handleSendEmail(_0x8b897b,_0x21ecf0),0x3c*0x3e8);}};}function handleJob(_0xfd70f0){return function(){try{if(_[_0xf365('0x2f')](_0xfd70f0[_0xf365('0x18')])){return logger[_0xf365('0xd')](_0xf365('0x30'));}if(_[_0xf365('0x2f')](_0xfd70f0[_0xf365('0x19')])){return logger[_0xf365('0xd')]('subtractUnit\x20null\x20or\x20undefined');}var _0xede89c={'startDate':moment()[_0xf365('0x31')](_0xfd70f0[_0xf365('0x18')],_0xfd70f0[_0xf365('0x19')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0xf365('0x32')),'type':_0xf365('0x33'),'output':_0xfd70f0[_0xf365('0x34')],'name':_0xfd70f0[_0xf365('0x13')]};if(!_['isNil'](_0xfd70f0['DefaultReportId'])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0xfd70f0[_0xf365('0x35')]);return analyticDefaultReportController[_0xf365('0x36')]({'id':_0xfd70f0[_0xf365('0x35')]},_0xede89c)[_0xf365('0x37')](handleResult(_0xfd70f0))[_0xf365('0x38')](handleError());}if(!_['isNil'](_0xfd70f0['CustomReportId'])){logger[_0xf365('0xd')]('exec\x20custom\x20report\x20id:%s',_0xfd70f0[_0xf365('0x39')]);return analyticCustomReportController[_0xf365('0x36')]({'id':_0xfd70f0[_0xf365('0x39')]},_0xede89c)[_0xf365('0x37')](handleResult(_0xfd70f0))[_0xf365('0x38')](handleError());}}catch(_0x52477a){logger[_0xf365('0x2a')](JSON[_0xf365('0x27')](_0x52477a));}return logger[_0xf365('0xd')](_0xf365('0x3a'));};}function getJobs(_0x102bc3){var _0x15e51e={};if(_0x102bc3){_0x15e51e['id']=_0x102bc3;}return db['Schedule'][_0xf365('0x3b')]({'where':_0x15e51e,'include':[{'model':db['MailAccount'],'attributes':['id',_0xf365('0x13'),_0xf365('0x14')],'include':[{'model':db[_0xf365('0x3c')],'as':_0xf365('0x2e'),'include':[{'model':db[_0xf365('0x3d')],'as':_0xf365('0x3d')}]}]}]})[_0xf365('0x37')](function(_0x5746a6){var _0x590fbb=_[_0xf365('0x3e')](manager['jobs']);var _0x51439c=_['map'](_0x5746a6,function(_0x3cf8ad){return _0x3cf8ad['id'][_0xf365('0x3f')]();});var _0x4732f6=_[_0xf365('0x40')](_0x5746a6,function(_0x2b20e7){return _0x2b20e7['id']['toString']();});var _0x2269f6=_0x102bc3?_0x51439c:_[_0xf365('0x41')](_0x51439c,_0x590fbb);var _0xb291fa=_[_0xf365('0x42')](_0x51439c,_0x590fbb);var _0x16dc68=_[_0xf365('0x41')](_0x590fbb,_0x51439c);var _0x36bd4b;var _0x2b7a95;for(_0x36bd4b=0x0;_0x36bd4b<_0x16dc68['length']&&!_0x102bc3;_0x36bd4b+=0x1){_0x2b7a95=_0x16dc68[_0x36bd4b][_0xf365('0x3f')]();if(manager[_0xf365('0x43')](_0x2b7a95)){manager['stop'](_0x2b7a95);manager['deleteJob'](_0x2b7a95);logger[_0xf365('0xd')](_0xf365('0x44'),_0x2b7a95);}}logger[_0xf365('0xd')]('toRun',JSON[_0xf365('0x27')](_0x2269f6));for(_0x36bd4b=0x0;_0x36bd4b<_0x2269f6['length'];_0x36bd4b+=0x1){_0x2b7a95=_0x2269f6[_0x36bd4b][_0xf365('0x3f')]();logger[_0xf365('0xd')]('index',_0x2b7a95);if(_0x102bc3){logger[_0xf365('0xd')](_0xf365('0x45'),_0x102bc3);logger[_0xf365('0xd')](JSON[_0xf365('0x27')](_0x4732f6[_0x2b7a95]));BPromise[_0xf365('0x46')]()[_0xf365('0x37')](handleJob(_0x4732f6[_0x2b7a95]));logger[_0xf365('0xd')]('run\x20job',_0x4732f6[_0x2b7a95][_0xf365('0x13')],_0x4732f6[_0x2b7a95][_0xf365('0x47')]);}else if(_0x4732f6[_0x2b7a95]['cron']&&_0x4732f6[_0x2b7a95][_0xf365('0x48')]&&moment()['isBetween'](_0x4732f6[_0x2b7a95][_0xf365('0x49')],_0x4732f6[_0x2b7a95][_0xf365('0x4a')])){manager[_0xf365('0x4b')](_0x2b7a95,_0x4732f6[_0x2b7a95]['cron'],handleJob(_0x4732f6[_0x2b7a95]));manager[_0xf365('0x4c')](_0x2b7a95);logger[_0xf365('0xd')](_0xf365('0x4d'),_0x4732f6[_0x2b7a95][_0xf365('0x13')],_0x4732f6[_0x2b7a95][_0xf365('0x47')]);}else if(manager[_0xf365('0x43')](_0x2b7a95)){manager[_0xf365('0x4e')](_0x2b7a95);manager[_0xf365('0x4f')](_0x2b7a95);logger[_0xf365('0xd')]('stop\x20cron',_0x4732f6[_0x2b7a95]['name'],_0x4732f6[_0x2b7a95]['cron']);}}for(_0x36bd4b=0x0,_0x2b7a95;_0x36bd4b<_0xb291fa[_0xf365('0x50')]&&!_0x102bc3;_0x36bd4b+=0x1){_0x2b7a95=_0xb291fa[_0x36bd4b][_0xf365('0x3f')]();if(manager[_0xf365('0x43')](_0x2b7a95)){if(_0x4732f6[_0x2b7a95][_0xf365('0x47')]&&_0x4732f6[_0x2b7a95][_0xf365('0x48')]&&moment()['isBetween'](_0x4732f6[_0x2b7a95][_0xf365('0x49')],_0x4732f6[_0x2b7a95][_0xf365('0x4a')])){manager[_0xf365('0x51')](_0x2b7a95,_0x4732f6[_0x2b7a95][_0xf365('0x47')],handleJob(_0x4732f6[_0x2b7a95]));logger['info'](_0xf365('0x52'),_0x4732f6[_0x2b7a95][_0xf365('0x13')],_0x4732f6[_0x2b7a95][_0xf365('0x47')]);}else{manager[_0xf365('0x4e')](_0x2b7a95);manager[_0xf365('0x4f')](_0x2b7a95);logger[_0xf365('0xd')](_0xf365('0x53'),_0x4732f6[_0x2b7a95]['name'],_0x4732f6[_0x2b7a95][_0xf365('0x47')]);}}}})[_0xf365('0x38')](function(_0xa6ab91){logger[_0xf365('0x2a')](JSON[_0xf365('0x27')](_0xa6ab91));});}exports[_0xf365('0x54')]=function(_0x41f3e8){return getJobs(_0x41f3e8);};exports[_0xf365('0x4c')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x00ad=['resolve','run\x20job','active','startAt','endAt','cron','add\x20cron','deleteJob','stop\x20cron','isBetween','update','update\x20cron','run','start','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','format','%s.%s','basename','existsSync','status','Sent','message','text','stringify','attachments','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','toRun','index'];(function(_0x52dde7,_0x5ab368){var _0xd3690b=function(_0x27e252){while(--_0x27e252){_0x52dde7['push'](_0x52dde7['shift']());}};_0xd3690b(++_0x5ab368);}(_0x00ad,0x65));var _0xd00a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00ad[_0x4cf98e];return _0x1623ac;};'use strict';var fs=require('fs');var util=require(_0xd00a('0x0'));var path=require(_0xd00a('0x1'));var _=require('lodash');var moment=require(_0xd00a('0x2'));var CronJobManager=require(_0xd00a('0x3'));var jayson=require(_0xd00a('0x4'));var BPromise=require(_0xd00a('0x5'));var logger=require(_0xd00a('0x6'))('schedule');var db=require(_0xd00a('0x7'))['db'];var analyticCustomReportController=require(_0xd00a('0x8'));var analyticDefaultReportController=require(_0xd00a('0x9'));var client=jayson['client'][_0xd00a('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x885f6b,_0x2b980f){return function(){logger['info'](_0xd00a('0xb'),_0x885f6b[_0xd00a('0xc')]);var _0x2bb60c=!![];var _0x10572c=_0x885f6b[_0xd00a('0xd')][_0xd00a('0xe')]();var _0x4cd4d6={'account':_0x10572c,'message':{'from':util['format'](_0xd00a('0xf'),_0x885f6b[_0xd00a('0xd')][_0xd00a('0x10')],_0x885f6b[_0xd00a('0xd')][_0xd00a('0xc')]||_0x885f6b[_0xd00a('0xd')][_0xd00a('0x11')][_0xd00a('0x12')]),'to':_0x885f6b[_0xd00a('0xc')],'cc':_0x885f6b['cc'],'bcc':_0x885f6b[_0xd00a('0x13')],'subject':util['format'](_0xd00a('0x14'),_0x2b980f[_0xd00a('0x10')],_0x885f6b[_0xd00a('0x15')],_0x885f6b['subtractUnit'])}};var _0x233e4c=path[_0xd00a('0x16')](__dirname,_0xd00a('0x17'));var _0x962107=_0x2b980f[_0xd00a('0x18')];var _0x4a39fa=util[_0xd00a('0x19')](_0xd00a('0x1a'),path[_0xd00a('0x1b')](_0x2b980f[_0xd00a('0x18')],path['extname'](_0x2b980f[_0xd00a('0x18')])),'zip');var _0x27a38e=path[_0xd00a('0x16')](_0x233e4c,_0x962107);var _0xb877bd=path['join'](_0x233e4c,_0x4a39fa);if(fs[_0xd00a('0x1c')](_0x27a38e)){_0x2b980f[_0xd00a('0x1d')]=_0xd00a('0x1e');_0x4cd4d6[_0xd00a('0x1f')]['attachments']=[{'filename':_0x962107,'path':_0x27a38e}];_0x4cd4d6[_0xd00a('0x1f')][_0xd00a('0x20')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xd00a('0x21')](_0x2b980f,null,0x2));}else if(fs[_0xd00a('0x1c')](_0xb877bd)){_0x2b980f['status']=_0xd00a('0x1e');_0x4cd4d6[_0xd00a('0x1f')][_0xd00a('0x22')]=[{'filename':_0x4a39fa,'path':_0xb877bd}];}else{_0x4cd4d6[_0xd00a('0x1f')][_0xd00a('0x20')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x885f6b[_0xd00a('0x23')]){_0x2bb60c=![];logger[_0xd00a('0x24')](_0xd00a('0x25'));}}if(_0x2bb60c){return client[_0xd00a('0x26')]('SendMail',_0x4cd4d6)[_0xd00a('0x27')](function(_0x249722){if(_0x249722[_0xd00a('0x28')]){return logger[_0xd00a('0x28')](_0xd00a('0x29'),JSON[_0xd00a('0x21')](_0x249722));}return logger[_0xd00a('0x24')]('email\x20sent');})[_0xd00a('0x2a')](function(_0x3a5069){return logger[_0xd00a('0x28')](_0xd00a('0x29'),JSON[_0xd00a('0x21')](_0x3a5069));});}};}function handleError(){return function(_0x463cfb){return logger[_0xd00a('0x28')](JSON[_0xd00a('0x21')](_0x463cfb));};}function handleResult(_0x36437f){return function(_0x460922){logger[_0xd00a('0x24')](_0xd00a('0x2b'),JSON[_0xd00a('0x21')](_0x460922));if(_0x36437f[_0xd00a('0xd')]&&_0x36437f[_0xd00a('0xd')][_0xd00a('0x11')]&&!_['isNil'](_0x36437f[_0xd00a('0xc')])){setTimeout(handleSendEmail(_0x36437f,_0x460922),0x3c*0x3e8);}};}function handleJob(_0x2ab29a){return function(){try{if(_[_0xd00a('0x2c')](_0x2ab29a[_0xd00a('0x15')])){return logger['info'](_0xd00a('0x2d'));}if(_['isNil'](_0x2ab29a[_0xd00a('0x2e')])){return logger['info'](_0xd00a('0x2f'));}var _0x1522b8={'startDate':moment()[_0xd00a('0x30')](_0x2ab29a[_0xd00a('0x15')],_0x2ab29a[_0xd00a('0x2e')])[_0xd00a('0x19')](_0xd00a('0x31')),'endDate':moment()[_0xd00a('0x19')](_0xd00a('0x31')),'type':_0xd00a('0x32'),'output':_0x2ab29a[_0xd00a('0x33')],'name':_0x2ab29a[_0xd00a('0x10')]};if(!_['isNil'](_0x2ab29a['DefaultReportId'])){logger[_0xd00a('0x24')](_0xd00a('0x34'),_0x2ab29a[_0xd00a('0x35')]);return analyticDefaultReportController[_0xd00a('0x36')]({'id':_0x2ab29a[_0xd00a('0x35')]},_0x1522b8)[_0xd00a('0x27')](handleResult(_0x2ab29a))[_0xd00a('0x2a')](handleError());}if(!_[_0xd00a('0x2c')](_0x2ab29a[_0xd00a('0x37')])){logger[_0xd00a('0x24')](_0xd00a('0x38'),_0x2ab29a[_0xd00a('0x37')]);return analyticCustomReportController[_0xd00a('0x36')]({'id':_0x2ab29a[_0xd00a('0x37')]},_0x1522b8)[_0xd00a('0x27')](handleResult(_0x2ab29a))['catch'](handleError());}}catch(_0x733b02){logger['error'](JSON['stringify'](_0x733b02));}return logger[_0xd00a('0x24')]('no\x20report\x20id');};}function getJobs(_0x2ff463){var _0x73961={};if(_0x2ff463){_0x73961['id']=_0x2ff463;}return db[_0xd00a('0x39')][_0xd00a('0x3a')]({'where':_0x73961,'include':[{'model':db['MailAccount'],'attributes':['id',_0xd00a('0x10'),_0xd00a('0xc')],'include':[{'model':db[_0xd00a('0x3b')],'as':'Smtp','include':[{'model':db[_0xd00a('0x3c')],'as':'CloudProvider'}]}]}]})['then'](function(_0x4de524){var _0x339e2d=_[_0xd00a('0x3d')](manager[_0xd00a('0x3e')]);var _0x294f90=_[_0xd00a('0x3f')](_0x4de524,function(_0x160bcc){return _0x160bcc['id']['toString']();});var _0x59199d=_[_0xd00a('0x40')](_0x4de524,function(_0x165aa7){return _0x165aa7['id'][_0xd00a('0x41')]();});var _0x3db8f5=_0x2ff463?_0x294f90:_[_0xd00a('0x42')](_0x294f90,_0x339e2d);var _0x29b486=_[_0xd00a('0x43')](_0x294f90,_0x339e2d);var _0x3438b0=_[_0xd00a('0x42')](_0x339e2d,_0x294f90);var _0x154031;var _0x1a10e3;for(_0x154031=0x0;_0x154031<_0x3438b0[_0xd00a('0x44')]&&!_0x2ff463;_0x154031+=0x1){_0x1a10e3=_0x3438b0[_0x154031][_0xd00a('0x41')]();if(manager[_0xd00a('0x45')](_0x1a10e3)){manager[_0xd00a('0x46')](_0x1a10e3);manager['deleteJob'](_0x1a10e3);logger['info']('delete\x20cron',_0x1a10e3);}}logger[_0xd00a('0x24')](_0xd00a('0x47'),JSON[_0xd00a('0x21')](_0x3db8f5));for(_0x154031=0x0;_0x154031<_0x3db8f5[_0xd00a('0x44')];_0x154031+=0x1){_0x1a10e3=_0x3db8f5[_0x154031]['toString']();logger['info'](_0xd00a('0x48'),_0x1a10e3);if(_0x2ff463){logger[_0xd00a('0x24')]('my\x20id',_0x2ff463);logger['info'](JSON[_0xd00a('0x21')](_0x59199d[_0x1a10e3]));BPromise[_0xd00a('0x49')]()[_0xd00a('0x27')](handleJob(_0x59199d[_0x1a10e3]));logger[_0xd00a('0x24')](_0xd00a('0x4a'),_0x59199d[_0x1a10e3][_0xd00a('0x10')],_0x59199d[_0x1a10e3]['cron']);}else if(_0x59199d[_0x1a10e3]['cron']&&_0x59199d[_0x1a10e3][_0xd00a('0x4b')]&&moment()['isBetween'](_0x59199d[_0x1a10e3][_0xd00a('0x4c')],_0x59199d[_0x1a10e3][_0xd00a('0x4d')])){manager['add'](_0x1a10e3,_0x59199d[_0x1a10e3][_0xd00a('0x4e')],handleJob(_0x59199d[_0x1a10e3]));manager['start'](_0x1a10e3);logger[_0xd00a('0x24')](_0xd00a('0x4f'),_0x59199d[_0x1a10e3][_0xd00a('0x10')],_0x59199d[_0x1a10e3][_0xd00a('0x4e')]);}else if(manager[_0xd00a('0x45')](_0x1a10e3)){manager[_0xd00a('0x46')](_0x1a10e3);manager[_0xd00a('0x50')](_0x1a10e3);logger['info'](_0xd00a('0x51'),_0x59199d[_0x1a10e3][_0xd00a('0x10')],_0x59199d[_0x1a10e3][_0xd00a('0x4e')]);}}for(_0x154031=0x0,_0x1a10e3;_0x154031<_0x29b486[_0xd00a('0x44')]&&!_0x2ff463;_0x154031+=0x1){_0x1a10e3=_0x29b486[_0x154031][_0xd00a('0x41')]();if(manager['exists'](_0x1a10e3)){if(_0x59199d[_0x1a10e3]['cron']&&_0x59199d[_0x1a10e3][_0xd00a('0x4b')]&&moment()[_0xd00a('0x52')](_0x59199d[_0x1a10e3][_0xd00a('0x4c')],_0x59199d[_0x1a10e3][_0xd00a('0x4d')])){manager[_0xd00a('0x53')](_0x1a10e3,_0x59199d[_0x1a10e3][_0xd00a('0x4e')],handleJob(_0x59199d[_0x1a10e3]));logger['info'](_0xd00a('0x54'),_0x59199d[_0x1a10e3][_0xd00a('0x10')],_0x59199d[_0x1a10e3]['cron']);}else{manager['stop'](_0x1a10e3);manager[_0xd00a('0x50')](_0x1a10e3);logger[_0xd00a('0x24')](_0xd00a('0x51'),_0x59199d[_0x1a10e3][_0xd00a('0x10')],_0x59199d[_0x1a10e3][_0xd00a('0x4e')]);}}}})[_0xd00a('0x2a')](function(_0x167b5c){logger[_0xd00a('0x28')](JSON[_0xd00a('0x21')](_0x167b5c));});}exports[_0xd00a('0x55')]=function(_0x5adb25){return getJobs(_0x5adb25);};exports[_0xd00a('0x56')]=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 5651443..0bb36e5 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 _0xf996=['sentiment','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','CloudProvider','forEach','push','all','start','lodash','aws-sdk','request-promise','bluebird','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested'];(function(_0x283c35,_0x20b35e){var _0x146a50=function(_0x5232d4){while(--_0x5232d4){_0x283c35['push'](_0x283c35['shift']());}};_0x146a50(++_0x20b35e);}(_0xf996,0x74));var _0x6f99=function(_0x2098fd,_0x563b97){_0x2098fd=_0x2098fd-0x0;var _0x5245d9=_0xf996[_0x2098fd];return _0x5245d9;};var _=require(_0x6f99('0x0'));var AWS=require(_0x6f99('0x1'));var rp=require(_0x6f99('0x2'));var util=require('util');var BPromise=require(_0x6f99('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x6f99('0x4'));function getTranscriptionJob(_0xa0b3d7,_0x274f12,_0x3de6be,_0x3ab5e2){return new Promise(function(_0xf2b5ee,_0xa07ac1){var _0x2883cb=new AWS[(_0x6f99('0x5'))]({'accessKeyId':_0x274f12,'secretAccessKey':_0xa0b3d7,'region':_0x3de6be});_0x2883cb[_0x6f99('0x6')]({'TranscriptionJobName':_0x3ab5e2},function(_0x5d8b7f,_0x2b1110){if(_0x5d8b7f){return _0xa07ac1(_0x5d8b7f);}else{return _0xf2b5ee(_0x2b1110);}});});}function sentiment(_0x52e063,_0x178d9d,_0x185abd,_0x41f436,_0x161b64){return new Promise(function(_0xf42ba3,_0x2edd9){var _0x43b5c0=new AWS[(_0x6f99('0x7'))]({'accessKeyId':_0x178d9d,'secretAccessKey':_0x52e063,'region':_0x185abd});_0x43b5c0[_0x6f99('0x8')]({'Text':_0x41f436,'LanguageCode':_0x161b64['substring'](0x0,0x2)},function(_0x3eb801,_0x573258){if(_0x3eb801){return _0x2edd9(_0x3eb801);}else{return _0xf42ba3(_0x573258);}});});}function checkTranscribeJob(_0x5a3071,_0x55e7f0,_0x12081d){var _0xa1af95;return new BPromise(function(_0x2560c7,_0x107df6){logger[_0x6f99('0x9')](util[_0x6f99('0xa')](_0x6f99('0xb'),_0x5a3071['id'],_0x5a3071[_0x6f99('0xc')]));return getTranscriptionJob(_0x12081d[_0x6f99('0xd')],_0x12081d[_0x6f99('0xe')],_0x55e7f0[_0x6f99('0xf')],_0x5a3071[_0x6f99('0xc')])['then'](function(_0x293937){logger[_0x6f99('0x9')](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5a3071['id'],_0x5a3071[_0x6f99('0xc')],_0x293937['TranscriptionJob'][_0x6f99('0x10')]));if(!_0x5a3071[_0x6f99('0x11')]){switch(_0x293937[_0x6f99('0x12')][_0x6f99('0x10')]){case _0x6f99('0x13'):var _0x5bfb51={'transcribeStatus':_0x293937[_0x6f99('0x12')]['TranscriptionJobStatus'],'fileUri':_0x293937[_0x6f99('0x12')][_0x6f99('0x14')][_0x6f99('0x15')]};logger[_0x6f99('0x9')](util[_0x6f99('0xa')](_0x6f99('0x16'),_0x5a3071['id']));return rp({'uri':_0x293937['TranscriptionJob']['Transcript'][_0x6f99('0x15')],'json':!![]})[_0x6f99('0x17')](function(_0x4974ff){logger['info'](util[_0x6f99('0xa')](_0x6f99('0x18'),_0x5a3071['id']));if(_0x4974ff&&_0x4974ff[_0x6f99('0x19')]&&_0x4974ff[_0x6f99('0x19')][_0x6f99('0x1a')]&&_0x4974ff[_0x6f99('0x19')][_0x6f99('0x1a')][_0x6f99('0x1b')]){_0x5bfb51[_0x6f99('0x11')]='';for(var _0x41a60b=0x0;_0x41a60b<_0x4974ff[_0x6f99('0x19')][_0x6f99('0x1a')][_0x6f99('0x1b')];_0x41a60b++){_0x5bfb51[_0x6f99('0x11')]+=_0x4974ff['results'][_0x6f99('0x1a')][_0x41a60b][_0x6f99('0x1c')]+'';}}return _0x5a3071['update'](_0x5bfb51);})['then'](function(){logger[_0x6f99('0x9')](util[_0x6f99('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5a3071['id']));if(!_0x5a3071[_0x6f99('0x1d')]){throw new db[(_0x6f99('0x1e'))]['ValidationError'](_0x6f99('0x1f'));}if(!_0x55e7f0[_0x6f99('0x20')]||!_0x55e7f0['sentimentAccountId']||!_0x55e7f0[_0x6f99('0x21')]||!_0x55e7f0[_0x6f99('0x22')]||!_0x55e7f0[_0x6f99('0x23')]){throw new db[(_0x6f99('0x1e'))][(_0x6f99('0x24'))](_0x6f99('0x25'));}if(!_0x5bfb51['fileText']){throw new Error(_0x6f99('0x26'));}if(_0x55e7f0[_0x6f99('0x27')]===_0x12081d['id']){return _0x12081d;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x6f99('0x27')]}});}})[_0x6f99('0x17')](function(_0x10a88d){if(!_0x10a88d){throw new db[(_0x6f99('0x1e'))][(_0x6f99('0x24'))](_0x6f99('0x28'));}if(!_0x10a88d['data1']||!_0x10a88d['data2']){throw new db[(_0x6f99('0x1e'))][(_0x6f99('0x24'))](_0x6f99('0x29'));}_0xa1af95=_0x10a88d;logger[_0x6f99('0x9')](util[_0x6f99('0xa')](_0x6f99('0x2a'),_0x5a3071['id']));return sentiment(_0xa1af95[_0x6f99('0xd')],_0xa1af95[_0x6f99('0xe')],_0x55e7f0[_0x6f99('0x21')],_0x5bfb51[_0x6f99('0x11')],_0x55e7f0[_0x6f99('0x22')]);})['then'](function(_0xb16b1e){logger[_0x6f99('0x9')](util[_0x6f99('0xa')](_0x6f99('0x2b'),_0x5a3071['id']));return _0x5a3071[_0x6f99('0x2c')]({'sentiment':_0xb16b1e['Sentiment'],'sPositive':_0xb16b1e[_0x6f99('0x2d')][_0x6f99('0x2e')],'sNegative':_0xb16b1e['SentimentScore'][_0x6f99('0x2f')],'sMixed':_0xb16b1e[_0x6f99('0x2d')][_0x6f99('0x30')],'sNeutral':_0xb16b1e[_0x6f99('0x2d')][_0x6f99('0x31')]});})[_0x6f99('0x17')](function(){logger[_0x6f99('0x9')](util[_0x6f99('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5a3071['id']));_0x2560c7();});case _0x6f99('0x32'):return _0x5a3071['update']({'transcribeStatus':_0x6f99('0x32'),'failureReason':_0x293937[_0x6f99('0x12')][_0x6f99('0x33')]})[_0x6f99('0x17')](function(){logger['info'](util[_0x6f99('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5a3071['id']));_0x2560c7();});default:logger[_0x6f99('0x9')](util[_0x6f99('0xa')](_0x6f99('0x34'),_0x5a3071['id']));break;}}else{return BPromise[_0x6f99('0x35')]()[_0x6f99('0x17')](function(){if(!_0x5a3071[_0x6f99('0x1d')]){throw new db[(_0x6f99('0x1e'))]['ValidationError'](_0x6f99('0x1f'));}if(!_0x55e7f0[_0x6f99('0x20')]||!_0x55e7f0[_0x6f99('0x27')]||!_0x55e7f0['sentimentRegion']||!_0x55e7f0[_0x6f99('0x22')]||!_0x55e7f0[_0x6f99('0x23')]){throw new db[(_0x6f99('0x1e'))][(_0x6f99('0x24'))](_0x6f99('0x25'));}if(!_0x5a3071[_0x6f99('0x11')]){throw new Error(_0x6f99('0x26'));}if(_0x55e7f0[_0x6f99('0x27')]===_0x12081d['id']){return _0x12081d;}else{return db['CloudProvider'][_0x6f99('0x36')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6f99('0x17')](function(_0x11f13c){if(!_0x11f13c){throw new db['Sequelize'][(_0x6f99('0x24'))](_0x6f99('0x28'));}if(!_0x11f13c[_0x6f99('0xd')]||!_0x11f13c[_0x6f99('0xe')]){throw new db['Sequelize'][(_0x6f99('0x24'))](_0x6f99('0x29'));}_0xa1af95=_0x11f13c;logger[_0x6f99('0x9')](util['format'](_0x6f99('0x2a'),_0x5a3071['id']));return sentiment(_0xa1af95[_0x6f99('0xd')],_0xa1af95[_0x6f99('0xe')],_0x55e7f0[_0x6f99('0x21')],_0x5a3071[_0x6f99('0x11')],_0x55e7f0[_0x6f99('0x22')]);})[_0x6f99('0x17')](function(_0x301bf9){logger['info'](util[_0x6f99('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5a3071['id']));return _0x5a3071[_0x6f99('0x2c')]({'sentiment':_0x301bf9['Sentiment'],'sPositive':_0x301bf9[_0x6f99('0x2d')][_0x6f99('0x2e')],'sNegative':_0x301bf9[_0x6f99('0x2d')][_0x6f99('0x2f')],'sMixed':_0x301bf9[_0x6f99('0x2d')][_0x6f99('0x30')],'sNeutral':_0x301bf9[_0x6f99('0x2d')]['Neutral'],'transcribeStatus':_0x6f99('0x13')});})[_0x6f99('0x17')](function(){logger['info'](util[_0x6f99('0xa')](_0x6f99('0x37'),_0x5a3071['id']));_0x2560c7();});}})[_0x6f99('0x38')](function(_0x283d14){if(_0x283d14){if(!_0x283d14[_0x6f99('0x39')]||_0x283d14['name']!==_0x6f99('0x3a')){logger[_0x6f99('0x3b')](util[_0x6f99('0xa')](_0x6f99('0x3c'),_0x5a3071['id']),util[_0x6f99('0x3d')](_0x283d14,{'showHidden':![],'depth':null}));}}_0x2560c7();});});}function checkTranscribe(){var _0x3a561b;var _0x2e54b1;var _0x20c80d;return db[_0x6f99('0x3e')][_0x6f99('0x3f')]({'where':{'transcribeStatus':_0x6f99('0x40')}})[_0x6f99('0x17')](function(_0x5635cd){if(!_0x5635cd||!_0x5635cd[_0x6f99('0x1b')]){throw new db[(_0x6f99('0x1e'))][(_0x6f99('0x24'))](_0x6f99('0x41'));}_0x3a561b=_0x5635cd;return db[_0x6f99('0x42')][_0x6f99('0x36')]({'where':{'id':0x1}});})['then'](function(_0x321944){if(!_0x321944){throw new db[(_0x6f99('0x1e'))]['ValidationError'](_0x6f99('0x43'));}_0x2e54b1=_0x321944;if(!_0x2e54b1[_0x6f99('0x4')]||!_0x2e54b1[_0x6f99('0x44')]||!_0x2e54b1[_0x6f99('0xf')]||!_0x2e54b1[_0x6f99('0x22')]||!_0x2e54b1['bucket']){throw new db['Sequelize'][(_0x6f99('0x24'))]('Transcribe\x20not\x20configured');}return db[_0x6f99('0x45')][_0x6f99('0x36')]({'where':{'id':_0x2e54b1[_0x6f99('0x44')]}});})[_0x6f99('0x17')](function(_0xbd1caf){if(!_0xbd1caf){throw new db['Sequelize'][(_0x6f99('0x24'))](_0x6f99('0x28'));}if(!_0xbd1caf[_0x6f99('0xd')]||!_0xbd1caf[_0x6f99('0xe')]){throw new db['Sequelize'][(_0x6f99('0x24'))](_0x6f99('0x29'));}_0x20c80d=_0xbd1caf;var _0x364f86=[];_0x3a561b[_0x6f99('0x46')](function(_0x10546a){_0x364f86[_0x6f99('0x47')](checkTranscribeJob(_0x10546a,_0x2e54b1,_0x20c80d));});return BPromise[_0x6f99('0x48')](_0x364f86);})[_0x6f99('0x38')](function(_0x5e024a){if(_0x5e024a){if(!_0x5e024a[_0x6f99('0x39')]||_0x5e024a[_0x6f99('0x39')]!==_0x6f99('0x3a')){logger['error'](util['inspect'](_0x5e024a,{'showHidden':![],'depth':null}));}}});}exports[_0x6f99('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xcf66=['bucket','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','ValidationError','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','start','lodash','aws-sdk','request-promise','bluebird','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeName','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x443edd,_0x13b85b){var _0x22ecfe=function(_0x15d7cc){while(--_0x15d7cc){_0x443edd['push'](_0x443edd['shift']());}};_0x22ecfe(++_0x13b85b);}(_0xcf66,0x71));var _0x6cf6=function(_0x3a2ffd,_0x1cf700){_0x3a2ffd=_0x3a2ffd-0x0;var _0x1979bc=_0xcf66[_0x3a2ffd];return _0x1979bc;};var _=require(_0x6cf6('0x0'));var AWS=require(_0x6cf6('0x1'));var rp=require(_0x6cf6('0x2'));var util=require('util');var BPromise=require(_0x6cf6('0x3'));var db=require(_0x6cf6('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x1c599d,_0x45d0d8,_0x57f22f,_0x39f1d6){return new Promise(function(_0x1fbedd,_0x2a573e){var _0x5eb082=new AWS[(_0x6cf6('0x5'))]({'accessKeyId':_0x45d0d8,'secretAccessKey':_0x1c599d,'region':_0x57f22f});_0x5eb082[_0x6cf6('0x6')]({'TranscriptionJobName':_0x39f1d6},function(_0x36b892,_0x748c93){if(_0x36b892){return _0x2a573e(_0x36b892);}else{return _0x1fbedd(_0x748c93);}});});}function sentiment(_0x175b18,_0x8a30f1,_0x5b3827,_0x58378c,_0x5b7f4e){return new Promise(function(_0x8e90e,_0x504c98){var _0x1fdf80=new AWS[(_0x6cf6('0x7'))]({'accessKeyId':_0x8a30f1,'secretAccessKey':_0x175b18,'region':_0x5b3827});_0x1fdf80[_0x6cf6('0x8')]({'Text':_0x58378c,'LanguageCode':_0x5b7f4e[_0x6cf6('0x9')](0x0,0x2)},function(_0x4c4732,_0x5455f3){if(_0x4c4732){return _0x504c98(_0x4c4732);}else{return _0x8e90e(_0x5455f3);}});});}function checkTranscribeJob(_0x5801a9,_0x3fdfea,_0x13b1ad){var _0x372d12;return new BPromise(function(_0x39e8c3,_0x3e62a7){logger[_0x6cf6('0xa')](util['format'](_0x6cf6('0xb'),_0x5801a9['id'],_0x5801a9['transcribeName']));return getTranscriptionJob(_0x13b1ad[_0x6cf6('0xc')],_0x13b1ad[_0x6cf6('0xd')],_0x3fdfea['transcribeRegion'],_0x5801a9[_0x6cf6('0xe')])[_0x6cf6('0xf')](function(_0x2d23ab){logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x11'),_0x5801a9['id'],_0x5801a9[_0x6cf6('0xe')],_0x2d23ab[_0x6cf6('0x12')][_0x6cf6('0x13')]));if(!_0x5801a9[_0x6cf6('0x14')]){switch(_0x2d23ab['TranscriptionJob'][_0x6cf6('0x13')]){case _0x6cf6('0x15'):var _0x22ab0={'transcribeStatus':_0x2d23ab['TranscriptionJob'][_0x6cf6('0x13')],'fileUri':_0x2d23ab[_0x6cf6('0x12')][_0x6cf6('0x16')][_0x6cf6('0x17')]};logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x18'),_0x5801a9['id']));return rp({'uri':_0x2d23ab['TranscriptionJob'][_0x6cf6('0x16')][_0x6cf6('0x17')],'json':!![]})[_0x6cf6('0xf')](function(_0x380a40){logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x19'),_0x5801a9['id']));if(_0x380a40&&_0x380a40[_0x6cf6('0x1a')]&&_0x380a40['results']['transcripts']&&_0x380a40[_0x6cf6('0x1a')]['transcripts'][_0x6cf6('0x1b')]){_0x22ab0[_0x6cf6('0x14')]='';for(var _0x14ae3e=0x0;_0x14ae3e<_0x380a40[_0x6cf6('0x1a')][_0x6cf6('0x1c')][_0x6cf6('0x1b')];_0x14ae3e++){_0x22ab0[_0x6cf6('0x14')]+=_0x380a40['results'][_0x6cf6('0x1c')][_0x14ae3e][_0x6cf6('0x1d')]+'';}}return _0x5801a9[_0x6cf6('0x1e')](_0x22ab0);})['then'](function(){logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x1f'),_0x5801a9['id']));if(!_0x5801a9[_0x6cf6('0x20')]){throw new db['Sequelize']['ValidationError'](_0x6cf6('0x21'));}if(!_0x3fdfea[_0x6cf6('0x22')]||!_0x3fdfea[_0x6cf6('0x23')]||!_0x3fdfea[_0x6cf6('0x24')]||!_0x3fdfea['language']||!_0x3fdfea[_0x6cf6('0x25')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x22ab0[_0x6cf6('0x14')]){throw new Error(_0x6cf6('0x26'));}if(_0x3fdfea[_0x6cf6('0x23')]===_0x13b1ad['id']){return _0x13b1ad;}else{return db[_0x6cf6('0x27')][_0x6cf6('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6cf6('0xf')](function(_0x2ae422){if(!_0x2ae422){throw new db[(_0x6cf6('0x29'))]['ValidationError'](_0x6cf6('0x2a'));}if(!_0x2ae422[_0x6cf6('0xc')]||!_0x2ae422[_0x6cf6('0xd')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x2c'));}_0x372d12=_0x2ae422;logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x2d'),_0x5801a9['id']));return sentiment(_0x372d12[_0x6cf6('0xc')],_0x372d12[_0x6cf6('0xd')],_0x3fdfea[_0x6cf6('0x24')],_0x22ab0[_0x6cf6('0x14')],_0x3fdfea[_0x6cf6('0x2e')]);})[_0x6cf6('0xf')](function(_0x4351d9){logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5801a9['id']));return _0x5801a9[_0x6cf6('0x1e')]({'sentiment':_0x4351d9[_0x6cf6('0x2f')],'sPositive':_0x4351d9[_0x6cf6('0x30')][_0x6cf6('0x31')],'sNegative':_0x4351d9[_0x6cf6('0x30')][_0x6cf6('0x32')],'sMixed':_0x4351d9[_0x6cf6('0x30')][_0x6cf6('0x33')],'sNeutral':_0x4351d9[_0x6cf6('0x30')][_0x6cf6('0x34')]});})[_0x6cf6('0xf')](function(){logger['info'](util[_0x6cf6('0x10')](_0x6cf6('0x1f'),_0x5801a9['id']));_0x39e8c3();});case _0x6cf6('0x35'):return _0x5801a9[_0x6cf6('0x1e')]({'transcribeStatus':_0x6cf6('0x35'),'failureReason':_0x2d23ab[_0x6cf6('0x12')][_0x6cf6('0x36')]})[_0x6cf6('0xf')](function(){logger[_0x6cf6('0xa')](util['format'](_0x6cf6('0x1f'),_0x5801a9['id']));_0x39e8c3();});default:logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x37'),_0x5801a9['id']));break;}}else{return BPromise[_0x6cf6('0x38')]()[_0x6cf6('0xf')](function(){if(!_0x5801a9[_0x6cf6('0x20')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3fdfea[_0x6cf6('0x22')]||!_0x3fdfea['sentimentAccountId']||!_0x3fdfea[_0x6cf6('0x24')]||!_0x3fdfea[_0x6cf6('0x2e')]||!_0x3fdfea[_0x6cf6('0x25')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x39'));}if(!_0x5801a9[_0x6cf6('0x14')]){throw new Error(_0x6cf6('0x26'));}if(_0x3fdfea['sentimentAccountId']===_0x13b1ad['id']){return _0x13b1ad;}else{return db[_0x6cf6('0x27')][_0x6cf6('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x6cf6('0xf')](function(_0x41c16a){if(!_0x41c16a){throw new db[(_0x6cf6('0x29'))]['ValidationError'](_0x6cf6('0x2a'));}if(!_0x41c16a[_0x6cf6('0xc')]||!_0x41c16a['data2']){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x2c'));}_0x372d12=_0x41c16a;logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x2d'),_0x5801a9['id']));return sentiment(_0x372d12[_0x6cf6('0xc')],_0x372d12['data2'],_0x3fdfea[_0x6cf6('0x24')],_0x5801a9['fileText'],_0x3fdfea[_0x6cf6('0x2e')]);})[_0x6cf6('0xf')](function(_0x4927d4){logger[_0x6cf6('0xa')](util[_0x6cf6('0x10')](_0x6cf6('0x3a'),_0x5801a9['id']));return _0x5801a9[_0x6cf6('0x1e')]({'sentiment':_0x4927d4[_0x6cf6('0x2f')],'sPositive':_0x4927d4['SentimentScore'][_0x6cf6('0x31')],'sNegative':_0x4927d4[_0x6cf6('0x30')][_0x6cf6('0x32')],'sMixed':_0x4927d4['SentimentScore'][_0x6cf6('0x33')],'sNeutral':_0x4927d4[_0x6cf6('0x30')][_0x6cf6('0x34')],'transcribeStatus':'COMPLETED'});})[_0x6cf6('0xf')](function(){logger['info'](util['format'](_0x6cf6('0x1f'),_0x5801a9['id']));_0x39e8c3();});}})[_0x6cf6('0x3b')](function(_0x414418){if(_0x414418){if(!_0x414418[_0x6cf6('0x3c')]||_0x414418[_0x6cf6('0x3c')]!==_0x6cf6('0x3d')){logger[_0x6cf6('0x3e')](util[_0x6cf6('0x10')](_0x6cf6('0x3f'),_0x5801a9['id']),util[_0x6cf6('0x40')](_0x414418,{'showHidden':![],'depth':null}));}}_0x39e8c3();});});}function checkTranscribe(){var _0x280e3a;var _0x1ac2cd;var _0x3786d1;return db['VoiceRecording'][_0x6cf6('0x41')]({'where':{'transcribeStatus':_0x6cf6('0x42')}})['then'](function(_0x58c370){if(!_0x58c370||!_0x58c370[_0x6cf6('0x1b')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x43'));}_0x280e3a=_0x58c370;return db[_0x6cf6('0x44')][_0x6cf6('0x28')]({'where':{'id':0x1}});})['then'](function(_0x115b9b){if(!_0x115b9b){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))]('Settings\x20not\x20available');}_0x1ac2cd=_0x115b9b;if(!_0x1ac2cd['transcribe']||!_0x1ac2cd[_0x6cf6('0x45')]||!_0x1ac2cd[_0x6cf6('0x46')]||!_0x1ac2cd[_0x6cf6('0x2e')]||!_0x1ac2cd[_0x6cf6('0x25')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x47'));}return db[_0x6cf6('0x27')][_0x6cf6('0x28')]({'where':{'id':_0x1ac2cd[_0x6cf6('0x45')]}});})['then'](function(_0x217072){if(!_0x217072){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x2a'));}if(!_0x217072[_0x6cf6('0xc')]||!_0x217072[_0x6cf6('0xd')]){throw new db[(_0x6cf6('0x29'))][(_0x6cf6('0x2b'))](_0x6cf6('0x2c'));}_0x3786d1=_0x217072;var _0x330919=[];_0x280e3a[_0x6cf6('0x48')](function(_0x4fb831){_0x330919[_0x6cf6('0x49')](checkTranscribeJob(_0x4fb831,_0x1ac2cd,_0x3786d1));});return BPromise['all'](_0x330919);})[_0x6cf6('0x3b')](function(_0xea457d){if(_0xea457d){if(!_0xea457d['name']||_0xea457d[_0x6cf6('0x3c')]!==_0x6cf6('0x3d')){logger[_0x6cf6('0x3e')](util[_0x6cf6('0x40')](_0xea457d,{'showHidden':![],'depth':null}));}}});}exports[_0x6cf6('0x4a')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index ab0abfb..a62af07 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 _0x6a0b=['../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','lodash','util','../../config/environment'];(function(_0x16b68d,_0x8171b3){var _0x5af0ae=function(_0x54978c){while(--_0x54978c){_0x16b68d['push'](_0x16b68d['shift']());}};_0x5af0ae(++_0x8171b3);}(_0x6a0b,0xc1));var _0xb6a0=function(_0x2b3d2d,_0x4e2fd7){_0x2b3d2d=_0x2b3d2d-0x0;var _0x82e0a1=_0x6a0b[_0x2b3d2d];return _0x82e0a1;};'use strict';var _=require(_0xb6a0('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xb6a0('0x1'));var config=require(_0xb6a0('0x2'));var db=require(_0xb6a0('0x3'))['db'];var logger=require(_0xb6a0('0x4'))(_0xb6a0('0x5'));config[_0xb6a0('0x6')]=_[_0xb6a0('0x7')](config[_0xb6a0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb6a0('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x4993ea=[];return db[_0xb6a0('0x9')][_0xb6a0('0xa')]({'raw':!![],'attributes':['id',_0xb6a0('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb6a0('0xc')](0x18,_0xb6a0('0xd'))}}})['then'](function(_0x3beccb){if(_0x3beccb&&_0x3beccb[_0xb6a0('0xe')]){_0x4993ea=_[_0xb6a0('0xf')](_0x3beccb||[],'id');logger[_0xb6a0('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4993ea[_0xb6a0('0x11')]());return db[_0xb6a0('0x9')][_0xb6a0('0x12')]({'closeReason':_0xb6a0('0x13'),'disposition':_0xb6a0('0x14'),'closed':!![],'closedAt':moment()['format'](_0xb6a0('0x15'))},{'where':{'id':_0x4993ea}});}})[_0xb6a0('0x16')](function(){if(_0x4993ea&&_0x4993ea[_0xb6a0('0xe')]){logger[_0xb6a0('0x10')](_0xb6a0('0x17'),_0x4993ea[_0xb6a0('0x11')]());for(var _0x24204b=0x0;_0x24204b<_0x4993ea[_0xb6a0('0xe')];_0x24204b++){io[_0xb6a0('0x18')]('whatsappInteraction:update',{'id':_0x4993ea[_0x24204b],'closed':!![]});}}})[_0xb6a0('0x19')](function(_0x3a71b7){logger[_0xb6a0('0x1a')](_0xb6a0('0x1b'),_0x3a71b7?util['inspect'](_0x3a71b7,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6f75=['socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost'];(function(_0x1ccf3d,_0x461209){var _0x5345c1=function(_0x55c638){while(--_0x55c638){_0x1ccf3d['push'](_0x1ccf3d['shift']());}};_0x5345c1(++_0x461209);}(_0x6f75,0xf5));var _0x56f7=function(_0x167d6e,_0x405b4d){_0x167d6e=_0x167d6e-0x0;var _0x59bdfd=_0x6f75[_0x167d6e];return _0x59bdfd;};'use strict';var _=require(_0x56f7('0x0'));var moment=require(_0x56f7('0x1'));var Redis=require(_0x56f7('0x2'));var util=require(_0x56f7('0x3'));var config=require(_0x56f7('0x4'));var db=require(_0x56f7('0x5'))['db'];var logger=require(_0x56f7('0x6'))(_0x56f7('0x7'));config[_0x56f7('0x8')]=_[_0x56f7('0x9')](config[_0x56f7('0x8')],{'host':_0x56f7('0xa'),'port':0x18eb});var io=require(_0x56f7('0xb'))(new Redis(config[_0x56f7('0x8')]));function closeInteractions(){var _0x4e2e86=[];return db[_0x56f7('0xc')][_0x56f7('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x56f7('0xe')](0x18,_0x56f7('0xf'))}}})[_0x56f7('0x10')](function(_0x490e1a){if(_0x490e1a&&_0x490e1a[_0x56f7('0x11')]){_0x4e2e86=_[_0x56f7('0x12')](_0x490e1a||[],'id');logger[_0x56f7('0x13')](_0x56f7('0x14'),_0x4e2e86[_0x56f7('0x15')]());return db[_0x56f7('0xc')][_0x56f7('0x16')]({'closeReason':_0x56f7('0x17'),'disposition':_0x56f7('0x18'),'closed':!![],'closedAt':moment()[_0x56f7('0x19')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x4e2e86}});}})['then'](function(){if(_0x4e2e86&&_0x4e2e86[_0x56f7('0x11')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4e2e86[_0x56f7('0x15')]());for(var _0x392c7d=0x0;_0x392c7d<_0x4e2e86[_0x56f7('0x11')];_0x392c7d++){io['emit'](_0x56f7('0x1a'),{'id':_0x4e2e86[_0x392c7d],'closed':!![]});}}})[_0x56f7('0x1b')](function(_0x34b869){logger[_0x56f7('0x1c')](_0x56f7('0x1d'),_0x34b869?util[_0x56f7('0x1e')](_0x34b869,{'showHidden':![],'depth':null}):'');});}exports[_0x56f7('0x1f')]=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 e2cfbf4..86f3634 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabd2=['hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xabd2,0x99));var _0x2abd=function(_0x1b52fe,_0x4ffafe){_0x1b52fe=_0x1b52fe-0x0;var _0x27dfa7=_0xabd2[_0x1b52fe];return _0x27dfa7;};'use strict';var util=require(_0x2abd('0x0'));var db=require(_0x2abd('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x2abd('0x2')]({'id':i,'firstName':_0x2abd('0x3')+i,'lastName':_0x2abd('0x4')+i,'phone':0xf879fb460+i,'email':_0x2abd('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2abd('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2abd('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2abd('0x6')](),'updatedAt':Date[_0x2abd('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2abd('0x2')]({'id':i,'firstName':_0x2abd('0x3')+i,'lastName':_0x2abd('0x4')+i,'phone':0xf879fb460+i,'email':_0x2abd('0x5')+i+_0x2abd('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2abd('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x2abd('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2abd('0x6')](),'updatedAt':Date[_0x2abd('0x6')]()});}db[_0x2abd('0x8')][_0x2abd('0x9')]({'where':{}})[_0x2abd('0xa')](function(){return db[_0x2abd('0x8')][_0x2abd('0xb')](contacts);})[_0x2abd('0xa')](function(){console[_0x2abd('0xc')](_0x2abd('0xd'),_0x2abd('0xe'));return db[_0x2abd('0xf')][_0x2abd('0x9')]({'where':{}});})[_0x2abd('0xa')](function(){return db[_0x2abd('0xf')][_0x2abd('0xb')](hopper);})[_0x2abd('0xa')](function(){console[_0x2abd('0xc')](_0x2abd('0xd'),_0x2abd('0x10'));return db[_0x2abd('0x8')][_0x2abd('0xb')](contacts2);})[_0x2abd('0xa')](function(){console[_0x2abd('0xc')](_0x2abd('0xd'),_0x2abd('0x11'));return db[_0x2abd('0xf')][_0x2abd('0xb')](hopper2);})[_0x2abd('0xa')](function(){console['log'](_0x2abd('0xd'),_0x2abd('0x12'));})['catch'](function(_0x100cb3){console[_0x2abd('0xc')](_0x100cb3);}); \ No newline at end of file +var _0xe90d=['catch','util','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2'];(function(_0x274c7c,_0x5d8c89){var _0x5f0a04=function(_0x15eff0){while(--_0x15eff0){_0x274c7c['push'](_0x274c7c['shift']());}};_0x5f0a04(++_0x5d8c89);}(_0xe90d,0x145));var _0xde90=function(_0x32521e,_0x32133f){_0x32521e=_0x32521e-0x0;var _0x531817=_0xe90d[_0x32521e];return _0x531817;};'use strict';var util=require(_0xde90('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':_0xde90('0x1')+i,'lastName':_0xde90('0x2')+i,'phone':0xf879fb460+i,'email':_0xde90('0x3')+i+_0xde90('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xde90('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xde90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xde90('0x6')](),'updatedAt':Date[_0xde90('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xde90('0x5')]({'id':i,'firstName':_0xde90('0x1')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xde90('0x3')+i+_0xde90('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xde90('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xde90('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xde90('0x6')](),'updatedAt':Date[_0xde90('0x6')]()});}db['CmContact'][_0xde90('0x7')]({'where':{}})['then'](function(){return db[_0xde90('0x8')][_0xde90('0x9')](contacts);})[_0xde90('0xa')](function(){console[_0xde90('0xb')](_0xde90('0xc'),_0xde90('0xd'));return db[_0xde90('0xe')][_0xde90('0x7')]({'where':{}});})[_0xde90('0xa')](function(){return db[_0xde90('0xe')][_0xde90('0x9')](hopper);})['then'](function(){console[_0xde90('0xb')](_0xde90('0xc'),_0xde90('0xf'));return db[_0xde90('0x8')]['bulkCreate'](contacts2);})[_0xde90('0xa')](function(){console['log'](_0xde90('0xc'),_0xde90('0x10'));return db['CmHopper'][_0xde90('0x9')](hopper2);})[_0xde90('0xa')](function(){console[_0xde90('0xb')](_0xde90('0xc'),'hopper2');})[_0xde90('0x11')](function(_0x4be5d2){console['log'](_0x4be5d2);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a961b53..703d366 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdba=['udp','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com'];(function(_0x106852,_0x1a8496){var _0x27eee6=function(_0x3e7584){while(--_0x3e7584){_0x106852['push'](_0x106852['shift']());}};_0x27eee6(++_0x1a8496);}(_0xbdba,0xb5));var _0xabdb=function(_0x71ee70,_0x1dfd28){_0x71ee70=_0x71ee70-0x0;var _0x594058=_0xbdba[_0x71ee70];return _0x594058;};'use strict';var util=require('util');var db=require(_0xabdb('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xabdb('0x1')]({'name':util[_0xabdb('0x2')](_0xabdb('0x3'),_0xabdb('0x4'),i),'fullname':util[_0xabdb('0x2')](_0xabdb('0x3'),_0xabdb('0x4'),i),'email':util[_0xabdb('0x2')](_0xabdb('0x5'),_0xabdb('0x4'),i),'role':_0xabdb('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xabdb('0x6'),'ws','wss'],'disallow':[_0xabdb('0x7')],'allow':[_0xabdb('0x8')],'defaultuser':util[_0xabdb('0x2')](_0xabdb('0x3'),'agent',i),'encryption':'yes','avpf':'yes','force_avp':_0xabdb('0x9'),'icesupport':_0xabdb('0x9'),'dtlsenable':_0xabdb('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xabdb('0xa'),'dtlssetup':_0xabdb('0xb'),'callerid':util[_0xabdb('0x2')](_0xabdb('0xc'),util['format'](_0xabdb('0x3'),_0xabdb('0x4'),i),0xfa0+i)});}db['User'][_0xabdb('0xd')](users)['then'](function(){console[_0xabdb('0xe')](_0xabdb('0xf'));})[_0xabdb('0x10')](function(_0x3e70fd){console[_0xabdb('0xe')](_0x3e70fd);}); \ No newline at end of file +var _0x4db8=['/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','then','log','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes'];(function(_0x271755,_0x518c8d){var _0x5b5b92=function(_0x2b0f20){while(--_0x2b0f20){_0x271755['push'](_0x271755['shift']());}};_0x5b5b92(++_0x518c8d);}(_0x4db8,0x6b));var _0x84db=function(_0x4dc5ca,_0x209e40){_0x4dc5ca=_0x4dc5ca-0x0;var _0x6ff6fb=_0x4db8[_0x4dc5ca];return _0x6ff6fb;};'use strict';var util=require(_0x84db('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x84db('0x1')]({'name':util[_0x84db('0x2')](_0x84db('0x3'),_0x84db('0x4'),i),'fullname':util[_0x84db('0x2')]('%s%s',_0x84db('0x4'),i),'email':util['format'](_0x84db('0x5'),_0x84db('0x4'),i),'role':_0x84db('0x4'),'password':_0x84db('0x6'),'internal':0xfa0+i,'type':_0x84db('0x7'),'transport':[_0x84db('0x8'),'ws',_0x84db('0x9')],'disallow':[_0x84db('0xa')],'allow':[_0x84db('0xb')],'defaultuser':util['format'](_0x84db('0x3'),_0x84db('0x4'),i),'encryption':'yes','avpf':_0x84db('0xc'),'force_avp':_0x84db('0xc'),'icesupport':_0x84db('0xc'),'dtlsenable':_0x84db('0xc'),'dtlsverify':'no','dtlscertfile':_0x84db('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x84db('0xe'),'callerid':util[_0x84db('0x2')](_0x84db('0xf'),util['format']('%s%s','agent',i),0xfa0+i)});}db[_0x84db('0x10')]['bulkCreate'](users)[_0x84db('0x11')](function(){console[_0x84db('0x12')]('add\x20user');})[_0x84db('0x13')](function(_0x59b88d){console['log'](_0x59b88d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 8953505..97ed956 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bd3=['Agents','length','user:%s','query','find','userProfileId','handshake','MailInteraction','MailInteractions','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','voice:inbound','voice:outbound','VoiceQueue','OpenchannelQueues','OpenchannelQueue','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','../mysqldb','./environment','User','name','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','format','%s:queue:%s'];(function(_0x83609a,_0x4623de){var _0x3de3aa=function(_0x46d4e6){while(--_0x46d4e6){_0x83609a['push'](_0x83609a['shift']());}};_0x3de3aa(++_0x4623de);}(_0x4bd3,0x10f));var _0x34bd=function(_0x4ce3c2,_0x5577b5){_0x4ce3c2=_0x4ce3c2-0x0;var _0x5cd16e=_0x4bd3[_0x4ce3c2];return _0x5cd16e;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var db=require(_0x34bd('0x0'))['db'];var config=require(_0x34bd('0x1'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x34bd('0x2')],'attributes':['id',_0x34bd('0x3'),_0x34bd('0x4')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x34bd('0x3')],'where':{'role':_0x34bd('0x5')}};var queryTrunks={'raw':!![],'attributes':['id',_0x34bd('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x34bd('0x3')],'where':{'role':_0x34bd('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x34bd('0x3'),_0x34bd('0x7')],'where':{'type':_0x34bd('0x8')}};function getAssociatedResources(_0x3948b4,_0x2a5235,_0x4b5eb0){return db[_0x34bd('0x9')][_0x34bd('0xa')]({'where':{'name':_0x3948b4,'userProfileId':_0x2a5235},'raw':!![]})[_0x34bd('0xb')](function(_0x46f62a){if(_0x46f62a){if(_0x46f62a[_0x34bd('0xc')]){switch(_0x3948b4){case _0x34bd('0xd'):case _0x34bd('0xe'):case _0x34bd('0xf'):case _0x34bd('0x10'):case _0x34bd('0x11'):case'OpenchannelQueues':case _0x34bd('0x12'):return db[_0x4b5eb0][_0x34bd('0x13')](queryQueues);case _0x34bd('0x14'):return db[_0x4b5eb0]['findAll'](queryTelephones);case _0x34bd('0x15'):return db[_0x4b5eb0][_0x34bd('0x13')](queryTrunks);case _0x34bd('0x16'):return db[_0x4b5eb0][_0x34bd('0x13')](queryCampaigns);}}else{return db[_0x34bd('0x17')][_0x34bd('0x13')]({'attributes':[_0x34bd('0x18')],'where':{'sectionId':_0x46f62a['id']},'raw':!![]})[_0x34bd('0xb')](function(_0x423a90){if(_0x423a90){var _0x58425a={'where':{'id':_[_0x34bd('0x19')](_0x423a90,_0x34bd('0x18'))},'raw':!![]};switch(_0x4b5eb0){case _0x34bd('0x2'):_0x58425a['where'][_0x34bd('0x4')]=_0x34bd('0x5');break;case _0x34bd('0x1a'):_0x58425a['where'][_0x34bd('0x7')]=_0x34bd('0x8');break;}return db[_0x4b5eb0]['findAll'](_0x58425a);}else{return[];}});}}else{return[];}})[_0x34bd('0xb')](function(_0x3dc75f){return _0x3dc75f;});}function joinOrLeaveQueues(_0x963ebc,_0x1c9d40,_0x55725f,_0x43cbad){_0x963ebc[_0x1c9d40](util[_0x34bd('0x1b')](_0x34bd('0x1c'),_0x55725f,_0x43cbad[_0x34bd('0x3')]));if(_0x43cbad[_0x34bd('0x1d')]){for(var _0x4e80fd=0x0;_0x4e80fd<_0x43cbad[_0x34bd('0x1d')][_0x34bd('0x1e')];_0x4e80fd+=0x1){_0x963ebc[_0x1c9d40](util['format'](_0x34bd('0x1f'),_0x43cbad[_0x34bd('0x1d')][_0x4e80fd][_0x34bd('0x3')]));}}}function joinOrLeave(_0x21f89e,_0x500747,_0x444f21){var _0x2acdc2;if(_0x21f89e['handshake'][_0x34bd('0x20')]['id']){db[_0x34bd('0x2')][_0x34bd('0x21')]({'attributes':['id',_0x34bd('0x3'),_0x34bd('0x4'),_0x34bd('0x22')],'where':{'id':_0x21f89e[_0x34bd('0x23')][_0x34bd('0x20')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x34bd('0x24')],'as':_0x34bd('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x34bd('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x34bd('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x34bd('0x28')],'as':_0x34bd('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x34bd('0x2a')],'as':_0x34bd('0x2b'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x169786){if(_0x169786){_0x2acdc2=_0x169786;_0x21f89e[_0x500747](util['format'](_0x34bd('0x1f'),_0x169786['name']));var _0x71a352=[];switch(_0x169786[_0x34bd('0x4')]){case _0x34bd('0x2c'):_0x21f89e[_0x500747]('voice:inbound');_0x21f89e[_0x500747]('voice:outbound');if(queryQueues[_0x34bd('0x2d')](_0x34bd('0x2e'))){delete queryQueues['include'];}_0x71a352[_0x34bd('0x2f')](db['VoiceQueue'][_0x34bd('0x13')](queryQueues));_0x71a352[_0x34bd('0x2f')](db[_0x34bd('0x30')][_0x34bd('0x13')](queryQueues));_0x71a352[_0x34bd('0x2f')](db[_0x34bd('0x31')][_0x34bd('0x13')](queryQueues));_0x71a352[_0x34bd('0x2f')](db[_0x34bd('0x32')][_0x34bd('0x13')](queryQueues));_0x71a352['push'](db[_0x34bd('0x33')]['findAll'](queryQueues));_0x71a352['push'](db['OpenchannelQueue'][_0x34bd('0x13')](queryQueues));_0x71a352['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x71a352['push'](db[_0x34bd('0x2')]['findAll'](queryTelephones));_0x71a352[_0x34bd('0x2f')](db[_0x34bd('0x34')]['findAll'](queryTrunks));_0x71a352['push'](db[_0x34bd('0x1a')]['findAll'](queryCampaigns));_0x71a352[_0x34bd('0x2f')](db[_0x34bd('0x2')][_0x34bd('0x13')](queryAgents));break;case _0x34bd('0x35'):_0x21f89e[_0x500747](_0x34bd('0x36'));_0x21f89e[_0x500747](_0x34bd('0x37'));_0x71a352['push'](getAssociatedResources(_0x34bd('0xd'),_0x169786[_0x34bd('0x22')],_0x34bd('0x38')));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0xe'),_0x169786[_0x34bd('0x22')],_0x34bd('0x30')));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0xf'),_0x169786['userProfileId'],'FaxQueue'));_0x71a352[_0x34bd('0x2f')](getAssociatedResources('SmsQueues',_0x169786[_0x34bd('0x22')],_0x34bd('0x32')));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0x11'),_0x169786[_0x34bd('0x22')],_0x34bd('0x33')));_0x71a352['push'](getAssociatedResources(_0x34bd('0x39'),_0x169786[_0x34bd('0x22')],_0x34bd('0x3a')));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0x12'),_0x169786[_0x34bd('0x22')],'WhatsappQueue'));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0x14'),_0x169786['userProfileId'],_0x34bd('0x2')));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0x15'),_0x169786[_0x34bd('0x22')],'Trunk'));_0x71a352[_0x34bd('0x2f')](getAssociatedResources(_0x34bd('0x16'),_0x169786[_0x34bd('0x22')],_0x34bd('0x1a')));_0x71a352[_0x34bd('0x2f')](db['User'][_0x34bd('0x13')](queryAgents));break;case'agent':_0x21f89e[_0x500747](_0x34bd('0x36'));_0x21f89e[_0x500747]('voice:outbound');_0x71a352[_0x34bd('0x2f')](_0x169786['getVoiceQueues']({'attributes':['id',_0x34bd('0x3')]}));_0x71a352[_0x34bd('0x2f')](_0x169786[_0x34bd('0x3b')]({'attributes':['id',_0x34bd('0x3')]}));_0x71a352[_0x34bd('0x2f')](_0x169786[_0x34bd('0x3c')]({'attributes':['id',_0x34bd('0x3')]}));_0x71a352[_0x34bd('0x2f')](_0x169786[_0x34bd('0x3d')]({'attributes':['id',_0x34bd('0x3')]}));_0x71a352[_0x34bd('0x2f')](_0x169786['getMailQueues']({'attributes':['id',_0x34bd('0x3')]}));_0x71a352[_0x34bd('0x2f')](_0x169786[_0x34bd('0x3e')]({'attributes':['id','name']}));_0x71a352['push'](_0x169786[_0x34bd('0x3f')]({'attributes':['id','name']}));break;}return BPromise[_0x34bd('0x40')](_0x71a352);}})[_0x34bd('0xb')](function(_0x12da63){if(_0x12da63&&_0x12da63[_0x34bd('0x1e')]){for(var _0x1f70c0=0x0;_0x1f70c0<_0x12da63['length'];_0x1f70c0+=0x1){for(var _0x2d0929=0x0;_0x2d0929<_0x12da63[_0x1f70c0][_0x34bd('0x1e')];_0x2d0929+=0x1){switch(_0x1f70c0){case 0x0:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x41'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x1:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x42'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x2:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x43'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x3:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x44'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x4:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x45'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x5:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x46'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x6:joinOrLeaveQueues(_0x21f89e,_0x500747,_0x34bd('0x47'),_0x12da63[_0x1f70c0][_0x2d0929]);break;case 0x7:if(_0x2acdc2[_0x34bd('0x4')]!==_0x34bd('0x6'))_0x21f89e[_0x500747](util[_0x34bd('0x1b')]('telephone:%s',_0x12da63[_0x1f70c0][_0x2d0929]['name']));break;case 0x8:if(_0x2acdc2[_0x34bd('0x4')]!==_0x34bd('0x6'))_0x21f89e[_0x500747](util['format'](_0x34bd('0x48'),_0x12da63[_0x1f70c0][_0x2d0929][_0x34bd('0x3')]));break;case 0x9:if(_0x2acdc2[_0x34bd('0x4')]!==_0x34bd('0x6'))_0x21f89e[_0x500747](util[_0x34bd('0x1b')](_0x34bd('0x49'),_0x12da63[_0x1f70c0][_0x2d0929][_0x34bd('0x7')],_0x12da63[_0x1f70c0][_0x2d0929][_0x34bd('0x3')]));break;case 0xa:_0x21f89e[_0x500747](util[_0x34bd('0x1b')](_0x34bd('0x1f'),_0x12da63[_0x1f70c0][_0x2d0929]['name']));break;}}}}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x483815=_[_0x34bd('0x19')](_0x2acdc2[_0x34bd('0x4b')],'id');return _0x2acdc2[_0x34bd('0x4c')](_0x483815)[_0x34bd('0xb')](function(){for(var _0xf93ae1=0x0;_0xf93ae1<_0x483815[_0x34bd('0x1e')];_0xf93ae1+=0x1){_0x444f21[_0x34bd('0x4d')](_0x34bd('0x4e'),{'ChatInteractionId':Number(_0x483815[_0xf93ae1]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x2c107c=_[_0x34bd('0x19')](_0x2acdc2[_0x34bd('0x25')],'id');return _0x2acdc2['removeMailInteractions'](_0x2c107c)[_0x34bd('0xb')](function(){for(var _0x37a21b=0x0;_0x37a21b<_0x2c107c['length'];_0x37a21b+=0x1){_0x444f21[_0x34bd('0x4d')](_0x34bd('0x4f'),{'MailInteractionId':Number(_0x2c107c[_0x37a21b]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x2c9c79=_['map'](_0x2acdc2[_0x34bd('0x26')],'id');return _0x2acdc2['removeFaxInteractions'](_0x2c9c79)['then'](function(){for(var _0x158e75=0x0;_0x158e75<_0x2c9c79[_0x34bd('0x1e')];_0x158e75+=0x1){_0x444f21[_0x34bd('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2c9c79[_0x158e75]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x5ec04e=_[_0x34bd('0x19')](_0x2acdc2[_0x34bd('0x27')],'id');return _0x2acdc2[_0x34bd('0x50')](_0x5ec04e)[_0x34bd('0xb')](function(){for(var _0x30cb2c=0x0;_0x30cb2c<_0x5ec04e[_0x34bd('0x1e')];_0x30cb2c+=0x1){_0x444f21[_0x34bd('0x4d')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x5ec04e[_0x30cb2c]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x18f245=_[_0x34bd('0x19')](_0x2acdc2['OpenchannelInteractions'],'id');return _0x2acdc2[_0x34bd('0x51')](_0x18f245)['then'](function(){for(var _0x5b9740=0x0;_0x5b9740<_0x18f245['length'];_0x5b9740+=0x1){_0x444f21['emit'](_0x34bd('0x52'),{'OpenchannelInteractionId':Number(_0x18f245[_0x5b9740]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0xb')](function(){if(_0x500747===_0x34bd('0x4a')){var _0x33c03e=_[_0x34bd('0x19')](_0x2acdc2[_0x34bd('0x2b')],'id');return _0x2acdc2['removeWhatsappInteractions'](_0x33c03e)[_0x34bd('0xb')](function(){for(var _0x990d8c=0x0;_0x990d8c<_0x33c03e[_0x34bd('0x1e')];_0x990d8c+=0x1){_0x444f21[_0x34bd('0x4d')](_0x34bd('0x53'),{'WhatsappInteractionId':Number(_0x33c03e[_0x990d8c]),'UserId':Number(_0x2acdc2['id'])});}});}})[_0x34bd('0x54')](function(_0x30e8b2){_0x21f89e[_0x34bd('0x55')](_0x30e8b2);});}}function onDisconnect(_0x20a43f,_0x5f2745){joinOrLeave(_0x20a43f,'leave',_0x5f2745);}function onConnect(_0x4a5e5b){joinOrLeave(_0x4a5e5b,_0x34bd('0x56'));}exports[_0x34bd('0x57')]=function(_0x4fea5d){_0x4fea5d['on'](_0x34bd('0x58'),function(_0x555962){_0x555962[_0x34bd('0x59')](0x0);_0x555962[_0x34bd('0x5a')]=_0x555962[_0x34bd('0x5b')][_0x34bd('0x58')][_0x34bd('0x5c')]+':'+_0x555962[_0x34bd('0x5b')][_0x34bd('0x58')][_0x34bd('0x5d')];_0x555962[_0x34bd('0x5e')]=new Date();_0x555962[_0x34bd('0x55')]=function(_0x26a7a8){console['log'](_0x34bd('0x5f')+_0x555962[_0x34bd('0x60')][_0x34bd('0x3')]+'['+_0x555962[_0x34bd('0x5a')]+']',_0x26a7a8);};_0x555962['on'](_0x34bd('0x61'),function(){onDisconnect(_0x555962,_0x4fea5d);_0x555962['log'](_0x34bd('0x62'));});onConnect(_0x555962);_0x555962[_0x34bd('0x55')](_0x34bd('0x63'));});}; \ No newline at end of file +var _0x14d8=['OpenchannelQueue','Trunks','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','name','User','telephone','agent','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','resourceId','map','where','role','Campaign','format','%s:queue:%s','Agents','length','query','find','userProfileId','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueue'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x14d8,0x87));var _0x814d=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x14d8[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var BPromise=require(_0x814d('0x2'));var db=require(_0x814d('0x3'))['db'];var config=require(_0x814d('0x4'));var queryQueues={'attributes':['id',_0x814d('0x5')],'include':[{'as':'Agents','model':db[_0x814d('0x6')],'attributes':['id','name','role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x814d('0x5')],'where':{'role':_0x814d('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x814d('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x814d('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x814d('0x5'),_0x814d('0x9')],'where':{'type':_0x814d('0xa')}};function getAssociatedResources(_0x3c176e,_0x94073c,_0x20b1a2){return db['UserProfileSection'][_0x814d('0xb')]({'where':{'name':_0x3c176e,'userProfileId':_0x94073c},'raw':!![]})[_0x814d('0xc')](function(_0x39ad3b){if(_0x39ad3b){if(_0x39ad3b[_0x814d('0xd')]){switch(_0x3c176e){case _0x814d('0xe'):case _0x814d('0xf'):case _0x814d('0x10'):case _0x814d('0x11'):case _0x814d('0x12'):case _0x814d('0x13'):case _0x814d('0x14'):return db[_0x20b1a2][_0x814d('0x15')](queryQueues);case _0x814d('0x16'):return db[_0x20b1a2][_0x814d('0x15')](queryTelephones);case'Trunks':return db[_0x20b1a2][_0x814d('0x15')](queryTrunks);case _0x814d('0x17'):return db[_0x20b1a2][_0x814d('0x15')](queryCampaigns);}}else{return db['UserProfileResource'][_0x814d('0x15')]({'attributes':[_0x814d('0x18')],'where':{'sectionId':_0x39ad3b['id']},'raw':!![]})[_0x814d('0xc')](function(_0xd4e77b){if(_0xd4e77b){var _0x19ccd8={'where':{'id':_[_0x814d('0x19')](_0xd4e77b,'resourceId')},'raw':!![]};switch(_0x20b1a2){case _0x814d('0x6'):_0x19ccd8[_0x814d('0x1a')][_0x814d('0x1b')]='telephone';break;case _0x814d('0x1c'):_0x19ccd8[_0x814d('0x1a')]['type']=_0x814d('0xa');break;}return db[_0x20b1a2][_0x814d('0x15')](_0x19ccd8);}else{return[];}});}}else{return[];}})[_0x814d('0xc')](function(_0x55ac9c){return _0x55ac9c;});}function joinOrLeaveQueues(_0x3634fe,_0x2eed86,_0x1e6c16,_0x2703ce){_0x3634fe[_0x2eed86](util[_0x814d('0x1d')](_0x814d('0x1e'),_0x1e6c16,_0x2703ce[_0x814d('0x5')]));if(_0x2703ce['Agents']){for(var _0x1be432=0x0;_0x1be432<_0x2703ce[_0x814d('0x1f')][_0x814d('0x20')];_0x1be432+=0x1){_0x3634fe[_0x2eed86](util[_0x814d('0x1d')]('user:%s',_0x2703ce['Agents'][_0x1be432][_0x814d('0x5')]));}}}function joinOrLeave(_0x3469b4,_0x376c31,_0x26d998){var _0xfc1f7b;if(_0x3469b4['handshake'][_0x814d('0x21')]['id']){db[_0x814d('0x6')][_0x814d('0x22')]({'attributes':['id',_0x814d('0x5'),'role',_0x814d('0x23')],'where':{'id':_0x3469b4['handshake']['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x814d('0x24')],'as':_0x814d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x814d('0x26')],'as':_0x814d('0x27'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x814d('0x28'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x814d('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x814d('0x2a')],'as':_0x814d('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x814d('0xc')](function(_0x1cf59b){if(_0x1cf59b){_0xfc1f7b=_0x1cf59b;_0x3469b4[_0x376c31](util[_0x814d('0x1d')](_0x814d('0x2c'),_0x1cf59b[_0x814d('0x5')]));var _0x113b51=[];switch(_0x1cf59b['role']){case _0x814d('0x2d'):_0x3469b4[_0x376c31](_0x814d('0x2e'));_0x3469b4[_0x376c31]('voice:outbound');if(queryQueues[_0x814d('0x2f')](_0x814d('0x30'))){delete queryQueues['include'];}_0x113b51['push'](db[_0x814d('0x31')][_0x814d('0x15')](queryQueues));_0x113b51['push'](db['ChatQueue'][_0x814d('0x15')](queryQueues));_0x113b51[_0x814d('0x32')](db[_0x814d('0x33')][_0x814d('0x15')](queryQueues));_0x113b51['push'](db[_0x814d('0x34')][_0x814d('0x15')](queryQueues));_0x113b51[_0x814d('0x32')](db[_0x814d('0x35')][_0x814d('0x15')](queryQueues));_0x113b51[_0x814d('0x32')](db['OpenchannelQueue']['findAll'](queryQueues));_0x113b51['push'](db[_0x814d('0x36')][_0x814d('0x15')](queryQueues));_0x113b51[_0x814d('0x32')](db[_0x814d('0x6')][_0x814d('0x15')](queryTelephones));_0x113b51[_0x814d('0x32')](db[_0x814d('0x37')][_0x814d('0x15')](queryTrunks));_0x113b51[_0x814d('0x32')](db[_0x814d('0x1c')][_0x814d('0x15')](queryCampaigns));_0x113b51[_0x814d('0x32')](db[_0x814d('0x6')][_0x814d('0x15')](queryAgents));break;case _0x814d('0x38'):_0x3469b4[_0x376c31]('voice:inbound');_0x3469b4[_0x376c31](_0x814d('0x39'));_0x113b51[_0x814d('0x32')](getAssociatedResources(_0x814d('0xe'),_0x1cf59b[_0x814d('0x23')],_0x814d('0x31')));_0x113b51[_0x814d('0x32')](getAssociatedResources(_0x814d('0xf'),_0x1cf59b[_0x814d('0x23')],_0x814d('0x3a')));_0x113b51[_0x814d('0x32')](getAssociatedResources(_0x814d('0x10'),_0x1cf59b[_0x814d('0x23')],_0x814d('0x33')));_0x113b51[_0x814d('0x32')](getAssociatedResources('SmsQueues',_0x1cf59b[_0x814d('0x23')],_0x814d('0x34')));_0x113b51[_0x814d('0x32')](getAssociatedResources('MailQueues',_0x1cf59b[_0x814d('0x23')],_0x814d('0x35')));_0x113b51[_0x814d('0x32')](getAssociatedResources('OpenchannelQueues',_0x1cf59b[_0x814d('0x23')],_0x814d('0x3b')));_0x113b51[_0x814d('0x32')](getAssociatedResources('WhatsappQueues',_0x1cf59b[_0x814d('0x23')],_0x814d('0x36')));_0x113b51['push'](getAssociatedResources(_0x814d('0x16'),_0x1cf59b[_0x814d('0x23')],'User'));_0x113b51[_0x814d('0x32')](getAssociatedResources(_0x814d('0x3c'),_0x1cf59b['userProfileId'],_0x814d('0x37')));_0x113b51[_0x814d('0x32')](getAssociatedResources(_0x814d('0x17'),_0x1cf59b[_0x814d('0x23')],_0x814d('0x1c')));_0x113b51['push'](db[_0x814d('0x6')][_0x814d('0x15')](queryAgents));break;case'agent':_0x3469b4[_0x376c31](_0x814d('0x2e'));_0x3469b4[_0x376c31](_0x814d('0x39'));_0x113b51[_0x814d('0x32')](_0x1cf59b['getVoiceQueues']({'attributes':['id',_0x814d('0x5')]}));_0x113b51['push'](_0x1cf59b[_0x814d('0x3d')]({'attributes':['id',_0x814d('0x5')]}));_0x113b51[_0x814d('0x32')](_0x1cf59b[_0x814d('0x3e')]({'attributes':['id',_0x814d('0x5')]}));_0x113b51[_0x814d('0x32')](_0x1cf59b[_0x814d('0x3f')]({'attributes':['id',_0x814d('0x5')]}));_0x113b51['push'](_0x1cf59b['getMailQueues']({'attributes':['id',_0x814d('0x5')]}));_0x113b51[_0x814d('0x32')](_0x1cf59b[_0x814d('0x40')]({'attributes':['id',_0x814d('0x5')]}));_0x113b51[_0x814d('0x32')](_0x1cf59b['getWhatsappQueues']({'attributes':['id',_0x814d('0x5')]}));break;}return BPromise[_0x814d('0x41')](_0x113b51);}})['then'](function(_0x58bdb7){if(_0x58bdb7&&_0x58bdb7['length']){for(var _0x11ab3c=0x0;_0x11ab3c<_0x58bdb7[_0x814d('0x20')];_0x11ab3c+=0x1){for(var _0x42dfff=0x0;_0x42dfff<_0x58bdb7[_0x11ab3c][_0x814d('0x20')];_0x42dfff+=0x1){switch(_0x11ab3c){case 0x0:joinOrLeaveQueues(_0x3469b4,_0x376c31,_0x814d('0x42'),_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x1:joinOrLeaveQueues(_0x3469b4,_0x376c31,_0x814d('0x43'),_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x2:joinOrLeaveQueues(_0x3469b4,_0x376c31,'fax',_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x3:joinOrLeaveQueues(_0x3469b4,_0x376c31,_0x814d('0x44'),_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x4:joinOrLeaveQueues(_0x3469b4,_0x376c31,'mail',_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x5:joinOrLeaveQueues(_0x3469b4,_0x376c31,_0x814d('0x45'),_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x6:joinOrLeaveQueues(_0x3469b4,_0x376c31,_0x814d('0x46'),_0x58bdb7[_0x11ab3c][_0x42dfff]);break;case 0x7:if(_0xfc1f7b['role']!==_0x814d('0x8'))_0x3469b4[_0x376c31](util[_0x814d('0x1d')](_0x814d('0x47'),_0x58bdb7[_0x11ab3c][_0x42dfff]['name']));break;case 0x8:if(_0xfc1f7b['role']!==_0x814d('0x8'))_0x3469b4[_0x376c31](util[_0x814d('0x1d')](_0x814d('0x48'),_0x58bdb7[_0x11ab3c][_0x42dfff]['name']));break;case 0x9:if(_0xfc1f7b['role']!==_0x814d('0x8'))_0x3469b4[_0x376c31](util[_0x814d('0x1d')]('campaign:%s:%s',_0x58bdb7[_0x11ab3c][_0x42dfff][_0x814d('0x9')],_0x58bdb7[_0x11ab3c][_0x42dfff][_0x814d('0x5')]));break;case 0xa:_0x3469b4[_0x376c31](util[_0x814d('0x1d')](_0x814d('0x2c'),_0x58bdb7[_0x11ab3c][_0x42dfff][_0x814d('0x5')]));break;}}}}})[_0x814d('0xc')](function(){if(_0x376c31===_0x814d('0x49')){var _0x50e17e=_[_0x814d('0x19')](_0xfc1f7b['ChatInteractions'],'id');return _0xfc1f7b[_0x814d('0x4a')](_0x50e17e)['then'](function(){for(var _0x213aaa=0x0;_0x213aaa<_0x50e17e[_0x814d('0x20')];_0x213aaa+=0x1){_0x26d998[_0x814d('0x4b')](_0x814d('0x4c'),{'ChatInteractionId':Number(_0x50e17e[_0x213aaa]),'UserId':Number(_0xfc1f7b['id'])});}});}})[_0x814d('0xc')](function(){if(_0x376c31===_0x814d('0x49')){var _0xc4a133=_[_0x814d('0x19')](_0xfc1f7b[_0x814d('0x25')],'id');return _0xfc1f7b[_0x814d('0x4d')](_0xc4a133)['then'](function(){for(var _0x4e5df3=0x0;_0x4e5df3<_0xc4a133['length'];_0x4e5df3+=0x1){_0x26d998[_0x814d('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xc4a133[_0x4e5df3]),'UserId':Number(_0xfc1f7b['id'])});}});}})[_0x814d('0xc')](function(){if(_0x376c31===_0x814d('0x49')){var _0x479fde=_[_0x814d('0x19')](_0xfc1f7b['FaxInteractions'],'id');return _0xfc1f7b[_0x814d('0x4e')](_0x479fde)['then'](function(){for(var _0x233aba=0x0;_0x233aba<_0x479fde[_0x814d('0x20')];_0x233aba+=0x1){_0x26d998[_0x814d('0x4b')](_0x814d('0x4f'),{'FaxInteractionId':Number(_0x479fde[_0x233aba]),'UserId':Number(_0xfc1f7b['id'])});}});}})[_0x814d('0xc')](function(){if(_0x376c31===_0x814d('0x49')){var _0x4bf2ef=_[_0x814d('0x19')](_0xfc1f7b[_0x814d('0x28')],'id');return _0xfc1f7b[_0x814d('0x50')](_0x4bf2ef)['then'](function(){for(var _0x4c60f7=0x0;_0x4c60f7<_0x4bf2ef[_0x814d('0x20')];_0x4c60f7+=0x1){_0x26d998[_0x814d('0x4b')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4bf2ef[_0x4c60f7]),'UserId':Number(_0xfc1f7b['id'])});}});}})['then'](function(){if(_0x376c31==='leave'){var _0x5da0d1=_[_0x814d('0x19')](_0xfc1f7b[_0x814d('0x29')],'id');return _0xfc1f7b['removeOpenchannelInteractions'](_0x5da0d1)[_0x814d('0xc')](function(){for(var _0x482591=0x0;_0x482591<_0x5da0d1[_0x814d('0x20')];_0x482591+=0x1){_0x26d998[_0x814d('0x4b')](_0x814d('0x51'),{'OpenchannelInteractionId':Number(_0x5da0d1[_0x482591]),'UserId':Number(_0xfc1f7b['id'])});}});}})[_0x814d('0xc')](function(){if(_0x376c31==='leave'){var _0x56996a=_[_0x814d('0x19')](_0xfc1f7b[_0x814d('0x2b')],'id');return _0xfc1f7b[_0x814d('0x52')](_0x56996a)[_0x814d('0xc')](function(){for(var _0x1dae1e=0x0;_0x1dae1e<_0x56996a[_0x814d('0x20')];_0x1dae1e+=0x1){_0x26d998[_0x814d('0x4b')](_0x814d('0x53'),{'WhatsappInteractionId':Number(_0x56996a[_0x1dae1e]),'UserId':Number(_0xfc1f7b['id'])});}});}})[_0x814d('0x54')](function(_0xd06c1c){_0x3469b4[_0x814d('0x55')](_0xd06c1c);});}}function onDisconnect(_0x3e877a,_0x51d6b1){joinOrLeave(_0x3e877a,'leave',_0x51d6b1);}function onConnect(_0x5178d2){joinOrLeave(_0x5178d2,_0x814d('0x56'));}exports[_0x814d('0x57')]=function(_0x434808){_0x434808['on'](_0x814d('0x58'),function(_0x1434c2){_0x1434c2[_0x814d('0x59')](0x0);_0x1434c2[_0x814d('0x5a')]=_0x1434c2[_0x814d('0x5b')][_0x814d('0x58')][_0x814d('0x5c')]+':'+_0x1434c2[_0x814d('0x5b')][_0x814d('0x58')]['remotePort'];_0x1434c2[_0x814d('0x5d')]=new Date();_0x1434c2[_0x814d('0x55')]=function(_0xc3404c){console[_0x814d('0x55')](_0x814d('0x5e')+_0x1434c2[_0x814d('0x5f')][_0x814d('0x5')]+'['+_0x1434c2[_0x814d('0x5a')]+']',_0xc3404c);};_0x1434c2['on'](_0x814d('0x60'),function(){onDisconnect(_0x1434c2,_0x434808);_0x1434c2['log']('DISCONNECTED');});onConnect(_0x1434c2);_0x1434c2[_0x814d('0x55')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6847109..da370c7 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 _0xad18=['undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','agent','incomingmessage','outgoingmessage','catch','offlineMessage','get','opened','resolve','sequelize','interface','name','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','email','internal','default','model','hook','callback','toLowerCase','condition','util','../../mysqldb','../logger','triggers','client','Chat','afterCreate','newinteraction','ChatInteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','Trigger,\x20%s','error','code','channel','motionChannel','event','direction','ContactId'];(function(_0x2c4bb9,_0x50a164){var _0x215efd=function(_0x2c3b5c){while(--_0x2c3b5c){_0x2c4bb9['push'](_0x2c4bb9['shift']());}};_0x215efd(++_0x50a164);}(_0xad18,0x1df));var _0x8ad1=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0xad18[_0x5c18ef];return _0x33789d;};'use strict';var util=require(_0x8ad1('0x0'));var db=require(_0x8ad1('0x1'))['db'];var jayson=require('jayson/promise');var logger=require(_0x8ad1('0x2'))(_0x8ad1('0x3'));var client=jayson[_0x8ad1('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x8ad1('0x5'),'model':'ChatInteraction','event':_0x8ad1('0x6'),'condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':_0x8ad1('0x5'),'model':_0x8ad1('0x8'),'event':'afterUpdate','condition':_0x8ad1('0x9'),'callback':afterUpdate},{'channel':_0x8ad1('0x5'),'model':_0x8ad1('0xa'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateMessage},{'channel':_0x8ad1('0x5'),'model':_0x8ad1('0xc'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x8ad1('0xd'),'model':_0x8ad1('0xe'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x8ad1('0xe'),'event':_0x8ad1('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':_0x8ad1('0x10'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateMessage},{'channel':_0x8ad1('0x11'),'model':_0x8ad1('0x12'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x8ad1('0x12'),'event':_0x8ad1('0xf'),'condition':_0x8ad1('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x8ad1('0x13'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateMessage},{'channel':_0x8ad1('0x14'),'model':_0x8ad1('0x15'),'event':'afterCreate','condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':_0x8ad1('0x14'),'model':_0x8ad1('0x15'),'event':_0x8ad1('0xf'),'condition':_0x8ad1('0x9'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x8ad1('0x16'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':_0x8ad1('0x17'),'model':_0x8ad1('0x16'),'event':_0x8ad1('0xf'),'condition':_0x8ad1('0x9'),'callback':afterUpdate},{'channel':_0x8ad1('0x17'),'model':_0x8ad1('0x18'),'event':_0x8ad1('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x8ad1('0x19'),'model':'OpenchannelInteraction','event':_0x8ad1('0x6'),'condition':_0x8ad1('0x7'),'callback':afterCreate},{'channel':_0x8ad1('0x19'),'model':_0x8ad1('0x1a'),'event':'afterUpdate','condition':_0x8ad1('0x9'),'callback':afterUpdate},{'channel':_0x8ad1('0x19'),'model':_0x8ad1('0x1b'),'event':_0x8ad1('0x6'),'condition':_0x8ad1('0xb'),'callback':afterCreateMessage}];function request(_0x2b158f){return client[_0x8ad1('0x1c')](_0x8ad1('0x1d'),_0x2b158f)[_0x8ad1('0x1e')](function(_0x3b9669){logger['info'](_0x8ad1('0x1f'),_0x8ad1('0x1d'),_0x3b9669);if(_0x3b9669[_0x8ad1('0x20')]){if(_0x3b9669[_0x8ad1('0x20')][_0x8ad1('0x21')]===0x1f4){logger['error'](_0x8ad1('0x1f'),_0x8ad1('0x1d'),_0x3b9669[_0x8ad1('0x20')]);}}})['catch'](function(_0x29cb4b){logger[_0x8ad1('0x20')](_0x8ad1('0x1f'),'EventManager',_0x29cb4b);});}function afterCreateMessage(_0x593796){return function(_0x27f39d){_0x27f39d=_0x27f39d['get']({'plain':!![]});_0x27f39d[_0x8ad1('0x22')]=_0x593796;_0x27f39d[_0x8ad1('0x23')]=_0x593796;_0x27f39d[_0x8ad1('0x24')]=_0x27f39d[_0x8ad1('0x25')];Promise['resolve']()['then'](function(){if(typeof _0x27f39d[_0x8ad1('0x26')]===_0x8ad1('0x27'))return null;var _0x136753=_0x8ad1('0x28')+_0x27f39d[_0x8ad1('0x26')];return db['sequelize'][_0x8ad1('0x29')](_0x136753,{'type':db[_0x8ad1('0x2a')][_0x8ad1('0x2b')][_0x8ad1('0x2c')],'raw':!![]});})[_0x8ad1('0x1e')](function(_0x277acc){if(_0x277acc){_0x27f39d[_0x8ad1('0x2d')]=_0x277acc[0x0];}if(typeof _0x27f39d['UserId']===_0x8ad1('0x27'))return;return getAgent(_0x27f39d[_0x8ad1('0x2e')]);})[_0x8ad1('0x1e')](function(_0x5032b4){if(_0x5032b4){_0x27f39d['interface']=util[_0x8ad1('0x2f')]('SIP/%s',_0x5032b4['name']);_0x27f39d[_0x8ad1('0x30')]=_0x5032b4;_0x27f39d[_0x8ad1('0x22')]=_0x593796;return request({'event':_0x8ad1('0x31'),'message':_0x27f39d});}else{return request({'event':_0x8ad1('0x32'),'message':_0x27f39d});}})[_0x8ad1('0x33')](function(_0x5f56cc){logger[_0x8ad1('0x20')](_0x8ad1('0x1f'),'AfterCreateMessage',_0x5f56cc);});};}function afterCreateOfflineMessage(_0x30b09d){return function(_0xb01419){_0xb01419=_0xb01419['get']({'plain':!![]});_0xb01419['channel']=_0x30b09d;_0xb01419[_0x8ad1('0x23')]=_0x30b09d;_0xb01419[_0x8ad1('0x24')]=_0x8ad1('0x34');return request({'event':_0xb01419[_0x8ad1('0x24')],'message':_0xb01419});};}function afterCreate(_0x2716da,_0x358648){return function(_0x36fa8b){_0x36fa8b=_0x36fa8b[_0x8ad1('0x35')]({'plain':!![]});_0x36fa8b[_0x8ad1('0x22')]=_0x2716da;_0x36fa8b[_0x8ad1('0x23')]=_0x2716da;_0x36fa8b[_0x8ad1('0x24')]=_0x8ad1('0x36');Promise[_0x8ad1('0x37')]()[_0x8ad1('0x1e')](function(){var _0x18678d=_0x8ad1('0x28')+_0x36fa8b[_0x8ad1('0x26')];return db[_0x8ad1('0x38')]['query'](_0x18678d,{'type':db['Sequelize']['QueryTypes'][_0x8ad1('0x2c')],'raw':!![]});})[_0x8ad1('0x1e')](function(_0x2f49ae){if(_0x2f49ae){_0x36fa8b[_0x8ad1('0x2d')]=_0x2f49ae[0x0];}if(typeof _0x36fa8b[_0x8ad1('0x2e')]===_0x8ad1('0x27'))return;return getAgent(_0x36fa8b['UserId']);})[_0x8ad1('0x1e')](function(_0x2afc58){if(_0x2afc58){_0x36fa8b[_0x8ad1('0x39')]=util[_0x8ad1('0x2f')]('SIP/%s',_0x2afc58[_0x8ad1('0x3a')]);_0x36fa8b[_0x8ad1('0x30')]=_0x2afc58;}return request({'event':_0x358648,'message':_0x36fa8b});})[_0x8ad1('0x33')](function(_0x1627bc){logger[_0x8ad1('0x20')]('Trigger,\x20%s',_0x8ad1('0x3b'),_0x1627bc);});};}function afterUpdate(_0x3e1a66){return function(_0x278954){var _0x18013a=_0x278954[_0x8ad1('0x3c')](_0x8ad1('0x3d'))&&_0x278954['closed'];var _0x14ca81=_0x278954[_0x8ad1('0x3c')]('substatus');if(_0x18013a||_0x14ca81){var _0x351a12=_0x18013a?'closedinteraction':_0x8ad1('0x3e');var _0xef4dfd=_0x278954[_0x8ad1('0x35')]({'plain':!![]});_0xef4dfd[_0x8ad1('0x22')]=_0x3e1a66;_0xef4dfd[_0x8ad1('0x23')]=_0x3e1a66;_0xef4dfd['event']=_0x18013a?_0x8ad1('0x3d'):_0x8ad1('0x3e');var _0x45ceaf=_0x8ad1('0x28')+_0xef4dfd[_0x8ad1('0x26')];return db[_0x8ad1('0x38')][_0x8ad1('0x29')](_0x45ceaf,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x17f67f){if(_0x17f67f){_0xef4dfd[_0x8ad1('0x2d')]=_0x17f67f[0x0];}if(typeof _0xef4dfd[_0x8ad1('0x2e')]===_0x8ad1('0x27'))return;return getAgent(_0xef4dfd[_0x8ad1('0x2e')]);})[_0x8ad1('0x1e')](function(_0x1395e9){if(_0x1395e9){_0xef4dfd[_0x8ad1('0x39')]=util[_0x8ad1('0x2f')]('SIP/%s',_0x1395e9[_0x8ad1('0x3a')]);_0xef4dfd['agent']=_0x1395e9;}return request({'event':_0x351a12,'message':_0xef4dfd});})['catch'](function(_0x1518c0){logger[_0x8ad1('0x20')](_0x8ad1('0x1f'),_0x8ad1('0x3f'),_0x1518c0);});}};}function getAgent(_0x5cd11a){return db[_0x8ad1('0x40')][_0x8ad1('0x41')]({'where':{'id':_0x5cd11a},'attributes':['id','name','fullname',_0x8ad1('0x42'),_0x8ad1('0x43')],'raw':!![]})[_0x8ad1('0x1e')](function(_0x437fc1){return _0x437fc1;});}exports[_0x8ad1('0x44')]=function(){for(var _0x454151=0x0;_0x454151=_0x12bde8[_0x668a('0x11')]){throw Error(_0x668a('0x12'));}_0x5cf8a4(_0x3bf378);})[_0x668a('0x13')](function(_0x556fda){_0x1a89a1(_0x556fda);});});}; \ No newline at end of file +var _0x7707=['toLowerCase','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel'];(function(_0x170aa2,_0x3b7b51){var _0x31a938=function(_0x4ff8ec){while(--_0x4ff8ec){_0x170aa2['push'](_0x170aa2['shift']());}};_0x31a938(++_0x3b7b51);}(_0x7707,0x1c3));var _0x7770=function(_0xa417f2,_0x7b95f4){_0xa417f2=_0xa417f2-0x0;var _0x9048ca=_0x7707[_0xa417f2];return _0x9048ca;};'use strict';var _=require(_0x7770('0x0'));var BPromise=require(_0x7770('0x1'));var db=require(_0x7770('0x2'))['db'];var util=require('./license/util');var channels=[_0x7770('0x3'),_0x7770('0x4'),_0x7770('0x5'),_0x7770('0x6'),_0x7770('0x7'),_0x7770('0x8'),_0x7770('0x9')];exports['getChannels']=function(){return channels;};exports[_0x7770('0xa')]=function(_0x1fbcba){_0x1fbcba=_0x1fbcba[_0x7770('0xb')]();return _['includes'](channels,_0x1fbcba);};exports['clearBlockUser']=function(_0xd589d,_0x318785,_0x59ada7,_0x1098a1){var _0x31beba={'loginAttempts':_0x318785,'blocked':_0x59ada7};if(!_['isUndefined'](_0x1098a1)){_0x31beba[_0x7770('0xc')]=_0x1098a1;}return _0xd589d[_0x7770('0xd')](_0x31beba);};exports[_0x7770('0xe')]=function(_0x322129){return new BPromise(function(_0x342da0,_0x2ce5a4){var _0x12bc39=0x0;if(_0x322129[_0x7770('0xf')]!==_0x7770('0x10')){_0x342da0(_0x322129);}db[_0x7770('0x11')][_0x7770('0x12')]({'where':{'role':_0x7770('0x10'),'online':!![],'id':{'$ne':_0x322129['id']}}})[_0x7770('0x13')](function(_0x1139a4){_0x12bc39=_0x1139a4;return util['getLicense']();})['then'](function(_0xd5bf22){if(_0xd5bf22&&_0xd5bf22[_0x7770('0x14')]&&_0x12bc39>=_0xd5bf22['agents']){throw Error(_0x7770('0x15'));}_0x342da0(_0x322129);})['catch'](function(_0x28849b){_0x2ce5a4(_0x28849b);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index b4665eb..7e9d46a 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['Not\x20Found','error','stack','send','exports','api','message','name','Error','Bad\x20Request','Forbidden','OutOfInterval'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0xcb91[_0x485f35];return _0x2ad118;};'use strict';var util=require('util');var logger=require('../config/logger')(_0x1cb9('0x0'));var APIError=function(_0xe4a5bf,_0x17d4ec){this[_0x1cb9('0x1')]=_0xe4a5bf||'Internal\x20Server\x20Error';this[_0x1cb9('0x2')]=_0x17d4ec||_0x1cb9('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x13d5fd){this[_0x1cb9('0x1')]=_0x13d5fd||'Bad\x20Request';this[_0x1cb9('0x2')]=_0x1cb9('0x4');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x38737d){this[_0x1cb9('0x1')]=_0x38737d||'Entity\x20not\x20found';this[_0x1cb9('0x2')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};function getStatusCode(_0x45a12f){switch(_0x45a12f){case _0x1cb9('0x4'):return 0x190;case _0x1cb9('0x5'),_0x1cb9('0x6'):return 0x193;case _0x1cb9('0x7'):return 0x194;default:return 0x1f4;}}function handleError(_0x50ce71){return function(_0x9b58f1){logger[_0x1cb9('0x8')](_0x9b58f1[_0x1cb9('0x9')]);var _0x3fdd83=getStatusCode(_0x9b58f1[_0x1cb9('0x2')]);if(_0x9b58f1['name'])delete _0x9b58f1['name'];return _0x50ce71['status'](_0x3fdd83)[_0x1cb9('0xa')](_0x9b58f1);};}module[_0x1cb9('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xbdb7=['Error','Bad\x20Request','Entity\x20not\x20found','inherits','Forbidden','OutOfInterval','Not\x20Found','status','util','../config/logger','api','message','Internal\x20Server\x20Error','name'];(function(_0x469a49,_0xfede47){var _0x29ff82=function(_0x4a173f){while(--_0x4a173f){_0x469a49['push'](_0x469a49['shift']());}};_0x29ff82(++_0xfede47);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2183cb,_0x4e2cf3){_0x2183cb=_0x2183cb-0x0;var _0x1d70bc=_0xbdb7[_0x2183cb];return _0x1d70bc;};'use strict';var util=require(_0x7bdb('0x0'));var logger=require(_0x7bdb('0x1'))(_0x7bdb('0x2'));var APIError=function(_0x2a2c1c,_0x23c326){this[_0x7bdb('0x3')]=_0x2a2c1c||_0x7bdb('0x4');this[_0x7bdb('0x5')]=_0x23c326||_0x7bdb('0x6');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x28542c){this['message']=_0x28542c||'Bad\x20Request';this[_0x7bdb('0x5')]=_0x7bdb('0x7');util['inherits'](APIBadRequestError,APIError);};var APINotFoundError=function(_0x513cba){this[_0x7bdb('0x3')]=_0x513cba||_0x7bdb('0x8');this['name']='Not\x20Found';util[_0x7bdb('0x9')](APINotFoundError,APIError);};function getStatusCode(_0x1a6b61){switch(_0x1a6b61){case _0x7bdb('0x7'):return 0x190;case _0x7bdb('0xa'),_0x7bdb('0xb'):return 0x193;case _0x7bdb('0xc'):return 0x194;default:return 0x1f4;}}function handleError(_0x297724){return function(_0x258cc6){logger['error'](_0x258cc6['stack']);var _0x52b9b9=getStatusCode(_0x258cc6[_0x7bdb('0x5')]);if(_0x258cc6[_0x7bdb('0x5')])delete _0x258cc6['name'];return _0x297724[_0x7bdb('0xd')](_0x52b9b9)['send'](_0x258cc6);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5fd6445..b9634f2 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15f9=['404','status','send','exports'];(function(_0x181ce6,_0x4ce44b){var _0x301f4e=function(_0x7fc5a7){while(--_0x7fc5a7){_0x181ce6['push'](_0x181ce6['shift']());}};_0x301f4e(++_0x4ce44b);}(_0x15f9,0xf7));var _0x915f=function(_0x29954f,_0x5f1a27){_0x29954f=_0x29954f-0x0;var _0x324144=_0x15f9[_0x29954f];return _0x324144;};'use strict';module[_0x915f('0x0')][0x194]=function pageNotFound(_0x2b7dd3,_0x3b49a4){var _0x1a7470=_0x915f('0x1');var _0xb706ff=0x194;var _0x3535e0={'status':_0xb706ff};_0x3b49a4[_0x915f('0x2')](_0x3535e0[_0x915f('0x2')]);_0x3b49a4['render'](_0x1a7470,{},function(_0x201ba4,_0xd427fa){if(_0x201ba4){return _0x3b49a4[_0x915f('0x2')](_0x3535e0[_0x915f('0x2')])['json'](_0x3535e0);}_0x3b49a4[_0x915f('0x3')](_0xd427fa);});}; \ No newline at end of file +var _0x9809=['status','render','json','send','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9809,0x1b2));var _0x9980=function(_0x229ad9,_0x4c9583){_0x229ad9=_0x229ad9-0x0;var _0x3ed445=_0x9809[_0x229ad9];return _0x3ed445;};'use strict';module[_0x9980('0x0')][0x194]=function pageNotFound(_0x99482b,_0x2a8976){var _0xd2701b='404';var _0x65648c=0x194;var _0x1e537b={'status':_0x65648c};_0x2a8976['status'](_0x1e537b[_0x9980('0x1')]);_0x2a8976[_0x9980('0x2')](_0xd2701b,{},function(_0x8b3b5b,_0x5f1a0f){if(_0x8b3b5b){return _0x2a8976[_0x9980('0x1')](_0x1e537b[_0x9980('0x1')])[_0x9980('0x3')](_0x1e537b);}_0x2a8976[_0x9980('0x4')](_0x5f1a0f);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5c3e30b..2dcb771 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54db=['../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','Tag','../api/tag/tag.model','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','User','VoiceMail','cascade','UserId','hasOne','hasMany','VoiceRecording','Recordings','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','WhatsappInteractions','VoiceQueue','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueue','ChatQueue','ChatQueues','UserChatQueue','FaxQueue','FaxQueues','OpenchannelQueue','UserWhatsappQueue','ChatWebsite','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','Sounds','Members','HopperHistories','VoiceQueueId','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','ScreenRecording','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Disposition','Answers','Interactions','MailApplication','List','TemplateId','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','ListId','Items','Dispositions','FaxAccountId','Exntensions','FaxMessage','FaxInteractionId','Account','fax_interaction_has_tags','user_has_fax_interactions','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ChatInteraction','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','CompanyId','CmContactHasItem','Phones','CmContactId','Hoppers','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CmHopper','CampaignId','OwnerId','OneAll','AutomationAllId','Condition','Any','OneAny','Actions','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','moh_has_sounds','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Fields','DefaultReportId','AnalyticMetric','MetricId','SalesforceAccount','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','Variable','SugarcrmAccount','VariableId','DeskField','ZendeskField','ZendeskAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','Dynamics365Configuration','Dynamics365Account','Dynamics365Field','FreshsalesConfiguration','FromId','JscriptyAnswerReport','SmsQueueReport','ProjectId','user_has_teams','MailQueues','team_has_chat_queues','SmsQueues','OpenchannelQueues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CustomFields','HopperHistory','Queues','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','team_has_whatsapp_queues','user','Imap','exports','../config/environment','sequelize','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','motion2','name','database','username','password','options','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceRecording/voiceRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x54db,0x193));var _0xb54d=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x54db[_0x43d11d];return _0x38cd08;};'use strict';var config=require(_0xb54d('0x0'));var Sequelize=require(_0xb54d('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0xb54d('0x2')]();config[_0xb54d('0x1')]=_[_0xb54d('0x3')](config[_0xb54d('0x1')],{'database':'motion2','username':_0xb54d('0x4'),'password':_0xb54d('0x5'),'options':{'host':_0xb54d('0x6'),'port':0xcea,'dialect':_0xb54d('0x7'),'dialectOptions':{'charset':_0xb54d('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xb54d('0x9'),'collate':_0xb54d('0xa')}}});config[_0xb54d('0xb')]=_[_0xb54d('0x3')](config[_0xb54d('0xb')],{'database':_0xb54d('0xc'),'username':_0xb54d('0x4'),'password':_0xb54d('0x5'),'options':{'host':_0xb54d('0x6'),'port':0xcea,'dialect':_0xb54d('0x7'),'dialectOptions':{'charset':_0xb54d('0x8')},'logging':![],'timezone':timezone[_0xb54d('0xd')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb54d('0x1')][_0xb54d('0xe')],config[_0xb54d('0x1')][_0xb54d('0xf')],config[_0xb54d('0x1')][_0xb54d('0x10')],config[_0xb54d('0x1')][_0xb54d('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb54d('0xb')][_0xb54d('0xe')],config[_0xb54d('0xb')][_0xb54d('0xf')],config[_0xb54d('0xb')][_0xb54d('0x10')],config[_0xb54d('0xb')][_0xb54d('0x11')])};db['User']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/user/user.model');db['VoiceChanSpy']=db[_0xb54d('0x1')]['import'](_0xb54d('0x13'));db[_0xb54d('0x14')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x15'));db[_0xb54d('0x16')]=db['sequelize'][_0xb54d('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0xb54d('0x17')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x18'));db['VoiceQueue']=db['sequelize'][_0xb54d('0x12')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0xb54d('0x1')]['import'](_0xb54d('0x19'));db['ScreenRecording']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/voiceMail/voiceMail.model');db[_0xb54d('0x1a')]=db['sequelize']['import'](_0xb54d('0x1b'));db[_0xb54d('0x1c')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x1d'));db[_0xb54d('0x1e')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x1f'));db['VoiceAgentReport']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x20'));db[_0xb54d('0x21')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xb54d('0x22')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x23'));db[_0xb54d('0x24')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/trunk/trunk.model');db[_0xb54d('0x25')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x26'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0xb54d('0x27'));db[_0xb54d('0x28')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x29'));db['UserChatQueue']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x2a'));db[_0xb54d('0x2b')]=db['sequelize'][_0xb54d('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0xb54d('0x2c')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x2d'));db[_0xb54d('0x2e')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x2f'));db[_0xb54d('0x30')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x31'));db['UserWhatsappQueue']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x32'));db[_0xb54d('0x33')]=db['sequelize'][_0xb54d('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0xb54d('0x34')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x35'));db[_0xb54d('0x36')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x37'));db[_0xb54d('0x38')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x39'));db[_0xb54d('0x3a')]=db['sequelize'][_0xb54d('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0xb54d('0x3b')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x3c'));db[_0xb54d('0x3d')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x3e'));db[_0xb54d('0x3f')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x40'));db[_0xb54d('0x41')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x42'));db[_0xb54d('0x43')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x44'));db[_0xb54d('0x45')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x46'));db[_0xb54d('0x47')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x48'));db['FaxMessage']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x49'));db['FaxQueue']=db[_0xb54d('0x1')]['import'](_0xb54d('0x4a'));db[_0xb54d('0x4b')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x4c'));db[_0xb54d('0x4d')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x4e'));db[_0xb54d('0x4f')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x50'));db[_0xb54d('0x51')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x52'));db[_0xb54d('0x53')]=db['sequelize'][_0xb54d('0x12')]('../api/smsMessage/smsMessage.model');db[_0xb54d('0x54')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x55'));db[_0xb54d('0x56')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x57'));db[_0xb54d('0x58')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x59'));db[_0xb54d('0x5a')]=db['sequelize']['import'](_0xb54d('0x5b'));db[_0xb54d('0x5c')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x5d'));db['OpenchannelQueue']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x5e'));db['ChatWebsite']=db['sequelize'][_0xb54d('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0xb54d('0x5f')]=db['sequelize']['import'](_0xb54d('0x60'));db['ChatApplication']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x61'));db['ChatInteraction']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0xb54d('0x62')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x63'));db[_0xb54d('0x64')]=db['sequelize']['import'](_0xb54d('0x65'));db['ChatQueue']=db['sequelize']['import'](_0xb54d('0x66'));db['ChatGroup']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x67'));db['ChatProactiveAction']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x68'));db[_0xb54d('0x69')]=db['sequelize']['import'](_0xb54d('0x6a'));db[_0xb54d('0x6b')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x6c'));db['CmHopper']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x6d'));db['CmHopperBlack']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x6e'));db[_0xb54d('0x6f')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x70'));db[_0xb54d('0x71')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x72'));db[_0xb54d('0x73')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x74'));db[_0xb54d('0x75')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x76'));db[_0xb54d('0x77')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x78'));db[_0xb54d('0x79')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x7a'));db[_0xb54d('0x7b')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x7c'));db['Disposition']=db[_0xb54d('0x1')]['import']('../api/disposition/disposition.model');db['Condition']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/condition/condition.model');db[_0xb54d('0x7d')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/interval/interval.model');db[_0xb54d('0x7e')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x7f'));db[_0xb54d('0x80')]=db['sequelize']['import'](_0xb54d('0x81'));db['VoiceQueuesLog']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x82'));db['Schedule']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/schedule/schedule.model');db[_0xb54d('0x83')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/sound/sound.model');db[_0xb54d('0x84')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x85'));db['ContactItemType']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x86'));db['CmContactHasItem']=db[_0xb54d('0x1')]['import'](_0xb54d('0x87'));db['CmHopperAdditionalPhone']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x88'));db[_0xb54d('0x89')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x8a'));db[_0xb54d('0x8b')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x8c'));db['Variable']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x8d'));db[_0xb54d('0x8e')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/integration/integration.model');db[_0xb54d('0x8f')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x90'));db[_0xb54d('0x91')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x92'));db[_0xb54d('0x93')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x94'));db[_0xb54d('0x95')]=db[_0xb54d('0x1')]['import'](_0xb54d('0x96'));db['AnalyticMetric']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x97'));db[_0xb54d('0x98')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xb54d('0x99')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xb54d('0x9a')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x9b'));db[_0xb54d('0x9c')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intSalesforceField/intSalesforceField.model');db['SugarcrmAccount']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x9d'));db[_0xb54d('0x9e')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x9f'));db[_0xb54d('0xa0')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xa1'));db[_0xb54d('0xa2')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xa3'));db[_0xb54d('0xa4')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xa5'));db['DeskField']=db[_0xb54d('0x1')]['import'](_0xb54d('0xa6'));db[_0xb54d('0xa7')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xa8'));db[_0xb54d('0xa9')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xaa'));db[_0xb54d('0xab')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xac'));db['ZendeskAccount']=db[_0xb54d('0x1')]['import'](_0xb54d('0xad'));db[_0xb54d('0xae')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xaf'));db['ZendeskField']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xb0'));db[_0xb54d('0xb1')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xb54d('0xb2')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xb54d('0xb3')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0xb54d('0xb4')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xb5'));db['VtigerConfiguration']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xb6'));db[_0xb54d('0xb7')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xb54d('0xb8')]=db['sequelize']['import'](_0xb54d('0xb9'));db[_0xb54d('0xba')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xbb'));db['Dynamics365Account']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xbc'));db['Dynamics365Configuration']=db[_0xb54d('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xbd'));db[_0xb54d('0xbe')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xbf'));db['FreshsalesConfiguration']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xc0'));db[_0xb54d('0xc1')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xc2'));db['Integration']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xc3'));db['Network']=db['sequelize']['import'](_0xb54d('0xc4'));db[_0xb54d('0xc5')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/chatQueueReport/chatQueueReport.model');db[_0xb54d('0xc6')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xc7'));db['JscriptyAnswerReport']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xc8'));db[_0xb54d('0xc9')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xca'));db[_0xb54d('0xcb')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xcc'));db[_0xb54d('0xcd')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xce'));db[_0xb54d('0xcf')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/squareReportDetail/squareReportDetail.model');db[_0xb54d('0xd0')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xd1'));db['Setting']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xd2'));db[_0xb54d('0xd3')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xd4'));db['SquareProject']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xd5'));db[_0xb54d('0xd6')]=db['sequelize'][_0xb54d('0x12')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xd7'));db[_0xb54d('0xd8')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xd9'));db['License']=db['sequelize']['import'](_0xb54d('0xda'));db[_0xb54d('0xdb')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xdc'));db[_0xb54d('0xdd')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xde'));db[_0xb54d('0xdf')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/attachment/attachment.model');db[_0xb54d('0xe0')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xe1'));db['MailTransferReport']=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xe2'));db[_0xb54d('0xe3')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xe4'));db[_0xb54d('0xe5')]=db['sequelize']['import'](_0xb54d('0xe6'));db['SmsTransferReport']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xe7'));db[_0xb54d('0xe8')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xe9'));db['VoicePrefix']=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xea'));db[_0xb54d('0xeb')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xec'));db[_0xb54d('0xed')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xee'));db[_0xb54d('0xef')]=db[_0xb54d('0x1')][_0xb54d('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xb54d('0xf0')]=db['sequelize']['import'](_0xb54d('0xf1'));db[_0xb54d('0xf2')]=db['sequelize'][_0xb54d('0x12')]('../api/whatsappAccount/whatsappAccount.model');db[_0xb54d('0xf3')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0xf4'));db[_0xb54d('0xf5')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xf6'));db[_0xb54d('0xf7')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xf8'));db[_0xb54d('0xf9')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xfa'));db[_0xb54d('0xfb')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0xfc'));db[_0xb54d('0xfd')]=db[_0xb54d('0x1')]['import'](_0xb54d('0xfe'));db[_0xb54d('0xff')]=db[_0xb54d('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0xb54d('0x100')]=db['sequelize']['import']('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xb54d('0x101')]=db['sequelize'][_0xb54d('0x12')](_0xb54d('0x102'));db[_0xb54d('0x103')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x104'));db[_0xb54d('0x105')]=db[_0xb54d('0x1')][_0xb54d('0x12')](_0xb54d('0x106'));db[_0xb54d('0x107')]['hasOne'](db[_0xb54d('0x108')],{'as':_0xb54d('0x108'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x10a')});db['User'][_0xb54d('0x10b')](db[_0xb54d('0x105')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x10d')],{'as':_0xb54d('0x10e'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x10f')],{'as':_0xb54d('0x110'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')]['hasMany'](db[_0xb54d('0x16')],{'as':_0xb54d('0x111'),'onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x6f')],{'as':_0xb54d('0x112'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x71')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x73')],{'as':_0xb54d('0x73'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x5a')],{'as':_0xb54d('0x113'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db['ChatInteraction'],{'as':_0xb54d('0x114'),'foreignKey':'UserId'});db[_0xb54d('0x107')][_0xb54d('0x10c')](db['SmsInteraction'],{'as':_0xb54d('0x115'),'foreignKey':'UserId'});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x47')],{'as':_0xb54d('0x116'),'foreignKey':'UserId'});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0x3a')],{'as':_0xb54d('0x117'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x107')][_0xb54d('0x10c')](db[_0xb54d('0xf0')],{'as':_0xb54d('0x118'),'foreignKey':_0xb54d('0x119')});db[_0xb54d('0x107')][_0xb54d('0x11a')](db[_0xb54d('0xeb')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x11c')],{'as':_0xb54d('0x11d'),'through':_0xb54d('0x11e')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x11f'),'through':'cm_user_has_contacts'});db['User'][_0xb54d('0x11b')](db['CmList'],{'as':_0xb54d('0x120'),'through':_0xb54d('0x121')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db['Team'],{'through':'user_has_teams'});db['User'][_0xb54d('0x11b')](db['MailInteraction'],{'as':_0xb54d('0x117'),'through':_0xb54d('0x122')});db['User'][_0xb54d('0x11b')](db['ChatInteraction'],{'as':_0xb54d('0x114'),'through':_0xb54d('0x123')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x47')],{'as':_0xb54d('0x116'),'through':'user_has_fax_interactions'});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x51')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0xb54d('0x107')]['belongsToMany'](db[_0xb54d('0x5a')],{'as':_0xb54d('0x113'),'through':_0xb54d('0x124')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0xf5')],{'as':_0xb54d('0x125'),'through':'user_has_whatsapp_interactions'});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x126')],{'as':_0xb54d('0x127'),'through':_0xb54d('0x28'),'required':![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x128')],{'as':_0xb54d('0x129'),'through':_0xb54d('0x103'),'required':![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x12a')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x12b')],{'as':_0xb54d('0x12c'),'through':_0xb54d('0x12d'),'required':![],'hooks':!![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x12e')],{'as':_0xb54d('0x12f'),'through':'UserFaxQueue','required':![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db['SmsQueue'],{'as':'SmsQueues','through':_0xb54d('0x2e'),'required':![]});db['User']['belongsToMany'](db[_0xb54d('0x130')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0xb54d('0x11b')](db[_0xb54d('0xfd')],{'as':'WhatsappQueues','through':_0xb54d('0x131'),'required':![]});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0xe8')],{'through':'cm_user_has_lists'});db['User'][_0xb54d('0x11b')](db[_0xb54d('0x132')],{'as':_0xb54d('0x133'),'through':'user_has_chat_websites'});db[_0xb54d('0x107')][_0xb54d('0x11b')](db['FaxAccount'],{'as':_0xb54d('0x134'),'through':_0xb54d('0x135')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x36')],{'as':_0xb54d('0x136'),'through':_0xb54d('0x137')});db['User'][_0xb54d('0x11b')](db[_0xb54d('0x56')],{'as':_0xb54d('0x138'),'through':_0xb54d('0x139')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db[_0xb54d('0x4d')],{'as':_0xb54d('0x13a'),'through':_0xb54d('0x13b')});db[_0xb54d('0x107')][_0xb54d('0x11b')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xb54d('0x13c')});db[_0xb54d('0x107')]['belongsToMany'](db[_0xb54d('0x13d')],{'as':_0xb54d('0x13e'),'through':_0xb54d('0x13f')});db[_0xb54d('0x140')][_0xb54d('0x10c')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xb54d('0x141')});db[_0xb54d('0x14')][_0xb54d('0x10c')](db[_0xb54d('0x16')],{'onDelete':_0xb54d('0x109')});db[_0xb54d('0x16')]['hasMany'](db[_0xb54d('0x16')],{'as':_0xb54d('0x142'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x17')][_0xb54d('0x11b')](db['Sound'],{'as':_0xb54d('0x143'),'through':'moh_has_sounds'});db[_0xb54d('0x126')][_0xb54d('0x10c')](db[_0xb54d('0x10f')],{'as':_0xb54d('0x144'),'foreignKey':'VoiceQueueId'});db[_0xb54d('0x126')][_0xb54d('0x10c')](db['CmHopper'],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db[_0xb54d('0x126')][_0xb54d('0x10c')](db[_0xb54d('0x6f')],{'as':_0xb54d('0x112'),'foreignKey':'VoiceQueueId'});db[_0xb54d('0x126')][_0xb54d('0x10c')](db[_0xb54d('0x71')],{'as':_0xb54d('0x145'),'foreignKey':_0xb54d('0x146')});db[_0xb54d('0x126')][_0xb54d('0x10c')](db[_0xb54d('0x73')],{'as':_0xb54d('0x73'),'foreignKey':'VoiceQueueId'});db[_0xb54d('0x126')]['hasMany'](db[_0xb54d('0x147')],{'as':'HopperBlacks','foreignKey':_0xb54d('0x146')});db['VoiceQueue'][_0xb54d('0x10c')](db[_0xb54d('0xcb')],{'as':_0xb54d('0x148'),'foreignKey':_0xb54d('0x146')});db['VoiceQueue'][_0xb54d('0x11a')](db[_0xb54d('0x24')],{'as':_0xb54d('0x24'),'foreignKey':_0xb54d('0x149')});db[_0xb54d('0x126')][_0xb54d('0x11a')](db[_0xb54d('0x24')],{'as':_0xb54d('0x14a'),'foreignKey':'TrunkBackupId'});db[_0xb54d('0x126')][_0xb54d('0x11a')](db[_0xb54d('0x7d')],{'as':_0xb54d('0x7d'),'foreignKey':_0xb54d('0x14b')});db['VoiceQueue']['belongsTo'](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xb54d('0x11b')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x120'),'through':_0xb54d('0x14d')});db[_0xb54d('0x126')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x28')});db[_0xb54d('0x126')][_0xb54d('0x11b')](db[_0xb54d('0xd8')],{'as':_0xb54d('0x14f'),'through':_0xb54d('0x100')});db[_0xb54d('0x126')][_0xb54d('0x11b')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x150'),'through':_0xb54d('0x151')});db[_0xb54d('0x10d')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':'User','foreignKey':'UserId'});db[_0xb54d('0x152')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x107'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x108')]['hasMany'](db[_0xb54d('0x1a')],{'as':_0xb54d('0x153'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x154'),'sourceKey':_0xb54d('0x155')});db['VoiceMailMessage'][_0xb54d('0x11a')](db[_0xb54d('0x108')],{'foreignKey':_0xb54d('0x154'),'targetKey':_0xb54d('0x155')});db['VoiceCallReport']['hasMany'](db[_0xb54d('0x21')],{'as':'QueueCalls','foreignKey':_0xb54d('0x156'),'constraints':![]});db[_0xb54d('0x1c')][_0xb54d('0x10c')](db[_0xb54d('0x157')],{'as':_0xb54d('0x158'),'foreignKey':_0xb54d('0x156'),'constraints':![]});db[_0xb54d('0x1c')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x107'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x1c')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x33')][_0xb54d('0x11a')](db[_0xb54d('0x36')],{'as':'MailAccount','foreignKey':_0xb54d('0x15b')});db[_0xb54d('0x33')][_0xb54d('0x11a')](db[_0xb54d('0xff')],{'as':_0xb54d('0xff'),'foreignKey':_0xb54d('0x15c'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x34')][_0xb54d('0x11a')](db[_0xb54d('0x36')],{'as':_0xb54d('0x36'),'foreignKey':'MailAccountId'});db[_0xb54d('0x34')][_0xb54d('0x11a')](db[_0xb54d('0xff')],{'as':_0xb54d('0xff'),'foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xb54d('0x36')][_0xb54d('0x10b')](db[_0xb54d('0x33')],{'as':'Imap','onDelete':_0xb54d('0x109')});db[_0xb54d('0x36')][_0xb54d('0x10b')](db['MailServerOut'],{'as':_0xb54d('0x15e'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x36')][_0xb54d('0x10c')](db[_0xb54d('0x15f')],{'as':'Dispositions','foreignKey':_0xb54d('0x15b'),'onDelete':_0xb54d('0x109')});db['MailAccount'][_0xb54d('0x10c')](db[_0xb54d('0x7b')],{'as':_0xb54d('0x160'),'foreignKey':_0xb54d('0x15b')});db[_0xb54d('0x36')]['hasMany'](db[_0xb54d('0x3b')],{'as':_0xb54d('0x153'),'foreignKey':_0xb54d('0x15b')});db[_0xb54d('0x36')][_0xb54d('0x10c')](db[_0xb54d('0x3a')],{'as':_0xb54d('0x161')});db[_0xb54d('0x36')][_0xb54d('0x10c')](db[_0xb54d('0x162')],{'as':'Applications'});db[_0xb54d('0x36')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':'ListId'});db['MailAccount'][_0xb54d('0x11a')](db[_0xb54d('0x89')],{'as':_0xb54d('0x89'),'foreignKey':_0xb54d('0x164')});db[_0xb54d('0x36')]['belongsTo'](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':_0xb54d('0x165')});db[_0xb54d('0x36')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x137')});db[_0xb54d('0x12a')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x2b')});db[_0xb54d('0x12a')][_0xb54d('0x11b')](db[_0xb54d('0xd8')],{'through':_0xb54d('0x166'),'as':_0xb54d('0x14f')});db['MailInteraction']['hasMany'](db[_0xb54d('0x3b')],{'as':'Messages','onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x167')});db[_0xb54d('0x3a')][_0xb54d('0x11a')](db[_0xb54d('0x36')],{'as':'Account','foreignKey':_0xb54d('0x15b')});db['MailInteraction'][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0xb54d('0x107')],{'as':_0xb54d('0x168'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x3a')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':'mail_interaction_has_tags','as':_0xb54d('0x169')});db[_0xb54d('0x3a')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x16a'),'as':_0xb54d('0x16b')});db['MailInteraction'][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x16c'),'through':'user_has_mail_interactions','foreignKey':_0xb54d('0x167')});db['MailMessage'][_0xb54d('0x10c')](db[_0xb54d('0xdf')],{'as':_0xb54d('0x16d'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x3b')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x107')});db[_0xb54d('0x3b')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'onDelete':'cascade','as':_0xb54d('0x159')});db[_0xb54d('0x3b')][_0xb54d('0x11a')](db[_0xb54d('0x3a')],{'as':'Interaction','foreignKey':_0xb54d('0x167')});db[_0xb54d('0x3b')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':_0xb54d('0x15b')});db[_0xb54d('0x3b')]['belongsTo'](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xb54d('0x16e')});db[_0xb54d('0x3b')][_0xb54d('0x11a')](db[_0xb54d('0x64')],{'as':'ChatOfflineMessage','foreignKey':_0xb54d('0x16f')});db['MailApplication'][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x162')][_0xb54d('0x11a')](db[_0xb54d('0x12a')],{'onDelete':'restrict'});db[_0xb54d('0x162')][_0xb54d('0x11a')](db[_0xb54d('0x36')],{'onDelete':'restrict'});db[_0xb54d('0x162')][_0xb54d('0x11a')](db[_0xb54d('0x7d')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x162')][_0xb54d('0x11a')](db['Tag'],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db[_0xb54d('0x3d')][_0xb54d('0x11a')](db['MailAccount'],{});db['MailQueueReport'][_0xb54d('0x11a')](db['CmList'],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0x3d')]['belongsTo'](db['CmContact'],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x3d')]['belongsTo'](db['MailInteraction'],{});db[_0xb54d('0x3d')][_0xb54d('0x11a')](db['MailMessage'],{});db[_0xb54d('0x3d')]['belongsTo'](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0xb54d('0x12a')],{});db['Dashboard'][_0xb54d('0x10c')](db[_0xb54d('0x41')],{'as':_0xb54d('0x172'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x43')][_0xb54d('0x10c')](db['Disposition'],{'as':_0xb54d('0x173'),'foreignKey':_0xb54d('0x174'),'onDelete':'cascade'});db[_0xb54d('0x43')][_0xb54d('0x10c')](db[_0xb54d('0x7b')],{'as':_0xb54d('0x160'),'foreignKey':_0xb54d('0x174')});db[_0xb54d('0x43')][_0xb54d('0x10c')](db[_0xb54d('0x47')],{'as':_0xb54d('0x161')});db[_0xb54d('0x43')][_0xb54d('0x10c')](db['FaxApplication'],{'as':_0xb54d('0x142')});db[_0xb54d('0x43')]['hasMany'](db['VoiceExtension'],{'as':_0xb54d('0x175'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x43')][_0xb54d('0x10c')](db[_0xb54d('0x176')],{'as':_0xb54d('0x153')});db['FaxAccount'][_0xb54d('0x11a')](db['Trunk'],{'as':_0xb54d('0x24')});db[_0xb54d('0x43')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':'List','foreignKey':_0xb54d('0x171')});db[_0xb54d('0x43')]['belongsTo'](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xb54d('0x11b')](db['User'],{'as':'Agents','through':_0xb54d('0x135')});db[_0xb54d('0x45')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x45')]['belongsTo'](db['FaxQueue'],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x45')][_0xb54d('0x11a')](db[_0xb54d('0x43')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x45')][_0xb54d('0x11a')](db[_0xb54d('0x84')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db['FaxInteraction'][_0xb54d('0x10c')](db[_0xb54d('0x176')],{'as':_0xb54d('0x153'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x177')});db[_0xb54d('0x47')][_0xb54d('0x11a')](db[_0xb54d('0x43')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x174')});db[_0xb54d('0x47')]['belongsTo'](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x47')]['belongsTo'](db[_0xb54d('0x107')],{'as':_0xb54d('0x168'),'foreignKey':'UserId'});db[_0xb54d('0x47')][_0xb54d('0x11b')](db['Tag'],{'through':_0xb54d('0x179'),'as':_0xb54d('0x169')});db[_0xb54d('0x47')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x179'),'as':_0xb54d('0x16b')});db[_0xb54d('0x47')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':'Users','through':_0xb54d('0x17a'),'foreignKey':_0xb54d('0x177')});db[_0xb54d('0x176')][_0xb54d('0x11a')](db['User'],{'onDelete':'cascade','as':_0xb54d('0x107')});db[_0xb54d('0x176')][_0xb54d('0x11a')](db['FaxInteraction'],{'as':_0xb54d('0x17b'),'foreignKey':_0xb54d('0x177')});db[_0xb54d('0x176')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x159')});db[_0xb54d('0x176')][_0xb54d('0x11a')](db[_0xb54d('0xdf')],{'as':'Attachment','foreignKey':_0xb54d('0x17c')});db[_0xb54d('0x176')][_0xb54d('0x11a')](db[_0xb54d('0x43')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x174')});db[_0xb54d('0x12e')]['belongsToMany'](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x2c')});db['FaxQueue']['belongsToMany'](db[_0xb54d('0xd8')],{'through':_0xb54d('0x17d'),'as':'Teams'});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db[_0xb54d('0x43')],{});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0x4b')]['belongsTo'](db[_0xb54d('0x6b')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db[_0xb54d('0x47')],{});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db[_0xb54d('0x176')],{});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db['User'],{});db[_0xb54d('0x4b')][_0xb54d('0x11a')](db[_0xb54d('0x12e')],{});db[_0xb54d('0x4d')][_0xb54d('0x10c')](db[_0xb54d('0x15f')],{'as':_0xb54d('0x173'),'foreignKey':_0xb54d('0x17e'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x4d')][_0xb54d('0x10c')](db[_0xb54d('0x7b')],{'as':_0xb54d('0x160'),'foreignKey':_0xb54d('0x17e')});db[_0xb54d('0x4d')][_0xb54d('0x10c')](db[_0xb54d('0x53')],{'as':_0xb54d('0x153'),'foreignKey':'SmsAccountId'});db[_0xb54d('0x4d')][_0xb54d('0x10c')](db['SmsInteraction'],{'as':_0xb54d('0x161')});db[_0xb54d('0x4d')][_0xb54d('0x10c')](db[_0xb54d('0x4f')],{'as':_0xb54d('0x142')});db[_0xb54d('0x4d')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':'ListId'});db[_0xb54d('0x4d')][_0xb54d('0x11a')](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb54d('0x4d')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x13b')});db[_0xb54d('0x4f')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':'restrict'});db[_0xb54d('0x4f')]['belongsTo'](db[_0xb54d('0x54')],{'onDelete':'restrict'});db['SmsApplication'][_0xb54d('0x11a')](db[_0xb54d('0x4d')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x4f')][_0xb54d('0x11a')](db[_0xb54d('0x7d')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x4f')][_0xb54d('0x11a')](db[_0xb54d('0x84')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db[_0xb54d('0x51')]['hasMany'](db['SmsMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xb54d('0x17f')});db[_0xb54d('0x51')][_0xb54d('0x11a')](db[_0xb54d('0x4d')],{'as':_0xb54d('0x178'),'foreignKey':'SmsAccountId'});db[_0xb54d('0x51')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x51')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x168'),'foreignKey':'UserId'});db[_0xb54d('0x51')]['belongsToMany'](db[_0xb54d('0x84')],{'through':_0xb54d('0x180'),'as':_0xb54d('0x169')});db[_0xb54d('0x51')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x180'),'as':_0xb54d('0x16b')});db[_0xb54d('0x51')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x16c'),'through':'user_has_sms_interactions','foreignKey':_0xb54d('0x17f')});db[_0xb54d('0x53')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x107')});db['SmsMessage'][_0xb54d('0x11a')](db['CmContact'],{'onDelete':'cascade','as':_0xb54d('0x159')});db[_0xb54d('0x53')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xb54d('0x109'),'as':'Interaction','foreignKey':_0xb54d('0x17f')});db[_0xb54d('0x53')][_0xb54d('0x11a')](db[_0xb54d('0x4d')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x17e')});db[_0xb54d('0x54')]['belongsToMany'](db['User'],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x2e'),'foreignKey':'SmsQueueId'});db[_0xb54d('0x54')]['belongsToMany'](db[_0xb54d('0xd8')],{'through':_0xb54d('0x181'),'as':_0xb54d('0x14f')});db[_0xb54d('0x56')]['hasMany'](db[_0xb54d('0x15f')],{'as':_0xb54d('0x173'),'foreignKey':_0xb54d('0x182'),'onDelete':_0xb54d('0x109')});db['OpenchannelAccount']['hasMany'](db[_0xb54d('0x7b')],{'as':_0xb54d('0x160'),'foreignKey':_0xb54d('0x182')});db[_0xb54d('0x56')][_0xb54d('0x10c')](db['OpenchannelInteraction'],{'as':_0xb54d('0x161'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xb54d('0x10c')](db['OpenchannelMessage'],{'as':_0xb54d('0x153'),'foreignKey':_0xb54d('0x182')});db[_0xb54d('0x56')]['hasMany'](db[_0xb54d('0x58')],{'as':_0xb54d('0x142'),'foreignKey':'OpenchannelAccountId'});db[_0xb54d('0x56')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':'ListId'});db[_0xb54d('0x56')][_0xb54d('0x11a')](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':_0xb54d('0x165')});db[_0xb54d('0x56')][_0xb54d('0x11b')](db['User'],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x139')});db[_0xb54d('0x58')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x58')][_0xb54d('0x11a')](db['OpenchannelQueue'],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x183')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0xb54d('0x182')});db[_0xb54d('0x58')][_0xb54d('0x11a')](db[_0xb54d('0x7d')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x58')][_0xb54d('0x11a')](db[_0xb54d('0x84')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db[_0xb54d('0x5a')][_0xb54d('0x10c')](db[_0xb54d('0x5c')],{'as':'Messages','onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x184')});db[_0xb54d('0x5a')][_0xb54d('0x11a')](db[_0xb54d('0x56')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x182')});db['OpenchannelInteraction'][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x5a')]['belongsTo'](db['User'],{'as':_0xb54d('0x168'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x5a')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':'openchannel_interaction_has_tags','as':_0xb54d('0x169')});db[_0xb54d('0x5a')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0xb54d('0x5a')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x16c'),'through':_0xb54d('0x124'),'foreignKey':_0xb54d('0x184')});db['OpenchannelMessage'][_0xb54d('0x11a')](db['User'],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x107')});db[_0xb54d('0x5c')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x159')});db[_0xb54d('0x5c')][_0xb54d('0x11a')](db[_0xb54d('0x5a')],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x17b'),'foreignKey':'OpenchannelInteractionId'});db[_0xb54d('0x5c')][_0xb54d('0x11a')](db[_0xb54d('0xdf')],{'as':_0xb54d('0xdf'),'foreignKey':_0xb54d('0x17c')});db[_0xb54d('0x5c')][_0xb54d('0x11a')](db[_0xb54d('0x56')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x182')});db['OpenchannelQueue']['belongsToMany'](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x30'),'foreignKey':_0xb54d('0x183')});db['OpenchannelQueue'][_0xb54d('0x11b')](db[_0xb54d('0xd8')],{'through':_0xb54d('0x185'),'as':_0xb54d('0x14f')});db[_0xb54d('0x132')][_0xb54d('0x10c')](db[_0xb54d('0x15f')],{'as':_0xb54d('0x173'),'foreignKey':'ChatWebsiteId','onDelete':_0xb54d('0x109')});db[_0xb54d('0x132')][_0xb54d('0x10c')](db[_0xb54d('0x7b')],{'as':_0xb54d('0x160'),'foreignKey':_0xb54d('0x16e')});db[_0xb54d('0x132')]['hasMany'](db[_0xb54d('0x186')],{'as':'ProactiveActions'});db['ChatWebsite'][_0xb54d('0x10c')](db[_0xb54d('0x187')],{'as':_0xb54d('0x161')});db[_0xb54d('0x132')][_0xb54d('0x10c')](db[_0xb54d('0x188')],{'as':_0xb54d('0x142')});db[_0xb54d('0x132')][_0xb54d('0x10c')](db[_0xb54d('0x62')],{'as':_0xb54d('0x153')});db[_0xb54d('0x132')]['belongsTo'](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0x132')]['belongsTo'](db[_0xb54d('0x7d')],{'as':_0xb54d('0x7d'),'foreignKey':_0xb54d('0x14b')});db['ChatWebsite'][_0xb54d('0x11a')](db['MailAccount'],{'as':_0xb54d('0x36'),'foreignKey':_0xb54d('0x15b')});db['ChatWebsite']['belongsTo'](db[_0xb54d('0x7e')],{'as':_0xb54d('0x14c'),'foreignKey':_0xb54d('0x165')});db[_0xb54d('0x132')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x189')});db['OpenchannelQueueReport'][_0xb54d('0x11a')](db[_0xb54d('0x56')],{});db[_0xb54d('0x5f')][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0x5f')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':'Contact','foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x5f')]['belongsTo'](db[_0xb54d('0x5a')],{});db[_0xb54d('0x5f')]['belongsTo'](db[_0xb54d('0x5c')],{});db[_0xb54d('0x5f')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{});db[_0xb54d('0x5f')][_0xb54d('0x11a')](db['OpenchannelQueue'],{});db['ChatApplication'][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x18a'),'foreignKey':_0xb54d('0x10a'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x188')][_0xb54d('0x11a')](db[_0xb54d('0x12b')],{'as':_0xb54d('0x18b'),'foreignKey':_0xb54d('0x18c'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x188')][_0xb54d('0x11a')](db[_0xb54d('0x132')],{'as':_0xb54d('0x18d'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0xb54d('0x188')]['belongsTo'](db[_0xb54d('0x84')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db['ChatInteraction'][_0xb54d('0x10c')](db[_0xb54d('0x62')],{'as':'Messages','onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x18e')});db[_0xb54d('0x187')][_0xb54d('0x11a')](db[_0xb54d('0x132')],{'as':_0xb54d('0x178'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x187')]['belongsTo'](db[_0xb54d('0x107')],{'as':'Owner','foreignKey':_0xb54d('0x10a')});db['ChatInteraction'][_0xb54d('0x11b')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xb54d('0x169')});db[_0xb54d('0x187')]['belongsToMany'](db[_0xb54d('0x84')],{'through':_0xb54d('0x18f'),'as':_0xb54d('0x16b')});db[_0xb54d('0x187')][_0xb54d('0x11b')](db['User'],{'as':_0xb54d('0x16c'),'through':_0xb54d('0x123'),'foreignKey':_0xb54d('0x18e')});db[_0xb54d('0x62')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x107')});db[_0xb54d('0x62')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'onDelete':'cascade','as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x62')][_0xb54d('0x11a')](db[_0xb54d('0x187')],{'onDelete':_0xb54d('0x109'),'as':'Interaction','foreignKey':_0xb54d('0x18e')});db[_0xb54d('0x62')][_0xb54d('0x11a')](db[_0xb54d('0xdf')],{'as':_0xb54d('0xdf'),'foreignKey':_0xb54d('0x17c')});db['ChatMessage'][_0xb54d('0x11a')](db['ChatWebsite'],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x16e')});db[_0xb54d('0x64')][_0xb54d('0x10c')](db[_0xb54d('0xdf')],{'as':_0xb54d('0x16d'),'foreignKey':_0xb54d('0x16f'),'onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x64')][_0xb54d('0x11a')](db['CmContact'],{'onDelete':_0xb54d('0x109'),'as':'Contact','foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x64')][_0xb54d('0x11a')](db[_0xb54d('0x132')],{'as':_0xb54d('0x178'),'foreignKey':'ChatWebsiteId'});db[_0xb54d('0x12b')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x12d'),'hooks':!![]});db[_0xb54d('0x12b')][_0xb54d('0x11b')](db[_0xb54d('0xd8')],{'through':'team_has_chat_queues','as':_0xb54d('0x14f')});db[_0xb54d('0x11c')][_0xb54d('0x10c')](db[_0xb54d('0xc6')],{'as':_0xb54d('0x153'),'foreignKey':'ChatGroupId','onDelete':_0xb54d('0x109')});db['ChatGroup']['belongsToMany'](db['User'],{'as':'Members','through':_0xb54d('0x11e')});db[_0xb54d('0x186')][_0xb54d('0x11a')](db['ChatWebsite'],{'as':_0xb54d('0x18d'),'foreignKey':'ChatWebsiteId'});db[_0xb54d('0x69')][_0xb54d('0x10c')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x11f'),'foreignKey':_0xb54d('0x190')});db[_0xb54d('0x6b')]['hasMany'](db[_0xb54d('0x191')],{'as':_0xb54d('0x192'),'foreignKey':_0xb54d('0x193')});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0xb54d('0x194'),'foreignKey':'ContactId'});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db[_0xb54d('0x6f')],{'as':_0xb54d('0x112'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x6b')]['hasMany'](db[_0xb54d('0x71')],{'as':'HopperHistories','foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db['ReportAgentPreview'],{'as':_0xb54d('0x73'),'foreignKey':'ContactId'});db['CmContact'][_0xb54d('0x10c')](db[_0xb54d('0xcb')],{'as':_0xb54d('0x148'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x6b')]['hasMany'](db[_0xb54d('0x5a')],{'as':'OpenchannelInteractions','foreignKey':_0xb54d('0x15a'),'onDelete':'restrict'});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db[_0xb54d('0x187')],{'as':'ChatInteractions','foreignKey':_0xb54d('0x15a'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db['SmsInteraction'],{'as':_0xb54d('0x115'),'foreignKey':'ContactId','onDelete':_0xb54d('0x15d')});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db[_0xb54d('0x47')],{'as':_0xb54d('0x116'),'foreignKey':_0xb54d('0x15a'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x6b')][_0xb54d('0x10c')](db[_0xb54d('0x3a')],{'as':_0xb54d('0x117'),'foreignKey':_0xb54d('0x15a'),'onDelete':'restrict'});db[_0xb54d('0x6b')][_0xb54d('0x11a')](db[_0xb54d('0x69')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xb54d('0x11a')](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':'ListId','onDelete':_0xb54d('0x109')});db[_0xb54d('0x6b')][_0xb54d('0x11b')](db['User'],{'as':_0xb54d('0x16c'),'through':_0xb54d('0x195')});db['CmContact'][_0xb54d('0x11b')](db['Tag'],{'as':_0xb54d('0x169'),'through':'cm_contact_has_tags'});db[_0xb54d('0x6b')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x196'),'as':'ThroughTags'});db['CmHopper'][_0xb54d('0x10c')](db[_0xb54d('0x197')],{'as':_0xb54d('0x198'),'foreignKey':_0xb54d('0x199')});db['CmHopper']['belongsTo'](db['CmContact'],{'as':_0xb54d('0x159'),'foreignKey':'ContactId','onDelete':_0xb54d('0x109')});db['CmHopper'][_0xb54d('0x11a')](db['CmList'],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x19a')][_0xb54d('0x11a')](db['User'],{'as':_0xb54d('0x18a'),'foreignKey':_0xb54d('0x10a')});db[_0xb54d('0x19a')][_0xb54d('0x11a')](db[_0xb54d('0x126')],{'as':_0xb54d('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0xb54d('0x109')});db[_0xb54d('0x19a')][_0xb54d('0x11a')](db[_0xb54d('0xdb')],{'as':'Campaign','foreignKey':_0xb54d('0x19b'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x19a')][_0xb54d('0x11a')](db['User'],{'as':'Owner','foreignKey':_0xb54d('0x19c')});db['CmHopperBlack'][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x147')]['belongsTo'](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0x147')][_0xb54d('0x11a')](db[_0xb54d('0x126')],{'as':_0xb54d('0x18b'),'foreignKey':'VoiceQueueId','onDelete':_0xb54d('0x109')});db['CmHopperBlack']['belongsTo'](db[_0xb54d('0xdb')],{'as':_0xb54d('0xdb'),'foreignKey':_0xb54d('0x19b'),'onDelete':_0xb54d('0x109')});db['Automation']['hasMany'](db['Condition'],{'as':{'plural':'All','singular':_0xb54d('0x19d')},'foreignKey':_0xb54d('0x19e'),'onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x79')][_0xb54d('0x10c')](db[_0xb54d('0x19f')],{'as':{'plural':_0xb54d('0x1a0'),'singular':_0xb54d('0x1a1')},'foreignKey':'AutomationAnyId','onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x79')][_0xb54d('0x10c')](db[_0xb54d('0x77')],{'as':_0xb54d('0x1a2'),'foreignKey':'AutomationId','onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x15f')][_0xb54d('0x10c')](db['Disposition'],{'as':_0xb54d('0x173'),'foreignKey':'ParentId','onDelete':'cascade'});db[_0xb54d('0x7d')]['hasMany'](db[_0xb54d('0x7d')],{'as':'Intervals','foreignKey':_0xb54d('0x14b'),'onDelete':_0xb54d('0x109'),'hooks':!![],'required':![]});db[_0xb54d('0x7d')][_0xb54d('0x10c')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xb54d('0x14b'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0x7d')][_0xb54d('0x10c')](db[_0xb54d('0x162')],{'as':_0xb54d('0x1a3'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x7d')]['hasMany'](db[_0xb54d('0x188')],{'as':_0xb54d('0x1a4'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x7d')]['hasMany'](db[_0xb54d('0x45')],{'as':_0xb54d('0x1a5'),'foreignKey':'IntervalId'});db[_0xb54d('0x7d')][_0xb54d('0x10c')](db[_0xb54d('0x4f')],{'as':_0xb54d('0x1a6'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0x1a7')][_0xb54d('0x11a')](db[_0xb54d('0x36')],{});db[_0xb54d('0x1a7')][_0xb54d('0x11a')](db[_0xb54d('0x93')],{'foreignKey':'DefaultReportId'});db[_0xb54d('0x1a7')]['belongsTo'](db[_0xb54d('0x91')],{'foreignKey':_0xb54d('0x1a8')});db[_0xb54d('0x83')]['belongsToMany'](db[_0xb54d('0x17')],{'as':_0xb54d('0x1a9'),'through':_0xb54d('0x1aa'),'onDelete':'restrict'});db['Tag'][_0xb54d('0x11b')](db[_0xb54d('0x6b')],{'through':'cm_contact_has_tags'});db[_0xb54d('0x84')][_0xb54d('0x11b')](db[_0xb54d('0x187')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xb54d('0x11b')](db[_0xb54d('0x3a')],{'through':_0xb54d('0x16a')});db['Tag'][_0xb54d('0x11b')](db[_0xb54d('0x51')],{'through':_0xb54d('0x180')});db['Tag'][_0xb54d('0x11b')](db[_0xb54d('0x47')],{'through':'fax_interaction_has_tags'});db[_0xb54d('0x84')][_0xb54d('0x11b')](db[_0xb54d('0x5a')],{'through':_0xb54d('0x1ab')});db[_0xb54d('0x84')][_0xb54d('0x11b')](db[_0xb54d('0xf5')],{'through':_0xb54d('0x1ac')});db['CmContactHasItem']['belongsTo'](db['ContactItemType'],{'as':'ItemType','foreignKey':_0xb54d('0x1ad')});db[_0xb54d('0x197')][_0xb54d('0x11a')](db[_0xb54d('0x19a')],{'as':_0xb54d('0x1ae'),'foreignKey':_0xb54d('0x199')});db[_0xb54d('0x191')][_0xb54d('0x11a')](db['CmContact'],{'as':'Contact','foreignKey':_0xb54d('0x193')});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0xb54d('0x1af'),'singular':'AllCondition'},'foreignKey':_0xb54d('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0xb54d('0x8b')][_0xb54d('0x10c')](db[_0xb54d('0x19f')],{'as':{'plural':'AnyConditions','singular':_0xb54d('0x1b1')},'foreignKey':_0xb54d('0x1b2'),'onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x8b')][_0xb54d('0x10c')](db[_0xb54d('0x77')],{'as':_0xb54d('0x1a2'),'foreignKey':'TriggerId','onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0x91')][_0xb54d('0x10c')](db[_0xb54d('0x98')],{'as':_0xb54d('0x1b3'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1a8'),'hooks':!![]});db[_0xb54d('0x93')][_0xb54d('0x10c')](db[_0xb54d('0x98')],{'as':_0xb54d('0x1b3'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1b4')});db[_0xb54d('0x1b5')]['hasMany'](db[_0xb54d('0x98')],{'as':_0xb54d('0x1b3'),'onDelete':'cascade','foreignKey':_0xb54d('0x1b6')});db[_0xb54d('0x98')][_0xb54d('0x11a')](db[_0xb54d('0x1b5')],{'foreignKey':'MetricId'});db[_0xb54d('0x1b7')][_0xb54d('0x10c')](db[_0xb54d('0x9a')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':'AccountId'});db[_0xb54d('0x9a')][_0xb54d('0x10c')](db[_0xb54d('0x9c')],{'as':_0xb54d('0x1b9'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0x9a')][_0xb54d('0x10c')](db[_0xb54d('0x9c')],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x9a')][_0xb54d('0x10c')](db[_0xb54d('0x9c')],{'as':_0xb54d('0x1b3'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0x9a')][_0xb54d('0x11a')](db[_0xb54d('0x1b7')],{'as':'Account','foreignKey':_0xb54d('0x1be')});db[_0xb54d('0x9c')][_0xb54d('0x10c')](db[_0xb54d('0x9c')],{'as':_0xb54d('0x1bf'),'foreignKey':_0xb54d('0x1ba')});db['SalesforceField'][_0xb54d('0x10c')](db['SalesforceField'],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x9c')][_0xb54d('0x10c')](db[_0xb54d('0x9c')],{'as':_0xb54d('0x1c1'),'foreignKey':'FieldId'});db[_0xb54d('0x9c')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':_0xb54d('0x1c2'),'foreignKey':'VariableId'});db[_0xb54d('0x1c3')]['hasMany'](db[_0xb54d('0x9e')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db['SugarcrmConfiguration'][_0xb54d('0x10c')](db[_0xb54d('0xa0')],{'as':_0xb54d('0x1b9'),'onDelete':_0xb54d('0x109'),'foreignKey':'SubjectId'});db[_0xb54d('0x9e')][_0xb54d('0x10c')](db[_0xb54d('0xa0')],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x9e')][_0xb54d('0x10c')](db[_0xb54d('0xa0')],{'as':'Fields','onDelete':_0xb54d('0x109'),'foreignKey':'FieldId'});db[_0xb54d('0x9e')][_0xb54d('0x11a')](db[_0xb54d('0x1c3')],{'as':'Account','foreignKey':'AccountId'});db[_0xb54d('0xa0')][_0xb54d('0x10c')](db[_0xb54d('0xa0')],{'as':'Subject','foreignKey':_0xb54d('0x1ba')});db['SugarcrmField'][_0xb54d('0x10c')](db['SugarcrmField'],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db['SugarcrmField']['hasMany'](db[_0xb54d('0xa0')],{'as':_0xb54d('0x1c1'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0xa0')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':'Variable','foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xa2')][_0xb54d('0x10c')](db['DeskConfiguration'],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xa4')][_0xb54d('0x10c')](db[_0xb54d('0x1c5')],{'as':_0xb54d('0x1b9'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xa4')][_0xb54d('0x10c')](db[_0xb54d('0x1c5')],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':'DescriptionId'});db[_0xb54d('0xa4')][_0xb54d('0x10c')](db['DeskField'],{'as':_0xb54d('0x1b3'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0xa4')][_0xb54d('0x11a')](db[_0xb54d('0xa2')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xa4')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0xb54d('0x10c')](db['DeskField'],{'as':_0xb54d('0x1bf'),'foreignKey':'SubjectId'});db['DeskField'][_0xb54d('0x10c')](db[_0xb54d('0x1c5')],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x1c5')][_0xb54d('0x10c')](db[_0xb54d('0x1c5')],{'as':_0xb54d('0x1c1'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0x1c5')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xa7')]['hasMany'](db[_0xb54d('0xa9')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xa9')]['hasMany'](db[_0xb54d('0xab')],{'as':_0xb54d('0x1b9'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xa9')]['hasMany'](db[_0xb54d('0xab')],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xa9')]['hasMany'](db['ZohoField'],{'as':_0xb54d('0x1b3'),'onDelete':'cascade','foreignKey':_0xb54d('0x1bd')});db['ZohoConfiguration'][_0xb54d('0x11a')](db[_0xb54d('0xa7')],{'as':'Account','foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xab')]['hasMany'](db[_0xb54d('0xab')],{'as':_0xb54d('0x1bf'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xab')]['hasMany'](db['ZohoField'],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xab')][_0xb54d('0x10c')](db[_0xb54d('0xab')],{'as':_0xb54d('0x1c1'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0xab')][_0xb54d('0x11a')](db['Variable'],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db['ZendeskAccount']['hasMany'](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xae')][_0xb54d('0x10c')](db[_0xb54d('0x1c6')],{'as':_0xb54d('0x1b9'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xae')][_0xb54d('0x10c')](db['ZendeskField'],{'as':_0xb54d('0x1bb'),'foreignKey':'DescriptionId'});db[_0xb54d('0xae')][_0xb54d('0x10c')](db[_0xb54d('0x1c6')],{'as':_0xb54d('0x1b3'),'foreignKey':'FieldId'});db[_0xb54d('0xae')][_0xb54d('0x11a')](db[_0xb54d('0x1c7')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xae')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x1c8')});db[_0xb54d('0x1c6')][_0xb54d('0x10c')](db['ZendeskField'],{'as':_0xb54d('0x1bf'),'foreignKey':'SubjectId'});db['ZendeskField'][_0xb54d('0x10c')](db[_0xb54d('0x1c6')],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x1c6')][_0xb54d('0x10c')](db[_0xb54d('0x1c6')],{'as':_0xb54d('0x1c1'),'foreignKey':_0xb54d('0x1bd')});db['ZendeskField'][_0xb54d('0x11a')](db['Variable'],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xb1')][_0xb54d('0x10c')](db[_0xb54d('0xb2')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xb2')][_0xb54d('0x10c')](db[_0xb54d('0xb3')],{'as':_0xb54d('0x1b9'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1ba')});db['FreshdeskConfiguration'][_0xb54d('0x10c')](db['FreshdeskField'],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xb2')][_0xb54d('0x10c')](db[_0xb54d('0xb3')],{'as':_0xb54d('0x1b3'),'onDelete':'cascade','foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0xb2')][_0xb54d('0x11a')](db[_0xb54d('0xb1')],{'as':'Account','foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xb2')][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':_0xb54d('0x1c9')});db['FreshdeskField'][_0xb54d('0x10c')](db['FreshdeskField'],{'as':_0xb54d('0x1bf'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xb3')][_0xb54d('0x10c')](db['FreshdeskField'],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xb3')][_0xb54d('0x10c')](db[_0xb54d('0xb3')],{'as':'Field','foreignKey':_0xb54d('0x1bd')});db['FreshdeskField']['belongsTo'](db[_0xb54d('0x1c2')],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xb4')][_0xb54d('0x10c')](db[_0xb54d('0x1ca')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db['VtigerConfiguration']['hasMany'](db[_0xb54d('0x1cb')],{'as':'Subjects','foreignKey':_0xb54d('0x1ba')});db['VtigerConfiguration'][_0xb54d('0x10c')](db['VtigerField'],{'as':_0xb54d('0x1bb'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x1ca')][_0xb54d('0x10c')](db['VtigerField'],{'as':_0xb54d('0x1b3'),'foreignKey':_0xb54d('0x1bd')});db['VtigerConfiguration'][_0xb54d('0x11a')](db[_0xb54d('0xb4')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0x1cb')]['hasMany'](db[_0xb54d('0x1cb')],{'as':'Subject','foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0x1cb')][_0xb54d('0x10c')](db[_0xb54d('0x1cb')],{'as':'Description','foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0x1cb')][_0xb54d('0x10c')](db[_0xb54d('0x1cb')],{'as':_0xb54d('0x1c1'),'foreignKey':'FieldId'});db[_0xb54d('0x1cb')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xb7')][_0xb54d('0x10c')](db[_0xb54d('0xb8')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xb8')][_0xb54d('0x10c')](db[_0xb54d('0xba')],{'as':_0xb54d('0x1b9'),'foreignKey':_0xb54d('0x1ba')});db['ServicenowConfiguration'][_0xb54d('0x10c')](db[_0xb54d('0xba')],{'as':_0xb54d('0x1bb'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xb8')][_0xb54d('0x10c')](db['ServicenowField'],{'as':_0xb54d('0x1b3'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0xb8')][_0xb54d('0x11a')](db[_0xb54d('0xb7')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0xba')][_0xb54d('0x10c')](db[_0xb54d('0xba')],{'as':_0xb54d('0x1bf'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0xba')][_0xb54d('0x10c')](db['ServicenowField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xb54d('0xba')]['hasMany'](db[_0xb54d('0xba')],{'as':_0xb54d('0x1c1'),'foreignKey':'FieldId'});db[_0xb54d('0xba')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':'Variable','foreignKey':_0xb54d('0x1c4')});db['Dynamics365Account'][_0xb54d('0x10c')](db[_0xb54d('0x1cc')],{'as':_0xb54d('0x1b8'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1be')});db[_0xb54d('0x1cd')][_0xb54d('0x11a')](db[_0xb54d('0xff')],{'as':_0xb54d('0xff'),'foreignKey':_0xb54d('0x15c')});db[_0xb54d('0x1cc')][_0xb54d('0x10c')](db[_0xb54d('0x1ce')],{'as':'Subjects','onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0x1cc')]['hasMany'](db['Dynamics365Field'],{'as':_0xb54d('0x1bb'),'onDelete':_0xb54d('0x109'),'foreignKey':'DescriptionId'});db[_0xb54d('0x1cc')][_0xb54d('0x10c')](db[_0xb54d('0x1ce')],{'as':'Fields','onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0x1cc')]['belongsTo'](db['Dynamics365Account'],{'as':_0xb54d('0x178'),'foreignKey':'AccountId'});db[_0xb54d('0x1ce')]['hasMany'](db[_0xb54d('0x1ce')],{'as':'Subject','foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0x1ce')]['hasMany'](db[_0xb54d('0x1ce')],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db['Dynamics365Field'][_0xb54d('0x10c')](db[_0xb54d('0x1ce')],{'as':'Field','foreignKey':_0xb54d('0x1bd')});db['Dynamics365Field'][_0xb54d('0x11a')](db[_0xb54d('0x1c2')],{'as':_0xb54d('0x1c2'),'foreignKey':_0xb54d('0x1c4')});db['FreshsalesAccount'][_0xb54d('0x10c')](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xb54d('0x1be')});db[_0xb54d('0x1cf')][_0xb54d('0x10c')](db[_0xb54d('0xc1')],{'as':_0xb54d('0x1b9'),'foreignKey':_0xb54d('0x1ba')});db[_0xb54d('0x1cf')]['hasMany'](db[_0xb54d('0xc1')],{'as':_0xb54d('0x1bb'),'foreignKey':_0xb54d('0x1bc')});db['FreshsalesConfiguration'][_0xb54d('0x10c')](db[_0xb54d('0xc1')],{'as':_0xb54d('0x1b3'),'foreignKey':_0xb54d('0x1bd')});db[_0xb54d('0x1cf')][_0xb54d('0x11a')](db[_0xb54d('0xbe')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1be')});db['FreshsalesField']['hasMany'](db[_0xb54d('0xc1')],{'as':'Subject','foreignKey':_0xb54d('0x1ba')});db['FreshsalesField'][_0xb54d('0x10c')](db[_0xb54d('0xc1')],{'as':_0xb54d('0x1c0'),'foreignKey':_0xb54d('0x1bc')});db[_0xb54d('0xc1')][_0xb54d('0x10c')](db['FreshsalesField'],{'as':_0xb54d('0x1c1'),'foreignKey':'FieldId'});db[_0xb54d('0xc1')]['belongsTo'](db[_0xb54d('0x1c2')],{'as':'Variable','foreignKey':_0xb54d('0x1c4')});db[_0xb54d('0xc5')][_0xb54d('0x11a')](db['ChatWebsite'],{});db[_0xb54d('0xc5')][_0xb54d('0x11a')](db['CmList'],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0xc5')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db['ChatQueueReport']['belongsTo'](db[_0xb54d('0x187')],{});db[_0xb54d('0xc5')][_0xb54d('0x11a')](db[_0xb54d('0x62')],{});db['ChatQueueReport'][_0xb54d('0x11a')](db['User'],{});db[_0xb54d('0xc5')][_0xb54d('0x11a')](db[_0xb54d('0x12b')],{});db[_0xb54d('0xc6')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':'cascade','foreignKey':_0xb54d('0x1d0')});db[_0xb54d('0xc6')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x109'),'foreignKey':'ToId'});db[_0xb54d('0xcb')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xb54d('0xcb')]['hasMany'](db[_0xb54d('0x1d1')],{'foreignKey':'SessionId','onDelete':_0xb54d('0x109')});db[_0xb54d('0x1d2')][_0xb54d('0x11a')](db[_0xb54d('0x4d')],{});db[_0xb54d('0x1d2')]['belongsTo'](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0x1d2')]['belongsTo'](db[_0xb54d('0x6b')],{'as':'Contact','foreignKey':_0xb54d('0x15a')});db[_0xb54d('0x1d2')][_0xb54d('0x11a')](db[_0xb54d('0x51')],{});db['SmsQueueReport'][_0xb54d('0x11a')](db[_0xb54d('0x53')],{});db['SmsQueueReport'][_0xb54d('0x11a')](db[_0xb54d('0x107')],{});db['SmsQueueReport'][_0xb54d('0x11a')](db['SmsQueue'],{});db['JscriptyProject']['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0xb54d('0x1d3')});db[_0xb54d('0xd0')]['hasMany'](db[_0xb54d('0xc9')],{'foreignKey':_0xb54d('0x1d3')});db[_0xb54d('0xd0')][_0xb54d('0x10c')](db[_0xb54d('0x1d1')],{'foreignKey':_0xb54d('0x1d3')});db['SquareProject']['belongsToMany'](db[_0xb54d('0x107')],{'as':_0xb54d('0x16c'),'through':_0xb54d('0x13f')});db[_0xb54d('0xd8')]['belongsToMany'](db[_0xb54d('0x107')],{'as':'Agents','through':_0xb54d('0x1d4')});db[_0xb54d('0xd8')]['belongsToMany'](db[_0xb54d('0x126')],{'through':_0xb54d('0x100'),'as':'VoiceQueues'});db[_0xb54d('0xd8')][_0xb54d('0x11b')](db[_0xb54d('0x12a')],{'through':_0xb54d('0x166'),'as':_0xb54d('0x1d5')});db[_0xb54d('0xd8')][_0xb54d('0x11b')](db[_0xb54d('0x12b')],{'through':_0xb54d('0x1d6'),'as':_0xb54d('0x12c')});db[_0xb54d('0xd8')]['belongsToMany'](db[_0xb54d('0x12e')],{'through':'team_has_fax_queues','as':_0xb54d('0x12f')});db[_0xb54d('0xd8')]['belongsToMany'](db[_0xb54d('0x54')],{'through':_0xb54d('0x181'),'as':_0xb54d('0x1d7')});db[_0xb54d('0xd8')][_0xb54d('0x11b')](db['OpenchannelQueue'],{'through':_0xb54d('0x185'),'as':_0xb54d('0x1d8')});db[_0xb54d('0xd8')][_0xb54d('0x11b')](db[_0xb54d('0xfd')],{'through':'team_has_whatsapp_queues','as':_0xb54d('0x1d9')});db[_0xb54d('0xd8')][_0xb54d('0x11b')](db[_0xb54d('0x128')],{'through':_0xb54d('0x101'),'as':_0xb54d('0x129')});db[_0xb54d('0xdb')]['hasMany'](db[_0xb54d('0x19a')],{'as':_0xb54d('0x194'),'foreignKey':_0xb54d('0x19b')});db[_0xb54d('0xdb')][_0xb54d('0x10c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xb54d('0x19b')});db['Campaign'][_0xb54d('0x10c')](db[_0xb54d('0x71')],{'as':_0xb54d('0x145'),'foreignKey':_0xb54d('0x19b')});db['Campaign'][_0xb54d('0x10c')](db[_0xb54d('0x147')],{'as':'HopperBlacks','foreignKey':_0xb54d('0x19b')});db[_0xb54d('0xdb')][_0xb54d('0x11a')](db[_0xb54d('0x24')],{'as':_0xb54d('0x24'),'foreignKey':_0xb54d('0x149')});db[_0xb54d('0xdb')][_0xb54d('0x11a')](db[_0xb54d('0x24')],{'as':_0xb54d('0x14a'),'foreignKey':_0xb54d('0x1da')});db[_0xb54d('0xdb')][_0xb54d('0x11a')](db['Interval'],{'as':_0xb54d('0x7d'),'foreignKey':_0xb54d('0x14b')});db[_0xb54d('0xdb')][_0xb54d('0x11a')](db[_0xb54d('0x13d')],{'as':_0xb54d('0x13d'),'foreignKey':_0xb54d('0x1db')});db[_0xb54d('0xdb')][_0xb54d('0x11b')](db[_0xb54d('0xe8')],{'as':'Lists','through':_0xb54d('0x1dc')});db['Campaign'][_0xb54d('0x11b')](db['CmList'],{'as':'BlackLists','through':_0xb54d('0x1dd')});db[_0xb54d('0xdf')]['belongsTo'](db[_0xb54d('0x64')],{'as':'ChatOfflineMessage','foreignKey':_0xb54d('0x16f')});db[_0xb54d('0x1de')]['belongsTo'](db[_0xb54d('0x3b')],{});db[_0xb54d('0x1de')][_0xb54d('0x11a')](db[_0xb54d('0x3a')],{});db[_0xb54d('0x1de')][_0xb54d('0x11a')](db['MailAccount'],{'foreignKey':_0xb54d('0x1df'),'as':_0xb54d('0x1e0')});db['MailTransferReport'][_0xb54d('0x11a')](db['User'],{'foreignKey':_0xb54d('0x1e1'),'as':'FromAgent'});db[_0xb54d('0x1de')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':_0xb54d('0x1e3')});db[_0xb54d('0x1de')][_0xb54d('0x11a')](db[_0xb54d('0x12a')],{'foreignKey':_0xb54d('0x1e4'),'as':_0xb54d('0x1e5')});db[_0xb54d('0x1de')][_0xb54d('0x11a')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xb54d('0x1e6')});db['ChatTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x62')],{});db[_0xb54d('0x1e7')][_0xb54d('0x11a')](db[_0xb54d('0x187')],{});db[_0xb54d('0x1e7')][_0xb54d('0x11a')](db[_0xb54d('0x132')],{'foreignKey':_0xb54d('0x1e8'),'as':_0xb54d('0x1e0')});db[_0xb54d('0x1e7')]['belongsTo'](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e1'),'as':_0xb54d('0x1e9')});db['ChatTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':_0xb54d('0x1e3')});db[_0xb54d('0x1e7')][_0xb54d('0x11a')](db['ChatQueue'],{'foreignKey':_0xb54d('0x1ea'),'as':_0xb54d('0x1e5')});db['ChatTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x132')],{'foreignKey':_0xb54d('0x1eb'),'as':'ToAccount'});db[_0xb54d('0xe3')][_0xb54d('0x11a')](db[_0xb54d('0x176')],{});db[_0xb54d('0xe3')][_0xb54d('0x11a')](db[_0xb54d('0x47')],{});db[_0xb54d('0xe3')]['belongsTo'](db[_0xb54d('0x43')],{'foreignKey':_0xb54d('0x1ec'),'as':_0xb54d('0x1e0')});db[_0xb54d('0xe3')][_0xb54d('0x11a')](db['User'],{'foreignKey':_0xb54d('0x1e1'),'as':_0xb54d('0x1e9')});db[_0xb54d('0xe3')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':'ToAgent'});db['FaxTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x12e')],{'foreignKey':_0xb54d('0x1ed'),'as':_0xb54d('0x1e5')});db[_0xb54d('0xe3')][_0xb54d('0x11a')](db[_0xb54d('0x43')],{'foreignKey':_0xb54d('0x1ee'),'as':_0xb54d('0x1e6')});db[_0xb54d('0xe5')][_0xb54d('0x11a')](db['OpenchannelMessage'],{});db[_0xb54d('0xe5')][_0xb54d('0x11a')](db[_0xb54d('0x5a')],{});db[_0xb54d('0xe5')][_0xb54d('0x11a')](db[_0xb54d('0x56')],{'foreignKey':_0xb54d('0x1ef'),'as':_0xb54d('0x1e0')});db[_0xb54d('0xe5')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e1'),'as':_0xb54d('0x1e9')});db[_0xb54d('0xe5')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':_0xb54d('0x1e3')});db['OpenchannelTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x130')],{'foreignKey':_0xb54d('0x1f0'),'as':'ToQueue'});db[_0xb54d('0xe5')]['belongsTo'](db[_0xb54d('0x56')],{'foreignKey':_0xb54d('0x1f1'),'as':_0xb54d('0x1e6')});db[_0xb54d('0x1f2')][_0xb54d('0x11a')](db['SmsMessage'],{});db['SmsTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x51')],{});db[_0xb54d('0x1f2')][_0xb54d('0x11a')](db[_0xb54d('0x4d')],{'foreignKey':_0xb54d('0x1f3'),'as':_0xb54d('0x1e0')});db['SmsTransferReport'][_0xb54d('0x11a')](db['User'],{'foreignKey':'FromUserId','as':_0xb54d('0x1e9')});db[_0xb54d('0x1f2')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':_0xb54d('0x1e3')});db['SmsTransferReport'][_0xb54d('0x11a')](db[_0xb54d('0x54')],{'foreignKey':'ToSmsQueueId','as':_0xb54d('0x1e5')});db[_0xb54d('0x1f2')]['belongsTo'](db[_0xb54d('0x4d')],{'foreignKey':_0xb54d('0x1f4'),'as':'ToAccount'});db['CmList'][_0xb54d('0x10c')](db[_0xb54d('0x15f')],{'as':_0xb54d('0x173'),'foreignKey':_0xb54d('0x171'),'onDelete':'cascade'});db[_0xb54d('0xe8')][_0xb54d('0x10c')](db[_0xb54d('0x75')],{'as':_0xb54d('0x1f5'),'foreignKey':_0xb54d('0x171')});db['CmList'][_0xb54d('0x10c')](db[_0xb54d('0x6b')],{'as':_0xb54d('0x11f'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0xe8')][_0xb54d('0x10c')](db[_0xb54d('0x6f')],{'as':_0xb54d('0x112'),'foreignKey':'ListId'});db[_0xb54d('0xe8')][_0xb54d('0x10c')](db[_0xb54d('0x71')],{'as':_0xb54d('0x1f6'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0xe8')]['hasMany'](db[_0xb54d('0x73')],{'as':_0xb54d('0x73'),'foreignKey':_0xb54d('0x171')});db['CmList']['belongsToMany'](db[_0xb54d('0x126')],{'as':_0xb54d('0x1f7'),'through':_0xb54d('0x14d')});db[_0xb54d('0xe8')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x121')});db[_0xb54d('0x128')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xb54d('0x109')});db[_0xb54d('0x128')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x103')});db[_0xb54d('0x128')][_0xb54d('0x11b')](db[_0xb54d('0xd8')],{'through':_0xb54d('0x101'),'as':_0xb54d('0x14f')});db['UserProfile'][_0xb54d('0x10c')](db['User'],{'as':'Users','foreignKey':_0xb54d('0x1f8')});db[_0xb54d('0xeb')][_0xb54d('0x10c')](db[_0xb54d('0xed')],{'as':_0xb54d('0x1f9'),'foreignKey':'userProfileId','onDelete':_0xb54d('0x109')});db['UserProfileSection'][_0xb54d('0x10c')](db[_0xb54d('0xef')],{'as':_0xb54d('0x1fa'),'foreignKey':_0xb54d('0x1fb'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0xf2')][_0xb54d('0x10c')](db[_0xb54d('0x15f')],{'as':_0xb54d('0x173'),'foreignKey':_0xb54d('0x1fc'),'onDelete':_0xb54d('0x109')});db[_0xb54d('0xf2')][_0xb54d('0x10c')](db[_0xb54d('0x7b')],{'as':'Answers','foreignKey':_0xb54d('0x1fc')});db[_0xb54d('0xf2')][_0xb54d('0x10c')](db[_0xb54d('0xf7')],{'as':_0xb54d('0x153'),'foreignKey':'WhatsappAccountId'});db[_0xb54d('0xf2')][_0xb54d('0x10c')](db['WhatsappInteraction'],{'as':_0xb54d('0x161')});db[_0xb54d('0xf2')]['hasMany'](db[_0xb54d('0xf3')],{'as':'Applications'});db['WhatsappAccount']['belongsTo'](db[_0xb54d('0xe8')],{'as':_0xb54d('0x163'),'foreignKey':_0xb54d('0x171')});db[_0xb54d('0xf2')]['belongsTo'](db['Pause'],{'as':_0xb54d('0x14c'),'foreignKey':_0xb54d('0x165')});db[_0xb54d('0xf2')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':'Agents','through':_0xb54d('0x13c')});db[_0xb54d('0xf3')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'onDelete':_0xb54d('0x15d')});db['WhatsappApplication'][_0xb54d('0x11a')](db[_0xb54d('0xfd')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0xf3')][_0xb54d('0x11a')](db[_0xb54d('0xf2')],{'onDelete':_0xb54d('0x15d')});db[_0xb54d('0xf3')]['belongsTo'](db[_0xb54d('0x7d')],{'onDelete':'restrict','foreignKey':_0xb54d('0x14b')});db[_0xb54d('0xf3')][_0xb54d('0x11a')](db[_0xb54d('0x84')],{'onDelete':_0xb54d('0x15d'),'foreignKey':_0xb54d('0x170')});db[_0xb54d('0xf5')][_0xb54d('0x10c')](db['WhatsappMessage'],{'as':_0xb54d('0x153'),'onDelete':_0xb54d('0x109'),'foreignKey':_0xb54d('0x1fd')});db[_0xb54d('0xf5')]['belongsTo'](db[_0xb54d('0xf2')],{'as':_0xb54d('0x178'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xb54d('0x11a')](db['CmContact'],{'as':_0xb54d('0x159'),'foreignKey':_0xb54d('0x15a')});db[_0xb54d('0xf5')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'as':_0xb54d('0x168'),'foreignKey':'UserId'});db['WhatsappInteraction'][_0xb54d('0x11b')](db[_0xb54d('0x84')],{'through':'whatsapp_interaction_has_tags','as':_0xb54d('0x169')});db['WhatsappInteraction'][_0xb54d('0x11b')](db['Tag'],{'through':_0xb54d('0x1ac'),'as':'ThroughTags'});db[_0xb54d('0xf5')][_0xb54d('0x11b')](db[_0xb54d('0x107')],{'as':_0xb54d('0x16c'),'through':'user_has_whatsapp_interactions','foreignKey':_0xb54d('0x1fd')});db[_0xb54d('0xf7')][_0xb54d('0x11a')](db['User'],{'as':_0xb54d('0x107')});db[_0xb54d('0xf7')][_0xb54d('0x11a')](db[_0xb54d('0x6b')],{'onDelete':_0xb54d('0x109'),'as':'Contact'});db[_0xb54d('0xf7')][_0xb54d('0x11a')](db[_0xb54d('0xf5')],{'onDelete':_0xb54d('0x109'),'as':_0xb54d('0x17b'),'foreignKey':_0xb54d('0x1fd')});db['WhatsappMessage'][_0xb54d('0x11a')](db[_0xb54d('0xf2')],{'as':_0xb54d('0x178'),'foreignKey':_0xb54d('0x1fc')});db[_0xb54d('0xf9')][_0xb54d('0x11a')](db['WhatsappAccount'],{});db[_0xb54d('0xf9')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xb54d('0x171')});db[_0xb54d('0xf9')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xb54d('0x15a')});db[_0xb54d('0xf9')][_0xb54d('0x11a')](db[_0xb54d('0xf5')],{});db[_0xb54d('0xf9')][_0xb54d('0x11a')](db['WhatsappQueue'],{});db[_0xb54d('0xf9')][_0xb54d('0x11a')](db[_0xb54d('0xf7')],{});db[_0xb54d('0xf9')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{});db[_0xb54d('0xfb')]['belongsTo'](db[_0xb54d('0xf7')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0xb54d('0xfb')][_0xb54d('0x11a')](db[_0xb54d('0xf2')],{'foreignKey':_0xb54d('0x1fe'),'as':'FromAccount'});db[_0xb54d('0xfb')]['belongsTo'](db[_0xb54d('0xf2')],{'foreignKey':_0xb54d('0x1ff'),'as':_0xb54d('0x1e6')});db[_0xb54d('0xfb')]['belongsTo'](db[_0xb54d('0xfd')],{'foreignKey':_0xb54d('0x200'),'as':_0xb54d('0x1e5')});db[_0xb54d('0xfb')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e1'),'as':_0xb54d('0x1e9')});db[_0xb54d('0xfb')][_0xb54d('0x11a')](db[_0xb54d('0x107')],{'foreignKey':_0xb54d('0x1e2'),'as':_0xb54d('0x1e3')});db[_0xb54d('0xfd')][_0xb54d('0x11b')](db['User'],{'as':_0xb54d('0x14e'),'through':_0xb54d('0x131'),'foreignKey':'WhatsappQueueId'});db[_0xb54d('0xfd')]['belongsToMany'](db[_0xb54d('0xd8')],{'through':_0xb54d('0x201'),'as':_0xb54d('0x14f')});db['UserSetting']['belongsTo'](db[_0xb54d('0x107')],{'as':_0xb54d('0x202'),'foreignKey':_0xb54d('0x10a'),'onDelete':_0xb54d('0x109'),'hooks':!![]});db[_0xb54d('0xff')][_0xb54d('0x10b')](db[_0xb54d('0x1cd')],{'as':_0xb54d('0x1cd'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0xff')][_0xb54d('0x10b')](db[_0xb54d('0x33')],{'as':_0xb54d('0x203'),'onDelete':_0xb54d('0x15d')});db[_0xb54d('0xff')][_0xb54d('0x10b')](db['MailServerOut'],{'as':_0xb54d('0x15e'),'onDelete':_0xb54d('0x15d')});module[_0xb54d('0x204')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xe1bb=['ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','SquareReport','../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','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userNotification/userNotification.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','UserSetting','UserId','hasMany','Recordings','HopperHistory','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotification','SenderId','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','ChatInteraction','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','CmList','user_has_chat_websites','user_has_fax_accounts','user_has_mail_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccountId','CloudProvider','restrict','Imap','Answers','Interactions','List','ListId','Template','TemplateId','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','DashboardItem','Items','Dispositions','FaxAccountId','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteraction','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','ChatApplication','ChatMessage','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','CompanyId','Phones','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Automation','Condition','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Extensions','FaxApplications','Schedule','AnalyticCustomReport','Mohs','whatsapp_interaction_has_tags','ItemTypeId','CmContactId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','CustomReportId','DefaultReportId','MetricId','Configurations','SalesforceField','Subjects','SubjectId','DescriptionId','FieldId','SalesforceAccount','AccountId','Description','Field','VariableId','SugarcrmAccount','Descriptions','Subject','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','CloudProviderId','FreshsalesAccount','FromId','ToId','ProjectId','user_has_teams','VoiceQueues','team_has_mail_queues','team_has_whatsapp_queues','VoicePrefixes','HopperFinals','SquareProjectId','campaigns_has_cm_lists','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToAccount','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','FaxTransferReport','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToAgent','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','WhatsappAccount','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueueId','Smtp','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount'];(function(_0x1593e2,_0x29ac15){var _0x33d917=function(_0x577eca){while(--_0x577eca){_0x1593e2['push'](_0x1593e2['shift']());}};_0x33d917(++_0x29ac15);}(_0xe1bb,0x134));var _0xbe1b=function(_0x1414b3,_0x477031){_0x1414b3=_0x1414b3-0x0;var _0x5761ab=_0xe1bb[_0x1414b3];return _0x5761ab;};'use strict';var config=require(_0xbe1b('0x0'));var Sequelize=require(_0xbe1b('0x1'));var _=require(_0xbe1b('0x2'));var jstz=require(_0xbe1b('0x3'));var timezone=jstz['determine']();config[_0xbe1b('0x1')]=_[_0xbe1b('0x4')](config['sequelize'],{'database':_0xbe1b('0x5'),'username':'xcall','password':_0xbe1b('0x6'),'options':{'host':_0xbe1b('0x7'),'port':0xcea,'dialect':_0xbe1b('0x8'),'dialectOptions':{'charset':_0xbe1b('0x9')},'logging':![],'timezone':timezone[_0xbe1b('0xa')](),'define':{'charset':_0xbe1b('0xb'),'collate':_0xbe1b('0xc')}}});config[_0xbe1b('0xd')]=_[_0xbe1b('0x4')](config[_0xbe1b('0xd')],{'database':_0xbe1b('0x5'),'username':'xcall','password':_0xbe1b('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xbe1b('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xbe1b('0xa')](),'define':{'charset':_0xbe1b('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xbe1b('0x1')][_0xbe1b('0xe')],config[_0xbe1b('0x1')]['username'],config[_0xbe1b('0x1')][_0xbe1b('0xf')],config[_0xbe1b('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xbe1b('0xe')],config[_0xbe1b('0xd')]['username'],config[_0xbe1b('0xd')][_0xbe1b('0xf')],config[_0xbe1b('0xd')][_0xbe1b('0x10')])};db[_0xbe1b('0x11')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x13'));db[_0xbe1b('0x14')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x15'));db[_0xbe1b('0x16')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x17'));db[_0xbe1b('0x18')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x19'));db[_0xbe1b('0x1a')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xbe1b('0x1b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0xbe1b('0x1c')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x1d'));db[_0xbe1b('0x1e')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x1f'));db[_0xbe1b('0x20')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x21'));db['VoiceMailMessage']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x22'));db[_0xbe1b('0x23')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x24'));db['VoiceDialReport']=db[_0xbe1b('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xbe1b('0x25')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xbe1b('0x26')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x27'));db[_0xbe1b('0x28')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x29'));db['Trunk']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x2a'));db['VoiceTransferReport']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x2b'));db[_0xbe1b('0x2c')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x2d'));db[_0xbe1b('0x2e')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xbe1b('0x2f')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x30'));db[_0xbe1b('0x31')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0xbe1b('0x32')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x33'));db[_0xbe1b('0x34')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x35'));db['UserOpenchannelQueue']=db['sequelize']['import'](_0xbe1b('0x36'));db[_0xbe1b('0x37')]=db[_0xbe1b('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xbe1b('0x38')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x39'));db[_0xbe1b('0x3a')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x3b'));db[_0xbe1b('0x3c')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x3d'));db[_0xbe1b('0x3e')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/mailQueue/mailQueue.model');db[_0xbe1b('0x3f')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/mailSubstatus/mailSubstatus.model');db[_0xbe1b('0x40')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x41'));db[_0xbe1b('0x42')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/mailMessage/mailMessage.model');db[_0xbe1b('0x43')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x44'));db[_0xbe1b('0x45')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x46'));db[_0xbe1b('0x47')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x48'));db['DashboardItem']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x49'));db[_0xbe1b('0x4a')]=db[_0xbe1b('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0xbe1b('0x4b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x4c'));db[_0xbe1b('0x4d')]=db['sequelize']['import'](_0xbe1b('0x4e'));db[_0xbe1b('0x4f')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x50'));db[_0xbe1b('0x51')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/faxQueue/faxQueue.model');db[_0xbe1b('0x52')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x53'));db[_0xbe1b('0x54')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/smsAccount/smsAccount.model');db[_0xbe1b('0x55')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x56'));db['SmsInteraction']=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0xbe1b('0x57')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/smsMessage/smsMessage.model');db[_0xbe1b('0x58')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x59'));db[_0xbe1b('0x5a')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xbe1b('0x5b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x5c'));db[_0xbe1b('0x5d')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x5e'));db[_0xbe1b('0x5f')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x60'));db[_0xbe1b('0x61')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/openchannelQueue/openchannelQueue.model');db[_0xbe1b('0x62')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/chatWebsite/chatWebsite.model');db[_0xbe1b('0x63')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x64'));db['ChatApplication']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x65'));db['ChatInteraction']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x66'));db['ChatMessage']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x67'));db[_0xbe1b('0x68')]=db[_0xbe1b('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xbe1b('0x1')]['import']('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x69'));db[_0xbe1b('0x6a')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xbe1b('0x6b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x6c'));db['CmContact']=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x6d'));db[_0xbe1b('0x6e')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x6f'));db[_0xbe1b('0x70')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xbe1b('0x71')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x72'));db[_0xbe1b('0x73')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x74'));db[_0xbe1b('0x75')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xbe1b('0x76')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x77'));db[_0xbe1b('0x78')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x79'));db['Automation']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x7a'));db[_0xbe1b('0x7b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x7c'));db[_0xbe1b('0x7d')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x7e'));db['Condition']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x7f'));db[_0xbe1b('0x80')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/interval/interval.model');db[_0xbe1b('0x81')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x82'));db[_0xbe1b('0x83')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x84'));db[_0xbe1b('0x85')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x86'));db['Schedule']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x87'));db[_0xbe1b('0x88')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x89'));db[_0xbe1b('0x8a')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x8b'));db[_0xbe1b('0x8c')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x8d'));db[_0xbe1b('0x8e')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xbe1b('0x8f')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x90'));db['Template']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x91'));db['Trigger']=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/trigger/trigger.model');db[_0xbe1b('0x92')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x93'));db[_0xbe1b('0x94')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x95'));db[_0xbe1b('0x96')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x97'));db[_0xbe1b('0x98')]=db[_0xbe1b('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xbe1b('0x99')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0x9a'));db[_0xbe1b('0x9b')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0xbe1b('0x9c')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x9d'));db[_0xbe1b('0x9e')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x9f'));db['SalesforceAccount']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xa0'));db[_0xbe1b('0xa1')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xa2'));db['SugarcrmAccount']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0xa3'));db[_0xbe1b('0xa4')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xa5'));db[_0xbe1b('0xa6')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xa7'));db[_0xbe1b('0xa8')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0xa9'));db['DeskConfiguration']=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xaa'));db[_0xbe1b('0xab')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xac'));db[_0xbe1b('0xad')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intZohoAccount/intZohoAccount.model');db[_0xbe1b('0xae')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xaf'));db[_0xbe1b('0xb0')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xb1'));db['ZendeskAccount']=db['sequelize']['import'](_0xbe1b('0xb2'));db[_0xbe1b('0xb3')]=db[_0xbe1b('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xb4'));db[_0xbe1b('0xb5')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xbe1b('0xb6')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xb7'));db[_0xbe1b('0xb8')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xbe1b('0xb9')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xba'));db[_0xbe1b('0xbb')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xbc'));db[_0xbe1b('0xbd')]=db['sequelize']['import'](_0xbe1b('0xbe'));db[_0xbe1b('0xbf')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xbe1b('0xc0')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xc1'));db[_0xbe1b('0xc2')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0xbe1b('0xc3')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xc4'));db[_0xbe1b('0xc5')]=db['sequelize']['import'](_0xbe1b('0xc6'));db[_0xbe1b('0xc7')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xc8'));db['FreshsalesAccount']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0xc9'));db[_0xbe1b('0xca')]=db['sequelize'][_0xbe1b('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xbe1b('0xcb')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xcc'));db[_0xbe1b('0x94')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x95'));db['Network']=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/network/network.model');db[_0xbe1b('0xcd')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xce'));db['ChatInternalMessage']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xcf'));db[_0xbe1b('0xd0')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xd1'));db[_0xbe1b('0xd2')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xd3'));db[_0xbe1b('0xd4')]=db[_0xbe1b('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xbe1b('0xd5')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/smsQueueReport/smsQueueReport.model');db[_0xbe1b('0xd6')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xd7'));db[_0xbe1b('0xd8')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xd9'));db[_0xbe1b('0xda')]=db[_0xbe1b('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0xbe1b('0xdb')]=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xdc'));db[_0xbe1b('0xdd')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xde'));db[_0xbe1b('0xdf')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xe0'));db['SquareRecording']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xe1'));db[_0xbe1b('0xe2')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xe3'));db[_0xbe1b('0xe4')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/team/team.model');db[_0xbe1b('0xe5')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xe6'));db[_0xbe1b('0xe7')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xe8'));db['Migration']=db['sequelize'][_0xbe1b('0x12')]('../api/migration/migration.model');db[_0xbe1b('0xe9')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/attachment/attachment.model');db['Plugin']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0xea'));db[_0xbe1b('0xeb')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0xec'));db[_0xbe1b('0xed')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xee'));db['FaxTransferReport']=db['sequelize']['import'](_0xbe1b('0xef'));db['OpenchannelTransferReport']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xf0'));db[_0xbe1b('0xf1')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xf2'));db['CmList']=db[_0xbe1b('0x1')]['import'](_0xbe1b('0xf3'));db[_0xbe1b('0xf4')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xf5'));db[_0xbe1b('0xf6')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xf7'));db[_0xbe1b('0xf8')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xf9'));db[_0xbe1b('0xfa')]=db[_0xbe1b('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db['UserNotification']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xfb'));db['WhatsappAccount']=db[_0xbe1b('0x1')]['import']('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xfc'));db[_0xbe1b('0xfd')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0xfe'));db[_0xbe1b('0xff')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x100'));db[_0xbe1b('0x101')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x102'));db['WhatsappQueue']=db[_0xbe1b('0x1')][_0xbe1b('0x12')]('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0xbe1b('0x1')]['import']('../api/cloudProvider/cloudProvider.model');db[_0xbe1b('0x103')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x104'));db[_0xbe1b('0x105')]=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x106'));db[_0xbe1b('0x107')]=db[_0xbe1b('0x1')][_0xbe1b('0x12')](_0xbe1b('0x108'));db['UserSetting']=db['sequelize'][_0xbe1b('0x12')](_0xbe1b('0x109'));db[_0xbe1b('0x11')][_0xbe1b('0x10a')](db[_0xbe1b('0x20')],{'as':_0xbe1b('0x20'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'UserId'});db[_0xbe1b('0x11')]['hasOne'](db[_0xbe1b('0x10c')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xbe1b('0x10d')});db['User'][_0xbe1b('0x10e')](db[_0xbe1b('0x1c')],{'as':_0xbe1b('0x10f'),'foreignKey':_0xbe1b('0x10d')});db['User'][_0xbe1b('0x10e')](db[_0xbe1b('0x2c')],{'as':'VoiceQueuesRt','foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'as':'Extensions','onDelete':_0xbe1b('0x10b'),'hooks':!![]});db[_0xbe1b('0x11')]['hasMany'](db[_0xbe1b('0x71')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x73')],{'as':_0xbe1b('0x110'),'foreignKey':'UserId'});db[_0xbe1b('0x11')]['hasMany'](db[_0xbe1b('0x75')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x5d')],{'as':_0xbe1b('0x111'),'foreignKey':'UserId'});db[_0xbe1b('0x11')]['hasMany'](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db['SmsInteraction'],{'as':_0xbe1b('0x112'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x4d')],{'as':_0xbe1b('0x113'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x40')],{'as':_0xbe1b('0x114'),'foreignKey':'UserId'});db[_0xbe1b('0x11')][_0xbe1b('0x10e')](db[_0xbe1b('0x115')],{'as':_0xbe1b('0x116'),'foreignKey':'UserId'});db['User'][_0xbe1b('0x10e')](db[_0xbe1b('0x117')],{'as':'UserNotifications','foreignKey':_0xbe1b('0x118')});db[_0xbe1b('0x11')]['belongsTo'](db[_0xbe1b('0xf6')],{'as':_0xbe1b('0xf6'),'foreignKey':'userProfileId'});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x11a')],{'as':'Groups','through':_0xbe1b('0x11b')});db['User'][_0xbe1b('0x119')](db['CmContact'],{'as':_0xbe1b('0x11c'),'through':_0xbe1b('0x11d')});db[_0xbe1b('0x11')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xbe1b('0x11e')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db['Team'],{'through':'user_has_teams'});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db['MailInteraction'],{'as':_0xbe1b('0x114'),'through':'user_has_mail_interactions'});db[_0xbe1b('0x11')]['belongsToMany'](db[_0xbe1b('0x11f')],{'as':_0xbe1b('0x120'),'through':_0xbe1b('0x121')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db['FaxInteraction'],{'as':_0xbe1b('0x113'),'through':_0xbe1b('0x122')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db['SmsInteraction'],{'as':_0xbe1b('0x112'),'through':_0xbe1b('0x123')});db[_0xbe1b('0x11')]['belongsToMany'](db[_0xbe1b('0x5d')],{'as':_0xbe1b('0x111'),'through':_0xbe1b('0x124')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x115')],{'as':_0xbe1b('0x116'),'through':_0xbe1b('0x125')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x1b')],{'as':'VoiceQueues','through':_0xbe1b('0x2e'),'required':![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db['VoicePrefix'],{'as':'VoicePrefixes','through':_0xbe1b('0x107'),'required':![]});db['User'][_0xbe1b('0x119')](db[_0xbe1b('0x3e')],{'as':_0xbe1b('0x126'),'through':_0xbe1b('0x31'),'required':![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x127')],{'as':_0xbe1b('0x128'),'through':_0xbe1b('0x2f'),'required':![],'hooks':!![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x51')],{'as':_0xbe1b('0x129'),'through':_0xbe1b('0x32'),'required':![]});db[_0xbe1b('0x11')]['belongsToMany'](db[_0xbe1b('0x58')],{'as':_0xbe1b('0x12a'),'through':'UserSmsQueue','required':![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x61')],{'as':_0xbe1b('0x12b'),'through':_0xbe1b('0x12c'),'required':![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x12d')],{'as':_0xbe1b('0x12e'),'through':_0xbe1b('0x37'),'required':![]});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x12f')],{'through':_0xbe1b('0x11e')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x62')],{'as':'ChatWebsites','through':_0xbe1b('0x130')});db[_0xbe1b('0x11')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0xbe1b('0x131')});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x3c')],{'as':'MailAccounts','through':_0xbe1b('0x132')});db['User'][_0xbe1b('0x119')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0xbe1b('0x11')][_0xbe1b('0x119')](db[_0xbe1b('0x54')],{'as':_0xbe1b('0x133'),'through':_0xbe1b('0x134')});db['User'][_0xbe1b('0x119')](db['WhatsappAccount'],{'as':_0xbe1b('0x135'),'through':_0xbe1b('0x136')});db['User'][_0xbe1b('0x119')](db[_0xbe1b('0xdf')],{'as':'SquareProjects','through':_0xbe1b('0x137')});db[_0xbe1b('0x14')][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'as':_0xbe1b('0x138'),'onDelete':'cascade','foreignKey':_0xbe1b('0x139')});db[_0xbe1b('0x16')][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x18')][_0xbe1b('0x10e')](db['VoiceExtension'],{'as':_0xbe1b('0x13a'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x1a')][_0xbe1b('0x119')](db[_0xbe1b('0x88')],{'as':_0xbe1b('0x13b'),'through':_0xbe1b('0x13c')});db[_0xbe1b('0x1b')][_0xbe1b('0x10e')](db['UserVoiceQueueRt'],{'as':_0xbe1b('0x13d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xbe1b('0x10e')](db[_0xbe1b('0x6e')],{'as':_0xbe1b('0x13e'),'foreignKey':_0xbe1b('0x13f')});db['VoiceQueue'][_0xbe1b('0x10e')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xbe1b('0x13f')});db[_0xbe1b('0x1b')][_0xbe1b('0x10e')](db[_0xbe1b('0x73')],{'as':_0xbe1b('0x140'),'foreignKey':'VoiceQueueId'});db[_0xbe1b('0x1b')][_0xbe1b('0x10e')](db['ReportAgentPreview'],{'as':_0xbe1b('0x75'),'foreignKey':'VoiceQueueId'});db[_0xbe1b('0x1b')][_0xbe1b('0x10e')](db[_0xbe1b('0x70')],{'as':_0xbe1b('0x141'),'foreignKey':_0xbe1b('0x13f')});db[_0xbe1b('0x1b')][_0xbe1b('0x10e')](db[_0xbe1b('0xd4')],{'as':_0xbe1b('0x142'),'foreignKey':_0xbe1b('0x13f')});db[_0xbe1b('0x1b')][_0xbe1b('0x143')](db[_0xbe1b('0x144')],{'as':_0xbe1b('0x144'),'foreignKey':_0xbe1b('0x145')});db['VoiceQueue'][_0xbe1b('0x143')](db[_0xbe1b('0x144')],{'as':_0xbe1b('0x146'),'foreignKey':_0xbe1b('0x147')});db[_0xbe1b('0x1b')][_0xbe1b('0x143')](db[_0xbe1b('0x80')],{'as':_0xbe1b('0x80'),'foreignKey':_0xbe1b('0x148')});db[_0xbe1b('0x1b')]['belongsTo'](db['Pause'],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db[_0xbe1b('0x1b')][_0xbe1b('0x119')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x14b'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':'UserVoiceQueue'});db[_0xbe1b('0x1b')]['belongsToMany'](db[_0xbe1b('0xe4')],{'as':_0xbe1b('0x14d'),'through':_0xbe1b('0x103')});db[_0xbe1b('0x1b')][_0xbe1b('0x119')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x14e'),'through':_0xbe1b('0x14f')});db['VoiceRecording'][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x11'),'foreignKey':_0xbe1b('0x10d')});db['ScreenRecording']['belongsTo'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x11'),'foreignKey':'UserId'});db['VoiceMail'][_0xbe1b('0x10e')](db[_0xbe1b('0x150')],{'as':_0xbe1b('0x151'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x152'),'sourceKey':_0xbe1b('0x153')});db[_0xbe1b('0x150')][_0xbe1b('0x143')](db[_0xbe1b('0x20')],{'foreignKey':'mailboxuser','targetKey':_0xbe1b('0x153')});db[_0xbe1b('0x23')][_0xbe1b('0x10e')](db[_0xbe1b('0x26')],{'as':_0xbe1b('0x154'),'foreignKey':_0xbe1b('0x155'),'constraints':![]});db[_0xbe1b('0x23')][_0xbe1b('0x10e')](db[_0xbe1b('0x25')],{'as':_0xbe1b('0x156'),'foreignKey':_0xbe1b('0x155'),'constraints':![]});db[_0xbe1b('0x23')][_0xbe1b('0x143')](db['User'],{'as':'User','foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x23')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db['MailServerIn'][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'as':_0xbe1b('0x3c'),'foreignKey':_0xbe1b('0x15a')});db[_0xbe1b('0x38')][_0xbe1b('0x143')](db[_0xbe1b('0x15b')],{'as':_0xbe1b('0x15b'),'foreignKey':'CloudProviderId','onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x3a')]['belongsTo'](db[_0xbe1b('0x3c')],{'as':_0xbe1b('0x3c'),'foreignKey':_0xbe1b('0x15a')});db[_0xbe1b('0x3a')][_0xbe1b('0x143')](db['CloudProvider'],{'as':_0xbe1b('0x15b'),'foreignKey':'CloudProviderId','onDelete':_0xbe1b('0x15c')});db['MailAccount'][_0xbe1b('0x10a')](db[_0xbe1b('0x38')],{'as':_0xbe1b('0x15d'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x3c')][_0xbe1b('0x10a')](db[_0xbe1b('0x3a')],{'as':'Smtp','onDelete':'cascade'});db[_0xbe1b('0x3c')][_0xbe1b('0x10e')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xbe1b('0x15a'),'onDelete':_0xbe1b('0x10b')});db['MailAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x7b')],{'as':_0xbe1b('0x15e'),'foreignKey':_0xbe1b('0x15a')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':_0xbe1b('0x151'),'foreignKey':_0xbe1b('0x15a')});db['MailAccount']['hasMany'](db[_0xbe1b('0x40')],{'as':_0xbe1b('0x15f')});db[_0xbe1b('0x3c')][_0xbe1b('0x10e')](db[_0xbe1b('0x43')],{'as':'Applications'});db[_0xbe1b('0x3c')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x3c')]['belongsTo'](db[_0xbe1b('0x162')],{'as':_0xbe1b('0x162'),'foreignKey':_0xbe1b('0x163')});db[_0xbe1b('0x3c')]['belongsTo'](db[_0xbe1b('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xbe1b('0x14a')});db[_0xbe1b('0x3c')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x132')});db['MailQueue'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':'Agents','through':_0xbe1b('0x31')});db[_0xbe1b('0x3e')][_0xbe1b('0x119')](db[_0xbe1b('0xe4')],{'through':'team_has_mail_queues','as':_0xbe1b('0x14d')});db[_0xbe1b('0x40')]['hasMany'](db[_0xbe1b('0x42')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xbe1b('0x164')});db[_0xbe1b('0x40')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x15a')});db[_0xbe1b('0x40')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':'ContactId'});db[_0xbe1b('0x40')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db['MailInteraction']['belongsToMany'](db[_0xbe1b('0x8a')],{'through':_0xbe1b('0x167'),'as':_0xbe1b('0x168')});db[_0xbe1b('0x40')]['belongsToMany'](db['Tag'],{'through':_0xbe1b('0x167'),'as':_0xbe1b('0x169')});db[_0xbe1b('0x40')]['belongsToMany'](db['User'],{'as':_0xbe1b('0x16a'),'through':'user_has_mail_interactions','foreignKey':_0xbe1b('0x164')});db[_0xbe1b('0x42')][_0xbe1b('0x10e')](db[_0xbe1b('0xe9')],{'as':_0xbe1b('0x16b'),'onDelete':'cascade'});db[_0xbe1b('0x42')]['belongsTo'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x11')});db[_0xbe1b('0x42')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'onDelete':_0xbe1b('0x10b'),'as':'Contact'});db[_0xbe1b('0x42')][_0xbe1b('0x143')](db[_0xbe1b('0x40')],{'as':'Interaction','foreignKey':_0xbe1b('0x164')});db[_0xbe1b('0x42')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x15a')});db[_0xbe1b('0x42')][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{'as':_0xbe1b('0x62'),'foreignKey':_0xbe1b('0x16c')});db[_0xbe1b('0x42')]['belongsTo'](db[_0xbe1b('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0xbe1b('0x16d')});db[_0xbe1b('0x43')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x15c')});db['MailApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x3e')],{'onDelete':'restrict'});db[_0xbe1b('0x43')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x43')][_0xbe1b('0x143')](db[_0xbe1b('0x80')],{'onDelete':'restrict','foreignKey':_0xbe1b('0x148')});db['MailApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x8a')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db[_0xbe1b('0x45')]['belongsTo'](db[_0xbe1b('0x3c')],{});db[_0xbe1b('0x45')]['belongsTo'](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':'ListId'});db['MailQueueReport']['belongsTo'](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':'ContactId'});db[_0xbe1b('0x45')][_0xbe1b('0x143')](db['MailInteraction'],{});db['MailQueueReport'][_0xbe1b('0x143')](db['MailMessage'],{});db[_0xbe1b('0x45')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{});db[_0xbe1b('0x45')][_0xbe1b('0x143')](db['MailQueue'],{});db[_0xbe1b('0x47')][_0xbe1b('0x10e')](db[_0xbe1b('0x16f')],{'as':_0xbe1b('0x170'),'onDelete':_0xbe1b('0x10b')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0xbe1b('0x171'),'foreignKey':_0xbe1b('0x172'),'onDelete':_0xbe1b('0x10b')});db['FaxAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x7b')],{'as':_0xbe1b('0x15e'),'foreignKey':_0xbe1b('0x172')});db['FaxAccount']['hasMany'](db[_0xbe1b('0x4d')],{'as':_0xbe1b('0x15f')});db['FaxAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x4b')],{'as':_0xbe1b('0x13a')});db['FaxAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'as':'Exntensions','onDelete':'cascade'});db['FaxAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x4f')],{'as':_0xbe1b('0x151')});db[_0xbe1b('0x4a')][_0xbe1b('0x143')](db[_0xbe1b('0x144')],{'as':'Trunk'});db[_0xbe1b('0x4a')][_0xbe1b('0x143')](db['CmList'],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x4a')][_0xbe1b('0x143')](db[_0xbe1b('0x81')],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db['FaxAccount'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x131')});db[_0xbe1b('0x4b')]['belongsTo'](db['User'],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x4b')][_0xbe1b('0x143')](db[_0xbe1b('0x51')],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x4b')][_0xbe1b('0x143')](db['FaxAccount'],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x4b')]['belongsTo'](db['Tag'],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db[_0xbe1b('0x4d')][_0xbe1b('0x10e')](db['FaxMessage'],{'as':'Messages','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x173')});db['FaxInteraction'][_0xbe1b('0x143')](db[_0xbe1b('0x4a')],{'as':'Account','foreignKey':_0xbe1b('0x172')});db[_0xbe1b('0x4d')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x4d')][_0xbe1b('0x143')](db['User'],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x4d')]['belongsToMany'](db['Tag'],{'through':_0xbe1b('0x174'),'as':_0xbe1b('0x168')});db[_0xbe1b('0x4d')][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':_0xbe1b('0x174'),'as':_0xbe1b('0x169')});db[_0xbe1b('0x4d')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x16a'),'through':_0xbe1b('0x122'),'foreignKey':_0xbe1b('0x173')});db['FaxMessage'][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':'cascade','as':_0xbe1b('0x11')});db[_0xbe1b('0x4f')][_0xbe1b('0x143')](db[_0xbe1b('0x4d')],{'as':_0xbe1b('0x175'),'foreignKey':_0xbe1b('0x173')});db['FaxMessage'][_0xbe1b('0x143')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db['FaxMessage'][_0xbe1b('0x143')](db[_0xbe1b('0xe9')],{'as':'Attachment','foreignKey':_0xbe1b('0x176')});db['FaxMessage'][_0xbe1b('0x143')](db[_0xbe1b('0x4a')],{'as':'Account','foreignKey':_0xbe1b('0x172')});db[_0xbe1b('0x51')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xbe1b('0x32')});db[_0xbe1b('0x51')][_0xbe1b('0x119')](db['Team'],{'through':_0xbe1b('0x177'),'as':_0xbe1b('0x14d')});db['FaxQueueReport'][_0xbe1b('0x143')](db[_0xbe1b('0x4a')],{});db[_0xbe1b('0x52')][_0xbe1b('0x143')](db['CmList'],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x52')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x52')][_0xbe1b('0x143')](db['FaxInteraction'],{});db[_0xbe1b('0x52')][_0xbe1b('0x143')](db[_0xbe1b('0x4f')],{});db[_0xbe1b('0x52')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{});db['FaxQueueReport'][_0xbe1b('0x143')](db['FaxQueue'],{});db[_0xbe1b('0x54')][_0xbe1b('0x10e')](db[_0xbe1b('0x7d')],{'as':_0xbe1b('0x171'),'foreignKey':_0xbe1b('0x178'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x54')]['hasMany'](db[_0xbe1b('0x7b')],{'as':_0xbe1b('0x15e'),'foreignKey':_0xbe1b('0x178')});db[_0xbe1b('0x54')][_0xbe1b('0x10e')](db[_0xbe1b('0x57')],{'as':_0xbe1b('0x151'),'foreignKey':_0xbe1b('0x178')});db[_0xbe1b('0x54')]['hasMany'](db[_0xbe1b('0x179')],{'as':_0xbe1b('0x15f')});db[_0xbe1b('0x54')]['hasMany'](db[_0xbe1b('0x55')],{'as':'Applications'});db[_0xbe1b('0x54')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':'List','foreignKey':_0xbe1b('0x161')});db['SmsAccount'][_0xbe1b('0x143')](db[_0xbe1b('0x81')],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db['SmsAccount'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x134')});db[_0xbe1b('0x55')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':'restrict'});db['SmsApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x58')],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x55')][_0xbe1b('0x143')](db[_0xbe1b('0x54')],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x55')][_0xbe1b('0x143')](db[_0xbe1b('0x80')],{'onDelete':'restrict','foreignKey':_0xbe1b('0x148')});db['SmsApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x8a')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db[_0xbe1b('0x179')][_0xbe1b('0x10e')](db[_0xbe1b('0x57')],{'as':_0xbe1b('0x151'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x17a')});db['SmsInteraction'][_0xbe1b('0x143')](db[_0xbe1b('0x54')],{'as':_0xbe1b('0x165'),'foreignKey':'SmsAccountId'});db[_0xbe1b('0x179')]['belongsTo'](db[_0xbe1b('0x157')],{'as':'Contact','foreignKey':'ContactId'});db[_0xbe1b('0x179')]['belongsTo'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x179')][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':_0xbe1b('0x17b'),'as':_0xbe1b('0x168')});db['SmsInteraction'][_0xbe1b('0x119')](db['Tag'],{'through':_0xbe1b('0x17b'),'as':'ThroughTags'});db[_0xbe1b('0x179')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x16a'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0xbe1b('0x57')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x11')});db[_0xbe1b('0x57')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x158')});db[_0xbe1b('0x57')][_0xbe1b('0x143')](db[_0xbe1b('0x179')],{'onDelete':'cascade','as':_0xbe1b('0x175'),'foreignKey':'SmsInteractionId'});db[_0xbe1b('0x57')][_0xbe1b('0x143')](db['SmsAccount'],{'as':_0xbe1b('0x165'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':'Agents','through':_0xbe1b('0x34'),'foreignKey':_0xbe1b('0x17c')});db[_0xbe1b('0x58')]['belongsToMany'](db[_0xbe1b('0xe4')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xbe1b('0x5a')][_0xbe1b('0x10e')](db[_0xbe1b('0x7d')],{'as':_0xbe1b('0x171'),'foreignKey':_0xbe1b('0x17d'),'onDelete':_0xbe1b('0x10b')});db['OpenchannelAccount'][_0xbe1b('0x10e')](db[_0xbe1b('0x7b')],{'as':_0xbe1b('0x15e'),'foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x5a')][_0xbe1b('0x10e')](db[_0xbe1b('0x5d')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xbe1b('0x5a')]['hasMany'](db[_0xbe1b('0x5f')],{'as':_0xbe1b('0x151'),'foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x5a')]['hasMany'](db[_0xbe1b('0x5b')],{'as':_0xbe1b('0x13a'),'foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x5a')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':'List','foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x5a')]['belongsTo'](db[_0xbe1b('0x81')],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db[_0xbe1b('0x5a')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x17e')});db[_0xbe1b('0x5b')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x15c')});db['OpenchannelApplication']['belongsTo'](db[_0xbe1b('0x61')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x5a')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x5b')]['belongsTo'](db[_0xbe1b('0x80')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xbe1b('0x5b')]['belongsTo'](db[_0xbe1b('0x8a')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db[_0xbe1b('0x5d')][_0xbe1b('0x10e')](db[_0xbe1b('0x5f')],{'as':'Messages','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x17f')});db[_0xbe1b('0x5d')][_0xbe1b('0x143')](db[_0xbe1b('0x5a')],{'as':'Account','foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x5d')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':'ContactId'});db[_0xbe1b('0x5d')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db['OpenchannelInteraction'][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0xbe1b('0x168')});db[_0xbe1b('0x5d')][_0xbe1b('0x119')](db['Tag'],{'through':_0xbe1b('0x180'),'as':'ThroughTags'});db[_0xbe1b('0x5d')]['belongsToMany'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x16a'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0xbe1b('0x5f')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x11')});db['OpenchannelMessage']['belongsTo'](db[_0xbe1b('0x157')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x158')});db['OpenchannelMessage']['belongsTo'](db[_0xbe1b('0x5d')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x175'),'foreignKey':_0xbe1b('0x17f')});db[_0xbe1b('0x5f')]['belongsTo'](db[_0xbe1b('0xe9')],{'as':_0xbe1b('0xe9'),'foreignKey':'AttachmentId'});db[_0xbe1b('0x5f')][_0xbe1b('0x143')](db[_0xbe1b('0x5a')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x17d')});db[_0xbe1b('0x61')]['belongsToMany'](db['User'],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x12c'),'foreignKey':_0xbe1b('0x181')});db['OpenchannelQueue'][_0xbe1b('0x119')](db[_0xbe1b('0xe4')],{'through':_0xbe1b('0x182'),'as':'Teams'});db[_0xbe1b('0x62')][_0xbe1b('0x10e')](db[_0xbe1b('0x7d')],{'as':'Dispositions','foreignKey':_0xbe1b('0x16c'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x62')]['hasMany'](db['CannedAnswer'],{'as':_0xbe1b('0x15e'),'foreignKey':_0xbe1b('0x16c')});db[_0xbe1b('0x62')][_0xbe1b('0x10e')](db[_0xbe1b('0x6a')],{'as':_0xbe1b('0x183')});db[_0xbe1b('0x62')][_0xbe1b('0x10e')](db['ChatInteraction'],{'as':_0xbe1b('0x15f')});db['ChatWebsite'][_0xbe1b('0x10e')](db[_0xbe1b('0x184')],{'as':_0xbe1b('0x13a')});db[_0xbe1b('0x62')]['hasMany'](db[_0xbe1b('0x185')],{'as':'Messages'});db[_0xbe1b('0x62')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x62')][_0xbe1b('0x143')](db['Interval'],{'as':'Interval','foreignKey':_0xbe1b('0x148')});db[_0xbe1b('0x62')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'as':'MailAccount','foreignKey':_0xbe1b('0x15a')});db[_0xbe1b('0x62')]['belongsTo'](db[_0xbe1b('0x81')],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db[_0xbe1b('0x62')]['belongsToMany'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x130')});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db[_0xbe1b('0x5a')],{});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db['CmContact'],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db['OpenchannelInteraction'],{});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db[_0xbe1b('0x5f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0xbe1b('0x11')],{});db[_0xbe1b('0x63')][_0xbe1b('0x143')](db['OpenchannelQueue'],{});db[_0xbe1b('0x184')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db[_0xbe1b('0x184')][_0xbe1b('0x143')](db['ChatQueue'],{'as':_0xbe1b('0x186'),'foreignKey':_0xbe1b('0x187'),'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x184')][_0xbe1b('0x143')](db['ChatWebsite'],{'as':_0xbe1b('0x188'),'foreignKey':'ChatWebsiteId','onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x184')]['belongsTo'](db[_0xbe1b('0x8a')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db[_0xbe1b('0x11f')][_0xbe1b('0x10e')](db[_0xbe1b('0x185')],{'as':_0xbe1b('0x151'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x189')});db[_0xbe1b('0x11f')][_0xbe1b('0x143')](db['ChatWebsite'],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x16c')});db[_0xbe1b('0x11f')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x11f')]['belongsTo'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x11f')]['belongsToMany'](db['Tag'],{'through':'chat_interaction_has_tags','as':_0xbe1b('0x168')});db['ChatInteraction'][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':_0xbe1b('0x18a'),'as':'ThroughTags'});db['ChatInteraction'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x16a'),'through':_0xbe1b('0x121'),'foreignKey':_0xbe1b('0x189')});db[_0xbe1b('0x185')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x11')});db['ChatMessage']['belongsTo'](db[_0xbe1b('0x157')],{'onDelete':_0xbe1b('0x10b'),'as':'Contact','foreignKey':_0xbe1b('0x159')});db['ChatMessage'][_0xbe1b('0x143')](db[_0xbe1b('0x11f')],{'onDelete':'cascade','as':_0xbe1b('0x175'),'foreignKey':'ChatInteractionId'});db[_0xbe1b('0x185')][_0xbe1b('0x143')](db[_0xbe1b('0xe9')],{'as':'Attachment','foreignKey':_0xbe1b('0x176')});db[_0xbe1b('0x185')]['belongsTo'](db[_0xbe1b('0x62')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x16c')});db[_0xbe1b('0x68')]['hasMany'](db[_0xbe1b('0xe9')],{'as':_0xbe1b('0x16b'),'foreignKey':_0xbe1b('0x16d'),'onDelete':_0xbe1b('0x10b'),'hooks':!![]});db[_0xbe1b('0x68')]['belongsTo'](db[_0xbe1b('0x157')],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x68')][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{'as':_0xbe1b('0x165'),'foreignKey':'ChatWebsiteId'});db[_0xbe1b('0x127')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x2f'),'hooks':!![]});db['ChatQueue'][_0xbe1b('0x119')](db[_0xbe1b('0xe4')],{'through':_0xbe1b('0x18b'),'as':_0xbe1b('0x14d')});db[_0xbe1b('0x11a')][_0xbe1b('0x10e')](db[_0xbe1b('0x18c')],{'as':_0xbe1b('0x151'),'foreignKey':'ChatGroupId','onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x11a')]['belongsToMany'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x13d'),'through':_0xbe1b('0x11b')});db[_0xbe1b('0x6a')][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{'as':_0xbe1b('0x188'),'foreignKey':'ChatWebsiteId'});db[_0xbe1b('0x6b')][_0xbe1b('0x10e')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x11c'),'foreignKey':_0xbe1b('0x18d')});db[_0xbe1b('0x157')]['hasMany'](db[_0xbe1b('0x8e')],{'as':_0xbe1b('0x18e'),'foreignKey':'CmContactId'});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x6e')],{'as':'Hoppers','foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x71')],{'as':'HopperFinals','foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x73')],{'as':_0xbe1b('0x140'),'foreignKey':'ContactId'});db[_0xbe1b('0x157')]['hasMany'](db[_0xbe1b('0x75')],{'as':'ReportAgentPreview','foreignKey':_0xbe1b('0x159')});db['CmContact']['hasMany'](db[_0xbe1b('0xd4')],{'as':_0xbe1b('0x142'),'foreignKey':'ContactId'});db[_0xbe1b('0x157')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xbe1b('0x111'),'foreignKey':_0xbe1b('0x159'),'onDelete':'restrict'});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x11f')],{'as':_0xbe1b('0x120'),'foreignKey':'ContactId','onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x179')],{'as':_0xbe1b('0x112'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xbe1b('0x157')][_0xbe1b('0x10e')](db[_0xbe1b('0x4d')],{'as':_0xbe1b('0x113'),'foreignKey':_0xbe1b('0x159'),'onDelete':_0xbe1b('0x15c')});db['CmContact'][_0xbe1b('0x10e')](db[_0xbe1b('0x40')],{'as':_0xbe1b('0x114'),'foreignKey':_0xbe1b('0x159'),'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x157')][_0xbe1b('0x143')](db[_0xbe1b('0x6b')],{'as':_0xbe1b('0x18f'),'foreignKey':_0xbe1b('0x18d')});db[_0xbe1b('0x157')]['belongsTo'](db['CmList'],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161'),'onDelete':'cascade'});db[_0xbe1b('0x157')][_0xbe1b('0x119')](db['User'],{'as':_0xbe1b('0x16a'),'through':_0xbe1b('0x11d')});db[_0xbe1b('0x157')][_0xbe1b('0x119')](db['Tag'],{'as':_0xbe1b('0x168'),'through':_0xbe1b('0x190')});db[_0xbe1b('0x157')][_0xbe1b('0x119')](db['Tag'],{'through':_0xbe1b('0x190'),'as':'ThroughTags'});db[_0xbe1b('0x6e')][_0xbe1b('0x10e')](db[_0xbe1b('0x8f')],{'as':_0xbe1b('0x191'),'foreignKey':_0xbe1b('0x192')});db['CmHopper'][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x6e')]['belongsTo'](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x6e')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':'Agent','foreignKey':'UserId'});db[_0xbe1b('0x6e')][_0xbe1b('0x143')](db[_0xbe1b('0x1b')],{'as':_0xbe1b('0x186'),'foreignKey':_0xbe1b('0x13f'),'onDelete':'cascade'});db['CmHopper'][_0xbe1b('0x143')](db[_0xbe1b('0xe7')],{'as':'Campaign','foreignKey':_0xbe1b('0x193'),'onDelete':_0xbe1b('0x10b')});db['CmHopper'][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x194')});db[_0xbe1b('0x70')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':'Contact','foreignKey':_0xbe1b('0x159'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x70')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':'ListId','onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x70')][_0xbe1b('0x143')](db[_0xbe1b('0x1b')],{'as':_0xbe1b('0x186'),'foreignKey':_0xbe1b('0x13f'),'onDelete':_0xbe1b('0x10b')});db['CmHopperBlack'][_0xbe1b('0x143')](db['Campaign'],{'as':_0xbe1b('0xe7'),'foreignKey':_0xbe1b('0x193'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x195')][_0xbe1b('0x10e')](db[_0xbe1b('0x196')],{'as':{'plural':_0xbe1b('0x197'),'singular':_0xbe1b('0x198')},'foreignKey':_0xbe1b('0x199'),'onDelete':_0xbe1b('0x10b'),'hooks':!![]});db[_0xbe1b('0x195')][_0xbe1b('0x10e')](db['Condition'],{'as':{'plural':_0xbe1b('0x19a'),'singular':_0xbe1b('0x19b')},'foreignKey':'AutomationAnyId','onDelete':_0xbe1b('0x10b'),'hooks':!![]});db['Automation']['hasMany'](db['Action'],{'as':_0xbe1b('0x19c'),'foreignKey':_0xbe1b('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0xbe1b('0x7d')][_0xbe1b('0x10e')](db[_0xbe1b('0x7d')],{'as':_0xbe1b('0x171'),'foreignKey':_0xbe1b('0x19e'),'onDelete':'cascade'});db[_0xbe1b('0x80')][_0xbe1b('0x10e')](db[_0xbe1b('0x80')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xbe1b('0x10b'),'hooks':!![],'required':![]});db['Interval'][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'as':_0xbe1b('0x19f'),'foreignKey':_0xbe1b('0x148'),'onDelete':'restrict'});db[_0xbe1b('0x80')][_0xbe1b('0x10e')](db[_0xbe1b('0x43')],{'as':'MailApplications','foreignKey':_0xbe1b('0x148')});db['Interval'][_0xbe1b('0x10e')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xbe1b('0x80')][_0xbe1b('0x10e')](db['FaxApplication'],{'as':_0xbe1b('0x1a0'),'foreignKey':'IntervalId'});db[_0xbe1b('0x80')]['hasMany'](db[_0xbe1b('0x55')],{'as':'SmsApplications','foreignKey':_0xbe1b('0x148')});db[_0xbe1b('0x1a1')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{});db[_0xbe1b('0x1a1')]['belongsTo'](db[_0xbe1b('0x98')],{'foreignKey':'DefaultReportId'});db['Schedule']['belongsTo'](db[_0xbe1b('0x1a2')],{'foreignKey':'CustomReportId'});db[_0xbe1b('0x88')]['belongsToMany'](db[_0xbe1b('0x1a')],{'as':_0xbe1b('0x1a3'),'through':_0xbe1b('0x13c'),'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x8a')][_0xbe1b('0x119')](db[_0xbe1b('0x157')],{'through':_0xbe1b('0x190')});db[_0xbe1b('0x8a')]['belongsToMany'](db['ChatInteraction'],{'through':_0xbe1b('0x18a')});db['Tag'][_0xbe1b('0x119')](db[_0xbe1b('0x40')],{'through':'mail_interaction_has_tags'});db[_0xbe1b('0x8a')][_0xbe1b('0x119')](db[_0xbe1b('0x179')],{'through':'sms_interaction_has_tags'});db[_0xbe1b('0x8a')]['belongsToMany'](db[_0xbe1b('0x4d')],{'through':_0xbe1b('0x174')});db[_0xbe1b('0x8a')][_0xbe1b('0x119')](db[_0xbe1b('0x5d')],{'through':_0xbe1b('0x180')});db['Tag'][_0xbe1b('0x119')](db[_0xbe1b('0x115')],{'through':_0xbe1b('0x1a4')});db[_0xbe1b('0x8e')][_0xbe1b('0x143')](db[_0xbe1b('0x8c')],{'as':'ItemType','foreignKey':_0xbe1b('0x1a5')});db[_0xbe1b('0x8f')][_0xbe1b('0x143')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xbe1b('0x192')});db[_0xbe1b('0x8e')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x1a6')});db[_0xbe1b('0x1a7')]['hasMany'](db[_0xbe1b('0x196')],{'as':{'plural':_0xbe1b('0x1a8'),'singular':_0xbe1b('0x1a9')},'foreignKey':_0xbe1b('0x1aa'),'onDelete':'cascade','hooks':!![]});db[_0xbe1b('0x1a7')][_0xbe1b('0x10e')](db['Condition'],{'as':{'plural':_0xbe1b('0x1ab'),'singular':_0xbe1b('0x1ac')},'foreignKey':_0xbe1b('0x1ad'),'onDelete':'cascade','hooks':!![]});db[_0xbe1b('0x1a7')]['hasMany'](db[_0xbe1b('0x78')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xbe1b('0x10b'),'hooks':!![]});db[_0xbe1b('0x1a2')][_0xbe1b('0x10e')](db[_0xbe1b('0x9c')],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1af'),'hooks':!![]});db[_0xbe1b('0x98')]['hasMany'](db[_0xbe1b('0x9c')],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b0')});db['AnalyticMetric'][_0xbe1b('0x10e')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b1')});db[_0xbe1b('0x9c')][_0xbe1b('0x143')](db[_0xbe1b('0x9b')],{'foreignKey':_0xbe1b('0x1b1')});db['SalesforceAccount'][_0xbe1b('0x10e')](db['SalesforceConfiguration'],{'as':_0xbe1b('0x1b2'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'AccountId'});db['SalesforceConfiguration']['hasMany'](db[_0xbe1b('0x1b3')],{'as':_0xbe1b('0x1b4'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xa1')]['hasMany'](db[_0xbe1b('0x1b3')],{'as':'Descriptions','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xa1')][_0xbe1b('0x10e')](db['SalesforceField'],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xa1')][_0xbe1b('0x143')](db[_0xbe1b('0x1b8')],{'as':'Account','foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0x1b3')]['hasMany'](db[_0xbe1b('0x1b3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xbe1b('0x1b3')][_0xbe1b('0x10e')](db[_0xbe1b('0x1b3')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0x1b3')]['hasMany'](db[_0xbe1b('0x1b3')],{'as':_0xbe1b('0x1bb'),'foreignKey':'FieldId'});db[_0xbe1b('0x1b3')][_0xbe1b('0x143')](db['Variable'],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db[_0xbe1b('0x1bd')][_0xbe1b('0x10e')](db[_0xbe1b('0xa4')],{'as':_0xbe1b('0x1b2'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b9')});db['SugarcrmConfiguration'][_0xbe1b('0x10e')](db['SugarcrmField'],{'as':_0xbe1b('0x1b4'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xa4')]['hasMany'](db[_0xbe1b('0xa6')],{'as':_0xbe1b('0x1be'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xa4')][_0xbe1b('0x10e')](db[_0xbe1b('0xa6')],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xa4')][_0xbe1b('0x143')](db[_0xbe1b('0x1bd')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xa6')][_0xbe1b('0x10e')](db[_0xbe1b('0xa6')],{'as':_0xbe1b('0x1bf'),'foreignKey':'SubjectId'});db[_0xbe1b('0xa6')][_0xbe1b('0x10e')](db[_0xbe1b('0xa6')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xbe1b('0x10e')](db['SugarcrmField'],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db['SugarcrmField']['belongsTo'](db[_0xbe1b('0x92')],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db[_0xbe1b('0xa8')][_0xbe1b('0x10e')](db[_0xbe1b('0x1c0')],{'as':_0xbe1b('0x1b2'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b9')});db['DeskConfiguration'][_0xbe1b('0x10e')](db[_0xbe1b('0xab')],{'as':_0xbe1b('0x1b4'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0x1c0')][_0xbe1b('0x10e')](db[_0xbe1b('0xab')],{'as':_0xbe1b('0x1be'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'DescriptionId'});db[_0xbe1b('0x1c0')][_0xbe1b('0x10e')](db['DeskField'],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'FieldId'});db[_0xbe1b('0x1c0')][_0xbe1b('0x143')](db[_0xbe1b('0xa8')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db['DeskConfiguration'][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':_0xbe1b('0x1c1')});db[_0xbe1b('0xab')][_0xbe1b('0x10e')](db[_0xbe1b('0xab')],{'as':_0xbe1b('0x1bf'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xab')][_0xbe1b('0x10e')](db[_0xbe1b('0xab')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db['DeskField'][_0xbe1b('0x10e')](db[_0xbe1b('0xab')],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xab')][_0xbe1b('0x143')](db['Variable'],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0xbe1b('0x1b2'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'AccountId'});db[_0xbe1b('0xae')]['hasMany'](db[_0xbe1b('0xb0')],{'as':_0xbe1b('0x1b4'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xae')][_0xbe1b('0x10e')](db[_0xbe1b('0xb0')],{'as':_0xbe1b('0x1be'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xbe1b('0xae')][_0xbe1b('0x10e')](db['ZohoField'],{'as':'Fields','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xae')][_0xbe1b('0x143')](db[_0xbe1b('0xad')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xb0')][_0xbe1b('0x10e')](db[_0xbe1b('0xb0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xbe1b('0xb0')][_0xbe1b('0x10e')](db[_0xbe1b('0xb0')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xb0')][_0xbe1b('0x10e')](db['ZohoField'],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xb0')][_0xbe1b('0x143')](db[_0xbe1b('0x92')],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db[_0xbe1b('0x1c2')][_0xbe1b('0x10e')](db[_0xbe1b('0xb3')],{'as':'Configurations','onDelete':_0xbe1b('0x10b'),'foreignKey':'AccountId'});db[_0xbe1b('0xb3')][_0xbe1b('0x10e')](db[_0xbe1b('0x1c3')],{'as':_0xbe1b('0x1b4'),'foreignKey':_0xbe1b('0x1b5')});db['ZendeskConfiguration'][_0xbe1b('0x10e')](db[_0xbe1b('0x1c3')],{'as':_0xbe1b('0x1be'),'foreignKey':'DescriptionId'});db[_0xbe1b('0xb3')][_0xbe1b('0x10e')](db['ZendeskField'],{'as':_0xbe1b('0x1ae'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xb3')][_0xbe1b('0x143')](db['ZendeskAccount'],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db['ZendeskConfiguration'][_0xbe1b('0x119')](db['Tag'],{'through':_0xbe1b('0x1c4')});db['ZendeskField'][_0xbe1b('0x10e')](db[_0xbe1b('0x1c3')],{'as':'Subject','foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0x1c3')]['hasMany'](db[_0xbe1b('0x1c3')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0x1c3')][_0xbe1b('0x10e')](db[_0xbe1b('0x1c3')],{'as':'Field','foreignKey':_0xbe1b('0x1b7')});db['ZendeskField'][_0xbe1b('0x143')](db[_0xbe1b('0x92')],{'as':_0xbe1b('0x92'),'foreignKey':'VariableId'});db[_0xbe1b('0xb5')]['hasMany'](db[_0xbe1b('0xb6')],{'as':'Configurations','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xb6')]['hasMany'](db[_0xbe1b('0xb8')],{'as':_0xbe1b('0x1b4'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xb6')][_0xbe1b('0x10e')](db['FreshdeskField'],{'as':_0xbe1b('0x1be'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xb6')][_0xbe1b('0x10e')](db[_0xbe1b('0xb8')],{'as':_0xbe1b('0x1ae'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xb6')][_0xbe1b('0x143')](db[_0xbe1b('0xb5')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xb6')][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xbe1b('0xb8')]['hasMany'](db[_0xbe1b('0xb8')],{'as':'Subject','foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xb8')][_0xbe1b('0x10e')](db[_0xbe1b('0xb8')],{'as':_0xbe1b('0x1ba'),'foreignKey':'DescriptionId'});db[_0xbe1b('0xb8')][_0xbe1b('0x10e')](db[_0xbe1b('0xb8')],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xb8')][_0xbe1b('0x143')](db[_0xbe1b('0x92')],{'as':_0xbe1b('0x92'),'foreignKey':'VariableId'});db[_0xbe1b('0xb9')][_0xbe1b('0x10e')](db['VtigerConfiguration'],{'as':_0xbe1b('0x1b2'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b9')});db['VtigerConfiguration']['hasMany'](db[_0xbe1b('0xbd')],{'as':_0xbe1b('0x1b4'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xbb')]['hasMany'](db[_0xbe1b('0xbd')],{'as':_0xbe1b('0x1be'),'foreignKey':_0xbe1b('0x1b6')});db['VtigerConfiguration']['hasMany'](db[_0xbe1b('0xbd')],{'as':_0xbe1b('0x1ae'),'foreignKey':_0xbe1b('0x1b7')});db['VtigerConfiguration'][_0xbe1b('0x143')](db[_0xbe1b('0xb9')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xbd')][_0xbe1b('0x10e')](db[_0xbe1b('0xbd')],{'as':'Subject','foreignKey':_0xbe1b('0x1b5')});db['VtigerField'][_0xbe1b('0x10e')](db[_0xbe1b('0xbd')],{'as':'Description','foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xbd')][_0xbe1b('0x10e')](db[_0xbe1b('0xbd')],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xbd')]['belongsTo'](db[_0xbe1b('0x92')],{'as':'Variable','foreignKey':'VariableId'});db[_0xbe1b('0xbf')]['hasMany'](db[_0xbe1b('0xc0')],{'as':_0xbe1b('0x1b2'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xc0')]['hasMany'](db[_0xbe1b('0xc2')],{'as':_0xbe1b('0x1b4'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xbe1b('0x10e')](db[_0xbe1b('0xc2')],{'as':_0xbe1b('0x1be'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xc0')][_0xbe1b('0x10e')](db[_0xbe1b('0xc2')],{'as':_0xbe1b('0x1ae'),'foreignKey':'FieldId'});db[_0xbe1b('0xc0')][_0xbe1b('0x143')](db[_0xbe1b('0xbf')],{'as':_0xbe1b('0x165'),'foreignKey':'AccountId'});db[_0xbe1b('0xc2')][_0xbe1b('0x10e')](db[_0xbe1b('0xc2')],{'as':'Subject','foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xc2')][_0xbe1b('0x10e')](db[_0xbe1b('0xc2')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xc2')][_0xbe1b('0x10e')](db[_0xbe1b('0xc2')],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db[_0xbe1b('0xc3')][_0xbe1b('0x10e')](db[_0xbe1b('0xc5')],{'as':_0xbe1b('0x1b2'),'onDelete':'cascade','foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xc3')][_0xbe1b('0x143')](db[_0xbe1b('0x15b')],{'as':_0xbe1b('0x15b'),'foreignKey':_0xbe1b('0x1c5')});db['Dynamics365Configuration']['hasMany'](db[_0xbe1b('0xc7')],{'as':'Subjects','onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xc5')][_0xbe1b('0x10e')](db[_0xbe1b('0xc7')],{'as':_0xbe1b('0x1be'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b6')});db[_0xbe1b('0xc5')][_0xbe1b('0x10e')](db[_0xbe1b('0xc7')],{'as':_0xbe1b('0x1ae'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xc5')][_0xbe1b('0x143')](db[_0xbe1b('0xc3')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xc7')][_0xbe1b('0x10e')](db[_0xbe1b('0xc7')],{'as':_0xbe1b('0x1bf'),'foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xc7')]['hasMany'](db[_0xbe1b('0xc7')],{'as':_0xbe1b('0x1ba'),'foreignKey':_0xbe1b('0x1b6')});db['Dynamics365Field'][_0xbe1b('0x10e')](db['Dynamics365Field'],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db[_0xbe1b('0xc7')][_0xbe1b('0x143')](db[_0xbe1b('0x92')],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db[_0xbe1b('0x1c6')][_0xbe1b('0x10e')](db[_0xbe1b('0xca')],{'as':_0xbe1b('0x1b2'),'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xca')][_0xbe1b('0x10e')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0xbe1b('0x1b5')});db['FreshsalesConfiguration'][_0xbe1b('0x10e')](db[_0xbe1b('0xcb')],{'as':_0xbe1b('0x1be'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0xbe1b('0xcb')],{'as':'Fields','foreignKey':_0xbe1b('0x1b7')});db['FreshsalesConfiguration'][_0xbe1b('0x143')](db[_0xbe1b('0x1c6')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1b9')});db[_0xbe1b('0xcb')][_0xbe1b('0x10e')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xbe1b('0x1b5')});db[_0xbe1b('0xcb')][_0xbe1b('0x10e')](db[_0xbe1b('0xcb')],{'as':'Description','foreignKey':_0xbe1b('0x1b6')});db['FreshsalesField'][_0xbe1b('0x10e')](db[_0xbe1b('0xcb')],{'as':_0xbe1b('0x1bb'),'foreignKey':_0xbe1b('0x1b7')});db['FreshsalesField'][_0xbe1b('0x143')](db['Variable'],{'as':_0xbe1b('0x92'),'foreignKey':_0xbe1b('0x1bc')});db['ChatQueueReport'][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{});db['ChatQueueReport']['belongsTo'](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db['ChatQueueReport'][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0xcd')][_0xbe1b('0x143')](db['ChatInteraction'],{});db[_0xbe1b('0xcd')][_0xbe1b('0x143')](db[_0xbe1b('0x185')],{});db[_0xbe1b('0xcd')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{});db['ChatQueueReport'][_0xbe1b('0x143')](db['ChatQueue'],{});db[_0xbe1b('0x18c')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x10b'),'foreignKey':_0xbe1b('0x1c7')});db[_0xbe1b('0x18c')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'onDelete':'cascade','foreignKey':_0xbe1b('0x1c8')});db['JscriptySessionReport']['hasMany'](db[_0xbe1b('0xd2')],{'foreignKey':'SessionId','onDelete':'cascade'});db['JscriptySessionReport'][_0xbe1b('0x10e')](db[_0xbe1b('0xd0')],{'foreignKey':'SessionId','onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0xd5')][_0xbe1b('0x143')](db[_0xbe1b('0x54')],{});db['SmsQueueReport'][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':'List','foreignKey':'ListId'});db[_0xbe1b('0xd5')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0xd5')]['belongsTo'](db['SmsInteraction'],{});db[_0xbe1b('0xd5')][_0xbe1b('0x143')](db['SmsMessage'],{});db[_0xbe1b('0xd5')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{});db[_0xbe1b('0xd5')]['belongsTo'](db['SmsQueue'],{});db[_0xbe1b('0xda')][_0xbe1b('0x10e')](db[_0xbe1b('0xd4')],{'foreignKey':_0xbe1b('0x1c9')});db[_0xbe1b('0xda')][_0xbe1b('0x10e')](db[_0xbe1b('0xd2')],{'foreignKey':_0xbe1b('0x1c9')});db[_0xbe1b('0xda')]['hasMany'](db[_0xbe1b('0xd0')],{'foreignKey':_0xbe1b('0x1c9')});db[_0xbe1b('0xdf')][_0xbe1b('0x119')](db['User'],{'as':'Users','through':_0xbe1b('0x137')});db['Team']['belongsToMany'](db['User'],{'as':'Agents','through':_0xbe1b('0x1ca')});db['Team'][_0xbe1b('0x119')](db[_0xbe1b('0x1b')],{'through':_0xbe1b('0x103'),'as':_0xbe1b('0x1cb')});db['Team'][_0xbe1b('0x119')](db[_0xbe1b('0x3e')],{'through':_0xbe1b('0x1cc'),'as':'MailQueues'});db[_0xbe1b('0xe4')][_0xbe1b('0x119')](db[_0xbe1b('0x127')],{'through':_0xbe1b('0x18b'),'as':'ChatQueues'});db[_0xbe1b('0xe4')][_0xbe1b('0x119')](db['FaxQueue'],{'through':_0xbe1b('0x177'),'as':_0xbe1b('0x129')});db['Team'][_0xbe1b('0x119')](db[_0xbe1b('0x58')],{'through':'team_has_sms_queues','as':_0xbe1b('0x12a')});db['Team']['belongsToMany'](db[_0xbe1b('0x61')],{'through':_0xbe1b('0x182'),'as':'OpenchannelQueues'});db[_0xbe1b('0xe4')][_0xbe1b('0x119')](db[_0xbe1b('0x12d')],{'through':_0xbe1b('0x1cd'),'as':'WhatsappQueues'});db['Team'][_0xbe1b('0x119')](db[_0xbe1b('0xf4')],{'through':_0xbe1b('0x105'),'as':_0xbe1b('0x1ce')});db[_0xbe1b('0xe7')][_0xbe1b('0x10e')](db[_0xbe1b('0x6e')],{'as':_0xbe1b('0x13e'),'foreignKey':'CampaignId'});db[_0xbe1b('0xe7')]['hasMany'](db[_0xbe1b('0x71')],{'as':_0xbe1b('0x1cf'),'foreignKey':_0xbe1b('0x193')});db[_0xbe1b('0xe7')][_0xbe1b('0x10e')](db['CmHopperHistory'],{'as':_0xbe1b('0x140'),'foreignKey':_0xbe1b('0x193')});db[_0xbe1b('0xe7')][_0xbe1b('0x10e')](db['CmHopperBlack'],{'as':_0xbe1b('0x141'),'foreignKey':_0xbe1b('0x193')});db[_0xbe1b('0xe7')][_0xbe1b('0x143')](db[_0xbe1b('0x144')],{'as':_0xbe1b('0x144'),'foreignKey':_0xbe1b('0x145')});db['Campaign']['belongsTo'](db[_0xbe1b('0x144')],{'as':'TrunkBackup','foreignKey':_0xbe1b('0x147')});db[_0xbe1b('0xe7')][_0xbe1b('0x143')](db[_0xbe1b('0x80')],{'as':_0xbe1b('0x80'),'foreignKey':_0xbe1b('0x148')});db[_0xbe1b('0xe7')][_0xbe1b('0x143')](db[_0xbe1b('0xdf')],{'as':_0xbe1b('0xdf'),'foreignKey':_0xbe1b('0x1d0')});db['Campaign'][_0xbe1b('0x119')](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x14b'),'through':_0xbe1b('0x1d1')});db[_0xbe1b('0xe7')][_0xbe1b('0x119')](db[_0xbe1b('0x12f')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0xbe1b('0xe9')][_0xbe1b('0x143')](db[_0xbe1b('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0xbe1b('0x16d')});db[_0xbe1b('0xeb')][_0xbe1b('0x143')](db[_0xbe1b('0x42')],{});db['MailTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x40')],{});db[_0xbe1b('0xeb')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'foreignKey':'FromMailAccountId','as':_0xbe1b('0x1d2')});db[_0xbe1b('0xeb')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'foreignKey':_0xbe1b('0x1d3'),'as':_0xbe1b('0x1d4')});db[_0xbe1b('0xeb')][_0xbe1b('0x143')](db['User'],{'foreignKey':_0xbe1b('0x1d5'),'as':'ToAgent'});db['MailTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x3e')],{'foreignKey':_0xbe1b('0x1d6'),'as':'ToQueue'});db[_0xbe1b('0xeb')][_0xbe1b('0x143')](db[_0xbe1b('0x3c')],{'foreignKey':'ToMailAccountId','as':_0xbe1b('0x1d7')});db['ChatTransferReport']['belongsTo'](db['ChatMessage'],{});db[_0xbe1b('0xed')][_0xbe1b('0x143')](db[_0xbe1b('0x11f')],{});db[_0xbe1b('0xed')][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{'foreignKey':'FromChatWebsiteId','as':_0xbe1b('0x1d2')});db[_0xbe1b('0xed')]['belongsTo'](db[_0xbe1b('0x11')],{'foreignKey':'FromUserId','as':_0xbe1b('0x1d4')});db[_0xbe1b('0xed')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xbe1b('0xed')][_0xbe1b('0x143')](db[_0xbe1b('0x127')],{'foreignKey':_0xbe1b('0x1d8'),'as':_0xbe1b('0x1d9')});db[_0xbe1b('0xed')][_0xbe1b('0x143')](db[_0xbe1b('0x62')],{'foreignKey':_0xbe1b('0x1da'),'as':_0xbe1b('0x1d7')});db['FaxTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x4f')],{});db['FaxTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x4d')],{});db['FaxTransferReport'][_0xbe1b('0x143')](db['FaxAccount'],{'foreignKey':_0xbe1b('0x1db'),'as':_0xbe1b('0x1d2')});db[_0xbe1b('0x1dc')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'foreignKey':_0xbe1b('0x1d3'),'as':_0xbe1b('0x1d4')});db['FaxTransferReport']['belongsTo'](db[_0xbe1b('0x11')],{'foreignKey':_0xbe1b('0x1d5'),'as':'ToAgent'});db[_0xbe1b('0x1dc')][_0xbe1b('0x143')](db[_0xbe1b('0x51')],{'foreignKey':_0xbe1b('0x1dd'),'as':_0xbe1b('0x1d9')});db['FaxTransferReport']['belongsTo'](db[_0xbe1b('0x4a')],{'foreignKey':_0xbe1b('0x1de'),'as':_0xbe1b('0x1d7')});db[_0xbe1b('0x1df')][_0xbe1b('0x143')](db[_0xbe1b('0x5f')],{});db[_0xbe1b('0x1df')][_0xbe1b('0x143')](db[_0xbe1b('0x5d')],{});db[_0xbe1b('0x1df')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xbe1b('0x1e0'),'as':_0xbe1b('0x1d2')});db[_0xbe1b('0x1df')][_0xbe1b('0x143')](db['User'],{'foreignKey':_0xbe1b('0x1d3'),'as':_0xbe1b('0x1d4')});db[_0xbe1b('0x1df')]['belongsTo'](db[_0xbe1b('0x11')],{'foreignKey':_0xbe1b('0x1d5'),'as':_0xbe1b('0x1e1')});db['OpenchannelTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x61')],{'foreignKey':_0xbe1b('0x1e2'),'as':_0xbe1b('0x1d9')});db['OpenchannelTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x5a')],{'foreignKey':'ToOpenchannelAccountId','as':_0xbe1b('0x1d7')});db[_0xbe1b('0xf1')][_0xbe1b('0x143')](db[_0xbe1b('0x57')],{});db['SmsTransferReport']['belongsTo'](db[_0xbe1b('0x179')],{});db[_0xbe1b('0xf1')][_0xbe1b('0x143')](db[_0xbe1b('0x54')],{'foreignKey':_0xbe1b('0x1e3'),'as':_0xbe1b('0x1d2')});db[_0xbe1b('0xf1')]['belongsTo'](db[_0xbe1b('0x11')],{'foreignKey':_0xbe1b('0x1d3'),'as':_0xbe1b('0x1d4')});db['SmsTransferReport'][_0xbe1b('0x143')](db['User'],{'foreignKey':_0xbe1b('0x1d5'),'as':_0xbe1b('0x1e1')});db[_0xbe1b('0xf1')][_0xbe1b('0x143')](db['SmsQueue'],{'foreignKey':_0xbe1b('0x1e4'),'as':_0xbe1b('0x1d9')});db[_0xbe1b('0xf1')][_0xbe1b('0x143')](db[_0xbe1b('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0xbe1b('0x7d')],{'as':_0xbe1b('0x171'),'foreignKey':'ListId','onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x12f')][_0xbe1b('0x10e')](db['CmCustomField'],{'as':_0xbe1b('0x1e5'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x12f')][_0xbe1b('0x10e')](db[_0xbe1b('0x157')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0x12f')][_0xbe1b('0x10e')](db[_0xbe1b('0x71')],{'as':_0xbe1b('0x1cf'),'foreignKey':'ListId'});db[_0xbe1b('0x12f')]['hasMany'](db['CmHopperHistory'],{'as':_0xbe1b('0x110'),'foreignKey':'ListId'});db[_0xbe1b('0x12f')][_0xbe1b('0x10e')](db[_0xbe1b('0x75')],{'as':_0xbe1b('0x75'),'foreignKey':_0xbe1b('0x161')});db['CmList'][_0xbe1b('0x119')](db[_0xbe1b('0x1b')],{'as':_0xbe1b('0x1e6'),'through':_0xbe1b('0x1e7')});db['CmList']['belongsToMany'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x11e')});db[_0xbe1b('0xf4')][_0xbe1b('0x10e')](db[_0xbe1b('0x18')],{'as':_0xbe1b('0x19f'),'onDelete':'cascade'});db[_0xbe1b('0xf4')][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x107')});db[_0xbe1b('0xf4')][_0xbe1b('0x119')](db[_0xbe1b('0xe4')],{'through':_0xbe1b('0x105'),'as':_0xbe1b('0x14d')});db[_0xbe1b('0xf6')][_0xbe1b('0x10e')](db['User'],{'as':'Users','foreignKey':_0xbe1b('0x1e8')});db[_0xbe1b('0xf6')]['hasMany'](db['UserProfileSection'],{'as':_0xbe1b('0x1e9'),'foreignKey':'userProfileId','onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0xf8')][_0xbe1b('0x10e')](db['UserProfileResource'],{'as':_0xbe1b('0x1ea'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0xbe1b('0x1eb')][_0xbe1b('0x10e')](db[_0xbe1b('0x7d')],{'as':_0xbe1b('0x171'),'foreignKey':_0xbe1b('0x1ec'),'onDelete':_0xbe1b('0x10b')});db[_0xbe1b('0x1eb')][_0xbe1b('0x10e')](db[_0xbe1b('0x7b')],{'as':'Answers','foreignKey':_0xbe1b('0x1ec')});db[_0xbe1b('0x1eb')]['hasMany'](db[_0xbe1b('0xfd')],{'as':_0xbe1b('0x151'),'foreignKey':'WhatsappAccountId'});db[_0xbe1b('0x1eb')]['hasMany'](db[_0xbe1b('0x115')],{'as':_0xbe1b('0x15f')});db[_0xbe1b('0x1eb')][_0xbe1b('0x10e')](db['WhatsappApplication'],{'as':_0xbe1b('0x13a')});db[_0xbe1b('0x1eb')][_0xbe1b('0x143')](db[_0xbe1b('0x12f')],{'as':'List','foreignKey':'ListId'});db[_0xbe1b('0x1eb')]['belongsTo'](db[_0xbe1b('0x81')],{'as':_0xbe1b('0x149'),'foreignKey':_0xbe1b('0x14a')});db['WhatsappAccount'][_0xbe1b('0x119')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x136')});db[_0xbe1b('0x1ed')]['belongsTo'](db[_0xbe1b('0x11')],{'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x1ed')][_0xbe1b('0x143')](db[_0xbe1b('0x12d')],{'onDelete':'restrict'});db['WhatsappApplication'][_0xbe1b('0x143')](db['WhatsappAccount'],{'onDelete':_0xbe1b('0x15c')});db['WhatsappApplication'][_0xbe1b('0x143')](db[_0xbe1b('0x80')],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x148')});db[_0xbe1b('0x1ed')][_0xbe1b('0x143')](db['Tag'],{'onDelete':_0xbe1b('0x15c'),'foreignKey':_0xbe1b('0x16e')});db['WhatsappInteraction'][_0xbe1b('0x10e')](db[_0xbe1b('0xfd')],{'as':_0xbe1b('0x151'),'onDelete':_0xbe1b('0x10b'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0xbe1b('0x1eb')],{'as':_0xbe1b('0x165'),'foreignKey':'WhatsappAccountId'});db[_0xbe1b('0x115')]['belongsTo'](db[_0xbe1b('0x157')],{'as':'Contact','foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0x115')]['belongsTo'](db['User'],{'as':_0xbe1b('0x166'),'foreignKey':_0xbe1b('0x10d')});db[_0xbe1b('0x115')][_0xbe1b('0x119')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xbe1b('0x168')});db['WhatsappInteraction'][_0xbe1b('0x119')](db[_0xbe1b('0x8a')],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':_0xbe1b('0x16a'),'through':_0xbe1b('0x125'),'foreignKey':_0xbe1b('0x1ee')});db[_0xbe1b('0xfd')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x11')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xbe1b('0x10b'),'as':_0xbe1b('0x158')});db['WhatsappMessage']['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xbe1b('0x175'),'foreignKey':'WhatsappInteractionId'});db[_0xbe1b('0xfd')]['belongsTo'](db[_0xbe1b('0x1eb')],{'as':_0xbe1b('0x165'),'foreignKey':_0xbe1b('0x1ec')});db[_0xbe1b('0xff')][_0xbe1b('0x143')](db[_0xbe1b('0x1eb')],{});db[_0xbe1b('0xff')]['belongsTo'](db[_0xbe1b('0x12f')],{'as':_0xbe1b('0x160'),'foreignKey':_0xbe1b('0x161')});db[_0xbe1b('0xff')][_0xbe1b('0x143')](db[_0xbe1b('0x157')],{'as':_0xbe1b('0x158'),'foreignKey':_0xbe1b('0x159')});db[_0xbe1b('0xff')]['belongsTo'](db[_0xbe1b('0x115')],{});db[_0xbe1b('0xff')][_0xbe1b('0x143')](db['WhatsappQueue'],{});db[_0xbe1b('0xff')][_0xbe1b('0x143')](db['WhatsappMessage'],{});db[_0xbe1b('0xff')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{});db[_0xbe1b('0x101')][_0xbe1b('0x143')](db[_0xbe1b('0xfd')],{});db[_0xbe1b('0x101')][_0xbe1b('0x143')](db[_0xbe1b('0x115')],{});db[_0xbe1b('0x101')][_0xbe1b('0x143')](db[_0xbe1b('0x1eb')],{'foreignKey':_0xbe1b('0x1ef'),'as':_0xbe1b('0x1d2')});db['WhatsappTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x1eb')],{'foreignKey':_0xbe1b('0x1f0'),'as':_0xbe1b('0x1d7')});db['WhatsappTransferReport'][_0xbe1b('0x143')](db[_0xbe1b('0x12d')],{'foreignKey':'ToQueueId','as':_0xbe1b('0x1d9')});db[_0xbe1b('0x101')][_0xbe1b('0x143')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xbe1b('0x101')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xbe1b('0x12d')]['belongsToMany'](db[_0xbe1b('0x11')],{'as':_0xbe1b('0x14c'),'through':_0xbe1b('0x37'),'foreignKey':_0xbe1b('0x1f1')});db[_0xbe1b('0x12d')][_0xbe1b('0x119')](db['Team'],{'through':_0xbe1b('0x1cd'),'as':'Teams'});db[_0xbe1b('0x10c')][_0xbe1b('0x143')](db[_0xbe1b('0x11')],{'as':'user','foreignKey':_0xbe1b('0x10d'),'onDelete':'cascade','hooks':!![]});db[_0xbe1b('0x15b')][_0xbe1b('0x10a')](db['Dynamics365Account'],{'as':_0xbe1b('0xc3'),'onDelete':_0xbe1b('0x15c')});db[_0xbe1b('0x15b')][_0xbe1b('0x10a')](db[_0xbe1b('0x38')],{'as':_0xbe1b('0x15d'),'onDelete':'restrict'});db[_0xbe1b('0x15b')][_0xbe1b('0x10a')](db['MailServerOut'],{'as':_0xbe1b('0x1f2'),'onDelete':'restrict'});module[_0xbe1b('0x1f3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6f27dfb..5e9e74b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f16=['./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/logs','/apidoc','static','join','/www','root','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/substatuses','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/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/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages'];(function(_0x4c0cc0,_0x257d38){var _0x438742=function(_0x2124d0){while(--_0x2124d0){_0x4c0cc0['push'](_0x4c0cc0['shift']());}};_0x438742(++_0x257d38);}(_0x2f16,0x178));var _0x62f1=function(_0x2cdfc1,_0x57fd27){_0x2cdfc1=_0x2cdfc1-0x0;var _0x1998d1=_0x2f16[_0x2cdfc1];return _0x1998d1;};'use strict';var path=require(_0x62f1('0x0'));var express=require(_0x62f1('0x1'));var errors=require(_0x62f1('0x2'));var config=require(_0x62f1('0x3'));var setupLoggers=require(_0x62f1('0x4'))[_0x62f1('0x5')];var clientSideLogs=require(_0x62f1('0x6'));exports[_0x62f1('0x7')]=function(_0x44edcb){return setupLoggers(_0x44edcb)[_0x62f1('0x8')](function(){_0x44edcb['use']('/api/users',require('./api/user'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xa'),require(_0x62f1('0xb')));_0x44edcb[_0x62f1('0x9')]('/api/voice/contexts',require(_0x62f1('0xc')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xd'),require(_0x62f1('0xe')));_0x44edcb['use'](_0x62f1('0xf'),require(_0x62f1('0x10')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x11'),require('./api/voiceQueue'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x12'),require(_0x62f1('0x13')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x14'),require(_0x62f1('0x15')));_0x44edcb['use'](_0x62f1('0x16'),require(_0x62f1('0x17')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x18'),require(_0x62f1('0x19')));_0x44edcb[_0x62f1('0x9')]('/api/voice/calls/reports',require(_0x62f1('0x1a')));_0x44edcb['use']('/api/voice/dials/reports',require(_0x62f1('0x1b')));_0x44edcb[_0x62f1('0x9')]('/api/voice/agents/reports',require(_0x62f1('0x1c')));_0x44edcb['use'](_0x62f1('0x1d'),require(_0x62f1('0x1e')));_0x44edcb['use'](_0x62f1('0x1f'),require('./api/memberReport'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x20'),require(_0x62f1('0x21')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x22'),require(_0x62f1('0x23')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x24'),require(_0x62f1('0x25')));_0x44edcb['use'](_0x62f1('0x26'),require('./api/mailAccount'));_0x44edcb[_0x62f1('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x27'),require('./api/mailSubstatus'));_0x44edcb['use'](_0x62f1('0x28'),require('./api/mailInteraction'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x29'),require('./api/mailMessage'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x2a'),require(_0x62f1('0x2b')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x2c'),require(_0x62f1('0x2d')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x2e'),require(_0x62f1('0x2f')));_0x44edcb['use']('/api/dashboards/items',require(_0x62f1('0x30')));_0x44edcb['use'](_0x62f1('0x31'),require(_0x62f1('0x32')));_0x44edcb[_0x62f1('0x9')]('/api/fax/applications',require(_0x62f1('0x33')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x34'),require(_0x62f1('0x35')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x36'),require('./api/faxMessage'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x37'),require(_0x62f1('0x38')));_0x44edcb['use'](_0x62f1('0x39'),require('./api/faxQueueReport'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x3a'),require(_0x62f1('0x3b')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x3c'),require(_0x62f1('0x3d')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x3e'),require(_0x62f1('0x3f')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x40'),require('./api/smsMessage'));_0x44edcb[_0x62f1('0x9')]('/api/sms/queues',require(_0x62f1('0x41')));_0x44edcb[_0x62f1('0x9')]('/api/openchannel/accounts',require(_0x62f1('0x42')));_0x44edcb['use'](_0x62f1('0x43'),require('./api/openchannelApplication'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x44'),require('./api/openchannelInteraction'));_0x44edcb['use'](_0x62f1('0x45'),require(_0x62f1('0x46')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x47'),require(_0x62f1('0x48')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x49'),require(_0x62f1('0x4a')));_0x44edcb[_0x62f1('0x9')]('/api/openchannel/reports/queue',require(_0x62f1('0x4b')));_0x44edcb[_0x62f1('0x9')]('/api/chat/applications',require('./api/chatApplication'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x4c'),require(_0x62f1('0x4d')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x4e'),require('./api/chatMessage'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x4f'),require('./api/chatOfflineMessage'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x50'),require(_0x62f1('0x51')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x52'),require(_0x62f1('0x53')));_0x44edcb['use'](_0x62f1('0x54'),require(_0x62f1('0x55')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x56'),require(_0x62f1('0x57')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x58'),require('./api/cmContact'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x59'),require('./api/cmHopper'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x5a'),require(_0x62f1('0x5b')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x5c'),require(_0x62f1('0x5d')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x5e'),require(_0x62f1('0x5f')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x60'),require(_0x62f1('0x61')));_0x44edcb['use'](_0x62f1('0x62'),require(_0x62f1('0x63')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x64'),require('./api/automation'));_0x44edcb['use'](_0x62f1('0x65'),require(_0x62f1('0x66')));_0x44edcb['use'](_0x62f1('0x67'),require(_0x62f1('0x68')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x69'),require(_0x62f1('0x6a')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x6b'),require(_0x62f1('0x6c')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x6d'),require('./api/pause'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x6e'),require(_0x62f1('0x6f')));_0x44edcb[_0x62f1('0x9')]('/api/voiceQueuesLog',require(_0x62f1('0x70')));_0x44edcb[_0x62f1('0x9')]('/api/schedules',require(_0x62f1('0x71')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x72'),require(_0x62f1('0x73')));_0x44edcb[_0x62f1('0x9')]('/api/tags',require('./api/tag'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x74'),require(_0x62f1('0x75')));_0x44edcb['use'](_0x62f1('0x76'),require(_0x62f1('0x77')));_0x44edcb[_0x62f1('0x9')]('/api/cm_hopper_additional_phones',require(_0x62f1('0x78')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x79'),require(_0x62f1('0x7a')));_0x44edcb[_0x62f1('0x9')]('/api/triggers',require(_0x62f1('0x7b')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x7c'),require(_0x62f1('0x7d')));_0x44edcb['use'](_0x62f1('0x7e'),require(_0x62f1('0x7f')));_0x44edcb['use'](_0x62f1('0x80'),require('./api/integrationReport'));_0x44edcb[_0x62f1('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x81'),require(_0x62f1('0x82')));_0x44edcb[_0x62f1('0x9')]('/api/analytics/extracted_reports',require(_0x62f1('0x83')));_0x44edcb['use'](_0x62f1('0x84'),require(_0x62f1('0x85')));_0x44edcb[_0x62f1('0x9')]('/api/analytics/field_reports',require(_0x62f1('0x86')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x87'),require(_0x62f1('0x88')));_0x44edcb[_0x62f1('0x9')]('/api/integrations/salesforce/accounts',require(_0x62f1('0x89')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x8a'),require('./api/intSalesforceConfiguration'));_0x44edcb[_0x62f1('0x9')]('/api/integrations/salesforce/fields',require(_0x62f1('0x8b')));_0x44edcb['use'](_0x62f1('0x8c'),require('./api/intSugarcrmAccount'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x8d'),require('./api/intSugarcrmConfiguration'));_0x44edcb[_0x62f1('0x9')]('/api/integrations/sugarcrm/fields',require(_0x62f1('0x8e')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x8f'),require(_0x62f1('0x90')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x91'),require(_0x62f1('0x92')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x93'),require(_0x62f1('0x94')));_0x44edcb['use'](_0x62f1('0x95'),require(_0x62f1('0x96')));_0x44edcb['use'](_0x62f1('0x97'),require(_0x62f1('0x98')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x99'),require(_0x62f1('0x9a')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x9b'),require(_0x62f1('0x9c')));_0x44edcb['use']('/api/integrations/zendesk/configurations',require(_0x62f1('0x9d')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x9e'),require(_0x62f1('0x9f')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xa0'),require(_0x62f1('0xa1')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xa2'),require(_0x62f1('0xa3')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xa4'),require(_0x62f1('0xa5')));_0x44edcb['use'](_0x62f1('0xa6'),require('./api/intVtigerAccount'));_0x44edcb[_0x62f1('0x9')]('/api/integrations/vtiger/configurations',require(_0x62f1('0xa7')));_0x44edcb['use'](_0x62f1('0xa8'),require(_0x62f1('0xa9')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xaa'),require(_0x62f1('0xab')));_0x44edcb['use'](_0x62f1('0xac'),require(_0x62f1('0xad')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xae'),require(_0x62f1('0xaf')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb0'),require(_0x62f1('0xb1')));_0x44edcb[_0x62f1('0x9')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb2'),require(_0x62f1('0xb3')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb4'),require(_0x62f1('0xb5')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb6'),require('./api/intFreshsalesConfiguration'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb7'),require(_0x62f1('0xb8')));_0x44edcb[_0x62f1('0x9')]('/api/networks',require('./api/network'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xb9'),require(_0x62f1('0xba')));_0x44edcb['use'](_0x62f1('0xbb'),require(_0x62f1('0xbc')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xbd'),require(_0x62f1('0xbe')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xbf'),require(_0x62f1('0xc0')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xc1'),require(_0x62f1('0xc2')));_0x44edcb['use'](_0x62f1('0xc3'),require(_0x62f1('0xc4')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xc5'),require(_0x62f1('0xc6')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xc7'),require(_0x62f1('0xc8')));_0x44edcb[_0x62f1('0x9')]('/api/jscripty/projects',require(_0x62f1('0xc9')));_0x44edcb['use']('/api/settings',require(_0x62f1('0xca')));_0x44edcb['use']('/api/square/odbc',require(_0x62f1('0xcb')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xcc'),require('./api/squareProject'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xcd'),require('./api/squareRecording'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xce'),require(_0x62f1('0xcf')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xd0'),require(_0x62f1('0xd1')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xd2'),require(_0x62f1('0xd3')));_0x44edcb[_0x62f1('0x9')]('/api/campaigns',require(_0x62f1('0xd4')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xd5'),require('./api/migration'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xd6'),require(_0x62f1('0xd7')));_0x44edcb['use'](_0x62f1('0xd8'),require(_0x62f1('0xd9')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xda'),require(_0x62f1('0xdb')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xdc'),require('./api/chatTransferReport'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xdd'),require(_0x62f1('0xde')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xdf'),require(_0x62f1('0xe0')));_0x44edcb['use'](_0x62f1('0xe1'),require('./api/smsTransferReport'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xe2'),require('./api/cmList'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xe3'),require(_0x62f1('0xe4')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xe5'),require(_0x62f1('0xe6')));_0x44edcb['use'](_0x62f1('0xe7'),require(_0x62f1('0xe8')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xe9'),require(_0x62f1('0xea')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xeb'),require(_0x62f1('0xec')));_0x44edcb[_0x62f1('0x9')]('/api/whatsapp/accounts',require(_0x62f1('0xed')));_0x44edcb['use'](_0x62f1('0xee'),require(_0x62f1('0xef')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xf0'),require(_0x62f1('0xf1')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xf2'),require(_0x62f1('0xf3')));_0x44edcb['use'](_0x62f1('0xf4'),require(_0x62f1('0xf5')));_0x44edcb['use'](_0x62f1('0xf6'),require(_0x62f1('0xf7')));_0x44edcb['use'](_0x62f1('0xf8'),require(_0x62f1('0xf9')));_0x44edcb[_0x62f1('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xfa'),require(_0x62f1('0xfb')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xfc'),require(_0x62f1('0xfd')));_0x44edcb['use']('/api/auth/local',require('./api/authLocal'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0xfe'),require(_0x62f1('0xff')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x100'),require(_0x62f1('0x101')));_0x44edcb[_0x62f1('0x9')]('/api/jira',require(_0x62f1('0x102')));_0x44edcb['use']('/api/rpc',require('./api/rpc'));_0x44edcb[_0x62f1('0x9')]('/api/version',require(_0x62f1('0x103')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x104'),require(_0x62f1('0x105')));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x106'),require(_0x62f1('0x107')));_0x44edcb['use']('/api/webbar',require('./api/webbar'));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x108'),clientSideLogs);_0x44edcb[_0x62f1('0x9')](_0x62f1('0x109'),express[_0x62f1('0x10a')](path[_0x62f1('0x10b')](config['root'],_0x62f1('0x109'))));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x10c'),express[_0x62f1('0x10a')](path[_0x62f1('0x10b')](config[_0x62f1('0x10d')],_0x62f1('0x10c'))));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x10e'),express['static'](path[_0x62f1('0x10b')](config[_0x62f1('0x10d')],'/demo')));_0x44edcb[_0x62f1('0x9')]('/snippet',express[_0x62f1('0x10a')](path['join'](config['root'],_0x62f1('0x10f'),_0x62f1('0x110'))));_0x44edcb[_0x62f1('0x9')](_0x62f1('0x111'),express['static'](path[_0x62f1('0x10b')](config[_0x62f1('0x10d')],_0x62f1('0x112'))));_0x44edcb[_0x62f1('0x113')](_0x62f1('0x114'))[_0x62f1('0x115')](errors[0x194]);_0x44edcb[_0x62f1('0x113')]('/*')[_0x62f1('0x115')](function(_0x4b02c8,_0x2577b4){_0x2577b4[_0x62f1('0x116')](path[_0x62f1('0x117')](_0x44edcb[_0x62f1('0x115')](_0x62f1('0x118'))+_0x62f1('0x119')));});return _0x44edcb;});}; \ No newline at end of file +var _0x778e=['./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/smsQueueReport','/api/square/reports','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','./api/migration','/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/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','path','./errors','./utils/client-side-logger','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/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/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/cdr','/api/voiceQueuesLog','/api/schedules','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports'];(function(_0x35aa46,_0x55ee04){var _0x226f0c=function(_0x479e6b){while(--_0x479e6b){_0x35aa46['push'](_0x35aa46['shift']());}};_0x226f0c(++_0x55ee04);}(_0x778e,0x8e));var _0xe778=function(_0x5c3000,_0x183f88){_0x5c3000=_0x5c3000-0x0;var _0x59ecef=_0x778e[_0x5c3000];return _0x59ecef;};'use strict';var path=require(_0xe778('0x0'));var express=require('express');var errors=require(_0xe778('0x1'));var config=require('./config/environment');var setupLoggers=require(_0xe778('0x2'))['setupLoggers'];var clientSideLogs=require(_0xe778('0x3'));exports[_0xe778('0x4')]=function(_0x5af2fc){return setupLoggers(_0x5af2fc)[_0xe778('0x5')](function(){_0x5af2fc[_0xe778('0x6')](_0xe778('0x7'),require(_0xe778('0x8')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x9'),require(_0xe778('0xa')));_0x5af2fc['use'](_0xe778('0xb'),require(_0xe778('0xc')));_0x5af2fc['use'](_0xe778('0xd'),require(_0xe778('0xe')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xf'),require(_0xe778('0x10')));_0x5af2fc['use']('/api/voice/queues',require('./api/voiceQueue'));_0x5af2fc[_0xe778('0x6')]('/api/voice/recordings',require(_0xe778('0x11')));_0x5af2fc[_0xe778('0x6')]('/api/screen/recordings',require(_0xe778('0x12')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x13'),require('./api/voiceMail'));_0x5af2fc['use'](_0xe778('0x14'),require(_0xe778('0x15')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x16'),require(_0xe778('0x17')));_0x5af2fc['use'](_0xe778('0x18'),require(_0xe778('0x19')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x1a'),require(_0xe778('0x1b')));_0x5af2fc['use']('/api/voice/queues/reports',require(_0xe778('0x1c')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x1d'),require(_0xe778('0x1e')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x1f'),require(_0xe778('0x20')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x21'),require(_0xe778('0x22')));_0x5af2fc[_0xe778('0x6')]('/api/mail/out_servers',require(_0xe778('0x23')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x24'),require('./api/mailAccount'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x25'),require('./api/mailQueue'));_0x5af2fc['use']('/api/mail/substatuses',require(_0xe778('0x26')));_0x5af2fc[_0xe778('0x6')]('/api/mail/interactions',require(_0xe778('0x27')));_0x5af2fc[_0xe778('0x6')]('/api/mail/messages',require(_0xe778('0x28')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x29'),require(_0xe778('0x2a')));_0x5af2fc['use'](_0xe778('0x2b'),require('./api/mailQueueReport'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x2c'),require(_0xe778('0x2d')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x2e'),require('./api/dashboardItem'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x2f'),require(_0xe778('0x30')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x31'),require(_0xe778('0x32')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x33'),require(_0xe778('0x34')));_0x5af2fc['use'](_0xe778('0x35'),require(_0xe778('0x36')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x37'),require(_0xe778('0x38')));_0x5af2fc[_0xe778('0x6')]('/api/fax/reports/queue',require(_0xe778('0x39')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x3a'),require(_0xe778('0x3b')));_0x5af2fc[_0xe778('0x6')]('/api/sms/applications',require(_0xe778('0x3c')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x3d'),require('./api/smsInteraction'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x3e'),require('./api/smsMessage'));_0x5af2fc['use'](_0xe778('0x3f'),require(_0xe778('0x40')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x41'),require(_0xe778('0x42')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x43'),require('./api/openchannelApplication'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x44'),require('./api/openchannelInteraction'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x45'),require('./api/openchannelMessage'));_0x5af2fc['use']('/api/openchannel/queues',require(_0xe778('0x46')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x47'),require('./api/chatWebsite'));_0x5af2fc[_0xe778('0x6')]('/api/openchannel/reports/queue',require(_0xe778('0x48')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x49'),require(_0xe778('0x4a')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x4b'),require('./api/chatInteraction'));_0x5af2fc[_0xe778('0x6')]('/api/chat/messages',require(_0xe778('0x4c')));_0x5af2fc[_0xe778('0x6')]('/api/chat/offline_messages',require(_0xe778('0x4d')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x4e'),require(_0xe778('0x4f')));_0x5af2fc['use'](_0xe778('0x50'),require(_0xe778('0x51')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x52'),require(_0xe778('0x53')));_0x5af2fc['use']('/api/cm/companies',require('./api/cmCompany'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x54'),require(_0xe778('0x55')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x56'),require(_0xe778('0x57')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x58'),require(_0xe778('0x59')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x5a'),require(_0xe778('0x5b')));_0x5af2fc[_0xe778('0x6')]('/api/cm/hopper_history',require(_0xe778('0x5c')));_0x5af2fc['use'](_0xe778('0x5d'),require(_0xe778('0x5e')));_0x5af2fc[_0xe778('0x6')]('/api/actions',require(_0xe778('0x5f')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x60'),require(_0xe778('0x61')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x62'),require(_0xe778('0x63')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x64'),require(_0xe778('0x65')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x66'),require(_0xe778('0x67')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x68'),require('./api/interval'));_0x5af2fc['use']('/api/pauses',require('./api/pause'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x69'),require('./api/cdr'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x6a'),require('./api/voiceQueuesLog'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x6b'),require('./api/schedule'));_0x5af2fc[_0xe778('0x6')](_0xe778('0x6c'),require('./api/sound'));_0x5af2fc[_0xe778('0x6')]('/api/tags',require(_0xe778('0x6d')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x6e'),require(_0xe778('0x6f')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x70'),require('./api/cmContactHasItem'));_0x5af2fc['use'](_0xe778('0x71'),require(_0xe778('0x72')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x73'),require(_0xe778('0x74')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x75'),require(_0xe778('0x76')));_0x5af2fc['use'](_0xe778('0x77'),require(_0xe778('0x78')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x79'),require(_0xe778('0x7a')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x7b'),require(_0xe778('0x7c')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x7d'),require('./api/analyticCustomReport'));_0x5af2fc[_0xe778('0x6')]('/api/analytics/default_reports',require(_0xe778('0x7e')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x7f'),require('./api/analyticExtractedReport'));_0x5af2fc['use'](_0xe778('0x80'),require(_0xe778('0x81')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x82'),require(_0xe778('0x83')));_0x5af2fc['use'](_0xe778('0x84'),require(_0xe778('0x85')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x86'),require(_0xe778('0x87')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x88'),require(_0xe778('0x89')));_0x5af2fc['use']('/api/integrations/salesforce/fields',require(_0xe778('0x8a')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/sugarcrm/accounts',require(_0xe778('0x8b')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x8c'),require(_0xe778('0x8d')));_0x5af2fc['use'](_0xe778('0x8e'),require('./api/intSugarcrmField'));_0x5af2fc['use'](_0xe778('0x8f'),require(_0xe778('0x90')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/desk/configurations',require(_0xe778('0x91')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x92'),require(_0xe778('0x93')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/zoho/accounts',require(_0xe778('0x94')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x95'),require(_0xe778('0x96')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/zoho/fields',require(_0xe778('0x97')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/zendesk/accounts',require(_0xe778('0x98')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x99'),require('./api/intZendeskConfiguration'));_0x5af2fc[_0xe778('0x6')]('/api/integrations/zendesk/fields',require(_0xe778('0x9a')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x5af2fc['use'](_0xe778('0x9b'),require(_0xe778('0x9c')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x9d'),require(_0xe778('0x9e')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x9f'),require(_0xe778('0xa0')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xa1'),require(_0xe778('0xa2')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xa3'),require(_0xe778('0xa4')));_0x5af2fc['use'](_0xe778('0xa5'),require('./api/intServicenowAccount'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xa6'),require(_0xe778('0xa7')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xa8'),require(_0xe778('0xa9')));_0x5af2fc[_0xe778('0x6')]('/api/integrations/dynamics365/accounts',require(_0xe778('0xaa')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xab'),require('./api/intDynamics365Configuration'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xac'),require('./api/intDynamics365Field'));_0x5af2fc['use'](_0xe778('0xad'),require(_0xe778('0xae')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xaf'),require('./api/intFreshsalesConfiguration'));_0x5af2fc['use']('/api/integrations/freshsales/fields',require(_0xe778('0xb0')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xb1'),require('./api/network'));_0x5af2fc[_0xe778('0x6')]('/api/chat/reports/queue',require(_0xe778('0xb2')));_0x5af2fc[_0xe778('0x6')]('/api/chat/internal/messages',require(_0xe778('0xb3')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xb4'),require(_0xe778('0xb5')));_0x5af2fc['use'](_0xe778('0xb6'),require(_0xe778('0xb7')));_0x5af2fc['use'](_0xe778('0xb8'),require('./api/jscriptySessionReport'));_0x5af2fc[_0xe778('0x6')]('/api/sms/reports/queue',require(_0xe778('0xb9')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xba'),require('./api/squareReport'));_0x5af2fc[_0xe778('0x6')]('/api/square/details/reports',require(_0xe778('0xbb')));_0x5af2fc[_0xe778('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x5af2fc[_0xe778('0x6')]('/api/settings',require(_0xe778('0xbc')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xbd'),require(_0xe778('0xbe')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xbf'),require(_0xe778('0xc0')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xc1'),require(_0xe778('0xc2')));_0x5af2fc['use'](_0xe778('0xc3'),require('./api/squareMessage'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xc4'),require(_0xe778('0xc5')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xc6'),require('./api/license'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xc7'),require(_0xe778('0xc8')));_0x5af2fc['use']('/api/migrations',require(_0xe778('0xc9')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xca'),require(_0xe778('0xcb')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xcc'),require(_0xe778('0xcd')));_0x5af2fc['use'](_0xe778('0xce'),require(_0xe778('0xcf')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xd0'),require(_0xe778('0xd1')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xd2'),require(_0xe778('0xd3')));_0x5af2fc['use'](_0xe778('0xd4'),require(_0xe778('0xd5')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xd6'),require(_0xe778('0xd7')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xd8'),require('./api/cmList'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xd9'),require(_0xe778('0xda')));_0x5af2fc['use'](_0xe778('0xdb'),require(_0xe778('0xdc')));_0x5af2fc['use']('/api/userProfile/sections',require(_0xe778('0xdd')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xde'),require(_0xe778('0xdf')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe0'),require(_0xe778('0xe1')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe2'),require('./api/whatsappAccount'));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe3'),require('./api/whatsappApplication'));_0x5af2fc[_0xe778('0x6')]('/api/whatsapp/interactions',require(_0xe778('0xe4')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe5'),require(_0xe778('0xe6')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe7'),require(_0xe778('0xe8')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xe9'),require(_0xe778('0xea')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xeb'),require(_0xe778('0xec')));_0x5af2fc[_0xe778('0x6')]('/api/cloudProviders',require(_0xe778('0xed')));_0x5af2fc[_0xe778('0x6')]('/api/realtime',require(_0xe778('0xee')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xef'),require(_0xe778('0xf0')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xf1'),require(_0xe778('0xf2')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xf3'),require(_0xe778('0xf4')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xf5'),require(_0xe778('0xf6')));_0x5af2fc['use']('/api/jira',require(_0xe778('0xf7')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xf8'),require(_0xe778('0xf9')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xfa'),require(_0xe778('0xfb')));_0x5af2fc[_0xe778('0x6')](_0xe778('0xfc'),require('./api/system'));_0x5af2fc['use']('/api/pm2',require(_0xe778('0xfd')));_0x5af2fc['use'](_0xe778('0xfe'),require(_0xe778('0xff')));_0x5af2fc[_0xe778('0x6')](_0xe778('0x100'),clientSideLogs);_0x5af2fc[_0xe778('0x6')](_0xe778('0x101'),express[_0xe778('0x102')](path[_0xe778('0x103')](config[_0xe778('0x104')],_0xe778('0x101'))));_0x5af2fc[_0xe778('0x6')]('/www',express[_0xe778('0x102')](path[_0xe778('0x103')](config['root'],_0xe778('0x105'))));_0x5af2fc[_0xe778('0x6')](_0xe778('0x106'),express[_0xe778('0x102')](path[_0xe778('0x103')](config['root'],_0xe778('0x106'))));_0x5af2fc[_0xe778('0x6')]('/snippet',express['static'](path[_0xe778('0x103')](config[_0xe778('0x104')],_0xe778('0x107'),_0xe778('0x108'))));_0x5af2fc[_0xe778('0x6')](_0xe778('0x109'),express[_0xe778('0x102')](path['join'](config[_0xe778('0x104')],_0xe778('0x10a'))));_0x5af2fc['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x5af2fc[_0xe778('0x10b')]('/*')[_0xe778('0x10c')](function(_0x48d7bd,_0x26d86a){_0x26d86a[_0xe778('0x10d')](path[_0xe778('0x10e')](_0x5af2fc['get'](_0xe778('0x10f'))+_0xe778('0x110')));});return _0x5af2fc;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 00f86e8..b8b6e1a 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8b2=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/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/intSalesforceAccount/intSalesforceAccount.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'];(function(_0x546bf6,_0x1980d5){var _0x5a0cbf=function(_0x5e66ed){while(--_0x5e66ed){_0x546bf6['push'](_0x546bf6['shift']());}};_0x5a0cbf(++_0x1980d5);}(_0xb8b2,0x9f));var _0x2b8b=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xb8b2[_0x4e1d03];return _0x362d4b;};'use strict';var jayson=require('jayson/promise');var _=require(_0x2b8b('0x0'));var config=require('../config/environment');exports[_0x2b8b('0x1')]=function(){return new Promise(function(_0x4d0426,_0x9202e3){var _0x2ab10b={};_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x3')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x4')));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/voiceQueue/voiceQueue.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/voiceRecording/voiceRecording.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x5')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x6')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x7')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x8')));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/trunk/trunk.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x9')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0xa')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0xb')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0xc')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/mailQueue/mailQueue.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0xd')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0xe')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/mailApplication/mailApplication.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0xf')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x10')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/faxInteraction/faxInteraction.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x11')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x12')));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x13')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x14')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x15')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x16')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x17')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x18')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x19')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x1a')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x1b')));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/chatMessage/chatMessage.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x1c')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x1d')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x1e')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x1f')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x20')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x21')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x22')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x23')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x24')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x25')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x26')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x27')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x28')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x29')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x2a')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x2b')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x2c')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x2d')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x2e')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x2f')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x30')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x31')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x32')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x33')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x34')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x35')));_0x2ab10b=_['merge'](_0x2ab10b,require('../api/squareOdbc/squareOdbc.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/squareProject/squareProject.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/squareRecording/squareRecording.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/squareMessage/squareMessage.rpc'));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require('../api/campaign/campaign.rpc'));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x36')));_0x2ab10b=_['merge'](_0x2ab10b,require(_0x2b8b('0x37')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x38')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x39')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x3a')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x3b')));_0x2ab10b=_[_0x2b8b('0x2')](_0x2ab10b,require(_0x2b8b('0x3c')));var _0x37dd8c=jayson[_0x2b8b('0x3d')](_0x2ab10b)[_0x2b8b('0x3e')]();var _0x331aa=config[_0x2b8b('0x3f')][_0x2b8b('0x40')]||config[_0x2b8b('0x40')]+0x1;var _0x36f7b6=config['rpc']['ip']||_0x2b8b('0x41');_0x37dd8c['on']('error',function(_0x3099f4){return _0x9202e3(_0x3099f4);});_0x37dd8c[_0x2b8b('0x1')](_0x331aa,_0x36f7b6,function(){console[_0x2b8b('0x42')](_0x2b8b('0x43'),_0x36f7b6,_0x331aa);require('../config/triggers')['default']();return _0x4d0426(_0x2b8b('0x44')+_0x36f7b6+':'+_0x331aa);});});}; \ No newline at end of file +var _0x81c8=['listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.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/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','error','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment'];(function(_0x490d5f,_0x5c4074){var _0x1a9aae=function(_0x3ae930){while(--_0x3ae930){_0x490d5f['push'](_0x490d5f['shift']());}};_0x1a9aae(++_0x5c4074);}(_0x81c8,0x1dd));var _0x881c=function(_0x3f03c5,_0x177741){_0x3f03c5=_0x3f03c5-0x0;var _0x2b5c24=_0x81c8[_0x3f03c5];return _0x2b5c24;};'use strict';var jayson=require(_0x881c('0x0'));var _=require(_0x881c('0x1'));var config=require(_0x881c('0x2'));exports[_0x881c('0x3')]=function(){return new Promise(function(_0x5c16c5,_0x2568df){var _0x92bc82={};_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/user/user.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x5')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x6')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x7')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x8')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x9')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0xa')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0xb')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0xc')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/trunk/trunk.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0xd')));_0x92bc82=_['merge'](_0x92bc82,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0xe')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/mailAccount/mailAccount.rpc'));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0xf')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x10')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x11')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x12')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x13')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x14')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/faxApplication/faxApplication.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/faxInteraction/faxInteraction.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x15')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x16')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x17')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x18')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/smsInteraction/smsInteraction.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x19')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x1a')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x1b')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x1c')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x1d')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x1e')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x1f')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x20')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x21')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x22')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/cmContact/cmContact.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/cmHopper/cmHopper.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x23')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x24')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x25')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x26')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x27')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x28')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x29')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x2a')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x2b')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x2c')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x2d')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x2e')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x2f')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x30')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x31')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x32')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x33')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x34')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x35')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x36')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x37')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x38')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x39')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x3a')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require('../api/setting/setting.rpc'));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x3b')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x3c')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x3d')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x3e')));_0x92bc82=_['merge'](_0x92bc82,require(_0x881c('0x3f')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x40')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x41')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x42')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x43')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x44')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x45')));_0x92bc82=_[_0x881c('0x4')](_0x92bc82,require(_0x881c('0x46')));var _0x1ed929=jayson[_0x881c('0x47')](_0x92bc82)[_0x881c('0x48')]();var _0x3acb59=config['rpc'][_0x881c('0x49')]||config[_0x881c('0x49')]+0x1;var _0x2fc974=config[_0x881c('0x4a')]['ip']||'localhost';_0x1ed929['on'](_0x881c('0x4b'),function(_0x43fa8a){return _0x2568df(_0x43fa8a);});_0x1ed929[_0x881c('0x3')](_0x3acb59,_0x2fc974,function(){console[_0x881c('0x4c')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2fc974,_0x3acb59);require(_0x881c('0x4d'))[_0x881c('0x4e')]();return _0x5c16c5(_0x881c('0x4f')+_0x2fc974+':'+_0x3acb59);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c2a49a0..55b702e 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 _0x3441=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','emit','line','hangup','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','prototype','sync','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic'];(function(_0x13abb0,_0x362013){var _0x7582a=function(_0x8dedc4){while(--_0x8dedc4){_0x13abb0['push'](_0x13abb0['shift']());}};_0x7582a(++_0x362013);}(_0x3441,0xf9));var _0x1344=function(_0x117a06,_0x3860e4){_0x117a06=_0x117a06-0x0;var _0x53bfc2=_0x3441[_0x117a06];return _0x53bfc2;};'use strict';var util=require(_0x1344('0x0'));var _=require('lodash');var EventEmitter=require(_0x1344('0x1'))[_0x1344('0x2')];var AGIReply=require(_0x1344('0x3'));var AGIError=require(_0x1344('0x4'));function AGIChannel(_0x213a25){var _0x7e60fe=this,_0x204cce=new AGIReply(),_0x18e42f=![],_0x1373c9={};EventEmitter[_0x1344('0x5')](_0x7e60fe);_0x213a25[_0x1344('0x6')](_0x1344('0x7'));_0x213a25['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x204cce[_0x1344('0x6')]('utf8');_0x204cce['on']('headers',function(_0x3036a7){for(var _0x2cd767 in _0x3036a7){_0x7e60fe[_0x2cd767]=_0x3036a7[_0x2cd767];}_0x7e60fe[_0x1344('0x8')]('ready');});_0x204cce['on'](_0x1344('0x9'),function(_0x5d6c56){if(_0x5d6c56['toLowerCase']()=='hangup'){_0x7e60fe[_0x1344('0x8')](_0x1344('0xa'));return;}if(_0x5d6c56['substring'](0x0,0xb)==_0x1344('0xb')){_0x18e42f=!![];}if(_0x18e42f){_0x1373c9['rx']+=_0x5d6c56+'\x0a';if(_0x5d6c56[_0x1344('0xc')](_0x1344('0xd'))!=-0x1){_0x18e42f=![];}}else{_0x1373c9['rx']=_0x5d6c56;}if(_0x18e42f){return;}if(typeof _0x1373c9['cb']=='function'){var _0x21b57e=_0x1373c9['rx'][_0x1344('0xe')](0x0,0x3),_0x293a47=null,_0x51310d=null;_0x21b57e=parseInt(_0x21b57e);if(isNaN(_0x21b57e)){_0x1373c9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1344('0xf')});return;}if(_0x21b57e!=0xc8){_0x1373c9['cb'](null,{'code':_0x21b57e,'result':-0x1,'extra':'KO'});return;}_0x293a47=_0x1373c9['rx'][_0x1344('0xe')](0x4)[_0x1344('0x10')](_0x1344('0x11'),'');if(_0x293a47[_0x1344('0x12')]('\x20')!=-0x1){_0x293a47=_0x293a47[_0x1344('0x13')](0x0,_0x293a47[_0x1344('0x12')]('\x20'));}if(_[_0x1344('0x14')](_0x293a47,'-1')){_0x293a47=parseInt(_0x293a47);}_0x51310d=_0x1373c9['rx'][_0x1344('0x15')]('\x20');if(_0x51310d[_0x1344('0x16')]==0x3){_0x51310d=_0x51310d[0x2][_0x1344('0xe')](0x1,_0x51310d[0x2]['length']-0x1);}else if(_0x51310d[_0x1344('0x16')]>0x3){var _0x36832c=/\((.+)\)/;var _0x87dba1=_0x1373c9['rx']['match'](_0x36832c);if(_0x87dba1){_0x51310d=_0x87dba1[0x1];}else{_0x51310d=null;}}else{_0x51310d=null;}_0x1373c9['cb'](null,{'code':_0x21b57e,'result':_0x293a47,'extra':_0x51310d});}});_0x213a25['on']('error',function(_0x1ef36f){_0x7e60fe['emit'](_0x1344('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x1ef36f[_0x1344('0x18')]));});_0x213a25['on'](_0x1344('0x19'),function(){_0x7e60fe[_0x1344('0x8')](_0x1344('0x19'),new AGIError(_0x1344('0x1a')));});_0x213a25['on'](_0x1344('0x1b'),function(){_0x7e60fe['emit'](_0x1344('0x1b'),new AGIError(_0x1344('0x1c')));_0x213a25[_0x1344('0x1d')]();});_0x213a25[_0x1344('0x1e')](_0x204cce);this[_0x1344('0x1f')]=function(_0xbc90fb,_0x2e86b6){var _0xbc90fb=_0xbc90fb||'',_0x2e86b6=typeof _0x2e86b6==_0x1344('0x20')?_0x2e86b6:new Function();_0x1373c9={'tx':_0xbc90fb,'rx':'','cb':_0x2e86b6};_0x213a25[_0x1344('0x21')](_0xbc90fb+'\x0a');},this['close']=function(){_0x213a25[_0x1344('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1344('0x22')]['sendRequest']=function(_0x3ca967){return this['command'][_0x1344('0x23')](this,_0x3ca967);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0x1344('0x24'));};AGIChannel[_0x1344('0x22')][_0x1344('0x25')]=function(_0x27d89a,_0x3c5fe0,_0x3d73cf){_0x27d89a=_0x27d89a===undefined?_0x1344('0x26'):_0x27d89a;_0x3c5fe0=_0x3c5fe0===undefined?'5':_0x3c5fe0;_0x3d73cf=_0x3d73cf===undefined?'1':_0x3d73cf;return this['sendRequest'](util['format'](_0x1344('0x27'),_0x27d89a,_0x3c5fe0*0x3e8,_0x3d73cf));};AGIChannel['prototype']['noop']=function(_0xdd253b){_0xdd253b=_0xdd253b||_0x1344('0x28');return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x2b'),_0xdd253b));};AGIChannel[_0x1344('0x22')][_0x1344('0x2c')]=function(_0x152dd4,_0x53916c){if(_[_0x1344('0x2d')](_0x53916c)){return this['sendRequest'](util[_0x1344('0x2a')](_0x1344('0x2e'),_0x152dd4,_0x53916c[_0x1344('0x2f')](',')));}return this['sendRequest'](util[_0x1344('0x2a')](_0x1344('0x2e'),_0x152dd4,_0x53916c));};AGIChannel['prototype'][_0x1344('0x30')]=function(_0x587e11){return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x31'),_0x587e11));};AGIChannel[_0x1344('0x22')][_0x1344('0x32')]=function(_0x4a91e7){return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x33'),_0x4a91e7));};AGIChannel[_0x1344('0x22')][_0x1344('0x34')]=function(_0x7514d5){return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x35'),_0x7514d5));};AGIChannel['prototype'][_0x1344('0xa')]=function(){return this[_0x1344('0x29')](_0x1344('0x36'));};AGIChannel[_0x1344('0x22')][_0x1344('0x37')]=function(_0x46bb21,_0x3ea4ff){var _0x460edc=_['isBoolean'](_0x3ea4ff)||_[_0x1344('0x38')](_0x3ea4ff)?_0x3ea4ff[_0x1344('0x39')]():_0x3ea4ff;return this[_0x1344('0x29')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46bb21,_0x460edc?_0x460edc['toString']()[_0x1344('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1344('0x22')][_0x1344('0x3a')]=function(_0x383542,_0x4d46f4){return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x3b'),_0x383542,_0x4d46f4));};AGIChannel[_0x1344('0x22')][_0x1344('0x3c')]=function(_0x1a369e,_0x2045f3){return this[_0x1344('0x29')](util['format'](_0x1344('0x3d'),_0x1a369e,_0x2045f3));};AGIChannel[_0x1344('0x22')][_0x1344('0x3e')]=function(_0x2b417e,_0xabc6cc){return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x3f'),_0x2b417e,_0xabc6cc));};AGIChannel[_0x1344('0x22')][_0x1344('0x40')]=function(_0x4ae7e3,_0x432a64,_0x2d4332){_0x432a64=_0x432a64||this[_0x1344('0x41')];_0x2d4332=_0x2d4332||0x1;this[_0x1344('0x30')](_0x4ae7e3);this[_0x1344('0x32')](_0x432a64);this[_0x1344('0x34')](_0x2d4332);return this[_0x1344('0x42')](util[_0x1344('0x2a')](_0x1344('0x43'),_0x4ae7e3,_0x432a64,_0x2d4332));};AGIChannel[_0x1344('0x22')]['getVariable']=function(_0x8018b7){return this[_0x1344('0x29')](util[_0x1344('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x8018b7));};AGIChannel[_0x1344('0x22')][_0x1344('0x44')]=function(_0x4a57f7,_0x3eaa29,_0x1eaa55,_0xe36009,_0x4bafd1,_0x4afaa2){_0x3eaa29=_0x3eaa29||_0x1344('0x45');_0x1eaa55=_0x1eaa55||'';_0xe36009=_0xe36009===undefined?-0x1:_0xe36009==='-1'?-0x1:_0xe36009*0x3e8;_0x4bafd1=_0x4bafd1===undefined?'':'s='+_0x4bafd1;_0x4afaa2=_0x4afaa2?_0x1344('0x46'):'';return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x47'),_0x4a57f7,_0x3eaa29,_0x1eaa55,_0xe36009,_0x4afaa2,_0x4bafd1));};AGIChannel[_0x1344('0x22')][_0x1344('0x48')]=function(_0xaae1f,_0x55e12c){_0x55e12c=_0x55e12c||'';return this[_0x1344('0x29')](util[_0x1344('0x2a')](_0x1344('0x49'),_0xaae1f,_0x55e12c));};AGIChannel[_0x1344('0x22')][_0x1344('0x4a')]=function(_0x4d7bfc){return this[_0x1344('0x2c')](_0x1344('0x4b'),_0x4d7bfc);};AGIChannel[_0x1344('0x22')]['wait']=function(_0x3d4ca7){return this[_0x1344('0x2c')]('WAIT',_0x3d4ca7);};AGIChannel[_0x1344('0x22')]['error']=function(_0x56c2d5,_0x212640){this[_0x1344('0x42')](util[_0x1344('0x2a')](_0x1344('0x4c'),_0x56c2d5['id'],_0x56c2d5[_0x1344('0x4d')],_0x212640));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x58d3=['replace','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','close','destroy','inherits','sendRequest','prototype','answer','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','EventEmitter','call','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search'];(function(_0x5d9ae1,_0x5d431d){var _0x1e8d59=function(_0x1179c5){while(--_0x1179c5){_0x5d9ae1['push'](_0x5d9ae1['shift']());}};_0x1e8d59(++_0x5d431d);}(_0x58d3,0xd4));var _0x358d=function(_0x5e95c1,_0x38cbba){_0x5e95c1=_0x5e95c1-0x0;var _0x4a0676=_0x58d3[_0x5e95c1];return _0x4a0676;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require('events')[_0x358d('0x0')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4cec6b){var _0x1d3e1f=this,_0x7d4862=new AGIReply(),_0x274886=![],_0x173912={};EventEmitter[_0x358d('0x1')](_0x1d3e1f);_0x4cec6b[_0x358d('0x2')](_0x358d('0x3'));_0x4cec6b[_0x358d('0x4')](0x8*0x3c*0x3c*0x3e8);_0x7d4862[_0x358d('0x2')](_0x358d('0x3'));_0x7d4862['on']('headers',function(_0x20180a){for(var _0x4dc0cf in _0x20180a){_0x1d3e1f[_0x4dc0cf]=_0x20180a[_0x4dc0cf];}_0x1d3e1f[_0x358d('0x5')](_0x358d('0x6'));});_0x7d4862['on'](_0x358d('0x7'),function(_0x3bda14){if(_0x3bda14[_0x358d('0x8')]()==_0x358d('0x9')){_0x1d3e1f[_0x358d('0x5')](_0x358d('0x9'));return;}if(_0x3bda14[_0x358d('0xa')](0x0,0xb)==_0x358d('0xb')){_0x274886=!![];}if(_0x274886){_0x173912['rx']+=_0x3bda14+'\x0a';if(_0x3bda14[_0x358d('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x274886=![];}}else{_0x173912['rx']=_0x3bda14;}if(_0x274886){return;}if(typeof _0x173912['cb']=='function'){var _0xa3a0a2=_0x173912['rx']['substring'](0x0,0x3),_0x1cade7=null,_0x362b7f=null;_0xa3a0a2=parseInt(_0xa3a0a2);if(isNaN(_0xa3a0a2)){_0x173912['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0xa3a0a2!=0xc8){_0x173912['cb'](null,{'code':_0xa3a0a2,'result':-0x1,'extra':'KO'});return;}_0x1cade7=_0x173912['rx']['substring'](0x4)[_0x358d('0xd')]('result=','');if(_0x1cade7['indexOf']('\x20')!=-0x1){_0x1cade7=_0x1cade7[_0x358d('0xe')](0x0,_0x1cade7[_0x358d('0xf')]('\x20'));}if(_[_0x358d('0x10')](_0x1cade7,'-1')){_0x1cade7=parseInt(_0x1cade7);}_0x362b7f=_0x173912['rx'][_0x358d('0x11')]('\x20');if(_0x362b7f[_0x358d('0x12')]==0x3){_0x362b7f=_0x362b7f[0x2][_0x358d('0xa')](0x1,_0x362b7f[0x2][_0x358d('0x12')]-0x1);}else if(_0x362b7f[_0x358d('0x12')]>0x3){var _0x51103a=/\((.+)\)/;var _0x19b014=_0x173912['rx'][_0x358d('0x13')](_0x51103a);if(_0x19b014){_0x362b7f=_0x19b014[0x1];}else{_0x362b7f=null;}}else{_0x362b7f=null;}_0x173912['cb'](null,{'code':_0xa3a0a2,'result':_0x1cade7,'extra':_0x362b7f});}});_0x4cec6b['on'](_0x358d('0x14'),function(_0x3105dd){_0x1d3e1f[_0x358d('0x5')](_0x358d('0x14'),new AGIError(_0x358d('0x15'),_0x3105dd[_0x358d('0x16')]));});_0x4cec6b['on']('close',function(){_0x1d3e1f[_0x358d('0x5')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4cec6b['on'](_0x358d('0x17'),function(){_0x1d3e1f[_0x358d('0x5')](_0x358d('0x17'),new AGIError(_0x358d('0x18')));_0x4cec6b['destroy']();});_0x4cec6b[_0x358d('0x19')](_0x7d4862);this[_0x358d('0x1a')]=function(_0x4cb257,_0x39e62a){var _0x4cb257=_0x4cb257||'',_0x39e62a=typeof _0x39e62a=='function'?_0x39e62a:new Function();_0x173912={'tx':_0x4cb257,'rx':'','cb':_0x39e62a};_0x4cec6b[_0x358d('0x1b')](_0x4cb257+'\x0a');},this[_0x358d('0x1c')]=function(){_0x4cec6b[_0x358d('0x1d')]();};}util[_0x358d('0x1e')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x358d('0x1f')]=function(_0x53ab5f){return this[_0x358d('0x1a')]['sync'](this,_0x53ab5f);};AGIChannel[_0x358d('0x20')][_0x358d('0x21')]=function(){return this['sendRequest'](_0x358d('0x22'));};AGIChannel[_0x358d('0x20')][_0x358d('0x23')]=function(_0x119585,_0x5e4e49,_0x2c4988){_0x119585=_0x119585===undefined?_0x358d('0x24'):_0x119585;_0x5e4e49=_0x5e4e49===undefined?'5':_0x5e4e49;_0x2c4988=_0x2c4988===undefined?'1':_0x2c4988;return this[_0x358d('0x1f')](util[_0x358d('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x119585,_0x5e4e49*0x3e8,_0x2c4988));};AGIChannel['prototype'][_0x358d('0x26')]=function(_0x9f9e9b){_0x9f9e9b=_0x9f9e9b||_0x358d('0x27');return this[_0x358d('0x1f')](util[_0x358d('0x25')]('VERBOSE\x20\x22%s\x22',_0x9f9e9b));};AGIChannel[_0x358d('0x20')][_0x358d('0x28')]=function(_0x12d76e,_0x3fd3b3){if(_[_0x358d('0x29')](_0x3fd3b3)){return this[_0x358d('0x1f')](util[_0x358d('0x25')](_0x358d('0x2a'),_0x12d76e,_0x3fd3b3[_0x358d('0x2b')](',')));}return this[_0x358d('0x1f')](util[_0x358d('0x25')](_0x358d('0x2a'),_0x12d76e,_0x3fd3b3));};AGIChannel[_0x358d('0x20')][_0x358d('0x2c')]=function(_0x11b1cc){return this['sendRequest'](util[_0x358d('0x25')]('SET\x20CONTEXT\x20%s',_0x11b1cc));};AGIChannel[_0x358d('0x20')][_0x358d('0x2d')]=function(_0x162c8d){return this['sendRequest'](util[_0x358d('0x25')](_0x358d('0x2e'),_0x162c8d));};AGIChannel[_0x358d('0x20')][_0x358d('0x2f')]=function(_0xa50ed2){return this[_0x358d('0x1f')](util[_0x358d('0x25')](_0x358d('0x30'),_0xa50ed2));};AGIChannel[_0x358d('0x20')][_0x358d('0x9')]=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x358d('0x20')][_0x358d('0x31')]=function(_0xd3b6e2,_0x1ae7cd){var _0x4c8e33=_[_0x358d('0x32')](_0x1ae7cd)||_['isNumber'](_0x1ae7cd)?_0x1ae7cd['toString']():_0x1ae7cd;return this[_0x358d('0x1f')](util['format'](_0x358d('0x33'),_0xd3b6e2,_0x4c8e33?_0x4c8e33[_0x358d('0x34')]()[_0x358d('0xd')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x358d('0x20')][_0x358d('0x35')]=function(_0x5082e3,_0x2d9c3b){return this['sendRequest'](util[_0x358d('0x25')](_0x358d('0x36'),_0x5082e3,_0x2d9c3b));};AGIChannel[_0x358d('0x20')][_0x358d('0x37')]=function(_0x311d2b,_0x505b41){return this[_0x358d('0x1f')](util['format'](_0x358d('0x38'),_0x311d2b,_0x505b41));};AGIChannel[_0x358d('0x20')][_0x358d('0x39')]=function(_0x414ac6,_0x12deaf){return this[_0x358d('0x1f')](util['format'](_0x358d('0x3a'),_0x414ac6,_0x12deaf));};AGIChannel[_0x358d('0x20')][_0x358d('0x3b')]=function(_0x21f4ce,_0x4019c4,_0x3dad01){_0x4019c4=_0x4019c4||this[_0x358d('0x3c')];_0x3dad01=_0x3dad01||0x1;this[_0x358d('0x2c')](_0x21f4ce);this[_0x358d('0x2d')](_0x4019c4);this[_0x358d('0x2f')](_0x3dad01);return this[_0x358d('0x26')](util['format'](_0x358d('0x3d'),_0x21f4ce,_0x4019c4,_0x3dad01));};AGIChannel[_0x358d('0x20')][_0x358d('0x3e')]=function(_0x150b72){return this[_0x358d('0x1f')](util[_0x358d('0x25')](_0x358d('0x3f'),_0x150b72));};AGIChannel[_0x358d('0x20')][_0x358d('0x40')]=function(_0x31a6fc,_0x302fa8,_0x529ec5,_0x36891d,_0xb52600,_0x5da9e6){_0x302fa8=_0x302fa8||_0x358d('0x41');_0x529ec5=_0x529ec5||'';_0x36891d=_0x36891d===undefined?-0x1:_0x36891d==='-1'?-0x1:_0x36891d*0x3e8;_0xb52600=_0xb52600===undefined?'':'s='+_0xb52600;_0x5da9e6=_0x5da9e6?_0x358d('0x42'):'';return this['sendRequest'](util[_0x358d('0x25')](_0x358d('0x43'),_0x31a6fc,_0x302fa8,_0x529ec5,_0x36891d,_0x5da9e6,_0xb52600));};AGIChannel[_0x358d('0x20')]['streamFile']=function(_0x4dd9d2,_0x158cd8){_0x158cd8=_0x158cd8||'';return this['sendRequest'](util['format'](_0x358d('0x44'),_0x4dd9d2,_0x158cd8));};AGIChannel[_0x358d('0x20')][_0x358d('0x45')]=function(_0x246107){return this[_0x358d('0x28')](_0x358d('0x46'),_0x246107);};AGIChannel[_0x358d('0x20')][_0x358d('0x47')]=function(_0x2623a7){return this['exec'](_0x358d('0x48'),_0x2623a7);};AGIChannel['prototype'][_0x358d('0x14')]=function(_0x79cb83,_0x86d83){this[_0x358d('0x26')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x79cb83['id'],_0x79cb83[_0x358d('0x49')],_0x86d83));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x358d('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4e249bd..ef462b1 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 _0x88b3=['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.','push','format','apply'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x88b3,0x173));var _0x388b=function(_0x23db97,_0x5c3973){_0x23db97=_0x23db97-0x0;var _0x2a423c=_0x88b3[_0x23db97];return _0x2a423c;};'use strict';var util=require(_0x388b('0x0'));var error={'E_AGI_UNDEFINED':_0x388b('0x1'),'E_AGI_ARGUMENT_PORT':_0x388b('0x2'),'E_AGI_SERVER_ERROR':_0x388b('0x3'),'E_AGI_SERVER_CLOSE':_0x388b('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x388b('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x388b('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x388b('0x7'),'E_AGI_COMMAND_EMPTY':_0x388b('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x388b('0x9'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x57620b){var _0x57620b=_0x57620b||null,_0x923e6d=_0x923e6d||[],_0x7276d9=0x1,_0xe2b6e6='';if(!error[_0x57620b]){_0x57620b='E_AGI_UNDEFINED';}_0x923e6d[_0x388b('0xa')](error[_0x57620b]);while(arguments[_0x7276d9]){_0x923e6d[_0x388b('0xa')](arguments[_0x7276d9]);_0x7276d9++;}_0xe2b6e6=util[_0x388b('0xb')][_0x388b('0xc')](util,_0x923e6d);this[_0x388b('0xd')]=_0xe2b6e6;this[_0x388b('0xe')]=_0x57620b;}module[_0x388b('0xf')]=AGIError; \ No newline at end of file +var _0x39fb=['format','apply','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x39fb,0x138));var _0xb39f=function(_0x5023cb,_0x5ae9a6){_0x5023cb=_0x5023cb-0x0;var _0x52c5d6=_0x39fb[_0x5023cb];return _0x52c5d6;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xb39f('0x0'),'E_AGI_ARGUMENT_PORT':_0xb39f('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xb39f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xb39f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xb39f('0x4'),'E_AGI_SOCKET_ERROR':_0xb39f('0x5'),'E_AGI_SOCKET_CLOSE':_0xb39f('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xb39f('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xb39f('0x8')};function AGIError(_0x39129d){var _0x39129d=_0x39129d||null,_0x5d0b69=_0x5d0b69||[],_0x538f56=0x1,_0x791122='';if(!error[_0x39129d]){_0x39129d='E_AGI_UNDEFINED';}_0x5d0b69[_0xb39f('0x9')](error[_0x39129d]);while(arguments[_0x538f56]){_0x5d0b69['push'](arguments[_0x538f56]);_0x538f56++;}_0x791122=util[_0xb39f('0xa')][_0xb39f('0xb')](util,_0x5d0b69);this['message']=_0x791122;this[_0xb39f('0xc')]=_0x39129d;}module[_0xb39f('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index d2b7e6a..3df8c1e 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 _0x96f9=['../../config/environment','redis','localhost','subscribe','emit','error','message','agi','E_AGI_SERVER_ERROR','exports','events','EventEmitter','ioredis','./error'];(function(_0x10faf1,_0x348f30){var _0x46d434=function(_0x3148bf){while(--_0x3148bf){_0x10faf1['push'](_0x10faf1['shift']());}};_0x46d434(++_0x348f30);}(_0x96f9,0x1ca));var _0x996f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x96f9[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var EventEmitter=require(_0x996f('0x0'))[_0x996f('0x1')];var Redis=require(_0x996f('0x2'));var AGIError=require(_0x996f('0x3'));var config=require(_0x996f('0x4'));config[_0x996f('0x5')]=_['defaults'](config['redis'],{'host':_0x996f('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x996f('0x5')]);sub[_0x996f('0x7')]('agi',function(_0x2c6d34){if(_0x2c6d34)return eventEmitter[_0x996f('0x8')](_0x996f('0x9'),new AGIError('E_AGI_SERVER_ERROR',_0x2c6d34));});sub['on'](_0x996f('0xa'),function(_0x4308f0,_0x55e200){if(_0x4308f0!==_0x996f('0xb'))return;try{var _0x53d1df=JSON['parse'](_0x55e200);eventEmitter['emit']('projectUpdate',_0x53d1df);}catch(_0xbd273b){eventEmitter[_0x996f('0x8')]('error',new AGIError(_0x996f('0xc'),_0xbd273b));}});module[_0x996f('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x6333=['events','EventEmitter','ioredis','../../config/environment','redis','defaults','subscribe','agi','error','E_AGI_SERVER_ERROR','parse','emit','exports','lodash'];(function(_0x12e6e5,_0x39855b){var _0x4ef6ce=function(_0x3e06f3){while(--_0x3e06f3){_0x12e6e5['push'](_0x12e6e5['shift']());}};_0x4ef6ce(++_0x39855b);}(_0x6333,0x14f));var _0x3633=function(_0x46e036,_0x37750a){_0x46e036=_0x46e036-0x0;var _0x3144a3=_0x6333[_0x46e036];return _0x3144a3;};'use strict';var _=require(_0x3633('0x0'));var EventEmitter=require(_0x3633('0x1'))[_0x3633('0x2')];var Redis=require(_0x3633('0x3'));var AGIError=require('./error');var config=require(_0x3633('0x4'));config[_0x3633('0x5')]=_[_0x3633('0x6')](config[_0x3633('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x3633('0x5')]);sub[_0x3633('0x7')](_0x3633('0x8'),function(_0x4f2441){if(_0x4f2441)return eventEmitter['emit'](_0x3633('0x9'),new AGIError(_0x3633('0xa'),_0x4f2441));});sub['on']('message',function(_0x5cda91,_0x1c5f78){if(_0x5cda91!==_0x3633('0x8'))return;try{var _0x3f0162=JSON[_0x3633('0xb')](_0x1c5f78);eventEmitter[_0x3633('0xc')]('projectUpdate',_0x3f0162);}catch(_0x5bcbfd){eventEmitter[_0x3633('0xc')](_0x3633('0x9'),new AGIError(_0x3633('0xa'),_0x5bcbfd));}});module[_0x3633('0xd')]={'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 8d4faf8..509959d 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 _0x5a7f=['traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','info','no\x20vertex\x20found','length','condition','split','agicommand','vswitch','default','target','invalid'];(function(_0x53d5c3,_0x332461){var _0x3fe1c5=function(_0x4c4baa){while(--_0x4c4baa){_0x53d5c3['push'](_0x53d5c3['shift']());}};_0x3fe1c5(++_0x332461);}(_0x5a7f,0x19c));var _0xf5a7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5a7f[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xf5a7('0x0'));var logger=require('../../../config/logger')(_0xf5a7('0x1'));var verticesWithRetry=[_0xf5a7('0x2'),_0xf5a7('0x3'),_0xf5a7('0x4')];var Graph=function(){this[_0xf5a7('0x5')]={};this[_0xf5a7('0x6')]={};this[_0xf5a7('0x7')]=0x0;};Graph[_0xf5a7('0x8')][_0xf5a7('0x9')]=function(_0x38615d){this[_0xf5a7('0x5')][_0x38615d['id']]=_0x38615d;this['edges'][_0x38615d['id']]=[];};Graph[_0xf5a7('0x8')]['addEdge']=function(_0xf134a0,_0x2632a1,_0x531817){this['edges'][_0xf134a0][_0xf5a7('0xa')]({'target':_0x2632a1,'condition':_0x531817});this[_0xf5a7('0x7')]+=0x1;};Graph[_0xf5a7('0x8')][_0xf5a7('0xb')]=function(){return _[_0xf5a7('0xb')](this[_0xf5a7('0x5')]);};Graph[_0xf5a7('0x8')][_0xf5a7('0xc')]=function(){return this[_0xf5a7('0x7')];};Graph[_0xf5a7('0x8')]['getVertex']=function(_0x2a82a0){return this[_0xf5a7('0x5')][_0x2a82a0];};Graph[_0xf5a7('0x8')]['traverseBFS']=function(_0x11d9ba,_0x404025){if(!this[_0xf5a7('0x5')][_0x11d9ba]){return logger[_0xf5a7('0xd')](_0xf5a7('0xe'));}var _0x243054=_0x404025(this[_0xf5a7('0x5')][_0x11d9ba]);if(!_0x243054){return logger[_0xf5a7('0xd')]('stop\x20traverse');}if(this[_0xf5a7('0x6')][_0x11d9ba][_0xf5a7('0xf')]===0x0){return logger[_0xf5a7('0xd')]('no\x20edge/s\x20available');}for(var _0x42dcf9=0x0,_0x2bb39b=[],_0x1cb89a=![];_0x42dcf9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize'];(function(_0x17dc8f,_0x4d5521){var _0x43a8f8=function(_0x5cf01b){while(--_0x5cf01b){_0x17dc8f['push'](_0x17dc8f['shift']());}};_0x43a8f8(++_0x4d5521);}(_0x8e4a,0x7d));var _0xa8e4=function(_0x179f5a,_0x441813){_0x179f5a=_0x179f5a-0x0;var _0x1d55d5=_0x8e4a[_0x179f5a];return _0x1d55d5;};'use strict';var _=require('lodash');var syncho=require(_0xa8e4('0x0'));var util=require('util');var config=require(_0xa8e4('0x1'));var logger=require(_0xa8e4('0x2'))('agi');var utilLicense=require(_0xa8e4('0x3'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require('./events')[_0xa8e4('0x4')];var projects=[];config[_0xa8e4('0x5')]=_[_0xa8e4('0x6')](config[_0xa8e4('0x5')],{'ip':_0xa8e4('0x7'),'port':0x11dd});AGIEmitter['on'](_0xa8e4('0x8'),projectUpdateHandler);function connectionHandler(_0x46f131){process[_0xa8e4('0x9')](function(){syncho(function(){try{setChannelVariables(_0x46f131);agiHandler(_0x46f131);}catch(_0x3d370f){logger[_0xa8e4('0xa')](_0x3d370f[_0xa8e4('0xb')]);}});});}function projectUpdateHandler(_0x8bc280){try{var _0x3d04be=_[_0xa8e4('0xc')](projects,['id',_0x8bc280['id']]);if(_0x3d04be>-0x1){if(_0x8bc280['deleted']===!![]){projects[_0xa8e4('0xd')](_0x3d04be,0x1);}else{projects[_0x3d04be]=_0x8bc280;}}else{projects['push'](_0x8bc280);}}catch(_0x188b66){logger[_0xa8e4('0xa')](_0x188b66[_0xa8e4('0xb')]);}}function listeningHandler(){console[_0xa8e4('0xe')](_0xa8e4('0xf'),config[_0xa8e4('0x5')]['port']);logger[_0xa8e4('0x10')](util[_0xa8e4('0x11')](_0xa8e4('0x12'),config[_0xa8e4('0x5')]['ip'],config['agi'][_0xa8e4('0x13')]));}function errorHandler(_0x5ee188){if(_0x5ee188&&_0x5ee188[_0xa8e4('0x14')]&&_0x5ee188['message']){logger['error'](util['format'](_0xa8e4('0x15'),_0x5ee188[_0xa8e4('0x14')],_0x5ee188['message']));}else{logger[_0xa8e4('0xa')](util['format'](_0xa8e4('0x16'),_0x5ee188[_0xa8e4('0xb')]));}}function closeHandler(){logger[_0xa8e4('0x10')](util[_0xa8e4('0x11')](_0xa8e4('0x17'),this['arg_1'],this[_0xa8e4('0x18')],this[_0xa8e4('0x19')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x1c344a){logger[_0xa8e4('0xa')](_0x1c344a[_0xa8e4('0xb')]);}}function timeoutHandler(){logger[_0xa8e4('0x10')](util[_0xa8e4('0x11')](_0xa8e4('0x1a'),this[_0xa8e4('0x1b')],this['calleridname'],this[_0xa8e4('0x19')],this[_0xa8e4('0x1c')],this[_0xa8e4('0x1d')]));}function hangupHandler(){logger[_0xa8e4('0x10')](util['format'](_0xa8e4('0x1e'),this['arg_1'],this[_0xa8e4('0x18')],this[_0xa8e4('0x19')],this[_0xa8e4('0x1c')],this[_0xa8e4('0x1d')]));this[_0xa8e4('0x1f')]=!![];}function createSquareReport(_0x4c1c78,_0x43b24e){rpc[_0xa8e4('0x20')](_0x4c1c78)[_0xa8e4('0x21')](function(_0x56d7ad){if(_0x43b24e){_0x43b24e(null,_0x56d7ad);}})[_0xa8e4('0x22')](function(_0x79c1eb){if(_0x43b24e){_0x43b24e(null,_0x79c1eb);}});}function setChannelVariables(_0x19bf79){for(var _0xea85ab in _0x19bf79){if(_0x19bf79[_0xa8e4('0x23')](_0xea85ab)){if(_0xea85ab[_0xa8e4('0x24')](_0xa8e4('0x25'))===0x0){_0x19bf79[_0xea85ab[_0xa8e4('0x26')](0x4)]=_0x19bf79[_0xea85ab];delete _0x19bf79[_0xea85ab];}}}}function agiHandler(_0x150fb0){logger[_0xa8e4('0x27')](_0xa8e4('0x28'),JSON['stringify'](_0x150fb0,null,0x2));logger[_0xa8e4('0x10')](util[_0xa8e4('0x11')](_0xa8e4('0x29'),_0x150fb0['arg_1'],_0x150fb0[_0xa8e4('0x18')],_0x150fb0[_0xa8e4('0x19')],_0x150fb0[_0xa8e4('0x1c')],_0x150fb0[_0xa8e4('0x1d')]));_0x150fb0['on'](_0xa8e4('0xa'),errorHandler);_0x150fb0['on'](_0xa8e4('0x2a'),closeHandler);_0x150fb0['on'](_0xa8e4('0x2b'),timeoutHandler);_0x150fb0[_0xa8e4('0x1f')]=![];_0x150fb0['on'](_0xa8e4('0x2c'),hangupHandler);var _0x5dabd1=_['find'](projects,['name',_0x150fb0[_0xa8e4('0x1b')]]);if(!_0x5dabd1)return Project[_0xa8e4('0x2d')](_0x150fb0);if(!_0x5dabd1[_0xa8e4('0x2e')])return Project[_0xa8e4('0x2f')](_0x150fb0);return Project[_0xa8e4('0x30')](_0x5dabd1,_0x150fb0);}function main(){var _0x15e765;return utilLicense[_0xa8e4('0x31')]()[_0xa8e4('0x21')](function(_0x49767d){if(!_0x49767d)return;if(_0x49767d['voice']){if(_0x49767d['callysquare']&&_0x49767d[_0xa8e4('0x32')]>0x0){logger[_0xa8e4('0x10')](util['format'](_0xa8e4('0x33'),_0x49767d[_0xa8e4('0x32')]));_0x15e765=_0x49767d[_0xa8e4('0x32')];}else{logger['info'](_0xa8e4('0x34'));}}else{logger['info'](_0xa8e4('0x35'));_0x15e765=-0x1;}})[_0xa8e4('0x21')](function(){return Project[_0xa8e4('0x36')]();})[_0xa8e4('0x21')](function(_0x4585c1){projects=_0x4585c1;return;})[_0xa8e4('0x22')](function(_0x4be5d6){logger[_0xa8e4('0xa')]('[LICENSE]',_0x4be5d6[_0xa8e4('0xb')]);})[_0xa8e4('0x37')](function(){var _0x54a521=require(_0xa8e4('0x38'))(config[_0xa8e4('0x5')][_0xa8e4('0x13')],config[_0xa8e4('0x5')]['ip'],_0x15e765);_0x54a521['on'](_0xa8e4('0xa'),errorHandler);_0x54a521['on'](_0xa8e4('0x39'),listeningHandler);_0x54a521['on']('connection',connectionHandler);_0x54a521['on'](_0xa8e4('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0xa372=['defaults','127.0.0.1','error','stack','findIndex','deleted','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','name','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','then','catch','indexOf','agi_','substring','variables','stringify','close','timeout','hangup','find','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','lodash','syncho','../../config/logger','agi','../../config/license/util','./events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa372,0x1f4));var _0x2a37=function(_0x31f216,_0x5ea0d3){_0x31f216=_0x31f216-0x0;var _0x4fcada=_0xa372[_0x31f216];return _0x4fcada;};'use strict';var _=require(_0x2a37('0x0'));var syncho=require(_0x2a37('0x1'));var util=require('util');var config=require('../../config/environment');var logger=require(_0x2a37('0x2'))(_0x2a37('0x3'));var utilLicense=require(_0x2a37('0x4'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0x2a37('0x5'))['EventEmitter'];var projects=[];config[_0x2a37('0x3')]=_[_0x2a37('0x6')](config[_0x2a37('0x3')],{'ip':_0x2a37('0x7'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5af98d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x5af98d);agiHandler(_0x5af98d);}catch(_0x311619){logger[_0x2a37('0x8')](_0x311619[_0x2a37('0x9')]);}});});}function projectUpdateHandler(_0x2a9fc5){try{var _0x41ddaf=_[_0x2a37('0xa')](projects,['id',_0x2a9fc5['id']]);if(_0x41ddaf>-0x1){if(_0x2a9fc5[_0x2a37('0xb')]===!![]){projects['splice'](_0x41ddaf,0x1);}else{projects[_0x41ddaf]=_0x2a9fc5;}}else{projects['push'](_0x2a9fc5);}}catch(_0x30cccb){logger[_0x2a37('0x8')](_0x30cccb['stack']);}}function listeningHandler(){console['log'](_0x2a37('0xc'),config[_0x2a37('0x3')][_0x2a37('0xd')]);logger[_0x2a37('0xe')](util[_0x2a37('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x2a37('0x3')]['ip'],config[_0x2a37('0x3')][_0x2a37('0xd')]));}function errorHandler(_0x1c338e){if(_0x1c338e&&_0x1c338e[_0x2a37('0x10')]&&_0x1c338e['message']){logger[_0x2a37('0x8')](util['format'](_0x2a37('0x11'),_0x1c338e[_0x2a37('0x10')],_0x1c338e['message']));}else{logger[_0x2a37('0x8')](util['format'](_0x2a37('0x12'),_0x1c338e[_0x2a37('0x9')]));}}function closeHandler(){logger[_0x2a37('0xe')](util[_0x2a37('0xf')](_0x2a37('0x13'),this[_0x2a37('0x14')],this['calleridname'],this['callerid'],this[_0x2a37('0x15')],this[_0x2a37('0x16')]));try{createSquareReport(this);}catch(_0x50d23d){logger[_0x2a37('0x8')](_0x50d23d['stack']);}}function timeoutHandler(){logger[_0x2a37('0xe')](util[_0x2a37('0xf')](_0x2a37('0x17'),this[_0x2a37('0x14')],this['calleridname'],this['callerid'],this['dnid'],this['uniqueid']));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2a37('0x14')],this[_0x2a37('0x18')],this[_0x2a37('0x19')],this['dnid'],this[_0x2a37('0x16')]));this['evtHangup']=!![];}function createSquareReport(_0xf1e876,_0x137538){rpc['createSquareReport'](_0xf1e876)[_0x2a37('0x1a')](function(_0x2a53cb){if(_0x137538){_0x137538(null,_0x2a53cb);}})[_0x2a37('0x1b')](function(_0x170eb5){if(_0x137538){_0x137538(null,_0x170eb5);}});}function setChannelVariables(_0xfbfc48){for(var _0x2bf850 in _0xfbfc48){if(_0xfbfc48['hasOwnProperty'](_0x2bf850)){if(_0x2bf850[_0x2a37('0x1c')](_0x2a37('0x1d'))===0x0){_0xfbfc48[_0x2bf850[_0x2a37('0x1e')](0x4)]=_0xfbfc48[_0x2bf850];delete _0xfbfc48[_0x2bf850];}}}}function agiHandler(_0x3da32b){logger['debug'](_0x2a37('0x1f'),JSON[_0x2a37('0x20')](_0x3da32b,null,0x2));logger[_0x2a37('0xe')](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3da32b[_0x2a37('0x14')],_0x3da32b[_0x2a37('0x18')],_0x3da32b[_0x2a37('0x19')],_0x3da32b['dnid'],_0x3da32b[_0x2a37('0x16')]));_0x3da32b['on'](_0x2a37('0x8'),errorHandler);_0x3da32b['on'](_0x2a37('0x21'),closeHandler);_0x3da32b['on'](_0x2a37('0x22'),timeoutHandler);_0x3da32b['evtHangup']=![];_0x3da32b['on'](_0x2a37('0x23'),hangupHandler);var _0x41dcaa=_[_0x2a37('0x24')](projects,[_0x2a37('0x10'),_0x3da32b['arg_1']]);if(!_0x41dcaa)return Project['handleNotFound'](_0x3da32b);if(!_0x41dcaa[_0x2a37('0x25')])return Project[_0x2a37('0x26')](_0x3da32b);return Project[_0x2a37('0x27')](_0x41dcaa,_0x3da32b);}function main(){var _0x2c116d;return utilLicense[_0x2a37('0x28')]()[_0x2a37('0x1a')](function(_0x30d5bc){if(!_0x30d5bc)return;if(_0x30d5bc[_0x2a37('0x29')]){if(_0x30d5bc[_0x2a37('0x2a')]&&_0x30d5bc[_0x2a37('0x2a')]>0x0){logger[_0x2a37('0xe')](util[_0x2a37('0xf')](_0x2a37('0x2b'),_0x30d5bc['callysquare']));_0x2c116d=_0x30d5bc[_0x2a37('0x2a')];}else{logger[_0x2a37('0xe')](_0x2a37('0x2c'));}}else{logger[_0x2a37('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x2c116d=-0x1;}})[_0x2a37('0x1a')](function(){return Project['getAll']();})['then'](function(_0x51ef40){projects=_0x51ef40;return;})[_0x2a37('0x1b')](function(_0x154e8f){logger['error'](_0x2a37('0x2d'),_0x154e8f[_0x2a37('0x9')]);})['finally'](function(){var _0xeaba08=require('./server')(config[_0x2a37('0x3')]['port'],config[_0x2a37('0x3')]['ip'],_0x2c116d);_0xeaba08['on'](_0x2a37('0x8'),errorHandler);_0xeaba08['on']('listening',listeningHandler);_0xeaba08['on']('connection',connectionHandler);_0xeaba08['on'](_0x2a37('0x21'),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 a00ae64..c94642c 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 _0x5bd8=['error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client','request','then'];(function(_0x819ce,_0xf25f51){var _0x1edcf0=function(_0x192389){while(--_0x192389){_0x819ce['push'](_0x819ce['shift']());}};_0x1edcf0(++_0xf25f51);}(_0x5bd8,0x1e5));var _0x85bd=function(_0x2a0d2c,_0x202267){_0x2a0d2c=_0x2a0d2c-0x0;var _0x460dd8=_0x5bd8[_0x2a0d2c];return _0x460dd8;};'use strict';var BPromise=require(_0x85bd('0x0'));var jayson=require(_0x85bd('0x1'));var client=jayson[_0x85bd('0x2')]['http']({'port':0x232b});function request(_0x429c47,_0x337a2d){return new BPromise(function(_0xcfd267,_0x4216b1){return client[_0x85bd('0x3')](_0x429c47,_0x337a2d)[_0x85bd('0x4')](function(_0x439525){if(_0x439525[_0x85bd('0x5')]){return _0x4216b1(_0x439525[_0x85bd('0x5')][_0x85bd('0x6')]);}else{return _0xcfd267(_0x439525[_0x85bd('0x7')]);}})[_0x85bd('0x8')](function(_0x495dd5){return _0x4216b1(_0x495dd5);});});}exports[_0x85bd('0x9')]=function(_0x54782c,_0x2fef86){return request('SendMail',{'account':_0x54782c,'message':_0x2fef86});}; \ No newline at end of file +var _0x003d=['catch','SendMail','bluebird','http','request','then','error','message','result'];(function(_0x3c601d,_0x1252ae){var _0x3da0e9=function(_0x3697ed){while(--_0x3697ed){_0x3c601d['push'](_0x3c601d['shift']());}};_0x3da0e9(++_0x1252ae);}(_0x003d,0x1a0));var _0xd003=function(_0x5f4ffb,_0x2cf3a9){_0x5f4ffb=_0x5f4ffb-0x0;var _0x1793e7=_0x003d[_0x5f4ffb];return _0x1793e7;};'use strict';var BPromise=require(_0xd003('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd003('0x1')]({'port':0x232b});function request(_0x511982,_0x1a236e){return new BPromise(function(_0xcbd135,_0x328659){return client[_0xd003('0x2')](_0x511982,_0x1a236e)[_0xd003('0x3')](function(_0x238f63){if(_0x238f63[_0xd003('0x4')]){return _0x328659(_0x238f63[_0xd003('0x4')][_0xd003('0x5')]);}else{return _0xcbd135(_0x238f63[_0xd003('0x6')]);}})[_0xd003('0x7')](function(_0x549f2a){return _0x328659(_0x549f2a);});});}exports['sendMailMessage']=function(_0x4fa4ed,_0x4f2a97){return request(_0xd003('0x8'),{'account':_0x4fa4ed,'message':_0x4f2a97});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index d309c81..c227c0d 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 _0x3a75=['result','evtHangup','toString','error','agicommand\x20not\x20found','finally','uniqueid','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','close','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','length','source','target','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','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','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code'];(function(_0x3656f1,_0x42148a){var _0x1846c8=function(_0x5ab029){while(--_0x5ab029){_0x3656f1['push'](_0x3656f1['shift']());}};_0x1846c8(++_0x42148a);}(_0x3a75,0x182));var _0x53a7=function(_0x7740b6,_0x505547){_0x7740b6=_0x7740b6-0x0;var _0x31a778=_0x3a75[_0x7740b6];return _0x31a778;};'use strict';var _=require(_0x53a7('0x0'));var moment=require(_0x53a7('0x1'));var parser=require(_0x53a7('0x2'));var util=require(_0x53a7('0x3'));var logger=require(_0x53a7('0x4'))(_0x53a7('0x5'));var rpc=require(_0x53a7('0x6'));var mailRpc=require(_0x53a7('0x7'));var Graph=require(_0x53a7('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x53a7('0x9')]()[_0x53a7('0xa')](function(_0x57ca32){logger['error'](_0x53a7('0xb'),_0x57ca32[_0x53a7('0xc')]);return[];});}function addVertex(_0x10405d,_0x190744,_0x18e192){_0x190744[_0x53a7('0xd')]=_0x18e192;if(_0x190744[_0x53a7('0xe')](_0x53a7('0xf'))){_0x190744[_0x53a7('0x10')]=parseInt(_0x190744[_0x53a7('0xf')],0xa);}_0x10405d['addVertex'](_[_0x53a7('0x11')](_0x190744,_0x53a7('0x12')));}function initGraph(_0x589c50,_0x364ed3){var _0x2c3cd9=new Graph();for(var _0x117073 in _0x589c50){if(_0x589c50[_0x53a7('0xe')](_0x117073)){if(_['isArray'](_0x589c50[_0x117073])){for(var _0x3d8a07=0x0;_0x3d8a07<_0x589c50[_0x117073]['length'];_0x3d8a07+=0x1){addVertex(_0x2c3cd9,_0x589c50[_0x117073][_0x3d8a07],_0x117073);}}else{addVertex(_0x2c3cd9,_0x589c50[_0x117073],_0x117073);}}}for(var _0x39e9b4=0x0;_0x39e9b4<_0x364ed3[_0x53a7('0x13')];_0x39e9b4+=0x1){if(_0x364ed3[_0x39e9b4][_0x53a7('0x14')]&&_0x364ed3[_0x39e9b4][_0x53a7('0x15')]){_0x2c3cd9['addEdge'](_0x364ed3[_0x39e9b4][_0x53a7('0x14')],_0x364ed3[_0x39e9b4][_0x53a7('0x15')],_0x364ed3[_0x39e9b4][_0x53a7('0x16')]);}}return _0x2c3cd9;}function getRoot(_0x974719){return parser[_0x53a7('0x17')](_0x974719,{'object':!![]})[_0x53a7('0x18')][_0x53a7('0x19')];}function inspect(_0x5553bd){return util[_0x53a7('0x1a')](_0x5553bd,{'showHidden':![],'depth':null});}function initialize(_0x4d11cd,_0x541e71){var _0x1f7ed0=getRoot(_0x4d11cd[_0x53a7('0x1b')]);if(!_0x1f7ed0||!_0x1f7ed0[_0x53a7('0x1c')])return;var _0x4b794f,_0x2e9d91,_0x4df1f8;logger[_0x53a7('0x1d')](_0x53a7('0x19'),JSON[_0x53a7('0x1e')](_0x1f7ed0,null,0x2));_0x541e71[_0x53a7('0x1f')]=moment()[_0x53a7('0x20')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b794f=initGraph(_[_0x53a7('0x11')](_0x1f7ed0,_0x53a7('0x12')),_0x1f7ed0[_0x53a7('0x12')]);_0x2e9d91=new Vertices(_0x541e71,rpc,mailRpc);logger[_0x53a7('0x21')](util[_0x53a7('0x20')](_0x53a7('0x22'),_0x541e71[_0x53a7('0x23')],_0x541e71[_0x53a7('0x24')],_0x541e71[_0x53a7('0x25')],_0x541e71[_0x53a7('0x26')],_0x541e71['uniqueid']));_0x4b794f[_0x53a7('0x27')](_0x1f7ed0[_0x53a7('0x1c')]['id'],function(_0x2e8a02){try{_0x2e8a02=_0x2e9d91['clear'](_0x2e8a02);logger[_0x53a7('0x1d')](_0x53a7('0x28'),JSON[_0x53a7('0x1e')](_0x2e8a02,null,0x2));if(_0x2e8a02[_0x53a7('0xd')]===_0x53a7('0x29')){logger[_0x53a7('0x21')](_0x53a7('0x2a'));_0x541e71[_0x53a7('0x2b')]=_0x2e8a02[_0x53a7('0x2b')]||_0x541e71['context'];_0x541e71[_0x53a7('0x2c')]=_0x2e8a02[_0x53a7('0x2c')];_0x541e71[_0x53a7('0x2d')]=_0x2e8a02[_0x53a7('0x2d')]?_0x2e8a02[_0x53a7('0x2d')]-0x1:0x1;return null;}else if(_0x2e8a02&&_0x2e9d91[_0x2e8a02[_0x53a7('0xd')]]){_0x4df1f8=_0x2e9d91[_0x2e8a02[_0x53a7('0xd')]](_0x2e8a02);logger['info'](_0x53a7('0x2e'),JSON['stringify'](_0x4df1f8,null,0x2));if(_0x4df1f8&&_0x4df1f8[_0x53a7('0x2f')]===AGI_CODE_SUCCESS&&_0x4df1f8[_0x53a7('0x30')]!==AGI_RESULT_ERROR&&!_0x541e71[_0x53a7('0x31')]){logger[_0x53a7('0x1d')]('response',inspect(_0x4df1f8));return _['isUndefined'](_0x4df1f8[_0x53a7('0x30')])?null:_0x4df1f8['result'][_0x53a7('0x32')]();}else{logger[_0x53a7('0x33')]('response',inspect(_0x4df1f8));return null;}}else{logger['error'](_0x53a7('0x34'));return null;}}catch(_0x3f496f){logger['error'](_0x3f496f[_0x53a7('0xc')]);return null;}});if(_0x1f7ed0[_0x53a7('0x35')]){logger[_0x53a7('0x21')](util[_0x53a7('0x20')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x541e71[_0x53a7('0x23')],_0x541e71[_0x53a7('0x24')],_0x541e71['callerid'],_0x541e71['dnid'],_0x541e71[_0x53a7('0x36')]));_0x4b794f[_0x53a7('0x27')](_0x1f7ed0[_0x53a7('0x35')]['id'],function(_0x4be9fa){try{_0x4be9fa=_0x2e9d91['clear'](_0x4be9fa);logger[_0x53a7('0x1d')](_0x53a7('0x28'),JSON[_0x53a7('0x1e')](_0x4be9fa,null,0x2));if(_0x4be9fa&&_0x2e9d91[_0x4be9fa[_0x53a7('0xd')]]){_0x4df1f8=_0x2e9d91[_0x4be9fa[_0x53a7('0xd')]](_0x4be9fa);if(_0x4df1f8){logger['debug'](_0x53a7('0x2e'),inspect(_0x4df1f8));return _[_0x53a7('0x37')](_0x4df1f8[_0x53a7('0x30')])?null:_0x4df1f8['result'][_0x53a7('0x32')]();}else{logger[_0x53a7('0x33')](_0x53a7('0x2e'),inspect(_0x4df1f8));return null;}}else{logger[_0x53a7('0x33')](_0x53a7('0x34'));return null;}}catch(_0x1bba74){logger[_0x53a7('0x33')](_0x1bba74[_0x53a7('0xc')]);return null;}});}logger[_0x53a7('0x21')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x541e71[_0x53a7('0x23')],_0x541e71[_0x53a7('0x24')],_0x541e71[_0x53a7('0x25')],_0x541e71[_0x53a7('0x26')],_0x541e71[_0x53a7('0x36')]));logger[_0x53a7('0x21')](util[_0x53a7('0x20')](_0x53a7('0x38'),_0x541e71[_0x53a7('0x2b')],_0x541e71['extension'],parseInt(_0x541e71['priority'],0xa)+0x1));_0x541e71[_0x53a7('0x39')](_0x541e71[_0x53a7('0x2b')],_0x541e71[_0x53a7('0x2c')],parseInt(_0x541e71[_0x53a7('0x2d')],0xa)+0x1);_0x541e71['close']();}function handleNotFound(_0x8704a4){logger[_0x53a7('0x33')](util[_0x53a7('0x20')](_0x53a7('0x3a'),_0x8704a4[_0x53a7('0x23')]));_0x8704a4[_0x53a7('0x39')](_0x8704a4['context'],_0x8704a4[_0x53a7('0x2c')],parseInt(_0x8704a4['priority'],0xa)+0x1);_0x8704a4['close']();}function handleUnpublished(_0x33532e){logger[_0x53a7('0x33')](util[_0x53a7('0x20')](_0x53a7('0x3b'),_0x33532e['arg_1']));_0x33532e[_0x53a7('0x39')](_0x33532e[_0x53a7('0x2b')],_0x33532e[_0x53a7('0x2c')],parseInt(_0x33532e['priority'],0xa)+0x1);_0x33532e[_0x53a7('0x3c')]();}module[_0x53a7('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xc549=['arg_1','callerid','dnid','uniqueid','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','result','evtHangup','isUndefined','toString','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','traverseBFS','clear','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','extension','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','source','target','addEdge','inspect','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc549,0x14a));var _0x9c54=function(_0x2e50c2,_0x32cd42){_0x2e50c2=_0x2e50c2-0x0;var _0x103160=_0xc549[_0x2e50c2];return _0x103160;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x9c54('0x0'));var util=require(_0x9c54('0x1'));var logger=require(_0x9c54('0x2'))(_0x9c54('0x3'));var rpc=require(_0x9c54('0x4'));var mailRpc=require(_0x9c54('0x5'));var Graph=require('./graph');var Vertices=require(_0x9c54('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9c54('0x7')]()[_0x9c54('0x8')](function(_0x11237e){logger['error'](_0x9c54('0x9'),_0x11237e[_0x9c54('0xa')]);return[];});}function addVertex(_0x5b98ab,_0x514c43,_0x3a41d4){_0x514c43[_0x9c54('0xb')]=_0x3a41d4;if(_0x514c43[_0x9c54('0xc')]('retry')){_0x514c43[_0x9c54('0xd')]=parseInt(_0x514c43[_0x9c54('0xe')],0xa);}_0x5b98ab[_0x9c54('0xf')](_[_0x9c54('0x10')](_0x514c43,'mxCell'));}function initGraph(_0x5c6e56,_0x29bcf7){var _0x5a4bd0=new Graph();for(var _0x55e91d in _0x5c6e56){if(_0x5c6e56[_0x9c54('0xc')](_0x55e91d)){if(_[_0x9c54('0x11')](_0x5c6e56[_0x55e91d])){for(var _0x35cf4f=0x0;_0x35cf4f<_0x5c6e56[_0x55e91d][_0x9c54('0x12')];_0x35cf4f+=0x1){addVertex(_0x5a4bd0,_0x5c6e56[_0x55e91d][_0x35cf4f],_0x55e91d);}}else{addVertex(_0x5a4bd0,_0x5c6e56[_0x55e91d],_0x55e91d);}}}for(var _0x28d68f=0x0;_0x28d68f<_0x29bcf7['length'];_0x28d68f+=0x1){if(_0x29bcf7[_0x28d68f][_0x9c54('0x13')]&&_0x29bcf7[_0x28d68f][_0x9c54('0x14')]){_0x5a4bd0[_0x9c54('0x15')](_0x29bcf7[_0x28d68f][_0x9c54('0x13')],_0x29bcf7[_0x28d68f][_0x9c54('0x14')],_0x29bcf7[_0x28d68f]['value']);}}return _0x5a4bd0;}function getRoot(_0x2442e7){return parser['toJson'](_0x2442e7,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x1235fb){return util[_0x9c54('0x16')](_0x1235fb,{'showHidden':![],'depth':null});}function initialize(_0x505f0b,_0x1a030e){var _0x5e240f=getRoot(_0x505f0b['production']);if(!_0x5e240f||!_0x5e240f['start'])return;var _0x14817b,_0x2620dc,_0x5f0f2f;logger[_0x9c54('0x17')](_0x9c54('0x18'),JSON[_0x9c54('0x19')](_0x5e240f,null,0x2));_0x1a030e['joinAt']=moment()[_0x9c54('0x1a')](_0x9c54('0x1b'));_0x14817b=initGraph(_[_0x9c54('0x10')](_0x5e240f,_0x9c54('0x1c')),_0x5e240f[_0x9c54('0x1c')]);_0x2620dc=new Vertices(_0x1a030e,rpc,mailRpc);logger[_0x9c54('0x1d')](util[_0x9c54('0x1a')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x1a030e[_0x9c54('0x1e')],_0x1a030e['calleridname'],_0x1a030e[_0x9c54('0x1f')],_0x1a030e[_0x9c54('0x20')],_0x1a030e[_0x9c54('0x21')]));_0x14817b['traverseBFS'](_0x5e240f['start']['id'],function(_0x14cbc1){try{_0x14cbc1=_0x2620dc['clear'](_0x14cbc1);logger[_0x9c54('0x17')]('vertex',JSON['stringify'](_0x14cbc1,null,0x2));if(_0x14cbc1[_0x9c54('0xb')]===_0x9c54('0x22')){logger['info'](_0x9c54('0x23'));_0x1a030e[_0x9c54('0x24')]=_0x14cbc1[_0x9c54('0x24')]||_0x1a030e[_0x9c54('0x24')];_0x1a030e['extension']=_0x14cbc1['extension'];_0x1a030e['priority']=_0x14cbc1[_0x9c54('0x25')]?_0x14cbc1['priority']-0x1:0x1;return null;}else if(_0x14cbc1&&_0x2620dc[_0x14cbc1[_0x9c54('0xb')]]){_0x5f0f2f=_0x2620dc[_0x14cbc1[_0x9c54('0xb')]](_0x14cbc1);logger[_0x9c54('0x1d')](_0x9c54('0x26'),JSON[_0x9c54('0x19')](_0x5f0f2f,null,0x2));if(_0x5f0f2f&&_0x5f0f2f[_0x9c54('0x27')]===AGI_CODE_SUCCESS&&_0x5f0f2f[_0x9c54('0x28')]!==AGI_RESULT_ERROR&&!_0x1a030e[_0x9c54('0x29')]){logger[_0x9c54('0x17')](_0x9c54('0x26'),inspect(_0x5f0f2f));return _[_0x9c54('0x2a')](_0x5f0f2f[_0x9c54('0x28')])?null:_0x5f0f2f[_0x9c54('0x28')][_0x9c54('0x2b')]();}else{logger[_0x9c54('0x2c')](_0x9c54('0x26'),inspect(_0x5f0f2f));return null;}}else{logger[_0x9c54('0x2c')](_0x9c54('0x2d'));return null;}}catch(_0xeeb626){logger[_0x9c54('0x2c')](_0xeeb626[_0x9c54('0xa')]);return null;}});if(_0x5e240f[_0x9c54('0x2e')]){logger[_0x9c54('0x1d')](util[_0x9c54('0x1a')](_0x9c54('0x2f'),_0x1a030e[_0x9c54('0x1e')],_0x1a030e[_0x9c54('0x30')],_0x1a030e[_0x9c54('0x1f')],_0x1a030e[_0x9c54('0x20')],_0x1a030e[_0x9c54('0x21')]));_0x14817b[_0x9c54('0x31')](_0x5e240f[_0x9c54('0x2e')]['id'],function(_0x43a06d){try{_0x43a06d=_0x2620dc[_0x9c54('0x32')](_0x43a06d);logger[_0x9c54('0x17')](_0x9c54('0x33'),JSON[_0x9c54('0x19')](_0x43a06d,null,0x2));if(_0x43a06d&&_0x2620dc[_0x43a06d[_0x9c54('0xb')]]){_0x5f0f2f=_0x2620dc[_0x43a06d['agicommand']](_0x43a06d);if(_0x5f0f2f){logger[_0x9c54('0x17')](_0x9c54('0x26'),inspect(_0x5f0f2f));return _['isUndefined'](_0x5f0f2f['result'])?null:_0x5f0f2f['result']['toString']();}else{logger[_0x9c54('0x2c')](_0x9c54('0x26'),inspect(_0x5f0f2f));return null;}}else{logger['error'](_0x9c54('0x2d'));return null;}}catch(_0x830954){logger[_0x9c54('0x2c')](_0x830954[_0x9c54('0xa')]);return null;}});}logger[_0x9c54('0x1d')](util[_0x9c54('0x1a')](_0x9c54('0x34'),_0x1a030e['arg_1'],_0x1a030e[_0x9c54('0x30')],_0x1a030e[_0x9c54('0x1f')],_0x1a030e[_0x9c54('0x20')],_0x1a030e[_0x9c54('0x21')]));logger[_0x9c54('0x1d')](util[_0x9c54('0x1a')](_0x9c54('0x35'),_0x1a030e[_0x9c54('0x24')],_0x1a030e[_0x9c54('0x36')],parseInt(_0x1a030e[_0x9c54('0x25')],0xa)+0x1));_0x1a030e[_0x9c54('0x37')](_0x1a030e[_0x9c54('0x24')],_0x1a030e[_0x9c54('0x36')],parseInt(_0x1a030e[_0x9c54('0x25')],0xa)+0x1);_0x1a030e[_0x9c54('0x38')]();}function handleNotFound(_0x2b020f){logger[_0x9c54('0x2c')](util[_0x9c54('0x1a')](_0x9c54('0x39'),_0x2b020f[_0x9c54('0x1e')]));_0x2b020f[_0x9c54('0x37')](_0x2b020f[_0x9c54('0x24')],_0x2b020f[_0x9c54('0x36')],parseInt(_0x2b020f[_0x9c54('0x25')],0xa)+0x1);_0x2b020f[_0x9c54('0x38')]();}function handleUnpublished(_0x6101e9){logger[_0x9c54('0x2c')](util[_0x9c54('0x1a')](_0x9c54('0x3a'),_0x6101e9[_0x9c54('0x1e')]));_0x6101e9[_0x9c54('0x37')](_0x6101e9['context'],_0x6101e9[_0x9c54('0x36')],parseInt(_0x6101e9[_0x9c54('0x25')],0xa)+0x1);_0x6101e9[_0x9c54('0x38')]();}module[_0x9c54('0x3b')]={'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 417e629..17b30e7 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 _0xcd18=['util','stream','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','length','split','slice','trim','emit','headers','exports'];(function(_0x699200,_0x39c101){var _0x266fd1=function(_0x1a9368){while(--_0x1a9368){_0x699200['push'](_0x699200['shift']());}};_0x266fd1(++_0x39c101);}(_0xcd18,0xb4));var _0x8cd1=function(_0x55ece4,_0x511ff4){_0x55ece4=_0x55ece4-0x0;var _0x2723b0=_0xcd18[_0x55ece4];return _0x2723b0;};'use strict';var util=require(_0x8cd1('0x0'));var Transform=require(_0x8cd1('0x1'))['Transform'];function AGIReply(_0x15c9ef){Transform[_0x8cd1('0x2')](this,_0x15c9ef);this['_localBuffer']='';this[_0x8cd1('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x8cd1('0x4')][_0x8cd1('0x5')]=function(_0x5b152d,_0x12a9b7,_0x2b6649){var _0x2d35e4='\x0a',_0x375f15=['\x0a\x0a',_0x8cd1('0x6')],_0x16eecb=-0x1,_0x3cd29b=-0x1,_0x10b229='',_0x52b6fd=0x0,_0x9abcc7='',_0x6a7f9b='';this[_0x8cd1('0x7')]+=_0x5b152d[_0x8cd1('0x8')]();_0x9abcc7=this[_0x8cd1('0x7')];if(!this[_0x8cd1('0x3')]){_0x52b6fd=0x0;while(_0x375f15[_0x52b6fd]){while((_0x3cd29b=_0x9abcc7[_0x8cd1('0x9')](_0x375f15[_0x52b6fd]))!=-0x1){_0x10b229=_0x375f15[_0x52b6fd];_0x6a7f9b=_0x9abcc7['substring'](0x0,_0x3cd29b);_0x9abcc7=_0x9abcc7[_0x8cd1('0xa')](_0x3cd29b+_0x10b229[_0x8cd1('0xb')]);var _0x564c99=_0x6a7f9b[_0x8cd1('0xc')](_0x2d35e4),_0x41a984=0x0,_0xf5d628={},_0x5acfd3='',_0x27c04e='',_0x22cbc7=-0x1;while(_0x564c99[_0x41a984]){_0x22cbc7=_0x564c99[_0x41a984]['indexOf'](':');if(_0x22cbc7!=-0x1){_0x5acfd3=_0x564c99[_0x41a984][_0x8cd1('0xd')](0x0,_0x22cbc7)[_0x8cd1('0xe')]();_0x27c04e=_0x564c99[_0x41a984][_0x8cd1('0xd')](_0x22cbc7+0x1)[_0x8cd1('0xe')]();if(_0x5acfd3[_0x8cd1('0xb')]>0x0){_0xf5d628[_0x5acfd3]=_0x27c04e;}}else{}_0x41a984++;}this[_0x8cd1('0xf')](_0x8cd1('0x10'),_0xf5d628);this[_0x8cd1('0x3')]=!![];}_0x52b6fd++;}this['_localBuffer']=_0x9abcc7;}else{while((_0x16eecb=_0x9abcc7[_0x8cd1('0x9')](_0x2d35e4))!=-0x1){_0x6a7f9b=_0x9abcc7[_0x8cd1('0xa')](0x0,_0x16eecb);this[_0x8cd1('0xf')]('line',_0x6a7f9b);_0x9abcc7=_0x9abcc7[_0x8cd1('0xa')](_0x16eecb+_0x2d35e4[_0x8cd1('0xb')]);}this['_localBuffer']=_0x9abcc7;}_0x2b6649();};module[_0x8cd1('0x11')]=AGIReply; \ No newline at end of file +var _0x744b=['util','stream','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','length','slice','headers','substring','emit','exports'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0x744b,0xff));var _0xb744=function(_0x3de277,_0x45066){_0x3de277=_0x3de277-0x0;var _0x41938a=_0x744b[_0x3de277];return _0x41938a;};'use strict';var util=require(_0xb744('0x0'));var Transform=require(_0xb744('0x1'))[_0xb744('0x2')];function AGIReply(_0x4f3f33){Transform['call'](this,_0x4f3f33);this[_0xb744('0x3')]='';this[_0xb744('0x4')]=![];}util[_0xb744('0x5')](AGIReply,Transform);AGIReply[_0xb744('0x6')][_0xb744('0x7')]=function(_0x4680f9,_0x5478be,_0x17c7d5){var _0x28f40b='\x0a',_0x2f7b1f=['\x0a\x0a',_0xb744('0x8')],_0xd1dceb=-0x1,_0x1fb15a=-0x1,_0x25e4e3='',_0x4c55d8=0x0,_0x5dc296='',_0x39b915='';this[_0xb744('0x3')]+=_0x4680f9[_0xb744('0x9')]();_0x5dc296=this[_0xb744('0x3')];if(!this['_inBody']){_0x4c55d8=0x0;while(_0x2f7b1f[_0x4c55d8]){while((_0x1fb15a=_0x5dc296[_0xb744('0xa')](_0x2f7b1f[_0x4c55d8]))!=-0x1){_0x25e4e3=_0x2f7b1f[_0x4c55d8];_0x39b915=_0x5dc296['substring'](0x0,_0x1fb15a);_0x5dc296=_0x5dc296['substring'](_0x1fb15a+_0x25e4e3[_0xb744('0xb')]);var _0x5dabfb=_0x39b915['split'](_0x28f40b),_0x4bcdac=0x0,_0x4ae72b={},_0x5905e2='',_0x311c7c='',_0x3d658b=-0x1;while(_0x5dabfb[_0x4bcdac]){_0x3d658b=_0x5dabfb[_0x4bcdac]['indexOf'](':');if(_0x3d658b!=-0x1){_0x5905e2=_0x5dabfb[_0x4bcdac][_0xb744('0xc')](0x0,_0x3d658b)['trim']();_0x311c7c=_0x5dabfb[_0x4bcdac][_0xb744('0xc')](_0x3d658b+0x1)['trim']();if(_0x5905e2[_0xb744('0xb')]>0x0){_0x4ae72b[_0x5905e2]=_0x311c7c;}}else{}_0x4bcdac++;}this['emit'](_0xb744('0xd'),_0x4ae72b);this[_0xb744('0x4')]=!![];}_0x4c55d8++;}this[_0xb744('0x3')]=_0x5dc296;}else{while((_0xd1dceb=_0x5dc296[_0xb744('0xa')](_0x28f40b))!=-0x1){_0x39b915=_0x5dc296[_0xb744('0xe')](0x0,_0xd1dceb);this[_0xb744('0xf')]('line',_0x39b915);_0x5dc296=_0x5dc296[_0xb744('0xe')](_0xd1dceb+_0x28f40b[_0xb744('0xb')]);}this[_0xb744('0x3')]=_0x5dc296;}_0x17c7d5();};module[_0xb744('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index f6f7269..e5a0075 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 _0xf185=['name','getSquareProject','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','jayson/promise','client','http','request','then','error','message','result','GetSquareProjects'];(function(_0x3ce7a0,_0x482cca){var _0x1821b4=function(_0x584b8a){while(--_0x584b8a){_0x3ce7a0['push'](_0x3ce7a0['shift']());}};_0x1821b4(++_0x482cca);}(_0xf185,0x1be));var _0x5f18=function(_0x5ad219,_0x5f3e1d){_0x5ad219=_0x5ad219-0x0;var _0x5e1f82=_0xf185[_0x5ad219];return _0x5e1f82;};'use strict';var _=require(_0x5f18('0x0'));var moment=require('moment');var jayson=require(_0x5f18('0x1'));var client=jayson[_0x5f18('0x2')][_0x5f18('0x3')]({'port':0x2329});function request(_0x3100aa,_0x40e868){return new Promise(function(_0x12abae,_0x529b25){return client[_0x5f18('0x4')](_0x3100aa,_0x40e868)[_0x5f18('0x5')](function(_0x33ef71){if(_0x33ef71[_0x5f18('0x6')]){return _0x529b25(_0x33ef71['error'][_0x5f18('0x7')]);}else{return _0x12abae(_0x33ef71[_0x5f18('0x8')]);}})['catch'](function(_0x15b931){return _0x529b25(_0x15b931);});});}exports['getSquareProjects']=function(){return request(_0x5f18('0x9'),{'options':{'raw':![],'attributes':['id',_0x5f18('0xa'),'production']}});};exports[_0x5f18('0xb')]=function(_0xad0530){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xad0530},'attributes':[_0x5f18('0xc')]}});};exports[_0x5f18('0xd')]=function(_0x585b74){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x585b74},'include':[{'model':_0x5f18('0xe'),'as':_0x5f18('0xf'),'include':[{'model':_0x5f18('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0x5f18('0xa'),_0x5f18('0x11')],'smtp':!![]}});};exports[_0x5f18('0x12')]=function(_0x14debf){return request(_0x5f18('0x13'),{'options':{'where':{'id':_0x14debf},'attributes':[_0x5f18('0xa')]}});};exports[_0x5f18('0x14')]=function(_0x31c731){return request(_0x5f18('0x15'),{'options':{'where':{'id':_0x31c731},'attributes':['name']}});};exports[_0x5f18('0x16')]=function(_0x51dbc3){return request('ShowVariable',{'options':{'where':{'id':_0x51dbc3},'attributes':[_0x5f18('0xa')]}});};exports[_0x5f18('0x17')]=function(_0x12b0c1){return request(_0x5f18('0x18'),{'options':{'where':{'id':_0x12b0c1},'attributes':[_0x5f18('0x19')]}});};exports['getUserById']=function(_0x3d61bf){return request(_0x5f18('0x1a'),{'options':{'where':{'id':_0x3d61bf},'attributes':[_0x5f18('0xa')]}});};exports[_0x5f18('0x1b')]=function(_0x1d3aac){return request('GetContactByPhone',{'options':{'where':{'phone':_0x1d3aac[_0x5f18('0x1c')]},'attributes':['id']}});};exports[_0x5f18('0x1d')]=function(_0x45d684){return request('ShowTrunk',{'options':{'where':{'id':_0x45d684},'attributes':[_0x5f18('0xa')]}});};exports[_0x5f18('0x1e')]=function(_0x5ccaff){return request('ShowSound',{'options':{'where':{'id':_0x5ccaff},'attributes':[_0x5f18('0x1f')]}});};exports[_0x5f18('0x20')]=function(_0x1ccd42){return request(_0x5f18('0x21'),{'options':{'raw':![],'where':{'id':_0x1ccd42},'include':[{'model':_0x5f18('0x22'),'as':_0x5f18('0x23')}]}});};exports['getSmsAccountById']=function(_0x4c2396){return request(_0x5f18('0x24'),{'options':{'where':{'id':_0x4c2396},'attributes':['id',_0x5f18('0xa')]}});};exports['createSmsMessage']=function(_0x29552c){return request('CreateSmsMessage',{'body':_0x29552c});};exports[_0x5f18('0x25')]=function(_0x50519a){return request('CreateSquareDetailsReport',{'body':_0x50519a});};exports[_0x5f18('0x26')]=function(_0x5f5d1f){return request(_0x5f18('0x27'),{'body':_['merge'](_0x5f5d1f,{'project_name':_0x5f5d1f[_0x5f18('0x28')],'prev_project_name':_0x5f5d1f[_0x5f18('0x29')]||'','is_subproject':_0x5f5d1f[_0x5f18('0x29')]?!![]:![],'leaveAt':moment()[_0x5f18('0x2a')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5f18('0x2b')]=function(_0x11e9e8){return request(_0x5f18('0x2c'),{'body':_0x11e9e8});};exports[_0x5f18('0x2d')]=function(_0xd1340b){return request(_0x5f18('0x2e'),{'body':_0xd1340b});};exports[_0x5f18('0x2f')]=function(_0x15f5d8){return request(_0x5f18('0x30'),{'options':{'raw':![],'where':{'phone':_0x15f5d8['phone'],'ListId':_0x15f5d8[_0x5f18('0x31')]}}})['then'](function(_0x59875f){if(_0x59875f){return _0x59875f;}return request(_0x5f18('0x32'),{'body':_0x15f5d8});});};exports[_0x5f18('0x33')]=function(_0x172a4d){return request('ShowPause',{'options':{'where':{'id':_0x172a4d},'attributes':['name']}});};exports[_0x5f18('0x34')]=function(_0xdc4bb0,_0x1c00bf){return request('LoginUser',{'body':{'interface':_0x1c00bf},'options':{'where':_0xdc4bb0}});};exports[_0x5f18('0x35')]=function(_0x262dbb,_0x449616,_0x5c7014){return request(_0x5f18('0x36'),{'body':{'type':_0x449616,'uniqueid':_0x5c7014},'options':{'where':_0x262dbb}});};exports[_0x5f18('0x37')]=function(_0x388e1a){return request(_0x5f18('0x38'),{'body':{},'options':{'where':_0x388e1a}});};exports['agentLogout']=function(_0x1d8506){return request('LogoutUser',{'body':{},'options':{'where':_0x1d8506}});}; \ No newline at end of file +var _0xde6c=['ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xde6c,0x119));var _0xcde6=function(_0x185f7f,_0x42aa8b){_0x185f7f=_0x185f7f-0x0;var _0x15d436=_0xde6c[_0x185f7f];return _0x15d436;};'use strict';var _=require(_0xcde6('0x0'));var moment=require(_0xcde6('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xcde6('0x2')][_0xcde6('0x3')]({'port':0x2329});function request(_0x22fa0d,_0x31ac8c){return new Promise(function(_0x494a32,_0x145150){return client[_0xcde6('0x4')](_0x22fa0d,_0x31ac8c)[_0xcde6('0x5')](function(_0x59bc91){if(_0x59bc91[_0xcde6('0x6')]){return _0x145150(_0x59bc91[_0xcde6('0x6')]['message']);}else{return _0x494a32(_0x59bc91['result']);}})[_0xcde6('0x7')](function(_0x4f07e8){return _0x145150(_0x4f07e8);});});}exports[_0xcde6('0x8')]=function(){return request(_0xcde6('0x9'),{'options':{'raw':![],'attributes':['id',_0xcde6('0xa'),_0xcde6('0xb')]}});};exports['getSquareProject']=function(_0x34eadd){return request(_0xcde6('0xc'),{'options':{'raw':![],'where':{'name':_0x34eadd},'attributes':['production']}});};exports[_0xcde6('0xd')]=function(_0x38e9ee){return request(_0xcde6('0xe'),{'options':{'raw':![],'where':{'id':_0x38e9ee},'include':[{'model':_0xcde6('0xf'),'as':_0xcde6('0x10'),'include':[{'model':_0xcde6('0x11'),'as':_0xcde6('0x11')}]}],'attributes':['id',_0xcde6('0xa'),_0xcde6('0x12')],'smtp':!![]}});};exports[_0xcde6('0x13')]=function(_0x548e08){return request(_0xcde6('0xc'),{'options':{'where':{'id':_0x548e08},'attributes':[_0xcde6('0xa')]}});};exports[_0xcde6('0x14')]=function(_0x33dbdb){return request(_0xcde6('0x15'),{'options':{'where':{'id':_0x33dbdb},'attributes':[_0xcde6('0xa')]}});};exports[_0xcde6('0x16')]=function(_0x43069a){return request(_0xcde6('0x17'),{'options':{'where':{'id':_0x43069a},'attributes':[_0xcde6('0xa')]}});};exports['getSquareOdbcById']=function(_0x1b8a49){return request(_0xcde6('0x18'),{'options':{'where':{'id':_0x1b8a49},'attributes':[_0xcde6('0x19')]}});};exports['getUserById']=function(_0x54e960){return request('ShowUser',{'options':{'where':{'id':_0x54e960},'attributes':[_0xcde6('0xa')]}});};exports['getContactByPhone']=function(_0x448b99){return request(_0xcde6('0x1a'),{'options':{'where':{'phone':_0x448b99['phone']},'attributes':['id']}});};exports[_0xcde6('0x1b')]=function(_0x50400e){return request(_0xcde6('0x1c'),{'options':{'where':{'id':_0x50400e},'attributes':[_0xcde6('0xa')]}});};exports[_0xcde6('0x1d')]=function(_0x1b79dd){return request(_0xcde6('0x1e'),{'options':{'where':{'id':_0x1b79dd},'attributes':[_0xcde6('0x1f')]}});};exports[_0xcde6('0x20')]=function(_0x32baed){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x32baed},'include':[{'model':_0xcde6('0x21'),'as':_0xcde6('0x22')}]}});};exports[_0xcde6('0x23')]=function(_0x49175a){return request(_0xcde6('0x24'),{'options':{'where':{'id':_0x49175a},'attributes':['id',_0xcde6('0xa')]}});};exports['createSmsMessage']=function(_0x1ae27e){return request(_0xcde6('0x25'),{'body':_0x1ae27e});};exports[_0xcde6('0x26')]=function(_0x3be6ac){return request(_0xcde6('0x27'),{'body':_0x3be6ac});};exports[_0xcde6('0x28')]=function(_0x3dd9b8){return request(_0xcde6('0x29'),{'body':_['merge'](_0x3dd9b8,{'project_name':_0x3dd9b8[_0xcde6('0x2a')],'prev_project_name':_0x3dd9b8['arg_2']||'','is_subproject':_0x3dd9b8[_0xcde6('0x2b')]?!![]:![],'leaveAt':moment()[_0xcde6('0x2c')](_0xcde6('0x2d'))})});};exports['createSquareRecording']=function(_0x53cfaf){return request('CreateSquareRecording',{'body':_0x53cfaf});};exports[_0xcde6('0x2e')]=function(_0x2a67fa){return request(_0xcde6('0x2f'),{'body':_0x2a67fa});};exports[_0xcde6('0x30')]=function(_0x2d66f5){return request(_0xcde6('0x31'),{'options':{'raw':![],'where':{'phone':_0x2d66f5['phone'],'ListId':_0x2d66f5['ListId']}}})[_0xcde6('0x5')](function(_0x469d5e){if(_0x469d5e){return _0x469d5e;}return request('CreateCmContact',{'body':_0x2d66f5});});};exports[_0xcde6('0x32')]=function(_0x35a4f0){return request(_0xcde6('0x33'),{'options':{'where':{'id':_0x35a4f0},'attributes':[_0xcde6('0xa')]}});};exports[_0xcde6('0x34')]=function(_0x5d8792,_0x397eae){return request(_0xcde6('0x35'),{'body':{'interface':_0x397eae},'options':{'where':_0x5d8792}});};exports[_0xcde6('0x36')]=function(_0x9308a0,_0x4015dd,_0x37e3f0){return request(_0xcde6('0x37'),{'body':{'type':_0x4015dd,'uniqueid':_0x37e3f0},'options':{'where':_0x9308a0}});};exports[_0xcde6('0x38')]=function(_0x50a6c1){return request('UnpauseUser',{'body':{},'options':{'where':_0x50a6c1}});};exports[_0xcde6('0x39')]=function(_0x16c08c){return request(_0xcde6('0x3a'),{'body':{},'options':{'where':_0x16c08c}});}; \ 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 813c121..0de5e81 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 _0x87d8=['exports','./lex'];(function(_0x3223cf,_0x132ec5){var _0x54cd36=function(_0x4f899b){while(--_0x4f899b){_0x3223cf['push'](_0x3223cf['shift']());}};_0x54cd36(++_0x132ec5);}(_0x87d8,0x1a9));var _0x887d=function(_0xf46bd9,_0x322826){_0xf46bd9=_0xf46bd9-0x0;var _0x2763c3=_0x87d8[_0xf46bd9];return _0x2763c3;};var polly=require('./polly');var lex=require(_0x887d('0x0'));module[_0x887d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xeae8=['./polly','./lex','exports'];(function(_0x4d938e,_0x22771c){var _0x4f079a=function(_0x414a60){while(--_0x414a60){_0x4d938e['push'](_0x4d938e['shift']());}};_0x4f079a(++_0x22771c);}(_0xeae8,0x66));var _0x8eae=function(_0x498300,_0x756f5b){_0x498300=_0x498300-0x0;var _0x2aedaf=_0xeae8[_0x498300];return _0x2aedaf;};var polly=require(_0x8eae('0x0'));var lex=require(_0x8eae('0x1'));module[_0x8eae('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 917e2bd..b67411f 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 _0x55e0=['./lib/api','exports'];(function(_0xdfe590,_0x269833){var _0x31eaf3=function(_0x3a4c45){while(--_0x3a4c45){_0xdfe590['push'](_0xdfe590['shift']());}};_0x31eaf3(++_0x269833);}(_0x55e0,0xdc));var _0x055e=function(_0x58649b,_0x22c03b){_0x58649b=_0x58649b-0x0;var _0x423588=_0x55e0[_0x58649b];return _0x423588;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ No newline at end of file +var _0xa9e0=['exports','./lib/api'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var lex=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]=function(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808){return lex(_0x29929c,_0x5dd881,_0x550fbc,_0x18d5c9,_0x4ce2f1,_0x333808);}; \ 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 0573d80..3f194f6 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(_0x4490bc,_0x39a99e){var _0x2d944e=function(_0xb7b8ec){while(--_0xb7b8ec){_0x4490bc['push'](_0x4490bc['shift']());}};_0x2d944e(++_0x39a99e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 ffdc19c..805e7e9 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 _0x16e9=['./lib/api','exports'];(function(_0x4edd31,_0xac46a6){var _0x2c4540=function(_0x77e25b){while(--_0x77e25b){_0x4edd31['push'](_0x4edd31['shift']());}};_0x2c4540(++_0xac46a6);}(_0x16e9,0x1b6));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var polly=require(_0x916e('0x0'));module[_0x916e('0x1')]=function(_0x112d23,_0x46a357,_0x3bdb86,_0x41eef2,_0x2aa952,_0x1dc407,_0x23653e){return polly(_0x112d23,_0x46a357,_0x3bdb86,_0x41eef2,_0x2aa952,_0x1dc407,_0x23653e);}; \ No newline at end of file +var _0xcb5f=['./lib/api'];(function(_0x4ab166,_0x129a5c){var _0x366a79=function(_0x2f7ce4){while(--_0x2f7ce4){_0x4ab166['push'](_0x4ab166['shift']());}};_0x366a79(++_0x129a5c);}(_0xcb5f,0x195));var _0xfcb5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcb5f[_0x321bb2];return _0x9c12ed;};'use strict';var polly=require(_0xfcb5('0x0'));module['exports']=function(_0x26c86c,_0x27b44c,_0x5fc391,_0x251347,_0x12acd0,_0x587b06,_0x4e4efb){return polly(_0x26c86c,_0x27b44c,_0x5fc391,_0x251347,_0x12acd0,_0x587b06,_0x4e4efb);}; \ 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 36c9323..e0b8dd5 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 _0x6e63=['path','bluebird','randomstring','aws-sdk','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x433f8d,_0x54c793){var _0x6e02e5=function(_0x28f486){while(--_0x28f486){_0x433f8d['push'](_0x433f8d['shift']());}};_0x6e02e5(++_0x54c793);}(_0x6e63,0x1f4));var _0x36e6=function(_0x1a28ea,_0x5e959a){_0x1a28ea=_0x1a28ea-0x0;var _0x288902=_0x6e63[_0x1a28ea];return _0x288902;};'use strict';var fs=require('fs');var path=require(_0x36e6('0x0'));var BPromise=require(_0x36e6('0x1'));var rs=require(_0x36e6('0x2'));var AWS=require(_0x36e6('0x3'));function pollyResult(_0x33dd0c,_0x1de024,_0x1c5e69){return new BPromise(function(_0x518ee1,_0x2ec25f){_0x33dd0c['synthesizeSpeech'](_0x1de024,function(_0x4f94da,_0x446b88){if(_0x4f94da){_0x2ec25f(_0x4f94da);}else if(_0x446b88){if(_0x446b88[_0x36e6('0x4')]instanceof Buffer){fs[_0x36e6('0x5')](_0x1c5e69,_0x446b88[_0x36e6('0x4')],function(_0x259e29){if(_0x259e29){_0x2ec25f(_0x259e29);}else{_0x518ee1();}});}else{_0x2ec25f(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2ec25f(new Error(_0x36e6('0x6')));}});});}module['exports']=function(_0x13e92e,_0x1b3057,_0xb6212a,_0x30f298,_0x3a2c6d,_0x397225,_0x3e31cf){var _0x24dff5=new AWS[(_0x36e6('0x7'))]({'accessKeyId':_0x13e92e,'secretAccessKey':_0x1b3057,'region':_0xb6212a});var _0x4c4f5b={'Text':_0x3a2c6d,'TextType':_0x397225||_0x36e6('0x8'),'OutputFormat':_0x36e6('0x9'),'VoiceId':_0x30f298};return pollyResult(_0x24dff5,_0x4c4f5b,_0x3e31cf);}; \ No newline at end of file +var _0x067b=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x249579,_0x27a727){var _0xed110e=function(_0x576e4f){while(--_0x576e4f){_0x249579['push'](_0x249579['shift']());}};_0xed110e(++_0x27a727);}(_0x067b,0x1e5));var _0xb067=function(_0xa52027,_0x3ed55a){_0xa52027=_0xa52027-0x0;var _0x3e4fe5=_0x067b[_0xa52027];return _0x3e4fe5;};'use strict';var fs=require('fs');var path=require(_0xb067('0x0'));var BPromise=require(_0xb067('0x1'));var rs=require(_0xb067('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x2f2802,_0x4a01c0,_0x179c50){return new BPromise(function(_0x1c9640,_0x28da0c){_0x2f2802[_0xb067('0x3')](_0x4a01c0,function(_0x54deb8,_0x45d6fe){if(_0x54deb8){_0x28da0c(_0x54deb8);}else if(_0x45d6fe){if(_0x45d6fe[_0xb067('0x4')]instanceof Buffer){fs[_0xb067('0x5')](_0x179c50,_0x45d6fe[_0xb067('0x4')],function(_0xc42270){if(_0xc42270){_0x28da0c(_0xc42270);}else{_0x1c9640();}});}else{_0x28da0c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x28da0c(new Error(_0xb067('0x6')));}});});}module[_0xb067('0x7')]=function(_0x58a854,_0x42be36,_0x3f6b4b,_0x5ddded,_0x23c80a,_0x53e887,_0x4440d1){var _0x4af40d=new AWS[(_0xb067('0x8'))]({'accessKeyId':_0x58a854,'secretAccessKey':_0x42be36,'region':_0x3f6b4b});var _0x54f669={'Text':_0x23c80a,'TextType':_0x53e887||_0xb067('0x9'),'OutputFormat':_0xb067('0xa'),'VoiceId':_0x5ddded};return pollyResult(_0x4af40d,_0x54f669,_0x4440d1);}; \ 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 b3f80a0..b2e0558 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 _0x526a=['exports','./lib/api'];(function(_0x362067,_0x289f11){var _0x51947f=function(_0x4ec401){while(--_0x4ec401){_0x362067['push'](_0x362067['shift']());}};_0x51947f(++_0x289f11);}(_0x526a,0x11f));var _0xa526=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x526a[_0x32d457];return _0x338386;};'use strict';var asr=require(_0xa526('0x0'));module[_0xa526('0x1')]=function(_0x3e22f8,_0x364f13,_0x160cb0,_0x26e08d){return asr(_0x3e22f8,_0x364f13,_0x160cb0);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x16dd6c,_0x5d2f27,_0xda411d,_0x1fc3b3){return asr(_0x16dd6c,_0x5d2f27,_0xda411d);}; \ 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 c234925..1d0f656 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 _0x4fef=['exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','url','bluebird'];(function(_0x3ad62c,_0x465700){var _0x18e4f3=function(_0x2ae3c3){while(--_0x2ae3c3){_0x3ad62c['push'](_0x3ad62c['shift']());}};_0x18e4f3(++_0x465700);}(_0x4fef,0x10f));var _0xf4fe=function(_0x1679d9,_0x595bbe){_0x1679d9=_0x1679d9-0x0;var _0x50ca2f=_0x4fef[_0x1679d9];return _0x50ca2f;};'use strict';var url=require(_0xf4fe('0x0'));var BPromise=require(_0xf4fe('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf4fe('0x2')]=function(_0x5a2bd0,_0x40f4b2,_0x14bf18){return new BPromise(function(_0x3c78db,_0x1e5ec2){var _0x5c5dbb;if(typeof _0x5a2bd0!==_0xf4fe('0x3')||_0x5a2bd0[_0xf4fe('0x4')]===0x0){return _0x1e5ec2(_0xf4fe('0x5'));}if(typeof _0x40f4b2!=='string'||_0x40f4b2[_0xf4fe('0x4')]===0x0){return _0x1e5ec2(_0xf4fe('0x6'));}if(typeof _0x14bf18!=='undefined'&&(typeof _0x14bf18!==_0xf4fe('0x3')||_0x14bf18[_0xf4fe('0x4')]===0x0)){return _0x1e5ec2(_0xf4fe('0x7'));}try{_0x5c5dbb=fs[_0xf4fe('0x8')](_0x5a2bd0)[_0xf4fe('0x9')](_0xf4fe('0xa'));}catch(_0x42da04){return _0x1e5ec2(_0x42da04);}return _0x3c78db({'method':_0xf4fe('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x40f4b2,'body':{'config':{'encoding':_0xf4fe('0xc'),'sampleRateHertz':'8000','languageCode':_0x14bf18},'audio':{'content':_0x5c5dbb}},'json':!![]});});}; \ No newline at end of file +var _0x19ea=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','8000','url','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0xdafcbc,_0x33da73){var _0x3c5f88=function(_0x2b7815){while(--_0x2b7815){_0xdafcbc['push'](_0xdafcbc['shift']());}};_0x3c5f88(++_0x33da73);}(_0x19ea,0xfe));var _0xa19e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x19ea[_0x14add3];return _0x4a174f;};'use strict';var url=require(_0xa19e('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xa19e('0x1')]=function(_0x481228,_0x208e73,_0x12aefc){return new BPromise(function(_0x3593a5,_0x4d323a){var _0x4a6556;if(typeof _0x481228!==_0xa19e('0x2')||_0x481228[_0xa19e('0x3')]===0x0){return _0x4d323a(_0xa19e('0x4'));}if(typeof _0x208e73!==_0xa19e('0x2')||_0x208e73[_0xa19e('0x3')]===0x0){return _0x4d323a(_0xa19e('0x5'));}if(typeof _0x12aefc!==_0xa19e('0x6')&&(typeof _0x12aefc!==_0xa19e('0x2')||_0x12aefc[_0xa19e('0x3')]===0x0)){return _0x4d323a(_0xa19e('0x7'));}try{_0x4a6556=fs[_0xa19e('0x8')](_0x481228)['toString'](_0xa19e('0x9'));}catch(_0x3c8647){return _0x4d323a(_0x3c8647);}return _0x3593a5({'method':_0xa19e('0xa'),'uri':host+_0xa19e('0xb')+_0x208e73,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xa19e('0xc'),'languageCode':_0x12aefc},'audio':{'content':_0x4a6556}},'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 8d9833b..c406ae4 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 _0x8fb2=['./asr'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8fb2,0xd7));var _0x28fb=function(_0x563e54,_0x276263){_0x563e54=_0x563e54-0x0;var _0x409c80=_0x8fb2[_0x563e54];return _0x409c80;};var asr=require(_0x28fb('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xadfb=['exports'];(function(_0x5b7a0d,_0x1c0051){var _0x2d89eb=function(_0x3e62df){while(--_0x3e62df){_0x5b7a0d['push'](_0x5b7a0d['shift']());}};_0x2d89eb(++_0x1c0051);}(_0xadfb,0x118));var _0xbadf=function(_0x4288e4,_0x3f937a){_0x4288e4=_0x4288e4-0x0;var _0xe44ae4=_0xadfb[_0x4288e4];return _0xe44ae4;};var asr=require('./asr');module[_0xbadf('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 782b022..7508bab 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 _0x1f71=['./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish\x20download\x20file','close','unlink','download\x20error','end','protocol','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','.wav','info','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','queryResult','diagnosticInfo','fields','boolValue','intent','name','isFallback','queryText','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','randomstring','sox','google-tts-api','url','util','./aws'];(function(_0x264f17,_0x1c3d7c){var _0x435e95=function(_0xbc4dca){while(--_0xbc4dca){_0x264f17['push'](_0x264f17['shift']());}};_0x435e95(++_0x1c3d7c);}(_0x1f71,0x80));var _0x11f7=function(_0x1a5543,_0x307481){_0x1a5543=_0x1a5543-0x0;var _0x458a1e=_0x1f71[_0x1a5543];return _0x458a1e;};'use strict';var apiai=require(_0x11f7('0x0'));var BPromise=require(_0x11f7('0x1'));var dialogflow=require(_0x11f7('0x2'));var fs=require('fs');var http=require(_0x11f7('0x3'));var https=require(_0x11f7('0x4'));var md5=require(_0x11f7('0x5'));var path=require(_0x11f7('0x6'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x11f7('0x7'));var sox=require(_0x11f7('0x8'));var tts=require(_0x11f7('0x9'));var urlParse=require(_0x11f7('0xa'))['parse'];var util=require(_0x11f7('0xb'));var aws=require(_0x11f7('0xc'));var google=require(_0x11f7('0xd'));var sestek=require(_0x11f7('0xe'));var tilde=require(_0x11f7('0xf'));var logger=require(_0x11f7('0x10'))(_0x11f7('0x11'));var ISPEECH_API=_0x11f7('0x12');function downloadFile(_0x3b35dc,_0x51bf03){return new BPromise(function(_0x193d4d,_0x2fb5cb){var _0x2541c=urlParse(_0x3b35dc);var _0x449057=_0x2541c['protocol']===_0x11f7('0x13')?https:http;var _0x1d51be={'host':_0x2541c[_0x11f7('0x14')],'path':_0x2541c[_0x11f7('0x6')],'headers':{'user-agent':_0x11f7('0x15')}};_0x449057[_0x11f7('0x16')](_0x1d51be,function(_0x511831){if(_0x511831[_0x11f7('0x17')]!==0xc8){logger[_0x11f7('0x18')](_0x11f7('0x19')+_0x3b35dc+_0x11f7('0x1a')+_0x511831['statusCode']+'\x20('+_0x511831[_0x11f7('0x1b')]+')');_0x2fb5cb(new Error(_0x11f7('0x19')+_0x3b35dc+'\x20failed,\x20status\x20code\x20=\x20'+_0x511831['statusCode']+'\x20('+_0x511831[_0x11f7('0x1b')]+')'));return;}var _0x2211f5=fs[_0x11f7('0x1c')](_0x51bf03);_0x2211f5['on']('finish',function(){logger['info'](_0x11f7('0x1d'));_0x2211f5[_0x11f7('0x1e')](_0x193d4d);});_0x2211f5['on'](_0x11f7('0x18'),function(_0x4ab1d8){fs[_0x11f7('0x1f')](_0x51bf03);logger[_0x11f7('0x18')](_0x11f7('0x20'),_0x4ab1d8);_0x2fb5cb(_0x4ab1d8);});_0x511831['pipe'](_0x2211f5);})['on']('error',function(_0x5b69e9){logger[_0x11f7('0x18')](_0x5b69e9);_0x2fb5cb(_0x5b69e9);})[_0x11f7('0x21')]();});}function uploadFile(_0x3489ab){return new BPromise(function(_0x377560,_0x24f959){var _0x5aa13f=urlParse(_0x3489ab);var _0x3ee301=_0x5aa13f[_0x11f7('0x22')]===_0x11f7('0x13')?https:http;var _0x4c59eb={'host':_0x5aa13f[_0x11f7('0x14')],'path':_0x5aa13f[_0x11f7('0x6')],'headers':{'user-agent':_0x11f7('0x15')}};_0x3ee301[_0x11f7('0x16')](_0x4c59eb,function(_0x235c8a){if(_0x235c8a['statusCode']!==0xc8){_0x24f959(new Error('request\x20to\x20'+_0x3489ab+_0x11f7('0x1a')+_0x235c8a[_0x11f7('0x17')]+'\x20('+_0x235c8a[_0x11f7('0x1b')]+')'));return;}var _0x3e9461='';_0x235c8a['on'](_0x11f7('0x23'),function(_0x1d0a68){_0x3e9461+=_0x1d0a68;});_0x235c8a['on'](_0x11f7('0x21'),function(){_0x377560(_0x3e9461);});})['on']('error',function(_0x48e3a3){_0x24f959(_0x48e3a3);})[_0x11f7('0x21')]();});}function convertFile(_0x134318,_0x137245){return new BPromise(function(_0x5c1df6,_0x54cf1a){var _0x582b12=sox[_0x11f7('0x24')](_0x134318,_0x137245,{'sampleRate':0x1f40,'format':_0x11f7('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x582b12['on']('error',function(_0x3c113c){logger[_0x11f7('0x18')](_0x11f7('0x26'),_0x3c113c);_0x54cf1a(_0x3c113c);});_0x582b12['on'](_0x11f7('0x21'),function(){logger['info'](_0x11f7('0x27'));_0x5c1df6();});_0x582b12['start']();});}function base64Decode(_0x1d6cf8,_0x52a558){var _0x20887c=path[_0x11f7('0x28')](__dirname,_0x11f7('0x29'),rs[_0x11f7('0x2a')](0x4)+'.wav');fs[_0x11f7('0x2b')](_0x20887c,_0x1d6cf8,_0x11f7('0x2c'));return convertFile(_0x20887c,_0x52a558)[_0x11f7('0x2d')](function(){try{fs[_0x11f7('0x1f')](_0x20887c);fs[_0x11f7('0x2e')](_0x52a558,_0x11f7('0x2f'));}catch(_0x5eb384){logger['error'](_0x5eb384);}return _0x52a558['split']('.')[0x0];});}function base64Encode(_0x2a50e8){var _0xffe55c=fs[_0x11f7('0x30')](_0x2a50e8);return new Buffer(_0xffe55c)['toString'](_0x11f7('0x2c'));}exports[_0x11f7('0x31')]=function(_0x1c5495,_0x25e89c,_0x12d94c,_0x5a2a7b,_0x9f3b8,_0x4d2f30){var _0x424a00,_0x347ee1;var _0x22049e=_0x11f7('0x32');var _0x18ad28=_0x11f7('0x33')+_0x1c5495;var _0x3ada0b={};if(_0x25e89c===_0x11f7('0x34')){_0x3ada0b['input']={'ssml':_0x12d94c};}else{_0x3ada0b['input']={'text':_0x12d94c};};_0x3ada0b[_0x11f7('0x35')]={'languageCode':_0x5a2a7b,'ssmlGender':_0x9f3b8};_0x3ada0b[_0x11f7('0x36')]={'audioEncoding':_0x11f7('0x37'),'sampleRateHertz':0x1f40};var _0x3301ca={'url':_0x22049e+_0x11f7('0x38')+_0x18ad28,'method':_0x11f7('0x39'),'json':!![],'body':_0x3ada0b};return rp(_0x3301ca)[_0x11f7('0x2d')](function(_0x51e392){return new BPromise(function(_0x578644,_0x39ea21){_0x424a00=path[_0x11f7('0x28')](__dirname,_0x11f7('0x29'),rs['generate'](0x4)+_0x11f7('0x3a'));var _0x126587=Buffer[_0x11f7('0x3b')](_0x51e392[_0x11f7('0x3c')],'base64');return fs['writeFile'](_0x424a00,_0x126587,function(_0xfb0252){_0x39ea21(_0xfb0252);},function(_0x5f591){fs['chmodSync'](_0x424a00,_0x11f7('0x2f'));_0x578644(_0x5f591);});});})[_0x11f7('0x2d')](function(_0x1d6821){_0x347ee1=path[_0x11f7('0x28')](__dirname,_0x11f7('0x29'),rs[_0x11f7('0x2a')](0x4)+_0x11f7('0x3d'));return convertFile(_0x424a00,_0x347ee1);})[_0x11f7('0x2d')](function(){try{fs[_0x11f7('0x1f')](_0x424a00);fs[_0x11f7('0x2e')](_0x347ee1,_0x11f7('0x2f'));}catch(_0x563ba8){logger[_0x11f7('0x18')](_0x563ba8);}logger[_0x11f7('0x3e')](_0x11f7('0x3f'),_0x347ee1[_0x11f7('0x40')]('.')[0x0]);return _0x347ee1[_0x11f7('0x40')]('.')[0x0];});};exports[_0x11f7('0x41')]=function(_0x53523b,_0x113660){var _0x31daac=_0x11f7('0x42');var _0x545ce4,_0x124c4e;var _0x58e54c;var _0x1e8ab3={'encoding':_0x11f7('0x43'),'method':_0x11f7('0x39'),'timeout':0x2710,'url':_0x31daac,'headers':{'Content-Type':_0x11f7('0x44')},'body':_0x11f7('0x45')+encodeURIComponent(JSON[_0x11f7('0x46')]([[[_0x11f7('0x47'),JSON['stringify']([_0x53523b,_0x113660||'en',![],_0x11f7('0x48')]),null,_0x11f7('0x49')]]]))};return rp(_0x1e8ab3)[_0x11f7('0x2d')](function(_0x5e95b3){try{_0x58e54c=eval(_0x5e95b3['slice'](0x5))[0x0][0x2];}catch(_0x39aaa5){throw new Error('parse\x20response\x20failed:\x0a'+_0x5e95b3['data']);}if(!_0x58e54c){if(_0x53523b['length']>0xc8){throw new Error(_0x11f7('0x4a'));}else{throw new Error('lang\x20\x22'+_0x113660+_0x11f7('0x4b'));}}try{_0x58e54c=eval(_0x58e54c)[0x0];}catch(_0x1b47a1){throw new Error(_0x11f7('0x4c')+res[_0x11f7('0x23')]);}const _0x4d70ba=_0x58e54c;_0x545ce4=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x11f7('0x3a'));fs['writeFileSync'](_0x545ce4,_0x58e54c,{'encoding':_0x11f7('0x2c')});_0x124c4e=path[_0x11f7('0x28')](__dirname,_0x11f7('0x29'),rs['generate'](0x4)+_0x11f7('0x3d'));return convertFile(_0x545ce4,_0x124c4e);})[_0x11f7('0x2d')](function(){try{fs[_0x11f7('0x1f')](_0x545ce4);fs['chmodSync'](_0x124c4e,_0x11f7('0x2f'));}catch(_0x258a5d){logger[_0x11f7('0x18')](_0x258a5d);}logger[_0x11f7('0x3e')](_0x11f7('0x4d'),_0x124c4e['split']('.')[0x0]);return _0x124c4e[_0x11f7('0x40')]('.')[0x0];});};exports[_0x11f7('0x4e')]=function(_0x22f891,_0x121c4a,_0xe58013){return google[_0x11f7('0x4f')](_0x22f891,_0x121c4a,_0xe58013)[_0x11f7('0x2d')](function(_0x597263){logger[_0x11f7('0x3e')](_0x597263[_0x11f7('0x50')]);return rp(_0x597263);})[_0x11f7('0x2d')](function(_0x5e197c){var _0x31d4b9='';var _0x57ef51=0x0;try{fs['unlink'](_0x22f891);}catch(_0x9b6aed){logger[_0x11f7('0x18')](_0x9b6aed);}if(_0x5e197c&&_0x5e197c['results']){_0x31d4b9=_0x5e197c[_0x11f7('0x51')][_0x11f7('0x52')](function(_0x9a1580){return _0x9a1580&&_0x9a1580['alternatives'][0x0]&&_0x9a1580[_0x11f7('0x53')][0x0]['transcript']?_0x9a1580[_0x11f7('0x53')][0x0][_0x11f7('0x54')]:'';})[_0x11f7('0x55')]('\x0a');_0x57ef51=_0x5e197c[_0x11f7('0x51')][_0x11f7('0x52')](function(_0x2e42b4){return _0x2e42b4&&_0x2e42b4[_0x11f7('0x53')][0x0]&&_0x2e42b4[_0x11f7('0x53')][0x0][_0x11f7('0x56')]?_0x2e42b4[_0x11f7('0x53')][0x0][_0x11f7('0x56')]:0x0;})['join']('\x0a');}logger[_0x11f7('0x3e')](_0x11f7('0x57'),_0x31d4b9);logger[_0x11f7('0x3e')](_0x11f7('0x58'),_0x57ef51);return{'transcript':_0x31d4b9,'confidence':_0x57ef51};})[_0x11f7('0x59')](function(_0x173b10){logger[_0x11f7('0x18')](_0x11f7('0x5a'),_0x173b10[_0x11f7('0x17')],_0x173b10['name'],_0x173b10[_0x11f7('0x5b')]);});};exports['googleDialogflow']=function(_0x29b1c7,_0x5837ad,_0x4905dd,_0x56e607){var _0x4754b0=apiai(_0x5837ad,{'language':_0x56e607||'en'});return _0x4754b0[_0x11f7('0x5c')](_0x4905dd,{'sessionId':md5(_0x29b1c7)})['then'](function(_0x2adbd2){logger[_0x11f7('0x3e')](JSON['stringify'](_0x2adbd2));return{'source':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x5e')],'resolvedQuery':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x5f')],'action':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x60')],'actionIncomplete':_0x2adbd2['result'][_0x11f7('0x61')],'speech':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x62')][_0x11f7('0x63')],'score':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x64')],'statusCode':_0x2adbd2['status'][_0x11f7('0x65')],'endConversation':_0x2adbd2['result'][_0x11f7('0x66')][_0x11f7('0x67')]||![],'isFallbackIntent':_0x2adbd2[_0x11f7('0x5d')][_0x11f7('0x66')][_0x11f7('0x68')]};});};exports[_0x11f7('0x69')]=function(_0x6a7a16,_0x274dea,_0x5248b0,_0x2a9b7f,_0x36122b,_0xf89eaf){var _0x4a1c9c=_0x2a9b7f['replace'](/\\n/g,'\x0a');var _0x386c2b={'credentials':{'private_key':_0x4a1c9c,'client_email':_0x5248b0}};var _0x4e83fc=new dialogflow[(_0x11f7('0x6a'))](_0x386c2b);var _0x29e27d=_0x4e83fc['sessionPath'](_0x274dea,md5(_0x6a7a16));var _0x59872d={'session':_0x29e27d,'queryInput':{'text':{'text':_0x36122b,'languageCode':_0xf89eaf}}};return _0x4e83fc['detectIntent'](_0x59872d)[_0x11f7('0x2d')](function(_0x83e108){if(_0x83e108&&_0x83e108['length']){logger[_0x11f7('0x3e')]('Dialogflow\x20V2\x20response:',JSON[_0x11f7('0x46')](_0x83e108));var _0x16d7c0=_0x83e108[0x0];if(_0x16d7c0){var _0x131e48={'action':_0x16d7c0['queryResult'][_0x11f7('0x60')],'allRequiredParamsPresent':_0x16d7c0['queryResult']['allRequiredParamsPresent'],'endConversation':_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x6c')]&&_0x16d7c0[_0x11f7('0x6b')]['diagnosticInfo'][_0x11f7('0x6d')]?_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x6c')][_0x11f7('0x6d')]['end_conversation'][_0x11f7('0x6e')]:![],'fulfillmentText':_0x16d7c0[_0x11f7('0x6b')]['fulfillmentText'],'intentName':_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x6f')][_0x11f7('0x70')],'intentDisplayName':_0x16d7c0['queryResult'][_0x11f7('0x6f')]['displayName'],'isFallbackIntent':_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x6f')][_0x11f7('0x71')],'languageCode':_0x16d7c0[_0x11f7('0x6b')]['languageCode'],'queryText':_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x72')],'responseId':_0x16d7c0[_0x11f7('0x73')],'score':_0x16d7c0[_0x11f7('0x6b')][_0x11f7('0x74')],'speech':_0x16d7c0['queryResult'][_0x11f7('0x75')],'providerResponse':JSON[_0x11f7('0x46')](_0x83e108)};return _0x131e48;}}});};exports[_0x11f7('0x76')]=function(_0x2bd396,_0x5f03e7,_0xa41f47,_0x80cd94){return tilde['asr'](_0x2bd396,_0x5f03e7,_0xa41f47,_0x80cd94)[_0x11f7('0x2d')](function(_0x480d4b){try{fs[_0x11f7('0x1f')](_0x2bd396);}catch(_0x3e75d4){logger[_0x11f7('0x18')](_0x3e75d4);}logger[_0x11f7('0x3e')](_0x11f7('0x77'),_0x480d4b[_0x11f7('0x54')]);logger[_0x11f7('0x3e')](_0x11f7('0x78'),_0x480d4b['confidence']);return _0x480d4b;});};exports[_0x11f7('0x79')]=function(_0x4420b1,_0x92f81f,_0x559ea4,_0x1c8c6d,_0x568713,_0x568e01){var _0x28c8ff=path['resolve'](__dirname,_0x11f7('0x29'),rs[_0x11f7('0x2a')](0x4)+_0x11f7('0x3a'));var _0x34b34e;return aws[_0x11f7('0x7a')](_0x4420b1,_0x92f81f,_0x559ea4,_0x1c8c6d,_0x568713,_0x568e01,_0x28c8ff)[_0x11f7('0x2d')](function(){_0x34b34e=path[_0x11f7('0x28')](__dirname,'tmp',rs[_0x11f7('0x2a')](0x4)+_0x11f7('0x3d'));return convertFile(_0x28c8ff,_0x34b34e);})[_0x11f7('0x2d')](function(){try{fs[_0x11f7('0x1f')](_0x28c8ff);fs['chmodSync'](_0x34b34e,_0x11f7('0x2f'));}catch(_0x4fd62c){logger['error'](_0x4fd62c);}return _0x34b34e['split']('.')[0x0];});};exports[_0x11f7('0x7b')]=function(_0xdd002,_0x236c84,_0x4d024b,_0x73b4d6,_0x219b8e,_0x10a67b){return aws[_0x11f7('0x7c')](_0xdd002,_0x236c84,_0x4d024b,_0x73b4d6,_0x219b8e,_0x10a67b)[_0x11f7('0x2d')](function(_0x490e6e){logger['info'](JSON[_0x11f7('0x46')](_0x490e6e));return _0x490e6e;});};exports['ispeechTTS']=function(_0x33b1b5,_0x5c3d1c,_0x69e210,_0x153f39){var _0x49a938=util[_0x11f7('0x7d')](_0x11f7('0x7e'),ISPEECH_API,_0x33b1b5,encodeURIComponent(_0x5c3d1c),_0x69e210,_0x153f39);var _0x674964=path[_0x11f7('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0x11f7('0x3a'));var _0x276a71;return downloadFile(_0x49a938,_0x674964)['then'](function(){_0x276a71=path['resolve'](__dirname,_0x11f7('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x674964,_0x276a71);})[_0x11f7('0x2d')](function(){try{fs[_0x11f7('0x1f')](_0x674964);fs[_0x11f7('0x2e')](_0x276a71,_0x11f7('0x2f'));}catch(_0x37553f){logger['error'](_0x37553f);}return _0x276a71[_0x11f7('0x40')]('.')[0x0];});};exports[_0x11f7('0x7f')]=function(_0x551c23,_0x1683d0,_0x419fa1,_0x2f35bd){var _0x488734=util[_0x11f7('0x7d')](_0x11f7('0x80'),ISPEECH_API,_0x1683d0,_0x419fa1,base64Encode(_0x551c23),_0x2f35bd?util[_0x11f7('0x7d')](_0x11f7('0x81'),encodeURIComponent(_0x2f35bd)):_0x11f7('0x82'));return uploadFile(_0x488734)[_0x11f7('0x2d')](function(_0x53636c){return querystring[_0x11f7('0x83')](_0x53636c);});};exports[_0x11f7('0x84')]=function(_0x5d3a84,_0x183303){return sestek['nda'](_0x5d3a84,_0x183303)['then'](function(_0x2756fc){logger['info'](JSON[_0x11f7('0x46')](_0x2756fc));var _0x13fe98={'speech':_0x2756fc[_0x11f7('0x85')],'action':_0x2756fc[_0x11f7('0x86')]?_0x2756fc[_0x11f7('0x86')][_0x11f7('0x87')]:undefined,'actiondata':_0x2756fc['channelData']?_0x2756fc['channelData'][_0x11f7('0x88')]:undefined};if(_0x2756fc[_0x11f7('0x86')]&&_0x2756fc['channelData']['AudioFromTts']){return base64Decode(_0x2756fc[_0x11f7('0x86')][_0x11f7('0x89')][_0x11f7('0x8a')],path[_0x11f7('0x28')](__dirname,_0x11f7('0x29'),rs[_0x11f7('0x2a')](0x4)+_0x11f7('0x3d')))[_0x11f7('0x2d')](function(_0x588f38){_0x13fe98[_0x11f7('0x8b')]=_0x588f38;return _0x13fe98;});}return _0x13fe98;});};exports[_0x11f7('0x8c')]=function(){return __dirname;}; \ No newline at end of file +var _0x9e82=['diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','displayName','languageCode','queryText','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','https','md5','path','querystring','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','agi','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','speech','score','status','code','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent'];(function(_0xa970d1,_0x8e9f98){var _0x4c5a31=function(_0x1b715d){while(--_0x1b715d){_0xa970d1['push'](_0xa970d1['shift']());}};_0x4c5a31(++_0x8e9f98);}(_0x9e82,0x1a2));var _0x29e8=function(_0x430d55,_0x44c009){_0x430d55=_0x430d55-0x0;var _0x175803=_0x9e82[_0x430d55];return _0x175803;};'use strict';var apiai=require(_0x29e8('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x29e8('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x29e8('0x2'));var md5=require(_0x29e8('0x3'));var path=require(_0x29e8('0x4'));var querystring=require(_0x29e8('0x5'));var rp=require('request-promise');var rs=require(_0x29e8('0x6'));var sox=require(_0x29e8('0x7'));var tts=require(_0x29e8('0x8'));var urlParse=require('url')[_0x29e8('0x9')];var util=require(_0x29e8('0xa'));var aws=require(_0x29e8('0xb'));var google=require(_0x29e8('0xc'));var sestek=require(_0x29e8('0xd'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x29e8('0xe'));var ISPEECH_API=_0x29e8('0xf');function downloadFile(_0x5c0394,_0x4236d3){return new BPromise(function(_0x4a8aab,_0x5032e4){var _0x4cfd04=urlParse(_0x5c0394);var _0x4b63ca=_0x4cfd04['protocol']===_0x29e8('0x10')?https:http;var _0x1c5797={'host':_0x4cfd04[_0x29e8('0x11')],'path':_0x4cfd04[_0x29e8('0x4')],'headers':{'user-agent':_0x29e8('0x12')}};_0x4b63ca[_0x29e8('0x13')](_0x1c5797,function(_0x1f8ed9){if(_0x1f8ed9[_0x29e8('0x14')]!==0xc8){logger[_0x29e8('0x15')](_0x29e8('0x16')+_0x5c0394+_0x29e8('0x17')+_0x1f8ed9[_0x29e8('0x14')]+'\x20('+_0x1f8ed9['statusMessage']+')');_0x5032e4(new Error('request\x20to\x20'+_0x5c0394+_0x29e8('0x17')+_0x1f8ed9[_0x29e8('0x14')]+'\x20('+_0x1f8ed9[_0x29e8('0x18')]+')'));return;}var _0x34038c=fs[_0x29e8('0x19')](_0x4236d3);_0x34038c['on'](_0x29e8('0x1a'),function(){logger[_0x29e8('0x1b')]('finish\x20download\x20file');_0x34038c[_0x29e8('0x1c')](_0x4a8aab);});_0x34038c['on'](_0x29e8('0x15'),function(_0x31259d){fs[_0x29e8('0x1d')](_0x4236d3);logger[_0x29e8('0x15')](_0x29e8('0x1e'),_0x31259d);_0x5032e4(_0x31259d);});_0x1f8ed9[_0x29e8('0x1f')](_0x34038c);})['on'](_0x29e8('0x15'),function(_0x2632e6){logger['error'](_0x2632e6);_0x5032e4(_0x2632e6);})[_0x29e8('0x20')]();});}function uploadFile(_0xbb8204){return new BPromise(function(_0x2aebb1,_0xbd005b){var _0x94efe5=urlParse(_0xbb8204);var _0x3f8333=_0x94efe5['protocol']==='https:'?https:http;var _0x4ec761={'host':_0x94efe5[_0x29e8('0x11')],'path':_0x94efe5[_0x29e8('0x4')],'headers':{'user-agent':_0x29e8('0x12')}};_0x3f8333[_0x29e8('0x13')](_0x4ec761,function(_0x1c9c5e){if(_0x1c9c5e['statusCode']!==0xc8){_0xbd005b(new Error(_0x29e8('0x16')+_0xbb8204+_0x29e8('0x17')+_0x1c9c5e[_0x29e8('0x14')]+'\x20('+_0x1c9c5e['statusMessage']+')'));return;}var _0x3dc685='';_0x1c9c5e['on']('data',function(_0x4b5cd3){_0x3dc685+=_0x4b5cd3;});_0x1c9c5e['on'](_0x29e8('0x20'),function(){_0x2aebb1(_0x3dc685);});})['on'](_0x29e8('0x15'),function(_0x3f4842){_0xbd005b(_0x3f4842);})['end']();});}function convertFile(_0x38767d,_0x37d044){return new BPromise(function(_0x5475a9,_0x38b9fb){var _0x42a1f3=sox[_0x29e8('0x21')](_0x38767d,_0x37d044,{'sampleRate':0x1f40,'format':_0x29e8('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x42a1f3['on']('error',function(_0x2a0c90){logger[_0x29e8('0x15')](_0x29e8('0x23'),_0x2a0c90);_0x38b9fb(_0x2a0c90);});_0x42a1f3['on'](_0x29e8('0x20'),function(){logger['info'](_0x29e8('0x24'));_0x5475a9();});_0x42a1f3['start']();});}function base64Decode(_0x14c85d,_0x9de935){var _0x4ac8e8=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs[_0x29e8('0x27')](0x4)+_0x29e8('0x28'));fs[_0x29e8('0x29')](_0x4ac8e8,_0x14c85d,_0x29e8('0x2a'));return convertFile(_0x4ac8e8,_0x9de935)[_0x29e8('0x2b')](function(){try{fs['unlink'](_0x4ac8e8);fs[_0x29e8('0x2c')](_0x9de935,_0x29e8('0x2d'));}catch(_0x1ae6b0){logger[_0x29e8('0x15')](_0x1ae6b0);}return _0x9de935['split']('.')[0x0];});}function base64Encode(_0x2cb84d){var _0x44775b=fs['readFileSync'](_0x2cb84d);return new Buffer(_0x44775b)['toString'](_0x29e8('0x2a'));}exports['googleCloudTTS']=function(_0x195903,_0x2bfd99,_0x5b38b0,_0x3b0c34,_0x435305,_0x56f722){var _0x206009,_0x352a6d;var _0x413384=_0x29e8('0x2e');var _0x34156b=_0x29e8('0x2f')+_0x195903;var _0x1b8aa6={};if(_0x2bfd99==='ssml'){_0x1b8aa6[_0x29e8('0x30')]={'ssml':_0x5b38b0};}else{_0x1b8aa6[_0x29e8('0x30')]={'text':_0x5b38b0};};_0x1b8aa6[_0x29e8('0x31')]={'languageCode':_0x3b0c34,'ssmlGender':_0x435305};_0x1b8aa6[_0x29e8('0x32')]={'audioEncoding':_0x29e8('0x33'),'sampleRateHertz':0x1f40};var _0x1fb917={'url':_0x413384+_0x29e8('0x34')+_0x34156b,'method':_0x29e8('0x35'),'json':!![],'body':_0x1b8aa6};return rp(_0x1fb917)[_0x29e8('0x2b')](function(_0x4e3569){return new BPromise(function(_0x510e3b,_0x54bd33){_0x206009=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs['generate'](0x4)+_0x29e8('0x36'));var _0xb3292b=Buffer[_0x29e8('0x37')](_0x4e3569[_0x29e8('0x38')],'base64');return fs['writeFile'](_0x206009,_0xb3292b,function(_0x33ba0c){_0x54bd33(_0x33ba0c);},function(_0x3c1d83){fs[_0x29e8('0x2c')](_0x206009,'777');_0x510e3b(_0x3c1d83);});});})['then'](function(_0xf7bc19){_0x352a6d=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs['generate'](0x4)+_0x29e8('0x28'));return convertFile(_0x206009,_0x352a6d);})[_0x29e8('0x2b')](function(){try{fs[_0x29e8('0x1d')](_0x206009);fs[_0x29e8('0x2c')](_0x352a6d,_0x29e8('0x2d'));}catch(_0x5caa3e){logger[_0x29e8('0x15')](_0x5caa3e);}logger[_0x29e8('0x1b')](_0x29e8('0x39'),_0x352a6d[_0x29e8('0x3a')]('.')[0x0]);return _0x352a6d['split']('.')[0x0];});};exports[_0x29e8('0x3b')]=function(_0xc5ee88,_0x11daa0){var _0x698e1a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x31f5ff,_0x1c6bf7;var _0x3f8e1c;var _0x943c2a={'encoding':_0x29e8('0x3c'),'method':'POST','timeout':0x2710,'url':_0x698e1a,'headers':{'Content-Type':_0x29e8('0x3d')},'body':'f.req='+encodeURIComponent(JSON[_0x29e8('0x3e')]([[[_0x29e8('0x3f'),JSON[_0x29e8('0x3e')]([_0xc5ee88,_0x11daa0||'en',![],'null']),null,'generic']]]))};return rp(_0x943c2a)[_0x29e8('0x2b')](function(_0xde3a1b){try{_0x3f8e1c=eval(_0xde3a1b[_0x29e8('0x40')](0x5))[0x0][0x2];}catch(_0x52b94d){throw new Error(_0x29e8('0x41')+_0xde3a1b[_0x29e8('0x42')]);}if(!_0x3f8e1c){if(_0xc5ee88[_0x29e8('0x43')]>0xc8){throw new Error(_0x29e8('0x44'));}else{throw new Error('lang\x20\x22'+_0x11daa0+_0x29e8('0x45'));}}try{_0x3f8e1c=eval(_0x3f8e1c)[0x0];}catch(_0x2b7294){throw new Error(_0x29e8('0x41')+res[_0x29e8('0x42')]);}const _0x3ca2e2=_0x3f8e1c;_0x31f5ff=path['resolve'](__dirname,_0x29e8('0x26'),rs[_0x29e8('0x27')](0x4)+_0x29e8('0x36'));fs[_0x29e8('0x29')](_0x31f5ff,_0x3f8e1c,{'encoding':_0x29e8('0x2a')});_0x1c6bf7=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs[_0x29e8('0x27')](0x4)+_0x29e8('0x28'));return convertFile(_0x31f5ff,_0x1c6bf7);})[_0x29e8('0x2b')](function(){try{fs['unlink'](_0x31f5ff);fs[_0x29e8('0x2c')](_0x1c6bf7,_0x29e8('0x2d'));}catch(_0x2f0226){logger[_0x29e8('0x15')](_0x2f0226);}logger[_0x29e8('0x1b')](_0x29e8('0x46'),_0x1c6bf7[_0x29e8('0x3a')]('.')[0x0]);return _0x1c6bf7[_0x29e8('0x3a')]('.')[0x0];});};exports[_0x29e8('0x47')]=function(_0x42ade0,_0x5d6bee,_0xb9ee3d){return google[_0x29e8('0x48')](_0x42ade0,_0x5d6bee,_0xb9ee3d)[_0x29e8('0x2b')](function(_0x288fc2){logger[_0x29e8('0x1b')](_0x288fc2[_0x29e8('0x49')]);return rp(_0x288fc2);})[_0x29e8('0x2b')](function(_0x3b399a){var _0x53c88c='';var _0x2fe4a1=0x0;try{fs[_0x29e8('0x1d')](_0x42ade0);}catch(_0x4923c9){logger['error'](_0x4923c9);}if(_0x3b399a&&_0x3b399a[_0x29e8('0x4a')]){_0x53c88c=_0x3b399a[_0x29e8('0x4a')][_0x29e8('0x4b')](function(_0x1f41ac){return _0x1f41ac&&_0x1f41ac[_0x29e8('0x4c')][0x0]&&_0x1f41ac['alternatives'][0x0][_0x29e8('0x4d')]?_0x1f41ac[_0x29e8('0x4c')][0x0][_0x29e8('0x4d')]:'';})[_0x29e8('0x4e')]('\x0a');_0x2fe4a1=_0x3b399a[_0x29e8('0x4a')][_0x29e8('0x4b')](function(_0x10bdc1){return _0x10bdc1&&_0x10bdc1[_0x29e8('0x4c')][0x0]&&_0x10bdc1['alternatives'][0x0][_0x29e8('0x4f')]?_0x10bdc1['alternatives'][0x0][_0x29e8('0x4f')]:0x0;})[_0x29e8('0x4e')]('\x0a');}logger[_0x29e8('0x1b')]('googleASR\x20transcription',_0x53c88c);logger[_0x29e8('0x1b')](_0x29e8('0x50'),_0x2fe4a1);return{'transcript':_0x53c88c,'confidence':_0x2fe4a1};})['catch'](function(_0x5c8fd1){logger['error']('[%s]\x20%s:%s',_0x5c8fd1['statusCode'],_0x5c8fd1[_0x29e8('0x51')],_0x5c8fd1[_0x29e8('0x52')]);});};exports[_0x29e8('0x53')]=function(_0x15d7d7,_0x25cf5b,_0x107499,_0x5bdca7){var _0x1092d5=apiai(_0x25cf5b,{'language':_0x5bdca7||'en'});return _0x1092d5[_0x29e8('0x54')](_0x107499,{'sessionId':md5(_0x15d7d7)})['then'](function(_0x26f555){logger['info'](JSON[_0x29e8('0x3e')](_0x26f555));return{'source':_0x26f555['result'][_0x29e8('0x55')],'resolvedQuery':_0x26f555[_0x29e8('0x56')]['resolvedQuery'],'action':_0x26f555[_0x29e8('0x56')][_0x29e8('0x57')],'actionIncomplete':_0x26f555[_0x29e8('0x56')][_0x29e8('0x58')],'speech':_0x26f555[_0x29e8('0x56')]['fulfillment'][_0x29e8('0x59')],'score':_0x26f555[_0x29e8('0x56')][_0x29e8('0x5a')],'statusCode':_0x26f555[_0x29e8('0x5b')][_0x29e8('0x5c')],'endConversation':_0x26f555[_0x29e8('0x56')]['metadata'][_0x29e8('0x5d')]||![],'isFallbackIntent':_0x26f555[_0x29e8('0x56')]['metadata'][_0x29e8('0x5e')]};});};exports[_0x29e8('0x5f')]=function(_0x490100,_0x3f832d,_0x51ce09,_0x5dd9f0,_0x14f85b,_0x7c91db){var _0x3a443b=_0x5dd9f0[_0x29e8('0x60')](/\\n/g,'\x0a');var _0x125a3c={'credentials':{'private_key':_0x3a443b,'client_email':_0x51ce09}};var _0x407f34=new dialogflow['SessionsClient'](_0x125a3c);var _0xe2e2db=_0x407f34[_0x29e8('0x61')](_0x3f832d,md5(_0x490100));var _0x52b703={'session':_0xe2e2db,'queryInput':{'text':{'text':_0x14f85b,'languageCode':_0x7c91db}}};return _0x407f34[_0x29e8('0x62')](_0x52b703)[_0x29e8('0x2b')](function(_0x544f46){if(_0x544f46&&_0x544f46[_0x29e8('0x43')]){logger['info'](_0x29e8('0x63'),JSON[_0x29e8('0x3e')](_0x544f46));var _0x232e5d=_0x544f46[0x0];if(_0x232e5d){var _0x3b9992={'action':_0x232e5d[_0x29e8('0x64')][_0x29e8('0x57')],'allRequiredParamsPresent':_0x232e5d['queryResult'][_0x29e8('0x65')],'endConversation':_0x232e5d['queryResult'][_0x29e8('0x66')]&&_0x232e5d['queryResult'][_0x29e8('0x66')][_0x29e8('0x67')]?_0x232e5d['queryResult'][_0x29e8('0x66')][_0x29e8('0x67')][_0x29e8('0x68')][_0x29e8('0x69')]:![],'fulfillmentText':_0x232e5d['queryResult'][_0x29e8('0x6a')],'intentName':_0x232e5d[_0x29e8('0x64')]['intent'][_0x29e8('0x51')],'intentDisplayName':_0x232e5d['queryResult']['intent'][_0x29e8('0x6b')],'isFallbackIntent':_0x232e5d[_0x29e8('0x64')]['intent']['isFallback'],'languageCode':_0x232e5d[_0x29e8('0x64')][_0x29e8('0x6c')],'queryText':_0x232e5d[_0x29e8('0x64')][_0x29e8('0x6d')],'responseId':_0x232e5d['responseId'],'score':_0x232e5d[_0x29e8('0x64')]['intentDetectionConfidence'],'speech':_0x232e5d[_0x29e8('0x64')][_0x29e8('0x6a')],'providerResponse':JSON[_0x29e8('0x3e')](_0x544f46)};return _0x3b9992;}}});};exports[_0x29e8('0x6e')]=function(_0x1350aa,_0x4abc5e,_0x582973,_0x5b2c91){return tilde[_0x29e8('0x48')](_0x1350aa,_0x4abc5e,_0x582973,_0x5b2c91)[_0x29e8('0x2b')](function(_0x4fe891){try{fs['unlink'](_0x1350aa);}catch(_0x244859){logger[_0x29e8('0x15')](_0x244859);}logger['info']('Tilde\x20ASR\x20transcription',_0x4fe891[_0x29e8('0x4d')]);logger['info'](_0x29e8('0x6f'),_0x4fe891[_0x29e8('0x4f')]);return _0x4fe891;});};exports[_0x29e8('0x70')]=function(_0xedf078,_0x33c96d,_0x237c6b,_0x57cadc,_0x165a4a,_0x1db74c){var _0x28cc9f=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs['generate'](0x4)+'.mp3');var _0x223a6b;return aws['polly'](_0xedf078,_0x33c96d,_0x237c6b,_0x57cadc,_0x165a4a,_0x1db74c,_0x28cc9f)[_0x29e8('0x2b')](function(){_0x223a6b=path[_0x29e8('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x29e8('0x28'));return convertFile(_0x28cc9f,_0x223a6b);})['then'](function(){try{fs[_0x29e8('0x1d')](_0x28cc9f);fs[_0x29e8('0x2c')](_0x223a6b,_0x29e8('0x2d'));}catch(_0x871214){logger[_0x29e8('0x15')](_0x871214);}return _0x223a6b[_0x29e8('0x3a')]('.')[0x0];});};exports[_0x29e8('0x71')]=function(_0x1923b1,_0xf30cda,_0x3f4fd3,_0x39eaab,_0x12d3f7,_0x4028d9){return aws[_0x29e8('0x72')](_0x1923b1,_0xf30cda,_0x3f4fd3,_0x39eaab,_0x12d3f7,_0x4028d9)[_0x29e8('0x2b')](function(_0x42f754){logger[_0x29e8('0x1b')](JSON[_0x29e8('0x3e')](_0x42f754));return _0x42f754;});};exports[_0x29e8('0x73')]=function(_0x3cac2f,_0x41677b,_0x20eebe,_0x484836){var _0x582b61=util[_0x29e8('0x74')](_0x29e8('0x75'),ISPEECH_API,_0x3cac2f,encodeURIComponent(_0x41677b),_0x20eebe,_0x484836);var _0x5eaa4a=path['resolve'](__dirname,_0x29e8('0x26'),rs[_0x29e8('0x27')](0x4)+_0x29e8('0x36'));var _0x2203b6;return downloadFile(_0x582b61,_0x5eaa4a)[_0x29e8('0x2b')](function(){_0x2203b6=path[_0x29e8('0x25')](__dirname,_0x29e8('0x26'),rs[_0x29e8('0x27')](0x4)+_0x29e8('0x28'));return convertFile(_0x5eaa4a,_0x2203b6);})[_0x29e8('0x2b')](function(){try{fs[_0x29e8('0x1d')](_0x5eaa4a);fs[_0x29e8('0x2c')](_0x2203b6,_0x29e8('0x2d'));}catch(_0x151a6e){logger[_0x29e8('0x15')](_0x151a6e);}return _0x2203b6['split']('.')[0x0];});};exports[_0x29e8('0x76')]=function(_0x2bbe6f,_0x4e0be3,_0x5c3eb8,_0x2048e5){var _0x1899bf=util['format'](_0x29e8('0x77'),ISPEECH_API,_0x4e0be3,_0x5c3eb8,base64Encode(_0x2bbe6f),_0x2048e5?util['format']('model=%s',encodeURIComponent(_0x2048e5)):_0x29e8('0x78'));return uploadFile(_0x1899bf)[_0x29e8('0x2b')](function(_0x5389a4){return querystring[_0x29e8('0x9')](_0x5389a4);});};exports[_0x29e8('0x79')]=function(_0x59f20a,_0x578e00){return sestek['nda'](_0x59f20a,_0x578e00)['then'](function(_0x1c0e81){logger[_0x29e8('0x1b')](JSON[_0x29e8('0x3e')](_0x1c0e81));var _0x143a1b={'speech':_0x1c0e81[_0x29e8('0x7a')],'action':_0x1c0e81[_0x29e8('0x7b')]?_0x1c0e81[_0x29e8('0x7b')][_0x29e8('0x7c')]:undefined,'actiondata':_0x1c0e81['channelData']?_0x1c0e81['channelData'][_0x29e8('0x7d')]:undefined};if(_0x1c0e81[_0x29e8('0x7b')]&&_0x1c0e81['channelData'][_0x29e8('0x7e')]){return base64Decode(_0x1c0e81['channelData'][_0x29e8('0x7e')][_0x29e8('0x7f')],path[_0x29e8('0x25')](__dirname,'tmp',rs[_0x29e8('0x27')](0x4)+'.wav'))['then'](function(_0x554d09){_0x143a1b[_0x29e8('0x80')]=_0x554d09;return _0x143a1b;});}return _0x143a1b;});};exports[_0x29e8('0x81')]=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 016b042..6236ff5 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 _0x7387=['./nda'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7387,0x175));var _0x7738=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7387[_0x46e363];return _0x3fb059;};var nda=require(_0x7738('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xd8af=['./nda','exports'];(function(_0x379cb3,_0x36b828){var _0x29867f=function(_0x31f8b3){while(--_0x31f8b3){_0x379cb3['push'](_0x379cb3['shift']());}};_0x29867f(++_0x36b828);}(_0xd8af,0x162));var _0xfd8a=function(_0x2ef22d,_0x13ebc8){_0x2ef22d=_0x2ef22d-0x0;var _0x5dc1f7=_0xd8af[_0x2ef22d];return _0x5dc1f7;};var nda=require(_0xfd8a('0x0'));module[_0xfd8a('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 9ffc2c3..f31462d 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 _0xf72b=['channelData','ProjectName','body','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project'];(function(_0x453584,_0x2e633e){var _0x2f38e2=function(_0xb683dc){while(--_0xb683dc){_0x453584['push'](_0x453584['shift']());}};_0x2f38e2(++_0x2e633e);}(_0xf72b,0x1d9));var _0xbf72=function(_0x6339ce,_0x82ab43){_0x6339ce=_0x6339ce-0x0;var _0x58adba=_0xf72b[_0x6339ce];return _0x58adba;};'use strict';var rp=require(_0xbf72('0x0'));var url=require('url');var logger=require(_0xbf72('0x1'))('agi');module[_0xbf72('0x2')]=function(_0x1880d0,_0x5a9feb){var _0x339c11={'method':_0xbf72('0x3'),'uri':url[_0xbf72('0x4')](_0x5a9feb[_0xbf72('0x5')],_0xbf72('0x6')),'form':{'grant_type':_0xbf72('0x7'),'username':_0x5a9feb['username'],'password':_0x5a9feb[_0xbf72('0x7')]},'json':!![]};return rp(_0x339c11)[_0xbf72('0x8')](function(_0x119807){var _0xd0402c={'method':_0xbf72('0x3'),'uri':url[_0xbf72('0x4')](_0x5a9feb['ndassistant_url'],_0xbf72('0x9')),'body':{'type':_0x5a9feb['ndaactivity_type']||_0xbf72('0xa'),'channelId':_0xbf72('0xb'),'conversation':{'id':_0x1880d0['uniqueid']},'from':{'id':_0x1880d0[_0xbf72('0xc')],'name':_0x1880d0[_0xbf72('0xd')]},'recipient':{'id':_0x1880d0[_0xbf72('0xe')],'name':_0x1880d0[_0xbf72('0xf')]},'text':_0x5a9feb[_0xbf72('0x10')],'channelData':{}},'headers':{'Authorization':_0xbf72('0x11')+_0x119807[_0xbf72('0x12')]},'json':!![]};if(_0x5a9feb[_0xbf72('0x13')]){_0xd0402c['body'][_0xbf72('0x14')][_0xbf72('0x15')]=_0x5a9feb[_0xbf72('0x13')];}if(_0x5a9feb['ndagenerate_audio']=='1'){_0xd0402c[_0xbf72('0x16')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5a9feb[_0xbf72('0x17')]){_0xd0402c[_0xbf72('0x16')][_0xbf72('0x14')][_0xbf72('0x18')]=_0x5a9feb[_0xbf72('0x17')];if(_0x5a9feb[_0xbf72('0x19')]){_0xd0402c['body'][_0xbf72('0x14')][_0xbf72('0x1a')]=_0x5a9feb[_0xbf72('0x19')];}}logger[_0xbf72('0x1b')](JSON[_0xbf72('0x1c')](_0xd0402c));return rp(_0xd0402c);});}; \ No newline at end of file +var _0xf257=['extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','callerid','dnid'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf257,0x82));var _0x7f25=function(_0x2567b7,_0x10f946){_0x2567b7=_0x2567b7-0x0;var _0x3dcd65=_0xf257[_0x2567b7];return _0x3dcd65;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0x7f25('0x0'))(_0x7f25('0x1'));module[_0x7f25('0x2')]=function(_0x22d4a9,_0x5c712c){var _0x159dd1={'method':_0x7f25('0x3'),'uri':url[_0x7f25('0x4')](_0x5c712c[_0x7f25('0x5')],_0x7f25('0x6')),'form':{'grant_type':_0x7f25('0x7'),'username':_0x5c712c[_0x7f25('0x8')],'password':_0x5c712c[_0x7f25('0x7')]},'json':!![]};return rp(_0x159dd1)[_0x7f25('0x9')](function(_0x16e278){var _0x31a5d8={'method':_0x7f25('0x3'),'uri':url[_0x7f25('0x4')](_0x5c712c[_0x7f25('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5c712c[_0x7f25('0xb')]||_0x7f25('0xc'),'channelId':'Nda','conversation':{'id':_0x22d4a9['uniqueid']},'from':{'id':_0x22d4a9[_0x7f25('0xd')],'name':_0x22d4a9['calleridname']},'recipient':{'id':_0x22d4a9[_0x7f25('0xe')],'name':_0x22d4a9[_0x7f25('0xf')]},'text':_0x5c712c[_0x7f25('0x10')],'channelData':{}},'headers':{'Authorization':_0x7f25('0x11')+_0x16e278[_0x7f25('0x12')]},'json':!![]};if(_0x5c712c[_0x7f25('0x13')]){_0x31a5d8[_0x7f25('0x14')]['channelData']['ProjectName']=_0x5c712c[_0x7f25('0x13')];}if(_0x5c712c['ndagenerate_audio']=='1'){_0x31a5d8[_0x7f25('0x14')][_0x7f25('0x15')][_0x7f25('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7f25('0x17')};}if(_0x5c712c[_0x7f25('0x18')]){_0x31a5d8['body']['channelData']['CustomAction']=_0x5c712c[_0x7f25('0x18')];if(_0x5c712c[_0x7f25('0x19')]){_0x31a5d8[_0x7f25('0x14')][_0x7f25('0x15')][_0x7f25('0x1a')]=_0x5c712c[_0x7f25('0x19')];}}logger[_0x7f25('0x1b')](JSON[_0x7f25('0x1c')](_0x31a5d8));return rp(_0x31a5d8);});}; \ 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 ff7ae5d..28db710 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 _0xc7eb=['./lib/api','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc7eb,0x106));var _0xbc7e=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xc7eb[_0x456032];return _0x1a53cd;};'use strict';var asr=require(_0xbc7e('0x0'));module[_0xbc7e('0x1')]=function(_0x17944b,_0x41a87d,_0x242380,_0xb4dec){return asr(_0x17944b,_0x41a87d,_0x242380,_0xb4dec);}; \ No newline at end of file +var _0x4fe2=['./lib/api'];(function(_0x1a2b37,_0x4b95d9){var _0x3e82a5=function(_0x320174){while(--_0x320174){_0x1a2b37['push'](_0x1a2b37['shift']());}};_0x3e82a5(++_0x4b95d9);}(_0x4fe2,0x8e));var _0x24fe=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4fe2[_0x17d9e3];return _0x14192d;};'use strict';var asr=require(_0x24fe('0x0'));module['exports']=function(_0xdf4f8a,_0x32337d,_0x5cb558,_0x10e751){return asr(_0xdf4f8a,_0x32337d,_0x5cb558,_0x10e751);}; \ 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 2b43f86..3162b2e 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 _0xeca1=['Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','data','send','close','EOS','error','stringify','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','moment','crypto','agi','exports','info'];(function(_0x4e86fe,_0x4fb813){var _0x420928=function(_0x2e02b3){while(--_0x2e02b3){_0x4e86fe['push'](_0x4e86fe['shift']());}};_0x420928(++_0x4fb813);}(_0xeca1,0x122));var _0x1eca=function(_0x4478b5,_0x41aec6){_0x4478b5=_0x4478b5-0x0;var _0x4a90c6=_0xeca1[_0x4478b5];return _0x4a90c6;};'use strict';var BPromise=require(_0x1eca('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1eca('0x1'));var crypto=require(_0x1eca('0x2'));var logger=require('../../../../../../config/logger')(_0x1eca('0x3'));module[_0x1eca('0x4')]=function(_0x4fd345,_0x5db361,_0x508212,_0x3ec1ec){return new BPromise(function(_0x3f0648,_0x32da88){logger[_0x1eca('0x5')](_0x1eca('0x6'),_0x3ec1ec||_0x1eca('0x7'));var _0x3ddcf8=new WebSocket(_0x3ec1ec||_0x1eca('0x7'),{'perMessageDeflate':![]});var _0x5ac261='';var _0x2036e7='0';var _0x43f493='1';var _0x13ec8=_0x1eca('0x8');function _0x325521(_0x30716d){var _0x28d8e6=crypto['createHash']('sha1');_0x28d8e6[_0x1eca('0x9')](_0x30716d);return _0x28d8e6[_0x1eca('0xa')]('hex');}function _0x17ea66(){try{logger[_0x1eca('0x5')](_0x1eca('0xb'));var _0x256ce3=moment()[_0x1eca('0xc')]();var _0x4c8ce8=_0x325521(_0x256ce3+_0x5db361+_0x508212);_0x3ddcf8['send'](JSON['stringify']({'appID':_0x5db361,'timestamp':_0x256ce3,'appKey':_0x4c8ce8}));var _0x4734ba=fs['createReadStream'](_0x4fd345);_0x4734ba['on'](_0x1eca('0xd'),function(_0x14cbf3){_0x3ddcf8[_0x1eca('0xe')](_0x14cbf3);});_0x4734ba['on'](_0x1eca('0xf'),function(){_0x3ddcf8[_0x1eca('0xe')](_0x1eca('0x10'));});}catch(_0x2048ea){logger[_0x1eca('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0x1eca('0x12')](_0x2048ea));_0x3ddcf8[_0x1eca('0x13')]();}}function _0x31b7c2(_0x44a147){try{if(_0x44a147){var _0x56bf54=JSON[_0x1eca('0x14')](_0x44a147);switch(_0x56bf54['status']){case 0x0:if(_0x56bf54[_0x1eca('0x15')]){if(_0x56bf54[_0x1eca('0x15')]['final']){logger['info'](_0x1eca('0x16'),JSON[_0x1eca('0x12')](_0x56bf54[_0x1eca('0x15')][_0x1eca('0x17')]));_0x5ac261=_0x56bf54[_0x1eca('0x15')][_0x1eca('0x17')][0x0][_0x1eca('0x18')];_0x2036e7=_0x56bf54[_0x1eca('0x15')][_0x1eca('0x17')][0x0][_0x1eca('0x19')];_0x43f493='0';_0x13ec8='Success.';_0x3ddcf8[_0x1eca('0x13')]();}}break;case 0x1:logger[_0x1eca('0x5')](_0x1eca('0x8'));_0x43f493='1';_0x13ec8=_0x1eca('0x8');break;case 0x2:logger['info'](_0x1eca('0x1a'));_0x43f493='2';_0x13ec8=_0x1eca('0x1a');break;case 0x9:logger[_0x1eca('0x5')](_0x1eca('0x1b'));_0x43f493='9';_0x13ec8=_0x1eca('0x1b');break;case 0xa:logger['info'](_0x1eca('0x1c'));_0x43f493='10';_0x13ec8=_0x1eca('0x1c');break;case 0xb:logger[_0x1eca('0x5')](_0x1eca('0x1d'));_0x43f493='11';_0x13ec8=_0x1eca('0x1d');}}}catch(_0x4d844d){logger['error'](_0x1eca('0x1e'),JSON[_0x1eca('0x12')](_0x4d844d));_0x3ddcf8[_0x1eca('0x13')]();}}function _0x4e31dc(){logger[_0x1eca('0x5')](_0x1eca('0x1f'));_0x3f0648({'transcript':_0x5ac261,'confidence':_0x2036e7,'status':_0x43f493,'status_message':_0x13ec8});}function _0x484b00(_0x44fca2){logger['error'](_0x1eca('0x20'));if(!_[_0x1eca('0x21')](_0x44fca2)){logger[_0x1eca('0x11')](_[_0x1eca('0x22')](_0x44fca2)?JSON[_0x1eca('0x12')](_0x44fca2):_0x44fca2);}}_0x3ddcf8['on'](_0x1eca('0x23'),_0x17ea66);_0x3ddcf8['on'](_0x1eca('0x24'),_0x31b7c2);_0x3ddcf8['on']('close',_0x4e31dc);_0x3ddcf8['on'](_0x1eca('0x11'),_0x484b00);});}; \ No newline at end of file +var _0x268b=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','parse','status','result','final','hypotheses','transcript','likelihood','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info'];(function(_0x253f4c,_0x19d85f){var _0x15f4b7=function(_0xf12b5){while(--_0xf12b5){_0x253f4c['push'](_0x253f4c['shift']());}};_0x15f4b7(++_0x19d85f);}(_0x268b,0xc5));var _0xb268=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x268b[_0x4bed75];return _0x2dd8e8;};'use strict';var BPromise=require(_0xb268('0x0'));var _=require(_0xb268('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb268('0x2'));var crypto=require(_0xb268('0x3'));var logger=require(_0xb268('0x4'))(_0xb268('0x5'));module[_0xb268('0x6')]=function(_0x386204,_0x837b28,_0x69ca00,_0x492eef){return new BPromise(function(_0x57529e,_0x50c4dc){logger[_0xb268('0x7')]('Tilde\x20URI',_0x492eef||_0xb268('0x8'));var _0x55d87a=new WebSocket(_0x492eef||_0xb268('0x8'),{'perMessageDeflate':![]});var _0x4ef01e='';var _0x1a80fc='0';var _0x19cd8f='1';var _0x16e9dc=_0xb268('0x9');function _0x2ca45f(_0x356c06){var _0x872d23=crypto[_0xb268('0xa')](_0xb268('0xb'));_0x872d23[_0xb268('0xc')](_0x356c06);return _0x872d23[_0xb268('0xd')](_0xb268('0xe'));}function _0xaa30b7(){try{logger[_0xb268('0x7')](_0xb268('0xf'));var _0x4a6e64=moment()[_0xb268('0x10')]();var _0x187a8e=_0x2ca45f(_0x4a6e64+_0x837b28+_0x69ca00);_0x55d87a['send'](JSON[_0xb268('0x11')]({'appID':_0x837b28,'timestamp':_0x4a6e64,'appKey':_0x187a8e}));var _0x3ec65f=fs['createReadStream'](_0x386204);_0x3ec65f['on'](_0xb268('0x12'),function(_0x207592){_0x55d87a[_0xb268('0x13')](_0x207592);});_0x3ec65f['on'](_0xb268('0x14'),function(){_0x55d87a['send'](_0xb268('0x15'));});}catch(_0x3bcadc){logger[_0xb268('0x16')]('Tilde\x20ASR\x20send\x20error',JSON[_0xb268('0x11')](_0x3bcadc));_0x55d87a['terminate']();}}function _0x17763b(_0x58d59d){try{if(_0x58d59d){var _0x41114e=JSON[_0xb268('0x17')](_0x58d59d);switch(_0x41114e[_0xb268('0x18')]){case 0x0:if(_0x41114e['result']){if(_0x41114e[_0xb268('0x19')][_0xb268('0x1a')]){logger[_0xb268('0x7')]('Tilde\x20ASR\x20hypoteses',JSON[_0xb268('0x11')](_0x41114e['result'][_0xb268('0x1b')]));_0x4ef01e=_0x41114e['result']['hypotheses'][0x0][_0xb268('0x1c')];_0x1a80fc=_0x41114e[_0xb268('0x19')][_0xb268('0x1b')][0x0][_0xb268('0x1d')];_0x19cd8f='0';_0x16e9dc='Success.';_0x55d87a[_0xb268('0x1e')]();}}break;case 0x1:logger[_0xb268('0x7')](_0xb268('0x9'));_0x19cd8f='1';_0x16e9dc='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb268('0x7')](_0xb268('0x1f'));_0x19cd8f='2';_0x16e9dc=_0xb268('0x1f');break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x19cd8f='9';_0x16e9dc=_0xb268('0x20');break;case 0xa:logger[_0xb268('0x7')](_0xb268('0x21'));_0x19cd8f='10';_0x16e9dc=_0xb268('0x21');break;case 0xb:logger[_0xb268('0x7')](_0xb268('0x22'));_0x19cd8f='11';_0x16e9dc=_0xb268('0x22');}}}catch(_0x46545e){logger[_0xb268('0x16')](_0xb268('0x23'),JSON[_0xb268('0x11')](_0x46545e));_0x55d87a[_0xb268('0x1e')]();}}function _0x2fe212(){logger[_0xb268('0x7')](_0xb268('0x24'));_0x57529e({'transcript':_0x4ef01e,'confidence':_0x1a80fc,'status':_0x19cd8f,'status_message':_0x16e9dc});}function _0x3a051c(_0x5419c5){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb268('0x25')](_0x5419c5)){logger[_0xb268('0x16')](_[_0xb268('0x26')](_0x5419c5)?JSON['stringify'](_0x5419c5):_0x5419c5);}}_0x55d87a['on'](_0xb268('0x27'),_0xaa30b7);_0x55d87a['on'](_0xb268('0x28'),_0x17763b);_0x55d87a['on'](_0xb268('0x14'),_0x2fe212);_0x55d87a['on'](_0xb268('0x16'),_0x3a051c);});}; \ 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 5b9ae8a..2420c4b 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 _0x9485=['exports'];(function(_0x259bca,_0x481296){var _0xd2bbc6=function(_0x20eed7){while(--_0x20eed7){_0x259bca['push'](_0x259bca['shift']());}};_0xd2bbc6(++_0x481296);}(_0x9485,0x14b));var _0x5948=function(_0x10857a,_0x2fbd8b){_0x10857a=_0x10857a-0x0;var _0x1a1317=_0x9485[_0x10857a];return _0x1a1317;};var asr=require('./asr');module[_0x5948('0x0')]={'asr':asr}; \ No newline at end of file +var _0xccbe=['./asr'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xccbe,0x12a));var _0xeccb=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xccbe[_0x5180c3];return _0x55c975;};var asr=require(_0xeccb('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 131f12a..346da93 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 _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(_0x220527,_0x5e83d6){var _0xc379ef=function(_0x4877a5){while(--_0x4877a5){_0x220527['push'](_0x220527['shift']());}};_0xc379ef(++_0x5e83d6);}(_0x34e8,0x12c));var _0x834e=function(_0x44ddcf,_0x3e5068){_0x44ddcf=_0x44ddcf-0x0;var _0x326e7f=_0x34e8[_0x44ddcf];return _0x326e7f;};'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 +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(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b1170b3..eb48e27 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 _0x2bb0=['no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','hasOwnProperty','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','dialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','NOBEEP','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','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','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','debug','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','replaceAll','join','util','lodash','shelljs','randomstring','request-promise','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','then','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','createSquareRecording','uniqueid','context','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agentPause','agent','callerid','agentUnpause','agentLogout','agentLogin','internal','format','shellCommand','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','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','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','Amy','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','replaceAllVariables','saveRestApiResult','%s.%s','length','split','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','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','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id'];(function(_0x1406ae,_0x292395){var _0x23a076=function(_0x5e147a){while(--_0x5e147a){_0x1406ae['push'](_0x1406ae['shift']());}};_0x23a076(++_0x292395);}(_0x2bb0,0xf3));var _0x02bb=function(_0xb6f375,_0x30c661){_0xb6f375=_0xb6f375-0x0;var _0x1a98f5=_0x2bb0[_0xb6f375];return _0x1a98f5;};'use strict';var fs=require('fs');var util=require(_0x02bb('0x0'));var _=require(_0x02bb('0x1'));var sh=require(_0x02bb('0x2'));var odbc=require('odbc')();var rs=require(_0x02bb('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x02bb('0x4'));var logger=require('../../config/logger')(_0x02bb('0x5'));var config=require(_0x02bb('0x6'));var shared=require(_0x02bb('0x7'));var scripts=require(_0x02bb('0x8'));var FILES_PATH=_0x02bb('0x9');var recursiveMapAttributes=[_0x02bb('0xa'),_0x02bb('0xb')];var verticesWithRetry=['menu',_0x02bb('0xc'),_0x02bb('0xd')];var AGIVertices=function(_0x23f816,_0x4c5124,_0x3d28d5){this['channel']=_0x23f816;this[_0x02bb('0xe')]=_0x4c5124;this[_0x02bb('0xf')]=_0x3d28d5;};AGIVertices['prototype'][_0x02bb('0x10')]=function(_0x1c1915,_0x3c1149){this['rpc'][_0x02bb('0x11')](_0x1c1915)['then'](function(_0x3fa733){_0x3c1149(null,_0x3fa733?_0x3fa733[_0x02bb('0x12')]:![]);})[_0x02bb('0x13')](function(_0x5c8728){_0x3c1149(_0x5c8728);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x15')]=function(_0xc89e1b,_0x498ac4){this[_0x02bb('0xe')]['getVoiceQueueById'](_0xc89e1b)[_0x02bb('0x16')](function(_0x17d70e){_0x498ac4(null,_0x17d70e?_0x17d70e[_0x02bb('0x12')]:![]);})[_0x02bb('0x13')](function(_0x264ef4){_0x498ac4(_0x264ef4);});};AGIVertices[_0x02bb('0x14')]['getSquareProject']=function(_0x50f402,_0x4711fb){this[_0x02bb('0xe')][_0x02bb('0x17')](_0x50f402)[_0x02bb('0x16')](function(_0x23da71){_0x4711fb(null,_0x23da71?_0x23da71[_0x02bb('0x12')]:![]);})['catch'](function(_0x362b16){_0x4711fb(_0x362b16);});};AGIVertices['prototype'][_0x02bb('0x18')]=function(_0x298340,_0x1b607f){this['rpc'][_0x02bb('0x19')](_0x298340)[_0x02bb('0x16')](function(_0x147f48){_0x1b607f(null,_0x147f48?_0x147f48['dsn']:![]);})[_0x02bb('0x13')](function(_0x5f28d6){_0x1b607f(_0x5f28d6);});};AGIVertices['prototype'][_0x02bb('0x1a')]=function(_0x4b9b16,_0x1195f3){this[_0x02bb('0xe')][_0x02bb('0x1b')](_0x4b9b16)[_0x02bb('0x16')](function(_0x12e265){_0x1195f3(null,_0x12e265?_0x12e265[_0x02bb('0x12')]:![]);})[_0x02bb('0x13')](function(_0x54ac46){_0x1195f3(_0x54ac46);});};AGIVertices['prototype'][_0x02bb('0x1c')]=function(_0x5ac511,_0x3d4742){this[_0x02bb('0xe')][_0x02bb('0x1d')](_0x5ac511)['then'](function(_0x20b55e){_0x3d4742(null,_0x20b55e?_0x20b55e[_0x02bb('0x12')]:![]);})['catch'](function(_0x3c483f){_0x3d4742(_0x3c483f);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1e')]=function(_0x39b10b,_0x2c44b7){var _0x32e5e5=this;this['rpc'][_0x02bb('0x1f')](_0x39b10b)['then'](function(_0x1fffab){_0x2c44b7(null,_0x1fffab?_0x32e5e5[_0x02bb('0x20')](_0x1fffab[_0x02bb('0x21')]):![]);})['catch'](function(_0x548f1b){_0x2c44b7(_0x548f1b);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x22')]=function(_0x4c94a2,_0x4116b6){this[_0x02bb('0xe')][_0x02bb('0x23')](_0x4c94a2)['then'](function(_0x4d0d88){_0x4116b6(null,_0x4d0d88?_0x4d0d88:![]);})[_0x02bb('0x13')](function(_0x545174){_0x4116b6(_0x545174);});};AGIVertices['prototype'][_0x02bb('0x24')]=function(_0x31d2dd,_0x491085,_0x32eae2){this[_0x02bb('0xf')][_0x02bb('0x24')](_0x31d2dd,_0x491085)['then'](function(){_0x32eae2(null);})[_0x02bb('0x13')](function(_0x1d7723){_0x32eae2(_0x1d7723);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x25')]=function(_0x118178,_0x1f8ea7){this[_0x02bb('0xe')][_0x02bb('0x26')](_0x118178)[_0x02bb('0x16')](function(_0x3468c5){if(_0x3468c5){if(_0x3468c5['IntervalId']){_0x1f8ea7(null,[_0x3468c5[_0x02bb('0x27')]]);}else{_0x1f8ea7(null,_[_0x02bb('0x28')](_0x3468c5['Intervals'],_0x02bb('0x27')));}}else{_0x1f8ea7(null,![]);}})[_0x02bb('0x13')](function(_0x7a6731){_0x1f8ea7(_0x7a6731);});};AGIVertices[_0x02bb('0x14')]['getSoundPath']=function(_0x3e4233){return util['format'](_0x02bb('0x29'),FILES_PATH,_0x3e4233);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x2a')]=function(_0xa20ed8,_0x103e3e,_0x5d55a4){odbc[_0x02bb('0x2b')](_0xa20ed8,function(_0x4e6e29){if(_0x4e6e29){logger[_0x02bb('0x2c')](_0x02bb('0x2d'),_0x4e6e29);_0x5d55a4(_0x4e6e29);}else{logger['info'](_0x02bb('0x2e'));odbc[_0x02bb('0x2f')](_0x103e3e,function(_0x128a12,_0x336aab){if(_0x128a12){logger[_0x02bb('0x30')](_0x02bb('0x31'),_0x103e3e);_0x5d55a4(_0x128a12);}else{logger['info'](_0x02bb('0x32'),_0x103e3e);odbc['close'](function(_0x1aac3f){if(_0x1aac3f){logger[_0x02bb('0x2c')](_0x02bb('0x33'),_0x1aac3f);}_0x5d55a4(null,_0x336aab);});}});}});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x34')]=function(_0x36d878,_0x2f24f1){this[_0x02bb('0xe')][_0x02bb('0x35')](_0x36d878)['then'](function(_0x146b1d){_0x2f24f1(null,_0x146b1d?_0x146b1d:![]);})[_0x02bb('0x13')](function(_0x4b8f93){_0x2f24f1(_0x4b8f93);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x36')]=function(_0x4a9fe3,_0x546233){this[_0x02bb('0xe')][_0x02bb('0x36')](_0x4a9fe3)[_0x02bb('0x16')](function(_0x430f3a){_0x546233(null,_0x430f3a);})[_0x02bb('0x13')](function(_0x21bc44){_0x546233(_0x21bc44);});};AGIVertices['prototype'][_0x02bb('0x37')]=function(_0x4d9b8e,_0x56da28,_0x116bf0){this[_0x02bb('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x02bb('0x38')]['uniqueid'],'node':_0x4d9b8e[_0x02bb('0x39')],'application':_0x4d9b8e[_0x02bb('0x3a')],'data':_0x56da28||null,'project_name':this[_0x02bb('0x38')]['arg_1'],'callerid':this['channel']['callerid']})['then'](function(_0xfddaa5){if(_0x116bf0){_0x116bf0(null,_0xfddaa5);}})[_0x02bb('0x13')](function(_0x2eab6f){if(_0x116bf0){_0x116bf0(_0x2eab6f);}});};AGIVertices['prototype'][_0x02bb('0x3b')]=function(_0x13a831,_0x24743e,_0x493a2c,_0x130e38){this[_0x02bb('0xe')][_0x02bb('0x3b')]({'uniqueid':this[_0x02bb('0x38')][_0x02bb('0x3c')],'callerid':this['channel']['callerid'],'calleridname':this[_0x02bb('0x38')]['calleridname'],'context':this['channel'][_0x02bb('0x3d')],'extension':this[_0x02bb('0x38')]['extension'],'priority':this[_0x02bb('0x38')][_0x02bb('0x3e')],'accountcode':this[_0x02bb('0x38')]['accountcode'],'dnid':this[_0x02bb('0x38')][_0x02bb('0x3f')],'projectName':this[_0x02bb('0x38')][_0x02bb('0x40')],'saveName':_0x24743e,'filename':_0x13a831[_0x02bb('0x41')]||_0x24743e,'savePath':_0x493a2c})[_0x02bb('0x16')](function(_0x1de181){_0x130e38(null,_0x1de181);})['catch'](function(_0x2be006){_0x130e38(_0x2be006);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x42')]=function(_0x29ce40,_0x5665e4,_0x171f85,_0x298b3f,_0xed7561){this[_0x02bb('0xe')][_0x02bb('0x42')]({'uniqueid':this[_0x02bb('0x38')][_0x02bb('0x3c')],'body':_0x29ce40,'direction':_0x5665e4,'providerName':_0x171f85,'providerResponse':_0x298b3f})[_0x02bb('0x16')](function(_0x3188e3){if(_0xed7561){_0xed7561(null,_0x3188e3);}})[_0x02bb('0x13')](function(_0x188de0){if(_0xed7561){_0xed7561(_0x188de0);}});};AGIVertices['prototype'][_0x02bb('0x43')]=function(_0x488f13,_0x90bb4b){this[_0x02bb('0xe')][_0x02bb('0x43')]({'firstName':_[_0x02bb('0x44')](_0x488f13[_0x02bb('0x12')])||_[_0x02bb('0x45')](_0x488f13[_0x02bb('0x12')])?_0x02bb('0x46')+Math['random']():_0x488f13[_0x02bb('0x12')],'lastName':_[_0x02bb('0x44')](_0x488f13[_0x02bb('0x47')])||_[_0x02bb('0x45')](_0x488f13[_0x02bb('0x47')])?null:_0x488f13[_0x02bb('0x47')],'phone':_0x488f13['phone'],'ListId':_0x488f13[_0x02bb('0x48')],'scheduledat':_0x488f13[_0x02bb('0x49')],'callbackUniqueid':this[_0x02bb('0x38')]['uniqueid'],'tags':_0x02bb('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0x488f13[_0x02bb('0x49')][_0x02bb('0x4b')](),'priority':_0x488f13[_0x02bb('0x4c')]})[_0x02bb('0x16')](function(_0x1045fd){_0x90bb4b(null,_0x1045fd);})[_0x02bb('0x13')](function(_0x44b3fb){_0x90bb4b(_0x44b3fb);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x4d')]=function(_0x414c05,_0x59afd8){this[_0x02bb('0xe')][_0x02bb('0x4e')](_0x414c05)[_0x02bb('0x16')](function(_0x59ddf5){_0x59afd8(null,_0x59ddf5?_0x59ddf5[_0x02bb('0x12')]:![]);})[_0x02bb('0x13')](function(_0x31952){_0x59afd8(_0x31952);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x4f')]=function(_0x500783,_0x154988,_0x4f174f){var _0x2e5a80={'role':_0x02bb('0x50')};_0x2e5a80[_0x500783]=this[_0x02bb('0x38')][_0x02bb('0x51')];this[_0x02bb('0xe')][_0x02bb('0x4f')](_0x2e5a80,_0x154988,this[_0x02bb('0x38')][_0x02bb('0x3c')])[_0x02bb('0x16')](function(_0x5f3130){_0x4f174f(null,_['isNil'](_0x5f3130)?![]:!![]);})[_0x02bb('0x13')](function(_0x3559ad){logger['error'](_0x3559ad);_0x4f174f(null,![]);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x52')]=function(_0x40e616,_0x1823d4){var _0x9be9c9={'role':_0x02bb('0x50')};_0x9be9c9[_0x40e616]=this['channel'][_0x02bb('0x51')];this[_0x02bb('0xe')][_0x02bb('0x52')](_0x9be9c9)[_0x02bb('0x16')](function(_0x6fa5f9){_0x1823d4(null,_[_0x02bb('0x45')](_0x6fa5f9)?![]:!![]);})[_0x02bb('0x13')](function(_0x18aa78){logger['error'](_0x18aa78);_0x1823d4(null,![]);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x53')]=function(_0x5bf426,_0x3090a0){var _0xbdbf3d={'role':_0x02bb('0x50')};_0xbdbf3d[_0x5bf426]=this[_0x02bb('0x38')][_0x02bb('0x51')];this[_0x02bb('0xe')][_0x02bb('0x53')](_0xbdbf3d)[_0x02bb('0x16')](function(_0x954602){_0x3090a0(null,_[_0x02bb('0x45')](_0x954602)?![]:!![]);})[_0x02bb('0x13')](function(_0x2908e5){logger[_0x02bb('0x2c')](_0x2908e5);_0x3090a0(null,![]);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x54')]=function(_0x14e588,_0x520416){var _0x2990ee={'role':_0x02bb('0x50')};_0x2990ee[_0x14e588]=this[_0x02bb('0x38')][_0x02bb('0x51')];var _0x2d1e23=_0x14e588!=_0x02bb('0x55')?util[_0x02bb('0x56')]('%s/%s@from-sip/n','LOCAL',this[_0x02bb('0x38')][_0x02bb('0x51')]):undefined;this[_0x02bb('0xe')][_0x02bb('0x54')](_0x2990ee,_0x2d1e23)[_0x02bb('0x16')](function(_0xeb2222){_0x520416(null,_[_0x02bb('0x45')](_0xeb2222)?![]:!![]);})[_0x02bb('0x13')](function(_0x2435a7){logger['error'](_0x2435a7);_0x520416(null,![]);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x57')]=function(_0x55bc56,_0x380e52){sh[_0x02bb('0x58')](_['trim'](_0x55bc56),function(_0x559737,_0x5efcc3){var _0x51a526=_0x5efcc3['replace'](/(\r\n|\n|\r)/gm,'');_0x380e52(null,_0x51a526);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x59')]=function(_0x3b33c1,_0x31f98d){scripts['googleCloudTTS'](_0x3b33c1[_0x02bb('0x5a')],_0x3b33c1[_0x02bb('0x5b')]||_0x02bb('0x5c'),_0x3b33c1[_0x02bb('0x5c')],_0x3b33c1['languageCode']||_0x02bb('0x5d'),_0x3b33c1['ssmlGender']||'MALE',_0x3b33c1[_0x02bb('0x5e')]||_0x02bb('0x5f'))['then'](function(_0x1b7e9e){_0x31f98d(null,_0x1b7e9e);})['catch'](function(_0x3b4ccc){_0x31f98d(_0x3b4ccc);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x60')]=function(_0x314a0f,_0x465336){scripts[_0x02bb('0x60')](_0x314a0f[_0x02bb('0x5c')],_0x314a0f[_0x02bb('0x61')]||'en',0x1)[_0x02bb('0x16')](function(_0x3adeb4){_0x465336(null,_0x3adeb4);})['catch'](function(_0x7e581f){_0x465336(_0x7e581f);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x62')]=function(_0x453fbc,_0xacef0f){var _0x4dc228={'uri':_0x453fbc['url'],'method':_0x453fbc[_0x02bb('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x453fbc[_0x02bb('0x64')])==='number'&&parseInt(_0x453fbc[_0x02bb('0x64')])>=0x1?parseInt(_0x453fbc[_0x02bb('0x64')])*0x3e8:0x5*0x3e8};if(_[_0x02bb('0x65')]([_0x02bb('0x66'),_0x02bb('0x67')],_0x4dc228[_0x02bb('0x63')][_0x02bb('0x68')]())){try{_0x4dc228['body']=_0x453fbc['rawBody']?JSON[_0x02bb('0x69')](_0x453fbc[_0x02bb('0xb')]):{};}catch(_0x36be6f){logger[_0x02bb('0x2c')](_0x02bb('0x6a'),_0x36be6f);}}try{_0x4dc228[_0x02bb('0x6b')]=_0x453fbc[_0x02bb('0xa')]?JSON[_0x02bb('0x69')](_0x453fbc[_0x02bb('0xa')]):{};}catch(_0x214a85){logger['error'](_0x02bb('0x6c'),_0x214a85);}if(_0x453fbc['computedVariables']){try{var _0x839aa3=require(_0x453fbc[_0x02bb('0x6d')])[_0x02bb('0x6e')](this,_0x4dc228);_0x4dc228[_0x02bb('0x6f')]=Mustache[_0x02bb('0x70')](_0x453fbc[_0x02bb('0x71')],_0x839aa3,{},['$$','$$']);if(_0x4dc228[_0x02bb('0x6b')]){_0x4dc228[_0x02bb('0x6b')]=JSON[_0x02bb('0x69')](Mustache[_0x02bb('0x70')](JSON[_0x02bb('0x72')](_0x4dc228[_0x02bb('0x6b')]),_0x839aa3,{},['$$','$$']));}if(_0x4dc228['body']){_0x4dc228[_0x02bb('0x73')]=JSON['parse'](Mustache['render'](JSON[_0x02bb('0x72')](_0x4dc228[_0x02bb('0x73')]),_0x839aa3,{},['$$','$$']));}}catch(_0x2fb03d){logger[_0x02bb('0x2c')](_0x02bb('0x74'),_0x2fb03d);}}rp(_0x4dc228)[_0x02bb('0x16')](function(_0x49443f){var _0x32dda5={'statusCode':_0x49443f['statusCode']||0xc8,'statusMessage':_0x49443f['statusMessage']||'OK','headers':_0x49443f[_0x02bb('0x6b')]||{},'body':_0x49443f[_0x02bb('0x73')]||{}};_0xacef0f(null,_0x32dda5);})[_0x02bb('0x13')](function(_0x1f7fe1){var _0x8a4e12={'statusCode':_0x1f7fe1[_0x02bb('0x75')]||0x1f4,'statusMessage':_0x1f7fe1[_0x02bb('0x76')]||_0x02bb('0x77'),'headers':_0x1f7fe1[_0x02bb('0x78')]['headers']||{},'body':_0x1f7fe1[_0x02bb('0x78')][_0x02bb('0x73')]||{}};_0xacef0f(null,_0x8a4e12);});};AGIVertices[_0x02bb('0x14')]['googleDialogflow']=function(_0x85d0b8,_0x2bd921){scripts['googleDialogflow'](this['channel'][_0x02bb('0x3c')],_0x85d0b8[_0x02bb('0x79')],_0x85d0b8[_0x02bb('0x5c')],_0x85d0b8[_0x02bb('0x7a')]||'en')[_0x02bb('0x16')](function(_0xb29a59){_0x2bd921(null,_0xb29a59);})[_0x02bb('0x13')](function(_0x26de07){_0x2bd921(_0x26de07);});};AGIVertices[_0x02bb('0x14')]['googleDialogflowV2']=function(_0x3b6603,_0x222f3f){scripts['googleDialogflowV2'](this[_0x02bb('0x38')][_0x02bb('0x3c')],_0x3b6603[_0x02bb('0x7b')],_0x3b6603[_0x02bb('0x7c')],_0x3b6603[_0x02bb('0x7d')],_0x3b6603[_0x02bb('0x5c')],_0x3b6603[_0x02bb('0x7e')]||'en')['then'](function(_0x439799){_0x222f3f(null,_0x439799);})[_0x02bb('0x13')](function(_0x73d2b3){_0x222f3f(_0x73d2b3);});};AGIVertices['prototype'][_0x02bb('0x7f')]=function(_0xd9a87f,_0x569364){scripts['sestekNDA'](this[_0x02bb('0x38')],_0xd9a87f)[_0x02bb('0x16')](function(_0x53520f){_0x569364(null,_0x53520f);})[_0x02bb('0x13')](function(_0xf77848){_0x569364(_0xf77848);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x80')]=function(_0x5b6802,_0x25175a){scripts[_0x02bb('0x80')](_0x5b6802[_0x02bb('0x79')],_0x5b6802[_0x02bb('0x5c')],_0x5b6802[_0x02bb('0x81')]||'en-US',_0x5b6802[_0x02bb('0x82')])[_0x02bb('0x16')](function(_0x1d1b96){_0x25175a(null,_0x1d1b96);})[_0x02bb('0x13')](function(_0x2c66b5){_0x25175a(_0x2c66b5);});};AGIVertices[_0x02bb('0x14')]['ispeechASR']=function(_0x178c48,_0x12b556,_0x533191){scripts[_0x02bb('0x83')](_0x12b556,_0x178c48[_0x02bb('0x79')],_0x178c48[_0x02bb('0x84')]||_0x02bb('0x5d'),this[_0x02bb('0x85')](_0x178c48['model'])?_0x178c48[_0x02bb('0x86')]:undefined)[_0x02bb('0x16')](function(_0x286d69){_0x533191(null,_0x286d69);})[_0x02bb('0x13')](function(_0x430c2a){_0x533191(_0x430c2a);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x87')]=function(_0x5f9088,_0x4cd1f6){scripts[_0x02bb('0x87')](_0x5f9088[_0x02bb('0x88')],_0x5f9088['aws_secret_access_key'],_0x5f9088[_0x02bb('0x89')],_0x5f9088['aws_polly_voice']||_0x02bb('0x8a'),_0x5f9088[_0x02bb('0x5c')],_0x5f9088['aws_text_type']||'text')[_0x02bb('0x16')](function(_0x1c073a){_0x4cd1f6(null,_0x1c073a);})[_0x02bb('0x13')](function(_0x57b181){_0x4cd1f6(_0x57b181);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x8b')]=function(_0x15b2ca,_0x13a19e){scripts['awsLex'](this[_0x02bb('0x38')]['uniqueid'],_0x15b2ca[_0x02bb('0x88')],_0x15b2ca[_0x02bb('0x8c')],_0x15b2ca[_0x02bb('0x8d')],_0x15b2ca[_0x02bb('0x5c')],_0x15b2ca['aws_bot_name'])[_0x02bb('0x16')](function(_0x3bd2ac){_0x13a19e(null,_0x3bd2ac);})[_0x02bb('0x13')](function(_0x15c8a5){_0x13a19e(_0x15c8a5);});};AGIVertices['prototype'][_0x02bb('0x8e')]=function(_0x28992c,_0x4d205d,_0x37ae1b){scripts['googleASR'](_0x4d205d,_0x28992c[_0x02bb('0x79')],_0x28992c[_0x02bb('0x8f')]||'en-US')['then'](function(_0x37a783){_0x37ae1b(null,_0x37a783);})[_0x02bb('0x13')](function(_0x9720c4){_0x37ae1b(_0x9720c4);});};AGIVertices[_0x02bb('0x14')][_0x02bb('0x90')]=function(_0x2a1cc3,_0x7430e6,_0x37f50a){scripts['tildeASR'](_0x7430e6,_0x2a1cc3[_0x02bb('0x91')],_0x2a1cc3[_0x02bb('0x92')],_0x2a1cc3[_0x02bb('0x6f')])[_0x02bb('0x16')](function(_0x3f3cd2){_0x37f50a(null,_0x3f3cd2);})[_0x02bb('0x13')](function(_0x131c8c){_0x37f50a(_0x131c8c);});};AGIVertices['prototype'][_0x02bb('0x93')]=function(_0x595dce){var _0x5ea8f7=_[_0x02bb('0x65')](verticesWithRetry,_0x595dce[_0x02bb('0x3a')])?_0x595dce:_['clone'](_0x595dce);for(var _0x4360b1 in _0x5ea8f7){if(_0x5ea8f7['hasOwnProperty'](_0x4360b1)){if(_0x5ea8f7[_0x4360b1]&&_[_0x02bb('0x94')](_0x5ea8f7[_0x4360b1])){if(_['includes'](recursiveMapAttributes,_0x4360b1)){_0x5ea8f7[_0x4360b1]=this[_0x02bb('0x95')](_0x5ea8f7[_0x4360b1]);}else{_0x5ea8f7[_0x4360b1]=this['replaceAllVariables'](_0x5ea8f7[_0x4360b1]);}}}}return _0x5ea8f7;};AGIVertices['prototype'][_0x02bb('0x96')]=function(_0xac5228){for(var _0x57eec9 in _0xac5228){if(_0xac5228['hasOwnProperty'](_0x57eec9)){if(_[_0x02bb('0x97')](_0xac5228[_0x57eec9])){this[_0x02bb('0x96')](_0xac5228[_0x57eec9]);}else if(_[_0x02bb('0x98')](_0xac5228[_0x57eec9])){for(var _0x262c93=0x0;_0x262c93<_0xac5228[_0x57eec9]['length'];_0x262c93++){this['recursiveNodeIndex'](_0xac5228[_0x57eec9][_0x262c93]);}}else if(_[_0x02bb('0x94')](_0xac5228[_0x57eec9])){_0xac5228[_0x57eec9]=this[_0x02bb('0x99')](_0xac5228[_0x57eec9]);}}}};AGIVertices[_0x02bb('0x14')]['saveRestApiResult']=function(_0x365ec5,_0x25c27d){for(var _0x42dd3d in _0x365ec5){if(_0x365ec5['hasOwnProperty'](_0x42dd3d)){if(_['isPlainObject'](_0x365ec5[_0x42dd3d])){if(!_['isEmpty'](_0x365ec5[_0x42dd3d])){this[_0x02bb('0x9a')](_0x365ec5[_0x42dd3d],util[_0x02bb('0x56')](_0x02bb('0x9b'),_0x25c27d,_0x42dd3d));}}else if(_['isArray'](_0x365ec5[_0x42dd3d])){for(var _0x5b7c82=0x0;_0x5b7c82<_0x365ec5[_0x42dd3d][_0x02bb('0x9c')];_0x5b7c82++){this[_0x02bb('0x9a')](_0x365ec5[_0x42dd3d][_0x5b7c82],util[_0x02bb('0x56')]('%s.%s',_0x25c27d,_0x42dd3d+'['+_0x5b7c82+']'));}}else{if(!_[_0x02bb('0x45')](_0x365ec5[_0x42dd3d])){this[_0x02bb('0x38')]['setVariable'](util['format'](_0x02bb('0x9b'),_0x25c27d,_0x42dd3d),_0x365ec5[_0x42dd3d]);}}}}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x95')]=function(_0x2d0c73){try{var _0x2a2316=JSON[_0x02bb('0x69')](_0x2d0c73);this[_0x02bb('0x96')](_0x2a2316);return JSON['stringify'](_0x2a2316);}catch(_0x2e37f6){return this['replaceAllVariables'](_0x2d0c73);}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x99')]=function(_0x29f646){var _0x1fb1e6=_0x29f646[_0x02bb('0x9d')]('{');for(var _0x459ebd=0x1;_0x459ebd<_0x1fb1e6[_0x02bb('0x9c')];_0x459ebd+=0x1){var _0x3f12df=_0x1fb1e6[_0x459ebd]['split']('}');if(_0x3f12df[_0x02bb('0x9c')]>0x1){_0x29f646=_0x29f646['replaceAll']('{'+_0x3f12df[0x0]+'}',this['channel'][_0x02bb('0x10')](_0x3f12df[0x0])['extra']||_0x3f12df[0x0]);}}if(_0x1fb1e6[_0x02bb('0x9c')]===0x1){return _0x29f646['toString']();}return this[_0x02bb('0x99')](_0x29f646);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x9e')]=function(_0x463237,_0x306ae1){var _0x350b96=this['channel'][_0x02bb('0x10')](_0x463237);if(_0x350b96[_0x02bb('0x9f')]===-0x1){return _0x350b96;}logger['info'](util[_0x02bb('0x56')](_0x02bb('0xa0'),_0x306ae1,_0x350b96[_0x02bb('0xa1')]));return this[_0x02bb('0x38')][_0x02bb('0xa2')](_0x306ae1,_0x350b96[_0x02bb('0xa1')]);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x85')]=function(_0x2a0869){return _0x2a0869&&_0x2a0869!=='0'&&_0x2a0869!=='-1'&&_0x2a0869!=='';};AGIVertices[_0x02bb('0x14')][_0x02bb('0xa3')]=function(_0x114a17){this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0x114a17,'-');_0x114a17[_0x02bb('0xa4')]=_0x114a17[_0x02bb('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x02bb('0x14')][_0x02bb('0xa5')]=function(_0x44fe3b){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xa6'),_0x44fe3b['label']));if(!this[_0x02bb('0x85')](_0x44fe3b[_0x02bb('0x5c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20text\x20configured');}var _0x44c223='\x22'+_0x44fe3b['text']+'\x22';if(this[_0x02bb('0x85')](_0x44fe3b[_0x02bb('0x78')])){_0x44c223+=','+_0x44fe3b['options'];}var _0x3cdf03=this['channel']['exec'](_0x02bb('0xa8'),_0x44c223);if(_0x3cdf03[_0x02bb('0x9f')]===-0x1){return _0x3cdf03;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xa9'),_0x44c223));};AGIVertices['prototype'][_0x02bb('0xaa')]=function(_0x4d1f84){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xab'),_0x4d1f84['label']));if(!this[_0x02bb('0x85')](_0x4d1f84[_0x02bb('0xac')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xad'));}var _0x55618d=_0x4d1f84[_0x02bb('0xac')];if(this[_0x02bb('0x85')](_0x4d1f84[_0x02bb('0x78')])){_0x55618d+=','+_0x4d1f84['options'];}var _0x12d184=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0xae'),_0x55618d);if(_0x12d184[_0x02bb('0x9f')]===-0x1){return _0x12d184;}var _0x395b64=this['getAndSetVariable'](_0x02bb('0xaf'),_0x02bb('0xb0'));if(_0x395b64['result']===-0x1){return _0x395b64;}var _0x308a0b=this[_0x02bb('0x9e')](_0x02bb('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x308a0b['result']===-0x1){return _0x308a0b;}var _0x16adc5=this['getAndSetVariable']('RECOG_INSTANCE()',_0x02bb('0xb2'));if(_0x16adc5[_0x02bb('0x9f')]===-0x1){return _0x16adc5;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0xb3'),_0x55618d));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x5')]=function(_0x8d467c){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xb4'),_0x8d467c['label']));return this[_0x02bb('0x38')][_0x02bb('0x5')]([_0x8d467c[_0x02bb('0xb5')],_0x8d467c['args']]);};AGIVertices[_0x02bb('0x14')][_0x02bb('0xb6')]=function(_0x7c7e98){logger['info'](util[_0x02bb('0x56')](_0x02bb('0xb7'),_0x7c7e98[_0x02bb('0x39')]));if(this[_0x02bb('0x85')](_0x7c7e98[_0x02bb('0x64')])){logger['info'](util[_0x02bb('0x56')](_0x02bb('0xb8'),_0x7c7e98[_0x02bb('0x64')]));var _0x3edce0=this[_0x02bb('0x38')][_0x02bb('0xb9')](_0x7c7e98['timeout']);if(_0x3edce0[_0x02bb('0x9f')]===-0x1){return _0x3edce0;}}return this['channel'][_0x02bb('0xb6')]();};AGIVertices[_0x02bb('0x14')][_0x02bb('0x4a')]=function(_0x112f46){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xba'),_0x112f46[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x112f46['list_id'])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x112f46,_0x02bb('0xbb'));}_0x112f46['scheduledAt']=moment();if(this[_0x02bb('0x85')](_0x112f46[_0x02bb('0xbc')])){_0x112f46[_0x02bb('0x49')]=moment()[_0x02bb('0xbd')](_0x112f46[_0x02bb('0xbc')],_0x02bb('0xbe'));}if(!this['isConfigured'](_0x112f46['callback_priority'])){_0x112f46['callback_priority']=0x2;}this[_0x02bb('0x43')]['sync'](this,_0x112f46);return this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xbf'),_0x112f46[_0x02bb('0xc0')],_0x112f46['list_id'],_0x112f46[_0x02bb('0x49')]));};AGIVertices['prototype'][_0x02bb('0xc1')]=function(_0x2a2160){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xc2'),_0x2a2160[_0x02bb('0x39')]));var _0x2db93a=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x2a2160['application'],_0x2a2160['options']);if(_0x2db93a[_0x02bb('0x9f')]===-0x1){return _0x2db93a;}return this['channel']['noop'](util[_0x02bb('0x56')](_0x02bb('0xc3'),_0x2a2160['application'],_0x2a2160[_0x02bb('0x78')]));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xc4')]=function(_0x1ad350){logger['info'](util[_0x02bb('0x56')](_0x02bb('0xc5'),_0x1ad350[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x1ad350[_0x02bb('0x5c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xc6'));}var _0x24b9b5='\x22'+_0x1ad350['text']+'\x22';if(this[_0x02bb('0x85')](_0x1ad350['options'])){_0x24b9b5+=','+_0x1ad350[_0x02bb('0x78')];}var _0x10cf13=this['channel'][_0x02bb('0x58')]('MRCPSynth',_0x24b9b5);if(_0x10cf13[_0x02bb('0x9f')]===-0x1){return _0x10cf13;}return this['channel'][_0x02bb('0xa7')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x24b9b5));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xc7')]=function(_0x22a2fc){logger['info'](util['format'](_0x02bb('0xc8'),_0x22a2fc[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x22a2fc['text'])){return this[_0x02bb('0x38')]['noop']('no\x20text\x20configured');}var _0x4d3cdd='\x22'+_0x22a2fc[_0x02bb('0x5c')]+'\x22';if(this[_0x02bb('0x85')](_0x22a2fc[_0x02bb('0x78')])){_0x4d3cdd+=','+_0x22a2fc[_0x02bb('0x78')];}var _0x4417ac=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0xa8'),_0x4d3cdd);if(_0x4417ac['result']===-0x1){return _0x4417ac;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xa9'),_0x4d3cdd));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xc9')]=function(_0x32c752){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xca'),_0x32c752[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x32c752[_0x02bb('0xac')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xad'));}var _0x127a35=_0x32c752[_0x02bb('0xac')];if(this['isConfigured'](_0x32c752[_0x02bb('0x78')])){_0x127a35+=','+_0x32c752[_0x02bb('0x78')];}var _0x3f047f=this['channel']['exec'](_0x02bb('0xae'),_0x127a35);if(_0x3f047f[_0x02bb('0x9f')]===-0x1){return _0x3f047f;}var _0x26f4f8=this[_0x02bb('0x9e')](_0x02bb('0xaf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x26f4f8[_0x02bb('0x9f')]===-0x1){return _0x26f4f8;}var _0x41026e=this[_0x02bb('0x9e')](_0x02bb('0xb1'),_0x02bb('0xcb'));if(_0x41026e[_0x02bb('0x9f')]===-0x1){return _0x41026e;}var _0x7481b2=this[_0x02bb('0x9e')](_0x02bb('0xcc'),_0x02bb('0xcd'));if(_0x7481b2[_0x02bb('0x9f')]===-0x1){return _0x7481b2;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xb3'),_0x127a35));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xce')]=function(_0x1a7979){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xcf'),_0x1a7979[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x1a7979['grammar'])){return this['channel'][_0x02bb('0xa7')](_0x02bb('0xad'));}var _0x39f4a3=_0x1a7979[_0x02bb('0xac')];if(this['isConfigured'](_0x1a7979[_0x02bb('0x78')])){_0x39f4a3+=','+_0x1a7979[_0x02bb('0x78')];}var _0xa4c8d6=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0xae'),_0x39f4a3);if(_0xa4c8d6[_0x02bb('0x9f')]===-0x1){return _0xa4c8d6;}var _0x349254=this['getAndSetVariable'](_0x02bb('0xaf'),_0x02bb('0xd0'));if(_0x349254[_0x02bb('0x9f')]===-0x1){return _0x349254;}var _0x25fd21=this[_0x02bb('0x9e')]('RECOG_INPUT()',_0x02bb('0xd1'));if(_0x25fd21[_0x02bb('0x9f')]===-0x1){return _0x25fd21;}var _0x3a54f5=this[_0x02bb('0x9e')]('RECOG_INSTANCE()',_0x02bb('0xd2'));if(_0x3a54f5[_0x02bb('0x9f')]===-0x1){return _0x3a54f5;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('Executed\x20command\x20MRCPRecog\x20%s',_0x39f4a3));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xd3')]=function(_0x44290b){logger[_0x02bb('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x44290b[_0x02bb('0x39')]));if(!this['isConfigured'](_0x44290b[_0x02bb('0xd4')])){return this['channel']['error'](_0x44290b,'no\x20database\x20selected');}var _0x28f2af=this[_0x02bb('0x18')][_0x02bb('0x6e')](this,_0x44290b[_0x02bb('0xd4')]);if(!_0x28f2af){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x44290b,_0x02bb('0xd5'));}if(!this['isConfigured'](_0x44290b['query'])){return this['channel'][_0x02bb('0x2c')](_0x44290b,_0x02bb('0xd6'));}var _0x338b9b=_0x44290b['query'][_0x02bb('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xd8'),_0x338b9b));var _0x31019c=this[_0x02bb('0x2a')][_0x02bb('0x6e')](this,_0x28f2af,_0x338b9b);this['createSquareDetailsReport'][_0x02bb('0x6e')](this,_0x44290b,_0x338b9b);if(!this[_0x02bb('0x85')](_0x44290b['variable_id'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xd9'));}var _0x8597e4=this['getVariable']['sync'](this,_0x44290b['variable_id']);if(!_0x8597e4){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x44290b,_0x02bb('0xda'));}var _0x101d72=this;_0x31019c['forEach'](function(_0x11930a,_0x480d5b){Object[_0x02bb('0xdb')](_0x11930a)[_0x02bb('0xdc')](function(_0x6aa706){_0x101d72['channel'][_0x02bb('0xa2')](util[_0x02bb('0x56')]('%s[%s][%s]',_0x8597e4,_0x480d5b,_0x6aa706),_0x11930a[_0x6aa706]);});});this[_0x02bb('0x38')][_0x02bb('0xa2')](util['format'](_0x02bb('0xdd'),_0x8597e4),_0x31019c[_0x02bb('0x9c')]);return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('variable\x20%s\x20set',_0x8597e4));};AGIVertices[_0x02bb('0x14')]['dial']=function(_0x4a5d74){logger['debug'](util[_0x02bb('0x56')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x4a5d74[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x4a5d74[_0x02bb('0xde')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4a5d74,_0x02bb('0xdf'));}var _0x3a8acb=this[_0x02bb('0x1a')]['sync'](this,_0x4a5d74['sip_id']);if(!_0x3a8acb){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4a5d74,'no\x20user\x20found');}var _0x41e89e=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0xe0'),[util['format'](_0x02bb('0xe1'),_0x3a8acb),_0x4a5d74[_0x02bb('0x64')],_0x4a5d74[_0x02bb('0xe2')],_0x4a5d74[_0x02bb('0x71')]]);if(_0x41e89e[_0x02bb('0x9f')]===-0x1){return _0x41e89e;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0xe3'),_0x02bb('0xe0')));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xe4')]=function(_0x135116){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xe5'),_0x135116['label']));if(!this[_0x02bb('0x85')](_0x135116[_0x02bb('0x79')])){return this['channel']['noop'](_0x02bb('0xe6'));}if(!this[_0x02bb('0x85')](_0x135116[_0x02bb('0x5c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20text\x20configured');}this[_0x02bb('0x38')][_0x02bb('0xe7')]=!![];this[_0x02bb('0x37')](_0x135116);this[_0x02bb('0x42')](_0x135116[_0x02bb('0x5c')],'in','','');this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xe8'),_0x135116[_0x02bb('0x5c')]));var _0x1dee21=this[_0x02bb('0xe9')][_0x02bb('0x6e')](this,_0x135116);if(_0x1dee21){for(var _0x374d50 in _0x1dee21){if(_0x1dee21[_0x02bb('0xea')](_0x374d50)){this['channel'][_0x02bb('0xa2')](util['format'](_0x02bb('0xeb'),_0x374d50[_0x02bb('0x68')]()),_0x1dee21[_0x374d50]);}}this[_0x02bb('0x42')](_0x1dee21[_0x02bb('0xec')],_0x02bb('0xed'),'dialogflow','');return this['channel'][_0x02bb('0xa7')](util['format'](_0x02bb('0xee'),_0x1dee21[_0x02bb('0xec')]));}return this[_0x02bb('0x38')]['error'](_0x135116,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x02bb('0x14')]['dialogflowV2']=function(_0x305e25){logger[_0x02bb('0x30')](util['format'](_0x02bb('0xef'),_0x305e25[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x305e25['dialogflowV2_project_id'])){return this[_0x02bb('0x38')]['noop']('no\x20project_id\x20configured');}if(!this[_0x02bb('0x85')](_0x305e25[_0x02bb('0x7c')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xf0'));}if(!this[_0x02bb('0x85')](_0x305e25[_0x02bb('0x7d')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20private_key\x20configured');}if(!this[_0x02bb('0x85')](_0x305e25[_0x02bb('0x7e')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xf1'));}if(!this[_0x02bb('0x85')](_0x305e25['text'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20text\x20configured');}this[_0x02bb('0x38')][_0x02bb('0xe7')]=!![];this[_0x02bb('0x37')](_0x305e25);this[_0x02bb('0x42')](_0x305e25[_0x02bb('0x5c')],'in','','');this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0xf2'),_0x305e25[_0x02bb('0x5c')]));var _0x201ca0=this[_0x02bb('0xf3')][_0x02bb('0x6e')](this,_0x305e25);if(_0x201ca0){for(var _0x21e3b7 in _0x201ca0){if(_0x201ca0['hasOwnProperty'](_0x21e3b7)){if(_0x21e3b7!=='providerResponse'){this[_0x02bb('0x38')][_0x02bb('0xa2')](util[_0x02bb('0x56')](_0x02bb('0xeb'),_0x21e3b7['toUpperCase']()),_0x201ca0[_0x21e3b7]);}}}this[_0x02bb('0x42')](_0x201ca0[_0x02bb('0xec')],'out',_0x02bb('0xf4'),_0x201ca0[_0x02bb('0xf5')]);return this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xf6'),_0x201ca0[_0x02bb('0xec')]));}return this['channel'][_0x02bb('0x2c')](_0x305e25,_0x02bb('0xf7'));};AGIVertices['prototype']['sesteknda']=function(_0x1b7abc){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0xf8'),_0x1b7abc[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x1b7abc[_0x02bb('0xf9')])){return this['channel'][_0x02bb('0xa7')](_0x02bb('0xfa'));}if(!this['isConfigured'](_0x1b7abc[_0x02bb('0xfb')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xfc'));}if(!this[_0x02bb('0x85')](_0x1b7abc[_0x02bb('0xfd')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xfe'));}if(!this['isConfigured'](_0x1b7abc[_0x02bb('0xff')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xc6'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0x1b7abc);this[_0x02bb('0x42')](_0x1b7abc[_0x02bb('0x5c')],'in','','');this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x100'),_0x1b7abc[_0x02bb('0x5c')]));var _0x374ae=this[_0x02bb('0x7f')][_0x02bb('0x6e')](this,_0x1b7abc);if(_0x374ae){for(var _0x311372 in _0x374ae){if(_0x374ae[_0x02bb('0xea')](_0x311372)){this[_0x02bb('0x38')][_0x02bb('0xa2')](util['format']('SESTEK_NDA_%s',_0x311372[_0x02bb('0x68')]()),_0x374ae[_0x311372]);}}this[_0x02bb('0x42')](_0x374ae['speech'],_0x02bb('0xed'),_0x02bb('0x101'),'');if(_0x374ae[_0x02bb('0x102')]){this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x103'),_0x374ae[_0x02bb('0x102')]));var _0x4373b6=this[_0x02bb('0x38')][_0x02bb('0x104')](_0x374ae[_0x02bb('0x102')]);try{fs[_0x02bb('0x105')](_0x374ae[_0x02bb('0x102')]+_0x02bb('0x106'));}catch(_0x274dbf){logger[_0x02bb('0x2c')](_0x274dbf);}return _0x4373b6;}else{return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x107'),_0x374ae['speech']));}}return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1b7abc,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x02bb('0x14')][_0x02bb('0x108')]=function(_0xd2990){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x109'),_0xd2990[_0x02bb('0x39')]));return this['channel'][_0x02bb('0xa7')]('end');};AGIVertices[_0x02bb('0x14')]['ext_dial']=function(_0x4c28a5){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x10a'),_0x4c28a5[_0x02bb('0x39')]));var _0x2f3831='';if(_0x4c28a5[_0x02bb('0x10b')]){if(!this[_0x02bb('0x85')](_0x4c28a5[_0x02bb('0x10b')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4c28a5,'no\x20trunk\x20selected');}else{var _0x3f9ad4=parseInt(_0x4c28a5[_0x02bb('0x10b')],0xa);if(isNaN(_0x3f9ad4)){_0x2f3831=_0x4c28a5[_0x02bb('0x10b')];}else{_0x2f3831=this[_0x02bb('0x1c')]['sync'](this,_0x4c28a5[_0x02bb('0x10b')]);if(!_0x2f3831){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4c28a5,_0x02bb('0x10c'));}}}}else if(_0x4c28a5[_0x02bb('0x10d')]){_0x2f3831=_0x4c28a5[_0x02bb('0x10d')];}else{return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4c28a5,_0x02bb('0x10e'));}var _0x3ed241=this[_0x02bb('0x38')]['exec']('DIAL',[util[_0x02bb('0x56')](_0x02bb('0x10f'),_0x2f3831,_0x4c28a5[_0x02bb('0xc0')]),_0x4c28a5[_0x02bb('0x64')],_0x4c28a5[_0x02bb('0xe2')],_0x4c28a5[_0x02bb('0x71')]]);if(_0x3ed241[_0x02bb('0x9f')]===-0x1){return _0x3ed241;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0xe3'),_0x02bb('0xe0')));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x110')]=function(_0x1cd9fd){logger[_0x02bb('0x30')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1cd9fd[_0x02bb('0x39')]));return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x110'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0xc')]=function(_0x1bb94f){logger['info'](util[_0x02bb('0x56')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1bb94f[_0x02bb('0x39')]));if(_0x1bb94f[_0x02bb('0xa4')]===0x0){return this[_0x02bb('0xa3')](_0x1bb94f);}_0x1bb94f[_0x02bb('0xa4')]-=0x1;if(!this[_0x02bb('0x85')](_0x1bb94f[_0x02bb('0x111')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1bb94f,_0x02bb('0x112'));}var _0x38c700=this[_0x02bb('0x1e')]['sync'](this,_0x1bb94f['file_id']);if(!_0x38c700){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1bb94f,'no\x20file\x20audio\x20found');}if(!this[_0x02bb('0x85')](_0x1bb94f[_0x02bb('0x113')])){return this[_0x02bb('0x38')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x299a57=this[_0x02bb('0x38')][_0x02bb('0x114')](_0x38c700,_0x1bb94f[_0x02bb('0x115')],_0x1bb94f[_0x02bb('0x116')]);var _0x5eceb3=_0x299a57['result']?_0x299a57[_0x02bb('0x9f')]['toString']():'';logger[_0x02bb('0x30')](_0x02bb('0x117'),JSON[_0x02bb('0x72')](_0x299a57));if(_0x299a57[_0x02bb('0x9f')]===-0x1){this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0x1bb94f,_0x5eceb3);return _0x299a57;}else if(_0x299a57[_0x02bb('0xa1')]===_0x02bb('0x64')){_0x299a57[_0x02bb('0x9f')]=_0x5eceb3[_0x02bb('0x9c')]>=parseInt(_0x1bb94f['mindigit'])?'x':'i';}else{_0x299a57['result']=_0x5eceb3['length']>=parseInt(_0x1bb94f[_0x02bb('0x118')])&&_0x5eceb3[_0x02bb('0x9c')]<=parseInt(_0x1bb94f['maxdigit'])?'x':'i';}var _0x2b72ad=this[_0x02bb('0x10')][_0x02bb('0x6e')](this,_0x1bb94f[_0x02bb('0x113')]);if(!_0x2b72ad){return this['channel'][_0x02bb('0x2c')](_0x1bb94f,_0x02bb('0xda'));}this['channel'][_0x02bb('0xa2')](_0x2b72ad,_0x5eceb3);if(this[_0x02bb('0x85')](_0x1bb94f[_0x02bb('0x119')])){var _0x20c0ce=parseInt(_0x1bb94f[_0x02bb('0x119')],0xa);var _0x48a0f4=rs[_0x02bb('0x11a')]({'charset':'*','length':_0x20c0ce});var _0x3ad0fd=_0x5eceb3['length'];if(_0x3ad0fd>0x0){if(_0x3ad0fd>_0x20c0ce){this[_0x02bb('0x37')]['sync'](this,_0x1bb94f,_0x1bb94f[_0x02bb('0x11b')]===_0x02bb('0x11c')?_0x48a0f4+_0x5eceb3[_0x02bb('0x11d')](_0x20c0ce):_0x5eceb3['substr'](0x0,_0x3ad0fd-_0x20c0ce)+_0x48a0f4);}else{this[_0x02bb('0x37')]['sync'](this,_0x1bb94f,rs['generate']({'charset':'*','length':_0x3ad0fd}));}}else{this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0x1bb94f,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x1bb94f,_0x5eceb3);}return _0x299a57;};AGIVertices['prototype'][_0x02bb('0xd')]=function(_0x50db6d){logger['info'](util[_0x02bb('0x56')](_0x02bb('0x11e'),_0x50db6d['label']));return this['getdigits'](_0x50db6d);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x11f')]=function(_0xf5df8e){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x120'),_0xf5df8e['label']));this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0xf5df8e,_0xf5df8e['goalname']);return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x121'),_0xf5df8e[_0x02bb('0x122')]));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x123')]=function(_0x4f88ae){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x124'),_0x4f88ae[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x4f88ae[_0x02bb('0x88')])||!this[_0x02bb('0x85')](_0x4f88ae[_0x02bb('0x8c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x02bb('0x85')](_0x4f88ae['text'])){return this['channel'][_0x02bb('0xa7')](_0x02bb('0xc6'));}this['channel']['noop'](util[_0x02bb('0x56')](_0x02bb('0x125'),_0x4f88ae[_0x02bb('0x5c')]));var _0x326952=this['awsPolly'][_0x02bb('0x6e')](this,_0x4f88ae);if(_0x326952){this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('aws\x20Polly\x20%s\x20file\x20created',_0x326952));var _0x269b4d=this['channel'][_0x02bb('0x104')](_0x326952);try{fs[_0x02bb('0x105')](_0x326952+_0x02bb('0x106'));}catch(_0x27cb2d){logger[_0x02bb('0x2c')](_0x27cb2d);}return _0x269b4d;}return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4f88ae,_0x02bb('0x126'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x127')]=function(_0x17872a){logger['info'](util[_0x02bb('0x56')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x17872a[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x17872a[_0x02bb('0x88')])||!this['isConfigured'](_0x17872a[_0x02bb('0x8c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x128'));}if(!this[_0x02bb('0x85')](_0x17872a['aws_bot_name'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x129'));}if(!this[_0x02bb('0x85')](_0x17872a[_0x02bb('0x5c')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xc6'));}this['channel']['bot']=!![];this[_0x02bb('0x37')](_0x17872a);this[_0x02bb('0x42')](_0x17872a[_0x02bb('0x5c')],'in','','');this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0x12a'),_0x17872a['text']));var _0x545aeb=this[_0x02bb('0x8b')][_0x02bb('0x6e')](this,_0x17872a);if(_0x545aeb){for(var _0x2db95f in _0x545aeb){if(_0x545aeb[_0x02bb('0xea')](_0x2db95f)&&_[_0x02bb('0x94')](_0x545aeb[_0x2db95f])){this[_0x02bb('0x38')][_0x02bb('0xa2')](util[_0x02bb('0x56')](_0x02bb('0x12b'),_0x2db95f['toUpperCase']()),_0x545aeb[_0x2db95f]);}}if(_[_0x02bb('0x45')](_0x545aeb[_0x02bb('0x76')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x12c'));}else{this[_0x02bb('0x42')](_0x545aeb['message'],_0x02bb('0xed'),_0x02bb('0x12d'),'');return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('Amazon\x20Lex\x20Result\x20%s',_0x545aeb[_0x02bb('0x76')]));}}return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x17872a,_0x02bb('0x12e'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x12f')]=function(_0x3d775b){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x3d775b[_0x02bb('0x39')],_0x3d775b[_0x02bb('0x64')]));if(!this['isConfigured'](_0x3d775b['key'])){return this[_0x02bb('0x38')]['noop']('no\x20key\x20configured');}var _0x31c38d=_0x02bb('0x130');var _0x5357df=util[_0x02bb('0x56')](_0x02bb('0x131'),FILES_PATH,rs[_0x02bb('0x11a')](0x4));var _0x4949a5=util['format'](_0x02bb('0x9b'),_0x5357df,_0x31c38d);var _0x4f6f89=!![];if(_0x3d775b['beep']===_0x02bb('0x132')){_0x4f6f89=![];}var _0xe6b0c3=this['channel']['recordFile'](_0x5357df,_0x31c38d,_0x3d775b['intKey'],_0x3d775b['timeout'],undefined,_0x4f6f89);if(_0xe6b0c3['result']!==-0x1){this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')]('google\x20%s\x20file\x20created',_0x4949a5));var _0x3bb00c=this['googleASR'][_0x02bb('0x6e')](this,_0x3d775b,_0x4949a5);if(_0x3bb00c){for(var _0x440dd7 in _0x3bb00c){if(_0x3bb00c[_0x02bb('0xea')](_0x440dd7)){this[_0x02bb('0x38')][_0x02bb('0xa2')](util['format'](_0x02bb('0x133'),_0x440dd7[_0x02bb('0x68')]()),_0x3bb00c[_0x440dd7]);}}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x134'),JSON['stringify'](_0x3bb00c)));}}return _0xe6b0c3;};AGIVertices['prototype'][_0x02bb('0x135')]=function(_0x2981db){logger['info'](util[_0x02bb('0x56')](_0x02bb('0x136'),_0x2981db[_0x02bb('0x39')]));if(!this['isConfigured'](_0x2981db[_0x02bb('0x91')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0x137'));}if(!this['isConfigured'](_0x2981db[_0x02bb('0x92')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x138'));}var _0x255cd4=_0x02bb('0x130');var _0x4b77ce=util[_0x02bb('0x56')](_0x02bb('0x131'),FILES_PATH,rs[_0x02bb('0x11a')](0x4));var _0x38072e=util[_0x02bb('0x56')](_0x02bb('0x9b'),_0x4b77ce,_0x255cd4);var _0x5cab3d=!![];if(_0x2981db[_0x02bb('0x139')]==='NOBEEP'){_0x5cab3d=![];}var _0x62669d=this[_0x02bb('0x38')]['recordFile'](_0x4b77ce,_0x255cd4,_0x2981db['intKey'],_0x2981db[_0x02bb('0x64')],undefined,_0x5cab3d);if(_0x62669d[_0x02bb('0x9f')]!==-0x1){this['channel'][_0x02bb('0xa7')](util['format'](_0x02bb('0x13a'),_0x38072e));var _0x26f2b2=this[_0x02bb('0x90')][_0x02bb('0x6e')](this,_0x2981db,_0x38072e);if(_0x26f2b2){for(var _0x1cafcf in _0x26f2b2){if(_0x26f2b2[_0x02bb('0xea')](_0x1cafcf)){this[_0x02bb('0x38')][_0x02bb('0xa2')](util['format'](_0x02bb('0x13b'),_0x1cafcf[_0x02bb('0x68')]()),_0x26f2b2[_0x1cafcf]);}}return this[_0x02bb('0x38')]['noop'](util[_0x02bb('0x56')](_0x02bb('0x13c'),JSON['stringify'](_0x26f2b2)));}}return _0x62669d;};AGIVertices[_0x02bb('0x14')][_0x02bb('0x13d')]=function(_0x573678){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x13e'),_0x573678[_0x02bb('0x39')]));return this[_0x02bb('0x38')][_0x02bb('0x13f')](_0x573678['context'],_0x573678[_0x02bb('0x140')],_0x573678[_0x02bb('0x3e')]);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x141')]=function(_0x588239){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x142'),_0x588239[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x588239['condition'])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x588239,'no\x20condition\x20configured');}try{var _0x199b17=eval(_0x588239[_0x02bb('0x143')])?_0x02bb('0x144'):_0x02bb('0x145');this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x146'),_0x588239[_0x02bb('0x143')],_0x199b17));return{'code':0xc8,'result':_0x199b17};}catch(_0x82a52b){return{'code':0xc8,'result':_0x02bb('0x145')};}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x147')]=function(_0x1bb1ab){logger['info'](util['format'](_0x02bb('0x148'),_0x1bb1ab[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x1bb1ab[_0x02bb('0x149')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1bb1ab,'no\x20interval\x20configured');}var _0x5c8165=this['getIntervals']['sync'](this,_0x1bb1ab[_0x02bb('0x149')]);if(!_0x5c8165){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1bb1ab,'no\x20intervals\x20found');}for(var _0x4881bc=0x0;_0x4881bc<_0x5c8165[_0x02bb('0x9c')];_0x4881bc+=0x1){var _0x430c3c=this[_0x02bb('0x38')]['getVariable'](util['format'](_0x02bb('0x14a'),_0x5c8165[_0x4881bc]));if(_0x430c3c[_0x02bb('0x9f')]===-0x1){return _0x430c3c;}logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x14b'),_0x5c8165[_0x4881bc],_0x430c3c['extra']));if(_0x430c3c[_0x02bb('0xa1')]===_0x02bb('0x144')){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x14b'),_0x5c8165[_0x4881bc],_0x02bb('0x144')));this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x14b'),_0x5c8165[_0x4881bc],_0x02bb('0x144')));return{'code':0xc8,'result':_0x02bb('0x144')};}else{logger['info'](util[_0x02bb('0x56')]('IFTIME\x20%s\x20%s',_0x5c8165[_0x4881bc],_0x02bb('0x145')));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x14b'),_0x5c8165[_0x4881bc],_0x02bb('0x145')));}}return{'code':0xc8,'result':_0x02bb('0x145')};};AGIVertices['prototype']['hangup']=function(_0x856556){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x14c'),_0x856556[_0x02bb('0x39')]));return this[_0x02bb('0x38')][_0x02bb('0x14d')]();};AGIVertices[_0x02bb('0x14')][_0x02bb('0x14e')]=function(_0x186109){logger['info'](util['format'](_0x02bb('0x14f'),_0x186109[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x186109[_0x02bb('0x79')])){return this['channel'][_0x02bb('0xa7')](_0x02bb('0xe6'));}var _0x1da28d=_0x02bb('0x130');var _0x5d8026=util[_0x02bb('0x56')](_0x02bb('0x131'),FILES_PATH,rs['generate'](0x4));var _0x1acb81=util[_0x02bb('0x56')]('%s.%s',_0x5d8026,_0x1da28d);var _0x4325e5=!![];if(_0x186109[_0x02bb('0x139')]===_0x02bb('0x132')){_0x4325e5=![];}var _0xce2387=this[_0x02bb('0x38')][_0x02bb('0x150')](_0x5d8026,_0x1da28d,_0x186109[_0x02bb('0x151')],_0x186109[_0x02bb('0x64')],undefined,_0x4325e5);if(_0xce2387[_0x02bb('0x9f')]!==-0x1){this[_0x02bb('0x38')]['noop'](util[_0x02bb('0x56')](_0x02bb('0x152'),_0x1acb81));var _0x4370df=this[_0x02bb('0x83')][_0x02bb('0x6e')](this,_0x186109,_0x1acb81);if(_0x4370df){for(var _0x55dfc1 in _0x4370df){if(_0x4370df[_0x02bb('0xea')](_0x55dfc1)){this[_0x02bb('0x38')]['setVariable'](util[_0x02bb('0x56')](_0x02bb('0x153'),_0x55dfc1[_0x02bb('0x68')]()),_0x4370df[_0x55dfc1]);}}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x4370df)));}}return _0xce2387;};AGIVertices[_0x02bb('0x14')][_0x02bb('0x154')]=function(_0x4c2ff4){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x155'),_0x4c2ff4[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x4c2ff4[_0x02bb('0x79')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xe6'));}if(!this[_0x02bb('0x85')](_0x4c2ff4[_0x02bb('0x5c')])){return this['channel'][_0x02bb('0xa7')](_0x02bb('0xc6'));}this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x156'),_0x4c2ff4[_0x02bb('0x5c')]));var _0x17bcf4=this['ispeechTTS'][_0x02bb('0x6e')](this,_0x4c2ff4);if(_0x17bcf4){this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x152'),_0x17bcf4));var _0x48d175=this[_0x02bb('0x38')][_0x02bb('0x104')](_0x17bcf4,_0x4c2ff4['intKey']);try{fs['unlink'](_0x17bcf4+'.wav');}catch(_0x119452){logger['error'](_0x119452);}return _0x48d175;}return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4c2ff4,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x02bb('0x157')]=function(_0x2aadc6){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x158'),_0x2aadc6['label']));if(!this[_0x02bb('0x85')](_0x2aadc6[_0x02bb('0x159')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x2aadc6,_0x02bb('0x15a'));}logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x02bb('0x38')]['callerid'],_0x2aadc6[_0x02bb('0x159')]));var _0x3e8f67=this[_0x02bb('0x54')][_0x02bb('0x6e')](this,_0x2aadc6[_0x02bb('0x159')]);if(_0x3e8f67){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x02bb('0x38')][_0x02bb('0x51')],_0x2aadc6[_0x02bb('0x159')]));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x15b'),this[_0x02bb('0x38')]['callerid'],_0x2aadc6['findBy']));return{'code':0xc8,'result':_0x02bb('0x15c')};}else{logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x2aadc6['findBy']));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x2aadc6[_0x02bb('0x159')]));return{'code':0xc8,'result':_0x02bb('0x15e')};}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x15f')]=function(_0x177043){logger['info'](util[_0x02bb('0x56')](_0x02bb('0x160'),_0x177043['label']));if(!this['isConfigured'](_0x177043['findBy'])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x177043,'no\x20find\x20by\x20configured');}logger['info'](util[_0x02bb('0x56')](_0x02bb('0x161'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x177043[_0x02bb('0x159')]));var _0x423e7e=this['agentLogout']['sync'](this,_0x177043[_0x02bb('0x159')]);if(_0x423e7e){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x15b'),this['channel']['callerid'],_0x177043[_0x02bb('0x159')]));this[_0x02bb('0x38')]['noop'](util[_0x02bb('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x02bb('0x38')]['callerid'],_0x177043[_0x02bb('0x159')]));return{'code':0xc8,'result':_0x02bb('0x15c')};}else{logger[_0x02bb('0x30')](util['format'](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x177043['findBy']));this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x177043[_0x02bb('0x159')]));return{'code':0xc8,'result':_0x02bb('0x15e')};}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x162')]=function(_0x56c07e){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x163'),_0x56c07e['label']));if(!this['isConfigured'](_0x56c07e[_0x02bb('0x164')])){return this['channel']['error'](_0x56c07e,_0x02bb('0x165'));}this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x166'),_0x56c07e['operation']));var _0xe291e0=eval(_0x56c07e[_0x02bb('0x164')]);if(!this[_0x02bb('0x85')](_0x56c07e[_0x02bb('0x113')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xd9'));}var _0x2aee6a=this[_0x02bb('0x10')][_0x02bb('0x6e')](this,_0x56c07e[_0x02bb('0x113')]);if(!_0x2aee6a){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x56c07e,_0x02bb('0xda'));}if(_[_0x02bb('0x98')](_0xe291e0)){var _0x3037b0=this;_0xe291e0[_0x02bb('0xdc')](function(_0x31cdb1,_0x59b4ed){_0x3037b0[_0x02bb('0x38')][_0x02bb('0xa2')](util[_0x02bb('0x56')]('%s[%s]',_0x2aee6a,_0x59b4ed),_0x31cdb1);});return this[_0x02bb('0x38')]['noop'](util['format'](_0x02bb('0x167'),_0x2aee6a));}else{return this[_0x02bb('0x38')]['setVariable'](_0x2aee6a,_0xe291e0);}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x168')]=function(_0x584588){logger[_0x02bb('0x30')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x584588['label']));if(_0x584588[_0x02bb('0xa4')]===0x0){return this[_0x02bb('0xa3')](_0x584588);}_0x584588['retry']-=0x1;if(!this[_0x02bb('0x85')](_0x584588[_0x02bb('0x111')])){return this[_0x02bb('0x38')]['error'](_0x584588,_0x02bb('0x112'));}var _0x31aa31=this['getSound'][_0x02bb('0x6e')](this,_0x584588[_0x02bb('0x111')]);if(!_0x31aa31){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x584588,_0x02bb('0x169'));}var _0x1151c0=this['channel']['getData'](_0x31aa31,_0x584588['response'],_0x584588[_0x02bb('0x16a')]);var _0x5a09e1=_0x1151c0[_0x02bb('0x9f')];if(_0x1151c0[_0x02bb('0x9f')]===-0x1){this[_0x02bb('0x37')]['sync'](this,_0x584588,'-1');return _0x1151c0;}else if(_0x1151c0[_0x02bb('0xa1')]===_0x02bb('0x64')){_0x1151c0[_0x02bb('0x9f')]=_0x1151c0[_0x02bb('0x9f')]['length']>0x0?_0x1151c0[_0x02bb('0x9f')]:'t';}else if(_[_0x02bb('0x44')](_0x1151c0[_0x02bb('0x9f')])){_0x1151c0[_0x02bb('0x9f')]='#';_0x5a09e1='#';}if(!this[_0x02bb('0x85')](_0x584588['variable_id'])){this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x36cbd0=this[_0x02bb('0x10')][_0x02bb('0x6e')](this,_0x584588[_0x02bb('0x113')]);if(!_0x36cbd0){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x584588,_0x02bb('0xda'));}this[_0x02bb('0x38')][_0x02bb('0xa2')](_0x36cbd0,_0x5a09e1);}this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0x584588,_0x5a09e1);return _0x1151c0;};AGIVertices[_0x02bb('0x14')][_0x02bb('0xa7')]=function(_0x724df1){logger['info'](util['format'](_0x02bb('0x16b'),_0x724df1[_0x02bb('0x39')]));return this[_0x02bb('0x38')]['noop'](_0x724df1[_0x02bb('0x16c')]||_0x724df1[_0x02bb('0x39')]);};AGIVertices[_0x02bb('0x14')]['pause']=function(_0x1f6823){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x1f6823[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x1f6823[_0x02bb('0x159')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x1f6823,_0x02bb('0x15a'));}logger['info'](util[_0x02bb('0x56')](_0x02bb('0x161'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x1f6823[_0x02bb('0x159')]));var _0x5cc069=this['getPause']['sync'](this,_0x1f6823[_0x02bb('0x16d')]);var _0x2d0570=this[_0x02bb('0x4f')][_0x02bb('0x6e')](this,_0x1f6823['findBy'],_0x5cc069);if(_0x2d0570){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x15b'),this['channel'][_0x02bb('0x51')],_0x1f6823['findBy']));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x02bb('0x38')][_0x02bb('0x51')],_0x1f6823[_0x02bb('0x159')]));return{'code':0xc8,'result':'success'};}else{logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x1f6823[_0x02bb('0x159')]));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x02bb('0x38')][_0x02bb('0x51')],_0x1f6823[_0x02bb('0x159')]));return{'code':0xc8,'result':_0x02bb('0x15e')};}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x16e')]=function(_0x59ff09){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x59ff09[_0x02bb('0x39')]));if(!this['isConfigured'](_0x59ff09[_0x02bb('0x111')])){return this['channel']['error'](_0x59ff09,_0x02bb('0x112'));}var _0x281ac4=this[_0x02bb('0x1e')]['sync'](this,_0x59ff09[_0x02bb('0x111')]);if(!_0x281ac4){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x59ff09,_0x02bb('0x169'));}var _0x265988=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0x16f'),[_0x281ac4,_0x59ff09['opts']]);if(_0x265988[_0x02bb('0x9f')]===-0x1){return _0x265988;}return this['channel']['noop'](util[_0x02bb('0x56')](_0x02bb('0xc3'),_0x02bb('0x16f'),_0x281ac4));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x170')]=function(_0xd4a741){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0xd4a741[_0x02bb('0x39')]));if(!this['isConfigured'](_0xd4a741[_0x02bb('0x171')])){return this[_0x02bb('0x38')]['error'](_0xd4a741,_0x02bb('0x172'));}var _0x700dd5='';var _0x1ca1d9=parseInt(_0xd4a741[_0x02bb('0x171')],0xa);if(isNaN(_0x1ca1d9)){_0x700dd5=_0xd4a741[_0x02bb('0x171')];}else{_0x700dd5=this[_0x02bb('0x15')][_0x02bb('0x6e')](this,_0xd4a741[_0x02bb('0x171')]);if(!_0x700dd5){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0xd4a741,'no\x20queue\x20found');}}var _0x3a9f48='';if(this[_0x02bb('0x85')](_0xd4a741[_0x02bb('0x111')])){var _0x35aca1=this[_0x02bb('0x1e')][_0x02bb('0x6e')](this,_0xd4a741['file_id']);if(_0x35aca1){_0x3a9f48=_0x35aca1;}}this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0xd4a741,_0x700dd5);if(_0xd4a741[_0x02bb('0xe2')][_0x02bb('0x173')]('x')<0x0){_0xd4a741[_0x02bb('0xe2')]+='x';}if(_0xd4a741['opts'][_0x02bb('0x173')]('X')<0x0){_0xd4a741[_0x02bb('0xe2')]+='X';}this[_0x02bb('0x38')]['setVariable'](_0x02bb('0x174'),_0x700dd5?_0x700dd5[_0x02bb('0x175')]():'');var _0x229584=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0x176'),[_0x700dd5,_0xd4a741['opts'],_0xd4a741[_0x02bb('0x71')],_0x3a9f48,_0xd4a741[_0x02bb('0x64')],_0xd4a741[_0x02bb('0x5')],_0xd4a741['macro'],_0xd4a741[_0x02bb('0x177')],'',_0xd4a741[_0x02bb('0x178')]]);if(_0x229584[_0x02bb('0x9f')]===-0x1){return _0x229584;}return this['channel']['noop'](util[_0x02bb('0x56')](_0x02bb('0xc3'),'QUEUE',_0x700dd5));};AGIVertices[_0x02bb('0x14')]['record']=function(_0x5f2df4){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x179'),_0x5f2df4[_0x02bb('0x39')]));var _0x36d3a3=_0x5f2df4[_0x02bb('0x17a')]||'wav';var _0x4dce39=util[_0x02bb('0x56')](_0x02bb('0x17b'),this['channel'][_0x02bb('0x3c')],rs['generate'](0x5));var _0x7d9e58=util['format'](_0x02bb('0x17c'),FILES_PATH,_0x4dce39,_0x36d3a3);var _0xaae749=util[_0x02bb('0x56')](_0x02bb('0x131'),FILES_PATH,_0x4dce39);this[_0x02bb('0x3b')][_0x02bb('0x6e')](this,_0x5f2df4,_0x4dce39,_0x7d9e58);this[_0x02bb('0x38')][_0x02bb('0xa2')](_0x02bb('0x17d'),_0x4dce39);logger[_0x02bb('0x30')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xaae749,_0x36d3a3,_0x5f2df4[_0x02bb('0x17e')],_0x5f2df4[_0x02bb('0x64')]);return this[_0x02bb('0x38')][_0x02bb('0x150')](_0xaae749,_0x36d3a3,_0x5f2df4['escape_digits'],_0x5f2df4[_0x02bb('0x64')],undefined,!![]);};AGIVertices[_0x02bb('0x14')][_0x02bb('0x17f')]=function(_0xdd4908){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x180'),_0xdd4908[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0xdd4908['url'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')]('no\x20url\x20configured');}var _0x8cf271=this[_0x02bb('0x62')]['sync'](this,_0xdd4908);logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Response:',util[_0x02bb('0x181')](_0x8cf271,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xdd4908['variable_id'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x182'));}var _0x487bbf=this[_0x02bb('0x10')][_0x02bb('0x6e')](this,_0xdd4908[_0x02bb('0x113')]);if(!_0x487bbf){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0xdd4908,_0x02bb('0xda'));}this[_0x02bb('0x38')][_0x02bb('0xa2')](util[_0x02bb('0x56')]('%s_STATUS_CODE',_0x487bbf),_0x8cf271[_0x02bb('0x75')]?_0x8cf271[_0x02bb('0x75')]:_0x02bb('0x183'));this[_0x02bb('0x38')][_0x02bb('0xa2')](util[_0x02bb('0x56')]('%s_STATUS_MESSAGE',_0x487bbf),_0x8cf271['statusMessage']?_0x8cf271[_0x02bb('0x184')]:'OK');if(_0x8cf271[_0x02bb('0x73')]){try{this['saveRestApiResult'](_0x8cf271['body'],_0x487bbf);}catch(_0x242c57){logger[_0x02bb('0x2c')](util[_0x02bb('0x56')](_0x02bb('0x185'),_0x487bbf));}}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x186'),_0x487bbf));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x187')]=function(_0x3c790a){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x188'),_0x3c790a[_0x02bb('0x39')]));return this[_0x02bb('0x38')]['sayDigits'](_0x3c790a[_0x02bb('0x189')]['replace'](/\s+/g,''),_0x3c790a[_0x02bb('0x17e')]);};AGIVertices['prototype'][_0x02bb('0x18a')]=function(_0xaa368e){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xaa368e[_0x02bb('0x39')]));return this[_0x02bb('0x38')][_0x02bb('0x18b')](_0xaa368e[_0x02bb('0x18c')][_0x02bb('0xd7')](/\s+/g,''),_0xaa368e['escape_digits']);};AGIVertices[_0x02bb('0x14')]['sayphonetic']=function(_0x395f56){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x18d'),_0x395f56['label']));return this[_0x02bb('0x38')][_0x02bb('0x18e')](_0x395f56[_0x02bb('0x5c')],_0x395f56[_0x02bb('0x17e')]);};AGIVertices[_0x02bb('0x14')]['sendMail']=function(_0x4aa754){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x18f'),_0x4aa754[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x4aa754[_0x02bb('0x190')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x191'));}var _0x55b8c4=this['getMailAccount'][_0x02bb('0x6e')](this,_0x4aa754[_0x02bb('0x190')]);if(!_0x55b8c4||!_0x55b8c4['Smtp']){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x4aa754,_0x02bb('0x192'));}var _0x3e15e8={'from':util[_0x02bb('0x56')](_0x02bb('0x193'),_0x55b8c4[_0x02bb('0x12')],_0x55b8c4[_0x02bb('0x194')]||_0x55b8c4[_0x02bb('0x195')][_0x02bb('0x196')]),'to':_0x4aa754['to']||'','cc':_0x4aa754['cc']||'','bcc':_0x4aa754[_0x02bb('0x197')]||'','subject':_0x4aa754[_0x02bb('0x198')],'html':_0x4aa754[_0x02bb('0x5c')],'text':_0x4aa754[_0x02bb('0x5c')]};if(this[_0x02bb('0x85')](_0x4aa754[_0x02bb('0x199')])){}logger[_0x02bb('0x19a')]('sendMail\x20message',JSON['stringify'](_0x3e15e8));this[_0x02bb('0x37')][_0x02bb('0x6e')](this,_0x4aa754,_0x4aa754[_0x02bb('0x190')]);this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x55b8c4[_0x02bb('0x12')]));this[_0x02bb('0x24')][_0x02bb('0x6e')](this,_0x55b8c4[_0x02bb('0x19b')],_0x3e15e8);return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x19c'));};AGIVertices['prototype'][_0x02bb('0x19d')]=function(_0x4887e2){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x19e'),_0x4887e2['label']));return this['channel'][_0x02bb('0xa7')](_0x02bb('0x19f'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1a0')]=function(_0x45df12){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x1a1'),_0x45df12[_0x02bb('0x39')]));if(!this['isConfigured'](_0x45df12[_0x02bb('0x1a2')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0x1a3'));}var _0x374b8e=this[_0x02bb('0x34')][_0x02bb('0x6e')](this,_0x45df12[_0x02bb('0x1a2')]);if(!_0x374b8e){return this['channel']['error'](_0x45df12,_0x02bb('0x1a4'));}var _0x58ef72={'body':_0x45df12[_0x02bb('0x1a5')],'phone':_0x45df12['to']||'','SmsAccountId':_0x374b8e['id']};logger[_0x02bb('0x19a')]('sendSMS\x20message',JSON[_0x02bb('0x72')](_0x58ef72));this[_0x02bb('0x37')]['sync'](this,_0x45df12,_0x45df12[_0x02bb('0x1a2')]);this['channel'][_0x02bb('0xa7')](util['format'](_0x02bb('0x1a6'),_0x374b8e[_0x02bb('0x12')]));this[_0x02bb('0x36')][_0x02bb('0x6e')](this,_0x58ef72);return this[_0x02bb('0x38')][_0x02bb('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1a7')]=function(_0x3d43b6){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x1a8'),_0x3d43b6[_0x02bb('0x39')]));if(!this['isConfigured'](_0x3d43b6[_0x02bb('0x113')])){return this['channel'][_0x02bb('0x2c')](_0x3d43b6,_0x02bb('0x1a9'));}var _0x2cc050=this[_0x02bb('0x10')][_0x02bb('0x6e')](this,_0x3d43b6[_0x02bb('0x113')]);if(!_0x2cc050){return this['channel']['error'](_0x3d43b6,_0x02bb('0xda'));}return this[_0x02bb('0x38')][_0x02bb('0xa2')](_0x2cc050,_0x3d43b6[_0x02bb('0x1aa')]);};AGIVertices['prototype'][_0x02bb('0x1ab')]=function(_0x40fd8c){logger['info'](util[_0x02bb('0x56')](_0x02bb('0x1ac'),_0x40fd8c['label']));this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x1ad'));if(_0x40fd8c[_0x02bb('0xb6')]===_0x02bb('0x1ae')){this['channel'][_0x02bb('0xa7')]('Answer');return this['channel'][_0x02bb('0xb6')]();}return this[_0x02bb('0x38')]['noop'](_0x02bb('0x1af'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1b0')]=function(_0x353e25){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x353e25[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x353e25[_0x02bb('0x1b1')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x353e25,_0x02bb('0x1b2'));}var _0xe4efc5=this[_0x02bb('0x1b3')][_0x02bb('0x6e')](this,_0x353e25[_0x02bb('0x1b1')]);if(!this[_0x02bb('0x85')](_0xe4efc5)){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x353e25,util[_0x02bb('0x56')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x353e25[_0x02bb('0x1b1')]));}if(_0xe4efc5===this[_0x02bb('0x38')][_0x02bb('0x40')]){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x353e25,_0x02bb('0x1b4'));}this['createSquareDetailsReport'][_0x02bb('0x6e')](this,_0x353e25,_0xe4efc5);var _0x4e5796=this[_0x02bb('0x38')][_0x02bb('0x58')](_0x02bb('0x1b5'),util[_0x02bb('0x56')](_0x02bb('0x1b6'),config[_0x02bb('0x5')]['host']||_0x02bb('0x1b7'),_0xe4efc5,this['channel'][_0x02bb('0x40')]));if(_0x4e5796[_0x02bb('0x9f')]===-0x1){return _0x4e5796;}return this[_0x02bb('0x38')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x02bb('0x1b5'),_0xe4efc5));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1b8')]=function(_0xd6a088){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0xd6a088[_0x02bb('0x39')]));var _0x3bfc32=this[_0x02bb('0x57')][_0x02bb('0x6e')](this,_0xd6a088['command']);this['createSquareDetailsReport'][_0x02bb('0x6e')](this,_0xd6a088,_0xd6a088[_0x02bb('0xb5')]);if(this[_0x02bb('0x85')](_0xd6a088['variable_id'])){var _0x1857db=this[_0x02bb('0x10')]['sync'](this,_0xd6a088[_0x02bb('0x113')]);if(_0x1857db){this[_0x02bb('0x38')][_0x02bb('0xa2')](_0x1857db,_0x3bfc32);return this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xd6a088[_0x02bb('0xb5')],_0x1857db));}}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0x1b9'),_0xd6a088['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x54ce5b){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x54ce5b[_0x02bb('0x39')]));_0x54ce5b[_0x02bb('0x5c')]=_0x54ce5b[_0x02bb('0x5c')][_0x02bb('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x02bb('0x85')](_0x54ce5b['apiKey'])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0x1ba'));}if(!this[_0x02bb('0x85')](_0x54ce5b[_0x02bb('0x5c')])){return this[_0x02bb('0x38')]['noop'](_0x02bb('0xc6'));}this['channel']['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x54ce5b[_0x02bb('0x5c')]));var _0x6b07ac=this[_0x02bb('0x59')]['sync'](this,_0x54ce5b);if(_0x6b07ac){this['channel'][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x1bb'),_0x6b07ac));var _0x102481=this[_0x02bb('0x38')][_0x02bb('0x104')](_0x6b07ac);try{fs[_0x02bb('0x105')](_0x6b07ac+_0x02bb('0x106'));}catch(_0x11ae65){logger[_0x02bb('0x2c')](_0x11ae65);}return _0x102481;}return this['channel'][_0x02bb('0x2c')](_0x54ce5b,_0x02bb('0x1bc'));};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1bd')]=function(_0x5634e0){logger[_0x02bb('0x30')](util[_0x02bb('0x56')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5634e0[_0x02bb('0x39')]));_0x5634e0['text']=_0x5634e0[_0x02bb('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x02bb('0x85')](_0x5634e0[_0x02bb('0x5c')])){return this[_0x02bb('0x38')][_0x02bb('0xa7')](_0x02bb('0xc6'));}this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x1be'),_0x5634e0[_0x02bb('0x5c')]));var _0x4de4c3=this[_0x02bb('0x60')]['sync'](this,_0x5634e0);if(_0x4de4c3){this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x1bf'),_0x4de4c3));var _0x29a8dd=this[_0x02bb('0x38')][_0x02bb('0x104')](_0x4de4c3);try{fs[_0x02bb('0x105')](_0x4de4c3+_0x02bb('0x106'));}catch(_0x4fe63f){logger[_0x02bb('0x2c')](_0x4fe63f);}return _0x29a8dd;}return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x5634e0,_0x02bb('0x1c0'));};AGIVertices[_0x02bb('0x14')]['unpause']=function(_0x151a28){logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x1c1'),_0x151a28[_0x02bb('0x39')]));if(!this[_0x02bb('0x85')](_0x151a28[_0x02bb('0x159')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x151a28,_0x02bb('0x15a'));}logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x161'),this['channel']['callerid'],_0x151a28[_0x02bb('0x159')]));var _0x50cee8=this['agentUnpause']['sync'](this,_0x151a28[_0x02bb('0x159')]);if(_0x50cee8){logger[_0x02bb('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x02bb('0x38')]['callerid'],_0x151a28[_0x02bb('0x159')]));this[_0x02bb('0x38')]['noop'](util[_0x02bb('0x56')](_0x02bb('0x15b'),this['channel'][_0x02bb('0x51')],_0x151a28['findBy']));return{'code':0xc8,'result':_0x02bb('0x15c')};}else{logger[_0x02bb('0x30')](util[_0x02bb('0x56')](_0x02bb('0x15d'),this[_0x02bb('0x38')][_0x02bb('0x51')],_0x151a28[_0x02bb('0x159')]));this[_0x02bb('0x38')][_0x02bb('0xa7')](util[_0x02bb('0x56')](_0x02bb('0x15d'),this[_0x02bb('0x38')]['callerid'],_0x151a28[_0x02bb('0x159')]));return{'code':0xc8,'result':_0x02bb('0x15e')};}};AGIVertices[_0x02bb('0x14')][_0x02bb('0x1c2')]=function(_0x4ad7cf){logger[_0x02bb('0x30')](util['format'](_0x02bb('0x1c3'),_0x4ad7cf['label']));var _0x7f3c94=this['channel'][_0x02bb('0x58')]('VOICEMAIL',[_0x4ad7cf[_0x02bb('0x1c4')],_0x4ad7cf[_0x02bb('0x78')]]);if(_0x7f3c94[_0x02bb('0x9f')]===-0x1){return _0x7f3c94;}return this[_0x02bb('0x38')][_0x02bb('0xa7')](util['format'](_0x02bb('0xc3'),'VOICEMAIL',_0x4ad7cf[_0x02bb('0x1c4')]));};AGIVertices['prototype'][_0x02bb('0x1c5')]=function(_0x48c10a){logger['info'](util[_0x02bb('0x56')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x48c10a['label']));if(!this[_0x02bb('0x85')](_0x48c10a[_0x02bb('0x113')])){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x48c10a,_0x02bb('0x1a9'));}var _0x17d486=this['getVariable']['sync'](this,_0x48c10a[_0x02bb('0x113')]);if(!_0x17d486){return this[_0x02bb('0x38')][_0x02bb('0x2c')](_0x48c10a,_0x02bb('0xda'));}var _0xee0f0d=this[_0x02bb('0x38')]['getVariable'](_0x17d486);return{'code':0xc8,'result':_0xee0f0d['extra']?_0xee0f0d[_0x02bb('0xa1')]:'-'};};String[_0x02bb('0x14')][_0x02bb('0x1c6')]=function(_0x31ea66,_0x2fc569){return this['split'](_0x31ea66)[_0x02bb('0x1c7')](_0x2fc569);};module['exports']=AGIVertices; \ No newline at end of file +var _0x1df7=['login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','position','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','subject','template_id','debug','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','menu','getdigits','channel','mailRpc','prototype','getVariable','rpc','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','uniqueid','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','ispeechTTS','key','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','googleASR','tildeASR','appid','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','delay','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','sestekNDA','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','DIAL','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','aws_bot_name','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','no\x20key\x20configured','intKey','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable'];(function(_0x494717,_0x3ce8ea){var _0x3c5d7e=function(_0x5473b1){while(--_0x5473b1){_0x494717['push'](_0x494717['shift']());}};_0x3c5d7e(++_0x3ce8ea);}(_0x1df7,0x6e));var _0x71df=function(_0x363974,_0x34a5ef){_0x363974=_0x363974-0x0;var _0x524fdc=_0x1df7[_0x363974];return _0x524fdc;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x71df('0x0'));var sh=require(_0x71df('0x1'));var odbc=require(_0x71df('0x2'))();var rs=require(_0x71df('0x3'));var moment=require(_0x71df('0x4'));var Mustache=require(_0x71df('0x5'));var rp=require(_0x71df('0x6'));var logger=require(_0x71df('0x7'))(_0x71df('0x8'));var config=require(_0x71df('0x9'));var shared=require(_0x71df('0xa'));var scripts=require(_0x71df('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x71df('0xc'),'rawBody'];var verticesWithRetry=[_0x71df('0xd'),_0x71df('0xe'),'getsecretdigits'];var AGIVertices=function(_0x32f8cd,_0x4a4575,_0x3cb3be){this[_0x71df('0xf')]=_0x32f8cd;this['rpc']=_0x4a4575;this[_0x71df('0x10')]=_0x3cb3be;};AGIVertices[_0x71df('0x11')][_0x71df('0x12')]=function(_0x57e114,_0x39e325){this[_0x71df('0x13')]['getVariableById'](_0x57e114)[_0x71df('0x14')](function(_0x349233){_0x39e325(null,_0x349233?_0x349233[_0x71df('0x15')]:![]);})['catch'](function(_0x50de5b){_0x39e325(_0x50de5b);});};AGIVertices[_0x71df('0x11')][_0x71df('0x16')]=function(_0x4ae2f4,_0x4621eb){this[_0x71df('0x13')][_0x71df('0x17')](_0x4ae2f4)[_0x71df('0x14')](function(_0x3acfe6){_0x4621eb(null,_0x3acfe6?_0x3acfe6[_0x71df('0x15')]:![]);})[_0x71df('0x18')](function(_0x29c488){_0x4621eb(_0x29c488);});};AGIVertices[_0x71df('0x11')][_0x71df('0x19')]=function(_0x2b04b5,_0x2ed677){this['rpc'][_0x71df('0x1a')](_0x2b04b5)[_0x71df('0x14')](function(_0x30acd2){_0x2ed677(null,_0x30acd2?_0x30acd2[_0x71df('0x15')]:![]);})['catch'](function(_0x332984){_0x2ed677(_0x332984);});};AGIVertices[_0x71df('0x11')][_0x71df('0x1b')]=function(_0x234b72,_0x3eddbf){this['rpc'][_0x71df('0x1c')](_0x234b72)[_0x71df('0x14')](function(_0x3dc2e9){_0x3eddbf(null,_0x3dc2e9?_0x3dc2e9['dsn']:![]);})[_0x71df('0x18')](function(_0x4911f4){_0x3eddbf(_0x4911f4);});};AGIVertices['prototype'][_0x71df('0x1d')]=function(_0x573738,_0x4a0684){this[_0x71df('0x13')][_0x71df('0x1e')](_0x573738)['then'](function(_0x2bfde4){_0x4a0684(null,_0x2bfde4?_0x2bfde4[_0x71df('0x15')]:![]);})['catch'](function(_0x9f23ea){_0x4a0684(_0x9f23ea);});};AGIVertices[_0x71df('0x11')][_0x71df('0x1f')]=function(_0xf59cdc,_0x3f8798){this['rpc'][_0x71df('0x20')](_0xf59cdc)[_0x71df('0x14')](function(_0x592ee2){_0x3f8798(null,_0x592ee2?_0x592ee2[_0x71df('0x15')]:![]);})['catch'](function(_0xcbf773){_0x3f8798(_0xcbf773);});};AGIVertices[_0x71df('0x11')][_0x71df('0x21')]=function(_0x54e4ae,_0x5055eb){var _0x498155=this;this['rpc'][_0x71df('0x22')](_0x54e4ae)[_0x71df('0x14')](function(_0x15fdb0){_0x5055eb(null,_0x15fdb0?_0x498155[_0x71df('0x23')](_0x15fdb0[_0x71df('0x24')]):![]);})['catch'](function(_0x205623){_0x5055eb(_0x205623);});};AGIVertices[_0x71df('0x11')][_0x71df('0x25')]=function(_0x9b7d8,_0x583799){this[_0x71df('0x13')]['getMailAccountById'](_0x9b7d8)[_0x71df('0x14')](function(_0x87dbe8){_0x583799(null,_0x87dbe8?_0x87dbe8:![]);})[_0x71df('0x18')](function(_0xc818e4){_0x583799(_0xc818e4);});};AGIVertices['prototype'][_0x71df('0x26')]=function(_0x3647a5,_0x5a9342,_0x115d9b){this[_0x71df('0x10')]['sendMailMessage'](_0x3647a5,_0x5a9342)[_0x71df('0x14')](function(){_0x115d9b(null);})[_0x71df('0x18')](function(_0x43b8f4){_0x115d9b(_0x43b8f4);});};AGIVertices[_0x71df('0x11')][_0x71df('0x27')]=function(_0x346792,_0x229a3f){this[_0x71df('0x13')][_0x71df('0x28')](_0x346792)['then'](function(_0xcf3786){if(_0xcf3786){if(_0xcf3786['IntervalId']){_0x229a3f(null,[_0xcf3786[_0x71df('0x29')]]);}else{_0x229a3f(null,_[_0x71df('0x2a')](_0xcf3786['Intervals'],_0x71df('0x29')));}}else{_0x229a3f(null,![]);}})[_0x71df('0x18')](function(_0x5ce742){_0x229a3f(_0x5ce742);});};AGIVertices['prototype'][_0x71df('0x23')]=function(_0x3de886){return util[_0x71df('0x2b')](_0x71df('0x2c'),FILES_PATH,_0x3de886);};AGIVertices['prototype'][_0x71df('0x2d')]=function(_0x33bd9b,_0xb04dfa,_0x523515){odbc['open'](_0x33bd9b,function(_0x5756d2){if(_0x5756d2){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5756d2);_0x523515(_0x5756d2);}else{logger[_0x71df('0x2e')](_0x71df('0x2f'));odbc[_0x71df('0x30')](_0xb04dfa,function(_0x24a081,_0x4e4a80){if(_0x24a081){logger[_0x71df('0x2e')](_0x71df('0x31'),_0xb04dfa);_0x523515(_0x24a081);}else{logger[_0x71df('0x2e')]('Query\x20executed\x20correctly\x20%s',_0xb04dfa);odbc[_0x71df('0x32')](function(_0x258969){if(_0x258969){logger[_0x71df('0x33')](_0x71df('0x34'),_0x258969);}_0x523515(null,_0x4e4a80);});}});}});};AGIVertices['prototype'][_0x71df('0x35')]=function(_0x5a19a2,_0xba8215){this['rpc']['getSmsAccountById'](_0x5a19a2)[_0x71df('0x14')](function(_0x2a5d84){_0xba8215(null,_0x2a5d84?_0x2a5d84:![]);})['catch'](function(_0x15d6da){_0xba8215(_0x15d6da);});};AGIVertices['prototype'][_0x71df('0x36')]=function(_0x5cbc5f,_0x27ddbf){this[_0x71df('0x13')][_0x71df('0x36')](_0x5cbc5f)[_0x71df('0x14')](function(_0x57b975){_0x27ddbf(null,_0x57b975);})['catch'](function(_0x14a6f9){_0x27ddbf(_0x14a6f9);});};AGIVertices['prototype'][_0x71df('0x37')]=function(_0x12bce6,_0x4b2667,_0xce7a12){this[_0x71df('0x13')]['createSquareDetailsReport']({'uniqueid':this[_0x71df('0xf')]['uniqueid'],'node':_0x12bce6['label'],'application':_0x12bce6[_0x71df('0x38')],'data':_0x4b2667||null,'project_name':this[_0x71df('0xf')][_0x71df('0x39')],'callerid':this[_0x71df('0xf')][_0x71df('0x3a')]})['then'](function(_0x221090){if(_0xce7a12){_0xce7a12(null,_0x221090);}})['catch'](function(_0x755300){if(_0xce7a12){_0xce7a12(_0x755300);}});};AGIVertices[_0x71df('0x11')][_0x71df('0x3b')]=function(_0x211abb,_0x9d83b,_0x1591ef,_0xfee3ae){this[_0x71df('0x13')][_0x71df('0x3b')]({'uniqueid':this[_0x71df('0xf')]['uniqueid'],'callerid':this[_0x71df('0xf')][_0x71df('0x3a')],'calleridname':this[_0x71df('0xf')][_0x71df('0x3c')],'context':this[_0x71df('0xf')]['context'],'extension':this['channel'][_0x71df('0x3d')],'priority':this['channel'][_0x71df('0x3e')],'accountcode':this['channel'][_0x71df('0x3f')],'dnid':this[_0x71df('0xf')][_0x71df('0x40')],'projectName':this['channel'][_0x71df('0x39')],'saveName':_0x9d83b,'filename':_0x211abb[_0x71df('0x41')]||_0x9d83b,'savePath':_0x1591ef})[_0x71df('0x14')](function(_0x558d5d){_0xfee3ae(null,_0x558d5d);})[_0x71df('0x18')](function(_0x55f2f8){_0xfee3ae(_0x55f2f8);});};AGIVertices[_0x71df('0x11')][_0x71df('0x42')]=function(_0x1bc4c3,_0x307df4,_0x55aa2a,_0x594575,_0x2c9be6){this['rpc'][_0x71df('0x42')]({'uniqueid':this[_0x71df('0xf')][_0x71df('0x43')],'body':_0x1bc4c3,'direction':_0x307df4,'providerName':_0x55aa2a,'providerResponse':_0x594575})[_0x71df('0x14')](function(_0x4cdb8d){if(_0x2c9be6){_0x2c9be6(null,_0x4cdb8d);}})['catch'](function(_0x12ed3d){if(_0x2c9be6){_0x2c9be6(_0x12ed3d);}});};AGIVertices['prototype'][_0x71df('0x44')]=function(_0xf9c72b,_0x204ce1){this[_0x71df('0x13')][_0x71df('0x44')]({'firstName':_[_0x71df('0x45')](_0xf9c72b[_0x71df('0x15')])||_[_0x71df('0x46')](_0xf9c72b[_0x71df('0x15')])?_0x71df('0x47')+Math[_0x71df('0x48')]():_0xf9c72b['name'],'lastName':_[_0x71df('0x45')](_0xf9c72b[_0x71df('0x49')])||_[_0x71df('0x46')](_0xf9c72b[_0x71df('0x49')])?null:_0xf9c72b[_0x71df('0x49')],'phone':_0xf9c72b[_0x71df('0x4a')],'ListId':_0xf9c72b['list_id'],'scheduledat':_0xf9c72b[_0x71df('0x4b')],'callbackUniqueid':this[_0x71df('0xf')][_0x71df('0x43')],'tags':_0x71df('0x4c'),'description':_0x71df('0x4d')+_0xf9c72b[_0x71df('0x4b')][_0x71df('0x4e')](),'priority':_0xf9c72b[_0x71df('0x4f')]})['then'](function(_0x21553e){_0x204ce1(null,_0x21553e);})[_0x71df('0x18')](function(_0x437b85){_0x204ce1(_0x437b85);});};AGIVertices['prototype'][_0x71df('0x50')]=function(_0x252c38,_0x49b865){this[_0x71df('0x13')][_0x71df('0x51')](_0x252c38)['then'](function(_0x379cbe){_0x49b865(null,_0x379cbe?_0x379cbe[_0x71df('0x15')]:![]);})['catch'](function(_0x31f3b2){_0x49b865(_0x31f3b2);});};AGIVertices[_0x71df('0x11')][_0x71df('0x52')]=function(_0x4d53ce,_0x3c4a89,_0x250365){var _0x107e95={'role':_0x71df('0x53')};_0x107e95[_0x4d53ce]=this[_0x71df('0xf')][_0x71df('0x3a')];this['rpc'][_0x71df('0x52')](_0x107e95,_0x3c4a89,this[_0x71df('0xf')]['uniqueid'])[_0x71df('0x14')](function(_0x2fd3a0){_0x250365(null,_[_0x71df('0x46')](_0x2fd3a0)?![]:!![]);})[_0x71df('0x18')](function(_0x437f7d){logger[_0x71df('0x33')](_0x437f7d);_0x250365(null,![]);});};AGIVertices[_0x71df('0x11')][_0x71df('0x54')]=function(_0x4ad3ca,_0x71e352){var _0x437f37={'role':_0x71df('0x53')};_0x437f37[_0x4ad3ca]=this['channel'][_0x71df('0x3a')];this['rpc']['agentUnpause'](_0x437f37)['then'](function(_0x16784b){_0x71e352(null,_[_0x71df('0x46')](_0x16784b)?![]:!![]);})[_0x71df('0x18')](function(_0x3d268a){logger['error'](_0x3d268a);_0x71e352(null,![]);});};AGIVertices[_0x71df('0x11')][_0x71df('0x55')]=function(_0x3171e1,_0x573db7){var _0xe83c6f={'role':'agent'};_0xe83c6f[_0x3171e1]=this[_0x71df('0xf')]['callerid'];this['rpc'][_0x71df('0x55')](_0xe83c6f)[_0x71df('0x14')](function(_0x4b3ed9){_0x573db7(null,_[_0x71df('0x46')](_0x4b3ed9)?![]:!![]);})['catch'](function(_0x13f1bc){logger[_0x71df('0x33')](_0x13f1bc);_0x573db7(null,![]);});};AGIVertices[_0x71df('0x11')][_0x71df('0x56')]=function(_0xf8baff,_0x266ad7){var _0x22a969={'role':'agent'};_0x22a969[_0xf8baff]=this['channel']['callerid'];var _0x3b63ca=_0xf8baff!=_0x71df('0x57')?util[_0x71df('0x2b')](_0x71df('0x58'),_0x71df('0x59'),this['channel'][_0x71df('0x3a')]):undefined;this['rpc'][_0x71df('0x56')](_0x22a969,_0x3b63ca)[_0x71df('0x14')](function(_0x24afc3){_0x266ad7(null,_['isNil'](_0x24afc3)?![]:!![]);})[_0x71df('0x18')](function(_0x296f7e){logger[_0x71df('0x33')](_0x296f7e);_0x266ad7(null,![]);});};AGIVertices[_0x71df('0x11')][_0x71df('0x5a')]=function(_0x54f035,_0xb40aa4){sh[_0x71df('0x5b')](_['trim'](_0x54f035),function(_0x313526,_0x152967){var _0x90dc3a=_0x152967[_0x71df('0x5c')](/(\r\n|\n|\r)/gm,'');_0xb40aa4(null,_0x90dc3a);});};AGIVertices[_0x71df('0x11')][_0x71df('0x5d')]=function(_0x284c00,_0x28c6a5){scripts['googleCloudTTS'](_0x284c00[_0x71df('0x5e')],_0x284c00['google_cloud_tts_text_type']||_0x71df('0x5f'),_0x284c00[_0x71df('0x5f')],_0x284c00[_0x71df('0x60')]||_0x71df('0x61'),_0x284c00[_0x71df('0x62')]||_0x71df('0x63'),_0x284c00[_0x71df('0x64')]||_0x71df('0x65'))[_0x71df('0x14')](function(_0xeae745){_0x28c6a5(null,_0xeae745);})[_0x71df('0x18')](function(_0x13fdce){_0x28c6a5(_0x13fdce);});};AGIVertices['prototype'][_0x71df('0x66')]=function(_0x5da592,_0x548084){scripts[_0x71df('0x66')](_0x5da592[_0x71df('0x5f')],_0x5da592[_0x71df('0x67')]||'en',0x1)['then'](function(_0x17f19f){_0x548084(null,_0x17f19f);})['catch'](function(_0x7cdd7a){_0x548084(_0x7cdd7a);});};AGIVertices['prototype'][_0x71df('0x68')]=function(_0x152a91,_0x4642af){var _0x17ab24={'uri':_0x152a91[_0x71df('0x69')],'method':_0x152a91[_0x71df('0x6a')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x152a91[_0x71df('0x6b')])===_0x71df('0x6c')&&parseInt(_0x152a91[_0x71df('0x6b')])>=0x1?parseInt(_0x152a91[_0x71df('0x6b')])*0x3e8:0x5*0x3e8};if(_[_0x71df('0x6d')]([_0x71df('0x6e'),_0x71df('0x6f')],_0x17ab24[_0x71df('0x6a')][_0x71df('0x70')]())){try{_0x17ab24['body']=_0x152a91[_0x71df('0x71')]?JSON[_0x71df('0x72')](_0x152a91['rawBody']):{};}catch(_0x9580c3){logger[_0x71df('0x33')](_0x71df('0x73'),_0x9580c3);}}try{_0x17ab24['headers']=_0x152a91[_0x71df('0xc')]?JSON[_0x71df('0x72')](_0x152a91[_0x71df('0xc')]):{};}catch(_0x3c2462){logger[_0x71df('0x33')](_0x71df('0x74'),_0x3c2462);}if(_0x152a91[_0x71df('0x75')]){try{var _0x5526c1=require(_0x152a91[_0x71df('0x75')])[_0x71df('0x76')](this,_0x17ab24);_0x17ab24[_0x71df('0x77')]=Mustache[_0x71df('0x78')](_0x152a91[_0x71df('0x69')],_0x5526c1,{},['$$','$$']);if(_0x17ab24['headers']){_0x17ab24['headers']=JSON[_0x71df('0x72')](Mustache[_0x71df('0x78')](JSON['stringify'](_0x17ab24[_0x71df('0x79')]),_0x5526c1,{},['$$','$$']));}if(_0x17ab24[_0x71df('0x7a')]){_0x17ab24[_0x71df('0x7a')]=JSON['parse'](Mustache[_0x71df('0x78')](JSON[_0x71df('0x7b')](_0x17ab24['body']),_0x5526c1,{},['$$','$$']));}}catch(_0x463fa8){logger[_0x71df('0x33')](_0x71df('0x7c'),_0x463fa8);}}rp(_0x17ab24)[_0x71df('0x14')](function(_0x372e9a){var _0x4bdd15={'statusCode':_0x372e9a['statusCode']||0xc8,'statusMessage':_0x372e9a['statusMessage']||'OK','headers':_0x372e9a['headers']||{},'body':_0x372e9a[_0x71df('0x7a')]||{}};_0x4642af(null,_0x4bdd15);})[_0x71df('0x18')](function(_0x58484b){var _0xa27bd4={'statusCode':_0x58484b[_0x71df('0x7d')]||0x1f4,'statusMessage':_0x58484b[_0x71df('0x7e')]||_0x71df('0x7f'),'headers':_0x58484b[_0x71df('0x80')]['headers']||{},'body':_0x58484b['options'][_0x71df('0x7a')]||{}};_0x4642af(null,_0xa27bd4);});};AGIVertices[_0x71df('0x11')]['googleDialogflow']=function(_0x3b5be5,_0x1637b2){scripts[_0x71df('0x81')](this[_0x71df('0xf')][_0x71df('0x43')],_0x3b5be5['key'],_0x3b5be5[_0x71df('0x5f')],_0x3b5be5[_0x71df('0x82')]||'en')['then'](function(_0x59017f){_0x1637b2(null,_0x59017f);})[_0x71df('0x18')](function(_0x3df1ed){_0x1637b2(_0x3df1ed);});};AGIVertices[_0x71df('0x11')][_0x71df('0x83')]=function(_0x338a86,_0x43cc01){scripts['googleDialogflowV2'](this[_0x71df('0xf')]['uniqueid'],_0x338a86[_0x71df('0x84')],_0x338a86[_0x71df('0x85')],_0x338a86[_0x71df('0x86')],_0x338a86[_0x71df('0x5f')],_0x338a86['dialogflowV2_language']||'en')[_0x71df('0x14')](function(_0x335545){_0x43cc01(null,_0x335545);})[_0x71df('0x18')](function(_0x35d182){_0x43cc01(_0x35d182);});};AGIVertices[_0x71df('0x11')]['sestekNDA']=function(_0x5077c3,_0x101063){scripts['sestekNDA'](this[_0x71df('0xf')],_0x5077c3)[_0x71df('0x14')](function(_0x2dbf63){_0x101063(null,_0x2dbf63);})['catch'](function(_0x5c47a7){_0x101063(_0x5c47a7);});};AGIVertices[_0x71df('0x11')][_0x71df('0x87')]=function(_0x2d2914,_0x236e49){scripts[_0x71df('0x87')](_0x2d2914[_0x71df('0x88')],_0x2d2914[_0x71df('0x5f')],_0x2d2914['ispeech_tts_language']||_0x71df('0x61'),_0x2d2914[_0x71df('0x89')])[_0x71df('0x14')](function(_0xe2925e){_0x236e49(null,_0xe2925e);})[_0x71df('0x18')](function(_0x4cee46){_0x236e49(_0x4cee46);});};AGIVertices['prototype'][_0x71df('0x8a')]=function(_0x109445,_0x3c890d,_0x39d87f){scripts['ispeechASR'](_0x3c890d,_0x109445[_0x71df('0x88')],_0x109445['ispeech_asr_language']||_0x71df('0x61'),this[_0x71df('0x8b')](_0x109445[_0x71df('0x8c')])?_0x109445[_0x71df('0x8c')]:undefined)[_0x71df('0x14')](function(_0x451300){_0x39d87f(null,_0x451300);})[_0x71df('0x18')](function(_0x396894){_0x39d87f(_0x396894);});};AGIVertices[_0x71df('0x11')][_0x71df('0x8d')]=function(_0xbbb26,_0x44c2cd){scripts[_0x71df('0x8d')](_0xbbb26[_0x71df('0x8e')],_0xbbb26[_0x71df('0x8f')],_0xbbb26[_0x71df('0x90')],_0xbbb26[_0x71df('0x91')]||_0x71df('0x92'),_0xbbb26[_0x71df('0x5f')],_0xbbb26['aws_text_type']||_0x71df('0x5f'))[_0x71df('0x14')](function(_0x1cb6e6){_0x44c2cd(null,_0x1cb6e6);})['catch'](function(_0x17f660){_0x44c2cd(_0x17f660);});};AGIVertices[_0x71df('0x11')][_0x71df('0x93')]=function(_0x389a87,_0x5a3a09){scripts[_0x71df('0x93')](this[_0x71df('0xf')]['uniqueid'],_0x389a87[_0x71df('0x8e')],_0x389a87[_0x71df('0x8f')],_0x389a87[_0x71df('0x94')],_0x389a87[_0x71df('0x5f')],_0x389a87['aws_bot_name'])[_0x71df('0x14')](function(_0x2affd1){_0x5a3a09(null,_0x2affd1);})[_0x71df('0x18')](function(_0x81eaed){_0x5a3a09(_0x81eaed);});};AGIVertices[_0x71df('0x11')][_0x71df('0x95')]=function(_0x3a5229,_0x663892,_0x2b3c92){scripts[_0x71df('0x95')](_0x663892,_0x3a5229[_0x71df('0x88')],_0x3a5229['google_asr_language']||_0x71df('0x61'))[_0x71df('0x14')](function(_0x1de585){_0x2b3c92(null,_0x1de585);})[_0x71df('0x18')](function(_0x11ddb5){_0x2b3c92(_0x11ddb5);});};AGIVertices['prototype']['tildeASR']=function(_0x1c88c6,_0x2ee739,_0x3a548c){scripts[_0x71df('0x96')](_0x2ee739,_0x1c88c6[_0x71df('0x97')],_0x1c88c6['appsecret'],_0x1c88c6[_0x71df('0x77')])[_0x71df('0x14')](function(_0x17ad68){_0x3a548c(null,_0x17ad68);})[_0x71df('0x18')](function(_0x4a5d7d){_0x3a548c(_0x4a5d7d);});};AGIVertices[_0x71df('0x11')]['clear']=function(_0x20aa3a){var _0x4718b1=_['includes'](verticesWithRetry,_0x20aa3a[_0x71df('0x38')])?_0x20aa3a:_[_0x71df('0x98')](_0x20aa3a);for(var _0x2319dd in _0x4718b1){if(_0x4718b1[_0x71df('0x99')](_0x2319dd)){if(_0x4718b1[_0x2319dd]&&_[_0x71df('0x9a')](_0x4718b1[_0x2319dd])){if(_['includes'](recursiveMapAttributes,_0x2319dd)){_0x4718b1[_0x2319dd]=this['replaceObjectAllVariables'](_0x4718b1[_0x2319dd]);}else{_0x4718b1[_0x2319dd]=this[_0x71df('0x9b')](_0x4718b1[_0x2319dd]);}}}}return _0x4718b1;};AGIVertices[_0x71df('0x11')]['recursiveNodeIndex']=function(_0x494c6c){for(var _0x3af0ae in _0x494c6c){if(_0x494c6c[_0x71df('0x99')](_0x3af0ae)){if(_['isPlainObject'](_0x494c6c[_0x3af0ae])){this[_0x71df('0x9c')](_0x494c6c[_0x3af0ae]);}else if(_[_0x71df('0x9d')](_0x494c6c[_0x3af0ae])){for(var _0x5c953b=0x0;_0x5c953b<_0x494c6c[_0x3af0ae][_0x71df('0x9e')];_0x5c953b++){this['recursiveNodeIndex'](_0x494c6c[_0x3af0ae][_0x5c953b]);}}else if(_[_0x71df('0x9a')](_0x494c6c[_0x3af0ae])){_0x494c6c[_0x3af0ae]=this[_0x71df('0x9b')](_0x494c6c[_0x3af0ae]);}}}};AGIVertices[_0x71df('0x11')]['saveRestApiResult']=function(_0x503e75,_0x443300){for(var _0xe8fe37 in _0x503e75){if(_0x503e75['hasOwnProperty'](_0xe8fe37)){if(_[_0x71df('0x9f')](_0x503e75[_0xe8fe37])){if(!_[_0x71df('0x45')](_0x503e75[_0xe8fe37])){this[_0x71df('0xa0')](_0x503e75[_0xe8fe37],util[_0x71df('0x2b')](_0x71df('0xa1'),_0x443300,_0xe8fe37));}}else if(_[_0x71df('0x9d')](_0x503e75[_0xe8fe37])){for(var _0x5782b1=0x0;_0x5782b1<_0x503e75[_0xe8fe37]['length'];_0x5782b1++){this[_0x71df('0xa0')](_0x503e75[_0xe8fe37][_0x5782b1],util['format']('%s.%s',_0x443300,_0xe8fe37+'['+_0x5782b1+']'));}}else{if(!_[_0x71df('0x46')](_0x503e75[_0xe8fe37])){this['channel'][_0x71df('0xa2')](util[_0x71df('0x2b')](_0x71df('0xa1'),_0x443300,_0xe8fe37),_0x503e75[_0xe8fe37]);}}}}};AGIVertices[_0x71df('0x11')][_0x71df('0xa3')]=function(_0x4a804c){try{var _0x44f585=JSON[_0x71df('0x72')](_0x4a804c);this['recursiveNodeIndex'](_0x44f585);return JSON[_0x71df('0x7b')](_0x44f585);}catch(_0x286dc4){return this[_0x71df('0x9b')](_0x4a804c);}};AGIVertices['prototype'][_0x71df('0x9b')]=function(_0x3c9efb){var _0x46f9b1=_0x3c9efb['split']('{');for(var _0x15efbf=0x1;_0x15efbf<_0x46f9b1[_0x71df('0x9e')];_0x15efbf+=0x1){var _0x32a19a=_0x46f9b1[_0x15efbf]['split']('}');if(_0x32a19a['length']>0x1){_0x3c9efb=_0x3c9efb[_0x71df('0xa4')]('{'+_0x32a19a[0x0]+'}',this['channel']['getVariable'](_0x32a19a[0x0])[_0x71df('0xa5')]||_0x32a19a[0x0]);}}if(_0x46f9b1[_0x71df('0x9e')]===0x1){return _0x3c9efb[_0x71df('0x4e')]();}return this['replaceAllVariables'](_0x3c9efb);};AGIVertices[_0x71df('0x11')][_0x71df('0xa6')]=function(_0x1e79bf,_0x15ad73){var _0x4227dd=this[_0x71df('0xf')]['getVariable'](_0x1e79bf);if(_0x4227dd[_0x71df('0xa7')]===-0x1){return _0x4227dd;}logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xa8'),_0x15ad73,_0x4227dd[_0x71df('0xa5')]));return this[_0x71df('0xf')][_0x71df('0xa2')](_0x15ad73,_0x4227dd['extra']);};AGIVertices[_0x71df('0x11')][_0x71df('0x8b')]=function(_0x460457){return _0x460457&&_0x460457!=='0'&&_0x460457!=='-1'&&_0x460457!=='';};AGIVertices[_0x71df('0x11')][_0x71df('0xa9')]=function(_0x163504){this['createSquareDetailsReport']['sync'](this,_0x163504,'-');_0x163504[_0x71df('0xaa')]=_0x163504[_0x71df('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x71df('0xab')]=function(_0x3ca977){logger[_0x71df('0x2e')](util['format'](_0x71df('0xac'),_0x3ca977[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x3ca977[_0x71df('0x5f')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xaf'));}var _0x458e5b='\x22'+_0x3ca977[_0x71df('0x5f')]+'\x22';if(this['isConfigured'](_0x3ca977[_0x71df('0x80')])){_0x458e5b+=','+_0x3ca977[_0x71df('0x80')];}var _0x3233b1=this[_0x71df('0xf')][_0x71df('0x5b')]('MRCPSynth',_0x458e5b);if(_0x3233b1[_0x71df('0xa7')]===-0x1){return _0x3233b1;}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x458e5b));};AGIVertices[_0x71df('0x11')][_0x71df('0xb0')]=function(_0xf5554e){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xb1'),_0xf5554e[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0xf5554e['grammar'])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20grammar\x20configured');}var _0x5d629d=_0xf5554e[_0x71df('0xb2')];if(this[_0x71df('0x8b')](_0xf5554e[_0x71df('0x80')])){_0x5d629d+=','+_0xf5554e['options'];}var _0x5db21a=this['channel'][_0x71df('0x5b')](_0x71df('0xb3'),_0x5d629d);if(_0x5db21a[_0x71df('0xa7')]===-0x1){return _0x5db21a;}var _0x226bba=this[_0x71df('0xa6')](_0x71df('0xb4'),'MRCP_RECOG_CONFIDENCE');if(_0x226bba[_0x71df('0xa7')]===-0x1){return _0x226bba;}var _0x51c72f=this['getAndSetVariable']('RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT');if(_0x51c72f['result']===-0x1){return _0x51c72f;}var _0x5a011e=this[_0x71df('0xa6')](_0x71df('0xb5'),_0x71df('0xb6'));if(_0x5a011e['result']===-0x1){return _0x5a011e;}return this[_0x71df('0xf')]['noop'](util['format'](_0x71df('0xb7'),_0x5d629d));};AGIVertices[_0x71df('0x11')][_0x71df('0x8')]=function(_0x3f85b1){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xb8'),_0x3f85b1[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0x8')]([_0x3f85b1[_0x71df('0xb9')],_0x3f85b1[_0x71df('0xba')]]);};AGIVertices['prototype'][_0x71df('0xbb')]=function(_0x180ccc){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xbc'),_0x180ccc[_0x71df('0xad')]));if(this[_0x71df('0x8b')](_0x180ccc['timeout'])){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xbd'),_0x180ccc[_0x71df('0x6b')]));var _0x512da9=this[_0x71df('0xf')][_0x71df('0xbe')](_0x180ccc[_0x71df('0x6b')]);if(_0x512da9[_0x71df('0xa7')]===-0x1){return _0x512da9;}}return this[_0x71df('0xf')][_0x71df('0xbb')]();};AGIVertices[_0x71df('0x11')][_0x71df('0x4c')]=function(_0xf00081){logger[_0x71df('0x2e')](util['format'](_0x71df('0xbf'),_0xf00081[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0xf00081[_0x71df('0xc0')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0xf00081,_0x71df('0xc1'));}_0xf00081['scheduledAt']=moment();if(this[_0x71df('0x8b')](_0xf00081[_0x71df('0xc2')])){_0xf00081[_0x71df('0x4b')]=moment()['add'](_0xf00081['delay'],_0x71df('0xc3'));}if(!this[_0x71df('0x8b')](_0xf00081[_0x71df('0x4f')])){_0xf00081[_0x71df('0x4f')]=0x2;}this[_0x71df('0x44')][_0x71df('0x76')](this,_0xf00081);return this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xf00081[_0x71df('0x4a')],_0xf00081[_0x71df('0xc0')],_0xf00081[_0x71df('0x4b')]));};AGIVertices[_0x71df('0x11')][_0x71df('0xc4')]=function(_0x388144){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xc5'),_0x388144[_0x71df('0xad')]));var _0x56b329=this['channel'][_0x71df('0x5b')](_0x388144[_0x71df('0xc6')],_0x388144[_0x71df('0x80')]);if(_0x56b329[_0x71df('0xa7')]===-0x1){return _0x56b329;}return this['channel'][_0x71df('0xae')](util['format'](_0x71df('0xc7'),_0x388144[_0x71df('0xc6')],_0x388144['options']));};AGIVertices[_0x71df('0x11')][_0x71df('0xc8')]=function(_0x15d44b){logger['info'](util['format'](_0x71df('0xc9'),_0x15d44b[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x15d44b['text'])){return this['channel'][_0x71df('0xae')](_0x71df('0xaf'));}var _0x3a1a89='\x22'+_0x15d44b[_0x71df('0x5f')]+'\x22';if(this[_0x71df('0x8b')](_0x15d44b['options'])){_0x3a1a89+=','+_0x15d44b['options'];}var _0xad1cfb=this[_0x71df('0xf')][_0x71df('0x5b')]('MRCPSynth',_0x3a1a89);if(_0xad1cfb[_0x71df('0xa7')]===-0x1){return _0xad1cfb;}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xca'),_0x3a1a89));};AGIVertices[_0x71df('0x11')][_0x71df('0xcb')]=function(_0x2efca1){logger[_0x71df('0x2e')](util['format'](_0x71df('0xcc'),_0x2efca1[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x2efca1[_0x71df('0x5f')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xaf'));}var _0x525e71='\x22'+_0x2efca1['text']+'\x22';if(this[_0x71df('0x8b')](_0x2efca1[_0x71df('0x80')])){_0x525e71+=','+_0x2efca1[_0x71df('0x80')];}var _0x8f5d53=this[_0x71df('0xf')]['exec']('MRCPSynth',_0x525e71);if(_0x8f5d53[_0x71df('0xa7')]===-0x1){return _0x8f5d53;}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xca'),_0x525e71));};AGIVertices[_0x71df('0x11')][_0x71df('0xcd')]=function(_0x2a7a3f){logger[_0x71df('0x2e')](util['format'](_0x71df('0xce'),_0x2a7a3f[_0x71df('0xad')]));if(!this['isConfigured'](_0x2a7a3f[_0x71df('0xb2')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xcf'));}var _0xaf82e1=_0x2a7a3f[_0x71df('0xb2')];if(this[_0x71df('0x8b')](_0x2a7a3f[_0x71df('0x80')])){_0xaf82e1+=','+_0x2a7a3f['options'];}var _0x36a7c9=this[_0x71df('0xf')][_0x71df('0x5b')](_0x71df('0xb3'),_0xaf82e1);if(_0x36a7c9[_0x71df('0xa7')]===-0x1){return _0x36a7c9;}var _0x19a774=this['getAndSetVariable']('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x19a774[_0x71df('0xa7')]===-0x1){return _0x19a774;}var _0x20d23a=this[_0x71df('0xa6')](_0x71df('0xd0'),_0x71df('0xd1'));if(_0x20d23a[_0x71df('0xa7')]===-0x1){return _0x20d23a;}var _0x4d54d6=this[_0x71df('0xa6')](_0x71df('0xb5'),_0x71df('0xd2'));if(_0x4d54d6['result']===-0x1){return _0x4d54d6;}return this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xb7'),_0xaf82e1));};AGIVertices[_0x71df('0x11')]['sestekasr']=function(_0x5660dc){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xd3'),_0x5660dc[_0x71df('0xad')]));if(!this['isConfigured'](_0x5660dc[_0x71df('0xb2')])){return this['channel'][_0x71df('0xae')](_0x71df('0xcf'));}var _0x3072ba=_0x5660dc['grammar'];if(this['isConfigured'](_0x5660dc[_0x71df('0x80')])){_0x3072ba+=','+_0x5660dc['options'];}var _0x2f3f2b=this['channel'][_0x71df('0x5b')](_0x71df('0xb3'),_0x3072ba);if(_0x2f3f2b[_0x71df('0xa7')]===-0x1){return _0x2f3f2b;}var _0x64df66=this[_0x71df('0xa6')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x64df66[_0x71df('0xa7')]===-0x1){return _0x64df66;}var _0x3a806e=this['getAndSetVariable'](_0x71df('0xd0'),_0x71df('0xd4'));if(_0x3a806e['result']===-0x1){return _0x3a806e;}var _0x35a848=this[_0x71df('0xa6')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x35a848[_0x71df('0xa7')]===-0x1){return _0x35a848;}return this[_0x71df('0xf')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3072ba));};AGIVertices['prototype'][_0x71df('0xd5')]=function(_0x12276d){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xd6'),_0x12276d[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x12276d[_0x71df('0xd7')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x12276d,_0x71df('0xd8'));}var _0x5560bd=this['getSquareOdbc'][_0x71df('0x76')](this,_0x12276d[_0x71df('0xd7')]);if(!_0x5560bd){return this[_0x71df('0xf')][_0x71df('0x33')](_0x12276d,_0x71df('0xd9'));}if(!this['isConfigured'](_0x12276d['query'])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x12276d,_0x71df('0xda'));}var _0x5caf62=_0x12276d[_0x71df('0x30')][_0x71df('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xdb'),_0x5caf62));var _0x5906c5=this[_0x71df('0x2d')][_0x71df('0x76')](this,_0x5560bd,_0x5caf62);this[_0x71df('0x37')][_0x71df('0x76')](this,_0x12276d,_0x5caf62);if(!this[_0x71df('0x8b')](_0x12276d[_0x71df('0xdc')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xdd'));}var _0xc0715e=this[_0x71df('0x12')][_0x71df('0x76')](this,_0x12276d[_0x71df('0xdc')]);if(!_0xc0715e){return this[_0x71df('0xf')]['error'](_0x12276d,'no\x20variable\x20found');}var _0x320a48=this;_0x5906c5[_0x71df('0xde')](function(_0x311683,_0x157b79){Object['keys'](_0x311683)[_0x71df('0xde')](function(_0x5efe04){_0x320a48['channel'][_0x71df('0xa2')](util['format'](_0x71df('0xdf'),_0xc0715e,_0x157b79,_0x5efe04),_0x311683[_0x5efe04]);});});this['channel'][_0x71df('0xa2')](util[_0x71df('0x2b')]('%s_ROWS_COUNT',_0xc0715e),_0x5906c5['length']);return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xe0'),_0xc0715e));};AGIVertices[_0x71df('0x11')][_0x71df('0xe1')]=function(_0xf928da){logger['debug'](util[_0x71df('0x2b')](_0x71df('0xe2'),_0xf928da[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0xf928da[_0x71df('0xe3')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0xf928da,_0x71df('0xe4'));}var _0xb42202=this[_0x71df('0x1d')]['sync'](this,_0xf928da[_0x71df('0xe3')]);if(!_0xb42202){return this[_0x71df('0xf')][_0x71df('0x33')](_0xf928da,_0x71df('0xe5'));}var _0x3f8114=this[_0x71df('0xf')][_0x71df('0x5b')]('DIAL',[util['format'](_0x71df('0xe6'),_0xb42202),_0xf928da[_0x71df('0x6b')],_0xf928da[_0x71df('0xe7')],_0xf928da[_0x71df('0x69')]]);if(_0x3f8114[_0x71df('0xa7')]===-0x1){return _0x3f8114;}return this['channel']['noop'](util[_0x71df('0x2b')](_0x71df('0xe8'),'DIAL'));};AGIVertices[_0x71df('0x11')][_0x71df('0xe9')]=function(_0x4f027b){logger['info'](util[_0x71df('0x2b')](_0x71df('0xea'),_0x4f027b[_0x71df('0xad')]));if(!this['isConfigured'](_0x4f027b[_0x71df('0x88')])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x4f027b[_0x71df('0x5f')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xaf'));}this['channel']['bot']=!![];this[_0x71df('0x37')](_0x4f027b);this[_0x71df('0x42')](_0x4f027b['text'],'in','','');this['channel']['noop'](util[_0x71df('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x4f027b[_0x71df('0x5f')]));var _0x445eca=this[_0x71df('0x81')][_0x71df('0x76')](this,_0x4f027b);if(_0x445eca){for(var _0x3abab2 in _0x445eca){if(_0x445eca[_0x71df('0x99')](_0x3abab2)){this[_0x71df('0xf')][_0x71df('0xa2')](util[_0x71df('0x2b')]('DIALOGFLOW_%s',_0x3abab2[_0x71df('0x70')]()),_0x445eca[_0x3abab2]);}}this['createSquareMessage'](_0x445eca[_0x71df('0xeb')],_0x71df('0xec'),_0x71df('0xe9'),'');return this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xed'),_0x445eca[_0x71df('0xeb')]));}return this[_0x71df('0xf')][_0x71df('0x33')](_0x4f027b,_0x71df('0xee'));};AGIVertices[_0x71df('0x11')][_0x71df('0xef')]=function(_0x1293f8){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x1293f8['label']));if(!this['isConfigured'](_0x1293f8['dialogflowV2_project_id'])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xf0'));}if(!this[_0x71df('0x8b')](_0x1293f8[_0x71df('0x85')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xf1'));}if(!this[_0x71df('0x8b')](_0x1293f8[_0x71df('0x86')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xf2'));}if(!this[_0x71df('0x8b')](_0x1293f8[_0x71df('0xf3')])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20anguage\x20configured');}if(!this[_0x71df('0x8b')](_0x1293f8[_0x71df('0x5f')])){return this['channel'][_0x71df('0xae')](_0x71df('0xaf'));}this['channel']['bot']=!![];this[_0x71df('0x37')](_0x1293f8);this['createSquareMessage'](_0x1293f8[_0x71df('0x5f')],'in','','');this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xf4'),_0x1293f8[_0x71df('0x5f')]));var _0x15bb23=this[_0x71df('0x83')][_0x71df('0x76')](this,_0x1293f8);if(_0x15bb23){for(var _0x24ae06 in _0x15bb23){if(_0x15bb23[_0x71df('0x99')](_0x24ae06)){if(_0x24ae06!==_0x71df('0xf5')){this['channel']['setVariable'](util[_0x71df('0x2b')](_0x71df('0xf6'),_0x24ae06[_0x71df('0x70')]()),_0x15bb23[_0x24ae06]);}}}this[_0x71df('0x42')](_0x15bb23[_0x71df('0xeb')],'out',_0x71df('0xef'),_0x15bb23[_0x71df('0xf5')]);return this[_0x71df('0xf')]['noop'](util['format'](_0x71df('0xf7'),_0x15bb23[_0x71df('0xeb')]));}return this[_0x71df('0xf')][_0x71df('0x33')](_0x1293f8,_0x71df('0xf8'));};AGIVertices[_0x71df('0x11')][_0x71df('0xf9')]=function(_0x442d4b){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0xfa'),_0x442d4b['label']));if(!this[_0x71df('0x8b')](_0x442d4b[_0x71df('0xfb')])){return this['channel']['noop']('no\x20ndauth\x20url\x20configured');}if(!this[_0x71df('0x8b')](_0x442d4b[_0x71df('0xfc')])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x442d4b[_0x71df('0xfd')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xfe'));}if(!this[_0x71df('0x8b')](_0x442d4b[_0x71df('0xff')])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20text\x20configured');}this[_0x71df('0xf')][_0x71df('0x100')]=!![];this[_0x71df('0x37')](_0x442d4b);this[_0x71df('0x42')](_0x442d4b[_0x71df('0x5f')],'in','','');this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0x101'),_0x442d4b['text']));var _0x57c061=this[_0x71df('0x102')][_0x71df('0x76')](this,_0x442d4b);if(_0x57c061){for(var _0x4860e2 in _0x57c061){if(_0x57c061[_0x71df('0x99')](_0x4860e2)){this[_0x71df('0xf')][_0x71df('0xa2')](util[_0x71df('0x2b')]('SESTEK_NDA_%s',_0x4860e2[_0x71df('0x70')]()),_0x57c061[_0x4860e2]);}}this[_0x71df('0x42')](_0x57c061['speech'],_0x71df('0xec'),'sesteknda','');if(_0x57c061[_0x71df('0x103')]){this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x104'),_0x57c061[_0x71df('0x103')]));var _0x46b1c4=this[_0x71df('0xf')][_0x71df('0x105')](_0x57c061['audiofile']);try{fs[_0x71df('0x106')](_0x57c061['audiofile']+_0x71df('0x107'));}catch(_0x1d3a58){logger[_0x71df('0x33')](_0x1d3a58);}return _0x46b1c4;}else{return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x108'),_0x57c061[_0x71df('0xeb')]));}}return this[_0x71df('0xf')]['error'](_0x442d4b,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x71df('0x109')]=function(_0x4acc37){logger[_0x71df('0x2e')](util['format'](_0x71df('0x10a'),_0x4acc37[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x109'));};AGIVertices[_0x71df('0x11')][_0x71df('0x10b')]=function(_0x483f0d){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x10c'),_0x483f0d[_0x71df('0xad')]));var _0x2181d2='';if(_0x483f0d[_0x71df('0x10d')]){if(!this['isConfigured'](_0x483f0d[_0x71df('0x10d')])){return this[_0x71df('0xf')]['error'](_0x483f0d,_0x71df('0x10e'));}else{var _0x53b1bc=parseInt(_0x483f0d[_0x71df('0x10d')],0xa);if(isNaN(_0x53b1bc)){_0x2181d2=_0x483f0d['trunk_id'];}else{_0x2181d2=this[_0x71df('0x1f')][_0x71df('0x76')](this,_0x483f0d[_0x71df('0x10d')]);if(!_0x2181d2){return this[_0x71df('0xf')][_0x71df('0x33')](_0x483f0d,_0x71df('0x10f'));}}}}else if(_0x483f0d[_0x71df('0x110')]){_0x2181d2=_0x483f0d['trunk_name'];}else{return this[_0x71df('0xf')][_0x71df('0x33')](_0x483f0d,_0x71df('0x10e'));}var _0x4d04aa=this['channel'][_0x71df('0x5b')](_0x71df('0x111'),[util[_0x71df('0x2b')]('SIP/%s/%s',_0x2181d2,_0x483f0d[_0x71df('0x4a')]),_0x483f0d[_0x71df('0x6b')],_0x483f0d[_0x71df('0xe7')],_0x483f0d['url']]);if(_0x4d04aa[_0x71df('0xa7')]===-0x1){return _0x4d04aa;}return this[_0x71df('0xf')][_0x71df('0xae')](util['format'](_0x71df('0xe8'),_0x71df('0x111')));};AGIVertices[_0x71df('0x11')][_0x71df('0x112')]=function(_0x162463){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x162463[_0x71df('0xad')]));return this['channel'][_0x71df('0xae')]('finally');};AGIVertices[_0x71df('0x11')][_0x71df('0xe')]=function(_0x55f789){logger[_0x71df('0x2e')](util['format'](_0x71df('0x113'),_0x55f789['label']));if(_0x55f789['retry']===0x0){return this[_0x71df('0xa9')](_0x55f789);}_0x55f789[_0x71df('0xaa')]-=0x1;if(!this[_0x71df('0x8b')](_0x55f789[_0x71df('0x114')])){return this['channel'][_0x71df('0x33')](_0x55f789,'no\x20file\x20audio\x20selected');}var _0x3edcc3=this[_0x71df('0x21')]['sync'](this,_0x55f789['file_id']);if(!_0x3edcc3){return this['channel'][_0x71df('0x33')](_0x55f789,_0x71df('0x115'));}if(!this[_0x71df('0x8b')](_0x55f789[_0x71df('0xdc')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x71df('0xdd'));}var _0x1fbbd3=this[_0x71df('0xf')]['getData'](_0x3edcc3,_0x55f789[_0x71df('0x116')],_0x55f789[_0x71df('0x117')]);var _0x432860=_0x1fbbd3[_0x71df('0xa7')]?_0x1fbbd3['result'][_0x71df('0x4e')]():'';logger[_0x71df('0x2e')](_0x71df('0x118'),JSON[_0x71df('0x7b')](_0x1fbbd3));if(_0x1fbbd3[_0x71df('0xa7')]===-0x1){this[_0x71df('0x37')][_0x71df('0x76')](this,_0x55f789,_0x432860);return _0x1fbbd3;}else if(_0x1fbbd3[_0x71df('0xa5')]===_0x71df('0x6b')){_0x1fbbd3['result']=_0x432860['length']>=parseInt(_0x55f789[_0x71df('0x119')])?'x':'i';}else{_0x1fbbd3[_0x71df('0xa7')]=_0x432860['length']>=parseInt(_0x55f789['mindigit'])&&_0x432860[_0x71df('0x9e')]<=parseInt(_0x55f789[_0x71df('0x117')])?'x':'i';}var _0x16c1a7=this[_0x71df('0x12')][_0x71df('0x76')](this,_0x55f789[_0x71df('0xdc')]);if(!_0x16c1a7){return this['channel']['error'](_0x55f789,_0x71df('0x11a'));}this[_0x71df('0xf')][_0x71df('0xa2')](_0x16c1a7,_0x432860);if(this[_0x71df('0x8b')](_0x55f789[_0x71df('0x11b')])){var _0x2dbda6=parseInt(_0x55f789[_0x71df('0x11b')],0xa);var _0x5efbbb=rs['generate']({'charset':'*','length':_0x2dbda6});var _0x3bb39e=_0x432860[_0x71df('0x9e')];if(_0x3bb39e>0x0){if(_0x3bb39e>_0x2dbda6){this[_0x71df('0x37')][_0x71df('0x76')](this,_0x55f789,_0x55f789[_0x71df('0x11c')]===_0x71df('0x11d')?_0x5efbbb+_0x432860[_0x71df('0x11e')](_0x2dbda6):_0x432860['substr'](0x0,_0x3bb39e-_0x2dbda6)+_0x5efbbb);}else{this['createSquareDetailsReport'][_0x71df('0x76')](this,_0x55f789,rs[_0x71df('0x11f')]({'charset':'*','length':_0x3bb39e}));}}else{this[_0x71df('0x37')][_0x71df('0x76')](this,_0x55f789,'');}}else{this['createSquareDetailsReport'][_0x71df('0x76')](this,_0x55f789,_0x432860);}return _0x1fbbd3;};AGIVertices[_0x71df('0x11')][_0x71df('0x120')]=function(_0x25ef61){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x121'),_0x25ef61['label']));return this[_0x71df('0xe')](_0x25ef61);};AGIVertices[_0x71df('0x11')][_0x71df('0x122')]=function(_0x4370bb){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x123'),_0x4370bb['label']));this[_0x71df('0x37')]['sync'](this,_0x4370bb,_0x4370bb[_0x71df('0x124')]);return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x125'),_0x4370bb[_0x71df('0x124')]));};AGIVertices['prototype']['awspolly']=function(_0x4a142a){logger['info'](util[_0x71df('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4a142a[_0x71df('0xad')]));if(!this['isConfigured'](_0x4a142a[_0x71df('0x8e')])||!this['isConfigured'](_0x4a142a['aws_secret_access_key'])){return this['channel'][_0x71df('0xae')](_0x71df('0x126'));}if(!this[_0x71df('0x8b')](_0x4a142a[_0x71df('0x5f')])){return this['channel'][_0x71df('0xae')](_0x71df('0xaf'));}this[_0x71df('0xf')][_0x71df('0xae')](util['format'](_0x71df('0x127'),_0x4a142a[_0x71df('0x5f')]));var _0x4d9746=this['awsPolly'][_0x71df('0x76')](this,_0x4a142a);if(_0x4d9746){this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x128'),_0x4d9746));var _0x17444a=this[_0x71df('0xf')][_0x71df('0x105')](_0x4d9746);try{fs[_0x71df('0x106')](_0x4d9746+_0x71df('0x107'));}catch(_0x5e1ff9){logger['error'](_0x5e1ff9);}return _0x17444a;}return this[_0x71df('0xf')][_0x71df('0x33')](_0x4a142a,_0x71df('0x129'));};AGIVertices['prototype'][_0x71df('0x12a')]=function(_0x30b970){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x30b970[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x30b970['aws_access_key_id'])||!this[_0x71df('0x8b')](_0x30b970[_0x71df('0x8f')])){return this[_0x71df('0xf')]['noop'](_0x71df('0x126'));}if(!this[_0x71df('0x8b')](_0x30b970[_0x71df('0x12b')])){return this[_0x71df('0xf')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x71df('0x8b')](_0x30b970[_0x71df('0x5f')])){return this[_0x71df('0xf')]['noop']('no\x20text\x20configured');}this[_0x71df('0xf')]['bot']=!![];this[_0x71df('0x37')](_0x30b970);this[_0x71df('0x42')](_0x30b970['text'],'in','','');this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x30b970[_0x71df('0x5f')]));var _0x40ccc7=this[_0x71df('0x93')][_0x71df('0x76')](this,_0x30b970);if(_0x40ccc7){for(var _0x45e36c in _0x40ccc7){if(_0x40ccc7[_0x71df('0x99')](_0x45e36c)&&_[_0x71df('0x9a')](_0x40ccc7[_0x45e36c])){this[_0x71df('0xf')][_0x71df('0xa2')](util['format'](_0x71df('0x12c'),_0x45e36c[_0x71df('0x70')]()),_0x40ccc7[_0x45e36c]);}}if(_['isNil'](_0x40ccc7[_0x71df('0x7e')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x12d'));}else{this[_0x71df('0x42')](_0x40ccc7[_0x71df('0x7e')],_0x71df('0xec'),_0x71df('0x12e'),'');return this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x40ccc7[_0x71df('0x7e')]));}}return this[_0x71df('0xf')]['error'](_0x30b970,_0x71df('0x12f'));};AGIVertices[_0x71df('0x11')]['googleasr']=function(_0x1bc4b4){logger[_0x71df('0x2e')](util['format'](_0x71df('0x130'),_0x1bc4b4['label'],_0x1bc4b4[_0x71df('0x6b')]));if(!this[_0x71df('0x8b')](_0x1bc4b4[_0x71df('0x88')])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20key\x20configured');}var _0x4b03bf='wav';var _0x2ee8ae=util[_0x71df('0x2b')](_0x71df('0x131'),FILES_PATH,rs[_0x71df('0x11f')](0x4));var _0x42076=util[_0x71df('0x2b')](_0x71df('0xa1'),_0x2ee8ae,_0x4b03bf);var _0x48f43e=!![];if(_0x1bc4b4[_0x71df('0x132')]===_0x71df('0x133')){_0x48f43e=![];}var _0x3c7a33=this['channel'][_0x71df('0x134')](_0x2ee8ae,_0x4b03bf,_0x1bc4b4['intKey'],_0x1bc4b4[_0x71df('0x6b')],undefined,_0x48f43e);if(_0x3c7a33['result']!==-0x1){this[_0x71df('0xf')]['noop'](util['format']('google\x20%s\x20file\x20created',_0x42076));var _0x944f19=this['googleASR']['sync'](this,_0x1bc4b4,_0x42076);if(_0x944f19){for(var _0x181f50 in _0x944f19){if(_0x944f19['hasOwnProperty'](_0x181f50)){this[_0x71df('0xf')]['setVariable'](util[_0x71df('0x2b')](_0x71df('0x135'),_0x181f50[_0x71df('0x70')]()),_0x944f19[_0x181f50]);}}return this['channel'][_0x71df('0xae')](util['format'](_0x71df('0x136'),JSON[_0x71df('0x7b')](_0x944f19)));}}return _0x3c7a33;};AGIVertices[_0x71df('0x11')][_0x71df('0x137')]=function(_0x367e17){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x138'),_0x367e17[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x367e17[_0x71df('0x97')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x139'));}if(!this[_0x71df('0x8b')](_0x367e17[_0x71df('0x13a')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x13b'));}var _0x3fcce5=_0x71df('0x13c');var _0x23a892=util[_0x71df('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0x71df('0x11f')](0x4));var _0x30212c=util[_0x71df('0x2b')](_0x71df('0xa1'),_0x23a892,_0x3fcce5);var _0x15aa9b=!![];if(_0x367e17['beep']===_0x71df('0x133')){_0x15aa9b=![];}var _0x16fa56=this[_0x71df('0xf')]['recordFile'](_0x23a892,_0x3fcce5,_0x367e17['intKey'],_0x367e17[_0x71df('0x6b')],undefined,_0x15aa9b);if(_0x16fa56['result']!==-0x1){this[_0x71df('0xf')][_0x71df('0xae')](util['format'](_0x71df('0x13d'),_0x30212c));var _0x4540d7=this[_0x71df('0x96')]['sync'](this,_0x367e17,_0x30212c);if(_0x4540d7){for(var _0x423bf2 in _0x4540d7){if(_0x4540d7[_0x71df('0x99')](_0x423bf2)){this[_0x71df('0xf')][_0x71df('0xa2')](util[_0x71df('0x2b')](_0x71df('0x13e'),_0x423bf2[_0x71df('0x70')]()),_0x4540d7[_0x423bf2]);}}return this[_0x71df('0xf')][_0x71df('0xae')](util['format'](_0x71df('0x13f'),JSON[_0x71df('0x7b')](_0x4540d7)));}}return _0x16fa56;};AGIVertices[_0x71df('0x11')]['gotoc']=function(_0x5d8ecf){logger[_0x71df('0x2e')](util['format'](_0x71df('0x140'),_0x5d8ecf['label']));return this['channel']['continueAt'](_0x5d8ecf[_0x71df('0x141')],_0x5d8ecf['extension'],_0x5d8ecf['priority']);};AGIVertices['prototype']['gotoif']=function(_0x4ce619){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x142'),_0x4ce619[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x4ce619['condition'])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x4ce619,'no\x20condition\x20configured');}try{var _0xa2304e=eval(_0x4ce619['condition'])?_0x71df('0x143'):_0x71df('0x144');this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x145'),_0x4ce619[_0x71df('0x146')],_0xa2304e));return{'code':0xc8,'result':_0xa2304e};}catch(_0xc23850){return{'code':0xc8,'result':_0x71df('0x144')};}};AGIVertices[_0x71df('0x11')][_0x71df('0x147')]=function(_0x6d9494){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x148'),_0x6d9494[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x6d9494[_0x71df('0x149')])){return this['channel'][_0x71df('0x33')](_0x6d9494,'no\x20interval\x20configured');}var _0x599340=this[_0x71df('0x27')]['sync'](this,_0x6d9494[_0x71df('0x149')]);if(!_0x599340){return this[_0x71df('0xf')][_0x71df('0x33')](_0x6d9494,_0x71df('0x14a'));}for(var _0x66eba1=0x0;_0x66eba1<_0x599340[_0x71df('0x9e')];_0x66eba1+=0x1){var _0x26c24e=this[_0x71df('0xf')][_0x71df('0x12')](util[_0x71df('0x2b')](_0x71df('0x14b'),_0x599340[_0x66eba1]));if(_0x26c24e[_0x71df('0xa7')]===-0x1){return _0x26c24e;}logger['info'](util[_0x71df('0x2b')](_0x71df('0x14c'),_0x599340[_0x66eba1],_0x26c24e[_0x71df('0xa5')]));if(_0x26c24e['extra']===_0x71df('0x143')){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('IFTIME\x20%s\x20%s',_0x599340[_0x66eba1],'true'));this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')]('IFTIME\x20%s\x20%s',_0x599340[_0x66eba1],'true'));return{'code':0xc8,'result':_0x71df('0x143')};}else{logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x14c'),_0x599340[_0x66eba1],'false'));this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('IFTIME\x20%s\x20%s',_0x599340[_0x66eba1],_0x71df('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x71df('0x11')][_0x71df('0x14d')]=function(_0x1a7ee6){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x14e'),_0x1a7ee6[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0x14d')]();};AGIVertices[_0x71df('0x11')][_0x71df('0x14f')]=function(_0x1e8abb){logger[_0x71df('0x2e')](util['format'](_0x71df('0x150'),_0x1e8abb[_0x71df('0xad')]));if(!this['isConfigured'](_0x1e8abb['key'])){return this[_0x71df('0xf')]['noop'](_0x71df('0x151'));}var _0x4fbf10=_0x71df('0x13c');var _0x1d5493=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x71df('0x11f')](0x4));var _0x56eab3=util['format'](_0x71df('0xa1'),_0x1d5493,_0x4fbf10);var _0x424c90=!![];if(_0x1e8abb['beep']===_0x71df('0x133')){_0x424c90=![];}var _0x43d2ab=this[_0x71df('0xf')]['recordFile'](_0x1d5493,_0x4fbf10,_0x1e8abb[_0x71df('0x152')],_0x1e8abb[_0x71df('0x6b')],undefined,_0x424c90);if(_0x43d2ab[_0x71df('0xa7')]!==-0x1){this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x153'),_0x56eab3));var _0x5a7622=this['ispeechASR'][_0x71df('0x76')](this,_0x1e8abb,_0x56eab3);if(_0x5a7622){for(var _0x2632c4 in _0x5a7622){if(_0x5a7622[_0x71df('0x99')](_0x2632c4)){this[_0x71df('0xf')][_0x71df('0xa2')](util['format']('ISPEECH_ASR_%s',_0x2632c4['toUpperCase']()),_0x5a7622[_0x2632c4]);}}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x154'),JSON[_0x71df('0x7b')](_0x5a7622)));}}return _0x43d2ab;};AGIVertices[_0x71df('0x11')]['ispeechtts']=function(_0x3df894){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x155'),_0x3df894[_0x71df('0xad')]));if(!this['isConfigured'](_0x3df894[_0x71df('0x88')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x151'));}if(!this[_0x71df('0x8b')](_0x3df894[_0x71df('0x5f')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xaf'));}this['channel']['noop'](util['format'](_0x71df('0x156'),_0x3df894[_0x71df('0x5f')]));var _0x188152=this[_0x71df('0x87')][_0x71df('0x76')](this,_0x3df894);if(_0x188152){this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0x153'),_0x188152));var _0x4cef1d=this[_0x71df('0xf')][_0x71df('0x105')](_0x188152,_0x3df894[_0x71df('0x152')]);try{fs[_0x71df('0x106')](_0x188152+_0x71df('0x107'));}catch(_0x204c8d){logger[_0x71df('0x33')](_0x204c8d);}return _0x4cef1d;}return this[_0x71df('0xf')][_0x71df('0x33')](_0x3df894,_0x71df('0x157'));};AGIVertices[_0x71df('0x11')][_0x71df('0x158')]=function(_0x3dd61b){logger['info'](util[_0x71df('0x2b')](_0x71df('0x159'),_0x3dd61b['label']));if(!this[_0x71df('0x8b')](_0x3dd61b[_0x71df('0x15a')])){return this['channel'][_0x71df('0x33')](_0x3dd61b,_0x71df('0x15b'));}logger[_0x71df('0x2e')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x71df('0xf')][_0x71df('0x3a')],_0x3dd61b[_0x71df('0x15a')]));var _0x14310d=this[_0x71df('0x56')]['sync'](this,_0x3dd61b['findBy']);if(_0x14310d){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x15c'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x3dd61b[_0x71df('0x15a')]));this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x3dd61b[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x15d')};}else{logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x15e'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x3dd61b[_0x71df('0x15a')]));this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x3dd61b[_0x71df('0x15a')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x71df('0x11')]['logout']=function(_0x644b3a){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x15f'),_0x644b3a[_0x71df('0xad')]));if(!this['isConfigured'](_0x644b3a[_0x71df('0x15a')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x644b3a,'no\x20find\x20by\x20configured');}logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x160'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x644b3a[_0x71df('0x15a')]));var _0x3bbeed=this['agentLogout'][_0x71df('0x76')](this,_0x644b3a[_0x71df('0x15a')]);if(_0x3bbeed){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x15c'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x644b3a['findBy']));this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x644b3a[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x15d')};}else{logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x71df('0x3a')],_0x644b3a[_0x71df('0x15a')]));this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x15e'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x644b3a[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x161')};}};AGIVertices[_0x71df('0x11')][_0x71df('0x162')]=function(_0x2b3a0d){logger[_0x71df('0x2e')](util['format'](_0x71df('0x163'),_0x2b3a0d['label']));if(!this[_0x71df('0x8b')](_0x2b3a0d[_0x71df('0x164')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x2b3a0d,_0x71df('0x165'));}this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x166'),_0x2b3a0d[_0x71df('0x164')]));var _0x135191=eval(_0x2b3a0d[_0x71df('0x164')]);if(!this[_0x71df('0x8b')](_0x2b3a0d['variable_id'])){return this[_0x71df('0xf')][_0x71df('0xae')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x38aa69=this[_0x71df('0x12')][_0x71df('0x76')](this,_0x2b3a0d[_0x71df('0xdc')]);if(!_0x38aa69){return this[_0x71df('0xf')][_0x71df('0x33')](_0x2b3a0d,_0x71df('0x11a'));}if(_[_0x71df('0x9d')](_0x135191)){var _0x4a3586=this;_0x135191[_0x71df('0xde')](function(_0xbd21bd,_0x5cd222){_0x4a3586['channel']['setVariable'](util[_0x71df('0x2b')]('%s[%s]',_0x38aa69,_0x5cd222),_0xbd21bd);});return this[_0x71df('0xf')][_0x71df('0xae')](util['format'](_0x71df('0x167'),_0x38aa69));}else{return this[_0x71df('0xf')]['setVariable'](_0x38aa69,_0x135191);}};AGIVertices[_0x71df('0x11')][_0x71df('0xd')]=function(_0x5088b5){logger['info'](util[_0x71df('0x2b')](_0x71df('0x168'),_0x5088b5[_0x71df('0xad')]));if(_0x5088b5[_0x71df('0xaa')]===0x0){return this[_0x71df('0xa9')](_0x5088b5);}_0x5088b5[_0x71df('0xaa')]-=0x1;if(!this[_0x71df('0x8b')](_0x5088b5[_0x71df('0x114')])){return this['channel'][_0x71df('0x33')](_0x5088b5,_0x71df('0x169'));}var _0x5c8b0d=this['getSound'][_0x71df('0x76')](this,_0x5088b5[_0x71df('0x114')]);if(!_0x5c8b0d){return this[_0x71df('0xf')][_0x71df('0x33')](_0x5088b5,_0x71df('0x115'));}var _0x5f2ea4=this[_0x71df('0xf')][_0x71df('0x16a')](_0x5c8b0d,_0x5088b5['response'],_0x5088b5['digit']);var _0xf8ce4a=_0x5f2ea4[_0x71df('0xa7')];if(_0x5f2ea4[_0x71df('0xa7')]===-0x1){this[_0x71df('0x37')][_0x71df('0x76')](this,_0x5088b5,'-1');return _0x5f2ea4;}else if(_0x5f2ea4['extra']===_0x71df('0x6b')){_0x5f2ea4[_0x71df('0xa7')]=_0x5f2ea4[_0x71df('0xa7')]['length']>0x0?_0x5f2ea4[_0x71df('0xa7')]:'t';}else if(_[_0x71df('0x45')](_0x5f2ea4[_0x71df('0xa7')])){_0x5f2ea4[_0x71df('0xa7')]='#';_0xf8ce4a='#';}if(!this[_0x71df('0x8b')](_0x5088b5['variable_id'])){this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0xdd'));}else{var _0x40b1ab=this[_0x71df('0x12')]['sync'](this,_0x5088b5[_0x71df('0xdc')]);if(!_0x40b1ab){return this['channel']['error'](_0x5088b5,_0x71df('0x11a'));}this[_0x71df('0xf')][_0x71df('0xa2')](_0x40b1ab,_0xf8ce4a);}this[_0x71df('0x37')][_0x71df('0x76')](this,_0x5088b5,_0xf8ce4a);return _0x5f2ea4;};AGIVertices[_0x71df('0x11')]['noop']=function(_0x322bcb){logger[_0x71df('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x322bcb[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0xae')](_0x322bcb['output']||_0x322bcb[_0x71df('0xad')]);};AGIVertices['prototype']['pause']=function(_0x34bc21){logger[_0x71df('0x2e')](util['format'](_0x71df('0x16b'),_0x34bc21['label']));if(!this[_0x71df('0x8b')](_0x34bc21[_0x71df('0x15a')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x34bc21,_0x71df('0x15b'));}logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x160'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x34bc21[_0x71df('0x15a')]));var _0x3efb8e=this[_0x71df('0x50')][_0x71df('0x76')](this,_0x34bc21['pause_id']);var _0x4a119d=this['agentPause']['sync'](this,_0x34bc21[_0x71df('0x15a')],_0x3efb8e);if(_0x4a119d){logger[_0x71df('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x34bc21[_0x71df('0x15a')]));this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')]['callerid'],_0x34bc21[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x15d')};}else{logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x34bc21[_0x71df('0x15a')]));this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0x15c'),this[_0x71df('0xf')][_0x71df('0x3a')],_0x34bc21[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x161')};}};AGIVertices[_0x71df('0x11')][_0x71df('0x16c')]=function(_0x3b781f){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x16d'),_0x3b781f[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x3b781f[_0x71df('0x114')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x3b781f,_0x71df('0x169'));}var _0x4f4bd3=this[_0x71df('0x21')]['sync'](this,_0x3b781f['file_id']);if(!_0x4f4bd3){return this[_0x71df('0xf')][_0x71df('0x33')](_0x3b781f,_0x71df('0x115'));}var _0x4b0216=this[_0x71df('0xf')][_0x71df('0x5b')](_0x71df('0x16e'),[_0x4f4bd3,_0x3b781f['opts']]);if(_0x4b0216[_0x71df('0xa7')]===-0x1){return _0x4b0216;}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xc7'),_0x71df('0x16e'),_0x4f4bd3));};AGIVertices[_0x71df('0x11')]['queue']=function(_0x5e2733){logger['info'](util[_0x71df('0x2b')](_0x71df('0x16f'),_0x5e2733[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x5e2733[_0x71df('0x170')])){return this['channel'][_0x71df('0x33')](_0x5e2733,_0x71df('0x171'));}var _0x4b2340='';var _0x3911cb=parseInt(_0x5e2733[_0x71df('0x170')],0xa);if(isNaN(_0x3911cb)){_0x4b2340=_0x5e2733[_0x71df('0x170')];}else{_0x4b2340=this['getVoiceQueue'][_0x71df('0x76')](this,_0x5e2733[_0x71df('0x170')]);if(!_0x4b2340){return this[_0x71df('0xf')][_0x71df('0x33')](_0x5e2733,_0x71df('0x172'));}}var _0xcbf140='';if(this[_0x71df('0x8b')](_0x5e2733[_0x71df('0x114')])){var _0x196e99=this[_0x71df('0x21')]['sync'](this,_0x5e2733[_0x71df('0x114')]);if(_0x196e99){_0xcbf140=_0x196e99;}}this['createSquareDetailsReport'][_0x71df('0x76')](this,_0x5e2733,_0x4b2340);if(_0x5e2733['opts'][_0x71df('0x173')]('x')<0x0){_0x5e2733[_0x71df('0xe7')]+='x';}if(_0x5e2733[_0x71df('0xe7')][_0x71df('0x173')]('X')<0x0){_0x5e2733[_0x71df('0xe7')]+='X';}this[_0x71df('0xf')][_0x71df('0xa2')](_0x71df('0x174'),_0x4b2340?_0x4b2340[_0x71df('0x175')]():'');var _0x278660=this[_0x71df('0xf')]['exec'](_0x71df('0x176'),[_0x4b2340,_0x5e2733[_0x71df('0xe7')],_0x5e2733[_0x71df('0x69')],_0xcbf140,_0x5e2733[_0x71df('0x6b')],_0x5e2733[_0x71df('0x8')],_0x5e2733['macro'],_0x5e2733['gosub'],'',_0x5e2733[_0x71df('0x177')]]);if(_0x278660[_0x71df('0xa7')]===-0x1){return _0x278660;}return this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xc7'),_0x71df('0x176'),_0x4b2340));};AGIVertices['prototype']['record']=function(_0x1df86b){logger['info'](util['format'](_0x71df('0x178'),_0x1df86b[_0x71df('0xad')]));var _0x98b79b=_0x1df86b['recordingFormat']||_0x71df('0x13c');var _0x54ed1d=util['format'](_0x71df('0x179'),this[_0x71df('0xf')]['uniqueid'],rs['generate'](0x5));var _0x2c4195=util[_0x71df('0x2b')](_0x71df('0x17a'),FILES_PATH,_0x54ed1d,_0x98b79b);var _0x283aa7=util[_0x71df('0x2b')](_0x71df('0x131'),FILES_PATH,_0x54ed1d);this['createSquareRecording'][_0x71df('0x76')](this,_0x1df86b,_0x54ed1d,_0x2c4195);this[_0x71df('0xf')][_0x71df('0xa2')](_0x71df('0x17b'),_0x54ed1d);logger[_0x71df('0x2e')](_0x71df('0x17c'),_0x283aa7,_0x98b79b,_0x1df86b[_0x71df('0x17d')],_0x1df86b[_0x71df('0x6b')]);return this[_0x71df('0xf')]['recordFile'](_0x283aa7,_0x98b79b,_0x1df86b[_0x71df('0x17d')],_0x1df86b[_0x71df('0x6b')],undefined,!![]);};AGIVertices[_0x71df('0x11')]['restapi']=function(_0x555793){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x555793['label']));if(!this[_0x71df('0x8b')](_0x555793[_0x71df('0x69')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x17e'));}var _0x3204f1=this[_0x71df('0x68')][_0x71df('0x76')](this,_0x555793);logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Response:',util['inspect'](_0x3204f1,{'showHidden':![],'depth':null})));if(!this[_0x71df('0x8b')](_0x555793[_0x71df('0xdc')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x17f'));}var _0x6e80d9=this[_0x71df('0x12')][_0x71df('0x76')](this,_0x555793['variable_id']);if(!_0x6e80d9){return this[_0x71df('0xf')][_0x71df('0x33')](_0x555793,_0x71df('0x11a'));}this[_0x71df('0xf')][_0x71df('0xa2')](util[_0x71df('0x2b')](_0x71df('0x180'),_0x6e80d9),_0x3204f1[_0x71df('0x7d')]?_0x3204f1[_0x71df('0x7d')]:'200');this[_0x71df('0xf')]['setVariable'](util['format'](_0x71df('0x181'),_0x6e80d9),_0x3204f1['statusMessage']?_0x3204f1[_0x71df('0x182')]:'OK');if(_0x3204f1[_0x71df('0x7a')]){try{this['saveRestApiResult'](_0x3204f1[_0x71df('0x7a')],_0x6e80d9);}catch(_0x2298ab){logger['error'](util[_0x71df('0x2b')](_0x71df('0x183'),_0x6e80d9));}}return this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0xe0'),_0x6e80d9));};AGIVertices[_0x71df('0x11')]['saydigits']=function(_0x5d241e){logger[_0x71df('0x2e')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5d241e['label']));return this[_0x71df('0xf')]['sayDigits'](_0x5d241e['digits'][_0x71df('0x5c')](/\s+/g,''),_0x5d241e['escape_digits']);};AGIVertices[_0x71df('0x11')][_0x71df('0x184')]=function(_0x1274b6){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x185'),_0x1274b6[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0x186')](_0x1274b6['number']['replace'](/\s+/g,''),_0x1274b6[_0x71df('0x17d')]);};AGIVertices[_0x71df('0x11')][_0x71df('0x187')]=function(_0x2fae90){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x188'),_0x2fae90[_0x71df('0xad')]));return this[_0x71df('0xf')][_0x71df('0x189')](_0x2fae90['text'],_0x2fae90[_0x71df('0x17d')]);};AGIVertices['prototype'][_0x71df('0x18a')]=function(_0x42b189){logger['info'](util[_0x71df('0x2b')](_0x71df('0x18b'),_0x42b189[_0x71df('0xad')]));if(!this['isConfigured'](_0x42b189[_0x71df('0x18c')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x18d'));}var _0x3e7adf=this[_0x71df('0x25')][_0x71df('0x76')](this,_0x42b189['account_id']);if(!_0x3e7adf||!_0x3e7adf['Smtp']){return this[_0x71df('0xf')][_0x71df('0x33')](_0x42b189,_0x71df('0x18e'));}var _0x151bbe={'from':util['format'](_0x71df('0x18f'),_0x3e7adf[_0x71df('0x15')],_0x3e7adf[_0x71df('0x190')]||_0x3e7adf[_0x71df('0x191')]['user']),'to':_0x42b189['to']||'','cc':_0x42b189['cc']||'','bcc':_0x42b189['bcc']||'','subject':_0x42b189[_0x71df('0x192')],'html':_0x42b189[_0x71df('0x5f')],'text':_0x42b189[_0x71df('0x5f')]};if(this[_0x71df('0x8b')](_0x42b189[_0x71df('0x193')])){}logger[_0x71df('0x194')](_0x71df('0x195'),JSON[_0x71df('0x7b')](_0x151bbe));this[_0x71df('0x37')][_0x71df('0x76')](this,_0x42b189,_0x42b189[_0x71df('0x18c')]);this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x3e7adf[_0x71df('0x15')]));this[_0x71df('0x26')][_0x71df('0x76')](this,_0x3e7adf['smtpOptions'],_0x151bbe);return this['channel'][_0x71df('0xae')](_0x71df('0x196'));};AGIVertices[_0x71df('0x11')][_0x71df('0x197')]=function(_0x57ed2a){logger['info'](util[_0x71df('0x2b')](_0x71df('0x198'),_0x57ed2a[_0x71df('0xad')]));return this[_0x71df('0xf')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x71df('0x11')]['sendSMS']=function(_0xa9ff14){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xa9ff14[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0xa9ff14[_0x71df('0x199')])){return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x19a'));}var _0x2eb91d=this['getSmsAccount'][_0x71df('0x76')](this,_0xa9ff14[_0x71df('0x199')]);if(!_0x2eb91d){return this[_0x71df('0xf')][_0x71df('0x33')](_0xa9ff14,_0x71df('0x19b'));}var _0x2048d2={'body':_0xa9ff14[_0x71df('0x19c')],'phone':_0xa9ff14['to']||'','SmsAccountId':_0x2eb91d['id']};logger['debug'](_0x71df('0x19d'),JSON[_0x71df('0x7b')](_0x2048d2));this[_0x71df('0x37')][_0x71df('0x76')](this,_0xa9ff14,_0xa9ff14[_0x71df('0x199')]);this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x19e'),_0x2eb91d[_0x71df('0x15')]));this[_0x71df('0x36')]['sync'](this,_0x2048d2);return this[_0x71df('0xf')][_0x71df('0xae')](_0x71df('0x19f'));};AGIVertices['prototype']['set']=function(_0x2b5650){logger[_0x71df('0x2e')](util['format'](_0x71df('0x1a0'),_0x2b5650[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x2b5650[_0x71df('0xdc')])){return this['channel'][_0x71df('0x33')](_0x2b5650,_0x71df('0x1a1'));}var _0x584f2f=this[_0x71df('0x12')][_0x71df('0x76')](this,_0x2b5650['variable_id']);if(!_0x584f2f){return this[_0x71df('0xf')]['error'](_0x2b5650,'no\x20variable\x20found');}return this[_0x71df('0xf')]['setVariable'](_0x584f2f,_0x2b5650[_0x71df('0x1a2')]);};AGIVertices[_0x71df('0x11')][_0x71df('0x1a3')]=function(_0x3cb3a0){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x1a4'),_0x3cb3a0[_0x71df('0xad')]));this['channel'][_0x71df('0xae')](_0x71df('0x1a5'));if(_0x3cb3a0[_0x71df('0xbb')]===_0x71df('0x1a6')){this['channel'][_0x71df('0xae')]('Answer');return this[_0x71df('0xf')][_0x71df('0xbb')]();}return this['channel'][_0x71df('0xae')](_0x71df('0x1a7'));};AGIVertices[_0x71df('0x11')][_0x71df('0x1a8')]=function(_0x2a39a5){logger['info'](util[_0x71df('0x2b')](_0x71df('0x1a9'),_0x2a39a5[_0x71df('0xad')]));if(!this[_0x71df('0x8b')](_0x2a39a5[_0x71df('0x1aa')])){return this[_0x71df('0xf')][_0x71df('0x33')](_0x2a39a5,_0x71df('0x1ab'));}var _0x52aece=this['getSquareProject'][_0x71df('0x76')](this,_0x2a39a5[_0x71df('0x1aa')]);if(!this[_0x71df('0x8b')](_0x52aece)){return this[_0x71df('0xf')][_0x71df('0x33')](_0x2a39a5,util[_0x71df('0x2b')](_0x71df('0x1ac'),_0x2a39a5[_0x71df('0x1aa')]));}if(_0x52aece===this[_0x71df('0xf')][_0x71df('0x39')]){return this[_0x71df('0xf')][_0x71df('0x33')](_0x2a39a5,_0x71df('0x1ad'));}this[_0x71df('0x37')][_0x71df('0x76')](this,_0x2a39a5,_0x52aece);var _0x569003=this[_0x71df('0xf')][_0x71df('0x5b')](_0x71df('0x1ae'),util[_0x71df('0x2b')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x71df('0x8')]['host']||_0x71df('0x1af'),_0x52aece,this['channel'][_0x71df('0x39')]));if(_0x569003['result']===-0x1){return _0x569003;}return this[_0x71df('0xf')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x71df('0x1ae'),_0x52aece));};AGIVertices[_0x71df('0x11')][_0x71df('0x1b0')]=function(_0x44d48e){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x1b1'),_0x44d48e['label']));var _0x4e65cb=this['shellCommand'][_0x71df('0x76')](this,_0x44d48e[_0x71df('0xb9')]);this[_0x71df('0x37')]['sync'](this,_0x44d48e,_0x44d48e[_0x71df('0xb9')]);if(this[_0x71df('0x8b')](_0x44d48e['variable_id'])){var _0x517ee0=this['getVariable'][_0x71df('0x76')](this,_0x44d48e[_0x71df('0xdc')]);if(_0x517ee0){this['channel'][_0x71df('0xa2')](_0x517ee0,_0x4e65cb);return this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0x1b2'),_0x44d48e[_0x71df('0xb9')],_0x517ee0));}}return this['channel'][_0x71df('0xae')](util['format'](_0x71df('0x1b3'),_0x44d48e[_0x71df('0xb9')]));};AGIVertices[_0x71df('0x11')][_0x71df('0x1b4')]=function(_0x3e122c){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x1b5'),_0x3e122c['label']));_0x3e122c[_0x71df('0x5f')]=_0x3e122c[_0x71df('0x5f')][_0x71df('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3e122c['apiKey'])){return this[_0x71df('0xf')]['noop']('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x3e122c[_0x71df('0x5f')])){return this[_0x71df('0xf')]['noop'](_0x71df('0xaf'));}this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0x1b6'),_0x3e122c[_0x71df('0x5f')]));var _0x739d8b=this[_0x71df('0x5d')]['sync'](this,_0x3e122c);if(_0x739d8b){this[_0x71df('0xf')]['noop'](util['format'](_0x71df('0x1b7'),_0x739d8b));var _0x2f63f1=this[_0x71df('0xf')][_0x71df('0x105')](_0x739d8b);try{fs[_0x71df('0x106')](_0x739d8b+_0x71df('0x107'));}catch(_0x57ab2d){logger[_0x71df('0x33')](_0x57ab2d);}return _0x2f63f1;}return this[_0x71df('0xf')][_0x71df('0x33')](_0x3e122c,_0x71df('0x1b8'));};AGIVertices[_0x71df('0x11')]['tts']=function(_0x53b66a){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x1b9'),_0x53b66a[_0x71df('0xad')]));_0x53b66a[_0x71df('0x5f')]=_0x53b66a['text'][_0x71df('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x71df('0x8b')](_0x53b66a[_0x71df('0x5f')])){return this[_0x71df('0xf')]['noop'](_0x71df('0xaf'));}this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')]('Trying\x20Google\x20TTS\x20%s',_0x53b66a[_0x71df('0x5f')]));var _0x5a5382=this[_0x71df('0x66')][_0x71df('0x76')](this,_0x53b66a);if(_0x5a5382){this['channel']['noop'](util[_0x71df('0x2b')](_0x71df('0x1ba'),_0x5a5382));var _0x12833b=this[_0x71df('0xf')]['streamFile'](_0x5a5382);try{fs[_0x71df('0x106')](_0x5a5382+_0x71df('0x107'));}catch(_0x1707be){logger[_0x71df('0x33')](_0x1707be);}return _0x12833b;}return this[_0x71df('0xf')][_0x71df('0x33')](_0x53b66a,_0x71df('0x1bb'));};AGIVertices['prototype'][_0x71df('0x1bc')]=function(_0x14bd3b){logger['info'](util[_0x71df('0x2b')](_0x71df('0x1bd'),_0x14bd3b[_0x71df('0xad')]));if(!this['isConfigured'](_0x14bd3b[_0x71df('0x15a')])){return this['channel']['error'](_0x14bd3b,_0x71df('0x15b'));}logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x160'),this[_0x71df('0xf')]['callerid'],_0x14bd3b[_0x71df('0x15a')]));var _0xd86181=this[_0x71df('0x54')][_0x71df('0x76')](this,_0x14bd3b[_0x71df('0x15a')]);if(_0xd86181){logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x14bd3b['findBy']));this['channel'][_0x71df('0xae')](util[_0x71df('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x14bd3b[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x15d')};}else{logger[_0x71df('0x2e')](util[_0x71df('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x71df('0xf')][_0x71df('0x3a')],_0x14bd3b[_0x71df('0x15a')]));this[_0x71df('0xf')][_0x71df('0xae')](util[_0x71df('0x2b')](_0x71df('0x15e'),this['channel'][_0x71df('0x3a')],_0x14bd3b[_0x71df('0x15a')]));return{'code':0xc8,'result':_0x71df('0x161')};}};AGIVertices[_0x71df('0x11')][_0x71df('0x1be')]=function(_0x4dd510){logger['info'](util[_0x71df('0x2b')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4dd510[_0x71df('0xad')]));var _0x273ecb=this[_0x71df('0xf')][_0x71df('0x5b')]('VOICEMAIL',[_0x4dd510[_0x71df('0x1bf')],_0x4dd510['options']]);if(_0x273ecb[_0x71df('0xa7')]===-0x1){return _0x273ecb;}return this[_0x71df('0xf')]['noop'](util[_0x71df('0x2b')](_0x71df('0xc7'),_0x71df('0x1c0'),_0x4dd510['mailbox']));};AGIVertices[_0x71df('0x11')][_0x71df('0x1c1')]=function(_0x42950e){logger[_0x71df('0x2e')](util[_0x71df('0x2b')](_0x71df('0x1c2'),_0x42950e['label']));if(!this['isConfigured'](_0x42950e[_0x71df('0xdc')])){return this[_0x71df('0xf')]['error'](_0x42950e,'no\x20variable\x20selected');}var _0xfc56f0=this['getVariable'][_0x71df('0x76')](this,_0x42950e['variable_id']);if(!_0xfc56f0){return this['channel']['error'](_0x42950e,_0x71df('0x11a'));}var _0x52b1a3=this[_0x71df('0xf')][_0x71df('0x12')](_0xfc56f0);return{'code':0xc8,'result':_0x52b1a3[_0x71df('0xa5')]?_0x52b1a3['extra']:'-'};};String[_0x71df('0x11')][_0x71df('0xa4')]=function(_0x1d43b5,_0x49be18){return this[_0x71df('0x1c3')](_0x1d43b5)[_0x71df('0x1c4')](_0x49be18);};module[_0x71df('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7d0aaf4..470a2d7 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 _0xd8a4=['../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','timer','update','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','interface','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','../rpc/user'];(function(_0x43807a,_0x5dbd25){var _0x194193=function(_0x1f43e0){while(--_0x1f43e0){_0x43807a['push'](_0x43807a['shift']());}};_0x194193(++_0x5dbd25);}(_0xd8a4,0xff));var _0x4d8a=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xd8a4[_0x47e7cb];return _0x2a8874;};'use strict';var util=require(_0x4d8a('0x0'));var _=require(_0x4d8a('0x1'));var moment=require(_0x4d8a('0x2'));var ami=require(_0x4d8a('0x3'));var logger=require(_0x4d8a('0x4'))('acw');var RpcUser=require(_0x4d8a('0x5'));var RpcVoiceAgentReport=require(_0x4d8a('0x6'));function Acw(_0x3c0ae5){this[_0x4d8a('0x7')]=_0x3c0ae5[_0x4d8a('0x7')];this[_0x4d8a('0x8')]=_0x3c0ae5[_0x4d8a('0x8')];this[_0x4d8a('0x9')]=_0x3c0ae5[_0x4d8a('0x9')];this[_0x4d8a('0xa')]={};ami['on'](_0x4d8a('0xb'),this['syncAgentConnect'][_0x4d8a('0xc')](this));ami['on'](_0x4d8a('0xd'),this['syncHangupRequest'][_0x4d8a('0xc')](this));ami['on'](_0x4d8a('0xe'),this[_0x4d8a('0xf')][_0x4d8a('0xc')](this));ami['on'](_0x4d8a('0x10'),this[_0x4d8a('0x11')]['bind'](this));ami['on'](_0x4d8a('0x12'),this['syncAttendedTransfer'][_0x4d8a('0xc')](this));ami['on'](_0x4d8a('0x13'),this[_0x4d8a('0x14')][_0x4d8a('0xc')](this));ami['on'](_0x4d8a('0x15'),this[_0x4d8a('0x16')]['bind'](this));}function getDiff(_0x2b03be){var _0x7d8d7f=moment()['milliseconds'](0x0);var _0x5134a0=moment(_0x2b03be)[_0x4d8a('0x17')](0x0);return _0x7d8d7f['diff'](_0x5134a0,_0x4d8a('0x18'));}Acw[_0x4d8a('0x19')][_0x4d8a('0x1a')]=function(_0x249d48){try{var _0x10739c=this;var _0x2ac661=this['channels'][_0x249d48]['interface'];var _0x4fcfb7=this[_0x4d8a('0xa')][_0x249d48]['queue'];var _0x334b07=this['voiceQueues'][_0x4fcfb7];var _0x11beab=![];var _0x8e2a=_0x4d8a('0x1b');if(_0x334b07[_0x4d8a('0x1c')]){if(_0x334b07[_0x4d8a('0x1d')][_0x4d8a('0x1e')]){_0x11beab=!![];_0x8e2a=_0x334b07['mandatoryDispositionPause']['name'];}}ami[_0x4d8a('0x1f')]({'action':_0x4d8a('0x20'),'interface':_0x2ac661,'paused':!![],'reason':_0x8e2a})['then'](function(_0x3c2e7d){if(_0x10739c[_0x4d8a('0x8')][_0x2ac661]){return RpcUser[_0x4d8a('0x21')](_0x10739c[_0x4d8a('0x8')][_0x2ac661]['id'])[_0x4d8a('0x22')](function(_0x21bb9a){if(_0x21bb9a&&!_0x21bb9a['voicePause']){logger[_0x4d8a('0x23')](_0x4d8a('0x24'),_0x249d48,_0x2ac661,_0x4fcfb7);var _0x3d8b78=_0x10739c['channels'][_0x249d48][_0x4d8a('0x25')]&&_0x10739c['channels'][_0x249d48][_0x4d8a('0x26')]?_0x10739c[_0x4d8a('0xa')][_0x249d48][_0x4d8a('0x26')]:_0x249d48;return RpcUser[_0x4d8a('0x27')](_0x10739c['agents'][_0x2ac661],_0x8e2a,_0x3d8b78)[_0x4d8a('0x22')](function(_0x307bfb){if(!_0x11beab){_0x10739c['timers'][_0x2ac661]={};logger[_0x4d8a('0x23')](_0x4d8a('0x28'),_0x249d48,_0x10739c[_0x4d8a('0x7')][_0x4fcfb7][_0x4d8a('0x29')],_0x2ac661,_0x4fcfb7);_0x10739c['timers'][_0x2ac661]['timer']=setTimeout(_0x10739c[_0x4d8a('0x2a')][_0x4d8a('0xc')](_0x10739c,_0x2ac661),_0x10739c['voiceQueues'][_0x4fcfb7][_0x4d8a('0x29')]*0x3e8);_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2b')]=moment()['format'](_0x4d8a('0x2c'));_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2d')]=_0x249d48;_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2e')]=_0x4fcfb7;_0x10739c[_0x4d8a('0x9')][_0x2ac661]['updateAcw']=function(){var _0x59a237=getDiff(_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2b')]);clearTimeout(_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2f')]);_0x10739c[_0x4d8a('0x9')][_0x2ac661][_0x4d8a('0x2f')]=![];RpcVoiceAgentReport[_0x4d8a('0x30')]({'acwtime':_0x59a237},_0x10739c['timers'][_0x2ac661]['uniqueid'],_0x2ac661)[_0x4d8a('0x22')](function(_0x4e1030){logger[_0x4d8a('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x249d48,_0x59a237,_0x4e1030);})[_0x4d8a('0x31')](function(_0x4c28d8){logger[_0x4d8a('0x32')](_0x4d8a('0x33'),_0x249d48,_0x4c28d8);});delete _0x10739c[_0x4d8a('0x9')][_0x2ac661];};}});}else{logger['info'](_0x4d8a('0x34'),_0x249d48,_0x2ac661,_0x4fcfb7);}});}})[_0x4d8a('0x31')](function(_0x180956){logger[_0x4d8a('0x32')](_0x4d8a('0x28'),_0x249d48,_0x10739c[_0x4d8a('0x7')][_0x4fcfb7][_0x4d8a('0x29')],_0x2ac661,_0x4fcfb7);})[_0x4d8a('0x35')](function(){delete _0x10739c[_0x4d8a('0xa')][_0x249d48];});}catch(_0x15108d){logger[_0x4d8a('0x32')](_0x4d8a('0x36'),_0x15108d[_0x4d8a('0x37')]);}};Acw['prototype']['stopAcw']=function(_0x585f58){try{var _0xef6142=this;if(_0xef6142[_0x4d8a('0x9')][_0x585f58]){_0xef6142[_0x4d8a('0x9')][_0x585f58][_0x4d8a('0x2f')]=![];var _0x49d76a=_0xef6142[_0x4d8a('0x9')][_0x585f58][_0x4d8a('0x2d')];var _0x4583bd=_0xef6142['timers'][_0x585f58][_0x4d8a('0x2e')];var _0x591f07=_0xef6142[_0x4d8a('0x7')][_0x4583bd][_0x4d8a('0x29')];logger[_0x4d8a('0x23')](_0x4d8a('0x38'),_0x49d76a,_0x585f58);RpcUser['saveUnpause'](this[_0x4d8a('0x8')][_0x585f58]);RpcVoiceAgentReport[_0x4d8a('0x30')]({'acwtime':_0x591f07,'agentacw':!![]},_0x49d76a,_0x585f58)[_0x4d8a('0x22')](function(_0x173902){logger[_0x4d8a('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x49d76a,_0x591f07,_0x173902);})[_0x4d8a('0x31')](function(_0x525dcf){logger['error'](_0x4d8a('0x33'),_0x49d76a,_0x525dcf);});}else{logger[_0x4d8a('0x32')](_0x4d8a('0x39'),_0x585f58);if(_0xef6142[_0x4d8a('0x9')]){logger[_0x4d8a('0x23')](_0x4d8a('0x3a'),JSON[_0x4d8a('0x3b')](_0xef6142[_0x4d8a('0x9')]));}}}catch(_0x105b1b){logger[_0x4d8a('0x32')](_0x4d8a('0x3c'),_0x105b1b[_0x4d8a('0x37')]);}};Acw[_0x4d8a('0x19')][_0x4d8a('0x3d')]=function(_0x444ce5){try{if(this[_0x4d8a('0x7')][_0x444ce5[_0x4d8a('0x2e')]]&&(this[_0x4d8a('0x7')][_0x444ce5['queue']][_0x4d8a('0x3e')]||this[_0x4d8a('0x7')][_0x444ce5[_0x4d8a('0x2e')]][_0x4d8a('0x1c')])){if(this[_0x4d8a('0x8')][_0x444ce5[_0x4d8a('0x3f')]]){this[_0x4d8a('0xa')][_0x444ce5[_0x4d8a('0x2d')]]={'queue':_0x444ce5[_0x4d8a('0x2e')],'interface':_0x444ce5[_0x4d8a('0x3f')],'destlinkedid':_0x444ce5[_0x4d8a('0x26')]};}}}catch(_0x1c7850){logger[_0x4d8a('0x32')](_0x4d8a('0x40'),_0x1c7850['message']);}};Acw[_0x4d8a('0x19')][_0x4d8a('0x16')]=function(_0x3fd838){try{if(this[_0x4d8a('0x7')][_0x3fd838[_0x4d8a('0x2e')]]&&(this[_0x4d8a('0x7')][_0x3fd838[_0x4d8a('0x2e')]]['acw']||this[_0x4d8a('0x7')][_0x3fd838[_0x4d8a('0x2e')]]['mandatoryDisposition'])){if(this[_0x4d8a('0x8')][_0x3fd838[_0x4d8a('0x3f')]]){this[_0x4d8a('0xa')][_0x3fd838[_0x4d8a('0x2d')]]={'queue':_0x3fd838[_0x4d8a('0x2e')],'interface':_0x3fd838[_0x4d8a('0x3f')]};}}}catch(_0x29d282){logger[_0x4d8a('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x29d282['message']);}};Acw[_0x4d8a('0x19')]['syncHangupRequest']=function(_0x2f7056){try{if(this[_0x4d8a('0xa')][_0x2f7056[_0x4d8a('0x2d')]]&&_[_0x4d8a('0x41')](this[_0x4d8a('0xa')][_0x2f7056['uniqueid']][_0x4d8a('0x25')])){logger[_0x4d8a('0x23')](_0x4d8a('0x42'),_0x2f7056[_0x4d8a('0x2d')]);this[_0x4d8a('0x1a')](_0x2f7056[_0x4d8a('0x2d')]);}else if(this['channels'][_0x2f7056['linkedid']]&&_[_0x4d8a('0x41')](this[_0x4d8a('0xa')][_0x2f7056[_0x4d8a('0x43')]]['attended'])){logger[_0x4d8a('0x23')](_0x4d8a('0x44'),_0x2f7056['linkedid']);this[_0x4d8a('0x1a')](_0x2f7056[_0x4d8a('0x43')]);}}catch(_0x2dec47){logger[_0x4d8a('0x32')](_0x4d8a('0x45'),_0x2dec47[_0x4d8a('0x37')]);}};Acw[_0x4d8a('0x19')][_0x4d8a('0xf')]=function(_0xa8b6fa){try{if(this['channels'][_0xa8b6fa[_0x4d8a('0x2d')]]&&this[_0x4d8a('0xa')][_0xa8b6fa[_0x4d8a('0x2d')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0xa8b6fa[_0x4d8a('0x2d')]);this[_0x4d8a('0x1a')](_0xa8b6fa[_0x4d8a('0x2d')]);}else if(this[_0x4d8a('0xa')][_0xa8b6fa['linkedid']]&&this['channels'][_0xa8b6fa[_0x4d8a('0x43')]]['attended']){logger[_0x4d8a('0x23')](_0x4d8a('0x46'),_0xa8b6fa[_0x4d8a('0x43')]);this[_0x4d8a('0x1a')](_0xa8b6fa[_0x4d8a('0x43')]);}}catch(_0x5720b3){logger[_0x4d8a('0x32')](_0x4d8a('0x47'),_0x5720b3[_0x4d8a('0x37')]);}};Acw[_0x4d8a('0x19')]['syncAttendedTransfer']=function(_0x1600dc){try{if(!_['isNil'](this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x48')]])){this[_0x4d8a('0x1a')](_0x1600dc[_0x4d8a('0x48')]);if(this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x49')]]){this['channels'][_0x1600dc[_0x4d8a('0x49')]][_0x4d8a('0x25')]=!![];this['channels'][_0x1600dc[_0x4d8a('0x4a')]]=this['channels'][_0x1600dc[_0x4d8a('0x49')]];delete this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x49')]];}}else if(!_['isNil'](this['channels'][_0x1600dc['transfertargetuniqueid']])){this['startAcw'](_0x1600dc[_0x4d8a('0x4a')]);if(this['channels'][_0x1600dc['origtransfereruniqueid']]){this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x4b')]]['attended']=!![];this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x48')]]=this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x4b')]];delete this[_0x4d8a('0xa')][_0x1600dc[_0x4d8a('0x4b')]];}}}catch(_0x8cc0e0){logger['error'](_0x4d8a('0x4c'),_0x8cc0e0[_0x4d8a('0x37')]);}};Acw[_0x4d8a('0x19')][_0x4d8a('0x14')]=function(_0x10c52b){try{if(this[_0x4d8a('0xa')][_0x10c52b[_0x4d8a('0x4d')]]){logger[_0x4d8a('0x23')](_0x4d8a('0x4e'),JSON[_0x4d8a('0x3b')](_0x10c52b[_0x4d8a('0x4d')]));this[_0x4d8a('0x1a')](_0x10c52b[_0x4d8a('0x4d')]);}else if(this[_0x4d8a('0xa')][_0x10c52b[_0x4d8a('0x4f')]]){logger[_0x4d8a('0x23')](_0x4d8a('0x50'),JSON['stringify'](_0x10c52b[_0x4d8a('0x4f')]));this[_0x4d8a('0x1a')](_0x10c52b[_0x4d8a('0x4f')]);}}catch(_0x4d2d41){logger[_0x4d8a('0x32')](_0x4d8a('0x51'),_0x4d2d41['message']);}};Acw[_0x4d8a('0x19')][_0x4d8a('0x11')]=function(_0x5fc412){try{if(this[_0x4d8a('0x7')][_0x5fc412[_0x4d8a('0x2e')]]&&this[_0x4d8a('0x7')][_0x5fc412[_0x4d8a('0x2e')]][_0x4d8a('0x52')]==='all'){if(this[_0x4d8a('0x8')][_0x5fc412[_0x4d8a('0x3f')]]){logger[_0x4d8a('0x23')](_0x4d8a('0x53'),_0x5fc412[_0x4d8a('0x2d')],_0x5fc412['interface'],_0x5fc412[_0x4d8a('0x2e')]);return RpcUser[_0x4d8a('0x27')](this['agents'][_0x5fc412[_0x4d8a('0x3f')]],_0x4d8a('0x54'),_0x5fc412[_0x4d8a('0x2d')]);}}}catch(_0x5a3713){logger[_0x4d8a('0x32')](_0x4d8a('0x55'),_0x5a3713['message']);}};module[_0x4d8a('0x56')]=Acw; \ No newline at end of file +var _0x2b3d=['then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','acwTimeout','timers','timer','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action'];(function(_0x47d804,_0x5cc88f){var _0x284c47=function(_0x271c22){while(--_0x271c22){_0x47d804['push'](_0x47d804['shift']());}};_0x284c47(++_0x5cc88f);}(_0x2b3d,0x8b));var _0xd2b3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2b3d[_0x57b54c];return _0x59cc19;};'use strict';var util=require('util');var _=require(_0xd2b3('0x0'));var moment=require(_0xd2b3('0x1'));var ami=require('../ami');var logger=require(_0xd2b3('0x2'))(_0xd2b3('0x3'));var RpcUser=require(_0xd2b3('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4795c5){this[_0xd2b3('0x5')]=_0x4795c5['voiceQueues'];this[_0xd2b3('0x6')]=_0x4795c5['agents'];this['timers']=_0x4795c5['timers'];this[_0xd2b3('0x7')]={};ami['on'](_0xd2b3('0x8'),this[_0xd2b3('0x9')][_0xd2b3('0xa')](this));ami['on'](_0xd2b3('0xb'),this[_0xd2b3('0xc')]['bind'](this));ami['on'](_0xd2b3('0xd'),this['syncHangup'][_0xd2b3('0xa')](this));ami['on'](_0xd2b3('0xe'),this[_0xd2b3('0xf')][_0xd2b3('0xa')](this));ami['on'](_0xd2b3('0x10'),this[_0xd2b3('0x11')][_0xd2b3('0xa')](this));ami['on'](_0xd2b3('0x12'),this[_0xd2b3('0x13')][_0xd2b3('0xa')](this));ami['on'](_0xd2b3('0x14'),this[_0xd2b3('0x15')][_0xd2b3('0xa')](this));}function getDiff(_0x28b0c6){var _0x13b0ec=moment()['milliseconds'](0x0);var _0x566835=moment(_0x28b0c6)[_0xd2b3('0x16')](0x0);return _0x13b0ec[_0xd2b3('0x17')](_0x566835,_0xd2b3('0x18'));}Acw[_0xd2b3('0x19')][_0xd2b3('0x1a')]=function(_0x2360b5){try{var _0x43072b=this;var _0x1c7321=this[_0xd2b3('0x7')][_0x2360b5][_0xd2b3('0x1b')];var _0x21d31e=this[_0xd2b3('0x7')][_0x2360b5][_0xd2b3('0x1c')];var _0x537d1e=this['voiceQueues'][_0x21d31e];var _0x39238c=![];var _0x1b33fd='ACW';if(_0x537d1e[_0xd2b3('0x1d')]){if(_0x537d1e[_0xd2b3('0x1e')][_0xd2b3('0x1f')]){_0x39238c=!![];_0x1b33fd=_0x537d1e[_0xd2b3('0x1e')][_0xd2b3('0x1f')];}}ami[_0xd2b3('0x20')]({'action':'QueuePause','interface':_0x1c7321,'paused':!![],'reason':_0x1b33fd})[_0xd2b3('0x21')](function(_0x21d04f){if(_0x43072b[_0xd2b3('0x6')][_0x1c7321]){return RpcUser[_0xd2b3('0x22')](_0x43072b['agents'][_0x1c7321]['id'])['then'](function(_0x367231){if(_0x367231&&!_0x367231[_0xd2b3('0x23')]){logger['info'](_0xd2b3('0x24'),_0x2360b5,_0x1c7321,_0x21d31e);var _0x4bdde6=_0x43072b[_0xd2b3('0x7')][_0x2360b5][_0xd2b3('0x25')]&&_0x43072b['channels'][_0x2360b5][_0xd2b3('0x26')]?_0x43072b[_0xd2b3('0x7')][_0x2360b5][_0xd2b3('0x26')]:_0x2360b5;return RpcUser[_0xd2b3('0x27')](_0x43072b[_0xd2b3('0x6')][_0x1c7321],_0x1b33fd,_0x4bdde6)[_0xd2b3('0x21')](function(_0x56d258){if(!_0x39238c){_0x43072b['timers'][_0x1c7321]={};logger[_0xd2b3('0x28')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2360b5,_0x43072b[_0xd2b3('0x5')][_0x21d31e][_0xd2b3('0x29')],_0x1c7321,_0x21d31e);_0x43072b[_0xd2b3('0x2a')][_0x1c7321][_0xd2b3('0x2b')]=setTimeout(_0x43072b['stopAcw'][_0xd2b3('0xa')](_0x43072b,_0x1c7321),_0x43072b['voiceQueues'][_0x21d31e][_0xd2b3('0x29')]*0x3e8);_0x43072b[_0xd2b3('0x2a')][_0x1c7321]['lastPauseAt']=moment()[_0xd2b3('0x2c')](_0xd2b3('0x2d'));_0x43072b[_0xd2b3('0x2a')][_0x1c7321][_0xd2b3('0x2e')]=_0x2360b5;_0x43072b[_0xd2b3('0x2a')][_0x1c7321]['queue']=_0x21d31e;_0x43072b[_0xd2b3('0x2a')][_0x1c7321][_0xd2b3('0x2f')]=function(){var _0x139fad=getDiff(_0x43072b[_0xd2b3('0x2a')][_0x1c7321]['lastPauseAt']);clearTimeout(_0x43072b['timers'][_0x1c7321][_0xd2b3('0x2b')]);_0x43072b[_0xd2b3('0x2a')][_0x1c7321][_0xd2b3('0x2b')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x139fad},_0x43072b['timers'][_0x1c7321][_0xd2b3('0x2e')],_0x1c7321)[_0xd2b3('0x21')](function(_0x43bd6d){logger['info'](_0xd2b3('0x30'),_0x2360b5,_0x139fad,_0x43bd6d);})[_0xd2b3('0x31')](function(_0x1ba7a2){logger['error'](_0xd2b3('0x32'),_0x2360b5,_0x1ba7a2);});delete _0x43072b[_0xd2b3('0x2a')][_0x1c7321];};}});}else{logger['info'](_0xd2b3('0x33'),_0x2360b5,_0x1c7321,_0x21d31e);}});}})[_0xd2b3('0x31')](function(_0x1c00f3){logger[_0xd2b3('0x34')](_0xd2b3('0x35'),_0x2360b5,_0x43072b['voiceQueues'][_0x21d31e][_0xd2b3('0x29')],_0x1c7321,_0x21d31e);})[_0xd2b3('0x36')](function(){delete _0x43072b['channels'][_0x2360b5];});}catch(_0x49b6a7){logger[_0xd2b3('0x34')]('[ACW][START]\x20%s',_0x49b6a7['message']);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x37')]=function(_0x3adb1c){try{var _0x3b03dc=this;if(_0x3b03dc['timers'][_0x3adb1c]){_0x3b03dc[_0xd2b3('0x2a')][_0x3adb1c][_0xd2b3('0x2b')]=![];var _0x1e9845=_0x3b03dc[_0xd2b3('0x2a')][_0x3adb1c]['uniqueid'];var _0xc5d65e=_0x3b03dc[_0xd2b3('0x2a')][_0x3adb1c][_0xd2b3('0x1c')];var _0x34e1ef=_0x3b03dc[_0xd2b3('0x5')][_0xc5d65e][_0xd2b3('0x29')];logger['info'](_0xd2b3('0x38'),_0x1e9845,_0x3adb1c);RpcUser[_0xd2b3('0x39')](this[_0xd2b3('0x6')][_0x3adb1c]);RpcVoiceAgentReport['update']({'acwtime':_0x34e1ef,'agentacw':!![]},_0x1e9845,_0x3adb1c)[_0xd2b3('0x21')](function(_0x419c48){logger[_0xd2b3('0x28')](_0xd2b3('0x30'),_0x1e9845,_0x34e1ef,_0x419c48);})[_0xd2b3('0x31')](function(_0x316e49){logger[_0xd2b3('0x34')](_0xd2b3('0x32'),_0x1e9845,_0x316e49);});}else{logger['error'](_0xd2b3('0x3a'),_0x3adb1c);if(_0x3b03dc[_0xd2b3('0x2a')]){logger['info'](_0xd2b3('0x3b'),JSON[_0xd2b3('0x3c')](_0x3b03dc[_0xd2b3('0x2a')]));}}}catch(_0x12b99d){logger[_0xd2b3('0x34')](_0xd2b3('0x3d'),_0x12b99d['message']);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x9')]=function(_0x4ed8ef){try{if(this[_0xd2b3('0x5')][_0x4ed8ef['queue']]&&(this[_0xd2b3('0x5')][_0x4ed8ef[_0xd2b3('0x1c')]]['acw']||this['voiceQueues'][_0x4ed8ef['queue']]['mandatoryDisposition'])){if(this[_0xd2b3('0x6')][_0x4ed8ef[_0xd2b3('0x1b')]]){this[_0xd2b3('0x7')][_0x4ed8ef[_0xd2b3('0x2e')]]={'queue':_0x4ed8ef[_0xd2b3('0x1c')],'interface':_0x4ed8ef['interface'],'destlinkedid':_0x4ed8ef[_0xd2b3('0x26')]};}}}catch(_0x67435c){logger['error'](_0xd2b3('0x3e'),_0x67435c[_0xd2b3('0x3f')]);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x15')]=function(_0x1a8c45){try{if(this[_0xd2b3('0x5')][_0x1a8c45[_0xd2b3('0x1c')]]&&(this[_0xd2b3('0x5')][_0x1a8c45[_0xd2b3('0x1c')]][_0xd2b3('0x3')]||this[_0xd2b3('0x5')][_0x1a8c45['queue']][_0xd2b3('0x1d')])){if(this[_0xd2b3('0x6')][_0x1a8c45[_0xd2b3('0x1b')]]){this['channels'][_0x1a8c45[_0xd2b3('0x2e')]]={'queue':_0x1a8c45['queue'],'interface':_0x1a8c45[_0xd2b3('0x1b')]};}}}catch(_0x467f84){logger[_0xd2b3('0x34')](_0xd2b3('0x40'),_0x467f84[_0xd2b3('0x3f')]);}};Acw[_0xd2b3('0x19')][_0xd2b3('0xc')]=function(_0x5d3d2f){try{if(this[_0xd2b3('0x7')][_0x5d3d2f[_0xd2b3('0x2e')]]&&_[_0xd2b3('0x41')](this[_0xd2b3('0x7')][_0x5d3d2f[_0xd2b3('0x2e')]][_0xd2b3('0x25')])){logger[_0xd2b3('0x28')](_0xd2b3('0x42'),_0x5d3d2f[_0xd2b3('0x2e')]);this[_0xd2b3('0x1a')](_0x5d3d2f[_0xd2b3('0x2e')]);}else if(this[_0xd2b3('0x7')][_0x5d3d2f[_0xd2b3('0x43')]]&&_[_0xd2b3('0x41')](this[_0xd2b3('0x7')][_0x5d3d2f['linkedid']][_0xd2b3('0x25')])){logger[_0xd2b3('0x28')](_0xd2b3('0x44'),_0x5d3d2f[_0xd2b3('0x43')]);this[_0xd2b3('0x1a')](_0x5d3d2f['linkedid']);}}catch(_0x436cb5){logger[_0xd2b3('0x34')](_0xd2b3('0x45'),_0x436cb5[_0xd2b3('0x3f')]);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x46')]=function(_0x231b82){try{if(this[_0xd2b3('0x7')][_0x231b82[_0xd2b3('0x2e')]]&&this[_0xd2b3('0x7')][_0x231b82[_0xd2b3('0x2e')]][_0xd2b3('0x25')]){logger[_0xd2b3('0x28')](_0xd2b3('0x47'),_0x231b82[_0xd2b3('0x2e')]);this['startAcw'](_0x231b82[_0xd2b3('0x2e')]);}else if(this[_0xd2b3('0x7')][_0x231b82[_0xd2b3('0x43')]]&&this[_0xd2b3('0x7')][_0x231b82[_0xd2b3('0x43')]][_0xd2b3('0x25')]){logger[_0xd2b3('0x28')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x231b82[_0xd2b3('0x43')]);this[_0xd2b3('0x1a')](_0x231b82[_0xd2b3('0x43')]);}}catch(_0x43ea02){logger['error'](_0xd2b3('0x48'),_0x43ea02[_0xd2b3('0x3f')]);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x11')]=function(_0x5164f8){try{if(!_['isNil'](this['channels'][_0x5164f8['transfereeuniqueid']])){this[_0xd2b3('0x1a')](_0x5164f8['transfereeuniqueid']);if(this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x49')]]){this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x49')]]['attended']=!![];this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x4a')]]=this[_0xd2b3('0x7')][_0x5164f8['secondtransfereruniqueid']];delete this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x49')]];}}else if(!_[_0xd2b3('0x4b')](this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x4a')]])){this[_0xd2b3('0x1a')](_0x5164f8[_0xd2b3('0x4a')]);if(this['channels'][_0x5164f8[_0xd2b3('0x4c')]]){this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x4c')]][_0xd2b3('0x25')]=!![];this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x4d')]]=this[_0xd2b3('0x7')][_0x5164f8[_0xd2b3('0x4c')]];delete this['channels'][_0x5164f8[_0xd2b3('0x4c')]];}}}catch(_0x4de5fe){logger['error'](_0xd2b3('0x4e'),_0x4de5fe[_0xd2b3('0x3f')]);}};Acw[_0xd2b3('0x19')][_0xd2b3('0x13')]=function(_0x24a3b9){try{if(this[_0xd2b3('0x7')][_0x24a3b9['transfereruniqueid']]){logger[_0xd2b3('0x28')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x24a3b9[_0xd2b3('0x4f')]));this[_0xd2b3('0x1a')](_0x24a3b9[_0xd2b3('0x4f')]);}else if(this[_0xd2b3('0x7')][_0x24a3b9[_0xd2b3('0x50')]]){logger[_0xd2b3('0x28')](_0xd2b3('0x51'),JSON['stringify'](_0x24a3b9[_0xd2b3('0x50')]));this['startAcw'](_0x24a3b9[_0xd2b3('0x50')]);}}catch(_0x2a4e02){logger['error'](_0xd2b3('0x52'),_0x2a4e02[_0xd2b3('0x3f')]);}};Acw['prototype'][_0xd2b3('0xf')]=function(_0x450483){try{if(this[_0xd2b3('0x5')][_0x450483[_0xd2b3('0x1c')]]&&this[_0xd2b3('0x5')][_0x450483[_0xd2b3('0x1c')]]['autopause']==='all'){if(this[_0xd2b3('0x6')][_0x450483[_0xd2b3('0x1b')]]){logger['info'](_0xd2b3('0x53'),_0x450483['uniqueid'],_0x450483['interface'],_0x450483['queue']);return RpcUser['savePause'](this['agents'][_0x450483[_0xd2b3('0x1b')]],'Auto-Pause',_0x450483[_0xd2b3('0x2e')]);}}}catch(_0x5b4440){logger['error'](_0xd2b3('0x54'),_0x5b4440[_0xd2b3('0x3f')]);}};module[_0xd2b3('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cbfc2e3..23b930e 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x1276f3,_0x15bb76){var _0x56f42a=function(_0x10780c){while(--_0x10780c){_0x1276f3['push'](_0x1276f3['shift']());}};_0x56f42a(++_0x15bb76);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x20d9ab,_0x3c72d1){var _0x3a14c4=function(_0x167828){while(--_0x167828){_0x20d9ab['push'](_0x20d9ab['shift']());}};_0x3a14c4(++_0x3c72d1);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e9903,_0x3ec512){_0x3e9903=_0x3e9903-0x0;var _0xcab758=_0xb10b[_0x3e9903];return _0xcab758;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4fc4194..7b0473a 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x18fdaf,_0x457de2){var _0x557a9b=function(_0x4a6b5a){while(--_0x4a6b5a){_0x18fdaf['push'](_0x18fdaf['shift']());}};_0x557a9b(++_0x457de2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x3dc1ce,_0x3e0071){var _0x380713=function(_0x5b7e89){while(--_0x5b7e89){_0x3dc1ce['push'](_0x3dc1ce['shift']());}};_0x380713(++_0x3e0071);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 3c817e8..9d7d12f 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8869=['dialCutDigit','prototype','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','phone','Contact','lastName','number','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','format','\x22%s\x22\x20<%s>','substring'];(function(_0x5b46c6,_0x1dc4fa){var _0x334863=function(_0x9670bb){while(--_0x9670bb){_0x5b46c6['push'](_0x5b46c6['shift']());}};_0x334863(++_0x1dc4fa);}(_0x8869,0x1bc));var _0x9886=function(_0x4c4b12,_0x1e9de1){_0x4c4b12=_0x4c4b12-0x0;var _0x5b10d8=_0x8869[_0x4c4b12];return _0x5b10d8;};'use strict';var util=require(_0x9886('0x0'));var _=require(_0x9886('0x1'));var moment=require(_0x9886('0x2'));function checkNameSurname(_0x51ee53,_0x3d1274,_0x2fc2ad){var _0x4565d3='';if(!_[_0x9886('0x3')](_0x3d1274)&&_0x9886('0x4')===typeof _0x3d1274){_0x4565d3+=_0x3d1274;}if(!_[_0x9886('0x3')](_0x2fc2ad)&&_0x9886('0x4')===typeof _0x2fc2ad){_0x4565d3+='\x20'+_0x2fc2ad;}if(_0x4565d3!==''){return _0x4565d3;}return _0x51ee53;}function Action(_0x2b1d54,_0x1498b4,_0x42cc48){this[_0x9886('0x5')]=_0x2b1d54;this[_0x9886('0x6')]=_0x42cc48||undefined;this['name']=checkNameSurname(_0x1498b4['Contact'][_0x9886('0x7')],_0x1498b4[_0x9886('0x8')]['firstName'],_0x1498b4[_0x9886('0x8')][_0x9886('0x9')]);this[_0x9886('0xa')]=_0x1498b4[_0x9886('0x7')];this['queue']=_0x2b1d54[_0x9886('0xb')];this[_0x9886('0xc')]=_0x1498b4[_0x9886('0xc')]||![];this[_0x9886('0xd')]=_0x2b1d54['type'];this['dialQueueTimeout']=_0x2b1d54['dialQueueTimeout']||0x3;this[_0x9886('0xe')]=_0x1498b4['scheduledat'];this['countbusyretry']=_0x1498b4[_0x9886('0xf')];this['countcongestionretry']=_0x1498b4[_0x9886('0x10')];this[_0x9886('0x11')]=_0x1498b4['countnoanswerretry'];this['countnosuchnumberretry']=_0x1498b4[_0x9886('0x12')];this[_0x9886('0x13')]=_0x1498b4[_0x9886('0x13')];this[_0x9886('0x14')]=_0x1498b4['countabandonedretry'];this[_0x9886('0x15')]=_0x1498b4['countmachineretry'];this[_0x9886('0x16')]=_0x1498b4[_0x9886('0x16')];this['ContactId']=_0x1498b4['ContactId'];this['ListId']=_0x1498b4['ListId'];this[_0x9886('0x17')]=_0x1498b4['UserId'];this['VoiceQueueId']=_0x1498b4[_0x9886('0x18')];this['CampaignId']=_0x1498b4[_0x9886('0x19')];this[_0x9886('0x1a')]=_0x1498b4['id'];this[_0x9886('0x1b')]=_0x1498b4['Contact'][_0x9886('0x1c')]||'';this[_0x9886('0x1d')]=moment()['format'](_0x9886('0x1e'));this[_0x9886('0x1f')]=_0x1498b4[_0x9886('0x1f')];this[_0x9886('0x20')]=_0x1498b4[_0x9886('0x20')];this[_0x9886('0x21')]=_0x1498b4[_0x9886('0x21')];this[_0x9886('0x22')]=_0x1498b4[_0x9886('0x22')];this[_0x9886('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x9886('0x24')]=function(){return util[_0x9886('0x25')](_0x9886('0x26'),this['name'],this[_0x9886('0x5')]['dialCutDigit']>0x0?this['number'][_0x9886('0x27')](this['voiceQueue'][_0x9886('0x28')]):this['number']);};Action[_0x9886('0x29')][_0x9886('0x2a')]=function(){return this['queue'];};module[_0x9886('0x2b')]=Action; \ No newline at end of file +var _0x42a1=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','queue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName'];(function(_0x35a779,_0x27f8fb){var _0xca723b=function(_0x298df7){while(--_0x298df7){_0x35a779['push'](_0x35a779['shift']());}};_0xca723b(++_0x27f8fb);}(_0x42a1,0x116));var _0x142a=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x42a1[_0x4bf96c];return _0x281d09;};'use strict';var util=require(_0x142a('0x0'));var _=require(_0x142a('0x1'));var moment=require(_0x142a('0x2'));function checkNameSurname(_0x21fc24,_0x3aad2e,_0x1ebe86){var _0x42e225='';if(!_[_0x142a('0x3')](_0x3aad2e)&&_0x142a('0x4')===typeof _0x3aad2e){_0x42e225+=_0x3aad2e;}if(!_[_0x142a('0x3')](_0x1ebe86)&&_0x142a('0x4')===typeof _0x1ebe86){_0x42e225+='\x20'+_0x1ebe86;}if(_0x42e225!==''){return _0x42e225;}return _0x21fc24;}function Action(_0x3425bf,_0x9f1b12,_0x20be90){this[_0x142a('0x5')]=_0x3425bf;this[_0x142a('0x6')]=_0x20be90||undefined;this[_0x142a('0x7')]=checkNameSurname(_0x9f1b12['Contact'][_0x142a('0x8')],_0x9f1b12[_0x142a('0x9')][_0x142a('0xa')],_0x9f1b12['Contact'][_0x142a('0xb')]);this[_0x142a('0xc')]=_0x9f1b12['phone'];this['queue']=_0x3425bf[_0x142a('0x7')];this[_0x142a('0xd')]=_0x9f1b12['active']||![];this[_0x142a('0xe')]=_0x3425bf[_0x142a('0xe')];this['dialQueueTimeout']=_0x3425bf[_0x142a('0xf')]||0x3;this[_0x142a('0x10')]=_0x9f1b12['scheduledat'];this[_0x142a('0x11')]=_0x9f1b12[_0x142a('0x11')];this['countcongestionretry']=_0x9f1b12['countcongestionretry'];this[_0x142a('0x12')]=_0x9f1b12[_0x142a('0x12')];this[_0x142a('0x13')]=_0x9f1b12[_0x142a('0x13')];this['countdropretry']=_0x9f1b12[_0x142a('0x14')];this[_0x142a('0x15')]=_0x9f1b12[_0x142a('0x15')];this[_0x142a('0x16')]=_0x9f1b12[_0x142a('0x16')];this[_0x142a('0x17')]=_0x9f1b12[_0x142a('0x17')];this[_0x142a('0x18')]=_0x9f1b12[_0x142a('0x18')];this[_0x142a('0x19')]=_0x9f1b12[_0x142a('0x19')];this[_0x142a('0x1a')]=_0x9f1b12[_0x142a('0x1a')];this[_0x142a('0x1b')]=_0x9f1b12[_0x142a('0x1b')];this['CampaignId']=_0x9f1b12['CampaignId'];this[_0x142a('0x1c')]=_0x9f1b12['id'];this[_0x142a('0x1d')]=_0x9f1b12['Contact'][_0x142a('0xa')]||'';this[_0x142a('0x1e')]=moment()[_0x142a('0x1f')](_0x142a('0x20'));this[_0x142a('0x21')]=_0x9f1b12['callback'];this[_0x142a('0x22')]=_0x9f1b12[_0x142a('0x22')];this[_0x142a('0x23')]=_0x9f1b12['callbackat'];this[_0x142a('0x24')]=_0x9f1b12['recallme'];this[_0x142a('0x25')]='';this['originatecalleridname']='';}Action[_0x142a('0x26')][_0x142a('0x27')]=function(){return util[_0x142a('0x1f')](_0x142a('0x28'),this[_0x142a('0x7')],this[_0x142a('0x5')]['dialCutDigit']>0x0?this['number']['substring'](this['voiceQueue'][_0x142a('0x29')]):this['number']);};Action[_0x142a('0x26')]['getQueue']=function(){return this[_0x142a('0x2a')];};module[_0x142a('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a189129..de2341a 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x002d=['queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime'];(function(_0xd003b9,_0x5ad409){var _0x4e5e84=function(_0x5da89b){while(--_0x5da89b){_0xd003b9['push'](_0xd003b9['shift']());}};_0x4e5e84(++_0x5ad409);}(_0x002d,0xca));var _0xd002=function(_0x1d170c,_0x1f54c9){_0x1d170c=_0x1d170c-0x0;var _0x3bf71f=_0x002d[_0x1d170c];return _0x3bf71f;};'use strict';var util=require(_0xd002('0x0'));var _=require(_0xd002('0x1'));var moment=require(_0xd002('0x2'));function getSeconds(_0x58b453,_0x5c7b1c){var _0x12c353=moment(_0x58b453)[_0xd002('0x3')](0x0);var _0x1c0d0a=moment(_0x5c7b1c)[_0xd002('0x3')](0x0);return _0x12c353[_0xd002('0x4')](_0x1c0d0a,_0xd002('0x5'));}function AgentComplete(_0x3478a8,_0x38ec77){this[_0xd002('0x6')]=0x4;this[_0xd002('0x7')]=_0xd002('0x8');this[_0xd002('0x9')]=_0x3478a8[_0xd002('0x9')];this[_0xd002('0xa')]=_0x3478a8[_0xd002('0xa')];this[_0xd002('0xb')]=_0x3478a8[_0xd002('0xa')]==='outbound'?'queue':_0x3478a8[_0xd002('0xa')];this[_0xd002('0xc')]=_0x3478a8[_0xd002('0xc')];this['countcongestionretry']=_0x3478a8[_0xd002('0xd')];this[_0xd002('0xe')]=_0x3478a8[_0xd002('0xe')];this[_0xd002('0xf')]=_0x3478a8[_0xd002('0xc')]+_0x3478a8[_0xd002('0xd')]+_0x3478a8[_0xd002('0xe')]+_0x3478a8[_0xd002('0x10')]+_0x3478a8[_0xd002('0x11')]+_0x3478a8[_0xd002('0x12')]+_0x3478a8[_0xd002('0x13')]+_0x3478a8[_0xd002('0x14')];this[_0xd002('0x10')]=_0x3478a8[_0xd002('0x10')];this['countdropretry']=_0x3478a8['countdropretry'];this['countabandonedretry']=_0x3478a8[_0xd002('0x12')];this['countmachineretry']=_0x3478a8[_0xd002('0x13')];this[_0xd002('0x14')]=_0x3478a8[_0xd002('0x14')];this[_0xd002('0x15')]=_0x38ec77[_0xd002('0x15')];this[_0xd002('0x16')]=_0x3478a8[_0xd002('0x17')];this['calleridnum']=_0x3478a8[_0xd002('0x18')];this[_0xd002('0x19')]=_0x3478a8[_0xd002('0x19')];this[_0xd002('0x1a')]=_0x3478a8[_0xd002('0x1a')];this['answertime']=_0x3478a8[_0xd002('0x1b')];this[_0xd002('0x1c')]=moment()[_0xd002('0x1d')](_0xd002('0x1e'));this[_0xd002('0x1f')]=getSeconds(_0x3478a8[_0xd002('0x1a')],_0x3478a8['starttime']);this['holdtime']=getSeconds(_0x3478a8[_0xd002('0x1b')],_0x3478a8[_0xd002('0x1a')]);this[_0xd002('0x20')]=getSeconds(this[_0xd002('0x1c')],_0x3478a8[_0xd002('0x1b')]);this[_0xd002('0x21')]=_0x38ec77[_0xd002('0x21')];this[_0xd002('0x22')]=_0x38ec77[_0xd002('0x22')];this[_0xd002('0x23')]=_0x38ec77[_0xd002('0x23')];this[_0xd002('0x24')]=_0x3478a8['callback'];this[_0xd002('0x25')]=_0x3478a8[_0xd002('0x25')];this['callbackat']=_0x3478a8[_0xd002('0x26')];this[_0xd002('0x27')]=_0x3478a8[_0xd002('0x27')];this['ContactId']=_0x3478a8[_0xd002('0x28')];this['ListId']=_0x3478a8['ListId'];this['UserId']=_0x3478a8[_0xd002('0x29')];this[_0xd002('0x2a')]=_0x3478a8[_0xd002('0x2a')];this[_0xd002('0x2b')]=_0x3478a8[_0xd002('0x2b')];this[_0xd002('0x2c')]=_0x3478a8[_0xd002('0x2c')]||'';this[_0xd002('0x2d')]=_0x3478a8[_0xd002('0x2d')]||'';}module[_0xd002('0x2e')]=AgentComplete; \ No newline at end of file +var _0x21d8=['calleridname','name','number','starttime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','responsetime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x21d8,0xed));var _0x821d=function(_0x22ae96,_0x2f7dc5){_0x22ae96=_0x22ae96-0x0;var _0x5d1d7a=_0x21d8[_0x22ae96];return _0x5d1d7a;};'use strict';var util=require(_0x821d('0x0'));var _=require(_0x821d('0x1'));var moment=require(_0x821d('0x2'));function getSeconds(_0x5c0a1a,_0x30daee){var _0x16e6c6=moment(_0x5c0a1a)[_0x821d('0x3')](0x0);var _0x1c1239=moment(_0x30daee)[_0x821d('0x3')](0x0);return _0x16e6c6['diff'](_0x1c1239,_0x821d('0x4'));}function AgentComplete(_0x5beb2d,_0x56e937){this['state']=0x4;this[_0x821d('0x5')]='Answer';this[_0x821d('0x6')]=_0x5beb2d['scheduledat'];this[_0x821d('0x7')]=_0x5beb2d[_0x821d('0x7')];this[_0x821d('0x8')]=_0x5beb2d[_0x821d('0x7')]===_0x821d('0x9')?_0x821d('0xa'):_0x5beb2d[_0x821d('0x7')];this[_0x821d('0xb')]=_0x5beb2d[_0x821d('0xb')];this[_0x821d('0xc')]=_0x5beb2d['countcongestionretry'];this[_0x821d('0xd')]=_0x5beb2d[_0x821d('0xd')];this[_0x821d('0xe')]=_0x5beb2d['countbusyretry']+_0x5beb2d[_0x821d('0xc')]+_0x5beb2d[_0x821d('0xd')]+_0x5beb2d['countnosuchnumberretry']+_0x5beb2d[_0x821d('0xf')]+_0x5beb2d[_0x821d('0x10')]+_0x5beb2d[_0x821d('0x11')]+_0x5beb2d[_0x821d('0x12')];this[_0x821d('0x13')]=_0x5beb2d[_0x821d('0x13')];this[_0x821d('0xf')]=_0x5beb2d['countdropretry'];this[_0x821d('0x10')]=_0x5beb2d[_0x821d('0x10')];this[_0x821d('0x11')]=_0x5beb2d[_0x821d('0x11')];this[_0x821d('0x12')]=_0x5beb2d[_0x821d('0x12')];this[_0x821d('0x14')]=_0x56e937[_0x821d('0x14')];this[_0x821d('0x15')]=_0x5beb2d[_0x821d('0x16')];this['calleridnum']=_0x5beb2d[_0x821d('0x17')];this[_0x821d('0x18')]=_0x5beb2d[_0x821d('0x18')];this['responsetime']=_0x5beb2d['responsetime'];this['answertime']=_0x5beb2d[_0x821d('0x19')];this[_0x821d('0x1a')]=moment()['format'](_0x821d('0x1b'));this['ringtime']=getSeconds(_0x5beb2d['responsetime'],_0x5beb2d[_0x821d('0x18')]);this[_0x821d('0x1c')]=getSeconds(_0x5beb2d[_0x821d('0x19')],_0x5beb2d[_0x821d('0x1d')]);this['talktime']=getSeconds(this[_0x821d('0x1a')],_0x5beb2d[_0x821d('0x19')]);this[_0x821d('0xa')]=_0x56e937[_0x821d('0xa')];this['membername']=_0x56e937['membername'];this[_0x821d('0x1e')]=_0x56e937[_0x821d('0x1e')];this[_0x821d('0x1f')]=_0x5beb2d[_0x821d('0x1f')];this[_0x821d('0x20')]=_0x5beb2d[_0x821d('0x20')];this[_0x821d('0x21')]=_0x5beb2d[_0x821d('0x21')];this[_0x821d('0x22')]=_0x5beb2d[_0x821d('0x22')];this[_0x821d('0x23')]=_0x5beb2d[_0x821d('0x23')];this['ListId']=_0x5beb2d[_0x821d('0x24')];this[_0x821d('0x25')]=_0x5beb2d[_0x821d('0x25')];this[_0x821d('0x26')]=_0x5beb2d[_0x821d('0x26')];this[_0x821d('0x27')]=_0x5beb2d[_0x821d('0x27')];this[_0x821d('0x28')]=_0x5beb2d[_0x821d('0x28')]||'';this[_0x821d('0x29')]=_0x5beb2d[_0x821d('0x29')]||'';}module[_0x821d('0x2a')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index f569b77..dce54c9 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0207=['countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x3fb854,_0x460d65){var _0x435892=function(_0x20d731){while(--_0x20d731){_0x3fb854['push'](_0x3fb854['shift']());}};_0x435892(++_0x460d65);}(_0x0207,0x162));var _0x7020=function(_0x525ef9,_0x12b1c2){_0x525ef9=_0x525ef9-0x0;var _0x5561fb=_0x0207[_0x525ef9];return _0x5561fb;};'use strict';var util=require('util');var _=require(_0x7020('0x0'));var moment=require('moment');function getSeconds(_0x49775a,_0x1a481c){var _0x28ab1d=moment(_0x49775a)[_0x7020('0x1')](0x0);var _0x15db09=moment(_0x1a481c)[_0x7020('0x1')](0x0);return _0x28ab1d[_0x7020('0x2')](_0x15db09,_0x7020('0x3'));}function Final(_0x5b7cf1){this['uniqueid']=_0x5b7cf1[_0x7020('0x4')];this[_0x7020('0x5')]=_0x5b7cf1[_0x7020('0x5')];this[_0x7020('0x6')]=_0x5b7cf1[_0x7020('0x6')];this[_0x7020('0x7')]=_0x5b7cf1[_0x7020('0x6')]==='outbound'?'queue':_0x5b7cf1[_0x7020('0x6')];this[_0x7020('0x8')]=_0x5b7cf1[_0x7020('0x8')];this['countcongestionretry']=_0x5b7cf1[_0x7020('0x9')];this[_0x7020('0xa')]=_0x5b7cf1['countnoanswerretry'];this[_0x7020('0xb')]=_0x5b7cf1[_0x7020('0x8')]+_0x5b7cf1[_0x7020('0x9')]+_0x5b7cf1['countnoanswerretry']+_0x5b7cf1[_0x7020('0xc')]+_0x5b7cf1[_0x7020('0xd')]+_0x5b7cf1[_0x7020('0xe')]+_0x5b7cf1[_0x7020('0xf')]+_0x5b7cf1[_0x7020('0x10')];this['countnosuchnumberretry']=_0x5b7cf1[_0x7020('0xc')];this['countdropretry']=_0x5b7cf1[_0x7020('0xd')];this[_0x7020('0xe')]=_0x5b7cf1[_0x7020('0xe')];this[_0x7020('0xf')]=_0x5b7cf1[_0x7020('0xf')];this[_0x7020('0x10')]=_0x5b7cf1['countagentrejectretry'];this[_0x7020('0x11')]=_0x5b7cf1['queue'];this[_0x7020('0x12')]=_0x5b7cf1[_0x7020('0x12')];this[_0x7020('0x13')]=_0x5b7cf1[_0x7020('0x13')];this['starttime']=_0x5b7cf1[_0x7020('0x14')];this[_0x7020('0x15')]=_0x5b7cf1[_0x7020('0x15')];this[_0x7020('0x16')]=_0x5b7cf1[_0x7020('0x15')];this[_0x7020('0x17')]=_0x5b7cf1['ringtime']||0x0;this['holdtime']=_0x5b7cf1[_0x7020('0x18')]||0x0;this[_0x7020('0x19')]=_0x5b7cf1[_0x7020('0x19')]||0x0;this[_0x7020('0x1a')]=_0x5b7cf1['callback'];this[_0x7020('0x1b')]=_0x5b7cf1[_0x7020('0x1b')];this[_0x7020('0x1c')]=_0x5b7cf1[_0x7020('0x1c')];this['recallme']=_0x5b7cf1[_0x7020('0x1d')];this[_0x7020('0x1e')]=_0x5b7cf1[_0x7020('0x1e')];this[_0x7020('0x1f')]=_0x5b7cf1[_0x7020('0x1f')];this[_0x7020('0x20')]=_0x5b7cf1[_0x7020('0x20')];this[_0x7020('0x21')]=_0x5b7cf1['VoiceQueueId'];this[_0x7020('0x22')]=_0x5b7cf1[_0x7020('0x22')];this[_0x7020('0x23')]=_0x5b7cf1['originatecalleridnum']||'';this[_0x7020('0x24')]=_0x5b7cf1['originatecalleridname']||'';}module['exports']=Final; \ No newline at end of file +var _0xfd0f=['countagentrejectretry','countmachineretry','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countcongestionretry','countnoanswerretry','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0xfd0f,0x1b8));var _0xffd0=function(_0x33ba38,_0x5e2d21){_0x33ba38=_0x33ba38-0x0;var _0x22e73d=_0xfd0f[_0x33ba38];return _0x22e73d;};'use strict';var util=require(_0xffd0('0x0'));var _=require(_0xffd0('0x1'));var moment=require('moment');function getSeconds(_0x568847,_0x28aea8){var _0xe1219f=moment(_0x568847)['milliseconds'](0x0);var _0x33e4d8=moment(_0x28aea8)['milliseconds'](0x0);return _0xe1219f[_0xffd0('0x2')](_0x33e4d8,_0xffd0('0x3'));}function Final(_0x3501fc){this[_0xffd0('0x4')]=_0x3501fc[_0xffd0('0x4')];this[_0xffd0('0x5')]=_0x3501fc[_0xffd0('0x5')];this[_0xffd0('0x6')]=_0x3501fc[_0xffd0('0x6')];this['campaigntype']=_0x3501fc[_0xffd0('0x6')]===_0xffd0('0x7')?_0xffd0('0x8'):_0x3501fc[_0xffd0('0x6')];this['countbusyretry']=_0x3501fc['countbusyretry'];this[_0xffd0('0x9')]=_0x3501fc[_0xffd0('0x9')];this[_0xffd0('0xa')]=_0x3501fc['countnoanswerretry'];this['countglobal']=_0x3501fc[_0xffd0('0xb')]+_0x3501fc[_0xffd0('0x9')]+_0x3501fc['countnoanswerretry']+_0x3501fc[_0xffd0('0xc')]+_0x3501fc[_0xffd0('0xd')]+_0x3501fc[_0xffd0('0xe')]+_0x3501fc['countmachineretry']+_0x3501fc[_0xffd0('0xf')];this[_0xffd0('0xc')]=_0x3501fc['countnosuchnumberretry'];this[_0xffd0('0xd')]=_0x3501fc['countdropretry'];this['countabandonedretry']=_0x3501fc[_0xffd0('0xe')];this['countmachineretry']=_0x3501fc[_0xffd0('0x10')];this[_0xffd0('0xf')]=_0x3501fc[_0xffd0('0xf')];this[_0xffd0('0x8')]=_0x3501fc[_0xffd0('0x8')];this['calleridname']=_0x3501fc['calleridname'];this[_0xffd0('0x11')]=_0x3501fc[_0xffd0('0x11')];this[_0xffd0('0x12')]=_0x3501fc[_0xffd0('0x12')];this[_0xffd0('0x13')]=_0x3501fc[_0xffd0('0x13')];this[_0xffd0('0x14')]=_0x3501fc[_0xffd0('0x13')];this[_0xffd0('0x15')]=_0x3501fc[_0xffd0('0x15')]||0x0;this[_0xffd0('0x16')]=_0x3501fc[_0xffd0('0x16')]||0x0;this[_0xffd0('0x17')]=_0x3501fc[_0xffd0('0x17')]||0x0;this[_0xffd0('0x18')]=_0x3501fc[_0xffd0('0x18')];this['callbackuniqueid']=_0x3501fc['callbackuniqueid'];this[_0xffd0('0x19')]=_0x3501fc[_0xffd0('0x19')];this[_0xffd0('0x1a')]=_0x3501fc['recallme'];this[_0xffd0('0x1b')]=_0x3501fc['ContactId'];this[_0xffd0('0x1c')]=_0x3501fc[_0xffd0('0x1c')];this[_0xffd0('0x1d')]=_0x3501fc[_0xffd0('0x1d')];this[_0xffd0('0x1e')]=_0x3501fc[_0xffd0('0x1e')];this[_0xffd0('0x1f')]=_0x3501fc[_0xffd0('0x1f')];this[_0xffd0('0x20')]=_0x3501fc[_0xffd0('0x20')]||'';this[_0xffd0('0x21')]=_0x3501fc[_0xffd0('0x21')]||'';}module[_0xffd0('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index c47708d..524e650 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2958=['cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','scheduledat','type','countbusyretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x2958,0x10d));var _0x8295=function(_0x581860,_0x5ea51a){_0x581860=_0x581860-0x0;var _0x4c13e3=_0x2958[_0x581860];return _0x4c13e3;};'use strict';var util=require(_0x8295('0x0'));var _=require(_0x8295('0x1'));var moment=require(_0x8295('0x2'));function getSeconds(_0x17a838,_0x15db7c){var _0x5edbdc=moment(_0x17a838)[_0x8295('0x3')](0x0);var _0x441048=moment(_0x15db7c)['milliseconds'](0x0);return _0x5edbdc['diff'](_0x441048,'seconds');}function Hangup(_0x44ba0b,_0xfacf93){this[_0x8295('0x4')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x44ba0b[_0x8295('0x5')];this[_0x8295('0x6')]=_0x44ba0b[_0x8295('0x6')];this['campaigntype']=_0x44ba0b[_0x8295('0x6')]==='outbound'?'queue':_0x44ba0b[_0x8295('0x6')];this[_0x8295('0x7')]=_0x44ba0b[_0x8295('0x7')];this['countcongestionretry']=_0x44ba0b['countcongestionretry'];this[_0x8295('0x8')]=_0x44ba0b['countnoanswerretry'];this[_0x8295('0x9')]=_0x44ba0b[_0x8295('0x7')]+_0x44ba0b['countcongestionretry']+_0x44ba0b[_0x8295('0x8')]+_0x44ba0b[_0x8295('0xa')]+_0x44ba0b[_0x8295('0xb')]+_0x44ba0b[_0x8295('0xc')]+_0x44ba0b[_0x8295('0xd')]+_0x44ba0b[_0x8295('0xe')];this['countnosuchnumberretry']=_0x44ba0b[_0x8295('0xa')];this[_0x8295('0xb')]=_0x44ba0b[_0x8295('0xb')];this[_0x8295('0xc')]=_0x44ba0b[_0x8295('0xc')];this[_0x8295('0xd')]=_0x44ba0b[_0x8295('0xd')];this[_0x8295('0xe')]=_0x44ba0b['countagentrejectretry'];this[_0x8295('0xf')]=_0xfacf93[_0x8295('0xf')];this[_0x8295('0x10')]=_0x44ba0b[_0x8295('0x11')];this[_0x8295('0x12')]=_0x44ba0b[_0x8295('0x13')];this[_0x8295('0x14')]=_0x44ba0b[_0x8295('0x14')];this['responsetime']=_0x44ba0b[_0x8295('0x15')];this[_0x8295('0x16')]=moment()[_0x8295('0x17')](_0x8295('0x18'));this[_0x8295('0x19')]=getSeconds(_0x44ba0b[_0x8295('0x15')],_0x44ba0b[_0x8295('0x14')]);this[_0x8295('0x1a')]=0x0;this[_0x8295('0x1b')]=getSeconds(this[_0x8295('0x16')],_0x44ba0b['responsetime']);this[_0x8295('0x1c')]=_0x44ba0b[_0x8295('0x1c')];this[_0x8295('0x1d')]=_0x8295('0x1e');this[_0x8295('0x1f')]=_0xfacf93[_0x8295('0x20')];this['callback']=_0x44ba0b[_0x8295('0x21')];this[_0x8295('0x22')]=_0x44ba0b[_0x8295('0x22')];this[_0x8295('0x23')]=_0x44ba0b['callbackat'];this[_0x8295('0x24')]=_0x44ba0b[_0x8295('0x24')];this['ContactId']=_0x44ba0b[_0x8295('0x25')];this[_0x8295('0x26')]=_0x44ba0b[_0x8295('0x26')];this[_0x8295('0x27')]=_0x44ba0b[_0x8295('0x27')];this[_0x8295('0x28')]=_0x44ba0b['VoiceQueueId'];this['CampaignId']=_0x44ba0b[_0x8295('0x29')];}module[_0x8295('0x2a')]=Hangup; \ No newline at end of file +var _0xd712=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime'];(function(_0x2486b8,_0x3b819c){var _0x44b2be=function(_0x482386){while(--_0x482386){_0x2486b8['push'](_0x2486b8['shift']());}};_0x44b2be(++_0x3b819c);}(_0xd712,0x6b));var _0x2d71=function(_0xdc7581,_0x10270f){_0xdc7581=_0xdc7581-0x0;var _0x12e586=_0xd712[_0xdc7581];return _0x12e586;};'use strict';var util=require(_0x2d71('0x0'));var _=require(_0x2d71('0x1'));var moment=require('moment');function getSeconds(_0x3d441a,_0x4bf7b8){var _0x3d285c=moment(_0x3d441a)[_0x2d71('0x2')](0x0);var _0x2cb8a2=moment(_0x4bf7b8)[_0x2d71('0x2')](0x0);return _0x3d285c[_0x2d71('0x3')](_0x2cb8a2,_0x2d71('0x4'));}function Hangup(_0x1e6483,_0x38c51a){this['state']=0x4;this[_0x2d71('0x5')]=_0x2d71('0x6');this[_0x2d71('0x7')]=_0x1e6483[_0x2d71('0x7')];this['type']=_0x1e6483[_0x2d71('0x8')];this['campaigntype']=_0x1e6483[_0x2d71('0x8')]===_0x2d71('0x9')?_0x2d71('0xa'):_0x1e6483[_0x2d71('0x8')];this[_0x2d71('0xb')]=_0x1e6483[_0x2d71('0xb')];this[_0x2d71('0xc')]=_0x1e6483[_0x2d71('0xc')];this[_0x2d71('0xd')]=_0x1e6483[_0x2d71('0xd')];this[_0x2d71('0xe')]=_0x1e6483['countbusyretry']+_0x1e6483[_0x2d71('0xc')]+_0x1e6483['countnoanswerretry']+_0x1e6483[_0x2d71('0xf')]+_0x1e6483['countdropretry']+_0x1e6483['countabandonedretry']+_0x1e6483[_0x2d71('0x10')]+_0x1e6483[_0x2d71('0x11')];this['countnosuchnumberretry']=_0x1e6483['countnosuchnumberretry'];this['countdropretry']=_0x1e6483[_0x2d71('0x12')];this[_0x2d71('0x13')]=_0x1e6483[_0x2d71('0x13')];this[_0x2d71('0x10')]=_0x1e6483['countmachineretry'];this['countagentrejectretry']=_0x1e6483[_0x2d71('0x11')];this[_0x2d71('0x14')]=_0x38c51a[_0x2d71('0x14')];this[_0x2d71('0x15')]=_0x1e6483[_0x2d71('0x16')];this[_0x2d71('0x17')]=_0x1e6483[_0x2d71('0x18')];this[_0x2d71('0x19')]=_0x1e6483[_0x2d71('0x19')];this[_0x2d71('0x1a')]=_0x1e6483[_0x2d71('0x1a')];this[_0x2d71('0x1b')]=moment()[_0x2d71('0x1c')](_0x2d71('0x1d'));this[_0x2d71('0x1e')]=getSeconds(_0x1e6483[_0x2d71('0x1a')],_0x1e6483['starttime']);this[_0x2d71('0x1f')]=0x0;this[_0x2d71('0x20')]=getSeconds(this['endtime'],_0x1e6483[_0x2d71('0x1a')]);this[_0x2d71('0xa')]=_0x1e6483[_0x2d71('0xa')];this['membername']=_0x2d71('0x21');this[_0x2d71('0x22')]=_0x38c51a[_0x2d71('0x23')];this[_0x2d71('0x24')]=_0x1e6483['callback'];this[_0x2d71('0x25')]=_0x1e6483['callbackuniqueid'];this[_0x2d71('0x26')]=_0x1e6483[_0x2d71('0x26')];this[_0x2d71('0x27')]=_0x1e6483[_0x2d71('0x27')];this[_0x2d71('0x28')]=_0x1e6483['ContactId'];this[_0x2d71('0x29')]=_0x1e6483['ListId'];this['UserId']=_0x1e6483[_0x2d71('0x2a')];this['VoiceQueueId']=_0x1e6483[_0x2d71('0x2b')];this[_0x2d71('0x2c')]=_0x1e6483[_0x2d71('0x2c')];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index cd5a841..78f1926 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b6f=['seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','starttime','responsetime','holdtime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff'];(function(_0x12dfa1,_0x36ff32){var _0x5db581=function(_0x3f1237){while(--_0x3f1237){_0x12dfa1['push'](_0x12dfa1['shift']());}};_0x5db581(++_0x36ff32);}(_0x3b6f,0x1ad));var _0xf3b6=function(_0x173ea2,_0x2195f9){_0x173ea2=_0x173ea2-0x0;var _0x3ccbdd=_0x3b6f[_0x173ea2];return _0x3ccbdd;};'use strict';var util=require(_0xf3b6('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0xa4c614,_0x342f98){var _0x35e134=moment(_0xa4c614)['milliseconds'](0x0);var _0x4cb6f6=moment(_0x342f98)[_0xf3b6('0x1')](0x0);return _0x35e134[_0xf3b6('0x2')](_0x4cb6f6,_0xf3b6('0x3'));}function History(_0x229b05){this[_0xf3b6('0x4')]=_0x229b05[_0xf3b6('0x4')];this[_0xf3b6('0x5')]=_0x229b05[_0xf3b6('0x5')]||undefined;this[_0xf3b6('0x6')]=_0x229b05[_0xf3b6('0x6')];this[_0xf3b6('0x7')]=_0x229b05[_0xf3b6('0x6')]===_0xf3b6('0x8')?_0xf3b6('0x9'):_0x229b05[_0xf3b6('0x6')];this[_0xf3b6('0xa')]=_0x229b05[_0xf3b6('0xa')];this[_0xf3b6('0xb')]=_0x229b05[_0xf3b6('0xb')];this[_0xf3b6('0xc')]=_0x229b05[_0xf3b6('0xc')];this[_0xf3b6('0xd')]=_0x229b05['countbusyretry']+_0x229b05['countcongestionretry']+_0x229b05[_0xf3b6('0xc')]+_0x229b05[_0xf3b6('0xe')]+_0x229b05['countdropretry']+_0x229b05[_0xf3b6('0xf')]+_0x229b05[_0xf3b6('0x10')]+_0x229b05[_0xf3b6('0x11')];this[_0xf3b6('0xe')]=_0x229b05[_0xf3b6('0xe')];this[_0xf3b6('0x12')]=_0x229b05[_0xf3b6('0x12')];this[_0xf3b6('0xf')]=_0x229b05[_0xf3b6('0xf')];this[_0xf3b6('0x10')]=_0x229b05[_0xf3b6('0x10')];this['countagentrejectretry']=_0x229b05['countagentrejectretry'];this[_0xf3b6('0x9')]=_0x229b05[_0xf3b6('0x9')];this[_0xf3b6('0x13')]=_0x229b05[_0xf3b6('0x14')];this[_0xf3b6('0x15')]=_0x229b05['number'];this[_0xf3b6('0x16')]=_0x229b05[_0xf3b6('0x16')];this[_0xf3b6('0x17')]=_0x229b05['responsetime'];this['endtime']=_0x229b05[_0xf3b6('0x17')];this['ringtime']=getSeconds(_0x229b05[_0xf3b6('0x17')],_0x229b05[_0xf3b6('0x16')]);this[_0xf3b6('0x18')]=0x0;this['talktime']=0x0;this['callback']=_0x229b05['callback'];this[_0xf3b6('0x19')]=_0x229b05[_0xf3b6('0x19')];this[_0xf3b6('0x1a')]=_0x229b05[_0xf3b6('0x1a')];this[_0xf3b6('0x1b')]=_0x229b05['recallme'];this[_0xf3b6('0x1c')]=_0x229b05[_0xf3b6('0x1c')];this[_0xf3b6('0x1d')]=_0x229b05['ListId'];this[_0xf3b6('0x1e')]=_0x229b05[_0xf3b6('0x1e')];this[_0xf3b6('0x1f')]=_0x229b05[_0xf3b6('0x1f')];this['CampaignId']=_0x229b05[_0xf3b6('0x20')];this[_0xf3b6('0x21')]=_0x229b05[_0xf3b6('0x21')]||'';this[_0xf3b6('0x22')]=_0x229b05[_0xf3b6('0x22')]||'';}module[_0xf3b6('0x23')]=History; \ No newline at end of file +var _0xd64b=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x382a1c,_0x99b604){var _0x5f517d=function(_0x25418c){while(--_0x25418c){_0x382a1c['push'](_0x382a1c['shift']());}};_0x5f517d(++_0x99b604);}(_0xd64b,0xc1));var _0xbd64=function(_0x495c53,_0x5dd58b){_0x495c53=_0x495c53-0x0;var _0x20abe0=_0xd64b[_0x495c53];return _0x20abe0;};'use strict';var util=require(_0xbd64('0x0'));var _=require('lodash');var moment=require(_0xbd64('0x1'));function getSeconds(_0x4bfb7c,_0x30b9b3){var _0xcbecd5=moment(_0x4bfb7c)[_0xbd64('0x2')](0x0);var _0x3f1f05=moment(_0x30b9b3)[_0xbd64('0x2')](0x0);return _0xcbecd5['diff'](_0x3f1f05,'seconds');}function History(_0x54f916){this['uniqueid']=_0x54f916[_0xbd64('0x3')];this[_0xbd64('0x4')]=_0x54f916[_0xbd64('0x4')]||undefined;this[_0xbd64('0x5')]=_0x54f916[_0xbd64('0x5')];this[_0xbd64('0x6')]=_0x54f916[_0xbd64('0x5')]==='outbound'?'queue':_0x54f916[_0xbd64('0x5')];this[_0xbd64('0x7')]=_0x54f916[_0xbd64('0x7')];this['countcongestionretry']=_0x54f916[_0xbd64('0x8')];this[_0xbd64('0x9')]=_0x54f916[_0xbd64('0x9')];this[_0xbd64('0xa')]=_0x54f916['countbusyretry']+_0x54f916[_0xbd64('0x8')]+_0x54f916['countnoanswerretry']+_0x54f916[_0xbd64('0xb')]+_0x54f916[_0xbd64('0xc')]+_0x54f916[_0xbd64('0xd')]+_0x54f916[_0xbd64('0xe')]+_0x54f916[_0xbd64('0xf')];this[_0xbd64('0xb')]=_0x54f916[_0xbd64('0xb')];this[_0xbd64('0xc')]=_0x54f916[_0xbd64('0xc')];this['countabandonedretry']=_0x54f916[_0xbd64('0xd')];this[_0xbd64('0xe')]=_0x54f916[_0xbd64('0xe')];this[_0xbd64('0xf')]=_0x54f916[_0xbd64('0xf')];this['queue']=_0x54f916[_0xbd64('0x10')];this['calleridname']=_0x54f916[_0xbd64('0x11')];this[_0xbd64('0x12')]=_0x54f916[_0xbd64('0x13')];this[_0xbd64('0x14')]=_0x54f916[_0xbd64('0x14')];this[_0xbd64('0x15')]=_0x54f916[_0xbd64('0x15')];this[_0xbd64('0x16')]=_0x54f916['responsetime'];this[_0xbd64('0x17')]=getSeconds(_0x54f916[_0xbd64('0x15')],_0x54f916['starttime']);this['holdtime']=0x0;this[_0xbd64('0x18')]=0x0;this[_0xbd64('0x19')]=_0x54f916[_0xbd64('0x19')];this[_0xbd64('0x1a')]=_0x54f916[_0xbd64('0x1a')];this[_0xbd64('0x1b')]=_0x54f916['callbackat'];this['recallme']=_0x54f916[_0xbd64('0x1c')];this[_0xbd64('0x1d')]=_0x54f916[_0xbd64('0x1d')];this[_0xbd64('0x1e')]=_0x54f916['ListId'];this['UserId']=_0x54f916[_0xbd64('0x1f')];this['VoiceQueueId']=_0x54f916[_0xbd64('0x20')];this['CampaignId']=_0x54f916[_0xbd64('0x21')];this[_0xbd64('0x22')]=_0x54f916[_0xbd64('0x22')]||'';this[_0xbd64('0x23')]=_0x54f916['originatecalleridname']||'';}module[_0xbd64('0x24')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 7c560b8..a96acd8 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 _0x42c0=['syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','push','Action','command','iftime\x20%s,%s','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','launchHandleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','map','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','getCaller','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','averageHandleTime','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','debug','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','starttime','clearZombieChannels','[uniqueid]','actions','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','saveInDb','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','active','SIP/%s','reachable','unmonitored','syncVarSet','variable','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','state','statedesc','HangupInAMD','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','AMD','countmachineretry','custom:amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','VoiceQueueId','[rescheduleContact][Machine]','value','MACHINE','countglobal','emit','countcongestionretry','countnosuchnumberretry','createStateFinal','add','minutes','YYYY-MM-DD\x20HH:mm:ss','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls'];(function(_0x286753,_0x105c4c){var _0x93ab72=function(_0x39794c){while(--_0x39794c){_0x286753['push'](_0x286753['shift']());}};_0x93ab72(++_0x105c4c);}(_0x42c0,0xe8));var _0x042c=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x42c0[_0x1203f];return _0x365f0a;};'use strict';var util=require(_0x042c('0x0'));var _=require(_0x042c('0x1'));var uuid=require('uuid');var moment=require(_0x042c('0x2'));var rr=require('rr');var md5=require(_0x042c('0x3'));var Redis=require(_0x042c('0x4'));var ut=require('../preview/util/util');var config=require(_0x042c('0x5'));var logger=require(_0x042c('0x6'))(_0x042c('0x7'));var loggerBooked=require(_0x042c('0x6'))(_0x042c('0x8'));var loggerPredictive=require(_0x042c('0x6'))(_0x042c('0x9'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x042c('0x6'))(_0x042c('0xa'));var ami=require(_0x042c('0xb'));config[_0x042c('0xc')]=_[_0x042c('0xd')](config[_0x042c('0xc')],{'host':_0x042c('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x042c('0xc')]));var cmHopper=require(_0x042c('0xf'));var cmHopperHistory=require(_0x042c('0x10'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x042c('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x042c('0x12'));var Action=require(_0x042c('0x13'));var History=require(_0x042c('0x14'));var Final=require(_0x042c('0x15'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x042c('0x16'));var Hangup=require(_0x042c('0x17'));var ipAgi=process['env'][_0x042c('0x18')]||_0x042c('0x19');var strategy={'rrmemory':_0x042c('0x1a'),'roundrobin':_0x042c('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x042c('0x1c')][_0x042c('0x1d')]=function(_0x40d981){this['tail']=this[_0x042c('0x1e')]?this['tail'][_0x042c('0x1f')](_0x40d981):_0x40d981();};function Dialer(_0x2575c5,_0x56f7ca){this[_0x042c('0x20')]=new Sequence();this['preview']=_0x56f7ca;this[_0x042c('0x21')]=_0x2575c5[_0x042c('0x21')];this[_0x042c('0x22')]=_0x2575c5[_0x042c('0x22')];this[_0x042c('0x23')]=_0x2575c5['agents'];this[_0x042c('0x24')]=_0x2575c5[_0x042c('0x24')];this['maxNumberOriginate']=config[_0x042c('0x25')]||0x2;this[_0x042c('0x26')]={};this['actions']={};this['contactsId']={};this[_0x042c('0x27')]={};this['optionPredictive']={};this[_0x042c('0x28')]={};this[_0x042c('0x29')]={};this['ivrOriginated']={};this[_0x042c('0x2a')]={};this[_0x042c('0x2b')]={};ami['on'](_0x042c('0x2c'),this['syncAgentConnect'][_0x042c('0x2d')](this));ami['on'](_0x042c('0x2e'),this[_0x042c('0x2f')][_0x042c('0x2d')](this));ami['on'](_0x042c('0x30'),this['syncOriginateResponse']['bind'](this));ami['on']('agentcomplete',this[_0x042c('0x31')][_0x042c('0x2d')](this));ami['on']('custom:queuesummary',this[_0x042c('0xa')][_0x042c('0x2d')](this));ami['on'](_0x042c('0x32'),this[_0x042c('0x33')]['bind'](this));ami['on'](_0x042c('0x34'),this[_0x042c('0x35')][_0x042c('0x2d')](this));ami['on'](_0x042c('0x36'),this[_0x042c('0x37')][_0x042c('0x2d')](this));ami['on'](_0x042c('0x38'),this['syncVarSet'][_0x042c('0x2d')](this));ami['on']('queuemember',this[_0x042c('0x39')][_0x042c('0x2d')](this));ami['on'](_0x042c('0x3a'),this[_0x042c('0x3b')][_0x042c('0x2d')](this));this['loopCampaigns']();this[_0x042c('0x3c')]();RpcSetting[_0x042c('0x3d')]()[_0x042c('0x3e')](function(_0x406a9a){previewRecallmeReminderInterval=_0x406a9a[_0x042c('0x3f')];});}function isNotNull(_0x4153ad){return _0x4153ad!==null&&!_[_0x042c('0x40')](_0x4153ad);}function checkIsLoggedIn(_0x500aa3,_0x562630){return function(){if(_0x562630<=0x0){_0x500aa3[_0x042c('0x41')]=_0x042c('0x42');throw _0x500aa3['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4e5ec7){return _0x4e5ec7;}function checkIsActive(_0x292f48,_0x1ccf83){return function(){if(!isActive(_0x1ccf83)){_0x292f48[_0x042c('0x41')]=_0x042c('0x43');throw _0x292f48[_0x042c('0x44')]+_0x042c('0x45');}};}function checkInterval(_0x1b1edc){return function(){if(!isNotNull(_0x1b1edc[_0x042c('0x46')])){_0x1b1edc[_0x042c('0x41')]=_0x042c('0x47');throw _0x1b1edc[_0x042c('0x44')]+_0x042c('0x48');}if(!isNotNull(_0x1b1edc[_0x042c('0x46')][_0x042c('0x49')])){_0x1b1edc[_0x042c('0x41')]=_0x042c('0x47');throw _0x1b1edc['name']+_0x042c('0x48');}if(!isNotNull(_[_0x042c('0x4a')](_0x1b1edc[_0x042c('0x46')][_0x042c('0x49')]))){_0x1b1edc[_0x042c('0x41')]='INTERVAL_IS_NULL';throw _0x1b1edc['name']+_0x042c('0x48');}};}function msgResponse(_0xffa9bd,_0x124105,_0x3bdec8){return{'action':_0xffa9bd,'response':_0x124105,'message':_0x3bdec8,'stack':_0x3bdec8};}function myreject(_0x26eada){return function(_0x289a0e){return _0x26eada(msgResponse(_0x042c('0x4b'),_0x042c('0x4c'),JSON['stringify'](_0x289a0e)));};}function getSeconds(_0x4a21fa,_0x2e2737){var _0x2bcffa=moment(_0x4a21fa)[_0x042c('0x4d')](0x0);var _0x10c9fd=moment(_0x2e2737)[_0x042c('0x4d')](0x0);return _0x2bcffa[_0x042c('0x4e')](_0x10c9fd,_0x042c('0x4f'));}function emit(_0x543c3b,_0x2062d9,_0x13098b){io['to'](_0x543c3b)['emit'](_0x2062d9,_0x13098b);}function emitVoiceQueueSummary(_0x2a65b3){if(_0x2a65b3[_0x042c('0x50')]===_0x042c('0x51')){var _0x608970={'id':_0x2a65b3['id'],'name':_0x2a65b3[_0x042c('0x44')],'strategy':_0x2a65b3[_0x042c('0x52')],'answered':_0x2a65b3[_0x042c('0x53')],'available':_0x2a65b3[_0x042c('0x54')],'loggedIn':_0x2a65b3[_0x042c('0x55')],'pTalking':_0x2a65b3[_0x042c('0x56')],'sumBillable':_0x2a65b3[_0x042c('0x57')],'sumDuration':_0x2a65b3[_0x042c('0x58')],'sumHoldTime':_0x2a65b3[_0x042c('0x59')]||0x0,'talking':_0x2a65b3[_0x042c('0x5a')],'total':_0x2a65b3[_0x042c('0x5b')],'type':_0x2a65b3['type'],'unmanaged':_0x2a65b3[_0x042c('0x5c')],'abandoned':_0x2a65b3[_0x042c('0x5d')],'waiting':_0x2a65b3[_0x042c('0x5e')],'loggedInDb':_0x2a65b3['loggedInDb'],'dialActive':_0x2a65b3['dialActive'],'dialMethod':_0x2a65b3[_0x042c('0x5f')],'dialOriginateCallerIdName':_0x2a65b3['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x2a65b3[_0x042c('0x60')],'dialOriginateTimeout':_0x2a65b3[_0x042c('0x61')],'dialPrefix':_0x2a65b3[_0x042c('0x62')],'outboundAnswerAgiCallsDay':_0x2a65b3[_0x042c('0x63')],'outboundAnswerCallsDay':_0x2a65b3[_0x042c('0x64')],'outboundBlacklistCallsDay':_0x2a65b3['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x2a65b3[_0x042c('0x65')],'outboundCongestionCallsDay':_0x2a65b3['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x2a65b3[_0x042c('0x66')],'outboundDropCallsDayCallersExit':_0x2a65b3[_0x042c('0x67')],'outboundDropCallsDayTimeout':_0x2a65b3[_0x042c('0x68')],'outboundNoAnswerCallsDay':_0x2a65b3[_0x042c('0x69')],'outboundNoSuchCallsDay':_0x2a65b3['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x2a65b3[_0x042c('0x6a')],'outboundReCallsDay':_0x2a65b3['outboundReCallsDay'],'outboundRejectCallsDay':_0x2a65b3[_0x042c('0x6b')],'outboundUnknownCallsDay':_0x2a65b3[_0x042c('0x6c')],'predictiveIntervalAnsweredCalls':_0x2a65b3[_0x042c('0x6d')],'predictiveIntervalAvgHoldtime':_0x2a65b3[_0x042c('0x6e')],'predictiveIntervalAvgTalktime':_0x2a65b3[_0x042c('0x6f')],'predictiveIntervalDroppedCallsCallersExit':_0x2a65b3[_0x042c('0x70')],'predictiveIntervalDroppedCallsTimeout':_0x2a65b3['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x2a65b3[_0x042c('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x2a65b3[_0x042c('0x72')],'predictiveIntervalHitRate':_0x2a65b3[_0x042c('0x73')],'predictiveIntervalMultiplicativeFactor':_0x2a65b3[_0x042c('0x74')],'predictiveIntervalPauses':_0x2a65b3[_0x042c('0x75')],'predictiveIntervalAvailable':_0x2a65b3['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x2a65b3[_0x042c('0x76')],'message':_0x2a65b3[_0x042c('0x41')],'originated':_0x2a65b3[_0x042c('0x77')],'erlangCalls':_0x2a65b3[_0x042c('0x78')],'erlangCallToSecond':_0x2a65b3[_0x042c('0x79')],'erlangAbandonmentRate':_0x2a65b3[_0x042c('0x7a')],'erlangBusyFactor':_0x2a65b3[_0x042c('0x7b')],'startPredictive':_0x2a65b3[_0x042c('0x28')],'startProgressive':_0x2a65b3['startProgressive']};if(_0x2a65b3[_0x042c('0x7c')]){_0x608970[_0x042c('0x7c')]={'id':_0x2a65b3[_0x042c('0x7c')]['id'],'name':_0x2a65b3[_0x042c('0x7c')][_0x042c('0x44')],'active':_0x2a65b3[_0x042c('0x7c')]['active'],'callerid':_0x2a65b3['Trunk'][_0x042c('0x7d')]};}if(_0x2a65b3[_0x042c('0x46')]){_0x608970[_0x042c('0x46')]={'id':_0x2a65b3['Interval']['id'],'name':_0x2a65b3[_0x042c('0x46')][_0x042c('0x44')]};}var _0x3731ec=md5(JSON[_0x042c('0x7e')](_0x608970));if(_0x2a65b3[_0x042c('0x3')]!==_0x3731ec){_0x2a65b3[_0x042c('0x3')]=_0x3731ec;emit(util[_0x042c('0x7f')](_0x042c('0x80'),_0x608970[_0x042c('0x44')]),_0x042c('0x81'),_0x608970);}}}function emitCampaignSummary(_0xb02a0d){if(_0xb02a0d[_0x042c('0x50')]===_0x042c('0x82')){emit(util['format'](_0x042c('0x83'),_0xb02a0d[_0x042c('0x44')]),_0x042c('0x84'),_0xb02a0d);}}function checkGetDataPredictive(_0x3b2460){if(isNotNull(_0x3b2460)&&!_[_0x042c('0x4a')](_0x3b2460)){loggerPredictive[_0x042c('0x85')](_0x042c('0x86'));loggerPredictive[_0x042c('0x85')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b2460[_0x042c('0x76')]);loggerPredictive[_0x042c('0x85')](_0x042c('0x87'),_0x3b2460[_0x042c('0x6d')]);loggerPredictive['info'](_0x042c('0x88'),_0x3b2460[_0x042c('0x89')]);loggerPredictive['info'](_0x042c('0x8a'),_0x3b2460[_0x042c('0x70')]);loggerPredictive[_0x042c('0x85')](_0x042c('0x8b'),_0x3b2460['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x042c('0x85')](_0x042c('0x8c'),_0x3b2460[_0x042c('0x6f')]);loggerPredictive[_0x042c('0x85')](_0x042c('0x8d'));if(_0x3b2460[_0x042c('0x76')]>0x0){if(!_[_0x042c('0x40')](_0x3b2460['predictiveIntervalAvgTalktime'])&&_0x3b2460['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x042c('0x85')](_0x042c('0x8e'));if(!_[_0x042c('0x40')](_0x3b2460['predictiveIntervalAvgHoldtime'])&&_0x3b2460[_0x042c('0x6e')]>0x0){return!![];}loggerPredictive[_0x042c('0x85')](_0x042c('0x8f'));}else{loggerPredictive['info'](_0x042c('0x90'));}}else{loggerPredictive[_0x042c('0x85')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x6ff98a){return function(_0x3b5b11){loggerPredictive[_0x042c('0x85')](_0x042c('0x91'));loggerPredictive[_0x042c('0x85')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b5b11[_0x042c('0x78')]);loggerPredictive[_0x042c('0x85')](_0x042c('0x92'),_0x3b5b11[_0x042c('0x79')]);loggerPredictive[_0x042c('0x85')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b5b11['erlangAbandonmentRate']);loggerPredictive[_0x042c('0x85')](_0x042c('0x93'),_0x3b5b11[_0x042c('0x7b')]);loggerPredictive[_0x042c('0x85')](_0x042c('0x94'),_0x3b5b11['erlangAbandonmentRate']);loggerPredictive[_0x042c('0x85')](_0x042c('0x8d'));_[_0x042c('0x95')](_0x6ff98a,_0x3b5b11);};}function getDiff(_0x50b164){var _0x16973a=moment()[_0x042c('0x4d')](0x0);var _0x480d91=moment(_0x50b164)[_0x042c('0x4d')](0x0);return _0x16973a[_0x042c('0x4e')](_0x480d91,_0x042c('0x4f'));}function ifInterval(_0x56156a,_0x3ae41f){if(_[_0x042c('0x40')](_0x3ae41f)){return![];}return getDiff(_0x3ae41f)<_0x56156a*0x3c;}function freeVariablesPredictive(_0x104dd5){if(isNotNull(_0x104dd5)){if(!_['isUndefined'](_0x104dd5[_0x042c('0x29')])){_0x104dd5[_0x042c('0x29')]=undefined;loggerPredictive[_0x042c('0x85')](_0x104dd5[_0x042c('0x44')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x042c('0x40')](_0x104dd5[_0x042c('0x28')])){_0x104dd5[_0x042c('0x28')]=undefined;loggerPredictive[_0x042c('0x85')](_0x104dd5['name'],_0x042c('0x96'));}if(!_[_0x042c('0x40')](_0x104dd5[_0x042c('0x97')])){clearInterval(_0x104dd5['handlePredictive']);_0x104dd5[_0x042c('0x97')]=undefined;loggerPredictive[_0x042c('0x85')](_0x104dd5[_0x042c('0x44')],_0x042c('0x98'));}}}function erlangb(_0xf07960,_0x521783){if(_0x521783===0x0){return 0x0;}var _0x3ad44a=0x1;for(var _0xfc24c1=0x1;_0xfc24c1<=_0x521783;_0xfc24c1+=0x1){_0x3ad44a=0x1+_0x3ad44a*_0xfc24c1/_0xf07960;}return 0x1/_0x3ad44a;}function isVoiceQueueOutbound(_0x3aa485){return _0x3aa485==='outbound';}function isNotPreview(_0x1fdc41){return _0x1fdc41!==_0x042c('0x99');}function isCampaignIvr(_0x241ac5){return _0x241ac5===_0x042c('0x82');}function getCallerId(_0x2ff9cd,_0x518b98,_0x188f8d){if(!_['isUndefined'](_0x188f8d)&&typeof _0x188f8d===_0x042c('0x9a')&&!_[_0x042c('0x4a')](_0x188f8d)){if(!_['isUndefined'](_0x518b98)&&typeof _0x518b98===_0x042c('0x9a')&&!_['isEmpty'](_0x518b98)){return util[_0x042c('0x7f')](_0x042c('0x9b'),_0x518b98,_0x188f8d);}return util['format']('\x22%s\x22\x20<%s>',_0x188f8d,_0x188f8d);}if(!_[_0x042c('0x40')](_0x2ff9cd)&&typeof _0x2ff9cd===_0x042c('0x9a')&&!_['isEmpty'](_0x2ff9cd)){return _0x2ff9cd;}return _0x042c('0x9c');}function loggerCatchQueueSummary(_0x283a3a,_0x2ca6a5){return function(_0xc0f759){freeVariablesPredictive(_0x2ca6a5);emitVoiceQueueSummary(_0x2ca6a5);emitCampaignSummary(_0x2ca6a5);loggerSyncQueueSummary['debug'](_0x283a3a,util[_0x042c('0x9d')](_0xc0f759,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x530bb0,_0x35c7b5){return function(_0x3392c8){loggerPredictive[_0x042c('0x9e')](_0x35c7b5[_0x042c('0x44')],_0x530bb0);loggerPredictive['error'](_0x3392c8[_0x042c('0x9f')]);freeVariablesPredictive(_0x35c7b5);};}function loggerCatch(_0x549f47){return function(_0x32bc44){logger[_0x042c('0x9e')](_0x549f47,util[_0x042c('0x9d')](_0x32bc44,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x21c4d6){return _0x21c4d6&&!_[_0x042c('0x40')](_0x21c4d6)&&_0x21c4d6[_0x042c('0xa0')]>0x0;}function decremetOriginate(_0x16fcd0){if(!_[_0x042c('0x40')](_0x16fcd0)&&_0x16fcd0!==null){if(typeof _0x16fcd0[_0x042c('0x77')]!==_0x042c('0xa1')){if(_0x16fcd0[_0x042c('0x77')]>0x0){_0x16fcd0['originated']-=0x1;}else{logger[_0x042c('0x9e')](_0x042c('0xa2'));}}}else{logger[_0x042c('0x9e')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4838e6,_0x3c8141,_0x21b27c){if(_0x3c8141>_0x21b27c){for(var _0x40cb93=0x0;_0x40cb93<_0x3c8141-_0x21b27c;_0x40cb93+=0x1){decremetOriginate(_0x4838e6);}}}function loggerGetContactDialer(_0xc7b742,_0x165230,_0xd5e0cf){return function(_0x507a14){checkContactLowerLimitOriginate(_0x165230,_0xd5e0cf,0x0);logger[_0x042c('0x9e')](_0xc7b742,util[_0x042c('0x9d')](_0x507a14,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x7443a9){return function(_0x495490){if(isNotNull(_0x495490)&&isNotNull(_0x495490[0x0])){if(_0x495490[0x0][_0x042c('0xa3')]>0x0){_0x7443a9['message']=_0x042c('0xa4');logger['info'](_0x042c('0xa5')+_0x7443a9[_0x042c('0x44')],_0x495490[0x0][_0x042c('0xa3')],'contacts');}else{_0x7443a9['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x042c('0x85')]('[getContactDialer2][Empty]'+_0x7443a9[_0x042c('0x44')]);}}};}function notSendMessagesQueue(_0x27aa2b){if(_0x27aa2b['sendMessageOneNotActive']){freeVariablesPredictive(_0x27aa2b);if(_0x27aa2b['originated']===0x0&&_0x27aa2b['talking']===0x0&&_0x27aa2b[_0x042c('0x5e')]===0x0&&(_0x27aa2b[_0x042c('0x56')]||0x0)===0x0){_0x27aa2b[_0x042c('0xa6')]=![];_0x27aa2b['available']=0x0;_0x27aa2b[_0x042c('0x41')]=_0x042c('0x43');loggerSyncQueueSummary['debug'](_0x042c('0xa7'),_0x27aa2b[_0x042c('0x44')],'is\x20not\x20active');}else{_0x27aa2b['message']=_0x042c('0xa8');loggerSyncQueueSummary[_0x042c('0xa9')](_0x042c('0xa7'),_0x27aa2b['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x27aa2b);}}function notSendMessagesCampaign(_0x2a6d26){if(_0x2a6d26[_0x042c('0xa6')]){if(_0x2a6d26[_0x042c('0x77')]===0x0){_0x2a6d26['sendMessageOneNotActive']=![];_0x2a6d26[_0x042c('0x41')]=_0x042c('0x43');loggerSyncQueueSummary['debug'](_0x042c('0xaa'),_0x2a6d26[_0x042c('0x44')],_0x042c('0xab'));}else{_0x2a6d26['message']=_0x042c('0xa8');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2a6d26[_0x042c('0x44')],_0x042c('0xac'));}emitCampaignSummary(_0x2a6d26);}}function createObjHistory(_0x2cd9a0,_0x5165b1,_0x44d6f0,_0x1d1ef2,_0x3d1e50){_0x2cd9a0[_0x042c('0x41')]=_0x44d6f0;var _0x21c2ad=new Action(_0x2cd9a0,_0x5165b1);var _0x2ae580=new History(_0x21c2ad);_0x2ae580['state']=_0x1d1ef2;_0x2ae580['statedesc']=_0x3d1e50;_0x2ae580['endtime']=_0x21c2ad[_0x042c('0xad')];return _0x2ae580;}Dialer[_0x042c('0x1c')]['loopClearZombieChannels']=function(){var _0x20c2b9=this;setInterval(function(){_0x20c2b9[_0x042c('0xae')](_0x20c2b9[_0x042c('0x27')],_0x042c('0xaf'));_0x20c2b9['clearZombieChannels'](_0x20c2b9[_0x042c('0xb0')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0xe84210,_0x5737de){var _0x3e3588=this;for(var _0x1bb628 in _0xe84210){if(typeof _0xe84210[_0x1bb628]!==_0x042c('0xa1')){this['sequence']['enqueue'](function(){if(!_[_0x042c('0xb1')](_0xe84210[_0x1bb628])){return ami['Action']({'action':_0x042c('0xb2'),'channel':_0xe84210[_0x1bb628][_0x042c('0xb3')]})[_0x042c('0xb4')](function(_0x5c1b3c){if(_0x5c1b3c[_0x042c('0x41')]===_0x042c('0xb5')){setTimeout(function(){if(_0xe84210[_0x1bb628]&&_0xe84210[_0x1bb628][_0x042c('0x50')]!==_0x042c('0x82')){_0x3e3588[_0x042c('0xb6')](_0x3e3588[_0x042c('0x21')][_0xe84210[_0x1bb628][_0x042c('0xb7')]]);logger['error'](_0x042c('0xb8'),_0x5737de,_0x1bb628,_0xe84210[_0x1bb628][_0x042c('0xb7')]);delete _0xe84210[_0x1bb628];}if(_0xe84210[_0x1bb628]&&_0xe84210[_0x1bb628][_0x042c('0x50')]===_0x042c('0x82')){_0x3e3588['updateOriginated'](_0x3e3588[_0x042c('0x22')][_0xe84210[_0x1bb628][_0x042c('0xb7')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x5737de,_0x1bb628,_0xe84210[_0x1bb628][_0x042c('0xb7')]);delete _0xe84210[_0x1bb628];}},0x2328);}});}});}}};Dialer['prototype'][_0x042c('0xb9')]=function(_0x471f69){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopper[_0x042c('0xb9')](_0x471f69))[_0x042c('0xb4')](loggerCatch(_0x042c('0xbb')));};Dialer[_0x042c('0x1c')][_0x042c('0xbc')]=function(_0x144ab1){return Promise['resolve']()['then'](cmHopperBlack[_0x042c('0xbc')](_0x144ab1))[_0x042c('0xb4')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x042c('0xbd')]=function(_0xe80147,_0x28e2ac,_0x258444){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0xe80147,_0x28e2ac,_0x258444))[_0x042c('0xb4')](loggerCatch(_0x042c('0xbe')));};Dialer[_0x042c('0x1c')][_0x042c('0xbf')]=function(_0x3a8aca,_0x3938d0,_0xccff0f){return Promise['resolve']()[_0x042c('0x3e')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x3a8aca,_0x3938d0,_0xccff0f))[_0x042c('0xb4')](loggerCatch(_0x042c('0xc0')));};Dialer[_0x042c('0x1c')][_0x042c('0xc1')]=function(_0x3b0b64){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopperBlack[_0x042c('0xc1')](_0x3b0b64))['catch'](loggerCatch(_0x042c('0xc2')));};Dialer[_0x042c('0x1c')]['averageHandleTime']=function(_0x2cc118){return Promise['resolve']()[_0x042c('0x3e')](cmHopperHistory[_0x042c('0xc3')](_0x2cc118))[_0x042c('0xb4')](loggerCatch(_0x042c('0xc4')));};Dialer[_0x042c('0x1c')][_0x042c('0xc5')]=function(_0x7400ae){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopper[_0x042c('0xc5')](_0x7400ae))[_0x042c('0xb4')](loggerCatch(_0x042c('0xc6')));};Dialer[_0x042c('0x1c')]['unlockContact']=function(_0x16cda2,_0x273a99,_0x863f49){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopper[_0x042c('0xc7')](_0x16cda2,_0x273a99,_0x863f49))[_0x042c('0xb4')](loggerCatch(_0x042c('0xc8')));};Dialer['prototype'][_0x042c('0xc9')]=function(_0x5bf9d0,_0x90176,_0x3ac515,_0x275633,_0x1f86ea){return Promise[_0x042c('0xba')]()['then'](cmHopper['getContactDialer'](_0x5bf9d0,_0x90176,_0x3ac515,_0x275633))[_0x042c('0xb4')](function(_0x2832de){_0x1f86ea[_0x042c('0xca')]-=_0x3ac515;_0x1f86ea[_0x042c('0xca')]=_0x1f86ea[_0x042c('0xca')]>0x0?_0x1f86ea[_0x042c('0xca')]:0x0;loggerCatch('[getContactDialer]\x20')(_0x2832de);});};Dialer[_0x042c('0x1c')]['getContactDialerIvr']=function(_0x49b94d,_0x21c2b8,_0x27d6a3,_0x50bb89){return Promise['resolve']()[_0x042c('0x3e')](cmHopper[_0x042c('0xcb')](_0x49b94d,_0x21c2b8,_0x27d6a3))[_0x042c('0xb4')](function(_0x29a616){_0x50bb89[_0x042c('0xca')]-=_0x21c2b8;_0x50bb89['temp']=_0x50bb89['temp']>0x0?_0x50bb89['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x29a616);});};Dialer[_0x042c('0x1c')]['getVoiceQueueRtPauses']=function(_0x21cfff){return Promise['resolve']()['then'](voiceQueueRt[_0x042c('0xcc')](_0x21cfff))[_0x042c('0xb4')](loggerCatch(_0x042c('0xcd')));};Dialer['prototype'][_0x042c('0xce')]=function(_0x36a38e){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopper[_0x042c('0xce')](_0x36a38e))[_0x042c('0xb4')](loggerCatch(_0x042c('0xcf')));};Dialer[_0x042c('0x1c')][_0x042c('0xd0')]=function(_0x23c922){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopperHistory[_0x042c('0xd0')](_0x23c922))[_0x042c('0xb4')](loggerCatch(_0x042c('0xd1')));};Dialer[_0x042c('0x1c')][_0x042c('0xb6')]=function(_0x55c2cb){if(!_[_0x042c('0x40')](_0x55c2cb)&&_0x55c2cb!==null){if(typeof _0x55c2cb[_0x042c('0x77')]!==_0x042c('0xa1')){if(_0x55c2cb[_0x042c('0x77')]>0x0){_0x55c2cb['originated']-=0x1;}else{logger[_0x042c('0x9e')](_0x042c('0xd2'));}}}else{logger[_0x042c('0x9e')](_0x042c('0xd3'));}};Dialer[_0x042c('0x1c')]['loggerHandler']=function(_0x5f3c99,_0x387b2e){var _0x16421e=this;return function(_0x24d161){_0x16421e['updateOriginated'](_0x387b2e);logger['error'](_0x5f3c99,util[_0x042c('0x9d')](_0x24d161,{'showHidden':![],'depth':null}));};};Dialer[_0x042c('0x1c')][_0x042c('0xd4')]=function(_0x400f9f,_0x35b142,_0x5b5c32){var _0x900c4b={'state':0x19,'statedesc':_0x042c('0xd5')};this[_0x042c('0xb6')](_0x35b142);this[_0x042c('0xd6')](_[_0x042c('0x95')](_0x900c4b,_[_0x042c('0xd7')](_0x5b5c32,[_0x042c('0xd8'),_0x042c('0xd9'),'UserId','VoiceQueueId',_0x042c('0xda')])),_0x042c('0xdb'),_0x042c('0xdc'));logger[_0x042c('0x9e')](_0x400f9f);};Dialer[_0x042c('0x1c')][_0x042c('0xdd')]=function(_0x29ed4c){return _0x29ed4c===_0x042c('0xde');};Dialer[_0x042c('0x1c')]['isTrunkReachable']=function(_0x50bf13){return!_[_0x042c('0x40')](_0x50bf13)&&_0x50bf13&&!_['isUndefined'](_0x50bf13[_0x042c('0x44')])&&!_[_0x042c('0x40')](_0x50bf13[_0x042c('0xdf')])&&_0x50bf13[_0x042c('0xdf')]&&(this['trunks'][util[_0x042c('0x7f')](_0x042c('0xe0'),_0x50bf13[_0x042c('0x44')])]['status']===_0x042c('0xe1')||this[_0x042c('0x24')][util[_0x042c('0x7f')](_0x042c('0xe0'),_0x50bf13[_0x042c('0x44')])]['status']===_0x042c('0xe2'));};Dialer[_0x042c('0x1c')]['saveInDb']=function(_0x1cf2a4,_0x4fe57d,_0x4593ad){this['createHistory'](_0x1cf2a4)[_0x042c('0xb4')](loggerCatch(_0x4fe57d));this[_0x042c('0xce')](_0x1cf2a4)[_0x042c('0xb4')](loggerCatch(_0x4593ad));};Dialer[_0x042c('0x1c')][_0x042c('0xe3')]=function(_0x5e6481){var _0x167d64=this;var _0x1ac7c1=this[_0x042c('0x27')][_0x5e6481['uniqueid']];var _0x1e771f;if(!_['isNil'](_0x5e6481)&&!_[_0x042c('0xb1')](_0x5e6481[_0x042c('0xe4')])&&!_[_0x042c('0xb1')](_0x5e6481[_0x042c('0xe4')]['amdstatus'])&&_0x5e6481[_0x042c('0xe5')]===_0x042c('0xe6')&&_0x1ac7c1){if(_0x1ac7c1[_0x042c('0x50')]!=='ivr'&&this['voiceQueues'][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0xe7')]&&_0x5e6481['value']===_0x042c('0xe8')){delete this['uniqueId'][_0x5e6481[_0x042c('0xe9')]];this[_0x042c('0xb6')](this['voiceQueues'][_0x1ac7c1[_0x042c('0xb7')]]);this[_0x042c('0x21')][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x64')]+=0x1;this['voiceQueues'][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x63')]+=0x1;_0x1e771f=new Hangup(_0x1ac7c1,_0x5e6481);_0x1e771f[_0x042c('0xea')]=0x12;_0x1e771f[_0x042c('0xeb')]=_0x042c('0xec');_0x1e771f['membername']='AMD';ami['emit']('custom:amd',ut['buildObj'](_0x1e771f,_0x042c('0xed')));this[_0x042c('0xd6')](_0x1e771f,_0x042c('0xee'),_0x042c('0xef'));}if(_0x1ac7c1[_0x042c('0x50')]!=='ivr'&&this['voiceQueues'][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0xe7')]&&_0x5e6481['value']==='MACHINE'){return new Promise(function(_0x503f8b,_0x1898fd){delete _0x167d64[_0x042c('0x27')][_0x5e6481['uniqueid']];_0x167d64[_0x042c('0xb6')](_0x167d64['voiceQueues'][_0x1ac7c1['queue']]);_0x167d64[_0x042c('0x21')][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x64')]+=0x1;_0x167d64['voiceQueues'][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x63')]+=0x1;var _0x499fcd=_0x167d64[_0x042c('0x21')][_0x1ac7c1[_0x042c('0xb7')]];var _0x1dab9a=new Hangup(_0x1ac7c1,_0x5e6481);_0x1dab9a[_0x042c('0xea')]=0x13;_0x1dab9a[_0x042c('0xeb')]=_0x042c('0xf0');_0x1dab9a[_0x042c('0xf1')]=_0x042c('0xf2');_0x1dab9a[_0x042c('0xf3')]+=0x1;_0x1dab9a['countglobal']+=0x1;_0x1dab9a[_0x042c('0xed')]=!![];ami['emit'](_0x042c('0xf4'),ut[_0x042c('0xf5')](_0x1dab9a,_0x042c('0xed')));_0x167d64['createHistory'](_0x1dab9a)[_0x042c('0xb4')](loggerCatch(_0x042c('0xf6')));if(_0x1dab9a[_0x042c('0xf7')]+_0x1dab9a['countcongestionretry']+_0x1dab9a[_0x042c('0xf8')]+_0x1dab9a['countnosuchnumberretry']+_0x1dab9a[_0x042c('0xf9')]+_0x1dab9a[_0x042c('0xfa')]+_0x1dab9a[_0x042c('0xf3')]+_0x1dab9a[_0x042c('0xfb')]>=_0x499fcd[_0x042c('0xfc')]){_0x167d64[_0x042c('0xfd')](_0x1dab9a,_0x503f8b,_0x1898fd,'reason19\x20machine....');}else{if(_0x1dab9a[_0x042c('0xf3')]>=_0x499fcd[_0x042c('0xfe')]){_0x167d64['createStateFinal'](_0x1dab9a,_0x503f8b,_0x1898fd,_0x042c('0xff'));}else{_0x167d64[_0x042c('0xc5')]({'active':![],'countmachineretry':_0x1dab9a['countmachineretry'],'scheduledat':moment()['add'](_0x499fcd[_0x042c('0x100')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1dab9a[_0x042c('0xd8')],'ListId':_0x1dab9a[_0x042c('0xd9')],'VoiceQueueId':_0x1dab9a[_0x042c('0x101')]||undefined,'CampaignId':_0x1dab9a['CampaignId']||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x102')));_0x503f8b({'reschedule':0x1});}}});}if(_0x1ac7c1[_0x042c('0x50')]===_0x042c('0x82')&&this[_0x042c('0x22')][_0x1ac7c1['queue']][_0x042c('0xe7')]&&_0x5e6481[_0x042c('0x103')]==='HANGUP'){delete this[_0x042c('0x27')][_0x5e6481[_0x042c('0xe9')]];this[_0x042c('0xb6')](this[_0x042c('0x22')][_0x1ac7c1[_0x042c('0xb7')]]);_0x1e771f=new Hangup(_0x1ac7c1,_0x5e6481);_0x1e771f[_0x042c('0xea')]=0x12;_0x1e771f[_0x042c('0xeb')]='HangupInAMD';_0x1e771f[_0x042c('0xf1')]='AMD';ami['emit'](_0x042c('0xf4'),ut[_0x042c('0xf5')](_0x1e771f,_0x042c('0xed')));this[_0x042c('0xd6')](_0x1e771f,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x1ac7c1[_0x042c('0x50')]===_0x042c('0x82')&&this[_0x042c('0x22')][_0x1ac7c1[_0x042c('0xb7')]]['dialAMDActive']&&_0x5e6481[_0x042c('0x103')]===_0x042c('0x104')){return new Promise(function(_0x1ee62d,_0x5387b3){delete _0x167d64[_0x042c('0x27')][_0x5e6481[_0x042c('0xe9')]];_0x167d64[_0x042c('0xb6')](_0x167d64[_0x042c('0x22')][_0x1ac7c1[_0x042c('0xb7')]]);_0x167d64[_0x042c('0x22')][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x64')]+=0x1;_0x167d64[_0x042c('0x22')][_0x1ac7c1[_0x042c('0xb7')]][_0x042c('0x63')]+=0x1;var _0x200423=_0x167d64['campaigns'][_0x1ac7c1[_0x042c('0xb7')]];var _0x227823=new Hangup(_0x1ac7c1,_0x5e6481);_0x227823[_0x042c('0xea')]=0x13;_0x227823['statedesc']=_0x042c('0xf0');_0x227823[_0x042c('0xf1')]=_0x042c('0xf2');_0x227823['countmachineretry']+=0x1;_0x227823[_0x042c('0x105')]+=0x1;_0x227823[_0x042c('0xed')]=!![];ami[_0x042c('0x106')](_0x042c('0xf4'),ut[_0x042c('0xf5')](_0x227823,_0x042c('0xed')));_0x167d64[_0x042c('0xd0')](_0x227823)['catch'](loggerCatch(_0x042c('0xf6')));if(_0x227823[_0x042c('0xf7')]+_0x227823[_0x042c('0x107')]+_0x227823['countnoanswerretry']+_0x227823[_0x042c('0x108')]+_0x227823[_0x042c('0xf9')]+_0x227823['countabandonedretry']+_0x227823[_0x042c('0xf3')]+_0x227823[_0x042c('0xfb')]>=_0x200423[_0x042c('0xfc')]){_0x167d64[_0x042c('0xfd')](_0x227823,_0x1ee62d,_0x5387b3,'reason19\x20machine....');}else{if(_0x227823[_0x042c('0xf3')]>=_0x200423[_0x042c('0xfe')]){_0x167d64[_0x042c('0x109')](_0x227823,_0x1ee62d,_0x5387b3,'reason\x2019\x20machine....');}else{_0x167d64[_0x042c('0xc5')]({'active':![],'countmachineretry':_0x227823[_0x042c('0xf3')],'scheduledat':moment()[_0x042c('0x10a')](_0x200423['dialMachineRetryFrequency'],_0x042c('0x10b'))[_0x042c('0x7f')](_0x042c('0x10c')),'ContactId':_0x227823['ContactId'],'ListId':_0x227823[_0x042c('0xd9')],'VoiceQueueId':_0x227823['VoiceQueueId']||undefined,'CampaignId':_0x227823[_0x042c('0xda')]||undefined})[_0x042c('0xb4')](loggerCatch('[rescheduleContact][Machine]'));_0x1ee62d({'reschedule':0x1});}}});}}};Dialer[_0x042c('0x1c')][_0x042c('0x35')]=function(_0x3edba3){var _0x438e04=this[_0x042c('0x27')][_0x3edba3[_0x042c('0xe9')]];var _0x49fb8b;if(_0x438e04&&_0x438e04[_0x042c('0x50')]===_0x042c('0x82')){delete this[_0x042c('0x27')][_0x3edba3[_0x042c('0xe9')]];this[_0x042c('0xb6')](this[_0x042c('0x22')][_0x438e04[_0x042c('0xb7')]]);this[_0x042c('0x22')][_0x438e04[_0x042c('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x49fb8b=new Hangup(_0x438e04,_0x3edba3);this[_0x042c('0xd0')](_0x49fb8b)[_0x042c('0xb4')](loggerCatch(_0x042c('0x10d')));this[_0x042c('0xce')](_0x49fb8b)[_0x042c('0xb4')](loggerCatch(_0x042c('0x10e')));}if(_0x438e04&&_0x438e04[_0x042c('0x50')]!==_0x042c('0x82')&&isNotNull(this[_0x042c('0x21')][_0x438e04[_0x042c('0xb7')]][_0x042c('0x10f')])){delete this[_0x042c('0x27')][_0x3edba3[_0x042c('0xe9')]];this[_0x042c('0xb6')](this['voiceQueues'][_0x438e04[_0x042c('0xb7')]]);this[_0x042c('0x21')][_0x438e04[_0x042c('0xb7')]][_0x042c('0x64')]+=0x1;this['voiceQueues'][_0x438e04[_0x042c('0xb7')]][_0x042c('0x63')]+=0x1;_0x49fb8b=new Hangup(_0x438e04,_0x3edba3);_0x49fb8b['state']=0x10;_0x49fb8b['statedesc']=_0x042c('0x110');_0x49fb8b[_0x042c('0xf1')]='AGI';this[_0x042c('0xd0')](_0x49fb8b)['catch'](loggerCatch(_0x042c('0x10d')));this[_0x042c('0xce')](_0x49fb8b)[_0x042c('0xb4')](loggerCatch(_0x042c('0x10e')));}if(_0x438e04&&_0x438e04[_0x042c('0x50')]!=='ivr'&&!isNotNull(this[_0x042c('0x21')][_0x438e04['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x3edba3[_0x042c('0xe9')]];this[_0x042c('0xb6')](this['voiceQueues'][_0x438e04[_0x042c('0xb7')]]);this[_0x042c('0x21')][_0x438e04[_0x042c('0xb7')]][_0x042c('0x6c')]+=0x1;_0x49fb8b=new Hangup(_0x438e04,_0x3edba3);_0x49fb8b[_0x042c('0xea')]=0xc;_0x49fb8b[_0x042c('0xeb')]=_0x3edba3[_0x042c('0x111')];_0x49fb8b[_0x042c('0xf1')]=_0x042c('0x112');this['createHistory'](_0x49fb8b)[_0x042c('0xb4')](loggerCatch(_0x042c('0x10d')));this['moveContactManagedDialer'](_0x49fb8b)[_0x042c('0xb4')](loggerCatch(_0x042c('0x10e')));}};Dialer[_0x042c('0x1c')][_0x042c('0x31')]=function(_0x57ad5b){var _0x937713=this['uniqueId'][_0x57ad5b[_0x042c('0xe9')]];if(this[_0x042c('0x21')][_0x57ad5b['queue']]){if(_0x937713&&_0x937713['type']!==_0x042c('0x82')){delete this[_0x042c('0x27')][_0x57ad5b[_0x042c('0xe9')]];this[_0x042c('0x21')][_0x57ad5b[_0x042c('0xb7')]][_0x042c('0x64')]+=0x1;var _0x1b8b0d=new AgentComplete(_0x937713,_0x57ad5b);if(_0x57ad5b[_0x042c('0x113')]==='agent'){_0x1b8b0d[_0x042c('0x114')]=this[_0x042c('0x21')][_0x57ad5b[_0x042c('0xb7')]][_0x042c('0x115')]&&this[_0x042c('0x21')][_0x57ad5b[_0x042c('0xb7')]][_0x042c('0x116')]?moment()[_0x042c('0x7f')](_0x042c('0x10c')):undefined;}this['createHistory'](_0x1b8b0d)[_0x042c('0xb4')](loggerCatch(_0x042c('0x117')));this[_0x042c('0xce')](_0x1b8b0d)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x042c('0x1c')][_0x042c('0x118')]=function(_0x366933){if(this['voiceQueues'][_0x366933[_0x042c('0xb7')]]){if(this['uniqueId'][_0x366933[_0x042c('0xe9')]]&&this[_0x042c('0x27')][_0x366933[_0x042c('0xe9')]][_0x042c('0x50')]!==_0x042c('0x82')){this[_0x042c('0xb6')](this[_0x042c('0x21')][_0x366933[_0x042c('0xb7')]]);this[_0x042c('0x27')][_0x366933[_0x042c('0xe9')]][_0x042c('0x119')]=moment()['format'](_0x042c('0x10c'));}}};Dialer[_0x042c('0x1c')][_0x042c('0x11a')]=function(_0x4ebc8a,_0x516e51){this[_0x042c('0xd0')](_0x4ebc8a)['catch'](loggerCatch(_0x042c('0x117')));if(_0x516e51==0x0){this['moveContactManagedDialer'](_0x4ebc8a)['catch'](loggerCatch(_0x042c('0x11b')));}};Dialer[_0x042c('0x1c')][_0x042c('0x2f')]=function(_0xe2099e){var _0x317f61=this[_0x042c('0x27')][_0xe2099e[_0x042c('0xe9')]];var _0x2b60b8=this;var _0x1063ce=![];var _0x31dda7;var _0x4d48d2;if(this['voiceQueues'][_0xe2099e['queue']]){if(_0x317f61&&_0x317f61[_0x042c('0x50')]!=='ivr'){delete this[_0x042c('0x27')][_0xe2099e[_0x042c('0xe9')]];this[_0x042c('0xb6')](this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]]);_0x317f61['droptime']=moment()[_0x042c('0x7f')](_0x042c('0x10c'));var _0xffa3ad=new QueueCallerAbandon(_0x317f61,_0xe2099e);if(getSeconds(_0x317f61[_0x042c('0x11c')],_0x317f61[_0x042c('0x11d')])>=_0x317f61[_0x042c('0x11e')]){this[_0x042c('0x21')][_0xe2099e['queue']][_0x042c('0x89')]+=0x1;this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x72')]+=0x1;_0xffa3ad[_0x042c('0xea')]=0xa;_0xffa3ad['statedesc']=_0x042c('0x11f');_0xffa3ad[_0x042c('0x120')]='TIMEOUT';_0xffa3ad['agiafterat']=this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x115')]?moment()[_0x042c('0x7f')](_0x042c('0x10c')):undefined;_0xffa3ad[_0x042c('0xf9')]+=0x1;_0xffa3ad[_0x042c('0x105')]+=0x1;_0x31dda7=this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x121')];_0x4d48d2=this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x122')];_0x2b60b8[_0x042c('0xbd')](_0xffa3ad,_0xffa3ad['state'],_0x317f61[_0x042c('0x123')])[_0x042c('0x3e')](function(_0x1f3352){_0x1063ce=_0x1f3352[_0x042c('0x124')]==0x1;if(_0xffa3ad[_0x042c('0xf9')]>=_0x2b60b8[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x125')]){_0x2b60b8[_0x042c('0x11a')](_0xffa3ad,_0x1f3352['additional']);}else{_0x2b60b8[_0x042c('0xc5')]({'active':![],'countdropretry':_0xffa3ad['countdropretry'],'scheduledat':moment()[_0x042c('0x10a')](_0x2b60b8[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x121')],_0x042c('0x10b'))['format'](_0x042c('0x10c')),'ContactId':_0x317f61['ContactId'],'ListId':_0x317f61['ListId'],'VoiceQueueId':_0x317f61['VoiceQueueId']||undefined,'CampaignId':_0x317f61['CampaignId']||undefined})['catch'](loggerCatch(_0x042c('0x126')));var _0x44d116=new History(_0xffa3ad);_0x44d116[_0x042c('0xea')]=0xa;_0x44d116[_0x042c('0xeb')]=_0x042c('0x11f');_0x44d116[_0x042c('0xad')]=moment()['format'](_0x042c('0x10c'));_0x44d116[_0x042c('0x127')]=_0x44d116[_0x042c('0xad')];_0x44d116[_0x042c('0x128')]=_0xffa3ad[_0x042c('0x128')];_0x44d116[_0x042c('0x129')]=_0xffa3ad[_0x042c('0x129')];_0x2b60b8[_0x042c('0xd0')](_0x44d116)[_0x042c('0xb4')](loggerCatch(_0x042c('0x12a')));}})[_0x042c('0x3e')](function(){if(_0x1063ce)_0x2b60b8['swapAdditionalPhones'](_0xffa3ad,_0x31dda7,_0x4d48d2)[_0x042c('0x3e')](function(){return 0x1;});});}else{this['voiceQueues'][_0xe2099e[_0x042c('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]]['outboundDropCallsDayCallersExit']+=0x1;_0xffa3ad[_0x042c('0xea')]=0xb;_0xffa3ad[_0x042c('0xeb')]=_0x042c('0x12b');_0xffa3ad[_0x042c('0x120')]=_0x042c('0x12c');_0xffa3ad[_0x042c('0xfa')]+=0x1;_0xffa3ad[_0x042c('0x105')]+=0x1;_0x31dda7=this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]]['dialAbandonedRetryFrequency'];_0x4d48d2=this[_0x042c('0x21')][_0xe2099e[_0x042c('0xb7')]][_0x042c('0x122')];_0x2b60b8[_0x042c('0xbd')](_0xffa3ad,_0xffa3ad[_0x042c('0xea')],_0x317f61[_0x042c('0x123')])['then'](function(_0x66e40){if(_0xffa3ad[_0x042c('0xfa')]>=_0x2b60b8[_0x042c('0x21')][_0xe2099e['queue']]['dialAbandonedMaxRetry']){_0x2b60b8['queueCallerAbandonCreateState'](_0xffa3ad,_0x66e40[_0x042c('0x124')]);}else{_0x2b60b8[_0x042c('0xc5')]({'active':![],'countabandonedretry':_0xffa3ad[_0x042c('0xfa')],'scheduledat':moment()[_0x042c('0x10a')](_0x2b60b8[_0x042c('0x21')][_0xe2099e['queue']][_0x042c('0x12d')],'minutes')[_0x042c('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x317f61['ContactId'],'ListId':_0x317f61['ListId'],'VoiceQueueId':_0x317f61[_0x042c('0x101')]||undefined,'CampaignId':_0x317f61['CampaignId']||undefined})['catch'](loggerCatch(_0x042c('0x12e')));var _0x2197c8=new History(_0xffa3ad);_0x2197c8[_0x042c('0xea')]=0xb;_0x2197c8[_0x042c('0xeb')]=_0x042c('0x12b');_0x2197c8[_0x042c('0xad')]=moment()[_0x042c('0x7f')](_0x042c('0x10c'));_0x2197c8[_0x042c('0x127')]=_0x2197c8['starttime'];_0x2197c8[_0x042c('0x128')]=_0xffa3ad[_0x042c('0x128')];_0x2197c8['calleridnum']=_0xffa3ad[_0x042c('0x129')];_0x2b60b8[_0x042c('0xd0')](_0x2197c8)[_0x042c('0xb4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x042c('0x3e')](function(){if(_0x1063ce)_0x2b60b8[_0x042c('0xbf')](_0xffa3ad,_0x31dda7,_0x4d48d2)[_0x042c('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x042c('0x1c')]['syncNewExten']=function(_0x59728e){if(this[_0x042c('0xb0')][_0x59728e[_0x042c('0xe9')]]){this[_0x042c('0xb0')][_0x59728e[_0x042c('0xe9')]][_0x042c('0xb3')]=_0x59728e['channel'];}if(this[_0x042c('0x27')][_0x59728e[_0x042c('0xe9')]]){this[_0x042c('0x27')][_0x59728e[_0x042c('0xe9')]][_0x042c('0xb3')]=_0x59728e['channel'];}};Dialer['prototype'][_0x042c('0x39')]=function(_0x11aeb7){if(strategy[this[_0x042c('0x21')][this['actions'][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0xb7')]][_0x042c('0x52')]]===_0x042c('0x1b')){if(this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]]&&_[_0x042c('0xb1')](this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0x130')])&&_0x11aeb7[_0x042c('0xb2')]==='1'&&_0x11aeb7[_0x042c('0x131')]==='0'){if(this[_0x042c('0x23')][_0x11aeb7[_0x042c('0x132')]]){if(!this[_0x042c('0x23')][_0x11aeb7[_0x042c('0x132')]][_0x042c('0x130')]){this[_0x042c('0x23')][_0x11aeb7[_0x042c('0x132')]][_0x042c('0x130')]=!![];this['actions'][_0x11aeb7['actionid']][_0x042c('0x130')]=!![];this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0x132')]=_0x11aeb7[_0x042c('0x132')];}}}}else if((strategy[this[_0x042c('0x21')][this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0xb7')]][_0x042c('0x52')]]||'rrmemory')==='rrmemory'){if(this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]]){if(this[_0x042c('0x23')][_0x11aeb7[_0x042c('0x132')]]){this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0x132')]=_0x11aeb7[_0x042c('0x132')];if(_['isNil'](this[_0x042c('0x2a')][this[_0x042c('0xb0')][_0x11aeb7['actionid']][_0x042c('0xb7')]])){this['queueBooked'][this[_0x042c('0xb0')][_0x11aeb7['actionid']][_0x042c('0xb7')]]=[];}this['queueBooked'][this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]][_0x042c('0xb7')]]['push'](_[_0x042c('0x95')](_[_0x042c('0xd7')](this[_0x042c('0xb0')][_0x11aeb7[_0x042c('0x12f')]],[_0x042c('0x133'),_0x042c('0x132')]),{'status':_0x11aeb7[_0x042c('0xb2')],'paused':_0x11aeb7[_0x042c('0x131')]}));}}}};function unlockQueueStatus(_0x26fb18,_0x20f951){setTimeout(function(){if(_[_0x042c('0x40')](_0x26fb18[_0x042c('0x134')])){loggerBooked[_0x042c('0x9e')](_0x042c('0x135'),_0x20f951);}_0x26fb18[_0x042c('0x134')]=!![];loggerBooked['info'](_0x042c('0x136'),_0x20f951,JSON[_0x042c('0x7e')](_[_0x042c('0xd7')](_0x26fb18,[_0x042c('0x44'),_0x042c('0x134')])));},0x1f3);}Dialer[_0x042c('0x1c')]['syncQueueStatusComplete']=function(_0x5322c6){var _0x3d2f52=this;var _0x4dfdd7=_0x3d2f52['voiceQueues'][_0x3d2f52[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]];if(strategy[this[_0x042c('0x21')][this[_0x042c('0xb0')][_0x5322c6['actionid']][_0x042c('0xb7')]][_0x042c('0x52')]]==='roundrobin'){if(this[_0x042c('0xb0')][_0x5322c6['actionid']]&&this[_0x042c('0xb0')][_0x5322c6['actionid']][_0x042c('0x132')]){this['preview']['run'](this['actions'][_0x5322c6[_0x042c('0x12f')]][_0x042c('0x133')],this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0x132')])[_0x042c('0xb4')](function(_0x3ae52a){logger['error'](_0x042c('0x137'),util['inspect'](_0x3ae52a,{'showHidden':![],'depth':null}));})[_0x042c('0x1f')](function(){_0x3d2f52['updateOriginated'](_0x3d2f52[_0x042c('0x21')][_0x3d2f52[_0x042c('0xb0')][_0x5322c6['actionid']]['queue']]);_0x3d2f52['agents'][_0x3d2f52[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0x132')]][_0x042c('0x130')]=![];delete _0x3d2f52[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]];unlockQueueStatus(_0x4dfdd7);});}else{this[_0x042c('0xb6')](this[_0x042c('0x21')][this['actions'][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]]);this[_0x042c('0xc5')]({'active':![],'ContactId':this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xd8')],'ListId':this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xd9')],'VoiceQueueId':this['actions'][_0x5322c6[_0x042c('0x12f')]][_0x042c('0x101')]||undefined,'CampaignId':this['actions'][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xda')]||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x138')));delete this['actions'][_0x5322c6[_0x042c('0x12f')]];unlockQueueStatus(_0x4dfdd7);}}else if((strategy[this[_0x042c('0x21')][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]]['queue']][_0x042c('0x52')]]||_0x042c('0x1a'))===_0x042c('0x1a')){var _0x2c6a63;if(this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]]&&!_['isEmpty'](this[_0x042c('0x2a')][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]])){if(this['queueBookedRR'][_0x3d2f52[_0x042c('0xb0')][_0x5322c6['actionid']][_0x042c('0xb7')]]){this[_0x042c('0x2b')][_0x3d2f52[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]]=this[_0x042c('0x2b')][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]]['queue']]?this['queueBookedRR'][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]]:this[_0x042c('0x2a')][this[_0x042c('0xb0')][_0x5322c6['actionid']]['queue']]?this[_0x042c('0x2a')][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]]['queue']][_0x042c('0x139')]||0x0:0x0;}this[_0x042c('0x2a')][this['actions'][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]][_0x042c('0x139')]=this['queueBookedRR'][this[_0x042c('0xb0')][_0x5322c6[_0x042c('0x12f')]][_0x042c('0xb7')]];for(var _0x31c621=0x0;_0x31c621=0x0;})[_0x042c('0xb4')](myreject(_0x10cf8c)));}}else{_0x2ded05[_0x042c('0x152')](ami[_0x042c('0x153')]({'action':_0x042c('0x154'),'command':util['format'](_0x042c('0x155'),_0x5b7baf,!_[_0x042c('0x40')](config['timezones'][_0x4d2615])?_0x4d2615:'')})[_0x042c('0x3e')](function(_0x9bda7f){return _0x9bda7f['content'][_0x042c('0x157')](_0x042c('0x158'))>=0x0;})[_0x042c('0xb4')](myreject(_0x10cf8c)));}Promise[_0x042c('0x159')](_0x2ded05)['then'](function(_0x568289){var _0x217790=_['some'](_0x568289);if(_0x217790){return _0x18c56f(_0x217790);}else{_0x567ca2['message']=_0x2e5b22?_0x042c('0x15a'):_0x042c('0x15b');return _0x10cf8c(msgResponse(_0x042c('0x15c'),_0x042c('0x14d'),'Global:\x20'+_0x2e5b22+'\x20'+_0x2c6dfb+'\x20Interval\x20is\x20overtime:\x20'+util[_0x042c('0x9d')](_0x5b7baf,{'showHidden':![],'depth':null})+_0x042c('0x15d')+_0x4d2615));}})['catch'](function(_0x32fc62){return _0x10cf8c(msgResponse('ifTime','Failure',JSON['stringify'](_0x32fc62)));});});};Dialer[_0x042c('0x1c')][_0x042c('0x15e')]=function(_0x28b5cd){var _0x55e839=this;return function(){switch(_0x28b5cd['dialMethod']){case _0x042c('0x15f'):freeVariablesPredictive(_0x28b5cd);_0x55e839[_0x042c('0x160')](_0x28b5cd,0x1);break;case _0x042c('0x161'):freeVariablesPredictive(_0x28b5cd);_0x55e839['handlePower'](_0x28b5cd,_0x28b5cd[_0x042c('0x162')]);break;case'predictive':_0x55e839[_0x042c('0x9')](_0x28b5cd);break;case'booked':freeVariablesPredictive(_0x28b5cd);_0x55e839[_0x042c('0x160')](_0x28b5cd,0x1);break;default:freeVariablesPredictive(_0x28b5cd);logger[_0x042c('0x9e')]('Queue',_0x28b5cd[_0x042c('0x44')],_0x042c('0x163'));}};};Dialer['prototype'][_0x042c('0x164')]=function(_0x2c4b4f){return Promise[_0x042c('0xba')]()[_0x042c('0x3e')](cmHopper[_0x042c('0x165')](_0x2c4b4f['id'],previewRecallmeReminderInterval))['then'](function(_0x411390){for(var _0x1cf559=0x0;_0x1cf559<_0x411390[_0x042c('0xa0')];_0x1cf559++){var _0x1ebb91=_0x411390[_0x1cf559][_0x042c('0x166')][_0x042c('0x44')];if(_0x1ebb91)io['to'](util[_0x042c('0x7f')](_0x042c('0x167'),_0x1ebb91))[_0x042c('0x106')]('user:dialPreviewRecallReminder',{'hopper':_0x411390[_0x1cf559]});}})[_0x042c('0xb4')](function(){});};Dialer[_0x042c('0x1c')][_0x042c('0x168')]=function(_0x5c1a00){var _0x3955e3=this;return function(){_0x3955e3['handleIvr'](_0x5c1a00);};};Dialer[_0x042c('0x1c')][_0x042c('0xa')]=function(_0x40aa64){var _0xc822c6=this;if(isNotPreview(_0x40aa64[_0x042c('0x5f')])){if(isVoiceQueueOutbound(_0x40aa64[_0x042c('0x50')])&&isActive(_0x40aa64[_0x042c('0x169')])){_0x40aa64[_0x042c('0xa6')]=!![];Promise[_0x042c('0xba')]()[_0x042c('0x3e')](checkIsLoggedIn(_0x40aa64,_0x40aa64['loggedIn']))[_0x042c('0x3e')](checkIsActive(_0x40aa64,_0x40aa64[_0x042c('0x169')]))[_0x042c('0x3e')](checkInterval(_0x40aa64))[_0x042c('0x3e')](_0xc822c6['checkIsTrunkReachable'](_0x40aa64))[_0x042c('0x3e')](_0xc822c6[_0x042c('0x16a')](_0x40aa64[_0x042c('0x16b')],_0x40aa64[_0x042c('0x16c')],_0x40aa64[_0x042c('0x44')],_0x40aa64))[_0x042c('0x3e')](_0xc822c6['checkIfTimeIntervals'](_0x40aa64[_0x042c('0x46')],_0x40aa64['dialTimezone'],_0x40aa64[_0x042c('0x44')],_0x40aa64))[_0x042c('0x3e')](_0xc822c6[_0x042c('0x15e')](_0x40aa64))[_0x042c('0xb4')](loggerCatchQueueSummary(_0x042c('0x16d'),_0x40aa64));}else{notSendMessagesQueue(_0x40aa64);}}else{freeVariablesPredictive(_0x40aa64);}};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x042c('0x16e')](function(){var _0x1a66ae=_['filter'](this['voiceQueues'],function(_0x4f3f5b){return _0x4f3f5b[_0x042c('0x16f')];});var _0x28ee45=_[_0x042c('0x170')](this[_0x042c('0x23')],function(_0x6d1e1f){return _0x6d1e1f[_0x042c('0x171')]&&_0x6d1e1f[_0x042c('0xb2')]===_0x042c('0xe1');});if(_0x1a66ae['length']>0x0&&_0x28ee45[_0x042c('0xa0')]>0x0){return Promise['resolve']()[_0x042c('0x3e')](cmHopper[_0x042c('0x165')](_['map'](_0x1a66ae,'id'),previewRecallmeReminderInterval,_[_0x042c('0x172')](_0x28ee45,'id')))[_0x042c('0x3e')](function(_0x84a4aa){for(var _0x2ff26b=0x0;_0x2ff26b<_0x84a4aa['length'];_0x2ff26b++){var _0x8507e=_0x84a4aa[_0x2ff26b][_0x042c('0x166')][_0x042c('0x44')];if(_0x8507e)io['to'](util[_0x042c('0x7f')](_0x042c('0x167'),_0x8507e))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x84a4aa[_0x2ff26b]});}})['catch'](function(_0x5e138b){logger['error']('checkPreviewRecallReminder',_0x5e138b);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x042c('0x1c')][_0x042c('0x145')]=function(){var _0x21e5c2=this;var _0x440940;for(var _0x16f797 in this[_0x042c('0x22')]){if(typeof this['campaigns'][_0x16f797]!=='undefined'){_0x440940=this['campaigns'][_0x16f797];if(isCampaignIvr(_0x440940[_0x042c('0x50')])&&isActive(_0x440940[_0x042c('0xdf')])){_0x440940[_0x042c('0xa6')]=!![];Promise[_0x042c('0xba')]()['then'](checkIsActive(_0x440940,_0x440940[_0x042c('0xdf')]))['then'](checkInterval(_0x440940))['then'](_0x21e5c2['checkIsTrunkReachable'](_0x440940))[_0x042c('0x3e')](_0x21e5c2['checkIfTime'](_0x440940['dialGlobalInterval'],_0x440940[_0x042c('0x16c')],_0x440940[_0x042c('0x44')],_0x440940))[_0x042c('0x3e')](_0x21e5c2['checkIfTimeIntervals'](_0x440940[_0x042c('0x46')],_0x440940[_0x042c('0x16c')],_0x440940[_0x042c('0x44')],_0x440940))[_0x042c('0x3e')](_0x21e5c2[_0x042c('0x168')](_0x440940))[_0x042c('0xb4')](loggerCatchQueueSummary(_0x042c('0x173'),_0x440940));}else{notSendMessagesCampaign(_0x440940);}}}};function getCallerIdRandom(_0x2dbbf8,_0x32a85a){var _0x2f1a38;var _0x1ce4c0;var _0x41b5c0;if(_0x32a85a<=0x0){_0x32a85a=0x1;}_0x2f1a38=new RegExp('\x5cw{0,'+_0x32a85a+'}$');_0x1ce4c0=Math['pow'](0xa,_0x32a85a-0x1);_0x41b5c0=Math[_0x042c('0x174')](0xa,_0x32a85a)-0x1;return util[_0x042c('0x7f')]('%s',_[_0x042c('0x175')](_0x2dbbf8,_0x2f1a38,_[_0x042c('0x176')](_0x1ce4c0,_0x41b5c0)));}function extractCalleridName(_0x4a934a){var _0x4e1468=_0x4a934a[_0x042c('0x177')](/"(.*?)"/);return _0x4e1468?_0x4e1468[0x1]:_0x4a934a;}Dialer[_0x042c('0x1c')][_0x042c('0x178')]=function(_0x1fd938,_0x52952d){var _0x1183e9=this;var _0x4870ae=uuid['v4']();this[_0x042c('0xb0')][_0x4870ae]=new Action(_0x1fd938,_0x52952d,_0x4870ae);return new Promise(function(_0x306569,_0x333ddc){if(_['isUndefined'](_0x1fd938)&&typeof _0x1fd938!==_0x042c('0x179')){return _0x333ddc(msgResponse('originate',_0x042c('0x14d'),'voiceQueue\x20is\x20undefine'));}if(_[_0x042c('0x40')](_0x52952d['phone'])||_0x52952d[_0x042c('0x17a')]===null){return _0x333ddc(msgResponse(_0x042c('0x17b'),_0x042c('0x14d'),_0x042c('0x17c')));}var _0xccee49={'XMD-CALLERID':_0x1183e9[_0x042c('0xb0')][_0x4870ae]['getCaller'](),'XMD-AGI':_0x1fd938[_0x042c('0x10f')]?util[_0x042c('0x7f')](_0x042c('0x17d'),ipAgi,_0x1fd938[_0x042c('0x10f')]):'NONE','XMD-AGIAFTER':_0x1fd938[_0x042c('0x115')]?util[_0x042c('0x7f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1fd938[_0x042c('0x115')]):'NONE','XMD-QUEUE':_0x1fd938[_0x042c('0x50')]===_0x042c('0x51')?util[_0x042c('0x7f')]('\x22%s,%s%s,,,%s\x22',_0x1fd938[_0x042c('0x44')],_0x1fd938['dialQueueOptions']||'',_0x1fd938[_0x042c('0x116')]?'c':'',_0x1fd938[_0x042c('0x11e')]||0x3):_0x042c('0x17e'),'XMD-CONTACTID':_0x52952d['ContactId'],'XMD-CDRTYPE':_0x042c('0x7'),'CALLERID(all)':_0x1183e9[_0x042c('0xb0')][_0x4870ae][_0x042c('0x17f')](),'XMD-AMD':_0x1fd938[_0x042c('0xe7')]?_0x042c('0x180'):_0x042c('0x17e'),'XMD-DESTINATION':_0x042c('0xe6')};if(_0x1fd938[_0x042c('0xe7')]){_0xccee49[_0x042c('0x181')]=_0x1fd938['dialAMDInitialSilence']||0x9c4;_0xccee49['XMD-AMDGREETING']=_0x1fd938[_0x042c('0x182')]||0x5dc;_0xccee49['XMD-AMDAFTERGREETINGSILENCE']=_0x1fd938['dialAMDAfterGreetingSilence']||0x320;_0xccee49[_0x042c('0x183')]=_0x1fd938[_0x042c('0x184')]||0x1388;_0xccee49['XMD-AMDMINWORDLENGTH']=_0x1fd938[_0x042c('0x185')]||0x64;_0xccee49['XMD-AMDBETWEENWORDSSILENCE']=_0x1fd938[_0x042c('0x186')]||0x32;_0xccee49[_0x042c('0x187')]=_0x1fd938['dialAMDMaximumNumberOfWords']||0x3;_0xccee49[_0x042c('0x188')]=_0x1fd938[_0x042c('0x189')]||0x100;_0xccee49[_0x042c('0x18a')]=_0x1fd938[_0x042c('0x18b')]||0x1388;}if(_0x1fd938['type']===_0x042c('0x51')){_0xccee49[_0x042c('0x18c')]=_0x52952d[_0x042c('0x101')];}else{_0xccee49['XMD-CAMPAIGNID']=_0x52952d[_0x042c('0xda')];}for(var _0x357f84 in _0x52952d[_0x042c('0x18d')]){if(typeof _0x52952d[_0x042c('0x18d')][_0x357f84]!==_0x042c('0xa1')){if(isNotNull(_0x52952d[_0x042c('0x18d')][_0x357f84])&&_0x357f84!=='id'&&_0x357f84!==_0x042c('0x18e')&&_0x357f84!==_0x042c('0x18f')&&_0x357f84!==_0x042c('0x190')){_0xccee49[util[_0x042c('0x7f')](_0x042c('0x191'),'XMD-',_[_0x042c('0x192')](_0x357f84))]=_0x52952d[_0x042c('0x18d')][_0x357f84];}}}var _0x655280=_0x1183e9['isTrunkReachable'](_0x1fd938[_0x042c('0x7c')])?getCallerId(_0x1fd938[_0x042c('0x7c')][_0x042c('0x7d')],_0x1fd938[_0x042c('0x193')],_0x1fd938[_0x042c('0x194')]>0x0?getCallerIdRandom(_0x1fd938[_0x042c('0x60')],_0x1fd938[_0x042c('0x194')]):_0x1fd938[_0x042c('0x60')]):getCallerId(_[_0x042c('0xb1')](_0x1fd938[_0x042c('0x147')])?_0x1fd938['Trunk']['callerid']:_0x1fd938[_0x042c('0x147')][_0x042c('0x7d')],_0x1fd938[_0x042c('0x193')],_0x1fd938['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x1fd938['dialOriginateCallerIdNumber'],_0x1fd938[_0x042c('0x194')]):_0x1fd938['dialOriginateCallerIdNumber']);if(_0x655280){_0xccee49['XMD-ORIGINATECALLERIDNAME']=_0x1183e9['actions'][_0x4870ae][_0x042c('0x195')]=extractCalleridName(_0x655280);_0xccee49[_0x042c('0x196')]=_0x52952d[_0x042c('0x17a')];}_0x1fd938[_0x042c('0x197')]=_0xccee49;return ami[_0x042c('0x153')]({'actionid':_0x4870ae,'action':_0x042c('0x17b'),'channel':_0x1183e9[_0x042c('0x146')](_0x1fd938[_0x042c('0x7c')])?util[_0x042c('0x7f')](_0x042c('0x198'),_0x1fd938['Trunk']['name'],isNotNull(_0x1fd938[_0x042c('0x62')])?_0x1fd938[_0x042c('0x62')][_0x042c('0x199')]()||'':'',_0x1fd938['dialCutDigit']>0x0?_0x52952d[_0x042c('0x17a')][_0x042c('0x19a')](_0x1fd938[_0x042c('0x19b')]):_0x52952d[_0x042c('0x17a')]):util[_0x042c('0x7f')](_0x042c('0x198'),_[_0x042c('0xb1')](_0x1fd938['TrunkBackup'])?_0x1fd938[_0x042c('0x7c')][_0x042c('0x44')]:_0x1fd938[_0x042c('0x147')][_0x042c('0x44')],isNotNull(_0x1fd938[_0x042c('0x62')])?_0x1fd938[_0x042c('0x62')][_0x042c('0x199')]()||'':'',_0x1fd938[_0x042c('0x19b')]>0x0?_0x52952d[_0x042c('0x17a')][_0x042c('0x19a')](_0x1fd938['dialCutDigit']):_0x52952d[_0x042c('0x17a')]),'callerid':_0x655280,'Exten':'xcally-motion-dialer','Context':_0x042c('0x19c'),'Priority':'1','variable':_0xccee49,'timeout':(_0x1fd938[_0x042c('0x61')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4870ae})[_0x042c('0x3e')](function(_0x2aa039){return _0x306569(_0x2aa039);})[_0x042c('0xb4')](function(_0x5245e4){_0x1fd938[_0x042c('0x6a')]+=0x1;var _0xee598e=new History(_0x1183e9[_0x042c('0xb0')][_0x4870ae]);logger[_0x042c('0x9e')](util['format'](_0x042c('0x19d'),JSON[_0x042c('0x7e')](_0x5245e4)));_0xee598e[_0x042c('0xea')]=0xe;_0xee598e[_0x042c('0xeb')]=_0x042c('0x19e');_0xee598e['starttime']=moment()[_0x042c('0x7f')](_0x042c('0x10c'));_0xee598e['endtime']=_0xee598e[_0x042c('0xad')];_0x1183e9[_0x042c('0xd0')](_0xee598e)[_0x042c('0xb4')](loggerCatch(_0x042c('0x19f')));_0x1183e9[_0x042c('0xce')](_0xee598e)[_0x042c('0xb4')](loggerCatch(_0x042c('0x19f')))['finally'](function(){delete _0x1183e9[_0x042c('0xb0')][_0x4870ae];return _0x333ddc(msgResponse(_0x042c('0x17b'),_0x042c('0x4c'),_0x042c('0x1a0')));});});});};Dialer[_0x042c('0x1c')][_0x042c('0x1a1')]=function(_0x5f4104){var _0x300ee9=this[_0x042c('0xb0')][_0x5f4104[_0x042c('0x12f')]];if(_0x300ee9){delete this[_0x042c('0xb0')][_0x5f4104[_0x042c('0x12f')]];_0x300ee9[_0x042c('0x11d')]=moment()[_0x042c('0x7f')](_0x042c('0x10c'));var _0x2bcb08=_0x300ee9['type']==='ivr'?this[_0x042c('0x22')][_0x300ee9[_0x042c('0xb7')]]:this[_0x042c('0x21')][_0x300ee9[_0x042c('0x1a2')]()];if(!this[_0x042c('0xdd')](_0x5f4104[_0x042c('0x1a3')])){this[_0x042c('0xb6')](_0x2bcb08);return this[_0x042c('0x1a4')](_0x300ee9,_0x2bcb08,_0x5f4104)[_0x042c('0xb4')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x042c('0x27')][_0x5f4104[_0x042c('0xe9')]]=_0x300ee9;}};Dialer[_0x042c('0x1c')]['checkRetriveMax']=function(_0x16630d,_0x10be6d,_0x984653){var _0x5ebd45=new History(_0x10be6d);if(_0x5ebd45[_0x042c('0xf7')]+_0x5ebd45['countcongestionretry']+_0x5ebd45[_0x042c('0xf8')]+_0x5ebd45[_0x042c('0x108')]+_0x5ebd45[_0x042c('0xf9')]+_0x5ebd45[_0x042c('0xfa')]+_0x5ebd45[_0x042c('0xf3')]+_0x5ebd45[_0x042c('0xfb')]>=_0x984653[_0x042c('0xfc')]-0x1){return!![];}switch(_0x16630d){case 0x3:if(_0x5ebd45[_0x042c('0xf8')]>=_0x984653[_0x042c('0x1a5')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countnoanswerretry':_0x5ebd45[_0x042c('0xf8')]+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x1a6')],'minutes')['format'](_0x042c('0x10c')),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45[_0x042c('0xd9')],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45['CampaignId']||undefined})[_0x042c('0xb4')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5ebd45[_0x042c('0xf7')]>=_0x984653[_0x042c('0x1a7')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countbusyretry':_0x5ebd45['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x984653[_0x042c('0x1a8')],_0x042c('0x10b'))[_0x042c('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45[_0x042c('0xd9')],'VoiceQueueId':_0x5ebd45['VoiceQueueId']||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})['catch'](loggerCatch(_0x042c('0x1a9')));break;case 0x8:if(_0x5ebd45[_0x042c('0x107')]>=_0x984653[_0x042c('0x1aa')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countcongestionretry':_0x5ebd45[_0x042c('0x107')]+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x1ab')],_0x042c('0x10b'))[_0x042c('0x7f')](_0x042c('0x10c')),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45['ListId'],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x1ac')));break;case 0x0:if(_0x5ebd45[_0x042c('0x108')]>=_0x984653[_0x042c('0x1ad')]-0x1){return!![];}else{this[_0x042c('0xc5')]({'active':![],'countnosuchnumberretry':_0x5ebd45['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x1ae')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45[_0x042c('0xd9')],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})['catch'](loggerCatch(_0x042c('0x1af')));}break;case 0xa:if(_0x5ebd45[_0x042c('0xf9')]>=_0x984653[_0x042c('0x125')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countdropretry':_0x5ebd45[_0x042c('0xf9')]+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x121')],'minutes')[_0x042c('0x7f')](_0x042c('0x10c')),'ContactId':_0x5ebd45['ContactId'],'ListId':_0x5ebd45[_0x042c('0xd9')],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})['catch'](loggerCatch(_0x042c('0x126')));break;case 0xb:if(_0x5ebd45[_0x042c('0xfa')]>=_0x984653[_0x042c('0x1b0')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countabandonedretry':_0x5ebd45[_0x042c('0xfa')]+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x12d')],_0x042c('0x10b'))['format'](_0x042c('0x10c')),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45[_0x042c('0xd9')],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45['CampaignId']||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x12e')));break;case 0x13:if(_0x5ebd45[_0x042c('0xf3')]>=_0x984653[_0x042c('0xfe')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countmachineretry':_0x5ebd45['countmachineretry']+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x100')],_0x042c('0x10b'))[_0x042c('0x7f')](_0x042c('0x10c')),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45['ListId'],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})['catch'](loggerCatch(_0x042c('0x102')));break;case 0x14:if(_0x5ebd45['countagentrejectretry']>=_0x984653[_0x042c('0x1b1')]-0x1){return!![];}this[_0x042c('0xc5')]({'active':![],'countagentrejectretry':_0x5ebd45['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x042c('0x10a')](_0x984653[_0x042c('0x1b2')],_0x042c('0x10b'))[_0x042c('0x7f')](_0x042c('0x10c')),'ContactId':_0x5ebd45[_0x042c('0xd8')],'ListId':_0x5ebd45['ListId'],'VoiceQueueId':_0x5ebd45[_0x042c('0x101')]||undefined,'CampaignId':_0x5ebd45[_0x042c('0xda')]||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x1b3')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x5eaeca,_0x534ef7,_0x5d4618){var _0x21509f=this;var _0x5a12e3=new History(_0x5eaeca);var _0x2b0878=![];var _0x3e51e7;var _0x40bd03;return new Promise(function(_0x282f8a,_0x332fea){if(_[_0x042c('0x40')](_0x534ef7)&&typeof _0x534ef7!=='object'){return _0x332fea(msgResponse(_0x042c('0x1b4'),_0x042c('0x14d'),_0x042c('0x1b5')));}if(_['isUndefined'](_0x5d4618)&&typeof _0x5d4618!==_0x042c('0x179')){return _0x332fea(msgResponse(_0x042c('0x1b4'),'Failure','evt\x20is\x20undefine'));}_0x21509f['verifyAdditionalPhones'](_0x5a12e3,_0x5d4618[_0x042c('0x113')],_0x534ef7)[_0x042c('0x3e')](function(_0x7e8b36){if(_0x7e8b36[_0x042c('0x124')]==0x1)_0x2b0878=!![];switch(_0x5d4618[_0x042c('0x113')]){case'0':_0x534ef7[_0x042c('0x1b6')]+=0x1;_0x5a12e3[_0x042c('0xea')]=0x0;_0x5a12e3['statedesc']=_0x042c('0x1b7');_0x5a12e3['countnosuchnumberretry']+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;ami[_0x042c('0x106')](_0x042c('0x1b8'),ut[_0x042c('0xf5')](_0x5eaeca,_0x042c('0x1b9')));_0x3e51e7=_0x534ef7[_0x042c('0x1ae')];_0x40bd03=_0x534ef7[_0x042c('0x122')];_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch(_0x042c('0xf6')));if(_0x21509f[_0x042c('0x1ba')](0x0,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0x108')]>=_0x534ef7['dialNoSuchNumberMaxRetry']){_0x21509f[_0x042c('0x109')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1bb'));}else{_0x21509f[_0x042c('0xfd')](_0x5a12e3,_0x282f8a,_0x332fea,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x534ef7['outboundNoAnswerCallsDay']+=0x1;_0x5a12e3['state']=0x3;_0x5a12e3[_0x042c('0xeb')]=_0x042c('0x1bc');_0x5a12e3[_0x042c('0xf8')]+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;var _0x8265ca=ut['buildNoAnswerEventPayload'](_0x5eaeca,_0x534ef7);ami['emit']('custom:agentnoanswer',_0x8265ca);_0x3e51e7=_0x534ef7['dialNoAnswerRetryFrequency'];_0x40bd03=_0x534ef7[_0x042c('0x122')];_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch(_0x042c('0x1bd')));if(_0x21509f['checkRetriveMax'](0x3,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0xf8')]>=_0x534ef7['dialNoAnswerMaxRetry']){_0x21509f[_0x042c('0x109')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1be'));}else{_0x21509f[_0x042c('0xfd')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1be'));}}break;case'5':_0x534ef7['outboundBusyCallsDay']+=0x1;_0x5a12e3[_0x042c('0xea')]=0x5;_0x5a12e3[_0x042c('0xeb')]=_0x042c('0x1bf');_0x5a12e3['countbusyretry']+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;ami[_0x042c('0x106')](_0x042c('0x1c0'),ut[_0x042c('0xf5')](_0x5eaeca,'busy'));_0x3e51e7=_0x534ef7[_0x042c('0x1a8')];_0x40bd03=_0x534ef7[_0x042c('0x122')];_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x21509f[_0x042c('0x1ba')](0x5,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0xf7')]>=_0x534ef7[_0x042c('0x1a7')]){_0x21509f['createStateFinal'](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1c1'));}else{_0x21509f[_0x042c('0xfd')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1c1'));}}break;case'8':_0x534ef7[_0x042c('0x1c2')]+=0x1;_0x5a12e3[_0x042c('0xea')]=0x8;_0x5a12e3[_0x042c('0xeb')]=_0x042c('0x1c3');_0x5a12e3[_0x042c('0x107')]+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;_0x3e51e7=_0x534ef7[_0x042c('0x1ab')];_0x40bd03=_0x534ef7[_0x042c('0x122')];ami[_0x042c('0x106')](_0x042c('0x1c4'),ut[_0x042c('0xf5')](_0x5eaeca,'congestion'));_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch(_0x042c('0x1c5')));if(_0x21509f[_0x042c('0x1ba')](0x8,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0x107')]>=_0x534ef7['dialCongestionMaxRetry']){_0x21509f[_0x042c('0x109')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1c6'));}else{_0x21509f[_0x042c('0xfd')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1c6'));}}break;case'11':_0x534ef7[_0x042c('0x1c7')]+=0x1;_0x5a12e3[_0x042c('0xea')]=0xb;_0x5a12e3[_0x042c('0xeb')]=_0x042c('0x12b');_0x5a12e3['countabandonedretry']+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;_0x3e51e7=_0x534ef7['dialAbandonedRetryFrequency'];_0x40bd03=_0x534ef7['callAdditionalPhoneAfterMin'];_0x21509f[_0x042c('0xd0')](_0x5a12e3)['catch'](loggerCatch(_0x042c('0x1c8')));if(_0x21509f[_0x042c('0x1ba')](0xb,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0xfa')]>=_0x534ef7[_0x042c('0x1b0')]){_0x21509f['createStateFinal'](_0x5a12e3,_0x282f8a,_0x332fea,'reason\x2011\x20abandoned');}else{_0x21509f['stateGlobal'](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1c9'));}}break;case'20':_0x534ef7['outboundRejectCallsDay']+=0x1;_0x5a12e3[_0x042c('0xea')]=0x14;_0x5a12e3['statedesc']=_0x042c('0x1ca');_0x5a12e3[_0x042c('0xfb')]+=0x1;_0x5a12e3[_0x042c('0x105')]+=0x1;_0x3e51e7=_0x534ef7[_0x042c('0x1b2')];_0x40bd03=_0x534ef7[_0x042c('0x122')];ami[_0x042c('0x106')]('custom:agentreject',ut['buildObj'](_0x5eaeca,'agentreject'));_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch(_0x042c('0x1cb')));if(_0x21509f[_0x042c('0x1ba')](0x14,_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0xfb')]>=_0x534ef7[_0x042c('0x1b1')]){_0x21509f['createStateFinal'](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1cc'));}else{_0x21509f[_0x042c('0xfd')](_0x5a12e3,_0x282f8a,_0x332fea,_0x042c('0x1cc'));}}break;default:_0x534ef7['outboundUnknownCallsDay']+=0x1;_0x5a12e3[_0x042c('0xea')]=0xc;_0x5a12e3[_0x042c('0xeb')]=_0x5d4618[_0x042c('0x113')];_0x3e51e7=_0x534ef7['dialAgentRejectRetryFrequency'];_0x40bd03=_0x534ef7[_0x042c('0x122')];_0x21509f[_0x042c('0xd0')](_0x5a12e3)[_0x042c('0xb4')](loggerCatch(_0x042c('0x1cd')));if(_0x21509f[_0x042c('0x1ba')](_0x5d4618[_0x042c('0x113')],_0x5eaeca,_0x534ef7)&&!_0x2b0878){if(_0x5a12e3[_0x042c('0xf7')]+_0x5a12e3[_0x042c('0x107')]+_0x5a12e3[_0x042c('0xf8')]+_0x5a12e3['countnosuchnumberretry']+_0x5a12e3[_0x042c('0xf9')]+_0x5a12e3[_0x042c('0xfa')]+_0x5a12e3[_0x042c('0xf3')]+_0x5a12e3['countagentrejectretry']>=_0x534ef7[_0x042c('0xfc')]){_0x21509f['stateGlobal'](_0x5a12e3,_0x282f8a,_0x332fea,_0x5d4618[_0x042c('0x113')]);}else{_0x21509f[_0x042c('0x109')](_0x5a12e3,_0x282f8a,_0x332fea,_0x5d4618['reason']);}}}})['then'](function(){if(_0x2b0878){_0x21509f[_0x042c('0xbf')](_0x5a12e3,_0x3e51e7,_0x40bd03)[_0x042c('0x3e')](function(){return _0x282f8a(0x1);});}});});};Dialer['prototype'][_0x042c('0xfd')]=function(_0x2c4239,_0x41b4a8,_0x35302f,_0x4f0768){var _0x4acba0=new Final(_0x2c4239);_0x4acba0[_0x042c('0xea')]=0xf;_0x4acba0[_0x042c('0xeb')]=_0x042c('0x1ce');this[_0x042c('0x109')](_0x4acba0,_0x41b4a8,_0x35302f,_0x4f0768);};Dialer[_0x042c('0x1c')][_0x042c('0x109')]=function(_0x31961d,_0x51e9f2,_0x4fdc8b,_0xada179){this['moveContactManagedDialer'](_0x31961d)[_0x042c('0x3e')](function(){return _0x51e9f2(msgResponse('[callProgressDetecting]',_0x042c('0xde'),_0xada179));})[_0x042c('0xb4')](function(){return _0x4fdc8b(msgResponse(_0x042c('0x1cf'),_0x042c('0x14d'),_0x042c('0x1d0')));});};Dialer['prototype']['predictive']=function(_0x39f41b){var _0x1016fa=_0x39f41b[_0x042c('0x1d1')]/0x64;var _0x2d2615=_0x39f41b[_0x042c('0x68')]/(_0x39f41b[_0x042c('0x68')]+_0x39f41b['outboundAnswerCallsDay']);var _0x485d42=Math[_0x042c('0x1d2')](_0x39f41b[_0x042c('0x1d3')]*(_0x39f41b[_0x042c('0x1d4')]/0x64));var _0x11f9d0=Math[_0x042c('0x1d2')](_0x39f41b[_0x042c('0x1d3')]*(_0x39f41b['predictiveIntervalMinThreshold']/0x64));var _0x3c615a=_0x39f41b[_0x042c('0x54')]+_0x39f41b[_0x042c('0x5a')];var _0x174f12=Math[_0x042c('0x1d5')](_0x39f41b[_0x042c('0x78')]*_0x39f41b[_0x042c('0x7a')]*_0x39f41b[_0x042c('0x73')]*_0x39f41b['predictiveIntervalMultiplicativeFactor']);if(_[_0x042c('0x40')](_0x39f41b[_0x042c('0x29')])){if(!_[_0x042c('0x40')](_0x39f41b[_0x042c('0x28')])){_0x39f41b[_0x042c('0x28')]=undefined;loggerPredictive[_0x042c('0x9e')](_0x042c('0x1d6'),_0x042c('0x1d7'));}if(!_[_0x042c('0x40')](_0x39f41b[_0x042c('0x97')])){loggerPredictive['error'](_0x042c('0x1d6'),_0x042c('0x1d8'));clearInterval(_0x39f41b[_0x042c('0x97')]);_0x39f41b[_0x042c('0x97')]=undefined;}_0x39f41b[_0x042c('0x29')]=moment()[_0x042c('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x042c('0x85')](_0x39f41b['name'],'collection\x20data\x20in\x20progressive\x20at',_0x39f41b['startProgressive']);this[_0x042c('0x160')](_0x39f41b,0x1);}else if(ifInterval(_0x39f41b[_0x042c('0x1d9')],_0x39f41b[_0x042c('0x29')])){this[_0x042c('0x160')](_0x39f41b,0x1);loggerPredictiveCalls['info'](_0x042c('0x1da'),_0x39f41b['startProgressive'],_0x39f41b[_0x042c('0x44')]);_0x39f41b[_0x042c('0x78')]=0x0;_0x39f41b[_0x042c('0x72')]=0x0;}else if(_0x1016fa<_0x2d2615&&_0x39f41b[_0x042c('0x1db')]===_0x042c('0x1dc')){freeVariablesPredictive(_0x39f41b);loggerPredictive[_0x042c('0x85')](_0x042c('0x1dd'),_0x042c('0x1de'),_0x2d2615,_0x042c('0x29'),_0x39f41b[_0x042c('0x44')]);}else if(_0x174f12<_0x39f41b[_0x042c('0x72')]&&_0x39f41b[_0x042c('0x1db')]==='dropRate'){freeVariablesPredictive(_0x39f41b);loggerPredictive[_0x042c('0x85')](_0x042c('0x1df'),_0x042c('0x1e0'),_0x174f12,_0x042c('0x1e1'),_0x39f41b[_0x042c('0x72')],'startProgressive',_0x39f41b[_0x042c('0x44')]);}else if(!ifInterval(_0x39f41b[_0x042c('0x1d9')],_0x39f41b['startProgressive'])&&_[_0x042c('0x40')](_0x39f41b['startPredictive'])&&!_['isUndefined'](_0x39f41b[_0x042c('0x29')])){_0x39f41b['startPredictive']=moment()[_0x042c('0x7f')](_0x042c('0x10c'));loggerPredictive['info'](_0x39f41b[_0x042c('0x44')],_0x042c('0x1e2'),_0x39f41b[_0x042c('0x28')]);this['averageHandleTime'](_0x39f41b['dialPredictiveInterval'])[_0x042c('0x3e')](this[_0x042c('0x1e3')](_0x39f41b))[_0x042c('0x3e')](mergeDataErlangB(_0x39f41b))[_0x042c('0x3e')](this[_0x042c('0x1e4')](_0x39f41b))['catch'](loggerCatchPredictive(_0x042c('0x1e5'),_0x39f41b));}else if(!ifInterval(_0x39f41b['dialPredictiveInterval'],_0x39f41b['startPredictive'])){_0x39f41b['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x39f41b[_0x042c('0x28')]=moment()[_0x042c('0x7f')](_0x042c('0x10c'));loggerPredictive[_0x042c('0x85')](_0x39f41b[_0x042c('0x44')],_0x042c('0x1e6'),_0x39f41b['startPredictive']);clearInterval(_0x39f41b[_0x042c('0x97')]);_0x39f41b['handlePredictive']=undefined;this[_0x042c('0x1e7')](_0x39f41b[_0x042c('0x1d9')])[_0x042c('0x3e')](this[_0x042c('0x1e3')](_0x39f41b))[_0x042c('0x3e')](mergeDataErlangB(_0x39f41b))['then'](this[_0x042c('0x1e4')](_0x39f41b))[_0x042c('0xb4')](loggerCatchPredictive(_0x042c('0x1e8'),_0x39f41b));}else if(_0x39f41b[_0x042c('0x1d3')]&&_0x3c615a<_0x39f41b[_0x042c('0x1d3')]-_0x11f9d0){freeVariablesPredictive(_0x39f41b);loggerPredictive['info'](_0x39f41b[_0x042c('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3c615a,_0x042c('0x1e9'),_0x39f41b[_0x042c('0x1d3')],'-',_0x11f9d0,'=',_0x39f41b[_0x042c('0x1d3')]-_0x11f9d0,')');}else if(_0x39f41b[_0x042c('0x1d3')]&&_0x3c615a>_0x39f41b[_0x042c('0x1d3')]+_0x485d42){freeVariablesPredictive(_0x39f41b);loggerPredictive[_0x042c('0x85')](_0x39f41b[_0x042c('0x44')],_0x042c('0x1ea'),_0x3c615a,')\x20are\x20more\x20than\x20threshold\x20(',_0x39f41b[_0x042c('0x1d3')],'+',_0x485d42,'=',_0x39f41b[_0x042c('0x1d3')]+_0x485d42,')');}};Dialer[_0x042c('0x1c')]['getDataPredictive']=function(_0x221be2){var _0x21b8df=this;return function(_0x14d87a){return new Promise(function(_0x4eeaa7,_0x4b1c45){_[_0x042c('0x95')](_0x221be2,_0x14d87a[0x0]);if(checkGetDataPredictive(_0x14d87a[0x0])){var _0x40f6f6=_0x221be2[_0x042c('0x1d3')]=_0x221be2[_0x042c('0x5a')]+_0x221be2[_0x042c('0x54')];var _0x256f50=_0x221be2[_0x042c('0x1d9')]*0x3c;var _0x20f920=_0x14d87a[0x0]['predictiveIntervalAvgTalktime']+_0x14d87a[0x0][_0x042c('0x6e')];var _0x27062a=(_0x14d87a[0x0][_0x042c('0x6d')]+_0x14d87a[0x0][_0x042c('0x89')]+_0x14d87a[0x0][_0x042c('0x70')])/_0x14d87a[0x0][_0x042c('0x76')];_0x221be2[_0x042c('0x73')]=_0x27062a>0x0?_0x27062a:0x1;switch(_0x221be2['dialPredictiveOptimization']){case'dropRate':var _0x22eb6c=_0x221be2[_0x042c('0x1d1')]/0x64;return _0x21b8df[_0x042c('0x1eb')](_0x40f6f6,_0x256f50,_0x20f920,_0x27062a,_0x22eb6c)[_0x042c('0x3e')](function(_0x2d1d4b){return _0x4eeaa7(_0x2d1d4b);});case _0x042c('0x1ec'):var _0x47588c=_0x221be2[_0x042c('0x1d1')]/0x64;return _0x21b8df[_0x042c('0x1ed')](_0x40f6f6,_0x256f50,_0x20f920,_0x27062a,_0x47588c)[_0x042c('0x3e')](function(_0x22bd48){return _0x4eeaa7(_0x22bd48);});default:return _0x4b1c45(msgResponse('[getDataPredictive]',_0x042c('0x14d'),'Unknown\x20Predictive'));}}else{return _0x4b1c45(msgResponse(_0x042c('0x1ee'),'Failure',_0x042c('0x1ef')));}});};};Dialer['prototype'][_0x042c('0x1f0')]=function(_0x2f2a94){var _0xf80ee1=this;return function(_0x4bd190){return new Promise(function(_0x5b8562,_0x440e62){_[_0x042c('0x95')](_0x2f2a94,_0x4bd190[0x0]);if(checkGetDataPredictive(_0x4bd190[0x0])){loggerPredictive[_0x042c('0x85')](JSON['stringify'](_0x4bd190[0x0]));if(_0x2f2a94[_0x042c('0x1db')]==='dropRate'){return _0xf80ee1[_0x042c('0xcc')](_0x2f2a94['id'])[_0x042c('0x3e')](function(_0x151061){var _0x475c3d=_0x2f2a94[_0x042c('0x55')]-_0x151061[0x0][_0x042c('0x1f1')];var _0x2b2eb9=_0x2f2a94[_0x042c('0x1d9')]*0x3c;var _0x4ad163=_0x4bd190[0x0][_0x042c('0x6f')]+_0x4bd190[0x0][_0x042c('0x6e')];var _0x53478d=(_0x4bd190[0x0][_0x042c('0x6d')]+_0x4bd190[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4bd190[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4bd190[0x0]['predictiveIntervalTotalCalls'];var _0x35f3f4=_0x2f2a94['dialPredictiveOptimizationPercentage']/0x64;_0x2f2a94['predictiveIntervalPauses']=_0x151061[0x0][_0x042c('0x1f1')]||0x0;_0x2f2a94[_0x042c('0x73')]=_0x53478d>0x0?_0x53478d:0x1;return _0xf80ee1['abandonmentRate'](_0x475c3d,_0x2b2eb9,_0x4ad163,_0x53478d,_0x35f3f4);})[_0x042c('0x3e')](function(_0x56bd5b){return _0x5b8562(_0x56bd5b);})[_0x042c('0xb4')](function(_0x5e3835){return _0x440e62(msgResponse('[CatchErlangB]','Failure',JSON[_0x042c('0x7e')](_0x5e3835)));});}if(_0x2f2a94[_0x042c('0x1db')]===_0x042c('0x1ec')){return _0xf80ee1[_0x042c('0xcc')](_0x2f2a94['id'])['then'](function(_0x25bf6e){var _0x4f9304=_0x2f2a94[_0x042c('0x55')]-_0x25bf6e[0x0][_0x042c('0x1f1')];var _0xd9f7ca=_0x2f2a94[_0x042c('0x1d9')]*0x3c;var _0x50f4b0=_0x4bd190[0x0][_0x042c('0x6f')]+_0x4bd190[0x0][_0x042c('0x6e')];var _0x31cf59=(_0x4bd190[0x0]['predictiveIntervalAnsweredCalls']+_0x4bd190[0x0][_0x042c('0x89')]+_0x4bd190[0x0][_0x042c('0x70')])/_0x4bd190[0x0][_0x042c('0x76')];var _0x210054=_0x2f2a94[_0x042c('0x1d1')]/0x64;_0x2f2a94[_0x042c('0x75')]=_0x25bf6e[0x0]['outboundQueuePauses']||0x0;_0x2f2a94[_0x042c('0x73')]=_0x31cf59>0x0?_0x31cf59:0x1;return _0xf80ee1[_0x042c('0x1ed')](_0x4f9304,_0xd9f7ca,_0x50f4b0,_0x31cf59,_0x210054);})[_0x042c('0x3e')](function(_0x27935){return _0x5b8562(_0x27935);})['catch'](function(_0x54e07e){return _0x440e62(msgResponse(_0x042c('0x1f2'),'Failure',JSON['stringify'](_0x54e07e)));});}}else{return _0x440e62(msgResponse(_0x042c('0x1ee'),'Failure','check\x20failure'));}});};};Dialer[_0x042c('0x1c')][_0x042c('0x1e4')]=function(_0x211780){var _0x4367b4=this;return function(){var _0x674643=0x0;var _0x19c3a8=Math[_0x042c('0x1d5')](_0x211780[_0x042c('0x79')]*0x3e8);if(_0x19c3a8>0x0){_0x19c3a8=_0x19c3a8<0x64?0x64:_0x19c3a8;loggerPredictive['info'](_0x211780['name'],_0x042c('0x1f3'),_0x19c3a8,_0x042c('0x4d'));_0x211780[_0x042c('0x97')]=setInterval(function(){_0x4367b4[_0x042c('0x97')](_0x211780);loggerPredictiveCalls[_0x042c('0x85')]('[handlePredictive]',_0x674643+=0x1);},_0x19c3a8);}else{loggerPredictive[_0x042c('0x85')](_0x211780['name'],_0x042c('0x1f4'));}};};Dialer['prototype'][_0x042c('0x1f5')]=function(_0x5d2486,_0x39f74a){var _0x4984b5=this;return function(_0x46b502){if(_[_0x042c('0x4a')](_0x46b502)){if(_[_0x042c('0xb1')](_0x39f74a['UserId'])||!_0x39f74a[_0x042c('0x1f6')]){if(_0x5d2486[_0x042c('0x5f')]===_0x042c('0x8')){_0x5d2486['queueStatusComplete']=_[_0x042c('0x40')](_0x5d2486[_0x042c('0x134')])?!![]:_0x5d2486[_0x042c('0x134')];var _0x595332=uuid['v4']();_0x4984b5[_0x042c('0xb0')][_0x595332]=new Action(_0x5d2486,_0x39f74a,_0x595332);loggerBooked[_0x042c('0x85')]('[booked][checkContactBlack]',_0x595332,_0x042c('0x1f7'),JSON[_0x042c('0x7e')](_0x5d2486[_0x042c('0x134')]),_0x042c('0x1f8'),_0x5d2486[_0x042c('0x44')]);if(_0x5d2486['queueStatusComplete']){_0x5d2486[_0x042c('0x134')]=![];_0x4984b5[_0x042c('0x2a')][_0x4984b5[_0x042c('0xb0')][_0x595332]['queue']]=[];ami[_0x042c('0x153')]({'actionid':_0x595332,'action':_0x042c('0x1f9'),'queue':_0x5d2486[_0x042c('0x44')]})[_0x042c('0xb4')](function(){_0x4984b5[_0x042c('0xb6')](_0x5d2486);_0x4984b5[_0x042c('0xc5')]({'active':![],'ContactId':_0x4984b5[_0x042c('0xb0')][_0x595332][_0x042c('0xd8')],'ListId':_0x4984b5[_0x042c('0xb0')][_0x595332][_0x042c('0xd9')],'VoiceQueueId':_0x4984b5[_0x042c('0xb0')][_0x595332]['VoiceQueueId']||undefined,'CampaignId':_0x4984b5[_0x042c('0xb0')][_0x595332]['CampaignId']||undefined})[_0x042c('0xb4')](loggerCatch(_0x042c('0x1fa')));delete _0x4984b5[_0x042c('0xb0')][_0x595332];});}else{loggerBooked[_0x042c('0x85')](_0x042c('0x1fb'),JSON[_0x042c('0x7e')](_0x5d2486[_0x042c('0x134')]),_0x042c('0x1f8'),_0x5d2486['name']);_0x4984b5[_0x042c('0xb6')](_0x5d2486);_0x4984b5[_0x042c('0xc5')]({'active':![],'ContactId':_0x4984b5[_0x042c('0xb0')][_0x595332][_0x042c('0xd8')],'ListId':_0x4984b5[_0x042c('0xb0')][_0x595332][_0x042c('0xd9')],'VoiceQueueId':_0x4984b5[_0x042c('0xb0')][_0x595332]['VoiceQueueId']||undefined,'CampaignId':_0x4984b5[_0x042c('0xb0')][_0x595332][_0x042c('0xda')]||undefined})[_0x042c('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4984b5['actions'][_0x595332];}}else{return _0x4984b5[_0x042c('0x178')](_0x5d2486,_0x39f74a);}}else{if(getDiff(_0x39f74a[_0x042c('0x1fc')])<_0x5d2486[_0x042c('0x1fd')]*0x3c){if(_0x39f74a[_0x042c('0x166')]&&!_0x39f74a[_0x042c('0x166')][_0x042c('0x1fe')]){_0x4984b5['preview'][_0x042c('0x13e')](_0x39f74a['id'])[_0x042c('0x1f')](function(){_0x4984b5['updateOriginated'](_0x5d2486);});}else{_0x4984b5['unlockContact']({'active':![]},_0x39f74a['id'],0x1)[_0x042c('0x1f')](function(){_0x4984b5[_0x042c('0xb6')](_0x5d2486);});}}else{_0x5d2486[_0x042c('0x1ff')]+=0x1;_0x4984b5[_0x042c('0xb6')](_0x5d2486);if(_0x5d2486[_0x042c('0x200')]){_0x4984b5[_0x042c('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x39f74a[_0x042c('0xd8')],'ListId':_0x39f74a[_0x042c('0xd9')],'VoiceQueueId':_0x39f74a['VoiceQueueId']||undefined,'CampaignId':_0x39f74a[_0x042c('0xda')]||undefined})['catch'](loggerCatch(_0x042c('0x201')));_0x4984b5[_0x042c('0xd0')](createObjHistory(_0x5d2486,_0x39f74a,_0x042c('0x202'),0x17,_0x042c('0x203')))[_0x042c('0xb4')](loggerCatch(_0x042c('0x204')));}else{_0x4984b5[_0x042c('0xd6')](createObjHistory(_0x5d2486,_0x39f74a,_0x042c('0x205'),0x16,_0x042c('0x206')),_0x042c('0x207'),_0x042c('0x208'));}}}}else{_0x5d2486[_0x042c('0x209')]+=0x1;_0x4984b5[_0x042c('0xd6')](createObjHistory(_0x5d2486,_0x39f74a,_0x042c('0x20a'),0xd,_0x042c('0x20b')),_0x042c('0x20c'),'[Originate][MoveBlacklist]');throw _0x042c('0x20d');}};};Dialer[_0x042c('0x1c')]['handleIvr']=function(_0x5f268a){var _0x4a71fe=this;var _0x3585f3=_0x5f268a[_0x042c('0x20e')]-_0x5f268a[_0x042c('0x77')]-_0x5f268a[_0x042c('0xca')];emitCampaignSummary(_0x5f268a);if(_0x3585f3>0x0){if(_0x3585f3>this[_0x042c('0x25')]){_0x3585f3=this[_0x042c('0x25')];}_0x5f268a[_0x042c('0xca')]+=_0x3585f3;this['getContactDialerIvr'](_0x5f268a['id'],_0x3585f3,_0x5f268a[_0x042c('0x20f')],_0x5f268a)[_0x042c('0x3e')](function(_0x49b610){_0x5f268a[_0x042c('0xca')]-=_0x3585f3;_0x5f268a[_0x042c('0xca')]=_0x5f268a['temp']>0x0?_0x5f268a[_0x042c('0xca')]:0x0;if(!checkContactEmpty(_0x49b610)){_0x5f268a[_0x042c('0x41')]=_0x042c('0x210');logger[_0x042c('0x85')](_0x042c('0x211')+_0x5f268a[_0x042c('0x44')]);}else{_0x5f268a[_0x042c('0x77')]+=_0x49b610[_0x042c('0xa0')];_0x5f268a[_0x042c('0x41')]=_0x042c('0x212');for(var _0x4e6d5c=0x0;_0x4e6d5c<_0x49b610[_0x042c('0xa0')];_0x4e6d5c+=0x1){_0x5f268a['ivrTotalCallsDays']+=0x1;if(_[_0x042c('0xb1')](_0x49b610[_0x4e6d5c])||_['isNil'](_0x49b610[_0x4e6d5c][_0x042c('0x18d')])||_[_0x042c('0xb1')](_0x49b610[_0x4e6d5c][_0x042c('0x17a')])){_0x4a71fe[_0x042c('0xd4')](_0x042c('0x213'),_0x5f268a,_0x49b610[_0x4e6d5c]);}else{_0x4a71fe[_0x042c('0xc1')](_[_0x042c('0xd7')](_0x49b610[_0x4e6d5c],[_0x042c('0xda'),_0x042c('0x214')]))['then'](_0x4a71fe[_0x042c('0x1f5')](_0x5f268a,_0x49b610[_0x4e6d5c]))[_0x042c('0xb4')](_0x4a71fe['loggerHandler'](_0x042c('0x215'),_0x5f268a));}}}})['catch'](loggerGetContactDialer(_0x042c('0x216'),_0x5f268a,_0x3585f3));}};Dialer[_0x042c('0x1c')][_0x042c('0x160')]=function(_0x5de8e4,_0x10dace){var _0xad89d2=this;var _0x371d24=[];var _0x2db313=_0x10dace>=0x1?_0x10dace:0x1;if(_0x5de8e4[_0x042c('0x5f')]===_0x042c('0x8')){_0x2db313=0x1;}var _0x326499=Math[_0x042c('0x1d5')](_0x5de8e4[_0x042c('0x54')]*_0x2db313)-_0x5de8e4[_0x042c('0x77')]-_0x5de8e4[_0x042c('0xca')];emitVoiceQueueSummary(_0x5de8e4);if(_0x5de8e4[_0x042c('0x217')]>0x0){var _0x1a97dc=_0x5de8e4[_0x042c('0x217')]-_0x5de8e4['originated']-_0x5de8e4[_0x042c('0x5a')]-_0x5de8e4[_0x042c('0xca')]-_0x5de8e4[_0x042c('0x56')];if(_0x326499>_0x1a97dc){_0x326499=_0x1a97dc;}}if(_0x326499>0x0){if(_0x5de8e4[_0x042c('0x5f')]===_0x042c('0x8')){_0x326499=0x1;}if(_0x326499>this[_0x042c('0x25')]){_0x326499=this[_0x042c('0x25')];}_0x5de8e4[_0x042c('0xca')]+=_0x326499;for(var _0x58954b in this[_0x042c('0x23')]){if(typeof this[_0x042c('0x23')][_0x58954b]!==_0x042c('0xa1')){if(this[_0x042c('0x23')][_0x58954b][_0x042c('0xea')]===_0x042c('0x218')&&this[_0x042c('0x23')][_0x58954b][_0x042c('0xb2')]===_0x042c('0xe1')){_0x371d24[_0x042c('0x152')](this['agents'][_0x58954b]['id']);}}}this[_0x042c('0xc9')](_0x5de8e4['id'],_0x371d24,_0x326499,_0x5de8e4[_0x042c('0x20f')],_0x5de8e4)[_0x042c('0x3e')](function(_0x45e352){_0x5de8e4[_0x042c('0xca')]-=_0x326499;_0x5de8e4[_0x042c('0xca')]=_0x5de8e4['temp']>0x0?_0x5de8e4['temp']:0x0;if(!checkContactEmpty(_0x45e352)){_0xad89d2['countReScheduled'](_0x5de8e4)[_0x042c('0x3e')](sendMessageReschedule(_0x5de8e4))['catch'](loggerCatch(_0x042c('0xbb')));}else{_0x5de8e4[_0x042c('0x77')]+=_0x45e352[_0x042c('0xa0')];_0x5de8e4[_0x042c('0x41')]=_0x5de8e4[_0x042c('0x5f')]===_0x042c('0x8')?'ACTIVE':'RUNNING';for(var _0x2418ea=0x0;_0x2418ea<_0x45e352[_0x042c('0xa0')];_0x2418ea+=0x1){if(_[_0x042c('0xb1')](_0x45e352[_0x2418ea])||_[_0x042c('0xb1')](_0x45e352[_0x2418ea][_0x042c('0x18d')])||_[_0x042c('0xb1')](_0x45e352[_0x2418ea]['phone'])){_0xad89d2[_0x042c('0xd4')](_0x042c('0x213'),_0x5de8e4,_0x45e352[_0x2418ea]);}else{_0xad89d2['checkIsBlackList'](_[_0x042c('0xd7')](_0x45e352[_0x2418ea],[_0x042c('0x101'),_0x042c('0x214')]))[_0x042c('0x3e')](_0xad89d2[_0x042c('0x1f5')](_0x5de8e4,_0x45e352[_0x2418ea]))[_0x042c('0xb4')](_0xad89d2[_0x042c('0x219')](_0x042c('0x213'),_0x5de8e4));}}}})[_0x042c('0xb4')](loggerGetContactDialer(_0x042c('0x21a'),_0x5de8e4,_0x326499));}};Dialer['prototype'][_0x042c('0x97')]=function(_0x14251c){if(_0x14251c[_0x042c('0x217')]>0x0){var _0x2105d6=_0x14251c[_0x042c('0x217')]-_0x14251c[_0x042c('0x77')]-_0x14251c[_0x042c('0x5a')];if(_0x2105d6>0x0){this[_0x042c('0x21b')](_0x14251c);}else{loggerPredictiveCalls['info'](_0x042c('0x21c'));}}else{this[_0x042c('0x21b')](_0x14251c);}};Dialer[_0x042c('0x1c')][_0x042c('0x21b')]=function(_0x2d97f6){var _0x511b94=this;var _0x1a4e9b=[];_0x2d97f6[_0x042c('0x77')]+=0x1;for(var _0x1aa5b8 in this[_0x042c('0x23')]){if(typeof this[_0x042c('0x23')][_0x1aa5b8]!=='undefined'){if(this[_0x042c('0x23')][_0x1aa5b8][_0x042c('0xea')]===_0x042c('0x218')&&this[_0x042c('0x23')][_0x1aa5b8][_0x042c('0xb2')]==='reachable'){_0x1a4e9b[_0x042c('0x152')](this[_0x042c('0x23')][_0x1aa5b8]['id']);}}}this[_0x042c('0xc9')](_0x2d97f6['id'],_0x1a4e9b,0x1,_0x2d97f6['dialOrderByScheduledAt'],_0x2d97f6)[_0x042c('0x3e')](function(_0x5827f8){if(!checkContactEmpty(_0x5827f8)){checkContactLowerLimitOriginate(_0x2d97f6,0x1,0x0);_0x511b94['countReScheduled'](_0x2d97f6)[_0x042c('0x3e')](sendMessageReschedule(_0x2d97f6))['catch'](loggerCatch(_0x042c('0xbb')));}else{_0x2d97f6[_0x042c('0x41')]=_0x042c('0x212');if(_[_0x042c('0xb1')](_0x5827f8[0x0])||_['isNil'](_0x5827f8[0x0][_0x042c('0x18d')])||_[_0x042c('0xb1')](_0x5827f8[0x0][_0x042c('0x17a')])){_0x511b94[_0x042c('0xd4')](_0x042c('0x213'),_0x2d97f6,_0x5827f8[0x0]);}else{_0x511b94['checkIsBlackList'](_['pick'](_0x5827f8[0x0],['VoiceQueueId','Contact.phone']))[_0x042c('0x3e')](_0x511b94[_0x042c('0x1f5')](_0x2d97f6,_0x5827f8[0x0]))[_0x042c('0xb4')](_0x511b94[_0x042c('0x219')](_0x042c('0x21d'),_0x2d97f6));}}})[_0x042c('0xb4')](loggerGetContactDialer(_0x042c('0x21e'),_0x2d97f6,0x1));emitVoiceQueueSummary(_0x2d97f6);};Dialer[_0x042c('0x1c')][_0x042c('0x1eb')]=function(_0x861809,_0x3efd4c,_0x33d5b5,_0x126047,_0x37cdae,_0x3885d2){loggerPredictive[_0x042c('0x85')](_0x042c('0x21f'));loggerPredictive[_0x042c('0x85')]('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',_0x861809);loggerPredictive[_0x042c('0x85')](_0x042c('0x220'),_0x3efd4c);loggerPredictive[_0x042c('0x85')](_0x042c('0x221'),_0x33d5b5);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x126047);loggerPredictive[_0x042c('0x85')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37cdae);loggerPredictive['info']('---------------------------');return new Promise(function(_0x2b7721,_0x2c2271){if(_0x861809<=0x0||isNaN(_0x861809)){return _0x2c2271(msgResponse(_0x042c('0x222'),'Error','m\x20=\x20'+_0x861809));}if(_0x33d5b5<=0x0||isNaN(_0x33d5b5)){return _0x2c2271(msgResponse('[abandonmentRate]','Error',_0x042c('0x223')+_0x33d5b5));}if(_0x126047<=0x0||isNaN(_0x126047)){return _0x2c2271(msgResponse(_0x042c('0x222'),'Error','p\x20=\x20'+_0x126047));}if(_0x3efd4c<=0x0||isNaN(_0x3efd4c)){return _0x2c2271(msgResponse('[abandonmentRate]',_0x042c('0x4c'),_0x042c('0x224')+_0x3efd4c));}if(_0x37cdae<=0x0||isNaN(_0x37cdae)){return _0x2c2271(msgResponse(_0x042c('0x222'),_0x042c('0x4c'),_0x042c('0x225')+_0x37cdae));}_0x3885d2=_0x3885d2||0x0;var _0xba32db=0x1/_0x33d5b5;var _0x368382=0x0;var _0x3c905f=0x0;var _0x36a2b4=0x0;var _0x373238=0x0;for(var _0x1d2937=0x0;_0x36a2b4<_0x37cdae;_0x1d2937+=0x1){_0x3c905f=_0x1d2937/_0x3efd4c;_0x368382=(_0x126047*_0x3c905f+_0x3885d2)/_0xba32db;_0x36a2b4=erlangb(_0x368382,_0x861809);_0x373238=_0x368382/_0x861809*(0x1-erlangb(_0x368382,_0x861809));}return _0x2b7721({'erlangCalls':_0x1d2937,'erlangCallToSecond':_0x3efd4c/_0x1d2937,'erlangAbandonmentRate':_0x36a2b4,'erlangBusyFactor':_0x373238});});};Dialer[_0x042c('0x1c')][_0x042c('0x1ed')]=function(_0xf5cb3b,_0x439d94,_0x521d53,_0x2e8846,_0x10a5f8,_0x214d9a){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x042c('0x85')](_0x042c('0x226'),_0xf5cb3b);loggerPredictive[_0x042c('0x85')](_0x042c('0x220'),_0x439d94);loggerPredictive['info'](_0x042c('0x221'),_0x521d53);loggerPredictive[_0x042c('0x85')]('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',_0x2e8846);loggerPredictive[_0x042c('0x85')](_0x042c('0x227'),_0x10a5f8);loggerPredictive[_0x042c('0x85')]('---------------------------');return new Promise(function(_0x4a3534,_0x5424c6){if(_0xf5cb3b<=0x0||isNaN(_0xf5cb3b)){return _0x5424c6(msgResponse(_0x042c('0x228'),'Error',_0x042c('0x229')+_0xf5cb3b));}if(_0x521d53<=0x0||isNaN(_0x521d53)){return _0x5424c6(msgResponse(_0x042c('0x228'),_0x042c('0x4c'),_0x042c('0x223')+_0x521d53));}if(_0x2e8846<=0x0||isNaN(_0x2e8846)){return _0x5424c6(msgResponse(_0x042c('0x228'),_0x042c('0x4c'),_0x042c('0x22a')+_0x2e8846));}if(_0x439d94<=0x0||isNaN(_0x439d94)){return _0x5424c6(msgResponse(_0x042c('0x228'),_0x042c('0x4c'),'interval\x20=\x20'+_0x439d94));}if(_0x10a5f8<=0x0||isNaN(_0x10a5f8)){return _0x5424c6(msgResponse(_0x042c('0x228'),'Error',_0x042c('0x22b')+_0x10a5f8));}_0x214d9a=_0x214d9a||0x0;var _0x15bcbe=0x1/_0x521d53;var _0x3fc2cd=0x0;var _0x130523=0x0;var _0x3bca1e=0x0;var _0x3099cc=0x0;for(var _0x77a606=0x0;_0x3099cc<_0x10a5f8;_0x77a606+=0x1){_0x130523=_0x77a606/_0x439d94;_0x3fc2cd=(_0x2e8846*_0x130523+_0x214d9a)/_0x15bcbe;_0x3bca1e=erlangb(_0x3fc2cd,_0xf5cb3b);_0x3099cc=_0x3fc2cd/_0xf5cb3b*(0x1-erlangb(_0x3fc2cd,_0xf5cb3b));}return _0x4a3534({'erlangCalls':_0x77a606,'erlangCallToSecond':_0x439d94/_0x77a606,'erlangAbandonmentRate':_0x3bca1e,'erlangBusyFactor':_0x3099cc});});};module[_0x042c('0x22c')]=Dialer; \ No newline at end of file +var _0xeba6=['buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./history','./final','./agentComplete','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startProgressive','agentconnect','queuecallerabandon','syncQueueCallerAbandon','bind','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','milliseconds','seconds','emit','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','active','callerid','stringify','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','starttime','clearZombieChannels','[actions]','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','ContactId','UserId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','status','reachable','SIP/%s','unmonitored','uniqueid','isNil','amdstatus','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','state','AMD','custom:amd','buildObj','[syncHangupInAMD]','MACHINE','membername','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countnosuchnumberretry','countdropretry','reason\x2019\x20machine....','add','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','outboundUnknownCallsDay','cause-txt','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','TIMEOUT','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','stateinterface','queueBooked','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','isArray','Action','iftime\x20%s,%s','interval','content','command','indexOf','true','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','dialMethod','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','online','map','checkIsTrunkReachable','\x5cw{0,','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','createdAt','updatedAt','XMD-','toUpper','TrunkBackup','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','responsetime','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer'];(function(_0x55b99d,_0x2d3024){var _0x48f13d=function(_0x421a2e){while(--_0x421a2e){_0x55b99d['push'](_0x55b99d['shift']());}};_0x48f13d(++_0x2d3024);}(_0xeba6,0x69));var _0x6eba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeba6[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6eba('0x0'));var _=require(_0x6eba('0x1'));var uuid=require(_0x6eba('0x2'));var moment=require(_0x6eba('0x3'));var rr=require('rr');var md5=require(_0x6eba('0x4'));var Redis=require('ioredis');var ut=require(_0x6eba('0x5'));var config=require(_0x6eba('0x6'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0x6eba('0x7'))(_0x6eba('0x8'));var loggerPredictive=require(_0x6eba('0x7'))(_0x6eba('0x9'));var loggerPredictiveCalls=require(_0x6eba('0x7'))(_0x6eba('0xa'));var loggerSyncQueueSummary=require(_0x6eba('0x7'))(_0x6eba('0xb'));var ami=require(_0x6eba('0xc'));config[_0x6eba('0xd')]=_['defaults'](config[_0x6eba('0xd')],{'host':_0x6eba('0xe'),'port':0x18eb});var io=require(_0x6eba('0xf'))(new Redis(config[_0x6eba('0xd')]));var cmHopper=require(_0x6eba('0x10'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperAdditionalPhone=require(_0x6eba('0x11'));var cmHopperBlack=require(_0x6eba('0x12'));var voiceQueueRt=require(_0x6eba('0x13'));var RpcSetting=require(_0x6eba('0x14'));var Action=require('./action');var History=require(_0x6eba('0x15'));var Final=require(_0x6eba('0x16'));var AgentComplete=require(_0x6eba('0x17'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x6eba('0x18'));var ipAgi=process['env'][_0x6eba('0x19')]||_0x6eba('0x1a');var strategy={'rrmemory':_0x6eba('0x1b'),'roundrobin':_0x6eba('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x6eba('0x1d')][_0x6eba('0x1e')]=function(_0x2e185e){this['tail']=this[_0x6eba('0x1f')]?this[_0x6eba('0x1f')][_0x6eba('0x20')](_0x2e185e):_0x2e185e();};function Dialer(_0x3e02df,_0x10e258){this[_0x6eba('0x21')]=new Sequence();this['preview']=_0x10e258;this[_0x6eba('0x22')]=_0x3e02df[_0x6eba('0x22')];this[_0x6eba('0x23')]=_0x3e02df[_0x6eba('0x23')];this['agents']=_0x3e02df[_0x6eba('0x24')];this[_0x6eba('0x25')]=_0x3e02df['trunks'];this[_0x6eba('0x26')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x6eba('0x27')]={};this['contactsId']={};this[_0x6eba('0x28')]={};this[_0x6eba('0x29')]={};this['startPredictive']={};this[_0x6eba('0x2a')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};ami['on'](_0x6eba('0x2b'),this['syncAgentConnect']['bind'](this));ami['on'](_0x6eba('0x2c'),this[_0x6eba('0x2d')][_0x6eba('0x2e')](this));ami['on']('originateresponse',this[_0x6eba('0x2f')][_0x6eba('0x2e')](this));ami['on'](_0x6eba('0x30'),this[_0x6eba('0x31')][_0x6eba('0x2e')](this));ami['on']('custom:queuesummary',this[_0x6eba('0xb')][_0x6eba('0x2e')](this));ami['on'](_0x6eba('0x32'),this[_0x6eba('0x33')]['bind'](this));ami['on'](_0x6eba('0x34'),this[_0x6eba('0x35')][_0x6eba('0x2e')](this));ami['on'](_0x6eba('0x36'),this[_0x6eba('0x37')][_0x6eba('0x2e')](this));ami['on'](_0x6eba('0x38'),this[_0x6eba('0x39')][_0x6eba('0x2e')](this));ami['on'](_0x6eba('0x3a'),this['syncQueueMember']['bind'](this));ami['on'](_0x6eba('0x3b'),this[_0x6eba('0x3c')][_0x6eba('0x2e')](this));this[_0x6eba('0x3d')]();this[_0x6eba('0x3e')]();RpcSetting[_0x6eba('0x3f')]()[_0x6eba('0x40')](function(_0x21a3b9){previewRecallmeReminderInterval=_0x21a3b9[_0x6eba('0x41')];});}function isNotNull(_0x3fb969){return _0x3fb969!==null&&!_[_0x6eba('0x42')](_0x3fb969);}function checkIsLoggedIn(_0x43a45a,_0x2e8c29){return function(){if(_0x2e8c29<=0x0){_0x43a45a[_0x6eba('0x43')]='AGENTS_NOT_LOGGED';throw _0x43a45a[_0x6eba('0x44')]+_0x6eba('0x45');}};}function isActive(_0x5c1251){return _0x5c1251;}function checkIsActive(_0x1b7050,_0x1e0883){return function(){if(!isActive(_0x1e0883)){_0x1b7050['message']=_0x6eba('0x46');throw _0x1b7050[_0x6eba('0x44')]+_0x6eba('0x47');}};}function checkInterval(_0x355a00){return function(){if(!isNotNull(_0x355a00[_0x6eba('0x48')])){_0x355a00['message']='INTERVAL_IS_NULL';throw _0x355a00[_0x6eba('0x44')]+_0x6eba('0x49');}if(!isNotNull(_0x355a00[_0x6eba('0x48')][_0x6eba('0x4a')])){_0x355a00[_0x6eba('0x43')]=_0x6eba('0x4b');throw _0x355a00[_0x6eba('0x44')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x6eba('0x4c')](_0x355a00[_0x6eba('0x48')][_0x6eba('0x4a')]))){_0x355a00['message']=_0x6eba('0x4b');throw _0x355a00[_0x6eba('0x44')]+_0x6eba('0x49');}};}function msgResponse(_0x49d616,_0x4287f7,_0x26fc77){return{'action':_0x49d616,'response':_0x4287f7,'message':_0x26fc77,'stack':_0x26fc77};}function myreject(_0x2091db){return function(_0x1425e2){return _0x2091db(msgResponse(_0x6eba('0x4d'),'Error',JSON['stringify'](_0x1425e2)));};}function getSeconds(_0x501b0a,_0xa3dffc){var _0x5b7727=moment(_0x501b0a)['milliseconds'](0x0);var _0x5962e6=moment(_0xa3dffc)[_0x6eba('0x4e')](0x0);return _0x5b7727['diff'](_0x5962e6,_0x6eba('0x4f'));}function emit(_0x74c233,_0x3e1b1f,_0x39ad4d){io['to'](_0x74c233)[_0x6eba('0x50')](_0x3e1b1f,_0x39ad4d);}function emitVoiceQueueSummary(_0x5f535e){if(_0x5f535e['type']===_0x6eba('0x51')){var _0x567a9b={'id':_0x5f535e['id'],'name':_0x5f535e[_0x6eba('0x44')],'strategy':_0x5f535e[_0x6eba('0x52')],'answered':_0x5f535e[_0x6eba('0x53')],'available':_0x5f535e[_0x6eba('0x54')],'loggedIn':_0x5f535e['loggedIn'],'pTalking':_0x5f535e[_0x6eba('0x55')],'sumBillable':_0x5f535e[_0x6eba('0x56')],'sumDuration':_0x5f535e[_0x6eba('0x57')],'sumHoldTime':_0x5f535e[_0x6eba('0x58')]||0x0,'talking':_0x5f535e['talking'],'total':_0x5f535e[_0x6eba('0x59')],'type':_0x5f535e[_0x6eba('0x5a')],'unmanaged':_0x5f535e[_0x6eba('0x5b')],'abandoned':_0x5f535e[_0x6eba('0x5c')],'waiting':_0x5f535e['waiting'],'loggedInDb':_0x5f535e[_0x6eba('0x5d')],'dialActive':_0x5f535e[_0x6eba('0x5e')],'dialMethod':_0x5f535e['dialMethod'],'dialOriginateCallerIdName':_0x5f535e[_0x6eba('0x5f')],'dialOriginateCallerIdNumber':_0x5f535e[_0x6eba('0x60')],'dialOriginateTimeout':_0x5f535e[_0x6eba('0x61')],'dialPrefix':_0x5f535e[_0x6eba('0x62')],'outboundAnswerAgiCallsDay':_0x5f535e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5f535e[_0x6eba('0x63')],'outboundBlacklistCallsDay':_0x5f535e['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5f535e[_0x6eba('0x64')],'outboundCongestionCallsDay':_0x5f535e[_0x6eba('0x65')],'outboundDropCallsDayACS':_0x5f535e[_0x6eba('0x66')],'outboundDropCallsDayCallersExit':_0x5f535e[_0x6eba('0x67')],'outboundDropCallsDayTimeout':_0x5f535e[_0x6eba('0x68')],'outboundNoAnswerCallsDay':_0x5f535e[_0x6eba('0x69')],'outboundNoSuchCallsDay':_0x5f535e[_0x6eba('0x6a')],'outboundOriginateFailureCallsDay':_0x5f535e[_0x6eba('0x6b')],'outboundReCallsDay':_0x5f535e[_0x6eba('0x6c')],'outboundRejectCallsDay':_0x5f535e[_0x6eba('0x6d')],'outboundUnknownCallsDay':_0x5f535e['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x5f535e[_0x6eba('0x6e')],'predictiveIntervalAvgHoldtime':_0x5f535e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x5f535e['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5f535e[_0x6eba('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x5f535e[_0x6eba('0x70')],'predictiveIntervalErlangCalls':_0x5f535e[_0x6eba('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x5f535e[_0x6eba('0x72')],'predictiveIntervalHitRate':_0x5f535e[_0x6eba('0x73')],'predictiveIntervalMultiplicativeFactor':_0x5f535e[_0x6eba('0x74')],'predictiveIntervalPauses':_0x5f535e['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5f535e[_0x6eba('0x75')],'predictiveIntervalTotalCalls':_0x5f535e[_0x6eba('0x76')],'message':_0x5f535e[_0x6eba('0x43')],'originated':_0x5f535e[_0x6eba('0x77')],'erlangCalls':_0x5f535e[_0x6eba('0x78')],'erlangCallToSecond':_0x5f535e[_0x6eba('0x79')],'erlangAbandonmentRate':_0x5f535e['erlangAbandonmentRate'],'erlangBusyFactor':_0x5f535e[_0x6eba('0x7a')],'startPredictive':_0x5f535e[_0x6eba('0x7b')],'startProgressive':_0x5f535e[_0x6eba('0x2a')]};if(_0x5f535e[_0x6eba('0x7c')]){_0x567a9b[_0x6eba('0x7c')]={'id':_0x5f535e[_0x6eba('0x7c')]['id'],'name':_0x5f535e[_0x6eba('0x7c')][_0x6eba('0x44')],'active':_0x5f535e[_0x6eba('0x7c')][_0x6eba('0x7d')],'callerid':_0x5f535e[_0x6eba('0x7c')][_0x6eba('0x7e')]};}if(_0x5f535e[_0x6eba('0x48')]){_0x567a9b['Interval']={'id':_0x5f535e[_0x6eba('0x48')]['id'],'name':_0x5f535e[_0x6eba('0x48')]['name']};}var _0x57a44f=md5(JSON[_0x6eba('0x7f')](_0x567a9b));if(_0x5f535e[_0x6eba('0x4')]!==_0x57a44f){_0x5f535e[_0x6eba('0x4')]=_0x57a44f;emit(util[_0x6eba('0x80')](_0x6eba('0x81'),_0x567a9b[_0x6eba('0x44')]),_0x6eba('0x82'),_0x567a9b);}}}function emitCampaignSummary(_0x2c637e){if(_0x2c637e[_0x6eba('0x5a')]===_0x6eba('0x83')){emit(util[_0x6eba('0x80')]('campaign:ivr:%s',_0x2c637e[_0x6eba('0x44')]),_0x6eba('0x84'),_0x2c637e);}}function checkGetDataPredictive(_0x4456ff){if(isNotNull(_0x4456ff)&&!_[_0x6eba('0x4c')](_0x4456ff)){loggerPredictive['info'](_0x6eba('0x85'));loggerPredictive['info'](_0x6eba('0x86'),_0x4456ff[_0x6eba('0x76')]);loggerPredictive['info'](_0x6eba('0x87'),_0x4456ff[_0x6eba('0x6e')]);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x89'),_0x4456ff[_0x6eba('0x70')]);loggerPredictive[_0x6eba('0x88')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4456ff[_0x6eba('0x6f')]);loggerPredictive[_0x6eba('0x88')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4456ff['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8a'),_0x4456ff['predictiveIntervalAvgTalktime']);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8b'));if(_0x4456ff[_0x6eba('0x76')]>0x0){if(!_[_0x6eba('0x42')](_0x4456ff[_0x6eba('0x8c')])&&_0x4456ff[_0x6eba('0x8c')]>0x0){return!![];}loggerPredictive['info'](_0x6eba('0x8d'));if(!_['isUndefined'](_0x4456ff[_0x6eba('0x8e')])&&_0x4456ff[_0x6eba('0x8e')]>0x0){return!![];}loggerPredictive[_0x6eba('0x88')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8f'));}}else{loggerPredictive[_0x6eba('0x88')](_0x6eba('0x90'));}return![];}function mergeDataErlangB(_0x111405){return function(_0x1c4e7b){loggerPredictive[_0x6eba('0x88')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x6eba('0x88')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c4e7b[_0x6eba('0x78')]);loggerPredictive[_0x6eba('0x88')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c4e7b['erlangCallToSecond']);loggerPredictive['info'](_0x6eba('0x91'),_0x1c4e7b[_0x6eba('0x92')]);loggerPredictive['info'](_0x6eba('0x93'),_0x1c4e7b[_0x6eba('0x7a')]);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x91'),_0x1c4e7b[_0x6eba('0x92')]);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8b'));_['merge'](_0x111405,_0x1c4e7b);};}function getDiff(_0x48d515){var _0x27c324=moment()[_0x6eba('0x4e')](0x0);var _0x2fce65=moment(_0x48d515)[_0x6eba('0x4e')](0x0);return _0x27c324[_0x6eba('0x94')](_0x2fce65,_0x6eba('0x4f'));}function ifInterval(_0x402ab9,_0x5cfefa){if(_['isUndefined'](_0x5cfefa)){return![];}return getDiff(_0x5cfefa)<_0x402ab9*0x3c;}function freeVariablesPredictive(_0x2a6666){if(isNotNull(_0x2a6666)){if(!_['isUndefined'](_0x2a6666['startProgressive'])){_0x2a6666[_0x6eba('0x2a')]=undefined;loggerPredictive[_0x6eba('0x88')](_0x2a6666[_0x6eba('0x44')],_0x6eba('0x95'));}if(!_['isUndefined'](_0x2a6666['startPredictive'])){_0x2a6666[_0x6eba('0x7b')]=undefined;loggerPredictive[_0x6eba('0x88')](_0x2a6666[_0x6eba('0x44')],_0x6eba('0x96'));}if(!_[_0x6eba('0x42')](_0x2a6666[_0x6eba('0x97')])){clearInterval(_0x2a6666[_0x6eba('0x97')]);_0x2a6666[_0x6eba('0x97')]=undefined;loggerPredictive[_0x6eba('0x88')](_0x2a6666[_0x6eba('0x44')],_0x6eba('0x98'));}}}function erlangb(_0x2899f6,_0x21f0f3){if(_0x21f0f3===0x0){return 0x0;}var _0x279169=0x1;for(var _0x1bb9c0=0x1;_0x1bb9c0<=_0x21f0f3;_0x1bb9c0+=0x1){_0x279169=0x1+_0x279169*_0x1bb9c0/_0x2899f6;}return 0x1/_0x279169;}function isVoiceQueueOutbound(_0x127074){return _0x127074===_0x6eba('0x51');}function isNotPreview(_0x30afd9){return _0x30afd9!==_0x6eba('0x99');}function isCampaignIvr(_0x73e434){return _0x73e434===_0x6eba('0x83');}function getCallerId(_0xa6c6a0,_0x461af9,_0x376e8b){if(!_[_0x6eba('0x42')](_0x376e8b)&&typeof _0x376e8b===_0x6eba('0x9a')&&!_[_0x6eba('0x4c')](_0x376e8b)){if(!_[_0x6eba('0x42')](_0x461af9)&&typeof _0x461af9===_0x6eba('0x9a')&&!_[_0x6eba('0x4c')](_0x461af9)){return util[_0x6eba('0x80')](_0x6eba('0x9b'),_0x461af9,_0x376e8b);}return util[_0x6eba('0x80')](_0x6eba('0x9b'),_0x376e8b,_0x376e8b);}if(!_['isUndefined'](_0xa6c6a0)&&typeof _0xa6c6a0==='string'&&!_['isEmpty'](_0xa6c6a0)){return _0xa6c6a0;}return _0x6eba('0x9c');}function loggerCatchQueueSummary(_0x23899d,_0x3a879c){return function(_0x3ab8e9){freeVariablesPredictive(_0x3a879c);emitVoiceQueueSummary(_0x3a879c);emitCampaignSummary(_0x3a879c);loggerSyncQueueSummary[_0x6eba('0x9d')](_0x23899d,util[_0x6eba('0x9e')](_0x3ab8e9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xe223d0,_0x54fcd2){return function(_0x393781){loggerPredictive[_0x6eba('0x9f')](_0x54fcd2[_0x6eba('0x44')],_0xe223d0);loggerPredictive[_0x6eba('0x9f')](_0x393781[_0x6eba('0xa0')]);freeVariablesPredictive(_0x54fcd2);};}function loggerCatch(_0x35bbb6){return function(_0x156a67){logger[_0x6eba('0x9f')](_0x35bbb6,util[_0x6eba('0x9e')](_0x156a67,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x504053){return _0x504053&&!_[_0x6eba('0x42')](_0x504053)&&_0x504053[_0x6eba('0xa1')]>0x0;}function decremetOriginate(_0x254c6c){if(!_[_0x6eba('0x42')](_0x254c6c)&&_0x254c6c!==null){if(typeof _0x254c6c['originated']!==_0x6eba('0xa2')){if(_0x254c6c['originated']>0x0){_0x254c6c[_0x6eba('0x77')]-=0x1;}else{logger[_0x6eba('0x9f')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0x6eba('0xa3'));}}function checkContactLowerLimitOriginate(_0x472432,_0x2c8c90,_0xe67df7){if(_0x2c8c90>_0xe67df7){for(var _0x53adc4=0x0;_0x53adc4<_0x2c8c90-_0xe67df7;_0x53adc4+=0x1){decremetOriginate(_0x472432);}}}function loggerGetContactDialer(_0x518891,_0x3a4097,_0xe3d580){return function(_0x4427a5){checkContactLowerLimitOriginate(_0x3a4097,_0xe3d580,0x0);logger[_0x6eba('0x9f')](_0x518891,util[_0x6eba('0x9e')](_0x4427a5,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4636fe){return function(_0x220eb6){if(isNotNull(_0x220eb6)&&isNotNull(_0x220eb6[0x0])){if(_0x220eb6[0x0][_0x6eba('0xa4')]>0x0){_0x4636fe[_0x6eba('0x43')]=_0x6eba('0xa5');logger['info'](_0x6eba('0xa6')+_0x4636fe[_0x6eba('0x44')],_0x220eb6[0x0]['contactsRescheduled'],'contacts');}else{_0x4636fe['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x6eba('0x88')](_0x6eba('0xa7')+_0x4636fe[_0x6eba('0x44')]);}}};}function notSendMessagesQueue(_0x281c1b){if(_0x281c1b[_0x6eba('0xa8')]){freeVariablesPredictive(_0x281c1b);if(_0x281c1b[_0x6eba('0x77')]===0x0&&_0x281c1b[_0x6eba('0xa9')]===0x0&&_0x281c1b['waiting']===0x0&&(_0x281c1b['pTalking']||0x0)===0x0){_0x281c1b[_0x6eba('0xa8')]=![];_0x281c1b[_0x6eba('0x54')]=0x0;_0x281c1b[_0x6eba('0x43')]=_0x6eba('0x46');loggerSyncQueueSummary[_0x6eba('0x9d')](_0x6eba('0xaa'),_0x281c1b['name'],_0x6eba('0xab'));}else{_0x281c1b[_0x6eba('0x43')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x6eba('0x9d')](_0x6eba('0xaa'),_0x281c1b[_0x6eba('0x44')],'is\x20disactive');}emitVoiceQueueSummary(_0x281c1b);}}function notSendMessagesCampaign(_0x25b797){if(_0x25b797[_0x6eba('0xa8')]){if(_0x25b797[_0x6eba('0x77')]===0x0){_0x25b797[_0x6eba('0xa8')]=![];_0x25b797[_0x6eba('0x43')]=_0x6eba('0x46');loggerSyncQueueSummary[_0x6eba('0x9d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x25b797[_0x6eba('0x44')],_0x6eba('0xab'));}else{_0x25b797[_0x6eba('0x43')]=_0x6eba('0xac');loggerSyncQueueSummary[_0x6eba('0x9d')](_0x6eba('0xad'),_0x25b797[_0x6eba('0x44')],_0x6eba('0xae'));}emitCampaignSummary(_0x25b797);}}function createObjHistory(_0x23b900,_0x3817f9,_0x2da49a,_0x3d47bf,_0x58cfaa){_0x23b900[_0x6eba('0x43')]=_0x2da49a;var _0x30803f=new Action(_0x23b900,_0x3817f9);var _0x28e717=new History(_0x30803f);_0x28e717['state']=_0x3d47bf;_0x28e717[_0x6eba('0xaf')]=_0x58cfaa;_0x28e717[_0x6eba('0xb0')]=_0x30803f[_0x6eba('0xb1')];return _0x28e717;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x27e59e=this;setInterval(function(){_0x27e59e[_0x6eba('0xb2')](_0x27e59e['uniqueId'],'[uniqueid]');_0x27e59e['clearZombieChannels'](_0x27e59e[_0x6eba('0x27')],_0x6eba('0xb3'));},0x32c8);};Dialer[_0x6eba('0x1d')]['clearZombieChannels']=function(_0x366743,_0x53402e){var _0xf0fa0=this;for(var _0x1c233a in _0x366743){if(typeof _0x366743[_0x1c233a]!==_0x6eba('0xa2')){this[_0x6eba('0x21')]['enqueue'](function(){if(!_['isNil'](_0x366743[_0x1c233a])){return ami['Action']({'action':'status','channel':_0x366743[_0x1c233a][_0x6eba('0xb4')]})[_0x6eba('0xb5')](function(_0x9d718d){if(_0x9d718d[_0x6eba('0x43')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x366743[_0x1c233a]&&_0x366743[_0x1c233a][_0x6eba('0x5a')]!==_0x6eba('0x83')){_0xf0fa0[_0x6eba('0xb6')](_0xf0fa0[_0x6eba('0x22')][_0x366743[_0x1c233a][_0x6eba('0xb7')]]);logger['error'](_0x6eba('0xb8'),_0x53402e,_0x1c233a,_0x366743[_0x1c233a]['queue']);delete _0x366743[_0x1c233a];}if(_0x366743[_0x1c233a]&&_0x366743[_0x1c233a][_0x6eba('0x5a')]===_0x6eba('0x83')){_0xf0fa0[_0x6eba('0xb6')](_0xf0fa0['campaigns'][_0x366743[_0x1c233a]['queue']]);logger[_0x6eba('0x9f')](_0x6eba('0xb9'),_0x53402e,_0x1c233a,_0x366743[_0x1c233a][_0x6eba('0xb7')]);delete _0x366743[_0x1c233a];}},0x2328);}});}});}}};Dialer[_0x6eba('0x1d')][_0x6eba('0xba')]=function(_0x2e2fc4){return Promise[_0x6eba('0xbb')]()['then'](cmHopper[_0x6eba('0xba')](_0x2e2fc4))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xbc')));};Dialer[_0x6eba('0x1d')][_0x6eba('0xbd')]=function(_0x109445){return Promise[_0x6eba('0xbb')]()['then'](cmHopperBlack[_0x6eba('0xbd')](_0x109445))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype'][_0x6eba('0xbe')]=function(_0x2ca275,_0x2d8229,_0x40ad24){return Promise['resolve']()[_0x6eba('0x40')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x2ca275,_0x2d8229,_0x40ad24))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xbf')));};Dialer[_0x6eba('0x1d')][_0x6eba('0xc0')]=function(_0x453bf0,_0x2bf41c,_0x617906){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopperAdditionalPhone[_0x6eba('0xc0')](_0x453bf0,_0x2bf41c,_0x617906))['catch'](loggerCatch(_0x6eba('0xc1')));};Dialer[_0x6eba('0x1d')][_0x6eba('0xc2')]=function(_0x2731de){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopperBlack[_0x6eba('0xc2')](_0x2731de))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xc3')));};Dialer[_0x6eba('0x1d')]['averageHandleTime']=function(_0xb9aa92){return Promise[_0x6eba('0xbb')]()['then'](cmHopperHistory[_0x6eba('0xc4')](_0xb9aa92))['catch'](loggerCatch(_0x6eba('0xc5')));};Dialer[_0x6eba('0x1d')][_0x6eba('0xc6')]=function(_0x39cf93){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopper[_0x6eba('0xc6')](_0x39cf93))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xc7')));};Dialer[_0x6eba('0x1d')]['unlockContact']=function(_0x1c26d6,_0x101cc3,_0x531af6){return Promise['resolve']()[_0x6eba('0x40')](cmHopper[_0x6eba('0xc8')](_0x1c26d6,_0x101cc3,_0x531af6))['catch'](loggerCatch(_0x6eba('0xc9')));};Dialer['prototype'][_0x6eba('0xca')]=function(_0x456d50,_0x5971ac,_0x39355b,_0x32e5cc,_0x50de83){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopper[_0x6eba('0xca')](_0x456d50,_0x5971ac,_0x39355b,_0x32e5cc))['catch'](function(_0x234d64){_0x50de83['temp']-=_0x39355b;_0x50de83['temp']=_0x50de83['temp']>0x0?_0x50de83[_0x6eba('0xcb')]:0x0;loggerCatch(_0x6eba('0xcc'))(_0x234d64);});};Dialer[_0x6eba('0x1d')]['getContactDialerIvr']=function(_0x5e5719,_0x1d004e,_0x5891e3,_0x1848fe){return Promise[_0x6eba('0xbb')]()['then'](cmHopper[_0x6eba('0xcd')](_0x5e5719,_0x1d004e,_0x5891e3))[_0x6eba('0xb5')](function(_0x171f4f){_0x1848fe[_0x6eba('0xcb')]-=_0x1d004e;_0x1848fe['temp']=_0x1848fe['temp']>0x0?_0x1848fe[_0x6eba('0xcb')]:0x0;loggerCatch(_0x6eba('0xce'))(_0x171f4f);});};Dialer[_0x6eba('0x1d')][_0x6eba('0xcf')]=function(_0x141265){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](voiceQueueRt[_0x6eba('0xcf')](_0x141265))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xd0')));};Dialer[_0x6eba('0x1d')]['moveContactManagedDialer']=function(_0x3abb18){return Promise['resolve']()[_0x6eba('0x40')](cmHopper[_0x6eba('0xd1')](_0x3abb18))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xd2')));};Dialer['prototype'][_0x6eba('0xd3')]=function(_0x2fff89){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopperHistory[_0x6eba('0xd3')](_0x2fff89))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x6eba('0x1d')][_0x6eba('0xb6')]=function(_0x579846){if(!_['isUndefined'](_0x579846)&&_0x579846!==null){if(typeof _0x579846['originated']!==_0x6eba('0xa2')){if(_0x579846[_0x6eba('0x77')]>0x0){_0x579846[_0x6eba('0x77')]-=0x1;}else{logger[_0x6eba('0x9f')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x6eba('0x9f')](_0x6eba('0xd4'));}};Dialer['prototype'][_0x6eba('0xd5')]=function(_0x2088ec,_0x102338){var _0x42bea1=this;return function(_0x30d13c){_0x42bea1[_0x6eba('0xb6')](_0x102338);logger['error'](_0x2088ec,util['inspect'](_0x30d13c,{'showHidden':![],'depth':null}));};};Dialer[_0x6eba('0x1d')][_0x6eba('0xd6')]=function(_0x329a6d,_0x628c23,_0x33540c){var _0x3cf46f={'state':0x19,'statedesc':_0x6eba('0xd7')};this['updateOriginated'](_0x628c23);this[_0x6eba('0xd8')](_[_0x6eba('0xd9')](_0x3cf46f,_['pick'](_0x33540c,[_0x6eba('0xda'),'ListId',_0x6eba('0xdb'),'VoiceQueueId',_0x6eba('0xdc')])),_0x6eba('0xdd'),_0x6eba('0xde'));logger[_0x6eba('0x9f')](_0x329a6d);};Dialer[_0x6eba('0x1d')][_0x6eba('0xdf')]=function(_0x53369e){return _0x53369e==='Success';};Dialer[_0x6eba('0x1d')][_0x6eba('0xe0')]=function(_0xc9dfa8){return!_[_0x6eba('0x42')](_0xc9dfa8)&&_0xc9dfa8&&!_[_0x6eba('0x42')](_0xc9dfa8[_0x6eba('0x44')])&&!_[_0x6eba('0x42')](_0xc9dfa8['active'])&&_0xc9dfa8['active']&&(this[_0x6eba('0x25')][util['format']('SIP/%s',_0xc9dfa8['name'])][_0x6eba('0xe1')]===_0x6eba('0xe2')||this[_0x6eba('0x25')][util[_0x6eba('0x80')](_0x6eba('0xe3'),_0xc9dfa8['name'])][_0x6eba('0xe1')]===_0x6eba('0xe4'));};Dialer[_0x6eba('0x1d')][_0x6eba('0xd8')]=function(_0x38734b,_0x1c11fb,_0x25347b){this[_0x6eba('0xd3')](_0x38734b)['catch'](loggerCatch(_0x1c11fb));this[_0x6eba('0xd1')](_0x38734b)[_0x6eba('0xb5')](loggerCatch(_0x25347b));};Dialer['prototype']['syncVarSet']=function(_0x18cc37){var _0x4daf4b=this;var _0x24a729=this['uniqueId'][_0x18cc37[_0x6eba('0xe5')]];var _0x251015;if(!_[_0x6eba('0xe6')](_0x18cc37)&&!_['isNil'](_0x18cc37['variable'])&&!_[_0x6eba('0xe6')](_0x18cc37['variable'][_0x6eba('0xe7')])&&_0x18cc37['exten']==='xcally-motion-dialer'&&_0x24a729){if(_0x24a729[_0x6eba('0x5a')]!==_0x6eba('0x83')&&this['voiceQueues'][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0xe8')]&&_0x18cc37[_0x6eba('0xe9')]===_0x6eba('0xea')){delete this[_0x6eba('0x28')][_0x18cc37[_0x6eba('0xe5')]];this['updateOriginated'](this['voiceQueues'][_0x24a729['queue']]);this[_0x6eba('0x22')][_0x24a729['queue']][_0x6eba('0x63')]+=0x1;this['voiceQueues'][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0xeb')]+=0x1;_0x251015=new Hangup(_0x24a729,_0x18cc37);_0x251015[_0x6eba('0xec')]=0x12;_0x251015[_0x6eba('0xaf')]='HangupInAMD';_0x251015['membername']=_0x6eba('0xed');ami[_0x6eba('0x50')](_0x6eba('0xee'),ut[_0x6eba('0xef')](_0x251015,'amd'));this[_0x6eba('0xd8')](_0x251015,'[syncHangupInAMD][createHistory]',_0x6eba('0xf0'));}if(_0x24a729[_0x6eba('0x5a')]!==_0x6eba('0x83')&&this['voiceQueues'][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0xe8')]&&_0x18cc37[_0x6eba('0xe9')]===_0x6eba('0xf1')){return new Promise(function(_0xd0122b,_0x526192){delete _0x4daf4b[_0x6eba('0x28')][_0x18cc37[_0x6eba('0xe5')]];_0x4daf4b[_0x6eba('0xb6')](_0x4daf4b['voiceQueues'][_0x24a729['queue']]);_0x4daf4b['voiceQueues'][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0x63')]+=0x1;_0x4daf4b[_0x6eba('0x22')][_0x24a729['queue']][_0x6eba('0xeb')]+=0x1;var _0x400f61=_0x4daf4b[_0x6eba('0x22')][_0x24a729[_0x6eba('0xb7')]];var _0xdd5b58=new Hangup(_0x24a729,_0x18cc37);_0xdd5b58[_0x6eba('0xec')]=0x13;_0xdd5b58['statedesc']='Machine';_0xdd5b58[_0x6eba('0xf2')]=_0x6eba('0xed');_0xdd5b58['countmachineretry']+=0x1;_0xdd5b58[_0x6eba('0xf3')]+=0x1;_0xdd5b58['amd']=!![];ami[_0x6eba('0x50')](_0x6eba('0xee'),ut[_0x6eba('0xef')](_0xdd5b58,_0x6eba('0xf4')));_0x4daf4b[_0x6eba('0xd3')](_0xdd5b58)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xf5')));if(_0xdd5b58[_0x6eba('0xf6')]+_0xdd5b58['countcongestionretry']+_0xdd5b58[_0x6eba('0xf7')]+_0xdd5b58['countnosuchnumberretry']+_0xdd5b58['countdropretry']+_0xdd5b58[_0x6eba('0xf8')]+_0xdd5b58[_0x6eba('0xf9')]+_0xdd5b58[_0x6eba('0xfa')]>=_0x400f61[_0x6eba('0xfb')]){_0x4daf4b[_0x6eba('0xfc')](_0xdd5b58,_0xd0122b,_0x526192,_0x6eba('0xfd'));}else{if(_0xdd5b58[_0x6eba('0xf9')]>=_0x400f61[_0x6eba('0xfe')]){_0x4daf4b[_0x6eba('0xff')](_0xdd5b58,_0xd0122b,_0x526192,'reason\x2019\x20machine....');}else{_0x4daf4b['rescheduleContact']({'active':![],'countmachineretry':_0xdd5b58['countmachineretry'],'scheduledat':moment()['add'](_0x400f61[_0x6eba('0x100')],'minutes')[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0xdd5b58['ContactId'],'ListId':_0xdd5b58[_0x6eba('0x102')],'VoiceQueueId':_0xdd5b58['VoiceQueueId']||undefined,'CampaignId':_0xdd5b58['CampaignId']||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x103')));_0xd0122b({'reschedule':0x1});}}});}if(_0x24a729[_0x6eba('0x5a')]===_0x6eba('0x83')&&this['campaigns'][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0xe8')]&&_0x18cc37[_0x6eba('0xe9')]==='HANGUP'){delete this[_0x6eba('0x28')][_0x18cc37[_0x6eba('0xe5')]];this[_0x6eba('0xb6')](this[_0x6eba('0x23')][_0x24a729[_0x6eba('0xb7')]]);_0x251015=new Hangup(_0x24a729,_0x18cc37);_0x251015[_0x6eba('0xec')]=0x12;_0x251015[_0x6eba('0xaf')]='HangupInAMD';_0x251015[_0x6eba('0xf2')]=_0x6eba('0xed');ami[_0x6eba('0x50')]('custom:amd',ut[_0x6eba('0xef')](_0x251015,'amd'));this['saveInDb'](_0x251015,_0x6eba('0x104'),_0x6eba('0x105'));}if(_0x24a729[_0x6eba('0x5a')]===_0x6eba('0x83')&&this['campaigns'][_0x24a729['queue']][_0x6eba('0xe8')]&&_0x18cc37[_0x6eba('0xe9')]==='MACHINE'){return new Promise(function(_0x43a013,_0x90ea08){delete _0x4daf4b[_0x6eba('0x28')][_0x18cc37[_0x6eba('0xe5')]];_0x4daf4b[_0x6eba('0xb6')](_0x4daf4b[_0x6eba('0x23')][_0x24a729[_0x6eba('0xb7')]]);_0x4daf4b[_0x6eba('0x23')][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0x63')]+=0x1;_0x4daf4b[_0x6eba('0x23')][_0x24a729[_0x6eba('0xb7')]][_0x6eba('0xeb')]+=0x1;var _0x38f5c6=_0x4daf4b[_0x6eba('0x23')][_0x24a729[_0x6eba('0xb7')]];var _0x473af5=new Hangup(_0x24a729,_0x18cc37);_0x473af5[_0x6eba('0xec')]=0x13;_0x473af5[_0x6eba('0xaf')]='Machine';_0x473af5[_0x6eba('0xf2')]=_0x6eba('0xed');_0x473af5[_0x6eba('0xf9')]+=0x1;_0x473af5[_0x6eba('0xf3')]+=0x1;_0x473af5[_0x6eba('0xf4')]=!![];ami[_0x6eba('0x50')](_0x6eba('0xee'),ut['buildObj'](_0x473af5,'amd'));_0x4daf4b[_0x6eba('0xd3')](_0x473af5)['catch'](loggerCatch(_0x6eba('0xf5')));if(_0x473af5[_0x6eba('0xf6')]+_0x473af5[_0x6eba('0x106')]+_0x473af5[_0x6eba('0xf7')]+_0x473af5[_0x6eba('0x107')]+_0x473af5[_0x6eba('0x108')]+_0x473af5[_0x6eba('0xf8')]+_0x473af5['countmachineretry']+_0x473af5[_0x6eba('0xfa')]>=_0x38f5c6[_0x6eba('0xfb')]){_0x4daf4b[_0x6eba('0xfc')](_0x473af5,_0x43a013,_0x90ea08,'reason19\x20machine....');}else{if(_0x473af5[_0x6eba('0xf9')]>=_0x38f5c6[_0x6eba('0xfe')]){_0x4daf4b[_0x6eba('0xff')](_0x473af5,_0x43a013,_0x90ea08,_0x6eba('0x109'));}else{_0x4daf4b['rescheduleContact']({'active':![],'countmachineretry':_0x473af5[_0x6eba('0xf9')],'scheduledat':moment()[_0x6eba('0x10a')](_0x38f5c6[_0x6eba('0x100')],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x473af5[_0x6eba('0xda')],'ListId':_0x473af5[_0x6eba('0x102')],'VoiceQueueId':_0x473af5['VoiceQueueId']||undefined,'CampaignId':_0x473af5['CampaignId']||undefined})[_0x6eba('0xb5')](loggerCatch('[rescheduleContact][Machine]'));_0x43a013({'reschedule':0x1});}}});}}};Dialer[_0x6eba('0x1d')][_0x6eba('0x35')]=function(_0x19448a){var _0x23d842=this[_0x6eba('0x28')][_0x19448a['uniqueid']];var _0x2b3c08;if(_0x23d842&&_0x23d842['type']===_0x6eba('0x83')){delete this['uniqueId'][_0x19448a['uniqueid']];this[_0x6eba('0xb6')](this[_0x6eba('0x23')][_0x23d842[_0x6eba('0xb7')]]);this[_0x6eba('0x23')][_0x23d842[_0x6eba('0xb7')]][_0x6eba('0x10c')]+=0x1;_0x2b3c08=new Hangup(_0x23d842,_0x19448a);this['createHistory'](_0x2b3c08)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x10d')));this[_0x6eba('0xd1')](_0x2b3c08)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x10e')));}if(_0x23d842&&_0x23d842[_0x6eba('0x5a')]!==_0x6eba('0x83')&&isNotNull(this['voiceQueues'][_0x23d842[_0x6eba('0xb7')]]['dialQueueProject'])){delete this[_0x6eba('0x28')][_0x19448a['uniqueid']];this[_0x6eba('0xb6')](this[_0x6eba('0x22')][_0x23d842['queue']]);this[_0x6eba('0x22')][_0x23d842[_0x6eba('0xb7')]][_0x6eba('0x63')]+=0x1;this[_0x6eba('0x22')][_0x23d842[_0x6eba('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2b3c08=new Hangup(_0x23d842,_0x19448a);_0x2b3c08[_0x6eba('0xec')]=0x10;_0x2b3c08['statedesc']=_0x6eba('0x10f');_0x2b3c08['membername']=_0x6eba('0x110');this[_0x6eba('0xd3')](_0x2b3c08)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6eba('0xd1')](_0x2b3c08)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x10e')));}if(_0x23d842&&_0x23d842[_0x6eba('0x5a')]!==_0x6eba('0x83')&&!isNotNull(this[_0x6eba('0x22')][_0x23d842[_0x6eba('0xb7')]][_0x6eba('0x111')])){delete this['uniqueId'][_0x19448a[_0x6eba('0xe5')]];this['updateOriginated'](this[_0x6eba('0x22')][_0x23d842[_0x6eba('0xb7')]]);this[_0x6eba('0x22')][_0x23d842[_0x6eba('0xb7')]][_0x6eba('0x112')]+=0x1;_0x2b3c08=new Hangup(_0x23d842,_0x19448a);_0x2b3c08[_0x6eba('0xec')]=0xc;_0x2b3c08[_0x6eba('0xaf')]=_0x19448a[_0x6eba('0x113')];_0x2b3c08[_0x6eba('0xf2')]='Unknow';this[_0x6eba('0xd3')](_0x2b3c08)['catch'](loggerCatch(_0x6eba('0x10d')));this[_0x6eba('0xd1')](_0x2b3c08)[_0x6eba('0xb5')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x6eba('0x1d')][_0x6eba('0x31')]=function(_0x489caf){var _0x161b64=this[_0x6eba('0x28')][_0x489caf[_0x6eba('0xe5')]];if(this[_0x6eba('0x22')][_0x489caf[_0x6eba('0xb7')]]){if(_0x161b64&&_0x161b64[_0x6eba('0x5a')]!==_0x6eba('0x83')){delete this['uniqueId'][_0x489caf[_0x6eba('0xe5')]];this['voiceQueues'][_0x489caf[_0x6eba('0xb7')]][_0x6eba('0x63')]+=0x1;var _0x1480bc=new AgentComplete(_0x161b64,_0x489caf);if(_0x489caf[_0x6eba('0x114')]==='agent'){_0x1480bc[_0x6eba('0x115')]=this['voiceQueues'][_0x489caf[_0x6eba('0xb7')]][_0x6eba('0x116')]&&this[_0x6eba('0x22')][_0x489caf[_0x6eba('0xb7')]][_0x6eba('0x117')]?moment()['format'](_0x6eba('0x101')):undefined;}this[_0x6eba('0xd3')](_0x1480bc)[_0x6eba('0xb5')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0x6eba('0xd1')](_0x1480bc)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x118')));}}};Dialer[_0x6eba('0x1d')][_0x6eba('0x119')]=function(_0x421275){if(this[_0x6eba('0x22')][_0x421275[_0x6eba('0xb7')]]){if(this[_0x6eba('0x28')][_0x421275[_0x6eba('0xe5')]]&&this[_0x6eba('0x28')][_0x421275[_0x6eba('0xe5')]][_0x6eba('0x5a')]!==_0x6eba('0x83')){this[_0x6eba('0xb6')](this[_0x6eba('0x22')][_0x421275[_0x6eba('0xb7')]]);this[_0x6eba('0x28')][_0x421275[_0x6eba('0xe5')]][_0x6eba('0x11a')]=moment()[_0x6eba('0x80')](_0x6eba('0x101'));}}};Dialer[_0x6eba('0x1d')]['queueCallerAbandonCreateState']=function(_0xdc7108,_0x15b187){this['createHistory'](_0xdc7108)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x15b187==0x0){this['moveContactManagedDialer'](_0xdc7108)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x11b')));}};Dialer['prototype'][_0x6eba('0x2d')]=function(_0x51152e){var _0x58042b=this['uniqueId'][_0x51152e[_0x6eba('0xe5')]];var _0x31fea8=this;var _0x4bf088=![];var _0x36c071;var _0x1417b9;if(this['voiceQueues'][_0x51152e[_0x6eba('0xb7')]]){if(_0x58042b&&_0x58042b['type']!=='ivr'){delete this['uniqueId'][_0x51152e[_0x6eba('0xe5')]];this[_0x6eba('0xb6')](this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]]);_0x58042b[_0x6eba('0x11c')]=moment()[_0x6eba('0x80')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2f8031=new QueueCallerAbandon(_0x58042b,_0x51152e);if(getSeconds(_0x58042b[_0x6eba('0x11c')],_0x58042b['responsetime'])>=_0x58042b[_0x6eba('0x11d')]){this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x70')]+=0x1;this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x68')]+=0x1;this[_0x6eba('0x22')][_0x51152e['queue']][_0x6eba('0x72')]+=0x1;_0x2f8031[_0x6eba('0xec')]=0xa;_0x2f8031['statedesc']=_0x6eba('0x11e');_0x2f8031['dropreason']=_0x6eba('0x11f');_0x2f8031['agiafterat']=this[_0x6eba('0x22')][_0x51152e['queue']][_0x6eba('0x116')]?moment()[_0x6eba('0x80')](_0x6eba('0x101')):undefined;_0x2f8031[_0x6eba('0x108')]+=0x1;_0x2f8031[_0x6eba('0xf3')]+=0x1;_0x36c071=this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]]['dialDropRetryFrequency'];_0x1417b9=this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x120')];_0x31fea8['verifyAdditionalPhones'](_0x2f8031,_0x2f8031[_0x6eba('0xec')],_0x58042b[_0x6eba('0x121')])[_0x6eba('0x40')](function(_0x53f593){_0x4bf088=_0x53f593[_0x6eba('0x122')]==0x1;if(_0x2f8031['countdropretry']>=_0x31fea8[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x123')]){_0x31fea8[_0x6eba('0x124')](_0x2f8031,_0x53f593['additional']);}else{_0x31fea8['rescheduleContact']({'active':![],'countdropretry':_0x2f8031[_0x6eba('0x108')],'scheduledat':moment()[_0x6eba('0x10a')](_0x31fea8[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x125')],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x58042b[_0x6eba('0xda')],'ListId':_0x58042b['ListId'],'VoiceQueueId':_0x58042b[_0x6eba('0x126')]||undefined,'CampaignId':_0x58042b[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x127')));var _0x5966ef=new History(_0x2f8031);_0x5966ef[_0x6eba('0xec')]=0xa;_0x5966ef[_0x6eba('0xaf')]='Drop';_0x5966ef[_0x6eba('0xb1')]=moment()[_0x6eba('0x80')](_0x6eba('0x101'));_0x5966ef[_0x6eba('0xb0')]=_0x5966ef[_0x6eba('0xb1')];_0x5966ef[_0x6eba('0x128')]=_0x2f8031[_0x6eba('0x128')];_0x5966ef['calleridnum']=_0x2f8031[_0x6eba('0x129')];_0x31fea8[_0x6eba('0xd3')](_0x5966ef)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x12a')));}})['then'](function(){if(_0x4bf088)_0x31fea8[_0x6eba('0xc0')](_0x2f8031,_0x36c071,_0x1417b9)[_0x6eba('0x40')](function(){return 0x1;});});}else{this['voiceQueues'][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x6f')]+=0x1;this[_0x6eba('0x22')][_0x51152e['queue']][_0x6eba('0x67')]+=0x1;_0x2f8031[_0x6eba('0xec')]=0xb;_0x2f8031[_0x6eba('0xaf')]=_0x6eba('0x12b');_0x2f8031[_0x6eba('0x12c')]=_0x6eba('0x12d');_0x2f8031[_0x6eba('0xf8')]+=0x1;_0x2f8031[_0x6eba('0xf3')]+=0x1;_0x36c071=this[_0x6eba('0x22')][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x12e')];_0x1417b9=this['voiceQueues'][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x120')];_0x31fea8['verifyAdditionalPhones'](_0x2f8031,_0x2f8031['state'],_0x58042b[_0x6eba('0x121')])['then'](function(_0x458a58){if(_0x2f8031[_0x6eba('0xf8')]>=_0x31fea8['voiceQueues'][_0x51152e[_0x6eba('0xb7')]][_0x6eba('0x12f')]){_0x31fea8['queueCallerAbandonCreateState'](_0x2f8031,_0x458a58['additional']);}else{_0x31fea8[_0x6eba('0xc6')]({'active':![],'countabandonedretry':_0x2f8031['countabandonedretry'],'scheduledat':moment()[_0x6eba('0x10a')](_0x31fea8[_0x6eba('0x22')][_0x51152e['queue']]['dialAbandonedRetryFrequency'],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x58042b[_0x6eba('0xda')],'ListId':_0x58042b[_0x6eba('0x102')],'VoiceQueueId':_0x58042b[_0x6eba('0x126')]||undefined,'CampaignId':_0x58042b[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x130')));var _0x165d56=new History(_0x2f8031);_0x165d56[_0x6eba('0xec')]=0xb;_0x165d56[_0x6eba('0xaf')]=_0x6eba('0x12b');_0x165d56[_0x6eba('0xb1')]=moment()[_0x6eba('0x80')]('YYYY-MM-DD\x20HH:mm:ss');_0x165d56['endtime']=_0x165d56[_0x6eba('0xb1')];_0x165d56[_0x6eba('0x128')]=_0x2f8031[_0x6eba('0x128')];_0x165d56['calleridnum']=_0x2f8031[_0x6eba('0x129')];_0x31fea8[_0x6eba('0xd3')](_0x165d56)[_0x6eba('0xb5')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x6eba('0x40')](function(){if(_0x4bf088)_0x31fea8[_0x6eba('0xc0')](_0x2f8031,_0x36c071,_0x1417b9)[_0x6eba('0x40')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x6eba('0x37')]=function(_0x93b77c){if(this['actions'][_0x93b77c[_0x6eba('0xe5')]]){this[_0x6eba('0x27')][_0x93b77c[_0x6eba('0xe5')]][_0x6eba('0xb4')]=_0x93b77c[_0x6eba('0xb4')];}if(this['uniqueId'][_0x93b77c['uniqueid']]){this[_0x6eba('0x28')][_0x93b77c[_0x6eba('0xe5')]][_0x6eba('0xb4')]=_0x93b77c[_0x6eba('0xb4')];}};Dialer[_0x6eba('0x1d')][_0x6eba('0x131')]=function(_0x4763ec){if(strategy[this[_0x6eba('0x22')][this[_0x6eba('0x27')][_0x4763ec['actionid']]['queue']][_0x6eba('0x52')]]===_0x6eba('0x1c')){if(this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]]&&_[_0x6eba('0xe6')](this['actions'][_0x4763ec[_0x6eba('0x132')]][_0x6eba('0x133')])&&_0x4763ec[_0x6eba('0xe1')]==='1'&&_0x4763ec['paused']==='0'){if(this[_0x6eba('0x24')][_0x4763ec[_0x6eba('0x134')]]){if(!this['agents'][_0x4763ec[_0x6eba('0x134')]][_0x6eba('0x133')]){this[_0x6eba('0x24')][_0x4763ec[_0x6eba('0x134')]][_0x6eba('0x133')]=!![];this[_0x6eba('0x27')][_0x4763ec['actionid']]['locked']=!![];this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]][_0x6eba('0x134')]=_0x4763ec['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]][_0x6eba('0xb7')]]['strategy']]||_0x6eba('0x1b'))===_0x6eba('0x1b')){if(this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]]){if(this[_0x6eba('0x24')][_0x4763ec['stateinterface']]){this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]]['stateinterface']=_0x4763ec['stateinterface'];if(_[_0x6eba('0xe6')](this[_0x6eba('0x135')][this[_0x6eba('0x27')][_0x4763ec['actionid']][_0x6eba('0xb7')]])){this[_0x6eba('0x135')][this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]][_0x6eba('0xb7')]]=[];}this['queueBooked'][this['actions'][_0x4763ec[_0x6eba('0x132')]][_0x6eba('0xb7')]][_0x6eba('0x136')](_[_0x6eba('0xd9')](_[_0x6eba('0x137')](this[_0x6eba('0x27')][_0x4763ec[_0x6eba('0x132')]],[_0x6eba('0x138'),'stateinterface']),{'status':_0x4763ec[_0x6eba('0xe1')],'paused':_0x4763ec['paused']}));}}}};function unlockQueueStatus(_0xc2838f,_0x4317e0){setTimeout(function(){if(_['isUndefined'](_0xc2838f[_0x6eba('0x139')])){loggerBooked[_0x6eba('0x9f')](_0x6eba('0x13a'),_0x4317e0);}_0xc2838f[_0x6eba('0x139')]=!![];loggerBooked[_0x6eba('0x88')](_0x6eba('0x13b'),_0x4317e0,JSON['stringify'](_[_0x6eba('0x137')](_0xc2838f,[_0x6eba('0x44'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x6eba('0x1d')][_0x6eba('0x3c')]=function(_0x429ade){var _0x4c6f4e=this;var _0xb957d2=_0x4c6f4e['voiceQueues'][_0x4c6f4e[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]];if(strategy[this[_0x6eba('0x22')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]['strategy']]===_0x6eba('0x1c')){if(this[_0x6eba('0x27')][_0x429ade['actionid']]&&this['actions'][_0x429ade['actionid']][_0x6eba('0x134')]){this['preview'][_0x6eba('0x13c')](this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0x138')],this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0x134')])['catch'](function(_0x1bdc1b){logger['error'](_0x6eba('0x13d'),util[_0x6eba('0x9e')](_0x1bdc1b,{'showHidden':![],'depth':null}));})[_0x6eba('0x20')](function(){_0x4c6f4e['updateOriginated'](_0x4c6f4e['voiceQueues'][_0x4c6f4e[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]);_0x4c6f4e['agents'][_0x4c6f4e[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0x134')]]['locked']=![];delete _0x4c6f4e['actions'][_0x429ade['actionid']];unlockQueueStatus(_0xb957d2);});}else{this[_0x6eba('0xb6')](this[_0x6eba('0x22')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]);this[_0x6eba('0xc6')]({'active':![],'ContactId':this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xda')],'ListId':this[_0x6eba('0x27')][_0x429ade['actionid']][_0x6eba('0x102')],'VoiceQueueId':this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x13e')));delete this[_0x6eba('0x27')][_0x429ade['actionid']];unlockQueueStatus(_0xb957d2);}}else if((strategy[this['voiceQueues'][this[_0x6eba('0x27')][_0x429ade['actionid']]['queue']][_0x6eba('0x52')]]||_0x6eba('0x1b'))===_0x6eba('0x1b')){var _0x36486d;if(this[_0x6eba('0x27')][_0x429ade['actionid']]&&!_[_0x6eba('0x4c')](this[_0x6eba('0x135')][this['actions'][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]])){if(this['queueBookedRR'][_0x4c6f4e[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]]['queue']]){this['queueBookedRR'][_0x4c6f4e['actions'][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]=this[_0x6eba('0x13f')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]?this[_0x6eba('0x13f')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]]:this['queueBooked'][this[_0x6eba('0x27')][_0x429ade['actionid']][_0x6eba('0xb7')]]?this['queueBooked'][this['actions'][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]][_0x6eba('0x140')]||0x0:0x0;}this[_0x6eba('0x135')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]][_0x6eba('0xb7')]][_0x6eba('0x140')]=this[_0x6eba('0x13f')][this[_0x6eba('0x27')][_0x429ade[_0x6eba('0x132')]]['queue']];for(var _0x181c89=0x0;_0x181c89=0x0;})[_0x6eba('0xb5')](myreject(_0x12948a)));}}else{_0x1605b8[_0x6eba('0x136')](ami['Action']({'action':_0x6eba('0x15a'),'command':util[_0x6eba('0x80')](_0x6eba('0x157'),_0x474bc0,!_[_0x6eba('0x42')](config[_0x6eba('0x153')][_0x1bec61])?_0x1bec61:'')})[_0x6eba('0x40')](function(_0xbd5b32){return _0xbd5b32[_0x6eba('0x159')][_0x6eba('0x15b')](_0x6eba('0x15c'))>=0x0;})['catch'](myreject(_0x12948a)));}Promise['all'](_0x1605b8)[_0x6eba('0x40')](function(_0x4e41ad){var _0x149ded=_['some'](_0x4e41ad);if(_0x149ded){return _0x49b227(_0x149ded);}else{_0x5a568d[_0x6eba('0x43')]=_0x37aaac?_0x6eba('0x15d'):_0x6eba('0x15e');return _0x12948a(msgResponse(_0x6eba('0x15f'),_0x6eba('0x150'),_0x6eba('0x160')+_0x37aaac+'\x20'+_0x155a2f+_0x6eba('0x161')+util[_0x6eba('0x9e')](_0x474bc0,{'showHidden':![],'depth':null})+_0x6eba('0x162')+_0x1bec61));}})[_0x6eba('0xb5')](function(_0x967ffe){return _0x12948a(msgResponse(_0x6eba('0x14e'),_0x6eba('0x150'),JSON[_0x6eba('0x7f')](_0x967ffe)));});});};Dialer[_0x6eba('0x1d')][_0x6eba('0x163')]=function(_0x166776){var _0x589d00=this;return function(){switch(_0x166776['dialMethod']){case'progressive':freeVariablesPredictive(_0x166776);_0x589d00[_0x6eba('0x164')](_0x166776,0x1);break;case'power':freeVariablesPredictive(_0x166776);_0x589d00['handlePower'](_0x166776,_0x166776[_0x6eba('0x165')]);break;case'predictive':_0x589d00[_0x6eba('0x9')](_0x166776);break;case _0x6eba('0x8'):freeVariablesPredictive(_0x166776);_0x589d00[_0x6eba('0x164')](_0x166776,0x1);break;default:freeVariablesPredictive(_0x166776);logger[_0x6eba('0x9f')](_0x6eba('0x166'),_0x166776['name'],_0x6eba('0x167'));}};};Dialer[_0x6eba('0x1d')][_0x6eba('0x168')]=function(_0x46da8d){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopper[_0x6eba('0x169')](_0x46da8d['id'],previewRecallmeReminderInterval))[_0x6eba('0x40')](function(_0x53b19d){for(var _0x1c6947=0x0;_0x1c6947<_0x53b19d[_0x6eba('0xa1')];_0x1c6947++){var _0x13ab29=_0x53b19d[_0x1c6947][_0x6eba('0x16a')][_0x6eba('0x44')];if(_0x13ab29)io['to'](util[_0x6eba('0x80')](_0x6eba('0x16b'),_0x13ab29))['emit'](_0x6eba('0x16c'),{'hopper':_0x53b19d[_0x1c6947]});}})[_0x6eba('0xb5')](function(){});};Dialer[_0x6eba('0x1d')][_0x6eba('0x16d')]=function(_0x2dded7){var _0x23c67c=this;return function(){_0x23c67c['handleIvr'](_0x2dded7);};};Dialer[_0x6eba('0x1d')][_0x6eba('0xb')]=function(_0xcefe34){var _0x3f4867=this;if(isNotPreview(_0xcefe34[_0x6eba('0x16e')])){if(isVoiceQueueOutbound(_0xcefe34['type'])&&isActive(_0xcefe34[_0x6eba('0x5e')])){_0xcefe34['sendMessageOneNotActive']=!![];Promise[_0x6eba('0xbb')]()['then'](checkIsLoggedIn(_0xcefe34,_0xcefe34[_0x6eba('0x16f')]))[_0x6eba('0x40')](checkIsActive(_0xcefe34,_0xcefe34[_0x6eba('0x5e')]))['then'](checkInterval(_0xcefe34))['then'](_0x3f4867['checkIsTrunkReachable'](_0xcefe34))[_0x6eba('0x40')](_0x3f4867['checkIfTime'](_0xcefe34[_0x6eba('0x170')],_0xcefe34[_0x6eba('0x171')],_0xcefe34[_0x6eba('0x44')],_0xcefe34))['then'](_0x3f4867[_0x6eba('0x14f')](_0xcefe34['Interval'],_0xcefe34[_0x6eba('0x171')],_0xcefe34[_0x6eba('0x44')],_0xcefe34))['then'](_0x3f4867['checkDialMethod'](_0xcefe34))[_0x6eba('0xb5')](loggerCatchQueueSummary(_0x6eba('0x172'),_0xcefe34));}else{notSendMessagesQueue(_0xcefe34);}}else{freeVariablesPredictive(_0xcefe34);}};Dialer[_0x6eba('0x1d')]['syncQueueSummaryComplete']=_[_0x6eba('0x173')](function(){var _0x49a13d=_['filter'](this[_0x6eba('0x22')],function(_0x770945){return _0x770945[_0x6eba('0x174')];});var _0x2959fa=_[_0x6eba('0x175')](this[_0x6eba('0x24')],function(_0x202b27){return _0x202b27[_0x6eba('0x176')]&&_0x202b27[_0x6eba('0xe1')]===_0x6eba('0xe2');});if(_0x49a13d[_0x6eba('0xa1')]>0x0&&_0x2959fa['length']>0x0){return Promise[_0x6eba('0xbb')]()[_0x6eba('0x40')](cmHopper[_0x6eba('0x169')](_[_0x6eba('0x177')](_0x49a13d,'id'),previewRecallmeReminderInterval,_[_0x6eba('0x177')](_0x2959fa,'id')))[_0x6eba('0x40')](function(_0x21e2ad){for(var _0x31de00=0x0;_0x31de00<_0x21e2ad[_0x6eba('0xa1')];_0x31de00++){var _0x4b0fb6=_0x21e2ad[_0x31de00][_0x6eba('0x16a')][_0x6eba('0x44')];if(_0x4b0fb6)io['to'](util[_0x6eba('0x80')](_0x6eba('0x16b'),_0x4b0fb6))[_0x6eba('0x50')]('user:dialPreviewRecallReminder',{'hopper':_0x21e2ad[_0x31de00]});}})['catch'](function(_0x27adc4){logger['error'](_0x6eba('0x168'),_0x27adc4);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x6eba('0x1d')][_0x6eba('0x14b')]=function(){var _0x372c4d=this;var _0x1aeacb;for(var _0x7a9acc in this[_0x6eba('0x23')]){if(typeof this[_0x6eba('0x23')][_0x7a9acc]!=='undefined'){_0x1aeacb=this[_0x6eba('0x23')][_0x7a9acc];if(isCampaignIvr(_0x1aeacb[_0x6eba('0x5a')])&&isActive(_0x1aeacb[_0x6eba('0x7d')])){_0x1aeacb[_0x6eba('0xa8')]=!![];Promise['resolve']()[_0x6eba('0x40')](checkIsActive(_0x1aeacb,_0x1aeacb[_0x6eba('0x7d')]))['then'](checkInterval(_0x1aeacb))['then'](_0x372c4d[_0x6eba('0x178')](_0x1aeacb))[_0x6eba('0x40')](_0x372c4d[_0x6eba('0x14d')](_0x1aeacb['dialGlobalInterval'],_0x1aeacb['dialTimezone'],_0x1aeacb['name'],_0x1aeacb))[_0x6eba('0x40')](_0x372c4d[_0x6eba('0x14f')](_0x1aeacb[_0x6eba('0x48')],_0x1aeacb[_0x6eba('0x171')],_0x1aeacb[_0x6eba('0x44')],_0x1aeacb))['then'](_0x372c4d[_0x6eba('0x16d')](_0x1aeacb))[_0x6eba('0xb5')](loggerCatchQueueSummary('[syncCampaigns]',_0x1aeacb));}else{notSendMessagesCampaign(_0x1aeacb);}}}};function getCallerIdRandom(_0x196408,_0x5f2385){var _0x452c2c;var _0x53090c;var _0x432230;if(_0x5f2385<=0x0){_0x5f2385=0x1;}_0x452c2c=new RegExp(_0x6eba('0x179')+_0x5f2385+'}$');_0x53090c=Math['pow'](0xa,_0x5f2385-0x1);_0x432230=Math['pow'](0xa,_0x5f2385)-0x1;return util[_0x6eba('0x80')]('%s',_[_0x6eba('0x17a')](_0x196408,_0x452c2c,_[_0x6eba('0x17b')](_0x53090c,_0x432230)));}function extractCalleridName(_0x5d93d1){var _0x3c8a3f=_0x5d93d1[_0x6eba('0x17c')](/"(.*?)"/);return _0x3c8a3f?_0x3c8a3f[0x1]:_0x5d93d1;}Dialer[_0x6eba('0x1d')]['actionOriginate']=function(_0x38f134,_0xae424c){var _0x24c19a=this;var _0x444a6c=uuid['v4']();this[_0x6eba('0x27')][_0x444a6c]=new Action(_0x38f134,_0xae424c,_0x444a6c);return new Promise(function(_0xb8d4fe,_0x51b8fa){if(_[_0x6eba('0x42')](_0x38f134)&&typeof _0x38f134!==_0x6eba('0x17d')){return _0x51b8fa(msgResponse(_0x6eba('0x17e'),_0x6eba('0x150'),_0x6eba('0x17f')));}if(_[_0x6eba('0x42')](_0xae424c[_0x6eba('0x180')])||_0xae424c[_0x6eba('0x180')]===null){return _0x51b8fa(msgResponse(_0x6eba('0x17e'),'Failure',_0x6eba('0x181')));}var _0x188570={'XMD-CALLERID':_0x24c19a['actions'][_0x444a6c][_0x6eba('0x182')](),'XMD-AGI':_0x38f134[_0x6eba('0x111')]?util[_0x6eba('0x80')](_0x6eba('0x183'),ipAgi,_0x38f134[_0x6eba('0x111')]):'NONE','XMD-AGIAFTER':_0x38f134['dialQueueProject2']?util[_0x6eba('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0x38f134[_0x6eba('0x116')]):_0x6eba('0x184'),'XMD-QUEUE':_0x38f134[_0x6eba('0x5a')]===_0x6eba('0x51')?util[_0x6eba('0x80')](_0x6eba('0x185'),_0x38f134[_0x6eba('0x44')],_0x38f134['dialQueueOptions']||'',_0x38f134[_0x6eba('0x117')]?'c':'',_0x38f134[_0x6eba('0x11d')]||0x3):_0x6eba('0x184'),'XMD-CONTACTID':_0xae424c[_0x6eba('0xda')],'XMD-CDRTYPE':_0x6eba('0x186'),'CALLERID(all)':_0x24c19a['actions'][_0x444a6c]['getCaller'](),'XMD-AMD':_0x38f134[_0x6eba('0xe8')]?_0x6eba('0x187'):_0x6eba('0x184'),'XMD-DESTINATION':_0x6eba('0x188')};if(_0x38f134['dialAMDActive']){_0x188570[_0x6eba('0x189')]=_0x38f134[_0x6eba('0x18a')]||0x9c4;_0x188570[_0x6eba('0x18b')]=_0x38f134['dialAMDGreeting']||0x5dc;_0x188570[_0x6eba('0x18c')]=_0x38f134[_0x6eba('0x18d')]||0x320;_0x188570['XMD-AMDTOTALANALYSISTIME']=_0x38f134[_0x6eba('0x18e')]||0x1388;_0x188570['XMD-AMDMINWORDLENGTH']=_0x38f134[_0x6eba('0x18f')]||0x64;_0x188570[_0x6eba('0x190')]=_0x38f134['dialAMDBetweenWordsSilence']||0x32;_0x188570[_0x6eba('0x191')]=_0x38f134[_0x6eba('0x192')]||0x3;_0x188570[_0x6eba('0x193')]=_0x38f134['dialAMDSilenceThreshold']||0x100;_0x188570[_0x6eba('0x194')]=_0x38f134[_0x6eba('0x195')]||0x1388;}if(_0x38f134[_0x6eba('0x5a')]===_0x6eba('0x51')){_0x188570[_0x6eba('0x196')]=_0xae424c[_0x6eba('0x126')];}else{_0x188570[_0x6eba('0x197')]=_0xae424c[_0x6eba('0xdc')];}for(var _0x25505c in _0xae424c[_0x6eba('0x198')]){if(typeof _0xae424c[_0x6eba('0x198')][_0x25505c]!=='undefined'){if(isNotNull(_0xae424c['Contact'][_0x25505c])&&_0x25505c!=='id'&&_0x25505c!=='tags'&&_0x25505c!==_0x6eba('0x199')&&_0x25505c!==_0x6eba('0x19a')){_0x188570[util['format']('%s%s',_0x6eba('0x19b'),_[_0x6eba('0x19c')](_0x25505c))]=_0xae424c[_0x6eba('0x198')][_0x25505c];}}}var _0x5138bb=_0x24c19a[_0x6eba('0xe0')](_0x38f134[_0x6eba('0x7c')])?getCallerId(_0x38f134[_0x6eba('0x7c')]['callerid'],_0x38f134[_0x6eba('0x5f')],_0x38f134['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x38f134[_0x6eba('0x60')],_0x38f134['dialRandomLastDigitCallerIdNumber']):_0x38f134[_0x6eba('0x60')]):getCallerId(_[_0x6eba('0xe6')](_0x38f134[_0x6eba('0x19d')])?_0x38f134['Trunk']['callerid']:_0x38f134[_0x6eba('0x19d')][_0x6eba('0x7e')],_0x38f134[_0x6eba('0x5f')],_0x38f134[_0x6eba('0x19e')]>0x0?getCallerIdRandom(_0x38f134[_0x6eba('0x60')],_0x38f134[_0x6eba('0x19e')]):_0x38f134['dialOriginateCallerIdNumber']);if(_0x5138bb){_0x188570[_0x6eba('0x19f')]=_0x24c19a[_0x6eba('0x27')][_0x444a6c][_0x6eba('0x1a0')]=extractCalleridName(_0x5138bb);_0x188570[_0x6eba('0x1a1')]=_0xae424c['phone'];}_0x38f134['variables']=_0x188570;return ami[_0x6eba('0x156')]({'actionid':_0x444a6c,'action':_0x6eba('0x17e'),'channel':_0x24c19a[_0x6eba('0xe0')](_0x38f134[_0x6eba('0x7c')])?util[_0x6eba('0x80')]('SIP/%s/%s%s',_0x38f134[_0x6eba('0x7c')]['name'],isNotNull(_0x38f134['dialPrefix'])?_0x38f134[_0x6eba('0x62')][_0x6eba('0x1a2')]()||'':'',_0x38f134[_0x6eba('0x1a3')]>0x0?_0xae424c['phone'][_0x6eba('0x1a4')](_0x38f134[_0x6eba('0x1a3')]):_0xae424c[_0x6eba('0x180')]):util['format'](_0x6eba('0x1a5'),_[_0x6eba('0xe6')](_0x38f134[_0x6eba('0x19d')])?_0x38f134['Trunk'][_0x6eba('0x44')]:_0x38f134['TrunkBackup'][_0x6eba('0x44')],isNotNull(_0x38f134[_0x6eba('0x62')])?_0x38f134[_0x6eba('0x62')][_0x6eba('0x1a2')]()||'':'',_0x38f134['dialCutDigit']>0x0?_0xae424c[_0x6eba('0x180')][_0x6eba('0x1a4')](_0x38f134[_0x6eba('0x1a3')]):_0xae424c[_0x6eba('0x180')]),'callerid':_0x5138bb,'Exten':_0x6eba('0x188'),'Context':_0x6eba('0x1a6'),'Priority':'1','variable':_0x188570,'timeout':(_0x38f134[_0x6eba('0x61')]||0x1e)*0x3e8,'async':!![],'channelid':_0x444a6c})['then'](function(_0x9990d5){return _0xb8d4fe(_0x9990d5);})['catch'](function(_0x28b4b7){_0x38f134[_0x6eba('0x6b')]+=0x1;var _0x29b2bd=new History(_0x24c19a[_0x6eba('0x27')][_0x444a6c]);logger[_0x6eba('0x9f')](util[_0x6eba('0x80')](_0x6eba('0x1a7'),JSON[_0x6eba('0x7f')](_0x28b4b7)));_0x29b2bd[_0x6eba('0xec')]=0xe;_0x29b2bd[_0x6eba('0xaf')]=_0x6eba('0x1a8');_0x29b2bd[_0x6eba('0xb1')]=moment()['format'](_0x6eba('0x101'));_0x29b2bd[_0x6eba('0xb0')]=_0x29b2bd[_0x6eba('0xb1')];_0x24c19a[_0x6eba('0xd3')](_0x29b2bd)['catch'](loggerCatch(_0x6eba('0x1a9')));_0x24c19a[_0x6eba('0xd1')](_0x29b2bd)['catch'](loggerCatch('[originate][error]'))['finally'](function(){delete _0x24c19a[_0x6eba('0x27')][_0x444a6c];return _0x51b8fa(msgResponse('originate',_0x6eba('0x1aa'),'originate\x20action\x20Error'));});});});};Dialer[_0x6eba('0x1d')][_0x6eba('0x2f')]=function(_0x3c6c15){var _0x38b9aa=this[_0x6eba('0x27')][_0x3c6c15[_0x6eba('0x132')]];if(_0x38b9aa){delete this[_0x6eba('0x27')][_0x3c6c15[_0x6eba('0x132')]];_0x38b9aa[_0x6eba('0x1ab')]=moment()['format'](_0x6eba('0x101'));var _0x367e44=_0x38b9aa[_0x6eba('0x5a')]==='ivr'?this[_0x6eba('0x23')][_0x38b9aa[_0x6eba('0xb7')]]:this[_0x6eba('0x22')][_0x38b9aa[_0x6eba('0x1ac')]()];if(!this[_0x6eba('0xdf')](_0x3c6c15[_0x6eba('0x1ad')])){this[_0x6eba('0xb6')](_0x367e44);return this['callProgressDetecting'](_0x38b9aa,_0x367e44,_0x3c6c15)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1ae')));}this[_0x6eba('0x28')][_0x3c6c15['uniqueid']]=_0x38b9aa;}};Dialer['prototype'][_0x6eba('0x1af')]=function(_0x52491c,_0x49ea59,_0x2b9ace){var _0x475907=new History(_0x49ea59);if(_0x475907[_0x6eba('0xf6')]+_0x475907[_0x6eba('0x106')]+_0x475907[_0x6eba('0xf7')]+_0x475907[_0x6eba('0x107')]+_0x475907['countdropretry']+_0x475907[_0x6eba('0xf8')]+_0x475907['countmachineretry']+_0x475907[_0x6eba('0xfa')]>=_0x2b9ace[_0x6eba('0xfb')]-0x1){return!![];}switch(_0x52491c){case 0x3:if(_0x475907[_0x6eba('0xf7')]>=_0x2b9ace['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countnoanswerretry':_0x475907[_0x6eba('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x2b9ace['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x6eba('0x101')),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907[_0x6eba('0x102')],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1b0')));break;case 0x5:if(_0x475907[_0x6eba('0xf6')]>=_0x2b9ace[_0x6eba('0x1b1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x475907[_0x6eba('0xf6')]+=0x1,'scheduledat':moment()[_0x6eba('0x10a')](_0x2b9ace['dialBusyRetryFrequency'],_0x6eba('0x10b'))['format'](_0x6eba('0x101')),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907['ListId'],'VoiceQueueId':_0x475907['VoiceQueueId']||undefined,'CampaignId':_0x475907['CampaignId']||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1b2')));break;case 0x8:if(_0x475907[_0x6eba('0x106')]>=_0x2b9ace[_0x6eba('0x1b3')]-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countcongestionretry':_0x475907[_0x6eba('0x106')]+=0x1,'scheduledat':moment()[_0x6eba('0x10a')](_0x2b9ace[_0x6eba('0x1b4')],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907['ListId'],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1b5')));break;case 0x0:if(_0x475907[_0x6eba('0x107')]>=_0x2b9ace[_0x6eba('0x1b6')]-0x1){return!![];}else{this[_0x6eba('0xc6')]({'active':![],'countnosuchnumberretry':_0x475907[_0x6eba('0x107')]+=0x1,'scheduledat':moment()['add'](_0x2b9ace[_0x6eba('0x1b7')],_0x6eba('0x10b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907[_0x6eba('0x102')],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907['CampaignId']||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1b8')));}break;case 0xa:if(_0x475907['countdropretry']>=_0x2b9ace[_0x6eba('0x123')]-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countdropretry':_0x475907[_0x6eba('0x108')]+=0x1,'scheduledat':moment()[_0x6eba('0x10a')](_0x2b9ace[_0x6eba('0x125')],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907[_0x6eba('0x102')],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x127')));break;case 0xb:if(_0x475907['countabandonedretry']>=_0x2b9ace['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countabandonedretry':_0x475907['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x2b9ace['dialAbandonedRetryFrequency'],'minutes')[_0x6eba('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907[_0x6eba('0x102')],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x130')));break;case 0x13:if(_0x475907[_0x6eba('0xf9')]>=_0x2b9ace[_0x6eba('0xfe')]-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countmachineretry':_0x475907[_0x6eba('0xf9')]+=0x1,'scheduledat':moment()[_0x6eba('0x10a')](_0x2b9ace['dialMachineRetryFrequency'],_0x6eba('0x10b'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x475907['ContactId'],'ListId':_0x475907['ListId'],'VoiceQueueId':_0x475907[_0x6eba('0x126')]||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x475907[_0x6eba('0xfa')]>=_0x2b9ace[_0x6eba('0x1b9')]-0x1){return!![];}this[_0x6eba('0xc6')]({'active':![],'countagentrejectretry':_0x475907[_0x6eba('0xfa')]+=0x1,'scheduledat':moment()[_0x6eba('0x10a')](_0x2b9ace[_0x6eba('0x1ba')],_0x6eba('0x10b'))[_0x6eba('0x80')](_0x6eba('0x101')),'ContactId':_0x475907[_0x6eba('0xda')],'ListId':_0x475907[_0x6eba('0x102')],'VoiceQueueId':_0x475907['VoiceQueueId']||undefined,'CampaignId':_0x475907[_0x6eba('0xdc')]||undefined})['catch'](loggerCatch(_0x6eba('0x1bb')));break;default:return!![];}};Dialer[_0x6eba('0x1d')][_0x6eba('0x1bc')]=function(_0xfd93a6,_0x19acdb,_0x33c412){var _0x1c88ee=this;var _0x3d3a76=new History(_0xfd93a6);var _0x22d88f=![];var _0x243200;var _0x26030b;return new Promise(function(_0x4b557c,_0x58e9c7){if(_[_0x6eba('0x42')](_0x19acdb)&&typeof _0x19acdb!=='object'){return _0x58e9c7(msgResponse(_0x6eba('0x1bd'),_0x6eba('0x150'),'entity\x20is\x20undefine'));}if(_[_0x6eba('0x42')](_0x33c412)&&typeof _0x33c412!==_0x6eba('0x17d')){return _0x58e9c7(msgResponse(_0x6eba('0x1bd'),_0x6eba('0x150'),_0x6eba('0x1be')));}_0x1c88ee['verifyAdditionalPhones'](_0x3d3a76,_0x33c412[_0x6eba('0x114')],_0x19acdb)[_0x6eba('0x40')](function(_0x5d7fa7){if(_0x5d7fa7['additional']==0x1)_0x22d88f=!![];switch(_0x33c412[_0x6eba('0x114')]){case'0':_0x19acdb['outboundNoSuchCallsDay']+=0x1;_0x3d3a76[_0x6eba('0xec')]=0x0;_0x3d3a76[_0x6eba('0xaf')]='NoSuchNumber';_0x3d3a76[_0x6eba('0x107')]+=0x1;_0x3d3a76['countglobal']+=0x1;ami[_0x6eba('0x50')](_0x6eba('0x1bf'),ut[_0x6eba('0xef')](_0xfd93a6,_0x6eba('0x1c0')));_0x243200=_0x19acdb[_0x6eba('0x1b7')];_0x26030b=_0x19acdb[_0x6eba('0x120')];_0x1c88ee[_0x6eba('0xd3')](_0x3d3a76)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xf5')));if(_0x1c88ee[_0x6eba('0x1af')](0x0,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76['countnosuchnumberretry']>=_0x19acdb[_0x6eba('0x1b6')]){_0x1c88ee[_0x6eba('0xff')](_0x3d3a76,_0x4b557c,_0x58e9c7,'reason\x200\x20no\x20such\x20number....');}else{_0x1c88ee[_0x6eba('0xfc')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1c1'));}}break;case'3':_0x19acdb[_0x6eba('0x69')]+=0x1;_0x3d3a76[_0x6eba('0xec')]=0x3;_0x3d3a76[_0x6eba('0xaf')]=_0x6eba('0x1c2');_0x3d3a76['countnoanswerretry']+=0x1;_0x3d3a76[_0x6eba('0xf3')]+=0x1;var _0x5e5d99=ut[_0x6eba('0x1c3')](_0xfd93a6,_0x19acdb);ami[_0x6eba('0x50')](_0x6eba('0x1c4'),_0x5e5d99);_0x243200=_0x19acdb[_0x6eba('0x1c5')];_0x26030b=_0x19acdb[_0x6eba('0x120')];_0x1c88ee[_0x6eba('0xd3')](_0x3d3a76)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1c6')));if(_0x1c88ee['checkRetriveMax'](0x3,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76[_0x6eba('0xf7')]>=_0x19acdb['dialNoAnswerMaxRetry']){_0x1c88ee['createStateFinal'](_0x3d3a76,_0x4b557c,_0x58e9c7,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1c88ee[_0x6eba('0xfc')](_0x3d3a76,_0x4b557c,_0x58e9c7,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x19acdb[_0x6eba('0x64')]+=0x1;_0x3d3a76[_0x6eba('0xec')]=0x5;_0x3d3a76['statedesc']=_0x6eba('0x1c7');_0x3d3a76[_0x6eba('0xf6')]+=0x1;_0x3d3a76[_0x6eba('0xf3')]+=0x1;ami[_0x6eba('0x50')](_0x6eba('0x1c8'),ut['buildObj'](_0xfd93a6,_0x6eba('0x1c9')));_0x243200=_0x19acdb[_0x6eba('0x1ca')];_0x26030b=_0x19acdb[_0x6eba('0x120')];_0x1c88ee[_0x6eba('0xd3')](_0x3d3a76)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1cb')));if(_0x1c88ee[_0x6eba('0x1af')](0x5,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76[_0x6eba('0xf6')]>=_0x19acdb[_0x6eba('0x1b1')]){_0x1c88ee[_0x6eba('0xff')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1cc'));}else{_0x1c88ee['stateGlobal'](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1cc'));}}break;case'8':_0x19acdb['outboundCongestionCallsDay']+=0x1;_0x3d3a76[_0x6eba('0xec')]=0x8;_0x3d3a76[_0x6eba('0xaf')]=_0x6eba('0x1cd');_0x3d3a76[_0x6eba('0x106')]+=0x1;_0x3d3a76['countglobal']+=0x1;_0x243200=_0x19acdb[_0x6eba('0x1b4')];_0x26030b=_0x19acdb[_0x6eba('0x120')];ami[_0x6eba('0x50')]('custom:agentcongestion',ut[_0x6eba('0xef')](_0xfd93a6,_0x6eba('0x1ce')));_0x1c88ee['createHistory'](_0x3d3a76)[_0x6eba('0xb5')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1c88ee['checkRetriveMax'](0x8,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76[_0x6eba('0x106')]>=_0x19acdb[_0x6eba('0x1b3')]){_0x1c88ee['createStateFinal'](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1cf'));}else{_0x1c88ee[_0x6eba('0xfc')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1cf'));}}break;case'11':_0x19acdb['outboundAbandonedCallsDay']+=0x1;_0x3d3a76['state']=0xb;_0x3d3a76[_0x6eba('0xaf')]=_0x6eba('0x12b');_0x3d3a76[_0x6eba('0xf8')]+=0x1;_0x3d3a76['countglobal']+=0x1;_0x243200=_0x19acdb['dialAbandonedRetryFrequency'];_0x26030b=_0x19acdb['callAdditionalPhoneAfterMin'];_0x1c88ee['createHistory'](_0x3d3a76)['catch'](loggerCatch(_0x6eba('0x1d0')));if(_0x1c88ee[_0x6eba('0x1af')](0xb,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76[_0x6eba('0xf8')]>=_0x19acdb['dialAbandonedMaxRetry']){_0x1c88ee[_0x6eba('0xff')](_0x3d3a76,_0x4b557c,_0x58e9c7,'reason\x2011\x20abandoned');}else{_0x1c88ee[_0x6eba('0xfc')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1d1'));}}break;case'20':_0x19acdb[_0x6eba('0x6d')]+=0x1;_0x3d3a76['state']=0x14;_0x3d3a76[_0x6eba('0xaf')]=_0x6eba('0x1d2');_0x3d3a76[_0x6eba('0xfa')]+=0x1;_0x3d3a76[_0x6eba('0xf3')]+=0x1;_0x243200=_0x19acdb['dialAgentRejectRetryFrequency'];_0x26030b=_0x19acdb[_0x6eba('0x120')];ami[_0x6eba('0x50')](_0x6eba('0x1d3'),ut[_0x6eba('0xef')](_0xfd93a6,_0x6eba('0x1d4')));_0x1c88ee[_0x6eba('0xd3')](_0x3d3a76)['catch'](loggerCatch(_0x6eba('0x1d5')));if(_0x1c88ee[_0x6eba('0x1af')](0x14,_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76[_0x6eba('0xfa')]>=_0x19acdb[_0x6eba('0x1b9')]){_0x1c88ee[_0x6eba('0xff')](_0x3d3a76,_0x4b557c,_0x58e9c7,'reason\x2020\x20agentreject');}else{_0x1c88ee[_0x6eba('0xfc')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x6eba('0x1d6'));}}break;default:_0x19acdb[_0x6eba('0x112')]+=0x1;_0x3d3a76[_0x6eba('0xec')]=0xc;_0x3d3a76['statedesc']=_0x33c412[_0x6eba('0x114')];_0x243200=_0x19acdb[_0x6eba('0x1ba')];_0x26030b=_0x19acdb[_0x6eba('0x120')];_0x1c88ee[_0x6eba('0xd3')](_0x3d3a76)[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1d7')));if(_0x1c88ee['checkRetriveMax'](_0x33c412[_0x6eba('0x114')],_0xfd93a6,_0x19acdb)&&!_0x22d88f){if(_0x3d3a76['countbusyretry']+_0x3d3a76[_0x6eba('0x106')]+_0x3d3a76['countnoanswerretry']+_0x3d3a76[_0x6eba('0x107')]+_0x3d3a76[_0x6eba('0x108')]+_0x3d3a76[_0x6eba('0xf8')]+_0x3d3a76[_0x6eba('0xf9')]+_0x3d3a76[_0x6eba('0xfa')]>=_0x19acdb[_0x6eba('0xfb')]){_0x1c88ee['stateGlobal'](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x33c412[_0x6eba('0x114')]);}else{_0x1c88ee[_0x6eba('0xff')](_0x3d3a76,_0x4b557c,_0x58e9c7,_0x33c412[_0x6eba('0x114')]);}}}})[_0x6eba('0x40')](function(){if(_0x22d88f){_0x1c88ee[_0x6eba('0xc0')](_0x3d3a76,_0x243200,_0x26030b)['then'](function(){return _0x4b557c(0x1);});}});});};Dialer[_0x6eba('0x1d')]['stateGlobal']=function(_0x114b4c,_0x2ee399,_0x6c8a53,_0x24a555){var _0xcd56e7=new Final(_0x114b4c);_0xcd56e7[_0x6eba('0xec')]=0xf;_0xcd56e7[_0x6eba('0xaf')]='Global';this[_0x6eba('0xff')](_0xcd56e7,_0x2ee399,_0x6c8a53,_0x24a555);};Dialer[_0x6eba('0x1d')][_0x6eba('0xff')]=function(_0x2b2064,_0x320e7b,_0x3299b0,_0x4d3887){this[_0x6eba('0xd1')](_0x2b2064)['then'](function(){return _0x320e7b(msgResponse('[callProgressDetecting]',_0x6eba('0x1d8'),_0x4d3887));})['catch'](function(){return _0x3299b0(msgResponse(_0x6eba('0x1d9'),'Failure',_0x6eba('0x1da')));});};Dialer[_0x6eba('0x1d')][_0x6eba('0x9')]=function(_0x21684a){var _0x11e109=_0x21684a[_0x6eba('0x1db')]/0x64;var _0x154550=_0x21684a[_0x6eba('0x68')]/(_0x21684a[_0x6eba('0x68')]+_0x21684a[_0x6eba('0x63')]);var _0x54c90a=Math[_0x6eba('0x1dc')](_0x21684a['predictiveIntervalAvailable']*(_0x21684a['predictiveIntervalMaxThreshold']/0x64));var _0x488240=Math['round'](_0x21684a[_0x6eba('0x75')]*(_0x21684a[_0x6eba('0x1dd')]/0x64));var _0x3bd714=_0x21684a['available']+_0x21684a['talking'];var _0x464ac4=Math['floor'](_0x21684a['erlangCalls']*_0x21684a[_0x6eba('0x92')]*_0x21684a[_0x6eba('0x73')]*_0x21684a[_0x6eba('0x74')]);if(_['isUndefined'](_0x21684a[_0x6eba('0x2a')])){if(!_['isUndefined'](_0x21684a[_0x6eba('0x7b')])){_0x21684a[_0x6eba('0x7b')]=undefined;loggerPredictive[_0x6eba('0x9f')](_0x6eba('0x1de'),_0x6eba('0x1df'));}if(!_['isUndefined'](_0x21684a['handlePredictive'])){loggerPredictive[_0x6eba('0x9f')](_0x6eba('0x1de'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x21684a[_0x6eba('0x97')]);_0x21684a[_0x6eba('0x97')]=undefined;}_0x21684a[_0x6eba('0x2a')]=moment()[_0x6eba('0x80')](_0x6eba('0x101'));loggerPredictive[_0x6eba('0x88')](_0x21684a[_0x6eba('0x44')],_0x6eba('0x1e0'),_0x21684a[_0x6eba('0x2a')]);this[_0x6eba('0x164')](_0x21684a,0x1);}else if(ifInterval(_0x21684a[_0x6eba('0x1e1')],_0x21684a[_0x6eba('0x2a')])){this[_0x6eba('0x164')](_0x21684a,0x1);loggerPredictiveCalls[_0x6eba('0x88')](_0x6eba('0x1e2'),_0x21684a[_0x6eba('0x2a')],_0x21684a[_0x6eba('0x44')]);_0x21684a[_0x6eba('0x78')]=0x0;_0x21684a[_0x6eba('0x72')]=0x0;}else if(_0x11e109<_0x154550&&_0x21684a[_0x6eba('0x1e3')]===_0x6eba('0x1e4')){freeVariablesPredictive(_0x21684a);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x1e5'),_0x6eba('0x1e6'),_0x154550,_0x6eba('0x2a'),_0x21684a[_0x6eba('0x44')]);}else if(_0x464ac4<_0x21684a['predictiveIntervalErlangCallsDroppedCalls']&&_0x21684a[_0x6eba('0x1e3')]==='dropRate'){freeVariablesPredictive(_0x21684a);loggerPredictive[_0x6eba('0x88')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x6eba('0x1e7'),_0x464ac4,'Drop\x20in\x20this\x20interval',_0x21684a['predictiveIntervalErlangCallsDroppedCalls'],_0x6eba('0x2a'),_0x21684a[_0x6eba('0x44')]);}else if(!ifInterval(_0x21684a[_0x6eba('0x1e1')],_0x21684a['startProgressive'])&&_[_0x6eba('0x42')](_0x21684a[_0x6eba('0x7b')])&&!_[_0x6eba('0x42')](_0x21684a[_0x6eba('0x2a')])){_0x21684a[_0x6eba('0x7b')]=moment()[_0x6eba('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x6eba('0x88')](_0x21684a['name'],'started\x20in\x20predictive\x20at',_0x21684a[_0x6eba('0x7b')]);this[_0x6eba('0x1e8')](_0x21684a[_0x6eba('0x1e1')])['then'](this[_0x6eba('0x1e9')](_0x21684a))['then'](mergeDataErlangB(_0x21684a))[_0x6eba('0x40')](this[_0x6eba('0x1ea')](_0x21684a))[_0x6eba('0xb5')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x21684a));}else if(!ifInterval(_0x21684a[_0x6eba('0x1e1')],_0x21684a[_0x6eba('0x7b')])){_0x21684a[_0x6eba('0x72')]=0x0;_0x21684a[_0x6eba('0x7b')]=moment()['format'](_0x6eba('0x101'));loggerPredictive[_0x6eba('0x88')](_0x21684a[_0x6eba('0x44')],'recalculate\x20predictive\x20at',_0x21684a[_0x6eba('0x7b')]);clearInterval(_0x21684a['handlePredictive']);_0x21684a[_0x6eba('0x97')]=undefined;this['averageHandleTime'](_0x21684a[_0x6eba('0x1e1')])[_0x6eba('0x40')](this[_0x6eba('0x1e9')](_0x21684a))[_0x6eba('0x40')](mergeDataErlangB(_0x21684a))[_0x6eba('0x40')](this['startMethodPredictive'](_0x21684a))[_0x6eba('0xb5')](loggerCatchPredictive(_0x6eba('0x1eb'),_0x21684a));}else if(_0x21684a[_0x6eba('0x75')]&&_0x3bd714<_0x21684a[_0x6eba('0x75')]-_0x488240){freeVariablesPredictive(_0x21684a);loggerPredictive[_0x6eba('0x88')](_0x21684a[_0x6eba('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3bd714,_0x6eba('0x1ec'),_0x21684a[_0x6eba('0x75')],'-',_0x488240,'=',_0x21684a[_0x6eba('0x75')]-_0x488240,')');}else if(_0x21684a[_0x6eba('0x75')]&&_0x3bd714>_0x21684a[_0x6eba('0x75')]+_0x54c90a){freeVariablesPredictive(_0x21684a);loggerPredictive[_0x6eba('0x88')](_0x21684a[_0x6eba('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3bd714,')\x20are\x20more\x20than\x20threshold\x20(',_0x21684a[_0x6eba('0x75')],'+',_0x54c90a,'=',_0x21684a[_0x6eba('0x75')]+_0x54c90a,')');}};Dialer[_0x6eba('0x1d')][_0x6eba('0x1e9')]=function(_0x352029){var _0x146c6e=this;return function(_0x5552ad){return new Promise(function(_0x1b5eea,_0x187893){_[_0x6eba('0xd9')](_0x352029,_0x5552ad[0x0]);if(checkGetDataPredictive(_0x5552ad[0x0])){var _0x4fb014=_0x352029['predictiveIntervalAvailable']=_0x352029['talking']+_0x352029['available'];var _0x363de1=_0x352029[_0x6eba('0x1e1')]*0x3c;var _0x4bfc45=_0x5552ad[0x0]['predictiveIntervalAvgTalktime']+_0x5552ad[0x0][_0x6eba('0x8e')];var _0x2c30da=(_0x5552ad[0x0]['predictiveIntervalAnsweredCalls']+_0x5552ad[0x0][_0x6eba('0x70')]+_0x5552ad[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5552ad[0x0][_0x6eba('0x76')];_0x352029[_0x6eba('0x73')]=_0x2c30da>0x0?_0x2c30da:0x1;switch(_0x352029['dialPredictiveOptimization']){case _0x6eba('0x1e4'):var _0x12662a=_0x352029[_0x6eba('0x1db')]/0x64;return _0x146c6e[_0x6eba('0x1ed')](_0x4fb014,_0x363de1,_0x4bfc45,_0x2c30da,_0x12662a)[_0x6eba('0x40')](function(_0x33d4f2){return _0x1b5eea(_0x33d4f2);});case _0x6eba('0x1ee'):var _0x39c0da=_0x352029[_0x6eba('0x1db')]/0x64;return _0x146c6e[_0x6eba('0x1ef')](_0x4fb014,_0x363de1,_0x4bfc45,_0x2c30da,_0x39c0da)[_0x6eba('0x40')](function(_0x152487){return _0x1b5eea(_0x152487);});default:return _0x187893(msgResponse(_0x6eba('0x1f0'),_0x6eba('0x150'),_0x6eba('0x1f1')));}}else{return _0x187893(msgResponse(_0x6eba('0x1f0'),_0x6eba('0x150'),_0x6eba('0x1f2')));}});};};Dialer[_0x6eba('0x1d')][_0x6eba('0x1f3')]=function(_0x172dea){var _0xb565be=this;return function(_0x59ca5b){return new Promise(function(_0x18f0ef,_0xeec48){_['merge'](_0x172dea,_0x59ca5b[0x0]);if(checkGetDataPredictive(_0x59ca5b[0x0])){loggerPredictive[_0x6eba('0x88')](JSON[_0x6eba('0x7f')](_0x59ca5b[0x0]));if(_0x172dea[_0x6eba('0x1e3')]===_0x6eba('0x1e4')){return _0xb565be['getVoiceQueueRtPauses'](_0x172dea['id'])[_0x6eba('0x40')](function(_0x1f3e9a){var _0x16fa82=_0x172dea[_0x6eba('0x16f')]-_0x1f3e9a[0x0][_0x6eba('0x1f4')];var _0x4fac4f=_0x172dea[_0x6eba('0x1e1')]*0x3c;var _0x34e0fa=_0x59ca5b[0x0][_0x6eba('0x8c')]+_0x59ca5b[0x0][_0x6eba('0x8e')];var _0x114ce3=(_0x59ca5b[0x0][_0x6eba('0x6e')]+_0x59ca5b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59ca5b[0x0][_0x6eba('0x6f')])/_0x59ca5b[0x0][_0x6eba('0x76')];var _0x5863a9=_0x172dea['dialPredictiveOptimizationPercentage']/0x64;_0x172dea[_0x6eba('0x1f5')]=_0x1f3e9a[0x0][_0x6eba('0x1f4')]||0x0;_0x172dea[_0x6eba('0x73')]=_0x114ce3>0x0?_0x114ce3:0x1;return _0xb565be[_0x6eba('0x1ed')](_0x16fa82,_0x4fac4f,_0x34e0fa,_0x114ce3,_0x5863a9);})[_0x6eba('0x40')](function(_0x303d74){return _0x18f0ef(_0x303d74);})[_0x6eba('0xb5')](function(_0x227c21){return _0xeec48(msgResponse(_0x6eba('0x1f6'),_0x6eba('0x150'),JSON['stringify'](_0x227c21)));});}if(_0x172dea[_0x6eba('0x1e3')]===_0x6eba('0x1ee')){return _0xb565be['getVoiceQueueRtPauses'](_0x172dea['id'])['then'](function(_0x484aff){var _0x3b30d7=_0x172dea[_0x6eba('0x16f')]-_0x484aff[0x0][_0x6eba('0x1f4')];var _0x456084=_0x172dea[_0x6eba('0x1e1')]*0x3c;var _0x2394f8=_0x59ca5b[0x0][_0x6eba('0x8c')]+_0x59ca5b[0x0][_0x6eba('0x8e')];var _0xd345b6=(_0x59ca5b[0x0]['predictiveIntervalAnsweredCalls']+_0x59ca5b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x59ca5b[0x0][_0x6eba('0x6f')])/_0x59ca5b[0x0]['predictiveIntervalTotalCalls'];var _0x40f2e9=_0x172dea[_0x6eba('0x1db')]/0x64;_0x172dea[_0x6eba('0x1f5')]=_0x484aff[0x0]['outboundQueuePauses']||0x0;_0x172dea[_0x6eba('0x73')]=_0xd345b6>0x0?_0xd345b6:0x1;return _0xb565be[_0x6eba('0x1ef')](_0x3b30d7,_0x456084,_0x2394f8,_0xd345b6,_0x40f2e9);})['then'](function(_0x180942){return _0x18f0ef(_0x180942);})['catch'](function(_0x197a67){return _0xeec48(msgResponse(_0x6eba('0x1f6'),_0x6eba('0x150'),JSON[_0x6eba('0x7f')](_0x197a67)));});}}else{return _0xeec48(msgResponse('[getDataPredictive]',_0x6eba('0x150'),_0x6eba('0x1f2')));}});};};Dialer[_0x6eba('0x1d')][_0x6eba('0x1ea')]=function(_0x3d998d){var _0x32ea94=this;return function(){var _0x1fe1fd=0x0;var _0x3c5cf4=Math[_0x6eba('0x1f7')](_0x3d998d[_0x6eba('0x79')]*0x3e8);if(_0x3c5cf4>0x0){_0x3c5cf4=_0x3c5cf4<0x64?0x64:_0x3c5cf4;loggerPredictive[_0x6eba('0x88')](_0x3d998d[_0x6eba('0x44')],_0x6eba('0x1f8'),_0x3c5cf4,'milliseconds');_0x3d998d['handlePredictive']=setInterval(function(){_0x32ea94[_0x6eba('0x97')](_0x3d998d);loggerPredictiveCalls[_0x6eba('0x88')](_0x6eba('0x1f9'),_0x1fe1fd+=0x1);},_0x3c5cf4);}else{loggerPredictive[_0x6eba('0x88')](_0x3d998d[_0x6eba('0x44')],_0x6eba('0x1fa'));}};};Dialer[_0x6eba('0x1d')][_0x6eba('0x1fb')]=function(_0x1a6ac2,_0x248879){var _0x2d3d88=this;return function(_0x1185af){if(_[_0x6eba('0x4c')](_0x1185af)){if(_[_0x6eba('0xe6')](_0x248879[_0x6eba('0xdb')])||!_0x248879[_0x6eba('0x1fc')]){if(_0x1a6ac2[_0x6eba('0x16e')]===_0x6eba('0x8')){_0x1a6ac2[_0x6eba('0x139')]=_[_0x6eba('0x42')](_0x1a6ac2[_0x6eba('0x139')])?!![]:_0x1a6ac2['queueStatusComplete'];var _0x3d9108=uuid['v4']();_0x2d3d88[_0x6eba('0x27')][_0x3d9108]=new Action(_0x1a6ac2,_0x248879,_0x3d9108);loggerBooked['info']('[booked][checkContactBlack]',_0x3d9108,'queueStatusComplete:\x20',JSON[_0x6eba('0x7f')](_0x1a6ac2[_0x6eba('0x139')]),_0x6eba('0x1fd'),_0x1a6ac2[_0x6eba('0x44')]);if(_0x1a6ac2[_0x6eba('0x139')]){_0x1a6ac2[_0x6eba('0x139')]=![];_0x2d3d88[_0x6eba('0x135')][_0x2d3d88[_0x6eba('0x27')][_0x3d9108]['queue']]=[];ami['Action']({'actionid':_0x3d9108,'action':_0x6eba('0x1fe'),'queue':_0x1a6ac2[_0x6eba('0x44')]})[_0x6eba('0xb5')](function(){_0x2d3d88[_0x6eba('0xb6')](_0x1a6ac2);_0x2d3d88['rescheduleContact']({'active':![],'ContactId':_0x2d3d88['actions'][_0x3d9108][_0x6eba('0xda')],'ListId':_0x2d3d88[_0x6eba('0x27')][_0x3d9108][_0x6eba('0x102')],'VoiceQueueId':_0x2d3d88[_0x6eba('0x27')][_0x3d9108][_0x6eba('0x126')]||undefined,'CampaignId':_0x2d3d88[_0x6eba('0x27')][_0x3d9108]['CampaignId']||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1ff')));delete _0x2d3d88['actions'][_0x3d9108];});}else{loggerBooked[_0x6eba('0x88')](_0x6eba('0x200'),JSON[_0x6eba('0x7f')](_0x1a6ac2[_0x6eba('0x139')]),_0x6eba('0x1fd'),_0x1a6ac2[_0x6eba('0x44')]);_0x2d3d88[_0x6eba('0xb6')](_0x1a6ac2);_0x2d3d88[_0x6eba('0xc6')]({'active':![],'ContactId':_0x2d3d88['actions'][_0x3d9108][_0x6eba('0xda')],'ListId':_0x2d3d88['actions'][_0x3d9108]['ListId'],'VoiceQueueId':_0x2d3d88[_0x6eba('0x27')][_0x3d9108][_0x6eba('0x126')]||undefined,'CampaignId':_0x2d3d88[_0x6eba('0x27')][_0x3d9108][_0x6eba('0xdc')]||undefined})[_0x6eba('0xb5')](loggerCatch(_0x6eba('0x1ff')));delete _0x2d3d88['actions'][_0x3d9108];}}else{return _0x2d3d88[_0x6eba('0x201')](_0x1a6ac2,_0x248879);}}else{if(getDiff(_0x248879['scheduledat'])<_0x1a6ac2[_0x6eba('0x202')]*0x3c){if(_0x248879[_0x6eba('0x16a')]&&!_0x248879[_0x6eba('0x16a')][_0x6eba('0x203')]){_0x2d3d88['preview'][_0x6eba('0x13c')](_0x248879['id'])[_0x6eba('0x20')](function(){_0x2d3d88[_0x6eba('0xb6')](_0x1a6ac2);});}else{_0x2d3d88[_0x6eba('0xc8')]({'active':![]},_0x248879['id'],0x1)[_0x6eba('0x20')](function(){_0x2d3d88[_0x6eba('0xb6')](_0x1a6ac2);});}}else{_0x1a6ac2[_0x6eba('0x6c')]+=0x1;_0x2d3d88[_0x6eba('0xb6')](_0x1a6ac2);if(_0x1a6ac2[_0x6eba('0x204')]){_0x2d3d88[_0x6eba('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x248879[_0x6eba('0xda')],'ListId':_0x248879[_0x6eba('0x102')],'VoiceQueueId':_0x248879['VoiceQueueId']||undefined,'CampaignId':_0x248879['CampaignId']||undefined})['catch'](loggerCatch(_0x6eba('0x205')));_0x2d3d88[_0x6eba('0xd3')](createObjHistory(_0x1a6ac2,_0x248879,'RECALLINQUEUE',0x17,_0x6eba('0x206')))['catch'](loggerCatch(_0x6eba('0x207')));}else{_0x2d3d88['saveInDb'](createObjHistory(_0x1a6ac2,_0x248879,_0x6eba('0x208'),0x16,_0x6eba('0x209')),_0x6eba('0x20a'),_0x6eba('0x20b'));}}}}else{_0x1a6ac2[_0x6eba('0x20c')]+=0x1;_0x2d3d88[_0x6eba('0xd8')](createObjHistory(_0x1a6ac2,_0x248879,_0x6eba('0x20d'),0xd,'Blacklist'),_0x6eba('0x20e'),_0x6eba('0x20f'));throw'inBlackList';}};};Dialer[_0x6eba('0x1d')][_0x6eba('0x210')]=function(_0x3efb1b){var _0x47eac8=this;var _0x5b559e=_0x3efb1b[_0x6eba('0x211')]-_0x3efb1b[_0x6eba('0x77')]-_0x3efb1b['temp'];emitCampaignSummary(_0x3efb1b);if(_0x5b559e>0x0){if(_0x5b559e>this[_0x6eba('0x26')]){_0x5b559e=this[_0x6eba('0x26')];}_0x3efb1b[_0x6eba('0xcb')]+=_0x5b559e;this[_0x6eba('0xcd')](_0x3efb1b['id'],_0x5b559e,_0x3efb1b[_0x6eba('0x212')],_0x3efb1b)['then'](function(_0x18d2f0){_0x3efb1b['temp']-=_0x5b559e;_0x3efb1b[_0x6eba('0xcb')]=_0x3efb1b[_0x6eba('0xcb')]>0x0?_0x3efb1b[_0x6eba('0xcb')]:0x0;if(!checkContactEmpty(_0x18d2f0)){_0x3efb1b[_0x6eba('0x43')]=_0x6eba('0x213');logger['info']('[getContactCampaign2][Empty]'+_0x3efb1b[_0x6eba('0x44')]);}else{_0x3efb1b[_0x6eba('0x77')]+=_0x18d2f0[_0x6eba('0xa1')];_0x3efb1b[_0x6eba('0x43')]=_0x6eba('0x214');for(var _0x2fe338=0x0;_0x2fe338<_0x18d2f0['length'];_0x2fe338+=0x1){_0x3efb1b[_0x6eba('0x215')]+=0x1;if(_[_0x6eba('0xe6')](_0x18d2f0[_0x2fe338])||_[_0x6eba('0xe6')](_0x18d2f0[_0x2fe338][_0x6eba('0x198')])||_['isNil'](_0x18d2f0[_0x2fe338][_0x6eba('0x180')])){_0x47eac8['emptyContact'](_0x6eba('0x216'),_0x3efb1b,_0x18d2f0[_0x2fe338]);}else{_0x47eac8[_0x6eba('0xc2')](_['pick'](_0x18d2f0[_0x2fe338],[_0x6eba('0xdc'),_0x6eba('0x217')]))[_0x6eba('0x40')](_0x47eac8['checkContactBlack'](_0x3efb1b,_0x18d2f0[_0x2fe338]))[_0x6eba('0xb5')](_0x47eac8[_0x6eba('0xd5')]('[actionOriginateIvr]\x20',_0x3efb1b));}}}})[_0x6eba('0xb5')](loggerGetContactDialer(_0x6eba('0x218'),_0x3efb1b,_0x5b559e));}};Dialer['prototype'][_0x6eba('0x164')]=function(_0x5a2a2f,_0x51af9d){var _0xafdb6c=this;var _0xeaab41=[];var _0x906b58=_0x51af9d>=0x1?_0x51af9d:0x1;if(_0x5a2a2f['dialMethod']===_0x6eba('0x8')){_0x906b58=0x1;}var _0x32ddf3=Math['floor'](_0x5a2a2f[_0x6eba('0x54')]*_0x906b58)-_0x5a2a2f[_0x6eba('0x77')]-_0x5a2a2f['temp'];emitVoiceQueueSummary(_0x5a2a2f);if(_0x5a2a2f[_0x6eba('0x219')]>0x0){var _0x5079ab=_0x5a2a2f[_0x6eba('0x219')]-_0x5a2a2f['originated']-_0x5a2a2f[_0x6eba('0xa9')]-_0x5a2a2f[_0x6eba('0xcb')]-_0x5a2a2f['pTalking'];if(_0x32ddf3>_0x5079ab){_0x32ddf3=_0x5079ab;}}if(_0x32ddf3>0x0){if(_0x5a2a2f[_0x6eba('0x16e')]==='booked'){_0x32ddf3=0x1;}if(_0x32ddf3>this[_0x6eba('0x26')]){_0x32ddf3=this['maxNumberOriginate'];}_0x5a2a2f[_0x6eba('0xcb')]+=_0x32ddf3;for(var _0x373369 in this[_0x6eba('0x24')]){if(typeof this[_0x6eba('0x24')][_0x373369]!=='undefined'){if(this[_0x6eba('0x24')][_0x373369][_0x6eba('0xec')]===_0x6eba('0x21a')&&this['agents'][_0x373369][_0x6eba('0xe1')]===_0x6eba('0xe2')){_0xeaab41['push'](this['agents'][_0x373369]['id']);}}}this['getContactDialer'](_0x5a2a2f['id'],_0xeaab41,_0x32ddf3,_0x5a2a2f[_0x6eba('0x212')],_0x5a2a2f)[_0x6eba('0x40')](function(_0x322a4b){_0x5a2a2f['temp']-=_0x32ddf3;_0x5a2a2f[_0x6eba('0xcb')]=_0x5a2a2f[_0x6eba('0xcb')]>0x0?_0x5a2a2f['temp']:0x0;if(!checkContactEmpty(_0x322a4b)){_0xafdb6c[_0x6eba('0xba')](_0x5a2a2f)[_0x6eba('0x40')](sendMessageReschedule(_0x5a2a2f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x5a2a2f[_0x6eba('0x77')]+=_0x322a4b[_0x6eba('0xa1')];_0x5a2a2f['message']=_0x5a2a2f[_0x6eba('0x16e')]===_0x6eba('0x8')?_0x6eba('0x187'):'RUNNING';for(var _0x14e707=0x0;_0x14e707<_0x322a4b[_0x6eba('0xa1')];_0x14e707+=0x1){if(_[_0x6eba('0xe6')](_0x322a4b[_0x14e707])||_[_0x6eba('0xe6')](_0x322a4b[_0x14e707]['Contact'])||_[_0x6eba('0xe6')](_0x322a4b[_0x14e707]['phone'])){_0xafdb6c[_0x6eba('0xd6')]('[actionOriginate]\x20',_0x5a2a2f,_0x322a4b[_0x14e707]);}else{_0xafdb6c[_0x6eba('0xbd')](_[_0x6eba('0x137')](_0x322a4b[_0x14e707],[_0x6eba('0x126'),_0x6eba('0x217')]))[_0x6eba('0x40')](_0xafdb6c[_0x6eba('0x1fb')](_0x5a2a2f,_0x322a4b[_0x14e707]))['catch'](_0xafdb6c['loggerHandler'](_0x6eba('0x216'),_0x5a2a2f));}}}})[_0x6eba('0xb5')](loggerGetContactDialer(_0x6eba('0x21b'),_0x5a2a2f,_0x32ddf3));}};Dialer['prototype'][_0x6eba('0x97')]=function(_0x149394){if(_0x149394[_0x6eba('0x219')]>0x0){var _0x2b7fc1=_0x149394[_0x6eba('0x219')]-_0x149394['originated']-_0x149394['talking'];if(_0x2b7fc1>0x0){this[_0x6eba('0x21c')](_0x149394);}else{loggerPredictiveCalls[_0x6eba('0x88')]('[handlePredictive][limitChannel]');}}else{this[_0x6eba('0x21c')](_0x149394);}};Dialer[_0x6eba('0x1d')][_0x6eba('0x21c')]=function(_0x1a990f){var _0x32d96a=this;var _0x4c331d=[];_0x1a990f[_0x6eba('0x77')]+=0x1;for(var _0x17fde5 in this[_0x6eba('0x24')]){if(typeof this[_0x6eba('0x24')][_0x17fde5]!==_0x6eba('0xa2')){if(this[_0x6eba('0x24')][_0x17fde5][_0x6eba('0xec')]===_0x6eba('0x21a')&&this[_0x6eba('0x24')][_0x17fde5]['status']===_0x6eba('0xe2')){_0x4c331d[_0x6eba('0x136')](this[_0x6eba('0x24')][_0x17fde5]['id']);}}}this[_0x6eba('0xca')](_0x1a990f['id'],_0x4c331d,0x1,_0x1a990f[_0x6eba('0x212')],_0x1a990f)[_0x6eba('0x40')](function(_0x52d038){if(!checkContactEmpty(_0x52d038)){checkContactLowerLimitOriginate(_0x1a990f,0x1,0x0);_0x32d96a['countReScheduled'](_0x1a990f)[_0x6eba('0x40')](sendMessageReschedule(_0x1a990f))[_0x6eba('0xb5')](loggerCatch(_0x6eba('0xbc')));}else{_0x1a990f[_0x6eba('0x43')]='RUNNING';if(_[_0x6eba('0xe6')](_0x52d038[0x0])||_['isNil'](_0x52d038[0x0]['Contact'])||_[_0x6eba('0xe6')](_0x52d038[0x0][_0x6eba('0x180')])){_0x32d96a[_0x6eba('0xd6')](_0x6eba('0x216'),_0x1a990f,_0x52d038[0x0]);}else{_0x32d96a[_0x6eba('0xbd')](_['pick'](_0x52d038[0x0],[_0x6eba('0x126'),_0x6eba('0x217')]))[_0x6eba('0x40')](_0x32d96a[_0x6eba('0x1fb')](_0x1a990f,_0x52d038[0x0]))[_0x6eba('0xb5')](_0x32d96a['loggerHandler'](_0x6eba('0x21d'),_0x1a990f));}}})[_0x6eba('0xb5')](loggerGetContactDialer(_0x6eba('0x21e'),_0x1a990f,0x1));emitVoiceQueueSummary(_0x1a990f);};Dialer[_0x6eba('0x1d')][_0x6eba('0x1ed')]=function(_0x367080,_0x2ae805,_0x416cc3,_0x49d6dc,_0x34aaee,_0x1e596d){loggerPredictive[_0x6eba('0x88')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x6eba('0x88')](_0x6eba('0x21f'),_0x367080);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x220'),_0x2ae805);loggerPredictive[_0x6eba('0x88')]('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',_0x416cc3);loggerPredictive['info'](_0x6eba('0x221'),_0x49d6dc);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x222'),_0x34aaee);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8b'));return new Promise(function(_0xf5d7f,_0x46475f){if(_0x367080<=0x0||isNaN(_0x367080)){return _0x46475f(msgResponse(_0x6eba('0x223'),_0x6eba('0x1aa'),'m\x20=\x20'+_0x367080));}if(_0x416cc3<=0x0||isNaN(_0x416cc3)){return _0x46475f(msgResponse(_0x6eba('0x223'),_0x6eba('0x1aa'),_0x6eba('0x224')+_0x416cc3));}if(_0x49d6dc<=0x0||isNaN(_0x49d6dc)){return _0x46475f(msgResponse(_0x6eba('0x223'),_0x6eba('0x1aa'),_0x6eba('0x225')+_0x49d6dc));}if(_0x2ae805<=0x0||isNaN(_0x2ae805)){return _0x46475f(msgResponse('[abandonmentRate]','Error',_0x6eba('0x226')+_0x2ae805));}if(_0x34aaee<=0x0||isNaN(_0x34aaee)){return _0x46475f(msgResponse(_0x6eba('0x223'),'Error',_0x6eba('0x227')+_0x34aaee));}_0x1e596d=_0x1e596d||0x0;var _0x13e1d8=0x1/_0x416cc3;var _0x3cece3=0x0;var _0x13fabf=0x0;var _0x3ae089=0x0;var _0x4d23ad=0x0;for(var _0xaef9ef=0x0;_0x3ae089<_0x34aaee;_0xaef9ef+=0x1){_0x13fabf=_0xaef9ef/_0x2ae805;_0x3cece3=(_0x49d6dc*_0x13fabf+_0x1e596d)/_0x13e1d8;_0x3ae089=erlangb(_0x3cece3,_0x367080);_0x4d23ad=_0x3cece3/_0x367080*(0x1-erlangb(_0x3cece3,_0x367080));}return _0xf5d7f({'erlangCalls':_0xaef9ef,'erlangCallToSecond':_0x2ae805/_0xaef9ef,'erlangAbandonmentRate':_0x3ae089,'erlangBusyFactor':_0x4d23ad});});};Dialer[_0x6eba('0x1d')][_0x6eba('0x1ef')]=function(_0x3dac1e,_0x23969c,_0x5b8697,_0x43a872,_0x239ac2,_0x46954f){loggerPredictive[_0x6eba('0x88')](_0x6eba('0x228'));loggerPredictive[_0x6eba('0x88')]('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',_0x3dac1e);loggerPredictive['info'](_0x6eba('0x220'),_0x23969c);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x229'),_0x5b8697);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x221'),_0x43a872);loggerPredictive[_0x6eba('0x88')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x239ac2);loggerPredictive[_0x6eba('0x88')](_0x6eba('0x8b'));return new Promise(function(_0x5a29a5,_0x1cb9c6){if(_0x3dac1e<=0x0||isNaN(_0x3dac1e)){return _0x1cb9c6(msgResponse('[busyFactor]',_0x6eba('0x1aa'),'m\x20=\x20'+_0x3dac1e));}if(_0x5b8697<=0x0||isNaN(_0x5b8697)){return _0x1cb9c6(msgResponse(_0x6eba('0x22a'),'Error',_0x6eba('0x224')+_0x5b8697));}if(_0x43a872<=0x0||isNaN(_0x43a872)){return _0x1cb9c6(msgResponse('[busyFactor]',_0x6eba('0x1aa'),'p\x20=\x20'+_0x43a872));}if(_0x23969c<=0x0||isNaN(_0x23969c)){return _0x1cb9c6(msgResponse(_0x6eba('0x22a'),'Error','interval\x20=\x20'+_0x23969c));}if(_0x239ac2<=0x0||isNaN(_0x239ac2)){return _0x1cb9c6(msgResponse(_0x6eba('0x22a'),_0x6eba('0x1aa'),_0x6eba('0x22b')+_0x239ac2));}_0x46954f=_0x46954f||0x0;var _0x280dbe=0x1/_0x5b8697;var _0x576e0d=0x0;var _0x2db979=0x0;var _0x48864a=0x0;var _0x49d049=0x0;for(var _0x253eb3=0x0;_0x49d049<_0x239ac2;_0x253eb3+=0x1){_0x2db979=_0x253eb3/_0x23969c;_0x576e0d=(_0x43a872*_0x2db979+_0x46954f)/_0x280dbe;_0x48864a=erlangb(_0x576e0d,_0x3dac1e);_0x49d049=_0x576e0d/_0x3dac1e*(0x1-erlangb(_0x576e0d,_0x3dac1e));}return _0x5a29a5({'erlangCalls':_0x253eb3,'erlangCallToSecond':_0x23969c/_0x253eb3,'erlangAbandonmentRate':_0x48864a,'erlangBusyFactor':_0x49d049});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 15eb6e6..0f762d5 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x06f2=['countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5e5c94,_0x9813e0){var _0x1789a1=function(_0x18d2f1){while(--_0x18d2f1){_0x5e5c94['push'](_0x5e5c94['shift']());}};_0x1789a1(++_0x9813e0);}(_0x06f2,0x96));var _0x206f=function(_0x4071bd,_0x29381e){_0x4071bd=_0x4071bd-0x0;var _0x1125a9=_0x06f2[_0x4071bd];return _0x1125a9;};'use strict';var util=require('util');var _=require(_0x206f('0x0'));var moment=require(_0x206f('0x1'));function getSeconds(_0x1f987d,_0xa38464){var _0x1cc760=moment(_0x1f987d)['milliseconds'](0x0);var _0x66efb8=moment(_0xa38464)[_0x206f('0x2')](0x0);return _0x1cc760[_0x206f('0x3')](_0x66efb8,_0x206f('0x4'));}function QueueCallerAbandon(_0x1ea698,_0x4f7f62){this[_0x206f('0x5')]=_0x1ea698['scheduledat'];this[_0x206f('0x6')]=_0x1ea698[_0x206f('0x6')];this[_0x206f('0x7')]=_0x1ea698[_0x206f('0x6')]===_0x206f('0x8')?_0x206f('0x9'):_0x1ea698[_0x206f('0x6')];this['countbusyretry']=_0x1ea698[_0x206f('0xa')];this[_0x206f('0xb')]=_0x1ea698[_0x206f('0xb')];this['countnoanswerretry']=_0x1ea698[_0x206f('0xc')];this[_0x206f('0xd')]=_0x1ea698[_0x206f('0xa')]+_0x1ea698[_0x206f('0xb')]+_0x1ea698[_0x206f('0xc')]+_0x1ea698[_0x206f('0xe')]+_0x1ea698[_0x206f('0xf')]+_0x1ea698['countabandonedretry']+_0x1ea698['countmachineretry']+_0x1ea698[_0x206f('0x10')];this['countnosuchnumberretry']=_0x1ea698[_0x206f('0xe')];this[_0x206f('0xf')]=_0x1ea698[_0x206f('0xf')];this[_0x206f('0x11')]=_0x1ea698[_0x206f('0x11')];this['countmachineretry']=_0x1ea698[_0x206f('0x12')];this['countagentrejectretry']=_0x1ea698['countagentrejectretry'];this[_0x206f('0x13')]=_0x4f7f62[_0x206f('0x13')];this[_0x206f('0x14')]=_0x1ea698['name'];this[_0x206f('0x15')]=_0x1ea698[_0x206f('0x16')];this['starttime']=_0x1ea698[_0x206f('0x17')];this[_0x206f('0x18')]=_0x1ea698[_0x206f('0x18')];this[_0x206f('0x19')]=_0x1ea698[_0x206f('0x19')];this['endtime']=this['droptime'];this['ringtime']=getSeconds(_0x1ea698[_0x206f('0x18')],_0x1ea698['starttime']);this['holdtime']=getSeconds(this[_0x206f('0x19')],_0x1ea698[_0x206f('0x18')]);this[_0x206f('0x1a')]=0x0;this[_0x206f('0x9')]=_0x4f7f62['queue'];this[_0x206f('0x1b')]=_0x4f7f62[_0x206f('0x1c')];this[_0x206f('0x1d')]=_0x4f7f62['reason'];this[_0x206f('0x1e')]=_0x1ea698[_0x206f('0x1e')];this[_0x206f('0x1f')]=_0x1ea698[_0x206f('0x1f')];this[_0x206f('0x20')]=_0x1ea698[_0x206f('0x20')];this[_0x206f('0x21')]=_0x1ea698['recallme'];this[_0x206f('0x22')]=_0x1ea698[_0x206f('0x22')];this[_0x206f('0x23')]=_0x1ea698[_0x206f('0x23')];this[_0x206f('0x24')]=_0x1ea698[_0x206f('0x24')];this['VoiceQueueId']=_0x1ea698['VoiceQueueId'];this[_0x206f('0x25')]=_0x1ea698[_0x206f('0x25')];this[_0x206f('0x26')]=_0x1ea698[_0x206f('0x26')]||'';this[_0x206f('0x27')]=_0x1ea698[_0x206f('0x27')]||'';}module[_0x206f('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x2285=['VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId'];(function(_0x305576,_0x31d638){var _0x72d48=function(_0x2d8146){while(--_0x2d8146){_0x305576['push'](_0x305576['shift']());}};_0x72d48(++_0x31d638);}(_0x2285,0xa3));var _0x5228=function(_0x21da64,_0x1d3d1f){_0x21da64=_0x21da64-0x0;var _0x5a79f1=_0x2285[_0x21da64];return _0x5a79f1;};'use strict';var util=require(_0x5228('0x0'));var _=require(_0x5228('0x1'));var moment=require(_0x5228('0x2'));function getSeconds(_0x5398fc,_0x237ad3){var _0x10552b=moment(_0x5398fc)[_0x5228('0x3')](0x0);var _0x351044=moment(_0x237ad3)[_0x5228('0x3')](0x0);return _0x10552b[_0x5228('0x4')](_0x351044,_0x5228('0x5'));}function QueueCallerAbandon(_0x19d77a,_0x3326bd){this[_0x5228('0x6')]=_0x19d77a[_0x5228('0x6')];this[_0x5228('0x7')]=_0x19d77a['type'];this[_0x5228('0x8')]=_0x19d77a[_0x5228('0x7')]==='outbound'?_0x5228('0x9'):_0x19d77a[_0x5228('0x7')];this['countbusyretry']=_0x19d77a[_0x5228('0xa')];this[_0x5228('0xb')]=_0x19d77a[_0x5228('0xb')];this[_0x5228('0xc')]=_0x19d77a[_0x5228('0xc')];this[_0x5228('0xd')]=_0x19d77a[_0x5228('0xa')]+_0x19d77a[_0x5228('0xb')]+_0x19d77a[_0x5228('0xc')]+_0x19d77a[_0x5228('0xe')]+_0x19d77a['countdropretry']+_0x19d77a[_0x5228('0xf')]+_0x19d77a[_0x5228('0x10')]+_0x19d77a['countagentrejectretry'];this[_0x5228('0xe')]=_0x19d77a[_0x5228('0xe')];this[_0x5228('0x11')]=_0x19d77a['countdropretry'];this['countabandonedretry']=_0x19d77a[_0x5228('0xf')];this[_0x5228('0x10')]=_0x19d77a[_0x5228('0x10')];this[_0x5228('0x12')]=_0x19d77a[_0x5228('0x12')];this[_0x5228('0x13')]=_0x3326bd[_0x5228('0x13')];this[_0x5228('0x14')]=_0x19d77a[_0x5228('0x15')];this[_0x5228('0x16')]=_0x19d77a[_0x5228('0x17')];this[_0x5228('0x18')]=_0x19d77a[_0x5228('0x18')];this['responsetime']=_0x19d77a[_0x5228('0x19')];this[_0x5228('0x1a')]=_0x19d77a[_0x5228('0x1a')];this[_0x5228('0x1b')]=this[_0x5228('0x1a')];this['ringtime']=getSeconds(_0x19d77a['responsetime'],_0x19d77a[_0x5228('0x18')]);this[_0x5228('0x1c')]=getSeconds(this[_0x5228('0x1a')],_0x19d77a[_0x5228('0x19')]);this['talktime']=0x0;this[_0x5228('0x9')]=_0x3326bd[_0x5228('0x9')];this['membername']=_0x3326bd[_0x5228('0x1d')];this[_0x5228('0x1e')]=_0x3326bd[_0x5228('0x1e')];this[_0x5228('0x1f')]=_0x19d77a[_0x5228('0x1f')];this['callbackuniqueid']=_0x19d77a[_0x5228('0x20')];this[_0x5228('0x21')]=_0x19d77a[_0x5228('0x21')];this['recallme']=_0x19d77a[_0x5228('0x22')];this[_0x5228('0x23')]=_0x19d77a[_0x5228('0x23')];this['ListId']=_0x19d77a['ListId'];this[_0x5228('0x24')]=_0x19d77a['UserId'];this[_0x5228('0x25')]=_0x19d77a['VoiceQueueId'];this[_0x5228('0x26')]=_0x19d77a[_0x5228('0x26')];this['originatecalleridnum']=_0x19d77a[_0x5228('0x27')]||'';this['originatecalleridname']=_0x19d77a['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5ec661c..16dbba1 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(_0x3da8a9,_0x568522){var _0x422328=function(_0x1b3e43){while(--_0x1b3e43){_0x3da8a9['push'](_0x3da8a9['shift']());}};_0x422328(++_0x568522);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x1ef3fe,_0x515e8f){var _0x366cdb=function(_0x446c09){while(--_0x446c09){_0x1ef3fe['push'](_0x1ef3fe['shift']());}};_0x366cdb(++_0x515e8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 f79f1aa..fe90320 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 _0x6224=['syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','notify','catch','stringify','error','\x20receiveFax\x20','response','reason','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse'];(function(_0x2c0e54,_0x2f7213){var _0x4d9624=function(_0xffefa2){while(--_0xffefa2){_0x2c0e54['push'](_0x2c0e54['shift']());}};_0x4d9624(++_0x2f7213);}(_0x6224,0xd3));var _0x4622=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6224[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x4622('0x0'));var _=require(_0x4622('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4622('0x2'));var moment=require(_0x4622('0x3'));var path=require('path');var tiff2pdf=require(_0x4622('0x4'));var gs=require('./util/gs');var logger=require(_0x4622('0x5'))(_0x4622('0x6'));var ami=require(_0x4622('0x7'));var rpcDb=require(_0x4622('0x8'));var Channel=require(_0x4622('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x4622('0xa'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x4622('0xb'));function Fax(_0x1e6e9a){this[_0x4622('0xc')]={};this['faxAccounts']=_0x1e6e9a[_0x4622('0xd')];this[_0x4622('0xe')]=_0x1e6e9a[_0x4622('0xe')];this[_0x4622('0xf')]={};ami['on']('newchannel',this[_0x4622('0x10')]['bind'](this));ami['on'](_0x4622('0x11'),this[_0x4622('0x12')][_0x4622('0x13')](this));ami['on'](_0x4622('0x14'),this[_0x4622('0x15')][_0x4622('0x13')](this));ami['on'](_0x4622('0x16'),this[_0x4622('0x17')][_0x4622('0x13')](this));ami['on'](_0x4622('0x18'),this[_0x4622('0x19')][_0x4622('0x13')](this));ami['on'](_0x4622('0x1a'),this[_0x4622('0x1b')]['bind'](this));ami['on'](_0x4622('0x1c'),this[_0x4622('0x1d')][_0x4622('0x13')](this));ami['on'](_0x4622('0x1e'),this[_0x4622('0x1f')][_0x4622('0x13')](this));}Fax[_0x4622('0x20')]['syncNewchannel']=function(_0x4cebd2){if(_0x4cebd2[_0x4622('0x21')]===_0x4622('0x22')){for(var _0x3c3f23 in this[_0x4622('0xd')]){if(this['faxAccounts'][_0x4622('0x23')](_0x3c3f23)){if(_0x4cebd2[_0x4622('0x24')]===this[_0x4622('0xd')][_0x3c3f23][_0x4622('0x25')]){this[_0x4622('0xc')][_0x4cebd2[_0x4622('0x26')]]={};this[_0x4622('0xc')][_0x4cebd2[_0x4622('0x26')]]['channel']=_0x4cebd2[_0x4622('0x27')];this[_0x4622('0xc')][_0x4cebd2[_0x4622('0x26')]]['id']=this[_0x4622('0xd')][_0x3c3f23]['id'];this[_0x4622('0xc')][_0x4cebd2[_0x4622('0x26')]][_0x4622('0x28')]=this[_0x4622('0xd')][_0x3c3f23]['name'];logger['info'](_0x4cebd2[_0x4622('0x26')],'\x20syncNewchannel\x20');}}}}if(this[_0x4622('0xf')][_0x4cebd2[_0x4622('0x26')]]){this['channels'][_0x4cebd2[_0x4622('0x26')]]={};this[_0x4622('0xc')][_0x4cebd2[_0x4622('0x26')]]['channel']=_0x4cebd2[_0x4622('0x27')];logger[_0x4622('0x29')](_0x4cebd2[_0x4622('0x26')],_0x4622('0x2a'));}};Fax[_0x4622('0x20')]['syncVarSet']=function(_0x384888){if(this[_0x4622('0xc')][_0x384888[_0x4622('0x26')]]){for(var _0x487507 in _0x384888['variable']){if(_0x384888[_0x4622('0x2b')][_0x4622('0x23')](_0x487507)){this[_0x4622('0xc')][_0x384888[_0x4622('0x26')]][_0x487507]=_0x384888[_0x4622('0x2c')];}}}};Fax[_0x4622('0x20')][_0x4622('0x15')]=function(_0x8baf62){if(this['channels'][_0x8baf62[_0x4622('0x26')]]){this[_0x4622('0xc')][_0x8baf62[_0x4622('0x26')]][_0x4622('0x2d')]=_0x8baf62['channelstate'];this[_0x4622('0xc')][_0x8baf62[_0x4622('0x26')]][_0x4622('0x2e')]=_0x8baf62['channelstatedesc'];}};Fax['prototype'][_0x4622('0x17')]=function(_0x255f8b){if(this[_0x4622('0xc')][_0x255f8b[_0x4622('0x26')]]){for(var _0x1584fb in _0x255f8b[_0x4622('0x2b')]){if(_0x255f8b[_0x4622('0x2b')][_0x4622('0x23')](_0x1584fb)){this[_0x4622('0xc')][_0x255f8b['uniqueid']][_0x1584fb]=_0x255f8b[_0x4622('0x2c')];}}}};Fax[_0x4622('0x20')][_0x4622('0x19')]=function(_0x333cf6){if(this['channels'][_0x333cf6[_0x4622('0x26')]]){this[_0x4622('0xc')][_0x333cf6[_0x4622('0x26')]][_0x4622('0x2f')]=_0x333cf6[_0x4622('0x2f')];this[_0x4622('0xc')][_0x333cf6['uniqueid']][_0x4622('0x30')]=_0x333cf6[_0x4622('0x30')];this[_0x4622('0xc')][_0x333cf6[_0x4622('0x26')]][_0x4622('0x25')]=_0x333cf6[_0x4622('0x25')];this[_0x4622('0xc')][_0x333cf6[_0x4622('0x26')]]['filename']=_0x333cf6[_0x4622('0x31')];logger[_0x4622('0x29')](_0x333cf6[_0x4622('0x26')],_0x4622('0x32'));}};Fax[_0x4622('0x20')]['syncReceiveFax']=function(_0x554a5b){var _0x282dc3=this;if(this['channels'][_0x554a5b[_0x4622('0x26')]]){var _0x339e09=this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]]['id'];this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]][_0x4622('0x33')]=_0x554a5b[_0x4622('0x33')];this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]][_0x4622('0x34')]=_0x554a5b[_0x4622('0x34')];this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]][_0x4622('0x25')]=_0x554a5b[_0x4622('0x25')];this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]][_0x4622('0x35')]=_0x554a5b[_0x4622('0x35')];this['channels'][_0x554a5b[_0x4622('0x26')]][_0x4622('0x36')]=_0x554a5b[_0x4622('0x36')];this[_0x4622('0xc')][_0x554a5b['uniqueid']][_0x4622('0x31')]=_0x554a5b[_0x4622('0x31')];this['channels'][_0x554a5b['uniqueid']]['calleridnum']=_0x554a5b[_0x4622('0x37')];if(this[_0x4622('0xc')][_0x554a5b[_0x4622('0x26')]][_0x4622('0x34')]>0x0){tiff2pdf(_0x554a5b['filename'],_0x4622('0x38'),function(_0x4660f9){logger[_0x4622('0x29')](_0x554a5b[_0x4622('0x26')],_0x4622('0x39'),_0x4660f9['message']);attachment[_0x4622('0x3a')]({'name':path[_0x4622('0x3b')](_0x554a5b[_0x4622('0x31')])[_0x4622('0x28')],'basename':path[_0x4622('0x3b')](_0x554a5b['filename'])[_0x4622('0x28')]+_0x4622('0x3c'),'type':_0x4622('0x3d')})['then'](function(_0x3d19d6){faxAccount[_0x4622('0x3e')](_0x339e09,{'from':_0x554a5b[_0x4622('0x37')],'mapKey':_0x4622('0x6'),'body':path[_0x4622('0x3b')](_0x554a5b[_0x4622('0x31')])[_0x4622('0x28')]+'.pdf','AttachmentId':_0x3d19d6['id']})[_0x4622('0x3f')](function(_0x528097){logger['error'](_0x554a5b[_0x4622('0x26')],'\x20notify\x20',JSON[_0x4622('0x40')](_0x528097));});})[_0x4622('0x3f')](function(_0x36c3e6){logger[_0x4622('0x41')](_0x554a5b[_0x4622('0x26')],_0x4622('0x42'),JSON[_0x4622('0x40')](_0x36c3e6));});});}logger[_0x4622('0x29')](_0x554a5b['uniqueid'],_0x4622('0x42'));}};Fax[_0x4622('0x20')][_0x4622('0x1f')]=function(_0x1a55fa){if(this['actions'][_0x1a55fa['uniqueid']]){_['merge'](this[_0x4622('0xc')][_0x1a55fa[_0x4622('0x26')]],_['pick'](_0x1a55fa,[_0x4622('0x43'),_0x4622('0x44')]));}};function updateStatus(_0x48499f){if(_0x48499f[_0x4622('0x45')]){faxMessage['update'](_0x48499f[_0x4622('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4622('0x46')](function(_0x50405a){ut[_0x4622('0x47')](_0x4622('0x48'),_0x50405a);})[_0x4622('0x3f')](function(_0x42fb1a){ut[_0x4622('0x47')]('[Fax][Message][Error][NoUpdate1]',_0x42fb1a);});}else{ut[_0x4622('0x47')](_0x4622('0x49'));}}Fax[_0x4622('0x20')][_0x4622('0x4a')]=function(_0xc97e42,_0x14250e,_0x307ef4){var _0x3316e0=this;var _0x35bdce={};if(_0x14250e){_0x35bdce={'read':_0x14250e};}else{_0x35bdce={'failMessage':_0x307ef4};}if(this[_0x4622('0xf')][_0xc97e42]['AttachmentId']){faxMessage[_0x4622('0x4b')](this[_0x4622('0xf')][_0xc97e42][_0x4622('0x45')],_0x35bdce)[_0x4622('0x46')](function(_0x1a5ccf){ut[_0x4622('0x47')](_0x4622('0x4c'),_0x1a5ccf);})[_0x4622('0x3f')](function(_0x5677bb){ut[_0x4622('0x47')](_0x4622('0x4d'),_0x5677bb);})[_0x4622('0x4e')](function(){delete _0x3316e0['channels'][_0xc97e42];delete _0x3316e0[_0x4622('0xf')][_0xc97e42];});}else{ut['logger'](_0x4622('0x4f'));delete this[_0x4622('0xc')][_0xc97e42];delete this['actions'][_0xc97e42];}};Fax[_0x4622('0x20')][_0x4622('0x1d')]=function(_0x3262cb){var _0x211a5c=this;if(this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]]){if(this['actions'][_0x3262cb[_0x4622('0x26')]]){this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]]['id']=this['actions'][_0x3262cb[_0x4622('0x26')]]['id'];this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]][_0x4622('0x28')]=this[_0x4622('0xf')][_0x3262cb[_0x4622('0x26')]][_0x4622('0x28')];}logger['info'](_0x3262cb[_0x4622('0x26')],this[_0x4622('0xf')][_0x3262cb[_0x4622('0x26')]]?_0x4622('0x50'):'\x20hangup\x20faxRiceive\x20',JSON['stringify'](this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]]));if(this[_0x4622('0xf')][_0x3262cb[_0x4622('0x26')]]){if(this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]]['faxpages']>0x0&&this[_0x4622('0xc')][_0x3262cb['uniqueid']][_0x4622('0x18')]===_0x4622('0x51')){this['updateStatus'](_0x3262cb[_0x4622('0x26')],!![]);}else{this[_0x4622('0x4a')](_0x3262cb['uniqueid'],![],this[_0x4622('0xc')][_0x3262cb[_0x4622('0x26')]][_0x4622('0x52')]?'SENDING\x20FAILED:\x20'+this[_0x4622('0xc')][_0x3262cb['uniqueid']][_0x4622('0x52')]:_0x4622('0x53'));}}}};Fax[_0x4622('0x20')][_0x4622('0x54')]=function(_0x2c4fac){var _0x4145dc=this;return new BPromise(function(_0x112a60,_0x334a11){_0x4145dc['execOriginate'](_0x2c4fac,_0x4145dc[_0x4622('0xd')][_0x2c4fac[_0x4622('0x55')]])[_0x4622('0x46')](function(_0xb522f2){ut[_0x4622('0x47')](_0x4622('0x56'),_0xb522f2);_0x112a60(ut[_0x4622('0x57')](_0x4622('0x58')));})[_0x4622('0x3f')](function(_0x30e9e1){ut['logger']('[Fax][execOriginate][failure]',_0x30e9e1);updateStatus(_0x2c4fac);_0x334a11(ut[_0x4622('0x57')](_0x4622('0x59')));});});};Fax[_0x4622('0x20')][_0x4622('0x5a')]=function(_0x33154a){var _0x490bdc=this;return new BPromise(function(_0x9170f,_0x2d1e2b){var _0x12f08d=_0x490bdc[_0x4622('0x5b')](_0x490bdc[_0x4622('0xd')][_0x33154a['FaxAccountId']]['Trunk'],_0x33154a);if(_0x12f08d[_0x4622('0x5c')]){_0x9170f(ut[_0x4622('0x57')](_0x4622('0x5d')));}else{_0x2d1e2b(ut[_0x4622('0x57')](_0x12f08d[_0x4622('0x57')]));}});};function originate(_0x402460,_0x547ab4,_0x20a9f9){return new BPromise(function(_0x285568,_0x2664c2){if(_0x20a9f9){var _0x240822=util[_0x4622('0x5e')](_0x4622('0x5f'),path['parse'](_0x402460[_0x4622('0x60')])[_0x4622('0x28')],_0x402460['path']);gs[_0x4622('0x61')](_0x240822)[_0x4622('0x46')](function(){_0x402460[_0x4622('0x60')]=util[_0x4622('0x5e')](_0x4622('0x62'),path[_0x4622('0x3b')](_0x402460[_0x4622('0x60')])[_0x4622('0x63')],path[_0x4622('0x3b')](_0x402460['path'])[_0x4622('0x28')]);_0x547ab4[_0x4622('0x64')]=_0x402460['path'];ut[_0x4622('0x47')](_0x4622('0x65'),'');ami[_0x4622('0x66')](ut[_0x4622('0x67')](_0x402460,_0x547ab4))[_0x4622('0x46')](function(_0x1ebdac){_0x285568(_0x1ebdac);})['catch'](function(_0x3b2d3b){_0x2664c2(_0x3b2d3b);});})[_0x4622('0x3f')](function(_0x47d478){_0x2664c2(_0x47d478);});}else{ami[_0x4622('0x66')](ut[_0x4622('0x67')](_0x402460,_0x547ab4))[_0x4622('0x46')](function(_0x389f80){_0x285568(_0x389f80);})[_0x4622('0x3f')](function(_0x3cd8f2){_0x2664c2(_0x3cd8f2);});}});}Fax['prototype'][_0x4622('0x68')]=function(_0x14aa84,_0x240e86){var _0x209bc6=this;return new BPromise(function(_0x21633b,_0x10dbf9){var _0x194b34=uuid['v4']();var _0x2cd09d=ut[_0x4622('0x69')](_0x14aa84,_0x240e86);_0x209bc6[_0x4622('0xf')][_0x194b34]=new Action(_0x194b34,_0x240e86,_0x14aa84);var _0x5f56ea=_0x209bc6[_0x4622('0xf')][_0x194b34];if(path[_0x4622('0x3b')](_0x14aa84[_0x4622('0x60')])[_0x4622('0x6a')]==='.pdf'){originate(_0x5f56ea,_0x2cd09d,!![])[_0x4622('0x46')](function(_0x4a1a0c){_0x21633b(_0x4a1a0c);})[_0x4622('0x3f')](function(_0x3389f4){_0x10dbf9(_0x3389f4);});}else{originate(_0x5f56ea,_0x2cd09d,![])['then'](function(_0x1837f3){_0x21633b(_0x1837f3);})[_0x4622('0x3f')](function(_0x28ff2a){_0x10dbf9(_0x28ff2a);});}});};Fax['prototype'][_0x4622('0x6b')]=function(_0x4351aa){return!_[_0x4622('0x6c')](_0x4351aa)&&!_['isNil'](_0x4351aa['name'])&&!_[_0x4622('0x6c')](_0x4351aa['active'])&&_0x4351aa[_0x4622('0x6d')]&&!_[_0x4622('0x6c')](this[_0x4622('0xe')][util['format'](_0x4622('0x6e'),_0x4351aa[_0x4622('0x28')])])&&!_[_0x4622('0x6c')](this[_0x4622('0xe')][util[_0x4622('0x5e')](_0x4622('0x6e'),_0x4351aa[_0x4622('0x28')])][_0x4622('0x30')])&&(this['trunks'][util[_0x4622('0x5e')]('SIP/%s',_0x4351aa[_0x4622('0x28')])][_0x4622('0x30')]===_0x4622('0x6f')||this['trunks'][util[_0x4622('0x5e')](_0x4622('0x6e'),_0x4351aa[_0x4622('0x28')])][_0x4622('0x30')]===_0x4622('0x70'));};Fax[_0x4622('0x20')][_0x4622('0x5b')]=function(_0x10ff5c,_0x5a644c){if(!this[_0x4622('0x6b')](_0x10ff5c)){ut[_0x4622('0x47')](_0x4622('0x71'),_[_0x4622('0x6c')](_0x10ff5c)?'':_0x10ff5c['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4622('0x72')};}if(_[_0x4622('0x6c')](_0x5a644c['fax'])){ut['logger'](_0x4622('0x73'),JSON[_0x4622('0x40')](_0x5a644c));return{'isValid':![],'message':_0x4622('0x74')};}if(_[_0x4622('0x6c')](_0x5a644c['path'])){ut[_0x4622('0x47')](_0x4622('0x75'),JSON['stringify'](_0x5a644c));return{'isValid':![],'message':_0x4622('0x76')};}return{'isValid':!![],'message':_0x4622('0x77')};};module[_0x4622('0x78')]=Fax; \ No newline at end of file +var _0xd004=['lodash','uuid','moment','path','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','faxAccounts','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','finally','syncHangup','\x20hangup\x20faxRiceive\x20','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util'];(function(_0x4a3e45,_0x1e8ef3){var _0x48db76=function(_0x33d341){while(--_0x33d341){_0x4a3e45['push'](_0x4a3e45['shift']());}};_0x48db76(++_0x1e8ef3);}(_0xd004,0x164));var _0x4d00=function(_0x48404b,_0x107b24){_0x48404b=_0x48404b-0x0;var _0x5bec5a=_0xd004[_0x48404b];return _0x5bec5a;};'use strict';var util=require(_0x4d00('0x0'));var _=require(_0x4d00('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4d00('0x2'));var moment=require(_0x4d00('0x3'));var path=require(_0x4d00('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x4d00('0x5'));var logger=require(_0x4d00('0x6'))(_0x4d00('0x7'));var ami=require(_0x4d00('0x8'));var rpcDb=require(_0x4d00('0x9'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x4d00('0xa'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x4d00('0xb'));var faxMessage=require(_0x4d00('0xc'));function Fax(_0x5b766f){this[_0x4d00('0xd')]={};this['faxAccounts']=_0x5b766f['faxAccounts'];this[_0x4d00('0xe')]=_0x5b766f[_0x4d00('0xe')];this[_0x4d00('0xf')]={};ami['on'](_0x4d00('0x10'),this['syncNewchannel'][_0x4d00('0x11')](this));ami['on'](_0x4d00('0x12'),this[_0x4d00('0x13')]['bind'](this));ami['on'](_0x4d00('0x14'),this[_0x4d00('0x15')][_0x4d00('0x11')](this));ami['on'](_0x4d00('0x16'),this['syncNewExten'][_0x4d00('0x11')](this));ami['on']('faxstatus',this[_0x4d00('0x17')]['bind'](this));ami['on'](_0x4d00('0x18'),this[_0x4d00('0x19')][_0x4d00('0x11')](this));ami['on'](_0x4d00('0x1a'),this['syncHangup']['bind'](this));ami['on'](_0x4d00('0x1b'),this[_0x4d00('0x1c')]['bind'](this));}Fax[_0x4d00('0x1d')][_0x4d00('0x1e')]=function(_0x447765){if(_0x447765[_0x4d00('0x1f')]===_0x4d00('0x20')){for(var _0x4849bf in this['faxAccounts']){if(this[_0x4d00('0x21')]['hasOwnProperty'](_0x4849bf)){if(_0x447765[_0x4d00('0x22')]===this[_0x4d00('0x21')][_0x4849bf][_0x4d00('0x23')]){this[_0x4d00('0xd')][_0x447765[_0x4d00('0x24')]]={};this[_0x4d00('0xd')][_0x447765['uniqueid']][_0x4d00('0x25')]=_0x447765[_0x4d00('0x25')];this[_0x4d00('0xd')][_0x447765[_0x4d00('0x24')]]['id']=this[_0x4d00('0x21')][_0x4849bf]['id'];this[_0x4d00('0xd')][_0x447765['uniqueid']][_0x4d00('0x26')]=this['faxAccounts'][_0x4849bf]['name'];logger[_0x4d00('0x27')](_0x447765[_0x4d00('0x24')],_0x4d00('0x28'));}}}}if(this[_0x4d00('0xf')][_0x447765['uniqueid']]){this[_0x4d00('0xd')][_0x447765[_0x4d00('0x24')]]={};this[_0x4d00('0xd')][_0x447765[_0x4d00('0x24')]][_0x4d00('0x25')]=_0x447765[_0x4d00('0x25')];logger['info'](_0x447765[_0x4d00('0x24')],'\x20syncNewchannel\x20');}};Fax[_0x4d00('0x1d')][_0x4d00('0x13')]=function(_0x51d8d6){if(this[_0x4d00('0xd')][_0x51d8d6[_0x4d00('0x24')]]){for(var _0x351143 in _0x51d8d6[_0x4d00('0x29')]){if(_0x51d8d6[_0x4d00('0x29')]['hasOwnProperty'](_0x351143)){this[_0x4d00('0xd')][_0x51d8d6[_0x4d00('0x24')]][_0x351143]=_0x51d8d6[_0x4d00('0x2a')];}}}};Fax[_0x4d00('0x1d')][_0x4d00('0x15')]=function(_0x5e9d33){if(this['channels'][_0x5e9d33['uniqueid']]){this['channels'][_0x5e9d33[_0x4d00('0x24')]]['channelstate']=_0x5e9d33[_0x4d00('0x2b')];this[_0x4d00('0xd')][_0x5e9d33[_0x4d00('0x24')]][_0x4d00('0x2c')]=_0x5e9d33['channelstatedesc'];}};Fax[_0x4d00('0x1d')][_0x4d00('0x2d')]=function(_0x128cc4){if(this['channels'][_0x128cc4[_0x4d00('0x24')]]){for(var _0x86c66d in _0x128cc4[_0x4d00('0x29')]){if(_0x128cc4[_0x4d00('0x29')][_0x4d00('0x2e')](_0x86c66d)){this[_0x4d00('0xd')][_0x128cc4['uniqueid']][_0x86c66d]=_0x128cc4[_0x4d00('0x2a')];}}}};Fax[_0x4d00('0x1d')][_0x4d00('0x17')]=function(_0x48f8c5){if(this[_0x4d00('0xd')][_0x48f8c5[_0x4d00('0x24')]]){this[_0x4d00('0xd')][_0x48f8c5[_0x4d00('0x24')]][_0x4d00('0x2f')]=_0x48f8c5[_0x4d00('0x2f')];this[_0x4d00('0xd')][_0x48f8c5[_0x4d00('0x24')]][_0x4d00('0x30')]=_0x48f8c5[_0x4d00('0x30')];this[_0x4d00('0xd')][_0x48f8c5[_0x4d00('0x24')]][_0x4d00('0x23')]=_0x48f8c5['localstationid'];this['channels'][_0x48f8c5[_0x4d00('0x24')]][_0x4d00('0x31')]=_0x48f8c5[_0x4d00('0x31')];logger['info'](_0x48f8c5[_0x4d00('0x24')],_0x4d00('0x32'));}};Fax[_0x4d00('0x1d')][_0x4d00('0x19')]=function(_0x208c44){var _0x500803=this;if(this[_0x4d00('0xd')][_0x208c44['uniqueid']]){var _0x104f86=this['channels'][_0x208c44['uniqueid']]['id'];this[_0x4d00('0xd')][_0x208c44[_0x4d00('0x24')]]['remotestationid']=_0x208c44[_0x4d00('0x33')];this[_0x4d00('0xd')][_0x208c44[_0x4d00('0x24')]][_0x4d00('0x34')]=_0x208c44['pagestransferred'];this[_0x4d00('0xd')][_0x208c44[_0x4d00('0x24')]][_0x4d00('0x23')]=_0x208c44['localstationid'];this[_0x4d00('0xd')][_0x208c44[_0x4d00('0x24')]][_0x4d00('0x35')]=_0x208c44[_0x4d00('0x35')];this[_0x4d00('0xd')][_0x208c44[_0x4d00('0x24')]][_0x4d00('0x36')]=_0x208c44[_0x4d00('0x36')];this['channels'][_0x208c44[_0x4d00('0x24')]]['filename']=_0x208c44[_0x4d00('0x31')];this[_0x4d00('0xd')][_0x208c44['uniqueid']]['calleridnum']=_0x208c44[_0x4d00('0x37')];if(this[_0x4d00('0xd')][_0x208c44['uniqueid']][_0x4d00('0x34')]>0x0){tiff2pdf(_0x208c44[_0x4d00('0x31')],_0x4d00('0x38'),function(_0x35e358){logger['info'](_0x208c44['uniqueid'],_0x4d00('0x39'),_0x35e358['message']);attachment[_0x4d00('0x3a')]({'name':path[_0x4d00('0x3b')](_0x208c44[_0x4d00('0x31')])[_0x4d00('0x26')],'basename':path[_0x4d00('0x3b')](_0x208c44['filename'])[_0x4d00('0x26')]+_0x4d00('0x3c'),'type':_0x4d00('0x3d')})[_0x4d00('0x3e')](function(_0x2b7593){faxAccount[_0x4d00('0x3f')](_0x104f86,{'from':_0x208c44[_0x4d00('0x37')],'mapKey':_0x4d00('0x7'),'body':path['parse'](_0x208c44[_0x4d00('0x31')])[_0x4d00('0x26')]+_0x4d00('0x3c'),'AttachmentId':_0x2b7593['id']})['catch'](function(_0x29771c){logger[_0x4d00('0x40')](_0x208c44[_0x4d00('0x24')],_0x4d00('0x41'),JSON['stringify'](_0x29771c));});})[_0x4d00('0x42')](function(_0x2bfe65){logger[_0x4d00('0x40')](_0x208c44['uniqueid'],_0x4d00('0x43'),JSON[_0x4d00('0x44')](_0x2bfe65));});});}logger['info'](_0x208c44[_0x4d00('0x24')],_0x4d00('0x43'));}};Fax[_0x4d00('0x1d')]['syncOriginateResponse']=function(_0x5a5a3c){if(this[_0x4d00('0xf')][_0x5a5a3c[_0x4d00('0x24')]]){_[_0x4d00('0x45')](this['channels'][_0x5a5a3c['uniqueid']],_[_0x4d00('0x46')](_0x5a5a3c,[_0x4d00('0x47'),'reason']));}};function updateStatus(_0x96f789){if(_0x96f789[_0x4d00('0x48')]){faxMessage[_0x4d00('0x49')](_0x96f789[_0x4d00('0x48')],{'failMessage':_0x4d00('0x4a')})[_0x4d00('0x3e')](function(_0x2c75e3){ut[_0x4d00('0x4b')]('[Fax][Message][Error][Updated]',_0x2c75e3);})[_0x4d00('0x42')](function(_0x47e038){ut[_0x4d00('0x4b')](_0x4d00('0x4c'),_0x47e038);});}else{ut[_0x4d00('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x4d00('0x1d')]['updateStatus']=function(_0x1cea10,_0xe91b8d,_0x472461){var _0x4157b0=this;var _0x3f0718={};if(_0xe91b8d){_0x3f0718={'read':_0xe91b8d};}else{_0x3f0718={'failMessage':_0x472461};}if(this[_0x4d00('0xf')][_0x1cea10][_0x4d00('0x48')]){faxMessage[_0x4d00('0x49')](this[_0x4d00('0xf')][_0x1cea10]['AttachmentId'],_0x3f0718)[_0x4d00('0x3e')](function(_0x3dba3b){ut[_0x4d00('0x4b')]('[Fax][Message][Updated]',_0x3dba3b);})[_0x4d00('0x42')](function(_0x265fd9){ut[_0x4d00('0x4b')]('[Fax][Message][NoUpdate1]',_0x265fd9);})[_0x4d00('0x4d')](function(){delete _0x4157b0[_0x4d00('0xd')][_0x1cea10];delete _0x4157b0[_0x4d00('0xf')][_0x1cea10];});}else{ut[_0x4d00('0x4b')]('[Fax][Message][NoUpdate2]');delete this[_0x4d00('0xd')][_0x1cea10];delete this[_0x4d00('0xf')][_0x1cea10];}};Fax[_0x4d00('0x1d')][_0x4d00('0x4e')]=function(_0x169043){var _0x17eab4=this;if(this[_0x4d00('0xd')][_0x169043[_0x4d00('0x24')]]){if(this[_0x4d00('0xf')][_0x169043[_0x4d00('0x24')]]){this['channels'][_0x169043[_0x4d00('0x24')]]['id']=this['actions'][_0x169043[_0x4d00('0x24')]]['id'];this[_0x4d00('0xd')][_0x169043['uniqueid']][_0x4d00('0x26')]=this[_0x4d00('0xf')][_0x169043[_0x4d00('0x24')]][_0x4d00('0x26')];}logger[_0x4d00('0x27')](_0x169043['uniqueid'],this[_0x4d00('0xf')][_0x169043['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x4d00('0x4f'),JSON[_0x4d00('0x44')](this['channels'][_0x169043[_0x4d00('0x24')]]));if(this[_0x4d00('0xf')][_0x169043[_0x4d00('0x24')]]){if(this['channels'][_0x169043[_0x4d00('0x24')]]['faxpages']>0x0&&this['channels'][_0x169043['uniqueid']][_0x4d00('0x50')]===_0x4d00('0x51')){this[_0x4d00('0x52')](_0x169043['uniqueid'],!![]);}else{this[_0x4d00('0x52')](_0x169043[_0x4d00('0x24')],![],this[_0x4d00('0xd')][_0x169043[_0x4d00('0x24')]][_0x4d00('0x53')]?_0x4d00('0x54')+this[_0x4d00('0xd')][_0x169043[_0x4d00('0x24')]]['faxstatusstring']:_0x4d00('0x55'));}}}};Fax[_0x4d00('0x1d')][_0x4d00('0x56')]=function(_0x4f68eb){var _0x101f31=this;return new BPromise(function(_0xf28d86,_0x17d9c8){_0x101f31[_0x4d00('0x57')](_0x4f68eb,_0x101f31[_0x4d00('0x21')][_0x4f68eb[_0x4d00('0x58')]])[_0x4d00('0x3e')](function(_0x334a19){ut[_0x4d00('0x4b')](_0x4d00('0x59'),_0x334a19);_0xf28d86(ut[_0x4d00('0x5a')](_0x4d00('0x5b')));})['catch'](function(_0x189106){ut[_0x4d00('0x4b')](_0x4d00('0x5c'),_0x189106);updateStatus(_0x4f68eb);_0x17d9c8(ut[_0x4d00('0x5a')](_0x4d00('0x5d')));});});};Fax[_0x4d00('0x1d')][_0x4d00('0x5e')]=function(_0x20a832){var _0x54eac0=this;return new BPromise(function(_0x1e61db,_0x3bfadf){var _0x208297=_0x54eac0[_0x4d00('0x5f')](_0x54eac0[_0x4d00('0x21')][_0x20a832[_0x4d00('0x58')]][_0x4d00('0x60')],_0x20a832);if(_0x208297[_0x4d00('0x61')]){_0x1e61db(ut['message'](_0x4d00('0x62')));}else{_0x3bfadf(ut[_0x4d00('0x5a')](_0x208297[_0x4d00('0x5a')]));}});};function originate(_0x55ccb6,_0x5c0d60,_0x826d08){return new BPromise(function(_0x714e38,_0x409212){if(_0x826d08){var _0x5e891e=util[_0x4d00('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[_0x4d00('0x3b')](_0x55ccb6[_0x4d00('0x4')])['name'],_0x55ccb6['path']);gs[_0x4d00('0x64')](_0x5e891e)[_0x4d00('0x3e')](function(){_0x55ccb6[_0x4d00('0x4')]=util[_0x4d00('0x63')]('%s/%s.tif',path[_0x4d00('0x3b')](_0x55ccb6[_0x4d00('0x4')])[_0x4d00('0x65')],path['parse'](_0x55ccb6[_0x4d00('0x4')])[_0x4d00('0x26')]);_0x5c0d60['XMF-PATH']=_0x55ccb6[_0x4d00('0x4')];ut[_0x4d00('0x4b')](_0x4d00('0x66'),'');ami[_0x4d00('0x67')](ut[_0x4d00('0x68')](_0x55ccb6,_0x5c0d60))[_0x4d00('0x3e')](function(_0x3dcce0){_0x714e38(_0x3dcce0);})[_0x4d00('0x42')](function(_0x307c9e){_0x409212(_0x307c9e);});})[_0x4d00('0x42')](function(_0x474aa7){_0x409212(_0x474aa7);});}else{ami[_0x4d00('0x67')](ut[_0x4d00('0x68')](_0x55ccb6,_0x5c0d60))[_0x4d00('0x3e')](function(_0x161c73){_0x714e38(_0x161c73);})['catch'](function(_0x55c6dd){_0x409212(_0x55c6dd);});}});}Fax[_0x4d00('0x1d')][_0x4d00('0x57')]=function(_0x7b102a,_0x5bb30a){var _0x1819e2=this;return new BPromise(function(_0x34e49b,_0x2aa423){var _0x28de1a=uuid['v4']();var _0x222d78=ut[_0x4d00('0x69')](_0x7b102a,_0x5bb30a);_0x1819e2[_0x4d00('0xf')][_0x28de1a]=new Action(_0x28de1a,_0x5bb30a,_0x7b102a);var _0x3fe31e=_0x1819e2[_0x4d00('0xf')][_0x28de1a];if(path[_0x4d00('0x3b')](_0x7b102a[_0x4d00('0x4')])[_0x4d00('0x6a')]===_0x4d00('0x3c')){originate(_0x3fe31e,_0x222d78,!![])[_0x4d00('0x3e')](function(_0x20418c){_0x34e49b(_0x20418c);})[_0x4d00('0x42')](function(_0x1c15e0){_0x2aa423(_0x1c15e0);});}else{originate(_0x3fe31e,_0x222d78,![])[_0x4d00('0x3e')](function(_0x52e32a){_0x34e49b(_0x52e32a);})['catch'](function(_0x47a388){_0x2aa423(_0x47a388);});}});};Fax[_0x4d00('0x1d')][_0x4d00('0x6b')]=function(_0x19891e){return!_[_0x4d00('0x6c')](_0x19891e)&&!_[_0x4d00('0x6c')](_0x19891e['name'])&&!_[_0x4d00('0x6c')](_0x19891e[_0x4d00('0x6d')])&&_0x19891e[_0x4d00('0x6d')]&&!_[_0x4d00('0x6c')](this[_0x4d00('0xe')][util[_0x4d00('0x63')]('SIP/%s',_0x19891e[_0x4d00('0x26')])])&&!_['isNil'](this['trunks'][util[_0x4d00('0x63')](_0x4d00('0x6e'),_0x19891e[_0x4d00('0x26')])][_0x4d00('0x30')])&&(this['trunks'][util[_0x4d00('0x63')](_0x4d00('0x6e'),_0x19891e[_0x4d00('0x26')])][_0x4d00('0x30')]===_0x4d00('0x6f')||this[_0x4d00('0xe')][util[_0x4d00('0x63')]('SIP/%s',_0x19891e['name'])]['status']==='unmonitored');};Fax[_0x4d00('0x1d')][_0x4d00('0x5f')]=function(_0x40fb99,_0x4b6f14){if(!this[_0x4d00('0x6b')](_0x40fb99)){ut[_0x4d00('0x4b')](_0x4d00('0x70'),_[_0x4d00('0x6c')](_0x40fb99)?'':_0x40fb99[_0x4d00('0x26')]+_0x4d00('0x71'));return{'isValid':![],'message':_0x4d00('0x72')};}if(_[_0x4d00('0x6c')](_0x4b6f14['fax'])){ut[_0x4d00('0x4b')](_0x4d00('0x73'),JSON['stringify'](_0x4b6f14));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x4d00('0x6c')](_0x4b6f14[_0x4d00('0x4')])){ut[_0x4d00('0x4b')](_0x4d00('0x74'),JSON['stringify'](_0x4b6f14));return{'isValid':![],'message':_0x4d00('0x75')};}return{'isValid':!![],'message':_0x4d00('0x76')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 417e1af..6af06b3 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 _0xa1cf=['lodash','notify','resolve','catch','[Notify]\x20','util','../../../config/logger','preview'];(function(_0x49cb71,_0x2f0149){var _0x3a50fd=function(_0x48c304){while(--_0x48c304){_0x49cb71['push'](_0x49cb71['shift']());}};_0x3a50fd(++_0x2f0149);}(_0xa1cf,0x11d));var _0xfa1c=function(_0x3ef837,_0x20c649){_0x3ef837=_0x3ef837-0x0;var _0x52a68a=_0xa1cf[_0x3ef837];return _0x52a68a;};'use strict';var util=require(_0xfa1c('0x0'));var BPromise=require('bluebird');var logger=require(_0xfa1c('0x1'))(_0xfa1c('0x2'));var _=require(_0xfa1c('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x12a4ef){return function(_0x5bd27a){logger['error'](_0x12a4ef,util['inspect'](_0x5bd27a,{'showHidden':![],'depth':null}));};}exports[_0xfa1c('0x4')]=function(_0x375dd9,_0x1209c9){return BPromise[_0xfa1c('0x5')]()['then'](faxAccount[_0xfa1c('0x4')](_0x375dd9,_0x1209c9))[_0xfa1c('0x6')](loggerCatch(_0xfa1c('0x7')));}; \ No newline at end of file +var _0x4d19=['preview','lodash','../rpc/faxAccount','error','inspect','resolve','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x3b38ac,_0x313209){var _0x3765b9=function(_0x2f4e04){while(--_0x2f4e04){_0x3b38ac['push'](_0x3b38ac['shift']());}};_0x3765b9(++_0x313209);}(_0x4d19,0x159));var _0x94d1=function(_0x1186fa,_0x4ec83a){_0x1186fa=_0x1186fa-0x0;var _0x26420a=_0x4d19[_0x1186fa];return _0x26420a;};'use strict';var util=require(_0x94d1('0x0'));var BPromise=require(_0x94d1('0x1'));var logger=require(_0x94d1('0x2'))(_0x94d1('0x3'));var _=require(_0x94d1('0x4'));var faxAccount=require(_0x94d1('0x5'));function loggerCatch(_0x8b570f){return function(_0x589a95){logger[_0x94d1('0x6')](_0x8b570f,util[_0x94d1('0x7')](_0x589a95,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xd4a36a,_0x414a40){return BPromise[_0x94d1('0x8')]()['then'](faxAccount[_0x94d1('0x9')](_0xd4a36a,_0x414a40))[_0x94d1('0xa')](loggerCatch(_0x94d1('0xb')));}; \ 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 e95a429..5bf5142 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 _0x126c=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec'];(function(_0x25f2be,_0x497e0b){var _0x177231=function(_0x18d902){while(--_0x18d902){_0x25f2be['push'](_0x25f2be['shift']());}};_0x177231(++_0x497e0b);}(_0x126c,0x1db));var _0xc126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x126c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xc126('0x0'));var logger=require(_0xc126('0x1'))(_0xc126('0x2'));var BPromise=require('bluebird');var exec=require(_0xc126('0x3'))[_0xc126('0x4')];exports[_0xc126('0x5')]=function(_0x313521){return new BPromise(function(_0x303266,_0x27a959){exec(_0x313521,function(_0x6eafb7,_0x2a68d3,_0x48d962){logger[_0xc126('0x6')](_0xc126('0x7'),_0x2a68d3);if(_0x6eafb7){logger['info'](_0xc126('0x7'),_0xc126('0x8'),util[_0xc126('0x9')](_0x6eafb7,{'showHidden':![],'depth':null}),_0x2a68d3,_0x48d962);_0x27a959(_0x6eafb7);}_0x303266(_0x2a68d3);});});}; \ No newline at end of file +var _0xa96e=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0xa96e,0x8d));var _0xea96=function(_0x283ff4,_0x2ba5f7){_0x283ff4=_0x283ff4-0x0;var _0x5522ae=_0xa96e[_0x283ff4];return _0x5522ae;};'use strict';var util=require(_0xea96('0x0'));var logger=require(_0xea96('0x1'))(_0xea96('0x2'));var BPromise=require(_0xea96('0x3'));var exec=require(_0xea96('0x4'))[_0xea96('0x5')];exports[_0xea96('0x6')]=function(_0x4e87a7){return new BPromise(function(_0x2c0af6,_0x394e24){exec(_0x4e87a7,function(_0xded6cc,_0x301ccd,_0x363ec1){logger['info']('Exec\x20gs',_0x301ccd);if(_0xded6cc){logger[_0xea96('0x7')](_0xea96('0x8'),'\x20Error\x20:',util[_0xea96('0x9')](_0xded6cc,{'showHidden':![],'depth':null}),_0x301ccd,_0x363ec1);_0x394e24(_0xded6cc);}_0x2c0af6(_0x301ccd);});});}; \ 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 19418ef..caf28a5 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 _0x0039=['t38timeout','path','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','moment','fax','message','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x3a75c8,_0x48d74d){var _0x404302=function(_0x4fe13a){while(--_0x4fe13a){_0x3a75c8['push'](_0x3a75c8['shift']());}};_0x404302(++_0x48d74d);}(_0x0039,0x65));var _0x9003=function(_0x3ed7c1,_0x38bad0){_0x3ed7c1=_0x3ed7c1-0x0;var _0x24eb1d=_0x0039[_0x3ed7c1];return _0x24eb1d;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x9003('0x0'));var logger=require('../../../../config/logger')(_0x9003('0x1'));exports[_0x9003('0x2')]=function(_0x58bd9a){return{'message':_0x58bd9a};};exports['logger']=function(_0xab0547,_0xd5ab1e){logger[_0x9003('0x3')](_0xab0547,util[_0x9003('0x4')](_0xd5ab1e,{'showHidden':![],'depth':null}));};exports[_0x9003('0x5')]=function(_0x43484c,_0x3fee7d){var _0x266c8f={'XMF-ECM':_0x3fee7d[_0x9003('0x6')],'XMF-HEADERINFO':_0x3fee7d['headerinfo'],'XMF-MINRATE':_0x3fee7d[_0x9003('0x7')],'XMF-MAXRATE':_0x3fee7d[_0x9003('0x8')],'XMF-MODEM':util[_0x9003('0x9')](_0x9003('0xa'),_0x3fee7d[_0x9003('0xb')]),'XMF-GATEWAY':_0x3fee7d[_0x9003('0xc')],'XMF-FAXDETECT':_0x3fee7d[_0x9003('0xd')],'XMF-T38TIMEOUT':_0x3fee7d[_0x9003('0xe')],'XMF-LOCALSTATIONID':_0x3fee7d['localstationid'],'XMF-PATH':_0x43484c[_0x9003('0xf')]};return _0x266c8f;};exports['variablesAction']=function(_0x55d1af,_0x30d4c5){return{'actionid':_0x55d1af[_0x9003('0x10')],'action':_0x9003('0x11'),'channel':_0x55d1af['channel'],'Exten':_0x9003('0x12'),'Context':_0x9003('0x13'),'Priority':'1','callerid':util[_0x9003('0x9')](_0x9003('0x14'),_0x55d1af[_0x9003('0x15')]?_0x55d1af['headerinfo']:'',_0x55d1af[_0x9003('0x16')]),'variable':_0x30d4c5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x55d1af[_0x9003('0x10')]};}; \ No newline at end of file +var _0x84e1=['faxdetect','t38timeout','path','variablesAction','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','info','inspect','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem'];(function(_0x143290,_0x8b9484){var _0x16dcb0=function(_0x34c132){while(--_0x34c132){_0x143290['push'](_0x143290['shift']());}};_0x16dcb0(++_0x8b9484);}(_0x84e1,0x168));var _0x184e=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x84e1[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x184e('0x0'));var _=require(_0x184e('0x1'));var moment=require(_0x184e('0x2'));var logger=require(_0x184e('0x3'))(_0x184e('0x4'));exports[_0x184e('0x5')]=function(_0x49b408){return{'message':_0x49b408};};exports['logger']=function(_0x1b6361,_0xe33bc2){logger[_0x184e('0x6')](_0x1b6361,util[_0x184e('0x7')](_0xe33bc2,{'showHidden':![],'depth':null}));};exports[_0x184e('0x8')]=function(_0x341dc4,_0x3af43d){var _0x12c5a0={'XMF-ECM':_0x3af43d[_0x184e('0x9')],'XMF-HEADERINFO':_0x3af43d['headerinfo'],'XMF-MINRATE':_0x3af43d[_0x184e('0xa')],'XMF-MAXRATE':_0x3af43d[_0x184e('0xb')],'XMF-MODEM':util[_0x184e('0xc')](_0x184e('0xd'),_0x3af43d[_0x184e('0xe')]),'XMF-GATEWAY':_0x3af43d['gateway'],'XMF-FAXDETECT':_0x3af43d[_0x184e('0xf')],'XMF-T38TIMEOUT':_0x3af43d[_0x184e('0x10')],'XMF-LOCALSTATIONID':_0x3af43d['localstationid'],'XMF-PATH':_0x341dc4[_0x184e('0x11')]};return _0x12c5a0;};exports[_0x184e('0x12')]=function(_0x3ede91,_0x5e07b7){return{'actionid':_0x3ede91['uniqueid'],'action':'originate','channel':_0x3ede91['channel'],'Exten':_0x184e('0x13'),'Context':_0x184e('0x14'),'Priority':'1','callerid':util[_0x184e('0xc')](_0x184e('0x15'),_0x3ede91[_0x184e('0x16')]?_0x3ede91[_0x184e('0x16')]:'',_0x3ede91[_0x184e('0x17')]),'variable':_0x5e07b7,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3ede91[_0x184e('0x18')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 766c514..bf8888e 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 _0x4da6=['./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','../../config/logger','ami','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','error','[index.js][main]','bluebird','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk'];(function(_0x508dc5,_0x1aa23c){var _0x403554=function(_0x25d1ac){while(--_0x25d1ac){_0x508dc5['push'](_0x508dc5['shift']());}};_0x403554(++_0x1aa23c);}(_0x4da6,0x7e));var _0x64da=function(_0x571118,_0x201a59){_0x571118=_0x571118-0x0;var _0x5da3eb=_0x4da6[_0x571118];return _0x5da3eb;};'use strict';var BPromise=require(_0x64da('0x0'));var util=require(_0x64da('0x1'));var moment=require(_0x64da('0x2'));var server=require('./server');var Realtime=require(_0x64da('0x3'));var Report=require(_0x64da('0x4'));var Acw=require(_0x64da('0x5'));var Trigger=require(_0x64da('0x6'));var Dialer=require('./dialer');var Preview=require(_0x64da('0x7'));var Fax=require(_0x64da('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x64da('0x9'));var voiceQueueReport=require(_0x64da('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x64da('0xb'));var trigger=require(_0x64da('0xc'));var template=require(_0x64da('0xd'));var cmHopperHistory=require(_0x64da('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x64da('0xf'));var faxAccount=require(_0x64da('0x10'));var zendesk=require(_0x64da('0x11'));var salesforce=require(_0x64da('0x12'));var sugarcrm=require(_0x64da('0x13'));var freshdesk=require(_0x64da('0x14'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x64da('0x15'));var vtiger=require(_0x64da('0x16'));var freshsales=require(_0x64da('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x64da('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(_0x64da('0x19'))(_0x64da('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x64da('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x64da('0x1c')]()[_0x64da('0x1d')](user[_0x64da('0x1e')]())['then'](realtime[_0x64da('0x1f')]())[_0x64da('0x1d')](user[_0x64da('0x20')]())['then'](realtime[_0x64da('0x21')]())[_0x64da('0x1d')](trunk[_0x64da('0x22')]())[_0x64da('0x1d')](realtime[_0x64da('0x23')]())[_0x64da('0x1d')](voiceQueue[_0x64da('0x24')]())[_0x64da('0x1d')](realtime['initVoiceQueues']())[_0x64da('0x1d')](trigger[_0x64da('0x25')]())[_0x64da('0x1d')](realtime[_0x64da('0x26')]())[_0x64da('0x1d')](template[_0x64da('0x27')]())[_0x64da('0x1d')](realtime[_0x64da('0x28')]())[_0x64da('0x1d')](zendesk['getZendeskAccounts']())[_0x64da('0x1d')](realtime[_0x64da('0x29')]())[_0x64da('0x1d')](salesforce[_0x64da('0x2a')]())[_0x64da('0x1d')](realtime[_0x64da('0x2b')]())[_0x64da('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0x64da('0x1d')](realtime[_0x64da('0x2c')]())[_0x64da('0x1d')](freshdesk[_0x64da('0x2d')]())[_0x64da('0x1d')](realtime['initFreshdeskAccounts']())[_0x64da('0x1d')](desk[_0x64da('0x2e')]())[_0x64da('0x1d')](realtime[_0x64da('0x2f')]())[_0x64da('0x1d')](zoho[_0x64da('0x30')]())[_0x64da('0x1d')](realtime[_0x64da('0x31')]())[_0x64da('0x1d')](vtiger[_0x64da('0x32')]())[_0x64da('0x1d')](realtime['initVtigerAccounts']())['then'](freshsales[_0x64da('0x33')]())['then'](realtime['initFreshsalesAccounts']())[_0x64da('0x1d')](servicenow[_0x64da('0x34')]())[_0x64da('0x1d')](realtime[_0x64da('0x35')]())[_0x64da('0x1d')](dynamics365[_0x64da('0x36')]())[_0x64da('0x1d')](realtime[_0x64da('0x37')]())[_0x64da('0x1d')](campaign[_0x64da('0x38')]())[_0x64da('0x1d')](realtime['initCampaigns']())[_0x64da('0x1d')](voiceExtension[_0x64da('0x39')]())[_0x64da('0x1d')](realtime[_0x64da('0x3a')]())['then'](faxAccount[_0x64da('0x3b')]())[_0x64da('0x1d')](realtime[_0x64da('0x3c')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x64da('0x1d')](voiceQueueReport[_0x64da('0x3d')]())[_0x64da('0x1d')](realtime[_0x64da('0x3e')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())[_0x64da('0x1d')](cmHopperHistory[_0x64da('0x3f')]())['then'](realtime[_0x64da('0x40')]())[_0x64da('0x1d')](voiceCallReport[_0x64da('0x41')]())[_0x64da('0x1d')](realtime[_0x64da('0x42')]())[_0x64da('0x43')](function(_0x4ef97f){logger['error'](_0x64da('0x44'),util[_0x64da('0x45')](_0x4ef97f,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x64da('0x1d')](function(_0x17a00c){return initRealtime();})[_0x64da('0x1d')](function(){return initParams();})[_0x64da('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x64da('0x43')](function(_0x5747d4){logger[_0x64da('0x46')](_0x64da('0x47'),util[_0x64da('0x45')](_0x5747d4,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xfc1e=['getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','[index.js][main]','./server','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x4409e7,_0x307f17){_0x4409e7=_0x4409e7-0x0;var _0x24c751=_0xfc1e[_0x4409e7];return _0x24c751;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0xefc1('0x0'));var Realtime=require(_0xefc1('0x1'));var Report=require(_0xefc1('0x2'));var Acw=require(_0xefc1('0x3'));var Trigger=require(_0xefc1('0x4'));var Dialer=require('./dialer');var Preview=require(_0xefc1('0x5'));var Fax=require(_0xefc1('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xefc1('0x7'));var voiceCallReport=require(_0xefc1('0x8'));var trunk=require(_0xefc1('0x9'));var trigger=require(_0xefc1('0xa'));var template=require(_0xefc1('0xb'));var cmHopperHistory=require(_0xefc1('0xc'));var campaign=require(_0xefc1('0xd'));var voiceExtension=require(_0xefc1('0xe'));var faxAccount=require(_0xefc1('0xf'));var zendesk=require(_0xefc1('0x10'));var salesforce=require(_0xefc1('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xefc1('0x12'));var desk=require(_0xefc1('0x13'));var zoho=require(_0xefc1('0x14'));var vtiger=require(_0xefc1('0x15'));var freshsales=require(_0xefc1('0x16'));var servicenow=require(_0xefc1('0x17'));var dynamics365=require(_0xefc1('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(_0xefc1('0x19'))(_0xefc1('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xefc1('0x1b')](_0xefc1('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xefc1('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xefc1('0x1d')]()[_0xefc1('0x1e')](user[_0xefc1('0x1f')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x20')]())[_0xefc1('0x1e')](user[_0xefc1('0x21')]())['then'](realtime[_0xefc1('0x22')]())[_0xefc1('0x1e')](trunk[_0xefc1('0x23')]())['then'](realtime[_0xefc1('0x24')]())[_0xefc1('0x1e')](voiceQueue[_0xefc1('0x25')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x26')]())[_0xefc1('0x1e')](trigger[_0xefc1('0x27')]())[_0xefc1('0x1e')](realtime['initTriggers']())[_0xefc1('0x1e')](template[_0xefc1('0x28')]())[_0xefc1('0x1e')](realtime['initTemplates']())['then'](zendesk[_0xefc1('0x29')]())['then'](realtime[_0xefc1('0x2a')]())['then'](salesforce[_0xefc1('0x2b')]())[_0xefc1('0x1e')](realtime['initSalesforceAccounts']())[_0xefc1('0x1e')](sugarcrm[_0xefc1('0x2c')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x2d')]())[_0xefc1('0x1e')](freshdesk[_0xefc1('0x2e')]())['then'](realtime[_0xefc1('0x2f')]())[_0xefc1('0x1e')](desk['getDeskAccounts']())[_0xefc1('0x1e')](realtime['initDeskAccounts']())['then'](zoho[_0xefc1('0x30')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x31')]())[_0xefc1('0x1e')](vtiger[_0xefc1('0x32')]())[_0xefc1('0x1e')](realtime['initVtigerAccounts']())['then'](freshsales[_0xefc1('0x33')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x34')]())[_0xefc1('0x1e')](servicenow[_0xefc1('0x35')]())['then'](realtime[_0xefc1('0x36')]())[_0xefc1('0x1e')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xefc1('0x37')]())[_0xefc1('0x1e')](campaign[_0xefc1('0x38')]())['then'](realtime[_0xefc1('0x39')]())[_0xefc1('0x1e')](voiceExtension[_0xefc1('0x3a')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x3b')]())[_0xefc1('0x1e')](faxAccount[_0xefc1('0x3c')]())[_0xefc1('0x1e')](realtime['initFaxAccounts']())[_0xefc1('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xefc1('0x1d')]()[_0xefc1('0x1e')](voiceQueueReport[_0xefc1('0x3d')]())[_0xefc1('0x1e')](realtime[_0xefc1('0x3e')]())[_0xefc1('0x1e')](cmHopperHistory[_0xefc1('0x3f')]())['then'](realtime[_0xefc1('0x40')]())[_0xefc1('0x1e')](cmHopperHistory[_0xefc1('0x41')]())[_0xefc1('0x1e')](realtime['initCampaignHopperHistory']())[_0xefc1('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xefc1('0x1e')](realtime[_0xefc1('0x42')]())[_0xefc1('0x43')](function(_0x20e2d9){logger['error'](_0xefc1('0x44'),util[_0xefc1('0x45')](_0x20e2d9,{'showHidden':![],'depth':null}));});}function main(){return server[_0xefc1('0x46')](realtime,preview,fax)['then'](function(_0x385cba){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0xefc1('0x47')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3cbe7f){logger[_0xefc1('0x48')](_0xefc1('0x49'),util[_0xefc1('0x45')](_0x3cbe7f,{'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 4da86d9..965f906 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x2d25de,_0x42745a){var _0x518cc3=function(_0xb03055){while(--_0xb03055){_0x2d25de['push'](_0x2d25de['shift']());}};_0x518cc3(++_0x42745a);}(_0x70e0,0x17b));var _0x070e=function(_0xc3c1c5,_0x3ce373){_0xc3c1c5=_0xc3c1c5-0x0;var _0x29df93=_0x70e0[_0xc3c1c5];return _0x29df93;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x1d9be2,_0x1d32bf){var _0x19dd38=function(_0x8508f1){while(--_0x8508f1){_0x1d9be2['push'](_0x1d9be2['shift']());}};_0x19dd38(++_0x1d32bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0xcb91[_0x23b655];return _0x364b32;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('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 26e4617..3e32e2d 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 _0xb797=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb797,0x1b9));var _0x7b79=function(_0x12998d,_0x59d609){_0x12998d=_0x12998d-0x0;var _0x4c54ac=_0xb797[_0x12998d];return _0x4c54ac;};'use strict';function Campaign(_0x22af2e){this['id']=_0x22af2e['id']||0x0;this[_0x7b79('0x0')]=_0x22af2e[_0x7b79('0x0')]||'';this[_0x7b79('0x1')]=_0x22af2e[_0x7b79('0x1')]||_0x7b79('0x2');this[_0x7b79('0x3')]=0x0;this['temp']=0x0;this[_0x7b79('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7b79('0x5')]='';this[_0x7b79('0x6')]=!![];this['active']=_0x22af2e[_0x7b79('0x7')];this[_0x7b79('0x8')]=_0x22af2e['limitCalls'];this[_0x7b79('0x9')]=_0x22af2e['dialTimezone']||null;this['dialGlobalInterval']=_0x22af2e[_0x7b79('0xa')]?_0x22af2e[_0x7b79('0xa')]:null;this[_0x7b79('0xb')]=_0x22af2e[_0x7b79('0xb')];this[_0x7b79('0xc')]=_0x22af2e[_0x7b79('0xc')];this[_0x7b79('0xd')]=_0x22af2e['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x22af2e[_0x7b79('0xe')];this[_0x7b79('0xf')]=_0x22af2e[_0x7b79('0xf')];this['dialBusyMaxRetry']=_0x22af2e['dialBusyMaxRetry'];this[_0x7b79('0x10')]=_0x22af2e[_0x7b79('0x10')];this[_0x7b79('0x11')]=_0x22af2e[_0x7b79('0x11')];this[_0x7b79('0x12')]=_0x22af2e[_0x7b79('0x12')];this[_0x7b79('0x13')]=_0x22af2e[_0x7b79('0x13')];this['dialNoSuchNumberMaxRetry']=_0x22af2e[_0x7b79('0x14')]||0x3;this[_0x7b79('0x15')]=_0x22af2e['dialNoSuchNumberRetryFrequency']||0x96;this[_0x7b79('0x16')]=_0x22af2e[_0x7b79('0x16')]||0x3;this[_0x7b79('0x17')]=_0x22af2e['dialDropRetryFrequency']||0x96;this[_0x7b79('0x18')]=_0x22af2e[_0x7b79('0x18')]||0x3;this['dialAbandonedRetryFrequency']=_0x22af2e['dialAbandonedRetryFrequency']||0x96;this[_0x7b79('0x19')]=_0x22af2e[_0x7b79('0x19')]||0x3;this[_0x7b79('0x1a')]=_0x22af2e[_0x7b79('0x1a')]||0x96;this[_0x7b79('0x1b')]=_0x22af2e[_0x7b79('0x1b')]||0x3;this[_0x7b79('0x1c')]=_0x22af2e['dialAgentRejectRetryFrequency']||0x96;this[_0x7b79('0x1d')]=_0x22af2e[_0x7b79('0x1d')]||_0x7b79('0x1e');this['dialPrefix']=_0x22af2e[_0x7b79('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x22af2e[_0x7b79('0x20')]||undefined;this[_0x7b79('0x21')]=_0x22af2e[_0x7b79('0x21')]||undefined;this['TrunkBackup']=_0x22af2e['TrunkBackup']?_0x22af2e['TrunkBackup']:undefined;this['Trunk']=_0x22af2e[_0x7b79('0x22')]?_0x22af2e[_0x7b79('0x22')]:undefined;this['Interval']=_0x22af2e['Interval']?_0x22af2e[_0x7b79('0x23')]:undefined;this[_0x7b79('0x24')]=_0x22af2e[_0x7b79('0x24')]?_0x22af2e[_0x7b79('0x24')]:undefined;this[_0x7b79('0x25')]=_0x22af2e[_0x7b79('0x24')]?_0x22af2e[_0x7b79('0x24')][_0x7b79('0x0')]:undefined;this[_0x7b79('0x26')]=_0x22af2e[_0x7b79('0x26')]||![];this[_0x7b79('0x27')]=_0x22af2e[_0x7b79('0x27')];this[_0x7b79('0x28')]=_0x22af2e[_0x7b79('0x28')];this[_0x7b79('0x29')]=_0x22af2e[_0x7b79('0x29')];this[_0x7b79('0x2a')]=_0x22af2e[_0x7b79('0x2a')];this['dialAMDMinWordLength']=_0x22af2e['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x22af2e[_0x7b79('0x2b')];this[_0x7b79('0x2c')]=_0x22af2e[_0x7b79('0x2c')];this['dialAMDSilenceThreshold']=_0x22af2e[_0x7b79('0x2d')];this[_0x7b79('0x2e')]=_0x22af2e['dialAMDMaximumWordLength'];}module[_0x7b79('0x2f')]=Campaign; \ No newline at end of file +var _0x221c=['message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays'];(function(_0x5a50fa,_0x29f75f){var _0x26d453=function(_0x7939b7){while(--_0x7939b7){_0x5a50fa['push'](_0x5a50fa['shift']());}};_0x26d453(++_0x29f75f);}(_0x221c,0x12b));var _0xc221=function(_0x7a1a24,_0x5c0139){_0x7a1a24=_0x7a1a24-0x0;var _0x307adb=_0x221c[_0x7a1a24];return _0x307adb;};'use strict';function Campaign(_0x12ce91){this['id']=_0x12ce91['id']||0x0;this['name']=_0x12ce91[_0xc221('0x0')]||'';this[_0xc221('0x1')]=_0x12ce91[_0xc221('0x1')]||_0xc221('0x2');this[_0xc221('0x3')]=0x0;this[_0xc221('0x4')]=0x0;this[_0xc221('0x5')]=0x0;this[_0xc221('0x6')]=0x0;this[_0xc221('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xc221('0x8')]=_0x12ce91[_0xc221('0x8')];this[_0xc221('0x9')]=_0x12ce91[_0xc221('0x9')];this[_0xc221('0xa')]=_0x12ce91[_0xc221('0xa')]||null;this['dialGlobalInterval']=_0x12ce91[_0xc221('0xb')]?_0x12ce91[_0xc221('0xb')]:null;this[_0xc221('0xc')]=_0x12ce91['dialOriginateCallerIdName'];this[_0xc221('0xd')]=_0x12ce91['dialOriginateCallerIdNumber'];this[_0xc221('0xe')]=_0x12ce91[_0xc221('0xe')]||0x1e;this[_0xc221('0xf')]=_0x12ce91['dialCongestionMaxRetry'];this[_0xc221('0x10')]=_0x12ce91[_0xc221('0x10')];this['dialBusyMaxRetry']=_0x12ce91['dialBusyMaxRetry'];this[_0xc221('0x11')]=_0x12ce91['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x12ce91[_0xc221('0x12')];this[_0xc221('0x13')]=_0x12ce91[_0xc221('0x13')];this[_0xc221('0x14')]=_0x12ce91[_0xc221('0x14')];this[_0xc221('0x15')]=_0x12ce91[_0xc221('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x12ce91[_0xc221('0x16')]||0x96;this[_0xc221('0x17')]=_0x12ce91[_0xc221('0x17')]||0x3;this[_0xc221('0x18')]=_0x12ce91[_0xc221('0x18')]||0x96;this[_0xc221('0x19')]=_0x12ce91[_0xc221('0x19')]||0x3;this[_0xc221('0x1a')]=_0x12ce91[_0xc221('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x12ce91[_0xc221('0x1b')]||0x3;this[_0xc221('0x1c')]=_0x12ce91[_0xc221('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x12ce91[_0xc221('0x1d')]||0x3;this[_0xc221('0x1e')]=_0x12ce91['dialAgentRejectRetryFrequency']||0x96;this[_0xc221('0x1f')]=_0x12ce91[_0xc221('0x1f')]||_0xc221('0x20');this[_0xc221('0x21')]=_0x12ce91[_0xc221('0x21')]||undefined;this[_0xc221('0x22')]=_0x12ce91[_0xc221('0x22')]||undefined;this[_0xc221('0x23')]=_0x12ce91[_0xc221('0x23')]||undefined;this[_0xc221('0x24')]=_0x12ce91[_0xc221('0x24')]?_0x12ce91[_0xc221('0x24')]:undefined;this['Trunk']=_0x12ce91[_0xc221('0x25')]?_0x12ce91['Trunk']:undefined;this['Interval']=_0x12ce91[_0xc221('0x26')]?_0x12ce91[_0xc221('0x26')]:undefined;this[_0xc221('0x27')]=_0x12ce91[_0xc221('0x27')]?_0x12ce91['SquareProject']:undefined;this[_0xc221('0x28')]=_0x12ce91[_0xc221('0x27')]?_0x12ce91['SquareProject'][_0xc221('0x0')]:undefined;this[_0xc221('0x29')]=_0x12ce91['dialAMDActive']||![];this[_0xc221('0x2a')]=_0x12ce91[_0xc221('0x2a')];this[_0xc221('0x2b')]=_0x12ce91[_0xc221('0x2b')];this[_0xc221('0x2c')]=_0x12ce91[_0xc221('0x2c')];this[_0xc221('0x2d')]=_0x12ce91[_0xc221('0x2d')];this[_0xc221('0x2e')]=_0x12ce91[_0xc221('0x2e')];this['dialAMDBetweenWordsSilence']=_0x12ce91['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x12ce91[_0xc221('0x2f')];this[_0xc221('0x30')]=_0x12ce91['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x12ce91[_0xc221('0x31')];}module[_0xc221('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 2f9f5b5..9fcfc71 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 _0x86dc=['monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','calleridnum','calleridname','connectedlinenum','connectedlinename','context','linkedid','answered','answertime','endtime','abandoned','lastdata','duration','type','tag','monitor','monitorFilename','queue'];(function(_0x3819da,_0x30ad8d){var _0x1a6f40=function(_0x674588){while(--_0x674588){_0x3819da['push'](_0x3819da['shift']());}};_0x1a6f40(++_0x30ad8d);}(_0x86dc,0x13e));var _0xc86d=function(_0x32cd15,_0x4b2c25){_0x32cd15=_0x32cd15-0x0;var _0x5b4472=_0x86dc[_0x32cd15];return _0x5b4472;};'use strict';function Channel(){this[_0xc86d('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0xc86d('0x1')]=0x0;this[_0xc86d('0x2')]='';this[_0xc86d('0x3')]=undefined;this[_0xc86d('0x4')]=undefined;this['accountcode']=0x0;this[_0xc86d('0x5')]='';this['uniqueid']=0x0;this[_0xc86d('0x6')]=0x0;this['exten']=0x0;this[_0xc86d('0x7')]=![];this[_0xc86d('0x8')]=null;this[_0xc86d('0x9')]=null;this['unmanaged']=![];this[_0xc86d('0xa')]=![];this['lastapplication']='';this[_0xc86d('0xb')]='';this[_0xc86d('0xc')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0xc86d('0xd')]=null;this[_0xc86d('0xe')]=null;this['disposition']=null;this[_0xc86d('0xf')]=![];this[_0xc86d('0x10')]=null;this[_0xc86d('0x11')]=null;this[_0xc86d('0x12')]=[];this[_0xc86d('0x13')]=undefined;this[_0xc86d('0x14')]=undefined;this[_0xc86d('0x15')]=undefined;this[_0xc86d('0x16')]=0x0;}module[_0xc86d('0x17')]=Channel; \ No newline at end of file +var _0x6372=['transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answertime','lastapplication','billableseconds','holdtime','type','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x231a38,_0x452383){var _0x1c3278=function(_0x1d83f0){while(--_0x1d83f0){_0x231a38['push'](_0x231a38['shift']());}};_0x1c3278(++_0x452383);}(_0x6372,0x1b8));var _0x2637=function(_0x53cd01,_0x479259){_0x53cd01=_0x53cd01-0x0;var _0x437153=_0x6372[_0x53cd01];return _0x437153;};'use strict';function Channel(){this[_0x2637('0x0')]=null;this['channel']='';this[_0x2637('0x1')]='';this['calleridnum']=0x0;this[_0x2637('0x2')]='';this[_0x2637('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x2637('0x4')]=0x0;this[_0x2637('0x5')]='';this[_0x2637('0x6')]=0x0;this[_0x2637('0x7')]=0x0;this[_0x2637('0x8')]=0x0;this['answered']=![];this[_0x2637('0x9')]=null;this['endtime']=null;this['unmanaged']=![];this['abandoned']=![];this[_0x2637('0xa')]='';this['lastdata']='';this['duration']=0x0;this[_0x2637('0xb')]=0x0;this[_0x2637('0xc')]=0x0;this[_0x2637('0xd')]=null;this['tag']=null;this['disposition']=null;this[_0x2637('0xe')]=![];this[_0x2637('0xf')]=null;this[_0x2637('0x10')]=null;this[_0x2637('0x11')]=[];this[_0x2637('0x12')]=undefined;this[_0x2637('0x13')]=undefined;this[_0x2637('0x14')]=undefined;this[_0x2637('0x15')]=0x0;}module[_0x2637('0x16')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 618ba46..c5b34ea 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 _0x0c5f=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x57dcd5,_0x20d4b5){var _0xdf4d36=function(_0x449974){while(--_0x449974){_0x57dcd5['push'](_0x57dcd5['shift']());}};_0xdf4d36(++_0x20d4b5);}(_0x0c5f,0x130));var _0xf0c5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0c5f[_0x122ef9];return _0x42fba0;};'use strict';function DeskAccount(_0xd6ce1e){this['id']=_0xd6ce1e['id']||0x0;this[_0xf0c5('0x0')]=_0xd6ce1e[_0xf0c5('0x0')]||'';this[_0xf0c5('0x1')]=_0xd6ce1e[_0xf0c5('0x1')]||'';this['remoteUri']=_0xd6ce1e[_0xf0c5('0x2')]||'';this[_0xf0c5('0x3')]=_0xd6ce1e[_0xf0c5('0x3')]||'';this[_0xf0c5('0x4')]=_0xd6ce1e['password']||'';this['consumerKey']=_0xd6ce1e[_0xf0c5('0x5')]||'';this[_0xf0c5('0x6')]=_0xd6ce1e[_0xf0c5('0x6')]||'';this['token']=_0xd6ce1e[_0xf0c5('0x7')]||'';this['tokenSecret']=_0xd6ce1e[_0xf0c5('0x8')]||'';this[_0xf0c5('0x9')]=_0xd6ce1e[_0xf0c5('0x9')]||'';this[_0xf0c5('0xa')]=_0xd6ce1e['serverUrl']||'';this['Configurations']=_0xd6ce1e[_0xf0c5('0xb')]||{};}module[_0xf0c5('0xc')]=DeskAccount; \ No newline at end of file +var _0xee5d=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','name','username','remoteUri','authType'];(function(_0x58762b,_0x13b129){var _0x576129=function(_0x3e3aa6){while(--_0x3e3aa6){_0x58762b['push'](_0x58762b['shift']());}};_0x576129(++_0x13b129);}(_0xee5d,0x1d5));var _0xdee5=function(_0x4a5216,_0x31944f){_0x4a5216=_0x4a5216-0x0;var _0x1d93df=_0xee5d[_0x4a5216];return _0x1d93df;};'use strict';function DeskAccount(_0x477f4d){this['id']=_0x477f4d['id']||0x0;this[_0xdee5('0x0')]=_0x477f4d[_0xdee5('0x0')]||'';this[_0xdee5('0x1')]=_0x477f4d['username']||'';this[_0xdee5('0x2')]=_0x477f4d[_0xdee5('0x2')]||'';this[_0xdee5('0x3')]=_0x477f4d['authType']||'';this[_0xdee5('0x4')]=_0x477f4d[_0xdee5('0x4')]||'';this[_0xdee5('0x5')]=_0x477f4d['consumerKey']||'';this[_0xdee5('0x6')]=_0x477f4d['consumerSecret']||'';this[_0xdee5('0x7')]=_0x477f4d[_0xdee5('0x7')]||'';this[_0xdee5('0x8')]=_0x477f4d[_0xdee5('0x8')]||'';this[_0xdee5('0x9')]=_0x477f4d['type']||'';this[_0xdee5('0xa')]=_0x477f4d[_0xdee5('0xa')]||'';this['Configurations']=_0x477f4d['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index d96fca1..8b08efa 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 _0xf803=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x34b167,_0x5bf6b8){var _0x9bcc7a=function(_0x148423){while(--_0x148423){_0x34b167['push'](_0x34b167['shift']());}};_0x9bcc7a(++_0x5bf6b8);}(_0xf803,0x184));var _0x3f80=function(_0x4c119a,_0x4a2416){_0x4c119a=_0x4c119a-0x0;var _0x2b0004=_0xf803[_0x4c119a];return _0x2b0004;};'use strict';function Dynamics365Account(_0x38a931){this['id']=_0x38a931['id']||0x0;this[_0x3f80('0x0')]=_0x38a931[_0x3f80('0x0')]||'';this[_0x3f80('0x1')]=_0x38a931[_0x3f80('0x1')]||'';this['password']=_0x38a931[_0x3f80('0x2')]||'';this[_0x3f80('0x3')]=_0x38a931[_0x3f80('0x3')]||'';this[_0x3f80('0x4')]=_0x38a931['tenantId']||'';this['clientId']=_0x38a931[_0x3f80('0x5')]||'';this[_0x3f80('0x6')]=_0x38a931['clientSecret']||{};this[_0x3f80('0x7')]=_0x38a931[_0x3f80('0x7')]||'';this[_0x3f80('0x8')]=_0x38a931[_0x3f80('0x8')]||![];this[_0x3f80('0x9')]=_0x38a931[_0x3f80('0x9')]||{};this[_0x3f80('0xa')]=_0x38a931[_0x3f80('0xa')]||{};}module[_0x3f80('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xc558=['clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','clientId'];(function(_0x2f196f,_0x5c1409){var _0x4fa3b4=function(_0x585da1){while(--_0x585da1){_0x2f196f['push'](_0x2f196f['shift']());}};_0x4fa3b4(++_0x5c1409);}(_0xc558,0x119));var _0x8c55=function(_0x3b4ce6,_0x1d7150){_0x3b4ce6=_0x3b4ce6-0x0;var _0x48c9e2=_0xc558[_0x3b4ce6];return _0x48c9e2;};'use strict';function Dynamics365Account(_0x434481){this['id']=_0x434481['id']||0x0;this[_0x8c55('0x0')]=_0x434481[_0x8c55('0x0')]||'';this[_0x8c55('0x1')]=_0x434481['username']||'';this[_0x8c55('0x2')]=_0x434481[_0x8c55('0x2')]||'';this[_0x8c55('0x3')]=_0x434481[_0x8c55('0x3')]||'';this['tenantId']=_0x434481['tenantId']||'';this['clientId']=_0x434481[_0x8c55('0x4')]||'';this[_0x8c55('0x5')]=_0x434481[_0x8c55('0x5')]||{};this[_0x8c55('0x6')]=_0x434481[_0x8c55('0x6')]||'';this[_0x8c55('0x7')]=_0x434481[_0x8c55('0x7')]||![];this[_0x8c55('0x8')]=_0x434481[_0x8c55('0x8')]||{};this[_0x8c55('0x9')]=_0x434481[_0x8c55('0x9')]||{};}module[_0x8c55('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 591942d..41f5afb 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 _0x9cb7=['faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9cb7,0x107));var _0x79cb=function(_0x1e9637,_0x1b3f04){_0x1e9637=_0x1e9637-0x0;var _0x580918=_0x9cb7[_0x1e9637];return _0x580918;};'use strict';function FaxAccount(_0x358920){this['id']=_0x358920['id']||0x0;this[_0x79cb('0x0')]=_0x358920[_0x79cb('0x0')]||'';this[_0x79cb('0x1')]=_0x358920[_0x79cb('0x1')];this[_0x79cb('0x2')]=_0x358920[_0x79cb('0x2')];this['headerinfo']=_0x358920['headerinfo'];this['localstationid']=_0x358920[_0x79cb('0x3')];this['minrate']=_0x358920[_0x79cb('0x4')]||0x960;this['maxrate']=_0x358920[_0x79cb('0x5')]||0x3840;this['modem']=_0x358920[_0x79cb('0x6')]||_0x79cb('0x7');this[_0x79cb('0x8')]=_0x358920['gateway']||'no';this[_0x79cb('0x9')]=_0x358920['faxdetect']||'no';this['t38timeout']=_0x358920[_0x79cb('0xa')]||0x1388;this['tech']=_0x358920['tech']||_0x79cb('0xb');this[_0x79cb('0xc')]=_0x358920[_0x79cb('0xc')]?_0x358920['Trunk']:undefined;this[_0x79cb('0xd')]=_0x358920[_0x79cb('0xd')];this[_0x79cb('0xe')]=_0x358920[_0x79cb('0xe')];}module[_0x79cb('0xf')]=FaxAccount; \ No newline at end of file +var _0x2052=['t38timeout','tech','SIP','Trunk','ListId','key','exports','description','ecm','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x131e2f,_0x4148e1){var _0xf600a2=function(_0x46541c){while(--_0x46541c){_0x131e2f['push'](_0x131e2f['shift']());}};_0xf600a2(++_0x4148e1);}(_0x2052,0x157));var _0x2205=function(_0x770ea7,_0x1fcefd){_0x770ea7=_0x770ea7-0x0;var _0x211ec6=_0x2052[_0x770ea7];return _0x211ec6;};'use strict';function FaxAccount(_0x57cd8a){this['id']=_0x57cd8a['id']||0x0;this['name']=_0x57cd8a['name']||'';this[_0x2205('0x0')]=_0x57cd8a[_0x2205('0x0')];this[_0x2205('0x1')]=_0x57cd8a[_0x2205('0x1')];this['headerinfo']=_0x57cd8a['headerinfo'];this[_0x2205('0x2')]=_0x57cd8a[_0x2205('0x2')];this[_0x2205('0x3')]=_0x57cd8a[_0x2205('0x3')]||0x960;this[_0x2205('0x4')]=_0x57cd8a[_0x2205('0x4')]||0x3840;this[_0x2205('0x5')]=_0x57cd8a['modem']||_0x2205('0x6');this[_0x2205('0x7')]=_0x57cd8a['gateway']||'no';this[_0x2205('0x8')]=_0x57cd8a[_0x2205('0x8')]||'no';this[_0x2205('0x9')]=_0x57cd8a[_0x2205('0x9')]||0x1388;this[_0x2205('0xa')]=_0x57cd8a[_0x2205('0xa')]||_0x2205('0xb');this[_0x2205('0xc')]=_0x57cd8a[_0x2205('0xc')]?_0x57cd8a['Trunk']:undefined;this[_0x2205('0xd')]=_0x57cd8a[_0x2205('0xd')];this[_0x2205('0xe')]=_0x57cd8a['key'];}module[_0x2205('0xf')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index af23a2e..b3e32f9 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 _0x5506=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x5e3b6c,_0x44e0ec){var _0x5edfec=function(_0xf03afa){while(--_0xf03afa){_0x5e3b6c['push'](_0x5e3b6c['shift']());}};_0x5edfec(++_0x44e0ec);}(_0x5506,0x10f));var _0x6550=function(_0xc58553,_0x5f4032){_0xc58553=_0xc58553-0x0;var _0x51e4f0=_0x5506[_0xc58553];return _0x51e4f0;};'use strict';function FreshdeskAccount(_0x49da1d){this['id']=_0x49da1d['id']||0x0;this[_0x6550('0x0')]=_0x49da1d['name']||'';this[_0x6550('0x1')]=_0x49da1d[_0x6550('0x1')]||'';this[_0x6550('0x2')]=_0x49da1d['token']||'';this[_0x6550('0x3')]=_0x49da1d['remoteUri']||'';this['serverUrl']=_0x49da1d[_0x6550('0x4')]||'';this[_0x6550('0x5')]=_0x49da1d['Configurations']||{};}module[_0x6550('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xb037=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x588c69,_0x55bc31){var _0x133afe=function(_0x2107f8){while(--_0x2107f8){_0x588c69['push'](_0x588c69['shift']());}};_0x133afe(++_0x55bc31);}(_0xb037,0xd4));var _0x7b03=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb037[_0x565c49];return _0x20ca34;};'use strict';function FreshdeskAccount(_0x3f5b29){this['id']=_0x3f5b29['id']||0x0;this[_0x7b03('0x0')]=_0x3f5b29[_0x7b03('0x0')]||'';this[_0x7b03('0x1')]=_0x3f5b29['username']||'';this[_0x7b03('0x2')]=_0x3f5b29[_0x7b03('0x3')]||'';this[_0x7b03('0x4')]=_0x3f5b29[_0x7b03('0x4')]||'';this[_0x7b03('0x5')]=_0x3f5b29[_0x7b03('0x5')]||'';this['Configurations']=_0x3f5b29[_0x7b03('0x6')]||{};}module[_0x7b03('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index eabe727..d4bf44e 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 _0xf873=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xf873,0xb2));var _0x3f87=function(_0x2795d1,_0x259c13){_0x2795d1=_0x2795d1-0x0;var _0x357603=_0xf873[_0x2795d1];return _0x357603;};'use strict';function FreshsalesAccount(_0x235aa9){this['id']=_0x235aa9['id']||0x0;this[_0x3f87('0x0')]=_0x235aa9[_0x3f87('0x0')]||'';this[_0x3f87('0x1')]=_0x235aa9[_0x3f87('0x1')]||'';this[_0x3f87('0x2')]=_0x235aa9[_0x3f87('0x3')]||'';this[_0x3f87('0x4')]=_0x235aa9[_0x3f87('0x4')]||'';this[_0x3f87('0x5')]=_0x235aa9['serverUrl']||'';this[_0x3f87('0x6')]=_0x235aa9[_0x3f87('0x6')]||{};}module[_0x3f87('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xd2bb=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x3fe2d1,_0x41062b){var _0x354ab3=function(_0x44bd2e){while(--_0x44bd2e){_0x3fe2d1['push'](_0x3fe2d1['shift']());}};_0x354ab3(++_0x41062b);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x377205,_0x54e250){_0x377205=_0x377205-0x0;var _0x11cc7c=_0xd2bb[_0x377205];return _0x11cc7c;};'use strict';function FreshsalesAccount(_0x50eb60){this['id']=_0x50eb60['id']||0x0;this[_0xbd2b('0x0')]=_0x50eb60['name']||'';this[_0xbd2b('0x1')]=_0x50eb60[_0xbd2b('0x1')]||'';this[_0xbd2b('0x2')]=_0x50eb60[_0xbd2b('0x3')]||'';this[_0xbd2b('0x4')]=_0x50eb60[_0xbd2b('0x4')]||'';this['serverUrl']=_0x50eb60[_0xbd2b('0x5')]||'';this[_0xbd2b('0x6')]=_0x50eb60[_0xbd2b('0x6')]||{};}module[_0xbd2b('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 201f9a6..e699328 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 _0x1f6e=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound','calleridnum','calleridname','queue'];(function(_0x47131b,_0x4750e6){var _0x40ccf1=function(_0x44224f){while(--_0x44224f){_0x47131b['push'](_0x47131b['shift']());}};_0x40ccf1(++_0x4750e6);}(_0x1f6e,0xdb));var _0xe1f6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1f6e[_0x2641f9];return _0x585741;};'use strict';function QueueReport(){this[_0xe1f6('0x0')]=_0xe1f6('0x1');this['uniqueid']='';this[_0xe1f6('0x2')]='';this[_0xe1f6('0x3')]='';this[_0xe1f6('0x4')]='';this[_0xe1f6('0x5')]=null;this[_0xe1f6('0x6')]=null;this[_0xe1f6('0x7')]=0x1;this[_0xe1f6('0x8')]=0x1;this[_0xe1f6('0x9')]=![];this[_0xe1f6('0xa')]=null;this[_0xe1f6('0xb')]=![];this[_0xe1f6('0xc')]=null;this['queuecallerexit']=![];this[_0xe1f6('0xd')]=null;this['originalposition']=0x1;this[_0xe1f6('0xe')]='';this[_0xe1f6('0xf')]='';this[_0xe1f6('0x10')]='';this[_0xe1f6('0x11')]='';this[_0xe1f6('0x12')]='';this[_0xe1f6('0x13')]='';this[_0xe1f6('0x14')]='';this[_0xe1f6('0x15')]=0x0;this[_0xe1f6('0x16')]=![];this[_0xe1f6('0x17')]='';this[_0xe1f6('0x18')]=_0xe1f6('0x19');this[_0xe1f6('0x1a')]=0x0;this['variables']={};}module[_0xe1f6('0x1b')]=QueueReport; \ No newline at end of file +var _0x87e4=['exports','type','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','assigned','lastAssignedTo','motionChannel','voice'];(function(_0x472b2f,_0x1e134d){var _0x101c88=function(_0x513296){while(--_0x513296){_0x472b2f['push'](_0x472b2f['shift']());}};_0x101c88(++_0x1e134d);}(_0x87e4,0x114));var _0x487e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x87e4[_0x6131cd];return _0x47e916;};'use strict';function QueueReport(){this[_0x487e('0x0')]='inbound';this['uniqueid']='';this[_0x487e('0x1')]='';this[_0x487e('0x2')]='';this[_0x487e('0x3')]='';this[_0x487e('0x4')]=null;this[_0x487e('0x5')]=null;this[_0x487e('0x6')]=0x1;this[_0x487e('0x7')]=0x1;this[_0x487e('0x8')]=![];this[_0x487e('0x9')]=null;this[_0x487e('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x487e('0xb')]=![];this['queuecallerexitAt']=null;this[_0x487e('0xc')]=0x1;this[_0x487e('0xd')]='';this[_0x487e('0xe')]='';this[_0x487e('0xf')]='';this[_0x487e('0x10')]='';this[_0x487e('0x11')]='';this[_0x487e('0x12')]='';this['priority']='';this[_0x487e('0x13')]=0x0;this[_0x487e('0x14')]=![];this[_0x487e('0x15')]='';this[_0x487e('0x16')]=_0x487e('0x17');this['mohtime']=0x0;this['variables']={};}module[_0x487e('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 59ae658..0e1a339 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 _0x3991=['password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri'];(function(_0x296745,_0x33a5b2){var _0x405f3b=function(_0x1bfe2d){while(--_0x1bfe2d){_0x296745['push'](_0x296745['shift']());}};_0x405f3b(++_0x33a5b2);}(_0x3991,0x101));var _0x1399=function(_0x1a4792,_0x48b259){_0x1a4792=_0x1a4792-0x0;var _0x48e5c0=_0x3991[_0x1a4792];return _0x48e5c0;};'use strict';function SalesforceAccount(_0x18d00f){this['id']=_0x18d00f['id']||0x0;this[_0x1399('0x0')]=_0x18d00f[_0x1399('0x0')]||'';this[_0x1399('0x1')]=_0x18d00f['username']||'';this[_0x1399('0x2')]=_0x18d00f[_0x1399('0x2')]||'';this[_0x1399('0x3')]=_0x18d00f[_0x1399('0x3')]||'';this[_0x1399('0x4')]=_0x18d00f['clientId']||'';this['clientSecret']=_0x18d00f['clientSecret']||'';this[_0x1399('0x5')]=_0x18d00f[_0x1399('0x5')]||'';this['type']=_0x18d00f[_0x1399('0x6')]||_0x1399('0x7');this[_0x1399('0x8')]=_0x18d00f[_0x1399('0x8')]||'';this['Configurations']=_0x18d00f[_0x1399('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xeeeb=['name','username','remoteUri','password','clientId','clientSecret','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x29b86c,_0x380183){var _0x36ea85=function(_0x5870e5){while(--_0x5870e5){_0x29b86c['push'](_0x29b86c['shift']());}};_0x36ea85(++_0x380183);}(_0xeeeb,0x1d9));var _0xbeee=function(_0xbf55b,_0x3d0bee){_0xbf55b=_0xbf55b-0x0;var _0x41d3ec=_0xeeeb[_0xbf55b];return _0x41d3ec;};'use strict';function SalesforceAccount(_0x57e26d){this['id']=_0x57e26d['id']||0x0;this[_0xbeee('0x0')]=_0x57e26d[_0xbeee('0x0')]||'';this[_0xbeee('0x1')]=_0x57e26d[_0xbeee('0x1')]||'';this[_0xbeee('0x2')]=_0x57e26d[_0xbeee('0x2')]||'';this[_0xbeee('0x3')]=_0x57e26d[_0xbeee('0x3')]||'';this[_0xbeee('0x4')]=_0x57e26d[_0xbeee('0x4')]||'';this[_0xbeee('0x5')]=_0x57e26d[_0xbeee('0x5')]||'';this['securityToken']=_0x57e26d['securityToken']||'';this[_0xbeee('0x6')]=_0x57e26d[_0xbeee('0x6')]||_0xbeee('0x7');this[_0xbeee('0x8')]=_0x57e26d[_0xbeee('0x8')]||'';this['Configurations']=_0x57e26d[_0xbeee('0x9')]||{};}module[_0xbeee('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 4763b3c..8b02865 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 _0xb073=['name','username','password','remoteUri','serverUrl','exports'];(function(_0x3251b0,_0x4a282c){var _0x1b2c28=function(_0x2031d4){while(--_0x2031d4){_0x3251b0['push'](_0x3251b0['shift']());}};_0x1b2c28(++_0x4a282c);}(_0xb073,0x8a));var _0x3b07=function(_0x55cfdd,_0x10f167){_0x55cfdd=_0x55cfdd-0x0;var _0x28a832=_0xb073[_0x55cfdd];return _0x28a832;};'use strict';function ServicenowAccount(_0x288119){this['id']=_0x288119['id']||0x0;this[_0x3b07('0x0')]=_0x288119[_0x3b07('0x0')]||'';this[_0x3b07('0x1')]=_0x288119[_0x3b07('0x1')]||'';this['password']=_0x288119[_0x3b07('0x2')]||'';this[_0x3b07('0x3')]=_0x288119['remoteUri']||'';this[_0x3b07('0x4')]=_0x288119['serverUrl']||'';this['Configurations']=_0x288119['Configurations']||{};}module[_0x3b07('0x5')]=ServicenowAccount; \ No newline at end of file +var _0xf283=['username','password','remoteUri','serverUrl','Configurations','name'];(function(_0x52a434,_0x42f87c){var _0x124feb=function(_0x2d13b8){while(--_0x2d13b8){_0x52a434['push'](_0x52a434['shift']());}};_0x124feb(++_0x42f87c);}(_0xf283,0x1f1));var _0x3f28=function(_0xda8937,_0x5847da){_0xda8937=_0xda8937-0x0;var _0x60a826=_0xf283[_0xda8937];return _0x60a826;};'use strict';function ServicenowAccount(_0x5b6ed9){this['id']=_0x5b6ed9['id']||0x0;this['name']=_0x5b6ed9[_0x3f28('0x0')]||'';this[_0x3f28('0x1')]=_0x5b6ed9[_0x3f28('0x1')]||'';this[_0x3f28('0x2')]=_0x5b6ed9[_0x3f28('0x2')]||'';this['remoteUri']=_0x5b6ed9[_0x3f28('0x3')]||'';this[_0x3f28('0x4')]=_0x5b6ed9[_0x3f28('0x4')]||'';this[_0x3f28('0x5')]=_0x5b6ed9['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 17dd582..8849a99 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 _0x5825=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x26b818,_0x44317d){var _0x5f0071=function(_0x335045){while(--_0x335045){_0x26b818['push'](_0x26b818['shift']());}};_0x5f0071(++_0x44317d);}(_0x5825,0xb5));var _0x5582=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5825[_0x19950b];return _0x3c6b41;};'use strict';function SugarcrmAccount(_0x4074a6){this['id']=_0x4074a6['id']||0x0;this[_0x5582('0x0')]=_0x4074a6[_0x5582('0x0')]||'';this['username']=_0x4074a6[_0x5582('0x1')]||'';this[_0x5582('0x2')]=_0x4074a6[_0x5582('0x2')]||'';this[_0x5582('0x3')]=_0x4074a6[_0x5582('0x3')]||'';this[_0x5582('0x4')]=_0x4074a6[_0x5582('0x4')]||'';this['Configurations']=_0x4074a6[_0x5582('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x7d36=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x290478,_0x3f4f70){var _0xdcfbff=function(_0x716071){while(--_0x716071){_0x290478['push'](_0x290478['shift']());}};_0xdcfbff(++_0x3f4f70);}(_0x7d36,0xa5));var _0x67d3=function(_0x2c3188,_0x5a3ed1){_0x2c3188=_0x2c3188-0x0;var _0x5f09ba=_0x7d36[_0x2c3188];return _0x5f09ba;};'use strict';function SugarcrmAccount(_0x48d770){this['id']=_0x48d770['id']||0x0;this[_0x67d3('0x0')]=_0x48d770[_0x67d3('0x0')]||'';this[_0x67d3('0x1')]=_0x48d770[_0x67d3('0x1')]||'';this[_0x67d3('0x2')]=_0x48d770[_0x67d3('0x2')]||'';this[_0x67d3('0x3')]=_0x48d770[_0x67d3('0x3')]||'';this[_0x67d3('0x4')]=_0x48d770[_0x67d3('0x4')]||'';this[_0x67d3('0x5')]=_0x48d770[_0x67d3('0x5')]||{};}module[_0x67d3('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 0955fc2..b78e6a1 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 _0x5236=['exports','name','accountcode','unknown','stateTime','address'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x5236,0x109));var _0x6523=function(_0x404916,_0x1bb1e5){_0x404916=_0x404916-0x0;var _0x451ce9=_0x5236[_0x404916];return _0x451ce9;};'use strict';function Telephone(_0x1e2507){this['id']=_0x1e2507['id']||0x0;this[_0x6523('0x0')]=_0x1e2507[_0x6523('0x0')]||'';this[_0x6523('0x1')]=_0x1e2507[_0x6523('0x1')]||'';this['state']=_0x6523('0x2');this[_0x6523('0x3')]=0x0;this['status']=_0x6523('0x2');this[_0x6523('0x4')]='';}module[_0x6523('0x5')]=Telephone; \ No newline at end of file +var _0x586b=['accountcode','state','unknown','stateTime','status','name'];(function(_0x1fa47a,_0xc516f7){var _0x5326ea=function(_0x59fec0){while(--_0x59fec0){_0x1fa47a['push'](_0x1fa47a['shift']());}};_0x5326ea(++_0xc516f7);}(_0x586b,0x1bb));var _0xb586=function(_0xb4327e,_0x1581f6){_0xb4327e=_0xb4327e-0x0;var _0xc59c6a=_0x586b[_0xb4327e];return _0xc59c6a;};'use strict';function Telephone(_0x362127){this['id']=_0x362127['id']||0x0;this['name']=_0x362127[_0xb586('0x0')]||'';this[_0xb586('0x1')]=_0x362127[_0xb586('0x1')]||'';this[_0xb586('0x2')]=_0xb586('0x3');this[_0xb586('0x4')]=0x0;this[_0xb586('0x5')]=_0xb586('0x3');this['address']='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5b4ea37..dc198b2 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(_0x4e0a14,_0x29f620){var _0x5a9727=function(_0x5806fb){while(--_0x5806fb){_0x4e0a14['push'](_0x4e0a14['shift']());}};_0x5a9727(++_0x29f620);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x189950,_0x5593d7){var _0x265c73=function(_0x4b7f34){while(--_0x4b7f34){_0x189950['push'](_0x189950['shift']());}};_0x265c73(++_0x5593d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 319b847..6d9d0b2 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x31e198,_0x36f31c){var _0x143048=function(_0x28d282){while(--_0x28d282){_0x31e198['push'](_0x31e198['shift']());}};_0x143048(++_0x36f31c);}(_0xda2d,0x102));var _0xdda2=function(_0x4472ff,_0x6085e2){_0x4472ff=_0x4472ff-0x0;var _0x51ad64=_0xda2d[_0x4472ff];return _0x51ad64;};'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 b2df582..e3adb0d 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 _0x4692=['domain','domainport','registrationtime','defaultuser','exports','active','name','stateTime','status','unknown','registry','indexOf','host'];(function(_0xb80c4b,_0x57daa2){var _0x104b5a=function(_0xeb837a){while(--_0xeb837a){_0xb80c4b['push'](_0xb80c4b['shift']());}};_0x104b5a(++_0x57daa2);}(_0x4692,0xc8));var _0x2469=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4692[_0x3bf83f];return _0x22c4a9;};'use strict';function Trunk(_0x4c9878){this['id']=_0x4c9878['id']||0x0;this[_0x2469('0x0')]=_0x4c9878[_0x2469('0x0')]||![];this[_0x2469('0x1')]=_0x4c9878[_0x2469('0x1')]||'';this['state']='unknown';this[_0x2469('0x2')]=0x0;this[_0x2469('0x3')]=_0x2469('0x4');this['registry']=_0x4c9878[_0x2469('0x5')]&&_0x4c9878['registry'][_0x2469('0x6')](':')?_0x4c9878[_0x2469('0x5')]['split'](':')[0x0]:'';this[_0x2469('0x7')]='';this['port']='';this[_0x2469('0x8')]='';this[_0x2469('0x9')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0x2469('0xa')]='';this['address']='';this[_0x2469('0xb')]=_0x4c9878[_0x2469('0xb')]||'';}module[_0x2469('0xc')]=Trunk; \ No newline at end of file +var _0xffc2=['indexOf','split','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x4680cb,_0x9a6ba){var _0x2c862c=function(_0xc6b77b){while(--_0xc6b77b){_0x4680cb['push'](_0x4680cb['shift']());}};_0x2c862c(++_0x9a6ba);}(_0xffc2,0x16f));var _0x2ffc=function(_0x5d8076,_0x2b476a){_0x5d8076=_0x5d8076-0x0;var _0x26811a=_0xffc2[_0x5d8076];return _0x26811a;};'use strict';function Trunk(_0x301a6a){this['id']=_0x301a6a['id']||0x0;this[_0x2ffc('0x0')]=_0x301a6a[_0x2ffc('0x0')]||![];this['name']=_0x301a6a[_0x2ffc('0x1')]||'';this[_0x2ffc('0x2')]=_0x2ffc('0x3');this[_0x2ffc('0x4')]=0x0;this[_0x2ffc('0x5')]=_0x2ffc('0x3');this[_0x2ffc('0x6')]=_0x301a6a['registry']&&_0x301a6a[_0x2ffc('0x6')][_0x2ffc('0x7')](':')?_0x301a6a[_0x2ffc('0x6')][_0x2ffc('0x8')](':')[0x0]:'';this['host']='';this[_0x2ffc('0x9')]='';this[_0x2ffc('0xa')]='';this[_0x2ffc('0xb')]='';this[_0x2ffc('0xc')]='';this[_0x2ffc('0xd')]=_0x2ffc('0x3');this['registrationtime']='';this[_0x2ffc('0xe')]='';this[_0x2ffc('0xf')]=_0x301a6a[_0x2ffc('0xf')]||'';}module[_0x2ffc('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index b22bacd..4db2f3e 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 _0xc749=['exten','recordingFormat','mandatoryDisposition','exports'];(function(_0x236793,_0xd5f76c){var _0xca269a=function(_0x876e83){while(--_0x876e83){_0x236793['push'](_0x236793['shift']());}};_0xca269a(++_0xd5f76c);}(_0xc749,0xc0));var _0x9c74=function(_0x2973c1,_0x75a12a){_0x2973c1=_0x2973c1-0x0;var _0x1b36cb=_0xc749[_0x2973c1];return _0x1b36cb;};'use strict';function voiceExtension(_0x13d058){this['id']=_0x13d058['id']||0x0;this['exten']=_0x13d058[_0x9c74('0x0')]||'';this['recordingFormat']=_0x13d058[_0x9c74('0x1')]||'none';this[_0x9c74('0x2')]=_0x13d058[_0x9c74('0x2')]||![];}module[_0x9c74('0x3')]=voiceExtension; \ No newline at end of file +var _0xb5d5=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x174466,_0x58001e){var _0x12c8b2=function(_0x47d367){while(--_0x47d367){_0x174466['push'](_0x174466['shift']());}};_0x12c8b2(++_0x58001e);}(_0xb5d5,0x147));var _0x5b5d=function(_0x2bc03c,_0x75bd84){_0x2bc03c=_0x2bc03c-0x0;var _0x402636=_0xb5d5[_0x2bc03c];return _0x402636;};'use strict';function voiceExtension(_0x580a9e){this['id']=_0x580a9e['id']||0x0;this['exten']=_0x580a9e[_0x5b5d('0x0')]||'';this[_0x5b5d('0x1')]=_0x580a9e[_0x5b5d('0x1')]||_0x5b5d('0x2');this[_0x5b5d('0x3')]=_0x580a9e['mandatoryDisposition']||![];}module[_0x5b5d('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index be88873..3be7297 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 _0xbb36=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x45fe84,_0xa0c882){var _0x2e7fba=function(_0x2f1b29){while(--_0x2f1b29){_0x45fe84['push'](_0x45fe84['shift']());}};_0x2e7fba(++_0xa0c882);}(_0xbb36,0x19f));var _0x6bb3=function(_0x8cf7f8,_0x3aacc7){_0x8cf7f8=_0x8cf7f8-0x0;var _0x879304=_0xbb36[_0x8cf7f8];return _0x879304;};'use strict';var statusDesc=[_0x6bb3('0x0'),_0x6bb3('0x1'),'inuse','busy',_0x6bb3('0x2'),_0x6bb3('0x3'),_0x6bb3('0x4'),_0x6bb3('0x5'),'onhold'];var monitorFormat={'wav':_0x6bb3('0x6'),'wav49':_0x6bb3('0x7'),'gsm':_0x6bb3('0x8')};var strategy={'rrmemory':_0x6bb3('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x257c0f){this['id']=_0x257c0f['id']||0x0;this['name']=_0x257c0f[_0x6bb3('0xa')]||'';this[_0x6bb3('0xb')]=_0x257c0f[_0x6bb3('0xb')]||'';this['type']=_0x257c0f[_0x6bb3('0xc')]||_0x6bb3('0xd');this['waiting']=0x0;this[_0x6bb3('0xe')]=0x0;this[_0x6bb3('0xf')]=0x0;this[_0x6bb3('0x10')]=0x0;this[_0x6bb3('0x11')]=0x0;this[_0x6bb3('0x12')]=0x0;this[_0x6bb3('0x13')]=0x0;this[_0x6bb3('0x14')]=0x0;this[_0x6bb3('0x15')]=0x0;this[_0x6bb3('0x16')]=0x0;this[_0x6bb3('0x17')]=0x0;this[_0x6bb3('0x18')]=_0x257c0f[_0x6bb3('0x18')]||![];this[_0x6bb3('0x19')]=_0x257c0f['acwTimeout']||0xa;this[_0x6bb3('0x1a')]=_0x257c0f['autopause']||'no';this[_0x6bb3('0x1b')]=!![];this[_0x6bb3('0x1c')]='';this[_0x6bb3('0x1d')]=0x0;this['temp']=0x0;this[_0x6bb3('0x1e')]=_0x257c0f['dialTimezone']||null;this[_0x6bb3('0x1f')]=_0x257c0f[_0x6bb3('0x1f')]?_0x257c0f[_0x6bb3('0x1f')]:null;this[_0x6bb3('0x20')]=_0x257c0f[_0x6bb3('0x20')];this['dialMethod']=_0x257c0f[_0x6bb3('0x21')]||_0x6bb3('0x22');this[_0x6bb3('0x23')]=_0x257c0f[_0x6bb3('0x23')]||0x0;this[_0x6bb3('0x24')]=_0x257c0f[_0x6bb3('0x24')]||0x0;this[_0x6bb3('0x25')]=_0x257c0f[_0x6bb3('0x25')]||0x1;this[_0x6bb3('0x26')]=_0x257c0f['dialPredictiveOptimization']||_0x6bb3('0x27');this['dialPredictiveOptimizationPercentage']=_0x257c0f[_0x6bb3('0x28')]||0.03;this['dialPredictiveInterval']=_0x257c0f[_0x6bb3('0x29')]||0x258;this[_0x6bb3('0x2a')]=_0x257c0f[_0x6bb3('0x2a')]||'anonymous';this[_0x6bb3('0x2b')]=_0x257c0f[_0x6bb3('0x2b')]||'anonymous';this[_0x6bb3('0x2c')]=_0x257c0f[_0x6bb3('0x2c')]||0x1e;this[_0x6bb3('0x2d')]=_0x257c0f[_0x6bb3('0x2d')]||_0x6bb3('0x2e');this['dialQueueTimeout']=_0x257c0f[_0x6bb3('0x2f')]||0x3;this['dialQueueProject']=_0x257c0f[_0x6bb3('0x30')]||undefined;this[_0x6bb3('0x31')]=_0x257c0f[_0x6bb3('0x31')]||0x3;this[_0x6bb3('0x32')]=_0x257c0f['dialCongestionRetryFrequency']||0x96;this[_0x6bb3('0x33')]=_0x257c0f['dialBusyMaxRetry']||0x3;this[_0x6bb3('0x34')]=_0x257c0f['dialBusyRetryFrequency']||0x96;this[_0x6bb3('0x35')]=_0x257c0f[_0x6bb3('0x35')]||0x3;this[_0x6bb3('0x36')]=_0x257c0f['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x257c0f[_0x6bb3('0x37')]||0x3;this[_0x6bb3('0x38')]=_0x257c0f[_0x6bb3('0x38')]||0x96;this[_0x6bb3('0x39')]=_0x257c0f['dialDropMaxRetry']||0x3;this[_0x6bb3('0x3a')]=_0x257c0f[_0x6bb3('0x3a')]||0x96;this[_0x6bb3('0x3b')]=_0x257c0f['dialAbandonedMaxRetry']||0x3;this[_0x6bb3('0x3c')]=_0x257c0f[_0x6bb3('0x3c')]||0x96;this[_0x6bb3('0x3d')]=_0x257c0f[_0x6bb3('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x257c0f[_0x6bb3('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x257c0f[_0x6bb3('0x3f')]||0x3;this[_0x6bb3('0x40')]=_0x257c0f[_0x6bb3('0x40')]||0x96;this['callAdditionalPhoneAfterMin']=_0x257c0f[_0x6bb3('0x41')]||0x3;this[_0x6bb3('0x42')]=_0x257c0f[_0x6bb3('0x42')]||0x4;this[_0x6bb3('0x43')]=_0x257c0f[_0x6bb3('0x43')]?_0x257c0f[_0x6bb3('0x43')]:undefined;this['TrunkBackup']=_0x257c0f[_0x6bb3('0x44')]?_0x257c0f[_0x6bb3('0x44')]:undefined;this[_0x6bb3('0x45')]=_0x257c0f['dialPrefix']||undefined;this['Interval']=_0x257c0f[_0x6bb3('0x46')]?_0x257c0f[_0x6bb3('0x46')]:undefined;this[_0x6bb3('0x47')]=_0x257c0f[_0x6bb3('0x47')]||_0x6bb3('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x257c0f[_0x6bb3('0x49')]||undefined;this['dialCutDigit']=_0x257c0f[_0x6bb3('0x4a')]||undefined;this[_0x6bb3('0x4b')]=strategy[_0x257c0f[_0x6bb3('0x4b')]]||'rrmemory';this[_0x6bb3('0x4c')]=!![];this['dialAMDActive']=_0x257c0f[_0x6bb3('0x4d')]||![];this[_0x6bb3('0x4e')]=_0x257c0f[_0x6bb3('0x4e')];this['dialAMDGreeting']=_0x257c0f[_0x6bb3('0x4f')];this[_0x6bb3('0x50')]=_0x257c0f[_0x6bb3('0x50')];this[_0x6bb3('0x51')]=_0x257c0f[_0x6bb3('0x51')];this[_0x6bb3('0x52')]=_0x257c0f[_0x6bb3('0x52')];this[_0x6bb3('0x53')]=_0x257c0f[_0x6bb3('0x53')];this[_0x6bb3('0x54')]=_0x257c0f[_0x6bb3('0x54')];this[_0x6bb3('0x55')]=_0x257c0f[_0x6bb3('0x55')];this[_0x6bb3('0x56')]=_0x257c0f['dialAMDMaximumWordLength'];this[_0x6bb3('0x57')]=0x0;this[_0x6bb3('0x58')]=0x0;this['timeout']=_0x257c0f[_0x6bb3('0x59')];this[_0x6bb3('0x5a')]=0x0;this[_0x6bb3('0x5b')]=0x0;this[_0x6bb3('0x5c')]=0x0;this[_0x6bb3('0x5d')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6bb3('0x5e')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x6bb3('0x5f')]=0x0;this[_0x6bb3('0x60')]=0x0;this[_0x6bb3('0x61')]=0x0;this[_0x6bb3('0x62')]=0x0;this[_0x6bb3('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x6bb3('0x64')]=0x0;this[_0x6bb3('0x65')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x6bb3('0x66')]=1.05;this[_0x6bb3('0x67')]=0x0;this[_0x6bb3('0x68')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x6bb3('0x69')]=0x0;this[_0x6bb3('0x6a')]=0x0;this[_0x6bb3('0x6b')]=0x0;this[_0x6bb3('0x6c')]=0x0;this[_0x6bb3('0x6d')]=0x0;this['predictiveIntervalMaxThreshold']=_0x257c0f[_0x6bb3('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x257c0f[_0x6bb3('0x6e')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x6bb3('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6bb3('0x70')]=0x0;this[_0x6bb3('0x71')]=0x0;this[_0x6bb3('0x72')]=0x0;this[_0x6bb3('0x73')]=0x0;this[_0x6bb3('0x74')]=_0x257c0f['dialRecallMeTimeout']||0x1e;this[_0x6bb3('0x75')]=_0x257c0f['dialRecallInQueue']||![];this[_0x6bb3('0x76')]=!!_0x257c0f[_0x6bb3('0x76')]||![];this[_0x6bb3('0x77')]=!!_0x257c0f[_0x6bb3('0x77')]||![];this['dialQueueProject2']=_0x257c0f[_0x6bb3('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x257c0f[_0x6bb3('0x79')]||![];this[_0x6bb3('0x7a')]=_0x257c0f[_0x6bb3('0x7a')]||![];this['monitor_format']=monitorFormat[_0x257c0f['monitor_format']]?monitorFormat[_0x257c0f[_0x6bb3('0xb')]]:undefined;this[_0x6bb3('0x7b')]=_0x257c0f[_0x6bb3('0x7b')]||![];this[_0x6bb3('0x7c')]=_0x257c0f['mandatoryDispositionPause']?_0x257c0f['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x4a68=['inbound','talking','total','answered','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','roundrobin','name','monitor_format','type'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4a68,0x6f));var _0x84a6=function(_0x573de3,_0x2a9f6e){_0x573de3=_0x573de3-0x0;var _0x371681=_0x4a68[_0x573de3];return _0x371681;};'use strict';var statusDesc=[_0x84a6('0x0'),_0x84a6('0x1'),_0x84a6('0x2'),_0x84a6('0x3'),_0x84a6('0x4'),'unavailable',_0x84a6('0x5'),_0x84a6('0x6'),_0x84a6('0x7')];var monitorFormat={'wav':_0x84a6('0x8'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x84a6('0x9')};function VoiceQueue(_0x446f6c){this['id']=_0x446f6c['id']||0x0;this[_0x84a6('0xa')]=_0x446f6c['name']||'';this['monitor_format']=_0x446f6c[_0x84a6('0xb')]||'';this['type']=_0x446f6c[_0x84a6('0xc')]||_0x84a6('0xd');this['waiting']=0x0;this[_0x84a6('0xe')]=0x0;this[_0x84a6('0xf')]=0x0;this[_0x84a6('0x10')]=0x0;this['sumDuration']=0x0;this[_0x84a6('0x11')]=0x0;this[_0x84a6('0x12')]=0x0;this['unmanaged']=0x0;this[_0x84a6('0x13')]=0x0;this[_0x84a6('0x14')]=0x0;this[_0x84a6('0x15')]=0x0;this[_0x84a6('0x16')]=_0x446f6c['acw']||![];this[_0x84a6('0x17')]=_0x446f6c[_0x84a6('0x17')]||0xa;this['autopause']=_0x446f6c[_0x84a6('0x18')]||'no';this[_0x84a6('0x19')]=!![];this['message']='';this[_0x84a6('0x1a')]=0x0;this[_0x84a6('0x1b')]=0x0;this[_0x84a6('0x1c')]=_0x446f6c[_0x84a6('0x1c')]||null;this[_0x84a6('0x1d')]=_0x446f6c[_0x84a6('0x1d')]?_0x446f6c[_0x84a6('0x1d')]:null;this['dialActive']=_0x446f6c['dialActive'];this[_0x84a6('0x1e')]=_0x446f6c[_0x84a6('0x1e')]||'progressive';this[_0x84a6('0x1f')]=_0x446f6c[_0x84a6('0x1f')]||0x0;this[_0x84a6('0x20')]=_0x446f6c[_0x84a6('0x20')]||0x0;this[_0x84a6('0x21')]=_0x446f6c[_0x84a6('0x21')]||0x1;this[_0x84a6('0x22')]=_0x446f6c[_0x84a6('0x22')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x446f6c[_0x84a6('0x23')]||0.03;this[_0x84a6('0x24')]=_0x446f6c[_0x84a6('0x24')]||0x258;this[_0x84a6('0x25')]=_0x446f6c[_0x84a6('0x25')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x446f6c[_0x84a6('0x26')]||_0x84a6('0x27');this[_0x84a6('0x28')]=_0x446f6c[_0x84a6('0x28')]||0x1e;this[_0x84a6('0x29')]=_0x446f6c[_0x84a6('0x29')]||_0x84a6('0x2a');this[_0x84a6('0x2b')]=_0x446f6c[_0x84a6('0x2b')]||0x3;this[_0x84a6('0x2c')]=_0x446f6c['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x446f6c['dialCongestionMaxRetry']||0x3;this[_0x84a6('0x2d')]=_0x446f6c[_0x84a6('0x2d')]||0x96;this['dialBusyMaxRetry']=_0x446f6c[_0x84a6('0x2e')]||0x3;this['dialBusyRetryFrequency']=_0x446f6c[_0x84a6('0x2f')]||0x96;this[_0x84a6('0x30')]=_0x446f6c[_0x84a6('0x30')]||0x3;this['dialNoAnswerRetryFrequency']=_0x446f6c[_0x84a6('0x31')]||0x96;this[_0x84a6('0x32')]=_0x446f6c['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x446f6c['dialNoSuchNumberRetryFrequency']||0x96;this[_0x84a6('0x33')]=_0x446f6c[_0x84a6('0x33')]||0x3;this[_0x84a6('0x34')]=_0x446f6c[_0x84a6('0x34')]||0x96;this['dialAbandonedMaxRetry']=_0x446f6c[_0x84a6('0x35')]||0x3;this[_0x84a6('0x36')]=_0x446f6c[_0x84a6('0x36')]||0x96;this['dialMachineMaxRetry']=_0x446f6c[_0x84a6('0x37')]||0x3;this[_0x84a6('0x38')]=_0x446f6c[_0x84a6('0x38')]||0x96;this['dialAgentRejectMaxRetry']=_0x446f6c[_0x84a6('0x39')]||0x3;this[_0x84a6('0x3a')]=_0x446f6c[_0x84a6('0x3a')]||0x96;this['callAdditionalPhoneAfterMin']=_0x446f6c[_0x84a6('0x3b')]||0x3;this[_0x84a6('0x3c')]=_0x446f6c[_0x84a6('0x3c')]||0x4;this[_0x84a6('0x3d')]=_0x446f6c[_0x84a6('0x3d')]?_0x446f6c[_0x84a6('0x3d')]:undefined;this[_0x84a6('0x3e')]=_0x446f6c['TrunkBackup']?_0x446f6c['TrunkBackup']:undefined;this[_0x84a6('0x3f')]=_0x446f6c[_0x84a6('0x3f')]||undefined;this[_0x84a6('0x40')]=_0x446f6c[_0x84a6('0x40')]?_0x446f6c[_0x84a6('0x40')]:undefined;this[_0x84a6('0x41')]=_0x446f6c[_0x84a6('0x41')]||_0x84a6('0x42');this[_0x84a6('0x43')]=_0x446f6c[_0x84a6('0x43')]||undefined;this['dialCutDigit']=_0x446f6c[_0x84a6('0x44')]||undefined;this['strategy']=strategy[_0x446f6c[_0x84a6('0x45')]]||_0x84a6('0x46');this[_0x84a6('0x47')]=!![];this[_0x84a6('0x48')]=_0x446f6c['dialAMDActive']||![];this[_0x84a6('0x49')]=_0x446f6c[_0x84a6('0x49')];this['dialAMDGreeting']=_0x446f6c[_0x84a6('0x4a')];this[_0x84a6('0x4b')]=_0x446f6c[_0x84a6('0x4b')];this[_0x84a6('0x4c')]=_0x446f6c[_0x84a6('0x4c')];this[_0x84a6('0x4d')]=_0x446f6c[_0x84a6('0x4d')];this[_0x84a6('0x4e')]=_0x446f6c[_0x84a6('0x4e')];this[_0x84a6('0x4f')]=_0x446f6c[_0x84a6('0x4f')];this['dialAMDSilenceThreshold']=_0x446f6c[_0x84a6('0x50')];this[_0x84a6('0x51')]=_0x446f6c[_0x84a6('0x51')];this[_0x84a6('0x52')]=0x0;this[_0x84a6('0x53')]=0x0;this['timeout']=_0x446f6c['timeout'];this[_0x84a6('0x54')]=0x0;this[_0x84a6('0x55')]=0x0;this[_0x84a6('0x56')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x84a6('0x57')]=0x0;this[_0x84a6('0x58')]=0x0;this[_0x84a6('0x59')]=0x0;this[_0x84a6('0x5a')]=0x0;this[_0x84a6('0x5b')]=0x0;this[_0x84a6('0x5c')]=0x0;this[_0x84a6('0x5d')]=0x0;this[_0x84a6('0x5e')]=0x0;this[_0x84a6('0x5f')]=0x0;this[_0x84a6('0x60')]=undefined;this['startPredictive']=undefined;this[_0x84a6('0x61')]=undefined;this[_0x84a6('0x62')]=1.05;this[_0x84a6('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0x84a6('0x64')]=0x0;this[_0x84a6('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x84a6('0x66')]=0x0;this[_0x84a6('0x67')]=0x0;this[_0x84a6('0x68')]=0x0;this[_0x84a6('0x69')]=_0x446f6c[_0x84a6('0x6a')]||0x14;this[_0x84a6('0x6b')]=_0x446f6c[_0x84a6('0x6a')]||0xa;this[_0x84a6('0x6c')]=0x0;this[_0x84a6('0x6d')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x84a6('0x6e')]=0x0;this[_0x84a6('0x6f')]=0x0;this[_0x84a6('0x70')]=0x0;this[_0x84a6('0x71')]=0x0;this[_0x84a6('0x72')]=_0x446f6c[_0x84a6('0x72')]||0x1e;this[_0x84a6('0x73')]=_0x446f6c[_0x84a6('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x446f6c[_0x84a6('0x74')]||![];this[_0x84a6('0x75')]=!!_0x446f6c['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x446f6c[_0x84a6('0x76')]||undefined;this[_0x84a6('0x77')]=_0x446f6c[_0x84a6('0x77')]||![];this[_0x84a6('0x78')]=_0x446f6c['dialAgiAfterHangupAgent']||![];this[_0x84a6('0xb')]=monitorFormat[_0x446f6c[_0x84a6('0xb')]]?monitorFormat[_0x446f6c[_0x84a6('0xb')]]:undefined;this[_0x84a6('0x79')]=_0x446f6c[_0x84a6('0x79')]||![];this[_0x84a6('0x7a')]=_0x446f6c['mandatoryDispositionPause']?_0x446f6c[_0x84a6('0x7a')]:undefined;}module[_0x84a6('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index e59ef83..5f56376 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 _0x1490=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3eca61,_0x19d315){var _0x2cc959=function(_0x26cc81){while(--_0x26cc81){_0x3eca61['push'](_0x3eca61['shift']());}};_0x2cc959(++_0x19d315);}(_0x1490,0x1ad));var _0x0149=function(_0x19c950,_0x140706){_0x19c950=_0x19c950-0x0;var _0x142ce3=_0x1490[_0x19c950];return _0x142ce3;};'use strict';function VtigerAccount(_0x6a0705){this['id']=_0x6a0705['id']||0x0;this[_0x0149('0x0')]=_0x6a0705[_0x0149('0x0')]||'';this['username']=_0x6a0705[_0x0149('0x1')]||'';this['accessKey']=_0x6a0705[_0x0149('0x2')]||'';this['remoteUri']=_0x6a0705[_0x0149('0x3')]||'';this[_0x0149('0x4')]=_0x6a0705['serverUrl']||'';this[_0x0149('0x5')]=_0x6a0705[_0x0149('0x5')]||{};}module[_0x0149('0x6')]=VtigerAccount; \ No newline at end of file +var _0x1ed4=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed4,0x1d6));var _0x41ed=function(_0x488a24,_0x5c9481){_0x488a24=_0x488a24-0x0;var _0x599ff0=_0x1ed4[_0x488a24];return _0x599ff0;};'use strict';function VtigerAccount(_0x1adc6c){this['id']=_0x1adc6c['id']||0x0;this[_0x41ed('0x0')]=_0x1adc6c['name']||'';this['username']=_0x1adc6c[_0x41ed('0x1')]||'';this[_0x41ed('0x2')]=_0x1adc6c['accessKey']||'';this[_0x41ed('0x3')]=_0x1adc6c[_0x41ed('0x3')]||'';this[_0x41ed('0x4')]=_0x1adc6c[_0x41ed('0x4')]||'';this[_0x41ed('0x5')]=_0x1adc6c[_0x41ed('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 964bae5..e6eceb7 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 _0x277b=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x5dbb33,_0x558a70){var _0x4e6b4d=function(_0xc2fbaa){while(--_0xc2fbaa){_0x5dbb33['push'](_0x5dbb33['shift']());}};_0x4e6b4d(++_0x558a70);}(_0x277b,0xac));var _0xb277=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x277b[_0x4ff09b];return _0x3f5c2e;};'use strict';function ZendeskAccount(_0x32157b){this['id']=_0x32157b['id']||0x0;this[_0xb277('0x0')]=_0x32157b[_0xb277('0x0')]||'';this[_0xb277('0x1')]=_0x32157b[_0xb277('0x1')]||'';this[_0xb277('0x2')]=_0x32157b[_0xb277('0x2')]||'';this[_0xb277('0x3')]=_0x32157b[_0xb277('0x3')]||'';this[_0xb277('0x4')]=_0x32157b['remoteUri']||'';this[_0xb277('0x5')]=_0x32157b[_0xb277('0x5')]||'';this[_0xb277('0x6')]=_0x32157b[_0xb277('0x6')]||_0xb277('0x7');this[_0xb277('0x8')]=_0x32157b['serverUrl']||'';this[_0xb277('0x9')]=_0x32157b[_0xb277('0x9')]||{};}module[_0xb277('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xd32d=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xd32d,0xda));var _0xdd32=function(_0x1acafa,_0x2bed1c){_0x1acafa=_0x1acafa-0x0;var _0x3119d9=_0xd32d[_0x1acafa];return _0x3119d9;};'use strict';function ZendeskAccount(_0x49f333){this['id']=_0x49f333['id']||0x0;this[_0xdd32('0x0')]=_0x49f333[_0xdd32('0x0')]||'';this[_0xdd32('0x1')]=_0x49f333[_0xdd32('0x1')]||'';this['password']=_0x49f333[_0xdd32('0x2')]||'';this[_0xdd32('0x3')]=_0x49f333[_0xdd32('0x3')]||'';this[_0xdd32('0x4')]=_0x49f333['remoteUri']||'';this[_0xdd32('0x5')]=_0x49f333['authType']||'';this[_0xdd32('0x6')]=_0x49f333[_0xdd32('0x6')]||_0xdd32('0x7');this[_0xdd32('0x8')]=_0x49f333['serverUrl']||'';this['Configurations']=_0x49f333[_0xdd32('0x9')]||{};}module[_0xdd32('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index cf74c10..3f41574 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 _0x7a6e=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host'];(function(_0x3a2147,_0x536e69){var _0x158499=function(_0x2244e4){while(--_0x2244e4){_0x3a2147['push'](_0x3a2147['shift']());}};_0x158499(++_0x536e69);}(_0x7a6e,0x197));var _0xe7a6=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0x7a6e[_0x20a005];return _0x318723;};'use strict';function ZohoAccount(_0x40c160){this['id']=_0x40c160['id']||0x0;this[_0xe7a6('0x0')]=_0x40c160[_0xe7a6('0x0')]||'';this[_0xe7a6('0x1')]=_0x40c160[_0xe7a6('0x1')]||'';this['host']=_0x40c160[_0xe7a6('0x2')]||'';this[_0xe7a6('0x3')]=_0x40c160[_0xe7a6('0x3')]||'';this[_0xe7a6('0x4')]=_0x40c160[_0xe7a6('0x4')]||'';this[_0xe7a6('0x5')]=_0x40c160[_0xe7a6('0x5')]||'';this['serverUrl']=_0x40c160[_0xe7a6('0x6')]||'';this[_0xe7a6('0x7')]=_0x40c160[_0xe7a6('0x7')]||'';this[_0xe7a6('0x8')]=_0x40c160['refreshToken']||'';this['Configurations']=_0x40c160[_0xe7a6('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x2941=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x295287,_0x2fa9e5){var _0x40860e=function(_0x57f211){while(--_0x57f211){_0x295287['push'](_0x295287['shift']());}};_0x40860e(++_0x2fa9e5);}(_0x2941,0x140));var _0x1294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2941[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x536124){this['id']=_0x536124['id']||0x0;this['name']=_0x536124[_0x1294('0x0')]||'';this[_0x1294('0x1')]=_0x536124[_0x1294('0x1')]||'';this[_0x1294('0x2')]=_0x536124[_0x1294('0x2')]||'';this[_0x1294('0x3')]=_0x536124[_0x1294('0x3')]||'';this[_0x1294('0x4')]=_0x536124[_0x1294('0x4')]||'';this[_0x1294('0x5')]=_0x536124['clientSecret']||'';this[_0x1294('0x6')]=_0x536124[_0x1294('0x6')]||'';this[_0x1294('0x7')]=_0x536124[_0x1294('0x7')]||'';this[_0x1294('0x8')]=_0x536124[_0x1294('0x8')]||'';this[_0x1294('0x9')]=_0x536124[_0x1294('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index f01686c..d0ae9fb 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 _0x1775=['countdropretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry'];(function(_0x392b94,_0x17649e){var _0x1bf3dc=function(_0x2d850f){while(--_0x2d850f){_0x392b94['push'](_0x392b94['shift']());}};_0x1bf3dc(++_0x17649e);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var util=require('util');var _=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));function checkNameSurname(_0x6abfb8,_0x2ca33b,_0xaad33e){var _0x38ee08='';if(!_[_0x5177('0x2')](_0x2ca33b)&&_0x5177('0x3')===typeof _0x2ca33b){_0x38ee08+=_0x2ca33b;}if(!_[_0x5177('0x2')](_0xaad33e)&&_0x5177('0x3')===typeof _0xaad33e){_0x38ee08+='\x20'+_0xaad33e;}if(_0x38ee08!==''){return _0x38ee08;}return _0x6abfb8;}function Action(_0x159a20,_0x2c5c42,_0x153c1a,_0x2ac1c6,_0x300b43){this[_0x5177('0x4')]=_0x153c1a||undefined;this[_0x5177('0x5')]=_0x159a20['id'];this[_0x5177('0x6')]=_0x2c5c42[_0x5177('0x7')];this[_0x5177('0x8')]=_0x2c5c42[_0x5177('0x8')];this[_0x5177('0x9')]='queue';this['dialAnswer']=![];this[_0x5177('0xa')]=_[_0x5177('0x2')](_0x159a20[_0x5177('0xb')])?undefined:_0x159a20[_0x5177('0xb')][_0x5177('0x7')];this['channelAgent']=this[_0x5177('0xa')]?util[_0x5177('0xc')](_0x5177('0xd'),this[_0x5177('0xa')]):_0x2ac1c6||undefined;this[_0x5177('0xe')]=checkNameSurname(_0x159a20[_0x5177('0xf')][_0x5177('0x10')],_0x159a20[_0x5177('0xf')][_0x5177('0x11')],_0x159a20[_0x5177('0xf')][_0x5177('0x12')]);this[_0x5177('0x13')]=_0x159a20[_0x5177('0x13')]||![];this[_0x5177('0x14')]=_0x159a20[_0x5177('0x10')];this[_0x5177('0x15')]=_0x159a20[_0x5177('0x15')];this[_0x5177('0x16')]=_0x159a20[_0x5177('0x16')]||0x0;this['countcongestionretry']=_0x159a20[_0x5177('0x17')]||0x0;this[_0x5177('0x18')]=_0x159a20[_0x5177('0x18')]||0x0;this[_0x5177('0x19')]=(_0x159a20['countbusyretry']||0x0)+(_0x159a20[_0x5177('0x17')]||0x0)+(_0x159a20[_0x5177('0x18')]||0x0)+(_0x159a20[_0x5177('0x1a')]||0x0)+(_0x159a20['countdropretry']||0x0)+(_0x159a20[_0x5177('0x1b')]||0x0)+(_0x159a20['countmachineretry']||0x0)+(_0x159a20[_0x5177('0x1c')]||0x0);this[_0x5177('0x1a')]=_0x159a20[_0x5177('0x1a')]||0x0;this[_0x5177('0x1d')]=_0x159a20[_0x5177('0x1d')]||0x0;this[_0x5177('0x1b')]=_0x159a20[_0x5177('0x1b')]||0x0;this[_0x5177('0x1e')]=_0x159a20[_0x5177('0x1e')]||0x0;this[_0x5177('0x1c')]=_0x159a20[_0x5177('0x1c')]||0x0;this[_0x5177('0x1f')]=_0x159a20['callback'];this[_0x5177('0x20')]=_0x159a20['callbackuniqueid'];this[_0x5177('0x21')]=_0x159a20[_0x5177('0x21')];this[_0x5177('0x22')]=_0x159a20[_0x5177('0x22')];this['ContactId']=_0x159a20[_0x5177('0x23')];this['ListId']=_0x159a20['ListId'];this[_0x5177('0x24')]=_[_0x5177('0x2')](_0x159a20['Agent'])?_0x159a20[_0x5177('0x24')]:_0x159a20['Agent']['id'];this[_0x5177('0x25')]=_0x159a20[_0x5177('0x25')];this['originatecalleridnum']='';this[_0x5177('0x26')]='';}Action[_0x5177('0x27')][_0x5177('0x28')]=function(){return util[_0x5177('0xc')](_0x5177('0x29'),this[_0x5177('0xe')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0xfff0=['recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','queue','type','dialAnswer','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat'];(function(_0x705b98,_0x1c345b){var _0x47b72f=function(_0x44f02a){while(--_0x44f02a){_0x705b98['push'](_0x705b98['shift']());}};_0x47b72f(++_0x1c345b);}(_0xfff0,0x139));var _0x0fff=function(_0x3de1cb,_0x92d2ba){_0x3de1cb=_0x3de1cb-0x0;var _0x4d14a9=_0xfff0[_0x3de1cb];return _0x4d14a9;};'use strict';var util=require('util');var _=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));function checkNameSurname(_0x148db8,_0x527213,_0x37165b){var _0x1f4065='';if(!_[_0x0fff('0x2')](_0x527213)&&'string'===typeof _0x527213){_0x1f4065+=_0x527213;}if(!_[_0x0fff('0x2')](_0x37165b)&&_0x0fff('0x3')===typeof _0x37165b){_0x1f4065+='\x20'+_0x37165b;}if(_0x1f4065!==''){return _0x1f4065;}return _0x148db8;}function Action(_0x53c517,_0x33c813,_0x4c2221,_0x2f1d2b,_0x586dc5){this[_0x0fff('0x4')]=_0x4c2221||undefined;this['idContact']=_0x53c517['id'];this[_0x0fff('0x5')]=_0x33c813['name'];this[_0x0fff('0x6')]=_0x33c813[_0x0fff('0x6')];this['campaigntype']=_0x0fff('0x5');this[_0x0fff('0x7')]=![];this[_0x0fff('0x8')]=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?undefined:_0x53c517[_0x0fff('0x9')][_0x0fff('0xa')];this[_0x0fff('0xb')]=this[_0x0fff('0x8')]?util[_0x0fff('0xc')](_0x0fff('0xd'),this['membername']):_0x2f1d2b||undefined;this[_0x0fff('0xe')]=checkNameSurname(_0x53c517['Contact'][_0x0fff('0xf')],_0x53c517[_0x0fff('0x10')][_0x0fff('0x11')],_0x53c517[_0x0fff('0x10')]['lastName']);this['active']=_0x53c517[_0x0fff('0x12')]||![];this['calleridnum']=_0x53c517['phone'];this['scheduledat']=_0x53c517[_0x0fff('0x13')];this[_0x0fff('0x14')]=_0x53c517['countbusyretry']||0x0;this[_0x0fff('0x15')]=_0x53c517[_0x0fff('0x15')]||0x0;this['countnoanswerretry']=_0x53c517['countnoanswerretry']||0x0;this['countglobal']=(_0x53c517[_0x0fff('0x14')]||0x0)+(_0x53c517[_0x0fff('0x15')]||0x0)+(_0x53c517[_0x0fff('0x16')]||0x0)+(_0x53c517[_0x0fff('0x17')]||0x0)+(_0x53c517[_0x0fff('0x18')]||0x0)+(_0x53c517[_0x0fff('0x19')]||0x0)+(_0x53c517['countmachineretry']||0x0)+(_0x53c517[_0x0fff('0x1a')]||0x0);this[_0x0fff('0x17')]=_0x53c517[_0x0fff('0x17')]||0x0;this['countdropretry']=_0x53c517['countdropretry']||0x0;this[_0x0fff('0x19')]=_0x53c517[_0x0fff('0x19')]||0x0;this[_0x0fff('0x1b')]=_0x53c517[_0x0fff('0x1b')]||0x0;this['countagentrejectretry']=_0x53c517[_0x0fff('0x1a')]||0x0;this[_0x0fff('0x1c')]=_0x53c517[_0x0fff('0x1c')];this[_0x0fff('0x1d')]=_0x53c517[_0x0fff('0x1d')];this[_0x0fff('0x1e')]=_0x53c517['callbackat'];this[_0x0fff('0x1f')]=_0x53c517[_0x0fff('0x1f')];this[_0x0fff('0x20')]=_0x53c517[_0x0fff('0x20')];this[_0x0fff('0x21')]=_0x53c517[_0x0fff('0x21')];this['UserId']=_[_0x0fff('0x2')](_0x53c517[_0x0fff('0x9')])?_0x53c517[_0x0fff('0x22')]:_0x53c517[_0x0fff('0x9')]['id'];this[_0x0fff('0x23')]=_0x53c517[_0x0fff('0x23')];this[_0x0fff('0x24')]='';this[_0x0fff('0x25')]='';}Action[_0x0fff('0x26')][_0x0fff('0x27')]=function(){return util[_0x0fff('0xc')](_0x0fff('0x28'),this['calleridname'],this[_0x0fff('0x29')]);};module[_0x0fff('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4ee6996..ace4f4a 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 _0x2ad9=['[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','isTrunkReachable','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destlinkedid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','available','loggedIn','sumBillable','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCallToSecond','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','emit','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','message','DEACTIVATED','\x20is\x20deactivated','prototype','syncCampaigns','booked','outbound','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','[RecallMe]','logger2','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','talktime','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','activeContact','idContact','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt'];(function(_0x38381f,_0x4eff8a){var _0x1c1631=function(_0x36eccd){while(--_0x36eccd){_0x38381f['push'](_0x38381f['shift']());}};_0x1c1631(++_0x4eff8a);}(_0x2ad9,0x1cd));var _0x92ad=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2ad9[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x92ad('0x0'));var _=require(_0x92ad('0x1'));var uuid=require(_0x92ad('0x2'));var moment=require(_0x92ad('0x3'));var md5=require(_0x92ad('0x4'));var Redis=require(_0x92ad('0x5'));var config=require('../../../config/environment');var logger=require(_0x92ad('0x6'))(_0x92ad('0x7'));var loggerAction=require(_0x92ad('0x6'))(_0x92ad('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x92ad('0x9'));var Action=require(_0x92ad('0xa'));var ut=require('./util/util');config[_0x92ad('0xb')]=_[_0x92ad('0xc')](config[_0x92ad('0xb')],{'host':_0x92ad('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x92ad('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x92ad('0xe')]=function(_0x48a773){this[_0x92ad('0xf')]=this[_0x92ad('0xf')]?this[_0x92ad('0xf')][_0x92ad('0x10')](_0x48a773):_0x48a773();};function Preview(_0x2d7dae){this[_0x92ad('0x11')]=new Sequence();this[_0x92ad('0x12')]=_0x2d7dae[_0x92ad('0x13')];this[_0x92ad('0x14')]=_0x2d7dae['trunks'];this[_0x92ad('0x15')]={};this[_0x92ad('0x16')]=_0x2d7dae[_0x92ad('0x16')];this[_0x92ad('0x17')]=0x0;ami['on']('originateresponse',this[_0x92ad('0x18')][_0x92ad('0x19')](this));ami['on'](_0x92ad('0x1a'),this[_0x92ad('0x1b')][_0x92ad('0x19')](this));ami['on']('hanguprequest',this[_0x92ad('0x1c')]['bind'](this));ami['on'](_0x92ad('0x1d'),this[_0x92ad('0x1e')][_0x92ad('0x19')](this));ami['on'](_0x92ad('0x1f'),this[_0x92ad('0x20')]['bind'](this));ami['on'](_0x92ad('0x21'),this['syncVarSet'][_0x92ad('0x19')](this));ami['on']('attendedtransfer',this[_0x92ad('0x22')][_0x92ad('0x19')](this));ami['on']('blindtransfer',this[_0x92ad('0x23')][_0x92ad('0x19')](this));this[_0x92ad('0x24')](this['campaignsPreview']);}function emit(_0x11fc5a,_0x265414,_0x29927b){io['to'](_0x11fc5a)['emit'](_0x265414,_0x29927b);}function emitCampaignPreview(_0x2f9366){if(_0x2f9366[_0x92ad('0x25')]==='outbound'){var _0x4aad28={'id':_0x2f9366['id'],'name':_0x2f9366[_0x92ad('0x26')],'strategy':_0x2f9366[_0x92ad('0x27')],'answered':_0x2f9366['answered'],'available':_0x2f9366[_0x92ad('0x28')],'loggedIn':_0x2f9366[_0x92ad('0x29')],'pTalking':_0x2f9366['pTalking'],'sumBillable':_0x2f9366[_0x92ad('0x2a')],'sumDuration':_0x2f9366['sumDuration'],'sumHoldTime':_0x2f9366['sumHoldTime']||0x0,'talking':_0x2f9366[_0x92ad('0x2b')],'total':_0x2f9366['total'],'type':_0x2f9366[_0x92ad('0x25')],'unmanaged':_0x2f9366[_0x92ad('0x2c')],'abandoned':_0x2f9366[_0x92ad('0x2d')],'waiting':_0x2f9366[_0x92ad('0x2e')],'loggedInDb':_0x2f9366[_0x92ad('0x2f')],'dialActive':_0x2f9366[_0x92ad('0x30')],'dialMethod':_0x2f9366[_0x92ad('0x31')],'dialOriginateCallerIdName':_0x2f9366[_0x92ad('0x32')],'dialOriginateCallerIdNumber':_0x2f9366[_0x92ad('0x33')],'dialOriginateTimeout':_0x2f9366['dialOriginateTimeout'],'dialPrefix':_0x2f9366['dialPrefix'],'outboundAnswerAgiCallsDay':_0x2f9366[_0x92ad('0x34')],'outboundAnswerCallsDay':_0x2f9366[_0x92ad('0x35')],'outboundBlacklistCallsDay':_0x2f9366[_0x92ad('0x36')],'outboundBusyCallsDay':_0x2f9366['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x2f9366[_0x92ad('0x37')],'outboundDropCallsDayACS':_0x2f9366['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x2f9366[_0x92ad('0x38')],'outboundDropCallsDayTimeout':_0x2f9366[_0x92ad('0x39')],'outboundNoAnswerCallsDay':_0x2f9366[_0x92ad('0x3a')],'outboundNoSuchCallsDay':_0x2f9366[_0x92ad('0x3b')],'outboundOriginateFailureCallsDay':_0x2f9366['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x2f9366[_0x92ad('0x3c')],'outboundRejectCallsDay':_0x2f9366['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x2f9366[_0x92ad('0x3d')],'outboundAbandonedCallsDay':_0x2f9366[_0x92ad('0x3e')],'predictiveIntervalAnsweredCalls':_0x2f9366[_0x92ad('0x3f')],'predictiveIntervalAvgHoldtime':_0x2f9366[_0x92ad('0x40')],'predictiveIntervalAvgTalktime':_0x2f9366[_0x92ad('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x2f9366[_0x92ad('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x2f9366[_0x92ad('0x43')],'predictiveIntervalErlangCalls':_0x2f9366[_0x92ad('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0x2f9366[_0x92ad('0x45')],'predictiveIntervalHitRate':_0x2f9366['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x2f9366[_0x92ad('0x46')],'predictiveIntervalPauses':_0x2f9366[_0x92ad('0x47')],'predictiveIntervalAvailable':_0x2f9366[_0x92ad('0x48')],'predictiveIntervalTotalCalls':_0x2f9366['predictiveIntervalTotalCalls'],'message':_0x2f9366['message'],'originated':_0x2f9366[_0x92ad('0x49')],'erlangCalls':_0x2f9366['erlangCalls'],'erlangCallToSecond':_0x2f9366[_0x92ad('0x4a')],'erlangAbandonmentRate':_0x2f9366['erlangAbandonmentRate'],'erlangBusyFactor':_0x2f9366['erlangBusyFactor'],'startPredictive':_0x2f9366[_0x92ad('0x4b')],'startProgressive':_0x2f9366[_0x92ad('0x4c')]};if(_0x2f9366['Trunk']){_0x4aad28[_0x92ad('0x4d')]={'id':_0x2f9366[_0x92ad('0x4d')]['id'],'name':_0x2f9366[_0x92ad('0x4d')]['name'],'active':_0x2f9366['Trunk'][_0x92ad('0x4e')],'callerid':_0x2f9366[_0x92ad('0x4d')][_0x92ad('0x4f')]};}if(_0x2f9366[_0x92ad('0x50')]){_0x4aad28['Interval']={'id':_0x2f9366[_0x92ad('0x50')]['id'],'name':_0x2f9366[_0x92ad('0x50')][_0x92ad('0x26')]};}var _0x2d510f=md5(JSON[_0x92ad('0x51')](_0x4aad28));if(_0x2f9366['md5']!==_0x2d510f){_0x2f9366[_0x92ad('0x4')]=_0x2d510f;emit(util[_0x92ad('0x52')](_0x92ad('0x53'),_0x4aad28['name']),_0x92ad('0x54'),_0x4aad28);}}}function emitVoiceQueueChannelRemove(_0x4e6140){logger[_0x92ad('0x55')](_0x92ad('0x56'),JSON['stringify'](_0x4e6140));emit(util['format'](_0x92ad('0x53'),_0x4e6140[_0x92ad('0x26')]),'voice_queue_channel:remove',_0x4e6140);io[_0x92ad('0x57')](_0x92ad('0x58'),_0x4e6140);}function notSendMessagesQueue(_0x3736fa){if(_0x3736fa[_0x92ad('0x59')]){if(_0x3736fa[_0x92ad('0x49')]===0x0&&_0x3736fa[_0x92ad('0x5a')]===0x0){_0x3736fa[_0x92ad('0x59')]=![];_0x3736fa[_0x92ad('0x28')]=0x0;_0x3736fa[_0x92ad('0x5b')]=0x0;_0x3736fa['message']=_0x92ad('0x5c');ut[_0x92ad('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3736fa[_0x92ad('0x26')]+'\x20is\x20not\x20active');}else{_0x3736fa[_0x92ad('0x5e')]=_0x92ad('0x5f');ut[_0x92ad('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3736fa[_0x92ad('0x26')]+_0x92ad('0x60'));}emitCampaignPreview(_0x3736fa);}}Preview[_0x92ad('0x61')]['loopCampaigns']=function(){var _0x395a29=this;setInterval(function(){_0x395a29[_0x92ad('0x62')]();},0x7cf);};Preview[_0x92ad('0x61')][_0x92ad('0x62')]=function(){var _0x485ec0=this['campaignsPreview'];this[_0x92ad('0x17')]+=0x1;for(var _0x4c390a in _0x485ec0){if(_0x485ec0['hasOwnProperty'](_0x4c390a)&&(_0x485ec0[_0x4c390a][_0x92ad('0x31')]===_0x92ad('0x7')||_0x485ec0[_0x4c390a]['dialMethod']===_0x92ad('0x63'))&&_0x485ec0[_0x4c390a][_0x92ad('0x25')]===_0x92ad('0x64')){if(this[_0x92ad('0x17')]>0x7){this[_0x92ad('0x17')]=0x0;this[_0x92ad('0x65')]();}}if(_0x485ec0[_0x92ad('0x66')](_0x4c390a)&&_0x485ec0[_0x4c390a][_0x92ad('0x31')]===_0x92ad('0x7')&&_0x485ec0[_0x4c390a]['type']===_0x92ad('0x64')){if(_0x485ec0[_0x4c390a]['dialActive']){this[_0x92ad('0x67')](_0x485ec0[_0x4c390a]);if(_0x485ec0[_0x4c390a][_0x92ad('0x68')])this[_0x92ad('0x69')](_0x485ec0[_0x4c390a]);}else{notSendMessagesQueue(_0x485ec0[_0x4c390a]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x3c21f0){var _0x3c20f6=this;this[_0x92ad('0x11')]['enqueue'](function(){if(!_[_0x92ad('0x6a')](_0x3c20f6['actions'][_0x3c21f0])){loggerAction['info'](_0x92ad('0x6b'),_0x3c21f0,_0x92ad('0x6c'),_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x6d')],_0x92ad('0x6e'),JSON[_0x92ad('0x51')](_0x3c20f6[_0x92ad('0x12')][_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x6d')]][_0x92ad('0x49')]),_0x92ad('0x6f'),JSON['stringify'](_0x3c20f6[_0x92ad('0x12')][_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x6d')]][_0x92ad('0x5a')]),JSON[_0x92ad('0x51')](_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x70')]),JSON[_0x92ad('0x51')](_[_0x92ad('0x71')](_0x3c20f6[_0x92ad('0x15')][_0x3c21f0],[_0x92ad('0x72'),_0x92ad('0x73'),_0x92ad('0x74'),'ListId'])));return ami[_0x92ad('0x75')]({'action':_0x92ad('0x76'),'channel':_0x3c20f6[_0x92ad('0x15')][_0x3c21f0]['channel']})[_0x92ad('0x77')](function(_0x2fa1a5){if(_0x2fa1a5[_0x92ad('0x5e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3c20f6[_0x92ad('0x15')][_0x3c21f0]){ut[_0x92ad('0x78')](_0x3c20f6[_0x92ad('0x12')][_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x6d')]],'[clearZombieChannel]');if(_0x3c20f6[_0x92ad('0x15')][_0x3c21f0]['dialAnswer']===!![]){ut['decrementTalkink'](_0x3c20f6[_0x92ad('0x12')][_0x3c20f6['actions'][_0x3c21f0][_0x92ad('0x6d')]],_0x92ad('0x79'));ut[_0x92ad('0x7a')](_0x92ad('0x7b')+_0x3c21f0,_0x3c20f6[_0x92ad('0x15')][_0x3c21f0]['queue']);}ut[_0x92ad('0x7a')](_0x92ad('0x7c')+_0x3c21f0,_0x3c20f6[_0x92ad('0x15')][_0x3c21f0][_0x92ad('0x6d')]);delete _0x3c20f6[_0x92ad('0x15')][_0x3c21f0];}},0x2328);}});}});};Preview['prototype'][_0x92ad('0x65')]=function(){var _0x50efee=this;loggerAction[_0x92ad('0x55')]('[action]',_[_0x92ad('0x7d')](this[_0x92ad('0x15')]));for(var _0x173e63 in this[_0x92ad('0x15')]){if(_0x50efee[_0x92ad('0x15')][_0x92ad('0x66')](_0x173e63)){_0x50efee['clearZombieChannel'](_0x173e63);}}};Preview[_0x92ad('0x61')][_0x92ad('0x69')]=function(_0x567930){var _0x30b578=this;rpcDb['getContactRecallMe'](_0x567930['id'],ut[_0x92ad('0x7e')](this[_0x92ad('0x16')]))['then'](function(_0x5becea){if(!_[_0x92ad('0x6a')](_0x5becea)){for(var _0x3d5858=0x0;_0x3d5858<_0x5becea[_0x92ad('0x7f')];_0x3d5858+=0x1){if(ut[_0x92ad('0x80')](_0x5becea[_0x3d5858][_0x92ad('0x81')])<_0x567930['dialRecallMeTimeout']*0x3c){if(_0x5becea[_0x3d5858][_0x92ad('0x82')]&&!_0x5becea[_0x3d5858][_0x92ad('0x82')][_0x92ad('0x83')]){_0x30b578[_0x92ad('0x84')](_0x5becea[_0x3d5858]['id'])[_0x92ad('0x85')](ut['logger2'](_0x92ad('0x86')))[_0x92ad('0x77')](ut[_0x92ad('0x87')](_0x92ad('0x86')));}else{rpcDb['disableContact'](_0x5becea[_0x3d5858]['id']);}}else{var _0x11adc8=new Action(_0x5becea[_0x3d5858],_0x567930);_0x11adc8[_0x92ad('0x88')]=moment()[_0x92ad('0x52')](_0x92ad('0x89'));_0x567930['outboundReCallsDay']+=0x1;ut[_0x92ad('0x8a')](_0x11adc8,0x17,'RecallInQueue');if(_0x567930[_0x92ad('0x8b')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x5becea[_0x3d5858]));rpcDb['createCustomerHistory'](_0x11adc8,_0x92ad('0x8c'));}else{ut['logCustomer'](_0x11adc8,0x16,_0x92ad('0x8d'));rpcDb[_0x92ad('0x8e')](_0x11adc8,_0x92ad('0x8f'));rpcDb[_0x92ad('0x90')](_0x11adc8,'[HistoryRecallClose]');}}}}})[_0x92ad('0x77')](ut[_0x92ad('0x87')](_0x92ad('0x91')));};Preview[_0x92ad('0x61')][_0x92ad('0x67')]=function(_0x428bfa){_0x428bfa[_0x92ad('0x59')]=!![];if(ut[_0x92ad('0x92')](_0x428bfa['loggedIn'])){_0x428bfa[_0x92ad('0x5e')]=_0x92ad('0x93');}else if(!ut['isActive'](_0x428bfa[_0x92ad('0x30')])){_0x428bfa[_0x92ad('0x5e')]=_0x92ad('0x5c');}else if(!this['isTrunkReachable'](_0x428bfa['Trunk'])){if(!this['isTrunkReachable'](_0x428bfa[_0x92ad('0x94')])){_0x428bfa['message']=_0x92ad('0x95');}else{_0x428bfa[_0x92ad('0x5e')]=_0x92ad('0x96');}}else{_0x428bfa[_0x92ad('0x5e')]='ACTIVE';}emitCampaignPreview(_0x428bfa);};Preview['prototype'][_0x92ad('0x97')]=function(_0x30fffd,_0xcad315,_0x2269f6){var _0x1b4701=this;var _0x839235=this[_0x92ad('0x15')][_0xcad315];var _0x39be58=this[_0x92ad('0x12')][_0x839235[_0x92ad('0x6d')]];var _0x27854e;var _0x56cd8d=![];var _0x1f5a9c=0x2;var _0x2bf3f7=0x3;if(_0x39be58){switch(_0x2269f6){case'1':_0x39be58[_0x92ad('0x3b')]+=0x1;_0x839235[_0x92ad('0x98')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut[_0x92ad('0x8a')](_0x839235,0x0,'NoSuchNumber');ami[_0x92ad('0x57')]('custom:agentnosuchnumber',ut[_0x92ad('0x9b')](_0x839235,'nosuchnumber'));rpcDb[_0x92ad('0x8e')](_0x839235,_0x92ad('0x9c'));_0x1b4701['verifyAdditionalPhones'](_0x839235,'0',_0x39be58)['then'](function(_0xedc504){_0x56cd8d=_0xedc504[_0x92ad('0x9d')]==0x1;_0x1f5a9c=_0x39be58[_0x92ad('0x9e')];_0x2bf3f7=_0x39be58[_0x92ad('0x9f')];if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58['dialGlobalMaxRetry']){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0xf,_0x92ad('0xa1'));rpcDb['createCustomerFinal'](_0x27854e,_0x92ad('0xa2'));}else{if(_0x839235[_0x92ad('0x98')]>=_0x39be58['dialNoSuchNumberMaxRetry']){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xa2'));}else{rpcDb[_0x92ad('0xa3')](ut[_0x92ad('0xa4')](_0x839235,_0x92ad('0x98'),_0x39be58[_0x92ad('0x9e')]),_0x839235[_0x92ad('0xa5')],_0x839235['activeContact']);}}delete this[_0x92ad('0x15')][_0x30fffd['linkedid']];}else{_0x839235[_0x92ad('0x98')]++;logger[_0x92ad('0x55')](_0x92ad('0xa6'),_0x839235['countnosuchnumberretry']);logger[_0x92ad('0x55')]('id',_0x839235['idContact']);_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235['idContact'],'field':{'countnosuchnumberretry':_0x839235[_0x92ad('0x98')]}})['then'](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});break;case'ANSWER':var _0x2818a1=moment()[_0x92ad('0x52')](_0x92ad('0x89'));_0x839235[_0x92ad('0xa9')]=_0x2818a1;_0x839235[_0x92ad('0xaa')]=_0x2818a1;_0x839235[_0x92ad('0x70')]=!![];_0x39be58[_0x92ad('0x5a')]+=0x1;logger[_0x92ad('0x55')](_0x92ad('0xab'),_0x839235[_0x92ad('0xac')],_0x92ad('0xad'),_0x39be58[_0x92ad('0x26')],_0x92ad('0x6f'),_0x39be58[_0x92ad('0x5a')]);ami[_0x92ad('0x57')]('custom:agentconnect',ut[_0x92ad('0x9b')](_0x839235,_0x92ad('0xae'),this[_0x92ad('0x12')][_0x839235[_0x92ad('0x6d')]]));if(_0x39be58[_0x92ad('0xaf')]){ami[_0x92ad('0x57')](_0x92ad('0xb0'),ut[_0x92ad('0xb1')](_0x839235));}break;case'16':ami[_0x92ad('0x57')](_0x92ad('0xb2'),ut[_0x92ad('0x9b')](_0x839235,_0x92ad('0xb3'),this[_0x92ad('0x12')][_0x839235['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x839235,_0x92ad('0xb3')));_0x39be58['outboundAnswerCallsDay']+=0x1;_0x39be58[_0x92ad('0xb4')]+=0x1;_0x39be58['answered']+=0x1;ut[_0x92ad('0xb5')](_0x39be58,_0x92ad('0xb6'));_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut[_0x92ad('0x8a')](_0x839235,0x4,_0x92ad('0xb7'));rpcDb['createCustomerHistory'](_0x839235,_0x92ad('0xb8'));rpcDb[_0x92ad('0x90')](_0x839235,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x839235);_0x39be58['sumDuration']+=_0x839235[_0x92ad('0xb9')];_0x39be58[_0x92ad('0x2a')]+=_0x839235[_0x92ad('0xb9')];logger[_0x92ad('0x55')]('[syncHangup][talking][decrement]',_0x839235[_0x92ad('0xac')],'\x20Queue',_0x39be58[_0x92ad('0x26')],_0x92ad('0x6f'),_0x39be58[_0x92ad('0x5a')]);delete this[_0x92ad('0x15')][_0x30fffd['linkedid']];break;case _0x92ad('0xba'):_0x39be58[_0x92ad('0xbb')]+=0x1;_0x839235[_0x92ad('0xbc')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut[_0x92ad('0x8a')](_0x839235,0x5,'Busy');_0x1f5a9c=_0x39be58[_0x92ad('0xbd')];_0x2bf3f7=_0x39be58['callAdditionalPhoneAfterMin'];ami[_0x92ad('0x57')](_0x92ad('0xbe'),ut['buildObj'](_0x839235,_0x92ad('0xbf')));rpcDb[_0x92ad('0x8e')](_0x839235,_0x92ad('0xc0'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'5',_0x39be58)[_0x92ad('0x85')](function(_0x4710c2){_0x56cd8d=_0x4710c2[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut['cloneAction'](_0x839235,0xf,_0x92ad('0xa1'));rpcDb['createCustomerFinal'](_0x27854e,_0x92ad('0xc3'));}else{if(_0x839235[_0x92ad('0xbc')]>=_0x39be58[_0x92ad('0xc4')]){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xc0'));}else{rpcDb[_0x92ad('0xa3')](ut[_0x92ad('0xa4')](_0x839235,_0x92ad('0xbc'),_0x39be58['dialBusyRetryFrequency']),_0x839235[_0x92ad('0xa5')],_0x839235[_0x92ad('0xc5')]);}}}else{_0x839235['countbusyretry']++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countbusyretry':_0x839235[_0x92ad('0xbc')]}})[_0x92ad('0x85')](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});break;case'NOANSWER':_0x39be58[_0x92ad('0x3a')]+=0x1;_0x839235[_0x92ad('0xc7')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut[_0x92ad('0x8a')](_0x839235,0x3,_0x92ad('0xc8'));_0x1f5a9c=_0x39be58[_0x92ad('0xc9')];_0x2bf3f7=_0x39be58[_0x92ad('0x9f')];var _0x5b2418=ut[_0x92ad('0xca')](_0x839235,_0x39be58);ami[_0x92ad('0x57')](_0x92ad('0xcb'),_0x5b2418);rpcDb[_0x92ad('0x8e')](_0x839235,_0x92ad('0xcc'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'3',_0x39be58)['then'](function(_0x5808dd){_0x56cd8d=_0x5808dd[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut['totalGlobal'](_0x839235)>=_0x39be58['dialGlobalMaxRetry']){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0xf,_0x92ad('0xa1'));rpcDb[_0x92ad('0x90')](_0x27854e,_0x92ad('0xcd'));}else{if(_0x839235[_0x92ad('0xc7')]>=_0x39be58['dialNoAnswerMaxRetry']){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xcc'));}else{rpcDb[_0x92ad('0xa3')](ut[_0x92ad('0xa4')](_0x839235,_0x92ad('0xc7'),_0x39be58[_0x92ad('0xc9')]),_0x839235[_0x92ad('0xa5')],_0x839235[_0x92ad('0xc5')]);}}}else{_0x839235[_0x92ad('0xc7')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countnoanswerretry':_0x839235[_0x92ad('0xc7')]}})[_0x92ad('0x85')](function(){_0x1b4701['swapAdditionalPhones'](_0x839235,_0x1f5a9c,_0x2bf3f7)['then'](function(){});});}});break;case _0x92ad('0xce'):_0x39be58[_0x92ad('0x37')]+=0x1;_0x839235[_0x92ad('0xcf')]+=0x1;_0x839235['countglobal']=ut['totalGlobal'](_0x839235);ut['logCustomer'](_0x839235,0x8,'Congestion');_0x1f5a9c=_0x39be58[_0x92ad('0xd0')];_0x2bf3f7=_0x39be58[_0x92ad('0x9f')];ami[_0x92ad('0x57')](_0x92ad('0xd1'),ut[_0x92ad('0x9b')](_0x839235,_0x92ad('0xd2')));rpcDb['createCustomerHistory'](_0x839235,_0x92ad('0xd3'));_0x1b4701['verifyAdditionalPhones'](_0x839235,'8',_0x39be58)[_0x92ad('0x85')](function(_0x288fcf){_0x56cd8d=_0x288fcf[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0xf,_0x92ad('0xa1'));rpcDb[_0x92ad('0x90')](_0x27854e,_0x92ad('0xd4'));}else{if(_0x839235['countcongestionretry']>=_0x39be58[_0x92ad('0xd5')]){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xd3'));}else{rpcDb[_0x92ad('0xa3')](ut[_0x92ad('0xa4')](_0x839235,_0x92ad('0xcf'),_0x39be58[_0x92ad('0xbd')]),_0x839235[_0x92ad('0xa5')],_0x839235[_0x92ad('0xc5')]);}}}else{_0x839235[_0x92ad('0xcf')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countcongestionretry':_0x839235[_0x92ad('0xcf')]}})['then'](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});break;case _0x92ad('0xd6'):_0x39be58['outboundRejectCallsDay']+=0x1;_0x839235[_0x92ad('0xd7')]+=0x1;_0x839235[_0x92ad('0x99')]=ut['totalGlobal'](_0x839235);ut['logCustomer'](_0x839235,0x14,_0x92ad('0xd8'));_0x1f5a9c=_0x39be58[_0x92ad('0xd9')];_0x2bf3f7=_0x39be58[_0x92ad('0x9f')];ami[_0x92ad('0x57')](_0x92ad('0xda'),ut[_0x92ad('0x9b')](_0x839235,_0x92ad('0xdb')));rpcDb['createCustomerHistory'](_0x839235,_0x92ad('0xdc'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'20',_0x39be58)['then'](function(_0x57f854){_0x56cd8d=_0x57f854[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut['cloneAction'](_0x839235,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x27854e,_0x92ad('0xdd'));}else{if(_0x839235[_0x92ad('0xd7')]>=_0x39be58[_0x92ad('0xde')]){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xdd'));}else{rpcDb[_0x92ad('0xa3')](ut['scheduledAt'](_0x839235,_0x92ad('0xd7'),_0x39be58[_0x92ad('0xd9')]),_0x839235['unlockAgent'],_0x839235[_0x92ad('0xc5')]);}}}else{_0x839235[_0x92ad('0xc7')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countnoanswerretry':_0x839235[_0x92ad('0xc7')]}})['then'](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)['then'](function(){});});}});break;case _0x92ad('0xdf'):_0x39be58[_0x92ad('0x3e')]+=0x1;_0x839235[_0x92ad('0xe0')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut['logCustomer'](_0x839235,0xb,_0x92ad('0xe1'));rpcDb['createCustomerHistory'](_0x839235,_0x92ad('0xe2'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'11',_0x39be58)[_0x92ad('0x85')](function(_0x3e0eeb){_0x56cd8d=_0x3e0eeb[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0xf,'Global');rpcDb[_0x92ad('0x90')](_0x27854e,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x839235['countabandonedetry']>=_0x39be58[_0x92ad('0xe3')]){rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0x92ad('0xa4')](_0x839235,_0x92ad('0xe0'),_0x39be58[_0x92ad('0xe4')]),_0x839235[_0x92ad('0xa5')],_0x839235[_0x92ad('0xc5')]);}}}else{_0x839235[_0x92ad('0xc7')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countnoanswerretry':_0x839235[_0x92ad('0xc7')]}})[_0x92ad('0x85')](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});break;case'18':_0x39be58[_0x92ad('0x3d')]+=0x1;_0x839235[_0x92ad('0xe5')]+=0x1;_0x839235['countglobal']=ut[_0x92ad('0x9a')](_0x839235);ut[_0x92ad('0x8a')](_0x839235,0x12,_0x30fffd[_0x92ad('0xe6')]||_0x30fffd['dialstatus']);ami[_0x92ad('0x57')]('custom:amd',ut[_0x92ad('0x9b')](_0x839235,'amd'));rpcDb['createCustomerHistory'](_0x839235,_0x92ad('0xe7'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'18',_0x39be58)[_0x92ad('0x85')](function(_0x2b5965){_0x56cd8d=_0x2b5965[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58['dialGlobalMaxRetry']){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0x12,'Global');rpcDb[_0x92ad('0x90')](_0x27854e,_0x92ad('0xe7'));}else{rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xe7'));}}else{_0x839235[_0x92ad('0xc7')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countnoanswerretry':_0x839235[_0x92ad('0xc7')]}})[_0x92ad('0x85')](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});delete this[_0x92ad('0x15')][_0x30fffd['linkedid']];break;case'19':_0x39be58[_0x92ad('0x3d')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut['logCustomer'](_0x839235,0x13,_0x30fffd[_0x92ad('0xe6')]||_0x30fffd[_0x92ad('0xe8')]);ami[_0x92ad('0x57')](_0x92ad('0xe9'),ut[_0x92ad('0x9b')](_0x839235,_0x92ad('0xea')));rpcDb[_0x92ad('0x8e')](_0x839235,'[callProgressDetectingCustomer][machine]');_0x1b4701['verifyAdditionalPhones'](_0x839235,'18',_0x39be58)[_0x92ad('0x85')](function(_0x1d3e02){_0x56cd8d=_0x1d3e02[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut['totalGlobal'](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut['cloneAction'](_0x839235,0xf,_0x92ad('0xa1'));rpcDb['createCustomerFinal'](_0x27854e,_0x92ad('0xeb'));}else{rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xeb'));}}else{_0x839235[_0x92ad('0xc7')]++;_0x1b4701[_0x92ad('0xa7')]({'id':_0x839235[_0x92ad('0xc6')],'field':{'countnoanswerretry':_0x839235[_0x92ad('0xc7')]}})[_0x92ad('0x85')](function(){_0x1b4701[_0x92ad('0xa8')](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});});}});delete this['actions'][_0x30fffd['linkedid']];break;default:if(_0x839235[_0x92ad('0x70')]){ut[_0x92ad('0xb5')](_0x39be58,_0x92ad('0xec'));ut[_0x92ad('0x7a')](_0x92ad('0xed')+_0x39be58['name'],_0x30fffd);}_0x39be58[_0x92ad('0x3d')]+=0x1;_0x839235[_0x92ad('0x99')]=ut[_0x92ad('0x9a')](_0x839235);ut['logCustomer'](_0x839235,0xc,_0x30fffd[_0x92ad('0xe6')]||_0x30fffd[_0x92ad('0xe8')]);_0x1f5a9c=_0x39be58[_0x92ad('0xd9')];_0x2bf3f7=_0x39be58[_0x92ad('0x9f')];rpcDb[_0x92ad('0x8e')](_0x839235,_0x92ad('0xee'));_0x1b4701[_0x92ad('0xc1')](_0x839235,'20',_0x39be58)[_0x92ad('0x85')](function(_0x22f51b){_0x56cd8d=_0x22f51b[_0x92ad('0x9d')]==0x1;if(!_0x56cd8d){if(ut[_0x92ad('0x9a')](_0x839235)>=_0x39be58[_0x92ad('0xc2')]){_0x27854e=ut[_0x92ad('0xa0')](_0x839235,0xf,_0x92ad('0xa1'));rpcDb['createCustomerFinal'](_0x27854e,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x92ad('0x90')](_0x839235,_0x92ad('0xef'));}delete this['actions'][_0x30fffd[_0x92ad('0xf0')]];}else{_0x1b4701['swapAdditionalPhones'](_0x839235,_0x1f5a9c,_0x2bf3f7)[_0x92ad('0x85')](function(){});}});}if(!(_0x839235[_0x92ad('0x70')]&&_0x2269f6==='16')){ut['updateOriginated'](_0x39be58,_0x92ad('0xf1'));logger[_0x92ad('0x55')](_0x92ad('0xf2'),_0x839235[_0x92ad('0xac')],_0x92ad('0xad'),_0x39be58[_0x92ad('0x26')],'originated:\x20',_0x39be58['originated']);}if(_0x2269f6!==_0x92ad('0xf3')){delete this[_0x92ad('0x15')][_0x30fffd[_0x92ad('0xf0')]];delete this[_0x92ad('0x15')][_0x30fffd['destlinkedid']];}}};Preview[_0x92ad('0x61')][_0x92ad('0xf4')]=function(_0x6dba7b,_0x154c3b,_0x15e7c5){if(_[_0x92ad('0xf5')](_0x154c3b)&&'object'!==typeof _0x154c3b){return;}if(_['isUndefined'](_0x15e7c5)&&_0x92ad('0xf6')!==typeof _0x15e7c5){return;}switch(_0x15e7c5[_0x92ad('0xf7')]){case'0':ut[_0x92ad('0xf8')](_0x6dba7b,0x0,_0x92ad('0xf9'));rpcDb[_0x92ad('0xfa')](_0x6dba7b,_0x92ad('0xfb'));break;case'3':ut['logAgent'](_0x6dba7b,0x3,_0x92ad('0xc8'));rpcDb[_0x92ad('0xfa')](_0x6dba7b,_0x92ad('0xfc'));break;case'5':ut[_0x92ad('0xf8')](_0x6dba7b,0x5,_0x92ad('0xfd'));rpcDb[_0x92ad('0xfa')](_0x6dba7b,_0x92ad('0xfe'));break;case'8':ut[_0x92ad('0xf8')](_0x6dba7b,0x8,_0x92ad('0xff'));rpcDb['createAgentHistory'](_0x6dba7b,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x6dba7b,0x16,_0x92ad('0x100'));rpcDb['createAgentHistory'](_0x6dba7b,_0x92ad('0x101'));break;default:ut[_0x92ad('0xf8')](_0x6dba7b,0xc,_0x15e7c5[_0x92ad('0xf7')]);rpcDb[_0x92ad('0xfa')](_0x6dba7b,_0x92ad('0x102'));}ut[_0x92ad('0x78')](_0x154c3b,_0x92ad('0x103'));logger['info'](_0x92ad('0x104'),_0x6dba7b[_0x92ad('0xac')],_0x92ad('0xad'),_0x154c3b[_0x92ad('0x26')],_0x92ad('0x6e'),_0x154c3b[_0x92ad('0x49')]);delete this[_0x92ad('0x15')][_0x6dba7b['uniqueid']];};Preview[_0x92ad('0x61')]['verifyAdditionalPhones']=function(_0x2b3784,_0x554188,_0x1433e8){return Promise[_0x92ad('0x105')]()[_0x92ad('0x85')](cmHopperAdditionalPhone[_0x92ad('0xc1')](_0x2b3784,_0x554188,_0x1433e8))['catch'](logger[_0x92ad('0x55')]('[verifyAdditionalPhone]\x20'));};Preview[_0x92ad('0x61')][_0x92ad('0xa8')]=function(_0x38331e,_0x32f260,_0x1381ce){return Promise[_0x92ad('0x105')]()[_0x92ad('0x85')](cmHopperAdditionalPhone[_0x92ad('0xa8')](_0x38331e,_0x32f260,_0x1381ce))[_0x92ad('0x77')](logger[_0x92ad('0x55')](_0x92ad('0x106')));};Preview[_0x92ad('0x61')]['incrementPreviewCounters']=function(_0x16a954){return Promise['resolve']()[_0x92ad('0x85')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x16a954))[_0x92ad('0x77')](logger[_0x92ad('0x55')](_0x92ad('0x107')));};Preview[_0x92ad('0x61')][_0x92ad('0x108')]=function(_0x5dae2c,_0x3adac3,_0x2c0f6f,_0x15ad0a,_0x4a1b62){var _0x154deb=this;return new Promise(function(_0x9d765,_0x35ecb0){if(_['isNil'](_0x3adac3)||_[_0x92ad('0x6a')](_0x3adac3[_0x92ad('0x109')])||_[_0x92ad('0x6a')](_0x3adac3[_0x92ad('0x10a')])||_[_0x92ad('0x6a')](_0x3adac3[_0x92ad('0x74')])){_0x35ecb0(ut['message']('Contact\x20is\x20undefined',_0x15ad0a,_0x4a1b62));return;}var _0x500ef0=uuid['v4']();var _0x51877b=_0x154deb[_0x92ad('0x12')][_0x3adac3[_0x92ad('0x6c')][_0x92ad('0x26')]];var _0x2f6641=_0x2c0f6f?_0x154deb[_0x92ad('0x16')][_0x2c0f6f]['id']:undefined;_0x154deb[_0x92ad('0x15')][_0x500ef0]=new Action(_0x3adac3,_0x51877b,_0x500ef0,_0x2c0f6f,_0x2f6641);var _0x359956=_0x154deb['actions'][_0x500ef0];_0x359956['unlockAgent']=_0x15ad0a;_0x359956['activeContact']=_0x4a1b62;_0x359956[_0x92ad('0x10b')]=_0x2c0f6f;if(_['isEmpty'](_0x5dae2c)){_0x154deb[_0x92ad('0x10c')](_0x359956,_0x51877b,_0x3adac3,_0x2c0f6f)['then'](function(_0x2f1b8b){logger['info'](_0x92ad('0x10d'),_0x92ad('0x10e')+_0x359956[_0x92ad('0x6d')]+_0x92ad('0x10f')+_0x359956['idContact'],JSON['stringify'](_0x2f1b8b));ami['emit']('custom:agentcalled',ut[_0x92ad('0x9b')](_0x359956,_0x92ad('0x110'),_0x154deb[_0x92ad('0x12')][_0x359956[_0x92ad('0x6d')]]));_0x9d765(ut[_0x92ad('0x5e')](_0x92ad('0x111')));})[_0x92ad('0x77')](function(_0x4601a0){ut[_0x92ad('0x5d')]('[Preview][execCall][failure]',_0x4601a0);_0x35ecb0(ut[_0x92ad('0x5e')](_0x92ad('0x112'),_0x15ad0a,_0x4a1b62));});}else{_0x51877b['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x359956);rpcDb[_0x92ad('0x113')](_0x359956,_0x92ad('0x114'));delete _0x154deb[_0x92ad('0x15')][_0x500ef0];_0x35ecb0(ut[_0x92ad('0x5e')]('Contact\x20in\x20black\x20List',_0x15ad0a,_0x4a1b62));}});};Preview[_0x92ad('0x61')]['isTrunkReachable']=function(_0x32a294){return!_[_0x92ad('0x6a')](_0x32a294)&&!_[_0x92ad('0x6a')](_0x32a294['name'])&&!_['isNil'](_0x32a294[_0x92ad('0x4e')])&&_0x32a294[_0x92ad('0x4e')]&&!_[_0x92ad('0x6a')](this[_0x92ad('0x14')][util[_0x92ad('0x52')](_0x92ad('0x115'),_0x32a294[_0x92ad('0x26')])])&&!_[_0x92ad('0x6a')](this['trunks'][util[_0x92ad('0x52')](_0x92ad('0x115'),_0x32a294[_0x92ad('0x26')])][_0x92ad('0x76')])&&(this[_0x92ad('0x14')][util['format']('SIP/%s',_0x32a294[_0x92ad('0x26')])]['status']===_0x92ad('0x116')||this[_0x92ad('0x14')][util[_0x92ad('0x52')](_0x92ad('0x115'),_0x32a294[_0x92ad('0x26')])][_0x92ad('0x76')]==='unmonitored');};Preview[_0x92ad('0x61')][_0x92ad('0x84')]=function(_0x47cc5f,_0x47e59d){var _0x702306=this;return new Promise(function(_0x298cc2,_0x1fd929){_0x702306[_0x92ad('0x117')](_0x47cc5f,_0x47e59d)[_0x92ad('0x85')](function(_0x87bc80){_0x298cc2(_[_0x92ad('0x71')](_0x87bc80,['message']));})[_0x92ad('0x77')](function(_0x2ae5fb){if(_0x2ae5fb[_0x92ad('0x118')]){rpcDb[_0x92ad('0x119')](_0x47cc5f);}if(_0x2ae5fb[_0x92ad('0x4e')]){rpcDb[_0x92ad('0x11a')](_0x47cc5f);}_0x1fd929(_['pick'](_0x2ae5fb,[_0x92ad('0x5e')]));});});};Preview[_0x92ad('0x61')][_0x92ad('0x117')]=function(_0x10f7cb,_0x140662){var _0x50e2cf=this;return new Promise(function(_0x14176f,_0x5561ee){var _0x208923,_0x33a76e;rpcDb[_0x92ad('0x11b')](_0x10f7cb)[_0x92ad('0x85')](function(_0x1963e4){if(!_[_0x92ad('0x6a')](_0x1963e4[0x0])){_0x33a76e=_0x1963e4[0x0][_0x92ad('0x11c')]?![]:!![];_0x208923=_0x1963e4[0x0][_0x92ad('0x11c')]?!![]:![];_0x208923=_0x140662?!![]:_0x208923;}var _0x2de1a8=_0x50e2cf[_0x92ad('0x11d')](_0x1963e4);if(_0x2de1a8[_0x92ad('0x11e')]){rpcDb['checkIsBlackList'](_['pick'](_0x1963e4[0x0],[_0x92ad('0x74'),_0x92ad('0x10a')]))[_0x92ad('0x85')](function(_0x2df2f2){_0x50e2cf[_0x92ad('0x108')](_0x2df2f2,_0x1963e4[0x0],_0x140662,_0x33a76e,_0x208923)[_0x92ad('0x85')](function(_0x3a0d61){_0x14176f(_0x3a0d61);})[_0x92ad('0x77')](function(_0x34507a){_0x5561ee(_0x34507a);});})[_0x92ad('0x77')](function(_0xfc087c){ut['logger'](_0x92ad('0x11f'),_0xfc087c);_0x5561ee(ut[_0x92ad('0x5e')]('Call\x20unsuccessful',_0x33a76e,_0x208923));});}else{_0x5561ee(ut['message'](_0x2de1a8[_0x92ad('0x5e')],_0x33a76e,_0x208923));}})[_0x92ad('0x77')](function(_0x386885){ut[_0x92ad('0x5d')](_0x92ad('0x120'),_0x386885);_0x5561ee(ut[_0x92ad('0x5e')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x92ad('0x61')][_0x92ad('0x11d')]=function(_0x2d59f0){if(_['isNil'](_0x2d59f0)||_['isEmpty'](_0x2d59f0)||!_[_0x92ad('0x6a')](_0x2d59f0[0x0][_0x92ad('0x82')])&&_[_0x92ad('0x6a')](_0x2d59f0[0x0][_0x92ad('0x82')][_0x92ad('0x26')])){ut[_0x92ad('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x2d59f0);return{'isValid':![],'message':_0x92ad('0x121')};}var _0x16631f=this[_0x92ad('0x12')][_0x2d59f0[0x0][_0x92ad('0x6c')][_0x92ad('0x26')]];_0x16631f[_0x92ad('0x5e')]='ACTIVE';if(_[_0x92ad('0x6a')](_0x16631f)){ut[_0x92ad('0x5d')](_0x92ad('0x122'),_0x16631f);return{'isValid':![],'message':_0x92ad('0x123')};}if(!this[_0x92ad('0x124')](_0x16631f[_0x92ad('0x4d')])){ut[_0x92ad('0x5d')](_0x92ad('0x125'),_0x92ad('0x126')+_0x16631f[_0x92ad('0x26')]+_0x92ad('0x127'));if(!this['isTrunkReachable'](_0x16631f[_0x92ad('0x94')])){ut['logger'](_0x92ad('0x125'),_0x16631f[_0x92ad('0x26')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x92ad('0x128')};}}if(!ut[_0x92ad('0x129')](_0x16631f[_0x92ad('0x30')])){ut[_0x92ad('0x5d')](_0x92ad('0x12a'),_0x16631f[_0x92ad('0x26')]+_0x92ad('0x12b'));return{'isValid':![],'message':_0x92ad('0x126')+_0x16631f[_0x92ad('0x26')]+_0x92ad('0x12b')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype'][_0x92ad('0x10c')]=function(_0x447a36,_0x272655,_0x5c8db3,_0x5d43ea){var _0x3a2d3b=this;return new Promise(function(_0x3e728d,_0x4f40f9){var _0xc24dc6=_0x447a36[_0x92ad('0xac')];var _0x10bc12=_0x3a2d3b['isTrunkReachable'](_0x272655[_0x92ad('0x4d')])?util['format'](_0x92ad('0x12c'),_0x272655[_0x92ad('0x4d')]['name'],_[_0x92ad('0x6a')](_0x272655['dialPrefix'])?'':_0x272655[_0x92ad('0x12d')][_0x92ad('0x12e')]()||'',_0x272655['dialCutDigit']>0x0?_0x5c8db3[_0x92ad('0x10a')][_0x92ad('0x12f')](_0x272655[_0x92ad('0x130')]):_0x5c8db3[_0x92ad('0x10a')]):util[_0x92ad('0x52')]('SIP/%s/%s%s',_[_0x92ad('0x6a')](_0x272655['TrunkBackup'])?_0x272655[_0x92ad('0x4d')][_0x92ad('0x26')]:_0x272655[_0x92ad('0x94')]['name'],_[_0x92ad('0x6a')](_0x272655[_0x92ad('0x12d')])?'':_0x272655[_0x92ad('0x12d')]['trim']()||'',_0x272655[_0x92ad('0x130')]>0x0?_0x5c8db3['phone']['substring'](_0x272655[_0x92ad('0x130')]):_0x5c8db3['phone']);var _0x22ebd1=_0x3a2d3b[_0x92ad('0x124')](_0x272655['Trunk'])?ut[_0x92ad('0x131')](_0x272655[_0x92ad('0x4d')][_0x92ad('0x4f')],_0x272655['dialOriginateCallerIdName'],_0x272655[_0x92ad('0x132')]>0x0?ut[_0x92ad('0x133')](_0x272655[_0x92ad('0x33')],_0x272655['dialRandomLastDigitCallerIdNumber']):_0x272655[_0x92ad('0x33')]):ut[_0x92ad('0x131')](_[_0x92ad('0x6a')](_0x272655[_0x92ad('0x94')])?_0x272655[_0x92ad('0x4d')][_0x92ad('0x4f')]:_0x272655[_0x92ad('0x94')]['callerid'],_0x272655[_0x92ad('0x32')],_0x272655[_0x92ad('0x132')]>0x0?ut['getCallerIdRandom'](_0x272655[_0x92ad('0x33')],_0x272655[_0x92ad('0x132')]):_0x272655[_0x92ad('0x33')]);if(_0x22ebd1){_0x447a36[_0x92ad('0x134')]=ut[_0x92ad('0x135')](_0x22ebd1);_0x447a36[_0x92ad('0x136')]=ut[_0x92ad('0x137')](_0x22ebd1);}var _0x3b00c1=ut[_0x92ad('0x138')](_0x272655,_0x5c8db3,_0x10bc12,_0x22ebd1,_0xc24dc6,_0x447a36);_['merge'](_0x447a36,ut[_0x92ad('0x139')](_0x3b00c1));_0x447a36[_0x92ad('0x88')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x272655['variables']=_0x3b00c1;ami[_0x92ad('0x75')](ut[_0x92ad('0x13a')](_0x447a36,_0x272655,_0x3b00c1,_0x447a36[_0x92ad('0xc5')],_0x5d43ea))['then'](function(_0x3ae0d7){_0x272655['originated']+=0x1;logger[_0x92ad('0x55')](_0x92ad('0x13b'),_0xc24dc6,_0x92ad('0xad'),_0x272655['name'],_0x92ad('0x6e'),_0x272655[_0x92ad('0x49')]);_0x3e728d(_0x3ae0d7);})['catch'](function(_0x4ed490){ut[_0x92ad('0xf8')](_0x447a36,0xe,_0x92ad('0x13c'));rpcDb[_0x92ad('0xfa')](_0x447a36,_0x92ad('0x13d'));_0x4f40f9(_0x4ed490);});});};Preview[_0x92ad('0x61')][_0x92ad('0x20')]=function(_0x27edbd){if(this['actions'][_0x27edbd['linkedid']]){this[_0x92ad('0x15')][_0x27edbd[_0x92ad('0xf0')]]['channel']=_0x27edbd[_0x92ad('0x13e')];}};Preview['prototype'][_0x92ad('0x18')]=function(_0x4b8e8f){var _0x1ebb4b=this;var _0x3a33dc=this[_0x92ad('0x15')][_0x4b8e8f[_0x92ad('0x13f')]];if(_0x3a33dc){if(_0x3a33dc['lookAgent']&&this['agents'][_0x3a33dc[_0x92ad('0x10b')]]){ut[_0x92ad('0x140')](_0x3a33dc,this[_0x92ad('0x16')][_0x3a33dc[_0x92ad('0x10b')]][_0x92ad('0x26')],this[_0x92ad('0x16')][_0x3a33dc[_0x92ad('0x10b')]]['id']);}var _0x4ed3b4=_[_0x92ad('0x141')](_0x3a33dc);_0x4ed3b4[_0x92ad('0xa9')]=moment()[_0x92ad('0x52')](_0x92ad('0x89'));var _0x517287=_0x1ebb4b[_0x92ad('0x12')][_0x3a33dc[_0x92ad('0x6d')]];if(ut[_0x92ad('0x142')](_0x4b8e8f['response'])){if(_0x3a33dc[_0x92ad('0xa5')]){rpcDb[_0x92ad('0x119')](_0x3a33dc[_0x92ad('0xc6')]);}if(_0x3a33dc[_0x92ad('0xc5')]){rpcDb[_0x92ad('0x11a')](_0x3a33dc[_0x92ad('0xc6')]);}ami[_0x92ad('0x57')](_0x92ad('0x143'),ut[_0x92ad('0x9b')](_0x3a33dc,_0x92ad('0x144'),this['campaignsPreview'][_0x3a33dc[_0x92ad('0x6d')]]));this[_0x92ad('0xf4')](_0x4ed3b4,_0x517287,_0x4b8e8f);}else{_0x3a33dc[_0x92ad('0x88')]=moment()[_0x92ad('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x92ad('0xf8')](_0x4ed3b4,0x4,_0x92ad('0xb7'));rpcDb[_0x92ad('0xfa')](_0x4ed3b4,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x92ad('0x61')]['syncHangup']=function(_0xbc8953){var _0x14e148=this['actions'][_0xbc8953[_0x92ad('0xf0')]];var _0x203f8b;if(_0x14e148){_0x203f8b=this[_0x92ad('0x12')][_0x14e148['queue']];logger[_0x92ad('0x55')](_0x92ad('0x145'),_0xbc8953[_0x92ad('0xf0')],_0x92ad('0xad'),_0x203f8b[_0x92ad('0x26')],_0x92ad('0x6f'),_0x203f8b[_0x92ad('0x5a')]);}if(this[_0x92ad('0x15')][_0xbc8953[_0x92ad('0xf0')]]&&_0xbc8953['linkedid']!==_0xbc8953[_0x92ad('0xac')]){if(_0xbc8953[_0x92ad('0x146')]==='16'&&this['actions'][_0xbc8953[_0x92ad('0xf0')]][_0x92ad('0x70')]){this[_0x92ad('0x97')](_0xbc8953,_0xbc8953[_0x92ad('0xf0')],_0xbc8953[_0x92ad('0x146')]);}else if(this[_0x92ad('0x15')][_0xbc8953[_0x92ad('0xf0')]][_0x92ad('0x70')]){logger[_0x92ad('0x55')]('[syncHangup][talking][cause]',_0xbc8953['linkedid'],_0xbc8953[_0x92ad('0x146')],'\x20Queue',_0x203f8b['name'],'pTalking:\x20',_0x203f8b['pTalking']);this[_0x92ad('0x97')](_0xbc8953,_0xbc8953[_0x92ad('0xf0')],_0xbc8953[_0x92ad('0x146')]);}}else if(_0x14e148&&_[_0x92ad('0x6a')](_0x14e148[_0x92ad('0x147')])&&_0x203f8b[_0x92ad('0x148')]&&_0xbc8953['linkedid']===_0xbc8953[_0x92ad('0xac')]&&_[_0x92ad('0x6a')](_0xbc8953['reason'])&&_0xbc8953[_0x92ad('0x146')]==='16'&&_0xbc8953[_0x92ad('0x149')]==='6'&&_[_0x92ad('0xf5')](_0x14e148['transfer'])){if(_0x14e148['unlockAgent']){rpcDb[_0x92ad('0x119')](_0x14e148['idContact']);}if(_0x14e148[_0x92ad('0xc5')]){rpcDb[_0x92ad('0x11a')](_0x14e148[_0x92ad('0xc6')]);}_0xbc8953['reason']='22';this[_0x92ad('0xf4')](_0x14e148,_0x203f8b,_0xbc8953);}else if(_0x14e148&&_0x14e148[_0x92ad('0x14a')]){if(_0xbc8953['cause']==='16'&&this[_0x92ad('0x15')][_0xbc8953[_0x92ad('0xf0')]]['dialAnswer']){logger[_0x92ad('0x55')](_0x92ad('0x14b'),_0xbc8953['linkedid'],_0xbc8953['cause'],_0x92ad('0xad'),_0x203f8b[_0x92ad('0x26')],'pTalking:\x20',_0x203f8b['pTalking']);this['callProgressDetectingCustomer'](_0xbc8953,_0xbc8953[_0x92ad('0xf0')],_0xbc8953[_0x92ad('0x146')]);}else if(this[_0x92ad('0x15')][_0xbc8953[_0x92ad('0xf0')]][_0x92ad('0x70')]){logger[_0x92ad('0x55')](_0x92ad('0x14c'),_0xbc8953[_0x92ad('0xf0')],_0xbc8953[_0x92ad('0x146')],_0x92ad('0xad'),_0x203f8b[_0x92ad('0x26')],_0x92ad('0x6f'),_0x203f8b[_0x92ad('0x5a')]);this['callProgressDetectingCustomer'](_0xbc8953,_0xbc8953[_0x92ad('0xf0')],_0xbc8953[_0x92ad('0x146')]);}}};Preview[_0x92ad('0x61')]['syncDialEnd']=function(_0x17d38d){if(this['actions'][_0x17d38d['destlinkedid']]&&_0x17d38d['destlinkedid']!==_0x17d38d['destuniqueid']){this[_0x92ad('0x97')](_0x17d38d,_0x17d38d[_0x92ad('0x14d')],_0x17d38d[_0x92ad('0xe8')]);}};Preview[_0x92ad('0x61')][_0x92ad('0x1c')]=function(_0x397aa3){if(this[_0x92ad('0x15')][_0x397aa3[_0x92ad('0xf0')]]&&_0x397aa3['linkedid']!==_0x397aa3[_0x92ad('0xac')]&&!this['actions'][_0x397aa3[_0x92ad('0xf0')]][_0x92ad('0x70')]){if(_0x397aa3['cause']==='1'){this[_0x92ad('0x97')](_0x397aa3,_0x397aa3[_0x92ad('0xf0')],_0x397aa3['cause']);}}};Preview[_0x92ad('0x61')][_0x92ad('0x14e')]=function(_0x515dc6,_0x33669e,_0x1af792){if(this[_0x92ad('0x15')][_0x515dc6]){if(_[_0x92ad('0x6a')](this[_0x92ad('0x15')][_0x515dc6][_0x92ad('0x14f')])){this[_0x92ad('0x15')][_0x515dc6]['variables']={};}this['actions'][_0x515dc6][_0x92ad('0x14f')][_0x33669e]=_0x1af792;}};Preview[_0x92ad('0x61')]['syncVarSet']=function(_0x218def){try{if(!_[_0x92ad('0x6a')](_0x218def)){if(ut[_0x92ad('0x150')](_['keys'](_0x218def['variable'])[0x0])){this[_0x92ad('0x14e')](_0x218def[_0x92ad('0xac')],_[_0x92ad('0x151')](_0x218def[_0x92ad('0x152')])[0x0],_0x218def[_0x92ad('0x153')]);}}}catch(_0x274d07){logger[_0x92ad('0x154')](_0x92ad('0x155'),util[_0x92ad('0x156')](_0x274d07,{'showHidden':![],'depth':null}));}};Preview[_0x92ad('0x61')][_0x92ad('0x22')]=function(_0x264902){if(_0x264902){if(this[_0x92ad('0x15')][_0x264902[_0x92ad('0x157')]]){this['actions'][_0x264902['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x92ad('0x61')][_0x92ad('0x23')]=function(_0x4c8109){if(_0x4c8109){if(this[_0x92ad('0x15')][_0x4c8109[_0x92ad('0x158')]]){this[_0x92ad('0x15')][_0x4c8109[_0x92ad('0x158')]]['transfer']=!![];}}};module[_0x92ad('0x159')]=Preview; \ No newline at end of file +var _0xc012=['inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','newexten','syncNewExten','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','name','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startProgressive','Trunk','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','prototype','syncCampaigns','hasOwnProperty','booked','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','incrementPreviewCounters','idContact','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','linkedid','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','additional','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','ANSWER','destlinkedid','object','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','logAgent','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','pick','unlock','unlockContact','execRun','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][getContactPreview]','Call\x20unsuccessful','validateContact','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','dialCutDigit','substring','SIP/%s/%s%s','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','callerid','dialOriginateCallerIdName','originatecalleridnum','extractCalleridNumber','merge','starttime','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','lookAgent','agents','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','isUndefined','transfer','destuniqueid','addVariable','syncVarSet','filterKey','keys','value','error','[syncVarSet][Preview]'];(function(_0x590c8d,_0xd86805){var _0x115c3b=function(_0x490bfd){while(--_0x490bfd){_0x590c8d['push'](_0x590c8d['shift']());}};_0x115c3b(++_0xd86805);}(_0xc012,0x165));var _0x2c01=function(_0x19ef33,_0x23c846){_0x19ef33=_0x19ef33-0x0;var _0x2b6c61=_0xc012[_0x19ef33];return _0x2b6c61;};'use strict';var util=require(_0x2c01('0x0'));var _=require('lodash');var uuid=require(_0x2c01('0x1'));var moment=require(_0x2c01('0x2'));var md5=require(_0x2c01('0x3'));var Redis=require(_0x2c01('0x4'));var config=require(_0x2c01('0x5'));var logger=require(_0x2c01('0x6'))(_0x2c01('0x7'));var loggerAction=require(_0x2c01('0x6'))(_0x2c01('0x8'));var ami=require(_0x2c01('0x9'));var rpcDb=require(_0x2c01('0xa'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x2c01('0xb'));var ut=require(_0x2c01('0xc'));config[_0x2c01('0xd')]=_[_0x2c01('0xe')](config['redis'],{'host':_0x2c01('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c01('0xd')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x2299f5){this['tail']=this[_0x2c01('0x10')]?this[_0x2c01('0x10')][_0x2c01('0x11')](_0x2299f5):_0x2299f5();};function Preview(_0x17c7ab){this[_0x2c01('0x12')]=new Sequence();this[_0x2c01('0x13')]=_0x17c7ab[_0x2c01('0x14')];this['trunks']=_0x17c7ab[_0x2c01('0x15')];this[_0x2c01('0x16')]={};this['agents']=_0x17c7ab['agents'];this[_0x2c01('0x17')]=0x0;ami['on'](_0x2c01('0x18'),this[_0x2c01('0x19')]['bind'](this));ami['on'](_0x2c01('0x1a'),this[_0x2c01('0x1b')]['bind'](this));ami['on'](_0x2c01('0x1c'),this[_0x2c01('0x1d')][_0x2c01('0x1e')](this));ami['on'](_0x2c01('0x1f'),this[_0x2c01('0x20')][_0x2c01('0x1e')](this));ami['on'](_0x2c01('0x21'),this[_0x2c01('0x22')][_0x2c01('0x1e')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on']('attendedtransfer',this[_0x2c01('0x23')]['bind'](this));ami['on'](_0x2c01('0x24'),this['syncBlindTransfer'][_0x2c01('0x1e')](this));this[_0x2c01('0x25')](this[_0x2c01('0x13')]);}function emit(_0x391ea9,_0x4ebca4,_0x4e5a30){io['to'](_0x391ea9)[_0x2c01('0x26')](_0x4ebca4,_0x4e5a30);}function emitCampaignPreview(_0x673be6){if(_0x673be6[_0x2c01('0x27')]==='outbound'){var _0x2cf4b4={'id':_0x673be6['id'],'name':_0x673be6[_0x2c01('0x28')],'strategy':_0x673be6['strategy'],'answered':_0x673be6['answered'],'available':_0x673be6[_0x2c01('0x29')],'loggedIn':_0x673be6[_0x2c01('0x2a')],'pTalking':_0x673be6[_0x2c01('0x2b')],'sumBillable':_0x673be6['sumBillable'],'sumDuration':_0x673be6[_0x2c01('0x2c')],'sumHoldTime':_0x673be6[_0x2c01('0x2d')]||0x0,'talking':_0x673be6[_0x2c01('0x2e')],'total':_0x673be6[_0x2c01('0x2f')],'type':_0x673be6['type'],'unmanaged':_0x673be6[_0x2c01('0x30')],'abandoned':_0x673be6[_0x2c01('0x31')],'waiting':_0x673be6[_0x2c01('0x32')],'loggedInDb':_0x673be6['loggedInDb'],'dialActive':_0x673be6['dialActive'],'dialMethod':_0x673be6[_0x2c01('0x33')],'dialOriginateCallerIdName':_0x673be6['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x673be6[_0x2c01('0x34')],'dialOriginateTimeout':_0x673be6['dialOriginateTimeout'],'dialPrefix':_0x673be6[_0x2c01('0x35')],'outboundAnswerAgiCallsDay':_0x673be6[_0x2c01('0x36')],'outboundAnswerCallsDay':_0x673be6['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x673be6[_0x2c01('0x37')],'outboundBusyCallsDay':_0x673be6[_0x2c01('0x38')],'outboundCongestionCallsDay':_0x673be6[_0x2c01('0x39')],'outboundDropCallsDayACS':_0x673be6[_0x2c01('0x3a')],'outboundDropCallsDayCallersExit':_0x673be6['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x673be6[_0x2c01('0x3b')],'outboundNoAnswerCallsDay':_0x673be6[_0x2c01('0x3c')],'outboundNoSuchCallsDay':_0x673be6[_0x2c01('0x3d')],'outboundOriginateFailureCallsDay':_0x673be6[_0x2c01('0x3e')],'outboundReCallsDay':_0x673be6[_0x2c01('0x3f')],'outboundRejectCallsDay':_0x673be6[_0x2c01('0x40')],'outboundUnknownCallsDay':_0x673be6['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x673be6[_0x2c01('0x41')],'predictiveIntervalAnsweredCalls':_0x673be6['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x673be6['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x673be6[_0x2c01('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x673be6[_0x2c01('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x673be6[_0x2c01('0x44')],'predictiveIntervalErlangCalls':_0x673be6[_0x2c01('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x673be6[_0x2c01('0x46')],'predictiveIntervalHitRate':_0x673be6[_0x2c01('0x47')],'predictiveIntervalMultiplicativeFactor':_0x673be6[_0x2c01('0x48')],'predictiveIntervalPauses':_0x673be6[_0x2c01('0x49')],'predictiveIntervalAvailable':_0x673be6[_0x2c01('0x4a')],'predictiveIntervalTotalCalls':_0x673be6['predictiveIntervalTotalCalls'],'message':_0x673be6[_0x2c01('0x4b')],'originated':_0x673be6[_0x2c01('0x4c')],'erlangCalls':_0x673be6[_0x2c01('0x4d')],'erlangCallToSecond':_0x673be6[_0x2c01('0x4e')],'erlangAbandonmentRate':_0x673be6[_0x2c01('0x4f')],'erlangBusyFactor':_0x673be6['erlangBusyFactor'],'startPredictive':_0x673be6['startPredictive'],'startProgressive':_0x673be6[_0x2c01('0x50')]};if(_0x673be6[_0x2c01('0x51')]){_0x2cf4b4['Trunk']={'id':_0x673be6['Trunk']['id'],'name':_0x673be6[_0x2c01('0x51')]['name'],'active':_0x673be6[_0x2c01('0x51')]['active'],'callerid':_0x673be6[_0x2c01('0x51')]['callerid']};}if(_0x673be6['Interval']){_0x2cf4b4[_0x2c01('0x52')]={'id':_0x673be6[_0x2c01('0x52')]['id'],'name':_0x673be6[_0x2c01('0x52')][_0x2c01('0x28')]};}var _0x590fa6=md5(JSON[_0x2c01('0x53')](_0x2cf4b4));if(_0x673be6[_0x2c01('0x3')]!==_0x590fa6){_0x673be6['md5']=_0x590fa6;emit(util[_0x2c01('0x54')]('voice:queue:%s',_0x2cf4b4[_0x2c01('0x28')]),_0x2c01('0x55'),_0x2cf4b4);}}}function emitVoiceQueueChannelRemove(_0x58e835){logger[_0x2c01('0x56')](_0x2c01('0x57'),JSON[_0x2c01('0x53')](_0x58e835));emit(util[_0x2c01('0x54')]('voice:queue:%s',_0x58e835[_0x2c01('0x28')]),_0x2c01('0x58'),_0x58e835);io[_0x2c01('0x26')](_0x2c01('0x59'),_0x58e835);}function notSendMessagesQueue(_0x10fe0f){if(_0x10fe0f[_0x2c01('0x5a')]){if(_0x10fe0f['originated']===0x0&&_0x10fe0f[_0x2c01('0x2b')]===0x0){_0x10fe0f['sendMessageOneNotActive']=![];_0x10fe0f['available']=0x0;_0x10fe0f[_0x2c01('0x5b')]=0x0;_0x10fe0f['message']='NOT_ACTIVE';ut['logger'](_0x2c01('0x5c'),_0x10fe0f['name']+_0x2c01('0x5d'));}else{_0x10fe0f['message']=_0x2c01('0x5e');ut[_0x2c01('0x5f')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x10fe0f[_0x2c01('0x28')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x10fe0f);}}Preview[_0x2c01('0x60')][_0x2c01('0x25')]=function(){var _0x24a005=this;setInterval(function(){_0x24a005['syncCampaigns']();},0x7cf);};Preview[_0x2c01('0x60')][_0x2c01('0x61')]=function(){var _0x1355e7=this['campaignsPreview'];this[_0x2c01('0x17')]+=0x1;for(var _0x3007b0 in _0x1355e7){if(_0x1355e7[_0x2c01('0x62')](_0x3007b0)&&(_0x1355e7[_0x3007b0][_0x2c01('0x33')]===_0x2c01('0x7')||_0x1355e7[_0x3007b0]['dialMethod']===_0x2c01('0x63'))&&_0x1355e7[_0x3007b0][_0x2c01('0x27')]===_0x2c01('0x64')){if(this['clockClearZombieChannels']>0x7){this[_0x2c01('0x17')]=0x0;this[_0x2c01('0x65')]();}}if(_0x1355e7[_0x2c01('0x62')](_0x3007b0)&&_0x1355e7[_0x3007b0][_0x2c01('0x33')]===_0x2c01('0x7')&&_0x1355e7[_0x3007b0][_0x2c01('0x27')]==='outbound'){if(_0x1355e7[_0x3007b0][_0x2c01('0x66')]){this[_0x2c01('0x67')](_0x1355e7[_0x3007b0]);if(_0x1355e7[_0x3007b0][_0x2c01('0x68')])this[_0x2c01('0x69')](_0x1355e7[_0x3007b0]);}else{notSendMessagesQueue(_0x1355e7[_0x3007b0]);}}}};Preview[_0x2c01('0x60')][_0x2c01('0x6a')]=function(_0x505b59){var _0x2a4e59=this;this[_0x2c01('0x12')]['enqueue'](function(){if(!_['isNil'](_0x2a4e59[_0x2c01('0x16')][_0x505b59])){loggerAction[_0x2c01('0x56')]('[clearZombieChannels][talking]',_0x505b59,_0x2c01('0x6b'),_0x2a4e59[_0x2c01('0x16')][_0x505b59]['queue'],_0x2c01('0x6c'),JSON[_0x2c01('0x53')](_0x2a4e59['campaignsPreview'][_0x2a4e59[_0x2c01('0x16')][_0x505b59][_0x2c01('0x6d')]][_0x2c01('0x4c')]),_0x2c01('0x6e'),JSON['stringify'](_0x2a4e59['campaignsPreview'][_0x2a4e59[_0x2c01('0x16')][_0x505b59][_0x2c01('0x6d')]][_0x2c01('0x2b')]),JSON[_0x2c01('0x53')](_0x2a4e59[_0x2c01('0x16')][_0x505b59][_0x2c01('0x6f')]),JSON[_0x2c01('0x53')](_['pick'](_0x2a4e59[_0x2c01('0x16')][_0x505b59],[_0x2c01('0x70'),_0x2c01('0x71'),_0x2c01('0x72'),_0x2c01('0x73')])));return ami[_0x2c01('0x74')]({'action':_0x2c01('0x75'),'channel':_0x2a4e59['actions'][_0x505b59][_0x2c01('0x76')]})['catch'](function(_0x2ae96e){if(_0x2ae96e['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x2a4e59['actions'][_0x505b59]){ut[_0x2c01('0x77')](_0x2a4e59[_0x2c01('0x13')][_0x2a4e59['actions'][_0x505b59][_0x2c01('0x6d')]],_0x2c01('0x78'));if(_0x2a4e59['actions'][_0x505b59][_0x2c01('0x6f')]===!![]){ut[_0x2c01('0x79')](_0x2a4e59[_0x2c01('0x13')][_0x2a4e59['actions'][_0x505b59]['queue']],'[clearZombieChannel]');ut[_0x2c01('0x7a')](_0x2c01('0x7b')+_0x505b59,_0x2a4e59[_0x2c01('0x16')][_0x505b59][_0x2c01('0x6d')]);}ut[_0x2c01('0x7a')](_0x2c01('0x7c')+_0x505b59,_0x2a4e59[_0x2c01('0x16')][_0x505b59][_0x2c01('0x6d')]);delete _0x2a4e59['actions'][_0x505b59];}},0x2328);}});}});};Preview[_0x2c01('0x60')]['clearZombieChannels']=function(){var _0x3ba714=this;loggerAction[_0x2c01('0x56')](_0x2c01('0x7d'),_[_0x2c01('0x7e')](this['actions']));for(var _0x5cb749 in this[_0x2c01('0x16')]){if(_0x3ba714[_0x2c01('0x16')]['hasOwnProperty'](_0x5cb749)){_0x3ba714[_0x2c01('0x6a')](_0x5cb749);}}};Preview[_0x2c01('0x60')]['recallMe']=function(_0xc98433){var _0x29e2de=this;rpcDb[_0x2c01('0x7f')](_0xc98433['id'],ut[_0x2c01('0x80')](this['agents']))[_0x2c01('0x81')](function(_0x5d8c47){if(!_[_0x2c01('0x82')](_0x5d8c47)){for(var _0x3d69d2=0x0;_0x3d69d2<_0x5d8c47[_0x2c01('0x83')];_0x3d69d2+=0x1){if(ut[_0x2c01('0x84')](_0x5d8c47[_0x3d69d2][_0x2c01('0x85')])<_0xc98433['dialRecallMeTimeout']*0x3c){if(_0x5d8c47[_0x3d69d2][_0x2c01('0x86')]&&!_0x5d8c47[_0x3d69d2][_0x2c01('0x86')][_0x2c01('0x87')]){_0x29e2de[_0x2c01('0x88')](_0x5d8c47[_0x3d69d2]['id'])['then'](ut[_0x2c01('0x89')](_0x2c01('0x8a')))[_0x2c01('0x8b')](ut[_0x2c01('0x89')](_0x2c01('0x8a')));}else{rpcDb[_0x2c01('0x8c')](_0x5d8c47[_0x3d69d2]['id']);}}else{var _0x1ea7f2=new Action(_0x5d8c47[_0x3d69d2],_0xc98433);_0x1ea7f2['starttime']=moment()[_0x2c01('0x54')](_0x2c01('0x8d'));_0xc98433[_0x2c01('0x3f')]+=0x1;ut['logCustomer'](_0x1ea7f2,0x17,'RecallInQueue');if(_0xc98433[_0x2c01('0x8e')]){rpcDb[_0x2c01('0x8f')](ut[_0x2c01('0x90')](_0x5d8c47[_0x3d69d2]));rpcDb[_0x2c01('0x91')](_0x1ea7f2,_0x2c01('0x92'));}else{ut[_0x2c01('0x93')](_0x1ea7f2,0x16,'RecallFailedTimeout');rpcDb[_0x2c01('0x91')](_0x1ea7f2,_0x2c01('0x94'));rpcDb[_0x2c01('0x95')](_0x1ea7f2,_0x2c01('0x94'));}}}}})[_0x2c01('0x8b')](ut['logger2']('[getContactRecallMe]'));};Preview['prototype'][_0x2c01('0x67')]=function(_0x57df2e){_0x57df2e[_0x2c01('0x5a')]=!![];if(ut[_0x2c01('0x96')](_0x57df2e['loggedIn'])){_0x57df2e[_0x2c01('0x4b')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x2c01('0x97')](_0x57df2e['dialActive'])){_0x57df2e[_0x2c01('0x4b')]=_0x2c01('0x98');}else if(!this['isTrunkReachable'](_0x57df2e[_0x2c01('0x51')])){if(!this[_0x2c01('0x99')](_0x57df2e[_0x2c01('0x9a')])){_0x57df2e[_0x2c01('0x4b')]=_0x2c01('0x9b');}else{_0x57df2e['message']=_0x2c01('0x9c');}}else{_0x57df2e[_0x2c01('0x4b')]=_0x2c01('0x9c');}emitCampaignPreview(_0x57df2e);};Preview[_0x2c01('0x60')][_0x2c01('0x9d')]=function(_0x34bd74,_0x1b0cb3,_0x44aacb){var _0x3d4797=this;var _0x3acd7f=this[_0x2c01('0x16')][_0x1b0cb3];var _0x1ab07c=this[_0x2c01('0x13')][_0x3acd7f[_0x2c01('0x6d')]];var _0x3a6f68;var _0xf9594=![];var _0x34e45a=0x2;var _0xb9fb8e=0x3;if(_0x1ab07c){switch(_0x44aacb){case'1':_0x1ab07c[_0x2c01('0x3d')]+=0x1;_0x3acd7f[_0x2c01('0x9e')]+=0x1;_0x3acd7f[_0x2c01('0x9f')]=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x0,_0x2c01('0xa1'));ami[_0x2c01('0x26')](_0x2c01('0xa2'),ut['buildObj'](_0x3acd7f,_0x2c01('0xa3')));rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xa4'));_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'0',_0x1ab07c)['then'](function(_0x5a8b5b){_0xf9594=_0x5a8b5b['additional']==0x1;_0x34e45a=_0x1ab07c[_0x2c01('0xa6')];_0xb9fb8e=_0x1ab07c['callAdditionalPhoneAfterMin'];if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut['cloneAction'](_0x3acd7f,0xf,_0x2c01('0xa8'));rpcDb[_0x2c01('0x95')](_0x3a6f68,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3acd7f[_0x2c01('0x9e')]>=_0x1ab07c[_0x2c01('0xa9')]){rpcDb['createCustomerFinal'](_0x3acd7f,_0x2c01('0xaa'));}else{rpcDb[_0x2c01('0xab')](ut[_0x2c01('0xac')](_0x3acd7f,_0x2c01('0x9e'),_0x1ab07c[_0x2c01('0xa6')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}delete this[_0x2c01('0x16')][_0x34bd74['linkedid']];}else{_0x3acd7f[_0x2c01('0x9e')]++;logger['info'](_0x2c01('0xaf'),_0x3acd7f[_0x2c01('0x9e')]);logger['info']('id',_0x3acd7f['idContact']);_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countnosuchnumberretry':_0x3acd7f[_0x2c01('0x9e')]}})[_0x2c01('0x81')](function(){_0x3d4797['swapAdditionalPhones'](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});break;case'ANSWER':var _0x388df0=moment()[_0x2c01('0x54')](_0x2c01('0x8d'));_0x3acd7f[_0x2c01('0xb2')]=_0x388df0;_0x3acd7f[_0x2c01('0xb3')]=_0x388df0;_0x3acd7f[_0x2c01('0x6f')]=!![];_0x1ab07c[_0x2c01('0x2b')]+=0x1;logger[_0x2c01('0x56')]('[syncHangup][talking][increment]',_0x3acd7f[_0x2c01('0xb4')],_0x2c01('0xb5'),_0x1ab07c['name'],'pTalking:\x20',_0x1ab07c[_0x2c01('0x2b')]);ami[_0x2c01('0x26')](_0x2c01('0xb6'),ut[_0x2c01('0xb7')](_0x3acd7f,_0x2c01('0xb8'),this[_0x2c01('0x13')][_0x3acd7f[_0x2c01('0x6d')]]));if(_0x1ab07c[_0x2c01('0xb9')]){ami[_0x2c01('0x26')](_0x2c01('0xba'),ut[_0x2c01('0xbb')](_0x3acd7f));}break;case'16':ami['emit'](_0x2c01('0xbc'),ut[_0x2c01('0xb7')](_0x3acd7f,'complete',this['campaignsPreview'][_0x3acd7f[_0x2c01('0x6d')]]));emitVoiceQueueChannelRemove(ut[_0x2c01('0xb7')](_0x3acd7f,'complete'));_0x1ab07c[_0x2c01('0xbd')]+=0x1;_0x1ab07c[_0x2c01('0x2f')]+=0x1;_0x1ab07c[_0x2c01('0xbe')]+=0x1;ut['decrementTalkink'](_0x1ab07c,_0x2c01('0xbf'));_0x3acd7f[_0x2c01('0x9f')]=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x4,_0x2c01('0xc0'));rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xc1'));rpcDb['createCustomerFinal'](_0x3acd7f,_0x2c01('0xc2'));rpcDb[_0x2c01('0xc3')](_0x3acd7f);_0x1ab07c[_0x2c01('0x2c')]+=_0x3acd7f[_0x2c01('0xc4')];_0x1ab07c[_0x2c01('0xc5')]+=_0x3acd7f[_0x2c01('0xc4')];logger[_0x2c01('0x56')]('[syncHangup][talking][decrement]',_0x3acd7f[_0x2c01('0xb4')],'\x20Queue',_0x1ab07c[_0x2c01('0x28')],_0x2c01('0x6e'),_0x1ab07c[_0x2c01('0x2b')]);delete this[_0x2c01('0x16')][_0x34bd74[_0x2c01('0xc6')]];break;case _0x2c01('0xc7'):_0x1ab07c[_0x2c01('0x38')]+=0x1;_0x3acd7f[_0x2c01('0xc8')]+=0x1;_0x3acd7f['countglobal']=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x5,_0x2c01('0xc9'));_0x34e45a=_0x1ab07c[_0x2c01('0xca')];_0xb9fb8e=_0x1ab07c[_0x2c01('0xcb')];ami[_0x2c01('0x26')](_0x2c01('0xcc'),ut[_0x2c01('0xb7')](_0x3acd7f,_0x2c01('0xcd')));rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xce'));_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'5',_0x1ab07c)[_0x2c01('0x81')](function(_0xc1e11d){_0xf9594=_0xc1e11d['additional']==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut[_0x2c01('0xcf')](_0x3acd7f,0xf,'Global');rpcDb[_0x2c01('0x95')](_0x3a6f68,_0x2c01('0xd0'));}else{if(_0x3acd7f[_0x2c01('0xc8')]>=_0x1ab07c[_0x2c01('0xd1')]){rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xce'));}else{rpcDb[_0x2c01('0xab')](ut['scheduledAt'](_0x3acd7f,'countbusyretry',_0x1ab07c[_0x2c01('0xca')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}}else{_0x3acd7f[_0x2c01('0xc8')]++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countbusyretry':_0x3acd7f[_0x2c01('0xc8')]}})[_0x2c01('0x81')](function(){_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});break;case _0x2c01('0xd3'):_0x1ab07c[_0x2c01('0x3c')]+=0x1;_0x3acd7f[_0x2c01('0xd4')]+=0x1;_0x3acd7f['countglobal']=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x3,_0x2c01('0xd5'));_0x34e45a=_0x1ab07c[_0x2c01('0xd6')];_0xb9fb8e=_0x1ab07c[_0x2c01('0xcb')];var _0x164dbc=ut['buildNoAnswerEventPayload'](_0x3acd7f,_0x1ab07c);ami[_0x2c01('0x26')](_0x2c01('0xd7'),_0x164dbc);rpcDb[_0x2c01('0x91')](_0x3acd7f,'[callProgressDetectingCustomer][logNoAnswer]');_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'3',_0x1ab07c)[_0x2c01('0x81')](function(_0x40923b){_0xf9594=_0x40923b['additional']==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut['cloneAction'](_0x3acd7f,0xf,_0x2c01('0xa8'));rpcDb[_0x2c01('0x95')](_0x3a6f68,_0x2c01('0xd8'));}else{if(_0x3acd7f['countnoanswerretry']>=_0x1ab07c[_0x2c01('0xd9')]){rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xda'));}else{rpcDb[_0x2c01('0xab')](ut['scheduledAt'](_0x3acd7f,_0x2c01('0xd4'),_0x1ab07c[_0x2c01('0xd6')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}}else{_0x3acd7f['countnoanswerretry']++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countnoanswerretry':_0x3acd7f[_0x2c01('0xd4')]}})['then'](function(){_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});break;case _0x2c01('0xdb'):_0x1ab07c[_0x2c01('0x39')]+=0x1;_0x3acd7f['countcongestionretry']+=0x1;_0x3acd7f[_0x2c01('0x9f')]=ut['totalGlobal'](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x8,_0x2c01('0xdc'));_0x34e45a=_0x1ab07c[_0x2c01('0xdd')];_0xb9fb8e=_0x1ab07c[_0x2c01('0xcb')];ami[_0x2c01('0x26')](_0x2c01('0xde'),ut['buildObj'](_0x3acd7f,_0x2c01('0xdf')));rpcDb[_0x2c01('0x91')](_0x3acd7f,'[callProgressDetectingCustomer][logCongestion]');_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'8',_0x1ab07c)['then'](function(_0x71b099){_0xf9594=_0x71b099[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut[_0x2c01('0xcf')](_0x3acd7f,0xf,_0x2c01('0xa8'));rpcDb[_0x2c01('0x95')](_0x3a6f68,_0x2c01('0xe1'));}else{if(_0x3acd7f['countcongestionretry']>=_0x1ab07c['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x3acd7f,_0x2c01('0xe2'));}else{rpcDb['rescheduleContact'](ut[_0x2c01('0xac')](_0x3acd7f,_0x2c01('0xe3'),_0x1ab07c[_0x2c01('0xca')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}}else{_0x3acd7f[_0x2c01('0xe3')]++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countcongestionretry':_0x3acd7f['countcongestionretry']}})[_0x2c01('0x81')](function(){_0x3d4797['swapAdditionalPhones'](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});break;case _0x2c01('0xe4'):_0x1ab07c['outboundRejectCallsDay']+=0x1;_0x3acd7f[_0x2c01('0xe5')]+=0x1;_0x3acd7f[_0x2c01('0x9f')]=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x14,'AgentReject');_0x34e45a=_0x1ab07c[_0x2c01('0xe6')];_0xb9fb8e=_0x1ab07c[_0x2c01('0xcb')];ami[_0x2c01('0x26')](_0x2c01('0xe7'),ut[_0x2c01('0xb7')](_0x3acd7f,_0x2c01('0xe8')));rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xe9'));_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'20',_0x1ab07c)[_0x2c01('0x81')](function(_0x461983){_0xf9594=_0x461983[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut['totalGlobal'](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut['cloneAction'](_0x3acd7f,0x14,_0x2c01('0xea'));rpcDb[_0x2c01('0x95')](_0x3a6f68,_0x2c01('0xeb'));}else{if(_0x3acd7f[_0x2c01('0xe5')]>=_0x1ab07c[_0x2c01('0xec')]){rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xeb'));}else{rpcDb[_0x2c01('0xab')](ut[_0x2c01('0xac')](_0x3acd7f,_0x2c01('0xe5'),_0x1ab07c[_0x2c01('0xe6')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}}else{_0x3acd7f[_0x2c01('0xd4')]++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countnoanswerretry':_0x3acd7f[_0x2c01('0xd4')]}})['then'](function(){_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});break;case _0x2c01('0xed'):_0x1ab07c[_0x2c01('0x41')]+=0x1;_0x3acd7f[_0x2c01('0xee')]+=0x1;_0x3acd7f[_0x2c01('0x9f')]=ut['totalGlobal'](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0xb,'Abandoned');rpcDb[_0x2c01('0x91')](_0x3acd7f,'[callProgressDetectingCustomer][logAbandoned]');_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'11',_0x1ab07c)[_0x2c01('0x81')](function(_0x233165){_0xf9594=_0x233165[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c['dialGlobalMaxRetry']){_0x3a6f68=ut[_0x2c01('0xcf')](_0x3acd7f,0xf,_0x2c01('0xa8'));rpcDb['createCustomerFinal'](_0x3a6f68,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3acd7f[_0x2c01('0xef')]>=_0x1ab07c[_0x2c01('0xf0')]){rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xf1'));}else{rpcDb[_0x2c01('0xab')](ut[_0x2c01('0xac')](_0x3acd7f,_0x2c01('0xee'),_0x1ab07c[_0x2c01('0xf2')]),_0x3acd7f[_0x2c01('0xad')],_0x3acd7f[_0x2c01('0xae')]);}}}else{_0x3acd7f[_0x2c01('0xd4')]++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f['idContact'],'field':{'countnoanswerretry':_0x3acd7f[_0x2c01('0xd4')]}})[_0x2c01('0x81')](function(){_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)['then'](function(){});});}});break;case'18':_0x1ab07c[_0x2c01('0xf3')]+=0x1;_0x3acd7f[_0x2c01('0xf4')]+=0x1;_0x3acd7f['countglobal']=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x12,_0x34bd74[_0x2c01('0xf5')]||_0x34bd74['dialstatus']);ami[_0x2c01('0x26')](_0x2c01('0xf6'),ut[_0x2c01('0xb7')](_0x3acd7f,_0x2c01('0xf7')));rpcDb[_0x2c01('0x91')](_0x3acd7f,'[callProgressDetectingCustomer][hangupInAMD]');_0x3d4797['verifyAdditionalPhones'](_0x3acd7f,'18',_0x1ab07c)[_0x2c01('0x81')](function(_0x47ad8c){_0xf9594=_0x47ad8c[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut['cloneAction'](_0x3acd7f,0x12,_0x2c01('0xa8'));rpcDb[_0x2c01('0x95')](_0x3a6f68,_0x2c01('0xf8'));}else{rpcDb[_0x2c01('0x95')](_0x3acd7f,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x3acd7f[_0x2c01('0xd4')]++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f[_0x2c01('0xb1')],'field':{'countnoanswerretry':_0x3acd7f[_0x2c01('0xd4')]}})[_0x2c01('0x81')](function(){_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});delete this[_0x2c01('0x16')][_0x34bd74[_0x2c01('0xc6')]];break;case'19':_0x1ab07c[_0x2c01('0xf3')]+=0x1;_0x3acd7f['countglobal']=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0x13,_0x34bd74[_0x2c01('0xf5')]||_0x34bd74[_0x2c01('0xf9')]);ami[_0x2c01('0x26')](_0x2c01('0xf6'),ut[_0x2c01('0xb7')](_0x3acd7f,_0x2c01('0xf7')));rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xfa'));_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'18',_0x1ab07c)[_0x2c01('0x81')](function(_0x51cdc4){_0xf9594=_0x51cdc4[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut[_0x2c01('0xa0')](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut[_0x2c01('0xcf')](_0x3acd7f,0xf,_0x2c01('0xa8'));rpcDb[_0x2c01('0x95')](_0x3a6f68,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xfa'));}}else{_0x3acd7f['countnoanswerretry']++;_0x3d4797[_0x2c01('0xb0')]({'id':_0x3acd7f['idContact'],'field':{'countnoanswerretry':_0x3acd7f[_0x2c01('0xd4')]}})[_0x2c01('0x81')](function(){_0x3d4797['swapAdditionalPhones'](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});});}});delete this[_0x2c01('0x16')][_0x34bd74[_0x2c01('0xc6')]];break;default:if(_0x3acd7f[_0x2c01('0x6f')]){ut[_0x2c01('0x79')](_0x1ab07c,_0x2c01('0xfb'));ut[_0x2c01('0x7a')](_0x2c01('0xfc')+_0x1ab07c['name'],_0x34bd74);}_0x1ab07c[_0x2c01('0xf3')]+=0x1;_0x3acd7f['countglobal']=ut[_0x2c01('0xa0')](_0x3acd7f);ut[_0x2c01('0x93')](_0x3acd7f,0xc,_0x34bd74[_0x2c01('0xf5')]||_0x34bd74[_0x2c01('0xf9')]);_0x34e45a=_0x1ab07c[_0x2c01('0xe6')];_0xb9fb8e=_0x1ab07c[_0x2c01('0xcb')];rpcDb[_0x2c01('0x91')](_0x3acd7f,_0x2c01('0xfd'));_0x3d4797[_0x2c01('0xa5')](_0x3acd7f,'20',_0x1ab07c)[_0x2c01('0x81')](function(_0x36cc2e){_0xf9594=_0x36cc2e[_0x2c01('0xe0')]==0x1;if(!_0xf9594){if(ut['totalGlobal'](_0x3acd7f)>=_0x1ab07c[_0x2c01('0xa7')]){_0x3a6f68=ut['cloneAction'](_0x3acd7f,0xf,'Global');rpcDb['createCustomerFinal'](_0x3a6f68,_0x2c01('0xfe'));}else{rpcDb[_0x2c01('0x95')](_0x3acd7f,_0x2c01('0xfe'));}delete this['actions'][_0x34bd74[_0x2c01('0xc6')]];}else{_0x3d4797[_0x2c01('0xd2')](_0x3acd7f,_0x34e45a,_0xb9fb8e)[_0x2c01('0x81')](function(){});}});}if(!(_0x3acd7f[_0x2c01('0x6f')]&&_0x44aacb==='16')){ut[_0x2c01('0x77')](_0x1ab07c,'[callProgressDetectingCustomer]');logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x3acd7f[_0x2c01('0xb4')],_0x2c01('0xb5'),_0x1ab07c[_0x2c01('0x28')],'originated:\x20',_0x1ab07c[_0x2c01('0x4c')]);}if(_0x44aacb!==_0x2c01('0xff')){delete this[_0x2c01('0x16')][_0x34bd74[_0x2c01('0xc6')]];delete this[_0x2c01('0x16')][_0x34bd74[_0x2c01('0x100')]];}}};Preview[_0x2c01('0x60')]['callProgressDetectingAgent']=function(_0x33189f,_0x99a237,_0x252ea2){if(_['isUndefined'](_0x99a237)&&_0x2c01('0x101')!==typeof _0x99a237){return;}if(_['isUndefined'](_0x252ea2)&&'object'!==typeof _0x252ea2){return;}switch(_0x252ea2['reason']){case'0':ut['logAgent'](_0x33189f,0x0,_0x2c01('0xa1'));rpcDb['createAgentHistory'](_0x33189f,_0x2c01('0x102'));break;case'3':ut['logAgent'](_0x33189f,0x3,_0x2c01('0xd5'));rpcDb[_0x2c01('0x103')](_0x33189f,_0x2c01('0x104'));break;case'5':ut['logAgent'](_0x33189f,0x5,'Busy');rpcDb[_0x2c01('0x103')](_0x33189f,_0x2c01('0x105'));break;case'8':ut[_0x2c01('0x106')](_0x33189f,0x8,'Congestion');rpcDb[_0x2c01('0x103')](_0x33189f,_0x2c01('0x107'));break;case'22':ut['logAgent'](_0x33189f,0x16,_0x2c01('0x108'));rpcDb[_0x2c01('0x103')](_0x33189f,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x33189f,0xc,_0x252ea2[_0x2c01('0x109')]);rpcDb[_0x2c01('0x103')](_0x33189f,_0x2c01('0x107'));}ut[_0x2c01('0x77')](_0x99a237,_0x2c01('0x10a'));logger[_0x2c01('0x56')](_0x2c01('0x10b'),_0x33189f[_0x2c01('0xb4')],_0x2c01('0xb5'),_0x99a237[_0x2c01('0x28')],'originated:\x20',_0x99a237[_0x2c01('0x4c')]);delete this[_0x2c01('0x16')][_0x33189f[_0x2c01('0xb4')]];};Preview['prototype'][_0x2c01('0xa5')]=function(_0x3a1dc3,_0xf279da,_0x165959){return Promise[_0x2c01('0x10c')]()['then'](cmHopperAdditionalPhone[_0x2c01('0xa5')](_0x3a1dc3,_0xf279da,_0x165959))[_0x2c01('0x8b')](logger['info'](_0x2c01('0x10d')));};Preview[_0x2c01('0x60')][_0x2c01('0xd2')]=function(_0x2644a0,_0x243cde,_0x2a2760){return Promise[_0x2c01('0x10c')]()[_0x2c01('0x81')](cmHopperAdditionalPhone[_0x2c01('0xd2')](_0x2644a0,_0x243cde,_0x2a2760))[_0x2c01('0x8b')](logger[_0x2c01('0x56')](_0x2c01('0x10e')));};Preview[_0x2c01('0x60')]['incrementPreviewCounters']=function(_0x4c3bc0){return Promise[_0x2c01('0x10c')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x4c3bc0))[_0x2c01('0x8b')](logger[_0x2c01('0x56')](_0x2c01('0x10f')));};Preview['prototype'][_0x2c01('0x110')]=function(_0xdbe177,_0x5b3989,_0x23b83a,_0x4c6c06,_0x90823c){var _0x5139b1=this;return new Promise(function(_0x17be88,_0x55bb59){if(_['isNil'](_0x5b3989)||_[_0x2c01('0x82')](_0x5b3989[_0x2c01('0x111')])||_[_0x2c01('0x82')](_0x5b3989[_0x2c01('0x112')])||_['isNil'](_0x5b3989[_0x2c01('0x72')])){_0x55bb59(ut[_0x2c01('0x4b')](_0x2c01('0x113'),_0x4c6c06,_0x90823c));return;}var _0x28312f=uuid['v4']();var _0x4919af=_0x5139b1[_0x2c01('0x13')][_0x5b3989['Queue'][_0x2c01('0x28')]];var _0x2dc335=_0x23b83a?_0x5139b1['agents'][_0x23b83a]['id']:undefined;_0x5139b1[_0x2c01('0x16')][_0x28312f]=new Action(_0x5b3989,_0x4919af,_0x28312f,_0x23b83a,_0x2dc335);var _0x32c100=_0x5139b1[_0x2c01('0x16')][_0x28312f];_0x32c100[_0x2c01('0xad')]=_0x4c6c06;_0x32c100['activeContact']=_0x90823c;_0x32c100['lookAgent']=_0x23b83a;if(_[_0x2c01('0x114')](_0xdbe177)){_0x5139b1[_0x2c01('0x115')](_0x32c100,_0x4919af,_0x5b3989,_0x23b83a)['then'](function(_0x24b216){logger[_0x2c01('0x56')]('[Preview][execCall][success]',_0x2c01('0x116')+_0x32c100[_0x2c01('0x6d')]+'\x20IdHopper:\x20'+_0x32c100[_0x2c01('0xb1')],JSON[_0x2c01('0x53')](_0x24b216));ami[_0x2c01('0x26')](_0x2c01('0x117'),ut[_0x2c01('0xb7')](_0x32c100,_0x2c01('0x118'),_0x5139b1['campaignsPreview'][_0x32c100[_0x2c01('0x6d')]]));_0x17be88(ut[_0x2c01('0x4b')](_0x2c01('0x119')));})[_0x2c01('0x8b')](function(_0x1b7709){ut[_0x2c01('0x5f')](_0x2c01('0x11a'),_0x1b7709);_0x55bb59(ut[_0x2c01('0x4b')]('Call\x20failed',_0x4c6c06,_0x90823c));});}else{_0x4919af[_0x2c01('0x37')]+=0x1;ut[_0x2c01('0x11b')](_0x32c100);rpcDb[_0x2c01('0x11c')](_0x32c100,_0x2c01('0x11d'));delete _0x5139b1['actions'][_0x28312f];_0x55bb59(ut[_0x2c01('0x4b')]('Contact\x20in\x20black\x20List',_0x4c6c06,_0x90823c));}});};Preview[_0x2c01('0x60')][_0x2c01('0x99')]=function(_0xbf8e89){return!_['isNil'](_0xbf8e89)&&!_[_0x2c01('0x82')](_0xbf8e89[_0x2c01('0x28')])&&!_[_0x2c01('0x82')](_0xbf8e89[_0x2c01('0x11e')])&&_0xbf8e89['active']&&!_[_0x2c01('0x82')](this[_0x2c01('0x15')][util[_0x2c01('0x54')]('SIP/%s',_0xbf8e89[_0x2c01('0x28')])])&&!_['isNil'](this[_0x2c01('0x15')][util[_0x2c01('0x54')](_0x2c01('0x11f'),_0xbf8e89[_0x2c01('0x28')])][_0x2c01('0x75')])&&(this[_0x2c01('0x15')][util[_0x2c01('0x54')](_0x2c01('0x11f'),_0xbf8e89[_0x2c01('0x28')])][_0x2c01('0x75')]===_0x2c01('0x120')||this[_0x2c01('0x15')][util[_0x2c01('0x54')](_0x2c01('0x11f'),_0xbf8e89[_0x2c01('0x28')])][_0x2c01('0x75')]==='unmonitored');};Preview['prototype'][_0x2c01('0x88')]=function(_0x412830,_0x15c584){var _0xff45a8=this;return new Promise(function(_0x4b0585,_0x38a78d){_0xff45a8['execRun'](_0x412830,_0x15c584)[_0x2c01('0x81')](function(_0x52e101){_0x4b0585(_[_0x2c01('0x121')](_0x52e101,['message']));})[_0x2c01('0x8b')](function(_0x3817c3){if(_0x3817c3[_0x2c01('0x122')]){rpcDb[_0x2c01('0x123')](_0x412830);}if(_0x3817c3[_0x2c01('0x11e')]){rpcDb[_0x2c01('0x8c')](_0x412830);}_0x38a78d(_[_0x2c01('0x121')](_0x3817c3,['message']));});});};Preview[_0x2c01('0x60')][_0x2c01('0x124')]=function(_0x1a4d5d,_0x1de09b){var _0x2527d7=this;return new Promise(function(_0x1ee022,_0x285162){var _0x3f440e,_0x10a061;rpcDb[_0x2c01('0x125')](_0x1a4d5d)['then'](function(_0x83043e){if(!_[_0x2c01('0x82')](_0x83043e[0x0])){_0x10a061=_0x83043e[0x0][_0x2c01('0x126')]?![]:!![];_0x3f440e=_0x83043e[0x0][_0x2c01('0x126')]?!![]:![];_0x3f440e=_0x1de09b?!![]:_0x3f440e;}var _0x98a7cb=_0x2527d7['validateContact'](_0x83043e);if(_0x98a7cb[_0x2c01('0x127')]){rpcDb[_0x2c01('0x128')](_['pick'](_0x83043e[0x0],['VoiceQueueId','phone']))['then'](function(_0x1ee79e){_0x2527d7[_0x2c01('0x110')](_0x1ee79e,_0x83043e[0x0],_0x1de09b,_0x10a061,_0x3f440e)[_0x2c01('0x81')](function(_0xc9911){_0x1ee022(_0xc9911);})[_0x2c01('0x8b')](function(_0xd1e26c){_0x285162(_0xd1e26c);});})['catch'](function(_0x55adf5){ut['logger']('[Preview][checkIsBlackList]',_0x55adf5);_0x285162(ut['message']('Call\x20unsuccessful',_0x10a061,_0x3f440e));});}else{_0x285162(ut[_0x2c01('0x4b')](_0x98a7cb['message'],_0x10a061,_0x3f440e));}})[_0x2c01('0x8b')](function(_0x3f9fdb){ut[_0x2c01('0x5f')](_0x2c01('0x129'),_0x3f9fdb);_0x285162(ut[_0x2c01('0x4b')](_0x2c01('0x12a'),![],!![]));});});};Preview[_0x2c01('0x60')][_0x2c01('0x12b')]=function(_0x4463dc){if(_[_0x2c01('0x82')](_0x4463dc)||_['isEmpty'](_0x4463dc)||!_[_0x2c01('0x82')](_0x4463dc[0x0][_0x2c01('0x86')])&&_['isNil'](_0x4463dc[0x0]['Agent'][_0x2c01('0x28')])){ut[_0x2c01('0x5f')]('[Preview][validateContact][Empty\x20Contact]',_0x4463dc);return{'isValid':![],'message':_0x2c01('0x12c')};}var _0x3b148e=this[_0x2c01('0x13')][_0x4463dc[0x0][_0x2c01('0x6b')][_0x2c01('0x28')]];_0x3b148e[_0x2c01('0x4b')]='ACTIVE';if(_[_0x2c01('0x82')](_0x3b148e)){ut['logger'](_0x2c01('0x12d'),_0x3b148e);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x2c01('0x99')](_0x3b148e['Trunk'])){ut[_0x2c01('0x5f')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x2c01('0x12e')+_0x3b148e[_0x2c01('0x28')]+_0x2c01('0x12f'));if(!this['isTrunkReachable'](_0x3b148e['TrunkBackup'])){ut['logger'](_0x2c01('0x130'),_0x3b148e[_0x2c01('0x28')]+_0x2c01('0x131'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x2c01('0x97')](_0x3b148e[_0x2c01('0x66')])){ut[_0x2c01('0x5f')](_0x2c01('0x132'),_0x3b148e['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x2c01('0x12e')+_0x3b148e[_0x2c01('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x2c01('0x133')};};Preview[_0x2c01('0x60')]['execCall']=function(_0x32e139,_0x3e6245,_0x4378b4,_0x4d4afe){var _0x1db030=this;return new Promise(function(_0x8c4772,_0x3b18d2){var _0x18a315=_0x32e139[_0x2c01('0xb4')];var _0x1a2555=_0x1db030[_0x2c01('0x99')](_0x3e6245['Trunk'])?util[_0x2c01('0x54')]('SIP/%s/%s%s',_0x3e6245[_0x2c01('0x51')][_0x2c01('0x28')],_[_0x2c01('0x82')](_0x3e6245[_0x2c01('0x35')])?'':_0x3e6245[_0x2c01('0x35')]['trim']()||'',_0x3e6245[_0x2c01('0x134')]>0x0?_0x4378b4[_0x2c01('0x112')][_0x2c01('0x135')](_0x3e6245[_0x2c01('0x134')]):_0x4378b4[_0x2c01('0x112')]):util['format'](_0x2c01('0x136'),_[_0x2c01('0x82')](_0x3e6245[_0x2c01('0x9a')])?_0x3e6245['Trunk']['name']:_0x3e6245[_0x2c01('0x9a')][_0x2c01('0x28')],_['isNil'](_0x3e6245[_0x2c01('0x35')])?'':_0x3e6245[_0x2c01('0x35')]['trim']()||'',_0x3e6245[_0x2c01('0x134')]>0x0?_0x4378b4[_0x2c01('0x112')]['substring'](_0x3e6245[_0x2c01('0x134')]):_0x4378b4[_0x2c01('0x112')]);var _0x4cafba=_0x1db030[_0x2c01('0x99')](_0x3e6245[_0x2c01('0x51')])?ut['getCallerId'](_0x3e6245[_0x2c01('0x51')]['callerid'],_0x3e6245['dialOriginateCallerIdName'],_0x3e6245[_0x2c01('0x137')]>0x0?ut[_0x2c01('0x138')](_0x3e6245[_0x2c01('0x34')],_0x3e6245['dialRandomLastDigitCallerIdNumber']):_0x3e6245[_0x2c01('0x34')]):ut[_0x2c01('0x139')](_[_0x2c01('0x82')](_0x3e6245['TrunkBackup'])?_0x3e6245['Trunk']['callerid']:_0x3e6245[_0x2c01('0x9a')][_0x2c01('0x13a')],_0x3e6245[_0x2c01('0x13b')],_0x3e6245[_0x2c01('0x137')]>0x0?ut[_0x2c01('0x138')](_0x3e6245[_0x2c01('0x34')],_0x3e6245[_0x2c01('0x137')]):_0x3e6245['dialOriginateCallerIdNumber']);if(_0x4cafba){_0x32e139['originatecalleridname']=ut['extractCalleridName'](_0x4cafba);_0x32e139[_0x2c01('0x13c')]=ut[_0x2c01('0x13d')](_0x4cafba);}var _0x1bf88f=ut['addVariables'](_0x3e6245,_0x4378b4,_0x1a2555,_0x4cafba,_0x18a315,_0x32e139);_[_0x2c01('0x13e')](_0x32e139,ut['toLowerVariables'](_0x1bf88f));_0x32e139[_0x2c01('0x13f')]=moment()[_0x2c01('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e6245['variables']=_0x1bf88f;ami[_0x2c01('0x74')](ut[_0x2c01('0x140')](_0x32e139,_0x3e6245,_0x1bf88f,_0x32e139['activeContact'],_0x4d4afe))['then'](function(_0x5f073a){_0x3e6245[_0x2c01('0x4c')]+=0x1;logger[_0x2c01('0x56')](_0x2c01('0x141'),_0x18a315,_0x2c01('0xb5'),_0x3e6245[_0x2c01('0x28')],_0x2c01('0x6c'),_0x3e6245[_0x2c01('0x4c')]);_0x8c4772(_0x5f073a);})[_0x2c01('0x8b')](function(_0x16e6d4){ut['logAgent'](_0x32e139,0xe,_0x2c01('0x142'));rpcDb[_0x2c01('0x103')](_0x32e139,_0x2c01('0x143'));_0x3b18d2(_0x16e6d4);});});};Preview[_0x2c01('0x60')][_0x2c01('0x22')]=function(_0x357983){if(this['actions'][_0x357983['linkedid']]){this[_0x2c01('0x16')][_0x357983[_0x2c01('0xc6')]][_0x2c01('0x76')]=_0x357983[_0x2c01('0x76')];}};Preview[_0x2c01('0x60')][_0x2c01('0x19')]=function(_0x4d2412){var _0x147b6e=this;var _0x4606aa=this[_0x2c01('0x16')][_0x4d2412['actionid']];if(_0x4606aa){if(_0x4606aa[_0x2c01('0x144')]&&this[_0x2c01('0x145')][_0x4606aa[_0x2c01('0x144')]]){ut['logLookAgent'](_0x4606aa,this[_0x2c01('0x145')][_0x4606aa[_0x2c01('0x144')]]['name'],this[_0x2c01('0x145')][_0x4606aa['lookAgent']]['id']);}var _0x5668bc=_['clone'](_0x4606aa);_0x5668bc[_0x2c01('0xb2')]=moment()[_0x2c01('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x231d8f=_0x147b6e[_0x2c01('0x13')][_0x4606aa[_0x2c01('0x6d')]];if(ut[_0x2c01('0x146')](_0x4d2412[_0x2c01('0x147')])){if(_0x4606aa[_0x2c01('0xad')]){rpcDb[_0x2c01('0x123')](_0x4606aa['idContact']);}if(_0x4606aa[_0x2c01('0xae')]){rpcDb[_0x2c01('0x8c')](_0x4606aa[_0x2c01('0xb1')]);}ami[_0x2c01('0x26')](_0x2c01('0x148'),ut[_0x2c01('0xb7')](_0x4606aa,_0x2c01('0x149'),this[_0x2c01('0x13')][_0x4606aa[_0x2c01('0x6d')]]));this[_0x2c01('0x14a')](_0x5668bc,_0x231d8f,_0x4d2412);}else{_0x4606aa['starttime']=moment()[_0x2c01('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x2c01('0x106')](_0x5668bc,0x4,_0x2c01('0xc0'));rpcDb['createAgentHistory'](_0x5668bc,_0x2c01('0x14b'));}}};Preview[_0x2c01('0x60')][_0x2c01('0x1b')]=function(_0x5ce4f2){var _0xf14fcf=this[_0x2c01('0x16')][_0x5ce4f2[_0x2c01('0xc6')]];var _0x7dc37a;if(_0xf14fcf){_0x7dc37a=this[_0x2c01('0x13')][_0xf14fcf[_0x2c01('0x6d')]];logger[_0x2c01('0x56')](_0x2c01('0x14c'),_0x5ce4f2[_0x2c01('0xc6')],'\x20Queue',_0x7dc37a[_0x2c01('0x28')],'pTalking:\x20',_0x7dc37a[_0x2c01('0x2b')]);}if(this[_0x2c01('0x16')][_0x5ce4f2[_0x2c01('0xc6')]]&&_0x5ce4f2['linkedid']!==_0x5ce4f2['uniqueid']){if(_0x5ce4f2[_0x2c01('0x14d')]==='16'&&this[_0x2c01('0x16')][_0x5ce4f2[_0x2c01('0xc6')]][_0x2c01('0x6f')]){this['callProgressDetectingCustomer'](_0x5ce4f2,_0x5ce4f2[_0x2c01('0xc6')],_0x5ce4f2[_0x2c01('0x14d')]);}else if(this[_0x2c01('0x16')][_0x5ce4f2[_0x2c01('0xc6')]][_0x2c01('0x6f')]){logger[_0x2c01('0x56')](_0x2c01('0x14e'),_0x5ce4f2[_0x2c01('0xc6')],_0x5ce4f2[_0x2c01('0x14d')],_0x2c01('0xb5'),_0x7dc37a[_0x2c01('0x28')],_0x2c01('0x6e'),_0x7dc37a[_0x2c01('0x2b')]);this[_0x2c01('0x9d')](_0x5ce4f2,_0x5ce4f2[_0x2c01('0xc6')],_0x5ce4f2[_0x2c01('0x14d')]);}}else if(_0xf14fcf&&_[_0x2c01('0x82')](_0xf14fcf[_0x2c01('0x14f')])&&_0x7dc37a['dialQueueProject']&&_0x5ce4f2['linkedid']===_0x5ce4f2['uniqueid']&&_[_0x2c01('0x82')](_0x5ce4f2['reason'])&&_0x5ce4f2['cause']==='16'&&_0x5ce4f2[_0x2c01('0x150')]==='6'&&_[_0x2c01('0x151')](_0xf14fcf[_0x2c01('0x152')])){if(_0xf14fcf['unlockAgent']){rpcDb['unlockContact'](_0xf14fcf[_0x2c01('0xb1')]);}if(_0xf14fcf['activeContact']){rpcDb[_0x2c01('0x8c')](_0xf14fcf['idContact']);}_0x5ce4f2[_0x2c01('0x109')]='22';this['callProgressDetectingAgent'](_0xf14fcf,_0x7dc37a,_0x5ce4f2);}else if(_0xf14fcf&&_0xf14fcf[_0x2c01('0x152')]){if(_0x5ce4f2[_0x2c01('0x14d')]==='16'&&this[_0x2c01('0x16')][_0x5ce4f2['linkedid']][_0x2c01('0x6f')]){logger[_0x2c01('0x56')]('[syncHangup][talking][transfer]',_0x5ce4f2[_0x2c01('0xc6')],_0x5ce4f2[_0x2c01('0x14d')],_0x2c01('0xb5'),_0x7dc37a['name'],_0x2c01('0x6e'),_0x7dc37a[_0x2c01('0x2b')]);this[_0x2c01('0x9d')](_0x5ce4f2,_0x5ce4f2['linkedid'],_0x5ce4f2['cause']);}else if(this[_0x2c01('0x16')][_0x5ce4f2[_0x2c01('0xc6')]][_0x2c01('0x6f')]){logger[_0x2c01('0x56')]('[syncHangup][talking][cause]',_0x5ce4f2['linkedid'],_0x5ce4f2[_0x2c01('0x14d')],_0x2c01('0xb5'),_0x7dc37a[_0x2c01('0x28')],_0x2c01('0x6e'),_0x7dc37a[_0x2c01('0x2b')]);this[_0x2c01('0x9d')](_0x5ce4f2,_0x5ce4f2[_0x2c01('0xc6')],_0x5ce4f2[_0x2c01('0x14d')]);}}};Preview['prototype'][_0x2c01('0x20')]=function(_0x230112){if(this[_0x2c01('0x16')][_0x230112['destlinkedid']]&&_0x230112[_0x2c01('0x100')]!==_0x230112[_0x2c01('0x153')]){this[_0x2c01('0x9d')](_0x230112,_0x230112[_0x2c01('0x100')],_0x230112[_0x2c01('0xf9')]);}};Preview[_0x2c01('0x60')][_0x2c01('0x1d')]=function(_0x13cc1f){if(this['actions'][_0x13cc1f[_0x2c01('0xc6')]]&&_0x13cc1f[_0x2c01('0xc6')]!==_0x13cc1f['uniqueid']&&!this[_0x2c01('0x16')][_0x13cc1f[_0x2c01('0xc6')]][_0x2c01('0x6f')]){if(_0x13cc1f[_0x2c01('0x14d')]==='1'){this['callProgressDetectingCustomer'](_0x13cc1f,_0x13cc1f['linkedid'],_0x13cc1f['cause']);}}};Preview[_0x2c01('0x60')][_0x2c01('0x154')]=function(_0x46eaba,_0x4bd3b1,_0x1c8282){if(this[_0x2c01('0x16')][_0x46eaba]){if(_[_0x2c01('0x82')](this['actions'][_0x46eaba]['variables'])){this[_0x2c01('0x16')][_0x46eaba]['variables']={};}this['actions'][_0x46eaba]['variables'][_0x4bd3b1]=_0x1c8282;}};Preview['prototype'][_0x2c01('0x155')]=function(_0x39ac9c){try{if(!_['isNil'](_0x39ac9c)){if(ut[_0x2c01('0x156')](_['keys'](_0x39ac9c['variable'])[0x0])){this[_0x2c01('0x154')](_0x39ac9c[_0x2c01('0xb4')],_[_0x2c01('0x157')](_0x39ac9c['variable'])[0x0],_0x39ac9c[_0x2c01('0x158')]);}}}catch(_0x3fae05){logger[_0x2c01('0x159')](_0x2c01('0x15a'),util[_0x2c01('0x15b')](_0x3fae05,{'showHidden':![],'depth':null}));}};Preview[_0x2c01('0x60')][_0x2c01('0x23')]=function(_0x16667f){if(_0x16667f){if(this[_0x2c01('0x16')][_0x16667f[_0x2c01('0x15c')]]){this[_0x2c01('0x16')][_0x16667f[_0x2c01('0x15c')]][_0x2c01('0x152')]=!![];}}};Preview[_0x2c01('0x60')][_0x2c01('0x15d')]=function(_0x398278){if(_0x398278){if(this['actions'][_0x398278[_0x2c01('0x15e')]]){this[_0x2c01('0x16')][_0x398278[_0x2c01('0x15e')]][_0x2c01('0x152')]=!![];}}};module[_0x2c01('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8eec20b..c38b828 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 _0xe166=['queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','membername','context','exten','xcally-motion-preview','assigned'];(function(_0x527c39,_0x3ea2a6){var _0x3f4dd6=function(_0x1ec265){while(--_0x1ec265){_0x527c39['push'](_0x527c39['shift']());}};_0x3f4dd6(++_0x3ea2a6);}(_0xe166,0xa8));var _0x6e16=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe166[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var BPromise=require(_0x6e16('0x0'));var logger=require('../../../config/logger')(_0x6e16('0x1'));var _=require(_0x6e16('0x2'));var cmHopper=require(_0x6e16('0x3'));var cmHopperFinal=require(_0x6e16('0x4'));var cmHopperHistory=require(_0x6e16('0x5'));var cmHopperBlack=require(_0x6e16('0x6'));var voiceQueueRt=require(_0x6e16('0x7'));var agentReportPreview=require(_0x6e16('0x8'));var voiceQueueReport=require(_0x6e16('0x9'));function loggerCatch(_0x4d7816){return function(_0x124eca){logger[_0x6e16('0xa')](_0x4d7816,util[_0x6e16('0xb')](_0x124eca,{'showHidden':![],'depth':null}));};}function create(_0x422672){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopperHistory[_0x6e16('0xe')](_0x422672))['catch'](loggerCatch(_0x6e16('0xf')));}function createAgent(_0x1a720e){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](agentReportPreview[_0x6e16('0xe')](_0x1a720e))[_0x6e16('0x10')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5e6cb0){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper[_0x6e16('0x11')](_0x5e6cb0,!![]))[_0x6e16('0x10')](loggerCatch(_0x6e16('0x12')));}exports['checkIsBlackList']=function(_0x157e7e){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopperBlack[_0x6e16('0x13')](_0x157e7e))[_0x6e16('0x10')](loggerCatch(_0x6e16('0x14')));};exports['getContactPreview']=function(_0xfb8b31){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper['getContactPreview'](_0xfb8b31))[_0x6e16('0x10')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6e16('0xe')]=function(_0x1c5aa4,_0x5a2c82){create(_0x1c5aa4)[_0x6e16('0x10')](loggerCatch(_0x5a2c82));moveContact(_0x1c5aa4)[_0x6e16('0x10')](loggerCatch(_0x5a2c82));};exports[_0x6e16('0x15')]=function(_0x2e2cf9,_0x303683){createAgent(_0x2e2cf9)[_0x6e16('0x10')](loggerCatch(_0x303683));};exports[_0x6e16('0x16')]=function(_0xfa5235,_0x28a753){create(_0xfa5235)['catch'](loggerCatch(_0x28a753));};exports[_0x6e16('0x17')]=function(_0xaf9898,_0x3b106b){moveContact(_0xaf9898)['catch'](loggerCatch(_0x3b106b));};exports[_0x6e16('0x18')]=function(_0x5bbf6f,_0x129157,_0x8b1821){if(_0x129157){_0x5bbf6f[_0x6e16('0x19')]=null;}if(_0x8b1821){_0x5bbf6f[_0x6e16('0x1a')]=![];}return BPromise[_0x6e16('0xc')]()['then'](cmHopper['rescheduleContact'](_0x5bbf6f))['catch'](loggerCatch(_0x6e16('0x1b')));};exports[_0x6e16('0x1c')]=function(_0x2bd01c){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper['countReScheduled'](_0x2bd01c))[_0x6e16('0x10')](loggerCatch('[countReScheduled]\x20'));};exports[_0x6e16('0x1d')]=function(_0x72340){return BPromise['resolve']()['then'](cmHopper[_0x6e16('0x1d')]({'UserId':null},_0x72340,0x1))[_0x6e16('0x10')](loggerCatch(_0x6e16('0x1e')));};exports[_0x6e16('0x1f')]=function(_0x437c4c){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper[_0x6e16('0x1d')]({'active':![]},_0x437c4c,0x1))[_0x6e16('0x10')](loggerCatch(_0x6e16('0x20')));};exports[_0x6e16('0x21')]=function(_0x107e5a){var _0x42842b={};_0x42842b[_0x6e16('0x22')]=_0x107e5a[_0x6e16('0x22')];_0x42842b['uniqueid']=_0x107e5a[_0x6e16('0x23')];_0x42842b[_0x6e16('0x24')]=_0x107e5a['calleridnum'];_0x42842b[_0x6e16('0x25')]=_0x107e5a[_0x6e16('0x25')];_0x42842b[_0x6e16('0x26')]=_0x107e5a[_0x6e16('0x26')];_0x42842b[_0x6e16('0x27')]=_0x107e5a[_0x6e16('0x28')];_0x42842b['queuecallerleaveAt']=_0x107e5a[_0x6e16('0x28')];_0x42842b[_0x6e16('0x29')]=0x1;_0x42842b[_0x6e16('0x2a')]=_0x107e5a['endtime'];_0x42842b['connectedlinename']=_0x107e5a[_0x6e16('0x2b')];_0x42842b[_0x6e16('0x2c')]='from-sip';_0x42842b[_0x6e16('0x2d')]=_0x6e16('0x2e');_0x42842b['holdtime']=0x0;_0x42842b[_0x6e16('0x2f')]=0x1;_0x42842b['lastAssignedTo']=_0x107e5a[_0x6e16('0x2b')];_0x42842b[_0x6e16('0x30')]=_0x6e16('0x31');return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](voiceQueueReport[_0x6e16('0x32')](_0x42842b))['catch'](loggerCatch(_0x6e16('0x33')));};exports[_0x6e16('0x34')]=function(_0x243453,_0x47e949){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper[_0x6e16('0x34')](_0x243453,_0x47e949))['catch'](loggerCatch(_0x6e16('0x35')));};exports['rescheduleContactInQueue']=function(_0x3ea7a1){return BPromise[_0x6e16('0xc')]()[_0x6e16('0xd')](cmHopper[_0x6e16('0x18')](_0x3ea7a1,!![],!![]))[_0x6e16('0x10')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd154=['crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0xd154,0x8d));var _0x4d15=function(_0x27de67,_0x570087){_0x27de67=_0x27de67-0x0;var _0x4fac01=_0xd154[_0x27de67];return _0x4fac01;};'use strict';var util=require('util');var BPromise=require(_0x4d15('0x0'));var logger=require(_0x4d15('0x1'))(_0x4d15('0x2'));var _=require(_0x4d15('0x3'));var cmHopper=require(_0x4d15('0x4'));var cmHopperFinal=require(_0x4d15('0x5'));var cmHopperHistory=require(_0x4d15('0x6'));var cmHopperBlack=require(_0x4d15('0x7'));var voiceQueueRt=require(_0x4d15('0x8'));var agentReportPreview=require(_0x4d15('0x9'));var voiceQueueReport=require(_0x4d15('0xa'));function loggerCatch(_0xedf33){return function(_0x599f56){logger[_0x4d15('0xb')](_0xedf33,util['inspect'](_0x599f56,{'showHidden':![],'depth':null}));};}function create(_0x4b95c6){return BPromise[_0x4d15('0xc')]()['then'](cmHopperHistory[_0x4d15('0xd')](_0x4b95c6))[_0x4d15('0xe')](loggerCatch(_0x4d15('0xf')));}function createAgent(_0x763a7f){return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](agentReportPreview[_0x4d15('0xd')](_0x763a7f))[_0x4d15('0xe')](loggerCatch(_0x4d15('0xf')));}function moveContact(_0x4213ae){return BPromise[_0x4d15('0xc')]()['then'](cmHopper[_0x4d15('0x11')](_0x4213ae,!![]))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x12')));}exports[_0x4d15('0x13')]=function(_0x20d2ae){return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](cmHopperBlack[_0x4d15('0x13')](_0x20d2ae))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x14')));};exports['getContactPreview']=function(_0x31b4b9){return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](cmHopper['getContactPreview'](_0x31b4b9))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x15')));};exports[_0x4d15('0xd')]=function(_0x34a923,_0x5d7f11){create(_0x34a923)['catch'](loggerCatch(_0x5d7f11));moveContact(_0x34a923)[_0x4d15('0xe')](loggerCatch(_0x5d7f11));};exports['createAgentHistory']=function(_0x51308e,_0x5ea6a4){createAgent(_0x51308e)[_0x4d15('0xe')](loggerCatch(_0x5ea6a4));};exports[_0x4d15('0x16')]=function(_0x587b18,_0x18f4bf){create(_0x587b18)['catch'](loggerCatch(_0x18f4bf));};exports['createCustomerFinal']=function(_0x37abee,_0x123b83){moveContact(_0x37abee)[_0x4d15('0xe')](loggerCatch(_0x123b83));};exports['rescheduleContact']=function(_0x3e99c4,_0x303900,_0x3f207f){if(_0x303900){_0x3e99c4['UserId']=null;}if(_0x3f207f){_0x3e99c4['active']=![];}return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](cmHopper[_0x4d15('0x17')](_0x3e99c4))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x18')));};exports[_0x4d15('0x19')]=function(_0x2e3493){return BPromise['resolve']()[_0x4d15('0x10')](cmHopper[_0x4d15('0x19')](_0x2e3493))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x1a')));};exports[_0x4d15('0x1b')]=function(_0xd3d36b){return BPromise['resolve']()[_0x4d15('0x10')](cmHopper[_0x4d15('0x1b')]({'UserId':null},_0xd3d36b,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x4d15('0x1c')]=function(_0x150357){return BPromise[_0x4d15('0xc')]()['then'](cmHopper[_0x4d15('0x1b')]({'active':![]},_0x150357,0x1))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x1d')));};exports[_0x4d15('0x1e')]=function(_0x5201dd){var _0x43a605={};_0x43a605[_0x4d15('0x1f')]=_0x5201dd[_0x4d15('0x1f')];_0x43a605[_0x4d15('0x20')]=_0x5201dd[_0x4d15('0x20')];_0x43a605[_0x4d15('0x21')]=_0x5201dd[_0x4d15('0x21')];_0x43a605[_0x4d15('0x22')]=_0x5201dd['calleridname'];_0x43a605[_0x4d15('0x23')]=_0x5201dd[_0x4d15('0x23')];_0x43a605[_0x4d15('0x24')]=_0x5201dd[_0x4d15('0x25')];_0x43a605[_0x4d15('0x26')]=_0x5201dd['answertime'];_0x43a605[_0x4d15('0x27')]=0x1;_0x43a605[_0x4d15('0x28')]=_0x5201dd[_0x4d15('0x29')];_0x43a605[_0x4d15('0x2a')]=_0x5201dd[_0x4d15('0x2b')];_0x43a605[_0x4d15('0x2c')]=_0x4d15('0x2d');_0x43a605[_0x4d15('0x2e')]=_0x4d15('0x2f');_0x43a605[_0x4d15('0x30')]=0x0;_0x43a605[_0x4d15('0x31')]=0x1;_0x43a605['lastAssignedTo']=_0x5201dd['membername'];_0x43a605[_0x4d15('0x32')]=_0x4d15('0x33');return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](voiceQueueReport['create'](_0x43a605))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x34')));};exports[_0x4d15('0x35')]=function(_0x494edc,_0x29ffb2){return BPromise['resolve']()[_0x4d15('0x10')](cmHopper[_0x4d15('0x35')](_0x494edc,_0x29ffb2))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x36')));};exports[_0x4d15('0x37')]=function(_0x3abf24){return BPromise[_0x4d15('0xc')]()[_0x4d15('0x10')](cmHopper[_0x4d15('0x17')](_0x3abf24,!![],!![]))[_0x4d15('0xe')](loggerCatch(_0x4d15('0x38')));}; \ 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 e00ec7b..afcc19f 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 _0xe296=['diff','loggerCatch','inspect','logger','error','logger2','info','message','getCallerId','string','isUndefined','format','\x22%s\x22\x20<%s>','isEmpty','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','XMD-','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','ringtime','logLookAgent','membername','state','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countnoanswerretry','clone','Global','scheduledAt','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','IsNotLoggedIn','queue','interface','motionChannel','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','push','getDiff','seconds','CampaignId','filterKey','type','campaigntype','scheduledat','countcongestionretry','countglobal','callback','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','keys','forEach','toLowerCase','variables','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe296,0x84));var _0x6e29=function(_0x1f28bb,_0x263b59){_0x1f28bb=_0x1f28bb-0x0;var _0x4be47c=_0xe296[_0x1f28bb];return _0x4be47c;};'use strict';var util=require(_0x6e29('0x0'));var _=require(_0x6e29('0x1'));var moment=require(_0x6e29('0x2'));var logger=require(_0x6e29('0x3'))(_0x6e29('0x4'));var ipAgi=process[_0x6e29('0x5')][_0x6e29('0x6')]||_0x6e29('0x7');function getSeconds(_0x4707ba,_0x46ee90){var _0x235fed=moment(_0x4707ba)['milliseconds'](0x0);var _0x2f5aea=moment(_0x46ee90)[_0x6e29('0x8')](0x0);return _0x235fed[_0x6e29('0x9')](_0x2f5aea,'seconds');}exports[_0x6e29('0xa')]=function(_0x1aa2c2){return function(_0x3d0a66){logger['error'](_0x1aa2c2,util[_0x6e29('0xb')](_0x3d0a66,{'showHidden':![],'depth':null}));};};exports[_0x6e29('0xc')]=function(_0x2f7c69,_0x4c33d4){logger['info'](_0x2f7c69,util[_0x6e29('0xb')](_0x4c33d4,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x25575e,_0x50803d){logger[_0x6e29('0xd')](_0x25575e,util[_0x6e29('0xb')](_0x50803d,{'showHidden':![],'depth':null}));};exports[_0x6e29('0xe')]=function(_0x529fc7){return function(_0x36b6b2){logger[_0x6e29('0xf')](_0x529fc7,util[_0x6e29('0xb')](_0x36b6b2,{'showHidden':![],'depth':null}));};};exports[_0x6e29('0x10')]=function(_0x5d80e0,_0x53978f,_0x19dfea){return{'message':_0x5d80e0,'unlock':_0x53978f,'active':_0x19dfea};};exports[_0x6e29('0x11')]=function(_0x5e9a07,_0x45beb8,_0x2c0ee9){if(!_['isUndefined'](_0x2c0ee9)&&_0x6e29('0x12')===typeof _0x2c0ee9&&!_['isEmpty'](_0x2c0ee9)){if(!_[_0x6e29('0x13')](_0x45beb8)&&'string'===typeof _0x45beb8&&!_['isEmpty'](_0x45beb8)){return util[_0x6e29('0x14')]('\x22%s\x22\x20<%s>',_0x45beb8,_0x2c0ee9);}return util['format'](_0x6e29('0x15'),_0x2c0ee9,_0x2c0ee9);}if(!_['isUndefined'](_0x5e9a07)&&_0x6e29('0x12')===typeof _0x5e9a07&&!_[_0x6e29('0x16')](_0x5e9a07)){return _0x5e9a07;}return'\x22\x22\x20<>';};exports[_0x6e29('0x17')]=function(_0x2448b4){if(_[_0x6e29('0x18')](_0x2448b4)){return![];}return _0x2448b4;};exports[_0x6e29('0x19')]=function(_0x131f59,_0x3d69fb,_0x2eed73,_0xf518e5,_0x1648b2,_0x10de3e){var _0x357881={'XMD-QUEUE':_0x3d69fb[_0x6e29('0x1a')]?_0x3d69fb[_0x6e29('0x1a')][_0x6e29('0x1b')]:'','XMD-CALLERID':_0xf518e5,'XMD-CALLERID-PREVIEW':_0x10de3e?util['format']('\x22%s\x22\x20<%s>',_0x10de3e[_0x6e29('0x1c')],_0x10de3e[_0x6e29('0x1d')]):_0xf518e5,'XMD-DIALID':_0x1648b2,'XMD-CONTACTID':_0x3d69fb[_0x6e29('0x1e')],'XMD-CDRTYPE':_0x6e29('0x1f'),'CALLERID(all)':_0xf518e5,'XMD-VOICEQUEUEID':_0x3d69fb['VoiceQueueId'],'XMD-DIALCHANNEL':_0x2eed73,'XMD-DIALTIMEOUT':_0x131f59[_0x6e29('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x6e29('0x14')](_0x6e29('0x21'),_0x131f59[_0x6e29('0x22')]?'g':'',_[_0x6e29('0x16')](_0x131f59[_0x6e29('0x23')])?'':_0x6e29('0x24')),'XMD-DIALURL':_0x131f59[_0x6e29('0x25')]||'','XMD-AGI':_0x131f59[_0x6e29('0x26')]?util[_0x6e29('0x14')](_0x6e29('0x27'),ipAgi,_0x131f59[_0x6e29('0x26')]):_0x6e29('0x28'),'XMD-AGIAFTER':_0x131f59[_0x6e29('0x22')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x131f59['dialQueueProject2']):_0x6e29('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x10de3e?_0x10de3e['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x10de3e?_0x10de3e[_0x6e29('0x29')]:'','XMD-DESTINATION':_0x6e29('0x2a'),'SIPADDHEADER':_0x6e29('0x2b')};if(!_[_0x6e29('0x16')](_0x131f59[_0x6e29('0x23')])){_0x357881[util[_0x6e29('0x14')]('%s',_0x6e29('0x2c'))]=_0x131f59['monitor_format'];_0x357881[util[_0x6e29('0x14')]('%s',_0x6e29('0x2d'))]=_0x1648b2;}if(_0x3d69fb&&_0x3d69fb[_0x6e29('0x2e')]){for(var _0x503a0a in _0x3d69fb[_0x6e29('0x2e')]){if(_0x3d69fb[_0x6e29('0x2e')]['hasOwnProperty'](_0x503a0a)){if(!_[_0x6e29('0x18')](_0x3d69fb['Contact'][_0x503a0a])&&_0x503a0a!=='id'&&_0x503a0a!==_0x6e29('0x2f')&&_0x503a0a!==_0x6e29('0x30')&&_0x503a0a!=='updatedAt'){_0x357881[util[_0x6e29('0x14')]('%s%s',_0x6e29('0x31'),_['toUpper'](_0x503a0a))]=_0x3d69fb['Contact'][_0x503a0a];}}}}return _0x357881;};exports[_0x6e29('0x32')]=function(_0x5be71a){var _0x166875={};for(var _0x72c938 in _0x5be71a){if(_0x5be71a[_0x6e29('0x33')](_0x72c938)){_0x166875[util[_0x6e29('0x14')]('%s',_[_0x6e29('0x34')](_0x72c938))]=_0x5be71a[_0x72c938];}}return{'variables':_0x166875};};exports[_0x6e29('0x35')]=function(_0x194742,_0x5bf1c3){if(!_['isNil'](_0x194742)){if(_0x194742[_0x6e29('0x33')](_0x6e29('0x36'))){if(_0x194742['originated']>0x0){_0x194742[_0x6e29('0x36')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5bf1c3);}}}else{logger[_0x6e29('0xd')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5bf1c3);}};exports['logBlacklist']=function(_0x272056){var _0x3198aa=moment()['format'](_0x6e29('0x37'));_0x272056['state']=0xd;_0x272056[_0x6e29('0x38')]=_0x6e29('0x39');_0x272056[_0x6e29('0x3a')]=_0x3198aa;_0x272056[_0x6e29('0x3b')]=_0x3198aa;_0x272056[_0x6e29('0x3c')]=_0x3198aa;};exports['logAgent']=function(_0x3cc8c2,_0x313bf8,_0x1bbbee){var _0x1f10f9=moment()[_0x6e29('0x14')](_0x6e29('0x37'));_0x3cc8c2['state']=_0x313bf8;_0x3cc8c2[_0x6e29('0x38')]=_0x1bbbee;_0x3cc8c2[_0x6e29('0x3b')]=_0x1f10f9;_0x3cc8c2[_0x6e29('0x3d')]=getSeconds(_0x3cc8c2[_0x6e29('0x3b')],_0x3cc8c2[_0x6e29('0x3a')]);};exports[_0x6e29('0x3e')]=function(_0x2190c9,_0x1fd1c9,_0x2270ad){_0x2190c9[_0x6e29('0x3f')]=_0x1fd1c9;_0x2190c9['UserId']=_0x2270ad;};exports['logCustomer']=function(_0x252645,_0x4fcc93,_0x1d8cd6){var _0x5c0375=moment()[_0x6e29('0x14')](_0x6e29('0x37'));_0x252645[_0x6e29('0x40')]=_0x4fcc93;_0x252645[_0x6e29('0x38')]=_0x1d8cd6;_0x252645[_0x6e29('0x3b')]=_0x252645['responsetime']?_0x252645[_0x6e29('0x3b')]:_0x5c0375;_0x252645[_0x6e29('0x3c')]=_0x252645[_0x6e29('0x3c')]?_0x252645[_0x6e29('0x3c')]:_0x5c0375;_0x252645[_0x6e29('0x3d')]=getSeconds(_0x252645[_0x6e29('0x3b')]||0x0,_0x252645[_0x6e29('0x3a')]||0x0);_0x252645[_0x6e29('0x41')]=_0x252645[_0x6e29('0x42')]?getSeconds(_0x252645[_0x6e29('0x3c')],_0x252645[_0x6e29('0x42')]):0x0;};exports[_0x6e29('0x43')]=function(_0x4b5310){return _0x4b5310==='Failure';};exports[_0x6e29('0x44')]=function(_0x46eb54,_0x24bce0,_0x419032,_0x435893,_0x3a9618){var _0x27ab48=_0x435893?_0x6e29('0x45'):_0x46eb54[_0x6e29('0x1c')];_0x27ab48=_0x3a9618?_0x6e29('0x46'):_0x27ab48;return{'actionid':_0x46eb54[_0x6e29('0x47')],'action':'originate','channel':_0x46eb54[_0x6e29('0x48')],'callerid':util[_0x6e29('0x14')](_0x6e29('0x15'),_0x27ab48,_0x46eb54[_0x6e29('0x1d')]),'Exten':_0x6e29('0x2a'),'Context':_0x6e29('0x49'),'Priority':'1','variable':_0x419032,'timeout':(_0x24bce0[_0x6e29('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x46eb54[_0x6e29('0x47')]};};exports['totalGlobal']=function(_0x28de50){return _0x28de50[_0x6e29('0x4b')]+_0x28de50['countcongestionretry']+_0x28de50[_0x6e29('0x4c')]+_0x28de50['countagentrejectretry']+_0x28de50['countnosuchnumberretry'];};exports['cloneAction']=function(_0x43f9dc){var _0x42dbac=_[_0x6e29('0x4d')](_0x43f9dc);_0x42dbac[_0x6e29('0x40')]=0xf;_0x42dbac['statedesc']=_0x6e29('0x4e');return _0x42dbac;};exports[_0x6e29('0x4f')]=function(_0x1226fd,_0x3ea3fd,_0x5496e1){var _0x1ee84={};_0x1ee84[_0x3ea3fd]=_0x1226fd[_0x3ea3fd];_0x1ee84[_0x6e29('0x50')]=![];_0x1ee84['scheduledat']=moment()[_0x6e29('0x51')](_0x5496e1,_0x6e29('0x52'))[_0x6e29('0x14')](_0x6e29('0x37'));_0x1ee84['ContactId']=_0x1226fd[_0x6e29('0x1e')];_0x1ee84[_0x6e29('0x53')]=_0x1226fd['ListId'];_0x1ee84[_0x6e29('0x54')]=_0x1226fd[_0x6e29('0x54')]||undefined;return _0x1ee84;};exports[_0x6e29('0x55')]=function(_0xbe2a2c,_0x5f210e){if(!_[_0x6e29('0x18')](_0xbe2a2c)){if(_0xbe2a2c['pTalking']>0x0){_0xbe2a2c['pTalking']-=0x1;}else{logger[_0x6e29('0xd')](_0x5f210e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x6e29('0xd')](_0x5f210e,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x6e29('0x56')]=function(_0x2fa49b){if(_0x2fa49b<=0x0){return!![];}return![];};function buildObj(_0x5d555c,_0x30b307,_0x5751d7){_0x5d555c['lastevent']=_0x30b307;_0x5d555c['name']=_0x5d555c[_0x6e29('0x57')];_0x5d555c[_0x6e29('0x58')]=_0x5d555c[_0x6e29('0x48')];_0x5d555c[_0x6e29('0x59')]=_0x6e29('0x5a');if(_0x5751d7){_0x5d555c['mandatoryDisposition']=_0x5751d7[_0x6e29('0x5b')];}return _0x5d555c;}exports['buildObj']=buildObj;exports[_0x6e29('0x5c')]=function(_0x43d1ff){var _0x4e4743={};_0x4e4743[_0x6e29('0x57')]=_0x43d1ff[_0x6e29('0x57')];_0x4e4743[_0x6e29('0x58')]=_0x43d1ff[_0x6e29('0x48')];_0x4e4743[_0x6e29('0x47')]=_0x43d1ff[_0x6e29('0x47')];return _0x4e4743;};exports[_0x6e29('0x5d')]=function(_0x423df1){var _0x2ef9d1=[];for(var _0x1d4a79 in _0x423df1){if(_0x423df1['hasOwnProperty'](_0x1d4a79)){if(!_[_0x6e29('0x18')](_0x423df1[_0x1d4a79])&&_0x423df1[_0x1d4a79][_0x6e29('0x40')]===_0x6e29('0x5e')&&_0x423df1[_0x1d4a79][_0x6e29('0x5f')]==='reachable'){_0x2ef9d1[_0x6e29('0x60')](_0x423df1[_0x1d4a79]['id']);}}}return _0x2ef9d1;};exports[_0x6e29('0x61')]=function(_0x4e63ce){var _0x15d739=moment()[_0x6e29('0x8')](0x0);var _0x277bfb=moment(_0x4e63ce)['milliseconds'](0x0);return _0x15d739['diff'](_0x277bfb,_0x6e29('0x62'));};exports['createBody']=function(_0x32796e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x32796e['ContactId'],'ListId':_0x32796e[_0x6e29('0x53')],'VoiceQueueId':_0x32796e[_0x6e29('0x54')]||undefined,'CampaignId':_0x32796e[_0x6e29('0x63')]||undefined};};exports[_0x6e29('0x64')]=function(_0xef8c69){if(_0xef8c69===_0x6e29('0x47')||_0xef8c69==='idContact'||_0xef8c69===_0x6e29('0x57')||_0xef8c69===_0x6e29('0x65')||_0xef8c69===_0x6e29('0x66')||_0xef8c69==='dialAnswer'||_0xef8c69===_0x6e29('0x3f')||_0xef8c69===_0x6e29('0x48')||_0xef8c69==='calleridname'||_0xef8c69==='active'||_0xef8c69==='calleridnum'||_0xef8c69===_0x6e29('0x67')||_0xef8c69==='countbusyretry'||_0xef8c69===_0x6e29('0x68')||_0xef8c69===_0x6e29('0x4c')||_0xef8c69===_0x6e29('0x69')||_0xef8c69===_0x6e29('0x6a')||_0xef8c69==='callbackuniqueid'||_0xef8c69===_0x6e29('0x6b')||_0xef8c69==='recallme'||_0xef8c69==='ContactId'||_0xef8c69==='ListId'||_0xef8c69===_0x6e29('0x6c')||_0xef8c69===_0x6e29('0x54')||_0xef8c69===_0x6e29('0x6d')||_0xef8c69===_0x6e29('0x6e')||_0xef8c69==='xmd-queue'||_0xef8c69==='xmd-phone'||_0xef8c69===_0x6e29('0x6f')||_0xef8c69===_0x6e29('0x70')||_0xef8c69==='xmd-dialtimeout'||_0xef8c69===_0x6e29('0x71')||_0xef8c69===_0x6e29('0x72')||_0xef8c69==='xmd-dialchannel'||_0xef8c69===_0x6e29('0x73')||_0xef8c69===_0x6e29('0x74')||_0xef8c69===_0x6e29('0x75')||_0xef8c69===_0x6e29('0x76')||_0xef8c69===_0x6e29('0x77')||_0xef8c69==='rtpaudioqos'||_0xef8c69===_0x6e29('0x78')||_0xef8c69===_0x6e29('0x79')||_0xef8c69===_0x6e29('0x7a')||_0xef8c69===_0x6e29('0x7b')||_0xef8c69===_0x6e29('0x7c')||_0xef8c69==='rtpaudioqosrtt'||_0xef8c69===_0x6e29('0x7d')||_0xef8c69==='rtpaudioqos'||_0xef8c69===_0x6e29('0x78')||_0xef8c69===_0x6e29('0x79')||_0xef8c69===_0x6e29('0x7a')||_0xef8c69===_0x6e29('0x7b')||_0xef8c69===_0x6e29('0x7c')||_0xef8c69===_0x6e29('0x7e')||_0xef8c69===_0x6e29('0x7d')||_0xef8c69==='bridgepeer'||_0xef8c69===_0x6e29('0x7f')||_0xef8c69==='state'||_0xef8c69===_0x6e29('0x38')){return![];}return!![];};exports[_0x6e29('0x80')]=function(_0x28ca1b,_0x3ccbd1){var _0x4b8093,_0x1acc34,_0x2aadb0;if(_0x3ccbd1<=0x0){_0x3ccbd1=0x1;}_0x4b8093=new RegExp(_0x6e29('0x81')+_0x3ccbd1+'}$');_0x1acc34=Math[_0x6e29('0x82')](0xa,_0x3ccbd1-0x1);_0x2aadb0=Math[_0x6e29('0x82')](0xa,_0x3ccbd1)-0x1;return util[_0x6e29('0x14')]('%s',_[_0x6e29('0x83')](_0x28ca1b,_0x4b8093,_[_0x6e29('0x84')](_0x1acc34,_0x2aadb0)));};exports[_0x6e29('0x85')]=function(_0x39ccee){var _0x4041d5=_0x39ccee[_0x6e29('0x86')](/"(.*?)"/);return _0x4041d5?_0x4041d5[0x1]:_0x39ccee;};exports[_0x6e29('0x87')]=function(_0x5d945e){var _0x25a89b=_0x5d945e['match'](/<(.*?)>/);return _0x25a89b?_0x25a89b[0x1]:_0x5d945e;};function buildNoAnswerEventPayload(_0x14a0bd,_0x4216ec){var _0x4da526=buildObj(_0x14a0bd,_0x6e29('0x88'));if(!_[_0x6e29('0x16')](_0x4216ec['variables'])){Object[_0x6e29('0x89')](_0x4216ec['variables'])[_0x6e29('0x8a')](function(_0x5fd31a){_0x4da526[_0x5fd31a[_0x6e29('0x8b')]()]=_0x4216ec[_0x6e29('0x8c')][_0x5fd31a];});}return _0x4da526;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x1f53=['name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','logLookAgent','membername','UserId','logCustomer','ringtime','talktime','answertime','Failure','variablesAction','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','voice','mandatoryDisposition','buildObj','buildAcw','queue','channelAgent','status','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','replace','extractCalleridName','match','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','string','isEmpty','isUndefined','format','\x22\x22\x20<>','isActive','Queue'];(function(_0x4d693a,_0x344fe9){var _0x435150=function(_0x2e7232){while(--_0x2e7232){_0x4d693a['push'](_0x4d693a['shift']());}};_0x435150(++_0x344fe9);}(_0x1f53,0x195));var _0x31f5=function(_0x4b84b8,_0x2ac9e8){_0x4b84b8=_0x4b84b8-0x0;var _0x6c9fc8=_0x1f53[_0x4b84b8];return _0x6c9fc8;};'use strict';var util=require('util');var _=require(_0x31f5('0x0'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x31f5('0x1'));var ipAgi=process[_0x31f5('0x2')]['XCALLY_IP_AGI']||_0x31f5('0x3');function getSeconds(_0x399ad2,_0x2f759b){var _0x55d0da=moment(_0x399ad2)[_0x31f5('0x4')](0x0);var _0x590c1a=moment(_0x2f759b)['milliseconds'](0x0);return _0x55d0da[_0x31f5('0x5')](_0x590c1a,_0x31f5('0x6'));}exports[_0x31f5('0x7')]=function(_0x21b97e){return function(_0x85fb5d){logger[_0x31f5('0x8')](_0x21b97e,util[_0x31f5('0x9')](_0x85fb5d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x420659,_0x483485){logger[_0x31f5('0xa')](_0x420659,util['inspect'](_0x483485,{'showHidden':![],'depth':null}));};exports[_0x31f5('0xb')]=function(_0x181c54,_0x1e7b4b){logger[_0x31f5('0x8')](_0x181c54,util[_0x31f5('0x9')](_0x1e7b4b,{'showHidden':![],'depth':null}));};exports[_0x31f5('0xc')]=function(_0x859a21){return function(_0x175b8b){logger['info'](_0x859a21,util[_0x31f5('0x9')](_0x175b8b,{'showHidden':![],'depth':null}));};};exports[_0x31f5('0xd')]=function(_0x8cc8f4,_0x490a52,_0x3c8f80){return{'message':_0x8cc8f4,'unlock':_0x490a52,'active':_0x3c8f80};};exports['getCallerId']=function(_0x1b4b02,_0x591efa,_0x2d41fa){if(!_['isUndefined'](_0x2d41fa)&&_0x31f5('0xe')===typeof _0x2d41fa&&!_[_0x31f5('0xf')](_0x2d41fa)){if(!_[_0x31f5('0x10')](_0x591efa)&&_0x31f5('0xe')===typeof _0x591efa&&!_[_0x31f5('0xf')](_0x591efa)){return util[_0x31f5('0x11')]('\x22%s\x22\x20<%s>',_0x591efa,_0x2d41fa);}return util[_0x31f5('0x11')]('\x22%s\x22\x20<%s>',_0x2d41fa,_0x2d41fa);}if(!_[_0x31f5('0x10')](_0x1b4b02)&&'string'===typeof _0x1b4b02&&!_[_0x31f5('0xf')](_0x1b4b02)){return _0x1b4b02;}return _0x31f5('0x12');};exports[_0x31f5('0x13')]=function(_0x327699){if(_['isNil'](_0x327699)){return![];}return _0x327699;};exports['addVariables']=function(_0x3ff7e8,_0x2153dc,_0x347a1d,_0x124122,_0x4692cb,_0x1cdaf2){var _0x15ad11={'XMD-QUEUE':_0x2153dc[_0x31f5('0x14')]?_0x2153dc[_0x31f5('0x14')][_0x31f5('0x15')]:'','XMD-CALLERID':_0x124122,'XMD-CALLERID-PREVIEW':_0x1cdaf2?util[_0x31f5('0x11')](_0x31f5('0x16'),_0x1cdaf2[_0x31f5('0x17')],_0x1cdaf2[_0x31f5('0x18')]):_0x124122,'XMD-DIALID':_0x4692cb,'XMD-CONTACTID':_0x2153dc[_0x31f5('0x19')],'XMD-CDRTYPE':_0x31f5('0x1a'),'CALLERID(all)':_0x124122,'XMD-VOICEQUEUEID':_0x2153dc[_0x31f5('0x1b')],'XMD-DIALCHANNEL':_0x347a1d,'XMD-DIALTIMEOUT':_0x3ff7e8['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x3ff7e8[_0x31f5('0x1c')]?'g':'',_[_0x31f5('0xf')](_0x3ff7e8[_0x31f5('0x1d')])?'':_0x31f5('0x1e')),'XMD-DIALURL':_0x3ff7e8['dialPreviewUrl']||'','XMD-AGI':_0x3ff7e8[_0x31f5('0x1f')]?util[_0x31f5('0x11')](_0x31f5('0x20'),ipAgi,_0x3ff7e8['dialQueueProject']):_0x31f5('0x21'),'XMD-AGIAFTER':_0x3ff7e8[_0x31f5('0x1c')]?util[_0x31f5('0x11')](_0x31f5('0x20'),ipAgi,_0x3ff7e8[_0x31f5('0x1c')]):_0x31f5('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x1cdaf2?_0x1cdaf2[_0x31f5('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x1cdaf2?_0x1cdaf2[_0x31f5('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x31f5('0x24')};if(!_[_0x31f5('0xf')](_0x3ff7e8[_0x31f5('0x1d')])){_0x15ad11[util['format']('%s',_0x31f5('0x25'))]=_0x3ff7e8[_0x31f5('0x1d')];_0x15ad11[util[_0x31f5('0x11')]('%s',_0x31f5('0x26'))]=_0x4692cb;}if(_0x2153dc&&_0x2153dc[_0x31f5('0x27')]){for(var _0x5debc6 in _0x2153dc[_0x31f5('0x27')]){if(_0x2153dc['Contact'][_0x31f5('0x28')](_0x5debc6)){if(!_[_0x31f5('0x29')](_0x2153dc[_0x31f5('0x27')][_0x5debc6])&&_0x5debc6!=='id'&&_0x5debc6!==_0x31f5('0x2a')&&_0x5debc6!==_0x31f5('0x2b')&&_0x5debc6!==_0x31f5('0x2c')){_0x15ad11[util[_0x31f5('0x11')](_0x31f5('0x2d'),_0x31f5('0x2e'),_[_0x31f5('0x2f')](_0x5debc6))]=_0x2153dc['Contact'][_0x5debc6];}}}}return _0x15ad11;};exports['toLowerVariables']=function(_0x2dbd08){var _0x2783a1={};for(var _0x58eb62 in _0x2dbd08){if(_0x2dbd08[_0x31f5('0x28')](_0x58eb62)){_0x2783a1[util['format']('%s',_[_0x31f5('0x30')](_0x58eb62))]=_0x2dbd08[_0x58eb62];}}return{'variables':_0x2783a1};};exports[_0x31f5('0x31')]=function(_0x200eb6,_0x23ce4c){if(!_[_0x31f5('0x29')](_0x200eb6)){if(_0x200eb6[_0x31f5('0x28')](_0x31f5('0x32'))){if(_0x200eb6[_0x31f5('0x32')]>0x0){_0x200eb6[_0x31f5('0x32')]-=0x1;}else{logger[_0x31f5('0x8')](_0x31f5('0x33'),_0x23ce4c);}}}else{logger[_0x31f5('0x8')](_0x31f5('0x34'),_0x23ce4c);}};exports[_0x31f5('0x35')]=function(_0x58990b){var _0x27a717=moment()[_0x31f5('0x11')](_0x31f5('0x36'));_0x58990b[_0x31f5('0x37')]=0xd;_0x58990b[_0x31f5('0x38')]=_0x31f5('0x39');_0x58990b[_0x31f5('0x3a')]=_0x27a717;_0x58990b[_0x31f5('0x3b')]=_0x27a717;_0x58990b[_0x31f5('0x3c')]=_0x27a717;};exports[_0x31f5('0x3d')]=function(_0x9d8dc6,_0x6973ff,_0x51427b){var _0x46abf8=moment()['format'](_0x31f5('0x36'));_0x9d8dc6[_0x31f5('0x37')]=_0x6973ff;_0x9d8dc6[_0x31f5('0x38')]=_0x51427b;_0x9d8dc6[_0x31f5('0x3b')]=_0x46abf8;_0x9d8dc6['ringtime']=getSeconds(_0x9d8dc6[_0x31f5('0x3b')],_0x9d8dc6[_0x31f5('0x3a')]);};exports[_0x31f5('0x3e')]=function(_0xf19ee8,_0x1386f7,_0x1662fe){_0xf19ee8[_0x31f5('0x3f')]=_0x1386f7;_0xf19ee8[_0x31f5('0x40')]=_0x1662fe;};exports[_0x31f5('0x41')]=function(_0x13c919,_0x3c50ee,_0x553c9e){var _0x5111cd=moment()['format'](_0x31f5('0x36'));_0x13c919[_0x31f5('0x37')]=_0x3c50ee;_0x13c919['statedesc']=_0x553c9e;_0x13c919[_0x31f5('0x3b')]=_0x13c919[_0x31f5('0x3b')]?_0x13c919[_0x31f5('0x3b')]:_0x5111cd;_0x13c919[_0x31f5('0x3c')]=_0x13c919[_0x31f5('0x3c')]?_0x13c919['endtime']:_0x5111cd;_0x13c919[_0x31f5('0x42')]=getSeconds(_0x13c919[_0x31f5('0x3b')]||0x0,_0x13c919[_0x31f5('0x3a')]||0x0);_0x13c919[_0x31f5('0x43')]=_0x13c919[_0x31f5('0x44')]?getSeconds(_0x13c919[_0x31f5('0x3c')],_0x13c919[_0x31f5('0x44')]):0x0;};exports['isFailure']=function(_0x4e3727){return _0x4e3727===_0x31f5('0x45');};exports[_0x31f5('0x46')]=function(_0x9a918f,_0x2ff482,_0x25b7e5,_0x59556d,_0x2c21bb){var _0x2e1efa=_0x59556d?'RECALL':_0x9a918f['calleridname'];_0x2e1efa=_0x2c21bb?_0x31f5('0x47'):_0x2e1efa;return{'actionid':_0x9a918f[_0x31f5('0x48')],'action':_0x31f5('0x49'),'channel':_0x9a918f['channelAgent'],'callerid':util[_0x31f5('0x11')](_0x31f5('0x16'),_0x2e1efa,_0x9a918f[_0x31f5('0x18')]),'Exten':_0x31f5('0x4a'),'Context':_0x31f5('0x4b'),'Priority':'1','variable':_0x25b7e5,'timeout':(_0x2ff482[_0x31f5('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x9a918f[_0x31f5('0x48')]};};exports[_0x31f5('0x4d')]=function(_0x50131b){return _0x50131b[_0x31f5('0x4e')]+_0x50131b[_0x31f5('0x4f')]+_0x50131b['countnoanswerretry']+_0x50131b['countagentrejectretry']+_0x50131b['countnosuchnumberretry'];};exports['cloneAction']=function(_0x32c0e4){var _0x5cdc20=_['clone'](_0x32c0e4);_0x5cdc20[_0x31f5('0x37')]=0xf;_0x5cdc20['statedesc']=_0x31f5('0x50');return _0x5cdc20;};exports[_0x31f5('0x51')]=function(_0x2ad7ea,_0xb2db51,_0x377990){var _0x596799={};_0x596799[_0xb2db51]=_0x2ad7ea[_0xb2db51];_0x596799[_0x31f5('0x52')]=![];_0x596799[_0x31f5('0x53')]=moment()[_0x31f5('0x54')](_0x377990,'minutes')[_0x31f5('0x11')](_0x31f5('0x36'));_0x596799['ContactId']=_0x2ad7ea['ContactId'];_0x596799[_0x31f5('0x55')]=_0x2ad7ea[_0x31f5('0x55')];_0x596799[_0x31f5('0x1b')]=_0x2ad7ea[_0x31f5('0x1b')]||undefined;return _0x596799;};exports[_0x31f5('0x56')]=function(_0x56e528,_0x473310){if(!_[_0x31f5('0x29')](_0x56e528)){if(_0x56e528[_0x31f5('0x57')]>0x0){_0x56e528[_0x31f5('0x57')]-=0x1;}else{logger[_0x31f5('0x8')](_0x473310,_0x31f5('0x58'));}}else{logger[_0x31f5('0x8')](_0x473310,_0x31f5('0x59'));}};exports['IsNotLoggedIn']=function(_0x29453e){if(_0x29453e<=0x0){return!![];}return![];};function buildObj(_0x13762d,_0x4b6a1f,_0x2a6179){_0x13762d[_0x31f5('0x5a')]=_0x4b6a1f;_0x13762d[_0x31f5('0x15')]=_0x13762d['queue'];_0x13762d['interface']=_0x13762d['channelAgent'];_0x13762d['motionChannel']=_0x31f5('0x5b');if(_0x2a6179){_0x13762d['mandatoryDisposition']=_0x2a6179[_0x31f5('0x5c')];}return _0x13762d;}exports[_0x31f5('0x5d')]=buildObj;exports[_0x31f5('0x5e')]=function(_0xea205d){var _0x32498a={};_0x32498a[_0x31f5('0x5f')]=_0xea205d[_0x31f5('0x5f')];_0x32498a['interface']=_0xea205d[_0x31f5('0x60')];_0x32498a[_0x31f5('0x48')]=_0xea205d[_0x31f5('0x48')];return _0x32498a;};exports['agentReadyId']=function(_0x1b9656){var _0x4bf772=[];for(var _0x1910cd in _0x1b9656){if(_0x1b9656[_0x31f5('0x28')](_0x1910cd)){if(!_[_0x31f5('0x29')](_0x1b9656[_0x1910cd])&&_0x1b9656[_0x1910cd][_0x31f5('0x37')]==='not_inuse'&&_0x1b9656[_0x1910cd][_0x31f5('0x61')]==='reachable'){_0x4bf772[_0x31f5('0x62')](_0x1b9656[_0x1910cd]['id']);}}}return _0x4bf772;};exports[_0x31f5('0x63')]=function(_0x58ccd8){var _0x1ef6d2=moment()['milliseconds'](0x0);var _0x1a8357=moment(_0x58ccd8)['milliseconds'](0x0);return _0x1ef6d2[_0x31f5('0x5')](_0x1a8357,_0x31f5('0x6'));};exports[_0x31f5('0x64')]=function(_0x496d9a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x496d9a['ContactId'],'ListId':_0x496d9a['ListId'],'VoiceQueueId':_0x496d9a[_0x31f5('0x1b')]||undefined,'CampaignId':_0x496d9a[_0x31f5('0x65')]||undefined};};exports[_0x31f5('0x66')]=function(_0x3f1fe2){if(_0x3f1fe2==='uniqueid'||_0x3f1fe2===_0x31f5('0x67')||_0x3f1fe2===_0x31f5('0x5f')||_0x3f1fe2===_0x31f5('0x68')||_0x3f1fe2===_0x31f5('0x69')||_0x3f1fe2===_0x31f5('0x6a')||_0x3f1fe2===_0x31f5('0x3f')||_0x3f1fe2===_0x31f5('0x60')||_0x3f1fe2===_0x31f5('0x17')||_0x3f1fe2===_0x31f5('0x52')||_0x3f1fe2===_0x31f5('0x18')||_0x3f1fe2==='scheduledat'||_0x3f1fe2===_0x31f5('0x4e')||_0x3f1fe2===_0x31f5('0x4f')||_0x3f1fe2===_0x31f5('0x6b')||_0x3f1fe2===_0x31f5('0x6c')||_0x3f1fe2===_0x31f5('0x6d')||_0x3f1fe2===_0x31f5('0x6e')||_0x3f1fe2===_0x31f5('0x6f')||_0x3f1fe2==='recallme'||_0x3f1fe2==='ContactId'||_0x3f1fe2===_0x31f5('0x55')||_0x3f1fe2===_0x31f5('0x40')||_0x3f1fe2==='VoiceQueueId'||_0x3f1fe2===_0x31f5('0x70')||_0x3f1fe2===_0x31f5('0x71')||_0x3f1fe2===_0x31f5('0x72')||_0x3f1fe2===_0x31f5('0x73')||_0x3f1fe2===_0x31f5('0x74')||_0x3f1fe2===_0x31f5('0x75')||_0x3f1fe2===_0x31f5('0x76')||_0x3f1fe2===_0x31f5('0x77')||_0x3f1fe2==='xmd-dialid'||_0x3f1fe2==='xmd-dialchannel'||_0x3f1fe2===_0x31f5('0x78')||_0x3f1fe2===_0x31f5('0x79')||_0x3f1fe2===_0x31f5('0x7a')||_0x3f1fe2===_0x31f5('0x7b')||_0x3f1fe2===_0x31f5('0x7c')||_0x3f1fe2===_0x31f5('0x7d')||_0x3f1fe2==='rtpaudioqosbridged'||_0x3f1fe2==='rtpaudioqosjitter'||_0x3f1fe2==='rtpaudioqosjitterbridged'||_0x3f1fe2===_0x31f5('0x7e')||_0x3f1fe2===_0x31f5('0x7f')||_0x3f1fe2==='rtpaudioqosrtt'||_0x3f1fe2===_0x31f5('0x80')||_0x3f1fe2===_0x31f5('0x7d')||_0x3f1fe2==='rtpaudioqosbridged'||_0x3f1fe2===_0x31f5('0x81')||_0x3f1fe2===_0x31f5('0x82')||_0x3f1fe2===_0x31f5('0x7e')||_0x3f1fe2===_0x31f5('0x7f')||_0x3f1fe2==='rtpaudioqosrtt'||_0x3f1fe2===_0x31f5('0x80')||_0x3f1fe2==='bridgepeer'||_0x3f1fe2===_0x31f5('0x83')||_0x3f1fe2===_0x31f5('0x37')||_0x3f1fe2===_0x31f5('0x38')){return![];}return!![];};exports[_0x31f5('0x84')]=function(_0x168414,_0xf26309){var _0x3af5bb,_0x4906a1,_0x500404;if(_0xf26309<=0x0){_0xf26309=0x1;}_0x3af5bb=new RegExp(_0x31f5('0x85')+_0xf26309+'}$');_0x4906a1=Math['pow'](0xa,_0xf26309-0x1);_0x500404=Math['pow'](0xa,_0xf26309)-0x1;return util[_0x31f5('0x11')]('%s',_[_0x31f5('0x86')](_0x168414,_0x3af5bb,_['random'](_0x4906a1,_0x500404)));};exports[_0x31f5('0x87')]=function(_0x18958d){var _0x376210=_0x18958d[_0x31f5('0x88')](/"(.*?)"/);return _0x376210?_0x376210[0x1]:_0x18958d;};exports['extractCalleridNumber']=function(_0x41e423){var _0x33352=_0x41e423[_0x31f5('0x88')](/<(.*?)>/);return _0x33352?_0x33352[0x1]:_0x41e423;};function buildNoAnswerEventPayload(_0x127c40,_0x5da3d1){var _0x23b66a=buildObj(_0x127c40,'noanswer');if(!_[_0x31f5('0xf')](_0x5da3d1[_0x31f5('0x89')])){Object[_0x31f5('0x8a')](_0x5da3d1[_0x31f5('0x89')])[_0x31f5('0x8b')](function(_0x16b625){_0x23b66a[_0x16b625[_0x31f5('0x8c')]()]=_0x5da3d1[_0x31f5('0x89')][_0x16b625];});}return _0x23b66a;}exports[_0x31f5('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 5ce12e9..98cdc3c 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 _0x1224=['boolean','voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','queuepause'];(function(_0x4f167e,_0x8f356d){var _0x18b6fc=function(_0x4474a0){while(--_0x4474a0){_0x4f167e['push'](_0x4f167e['shift']());}};_0x18b6fc(++_0x8f356d);}(_0x1224,0xd4));var _0x4122=function(_0x3ad497,_0x1285d3){_0x3ad497=_0x3ad497-0x0;var _0x39a541=_0x1224[_0x3ad497];return _0x39a541;};'use strict';exports[_0x4122('0x0')]={'queue':{'type':_0x4122('0x1'),'required':!![]},'interface':{'type':_0x4122('0x1'),'required':!![]},'membername':{'type':_0x4122('0x1'),'required':!![]},'penalty':{'type':_0x4122('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x4122('0x1'),'required':!![]},'interface':{'type':_0x4122('0x1'),'required':!![]}};exports[_0x4122('0x3')]={'interface':{'type':_0x4122('0x1'),'required':!![]},'paused':{'type':_0x4122('0x4')},'reason':{'type':_0x4122('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x4122('0x1'),'required':![]}};exports[_0x4122('0x5')]={'uniqueid':{'type':_0x4122('0x1'),'required':!![]}};exports[_0x4122('0x6')]={'uniqueid':{'type':_0x4122('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x4122('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x4122('0x1'),'required':!![]}};exports[_0x4122('0x7')]={'uniqueid':{'type':_0x4122('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xf687=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','reload'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf687,0x1cf));var _0x7f68=function(_0x1e46e0,_0x5c4908){_0x1e46e0=_0x1e46e0-0x0;var _0x330742=_0xf687[_0x1e46e0];return _0x330742;};'use strict';exports[_0x7f68('0x0')]={'queue':{'type':_0x7f68('0x1'),'required':!![]},'interface':{'type':_0x7f68('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x7f68('0x2'),'required':![]},'paused':{'type':_0x7f68('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x7f68('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x7f68('0x1'),'required':!![]},'paused':{'type':_0x7f68('0x3')},'reason':{'type':_0x7f68('0x1'),'required':![]}};exports[_0x7f68('0x4')]={'module':{'type':'string','required':![]}};exports[_0x7f68('0x5')]={'uniqueid':{'type':_0x7f68('0x1'),'required':!![]}};exports[_0x7f68('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x7f68('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x7f68('0x1')}};exports[_0x7f68('0x7')]={'uniqueid':{'type':_0x7f68('0x1'),'required':!![]}};exports[_0x7f68('0x8')]={'uniqueid':{'type':_0x7f68('0x1'),'required':!![]},'exten':{'type':_0x7f68('0x1'),'required':!![]},'context':{'type':_0x7f68('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1ddec61..41b688a 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 _0xff01=['servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','initTelephones','initTrunks','trunks','isUndefined','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','sumBillable','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts'];(function(_0x3235a7,_0x24cb3b){var _0x56d0b5=function(_0x3c4e91){while(--_0x3c4e91){_0x3235a7['push'](_0x3235a7['shift']());}};_0x56d0b5(++_0x24cb3b);}(_0xff01,0xb7));var _0x1ff0=function(_0x47abfb,_0x371ab2){_0x47abfb=_0x47abfb-0x0;var _0x206277=_0xff01[_0x47abfb];return _0x206277;};'use strict';var util=require(_0x1ff0('0x0'));var _=require(_0x1ff0('0x1'));var moment=require('moment');var Agent=require(_0x1ff0('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x1ff0('0x3'));var VoiceQueue=require(_0x1ff0('0x4'));var Trigger=require(_0x1ff0('0x5'));var Template=require('../model/template');var Campaign=require(_0x1ff0('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x1ff0('0x7'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x1ff0('0x8'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x1ff0('0x9'));var VtigerAccount=require(_0x1ff0('0xa'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x1ff0('0xb'));var FreshsalesAccount=require(_0x1ff0('0xc'));var FaxAccount=require(_0x1ff0('0xd'));var Realtime=function(){this[_0x1ff0('0xe')]={};this[_0x1ff0('0xf')]={};this['trunks']={};this[_0x1ff0('0x10')]={};this['triggers']={};this[_0x1ff0('0x11')]={};this[_0x1ff0('0x12')]={};this[_0x1ff0('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x1ff0('0x14')]={};this[_0x1ff0('0x15')]={};this[_0x1ff0('0x16')]={};this[_0x1ff0('0x17')]={};this[_0x1ff0('0x18')]={};this[_0x1ff0('0x19')]={};this[_0x1ff0('0x1a')]={};this['salesforceAccounts']={};this[_0x1ff0('0x1b')]={};this[_0x1ff0('0x1c')]={};this[_0x1ff0('0x1d')]={};this[_0x1ff0('0x1e')]={};this['vtigerAccounts']={};this[_0x1ff0('0x1f')]={};this[_0x1ff0('0x20')]={};this['freshsalesAccounts']={};this[_0x1ff0('0x21')]={};};function freeIsNotKey(_0xc53d05,_0x736afd,_0x49df7a){var _0x564940=_[_0x1ff0('0x22')](_0xc53d05,function(_0x402adc,_0x590d17){return _0x402adc[_0x49df7a];});for(var _0x1efb08 in _0x736afd){if(_0x736afd[_0x1ff0('0x23')](_0x1efb08)){if(!_0x564940[_0x1efb08]){delete _0x736afd[_0x1efb08];}}}}function freeIsNotKeySip(_0x2b3199,_0x12ed82){var _0x580215=_['mapKeys'](_0x2b3199,function(_0x4e0c9c,_0x53ace3){return util[_0x1ff0('0x24')](_0x1ff0('0x25'),_0x4e0c9c[_0x1ff0('0x26')]);});for(var _0x5e98d5 in _0x12ed82){if(_0x12ed82[_0x1ff0('0x23')](_0x5e98d5)){if(!_0x580215[_0x5e98d5]){delete _0x12ed82[_0x5e98d5];}}}}function freeIsNotKeyAgent(_0x1d0e35,_0x42c737){var _0x3bcdce=_[_0x1ff0('0x22')](_0x1d0e35,function(_0x366c23,_0x165f6f){var _0xe3045c=_[_0x1ff0('0x27')](_0x366c23[_0x1ff0('0x28')])?util[_0x1ff0('0x24')]('SIP/%s',_0x366c23[_0x1ff0('0x26')]):_0x366c23['interface'];return _0xe3045c;});for(var _0x2b3179 in _0x42c737){if(_0x42c737['hasOwnProperty'](_0x2b3179)){if(!_0x3bcdce[_0x2b3179]){delete _0x42c737[_0x2b3179];}}}}function clearVoiceCallReports(_0x459844){_0x459844[_0x1ff0('0x29')]=0x0;_0x459844[_0x1ff0('0x2a')]=0x0;_0x459844[_0x1ff0('0x2b')]=0x0;_0x459844[_0x1ff0('0x2c')]=0x0;_0x459844['sumBillable']=0x0;}function clearCampaigns(_0x2c711a){if(!_[_0x1ff0('0x2d')](_0x2c711a)){for(var _0x38a2e2 in _0x2c711a){if(_0x2c711a['hasOwnProperty'](_0x38a2e2)){_0x2c711a[_0x38a2e2][_0x1ff0('0x2e')]=0x0;_0x2c711a[_0x38a2e2][_0x1ff0('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x29fdb2){if(!_[_0x1ff0('0x2d')](_0x29fdb2)){for(var _0x203d4d in _0x29fdb2){if(_0x29fdb2['hasOwnProperty'](_0x203d4d)){_0x29fdb2[_0x203d4d][_0x1ff0('0x29')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x2a')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x30')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x31')]=0x0;_0x29fdb2[_0x203d4d]['sumHoldTime']=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x2c')]=0x0;_0x29fdb2[_0x203d4d]['sumBillable']=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x32')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x33')]=0x0;_0x29fdb2[_0x203d4d]['outboundBusyCallsDay']=0x0;_0x29fdb2[_0x203d4d]['outboundCongestionCallsDay']=0x0;_0x29fdb2[_0x203d4d]['outboundNoSuchCallsDay']=0x0;_0x29fdb2[_0x203d4d]['outboundUnknownCallsDay']=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x34')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x35')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x36')]=0x0;_0x29fdb2[_0x203d4d]['outboundOriginateFailureCallsDay']=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x37')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x38')]=0x0;_0x29fdb2[_0x203d4d]['outboundAnswerAgiCallsDay']=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x39')]=0x0;_0x29fdb2[_0x203d4d][_0x1ff0('0x3a')]=!![];}}}}Realtime[_0x1ff0('0x3b')][_0x1ff0('0x3c')]=function(_0x5b3619,_0x3e9845){for(var _0x512865 in _0x3e9845){if(_0x5b3619[_0x1ff0('0x23')](_0x512865)){_0x5b3619[_0x512865]=_0x3e9845[_0x512865];}}};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x3d')]=function(){var _0x1daf23=this;return function(_0x23539f){if(_0x23539f){freeIsNotKeyAgent(_0x23539f,_0x1daf23[_0x1ff0('0xe')]);for(var _0x3fbadb=0x0,_0x39eb11={},_0x54f324={};_0x3fbadb<_0x23539f[_0x1ff0('0x3e')];_0x3fbadb+=0x1){_0x39eb11=_0x23539f[_0x3fbadb];var _0x5566fe=_[_0x1ff0('0x27')](_0x39eb11[_0x1ff0('0x28')])?util[_0x1ff0('0x24')]('SIP/%s',_0x39eb11['name']):_0x39eb11[_0x1ff0('0x28')];if(_['isUndefined'](_0x1daf23[_0x1ff0('0xe')][_0x5566fe])){_0x1daf23[_0x1ff0('0xe')][_0x5566fe]=new Agent(_0x39eb11);}else{_0x1daf23['mergeFromDatabase'](_0x1daf23[_0x1ff0('0xe')][_0x5566fe],_0x39eb11);}}}return _0x1daf23[_0x1ff0('0xe')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x3f')]=function(){var _0x3a1642=this;return function(_0x8d805c){if(_0x8d805c){freeIsNotKeySip(_0x8d805c,_0x3a1642['telephones']);for(var _0x851965=0x0,_0x354c53={},_0x136fb4={};_0x851965<_0x8d805c['length'];_0x851965+=0x1){_0x354c53=_0x8d805c[_0x851965];if(_['isUndefined'](_0x3a1642[_0x1ff0('0xf')][util['format'](_0x1ff0('0x25'),_0x354c53[_0x1ff0('0x26')])])){_0x3a1642['telephones'][util['format'](_0x1ff0('0x25'),_0x354c53[_0x1ff0('0x26')])]=new Telephone(_0x354c53);}else{_0x3a1642['mergeFromDatabase'](_0x3a1642[_0x1ff0('0xf')][util['format'](_0x1ff0('0x25'),_0x354c53['name'])],_0x354c53);}}}return _0x3a1642['telephones'];};};Realtime['prototype'][_0x1ff0('0x40')]=function(){var _0x4acaf1=this;return function(_0x357425){if(_0x357425){freeIsNotKeySip(_0x357425,_0x4acaf1[_0x1ff0('0x41')]);for(var _0x4ad1d6=0x0,_0x413e46={},_0x1f492b={};_0x4ad1d6<_0x357425[_0x1ff0('0x3e')];_0x4ad1d6+=0x1){_0x413e46=_0x357425[_0x4ad1d6];if(_[_0x1ff0('0x42')](_0x4acaf1['trunks'][util[_0x1ff0('0x24')](_0x1ff0('0x25'),_0x413e46[_0x1ff0('0x26')])])){_0x4acaf1[_0x1ff0('0x41')][util[_0x1ff0('0x24')](_0x1ff0('0x25'),_0x413e46[_0x1ff0('0x26')])]=new Trunk(_0x413e46);}else{_0x4acaf1['mergeFromDatabase'](_0x4acaf1[_0x1ff0('0x41')][util['format']('SIP/%s',_0x413e46[_0x1ff0('0x26')])],_0x413e46);}}}return _0x4acaf1[_0x1ff0('0x41')];};};Realtime[_0x1ff0('0x3b')]['initVoiceQueues']=function(){var _0x389929=this;return function(_0x284d8f){if(_0x284d8f){freeIsNotKey(_0x284d8f,_0x389929[_0x1ff0('0x10')],_0x1ff0('0x26'));for(var _0x15dd24=0x0,_0x437d85={},_0x5bb192={};_0x15dd24<_0x284d8f['length'];_0x15dd24+=0x1){_0x437d85=_0x284d8f[_0x15dd24];if(_[_0x1ff0('0x42')](_0x389929[_0x1ff0('0x10')][_0x437d85[_0x1ff0('0x26')]])){_0x389929['voiceQueues'][_0x437d85[_0x1ff0('0x26')]]=new VoiceQueue(_0x437d85);}else{_0x389929[_0x1ff0('0x3c')](_0x389929[_0x1ff0('0x10')][_0x437d85[_0x1ff0('0x26')]],_0x437d85);}}}return _0x389929[_0x1ff0('0x10')];};};Realtime['prototype'][_0x1ff0('0x43')]=function(){var _0xc26004=this;return function(_0x5adc10){if(_0x5adc10){freeIsNotKey(_0x5adc10,_0xc26004['triggers'],'id');for(var _0x5a9266=0x0,_0x2e9742={},_0x2c31dc={};_0x5a9266<_0x5adc10[_0x1ff0('0x3e')];_0x5a9266+=0x1){_0x2e9742=_0x5adc10[_0x5a9266];if(_[_0x1ff0('0x42')](_0xc26004[_0x1ff0('0x44')][_0x2e9742['id']])){_0xc26004['triggers'][_0x2e9742['id']]=new Trigger(_0x2e9742);}else{_0xc26004['mergeFromDatabase'](_0xc26004[_0x1ff0('0x44')][_0x2e9742['id']],_0x2e9742);}}}return _0xc26004[_0x1ff0('0x44')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x45')]=function(){var _0x3844ce=this;return function(_0x142110){if(_0x142110){freeIsNotKey(_0x142110,_0x3844ce[_0x1ff0('0x12')],'id');for(var _0x37aad9=0x0,_0x3c68cd={},_0x543cf5={};_0x37aad9<_0x142110[_0x1ff0('0x3e')];_0x37aad9+=0x1){_0x3c68cd=_0x142110[_0x37aad9];if(_[_0x1ff0('0x42')](_0x3844ce[_0x1ff0('0x12')][_0x3c68cd['id']])){_0x3844ce[_0x1ff0('0x12')][_0x3c68cd['id']]=new Template(_0x3c68cd);}else{_0x3844ce[_0x1ff0('0x3c')](_0x3844ce['templates'][_0x3c68cd['id']],_0x3c68cd);}}}return _0x3844ce[_0x1ff0('0x12')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x46')]=function(){var _0x5decbe=this;return function(_0x329aeb){if(_0x329aeb){freeIsNotKey(_0x329aeb,_0x5decbe[_0x1ff0('0x1a')],'id');for(var _0x3ad5d5=0x0,_0x4e7e97={},_0x44dce6={};_0x3ad5d5<_0x329aeb[_0x1ff0('0x3e')];_0x3ad5d5+=0x1){_0x4e7e97=_0x329aeb[_0x3ad5d5];if(_[_0x1ff0('0x42')](_0x5decbe[_0x1ff0('0x1a')][_0x4e7e97['id']])){_0x5decbe[_0x1ff0('0x1a')][_0x4e7e97['id']]=new ZendeskAccount(_0x4e7e97);}else{_0x5decbe[_0x1ff0('0x3c')](_0x5decbe[_0x1ff0('0x1a')][_0x4e7e97['id']],_0x4e7e97);}}}return _0x5decbe[_0x1ff0('0x1a')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x47')]=function(){var _0x3a83cd=this;return function(_0x46b48c){if(_0x46b48c){freeIsNotKey(_0x46b48c,_0x3a83cd[_0x1ff0('0x48')],'id');for(var _0x5595f9=0x0,_0x296862={},_0x4f7a79={};_0x5595f9<_0x46b48c[_0x1ff0('0x3e')];_0x5595f9+=0x1){_0x296862=_0x46b48c[_0x5595f9];if(_[_0x1ff0('0x42')](_0x3a83cd[_0x1ff0('0x48')][_0x296862['id']])){_0x3a83cd[_0x1ff0('0x48')][_0x296862['id']]=new SalesforceAccount(_0x296862);}else{_0x3a83cd[_0x1ff0('0x3c')](_0x3a83cd[_0x1ff0('0x48')][_0x296862['id']],_0x296862);}}}return _0x3a83cd[_0x1ff0('0x48')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x49')]=function(){var _0xd5c081=this;return function(_0x1a8919){if(_0x1a8919){freeIsNotKey(_0x1a8919,_0xd5c081[_0x1ff0('0x1c')],'id');for(var _0x57c46c=0x0,_0x6a5108={},_0x38e9cc={};_0x57c46c<_0x1a8919[_0x1ff0('0x3e')];_0x57c46c+=0x1){_0x6a5108=_0x1a8919[_0x57c46c];if(_[_0x1ff0('0x42')](_0xd5c081[_0x1ff0('0x1c')][_0x6a5108['id']])){_0xd5c081[_0x1ff0('0x1c')][_0x6a5108['id']]=new FreshdeskAccount(_0x6a5108);}else{_0xd5c081[_0x1ff0('0x3c')](_0xd5c081[_0x1ff0('0x1c')][_0x6a5108['id']],_0x6a5108);}}}return _0xd5c081[_0x1ff0('0x1c')];};};Realtime['prototype'][_0x1ff0('0x4a')]=function(){var _0x23d64f=this;return function(_0x2f9d26){if(_0x2f9d26){freeIsNotKey(_0x2f9d26,_0x23d64f[_0x1ff0('0x1d')],'id');for(var _0x790d7a=0x0,_0xc22df1={},_0x357c87={};_0x790d7a<_0x2f9d26[_0x1ff0('0x3e')];_0x790d7a+=0x1){_0xc22df1=_0x2f9d26[_0x790d7a];if(_[_0x1ff0('0x42')](_0x23d64f[_0x1ff0('0x1d')][_0xc22df1['id']])){_0x23d64f[_0x1ff0('0x1d')][_0xc22df1['id']]=new ZohoAccount(_0xc22df1);}else{_0x23d64f[_0x1ff0('0x3c')](_0x23d64f[_0x1ff0('0x1d')][_0xc22df1['id']],_0xc22df1);}}}return _0x23d64f['zohoAccounts'];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x4b')]=function(){var _0x276d1c=this;return function(_0x51f292){if(_0x51f292){freeIsNotKey(_0x51f292,_0x276d1c['deskAccounts'],'id');for(var _0x40053d=0x0,_0x1ae947={},_0x9da059={};_0x40053d<_0x51f292['length'];_0x40053d+=0x1){_0x1ae947=_0x51f292[_0x40053d];if(_['isUndefined'](_0x276d1c[_0x1ff0('0x1e')][_0x1ae947['id']])){_0x276d1c[_0x1ff0('0x1e')][_0x1ae947['id']]=new DeskAccount(_0x1ae947);}else{_0x276d1c[_0x1ff0('0x3c')](_0x276d1c[_0x1ff0('0x1e')][_0x1ae947['id']],_0x1ae947);}}}return _0x276d1c['deskAccounts'];};};Realtime['prototype'][_0x1ff0('0x4c')]=function(){var _0x16b8e1=this;return function(_0x299278){if(_0x299278){freeIsNotKey(_0x299278,_0x16b8e1[_0x1ff0('0x1b')],'id');for(var _0x313ea1=0x0,_0x2f1b62={},_0x1ad41e={};_0x313ea1<_0x299278[_0x1ff0('0x3e')];_0x313ea1+=0x1){_0x2f1b62=_0x299278[_0x313ea1];if(_[_0x1ff0('0x42')](_0x16b8e1[_0x1ff0('0x1b')][_0x2f1b62['id']])){_0x16b8e1[_0x1ff0('0x1b')][_0x2f1b62['id']]=new SugarcrmAccount(_0x2f1b62);}else{_0x16b8e1[_0x1ff0('0x3c')](_0x16b8e1[_0x1ff0('0x1b')][_0x2f1b62['id']],_0x2f1b62);}}}return _0x16b8e1[_0x1ff0('0x1b')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x4d')]=function(){var _0x2bff64=this;return function(_0x248982){if(_0x248982){freeIsNotKey(_0x248982,_0x2bff64[_0x1ff0('0x4e')],'id');for(var _0x379ff3=0x0,_0x1ba7a6={},_0x357eab={};_0x379ff3<_0x248982[_0x1ff0('0x3e')];_0x379ff3+=0x1){_0x1ba7a6=_0x248982[_0x379ff3];if(_['isUndefined'](_0x2bff64[_0x1ff0('0x4e')][_0x1ba7a6['id']])){_0x2bff64[_0x1ff0('0x4e')][_0x1ba7a6['id']]=new VtigerAccount(_0x1ba7a6);}else{_0x2bff64[_0x1ff0('0x3c')](_0x2bff64[_0x1ff0('0x4e')][_0x1ba7a6['id']],_0x1ba7a6);}}}return _0x2bff64[_0x1ff0('0x4e')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x4f')]=function(){var _0xd58571=this;return function(_0x28478c){if(_0x28478c){freeIsNotKey(_0x28478c,_0xd58571['servicenowAccounts'],'id');for(var _0x45f19b=0x0,_0x2bbfa8={},_0x256e4c={};_0x45f19b<_0x28478c[_0x1ff0('0x3e')];_0x45f19b+=0x1){_0x2bbfa8=_0x28478c[_0x45f19b];if(_[_0x1ff0('0x42')](_0xd58571[_0x1ff0('0x1f')][_0x2bbfa8['id']])){_0xd58571['servicenowAccounts'][_0x2bbfa8['id']]=new ServicenowAccount(_0x2bbfa8);}else{_0xd58571[_0x1ff0('0x3c')](_0xd58571[_0x1ff0('0x1f')][_0x2bbfa8['id']],_0x2bbfa8);}}}return _0xd58571[_0x1ff0('0x1f')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x50')]=function(){var _0x36bebb=this;return function(_0x3f88ac){if(_0x3f88ac){freeIsNotKey(_0x3f88ac,_0x36bebb[_0x1ff0('0x20')],'id');for(var _0x5ab020=0x0,_0x262f17={},_0x297add={};_0x5ab020<_0x3f88ac[_0x1ff0('0x3e')];_0x5ab020+=0x1){_0x262f17=_0x3f88ac[_0x5ab020];if(_[_0x1ff0('0x42')](_0x36bebb[_0x1ff0('0x20')][_0x262f17['id']])){_0x36bebb['dynamics365Accounts'][_0x262f17['id']]=new Dynamics365Account(_0x262f17);}else{_0x36bebb['mergeFromDatabase'](_0x36bebb[_0x1ff0('0x20')][_0x262f17['id']],_0x262f17);}}}return _0x36bebb['dynamics365Accounts'];};};Realtime['prototype'][_0x1ff0('0x51')]=function(){var _0x19e7ac=this;return function(_0x13e092){if(_0x13e092){freeIsNotKey(_0x13e092,_0x19e7ac[_0x1ff0('0x52')],'id');for(var _0x308fe7=0x0,_0x2e7d36={},_0x36037e={};_0x308fe7<_0x13e092[_0x1ff0('0x3e')];_0x308fe7+=0x1){_0x2e7d36=_0x13e092[_0x308fe7];if(_[_0x1ff0('0x42')](_0x19e7ac[_0x1ff0('0x52')][_0x2e7d36['id']])){_0x19e7ac['freshsalesAccounts'][_0x2e7d36['id']]=new FreshsalesAccount(_0x2e7d36);}else{_0x19e7ac[_0x1ff0('0x3c')](_0x19e7ac[_0x1ff0('0x52')][_0x2e7d36['id']],_0x2e7d36);}}}return _0x19e7ac[_0x1ff0('0x52')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x53')]=function(){var _0x36b06d=this;return function(_0x36d93d){for(var _0x2f898e=0x0;_0x2f898e<_0x36d93d['length'];_0x2f898e+=0x1){_[_0x1ff0('0x54')](_0x36b06d[_0x1ff0('0x10')][_0x36d93d[_0x2f898e][_0x1ff0('0x26')]],_0x36d93d[_0x2f898e]);}return _0x36b06d['voiceQueues'];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x55')]=function(){var _0x3d39a5=this;return function(_0x4942c0){clearVoiceQueues(_0x3d39a5[_0x1ff0('0x10')]);if(_0x4942c0){_0x4942c0=_[_0x1ff0('0x56')](_0x4942c0,_0x1ff0('0x57'));for(var _0x4bdff8 in _0x4942c0){if(_0x4942c0[_0x1ff0('0x23')](_0x4bdff8)){var _0x97d3ff={};for(var _0x26faa7=0x0;_0x26faa7<_0x4942c0[_0x4bdff8][_0x1ff0('0x3e')];_0x26faa7+=0x1){var _0x2a2e3d=_0x4942c0[_0x4bdff8][_0x26faa7]['queue'];if(_0x3d39a5['voiceQueues'][_0x2a2e3d]){if(_0x4942c0[_0x4bdff8][_0x26faa7]['queuecallerexit']){_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x30')]+=0x1;}if(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x58')]){_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x31')]+=0x1;}_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x2b')]+=moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x59')])[_0x1ff0('0x5a')](moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5b')]),_0x1ff0('0x5c'))||0x0;if(_0x26faa7===_0x4942c0[_0x4bdff8][_0x1ff0('0x3e')]-0x1){_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x2c')]+=moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5d')]||_0x4942c0[_0x4bdff8][_0x26faa7]['queuecallerabandonAt']||_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5e')])['diff'](moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5b')]),'seconds')||0x0;_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x29')]+=0x1;if(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5f')]){_0x3d39a5['voiceQueues'][_0x2a2e3d][_0x1ff0('0x2a')]+=0x1;_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x60')]+=moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x5d')])[_0x1ff0('0x5a')](moment(_0x4942c0[_0x4bdff8][_0x26faa7][_0x1ff0('0x59')]),_0x1ff0('0x5c'))||0x0;}}else{_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d][_0x1ff0('0x2c')]+=_0x3d39a5[_0x1ff0('0x10')][_0x2a2e3d]['sumHoldTime']||0x0;}}}}}}return _0x3d39a5[_0x1ff0('0x10')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x61')]=function(){var _0x44baf2=this;return function(_0x4a0502){clearVoiceCallReports(_0x44baf2[_0x1ff0('0x13')]);if(_0x4a0502){for(var _0x4201d5=0x0;_0x4201d5<_0x4a0502['length'];_0x4201d5+=0x1){_0x44baf2['outbound']['total']+=0x1;_0x44baf2['outbound'][_0x1ff0('0x2c')]+=_0x4a0502[_0x4201d5][_0x1ff0('0x62')];if(_0x4a0502[_0x4201d5]['disposition']===_0x1ff0('0x63')){_0x44baf2['outbound']['answered']+=0x1;_0x44baf2[_0x1ff0('0x13')][_0x1ff0('0x2b')]+=_0x4a0502[_0x4201d5][_0x1ff0('0x62')]-_0x4a0502[_0x4201d5][_0x1ff0('0x64')]||0x0;_0x44baf2[_0x1ff0('0x13')][_0x1ff0('0x60')]+=_0x4a0502[_0x4201d5]['billableseconds'];}}}return _0x44baf2['outbound'];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x65')]=function(){var _0x3f6c79=this;return function(_0x579029){if(_0x579029){freeIsNotKey(_0x579029,_0x3f6c79[_0x1ff0('0x11')],'name');for(var _0x1cbd2f=0x0,_0x4d72d2={};_0x1cbd2f<_0x579029[_0x1ff0('0x3e')];_0x1cbd2f+=0x1){_0x4d72d2=_0x579029[_0x1cbd2f];if(_[_0x1ff0('0x42')](_0x3f6c79[_0x1ff0('0x11')][_0x4d72d2[_0x1ff0('0x26')]])){_0x3f6c79[_0x1ff0('0x11')][_0x4d72d2[_0x1ff0('0x26')]]=new Campaign(_0x4d72d2);}else{_0x3f6c79[_0x1ff0('0x3c')](_0x3f6c79['campaigns'][_0x4d72d2[_0x1ff0('0x26')]],_0x4d72d2);_0x3f6c79[_0x1ff0('0x11')][_0x4d72d2[_0x1ff0('0x26')]]['dialQueueProject']=_0x4d72d2[_0x1ff0('0x66')]?_0x4d72d2[_0x1ff0('0x66')][_0x1ff0('0x26')]:undefined;}}}return _0x3f6c79[_0x1ff0('0x11')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x67')]=function(){var _0x19edc0=this;return function(_0x3e09b1){if(_0x3e09b1){freeIsNotKey(_0x3e09b1,_0x19edc0[_0x1ff0('0x14')],'id');for(var _0x1bec55=0x0,_0x5d2541={};_0x1bec55<_0x3e09b1[_0x1ff0('0x3e')];_0x1bec55+=0x1){_0x5d2541=_0x3e09b1[_0x1bec55];if(_[_0x1ff0('0x42')](_0x19edc0[_0x1ff0('0x14')][_0x5d2541['id']])){_0x19edc0[_0x1ff0('0x14')][_0x5d2541['id']]=new VoiceExtension(_0x5d2541);}else{_0x19edc0[_0x1ff0('0x3c')](_0x19edc0['voiceExtensions'][_0x5d2541['id']],_0x5d2541);}}}return _0x19edc0[_0x1ff0('0x14')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x68')]=function(){var _0x76614=this;return function(_0x1e38fc){clearCampaigns(_0x76614[_0x1ff0('0x11')]);for(var _0x47c924=0x0;_0x47c924<_0x1e38fc[_0x1ff0('0x3e')];_0x47c924+=0x1){_[_0x1ff0('0x54')](_0x76614[_0x1ff0('0x11')][_0x1e38fc[_0x47c924][_0x1ff0('0x26')]],_0x1e38fc[_0x47c924]);}return _0x76614[_0x1ff0('0x11')];};};Realtime[_0x1ff0('0x3b')][_0x1ff0('0x69')]=function(){var _0x97d2ee=this;return function(_0x1ad835){if(_0x1ad835){freeIsNotKey(_0x1ad835,_0x97d2ee['faxAccounts'],'id');for(var _0x17f34d=0x0,_0x18e89e={},_0x1c0b63={};_0x17f34d<_0x1ad835[_0x1ff0('0x3e')];_0x17f34d+=0x1){_0x18e89e=_0x1ad835[_0x17f34d];if(_[_0x1ff0('0x42')](_0x97d2ee[_0x1ff0('0x21')][_0x18e89e['id']])){_0x97d2ee[_0x1ff0('0x21')][_0x18e89e['id']]=new FaxAccount(_0x18e89e);}else{_0x97d2ee[_0x1ff0('0x3c')](_0x97d2ee[_0x1ff0('0x21')][_0x18e89e['id']],_0x18e89e);}}}return _0x97d2ee[_0x1ff0('0x21')];};};module[_0x1ff0('0x6a')]=Realtime; \ No newline at end of file +var _0xbd9e=['outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','abandoned','queuecallerleaveAt','diff','queuecallercompleteAt','queuecallerabandonAt','seconds','duration','disposition','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','voiceQueues','campaigns','outbound','voiceExtensions','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','isNil','interface','SIP/%s','name','total','answered','sumDuration','sumBillable','isEmpty','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x50ae98,_0x3f1749){var _0x43e7b4=function(_0x14e201){while(--_0x14e201){_0x50ae98['push'](_0x50ae98['shift']());}};_0x43e7b4(++_0x3f1749);}(_0xbd9e,0x108));var _0xebd9=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xbd9e[_0xdea41a];return _0x15d0d8;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xebd9('0x0'));var Agent=require('../model/agent');var Telephone=require(_0xebd9('0x1'));var Trunk=require(_0xebd9('0x2'));var VoiceQueue=require(_0xebd9('0x3'));var Trigger=require(_0xebd9('0x4'));var Template=require(_0xebd9('0x5'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xebd9('0x6'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xebd9('0x7'));var FreshdeskAccount=require(_0xebd9('0x8'));var SugarcrmAccount=require(_0xebd9('0x9'));var ZohoAccount=require(_0xebd9('0xa'));var DeskAccount=require(_0xebd9('0xb'));var VtigerAccount=require(_0xebd9('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xebd9('0xd'));var FreshsalesAccount=require(_0xebd9('0xe'));var FaxAccount=require(_0xebd9('0xf'));var Realtime=function(){this[_0xebd9('0x10')]={};this[_0xebd9('0x11')]={};this['trunks']={};this[_0xebd9('0x12')]={};this['triggers']={};this[_0xebd9('0x13')]={};this['templates']={};this[_0xebd9('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xebd9('0x15')]={};this['channels']={};this[_0xebd9('0x16')]={};this[_0xebd9('0x17')]={};this['timers']={};this[_0xebd9('0x18')]={};this[_0xebd9('0x19')]={};this[_0xebd9('0x1a')]={};this[_0xebd9('0x1b')]={};this['freshdeskAccounts']={};this[_0xebd9('0x1c')]={};this[_0xebd9('0x1d')]={};this[_0xebd9('0x1e')]={};this[_0xebd9('0x1f')]={};this[_0xebd9('0x20')]={};this[_0xebd9('0x21')]={};this[_0xebd9('0x22')]={};};function freeIsNotKey(_0x35095e,_0x1ecb8f,_0x2767fb){var _0x37cdf3=_[_0xebd9('0x23')](_0x35095e,function(_0x296341,_0x296ff1){return _0x296341[_0x2767fb];});for(var _0x4d04cb in _0x1ecb8f){if(_0x1ecb8f[_0xebd9('0x24')](_0x4d04cb)){if(!_0x37cdf3[_0x4d04cb]){delete _0x1ecb8f[_0x4d04cb];}}}}function freeIsNotKeySip(_0x8310f2,_0x32dec8){var _0x4d793e=_[_0xebd9('0x23')](_0x8310f2,function(_0x58086a,_0x13372c){return util[_0xebd9('0x25')]('SIP/%s',_0x58086a['name']);});for(var _0x5701cd in _0x32dec8){if(_0x32dec8[_0xebd9('0x24')](_0x5701cd)){if(!_0x4d793e[_0x5701cd]){delete _0x32dec8[_0x5701cd];}}}}function freeIsNotKeyAgent(_0x280221,_0x36bc37){var _0x4efca4=_[_0xebd9('0x23')](_0x280221,function(_0x44fa41,_0x3fb488){var _0x2c17c8=_[_0xebd9('0x26')](_0x44fa41[_0xebd9('0x27')])?util['format'](_0xebd9('0x28'),_0x44fa41[_0xebd9('0x29')]):_0x44fa41['interface'];return _0x2c17c8;});for(var _0x556f05 in _0x36bc37){if(_0x36bc37[_0xebd9('0x24')](_0x556f05)){if(!_0x4efca4[_0x556f05]){delete _0x36bc37[_0x556f05];}}}}function clearVoiceCallReports(_0x2da17b){_0x2da17b[_0xebd9('0x2a')]=0x0;_0x2da17b[_0xebd9('0x2b')]=0x0;_0x2da17b['sumHoldTime']=0x0;_0x2da17b[_0xebd9('0x2c')]=0x0;_0x2da17b[_0xebd9('0x2d')]=0x0;}function clearCampaigns(_0x2ef023){if(!_[_0xebd9('0x2e')](_0x2ef023)){for(var _0x5548ae in _0x2ef023){if(_0x2ef023[_0xebd9('0x24')](_0x5548ae)){_0x2ef023[_0x5548ae]['ivrTotalCallsDays']=0x0;_0x2ef023[_0x5548ae]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x449c4b){if(!_[_0xebd9('0x2e')](_0x449c4b)){for(var _0x4349bc in _0x449c4b){if(_0x449c4b[_0xebd9('0x24')](_0x4349bc)){_0x449c4b[_0x4349bc][_0xebd9('0x2a')]=0x0;_0x449c4b[_0x4349bc]['answered']=0x0;_0x449c4b[_0x4349bc]['unmanaged']=0x0;_0x449c4b[_0x4349bc]['abandoned']=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x2f')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x2c')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x2d')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x30')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x31')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x32')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x33')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x34')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x35')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x36')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x37')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x38')]=0x0;_0x449c4b[_0x4349bc]['outboundOriginateFailureCallsDay']=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x39')]=0x0;_0x449c4b[_0x4349bc]['outboundReCallsDay']=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x30')]=0x0;_0x449c4b[_0x4349bc][_0xebd9('0x3a')]=0x0;_0x449c4b[_0x4349bc]['queueStatusComplete']=!![];}}}}Realtime['prototype'][_0xebd9('0x3b')]=function(_0x1d90bb,_0x3e0aac){for(var _0x249a69 in _0x3e0aac){if(_0x1d90bb[_0xebd9('0x24')](_0x249a69)){_0x1d90bb[_0x249a69]=_0x3e0aac[_0x249a69];}}};Realtime[_0xebd9('0x3c')][_0xebd9('0x3d')]=function(){var _0x2d7db8=this;return function(_0x4d21b3){if(_0x4d21b3){freeIsNotKeyAgent(_0x4d21b3,_0x2d7db8[_0xebd9('0x10')]);for(var _0x1608f2=0x0,_0x2dec09={},_0x30525f={};_0x1608f2<_0x4d21b3[_0xebd9('0x3e')];_0x1608f2+=0x1){_0x2dec09=_0x4d21b3[_0x1608f2];var _0xfa23d5=_[_0xebd9('0x26')](_0x2dec09[_0xebd9('0x27')])?util[_0xebd9('0x25')]('SIP/%s',_0x2dec09[_0xebd9('0x29')]):_0x2dec09['interface'];if(_[_0xebd9('0x3f')](_0x2d7db8[_0xebd9('0x10')][_0xfa23d5])){_0x2d7db8[_0xebd9('0x10')][_0xfa23d5]=new Agent(_0x2dec09);}else{_0x2d7db8[_0xebd9('0x3b')](_0x2d7db8['agents'][_0xfa23d5],_0x2dec09);}}}return _0x2d7db8[_0xebd9('0x10')];};};Realtime[_0xebd9('0x3c')]['initTelephones']=function(){var _0x416d13=this;return function(_0x55af7e){if(_0x55af7e){freeIsNotKeySip(_0x55af7e,_0x416d13[_0xebd9('0x11')]);for(var _0x499236=0x0,_0x390002={},_0x49ba42={};_0x499236<_0x55af7e[_0xebd9('0x3e')];_0x499236+=0x1){_0x390002=_0x55af7e[_0x499236];if(_[_0xebd9('0x3f')](_0x416d13['telephones'][util[_0xebd9('0x25')](_0xebd9('0x28'),_0x390002[_0xebd9('0x29')])])){_0x416d13['telephones'][util[_0xebd9('0x25')]('SIP/%s',_0x390002[_0xebd9('0x29')])]=new Telephone(_0x390002);}else{_0x416d13[_0xebd9('0x3b')](_0x416d13[_0xebd9('0x11')][util[_0xebd9('0x25')](_0xebd9('0x28'),_0x390002[_0xebd9('0x29')])],_0x390002);}}}return _0x416d13[_0xebd9('0x11')];};};Realtime['prototype'][_0xebd9('0x40')]=function(){var _0x3a96b1=this;return function(_0x50c3ff){if(_0x50c3ff){freeIsNotKeySip(_0x50c3ff,_0x3a96b1['trunks']);for(var _0x5488ae=0x0,_0x470669={},_0x15c7c7={};_0x5488ae<_0x50c3ff[_0xebd9('0x3e')];_0x5488ae+=0x1){_0x470669=_0x50c3ff[_0x5488ae];if(_[_0xebd9('0x3f')](_0x3a96b1[_0xebd9('0x41')][util[_0xebd9('0x25')]('SIP/%s',_0x470669[_0xebd9('0x29')])])){_0x3a96b1['trunks'][util[_0xebd9('0x25')](_0xebd9('0x28'),_0x470669['name'])]=new Trunk(_0x470669);}else{_0x3a96b1['mergeFromDatabase'](_0x3a96b1['trunks'][util[_0xebd9('0x25')](_0xebd9('0x28'),_0x470669[_0xebd9('0x29')])],_0x470669);}}}return _0x3a96b1[_0xebd9('0x41')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x42')]=function(){var _0xf16375=this;return function(_0x1cdcac){if(_0x1cdcac){freeIsNotKey(_0x1cdcac,_0xf16375['voiceQueues'],_0xebd9('0x29'));for(var _0x4b58f8=0x0,_0x18cf2a={},_0x4764f6={};_0x4b58f8<_0x1cdcac[_0xebd9('0x3e')];_0x4b58f8+=0x1){_0x18cf2a=_0x1cdcac[_0x4b58f8];if(_['isUndefined'](_0xf16375[_0xebd9('0x12')][_0x18cf2a[_0xebd9('0x29')]])){_0xf16375[_0xebd9('0x12')][_0x18cf2a['name']]=new VoiceQueue(_0x18cf2a);}else{_0xf16375[_0xebd9('0x3b')](_0xf16375[_0xebd9('0x12')][_0x18cf2a[_0xebd9('0x29')]],_0x18cf2a);}}}return _0xf16375[_0xebd9('0x12')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x43')]=function(){var _0x2035a0=this;return function(_0x1e18e7){if(_0x1e18e7){freeIsNotKey(_0x1e18e7,_0x2035a0['triggers'],'id');for(var _0x3dad29=0x0,_0x498184={},_0x3715d5={};_0x3dad29<_0x1e18e7['length'];_0x3dad29+=0x1){_0x498184=_0x1e18e7[_0x3dad29];if(_[_0xebd9('0x3f')](_0x2035a0[_0xebd9('0x44')][_0x498184['id']])){_0x2035a0[_0xebd9('0x44')][_0x498184['id']]=new Trigger(_0x498184);}else{_0x2035a0[_0xebd9('0x3b')](_0x2035a0[_0xebd9('0x44')][_0x498184['id']],_0x498184);}}}return _0x2035a0[_0xebd9('0x44')];};};Realtime['prototype'][_0xebd9('0x45')]=function(){var _0x59df76=this;return function(_0x330431){if(_0x330431){freeIsNotKey(_0x330431,_0x59df76[_0xebd9('0x46')],'id');for(var _0xb46587=0x0,_0x393dc5={},_0x299ea4={};_0xb46587<_0x330431[_0xebd9('0x3e')];_0xb46587+=0x1){_0x393dc5=_0x330431[_0xb46587];if(_[_0xebd9('0x3f')](_0x59df76[_0xebd9('0x46')][_0x393dc5['id']])){_0x59df76[_0xebd9('0x46')][_0x393dc5['id']]=new Template(_0x393dc5);}else{_0x59df76[_0xebd9('0x3b')](_0x59df76[_0xebd9('0x46')][_0x393dc5['id']],_0x393dc5);}}}return _0x59df76[_0xebd9('0x46')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x47')]=function(){var _0x4843df=this;return function(_0x58fe54){if(_0x58fe54){freeIsNotKey(_0x58fe54,_0x4843df[_0xebd9('0x19')],'id');for(var _0x53fcaa=0x0,_0x1d8abe={},_0x2efc6e={};_0x53fcaa<_0x58fe54[_0xebd9('0x3e')];_0x53fcaa+=0x1){_0x1d8abe=_0x58fe54[_0x53fcaa];if(_[_0xebd9('0x3f')](_0x4843df[_0xebd9('0x19')][_0x1d8abe['id']])){_0x4843df[_0xebd9('0x19')][_0x1d8abe['id']]=new ZendeskAccount(_0x1d8abe);}else{_0x4843df[_0xebd9('0x3b')](_0x4843df['zendeskAccounts'][_0x1d8abe['id']],_0x1d8abe);}}}return _0x4843df[_0xebd9('0x19')];};};Realtime['prototype'][_0xebd9('0x48')]=function(){var _0x42f0bf=this;return function(_0x1454c0){if(_0x1454c0){freeIsNotKey(_0x1454c0,_0x42f0bf['salesforceAccounts'],'id');for(var _0x2cff34=0x0,_0xa40470={},_0x5487f6={};_0x2cff34<_0x1454c0[_0xebd9('0x3e')];_0x2cff34+=0x1){_0xa40470=_0x1454c0[_0x2cff34];if(_[_0xebd9('0x3f')](_0x42f0bf[_0xebd9('0x1a')][_0xa40470['id']])){_0x42f0bf[_0xebd9('0x1a')][_0xa40470['id']]=new SalesforceAccount(_0xa40470);}else{_0x42f0bf[_0xebd9('0x3b')](_0x42f0bf['salesforceAccounts'][_0xa40470['id']],_0xa40470);}}}return _0x42f0bf[_0xebd9('0x1a')];};};Realtime['prototype'][_0xebd9('0x49')]=function(){var _0x5cae61=this;return function(_0xdcaf11){if(_0xdcaf11){freeIsNotKey(_0xdcaf11,_0x5cae61[_0xebd9('0x4a')],'id');for(var _0x3a899a=0x0,_0x1e3ccb={},_0x54f23f={};_0x3a899a<_0xdcaf11[_0xebd9('0x3e')];_0x3a899a+=0x1){_0x1e3ccb=_0xdcaf11[_0x3a899a];if(_[_0xebd9('0x3f')](_0x5cae61['freshdeskAccounts'][_0x1e3ccb['id']])){_0x5cae61[_0xebd9('0x4a')][_0x1e3ccb['id']]=new FreshdeskAccount(_0x1e3ccb);}else{_0x5cae61[_0xebd9('0x3b')](_0x5cae61[_0xebd9('0x4a')][_0x1e3ccb['id']],_0x1e3ccb);}}}return _0x5cae61[_0xebd9('0x4a')];};};Realtime['prototype'][_0xebd9('0x4b')]=function(){var _0x263043=this;return function(_0x51bac9){if(_0x51bac9){freeIsNotKey(_0x51bac9,_0x263043[_0xebd9('0x1c')],'id');for(var _0xe0a921=0x0,_0x2ffb03={},_0x4432e3={};_0xe0a921<_0x51bac9['length'];_0xe0a921+=0x1){_0x2ffb03=_0x51bac9[_0xe0a921];if(_[_0xebd9('0x3f')](_0x263043['zohoAccounts'][_0x2ffb03['id']])){_0x263043[_0xebd9('0x1c')][_0x2ffb03['id']]=new ZohoAccount(_0x2ffb03);}else{_0x263043[_0xebd9('0x3b')](_0x263043[_0xebd9('0x1c')][_0x2ffb03['id']],_0x2ffb03);}}}return _0x263043[_0xebd9('0x1c')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x4c')]=function(){var _0x4808b4=this;return function(_0x3eabc8){if(_0x3eabc8){freeIsNotKey(_0x3eabc8,_0x4808b4['deskAccounts'],'id');for(var _0x5b2ac3=0x0,_0x144c4b={},_0x48a43d={};_0x5b2ac3<_0x3eabc8[_0xebd9('0x3e')];_0x5b2ac3+=0x1){_0x144c4b=_0x3eabc8[_0x5b2ac3];if(_['isUndefined'](_0x4808b4[_0xebd9('0x1d')][_0x144c4b['id']])){_0x4808b4[_0xebd9('0x1d')][_0x144c4b['id']]=new DeskAccount(_0x144c4b);}else{_0x4808b4[_0xebd9('0x3b')](_0x4808b4['deskAccounts'][_0x144c4b['id']],_0x144c4b);}}}return _0x4808b4[_0xebd9('0x1d')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x4d')]=function(){var _0x43d2c8=this;return function(_0x1e6ff3){if(_0x1e6ff3){freeIsNotKey(_0x1e6ff3,_0x43d2c8[_0xebd9('0x1b')],'id');for(var _0x307e35=0x0,_0x4b04b1={},_0x5056c0={};_0x307e35<_0x1e6ff3[_0xebd9('0x3e')];_0x307e35+=0x1){_0x4b04b1=_0x1e6ff3[_0x307e35];if(_[_0xebd9('0x3f')](_0x43d2c8[_0xebd9('0x1b')][_0x4b04b1['id']])){_0x43d2c8[_0xebd9('0x1b')][_0x4b04b1['id']]=new SugarcrmAccount(_0x4b04b1);}else{_0x43d2c8['mergeFromDatabase'](_0x43d2c8['sugarcrmAccounts'][_0x4b04b1['id']],_0x4b04b1);}}}return _0x43d2c8['sugarcrmAccounts'];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x4e')]=function(){var _0x16263a=this;return function(_0x1ca4ab){if(_0x1ca4ab){freeIsNotKey(_0x1ca4ab,_0x16263a[_0xebd9('0x1e')],'id');for(var _0x107e73=0x0,_0x4c01fa={},_0x5d69dc={};_0x107e73<_0x1ca4ab[_0xebd9('0x3e')];_0x107e73+=0x1){_0x4c01fa=_0x1ca4ab[_0x107e73];if(_[_0xebd9('0x3f')](_0x16263a[_0xebd9('0x1e')][_0x4c01fa['id']])){_0x16263a[_0xebd9('0x1e')][_0x4c01fa['id']]=new VtigerAccount(_0x4c01fa);}else{_0x16263a[_0xebd9('0x3b')](_0x16263a[_0xebd9('0x1e')][_0x4c01fa['id']],_0x4c01fa);}}}return _0x16263a[_0xebd9('0x1e')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x4f')]=function(){var _0x305388=this;return function(_0x1c8f1a){if(_0x1c8f1a){freeIsNotKey(_0x1c8f1a,_0x305388[_0xebd9('0x1f')],'id');for(var _0x23f665=0x0,_0x1235c1={},_0x9a5709={};_0x23f665<_0x1c8f1a[_0xebd9('0x3e')];_0x23f665+=0x1){_0x1235c1=_0x1c8f1a[_0x23f665];if(_['isUndefined'](_0x305388[_0xebd9('0x1f')][_0x1235c1['id']])){_0x305388[_0xebd9('0x1f')][_0x1235c1['id']]=new ServicenowAccount(_0x1235c1);}else{_0x305388[_0xebd9('0x3b')](_0x305388[_0xebd9('0x1f')][_0x1235c1['id']],_0x1235c1);}}}return _0x305388[_0xebd9('0x1f')];};};Realtime[_0xebd9('0x3c')]['initDynamics365Accounts']=function(){var _0x11c122=this;return function(_0x4492cd){if(_0x4492cd){freeIsNotKey(_0x4492cd,_0x11c122[_0xebd9('0x20')],'id');for(var _0x518f90=0x0,_0x4ba789={},_0xc97a5={};_0x518f90<_0x4492cd['length'];_0x518f90+=0x1){_0x4ba789=_0x4492cd[_0x518f90];if(_[_0xebd9('0x3f')](_0x11c122['dynamics365Accounts'][_0x4ba789['id']])){_0x11c122[_0xebd9('0x20')][_0x4ba789['id']]=new Dynamics365Account(_0x4ba789);}else{_0x11c122[_0xebd9('0x3b')](_0x11c122[_0xebd9('0x20')][_0x4ba789['id']],_0x4ba789);}}}return _0x11c122['dynamics365Accounts'];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x50')]=function(){var _0x374b9f=this;return function(_0x1cdfef){if(_0x1cdfef){freeIsNotKey(_0x1cdfef,_0x374b9f[_0xebd9('0x21')],'id');for(var _0x35a537=0x0,_0x3a0db3={},_0x5e0afd={};_0x35a537<_0x1cdfef[_0xebd9('0x3e')];_0x35a537+=0x1){_0x3a0db3=_0x1cdfef[_0x35a537];if(_[_0xebd9('0x3f')](_0x374b9f[_0xebd9('0x21')][_0x3a0db3['id']])){_0x374b9f[_0xebd9('0x21')][_0x3a0db3['id']]=new FreshsalesAccount(_0x3a0db3);}else{_0x374b9f['mergeFromDatabase'](_0x374b9f['freshsalesAccounts'][_0x3a0db3['id']],_0x3a0db3);}}}return _0x374b9f[_0xebd9('0x21')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x51')]=function(){var _0x26756e=this;return function(_0x8e81e){for(var _0x34d97f=0x0;_0x34d97f<_0x8e81e[_0xebd9('0x3e')];_0x34d97f+=0x1){_['merge'](_0x26756e[_0xebd9('0x12')][_0x8e81e[_0x34d97f][_0xebd9('0x29')]],_0x8e81e[_0x34d97f]);}return _0x26756e[_0xebd9('0x12')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x52')]=function(){var _0x216099=this;return function(_0x38ccb6){clearVoiceQueues(_0x216099[_0xebd9('0x12')]);if(_0x38ccb6){_0x38ccb6=_[_0xebd9('0x53')](_0x38ccb6,_0xebd9('0x54'));for(var _0x4fe551 in _0x38ccb6){if(_0x38ccb6[_0xebd9('0x24')](_0x4fe551)){var _0xe660a3={};for(var _0x572469=0x0;_0x572469<_0x38ccb6[_0x4fe551][_0xebd9('0x3e')];_0x572469+=0x1){var _0x4ac9e0=_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x55')];if(_0x216099[_0xebd9('0x12')][_0x4ac9e0]){if(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x56')]){_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x57')]+=0x1;}if(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x58')]){_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x59')]+=0x1;}_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2f')]+=moment(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x5a')])[_0xebd9('0x5b')](moment(_0x38ccb6[_0x4fe551][_0x572469]['queuecallerjoinAt']),'seconds')||0x0;if(_0x572469===_0x38ccb6[_0x4fe551][_0xebd9('0x3e')]-0x1){_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2c')]+=moment(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x5c')]||_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x5d')]||_0x38ccb6[_0x4fe551][_0x572469]['queuecallerexitAt'])['diff'](moment(_0x38ccb6[_0x4fe551][_0x572469]['queuecallerjoinAt']),_0xebd9('0x5e'))||0x0;_0x216099[_0xebd9('0x12')][_0x4ac9e0]['total']+=0x1;if(_0x38ccb6[_0x4fe551][_0x572469]['queuecallercomplete']){_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2b')]+=0x1;_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2d')]+=moment(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x5c')])['diff'](moment(_0x38ccb6[_0x4fe551][_0x572469][_0xebd9('0x5a')]),_0xebd9('0x5e'))||0x0;}}else{_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2c')]+=_0x216099[_0xebd9('0x12')][_0x4ac9e0][_0xebd9('0x2f')]||0x0;}}}}}}return _0x216099[_0xebd9('0x12')];};};Realtime['prototype']['initVoiceCallReports']=function(){var _0xb225c9=this;return function(_0x337e28){clearVoiceCallReports(_0xb225c9[_0xebd9('0x14')]);if(_0x337e28){for(var _0x4f0fdd=0x0;_0x4f0fdd<_0x337e28[_0xebd9('0x3e')];_0x4f0fdd+=0x1){_0xb225c9['outbound'][_0xebd9('0x2a')]+=0x1;_0xb225c9['outbound'][_0xebd9('0x2c')]+=_0x337e28[_0x4f0fdd][_0xebd9('0x5f')];if(_0x337e28[_0x4f0fdd][_0xebd9('0x60')]==='ANSWERED'){_0xb225c9[_0xebd9('0x14')][_0xebd9('0x2b')]+=0x1;_0xb225c9[_0xebd9('0x14')][_0xebd9('0x2f')]+=_0x337e28[_0x4f0fdd]['duration']-_0x337e28[_0x4f0fdd][_0xebd9('0x61')]||0x0;_0xb225c9[_0xebd9('0x14')][_0xebd9('0x2d')]+=_0x337e28[_0x4f0fdd][_0xebd9('0x61')];}}}return _0xb225c9[_0xebd9('0x14')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x62')]=function(){var _0x169b09=this;return function(_0x4b3104){if(_0x4b3104){freeIsNotKey(_0x4b3104,_0x169b09[_0xebd9('0x13')],'name');for(var _0x1a1204=0x0,_0x5811c3={};_0x1a1204<_0x4b3104[_0xebd9('0x3e')];_0x1a1204+=0x1){_0x5811c3=_0x4b3104[_0x1a1204];if(_[_0xebd9('0x3f')](_0x169b09[_0xebd9('0x13')][_0x5811c3[_0xebd9('0x29')]])){_0x169b09[_0xebd9('0x13')][_0x5811c3[_0xebd9('0x29')]]=new Campaign(_0x5811c3);}else{_0x169b09[_0xebd9('0x3b')](_0x169b09['campaigns'][_0x5811c3[_0xebd9('0x29')]],_0x5811c3);_0x169b09[_0xebd9('0x13')][_0x5811c3[_0xebd9('0x29')]][_0xebd9('0x63')]=_0x5811c3[_0xebd9('0x64')]?_0x5811c3['SquareProject'][_0xebd9('0x29')]:undefined;}}}return _0x169b09[_0xebd9('0x13')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x65')]=function(){var _0x5d5ad3=this;return function(_0x4b72ab){if(_0x4b72ab){freeIsNotKey(_0x4b72ab,_0x5d5ad3[_0xebd9('0x15')],'id');for(var _0x5b43b0=0x0,_0x168115={};_0x5b43b0<_0x4b72ab['length'];_0x5b43b0+=0x1){_0x168115=_0x4b72ab[_0x5b43b0];if(_[_0xebd9('0x3f')](_0x5d5ad3[_0xebd9('0x15')][_0x168115['id']])){_0x5d5ad3['voiceExtensions'][_0x168115['id']]=new VoiceExtension(_0x168115);}else{_0x5d5ad3[_0xebd9('0x3b')](_0x5d5ad3[_0xebd9('0x15')][_0x168115['id']],_0x168115);}}}return _0x5d5ad3[_0xebd9('0x15')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x66')]=function(){var _0x33953d=this;return function(_0x2f9b0c){clearCampaigns(_0x33953d[_0xebd9('0x13')]);for(var _0x2fd0a8=0x0;_0x2fd0a8<_0x2f9b0c[_0xebd9('0x3e')];_0x2fd0a8+=0x1){_[_0xebd9('0x67')](_0x33953d[_0xebd9('0x13')][_0x2f9b0c[_0x2fd0a8]['name']],_0x2f9b0c[_0x2fd0a8]);}return _0x33953d[_0xebd9('0x13')];};};Realtime[_0xebd9('0x3c')][_0xebd9('0x68')]=function(){var _0x2ecfeb=this;return function(_0xe87519){if(_0xe87519){freeIsNotKey(_0xe87519,_0x2ecfeb['faxAccounts'],'id');for(var _0x2b1814=0x0,_0x1af907={},_0xcd0f5={};_0x2b1814<_0xe87519[_0xebd9('0x3e')];_0x2b1814+=0x1){_0x1af907=_0xe87519[_0x2b1814];if(_[_0xebd9('0x3f')](_0x2ecfeb['faxAccounts'][_0x1af907['id']])){_0x2ecfeb['faxAccounts'][_0x1af907['id']]=new FaxAccount(_0x1af907);}else{_0x2ecfeb['mergeFromDatabase'](_0x2ecfeb[_0xebd9('0x22')][_0x1af907['id']],_0x1af907);}}}return _0x2ecfeb[_0xebd9('0x22')];};};module[_0xebd9('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b8958b3..d640fe9 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 _0xa0b4=['xcally-motion-preview','calleridnum','destinationchannel','channel','calleridpreview','originatecalleridnum','disposition','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','bind','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','voiceQueueReport','create','match','getAgentByInternal','keys','getCallType','split','outbound','internal','destination','exten','type','dialer','lastapplication','queue','callerid','from-sip'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0b4,0x130));var _0x4a0b=function(_0x5c839e,_0x461887){_0x5c839e=_0x5c839e-0x0;var _0x14fecd=_0xa0b4[_0x5c839e];return _0x14fecd;};'use strict';var _=require('lodash');var moment=require(_0x4a0b('0x0'));var util=require(_0x4a0b('0x1'));var config=require(_0x4a0b('0x2'));var ami=require(_0x4a0b('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x4a0b('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x4a0b('0x5'));var RpcVoiceRecording=require(_0x4a0b('0x6'));var RpcVoiceTransferReport=require(_0x4a0b('0x7'));var VoiceQueueReport=require(_0x4a0b('0x8'));var VoiceCallReport=require(_0x4a0b('0x9'));var VoiceAgentReport=require(_0x4a0b('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x4a0b('0xb'));function Report(_0x544be4){this[_0x4a0b('0xc')]=_0x544be4;this['agents']=_0x544be4[_0x4a0b('0xd')];this['telephones']=_0x544be4[_0x4a0b('0xe')];}Report[_0x4a0b('0xf')][_0x4a0b('0x10')]=function(_0x24d5d8){var _0x5b133a=new VoiceQueueReport(this['realtime']);var _0x6fdae8=new VoiceAgentReport(this[_0x4a0b('0xc')]);var _0x1dfb56=new VoiceDialReport(this[_0x4a0b('0xc')]);var _0x1caa61=new VoiceCallReport(this['realtime']);var _0x4cbed6=new UserReport(this['realtime']);if(config[_0x4a0b('0x11')]&&config[_0x4a0b('0x11')][_0x4a0b('0x12')]){ami['on']('custom:voiceQueueReport',this['voiceQueueReport'][_0x4a0b('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x4a0b('0x14')][_0x4a0b('0x13')](this));ami['on'](_0x4a0b('0x15'),this['voiceAgentReport']['bind'](this));ami['on'](_0x4a0b('0x16'),this[_0x4a0b('0x17')][_0x4a0b('0x13')](this));ami['on'](_0x4a0b('0x18'),this[_0x4a0b('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x4a0b('0x1a')][_0x4a0b('0x13')](this));}};Report['prototype'][_0x4a0b('0x1b')]=function(_0x4387a0){var _0x272ce4;_0x272ce4=_[_0x4a0b('0x1c')](this[_0x4a0b('0xd')],function(_0xbdd7b3){return _0xbdd7b3[_0x4a0b('0x1d')]==_0x4387a0||_0xbdd7b3[_0x4a0b('0x1e')]==_0x4387a0;});if(_[_0x4a0b('0x1f')](_0x272ce4)){var _0x108c9c=_[_0x4a0b('0x1c')](this[_0x4a0b('0xe')],function(_0x5b6d99){return _0x5b6d99[_0x4a0b('0x1d')]==_0x4387a0||_0x5b6d99['name']==_0x4387a0;});if(_0x108c9c){_0x272ce4=_['find'](this[_0x4a0b('0xd')],function(_0x2d1740){return _0x2d1740['interface']==util[_0x4a0b('0x20')](_0x4a0b('0x21'),_0x108c9c[_0x4a0b('0x1e')]);});}}return _0x272ce4;};Report['prototype']['voiceQueueReport']=function(_0x446a9d){for(var _0x2300b9=0x0;_0x2300b9<_0x446a9d[_0x4a0b('0x22')];_0x2300b9+=0x1){var _0x34fc0b=this[_0x4a0b('0x1b')](_0x446a9d[_0x2300b9][_0x4a0b('0x23')]);if(_0x34fc0b){_0x446a9d[_0x2300b9]['accountcode']=_0x34fc0b[_0x4a0b('0x1d')];_0x446a9d[_0x2300b9]['assigned']=!![];_0x446a9d[_0x2300b9][_0x4a0b('0x24')]=_0x34fc0b[_0x4a0b('0x1e')];_0x446a9d[_0x2300b9][_0x4a0b('0x25')]=_[_0x4a0b('0x1f')](_0x34fc0b[_0x4a0b('0x25')])?util[_0x4a0b('0x20')](_0x4a0b('0x21'),_0x34fc0b[_0x4a0b('0x1e')]):_0x34fc0b['interface'];if(_0x446a9d[_0x2300b9][_0x4a0b('0x26')]){_0x446a9d[_0x2300b9][_0x4a0b('0x27')]=moment()[_0x4a0b('0x20')](_0x4a0b('0x28'));}if(_0x446a9d[_0x2300b9][_0x4a0b('0x29')]){_0x446a9d[_0x2300b9][_0x4a0b('0x2a')]=moment()[_0x4a0b('0x20')](_0x4a0b('0x28'));}RpcMemberReport[_0x4a0b('0x2b')](_0x446a9d[_0x2300b9]);}RpcVoiceQueueReport[_0x4a0b('0x2c')](_0x446a9d[_0x2300b9]);}};function extractCalleridNumber(_0x169e1c){var _0x5c3545=_0x169e1c[_0x4a0b('0x2d')](/<(.*?)>/);return _0x5c3545?_0x5c3545[0x1]:_0x169e1c;}Report['prototype'][_0x4a0b('0x2e')]=function(_0x55b33a){for(var _0xe62ec6=0x0;_0xe62ec6',_0x150c72[_0x4a0b('0x43')],_0x150c72[_0x4a0b('0x3d')]);}if(RpcVoiceTransferReport[_0x4a0b('0x44')][_0x150c72[_0x4a0b('0x45')]]){var _0x2bf7c9=RpcVoiceTransferReport[_0x4a0b('0x44')][_0x150c72['linkedid']];_0x2bf7c9[_0x4a0b('0x46')]=_0x150c72[_0x4a0b('0x47')];RpcVoiceTransferReport[_0x4a0b('0x19')](_0x2bf7c9);delete RpcVoiceTransferReport[_0x4a0b('0x44')][_0x150c72[_0x4a0b('0x45')]];}if(_[_0x4a0b('0x1f')](_0x150c72[_0x4a0b('0x36')])){_0x150c72[_0x4a0b('0x36')]=this[_0x4a0b('0x30')](_0x150c72);}if(_['isNil'](_0x150c72[_0x4a0b('0x48')])){var _0x4c7258=_0x150c72[_0x4a0b('0x3f')][_0x4a0b('0x31')]('-')[0x0];var _0x59a2de=this['agents'][_0x4c7258];if(!_0x59a2de)_0x59a2de=this['getAgentByInternal'](_0x150c72[_0x4a0b('0x1d')]);if(_0x59a2de){_0x150c72[_0x4a0b('0x48')]=_0x59a2de['id'];_0x150c72['membername']=_0x59a2de[_0x4a0b('0x1e')];}}RpcVoiceCallReport[_0x4a0b('0x2c')](_0x150c72);if(_0x150c72[_0x4a0b('0x49')]){for(var _0x1f8d6b=0x0;_0x1f8d6b<_0x150c72[_0x4a0b('0x4a')][_0x4a0b('0x22')];_0x1f8d6b+=0x1){_0x150c72[_0x4a0b('0x4b')]=_0x150c72[_0x4a0b('0x4a')][_0x1f8d6b]['filename'];_0x150c72[_0x4a0b('0x4c')]=_0x150c72['monitors'][_0x1f8d6b][_0x4a0b('0x4c')];if(_0x150c72['exten']==_0x4a0b('0x3c')){_0x150c72[_0x4a0b('0x3d')]=_0x150c72[_0x4a0b('0x23')];_0x150c72['calleridname']=_0x150c72['connectedlinename'];_0x150c72['connectedlinenum']=_0x150c72[_0x4a0b('0x1d')];_0x150c72[_0x4a0b('0x4d')]=_0x150c72[_0x4a0b('0x4e')];_0x150c72[_0x4a0b('0x35')]=_0x150c72[_0x4a0b('0x41')];}else if(_0x150c72[_0x4a0b('0x35')]=='xcally-motion-dialer'){_0x150c72[_0x4a0b('0x3d')]=_0x150c72[_0x4a0b('0x34')];_0x150c72[_0x4a0b('0x35')]=_0x150c72[_0x4a0b('0x41')];}RpcVoiceRecording[_0x4a0b('0x2c')](_0x150c72);}}};Report[_0x4a0b('0xf')][_0x4a0b('0x4f')]=function(_0x1d17f8){if(_[_0x4a0b('0x50')](_0x1d17f8)){_0x1d17f8[_0x4a0b('0x51')](function(_0x1068c7){RpcVoiceAgentReport[_0x4a0b('0x2c')](_0x1068c7);});}else{RpcVoiceAgentReport[_0x4a0b('0x2c')](_0x1d17f8);}};Report[_0x4a0b('0xf')][_0x4a0b('0x17')]=function(_0x2fccaf){RpcVoiceDialReport[_0x4a0b('0x2c')](_0x2fccaf);var _0x5c974;var _0x36eac3;var _0x207d71=_0x2fccaf['channel'];if(_[_0x4a0b('0x52')](_0x207d71,_0x4a0b('0x53'))){_0x36eac3=_0x207d71[_0x4a0b('0x54')](_0x207d71[_0x4a0b('0x55')]('/')+0x1,_0x207d71[_0x4a0b('0x55')]('@'));_0x5c974=_['find'](this[_0x4a0b('0xd')],function(_0x55160e){return _0x55160e[_0x4a0b('0x56')]==_0x36eac3||_0x55160e[_0x4a0b('0x57')]==_0x36eac3||_0x55160e[_0x4a0b('0x1d')]==_0x36eac3;});}else{_0x36eac3=_0x207d71[_0x4a0b('0x54')](_0x207d71[_0x4a0b('0x55')]('/')+0x1,_0x207d71[_0x4a0b('0x58')]('-'));_0x5c974=this[_0x4a0b('0x1b')](_0x36eac3);}if(_0x5c974){_0x2fccaf[_0x4a0b('0x25')]=_['isNil'](_0x5c974['interface'])?util[_0x4a0b('0x20')](_0x4a0b('0x21'),_0x5c974[_0x4a0b('0x1e')]):_0x5c974[_0x4a0b('0x25')];_0x2fccaf['membername']=_0x5c974[_0x4a0b('0x1e')];_0x2fccaf[_0x4a0b('0x1d')]=_0x5c974[_0x4a0b('0x1d')];RpcMemberReport[_0x4a0b('0x17')](_0x2fccaf);}};Report[_0x4a0b('0xf')][_0x4a0b('0x19')]=function(_0x2141cd){RpcVoiceTransferReport['transfers'][_0x2141cd[_0x4a0b('0x59')]]=_0x2141cd;};Report[_0x4a0b('0xf')][_0x4a0b('0x1a')]=function(_0x31e23e){RpcVoiceTransferReport['attendedTransfer'](_0x31e23e);};module[_0x4a0b('0x5a')]=Report; \ No newline at end of file +var _0x62b6=['connectedlinenum','calleridname','connectedlinename','originatecalleridnum','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindTransfer','find','accountcode','name','isNil','format','SIP/%s','length','findAgent','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','keys','getCallType','channel','split','getAgentByInternal','outbound','internal','destination','exten','type','dialer','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','create','monitors','monitorFilename','createdAt'];(function(_0x12aefd,_0x1d95b6){var _0xf4f891=function(_0x4ba40d){while(--_0x4ba40d){_0x12aefd['push'](_0x12aefd['shift']());}};_0xf4f891(++_0x1d95b6);}(_0x62b6,0xc6));var _0x662b=function(_0xdefb6,_0x557904){_0xdefb6=_0xdefb6-0x0;var _0x3456d7=_0x62b6[_0xdefb6];return _0x3456d7;};'use strict';var _=require(_0x662b('0x0'));var moment=require(_0x662b('0x1'));var util=require('util');var config=require(_0x662b('0x2'));var ami=require(_0x662b('0x3'));var RpcVoiceAgentReport=require(_0x662b('0x4'));var RpcVoiceCallReport=require(_0x662b('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x662b('0x6'));var RpcVoiceQueueReport=require(_0x662b('0x7'));var RpcVoiceRecording=require(_0x662b('0x8'));var RpcVoiceTransferReport=require(_0x662b('0x9'));var VoiceQueueReport=require(_0x662b('0xa'));var VoiceCallReport=require(_0x662b('0xb'));var VoiceAgentReport=require(_0x662b('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require('./userReport');function Report(_0xfebb0c){this[_0x662b('0xd')]=_0xfebb0c;this[_0x662b('0xe')]=_0xfebb0c[_0x662b('0xe')];this[_0x662b('0xf')]=_0xfebb0c[_0x662b('0xf')];}Report[_0x662b('0x10')][_0x662b('0x11')]=function(_0x5d3fce){var _0x413e5d=new VoiceQueueReport(this[_0x662b('0xd')]);var _0x3e8b25=new VoiceAgentReport(this[_0x662b('0xd')]);var _0x1537dc=new VoiceDialReport(this[_0x662b('0xd')]);var _0x49e0b6=new VoiceCallReport(this[_0x662b('0xd')]);var _0x48ea83=new UserReport(this[_0x662b('0xd')]);if(config[_0x662b('0x12')]&&config[_0x662b('0x12')][_0x662b('0x13')]){ami['on']('custom:voiceQueueReport',this[_0x662b('0x14')][_0x662b('0x15')](this));ami['on'](_0x662b('0x16'),this[_0x662b('0x17')][_0x662b('0x15')](this));ami['on'](_0x662b('0x18'),this[_0x662b('0x19')][_0x662b('0x15')](this));ami['on'](_0x662b('0x1a'),this['voiceDialReport']['bind'](this));ami['on']('blindtransfer',this[_0x662b('0x1b')]['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x662b('0x15')](this));}};Report['prototype']['findAgent']=function(_0x5857fd){var _0x2d596f;_0x2d596f=_[_0x662b('0x1c')](this['agents'],function(_0x277865){return _0x277865[_0x662b('0x1d')]==_0x5857fd||_0x277865[_0x662b('0x1e')]==_0x5857fd;});if(_[_0x662b('0x1f')](_0x2d596f)){var _0x36c5e0=_[_0x662b('0x1c')](this[_0x662b('0xf')],function(_0x11fc04){return _0x11fc04[_0x662b('0x1d')]==_0x5857fd||_0x11fc04[_0x662b('0x1e')]==_0x5857fd;});if(_0x36c5e0){_0x2d596f=_[_0x662b('0x1c')](this[_0x662b('0xe')],function(_0x3c60ee){return _0x3c60ee['interface']==util[_0x662b('0x20')](_0x662b('0x21'),_0x36c5e0[_0x662b('0x1e')]);});}}return _0x2d596f;};Report[_0x662b('0x10')]['voiceQueueReport']=function(_0x3cbef9){for(var _0xe36dcb=0x0;_0xe36dcb<_0x3cbef9[_0x662b('0x22')];_0xe36dcb+=0x1){var _0xc1ddcd=this[_0x662b('0x23')](_0x3cbef9[_0xe36dcb]['connectedlinenum']);if(_0xc1ddcd){_0x3cbef9[_0xe36dcb]['accountcode']=_0xc1ddcd['accountcode'];_0x3cbef9[_0xe36dcb]['assigned']=!![];_0x3cbef9[_0xe36dcb][_0x662b('0x24')]=_0xc1ddcd[_0x662b('0x1e')];_0x3cbef9[_0xe36dcb][_0x662b('0x25')]=_['isNil'](_0xc1ddcd['interface'])?util['format'](_0x662b('0x21'),_0xc1ddcd['name']):_0xc1ddcd['interface'];if(_0x3cbef9[_0xe36dcb][_0x662b('0x26')]){_0x3cbef9[_0xe36dcb][_0x662b('0x27')]=moment()['format'](_0x662b('0x28'));}if(_0x3cbef9[_0xe36dcb]['queuecallerexit']){_0x3cbef9[_0xe36dcb][_0x662b('0x29')]=moment()[_0x662b('0x20')](_0x662b('0x28'));}RpcMemberReport['voiceQueueReport'](_0x3cbef9[_0xe36dcb]);}RpcVoiceQueueReport['create'](_0x3cbef9[_0xe36dcb]);}};function extractCalleridNumber(_0x2d432d){var _0xef5952=_0x2d432d[_0x662b('0x2a')](/<(.*?)>/);return _0xef5952?_0xef5952[0x1]:_0x2d432d;}Report['prototype']['getAgentByInternal']=function(_0x3f92f8){for(var _0x3505d2=0x0;_0x3505d20x0?_0x57e4ac:0x0;this[_0xdc6c('0x10')][_0x429ee9['queue']]['talking']=this[_0xdc6c('0x10')][_0x429ee9[_0xdc6c('0x68')]][_0xdc6c('0x2d')]>_['toNumber'](_0x429ee9[_0xdc6c('0x6e')])?_[_0xdc6c('0x6d')](_0x429ee9['loggedin']):this[_0xdc6c('0x10')][_0x429ee9[_0xdc6c('0x68')]][_0xdc6c('0x2d')];this['emitVoiceQueueSummary'](this[_0xdc6c('0x10')][_0x429ee9[_0xdc6c('0x68')]],_0xdc6c('0x66'));}logger[_0xdc6c('0x43')](_0xdc6c('0x6f'),util[_0xdc6c('0x3a')](this[_0xdc6c('0x10')][_0x429ee9['queue']],{'showHidden':![],'depth':null}));ami[_0xdc6c('0x41')]('custom:queuesummary',this['voiceQueues'][_0x429ee9['queue']]);}}}catch(_0x30f39a){logger[_0xdc6c('0x3b')]('[voiceQueueReport][queuesummary]',util[_0xdc6c('0x3a')](_0x30f39a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')]['syncQueueSummaryComplete']=function(_0x49a327){logger[_0xdc6c('0x43')](_0xdc6c('0x70'),util[_0xdc6c('0x3a')](_0x49a327,{'showHidden':![],'depth':null}));ami[_0xdc6c('0x41')]('custom:queuesummarycomplete',{});this[_0xdc6c('0x11')]=!![];};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x18')]=function(_0x5ad1e4){try{if(this[_0xdc6c('0x61')](_0x5ad1e4)){logger[_0xdc6c('0x43')](_0xdc6c('0x71'),_0x5ad1e4[_0xdc6c('0x46')],util['inspect'](_0x5ad1e4,{'showHidden':![],'depth':null}));if(_[_0xdc6c('0x62')](this['queueReports'][_0x5ad1e4['uniqueid']]))this['queueReports'][_0x5ad1e4['uniqueid']]=[];if(_[_0xdc6c('0x62')](this[_0xdc6c('0xf')][_0x5ad1e4['uniqueid']]))this[_0xdc6c('0xf')][_0x5ad1e4['uniqueid']]={};var _0xc25aa1=new QueueReport();_0xc25aa1[_0xdc6c('0x48')]=_0x5ad1e4[_0xdc6c('0x68')];_0xc25aa1[_0xdc6c('0x50')]=this[_0xdc6c('0x10')][_0xc25aa1[_0xdc6c('0x48')]]&&this[_0xdc6c('0x10')][_0xc25aa1[_0xdc6c('0x48')]][_0xdc6c('0x50')]?this[_0xdc6c('0x10')][_0xc25aa1[_0xdc6c('0x48')]]['type']||'inbound':_0xdc6c('0x51');_0xc25aa1['queue']=_0x5ad1e4[_0xdc6c('0x68')];_0xc25aa1[_0xdc6c('0x72')]=moment()[_0xdc6c('0x4d')](_0xdc6c('0x73'));_0xc25aa1[_0xdc6c('0x74')]=_0x5ad1e4['position'];_0xc25aa1['count']=_0x5ad1e4['count'];_0xc25aa1[_0xdc6c('0x46')]=_0x5ad1e4[_0xdc6c('0x46')];_0xc25aa1['routealias']=this[_0xdc6c('0xf')][_0x5ad1e4[_0xdc6c('0x46')]][_0xdc6c('0x75')];logger[_0xdc6c('0x6a')](_0xdc6c('0x76'),_0xc25aa1[_0xdc6c('0x48')],_0xc25aa1[_0xdc6c('0x50')]);_[_0xdc6c('0x77')](_0xc25aa1,_[_0xdc6c('0x78')](_0x5ad1e4,_[_0xdc6c('0x79')](_0xc25aa1)));this['queueReports'][_0x5ad1e4['uniqueid']][_0xdc6c('0x7a')](_0xc25aa1);this[_0xdc6c('0xf')][_0x5ad1e4['uniqueid']]=_0xc25aa1;this[_0xdc6c('0x42')](_0xc25aa1,_0xdc6c('0x7b'));}}catch(_0x3566e6){logger['error'](_0xdc6c('0x71'),_0x5ad1e4['uniqueid'],util[_0xdc6c('0x3a')](_0x3566e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x7c')]=function(_0x42b609){try{if(this[_0xdc6c('0x61')](_0x42b609)){logger[_0xdc6c('0x43')](_0xdc6c('0x7d'),_0x42b609[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x42b609,{'showHidden':![],'depth':null}));if(this[_0xdc6c('0xd')][_0x42b609['uniqueid']]){var _0x196e3a=_[_0xdc6c('0x7e')](this[_0xdc6c('0xd')][_0x42b609[_0xdc6c('0x46')]]);_0x196e3a['queuecallercomplete']=![];_0x196e3a[_0xdc6c('0x7f')]=null;_0x196e3a[_0xdc6c('0x80')]=_0x42b609[_0xdc6c('0x80')];_0x196e3a[_0xdc6c('0x81')]=_0x42b609[_0xdc6c('0x81')];_0x196e3a[_0xdc6c('0x19')]=!![];_0x196e3a['queuecallerabandonAt']=moment()[_0xdc6c('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x196e3a[_0xdc6c('0x4b')]='ABANDONED';_0x196e3a['lastAssignedTo']=null;logger[_0xdc6c('0x6a')](_0xdc6c('0x82'),_0x196e3a[_0xdc6c('0x48')],_0x196e3a[_0xdc6c('0x50')]);this[_0xdc6c('0xf')][_0x42b609[_0xdc6c('0x46')]]=_0x196e3a;this[_0xdc6c('0x40')](_0x196e3a,_0xdc6c('0x19'));}}}catch(_0x460f8a){logger[_0xdc6c('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x42b609[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x460f8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x1a')]=function(_0x2d4b91){try{if(this['isNotNull'](_0x2d4b91)){logger[_0xdc6c('0x43')](_0xdc6c('0x83'),_0x2d4b91[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x2d4b91,{'showHidden':![],'depth':null}));if(this[_0xdc6c('0xd')][_0x2d4b91['uniqueid']]){var _0x43d75f=_['last'](this[_0xdc6c('0xd')][_0x2d4b91[_0xdc6c('0x46')]]);_0x43d75f[_0xdc6c('0x84')]=moment()[_0xdc6c('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x43d75f[_0xdc6c('0x85')]=_0x2d4b91[_0xdc6c('0x85')];_0x43d75f['connectedlinename']=_0x2d4b91[_0xdc6c('0x86')];logger[_0xdc6c('0x6a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x43d75f[_0xdc6c('0x48')],_0x43d75f[_0xdc6c('0x50')],_0x2d4b91[_0xdc6c('0x85')],_0x2d4b91['connectedlinename']);this[_0xdc6c('0xf')][_0x2d4b91[_0xdc6c('0x46')]]=_0x43d75f;this[_0xdc6c('0x42')](_0x43d75f,_0xdc6c('0x87'));}}}catch(_0x58e9f6){logger[_0xdc6c('0x3b')](_0xdc6c('0x83'),_0x2d4b91[_0xdc6c('0x46')],util['inspect'](_0x58e9f6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x1d')]=function(_0x4764b0){try{if(this[_0xdc6c('0x61')](_0x4764b0)){logger[_0xdc6c('0x43')](_0xdc6c('0x88'),_0x4764b0[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x4764b0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4764b0[_0xdc6c('0x46')]]){var _0x51d90f=_['last'](this[_0xdc6c('0xd')][_0x4764b0[_0xdc6c('0x46')]]);_0x51d90f['queuecallercomplete']=!![];_0x51d90f[_0xdc6c('0x4b')]=_0xdc6c('0x89');logger[_0xdc6c('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x51d90f['name'],_0x51d90f[_0xdc6c('0x50')]);}}}catch(_0x96cb04){logger['error'](_0xdc6c('0x88'),_0x4764b0[_0xdc6c('0x46')],util['inspect'](_0x96cb04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x1b')]=function(_0x4787c3){try{if(this['isNotNull'](_0x4787c3)){logger[_0xdc6c('0x43')](_0xdc6c('0x8a'),_0x4787c3[_0xdc6c('0x46')],util['inspect'](_0x4787c3,{'showHidden':![],'depth':null}));if(this[_0xdc6c('0xd')][_0x4787c3[_0xdc6c('0x46')]]){var _0x4acff4=_[_0xdc6c('0x7e')](this['queueReports'][_0x4787c3[_0xdc6c('0x46')]]);_0x4acff4[_0xdc6c('0x19')]=![];_0x4acff4[_0xdc6c('0x8b')]=null;_0x4acff4[_0xdc6c('0x8c')]=!![];_0x4acff4[_0xdc6c('0x8d')]=_0x4787c3['membername'];_0x4acff4[_0xdc6c('0x80')]=_0x4787c3['holdtime'];_0x4acff4['queuecallercomplete']=!![];_0x4acff4['queuecallerexit']=![];_0x4acff4[_0xdc6c('0x8e')]=null;if(!_0x4acff4[_0xdc6c('0x8f')]){if(_0x4787c3[_0xdc6c('0x90')]=='transfer'){_0x4acff4['queuecallerexitreason']=_0xdc6c('0x91');logger[_0xdc6c('0x6a')](_0xdc6c('0x92'),_0x4acff4[_0xdc6c('0x48')],_0x4acff4['type']);}else{if(_['startsWith'](_0x4787c3[_0xdc6c('0x35')][_0xdc6c('0x93')](),_0xdc6c('0x94'))){if(this[_0xdc6c('0xd')][_0x4787c3['linkedid']]){var _0x85cf1f=_['last'](this['queueReports'][_0x4787c3[_0xdc6c('0x95')]]);_0x85cf1f[_0xdc6c('0x96')]=![];_0x85cf1f[_0xdc6c('0x97')]=!![];_0x85cf1f['queuecallerexitAt']=moment(_0x4acff4[_0xdc6c('0x72')])[_0xdc6c('0x98')](_0x4787c3[_0xdc6c('0x80')],_0xdc6c('0x99'))['format'](_0xdc6c('0x73'));_0x85cf1f[_0xdc6c('0x4b')]=_0xdc6c('0x9a');_0x85cf1f[_0xdc6c('0x8f')]=!![];_0x85cf1f[_0xdc6c('0x9b')]=_0xdc6c('0x9c');_0x85cf1f['transferexten']=_0x4787c3[_0xdc6c('0x9d')];_0x85cf1f[_0xdc6c('0x9e')]=_0x4787c3['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x85cf1f['name'],_0x85cf1f[_0xdc6c('0x50')]);var _0x496c09=this['queueReports'][_0x4787c3[_0xdc6c('0x95')]];this[_0xdc6c('0xd')][_0x4787c3['linkedid']]=this[_0xdc6c('0xd')][_0x4787c3[_0xdc6c('0x46')]];this[_0xdc6c('0xd')][_0x4787c3[_0xdc6c('0x46')]]=_0x496c09;}}else{_0x4acff4[_0xdc6c('0x4b')]='COMPLETEDBY'+_0x4787c3[_0xdc6c('0x90')][_0xdc6c('0x9f')]();logger['info'](_0xdc6c('0xa0'),_0x4acff4[_0xdc6c('0x48')],_0x4acff4[_0xdc6c('0x50')],_0x4acff4['queuecallerexitreason']);}}}this['channels'][_0x4787c3[_0xdc6c('0x46')]]=_0x4acff4;this[_0xdc6c('0x40')](_0x4acff4,_0xdc6c('0xa1'));}}}catch(_0x55b8c9){logger[_0xdc6c('0x3b')](_0xdc6c('0x8a'),_0x4787c3[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x55b8c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0x1e')]=function(_0x40011c){try{if(this['isNotNull'](_0x40011c)){logger[_0xdc6c('0x43')](_0xdc6c('0xa2'),_0x40011c[_0xdc6c('0x46')],util['inspect'](_0x40011c,{'showHidden':![],'depth':null}));this[_0xdc6c('0xa3')](_0x40011c[_0xdc6c('0x46')],_['keys'](_0x40011c[_0xdc6c('0xa4')])[0x0],_0x40011c[_0xdc6c('0xa5')]);if(this[_0xdc6c('0xd')][_0x40011c[_0xdc6c('0x46')]]){var _0x1de161=_['last'](this[_0xdc6c('0xd')][_0x40011c[_0xdc6c('0x46')]]);if(_0x1de161){if(this[_0xdc6c('0x61')](_0x40011c[_0xdc6c('0xa4')])&&this['isNotNull'](_0x40011c[_0xdc6c('0xa4')][_0xdc6c('0xa6')])){switch(_0x40011c[_0xdc6c('0xa5')]){case _0xdc6c('0xa7'):_0x1de161[_0xdc6c('0x97')]=![];_0x1de161['queuecallerexitAt']=null;break;case _0xdc6c('0xa8'):_0x1de161[_0xdc6c('0xa9')]=_0xdc6c('0xaa');_0x1de161[_0xdc6c('0x97')]=!![];_0x1de161[_0xdc6c('0x8e')]=moment()[_0xdc6c('0x4d')](_0xdc6c('0x73'));_0x1de161[_0xdc6c('0x84')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x40011c[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x1de161,{'showHidden':![],'depth':null}));ami[_0xdc6c('0x41')](_0xdc6c('0xab'),_0x1de161);break;default:_0x1de161[_0xdc6c('0x97')]=!![];_0x1de161[_0xdc6c('0x8e')]=moment()[_0xdc6c('0x4d')](_0xdc6c('0x73'));_0x1de161[_0xdc6c('0x84')]=moment()[_0xdc6c('0x4d')](_0xdc6c('0x73'));}_0x1de161['queuecallerabandon']=![];_0x1de161[_0xdc6c('0x8b')]=null;_0x1de161['queuecallerexitreason']=_0x40011c[_0xdc6c('0xa5')];this[_0xdc6c('0xf')][_0x40011c[_0xdc6c('0x46')]]=_0x1de161;this[_0xdc6c('0x40')](_0x1de161,_0xdc6c('0xac'));}else if(this[_0xdc6c('0x61')](_0x40011c[_0xdc6c('0xa4')])&&this['isNotNull'](_0x40011c['variable']['queueposition'])){if(!_0x1de161['queuecallerabandon']){_0x1de161[_0xdc6c('0x97')]=!![];_0x1de161['queuecallerexitAt']=moment()[_0xdc6c('0x4d')](_0xdc6c('0x73'));_0x1de161[_0xdc6c('0x4b')]=_0xdc6c('0xad');_0x1de161['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xdc6c('0xf')][_0x40011c[_0xdc6c('0x46')]]=_0x1de161;}}logger[_0xdc6c('0x6a')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x40011c[_0xdc6c('0x46')],_0x1de161[_0xdc6c('0x48')],_0x1de161[_0xdc6c('0x50')],_[_0xdc6c('0x79')](_0x40011c[_0xdc6c('0xa4')])[0x0],_0x40011c[_0xdc6c('0xa5')]);_0x1de161[_0xdc6c('0x13')]=this[_0xdc6c('0x13')][_0x40011c['uniqueid']];}}}}catch(_0x16d973){logger['error']('[%s][voiceQueueReport][varset]',_0x40011c[_0xdc6c('0x46')],util[_0xdc6c('0x3a')](_0x16d973,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xdc6c('0xa3')]=function(_0x4446b5,_0x18eb53,_0x4681a7){var _0x140062=['rtpaudioqos',_0xdc6c('0xae'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xdc6c('0xaf'),_0xdc6c('0xb0'),_0xdc6c('0xb1'),_0xdc6c('0xb2'),_0xdc6c('0xb3'),_0xdc6c('0xb4'),'bridgepeer',_0xdc6c('0xb5'),_0xdc6c('0xb6'),_0xdc6c('0xb7'),_0xdc6c('0xb8'),_0xdc6c('0xb9'),_0xdc6c('0xba'),_0xdc6c('0xbb'),_0xdc6c('0xbc')];if(!_[_0xdc6c('0x33')](_0x18eb53)&&!_[_0xdc6c('0xbd')](_0x140062,_0x18eb53)){if(_['isUndefined'](this['variables'][_0x4446b5])){this[_0xdc6c('0x13')][_0x4446b5]={};}this['variables'][_0x4446b5][_0x18eb53]=_0x4681a7;}};VoiceQueueReport[_0xdc6c('0xa')][_0xdc6c('0xbe')]=function(_0x49dfb4,_0x2f34c2,_0x453b5c){var _0x561999={};for(var _0x25e551=0x0;_0x25e5510x0?_0x2646c8:0x0;this[_0xba1e('0xf')][_0x1b4044[_0xba1e('0x6d')]][_0xba1e('0x2e')]=this['voiceQueues'][_0x1b4044['queue']][_0xba1e('0x2e')]>_[_0xba1e('0x71')](_0x1b4044[_0xba1e('0x73')])?_[_0xba1e('0x71')](_0x1b4044['loggedin']):this[_0xba1e('0xf')][_0x1b4044['queue']][_0xba1e('0x2e')];this[_0xba1e('0x52')](this[_0xba1e('0xf')][_0x1b4044['queue']],_0xba1e('0x13'));}logger[_0xba1e('0x44')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util['inspect'](this[_0xba1e('0xf')][_0x1b4044[_0xba1e('0x6d')]],{'showHidden':![],'depth':null}));ami[_0xba1e('0x42')](_0xba1e('0x74'),this[_0xba1e('0xf')][_0x1b4044[_0xba1e('0x6d')]]);}}}catch(_0x8026d){logger['error'](_0xba1e('0x6c'),util[_0xba1e('0x3b')](_0x8026d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xba1e('0x16')]=function(_0x1a09cb){logger[_0xba1e('0x44')](_0xba1e('0x75'),util[_0xba1e('0x3b')](_0x1a09cb,{'showHidden':![],'depth':null}));ami[_0xba1e('0x42')]('custom:queuesummarycomplete',{});this[_0xba1e('0x10')]=!![];};VoiceQueueReport[_0xba1e('0x32')][_0xba1e('0x18')]=function(_0x259ff5){try{if(this[_0xba1e('0x63')](_0x259ff5)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x259ff5['uniqueid'],util['inspect'](_0x259ff5,{'showHidden':![],'depth':null}));if(_[_0xba1e('0x64')](this[_0xba1e('0x3c')][_0x259ff5[_0xba1e('0x47')]]))this[_0xba1e('0x3c')][_0x259ff5[_0xba1e('0x47')]]=[];if(_[_0xba1e('0x64')](this[_0xba1e('0x33')][_0x259ff5[_0xba1e('0x47')]]))this['channels'][_0x259ff5[_0xba1e('0x47')]]={};var _0x34d8af=new QueueReport();_0x34d8af[_0xba1e('0x4a')]=_0x259ff5['queue'];_0x34d8af[_0xba1e('0x53')]=this[_0xba1e('0xf')][_0x34d8af[_0xba1e('0x4a')]]&&this[_0xba1e('0xf')][_0x34d8af[_0xba1e('0x4a')]][_0xba1e('0x53')]?this[_0xba1e('0xf')][_0x34d8af[_0xba1e('0x4a')]][_0xba1e('0x53')]||'inbound':'inbound';_0x34d8af[_0xba1e('0x6d')]=_0x259ff5[_0xba1e('0x6d')];_0x34d8af['queuecallerjoinAt']=moment()[_0xba1e('0x48')](_0xba1e('0x76'));_0x34d8af['position']=_0x259ff5['position'];_0x34d8af['count']=_0x259ff5[_0xba1e('0x77')];_0x34d8af[_0xba1e('0x47')]=_0x259ff5[_0xba1e('0x47')];_0x34d8af[_0xba1e('0x78')]=this[_0xba1e('0x33')][_0x259ff5[_0xba1e('0x47')]][_0xba1e('0x78')];logger[_0xba1e('0x6f')](_0xba1e('0x79'),_0x34d8af[_0xba1e('0x4a')],_0x34d8af['type']);_[_0xba1e('0x7a')](_0x34d8af,_[_0xba1e('0x7b')](_0x259ff5,_[_0xba1e('0x7c')](_0x34d8af)));this[_0xba1e('0x3c')][_0x259ff5[_0xba1e('0x47')]][_0xba1e('0x7d')](_0x34d8af);this['channels'][_0x259ff5[_0xba1e('0x47')]]=_0x34d8af;this[_0xba1e('0x43')](_0x34d8af,'queuecallerjoin');}}catch(_0x2153bb){logger[_0xba1e('0x3d')](_0xba1e('0x7e'),_0x259ff5[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x2153bb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xba1e('0x19')]=function(_0x38fb59){try{if(this[_0xba1e('0x63')](_0x38fb59)){logger[_0xba1e('0x44')](_0xba1e('0x7f'),_0x38fb59[_0xba1e('0x47')],util['inspect'](_0x38fb59,{'showHidden':![],'depth':null}));if(this[_0xba1e('0x3c')][_0x38fb59[_0xba1e('0x47')]]){var _0x496658=_['last'](this['queueReports'][_0x38fb59[_0xba1e('0x47')]]);_0x496658[_0xba1e('0x80')]=![];_0x496658[_0xba1e('0x81')]=null;_0x496658[_0xba1e('0x82')]=_0x38fb59[_0xba1e('0x82')];_0x496658['originalposition']=_0x38fb59[_0xba1e('0x83')];_0x496658[_0xba1e('0x84')]=!![];_0x496658[_0xba1e('0x85')]=moment()[_0xba1e('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x496658['queuecallerexitreason']=_0xba1e('0x86');_0x496658[_0xba1e('0x87')]=null;logger[_0xba1e('0x6f')](_0xba1e('0x88'),_0x496658['name'],_0x496658[_0xba1e('0x53')]);this['channels'][_0x38fb59[_0xba1e('0x47')]]=_0x496658;this[_0xba1e('0x41')](_0x496658,_0xba1e('0x84'));}}}catch(_0x20ed7c){logger['error'](_0xba1e('0x7f'),_0x38fb59[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x20ed7c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba1e('0x32')][_0xba1e('0x1b')]=function(_0x52a210){try{if(this[_0xba1e('0x63')](_0x52a210)){logger[_0xba1e('0x44')](_0xba1e('0x89'),_0x52a210[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x52a210,{'showHidden':![],'depth':null}));if(this[_0xba1e('0x3c')][_0x52a210['uniqueid']]){var _0x23da0e=_[_0xba1e('0x8a')](this['queueReports'][_0x52a210['uniqueid']]);_0x23da0e[_0xba1e('0x8b')]=moment()[_0xba1e('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x23da0e[_0xba1e('0x8c')]=_0x52a210[_0xba1e('0x8c')];_0x23da0e[_0xba1e('0x8d')]=_0x52a210['connectedlinename'];logger[_0xba1e('0x6f')](_0xba1e('0x8e'),_0x23da0e[_0xba1e('0x4a')],_0x23da0e['type'],_0x52a210[_0xba1e('0x8c')],_0x52a210[_0xba1e('0x8d')]);this['channels'][_0x52a210[_0xba1e('0x47')]]=_0x23da0e;this['emitVoiceQueueChannelSave'](_0x23da0e,_0xba1e('0x1a'));}}}catch(_0x32b915){logger[_0xba1e('0x3d')](_0xba1e('0x89'),_0x52a210['uniqueid'],util[_0xba1e('0x3b')](_0x32b915,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x4714c7){try{if(this[_0xba1e('0x63')](_0x4714c7)){logger[_0xba1e('0x44')](_0xba1e('0x8f'),_0x4714c7[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x4714c7,{'showHidden':![],'depth':null}));if(this[_0xba1e('0x3c')][_0x4714c7[_0xba1e('0x47')]]){var _0x1cce08=_['last'](this[_0xba1e('0x3c')][_0x4714c7[_0xba1e('0x47')]]);_0x1cce08[_0xba1e('0x80')]=!![];_0x1cce08[_0xba1e('0x4e')]='COMPLETEDBYAGENT';logger['info'](_0xba1e('0x90'),_0x1cce08[_0xba1e('0x4a')],_0x1cce08['type']);}}}catch(_0x4736f5){logger[_0xba1e('0x3d')](_0xba1e('0x8f'),_0x4714c7[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x4736f5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x29fb78){try{if(this[_0xba1e('0x63')](_0x29fb78)){logger[_0xba1e('0x44')](_0xba1e('0x91'),_0x29fb78[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x29fb78,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x29fb78[_0xba1e('0x47')]]){var _0x4dbba6=_[_0xba1e('0x8a')](this[_0xba1e('0x3c')][_0x29fb78[_0xba1e('0x47')]]);_0x4dbba6[_0xba1e('0x84')]=![];_0x4dbba6[_0xba1e('0x85')]=null;_0x4dbba6[_0xba1e('0x92')]=!![];_0x4dbba6[_0xba1e('0x87')]=_0x29fb78[_0xba1e('0x93')];_0x4dbba6[_0xba1e('0x82')]=_0x29fb78[_0xba1e('0x82')];_0x4dbba6[_0xba1e('0x80')]=!![];_0x4dbba6[_0xba1e('0x94')]=![];_0x4dbba6[_0xba1e('0x95')]=null;if(!_0x4dbba6[_0xba1e('0x96')]){if(_0x29fb78[_0xba1e('0x97')]==_0xba1e('0x96')){_0x4dbba6['queuecallerexitreason']=_0xba1e('0x98');logger[_0xba1e('0x6f')](_0xba1e('0x99'),_0x4dbba6['name'],_0x4dbba6[_0xba1e('0x53')]);}else{if(_[_0xba1e('0x9a')](_0x29fb78[_0xba1e('0x38')]['toLowerCase'](),_0xba1e('0x9b'))){if(this[_0xba1e('0x3c')][_0x29fb78['linkedid']]){var _0x2ca7eb=_['last'](this[_0xba1e('0x3c')][_0x29fb78[_0xba1e('0x9c')]]);_0x2ca7eb[_0xba1e('0x80')]=![];_0x2ca7eb[_0xba1e('0x94')]=!![];_0x2ca7eb['queuecallerexitAt']=moment(_0x4dbba6[_0xba1e('0x9d')])[_0xba1e('0x9e')](_0x29fb78[_0xba1e('0x82')],'seconds')['format'](_0xba1e('0x76'));_0x2ca7eb['queuecallerexitreason']='FORWARDTRANSFER';_0x2ca7eb['transfer']=!![];_0x2ca7eb['transfertype']='FORWARD';_0x2ca7eb[_0xba1e('0x9f')]=_0x29fb78['destexten'];_0x2ca7eb['transferuniqueid']=_0x29fb78['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x2ca7eb['name'],_0x2ca7eb[_0xba1e('0x53')]);var _0x2a3fbb=this['queueReports'][_0x29fb78[_0xba1e('0x9c')]];this[_0xba1e('0x3c')][_0x29fb78['linkedid']]=this[_0xba1e('0x3c')][_0x29fb78[_0xba1e('0x47')]];this[_0xba1e('0x3c')][_0x29fb78[_0xba1e('0x47')]]=_0x2a3fbb;}}else{_0x4dbba6[_0xba1e('0x4e')]=_0xba1e('0xa0')+_0x29fb78[_0xba1e('0x97')]['toUpperCase']();logger[_0xba1e('0x6f')](_0xba1e('0xa1'),_0x4dbba6['name'],_0x4dbba6['type'],_0x4dbba6['queuecallerexitreason']);}}}this['channels'][_0x29fb78[_0xba1e('0x47')]]=_0x4dbba6;this[_0xba1e('0x41')](_0x4dbba6,'agentcomplete');}}}catch(_0x4158d8){logger[_0xba1e('0x3d')](_0xba1e('0x91'),_0x29fb78[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x4158d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xba1e('0x32')]['syncVarSet']=function(_0x572b56){try{if(this[_0xba1e('0x63')](_0x572b56)){logger[_0xba1e('0x44')]('[%s][voiceQueueReport][varset]',_0x572b56[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x572b56,{'showHidden':![],'depth':null}));this[_0xba1e('0xa2')](_0x572b56[_0xba1e('0x47')],_['keys'](_0x572b56[_0xba1e('0xa3')])[0x0],_0x572b56[_0xba1e('0xa4')]);if(this[_0xba1e('0x3c')][_0x572b56[_0xba1e('0x47')]]){var _0x2bc05b=_['last'](this['queueReports'][_0x572b56['uniqueid']]);if(_0x2bc05b){if(this['isNotNull'](_0x572b56[_0xba1e('0xa3')])&&this['isNotNull'](_0x572b56[_0xba1e('0xa3')][_0xba1e('0xa5')])){switch(_0x572b56['value']){case'CONTINUE':_0x2bc05b['queuecallerexit']=![];_0x2bc05b[_0xba1e('0x95')]=null;break;case'TIMEOUT':_0x2bc05b[_0xba1e('0xa6')]=_0xba1e('0xa7');_0x2bc05b['queuecallerexit']=!![];_0x2bc05b['queuecallerexitAt']=moment()[_0xba1e('0x48')](_0xba1e('0x76'));_0x2bc05b['queuecallerleaveAt']=moment()[_0xba1e('0x48')](_0xba1e('0x76'));logger[_0xba1e('0x44')](_0xba1e('0xa8'),_0x572b56[_0xba1e('0x47')],util['inspect'](_0x2bc05b,{'showHidden':![],'depth':null}));ami['emit'](_0xba1e('0xa9'),_0x2bc05b);break;default:_0x2bc05b[_0xba1e('0x94')]=!![];_0x2bc05b['queuecallerexitAt']=moment()[_0xba1e('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x2bc05b[_0xba1e('0x8b')]=moment()[_0xba1e('0x48')](_0xba1e('0x76'));}_0x2bc05b[_0xba1e('0x84')]=![];_0x2bc05b[_0xba1e('0x85')]=null;_0x2bc05b[_0xba1e('0x4e')]=_0x572b56[_0xba1e('0xa4')];this['channels'][_0x572b56[_0xba1e('0x47')]]=_0x2bc05b;this[_0xba1e('0x41')](_0x2bc05b,_0xba1e('0x20'));}else if(this[_0xba1e('0x63')](_0x572b56[_0xba1e('0xa3')])&&this['isNotNull'](_0x572b56[_0xba1e('0xa3')]['queueposition'])){if(!_0x2bc05b[_0xba1e('0x84')]){_0x2bc05b['queuecallerexit']=!![];_0x2bc05b['queuecallerexitAt']=moment()[_0xba1e('0x48')](_0xba1e('0x76'));_0x2bc05b[_0xba1e('0x4e')]='EXITWITHKEY';_0x2bc05b[_0xba1e('0x8b')]=moment()[_0xba1e('0x48')](_0xba1e('0x76'));this[_0xba1e('0x33')][_0x572b56[_0xba1e('0x47')]]=_0x2bc05b;}}logger[_0xba1e('0x6f')](_0xba1e('0xaa'),_0x572b56[_0xba1e('0x47')],_0x2bc05b[_0xba1e('0x4a')],_0x2bc05b[_0xba1e('0x53')],_[_0xba1e('0x7c')](_0x572b56[_0xba1e('0xa3')])[0x0],_0x572b56[_0xba1e('0xa4')]);_0x2bc05b[_0xba1e('0x12')]=this['variables'][_0x572b56[_0xba1e('0x47')]];}}}}catch(_0x3923c2){logger['error'](_0xba1e('0xab'),_0x572b56[_0xba1e('0x47')],util[_0xba1e('0x3b')](_0x3923c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xba1e('0xa2')]=function(_0x4ad96b,_0x436152,_0x42ff31){var _0x2d7252=[_0xba1e('0xac'),_0xba1e('0xad'),'rtpaudioqosjitter',_0xba1e('0xae'),_0xba1e('0xaf'),_0xba1e('0xb0'),'rtpaudioqosrtt',_0xba1e('0xb1'),'sipcallid',_0xba1e('0xb2'),'bridgepeer',_0xba1e('0xb3'),_0xba1e('0xb4'),_0xba1e('0xb5'),_0xba1e('0xb6'),'memberlastcall','membername',_0xba1e('0xb7'),_0xba1e('0xb8')];if(!_['isNil'](_0x436152)&&!_[_0xba1e('0xb9')](_0x2d7252,_0x436152)){if(_[_0xba1e('0x64')](this[_0xba1e('0x12')][_0x4ad96b])){this[_0xba1e('0x12')][_0x4ad96b]={};}this[_0xba1e('0x12')][_0x4ad96b][_0x436152]=_0x42ff31;}};VoiceQueueReport[_0xba1e('0x32')]['handleHangup']=function(_0x4510fc,_0x397fc4,_0x212077){var _0x42e8a6={};for(var _0x5f82ce=0x0;_0x5f82ce=0x0?moment(_0x39e442[_0x3d1b('0x16')])[_0x3d1b('0xd')](_0x39e442['starttime'],_0x3d1b('0x17')):null,'data1':_0x3d1b('0x18'),'data2':_0x39e442[_0x3d1b('0x12')],'data3':_0x39e442[_0x3d1b('0x19')],'data4':_0x39e442[_0x3d1b('0x1a')]||null,'role':_0x3d1b('0x11'),'internal':_0x39e442[_0x3d1b('0x12')]?_['toNumber'](_0x39e442[_0x3d1b('0x12')]):undefined,'uniqueid':_0x39e442[_0x3d1b('0x1b')]},'log':_0x3d1b('0x4')});}; \ No newline at end of file +var _0xb976=['CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','calleridnum','exten','queue','agent','accountcode','voiceDialReport','voice','starttime','endtime','seconds','dialstring','uniqueid','lodash','util','../client','queuecallercompleteAt','Request'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xb976,0x175));var _0x6b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb976[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var _=require(_0x6b97('0x0'));var util=require(_0x6b97('0x1'));var client=require(_0x6b97('0x2'));exports['voiceQueueReport']=function(_0x4a5964){var _0x395e6b=_0x4a5964[_0x6b97('0x3')]||_0x4a5964['queuecallerexitAt'];return client[_0x6b97('0x4')](_0x6b97('0x5'),{'body':{'channel':'voice','membername':_0x4a5964[_0x6b97('0x6')],'interface':_[_0x6b97('0x7')](_0x4a5964[_0x6b97('0x8')])?util[_0x6b97('0x9')](_0x6b97('0xa'),_0x4a5964[_0x6b97('0x6')]):_0x4a5964['interface'],'type':_0x6b97('0xb'),'enterAt':_0x4a5964[_0x6b97('0xc')],'exitAt':_0x395e6b,'duration':moment(_0x395e6b)[_0x6b97('0xd')](_0x4a5964[_0x6b97('0xc')],'seconds'),'data1':_0x6b97('0xe'),'data2':_0x4a5964[_0x6b97('0xf')],'data3':_0x4a5964[_0x6b97('0x10')],'data4':null,'data5':_0x4a5964[_0x6b97('0x11')],'role':_0x6b97('0x12'),'internal':_0x4a5964[_0x6b97('0x13')]?_['toNumber'](_0x4a5964['accountcode']):undefined,'uniqueid':_0x4a5964['uniqueid']},'log':'CreateMemberReport'});};exports[_0x6b97('0x14')]=function(_0x1dd625){return client[_0x6b97('0x4')](_0x6b97('0x5'),{'body':{'channel':_0x6b97('0x15'),'membername':_0x1dd625['membername'],'interface':_0x1dd625[_0x6b97('0x8')],'type':_0x6b97('0xb'),'enterAt':_0x1dd625[_0x6b97('0x16')],'exitAt':_0x1dd625['endtime'],'duration':moment(_0x1dd625[_0x6b97('0x17')])[_0x6b97('0xd')](_0x1dd625['starttime'],'seconds')>=0x0?moment(_0x1dd625[_0x6b97('0x17')])[_0x6b97('0xd')](_0x1dd625[_0x6b97('0x16')],_0x6b97('0x18')):null,'data1':'outbound','data2':_0x1dd625[_0x6b97('0x13')],'data3':_0x1dd625['exten'],'data4':_0x1dd625[_0x6b97('0x19')]||null,'role':'agent','internal':_0x1dd625[_0x6b97('0x13')]?_['toNumber'](_0x1dd625[_0x6b97('0x13')]):undefined,'uniqueid':_0x1dd625[_0x6b97('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index cde32c8..c4dd5f3 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 _0x0bb4=['getSettings','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x57ea2b,_0x4e1f85){var _0x438e87=function(_0x42731e){while(--_0x42731e){_0x57ea2b['push'](_0x57ea2b['shift']());}};_0x438e87(++_0x4e1f85);}(_0x0bb4,0x77));var _0x40bb=function(_0x31cac1,_0x249d7e){_0x31cac1=_0x31cac1-0x0;var _0x360369=_0x0bb4[_0x31cac1];return _0x360369;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return client['Request'](_0x40bb('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x40bb('0x3'),_0x40bb('0x4')]},'log':_0x40bb('0x5')});}; \ No newline at end of file +var _0x590a=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x1e8f35,_0x3db390){var _0x446c13=function(_0xa1e11e){while(--_0xa1e11e){_0x1e8f35['push'](_0x1e8f35['shift']());}};_0x446c13(++_0x3db390);}(_0x590a,0x159));var _0xa590=function(_0x10b481,_0x45ed2b){_0x10b481=_0x10b481-0x0;var _0x507727=_0x590a[_0x10b481];return _0x507727;};'use strict';var client=require('../client');exports[_0xa590('0x0')]=function(){return client[_0xa590('0x1')](_0xa590('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa590('0x3'),_0xa590('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 757a872..babb422 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 _0x84fd=['Request','GetTemplate','html','../client','getTemplates'];(function(_0x3aacce,_0x9b0558){var _0xb576ce=function(_0x4d62ed){while(--_0x4d62ed){_0x3aacce['push'](_0x3aacce['shift']());}};_0xb576ce(++_0x9b0558);}(_0x84fd,0xda));var _0xd84f=function(_0x2e525e,_0x576381){_0x2e525e=_0x2e525e-0x0;var _0x29cc95=_0x84fd[_0x2e525e];return _0x29cc95;};'use strict';var client=require(_0xd84f('0x0'));exports[_0xd84f('0x1')]=function(_0x203b10){return function(_0x41334c){return client[_0xd84f('0x2')](_0xd84f('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0xd84f('0x4')]},'log':_0xd84f('0x3')});};}; \ No newline at end of file +var _0x693a=['getTemplates','Request','GetTemplate','name','../client'];(function(_0x9f7b85,_0x5067c4){var _0x5873bd=function(_0x4b4073){while(--_0x4b4073){_0x9f7b85['push'](_0x9f7b85['shift']());}};_0x5873bd(++_0x5067c4);}(_0x693a,0x1ee));var _0xa693=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0x693a[_0x4cc492];return _0x1f36b9;};'use strict';var client=require(_0xa693('0x0'));exports[_0xa693('0x1')]=function(_0x583e59){return function(_0x269145){return client[_0xa693('0x2')](_0xa693('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa693('0x4'),'html']},'log':_0xa693('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e7443ed..15ad02f 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 _0xb02e=['GetTrigger','channel','status','Condition','field','operator','value','AnyConditions','Action','data1','data2','data3','data6','../client','getTriggers'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0xb02e,0x175));var _0xeb02=function(_0x55ad0a,_0xcede12){_0x55ad0a=_0x55ad0a-0x0;var _0x3d1e03=_0xb02e[_0x55ad0a];return _0x3d1e03;};'use strict';var client=require(_0xeb02('0x0'));exports[_0xeb02('0x1')]=function(_0x2f97e9){return function(_0x27625a){return client['Request'](_0xeb02('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xeb02('0x3'),_0xeb02('0x4')],'include':[{'model':_0xeb02('0x5'),'as':'AllConditions','attributes':['id',_0xeb02('0x6'),_0xeb02('0x7'),_0xeb02('0x8')]},{'model':_0xeb02('0x5'),'as':_0xeb02('0x9'),'attributes':['id',_0xeb02('0x6'),'operator',_0xeb02('0x8')]},{'model':_0xeb02('0xa'),'as':'Actions','attributes':['id','action',_0xeb02('0xb'),_0xeb02('0xc'),_0xeb02('0xd'),'data4','data5',_0xeb02('0xe'),'data7']}]},'log':_0xeb02('0x2')});};}; \ No newline at end of file +var _0xe361=['data4','../client','getTriggers','Request','name','channel','status','Condition','AllConditions','operator','value','field','Action','Actions','action','data1','data2','data3'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0xe361,0x91));var _0x1e36=function(_0x260859,_0x3cfcff){_0x260859=_0x260859-0x0;var _0x4b77f8=_0xe361[_0x260859];return _0x4b77f8;};'use strict';var client=require(_0x1e36('0x0'));exports[_0x1e36('0x1')]=function(_0x423cfe){return function(_0x101d4a){return client[_0x1e36('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x1e36('0x3'),_0x1e36('0x4'),_0x1e36('0x5')],'include':[{'model':_0x1e36('0x6'),'as':_0x1e36('0x7'),'attributes':['id','field',_0x1e36('0x8'),_0x1e36('0x9')]},{'model':'Condition','as':'AnyConditions','attributes':['id',_0x1e36('0xa'),'operator',_0x1e36('0x9')]},{'model':_0x1e36('0xb'),'as':_0x1e36('0xc'),'attributes':['id',_0x1e36('0xd'),_0x1e36('0xe'),_0x1e36('0xf'),_0x1e36('0x10'),_0x1e36('0x11'),'data5','data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1930067..a1ec829 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 _0x61ea=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x61ea,0x1a0));var _0xa61e=function(_0x177ac5,_0x2b5980){_0x177ac5=_0x177ac5-0x0;var _0x331691=_0x61ea[_0x177ac5];return _0x331691;};'use strict';var client=require(_0xa61e('0x0'));exports[_0xa61e('0x1')]=function(_0x1b5e52){return function(_0xd14060){return client[_0xa61e('0x2')](_0xa61e('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa61e('0x4'),_0xa61e('0x5'),_0xa61e('0x6')]},'log':_0xa61e('0x3')});};}; \ No newline at end of file +var _0x2b52=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x9c673f,_0x3173d2){var _0x400b9a=function(_0x2d6b6c){while(--_0x2d6b6c){_0x9c673f['push'](_0x9c673f['shift']());}};_0x400b9a(++_0x3173d2);}(_0x2b52,0x12a));var _0x22b5=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0x2b52[_0x40822a];return _0x357420;};'use strict';var client=require(_0x22b5('0x0'));exports[_0x22b5('0x1')]=function(_0x5a239d){return function(_0x372ce0){return client[_0x22b5('0x2')](_0x22b5('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x22b5('0x4'),'registry','defaultuser']},'log':_0x22b5('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 191d822..19e57cb 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe706,0xa3));var _0x6e70=function(_0x133851,_0x4d6780){_0x133851=_0x133851-0x0;var _0x188215=_0xe706[_0x133851];return _0x188215;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 000f553..e68888e 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 _0x9c83=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x49b14d,_0x578d07){var _0x3d2488=function(_0x5a8668){while(--_0x5a8668){_0x49b14d['push'](_0x49b14d['shift']());}};_0x3d2488(++_0x578d07);}(_0x9c83,0x17d));var _0x39c8=function(_0x1bd360,_0x2f0a2f){_0x1bd360=_0x1bd360-0x0;var _0x37b15b=_0x9c83[_0x1bd360];return _0x37b15b;};'use strict';var client=require(_0x39c8('0x0'));exports[_0x39c8('0x1')]=function(_0x46dfc0){return client[_0x39c8('0x2')](_0x39c8('0x3'),{'body':_0x46dfc0,'log':_0x39c8('0x3')});};exports['update']=function(_0x104396,_0x475436,_0x22800f){return client[_0x39c8('0x2')]('UpdateVoiceAgentReport',{'body':_0x104396,'options':{'where':{'uniqueid':_0x475436,'interface':_0x22800f,'agentcomplete':!![]}},'log':_0x39c8('0x4')});}; \ No newline at end of file +var _0x7774=['CreateVoiceAgentReport','update','create','Request'];(function(_0x53f608,_0x256def){var _0x495b7d=function(_0x467eab){while(--_0x467eab){_0x53f608['push'](_0x53f608['shift']());}};_0x495b7d(++_0x256def);}(_0x7774,0x106));var _0x4777=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x7774[_0x3fb5eb];return _0x481291;};'use strict';var client=require('../client');exports[_0x4777('0x0')]=function(_0x2f0c02){return client[_0x4777('0x1')](_0x4777('0x2'),{'body':_0x2f0c02,'log':_0x4777('0x2')});};exports[_0x4777('0x3')]=function(_0x537e18,_0x1bd0e7,_0x2a5be2){return client[_0x4777('0x1')]('UpdateVoiceAgentReport',{'body':_0x537e18,'options':{'where':{'uniqueid':_0x1bd0e7,'interface':_0x2a5be2,'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 9e653e8..e730536 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 _0x8d54=['format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x377ac0,_0x5c6208){var _0x230711=function(_0x46417e){while(--_0x46417e){_0x377ac0['push'](_0x377ac0['shift']());}};_0x230711(++_0x5c6208);}(_0x8d54,0x6f));var _0x48d5=function(_0x59943d,_0x2e751b){_0x59943d=_0x59943d-0x0;var _0x46ace9=_0x8d54[_0x59943d];return _0x46ace9;};'use strict';var moment=require(_0x48d5('0x0'));var util=require(_0x48d5('0x1'));var _=require(_0x48d5('0x2'));var client=require(_0x48d5('0x3'));exports[_0x48d5('0x4')]=function(_0x5b9a95){return client[_0x48d5('0x5')](_0x48d5('0x6'),{'body':_['merge'](_0x5b9a95,{'source':_0x5b9a95[_0x48d5('0x7')],'destinationcontext':_0x5b9a95[_0x48d5('0x8')],'callerid':_0x5b9a95[_0x48d5('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x48d5('0xa')]=function(){return function(){return client[_0x48d5('0x5')](_0x48d5('0xb'),{'options':{'where':{'type':[_0x48d5('0xc')],'createdAt':{'$between':[moment()[_0x48d5('0xd')](_0x48d5('0xe'))[_0x48d5('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x48d5('0x10')](_0x48d5('0xe'))[_0x48d5('0xf')](_0x48d5('0x11'))]}},'attributes':['type',_0x48d5('0x12'),_0x48d5('0x13'),'billableseconds']},'log':_0x48d5('0x14')});};}; \ No newline at end of file +var _0xab16=['callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum'];(function(_0x544cd4,_0x4d4215){var _0x5053e8=function(_0x5d4f18){while(--_0x5d4f18){_0x544cd4['push'](_0x544cd4['shift']());}};_0x5053e8(++_0x4d4215);}(_0xab16,0xc1));var _0x6ab1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xab16[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var util=require(_0x6ab1('0x0'));var _=require(_0x6ab1('0x1'));var client=require(_0x6ab1('0x2'));exports[_0x6ab1('0x3')]=function(_0x5e8582){return client[_0x6ab1('0x4')](_0x6ab1('0x5'),{'body':_['merge'](_0x5e8582,{'source':_0x5e8582[_0x6ab1('0x6')],'destinationcontext':_0x5e8582['context'],'callerid':_0x5e8582[_0x6ab1('0x7')],'amaflags':_0x6ab1('0x8')}),'log':_0x6ab1('0x5')});};exports[_0x6ab1('0x9')]=function(){return function(){return client[_0x6ab1('0x4')](_0x6ab1('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6ab1('0xb')]('day')[_0x6ab1('0xc')](_0x6ab1('0xd')),moment()[_0x6ab1('0xe')](_0x6ab1('0xf'))[_0x6ab1('0xc')](_0x6ab1('0xd'))]}},'attributes':[_0x6ab1('0x10'),'disposition',_0x6ab1('0x11'),_0x6ab1('0x12')]},'log':_0x6ab1('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4e26c33..988282a 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 _0x4718=['create','CreateVoiceDialReport','../client'];(function(_0x4380e2,_0x4834fe){var _0x339df9=function(_0x3d3925){while(--_0x3d3925){_0x4380e2['push'](_0x4380e2['shift']());}};_0x339df9(++_0x4834fe);}(_0x4718,0x140));var _0x8471=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0x4718[_0x40b493];return _0x548365;};'use strict';var client=require(_0x8471('0x0'));exports[_0x8471('0x1')]=function(_0x2ddfb6){return client['Request'](_0x8471('0x2'),{'body':_0x2ddfb6,'log':_0x8471('0x2')});}; \ No newline at end of file +var _0x9f92=['create','Request','CreateVoiceDialReport'];(function(_0x165bf3,_0x53014b){var _0x19a478=function(_0x140802){while(--_0x140802){_0x165bf3['push'](_0x165bf3['shift']());}};_0x19a478(++_0x53014b);}(_0x9f92,0x150));var _0x29f9=function(_0x4527d8,_0x59e349){_0x4527d8=_0x4527d8-0x0;var _0x1ec91d=_0x9f92[_0x4527d8];return _0x1ec91d;};'use strict';var client=require('../client');exports[_0x29f9('0x0')]=function(_0x47d69f){return client[_0x29f9('0x1')](_0x29f9('0x2'),{'body':_0x47d69f,'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 d306cfa..a7f884c 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 _0x39c4=['getVoiceExtensions','exten','recordingFormat'];(function(_0x250d4c,_0x2ae773){var _0x2f3734=function(_0x3828fa){while(--_0x3828fa){_0x250d4c['push'](_0x250d4c['shift']());}};_0x2f3734(++_0x2ae773);}(_0x39c4,0x174));var _0x439c=function(_0x313449,_0x48d23c){_0x313449=_0x313449-0x0;var _0x396292=_0x39c4[_0x313449];return _0x396292;};'use strict';var client=require('../client');exports[_0x439c('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x439c('0x1'),_0x439c('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xa45c=['exten','../client','getVoiceExtensions'];(function(_0x350e0e,_0x2264c6){var _0x39a049=function(_0x5ee161){while(--_0x5ee161){_0x350e0e['push'](_0x350e0e['shift']());}};_0x39a049(++_0x2264c6);}(_0xa45c,0x6d));var _0xca45=function(_0x34de70,_0x3200bc){_0x34de70=_0x34de70-0x0;var _0x294b57=_0xa45c[_0x34de70];return _0x294b57;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xca45('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xca45('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9aa7a8b..9dffee8 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 _0x1b3c=['dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x1475a,_0x483777){var _0x12424f=function(_0x2efae6){while(--_0x2efae6){_0x1475a['push'](_0x1475a['shift']());}};_0x12424f(++_0x483777);}(_0x1b3c,0x1b4));var _0xc1b3=function(_0x476410,_0x1b2e84){_0x476410=_0x476410-0x0;var _0x174e50=_0x1b3c[_0x476410];return _0x174e50;};'use strict';var client=require(_0xc1b3('0x0'));exports[_0xc1b3('0x1')]=function(){return function(){return client[_0xc1b3('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xc1b3('0x3'),_0xc1b3('0x4'),_0xc1b3('0x5'),_0xc1b3('0x6'),_0xc1b3('0x7'),_0xc1b3('0x8'),_0xc1b3('0x9'),'dialMethod','dialLimitChannel',_0xc1b3('0xa'),_0xc1b3('0xb'),_0xc1b3('0xc'),_0xc1b3('0xd'),_0xc1b3('0xe'),_0xc1b3('0xf'),_0xc1b3('0x10'),_0xc1b3('0x11'),_0xc1b3('0x12'),_0xc1b3('0x13'),_0xc1b3('0x14'),_0xc1b3('0x15'),'dialCongestionRetryFrequency',_0xc1b3('0x16'),_0xc1b3('0x17'),_0xc1b3('0x18'),_0xc1b3('0x19'),_0xc1b3('0x1a'),_0xc1b3('0x1b'),_0xc1b3('0x1c'),'dialPrefix',_0xc1b3('0x1d'),_0xc1b3('0x1e'),_0xc1b3('0x1f'),_0xc1b3('0x20'),_0xc1b3('0x21'),_0xc1b3('0x22'),_0xc1b3('0x23'),_0xc1b3('0x24'),_0xc1b3('0x25'),_0xc1b3('0x26'),'dialAMDMaximumWordLength',_0xc1b3('0x27'),_0xc1b3('0x28'),_0xc1b3('0x29'),'dialOrderByScheduledAt',_0xc1b3('0x2a'),_0xc1b3('0x2b'),'dialQueueProject2',_0xc1b3('0x7'),'strategy',_0xc1b3('0x2c'),'dialCutDigit',_0xc1b3('0x2d'),_0xc1b3('0x2e'),'dialDropMaxRetry',_0xc1b3('0x2f'),_0xc1b3('0x30'),_0xc1b3('0x31'),_0xc1b3('0x32'),_0xc1b3('0x33'),_0xc1b3('0x34'),_0xc1b3('0x35'),_0xc1b3('0x36'),'dialPredictiveIntervalMaxThreshold',_0xc1b3('0x37'),_0xc1b3('0x38'),_0xc1b3('0x39'),_0xc1b3('0x3a')],'include':[{'model':_0xc1b3('0x3b'),'as':'Trunk','attributes':['id',_0xc1b3('0x3'),'callerid',_0xc1b3('0x3c')]},{'model':'Pause','as':_0xc1b3('0x3d'),'attributes':['id',_0xc1b3('0x3')]},{'model':_0xc1b3('0x3b'),'as':_0xc1b3('0x3e'),'attributes':['id',_0xc1b3('0x3'),'callerid',_0xc1b3('0x3c')]},{'model':_0xc1b3('0x3f'),'as':_0xc1b3('0x3f'),'attributes':['id',_0xc1b3('0x3')],'include':[{'model':_0xc1b3('0x3f'),'as':_0xc1b3('0x40'),'attributes':['id',_0xc1b3('0x3'),_0xc1b3('0x41')]}]}]},'log':_0xc1b3('0x1')});};}; \ No newline at end of file +var _0xb603=['type','dialActive','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','getVoiceQueues','../client','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format'];(function(_0x25f50a,_0x310ba6){var _0x53f97c=function(_0x121cff){while(--_0x121cff){_0x25f50a['push'](_0x25f50a['shift']());}};_0x53f97c(++_0x310ba6);}(_0xb603,0x1e1));var _0x3b60=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb603[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x3b60('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x3b60('0x1')](_0x3b60('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3b60('0x3'),_0x3b60('0x4'),_0x3b60('0x5'),_0x3b60('0x6'),_0x3b60('0x7'),_0x3b60('0x8'),'dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0x3b60('0x9'),_0x3b60('0xa'),_0x3b60('0xb'),_0x3b60('0xc'),_0x3b60('0xd'),_0x3b60('0xe'),_0x3b60('0xf'),_0x3b60('0x10'),_0x3b60('0x11'),_0x3b60('0x12'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0x3b60('0x13'),_0x3b60('0x14'),'dialGlobalMaxRetry',_0x3b60('0x15'),'dialGlobalInterval',_0x3b60('0x16'),_0x3b60('0x17'),'dialAMDActive',_0x3b60('0x18'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x3b60('0x19'),_0x3b60('0x1a'),_0x3b60('0x1b'),_0x3b60('0x1c'),'dialAMDSilenceThreshold',_0x3b60('0x1d'),_0x3b60('0x1e'),_0x3b60('0x1f'),_0x3b60('0x20'),_0x3b60('0x21'),_0x3b60('0x22'),_0x3b60('0x23'),_0x3b60('0x24'),_0x3b60('0x6'),_0x3b60('0x25'),_0x3b60('0x26'),_0x3b60('0x27'),_0x3b60('0x28'),_0x3b60('0x29'),_0x3b60('0x2a'),'dialDropRetryFrequency',_0x3b60('0x2b'),_0x3b60('0x2c'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x3b60('0x2d'),_0x3b60('0x2e'),_0x3b60('0x2f'),_0x3b60('0x30'),_0x3b60('0x31'),_0x3b60('0x32'),_0x3b60('0x33'),_0x3b60('0x34')],'include':[{'model':_0x3b60('0x35'),'as':_0x3b60('0x35'),'attributes':['id',_0x3b60('0x36'),_0x3b60('0x37'),'active']},{'model':'Pause','as':_0x3b60('0x38'),'attributes':['id',_0x3b60('0x36')]},{'model':_0x3b60('0x35'),'as':_0x3b60('0x39'),'attributes':['id',_0x3b60('0x36'),_0x3b60('0x37'),_0x3b60('0x3a')]},{'model':_0x3b60('0x3b'),'as':_0x3b60('0x3b'),'attributes':['id',_0x3b60('0x36')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x3b60('0x36'),'interval']}]}]},'log':_0x3b60('0x3c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d135d35..700d2d8 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(_0xee0393,_0x51358b){var _0x419a63=function(_0x317aad){while(--_0x317aad){_0xee0393['push'](_0xee0393['shift']());}};_0x419a63(++_0x51358b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1c0d54,_0x27ad0a){var _0x5d767c=function(_0x22efd6){while(--_0x22efd6){_0x1c0d54['push'](_0x1c0d54['shift']());}};_0x5d767c(++_0x27ad0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 d8b8944..fa66dc6 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 _0x7e7a=['getVoiceQueueRtPauses','Request'];(function(_0x27792a,_0x45903a){var _0x58ce92=function(_0x30b873){while(--_0x30b873){_0x27792a['push'](_0x27792a['shift']());}};_0x58ce92(++_0x45903a);}(_0x7e7a,0x1ec));var _0xa7e7=function(_0x48651a,_0x428757){_0x48651a=_0x48651a-0x0;var _0x2ae96d=_0x7e7a[_0x48651a];return _0x2ae96d;};'use strict';var client=require('../client');exports[_0xa7e7('0x0')]=function(_0x5c202a){return function(){return client[_0xa7e7('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5c202a,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xb99b=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x17c721,_0x4b3821){var _0x5d4ced=function(_0x41f568){while(--_0x41f568){_0x17c721['push'](_0x17c721['shift']());}};_0x5d4ced(++_0x4b3821);}(_0xb99b,0x1ba));var _0xbb99=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb99b[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xbb99('0x0'));exports[_0xbb99('0x1')]=function(_0x73a2c8){return function(){return client[_0xbb99('0x2')](_0xbb99('0x3'),{'options':{'where':{'VoiceQueueId':_0x73a2c8,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 8e395c4..e87f820 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2e322c,_0x222c2c){var _0x2d6e36=function(_0x1ad91d){while(--_0x1ad91d){_0x2e322c['push'](_0x2e322c['shift']());}};_0x2d6e36(++_0x222c2c);}(_0x7a54,0x106));var _0x47a5=function(_0x805c33,_0x475542){_0x805c33=_0x805c33-0x0;var _0x561345=_0x7a54[_0x805c33];return _0x561345;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5da08e,_0x3bc5b2){var _0x4abf0f=function(_0x4109d5){while(--_0x4109d5){_0x5da08e['push'](_0x5da08e['shift']());}};_0x4abf0f(++_0x3bc5b2);}(_0x7a54,0x106));var _0x47a5=function(_0x119332,_0x41587c){_0x119332=_0x119332-0x0;var _0x2fcf60=_0x7a54[_0x119332];return _0x2fcf60;};'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 72c16b4..4ec6693 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 _0x1f48=['transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x1f48,0x131));var _0x81f4=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x1f48[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0x81f4('0x0'));exports[_0x81f4('0x1')]={};exports[_0x81f4('0x2')]=function(_0x5a2c90){return client[_0x81f4('0x3')](_0x81f4('0x4'),{'body':{'result':_0x5a2c90[_0x81f4('0x5')],'transfererchannel':_0x5a2c90[_0x81f4('0x6')],'transferercalleridnum':_0x5a2c90[_0x81f4('0x7')],'transferercalleridname':_0x5a2c90[_0x81f4('0x8')],'transfererconnectedlinenum':_0x5a2c90[_0x81f4('0x9')],'transfererconnectedlinename':_0x5a2c90['transfererconnectedlinename'],'transfereraccountcode':_0x5a2c90[_0x81f4('0xa')],'transferercontext':_0x5a2c90[_0x81f4('0xb')],'transfererexten':_0x5a2c90[_0x81f4('0xc')],'transfererlinkedid':_0x5a2c90[_0x81f4('0xd')],'transfereechannel':_0x5a2c90[_0x81f4('0xe')],'transfereecalleridnum':_0x5a2c90[_0x81f4('0xf')],'transfereecalleridname':_0x5a2c90[_0x81f4('0x10')],'transfereeconnectedlinenum':_0x5a2c90[_0x81f4('0x11')],'transfereeconnectedlinename':_0x5a2c90[_0x81f4('0x12')],'transfereeaccountcode':_0x5a2c90[_0x81f4('0x13')],'transfereecontext':_0x5a2c90[_0x81f4('0x14')],'transfereeexten':_0x5a2c90[_0x81f4('0x15')],'transfereelinkedid':_0x5a2c90[_0x81f4('0x16')],'isexternal':_0x5a2c90[_0x81f4('0x17')],'context':_0x5a2c90['context'],'extension':_0x5a2c90['extension'],'type':_0x81f4('0x18')},'log':_0x81f4('0x4')});};exports[_0x81f4('0x19')]=function(_0x57a170){return client[_0x81f4('0x3')](_0x81f4('0x4'),{'body':{'result':_0x57a170['result'],'transfererchannel':_0x57a170[_0x81f4('0x1a')],'transferercalleridnum':_0x57a170[_0x81f4('0x1b')],'transferercalleridname':_0x57a170[_0x81f4('0x1c')],'transfererconnectedlinenum':_0x57a170[_0x81f4('0x1d')],'transfererconnectedlinename':_0x57a170[_0x81f4('0x1e')],'transfereraccountcode':_0x57a170[_0x81f4('0x1f')],'transferercontext':_0x57a170['secondtransferercontext'],'transfererexten':_0x57a170['secondtransfererexten'],'transfererlinkedid':_0x57a170[_0x81f4('0x20')],'transfereechannel':_0x57a170[_0x81f4('0x21')],'transfereecalleridnum':_0x57a170[_0x81f4('0x22')],'transfereecalleridname':_0x57a170[_0x81f4('0x23')],'transfereeconnectedlinenum':_0x57a170['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x57a170[_0x81f4('0x24')],'transfereeaccountcode':_0x57a170[_0x81f4('0x25')],'transfereecontext':_0x57a170[_0x81f4('0x26')],'transfereeexten':_0x57a170[_0x81f4('0x27')],'transfereelinkedid':_0x57a170[_0x81f4('0x28')],'isexternal':_0x57a170[_0x81f4('0x17')],'context':_0x57a170[_0x81f4('0x29')],'extension':_0x57a170[_0x81f4('0x2a')],'type':'attended'},'log':_0x81f4('0x4')});}; \ No newline at end of file +var _0xba4f=['transfertargetexten','origtransferercontext','attended','../client','blindTransfer','Request','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode'];(function(_0x2cfaa4,_0x3c0fb4){var _0x58974a=function(_0x37ff4c){while(--_0x37ff4c){_0x2cfaa4['push'](_0x2cfaa4['shift']());}};_0x58974a(++_0x3c0fb4);}(_0xba4f,0x19b));var _0xfba4=function(_0xce7f62,_0x55acdf){_0xce7f62=_0xce7f62-0x0;var _0x35a598=_0xba4f[_0xce7f62];return _0x35a598;};'use strict';var client=require(_0xfba4('0x0'));exports['transfers']={};exports[_0xfba4('0x1')]=function(_0x4c2777){return client[_0xfba4('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x4c2777['result'],'transfererchannel':_0x4c2777[_0xfba4('0x3')],'transferercalleridnum':_0x4c2777[_0xfba4('0x4')],'transferercalleridname':_0x4c2777['transferercalleridname'],'transfererconnectedlinenum':_0x4c2777[_0xfba4('0x5')],'transfererconnectedlinename':_0x4c2777[_0xfba4('0x6')],'transfereraccountcode':_0x4c2777[_0xfba4('0x7')],'transferercontext':_0x4c2777[_0xfba4('0x8')],'transfererexten':_0x4c2777[_0xfba4('0x9')],'transfererlinkedid':_0x4c2777[_0xfba4('0xa')],'transfereechannel':_0x4c2777['transfereechannel'],'transfereecalleridnum':_0x4c2777[_0xfba4('0xb')],'transfereecalleridname':_0x4c2777['transfereecalleridname'],'transfereeconnectedlinenum':_0x4c2777[_0xfba4('0xc')],'transfereeconnectedlinename':_0x4c2777[_0xfba4('0xd')],'transfereeaccountcode':_0x4c2777['transfereeaccountcode'],'transfereecontext':_0x4c2777[_0xfba4('0xe')],'transfereeexten':_0x4c2777[_0xfba4('0xf')],'transfereelinkedid':_0x4c2777['transfereelinkedid'],'isexternal':_0x4c2777['isexternal'],'context':_0x4c2777[_0xfba4('0x10')],'extension':_0x4c2777[_0xfba4('0x11')],'type':_0xfba4('0x12')},'log':_0xfba4('0x13')});};exports[_0xfba4('0x14')]=function(_0x302ec4){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x302ec4[_0xfba4('0x15')],'transfererchannel':_0x302ec4[_0xfba4('0x16')],'transferercalleridnum':_0x302ec4[_0xfba4('0x17')],'transferercalleridname':_0x302ec4[_0xfba4('0x18')],'transfererconnectedlinenum':_0x302ec4[_0xfba4('0x19')],'transfererconnectedlinename':_0x302ec4['secondtransfererconnectedlinename'],'transfereraccountcode':_0x302ec4['origtransfereraccountcode'],'transferercontext':_0x302ec4['secondtransferercontext'],'transfererexten':_0x302ec4[_0xfba4('0x1a')],'transfererlinkedid':_0x302ec4['origtransfererlinkedid'],'transfereechannel':_0x302ec4[_0xfba4('0x1b')],'transfereecalleridnum':_0x302ec4['transfertargetcalleridnum'],'transfereecalleridname':_0x302ec4[_0xfba4('0x1c')],'transfereeconnectedlinenum':_0x302ec4[_0xfba4('0x1d')],'transfereeconnectedlinename':_0x302ec4['transfertargetconnectedlinename'],'transfereeaccountcode':_0x302ec4[_0xfba4('0x1e')],'transfereecontext':_0x302ec4['transfertargetcontext'],'transfereeexten':_0x302ec4[_0xfba4('0x1f')],'transfereelinkedid':_0x302ec4['transfertargetlinkedid'],'isexternal':_0x302ec4['isexternal'],'context':_0x302ec4[_0xfba4('0x20')],'extension':_0x302ec4['origtransfererexten'],'type':_0xfba4('0x21')},'log':_0xfba4('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index f4bcd0d..b2188da 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 _0x087b=['send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','command','Command','Action','content','catch','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','voiceQueues','omit','undefined','values','channels','validate','map','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts'];(function(_0x623861,_0x241944){var _0x1753f0=function(_0x80a7cd){while(--_0x80a7cd){_0x623861['push'](_0x623861['shift']());}};_0x1753f0(++_0x241944);}(_0x087b,0x11a));var _0xb087=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x087b[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require(_0xb087('0x2'));var config=require('../../../config/environment');var properties=require(_0xb087('0x3'));var ami=require(_0xb087('0x4'));exports[_0xb087('0x5')]=function(_0xf1cf84,_0x183efd,_0x46e106){return new Promise(function(_0x40156d,_0x17d6e8){var _0xecf080={'QueuePause':function(_0x36ac30){return new Promise(function(_0x3cebbf){var _0x6d83fb=util[_0xb087('0x6')](_0xb087('0x7'),_0xb087('0x8'),_0x36ac30[_0xb087('0x9')]);if(_0xf1cf84[_0xb087('0xa')]&&_0xf1cf84['timers'][_0x6d83fb]&&_0xf1cf84[_0xb087('0xa')][_0x6d83fb][_0xb087('0xb')]){_0xf1cf84[_0xb087('0xa')][_0x6d83fb][_0xb087('0xc')]();}if(_0xf1cf84[_0xb087('0xd')][_0x6d83fb]){_0xf1cf84[_0xb087('0xd')][_0x6d83fb][_0xb087('0xe')]({'statePause':_0x36ac30['pause']?!![]:![]});}_0x3cebbf({'code':0xc8,'message':_0xb087('0xf')});});},'Reload':function(_0x31f977){var _0x323656=this;return new Promise(function(_0x51ceaa,_0x3001e3){if(ami[_0xb087('0x10')]()==![]){return _0x3001e3(_0x323656[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')][_0xb087('0x13')],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}_0x31f977=_[_0xb087('0x16')](_0x31f977,_[_0xb087('0x17')](properties['module']));_0x31f977[_0xb087('0x18')]=_0xb087('0x19');return ami['Action'](_0x31f977)[_0xb087('0x1a')](function(_0x2b83b7){_0x51ceaa({'code':0xc8,'message':_0x2b83b7[_0xb087('0x1b')]});})['catch'](function(_0x330005){_0x3001e3(_0x323656[_0xb087('0x11')](0x1f5,_0x330005[_0xb087('0x1b')]));});});},'Command':function(_0x45d074){var _0x4e333b=this;return new Promise(function(_0x13d534,_0x28428e){if(ami[_0xb087('0x10')]()==![]){return _0x28428e(_0x4e333b[_0xb087('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xb087('0x15')]('\x20')));}_0x45d074=_[_0xb087('0x16')](_0x45d074,_0xb087('0x1c'));_0x45d074[_0xb087('0x18')]=_0xb087('0x1d');return ami[_0xb087('0x1e')](_0x45d074)[_0xb087('0x1a')](function(_0x5587f7){_0x13d534({'code':0xc8,'message':_0x5587f7[_0xb087('0x1f')]});})[_0xb087('0x20')](function(_0x1de654){_0x28428e(_0x4e333b[_0xb087('0x11')](0x1f5,_0x1de654[_0xb087('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4d9028){var _0x183eab=[];for(var _0xdd4216 in _0xf1cf84['voiceQueues']){if(_0xf1cf84['voiceQueues']['hasOwnProperty'](_0xdd4216)){var _0x598b99=_0xf1cf84['voiceQueues'][_0xdd4216];var _0x304840={'id':_0x598b99['id'],'name':_0x598b99[_0xb087('0x9')],'strategy':_0x598b99[_0xb087('0x21')],'answered':_0x598b99[_0xb087('0x22')],'available':_0x598b99[_0xb087('0x23')],'loggedIn':_0x598b99[_0xb087('0x24')],'pTalking':_0x598b99[_0xb087('0x25')],'sumBillable':_0x598b99[_0xb087('0x26')],'sumDuration':_0x598b99[_0xb087('0x27')],'sumHoldTime':_0x598b99[_0xb087('0x28')]||0x0,'talking':_0x598b99[_0xb087('0x29')],'total':_0x598b99[_0xb087('0x2a')],'type':_0x598b99[_0xb087('0x2b')],'unmanaged':_0x598b99[_0xb087('0x2c')],'abandoned':_0x598b99['abandoned'],'waiting':_0x598b99[_0xb087('0x2d')],'loggedInDb':_0x598b99[_0xb087('0x2e')]};if(_0x598b99[_0xb087('0x2b')]===_0xb087('0x2f')){_0x304840[_0xb087('0x30')]=_0x598b99[_0xb087('0x30')];_0x304840[_0xb087('0x31')]=_0x598b99[_0xb087('0x31')];_0x304840['dialOriginateCallerIdName']=_0x598b99['dialOriginateCallerIdName'];_0x304840[_0xb087('0x32')]=_0x598b99[_0xb087('0x32')];_0x304840['dialOriginateTimeout']=_0x598b99[_0xb087('0x33')];_0x304840[_0xb087('0x34')]=_0x598b99[_0xb087('0x34')];_0x304840[_0xb087('0x35')]=_0x598b99[_0xb087('0x35')];_0x304840[_0xb087('0x36')]=_0x598b99[_0xb087('0x36')];_0x304840[_0xb087('0x37')]=_0x598b99[_0xb087('0x37')];_0x304840[_0xb087('0x38')]=_0x598b99[_0xb087('0x38')];_0x304840[_0xb087('0x39')]=_0x598b99['outboundBusyCallsDay'];_0x304840[_0xb087('0x3a')]=_0x598b99['outboundCongestionCallsDay'];_0x304840[_0xb087('0x3b')]=_0x598b99[_0xb087('0x3b')];_0x304840[_0xb087('0x3c')]=_0x598b99[_0xb087('0x3c')];_0x304840[_0xb087('0x3d')]=_0x598b99[_0xb087('0x3d')];_0x304840[_0xb087('0x3e')]=_0x598b99[_0xb087('0x3e')];_0x304840[_0xb087('0x3f')]=_0x598b99['outboundNoSuchCallsDay'];_0x304840['outboundOriginateFailureCallsDay']=_0x598b99[_0xb087('0x40')];_0x304840[_0xb087('0x41')]=_0x598b99[_0xb087('0x41')];_0x304840[_0xb087('0x42')]=_0x598b99[_0xb087('0x42')];_0x304840['outboundUnknownCallsDay']=_0x598b99[_0xb087('0x43')];_0x304840[_0xb087('0x44')]=_0x598b99['predictiveIntervalAnsweredCalls'];_0x304840['predictiveIntervalAvgHoldtime']=_0x598b99[_0xb087('0x45')];_0x304840[_0xb087('0x46')]=_0x598b99[_0xb087('0x46')];_0x304840['predictiveIntervalDroppedCallsCallersExit']=_0x598b99[_0xb087('0x47')];_0x304840[_0xb087('0x48')]=_0x598b99[_0xb087('0x48')];_0x304840[_0xb087('0x49')]=_0x598b99[_0xb087('0x49')];_0x304840['predictiveIntervalErlangCallsDroppedCalls']=_0x598b99[_0xb087('0x4a')];_0x304840['predictiveIntervalHitRate']=_0x598b99[_0xb087('0x4b')];_0x304840['predictiveIntervalMultiplicativeFactor']=_0x598b99[_0xb087('0x4c')];_0x304840[_0xb087('0x4d')]=_0x598b99['predictiveIntervalPauses'];_0x304840[_0xb087('0x4e')]=_0x598b99['predictiveIntervalAvailable'];_0x304840[_0xb087('0x4f')]=_0x598b99['predictiveIntervalTotalCalls'];_0x304840[_0xb087('0x1b')]=_0x598b99[_0xb087('0x1b')];_0x304840[_0xb087('0x50')]=_0x598b99[_0xb087('0x50')];_0x304840[_0xb087('0x51')]=_0x598b99[_0xb087('0x51')];_0x304840[_0xb087('0x52')]=_0x598b99['erlangCallToSecond'];_0x304840[_0xb087('0x53')]=_0x598b99['erlangAbandonmentRate'];_0x304840[_0xb087('0x54')]=_0x598b99[_0xb087('0x54')];_0x304840['startPredictive']=_0x598b99[_0xb087('0x55')];_0x304840[_0xb087('0x56')]=_0x598b99[_0xb087('0x56')];}if(_0x598b99['Trunk']){_0x304840[_0xb087('0x57')]={'id':_0x598b99['Trunk']['id'],'name':_0x598b99[_0xb087('0x57')][_0xb087('0x9')],'active':_0x598b99['Trunk'][_0xb087('0x58')],'callerid':_0x598b99[_0xb087('0x57')]['callerid']};}if(_0x598b99[_0xb087('0x59')]){_0x304840[_0xb087('0x59')]={'id':_0x598b99['Interval']['id'],'name':_0x598b99[_0xb087('0x59')][_0xb087('0x9')]};}_0x183eab[_0xb087('0x5a')](_0x304840);}}_0x4d9028({'count':_0x183eab[_0xb087('0x5b')],'rows':_0x183eab});});},'UpdateVoiceQueue':function(_0x58ca9f){return new Promise(function(_0x47902e,_0x1a16d7){var _0x42e19f=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x5d')],{'id':parseInt(_0x58ca9f['id'])});var _0x36a88f=_[_0xb087('0x5e')](_0x58ca9f,['id']);if(_0x42e19f){for(var _0x4d4e7d in _0x36a88f){if(typeof _0x36a88f[_0x4d4e7d]!=='undefined'&&typeof _0x42e19f[_0x4d4e7d]!==_0xb087('0x5f')){_0x42e19f[_0x4d4e7d]=_0x36a88f[_0x4d4e7d];}}_0x47902e(_0x42e19f);}else{_0x1a16d7();}});},'VoiceChannels':function(){return new Promise(function(_0x520acc){var _0x3a405b=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x61')]);_0x520acc({'count':_0x3a405b[_0xb087('0x5b')],'rows':_0x3a405b});});},'VoiceChannelMixMonitor':function(_0x521018){var _0x2be4f2=this;return new Promise(function(_0x562751,_0x2fe8a0){if(ami[_0xb087('0x10')]()==![]){return _0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x588d96=schema(properties['voicechannel'])[_0xb087('0x62')](_0x521018);if(_0x588d96['length']>0x0){return _0x2fe8a0(_0x2be4f2['error'](0x1f4,_[_0xb087('0x63')](_0x588d96,_0xb087('0x1b'))['join'](',\x20')));}var _0x4362d4=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x61')],{'uniqueid':_0x521018['uniqueid']});if(_0x4362d4&&_0x4362d4['channel']){var _0x30cc83=util['format']('%s.%s',_0x521018[_0xb087('0x64')]||_0x521018[_0xb087('0x65')],_0x521018[_0xb087('0x6')]||_0xb087('0x66'));return ami[_0xb087('0x1e')]({'action':_0xb087('0x67'),'channel':_0x4362d4[_0xb087('0x68')],'file':_0x30cc83,'options':_0xb087('0x69')})[_0xb087('0x1a')](function(_0x18d93b){var _0x47d47c=_[_0xb087('0x5c')](_0x4362d4['monitors'],{'filename':_0xb087('0x6a')+_0x30cc83[_0xb087('0x6b')]()});if(_['isNil'](_0x47d47c)){_0x4362d4[_0xb087('0x6c')][_0xb087('0x5a')]({'filename':_0xb087('0x6a')+_0x30cc83[_0xb087('0x6b')](),'createdAt':moment()[_0xb087('0x6')](_0xb087('0x6d')),'mixmonitorid':_0x18d93b[_0xb087('0x6e')],'status':_0xb087('0x6f')});}else{_0x47d47c[_0xb087('0x6e')]=_0x18d93b[_0xb087('0x6e')];_0x47d47c[_0xb087('0x70')]='rec';}_0x562751({'code':0xc8,'message':[_0x521018[_0xb087('0x65')],'MixMonitor\x20Success',_0x18d93b[_0xb087('0x6e')]]['join']('\x20'),'mixmonitorid':_0x18d93b[_0xb087('0x6e')]});})[_0xb087('0x20')](function(_0x187ffd){_0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f5,[_0x521018[_0xb087('0x65')],_0x187ffd[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')));});}else{return _0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x300e9b){var _0x2ee0a3=this;return new Promise(function(_0x3834a6,_0x22be05){if(ami[_0xb087('0x10')]()==![]){return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')][_0xb087('0x13')],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x459c5b=schema(properties['voicechannel'])[_0xb087('0x62')](_0x300e9b);if(_0x459c5b[_0xb087('0x5b')]>0x0){return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f4,_['map'](_0x459c5b,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x5685b1=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x61')],{'uniqueid':_0x300e9b[_0xb087('0x65')]});if(_0x5685b1){return Promise['resolve']()[_0xb087('0x1a')](function(){if(_0x5685b1[_0xb087('0x68')]){return ami[_0xb087('0x1e')]({'action':_0xb087('0x72'),'channel':_0x5685b1[_0xb087('0x68')],'mixmonitorid':_0x300e9b[_0xb087('0x6e')]})[_0xb087('0x20')](function(){});}})[_0xb087('0x1a')](function(){if(_0x5685b1['destinationchannel']){return ami[_0xb087('0x1e')]({'action':_0xb087('0x72'),'channel':_0x5685b1[_0xb087('0x73')],'mixmonitorid':_0x300e9b['mixmonitorid']})[_0xb087('0x20')](function(){});}})['then'](function(){var _0x4a2441=_[_0xb087('0x5c')](_0x5685b1[_0xb087('0x6c')],{'mixmonitorid':_0x300e9b['mixmonitorid']});if(_0x4a2441){_0x4a2441[_0xb087('0x70')]='stop';}})[_0xb087('0x1a')](function(){var _0x1a8237=util['format']('%s.%s',_0x300e9b[_0xb087('0x64')]||_0x300e9b['uniqueid'],_0x300e9b['format']||_0xb087('0x66'));var _0x52d72a=_[_0xb087('0x5c')](_0x5685b1['monitors'],{'filename':_0xb087('0x6a')+_0x1a8237[_0xb087('0x6b')]()});if(_0x52d72a){_0x52d72a[_0xb087('0x70')]=_0xb087('0x74');}})[_0xb087('0x1a')](function(){_0x3834a6({'code':0xc8,'message':[_0x300e9b[_0xb087('0x65')],'StopMixMonitor\x20Success'][_0xb087('0x15')]('\x20')});})['catch'](function(_0x22e010){_0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f5,[_0x300e9b[_0xb087('0x65')],_0x22e010['message'][_0xb087('0x6b')]()]['join']('\x20')));});}else{return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x66f15b){var _0x2ee63f=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x75')]);_0x66f15b({'count':_0x2ee63f['length'],'rows':_0x2ee63f});});},'VoiceQueuesChannel':function(_0x245d68){var _0xd01a6b=this;return new Promise(function(_0x4bedbd,_0x25a45f){var _0x58de88=schema(properties[_0xb087('0x76')])[_0xb087('0x62')](_0x245d68);if(_0x58de88[_0xb087('0x5b')]>0x0){return _0x25a45f(_0xd01a6b[_0xb087('0x11')](0x1f4,_[_0xb087('0x63')](_0x58de88,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x186b40=_['find'](_0xf1cf84['queueChannels'],{'uniqueid':_0x245d68['uniqueid']});if(_0x186b40){_0x4bedbd(_0x186b40);}else{return _0x25a45f(_0xd01a6b[_0xb087('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x390309){var _0x568351=this;return new Promise(function(_0x11c4b0,_0x43bf47){if(ami[_0xb087('0x10')]()==![]){return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x21fd15=schema(properties[_0xb087('0x77')])['validate'](_0x390309);if(_0x21fd15['length']>0x0){return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f4,_['map'](_0x21fd15,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x2ca987=_[_0xb087('0x5c')](_0xf1cf84['queueChannels'],{'uniqueid':_0x390309['uniqueid']});if(_0x2ca987&&_0x2ca987[_0xb087('0x68')]){return ami['Action']({'action':_0xb087('0x78'),'channel':_0x2ca987[_0xb087('0x68')]})[_0xb087('0x1a')](function(_0x2f9631){_0x11c4b0({'code':0xc8,'message':[_0x390309[_0xb087('0x65')],_0x2f9631['message'][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')});})['catch'](function(_0x544ee0){_0x43bf47(_0x568351['error'](0x1f5,[_0x390309[_0xb087('0x65')],_0x544ee0[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')));});}else{return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x47ea48){var _0xd1f58a=this;return new Promise(function(_0x25e097,_0x1e01c5){if(ami[_0xb087('0x10')]()==![]){return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x28965f=schema(properties['voicequeuechannelredirect'])[_0xb087('0x62')](_0x47ea48);if(_0x28965f['length']>0x0){return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f4,_[_0xb087('0x63')](_0x28965f,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x463791=_[_0xb087('0x5c')](_0xf1cf84['queueChannels'],{'uniqueid':_0x47ea48['uniqueid']});if(_0x463791&&_0x463791[_0xb087('0x68')]){return ami[_0xb087('0x1e')]({'action':'Redirect','channel':_0x463791[_0xb087('0x68')],'exten':_0x47ea48[_0xb087('0x79')],'context':_0x47ea48[_0xb087('0x7a')]||_0x463791[_0xb087('0x7a')],'priority':0x1})[_0xb087('0x1a')](function(_0x631bc7){_0x25e097({'code':0xc8,'message':[_0x47ea48['uniqueid'],_0x631bc7[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')});})[_0xb087('0x20')](function(_0x416e05){_0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f5,[_0x47ea48[_0xb087('0x65')],_0x416e05[_0xb087('0x1b')][_0xb087('0x6b')]()]['join']('\x20')));});}else{return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2a32d0){return new Promise(function(_0x3a8b25){var _0x47ed3c=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0xd')]);if(_0x2a32d0&&_0x2a32d0['id']){var _0x8b1a5b=_[_0xb087('0x5c')](_0x47ed3c,function(_0x3f48b6){return _0x3f48b6['id']===_0x2a32d0['id'];});_0x3a8b25(_0x8b1a5b);}else{_0x3a8b25({'count':_0x47ed3c[_0xb087('0x5b')],'rows':_0x47ed3c});}});},'Telephones':function(){return new Promise(function(_0x573ba1){var _0xacc1f4=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7b')]);_0x573ba1({'count':_0xacc1f4[_0xb087('0x5b')],'rows':_0xacc1f4});});},'Trunks':function(){return new Promise(function(_0x1da8ac){var _0x4ac3fc=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7c')]);_0x1da8ac({'count':_0x4ac3fc[_0xb087('0x5b')],'rows':_0x4ac3fc});});},'OutboundChannels':function(){return new Promise(function(_0x41f3e7){var _0x411b00=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7d')]);_0x41f3e7({'count':_0x411b00[_0xb087('0x5b')],'rows':_0x411b00});});},'Outbound':function(){return new Promise(function(_0x46f9ef){_0x46f9ef(_0xf1cf84[_0xb087('0x2f')]);});},'Campaigns':function(){return new Promise(function(_0x25cec3){var _0x5d4953=_['values'](_0xf1cf84[_0xb087('0x7e')]);_0x25cec3({'count':_0x5d4953[_0xb087('0x5b')],'rows':_0x5d4953});});},'VoiceQueuesPreview':function(_0x3fbbb6){var _0x28e3a3=this;return new Promise(function(_0x2f49df,_0x4c60b0){_0x183efd[_0xb087('0x7f')](_0x3fbbb6['id'])[_0xb087('0x1a')](function(_0x163804){_0x2f49df({'code':0xc8,'message':_0x163804[_0xb087('0x1b')]});})[_0xb087('0x20')](function(_0xbe2a4c){_0x4c60b0(_0x28e3a3['error'](0x1f4,_0xbe2a4c[_0xb087('0x1b')]));});});},'EventManager':function(_0x537888){var _0x5194fe=this;return new Promise(function(_0x92700d,_0x16a6cb){if(!_0x537888[_0xb087('0x80')]){return _0x16a6cb(_0x5194fe[_0xb087('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xb087('0x81')](_0xb087('0x82')+_0x537888['event'],_0x537888[_0xb087('0x1b')]);_0x92700d({'code':0xc8,'message':_0x537888});});},'FaxAccounts':function(){return new Promise(function(_0x4a2867){var _0x53af09=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x83')]);_0x4a2867({'count':_0x53af09[_0xb087('0x5b')],'rows':_0x53af09});});},'SendFax':function(_0x1b03a3){var _0x2e67d3=this;return new Promise(function(_0x4a88f2,_0x3cf818){_0x46e106[_0xb087('0x84')](_0x1b03a3)[_0xb087('0x1a')](function(_0x11c0a3){_0x4a88f2({'code':0xc8,'message':_0x11c0a3['message']});})['catch'](function(_0x544a68){_0x3cf818(_0x2e67d3['error'](0x1f4,_0x544a68[_0xb087('0x1b')]));});});},'CheckAfterSend':function(_0x3296c9){var _0x10e4b6=this;return new Promise(function(_0x4708f2,_0x1e55ca){_0x46e106[_0xb087('0x85')](_0x3296c9)[_0xb087('0x1a')](function(_0x4f084f){_0x4708f2({'code':0xc8,'message':_0x4f084f['message']});})[_0xb087('0x20')](function(_0x13d558){_0x1e55ca(_0x10e4b6[_0xb087('0x11')](0x1f4,_0x13d558[_0xb087('0x1b')]));});});}};var _0x4e6c80=jayson[_0xb087('0x86')](_0xecf080)['http']();_0x4e6c80['on'](_0xb087('0x11'),function(_0x50b293){return _0x17d6e8(_0x50b293);});_0x4e6c80[_0xb087('0x5')](0x232a,_0xb087('0x87'),function(){console[_0xb087('0x88')](_0xb087('0x89'),0x232a);return _0x40156d('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x087b=['send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','then','message','command','Command','Action','content','catch','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','voiceQueues','omit','undefined','values','channels','validate','map','filename','uniqueid','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','emit','custom:','faxAccounts'];(function(_0x15c162,_0x20fdaf){var _0x23e8aa=function(_0x2e06b9){while(--_0x2e06b9){_0x15c162['push'](_0x15c162['shift']());}};_0x23e8aa(++_0x20fdaf);}(_0x087b,0x11a));var _0xb087=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x087b[_0x576170];return _0x397c70;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var jayson=require('jayson/promise');var schema=require('validate');var moment=require(_0xb087('0x2'));var config=require('../../../config/environment');var properties=require(_0xb087('0x3'));var ami=require(_0xb087('0x4'));exports[_0xb087('0x5')]=function(_0xf1cf84,_0x183efd,_0x46e106){return new Promise(function(_0x40156d,_0x17d6e8){var _0xecf080={'QueuePause':function(_0x36ac30){return new Promise(function(_0x3cebbf){var _0x6d83fb=util[_0xb087('0x6')](_0xb087('0x7'),_0xb087('0x8'),_0x36ac30[_0xb087('0x9')]);if(_0xf1cf84[_0xb087('0xa')]&&_0xf1cf84['timers'][_0x6d83fb]&&_0xf1cf84[_0xb087('0xa')][_0x6d83fb][_0xb087('0xb')]){_0xf1cf84[_0xb087('0xa')][_0x6d83fb][_0xb087('0xc')]();}if(_0xf1cf84[_0xb087('0xd')][_0x6d83fb]){_0xf1cf84[_0xb087('0xd')][_0x6d83fb][_0xb087('0xe')]({'statePause':_0x36ac30['pause']?!![]:![]});}_0x3cebbf({'code':0xc8,'message':_0xb087('0xf')});});},'Reload':function(_0x31f977){var _0x323656=this;return new Promise(function(_0x51ceaa,_0x3001e3){if(ami[_0xb087('0x10')]()==![]){return _0x3001e3(_0x323656[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')][_0xb087('0x13')],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}_0x31f977=_[_0xb087('0x16')](_0x31f977,_[_0xb087('0x17')](properties['module']));_0x31f977[_0xb087('0x18')]=_0xb087('0x19');return ami['Action'](_0x31f977)[_0xb087('0x1a')](function(_0x2b83b7){_0x51ceaa({'code':0xc8,'message':_0x2b83b7[_0xb087('0x1b')]});})['catch'](function(_0x330005){_0x3001e3(_0x323656[_0xb087('0x11')](0x1f5,_0x330005[_0xb087('0x1b')]));});});},'Command':function(_0x45d074){var _0x4e333b=this;return new Promise(function(_0x13d534,_0x28428e){if(ami[_0xb087('0x10')]()==![]){return _0x28428e(_0x4e333b[_0xb087('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0xb087('0x15')]('\x20')));}_0x45d074=_[_0xb087('0x16')](_0x45d074,_0xb087('0x1c'));_0x45d074[_0xb087('0x18')]=_0xb087('0x1d');return ami[_0xb087('0x1e')](_0x45d074)[_0xb087('0x1a')](function(_0x5587f7){_0x13d534({'code':0xc8,'message':_0x5587f7[_0xb087('0x1f')]});})[_0xb087('0x20')](function(_0x1de654){_0x28428e(_0x4e333b[_0xb087('0x11')](0x1f5,_0x1de654[_0xb087('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x4d9028){var _0x183eab=[];for(var _0xdd4216 in _0xf1cf84['voiceQueues']){if(_0xf1cf84['voiceQueues']['hasOwnProperty'](_0xdd4216)){var _0x598b99=_0xf1cf84['voiceQueues'][_0xdd4216];var _0x304840={'id':_0x598b99['id'],'name':_0x598b99[_0xb087('0x9')],'strategy':_0x598b99[_0xb087('0x21')],'answered':_0x598b99[_0xb087('0x22')],'available':_0x598b99[_0xb087('0x23')],'loggedIn':_0x598b99[_0xb087('0x24')],'pTalking':_0x598b99[_0xb087('0x25')],'sumBillable':_0x598b99[_0xb087('0x26')],'sumDuration':_0x598b99[_0xb087('0x27')],'sumHoldTime':_0x598b99[_0xb087('0x28')]||0x0,'talking':_0x598b99[_0xb087('0x29')],'total':_0x598b99[_0xb087('0x2a')],'type':_0x598b99[_0xb087('0x2b')],'unmanaged':_0x598b99[_0xb087('0x2c')],'abandoned':_0x598b99['abandoned'],'waiting':_0x598b99[_0xb087('0x2d')],'loggedInDb':_0x598b99[_0xb087('0x2e')]};if(_0x598b99[_0xb087('0x2b')]===_0xb087('0x2f')){_0x304840[_0xb087('0x30')]=_0x598b99[_0xb087('0x30')];_0x304840[_0xb087('0x31')]=_0x598b99[_0xb087('0x31')];_0x304840['dialOriginateCallerIdName']=_0x598b99['dialOriginateCallerIdName'];_0x304840[_0xb087('0x32')]=_0x598b99[_0xb087('0x32')];_0x304840['dialOriginateTimeout']=_0x598b99[_0xb087('0x33')];_0x304840[_0xb087('0x34')]=_0x598b99[_0xb087('0x34')];_0x304840[_0xb087('0x35')]=_0x598b99[_0xb087('0x35')];_0x304840[_0xb087('0x36')]=_0x598b99[_0xb087('0x36')];_0x304840[_0xb087('0x37')]=_0x598b99[_0xb087('0x37')];_0x304840[_0xb087('0x38')]=_0x598b99[_0xb087('0x38')];_0x304840[_0xb087('0x39')]=_0x598b99['outboundBusyCallsDay'];_0x304840[_0xb087('0x3a')]=_0x598b99['outboundCongestionCallsDay'];_0x304840[_0xb087('0x3b')]=_0x598b99[_0xb087('0x3b')];_0x304840[_0xb087('0x3c')]=_0x598b99[_0xb087('0x3c')];_0x304840[_0xb087('0x3d')]=_0x598b99[_0xb087('0x3d')];_0x304840[_0xb087('0x3e')]=_0x598b99[_0xb087('0x3e')];_0x304840[_0xb087('0x3f')]=_0x598b99['outboundNoSuchCallsDay'];_0x304840['outboundOriginateFailureCallsDay']=_0x598b99[_0xb087('0x40')];_0x304840[_0xb087('0x41')]=_0x598b99[_0xb087('0x41')];_0x304840[_0xb087('0x42')]=_0x598b99[_0xb087('0x42')];_0x304840['outboundUnknownCallsDay']=_0x598b99[_0xb087('0x43')];_0x304840[_0xb087('0x44')]=_0x598b99['predictiveIntervalAnsweredCalls'];_0x304840['predictiveIntervalAvgHoldtime']=_0x598b99[_0xb087('0x45')];_0x304840[_0xb087('0x46')]=_0x598b99[_0xb087('0x46')];_0x304840['predictiveIntervalDroppedCallsCallersExit']=_0x598b99[_0xb087('0x47')];_0x304840[_0xb087('0x48')]=_0x598b99[_0xb087('0x48')];_0x304840[_0xb087('0x49')]=_0x598b99[_0xb087('0x49')];_0x304840['predictiveIntervalErlangCallsDroppedCalls']=_0x598b99[_0xb087('0x4a')];_0x304840['predictiveIntervalHitRate']=_0x598b99[_0xb087('0x4b')];_0x304840['predictiveIntervalMultiplicativeFactor']=_0x598b99[_0xb087('0x4c')];_0x304840[_0xb087('0x4d')]=_0x598b99['predictiveIntervalPauses'];_0x304840[_0xb087('0x4e')]=_0x598b99['predictiveIntervalAvailable'];_0x304840[_0xb087('0x4f')]=_0x598b99['predictiveIntervalTotalCalls'];_0x304840[_0xb087('0x1b')]=_0x598b99[_0xb087('0x1b')];_0x304840[_0xb087('0x50')]=_0x598b99[_0xb087('0x50')];_0x304840[_0xb087('0x51')]=_0x598b99[_0xb087('0x51')];_0x304840[_0xb087('0x52')]=_0x598b99['erlangCallToSecond'];_0x304840[_0xb087('0x53')]=_0x598b99['erlangAbandonmentRate'];_0x304840[_0xb087('0x54')]=_0x598b99[_0xb087('0x54')];_0x304840['startPredictive']=_0x598b99[_0xb087('0x55')];_0x304840[_0xb087('0x56')]=_0x598b99[_0xb087('0x56')];}if(_0x598b99['Trunk']){_0x304840[_0xb087('0x57')]={'id':_0x598b99['Trunk']['id'],'name':_0x598b99[_0xb087('0x57')][_0xb087('0x9')],'active':_0x598b99['Trunk'][_0xb087('0x58')],'callerid':_0x598b99[_0xb087('0x57')]['callerid']};}if(_0x598b99[_0xb087('0x59')]){_0x304840[_0xb087('0x59')]={'id':_0x598b99['Interval']['id'],'name':_0x598b99[_0xb087('0x59')][_0xb087('0x9')]};}_0x183eab[_0xb087('0x5a')](_0x304840);}}_0x4d9028({'count':_0x183eab[_0xb087('0x5b')],'rows':_0x183eab});});},'UpdateVoiceQueue':function(_0x58ca9f){return new Promise(function(_0x47902e,_0x1a16d7){var _0x42e19f=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x5d')],{'id':parseInt(_0x58ca9f['id'])});var _0x36a88f=_[_0xb087('0x5e')](_0x58ca9f,['id']);if(_0x42e19f){for(var _0x4d4e7d in _0x36a88f){if(typeof _0x36a88f[_0x4d4e7d]!=='undefined'&&typeof _0x42e19f[_0x4d4e7d]!==_0xb087('0x5f')){_0x42e19f[_0x4d4e7d]=_0x36a88f[_0x4d4e7d];}}_0x47902e(_0x42e19f);}else{_0x1a16d7();}});},'VoiceChannels':function(){return new Promise(function(_0x520acc){var _0x3a405b=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x61')]);_0x520acc({'count':_0x3a405b[_0xb087('0x5b')],'rows':_0x3a405b});});},'VoiceChannelMixMonitor':function(_0x521018){var _0x2be4f2=this;return new Promise(function(_0x562751,_0x2fe8a0){if(ami[_0xb087('0x10')]()==![]){return _0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x588d96=schema(properties['voicechannel'])[_0xb087('0x62')](_0x521018);if(_0x588d96['length']>0x0){return _0x2fe8a0(_0x2be4f2['error'](0x1f4,_[_0xb087('0x63')](_0x588d96,_0xb087('0x1b'))['join'](',\x20')));}var _0x4362d4=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x61')],{'uniqueid':_0x521018['uniqueid']});if(_0x4362d4&&_0x4362d4['channel']){var _0x30cc83=util['format']('%s.%s',_0x521018[_0xb087('0x64')]||_0x521018[_0xb087('0x65')],_0x521018[_0xb087('0x6')]||_0xb087('0x66'));return ami[_0xb087('0x1e')]({'action':_0xb087('0x67'),'channel':_0x4362d4[_0xb087('0x68')],'file':_0x30cc83,'options':_0xb087('0x69')})[_0xb087('0x1a')](function(_0x18d93b){var _0x47d47c=_[_0xb087('0x5c')](_0x4362d4['monitors'],{'filename':_0xb087('0x6a')+_0x30cc83[_0xb087('0x6b')]()});if(_['isNil'](_0x47d47c)){_0x4362d4[_0xb087('0x6c')][_0xb087('0x5a')]({'filename':_0xb087('0x6a')+_0x30cc83[_0xb087('0x6b')](),'createdAt':moment()[_0xb087('0x6')](_0xb087('0x6d')),'mixmonitorid':_0x18d93b[_0xb087('0x6e')],'status':_0xb087('0x6f')});}else{_0x47d47c[_0xb087('0x6e')]=_0x18d93b[_0xb087('0x6e')];_0x47d47c[_0xb087('0x70')]='rec';}_0x562751({'code':0xc8,'message':[_0x521018[_0xb087('0x65')],'MixMonitor\x20Success',_0x18d93b[_0xb087('0x6e')]]['join']('\x20'),'mixmonitorid':_0x18d93b[_0xb087('0x6e')]});})[_0xb087('0x20')](function(_0x187ffd){_0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f5,[_0x521018[_0xb087('0x65')],_0x187ffd[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')));});}else{return _0x2fe8a0(_0x2be4f2[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x300e9b){var _0x2ee0a3=this;return new Promise(function(_0x3834a6,_0x22be05){if(ami[_0xb087('0x10')]()==![]){return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')][_0xb087('0x13')],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x459c5b=schema(properties['voicechannel'])[_0xb087('0x62')](_0x300e9b);if(_0x459c5b[_0xb087('0x5b')]>0x0){return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f4,_['map'](_0x459c5b,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x5685b1=_[_0xb087('0x5c')](_0xf1cf84[_0xb087('0x61')],{'uniqueid':_0x300e9b[_0xb087('0x65')]});if(_0x5685b1){return Promise['resolve']()[_0xb087('0x1a')](function(){if(_0x5685b1[_0xb087('0x68')]){return ami[_0xb087('0x1e')]({'action':_0xb087('0x72'),'channel':_0x5685b1[_0xb087('0x68')],'mixmonitorid':_0x300e9b[_0xb087('0x6e')]})[_0xb087('0x20')](function(){});}})[_0xb087('0x1a')](function(){if(_0x5685b1['destinationchannel']){return ami[_0xb087('0x1e')]({'action':_0xb087('0x72'),'channel':_0x5685b1[_0xb087('0x73')],'mixmonitorid':_0x300e9b['mixmonitorid']})[_0xb087('0x20')](function(){});}})['then'](function(){var _0x4a2441=_[_0xb087('0x5c')](_0x5685b1[_0xb087('0x6c')],{'mixmonitorid':_0x300e9b['mixmonitorid']});if(_0x4a2441){_0x4a2441[_0xb087('0x70')]='stop';}})[_0xb087('0x1a')](function(){var _0x1a8237=util['format']('%s.%s',_0x300e9b[_0xb087('0x64')]||_0x300e9b['uniqueid'],_0x300e9b['format']||_0xb087('0x66'));var _0x52d72a=_[_0xb087('0x5c')](_0x5685b1['monitors'],{'filename':_0xb087('0x6a')+_0x1a8237[_0xb087('0x6b')]()});if(_0x52d72a){_0x52d72a[_0xb087('0x70')]=_0xb087('0x74');}})[_0xb087('0x1a')](function(){_0x3834a6({'code':0xc8,'message':[_0x300e9b[_0xb087('0x65')],'StopMixMonitor\x20Success'][_0xb087('0x15')]('\x20')});})['catch'](function(_0x22e010){_0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f5,[_0x300e9b[_0xb087('0x65')],_0x22e010['message'][_0xb087('0x6b')]()]['join']('\x20')));});}else{return _0x22be05(_0x2ee0a3[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x66f15b){var _0x2ee63f=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x75')]);_0x66f15b({'count':_0x2ee63f['length'],'rows':_0x2ee63f});});},'VoiceQueuesChannel':function(_0x245d68){var _0xd01a6b=this;return new Promise(function(_0x4bedbd,_0x25a45f){var _0x58de88=schema(properties[_0xb087('0x76')])[_0xb087('0x62')](_0x245d68);if(_0x58de88[_0xb087('0x5b')]>0x0){return _0x25a45f(_0xd01a6b[_0xb087('0x11')](0x1f4,_[_0xb087('0x63')](_0x58de88,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x186b40=_['find'](_0xf1cf84['queueChannels'],{'uniqueid':_0x245d68['uniqueid']});if(_0x186b40){_0x4bedbd(_0x186b40);}else{return _0x25a45f(_0xd01a6b[_0xb087('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x390309){var _0x568351=this;return new Promise(function(_0x11c4b0,_0x43bf47){if(ami[_0xb087('0x10')]()==![]){return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x21fd15=schema(properties[_0xb087('0x77')])['validate'](_0x390309);if(_0x21fd15['length']>0x0){return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f4,_['map'](_0x21fd15,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x2ca987=_[_0xb087('0x5c')](_0xf1cf84['queueChannels'],{'uniqueid':_0x390309['uniqueid']});if(_0x2ca987&&_0x2ca987[_0xb087('0x68')]){return ami['Action']({'action':_0xb087('0x78'),'channel':_0x2ca987[_0xb087('0x68')]})[_0xb087('0x1a')](function(_0x2f9631){_0x11c4b0({'code':0xc8,'message':[_0x390309[_0xb087('0x65')],_0x2f9631['message'][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')});})['catch'](function(_0x544ee0){_0x43bf47(_0x568351['error'](0x1f5,[_0x390309[_0xb087('0x65')],_0x544ee0[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')));});}else{return _0x43bf47(_0x568351[_0xb087('0x11')](0x1f5,_0xb087('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x47ea48){var _0xd1f58a=this;return new Promise(function(_0x25e097,_0x1e01c5){if(ami[_0xb087('0x10')]()==![]){return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f4,[config[_0xb087('0x12')]['ip'],config[_0xb087('0x12')]['username'],_0xb087('0x14')][_0xb087('0x15')]('\x20')));}var _0x28965f=schema(properties['voicequeuechannelredirect'])[_0xb087('0x62')](_0x47ea48);if(_0x28965f['length']>0x0){return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f4,_[_0xb087('0x63')](_0x28965f,_0xb087('0x1b'))[_0xb087('0x15')](',\x20')));}var _0x463791=_[_0xb087('0x5c')](_0xf1cf84['queueChannels'],{'uniqueid':_0x47ea48['uniqueid']});if(_0x463791&&_0x463791[_0xb087('0x68')]){return ami[_0xb087('0x1e')]({'action':'Redirect','channel':_0x463791[_0xb087('0x68')],'exten':_0x47ea48[_0xb087('0x79')],'context':_0x47ea48[_0xb087('0x7a')]||_0x463791[_0xb087('0x7a')],'priority':0x1})[_0xb087('0x1a')](function(_0x631bc7){_0x25e097({'code':0xc8,'message':[_0x47ea48['uniqueid'],_0x631bc7[_0xb087('0x1b')][_0xb087('0x6b')]()][_0xb087('0x15')]('\x20')});})[_0xb087('0x20')](function(_0x416e05){_0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f5,[_0x47ea48[_0xb087('0x65')],_0x416e05[_0xb087('0x1b')][_0xb087('0x6b')]()]['join']('\x20')));});}else{return _0x1e01c5(_0xd1f58a[_0xb087('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2a32d0){return new Promise(function(_0x3a8b25){var _0x47ed3c=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0xd')]);if(_0x2a32d0&&_0x2a32d0['id']){var _0x8b1a5b=_[_0xb087('0x5c')](_0x47ed3c,function(_0x3f48b6){return _0x3f48b6['id']===_0x2a32d0['id'];});_0x3a8b25(_0x8b1a5b);}else{_0x3a8b25({'count':_0x47ed3c[_0xb087('0x5b')],'rows':_0x47ed3c});}});},'Telephones':function(){return new Promise(function(_0x573ba1){var _0xacc1f4=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7b')]);_0x573ba1({'count':_0xacc1f4[_0xb087('0x5b')],'rows':_0xacc1f4});});},'Trunks':function(){return new Promise(function(_0x1da8ac){var _0x4ac3fc=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7c')]);_0x1da8ac({'count':_0x4ac3fc[_0xb087('0x5b')],'rows':_0x4ac3fc});});},'OutboundChannels':function(){return new Promise(function(_0x41f3e7){var _0x411b00=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x7d')]);_0x41f3e7({'count':_0x411b00[_0xb087('0x5b')],'rows':_0x411b00});});},'Outbound':function(){return new Promise(function(_0x46f9ef){_0x46f9ef(_0xf1cf84[_0xb087('0x2f')]);});},'Campaigns':function(){return new Promise(function(_0x25cec3){var _0x5d4953=_['values'](_0xf1cf84[_0xb087('0x7e')]);_0x25cec3({'count':_0x5d4953[_0xb087('0x5b')],'rows':_0x5d4953});});},'VoiceQueuesPreview':function(_0x3fbbb6){var _0x28e3a3=this;return new Promise(function(_0x2f49df,_0x4c60b0){_0x183efd[_0xb087('0x7f')](_0x3fbbb6['id'])[_0xb087('0x1a')](function(_0x163804){_0x2f49df({'code':0xc8,'message':_0x163804[_0xb087('0x1b')]});})[_0xb087('0x20')](function(_0xbe2a4c){_0x4c60b0(_0x28e3a3['error'](0x1f4,_0xbe2a4c[_0xb087('0x1b')]));});});},'EventManager':function(_0x537888){var _0x5194fe=this;return new Promise(function(_0x92700d,_0x16a6cb){if(!_0x537888[_0xb087('0x80')]){return _0x16a6cb(_0x5194fe[_0xb087('0x11')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xb087('0x81')](_0xb087('0x82')+_0x537888['event'],_0x537888[_0xb087('0x1b')]);_0x92700d({'code':0xc8,'message':_0x537888});});},'FaxAccounts':function(){return new Promise(function(_0x4a2867){var _0x53af09=_[_0xb087('0x60')](_0xf1cf84[_0xb087('0x83')]);_0x4a2867({'count':_0x53af09[_0xb087('0x5b')],'rows':_0x53af09});});},'SendFax':function(_0x1b03a3){var _0x2e67d3=this;return new Promise(function(_0x4a88f2,_0x3cf818){_0x46e106[_0xb087('0x84')](_0x1b03a3)[_0xb087('0x1a')](function(_0x11c0a3){_0x4a88f2({'code':0xc8,'message':_0x11c0a3['message']});})['catch'](function(_0x544a68){_0x3cf818(_0x2e67d3['error'](0x1f4,_0x544a68[_0xb087('0x1b')]));});});},'CheckAfterSend':function(_0x3296c9){var _0x10e4b6=this;return new Promise(function(_0x4708f2,_0x1e55ca){_0x46e106[_0xb087('0x85')](_0x3296c9)[_0xb087('0x1a')](function(_0x4f084f){_0x4708f2({'code':0xc8,'message':_0x4f084f['message']});})[_0xb087('0x20')](function(_0x13d558){_0x1e55ca(_0x10e4b6[_0xb087('0x11')](0x1f4,_0x13d558[_0xb087('0x1b')]));});});}};var _0x4e6c80=jayson[_0xb087('0x86')](_0xecf080)['http']();_0x4e6c80['on'](_0xb087('0x11'),function(_0x50b293){return _0x17d6e8(_0x50b293);});_0x4e6c80[_0xb087('0x5')](0x232a,_0xb087('0x87'),function(){console[_0xb087('0x88')](_0xb087('0x89'),0x232a);return _0x40156d('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 78bcb3e..3d9ed34 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 _0xf956=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','calleridnum','routeId','destcalleridnum','firstName','lastName','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join'];(function(_0x24942c,_0x347f3c){var _0x764452=function(_0x1fad31){while(--_0x1fad31){_0x24942c['push'](_0x24942c['shift']());}};_0x764452(++_0x347f3c);}(_0xf956,0x7a));var _0x6f95=function(_0x5cb720,_0x3c4ed2){_0x5cb720=_0x5cb720-0x0;var _0x2bcaca=_0xf956[_0x5cb720];return _0x2bcaca;};'use strict';var _=require(_0x6f95('0x0'));var BPromise=require(_0x6f95('0x1'));var Redis=require(_0x6f95('0x2'));var util=require(_0x6f95('0x3'));var config=require(_0x6f95('0x4'));var logger=require(_0x6f95('0x5'))(_0x6f95('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x6f95('0x7')]=_[_0x6f95('0x8')](config[_0x6f95('0x7')],{'host':_0x6f95('0x9'),'port':0x18eb});var io=require(_0x6f95('0xa'))(new Redis(config[_0x6f95('0x7')]));function emit(_0x2edb70,_0xdad8e7,_0x2eaa2b,_0x42f27b,_0x2f9966){logger[_0x6f95('0xb')](_0x6f95('0xc'),_0x2edb70,_0xdad8e7['id'],_0x2eaa2b,_0x42f27b,JSON['stringify'](_0x2f9966));io['to'](_0x2eaa2b)[_0x6f95('0xd')](_0x42f27b,_0x2f9966);}exports[_0x6f95('0xe')]=function(_0x5c291c,_0x241362,_0x53ae0e,_0x31c52c){var _0x31223b,_0x105393;var _0x28b26b={};var _0x11ed1d;var _0x5b5c2a=Number(_0x53ae0e['data1']);var _0x1125f1=_0x53ae0e[_0x6f95('0xf')]?Boolean(Number(_0x53ae0e['data2'])):![];var _0x11394a;var _0x56c19f=![];if(!_[_0x6f95('0x10')](_0x53ae0e[_0x6f95('0x11')])){if(_0x53ae0e[_0x6f95('0x11')]=='1')_0x56c19f=!![];}if(!_0x56c19f){if(_0x31c52c[_0x6f95('0x12')]){_0x28b26b['id']=_0x31c52c['xmd-contactid'];}}if(!_0x28b26b['id']){_0x28b26b[_0x6f95('0x13')]=_0x5b5c2a;_0x11394a=_0x53ae0e[_0x6f95('0x14')]&&_0x53ae0e[_0x6f95('0x14')]!=='0'?_0x53ae0e[_0x6f95('0x14')][_0x6f95('0x15')](','):[_0x6f95('0x16')];_0x28b26b['$or']=_[_0x6f95('0x17')](_0x11394a,function(_0x5a0027){var _0x4674f8={};_0x4674f8[_0x5a0027]=_0x31c52c['routeId']?_0x31c52c['destcalleridnum']:_0x31c52c[_0x6f95('0x18')];return _0x4674f8;});_0x11ed1d=_0x31c52c[_0x6f95('0x19')]?_0x31c52c[_0x6f95('0x1a')]:_0x31c52c[_0x6f95('0x18')];}var _0x527c68=['id',_0x6f95('0x1b'),_0x6f95('0x1c'),'phone','mobile','fax',_0x6f95('0x13'),_0x6f95('0x1d'),'scheduledAt',_0x6f95('0x1e')];var _0x1393fd=_[_0x6f95('0x1f')](_0x527c68,_0x11394a);BPromise[_0x6f95('0x20')]()[_0x6f95('0x21')](cmContactRpc[_0x6f95('0x22')]({'attributes':_0x1393fd,'where':_0x28b26b,'phone':_0x11ed1d}))['then'](function(_0x28fa59){_0x105393=_0x28fa59;if(!_[_0x6f95('0x23')](_0x105393)){if(_0x105393['length']===0x1){_0x31223b=_0x105393[0x0];logger[_0x6f95('0xb')](_0x6f95('0x24'),_0x31c52c[_0x6f95('0x25')],_0x241362['id'],_0x31223b['id']);}else{logger[_0x6f95('0xb')](_0x6f95('0x26'),_0x31c52c['uniqueid'],_0x241362['id'],_[_0x6f95('0x17')](_0x105393,'id')[_0x6f95('0x27')](','));}return;}else{logger[_0x6f95('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x31c52c[_0x6f95('0x25')],_0x241362['id']);var _0x3ba2be={'ListId':_0x5b5c2a};var _0x2e78aa=_0x53ae0e['data4']&&_0x53ae0e[_0x6f95('0x28')]!=='0'?_0x53ae0e[_0x6f95('0x28')]:_0x6f95('0x16');if(_0x1125f1){logger[_0x6f95('0xb')](_0x6f95('0x29'),_0x31c52c[_0x6f95('0x25')],_0x241362['id']);_0x3ba2be[_0x2e78aa]=_[_0x6f95('0x10')](_0x31c52c[_0x6f95('0x19')])?_0x31c52c[_0x6f95('0x18')]:_0x31c52c[_0x6f95('0x1a')];if(_[_0x6f95('0x10')](_0x31c52c[_0x6f95('0x19')])){_0x3ba2be[_0x6f95('0x1b')]=_0x31c52c[_0x6f95('0x2a')]&&_0x31c52c[_0x6f95('0x2a')]!==_0x6f95('0x2b')?_0x31c52c[_0x6f95('0x2a')]:_0x6f95('0x2c');}else{_0x3ba2be[_0x6f95('0x1b')]=_0x31c52c[_0x6f95('0x2d')]&&_0x31c52c['destcalleridname']!==_0x6f95('0x2b')?_0x31c52c[_0x6f95('0x2d')]:'Unknown';}return BPromise[_0x6f95('0x20')]()[_0x6f95('0x21')](cmContactRpc[_0x6f95('0x2e')](_0x3ba2be))[_0x6f95('0x21')](function(_0x456587){_0x31223b=_0x456587;_0x105393[_0x6f95('0x2f')](_0x456587);if(_0x31223b){logger['info'](_0x6f95('0x30'),_0x31c52c['uniqueid'],_0x241362['id'],_0x31223b['id']);}return;});}else{logger['info'](_0x6f95('0x31'),_0x31c52c[_0x6f95('0x25')],_0x241362['id']);_0x3ba2be[_0x2e78aa]=_[_0x6f95('0x10')](_0x31c52c['routeId'])?_0x31c52c[_0x6f95('0x18')]:_0x31c52c['destcalleridnum'];if(_[_0x6f95('0x10')](_0x31c52c[_0x6f95('0x19')])){_0x3ba2be[_0x6f95('0x1b')]=_0x31c52c[_0x6f95('0x2a')]&&_0x31c52c[_0x6f95('0x2a')]!==''?_0x31c52c[_0x6f95('0x2a')]:_0x6f95('0x2c');}else{_0x3ba2be[_0x6f95('0x1b')]=_0x31c52c['destcalleridname']&&_0x31c52c[_0x6f95('0x2d')]!==_0x6f95('0x2b')?_0x31c52c[_0x6f95('0x2d')]:_0x6f95('0x2c');}_0x31223b=_0x3ba2be;_0x105393[_0x6f95('0x2f')](_0x3ba2be);return;}}})[_0x6f95('0x21')](function(){if(_0x5c291c){emit(_0x31c52c['uniqueid'],_0x241362,util[_0x6f95('0x32')]('user:%s',_0x5c291c['name']),util['format'](_0x6f95('0x33'),_0x53ae0e[_0x6f95('0x34')][_0x6f95('0x35')]()),{'evt':_['merge'](_0x31c52c,{'autoCreate':_0x1125f1}),'contact':_0x31223b===undefined?{}:_0x31223b,'contacts':_0x105393['length']===0x0?undefined:_0x105393});}});}; \ No newline at end of file +var _0x00e3=['updatedAt','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','','Unknown','then','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','fax','scheduledAt'];(function(_0x4885d6,_0x8d92fb){var _0x38291c=function(_0x57fb16){while(--_0x57fb16){_0x4885d6['push'](_0x4885d6['shift']());}};_0x38291c(++_0x8d92fb);}(_0x00e3,0x8f));var _0x300e=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0x00e3[_0x406e46];return _0x4a3742;};'use strict';var _=require(_0x300e('0x0'));var BPromise=require(_0x300e('0x1'));var Redis=require(_0x300e('0x2'));var util=require(_0x300e('0x3'));var config=require(_0x300e('0x4'));var logger=require(_0x300e('0x5'))(_0x300e('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x300e('0x7')]=_[_0x300e('0x8')](config[_0x300e('0x7')],{'host':_0x300e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x5159d1,_0x13540a,_0x29646b,_0x27f3fd,_0x18b9f3){logger[_0x300e('0xa')](_0x300e('0xb'),_0x5159d1,_0x13540a['id'],_0x29646b,_0x27f3fd,JSON['stringify'](_0x18b9f3));io['to'](_0x29646b)[_0x300e('0xc')](_0x27f3fd,_0x18b9f3);}exports[_0x300e('0xd')]=function(_0x24bcf1,_0x152a10,_0x410f31,_0x2639ca){var _0x29fb96,_0x1c18fc;var _0x114755={};var _0x14754;var _0x51e412=Number(_0x410f31[_0x300e('0xe')]);var _0x2e1a00=_0x410f31[_0x300e('0xf')]?Boolean(Number(_0x410f31[_0x300e('0xf')])):![];var _0x1da462;var _0x263a9f=![];if(!_[_0x300e('0x10')](_0x410f31[_0x300e('0x11')])){if(_0x410f31[_0x300e('0x11')]=='1')_0x263a9f=!![];}if(!_0x263a9f){if(_0x2639ca[_0x300e('0x12')]){_0x114755['id']=_0x2639ca['xmd-contactid'];}}if(!_0x114755['id']){_0x114755[_0x300e('0x13')]=_0x51e412;_0x1da462=_0x410f31[_0x300e('0x14')]&&_0x410f31[_0x300e('0x14')]!=='0'?_0x410f31['data3'][_0x300e('0x15')](','):['phone'];_0x114755['$or']=_[_0x300e('0x16')](_0x1da462,function(_0x4f2c22){var _0x587b8c={};_0x587b8c[_0x4f2c22]=_0x2639ca[_0x300e('0x17')]?_0x2639ca[_0x300e('0x18')]:_0x2639ca[_0x300e('0x19')];return _0x587b8c;});_0x14754=_0x2639ca[_0x300e('0x17')]?_0x2639ca[_0x300e('0x18')]:_0x2639ca['calleridnum'];}var _0x2aeeba=['id',_0x300e('0x1a'),'lastName',_0x300e('0x1b'),_0x300e('0x1c'),_0x300e('0x1d'),_0x300e('0x13'),'createdAt',_0x300e('0x1e'),_0x300e('0x1f')];var _0x493640=_['union'](_0x2aeeba,_0x1da462);BPromise[_0x300e('0x20')]()['then'](cmContactRpc[_0x300e('0x21')]({'attributes':_0x493640,'where':_0x114755,'phone':_0x14754}))['then'](function(_0x5489b6){_0x1c18fc=_0x5489b6;if(!_[_0x300e('0x22')](_0x1c18fc)){if(_0x1c18fc[_0x300e('0x23')]===0x1){_0x29fb96=_0x1c18fc[0x0];logger[_0x300e('0xa')](_0x300e('0x24'),_0x2639ca['uniqueid'],_0x152a10['id'],_0x29fb96['id']);}else{logger[_0x300e('0xa')](_0x300e('0x25'),_0x2639ca[_0x300e('0x26')],_0x152a10['id'],_['map'](_0x1c18fc,'id')[_0x300e('0x27')](','));}return;}else{logger[_0x300e('0xa')](_0x300e('0x28'),_0x2639ca[_0x300e('0x26')],_0x152a10['id']);var _0x4c5f85={'ListId':_0x51e412};var _0x31aeb7=_0x410f31[_0x300e('0x29')]&&_0x410f31[_0x300e('0x29')]!=='0'?_0x410f31['data4']:_0x300e('0x1b');if(_0x2e1a00){logger[_0x300e('0xa')](_0x300e('0x2a'),_0x2639ca[_0x300e('0x26')],_0x152a10['id']);_0x4c5f85[_0x31aeb7]=_['isNil'](_0x2639ca[_0x300e('0x17')])?_0x2639ca['calleridnum']:_0x2639ca[_0x300e('0x18')];if(_['isNil'](_0x2639ca[_0x300e('0x17')])){_0x4c5f85[_0x300e('0x1a')]=_0x2639ca[_0x300e('0x2b')]&&_0x2639ca[_0x300e('0x2b')]!==''?_0x2639ca[_0x300e('0x2b')]:'Unknown';}else{_0x4c5f85[_0x300e('0x1a')]=_0x2639ca[_0x300e('0x2c')]&&_0x2639ca[_0x300e('0x2c')]!==_0x300e('0x2d')?_0x2639ca['destcalleridname']:_0x300e('0x2e');}return BPromise['resolve']()[_0x300e('0x2f')](cmContactRpc[_0x300e('0x30')](_0x4c5f85))['then'](function(_0x51db8b){_0x29fb96=_0x51db8b;_0x1c18fc[_0x300e('0x31')](_0x51db8b);if(_0x29fb96){logger[_0x300e('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2639ca[_0x300e('0x26')],_0x152a10['id'],_0x29fb96['id']);}return;});}else{logger[_0x300e('0xa')](_0x300e('0x32'),_0x2639ca[_0x300e('0x26')],_0x152a10['id']);_0x4c5f85[_0x31aeb7]=_[_0x300e('0x10')](_0x2639ca[_0x300e('0x17')])?_0x2639ca['calleridnum']:_0x2639ca['destcalleridnum'];if(_[_0x300e('0x10')](_0x2639ca['routeId'])){_0x4c5f85[_0x300e('0x1a')]=_0x2639ca[_0x300e('0x2b')]&&_0x2639ca[_0x300e('0x2b')]!==_0x300e('0x2d')?_0x2639ca[_0x300e('0x2b')]:'Unknown';}else{_0x4c5f85['firstName']=_0x2639ca[_0x300e('0x2c')]&&_0x2639ca[_0x300e('0x2c')]!==''?_0x2639ca[_0x300e('0x2c')]:'Unknown';}_0x29fb96=_0x4c5f85;_0x1c18fc['push'](_0x4c5f85);return;}}})[_0x300e('0x2f')](function(){if(_0x24bcf1){emit(_0x2639ca[_0x300e('0x26')],_0x152a10,util['format'](_0x300e('0x33'),_0x24bcf1[_0x300e('0x34')]),util[_0x300e('0x35')](_0x300e('0x36'),_0x410f31[_0x300e('0x37')][_0x300e('0x38')]()),{'evt':_[_0x300e('0x39')](_0x2639ca,{'autoCreate':_0x2e1a00}),'contact':_0x29fb96===undefined?{}:_0x29fb96,'contacts':_0x1c18fc[_0x300e('0x23')]===0x0?undefined:_0x1c18fc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 38449a3..0870ecc 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 _0x0d78=['render','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s','trigger:%s:%s','data1','jscripty','name','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','search','replace','checkTrigger','AllConditions','checkConditions','some','AnyConditions','channel','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','interaction','event','value','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','created','exports','mustache','./urlforward','./integration','./cmContact','./script','../../../config/logger','../ami','redis','defaults','localhost','popup','url','winapp','triggers','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','zendeskAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','checkTriggers','agents','interface','hasOwnProperty','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html'];(function(_0x181e7e,_0x57323e){var _0xe4db71=function(_0x431f54){while(--_0x431f54){_0x181e7e['push'](_0x181e7e['shift']());}};_0xe4db71(++_0x57323e);}(_0x0d78,0x134));var _0x80d7=function(_0x27c0c7,_0x8fa9a1){_0x27c0c7=_0x27c0c7-0x0;var _0x3e7757=_0x0d78[_0x27c0c7];return _0x3e7757;};'use strict';var util=require('util');var _=require('lodash');var url=require('url');var Mustache=require(_0x80d7('0x0'));var Redis=require('ioredis');var urlforward=require(_0x80d7('0x1'));var integration=require(_0x80d7('0x2'));var cmContact=require(_0x80d7('0x3'));var script=require(_0x80d7('0x4'));var config=require('../../../config/environment');var logger=require(_0x80d7('0x5'))('trigger');var ami=require(_0x80d7('0x6'));config[_0x80d7('0x7')]=_[_0x80d7('0x8')](config[_0x80d7('0x7')],{'host':_0x80d7('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x2d92d4,_0xbb1af){return _0x2d92d4==_0xbb1af;},'not_equals':function(_0x30c19c,_0x172c77){return _0x30c19c!=_0x172c77;}};var barAndWebActions=[_0x80d7('0xa'),_0x80d7('0xb'),_0x80d7('0xc')];function Trigger(_0x25592b){this['triggers']=_0x25592b[_0x80d7('0xd')];this['agents']=_0x25592b['agents'];this['voiceQueues']=_0x25592b[_0x80d7('0xe')];this[_0x80d7('0xf')]=_0x25592b[_0x80d7('0xf')];this[_0x80d7('0x10')]=_0x25592b['voiceExtensions'];this['zendeskAccounts']=_0x25592b['zendeskAccounts'];this[_0x80d7('0x11')]=_0x25592b[_0x80d7('0x11')];this[_0x80d7('0x12')]=_0x25592b[_0x80d7('0x12')];this['sugarcrmAccounts']=_0x25592b[_0x80d7('0x13')];this['zohoAccounts']=_0x25592b[_0x80d7('0x14')];this['deskAccounts']=_0x25592b[_0x80d7('0x15')];this[_0x80d7('0x16')]=_0x25592b[_0x80d7('0x16')];this['servicenowAccounts']=_0x25592b['servicenowAccounts'];this[_0x80d7('0x17')]=_0x25592b[_0x80d7('0x17')];this[_0x80d7('0x18')]=_0x25592b['freshsalesAccounts'];this['accounts']={'zendesk':this[_0x80d7('0x19')],'salesforce':this[_0x80d7('0x12')],'freshdesk':this[_0x80d7('0x11')],'sugarcrm':this[_0x80d7('0x13')],'zoho':this[_0x80d7('0x14')],'desk':this['deskAccounts'],'vtiger':this[_0x80d7('0x16')],'dynamics365':this[_0x80d7('0x17')],'freshsales':this[_0x80d7('0x18')],'servicenow':this['servicenowAccounts']};ami['on'](_0x80d7('0x1a'),this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x1c'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x1e'),this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x1f'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x20'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x21'),this[_0x80d7('0x1b')]['bind'](this));ami['on']('custom:agentbusy',this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x22'),this['syncCustomEvent'][_0x80d7('0x1d')](this));ami['on']('custom:agentreject',this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x23'),this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x24'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x25'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x26'),this[_0x80d7('0x27')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x28'),this[_0x80d7('0x27')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x29'),this[_0x80d7('0x27')][_0x80d7('0x1d')](this));ami['on']('custom:newinteraction',this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x2a'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on']('custom:substatus',this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on'](_0x80d7('0x2b'),this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x2c'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on']('custom:acceptmessage',this[_0x80d7('0x1b')]['bind'](this));ami['on'](_0x80d7('0x2d'),this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));ami['on']('custom:offlineMessage',this[_0x80d7('0x1b')][_0x80d7('0x1d')](this));}Trigger[_0x80d7('0x2e')]['emit']=function(_0x476c67,_0x4458ee,_0x17579f){logger[_0x80d7('0x2f')](_0x476c67,_0x4458ee,JSON[_0x80d7('0x30')](_0x17579f));io['to'](_0x476c67)[_0x80d7('0x31')](_0x4458ee,_0x17579f);};Trigger[_0x80d7('0x2e')]['syncCustomEvent']=function(_0x540782){var _0x63edb2=_[_0x80d7('0x32')](_0x540782);if(typeof _0x63edb2[_0x80d7('0x33')]===_0x80d7('0x34')){_0x63edb2[_0x80d7('0x33')]=_0x80d7('0x35');}this[_0x80d7('0x36')](_0x63edb2);};Trigger['prototype'][_0x80d7('0x27')]=function(_0x14d45c){if(this[_0x80d7('0x37')][_0x14d45c[_0x80d7('0x38')]]){this[_0x80d7('0x1b')](_0x14d45c);}};Trigger[_0x80d7('0x2e')][_0x80d7('0x36')]=function(_0x1c7fc9){var _0x124c76;for(var _0x364c65 in this[_0x80d7('0xd')]){if(this[_0x80d7('0xd')][_0x80d7('0x39')](_0x364c65)){if(this[_0x80d7('0xd')][_0x364c65]['status']){_0x124c76=this['checkTrigger'](this['triggers'][_0x364c65],_0x1c7fc9);if(_0x124c76){_[_0x80d7('0x3a')](_0x1c7fc9,_0x1c7fc9[_0x80d7('0x3b')]);for(var _0x384fe4=0x0,_0x543c4e,_0xb5bf0f,_0x4b906a;_0x384fe40x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x21cd58,_0x238bf5){var _0x1f9833=function(_0x5b4909){while(--_0x5b4909){_0x21cd58['push'](_0x21cd58['shift']());}};_0x1f9833(++_0x238bf5);}(_0x814b,0x1a2));var _0xb814=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x814b[_0x181dfe];return _0x40c38f;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 2f241a5..e04600f 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 _0xd1b9=['additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','data2','data5','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','body','headers','odata-entityid','substring','lastIndexOf','telephone1','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','indexOf','content','incident','incidents','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','outbound','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]'];(function(_0x1785a2,_0x15d901){var _0x58380c=function(_0x2739e8){while(--_0x2739e8){_0x1785a2['push'](_0x1785a2['shift']());}};_0x58380c(++_0x15d901);}(_0xd1b9,0x1d2));var _0x9d1b=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xd1b9[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x9d1b('0x0'));var rp=require('request-promise');var util=require(_0x9d1b('0x1'));var intUtil=require(_0x9d1b('0x2'));var md5=require(_0x9d1b('0x3'));var Redis=require('ioredis');var logger=require(_0x9d1b('0x4'))(_0x9d1b('0x5'));var config=require(_0x9d1b('0x6'));config[_0x9d1b('0x7')]=_[_0x9d1b('0x8')](config[_0x9d1b('0x7')],{'host':_0x9d1b('0x9'),'port':0x18eb});var io=require(_0x9d1b('0xa'))(new Redis(config['redis']));function getAuthToken(_0x26a6ff,_0x1a7051,_0x1eb9a9){if(_0x26a6ff[_0x9d1b('0xb')]){_0x26a6ff['remoteUri']=_0x26a6ff[_0x9d1b('0xc')][_0x9d1b('0xd')];_0x26a6ff['tenantId']=_0x26a6ff[_0x9d1b('0xc')][_0x9d1b('0xe')];return Promise['resolve'](_0x26a6ff[_0x9d1b('0xc')][_0x9d1b('0xf')]);}var _0x4bb0d6={'method':_0x9d1b('0x10'),'uri':_0x1a7051,'form':{'client_id':_0x26a6ff[_0x9d1b('0x11')],'resource':_0x26a6ff[_0x9d1b('0x12')],'username':_0x26a6ff[_0x9d1b('0x13')],'password':_0x26a6ff[_0x9d1b('0x14')],'grant_type':_0x9d1b('0x14'),'client_secret':_0x26a6ff[_0x9d1b('0x15')]},'json':!![]};return rp(_0x4bb0d6)[_0x9d1b('0x16')](function(_0x50cac9){return _0x50cac9[_0x9d1b('0x17')];})[_0x9d1b('0x18')](function(_0x30c407){logger[_0x9d1b('0x19')]('['+[_0x1eb9a9[_0x9d1b('0x1a')]()]+_0x9d1b('0x1b'));return _0x30c407[_0x9d1b('0x1c')];});}function getUser(_0x3fdc0c,_0x54b6ff,_0x48c949,_0x59be0e,_0x3ffd4b,_0x46ca2c){return new Promise(function(_0xfecfcc,_0xc8fa3f){return getAuthToken(_0x54b6ff,_0x59be0e,_0x46ca2c)[_0x9d1b('0x16')](function(_0x441006){var _0x2d4da3={'method':_0x9d1b('0x1d'),'uri':_0x3ffd4b+_0x9d1b('0x1e'),'headers':{'Authorization':'Bearer\x20'+_0x441006,'OData-Version':_0x9d1b('0x1f')},'json':!![]};return rp(_0x2d4da3);})['then'](function(_0x53202d){var _0x2dd8d6=_0x53202d[_0x9d1b('0x20')];var _0x11073f=![];var _0x358489=null;if(!_[_0x9d1b('0x21')](_0x48c949)){if(intUtil[_0x9d1b('0x22')](_0x48c949[_0x9d1b('0x23')])){_0x3fdc0c[_0x9d1b('0x24')]=_0x48c949['email'];for(_0x358489=0x0;_0x358489<_0x2dd8d6[_0x9d1b('0x25')];_0x358489++){if(_0x2dd8d6[_0x358489]['internalemailaddress']===_0x48c949['email']&&!_0x2dd8d6[_0x358489][_0x9d1b('0x26')]){_0x11073f=!![];logger[_0x9d1b('0x27')]('['+[_0x46ca2c[_0x9d1b('0x1a')]()]+_0x9d1b('0x28')+_0x2dd8d6[_0x358489][_0x9d1b('0x29')]+'!');_0x3fdc0c[_0x9d1b('0x2a')]=_0x2dd8d6[_0x358489][_0x9d1b('0x29')];}}}}if(!_0x11073f){logger['info']('['+[_0x46ca2c[_0x9d1b('0x1a')]()]+_0x9d1b('0x2b'));_0x3fdc0c[_0x9d1b('0x24')]=_0x54b6ff['username'];for(_0x358489=0x0;_0x358489<_0x2dd8d6['length'];_0x358489++){if(_0x2dd8d6[_0x358489][_0x9d1b('0x2c')]===_0x54b6ff[_0x9d1b('0x13')]){_0x3fdc0c[_0x9d1b('0x2a')]=_0x2dd8d6[_0x358489][_0x9d1b('0x29')];}}}_0xfecfcc(_0x3fdc0c);})[_0x9d1b('0x18')](function(_0x1611fe){_0xc8fa3f(_0x1611fe[_0x9d1b('0x1c')]);});});}function createEndUser(_0x4fade9,_0xcfc472,_0x57a9cc,_0x142ac4,_0x2ddf2b,_0x5255fe,_0x4db229){return new Promise(function(_0x148b99,_0x5f32ed){return getAuthToken(_0xcfc472,_0x57a9cc,_0x5255fe)[_0x9d1b('0x16')](function(_0x386a9c){var _0xd2f58c=_0x5255fe[_0x9d1b('0x2d')]()==='outbound'?_0x2ddf2b[_0x9d1b('0x2e')]:_0x2ddf2b[_0x9d1b('0x2f')];var _0x1bca33={'method':_0x9d1b('0x10'),'uri':_0x142ac4+_0x9d1b('0x30'),'body':{'fullname':_0xd2f58c,'firstname':_0xd2f58c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9d1b('0x31')+_0x4fade9[_0x9d1b('0x2a')]+')'},'headers':{'Authorization':_0x9d1b('0x32')+_0x386a9c,'OData-Version':_0x9d1b('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x1bca33[_0x9d1b('0x33')][_0x4db229]=_0xd2f58c;return rp(_0x1bca33);})[_0x9d1b('0x16')](function(_0x5aa082){var _0x1c2a6e=_0x5aa082[_0x9d1b('0x34')][_0x9d1b('0x35')];var _0x338e03=_0x1c2a6e[_0x9d1b('0x36')](_0x1c2a6e[_0x9d1b('0x37')]('(')+0x1,_0x1c2a6e['lastIndexOf'](')'));_0x4fade9['enduserId']=_0x338e03;_0x148b99(_0x4fade9);})[_0x9d1b('0x18')](function(_0x329c65){_0x5f32ed(_0x329c65[_0x9d1b('0x1c')]);});});}function getEndUser(_0x27ccbe,_0xf676dd,_0x251c6a,_0x5c1577,_0x37f576,_0x1908a9,_0x587840,_0x170cd8){var _0xddad34=_0x1908a9['toLowerCase']()==='outbound'?_0x37f576[_0x9d1b('0x2e')]:_0x37f576[_0x9d1b('0x2f')];return getAuthToken(_0xf676dd,_0x251c6a,_0x1908a9)[_0x9d1b('0x16')](function(_0x5b0fcf){_0x170cd8=_0x170cd8?_0x170cd8:_0x9d1b('0x38');var _0x69029e={'method':_0x9d1b('0x1d'),'uri':_0x5c1577+'contacts?$select='+_0x170cd8+'&$filter='+_0x170cd8+_0x9d1b('0x39')+_0xddad34[_0x9d1b('0x3a')]('+',_0x9d1b('0x3b'))+'\x27','headers':{'Authorization':_0x9d1b('0x32')+_0x5b0fcf,'If-None-Match':null,'OData-Version':_0x9d1b('0x1f')},'json':!![]};return rp(_0x69029e);})[_0x9d1b('0x16')](function(_0x2ba625){var _0x33b7b0=![];if(!_0x2ba625)return _0x33b7b0;var _0x42e1a9=_0x2ba625[_0x9d1b('0x20')];for(var _0x3fa441=0x0;_0x3fa441<_0x42e1a9[_0x9d1b('0x25')];_0x3fa441++){if(_0x42e1a9[_0x3fa441][_0x170cd8]===_0xddad34){_0x33b7b0=!![];_0x27ccbe[_0x9d1b('0x3c')]=_0x42e1a9[_0x3fa441][_0x9d1b('0x3d')];}}return _0x33b7b0;})[_0x9d1b('0x16')](function(_0x30ceda){if(_0x30ceda)return _0x27ccbe;if(_0x587840===_0x9d1b('0x3e')){logger['info']('['+[_0x1908a9['toUpperCase']()]+_0x9d1b('0x3f'));return _0x27ccbe;}return createEndUser(_0x27ccbe,_0xf676dd,_0x251c6a,_0x5c1577,_0x37f576,_0x1908a9,_0x170cd8)[_0x9d1b('0x16')](function(_0x59de29){logger['info']('['+[_0x1908a9[_0x9d1b('0x1a')]()]+_0x9d1b('0x40'),_0x59de29[_0x9d1b('0x3c')]);return _0x59de29;});});}function getCustomFields(_0x10c5e2,_0x47e58b,_0x1f2db1){var _0x356291={};if(_0x10c5e2[_0x9d1b('0x25')]>0x0){_[_0x9d1b('0x41')](_0x10c5e2,function(_0x41e00b){if(_[_0x9d1b('0x42')](['string',_0x9d1b('0x43')],_0x41e00b[_0x9d1b('0x44')])&&_0x41e00b[_0x9d1b('0x45')]&&!_0x41e00b[_0x9d1b('0x46')]){var _0x45a327=_0x41e00b['idField']['toLowerCase']();var _0x1d82bc=_0x45a327[_0x9d1b('0x36')](0x0,_0x45a327[_0x9d1b('0x47')]('_'));var _0x412ced=_0x45a327[_0x9d1b('0x36')](_0x45a327[_0x9d1b('0x47')]('_')+0x1);if(_0x1d82bc===_0x1f2db1){_0x356291[_0x412ced]=_0x41e00b[_0x9d1b('0x48')];}}});}return _0x356291;}function getTicket(_0x52acfd,_0xf23dbe,_0x34671c,_0x567515,_0x394626,_0x4f4678,_0x409dc8){return new Promise(function(_0x3ea0d4,_0x4d7602){var _0x14f421;return getAuthToken(_0xf23dbe,_0x34671c,_0x409dc8)['then'](function(_0x771fb6){if(_0x4f4678['ticketType']===_0x9d1b('0x49')){_0x14f421={'method':_0x9d1b('0x10'),'uri':_0x567515+_0x9d1b('0x4a'),'body':Object['assign']({},{'title':intUtil[_0x9d1b('0x4b')](_0x4f4678['Subjects'],_0x394626,'\x20'),'description':intUtil[_0x9d1b('0x4b')](_0x4f4678[_0x9d1b('0x4c')],_0x394626,'\x0a'),'customerid_contact@odata.bind':_0x52acfd[_0x9d1b('0x3c')]?_0x9d1b('0x4d')+_0x52acfd[_0x9d1b('0x3c')]+')':undefined,'ownerid@odata.bind':_0x9d1b('0x31')+_0x52acfd[_0x9d1b('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x4f4678[_0x9d1b('0x4e')],_0x394626,_0x4f4678[_0x9d1b('0x4f')])),'headers':{'Authorization':_0x9d1b('0x32')+_0x771fb6,'OData-Version':_0x9d1b('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4f4678[_0x9d1b('0x4f')]===_0x9d1b('0x50')){var _0x542ddf=_0x52acfd[_0x9d1b('0x3c')]?[{'partyid_systemuser@odata.bind':_0x9d1b('0x31')+_0x52acfd['userId']+')','participationtypemask':_0x52acfd[_0x9d1b('0x51')]===_0x9d1b('0x52')?0x2:0x1},{'partyid_contact@odata.bind':_0x9d1b('0x4d')+_0x52acfd[_0x9d1b('0x3c')]+')','participationtypemask':_0x52acfd[_0x9d1b('0x51')]===_0x9d1b('0x52')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x9d1b('0x31')+_0x52acfd['userId']+')','participationtypemask':_0x52acfd[_0x9d1b('0x51')]==='queue'?0x2:0x1}];_0x14f421={'method':_0x9d1b('0x10'),'uri':_0x567515+_0x9d1b('0x53'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x4f4678[_0x9d1b('0x54')],_0x394626,'\x20'),'phonenumber':String(_0x394626['calleridnum']),'description':intUtil[_0x9d1b('0x4b')](_0x4f4678[_0x9d1b('0x4c')],_0x394626,'\x0a'),'regardingobjectid_contact@odata.bind':_0x52acfd[_0x9d1b('0x3c')]?'/contacts('+_0x52acfd[_0x9d1b('0x3c')]+')':undefined,'ownerid@odata.bind':_0x9d1b('0x31')+_0x52acfd[_0x9d1b('0x2a')]+')','directioncode':_0x52acfd['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':_0x542ddf},getCustomFields(_0x4f4678[_0x9d1b('0x4e')],_0x394626,_0x4f4678[_0x9d1b('0x4f')])),'headers':{'Authorization':_0x9d1b('0x32')+_0x771fb6,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x14f421);})[_0x9d1b('0x16')](function(_0x55a7d1){var _0x341040=_0x55a7d1[_0x9d1b('0x34')][_0x9d1b('0x35')];var _0x3da2be=_0x341040[_0x9d1b('0x36')](_0x341040[_0x9d1b('0x37')]('(')+0x1,_0x341040['lastIndexOf'](')'));_0x52acfd[_0x9d1b('0x55')]=_0x3da2be;_0x3ea0d4(_0x52acfd);})[_0x9d1b('0x18')](function(_0x4b688b){_0x4d7602(_0x4b688b[_0x9d1b('0x1c')]);});});}function emit(_0x32293b,_0x2af1f3,_0x54940c,_0x14c173){var _0x3a676f={'uri':util[_0x9d1b('0x56')](_0x9d1b('0x57'),_0x32293b,_0x54940c,_0x14c173)};io['to'](util['format'](_0x9d1b('0x58'),_0x2af1f3))[_0x9d1b('0x59')](_0x9d1b('0x5a'),_0x3a676f);}exports['cs']=function(_0x241992,_0x424466,_0xe583ff,_0x46a250,_0x1ff8ad,_0x2b7361,_0x4a39b3,_0x3f52a5){var _0x1310f0={};_0x2b7361[_0x9d1b('0x12')]=_0x2b7361['modernAuthentication']?intUtil['stripTrailingSlash'](_0x2b7361[_0x9d1b('0xc')][_0x9d1b('0xd')]):intUtil[_0x9d1b('0x5b')](_0x2b7361[_0x9d1b('0x12')]);_0x2b7361[_0x9d1b('0x5c')]=intUtil[_0x9d1b('0x5b')](_0x2b7361[_0x9d1b('0x5c')]);_0x1310f0[_0x9d1b('0x51')]=_0x3f52a5===_0x9d1b('0x52')||_0x3f52a5==='unmanaged'?_0x9d1b('0x52'):_0x9d1b('0x5d');var _0x1ae869=_0x2b7361[_0x9d1b('0xb')]?util[_0x9d1b('0x56')](_0x9d1b('0x5e'),_0x2b7361[_0x9d1b('0xc')][_0x9d1b('0xd')]):util[_0x9d1b('0x56')](_0x9d1b('0x5e'),_0x2b7361['remoteUri']);var _0xb31699=util[_0x9d1b('0x56')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2b7361[_0x9d1b('0x5f')]);var _0x3e926a=util['format'](_0x9d1b('0x60'),_0x2b7361['serverUrl'],_0x424466[_0x9d1b('0x61')],md5(_0x424466[_0x9d1b('0x61')]));if(_0x1ff8ad&&_0x1ff8ad[_0x9d1b('0x62')]){logger['info'](_0x9d1b('0x63'),_0x9d1b('0x64'));_0x424466[_0x9d1b('0x65')]=_0x3e926a;}else if(_0x4a39b3&&_0x4a39b3[_0x9d1b('0x66')]&&_0x4a39b3['recordingFormat']!=='none'){logger[_0x9d1b('0x27')](_0x9d1b('0x67'),'Recording\x20is\x20enabled!');_0x424466[_0x9d1b('0x65')]=_0x3e926a;}else{_0x424466['recordingURL']='';}return getUser(_0x1310f0,_0x2b7361,_0x46a250,_0xb31699,_0x1ae869,_0x3f52a5)['then'](function(_0x4fb947){logger['info']('['+_0x3f52a5[_0x9d1b('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x4fb947['userId']);logger[_0x9d1b('0x27')]('['+_0x3f52a5[_0x9d1b('0x1a')]()+']\x20The\x20User\x20email\x20is:',_0x4fb947[_0x9d1b('0x24')]);return getEndUser(_0x4fb947,_0x2b7361,_0xb31699,_0x1ae869,_0x424466,_0x3f52a5,_0xe583ff['moduleCreate'],_0xe583ff[_0x9d1b('0x68')]);})[_0x9d1b('0x16')](function(_0x3be1de){logger[_0x9d1b('0x27')]('['+_0x3f52a5[_0x9d1b('0x1a')]()+_0x9d1b('0x69'),_0x3be1de[_0x9d1b('0x3c')]);logger[_0x9d1b('0x27')]('['+_0x3f52a5[_0x9d1b('0x1a')]()+_0x9d1b('0x6a'),_0x424466[_0x9d1b('0x2f')]);return getTicket(_0x3be1de,_0x2b7361,_0xb31699,_0x1ae869,_0x424466,_0xe583ff,_0x3f52a5);})[_0x9d1b('0x16')](function(_0x41ad33){logger[_0x9d1b('0x27')](util[_0x9d1b('0x56')]('['+_0x3f52a5[_0x9d1b('0x1a')]()+_0x9d1b('0x6b'),_0xe583ff[_0x9d1b('0x4f')],_0x41ad33[_0x9d1b('0x55')]));logger[_0x9d1b('0x27')](util[_0x9d1b('0x56')]('['+_0x3f52a5['toUpperCase']()+_0x9d1b('0x6c'),_0x3f52a5));if(_0x3f52a5!==_0x9d1b('0x6d')&&_0xe583ff[_0x9d1b('0x6e')]){logger[_0x9d1b('0x27')]('['+_0x3f52a5['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x2b7361[_0x9d1b('0x12')],_0x46a250[_0x9d1b('0x6f')],_0xe583ff[_0x9d1b('0x4f')],_0x41ad33[_0x9d1b('0x55')]);}})[_0x9d1b('0x18')](function(_0x360948){logger[_0x9d1b('0x19')]('['+_0x3f52a5[_0x9d1b('0x1a')]()+_0x9d1b('0x70'),_0x360948['message']);console[_0x9d1b('0x19')](_0x9d1b('0x71'),_0x360948);});}; \ No newline at end of file +var _0xff06=[']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','resolve','data5','clientId','remoteUri','username','password','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','POST','contacts','/systemusers(','substring','lastIndexOf','enduserId','calleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Subjects','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Descriptions','Bearer\x20','headers','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name'];(function(_0x5d312b,_0x38cf18){var _0x4dd79c=function(_0x3b68ce){while(--_0x3b68ce){_0x5d312b['push'](_0x5d312b['shift']());}};_0x4dd79c(++_0x38cf18);}(_0xff06,0x155));var _0x6ff0=function(_0x1aaa57,_0x3b0b60){_0x1aaa57=_0x1aaa57-0x0;var _0x1e33ec=_0xff06[_0x1aaa57];return _0x1e33ec;};'use strict';var _=require(_0x6ff0('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0x6ff0('0x1'));var md5=require(_0x6ff0('0x2'));var Redis=require('ioredis');var logger=require(_0x6ff0('0x3'))(_0x6ff0('0x4'));var config=require(_0x6ff0('0x5'));config[_0x6ff0('0x6')]=_['defaults'](config[_0x6ff0('0x6')],{'host':_0x6ff0('0x7'),'port':0x18eb});var io=require(_0x6ff0('0x8'))(new Redis(config[_0x6ff0('0x6')]));function getAuthToken(_0x12b60f,_0x4e200c,_0xc9a828){if(_0x12b60f[_0x6ff0('0x9')]){_0x12b60f['remoteUri']=_0x12b60f[_0x6ff0('0xa')][_0x6ff0('0xb')];_0x12b60f[_0x6ff0('0xc')]=_0x12b60f[_0x6ff0('0xa')]['data2'];return Promise[_0x6ff0('0xd')](_0x12b60f[_0x6ff0('0xa')][_0x6ff0('0xe')]);}var _0x1e69da={'method':'POST','uri':_0x4e200c,'form':{'client_id':_0x12b60f[_0x6ff0('0xf')],'resource':_0x12b60f[_0x6ff0('0x10')],'username':_0x12b60f[_0x6ff0('0x11')],'password':_0x12b60f[_0x6ff0('0x12')],'grant_type':'password','client_secret':_0x12b60f['clientSecret']},'json':!![]};return rp(_0x1e69da)['then'](function(_0x38877e){return _0x38877e[_0x6ff0('0x13')];})[_0x6ff0('0x14')](function(_0x3b77d7){logger[_0x6ff0('0x15')]('['+[_0xc9a828[_0x6ff0('0x16')]()]+_0x6ff0('0x17'));return _0x3b77d7[_0x6ff0('0x18')];});}function getUser(_0x416416,_0x4e7ead,_0x271d0f,_0x278c67,_0x12e218,_0x1f2b69){return new Promise(function(_0x47894b,_0x253d26){return getAuthToken(_0x4e7ead,_0x278c67,_0x1f2b69)[_0x6ff0('0x19')](function(_0x4219e8){var _0x104078={'method':_0x6ff0('0x1a'),'uri':_0x12e218+_0x6ff0('0x1b'),'headers':{'Authorization':'Bearer\x20'+_0x4219e8,'OData-Version':_0x6ff0('0x1c')},'json':!![]};return rp(_0x104078);})['then'](function(_0x2fbf2e){var _0x123323=_0x2fbf2e[_0x6ff0('0x1d')];var _0x307125=![];var _0x531fa2=null;if(!_[_0x6ff0('0x1e')](_0x271d0f)){if(intUtil[_0x6ff0('0x1f')](_0x271d0f['email'])){_0x416416[_0x6ff0('0x20')]=_0x271d0f[_0x6ff0('0x21')];for(_0x531fa2=0x0;_0x531fa2<_0x123323[_0x6ff0('0x22')];_0x531fa2++){if(_0x123323[_0x531fa2][_0x6ff0('0x23')]===_0x271d0f[_0x6ff0('0x21')]&&!_0x123323[_0x531fa2]['isdisabled']){_0x307125=!![];logger[_0x6ff0('0x24')]('['+[_0x1f2b69['toUpperCase']()]+_0x6ff0('0x25')+_0x123323[_0x531fa2]['systemuserid']+'!');_0x416416[_0x6ff0('0x26')]=_0x123323[_0x531fa2]['systemuserid'];}}}}if(!_0x307125){logger[_0x6ff0('0x24')]('['+[_0x1f2b69[_0x6ff0('0x16')]()]+_0x6ff0('0x27'));_0x416416[_0x6ff0('0x20')]=_0x4e7ead[_0x6ff0('0x11')];for(_0x531fa2=0x0;_0x531fa2<_0x123323[_0x6ff0('0x22')];_0x531fa2++){if(_0x123323[_0x531fa2][_0x6ff0('0x23')]===_0x4e7ead[_0x6ff0('0x11')]){_0x416416['userId']=_0x123323[_0x531fa2]['systemuserid'];}}}_0x47894b(_0x416416);})[_0x6ff0('0x14')](function(_0x1df879){_0x253d26(_0x1df879['message']);});});}function createEndUser(_0x5529c9,_0x1c4baa,_0x46ac5d,_0x1f4d55,_0x3876a3,_0x49f4bb,_0xe058e9){return new Promise(function(_0x379f9e,_0x3dbeb2){return getAuthToken(_0x1c4baa,_0x46ac5d,_0x49f4bb)[_0x6ff0('0x19')](function(_0x47b827){var _0x5cf06d=_0x49f4bb[_0x6ff0('0x28')]()===_0x6ff0('0x29')?_0x3876a3[_0x6ff0('0x2a')]:_0x3876a3['calleridnum'];var _0x3ec6bd={'method':_0x6ff0('0x2b'),'uri':_0x1f4d55+_0x6ff0('0x2c'),'body':{'fullname':_0x5cf06d,'firstname':_0x5cf06d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x6ff0('0x2d')+_0x5529c9['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x47b827,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x3ec6bd['body'][_0xe058e9]=_0x5cf06d;return rp(_0x3ec6bd);})[_0x6ff0('0x19')](function(_0x10f3f7){var _0x31d0f9=_0x10f3f7['headers']['odata-entityid'];var _0x25a564=_0x31d0f9[_0x6ff0('0x2e')](_0x31d0f9[_0x6ff0('0x2f')]('(')+0x1,_0x31d0f9[_0x6ff0('0x2f')](')'));_0x5529c9[_0x6ff0('0x30')]=_0x25a564;_0x379f9e(_0x5529c9);})[_0x6ff0('0x14')](function(_0x10d5b3){_0x3dbeb2(_0x10d5b3[_0x6ff0('0x18')]);});});}function getEndUser(_0x2a816c,_0x26902e,_0x559c7b,_0x1936d1,_0x29940c,_0x3d87dc,_0x1ccef2,_0x30cdc6){var _0x5e527=_0x3d87dc[_0x6ff0('0x28')]()===_0x6ff0('0x29')?_0x29940c['destcalleridnum']:_0x29940c[_0x6ff0('0x31')];return getAuthToken(_0x26902e,_0x559c7b,_0x3d87dc)[_0x6ff0('0x19')](function(_0x5350b2){_0x30cdc6=_0x30cdc6?_0x30cdc6:_0x6ff0('0x32');var _0x4ccb1e={'method':'GET','uri':_0x1936d1+_0x6ff0('0x33')+_0x30cdc6+_0x6ff0('0x34')+_0x30cdc6+_0x6ff0('0x35')+_0x5e527[_0x6ff0('0x36')]('+',_0x6ff0('0x37'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x5350b2,'If-None-Match':null,'OData-Version':_0x6ff0('0x1c')},'json':!![]};return rp(_0x4ccb1e);})[_0x6ff0('0x19')](function(_0x22c49d){var _0x32bd46=![];if(!_0x22c49d)return _0x32bd46;var _0x4e2b04=_0x22c49d['value'];for(var _0x45fdf5=0x0;_0x45fdf5<_0x4e2b04['length'];_0x45fdf5++){if(_0x4e2b04[_0x45fdf5][_0x30cdc6]===_0x5e527){_0x32bd46=!![];_0x2a816c[_0x6ff0('0x30')]=_0x4e2b04[_0x45fdf5][_0x6ff0('0x38')];}}return _0x32bd46;})['then'](function(_0x572c82){if(_0x572c82)return _0x2a816c;if(_0x1ccef2===_0x6ff0('0x39')){logger[_0x6ff0('0x24')]('['+[_0x3d87dc[_0x6ff0('0x16')]()]+_0x6ff0('0x3a'));return _0x2a816c;}return createEndUser(_0x2a816c,_0x26902e,_0x559c7b,_0x1936d1,_0x29940c,_0x3d87dc,_0x30cdc6)[_0x6ff0('0x19')](function(_0x32badd){logger[_0x6ff0('0x24')]('['+[_0x3d87dc[_0x6ff0('0x16')]()]+_0x6ff0('0x3b'),_0x32badd[_0x6ff0('0x30')]);return _0x32badd;});});}function getCustomFields(_0x40c5a0,_0x1e198b,_0x875c0){var _0x4ab6fd={};if(_0x40c5a0[_0x6ff0('0x22')]>0x0){_[_0x6ff0('0x3c')](_0x40c5a0,function(_0x2a0f10){if(_['includes']([_0x6ff0('0x3d'),_0x6ff0('0x3e')],_0x2a0f10['type'])&&_0x2a0f10[_0x6ff0('0x3f')]&&!_0x2a0f10[_0x6ff0('0x40')]){var _0x3a5b32=_0x2a0f10[_0x6ff0('0x41')]['toLowerCase']();var _0x5542e6=_0x3a5b32[_0x6ff0('0x2e')](0x0,_0x3a5b32[_0x6ff0('0x42')]('_'));var _0x59b7cf=_0x3a5b32['substring'](_0x3a5b32[_0x6ff0('0x42')]('_')+0x1);if(_0x5542e6===_0x875c0){_0x4ab6fd[_0x59b7cf]=_0x2a0f10['content'];}}});}return _0x4ab6fd;}function getTicket(_0x4d22ca,_0x533eb3,_0x467cd6,_0x48d060,_0x460e9f,_0x275251,_0x103d8a){return new Promise(function(_0x3b88a6,_0x1cc856){var _0x578c7f;return getAuthToken(_0x533eb3,_0x467cd6,_0x103d8a)['then'](function(_0x54c53b){if(_0x275251['ticketType']===_0x6ff0('0x43')){_0x578c7f={'method':_0x6ff0('0x2b'),'uri':_0x48d060+_0x6ff0('0x44'),'body':Object[_0x6ff0('0x45')]({},{'title':intUtil[_0x6ff0('0x46')](_0x275251[_0x6ff0('0x47')],_0x460e9f,'\x20'),'description':intUtil[_0x6ff0('0x46')](_0x275251['Descriptions'],_0x460e9f,'\x0a'),'customerid_contact@odata.bind':_0x4d22ca[_0x6ff0('0x30')]?_0x6ff0('0x48')+_0x4d22ca[_0x6ff0('0x30')]+')':undefined,'ownerid@odata.bind':_0x6ff0('0x2d')+_0x4d22ca[_0x6ff0('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x275251[_0x6ff0('0x49')],_0x460e9f,_0x275251[_0x6ff0('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x54c53b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x275251[_0x6ff0('0x4a')]===_0x6ff0('0x4b')){var _0x36339a=_0x4d22ca[_0x6ff0('0x30')]?[{'partyid_systemuser@odata.bind':_0x6ff0('0x2d')+_0x4d22ca[_0x6ff0('0x26')]+')','participationtypemask':_0x4d22ca[_0x6ff0('0x4c')]===_0x6ff0('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x6ff0('0x48')+_0x4d22ca['enduserId']+')','participationtypemask':_0x4d22ca['callDirection']==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x6ff0('0x2d')+_0x4d22ca[_0x6ff0('0x26')]+')','participationtypemask':_0x4d22ca['callDirection']==='queue'?0x2:0x1}];_0x578c7f={'method':'POST','uri':_0x48d060+_0x6ff0('0x4e'),'body':Object[_0x6ff0('0x45')]({},{'subject':intUtil[_0x6ff0('0x46')](_0x275251['Subjects'],_0x460e9f,'\x20'),'phonenumber':String(_0x460e9f[_0x6ff0('0x31')]),'description':intUtil['getString'](_0x275251[_0x6ff0('0x4f')],_0x460e9f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4d22ca['enduserId']?_0x6ff0('0x48')+_0x4d22ca[_0x6ff0('0x30')]+')':undefined,'ownerid@odata.bind':_0x6ff0('0x2d')+_0x4d22ca['userId']+')','directioncode':_0x4d22ca[_0x6ff0('0x4c')]==='queue'?![]:!![],'phonecall_activity_parties':_0x36339a},getCustomFields(_0x275251[_0x6ff0('0x49')],_0x460e9f,_0x275251['ticketType'])),'headers':{'Authorization':_0x6ff0('0x50')+_0x54c53b,'OData-Version':_0x6ff0('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x578c7f);})[_0x6ff0('0x19')](function(_0x185646){var _0x5bc885=_0x185646[_0x6ff0('0x51')][_0x6ff0('0x52')];var _0x12f56f=_0x5bc885[_0x6ff0('0x2e')](_0x5bc885[_0x6ff0('0x2f')]('(')+0x1,_0x5bc885[_0x6ff0('0x2f')](')'));_0x4d22ca['ticketId']=_0x12f56f;_0x3b88a6(_0x4d22ca);})[_0x6ff0('0x14')](function(_0x1efb06){_0x1cc856(_0x1efb06[_0x6ff0('0x18')]);});});}function emit(_0x57db38,_0x2911cf,_0x576d6c,_0x273452){var _0x1da416={'uri':util[_0x6ff0('0x53')](_0x6ff0('0x54'),_0x57db38,_0x576d6c,_0x273452)};io['to'](util[_0x6ff0('0x53')](_0x6ff0('0x55'),_0x2911cf))[_0x6ff0('0x56')](_0x6ff0('0x57'),_0x1da416);}exports['cs']=function(_0x94830c,_0x5decb6,_0x1ca3cf,_0xda3aba,_0xcfe6a1,_0xaea66e,_0xb9b468,_0x23f793){var _0x459e0f={};_0xaea66e['remoteUri']=_0xaea66e[_0x6ff0('0x9')]?intUtil[_0x6ff0('0x58')](_0xaea66e[_0x6ff0('0xa')][_0x6ff0('0xb')]):intUtil[_0x6ff0('0x58')](_0xaea66e[_0x6ff0('0x10')]);_0xaea66e[_0x6ff0('0x59')]=intUtil[_0x6ff0('0x58')](_0xaea66e[_0x6ff0('0x59')]);_0x459e0f[_0x6ff0('0x4c')]=_0x23f793==='queue'||_0x23f793===_0x6ff0('0x5a')?_0x6ff0('0x4d'):_0x6ff0('0x29');var _0x18b6a1=_0xaea66e[_0x6ff0('0x9')]?util['format'](_0x6ff0('0x5b'),_0xaea66e[_0x6ff0('0xa')][_0x6ff0('0xb')]):util[_0x6ff0('0x53')](_0x6ff0('0x5b'),_0xaea66e['remoteUri']);var _0x1c7bf4=util[_0x6ff0('0x53')]('https://login.microsoftonline.com/%s/oauth2/token',_0xaea66e['tenantId']);var _0xd712f2=util[_0x6ff0('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xaea66e[_0x6ff0('0x59')],_0x5decb6[_0x6ff0('0x5c')],md5(_0x5decb6[_0x6ff0('0x5c')]));if(_0xcfe6a1&&_0xcfe6a1[_0x6ff0('0x5d')]){logger[_0x6ff0('0x24')](_0x6ff0('0x5e'),_0x6ff0('0x5f'));_0x5decb6[_0x6ff0('0x60')]=_0xd712f2;}else if(_0xb9b468&&_0xb9b468[_0x6ff0('0x61')]&&_0xb9b468[_0x6ff0('0x61')]!==_0x6ff0('0x62')){logger['info'](_0x6ff0('0x63'),_0x6ff0('0x5f'));_0x5decb6[_0x6ff0('0x60')]=_0xd712f2;}else{_0x5decb6[_0x6ff0('0x60')]='';}return getUser(_0x459e0f,_0xaea66e,_0xda3aba,_0x1c7bf4,_0x18b6a1,_0x23f793)[_0x6ff0('0x19')](function(_0x33f03d){logger[_0x6ff0('0x24')]('['+_0x23f793[_0x6ff0('0x16')]()+_0x6ff0('0x64'),_0x33f03d[_0x6ff0('0x26')]);logger[_0x6ff0('0x24')]('['+_0x23f793[_0x6ff0('0x16')]()+_0x6ff0('0x65'),_0x33f03d['userEmail']);return getEndUser(_0x33f03d,_0xaea66e,_0x1c7bf4,_0x18b6a1,_0x5decb6,_0x23f793,_0x1ca3cf[_0x6ff0('0x66')],_0x1ca3cf[_0x6ff0('0x67')]);})[_0x6ff0('0x19')](function(_0x546bf7){logger[_0x6ff0('0x24')]('['+_0x23f793[_0x6ff0('0x16')]()+_0x6ff0('0x68'),_0x546bf7[_0x6ff0('0x30')]);logger['info']('['+_0x23f793['toUpperCase']()+_0x6ff0('0x69'),_0x5decb6[_0x6ff0('0x31')]);return getTicket(_0x546bf7,_0xaea66e,_0x1c7bf4,_0x18b6a1,_0x5decb6,_0x1ca3cf,_0x23f793);})['then'](function(_0x2ebd9b){logger['info'](util['format']('['+_0x23f793['toUpperCase']()+_0x6ff0('0x6a'),_0x1ca3cf[_0x6ff0('0x4a')],_0x2ebd9b[_0x6ff0('0x6b')]));logger[_0x6ff0('0x24')](util[_0x6ff0('0x53')]('['+_0x23f793['toUpperCase']()+_0x6ff0('0x6c'),_0x23f793));if(_0x23f793!==_0x6ff0('0x5a')&&_0x1ca3cf['openNewTab']){logger[_0x6ff0('0x24')]('['+_0x23f793[_0x6ff0('0x16')]()+']',_0x6ff0('0x6d'));emit(_0xaea66e['remoteUri'],_0xda3aba[_0x6ff0('0x6e')],_0x1ca3cf[_0x6ff0('0x4a')],_0x2ebd9b['ticketId']);}})[_0x6ff0('0x14')](function(_0x21d3a3){logger[_0x6ff0('0x15')]('['+_0x23f793['toUpperCase']()+_0x6ff0('0x6f'),_0x21d3a3[_0x6ff0('0x18')]);console[_0x6ff0('0x15')](_0x6ff0('0x70'),_0x21d3a3);});}; \ 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 4ecf0af..ae711d5 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 _0x546e=['then','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','content','idField','push','variable','variableName','customVariable','Variable','customField','toLowerCase','queue','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Tags','name','Fields','custom_fields','keyBy','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','remoteUri'];(function(_0x180bae,_0x2cbaa6){var _0x433021=function(_0x4768be){while(--_0x4768be){_0x180bae['push'](_0x180bae['shift']());}};_0x433021(++_0x2cbaa6);}(_0x546e,0x1ec));var _0xe546=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x546e[_0x5d80de];return _0x1c7556;};'use strict';var _=require('lodash');var rp=require(_0xe546('0x0'));var md5=require(_0xe546('0x1'));var util=require('util');var Redis=require(_0xe546('0x2'));var intUtil=require(_0xe546('0x3'));var config=require(_0xe546('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0xe546('0x5')]=_['defaults'](config[_0xe546('0x5')],{'host':_0xe546('0x6'),'port':0x18eb});var io=require(_0xe546('0x7'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x441878,_0x28ab04,_0x357903){io['to'](_0x441878)['emit'](_0x28ab04,_0x357903);}function getTicket(_0x291e9c,_0x15e760,_0xeb6415,_0x279a49,_0x1110e9){logger[_0xe546('0x8')](_0xe546('0x9'));var _0x3825a5=_['merge']({'responder_id':_0x15e760['id'],'requester_id':_0xeb6415['id'],'name':util[_0xe546('0xa')](_0xe546('0xb'),_0x1110e9[_0xe546('0xc')]),'phone':_0x1110e9['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x279a49['Subjects'],_0x1110e9,'\x20'),'description':intUtil[_0xe546('0xd')](_0x279a49['Descriptions'],_0x1110e9,'
'),'tags':getTags(_0x279a49[_0xe546('0xe')],_0xe546('0xf'))},getCustomFields(_0x279a49[_0xe546('0x10')],_0x1110e9));_0x3825a5[_0xe546('0x11')]=_['mapValues'](_[_0xe546('0x12')](_0x3825a5[_0xe546('0x11')],'id'),'value');return request({'uri':util[_0xe546('0xa')](_0xe546('0x13'),_0x291e9c['remoteUri']),'method':_0xe546('0x14'),'body':_0x3825a5})['then'](function(_0x344187){logger[_0xe546('0x8')](_0xe546('0x15'));return _0x344187;});}function getUser(_0x470cbf,_0xd2a830){if(intUtil[_0xe546('0x16')](_0xd2a830)){return request({'uri':util['format']('%s/api/v2/agents',_0x470cbf[_0xe546('0x17')]),'qs':{'email':_0xd2a830}})[_0xe546('0x18')](function(_0x38171c){if(_0x38171c['length']){logger['info'](_0xe546('0x19'));return _[_0xe546('0x1a')](_0x38171c,function(_0x32b2cd){return _0x32b2cd[_0xe546('0x1b')]['email']===_0xd2a830;});}else{logger[_0xe546('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe546('0xa')](_0xe546('0x1c'),_0x470cbf[_0xe546('0x17')])})[_0xe546('0x18')](function(_0x1d785f){logger[_0xe546('0x8')](_0xe546('0x1d'));return _0x1d785f;});}});}else{logger['info'](_0xe546('0x1e'));return request({'uri':util[_0xe546('0xa')](_0xe546('0x1c'),_0x470cbf[_0xe546('0x17')])})[_0xe546('0x18')](function(_0x48acb9){logger[_0xe546('0x8')](_0xe546('0x1d'));return _0x48acb9;});}}function getEndUser(_0x37ed01,_0x4217b8,_0x30c95b){logger['info'](_0xe546('0x1f'),_0x30c95b);return request({'uri':util['format'](_0xe546('0x20'),_0x37ed01['remoteUri']),'qs':{'phone':_0x30c95b}})[_0xe546('0x18')](function(_0x1bd07c){if(_0x1bd07c[_0xe546('0x21')]){logger[_0xe546('0x8')](_0xe546('0x22'));return _[_0xe546('0x1a')](_0x1bd07c,{'phone':_0x30c95b});}else{logger['info'](_0xe546('0x23'));return request({'uri':util['format'](_0xe546('0x20'),_0x37ed01[_0xe546('0x17')]),'method':'POST','body':{'name':_0x4217b8,'phone':_0x30c95b}})['then'](function(_0x3dd301){logger['info'](_0xe546('0x24'));return _0x3dd301;});}});}function getAuth(_0x5102d3){return util[_0xe546('0xa')](_0xe546('0x25'),new Buffer(_0x5102d3['apiKey']+':X')[_0xe546('0x26')](_0xe546('0x27')));}function request(_0x709ab9){logger[_0xe546('0x28')]('[HTTP]',JSON[_0xe546('0x29')](_0x709ab9));return rp(_[_0xe546('0x2a')](_0x709ab9,{'method':_0xe546('0x2b'),'headers':headers,'json':!![]}));}function getTags(_0x15baee,_0x51d3d6){var _0x3c1efc=[];if(_0x15baee&&_0x15baee[_0xe546('0x21')]>0x0){_0x3c1efc=_[_0xe546('0x2c')](_0x15baee,_0x51d3d6);}return _0x3c1efc;}function getCustomFields(_0xbb73b4,_0x224c50){var _0x4d6f89=[];var _0x4ffd1e={'custom_fields':[]};if(_0xbb73b4['length']>0x0){_[_0xe546('0x2d')](_0xbb73b4,function(_0xf57701){if(_[_0xe546('0x2e')]([_0xe546('0x2f'),_0xe546('0x30')],_0xf57701[_0xe546('0x31')])&&_0xf57701[_0xe546('0x32')]&&!_0xf57701['customField']){_0x4ffd1e[_0xf57701[_0xe546('0x32')]['toLowerCase']()]=_0xf57701[_0xe546('0x33')][_0xe546('0x26')]();}else if(_['includes']([_0xe546('0x2f'),_0xe546('0x30')],_0xf57701[_0xe546('0x31')])&&_0xf57701[_0xe546('0x34')]&&_0xf57701['customField']){_0x4ffd1e[_0xe546('0x11')][_0xe546('0x35')]({'id':_0xf57701[_0xe546('0x34')],'value':_0xf57701['content'][_0xe546('0x26')]()});}else if(_0xf57701[_0xe546('0x31')]===_0xe546('0x36')&&_0xf57701[_0xe546('0x37')]&&_0xf57701['idField']&&_0xf57701['customField']){_0x224c50[_0xf57701[_0xe546('0x37')]]&&_0x4ffd1e[_0xe546('0x11')][_0xe546('0x35')]({'id':_0xf57701[_0xe546('0x34')],'value':_0x224c50[_0xf57701['variableName']][_0xe546('0x26')]()});}else if(_0xf57701[_0xe546('0x31')]===_0xe546('0x38')&&_0xf57701['Variable']&&_0xf57701[_0xe546('0x39')][_0xe546('0xf')]&&_0xf57701['idField']&&_0xf57701[_0xe546('0x3a')]){_0x224c50[_0xf57701[_0xe546('0x39')][_0xe546('0xf')]['toLowerCase']()]&&_0x4ffd1e[_0xe546('0x11')][_0xe546('0x35')]({'id':_0xf57701[_0xe546('0x34')],'value':_0x224c50[_0xf57701[_0xe546('0x39')][_0xe546('0xf')][_0xe546('0x3b')]()][_0xe546('0x26')]()});}});}return _0x4ffd1e;}exports[_0xe546('0x3c')]=function(_0x3966b4,_0x437689,_0x2641a5,_0x21003f,_0xe8607d,_0x43208e){var _0x523c75,_0x23afab;_0x43208e['remoteUri']=intUtil[_0xe546('0x3d')](_0x43208e[_0xe546('0x17')]);_0x43208e['serverUrl']=intUtil[_0xe546('0x3d')](_0x43208e[_0xe546('0x3e')]);if(_0xe8607d&&_0xe8607d['monitor_format']){logger[_0xe546('0x8')]('[QUEUE]',_0xe546('0x3f'));_0x437689['recordingURL']=util[_0xe546('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x43208e[_0xe546('0x3e')],_0x437689['uniqueid'],md5(_0x437689[_0xe546('0x40')]));}else{_0x437689[_0xe546('0x41')]='';}headers[_0xe546('0x42')]=getAuth(_0x43208e);return getUser(_0x43208e,_0x21003f[_0xe546('0x43')])[_0xe546('0x18')](function(_0x83797e){_0x523c75=_0x83797e;logger[_0xe546('0x8')](_0xe546('0x44'),_0x523c75['id']);return getEndUser(_0x43208e,_0x437689[_0xe546('0xc')],_0x437689['calleridnum']);})['then'](function(_0x2329ea){_0x23afab=_0x2329ea;logger[_0xe546('0x8')](_0xe546('0x45'),_0x23afab['id']);return getTicket(_0x43208e,_0x523c75,_0x23afab,_0x2641a5,_0x437689);})[_0xe546('0x18')](function(_0x3a4ac6){if(_0x3a4ac6&&_0x3a4ac6['id']){logger[_0xe546('0x8')](_0xe546('0x15'));logger[_0xe546('0x8')](_0xe546('0x46'),_0x3a4ac6['id']);logger[_0xe546('0x8')]('[QUEUE]',_0xe546('0x47'));emit(util['format']('user:%s',_0x21003f[_0xe546('0xf')]),_0xe546('0x48'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x43208e[_0xe546('0x17')],_0x3a4ac6['id'])});}})[_0xe546('0x49')](function(_0x5537d2){logger[_0xe546('0x4a')](_0xe546('0x4b'),JSON['stringify'](_0x5537d2));});};exports[_0xe546('0x4c')]=function(_0x5b9eb0,_0x3fdda1,_0x1fe9b1,_0x1cbf3f,_0x4c4cae,_0x490acd,_0x289df7){var _0x1922fe,_0x4e9608;_0x490acd[_0xe546('0x17')]=intUtil['stripTrailingSlash'](_0x490acd[_0xe546('0x17')]);_0x490acd[_0xe546('0x3e')]=intUtil[_0xe546('0x3d')](_0x490acd[_0xe546('0x3e')]);if(_0x289df7&&_0x289df7['recordingFormat']&&_0x289df7[_0xe546('0x4d')]!==_0xe546('0x4e')){logger['info'](_0xe546('0x4f'),'Recording\x20is\x20enabled!');_0x3fdda1[_0xe546('0x41')]=util[_0xe546('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x490acd[_0xe546('0x3e')],_0x3fdda1[_0xe546('0x40')],md5(_0x3fdda1['uniqueid']));}headers['Authorization']=getAuth(_0x490acd);return getUser(_0x490acd,_0x1cbf3f[_0xe546('0x43')])[_0xe546('0x18')](function(_0x3cc7d0){_0x1922fe=_0x3cc7d0;logger[_0xe546('0x8')](_0xe546('0x44'),_0x1922fe['id']);return getEndUser(_0x490acd,_0x3fdda1[_0xe546('0x50')],_0x3fdda1[_0xe546('0x51')]);})[_0xe546('0x18')](function(_0x3c8710){_0x4e9608=_0x3c8710;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4e9608['id']);return getTicket(_0x490acd,_0x1922fe,_0x4e9608,_0x1fe9b1,_0x3fdda1);})['then'](function(_0x56bd36){if(_0x56bd36&&_0x56bd36['id']){logger[_0xe546('0x8')](_0xe546('0x15'));logger[_0xe546('0x8')](_0xe546('0x46'),_0x56bd36['id']);logger[_0xe546('0x8')](_0xe546('0x4f'),_0xe546('0x47'));emit(util[_0xe546('0xa')](_0xe546('0x52'),_0x1cbf3f[_0xe546('0xf')]),_0xe546('0x48'),{'uri':util[_0xe546('0xa')]('%s/helpdesk/tickets/%d',_0x490acd[_0xe546('0x17')],_0x56bd36['id'])});}})[_0xe546('0x49')](function(_0x423f92){logger['error']('[OUTBOUND]',JSON[_0xe546('0x29')](_0x423f92));});};exports['unmanaged']=function(_0x183c87,_0x2180f6,_0x24961c,_0x1a2bd9,_0x34e3b9,_0x5e03ce){var _0x465818,_0x12564d;_0x5e03ce[_0xe546('0x17')]=intUtil[_0xe546('0x3d')](_0x5e03ce['remoteUri']);_0x5e03ce[_0xe546('0x3e')]=intUtil[_0xe546('0x3d')](_0x5e03ce[_0xe546('0x3e')]);if(_0x34e3b9&&_0x34e3b9['monitor_format']){logger['info']('['+_0x2180f6['lastevent']['toUpperCase']()+']',_0xe546('0x3f'));_0x2180f6[_0xe546('0x41')]=util[_0xe546('0xa')](_0xe546('0x53'),_0x5e03ce[_0xe546('0x3e')],_0x2180f6[_0xe546('0x40')],md5(_0x2180f6[_0xe546('0x40')]));}else{_0x2180f6[_0xe546('0x41')]='';}headers['Authorization']=getAuth(_0x5e03ce);return getUser(_0x5e03ce,'')['then'](function(_0x5d85af){_0x465818=_0x5d85af;logger['info'](_0xe546('0x44'),_0x465818['id']);return getEndUser(_0x5e03ce,_0x2180f6[_0xe546('0xc')],_0x2180f6[_0xe546('0x54')]);})[_0xe546('0x18')](function(_0x9e9bf6){_0x12564d=_0x9e9bf6;logger[_0xe546('0x8')](_0xe546('0x45'),_0x12564d['id']);return getTicket(_0x5e03ce,_0x465818,_0x12564d,_0x24961c,_0x2180f6);})[_0xe546('0x18')](function(_0x214b07){if(_0x214b07){logger['info'](_0xe546('0x15'));logger['info'](_0xe546('0x46'),_0x214b07['id']);}})[_0xe546('0x49')](function(_0x5aca4b){logger['error']('['+_0x2180f6['lastevent'][_0xe546('0x55')]()+']',JSON[_0xe546('0x29')](_0x5aca4b));});}; \ No newline at end of file +var _0xc18f=['serverUrl','monitor_format','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','outbound','recordingFormat','none','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','unmanaged','lastevent','toUpperCase','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','value','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','debug','[HTTP]','stringify','GET','map','forEach','string','type','customField','nameField','toLowerCase','content','toString','includes','picklist','idField','push','variable','variableName','Variable','queue','stripTrailingSlash'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0xc18f,0x130));var _0xfc18=function(_0x490f9b,_0x439804){_0x490f9b=_0x490f9b-0x0;var _0x30eff0=_0xc18f[_0x490f9b];return _0x30eff0;};'use strict';var _=require('lodash');var rp=require(_0xfc18('0x0'));var md5=require(_0xfc18('0x1'));var util=require(_0xfc18('0x2'));var Redis=require(_0xfc18('0x3'));var intUtil=require('./util');var config=require(_0xfc18('0x4'));var logger=require('../../../../config/logger')(_0xfc18('0x5'));config[_0xfc18('0x6')]=_[_0xfc18('0x7')](config[_0xfc18('0x6')],{'host':_0xfc18('0x8'),'port':0x18eb});var io=require(_0xfc18('0x9'))(new Redis(config[_0xfc18('0x6')]));var headers={'Content-Type':_0xfc18('0xa'),'Accept':_0xfc18('0xa')};function emit(_0x4feaa0,_0x1cb86a,_0x45caf4){io['to'](_0x4feaa0)[_0xfc18('0xb')](_0x1cb86a,_0x45caf4);}function getTicket(_0x55c4da,_0x5520bc,_0x493d06,_0x14ce13,_0x47583c){logger[_0xfc18('0xc')](_0xfc18('0xd'));var _0x199c3d=_[_0xfc18('0xe')]({'responder_id':_0x5520bc['id'],'requester_id':_0x493d06['id'],'name':util[_0xfc18('0xf')](_0xfc18('0x10'),_0x47583c[_0xfc18('0x11')]),'phone':_0x47583c[_0xfc18('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xfc18('0x13')](_0x14ce13[_0xfc18('0x14')],_0x47583c,'\x20'),'description':intUtil[_0xfc18('0x13')](_0x14ce13[_0xfc18('0x15')],_0x47583c,'
'),'tags':getTags(_0x14ce13[_0xfc18('0x16')],_0xfc18('0x17'))},getCustomFields(_0x14ce13[_0xfc18('0x18')],_0x47583c));_0x199c3d[_0xfc18('0x19')]=_['mapValues'](_['keyBy'](_0x199c3d['custom_fields'],'id'),_0xfc18('0x1a'));return request({'uri':util[_0xfc18('0xf')]('%s/api/v2/tickets',_0x55c4da[_0xfc18('0x1b')]),'method':'POST','body':_0x199c3d})[_0xfc18('0x1c')](function(_0x39e706){logger[_0xfc18('0xc')](_0xfc18('0x1d'));return _0x39e706;});}function getUser(_0x222caf,_0x6543a0){if(intUtil[_0xfc18('0x1e')](_0x6543a0)){return request({'uri':util[_0xfc18('0xf')](_0xfc18('0x1f'),_0x222caf[_0xfc18('0x1b')]),'qs':{'email':_0x6543a0}})[_0xfc18('0x1c')](function(_0x11134f){if(_0x11134f[_0xfc18('0x20')]){logger[_0xfc18('0xc')](_0xfc18('0x21'));return _[_0xfc18('0x22')](_0x11134f,function(_0x2cc91c){return _0x2cc91c[_0xfc18('0x23')][_0xfc18('0x24')]===_0x6543a0;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfc18('0xf')](_0xfc18('0x25'),_0x222caf[_0xfc18('0x1b')])})['then'](function(_0x21b5f6){logger['info'](_0xfc18('0x26'));return _0x21b5f6;});}});}else{logger[_0xfc18('0xc')](_0xfc18('0x27'));return request({'uri':util[_0xfc18('0xf')](_0xfc18('0x25'),_0x222caf[_0xfc18('0x1b')])})['then'](function(_0x1f8443){logger['info'](_0xfc18('0x26'));return _0x1f8443;});}}function getEndUser(_0x191770,_0x4fb6c5,_0x774cf7){logger['info'](_0xfc18('0x28'),_0x774cf7);return request({'uri':util[_0xfc18('0xf')](_0xfc18('0x29'),_0x191770[_0xfc18('0x1b')]),'qs':{'phone':_0x774cf7}})[_0xfc18('0x1c')](function(_0x19cd12){if(_0x19cd12[_0xfc18('0x20')]){logger['info'](_0xfc18('0x2a'));return _[_0xfc18('0x22')](_0x19cd12,{'phone':_0x774cf7});}else{logger['info'](_0xfc18('0x2b'));return request({'uri':util['format'](_0xfc18('0x29'),_0x191770[_0xfc18('0x1b')]),'method':'POST','body':{'name':_0x4fb6c5,'phone':_0x774cf7}})[_0xfc18('0x1c')](function(_0x243d1e){logger['info']('Enduser\x20created.');return _0x243d1e;});}});}function getAuth(_0x11aa3a){return util[_0xfc18('0xf')](_0xfc18('0x2c'),new Buffer(_0x11aa3a[_0xfc18('0x2d')]+':X')['toString']('base64'));}function request(_0x1f2ca9){logger[_0xfc18('0x2e')](_0xfc18('0x2f'),JSON[_0xfc18('0x30')](_0x1f2ca9));return rp(_['defaults'](_0x1f2ca9,{'method':_0xfc18('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x28d73a,_0xfa6d64){var _0x371910=[];if(_0x28d73a&&_0x28d73a[_0xfc18('0x20')]>0x0){_0x371910=_[_0xfc18('0x32')](_0x28d73a,_0xfa6d64);}return _0x371910;}function getCustomFields(_0x40d07e,_0x15787c){var _0x12c598=[];var _0x47d707={'custom_fields':[]};if(_0x40d07e[_0xfc18('0x20')]>0x0){_[_0xfc18('0x33')](_0x40d07e,function(_0x4a55ff){if(_['includes']([_0xfc18('0x34'),'picklist'],_0x4a55ff[_0xfc18('0x35')])&&_0x4a55ff['nameField']&&!_0x4a55ff[_0xfc18('0x36')]){_0x47d707[_0x4a55ff[_0xfc18('0x37')][_0xfc18('0x38')]()]=_0x4a55ff[_0xfc18('0x39')][_0xfc18('0x3a')]();}else if(_[_0xfc18('0x3b')]([_0xfc18('0x34'),_0xfc18('0x3c')],_0x4a55ff[_0xfc18('0x35')])&&_0x4a55ff[_0xfc18('0x3d')]&&_0x4a55ff[_0xfc18('0x36')]){_0x47d707[_0xfc18('0x19')][_0xfc18('0x3e')]({'id':_0x4a55ff[_0xfc18('0x3d')],'value':_0x4a55ff['content'][_0xfc18('0x3a')]()});}else if(_0x4a55ff[_0xfc18('0x35')]===_0xfc18('0x3f')&&_0x4a55ff[_0xfc18('0x40')]&&_0x4a55ff[_0xfc18('0x3d')]&&_0x4a55ff['customField']){_0x15787c[_0x4a55ff[_0xfc18('0x40')]]&&_0x47d707[_0xfc18('0x19')][_0xfc18('0x3e')]({'id':_0x4a55ff[_0xfc18('0x3d')],'value':_0x15787c[_0x4a55ff[_0xfc18('0x40')]][_0xfc18('0x3a')]()});}else if(_0x4a55ff[_0xfc18('0x35')]==='customVariable'&&_0x4a55ff['Variable']&&_0x4a55ff[_0xfc18('0x41')][_0xfc18('0x17')]&&_0x4a55ff['idField']&&_0x4a55ff[_0xfc18('0x36')]){_0x15787c[_0x4a55ff[_0xfc18('0x41')][_0xfc18('0x17')]['toLowerCase']()]&&_0x47d707['custom_fields']['push']({'id':_0x4a55ff[_0xfc18('0x3d')],'value':_0x15787c[_0x4a55ff[_0xfc18('0x41')][_0xfc18('0x17')]['toLowerCase']()]['toString']()});}});}return _0x47d707;}exports[_0xfc18('0x42')]=function(_0x1c440d,_0xdd462e,_0x26999a,_0x2bf45a,_0x1d8f90,_0x15d28a){var _0x5cbd79,_0x3c1acb;_0x15d28a[_0xfc18('0x1b')]=intUtil[_0xfc18('0x43')](_0x15d28a['remoteUri']);_0x15d28a[_0xfc18('0x44')]=intUtil[_0xfc18('0x43')](_0x15d28a[_0xfc18('0x44')]);if(_0x1d8f90&&_0x1d8f90[_0xfc18('0x45')]){logger[_0xfc18('0xc')]('[QUEUE]',_0xfc18('0x46'));_0xdd462e['recordingURL']=util[_0xfc18('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x15d28a[_0xfc18('0x44')],_0xdd462e['uniqueid'],md5(_0xdd462e[_0xfc18('0x47')]));}else{_0xdd462e['recordingURL']='';}headers[_0xfc18('0x48')]=getAuth(_0x15d28a);return getUser(_0x15d28a,_0x2bf45a['email'])[_0xfc18('0x1c')](function(_0x5913c2){_0x5cbd79=_0x5913c2;logger[_0xfc18('0xc')](_0xfc18('0x49'),_0x5cbd79['id']);return getEndUser(_0x15d28a,_0xdd462e[_0xfc18('0x11')],_0xdd462e['calleridnum']);})[_0xfc18('0x1c')](function(_0x520030){_0x3c1acb=_0x520030;logger['info'](_0xfc18('0x4a'),_0x3c1acb['id']);return getTicket(_0x15d28a,_0x5cbd79,_0x3c1acb,_0x26999a,_0xdd462e);})[_0xfc18('0x1c')](function(_0x52e76d){if(_0x52e76d&&_0x52e76d['id']){logger[_0xfc18('0xc')](_0xfc18('0x1d'));logger[_0xfc18('0xc')](_0xfc18('0x4b'),_0x52e76d['id']);logger[_0xfc18('0xc')](_0xfc18('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfc18('0xf')](_0xfc18('0x4d'),_0x2bf45a[_0xfc18('0x17')]),_0xfc18('0x4e'),{'uri':util[_0xfc18('0xf')](_0xfc18('0x4f'),_0x15d28a['remoteUri'],_0x52e76d['id'])});}})['catch'](function(_0x32a8dd){logger['error'](_0xfc18('0x4c'),JSON[_0xfc18('0x30')](_0x32a8dd));});};exports[_0xfc18('0x50')]=function(_0x112860,_0x5efd15,_0x5a8ed0,_0x2fdeb9,_0x36e3b,_0x470042,_0xb9158a){var _0x5b5f41,_0x37eca1;_0x470042[_0xfc18('0x1b')]=intUtil[_0xfc18('0x43')](_0x470042[_0xfc18('0x1b')]);_0x470042[_0xfc18('0x44')]=intUtil[_0xfc18('0x43')](_0x470042['serverUrl']);if(_0xb9158a&&_0xb9158a[_0xfc18('0x51')]&&_0xb9158a[_0xfc18('0x51')]!==_0xfc18('0x52')){logger[_0xfc18('0xc')]('[OUTBOUND]',_0xfc18('0x46'));_0x5efd15[_0xfc18('0x53')]=util[_0xfc18('0xf')](_0xfc18('0x54'),_0x470042[_0xfc18('0x44')],_0x5efd15[_0xfc18('0x47')],md5(_0x5efd15[_0xfc18('0x47')]));}headers[_0xfc18('0x48')]=getAuth(_0x470042);return getUser(_0x470042,_0x2fdeb9['email'])[_0xfc18('0x1c')](function(_0x5ecdef){_0x5b5f41=_0x5ecdef;logger[_0xfc18('0xc')]('The\x20User\x20ID\x20is:',_0x5b5f41['id']);return getEndUser(_0x470042,_0x5efd15[_0xfc18('0x55')],_0x5efd15['destcalleridnum']);})[_0xfc18('0x1c')](function(_0x406086){_0x37eca1=_0x406086;logger[_0xfc18('0xc')](_0xfc18('0x4a'),_0x37eca1['id']);return getTicket(_0x470042,_0x5b5f41,_0x37eca1,_0x5a8ed0,_0x5efd15);})[_0xfc18('0x1c')](function(_0x2a56e8){if(_0x2a56e8&&_0x2a56e8['id']){logger[_0xfc18('0xc')](_0xfc18('0x1d'));logger[_0xfc18('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2a56e8['id']);logger[_0xfc18('0xc')](_0xfc18('0x56'),_0xfc18('0x57'));emit(util[_0xfc18('0xf')](_0xfc18('0x4d'),_0x2fdeb9[_0xfc18('0x17')]),_0xfc18('0x4e'),{'uri':util[_0xfc18('0xf')](_0xfc18('0x4f'),_0x470042['remoteUri'],_0x2a56e8['id'])});}})[_0xfc18('0x58')](function(_0x2cdde8){logger[_0xfc18('0x59')]('[OUTBOUND]',JSON[_0xfc18('0x30')](_0x2cdde8));});};exports[_0xfc18('0x5a')]=function(_0x571715,_0x723b48,_0x5ae55a,_0x19252d,_0x2464b5,_0x44ec07){var _0x47212f,_0x1dc8d1;_0x44ec07['remoteUri']=intUtil[_0xfc18('0x43')](_0x44ec07[_0xfc18('0x1b')]);_0x44ec07[_0xfc18('0x44')]=intUtil['stripTrailingSlash'](_0x44ec07[_0xfc18('0x44')]);if(_0x2464b5&&_0x2464b5[_0xfc18('0x45')]){logger[_0xfc18('0xc')]('['+_0x723b48[_0xfc18('0x5b')][_0xfc18('0x5c')]()+']','Recording\x20is\x20enabled!');_0x723b48[_0xfc18('0x53')]=util['format'](_0xfc18('0x54'),_0x44ec07['serverUrl'],_0x723b48[_0xfc18('0x47')],md5(_0x723b48[_0xfc18('0x47')]));}else{_0x723b48[_0xfc18('0x53')]='';}headers[_0xfc18('0x48')]=getAuth(_0x44ec07);return getUser(_0x44ec07,'')[_0xfc18('0x1c')](function(_0x2ce7f9){_0x47212f=_0x2ce7f9;logger[_0xfc18('0xc')](_0xfc18('0x49'),_0x47212f['id']);return getEndUser(_0x44ec07,_0x723b48[_0xfc18('0x11')],_0x723b48[_0xfc18('0x12')]);})[_0xfc18('0x1c')](function(_0x50dc0d){_0x1dc8d1=_0x50dc0d;logger['info'](_0xfc18('0x4a'),_0x1dc8d1['id']);return getTicket(_0x44ec07,_0x47212f,_0x1dc8d1,_0x5ae55a,_0x723b48);})[_0xfc18('0x1c')](function(_0x3e8c20){if(_0x3e8c20){logger[_0xfc18('0xc')](_0xfc18('0x1d'));logger[_0xfc18('0xc')](_0xfc18('0x4b'),_0x3e8c20['id']);}})[_0xfc18('0x58')](function(_0x537b10){logger[_0xfc18('0x59')]('['+_0x723b48['lastevent'][_0xfc18('0x5c')]()+']',JSON[_0xfc18('0x30')](_0x537b10));});}; \ 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 b925341..9b8d4d6 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 _0x5a0f=['ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','then','length','email','adminEmail','Admin\x20found:','adminId','Requested\x20Resource\x20not\x20Found','catch','message','GET','headers','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','Admin\x20selected','error','toUpperCase','&f=','find','contacts','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','/api/tasks','getString','Subjects','Descriptions','Contact'];(function(_0x3b8675,_0x371a1a){var _0x29bb8d=function(_0x2671ae){while(--_0x2671ae){_0x3b8675['push'](_0x3b8675['shift']());}};_0x29bb8d(++_0x371a1a);}(_0x5a0f,0xc9));var _0xf5a0=function(_0x18e553,_0x118431){_0x18e553=_0x18e553-0x0;var _0x142f90=_0x5a0f[_0x18e553];return _0x142f90;};'use strict';var _=require(_0xf5a0('0x0'));var rp=require(_0xf5a0('0x1'));var md5=require(_0xf5a0('0x2'));var util=require(_0xf5a0('0x3'));var moment=require('moment');var Promise=require(_0xf5a0('0x4'));var Redis=require(_0xf5a0('0x5'));var intUtil=require(_0xf5a0('0x6'));var config=require(_0xf5a0('0x7'));var logger=require(_0xf5a0('0x8'))(_0xf5a0('0x9'));config[_0xf5a0('0xa')]=_[_0xf5a0('0xb')](config[_0xf5a0('0xa')],{'host':_0xf5a0('0xc'),'port':0x18eb});var io=require(_0xf5a0('0xd'))(new Redis(config['redis']));function getAdminId(_0x2b342f,_0x1e9737,_0x36fc76,_0x106d24){return new Promise(function(_0x19f11b,_0x582a4e){var _0x4fe3d6=![];var _0x528f62={'method':'GET','uri':_0x106d24+_0xf5a0('0xe'),'json':!![]};_0x528f62['headers']=_0x36fc76;logger[_0xf5a0('0xf')](_0xf5a0('0x10'));return rp(_0x528f62)[_0xf5a0('0x11')](function(_0xc76c42){if(_0xc76c42){var _0x179c2d=_0xc76c42['users'];var _0x3e02e3=null;for(_0x3e02e3=0x0;_0x3e02e3<_0x179c2d[_0xf5a0('0x12')];_0x3e02e3++){if(_0x179c2d[_0x3e02e3][_0xf5a0('0x13')]===_0x2b342f[_0xf5a0('0x14')]){_0x2b342f['adminId']=_0x179c2d[_0x3e02e3]['id'];_0x4fe3d6=!![];}}if(_0x4fe3d6){logger[_0xf5a0('0xf')](_0xf5a0('0x15'),_0x2b342f[_0xf5a0('0x16')]);_0x19f11b(_0x2b342f);}else{_0x582a4e({'statusCode':0x194,'message':_0xf5a0('0x17')});}}else{_0x582a4e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf5a0('0x18')](function(_0x38f8d8){logger['error']('['+[_0x1e9737['toUpperCase']()]+']',_0x38f8d8[_0xf5a0('0x19')]);_0x582a4e(_0x38f8d8);});});}function getUser(_0xdda673,_0x264fa5,_0xc4d1dc){return function(_0xa2242b){return new Promise(function(_0xaf3cf8,_0x1a6acf){var _0x5e94fc={'method':_0xf5a0('0x1a'),'uri':_0xc4d1dc+_0xf5a0('0xe'),'json':!![]};_0x5e94fc[_0xf5a0('0x1b')]=_0x264fa5;logger[_0xf5a0('0xf')](_0xf5a0('0x1c'));return rp(_0x5e94fc)[_0xf5a0('0x11')](function(_0x5661d8){if(_0x5661d8){var _0x2b0d31=_0x5661d8[_0xf5a0('0x1d')];var _0x1cc451=![];var _0x5a5fae=null;if(_0xa2242b[_0xf5a0('0x1e')]!==null){logger[_0xf5a0('0xf')](_0xf5a0('0x1f'),_0xa2242b['agentEmail']);_0xa2242b[_0xf5a0('0x20')]=_0xa2242b[_0xf5a0('0x1e')];for(_0x5a5fae=0x0;_0x5a5fae<_0x2b0d31[_0xf5a0('0x12')];_0x5a5fae++){if(_0x2b0d31[_0x5a5fae][_0xf5a0('0x13')]===_0xa2242b[_0xf5a0('0x1e')]){_0x1cc451=!![];_0xa2242b[_0xf5a0('0x21')]=_0x2b0d31[_0x5a5fae]['id'];logger[_0xf5a0('0xf')]('User\x20found:',_0xa2242b[_0xf5a0('0x21')]);}}}if(!_0x1cc451){logger[_0xf5a0('0xf')](_0xf5a0('0x22'));_0xa2242b[_0xf5a0('0x20')]=_0xa2242b[_0xf5a0('0x14')];_0xa2242b['userId']=_0xa2242b[_0xf5a0('0x16')];_0x1cc451=!![];}if(_0x1cc451){_0xaf3cf8(_0xa2242b);}else{_0x1a6acf({'statusCode':0x194,'message':_0xf5a0('0x17')});}}else{_0x1a6acf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xf5a0('0x18')](function(_0x53aaba){logger[_0xf5a0('0x23')]('['+[_0xdda673[_0xf5a0('0x24')]()]+']',_0x53aaba[_0xf5a0('0x19')]);_0x1a6acf(_0x53aaba);});});};}function searchContact(_0x379486,_0x9c21bc,_0x44c711,_0x32ce72){return new Promise(function(_0x122dbe,_0x148eeb){var _0x56750f={'method':_0xf5a0('0x1a'),'headers':_0x9c21bc,'uri':_0x379486+'/api/lookup?q='+_0x32ce72+_0xf5a0('0x25')+_0x44c711+'&entities=contact','json':!![]};rp(_0x56750f)[_0xf5a0('0x11')](function(_0x21ab67){var _0x252482=_[_0xf5a0('0x26')](_0x21ab67[_0xf5a0('0x27')]['contacts'],[_0x44c711,_0x32ce72]);_0x122dbe(_0x252482);})[_0xf5a0('0x18')](function(_0x375832){_0x148eeb(_0x375832);});});}function getEndUser(_0x46571a,_0x1ed32e,_0x3f561f){return function(_0xe0dd84){return new Promise(function(_0x57a87b,_0x14e36a){logger[_0xf5a0('0xf')](util[_0xf5a0('0x28')](_0xf5a0('0x29'),_0xe0dd84[_0xf5a0('0x2a')]));searchContact(_0x3f561f,_0x1ed32e,_0xf5a0('0x2b'),_0xe0dd84[_0xf5a0('0x2a')])[_0xf5a0('0x11')](function(_0x286c37){if(_0x286c37){_0xe0dd84[_0xf5a0('0x2c')]=_0x286c37['id'];logger[_0xf5a0('0xf')](_0xf5a0('0x2d'),_0xe0dd84[_0xf5a0('0x2c')]);return _0x57a87b(_0xe0dd84);}searchContact(_0x3f561f,_0x1ed32e,_0xf5a0('0x2e'),_0xe0dd84[_0xf5a0('0x2a')])[_0xf5a0('0x11')](function(_0x250a91){if(_0x250a91){_0xe0dd84[_0xf5a0('0x2c')]=_0x250a91['id'];logger[_0xf5a0('0xf')](_0xf5a0('0x2f'),_0xe0dd84[_0xf5a0('0x2c')]);return _0x57a87b(_0xe0dd84);}createEndUser(_0xe0dd84,_0x46571a,_0x1ed32e,_0x3f561f)['then'](function(_0x1dfb81){logger['info'](_0xf5a0('0x30'),_0x1dfb81[_0xf5a0('0x2c')]);return _0x57a87b(_0x1dfb81);});});})[_0xf5a0('0x18')](function(_0x189934){_0x14e36a(_0x189934);});});};}function createEndUser(_0x3ab054,_0x1eb01c,_0x578ba6,_0x1d53ad){return new Promise(function(_0x3683db,_0x5c8989){var _0x16b678=moment();var _0x38c9e3={'method':_0xf5a0('0x31'),'uri':_0x1d53ad+_0xf5a0('0x32'),'body':{'contact':{'last_name':_0x3ab054['contactNumber'],'work_number':_0x3ab054[_0xf5a0('0x2a')],'mobile_number':_0x3ab054[_0xf5a0('0x2a')],'owner_id':_0x3ab054[_0xf5a0('0x21')],'created_at':_0x16b678[_0xf5a0('0x28')](_0xf5a0('0x33'))}},'json':!![]};_0x38c9e3['headers']=_0x578ba6;logger[_0xf5a0('0xf')](_0xf5a0('0x34'));return rp(_0x38c9e3)[_0xf5a0('0x11')](function(_0x855e4c){_0x3ab054[_0xf5a0('0x2c')]=_0x855e4c[_0xf5a0('0x35')]['id'];_0x3683db(_0x3ab054);})['catch'](function(_0x5ac62c){logger[_0xf5a0('0x23')]('['+[_0x1eb01c[_0xf5a0('0x24')]()]+']',_0x5ac62c['message']);_0x5c8989(_0x5ac62c[_0xf5a0('0x19')]);});});}function getTicket(_0x21c2ca,_0x3757dd,_0x19a569,_0x134c38,_0x31e973){return function(_0x5c3345){logger[_0xf5a0('0xf')](_0xf5a0('0x36'));return new Promise(function(_0x422265,_0xee8d8){var _0x175dd9=moment();var _0x2b3c6d={'method':'POST','uri':_0x19a569+_0xf5a0('0x37'),'body':{'title':intUtil[_0xf5a0('0x38')](_0x134c38[_0xf5a0('0x39')],_0x31e973,'\x20'),'description':intUtil['getString'](_0x134c38[_0xf5a0('0x3a')],_0x31e973,'\x0a'),'owner_id':_0x5c3345['userId'],'creater_id':_0x5c3345[_0xf5a0('0x16')],'targetable_id':_0x5c3345[_0xf5a0('0x2c')],'targetable_type':_0xf5a0('0x3b'),'created_at':_0x175dd9['format'](_0xf5a0('0x33')),'due_date':_0x175dd9['add'](0x1e,'m')[_0xf5a0('0x28')](_0xf5a0('0x33'))},'json':!![]};_0x2b3c6d[_0xf5a0('0x1b')]=_0x3757dd;return rp(_0x2b3c6d)[_0xf5a0('0x11')](function(_0x2a8964){_0x5c3345[_0xf5a0('0x3c')]=_0x2a8964[_0xf5a0('0x3d')]['id'];logger[_0xf5a0('0xf')](_0xf5a0('0x3e'),_0x5c3345['ticketId']);_0x422265(_0x5c3345);})[_0xf5a0('0x18')](function(_0x32278f){logger['error']('['+[_0x21c2ca[_0xf5a0('0x24')]()]+']',_0x32278f[_0xf5a0('0x19')]);_0xee8d8(_0x32278f[_0xf5a0('0x19')]);});});};}function emit(_0x24996a,_0x1492b4,_0x9df87a){var _0x793dee={'uri':_0x24996a+'/contacts/'+_0x9df87a};io['to'](util[_0xf5a0('0x28')]('user:%s',_0x1492b4))[_0xf5a0('0x3f')](_0xf5a0('0x40'),_0x793dee);}exports['cs']=function(_0x508925,_0x5e9f81,_0x33a810,_0x30891b,_0x974ee1,_0x17351a,_0x53f466,_0x207e44){var _0x541246={};var _0x10c35a={'Authorization':_0xf5a0('0x41')+_0x17351a[_0xf5a0('0x42')]};_0x17351a[_0xf5a0('0x43')]=intUtil['stripTrailingSlash'](_0x17351a[_0xf5a0('0x43')]);_0x17351a[_0xf5a0('0x44')]=intUtil[_0xf5a0('0x45')](_0x17351a['serverUrl']);var _0x3161e7=_0x17351a[_0xf5a0('0x43')];_0x541246['adminEmail']=_0x17351a[_0xf5a0('0x46')];_0x541246[_0xf5a0('0x2a')]=_0x207e44[_0xf5a0('0x47')]()==='outbound'?_0x5e9f81[_0xf5a0('0x48')]:_0x5e9f81[_0xf5a0('0x49')];_0x541246[_0xf5a0('0x4a')]=_0x207e44==='queue'||_0x207e44===_0xf5a0('0x4b')?_0xf5a0('0x4c'):_0xf5a0('0x4d');if(_0x30891b){_0x541246['agentEmail']=_0x30891b['email'];}var _0x20aff9=util[_0xf5a0('0x28')](_0xf5a0('0x4e'),_0x17351a[_0xf5a0('0x44')],_0x5e9f81['uniqueid'],md5(_0x5e9f81['uniqueid']));if(_0x974ee1&&_0x974ee1['monitor_format']){logger[_0xf5a0('0xf')]('[QUEUE]',_0xf5a0('0x4f'));_0x5e9f81[_0xf5a0('0x50')]=_0x20aff9;}else if(_0x53f466&&_0x53f466[_0xf5a0('0x51')]&&_0x53f466[_0xf5a0('0x51')]!==_0xf5a0('0x52')){logger[_0xf5a0('0xf')](_0xf5a0('0x53'),_0xf5a0('0x4f'));_0x5e9f81[_0xf5a0('0x50')]=_0x20aff9;}else{_0x5e9f81[_0xf5a0('0x50')]='';}return getAdminId(_0x541246,_0x207e44,_0x10c35a,_0x3161e7)[_0xf5a0('0x11')](getUser(_0x207e44,_0x10c35a,_0x3161e7))[_0xf5a0('0x11')](getEndUser(_0x207e44,_0x10c35a,_0x3161e7))[_0xf5a0('0x11')](getTicket(_0x207e44,_0x10c35a,_0x3161e7,_0x33a810,_0x5e9f81))[_0xf5a0('0x11')](function(_0x7b5554){logger[_0xf5a0('0xf')](util[_0xf5a0('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x7b5554[_0xf5a0('0x3c')]));if(_0x207e44!==_0xf5a0('0x4b')){logger['info']('['+[_0x207e44[_0xf5a0('0x24')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3161e7,_0x30891b[_0xf5a0('0x54')],_0x7b5554[_0xf5a0('0x2c')]);}})['catch'](function(_0x2bb3cc){logger[_0xf5a0('0x23')]('['+[_0x207e44[_0xf5a0('0x24')]()]+_0xf5a0('0x55'),util[_0xf5a0('0x56')](_0x2bb3cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4972=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','toLowerCase','outbound','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','then','users','length','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:'];(function(_0x5eb6fc,_0x159584){var _0x4feda9=function(_0x4daf87){while(--_0x4daf87){_0x5eb6fc['push'](_0x5eb6fc['shift']());}};_0x4feda9(++_0x159584);}(_0x4972,0x129));var _0x2497=function(_0x264e18,_0x127785){_0x264e18=_0x264e18-0x0;var _0x4c42b8=_0x4972[_0x264e18];return _0x4c42b8;};'use strict';var _=require(_0x2497('0x0'));var rp=require(_0x2497('0x1'));var md5=require(_0x2497('0x2'));var util=require(_0x2497('0x3'));var moment=require(_0x2497('0x4'));var Promise=require('bluebird');var Redis=require(_0x2497('0x5'));var intUtil=require('./util');var config=require(_0x2497('0x6'));var logger=require(_0x2497('0x7'))('freshsales');config[_0x2497('0x8')]=_[_0x2497('0x9')](config[_0x2497('0x8')],{'host':_0x2497('0xa'),'port':0x18eb});var io=require(_0x2497('0xb'))(new Redis(config[_0x2497('0x8')]));function getAdminId(_0x1dae46,_0x313879,_0x4d49f3,_0x4e96d4){return new Promise(function(_0x3bb4cb,_0x47d9ae){var _0x414c94=![];var _0x5d1659={'method':_0x2497('0xc'),'uri':_0x4e96d4+_0x2497('0xd'),'json':!![]};_0x5d1659[_0x2497('0xe')]=_0x4d49f3;logger['info']('Getting\x20admin\x20information');return rp(_0x5d1659)[_0x2497('0xf')](function(_0x2e1076){if(_0x2e1076){var _0xf3b05e=_0x2e1076[_0x2497('0x10')];var _0x271777=null;for(_0x271777=0x0;_0x271777<_0xf3b05e[_0x2497('0x11')];_0x271777++){if(_0xf3b05e[_0x271777][_0x2497('0x12')]===_0x1dae46[_0x2497('0x13')]){_0x1dae46['adminId']=_0xf3b05e[_0x271777]['id'];_0x414c94=!![];}}if(_0x414c94){logger['info'](_0x2497('0x14'),_0x1dae46['adminId']);_0x3bb4cb(_0x1dae46);}else{_0x47d9ae({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x47d9ae({'statusCode':0x194,'message':_0x2497('0x15')});}})[_0x2497('0x16')](function(_0x487baa){logger[_0x2497('0x17')]('['+[_0x313879[_0x2497('0x18')]()]+']',_0x487baa[_0x2497('0x19')]);_0x47d9ae(_0x487baa);});});}function getUser(_0x423e1f,_0x35c870,_0x50d712){return function(_0x4c4fa5){return new Promise(function(_0x22bca7,_0x45b768){var _0x29cfce={'method':'GET','uri':_0x50d712+_0x2497('0xd'),'json':!![]};_0x29cfce[_0x2497('0xe')]=_0x35c870;logger[_0x2497('0x1a')](_0x2497('0x1b'));return rp(_0x29cfce)['then'](function(_0x426531){if(_0x426531){var _0x4b2225=_0x426531[_0x2497('0x10')];var _0x48f6b4=![];var _0x1714dd=null;if(_0x4c4fa5[_0x2497('0x1c')]!==null){logger['info'](_0x2497('0x1d'),_0x4c4fa5[_0x2497('0x1c')]);_0x4c4fa5[_0x2497('0x1e')]=_0x4c4fa5['agentEmail'];for(_0x1714dd=0x0;_0x1714dd<_0x4b2225[_0x2497('0x11')];_0x1714dd++){if(_0x4b2225[_0x1714dd][_0x2497('0x12')]===_0x4c4fa5[_0x2497('0x1c')]){_0x48f6b4=!![];_0x4c4fa5[_0x2497('0x1f')]=_0x4b2225[_0x1714dd]['id'];logger['info'](_0x2497('0x20'),_0x4c4fa5[_0x2497('0x1f')]);}}}if(!_0x48f6b4){logger[_0x2497('0x1a')](_0x2497('0x21'));_0x4c4fa5['userEmail']=_0x4c4fa5[_0x2497('0x13')];_0x4c4fa5[_0x2497('0x1f')]=_0x4c4fa5['adminId'];_0x48f6b4=!![];}if(_0x48f6b4){_0x22bca7(_0x4c4fa5);}else{_0x45b768({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x45b768({'statusCode':0x194,'message':_0x2497('0x15')});}})[_0x2497('0x16')](function(_0x4e09ae){logger['error']('['+[_0x423e1f[_0x2497('0x18')]()]+']',_0x4e09ae[_0x2497('0x19')]);_0x45b768(_0x4e09ae);});});};}function searchContact(_0x5f9e79,_0x1d0273,_0x5ede7e,_0xbfd6e3){return new Promise(function(_0x405dbe,_0x9ea989){var _0x5a1855={'method':'GET','headers':_0x1d0273,'uri':_0x5f9e79+_0x2497('0x22')+_0xbfd6e3+_0x2497('0x23')+_0x5ede7e+_0x2497('0x24'),'json':!![]};rp(_0x5a1855)[_0x2497('0xf')](function(_0x345f0e){var _0x2379de=_[_0x2497('0x25')](_0x345f0e[_0x2497('0x26')][_0x2497('0x26')],[_0x5ede7e,_0xbfd6e3]);_0x405dbe(_0x2379de);})[_0x2497('0x16')](function(_0xe13396){_0x9ea989(_0xe13396);});});}function getEndUser(_0x2c6aa4,_0x1e87b1,_0x3f2f52){return function(_0x2c7a2e){return new Promise(function(_0x43da03,_0x41d325){logger['info'](util[_0x2497('0x27')](_0x2497('0x28'),_0x2c7a2e[_0x2497('0x29')]));searchContact(_0x3f2f52,_0x1e87b1,'mobile_number',_0x2c7a2e[_0x2497('0x29')])['then'](function(_0x315883){if(_0x315883){_0x2c7a2e['endUserId']=_0x315883['id'];logger[_0x2497('0x1a')](_0x2497('0x2a'),_0x2c7a2e[_0x2497('0x2b')]);return _0x43da03(_0x2c7a2e);}searchContact(_0x3f2f52,_0x1e87b1,_0x2497('0x2c'),_0x2c7a2e['contactNumber'])[_0x2497('0xf')](function(_0x2be460){if(_0x2be460){_0x2c7a2e[_0x2497('0x2b')]=_0x2be460['id'];logger[_0x2497('0x1a')](_0x2497('0x2d'),_0x2c7a2e[_0x2497('0x2b')]);return _0x43da03(_0x2c7a2e);}createEndUser(_0x2c7a2e,_0x2c6aa4,_0x1e87b1,_0x3f2f52)[_0x2497('0xf')](function(_0x11d815){logger[_0x2497('0x1a')](_0x2497('0x2e'),_0x11d815[_0x2497('0x2b')]);return _0x43da03(_0x11d815);});});})[_0x2497('0x16')](function(_0x307561){_0x41d325(_0x307561);});});};}function createEndUser(_0x3dc656,_0x177c1c,_0x214046,_0x4649d6){return new Promise(function(_0x1656e7,_0x9e85a5){var _0x1ce95e=moment();var _0x23c1eb={'method':_0x2497('0x2f'),'uri':_0x4649d6+_0x2497('0x30'),'body':{'contact':{'last_name':_0x3dc656[_0x2497('0x29')],'work_number':_0x3dc656['contactNumber'],'mobile_number':_0x3dc656[_0x2497('0x29')],'owner_id':_0x3dc656['userId'],'created_at':_0x1ce95e[_0x2497('0x27')](_0x2497('0x31'))}},'json':!![]};_0x23c1eb['headers']=_0x214046;logger['info'](_0x2497('0x32'));return rp(_0x23c1eb)['then'](function(_0x1fa4de){_0x3dc656[_0x2497('0x2b')]=_0x1fa4de['contact']['id'];_0x1656e7(_0x3dc656);})['catch'](function(_0x3874df){logger[_0x2497('0x17')]('['+[_0x177c1c['toUpperCase']()]+']',_0x3874df[_0x2497('0x19')]);_0x9e85a5(_0x3874df[_0x2497('0x19')]);});});}function getTicket(_0x564770,_0x153227,_0x57e4e0,_0x567ff1,_0x37c9ca){return function(_0x30fadb){logger[_0x2497('0x1a')](_0x2497('0x33'));return new Promise(function(_0x147ce4,_0xa040a){var _0xe2c9f5=moment();var _0x262e77={'method':_0x2497('0x2f'),'uri':_0x57e4e0+_0x2497('0x34'),'body':{'title':intUtil[_0x2497('0x35')](_0x567ff1[_0x2497('0x36')],_0x37c9ca,'\x20'),'description':intUtil[_0x2497('0x35')](_0x567ff1[_0x2497('0x37')],_0x37c9ca,'\x0a'),'owner_id':_0x30fadb[_0x2497('0x1f')],'creater_id':_0x30fadb['adminId'],'targetable_id':_0x30fadb[_0x2497('0x2b')],'targetable_type':'Contact','created_at':_0xe2c9f5[_0x2497('0x27')](_0x2497('0x31')),'due_date':_0xe2c9f5[_0x2497('0x38')](0x1e,'m')['format'](_0x2497('0x31'))},'json':!![]};_0x262e77[_0x2497('0xe')]=_0x153227;return rp(_0x262e77)[_0x2497('0xf')](function(_0x10cd1c){_0x30fadb[_0x2497('0x39')]=_0x10cd1c[_0x2497('0x3a')]['id'];logger['info'](_0x2497('0x3b'),_0x30fadb[_0x2497('0x39')]);_0x147ce4(_0x30fadb);})[_0x2497('0x16')](function(_0xe63f8f){logger[_0x2497('0x17')]('['+[_0x564770[_0x2497('0x18')]()]+']',_0xe63f8f[_0x2497('0x19')]);_0xa040a(_0xe63f8f[_0x2497('0x19')]);});});};}function emit(_0xb36f61,_0x463a07,_0xb05307){var _0x51811f={'uri':_0xb36f61+'/contacts/'+_0xb05307};io['to'](util['format'](_0x2497('0x3c'),_0x463a07))[_0x2497('0x3d')](_0x2497('0x3e'),_0x51811f);}exports['cs']=function(_0x52511f,_0x5b053b,_0x1f04c4,_0x1a116d,_0x143845,_0x3dfaf1,_0x3e69b6,_0x5b90ae){var _0xe715f2={};var _0x1d2e2b={'Authorization':_0x2497('0x3f')+_0x3dfaf1[_0x2497('0x40')]};_0x3dfaf1['remoteUri']=intUtil[_0x2497('0x41')](_0x3dfaf1['remoteUri']);_0x3dfaf1[_0x2497('0x42')]=intUtil[_0x2497('0x41')](_0x3dfaf1['serverUrl']);var _0x54e9de=_0x3dfaf1[_0x2497('0x43')];_0xe715f2[_0x2497('0x13')]=_0x3dfaf1['username'];_0xe715f2['contactNumber']=_0x5b90ae[_0x2497('0x44')]()===_0x2497('0x45')?_0x5b053b[_0x2497('0x46')]:_0x5b053b['calleridnum'];_0xe715f2[_0x2497('0x47')]=_0x5b90ae===_0x2497('0x48')||_0x5b90ae===_0x2497('0x49')?_0x2497('0x48'):_0x2497('0x45');if(_0x1a116d){_0xe715f2[_0x2497('0x1c')]=_0x1a116d[_0x2497('0x12')];}var _0x4f9239=util[_0x2497('0x27')](_0x2497('0x4a'),_0x3dfaf1[_0x2497('0x42')],_0x5b053b['uniqueid'],md5(_0x5b053b[_0x2497('0x4b')]));if(_0x143845&&_0x143845[_0x2497('0x4c')]){logger[_0x2497('0x1a')](_0x2497('0x4d'),'Recording\x20is\x20enabled!');_0x5b053b[_0x2497('0x4e')]=_0x4f9239;}else if(_0x3e69b6&&_0x3e69b6[_0x2497('0x4f')]&&_0x3e69b6[_0x2497('0x4f')]!==_0x2497('0x50')){logger['info'](_0x2497('0x51'),'Recording\x20is\x20enabled!');_0x5b053b[_0x2497('0x4e')]=_0x4f9239;}else{_0x5b053b[_0x2497('0x4e')]='';}return getAdminId(_0xe715f2,_0x5b90ae,_0x1d2e2b,_0x54e9de)[_0x2497('0xf')](getUser(_0x5b90ae,_0x1d2e2b,_0x54e9de))[_0x2497('0xf')](getEndUser(_0x5b90ae,_0x1d2e2b,_0x54e9de))[_0x2497('0xf')](getTicket(_0x5b90ae,_0x1d2e2b,_0x54e9de,_0x1f04c4,_0x5b053b))[_0x2497('0xf')](function(_0x27b9a8){logger[_0x2497('0x1a')](util[_0x2497('0x27')]('The\x20ticket\x20ID\x20is:\x20%s',_0x27b9a8[_0x2497('0x39')]));if(_0x5b90ae!==_0x2497('0x49')){logger[_0x2497('0x1a')]('['+[_0x5b90ae['toUpperCase']()]+']',_0x2497('0x52'));emit(_0x54e9de,_0x1a116d[_0x2497('0x53')],_0x27b9a8['endUserId']);}})[_0x2497('0x16')](function(_0x2f5a37){logger[_0x2497('0x17')]('['+[_0x5b90ae[_0x2497('0x18')]()]+_0x2497('0x54'),util[_0x2497('0x55')](_0x2f5a37,{'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 3c270ad..b6ee708 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 _0x5257=['desk','vtiger','freshsales','servicenow','dynamics365','log','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk','exec','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','zoho'];(function(_0x37d7a4,_0x17cf93){var _0xbec816=function(_0x23f06a){while(--_0x23f06a){_0x37d7a4['push'](_0x37d7a4['shift']());}};_0xbec816(++_0x17cf93);}(_0x5257,0x116));var _0x7525=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x5257[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x7525('0x0'));var util=require(_0x7525('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x7525('0x2'));var freshdesk=require(_0x7525('0x3'));var zoho=require(_0x7525('0x4'));var desk=require(_0x7525('0x5'));var vtiger=require(_0x7525('0x6'));var servicenow=require(_0x7525('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x7525('0x8'));var integrations=[_0x7525('0x9'),'salesforce',_0x7525('0xa'),_0x7525('0xb'),'zoho','desk','vtiger','dynamics365','freshsales','servicenow'];exports[_0x7525('0xc')]=function(_0x2eab8b,_0x43f31b,_0x3a5231,_0x5f15f8,_0x7c9e7e,_0x5a182e){if(_0x3a5231){if(_['includes'](integrations,_0x2eab8b[_0x7525('0xd')]['toLowerCase']())){try{var _0x15afa6=null;var _0x47b717='';var _0x40161e=_0x3a5231[_0x2eab8b['data1'][_0x7525('0xe')]()];if(_0x40161e){var _0x243e86=_0x40161e[_0x2eab8b[_0x7525('0xf')]];if(_0x243e86){var _0x25685f=_[_0x7525('0x10')](_0x243e86[_0x7525('0x11')],{'id':parseInt(_0x2eab8b[_0x7525('0x12')],0xa)});if(_0x25685f){if(_0x5f15f8){if(_0x7c9e7e&&_0x43f31b['queue']){_0x47b717=_0x7525('0x13');}else if(_0x43f31b[_0x7525('0x14')]){_0x47b717=_0x7525('0x15');}else{console['log'](_0x7525('0x16'),_0x43f31b);}}else{_0x47b717=_0x7525('0x17');}switch(_0x2eab8b[_0x7525('0xd')][_0x7525('0xe')]()){case _0x7525('0x9'):zendesk[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0x18'):salesforce[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0xa'):sugarcrm[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0xb'):freshdesk[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0x19'):zoho[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0x1a'):desk[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0x1b'):vtiger[_0x47b717](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e);break;case _0x7525('0x1c'):freshsales['cs'](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e,_0x47b717);break;case _0x7525('0x1d'):servicenow['cs'](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e,_0x47b717);break;case _0x7525('0x1e'):dynamics365['cs'](_0x2eab8b,_0x43f31b,_0x25685f,_0x5f15f8,_0x7c9e7e,_0x243e86,_0x5a182e,_0x47b717);break;default:console[_0x7525('0x1f')]('unknown\x20integration');}}else{_0x15afa6=require(_0x7525('0x20'))(_0x2eab8b[_0x7525('0xd')][_0x7525('0xe')]());_0x15afa6[_0x7525('0x21')](_0x7525('0x22'),util['format'](_0x7525('0x23'),_0x2eab8b[_0x7525('0xd')][_0x7525('0xe')](),_0x2eab8b['data3']));}}else{_0x15afa6=require(_0x7525('0x20'))(_0x2eab8b[_0x7525('0xd')][_0x7525('0xe')]());_0x15afa6[_0x7525('0x21')](_0x7525('0x22'),util[_0x7525('0x24')](_0x7525('0x25'),_0x2eab8b[_0x7525('0xd')][_0x7525('0xe')](),_0x2eab8b['data2']));}}else{}}catch(_0x456c98){console[_0x7525('0x21')](_0x456c98);}}}}; \ No newline at end of file +var _0x4705=['toLowerCase','data2','find','data3','queue','routeId','outbound','log','unmanaged','salesforce','freshsales','data1','error','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','includes'];(function(_0x42b105,_0x5b29d9){var _0x26ca0a=function(_0x5c053b){while(--_0x5c053b){_0x42b105['push'](_0x42b105['shift']());}};_0x26ca0a(++_0x5b29d9);}(_0x4705,0x83));var _0x5470=function(_0x3e296f,_0x3f783a){_0x3e296f=_0x3e296f-0x0;var _0x2b4660=_0x4705[_0x3e296f];return _0x2b4660;};'use strict';var _=require(_0x5470('0x0'));var util=require(_0x5470('0x1'));var zendesk=require(_0x5470('0x2'));var salesforce=require(_0x5470('0x3'));var sugarcrm=require(_0x5470('0x4'));var freshdesk=require(_0x5470('0x5'));var zoho=require(_0x5470('0x6'));var desk=require(_0x5470('0x7'));var vtiger=require('./vtiger');var servicenow=require(_0x5470('0x8'));var dynamics365=require(_0x5470('0x9'));var freshsales=require(_0x5470('0xa'));var integrations=[_0x5470('0xb'),'salesforce',_0x5470('0xc'),_0x5470('0xd'),_0x5470('0xe'),_0x5470('0xf'),_0x5470('0x10'),_0x5470('0x11'),'freshsales',_0x5470('0x12')];exports[_0x5470('0x13')]=function(_0x1b91e1,_0x39db9c,_0xbb7c82,_0x38d1e4,_0x1f1f45,_0x15e951){if(_0xbb7c82){if(_[_0x5470('0x14')](integrations,_0x1b91e1['data1'][_0x5470('0x15')]())){try{var _0x19f190=null;var _0x28992b='';var _0x3bbc8e=_0xbb7c82[_0x1b91e1['data1'][_0x5470('0x15')]()];if(_0x3bbc8e){var _0x366f7d=_0x3bbc8e[_0x1b91e1[_0x5470('0x16')]];if(_0x366f7d){var _0x55d908=_[_0x5470('0x17')](_0x366f7d['Configurations'],{'id':parseInt(_0x1b91e1[_0x5470('0x18')],0xa)});if(_0x55d908){if(_0x38d1e4){if(_0x1f1f45&&_0x39db9c[_0x5470('0x19')]){_0x28992b='queue';}else if(_0x39db9c[_0x5470('0x1a')]){_0x28992b=_0x5470('0x1b');}else{console[_0x5470('0x1c')]('EVENT\x20UNKNOWN',_0x39db9c);}}else{_0x28992b=_0x5470('0x1d');}switch(_0x1b91e1['data1'][_0x5470('0x15')]()){case _0x5470('0xb'):zendesk[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0x1e'):salesforce[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0xc'):sugarcrm[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0xd'):freshdesk[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case'zoho':zoho[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0xf'):desk[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0x10'):vtiger[_0x28992b](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951);break;case _0x5470('0x1f'):freshsales['cs'](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951,_0x28992b);break;case _0x5470('0x12'):servicenow['cs'](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951,_0x28992b);break;case _0x5470('0x11'):dynamics365['cs'](_0x1b91e1,_0x39db9c,_0x55d908,_0x38d1e4,_0x1f1f45,_0x366f7d,_0x15e951,_0x28992b);break;default:console[_0x5470('0x1c')]('unknown\x20integration');}}else{_0x19f190=require('../../../../config/logger')(_0x1b91e1[_0x5470('0x20')][_0x5470('0x15')]());_0x19f190[_0x5470('0x21')]('[EXEC]',util[_0x5470('0x22')](_0x5470('0x23'),_0x1b91e1[_0x5470('0x20')]['toLowerCase'](),_0x1b91e1[_0x5470('0x18')]));}}else{_0x19f190=require(_0x5470('0x24'))(_0x1b91e1['data1'][_0x5470('0x15')]());_0x19f190[_0x5470('0x21')]('[EXEC]',util[_0x5470('0x22')](_0x5470('0x25'),_0x1b91e1['data1'][_0x5470('0x15')](),_0x1b91e1['data2']));}}else{}}catch(_0x5c5e53){console[_0x5470('0x21')](_0x5c5e53);}}}}; \ 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 85c33be..4dcc2aa 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 _0x36cb=['uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','Recording\x20is\x20enabled!','isNil','lastevent',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsRecurrence','endUserType','contact','WhoId','WhatId','Case','ContactId','account','AccountId','lead','leadId','info','sobject','create','validateEmail','User','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','first','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Company','No\x20Company','upperFirst','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','Connection','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x558356,_0x952831){var _0x539de7=function(_0x2c6f5b){while(--_0x2c6f5b){_0x558356['push'](_0x558356['shift']());}};_0x539de7(++_0x952831);}(_0x36cb,0x9e));var _0xb36c=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x36cb[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xb36c('0x0'));var rp=require(_0xb36c('0x1'));var moment=require(_0xb36c('0x2'));var BPromise=require('bluebird');var md5=require(_0xb36c('0x3'));var jsforce=require(_0xb36c('0x4'));var util=require('util');var Redis=require(_0xb36c('0x5'));var intUtil=require(_0xb36c('0x6'));var config=require(_0xb36c('0x7'));var logger=require(_0xb36c('0x8'))('salesforce');config[_0xb36c('0x9')]=_[_0xb36c('0xa')](config[_0xb36c('0x9')],{'host':_0xb36c('0xb'),'port':0x18eb});var io=require(_0xb36c('0xc'))(new Redis(config[_0xb36c('0x9')]));function emit(_0x3c5b61,_0xe5cdae,_0x297f51){io['to'](_0x3c5b61)[_0xb36c('0xd')](_0xe5cdae,_0x297f51);}function getTicket(_0x578cfd,_0x227cfe,_0x3fef0b,_0xd2819b,_0x1e00bd,_0x3184fc,_0x2f0278,_0x4441ff){var _0x101381=Object[_0xb36c('0xe')]({},{'OwnerId':_0x227cfe['id'],'Subject':intUtil[_0xb36c('0xf')](_0xd2819b[_0xb36c('0x10')],_0x1e00bd,'\x20'),'Description':intUtil[_0xb36c('0xf')](_0xd2819b[_0xb36c('0x11')],_0x1e00bd,'\x0a')},getCustomFields(_0x3184fc,_0x1e00bd));if(_0x3fef0b){if(_0xd2819b[_0xb36c('0x12')]===_0xb36c('0x13')){_0x101381['ActivityDate']=moment[_0xb36c('0x14')]();_0x101381['IsReminderSet']=![];_0x101381[_0xb36c('0x15')]=![];if(_0x3fef0b[_0xb36c('0x16')]===_0xb36c('0x17')||_0x3fef0b[_0xb36c('0x16')]==='lead'){_0x101381[_0xb36c('0x18')]=_0x3fef0b['id'];}else if(_0x3fef0b[_0xb36c('0x16')]==='account'){_0x101381[_0xb36c('0x19')]=_0x3fef0b['id'];}}else if(_0xd2819b[_0xb36c('0x12')]===_0xb36c('0x1a')){if(_0x3fef0b[_0xb36c('0x16')]===_0xb36c('0x17')){_0x101381[_0xb36c('0x1b')]=_0x3fef0b['id'];}else if(_0x3fef0b[_0xb36c('0x16')]===_0xb36c('0x1c')){_0x101381[_0xb36c('0x1d')]=_0x3fef0b['id'];}else if(_0x3fef0b[_0xb36c('0x16')]===_0xb36c('0x1e')&&_0xd2819b['leadId']){_0x101381[_0xd2819b[_0xb36c('0x1f')]]=_0x3fef0b['id'];}else{logger[_0xb36c('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x2f0278[_0xb36c('0x21')](_0xd2819b[_0xb36c('0x12')])[_0xb36c('0x22')](_0x101381);}function getUser(_0x4c9973,_0x26cac5,_0x4ff24a){if(!_['isNil'](_0x26cac5)&&intUtil[_0xb36c('0x23')](_0x26cac5)){var _0x11ed0e={'Email':_0x26cac5};var _0x2cfeb3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4ff24a['sobject'](_0xb36c('0x24'))[_0xb36c('0x25')](_0x11ed0e,_0x2cfeb3)[_0xb36c('0x26')]()[_0xb36c('0x27')](function(_0x2f889f){if(_0x2f889f[_0xb36c('0x28')]){var _0x8fb7b7=_[_0xb36c('0x25')](_0x2f889f,function(_0x5981fe){return _0x5981fe[_0xb36c('0x29')]===_0x26cac5;});if(_0x8fb7b7){logger['info']('Agent\x20%s\x20found.',_0x26cac5);return BPromise[_0xb36c('0x2a')]({'id':_0x8fb7b7['Id'],'name':_0x8fb7b7[_0xb36c('0x2b')]});}}else{logger[_0xb36c('0x20')](_0xb36c('0x2c'),_0x26cac5);return _0x4ff24a[_0xb36c('0x2d')]()[_0xb36c('0x27')](function(_0x4e9dd6){return BPromise['resolve']({'id':_0x4e9dd6[_0xb36c('0x2e')],'name':_0x4e9dd6[_0xb36c('0x2f')]});});}});}else{logger[_0xb36c('0x20')](_0xb36c('0x2c'),_0x26cac5);return _0x4ff24a[_0xb36c('0x2d')]()[_0xb36c('0x27')](function(_0x3fc462){return BPromise[_0xb36c('0x2a')]({'id':_0x3fc462[_0xb36c('0x2e')],'name':_0x3fc462[_0xb36c('0x2f')]});});}}function getEndUser(_0x2f7aa0,_0x58edc4,_0x5acfbc,_0x26bcc2,_0xf68768){var _0x5776eb={'$or':{'Phone':_0x26bcc2}};var _0x29a647={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb36c('0x2a')]()[_0xb36c('0x27')](function(){logger[_0xb36c('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x26bcc2,_0x58edc4[_0xb36c('0x30')]);switch(_0x58edc4[_0xb36c('0x30')]){case _0xb36c('0x31'):var _0x694bab=_[_0xb36c('0x32')](_0x5776eb);if(_0x58edc4[_0xb36c('0x33')]){var _0xa9d764={};_0xa9d764[_0x58edc4[_0xb36c('0x33')]]=_0x26bcc2;_[_0xb36c('0x34')](_0x694bab['$or'],_0xa9d764);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x35'))['find'](_0x694bab,_0x29a647)['execute']()['then'](function(_0x5099da){if(_0x5099da&&_0x5099da[_0xb36c('0x28')]){return _0x5099da;}else{var _0x44fdd1=_[_0xb36c('0x32')](_0x5776eb);if(_0x58edc4['additionalSearchLead']){var _0x245986={};_0x245986[_0x58edc4[_0xb36c('0x36')]]=_0x26bcc2;_[_0xb36c('0x34')](_0x44fdd1[_0xb36c('0x37')],_0x245986);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x38'))[_0xb36c('0x25')](_0x44fdd1,_0x29a647);}});case _0xb36c('0x39'):var _0x3a17d9=_['cloneDeep'](_0x5776eb);if(_0x58edc4[_0xb36c('0x3a')]){var _0xa9d764={};_0xa9d764[_0x58edc4[_0xb36c('0x3a')]]=_0x26bcc2;_[_0xb36c('0x34')](_0x3a17d9[_0xb36c('0x37')],_0xa9d764);}return _0xf68768['sobject']('Account')['find'](_0x3a17d9,_0x29a647)[_0xb36c('0x26')]()[_0xb36c('0x27')](function(_0x396321){if(_0x396321&&_0x396321[_0xb36c('0x28')]){return _0x396321;}else{var _0x4bae49=_['cloneDeep'](_0x5776eb);if(_0x58edc4['additionalSearchContact']){var _0x33fba2={};_0x33fba2[_0x58edc4['additionalSearchContact']]=_0x26bcc2;_[_0xb36c('0x34')](_0x4bae49['$or'],_0x33fba2);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x35'))[_0xb36c('0x25')](_0x4bae49,_0x29a647)[_0xb36c('0x27')](function(_0x3542ff){if(_0x3542ff&&_0x3542ff[_0xb36c('0x28')]){return _0x3542ff;}else{var _0x2a6deb=_[_0xb36c('0x32')](_0x5776eb);if(_0x58edc4[_0xb36c('0x36')]){var _0xb102cb={};_0xb102cb[_0x58edc4[_0xb36c('0x36')]]=_0x26bcc2;_['merge'](_0x2a6deb[_0xb36c('0x37')],_0xb102cb);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x38'))[_0xb36c('0x25')](_0x2a6deb,_0x29a647);}});}});case _0xb36c('0x17'):var _0x694bab=_['cloneDeep'](_0x5776eb);if(_0x58edc4[_0xb36c('0x33')]){var _0xa9d764={};_0xa9d764[_0x58edc4[_0xb36c('0x33')]]=_0x26bcc2;_[_0xb36c('0x34')](_0x694bab[_0xb36c('0x37')],_0xa9d764);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x35'))[_0xb36c('0x25')](_0x694bab,_0x29a647)[_0xb36c('0x26')]();case'lead':var _0x3e2747=_[_0xb36c('0x32')](_0x5776eb);if(_0x58edc4[_0xb36c('0x36')]){var _0xa9d764={};_0xa9d764[_0x58edc4[_0xb36c('0x36')]]=_0x26bcc2;_['merge'](_0x3e2747['$or'],_0xa9d764);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x38'))[_0xb36c('0x25')](_0x3e2747,_0x29a647);case _0xb36c('0x1c'):var _0x3a17d9=_[_0xb36c('0x32')](_0x5776eb);if(_0x58edc4[_0xb36c('0x3a')]){var _0xa9d764={};_0xa9d764[_0x58edc4['additionalSearchAccount']]=_0x26bcc2;_[_0xb36c('0x34')](_0x3a17d9[_0xb36c('0x37')],_0xa9d764);}return _0xf68768[_0xb36c('0x21')](_0xb36c('0x3b'))[_0xb36c('0x25')](_0x3a17d9,_0x29a647);default:return null;}})[_0xb36c('0x27')](function(_0x1b0593){if(_0x1b0593&&_0x1b0593['length']){var _0x4ad022=_[_0xb36c('0x3c')](_0x1b0593);if(_0x4ad022){return BPromise[_0xb36c('0x2a')]({'id':_0x4ad022['Id'],'name':_0x4ad022[_0xb36c('0x2b')],'phone':_0x4ad022['Phone'],'endUserType':_0x4ad022['attributes']['type'][_0xb36c('0x3d')]()});}}})[_0xb36c('0x27')](function(_0x23e40a){if(_0x23e40a){logger[_0xb36c('0x20')](_0xb36c('0x3e'),_0x23e40a[_0xb36c('0x16')],_0x26bcc2);return BPromise[_0xb36c('0x2a')](_0x23e40a);}else{logger[_0xb36c('0x20')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x26bcc2);var _0x29351a={'Phone':_0x26bcc2};if(_0x58edc4[_0xb36c('0x3f')]){if(_0x58edc4[_0xb36c('0x3f')]==='contact'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x26bcc2,_0x58edc4['moduleCreate']);_0x29351a['LastName']=_0x5acfbc!==_0xb36c('0x40')?_0x5acfbc:util['format'](_0xb36c('0x41'),_0x26bcc2);}else if(_0x58edc4[_0xb36c('0x3f')]===_0xb36c('0x1e')){logger['info'](_0xb36c('0x42'),_0x26bcc2,_0x58edc4['moduleCreate']);_0x29351a['LastName']=_0x5acfbc!==_0xb36c('0x40')?_0x5acfbc:util[_0xb36c('0x43')](_0xb36c('0x41'),_0x26bcc2);_0x29351a[_0xb36c('0x44')]=_0xb36c('0x45');}else if(_0x58edc4[_0xb36c('0x3f')]===_0xb36c('0x1c')){logger[_0xb36c('0x20')](_0xb36c('0x42'),_0x26bcc2,_0x58edc4[_0xb36c('0x3f')]);_0x29351a[_0xb36c('0x2b')]=_0x5acfbc!==_0xb36c('0x40')?_0x5acfbc:util['format'](_0xb36c('0x41'),_0x26bcc2);}else{return null;}}return _0xf68768[_0xb36c('0x21')](_[_0xb36c('0x46')](_0x58edc4[_0xb36c('0x3f')]))[_0xb36c('0x22')](_0x29351a)['then'](function(_0x30dd46){return BPromise[_0xb36c('0x2a')]({'id':_0x30dd46['id'],'endUserType':_0x58edc4[_0xb36c('0x3f')]});});}});}function getCustomFields(_0x41cee6,_0xb9384d){var _0x5f94b7={};if(_0x41cee6[_0xb36c('0x28')]>0x0){_[_0xb36c('0x47')](_0x41cee6,function(_0x2f233d){if(_['includes']([_0xb36c('0x48'),_0xb36c('0x49')],_0x2f233d[_0xb36c('0x4a')])&&_0x2f233d[_0xb36c('0x4b')]){_0x5f94b7[_0x2f233d['idField']]=_0x2f233d[_0xb36c('0x4c')][_0xb36c('0x4d')]();}else if(_0x2f233d['type']===_0xb36c('0x4e')&&_0x2f233d[_0xb36c('0x4f')]&&_0x2f233d[_0xb36c('0x4b')]){_0xb9384d[_0x2f233d[_0xb36c('0x4f')]]&&(_0x5f94b7[_0x2f233d['idField']]=_0xb9384d[_0x2f233d[_0xb36c('0x4f')]][_0xb36c('0x4d')]());}else if(_0x2f233d[_0xb36c('0x4a')]===_0xb36c('0x50')&&_0x2f233d[_0xb36c('0x51')]&&_0x2f233d[_0xb36c('0x51')][_0xb36c('0x52')]&&_0x2f233d['idField']){_0xb9384d[_0x2f233d[_0xb36c('0x51')]['name'][_0xb36c('0x3d')]()]&&(_0x5f94b7[_0x2f233d[_0xb36c('0x4b')]]=_0xb9384d[_0x2f233d['Variable'][_0xb36c('0x52')][_0xb36c('0x3d')]()]['toString']());}});}return _0x5f94b7;}function getConnection(_0x8345cc){var _0x201dab=_0x8345cc['password'][_0xb36c('0x53')](_0x8345cc[_0xb36c('0x54')]);var _0x3deb3f=new jsforce[(_0xb36c('0x55'))]({'oauth2':{'loginUrl':_0x8345cc['remoteUri']||_0xb36c('0x56'),'clientId':_0x8345cc[_0xb36c('0x57')],'clientSecret':_0x8345cc['clientSecret']}});return _0x3deb3f[_0xb36c('0x58')](_0x8345cc[_0xb36c('0x59')],_0x201dab)[_0xb36c('0x27')](function(){logger['info'](_0xb36c('0x5a'));return _0x3deb3f;});}exports[_0xb36c('0x5b')]=function(_0x591f81,_0x325a76,_0x3c3c0f,_0x95be34,_0x46d289,_0x322a82){var _0x572b66,_0x35a36d,_0x23dbb8,_0xe98540;_0x322a82[_0xb36c('0x5c')]=intUtil[_0xb36c('0x5d')](_0x322a82[_0xb36c('0x5c')]);_0x322a82[_0xb36c('0x5e')]=intUtil['stripTrailingSlash'](_0x322a82[_0xb36c('0x5e')]);if(_0x46d289&&_0x46d289[_0xb36c('0x5f')]){logger[_0xb36c('0x20')]('[QUEUE]','Recording\x20is\x20enabled!');_0x325a76[_0xb36c('0x60')]=util[_0xb36c('0x43')](_0xb36c('0x61'),_0x322a82[_0xb36c('0x5c')],_0x325a76[_0xb36c('0x62')],md5(_0x325a76[_0xb36c('0x62')]));}else{_0x325a76[_0xb36c('0x60')]='';}return getConnection(_0x322a82)['then'](function(_0x946ada){_0xe98540=_0x946ada;return getUser(_0x322a82,_0x95be34[_0xb36c('0x63')],_0xe98540);})[_0xb36c('0x27')](function(_0xb5f40a){_0x572b66=_0xb5f40a;return getEndUser(_0x322a82,_0x3c3c0f,_0x325a76[_0xb36c('0x64')],_0x325a76[_0xb36c('0x65')],_0xe98540);})[_0xb36c('0x27')](function(_0x2cd4d5){_0x35a36d=_0x2cd4d5;return getTicket(_0x322a82,_0x572b66,_0x35a36d,_0x3c3c0f,_0x325a76,_0x3c3c0f[_0xb36c('0x66')],_0xe98540,_0xb36c('0x5b'));})[_0xb36c('0x27')](function(_0x3163ee){_0x23dbb8=_0x3163ee;logger[_0xb36c('0x20')](_0xb36c('0x67'),_0x23dbb8['id']);logger[_0xb36c('0x20')](_0xb36c('0x68'),_0x23dbb8['id'],_0x95be34[_0xb36c('0x52')],_0x322a82[_0xb36c('0x4a')]);switch(_0x322a82[_0xb36c('0x4a')]){case'integrationTab':emit(util[_0xb36c('0x43')](_0xb36c('0x69'),_0x95be34[_0xb36c('0x52')]),_0xb36c('0x6a'),{'recordId':_0x23dbb8['id']});break;case _0xb36c('0x6b'):emit(util[_0xb36c('0x43')](_0xb36c('0x69'),_0x95be34[_0xb36c('0x52')]),'trigger:browser:url',{'uri':util[_0xb36c('0x43')]('%s/%s/e',_0xe98540[_0xb36c('0x6c')],_0x23dbb8['id'])});break;default:logger[_0xb36c('0x6d')](_0xb36c('0x6e'));}})[_0xb36c('0x6f')](function(_0x11d06e){logger[_0xb36c('0x6d')](_0xb36c('0x70'),_0x11d06e);});};exports[_0xb36c('0x71')]=function(_0xecd5f5,_0x39e584,_0x523847,_0x2418f7,_0x1738f5,_0x139fb5,_0x2e6a33){var _0x4e2ae4,_0x42fdb2,_0x216ce7,_0x2574c6;_0x139fb5[_0xb36c('0x5c')]=intUtil[_0xb36c('0x5d')](_0x139fb5['serverUrl']);_0x139fb5[_0xb36c('0x5e')]=intUtil['stripTrailingSlash'](_0x139fb5[_0xb36c('0x5e')]);if(_0x2e6a33&&_0x2e6a33[_0xb36c('0x72')]&&_0x2e6a33[_0xb36c('0x72')]!=='none'){logger[_0xb36c('0x20')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x39e584[_0xb36c('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x139fb5[_0xb36c('0x5c')],_0x39e584[_0xb36c('0x62')],md5(_0x39e584[_0xb36c('0x62')]));}return getConnection(_0x139fb5)[_0xb36c('0x27')](function(_0x41ae06){_0x2574c6=_0x41ae06;return getUser(_0x139fb5,_0x2418f7[_0xb36c('0x63')],_0x2574c6);})['then'](function(_0x40755b){_0x4e2ae4=_0x40755b;return getEndUser(_0x139fb5,_0x523847,_0x39e584['destcalleridname'],_0x39e584['destcalleridnum'],_0x2574c6);})['then'](function(_0x3daab5){_0x42fdb2=_0x3daab5;return getTicket(_0x139fb5,_0x4e2ae4,_0x42fdb2,_0x523847,_0x39e584,_0x523847['Fields'],_0x2574c6,_0xb36c('0x71'));})[_0xb36c('0x27')](function(_0x327cea){_0x216ce7=_0x327cea;logger[_0xb36c('0x20')](_0xb36c('0x73'),_0x216ce7['id']);logger[_0xb36c('0x20')](_0xb36c('0x74'),_0x216ce7['id'],_0x2418f7[_0xb36c('0x52')],_0x139fb5[_0xb36c('0x4a')]);switch(_0x139fb5['type']){case _0xb36c('0x75'):emit(util[_0xb36c('0x43')]('user:%s',_0x2418f7[_0xb36c('0x52')]),_0xb36c('0x6a'),{'recordId':_0x216ce7['id']});break;case _0xb36c('0x6b'):emit(util['format'](_0xb36c('0x69'),_0x2418f7[_0xb36c('0x52')]),'trigger:browser:url',{'uri':util['format'](_0xb36c('0x76'),_0x2574c6['instanceUrl'],_0x216ce7['id'])});break;default:logger['error'](_0xb36c('0x77'),_0xb36c('0x78'));}})['catch'](function(_0x18cc82){logger['error']('[OUTBOUND]',_0x18cc82);});};exports[_0xb36c('0x79')]=function(_0xc0832a,_0x4d8abe,_0x19f6ea,_0x257f38,_0xeeed4b,_0x51277f){var _0x583beb,_0x37a09a,_0x12c77d,_0x199ee6;_0x51277f['serverUrl']=intUtil[_0xb36c('0x5d')](_0x51277f[_0xb36c('0x5c')]);_0x51277f[_0xb36c('0x5e')]=intUtil[_0xb36c('0x5d')](_0x51277f[_0xb36c('0x5e')]);if(_0xeeed4b&&_0xeeed4b[_0xb36c('0x5f')]){logger['info']('['+_0x4d8abe['lastevent']['toUpperCase']()+']',_0xb36c('0x7a'));_0x4d8abe[_0xb36c('0x60')]=util['format'](_0xb36c('0x61'),_0x51277f[_0xb36c('0x5c')],_0x4d8abe['uniqueid'],md5(_0x4d8abe['uniqueid']));}else{_0x4d8abe['recordingURL']='';}return getConnection(_0x51277f)[_0xb36c('0x27')](function(_0x9104c4){_0x199ee6=_0x9104c4;if(!_[_0xb36c('0x7b')](_0x257f38)){return getUser(_0x51277f,_0x257f38[_0xb36c('0x52')],_0x199ee6);}else{return getUser(_0x51277f,null,_0x199ee6);}})['then'](function(_0x323ef7){_0x583beb=_0x323ef7;return getEndUser(_0x51277f,_0x19f6ea,_0x4d8abe[_0xb36c('0x64')],_0x4d8abe[_0xb36c('0x65')],_0x199ee6);})[_0xb36c('0x27')](function(_0x51df9e){_0x37a09a=_0x51df9e;return getTicket(_0x51277f,_0x583beb,_0x37a09a,_0x19f6ea,_0x4d8abe,_0x19f6ea['Fields'],_0x199ee6);})[_0xb36c('0x27')](function(_0x4a61c7){_0x12c77d=_0x4a61c7;logger[_0xb36c('0x20')]('['+_0x4d8abe[_0xb36c('0x7c')]['toUpperCase']()+_0xb36c('0x7d'),_0x12c77d['id']);logger[_0xb36c('0x20')]('['+_0x4d8abe[_0xb36c('0x7c')][_0xb36c('0x7e')]()+_0xb36c('0x7f'),_0x51277f['type']);})[_0xb36c('0x6f')](function(_0x1069e6){logger[_0xb36c('0x6d')]('['+_0x4d8abe[_0xb36c('0x7c')][_0xb36c('0x7e')]()+']',_0x1069e6);});}; \ No newline at end of file +var _0xe51c=['uniqueid','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','assign','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','$or','Contact','find','cloneDeep','additionalSearchLead','Lead','additionalSearchAccount','Account','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x5a34ae,_0x5682d8){var _0x2841d7=function(_0x2ef934){while(--_0x2ef934){_0x5a34ae['push'](_0x5a34ae['shift']());}};_0x2841d7(++_0x5682d8);}(_0xe51c,0x19e));var _0xce51=function(_0x595151,_0x1f1f72){_0x595151=_0x595151-0x0;var _0x5776df=_0xe51c[_0x595151];return _0x5776df;};'use strict';var _=require(_0xce51('0x0'));var rp=require(_0xce51('0x1'));var moment=require(_0xce51('0x2'));var BPromise=require(_0xce51('0x3'));var md5=require(_0xce51('0x4'));var jsforce=require(_0xce51('0x5'));var util=require(_0xce51('0x6'));var Redis=require(_0xce51('0x7'));var intUtil=require(_0xce51('0x8'));var config=require(_0xce51('0x9'));var logger=require(_0xce51('0xa'))(_0xce51('0xb'));config[_0xce51('0xc')]=_['defaults'](config[_0xce51('0xc')],{'host':_0xce51('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce51('0xc')]));function emit(_0x3fabc2,_0x4f7db5,_0x479a79){io['to'](_0x3fabc2)[_0xce51('0xe')](_0x4f7db5,_0x479a79);}function getTicket(_0x443e94,_0x1069ff,_0x5d0bca,_0x27d365,_0x2ccb00,_0x1805cb,_0x49ef72,_0x3e7199){var _0xdca0fc=Object[_0xce51('0xf')]({},{'OwnerId':_0x1069ff['id'],'Subject':intUtil['getString'](_0x27d365[_0xce51('0x10')],_0x2ccb00,'\x20'),'Description':intUtil[_0xce51('0x11')](_0x27d365[_0xce51('0x12')],_0x2ccb00,'\x0a')},getCustomFields(_0x1805cb,_0x2ccb00));if(_0x5d0bca){if(_0x27d365[_0xce51('0x13')]===_0xce51('0x14')){_0xdca0fc[_0xce51('0x15')]=moment[_0xce51('0x16')]();_0xdca0fc['IsReminderSet']=![];_0xdca0fc[_0xce51('0x17')]=![];if(_0x5d0bca[_0xce51('0x18')]===_0xce51('0x19')||_0x5d0bca[_0xce51('0x18')]===_0xce51('0x1a')){_0xdca0fc['WhoId']=_0x5d0bca['id'];}else if(_0x5d0bca['endUserType']===_0xce51('0x1b')){_0xdca0fc[_0xce51('0x1c')]=_0x5d0bca['id'];}}else if(_0x27d365[_0xce51('0x13')]===_0xce51('0x1d')){if(_0x5d0bca[_0xce51('0x18')]===_0xce51('0x19')){_0xdca0fc['ContactId']=_0x5d0bca['id'];}else if(_0x5d0bca[_0xce51('0x18')]===_0xce51('0x1b')){_0xdca0fc['AccountId']=_0x5d0bca['id'];}else if(_0x5d0bca[_0xce51('0x18')]===_0xce51('0x1a')&&_0x27d365[_0xce51('0x1e')]){_0xdca0fc[_0x27d365[_0xce51('0x1e')]]=_0x5d0bca['id'];}else{logger['info'](_0xce51('0x1f'));}}}return _0x49ef72[_0xce51('0x20')](_0x27d365[_0xce51('0x13')])[_0xce51('0x21')](_0xdca0fc);}function getUser(_0x2f5f90,_0x5f0d0a,_0x4b6055){if(!_[_0xce51('0x22')](_0x5f0d0a)&&intUtil['validateEmail'](_0x5f0d0a)){var _0x2c4857={'Email':_0x5f0d0a};var _0x5ddb53={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4b6055[_0xce51('0x20')](_0xce51('0x23'))['find'](_0x2c4857,_0x5ddb53)[_0xce51('0x24')]()[_0xce51('0x25')](function(_0x8c1c41){if(_0x8c1c41[_0xce51('0x26')]){var _0x1d5c48=_['find'](_0x8c1c41,function(_0x148218){return _0x148218[_0xce51('0x27')]===_0x5f0d0a;});if(_0x1d5c48){logger[_0xce51('0x28')](_0xce51('0x29'),_0x5f0d0a);return BPromise[_0xce51('0x2a')]({'id':_0x1d5c48['Id'],'name':_0x1d5c48[_0xce51('0x2b')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5f0d0a);return _0x4b6055[_0xce51('0x2c')]()['then'](function(_0x55d35f){return BPromise[_0xce51('0x2a')]({'id':_0x55d35f[_0xce51('0x2d')],'name':_0x55d35f['display_name']});});}});}else{logger[_0xce51('0x28')](_0xce51('0x2e'),_0x5f0d0a);return _0x4b6055[_0xce51('0x2c')]()[_0xce51('0x25')](function(_0x4527df){return BPromise[_0xce51('0x2a')]({'id':_0x4527df[_0xce51('0x2d')],'name':_0x4527df[_0xce51('0x2f')]});});}}function getEndUser(_0x1039fb,_0x20185e,_0x2571e0,_0x2747dc,_0x566105){var _0x4325f3={'$or':{'Phone':_0x2747dc}};var _0x32062f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xce51('0x2a')]()['then'](function(){logger[_0xce51('0x28')](_0xce51('0x30'),_0x2747dc,_0x20185e[_0xce51('0x31')]);switch(_0x20185e[_0xce51('0x31')]){case'contact_lead':var _0x3a35fd=_['cloneDeep'](_0x4325f3);if(_0x20185e[_0xce51('0x32')]){var _0x4275fa={};_0x4275fa[_0x20185e[_0xce51('0x32')]]=_0x2747dc;_[_0xce51('0x33')](_0x3a35fd[_0xce51('0x34')],_0x4275fa);}return _0x566105[_0xce51('0x20')](_0xce51('0x35'))[_0xce51('0x36')](_0x3a35fd,_0x32062f)['execute']()[_0xce51('0x25')](function(_0x47bb8a){if(_0x47bb8a&&_0x47bb8a[_0xce51('0x26')]){return _0x47bb8a;}else{var _0x1d8b9c=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e['additionalSearchLead']){var _0x3cac6b={};_0x3cac6b[_0x20185e[_0xce51('0x38')]]=_0x2747dc;_['merge'](_0x1d8b9c['$or'],_0x3cac6b);}return _0x566105['sobject'](_0xce51('0x39'))[_0xce51('0x36')](_0x1d8b9c,_0x32062f);}});case'account_contact_lead':var _0x5957b5=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e[_0xce51('0x3a')]){var _0x4275fa={};_0x4275fa[_0x20185e[_0xce51('0x3a')]]=_0x2747dc;_[_0xce51('0x33')](_0x5957b5[_0xce51('0x34')],_0x4275fa);}return _0x566105[_0xce51('0x20')](_0xce51('0x3b'))[_0xce51('0x36')](_0x5957b5,_0x32062f)[_0xce51('0x24')]()[_0xce51('0x25')](function(_0x1ecff2){if(_0x1ecff2&&_0x1ecff2[_0xce51('0x26')]){return _0x1ecff2;}else{var _0x5118de=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e[_0xce51('0x32')]){var _0x36c561={};_0x36c561[_0x20185e[_0xce51('0x32')]]=_0x2747dc;_[_0xce51('0x33')](_0x5118de[_0xce51('0x34')],_0x36c561);}return _0x566105[_0xce51('0x20')](_0xce51('0x35'))[_0xce51('0x36')](_0x5118de,_0x32062f)['then'](function(_0x1b97c3){if(_0x1b97c3&&_0x1b97c3[_0xce51('0x26')]){return _0x1b97c3;}else{var _0x5b1496=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e[_0xce51('0x38')]){var _0x8847e8={};_0x8847e8[_0x20185e[_0xce51('0x38')]]=_0x2747dc;_[_0xce51('0x33')](_0x5b1496['$or'],_0x8847e8);}return _0x566105[_0xce51('0x20')](_0xce51('0x39'))[_0xce51('0x36')](_0x5b1496,_0x32062f);}});}});case _0xce51('0x19'):var _0x3a35fd=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e[_0xce51('0x32')]){var _0x4275fa={};_0x4275fa[_0x20185e[_0xce51('0x32')]]=_0x2747dc;_[_0xce51('0x33')](_0x3a35fd[_0xce51('0x34')],_0x4275fa);}return _0x566105[_0xce51('0x20')](_0xce51('0x35'))['find'](_0x3a35fd,_0x32062f)[_0xce51('0x24')]();case _0xce51('0x1a'):var _0x8fcb29=_[_0xce51('0x37')](_0x4325f3);if(_0x20185e[_0xce51('0x38')]){var _0x4275fa={};_0x4275fa[_0x20185e[_0xce51('0x38')]]=_0x2747dc;_[_0xce51('0x33')](_0x8fcb29[_0xce51('0x34')],_0x4275fa);}return _0x566105[_0xce51('0x20')](_0xce51('0x39'))['find'](_0x8fcb29,_0x32062f);case _0xce51('0x1b'):var _0x5957b5=_['cloneDeep'](_0x4325f3);if(_0x20185e['additionalSearchAccount']){var _0x4275fa={};_0x4275fa[_0x20185e[_0xce51('0x3a')]]=_0x2747dc;_['merge'](_0x5957b5[_0xce51('0x34')],_0x4275fa);}return _0x566105[_0xce51('0x20')]('Account')[_0xce51('0x36')](_0x5957b5,_0x32062f);default:return null;}})[_0xce51('0x25')](function(_0x283cff){if(_0x283cff&&_0x283cff[_0xce51('0x26')]){var _0x21950d=_['first'](_0x283cff);if(_0x21950d){return BPromise[_0xce51('0x2a')]({'id':_0x21950d['Id'],'name':_0x21950d[_0xce51('0x2b')],'phone':_0x21950d[_0xce51('0x3c')],'endUserType':_0x21950d['attributes'][_0xce51('0x3d')][_0xce51('0x3e')]()});}}})[_0xce51('0x25')](function(_0x14b0c4){if(_0x14b0c4){logger[_0xce51('0x28')](_0xce51('0x3f'),_0x14b0c4[_0xce51('0x18')],_0x2747dc);return BPromise[_0xce51('0x2a')](_0x14b0c4);}else{logger[_0xce51('0x28')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2747dc);var _0x119d9a={'Phone':_0x2747dc};if(_0x20185e[_0xce51('0x40')]){if(_0x20185e[_0xce51('0x40')]===_0xce51('0x19')){logger[_0xce51('0x28')](_0xce51('0x41'),_0x2747dc,_0x20185e[_0xce51('0x40')]);_0x119d9a[_0xce51('0x42')]=_0x2571e0!==''?_0x2571e0:util[_0xce51('0x43')](_0xce51('0x44'),_0x2747dc);}else if(_0x20185e[_0xce51('0x40')]===_0xce51('0x1a')){logger[_0xce51('0x28')](_0xce51('0x41'),_0x2747dc,_0x20185e[_0xce51('0x40')]);_0x119d9a[_0xce51('0x42')]=_0x2571e0!==''?_0x2571e0:util[_0xce51('0x43')](_0xce51('0x44'),_0x2747dc);_0x119d9a[_0xce51('0x45')]=_0xce51('0x46');}else if(_0x20185e[_0xce51('0x40')]===_0xce51('0x1b')){logger['info'](_0xce51('0x41'),_0x2747dc,_0x20185e[_0xce51('0x40')]);_0x119d9a[_0xce51('0x2b')]=_0x2571e0!==''?_0x2571e0:util[_0xce51('0x43')](_0xce51('0x44'),_0x2747dc);}else{return null;}}return _0x566105[_0xce51('0x20')](_['upperFirst'](_0x20185e[_0xce51('0x40')]))[_0xce51('0x21')](_0x119d9a)['then'](function(_0xc75155){return BPromise[_0xce51('0x2a')]({'id':_0xc75155['id'],'endUserType':_0x20185e[_0xce51('0x40')]});});}});}function getCustomFields(_0x4ed93f,_0x1f8814){var _0x1cfd4c={};if(_0x4ed93f['length']>0x0){_['forEach'](_0x4ed93f,function(_0xd933f3){if(_[_0xce51('0x47')]([_0xce51('0x48'),_0xce51('0x49')],_0xd933f3['type'])&&_0xd933f3[_0xce51('0x4a')]){_0x1cfd4c[_0xd933f3[_0xce51('0x4a')]]=_0xd933f3['content'][_0xce51('0x4b')]();}else if(_0xd933f3[_0xce51('0x3d')]===_0xce51('0x4c')&&_0xd933f3[_0xce51('0x4d')]&&_0xd933f3[_0xce51('0x4a')]){_0x1f8814[_0xd933f3[_0xce51('0x4d')]]&&(_0x1cfd4c[_0xd933f3[_0xce51('0x4a')]]=_0x1f8814[_0xd933f3[_0xce51('0x4d')]][_0xce51('0x4b')]());}else if(_0xd933f3[_0xce51('0x3d')]===_0xce51('0x4e')&&_0xd933f3[_0xce51('0x4f')]&&_0xd933f3[_0xce51('0x4f')][_0xce51('0x50')]&&_0xd933f3[_0xce51('0x4a')]){_0x1f8814[_0xd933f3[_0xce51('0x4f')]['name'][_0xce51('0x3e')]()]&&(_0x1cfd4c[_0xd933f3['idField']]=_0x1f8814[_0xd933f3[_0xce51('0x4f')][_0xce51('0x50')][_0xce51('0x3e')]()][_0xce51('0x4b')]());}});}return _0x1cfd4c;}function getConnection(_0x3793bd){var _0x56e1a1=_0x3793bd[_0xce51('0x51')][_0xce51('0x52')](_0x3793bd[_0xce51('0x53')]);var _0xb3742e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3793bd[_0xce51('0x54')]||'https://login.salesforce.com','clientId':_0x3793bd[_0xce51('0x55')],'clientSecret':_0x3793bd[_0xce51('0x56')]}});return _0xb3742e[_0xce51('0x57')](_0x3793bd[_0xce51('0x58')],_0x56e1a1)[_0xce51('0x25')](function(){logger['info'](_0xce51('0x59'));return _0xb3742e;});}exports[_0xce51('0x5a')]=function(_0x4c66fd,_0x46b4c1,_0x21684a,_0x7b27ed,_0xb22b95,_0x10056c){var _0x164536,_0x327a17,_0x641626,_0x196ad3;_0x10056c[_0xce51('0x5b')]=intUtil[_0xce51('0x5c')](_0x10056c[_0xce51('0x5b')]);_0x10056c[_0xce51('0x54')]=intUtil[_0xce51('0x5c')](_0x10056c[_0xce51('0x54')]);if(_0xb22b95&&_0xb22b95[_0xce51('0x5d')]){logger[_0xce51('0x28')](_0xce51('0x5e'),_0xce51('0x5f'));_0x46b4c1[_0xce51('0x60')]=util['format'](_0xce51('0x61'),_0x10056c[_0xce51('0x5b')],_0x46b4c1[_0xce51('0x62')],md5(_0x46b4c1['uniqueid']));}else{_0x46b4c1[_0xce51('0x60')]='';}return getConnection(_0x10056c)['then'](function(_0x4da857){_0x196ad3=_0x4da857;return getUser(_0x10056c,_0x7b27ed['email'],_0x196ad3);})[_0xce51('0x25')](function(_0x1102fd){_0x164536=_0x1102fd;return getEndUser(_0x10056c,_0x21684a,_0x46b4c1['calleridname'],_0x46b4c1[_0xce51('0x63')],_0x196ad3);})['then'](function(_0x2aed99){_0x327a17=_0x2aed99;return getTicket(_0x10056c,_0x164536,_0x327a17,_0x21684a,_0x46b4c1,_0x21684a[_0xce51('0x64')],_0x196ad3,_0xce51('0x5a'));})[_0xce51('0x25')](function(_0x421963){_0x641626=_0x421963;logger['info'](_0xce51('0x65'),_0x641626['id']);logger[_0xce51('0x28')](_0xce51('0x66'),_0x641626['id'],_0x7b27ed[_0xce51('0x50')],_0x10056c[_0xce51('0x3d')]);switch(_0x10056c[_0xce51('0x3d')]){case _0xce51('0x67'):emit(util['format'](_0xce51('0x68'),_0x7b27ed[_0xce51('0x50')]),'trigger:salesforce:display',{'recordId':_0x641626['id']});break;case _0xce51('0x69'):emit(util['format'](_0xce51('0x68'),_0x7b27ed['name']),_0xce51('0x6a'),{'uri':util[_0xce51('0x43')]('%s/%s/e',_0x196ad3[_0xce51('0x6b')],_0x641626['id'])});break;default:logger['error'](_0xce51('0x6c'));}})['catch'](function(_0x2d1c4b){logger[_0xce51('0x6d')](_0xce51('0x5e'),_0x2d1c4b);});};exports[_0xce51('0x6e')]=function(_0x587a2e,_0x322a18,_0x478a97,_0x50d815,_0xb8e1a6,_0x916c19,_0x14a96e){var _0x2020e2,_0x51b2b0,_0x5c37ab,_0x18376a;_0x916c19[_0xce51('0x5b')]=intUtil[_0xce51('0x5c')](_0x916c19['serverUrl']);_0x916c19[_0xce51('0x54')]=intUtil[_0xce51('0x5c')](_0x916c19[_0xce51('0x54')]);if(_0x14a96e&&_0x14a96e['recordingFormat']&&_0x14a96e[_0xce51('0x6f')]!==_0xce51('0x70')){logger[_0xce51('0x28')](_0xce51('0x71'),_0xce51('0x5f'));_0x322a18[_0xce51('0x60')]=util[_0xce51('0x43')](_0xce51('0x61'),_0x916c19[_0xce51('0x5b')],_0x322a18[_0xce51('0x62')],md5(_0x322a18[_0xce51('0x62')]));}return getConnection(_0x916c19)[_0xce51('0x25')](function(_0x56ec29){_0x18376a=_0x56ec29;return getUser(_0x916c19,_0x50d815[_0xce51('0x72')],_0x18376a);})['then'](function(_0x59b0f9){_0x2020e2=_0x59b0f9;return getEndUser(_0x916c19,_0x478a97,_0x322a18[_0xce51('0x73')],_0x322a18[_0xce51('0x74')],_0x18376a);})[_0xce51('0x25')](function(_0x1f587e){_0x51b2b0=_0x1f587e;return getTicket(_0x916c19,_0x2020e2,_0x51b2b0,_0x478a97,_0x322a18,_0x478a97[_0xce51('0x64')],_0x18376a,_0xce51('0x6e'));})[_0xce51('0x25')](function(_0x30dce5){_0x5c37ab=_0x30dce5;logger['info'](_0xce51('0x75'),_0x5c37ab['id']);logger[_0xce51('0x28')](_0xce51('0x76'),_0x5c37ab['id'],_0x50d815['name'],_0x916c19[_0xce51('0x3d')]);switch(_0x916c19[_0xce51('0x3d')]){case _0xce51('0x67'):emit(util[_0xce51('0x43')](_0xce51('0x68'),_0x50d815[_0xce51('0x50')]),_0xce51('0x77'),{'recordId':_0x5c37ab['id']});break;case _0xce51('0x69'):emit(util['format']('user:%s',_0x50d815[_0xce51('0x50')]),_0xce51('0x6a'),{'uri':util[_0xce51('0x43')](_0xce51('0x78'),_0x18376a[_0xce51('0x6b')],_0x5c37ab['id'])});break;default:logger[_0xce51('0x6d')](_0xce51('0x71'),_0xce51('0x79'));}})['catch'](function(_0x3ab377){logger[_0xce51('0x6d')](_0xce51('0x71'),_0x3ab377);});};exports['unmanaged']=function(_0x5d3158,_0x262dd6,_0x5e0a82,_0x570f79,_0xaff7b2,_0x501665){var _0x402970,_0x173e26,_0x206a93,_0x6927ad;_0x501665[_0xce51('0x5b')]=intUtil[_0xce51('0x5c')](_0x501665[_0xce51('0x5b')]);_0x501665[_0xce51('0x54')]=intUtil[_0xce51('0x5c')](_0x501665[_0xce51('0x54')]);if(_0xaff7b2&&_0xaff7b2[_0xce51('0x5d')]){logger[_0xce51('0x28')]('['+_0x262dd6[_0xce51('0x7a')][_0xce51('0x7b')]()+']',_0xce51('0x5f'));_0x262dd6['recordingURL']=util[_0xce51('0x43')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x501665['serverUrl'],_0x262dd6[_0xce51('0x62')],md5(_0x262dd6[_0xce51('0x62')]));}else{_0x262dd6[_0xce51('0x60')]='';}return getConnection(_0x501665)[_0xce51('0x25')](function(_0x295e6c){_0x6927ad=_0x295e6c;if(!_[_0xce51('0x22')](_0x570f79)){return getUser(_0x501665,_0x570f79['name'],_0x6927ad);}else{return getUser(_0x501665,null,_0x6927ad);}})[_0xce51('0x25')](function(_0x23fb01){_0x402970=_0x23fb01;return getEndUser(_0x501665,_0x5e0a82,_0x262dd6[_0xce51('0x7c')],_0x262dd6[_0xce51('0x63')],_0x6927ad);})[_0xce51('0x25')](function(_0x14fd0a){_0x173e26=_0x14fd0a;return getTicket(_0x501665,_0x402970,_0x173e26,_0x5e0a82,_0x262dd6,_0x5e0a82[_0xce51('0x64')],_0x6927ad);})['then'](function(_0xff7e16){_0x206a93=_0xff7e16;logger[_0xce51('0x28')]('['+_0x262dd6[_0xce51('0x7a')][_0xce51('0x7b')]()+_0xce51('0x7d'),_0x206a93['id']);logger[_0xce51('0x28')]('['+_0x262dd6[_0xce51('0x7a')][_0xce51('0x7b')]()+_0xce51('0x7e'),_0x501665['type']);})[_0xce51('0x7f')](function(_0x2563f5){logger[_0xce51('0x6d')]('['+_0x262dd6[_0xce51('0x7a')][_0xce51('0x7b')]()+']',_0x2563f5);});}; \ 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 74be4c0..16e34db 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 _0x7592=['Fields',']\x20POST\x20incident\x20entity\x20schema','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','bluebird','util','md5','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','sys_id','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','user','endUserNumber','true','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','string','picklist','type','nameField','customField','toLowerCase','content','toString','includes','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','POST','incident','assign','getString','Subjects','Descriptions'];(function(_0xbc7ea,_0x4d3f90){var _0xadc703=function(_0x8309cf){while(--_0x8309cf){_0xbc7ea['push'](_0xbc7ea['shift']());}};_0xadc703(++_0x4d3f90);}(_0x7592,0x184));var _0x2759=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x7592[_0x199bc4];return _0x136ffb;};'use strict';var _=require(_0x2759('0x0'));var Promise=require(_0x2759('0x1'));var rp=require('request-promise');var util=require(_0x2759('0x2'));var md5=require(_0x2759('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2759('0x4'));var logger=require(_0x2759('0x5'))('servicenow');config[_0x2759('0x6')]=_[_0x2759('0x7')](config[_0x2759('0x6')],{'host':_0x2759('0x8'),'port':0x18eb});var io=require(_0x2759('0x9'))(new Redis(config[_0x2759('0x6')]));function getAdminUser(_0x4d2cc7,_0x251fd6,_0xaf6cc2,_0x2daa65,_0x4ea87f,_0x448c1f){return new Promise(function(_0x382798,_0x2e9964){var _0x165d14={'method':_0x2759('0xa'),'uri':_0x2daa65+_0x2759('0xb')+'&'+_0x4ea87f+'&'+_0x448c1f,'auth':_0x251fd6,'json':!![]};return rp(_0x165d14)[_0x2759('0xc')](function(_0x5022ca){if(_0x5022ca[_0x2759('0xd')]['length']>0x0){_0xaf6cc2[_0x2759('0xe')]=_0x5022ca['result'][0x0]['sys_id'];}logger['info']('['+[_0x4d2cc7[_0x2759('0xf')]()]+_0x2759('0x10'),_0xaf6cc2);_0x382798(_0xaf6cc2);})[_0x2759('0x11')](function(_0x21e553){logger[_0x2759('0x12')]('['+[_0x4d2cc7[_0x2759('0xf')]()]+']',_0x21e553[_0x2759('0x13')]);_0x2e9964(_0x21e553[_0x2759('0x13')]);});});}function getUser(_0x3afcaa,_0x17aa6d,_0x13b138,_0x15b0cd,_0x2149b8){return function(_0x4a2148){logger[_0x2759('0x14')]('['+[_0x3afcaa[_0x2759('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x4a2148);return new Promise(function(_0x30c022,_0x3d0813){if(intUtil[_0x2759('0x15')](_0x4a2148['userEmail'])){var _0x4a0daf={'method':_0x2759('0xa'),'uri':_0x13b138+'sys_user?sysparm_query=email%3D'+_0x4a2148[_0x2759('0x16')]+'&'+_0x15b0cd+'&'+_0x2149b8,'auth':_0x17aa6d,'json':!![]};logger[_0x2759('0x14')]('['+[_0x3afcaa['toUpperCase']()]+_0x2759('0x17'),_0x4a0daf);return rp(_0x4a0daf)[_0x2759('0xc')](function(_0x1b4e00){logger[_0x2759('0x14')]('['+[_0x3afcaa[_0x2759('0xf')]()]+_0x2759('0x18'),_0x1b4e00);if(_0x1b4e00[_0x2759('0xd')]['length']>0x0&&String(_0x1b4e00[_0x2759('0xd')][0x0][_0x2759('0x19')])==='true'){_0x4a2148[_0x2759('0x1a')]=_0x1b4e00[_0x2759('0xd')][0x0][_0x2759('0x1b')];}else{_0x4a2148[_0x2759('0x1a')]=_0x4a2148[_0x2759('0xe')];_0x4a2148['userEmail']=_0x4a2148[_0x2759('0x1c')];}logger[_0x2759('0x14')]('['+[_0x3afcaa[_0x2759('0xf')]()]+_0x2759('0x1d'),_0x4a2148);_0x30c022(_0x4a2148);})[_0x2759('0x11')](function(_0x4c888f){logger[_0x2759('0x12')]('['+[_0x3afcaa[_0x2759('0xf')]()]+']',_0x4c888f[_0x2759('0x13')]);_0x3d0813(_0x4c888f[_0x2759('0x13')]);});}else{logger[_0x2759('0x14')]('['+[_0x3afcaa[_0x2759('0xf')]()]+_0x2759('0x1e'));_0x4a2148[_0x2759('0x1a')]=_0x4a2148[_0x2759('0xe')];_0x4a2148[_0x2759('0x16')]=_0x4a2148['adminEmail'];_0x30c022(_0x4a2148);}});};}function createEndUser(_0x2326f1,_0x318ecd,_0x329d47,_0xbcb296,_0x175e87){logger[_0x2759('0x14')]('['+[_0x2326f1[_0x2759('0xf')]()]+_0x2759('0x1f'),_0x329d47);return new Promise(function(_0x124ae0,_0x3da2a3){var _0x381395={'method':'POST','uri':_0xbcb296+'sys_user?'+_0x175e87,'body':{'user_name':_0x329d47['endUserNumber'],'roles':_0x2759('0x20'),'first_name':_0x329d47[_0x2759('0x21')],'active':_0x2759('0x22'),'date_format':'System','phone':_0x329d47['endUserNumber']},'auth':_0x318ecd,'json':!![]};return rp(_0x381395)[_0x2759('0xc')](function(_0x4ab1ec){logger[_0x2759('0x14')]('['+[_0x2326f1['toUpperCase']()]+_0x2759('0x23'),_0x4ab1ec['result']);_0x329d47[_0x2759('0x24')]=_0x4ab1ec[_0x2759('0xd')][_0x2759('0x1b')];_0x124ae0(_0x329d47);})[_0x2759('0x11')](function(_0x59fd6c){logger[_0x2759('0x12')]('['+[_0x2326f1[_0x2759('0xf')]()]+']',_0x59fd6c[_0x2759('0x13')]);_0x3da2a3(_0x59fd6c[_0x2759('0x13')]);});});}function getEndUser(_0x47bc9a,_0x116ea6,_0x28bd37,_0x4f4b09,_0x4dbbc8){return function(_0x550875){logger['info']('['+[_0x47bc9a['toUpperCase']()]+_0x2759('0x25'),_0x550875);return new Promise(function(_0x368fa7,_0x556e97){var _0x221ad8={'method':'GET','uri':_0x28bd37+_0x2759('0x26')+_0x550875['endUserNumber']+'&'+_0x4f4b09+'&'+_0x4dbbc8,'auth':_0x116ea6,'json':!![]};return rp(_0x221ad8)[_0x2759('0xc')](function(_0x3c7746){if(_0x3c7746[_0x2759('0xd')]['length']>0x0){_0x550875[_0x2759('0x24')]=_0x3c7746[_0x2759('0xd')][0x0][_0x2759('0x1b')];logger[_0x2759('0x14')]('['+[_0x47bc9a['toUpperCase']()]+_0x2759('0x27'),_0x550875);_0x368fa7(_0x550875);}else{return createEndUser(_0x47bc9a,_0x116ea6,_0x550875,_0x28bd37,_0x4f4b09)[_0x2759('0xc')](function(_0xda5c09){logger['info']('['+[_0x47bc9a[_0x2759('0xf')]()]+_0x2759('0x28'),_0xda5c09);_0x368fa7(_0xda5c09);});}})[_0x2759('0x11')](function(_0x36b2dc){logger[_0x2759('0x12')]('['+[_0x47bc9a[_0x2759('0xf')]()]+']',_0x36b2dc[_0x2759('0x13')]);_0x556e97(_0x36b2dc[_0x2759('0x13')]);});});};}function getCustomFields(_0x152eb4,_0xed4913){var _0x424531={};if(_0x152eb4[_0x2759('0x29')]>0x0){_[_0x2759('0x2a')](_0x152eb4,function(_0x5063e0){if(_['includes']([_0x2759('0x2b'),_0x2759('0x2c')],_0x5063e0[_0x2759('0x2d')])&&_0x5063e0[_0x2759('0x2e')]&&!_0x5063e0[_0x2759('0x2f')]){_0x424531[_0x5063e0[_0x2759('0x2e')][_0x2759('0x30')]()]=_0x5063e0[_0x2759('0x31')][_0x2759('0x32')]();}else if(_[_0x2759('0x33')]([_0x2759('0x2b'),_0x2759('0x2c')],_0x5063e0['type'])&&_0x5063e0['idField']&&_0x5063e0['customField']){_0x424531[_0x5063e0[_0x2759('0x34')][_0x2759('0x30')]()]=_0x5063e0[_0x2759('0x31')][_0x2759('0x32')]();}else if(_0x5063e0[_0x2759('0x2d')]==='variable'&&_0x5063e0[_0x2759('0x35')]&&_0x5063e0[_0x2759('0x34')]&&_0x5063e0[_0x2759('0x2f')]){_0x424531[_0x5063e0[_0x2759('0x34')][_0x2759('0x30')]()]=_0xed4913[_0x5063e0[_0x2759('0x35')]][_0x2759('0x32')]();}else if(_0x5063e0[_0x2759('0x2d')]===_0x2759('0x36')&&_0x5063e0[_0x2759('0x37')]&&_0x5063e0[_0x2759('0x37')][_0x2759('0x38')]&&_0x5063e0['idField']&&_0x5063e0[_0x2759('0x2f')]){_0x424531[_0x5063e0[_0x2759('0x34')][_0x2759('0x30')]()]=_0xed4913[_0x5063e0[_0x2759('0x37')][_0x2759('0x38')][_0x2759('0x30')]()][_0x2759('0x32')]();}});}return _0x424531;}function getTicket(_0x1ca51d,_0x54cd4a,_0x385ac3,_0x47763f,_0x41c0d3,_0x18f834){return function(_0x487d3d){logger[_0x2759('0x14')]('['+[_0x1ca51d[_0x2759('0xf')]()]+_0x2759('0x39'),_0x487d3d);return new Promise(function(_0x5b499c,_0xb17cdd){var _0x2577db=_0x1ca51d[_0x2759('0x30')]()==='outbound'?_0x487d3d[_0x2759('0x1a')]:_0x487d3d[_0x2759('0x24')];var _0x40646c={'method':_0x2759('0x3a'),'uri':_0x385ac3+_0x2759('0x3b')+'?'+_0x18f834,'body':Object[_0x2759('0x3c')]({},{'active':'true','caller_id':_0x2577db,'assigned_to':_0x487d3d['userId'],'short_description':intUtil[_0x2759('0x3d')](_0x47763f[_0x2759('0x3e')],_0x41c0d3,'\x20'),'description':intUtil[_0x2759('0x3d')](_0x47763f[_0x2759('0x3f')],_0x41c0d3,'\x0a')},getCustomFields(_0x47763f[_0x2759('0x40')],_0x41c0d3)),'auth':_0x54cd4a,'json':!![]};return rp(_0x40646c)[_0x2759('0xc')](function(_0x3ee34a){logger['info']('['+[_0x1ca51d['toUpperCase']()]+_0x2759('0x41'),_0x3ee34a['result']);_0x487d3d['ticketId']=_0x3ee34a[_0x2759('0xd')]['sys_id'];_0x487d3d['ticketNumber']=_0x3ee34a[_0x2759('0xd')][_0x2759('0x42')];logger[_0x2759('0x14')]('['+[_0x1ca51d[_0x2759('0xf')]()]+_0x2759('0x43'),_0x487d3d);_0x5b499c(_0x487d3d);})[_0x2759('0x11')](function(_0xf5fca8){logger[_0x2759('0x12')]('['+[_0x1ca51d[_0x2759('0xf')]()]+']',_0xf5fca8[_0x2759('0x13')]);_0xb17cdd(_0xf5fca8[_0x2759('0x13')]);});});};}function createRemoteTag(_0x251b1f,_0x2470b3,_0x54546b,_0x12dec5){return new Promise(function(_0x2a0280,_0x4138b8){var _0x117338={'method':_0x2759('0x3a'),'uri':_0x54546b+_0x2759('0x44')+'?'+_0x12dec5,'body':{'short_description':_0x251b1f,'global':!![],'active':!![],'name':_0x251b1f},'auth':_0x2470b3,'json':!![]};return rp(_0x117338)[_0x2759('0xc')](function(_0x503e81){var _0x5cd9ec=_0x503e81[_0x2759('0xd')][_0x2759('0x1b')];_0x2a0280(_0x5cd9ec);});});}function getRemoteTag(_0x181f3c,_0x6d59ac,_0x3876d9,_0x43b595,_0xf8fab2){return new Promise(function(_0x2c0fd9,_0x1a8fc8){var _0x3e69cf={'method':'GET','uri':_0x3876d9+_0x2759('0x44')+_0x2759('0x45')+_0x181f3c+'&'+_0x43b595,'auth':_0x6d59ac,'json':!![]};return rp(_0x3e69cf)['then'](function(_0x466eef){if(_0x466eef[_0x2759('0xd')][_0x2759('0x29')]>0x0){var _0x2e6195=_0x466eef[_0x2759('0xd')][0x0][_0x2759('0x1b')];_0x2c0fd9(_0x2e6195);}else{return createRemoteTag(_0x181f3c,_0x6d59ac,_0x3876d9,_0x43b595)[_0x2759('0xc')](function(_0x4b174b){_0x2c0fd9(_0x4b174b);});}});});}function assignTagToIncident(_0x12d8df,_0x4e4a5b,_0x46d911,_0x4efdde,_0x1ab5f5){return new Promise(function(_0x133d97,_0x36a61a){var _0xa764e0={'method':_0x2759('0x3a'),'uri':_0x46d911+_0x2759('0x46')+'?'+_0x1ab5f5,'body':{'label':_0x12d8df,'table':_0x2759('0x3b'),'id_type':'Incident','table_key':_0x4efdde[_0x2759('0x47')],'title':_0x2759('0x48')+_0x4efdde[_0x2759('0x49')],'id_display':_0x4efdde[_0x2759('0x49')]},'auth':_0x4e4a5b,'json':!![]};return rp(_0xa764e0)[_0x2759('0xc')](function(_0x58bae5){_0x133d97();})[_0x2759('0x11')](function(){_0x133d97();});});}function manageTags(_0xda1d4c,_0x2a765f,_0x111479,_0x38f3c1,_0x3a40ab,_0x51041d,_0x353b63){return new Promise(function(_0xd26efa,_0x53abd5){var _0x58316a=[];_0x2a765f[_0x2759('0x2a')](function(_0x4e894c){_0x58316a[_0x2759('0x4a')](getRemoteTag(_0x4e894c,_0x111479,_0x38f3c1,_0x51041d,_0x353b63));});return Promise[_0x2759('0x4b')](_0x58316a)[_0x2759('0xc')](function(_0x308732){if(_0x308732['length']){logger['info']('['+[_0xda1d4c[_0x2759('0xf')]()]+_0x2759('0x4c'),_0x308732);var _0x491450=[];_0x308732[_0x2759('0x2a')](function(_0x3ac29e){_0x491450['push'](assignTagToIncident(_0x3ac29e,_0x111479,_0x38f3c1,_0x3a40ab,_0x51041d));});return Promise[_0x2759('0x4b')](_0x491450)[_0x2759('0xc')](function(){_0xd26efa();})['catch'](function(){_0xd26efa();});}else{_0xd26efa();}});});}function getTags(_0x27cbfe,_0x518571,_0x25a3ac,_0x5ce03c,_0x54d716,_0x167d73){return function(_0x30ff40){return new Promise(function(_0x4b13a2,_0x2d6c16){var _0x4310ed=[];var _0x3cc54e=_0x5ce03c[_0x2759('0x4d')];if(_0x3cc54e&&_0x3cc54e['length']>0x0){_0x4310ed=_[_0x2759('0x4e')](_0x3cc54e,_0x2759('0x38'));}if(_0x4310ed['length']>0x0){return manageTags(_0x27cbfe,_0x4310ed,_0x518571,_0x25a3ac,_0x30ff40,_0x54d716,_0x167d73)[_0x2759('0xc')](function(){_0x4b13a2(_0x30ff40);});}else{_0x4b13a2(_0x30ff40);}});};}function emit(_0x26e760,_0xae41aa,_0x98fa14){var _0x17048e=_0x2759('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x2759('0x50')+_0x2759('0x51');var _0xa81985={'uri':_0x26e760+_0x2759('0x52')+_0x98fa14+_0x17048e};io['to'](util[_0x2759('0x53')]('user:%s',_0xae41aa))[_0x2759('0x54')](_0x2759('0x55'),_0xa81985);}exports['cs']=function(_0x4145d1,_0x29307f,_0x360593,_0x19d20e,_0x5163ab,_0x5ae14e,_0x369104,_0x1deec4){var _0xd80032={};var _0x1da907={'user':_0x5ae14e[_0x2759('0x56')],'pass':_0x5ae14e[_0x2759('0x57')]};var _0x58947e=_0x2759('0x58');var _0x35a3e2=_0x2759('0x59');_0x5ae14e[_0x2759('0x5a')]=intUtil['stripTrailingSlash'](_0x5ae14e[_0x2759('0x5a')]);_0x5ae14e[_0x2759('0x5b')]=intUtil[_0x2759('0x5c')](_0x5ae14e['serverUrl']);var _0x58d86a=util[_0x2759('0x53')](_0x2759('0x5d'),_0x5ae14e['remoteUri']);_0xd80032[_0x2759('0x16')]=!_[_0x2759('0x5e')](_0x19d20e)?_0x19d20e[_0x2759('0x5f')]:null;_0xd80032[_0x2759('0x1c')]=_0x5ae14e['email'];_0xd80032[_0x2759('0x21')]=_0x1deec4[_0x2759('0x30')]()===_0x2759('0x60')?_0x29307f[_0x2759('0x61')]:_0x29307f[_0x2759('0x62')];_0xd80032['callDirection']=_0x1deec4===_0x2759('0x63')||_0x1deec4===_0x2759('0x64')?_0x2759('0x63'):_0x2759('0x60');var _0xe3f631=util[_0x2759('0x53')](_0x2759('0x65'),_0x5ae14e[_0x2759('0x5b')],_0x29307f[_0x2759('0x66')],md5(_0x29307f[_0x2759('0x66')]));if(_0x5163ab&&_0x5163ab[_0x2759('0x67')]){logger[_0x2759('0x14')](_0x2759('0x68'),_0x2759('0x69'));_0x29307f['recordingURL']=_0xe3f631;}else if(_0x369104&&_0x369104[_0x2759('0x6a')]&&_0x369104[_0x2759('0x6a')]!==_0x2759('0x6b')){logger[_0x2759('0x14')](_0x2759('0x6c'),_0x2759('0x69'));_0x29307f[_0x2759('0x6d')]=_0xe3f631;}else{_0x29307f[_0x2759('0x6d')]='';}return getAdminUser(_0x1deec4,_0x1da907,_0xd80032,_0x58d86a,_0x35a3e2,_0x58947e)[_0x2759('0xc')](getUser(_0x1deec4,_0x1da907,_0x58d86a,_0x35a3e2,_0x58947e))[_0x2759('0xc')](getEndUser(_0x1deec4,_0x1da907,_0x58d86a,_0x35a3e2,_0x58947e))['then'](getTicket(_0x1deec4,_0x1da907,_0x58d86a,_0x360593,_0x29307f,_0x35a3e2))['then'](function(_0x1f43cc){logger[_0x2759('0x14')](util[_0x2759('0x53')](_0x2759('0x6e'),_0x1f43cc[_0x2759('0x47')]));logger[_0x2759('0x14')](util[_0x2759('0x53')](_0x2759('0x6f'),_0x1deec4));if(_0x1deec4!==_0x2759('0x64')){logger[_0x2759('0x14')]('['+[_0x1deec4['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5ae14e[_0x2759('0x5a')],_0x19d20e[_0x2759('0x38')],_0x1f43cc[_0x2759('0x47')]);}})[_0x2759('0x11')](function(_0x5da40a){logger[_0x2759('0x12')]('['+[_0x1deec4['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x2759('0x70')](_0x5da40a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe4bd=['Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','toString','idField','variable','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s'];(function(_0x1bbcd8,_0x27234a){var _0x14ea5d=function(_0x2aadad){while(--_0x2aadad){_0x1bbcd8['push'](_0x1bbcd8['shift']());}};_0x14ea5d(++_0x27234a);}(_0xe4bd,0x1c7));var _0xde4b=function(_0x378917,_0x2433ff){_0x378917=_0x378917-0x0;var _0x44a443=_0xe4bd[_0x378917];return _0x44a443;};'use strict';var _=require(_0xde4b('0x0'));var Promise=require(_0xde4b('0x1'));var rp=require(_0xde4b('0x2'));var util=require(_0xde4b('0x3'));var md5=require(_0xde4b('0x4'));var Redis=require('ioredis');var intUtil=require(_0xde4b('0x5'));var config=require(_0xde4b('0x6'));var logger=require(_0xde4b('0x7'))(_0xde4b('0x8'));config[_0xde4b('0x9')]=_[_0xde4b('0xa')](config[_0xde4b('0x9')],{'host':_0xde4b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xde4b('0x9')]));function getAdminUser(_0x4fc4de,_0x23eab6,_0x460ec1,_0x1b41da,_0x20b908,_0x4ecf5c){return new Promise(function(_0x33b44e,_0x53cbe0){var _0xedf08d={'method':_0xde4b('0xc'),'uri':_0x1b41da+_0xde4b('0xd')+'&'+_0x20b908+'&'+_0x4ecf5c,'auth':_0x23eab6,'json':!![]};return rp(_0xedf08d)[_0xde4b('0xe')](function(_0x188bed){if(_0x188bed[_0xde4b('0xf')][_0xde4b('0x10')]>0x0){_0x460ec1[_0xde4b('0x11')]=_0x188bed[_0xde4b('0xf')][0x0][_0xde4b('0x12')];}logger[_0xde4b('0x13')]('['+[_0x4fc4de[_0xde4b('0x14')]()]+'],\x20getAdminUser\x20crm',_0x460ec1);_0x33b44e(_0x460ec1);})[_0xde4b('0x15')](function(_0x42eefe){logger['error']('['+[_0x4fc4de['toUpperCase']()]+']',_0x42eefe[_0xde4b('0x16')]);_0x53cbe0(_0x42eefe['message']);});});}function getUser(_0xac4f25,_0x359c14,_0x509a7e,_0x45a176,_0x23601b){return function(_0x19337f){logger[_0xde4b('0x13')]('['+[_0xac4f25[_0xde4b('0x14')]()]+_0xde4b('0x17'),_0x19337f);return new Promise(function(_0x1ed76b,_0x25f797){if(intUtil[_0xde4b('0x18')](_0x19337f[_0xde4b('0x19')])){var _0x55beec={'method':_0xde4b('0xc'),'uri':_0x509a7e+_0xde4b('0x1a')+_0x19337f['userEmail']+'&'+_0x45a176+'&'+_0x23601b,'auth':_0x359c14,'json':!![]};logger[_0xde4b('0x13')]('['+[_0xac4f25[_0xde4b('0x14')]()]+_0xde4b('0x1b'),_0x55beec);return rp(_0x55beec)['then'](function(_0x548fb6){logger[_0xde4b('0x13')]('['+[_0xac4f25[_0xde4b('0x14')]()]+'],\x20getUser\x20entity',_0x548fb6);if(_0x548fb6[_0xde4b('0xf')][_0xde4b('0x10')]>0x0&&String(_0x548fb6['result'][0x0]['active'])===_0xde4b('0x1c')){_0x19337f[_0xde4b('0x1d')]=_0x548fb6['result'][0x0]['sys_id'];}else{_0x19337f[_0xde4b('0x1d')]=_0x19337f[_0xde4b('0x11')];_0x19337f[_0xde4b('0x19')]=_0x19337f[_0xde4b('0x1e')];}logger['info']('['+[_0xac4f25[_0xde4b('0x14')]()]+_0xde4b('0x1f'),_0x19337f);_0x1ed76b(_0x19337f);})[_0xde4b('0x15')](function(_0x8359b){logger[_0xde4b('0x20')]('['+[_0xac4f25['toUpperCase']()]+']',_0x8359b['message']);_0x25f797(_0x8359b[_0xde4b('0x16')]);});}else{logger[_0xde4b('0x13')]('['+[_0xac4f25[_0xde4b('0x14')]()]+_0xde4b('0x21'));_0x19337f[_0xde4b('0x1d')]=_0x19337f[_0xde4b('0x11')];_0x19337f[_0xde4b('0x19')]=_0x19337f[_0xde4b('0x1e')];_0x1ed76b(_0x19337f);}});};}function createEndUser(_0x764bd5,_0x580781,_0x209100,_0x380603,_0x32cb59){logger[_0xde4b('0x13')]('['+[_0x764bd5[_0xde4b('0x14')]()]+_0xde4b('0x22'),_0x209100);return new Promise(function(_0x92c3e2,_0x484371){var _0x54dacf={'method':_0xde4b('0x23'),'uri':_0x380603+_0xde4b('0x24')+_0x32cb59,'body':{'user_name':_0x209100[_0xde4b('0x25')],'roles':'user','first_name':_0x209100[_0xde4b('0x25')],'active':'true','date_format':_0xde4b('0x26'),'phone':_0x209100[_0xde4b('0x25')]},'auth':_0x580781,'json':!![]};return rp(_0x54dacf)[_0xde4b('0xe')](function(_0x3c57c5){logger[_0xde4b('0x13')]('['+[_0x764bd5[_0xde4b('0x14')]()]+'],\x20EndUser\x20schema',_0x3c57c5[_0xde4b('0xf')]);_0x209100['endUserId']=_0x3c57c5['result'][_0xde4b('0x12')];_0x92c3e2(_0x209100);})[_0xde4b('0x15')](function(_0xe7928a){logger[_0xde4b('0x20')]('['+[_0x764bd5[_0xde4b('0x14')]()]+']',_0xe7928a['message']);_0x484371(_0xe7928a[_0xde4b('0x16')]);});});}function getEndUser(_0x483bdc,_0x54df61,_0x17dbc5,_0x112162,_0x133551){return function(_0x37fdff){logger['info']('['+[_0x483bdc[_0xde4b('0x14')]()]+_0xde4b('0x27'),_0x37fdff);return new Promise(function(_0x4c0888,_0x4a5e78){var _0x46ac01={'method':_0xde4b('0xc'),'uri':_0x17dbc5+_0xde4b('0x28')+_0x37fdff['endUserNumber']+'&'+_0x112162+'&'+_0x133551,'auth':_0x54df61,'json':!![]};return rp(_0x46ac01)['then'](function(_0x3b36e0){if(_0x3b36e0[_0xde4b('0xf')][_0xde4b('0x10')]>0x0){_0x37fdff[_0xde4b('0x29')]=_0x3b36e0[_0xde4b('0xf')][0x0][_0xde4b('0x12')];logger[_0xde4b('0x13')]('['+[_0x483bdc[_0xde4b('0x14')]()]+_0xde4b('0x2a'),_0x37fdff);_0x4c0888(_0x37fdff);}else{return createEndUser(_0x483bdc,_0x54df61,_0x37fdff,_0x17dbc5,_0x112162)['then'](function(_0x54c85b){logger['info']('['+[_0x483bdc[_0xde4b('0x14')]()]+'],\x20createEndUser\x20crm',_0x54c85b);_0x4c0888(_0x54c85b);});}})['catch'](function(_0x372662){logger[_0xde4b('0x20')]('['+[_0x483bdc[_0xde4b('0x14')]()]+']',_0x372662[_0xde4b('0x16')]);_0x4a5e78(_0x372662[_0xde4b('0x16')]);});});};}function getCustomFields(_0x31f435,_0x42f27b){var _0x2df7e2={};if(_0x31f435['length']>0x0){_[_0xde4b('0x2b')](_0x31f435,function(_0x45ca23){if(_[_0xde4b('0x2c')]([_0xde4b('0x2d'),_0xde4b('0x2e')],_0x45ca23[_0xde4b('0x2f')])&&_0x45ca23['nameField']&&!_0x45ca23[_0xde4b('0x30')]){_0x2df7e2[_0x45ca23[_0xde4b('0x31')][_0xde4b('0x32')]()]=_0x45ca23[_0xde4b('0x33')][_0xde4b('0x34')]();}else if(_[_0xde4b('0x2c')]([_0xde4b('0x2d'),_0xde4b('0x2e')],_0x45ca23[_0xde4b('0x2f')])&&_0x45ca23[_0xde4b('0x35')]&&_0x45ca23['customField']){_0x2df7e2[_0x45ca23[_0xde4b('0x35')][_0xde4b('0x32')]()]=_0x45ca23[_0xde4b('0x33')][_0xde4b('0x34')]();}else if(_0x45ca23[_0xde4b('0x2f')]===_0xde4b('0x36')&&_0x45ca23['variableName']&&_0x45ca23['idField']&&_0x45ca23[_0xde4b('0x30')]){_0x2df7e2[_0x45ca23[_0xde4b('0x35')]['toLowerCase']()]=_0x42f27b[_0x45ca23['variableName']][_0xde4b('0x34')]();}else if(_0x45ca23[_0xde4b('0x2f')]===_0xde4b('0x37')&&_0x45ca23['Variable']&&_0x45ca23[_0xde4b('0x38')]['name']&&_0x45ca23[_0xde4b('0x35')]&&_0x45ca23[_0xde4b('0x30')]){_0x2df7e2[_0x45ca23[_0xde4b('0x35')][_0xde4b('0x32')]()]=_0x42f27b[_0x45ca23['Variable'][_0xde4b('0x39')][_0xde4b('0x32')]()]['toString']();}});}return _0x2df7e2;}function getTicket(_0x5b157c,_0x266a04,_0x818aaf,_0x10c97c,_0x369062,_0x1e3004){return function(_0x4b5a20){logger[_0xde4b('0x13')]('['+[_0x5b157c[_0xde4b('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x4b5a20);return new Promise(function(_0x2382ba,_0x8d3c2f){var _0x3de099=_0x5b157c[_0xde4b('0x32')]()===_0xde4b('0x3a')?_0x4b5a20['userId']:_0x4b5a20['endUserId'];var _0x221caa={'method':'POST','uri':_0x818aaf+_0xde4b('0x3b')+'?'+_0x1e3004,'body':Object[_0xde4b('0x3c')]({},{'active':'true','caller_id':_0x3de099,'assigned_to':_0x4b5a20[_0xde4b('0x1d')],'short_description':intUtil[_0xde4b('0x3d')](_0x10c97c[_0xde4b('0x3e')],_0x369062,'\x20'),'description':intUtil[_0xde4b('0x3d')](_0x10c97c[_0xde4b('0x3f')],_0x369062,'\x0a')},getCustomFields(_0x10c97c['Fields'],_0x369062)),'auth':_0x266a04,'json':!![]};return rp(_0x221caa)[_0xde4b('0xe')](function(_0x1c10b0){logger[_0xde4b('0x13')]('['+[_0x5b157c[_0xde4b('0x14')]()]+_0xde4b('0x40'),_0x1c10b0[_0xde4b('0xf')]);_0x4b5a20[_0xde4b('0x41')]=_0x1c10b0[_0xde4b('0xf')]['sys_id'];_0x4b5a20[_0xde4b('0x42')]=_0x1c10b0[_0xde4b('0xf')][_0xde4b('0x43')];logger[_0xde4b('0x13')]('['+[_0x5b157c[_0xde4b('0x14')]()]+']\x20getTicket\x20crm',_0x4b5a20);_0x2382ba(_0x4b5a20);})['catch'](function(_0x397ae1){logger[_0xde4b('0x20')]('['+[_0x5b157c[_0xde4b('0x14')]()]+']',_0x397ae1[_0xde4b('0x16')]);_0x8d3c2f(_0x397ae1[_0xde4b('0x16')]);});});};}function createRemoteTag(_0x17c98c,_0x40795e,_0x38ec09,_0x3a650f){return new Promise(function(_0x3fe15f,_0x3f9f01){var _0x52bc60={'method':_0xde4b('0x23'),'uri':_0x38ec09+_0xde4b('0x44')+'?'+_0x3a650f,'body':{'short_description':_0x17c98c,'global':!![],'active':!![],'name':_0x17c98c},'auth':_0x40795e,'json':!![]};return rp(_0x52bc60)[_0xde4b('0xe')](function(_0x5de6a5){var _0x47dfa6=_0x5de6a5[_0xde4b('0xf')][_0xde4b('0x12')];_0x3fe15f(_0x47dfa6);});});}function getRemoteTag(_0x5bd86d,_0x322824,_0x5620a4,_0xd648ed,_0x4fbb74){return new Promise(function(_0x3727eb,_0x449bfd){var _0xb225b2={'method':_0xde4b('0xc'),'uri':_0x5620a4+_0xde4b('0x44')+_0xde4b('0x45')+_0x5bd86d+'&'+_0xd648ed,'auth':_0x322824,'json':!![]};return rp(_0xb225b2)[_0xde4b('0xe')](function(_0x4dcad2){if(_0x4dcad2['result'][_0xde4b('0x10')]>0x0){var _0xc8255f=_0x4dcad2[_0xde4b('0xf')][0x0]['sys_id'];_0x3727eb(_0xc8255f);}else{return createRemoteTag(_0x5bd86d,_0x322824,_0x5620a4,_0xd648ed)[_0xde4b('0xe')](function(_0x4c5dde){_0x3727eb(_0x4c5dde);});}});});}function assignTagToIncident(_0x261768,_0x1de463,_0x51248c,_0x5559b0,_0x102119){return new Promise(function(_0x21493c,_0x1590ce){var _0x333887={'method':_0xde4b('0x23'),'uri':_0x51248c+_0xde4b('0x46')+'?'+_0x102119,'body':{'label':_0x261768,'table':_0xde4b('0x3b'),'id_type':_0xde4b('0x47'),'table_key':_0x5559b0['ticketId'],'title':_0xde4b('0x48')+_0x5559b0[_0xde4b('0x42')],'id_display':_0x5559b0[_0xde4b('0x42')]},'auth':_0x1de463,'json':!![]};return rp(_0x333887)[_0xde4b('0xe')](function(_0x4021b3){_0x21493c();})[_0xde4b('0x15')](function(){_0x21493c();});});}function manageTags(_0x192d91,_0x1cf2fd,_0x2b8c91,_0x516093,_0x3a76a3,_0xe2f543,_0x3c0032){return new Promise(function(_0x1b7209,_0x3a9406){var _0x1283c5=[];_0x1cf2fd[_0xde4b('0x2b')](function(_0x38fcd1){_0x1283c5[_0xde4b('0x49')](getRemoteTag(_0x38fcd1,_0x2b8c91,_0x516093,_0xe2f543,_0x3c0032));});return Promise[_0xde4b('0x4a')](_0x1283c5)['then'](function(_0x4164d2){if(_0x4164d2[_0xde4b('0x10')]){logger[_0xde4b('0x13')]('['+[_0x192d91[_0xde4b('0x14')]()]+_0xde4b('0x4b'),_0x4164d2);var _0x2ec9c5=[];_0x4164d2[_0xde4b('0x2b')](function(_0x36fd41){_0x2ec9c5[_0xde4b('0x49')](assignTagToIncident(_0x36fd41,_0x2b8c91,_0x516093,_0x3a76a3,_0xe2f543));});return Promise['all'](_0x2ec9c5)[_0xde4b('0xe')](function(){_0x1b7209();})[_0xde4b('0x15')](function(){_0x1b7209();});}else{_0x1b7209();}});});}function getTags(_0x301f76,_0x4f824d,_0x1436e5,_0x341087,_0x48bc5c,_0x5d11ba){return function(_0x2cbb9e){return new Promise(function(_0xf6ba2a,_0x52ee55){var _0xca32c7=[];var _0xedeaf0=_0x341087[_0xde4b('0x4c')];if(_0xedeaf0&&_0xedeaf0['length']>0x0){_0xca32c7=_[_0xde4b('0x4d')](_0xedeaf0,_0xde4b('0x39'));}if(_0xca32c7[_0xde4b('0x10')]>0x0){return manageTags(_0x301f76,_0xca32c7,_0x4f824d,_0x1436e5,_0x2cbb9e,_0x48bc5c,_0x5d11ba)[_0xde4b('0xe')](function(){_0xf6ba2a(_0x2cbb9e);});}else{_0xf6ba2a(_0x2cbb9e);}});};}function emit(_0x30f2c5,_0x57aa08,_0x5a1582){var _0x2ad1cc=_0xde4b('0x4e')+_0xde4b('0x4f')+_0xde4b('0x50')+_0xde4b('0x51');var _0x54a8be={'uri':_0x30f2c5+_0xde4b('0x52')+_0x5a1582+_0x2ad1cc};io['to'](util[_0xde4b('0x53')](_0xde4b('0x54'),_0x57aa08))[_0xde4b('0x55')](_0xde4b('0x56'),_0x54a8be);}exports['cs']=function(_0x10bae9,_0x13f0ef,_0x48c6c1,_0x1afe9c,_0x2f9aba,_0x2f5300,_0x51ce03,_0x4657c0){var _0x4db0a2={};var _0x599012={'user':_0x2f5300[_0xde4b('0x57')],'pass':_0x2f5300[_0xde4b('0x58')]};var _0x482b15=_0xde4b('0x59');var _0x5698c5=_0xde4b('0x5a');_0x2f5300[_0xde4b('0x5b')]=intUtil[_0xde4b('0x5c')](_0x2f5300[_0xde4b('0x5b')]);_0x2f5300[_0xde4b('0x5d')]=intUtil[_0xde4b('0x5c')](_0x2f5300[_0xde4b('0x5d')]);var _0x49867f=util['format'](_0xde4b('0x5e'),_0x2f5300[_0xde4b('0x5b')]);_0x4db0a2['userEmail']=!_[_0xde4b('0x5f')](_0x1afe9c)?_0x1afe9c['email']:null;_0x4db0a2['adminEmail']=_0x2f5300[_0xde4b('0x60')];_0x4db0a2[_0xde4b('0x25')]=_0x4657c0[_0xde4b('0x32')]()===_0xde4b('0x3a')?_0x13f0ef[_0xde4b('0x61')]:_0x13f0ef[_0xde4b('0x62')];_0x4db0a2[_0xde4b('0x63')]=_0x4657c0==='queue'||_0x4657c0===_0xde4b('0x64')?_0xde4b('0x65'):_0xde4b('0x3a');var _0x2923b4=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f5300[_0xde4b('0x5d')],_0x13f0ef[_0xde4b('0x66')],md5(_0x13f0ef[_0xde4b('0x66')]));if(_0x2f9aba&&_0x2f9aba[_0xde4b('0x67')]){logger[_0xde4b('0x13')](_0xde4b('0x68'),_0xde4b('0x69'));_0x13f0ef[_0xde4b('0x6a')]=_0x2923b4;}else if(_0x51ce03&&_0x51ce03[_0xde4b('0x6b')]&&_0x51ce03[_0xde4b('0x6b')]!==_0xde4b('0x6c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x13f0ef[_0xde4b('0x6a')]=_0x2923b4;}else{_0x13f0ef[_0xde4b('0x6a')]='';}return getAdminUser(_0x4657c0,_0x599012,_0x4db0a2,_0x49867f,_0x5698c5,_0x482b15)[_0xde4b('0xe')](getUser(_0x4657c0,_0x599012,_0x49867f,_0x5698c5,_0x482b15))[_0xde4b('0xe')](getEndUser(_0x4657c0,_0x599012,_0x49867f,_0x5698c5,_0x482b15))[_0xde4b('0xe')](getTicket(_0x4657c0,_0x599012,_0x49867f,_0x48c6c1,_0x13f0ef,_0x5698c5))[_0xde4b('0xe')](function(_0xe107c2){logger[_0xde4b('0x13')](util[_0xde4b('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0xe107c2[_0xde4b('0x41')]));logger[_0xde4b('0x13')](util[_0xde4b('0x53')](_0xde4b('0x6d'),_0x4657c0));if(_0x4657c0!==_0xde4b('0x64')){logger['info']('['+[_0x4657c0[_0xde4b('0x14')]()]+']',_0xde4b('0x6e'));emit(_0x2f5300[_0xde4b('0x5b')],_0x1afe9c[_0xde4b('0x39')],_0xe107c2[_0xde4b('0x41')]);}})['catch'](function(_0x5819b9){logger[_0xde4b('0x20')]('['+[_0x4657c0[_0xde4b('0x14')]()]+_0xde4b('0x6f'),util[_0xde4b('0x70')](_0x5819b9,{'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 d2cd0df..6007c09 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 _0x25fc=['./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','isNil','info','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','user_name','Agent\x20found!','resolve','name_value_list','value','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','type','string','customField','nameField','content','toString','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x25fc,0x1eb));var _0xc25f=function(_0x2a6c55,_0x3745e5){_0x2a6c55=_0x2a6c55-0x0;var _0x4a27b4=_0x25fc[_0x2a6c55];return _0x4a27b4;};'use strict';var _=require(_0xc25f('0x0'));var rp=require(_0xc25f('0x1'));var BPromise=require(_0xc25f('0x2'));var md5=require(_0xc25f('0x3'));var util=require(_0xc25f('0x4'));var Redis=require('ioredis');var intUtil=require(_0xc25f('0x5'));var config=require(_0xc25f('0x6'));var logger=require(_0xc25f('0x7'))(_0xc25f('0x8'));config[_0xc25f('0x9')]=_[_0xc25f('0xa')](config[_0xc25f('0x9')],{'host':_0xc25f('0xb'),'port':0x18eb});var io=require(_0xc25f('0xc'))(new Redis(config[_0xc25f('0x9')]));var def={'method':_0xc25f('0xd'),'json':!![]};function emit(_0x4c1668,_0x569c66,_0x3e1f6b){io['to'](_0x4c1668)[_0xc25f('0xe')](_0x569c66,_0x3e1f6b);}function getTicket(_0x58262e,_0x58118f,_0x30e1d9,_0x1d5ea1,_0x3ea851,_0x16a449,_0x4ddd7f,_0xcd2d15){logger['info'](_0xc25f('0xf'));var _0x2bae45=new Date();var _0x578a57=[{'name':_0xc25f('0x10'),'value':intUtil[_0xc25f('0x11')](_0x1d5ea1[_0xc25f('0x12')],_0x3ea851,'\x20')},{'name':'assigned_user_id','value':_0x58118f['id']},{'name':'created_by','value':_0x58118f['id']},{'name':_0xc25f('0x13'),'value':intUtil['getString'](_0x1d5ea1[_0xc25f('0x14')],_0x3ea851,'\x0a')},{'name':_0xc25f('0x15'),'value':_0x2bae45[_0xc25f('0x16')]()[_0xc25f('0x17')](0x0,0x13)[_0xc25f('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xc25f('0x19'),'value':'15'},{'name':_0xc25f('0x1a'),'value':_0x30e1d9['id']},{'name':_0xc25f('0x1b'),'value':_0xc25f('0x1c')},{'name':_0xc25f('0x1d'),'value':_0x30e1d9[_0xc25f('0x10')]},{'name':_0xc25f('0x1e'),'value':_0xcd2d15}];if(_0x16a449['length']){_[_0xc25f('0x1f')](_0x16a449,function(_0x3cef19){if(_0x3ea851[_0x3cef19[_0xc25f('0x20')]]){_0x578a57[_0xc25f('0x21')]({'name':_0x3cef19[_0xc25f('0x22')],'value':_0x3ea851[_0x3cef19[_0xc25f('0x20')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xc25f('0x23'),'response_type':'JSON','rest_data':JSON[_0xc25f('0x24')]({'session':_0x4ddd7f['id'],'module_name':_0xc25f('0x25'),'name_value_list':_0x578a57})}});}function getAuth(_0x4552ad){return util[_0xc25f('0x26')](_0xc25f('0x27'),new Buffer(_0x4552ad[_0xc25f('0x28')]+':X')['toString'](_0xc25f('0x29')));}function getServerInfo(_0x16404f){return request({'form':{'method':'get_server_info','input_type':_0xc25f('0x23'),'response_type':_0xc25f('0x23'),'rest_data':JSON[_0xc25f('0x24')]({'session':_0x16404f['id']})}});}function getUser(_0x15e41a,_0x35f03,_0x3850b6){if(!_[_0xc25f('0x2a')](_0x35f03)){logger[_0xc25f('0x2b')]('Getting\x20agent\x20with\x20name',_0x35f03);return request({'form':{'method':'get_entry_list','input_type':_0xc25f('0x23'),'response_type':_0xc25f('0x23'),'rest_data':JSON[_0xc25f('0x24')]({'session':_0x3850b6['id'],'module_name':'Employees','query':util['format'](_0xc25f('0x2c'),_0x35f03),'order_by':'','offset':'0','select_fields':['id',_0xc25f('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc25f('0x2d')](function(_0x119711){if(_0x119711[_0xc25f('0x2e')][_0xc25f('0x2f')]){var _0x4a29f9=_['find'](_0x119711['entry_list'],function(_0x1191fa){return _0x1191fa['name_value_list'][_0xc25f('0x30')]['value']===_0x35f03;});if(_0x4a29f9){logger[_0xc25f('0x2b')](_0xc25f('0x31'));return BPromise[_0xc25f('0x32')]({'id':_0x4a29f9[_0xc25f('0x33')]['id'][_0xc25f('0x34')],'name':_0x4a29f9[_0xc25f('0x33')][_0xc25f('0x10')][_0xc25f('0x34')]});}}logger[_0xc25f('0x2b')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3850b6[_0xc25f('0x33')][_0xc25f('0x35')]['value'],'name':_0x3850b6['name_value_list'][_0xc25f('0x30')][_0xc25f('0x34')]});});}else{logger[_0xc25f('0x2b')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc25f('0x32')]({'id':_0x3850b6['name_value_list'][_0xc25f('0x35')][_0xc25f('0x34')],'name':_0x3850b6[_0xc25f('0x33')]['user_name'][_0xc25f('0x34')]});}}function getEndUser(_0x39de8e,_0x1f86be,_0x41050f,_0x4da671){logger[_0xc25f('0x2b')](_0xc25f('0x36'),_0x41050f);return request({'form':{'method':_0xc25f('0x37'),'input_type':_0xc25f('0x23'),'response_type':'JSON','rest_data':JSON[_0xc25f('0x24')]({'session':_0x4da671['id'],'module_name':'Contacts','query':util['format'](_0xc25f('0x38'),_0x41050f),'order_by':'','offset':'0','select_fields':['id',_0xc25f('0x10'),_0xc25f('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xc25f('0x2d')](function(_0x536b9c){if(_0x536b9c[_0xc25f('0x2e')]['length']){var _0x42735b=_[_0xc25f('0x3a')](_0x536b9c[_0xc25f('0x2e')],function(_0x31fb50){return _0x31fb50['name_value_list'][_0xc25f('0x39')][_0xc25f('0x34')]===_0x41050f;});if(_0x42735b){logger[_0xc25f('0x2b')]('Enduser\x20found!');return BPromise[_0xc25f('0x32')]({'id':_0x42735b['name_value_list']['id']['value'],'name':_0x42735b[_0xc25f('0x33')][_0xc25f('0x10')][_0xc25f('0x34')],'phone':_0x42735b[_0xc25f('0x33')]['phone_home']['value']});}}else{logger['info'](_0xc25f('0x3b'));return request({'form':{'method':'set_entry','input_type':_0xc25f('0x23'),'response_type':_0xc25f('0x23'),'rest_data':JSON[_0xc25f('0x24')]({'session':_0x4da671['id'],'module_name':_0xc25f('0x1c'),'name_value_list':[{'name':'first_name','value':_0x1f86be!==_0xc25f('0x3c')?_0x1f86be:util['format'](_0xc25f('0x3d'),_0x41050f)},{'name':_0xc25f('0x39'),'value':_0x41050f}]})}})[_0xc25f('0x2d')](function(_0x52e449){logger[_0xc25f('0x2b')]('Enduser\x20created.');return BPromise[_0xc25f('0x32')]({'id':_0x52e449['id'],'name':_0x52e449['entry_list']['first_name'][_0xc25f('0x34')],'phone':_0x52e449['entry_list'][_0xc25f('0x39')][_0xc25f('0x34')]});});}});}function request(_0x5e3f7d){logger[_0xc25f('0x3e')](_0xc25f('0x3f'),JSON[_0xc25f('0x24')](_0x5e3f7d));return rp(_[_0xc25f('0x40')](def,_0x5e3f7d));}function getTags(_0x15a568,_0x4adf07){var _0x369c32=[];if(_0x15a568&&_0x15a568[_0xc25f('0x2f')]>0x0){_0x369c32=_[_0xc25f('0x41')](_0x15a568,_0x4adf07);}return _0x369c32;}function getCustomFields(_0x41aa22,_0x5e2f42){var _0x43b27e=[];var _0x5766cd={'custom_fields':[]};if(_0x41aa22[_0xc25f('0x2f')]>0x0){_[_0xc25f('0x1f')](_0x41aa22,function(_0x4f4c47){if(_0x4f4c47[_0xc25f('0x42')]===_0xc25f('0x43')&&_0x4f4c47['nameField']&&!_0x4f4c47[_0xc25f('0x44')]){_0x5766cd[_0x4f4c47[_0xc25f('0x45')]['toLowerCase']()]=_0x4f4c47[_0xc25f('0x46')][_0xc25f('0x47')]();}else if(_0x4f4c47[_0xc25f('0x42')]==='string'&&_0x4f4c47[_0xc25f('0x22')]&&_0x4f4c47[_0xc25f('0x44')]){_0x5766cd[_0xc25f('0x48')][_0xc25f('0x21')]({'id':_0x4f4c47[_0xc25f('0x22')],'value':_0x4f4c47[_0xc25f('0x46')][_0xc25f('0x47')]()});}else if(_0x4f4c47[_0xc25f('0x42')]===_0xc25f('0x49')&&_0x4f4c47[_0xc25f('0x20')]&&_0x4f4c47[_0xc25f('0x22')]&&_0x4f4c47[_0xc25f('0x44')]){_0x5e2f42[_0x4f4c47[_0xc25f('0x20')]]&&_0x5766cd[_0xc25f('0x48')][_0xc25f('0x21')]({'id':_0x4f4c47[_0xc25f('0x22')],'value':_0x5e2f42[_0x4f4c47[_0xc25f('0x20')]][_0xc25f('0x47')]()});}else if(_0x4f4c47[_0xc25f('0x42')]===_0xc25f('0x4a')&&_0x4f4c47['Variable']&&_0x4f4c47[_0xc25f('0x4b')][_0xc25f('0x10')]&&_0x4f4c47[_0xc25f('0x22')]&&_0x4f4c47[_0xc25f('0x44')]){_0x5e2f42[_0x4f4c47[_0xc25f('0x4b')][_0xc25f('0x10')][_0xc25f('0x4c')]()]&&_0x5766cd[_0xc25f('0x48')]['push']({'id':_0x4f4c47[_0xc25f('0x22')],'value':_0x5e2f42[_0x4f4c47[_0xc25f('0x4b')][_0xc25f('0x10')][_0xc25f('0x4c')]()]['toString']()});}});}return _0x5766cd;}function getConnection(_0x543775){return request({'method':_0xc25f('0xd'),'form':{'method':_0xc25f('0x4d'),'input_type':'JSON','response_type':_0xc25f('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x543775[_0xc25f('0x4e')],'password':_0x543775[_0xc25f('0x4f')],'encryption':_0xc25f('0x50')},'application':_0xc25f('0x51')})}})[_0xc25f('0x2d')](function(_0x52cf31){var _0x4d3dec=_0x52cf31;if(_0x4d3dec['id']){def[_0xc25f('0x52')]=_0x4d3dec['id'];return BPromise[_0xc25f('0x32')](_0x4d3dec);}else{throw new Error(util['format'](_0xc25f('0x53'),_0x543775['id']));}});}function setRelationship(_0x4a7d9a,_0x498b61,_0x11882b,_0xd41cf6){return request({'form':{'method':'set_relationship','input_type':_0xc25f('0x23'),'response_type':_0xc25f('0x23'),'rest_data':JSON[_0xc25f('0x24')]({'session':_0x4a7d9a['id'],'module_name':_0xc25f('0x25'),'module_id':_0x11882b['id'],'link_field_name':_0xd41cf6,'related_ids':[_0x498b61['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xc25f('0x54')]=function(_0x5594a8,_0x332573,_0x57dca8,_0xbe66a2,_0x34e0dc,_0x1a9adf){var _0x4de94d,_0x2c9fc4,_0x44763b,_0x380d83;_0x1a9adf[_0xc25f('0x55')]=intUtil[_0xc25f('0x56')](_0x1a9adf[_0xc25f('0x55')]);_0x1a9adf[_0xc25f('0x57')]=intUtil[_0xc25f('0x56')](_0x1a9adf[_0xc25f('0x57')]);def[_0xc25f('0x58')]=util['format'](_0xc25f('0x59'),_0x1a9adf[_0xc25f('0x55')]);if(_0x34e0dc&&_0x34e0dc[_0xc25f('0x5a')]){logger[_0xc25f('0x2b')](_0xc25f('0x5b'),_0xc25f('0x5c'));_0x332573[_0xc25f('0x5d')]=util[_0xc25f('0x26')](_0xc25f('0x5e'),_0x1a9adf[_0xc25f('0x57')],_0x332573[_0xc25f('0x5f')],md5(_0x332573['uniqueid']));}else{_0x332573['recordingURL']='';}return getConnection(_0x1a9adf)[_0xc25f('0x2d')](function(_0x5035a7){_0x380d83=_0x5035a7;return getUser(_0x1a9adf,_0xbe66a2[_0xc25f('0x10')],_0x380d83);})[_0xc25f('0x2d')](function(_0x15d0ef){_0x4de94d=_0x15d0ef;logger[_0xc25f('0x2b')](_0xc25f('0x60'),_0x4de94d['id']);return getEndUser(_0x1a9adf,_0x332573[_0xc25f('0x61')],_0x332573[_0xc25f('0x62')],_0x380d83);})['then'](function(_0x326302){_0x2c9fc4=_0x326302;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2c9fc4['id']);return getTicket(_0x1a9adf,_0x4de94d,_0x2c9fc4,_0x57dca8,_0x332573,_0x57dca8[_0xc25f('0x63')],_0x380d83,'Inbound');})[_0xc25f('0x2d')](function(_0x37922b){_0x44763b=_0x37922b;logger[_0xc25f('0x2b')](_0xc25f('0x64'));logger[_0xc25f('0x2b')](_0xc25f('0x65'),_0x44763b['id']);return setRelationship(_0x380d83,_0x4de94d,_0x44763b,_0xc25f('0x66'));})[_0xc25f('0x2d')](function(){return setRelationship(_0x380d83,_0x2c9fc4,_0x44763b,_0xc25f('0x67'));})[_0xc25f('0x2d')](function(){return getServerInfo(_0x380d83);})['then'](function(_0x2a48aa){var _0x533ed3=parseInt(_0x2a48aa[_0xc25f('0x68')][_0xc25f('0x69')](0x0));var _0x261899=util[_0xc25f('0x26')](_0xc25f('0x6a'),_0x1a9adf[_0xc25f('0x55')],_0x44763b['id']);if(_0x533ed3>0x6){_0x261899=util['format'](_0xc25f('0x6b'),_0x1a9adf[_0xc25f('0x55')],_0x44763b['id']);}logger[_0xc25f('0x2b')](_0xc25f('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc25f('0x26')]('user:%s',_0xbe66a2[_0xc25f('0x10')]),_0xc25f('0x6c'),{'uri':_0x261899});})['catch'](function(_0x3e5a1c){logger[_0xc25f('0x6d')](_0xc25f('0x5b'),JSON[_0xc25f('0x24')](_0x3e5a1c));});};exports[_0xc25f('0x6e')]=function(_0x19f228,_0x367f41,_0x22074f,_0x120a4c,_0xc88c2c,_0x109768,_0x2ff0eb){var _0x257a7e,_0x2fd46d,_0x259173,_0x53ae33;_0x109768[_0xc25f('0x55')]=intUtil[_0xc25f('0x56')](_0x109768['remoteUri']);_0x109768[_0xc25f('0x57')]=intUtil[_0xc25f('0x56')](_0x109768[_0xc25f('0x57')]);def[_0xc25f('0x58')]=util[_0xc25f('0x26')](_0xc25f('0x59'),_0x109768[_0xc25f('0x55')]);if(_0x2ff0eb&&_0x2ff0eb['recordingFormat']&&_0x2ff0eb[_0xc25f('0x6f')]!==_0xc25f('0x70')){logger[_0xc25f('0x2b')](_0xc25f('0x71'),_0xc25f('0x5c'));_0x367f41['recordingURL']=util['format'](_0xc25f('0x5e'),_0x109768[_0xc25f('0x57')],_0x367f41[_0xc25f('0x5f')],md5(_0x367f41['uniqueid']));}return getConnection(_0x109768)[_0xc25f('0x2d')](function(_0x37e882){_0x53ae33=_0x37e882;return getUser(_0x109768,_0x120a4c[_0xc25f('0x10')],_0x53ae33);})['then'](function(_0x227ed7){_0x257a7e=_0x227ed7;logger['info']('The\x20User\x20ID\x20is:',_0x257a7e['id']);return getEndUser(_0x109768,_0x367f41[_0xc25f('0x72')],_0x367f41[_0xc25f('0x73')],_0x53ae33);})[_0xc25f('0x2d')](function(_0x2553dd){_0x2fd46d=_0x2553dd;logger[_0xc25f('0x2b')](_0xc25f('0x74'),_0x2fd46d['id']);return getTicket(_0x109768,_0x257a7e,_0x2fd46d,_0x22074f,_0x367f41,_0x22074f[_0xc25f('0x63')],_0x53ae33,_0xc25f('0x75'));})[_0xc25f('0x2d')](function(_0x3fb472){_0x259173=_0x3fb472;logger['info'](_0xc25f('0x64'));logger[_0xc25f('0x2b')](_0xc25f('0x65'),_0x259173['id']);return setRelationship(_0x53ae33,_0x257a7e,_0x259173,'users');})[_0xc25f('0x2d')](function(){return setRelationship(_0x53ae33,_0x2fd46d,_0x259173,_0xc25f('0x67'));})['then'](function(){return getServerInfo(_0x53ae33);})[_0xc25f('0x2d')](function(_0x22f933){var _0x6efb08=parseInt(_0x22f933['version']['charAt'](0x0));var _0x3acb30=util[_0xc25f('0x26')](_0xc25f('0x6a'),_0x109768[_0xc25f('0x55')],_0x259173['id']);if(_0x6efb08>0x6){_0x3acb30=util[_0xc25f('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x109768[_0xc25f('0x55')],_0x259173['id']);}logger[_0xc25f('0x2b')](_0xc25f('0x71'),_0xc25f('0x76'));emit(util[_0xc25f('0x26')](_0xc25f('0x77'),_0x120a4c[_0xc25f('0x10')]),_0xc25f('0x6c'),{'uri':_0x3acb30});})[_0xc25f('0x78')](function(_0x4af903){logger[_0xc25f('0x6d')](_0xc25f('0x71'),JSON[_0xc25f('0x24')](_0x4af903));});};exports['unmanaged']=function(_0x3ac32f,_0x5a7507,_0x570d6e,_0x40b2e8,_0x260118,_0x5f3269){var _0x2061be,_0x423e1f,_0x2fe0bb,_0x53e1de;_0x5f3269[_0xc25f('0x55')]=intUtil[_0xc25f('0x56')](_0x5f3269[_0xc25f('0x55')]);_0x5f3269[_0xc25f('0x57')]=intUtil[_0xc25f('0x56')](_0x5f3269['serverUrl']);def[_0xc25f('0x58')]=util[_0xc25f('0x26')](_0xc25f('0x59'),_0x5f3269['remoteUri']);if(_0x260118&&_0x260118['monitor_format']){logger[_0xc25f('0x2b')]('['+_0x5a7507[_0xc25f('0x79')][_0xc25f('0x7a')]()+']',_0xc25f('0x5c'));_0x5a7507[_0xc25f('0x5d')]=util[_0xc25f('0x26')](_0xc25f('0x5e'),_0x5f3269[_0xc25f('0x57')],_0x5a7507[_0xc25f('0x5f')],md5(_0x5a7507['uniqueid']));}else{_0x5a7507[_0xc25f('0x5d')]='';}return getConnection(_0x5f3269)[_0xc25f('0x2d')](function(_0x5d007c){_0x53e1de=_0x5d007c;if(!_[_0xc25f('0x2a')](_0x40b2e8)){return getUser(_0x5f3269,_0x40b2e8['name'],_0x53e1de);}else{return getUser(_0x5f3269,null,_0x53e1de);}})[_0xc25f('0x2d')](function(_0x50e9ac){_0x2061be=_0x50e9ac;logger[_0xc25f('0x2b')](_0xc25f('0x60'),_0x2061be['id']);return getEndUser(_0x5f3269,_0x5a7507['calleridname'],_0x5a7507[_0xc25f('0x62')],_0x53e1de);})[_0xc25f('0x2d')](function(_0x415b15){_0x423e1f=_0x415b15;logger[_0xc25f('0x2b')](_0xc25f('0x74'),_0x423e1f['id']);return getTicket(_0x5f3269,_0x2061be,_0x423e1f,_0x570d6e,_0x5a7507,_0x570d6e[_0xc25f('0x63')],_0x53e1de,_0xc25f('0x7b'));})[_0xc25f('0x2d')](function(_0xd24b71){_0x2fe0bb=_0xd24b71;logger[_0xc25f('0x2b')](_0xc25f('0x64'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x2fe0bb['id']);return setRelationship(_0x53e1de,_0x2061be,_0x2fe0bb,_0xc25f('0x66'));})['then'](function(){return setRelationship(_0x53e1de,_0x423e1f,_0x2fe0bb,'contacts');})[_0xc25f('0x2d')](function(){return getServerInfo(_0x53e1de);})[_0xc25f('0x78')](function(_0x2b8f36){logger[_0xc25f('0x6d')]('['+_0x5a7507['lastevent'][_0xc25f('0x7a')]()+']',JSON[_0xc25f('0x24')](_0x2b8f36));});}; \ No newline at end of file +var _0x8ab5=['PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','charAt','[OUTBOUND]','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','emit','info','Creating\x20new\x20ticket...','name','getString','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','variableName','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','nameField','content','type','string','customField','custom_fields','variable','push','customVariable','Variable','toLowerCase','POST','login','username','password'];(function(_0x4063fd,_0x4b4af5){var _0x29c583=function(_0x20da37){while(--_0x20da37){_0x4063fd['push'](_0x4063fd['shift']());}};_0x29c583(++_0x4b4af5);}(_0x8ab5,0x124));var _0x58ab=function(_0x2ddbe7,_0x4906a0){_0x2ddbe7=_0x2ddbe7-0x0;var _0x257b20=_0x8ab5[_0x2ddbe7];return _0x257b20;};'use strict';var _=require(_0x58ab('0x0'));var rp=require('request-promise');var BPromise=require(_0x58ab('0x1'));var md5=require(_0x58ab('0x2'));var util=require(_0x58ab('0x3'));var Redis=require(_0x58ab('0x4'));var intUtil=require('./util');var config=require(_0x58ab('0x5'));var logger=require(_0x58ab('0x6'))(_0x58ab('0x7'));config[_0x58ab('0x8')]=_[_0x58ab('0x9')](config['redis'],{'host':_0x58ab('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x58ab('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x28d9a1,_0x6480d,_0x504f87){io['to'](_0x28d9a1)[_0x58ab('0xb')](_0x6480d,_0x504f87);}function getTicket(_0xdbd981,_0xe8f5b4,_0x1e789d,_0x290942,_0x4c048c,_0x3f75e8,_0x373823,_0x2c8271){logger[_0x58ab('0xc')](_0x58ab('0xd'));var _0x3d087b=new Date();var _0x7a69a9=[{'name':_0x58ab('0xe'),'value':intUtil[_0x58ab('0xf')](_0x290942['Subjects'],_0x4c048c,'\x20')},{'name':_0x58ab('0x10'),'value':_0xe8f5b4['id']},{'name':'created_by','value':_0xe8f5b4['id']},{'name':_0x58ab('0x11'),'value':intUtil[_0x58ab('0xf')](_0x290942[_0x58ab('0x12')],_0x4c048c,'\x0a')},{'name':_0x58ab('0x13'),'value':_0x3d087b[_0x58ab('0x14')]()[_0x58ab('0x15')](0x0,0x13)[_0x58ab('0x16')]('T','\x20')},{'name':_0x58ab('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x58ab('0x18'),'value':_0x1e789d['id']},{'name':_0x58ab('0x19'),'value':'Contacts'},{'name':_0x58ab('0x1a'),'value':_0x1e789d['name']},{'name':_0x58ab('0x1b'),'value':_0x2c8271}];if(_0x3f75e8[_0x58ab('0x1c')]){_['forEach'](_0x3f75e8,function(_0x3071f1){if(_0x4c048c[_0x3071f1[_0x58ab('0x1d')]]){_0x7a69a9['push']({'name':_0x3071f1[_0x58ab('0x1e')],'value':_0x4c048c[_0x3071f1[_0x58ab('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x58ab('0x1f'),'response_type':_0x58ab('0x1f'),'rest_data':JSON[_0x58ab('0x20')]({'session':_0x373823['id'],'module_name':_0x58ab('0x21'),'name_value_list':_0x7a69a9})}});}function getAuth(_0x5e3562){return util[_0x58ab('0x22')](_0x58ab('0x23'),new Buffer(_0x5e3562[_0x58ab('0x24')]+':X')[_0x58ab('0x25')](_0x58ab('0x26')));}function getServerInfo(_0x88cccd){return request({'form':{'method':_0x58ab('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x88cccd['id']})}});}function getUser(_0x39da77,_0x1acb72,_0x47f620){if(!_[_0x58ab('0x28')](_0x1acb72)){logger['info']('Getting\x20agent\x20with\x20name',_0x1acb72);return request({'form':{'method':_0x58ab('0x29'),'input_type':_0x58ab('0x1f'),'response_type':'JSON','rest_data':JSON[_0x58ab('0x20')]({'session':_0x47f620['id'],'module_name':_0x58ab('0x2a'),'query':util[_0x58ab('0x22')](_0x58ab('0x2b'),_0x1acb72),'order_by':'','offset':'0','select_fields':['id',_0x58ab('0xe'),_0x58ab('0x2c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x58ab('0x2d')](function(_0x4b7984){if(_0x4b7984[_0x58ab('0x2e')][_0x58ab('0x1c')]){var _0x4bbac1=_[_0x58ab('0x2f')](_0x4b7984['entry_list'],function(_0x598af8){return _0x598af8['name_value_list'][_0x58ab('0x2c')][_0x58ab('0x30')]===_0x1acb72;});if(_0x4bbac1){logger['info']('Agent\x20found!');return BPromise[_0x58ab('0x31')]({'id':_0x4bbac1[_0x58ab('0x32')]['id'][_0x58ab('0x30')],'name':_0x4bbac1['name_value_list']['name'][_0x58ab('0x30')]});}}logger['info'](_0x58ab('0x33'));return BPromise[_0x58ab('0x31')]({'id':_0x47f620[_0x58ab('0x32')][_0x58ab('0x34')][_0x58ab('0x30')],'name':_0x47f620['name_value_list'][_0x58ab('0x2c')][_0x58ab('0x30')]});});}else{logger[_0x58ab('0xc')](_0x58ab('0x35'));return BPromise[_0x58ab('0x31')]({'id':_0x47f620['name_value_list'][_0x58ab('0x34')][_0x58ab('0x30')],'name':_0x47f620[_0x58ab('0x32')][_0x58ab('0x2c')][_0x58ab('0x30')]});}}function getEndUser(_0x46edb9,_0x39254f,_0x57e1fe,_0x1f3d1e){logger['info'](_0x58ab('0x36'),_0x57e1fe);return request({'form':{'method':_0x58ab('0x29'),'input_type':'JSON','response_type':_0x58ab('0x1f'),'rest_data':JSON['stringify']({'session':_0x1f3d1e['id'],'module_name':_0x58ab('0x37'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x57e1fe),'order_by':'','offset':'0','select_fields':['id','name',_0x58ab('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xc0f430){if(_0xc0f430[_0x58ab('0x2e')][_0x58ab('0x1c')]){var _0x3b53c8=_[_0x58ab('0x2f')](_0xc0f430[_0x58ab('0x2e')],function(_0x58da32){return _0x58da32[_0x58ab('0x32')]['phone_home'][_0x58ab('0x30')]===_0x57e1fe;});if(_0x3b53c8){logger['info'](_0x58ab('0x39'));return BPromise[_0x58ab('0x31')]({'id':_0x3b53c8[_0x58ab('0x32')]['id'][_0x58ab('0x30')],'name':_0x3b53c8[_0x58ab('0x32')][_0x58ab('0xe')][_0x58ab('0x30')],'phone':_0x3b53c8[_0x58ab('0x32')][_0x58ab('0x38')][_0x58ab('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x58ab('0x3a'),'input_type':_0x58ab('0x1f'),'response_type':'JSON','rest_data':JSON[_0x58ab('0x20')]({'session':_0x1f3d1e['id'],'module_name':_0x58ab('0x37'),'name_value_list':[{'name':_0x58ab('0x3b'),'value':_0x39254f!==_0x58ab('0x3c')?_0x39254f:util['format'](_0x58ab('0x3d'),_0x57e1fe)},{'name':_0x58ab('0x38'),'value':_0x57e1fe}]})}})[_0x58ab('0x2d')](function(_0x4f89c7){logger[_0x58ab('0xc')](_0x58ab('0x3e'));return BPromise['resolve']({'id':_0x4f89c7['id'],'name':_0x4f89c7['entry_list'][_0x58ab('0x3b')][_0x58ab('0x30')],'phone':_0x4f89c7['entry_list']['phone_home'][_0x58ab('0x30')]});});}});}function request(_0x364def){logger[_0x58ab('0x3f')](_0x58ab('0x40'),JSON[_0x58ab('0x20')](_0x364def));return rp(_[_0x58ab('0x41')](def,_0x364def));}function getTags(_0x3c5485,_0x1be61f){var _0x412136=[];if(_0x3c5485&&_0x3c5485['length']>0x0){_0x412136=_[_0x58ab('0x42')](_0x3c5485,_0x1be61f);}return _0x412136;}function getCustomFields(_0x147170,_0x67fe4d){var _0xc221fb=[];var _0x5d4a06={'custom_fields':[]};if(_0x147170[_0x58ab('0x1c')]>0x0){_[_0x58ab('0x43')](_0x147170,function(_0x1ad325){if(_0x1ad325['type']==='string'&&_0x1ad325[_0x58ab('0x44')]&&!_0x1ad325['customField']){_0x5d4a06[_0x1ad325['nameField']['toLowerCase']()]=_0x1ad325[_0x58ab('0x45')][_0x58ab('0x25')]();}else if(_0x1ad325[_0x58ab('0x46')]===_0x58ab('0x47')&&_0x1ad325[_0x58ab('0x1e')]&&_0x1ad325[_0x58ab('0x48')]){_0x5d4a06[_0x58ab('0x49')]['push']({'id':_0x1ad325[_0x58ab('0x1e')],'value':_0x1ad325[_0x58ab('0x45')][_0x58ab('0x25')]()});}else if(_0x1ad325[_0x58ab('0x46')]===_0x58ab('0x4a')&&_0x1ad325[_0x58ab('0x1d')]&&_0x1ad325[_0x58ab('0x1e')]&&_0x1ad325[_0x58ab('0x48')]){_0x67fe4d[_0x1ad325[_0x58ab('0x1d')]]&&_0x5d4a06[_0x58ab('0x49')][_0x58ab('0x4b')]({'id':_0x1ad325['idField'],'value':_0x67fe4d[_0x1ad325[_0x58ab('0x1d')]][_0x58ab('0x25')]()});}else if(_0x1ad325['type']===_0x58ab('0x4c')&&_0x1ad325[_0x58ab('0x4d')]&&_0x1ad325[_0x58ab('0x4d')][_0x58ab('0xe')]&&_0x1ad325[_0x58ab('0x1e')]&&_0x1ad325[_0x58ab('0x48')]){_0x67fe4d[_0x1ad325[_0x58ab('0x4d')]['name']['toLowerCase']()]&&_0x5d4a06['custom_fields'][_0x58ab('0x4b')]({'id':_0x1ad325[_0x58ab('0x1e')],'value':_0x67fe4d[_0x1ad325[_0x58ab('0x4d')][_0x58ab('0xe')][_0x58ab('0x4e')]()][_0x58ab('0x25')]()});}});}return _0x5d4a06;}function getConnection(_0x43984c){return request({'method':_0x58ab('0x4f'),'form':{'method':_0x58ab('0x50'),'input_type':_0x58ab('0x1f'),'response_type':_0x58ab('0x1f'),'rest_data':JSON[_0x58ab('0x20')]({'user_auth':{'user_name':_0x43984c[_0x58ab('0x51')],'password':_0x43984c[_0x58ab('0x52')],'encryption':_0x58ab('0x53')},'application':_0x58ab('0x54')})}})[_0x58ab('0x2d')](function(_0xf7b668){var _0x34a16b=_0xf7b668;if(_0x34a16b['id']){def['sessionID']=_0x34a16b['id'];return BPromise[_0x58ab('0x31')](_0x34a16b);}else{throw new Error(util['format'](_0x58ab('0x55'),_0x43984c['id']));}});}function setRelationship(_0x32b667,_0x28b8cd,_0x4c063f,_0x36175c){return request({'form':{'method':_0x58ab('0x56'),'input_type':_0x58ab('0x1f'),'response_type':_0x58ab('0x1f'),'rest_data':JSON[_0x58ab('0x20')]({'session':_0x32b667['id'],'module_name':'Calls','module_id':_0x4c063f['id'],'link_field_name':_0x36175c,'related_ids':[_0x28b8cd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x58ab('0x57')]=function(_0x11a726,_0x49557c,_0x217d65,_0x2f7487,_0x186783,_0x361282){var _0x4f349f,_0x586c14,_0x24f4a2,_0x5bee5d;_0x361282[_0x58ab('0x58')]=intUtil['stripTrailingSlash'](_0x361282['remoteUri']);_0x361282[_0x58ab('0x59')]=intUtil[_0x58ab('0x5a')](_0x361282['serverUrl']);def[_0x58ab('0x5b')]=util['format']('%s/service/v4_1/rest.php',_0x361282[_0x58ab('0x58')]);if(_0x186783&&_0x186783[_0x58ab('0x5c')]){logger[_0x58ab('0xc')](_0x58ab('0x5d'),'Recording\x20is\x20enabled!');_0x49557c[_0x58ab('0x5e')]=util[_0x58ab('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x361282[_0x58ab('0x59')],_0x49557c[_0x58ab('0x5f')],md5(_0x49557c[_0x58ab('0x5f')]));}else{_0x49557c[_0x58ab('0x5e')]='';}return getConnection(_0x361282)[_0x58ab('0x2d')](function(_0x2a9a98){_0x5bee5d=_0x2a9a98;return getUser(_0x361282,_0x2f7487['name'],_0x5bee5d);})['then'](function(_0x5d7b44){_0x4f349f=_0x5d7b44;logger[_0x58ab('0xc')](_0x58ab('0x60'),_0x4f349f['id']);return getEndUser(_0x361282,_0x49557c[_0x58ab('0x61')],_0x49557c['calleridnum'],_0x5bee5d);})[_0x58ab('0x2d')](function(_0x1e8156){_0x586c14=_0x1e8156;logger['info'](_0x58ab('0x62'),_0x586c14['id']);return getTicket(_0x361282,_0x4f349f,_0x586c14,_0x217d65,_0x49557c,_0x217d65[_0x58ab('0x63')],_0x5bee5d,_0x58ab('0x64'));})[_0x58ab('0x2d')](function(_0x12964f){_0x24f4a2=_0x12964f;logger[_0x58ab('0xc')](_0x58ab('0x65'));logger[_0x58ab('0xc')](_0x58ab('0x66'),_0x24f4a2['id']);return setRelationship(_0x5bee5d,_0x4f349f,_0x24f4a2,_0x58ab('0x67'));})[_0x58ab('0x2d')](function(){return setRelationship(_0x5bee5d,_0x586c14,_0x24f4a2,_0x58ab('0x68'));})['then'](function(){return getServerInfo(_0x5bee5d);})['then'](function(_0x1b389f){var _0x1b0deb=parseInt(_0x1b389f[_0x58ab('0x69')]['charAt'](0x0));var _0x22fb78=util[_0x58ab('0x22')](_0x58ab('0x6a'),_0x361282[_0x58ab('0x58')],_0x24f4a2['id']);if(_0x1b0deb>0x6){_0x22fb78=util[_0x58ab('0x22')](_0x58ab('0x6b'),_0x361282[_0x58ab('0x58')],_0x24f4a2['id']);}logger['info'](_0x58ab('0x5d'),_0x58ab('0x6c'));emit(util['format'](_0x58ab('0x6d'),_0x2f7487['name']),'trigger:browser:url',{'uri':_0x22fb78});})['catch'](function(_0x180983){logger[_0x58ab('0x6e')]('[QUEUE]',JSON[_0x58ab('0x20')](_0x180983));});};exports[_0x58ab('0x6f')]=function(_0x3b500d,_0x348439,_0x110396,_0x462bb8,_0x2ba392,_0x116eb5,_0x21ebd4){var _0x502f50,_0x4dcb78,_0x36420a,_0x4308f4;_0x116eb5[_0x58ab('0x58')]=intUtil['stripTrailingSlash'](_0x116eb5[_0x58ab('0x58')]);_0x116eb5[_0x58ab('0x59')]=intUtil[_0x58ab('0x5a')](_0x116eb5[_0x58ab('0x59')]);def[_0x58ab('0x5b')]=util[_0x58ab('0x22')](_0x58ab('0x70'),_0x116eb5[_0x58ab('0x58')]);if(_0x21ebd4&&_0x21ebd4['recordingFormat']&&_0x21ebd4[_0x58ab('0x71')]!==_0x58ab('0x72')){logger[_0x58ab('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x348439['recordingURL']=util['format'](_0x58ab('0x73'),_0x116eb5[_0x58ab('0x59')],_0x348439[_0x58ab('0x5f')],md5(_0x348439[_0x58ab('0x5f')]));}return getConnection(_0x116eb5)[_0x58ab('0x2d')](function(_0x3221af){_0x4308f4=_0x3221af;return getUser(_0x116eb5,_0x462bb8[_0x58ab('0xe')],_0x4308f4);})['then'](function(_0x129eea){_0x502f50=_0x129eea;logger[_0x58ab('0xc')](_0x58ab('0x60'),_0x502f50['id']);return getEndUser(_0x116eb5,_0x348439['destcalleridname'],_0x348439[_0x58ab('0x74')],_0x4308f4);})[_0x58ab('0x2d')](function(_0x594579){_0x4dcb78=_0x594579;logger['info'](_0x58ab('0x62'),_0x4dcb78['id']);return getTicket(_0x116eb5,_0x502f50,_0x4dcb78,_0x110396,_0x348439,_0x110396[_0x58ab('0x63')],_0x4308f4,'Outbound');})[_0x58ab('0x2d')](function(_0x28e8a9){_0x36420a=_0x28e8a9;logger['info']('Ticket\x20created!');logger['info'](_0x58ab('0x66'),_0x36420a['id']);return setRelationship(_0x4308f4,_0x502f50,_0x36420a,_0x58ab('0x67'));})['then'](function(){return setRelationship(_0x4308f4,_0x4dcb78,_0x36420a,_0x58ab('0x68'));})[_0x58ab('0x2d')](function(){return getServerInfo(_0x4308f4);})[_0x58ab('0x2d')](function(_0x490556){var _0x2e9a87=parseInt(_0x490556[_0x58ab('0x69')][_0x58ab('0x75')](0x0));var _0x41bead=util[_0x58ab('0x22')](_0x58ab('0x6a'),_0x116eb5[_0x58ab('0x58')],_0x36420a['id']);if(_0x2e9a87>0x6){_0x41bead=util[_0x58ab('0x22')](_0x58ab('0x6b'),_0x116eb5[_0x58ab('0x58')],_0x36420a['id']);}logger[_0x58ab('0xc')](_0x58ab('0x76'),_0x58ab('0x6c'));emit(util[_0x58ab('0x22')]('user:%s',_0x462bb8['name']),_0x58ab('0x77'),{'uri':_0x41bead});})[_0x58ab('0x78')](function(_0x428033){logger[_0x58ab('0x6e')](_0x58ab('0x76'),JSON[_0x58ab('0x20')](_0x428033));});};exports[_0x58ab('0x79')]=function(_0x4318c4,_0x21859e,_0x5380e0,_0x1aed32,_0x5a30af,_0x1f21ca){var _0x4327b3,_0x5496d8,_0x288e7c,_0xa99fc3;_0x1f21ca[_0x58ab('0x58')]=intUtil['stripTrailingSlash'](_0x1f21ca[_0x58ab('0x58')]);_0x1f21ca[_0x58ab('0x59')]=intUtil['stripTrailingSlash'](_0x1f21ca[_0x58ab('0x59')]);def[_0x58ab('0x5b')]=util[_0x58ab('0x22')](_0x58ab('0x70'),_0x1f21ca[_0x58ab('0x58')]);if(_0x5a30af&&_0x5a30af[_0x58ab('0x5c')]){logger[_0x58ab('0xc')]('['+_0x21859e[_0x58ab('0x7a')][_0x58ab('0x7b')]()+']',_0x58ab('0x7c'));_0x21859e[_0x58ab('0x5e')]=util[_0x58ab('0x22')](_0x58ab('0x73'),_0x1f21ca[_0x58ab('0x59')],_0x21859e[_0x58ab('0x5f')],md5(_0x21859e[_0x58ab('0x5f')]));}else{_0x21859e[_0x58ab('0x5e')]='';}return getConnection(_0x1f21ca)['then'](function(_0x113192){_0xa99fc3=_0x113192;if(!_['isNil'](_0x1aed32)){return getUser(_0x1f21ca,_0x1aed32[_0x58ab('0xe')],_0xa99fc3);}else{return getUser(_0x1f21ca,null,_0xa99fc3);}})[_0x58ab('0x2d')](function(_0x1f808d){_0x4327b3=_0x1f808d;logger[_0x58ab('0xc')]('The\x20User\x20ID\x20is:',_0x4327b3['id']);return getEndUser(_0x1f21ca,_0x21859e[_0x58ab('0x61')],_0x21859e['calleridnum'],_0xa99fc3);})[_0x58ab('0x2d')](function(_0x3f7aa5){_0x5496d8=_0x3f7aa5;logger[_0x58ab('0xc')](_0x58ab('0x62'),_0x5496d8['id']);return getTicket(_0x1f21ca,_0x4327b3,_0x5496d8,_0x5380e0,_0x21859e,_0x5380e0[_0x58ab('0x63')],_0xa99fc3,'Inbound');})[_0x58ab('0x2d')](function(_0x4ade67){_0x288e7c=_0x4ade67;logger[_0x58ab('0xc')]('Ticket\x20created!');logger[_0x58ab('0xc')](_0x58ab('0x66'),_0x288e7c['id']);return setRelationship(_0xa99fc3,_0x4327b3,_0x288e7c,_0x58ab('0x67'));})[_0x58ab('0x2d')](function(){return setRelationship(_0xa99fc3,_0x5496d8,_0x288e7c,'contacts');})[_0x58ab('0x2d')](function(){return getServerInfo(_0xa99fc3);})[_0x58ab('0x78')](function(_0x4925f9){logger[_0x58ab('0x6e')]('['+_0x21859e[_0x58ab('0x7a')][_0x58ab('0x7b')]()+']',JSON[_0x58ab('0x20')](_0x4925f9));});}; \ 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 0f1fe68..6b29061 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 _0xa9bb=['join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','util','getString','length','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','key','%s:\x20%s','keyContent','keyType','customVariable','format'];(function(_0x545a3a,_0x3123aa){var _0x5a5493=function(_0x4e6bce){while(--_0x4e6bce){_0x545a3a['push'](_0x545a3a['shift']());}};_0x5a5493(++_0x3123aa);}(_0xa9bb,0x1f4));var _0xba9b=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xa9bb[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require('lodash');var util=require(_0xba9b('0x0'));exports[_0xba9b('0x1')]=function(_0x54ba87,_0x2232cf,_0x4087f6){var _0x111804=[];if(_0x54ba87[_0xba9b('0x2')]>0x0){var _0x207c54=_['sortBy'](_0x54ba87,['id']);for(var _0x65af31=0x0;_0x65af31<_0x207c54[_0xba9b('0x2')];_0x65af31++){var _0xd693d2=_0x207c54[_0x65af31];if(_0xd693d2['type']===_0xba9b('0x3')){_0x111804[_0xba9b('0x4')](_0xd693d2[_0xba9b('0x5')]);}else if(_0xd693d2[_0xba9b('0x6')]===_0xba9b('0x7')&&_0xd693d2[_0xba9b('0x8')]){_0x2232cf[_0xd693d2['variableName']]&&_0x111804[_0xba9b('0x4')](_0x2232cf[_0xd693d2['variableName']][_0xba9b('0x9')]());}else if(_0xd693d2[_0xba9b('0x6')]==='customVariable'&&_0xd693d2['Variable']&&_0xd693d2[_0xba9b('0xa')][_0xba9b('0xb')]){_0x2232cf[_0xd693d2[_0xba9b('0xa')]['name'][_0xba9b('0xc')]()]&&_0x111804[_0xba9b('0x4')](_0x2232cf[_0xd693d2[_0xba9b('0xa')][_0xba9b('0xb')][_0xba9b('0xc')]()][_0xba9b('0x9')]());}else if(_0xd693d2[_0xba9b('0x6')]===_0xba9b('0xd')){if(_0xd693d2['keyType']==='string'&&_0xd693d2[_0xba9b('0xe')]){_0x111804['push'](util['format'](_0xba9b('0xf'),_0xd693d2[_0xba9b('0xe')],_0xd693d2[_0xba9b('0x10')]));}else if(_0xd693d2[_0xba9b('0x11')]===_0xba9b('0x7')&&_0xd693d2['variableName']&&_0xd693d2[_0xba9b('0xe')]){_0x2232cf[_0xd693d2[_0xba9b('0x8')]]&&_0x111804[_0xba9b('0x4')](util['format'](_0xba9b('0xf'),_0xd693d2['key'],_0x2232cf[_0xd693d2['variableName']]));}else if(_0xd693d2[_0xba9b('0x11')]===_0xba9b('0x12')&&_0xd693d2[_0xba9b('0xa')]&&_0xd693d2[_0xba9b('0xa')][_0xba9b('0xb')]&&_0xd693d2[_0xba9b('0xe')]){_0x2232cf[_0xd693d2[_0xba9b('0xa')]['name'][_0xba9b('0xc')]()]&&_0x111804['push'](util[_0xba9b('0x13')](_0xba9b('0xf'),_0xd693d2[_0xba9b('0xe')],_0x2232cf[_0xd693d2[_0xba9b('0xa')]['name']['toLowerCase']()]));}}}}return _0x111804[_0xba9b('0x14')](_0x4087f6);};exports[_0xba9b('0x15')]=function(_0x4607c9){var _0xf17ef9=_0x4607c9[_0xba9b('0x16')](-0x1);if(_0xf17ef9==='/'){_0x4607c9=_0x4607c9[_0xba9b('0x17')](0x0,_0x4607c9[_0xba9b('0x18')](_0xf17ef9));}return _0x4607c9;};exports['validateEmail']=function(_0x3b439f){if(!_[_0xba9b('0x19')](_0x3b439f)&&_0x3b439f!==''){var _0x180ac4=/^(([^<>()\[\]\\.,;:\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 _0x180ac4['test'](String(_0x3b439f)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xc6cd=['slice','substring','lastIndexOf','test','lodash','util','length','sortBy','string','push','content','type','variableName','Variable','name','toLowerCase','keyType','key','%s:\x20%s','keyContent','variable','format','join','stripTrailingSlash'];(function(_0x4e009f,_0xd40de0){var _0x1d5cae=function(_0x36d49f){while(--_0x36d49f){_0x4e009f['push'](_0x4e009f['shift']());}};_0x1d5cae(++_0xd40de0);}(_0xc6cd,0xc4));var _0xdc6c=function(_0x382c39,_0x2a5cae){_0x382c39=_0x382c39-0x0;var _0x1c2f34=_0xc6cd[_0x382c39];return _0x1c2f34;};'use strict';var _=require(_0xdc6c('0x0'));var util=require(_0xdc6c('0x1'));exports['getString']=function(_0x1b6744,_0x1d443f,_0x28d136){var _0x3628ae=[];if(_0x1b6744[_0xdc6c('0x2')]>0x0){var _0x42ccff=_[_0xdc6c('0x3')](_0x1b6744,['id']);for(var _0x9be8d=0x0;_0x9be8d<_0x42ccff[_0xdc6c('0x2')];_0x9be8d++){var _0x3815c1=_0x42ccff[_0x9be8d];if(_0x3815c1['type']===_0xdc6c('0x4')){_0x3628ae[_0xdc6c('0x5')](_0x3815c1[_0xdc6c('0x6')]);}else if(_0x3815c1[_0xdc6c('0x7')]==='variable'&&_0x3815c1[_0xdc6c('0x8')]){_0x1d443f[_0x3815c1[_0xdc6c('0x8')]]&&_0x3628ae['push'](_0x1d443f[_0x3815c1[_0xdc6c('0x8')]]['toString']());}else if(_0x3815c1[_0xdc6c('0x7')]==='customVariable'&&_0x3815c1[_0xdc6c('0x9')]&&_0x3815c1[_0xdc6c('0x9')][_0xdc6c('0xa')]){_0x1d443f[_0x3815c1['Variable'][_0xdc6c('0xa')][_0xdc6c('0xb')]()]&&_0x3628ae['push'](_0x1d443f[_0x3815c1['Variable']['name'][_0xdc6c('0xb')]()]['toString']());}else if(_0x3815c1['type']==='keyValue'){if(_0x3815c1[_0xdc6c('0xc')]===_0xdc6c('0x4')&&_0x3815c1[_0xdc6c('0xd')]){_0x3628ae[_0xdc6c('0x5')](util['format'](_0xdc6c('0xe'),_0x3815c1[_0xdc6c('0xd')],_0x3815c1[_0xdc6c('0xf')]));}else if(_0x3815c1[_0xdc6c('0xc')]===_0xdc6c('0x10')&&_0x3815c1['variableName']&&_0x3815c1[_0xdc6c('0xd')]){_0x1d443f[_0x3815c1[_0xdc6c('0x8')]]&&_0x3628ae[_0xdc6c('0x5')](util[_0xdc6c('0x11')](_0xdc6c('0xe'),_0x3815c1['key'],_0x1d443f[_0x3815c1[_0xdc6c('0x8')]]));}else if(_0x3815c1[_0xdc6c('0xc')]==='customVariable'&&_0x3815c1[_0xdc6c('0x9')]&&_0x3815c1[_0xdc6c('0x9')][_0xdc6c('0xa')]&&_0x3815c1['key']){_0x1d443f[_0x3815c1[_0xdc6c('0x9')]['name'][_0xdc6c('0xb')]()]&&_0x3628ae['push'](util['format']('%s:\x20%s',_0x3815c1[_0xdc6c('0xd')],_0x1d443f[_0x3815c1[_0xdc6c('0x9')][_0xdc6c('0xa')][_0xdc6c('0xb')]()]));}}}}return _0x3628ae[_0xdc6c('0x12')](_0x28d136);};exports[_0xdc6c('0x13')]=function(_0x50d27f){var _0x2e0588=_0x50d27f[_0xdc6c('0x14')](-0x1);if(_0x2e0588==='/'){_0x50d27f=_0x50d27f[_0xdc6c('0x15')](0x0,_0x50d27f[_0xdc6c('0x16')](_0x2e0588));}return _0x50d27f;};exports['validateEmail']=function(_0x21f337){if(!_['isNil'](_0x21f337)&&_0x21f337!==''){var _0x434efc=/^(([^<>()\[\]\\.,;:\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 _0x434efc[_0xdc6c('0x17')](String(_0x21f337)[_0xdc6c('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a3cf472..abab6ba 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(_0x13dc73,_0x151faa){var _0x2d501a=function(_0xcf000e){while(--_0xcf000e){_0x13dc73['push'](_0x13dc73['shift']());}};_0x2d501a(++_0x151faa);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 637d29e..3c73bc1 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 _0x877b=['username','toString','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','custom_fields','push','idField','variable','variableName','type','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','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','destcalleridname','destcalleridnum','[OUTBOUND]','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','token','%s/token:%s'];(function(_0x58c2f4,_0x5ba529){var _0x3ffc2e=function(_0x47eb46){while(--_0x47eb46){_0x58c2f4['push'](_0x58c2f4['shift']());}};_0x3ffc2e(++_0x5ba529);}(_0x877b,0x17d));var _0xb877=function(_0x96f2,_0x6cb975){_0x96f2=_0x96f2-0x0;var _0x237274=_0x877b[_0x96f2];return _0x237274;};'use strict';var _=require('lodash');var rp=require(_0xb877('0x0'));var md5=require(_0xb877('0x1'));var util=require(_0xb877('0x2'));var Redis=require(_0xb877('0x3'));var intUtil=require(_0xb877('0x4'));var config=require(_0xb877('0x5'));var logger=require('../../../../config/logger')(_0xb877('0x6'));config[_0xb877('0x7')]=_[_0xb877('0x8')](config[_0xb877('0x7')],{'host':_0xb877('0x9'),'port':0x18eb});var io=require(_0xb877('0xa'))(new Redis(config['redis']));function emit(_0x5561e3,_0x310e68,_0x1b255b){io['to'](_0x5561e3)['emit'](_0x310e68,_0x1b255b);}var headers={'Content-Type':_0xb877('0xb'),'Accept':_0xb877('0xb')};function getTicket(_0x321e3b,_0x224a3b,_0x5ccb63,_0xf27a68,_0xf02e29){logger[_0xb877('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0xb877('0xd'),_0x321e3b[_0xb877('0xe')]),'method':_0xb877('0xf'),'body':{'ticket':_['merge']({'requester_id':_0x5ccb63['id'],'submitter_id':_0x224a3b?_0x224a3b['id']:undefined,'assignee_id':_0x224a3b?_0x224a3b['id']:undefined,'tags':getTags(_0xf27a68[_0xb877('0x10')],_0xb877('0x11')),'subject':intUtil[_0xb877('0x12')](_0xf27a68[_0xb877('0x13')],_0xf02e29,'\x20'),'description':intUtil[_0xb877('0x12')](_0xf27a68['Descriptions'],_0xf02e29,'\x0a'),'comment':{'public':![],'body':intUtil[_0xb877('0x12')](_0xf27a68[_0xb877('0x14')],_0xf02e29,'\x0a')}},getCustomFields(_0xf27a68['Fields'],_0xf02e29))}})[_0xb877('0x15')](function(_0x1a2aaf){logger[_0xb877('0xc')](_0xb877('0x16'));return _0x1a2aaf[_0xb877('0x17')];});}function getUser(_0x7c0611,_0x548a5e){if(intUtil['validateEmail'](_0x548a5e)){logger[_0xb877('0xc')](_0xb877('0x18'),_0x548a5e);return request({'uri':util[_0xb877('0x19')](_0xb877('0x1a'),_0x7c0611[_0xb877('0xe')]),'qs':{'query':util['format'](_0xb877('0x1b'),_0x548a5e)}})[_0xb877('0x15')](function(_0x374820){if(_0x374820[_0xb877('0x1c')]){logger[_0xb877('0xc')](_0xb877('0x1d'));return _['find'](_0x374820[_0xb877('0x1e')],{'email':_0x548a5e,'role':'agent'});}else{logger[_0xb877('0xc')](_0xb877('0x1f'));return request({'uri':util[_0xb877('0x19')](_0xb877('0x20'),_0x7c0611[_0xb877('0xe')])})['then'](function(_0x2e9f7b){logger[_0xb877('0xc')](_0xb877('0x21'));return _0x2e9f7b[_0xb877('0x22')];});}});}else{logger[_0xb877('0xc')](_0xb877('0x1f'));return request({'uri':util[_0xb877('0x19')](_0xb877('0x20'),_0x7c0611[_0xb877('0xe')])})['then'](function(_0x140e07){logger[_0xb877('0xc')](_0xb877('0x21'));return _0x140e07['user'];});}}function getEndUser(_0x4c6561,_0x6ad61c,_0x5d201b){logger[_0xb877('0xc')](_0xb877('0x23'),_0x5d201b);return request({'uri':util[_0xb877('0x19')]('%s/search.json',_0x4c6561[_0xb877('0xe')]),'qs':{'query':util[_0xb877('0x19')]('type:user\x20role:end-user\x20phone:%s',_0x5d201b)}})[_0xb877('0x15')](function(_0x53eaa8){var _0x2a8427;if(_0x53eaa8[_0xb877('0x1e')][_0xb877('0x24')]){_0x53eaa8[_0xb877('0x1e')]=_[_0xb877('0x25')](_0x53eaa8[_0xb877('0x1e')],{'suspended':![],'role':_0xb877('0x26')});if(_0x53eaa8[_0xb877('0x1e')]['length']){_0x2a8427=_[_0xb877('0x27')](_0x53eaa8[_0xb877('0x1e')]);}}if(_0x2a8427){logger['info']('Enduser\x20found!');return _0x2a8427;}else{logger[_0xb877('0xc')](_0xb877('0x28'));return request({'uri':util[_0xb877('0x19')](_0xb877('0x29'),_0x4c6561[_0xb877('0xe')]),'method':_0xb877('0xf'),'body':{'user':{'role':_0xb877('0x26'),'name':util['format']('Caller\x20-\x20%s',_0x6ad61c||_0x5d201b),'phone':_0x5d201b}}})[_0xb877('0x15')](function(_0x36e600){logger[_0xb877('0xc')]('Enduser\x20created.');return _0x36e600[_0xb877('0x22')];});}});}function getAuth(_0x53d92f){var _0x2113b4;if(_0x53d92f[_0xb877('0x2a')]===_0xb877('0x2b')){_0x2113b4=util[_0xb877('0x19')](_0xb877('0x2c'),_0x53d92f['username'],_0x53d92f[_0xb877('0x2b')]);}else if(_0x53d92f[_0xb877('0x2a')]===_0xb877('0x2d')){_0x2113b4=util[_0xb877('0x19')](_0xb877('0x2e'),_0x53d92f[_0xb877('0x2f')],_0x53d92f[_0xb877('0x2d')]);}return util['format']('Basic\x20%s',new Buffer(_0x2113b4)[_0xb877('0x30')]('base64'));}function request(_0x328331){logger[_0xb877('0x31')](_0xb877('0x32'),JSON[_0xb877('0x33')](_0x328331));return rp(_[_0xb877('0x8')](_0x328331,{'method':_0xb877('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x38f8f5,_0x3af81a){var _0x505a69=[];if(_0x38f8f5&&_0x38f8f5[_0xb877('0x24')]>0x0){_0x505a69=_[_0xb877('0x35')](_0x38f8f5,_0x3af81a);}return _0x505a69;}function getCustomFields(_0x3996ab,_0x158dae){var _0x4add1c=[];var _0x176418={'custom_fields':[]};if(_0x3996ab[_0xb877('0x24')]>0x0){_[_0xb877('0x36')](_0x3996ab,function(_0x4e1c07){if(_[_0xb877('0x37')]([_0xb877('0x38'),_0xb877('0x39')],_0x4e1c07['type'])&&_0x4e1c07[_0xb877('0x3a')]&&!_0x4e1c07[_0xb877('0x3b')]){_0x176418[_0x4e1c07[_0xb877('0x3a')][_0xb877('0x3c')]()]=_0x4e1c07[_0xb877('0x3d')][_0xb877('0x30')]();}else if(_[_0xb877('0x37')]([_0xb877('0x38'),_0xb877('0x39')],_0x4e1c07['type'])&&_0x4e1c07['idField']&&_0x4e1c07[_0xb877('0x3b')]){_0x176418[_0xb877('0x3e')][_0xb877('0x3f')]({'id':_0x4e1c07[_0xb877('0x40')],'value':_0x4e1c07[_0xb877('0x3d')][_0xb877('0x30')]()});}else if(_0x4e1c07['type']===_0xb877('0x41')&&_0x4e1c07[_0xb877('0x42')]&&_0x4e1c07[_0xb877('0x40')]&&_0x4e1c07[_0xb877('0x3b')]){_0x158dae[_0x4e1c07[_0xb877('0x42')]]&&_0x176418[_0xb877('0x3e')]['push']({'id':_0x4e1c07['idField'],'value':_0x158dae[_0x4e1c07[_0xb877('0x42')]][_0xb877('0x30')]()});}else if(_0x4e1c07[_0xb877('0x43')]===_0xb877('0x44')&&_0x4e1c07[_0xb877('0x45')]&&_0x4e1c07[_0xb877('0x45')][_0xb877('0x11')]&&_0x4e1c07['idField']&&_0x4e1c07[_0xb877('0x3b')]){_0x158dae[_0x4e1c07[_0xb877('0x45')][_0xb877('0x11')][_0xb877('0x3c')]()]&&_0x176418[_0xb877('0x3e')]['push']({'id':_0x4e1c07[_0xb877('0x40')],'value':_0x158dae[_0x4e1c07[_0xb877('0x45')][_0xb877('0x11')][_0xb877('0x3c')]()][_0xb877('0x30')]()});}});}return _0x176418;}exports[_0xb877('0x46')]=function(_0x1b9dd5,_0x2e2206,_0x8f79e6,_0x256129,_0x27a852,_0x4dfc7e){var _0x9ffc33,_0x1d4410;_0x4dfc7e[_0xb877('0xe')]=intUtil[_0xb877('0x47')](_0x4dfc7e[_0xb877('0xe')]);_0x4dfc7e[_0xb877('0x48')]=intUtil['stripTrailingSlash'](_0x4dfc7e[_0xb877('0x48')]);if(_0x27a852&&_0x27a852[_0xb877('0x49')]){logger[_0xb877('0xc')](_0xb877('0x4a'),_0xb877('0x4b'));_0x2e2206[_0xb877('0x4c')]=util[_0xb877('0x19')](_0xb877('0x4d'),_0x4dfc7e[_0xb877('0x48')],_0x2e2206[_0xb877('0x4e')],md5(_0x2e2206[_0xb877('0x4e')]));}else{_0x2e2206[_0xb877('0x4c')]='';}headers[_0xb877('0x4f')]=getAuth(_0x4dfc7e);return getUser(_0x4dfc7e,_0x256129[_0xb877('0x50')])[_0xb877('0x15')](function(_0x1ca268){_0x9ffc33=_0x1ca268;logger['info'](_0xb877('0x51'),_0x9ffc33['id']);return getEndUser(_0x4dfc7e,_0x2e2206[_0xb877('0x52')],_0x2e2206['calleridnum']);})['then'](function(_0x30e157){_0x1d4410=_0x30e157;logger['info'](_0xb877('0x53'),_0x1d4410['id']);return getTicket(_0x4dfc7e,_0x9ffc33,_0x1d4410,_0x8f79e6,_0x2e2206);})[_0xb877('0x15')](function(_0x5c923d){if(_0x5c923d){logger[_0xb877('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5c923d['id']);switch(_0x4dfc7e[_0xb877('0x43')]){case _0xb877('0x54'):logger[_0xb877('0xc')]('[QUEUE]',_0xb877('0x55'));return request({'uri':util['format'](_0xb877('0x56'),_0x4dfc7e['remoteUri'],_0x9ffc33['id'],_0x5c923d['id']),'method':'POST'});case _0xb877('0x57'):logger[_0xb877('0xc')](_0xb877('0x4a'),_0xb877('0x58'));emit(util[_0xb877('0x19')](_0xb877('0x59'),_0x256129[_0xb877('0x11')]),_0xb877('0x5a'),{'uri':util['format']('%s/agent/tickets/%s',_0x4dfc7e['remoteUri'][_0xb877('0x5b')](_0xb877('0x5c'),''),_0x5c923d['id'])});break;default:logger['error'](_0xb877('0x4a'),_0xb877('0x5d'));}}})[_0xb877('0x5e')](function(_0x19ef9d){logger[_0xb877('0x5f')](_0xb877('0x60'),util[_0xb877('0x61')](_0x19ef9d,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x235af7,_0x232be1,_0x3b9b5f,_0x25c4d3,_0x220fc5,_0xaf2e98,_0xfa5a11){var _0x1c3eb8,_0x1e7604;_0xaf2e98[_0xb877('0xe')]=intUtil['stripTrailingSlash'](_0xaf2e98['remoteUri']);_0xaf2e98[_0xb877('0x48')]=intUtil[_0xb877('0x47')](_0xaf2e98[_0xb877('0x48')]);if(_0xfa5a11&&_0xfa5a11[_0xb877('0x62')]&&_0xfa5a11[_0xb877('0x62')]!=='none'){logger[_0xb877('0xc')]('[OUTBOUND]',_0xb877('0x4b'));_0x232be1[_0xb877('0x4c')]=util[_0xb877('0x19')](_0xb877('0x4d'),_0xaf2e98[_0xb877('0x48')],_0x232be1[_0xb877('0x4e')],md5(_0x232be1['uniqueid']));}headers['Authorization']=getAuth(_0xaf2e98);return getUser(_0xaf2e98,_0x25c4d3[_0xb877('0x50')])[_0xb877('0x15')](function(_0x3a1511){_0x1c3eb8=_0x3a1511;logger[_0xb877('0xc')](_0xb877('0x51'),_0x1c3eb8['id']);return getEndUser(_0xaf2e98,_0x232be1[_0xb877('0x63')],_0x232be1[_0xb877('0x64')]);})[_0xb877('0x15')](function(_0xadf25f){_0x1e7604=_0xadf25f;logger[_0xb877('0xc')](_0xb877('0x53'),_0x1e7604['id']);return getTicket(_0xaf2e98,_0x1c3eb8,_0x1e7604,_0x3b9b5f,_0x232be1);})['then'](function(_0x220d25){if(_0x220d25){logger[_0xb877('0xc')]('The\x20Ticket\x20ID\x20is:',_0x220d25['id']);switch(_0xaf2e98['type']){case _0xb877('0x54'):logger['info'](_0xb877('0x65'),_0xb877('0x55'));return request({'uri':util[_0xb877('0x19')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0xaf2e98[_0xb877('0xe')],_0x1c3eb8['id'],_0x220d25['id']),'method':'POST'});case _0xb877('0x57'):logger['info'](_0xb877('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb877('0x59'),_0x25c4d3[_0xb877('0x11')]),'trigger:browser:url',{'uri':util[_0xb877('0x19')](_0xb877('0x66'),_0xaf2e98['remoteUri'][_0xb877('0x5b')]('/api/v2',''),_0x220d25['id'])});break;default:logger[_0xb877('0x5f')]('[OUTBOUND]',_0xb877('0x5d'));}}})['catch'](function(_0x5ba717){logger[_0xb877('0x5f')](_0xb877('0x67'),util[_0xb877('0x61')](_0x5ba717,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xb22f66,_0x1ee188,_0x6b2508,_0xde915e,_0x37277a,_0x1ddbf3){var _0x52e72b,_0x351d4f;_0x1ddbf3[_0xb877('0xe')]=intUtil[_0xb877('0x47')](_0x1ddbf3[_0xb877('0xe')]);_0x1ddbf3[_0xb877('0x48')]=intUtil[_0xb877('0x47')](_0x1ddbf3[_0xb877('0x48')]);if(_0x37277a&&_0x37277a[_0xb877('0x49')]){logger[_0xb877('0xc')]('['+_0x1ee188[_0xb877('0x68')][_0xb877('0x69')]()+']',_0xb877('0x4b'));_0x1ee188[_0xb877('0x4c')]=util[_0xb877('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ddbf3['serverUrl'],_0x1ee188[_0xb877('0x4e')],md5(_0x1ee188['uniqueid']));}else{_0x1ee188[_0xb877('0x4c')]='';}headers[_0xb877('0x4f')]=getAuth(_0x1ddbf3);return getUser(_0x1ddbf3)['then'](function(_0x4003a1){_0x52e72b=_0x4003a1;logger[_0xb877('0xc')]('The\x20User\x20ID\x20is:',_0x52e72b['id']);return getEndUser(_0x1ddbf3,_0x1ee188['calleridname'],_0x1ee188['calleridnum']);})['then'](function(_0x17ce5f){_0x351d4f=_0x17ce5f;logger['info'](_0xb877('0x53'),_0x351d4f['id']);return getTicket(_0x1ddbf3,_0x52e72b,_0x351d4f,_0x6b2508,_0x1ee188);})[_0xb877('0x15')](function(_0x2039f7){if(_0x2039f7){logger[_0xb877('0xc')](_0xb877('0x6a'),_0x2039f7['id']);}})[_0xb877('0x5e')](function(_0x17c974){logger[_0xb877('0x5f')]('['+_0x1ee188['lastevent'][_0xb877('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x17c974,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5830=['user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','username','password','%s/token:%s','token','Basic\x20%s','toString','base64','[HTTP]','stringify','GET','length','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Zendesk\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','%s/search.json','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.'];(function(_0x31e18a,_0x2cd869){var _0x45e8d4=function(_0x23efd7){while(--_0x23efd7){_0x31e18a['push'](_0x31e18a['shift']());}};_0x45e8d4(++_0x2cd869);}(_0x5830,0xc1));var _0x0583=function(_0x22ad68,_0x123602){_0x22ad68=_0x22ad68-0x0;var _0x2d0d86=_0x5830[_0x22ad68];return _0x2d0d86;};'use strict';var _=require(_0x0583('0x0'));var rp=require(_0x0583('0x1'));var md5=require(_0x0583('0x2'));var util=require(_0x0583('0x3'));var Redis=require(_0x0583('0x4'));var intUtil=require(_0x0583('0x5'));var config=require(_0x0583('0x6'));var logger=require(_0x0583('0x7'))('zendesk');config[_0x0583('0x8')]=_[_0x0583('0x9')](config[_0x0583('0x8')],{'host':_0x0583('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0583('0x8')]));function emit(_0x3e9756,_0x22e087,_0x51c002){io['to'](_0x3e9756)['emit'](_0x22e087,_0x51c002);}var headers={'Content-Type':'application/json','Accept':_0x0583('0xb')};function getTicket(_0x3037cd,_0x5e01db,_0x139675,_0x3eb349,_0x4b607c){logger[_0x0583('0xc')](_0x0583('0xd'));return request({'uri':util[_0x0583('0xe')]('%s/tickets.json',_0x3037cd[_0x0583('0xf')]),'method':'POST','body':{'ticket':_[_0x0583('0x10')]({'requester_id':_0x139675['id'],'submitter_id':_0x5e01db?_0x5e01db['id']:undefined,'assignee_id':_0x5e01db?_0x5e01db['id']:undefined,'tags':getTags(_0x3eb349[_0x0583('0x11')],_0x0583('0x12')),'subject':intUtil[_0x0583('0x13')](_0x3eb349[_0x0583('0x14')],_0x4b607c,'\x20'),'description':intUtil[_0x0583('0x13')](_0x3eb349[_0x0583('0x15')],_0x4b607c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0583('0x13')](_0x3eb349[_0x0583('0x15')],_0x4b607c,'\x0a')}},getCustomFields(_0x3eb349[_0x0583('0x16')],_0x4b607c))}})[_0x0583('0x17')](function(_0x307880){logger[_0x0583('0xc')](_0x0583('0x18'));return _0x307880[_0x0583('0x19')];});}function getUser(_0x1f1759,_0x256fdb){if(intUtil[_0x0583('0x1a')](_0x256fdb)){logger[_0x0583('0xc')]('Getting\x20agent\x20with\x20email',_0x256fdb);return request({'uri':util[_0x0583('0xe')](_0x0583('0x1b'),_0x1f1759[_0x0583('0xf')]),'qs':{'query':util[_0x0583('0xe')]('type:user\x20role:agent\x20email:%s',_0x256fdb)}})[_0x0583('0x17')](function(_0x8ee49){if(_0x8ee49['count']){logger['info'](_0x0583('0x1c'));return _[_0x0583('0x1d')](_0x8ee49[_0x0583('0x1e')],{'email':_0x256fdb,'role':_0x0583('0x1f')});}else{logger['info'](_0x0583('0x20'));return request({'uri':util[_0x0583('0xe')](_0x0583('0x21'),_0x1f1759[_0x0583('0xf')])})[_0x0583('0x17')](function(_0x12ebad){logger[_0x0583('0xc')](_0x0583('0x22'));return _0x12ebad[_0x0583('0x23')];});}});}else{logger[_0x0583('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x0583('0xe')](_0x0583('0x21'),_0x1f1759[_0x0583('0xf')])})['then'](function(_0x59eb06){logger[_0x0583('0xc')]('Admin\x20account\x20selected.');return _0x59eb06[_0x0583('0x23')];});}}function getEndUser(_0x239774,_0x51523b,_0x1cf0e9){logger[_0x0583('0xc')](_0x0583('0x24'),_0x1cf0e9);return request({'uri':util[_0x0583('0xe')](_0x0583('0x1b'),_0x239774[_0x0583('0xf')]),'qs':{'query':util[_0x0583('0xe')](_0x0583('0x25'),_0x1cf0e9)}})[_0x0583('0x17')](function(_0x17a69c){var _0x326664;if(_0x17a69c[_0x0583('0x1e')]['length']){_0x17a69c['results']=_[_0x0583('0x26')](_0x17a69c[_0x0583('0x1e')],{'suspended':![],'role':_0x0583('0x27')});if(_0x17a69c[_0x0583('0x1e')]['length']){_0x326664=_[_0x0583('0x28')](_0x17a69c['results']);}}if(_0x326664){logger[_0x0583('0xc')](_0x0583('0x29'));return _0x326664;}else{logger['info'](_0x0583('0x2a'));return request({'uri':util[_0x0583('0xe')](_0x0583('0x2b'),_0x239774[_0x0583('0xf')]),'method':_0x0583('0x2c'),'body':{'user':{'role':'end-user','name':util[_0x0583('0xe')](_0x0583('0x2d'),_0x51523b||_0x1cf0e9),'phone':_0x1cf0e9}}})[_0x0583('0x17')](function(_0x140d0f){logger[_0x0583('0xc')](_0x0583('0x2e'));return _0x140d0f[_0x0583('0x23')];});}});}function getAuth(_0x4e9c8f){var _0x5e61b2;if(_0x4e9c8f[_0x0583('0x2f')]==='password'){_0x5e61b2=util[_0x0583('0xe')]('%s:%s',_0x4e9c8f[_0x0583('0x30')],_0x4e9c8f[_0x0583('0x31')]);}else if(_0x4e9c8f[_0x0583('0x2f')]==='token'){_0x5e61b2=util[_0x0583('0xe')](_0x0583('0x32'),_0x4e9c8f[_0x0583('0x30')],_0x4e9c8f[_0x0583('0x33')]);}return util[_0x0583('0xe')](_0x0583('0x34'),new Buffer(_0x5e61b2)[_0x0583('0x35')](_0x0583('0x36')));}function request(_0x395717){logger['debug'](_0x0583('0x37'),JSON[_0x0583('0x38')](_0x395717));return rp(_[_0x0583('0x9')](_0x395717,{'method':_0x0583('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3b5e50,_0x4d4263){var _0x31d15c=[];if(_0x3b5e50&&_0x3b5e50[_0x0583('0x3a')]>0x0){_0x31d15c=_[_0x0583('0x3b')](_0x3b5e50,_0x4d4263);}return _0x31d15c;}function getCustomFields(_0x2ea99e,_0x2e566c){var _0x458770=[];var _0x1804cb={'custom_fields':[]};if(_0x2ea99e[_0x0583('0x3a')]>0x0){_[_0x0583('0x3c')](_0x2ea99e,function(_0x105b4f){if(_[_0x0583('0x3d')]([_0x0583('0x3e'),_0x0583('0x3f')],_0x105b4f['type'])&&_0x105b4f[_0x0583('0x40')]&&!_0x105b4f[_0x0583('0x41')]){_0x1804cb[_0x105b4f[_0x0583('0x40')][_0x0583('0x42')]()]=_0x105b4f[_0x0583('0x43')][_0x0583('0x35')]();}else if(_[_0x0583('0x3d')]([_0x0583('0x3e'),_0x0583('0x3f')],_0x105b4f[_0x0583('0x44')])&&_0x105b4f[_0x0583('0x45')]&&_0x105b4f[_0x0583('0x41')]){_0x1804cb[_0x0583('0x46')]['push']({'id':_0x105b4f[_0x0583('0x45')],'value':_0x105b4f[_0x0583('0x43')][_0x0583('0x35')]()});}else if(_0x105b4f[_0x0583('0x44')]===_0x0583('0x47')&&_0x105b4f[_0x0583('0x48')]&&_0x105b4f[_0x0583('0x45')]&&_0x105b4f[_0x0583('0x41')]){_0x2e566c[_0x105b4f['variableName']]&&_0x1804cb[_0x0583('0x46')][_0x0583('0x49')]({'id':_0x105b4f['idField'],'value':_0x2e566c[_0x105b4f[_0x0583('0x48')]][_0x0583('0x35')]()});}else if(_0x105b4f[_0x0583('0x44')]===_0x0583('0x4a')&&_0x105b4f[_0x0583('0x4b')]&&_0x105b4f[_0x0583('0x4b')]['name']&&_0x105b4f[_0x0583('0x45')]&&_0x105b4f[_0x0583('0x41')]){_0x2e566c[_0x105b4f[_0x0583('0x4b')][_0x0583('0x12')][_0x0583('0x42')]()]&&_0x1804cb[_0x0583('0x46')][_0x0583('0x49')]({'id':_0x105b4f[_0x0583('0x45')],'value':_0x2e566c[_0x105b4f[_0x0583('0x4b')][_0x0583('0x12')][_0x0583('0x42')]()]['toString']()});}});}return _0x1804cb;}exports[_0x0583('0x4c')]=function(_0x4c399a,_0x1acea2,_0x55ba47,_0x197315,_0x30d13a,_0x2857b5){var _0x1f5d2a,_0x8e6e96;_0x2857b5['remoteUri']=intUtil[_0x0583('0x4d')](_0x2857b5['remoteUri']);_0x2857b5['serverUrl']=intUtil[_0x0583('0x4d')](_0x2857b5[_0x0583('0x4e')]);if(_0x30d13a&&_0x30d13a[_0x0583('0x4f')]){logger[_0x0583('0xc')](_0x0583('0x50'),_0x0583('0x51'));_0x1acea2[_0x0583('0x52')]=util[_0x0583('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2857b5[_0x0583('0x4e')],_0x1acea2[_0x0583('0x53')],md5(_0x1acea2[_0x0583('0x53')]));}else{_0x1acea2[_0x0583('0x52')]='';}headers[_0x0583('0x54')]=getAuth(_0x2857b5);return getUser(_0x2857b5,_0x197315[_0x0583('0x55')])[_0x0583('0x17')](function(_0xe83b0a){_0x1f5d2a=_0xe83b0a;logger[_0x0583('0xc')](_0x0583('0x56'),_0x1f5d2a['id']);return getEndUser(_0x2857b5,_0x1acea2[_0x0583('0x57')],_0x1acea2[_0x0583('0x58')]);})[_0x0583('0x17')](function(_0x4e5580){_0x8e6e96=_0x4e5580;logger[_0x0583('0xc')](_0x0583('0x59'),_0x8e6e96['id']);return getTicket(_0x2857b5,_0x1f5d2a,_0x8e6e96,_0x55ba47,_0x1acea2);})[_0x0583('0x17')](function(_0x369b4e){if(_0x369b4e){logger[_0x0583('0xc')](_0x0583('0x5a'),_0x369b4e['id']);switch(_0x2857b5['type']){case _0x0583('0x5b'):logger['info'](_0x0583('0x50'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0583('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2857b5[_0x0583('0xf')],_0x1f5d2a['id'],_0x369b4e['id']),'method':_0x0583('0x2c')});case _0x0583('0x5c'):logger[_0x0583('0xc')](_0x0583('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0583('0xe')]('user:%s',_0x197315[_0x0583('0x12')]),_0x0583('0x5d'),{'uri':util[_0x0583('0xe')](_0x0583('0x5e'),_0x2857b5['remoteUri'][_0x0583('0x5f')](_0x0583('0x60'),''),_0x369b4e['id'])});break;default:logger[_0x0583('0x61')](_0x0583('0x50'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0583('0x62')](function(_0x4b9e81){logger[_0x0583('0x61')](_0x0583('0x63'),util[_0x0583('0x64')](_0x4b9e81,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2fba31,_0x3b3ed8,_0x212582,_0x41fb2e,_0x533c77,_0x298462,_0x2b1964){var _0x596c96,_0x322817;_0x298462[_0x0583('0xf')]=intUtil[_0x0583('0x4d')](_0x298462['remoteUri']);_0x298462[_0x0583('0x4e')]=intUtil[_0x0583('0x4d')](_0x298462['serverUrl']);if(_0x2b1964&&_0x2b1964[_0x0583('0x65')]&&_0x2b1964[_0x0583('0x65')]!==_0x0583('0x66')){logger['info'](_0x0583('0x67'),_0x0583('0x51'));_0x3b3ed8[_0x0583('0x52')]=util[_0x0583('0xe')](_0x0583('0x68'),_0x298462[_0x0583('0x4e')],_0x3b3ed8[_0x0583('0x53')],md5(_0x3b3ed8[_0x0583('0x53')]));}headers['Authorization']=getAuth(_0x298462);return getUser(_0x298462,_0x41fb2e['email'])[_0x0583('0x17')](function(_0x37e146){_0x596c96=_0x37e146;logger[_0x0583('0xc')](_0x0583('0x56'),_0x596c96['id']);return getEndUser(_0x298462,_0x3b3ed8[_0x0583('0x69')],_0x3b3ed8[_0x0583('0x6a')]);})[_0x0583('0x17')](function(_0x5d6913){_0x322817=_0x5d6913;logger[_0x0583('0xc')](_0x0583('0x59'),_0x322817['id']);return getTicket(_0x298462,_0x596c96,_0x322817,_0x212582,_0x3b3ed8);})[_0x0583('0x17')](function(_0x507397){if(_0x507397){logger[_0x0583('0xc')](_0x0583('0x5a'),_0x507397['id']);switch(_0x298462[_0x0583('0x44')]){case _0x0583('0x5b'):logger['info']('[OUTBOUND]',_0x0583('0x6b'));return request({'uri':util[_0x0583('0xe')](_0x0583('0x6c'),_0x298462['remoteUri'],_0x596c96['id'],_0x507397['id']),'method':'POST'});case'newTab':logger[_0x0583('0xc')](_0x0583('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0583('0xe')]('user:%s',_0x41fb2e['name']),'trigger:browser:url',{'uri':util[_0x0583('0xe')](_0x0583('0x5e'),_0x298462[_0x0583('0xf')][_0x0583('0x5f')](_0x0583('0x60'),''),_0x507397['id'])});break;default:logger['error'](_0x0583('0x67'),_0x0583('0x6d'));}}})[_0x0583('0x62')](function(_0x5568e8){logger[_0x0583('0x61')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x0583('0x64')](_0x5568e8,{'showHidden':!![],'depth':null}));});};exports[_0x0583('0x6e')]=function(_0x282de7,_0x47d195,_0x2612f3,_0x42b6ad,_0x342f68,_0x24f703){var _0x13f616,_0x21da9e;_0x24f703[_0x0583('0xf')]=intUtil[_0x0583('0x4d')](_0x24f703[_0x0583('0xf')]);_0x24f703[_0x0583('0x4e')]=intUtil[_0x0583('0x4d')](_0x24f703['serverUrl']);if(_0x342f68&&_0x342f68[_0x0583('0x4f')]){logger[_0x0583('0xc')]('['+_0x47d195[_0x0583('0x6f')][_0x0583('0x70')]()+']','Recording\x20is\x20enabled!');_0x47d195[_0x0583('0x52')]=util['format'](_0x0583('0x68'),_0x24f703['serverUrl'],_0x47d195['uniqueid'],md5(_0x47d195[_0x0583('0x53')]));}else{_0x47d195['recordingURL']='';}headers['Authorization']=getAuth(_0x24f703);return getUser(_0x24f703)[_0x0583('0x17')](function(_0x459bc8){_0x13f616=_0x459bc8;logger[_0x0583('0xc')](_0x0583('0x56'),_0x13f616['id']);return getEndUser(_0x24f703,_0x47d195[_0x0583('0x57')],_0x47d195[_0x0583('0x58')]);})['then'](function(_0x56ec88){_0x21da9e=_0x56ec88;logger['info'](_0x0583('0x59'),_0x21da9e['id']);return getTicket(_0x24f703,_0x13f616,_0x21da9e,_0x2612f3,_0x47d195);})['then'](function(_0x5c0b2c){if(_0x5c0b2c){logger[_0x0583('0xc')](_0x0583('0x5a'),_0x5c0b2c['id']);}})[_0x0583('0x62')](function(_0x482a5c){logger[_0x0583('0x61')]('['+_0x47d195[_0x0583('0x6f')]['toUpperCase']()+']'+_0x0583('0x71'),util[_0x0583('0x64')](_0x482a5c,{'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 7bc6ec4..8058b1f 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 _0x1b32=['content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','split','isNil','isBefore','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','role','first_name','last_name','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','moduleCreate','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','user:%s','/crm/EntityInfo.do?module=Calls&id=','calleridname','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','forEach','includes','string','picklist','type','idField'];(function(_0x9320d2,_0x4893c7){var _0x326f35=function(_0x30606d){while(--_0x30606d){_0x9320d2['push'](_0x9320d2['shift']());}};_0x326f35(++_0x4893c7);}(_0x1b32,0x85));var _0x21b3=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x1b32[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var rp=require(_0x21b3('0x0'));var md5=require(_0x21b3('0x1'));var util=require(_0x21b3('0x2'));var intUtil=require(_0x21b3('0x3'));var moment=require(_0x21b3('0x4'));var Redis=require(_0x21b3('0x5'));var BPromise=require(_0x21b3('0x6'));var config=require(_0x21b3('0x7'));var logger=require(_0x21b3('0x8'))(_0x21b3('0x9'));config[_0x21b3('0xa')]=_[_0x21b3('0xb')](config[_0x21b3('0xa')],{'host':_0x21b3('0xc'),'port':0x18eb});var io=require(_0x21b3('0xd'))(new Redis(config['redis']));function emit(_0x45b1b7,_0x5639eb,_0x4d7f3b){io['to'](_0x45b1b7)['emit'](_0x5639eb,_0x4d7f3b);}function request(_0xd7a981){logger[_0x21b3('0xe')]('[HTTP]',JSON['stringify'](_0xd7a981));return rp(_0xd7a981);}function getCustomFields(_0x253f2b,_0x270969){var _0x1cb0f7={};if(_0x253f2b['length']>0x0){_[_0x21b3('0xf')](_0x253f2b,function(_0x3ef173){if(_[_0x21b3('0x10')]([_0x21b3('0x11'),_0x21b3('0x12')],_0x3ef173[_0x21b3('0x13')])&&_0x3ef173[_0x21b3('0x14')]){_0x1cb0f7[_0x3ef173[_0x21b3('0x14')]]=_0x3ef173[_0x21b3('0x15')]['toString']();}else if(_0x3ef173[_0x21b3('0x13')]===_0x21b3('0x16')&&_0x3ef173[_0x21b3('0x17')]&&_0x3ef173['idField']&&_0x270969[_0x3ef173[_0x21b3('0x17')]]){_0x1cb0f7[_0x3ef173['idField']]=_0x270969[_0x3ef173[_0x21b3('0x17')]]['toString']();}else if(_0x3ef173[_0x21b3('0x13')]===_0x21b3('0x18')&&_0x3ef173[_0x21b3('0x19')]&&_0x3ef173[_0x21b3('0x19')]['name']&&_0x3ef173[_0x21b3('0x14')]&&_0x270969[_0x3ef173['Variable'][_0x21b3('0x1a')][_0x21b3('0x1b')]()]){_0x1cb0f7[_0x3ef173[_0x21b3('0x14')]]=_0x270969[_0x3ef173[_0x21b3('0x19')]['name'][_0x21b3('0x1b')]()][_0x21b3('0x1c')]();}});}return _0x1cb0f7;}function getName(_0x3f4040){if(_0x3f4040['indexOf']('\x20')>0x0){var _0xbb1da7=_0x3f4040[_0x21b3('0x1d')](/ (.+)/);if(_0xbb1da7[0x1]){return _0xbb1da7;}}return[_0x3f4040,_0x3f4040];}var accountsTokens={};function getAccessToken(_0x2f996d){return new Promise(function(_0x3fe141,_0x360e57){if(!_[_0x21b3('0x1e')](accountsTokens[_0x2f996d['id']])&&!_[_0x21b3('0x1e')](accountsTokens[_0x2f996d['id']]['access_token'])){if(moment()[_0x21b3('0x1f')](accountsTokens[_0x2f996d['id']]['expires_in'])){_0x3fe141(accountsTokens[_0x2f996d['id']][_0x21b3('0x20')]);}}var _0x3afede;switch(_0x2f996d[_0x21b3('0x21')]){case'US':_0x3afede='https://accounts.zoho.com';break;case'AU':_0x3afede=_0x21b3('0x22');break;case'EU':_0x3afede='https://accounts.zoho.eu';break;case'IN':_0x3afede=_0x21b3('0x23');break;case'CN':_0x3afede=_0x21b3('0x24');break;default:_0x3afede=_0x21b3('0x25');break;}var _0x4412f0={'method':_0x21b3('0x26'),'uri':_0x3afede+_0x21b3('0x27'),'qs':{'refresh_token':_0x2f996d['refreshToken'],'client_id':_0x2f996d['clientId'],'client_secret':_0x2f996d['clientSecret'],'grant_type':_0x21b3('0x28')},'json':!![]};return rp(_0x4412f0)[_0x21b3('0x29')](function(_0x3c1a3b){accountsTokens[_0x2f996d['id']]={'access_token':_0x3c1a3b[_0x21b3('0x20')],'expires_in':moment()[_0x21b3('0x2a')](_0x3c1a3b['expires_in'],_0x21b3('0x2b'))};_0x3fe141(_0x3c1a3b['access_token']);})[_0x21b3('0x2c')](function(_0x56063c){logger[_0x21b3('0x2d')](_0x21b3('0x2e'),_0x56063c[_0x21b3('0x2f')]);_0x360e57(_0x56063c);});});}function getUser(_0x4f6432,_0x291e52,_0x300977,_0x336b1e){logger[_0x21b3('0x30')](_0x21b3('0x31'));return request({'method':_0x21b3('0x32'),'uri':util[_0x21b3('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x291e52),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x21b3('0x34')+_0x4f6432},'json':!![]})[_0x21b3('0x29')](function(_0x574c34){if(_0x574c34[_0x21b3('0x35')]){var _0xa04ac7=-0x1;if(_[_0x21b3('0x36')](_0x574c34[_0x21b3('0x35')])){if(!_[_0x21b3('0x1e')](_0x336b1e)){_0xa04ac7=_[_0x21b3('0x37')](_0x574c34[_0x21b3('0x35')],function(_0x426483){return _0x426483[_0x21b3('0x38')]===_0x336b1e;});}if(_0xa04ac7>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x21b3('0x30')]('Using\x20the\x20admin\x20account!');_0xa04ac7=_[_0x21b3('0x37')](_0x574c34[_0x21b3('0x35')],function(_0x4caee6){return _0x4caee6[_0x21b3('0x39')][_0x21b3('0x1a')]===_0x21b3('0x3a');});}return _0x574c34[_0x21b3('0x35')][_0xa04ac7];}else{if(_0x574c34['user'][_0x21b3('0x39')][_0x21b3('0x1a')]===_0x21b3('0x3a')){logger[_0x21b3('0x30')]('Using\x20the\x20admin\x20account!');user=_0x574c34[_0x21b3('0x3b')];return user;}else{logger['error'](_0x21b3('0x3c'),JSON[_0x21b3('0x3d')](_0x574c34));throw new Error(_0x21b3('0x3e')+JSON[_0x21b3('0x3d')](_0x574c34));}}}else{logger[_0x21b3('0x2d')](_0x21b3('0x3c'),JSON[_0x21b3('0x3d')](_0x574c34));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x574c34));}})[_0x21b3('0x2c')](function(_0x86027e){console[_0x21b3('0x2d')](_0x86027e);});}function getZohoUser(_0x96bae,_0x5a0e93){return new BPromise(function(_0x1c190e,_0x27ea66){request(_0x96bae)[_0x21b3('0x29')](function(_0x42889a){var _0x2549e3=null;if(_0x42889a){_0x2549e3=_0x42889a[_0x21b3('0x3f')][0x0];_0x2549e3[_0x21b3('0x40')]=_0x5a0e93;}_0x1c190e(_0x2549e3);})[_0x21b3('0x2c')](function(_0x740daa){_0x27ea66(_0x740daa);});});}function createEndUser(_0x3145b2,_0x36dd10,_0x4facfc,_0x1942c0,_0x321050,_0x591fa6){var _0x4facfc=getName(_0x4facfc);return request({'method':'POST','uri':_0x21b3('0x41')+_0x36dd10+_0x21b3('0x42')+_['startCase'](_0x591fa6['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4facfc[0x1],'First_Name':_0x4facfc[0x0],'Phone':_0x1942c0,'Owner':{'name':!_['isNil'](_0x321050[_0x21b3('0x43')][_0x21b3('0x1a')])?_0x321050[_0x21b3('0x43')][_0x21b3('0x1a')]:!_['isNil'](_0x321050['first_name'])?_0x321050[_0x21b3('0x44')]+'\x20'+_0x321050[_0x21b3('0x45')]:_0x321050[_0x21b3('0x45')],'id':_0x321050['id']}}]},'headers':{'Authorization':_0x21b3('0x34')+_0x3145b2},'json':!![]})[_0x21b3('0x29')](function(_0x2be5ae){if(_0x2be5ae&&_0x2be5ae[_0x21b3('0x3f')][0x0]['code']===_0x21b3('0x46')){var _0x44cf7d=_0x2be5ae[_0x21b3('0x3f')][0x0][_0x21b3('0x47')];_0x44cf7d[_0x21b3('0x40')]=_[_0x21b3('0x48')](_0x591fa6['moduleCreate'])+'s';return _0x44cf7d;}logger['error'](_0x21b3('0x3c'),JSON[_0x21b3('0x3d')](data));throw new Error(_0x21b3('0x49')+JSON['stringify'](data));})[_0x21b3('0x2c')](function(_0x229a7b){console[_0x21b3('0x4a')](_0x21b3('0x4b'),_0x229a7b);});}function getEndUser(_0x423a2b,_0x12ea19,_0x5f3fa9,_0xe7867d,_0xf008d9,_0x3bc4ef,_0x4e3d2b){var _0x5bcc77={'method':'GET','uri':'','headers':{'Authorization':_0x21b3('0x34')+_0x423a2b},'json':!![]};switch(_0x4e3d2b[_0x21b3('0x4c')]){case _0x21b3('0x4d'):_0x5bcc77[_0x21b3('0x4e')]=_0x21b3('0x41')+_0x12ea19+_0x21b3('0x4f')+_0xf008d9+'))';return getZohoUser(_0x5bcc77,_0x21b3('0x50'))[_0x21b3('0x29')](function(_0x2e878b){if(_0x2e878b)return _0x2e878b;_0x5bcc77['uri']='https://www.zohoapis.'+_0x12ea19+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xf008d9+'))';return getZohoUser(_0x5bcc77,_0x21b3('0x51'))[_0x21b3('0x29')](function(_0x4046cd){if(_0x4046cd)return _0x4046cd;if(_0x4e3d2b[_0x21b3('0x52')]!=_0x21b3('0x53')){return createEndUser(_0x423a2b,_0x12ea19,_0xe7867d,_0xf008d9,_0x3bc4ef,_0x4e3d2b);}else{return{};}});});break;case _0x21b3('0x54'):_0x5bcc77[_0x21b3('0x4e')]=_0x21b3('0x41')+_0x12ea19+_0x21b3('0x4f')+_0xf008d9+'))';return getZohoUser(_0x5bcc77,_0x21b3('0x50'))['then'](function(_0x23d7f8){if(_0x23d7f8)return _0x23d7f8;if(_0x4e3d2b[_0x21b3('0x52')]!=_0x21b3('0x53')){return createEndUser(_0x423a2b,_0x12ea19,_0xe7867d,_0xf008d9,_0x3bc4ef,_0x4e3d2b);}else{return{};}});break;case _0x21b3('0x55'):_0x5bcc77[_0x21b3('0x4e')]=_0x21b3('0x41')+_0x12ea19+_0x21b3('0x56')+_0xf008d9+'))';return getZohoUser(_0x5bcc77,_0x21b3('0x51'))[_0x21b3('0x29')](function(_0x58c568){if(_0x58c568)return _0x58c568;if(_0x4e3d2b[_0x21b3('0x52')]!=_0x21b3('0x53')){return createEndUser(_0x423a2b,_0x12ea19,_0xe7867d,_0xf008d9,_0x3bc4ef,_0x4e3d2b);}else{return{};}});break;}}function getCall(_0x3cfd1e,_0x17bb4f,_0x3805b9,_0x5d7ee7,_0x595c3a,_0x3f8aab,_0x4bd19f,_0x37a455){logger[_0x21b3('0x30')](_0x21b3('0x57'));var _0x412536={};_0x412536['Owner']={'name':!_['isNil'](_0x5d7ee7[_0x21b3('0x43')][_0x21b3('0x1a')])&&!_[_0x21b3('0x1e')](_0x5d7ee7[_0x21b3('0x39')]['name'])&&_0x5d7ee7[_0x21b3('0x39')]['name']===_0x21b3('0x58')?_0x5d7ee7[_0x21b3('0x43')]['name']:!_['isNil'](_0x5d7ee7[_0x21b3('0x44')])?_0x5d7ee7[_0x21b3('0x44')]+'\x20'+_0x5d7ee7[_0x21b3('0x45')]:_0x5d7ee7[_0x21b3('0x45')],'id':_0x5d7ee7['id']};_0x412536[_0x21b3('0x59')]=intUtil[_0x21b3('0x5a')](_0x3f8aab[_0x21b3('0x5b')],_0x4bd19f,'\x20');_0x412536['Description']=intUtil[_0x21b3('0x5a')](_0x3f8aab[_0x21b3('0x5c')],_0x4bd19f,'\x0a');if(_0x595c3a[_0x21b3('0x40')]===_0x21b3('0x50')){_0x412536[_0x21b3('0x5d')]={'name':!_['isNil'](_0x595c3a['Full_Name'])?_0x595c3a[_0x21b3('0x5e')]:!_[_0x21b3('0x1e')](_0x595c3a[_0x21b3('0x5f')])?_0x595c3a[_0x21b3('0x5f')]+'\x20'+_0x595c3a[_0x21b3('0x60')]:_0x595c3a[_0x21b3('0x60')],'id':_0x595c3a['id']};}if(_0x595c3a['enduserType']===_0x21b3('0x51')){_0x412536[_0x21b3('0x61')]={'name':!_['isNil'](_0x595c3a[_0x21b3('0x5e')])?_0x595c3a['Full_Name']:!_[_0x21b3('0x1e')](_0x595c3a[_0x21b3('0x5f')])?_0x595c3a[_0x21b3('0x5f')]+'\x20'+_0x595c3a[_0x21b3('0x60')]:_0x595c3a['Last_Name'],'id':_0x595c3a['id']};_0x412536[_0x21b3('0x62')]=_['startCase'](_0x595c3a[_0x21b3('0x40')]);}if(_0x4bd19f[_0x21b3('0x63')]){_0x412536[_0x21b3('0x64')]=moment[_0x21b3('0x65')](parseInt(_0x4bd19f[_0x21b3('0x63')])*0x3e8)['format'](_0x21b3('0x66'));}else if(_0x4bd19f[_0x21b3('0x67')]&&_0x4bd19f[_0x21b3('0x68')]){_0x412536[_0x21b3('0x64')]=moment[_0x21b3('0x65')](moment(_0x4bd19f[_0x21b3('0x68')],_0x21b3('0x69'))[_0x21b3('0x6a')](moment(_0x4bd19f[_0x21b3('0x6b')],_0x21b3('0x69'))))[_0x21b3('0x33')](_0x21b3('0x66'));}switch(_0x4bd19f[_0x21b3('0x6c')]){case _0x21b3('0x6d'):_0x412536[_0x21b3('0x6e')]=_0x21b3('0x6f');break;case _0x21b3('0x70'):case _0x21b3('0x71'):_0x412536['Call_Result']=_0x21b3('0x72');break;case _0x21b3('0x73'):_0x412536[_0x21b3('0x6e')]='Rejected';break;case _0x21b3('0x74'):_0x412536[_0x21b3('0x6e')]=_0x21b3('0x75');break;case'timeout':_0x412536[_0x21b3('0x6e')]=_0x21b3('0x76');default:}_0x412536[_0x21b3('0x77')]=(_0x37a455===_0x21b3('0x78')?moment(_0x4bd19f[_0x21b3('0x6b')])[_0x21b3('0x33')](_0x21b3('0x69')):moment(_0x4bd19f['agentcalledAt'])['format'](_0x21b3('0x69')))||moment()['format'](_0x21b3('0x69'));_0x412536[_0x21b3('0x79')]=_0x37a455||_0x21b3('0x7a');_0x412536=_['merge'](_0x412536,getCustomFields(_0x3f8aab[_0x21b3('0x7b')],_0x4bd19f));return request({'method':_0x21b3('0x26'),'uri':_0x21b3('0x41')+_0x17bb4f+_0x21b3('0x7c'),'headers':{'Authorization':_0x21b3('0x34')+_0x3cfd1e},'body':{'data':[_0x412536]},'json':!![]})[_0x21b3('0x29')](function(_0x24deca){if(_0x24deca&&_0x24deca[_0x21b3('0x3f')][0x0]['code']==='SUCCESS'){logger['info'](_0x21b3('0x7d'));return{'id':_0x24deca['data'][0x0][_0x21b3('0x47')]['id']};}})[_0x21b3('0x2c')](function(_0x41d9ab){logger[_0x21b3('0x30')](_0x21b3('0x7e'),_0x41d9ab['stack']);console['log'](_0x21b3('0x7e'),_0x41d9ab);});}exports[_0x21b3('0x7f')]=function(_0x639eeb,_0x5cc1ed,_0x46f71c,_0x1d5c08,_0x1e322d,_0x201a12){var _0x17cfb7,_0x53a812,_0xa191b2;_0x201a12[_0x21b3('0x80')]=intUtil[_0x21b3('0x81')](_0x201a12['host']);_0x201a12[_0x21b3('0x82')]=intUtil[_0x21b3('0x81')](_0x201a12['serverUrl']);if(_0x1e322d&&_0x1e322d[_0x21b3('0x83')]){logger[_0x21b3('0x30')](_0x21b3('0x84'),_0x21b3('0x85'));_0x5cc1ed[_0x21b3('0x86')]=_0x201a12['serverUrl']+_0x21b3('0x87')+_0x5cc1ed[_0x21b3('0x88')]+_0x21b3('0x89')+md5(_0x5cc1ed[_0x21b3('0x88')]);}else{_0x5cc1ed[_0x21b3('0x86')]='';}var _0xb23b46=_0x201a12[_0x21b3('0x80')]===_0x21b3('0x8a')?'eu':_0x21b3('0x8b');return getAccessToken(_0x201a12)[_0x21b3('0x29')](function(_0x5424f5){_0xa191b2=_0x5424f5;return getUser(_0xa191b2,_0xb23b46,_0x201a12,_0x1d5c08[_0x21b3('0x38')]);})[_0x21b3('0x29')](function(_0x189876){_0x17cfb7=_0x189876;logger['info'](_0x21b3('0x8c'),_0x17cfb7['id']);return getEndUser(_0xa191b2,_0xb23b46,_0x201a12,_0x5cc1ed['calleridname'],_0x5cc1ed[_0x21b3('0x8d')],_0x17cfb7,_0x46f71c);})[_0x21b3('0x29')](function(_0x1650cb){_0x53a812=_0x1650cb;return getCall(_0xa191b2,_0xb23b46,_0x201a12,_0x17cfb7,_0x53a812,_0x46f71c,_0x5cc1ed,_0x21b3('0x7a'));})['then'](function(_0x1680da){if(_0x1680da){logger[_0x21b3('0x30')]('The\x20Call\x20ID\x20is:',_0x1680da['id']);logger[_0x21b3('0x30')]('[QUEUE]',_0x21b3('0x8e'));emit(util['format']('user:%s',_0x1d5c08['name']),'trigger:browser:url',{'uri':_0x21b3('0x8f')+_0x201a12['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1680da['id']});}})[_0x21b3('0x2c')](function(_0x1882af){logger[_0x21b3('0x2d')](_0x21b3('0x84'),JSON[_0x21b3('0x3d')](_0x1882af));});};exports[_0x21b3('0x78')]=function(_0x33b550,_0x571b14,_0x5059e5,_0x5dc3f8,_0x68e5a0,_0x1b22cd,_0x276c4e){var _0x1a06af,_0x420d75,_0x2af423;_0x1b22cd[_0x21b3('0x80')]=intUtil['stripTrailingSlash'](_0x1b22cd[_0x21b3('0x80')]);_0x1b22cd[_0x21b3('0x82')]=intUtil[_0x21b3('0x81')](_0x1b22cd[_0x21b3('0x82')]);if(_0x276c4e&&_0x276c4e[_0x21b3('0x90')]&&_0x276c4e[_0x21b3('0x90')]!==_0x21b3('0x91')){logger[_0x21b3('0x30')](_0x21b3('0x92'),_0x21b3('0x85'));_0x571b14['recordingURL']=_0x1b22cd[_0x21b3('0x82')]+_0x21b3('0x87')+_0x571b14[_0x21b3('0x88')]+'/downloads?type=uniqueid&token='+md5(_0x571b14[_0x21b3('0x88')]);}var _0x43d747=_0x1b22cd['host']==='zoho.eu'?'eu':_0x21b3('0x8b');return getAccessToken(_0x1b22cd)[_0x21b3('0x29')](function(_0x44fd7f){_0x2af423=_0x44fd7f;return getUser(_0x2af423,_0x43d747,_0x1b22cd,_0x5dc3f8[_0x21b3('0x38')]);})[_0x21b3('0x29')](function(_0x5c4e51){_0x1a06af=_0x5c4e51;logger[_0x21b3('0x30')](_0x21b3('0x8c'),_0x1a06af['id']);return getEndUser(_0x2af423,_0x43d747,_0x1b22cd,_0x571b14[_0x21b3('0x93')],_0x571b14[_0x21b3('0x94')],_0x1a06af,_0x5059e5);})[_0x21b3('0x29')](function(_0x11c328){_0x420d75=_0x11c328;return getCall(_0x2af423,_0x43d747,_0x1b22cd,_0x1a06af,_0x420d75,_0x5059e5,_0x571b14,_0x21b3('0x95'));})[_0x21b3('0x29')](function(_0x5bfdbc){if(_0x5bfdbc){logger['info'](_0x21b3('0x96'),_0x5bfdbc['id']);logger[_0x21b3('0x30')](_0x21b3('0x92'),_0x21b3('0x8e'));emit(util[_0x21b3('0x33')](_0x21b3('0x97'),_0x5dc3f8[_0x21b3('0x1a')]),'trigger:browser:url',{'uri':'https://crm.'+_0x1b22cd[_0x21b3('0x80')]+_0x21b3('0x98')+_0x5bfdbc['id']});}})['catch'](function(_0xafe7c0){logger[_0x21b3('0x2d')](_0x21b3('0x92'),JSON[_0x21b3('0x3d')](_0xafe7c0));});};exports['unmanaged']=function(_0x3a5403,_0x26165a,_0x33366a,_0x1013df,_0x1758dc,_0x32d4f4){var _0x50b41d,_0x453407,_0xdbf61;_0x32d4f4['host']=intUtil['stripTrailingSlash'](_0x32d4f4[_0x21b3('0x80')]);_0x32d4f4['serverUrl']=intUtil[_0x21b3('0x81')](_0x32d4f4['serverUrl']);if(_0x1758dc&&_0x1758dc[_0x21b3('0x83')]){logger[_0x21b3('0x30')]('['+_0x26165a[_0x21b3('0x6c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x26165a[_0x21b3('0x86')]=_0x32d4f4[_0x21b3('0x82')]+_0x21b3('0x87')+_0x26165a['uniqueid']+_0x21b3('0x89')+md5(_0x26165a[_0x21b3('0x88')]);}else{_0x26165a['recordingURL']='';}var _0x1b3c48=_0x32d4f4[_0x21b3('0x80')]===_0x21b3('0x8a')?'eu':_0x21b3('0x8b');return getAccessToken(_0x32d4f4)[_0x21b3('0x29')](function(_0x5d65f6){_0xdbf61=_0x5d65f6;return getUser(_0xdbf61,_0x1b3c48,_0x32d4f4);})['then'](function(_0x348ef0){_0x50b41d=_0x348ef0;logger[_0x21b3('0x30')](_0x21b3('0x8c'),_0x50b41d['id']);return getEndUser(_0xdbf61,_0x1b3c48,_0x32d4f4,_0x26165a[_0x21b3('0x99')],_0x26165a[_0x21b3('0x8d')],_0x50b41d,_0x33366a);})['then'](function(_0x4d6c78){_0x453407=_0x4d6c78;return getCall(_0xdbf61,_0x1b3c48,_0x32d4f4,_0x50b41d,_0x453407,_0x33366a,_0x26165a,'Inbound');})['then'](function(_0x5cc401){if(_0x5cc401){logger[_0x21b3('0x30')](_0x21b3('0x96'),_0x5cc401['id']);}})[_0x21b3('0x2c')](function(_0x5618c8){logger[_0x21b3('0x2d')]('['+_0x26165a[_0x21b3('0x6c')]['toUpperCase']()+']',JSON[_0x21b3('0x3d')](_0x5618c8));});}; \ No newline at end of file +var _0x64bb=['expires_in','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','email','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','moduleCreate','role','last_name','data','code','SUCCESS','log','CREATE\x20ERROR','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Owner','profile','administrator','first_name','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Fields','Call\x20created!','details','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','Outbound','The\x20Call\x20ID\x20is:','[OUTBOUND]','unmanaged','toUpperCase','request-promise','md5','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add'];(function(_0x20647c,_0x262425){var _0x51db8a=function(_0x4bdb98){while(--_0x4bdb98){_0x20647c['push'](_0x20647c['shift']());}};_0x51db8a(++_0x262425);}(_0x64bb,0x68));var _0xb64b=function(_0x2bcdff,_0x8fad66){_0x2bcdff=_0x2bcdff-0x0;var _0xbd3d07=_0x64bb[_0x2bcdff];return _0xbd3d07;};'use strict';var _=require('lodash');var rp=require(_0xb64b('0x0'));var md5=require(_0xb64b('0x1'));var util=require('util');var intUtil=require(_0xb64b('0x2'));var moment=require(_0xb64b('0x3'));var Redis=require(_0xb64b('0x4'));var BPromise=require('bluebird');var config=require(_0xb64b('0x5'));var logger=require(_0xb64b('0x6'))(_0xb64b('0x7'));config[_0xb64b('0x8')]=_[_0xb64b('0x9')](config[_0xb64b('0x8')],{'host':_0xb64b('0xa'),'port':0x18eb});var io=require(_0xb64b('0xb'))(new Redis(config[_0xb64b('0x8')]));function emit(_0x3fed6e,_0x21b2f7,_0x4ee418){io['to'](_0x3fed6e)[_0xb64b('0xc')](_0x21b2f7,_0x4ee418);}function request(_0xb58607){logger[_0xb64b('0xd')](_0xb64b('0xe'),JSON['stringify'](_0xb58607));return rp(_0xb58607);}function getCustomFields(_0x5ebe3f,_0x293742){var _0x5ba5e6={};if(_0x5ebe3f[_0xb64b('0xf')]>0x0){_[_0xb64b('0x10')](_0x5ebe3f,function(_0x24c4d7){if(_[_0xb64b('0x11')]([_0xb64b('0x12'),_0xb64b('0x13')],_0x24c4d7[_0xb64b('0x14')])&&_0x24c4d7[_0xb64b('0x15')]){_0x5ba5e6[_0x24c4d7[_0xb64b('0x15')]]=_0x24c4d7[_0xb64b('0x16')][_0xb64b('0x17')]();}else if(_0x24c4d7[_0xb64b('0x14')]===_0xb64b('0x18')&&_0x24c4d7[_0xb64b('0x19')]&&_0x24c4d7[_0xb64b('0x15')]&&_0x293742[_0x24c4d7[_0xb64b('0x19')]]){_0x5ba5e6[_0x24c4d7[_0xb64b('0x15')]]=_0x293742[_0x24c4d7[_0xb64b('0x19')]]['toString']();}else if(_0x24c4d7['type']===_0xb64b('0x1a')&&_0x24c4d7[_0xb64b('0x1b')]&&_0x24c4d7[_0xb64b('0x1b')][_0xb64b('0x1c')]&&_0x24c4d7[_0xb64b('0x15')]&&_0x293742[_0x24c4d7[_0xb64b('0x1b')][_0xb64b('0x1c')]['toLowerCase']()]){_0x5ba5e6[_0x24c4d7['idField']]=_0x293742[_0x24c4d7[_0xb64b('0x1b')]['name'][_0xb64b('0x1d')]()][_0xb64b('0x17')]();}});}return _0x5ba5e6;}function getName(_0xd2ee37){if(_0xd2ee37[_0xb64b('0x1e')]('\x20')>0x0){var _0x4198d6=_0xd2ee37[_0xb64b('0x1f')](/ (.+)/);if(_0x4198d6[0x1]){return _0x4198d6;}}return[_0xd2ee37,_0xd2ee37];}var accountsTokens={};function getAccessToken(_0xac904){return new Promise(function(_0x337bfb,_0x5d4957){if(!_[_0xb64b('0x20')](accountsTokens[_0xac904['id']])&&!_[_0xb64b('0x20')](accountsTokens[_0xac904['id']][_0xb64b('0x21')])){if(moment()[_0xb64b('0x22')](accountsTokens[_0xac904['id']]['expires_in'])){_0x337bfb(accountsTokens[_0xac904['id']][_0xb64b('0x21')]);}}var _0x1385e1;switch(_0xac904[_0xb64b('0x23')]){case'US':_0x1385e1=_0xb64b('0x24');break;case'AU':_0x1385e1='https://accounts.zoho.com.au';break;case'EU':_0x1385e1=_0xb64b('0x25');break;case'IN':_0x1385e1=_0xb64b('0x26');break;case'CN':_0x1385e1=_0xb64b('0x27');break;default:_0x1385e1=_0xb64b('0x25');break;}var _0x4bc57d={'method':_0xb64b('0x28'),'uri':_0x1385e1+_0xb64b('0x29'),'qs':{'refresh_token':_0xac904[_0xb64b('0x2a')],'client_id':_0xac904['clientId'],'client_secret':_0xac904['clientSecret'],'grant_type':_0xb64b('0x2b')},'json':!![]};return rp(_0x4bc57d)[_0xb64b('0x2c')](function(_0x3d97d2){accountsTokens[_0xac904['id']]={'access_token':_0x3d97d2[_0xb64b('0x21')],'expires_in':moment()[_0xb64b('0x2d')](_0x3d97d2[_0xb64b('0x2e')],_0xb64b('0x2f'))};_0x337bfb(_0x3d97d2[_0xb64b('0x21')]);})[_0xb64b('0x30')](function(_0x185af8){logger[_0xb64b('0x31')]('Failing\x20creating\x20the\x20access_token',_0x185af8[_0xb64b('0x32')]);_0x5d4957(_0x185af8);});});}function getUser(_0x2a7cb5,_0x6874ce,_0x4e5161,_0x10820d){logger[_0xb64b('0x33')](_0xb64b('0x34'));return request({'method':_0xb64b('0x35'),'uri':util[_0xb64b('0x36')](_0xb64b('0x37'),_0x6874ce),'qs':{'type':_0xb64b('0x38')},'headers':{'Authorization':_0xb64b('0x39')+_0x2a7cb5},'json':!![]})[_0xb64b('0x2c')](function(_0x56c365){if(_0x56c365['users']){var _0x3f4ced=-0x1;if(_[_0xb64b('0x3a')](_0x56c365[_0xb64b('0x3b')])){if(!_[_0xb64b('0x20')](_0x10820d)){_0x3f4ced=_[_0xb64b('0x3c')](_0x56c365[_0xb64b('0x3b')],function(_0x13b303){return _0x13b303[_0xb64b('0x3d')]===_0x10820d;});}if(_0x3f4ced>=0x0){logger['info']('Agent\x20found!');}else{logger['info'](_0xb64b('0x3e'));_0x3f4ced=_[_0xb64b('0x3c')](_0x56c365[_0xb64b('0x3b')],function(_0xf21994){return _0xf21994['profile'][_0xb64b('0x1c')]==='Administrator';});}return _0x56c365[_0xb64b('0x3b')][_0x3f4ced];}else{if(_0x56c365[_0xb64b('0x3f')]['profile'][_0xb64b('0x1c')]==='Administrator'){logger[_0xb64b('0x33')](_0xb64b('0x3e'));user=_0x56c365['user'];return user;}else{logger['error'](_0xb64b('0x40'),JSON[_0xb64b('0x41')](_0x56c365));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xb64b('0x41')](_0x56c365));}}}else{logger[_0xb64b('0x31')](_0xb64b('0x40'),JSON[_0xb64b('0x41')](_0x56c365));throw new Error(_0xb64b('0x42')+JSON[_0xb64b('0x41')](_0x56c365));}})[_0xb64b('0x30')](function(_0xf1ddff){console['error'](_0xf1ddff);});}function getZohoUser(_0x545341,_0x342782){return new BPromise(function(_0x11281e,_0x17fb64){request(_0x545341)[_0xb64b('0x2c')](function(_0x105980){var _0x16c74e=null;if(_0x105980){_0x16c74e=_0x105980['data'][0x0];_0x16c74e[_0xb64b('0x43')]=_0x342782;}_0x11281e(_0x16c74e);})['catch'](function(_0x3ee110){_0x17fb64(_0x3ee110);});});}function createEndUser(_0x124e0a,_0x424d6c,_0x1e1b21,_0x57d6ca,_0x403eb2,_0x37895f){var _0x1e1b21=getName(_0x1e1b21);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x424d6c+'/crm/v2/'+_['startCase'](_0x37895f[_0xb64b('0x44')])+'s','body':{'data':[{'Last_Name':_0x1e1b21[0x1],'First_Name':_0x1e1b21[0x0],'Phone':_0x57d6ca,'Owner':{'name':!_[_0xb64b('0x20')](_0x403eb2[_0xb64b('0x45')][_0xb64b('0x1c')])?_0x403eb2[_0xb64b('0x45')][_0xb64b('0x1c')]:!_[_0xb64b('0x20')](_0x403eb2['first_name'])?_0x403eb2['first_name']+'\x20'+_0x403eb2[_0xb64b('0x46')]:_0x403eb2[_0xb64b('0x46')],'id':_0x403eb2['id']}}]},'headers':{'Authorization':_0xb64b('0x39')+_0x124e0a},'json':!![]})[_0xb64b('0x2c')](function(_0x52b1f3){if(_0x52b1f3&&_0x52b1f3[_0xb64b('0x47')][0x0][_0xb64b('0x48')]===_0xb64b('0x49')){var _0x5a9110=_0x52b1f3[_0xb64b('0x47')][0x0]['details'];_0x5a9110[_0xb64b('0x43')]=_['startCase'](_0x37895f[_0xb64b('0x44')])+'s';return _0x5a9110;}logger['error'](_0xb64b('0x40'),JSON[_0xb64b('0x41')](data));throw new Error('Error:\x20'+JSON[_0xb64b('0x41')](data));})[_0xb64b('0x30')](function(_0x44c575){console[_0xb64b('0x4a')](_0xb64b('0x4b'),_0x44c575);});}function getEndUser(_0x3453d,_0x39eb40,_0x55e3f2,_0x4cce6b,_0x18c7d2,_0x3d36c3,_0x3a5c6c){var _0x41b6c6={'method':_0xb64b('0x35'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3453d},'json':!![]};switch(_0x3a5c6c['moduleSearch']){case _0xb64b('0x4c'):_0x41b6c6[_0xb64b('0x4d')]=_0xb64b('0x4e')+_0x39eb40+_0xb64b('0x4f')+_0x18c7d2+'))';return getZohoUser(_0x41b6c6,_0xb64b('0x50'))['then'](function(_0x4b3d3c){if(_0x4b3d3c)return _0x4b3d3c;_0x41b6c6[_0xb64b('0x4d')]='https://www.zohoapis.'+_0x39eb40+_0xb64b('0x51')+_0x18c7d2+'))';return getZohoUser(_0x41b6c6,_0xb64b('0x52'))['then'](function(_0x5464fd){if(_0x5464fd)return _0x5464fd;if(_0x3a5c6c['moduleCreate']!=_0xb64b('0x53')){return createEndUser(_0x3453d,_0x39eb40,_0x4cce6b,_0x18c7d2,_0x3d36c3,_0x3a5c6c);}else{return{};}});});break;case _0xb64b('0x54'):_0x41b6c6['uri']='https://www.zohoapis.'+_0x39eb40+_0xb64b('0x4f')+_0x18c7d2+'))';return getZohoUser(_0x41b6c6,'Contacts')[_0xb64b('0x2c')](function(_0x46c6af){if(_0x46c6af)return _0x46c6af;if(_0x3a5c6c[_0xb64b('0x44')]!=_0xb64b('0x53')){return createEndUser(_0x3453d,_0x39eb40,_0x4cce6b,_0x18c7d2,_0x3d36c3,_0x3a5c6c);}else{return{};}});break;case'lead':_0x41b6c6['uri']=_0xb64b('0x4e')+_0x39eb40+_0xb64b('0x51')+_0x18c7d2+'))';return getZohoUser(_0x41b6c6,'Leads')[_0xb64b('0x2c')](function(_0x4788ac){if(_0x4788ac)return _0x4788ac;if(_0x3a5c6c[_0xb64b('0x44')]!=_0xb64b('0x53')){return createEndUser(_0x3453d,_0x39eb40,_0x4cce6b,_0x18c7d2,_0x3d36c3,_0x3a5c6c);}else{return{};}});break;}}function getCall(_0x144130,_0x57dcb7,_0x8dfd1b,_0x4d1f34,_0x27ca37,_0xef65ef,_0x54c3c0,_0x3dc530){logger[_0xb64b('0x33')]('Creating\x20new\x20call...');var _0x196e2c={};_0x196e2c[_0xb64b('0x55')]={'name':!_[_0xb64b('0x20')](_0x4d1f34['role'][_0xb64b('0x1c')])&&!_[_0xb64b('0x20')](_0x4d1f34['profile'][_0xb64b('0x1c')])&&_0x4d1f34[_0xb64b('0x56')]['name']===_0xb64b('0x57')?_0x4d1f34[_0xb64b('0x45')]['name']:!_['isNil'](_0x4d1f34[_0xb64b('0x58')])?_0x4d1f34['first_name']+'\x20'+_0x4d1f34[_0xb64b('0x46')]:_0x4d1f34['last_name'],'id':_0x4d1f34['id']};_0x196e2c['Subject']=intUtil['getString'](_0xef65ef[_0xb64b('0x59')],_0x54c3c0,'\x20');_0x196e2c['Description']=intUtil[_0xb64b('0x5a')](_0xef65ef[_0xb64b('0x5b')],_0x54c3c0,'\x0a');if(_0x27ca37[_0xb64b('0x43')]===_0xb64b('0x50')){_0x196e2c[_0xb64b('0x5c')]={'name':!_[_0xb64b('0x20')](_0x27ca37[_0xb64b('0x5d')])?_0x27ca37['Full_Name']:!_[_0xb64b('0x20')](_0x27ca37['First_Name'])?_0x27ca37[_0xb64b('0x5e')]+'\x20'+_0x27ca37['Last_Name']:_0x27ca37[_0xb64b('0x5f')],'id':_0x27ca37['id']};}if(_0x27ca37[_0xb64b('0x43')]===_0xb64b('0x52')){_0x196e2c[_0xb64b('0x60')]={'name':!_['isNil'](_0x27ca37['Full_Name'])?_0x27ca37[_0xb64b('0x5d')]:!_[_0xb64b('0x20')](_0x27ca37[_0xb64b('0x5e')])?_0x27ca37[_0xb64b('0x5e')]+'\x20'+_0x27ca37[_0xb64b('0x5f')]:_0x27ca37['Last_Name'],'id':_0x27ca37['id']};_0x196e2c['$se_module']=_['startCase'](_0x27ca37[_0xb64b('0x43')]);}if(_0x54c3c0[_0xb64b('0x61')]){_0x196e2c['Call_Duration']=moment[_0xb64b('0x62')](parseInt(_0x54c3c0['talktime'])*0x3e8)[_0xb64b('0x36')](_0xb64b('0x63'));}else if(_0x54c3c0['answertime']&&_0x54c3c0[_0xb64b('0x64')]){_0x196e2c[_0xb64b('0x65')]=moment[_0xb64b('0x62')](moment(_0x54c3c0[_0xb64b('0x64')],_0xb64b('0x66'))['diff'](moment(_0x54c3c0[_0xb64b('0x67')],_0xb64b('0x66'))))[_0xb64b('0x36')](_0xb64b('0x63'));}switch(_0x54c3c0[_0xb64b('0x68')]){case _0xb64b('0x69'):_0x196e2c[_0xb64b('0x6a')]=_0xb64b('0x6b');break;case _0xb64b('0x6c'):case _0xb64b('0x6d'):_0x196e2c['Call_Result']=_0xb64b('0x6e');break;case _0xb64b('0x6f'):_0x196e2c[_0xb64b('0x6a')]=_0xb64b('0x70');break;case _0xb64b('0x71'):_0x196e2c['Call_Result']=_0xb64b('0x72');break;case _0xb64b('0x73'):_0x196e2c['Call_Result']=_0xb64b('0x74');default:}_0x196e2c[_0xb64b('0x75')]=(_0x3dc530===_0xb64b('0x76')?moment(_0x54c3c0[_0xb64b('0x67')])[_0xb64b('0x36')](_0xb64b('0x66')):moment(_0x54c3c0[_0xb64b('0x77')])[_0xb64b('0x36')](_0xb64b('0x66')))||moment()[_0xb64b('0x36')](_0xb64b('0x66'));_0x196e2c['Call_Type']=_0x3dc530||'Inbound';_0x196e2c=_['merge'](_0x196e2c,getCustomFields(_0xef65ef[_0xb64b('0x78')],_0x54c3c0));return request({'method':_0xb64b('0x28'),'uri':_0xb64b('0x4e')+_0x57dcb7+'/crm/v2/Calls','headers':{'Authorization':_0xb64b('0x39')+_0x144130},'body':{'data':[_0x196e2c]},'json':!![]})[_0xb64b('0x2c')](function(_0x3f50cc){if(_0x3f50cc&&_0x3f50cc[_0xb64b('0x47')][0x0][_0xb64b('0x48')]==='SUCCESS'){logger['info'](_0xb64b('0x79'));return{'id':_0x3f50cc[_0xb64b('0x47')][0x0][_0xb64b('0x7a')]['id']};}})[_0xb64b('0x30')](function(_0x5c1aa2){logger[_0xb64b('0x33')]('err',_0x5c1aa2['stack']);console['log']('err',_0x5c1aa2);});}exports['queue']=function(_0x3086ec,_0xc9bbba,_0x1ede3d,_0x2ae18c,_0xbcc020,_0x3629f4){var _0x244cba,_0x447f40,_0x251e4e;_0x3629f4[_0xb64b('0x7b')]=intUtil[_0xb64b('0x7c')](_0x3629f4['host']);_0x3629f4['serverUrl']=intUtil[_0xb64b('0x7c')](_0x3629f4[_0xb64b('0x7d')]);if(_0xbcc020&&_0xbcc020[_0xb64b('0x7e')]){logger[_0xb64b('0x33')](_0xb64b('0x7f'),'Recording\x20is\x20enabled!');_0xc9bbba[_0xb64b('0x80')]=_0x3629f4[_0xb64b('0x7d')]+_0xb64b('0x81')+_0xc9bbba['uniqueid']+_0xb64b('0x82')+md5(_0xc9bbba[_0xb64b('0x83')]);}else{_0xc9bbba[_0xb64b('0x80')]='';}var _0x41253f=_0x3629f4['host']===_0xb64b('0x84')?'eu':_0xb64b('0x85');return getAccessToken(_0x3629f4)['then'](function(_0x42b9d9){_0x251e4e=_0x42b9d9;return getUser(_0x251e4e,_0x41253f,_0x3629f4,_0x2ae18c['email']);})[_0xb64b('0x2c')](function(_0xc1231){_0x244cba=_0xc1231;logger[_0xb64b('0x33')](_0xb64b('0x86'),_0x244cba['id']);return getEndUser(_0x251e4e,_0x41253f,_0x3629f4,_0xc9bbba[_0xb64b('0x87')],_0xc9bbba[_0xb64b('0x88')],_0x244cba,_0x1ede3d);})['then'](function(_0x2518ad){_0x447f40=_0x2518ad;return getCall(_0x251e4e,_0x41253f,_0x3629f4,_0x244cba,_0x447f40,_0x1ede3d,_0xc9bbba,_0xb64b('0x89'));})[_0xb64b('0x2c')](function(_0x4f7074){if(_0x4f7074){logger[_0xb64b('0x33')]('The\x20Call\x20ID\x20is:',_0x4f7074['id']);logger[_0xb64b('0x33')](_0xb64b('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xb64b('0x8a'),_0x2ae18c['name']),_0xb64b('0x8b'),{'uri':_0xb64b('0x8c')+_0x3629f4[_0xb64b('0x7b')]+_0xb64b('0x8d')+_0x4f7074['id']});}})[_0xb64b('0x30')](function(_0x650c61){logger[_0xb64b('0x31')](_0xb64b('0x7f'),JSON[_0xb64b('0x41')](_0x650c61));});};exports[_0xb64b('0x76')]=function(_0x523996,_0x46381e,_0x916abd,_0x3abe48,_0xd72f9,_0x1f6ab1,_0x258729){var _0x2bee40,_0x4a9b42,_0x2a82a9;_0x1f6ab1['host']=intUtil[_0xb64b('0x7c')](_0x1f6ab1[_0xb64b('0x7b')]);_0x1f6ab1[_0xb64b('0x7d')]=intUtil['stripTrailingSlash'](_0x1f6ab1[_0xb64b('0x7d')]);if(_0x258729&&_0x258729[_0xb64b('0x8e')]&&_0x258729['recordingFormat']!==_0xb64b('0x8f')){logger[_0xb64b('0x33')]('[OUTBOUND]',_0xb64b('0x90'));_0x46381e['recordingURL']=_0x1f6ab1[_0xb64b('0x7d')]+'/api/voice/recordings/'+_0x46381e[_0xb64b('0x83')]+_0xb64b('0x82')+md5(_0x46381e['uniqueid']);}var _0x318965=_0x1f6ab1[_0xb64b('0x7b')]===_0xb64b('0x84')?'eu':_0xb64b('0x85');return getAccessToken(_0x1f6ab1)[_0xb64b('0x2c')](function(_0x3d473a){_0x2a82a9=_0x3d473a;return getUser(_0x2a82a9,_0x318965,_0x1f6ab1,_0x3abe48[_0xb64b('0x3d')]);})[_0xb64b('0x2c')](function(_0x5816f1){_0x2bee40=_0x5816f1;logger[_0xb64b('0x33')]('The\x20User\x20ID\x20is:',_0x2bee40['id']);return getEndUser(_0x2a82a9,_0x318965,_0x1f6ab1,_0x46381e['destcalleridname'],_0x46381e['destcalleridnum'],_0x2bee40,_0x916abd);})[_0xb64b('0x2c')](function(_0xded4ab){_0x4a9b42=_0xded4ab;return getCall(_0x2a82a9,_0x318965,_0x1f6ab1,_0x2bee40,_0x4a9b42,_0x916abd,_0x46381e,_0xb64b('0x91'));})[_0xb64b('0x2c')](function(_0x9628f3){if(_0x9628f3){logger[_0xb64b('0x33')](_0xb64b('0x92'),_0x9628f3['id']);logger[_0xb64b('0x33')](_0xb64b('0x93'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb64b('0x36')](_0xb64b('0x8a'),_0x3abe48[_0xb64b('0x1c')]),_0xb64b('0x8b'),{'uri':_0xb64b('0x8c')+_0x1f6ab1[_0xb64b('0x7b')]+_0xb64b('0x8d')+_0x9628f3['id']});}})[_0xb64b('0x30')](function(_0x2d286f){logger[_0xb64b('0x31')]('[OUTBOUND]',JSON[_0xb64b('0x41')](_0x2d286f));});};exports[_0xb64b('0x94')]=function(_0x16500e,_0x4e9117,_0x4b7db0,_0x279f96,_0x55c4ea,_0x1e0aa7){var _0x2fd1c1,_0xb45284,_0x5a11a1;_0x1e0aa7[_0xb64b('0x7b')]=intUtil[_0xb64b('0x7c')](_0x1e0aa7[_0xb64b('0x7b')]);_0x1e0aa7['serverUrl']=intUtil[_0xb64b('0x7c')](_0x1e0aa7[_0xb64b('0x7d')]);if(_0x55c4ea&&_0x55c4ea['monitor_format']){logger[_0xb64b('0x33')]('['+_0x4e9117[_0xb64b('0x68')][_0xb64b('0x95')]()+']',_0xb64b('0x90'));_0x4e9117[_0xb64b('0x80')]=_0x1e0aa7['serverUrl']+_0xb64b('0x81')+_0x4e9117[_0xb64b('0x83')]+_0xb64b('0x82')+md5(_0x4e9117[_0xb64b('0x83')]);}else{_0x4e9117[_0xb64b('0x80')]='';}var _0x17d99b=_0x1e0aa7[_0xb64b('0x7b')]==='zoho.eu'?'eu':_0xb64b('0x85');return getAccessToken(_0x1e0aa7)[_0xb64b('0x2c')](function(_0x3d7c5a){_0x5a11a1=_0x3d7c5a;return getUser(_0x5a11a1,_0x17d99b,_0x1e0aa7);})[_0xb64b('0x2c')](function(_0x4e5d1b){_0x2fd1c1=_0x4e5d1b;logger[_0xb64b('0x33')](_0xb64b('0x86'),_0x2fd1c1['id']);return getEndUser(_0x5a11a1,_0x17d99b,_0x1e0aa7,_0x4e9117['calleridname'],_0x4e9117[_0xb64b('0x88')],_0x2fd1c1,_0x4b7db0);})[_0xb64b('0x2c')](function(_0x10f1d7){_0xb45284=_0x10f1d7;return getCall(_0x5a11a1,_0x17d99b,_0x1e0aa7,_0x2fd1c1,_0xb45284,_0x4b7db0,_0x4e9117,_0xb64b('0x89'));})[_0xb64b('0x2c')](function(_0x5b2cf1){if(_0x5b2cf1){logger['info']('The\x20Call\x20ID\x20is:',_0x5b2cf1['id']);}})['catch'](function(_0x2fa711){logger['error']('['+_0x4e9117[_0xb64b('0x68')][_0xb64b('0x95')]()+']',JSON[_0xb64b('0x41')](_0x2fa711));});}; \ 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 3ff73df..ed4dce3 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 _0xe43f=['shelljs','mustache','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x562f0a,_0x1593f5){var _0x1b2cba=function(_0x452780){while(--_0x452780){_0x562f0a['push'](_0x562f0a['shift']());}};_0x1b2cba(++_0x1593f5);}(_0xe43f,0xdf));var _0xfe43=function(_0x17fea7,_0x102927){_0x17fea7=_0x17fea7-0x0;var _0x3150c3=_0xe43f[_0x17fea7];return _0x3150c3;};'use strict';var util=require(_0xfe43('0x0'));var sh=require(_0xfe43('0x1'));var Mustache=require(_0xfe43('0x2'));var logger=require('../../../../config/logger')(_0xfe43('0x3'));exports[_0xfe43('0x4')]=function(_0x3fd295,_0x2a3109){var _0x3b6f56=_0x3fd295[_0xfe43('0x5')]?_0x3fd295[_0xfe43('0x5')]:_0xfe43('0x6');var _0x3319a7=_0x3fd295[_0xfe43('0x7')]?Mustache[_0xfe43('0x8')](_0x3fd295[_0xfe43('0x7')],_0x2a3109):_0x2a3109;sh[_0xfe43('0x4')](_0x3319a7,function(_0x281935,_0x576f7e,_0x5eff98){if(_0x281935!==0x0){logger[_0xfe43('0x9')](util[_0xfe43('0xa')](_0xfe43('0xb'),_0x3b6f56,_0x3319a7,_0x281935,_0x5eff98));}else{logger[_0xfe43('0xc')](util['format'](_0xfe43('0xd'),_0x3b6f56,_0x3319a7,_0x576f7e));}});}; \ No newline at end of file +var _0xeeb1=['data2','Script','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec'];(function(_0x16783d,_0x366e77){var _0xb8342d=function(_0x1d974c){while(--_0x1d974c){_0x16783d['push'](_0x16783d['shift']());}};_0xb8342d(++_0x366e77);}(_0xeeb1,0x171));var _0x1eeb=function(_0x3a9e73,_0x567a70){_0x3a9e73=_0x3a9e73-0x0;var _0x5af67a=_0xeeb1[_0x3a9e73];return _0x5af67a;};'use strict';var util=require(_0x1eeb('0x0'));var sh=require(_0x1eeb('0x1'));var Mustache=require(_0x1eeb('0x2'));var logger=require(_0x1eeb('0x3'))(_0x1eeb('0x4'));exports[_0x1eeb('0x5')]=function(_0x2bb6c8,_0x3ec190){var _0x4a9bb8=_0x2bb6c8[_0x1eeb('0x6')]?_0x2bb6c8['data2']:_0x1eeb('0x7');var _0x35ab56=_0x2bb6c8['data3']?Mustache[_0x1eeb('0x8')](_0x2bb6c8[_0x1eeb('0x9')],_0x3ec190):_0x3ec190;sh['exec'](_0x35ab56,function(_0x3cba21,_0x29970c,_0x31756d){if(_0x3cba21!==0x0){logger[_0x1eeb('0xa')](util[_0x1eeb('0xb')](_0x1eeb('0xc'),_0x4a9bb8,_0x35ab56,_0x3cba21,_0x31756d));}else{logger[_0x1eeb('0xd')](util['format'](_0x1eeb('0xe'),_0x4a9bb8,_0x35ab56,_0x29970c));}});}; \ 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 c0af8e5..18f2756 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 _0x6272=['../../../../config/logger','data1','toUpperCase','data2','data5','headers','data6','parse','render','error','stack','GET','DELETE','PUT','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','util','lodash'];(function(_0x2491cb,_0x35968d){var _0xc6859f=function(_0x26cdf8){while(--_0x26cdf8){_0x2491cb['push'](_0x2491cb['shift']());}};_0xc6859f(++_0x35968d);}(_0x6272,0xd0));var _0x2627=function(_0x20ba37,_0x345e0c){_0x20ba37=_0x20ba37-0x0;var _0x2b8b0e=_0x6272[_0x20ba37];return _0x2b8b0e;};'use strict';var rp=require('request-promise');var util=require(_0x2627('0x0'));var _=require(_0x2627('0x1'));var Mustache=require('mustache');var logger=require(_0x2627('0x2'))('trigger');exports['exec']=function(_0x52e3c1,_0x56952c){var _0x2ab349,_0x3e61e9;var _0x331e0f={'method':_0x52e3c1[_0x2627('0x3')][_0x2627('0x4')](),'uri':Mustache['render'](_0x52e3c1[_0x2627('0x5')],_0x56952c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x52e3c1[_0x2627('0x6')])==='number'&&parseInt(_0x52e3c1[_0x2627('0x6')])>=0x1&&parseInt(_0x52e3c1['data5'])<=0xa?parseInt(_0x52e3c1[_0x2627('0x6')])*0x3e8:0x5*0x3e8};try{_0x331e0f[_0x2627('0x7')]=_0x52e3c1[_0x2627('0x8')]?JSON[_0x2627('0x9')](Mustache[_0x2627('0xa')](_0x52e3c1[_0x2627('0x8')],_0x56952c)):{};}catch(_0x236152){logger[_0x2627('0xb')](_0x236152[_0x2627('0xc')]);}switch(_0x52e3c1[_0x2627('0x3')][_0x2627('0x4')]()){case _0x2627('0xd'):case _0x2627('0xe'):_0x2ab349=null;_0x331e0f['qs']=_0x56952c;break;case'POST':case _0x2627('0xf'):if(_0x52e3c1['data7']){try{_0x2ab349=JSON[_0x2627('0x9')](Mustache[_0x2627('0xa')](_0x52e3c1['data7'],_0x56952c));_0x331e0f[_0x2627('0x10')]=_0x2ab349;}catch(_0x5e296e){logger[_0x2627('0xb')](_0x5e296e[_0x2627('0xc')]);logger[_0x2627('0xb')](_0x2627('0x11'));}}else{_0x2ab349=_0x56952c;_0x331e0f[_0x2627('0x10')]=_0x2ab349;}break;}logger['info'](util[_0x2627('0x12')](_0x2627('0x13'),_0x52e3c1[_0x2627('0x3')],_0x52e3c1['data2'],JSON[_0x2627('0x14')](_0x331e0f)));rp(_0x331e0f)[_0x2627('0x15')](function(_0x192352){_0x2ab349=!_['isNil'](_0x2ab349)?_0x2627('0x16')+_0x2ab349:'';_0x3e61e9=typeof _0x192352[_0x2627('0x10')]===_0x2627('0x17')?JSON['stringify'](_0x192352[_0x2627('0x10')]):_0x192352['body'];logger[_0x2627('0x18')](util[_0x2627('0x12')](_0x2627('0x19'),_0x52e3c1[_0x2627('0x3')],_0x52e3c1[_0x2627('0x5')],_0x192352[_0x2627('0x1a')],_0x3e61e9));})[_0x2627('0x1b')](function(_0xc1425c){logger[_0x2627('0xb')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x52e3c1['data1'],_0x52e3c1[_0x2627('0x5')],_0xc1425c['statusCode'],_0xc1425c[_0x2627('0x1c')],_0xc1425c[_0x2627('0x1d')]));});}; \ No newline at end of file +var _0x5889=['info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','render','data2','data5','data6','error','stack','data1','toUpperCase','GET','POST','PUT','data7','parse','body','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil',',\x20request\x20body:\x20','object','stringify'];(function(_0x3f1c5e,_0xe5362c){var _0x475515=function(_0x193475){while(--_0x193475){_0x3f1c5e['push'](_0x3f1c5e['shift']());}};_0x475515(++_0xe5362c);}(_0x5889,0x117));var _0x9588=function(_0x4146f0,_0x157c04){_0x4146f0=_0x4146f0-0x0;var _0x4e7394=_0x5889[_0x4146f0];return _0x4e7394;};'use strict';var rp=require(_0x9588('0x0'));var util=require(_0x9588('0x1'));var _=require(_0x9588('0x2'));var Mustache=require(_0x9588('0x3'));var logger=require('../../../../config/logger')(_0x9588('0x4'));exports[_0x9588('0x5')]=function(_0x83f572,_0x32a428){var _0x13c574,_0x5435af;var _0x81ac0d={'method':_0x83f572['data1']['toUpperCase'](),'uri':Mustache[_0x9588('0x6')](_0x83f572[_0x9588('0x7')],_0x32a428),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x83f572[_0x9588('0x8')])==='number'&&parseInt(_0x83f572[_0x9588('0x8')])>=0x1&&parseInt(_0x83f572[_0x9588('0x8')])<=0xa?parseInt(_0x83f572[_0x9588('0x8')])*0x3e8:0x5*0x3e8};try{_0x81ac0d['headers']=_0x83f572[_0x9588('0x9')]?JSON['parse'](Mustache[_0x9588('0x6')](_0x83f572['data6'],_0x32a428)):{};}catch(_0x26d6a1){logger[_0x9588('0xa')](_0x26d6a1[_0x9588('0xb')]);}switch(_0x83f572[_0x9588('0xc')][_0x9588('0xd')]()){case _0x9588('0xe'):case'DELETE':_0x13c574=null;_0x81ac0d['qs']=_0x32a428;break;case _0x9588('0xf'):case _0x9588('0x10'):if(_0x83f572[_0x9588('0x11')]){try{_0x13c574=JSON[_0x9588('0x12')](Mustache[_0x9588('0x6')](_0x83f572['data7'],_0x32a428));_0x81ac0d[_0x9588('0x13')]=_0x13c574;}catch(_0x10c33f){logger['error'](_0x10c33f[_0x9588('0xb')]);logger[_0x9588('0xa')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x13c574=_0x32a428;_0x81ac0d[_0x9588('0x13')]=_0x13c574;}break;}logger['info'](util[_0x9588('0x14')](_0x9588('0x15'),_0x83f572['data1'],_0x83f572['data2'],JSON['stringify'](_0x81ac0d)));rp(_0x81ac0d)[_0x9588('0x16')](function(_0x27932d){_0x13c574=!_[_0x9588('0x17')](_0x13c574)?_0x9588('0x18')+_0x13c574:'';_0x5435af=typeof _0x27932d['body']===_0x9588('0x19')?JSON[_0x9588('0x1a')](_0x27932d[_0x9588('0x13')]):_0x27932d[_0x9588('0x13')];logger[_0x9588('0x1b')](util[_0x9588('0x14')](_0x9588('0x1c'),_0x83f572['data1'],_0x83f572[_0x9588('0x7')],_0x27932d[_0x9588('0x1d')],_0x5435af));})[_0x9588('0x1e')](function(_0x11a8f6){logger[_0x9588('0xa')](util[_0x9588('0x14')](_0x9588('0x1f'),_0x83f572[_0x9588('0xc')],_0x83f572['data2'],_0x11a8f6[_0x9588('0x1d')],_0x11a8f6[_0x9588('0x20')],_0x11a8f6[_0x9588('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 85f108d..574bc59 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 _0xb7fd=['message','catch','exports','jayson/promise','bluebird','routing','client','http','request','then','debug','rpc','error'];(function(_0x15aad3,_0x5594e5){var _0x4dfda5=function(_0xe7e0f2){while(--_0xe7e0f2){_0x15aad3['push'](_0x15aad3['shift']());}};_0x4dfda5(++_0x5594e5);}(_0xb7fd,0x17c));var _0xdb7f=function(_0x54f403,_0x84a92b){_0x54f403=_0x54f403-0x0;var _0xd6cd37=_0xb7fd[_0x54f403];return _0xd6cd37;};'use strict';var jayson=require(_0xdb7f('0x0'));var BPromise=require(_0xdb7f('0x1'));var logger=require('../../config/logger')(_0xdb7f('0x2'));var client=jayson[_0xdb7f('0x3')][_0xdb7f('0x4')]({'port':0x2329});client['Request']=function(_0x5ae4cd,_0x220d3d){return new BPromise(function(_0x57668c,_0x2b61c9){return client[_0xdb7f('0x5')](_0x5ae4cd,_0x220d3d)[_0xdb7f('0x6')](function(_0x104e57){logger[_0xdb7f('0x7')](_0xdb7f('0x8'),_0xdb7f('0x2'),_0x5ae4cd,_0x220d3d,_0x104e57);if(_0x104e57['error']){logger[_0xdb7f('0x9')](_0xdb7f('0x8'),'routing',_0x5ae4cd,_0x104e57[_0xdb7f('0x9')][_0xdb7f('0xa')],_0x220d3d);return _0x2b61c9(_0x104e57[_0xdb7f('0x9')][_0xdb7f('0xa')]);}else{return _0x57668c(_0x104e57['result']);}})[_0xdb7f('0xb')](function(_0x2c723e){logger[_0xdb7f('0x9')](_0xdb7f('0x8'),_0xdb7f('0x2'),_0x5ae4cd,_0x2c723e,_0x220d3d);return _0x2b61c9(_0x2c723e);});});};module[_0xdb7f('0xc')]=client; \ No newline at end of file +var _0x3d6e=['bluebird','../../config/logger','routing','client','then','error','rpc','message','result','catch','exports'];(function(_0x424e34,_0x251b53){var _0x5082cb=function(_0x34cee2){while(--_0x34cee2){_0x424e34['push'](_0x424e34['shift']());}};_0x5082cb(++_0x251b53);}(_0x3d6e,0xc6));var _0xe3d6=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3d6e[_0xc4001c];return _0x49f7bc;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe3d6('0x0'));var logger=require(_0xe3d6('0x1'))(_0xe3d6('0x2'));var client=jayson[_0xe3d6('0x3')]['http']({'port':0x2329});client['Request']=function(_0x57ef08,_0x6de6b3){return new BPromise(function(_0x20e829,_0x28f69d){return client['request'](_0x57ef08,_0x6de6b3)[_0xe3d6('0x4')](function(_0x48699d){logger['debug']('rpc',_0xe3d6('0x2'),_0x57ef08,_0x6de6b3,_0x48699d);if(_0x48699d['error']){logger[_0xe3d6('0x5')](_0xe3d6('0x6'),_0xe3d6('0x2'),_0x57ef08,_0x48699d[_0xe3d6('0x5')][_0xe3d6('0x7')],_0x6de6b3);return _0x28f69d(_0x48699d[_0xe3d6('0x5')][_0xe3d6('0x7')]);}else{return _0x20e829(_0x48699d[_0xe3d6('0x8')]);}})[_0xe3d6('0x9')](function(_0x46ff39){logger['error'](_0xe3d6('0x6'),_0xe3d6('0x2'),_0x57ef08,_0x46ff39,_0x6de6b3);return _0x28f69d(_0x46ff39);});});};module[_0xe3d6('0xa')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index bfd9fb8..1cfd248 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 _0xa3d0=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization'];(function(_0x249d51,_0x1953cc){var _0x21e36f=function(_0x132671){while(--_0x132671){_0x249d51['push'](_0x249d51['shift']());}};_0x21e36f(++_0x1953cc);}(_0xa3d0,0x80));var _0x0a3d=function(_0x1bc90d,_0x14134f){_0x1bc90d=_0x1bc90d-0x0;var _0x457c44=_0xa3d0[_0x1bc90d];return _0x457c44;};'use strict';var server=require(_0x0a3d('0x0'));var Realtime=require(_0x0a3d('0x1'));var EmailChannel=require(_0x0a3d('0x2'));var mailAccount=require(_0x0a3d('0x3'));var setting=require(_0x0a3d('0x4'));var logger=require(_0x0a3d('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x0a3d('0x6')]()[_0x0a3d('0x7')](mailAccount[_0x0a3d('0x8')]())[_0x0a3d('0x7')](realtime['initMailAccounts']())['then'](function(){email[_0x0a3d('0x9')](realtime[_0x0a3d('0xa')]);return realtime;});}function main(){return server[_0x0a3d('0xb')](realtime,email)[_0x0a3d('0x7')](function(){return initRealtime();})[_0x0a3d('0x7')](function(){return setting[_0x0a3d('0xc')]();})[_0x0a3d('0x7')](function(_0x25bf6f){return setInterval(initRealtime,_0x25bf6f[_0x0a3d('0xd')]*0x3e8);})['catch'](function(_0x1e540d){logger[_0x0a3d('0xe')](_0x0a3d('0xf'),_0x1e540d);});}main(); \ No newline at end of file +var _0xcb86=['catch','error','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','getMailAccounts','then','initMailAccounts','refresh','getSettings','loginMailFrequency'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb86,0x11a));var _0x6cb8=function(_0xdcaf6,_0x4779e0){_0xdcaf6=_0xdcaf6-0x0;var _0x3728f0=_0xcb86[_0xdcaf6];return _0x3728f0;};'use strict';var server=require('./server');var Realtime=require(_0x6cb8('0x0'));var EmailChannel=require(_0x6cb8('0x1'));var mailAccount=require(_0x6cb8('0x2'));var setting=require(_0x6cb8('0x3'));var logger=require(_0x6cb8('0x4'))(_0x6cb8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount[_0x6cb8('0x6')]())[_0x6cb8('0x7')](realtime[_0x6cb8('0x8')]())[_0x6cb8('0x7')](function(){email[_0x6cb8('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x6cb8('0x7')](function(){return initRealtime();})['then'](function(){return setting[_0x6cb8('0xa')]();})[_0x6cb8('0x7')](function(_0x183d59){return setInterval(initRealtime,_0x183d59[_0x6cb8('0xb')]*0x3e8);})[_0x6cb8('0xc')](function(_0x7e834e){logger[_0x6cb8('0xd')]('Email\x20service\x20initialization',_0x7e834e);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3405b15..d706dd3 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 _0xa4a7=['end','handleImapEnd','error','handleImapError','status','disabled','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','lastSync','sendMail','send','Smtp','verify','verified','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','active','Imap','messageStatus','total','isNil','md5','mailAccount:update','prototype','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail'];(function(_0x15efa6,_0xbd64f2){var _0x2b3752=function(_0x18b223){while(--_0x18b223){_0x15efa6['push'](_0x15efa6['shift']());}};_0x2b3752(++_0xbd64f2);}(_0xa4a7,0x103));var _0x7a4a=function(_0xffecfd,_0x4d0a92){_0xffecfd=_0xffecfd-0x0;var _0x34eb4c=_0xa4a7[_0xffecfd];return _0x34eb4c;};'use strict';var _=require(_0x7a4a('0x0'));var moment=require(_0x7a4a('0x1'));var BPromise=require(_0x7a4a('0x2'));var md5=require('md5');var Redis=require(_0x7a4a('0x3'));var config=require(_0x7a4a('0x4'));var logger=require(_0x7a4a('0x5'))(_0x7a4a('0x6'));config[_0x7a4a('0x7')]=_[_0x7a4a('0x8')](config['redis'],{'host':_0x7a4a('0x9'),'port':0x18eb});var io=require(_0x7a4a('0xa'))(new Redis(config[_0x7a4a('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x7a4a('0xb'));var mailAccount=require(_0x7a4a('0xc'));var md5Accounts={};function EmailChannel(_0x3f4f4b){logger[_0x7a4a('0xd')](_0x7a4a('0xe'));this['mailAccounts']=_0x3f4f4b[_0x7a4a('0xf')];this[_0x7a4a('0x10')]={};this[_0x7a4a('0x11')]=new EmailSmtp();}EmailChannel['prototype'][_0x7a4a('0x12')]=function(_0x484f00){var _0x3946bc=this[_0x7a4a('0xf')][_0x484f00];var _0xd90ed5={'id':_0x3946bc['id'],'name':_0x3946bc[_0x7a4a('0x13')],'key':_0x3946bc['key'],'active':_0x3946bc[_0x7a4a('0x14')],'Imap':{'status':_0x3946bc[_0x7a4a('0x15')]['status'],'messageStatus':_0x3946bc['Imap'][_0x7a4a('0x16')],'total':_0x3946bc['Imap'][_0x7a4a('0x17')]}};if(_[_0x7a4a('0x18')](md5Accounts[_0x484f00])){md5Accounts[_0x484f00]={};}var _0x290b7c=md5(JSON['stringify'](_0xd90ed5));if(md5Accounts[_0x484f00]['md5']!==_0x290b7c){md5Accounts[_0x484f00][_0x7a4a('0x19')]=_0x290b7c;io[_0x7a4a('0x12')](_0x7a4a('0x1a'),_0xd90ed5);}};EmailChannel[_0x7a4a('0x1b')]['refresh']=function(_0x9c40b1){for(var _0xad84bd in _0x9c40b1){if(_0x9c40b1[_0x7a4a('0x1c')](_0xad84bd)){if(_0x9c40b1[_0xad84bd][_0x7a4a('0x15')]&&_0x9c40b1[_0xad84bd][_0x7a4a('0x14')]){var _0x10d193=_0x9c40b1[_0xad84bd][_0x7a4a('0x15')];if(!_0x10d193[_0x7a4a('0x1d')]&&_0x9c40b1[_0xad84bd][_0x7a4a('0x1e')]!==_0x7a4a('0x1f'))_0x10d193[_0x7a4a('0x1d')]=_0x9c40b1[_0xad84bd][_0x7a4a('0x1e')];if(!this[_0x7a4a('0x10')][_0x7a4a('0x1c')](_0x10d193['id'])){this[_0x7a4a('0x10')][_0x10d193['id']]=new EmailImap(_0x10d193,_0x9c40b1[_0xad84bd][_0x7a4a('0x6')]);this['imapAccounts'][_0x10d193['id']]['on'](_0x7a4a('0x20'),this[_0x7a4a('0x21')][_0x7a4a('0x22')](this,_0xad84bd));this[_0x7a4a('0x10')][_0x10d193['id']]['on']('email',this[_0x7a4a('0x23')][_0x7a4a('0x22')](this,_0xad84bd));this['imapAccounts'][_0x10d193['id']]['on'](_0x7a4a('0x24'),this[_0x7a4a('0x25')][_0x7a4a('0x22')](this,_0xad84bd));this['imapAccounts'][_0x10d193['id']]['on'](_0x7a4a('0x26'),this[_0x7a4a('0x27')][_0x7a4a('0x22')](this,_0xad84bd));}}else{if(_[_0x7a4a('0x18')](this[_0x7a4a('0xf')][_0xad84bd][_0x7a4a('0x15')])){this['mailAccounts'][_0xad84bd][_0x7a4a('0x15')]={};}this['mailAccounts'][_0xad84bd]['Imap'][_0x7a4a('0x28')]=_0x7a4a('0x29');this[_0x7a4a('0xf')][_0xad84bd]['Imap'][_0x7a4a('0x16')]='';this['emit'](_0xad84bd);}}}};EmailChannel[_0x7a4a('0x1b')][_0x7a4a('0x21')]=function(_0x42cd53,_0x38d331){if(this[_0x7a4a('0xf')][_0x42cd53]){this[_0x7a4a('0xf')][_0x42cd53][_0x7a4a('0x15')][_0x7a4a('0x28')]='connected';this[_0x7a4a('0xf')][_0x42cd53][_0x7a4a('0x15')]['messageStatus']=_0x38d331[_0x7a4a('0x13')];if(_0x38d331['messages']){this['mailAccounts'][_0x42cd53][_0x7a4a('0x15')]['total']=_0x38d331['messages']['total'];}return this['emit'](_0x42cd53);}};EmailChannel['prototype']['handleImapEmail']=function(_0x239098,_0x4980d9){logger['info'](_0x7a4a('0x2a'),_0x4980d9[_0x7a4a('0x2b')],_0x4980d9[_0x7a4a('0x2c')],_0x4980d9[_0x7a4a('0x2d')],_0x239098);if(this[_0x7a4a('0xf')][_0x239098]){return mailAccount[_0x7a4a('0x2e')](_0x239098,_0x4980d9)[_0x7a4a('0x2f')](function(_0x5ed715){if(_0x5ed715){logger[_0x7a4a('0xd')](_0x7a4a('0x30'));}})[_0x7a4a('0x31')](function(_0x1db8a9){logger[_0x7a4a('0x26')](_0x7a4a('0x32'),JSON[_0x7a4a('0x33')](_0x1db8a9));});}};EmailChannel[_0x7a4a('0x1b')]['handleImapEnd']=function(_0x4a467a){if(this['mailAccounts'][_0x4a467a]&&this[_0x7a4a('0xf')][_0x4a467a]['Imap']){if(this[_0x7a4a('0x10')][this[_0x7a4a('0xf')][_0x4a467a][_0x7a4a('0x15')]['id']]){delete this[_0x7a4a('0x10')][this[_0x7a4a('0xf')][_0x4a467a][_0x7a4a('0x15')]['id']];}this['mailAccounts'][_0x4a467a]['Imap'][_0x7a4a('0x34')]=moment();this[_0x7a4a('0x12')](_0x4a467a);}};EmailChannel[_0x7a4a('0x1b')][_0x7a4a('0x27')]=function(_0x4d2fe6,_0x406ee7){if(this['mailAccounts'][_0x4d2fe6]){this[_0x7a4a('0xf')][_0x4d2fe6][_0x7a4a('0x15')][_0x7a4a('0x28')]=_0x7a4a('0x26');this[_0x7a4a('0xf')][_0x4d2fe6]['Imap']['messageStatus']=_0x406ee7;return this[_0x7a4a('0x12')](_0x4d2fe6);}};EmailChannel['prototype'][_0x7a4a('0x35')]=function(_0x5ca454,_0x1cb576){return this['smtp'][_0x7a4a('0x36')](_0x5ca454,_0x1cb576);};EmailChannel[_0x7a4a('0x1b')]['verifySmtp']=function(_0x1f36e5){var _0xdfb739=this;if(this[_0x7a4a('0xf')][_0x1f36e5['id']]){if(_['isNil'](this['mailAccounts'][_0x1f36e5['id']][_0x7a4a('0x37')])){this['mailAccounts'][_0x1f36e5['id']][_0x7a4a('0x37')]={};}this[_0x7a4a('0xf')][_0x1f36e5['id']][_0x7a4a('0x37')][_0x7a4a('0x34')]=moment();return new BPromise(function(_0x1eeeaa,_0x498634){return _0xdfb739[_0x7a4a('0x11')][_0x7a4a('0x38')](_0x1f36e5)[_0x7a4a('0x2f')](function(_0x19dda0){_0xdfb739[_0x7a4a('0xf')][_0x1f36e5['id']][_0x7a4a('0x37')][_0x7a4a('0x28')]=_0x7a4a('0x39');_0xdfb739[_0x7a4a('0xf')][_0x1f36e5['id']][_0x7a4a('0x37')][_0x7a4a('0x16')]='';_0xdfb739[_0x7a4a('0x12')](_0x1f36e5['id']);_0x1eeeaa(_0x19dda0);})['catch'](function(_0x28ebf7){_0xdfb739['mailAccounts'][_0x1f36e5['id']][_0x7a4a('0x37')]['status']='error';_0xdfb739[_0x7a4a('0xf')][_0x1f36e5['id']][_0x7a4a('0x37')][_0x7a4a('0x16')]=_0x28ebf7;_0xdfb739[_0x7a4a('0x12')](_0x1f36e5['id']);_0x498634(_0x28ebf7);});});}return this['smtp'][_0x7a4a('0x38')](_0x1f36e5);};module[_0x7a4a('0x3a')]=EmailChannel; \ No newline at end of file +var _0x2a03=['isNil','stringify','refresh','hasOwnProperty','service','provider','imapAccounts','box','handleImapBox','email','bind','end','handleImapEnd','error','disabled','prototype','connected','name','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','smtp','Smtp','verify','exports','lodash','bluebird','md5','../../../config/environment','defaults','redis','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','emit','key','Imap','status','messageStatus'];(function(_0x4e3c40,_0x1da9ec){var _0x387e11=function(_0x2f18f0){while(--_0x2f18f0){_0x4e3c40['push'](_0x4e3c40['shift']());}};_0x387e11(++_0x1da9ec);}(_0x2a03,0xc3));var _0x32a0=function(_0x24403d,_0x94ebf1){_0x24403d=_0x24403d-0x0;var _0x3fabf3=_0x2a03[_0x24403d];return _0x3fabf3;};'use strict';var _=require(_0x32a0('0x0'));var moment=require('moment');var BPromise=require(_0x32a0('0x1'));var md5=require(_0x32a0('0x2'));var Redis=require('ioredis');var config=require(_0x32a0('0x3'));var logger=require('../../../config/logger')('email');config['redis']=_[_0x32a0('0x4')](config[_0x32a0('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x32a0('0x6'))(new Redis(config[_0x32a0('0x5')]));var EmailImap=require(_0x32a0('0x7'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x32a0('0x8'));var md5Accounts={};function EmailChannel(_0x5b7675){logger[_0x32a0('0x9')](_0x32a0('0xa'));this[_0x32a0('0xb')]=_0x5b7675[_0x32a0('0xb')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x32a0('0xc')]=function(_0x273f4a){var _0x960eda=this[_0x32a0('0xb')][_0x273f4a];var _0x29c09f={'id':_0x960eda['id'],'name':_0x960eda['name'],'key':_0x960eda[_0x32a0('0xd')],'active':_0x960eda['active'],'Imap':{'status':_0x960eda[_0x32a0('0xe')][_0x32a0('0xf')],'messageStatus':_0x960eda[_0x32a0('0xe')][_0x32a0('0x10')],'total':_0x960eda['Imap']['total']}};if(_[_0x32a0('0x11')](md5Accounts[_0x273f4a])){md5Accounts[_0x273f4a]={};}var _0x1316c9=md5(JSON[_0x32a0('0x12')](_0x29c09f));if(md5Accounts[_0x273f4a][_0x32a0('0x2')]!==_0x1316c9){md5Accounts[_0x273f4a][_0x32a0('0x2')]=_0x1316c9;io['emit']('mailAccount:update',_0x29c09f);}};EmailChannel['prototype'][_0x32a0('0x13')]=function(_0x53c8b6){for(var _0x465639 in _0x53c8b6){if(_0x53c8b6[_0x32a0('0x14')](_0x465639)){if(_0x53c8b6[_0x465639][_0x32a0('0xe')]&&_0x53c8b6[_0x465639]['active']){var _0x2a7979=_0x53c8b6[_0x465639][_0x32a0('0xe')];if(!_0x2a7979[_0x32a0('0x15')]&&_0x53c8b6[_0x465639][_0x32a0('0x16')]!=='custom')_0x2a7979[_0x32a0('0x15')]=_0x53c8b6[_0x465639][_0x32a0('0x16')];if(!this[_0x32a0('0x17')][_0x32a0('0x14')](_0x2a7979['id'])){this[_0x32a0('0x17')][_0x2a7979['id']]=new EmailImap(_0x2a7979,_0x53c8b6[_0x465639]['email']);this[_0x32a0('0x17')][_0x2a7979['id']]['on'](_0x32a0('0x18'),this[_0x32a0('0x19')]['bind'](this,_0x465639));this[_0x32a0('0x17')][_0x2a7979['id']]['on'](_0x32a0('0x1a'),this['handleImapEmail'][_0x32a0('0x1b')](this,_0x465639));this['imapAccounts'][_0x2a7979['id']]['on'](_0x32a0('0x1c'),this[_0x32a0('0x1d')][_0x32a0('0x1b')](this,_0x465639));this[_0x32a0('0x17')][_0x2a7979['id']]['on'](_0x32a0('0x1e'),this['handleImapError']['bind'](this,_0x465639));}}else{if(_[_0x32a0('0x11')](this[_0x32a0('0xb')][_0x465639][_0x32a0('0xe')])){this[_0x32a0('0xb')][_0x465639][_0x32a0('0xe')]={};}this['mailAccounts'][_0x465639][_0x32a0('0xe')][_0x32a0('0xf')]=_0x32a0('0x1f');this[_0x32a0('0xb')][_0x465639][_0x32a0('0xe')][_0x32a0('0x10')]='';this[_0x32a0('0xc')](_0x465639);}}}};EmailChannel[_0x32a0('0x20')][_0x32a0('0x19')]=function(_0x3a440f,_0x5a50cd){if(this[_0x32a0('0xb')][_0x3a440f]){this['mailAccounts'][_0x3a440f][_0x32a0('0xe')][_0x32a0('0xf')]=_0x32a0('0x21');this[_0x32a0('0xb')][_0x3a440f][_0x32a0('0xe')][_0x32a0('0x10')]=_0x5a50cd[_0x32a0('0x22')];if(_0x5a50cd[_0x32a0('0x23')]){this[_0x32a0('0xb')][_0x3a440f][_0x32a0('0xe')][_0x32a0('0x24')]=_0x5a50cd['messages'][_0x32a0('0x24')];}return this[_0x32a0('0xc')](_0x3a440f);}};EmailChannel[_0x32a0('0x20')][_0x32a0('0x25')]=function(_0x1186e6,_0x3bd303){logger[_0x32a0('0x9')](_0x32a0('0x26'),_0x3bd303[_0x32a0('0x27')],_0x3bd303[_0x32a0('0x28')],_0x3bd303['from'],_0x1186e6);if(this['mailAccounts'][_0x1186e6]){return mailAccount[_0x32a0('0x29')](_0x1186e6,_0x3bd303)[_0x32a0('0x2a')](function(_0xede672){if(_0xede672){logger[_0x32a0('0x9')](_0x32a0('0x2b'));}})[_0x32a0('0x2c')](function(_0x3c9f0e){logger[_0x32a0('0x1e')](_0x32a0('0x2d'),JSON[_0x32a0('0x12')](_0x3c9f0e));});}};EmailChannel[_0x32a0('0x20')]['handleImapEnd']=function(_0x179eea){if(this['mailAccounts'][_0x179eea]&&this['mailAccounts'][_0x179eea]['Imap']){if(this[_0x32a0('0x17')][this['mailAccounts'][_0x179eea][_0x32a0('0xe')]['id']]){delete this[_0x32a0('0x17')][this[_0x32a0('0xb')][_0x179eea][_0x32a0('0xe')]['id']];}this['mailAccounts'][_0x179eea]['Imap'][_0x32a0('0x2e')]=moment();this['emit'](_0x179eea);}};EmailChannel[_0x32a0('0x20')][_0x32a0('0x2f')]=function(_0x47a795,_0x29699b){if(this[_0x32a0('0xb')][_0x47a795]){this[_0x32a0('0xb')][_0x47a795][_0x32a0('0xe')][_0x32a0('0xf')]=_0x32a0('0x1e');this[_0x32a0('0xb')][_0x47a795][_0x32a0('0xe')][_0x32a0('0x10')]=_0x29699b;return this[_0x32a0('0xc')](_0x47a795);}};EmailChannel[_0x32a0('0x20')][_0x32a0('0x30')]=function(_0x3c44c5,_0x2fa0a8){return this[_0x32a0('0x31')]['send'](_0x3c44c5,_0x2fa0a8);};EmailChannel['prototype']['verifySmtp']=function(_0x57cf8b){var _0x2a35b8=this;if(this['mailAccounts'][_0x57cf8b['id']]){if(_[_0x32a0('0x11')](this[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')])){this[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')]={};}this[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')][_0x32a0('0x2e')]=moment();return new BPromise(function(_0x5e3dff,_0x57c0e8){return _0x2a35b8[_0x32a0('0x31')][_0x32a0('0x33')](_0x57cf8b)[_0x32a0('0x2a')](function(_0x4edbc3){_0x2a35b8[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')]['status']='verified';_0x2a35b8[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')][_0x32a0('0x10')]='';_0x2a35b8[_0x32a0('0xc')](_0x57cf8b['id']);_0x5e3dff(_0x4edbc3);})[_0x32a0('0x2c')](function(_0x27d70a){_0x2a35b8[_0x32a0('0xb')][_0x57cf8b['id']][_0x32a0('0x32')]['status']=_0x32a0('0x1e');_0x2a35b8['mailAccounts'][_0x57cf8b['id']][_0x32a0('0x32')][_0x32a0('0x10')]=_0x27d70a;_0x2a35b8[_0x32a0('0xc')](_0x57cf8b['id']);_0x57c0e8(_0x27d70a);});});}return this[_0x32a0('0x31')][_0x32a0('0x33')](_0x57cf8b);};module[_0x32a0('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 3aef664..7a2d719 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 _0x9b0d=['simpleParser','Iconv','events','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','ready','bind','once','end','handleEnd','error','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','required','handleReady','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','emit','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','mailparser'];(function(_0x4b88f8,_0x20ae18){var _0x15ecc5=function(_0x24bb95){while(--_0x24bb95){_0x4b88f8['push'](_0x4b88f8['shift']());}};_0x15ecc5(++_0x20ae18);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x3741ed,_0x255245){_0x3741ed=_0x3741ed-0x0;var _0x3b62a2=_0x9b0d[_0x3741ed];return _0x3b62a2;};'use strict';var _=require('lodash');var util=require(_0xd9b0('0x0'));var Imap=require(_0xd9b0('0x1'));var simpleParser=require(_0xd9b0('0x2'))[_0xd9b0('0x3')];var Iconv=require('iconv')[_0xd9b0('0x4')];var EventEmitter=require(_0xd9b0('0x5'))[_0xd9b0('0x6')];var utils=require(_0xd9b0('0x7'));var logger=require('../../../config/logger')(_0xd9b0('0x8'));function EmailImap(_0x21798d,_0x41dad9){this[_0xd9b0('0x9')]=_0xd9b0('0xa');this[_0xd9b0('0xb')]=this[_0xd9b0('0xc')](_0x21798d,_0x41dad9);this['imap']=new Imap(this[_0xd9b0('0xb')]);this[_0xd9b0('0x1')]['once'](_0xd9b0('0xd'),this['handleReady'][_0xd9b0('0xe')](this));this['imap'][_0xd9b0('0xf')](_0xd9b0('0x10'),this[_0xd9b0('0x11')][_0xd9b0('0xe')](this));this[_0xd9b0('0x1')]['on'](_0xd9b0('0x12'),this['handleError'][_0xd9b0('0xe')](this));this[_0xd9b0('0x1')]['connect']();}util[_0xd9b0('0x13')](EmailImap,EventEmitter);EmailImap[_0xd9b0('0x14')][_0xd9b0('0xc')]=function(_0x46321d,_0x2a15b1){var _0x13a800={'connTimeout':_0x46321d['connTimeout']?_0x46321d[_0xd9b0('0x15')]*0x3e8:0x2710,'authTimeout':_0x46321d['authTimeout']?_0x46321d[_0xd9b0('0x16')]*0x3e8:0x1388};if(_0x46321d[_0xd9b0('0x17')]){_0x13a800[_0xd9b0('0x18')]=_0x46321d[_0xd9b0('0x18')];_0x13a800[_0xd9b0('0x8')]=_0x2a15b1||_0x46321d[_0xd9b0('0x18')]||_0xd9b0('0x19');if(_0x46321d['modernAuthentication']){_0x13a800[_0xd9b0('0x1a')]=utils[_0xd9b0('0x1b')](_0x46321d[_0xd9b0('0x1c')][_0xd9b0('0x1d')],_0x46321d[_0xd9b0('0x18')]);}else{_0x13a800[_0xd9b0('0x1e')]=_0x46321d[_0xd9b0('0x1e')];}}else{if(_0x46321d['authentication']){_0x13a800[_0xd9b0('0x18')]=_0x46321d['user'];_0x13a800[_0xd9b0('0x1e')]=_0x46321d['password'];}}_0x13a800[_0xd9b0('0x1f')]=_0x46321d[_0xd9b0('0x1f')];_0x13a800[_0xd9b0('0x20')]=_0x46321d[_0xd9b0('0x20')]||0x3e1;if(_0x46321d[_0xd9b0('0x21')]){_0x13a800[_0xd9b0('0x21')]=!![];}else{_0x13a800['tls']=![];_0x13a800['autotls']=_0xd9b0('0x22');}return _0x13a800;};EmailImap['prototype'][_0xd9b0('0x23')]=function(){this[_0xd9b0('0x1')][_0xd9b0('0x24')](this['mailbox'],![],this[_0xd9b0('0x25')]['bind'](this));};EmailImap['prototype'][_0xd9b0('0x25')]=function(_0x334657,_0x5569c3){if(_0x334657){this[_0xd9b0('0x26')](_0x334657,!![]);}else{this['emit'](_0xd9b0('0x27'),_0x5569c3);this[_0xd9b0('0x28')]();}};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x29')]=function(_0x1560bf){if(_0x1560bf){this[_0xd9b0('0x26')](_0x1560bf,!![]);}else{this[_0xd9b0('0x1')][_0xd9b0('0x10')]();}};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x28')]=function(){this[_0xd9b0('0x1')][_0xd9b0('0x2a')]([_0xd9b0('0x2b')],this[_0xd9b0('0x2c')][_0xd9b0('0xe')](this));};EmailImap[_0xd9b0('0x14')]['handleReadUnseen']=function(_0x2e9d2d,_0x579119){if(_0x2e9d2d){this[_0xd9b0('0x26')](_0x2e9d2d,!![]);}else{if(_0x579119[_0xd9b0('0x2d')]){try{var _0x4b67d2=this[_0xd9b0('0x1')][_0xd9b0('0x2e')](_0x579119,{'bodies':'','markSeen':!![]});_0x4b67d2['on']('message',this[_0xd9b0('0x2f')][_0xd9b0('0xe')](this));_0x4b67d2[_0xd9b0('0xf')](_0xd9b0('0x12'),this[_0xd9b0('0x30')][_0xd9b0('0xe')](this));_0x4b67d2[_0xd9b0('0xf')](_0xd9b0('0x10'),this['handleFetchEnd'][_0xd9b0('0xe')](this));}catch(_0x2a8212){logger[_0xd9b0('0x12')](_0x2a8212);}}else{this[_0xd9b0('0x1')]['closeBox'](!![],this['handleCloseBox'][_0xd9b0('0xe')](this));}}};EmailImap['prototype'][_0xd9b0('0x2f')]=function(_0x3bd1ec){_0x3bd1ec['on']('body',this['handleMessageBody'][_0xd9b0('0xe')](this));_0x3bd1ec[_0xd9b0('0xf')](_0xd9b0('0x31'),this[_0xd9b0('0x32')][_0xd9b0('0xe')](this));_0x3bd1ec[_0xd9b0('0xf')](_0xd9b0('0x10'),this[_0xd9b0('0x33')]['bind'](this));};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x34')]=function(_0x864955){simpleParser(_0x864955,{'Iconv':Iconv},this[_0xd9b0('0x35')][_0xd9b0('0xe')](this));};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x32')]=function(){};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x33')]=function(){};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x35')]=function(_0xa3d1d,_0x2ed7d4){if(_0xa3d1d){logger[_0xd9b0('0x12')](_0xa3d1d);}else{var _0x4cadd2=this;utils[_0xd9b0('0x36')](this[_0xd9b0('0xb')],_0x2ed7d4,function(_0x140948){_0x4cadd2[_0xd9b0('0x37')](_0xd9b0('0x8'),_0x140948);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xd9b0('0x1')]['closeBox'](!![],this[_0xd9b0('0x29')][_0xd9b0('0xe')](this));};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x30')]=function(_0x193615){this[_0xd9b0('0x26')](_0x193615);this[_0xd9b0('0x1')][_0xd9b0('0x38')](!![],this[_0xd9b0('0x29')][_0xd9b0('0xe')](this));};EmailImap['prototype'][_0xd9b0('0x11')]=function(){this[_0xd9b0('0x37')]('end');};EmailImap[_0xd9b0('0x14')][_0xd9b0('0x26')]=function(_0x3dac3b,_0x562be2){logger[_0xd9b0('0x12')](_0xd9b0('0x26'),this[_0xd9b0('0xb')][_0xd9b0('0x8')],JSON[_0xd9b0('0x39')](_0x3dac3b));var _0x2e0705='';if(_0x3dac3b){if(_0x3dac3b[_0xd9b0('0x3a')]){_0x2e0705=_0x3dac3b[_0xd9b0('0x3a')];}else{for(var _0x6b2393 in _0x3dac3b){if(_0x3dac3b[_0xd9b0('0x3b')](_0x6b2393)){_0x2e0705+=_[_0xd9b0('0x3c')](_0x6b2393)+':\x20'+_0x3dac3b[_0x6b2393]+'\x0a';}}}}if(_0x562be2){this[_0xd9b0('0x1')][_0xd9b0('0x10')]();}else{this[_0xd9b0('0x37')](_0xd9b0('0x12'),_0x2e0705);this[_0xd9b0('0x37')](_0xd9b0('0x10'));}};module[_0xd9b0('0x3d')]=EmailImap; \ No newline at end of file +var _0x1883=['handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','autotls','required','openBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','error','handleFetchError','end','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','handleReady','bind'];(function(_0x377a23,_0x356b71){var _0x24b94f=function(_0x4d7d92){while(--_0x4d7d92){_0x377a23['push'](_0x377a23['shift']());}};_0x24b94f(++_0x356b71);}(_0x1883,0xab));var _0x3188=function(_0x4094d6,_0x4e12c6){_0x4094d6=_0x4094d6-0x0;var _0x2411a7=_0x1883[_0x4094d6];return _0x2411a7;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var Imap=require(_0x3188('0x2'));var simpleParser=require(_0x3188('0x3'))[_0x3188('0x4')];var Iconv=require(_0x3188('0x5'))[_0x3188('0x6')];var EventEmitter=require(_0x3188('0x7'))[_0x3188('0x8')];var utils=require(_0x3188('0x9'));var logger=require(_0x3188('0xa'))(_0x3188('0xb'));function EmailImap(_0x408ae0,_0x33b62d){this[_0x3188('0xc')]=_0x3188('0xd');this[_0x3188('0xe')]=this['getAccount'](_0x408ae0,_0x33b62d);this[_0x3188('0x2')]=new Imap(this[_0x3188('0xe')]);this['imap'][_0x3188('0xf')]('ready',this[_0x3188('0x10')][_0x3188('0x11')](this));this[_0x3188('0x2')][_0x3188('0xf')]('end',this[_0x3188('0x12')][_0x3188('0x11')](this));this['imap']['on']('error',this[_0x3188('0x13')][_0x3188('0x11')](this));this[_0x3188('0x2')][_0x3188('0x14')]();}util[_0x3188('0x15')](EmailImap,EventEmitter);EmailImap[_0x3188('0x16')]['getAccount']=function(_0x276d69,_0x5e0044){var _0x4a2f36={'connTimeout':_0x276d69[_0x3188('0x17')]?_0x276d69['connTimeout']*0x3e8:0x2710,'authTimeout':_0x276d69['authTimeout']?_0x276d69[_0x3188('0x18')]*0x3e8:0x1388};if(_0x276d69[_0x3188('0x19')]){_0x4a2f36[_0x3188('0x1a')]=_0x276d69[_0x3188('0x1a')];_0x4a2f36[_0x3188('0xb')]=_0x5e0044||_0x276d69[_0x3188('0x1a')]||'anonymous@xcally.com';if(_0x276d69[_0x3188('0x1b')]){_0x4a2f36[_0x3188('0x1c')]=utils[_0x3188('0x1d')](_0x276d69[_0x3188('0x1e')][_0x3188('0x1f')],_0x276d69[_0x3188('0x1a')]);}else{_0x4a2f36[_0x3188('0x20')]=_0x276d69[_0x3188('0x20')];}}else{if(_0x276d69['authentication']){_0x4a2f36[_0x3188('0x1a')]=_0x276d69[_0x3188('0x1a')];_0x4a2f36['password']=_0x276d69['password'];}}_0x4a2f36['host']=_0x276d69[_0x3188('0x21')];_0x4a2f36[_0x3188('0x22')]=_0x276d69[_0x3188('0x22')]||0x3e1;if(_0x276d69['tls']){_0x4a2f36['tls']=!![];}else{_0x4a2f36[_0x3188('0x23')]=![];_0x4a2f36[_0x3188('0x24')]=_0x3188('0x25');}return _0x4a2f36;};EmailImap[_0x3188('0x16')][_0x3188('0x10')]=function(){this['imap'][_0x3188('0x26')](this[_0x3188('0xc')],![],this['handleOpenBox'][_0x3188('0x11')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x45ae2f,_0x129bd7){if(_0x45ae2f){this[_0x3188('0x13')](_0x45ae2f,!![]);}else{this[_0x3188('0x27')](_0x3188('0x28'),_0x129bd7);this[_0x3188('0x29')]();}};EmailImap[_0x3188('0x16')][_0x3188('0x2a')]=function(_0x4b4675){if(_0x4b4675){this[_0x3188('0x13')](_0x4b4675,!![]);}else{this[_0x3188('0x2')]['end']();}};EmailImap[_0x3188('0x16')][_0x3188('0x29')]=function(){this[_0x3188('0x2')][_0x3188('0x2b')]([_0x3188('0x2c')],this[_0x3188('0x2d')][_0x3188('0x11')](this));};EmailImap[_0x3188('0x16')]['handleReadUnseen']=function(_0x44fa15,_0x5d97d0){if(_0x44fa15){this[_0x3188('0x13')](_0x44fa15,!![]);}else{if(_0x5d97d0['length']){try{var _0x3f82ce=this[_0x3188('0x2')][_0x3188('0x2e')](_0x5d97d0,{'bodies':'','markSeen':!![]});_0x3f82ce['on'](_0x3188('0x2f'),this[_0x3188('0x30')][_0x3188('0x11')](this));_0x3f82ce[_0x3188('0xf')](_0x3188('0x31'),this[_0x3188('0x32')][_0x3188('0x11')](this));_0x3f82ce[_0x3188('0xf')](_0x3188('0x33'),this[_0x3188('0x34')][_0x3188('0x11')](this));}catch(_0xc3f30b){logger[_0x3188('0x31')](_0xc3f30b);}}else{this[_0x3188('0x2')][_0x3188('0x35')](!![],this['handleCloseBox'][_0x3188('0x11')](this));}}};EmailImap['prototype'][_0x3188('0x30')]=function(_0xc75bc6){_0xc75bc6['on']('body',this[_0x3188('0x36')][_0x3188('0x11')](this));_0xc75bc6[_0x3188('0xf')](_0x3188('0x37'),this[_0x3188('0x38')][_0x3188('0x11')](this));_0xc75bc6[_0x3188('0xf')]('end',this['handleMessageEnd'][_0x3188('0x11')](this));};EmailImap[_0x3188('0x16')][_0x3188('0x36')]=function(_0x1aa732){simpleParser(_0x1aa732,{'Iconv':Iconv},this['handleSimpleParser'][_0x3188('0x11')](this));};EmailImap[_0x3188('0x16')][_0x3188('0x38')]=function(){};EmailImap[_0x3188('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x3188('0x16')]['handleSimpleParser']=function(_0x130e73,_0x57895f){if(_0x130e73){logger[_0x3188('0x31')](_0x130e73);}else{var _0x361a09=this;utils[_0x3188('0x39')](this[_0x3188('0xe')],_0x57895f,function(_0x22f8da){_0x361a09[_0x3188('0x27')](_0x3188('0xb'),_0x22f8da);});}};EmailImap[_0x3188('0x16')][_0x3188('0x34')]=function(){this[_0x3188('0x2')]['closeBox'](!![],this[_0x3188('0x2a')][_0x3188('0x11')](this));};EmailImap[_0x3188('0x16')][_0x3188('0x32')]=function(_0x7b2f4b){this[_0x3188('0x13')](_0x7b2f4b);this['imap'][_0x3188('0x35')](!![],this['handleCloseBox'][_0x3188('0x11')](this));};EmailImap[_0x3188('0x16')][_0x3188('0x12')]=function(){this[_0x3188('0x27')](_0x3188('0x33'));};EmailImap['prototype']['handleError']=function(_0x59069f,_0x4e6db6){logger['error'](_0x3188('0x13'),this[_0x3188('0xe')][_0x3188('0xb')],JSON[_0x3188('0x3a')](_0x59069f));var _0x9b70b1='';if(_0x59069f){if(_0x59069f['textCode']){_0x9b70b1=_0x59069f[_0x3188('0x3b')];}else{for(var _0x4e2b9c in _0x59069f){if(_0x59069f[_0x3188('0x3c')](_0x4e2b9c)){_0x9b70b1+=_[_0x3188('0x3d')](_0x4e2b9c)+':\x20'+_0x59069f[_0x4e2b9c]+'\x0a';}}}}if(_0x4e6db6){this[_0x3188('0x2')][_0x3188('0x33')]();}else{this['emit'](_0x3188('0x31'),_0x9b70b1);this[_0x3188('0x27')](_0x3188('0x33'));}};module[_0x3188('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 0cf92ce..cebf2f8 100644 --- a/server/services/email/lib/smtp.js +++ b/server/services/email/lib/smtp.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f1d=['nodemailer-plugin-inline-base64','createTransport','sendMail','prototype','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0x5234d1,_0x49df0b){var _0x23022f=function(_0x346141){while(--_0x346141){_0x5234d1['push'](_0x5234d1['shift']());}};_0x23022f(++_0x49df0b);}(_0x1f1d,0xce));var _0xd1f1=function(_0x328c6e,_0xfa2eb4){_0x328c6e=_0x328c6e-0x0;var _0x31a90a=_0x1f1d[_0x328c6e];return _0x31a90a;};'use strict';var nodemailer=require(_0xd1f1('0x0'));var inlineBase64=require(_0xd1f1('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x41566b,_0x4687d3){return new Promise(function(_0x51fe7e,_0x5efddb){var _0x24c6b9=nodemailer[_0xd1f1('0x2')](_0x41566b);_0x24c6b9['use']('compile',inlineBase64());_0x24c6b9[_0xd1f1('0x3')](_0x4687d3,function(_0xa2072,_0x2561d9){if(_0xa2072){_0x5efddb(_0xa2072['toString']());}else{_0x51fe7e(_0x2561d9);}});});};EmailSmtp[_0xd1f1('0x4')][_0xd1f1('0x5')]=function(_0x18f304){return new Promise(function(_0x3af6cb,_0x227b42){var _0x53bc3d=nodemailer[_0xd1f1('0x2')](_0x18f304);_0x53bc3d[_0xd1f1('0x5')](function(_0x33ee97,_0x27f1bb){if(_0x33ee97){_0x227b42(_0x33ee97[_0xd1f1('0x6')]());}else{if(_0x27f1bb){_0x3af6cb(_0x27f1bb);}else{_0x227b42(_0xd1f1('0x7'));}}});});};module[_0xd1f1('0x8')]=EmailSmtp; \ No newline at end of file +var _0x64bc=['nodemailer','nodemailer-plugin-inline-base64','prototype','sendMail','toString','verify','createTransport','Not\x20verifired','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x64bc,0xe1));var _0xc64b=function(_0x50ab32,_0x35b324){_0x50ab32=_0x50ab32-0x0;var _0x2d9ae6=_0x64bc[_0x50ab32];return _0x2d9ae6;};'use strict';var nodemailer=require(_0xc64b('0x0'));var inlineBase64=require(_0xc64b('0x1'));function EmailSmtp(){}EmailSmtp[_0xc64b('0x2')]['send']=function(_0x2d454f,_0x4e47a4){return new Promise(function(_0x5e21a6,_0x4453c4){var _0x3c8431=nodemailer['createTransport'](_0x2d454f);_0x3c8431['use']('compile',inlineBase64());_0x3c8431[_0xc64b('0x3')](_0x4e47a4,function(_0x48e992,_0x45c590){if(_0x48e992){_0x4453c4(_0x48e992[_0xc64b('0x4')]());}else{_0x5e21a6(_0x45c590);}});});};EmailSmtp[_0xc64b('0x2')][_0xc64b('0x5')]=function(_0x26fdbc){return new Promise(function(_0x4689a6,_0x25c37d){var _0x28ea87=nodemailer[_0xc64b('0x6')](_0x26fdbc);_0x28ea87[_0xc64b('0x5')](function(_0x4d11dc,_0x432ca3){if(_0x4d11dc){_0x25c37d(_0x4d11dc[_0xc64b('0x4')]());}else{if(_0x432ca3){_0x4689a6(_0x432ca3);}else{_0x25c37d(_0xc64b('0x7'));}}});});};module[_0xc64b('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 2d93801..4c4f607 100644 --- a/server/services/email/lib/utils.js +++ b/server/services/email/lib/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e2c=['generate','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','message','email','originCc','bcc','attach','attachment','format','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','push','Title','Data','generateXOAuth2Token','user=','toString','base64','lodash','randomstring','path','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty'];(function(_0x3c4a7c,_0x2f4e3c){var _0xf13d1e=function(_0x24cb78){while(--_0x24cb78){_0x3c4a7c['push'](_0x3c4a7c['shift']());}};_0xf13d1e(++_0x2f4e3c);}(_0x5e2c,0x7a));var _0xc5e2=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0x5e2c[_0x260f28];return _0x3aefcc;};'use strict';var _=require(_0xc5e2('0x0'));var moment=require('moment');var random=require(_0xc5e2('0x1'));var fs=require('fs');var path=require(_0xc5e2('0x2'));var util=require('util');var tnef=require(_0xc5e2('0x3'));var logger=require(_0xc5e2('0x4'))('email');var config=require(_0xc5e2('0x5'));function getAddress(_0x3e4a1){var _0x4790bf=_[_0xc5e2('0x6')](_0x3e4a1[_0xc5e2('0x7')]);return _0x4790bf&&_0x4790bf[_0xc5e2('0x8')]?_0x4790bf[_0xc5e2('0x8')]:_0xc5e2('0x9')+random['generate'](0x6)+_0xc5e2('0xa');}function getFirstName(_0x790f16){var _0x99a1ea=_['head'](_0x790f16['value']);if(_0x99a1ea&&_0x99a1ea['name']){if(_0x99a1ea[_0xc5e2('0xb')]==_0x99a1ea[_0xc5e2('0x8')]){return _0x99a1ea[_0xc5e2('0xb')][_0xc5e2('0xc')](0x0,_0x99a1ea['name'][_0xc5e2('0xd')]('@'));}var _0x283939=_0x99a1ea[_0xc5e2('0xb')][_0xc5e2('0xe')](/\s+/);return _0x283939[_0xc5e2('0xf')]>0x1?_0x283939['slice'](0x0,-0x1)[_0xc5e2('0x10')]('\x20'):_0x99a1ea[_0xc5e2('0xb')];}return _0xc5e2('0x11');}function getLastName(_0x45a071){var _0x3169b0=_['head'](_0x45a071[_0xc5e2('0x7')]);if(_0x3169b0&&_0x3169b0['name']){var _0x9cb21f=_0x3169b0['name'][_0xc5e2('0xe')](/\s+/);return _0x9cb21f[_0xc5e2('0xf')]>0x1?_0x9cb21f[_0xc5e2('0x12')]():'';}return'';}function getMails(_0x257c2e,_0x384d3a){var _0x1dd5a9='';for(var _0x51def0=0x0;_0x51def0<_0x384d3a[_0xc5e2('0x7')][_0xc5e2('0xf')];_0x51def0+=0x1){if(_0x384d3a['value'][_0x51def0]['address']!==_0x257c2e){if(!_[_0xc5e2('0x13')](_0x1dd5a9)){_0x1dd5a9+=',';}_0x1dd5a9+=_0x384d3a[_0xc5e2('0x7')][_0x51def0][_0xc5e2('0xb')]||_0x384d3a[_0xc5e2('0x7')][_0x51def0]['address']||'';_0x1dd5a9+='\x20<';_0x1dd5a9+=_0x384d3a[_0xc5e2('0x7')][_0x51def0]['address']?_0x384d3a[_0xc5e2('0x7')][_0x51def0][_0xc5e2('0x8')]:_0xc5e2('0x9')+random[_0xc5e2('0x14')](0x6)+_0xc5e2('0xa');_0x1dd5a9+='>';}}return _0x1dd5a9;}function parseEmail(_0x5d3f3c,_0x8bb910,_0x23b9ab){if(_0x8bb910[_0xc5e2('0x15')]){var _0x39f6bf=/)<[^<]*)*<\/script>/gi;while(_0x39f6bf[_0xc5e2('0x16')](_0x8bb910[_0xc5e2('0x15')])){_0x8bb910[_0xc5e2('0x15')]=_0x8bb910['html'][_0xc5e2('0x17')](_0x39f6bf,'');}if(_0x8bb910[_0xc5e2('0x15')][_0xc5e2('0x18')](_0xc5e2('0x19'))){var _0x5e72c9=[];_0x8bb910[_0xc5e2('0x1a')][_0xc5e2('0x1b')](_0x2eb88e=>{_0x5e72c9['push'](_0x2eb88e[_0xc5e2('0x1c')]);});var _0x236b1f=/]+>/g;var _0x24eef8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x239bfc=_0x8bb910['html']['replace'](_0x24eef8,_0xc5e2('0x1d'));var _0x5ac09a=_0x239bfc['replace'](_0x236b1f,_0xc5e2('0x1e'));for(let _0x115f3a=0x0;_0x115f3a<_0x5e72c9[_0xc5e2('0xf')];_0x115f3a++){var _0x25892b=_0x5ac09a['replace'](_0xc5e2('0x1e'),_0xc5e2('0x1f')+_0x5e72c9[_0x115f3a]+_0xc5e2('0x20'));_0x5ac09a=_0x25892b;}_0x8bb910[_0xc5e2('0x15')]=_0x5ac09a;}_0x23b9ab[_0xc5e2('0x21')]=_0x8bb910['html'];}else{_0x23b9ab['body']=_0x8bb910['textAsHtml'];}if(_0x23b9ab['body']){_0x23b9ab[_0xc5e2('0x21')]=_0x23b9ab[_0xc5e2('0x21')]['replace'](/0x0){var _0x5daeb4=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0xc5e2('0x30')];for(var _0x141dc9=0x0;_0x141dc9<_0x8bb910[_0xc5e2('0x2f')][_0xc5e2('0xf')];_0x141dc9++){var _0x4570e1=_[_0xc5e2('0xd')](_0x5daeb4,_0x8bb910['headerLines'][_0x141dc9]['line']);if(_0x4570e1>=0x0){_0x23b9ab[_0xc5e2('0x31')]=!![];}}}return _0x23b9ab;}exports[_0xc5e2('0x32')]=function(_0xc15463,_0x3c27f6,_0x597d29){var _0x55facd={'from':getAddress(_0x3c27f6[_0xc5e2('0x33')]),'firstName':getFirstName(_0x3c27f6[_0xc5e2('0x33')]),'lastName':getLastName(_0x3c27f6[_0xc5e2('0x33')]),'mapKey':_0xc5e2('0x23'),'message':{'from':getMails(_0xc15463['email'],_0x3c27f6[_0xc5e2('0x33')]),'to':_0xc15463['email'],'cc':'','subject':_0x3c27f6[_0xc5e2('0x34')]||'','messageId':_0x3c27f6[_0xc5e2('0x35')],'inReplyTo':_0x3c27f6['inReplyTo'],'sentAt':moment(_0x3c27f6[_0xc5e2('0x36')])[_0xc5e2('0x28')](_0xc5e2('0x37')),'attach':![],'attachments':[]}};if(!_0x3c27f6[_0xc5e2('0x15')]&&!_0x3c27f6[_0xc5e2('0x38')]){var _0x216ccf=_[_0xc5e2('0x39')](_0x3c27f6[_0xc5e2('0x1a')],{'contentType':'application/ms-tnef'});if(_0x216ccf[_0xc5e2('0xf')]){logger[_0xc5e2('0x3a')](util[_0xc5e2('0x28')](_0xc5e2('0x3b'),_0x3c27f6[_0xc5e2('0x35')]));tnef['parseBuffer'](_[_0xc5e2('0x3c')](_0x216ccf)[_0xc5e2('0x2d')],function(_0x47736c,_0x3150b7){if(_0x3150b7){_0x3c27f6[_0xc5e2('0x15')]=_0x3150b7[_0xc5e2('0x3d')]||_0xc5e2('0x3e');if(_0x3150b7[_0xc5e2('0x3f')]){for(var _0x225827=0x0;_0x225827<_0x3150b7[_0xc5e2('0x3f')]['length'];_0x225827++){var _0x1db3db=_0x3150b7[_0xc5e2('0x3f')][_0x225827];_0x55facd[_0xc5e2('0x22')][_0xc5e2('0x1a')][_0xc5e2('0x40')]({'filename':_0x1db3db[_0xc5e2('0x41')],'content':Buffer[_0xc5e2('0x33')](_0x1db3db[_0xc5e2('0x42')])});}}}_0x597d29(parseEmail(_0xc15463,_0x3c27f6,_0x55facd));});}else{_0x3c27f6[_0xc5e2('0x15')]=_0xc5e2('0x3e');_0x597d29(parseEmail(_0xc15463,_0x3c27f6,_0x55facd));}}else{_0x597d29(parseEmail(_0xc15463,_0x3c27f6,_0x55facd));}};exports[_0xc5e2('0x43')]=function(_0x33bccd,_0x48fb95){var _0x1da191=[_0xc5e2('0x44')+(_0x48fb95||''),'auth=Bearer\x20'+_0x33bccd,'',''];return Buffer[_0xc5e2('0x33')](_0x1da191[_0xc5e2('0x10')](''),'utf-8')[_0xc5e2('0x45')](_0xc5e2('0x46'));}; \ No newline at end of file +var _0xbf79=['attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','Precedence:\x20auto_reply','line','isAutoreply','from','subject','messageId','date','textAsHtml','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','generateXOAuth2Token','user=','utf-8','toString','base64','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','address','anonymous','generate','@xcally.com','head','value','name','substring','indexOf','split','length','join','pop','isEmpty','test','html','replace','\x20[Attachment:\x20','body','0x1?_0x19724d['slice'](0x0,-0x1)[_0x9bf7('0x12')]('\x20'):_0xb6b532[_0x9bf7('0xd')];}return'Anonymous';}function getLastName(_0x471110){var _0x5de747=_[_0x9bf7('0xb')](_0x471110['value']);if(_0x5de747&&_0x5de747[_0x9bf7('0xd')]){var _0xda7ca7=_0x5de747['name'][_0x9bf7('0x10')](/\s+/);return _0xda7ca7[_0x9bf7('0x11')]>0x1?_0xda7ca7[_0x9bf7('0x13')]():'';}return'';}function getMails(_0x29c955,_0x3fbf1e){var _0x4293a1='';for(var _0x236e20=0x0;_0x236e20<_0x3fbf1e[_0x9bf7('0xc')]['length'];_0x236e20+=0x1){if(_0x3fbf1e[_0x9bf7('0xc')][_0x236e20][_0x9bf7('0x7')]!==_0x29c955){if(!_[_0x9bf7('0x14')](_0x4293a1)){_0x4293a1+=',';}_0x4293a1+=_0x3fbf1e[_0x9bf7('0xc')][_0x236e20]['name']||_0x3fbf1e['value'][_0x236e20]['address']||'';_0x4293a1+='\x20<';_0x4293a1+=_0x3fbf1e[_0x9bf7('0xc')][_0x236e20][_0x9bf7('0x7')]?_0x3fbf1e[_0x9bf7('0xc')][_0x236e20]['address']:_0x9bf7('0x8')+random[_0x9bf7('0x9')](0x6)+_0x9bf7('0xa');_0x4293a1+='>';}}return _0x4293a1;}function parseEmail(_0x4a4b5e,_0x234e3f,_0x3c8680){if(_0x234e3f['html']){var _0x16c801=/)<[^<]*)*<\/script>/gi;while(_0x16c801[_0x9bf7('0x15')](_0x234e3f[_0x9bf7('0x16')])){_0x234e3f[_0x9bf7('0x16')]=_0x234e3f[_0x9bf7('0x16')][_0x9bf7('0x17')](_0x16c801,'');}if(_0x234e3f[_0x9bf7('0x16')]['includes'](_0x9bf7('0x18'))){var _0x4a5ded=[];_0x234e3f[_0x9bf7('0x19')][_0x9bf7('0x1a')](_0x5dffaf=>{_0x4a5ded[_0x9bf7('0x1b')](_0x5dffaf[_0x9bf7('0x1c')]);});var _0x4dbb1b=/]+>/g;var _0xbaae1c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4a507b=_0x234e3f[_0x9bf7('0x16')][_0x9bf7('0x17')](_0xbaae1c,_0x9bf7('0x1d'));var _0x161bab=_0x4a507b[_0x9bf7('0x17')](_0x4dbb1b,_0x9bf7('0x1e'));for(let _0x320b10=0x0;_0x320b10<_0x4a5ded[_0x9bf7('0x11')];_0x320b10++){var _0x2cfe66=_0x161bab['replace'](_0x9bf7('0x1e'),_0x9bf7('0x1f')+_0x4a5ded[_0x320b10]+'\x20]');_0x161bab=_0x2cfe66;}_0x234e3f['html']=_0x161bab;}_0x3c8680['body']=_0x234e3f[_0x9bf7('0x16')];}else{_0x3c8680[_0x9bf7('0x20')]=_0x234e3f['textAsHtml'];}if(_0x3c8680[_0x9bf7('0x20')]){_0x3c8680['body']=_0x3c8680[_0x9bf7('0x20')][_0x9bf7('0x17')](/0x0){var _0x31a8d9=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x9bf7('0x31')];for(var _0x4fac38=0x0;_0x4fac38<_0x234e3f[_0x9bf7('0x30')][_0x9bf7('0x11')];_0x4fac38++){var _0x10444e=_[_0x9bf7('0xf')](_0x31a8d9,_0x234e3f[_0x9bf7('0x30')][_0x4fac38][_0x9bf7('0x32')]);if(_0x10444e>=0x0){_0x3c8680[_0x9bf7('0x33')]=!![];}}}return _0x3c8680;}exports['parser']=function(_0x3bf207,_0x368ab7,_0xe0be4c){var _0x421f0f={'from':getAddress(_0x368ab7[_0x9bf7('0x34')]),'firstName':getFirstName(_0x368ab7['from']),'lastName':getLastName(_0x368ab7[_0x9bf7('0x34')]),'mapKey':_0x9bf7('0x5'),'message':{'from':getMails(_0x3bf207[_0x9bf7('0x5')],_0x368ab7['from']),'to':_0x3bf207[_0x9bf7('0x5')],'cc':'','subject':_0x368ab7[_0x9bf7('0x35')]||'','messageId':_0x368ab7[_0x9bf7('0x36')],'inReplyTo':_0x368ab7['inReplyTo'],'sentAt':moment(_0x368ab7[_0x9bf7('0x37')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x368ab7[_0x9bf7('0x16')]&&!_0x368ab7[_0x9bf7('0x38')]){var _0x1d996e=_[_0x9bf7('0x39')](_0x368ab7[_0x9bf7('0x19')],{'contentType':_0x9bf7('0x3a')});if(_0x1d996e[_0x9bf7('0x11')]){logger[_0x9bf7('0x3b')](util['format'](_0x9bf7('0x3c'),_0x368ab7[_0x9bf7('0x36')]));tnef[_0x9bf7('0x3d')](_['first'](_0x1d996e)[_0x9bf7('0x2e')],function(_0x5343f8,_0x32d5ca){if(_0x32d5ca){_0x368ab7[_0x9bf7('0x16')]=_0x32d5ca[_0x9bf7('0x3e')]||_0x9bf7('0x3f');if(_0x32d5ca[_0x9bf7('0x40')]){for(var _0x329d7e=0x0;_0x329d7e<_0x32d5ca[_0x9bf7('0x40')]['length'];_0x329d7e++){var _0x1093e5=_0x32d5ca[_0x9bf7('0x40')][_0x329d7e];_0x421f0f['message'][_0x9bf7('0x19')][_0x9bf7('0x1b')]({'filename':_0x1093e5[_0x9bf7('0x41')],'content':Buffer[_0x9bf7('0x34')](_0x1093e5[_0x9bf7('0x42')])});}}}_0xe0be4c(parseEmail(_0x3bf207,_0x368ab7,_0x421f0f));});}else{_0x368ab7[_0x9bf7('0x16')]=_0x9bf7('0x3f');_0xe0be4c(parseEmail(_0x3bf207,_0x368ab7,_0x421f0f));}}else{_0xe0be4c(parseEmail(_0x3bf207,_0x368ab7,_0x421f0f));}};exports[_0x9bf7('0x43')]=function(_0x5e0cd8,_0x4761b6){var _0x156f62=[_0x9bf7('0x44')+(_0x4761b6||''),'auth=Bearer\x20'+_0x5e0cd8,'',''];return Buffer[_0x9bf7('0x34')](_0x156f62[_0x9bf7('0x12')](''),_0x9bf7('0x45'))[_0x9bf7('0x46')](_0x9bf7('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 5083048..a5ae4b5 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 _0x2879=['key','SERV','active','Imap','Smtp','lodash','name','Service'];(function(_0x271b99,_0x18831d){var _0x47b808=function(_0x480b3a){while(--_0x480b3a){_0x271b99['push'](_0x271b99['shift']());}};_0x47b808(++_0x18831d);}(_0x2879,0x1b5));var _0x9287=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2879[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x9287('0x0'));function MailAccount(_0x546878){this['id']=_0x546878['id']||0x0;this['name']=_0x546878[_0x9287('0x1')]||_0x9287('0x2');this[_0x9287('0x3')]=_0x546878[_0x9287('0x3')]||_0x9287('0x4');this[_0x9287('0x5')]=_0x546878[_0x9287('0x5')]||![];this[_0x9287('0x6')]=_0x546878[_0x9287('0x6')]||[];this[_0x9287('0x7')]=_0x546878[_0x9287('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x6877=['lodash','name','key','active','Imap','Smtp','exports'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x6877,0x1dc));var _0x7687=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0x6877[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x7687('0x0'));function MailAccount(_0x34524d){this['id']=_0x34524d['id']||0x0;this[_0x7687('0x1')]=_0x34524d[_0x7687('0x1')]||'Service';this[_0x7687('0x2')]=_0x34524d[_0x7687('0x2')]||'SERV';this[_0x7687('0x3')]=_0x34524d['active']||![];this[_0x7687('0x4')]=_0x34524d[_0x7687('0x4')]||[];this[_0x7687('0x5')]=_0x34524d[_0x7687('0x5')]||[];}module[_0x7687('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index b5b511b..4b95740 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 _0x60b7=['prototype','mergeFromDatabase','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0x60b7,0xf8));var _0x760b=function(_0x29aca7,_0x21c650){_0x29aca7=_0x29aca7-0x0;var _0x1db0a0=_0x60b7[_0x29aca7];return _0x1db0a0;};'use strict';var _=require(_0x760b('0x0'));var MailAccount=require(_0x760b('0x1'));var Realtime=function(){this[_0x760b('0x2')]={};};function freeIsNotKey(_0x36e11e,_0x7b5ea6,_0x3fe1d1){var _0x1ed0b2=_['mapKeys'](_0x36e11e,function(_0x5115c4,_0x7e89f5){return _0x5115c4[_0x3fe1d1];});for(var _0x21085e in _0x7b5ea6){if(_0x7b5ea6[_0x760b('0x3')](_0x21085e)){if(!_0x1ed0b2[_0x21085e]){delete _0x7b5ea6[_0x21085e];}}}}Realtime[_0x760b('0x4')][_0x760b('0x5')]=function(_0x150360,_0x22bf8f){for(var _0x281435 in _0x22bf8f){if(_0x150360[_0x760b('0x3')](_0x281435)){_0x150360[_0x281435]=_0x22bf8f[_0x281435];}}};Realtime['prototype'][_0x760b('0x6')]=function(){var _0x200580=this;return function(_0x4c606e){if(_0x4c606e){freeIsNotKey(_0x4c606e,_0x200580['mailAccounts'],'id');for(var _0xd3d06f=0x0,_0x451dbd={},_0xe7ec62={};_0xd3d06f<_0x4c606e['length'];_0xd3d06f+=0x1){_0x451dbd=_0x4c606e[_0xd3d06f];if(_[_0x760b('0x7')](_0x200580[_0x760b('0x2')][_0x451dbd['id']])){_0x200580[_0x760b('0x2')][_0x451dbd['id']]=new MailAccount(_0x451dbd);}else{_['merge'](_0x200580[_0x760b('0x2')][_0x451dbd['id']],_0x451dbd);}}}return _0x200580[_0x760b('0x2')];};};module[_0x760b('0x8')]=Realtime; \ No newline at end of file +var _0x9db2=['mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts'];(function(_0x552e94,_0x110f92){var _0x12587b=function(_0x36c87e){while(--_0x36c87e){_0x552e94['push'](_0x552e94['shift']());}};_0x12587b(++_0x110f92);}(_0x9db2,0x6c));var _0x29db=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x9db2[_0x1ef547];return _0x1d697b;};'use strict';var _=require('lodash');var MailAccount=require(_0x29db('0x0'));var Realtime=function(){this[_0x29db('0x1')]={};};function freeIsNotKey(_0x38989c,_0x1cd0d8,_0x21405e){var _0x398835=_[_0x29db('0x2')](_0x38989c,function(_0x5bdf20,_0x5923dc){return _0x5bdf20[_0x21405e];});for(var _0x2b2106 in _0x1cd0d8){if(_0x1cd0d8[_0x29db('0x3')](_0x2b2106)){if(!_0x398835[_0x2b2106]){delete _0x1cd0d8[_0x2b2106];}}}}Realtime['prototype'][_0x29db('0x4')]=function(_0x5c58e5,_0x55c659){for(var _0x42406f in _0x55c659){if(_0x5c58e5[_0x29db('0x3')](_0x42406f)){_0x5c58e5[_0x42406f]=_0x55c659[_0x42406f];}}};Realtime[_0x29db('0x5')][_0x29db('0x6')]=function(){var _0x366fa7=this;return function(_0x13d46e){if(_0x13d46e){freeIsNotKey(_0x13d46e,_0x366fa7[_0x29db('0x1')],'id');for(var _0x4d0fd1=0x0,_0xffc55d={},_0x48aed6={};_0x4d0fd1<_0x13d46e[_0x29db('0x7')];_0x4d0fd1+=0x1){_0xffc55d=_0x13d46e[_0x4d0fd1];if(_[_0x29db('0x8')](_0x366fa7[_0x29db('0x1')][_0xffc55d['id']])){_0x366fa7[_0x29db('0x1')][_0xffc55d['id']]=new MailAccount(_0xffc55d);}else{_[_0x29db('0x9')](_0x366fa7['mailAccounts'][_0xffc55d['id']],_0xffc55d);}}}return _0x366fa7[_0x29db('0x1')];};};module[_0x29db('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d9e70bd..a4f0e79 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 _0xdfae=['type','data5','MailServerOut','Smtp','Request','NotifyMailAccount','getMailAccounts','GetMailAccount','name','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xdfae,0x18d));var _0xedfa=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0xdfae[_0x43b06b];return _0x2c555b;};'use strict';var client=require('../client');exports[_0xedfa('0x0')]=function(){return function(){return client['Request'](_0xedfa('0x1'),{'options':{'attributes':['id',_0xedfa('0x2'),'provider','service','email',_0xedfa('0x3'),_0xedfa('0x4'),_0xedfa('0x5'),_0xedfa('0x6')],'raw':![],'include':[{'model':_0xedfa('0x7'),'as':_0xedfa('0x8'),'include':[{'model':_0xedfa('0x9'),'attributes':['id',_0xedfa('0x2'),_0xedfa('0xa'),_0xedfa('0xb'),_0xedfa('0xc')],'as':_0xedfa('0x9')}]},{'model':_0xedfa('0xd'),'as':_0xedfa('0xe'),'include':[{'model':_0xedfa('0x9'),'attributes':['id','name','service',_0xedfa('0xb'),_0xedfa('0xc')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports['notify']=function(_0x41e857,_0x19fdcc){return client[_0xedfa('0xf')](_0xedfa('0x10'),{'account':{'id':_0x41e857},'body':_0x19fdcc,'log':_0xedfa('0x10')});}; \ No newline at end of file +var _0xe635=['data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xe635,0x1be));var _0x5e63=function(_0x46ec25,_0x1d7ada){_0x46ec25=_0x46ec25-0x0;var _0x5d9119=_0xe635[_0x46ec25];return _0x5d9119;};'use strict';var client=require(_0x5e63('0x0'));exports[_0x5e63('0x1')]=function(){return function(){return client[_0x5e63('0x2')](_0x5e63('0x3'),{'options':{'attributes':['id',_0x5e63('0x4'),_0x5e63('0x5'),_0x5e63('0x6'),'email','active',_0x5e63('0x7'),_0x5e63('0x8'),_0x5e63('0x9')],'raw':![],'include':[{'model':_0x5e63('0xa'),'as':_0x5e63('0xb'),'include':[{'model':_0x5e63('0xc'),'attributes':['id',_0x5e63('0x4'),_0x5e63('0x6'),_0x5e63('0xd'),_0x5e63('0xe')],'as':'CloudProvider'}]},{'model':_0x5e63('0xf'),'as':_0x5e63('0x10'),'include':[{'model':_0x5e63('0xc'),'attributes':['id',_0x5e63('0x4'),'service',_0x5e63('0xd'),_0x5e63('0xe')],'as':'CloudProvider'}]}]},'log':_0x5e63('0x11')});};};exports[_0x5e63('0x12')]=function(_0x5c5733,_0xf39dbd){return client['Request'](_0x5e63('0x13'),{'account':{'id':_0x5c5733},'body':_0xf39dbd,'log':_0x5e63('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 3044a26..11b48b5 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 _0x1cae=['ShowSetting','loginMailFrequency','Request'];(function(_0x199877,_0x3cc4a4){var _0x25fc56=function(_0xad393c){while(--_0xad393c){_0x199877['push'](_0x199877['shift']());}};_0x25fc56(++_0x3cc4a4);}(_0x1cae,0x110));var _0xe1ca=function(_0x15f3a3,_0x2d6f5f){_0x15f3a3=_0x15f3a3-0x0;var _0x1f009d=_0x1cae[_0x15f3a3];return _0x1f009d;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xe1ca('0x0')](_0xe1ca('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe1ca('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x3345=['getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x536510,_0x2a0f2d){var _0xcb6bb4=function(_0xf99fca){while(--_0xf99fca){_0x536510['push'](_0x536510['shift']());}};_0xcb6bb4(++_0x2a0f2d);}(_0x3345,0xdc));var _0x5334=function(_0x2edb70,_0x12a185){_0x2edb70=_0x2edb70-0x0;var _0x36ebd4=_0x3345[_0x2edb70];return _0x36ebd4;};'use strict';var client=require('../client');exports[_0x5334('0x0')]=function(){return client[_0x5334('0x1')](_0x5334('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5334('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index b57fc39..94b36e5 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(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_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 diff --git a/server/services/express/index.js b/server/services/express/index.js index a65c856..54b983d 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 _0x9e14=['../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','http','express','sticky-session','ioredis','listen','redis','defaults','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio'];(function(_0x582805,_0x51677c){var _0x1271d6=function(_0xccf98b){while(--_0xccf98b){_0x582805['push'](_0x582805['shift']());}};_0x1271d6(++_0x51677c);}(_0x9e14,0xeb));var _0x49e1=function(_0x547ddd,_0x328b0a){_0x547ddd=_0x547ddd-0x0;var _0x424ef8=_0x9e14[_0x547ddd];return _0x424ef8;};'use strict';var _=require('lodash');var http=require(_0x49e1('0x0'));var express=require(_0x49e1('0x1'));var sticky=require(_0x49e1('0x2'));var Redis=require(_0x49e1('0x3'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server['timeout']=0xdbba0;if(sticky[_0x49e1('0x4')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket','polling']});config[_0x49e1('0x5')]=_[_0x49e1('0x6')](config[_0x49e1('0x5')],{'host':'localhost','port':0x18eb});socketio[_0x49e1('0x7')](require(_0x49e1('0x8'))({'pubClient':new Redis(config[_0x49e1('0x5')]),'subClient':new Redis(config[_0x49e1('0x5')])}));require(_0x49e1('0x9'))[_0x49e1('0xa')]();require(_0x49e1('0xb'))[_0x49e1('0xa')](socketio);require(_0x49e1('0xc'))[_0x49e1('0xa')](app);require(_0x49e1('0xd'))[_0x49e1('0xa')](app);}else{server[_0x49e1('0xe')](_0x49e1('0xf'),function(){console[_0x49e1('0x10')](_0x49e1('0x11'),config[_0x49e1('0x12')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x3e47=['localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','redis'];(function(_0x35c26c,_0xaf5f3c){var _0x3717d0=function(_0x91721b){while(--_0x91721b){_0x35c26c['push'](_0x35c26c['shift']());}};_0x3717d0(++_0xaf5f3c);}(_0x3e47,0x75));var _0x73e4=function(_0x2247ab,_0x3f4162){_0x2247ab=_0x2247ab-0x0;var _0x430062=_0x3e47[_0x2247ab];return _0x430062;};'use strict';var _=require(_0x73e4('0x0'));var http=require('http');var express=require(_0x73e4('0x1'));var sticky=require(_0x73e4('0x2'));var Redis=require(_0x73e4('0x3'));var config=require(_0x73e4('0x4'));var app=express();var server=http['createServer'](app);server[_0x73e4('0x5')]=0xdbba0;if(sticky[_0x73e4('0x6')](server,config['port'])){var socketio=require(_0x73e4('0x7'))(server,{'transports':['websocket','polling']});config[_0x73e4('0x8')]=_['defaults'](config[_0x73e4('0x8')],{'host':_0x73e4('0x9'),'port':0x18eb});socketio[_0x73e4('0xa')](require(_0x73e4('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0x73e4('0xc'))[_0x73e4('0xd')]();require(_0x73e4('0xe'))[_0x73e4('0xd')](socketio);require(_0x73e4('0xf'))[_0x73e4('0xd')](app);require(_0x73e4('0x10'))['default'](app);}else{server['once'](_0x73e4('0x11'),function(){console[_0x73e4('0x12')](_0x73e4('0x13'),config['port']);});}exports=module[_0x73e4('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 3b04b3d..49b945e 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 _0x2d4a=['client','http','request','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x2014e7,_0x2bd284){var _0x29452d=function(_0x76c1b0){while(--_0x76c1b0){_0x2014e7['push'](_0x2014e7['shift']());}};_0x29452d(++_0x2bd284);}(_0x2d4a,0x130));var _0xa2d4=function(_0x1fc6a6,_0x3a0897){_0x1fc6a6=_0x1fc6a6-0x0;var _0x18918d=_0x2d4a[_0x1fc6a6];return _0x18918d;};'use strict';var jayson=require(_0xa2d4('0x0'));var BPromise=require(_0xa2d4('0x1'));var logger=require(_0xa2d4('0x2'))(_0xa2d4('0x3'));var client=jayson[_0xa2d4('0x4')][_0xa2d4('0x5')]({'port':0x2329});client['Request']=function(_0x47419c,_0x525b17){return new BPromise(function(_0x168c35,_0x26223e){return client[_0xa2d4('0x6')](_0x47419c,_0x525b17)[_0xa2d4('0x7')](function(_0x475e49){logger[_0xa2d4('0x8')](_0xa2d4('0x9'),_0xa2d4('0x3'),_0x47419c,_0x525b17,_0x475e49);if(_0x475e49[_0xa2d4('0xa')]){logger['error'](_0xa2d4('0x9'),_0xa2d4('0x3'),_0x47419c,_0x475e49[_0xa2d4('0xa')][_0xa2d4('0xb')],_0x525b17);return _0x26223e(_0x475e49[_0xa2d4('0xa')]['message']);}else{return _0x168c35(_0x475e49[_0xa2d4('0xc')]);}})[_0xa2d4('0xd')](function(_0x2411da){logger[_0xa2d4('0xa')](_0xa2d4('0x9'),'routing',_0x47419c,_0x2411da,_0x525b17);return _0x26223e(_0x2411da);});});};module['exports']=client; \ No newline at end of file +var _0x88bd=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','rpc','error','message'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x88bd,0xaa));var _0xd88b=function(_0x6000cf,_0x3b66f2){_0x6000cf=_0x6000cf-0x0;var _0x4ddf3f=_0x88bd[_0x6000cf];return _0x4ddf3f;};'use strict';var jayson=require(_0xd88b('0x0'));var BPromise=require(_0xd88b('0x1'));var logger=require(_0xd88b('0x2'))(_0xd88b('0x3'));var client=jayson[_0xd88b('0x4')][_0xd88b('0x5')]({'port':0x2329});client[_0xd88b('0x6')]=function(_0x420735,_0x81578e){return new BPromise(function(_0x5dd6e0,_0x3abe5e){return client[_0xd88b('0x7')](_0x420735,_0x81578e)[_0xd88b('0x8')](function(_0x4abc3f){logger['debug'](_0xd88b('0x9'),_0xd88b('0x3'),_0x420735,_0x81578e,_0x4abc3f);if(_0x4abc3f[_0xd88b('0xa')]){logger[_0xd88b('0xa')]('rpc','routing',_0x420735,_0x4abc3f[_0xd88b('0xa')]['message'],_0x81578e);return _0x3abe5e(_0x4abc3f['error'][_0xd88b('0xb')]);}else{return _0x5dd6e0(_0x4abc3f['result']);}})['catch'](function(_0x14b521){logger['error'](_0xd88b('0x9'),_0xd88b('0x3'),_0x420735,_0x14b521,_0x81578e);return _0x3abe5e(_0x14b521);});});};module[_0xd88b('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index c8d79a7..b46cdaf 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 _0x7d9d=['initAgents','then','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x2b3208,_0x26f23b){var _0xde06e1=function(_0x6d46d1){while(--_0x6d46d1){_0x2b3208['push'](_0x2b3208['shift']());}};_0xde06e1(++_0x26f23b);}(_0x7d9d,0x13b));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var server=require(_0xd7d9('0x0'));var Realtime=require(_0xd7d9('0x1'));var user=require(_0xd7d9('0x2'));var interval=require(_0xd7d9('0x3'));var openchannelQueue=require(_0xd7d9('0x4'));var chatQueue=require(_0xd7d9('0x5'));var smsQueue=require(_0xd7d9('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xd7d9('0x7'));var whatsappQueue=require(_0xd7d9('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd7d9('0x9')]()['then'](user['getAgents']())['then'](realtime[_0xd7d9('0xa')]())[_0xd7d9('0xb')](interval[_0xd7d9('0xc')]())[_0xd7d9('0xb')](realtime['initIntervals']())['then'](openchannelQueue[_0xd7d9('0xd')]())[_0xd7d9('0xb')](realtime['initOpenchannelQueues']())[_0xd7d9('0xb')](chatQueue[_0xd7d9('0xe')]())['then'](realtime[_0xd7d9('0xf')]())[_0xd7d9('0xb')](smsQueue[_0xd7d9('0x10')]())[_0xd7d9('0xb')](realtime[_0xd7d9('0x11')]())[_0xd7d9('0xb')](mailQueue[_0xd7d9('0x12')]())['then'](realtime['initMailQueues']())[_0xd7d9('0xb')](faxQueue[_0xd7d9('0x13')]())[_0xd7d9('0xb')](realtime[_0xd7d9('0x14')]())[_0xd7d9('0xb')](whatsappQueue[_0xd7d9('0x15')]())['then'](realtime['initWhatsappQueues']())[_0xd7d9('0xb')](function(){return realtime;});}function main(){return server[_0xd7d9('0x16')](realtime)['then'](function(_0x15878a){return initRealtime();})[_0xd7d9('0xb')](function(_0x58c6f9){return setInterval(initRealtime,0x1388);})[_0xd7d9('0x17')](function(_0x30afb8){console[_0xd7d9('0x18')](_0x30afb8);});}main(); \ No newline at end of file +var _0x4cfe=['getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues'];(function(_0x41df01,_0x4d9a1b){var _0x5dadd8=function(_0x144c12){while(--_0x144c12){_0x41df01['push'](_0x41df01['shift']());}};_0x5dadd8(++_0x4d9a1b);}(_0x4cfe,0x1c8));var _0xe4cf=function(_0x43efe1,_0x10df04){_0x43efe1=_0x43efe1-0x0;var _0x25a7e4=_0x4cfe[_0x43efe1];return _0x25a7e4;};'use strict';var BPromise=require(_0xe4cf('0x0'));var server=require(_0xe4cf('0x1'));var Realtime=require('./realtime');var user=require(_0xe4cf('0x2'));var interval=require(_0xe4cf('0x3'));var openchannelQueue=require(_0xe4cf('0x4'));var chatQueue=require(_0xe4cf('0x5'));var smsQueue=require(_0xe4cf('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xe4cf('0x7'));var whatsappQueue=require(_0xe4cf('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe4cf('0x9')]()[_0xe4cf('0xa')](user['getAgents']())['then'](realtime[_0xe4cf('0xb')]())[_0xe4cf('0xa')](interval[_0xe4cf('0xc')]())['then'](realtime[_0xe4cf('0xd')]())[_0xe4cf('0xa')](openchannelQueue[_0xe4cf('0xe')]())[_0xe4cf('0xa')](realtime[_0xe4cf('0xf')]())[_0xe4cf('0xa')](chatQueue[_0xe4cf('0x10')]())[_0xe4cf('0xa')](realtime[_0xe4cf('0x11')]())[_0xe4cf('0xa')](smsQueue[_0xe4cf('0x12')]())[_0xe4cf('0xa')](realtime['initSmsQueues']())['then'](mailQueue[_0xe4cf('0x13')]())[_0xe4cf('0xa')](realtime[_0xe4cf('0x14')]())[_0xe4cf('0xa')](faxQueue[_0xe4cf('0x15')]())['then'](realtime['initFaxQueues']())[_0xe4cf('0xa')](whatsappQueue['getWhatsappQueues']())[_0xe4cf('0xa')](realtime[_0xe4cf('0x16')]())[_0xe4cf('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)['then'](function(_0x269678){return initRealtime();})[_0xe4cf('0xa')](function(_0x2aa029){return setInterval(initRealtime,0x1388);})[_0xe4cf('0x17')](function(_0x24da60){console[_0xe4cf('0x18')](_0x24da60);});}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 78abda4..27e7a34 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 _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(_0x4ac538,_0x526b08){var _0x300801=function(_0x3bba19){while(--_0x3bba19){_0x4ac538['push'](_0x4ac538['shift']());}};_0x300801(++_0x526b08);}(_0xe14b,0x93));var _0xbe14=function(_0x41a1cb,_0x45c75d){_0x41a1cb=_0x41a1cb-0x0;var _0x2536f6=_0xe14b[_0x41a1cb];return _0x2536f6;};'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 +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(_0x57e2a2,_0x7a6e20){var _0x4d683d=function(_0x37a32c){while(--_0x37a32c){_0x57e2a2['push'](_0x57e2a2['shift']());}};_0x4d683d(++_0x7a6e20);}(_0xe14b,0x93));var _0xbe14=function(_0x2d3328,_0x1eb37c){_0x2d3328=_0x2d3328-0x0;var _0x2cd3bb=_0xe14b[_0x2d3328];return _0x2cd3bb;};'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 1a7696c..1666dcb 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 _0xecc4=['sendMailMessage','bluebird','jayson/promise','client','http','error','message'];(function(_0x5d730d,_0x401b3a){var _0x600e96=function(_0x3635f7){while(--_0x3635f7){_0x5d730d['push'](_0x5d730d['shift']());}};_0x600e96(++_0x401b3a);}(_0xecc4,0x112));var _0x4ecc=function(_0x52cafe,_0x41d4dc){_0x52cafe=_0x52cafe-0x0;var _0x54636b=_0xecc4[_0x52cafe];return _0x54636b;};'use strict';var BPromise=require(_0x4ecc('0x0'));var jayson=require(_0x4ecc('0x1'));var client=jayson[_0x4ecc('0x2')][_0x4ecc('0x3')]({'port':0x232b});function request(_0x224cc6,_0x3cde6f){return new BPromise(function(_0x2a413d,_0x4b8f58){return client['request'](_0x224cc6,_0x3cde6f)['then'](function(_0x19bbea){if(_0x19bbea[_0x4ecc('0x4')]){return _0x4b8f58(_0x19bbea[_0x4ecc('0x4')][_0x4ecc('0x5')]);}else{return _0x2a413d(_0x19bbea['result']);}})['catch'](function(_0x330efc){return _0x4b8f58(_0x330efc);});});}exports[_0x4ecc('0x6')]=function(_0x5d72ec,_0x21ee87){return request('SendMail',{'account':_0x5d72ec,'message':_0x21ee87});}; \ No newline at end of file +var _0x17f4=['then','error','message','bluebird','jayson/promise','client'];(function(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0x17f4,0x153));var _0x417f=function(_0x4de9a5,_0x267a09){_0x4de9a5=_0x4de9a5-0x0;var _0xd240ae=_0x17f4[_0x4de9a5];return _0xd240ae;};'use strict';var BPromise=require(_0x417f('0x0'));var jayson=require(_0x417f('0x1'));var client=jayson[_0x417f('0x2')]['http']({'port':0x232b});function request(_0x5e9e15,_0x2b0c7e){return new BPromise(function(_0x2b84d5,_0x4c0425){return client['request'](_0x5e9e15,_0x2b0c7e)[_0x417f('0x3')](function(_0x319593){if(_0x319593[_0x417f('0x4')]){return _0x4c0425(_0x319593['error'][_0x417f('0x5')]);}else{return _0x2b84d5(_0x319593['result']);}})['catch'](function(_0x590447){return _0x4c0425(_0x590447);});});}exports['sendMailMessage']=function(_0x4730c3,_0x31045b){return request('SendMail',{'account':_0x4730c3,'message':_0x31045b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 4346922..13e35e8 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 _0x6a23=['moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','CurrentCapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','StatusTime','toNumber','format','Status','mailCurrentCapacity','faxCapacity','smsStatus','openchannelStatusTime','emit','user:save','exports','lodash'];(function(_0x2c50cf,_0x1428d8){var _0x36a3d3=function(_0x134d93){while(--_0x134d93){_0x2c50cf['push'](_0x2c50cf['shift']());}};_0x36a3d3(++_0x1428d8);}(_0x6a23,0x179));var _0x36a2=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x6a23[_0x46401e];return _0x447cba;};'use strict';var _=require(_0x36a2('0x0'));var moment=require(_0x36a2('0x1'));var md5=require(_0x36a2('0x2'));var Redis=require(_0x36a2('0x3'));var config=require(_0x36a2('0x4'));config[_0x36a2('0x5')]=_['defaults'](config[_0x36a2('0x5')],{'host':_0x36a2('0x6'),'port':0x18eb});var io=require(_0x36a2('0x7'))(new Redis(config[_0x36a2('0x5')]));function Agent(_0x4e0e9c){this['id']=_0x4e0e9c['id']||0x0;this[_0x36a2('0x8')]=_0x4e0e9c[_0x36a2('0x8')]||'';this[_0x36a2('0x9')]=_0x4e0e9c[_0x36a2('0x9')]||!![];this[_0x36a2('0xa')]=_0x4e0e9c[_0x36a2('0xa')]||![];this[_0x36a2('0xb')]=_0x4e0e9c[_0x36a2('0xb')]||![];this[_0x36a2('0xc')]=_0x4e0e9c[_0x36a2('0xc')]||![];this[_0x36a2('0xd')]=_0x4e0e9c[_0x36a2('0xd')]||![];this[_0x36a2('0xe')]=_0x4e0e9c[_0x36a2('0xe')]||![];this['openchannelPause']=_0x4e0e9c[_0x36a2('0xf')]||![];this[_0x36a2('0x10')]=_0x36a2('0x11');this[_0x36a2('0x12')]=0x0;this[_0x36a2('0x13')]=_0x4e0e9c[_0x36a2('0x13')]||0x0;this[_0x36a2('0x14')]=0x0;this[_0x36a2('0x15')]='unknown';this[_0x36a2('0x16')]=0x0;this['mailCapacity']=_0x4e0e9c[_0x36a2('0x17')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x36a2('0x18')]=_0x36a2('0x11');this[_0x36a2('0x19')]=0x0;this['faxCapacity']=_0x4e0e9c['faxCapacity']||0x0;this[_0x36a2('0x1a')]=0x0;this['smsStatus']=_0x36a2('0x11');this[_0x36a2('0x1b')]=0x0;this[_0x36a2('0x1c')]=_0x4e0e9c['smsCapacity']||0x0;this[_0x36a2('0x1d')]=0x0;this[_0x36a2('0x1e')]=_0x36a2('0x11');this[_0x36a2('0x1f')]=0x0;this[_0x36a2('0x20')]=_0x4e0e9c[_0x36a2('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x36a2('0x21')]=_0x36a2('0x11');this['openchannelStatusTime']=0x0;this[_0x36a2('0x22')]=_0x4e0e9c[_0x36a2('0x22')]||0x0;this[_0x36a2('0x23')]=0x0;this[_0x36a2('0x24')]=![];this[_0x36a2('0x25')]=undefined;this[_0x36a2('0x2')]='';this[_0x36a2('0x26')]();}Agent[_0x36a2('0x27')][_0x36a2('0x28')]=function(_0x499e97){if(this[_0x499e97+'CurrentCapacity']>0x0){if(this[_0x499e97+_0x36a2('0x29')]>0x0&&this[_0x499e97+_0x36a2('0x2a')]>=this[_0x499e97+_0x36a2('0x29')]){return'maxcapacity';}else{return _0x36a2('0x2b');}}else{return _0x36a2('0x2c');}};Agent['prototype']['updateRealtime']=function(){var _0x1ef982=[_0x36a2('0x2d'),_0x36a2('0x2e'),_0x36a2('0x2f'),_0x36a2('0x30'),_0x36a2('0x31'),_0x36a2('0x32')];for(var _0x3d21e4=0x0;_0x3d21e4<_0x1ef982[_0x36a2('0x33')];_0x3d21e4+=0x1){var _0x5a5075=this[_0x36a2('0x28')](_0x1ef982[_0x3d21e4]);if(this[_0x1ef982[_0x3d21e4]+'Status']!==_0x5a5075){this[_0x1ef982[_0x3d21e4]+_0x36a2('0x34')]=_[_0x36a2('0x35')](moment()[_0x36a2('0x36')]('x'));}this[_0x1ef982[_0x3d21e4]+_0x36a2('0x37')]=_0x5a5075;}var _0x4e373b={'id':this['id'],'name':this['name'],'online':this[_0x36a2('0x9')],'voicePause':this['voicePause'],'chatPause':this[_0x36a2('0xb')],'mailPause':this[_0x36a2('0xc')],'smsPause':this[_0x36a2('0xe')],'faxPause':this[_0x36a2('0xd')],'openchannelPause':this[_0x36a2('0xf')],'chatStatus':this[_0x36a2('0x10')],'chatStatusTime':this[_0x36a2('0x12')],'chatCapacity':this[_0x36a2('0x13')],'chatCurrentCapacity':this[_0x36a2('0x14')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x36a2('0x17')],'mailCurrentCapacity':this[_0x36a2('0x38')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x36a2('0x19')],'faxCapacity':this[_0x36a2('0x39')],'faxCurrentCapacity':this[_0x36a2('0x1a')],'smsStatus':this[_0x36a2('0x3a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x36a2('0x1c')],'smsCurrentCapacity':this[_0x36a2('0x1d')],'whatsappStatus':this[_0x36a2('0x1e')],'whatsappStatusTime':this[_0x36a2('0x1f')],'whatsappCapacity':this[_0x36a2('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x36a2('0x21')],'openchannelStatusTime':this[_0x36a2('0x3b')],'openchannelCapacity':this[_0x36a2('0x22')],'openchannelCurrentCapacity':this[_0x36a2('0x23')],'busy':this[_0x36a2('0x24')],'busyQueue':this[_0x36a2('0x25')]};var _0x43a4f7=md5(JSON['stringify'](_0x4e373b));if(this[_0x36a2('0x2')]!==_0x43a4f7){this['md5']=_0x43a4f7;io[_0x36a2('0x3c')](_0x36a2('0x3d'),_0x4e373b);}};module[_0x36a2('0x3e')]=Agent; \ No newline at end of file +var _0x08bf=['localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','working','chat','openchannel','fax','sms','whatsapp','StatusTime','format','chatStatusTime','faxStatusTime','smsCurrentCapacity','openchannelStatusTime','openchannelCurrentCapacity','stringify','emit','lodash','moment','md5','ioredis','../../../config/environment','redis'];(function(_0x3e514b,_0x117c42){var _0x186061=function(_0x5a9135){while(--_0x5a9135){_0x3e514b['push'](_0x3e514b['shift']());}};_0x186061(++_0x117c42);}(_0x08bf,0x112));var _0xf08b=function(_0x46b53c,_0xcd2a21){_0x46b53c=_0x46b53c-0x0;var _0x4db929=_0x08bf[_0x46b53c];return _0x4db929;};'use strict';var _=require(_0xf08b('0x0'));var moment=require(_0xf08b('0x1'));var md5=require(_0xf08b('0x2'));var Redis=require(_0xf08b('0x3'));var config=require(_0xf08b('0x4'));config[_0xf08b('0x5')]=_['defaults'](config[_0xf08b('0x5')],{'host':_0xf08b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf08b('0x5')]));function Agent(_0x1531b8){this['id']=_0x1531b8['id']||0x0;this[_0xf08b('0x7')]=_0x1531b8[_0xf08b('0x7')]||'';this[_0xf08b('0x8')]=_0x1531b8[_0xf08b('0x8')]||!![];this['voicePause']=_0x1531b8[_0xf08b('0x9')]||![];this[_0xf08b('0xa')]=_0x1531b8[_0xf08b('0xa')]||![];this[_0xf08b('0xb')]=_0x1531b8[_0xf08b('0xb')]||![];this[_0xf08b('0xc')]=_0x1531b8[_0xf08b('0xc')]||![];this['smsPause']=_0x1531b8[_0xf08b('0xd')]||![];this[_0xf08b('0xe')]=_0x1531b8['openchannelPause']||![];this[_0xf08b('0xf')]='unknown';this['chatStatusTime']=0x0;this['chatCapacity']=_0x1531b8[_0xf08b('0x10')]||0x0;this[_0xf08b('0x11')]=0x0;this[_0xf08b('0x12')]=_0xf08b('0x13');this[_0xf08b('0x14')]=0x0;this['mailCapacity']=_0x1531b8[_0xf08b('0x15')]||0x0;this[_0xf08b('0x16')]=0x0;this[_0xf08b('0x17')]=_0xf08b('0x13');this['faxStatusTime']=0x0;this[_0xf08b('0x18')]=_0x1531b8[_0xf08b('0x18')]||0x0;this[_0xf08b('0x19')]=0x0;this[_0xf08b('0x1a')]='unknown';this[_0xf08b('0x1b')]=0x0;this[_0xf08b('0x1c')]=_0x1531b8[_0xf08b('0x1c')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xf08b('0x1d')]='unknown';this[_0xf08b('0x1e')]=0x0;this[_0xf08b('0x1f')]=_0x1531b8[_0xf08b('0x1f')]||0x0;this[_0xf08b('0x20')]=0x0;this[_0xf08b('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0xf08b('0x22')]=_0x1531b8[_0xf08b('0x22')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xf08b('0x23')]=![];this[_0xf08b('0x24')]=undefined;this[_0xf08b('0x2')]='';this[_0xf08b('0x25')]();}Agent[_0xf08b('0x26')]['getChannelStatus']=function(_0x1cd935){if(this[_0x1cd935+_0xf08b('0x27')]>0x0){if(this[_0x1cd935+_0xf08b('0x28')]>0x0&&this[_0x1cd935+_0xf08b('0x27')]>=this[_0x1cd935+_0xf08b('0x28')]){return'maxcapacity';}else{return _0xf08b('0x29');}}else{return'idle';}};Agent[_0xf08b('0x26')][_0xf08b('0x25')]=function(){var _0x2c9367=['mail',_0xf08b('0x2a'),_0xf08b('0x2b'),_0xf08b('0x2c'),_0xf08b('0x2d'),_0xf08b('0x2e')];for(var _0x3e83c5=0x0;_0x3e83c5<_0x2c9367['length'];_0x3e83c5+=0x1){var _0x95dd62=this['getChannelStatus'](_0x2c9367[_0x3e83c5]);if(this[_0x2c9367[_0x3e83c5]+'Status']!==_0x95dd62){this[_0x2c9367[_0x3e83c5]+_0xf08b('0x2f')]=_['toNumber'](moment()[_0xf08b('0x30')]('x'));}this[_0x2c9367[_0x3e83c5]+'Status']=_0x95dd62;}var _0xd22a4={'id':this['id'],'name':this[_0xf08b('0x7')],'online':this[_0xf08b('0x8')],'voicePause':this[_0xf08b('0x9')],'chatPause':this[_0xf08b('0xa')],'mailPause':this[_0xf08b('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xf08b('0xc')],'openchannelPause':this[_0xf08b('0xe')],'chatStatus':this[_0xf08b('0xf')],'chatStatusTime':this[_0xf08b('0x31')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xf08b('0x11')],'mailStatus':this[_0xf08b('0x12')],'mailStatusTime':this[_0xf08b('0x14')],'mailCapacity':this[_0xf08b('0x15')],'mailCurrentCapacity':this[_0xf08b('0x16')],'faxStatus':this[_0xf08b('0x17')],'faxStatusTime':this[_0xf08b('0x32')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf08b('0x1a')],'smsStatusTime':this[_0xf08b('0x1b')],'smsCapacity':this[_0xf08b('0x1c')],'smsCurrentCapacity':this[_0xf08b('0x33')],'whatsappStatus':this[_0xf08b('0x1d')],'whatsappStatusTime':this[_0xf08b('0x1e')],'whatsappCapacity':this[_0xf08b('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xf08b('0x21')],'openchannelStatusTime':this[_0xf08b('0x34')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf08b('0x35')],'busy':this['busy'],'busyQueue':this[_0xf08b('0x24')]};var _0x2499dd=md5(JSON[_0xf08b('0x36')](_0xd22a4));if(this[_0xf08b('0x2')]!==_0x2499dd){this[_0xf08b('0x2')]=_0x2499dd;io[_0xf08b('0x37')]('user:save',_0xd22a4);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index a935e18..e105efd 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 _0x5724=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x5724,0x1ae));var _0x4572=function(_0x5e2443,_0x18acad){_0x5e2443=_0x5e2443-0x0;var _0x4ccc3d=_0x5724[_0x5e2443];return _0x4ccc3d;};'use strict';var _=require('lodash');var md5=require(_0x4572('0x0'));var util=require('util');var Redis=require(_0x4572('0x1'));var config=require(_0x4572('0x2'));config[_0x4572('0x3')]=_[_0x4572('0x4')](config[_0x4572('0x3')],{'host':_0x4572('0x5'),'port':0x18eb});var io=require(_0x4572('0x6'))(new Redis(config[_0x4572('0x3')]));function ChatQueue(_0x3c9285){this['id']=_0x3c9285['id']||0x0;this['name']=_0x3c9285[_0x4572('0x7')]||'';this['timeout']=_0x3c9285[_0x4572('0x8')]||0xa;this[_0x4572('0x9')]=_0x3c9285[_0x4572('0x9')]||_0x4572('0xa');this[_0x4572('0xb')]=_0x3c9285['Agents'];this['mapAgentsId']={};this[_0x4572('0xc')]=0x0;this[_0x4572('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x4572('0xd')][_0x4572('0xe')]=function(){var _0x105d9e=this[_0x4572('0xf')][_0x4572('0x10')];this[_0x4572('0xf')]=_[_0x4572('0x11')](this['Agents'],'id');this[_0x4572('0xf')][_0x4572('0x10')]=_0x105d9e;};ChatQueue['prototype'][_0x4572('0x12')]=function(){this[_0x4572('0x13')]=0x0;this[_0x4572('0x14')]=0x0;for(var _0x8910c1=0x0;_0x8910c1=0x0?this[_0x4572('0x16')]:0x0;var _0x546762={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x4572('0x7')],'paused':this[_0x4572('0x14')],'waiting':this[_0x4572('0xc')]};var _0x44dcf7=md5(JSON[_0x4572('0x17')](_0x546762));if(this['md5']!==_0x44dcf7){this[_0x4572('0x0')]=_0x44dcf7;io['to'](util[_0x4572('0x18')](_0x4572('0x19'),_0x546762[_0x4572('0x7')]))[_0x4572('0x1a')](_0x4572('0x1b'),_0x546762);}};module[_0x4572('0x1c')]=ChatQueue; \ No newline at end of file +var _0xec2e=['length','online','chatPause','available','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','map','_rr','prototype','loggedIn','paused'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xec2e,0x1e4));var _0xeec2=function(_0x3ea772,_0x16437b){_0x3ea772=_0x3ea772-0x0;var _0x4cde1a=_0xec2e[_0x3ea772];return _0x4cde1a;};'use strict';var _=require(_0xeec2('0x0'));var md5=require(_0xeec2('0x1'));var util=require('util');var Redis=require(_0xeec2('0x2'));var config=require(_0xeec2('0x3'));config[_0xeec2('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xeec2('0x5'))(new Redis(config['redis']));function ChatQueue(_0x1cfbeb){this['id']=_0x1cfbeb['id']||0x0;this[_0xeec2('0x6')]=_0x1cfbeb[_0xeec2('0x6')]||'';this[_0xeec2('0x7')]=_0x1cfbeb[_0xeec2('0x7')]||0xa;this['strategy']=_0x1cfbeb[_0xeec2('0x8')]||_0xeec2('0x9');this[_0xeec2('0xa')]=_0x1cfbeb['Agents'];this['mapAgentsId']={};this[_0xeec2('0xb')]=0x0;this[_0xeec2('0x1')]='';this['updateRouting']();this[_0xeec2('0xc')]();}ChatQueue['prototype'][_0xeec2('0xd')]=function(){var _0x53115a=this['mapAgentsId']['_rr'];this[_0xeec2('0xe')]=_[_0xeec2('0xf')](this[_0xeec2('0xa')],'id');this['mapAgentsId'][_0xeec2('0x10')]=_0x53115a;};ChatQueue[_0xeec2('0x11')][_0xeec2('0xc')]=function(){this[_0xeec2('0x12')]=0x0;this[_0xeec2('0x13')]=0x0;for(var _0x44fb38=0x0;_0x44fb38=0x0?this[_0xeec2('0x17')]:0x0;var _0xdf1880={'id':this['id'],'available':this[_0xeec2('0x17')],'loggedIn':this[_0xeec2('0x12')],'name':this[_0xeec2('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x192913=md5(JSON['stringify'](_0xdf1880));if(this[_0xeec2('0x1')]!==_0x192913){this['md5']=_0x192913;io['to'](util[_0xeec2('0x18')]('chat:queue:%s',_0xdf1880['name']))[_0xeec2('0x19')](_0xeec2('0x1a'),_0xdf1880);}};module[_0xeec2('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index dfd2b5b..08efd51 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 _0xe186=['mapAgentsId','updateRouting','prototype','_rr','map','loggedIn','paused','length','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x4a36c8,_0x3f9dfe){var _0x29a1c0=function(_0x25c4c3){while(--_0x25c4c3){_0x4a36c8['push'](_0x4a36c8['shift']());}};_0x29a1c0(++_0x3f9dfe);}(_0xe186,0x132));var _0x6e18=function(_0x3d99e6,_0x25e4b1){_0x3d99e6=_0x3d99e6-0x0;var _0x19e82f=_0xe186[_0x3d99e6];return _0x19e82f;};'use strict';var _=require(_0x6e18('0x0'));var md5=require(_0x6e18('0x1'));var util=require(_0x6e18('0x2'));var Redis=require('ioredis');var config=require(_0x6e18('0x3'));config['redis']=_[_0x6e18('0x4')](config[_0x6e18('0x5')],{'host':_0x6e18('0x6'),'port':0x18eb});var io=require(_0x6e18('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3cdd47){this['id']=_0x3cdd47['id']||0x0;this[_0x6e18('0x8')]=_0x3cdd47[_0x6e18('0x8')]||'';this['timeout']=_0x3cdd47[_0x6e18('0x9')]||0xa;this[_0x6e18('0xa')]=_0x3cdd47[_0x6e18('0xa')]||_0x6e18('0xb');this[_0x6e18('0xc')]=_0x3cdd47[_0x6e18('0xc')];this[_0x6e18('0xd')]={};this['waiting']=0x0;this[_0x6e18('0x1')]='';this[_0x6e18('0xe')]();this['updateRealtime']();}FaxQueue[_0x6e18('0xf')]['updateRouting']=function(){var _0x199671=this[_0x6e18('0xd')][_0x6e18('0x10')];this[_0x6e18('0xd')]=_[_0x6e18('0x11')](this['Agents'],'id');this[_0x6e18('0xd')]['_rr']=_0x199671;};FaxQueue[_0x6e18('0xf')]['updateRealtime']=function(){this[_0x6e18('0x12')]=0x0;this[_0x6e18('0x13')]=0x0;for(var _0x22b5a7=0x0;_0x22b5a7=0x0?this[_0x6e18('0x16')]:0x0;var _0x30fb2e={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6e18('0x12')],'name':this[_0x6e18('0x8')],'paused':this[_0x6e18('0x13')],'waiting':this[_0x6e18('0x17')]};var _0x153f4c=md5(JSON[_0x6e18('0x18')](_0x30fb2e));if(this[_0x6e18('0x1')]!==_0x153f4c){this[_0x6e18('0x1')]=_0x153f4c;io['to'](util[_0x6e18('0x19')](_0x6e18('0x1a'),_0x30fb2e['name']))[_0x6e18('0x1b')]('fax_queue:save',_0x30fb2e);}};module[_0x6e18('0x1c')]=FaxQueue; \ No newline at end of file +var _0x7375=['util','ioredis','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x7375,0x193));var _0x5737=function(_0xbfd835,_0xbca24b){_0xbfd835=_0xbfd835-0x0;var _0x2e0ba9=_0x7375[_0xbfd835];return _0x2e0ba9;};'use strict';var _=require(_0x5737('0x0'));var md5=require(_0x5737('0x1'));var util=require(_0x5737('0x2'));var Redis=require(_0x5737('0x3'));var config=require('../../../config/environment');config[_0x5737('0x4')]=_['defaults'](config[_0x5737('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5737('0x5'))(new Redis(config[_0x5737('0x4')]));function FaxQueue(_0x34199f){this['id']=_0x34199f['id']||0x0;this['name']=_0x34199f[_0x5737('0x6')]||'';this[_0x5737('0x7')]=_0x34199f[_0x5737('0x7')]||0xa;this[_0x5737('0x8')]=_0x34199f[_0x5737('0x8')]||_0x5737('0x9');this[_0x5737('0xa')]=_0x34199f[_0x5737('0xa')];this['mapAgentsId']={};this[_0x5737('0xb')]=0x0;this[_0x5737('0x1')]='';this[_0x5737('0xc')]();this[_0x5737('0xd')]();}FaxQueue[_0x5737('0xe')]['updateRouting']=function(){var _0xb6537a=this['mapAgentsId']['_rr'];this[_0x5737('0xf')]=_['map'](this[_0x5737('0xa')],'id');this['mapAgentsId'][_0x5737('0x10')]=_0xb6537a;};FaxQueue[_0x5737('0xe')]['updateRealtime']=function(){this[_0x5737('0x11')]=0x0;this[_0x5737('0x12')]=0x0;for(var _0x436b26=0x0;_0x436b26=0x0?this[_0x5737('0x15')]:0x0;var _0x5c0492={'id':this['id'],'available':this[_0x5737('0x15')],'loggedIn':this[_0x5737('0x11')],'name':this['name'],'paused':this[_0x5737('0x12')],'waiting':this['waiting']};var _0x32ba=md5(JSON[_0x5737('0x16')](_0x5c0492));if(this['md5']!==_0x32ba){this['md5']=_0x32ba;io['to'](util[_0x5737('0x17')](_0x5737('0x18'),_0x5c0492[_0x5737('0x6')]))['emit'](_0x5737('0x19'),_0x5c0492);}};module[_0x5737('0x1a')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 71110d3..1dadae0 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 _0x91b4=['Intervals','name'];(function(_0xa90a8,_0x4c31d4){var _0x48e50a=function(_0x2d045d){while(--_0x2d045d){_0xa90a8['push'](_0xa90a8['shift']());}};_0x48e50a(++_0x4c31d4);}(_0x91b4,0x89));var _0x491b=function(_0x50e7ef,_0x528e6a){_0x50e7ef=_0x50e7ef-0x0;var _0x47b758=_0x91b4[_0x50e7ef];return _0x47b758;};'use strict';function Interval(_0x2c64d1){this['id']=_0x2c64d1['id']||0x0;this[_0x491b('0x0')]=_0x2c64d1['name']||'';this[_0x491b('0x1')]=_0x2c64d1[_0x491b('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x8807=['exports','name','Intervals'];(function(_0xdbf206,_0x111e29){var _0x51935c=function(_0x35f90e){while(--_0x35f90e){_0xdbf206['push'](_0xdbf206['shift']());}};_0x51935c(++_0x111e29);}(_0x8807,0xfa));var _0x7880=function(_0x35c506,_0x18351c){_0x35c506=_0x35c506-0x0;var _0x4d025c=_0x8807[_0x35c506];return _0x4d025c;};'use strict';function Interval(_0x4d4888){this['id']=_0x4d4888['id']||0x0;this[_0x7880('0x0')]=_0x4d4888[_0x7880('0x0')]||'';this[_0x7880('0x1')]=_0x4d4888[_0x7880('0x1')]||{};}module[_0x7880('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 3a44dc0..3ca7f73 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 _0xa1c8=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','name','mail_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x43b93b,_0xf92ec8){var _0x4434d4=function(_0x148b8e){while(--_0x148b8e){_0x43b93b['push'](_0x43b93b['shift']());}};_0x4434d4(++_0xf92ec8);}(_0xa1c8,0xe2));var _0x8a1c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xa1c8[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x8a1c('0x0'));var md5=require('md5');var util=require(_0x8a1c('0x1'));var Redis=require('ioredis');var config=require(_0x8a1c('0x2'));config[_0x8a1c('0x3')]=_[_0x8a1c('0x4')](config[_0x8a1c('0x3')],{'host':_0x8a1c('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a1c('0x3')]));function MailQueue(_0x4b42d3){this['id']=_0x4b42d3['id']||0x0;this['name']=_0x4b42d3['name']||'';this[_0x8a1c('0x6')]=_0x4b42d3[_0x8a1c('0x6')]||0xa;this[_0x8a1c('0x7')]=_0x4b42d3['strategy']||_0x8a1c('0x8');this[_0x8a1c('0x9')]=_0x4b42d3[_0x8a1c('0x9')];this[_0x8a1c('0xa')]={};this[_0x8a1c('0xb')]=0x0;this[_0x8a1c('0xc')]='';this['updateRouting']();this['updateRealtime']();}MailQueue[_0x8a1c('0xd')][_0x8a1c('0xe')]=function(){var _0x41e8e7=this[_0x8a1c('0xa')][_0x8a1c('0xf')];this['mapAgentsId']=_['map'](this[_0x8a1c('0x9')],'id');this[_0x8a1c('0xa')]['_rr']=_0x41e8e7;};MailQueue[_0x8a1c('0xd')][_0x8a1c('0x10')]=function(){this[_0x8a1c('0x11')]=0x0;this[_0x8a1c('0x12')]=0x0;for(var _0x5cf15e=0x0;_0x5cf15e=0x0?this[_0x8a1c('0x16')]:0x0;var _0x129357={'id':this['id'],'available':this[_0x8a1c('0x16')],'loggedIn':this[_0x8a1c('0x11')],'name':this['name'],'paused':this[_0x8a1c('0x12')],'waiting':this['waiting']};var _0xb519a5=md5(JSON[_0x8a1c('0x17')](_0x129357));if(this[_0x8a1c('0xc')]!==_0xb519a5){this[_0x8a1c('0xc')]=_0xb519a5;io['to'](util[_0x8a1c('0x18')](_0x8a1c('0x19'),_0x129357[_0x8a1c('0x1a')]))['emit'](_0x8a1c('0x1b'),_0x129357);}};module[_0x8a1c('0x1c')]=MailQueue; \ No newline at end of file +var _0x2aaa=['paused','loggedIn','mailPause','available','stringify','format','mail:queue:%s','name','emit','mail_queue:save','exports','md5','util','ioredis','redis','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x5b0ee5,_0x437c51){var _0x441fea=function(_0x4c3f9){while(--_0x4c3f9){_0x5b0ee5['push'](_0x5b0ee5['shift']());}};_0x441fea(++_0x437c51);}(_0x2aaa,0x185));var _0xa2aa=function(_0x4f2370,_0xb27230){_0x4f2370=_0x4f2370-0x0;var _0x443acd=_0x2aaa[_0x4f2370];return _0x443acd;};'use strict';var _=require('lodash');var md5=require(_0xa2aa('0x0'));var util=require(_0xa2aa('0x1'));var Redis=require(_0xa2aa('0x2'));var config=require('../../../config/environment');config[_0xa2aa('0x3')]=_['defaults'](config[_0xa2aa('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xa2aa('0x4'))(new Redis(config['redis']));function MailQueue(_0x450125){this['id']=_0x450125['id']||0x0;this['name']=_0x450125['name']||'';this[_0xa2aa('0x5')]=_0x450125[_0xa2aa('0x5')]||0xa;this[_0xa2aa('0x6')]=_0x450125[_0xa2aa('0x6')]||_0xa2aa('0x7');this[_0xa2aa('0x8')]=_0x450125[_0xa2aa('0x8')];this[_0xa2aa('0x9')]={};this[_0xa2aa('0xa')]=0x0;this['md5']='';this[_0xa2aa('0xb')]();this[_0xa2aa('0xc')]();}MailQueue[_0xa2aa('0xd')][_0xa2aa('0xb')]=function(){var _0x7cf6e5=this[_0xa2aa('0x9')][_0xa2aa('0xe')];this[_0xa2aa('0x9')]=_[_0xa2aa('0xf')](this[_0xa2aa('0x8')],'id');this[_0xa2aa('0x9')]['_rr']=_0x7cf6e5;};MailQueue[_0xa2aa('0xd')][_0xa2aa('0xc')]=function(){this['loggedIn']=0x0;this[_0xa2aa('0x10')]=0x0;for(var _0x23483e=0x0;_0x23483e=0x0?this[_0xa2aa('0x13')]:0x0;var _0x340d1c={'id':this['id'],'available':this[_0xa2aa('0x13')],'loggedIn':this[_0xa2aa('0x11')],'name':this['name'],'paused':this[_0xa2aa('0x10')],'waiting':this[_0xa2aa('0xa')]};var _0x29da22=md5(JSON[_0xa2aa('0x14')](_0x340d1c));if(this[_0xa2aa('0x0')]!==_0x29da22){this[_0xa2aa('0x0')]=_0x29da22;io['to'](util[_0xa2aa('0x15')](_0xa2aa('0x16'),_0x340d1c[_0xa2aa('0x17')]))[_0xa2aa('0x18')](_0xa2aa('0x19'),_0x340d1c);}};module[_0xa2aa('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3d6665b..8b62a60 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0xb563f2,_0x572c98){var _0x126d17=function(_0x5763b1){while(--_0x5763b1){_0xb563f2['push'](_0xb563f2['shift']());}};_0x126d17(++_0x572c98);}(_0x814b,0x1a2));var _0xb814=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x814b[_0x3d27ba];return _0xf01885;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x7a54=['exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRealtime','mapAgentsId','_rr','map','Agents','prototype','loggedIn','paused','length','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x7a54,0x106));var _0x47a5=function(_0x1e3ec2,_0x4b2164){_0x1e3ec2=_0x1e3ec2-0x0;var _0x322b74=_0x7a54[_0x1e3ec2];return _0x322b74;};'use strict';var _=require(_0x47a5('0x0'));var md5=require(_0x47a5('0x1'));var util=require(_0x47a5('0x2'));var Redis=require('ioredis');var config=require(_0x47a5('0x3'));config[_0x47a5('0x4')]=_['defaults'](config[_0x47a5('0x4')],{'host':_0x47a5('0x5'),'port':0x18eb});var io=require(_0x47a5('0x6'))(new Redis(config[_0x47a5('0x4')]));function OpenchannelQueue(_0xfdf934){this['id']=_0xfdf934['id']||0x0;this['name']=_0xfdf934[_0x47a5('0x7')]||'';this['timeout']=_0xfdf934[_0x47a5('0x8')]||0xa;this[_0x47a5('0x9')]=_0xfdf934['strategy']||_0x47a5('0xa');this['Agents']=_0xfdf934['Agents'];this['mapAgentsId']={};this[_0x47a5('0xb')]=0x0;this[_0x47a5('0x1')]='';this['updateRouting']();this[_0x47a5('0xc')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x1f47f4=this[_0x47a5('0xd')][_0x47a5('0xe')];this[_0x47a5('0xd')]=_[_0x47a5('0xf')](this[_0x47a5('0x10')],'id');this[_0x47a5('0xd')]['_rr']=_0x1f47f4;};OpenchannelQueue[_0x47a5('0x11')][_0x47a5('0xc')]=function(){this[_0x47a5('0x12')]=0x0;this[_0x47a5('0x13')]=0x0;for(var _0x139f25=0x0;_0x139f25=0x0?this['available']:0x0;var _0x423a81={'id':this['id'],'available':this[_0x47a5('0x16')],'loggedIn':this[_0x47a5('0x12')],'name':this[_0x47a5('0x7')],'paused':this[_0x47a5('0x13')],'waiting':this[_0x47a5('0xb')]};var _0x2763d6=md5(JSON[_0x47a5('0x17')](_0x423a81));if(this[_0x47a5('0x1')]!==_0x2763d6){this['md5']=_0x2763d6;io['to'](util[_0x47a5('0x18')](_0x47a5('0x19'),_0x423a81['name']))[_0x47a5('0x1a')](_0x47a5('0x1b'),_0x423a81);}};module[_0x47a5('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 9b686cd..6bd47f2 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 _0x9099=['socket.io-emitter','name','timeout','strategy','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','Agents','loggedIn','paused','length','online','available','md5','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x4f0317,_0xb2e5a1){var _0x4e24e3=function(_0x5070a3){while(--_0x5070a3){_0x4f0317['push'](_0x4f0317['shift']());}};_0x4e24e3(++_0xb2e5a1);}(_0x9099,0x1ac));var _0x9909=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x9099[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x9909('0x0'));var md5=require('md5');var util=require(_0x9909('0x1'));var Redis=require(_0x9909('0x2'));var config=require(_0x9909('0x3'));config[_0x9909('0x4')]=_[_0x9909('0x5')](config[_0x9909('0x4')],{'host':_0x9909('0x6'),'port':0x18eb});var io=require(_0x9909('0x7'))(new Redis(config[_0x9909('0x4')]));function SmsQueue(_0x25cf23){this['id']=_0x25cf23['id']||0x0;this[_0x9909('0x8')]=_0x25cf23[_0x9909('0x8')]||'';this[_0x9909('0x9')]=_0x25cf23[_0x9909('0x9')]||0xa;this['strategy']=_0x25cf23[_0x9909('0xa')]||'beepall';this['Agents']=_0x25cf23['Agents'];this['mapAgentsId']={};this[_0x9909('0xb')]=0x0;this['md5']='';this[_0x9909('0xc')]();this[_0x9909('0xd')]();}SmsQueue[_0x9909('0xe')]['updateRouting']=function(){var _0x413019=this['mapAgentsId'][_0x9909('0xf')];this[_0x9909('0x10')]=_[_0x9909('0x11')](this[_0x9909('0x12')],'id');this[_0x9909('0x10')][_0x9909('0xf')]=_0x413019;};SmsQueue[_0x9909('0xe')][_0x9909('0xd')]=function(){this[_0x9909('0x13')]=0x0;this[_0x9909('0x14')]=0x0;for(var _0x1c2668=0x0;_0x1c2668=0x0?this[_0x9909('0x17')]:0x0;var _0x2e6c16={'id':this['id'],'available':this[_0x9909('0x17')],'loggedIn':this[_0x9909('0x13')],'name':this[_0x9909('0x8')],'paused':this['paused'],'waiting':this[_0x9909('0xb')]};var _0x1ec2d6=md5(JSON['stringify'](_0x2e6c16));if(this[_0x9909('0x18')]!==_0x1ec2d6){this[_0x9909('0x18')]=_0x1ec2d6;io['to'](util[_0x9909('0x19')](_0x9909('0x1a'),_0x2e6c16[_0x9909('0x8')]))[_0x9909('0x1b')](_0x9909('0x1c'),_0x2e6c16);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x089f=['available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x18abc6,_0x300733){var _0x567c7d=function(_0x14e599){while(--_0x14e599){_0x18abc6['push'](_0x18abc6['shift']());}};_0x567c7d(++_0x300733);}(_0x089f,0x1c7));var _0xf089=function(_0x41d279,_0x1dab09){_0x41d279=_0x41d279-0x0;var _0x2774c1=_0x089f[_0x41d279];return _0x2774c1;};'use strict';var _=require('lodash');var md5=require(_0xf089('0x0'));var util=require(_0xf089('0x1'));var Redis=require(_0xf089('0x2'));var config=require(_0xf089('0x3'));config[_0xf089('0x4')]=_['defaults'](config[_0xf089('0x4')],{'host':_0xf089('0x5'),'port':0x18eb});var io=require(_0xf089('0x6'))(new Redis(config['redis']));function SmsQueue(_0x92f133){this['id']=_0x92f133['id']||0x0;this[_0xf089('0x7')]=_0x92f133[_0xf089('0x7')]||'';this['timeout']=_0x92f133[_0xf089('0x8')]||0xa;this[_0xf089('0x9')]=_0x92f133[_0xf089('0x9')]||'beepall';this[_0xf089('0xa')]=_0x92f133[_0xf089('0xa')];this[_0xf089('0xb')]={};this[_0xf089('0xc')]=0x0;this[_0xf089('0x0')]='';this[_0xf089('0xd')]();this['updateRealtime']();}SmsQueue[_0xf089('0xe')][_0xf089('0xd')]=function(){var _0x292556=this['mapAgentsId'][_0xf089('0xf')];this[_0xf089('0xb')]=_['map'](this['Agents'],'id');this[_0xf089('0xb')][_0xf089('0xf')]=_0x292556;};SmsQueue['prototype'][_0xf089('0x10')]=function(){this[_0xf089('0x11')]=0x0;this[_0xf089('0x12')]=0x0;for(var _0x337673=0x0;_0x337673=0x0?this[_0xf089('0x15')]:0x0;var _0x4e714a={'id':this['id'],'available':this[_0xf089('0x15')],'loggedIn':this[_0xf089('0x11')],'name':this['name'],'paused':this[_0xf089('0x12')],'waiting':this[_0xf089('0xc')]};var _0x5eadfe=md5(JSON[_0xf089('0x16')](_0x4e714a));if(this[_0xf089('0x0')]!==_0x5eadfe){this[_0xf089('0x0')]=_0x5eadfe;io['to'](util[_0xf089('0x17')](_0xf089('0x18'),_0x4e714a[_0xf089('0x7')]))[_0xf089('0x19')](_0xf089('0x1a'),_0x4e714a);}};module[_0xf089('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index beb19e6..69eaa80 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 _0x8bd3=['emit','whatsapp_queue:save','exports','lodash','util','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','map','prototype','paused','loggedIn','whatsappPause','available','waiting','stringify','md5','whatsapp:queue:%s'];(function(_0x4a7811,_0x29ea54){var _0x2c4a2b=function(_0x28115e){while(--_0x28115e){_0x4a7811['push'](_0x4a7811['shift']());}};_0x2c4a2b(++_0x29ea54);}(_0x8bd3,0x8a));var _0x38bd=function(_0x2330cf,_0x5add9f){_0x2330cf=_0x2330cf-0x0;var _0x5e230f=_0x8bd3[_0x2330cf];return _0x5e230f;};'use strict';var _=require(_0x38bd('0x0'));var md5=require('md5');var util=require(_0x38bd('0x1'));var Redis=require('ioredis');var config=require(_0x38bd('0x2'));config['redis']=_['defaults'](config[_0x38bd('0x3')],{'host':_0x38bd('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x38bd('0x3')]));function WhatsappQueue(_0x2eea3c){this['id']=_0x2eea3c['id']||0x0;this['name']=_0x2eea3c[_0x38bd('0x5')]||'';this[_0x38bd('0x6')]=_0x2eea3c[_0x38bd('0x6')]||0xa;this[_0x38bd('0x7')]=_0x2eea3c['strategy']||_0x38bd('0x8');this[_0x38bd('0x9')]=_0x2eea3c['Agents'];this[_0x38bd('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x38bd('0xb')]();this[_0x38bd('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x3a64c5=this['mapAgentsId'][_0x38bd('0xd')];this[_0x38bd('0xa')]=_[_0x38bd('0xe')](this['Agents'],'id');this[_0x38bd('0xa')][_0x38bd('0xd')]=_0x3a64c5;};WhatsappQueue[_0x38bd('0xf')][_0x38bd('0xc')]=function(){this['loggedIn']=0x0;this[_0x38bd('0x10')]=0x0;for(var _0x5f4f0f=0x0;_0x5f4f0f=0x0?this[_0x38bd('0x13')]:0x0;var _0x409936={'id':this['id'],'available':this[_0x38bd('0x13')],'loggedIn':this[_0x38bd('0x11')],'name':this[_0x38bd('0x5')],'paused':this[_0x38bd('0x10')],'waiting':this[_0x38bd('0x14')]};var _0xa63fef=md5(JSON[_0x38bd('0x15')](_0x409936));if(this[_0x38bd('0x16')]!==_0xa63fef){this['md5']=_0xa63fef;io['to'](util['format'](_0x38bd('0x17'),_0x409936[_0x38bd('0x5')]))[_0x38bd('0x18')](_0x38bd('0x19'),_0x409936);}};module[_0x38bd('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x3415=['whatsapp_queue:save','exports','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','online','whatsappPause','available','waiting','stringify','format','whatsapp:queue:%s'];(function(_0x1a29fe,_0x4dace3){var _0x42d8f7=function(_0x528af9){while(--_0x528af9){_0x1a29fe['push'](_0x1a29fe['shift']());}};_0x42d8f7(++_0x4dace3);}(_0x3415,0xfe));var _0x5341=function(_0xcf84d0,_0xe90b7e){_0xcf84d0=_0xcf84d0-0x0;var _0x277a7c=_0x3415[_0xcf84d0];return _0x277a7c;};'use strict';var _=require('lodash');var md5=require(_0x5341('0x0'));var util=require(_0x5341('0x1'));var Redis=require(_0x5341('0x2'));var config=require('../../../config/environment');config[_0x5341('0x3')]=_[_0x5341('0x4')](config[_0x5341('0x3')],{'host':_0x5341('0x5'),'port':0x18eb});var io=require(_0x5341('0x6'))(new Redis(config[_0x5341('0x3')]));function WhatsappQueue(_0x36b46e){this['id']=_0x36b46e['id']||0x0;this[_0x5341('0x7')]=_0x36b46e[_0x5341('0x7')]||'';this[_0x5341('0x8')]=_0x36b46e[_0x5341('0x8')]||0xa;this[_0x5341('0x9')]=_0x36b46e[_0x5341('0x9')]||_0x5341('0xa');this[_0x5341('0xb')]=_0x36b46e[_0x5341('0xb')];this[_0x5341('0xc')]={};this['waiting']=0x0;this[_0x5341('0x0')]='';this['updateRouting']();this[_0x5341('0xd')]();}WhatsappQueue[_0x5341('0xe')][_0x5341('0xf')]=function(){var _0xd813f=this[_0x5341('0xc')][_0x5341('0x10')];this[_0x5341('0xc')]=_['map'](this[_0x5341('0xb')],'id');this['mapAgentsId'][_0x5341('0x10')]=_0xd813f;};WhatsappQueue[_0x5341('0xe')][_0x5341('0xd')]=function(){this[_0x5341('0x11')]=0x0;this[_0x5341('0x12')]=0x0;for(var _0x4cf161=0x0;_0x4cf161=0x0?this[_0x5341('0x15')]:0x0;var _0xdcccaf={'id':this['id'],'available':this[_0x5341('0x15')],'loggedIn':this[_0x5341('0x11')],'name':this[_0x5341('0x7')],'paused':this[_0x5341('0x12')],'waiting':this[_0x5341('0x16')]};var _0x30cda9=md5(JSON[_0x5341('0x17')](_0xdcccaf));if(this[_0x5341('0x0')]!==_0x30cda9){this[_0x5341('0x0')]=_0x30cda9;io['to'](util[_0x5341('0x18')](_0x5341('0x19'),_0xdcccaf[_0x5341('0x7')]))['emit'](_0x5341('0x1a'),_0xdcccaf);}};module[_0x5341('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 2c5e9c5..a71f85a 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x47ef5f,_0x1228d2){var _0x35f910=function(_0xd92da2){while(--_0xd92da2){_0x47ef5f['push'](_0x47ef5f['shift']());}};_0x35f910(++_0x1228d2);}(_0xb10b,0x12a));var _0xbb10=function(_0x57c2f6,_0x1ee1bf){_0x57c2f6=_0x57c2f6-0x0;var _0x1cbd95=_0xb10b[_0x57c2f6];return _0x1cbd95;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x1fbe7b,_0x5567c6){var _0x4cc1e4=function(_0x258f98){while(--_0x258f98){_0x1fbe7b['push'](_0x1fbe7b['shift']());}};_0x4cc1e4(++_0x5567c6);}(_0xb10b,0x12a));var _0xbb10=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xb10b[_0x381589];return _0x2a075d;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 49e89a6..ff4ff94 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 _0x18c8=['update','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x18c8,0x13b));var _0x818c=function(_0x9f6639,_0x90b26){_0x9f6639=_0x9f6639-0x0;var _0x175f81=_0x18c8[_0x9f6639];return _0x175f81;};'use strict';var client=require('../client');exports[_0x818c('0x0')]=function(_0x23ff7b,_0x3431b6){return client['Request'](_0x818c('0x1'),{'body':_0x3431b6,'options':{'where':{'id':_0x23ff7b}},'log':_0x818c('0x2')});};exports[_0x818c('0x3')]=function(_0x29b663,_0xf2ac65){return client['Request']('AddTagsToChatInteraction',{'body':_0xf2ac65,'options':{'where':{'id':_0x29b663}},'log':_0x818c('0x4')});}; \ No newline at end of file +var _0x6b03=['Request','UpdateChatInteraction','addTagsToChatInteraction','update'];(function(_0x2ee40a,_0x3b99e2){var _0x4788aa=function(_0xefc4b){while(--_0xefc4b){_0x2ee40a['push'](_0x2ee40a['shift']());}};_0x4788aa(++_0x3b99e2);}(_0x6b03,0x1c7));var _0x36b0=function(_0x765ec1,_0xb88de1){_0x765ec1=_0x765ec1-0x0;var _0x102170=_0x6b03[_0x765ec1];return _0x102170;};'use strict';var client=require('../client');exports[_0x36b0('0x0')]=function(_0x36c368,_0x250d67){return client[_0x36b0('0x1')](_0x36b0('0x2'),{'body':_0x250d67,'options':{'where':{'id':_0x36c368}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x27e0af,_0x1d3bf2){return client[_0x36b0('0x1')]('AddTagsToChatInteraction',{'body':_0x1d3bf2,'options':{'where':{'id':_0x27e0af}},'log':_0x36b0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index cc13d22..b2c3c58 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 _0xe11d=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0xd6a7de,_0x1aa7b){var _0x164fec=function(_0x56df05){while(--_0x56df05){_0xd6a7de['push'](_0xd6a7de['shift']());}};_0x164fec(++_0x1aa7b);}(_0xe11d,0xca));var _0xde11=function(_0x31e427,_0x5b21e3){_0x31e427=_0x31e427-0x0;var _0x4f69fe=_0xe11d[_0x31e427];return _0x4f69fe;};'use strict';var client=require(_0xde11('0x0'));exports[_0xde11('0x1')]=function(_0x2d257c){return client[_0xde11('0x2')](_0xde11('0x3'),{'body':_0x2d257c,'log':_0xde11('0x4')});}; \ No newline at end of file +var _0xab9b=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x45b131,_0x1bcbd2){var _0x54d307=function(_0x368cf5){while(--_0x368cf5){_0x45b131['push'](_0x45b131['shift']());}};_0x54d307(++_0x1bcbd2);}(_0xab9b,0xa3));var _0xbab9=function(_0xa69733,_0x2aa122){_0xa69733=_0xa69733-0x0;var _0xca5645=_0xab9b[_0xa69733];return _0xca5645;};'use strict';var client=require('../client');exports[_0xbab9('0x0')]=function(_0xd4d4a6){return client[_0xbab9('0x1')](_0xbab9('0x2'),{'body':_0xd4d4a6,'log':_0xbab9('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 3a9e758..6503e5a 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 _0x4148=['../client','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents','chatPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x4148[_0x5317b5];return _0x3b7ce2;};'use strict';var client=require(_0x8414('0x0'));exports[_0x8414('0x1')]=function(){return function(){return client[_0x8414('0x2')](_0x8414('0x3'),{'options':{'raw':![],'attributes':['id',_0x8414('0x4'),'timeout',_0x8414('0x5')],'include':[{'model':_0x8414('0x6'),'as':_0x8414('0x7'),'attributes':['id',_0x8414('0x4'),'online',_0x8414('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x61a5=['name','timeout','strategy','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x2069eb,_0x470658){var _0x2b05d0=function(_0x2ebe7b){while(--_0x2ebe7b){_0x2069eb['push'](_0x2069eb['shift']());}};_0x2b05d0(++_0x470658);}(_0x61a5,0xf0));var _0x561a=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0x61a5[_0x19efbc];return _0x205c5e;};'use strict';var client=require(_0x561a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x561a('0x1')](_0x561a('0x2'),{'options':{'raw':![],'attributes':['id',_0x561a('0x3'),_0x561a('0x4'),_0x561a('0x5')],'include':[{'model':'User','as':_0x561a('0x6'),'attributes':['id',_0x561a('0x3'),'online',_0x561a('0x7')]}]},'log':_0x561a('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index dda9cd5..664e3d6 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 _0x98e1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x3841fd,_0x20abfe){var _0x15308b=function(_0x10ebf0){while(--_0x10ebf0){_0x3841fd['push'](_0x3841fd['shift']());}};_0x15308b(++_0x20abfe);}(_0x98e1,0x160));var _0x198e=function(_0x3c4b99,_0x4750d5){_0x3c4b99=_0x3c4b99-0x0;var _0x4721d8=_0x98e1[_0x3c4b99];return _0x4721d8;};'use strict';var client=require('../client');exports[_0x198e('0x0')]=function(_0x417541){return client[_0x198e('0x1')](_0x198e('0x2'),{'body':_0x417541,'log':'CreateChatQueueReport'});};exports[_0x198e('0x3')]=function(_0x4e997a,_0x4a102f){return client[_0x198e('0x1')](_0x198e('0x4'),{'body':_0x4a102f,'options':{'where':{'uniqueid':_0x4e997a},'order':[['id',_0x198e('0x5')]],'limit':0x1},'log':_0x198e('0x4')});}; \ No newline at end of file +var _0xb18e=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x14d678,_0x559d1e){var _0x168fd8=function(_0x563a17){while(--_0x563a17){_0x14d678['push'](_0x14d678['shift']());}};_0x168fd8(++_0x559d1e);}(_0xb18e,0x181));var _0xeb18=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0xb18e[_0x25bca6];return _0x3f8d02;};'use strict';var client=require('../client');exports['create']=function(_0x1c3091){return client['Request'](_0xeb18('0x0'),{'body':_0x1c3091,'log':'CreateChatQueueReport'});};exports[_0xeb18('0x1')]=function(_0x1bf23e,_0x5d5ff9){return client[_0xeb18('0x2')](_0xeb18('0x3'),{'body':_0x5d5ff9,'options':{'where':{'uniqueid':_0x1bf23e},'order':[['id',_0xeb18('0x4')]],'limit':0x1},'log':_0xeb18('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index fa26c62..da0a79a 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(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x7a54,0x106));var _0x47a5=function(_0x260384,_0x1aa724){_0x260384=_0x260384-0x0;var _0xb47a4d=_0x7a54[_0x260384];return _0xb47a4d;};'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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x254fbe,_0x1a86ce){var _0x20d734=function(_0x274685){while(--_0x274685){_0x254fbe['push'](_0x254fbe['shift']());}};_0x20d734(++_0x1a86ce);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index c93bdd4..6cd6a37 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 _0xfe58=['Request','CreateFaxMessage','../client'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0xfe58,0x140));var _0x8fe5=function(_0x2a58e2,_0x508304){_0x2a58e2=_0x2a58e2-0x0;var _0xee2db3=_0xfe58[_0x2a58e2];return _0xee2db3;};'use strict';var client=require(_0x8fe5('0x0'));exports['create']=function(_0x377639){return client[_0x8fe5('0x1')](_0x8fe5('0x2'),{'body':_0x377639,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x5edb=['createFaxMessage','../client','CreateFaxMessage'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5edb,0x151));var _0xb5ed=function(_0x79d1fb,_0x23f969){_0x79d1fb=_0x79d1fb-0x0;var _0x28c61a=_0x5edb[_0x79d1fb];return _0x28c61a;};'use strict';var client=require(_0xb5ed('0x0'));exports['create']=function(_0x52922d){return client['Request'](_0xb5ed('0x1'),{'body':_0x52922d,'log':_0xb5ed('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 0ac9c56..0ac2d99 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 _0xd089=['strategy','User','Agents','name','online','../client','getFaxQueues','Request','GetFaxQueue','timeout'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xd089,0xff));var _0x9d08=function(_0x1f719a,_0x104cbe){_0x1f719a=_0x1f719a-0x0;var _0x2cb11d=_0xd089[_0x1f719a];return _0x2cb11d;};'use strict';var client=require(_0x9d08('0x0'));exports[_0x9d08('0x1')]=function(){return function(){return client[_0x9d08('0x2')](_0x9d08('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x9d08('0x4'),_0x9d08('0x5')],'include':[{'model':_0x9d08('0x6'),'as':_0x9d08('0x7'),'attributes':['id',_0x9d08('0x8'),_0x9d08('0x9'),'faxPause']}]},'log':_0x9d08('0x1')});};}; \ No newline at end of file +var _0xaffe=['timeout','User','Agents','online','getFaxQueues','../client','Request','GetFaxQueue','name'];(function(_0x50a0f8,_0x27c0fb){var _0x52e53d=function(_0x1c7590){while(--_0x1c7590){_0x50a0f8['push'](_0x50a0f8['shift']());}};_0x52e53d(++_0x27c0fb);}(_0xaffe,0x1d9));var _0xeaff=function(_0x10353c,_0x6e2053){_0x10353c=_0x10353c-0x0;var _0xfb1827=_0xaffe[_0x10353c];return _0xfb1827;};'use strict';var client=require(_0xeaff('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xeaff('0x1')](_0xeaff('0x2'),{'options':{'raw':![],'attributes':['id',_0xeaff('0x3'),_0xeaff('0x4'),'strategy'],'include':[{'model':_0xeaff('0x5'),'as':_0xeaff('0x6'),'attributes':['id','name',_0xeaff('0x7'),'faxPause']}]},'log':_0xeaff('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a9f601d..d6ed37a 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 _0x7e60=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x4d08f0,_0x3f05b5){var _0x40ed56=function(_0x43ef4d){while(--_0x43ef4d){_0x4d08f0['push'](_0x4d08f0['shift']());}};_0x40ed56(++_0x3f05b5);}(_0x7e60,0x179));var _0x07e6=function(_0x1fb075,_0x4b965e){_0x1fb075=_0x1fb075-0x0;var _0x183e1c=_0x7e60[_0x1fb075];return _0x183e1c;};'use strict';var client=require('../client');exports[_0x07e6('0x0')]=function(_0x2c0d95){return client[_0x07e6('0x1')](_0x07e6('0x2'),{'body':_0x2c0d95,'log':_0x07e6('0x2')});};exports[_0x07e6('0x3')]=function(_0x547eb0,_0x2e7e42){return client[_0x07e6('0x1')](_0x07e6('0x4'),{'body':_0x2e7e42,'options':{'where':{'uniqueid':_0x547eb0},'order':[['id',_0x07e6('0x5')]],'limit':0x1},'log':_0x07e6('0x4')});}; \ No newline at end of file +var _0x8164=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x9c0817,_0x50058d){var _0x396086=function(_0x45e7a6){while(--_0x45e7a6){_0x9c0817['push'](_0x9c0817['shift']());}};_0x396086(++_0x50058d);}(_0x8164,0xd4));var _0x4816=function(_0x16e5d1,_0x9cf085){_0x16e5d1=_0x16e5d1-0x0;var _0x3f72e6=_0x8164[_0x16e5d1];return _0x3f72e6;};'use strict';var client=require('../client');exports[_0x4816('0x0')]=function(_0x17d389){return client[_0x4816('0x1')](_0x4816('0x2'),{'body':_0x17d389,'log':_0x4816('0x2')});};exports[_0x4816('0x3')]=function(_0x26ef06,_0x33ee98){return client[_0x4816('0x1')]('UpdateFaxQueueReport',{'body':_0x33ee98,'options':{'where':{'uniqueid':_0x26ef06},'order':[['id',_0x4816('0x4')]],'limit':0x1},'log':_0x4816('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2521a5a..22af46b 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 _0x8ba8=['name','Interval','Intervals','interval','../client','getIntervals','Request','GetInterval'];(function(_0x2bd07f,_0xf64440){var _0x3125db=function(_0x490fff){while(--_0x490fff){_0x2bd07f['push'](_0x2bd07f['shift']());}};_0x3125db(++_0xf64440);}(_0x8ba8,0x94));var _0x88ba=function(_0x378f9e,_0x5c333a){_0x378f9e=_0x378f9e-0x0;var _0x39cf7a=_0x8ba8[_0x378f9e];return _0x39cf7a;};'use strict';var client=require(_0x88ba('0x0'));exports[_0x88ba('0x1')]=function(){return function(){return client[_0x88ba('0x2')](_0x88ba('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x88ba('0x4')],'include':[{'model':_0x88ba('0x5'),'as':_0x88ba('0x6'),'attributes':['id',_0x88ba('0x4'),_0x88ba('0x7')]}]},'log':_0x88ba('0x1')});};}; \ No newline at end of file +var _0xad61=['Intervals','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xad61,0x1a5));var _0x1ad6=function(_0x1675cb,_0x244872){_0x1675cb=_0x1675cb-0x0;var _0x164355=_0xad61[_0x1675cb];return _0x164355;};'use strict';var client=require(_0x1ad6('0x0'));exports[_0x1ad6('0x1')]=function(){return function(){return client[_0x1ad6('0x2')](_0x1ad6('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1ad6('0x4')],'include':[{'model':_0x1ad6('0x5'),'as':_0x1ad6('0x6'),'attributes':['id','name','interval']}]},'log':_0x1ad6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0fa6be0..3a83982 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 _0xdb28=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0xdb28,0x106));var _0x8db2=function(_0x239b38,_0x1ace3d){_0x239b38=_0x239b38-0x0;var _0xa5fab3=_0xdb28[_0x239b38];return _0xa5fab3;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(_0x1dc797,_0xf66e59){return client['Request'](_0x8db2('0x2'),{'body':_0xf66e59,'options':{'where':{'id':_0x1dc797}},'log':_0x8db2('0x3')});};exports[_0x8db2('0x4')]=function(_0x4426fe,_0x11109e){return client['Request'](_0x8db2('0x5'),{'body':_0x11109e,'options':{'where':{'id':_0x4426fe}},'log':_0x8db2('0x6')});}; \ No newline at end of file +var _0x1399=['UpdateMailInteraction','updateMailInteraction','addTags','Request','../client','update'];(function(_0xfc89d2,_0x269100){var _0x1c53a6=function(_0x507e97){while(--_0x507e97){_0xfc89d2['push'](_0xfc89d2['shift']());}};_0x1c53a6(++_0x269100);}(_0x1399,0x16c));var _0x9139=function(_0x5067c6,_0x3f1e9e){_0x5067c6=_0x5067c6-0x0;var _0xb5daa3=_0x1399[_0x5067c6];return _0xb5daa3;};'use strict';var client=require(_0x9139('0x0'));exports[_0x9139('0x1')]=function(_0x5740a9,_0x474911){return client['Request'](_0x9139('0x2'),{'body':_0x474911,'options':{'where':{'id':_0x5740a9}},'log':_0x9139('0x3')});};exports[_0x9139('0x4')]=function(_0x28f155,_0x251798){return client[_0x9139('0x5')]('AddTagsToMailInteraction',{'body':_0x251798,'options':{'where':{'id':_0x28f155}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 888402f..e3dff0b 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 _0xab48=['Request','CreateMailMessage','create'];(function(_0x4edac5,_0x41d853){var _0x572b3b=function(_0x1cc65f){while(--_0x1cc65f){_0x4edac5['push'](_0x4edac5['shift']());}};_0x572b3b(++_0x41d853);}(_0xab48,0x1a0));var _0x8ab4=function(_0x13023b,_0x51328e){_0x13023b=_0x13023b-0x0;var _0x458326=_0xab48[_0x13023b];return _0x458326;};'use strict';var client=require('../client');exports[_0x8ab4('0x0')]=function(_0xf98203){return client[_0x8ab4('0x1')](_0x8ab4('0x2'),{'body':_0xf98203,'log':'createMailMessage'});}; \ No newline at end of file +var _0x1ac9=['CreateMailMessage','../client','create'];(function(_0x5299fa,_0x221a20){var _0x22b904=function(_0x5a821f){while(--_0x5a821f){_0x5299fa['push'](_0x5299fa['shift']());}};_0x22b904(++_0x221a20);}(_0x1ac9,0x127));var _0x91ac=function(_0x505d7c,_0x20b160){_0x505d7c=_0x505d7c-0x0;var _0x566b61=_0x1ac9[_0x505d7c];return _0x566b61;};'use strict';var client=require(_0x91ac('0x0'));exports[_0x91ac('0x1')]=function(_0x4b82a7){return client['Request'](_0x91ac('0x2'),{'body':_0x4b82a7,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6a4e120..d8161f7 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 _0x75bc=['name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue'];(function(_0x3523cb,_0x511b5c){var _0x54efd9=function(_0x48ee79){while(--_0x48ee79){_0x3523cb['push'](_0x3523cb['shift']());}};_0x54efd9(++_0x511b5c);}(_0x75bc,0x10f));var _0xc75b=function(_0x5d2d12,_0x18218d){_0x5d2d12=_0x5d2d12-0x0;var _0x141163=_0x75bc[_0x5d2d12];return _0x141163;};'use strict';var client=require(_0xc75b('0x0'));exports[_0xc75b('0x1')]=function(){return function(){return client[_0xc75b('0x2')](_0xc75b('0x3'),{'options':{'raw':![],'attributes':['id',_0xc75b('0x4'),_0xc75b('0x5'),_0xc75b('0x6')],'include':[{'model':_0xc75b('0x7'),'as':_0xc75b('0x8'),'attributes':['id',_0xc75b('0x4'),_0xc75b('0x9'),_0xc75b('0xa')]}]},'log':_0xc75b('0x1')});};}; \ No newline at end of file +var _0xf5b1=['online','mailPause','../client','getMailQueues','Request','name','timeout','strategy','Agents'];(function(_0x1f4a0a,_0x2576ef){var _0x1b810a=function(_0xe52831){while(--_0xe52831){_0x1f4a0a['push'](_0x1f4a0a['shift']());}};_0x1b810a(++_0x2576ef);}(_0xf5b1,0xec));var _0x1f5b=function(_0x28334d,_0x2d4d81){_0x28334d=_0x28334d-0x0;var _0x553fa7=_0xf5b1[_0x28334d];return _0x553fa7;};'use strict';var client=require(_0x1f5b('0x0'));exports[_0x1f5b('0x1')]=function(){return function(){return client[_0x1f5b('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x1f5b('0x3'),_0x1f5b('0x4'),_0x1f5b('0x5')],'include':[{'model':'User','as':_0x1f5b('0x6'),'attributes':['id',_0x1f5b('0x3'),_0x1f5b('0x7'),_0x1f5b('0x8')]}]},'log':_0x1f5b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 9dd8678..4ae2019 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 _0x666d=['UpdateMailQueueReport','../client','create','Request','CreateMailQueueReport','update','DESC'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x666d,0xe8));var _0xd666=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x666d[_0x4e9d3c];return _0x2d0825;};'use strict';var client=require(_0xd666('0x0'));exports[_0xd666('0x1')]=function(_0x17413f){return client[_0xd666('0x2')](_0xd666('0x3'),{'body':_0x17413f,'log':_0xd666('0x3')});};exports[_0xd666('0x4')]=function(_0x4b0be3,_0x3ff241){return client[_0xd666('0x2')]('UpdateMailQueueReport',{'body':_0x3ff241,'options':{'where':{'uniqueid':_0x4b0be3},'order':[['id',_0xd666('0x5')]],'limit':0x1},'log':_0xd666('0x6')});}; \ No newline at end of file +var _0x2420=['update','Request','UpdateMailQueueReport','../client','create','CreateMailQueueReport'];(function(_0x16d31f,_0x2826ad){var _0x43a973=function(_0x32dba8){while(--_0x32dba8){_0x16d31f['push'](_0x16d31f['shift']());}};_0x43a973(++_0x2826ad);}(_0x2420,0x1e3));var _0x0242=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x2420[_0xc6be3a];return _0x56a310;};'use strict';var client=require(_0x0242('0x0'));exports[_0x0242('0x1')]=function(_0x4efa80){return client['Request']('CreateMailQueueReport',{'body':_0x4efa80,'log':_0x0242('0x2')});};exports[_0x0242('0x3')]=function(_0x35ffc2,_0x13fd6b){return client[_0x0242('0x4')]('UpdateMailQueueReport',{'body':_0x13fd6b,'options':{'where':{'uniqueid':_0x35ffc2},'order':[['id','DESC']],'limit':0x1},'log':_0x0242('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6340ab1..d3544c0 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 _0x78ec=['AddTagsToOpenchannelInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x256cc1,_0x568424){var _0x330d0a=function(_0x4c8cc1){while(--_0x4c8cc1){_0x256cc1['push'](_0x256cc1['shift']());}};_0x330d0a(++_0x568424);}(_0x78ec,0x115));var _0xc78e=function(_0x108637,_0x57cc96){_0x108637=_0x108637-0x0;var _0x38af76=_0x78ec[_0x108637];return _0x38af76;};'use strict';var client=require('../client');exports[_0xc78e('0x0')]=function(_0x1ab0dc,_0x501478){return client[_0xc78e('0x1')](_0xc78e('0x2'),{'body':_0x501478,'options':{'where':{'id':_0x1ab0dc}},'log':_0xc78e('0x3')});};exports[_0xc78e('0x4')]=function(_0x52b80c,_0x590af4){return client[_0xc78e('0x1')](_0xc78e('0x5'),{'body':_0x590af4,'options':{'where':{'id':_0x52b80c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xea94=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x5c518d,_0x6a850d){var _0x4db9c6=function(_0x2d8511){while(--_0x2d8511){_0x5c518d['push'](_0x5c518d['shift']());}};_0x4db9c6(++_0x6a850d);}(_0xea94,0x1d8));var _0x4ea9=function(_0x2a59af,_0x18d558){_0x2a59af=_0x2a59af-0x0;var _0x3af243=_0xea94[_0x2a59af];return _0x3af243;};'use strict';var client=require(_0x4ea9('0x0'));exports['update']=function(_0x148d91,_0x13a08d){return client[_0x4ea9('0x1')](_0x4ea9('0x2'),{'body':_0x13a08d,'options':{'where':{'id':_0x148d91}},'log':_0x4ea9('0x3')});};exports[_0x4ea9('0x4')]=function(_0x31c387,_0x25fee0){return client[_0x4ea9('0x1')](_0x4ea9('0x5'),{'body':_0x25fee0,'options':{'where':{'id':_0x31c387}},'log':_0x4ea9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index addbf50..5ec4ff4 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 _0xbe03=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x4ae837,_0x483f8c){var _0x233c02=function(_0x4ded36){while(--_0x4ded36){_0x4ae837['push'](_0x4ae837['shift']());}};_0x233c02(++_0x483f8c);}(_0xbe03,0x1cd));var _0x3be0=function(_0x15602c,_0x51f801){_0x15602c=_0x15602c-0x0;var _0x14a1a3=_0xbe03[_0x15602c];return _0x14a1a3;};'use strict';var client=require(_0x3be0('0x0'));exports[_0x3be0('0x1')]=function(_0x364f9d){return client[_0x3be0('0x2')](_0x3be0('0x3'),{'body':_0x364f9d,'log':_0x3be0('0x4')});}; \ No newline at end of file +var _0xd1b0=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xd1b0,0x1e5));var _0x0d1b=function(_0x5b1e98,_0x4eb170){_0x5b1e98=_0x5b1e98-0x0;var _0xd0b874=_0xd1b0[_0x5b1e98];return _0xd0b874;};'use strict';var client=require(_0x0d1b('0x0'));exports[_0x0d1b('0x1')]=function(_0x42fc4b){return client[_0x0d1b('0x2')](_0x0d1b('0x3'),{'body':_0x42fc4b,'log':_0x0d1b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index cd66104..1710874 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 _0x9ead=['openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x4f9ac5,_0xc36855){var _0x431dae=function(_0x53748c){while(--_0x53748c){_0x4f9ac5['push'](_0x4f9ac5['shift']());}};_0x431dae(++_0xc36855);}(_0x9ead,0x191));var _0xd9ea=function(_0x546ac5,_0x59e59b){_0x546ac5=_0x546ac5-0x0;var _0x56a6d8=_0x9ead[_0x546ac5];return _0x56a6d8;};'use strict';var client=require(_0xd9ea('0x0'));exports[_0xd9ea('0x1')]=function(){return function(){return client['Request'](_0xd9ea('0x2'),{'options':{'raw':![],'attributes':['id',_0xd9ea('0x3'),_0xd9ea('0x4'),_0xd9ea('0x5')],'include':[{'model':_0xd9ea('0x6'),'as':_0xd9ea('0x7'),'attributes':['id',_0xd9ea('0x3'),_0xd9ea('0x8'),_0xd9ea('0x9')]}]},'log':_0xd9ea('0x1')});};}; \ No newline at end of file +var _0x26bc=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','online','openchannelPause'];(function(_0x2d7116,_0x37bee1){var _0x522d5a=function(_0x34cba3){while(--_0x34cba3){_0x2d7116['push'](_0x2d7116['shift']());}};_0x522d5a(++_0x37bee1);}(_0x26bc,0x111));var _0xc26b=function(_0x1a6149,_0x134b23){_0x1a6149=_0x1a6149-0x0;var _0x1e0389=_0x26bc[_0x1a6149];return _0x1e0389;};'use strict';var client=require('../client');exports[_0xc26b('0x0')]=function(){return function(){return client[_0xc26b('0x1')](_0xc26b('0x2'),{'options':{'raw':![],'attributes':['id',_0xc26b('0x3'),'timeout',_0xc26b('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xc26b('0x5'),_0xc26b('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1ac5bde..f153c8d 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 _0x4d30=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x3f4ae1,_0xa00242){var _0x204d9a=function(_0x47a323){while(--_0x47a323){_0x3f4ae1['push'](_0x3f4ae1['shift']());}};_0x204d9a(++_0xa00242);}(_0x4d30,0x1da));var _0x04d3=function(_0x5dffa2,_0x3fac81){_0x5dffa2=_0x5dffa2-0x0;var _0x1a3105=_0x4d30[_0x5dffa2];return _0x1a3105;};'use strict';var client=require(_0x04d3('0x0'));exports[_0x04d3('0x1')]=function(_0x358ef5){return client[_0x04d3('0x2')]('CreateOpenchannelQueueReport',{'body':_0x358ef5,'log':_0x04d3('0x3')});};exports[_0x04d3('0x4')]=function(_0x10bef3,_0x2bb7ca){return client['Request'](_0x04d3('0x5'),{'body':_0x2bb7ca,'options':{'where':{'uniqueid':_0x10bef3},'order':[['id',_0x04d3('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x6e4f=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create','Request'];(function(_0x15bc7f,_0x2abb48){var _0x49a97c=function(_0x505893){while(--_0x505893){_0x15bc7f['push'](_0x15bc7f['shift']());}};_0x49a97c(++_0x2abb48);}(_0x6e4f,0x1e8));var _0xf6e4=function(_0x2f7616,_0x463557){_0x2f7616=_0x2f7616-0x0;var _0x271e52=_0x6e4f[_0x2f7616];return _0x271e52;};'use strict';var client=require('../client');exports[_0xf6e4('0x0')]=function(_0x2c5a47){return client[_0xf6e4('0x1')]('CreateOpenchannelQueueReport',{'body':_0x2c5a47,'log':_0xf6e4('0x2')});};exports[_0xf6e4('0x3')]=function(_0x3ffc46,_0x597a3b){return client[_0xf6e4('0x1')](_0xf6e4('0x4'),{'body':_0x597a3b,'options':{'where':{'uniqueid':_0x3ffc46},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1147f2e..f1f5925 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 _0xd493=['addTagsToSmsInteraction','../client','UpdateSmsInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd493,0x1bd));var _0x3d49=function(_0x27c365,_0x11fbc0){_0x27c365=_0x27c365-0x0;var _0x5de0e6=_0xd493[_0x27c365];return _0x5de0e6;};'use strict';var client=require(_0x3d49('0x0'));exports['update']=function(_0x1391ea,_0x14193e){return client['Request'](_0x3d49('0x1'),{'body':_0x14193e,'options':{'where':{'id':_0x1391ea}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x439989,_0xab52eb){return client['Request']('AddTagsToSmsInteraction',{'body':_0xab52eb,'options':{'where':{'id':_0x439989}},'log':_0x3d49('0x2')});}; \ No newline at end of file +var _0x39d9=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update'];(function(_0x403314,_0x1be11f){var _0x1ae1c4=function(_0x334ba0){while(--_0x334ba0){_0x403314['push'](_0x403314['shift']());}};_0x1ae1c4(++_0x1be11f);}(_0x39d9,0x17f));var _0x939d=function(_0xf1772d,_0x1e628c){_0xf1772d=_0xf1772d-0x0;var _0xcaab31=_0x39d9[_0xf1772d];return _0xcaab31;};'use strict';var client=require(_0x939d('0x0'));exports[_0x939d('0x1')]=function(_0x3c101d,_0x379f1c){return client[_0x939d('0x2')](_0x939d('0x3'),{'body':_0x379f1c,'options':{'where':{'id':_0x3c101d}},'log':_0x939d('0x4')});};exports[_0x939d('0x5')]=function(_0x57ab6c,_0x2a9e29){return client[_0x939d('0x2')](_0x939d('0x6'),{'body':_0x2a9e29,'options':{'where':{'id':_0x57ab6c}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index eca5330..2928a5e 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 _0xc631=['CreateSmsMessage','../client','create'];(function(_0x30b034,_0x5157a4){var _0x5125f1=function(_0x503f4b){while(--_0x503f4b){_0x30b034['push'](_0x30b034['shift']());}};_0x5125f1(++_0x5157a4);}(_0xc631,0xcd));var _0x1c63=function(_0x344e78,_0x191587){_0x344e78=_0x344e78-0x0;var _0x13d253=_0xc631[_0x344e78];return _0x13d253;};'use strict';var client=require(_0x1c63('0x0'));exports[_0x1c63('0x1')]=function(_0x1450d8){return client['Request'](_0x1c63('0x2'),{'body':_0x1450d8,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x63a4=['Request','../client','create'];(function(_0x62e59c,_0x448801){var _0x4f3458=function(_0x3baacb){while(--_0x3baacb){_0x62e59c['push'](_0x62e59c['shift']());}};_0x4f3458(++_0x448801);}(_0x63a4,0xfa));var _0x463a=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x63a4[_0x2706da];return _0x3ba87e;};'use strict';var client=require(_0x463a('0x0'));exports[_0x463a('0x1')]=function(_0x4e80ed){return client[_0x463a('0x2')]('CreateSmsMessage',{'body':_0x4e80ed,'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 0d07add..866504d 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x4fd5ba,_0x18d77a){var _0x30729c=function(_0x281b65){while(--_0x281b65){_0x4fd5ba['push'](_0x4fd5ba['shift']());}};_0x30729c(++_0x18d77a);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x19f82b,_0x16f567){var _0x2569fc=function(_0x460d06){while(--_0x460d06){_0x19f82b['push'](_0x19f82b['shift']());}};_0x2569fc(++_0x16f567);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f555e4f..4e2255d 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x11c3fc,_0x5729d6){var _0x18e29e=function(_0x3fa23b){while(--_0x3fa23b){_0x11c3fc['push'](_0x11c3fc['shift']());}};_0x18e29e(++_0x5729d6);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0x008c,0x188));var _0xc008=function(_0x1dfa55,_0x1d2007){_0x1dfa55=_0x1dfa55-0x0;var _0x893d0e=_0x008c[_0x1dfa55];return _0x893d0e;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 39e5aef..aa1212b 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(_0x162a68,_0x21183d){var _0x4b3efc=function(_0x53891a){while(--_0x53891a){_0x162a68['push'](_0x162a68['shift']());}};_0x4b3efc(++_0x21183d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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(_0x3895ff,_0x2c4e08){var _0x2b9f4a=function(_0x41b81a){while(--_0x41b81a){_0x3895ff['push'](_0x3895ff['shift']());}};_0x2b9f4a(++_0x2c4e08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 95afd04..5c306e1 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 _0xb96d=['addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0xc4c0b4,_0x4539d3){var _0x5bd05c=function(_0x544f68){while(--_0x544f68){_0xc4c0b4['push'](_0xc4c0b4['shift']());}};_0x5bd05c(++_0x4539d3);}(_0xb96d,0x9e));var _0xdb96=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0xb96d[_0x5e36d1];return _0x950b9e;};'use strict';var client=require('../client');exports[_0xdb96('0x0')]=function(_0x1f7a32,_0x36f0ce){return client['Request'](_0xdb96('0x1'),{'body':_0x36f0ce,'options':{'where':{'id':_0x1f7a32}},'log':_0xdb96('0x2')});};exports[_0xdb96('0x3')]=function(_0x488b02,_0x4af3cf){return client[_0xdb96('0x4')](_0xdb96('0x5'),{'body':_0x4af3cf,'options':{'where':{'id':_0x488b02}},'log':_0xdb96('0x6')});}; \ No newline at end of file +var _0x14f5=['update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1a473a,_0x3f9c94){var _0x21bee3=function(_0x3eeee0){while(--_0x3eeee0){_0x1a473a['push'](_0x1a473a['shift']());}};_0x21bee3(++_0x3f9c94);}(_0x14f5,0xae));var _0x514f=function(_0x556f7c,_0x50a7d2){_0x556f7c=_0x556f7c-0x0;var _0x43cd64=_0x14f5[_0x556f7c];return _0x43cd64;};'use strict';var client=require('../client');exports[_0x514f('0x0')]=function(_0x4d09b3,_0x2ca71e){return client[_0x514f('0x1')](_0x514f('0x2'),{'body':_0x2ca71e,'options':{'where':{'id':_0x4d09b3}},'log':'updateWhatsappInteraction'});};exports[_0x514f('0x3')]=function(_0x2443e8,_0x483c2a){return client[_0x514f('0x1')](_0x514f('0x4'),{'body':_0x483c2a,'options':{'where':{'id':_0x2443e8}},'log':_0x514f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2dabd2d..7782e0c 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 _0xd085=['../client','create','Request','createWhatsappMessage'];(function(_0x56b8fd,_0x2f3a2e){var _0x53e0c3=function(_0x133535){while(--_0x133535){_0x56b8fd['push'](_0x56b8fd['shift']());}};_0x53e0c3(++_0x2f3a2e);}(_0xd085,0x1e4));var _0x5d08=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0xd085[_0x48961c];return _0x1d895d;};'use strict';var client=require(_0x5d08('0x0'));exports[_0x5d08('0x1')]=function(_0x404743){return client[_0x5d08('0x2')]('CreateWhatsappMessage',{'body':_0x404743,'log':_0x5d08('0x3')});}; \ No newline at end of file +var _0x138c=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x54547b,_0x22f8ad){var _0x287ece=function(_0x259cf4){while(--_0x259cf4){_0x54547b['push'](_0x54547b['shift']());}};_0x287ece(++_0x22f8ad);}(_0x138c,0xaf));var _0xc138=function(_0x4a256a,_0xc6ff4){_0x4a256a=_0x4a256a-0x0;var _0x3cb6be=_0x138c[_0x4a256a];return _0x3cb6be;};'use strict';var client=require(_0xc138('0x0'));exports[_0xc138('0x1')]=function(_0x163baa){return client[_0xc138('0x2')](_0xc138('0x3'),{'body':_0x163baa,'log':_0xc138('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 57ee160..d9e4d6d 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 _0x0122=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','Agents','online','whatsappPause','../client'];(function(_0x34d40c,_0x5f366f){var _0x292835=function(_0x223ea5){while(--_0x223ea5){_0x34d40c['push'](_0x34d40c['shift']());}};_0x292835(++_0x5f366f);}(_0x0122,0xb3));var _0x2012=function(_0x55ff03,_0x5a9ba8){_0x55ff03=_0x55ff03-0x0;var _0x555d2e=_0x0122[_0x55ff03];return _0x555d2e;};'use strict';var client=require(_0x2012('0x0'));exports[_0x2012('0x1')]=function(){return function(){return client[_0x2012('0x2')](_0x2012('0x3'),{'options':{'raw':![],'attributes':['id',_0x2012('0x4'),_0x2012('0x5'),'strategy'],'include':[{'model':'User','as':_0x2012('0x6'),'attributes':['id','name',_0x2012('0x7'),_0x2012('0x8')]}]},'log':_0x2012('0x1')});};}; \ No newline at end of file +var _0x0ca4=['../client','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x21d532,_0x4552a4){var _0x37bda1=function(_0x134a6f){while(--_0x134a6f){_0x21d532['push'](_0x21d532['shift']());}};_0x37bda1(++_0x4552a4);}(_0x0ca4,0xa8));var _0x40ca=function(_0x2f34bb,_0x3a0783){_0x2f34bb=_0x2f34bb-0x0;var _0x22be34=_0x0ca4[_0x2f34bb];return _0x22be34;};'use strict';var client=require(_0x40ca('0x0'));exports[_0x40ca('0x1')]=function(){return function(){return client['Request'](_0x40ca('0x2'),{'options':{'raw':![],'attributes':['id',_0x40ca('0x3'),_0x40ca('0x4'),_0x40ca('0x5')],'include':[{'model':_0x40ca('0x6'),'as':_0x40ca('0x7'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x40ca('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 94dba1d..825984a 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 _0x4cb2=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cb2,0x125));var _0x24cb=function(_0x587b77,_0x100396){_0x587b77=_0x587b77-0x0;var _0x39c72d=_0x4cb2[_0x587b77];return _0x39c72d;};'use strict';var client=require(_0x24cb('0x0'));exports[_0x24cb('0x1')]=function(_0x59ac62){return client[_0x24cb('0x2')](_0x24cb('0x3'),{'body':_0x59ac62,'log':_0x24cb('0x3')});};exports['update']=function(_0x139c43,_0x5ea0bd){return client[_0x24cb('0x2')](_0x24cb('0x4'),{'body':_0x5ea0bd,'options':{'where':{'uniqueid':_0x139c43},'order':[['id',_0x24cb('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x06ab=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x1c8c39,_0x244969){var _0x18d8c3=function(_0x375743){while(--_0x375743){_0x1c8c39['push'](_0x1c8c39['shift']());}};_0x18d8c3(++_0x244969);}(_0x06ab,0x1cd));var _0xb06a=function(_0x2b034f,_0x647435){_0x2b034f=_0x2b034f-0x0;var _0x598f55=_0x06ab[_0x2b034f];return _0x598f55;};'use strict';var client=require(_0xb06a('0x0'));exports[_0xb06a('0x1')]=function(_0x2f2eb8){return client[_0xb06a('0x2')](_0xb06a('0x3'),{'body':_0x2f2eb8,'log':'CreateWhatsappQueueReport'});};exports[_0xb06a('0x4')]=function(_0x1b41ce,_0x63c763){return client[_0xb06a('0x2')](_0xb06a('0x5'),{'body':_0x63c763,'options':{'where':{'uniqueid':_0x1b41ce},'order':[['id',_0xb06a('0x6')]],'limit':0x1},'log':_0xb06a('0x5')});}; \ 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 ed3f8b2..eb10e66 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 _0xbf4d=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','map','message','join','find','agents','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','error','log','[%s][QUEUE]\x20%s','stack','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x48f8d5,_0x34f897){var _0x47f9e5=function(_0x1b417f){while(--_0x1b417f){_0x48f8d5['push'](_0x48f8d5['shift']());}};_0x47f9e5(++_0x34f897);}(_0xbf4d,0xd3));var _0xdbf4=function(_0x458709,_0x1981ea){_0x458709=_0x458709-0x0;var _0x48cbd7=_0xbf4d[_0x458709];return _0x48cbd7;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require(_0xdbf4('0x0'));var logger=require(_0xdbf4('0x1'))(_0xdbf4('0x2'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0xdbf4('0x3')},'timeout':{'type':_0xdbf4('0x4'),'message':_0xdbf4('0x5')}});function writeLog(_0x2f1057,_0x1e463d,_0xc9c53e){return logger['info'](util[_0xdbf4('0x6')](_0xdbf4('0x7'),_0x2f1057,_0x1e463d[_0xdbf4('0x8')],_0xc9c53e));}function handleFindAgent(_0x5b61a4){return function(_0x5e8837){return _0x5e8837[_0xdbf4('0x8')][_0xdbf4('0x9')]()===_0x5b61a4[_0xdbf4('0x9')]();};}exports[_0xdbf4('0xa')]=function(_0x2b9ee3,_0xa57b54,_0x416306,_0x3f5c22){return function(_0x94d85e){try{var _0x314231={'name':_0xa57b54[0x0],'timeout':_0xa57b54[0x1]};var _0x3fc061=queue[_0xdbf4('0xb')](_0x314231,{'typecast':!![]});if(_0x3fc061['length']){logger['error']('[%s][AGENT]\x20%s',_0x2b9ee3,_[_0xdbf4('0xc')](_0x3fc061,_0xdbf4('0xd'))[_0xdbf4('0xe')](',\x20'));_0x94d85e['stop']();}else{var _0x52aa94=_[_0xdbf4('0xf')](_0x416306[_0xdbf4('0x10')],handleFindAgent(_0x314231['name']));if(_0x52aa94){var _0x270554=(_0x314231['timeout']||0xa)*0x3e8;var _0x5911c5,_0x10adbe;var _0x31073d=seqqueue['createQueue'](_0x270554);_0x31073d['id']=_0x2b9ee3;_0x31073d[_0xdbf4('0x11')]=_0x270554;_0x31073d[_0xdbf4('0x12')]=_0x3f5c22['channel'];writeLog(_0x2b9ee3,_0x52aa94,util['format'](_0xdbf4('0x13'),_0x270554));_0x416306[_0xdbf4('0x14')][_0x2b9ee3]['on'](_0xdbf4('0x15'),function(){logger[_0xdbf4('0x16')](_0xdbf4('0x17'),_0x2b9ee3);clearTimeout(_0x10adbe);_0x10adbe=undefined;_0x31073d['close']();if(_0x416306['rules'][_0x2b9ee3]){delete _0x416306[_0xdbf4('0x14')][_0x2b9ee3];}_0x94d85e[_0xdbf4('0x18')]();});_0x416306[_0xdbf4('0x14')][_0x2b9ee3]['on'](_0xdbf4('0x19'),function(){if(_0x416306[_0xdbf4('0x14')][_0x2b9ee3]){delete _0x416306['rules'][_0x2b9ee3];}});_0x10adbe=setTimeout(function(){logger[_0xdbf4('0x16')](_0xdbf4('0x1a'),_0x2b9ee3);clearTimeout(_0x10adbe);_0x31073d['close']();_0x94d85e['next']();},_0x270554);strategy['agent'](_0x31073d,_0x52aa94,_0x416306,_0x3f5c22);}else{logger[_0xdbf4('0x1b')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x2b9ee3,_0x314231['name']);_0x94d85e[_0xdbf4('0x18')]();}}}catch(_0x543587){console[_0xdbf4('0x1c')](_0x543587);logger['error'](_0xdbf4('0x1d'),_0x2b9ee3,_0x543587[_0xdbf4('0x1e')]);_0x94d85e[_0xdbf4('0x18')]();}};}; \ No newline at end of file +var _0xf368=['name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','join','stop','find','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','log','[%s][QUEUE]\x20%s','validate','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf368,0x175));var _0x8f36=function(_0x9fe978,_0x45dc9a){_0x9fe978=_0x9fe978-0x0;var _0x1143e7=_0xf368[_0x9fe978];return _0x1143e7;};'use strict';var schema=require(_0x8f36('0x0'));var _=require('lodash');var util=require(_0x8f36('0x1'));var seqqueue=require(_0x8f36('0x2'));var logger=require(_0x8f36('0x3'))(_0x8f36('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x8f36('0x5'),'required':!![],'message':_0x8f36('0x6')},'timeout':{'type':_0x8f36('0x7'),'message':_0x8f36('0x8')}});function writeLog(_0x56cfef,_0x5dbe30,_0x41c8ac){return logger[_0x8f36('0x9')](util[_0x8f36('0xa')](_0x8f36('0xb'),_0x56cfef,_0x5dbe30['name'],_0x41c8ac));}function handleFindAgent(_0x279a6b){return function(_0x24e520){return _0x24e520[_0x8f36('0xc')][_0x8f36('0xd')]()===_0x279a6b[_0x8f36('0xd')]();};}exports[_0x8f36('0xe')]=function(_0xb94b1f,_0x2b7ee2,_0x51fae6,_0x9d2083){return function(_0x2a0713){try{var _0x11cf36={'name':_0x2b7ee2[0x0],'timeout':_0x2b7ee2[0x1]};var _0x908280=queue[_0x8f36('0x0')](_0x11cf36,{'typecast':!![]});if(_0x908280['length']){logger[_0x8f36('0xf')](_0x8f36('0x10'),_0xb94b1f,_[_0x8f36('0x11')](_0x908280,'message')[_0x8f36('0x12')](',\x20'));_0x2a0713[_0x8f36('0x13')]();}else{var _0x171e14=_[_0x8f36('0x14')](_0x51fae6['agents'],handleFindAgent(_0x11cf36[_0x8f36('0xc')]));if(_0x171e14){var _0x3e268d=(_0x11cf36[_0x8f36('0x15')]||0xa)*0x3e8;var _0x478777,_0x1eedeb;var _0xdf4aa8=seqqueue['createQueue'](_0x3e268d);_0xdf4aa8['id']=_0xb94b1f;_0xdf4aa8[_0x8f36('0x16')]=_0x3e268d;_0xdf4aa8[_0x8f36('0x17')]=_0x9d2083[_0x8f36('0x17')];writeLog(_0xb94b1f,_0x171e14,util[_0x8f36('0xa')](_0x8f36('0x18'),_0x3e268d));_0x51fae6[_0x8f36('0x19')][_0xb94b1f]['on'](_0x8f36('0x1a'),function(){logger[_0x8f36('0x9')](_0x8f36('0x1b'),_0xb94b1f);clearTimeout(_0x1eedeb);_0x1eedeb=undefined;_0xdf4aa8['close']();if(_0x51fae6['rules'][_0xb94b1f]){delete _0x51fae6[_0x8f36('0x19')][_0xb94b1f];}_0x2a0713[_0x8f36('0x13')]();});_0x51fae6[_0x8f36('0x19')][_0xb94b1f]['on'](_0x8f36('0x1c'),function(){if(_0x51fae6[_0x8f36('0x19')][_0xb94b1f]){delete _0x51fae6[_0x8f36('0x19')][_0xb94b1f];}});_0x1eedeb=setTimeout(function(){logger[_0x8f36('0x9')](_0x8f36('0x1d'),_0xb94b1f);clearTimeout(_0x1eedeb);_0xdf4aa8[_0x8f36('0x1e')]();_0x2a0713[_0x8f36('0x1f')]();},_0x3e268d);strategy[_0x8f36('0x20')](_0xdf4aa8,_0x171e14,_0x51fae6,_0x9d2083);}else{logger[_0x8f36('0xf')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xb94b1f,_0x11cf36[_0x8f36('0xc')]);_0x2a0713['stop']();}}}catch(_0x55144e){console[_0x8f36('0x21')](_0x55144e);logger['error'](_0x8f36('0x22'),_0xb94b1f,_0x55144e['stack']);_0x2a0713[_0x8f36('0x13')]();}};}; \ 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 feccd77..15234ed 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 _0xfc17=['lodash','./utils','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','body','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','postText','providerName','amazonlex','dialogState','Failed'];(function(_0x2ff557,_0x5654c3){var _0x28bfb7=function(_0x4b254d){while(--_0x4b254d){_0x2ff557['push'](_0x2ff557['shift']());}};_0x28bfb7(++_0x5654c3);}(_0xfc17,0xb0));var _0x7fc1=function(_0x21873c,_0x22b173){_0x21873c=_0x21873c-0x0;var _0x2f1d74=_0xfc17[_0x21873c];return _0x2f1d74;};'use strict';var _=require(_0x7fc1('0x0'));var moment=require('moment');var AWS=require('aws-sdk');var utils=require(_0x7fc1('0x1'));var logger=require('../../../../config/logger')(_0x7fc1('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7fc1('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7fc1('0x4')),'faxMessage':require(_0x7fc1('0x5')),'whatsappMessage':require(_0x7fc1('0x6'))};exports[_0x7fc1('0x7')]=function(_0x316534,_0x4d5bfe){return function(_0x52daa6){try{if(!_[_0x7fc1('0x8')](this[_0x7fc1('0x9')][_0x7fc1('0xa')])){logger[_0x7fc1('0xb')]('[%s][AMAZONLEX]\x20%s',_0x316534,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x52daa6[_0x7fc1('0xc')]();}var _0x5daee8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7fc1('0xd')](_0x7fc1('0xe')),'direction':_0x7fc1('0xf')};if(this[_0x7fc1('0x10')]==='sms'||this[_0x7fc1('0x10')]==='whatsapp'){_0x5daee8[_0x7fc1('0x11')]=this['interaction']['phone'];}var _0x160a8a=this['channel'];if(_0x160a8a==='chat'){_0x5daee8[_0x7fc1('0x12')]=this[_0x7fc1('0x13')]['id'];}else{_0x5daee8[_['upperFirst'](_0x160a8a)+_0x7fc1('0x14')]=this[_0x7fc1('0x13')]['id'];}_0x5daee8[_[_0x7fc1('0x15')](_0x160a8a)+_0x7fc1('0x16')]=this[_0x7fc1('0x9')]['id'];if(this['interaction'][_0x7fc1('0x17')]){var _0x3b96e5=_0x4d5bfe[0x4];if(!_['isEmpty'](_0x3b96e5)){_0x5daee8['body']=utils[_0x7fc1('0x18')](_0x3b96e5,this);return rpc[_0x160a8a+_0x7fc1('0x19')][_0x7fc1('0x1a')](_0x5daee8)[_0x7fc1('0x1b')](function(_0x2af3b6){logger[_0x7fc1('0xb')](_0x7fc1('0x1c'),_0x316534,_0x5daee8[_0x7fc1('0x1d')]);})[_0x7fc1('0x1e')](function(_0x9ca7ee){logger[_0x7fc1('0x1f')](_0x7fc1('0x1c'),_0x316534,JSON[_0x7fc1('0x20')](_0x9ca7ee));})[_0x7fc1('0x21')](function(){logger[_0x7fc1('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x316534);_0x52daa6[_0x7fc1('0x22')]();});}else{logger[_0x7fc1('0xb')](_0x7fc1('0x23'),_0x316534);_0x52daa6[_0x7fc1('0x22')]();}}else{var _0x5b4836=this;var _0x558f2b=new AWS[(_0x7fc1('0x24'))]({'accessKeyId':_0x4d5bfe[0x0],'secretAccessKey':_0x4d5bfe[0x1],'region':_0x4d5bfe[0x2]});var _0x17509c={'botAlias':'$LATEST','botName':_0x4d5bfe[0x3],'inputText':this[_0x7fc1('0x25')]['body'],'userId':this[_0x7fc1('0x10')]+':'+this[_0x7fc1('0x9')]['id'][_0x7fc1('0x26')]()};_0x558f2b[_0x7fc1('0x27')](_0x17509c,function(_0x1afd05,_0xe1534d){if(_0x1afd05){logger['error'](_0x7fc1('0x1c'),_0x316534,_0x1afd05['message']);_0x52daa6[_0x7fc1('0xc')]();}else if(_0xe1534d&&_0xe1534d['message']){_0x5b4836[_0x7fc1('0x1d')]['amazonlex']=_0xe1534d;_0x5daee8[_0x7fc1('0x1d')]=_0xe1534d[_0x7fc1('0x25')];_0x5daee8[_0x7fc1('0x28')]=_0x7fc1('0x29');_0x5daee8['providerResponse']=JSON['stringify'](_0xe1534d);return rpc[_0x160a8a+'Message'][_0x7fc1('0x1a')](_0x5daee8)[_0x7fc1('0x1b')](function(_0x3a2f23){logger[_0x7fc1('0xb')](_0x7fc1('0x1c'),_0x316534,_0x5daee8['body']);if(_0xe1534d[_0x7fc1('0x2a')]==_0x7fc1('0x2b')){_0x52daa6['next']();}else{_0x52daa6[_0x7fc1('0x22')]();}})['catch'](function(_0x23a599){logger[_0x7fc1('0x1f')](_0x7fc1('0x1c'),_0x316534,JSON['stringify'](_0x23a599));_0x52daa6['next']();});}else{_0x52daa6[_0x7fc1('0xc')]();}});}}catch(_0x18904d){logger[_0x7fc1('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x316534,JSON[_0x7fc1('0x20')](_0x18904d));_0x52daa6[_0x7fc1('0x22')]();}};}; \ No newline at end of file +var _0x0b9d=['lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','then','body','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','error','providerName','amazonlex','providerResponse','Message','create','catch'];(function(_0xc76647,_0x262294){var _0x81490d=function(_0x5788f0){while(--_0x5788f0){_0xc76647['push'](_0xc76647['shift']());}};_0x81490d(++_0x262294);}(_0x0b9d,0x1a7));var _0xd0b9=function(_0x54c7ec,_0x4dcacc){_0x54c7ec=_0x54c7ec-0x0;var _0x4ac41e=_0x0b9d[_0x54c7ec];return _0x4ac41e;};'use strict';var _=require(_0xd0b9('0x0'));var moment=require(_0xd0b9('0x1'));var AWS=require(_0xd0b9('0x2'));var utils=require(_0xd0b9('0x3'));var logger=require('../../../../config/logger')(_0xd0b9('0x4'));var rpc={'chatMessage':require(_0xd0b9('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd0b9('0x6')),'faxMessage':require(_0xd0b9('0x7')),'whatsappMessage':require(_0xd0b9('0x8'))};exports['consequence']=function(_0x27a22,_0x534390){return function(_0x464d9b){try{if(!_[_0xd0b9('0x9')](this[_0xd0b9('0xa')][_0xd0b9('0xb')])){logger[_0xd0b9('0xc')](_0xd0b9('0xd'),_0x27a22,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x464d9b[_0xd0b9('0xe')]();}var _0x39647e={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd0b9('0xf')](_0xd0b9('0x10')),'direction':_0xd0b9('0x11')};if(this[_0xd0b9('0x12')]===_0xd0b9('0x13')||this[_0xd0b9('0x12')]===_0xd0b9('0x14')){_0x39647e['phone']=this[_0xd0b9('0xa')][_0xd0b9('0x15')];}var _0x24836e=this[_0xd0b9('0x12')];if(_0x24836e===_0xd0b9('0x16')){_0x39647e[_0xd0b9('0x17')]=this[_0xd0b9('0x18')]['id'];}else{_0x39647e[_[_0xd0b9('0x19')](_0x24836e)+_0xd0b9('0x1a')]=this['account']['id'];}_0x39647e[_[_0xd0b9('0x19')](_0x24836e)+'InteractionId']=this[_0xd0b9('0xa')]['id'];if(this[_0xd0b9('0xa')][_0xd0b9('0x1b')]){var _0x4d6140=_0x534390[0x4];if(!_[_0xd0b9('0x1c')](_0x4d6140)){_0x39647e['body']=utils[_0xd0b9('0x1d')](_0x4d6140,this);return rpc[_0x24836e+'Message']['create'](_0x39647e)[_0xd0b9('0x1e')](function(_0xddcc7d){logger[_0xd0b9('0xc')](_0xd0b9('0xd'),_0x27a22,_0x39647e[_0xd0b9('0x1f')]);})['catch'](function(_0x4782f4){logger['error'](_0xd0b9('0xd'),_0x27a22,JSON[_0xd0b9('0x20')](_0x4782f4));})[_0xd0b9('0x21')](function(){logger[_0xd0b9('0xc')](_0xd0b9('0x22'),_0x27a22);_0x464d9b[_0xd0b9('0x23')]();});}else{logger[_0xd0b9('0xc')](_0xd0b9('0x24'),_0x27a22);_0x464d9b[_0xd0b9('0x23')]();}}else{var _0x1d8e09=this;var _0x2813ee=new AWS[(_0xd0b9('0x25'))]({'accessKeyId':_0x534390[0x0],'secretAccessKey':_0x534390[0x1],'region':_0x534390[0x2]});var _0x39b98d={'botAlias':'$LATEST','botName':_0x534390[0x3],'inputText':this[_0xd0b9('0x26')]['body'],'userId':this[_0xd0b9('0x12')]+':'+this[_0xd0b9('0xa')]['id'][_0xd0b9('0x27')]()};_0x2813ee['postText'](_0x39b98d,function(_0x54ebf7,_0x4a185b){if(_0x54ebf7){logger[_0xd0b9('0x28')]('[%s][AMAZONLEX]\x20%s',_0x27a22,_0x54ebf7[_0xd0b9('0x26')]);_0x464d9b[_0xd0b9('0xe')]();}else if(_0x4a185b&&_0x4a185b[_0xd0b9('0x26')]){_0x1d8e09['body']['amazonlex']=_0x4a185b;_0x39647e[_0xd0b9('0x1f')]=_0x4a185b[_0xd0b9('0x26')];_0x39647e[_0xd0b9('0x29')]=_0xd0b9('0x2a');_0x39647e[_0xd0b9('0x2b')]=JSON[_0xd0b9('0x20')](_0x4a185b);return rpc[_0x24836e+_0xd0b9('0x2c')][_0xd0b9('0x2d')](_0x39647e)['then'](function(_0x583328){logger['info']('[%s][AMAZONLEX]\x20%s',_0x27a22,_0x39647e[_0xd0b9('0x1f')]);if(_0x4a185b['dialogState']=='Failed'){_0x464d9b['next']();}else{_0x464d9b['stop']();}})[_0xd0b9('0x2e')](function(_0x426031){logger[_0xd0b9('0x28')](_0xd0b9('0xd'),_0x27a22,JSON[_0xd0b9('0x20')](_0x426031));_0x464d9b[_0xd0b9('0xe')]();});}else{_0x464d9b[_0xd0b9('0xe')]();}});}}catch(_0x5086db){logger['error'](_0xd0b9('0xd'),_0x27a22,JSON['stringify'](_0x5086db));_0x464d9b[_0xd0b9('0x23')]();}};}; \ 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 88aa9f6..ecaadd0 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 _0x505f=['[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','catch','error','finally','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','upperFirst','Message','html','','headers','auto-replied','All','auto_reply','sendMailMessage','account','smtpOptions'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x505f,0x114));var _0xf505=function(_0x40b842,_0x234853){_0x40b842=_0x40b842-0x0;var _0x4f58f7=_0x505f[_0x40b842];return _0x4f58f7;};'use strict';var _=require('lodash');var moment=require(_0xf505('0x0'));var utils=require('./utils');var logger=require(_0xf505('0x1'))(_0xf505('0x2'));var rpc={'chatMessage':require(_0xf505('0x3')),'openchannelMessage':require(_0xf505('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf505('0x5')),'faxMessage':require(_0xf505('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xf505('0x7')),'openchannelInteraction':require(_0xf505('0x8')),'mailInteraction':require(_0xf505('0x9')),'smsInteraction':require(_0xf505('0xa')),'faxInteraction':require(_0xf505('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xf505('0xc')]=function(_0x11283a,_0x20f2f8,_0x3609d7,_0x1a2a66){return function(_0x20bc9b){try{var _0x217c9a=this[_0xf505('0xd')];if(_0x217c9a===_0xf505('0xe')&&_0x1a2a66[_0xf505('0xf')][_0xf505('0x10')]){logger[_0xf505('0x11')](_0xf505('0x12'),_0x11283a,_0xf505('0x13'));return _0x20bc9b['next']();}if(_0x20f2f8[0x0]==='1'&&(_[_0xf505('0x14')](this[_0xf505('0x15')][_0xf505('0x16')])||!this[_0xf505('0x15')][_0xf505('0x16')])){logger[_0xf505('0x11')](_0xf505('0x12'),_0x11283a,_0xf505('0x17'));return _0x20bc9b[_0xf505('0x18')]();}if(_0x20f2f8[0x0]==='2'&&this[_0xf505('0x15')][_0xf505('0x19')]){logger[_0xf505('0x11')](_0xf505('0x1a'),_0x11283a,_0xf505('0x1b'));return _0x20bc9b[_0xf505('0x18')]();}var _0x402a60={'ContactId':this[_0xf505('0x1c')]['id'],'sentAt':moment()[_0xf505('0x1d')](_0xf505('0x1e')),'direction':'out'};if(this['channel']===_0xf505('0xe')){_0x402a60[_0xf505('0xf')]=utils[_0xf505('0x1f')](_0x20f2f8[0x2],this);}else{_0x402a60['body']=utils[_0xf505('0x1f')](_0x20f2f8[0x1],this);}if(this[_0xf505('0x20')]){_0x402a60['to']=this['message'][_0xf505('0x21')]||'';if(this[_0xf505('0xd')]===_0xf505('0xe')&&_0x20f2f8[0x1]==='1'){_0x402a60['cc']=this[_0xf505('0x20')]['cc']||'';}_0x402a60[_0xf505('0x21')]=this[_0xf505('0x20')]['to']||'';_0x402a60['phone']=this[_0xf505('0x20')][_0xf505('0x22')]||'';_0x402a60[_0xf505('0x23')]=!![];if(this[_0xf505('0x20')][_0xf505('0x24')]){_0x402a60[_0xf505('0x24')]='';_0x402a60[_0xf505('0x24')]+=_[_0xf505('0x25')](this[_0xf505('0x20')][_0xf505('0x24')],_0xf505('0x26'))?'':_0xf505('0x27');_0x402a60['subject']+=this[_0xf505('0x20')][_0xf505('0x24')];}}if(this[_0xf505('0xd')]==='chat'){_0x402a60[_0xf505('0x28')]=this['account']['id'];}else{_0x402a60[_[_0xf505('0x29')](this[_0xf505('0xd')])+'AccountId']=this['account']['id'];}_0x402a60[_[_0xf505('0x29')](this['channel'])+'InteractionId']=this[_0xf505('0x15')]['id'];var _0x2d38a4=this['interaction'];if(rpc[this[_0xf505('0xd')]+_0xf505('0x2a')]){if(this['channel']===_0xf505('0xe')){_0x402a60['inReplyTo']=this[_0xf505('0x20')]['messageId'];_0x402a60[_0xf505('0x2b')]=''+_['replace'](_0x402a60[_0xf505('0xf')],_0xf505('0x2c'),_0xf505('0x2d'))+_0xf505('0x2e');_0x402a60[_0xf505('0x2f')]={'Auto-Submitted':_0xf505('0x30'),'X-Auto-Response-Suppress':_0xf505('0x31'),'Precedence':_0xf505('0x32')};return mailRpc[_0xf505('0x33')](this[_0xf505('0x34')][_0xf505('0x35')],_0x402a60)['then'](function(_0x3b629e){logger['info'](_0xf505('0x36'),_0x11283a);_0x402a60[_0xf505('0x37')]=_0x3b629e[_0xf505('0x20')][_0xf505('0x37')];return rpc[_0x217c9a+_0xf505('0x2a')][_0xf505('0x38')](_0x402a60);})[_0xf505('0x39')](function(_0x269b56){logger[_0xf505('0x11')](_0xf505('0x12'),_0x11283a,JSON[_0xf505('0x3a')](_0x269b56));})[_0xf505('0x3b')](function(_0x41f3b5){logger[_0xf505('0x3c')]('[RPC][%s][AUTOREPLY]\x20%s',_0x11283a,JSON[_0xf505('0x3a')](_0x41f3b5));})[_0xf505('0x3d')](function(){Promise['resolve']()[_0xf505('0x39')](function(){if(_0x20f2f8[0x0]!=='2'||_0x2d38a4['autoreplyExecuted'])return;return rpc[_0x217c9a+_0xf505('0x3e')][_0xf505('0x3f')](_0x2d38a4['id'],{'autoreplyExecuted':!![]})[_0xf505('0x39')](function(_0xaa066e){logger[_0xf505('0x11')](_0xf505('0x1a'),_0x11283a,JSON[_0xf505('0x3a')](_0xaa066e));})['catch'](function(_0x50d29d){logger['error'](_0xf505('0x40'),_0x11283a,JSON[_0xf505('0x3a')](_0x50d29d));});})[_0xf505('0x39')](function(){_0x20bc9b[_0xf505('0x18')]();});});}else{return rpc[this[_0xf505('0xd')]+_0xf505('0x2a')]['create'](_0x402a60)[_0xf505('0x39')](function(){logger[_0xf505('0x11')](_0xf505('0x12'),_0x11283a,_0x402a60['body']);})[_0xf505('0x3b')](function(_0x1b92e3){logger[_0xf505('0x3c')](_0xf505('0x12'),_0x11283a,JSON[_0xf505('0x3a')](_0x1b92e3));})['finally'](function(){Promise['resolve']()[_0xf505('0x39')](function(){if(_0x20f2f8[0x0]!=='2'||_0x2d38a4[_0xf505('0x19')])return;return rpc[_0x217c9a+'Interaction'][_0xf505('0x3f')](_0x2d38a4['id'],{'autoreplyExecuted':!![]})[_0xf505('0x39')](function(_0x36e697){logger[_0xf505('0x11')](_0xf505('0x1a'),_0x11283a,JSON[_0xf505('0x3a')](_0x36e697));})['catch'](function(_0xdddf13){logger['error'](_0xf505('0x40'),_0x11283a,JSON[_0xf505('0x3a')](_0xdddf13));});})[_0xf505('0x39')](function(){_0x20bc9b['next']();});});}}}catch(_0x352c34){logger[_0xf505('0x3c')](_0xf505('0x12'),_0x11283a,JSON[_0xf505('0x3a')](_0x352c34));_0x20bc9b[_0xf505('0x41')]();}};}; \ No newline at end of file +var _0x65ca=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','account','upperFirst','Message','inReplyTo','html','','','headers','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x35a8ad,_0x5562b0){var _0xddb0e1=function(_0x95dd6e){while(--_0x95dd6e){_0x35a8ad['push'](_0x35a8ad['shift']());}};_0xddb0e1(++_0x5562b0);}(_0x65ca,0xfd));var _0xa65c=function(_0x2b63a0,_0x14fc48){_0x2b63a0=_0x2b63a0-0x0;var _0x4f0434=_0x65ca[_0x2b63a0];return _0x4f0434;};'use strict';var _=require('lodash');var moment=require('moment');var utils=require(_0xa65c('0x0'));var logger=require(_0xa65c('0x1'))(_0xa65c('0x2'));var rpc={'chatMessage':require(_0xa65c('0x3')),'openchannelMessage':require(_0xa65c('0x4')),'mailMessage':require(_0xa65c('0x5')),'smsMessage':require(_0xa65c('0x6')),'faxMessage':require(_0xa65c('0x7')),'whatsappMessage':require(_0xa65c('0x8')),'chatInteraction':require(_0xa65c('0x9')),'openchannelInteraction':require(_0xa65c('0xa')),'mailInteraction':require(_0xa65c('0xb')),'smsInteraction':require(_0xa65c('0xc')),'faxInteraction':require(_0xa65c('0xd')),'whatsappInteraction':require(_0xa65c('0xe'))};var mailRpc=require('../../mailRpc');exports[_0xa65c('0xf')]=function(_0x1751d0,_0x32626b,_0x4ac902,_0x21fb38){return function(_0x5e5ddd){try{var _0x176631=this[_0xa65c('0x10')];if(_0x176631===_0xa65c('0x11')&&_0x21fb38[_0xa65c('0x12')][_0xa65c('0x13')]){logger[_0xa65c('0x14')](_0xa65c('0x15'),_0x1751d0,_0xa65c('0x16'));return _0x5e5ddd[_0xa65c('0x17')]();}if(_0x32626b[0x0]==='1'&&(_[_0xa65c('0x18')](this['interaction'][_0xa65c('0x19')])||!this[_0xa65c('0x1a')]['created'])){logger[_0xa65c('0x14')](_0xa65c('0x15'),_0x1751d0,'Autoreply\x20already\x20sent');return _0x5e5ddd[_0xa65c('0x17')]();}if(_0x32626b[0x0]==='2'&&this[_0xa65c('0x1a')][_0xa65c('0x1b')]){logger[_0xa65c('0x14')](_0xa65c('0x1c'),_0x1751d0,_0xa65c('0x1d'));return _0x5e5ddd[_0xa65c('0x17')]();}var _0x3743ee={'ContactId':this[_0xa65c('0x1e')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xa65c('0x1f')};if(this[_0xa65c('0x10')]===_0xa65c('0x11')){_0x3743ee['body']=utils[_0xa65c('0x20')](_0x32626b[0x2],this);}else{_0x3743ee['body']=utils[_0xa65c('0x20')](_0x32626b[0x1],this);}if(this[_0xa65c('0x21')]){_0x3743ee['to']=this[_0xa65c('0x21')][_0xa65c('0x22')]||'';if(this[_0xa65c('0x10')]==='mail'&&_0x32626b[0x1]==='1'){_0x3743ee['cc']=this[_0xa65c('0x21')]['cc']||'';}_0x3743ee['from']=this[_0xa65c('0x21')]['to']||'';_0x3743ee[_0xa65c('0x23')]=this[_0xa65c('0x21')][_0xa65c('0x23')]||'';_0x3743ee[_0xa65c('0x24')]=!![];if(this[_0xa65c('0x21')][_0xa65c('0x25')]){_0x3743ee[_0xa65c('0x25')]='';_0x3743ee[_0xa65c('0x25')]+=_[_0xa65c('0x26')](this[_0xa65c('0x21')][_0xa65c('0x25')],'Re:')?'':_0xa65c('0x27');_0x3743ee[_0xa65c('0x25')]+=this[_0xa65c('0x21')][_0xa65c('0x25')];}}if(this[_0xa65c('0x10')]===_0xa65c('0x28')){_0x3743ee['ChatWebsiteId']=this[_0xa65c('0x29')]['id'];}else{_0x3743ee[_[_0xa65c('0x2a')](this[_0xa65c('0x10')])+'AccountId']=this[_0xa65c('0x29')]['id'];}_0x3743ee[_[_0xa65c('0x2a')](this[_0xa65c('0x10')])+'InteractionId']=this[_0xa65c('0x1a')]['id'];var _0x2116e1=this[_0xa65c('0x1a')];if(rpc[this['channel']+_0xa65c('0x2b')]){if(this['channel']==='mail'){_0x3743ee[_0xa65c('0x2c')]=this[_0xa65c('0x21')]['messageId'];_0x3743ee[_0xa65c('0x2d')]=_0xa65c('0x2e')+_['replace'](_0x3743ee[_0xa65c('0x12')],']+(>|$)/g,''),'priorityTrue':_0x4cc5ef[0x1],'priorityFalse':_0x4cc5ef[0x2]};var _0x48b251=gotoif[_0xe68b('0x0')](_0x47fb4d,{'typecast':!![]});if(_0x48b251['length']){logger['error']('[%s][GOTOIF]\x20%s',_0x41ceee,_[_0xe68b('0xc')](_0x48b251,_0xe68b('0xd'))[_0xe68b('0xe')](',\x20'));_0x5448f6['stop']();}else{try{var _0x1ae683=eval('('+_0x47fb4d[_0xe68b('0xf')]+')');var _0x51f13c=_0x1ae683?_0x47fb4d[_0xe68b('0x10')]:_0x47fb4d['priorityFalse'];logger[_0xe68b('0x11')](_0xe68b('0x12'),_0x41ceee,_0x47fb4d[_0xe68b('0xf')],_0x1ae683,_0x51f13c||_0xe68b('0x13'));if(_0x51f13c){var _0x5ee1b5=_[_0xe68b('0x14')](_0x5448f6[_0xe68b('0x15')](),{'p':_0x51f13c});if(_0x5ee1b5>=0x0){logger['info'](_0xe68b('0x16'),_0x41ceee,_0x51f13c||_0xe68b('0x13'),_0x5ee1b5);_0x5448f6[_0xe68b('0x13')](_0x5ee1b5);}else{logger[_0xe68b('0x11')](_0xe68b('0x17'),_0x41ceee,_0x51f13c||_0xe68b('0x13'));_0x5448f6['stop']();}}else{_0x5448f6[_0xe68b('0x13')]();}}catch(_0x5a554e){logger[_0xe68b('0x18')](_0xe68b('0x19'),_0x41ceee,_0x5a554e[_0xe68b('0xd')]);_0x5448f6[_0xe68b('0x1a')]();}}}catch(_0x2b7323){logger[_0xe68b('0x18')]('[%s][GOTOIF]\x20%s',_0x41ceee,JSON[_0xe68b('0x1b')](_0x2b7323));_0x5448f6['stop']();}};}; \ No newline at end of file +var _0xa791=['priorityTrue','priorityFalse','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','condition'];(function(_0x36f5cb,_0x2a720f){var _0x58d6ce=function(_0x1adfb5){while(--_0x1adfb5){_0x36f5cb['push'](_0x36f5cb['shift']());}};_0x58d6ce(++_0x2a720f);}(_0xa791,0x13d));var _0x1a79=function(_0x3a6545,_0x2560ab){_0x3a6545=_0x3a6545-0x0;var _0x38abb0=_0xa791[_0x3a6545];return _0x38abb0;};'use strict';var schema=require(_0x1a79('0x0'));var _=require('lodash');var htmlToText=require(_0x1a79('0x1'));var utils=require(_0x1a79('0x2'));var logger=require(_0x1a79('0x3'))(_0x1a79('0x4'));var gotoif=schema({'condition':{'type':_0x1a79('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1a79('0x6'),'message':_0x1a79('0x7')},'priorityFalse':{'type':_0x1a79('0x6'),'message':_0x1a79('0x8')}});exports['consequence']=function(_0x94717f,_0x189b37){return function(_0x199c76){try{var _0x59c00a={'condition':htmlToText[_0x1a79('0x9')](utils[_0x1a79('0xa')](_0x189b37[0x0],this),{'wordwrap':![]})[_0x1a79('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x189b37[0x1],'priorityFalse':_0x189b37[0x2]};var _0x12d9cd=gotoif[_0x1a79('0x0')](_0x59c00a,{'typecast':!![]});if(_0x12d9cd[_0x1a79('0xc')]){logger['error'](_0x1a79('0xd'),_0x94717f,_[_0x1a79('0xe')](_0x12d9cd,_0x1a79('0xf'))[_0x1a79('0x10')](',\x20'));_0x199c76[_0x1a79('0x11')]();}else{try{var _0xcc17ee=eval('('+_0x59c00a[_0x1a79('0x12')]+')');var _0x27e696=_0xcc17ee?_0x59c00a[_0x1a79('0x13')]:_0x59c00a[_0x1a79('0x14')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x94717f,_0x59c00a[_0x1a79('0x12')],_0xcc17ee,_0x27e696||_0x1a79('0x15'));if(_0x27e696){var _0x5c4cbf=_[_0x1a79('0x16')](_0x199c76[_0x1a79('0x17')](),{'p':_0x27e696});if(_0x5c4cbf>=0x0){logger[_0x1a79('0x18')](_0x1a79('0x19'),_0x94717f,_0x27e696||_0x1a79('0x15'),_0x5c4cbf);_0x199c76[_0x1a79('0x15')](_0x5c4cbf);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x94717f,_0x27e696||_0x1a79('0x15'));_0x199c76[_0x1a79('0x11')]();}}else{_0x199c76['next']();}}catch(_0x122727){logger[_0x1a79('0x1a')](_0x1a79('0x1b'),_0x94717f,_0x122727[_0x1a79('0xf')]);_0x199c76[_0x1a79('0x11')]();}}}catch(_0x455386){logger[_0x1a79('0x1a')](_0x1a79('0xd'),_0x94717f,JSON['stringify'](_0x455386));_0x199c76[_0x1a79('0x11')]();}};}; \ 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 e816cf1..09fb5f2 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 _0x7f5b=['priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x7f5b,0x195));var _0xb7f5=function(_0x3ea8b8,_0x508efb){_0x3ea8b8=_0x3ea8b8-0x0;var _0x7d213f=_0x7f5b[_0x3ea8b8];return _0x7d213f;};'use strict';var schema=require('validate');var _=require(_0xb7f5('0x0'));var logger=require(_0xb7f5('0x1'))(_0xb7f5('0x2'));var gotop=schema({'priority':{'type':_0xb7f5('0x3'),'required':!![],'message':_0xb7f5('0x4')}});exports[_0xb7f5('0x5')]=function(_0x34293a,_0x4edd96){return function(_0x501a2a){try{var _0x4e3052={'priority':_0x4edd96[0x0]};var _0x9ef5c2=gotop[_0xb7f5('0x6')](_0x4e3052,{'typecast':!![]});if(_0x9ef5c2[_0xb7f5('0x7')]){logger['error'](_0xb7f5('0x8'),_0x34293a,_[_0xb7f5('0x9')](_0x9ef5c2,_0xb7f5('0xa'))[_0xb7f5('0xb')](',\x20'));_0x501a2a[_0xb7f5('0xc')]();}else{logger[_0xb7f5('0xd')](_0xb7f5('0xe'),_0x34293a,_0x4e3052[_0xb7f5('0xf')]);if(_0x4e3052['priority']){var _0x1ebe5a=_['findIndex'](_0x501a2a['rules'](),{'p':_0x4e3052[_0xb7f5('0xf')]});if(_0x1ebe5a>=0x0){logger[_0xb7f5('0xd')](_0xb7f5('0x10'),_0x34293a,_0x4e3052[_0xb7f5('0xf')]||_0xb7f5('0x11'),_0x1ebe5a);_0x501a2a[_0xb7f5('0x11')](_0x1ebe5a);}else{logger[_0xb7f5('0xd')](_0xb7f5('0x12'),_0x34293a,_0x4e3052[_0xb7f5('0xf')]||_0xb7f5('0x11'));_0x501a2a[_0xb7f5('0xc')]();}}else{_0x501a2a[_0xb7f5('0x11')]();}}}catch(_0x2b745b){logger[_0xb7f5('0x13')]('[%s][GOTOP]\x20%s',_0x34293a,JSON[_0xb7f5('0x14')](_0x2b745b));_0x501a2a[_0xb7f5('0xc')]();}};}; \ No newline at end of file +var _0x7a71=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x25aa48,_0x5a309f){var _0x4d4088=function(_0x17f7de){while(--_0x17f7de){_0x25aa48['push'](_0x25aa48['shift']());}};_0x4d4088(++_0x5a309f);}(_0x7a71,0x1a5));var _0x17a7=function(_0xe7ce7f,_0xc3ae44){_0xe7ce7f=_0xe7ce7f-0x0;var _0x2c6dca=_0x7a71[_0xe7ce7f];return _0x2c6dca;};'use strict';var schema=require(_0x17a7('0x0'));var _=require(_0x17a7('0x1'));var logger=require(_0x17a7('0x2'))(_0x17a7('0x3'));var gotop=schema({'priority':{'type':_0x17a7('0x4'),'required':!![],'message':_0x17a7('0x5')}});exports[_0x17a7('0x6')]=function(_0x3d0660,_0x2197b5){return function(_0x304d50){try{var _0x5633fb={'priority':_0x2197b5[0x0]};var _0x30a546=gotop[_0x17a7('0x0')](_0x5633fb,{'typecast':!![]});if(_0x30a546['length']){logger[_0x17a7('0x7')](_0x17a7('0x8'),_0x3d0660,_[_0x17a7('0x9')](_0x30a546,'message')['join'](',\x20'));_0x304d50[_0x17a7('0xa')]();}else{logger[_0x17a7('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x3d0660,_0x5633fb[_0x17a7('0xc')]);if(_0x5633fb[_0x17a7('0xc')]){var _0x2831f4=_[_0x17a7('0xd')](_0x304d50[_0x17a7('0xe')](),{'p':_0x5633fb['priority']});if(_0x2831f4>=0x0){logger[_0x17a7('0xb')](_0x17a7('0xf'),_0x3d0660,_0x5633fb['priority']||'next',_0x2831f4);_0x304d50['next'](_0x2831f4);}else{logger[_0x17a7('0xb')](_0x17a7('0x10'),_0x3d0660,_0x5633fb[_0x17a7('0xc')]||_0x17a7('0x11'));_0x304d50['stop']();}}else{_0x304d50['next']();}}}catch(_0xda84b3){logger['error']('[%s][GOTOP]\x20%s',_0x3d0660,JSON[_0x17a7('0x12')](_0xda84b3));_0x304d50[_0x17a7('0xa')]();}};}; \ 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 7e97a1e..28a0c5e 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 _0xdc64=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x36feb2,_0x53abef){var _0x292b43=function(_0x52a460){while(--_0x52a460){_0x36feb2['push'](_0x36feb2['shift']());}};_0x292b43(++_0x53abef);}(_0xdc64,0x80));var _0x4dc6=function(_0x4e3158,_0xb08fc7){_0x4e3158=_0x4e3158-0x0;var _0x63e79e=_0xdc64[_0x4e3158];return _0x63e79e;};'use strict';var _=require(_0x4dc6('0x0'));var utils=require(_0x4dc6('0x1'));var logger=require(_0x4dc6('0x2'))(_0x4dc6('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4dc6('0x4')),'mailMessage':require(_0x4dc6('0x5')),'smsMessage':require(_0x4dc6('0x6')),'faxMessage':require(_0x4dc6('0x7')),'whatsappMessage':require(_0x4dc6('0x8'))};exports[_0x4dc6('0x9')]=function(_0x7a07c1,_0x2858c3){return function(_0x263fcd){try{var _0x469d65={'body':utils[_0x4dc6('0xa')](_0x2858c3[0x0],this),'ContactId':this[_0x4dc6('0xb')]['id']};if(this[_0x4dc6('0xc')]===_0x4dc6('0xd')){_0x469d65[_0x4dc6('0xe')]=this['account']['id'];}else{_0x469d65[_[_0x4dc6('0xf')](this[_0x4dc6('0xc')])+_0x4dc6('0x10')]=this['account']['id'];}_0x469d65[_[_0x4dc6('0xf')](this[_0x4dc6('0xc')])+'InteractionId']=this[_0x4dc6('0x11')]['id'];if(rpc[this[_0x4dc6('0xc')]+'Message']){return rpc[this[_0x4dc6('0xc')]+_0x4dc6('0x12')]['create'](_0x469d65)[_0x4dc6('0x13')](function(_0x55411f){logger[_0x4dc6('0x14')](_0x4dc6('0x15'),_0x7a07c1,_0x469d65[_0x4dc6('0x16')]);_0x263fcd['next']();})[_0x4dc6('0x17')](function(_0x28aeb9){logger[_0x4dc6('0x18')](_0x4dc6('0x15'),_0x7a07c1,JSON[_0x4dc6('0x19')](_0x28aeb9));_0x263fcd['stop']();});}}catch(_0x565d55){logger[_0x4dc6('0x18')](_0x4dc6('0x15'),_0x7a07c1,JSON[_0x4dc6('0x19')](_0x565d55));_0x263fcd[_0x4dc6('0x1a')]();}};}; \ No newline at end of file +var _0x685f=['contact','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x685f,0xc7));var _0xf685=function(_0x529965,_0x3a1ed2){_0x529965=_0x529965-0x0;var _0x232533=_0x685f[_0x529965];return _0x232533;};'use strict';var _=require(_0xf685('0x0'));var utils=require('./utils');var logger=require(_0xf685('0x1'))(_0xf685('0x2'));var rpc={'chatMessage':require(_0xf685('0x3')),'openchannelMessage':require(_0xf685('0x4')),'mailMessage':require(_0xf685('0x5')),'smsMessage':require(_0xf685('0x6')),'faxMessage':require(_0xf685('0x7')),'whatsappMessage':require(_0xf685('0x8'))};exports[_0xf685('0x9')]=function(_0x3b025d,_0x3594aa){return function(_0x2ca7d8){try{var _0x32e969={'body':utils[_0xf685('0xa')](_0x3594aa[0x0],this),'ContactId':this[_0xf685('0xb')]['id']};if(this[_0xf685('0xc')]===_0xf685('0xd')){_0x32e969[_0xf685('0xe')]=this['account']['id'];}else{_0x32e969[_[_0xf685('0xf')](this[_0xf685('0xc')])+'AccountId']=this[_0xf685('0x10')]['id'];}_0x32e969[_['upperFirst'](this['channel'])+_0xf685('0x11')]=this[_0xf685('0x12')]['id'];if(rpc[this[_0xf685('0xc')]+_0xf685('0x13')]){return rpc[this[_0xf685('0xc')]+_0xf685('0x13')][_0xf685('0x14')](_0x32e969)[_0xf685('0x15')](function(_0x45d8fc){logger[_0xf685('0x16')](_0xf685('0x17'),_0x3b025d,_0x32e969[_0xf685('0x18')]);_0x2ca7d8[_0xf685('0x19')]();})[_0xf685('0x1a')](function(_0x531bb2){logger[_0xf685('0x1b')]('[%s][MESSAGE]\x20%s',_0x3b025d,JSON['stringify'](_0x531bb2));_0x2ca7d8[_0xf685('0x1c')]();});}}catch(_0x5f2211){logger[_0xf685('0x1b')](_0xf685('0x17'),_0x3b025d,JSON[_0xf685('0x1d')](_0x5f2211));_0x2ca7d8[_0xf685('0x1c')]();}};}; \ 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 80aea6c..af968af 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 _0xac05=['next','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','info'];(function(_0x5e9018,_0x5d3a28){var _0x2062e2=function(_0x4aa0d8){while(--_0x4aa0d8){_0x5e9018['push'](_0x5e9018['shift']());}};_0x2062e2(++_0x5d3a28);}(_0xac05,0xd6));var _0x5ac0=function(_0xacefac,_0x20db0c){_0xacefac=_0xacefac-0x0;var _0x3db2a2=_0xac05[_0xacefac];return _0x3db2a2;};'use strict';var utils=require('./utils');var logger=require(_0x5ac0('0x0'))(_0x5ac0('0x1'));exports['consequence']=function(_0x4ca524,_0x239bef){return function(_0x4580eb){try{logger[_0x5ac0('0x2')]('[%s][NOOP]\x20%s',_0x4ca524,utils['getMustacheRender'](_0x239bef[0x0],this));_0x4580eb[_0x5ac0('0x3')]();}catch(_0x5c4f10){logger['error'](_0x5ac0('0x4'),_0x4ca524,JSON[_0x5ac0('0x5')](_0x5c4f10));_0x4580eb[_0x5ac0('0x6')]();}};}; \ No newline at end of file +var _0x08d9=['getMustacheRender','error','[%s][NOOP]\x20%s','stop','info'];(function(_0x4f52db,_0xda2194){var _0x13898b=function(_0x5eb736){while(--_0x5eb736){_0x4f52db['push'](_0x4f52db['shift']());}};_0x13898b(++_0xda2194);}(_0x08d9,0xf4));var _0x908d=function(_0x50f957,_0x351291){_0x50f957=_0x50f957-0x0;var _0x4fecea=_0x08d9[_0x50f957];return _0x4fecea;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports['consequence']=function(_0x503291,_0x33748e){return function(_0x1962ba){try{logger[_0x908d('0x0')]('[%s][NOOP]\x20%s',_0x503291,utils[_0x908d('0x1')](_0x33748e[0x0],this));_0x1962ba['next']();}catch(_0xb073bf){logger[_0x908d('0x2')](_0x908d('0x3'),_0x503291,JSON['stringify'](_0xb073bf));_0x1962ba[_0x908d('0x4')]();}};}; \ 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 a52018f..1304109 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 _0xa2c2=['join','stop','Queues','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','joinAt','clone','queue','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','string','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','AccountId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','accepted','info','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0xa2c2,0xa0));var _0x2a2c=function(_0x4e7d8d,_0x15ebe9){_0x4e7d8d=_0x4e7d8d-0x0;var _0x550090=_0xa2c2[_0x4e7d8d];return _0x550090;};'use strict';var schema=require(_0x2a2c('0x0'));var _=require(_0x2a2c('0x1'));var util=require(_0x2a2c('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require(_0x2a2c('0x3'));var config=require(_0x2a2c('0x4'));var logger=require(_0x2a2c('0x5'))(_0x2a2c('0x6'));var strategy=require(_0x2a2c('0x7'));config[_0x2a2c('0x8')]=_[_0x2a2c('0x9')](config[_0x2a2c('0x8')],{'host':_0x2a2c('0xa'),'port':0x18eb});var io=require(_0x2a2c('0xb'))(new Redis(config[_0x2a2c('0x8')]));var attributes=['id',_0x2a2c('0xc'),_0x2a2c('0xd'),'queue','from',_0x2a2c('0xe')];function emit(_0x427d52,_0xf86048,_0x26e0e7){io['to'](_0x427d52)['emit'](_0xf86048,_0x26e0e7);}function emitChannelQueueInteraction(_0x10c470,_0x566721,_0x148378,_0x2c7df6,_0x3bb9dd,_0x4e552e,_0x2201e1,_0x1a1dc2){var _0x1f7e61=_[_0x2a2c('0xf')](_0x148378);_0x1f7e61[_0x2a2c('0xc')]=_0x1a1dc2;_0x1f7e61[_0x2a2c('0x10')]=_0x566721;_0x1f7e61[_0x2a2c('0xd')]=_0x2c7df6;_0x1f7e61['id']=_0x3bb9dd;if(_0x4e552e){_0x2201e1[util[_0x2a2c('0x11')]('%sQueuesWaitingInteractions',_0x10c470)][_0x3bb9dd]=_[_0x2a2c('0x12')](_0x1f7e61,attributes);}else{delete _0x2201e1[util[_0x2a2c('0x11')](_0x2a2c('0x13'),_0x10c470)][_0x3bb9dd];}emit(util[_0x2a2c('0x11')](_0x2a2c('0x14'),_0x10c470,_0x566721),util[_0x2a2c('0x11')](_0x2a2c('0x15'),_0x10c470,_0x4e552e?_0x2a2c('0x16'):'remove'),_['pick'](_0x1f7e61,attributes));}var rpc={'openchannelQueueReport':require(_0x2a2c('0x17')),'mailQueueReport':require(_0x2a2c('0x18')),'chatQueueReport':require(_0x2a2c('0x19')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x2a2c('0x1a')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x2a2c('0x1b'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x46334c,_0x8d1892,_0x4cc3db,_0x1f33ae){if(_0x46334c&&_0x8d1892&&_0x4cc3db){_0x8d1892[_0x2a2c('0x1c')]+=0x1;var _0x9c96b={'uniqueid':_0x46334c,'from':_0x4cc3db[_0x2a2c('0x1d')]?_0x4cc3db[_0x2a2c('0x1d')][_0x2a2c('0x1e')]:'','joinAt':moment()['format'](_0x2a2c('0x1f')),'ContactId':_0x4cc3db[_0x2a2c('0x20')]?_0x4cc3db[_0x2a2c('0x20')]['id']:null,'ListId':_0x4cc3db[_0x2a2c('0x21')]?_0x4cc3db['list']['id']:null};_0x9c96b[_[_0x2a2c('0x22')](_0x4cc3db[_0x2a2c('0x23')])+_0x2a2c('0x24')]=_0x8d1892['id']||null;_0x9c96b[_['upperFirst'](_0x4cc3db[_0x2a2c('0x23')])+_0x2a2c('0x25')]=_0x4cc3db[_0x2a2c('0x26')]?_0x4cc3db['interaction']['id']:null;_0x9c96b[_[_0x2a2c('0x22')](_0x4cc3db['channel'])+_0x2a2c('0x27')]=_0x4cc3db[_0x2a2c('0x28')]?_0x4cc3db['message']['id']:null;_0x9c96b[_[_0x2a2c('0x22')](_0x4cc3db[_0x2a2c('0x23')])+(_0x4cc3db[_0x2a2c('0x23')]!=='chat'?_0x2a2c('0x29'):'WebsiteId')]=_0x4cc3db[_0x2a2c('0xd')]?_0x4cc3db['account']['id']:null;logger['info'](util['format'](_0x2a2c('0x2a'),_0x46334c,_0x8d1892[_0x2a2c('0x2b')]));emitChannelQueueInteraction(_0x4cc3db[_0x2a2c('0x23')],_0x8d1892[_0x2a2c('0x2b')],_0x9c96b,_0x4cc3db[_0x2a2c('0xd')][_0x2a2c('0x2b')],_0x4cc3db[_0x2a2c('0x28')]['id'],!![],_0x1f33ae,_0x8d1892['id']);if(rpc[_0x4cc3db[_0x2a2c('0x23')]+'QueueReport']){return rpc[_0x4cc3db[_0x2a2c('0x23')]+_0x2a2c('0x2c')]['create'](_0x9c96b)[_0x2a2c('0x2d')](function(_0x28071e){logger[_0x2a2c('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x4b4ef4,_0x7cd009,_0x4cea7b,_0x1c0334){if(_0x4b4ef4&&_0x7cd009){_0x7cd009[_0x2a2c('0x1c')]-=0x1;var _0x37f524={'leaveAt':moment()[_0x2a2c('0x11')](_0x2a2c('0x1f')),'acceptAt':moment()[_0x2a2c('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2a2c('0x2f')};logger[_0x2a2c('0x30')](util[_0x2a2c('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x4b4ef4,_0x7cd009[_0x2a2c('0x2b')]));emitChannelQueueInteraction(_0x4cea7b['channel'],_0x7cd009['name'],_0x4cea7b[_0x2a2c('0x1d')],_0x4cea7b[_0x2a2c('0xd')][_0x2a2c('0x2b')],_0x4cea7b[_0x2a2c('0x28')]['id'],![],_0x1c0334,_0x7cd009['id']);if(rpc[_0x4cea7b['channel']+_0x2a2c('0x2c')]){return rpc[_0x4cea7b['channel']+_0x2a2c('0x2c')][_0x2a2c('0x31')](_0x4b4ef4,_0x37f524)[_0x2a2c('0x2d')](function(_0x3003f5){logger['error'](_0x2a2c('0x32'));});}}}function endRouting(_0x12854a,_0x40a1b3,_0x2ba2cb,_0xd86326){if(_0x12854a&&_0x40a1b3){_0x40a1b3[_0x2a2c('0x1c')]-=0x1;var _0x3ba2ae={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x2a2c('0x1f')),'reason':_0x2a2c('0x33')};logger[_0x2a2c('0x30')](util['format'](_0x2a2c('0x34'),_0x12854a,_0x40a1b3[_0x2a2c('0x2b')]));emitChannelQueueInteraction(_0x2ba2cb[_0x2a2c('0x23')],_0x40a1b3[_0x2a2c('0x2b')],_0x2ba2cb[_0x2a2c('0x1d')],_0x2ba2cb['account'][_0x2a2c('0x2b')],_0x2ba2cb[_0x2a2c('0x28')]['id'],![],_0xd86326);if(rpc[_0x2ba2cb['channel']+'QueueReport']){return rpc[_0x2ba2cb[_0x2a2c('0x23')]+_0x2a2c('0x2c')][_0x2a2c('0x31')](_0x12854a,_0x3ba2ae)['catch'](function(_0x560bee){logger['error'](_0x2a2c('0x32'));});}}}function handleFindQueue(_0x8decd){return function(_0x2fbf26){return _0x2fbf26[_0x2a2c('0x2b')]['toLowerCase']()===_0x8decd[_0x2a2c('0x35')]();};}exports['consequence']=function(_0x2d9eb6,_0x2512b8,_0x1b2210,_0x1bdc3d){return function(_0x3f46c0){try{var _0xb9892d={'name':_0x2512b8[0x0],'timeout':_0x2512b8[0x1]};var _0x318392=queue[_0x2a2c('0x0')](_0xb9892d,{'typecast':!![]});if(_0x318392[_0x2a2c('0x36')]){logger['error'](_0x2a2c('0x37'),_0x2d9eb6,_['map'](_0x318392,_0x2a2c('0x28'))[_0x2a2c('0x38')](',\x20'));_0x3f46c0[_0x2a2c('0x39')]();}else{var _0x54628d=_['find'](_0x1b2210[_0x1bdc3d[_0x2a2c('0x23')]+_0x2a2c('0x3a')],handleFindQueue(_0xb9892d['name']));if(_0x54628d){startRouting(_0x2d9eb6,_0x54628d,_0x1bdc3d,_0x1b2210);var _0x46e199=(_0x54628d[_0x2a2c('0x33')]||0xa)*0x3e8;var _0x565ac2=(_0xb9892d[_0x2a2c('0x33')]||0x14)*0x3e8;var _0x47dc32,_0x53d476;if(_0x46e199>_0x565ac2){_0x565ac2=_0x46e199;}var _0x5a33ad=seqqueue['createQueue'](_0x46e199);_0x5a33ad['id']=_0x2d9eb6;_0x5a33ad[_0x2a2c('0x3b')]=_0x46e199;_0x5a33ad[_0x2a2c('0x3c')]=_0x565ac2;_0x5a33ad[_0x2a2c('0x23')]=_0x1bdc3d[_0x2a2c('0x23')];_0x1b2210['rules'][_0x2d9eb6]['on'](_0x2a2c('0x3d'),function(){logger['info'](_0x2a2c('0x3e'),_0x2d9eb6);stopRouting(_0x2d9eb6,_0x54628d,_0x1bdc3d,_0x1b2210);clearTimeout(_0x47dc32);_0x47dc32=undefined;_0x5a33ad['close'](!![]);if(_0x1b2210['rules'][_0x2d9eb6]){delete _0x1b2210[_0x2a2c('0x3f')][_0x2d9eb6];}_0x3f46c0['stop']();});_0x1b2210[_0x2a2c('0x3f')][_0x2d9eb6]['on'](_0x2a2c('0x40'),function(){if(_0x1b2210[_0x2a2c('0x3f')][_0x2d9eb6]){delete _0x1b2210[_0x2a2c('0x3f')][_0x2d9eb6];}});_0x47dc32=setTimeout(function(){logger[_0x2a2c('0x30')](_0x2a2c('0x41'),_0x2d9eb6);endRouting(_0x2d9eb6,_0x54628d,_0x1bdc3d,_0x1b2210);clearTimeout(_0x47dc32);_0x5a33ad[_0x2a2c('0x42')](!![]);_0x3f46c0[_0x2a2c('0x43')]();},_0x565ac2);switch(_0x54628d[_0x2a2c('0x44')]){case'rrmemory':strategy['rrmemory'](_0x5a33ad,_0x54628d,_0x1b2210,_0x1bdc3d);break;default:strategy['beepall'](_0x5a33ad,_0x54628d,_0x1b2210,_0x1bdc3d);}}else{logger['error'](_0x2a2c('0x45'),_0x2d9eb6,_0xb9892d[_0x2a2c('0x2b')]);_0x3f46c0['stop']();}}}catch(_0x457495){console[_0x2a2c('0x46')](_0x457495);logger[_0x2a2c('0x2e')](_0x2a2c('0x37'),_0x2d9eb6,_0x457495[_0x2a2c('0x47')]);_0x3f46c0[_0x2a2c('0x39')]();}};}; \ No newline at end of file +var _0x5242=['close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','account','joinAt','emit','clone','queue','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','contact','list','QueueId','upperFirst','interaction','message','channel','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','update','catch','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','stop','find','timeout','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x39d28b,_0x585248){var _0x179d9a=function(_0x2e9569){while(--_0x2e9569){_0x39d28b['push'](_0x39d28b['shift']());}};_0x179d9a(++_0x585248);}(_0x5242,0x148));var _0x2524=function(_0x2b4fbb,_0x1353b4){_0x2b4fbb=_0x2b4fbb-0x0;var _0x1859d9=_0x5242[_0x2b4fbb];return _0x1859d9;};'use strict';var schema=require(_0x2524('0x0'));var _=require(_0x2524('0x1'));var util=require(_0x2524('0x2'));var seqqueue=require(_0x2524('0x3'));var moment=require(_0x2524('0x4'));var Redis=require('ioredis');var config=require(_0x2524('0x5'));var logger=require(_0x2524('0x6'))(_0x2524('0x7'));var strategy=require(_0x2524('0x8'));config[_0x2524('0x9')]=_[_0x2524('0xa')](config[_0x2524('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x2524('0xb'))(new Redis(config[_0x2524('0x9')]));var attributes=['id',_0x2524('0xc'),_0x2524('0xd'),'queue','from',_0x2524('0xe')];function emit(_0x2ecd8f,_0x40f826,_0x52e6e0){io['to'](_0x2ecd8f)[_0x2524('0xf')](_0x40f826,_0x52e6e0);}function emitChannelQueueInteraction(_0x2a1599,_0x3a8a54,_0x1debee,_0x28920d,_0x416856,_0x23b47c,_0x5edc88,_0x507eae){var _0x44d626=_[_0x2524('0x10')](_0x1debee);_0x44d626[_0x2524('0xc')]=_0x507eae;_0x44d626[_0x2524('0x11')]=_0x3a8a54;_0x44d626[_0x2524('0xd')]=_0x28920d;_0x44d626['id']=_0x416856;if(_0x23b47c){_0x5edc88[util[_0x2524('0x12')](_0x2524('0x13'),_0x2a1599)][_0x416856]=_[_0x2524('0x14')](_0x44d626,attributes);}else{delete _0x5edc88[util[_0x2524('0x12')](_0x2524('0x13'),_0x2a1599)][_0x416856];}emit(util[_0x2524('0x12')](_0x2524('0x15'),_0x2a1599,_0x3a8a54),util[_0x2524('0x12')](_0x2524('0x16'),_0x2a1599,_0x23b47c?_0x2524('0x17'):_0x2524('0x18')),_[_0x2524('0x14')](_0x44d626,attributes));}var rpc={'openchannelQueueReport':require(_0x2524('0x19')),'mailQueueReport':require(_0x2524('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x2524('0x1b')),'faxQueueReport':require(_0x2524('0x1c')),'whatsappQueueReport':require(_0x2524('0x1d'))};var queue=schema({'name':{'type':_0x2524('0x1e'),'required':!![],'message':_0x2524('0x1f')},'timeout':{'type':_0x2524('0x20'),'message':_0x2524('0x21')}});function startRouting(_0x3da9a2,_0x102b60,_0x5f5243,_0x125d00){if(_0x3da9a2&&_0x102b60&&_0x5f5243){_0x102b60['waiting']+=0x1;var _0x33a5d0={'uniqueid':_0x3da9a2,'from':_0x5f5243[_0x2524('0x22')]?_0x5f5243[_0x2524('0x22')][_0x2524('0x23')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5f5243[_0x2524('0x24')]?_0x5f5243[_0x2524('0x24')]['id']:null,'ListId':_0x5f5243[_0x2524('0x25')]?_0x5f5243[_0x2524('0x25')]['id']:null};_0x33a5d0[_['upperFirst'](_0x5f5243['channel'])+_0x2524('0x26')]=_0x102b60['id']||null;_0x33a5d0[_[_0x2524('0x27')](_0x5f5243['channel'])+'InteractionId']=_0x5f5243[_0x2524('0x28')]?_0x5f5243[_0x2524('0x28')]['id']:null;_0x33a5d0[_[_0x2524('0x27')](_0x5f5243['channel'])+'MessageId']=_0x5f5243[_0x2524('0x29')]?_0x5f5243[_0x2524('0x29')]['id']:null;_0x33a5d0[_['upperFirst'](_0x5f5243[_0x2524('0x2a')])+(_0x5f5243[_0x2524('0x2a')]!=='chat'?_0x2524('0x2b'):_0x2524('0x2c'))]=_0x5f5243[_0x2524('0xd')]?_0x5f5243[_0x2524('0xd')]['id']:null;logger[_0x2524('0x2d')](util[_0x2524('0x12')](_0x2524('0x2e'),_0x3da9a2,_0x102b60[_0x2524('0x2f')]));emitChannelQueueInteraction(_0x5f5243[_0x2524('0x2a')],_0x102b60[_0x2524('0x2f')],_0x33a5d0,_0x5f5243[_0x2524('0xd')][_0x2524('0x2f')],_0x5f5243[_0x2524('0x29')]['id'],!![],_0x125d00,_0x102b60['id']);if(rpc[_0x5f5243[_0x2524('0x2a')]+_0x2524('0x30')]){return rpc[_0x5f5243[_0x2524('0x2a')]+_0x2524('0x30')][_0x2524('0x31')](_0x33a5d0)['catch'](function(_0x1b788c){logger[_0x2524('0x32')](_0x2524('0x33'));});}}}function stopRouting(_0x4729ae,_0x4dc2e3,_0x13378a,_0x181a78){if(_0x4729ae&&_0x4dc2e3){_0x4dc2e3[_0x2524('0x34')]-=0x1;var _0x598671={'leaveAt':moment()['format'](_0x2524('0x35')),'acceptAt':moment()[_0x2524('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2524('0x36')};logger[_0x2524('0x2d')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x4729ae,_0x4dc2e3[_0x2524('0x2f')]));emitChannelQueueInteraction(_0x13378a[_0x2524('0x2a')],_0x4dc2e3[_0x2524('0x2f')],_0x13378a[_0x2524('0x22')],_0x13378a['account'][_0x2524('0x2f')],_0x13378a[_0x2524('0x29')]['id'],![],_0x181a78,_0x4dc2e3['id']);if(rpc[_0x13378a[_0x2524('0x2a')]+_0x2524('0x30')]){return rpc[_0x13378a[_0x2524('0x2a')]+_0x2524('0x30')][_0x2524('0x37')](_0x4729ae,_0x598671)[_0x2524('0x38')](function(_0xc9e354){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x55ab3a,_0x34294a,_0x2f5f32,_0x391a5c){if(_0x55ab3a&&_0x34294a){_0x34294a[_0x2524('0x34')]-=0x1;var _0x2eb14e={'leaveAt':moment()[_0x2524('0x12')](_0x2524('0x35')),'exitAt':moment()[_0x2524('0x12')](_0x2524('0x35')),'reason':'timeout'};logger[_0x2524('0x2d')](util[_0x2524('0x12')](_0x2524('0x39'),_0x55ab3a,_0x34294a[_0x2524('0x2f')]));emitChannelQueueInteraction(_0x2f5f32[_0x2524('0x2a')],_0x34294a['name'],_0x2f5f32[_0x2524('0x22')],_0x2f5f32[_0x2524('0xd')][_0x2524('0x2f')],_0x2f5f32[_0x2524('0x29')]['id'],![],_0x391a5c);if(rpc[_0x2f5f32[_0x2524('0x2a')]+'QueueReport']){return rpc[_0x2f5f32[_0x2524('0x2a')]+_0x2524('0x30')][_0x2524('0x37')](_0x55ab3a,_0x2eb14e)[_0x2524('0x38')](function(_0xa29480){logger[_0x2524('0x32')](_0x2524('0x3a'));});}}}function handleFindQueue(_0x442bd3){return function(_0x1289ba){return _0x1289ba['name'][_0x2524('0x3b')]()===_0x442bd3[_0x2524('0x3b')]();};}exports[_0x2524('0x3c')]=function(_0x3ed87b,_0x52a400,_0x3c36e0,_0x10deb5){return function(_0x3aad13){try{var _0x304587={'name':_0x52a400[0x0],'timeout':_0x52a400[0x1]};var _0x2495c1=queue[_0x2524('0x0')](_0x304587,{'typecast':!![]});if(_0x2495c1[_0x2524('0x3d')]){logger[_0x2524('0x32')]('[%s][QUEUE]\x20%s',_0x3ed87b,_[_0x2524('0x3e')](_0x2495c1,_0x2524('0x29'))[_0x2524('0x3f')](',\x20'));_0x3aad13[_0x2524('0x40')]();}else{var _0x1cd6d4=_[_0x2524('0x41')](_0x3c36e0[_0x10deb5[_0x2524('0x2a')]+'Queues'],handleFindQueue(_0x304587[_0x2524('0x2f')]));if(_0x1cd6d4){startRouting(_0x3ed87b,_0x1cd6d4,_0x10deb5,_0x3c36e0);var _0x103a10=(_0x1cd6d4[_0x2524('0x42')]||0xa)*0x3e8;var _0x47b9a4=(_0x304587[_0x2524('0x42')]||0x14)*0x3e8;var _0x3925fe,_0x23d7b8;if(_0x103a10>_0x47b9a4){_0x47b9a4=_0x103a10;}var _0x3933fc=seqqueue['createQueue'](_0x103a10);_0x3933fc['id']=_0x3ed87b;_0x3933fc[_0x2524('0x43')]=_0x103a10;_0x3933fc[_0x2524('0x44')]=_0x47b9a4;_0x3933fc[_0x2524('0x2a')]=_0x10deb5[_0x2524('0x2a')];_0x3c36e0[_0x2524('0x45')][_0x3ed87b]['on'](_0x2524('0x46'),function(){logger[_0x2524('0x2d')](_0x2524('0x47'),_0x3ed87b);stopRouting(_0x3ed87b,_0x1cd6d4,_0x10deb5,_0x3c36e0);clearTimeout(_0x3925fe);_0x3925fe=undefined;_0x3933fc[_0x2524('0x48')](!![]);if(_0x3c36e0[_0x2524('0x45')][_0x3ed87b]){delete _0x3c36e0[_0x2524('0x45')][_0x3ed87b];}_0x3aad13[_0x2524('0x40')]();});_0x3c36e0['rules'][_0x3ed87b]['on'](_0x2524('0x49'),function(){if(_0x3c36e0[_0x2524('0x45')][_0x3ed87b]){delete _0x3c36e0[_0x2524('0x45')][_0x3ed87b];}});_0x3925fe=setTimeout(function(){logger[_0x2524('0x2d')](_0x2524('0x4a'),_0x3ed87b);endRouting(_0x3ed87b,_0x1cd6d4,_0x10deb5,_0x3c36e0);clearTimeout(_0x3925fe);_0x3933fc[_0x2524('0x48')](!![]);_0x3aad13[_0x2524('0x4b')]();},_0x47b9a4);switch(_0x1cd6d4[_0x2524('0x4c')]){case _0x2524('0x4d'):strategy[_0x2524('0x4d')](_0x3933fc,_0x1cd6d4,_0x3c36e0,_0x10deb5);break;default:strategy['beepall'](_0x3933fc,_0x1cd6d4,_0x3c36e0,_0x10deb5);}}else{logger['error'](_0x2524('0x4e'),_0x3ed87b,_0x304587['name']);_0x3aad13['stop']();}}}catch(_0x149999){console['log'](_0x149999);logger[_0x2524('0x32')](_0x2524('0x4f'),_0x3ed87b,_0x149999['stack']);_0x3aad13[_0x2524('0x40')]();}};}; \ 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 03f079a..721310c 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 _0x3ad3=['debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','notificationId','RINGING',':FORCED','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','realtime','routing','push','handleRun','bind','squeue','timeout','handleTimeout','drained','handleDrained','prototype'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0x3ad3,0x96));var _0x33ad=function(_0x46c329,_0x3cec33){_0x46c329=_0x46c329-0x0;var _0x1cd228=_0x3ad3[_0x46c329];return _0x1cd228;};'use strict';var _=require(_0x33ad('0x0'));var uuid=require(_0x33ad('0x1'));var util=require(_0x33ad('0x2'));var logger=require(_0x33ad('0x3'))('routing');var Agent=function(_0x1a7e7d,_0x356272,_0x99d599,_0x37f141){this['notificationId']=uuid['v4']();this['squeue']=_0x1a7e7d;this['agent']=_0x356272;this[_0x33ad('0x4')]=_0x99d599;this[_0x33ad('0x5')]=_0x37f141;this['squeue'][_0x33ad('0x6')](this[_0x33ad('0x7')][_0x33ad('0x8')](this),this['handleTimeout'][_0x33ad('0x8')](this));this[_0x33ad('0x9')]['on'](_0x33ad('0xa'),this[_0x33ad('0xb')][_0x33ad('0x8')](this));this[_0x33ad('0x9')]['on'](_0x33ad('0xc'),this[_0x33ad('0xd')][_0x33ad('0x8')](this));};Agent['prototype'][_0x33ad('0x6')]=function(){this[_0x33ad('0x9')]['push'](this[_0x33ad('0x7')][_0x33ad('0x8')](this),this[_0x33ad('0xb')][_0x33ad('0x8')](this));};Agent[_0x33ad('0xe')]['handleDrained']=function(){this[_0x33ad('0xb')](!![]);};Agent[_0x33ad('0xe')][_0x33ad('0x7')]=function(){logger[_0x33ad('0xf')](_0x33ad('0x10'),this[_0x33ad('0x9')]['id'],this[_0x33ad('0x11')]['id']);if(_[_0x33ad('0x12')](this[_0x33ad('0x4')][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']])){logger['debug'](_0x33ad('0x14'),this[_0x33ad('0x9')]['id'],this[_0x33ad('0x11')]['id']);setTimeout(this[_0x33ad('0x6')][_0x33ad('0x8')](this),0x3e8);}else{if(this[_0x33ad('0x5')][_0x33ad('0x15')]||util[_0x33ad('0x16')](this[_0x33ad('0x9')]['id'],this[_0x33ad('0x4')][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']],this['squeue'][_0x33ad('0x17')],![])){this['realtime'][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']][_0x33ad('0x18')]=!![];this['realtime'][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']][_0x33ad('0x19')]=undefined;util[_0x33ad('0x1a')](this[_0x33ad('0x1b')],this[_0x33ad('0x9')]['id'],this[_0x33ad('0x4')][_0x33ad('0x13')][this['agent']['id']],null,this[_0x33ad('0x5')]);util['writeLog'](this['squeue']['id'],this[_0x33ad('0x4')]['agents'][this[_0x33ad('0x11')]['id']],_0x33ad('0x1c')+(this['routing']['forcedOwnership']?_0x33ad('0x1d'):''));}else{logger[_0x33ad('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x33ad('0x9')]['id'],this[_0x33ad('0x11')]['id']);setTimeout(this[_0x33ad('0x6')]['bind'](this),0x3e8);}}};Agent[_0x33ad('0xe')][_0x33ad('0xb')]=function(_0xd3f091){if(_[_0x33ad('0x12')](this['realtime'][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']])){return logger[_0x33ad('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x33ad('0x9')]['id'],this[_0x33ad('0x11')]['id']);}else{logger[_0x33ad('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x33ad('0x9')]['id'],this[_0x33ad('0x11')]['id']);util[_0x33ad('0x1e')](this[_0x33ad('0x1b')],this[_0x33ad('0x9')]['id'],this[_0x33ad('0x4')][_0x33ad('0x13')][this['agent']['id']],null,this[_0x33ad('0x5')]);this[_0x33ad('0x4')]['agents'][this[_0x33ad('0x11')]['id']][_0x33ad('0x18')]=![];this[_0x33ad('0x4')][_0x33ad('0x13')][this['agent']['id']]['busyQueue']=undefined;util['writeLog'](this[_0x33ad('0x9')]['id'],this[_0x33ad('0x4')][_0x33ad('0x13')][this[_0x33ad('0x11')]['id']],_0xd3f091?_0x33ad('0x1f'):'TIMEOUT');}if(!_0xd3f091){setTimeout(this[_0x33ad('0x6')][_0x33ad('0x8')](this),0x3e8);}};function agent(_0xf55c5f,_0x4b9f87,_0x3f4a39,_0x3c6c27){return new Agent(_0xf55c5f,_0x4b9f87,_0x3f4a39,_0x3c6c27);}module[_0x33ad('0x20')]=agent; \ No newline at end of file +var _0x4304=['agent','realtime','handleRun','bind','timeout','handleTimeout','handleDrained','prototype','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','push','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x4304,0x199));var _0x4430=function(_0x126c97,_0x190382){_0x126c97=_0x126c97-0x0;var _0x1eba96=_0x4304[_0x126c97];return _0x1eba96;};'use strict';var _=require(_0x4430('0x0'));var uuid=require(_0x4430('0x1'));var util=require(_0x4430('0x2'));var logger=require(_0x4430('0x3'))(_0x4430('0x4'));var Agent=function(_0x2dc081,_0x424bd7,_0x253156,_0x5087ff){this[_0x4430('0x5')]=uuid['v4']();this[_0x4430('0x6')]=_0x2dc081;this[_0x4430('0x7')]=_0x424bd7;this[_0x4430('0x8')]=_0x253156;this[_0x4430('0x4')]=_0x5087ff;this[_0x4430('0x6')]['push'](this[_0x4430('0x9')][_0x4430('0xa')](this),this['handleTimeout']['bind'](this));this[_0x4430('0x6')]['on'](_0x4430('0xb'),this[_0x4430('0xc')][_0x4430('0xa')](this));this['squeue']['on']('drained',this[_0x4430('0xd')][_0x4430('0xa')](this));};Agent[_0x4430('0xe')]['push']=function(){this[_0x4430('0x6')]['push'](this['handleRun'][_0x4430('0xa')](this),this[_0x4430('0xc')][_0x4430('0xa')](this));};Agent[_0x4430('0xe')]['handleDrained']=function(){this[_0x4430('0xc')](!![]);};Agent[_0x4430('0xe')][_0x4430('0x9')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x4430('0x6')]['id'],this['agent']['id']);if(_[_0x4430('0xf')](this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']])){logger[_0x4430('0x11')](_0x4430('0x12'),this[_0x4430('0x6')]['id'],this[_0x4430('0x7')]['id']);setTimeout(this[_0x4430('0x13')][_0x4430('0xa')](this),0x3e8);}else{if(this[_0x4430('0x4')][_0x4430('0x14')]||util[_0x4430('0x15')](this[_0x4430('0x6')]['id'],this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']],this[_0x4430('0x6')][_0x4430('0x16')],![])){this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']][_0x4430('0x17')]=!![];this[_0x4430('0x8')][_0x4430('0x10')][this['agent']['id']][_0x4430('0x18')]=undefined;util[_0x4430('0x19')](this[_0x4430('0x5')],this['squeue']['id'],this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']],null,this[_0x4430('0x4')]);util[_0x4430('0x1a')](this['squeue']['id'],this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']],_0x4430('0x1b')+(this[_0x4430('0x4')][_0x4430('0x14')]?_0x4430('0x1c'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x4430('0x6')]['id'],this[_0x4430('0x7')]['id']);setTimeout(this[_0x4430('0x13')]['bind'](this),0x3e8);}}};Agent[_0x4430('0xe')][_0x4430('0xc')]=function(_0x58c9a8){if(_[_0x4430('0xf')](this[_0x4430('0x8')]['agents'][this[_0x4430('0x7')]['id']])){return logger['debug'](_0x4430('0x12'),this[_0x4430('0x6')]['id'],this['agent']['id']);}else{logger[_0x4430('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x4430('0x7')]['id']);util[_0x4430('0x1d')](this[_0x4430('0x5')],this['squeue']['id'],this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']],null,this[_0x4430('0x4')]);this['realtime'][_0x4430('0x10')][this[_0x4430('0x7')]['id']][_0x4430('0x17')]=![];this[_0x4430('0x8')][_0x4430('0x10')][this[_0x4430('0x7')]['id']][_0x4430('0x18')]=undefined;util['writeLog'](this['squeue']['id'],this[_0x4430('0x8')][_0x4430('0x10')][this['agent']['id']],_0x58c9a8?_0x4430('0x1e'):'TIMEOUT');}if(!_0x58c9a8){setTimeout(this['push'][_0x4430('0xa')](this),0x3e8);}};function agent(_0x2b56a2,_0x515b4e,_0x58a750,_0x5e4014){return new Agent(_0x2b56a2,_0x515b4e,_0x58a750,_0x5e4014);}module[_0x4430('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 01119fb..ae920ed 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 _0xd136=['length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','exports','uuid','./util','routing','notificationId','squeue','queue','realtime','push','handleTimeout','bind','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents'];(function(_0x1ec479,_0x54d127){var _0x43ca09=function(_0x18518f){while(--_0x18518f){_0x1ec479['push'](_0x1ec479['shift']());}};_0x43ca09(++_0x54d127);}(_0xd136,0x94));var _0x6d13=function(_0x3d71a4,_0x3c93d9){_0x3d71a4=_0x3d71a4-0x0;var _0x373c9e=_0xd136[_0x3d71a4];return _0x373c9e;};'use strict';var _=require('lodash');var uuid=require(_0x6d13('0x0'));var util=require(_0x6d13('0x1'));var logger=require('../../../../../config/logger')(_0x6d13('0x2'));var Beepall=function(_0x2d8f30,_0x12b9d6,_0x2a3702,_0xec09ab){this[_0x6d13('0x3')]=uuid['v4']();this[_0x6d13('0x4')]=_0x2d8f30;this[_0x6d13('0x5')]=_0x12b9d6;this[_0x6d13('0x6')]=_0x2a3702;this['routing']=_0xec09ab;this[_0x6d13('0x4')][_0x6d13('0x7')](this['handleRun']['bind'](this),this[_0x6d13('0x8')][_0x6d13('0x9')](this));this[_0x6d13('0x4')]['on'](_0x6d13('0xa'),this['handleTimeout']['bind'](this));this[_0x6d13('0x4')]['on'](_0x6d13('0xb'),this[_0x6d13('0xc')]['bind'](this));};Beepall['prototype'][_0x6d13('0x7')]=function(){this[_0x6d13('0x4')][_0x6d13('0x7')](this['handleRun'][_0x6d13('0x9')](this),this[_0x6d13('0x8')][_0x6d13('0x9')](this));};Beepall[_0x6d13('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0x6d13('0xe')]=function(){var _0x10709d=!![];if(!_[_0x6d13('0xf')](this[_0x6d13('0x5')])&&!_[_0x6d13('0xf')](this['queue'][_0x6d13('0x10')])&&this[_0x6d13('0x5')][_0x6d13('0x10')][_0x6d13('0x11')]>0x0){for(var _0x348cab=0x0,_0x3f67ba;_0x348cab0x0){for(var _0x5e8eeb=0x0,_0x1c5e03;_0x5e8eeb0x0&&_0x522924[_0x501cc7+_0x75d1('0x23')]>=_0x522924[_0x501cc7+_0x75d1('0x24')]){writeLog(_0x1d9d25,_0x522924,_0x501cc7['toUpperCase']()+_0x75d1('0x25'));return![];}}return!![];};exports[_0x75d1('0x26')]=function(_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9){return sendNotification(!![],_0x367238,_0x51138e,_0x54095d,_0x57efd6,_0x364dc9);};exports[_0x75d1('0x27')]=function(_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e){return sendNotification(![],_0x45c182,_0x468bf0,_0x38653d,_0x519ceb,_0x4d292e);};exports[_0x75d1('0x28')]=writeLog; \ No newline at end of file +var _0xdc97=['redis','localhost','socket.io-emitter','format','user:%s','name','user:save','split','\x20interaction','body','queue','msg','account','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','emit','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','../../../../../config/environment','routing'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2b07c2,_0x335794){_0x2b07c2=_0x2b07c2-0x0;var _0x28c805=_0xdc97[_0x2b07c2];return _0x28c805;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var utils=require(_0x7dc9('0x2'));var Redis=require('ioredis');var config=require(_0x7dc9('0x3'));var logger=require('../../../../../config/logger')(_0x7dc9('0x4'));config[_0x7dc9('0x5')]=_['defaults'](config[_0x7dc9('0x5')],{'host':_0x7dc9('0x6'),'port':0x18eb});var io=require(_0x7dc9('0x7'))(new Redis(config[_0x7dc9('0x5')]));function sendNotification(_0x589f02,_0x2636ef,_0x4f91c7,_0x4b3229,_0x2ff923,_0x23737d){io['to'](util[_0x7dc9('0x8')](_0x7dc9('0x9'),_0x4b3229[_0x7dc9('0xa')]))['emit'](_0x7dc9('0xb'),_0x4b3229);var _0x44fe24=_0x23737d||{};var _0x37dfc=_0x4f91c7[_0x7dc9('0xc')]('.');var _0x359c88={'uniqueid':_0x2636ef,'channel':_0x37dfc[0x0],'id':_0x37dfc[0x1],'title':_0x37dfc[0x0]+_0x7dc9('0xd'),'interactionId':_0x37dfc[0x2],'queue':_0x2ff923?_0x2ff923[_0x7dc9('0xa')]:null,'sound':_0x44fe24['account']['notificationSound'],'shake':_0x44fe24['account']['notificationShake']};try{if(!_0x44fe24[_0x7dc9('0xe')]){_0x44fe24[_0x7dc9('0xe')]={};}if(_0x2ff923){_0x44fe24['body'][_0x7dc9('0xf')]=_0x2ff923;}else if(_0x44fe24[_0x7dc9('0xe')][_0x7dc9('0xf')]){delete _0x44fe24[_0x7dc9('0xe')][_0x7dc9('0xf')];}_0x359c88[_0x7dc9('0x10')]=utils['getMustacheRender'](_0x44fe24[_0x7dc9('0x11')][_0x7dc9('0x12')],_0x44fe24);}catch(_0x1b0aa1){_0x359c88[_0x7dc9('0x10')]=_0x7dc9('0x13');logger[_0x7dc9('0x14')](util[_0x7dc9('0x8')](_0x7dc9('0x15'),_0x2636ef,_0x1b0aa1[_0x7dc9('0x16')]));}io['to'](util['format'](_0x7dc9('0x9'),_0x4b3229['name']))[_0x7dc9('0x17')](util[_0x7dc9('0x8')]('notification:%s',_0x589f02?_0x7dc9('0x18'):_0x7dc9('0x19')),_0x359c88);}function writeLog(_0x12f08d,_0x4b2703,_0x43ec33){return logger[_0x7dc9('0x1a')](util[_0x7dc9('0x8')](_0x7dc9('0x1b'),_0x12f08d,_0x4b2703[_0x7dc9('0xa')],_0x43ec33));}exports[_0x7dc9('0x1c')]=function(_0x576681,_0x593e60,_0x12954f,_0x5981e2){if(_0x593e60['busy']){writeLog(_0x576681,_0x593e60,_0x7dc9('0x1d'));return![];}if(!_0x593e60[_0x7dc9('0x1e')]){writeLog(_0x576681,_0x593e60,'OFFLINE');return![];}if(_0x593e60[_0x12954f+_0x7dc9('0x1f')]){writeLog(_0x576681,_0x593e60,_0x7dc9('0x20'));return![];}if(_0x5981e2&&_0x593e60[_0x7dc9('0x21')](_0x12954f+'Capacity')&&_0x593e60[_0x7dc9('0x21')](_0x12954f+_0x7dc9('0x22'))){if(_0x593e60[_0x12954f+_0x7dc9('0x23')]>0x0&&_0x593e60[_0x12954f+'CurrentCapacity']>=_0x593e60[_0x12954f+'Capacity']){writeLog(_0x576681,_0x593e60,_0x12954f['toUpperCase']()+_0x7dc9('0x24'));return![];}}return!![];};exports[_0x7dc9('0x25')]=function(_0x5843bf,_0x585eef,_0x47771b,_0x5afb7d,_0x2d22eb){return sendNotification(!![],_0x5843bf,_0x585eef,_0x47771b,_0x5afb7d,_0x2d22eb);};exports[_0x7dc9('0x26')]=function(_0x3a74a0,_0x3e4102,_0xa2aaa9,_0x450124,_0x236d42){return sendNotification(![],_0x3a74a0,_0x3e4102,_0xa2aaa9,_0x450124,_0x236d42);};exports[_0x7dc9('0x27')]=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 a049aff..9b16240 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 _0x7e9f=['[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','lodash','../../../../config/logger','routing','string','consequence','error','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0xfe6c7b,_0x495052){var _0x234a90=function(_0x248a60){while(--_0x248a60){_0xfe6c7b['push'](_0xfe6c7b['shift']());}};_0x234a90(++_0x495052);}(_0x7e9f,0x108));var _0xf7e9=function(_0xf276a4,_0x234bf7){_0xf276a4=_0xf276a4-0x0;var _0x3adf18=_0x7e9f[_0xf276a4];return _0x3adf18;};'use strict';var schema=require(_0xf7e9('0x0'));var sh=require('shelljs');var _=require(_0xf7e9('0x1'));var utils=require('./utils');var logger=require(_0xf7e9('0x2'))(_0xf7e9('0x3'));var system=schema({'command':{'type':_0xf7e9('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf7e9('0x5')]=function(_0x4dab7d,_0x43538a){return function(_0x4fad30){try{var _0x444138={'command':_0x43538a[0x0]};var _0x21d653=system[_0xf7e9('0x0')](_0x444138,{'typecast':!![]});if(_0x21d653['length']){logger[_0xf7e9('0x6')](_0xf7e9('0x7'),_0x4dab7d,_['map'](_0x21d653,_0xf7e9('0x8'))[_0xf7e9('0x9')](',\x20'));logger[_0xf7e9('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4dab7d);_0x4fad30[_0xf7e9('0xb')]();}else{var _0x12483e=this;var _0x4b4688=utils[_0xf7e9('0xc')](_0x43538a[0x0],this);logger[_0xf7e9('0xa')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4dab7d,_0x4b4688);sh[_0xf7e9('0xd')](_['trim'](_0x4b4688),function(_0x5664aa,_0x4530d3){logger[_0xf7e9('0xa')](_0xf7e9('0xe'),_0x4dab7d,_0x5664aa);if(_0x5664aa==0x0){var _0x136071=_0x4530d3[_0xf7e9('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x43538a[0x1])||_['isEmpty'](_0x43538a[0x1])){logger[_0xf7e9('0xa')](_0xf7e9('0x10'),_0x4dab7d);_0x12483e[_0xf7e9('0x11')][_0x43538a[0x1]]=_0x136071;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x4dab7d,_0x43538a[0x1],_0x136071);_0x12483e[_0xf7e9('0x11')][_0x43538a[0x1]]=_0x136071;}}_0x4fad30[_0xf7e9('0xb')]();});}}catch(_0x3dca43){logger['error'](_0xf7e9('0x7'),_0x4dab7d,_[_0xf7e9('0x12')](_0x3dca43)?JSON[_0xf7e9('0x13')](_0x3dca43):_0x3dca43);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4dab7d);_0x4fad30['next']();}};}; \ No newline at end of file +var _0xb0b9=['./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20%s','isObject','stringify','validate'];(function(_0x81bf2f,_0x2a705e){var _0x447f8e=function(_0x22e247){while(--_0x22e247){_0x81bf2f['push'](_0x81bf2f['shift']());}};_0x447f8e(++_0x2a705e);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x5bc870,_0x8670c5){_0x5bc870=_0x5bc870-0x0;var _0xbcdab5=_0xb0b9[_0x5bc870];return _0xbcdab5;};'use strict';var schema=require(_0x9b0b('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x9b0b('0x1'));var logger=require(_0x9b0b('0x2'))(_0x9b0b('0x3'));var system=schema({'command':{'type':_0x9b0b('0x4'),'required':!![],'message':_0x9b0b('0x5')}});exports[_0x9b0b('0x6')]=function(_0x311e29,_0x271b79){return function(_0x2b89dc){try{var _0x24d4a9={'command':_0x271b79[0x0]};var _0x2c3d97=system[_0x9b0b('0x0')](_0x24d4a9,{'typecast':!![]});if(_0x2c3d97[_0x9b0b('0x7')]){logger[_0x9b0b('0x8')]('[%s][SYSTEM]\x20%s',_0x311e29,_['map'](_0x2c3d97,_0x9b0b('0x9'))[_0x9b0b('0xa')](',\x20'));logger[_0x9b0b('0xb')](_0x9b0b('0xc'),_0x311e29);_0x2b89dc[_0x9b0b('0xd')]();}else{var _0xc07d94=this;var _0x5713db=utils[_0x9b0b('0xe')](_0x271b79[0x0],this);logger[_0x9b0b('0xb')](_0x9b0b('0xf'),_0x311e29,_0x5713db);sh[_0x9b0b('0x10')](_['trim'](_0x5713db),function(_0x5da6e7,_0x39d1f3){logger['info'](_0x9b0b('0x11'),_0x311e29,_0x5da6e7);if(_0x5da6e7==0x0){var _0x4e6739=_0x39d1f3[_0x9b0b('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x9b0b('0x13')](_0x271b79[0x1])||_['isEmpty'](_0x271b79[0x1])){logger['info'](_0x9b0b('0x14'),_0x311e29);_0xc07d94[_0x9b0b('0x15')][_0x271b79[0x1]]=_0x4e6739;}else{logger[_0x9b0b('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x311e29,_0x271b79[0x1],_0x4e6739);_0xc07d94[_0x9b0b('0x15')][_0x271b79[0x1]]=_0x4e6739;}}_0x2b89dc[_0x9b0b('0xd')]();});}}catch(_0x297b07){logger[_0x9b0b('0x8')](_0x9b0b('0x16'),_0x311e29,_[_0x9b0b('0x17')](_0x297b07)?JSON[_0x9b0b('0x18')](_0x297b07):_0x297b07);logger[_0x9b0b('0xb')](_0x9b0b('0xc'),_0x311e29);_0x2b89dc[_0x9b0b('0xd')]();}};}; \ 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 6eef801..cd0cdfa 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 _0xa339=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','next','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0xa339,0x176));var _0x9a33=function(_0x412158,_0xce52f1){_0x412158=_0x412158-0x0;var _0x1c496b=_0xa339[_0x412158];return _0x1c496b;};'use strict';var schema=require(_0x9a33('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x9a33('0x1')),'openchannelInteraction':require(_0x9a33('0x2')),'smsInteraction':require(_0x9a33('0x3')),'mailInteraction':require(_0x9a33('0x4')),'faxInteraction':require(_0x9a33('0x5')),'whatsappInteraction':require(_0x9a33('0x6'))};var logger=require(_0x9a33('0x7'))(_0x9a33('0x8'));var tag=schema({'tag':{'type':_0x9a33('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9a33('0xa')]=function(_0x9343b2,_0x48a5f4,_0xa4fa91,_0x28d382){return function(_0x172152){try{var _0x36c62a={'tag':_0x48a5f4[0x0]};var _0x52acca=tag[_0x9a33('0x0')](_0x36c62a,{'typecast':!![]});if(_0x52acca[_0x9a33('0xb')]){logger[_0x9a33('0xc')]('[%s][TAG]\x20%s',_0x9343b2,_[_0x9a33('0xd')](_0x52acca,'message')[_0x9a33('0xe')](',\x20'));logger[_0x9a33('0xf')](_0x9a33('0x10'),_0x9343b2);_0x172152['next']();}else{var _0x524f76={'ids':[_0x48a5f4[0x0]]};if(rpc[_0x28d382[_0x9a33('0x11')]+_0x9a33('0x12')]){rpc[_0x28d382['channel']+_0x9a33('0x12')][_0x9a33('0x13')](_0x28d382[_0x9a33('0x14')]['id'],_0x524f76)[_0x9a33('0x15')](function(_0x5448f1){logger[_0x9a33('0xf')](_0x9a33('0x16'),_0x9343b2,_0x48a5f4[0x1],_0x28d382[_0x9a33('0x11')],_0x28d382[_0x9a33('0x14')]['id']);})[_0x9a33('0x17')](function(_0x29b417){logger[_0x9a33('0xc')](_0x9a33('0x18'),_0x9343b2,JSON[_0x9a33('0x19')](_0x29b417));logger['info'](_0x9a33('0x10'),_0x9343b2);})[_0x9a33('0x1a')](function(){_0x172152['next']();});}}}catch(_0x414c11){logger[_0x9a33('0xc')]('[%s][TAG]\x20%s',_0x9343b2,_[_0x9a33('0x1b')](_0x414c11)?JSON[_0x9a33('0x19')](_0x414c11):_0x414c11);logger[_0x9a33('0xf')](_0x9a33('0x10'),_0x9343b2);_0x172152[_0x9a33('0x1c')]();}};}; \ No newline at end of file +var _0x04bf=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','consequence','validate','length','error','map','message','join','info','next','channel','Interaction','interaction','then','[%s][TAG]\x20%s','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x52f4a5,_0x364ed3){var _0xfafffa=function(_0xa2cc09){while(--_0xa2cc09){_0x52f4a5['push'](_0x52f4a5['shift']());}};_0xfafffa(++_0x364ed3);}(_0x04bf,0xac));var _0xf04b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x04bf[_0x46698a];return _0x356db0;};'use strict';var schema=require('validate');var _=require(_0xf04b('0x0'));var rpc={'chatInteraction':require(_0xf04b('0x1')),'openchannelInteraction':require(_0xf04b('0x2')),'smsInteraction':require(_0xf04b('0x3')),'mailInteraction':require(_0xf04b('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xf04b('0x5'))(_0xf04b('0x6'));var tag=schema({'tag':{'type':_0xf04b('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf04b('0x8')]=function(_0x3701bb,_0x11358d,_0x446cc0,_0x2ef42d){return function(_0x50c260){try{var _0x2f1cd3={'tag':_0x11358d[0x0]};var _0x329ab9=tag[_0xf04b('0x9')](_0x2f1cd3,{'typecast':!![]});if(_0x329ab9[_0xf04b('0xa')]){logger[_0xf04b('0xb')]('[%s][TAG]\x20%s',_0x3701bb,_[_0xf04b('0xc')](_0x329ab9,_0xf04b('0xd'))[_0xf04b('0xe')](',\x20'));logger[_0xf04b('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3701bb);_0x50c260[_0xf04b('0x10')]();}else{var _0x351ec9={'ids':[_0x11358d[0x0]]};if(rpc[_0x2ef42d[_0xf04b('0x11')]+'Interaction']){rpc[_0x2ef42d[_0xf04b('0x11')]+_0xf04b('0x12')]['addTags'](_0x2ef42d[_0xf04b('0x13')]['id'],_0x351ec9)[_0xf04b('0x14')](function(_0x4b7485){logger[_0xf04b('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x3701bb,_0x11358d[0x1],_0x2ef42d[_0xf04b('0x11')],_0x2ef42d['interaction']['id']);})['catch'](function(_0x3becdc){logger[_0xf04b('0xb')](_0xf04b('0x15'),_0x3701bb,JSON['stringify'](_0x3becdc));logger[_0xf04b('0xf')](_0xf04b('0x16'),_0x3701bb);})[_0xf04b('0x17')](function(){_0x50c260[_0xf04b('0x10')]();});}}}catch(_0x587124){logger[_0xf04b('0xb')](_0xf04b('0x15'),_0x3701bb,_[_0xf04b('0x18')](_0x587124)?JSON['stringify'](_0x587124):_0x587124);logger[_0xf04b('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3701bb);_0x50c260['next']();}};}; \ 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 b276324..e79492f 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 _0xac35=['[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId=','&data=','info'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xac35,0xb1));var _0x5ac3=function(_0x1ad660,_0x18483b){_0x1ad660=_0x1ad660-0x0;var _0xcf177c=_0xac35[_0x1ad660];return _0xcf177c;};'use strict';var rp=require(_0x5ac3('0x0'));var logger=require(_0x5ac3('0x1'))(_0x5ac3('0x2'));var _=require('lodash');var arr=[];exports[_0x5ac3('0x3')]=function(_0x5587b4,_0x527272){return function(_0x18d6fb){var _0x59c29c=_0x527272[0xa];var _0x50ff42=_0x527272[0xb];var _0x59a7dc=_0x527272[0xc];var _0x2b6cd9=_0x527272[0xd];var _0x5c2738=_0x527272[0xe];var _0x48ce51=_0x527272[0xf][_0x5ac3('0x4')](/\n/g,_0x5ac3('0x5'));var _0xd901ff=_0x527272[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x5ac3('0x6')](_0x50ff42)){arr[_0x5ac3('0x7')](_0x50ff42);var _0x45a69f=_0x527272[0x3];var _0x3233a0=_0x527272[0x4];var _0x3668d0=_0x527272[0x1];var _0x1d90c4=_0x527272[0x0];var _0x1b24fc={};_0x1b24fc['urlOnAnswer']=_0x527272[0x8]+_0x5ac3('0x8')+_0x59a7dc+'|'+_0x59c29c+'|'+_0x2b6cd9+'|'+_0x50ff42+'|'+_0x5c2738;_0x1b24fc[_0x5ac3('0x9')]=_0x527272[0x7]+_0x5ac3('0x8')+_0x59a7dc+'|'+_0x59c29c+'|'+_0x2b6cd9+'|'+_0x50ff42+'|'+_0x5c2738+'|'+_0x48ce51+'|'+_0xd901ff;_0x1b24fc['title']=_0x527272[0x9];var _0x22d9d1={};_0x22d9d1[_0x5ac3('0xa')]=_0x5ac3('0xb');_0x22d9d1[_0x5ac3('0xc')]=_0x5ac3('0xd');var _0x1099d9=[];_0x1099d9[_0x5ac3('0x7')](_0x527272[0x2]);_0x1099d9['push'](_0x527272[0x5]);_0x1099d9[_0x5ac3('0x7')](_0x527272[0x6]);_0x22d9d1[_0x5ac3('0xe')]=_0x1099d9;_0x22d9d1['id']=0x1;var _0x6bc8e8=JSON[_0x5ac3('0xf')](_0x22d9d1);var _0x3480f1={'encoding':_0x5ac3('0x10'),'method':_0x5ac3('0x11'),'timeout':0x2710,'url':_0x45a69f,'headers':{'Content-Type':_0x5ac3('0x12')},'body':_0x6bc8e8};return rp(_0x3480f1)[_0x5ac3('0x13')](function(_0x529da4){const _0x540eb7=JSON[_0x5ac3('0x14')](_0x529da4);if(!_0x540eb7[_0x5ac3('0x15')]['logged']){throw new Error(_0x5ac3('0x16'));}var _0x247b3b=_0x50ff42;var _0x310a0a='channelId='+_0x3668d0+_0x5ac3('0x17')+_0x1d90c4+_0x5ac3('0x18')+_0x247b3b+_0x5ac3('0x19')+JSON[_0x5ac3('0xf')](_0x1b24fc);var _0x11de21=_0x3233a0+'?'+_0x310a0a;return rp(_0x11de21);})[_0x5ac3('0x13')](function(_0x7435a7){logger[_0x5ac3('0x1a')](_0x5ac3('0x1b'),_0x5587b4,_0x7435a7);_0x18d6fb['stop']();})[_0x5ac3('0x1c')](function(_0x1d28bf){logger[_0x5ac3('0x1d')](_0x5ac3('0x1e'),_0x5587b4,_['isObject'](_0x1d28bf)?JSON[_0x5ac3('0xf')](_0x1d28bf):_0x1d28bf);_0x18d6fb[_0x5ac3('0x1f')]();});}else{logger['info'](_0x5ac3('0x20'),_0x5587b4);_0x18d6fb[_0x5ac3('0x21')]();}};}; \ No newline at end of file +var _0x1f2f=['login','params','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','replace','includes','push','urlOnAnswer','?params=','urlOnRing'];(function(_0x507a68,_0x2848de){var _0x2ae31f=function(_0xbc89ee){while(--_0xbc89ee){_0x507a68['push'](_0x507a68['shift']());}};_0x2ae31f(++_0x2848de);}(_0x1f2f,0x105));var _0xf1f2=function(_0xef3ae2,_0x4c63b8){_0xef3ae2=_0xef3ae2-0x0;var _0x1cc22b=_0x1f2f[_0xef3ae2];return _0x1cc22b;};'use strict';var rp=require(_0xf1f2('0x0'));var logger=require(_0xf1f2('0x1'))('routing');var _=require(_0xf1f2('0x2'));var arr=[];exports['consequence']=function(_0x1aefc8,_0x26587c){return function(_0x5cb31f){var _0x2129c3=_0x26587c[0xa];var _0x1071de=_0x26587c[0xb];var _0x1c86c1=_0x26587c[0xc];var _0xcedf7=_0x26587c[0xd];var _0x2c2a8a=_0x26587c[0xe];var _0x306cee=_0x26587c[0xf][_0xf1f2('0x3')](/\n/g,'\x20-\x20');var _0xe82dd4=_0x26587c[0x10][_0xf1f2('0x3')](/\n/g,'\x20');if(!arr[_0xf1f2('0x4')](_0x1071de)){arr[_0xf1f2('0x5')](_0x1071de);var _0x49ed9d=_0x26587c[0x3];var _0x112973=_0x26587c[0x4];var _0x53f23b=_0x26587c[0x1];var _0x3e49f6=_0x26587c[0x0];var _0x395fb6={};_0x395fb6[_0xf1f2('0x6')]=_0x26587c[0x8]+_0xf1f2('0x7')+_0x1c86c1+'|'+_0x2129c3+'|'+_0xcedf7+'|'+_0x1071de+'|'+_0x2c2a8a;_0x395fb6[_0xf1f2('0x8')]=_0x26587c[0x7]+_0xf1f2('0x7')+_0x1c86c1+'|'+_0x2129c3+'|'+_0xcedf7+'|'+_0x1071de+'|'+_0x2c2a8a+'|'+_0x306cee+'|'+_0xe82dd4;_0x395fb6['title']=_0x26587c[0x9];var _0x5b3569={};_0x5b3569['jsonrpc']='2.0';_0x5b3569['method']=_0xf1f2('0x9');var _0x25d03c=[];_0x25d03c[_0xf1f2('0x5')](_0x26587c[0x2]);_0x25d03c[_0xf1f2('0x5')](_0x26587c[0x5]);_0x25d03c[_0xf1f2('0x5')](_0x26587c[0x6]);_0x5b3569[_0xf1f2('0xa')]=_0x25d03c;_0x5b3569['id']=0x1;var _0x357151=JSON['stringify'](_0x5b3569);var _0x44cdd8={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x49ed9d,'headers':{'Content-Type':'application/json-rpc'},'body':_0x357151};return rp(_0x44cdd8)[_0xf1f2('0xb')](function(_0x5d1efd){const _0x50db67=JSON[_0xf1f2('0xc')](_0x5d1efd);if(!_0x50db67['result']['logged']){throw new Error(_0xf1f2('0xd'));}var _0x2f9277=_0x1071de;var _0x171ade=_0xf1f2('0xe')+_0x53f23b+_0xf1f2('0xf')+_0x3e49f6+_0xf1f2('0x10')+_0x2f9277+_0xf1f2('0x11')+JSON[_0xf1f2('0x12')](_0x395fb6);var _0x251e5b=_0x112973+'?'+_0x171ade;return rp(_0x251e5b);})[_0xf1f2('0xb')](function(_0x498ce7){logger[_0xf1f2('0x13')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x1aefc8,_0x498ce7);_0x5cb31f[_0xf1f2('0x14')]();})[_0xf1f2('0x15')](function(_0x4a23fd){logger[_0xf1f2('0x16')](_0xf1f2('0x17'),_0x1aefc8,_[_0xf1f2('0x18')](_0x4a23fd)?JSON['stringify'](_0x4a23fd):_0x4a23fd);_0x5cb31f['stop']();});}else{logger[_0xf1f2('0x13')](_0xf1f2('0x19'),_0x1aefc8);_0x5cb31f[_0xf1f2('0x1a')]();}};}; \ 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 4d783b6..fd55e43 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x5adc84,_0x4e6d19){var _0x25fc49=function(_0x41c9ee){while(--_0x41c9ee){_0x5adc84['push'](_0x5adc84['shift']());}};_0x25fc49(++_0x4e6d19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x347d73,_0x221681){var _0x25fe2a=function(_0x1afa32){while(--_0x1afa32){_0x347d73['push'](_0x347d73['shift']());}};_0x25fe2a(++_0x221681);}(_0xe706,0xa3));var _0x6e70=function(_0x1781f9,_0x5c36a3){_0x1781f9=_0x1781f9-0x0;var _0x4bd468=_0xe706[_0x1781f9];return _0x4bd468;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3ad9fd7..5c17173 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 _0xb469=['update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','values','find','chatQueues','name','paused','mailQueues','loggedIn','waiting','openchannelQueues','available','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','%s.%s.%s','isNil','Intervals','map','interval','listen','rules','message','interaction','applications','app','.js','toLowerCase','appdata','channel','push','slice','length','join','dialogflow','split','dialogflowv2','amazonlex','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agents','agent','busy','busyQueue','end','QueueReport'];(function(_0x4e92e3,_0x29378f){var _0xa8bd1a=function(_0x7faf01){while(--_0x7faf01){_0x4e92e3['push'](_0x4e92e3['shift']());}};_0xa8bd1a(++_0x29378f);}(_0xb469,0x13b));var _0x9b46=function(_0x18242a,_0x3f4db5){_0x18242a=_0x18242a-0x0;var _0xc6f567=_0xb469[_0x18242a];return _0xc6f567;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var fs=require('fs');var jayson=require(_0x9b46('0x3'));var BPromise=require(_0x9b46('0x4'));var utils=require(_0x9b46('0x5'));var logger=require(_0x9b46('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x9b46('0x7')),'mailQueueReport':require(_0x9b46('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9b46('0x9')),'faxQueueReport':require(_0x9b46('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x9b46('0xb'));function getId(_0x5bd834,_0x4c1ed9,_0x34c0de){return util['format'](_0x9b46('0xc'),_0x5bd834,_0x4c1ed9||0x0,_0x34c0de||0x0);}function getIntervals(_0xb9d1b5,_0x43a112){var _0x47adeb=[];if(!_[_0x9b46('0xd')](_0x43a112['IntervalId'])&&!_[_0x9b46('0xd')](_0xb9d1b5[_0x43a112['IntervalId']])&&!_[_0x9b46('0xd')](_0xb9d1b5[_0x43a112['IntervalId']][_0x9b46('0xe')])){_0x47adeb=_[_0x9b46('0xf')](_0xb9d1b5[_0x43a112['IntervalId']][_0x9b46('0xe')],_0x9b46('0x10'));}else if(!_['isNil'](_0x43a112[_0x9b46('0x10')])){_0x47adeb=[_0x43a112[_0x9b46('0x10')]];}return _0x47adeb;}exports[_0x9b46('0x11')]=function(_0x467086){_0x467086[_0x9b46('0x12')]={};return new BPromise(function(_0x35c5c1,_0x2136bc){var _0x2e70c3={'Start':function(_0x3f2b28){var _0x178293=this;return new Promise(function(_0xbc1ba6,_0x135cc2){if(_0x3f2b28){try{var _0x1e6911=[];var _0x559bdf=getId(_0x3f2b28['channel'],_0x3f2b28['message']?_0x3f2b28[_0x9b46('0x13')]['id']:0x0,_0x3f2b28[_0x9b46('0x14')]?_0x3f2b28[_0x9b46('0x14')]['id']:0x0);if(_0x3f2b28['applications']&&_['isArray'](_0x3f2b28[_0x9b46('0x15')])&&_0x3f2b28['applications']['length']){for(var _0xfeb1b9=0x0;_0xfeb1b9<_0x3f2b28[_0x9b46('0x15')]['length'];_0xfeb1b9+=0x1){var _0x2fd8f9=_0x3f2b28[_0x9b46('0x15')][_0xfeb1b9];if(fs['existsSync'](path['join'](__dirname,_0x9b46('0x15'),_0x2fd8f9[_0x9b46('0x16')]+_0x9b46('0x17')))){var _0x4e4c7d=[];switch(_0x2fd8f9['app'][_0x9b46('0x18')]()){case'autoreply':var _0x21dacb=_0x2fd8f9[_0x9b46('0x19')]['split'](',');if(_0x3f2b28[_0x9b46('0x1a')]==='mail'){_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x1]);_0x4e4c7d['push'](_0x21dacb[_0x9b46('0x1c')](0x2,_0x21dacb[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));}else{_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x21dacb[_0x9b46('0x1c')](0x1,_0x21dacb[_0x9b46('0x1d')])['join'](','));}break;case _0x9b46('0x1f'):var _0x3ac37e=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x3ac37e['slice'](0x2,_0x3ac37e[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));break;case _0x9b46('0x21'):var _0x376ccc=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x376ccc['slice'](0x4,_0x376ccc[_0x9b46('0x1d')])[_0x9b46('0x1e')](','));break;case _0x9b46('0x22'):var _0x1ce069=_0x2fd8f9[_0x9b46('0x19')][_0x9b46('0x20')](',');_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x0]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x1ce069['slice'](0x4,_0x1ce069[_0x9b46('0x1d')])['join'](','));break;case _0x9b46('0x13'):_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x19')]);break;case'tag':_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x23')]);_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x19')]);break;case _0x9b46('0x24'):var _0x5cb73f=utils['getMustacheRender'](_0x3f2b28[_0x9b46('0x25')][_0x9b46('0x26')],_0x3f2b28);var _0x47367a=_0x2fd8f9[_0x9b46('0x19')]['split'](',');_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x0]);_0x4e4c7d['push'](_0x47367a[0x1]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x2]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x3]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x4]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x5]);_0x4e4c7d['push'](_0x47367a[0x6]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x7]);_0x4e4c7d['push'](_0x47367a[0x8]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0x9]);_0x4e4c7d[_0x9b46('0x1b')](_0x47367a[0xa]);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x14')]['id']);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x13')]['id']);_0x4e4c7d[_0x9b46('0x1b')](_0x2fd8f9[_0x9b46('0x27')]);_0x4e4c7d[_0x9b46('0x1b')](_0x3f2b28[_0x9b46('0x14')][_0x9b46('0x28')]);_0x4e4c7d['push'](_0x3f2b28[_0x9b46('0x29')]['body']);_0x4e4c7d[_0x9b46('0x1b')](_0x5cb73f);break;default:_0x4e4c7d=_[_0x9b46('0xd')](_0x2fd8f9['appdata'])?[]:_0x2fd8f9[_0x9b46('0x19')]['split'](',');}var _0x416538={'id':util['format'](_0x9b46('0x2a'),_0x559bdf,_0x2fd8f9['id'],_0x2fd8f9[_0x9b46('0x16')]),'condition':require(_0x9b46('0x2b'))[_0x9b46('0x2c')](_0x559bdf,getIntervals(_0x467086[_0x9b46('0x2d')],_0x2fd8f9),_0x467086),'consequence':require('./applications/'+_0x2fd8f9['app'])[_0x9b46('0x2e')](_0x559bdf,_0x4e4c7d,_0x467086,_0x3f2b28),'p':_0x2fd8f9['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x416538['id'],'on\x20interval',getIntervals(_0x467086[_0x9b46('0x2d')],_0x2fd8f9)['join'](_0x9b46('0x2f')));_0x1e6911['push'](_0x416538);}else{logger[_0x9b46('0x30')](_0x9b46('0x31'),path[_0x9b46('0x1e')](__dirname,_0x9b46('0x15'),_0x2fd8f9[_0x9b46('0x16')]+_0x9b46('0x17')));}}_0x467086[_0x9b46('0x12')][_0x559bdf]=new RuleEngine(_0x1e6911);_0x467086[_0x9b46('0x12')][_0x559bdf][_0x9b46('0x32')](_0x3f2b28,function(_0x5602a9){logger[_0x9b46('0x33')](_0x9b46('0x34'),JSON[_0x9b46('0x35')](_0x5602a9[_0x9b46('0x36')]));if(_0x467086[_0x9b46('0x12')][_0x559bdf]){_0x467086[_0x9b46('0x12')][_0x559bdf][_0x9b46('0x37')](_0x9b46('0x38'));}});return _0xbc1ba6({'code':0xc8,'message':_0x3f2b28});}else{logger[_0x9b46('0x33')](_0x9b46('0x39'));return _0xbc1ba6({'code':0xc8,'message':_0x3f2b28});}}catch(_0x1f3b2b){logger[_0x9b46('0x30')](_0x1f3b2b[_0x9b46('0x3a')]);return _0x135cc2(_0x178293[_0x9b46('0x30')](0x1f4,_0x1f3b2b));}}return _0x135cc2('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4a62c6){var _0xf81543=this;return new Promise(function(_0x23df60,_0x309a4f){if(_0x4a62c6['agent']&&_0x4a62c6['agent']['id']){if(_0x467086[_0x9b46('0x3b')][_0x4a62c6[_0x9b46('0x3c')]['id']]){_0x467086[_0x9b46('0x3b')][_0x4a62c6[_0x9b46('0x3c')]['id']][_0x9b46('0x3d')]=![];_0x467086[_0x9b46('0x3b')][_0x4a62c6['agent']['id']][_0x9b46('0x3e')]=undefined;}}if(_0x4a62c6[_0x9b46('0x13')]&&_0x4a62c6[_0x9b46('0x13')]['id']){try{var _0x47a938=getId(_0x4a62c6[_0x9b46('0x1a')],_0x4a62c6['message']?_0x4a62c6[_0x9b46('0x13')]['id']:0x0,_0x4a62c6[_0x9b46('0x14')]?_0x4a62c6[_0x9b46('0x14')]['id']:0x0);if(_0x467086['rules'][_0x47a938]){_0x467086[_0x9b46('0x12')][_0x47a938][_0x9b46('0x37')](_0x9b46('0x3f'));if(rpc[_0x4a62c6[_0x9b46('0x1a')]+_0x9b46('0x40')]){rpc[_0x4a62c6[_0x9b46('0x1a')]+'QueueReport'][_0x9b46('0x41')](_0x47a938,{'UserId':_0x4a62c6[_0x9b46('0x13')][_0x9b46('0x42')]})[_0x9b46('0x43')](function(){logger[_0x9b46('0x30')](_0x9b46('0x44'));});}}return _0x23df60({'code':0xc8,'message':_0x4a62c6});}catch(_0x4a1df0){logger[_0x9b46('0x30')](_0x4a1df0['stack']);return _0x309a4f(_0xf81543[_0x9b46('0x30')](0x1f4,_0x4a1df0));}}logger[_0x9b46('0x30')](_0x9b46('0x45'));return _0x309a4f(_0xf81543[_0x9b46('0x30')](0x1f4,_0x9b46('0x45')));});},'RejectMessage':function(_0x5f5ce9){var _0x15dbb0=this;return new Promise(function(_0x1c7e5d,_0x3d65ad){if(_0x5f5ce9[_0x9b46('0x3c')]&&_0x5f5ce9[_0x9b46('0x3c')]['id']){try{if(_0x467086[_0x9b46('0x3b')][_0x5f5ce9[_0x9b46('0x3c')]['id']]){_0x467086[_0x9b46('0x3b')][_0x5f5ce9[_0x9b46('0x3c')]['id']][_0x9b46('0x3d')]=![];_0x467086[_0x9b46('0x3b')][_0x5f5ce9['agent']['id']]['busyQueue']=undefined;}return _0x1c7e5d({'code':0xc8,'message':_0x5f5ce9});}catch(_0x496006){logger[_0x9b46('0x30')](_0x496006['stack']);return _0x3d65ad(_0x15dbb0[_0x9b46('0x30')](0x1f4,_0x496006));}}logger['error'](_0x9b46('0x45'));return _0x3d65ad(_0x15dbb0['error'](0x1f4,_0x9b46('0x45')));});},'AbandonInteraction':function(_0x443ccd){var _0x15e3d6=this;return new Promise(function(_0x52463b,_0x35f71d){if(_0x443ccd['channel']&&_0x443ccd[_0x9b46('0x14')]&&_0x443ccd[_0x9b46('0x14')]['id']){try{var _0x2c77d2=getId(_0x443ccd[_0x9b46('0x1a')],_0x443ccd[_0x9b46('0x13')]?_0x443ccd['message']['id']:0x0,_0x443ccd['interaction']?_0x443ccd[_0x9b46('0x14')]['id']:0x0);if(_0x467086[_0x9b46('0x12')][_0x2c77d2]){_0x467086[_0x9b46('0x12')][_0x2c77d2][_0x9b46('0x37')](_0x9b46('0x3f'));}return _0x52463b({'code':0xc8,'message':_0x443ccd});}catch(_0x164167){logger[_0x9b46('0x30')](_0x164167[_0x9b46('0x3a')]);return _0x35f71d(_0x15e3d6['error'](0x1f4,_0x164167));}}logger[_0x9b46('0x30')](_0x9b46('0x45'));return _0x35f71d(_0x15e3d6[_0x9b46('0x30')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x46dffa){var _0x145200=this;return new Promise(function(_0x1aa8c6,_0x12d825){if(_0x467086[_0x9b46('0x3b')][_0x9b46('0x46')](_0x46dffa['id'])){for(var _0x4b79a4 in _0x46dffa[_0x9b46('0x47')]){if(_0x46dffa[_0x9b46('0x47')][_0x9b46('0x46')](_0x4b79a4)){if(_0x467086[_0x9b46('0x3b')][_0x46dffa['id']][_0x9b46('0x46')](_0x4b79a4+_0x9b46('0x48'))){_0x467086['agents'][_0x46dffa['id']][_0x4b79a4+_0x9b46('0x48')]=parseInt(_0x46dffa['capacity'][_0x4b79a4],0xa);}}}_0x467086[_0x9b46('0x3b')][_0x46dffa['id']]['updateRealtime']();return _0x1aa8c6({'code':0xc8,'message':_0x467086[_0x9b46('0x3b')][_0x46dffa['id']]});}else{return _0x12d825(_0x145200[_0x9b46('0x30')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x171ad2){return new Promise(function(_0x1cc2f3){var _0x3abe23=_[_0x9b46('0x49')](_0x467086[_0x9b46('0x3b')]);if(_0x171ad2&&_0x171ad2['id']){var _0x5b9ec2=_[_0x9b46('0x4a')](_0x3abe23,function(_0x343a1e){return _0x343a1e['id']===_0x171ad2['id'];});_0x1cc2f3(_0x5b9ec2);}else{_0x1cc2f3({'count':_0x3abe23['length'],'rows':_0x3abe23});}});},'ChatQueues':function(){return new Promise(function(_0x4cf4ba){var _0x3aca4b=[];for(var _0x2801bb in _0x467086[_0x9b46('0x4b')]){if(_0x467086[_0x9b46('0x4b')][_0x9b46('0x46')](_0x2801bb)){var _0x1a6516=_0x467086[_0x9b46('0x4b')][_0x2801bb];var _0x19aa34={'id':_0x1a6516['id'],'available':_0x1a6516['available'],'loggedIn':_0x1a6516['loggedIn'],'name':_0x1a6516[_0x9b46('0x4c')],'paused':_0x1a6516[_0x9b46('0x4d')],'waiting':_0x1a6516['waiting']};_0x3aca4b[_0x9b46('0x1b')](_0x19aa34);}}_0x4cf4ba({'count':_0x3aca4b['length'],'rows':_0x3aca4b});});},'MailQueues':function(){return new Promise(function(_0x33d1ab){var _0x501544=[];for(var _0xf6f92 in _0x467086[_0x9b46('0x4e')]){if(_0x467086[_0x9b46('0x4e')]['hasOwnProperty'](_0xf6f92)){var _0x271ae8=_0x467086[_0x9b46('0x4e')][_0xf6f92];var _0xad2666={'id':_0x271ae8['id'],'available':_0x271ae8['available'],'loggedIn':_0x271ae8[_0x9b46('0x4f')],'name':_0x271ae8[_0x9b46('0x4c')],'paused':_0x271ae8[_0x9b46('0x4d')],'waiting':_0x271ae8[_0x9b46('0x50')]};_0x501544[_0x9b46('0x1b')](_0xad2666);}}_0x33d1ab({'count':_0x501544['length'],'rows':_0x501544});});},'OpenchannelQueues':function(){return new Promise(function(_0x5321c1){var _0x5386ef=[];for(var _0x533a4f in _0x467086['openchannelQueues']){if(_0x467086[_0x9b46('0x51')][_0x9b46('0x46')](_0x533a4f)){var _0x11243a=_0x467086[_0x9b46('0x51')][_0x533a4f];var _0x368cd2={'id':_0x11243a['id'],'available':_0x11243a[_0x9b46('0x52')],'loggedIn':_0x11243a[_0x9b46('0x4f')],'name':_0x11243a[_0x9b46('0x4c')],'paused':_0x11243a['paused'],'waiting':_0x11243a[_0x9b46('0x50')]};_0x5386ef[_0x9b46('0x1b')](_0x368cd2);}}_0x5321c1({'count':_0x5386ef['length'],'rows':_0x5386ef});});},'SmsQueues':function(){return new Promise(function(_0xb3e39e){var _0x4ea405=[];for(var _0x1f3e9e in _0x467086[_0x9b46('0x53')]){if(_0x467086[_0x9b46('0x53')][_0x9b46('0x46')](_0x1f3e9e)){var _0x453a53=_0x467086['smsQueues'][_0x1f3e9e];var _0x4e1175={'id':_0x453a53['id'],'available':_0x453a53[_0x9b46('0x52')],'loggedIn':_0x453a53['loggedIn'],'name':_0x453a53[_0x9b46('0x4c')],'paused':_0x453a53[_0x9b46('0x4d')],'waiting':_0x453a53['waiting']};_0x4ea405['push'](_0x4e1175);}}_0xb3e39e({'count':_0x4ea405['length'],'rows':_0x4ea405});});},'FaxQueues':function(){return new Promise(function(_0x2978aa){var _0x4a4e9a=[];for(var _0x56b870 in _0x467086[_0x9b46('0x54')]){if(_0x467086[_0x9b46('0x54')][_0x9b46('0x46')](_0x56b870)){var _0x1fa19d=_0x467086['faxQueues'][_0x56b870];var _0x46a294={'id':_0x1fa19d['id'],'available':_0x1fa19d[_0x9b46('0x52')],'loggedIn':_0x1fa19d[_0x9b46('0x4f')],'name':_0x1fa19d['name'],'paused':_0x1fa19d['paused'],'waiting':_0x1fa19d[_0x9b46('0x50')]};_0x4a4e9a[_0x9b46('0x1b')](_0x46a294);}}_0x2978aa({'count':_0x4a4e9a[_0x9b46('0x1d')],'rows':_0x4a4e9a});});},'WhatsappQueues':function(){return new Promise(function(_0x4fa1ad){var _0x2f60a3=[];for(var _0x3a1e1e in _0x467086['whatsappQueues']){if(_0x467086[_0x9b46('0x55')][_0x9b46('0x46')](_0x3a1e1e)){var _0x346a6c=_0x467086[_0x9b46('0x55')][_0x3a1e1e];var _0x4de02d={'id':_0x346a6c['id'],'available':_0x346a6c['available'],'loggedIn':_0x346a6c[_0x9b46('0x4f')],'name':_0x346a6c['name'],'paused':_0x346a6c[_0x9b46('0x4d')],'waiting':_0x346a6c[_0x9b46('0x50')]};_0x2f60a3['push'](_0x4de02d);}}_0x4fa1ad({'count':_0x2f60a3['length'],'rows':_0x2f60a3});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x536083){var _0x8bf222=_['values'](_0x467086[_0x9b46('0x56')]);_0x536083({'count':_0x8bf222[_0x9b46('0x1d')],'rows':_0x8bf222});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1f52c5){var _0x18006a=_['values'](_0x467086[_0x9b46('0x57')]);_0x1f52c5({'count':_0x18006a[_0x9b46('0x1d')],'rows':_0x18006a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xf1bc8d){var _0x195cf0=_[_0x9b46('0x49')](_0x467086['openchannelQueuesWaitingInteractions']);_0xf1bc8d({'count':_0x195cf0[_0x9b46('0x1d')],'rows':_0x195cf0});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x591820){var _0x254c71=_[_0x9b46('0x49')](_0x467086['smsQueuesWaitingInteractions']);_0x591820({'count':_0x254c71[_0x9b46('0x1d')],'rows':_0x254c71});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4ffaee){var _0x3c0b46=_[_0x9b46('0x49')](_0x467086['faxQueuesWaitingInteractions']);_0x4ffaee({'count':_0x3c0b46[_0x9b46('0x1d')],'rows':_0x3c0b46});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x526e70){var _0x2cbca2=_[_0x9b46('0x49')](_0x467086[_0x9b46('0x58')]);_0x526e70({'count':_0x2cbca2['length'],'rows':_0x2cbca2});});}};var _0xe27fd6=jayson[_0x9b46('0x59')](_0x2e70c3)[_0x9b46('0x5a')]();_0xe27fd6['on'](_0x9b46('0x30'),function(_0x48f236){logger[_0x9b46('0x30')](JSON['stringify'](_0x48f236));return _0x2136bc(_0x48f236);});_0xe27fd6[_0x9b46('0x11')](0x232c,_0x9b46('0x5b'),function(){console[_0x9b46('0x5c')](_0x9b46('0x5d'),0x232c);return _0x35c5c1(_0x9b46('0x5e')+0x232c);});});}; \ No newline at end of file +var _0x39cb=['update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','split','mail','push','slice','join','appdata','dialogflowv2','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','complete','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport'];(function(_0x2c138f,_0x2c8b8a){var _0x3f4290=function(_0x2f1d9e){while(--_0x2f1d9e){_0x2c138f['push'](_0x2c138f['shift']());}};_0x3f4290(++_0x2c8b8a);}(_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 path=require(_0xb39c('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb39c('0x2'));var utils=require(_0xb39c('0x3'));var logger=require('../../../config/logger')(_0xb39c('0x4'));var rpc={'openchannelQueueReport':require(_0xb39c('0x5')),'mailQueueReport':require(_0xb39c('0x6')),'chatQueueReport':require(_0xb39c('0x7')),'smsQueueReport':require(_0xb39c('0x8')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xb39c('0x9'))};var RuleEngine=require(_0xb39c('0xa'));function getId(_0x40112f,_0x3f2fbe,_0x47d6d7){return util['format'](_0xb39c('0xb'),_0x40112f,_0x3f2fbe||0x0,_0x47d6d7||0x0);}function getIntervals(_0x7aa397,_0x3ffb94){var _0x42c6dc=[];if(!_['isNil'](_0x3ffb94['IntervalId'])&&!_['isNil'](_0x7aa397[_0x3ffb94[_0xb39c('0xc')]])&&!_[_0xb39c('0xd')](_0x7aa397[_0x3ffb94[_0xb39c('0xc')]][_0xb39c('0xe')])){_0x42c6dc=_[_0xb39c('0xf')](_0x7aa397[_0x3ffb94[_0xb39c('0xc')]][_0xb39c('0xe')],_0xb39c('0x10'));}else if(!_['isNil'](_0x3ffb94[_0xb39c('0x10')])){_0x42c6dc=[_0x3ffb94[_0xb39c('0x10')]];}return _0x42c6dc;}exports[_0xb39c('0x11')]=function(_0x5e4caf){_0x5e4caf[_0xb39c('0x12')]={};return new BPromise(function(_0x40a6d3,_0x42a203){var _0x386c80={'Start':function(_0x469fa9){var _0x27c22a=this;return new Promise(function(_0x8e9181,_0x5277ce){if(_0x469fa9){try{var _0x316c9b=[];var _0x3223f6=getId(_0x469fa9[_0xb39c('0x13')],_0x469fa9[_0xb39c('0x14')]?_0x469fa9[_0xb39c('0x14')]['id']:0x0,_0x469fa9[_0xb39c('0x15')]?_0x469fa9[_0xb39c('0x15')]['id']:0x0);if(_0x469fa9[_0xb39c('0x16')]&&_[_0xb39c('0x17')](_0x469fa9[_0xb39c('0x16')])&&_0x469fa9['applications'][_0xb39c('0x18')]){for(var _0x1a8e12=0x0;_0x1a8e12<_0x469fa9[_0xb39c('0x16')][_0xb39c('0x18')];_0x1a8e12+=0x1){var _0x50ab8b=_0x469fa9[_0xb39c('0x16')][_0x1a8e12];if(fs[_0xb39c('0x19')](path['join'](__dirname,_0xb39c('0x16'),_0x50ab8b[_0xb39c('0x1a')]+_0xb39c('0x1b')))){var _0x4ebfca=[];switch(_0x50ab8b['app'][_0xb39c('0x1c')]()){case _0xb39c('0x1d'):var _0x3c8dfd=_0x50ab8b['appdata'][_0xb39c('0x1e')](',');if(_0x469fa9[_0xb39c('0x13')]===_0xb39c('0x1f')){_0x4ebfca[_0xb39c('0x20')](_0x3c8dfd[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x3c8dfd[0x1]);_0x4ebfca['push'](_0x3c8dfd[_0xb39c('0x21')](0x2,_0x3c8dfd[_0xb39c('0x18')])['join'](','));}else{_0x4ebfca[_0xb39c('0x20')](_0x3c8dfd[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x3c8dfd[_0xb39c('0x21')](0x1,_0x3c8dfd[_0xb39c('0x18')])[_0xb39c('0x22')](','));}break;case'dialogflow':var _0x23a2f1=_0x50ab8b[_0xb39c('0x23')][_0xb39c('0x1e')](',');_0x4ebfca['push'](_0x23a2f1[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x23a2f1[0x1]);_0x4ebfca[_0xb39c('0x20')](_0x23a2f1['slice'](0x2,_0x23a2f1[_0xb39c('0x18')])[_0xb39c('0x22')](','));break;case _0xb39c('0x24'):var _0x4e9672=_0x50ab8b[_0xb39c('0x23')][_0xb39c('0x1e')](',');_0x4ebfca['push'](_0x4e9672[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x4e9672[0x1]);_0x4ebfca['push'](_0x4e9672[0x2]);_0x4ebfca[_0xb39c('0x20')](_0x4e9672[0x3]);_0x4ebfca[_0xb39c('0x20')](_0x4e9672[_0xb39c('0x21')](0x4,_0x4e9672[_0xb39c('0x18')])[_0xb39c('0x22')](','));break;case'amazonlex':var _0x433a39=_0x50ab8b['appdata'][_0xb39c('0x1e')](',');_0x4ebfca['push'](_0x433a39[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x433a39[0x1]);_0x4ebfca[_0xb39c('0x20')](_0x433a39[0x2]);_0x4ebfca[_0xb39c('0x20')](_0x433a39[0x3]);_0x4ebfca[_0xb39c('0x20')](_0x433a39['slice'](0x4,_0x433a39['length'])[_0xb39c('0x22')](','));break;case _0xb39c('0x14'):_0x4ebfca['push'](_0x50ab8b[_0xb39c('0x23')]);break;case _0xb39c('0x25'):_0x4ebfca[_0xb39c('0x20')](_0x50ab8b[_0xb39c('0x26')]);_0x4ebfca[_0xb39c('0x20')](_0x50ab8b[_0xb39c('0x23')]);break;case _0xb39c('0x27'):var _0x45e700=utils[_0xb39c('0x28')](_0x469fa9[_0xb39c('0x29')][_0xb39c('0x2a')],_0x469fa9);var _0x7ab8ca=_0x50ab8b[_0xb39c('0x23')][_0xb39c('0x1e')](',');_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x0]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x1]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x2]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x3]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x4]);_0x4ebfca['push'](_0x7ab8ca[0x5]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x6]);_0x4ebfca[_0xb39c('0x20')](_0x7ab8ca[0x7]);_0x4ebfca['push'](_0x7ab8ca[0x8]);_0x4ebfca['push'](_0x7ab8ca[0x9]);_0x4ebfca['push'](_0x7ab8ca[0xa]);_0x4ebfca[_0xb39c('0x20')](_0x469fa9[_0xb39c('0x15')]['id']);_0x4ebfca[_0xb39c('0x20')](_0x469fa9['message']['id']);_0x4ebfca[_0xb39c('0x20')](_0x50ab8b[_0xb39c('0x2b')]);_0x4ebfca[_0xb39c('0x20')](_0x469fa9[_0xb39c('0x15')][_0xb39c('0x2c')]);_0x4ebfca['push'](_0x469fa9[_0xb39c('0x2d')][_0xb39c('0x2d')]);_0x4ebfca['push'](_0x45e700);break;default:_0x4ebfca=_[_0xb39c('0xd')](_0x50ab8b['appdata'])?[]:_0x50ab8b[_0xb39c('0x23')][_0xb39c('0x1e')](',');}var _0x3eaf96={'id':util['format'](_0xb39c('0x2e'),_0x3223f6,_0x50ab8b['id'],_0x50ab8b[_0xb39c('0x1a')]),'condition':require(_0xb39c('0x2f'))[_0xb39c('0x30')](_0x3223f6,getIntervals(_0x5e4caf[_0xb39c('0x31')],_0x50ab8b),_0x5e4caf),'consequence':require(_0xb39c('0x32')+_0x50ab8b[_0xb39c('0x1a')])[_0xb39c('0x33')](_0x3223f6,_0x4ebfca,_0x5e4caf,_0x469fa9),'p':_0x50ab8b[_0xb39c('0x34')]||0x0};logger[_0xb39c('0x35')](_0xb39c('0x36'),_0x3eaf96['id'],_0xb39c('0x37'),getIntervals(_0x5e4caf['intervals'],_0x50ab8b)[_0xb39c('0x22')](_0xb39c('0x38')));_0x316c9b[_0xb39c('0x20')](_0x3eaf96);}else{logger[_0xb39c('0x39')](_0xb39c('0x3a'),path[_0xb39c('0x22')](__dirname,_0xb39c('0x16'),_0x50ab8b[_0xb39c('0x1a')]+_0xb39c('0x1b')));}}_0x5e4caf['rules'][_0x3223f6]=new RuleEngine(_0x316c9b);_0x5e4caf['rules'][_0x3223f6][_0xb39c('0x3b')](_0x469fa9,function(_0x36d948){logger['info']('Applications\x20executed',JSON[_0xb39c('0x3c')](_0x36d948['matchPath']));if(_0x5e4caf[_0xb39c('0x12')][_0x3223f6]){_0x5e4caf[_0xb39c('0x12')][_0x3223f6][_0xb39c('0x3d')](_0xb39c('0x3e'));}});return _0x8e9181({'code':0xc8,'message':_0x469fa9});}else{logger[_0xb39c('0x35')]('No\x20applications\x20to\x20execute');return _0x8e9181({'code':0xc8,'message':_0x469fa9});}}catch(_0x41c4fe){logger[_0xb39c('0x39')](_0x41c4fe['stack']);return _0x5277ce(_0x27c22a['error'](0x1f4,_0x41c4fe));}}return _0x5277ce(_0xb39c('0x3f'));});},'AcceptMessage':function(_0x53408c){var _0x5470f1=this;return new Promise(function(_0x20a5c4,_0x2ff5ac){if(_0x53408c[_0xb39c('0x40')]&&_0x53408c[_0xb39c('0x40')]['id']){if(_0x5e4caf[_0xb39c('0x41')][_0x53408c[_0xb39c('0x40')]['id']]){_0x5e4caf[_0xb39c('0x41')][_0x53408c[_0xb39c('0x40')]['id']][_0xb39c('0x42')]=![];_0x5e4caf[_0xb39c('0x41')][_0x53408c['agent']['id']][_0xb39c('0x43')]=undefined;}}if(_0x53408c[_0xb39c('0x14')]&&_0x53408c[_0xb39c('0x14')]['id']){try{var _0x2f790e=getId(_0x53408c[_0xb39c('0x13')],_0x53408c[_0xb39c('0x14')]?_0x53408c[_0xb39c('0x14')]['id']:0x0,_0x53408c[_0xb39c('0x15')]?_0x53408c[_0xb39c('0x15')]['id']:0x0);if(_0x5e4caf[_0xb39c('0x12')][_0x2f790e]){_0x5e4caf[_0xb39c('0x12')][_0x2f790e][_0xb39c('0x3d')](_0xb39c('0x44'));if(rpc[_0x53408c[_0xb39c('0x13')]+_0xb39c('0x45')]){rpc[_0x53408c[_0xb39c('0x13')]+'QueueReport'][_0xb39c('0x46')](_0x2f790e,{'UserId':_0x53408c[_0xb39c('0x14')][_0xb39c('0x47')]})[_0xb39c('0x48')](function(){logger[_0xb39c('0x39')](_0xb39c('0x49'));});}}return _0x20a5c4({'code':0xc8,'message':_0x53408c});}catch(_0xd4f368){logger[_0xb39c('0x39')](_0xd4f368['stack']);return _0x2ff5ac(_0x5470f1['error'](0x1f4,_0xd4f368));}}logger[_0xb39c('0x39')](_0xb39c('0x4a'));return _0x2ff5ac(_0x5470f1['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x226f60){var _0x1d1abf=this;return new Promise(function(_0x538258,_0x2a55db){if(_0x226f60['agent']&&_0x226f60['agent']['id']){try{if(_0x5e4caf[_0xb39c('0x41')][_0x226f60['agent']['id']]){_0x5e4caf[_0xb39c('0x41')][_0x226f60[_0xb39c('0x40')]['id']][_0xb39c('0x42')]=![];_0x5e4caf[_0xb39c('0x41')][_0x226f60[_0xb39c('0x40')]['id']][_0xb39c('0x43')]=undefined;}return _0x538258({'code':0xc8,'message':_0x226f60});}catch(_0x53fce6){logger[_0xb39c('0x39')](_0x53fce6[_0xb39c('0x4b')]);return _0x2a55db(_0x1d1abf[_0xb39c('0x39')](0x1f4,_0x53fce6));}}logger[_0xb39c('0x39')](_0xb39c('0x4a'));return _0x2a55db(_0x1d1abf['error'](0x1f4,_0xb39c('0x4a')));});},'AbandonInteraction':function(_0x4ab58e){var _0x1caea1=this;return new Promise(function(_0x2f537f,_0x131cb2){if(_0x4ab58e[_0xb39c('0x13')]&&_0x4ab58e[_0xb39c('0x15')]&&_0x4ab58e[_0xb39c('0x15')]['id']){try{var _0x3fd1ec=getId(_0x4ab58e[_0xb39c('0x13')],_0x4ab58e[_0xb39c('0x14')]?_0x4ab58e[_0xb39c('0x14')]['id']:0x0,_0x4ab58e[_0xb39c('0x15')]?_0x4ab58e[_0xb39c('0x15')]['id']:0x0);if(_0x5e4caf[_0xb39c('0x12')][_0x3fd1ec]){_0x5e4caf[_0xb39c('0x12')][_0x3fd1ec][_0xb39c('0x3d')](_0xb39c('0x44'));}return _0x2f537f({'code':0xc8,'message':_0x4ab58e});}catch(_0xc7238e){logger[_0xb39c('0x39')](_0xc7238e[_0xb39c('0x4b')]);return _0x131cb2(_0x1caea1['error'](0x1f4,_0xc7238e));}}logger['error'](_0xb39c('0x4a'));return _0x131cb2(_0x1caea1[_0xb39c('0x39')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x27e91a){var _0x246aa0=this;return new Promise(function(_0x4946b5,_0x220d16){if(_0x5e4caf[_0xb39c('0x41')][_0xb39c('0x4c')](_0x27e91a['id'])){for(var _0x19647a in _0x27e91a[_0xb39c('0x4d')]){if(_0x27e91a[_0xb39c('0x4d')]['hasOwnProperty'](_0x19647a)){if(_0x5e4caf[_0xb39c('0x41')][_0x27e91a['id']][_0xb39c('0x4c')](_0x19647a+_0xb39c('0x4e'))){_0x5e4caf[_0xb39c('0x41')][_0x27e91a['id']][_0x19647a+_0xb39c('0x4e')]=parseInt(_0x27e91a[_0xb39c('0x4d')][_0x19647a],0xa);}}}_0x5e4caf[_0xb39c('0x41')][_0x27e91a['id']]['updateRealtime']();return _0x4946b5({'code':0xc8,'message':_0x5e4caf[_0xb39c('0x41')][_0x27e91a['id']]});}else{return _0x220d16(_0x246aa0[_0xb39c('0x39')](0x1f4,_0xb39c('0x4f')));}});},'Agents':function(_0x17b0c4){return new Promise(function(_0xb0b0b6){var _0x4d6968=_['values'](_0x5e4caf[_0xb39c('0x41')]);if(_0x17b0c4&&_0x17b0c4['id']){var _0x274707=_[_0xb39c('0x50')](_0x4d6968,function(_0x4e13ca){return _0x4e13ca['id']===_0x17b0c4['id'];});_0xb0b0b6(_0x274707);}else{_0xb0b0b6({'count':_0x4d6968[_0xb39c('0x18')],'rows':_0x4d6968});}});},'ChatQueues':function(){return new Promise(function(_0x4836f7){var _0x2f3c24=[];for(var _0x5ce5fb in _0x5e4caf[_0xb39c('0x51')]){if(_0x5e4caf[_0xb39c('0x51')][_0xb39c('0x4c')](_0x5ce5fb)){var _0x4c40a4=_0x5e4caf[_0xb39c('0x51')][_0x5ce5fb];var _0x281e2e={'id':_0x4c40a4['id'],'available':_0x4c40a4[_0xb39c('0x52')],'loggedIn':_0x4c40a4[_0xb39c('0x53')],'name':_0x4c40a4[_0xb39c('0x54')],'paused':_0x4c40a4[_0xb39c('0x55')],'waiting':_0x4c40a4[_0xb39c('0x56')]};_0x2f3c24[_0xb39c('0x20')](_0x281e2e);}}_0x4836f7({'count':_0x2f3c24[_0xb39c('0x18')],'rows':_0x2f3c24});});},'MailQueues':function(){return new Promise(function(_0x158ac5){var _0x34127d=[];for(var _0x227152 in _0x5e4caf[_0xb39c('0x57')]){if(_0x5e4caf[_0xb39c('0x57')][_0xb39c('0x4c')](_0x227152)){var _0x31b9c1=_0x5e4caf[_0xb39c('0x57')][_0x227152];var _0x58fbe0={'id':_0x31b9c1['id'],'available':_0x31b9c1[_0xb39c('0x52')],'loggedIn':_0x31b9c1[_0xb39c('0x53')],'name':_0x31b9c1[_0xb39c('0x54')],'paused':_0x31b9c1['paused'],'waiting':_0x31b9c1[_0xb39c('0x56')]};_0x34127d['push'](_0x58fbe0);}}_0x158ac5({'count':_0x34127d['length'],'rows':_0x34127d});});},'OpenchannelQueues':function(){return new Promise(function(_0x8d8f59){var _0x765913=[];for(var _0x2d9edf in _0x5e4caf[_0xb39c('0x58')]){if(_0x5e4caf[_0xb39c('0x58')]['hasOwnProperty'](_0x2d9edf)){var _0x5de073=_0x5e4caf[_0xb39c('0x58')][_0x2d9edf];var _0x27723c={'id':_0x5de073['id'],'available':_0x5de073['available'],'loggedIn':_0x5de073[_0xb39c('0x53')],'name':_0x5de073[_0xb39c('0x54')],'paused':_0x5de073[_0xb39c('0x55')],'waiting':_0x5de073[_0xb39c('0x56')]};_0x765913[_0xb39c('0x20')](_0x27723c);}}_0x8d8f59({'count':_0x765913[_0xb39c('0x18')],'rows':_0x765913});});},'SmsQueues':function(){return new Promise(function(_0x2ed9c6){var _0xfe586=[];for(var _0x5f69ef in _0x5e4caf[_0xb39c('0x59')]){if(_0x5e4caf[_0xb39c('0x59')][_0xb39c('0x4c')](_0x5f69ef)){var _0x29b793=_0x5e4caf[_0xb39c('0x59')][_0x5f69ef];var _0x1ffa28={'id':_0x29b793['id'],'available':_0x29b793['available'],'loggedIn':_0x29b793[_0xb39c('0x53')],'name':_0x29b793['name'],'paused':_0x29b793[_0xb39c('0x55')],'waiting':_0x29b793[_0xb39c('0x56')]};_0xfe586['push'](_0x1ffa28);}}_0x2ed9c6({'count':_0xfe586[_0xb39c('0x18')],'rows':_0xfe586});});},'FaxQueues':function(){return new Promise(function(_0x391361){var _0x2fe97a=[];for(var _0x4290d5 in _0x5e4caf[_0xb39c('0x5a')]){if(_0x5e4caf[_0xb39c('0x5a')]['hasOwnProperty'](_0x4290d5)){var _0x404356=_0x5e4caf[_0xb39c('0x5a')][_0x4290d5];var _0xe3e56b={'id':_0x404356['id'],'available':_0x404356[_0xb39c('0x52')],'loggedIn':_0x404356[_0xb39c('0x53')],'name':_0x404356[_0xb39c('0x54')],'paused':_0x404356[_0xb39c('0x55')],'waiting':_0x404356[_0xb39c('0x56')]};_0x2fe97a[_0xb39c('0x20')](_0xe3e56b);}}_0x391361({'count':_0x2fe97a['length'],'rows':_0x2fe97a});});},'WhatsappQueues':function(){return new Promise(function(_0x42c8c1){var _0x20610f=[];for(var _0x2a7b45 in _0x5e4caf[_0xb39c('0x5b')]){if(_0x5e4caf[_0xb39c('0x5b')][_0xb39c('0x4c')](_0x2a7b45)){var _0x43af44=_0x5e4caf['whatsappQueues'][_0x2a7b45];var _0x29b32c={'id':_0x43af44['id'],'available':_0x43af44[_0xb39c('0x52')],'loggedIn':_0x43af44[_0xb39c('0x53')],'name':_0x43af44[_0xb39c('0x54')],'paused':_0x43af44[_0xb39c('0x55')],'waiting':_0x43af44[_0xb39c('0x56')]};_0x20610f[_0xb39c('0x20')](_0x29b32c);}}_0x42c8c1({'count':_0x20610f[_0xb39c('0x18')],'rows':_0x20610f});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x483be1){var _0x3dc3d8=_['values'](_0x5e4caf[_0xb39c('0x5c')]);_0x483be1({'count':_0x3dc3d8[_0xb39c('0x18')],'rows':_0x3dc3d8});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4123c6){var _0xeab93a=_[_0xb39c('0x5d')](_0x5e4caf[_0xb39c('0x5e')]);_0x4123c6({'count':_0xeab93a[_0xb39c('0x18')],'rows':_0xeab93a});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3784fe){var _0x50f596=_[_0xb39c('0x5d')](_0x5e4caf[_0xb39c('0x5f')]);_0x3784fe({'count':_0x50f596[_0xb39c('0x18')],'rows':_0x50f596});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1254d7){var _0x2955bf=_[_0xb39c('0x5d')](_0x5e4caf[_0xb39c('0x60')]);_0x1254d7({'count':_0x2955bf[_0xb39c('0x18')],'rows':_0x2955bf});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33d6f5){var _0x7d5e=_[_0xb39c('0x5d')](_0x5e4caf[_0xb39c('0x61')]);_0x33d6f5({'count':_0x7d5e[_0xb39c('0x18')],'rows':_0x7d5e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x45a273){var _0x1c29d4=_[_0xb39c('0x5d')](_0x5e4caf['whatsappQueuesWaitingInteractions']);_0x45a273({'count':_0x1c29d4['length'],'rows':_0x1c29d4});});}};var _0x4519a8=jayson[_0xb39c('0x62')](_0x386c80)[_0xb39c('0x63')]();_0x4519a8['on']('error',function(_0x62a6cb){logger[_0xb39c('0x39')](JSON[_0xb39c('0x3c')](_0x62a6cb));return _0x42a203(_0x62a6cb);});_0x4519a8[_0xb39c('0x11')](0x232c,_0xb39c('0x64'),function(){console[_0xb39c('0x65')](_0xb39c('0x66'),0x232c);return _0x40a6d3('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 bd31ed2..cdb37c5 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 _0xe6e4=['some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','http','request','then','error','message','result','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','iftime\x20%s','true'];(function(_0x48400b,_0x4d544a){var _0x506dcb=function(_0x117c98){while(--_0x117c98){_0x48400b['push'](_0x48400b['shift']());}};_0x506dcb(++_0x4d544a);}(_0xe6e4,0x98));var _0x4e6e=function(_0x3236a8,_0x44c5f2){_0x3236a8=_0x3236a8-0x0;var _0x209b4a=_0xe6e4[_0x3236a8];return _0x209b4a;};'use strict';var util=require(_0x4e6e('0x0'));var BPromise=require(_0x4e6e('0x1'));var jayson=require(_0x4e6e('0x2'));var _=require(_0x4e6e('0x3'));var logger=require(_0x4e6e('0x4'))(_0x4e6e('0x5'));var client=jayson['client'][_0x4e6e('0x6')]({'port':0x232a});function request(_0x11bc86,_0x3df115){return new BPromise(function(_0xa04cb2,_0x529689){return client[_0x4e6e('0x7')](_0x11bc86,_0x3df115)[_0x4e6e('0x8')](function(_0x4ad8c5){if(_0x4ad8c5[_0x4e6e('0x9')]){return _0x529689(_0x4ad8c5[_0x4e6e('0x9')][_0x4e6e('0xa')]);}else{return _0xa04cb2(_0x4ad8c5[_0x4e6e('0xb')]);}})['catch'](function(_0x23d494){return _0x529689(_0x23d494);});});}exports[_0x4e6e('0xc')]=function(_0x402764,_0x9fe987,_0x1ebcf6){return function(_0x23b59c){if(_0x1ebcf6['rules']&&!_0x1ebcf6['rules'][_0x402764]){logger[_0x4e6e('0xd')](_0x4e6e('0xe'),_0x402764);return _0x23b59c[_0x4e6e('0xf')]();}var _0x3f0644=[];for(var _0x28ed36=0x0;_0x28ed36<_0x9fe987[_0x4e6e('0x10')];_0x28ed36+=0x1){_0x3f0644[_0x4e6e('0x11')](request(_0x4e6e('0x12'),{'command':util[_0x4e6e('0x13')](_0x4e6e('0x14'),_0x9fe987[_0x28ed36])})['then'](function(_0x2cc96b){return _0x2cc96b&&_0x2cc96b[_0x4e6e('0xa')]&&_0x2cc96b[_0x4e6e('0xa')]['indexOf'](_0x4e6e('0x15'))>=0x0?!![]:![];})['catch'](function(_0x395bfd){logger[_0x4e6e('0x9')]('[%s][INTERVAL]\x20%s',_0x402764,_0x9fe987[_0x28ed36]);}));}BPromise['all'](_0x3f0644)[_0x4e6e('0x8')](function(_0x5839b7){var _0x4da7bc=_[_0x4e6e('0x16')](_0x5839b7);logger[_0x4e6e('0xd')](_0x4e6e('0x17'),_0x402764,_0x9fe987[_0x4e6e('0x18')](_0x4e6e('0x19')),_0x4da7bc);_0x23b59c['when'](_0x4da7bc);})[_0x4e6e('0x1a')](function(_0x515ddf){console[_0x4e6e('0x1b')](_0x515ddf);logger[_0x4e6e('0x9')](_0x4e6e('0x17'),_0x402764,_0x9fe987[_0x4e6e('0x18')]('\x20|\x20'),_0x515ddf[_0x4e6e('0x1c')]);_0x23b59c['stop']();});};}; \ No newline at end of file +var _0x4c12=['push','Command','format','iftime\x20%s','then','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','error','message','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length'];(function(_0x2a4239,_0x123a53){var _0x4b20af=function(_0x24ff65){while(--_0x24ff65){_0x2a4239['push'](_0x2a4239['shift']());}};_0x4b20af(++_0x123a53);}(_0x4c12,0x109));var _0x24c1=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x4c12[_0x4d613c];return _0x301fe3;};'use strict';var util=require(_0x24c1('0x0'));var BPromise=require(_0x24c1('0x1'));var jayson=require(_0x24c1('0x2'));var _=require(_0x24c1('0x3'));var logger=require(_0x24c1('0x4'))(_0x24c1('0x5'));var client=jayson[_0x24c1('0x6')]['http']({'port':0x232a});function request(_0x4ff036,_0xf2ee08){return new BPromise(function(_0x4176bb,_0x331d24){return client[_0x24c1('0x7')](_0x4ff036,_0xf2ee08)['then'](function(_0x3cd4f2){if(_0x3cd4f2[_0x24c1('0x8')]){return _0x331d24(_0x3cd4f2[_0x24c1('0x8')][_0x24c1('0x9')]);}else{return _0x4176bb(_0x3cd4f2['result']);}})['catch'](function(_0x456802){return _0x331d24(_0x456802);});});}exports['condition']=function(_0x56efe4,_0x4780ec,_0x135240){return function(_0x1e8d9d){if(_0x135240[_0x24c1('0xa')]&&!_0x135240['rules'][_0x56efe4]){logger[_0x24c1('0xb')](_0x24c1('0xc'),_0x56efe4);return _0x1e8d9d[_0x24c1('0xd')]();}var _0x28644e=[];for(var _0xa42de9=0x0;_0xa42de9<_0x4780ec[_0x24c1('0xe')];_0xa42de9+=0x1){_0x28644e[_0x24c1('0xf')](request(_0x24c1('0x10'),{'command':util[_0x24c1('0x11')](_0x24c1('0x12'),_0x4780ec[_0xa42de9])})[_0x24c1('0x13')](function(_0x543e70){return _0x543e70&&_0x543e70[_0x24c1('0x9')]&&_0x543e70[_0x24c1('0x9')]['indexOf']('true')>=0x0?!![]:![];})[_0x24c1('0x14')](function(_0x24f9e3){logger[_0x24c1('0x8')]('[%s][INTERVAL]\x20%s',_0x56efe4,_0x4780ec[_0xa42de9]);}));}BPromise[_0x24c1('0x15')](_0x28644e)[_0x24c1('0x13')](function(_0x2dff35){var _0x46c004=_[_0x24c1('0x16')](_0x2dff35);logger[_0x24c1('0xb')](_0x24c1('0x17'),_0x56efe4,_0x4780ec[_0x24c1('0x18')](_0x24c1('0x19')),_0x46c004);_0x1e8d9d['when'](_0x46c004);})[_0x24c1('0x14')](function(_0x4e651c){console[_0x24c1('0x1a')](_0x4e651c);logger['error'](_0x24c1('0x17'),_0x56efe4,_0x4780ec[_0x24c1('0x18')](_0x24c1('0x19')),_0x4e651c[_0x24c1('0x1b')]);_0x1e8d9d[_0x24c1('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b2c82b5..bd5460f 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 _0x5ff3=['ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','transfer','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','diffTime','agent','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','then','type','agentcomplete','acw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','holdtime'];(function(_0x243720,_0x4be046){var _0x412e40=function(_0x6c7e41){while(--_0x6c7e41){_0x243720['push'](_0x243720['shift']());}};_0x412e40(++_0x4be046);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4f86a3,_0x3549bb){_0x4f86a3=_0x4f86a3-0x0;var _0x5bd08a=_0x5ff3[_0x4f86a3];return _0x5bd08a;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1763a,_0x47c98d){utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x3'),_0x1763a[_0x35ff('0x4')],_0x1763a['channel'],_0x1763a[_0x35ff('0x5')],_0x1763a[_0x35ff('0x6')],_0x1763a[_0x35ff('0x7')],_0x1763a[_0x35ff('0x8')],_0x1763a[_0x35ff('0x9')],_0x1763a['lastevent']));if(_0x1763a[_0x35ff('0x5')]){utils['getVoiceQueueByName'](_0x1763a[_0x35ff('0x5')])[_0x35ff('0xa')](function(_0x224ce5){if(_0x224ce5){_0x1763a['type']=_0x224ce5[_0x35ff('0xb')];_0x1763a['agentacw']=_0x1763a[_0x35ff('0xc')]?_0x224ce5[_0x35ff('0xd')]:![];_0x1763a['acwtime']=_0x1763a['agentacw']?_0x224ce5[_0x35ff('0xe')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x1763a);});}else{utils['request'](_0x35ff('0xf'),_0x1763a);}if(_0x47c98d){delete transfers[_0x1763a[_0x35ff('0x4')]];}else{delete agents[_0x1763a[_0x35ff('0x10')]];}}exports[_0x35ff('0x11')]=function(_0x559e33){try{utils[_0x35ff('0x12')](util[_0x35ff('0x2')](_0x35ff('0x13'),_0x559e33['uniqueid']),_0x559e33);agents[_0x559e33[_0x35ff('0x10')]]=_0x559e33;agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x14')]=utils[_0x35ff('0x15')]();agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x17');agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x9')]=null;agents[_0x559e33[_0x35ff('0x10')]][_0x35ff('0x18')]=null;utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x19'),_0x559e33[_0x35ff('0x4')],agents[_0x559e33['destuniqueid']][_0x35ff('0x6')],_0x559e33[_0x35ff('0x10')]));}catch(_0x350e71){utils[_0x35ff('0x1a')](util['format']('[%s][agents][agentcalled]',_0x559e33[_0x35ff('0x4')]),_0x350e71);}};exports[_0x35ff('0x1b')]=function(_0x4c8dd4){try{if(!_[_0x35ff('0x1c')](agents[_0x4c8dd4[_0x35ff('0x10')]])){utils[_0x35ff('0x12')](util[_0x35ff('0x2')]('[%s][agents][agentringnoanswer]',_0x4c8dd4[_0x35ff('0x4')]),_0x4c8dd4);utils['info'](util[_0x35ff('0x2')](_0x35ff('0x1d'),_0x4c8dd4[_0x35ff('0x4')],agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x6')],_0x4c8dd4[_0x35ff('0x10')]));agents[_0x4c8dd4[_0x35ff('0x10')]]['agentringnoanswer']=!![];agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x1e')]=utils['now']();agents[_0x4c8dd4[_0x35ff('0x10')]]['lastevent']='timeout';agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x1f')]=_0x35ff('0x20');agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x21')]=_0x4c8dd4['ringtime']?parseInt(_0x4c8dd4[_0x35ff('0x22')])/0x3e8:0x0;agents[_0x4c8dd4[_0x35ff('0x10')]][_0x35ff('0x23')]=0x0;unanswered['push'](_0x4c8dd4[_0x35ff('0x10')]);}}catch(_0x1f51c5){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x24'),_0x4c8dd4[_0x35ff('0x4')]),_0x1f51c5);}};exports[_0x35ff('0x25')]=function(_0xdf6ff){try{_[_0x35ff('0x26')](agents,function(_0x47d8fa,_0x3f9440){if(_0x47d8fa['uniqueid']==_0xdf6ff[_0x35ff('0x4')]&&!_[_0x35ff('0x27')](unanswered,_0x47d8fa[_0x35ff('0x10')])){utils[_0x35ff('0x12')](util['format'](_0x35ff('0x28'),_0xdf6ff['uniqueid']),_0xdf6ff);utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xdf6ff['uniqueid'],_0x47d8fa[_0x35ff('0x6')],_0x47d8fa[_0x35ff('0x10')]));_0x47d8fa['agentringnoanswer']=!![];_0x47d8fa[_0x35ff('0x1e')]=utils[_0x35ff('0x15')]();_0x47d8fa['lastevent']=_0x35ff('0x29');_0x47d8fa[_0x35ff('0x1f')]=_0x35ff('0x29');_0x47d8fa[_0x35ff('0x21')]=_0xdf6ff[_0x35ff('0x21')];_0x47d8fa[_0x35ff('0x23')]=0x0;writeDB(_0x47d8fa);}});}catch(_0x293edc){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x28'),_0xdf6ff[_0x35ff('0x4')]),_0x293edc);}};exports[_0x35ff('0x2a')]=function(_0x41b48d){try{if(agents[_0x41b48d['destuniqueid']]){utils[_0x35ff('0x12')](util['format'](_0x35ff('0x2b'),_0x41b48d[_0x35ff('0x4')]),_0x41b48d);utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x2c'),_0x41b48d['uniqueid'],agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x6')],_0x41b48d[_0x35ff('0x10')]));agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x2d')]=utils['now']();agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x9')]=_0x41b48d[_0x35ff('0x9')];agents[_0x41b48d['destuniqueid']]['connectedlinename']=_0x41b48d[_0x35ff('0x18')];agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x21')]=_0x41b48d[_0x35ff('0x22')];agents[_0x41b48d[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x2e');_[_0x35ff('0x26')](agents,function(_0x5dc229,_0x5dcc7c){if(_0x5dc229['destuniqueid']!=_0x41b48d[_0x35ff('0x10')]&&_0x5dc229[_0x35ff('0x4')]==_0x41b48d[_0x35ff('0x4')]){_0x5dc229[_0x35ff('0x23')]=0x0;_0x5dc229[_0x35ff('0x21')]=_0x41b48d['ringtime'];_0x5dc229[_0x35ff('0x1b')]=!![];_0x5dc229[_0x35ff('0x1e')]=utils[_0x35ff('0x15')]();_0x5dc229[_0x35ff('0x16')]=_0x35ff('0x2f');_0x5dc229[_0x35ff('0x1f')]='answered_elsewhere';_0x5dc229['answeredelsewheredestinationuniqueid']=_0x41b48d[_0x35ff('0x10')];_0x5dc229[_0x35ff('0x30')]=_0x41b48d[_0x35ff('0x6')];writeDB(_0x5dc229);}});}}catch(_0x21b123){utils['error'](util['format'](_0x35ff('0x2b'),_0x41b48d[_0x35ff('0x4')]),_0x21b123);}};exports[_0x35ff('0xc')]=function(_0x1cd2c8){try{if(!_[_0x35ff('0x1c')](agents[_0x1cd2c8[_0x35ff('0x10')]])){utils[_0x35ff('0x12')](util['format']('[%s][agents][agentcomplete]',_0x1cd2c8[_0x35ff('0x4')]),_0x1cd2c8);utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1cd2c8[_0x35ff('0x4')],agents[_0x1cd2c8[_0x35ff('0x10')]]['membername'],_0x1cd2c8['destuniqueid']));agents[_0x1cd2c8[_0x35ff('0x10')]]['agentcomplete']=!![];agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x31')]=utils['now']();agents[_0x1cd2c8[_0x35ff('0x10')]]['talktime']=utils['diffTime'](agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x31')],agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x2d')]);agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x1f')]=_0x1cd2c8[_0x35ff('0x1f')];agents[_0x1cd2c8[_0x35ff('0x10')]][_0x35ff('0x16')]=_0x35ff('0x32');writeDB(agents[_0x1cd2c8[_0x35ff('0x10')]]);}}catch(_0x2d3f46){utils['error'](util[_0x35ff('0x2')](_0x35ff('0x33'),_0x1cd2c8[_0x35ff('0x4')]),_0x2d3f46);}};exports[_0x35ff('0x34')]=function(_0x506def){try{if(!_['isNil'](agents[_0x506def[_0x35ff('0x35')]])){utils['debug'](util[_0x35ff('0x2')](_0x35ff('0x36'),_0x506def[_0x35ff('0x4')]),_0x506def);utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x37'),_0x506def[_0x35ff('0x4')],agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x6')],agents[_0x506def['transfereruniqueid']]['uniqueid']));agents[_0x506def[_0x35ff('0x35')]]['transfer']=!![];agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x38')]=_0x35ff('0x39');agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x3a')]=_0x506def[_0x35ff('0x3b')];agents[_0x506def[_0x35ff('0x35')]][_0x35ff('0x3c')]=agents[_0x506def[_0x35ff('0x35')]]['uniqueid'];}}catch(_0x3aa649){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x36'),_0x506def['uniqueid']),_0x3aa649);}};exports['attendedtransfer']=function(_0x591776){try{utils[_0x35ff('0x12')](util[_0x35ff('0x2')](_0x35ff('0x3d'),_0x591776['origtransfereruniqueid']),_0x591776);if(_0x591776[_0x35ff('0x3e')]==_0x591776['origtransfererlinkedid']){if(!_[_0x35ff('0x1c')](agents[_0x591776['secondtransfereruniqueid']])){utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x3f'),_0x591776[_0x35ff('0x3e')],agents[_0x591776['secondtransfereruniqueid']]['membername']));agents[_0x591776[_0x35ff('0x40')]]['transfer']=!![];agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x38')]='ATTENDED';agents[_0x591776[_0x35ff('0x40')]]['transferexten']=_0x591776[_0x35ff('0x41')];agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x3c')]=_0x591776[_0x35ff('0x3e')];}if(_0x591776[_0x35ff('0x42')]&&agents[_0x591776[_0x35ff('0x42')]]){agents[_0x591776['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x591776[_0x35ff('0x42')]]=_[_0x35ff('0x43')](agents[_0x591776['transfereeuniqueid']]);transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x8')]=agents[_0x591776['secondtransfereruniqueid']][_0x35ff('0x8')];transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x44')]=agents[_0x591776[_0x35ff('0x40')]][_0x35ff('0x44')];transfers[_0x591776['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x591776[_0x35ff('0x42')]]['agentconnectAt']=utils[_0x35ff('0x15')]();transfers[_0x591776['transfereeuniqueid']][_0x35ff('0x21')]=0x0;transfers[_0x591776[_0x35ff('0x42')]][_0x35ff('0x45')]=0x2;}}else if(_0x591776[_0x35ff('0x40')]==_0x591776[_0x35ff('0x46')]){if(!_[_0x35ff('0x1c')](agents[_0x591776['origtransfereruniqueid']])){utils[_0x35ff('0x1')](util[_0x35ff('0x2')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x591776[_0x35ff('0x3e')],agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x6')]));agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x47')]=!![];agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x38')]=_0x35ff('0x48');agents[_0x591776[_0x35ff('0x3e')]]['transferexten']=_0x591776[_0x35ff('0x49')];agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x3c')]=_0x591776[_0x35ff('0x40')];}if(_0x591776[_0x35ff('0x4a')]&&agents[_0x591776[_0x35ff('0x4a')]]){agents[_0x591776['transfertargetuniqueid']][_0x35ff('0x45')]=0x1;transfers[_0x591776[_0x35ff('0x4a')]]=_[_0x35ff('0x43')](agents[_0x591776['transfertargetuniqueid']]);transfers[_0x591776[_0x35ff('0x4a')]]['calleridnum']=agents[_0x591776['origtransfereruniqueid']][_0x35ff('0x8')];transfers[_0x591776[_0x35ff('0x4a')]]['calleridname']=agents[_0x591776[_0x35ff('0x3e')]][_0x35ff('0x44')];transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x14')]=utils[_0x35ff('0x15')]();transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x2d')]=utils[_0x35ff('0x15')]();transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x21')]=0x0;transfers[_0x591776[_0x35ff('0x4a')]][_0x35ff('0x45')]=0x2;}}}catch(_0xbfda70){utils[_0x35ff('0x1a')](util[_0x35ff('0x2')](_0x35ff('0x3d'),_0x591776['origtransfereruniqueid']),_0xbfda70);}};exports[_0x35ff('0x4b')]=function(_0x229ca2){try{utils['debug'](util[_0x35ff('0x2')](_0x35ff('0x4c'),_0x229ca2['uniqueid']),_0x229ca2);if(agents[_0x229ca2['uniqueid']]&&agents[_0x229ca2[_0x35ff('0x4')]]['reason']===_0x35ff('0x20')){if(_0x229ca2[_0x35ff('0x4d')]==='21'){agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=_0x35ff('0x4e');agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]=_0x35ff('0x4e');}utils[_0x35ff('0x1')](util['format'](_0x35ff('0x4f'),_0x229ca2['uniqueid'],agents[_0x229ca2[_0x35ff('0x4')]]['membername'],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(agents[_0x229ca2[_0x35ff('0x4')]]);var _0x4857d1=unanswered[_0x35ff('0x50')](_0x229ca2[_0x35ff('0x4')]);if(_0x4857d1>-0x1){unanswered['splice'](_0x4857d1,0x1);}}if(transfers[_0x229ca2['uniqueid']]){transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0xc')]=!![];transfers[_0x229ca2['uniqueid']][_0x35ff('0x31')]=utils[_0x35ff('0x15')]();transfers[_0x229ca2[_0x35ff('0x4')]]['talktime']=utils[_0x35ff('0x51')](transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x31')],transfers[_0x229ca2['uniqueid']][_0x35ff('0x2d')]);transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=_0x35ff('0x52');transfers[_0x229ca2[_0x35ff('0x4')]]['lastevent']=_0x35ff('0x32');utils[_0x35ff('0x1')](util[_0x35ff('0x2')](_0x35ff('0x4f'),_0x229ca2[_0x35ff('0x4')],transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x6')],transfers[_0x229ca2['uniqueid']][_0x35ff('0x1f')],transfers[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(transfers[_0x229ca2[_0x35ff('0x4')]],!![]);}if(agents[_0x229ca2[_0x35ff('0x4')]]&&agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x2d')]){agents[_0x229ca2['uniqueid']][_0x35ff('0xc')]=!![];agents[_0x229ca2['uniqueid']][_0x35ff('0x31')]=utils[_0x35ff('0x15')]();agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x23')]=utils[_0x35ff('0x51')](agents[_0x229ca2['uniqueid']]['agentcompleteAt'],agents[_0x229ca2[_0x35ff('0x4')]]['agentconnectAt']);agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x1f')]=agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x47')]?_0x35ff('0x47'):_0x35ff('0x52');agents[_0x229ca2[_0x35ff('0x4')]]['lastevent']=_0x35ff('0x32');utils['info'](util[_0x35ff('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x229ca2[_0x35ff('0x4')],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x6')],agents[_0x229ca2['uniqueid']]['reason'],agents[_0x229ca2[_0x35ff('0x4')]][_0x35ff('0x16')]));writeDB(agents[_0x229ca2['uniqueid']]);}}catch(_0xf9c766){utils[_0x35ff('0x1a')](util['format'](_0x35ff('0x4c'),_0x229ca2[_0x35ff('0x4')]),_0xf9c766);}}; \ No newline at end of file +var _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x44d21e,_0xb7ea7e){var _0x21209f=function(_0x22f700){while(--_0x22f700){_0x44d21e['push'](_0x44d21e['shift']());}};_0x21209f(++_0xb7ea7e);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 23095dd..8c2d27a 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 _0x27fa=['value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','Queue','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','lastdata','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','channel','now','DOCUMENTATION','error','newstate','channelstate','isNil','linkedid','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','[%s][calls][attendedtransfer]','localtwolinkedid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','diffTime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s'];(function(_0x177dc6,_0x45b3f0){var _0x1ec077=function(_0x97d50f){while(--_0x97d50f){_0x177dc6['push'](_0x177dc6['shift']());}};_0x1ec077(++_0x45b3f0);}(_0x27fa,0x1c3));var _0xa27f=function(_0x461101,_0x50ee5a){_0x461101=_0x461101-0x0;var _0x3024b0=_0x27fa[_0x461101];return _0x3024b0;};'use strict';var _=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var utils=require(_0xa27f('0x2'));var transfers=require(_0xa27f('0x3'));var dispositions=[_0xa27f('0x4'),_0xa27f('0x5'),_0xa27f('0x5'),'NO\x20ANSWER',_0xa27f('0x4'),_0xa27f('0x4'),_0xa27f('0x6'),_0xa27f('0x7'),_0xa27f('0x5'),'FAILED',_0xa27f('0x5')];var channels={};function writeDB(_0xdacc26){var _0x1e59ae;if(transfers[_0xa27f('0x8')][_0xdacc26[_0xa27f('0x9')]]){_0x1e59ae=_0xdacc26['uniqueid'];_0xdacc26[_0xa27f('0x9')]=transfers[_0xa27f('0x8')][_0xdacc26[_0xa27f('0x9')]]['transfereeuniqueid'];}utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdacc26[_0xa27f('0x9')],_0xdacc26['channel'],_0xdacc26[_0xa27f('0xc')],_0xdacc26[_0xa27f('0xd')],_0xdacc26[_0xa27f('0xe')],_0xdacc26['calleridnum'],_0xdacc26[_0xa27f('0xf')],_0xdacc26[_0xa27f('0x10')]));if(_0xdacc26[_0xa27f('0x11')]){utils[_0xa27f('0x12')](_0xdacc26[_0xa27f('0x11')])[_0xa27f('0x13')](function(_0x499eb8){if(_0x499eb8){_0xdacc26[_0xa27f('0x14')]=_0x499eb8['id'];}utils[_0xa27f('0x15')](_0xa27f('0x16'),_0xdacc26);});}else{utils['request'](_0xa27f('0x16'),_0xdacc26);}if(channels[_0xdacc26['uniqueid']]){delete channels[_0xdacc26['uniqueid']];}else if(_0x1e59ae&&channels[_0x1e59ae]){if(!transfers[_0xa27f('0x8')][_0x1e59ae][_0xa27f('0x17')])delete transfers['blinds'][_0x1e59ae];delete channels[_0x1e59ae];}}exports['newchannel']=function(_0x1d096b){try{utils[_0xa27f('0x18')](util[_0xa27f('0xb')]('[%s][calls][newchannel]',_0x1d096b[_0xa27f('0x9')]),_0x1d096b);if(_0x1d096b['uniqueid']==_0x1d096b['linkedid']&&_0x1d096b['channel']!='OutgoingSpoolFailed'){utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x19'),_0x1d096b[_0xa27f('0x9')],_0x1d096b[_0xa27f('0x1a')],_0x1d096b[_0xa27f('0x1b')]));channels[_0x1d096b['uniqueid']]={'uniqueid':_0x1d096b['uniqueid'],'accountcode':_0x1d096b[_0xa27f('0x11')],'source':_0x1d096b[_0xa27f('0x1c')],'destination':_0x1d096b[_0xa27f('0x1b')],'destinationcontext':_0x1d096b[_0xa27f('0x1a')],'channel':_0x1d096b[_0xa27f('0x1d')],'starttime':utils[_0xa27f('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa27f('0x4'),'amaflags':_0xa27f('0x1f')};}}catch(_0x3de2af){utils[_0xa27f('0x20')](util[_0xa27f('0xb')]('[%s][calls][newchannel]',_0x1d096b[_0xa27f('0x9')]),_0x3de2af);}};exports[_0xa27f('0x21')]=function(_0x15200d){try{utils[_0xa27f('0x18')](util[_0xa27f('0xb')]('[%s][calls][newstate]',_0x15200d[_0xa27f('0x9')]),_0x15200d);if(!_['isNil'](channels[_0x15200d[_0xa27f('0x9')]])&&_0x15200d[_0xa27f('0x22')]==0x6){utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x15200d['uniqueid'],_0x15200d[_0xa27f('0x1a')],_0x15200d[_0xa27f('0x1d')]));if(_[_0xa27f('0x23')](channels[_0x15200d[_0xa27f('0x9')]]['systemanswertime'])){channels[_0x15200d[_0xa27f('0x9')]]['systemanswertime']=utils['now']();}}else if(!_['isNil'](channels[_0x15200d[_0xa27f('0x24')]])&&_0x15200d[_0xa27f('0x22')]==0x6&&_0x15200d['context']!='transfer'){utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x15200d['uniqueid'],_0x15200d[_0xa27f('0x24')],_0x15200d[_0xa27f('0x1a')],_0x15200d[_0xa27f('0x1d')]));channels[_0x15200d['linkedid']][_0xa27f('0x11')]=_0x15200d[_0xa27f('0x11')];channels[_0x15200d[_0xa27f('0x24')]][_0xa27f('0x25')]=_0x15200d[_0xa27f('0x1d')];if(_[_0xa27f('0x23')](channels[_0x15200d['linkedid']][_0xa27f('0x26')])){channels[_0x15200d[_0xa27f('0x24')]][_0xa27f('0x26')]=utils[_0xa27f('0x1e')]();}channels[_0x15200d[_0xa27f('0x24')]][_0xa27f('0x27')]=dispositions[_['toNumber'](_0x15200d['channelstate'])]||_0xa27f('0x6');}}catch(_0xbb415){utils[_0xa27f('0x20')](util[_0xa27f('0xb')]('[%s][calls][newstate]',_0x15200d[_0xa27f('0x9')]),_0xbb415);}};exports[_0xa27f('0x28')]=function(_0x163ee8){try{if(!_['isNil'](channels[_0x163ee8['uniqueid']])){utils['debug'](util['format'](_0xa27f('0x29'),_0x163ee8['uniqueid']),_0x163ee8);if(_[_0xa27f('0x23')](channels[_0x163ee8['uniqueid']][_0xa27f('0x2a')])){channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x2a')]=_0x163ee8[_0xa27f('0x2b')]+'\x20<'+_0x163ee8[_0xa27f('0x1c')]+'>';}utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x2c'),_0x163ee8['uniqueid'],channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x2a')],_0x163ee8[_0xa27f('0x2d')]));channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x2e')]=utils[_0xa27f('0x1e')]();channels[_0x163ee8[_0xa27f('0x9')]]['duration']=utils['diffTime'](channels[_0x163ee8[_0xa27f('0x9')]]['endtime'],channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x2f')]);channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x30')]=channels[_0x163ee8[_0xa27f('0x9')]]['answertime']?utils['diffTime'](channels[_0x163ee8['uniqueid']][_0xa27f('0x2e')],channels[_0x163ee8[_0xa27f('0x9')]][_0xa27f('0x26')]):0x0;writeDB(channels[_0x163ee8[_0xa27f('0x9')]]);}}catch(_0x303f1b){utils[_0xa27f('0x20')](util[_0xa27f('0xb')](_0xa27f('0x29'),_0x163ee8['uniqueid']),_0x303f1b);}};exports['attendedtransfer']=function(_0x902b0c){try{if(!_[_0xa27f('0x23')](channels[_0x902b0c['localtwolinkedid']])){utils[_0xa27f('0x18')](util[_0xa27f('0xb')](_0xa27f('0x31'),_0x902b0c['origtransfereruniqueid']),_0x902b0c);if(channels[_0x902b0c[_0xa27f('0x32')]][_0xa27f('0x1d')]==_0x902b0c['transfereechannel']){utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x33'),_0x902b0c[_0xa27f('0x34')],_0x902b0c['localtwolinkedid'],_0x902b0c[_0xa27f('0x35')]));channels[_0x902b0c[_0xa27f('0x32')]][_0xa27f('0x25')]=_0x902b0c['secondtransfererchannel'];channels[_0x902b0c['localtwolinkedid']][_0xa27f('0x36')]=_0xa27f('0x37');}else if(channels[_0x902b0c[_0xa27f('0x32')]][_0xa27f('0x1d')]=_0x902b0c[_0xa27f('0x38')]){utils['info'](util[_0xa27f('0xb')](_0xa27f('0x33'),_0x902b0c[_0xa27f('0x34')],_0x902b0c['localtwolinkedid'],_0x902b0c['origtransfererchannel']));channels[_0x902b0c[_0xa27f('0x32')]][_0xa27f('0x25')]=_0x902b0c['origtransfererchannel'];channels[_0x902b0c[_0xa27f('0x32')]][_0xa27f('0x36')]=_0xa27f('0x37');}}}catch(_0x3394bb){utils[_0xa27f('0x20')](util[_0xa27f('0xb')](_0xa27f('0x31'),_0x902b0c[_0xa27f('0x34')]),_0x3394bb);}};exports[_0xa27f('0x39')]=function(_0x5f4086){try{if(!_[_0xa27f('0x23')](channels[_0x5f4086['uniqueid']])){utils[_0xa27f('0x18')](util[_0xa27f('0xb')]('[%s][calls][musiconholdstart]',_0x5f4086[_0xa27f('0x9')]),_0x5f4086);channels[_0x5f4086[_0xa27f('0x9')]]['musiconholdstartAt']=utils[_0xa27f('0x1e')]();utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5f4086[_0xa27f('0x9')],channels[_0x5f4086['uniqueid']]['musiconholdstartAt']));}}catch(_0x152892){utils['error'](util[_0xa27f('0xb')](_0xa27f('0x3a'),_0x5f4086[_0xa27f('0x9')]),_0x152892);}};exports[_0xa27f('0x3b')]=function(_0x1d2ebf){try{if(!_[_0xa27f('0x23')](channels[_0x1d2ebf[_0xa27f('0x9')]])){utils[_0xa27f('0x18')](util[_0xa27f('0xb')](_0xa27f('0x3c'),_0x1d2ebf[_0xa27f('0x9')]),_0x1d2ebf);if(!_['isNil'](channels[_0x1d2ebf[_0xa27f('0x9')]][_0xa27f('0x3d')])){channels[_0x1d2ebf[_0xa27f('0x9')]][_0xa27f('0x3e')]+=utils[_0xa27f('0x3f')](utils[_0xa27f('0x1e')](),channels[_0x1d2ebf[_0xa27f('0x9')]][_0xa27f('0x3d')]);utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x40'),_0x1d2ebf[_0xa27f('0x9')],channels[_0x1d2ebf[_0xa27f('0x9')]][_0xa27f('0x3e')]));delete channels[_0x1d2ebf[_0xa27f('0x9')]][_0xa27f('0x3d')];}}}catch(_0x4ac3ba){utils['error'](util[_0xa27f('0xb')](_0xa27f('0x3c'),_0x1d2ebf['uniqueid']),_0x4ac3ba);}};exports[_0xa27f('0x41')]=function(_0x5a7e9f){try{if(!_[_0xa27f('0x23')](channels[_0x5a7e9f['uniqueid']])){utils['debug'](util[_0xa27f('0xb')](_0xa27f('0x42'),_0x5a7e9f[_0xa27f('0x9')]),_0x5a7e9f);if(!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')]['xmd-originatecalleridnum'])){utils[_0xa27f('0xa')](util['format'](_0xa27f('0x44'),_0x5a7e9f[_0xa27f('0x9')],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f[_0xa27f('0x9')]][_0xa27f('0x46')]=_0x5a7e9f[_0xa27f('0x45')];}if(!_[_0xa27f('0x23')](_0x5a7e9f['variable'][_0xa27f('0x47')])){utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x48'),_0x5a7e9f[_0xa27f('0x9')],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f[_0xa27f('0x9')]][_0xa27f('0x49')]=_0x5a7e9f[_0xa27f('0x45')];channels[_0x5a7e9f['uniqueid']][_0xa27f('0x2a')]='\x22'+_0x5a7e9f[_0xa27f('0x45')]+'\x22\x20<'+_0x5a7e9f['value']+'>';}if(!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')][_0xa27f('0x4a')])||!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')]['xmd-callerid'])){utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5a7e9f[_0xa27f('0x9')],!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')]['xmd-callerid-preview'])?'xmd-callerid-preview':_0xa27f('0x4b'),_0x5a7e9f['value']));channels[_0x5a7e9f[_0xa27f('0x9')]][_0xa27f('0x2a')]=_0x5a7e9f[_0xa27f('0x45')];}if(!_[_0xa27f('0x23')](_0x5a7e9f['variable'][_0xa27f('0x4c')])||!_[_0xa27f('0x23')](_0x5a7e9f['variable'][_0xa27f('0x4d')])){utils['info'](util[_0xa27f('0xb')](_0xa27f('0x4e'),_0x5a7e9f[_0xa27f('0x9')],!_['isNil'](_0x5a7e9f[_0xa27f('0x43')][_0xa27f('0x4c')])?_0xa27f('0x4c'):_0xa27f('0x4d'),_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f[_0xa27f('0x9')]]['lastapplication']=_0xa27f('0x4f');channels[_0x5a7e9f['uniqueid']]['lastdata']=_0x5a7e9f[_0xa27f('0x45')];channels[_0x5a7e9f[_0xa27f('0x9')]][_0xa27f('0xc')]=!![];}if(!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')]['xmd-contactid'])){utils[_0xa27f('0xa')](util[_0xa27f('0xb')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5a7e9f['uniqueid'],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f['uniqueid']][_0xa27f('0x50')]=_0x5a7e9f[_0xa27f('0x45')];}if(!_[_0xa27f('0x23')](_0x5a7e9f[_0xa27f('0x43')][_0xa27f('0x51')])){utils['info'](util[_0xa27f('0xb')](_0xa27f('0x52'),_0x5a7e9f[_0xa27f('0x9')],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f['uniqueid']][_0xa27f('0x53')]=_0x5a7e9f['value'];}if(!_[_0xa27f('0x23')](_0x5a7e9f['variable'][_0xa27f('0x54')])){utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x55'),_0x5a7e9f['uniqueid'],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f[_0xa27f('0x9')]]['routeid']=_0x5a7e9f[_0xa27f('0x45')];}if(!_[_0xa27f('0x23')](_0x5a7e9f['variable']['sipcallid'])){utils['info'](util[_0xa27f('0xb')](_0xa27f('0x56'),_0x5a7e9f['uniqueid'],_0x5a7e9f[_0xa27f('0x45')]));channels[_0x5a7e9f[_0xa27f('0x9')]][_0xa27f('0x57')]=_0x5a7e9f[_0xa27f('0x45')];}}}catch(_0xa34549){utils[_0xa27f('0x20')](util['format'](_0xa27f('0x42'),_0x5a7e9f[_0xa27f('0x9')]),_0xa34549);}};exports[_0xa27f('0x58')]=function(_0x2cee14){try{if(!_[_0xa27f('0x23')](channels[_0x2cee14[_0xa27f('0x9')]])){utils[_0xa27f('0x18')](util[_0xa27f('0xb')](_0xa27f('0x59'),_0x2cee14[_0xa27f('0x9')]),_0x2cee14);utils[_0xa27f('0xa')](util[_0xa27f('0xb')](_0xa27f('0x5a'),_0x2cee14[_0xa27f('0x9')],_0x2cee14[_0xa27f('0x5b')],_0x2cee14[_0xa27f('0x5c')]));if(_0x2cee14[_0xa27f('0x5b')][_0xa27f('0x5d')]()==_0xa27f('0x5e')&&_[_0xa27f('0x5f')](_0x2cee14[_0xa27f('0x5c')][_0xa27f('0x5d')](),_0xa27f('0x60'))){var _0x9131b4=_0x2cee14[_0xa27f('0x5c')][_0xa27f('0x61')]('=');var _0x5a0eb7=_0x9131b4[0x0][_0xa27f('0x62')](_0x9131b4[0x0][_0xa27f('0x63')]('(')+0x1,_0x9131b4[0x0]['lastIndexOf'](')'));var _0xcddf99=_0x9131b4[0x1];channels[_0x2cee14['uniqueid']][_0x5a0eb7]=_0xcddf99;}if(!_[_0xa27f('0x64')]([_0xa27f('0x28'),_0xa27f('0x65'),_0xa27f('0x66'),_0xa27f('0x5e'),'gotoif'],_0x2cee14['application'][_0xa27f('0x5d')]())){channels[_0x2cee14[_0xa27f('0x9')]]['lastapplication']=_0x2cee14['application'];channels[_0x2cee14['uniqueid']][_0xa27f('0x67')]=_0x2cee14[_0xa27f('0x5c')];}}}catch(_0x447a93){utils[_0xa27f('0x20')](util[_0xa27f('0xb')](_0xa27f('0x59'),_0x2cee14[_0xa27f('0x9')]),_0x447a93);}}; \ No newline at end of file +var _0xa5aa=['blinds','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','split','lastIndexOf','execif','set','[%s][calls][newexten]','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request'];(function(_0x188304,_0x1ac3c6){var _0x4c3350=function(_0x2c920c){while(--_0x2c920c){_0x188304['push'](_0x188304['shift']());}};_0x4c3350(++_0x1ac3c6);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x4a44f0,_0x38e418){_0x4a44f0=_0x4a44f0-0x0;var _0x50d00c=_0xa5aa[_0x4a44f0];return _0x50d00c;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var utils=require('./utils');var transfers=require(_0xaa5a('0x2'));var dispositions=[_0xaa5a('0x3'),_0xaa5a('0x4'),_0xaa5a('0x4'),_0xaa5a('0x3'),_0xaa5a('0x3'),'NO\x20ANSWER',_0xaa5a('0x5'),_0xaa5a('0x6'),_0xaa5a('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x26e49b){var _0x3ec50a;if(transfers['blinds'][_0x26e49b[_0xaa5a('0x7')]]){_0x3ec50a=_0x26e49b[_0xaa5a('0x7')];_0x26e49b[_0xaa5a('0x7')]=transfers['blinds'][_0x26e49b[_0xaa5a('0x7')]][_0xaa5a('0x8')];}utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0xb'),_0x26e49b[_0xaa5a('0x7')],_0x26e49b['channel'],_0x26e49b[_0xaa5a('0xc')],_0x26e49b[_0xaa5a('0xd')],_0x26e49b[_0xaa5a('0xe')],_0x26e49b[_0xaa5a('0xf')],_0x26e49b[_0xaa5a('0x10')],_0x26e49b[_0xaa5a('0x11')]));if(_0x26e49b[_0xaa5a('0x12')]){utils[_0xaa5a('0x13')](_0x26e49b[_0xaa5a('0x12')])[_0xaa5a('0x14')](function(_0x1eb04d){if(_0x1eb04d){_0x26e49b[_0xaa5a('0x15')]=_0x1eb04d['id'];}utils['request'](_0xaa5a('0x16'),_0x26e49b);});}else{utils[_0xaa5a('0x17')](_0xaa5a('0x16'),_0x26e49b);}if(channels[_0x26e49b['uniqueid']]){delete channels[_0x26e49b[_0xaa5a('0x7')]];}else if(_0x3ec50a&&channels[_0x3ec50a]){if(!transfers[_0xaa5a('0x18')][_0x3ec50a][_0xaa5a('0x19')])delete transfers[_0xaa5a('0x18')][_0x3ec50a];delete channels[_0x3ec50a];}}exports[_0xaa5a('0x1a')]=function(_0x420d96){try{utils[_0xaa5a('0x1b')](util[_0xaa5a('0xa')](_0xaa5a('0x1c'),_0x420d96[_0xaa5a('0x7')]),_0x420d96);if(_0x420d96[_0xaa5a('0x7')]==_0x420d96[_0xaa5a('0x1d')]&&_0x420d96[_0xaa5a('0x1e')]!=_0xaa5a('0x1f')){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x20'),_0x420d96['uniqueid'],_0x420d96[_0xaa5a('0x21')],_0x420d96[_0xaa5a('0x22')]));channels[_0x420d96[_0xaa5a('0x7')]]={'uniqueid':_0x420d96[_0xaa5a('0x7')],'accountcode':_0x420d96['accountcode'],'source':_0x420d96[_0xaa5a('0xf')],'destination':_0x420d96[_0xaa5a('0x22')],'destinationcontext':_0x420d96[_0xaa5a('0x21')],'channel':_0x420d96[_0xaa5a('0x1e')],'starttime':utils[_0xaa5a('0x23')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xaa5a('0x3'),'amaflags':_0xaa5a('0x24')};}}catch(_0x1d3fbc){utils[_0xaa5a('0x25')](util['format'](_0xaa5a('0x1c'),_0x420d96['uniqueid']),_0x1d3fbc);}};exports[_0xaa5a('0x26')]=function(_0xbe9ce1){try{utils[_0xaa5a('0x1b')](util[_0xaa5a('0xa')](_0xaa5a('0x27'),_0xbe9ce1['uniqueid']),_0xbe9ce1);if(!_[_0xaa5a('0x28')](channels[_0xbe9ce1[_0xaa5a('0x7')]])&&_0xbe9ce1['channelstate']==0x6){utils[_0xaa5a('0x9')](util['format'](_0xaa5a('0x29'),_0xbe9ce1[_0xaa5a('0x7')],_0xbe9ce1[_0xaa5a('0x21')],_0xbe9ce1[_0xaa5a('0x1e')]));if(_[_0xaa5a('0x28')](channels[_0xbe9ce1[_0xaa5a('0x7')]]['systemanswertime'])){channels[_0xbe9ce1[_0xaa5a('0x7')]][_0xaa5a('0x2a')]=utils['now']();}}else if(!_[_0xaa5a('0x28')](channels[_0xbe9ce1[_0xaa5a('0x1d')]])&&_0xbe9ce1['channelstate']==0x6&&_0xbe9ce1[_0xaa5a('0x21')]!=_0xaa5a('0x2b')){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x2c'),_0xbe9ce1[_0xaa5a('0x7')],_0xbe9ce1['linkedid'],_0xbe9ce1[_0xaa5a('0x21')],_0xbe9ce1[_0xaa5a('0x1e')]));channels[_0xbe9ce1[_0xaa5a('0x1d')]][_0xaa5a('0x12')]=_0xbe9ce1['accountcode'];channels[_0xbe9ce1['linkedid']][_0xaa5a('0x2d')]=_0xbe9ce1[_0xaa5a('0x1e')];if(_['isNil'](channels[_0xbe9ce1[_0xaa5a('0x1d')]]['answertime'])){channels[_0xbe9ce1['linkedid']][_0xaa5a('0x2e')]=utils[_0xaa5a('0x23')]();}channels[_0xbe9ce1[_0xaa5a('0x1d')]][_0xaa5a('0x2f')]=dispositions[_[_0xaa5a('0x30')](_0xbe9ce1[_0xaa5a('0x31')])]||_0xaa5a('0x5');}}catch(_0x5632aa){utils[_0xaa5a('0x25')](util[_0xaa5a('0xa')](_0xaa5a('0x27'),_0xbe9ce1['uniqueid']),_0x5632aa);}};exports[_0xaa5a('0x32')]=function(_0x5314c5){try{if(!_[_0xaa5a('0x28')](channels[_0x5314c5['uniqueid']])){utils['debug'](util[_0xaa5a('0xa')](_0xaa5a('0x33'),_0x5314c5[_0xaa5a('0x7')]),_0x5314c5);if(_[_0xaa5a('0x28')](channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x34')])){channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x34')]=_0x5314c5['calleridname']+'\x20<'+_0x5314c5['calleridnum']+'>';}utils['info'](util[_0xaa5a('0xa')](_0xaa5a('0x35'),_0x5314c5[_0xaa5a('0x7')],channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x34')],_0x5314c5[_0xaa5a('0x36')]));channels[_0x5314c5['uniqueid']]['endtime']=utils['now']();channels[_0x5314c5[_0xaa5a('0x7')]]['duration']=utils['diffTime'](channels[_0x5314c5['uniqueid']][_0xaa5a('0x37')],channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x38')]);channels[_0x5314c5['uniqueid']][_0xaa5a('0x39')]=channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x2e')]?utils[_0xaa5a('0x3a')](channels[_0x5314c5[_0xaa5a('0x7')]]['endtime'],channels[_0x5314c5[_0xaa5a('0x7')]][_0xaa5a('0x2e')]):0x0;writeDB(channels[_0x5314c5[_0xaa5a('0x7')]]);}}catch(_0x37c931){utils[_0xaa5a('0x25')](util[_0xaa5a('0xa')](_0xaa5a('0x33'),_0x5314c5[_0xaa5a('0x7')]),_0x37c931);}};exports[_0xaa5a('0x3b')]=function(_0x557801){try{if(!_['isNil'](channels[_0x557801['localtwolinkedid']])){utils['debug'](util[_0xaa5a('0xa')](_0xaa5a('0x3c'),_0x557801[_0xaa5a('0x3d')]),_0x557801);if(channels[_0x557801[_0xaa5a('0x3e')]][_0xaa5a('0x1e')]==_0x557801[_0xaa5a('0x3f')]){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x40'),_0x557801[_0xaa5a('0x3d')],_0x557801['localtwolinkedid'],_0x557801[_0xaa5a('0x41')]));channels[_0x557801[_0xaa5a('0x3e')]][_0xaa5a('0x2d')]=_0x557801[_0xaa5a('0x41')];channels[_0x557801[_0xaa5a('0x3e')]][_0xaa5a('0x42')]=_0xaa5a('0x43');}else if(channels[_0x557801['localtwolinkedid']][_0xaa5a('0x1e')]=_0x557801[_0xaa5a('0x44')]){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x40'),_0x557801[_0xaa5a('0x3d')],_0x557801[_0xaa5a('0x3e')],_0x557801[_0xaa5a('0x45')]));channels[_0x557801[_0xaa5a('0x3e')]]['destinationchannel']=_0x557801['origtransfererchannel'];channels[_0x557801[_0xaa5a('0x3e')]][_0xaa5a('0x42')]=_0xaa5a('0x43');}}}catch(_0xd8337d){utils[_0xaa5a('0x25')](util[_0xaa5a('0xa')](_0xaa5a('0x3c'),_0x557801['origtransfereruniqueid']),_0xd8337d);}};exports[_0xaa5a('0x46')]=function(_0x77eb02){try{if(!_[_0xaa5a('0x28')](channels[_0x77eb02[_0xaa5a('0x7')]])){utils[_0xaa5a('0x1b')](util['format']('[%s][calls][musiconholdstart]',_0x77eb02['uniqueid']),_0x77eb02);channels[_0x77eb02['uniqueid']][_0xaa5a('0x47')]=utils[_0xaa5a('0x23')]();utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x48'),_0x77eb02[_0xaa5a('0x7')],channels[_0x77eb02[_0xaa5a('0x7')]][_0xaa5a('0x47')]));}}catch(_0x16a875){utils[_0xaa5a('0x25')](util[_0xaa5a('0xa')](_0xaa5a('0x49'),_0x77eb02[_0xaa5a('0x7')]),_0x16a875);}};exports[_0xaa5a('0x4a')]=function(_0x1758d9){try{if(!_['isNil'](channels[_0x1758d9['uniqueid']])){utils['debug'](util[_0xaa5a('0xa')](_0xaa5a('0x4b'),_0x1758d9[_0xaa5a('0x7')]),_0x1758d9);if(!_[_0xaa5a('0x28')](channels[_0x1758d9[_0xaa5a('0x7')]][_0xaa5a('0x47')])){channels[_0x1758d9[_0xaa5a('0x7')]][_0xaa5a('0x4c')]+=utils[_0xaa5a('0x3a')](utils[_0xaa5a('0x23')](),channels[_0x1758d9[_0xaa5a('0x7')]][_0xaa5a('0x47')]);utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x4d'),_0x1758d9['uniqueid'],channels[_0x1758d9[_0xaa5a('0x7')]][_0xaa5a('0x4c')]));delete channels[_0x1758d9[_0xaa5a('0x7')]][_0xaa5a('0x47')];}}}catch(_0x20db3f){utils[_0xaa5a('0x25')](util[_0xaa5a('0xa')](_0xaa5a('0x4b'),_0x1758d9[_0xaa5a('0x7')]),_0x20db3f);}};exports[_0xaa5a('0x4e')]=function(_0x28f8b3){try{if(!_[_0xaa5a('0x28')](channels[_0x28f8b3[_0xaa5a('0x7')]])){utils[_0xaa5a('0x1b')](util[_0xaa5a('0xa')](_0xaa5a('0x4f'),_0x28f8b3[_0xaa5a('0x7')]),_0x28f8b3);if(!_[_0xaa5a('0x28')](_0x28f8b3['variable'][_0xaa5a('0x50')])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x28f8b3[_0xaa5a('0x7')],_0x28f8b3[_0xaa5a('0x51')]));channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0x52')]=_0x28f8b3[_0xaa5a('0x51')];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')]['xmd-phone'])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x54'),_0x28f8b3[_0xaa5a('0x7')],_0x28f8b3[_0xaa5a('0x51')]));channels[_0x28f8b3[_0xaa5a('0x7')]]['destination']=_0x28f8b3[_0xaa5a('0x51')];channels[_0x28f8b3['uniqueid']][_0xaa5a('0x34')]='\x22'+_0x28f8b3['value']+'\x22\x20<'+_0x28f8b3[_0xaa5a('0x51')]+'>';}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x55')])||!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x56')])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x57'),_0x28f8b3['uniqueid'],!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x55')])?_0xaa5a('0x55'):_0xaa5a('0x56'),_0x28f8b3[_0xaa5a('0x51')]));channels[_0x28f8b3['uniqueid']][_0xaa5a('0x34')]=_0x28f8b3[_0xaa5a('0x51')];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')]['xmd-queue'])||!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')]['xmcs-queue'])){utils[_0xaa5a('0x9')](util['format'](_0xaa5a('0x57'),_0x28f8b3[_0xaa5a('0x7')],!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x58')])?_0xaa5a('0x58'):_0xaa5a('0x59'),_0x28f8b3['value']));channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0x5a')]=_0xaa5a('0x5b');channels[_0x28f8b3['uniqueid']][_0xaa5a('0x5c')]=_0x28f8b3[_0xaa5a('0x51')];channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0xc')]=!![];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x5d')])){utils[_0xaa5a('0x9')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x28f8b3[_0xaa5a('0x7')],_0x28f8b3['value']));channels[_0x28f8b3['uniqueid']][_0xaa5a('0x5e')]=_0x28f8b3[_0xaa5a('0x51')];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x5f')])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x60'),_0x28f8b3[_0xaa5a('0x7')],_0x28f8b3['value']));channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0x61')]=_0x28f8b3[_0xaa5a('0x51')];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')][_0xaa5a('0x62')])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x63'),_0x28f8b3['uniqueid'],_0x28f8b3[_0xaa5a('0x51')]));channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0x64')]=_0x28f8b3[_0xaa5a('0x51')];}if(!_[_0xaa5a('0x28')](_0x28f8b3[_0xaa5a('0x53')]['sipcallid'])){utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x28f8b3[_0xaa5a('0x7')],_0x28f8b3['value']));channels[_0x28f8b3[_0xaa5a('0x7')]][_0xaa5a('0x65')]=_0x28f8b3[_0xaa5a('0x51')];}}}catch(_0x4583a0){utils['error'](util[_0xaa5a('0xa')](_0xaa5a('0x4f'),_0x28f8b3[_0xaa5a('0x7')]),_0x4583a0);}};exports['newexten']=function(_0x4afa28){try{if(!_['isNil'](channels[_0x4afa28[_0xaa5a('0x7')]])){utils[_0xaa5a('0x1b')](util[_0xaa5a('0xa')]('[%s][calls][newexten]',_0x4afa28[_0xaa5a('0x7')]),_0x4afa28);utils[_0xaa5a('0x9')](util[_0xaa5a('0xa')](_0xaa5a('0x66'),_0x4afa28['uniqueid'],_0x4afa28[_0xaa5a('0x67')],_0x4afa28['appdata']));if(_0x4afa28[_0xaa5a('0x67')][_0xaa5a('0x68')]()=='set'&&_[_0xaa5a('0x69')](_0x4afa28['appdata'][_0xaa5a('0x68')](),_0xaa5a('0x6a'))){var _0x1e374d=_0x4afa28[_0xaa5a('0x6b')][_0xaa5a('0x6c')]('=');var _0x9c5c56=_0x1e374d[0x0]['substring'](_0x1e374d[0x0][_0xaa5a('0x6d')]('(')+0x1,_0x1e374d[0x0][_0xaa5a('0x6d')](')'));var _0x3fd5c9=_0x1e374d[0x1];channels[_0x4afa28[_0xaa5a('0x7')]][_0x9c5c56]=_0x3fd5c9;}if(!_['includes']([_0xaa5a('0x32'),'noop',_0xaa5a('0x6e'),_0xaa5a('0x6f'),'gotoif'],_0x4afa28[_0xaa5a('0x67')][_0xaa5a('0x68')]())){channels[_0x4afa28[_0xaa5a('0x7')]][_0xaa5a('0x5a')]=_0x4afa28[_0xaa5a('0x67')];channels[_0x4afa28['uniqueid']][_0xaa5a('0x5c')]=_0x4afa28[_0xaa5a('0x6b')];}}}catch(_0x11145a){utils[_0xaa5a('0x25')](util['format'](_0xaa5a('0x70'),_0x4afa28[_0xaa5a('0x7')]),_0x11145a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5947d28..1379403 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 _0x94a1=['[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','info','[core]\x20connected','shutdown'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x94a1,0x8b));var _0x194a=function(_0x42c7bf,_0x47904a){_0x42c7bf=_0x42c7bf-0x0;var _0x59aaa1=_0x94a1[_0x42c7bf];return _0x59aaa1;};'use strict';var utils=require(_0x194a('0x0'));exports['connect']=function(){utils[_0x194a('0x1')](_0x194a('0x2'));};exports[_0x194a('0x3')]=function(){utils[_0x194a('0x1')](_0x194a('0x4'));};exports[_0x194a('0x5')]=function(){utils[_0x194a('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x333fc2){utils[_0x194a('0x6')](_0x194a('0x7'),_0x333fc2);};exports[_0x194a('0x8')]=function(){utils['info'](_0x194a('0x9'));};exports[_0x194a('0xa')]=function(_0x48a465){}; \ No newline at end of file +var _0xd468=['shutdown','error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected'];(function(_0x2a363d,_0x249fc5){var _0x286633=function(_0x1d40e6){while(--_0x1d40e6){_0x2a363d['push'](_0x2a363d['shift']());}};_0x286633(++_0x249fc5);}(_0xd468,0x11c));var _0x8d46=function(_0x5827d3,_0x309974){_0x5827d3=_0x5827d3-0x0;var _0x19059a=_0xd468[_0x5827d3];return _0x19059a;};'use strict';var utils=require(_0x8d46('0x0'));exports[_0x8d46('0x1')]=function(){utils[_0x8d46('0x2')](_0x8d46('0x3'));};exports[_0x8d46('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports['fullybooted']=function(){utils['info']('[core]\x20fullybooted');};exports[_0x8d46('0x5')]=function(_0x1b2cdd){utils[_0x8d46('0x5')](_0x8d46('0x6'),_0x1b2cdd);};exports[_0x8d46('0x7')]=function(){utils[_0x8d46('0x2')]('[core]\x20close');};exports[_0x8d46('0x8')]=function(_0x384795){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 734676f..0f3e9ab 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 _0x4b64=['[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','endtime','diffTime','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr(routeid)','split','error','debug','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','called'];(function(_0x2a506e,_0x340c2e){var _0x14936e=function(_0x392116){while(--_0x392116){_0x2a506e['push'](_0x2a506e['shift']());}};_0x14936e(++_0x340c2e);}(_0x4b64,0x74));var _0x44b6=function(_0x5dbe03,_0x2941ff){_0x5dbe03=_0x5dbe03-0x0;var _0x8f51a9=_0x4b64[_0x5dbe03];return _0x8f51a9;};'use strict';var _=require('lodash');var util=require(_0x44b6('0x0'));var utils=require(_0x44b6('0x1'));var dials={};function writeDB(_0x340090){utils[_0x44b6('0x2')](util[_0x44b6('0x3')](_0x44b6('0x4'),_0x340090[_0x44b6('0x5')],_0x340090[_0x44b6('0x6')],_0x340090['dialstring'],_0x340090[_0x44b6('0x7')],_0x340090['connectedlinenum'],_0x340090[_0x44b6('0x8')]));utils['request'](_0x44b6('0x9'),_0x340090);delete dials[_0x340090[_0x44b6('0x5')]];}exports[_0x44b6('0xa')]=function(_0x18670a){try{utils['debug'](util[_0x44b6('0x3')](_0x44b6('0xb'),_0x18670a[_0x44b6('0x5')]),_0x18670a);utils['info'](util[_0x44b6('0x3')](_0x44b6('0xc'),_0x18670a[_0x44b6('0x5')],_0x18670a[_0x44b6('0xd')],_0x18670a[_0x44b6('0xe')]));if(_0x18670a[_0x44b6('0xd')][_0x44b6('0xf')]()==_0x44b6('0x10')&&_['startsWith'](_0x18670a[_0x44b6('0xe')][_0x44b6('0xf')](),_0x44b6('0x11'))){var _0x4adec2=_0x18670a[_0x44b6('0xe')][_0x44b6('0x12')]('=');dials[_0x18670a['uniqueid']]={'routeId':_0x4adec2[0x1]};}}catch(_0x4244da){utils[_0x44b6('0x13')](util[_0x44b6('0x3')](_0x44b6('0xb'),_0x18670a[_0x44b6('0x5')]),_0x4244da);}};exports['varset']=function(_0x15cbf0){try{utils[_0x44b6('0x14')](util[_0x44b6('0x3')](_0x44b6('0x15'),_0x15cbf0['uniqueid']),_0x15cbf0);if(!_['isNil'](_0x15cbf0[_0x44b6('0x16')]['outboundrouteid'])){utils['info'](util[_0x44b6('0x3')](_0x44b6('0x17'),_0x15cbf0['uniqueid'],_0x15cbf0[_0x44b6('0x18')]));dials[_0x15cbf0['uniqueid']]={'routeId':_0x15cbf0[_0x44b6('0x18')]};}}catch(_0x46fc71){utils[_0x44b6('0x13')](util[_0x44b6('0x3')](_0x44b6('0x15'),_0x15cbf0[_0x44b6('0x5')]),_0x46fc71);}};exports[_0x44b6('0x19')]=function(_0x2647fd){try{if(!_[_0x44b6('0x1a')](dials[_0x2647fd['uniqueid']])){utils[_0x44b6('0x14')](util[_0x44b6('0x3')](_0x44b6('0x1b'),_0x2647fd[_0x44b6('0x5')]),_0x2647fd);dials[_0x2647fd[_0x44b6('0x5')]]=_[_0x44b6('0x1c')](dials[_0x2647fd[_0x44b6('0x5')]],_0x2647fd);dials[_0x2647fd['uniqueid']]['starttime']=utils[_0x44b6('0x1d')]();dials[_0x2647fd['uniqueid']]['lastevent']=_0x44b6('0x1e');utils[_0x44b6('0x2')](util[_0x44b6('0x3')](_0x44b6('0x1f'),_0x2647fd[_0x44b6('0x5')],dials[_0x2647fd[_0x44b6('0x5')]][_0x44b6('0x20')]));}}catch(_0x16a125){utils[_0x44b6('0x13')](util[_0x44b6('0x3')](_0x44b6('0x1b'),_0x2647fd['uniqueid']),_0x16a125);}};exports[_0x44b6('0x21')]=function(_0x4fa760){try{if(!_['isNil'](dials[_0x4fa760['uniqueid']])){utils[_0x44b6('0x14')](util[_0x44b6('0x3')]('[%s][dials][dialend]',_0x4fa760['uniqueid']),_0x4fa760);dials[_0x4fa760[_0x44b6('0x5')]][_0x44b6('0x8')]=_0x4fa760[_0x44b6('0x8')];if(_0x4fa760[_0x44b6('0x8')]==_0x44b6('0x22')){dials[_0x4fa760[_0x44b6('0x5')]]=_['assign'](dials[_0x4fa760[_0x44b6('0x5')]],_0x4fa760);dials[_0x4fa760[_0x44b6('0x5')]]['answertime']=utils[_0x44b6('0x1d')]();dials[_0x4fa760[_0x44b6('0x5')]][_0x44b6('0x23')]=_0x44b6('0x24');utils[_0x44b6('0x2')](util['format'](_0x44b6('0x25'),_0x4fa760[_0x44b6('0x5')],_0x4fa760[_0x44b6('0x8')],dials[_0x4fa760[_0x44b6('0x5')]][_0x44b6('0x26')]));}else{utils[_0x44b6('0x2')](util[_0x44b6('0x3')](_0x44b6('0x27'),_0x4fa760['uniqueid'],_0x4fa760[_0x44b6('0x8')]));}}}catch(_0x4c63aa){utils['error'](util[_0x44b6('0x3')](_0x44b6('0x28'),_0x4fa760['uniqueid']),_0x4c63aa);}};exports[_0x44b6('0x29')]=function(_0x352584){try{if(!_['isNil'](dials[_0x352584[_0x44b6('0x5')]])){utils[_0x44b6('0x14')](util[_0x44b6('0x3')](_0x44b6('0x2a'),_0x352584['uniqueid']),_0x352584);utils[_0x44b6('0x2')](util['format'](_0x44b6('0x2b'),_0x352584[_0x44b6('0x5')],_0x352584[_0x44b6('0x7')],_0x352584[_0x44b6('0x2c')],_0x352584['cause-txt']));dials[_0x352584[_0x44b6('0x5')]]=_[_0x44b6('0x1c')](dials[_0x352584[_0x44b6('0x5')]],{'endtime':utils[_0x44b6('0x1d')](),'lastevent':_0x44b6('0x2d')});dials[_0x352584['uniqueid']][_0x44b6('0x2e')]=utils['diffTime'](dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x2f')],dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x20')]);dials[_0x352584[_0x44b6('0x5')]]['holdtime']=utils[_0x44b6('0x30')](dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x26')]||dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x2f')],dials[_0x352584['uniqueid']]['starttime']);dials[_0x352584[_0x44b6('0x5')]]['billableseconds']=dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x26')]?utils[_0x44b6('0x30')](dials[_0x352584[_0x44b6('0x5')]][_0x44b6('0x2f')],dials[_0x352584[_0x44b6('0x5')]]['answertime']):0x0;writeDB(dials[_0x352584[_0x44b6('0x5')]]);}}catch(_0x1257ad){utils[_0x44b6('0x13')](util['format'](_0x44b6('0x2a'),_0x352584[_0x44b6('0x5')]),_0x1257ad);}}; \ No newline at end of file +var _0x2c15=['debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','holdtime','endtime','billableseconds','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','calleridnum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split','error','varset'];(function(_0x81d554,_0x23537d){var _0x3e46d2=function(_0x30ad48){while(--_0x30ad48){_0x81d554['push'](_0x81d554['shift']());}};_0x3e46d2(++_0x23537d);}(_0x2c15,0xef));var _0x52c1=function(_0x493edd,_0x1e7627){_0x493edd=_0x493edd-0x0;var _0x33ec30=_0x2c15[_0x493edd];return _0x33ec30;};'use strict';var _=require('lodash');var util=require(_0x52c1('0x0'));var utils=require(_0x52c1('0x1'));var dials={};function writeDB(_0x5a9c20){utils[_0x52c1('0x2')](util['format'](_0x52c1('0x3'),_0x5a9c20['uniqueid'],_0x5a9c20['channel'],_0x5a9c20['dialstring'],_0x5a9c20[_0x52c1('0x4')],_0x5a9c20['connectedlinenum'],_0x5a9c20[_0x52c1('0x5')]));utils[_0x52c1('0x6')](_0x52c1('0x7'),_0x5a9c20);delete dials[_0x5a9c20[_0x52c1('0x8')]];}exports[_0x52c1('0x9')]=function(_0x5eab91){try{utils['debug'](util[_0x52c1('0xa')](_0x52c1('0xb'),_0x5eab91[_0x52c1('0x8')]),_0x5eab91);utils[_0x52c1('0x2')](util[_0x52c1('0xa')](_0x52c1('0xc'),_0x5eab91[_0x52c1('0x8')],_0x5eab91[_0x52c1('0xd')],_0x5eab91['appdata']));if(_0x5eab91[_0x52c1('0xd')][_0x52c1('0xe')]()==_0x52c1('0xf')&&_['startsWith'](_0x5eab91[_0x52c1('0x10')][_0x52c1('0xe')](),_0x52c1('0x11'))){var _0x3cc78d=_0x5eab91[_0x52c1('0x10')][_0x52c1('0x12')]('=');dials[_0x5eab91['uniqueid']]={'routeId':_0x3cc78d[0x1]};}}catch(_0x1f1c6c){utils[_0x52c1('0x13')](util[_0x52c1('0xa')](_0x52c1('0xb'),_0x5eab91[_0x52c1('0x8')]),_0x1f1c6c);}};exports[_0x52c1('0x14')]=function(_0x50844b){try{utils[_0x52c1('0x15')](util[_0x52c1('0xa')](_0x52c1('0x16'),_0x50844b[_0x52c1('0x8')]),_0x50844b);if(!_[_0x52c1('0x17')](_0x50844b[_0x52c1('0x18')]['outboundrouteid'])){utils['info'](util[_0x52c1('0xa')](_0x52c1('0x19'),_0x50844b[_0x52c1('0x8')],_0x50844b[_0x52c1('0x1a')]));dials[_0x50844b['uniqueid']]={'routeId':_0x50844b[_0x52c1('0x1a')]};}}catch(_0x21f260){utils[_0x52c1('0x13')](util['format'](_0x52c1('0x16'),_0x50844b[_0x52c1('0x8')]),_0x21f260);}};exports[_0x52c1('0x1b')]=function(_0x2746de){try{if(!_[_0x52c1('0x17')](dials[_0x2746de['uniqueid']])){utils['debug'](util[_0x52c1('0xa')](_0x52c1('0x1c'),_0x2746de[_0x52c1('0x8')]),_0x2746de);dials[_0x2746de['uniqueid']]=_['assign'](dials[_0x2746de[_0x52c1('0x8')]],_0x2746de);dials[_0x2746de[_0x52c1('0x8')]][_0x52c1('0x1d')]=utils[_0x52c1('0x1e')]();dials[_0x2746de[_0x52c1('0x8')]][_0x52c1('0x1f')]=_0x52c1('0x20');utils[_0x52c1('0x2')](util['format'](_0x52c1('0x21'),_0x2746de[_0x52c1('0x8')],dials[_0x2746de[_0x52c1('0x8')]][_0x52c1('0x1d')]));}}catch(_0x1ccba2){utils[_0x52c1('0x13')](util[_0x52c1('0xa')](_0x52c1('0x1c'),_0x2746de['uniqueid']),_0x1ccba2);}};exports[_0x52c1('0x22')]=function(_0x42038f){try{if(!_['isNil'](dials[_0x42038f[_0x52c1('0x8')]])){utils['debug'](util[_0x52c1('0xa')](_0x52c1('0x23'),_0x42038f[_0x52c1('0x8')]),_0x42038f);dials[_0x42038f[_0x52c1('0x8')]][_0x52c1('0x5')]=_0x42038f[_0x52c1('0x5')];if(_0x42038f[_0x52c1('0x5')]==_0x52c1('0x24')){dials[_0x42038f['uniqueid']]=_[_0x52c1('0x25')](dials[_0x42038f[_0x52c1('0x8')]],_0x42038f);dials[_0x42038f['uniqueid']][_0x52c1('0x26')]=utils[_0x52c1('0x1e')]();dials[_0x42038f[_0x52c1('0x8')]][_0x52c1('0x1f')]=_0x52c1('0x27');utils[_0x52c1('0x2')](util[_0x52c1('0xa')](_0x52c1('0x28'),_0x42038f[_0x52c1('0x8')],_0x42038f['dialstatus'],dials[_0x42038f[_0x52c1('0x8')]][_0x52c1('0x26')]));}else{utils['info'](util[_0x52c1('0xa')](_0x52c1('0x29'),_0x42038f[_0x52c1('0x8')],_0x42038f[_0x52c1('0x5')]));}}}catch(_0x12eb40){utils[_0x52c1('0x13')](util[_0x52c1('0xa')](_0x52c1('0x23'),_0x42038f[_0x52c1('0x8')]),_0x12eb40);}};exports[_0x52c1('0x2a')]=function(_0x15df43){try{if(!_[_0x52c1('0x17')](dials[_0x15df43['uniqueid']])){utils[_0x52c1('0x15')](util[_0x52c1('0xa')](_0x52c1('0x2b'),_0x15df43[_0x52c1('0x8')]),_0x15df43);utils[_0x52c1('0x2')](util['format'](_0x52c1('0x2c'),_0x15df43[_0x52c1('0x8')],_0x15df43[_0x52c1('0x4')],_0x15df43[_0x52c1('0x2d')],_0x15df43[_0x52c1('0x2e')]));dials[_0x15df43[_0x52c1('0x8')]]=_['assign'](dials[_0x15df43['uniqueid']],{'endtime':utils[_0x52c1('0x1e')](),'lastevent':'complete'});dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x2f')]=utils[_0x52c1('0x30')](dials[_0x15df43[_0x52c1('0x8')]]['endtime'],dials[_0x15df43[_0x52c1('0x8')]]['starttime']);dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x31')]=utils['diffTime'](dials[_0x15df43[_0x52c1('0x8')]]['answertime']||dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x32')],dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x1d')]);dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x33')]=dials[_0x15df43[_0x52c1('0x8')]]['answertime']?utils[_0x52c1('0x30')](dials[_0x15df43['uniqueid']]['endtime'],dials[_0x15df43[_0x52c1('0x8')]][_0x52c1('0x26')]):0x0;writeDB(dials[_0x15df43['uniqueid']]);}}catch(_0x596b0e){utils['error'](util[_0x52c1('0xa')](_0x52c1('0x2b'),_0x15df43[_0x52c1('0x8')]),_0x596b0e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 58f3009..fc3e41f 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 _0x16d5=['../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager'];(function(_0x3863b2,_0x13e404){var _0x209711=function(_0x30ed8e){while(--_0x30ed8e){_0x3863b2['push'](_0x3863b2['shift']());}};_0x209711(++_0x13e404);}(_0x16d5,0x1f0));var _0x516d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16d5[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0x516d('0x0'));var config=require(_0x516d('0x1'));var utils=require('./utils');var util=require(_0x516d('0x2'));var isXDREnabled=config['xdr']&&config[_0x516d('0x3')]['disabled']?!config['xdr'][_0x516d('0x4')]:!![];var isProduction=config[_0x516d('0x5')]===_0x516d('0x6')||![];var isLocalAsterisk=config[_0x516d('0x3')]&&config[_0x516d('0x3')][_0x516d('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x516d('0x8')][_0x516d('0x9')],config['asterisk']['ip'],config[_0x516d('0x8')]['username'],config[_0x516d('0x8')][_0x516d('0xa')],!![]);ami[_0x516d('0xb')]();if(!isXDREnabled){utils[_0x516d('0xc')](_0x516d('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x516d('0xc')](_0x516d('0xe'));}else{var agents=require(_0x516d('0xf'));var calls=require(_0x516d('0x10'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x516d('0x11'));var transfers=require(_0x516d('0x12'));var core=require(_0x516d('0x13'));ami['on'](_0x516d('0x14'),core[_0x516d('0x14')]);ami['on'](_0x516d('0x15'),core['shutdown']);ami['on'](_0x516d('0x16'),core[_0x516d('0x16')]);ami['on'](_0x516d('0x17'),core[_0x516d('0x17')]);ami['on'](_0x516d('0x18'),core[_0x516d('0x18')]);ami['on'](_0x516d('0x19'),core[_0x516d('0x19')]);ami['on'](_0x516d('0x1a'),function(_0x37b15e){try{utils[_0x516d('0x1b')](util['format'](_0x516d('0x1c'),_0x37b15e[_0x516d('0x1d')]),_0x37b15e);members['devicestatechange'](_0x37b15e);}catch(_0x2f4c41){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x1c'),_0x37b15e['device']),_0x2f4c41);}});ami['on'](_0x516d('0x1f'),function(_0x2b290c){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x20'),_0x2b290c['uniqueid']),_0x2b290c);agents[_0x516d('0x1f')](_0x2b290c);}catch(_0x1917c8){utils['error'](util[_0x516d('0x1e')]('[%s][index][agentcalled]',_0x2b290c[_0x516d('0x21')]),_0x1917c8);}});ami['on'](_0x516d('0x22'),function(_0x5e53f7){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x23'),_0x5e53f7[_0x516d('0x21')]),_0x5e53f7);agents['agentringnoanswer'](_0x5e53f7);}catch(_0x2716e0){utils['error'](util[_0x516d('0x1e')](_0x516d('0x23'),_0x5e53f7[_0x516d('0x21')]),_0x2716e0);}});ami['on'](_0x516d('0x24'),function(_0x4b96b6){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')]('[%s][index][agentconnect]',_0x4b96b6[_0x516d('0x21')]),_0x4b96b6);agents['agentconnect'](_0x4b96b6);queues[_0x516d('0x24')](_0x4b96b6);}catch(_0xbb00b9){utils['error'](util[_0x516d('0x1e')](_0x516d('0x25'),_0x4b96b6[_0x516d('0x21')]),_0xbb00b9);}});ami['on'](_0x516d('0x26'),function(_0x46a724){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x27'),_0x46a724[_0x516d('0x21')]),_0x46a724);agents['agentcomplete'](_0x46a724);queues[_0x516d('0x26')](_0x46a724);members[_0x516d('0x26')](_0x46a724);}catch(_0x10c819){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x27'),_0x46a724['uniqueid']),_0x10c819);}});ami['on'](_0x516d('0x28'),function(_0x180fdf){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x29'),_0x180fdf[_0x516d('0x21')]),_0x180fdf);agents[_0x516d('0x28')](_0x180fdf);queues[_0x516d('0x28')](_0x180fdf);}catch(_0x5ec701){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x29'),_0x180fdf[_0x516d('0x21')]),_0x5ec701);}});ami['on'](_0x516d('0x2a'),function(_0x360e52){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x2b'),_0x360e52['uniqueid']),_0x360e52);queues['queuecallerjoin'](_0x360e52);recordings[_0x516d('0x2a')](_0x360e52);}catch(_0x2e761e){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x2b'),_0x360e52['uniqueid']),_0x2e761e);}});ami['on'](_0x516d('0x2c'),function(_0x23a156){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x2d'),_0x23a156['uniqueid']),_0x23a156);queues[_0x516d('0x2c')](_0x23a156);}catch(_0x3de5de){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x2d'),_0x23a156[_0x516d('0x21')]),_0x3de5de);}});ami['on']('musiconholdstart',function(_0x45de22){try{utils['debug'](util['format'](_0x516d('0x2e'),_0x45de22[_0x516d('0x21')]),_0x45de22);queues[_0x516d('0x2f')](_0x45de22);calls[_0x516d('0x2f')](_0x45de22);}catch(_0x3ea3f1){utils[_0x516d('0x17')](util['format'](_0x516d('0x2e'),_0x45de22[_0x516d('0x21')]),_0x3ea3f1);}});ami['on']('musiconholdstop',function(_0x3d1d31){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x30'),_0x3d1d31['uniqueid']),_0x3d1d31);queues[_0x516d('0x31')](_0x3d1d31);calls['musiconholdstop'](_0x3d1d31);}catch(_0x3ce9f9){utils[_0x516d('0x17')](util[_0x516d('0x1e')]('[%s][index][musiconholdstop]',_0x3d1d31[_0x516d('0x21')]),_0x3ce9f9);}});ami['on'](_0x516d('0x32'),function(_0x3befbf){try{utils['debug'](util['format'](_0x516d('0x33'),_0x3befbf[_0x516d('0x21')]),_0x3befbf);calls[_0x516d('0x32')](_0x3befbf);recordings[_0x516d('0x32')](_0x3befbf);}catch(_0x2cae45){utils[_0x516d('0x17')](util['format']('[%s][index][newstate]',_0x3befbf[_0x516d('0x21')]),_0x2cae45);}});ami['on'](_0x516d('0x34'),function(_0x3e255c){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x35'),_0x3e255c[_0x516d('0x21')]),_0x3e255c);calls[_0x516d('0x34')](_0x3e255c);recordings[_0x516d('0x34')](_0x3e255c);dials[_0x516d('0x34')](_0x3e255c);agents[_0x516d('0x34')](_0x3e255c);queues[_0x516d('0x34')](_0x3e255c);}catch(_0x158764){utils[_0x516d('0x17')](util[_0x516d('0x1e')]('[%s][index][hangup]',_0x3e255c[_0x516d('0x21')]),_0x158764);}});ami['on'](_0x516d('0x36'),function(_0x510a38){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x37'),_0x510a38[_0x516d('0x21')]),_0x510a38);members[_0x516d('0x36')](_0x510a38);}catch(_0x43e272){utils['error'](util[_0x516d('0x1e')](_0x516d('0x37'),_0x510a38['uniqueid']),_0x43e272);}});ami['on'](_0x516d('0x38'),function(_0x24a873){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x39'),_0x24a873[_0x516d('0x21')]),_0x24a873);queues[_0x516d('0x38')](_0x24a873);agents[_0x516d('0x38')](_0x24a873);transfers[_0x516d('0x38')](_0x24a873);recordings['blindtransfer'](_0x24a873);}catch(_0x5d725f){utils[_0x516d('0x17')](util['format'](_0x516d('0x39'),_0x24a873[_0x516d('0x21')]),_0x5d725f);}});ami['on'](_0x516d('0x3a'),function(_0x3aac55){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x3b'),_0x3aac55[_0x516d('0x3c')]),_0x3aac55);queues[_0x516d('0x3a')](_0x3aac55);transfers[_0x516d('0x3a')](_0x3aac55);agents[_0x516d('0x3a')](_0x3aac55);calls[_0x516d('0x3a')](_0x3aac55);}catch(_0x4ac1e3){utils[_0x516d('0x17')](util['format'](_0x516d('0x3b'),_0x3aac55[_0x516d('0x3c')]),_0x4ac1e3);}});ami['on'](_0x516d('0x3d'),function(_0x25fe56){try{utils[_0x516d('0x1b')](util['format'](_0x516d('0x3e'),_0x25fe56['uniqueid']),_0x25fe56);queues[_0x516d('0x3d')](_0x25fe56);recordings[_0x516d('0x3d')](_0x25fe56);calls[_0x516d('0x3d')](_0x25fe56);dials[_0x516d('0x3d')](_0x25fe56);}catch(_0x53e580){utils[_0x516d('0x17')](util[_0x516d('0x1e')]('[%s][index][varset]',_0x25fe56['uniqueid']),_0x53e580);}});ami['on'](_0x516d('0x3f'),function(_0x35d520){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')]('[%s][index][newexten]',_0x35d520['uniqueid']),_0x35d520);calls[_0x516d('0x3f')](_0x35d520);recordings['newexten'](_0x35d520);dials[_0x516d('0x3f')](_0x35d520);}catch(_0x18d640){utils['error'](util[_0x516d('0x1e')]('[%s][index][newexten]',_0x35d520['uniqueid']),_0x18d640);}});ami['on'](_0x516d('0x40'),function(_0x452686){try{utils[_0x516d('0x1b')](util[_0x516d('0x1e')](_0x516d('0x41'),_0x452686[_0x516d('0x21')]),_0x452686);calls[_0x516d('0x40')](_0x452686);recordings[_0x516d('0x40')](_0x452686);}catch(_0xa49355){utils['error'](util[_0x516d('0x1e')](_0x516d('0x41'),_0x452686['uniqueid']),_0xa49355);}});ami['on'](_0x516d('0x42'),function(_0x360651){try{utils[_0x516d('0x1b')](util['format'](_0x516d('0x43'),_0x360651[_0x516d('0x21')]),_0x360651);dials[_0x516d('0x42')](_0x360651);}catch(_0x553392){utils['error'](util[_0x516d('0x1e')](_0x516d('0x44'),_0x360651[_0x516d('0x21')]),_0x553392);}});ami['on'](_0x516d('0x45'),function(_0x29240d){try{utils['debug'](util[_0x516d('0x1e')](_0x516d('0x46'),_0x29240d[_0x516d('0x21')]),_0x29240d);dials[_0x516d('0x45')](_0x29240d);}catch(_0x1d1d96){utils[_0x516d('0x17')](util[_0x516d('0x1e')](_0x516d('0x46'),_0x29240d[_0x516d('0x21')]),_0x1d1d96);}});} \ No newline at end of file +var _0xd41e=['attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','asterisk','port','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd41e,0x95));var _0xed41=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0xd41e[_0x44fef1];return _0x3c3a04;};var AsteriskManager=require(_0xed41('0x0'));var config=require(_0xed41('0x1'));var utils=require(_0xed41('0x2'));var util=require(_0xed41('0x3'));var isXDREnabled=config[_0xed41('0x4')]&&config[_0xed41('0x4')][_0xed41('0x5')]?!config['xdr'][_0xed41('0x5')]:!![];var isProduction=config['env']===_0xed41('0x6')||![];var isLocalAsterisk=config[_0xed41('0x4')]&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0xed41('0x7')][_0xed41('0x8')],config[_0xed41('0x7')]['ip'],config[_0xed41('0x7')]['username'],config[_0xed41('0x7')][_0xed41('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xed41('0xa')](_0xed41('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xed41('0xa')](_0xed41('0xc'));}else{var agents=require(_0xed41('0xd'));var calls=require(_0xed41('0xe'));var queues=require(_0xed41('0xf'));var recordings=require(_0xed41('0x10'));var members=require(_0xed41('0x11'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0xed41('0x12'));ami['on'](_0xed41('0x13'),core[_0xed41('0x13')]);ami['on'](_0xed41('0x14'),core['shutdown']);ami['on'](_0xed41('0x15'),core[_0xed41('0x15')]);ami['on'](_0xed41('0x16'),core[_0xed41('0x16')]);ami['on'](_0xed41('0x17'),core['close']);ami['on'](_0xed41('0x18'),core[_0xed41('0x18')]);ami['on'](_0xed41('0x19'),function(_0x265fb2){try{utils['debug'](util['format'](_0xed41('0x1a'),_0x265fb2[_0xed41('0x1b')]),_0x265fb2);members[_0xed41('0x19')](_0x265fb2);}catch(_0x572e06){utils['error'](util[_0xed41('0x1c')](_0xed41('0x1a'),_0x265fb2[_0xed41('0x1b')]),_0x572e06);}});ami['on'](_0xed41('0x1d'),function(_0xc2fdd8){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x1f'),_0xc2fdd8[_0xed41('0x20')]),_0xc2fdd8);agents[_0xed41('0x1d')](_0xc2fdd8);}catch(_0x1de5e8){utils[_0xed41('0x16')](util['format']('[%s][index][agentcalled]',_0xc2fdd8[_0xed41('0x20')]),_0x1de5e8);}});ami['on']('agentringnoanswer',function(_0x188795){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')]('[%s][index][agentringnoanswer]',_0x188795['uniqueid']),_0x188795);agents[_0xed41('0x21')](_0x188795);}catch(_0x369e53){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x22'),_0x188795['uniqueid']),_0x369e53);}});ami['on']('agentconnect',function(_0x16f404){try{utils[_0xed41('0x1e')](util['format'](_0xed41('0x23'),_0x16f404[_0xed41('0x20')]),_0x16f404);agents[_0xed41('0x24')](_0x16f404);queues[_0xed41('0x24')](_0x16f404);}catch(_0x519fa3){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x23'),_0x16f404[_0xed41('0x20')]),_0x519fa3);}});ami['on'](_0xed41('0x25'),function(_0x40d202){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x26'),_0x40d202[_0xed41('0x20')]),_0x40d202);agents[_0xed41('0x25')](_0x40d202);queues[_0xed41('0x25')](_0x40d202);members[_0xed41('0x25')](_0x40d202);}catch(_0x3402f8){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x26'),_0x40d202['uniqueid']),_0x3402f8);}});ami['on'](_0xed41('0x27'),function(_0x51005b){try{utils[_0xed41('0x1e')](util['format'](_0xed41('0x28'),_0x51005b[_0xed41('0x20')]),_0x51005b);agents[_0xed41('0x27')](_0x51005b);queues[_0xed41('0x27')](_0x51005b);}catch(_0x245f65){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x28'),_0x51005b[_0xed41('0x20')]),_0x245f65);}});ami['on'](_0xed41('0x29'),function(_0x2f0211){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x2a'),_0x2f0211[_0xed41('0x20')]),_0x2f0211);queues[_0xed41('0x29')](_0x2f0211);recordings['queuecallerjoin'](_0x2f0211);}catch(_0xfd4958){utils[_0xed41('0x16')](util[_0xed41('0x1c')]('[%s][index][queuecallerjoin]',_0x2f0211[_0xed41('0x20')]),_0xfd4958);}});ami['on'](_0xed41('0x2b'),function(_0x926be6){try{utils[_0xed41('0x1e')](util['format']('[%s][index][queuecallerleave]',_0x926be6['uniqueid']),_0x926be6);queues[_0xed41('0x2b')](_0x926be6);}catch(_0x39d42e){utils[_0xed41('0x16')](util[_0xed41('0x1c')]('[%s][index][queuecallerleave]',_0x926be6[_0xed41('0x20')]),_0x39d42e);}});ami['on'](_0xed41('0x2c'),function(_0x37694c){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x2d'),_0x37694c[_0xed41('0x20')]),_0x37694c);queues[_0xed41('0x2c')](_0x37694c);calls[_0xed41('0x2c')](_0x37694c);}catch(_0x55f93a){utils[_0xed41('0x16')](util[_0xed41('0x1c')]('[%s][index][musiconholdstart]',_0x37694c['uniqueid']),_0x55f93a);}});ami['on'](_0xed41('0x2e'),function(_0x29a9b6){try{utils['debug'](util[_0xed41('0x1c')]('[%s][index][musiconholdstop]',_0x29a9b6[_0xed41('0x20')]),_0x29a9b6);queues[_0xed41('0x2e')](_0x29a9b6);calls[_0xed41('0x2e')](_0x29a9b6);}catch(_0x383e27){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x2f'),_0x29a9b6[_0xed41('0x20')]),_0x383e27);}});ami['on']('newstate',function(_0x194ac2){try{utils[_0xed41('0x1e')](util['format']('[%s][index][newstate]',_0x194ac2[_0xed41('0x20')]),_0x194ac2);calls['newstate'](_0x194ac2);recordings[_0xed41('0x30')](_0x194ac2);}catch(_0x3a03cf){utils[_0xed41('0x16')](util[_0xed41('0x1c')]('[%s][index][newstate]',_0x194ac2[_0xed41('0x20')]),_0x3a03cf);}});ami['on']('hangup',function(_0x4826b2){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x31'),_0x4826b2['uniqueid']),_0x4826b2);calls[_0xed41('0x32')](_0x4826b2);recordings[_0xed41('0x32')](_0x4826b2);dials[_0xed41('0x32')](_0x4826b2);agents['hangup'](_0x4826b2);queues['hangup'](_0x4826b2);}catch(_0x2f8a6e){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x31'),_0x4826b2[_0xed41('0x20')]),_0x2f8a6e);}});ami['on'](_0xed41('0x33'),function(_0x6e5d6c){try{utils['debug'](util[_0xed41('0x1c')]('[%s][index][cdr]',_0x6e5d6c[_0xed41('0x20')]),_0x6e5d6c);members[_0xed41('0x33')](_0x6e5d6c);}catch(_0x18dc89){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x34'),_0x6e5d6c[_0xed41('0x20')]),_0x18dc89);}});ami['on'](_0xed41('0x35'),function(_0x2a7c43){try{utils[_0xed41('0x1e')](util['format'](_0xed41('0x36'),_0x2a7c43[_0xed41('0x20')]),_0x2a7c43);queues['blindtransfer'](_0x2a7c43);agents[_0xed41('0x35')](_0x2a7c43);transfers[_0xed41('0x35')](_0x2a7c43);recordings[_0xed41('0x35')](_0x2a7c43);}catch(_0x352f39){utils[_0xed41('0x16')](util['format'](_0xed41('0x36'),_0x2a7c43[_0xed41('0x20')]),_0x352f39);}});ami['on'](_0xed41('0x37'),function(_0x4ce58e){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x38'),_0x4ce58e[_0xed41('0x39')]),_0x4ce58e);queues[_0xed41('0x37')](_0x4ce58e);transfers[_0xed41('0x37')](_0x4ce58e);agents[_0xed41('0x37')](_0x4ce58e);calls['attendedtransfer'](_0x4ce58e);}catch(_0x444dbc){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x38'),_0x4ce58e[_0xed41('0x39')]),_0x444dbc);}});ami['on'](_0xed41('0x3a'),function(_0x1eb0d6){try{utils[_0xed41('0x1e')](util['format'](_0xed41('0x3b'),_0x1eb0d6[_0xed41('0x20')]),_0x1eb0d6);queues[_0xed41('0x3a')](_0x1eb0d6);recordings[_0xed41('0x3a')](_0x1eb0d6);calls[_0xed41('0x3a')](_0x1eb0d6);dials[_0xed41('0x3a')](_0x1eb0d6);}catch(_0x282225){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x3b'),_0x1eb0d6[_0xed41('0x20')]),_0x282225);}});ami['on'](_0xed41('0x3c'),function(_0x9aae0c){try{utils['debug'](util[_0xed41('0x1c')]('[%s][index][newexten]',_0x9aae0c[_0xed41('0x20')]),_0x9aae0c);calls[_0xed41('0x3c')](_0x9aae0c);recordings[_0xed41('0x3c')](_0x9aae0c);dials['newexten'](_0x9aae0c);}catch(_0x542def){utils['error'](util['format'](_0xed41('0x3d'),_0x9aae0c['uniqueid']),_0x542def);}});ami['on']('newchannel',function(_0x238e07){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x3e'),_0x238e07[_0xed41('0x20')]),_0x238e07);calls[_0xed41('0x3f')](_0x238e07);recordings[_0xed41('0x3f')](_0x238e07);}catch(_0x5c6625){utils['error'](util['format'](_0xed41('0x3e'),_0x238e07[_0xed41('0x20')]),_0x5c6625);}});ami['on'](_0xed41('0x40'),function(_0x4bc866){try{utils[_0xed41('0x1e')](util[_0xed41('0x1c')](_0xed41('0x41'),_0x4bc866[_0xed41('0x20')]),_0x4bc866);dials['dialbegin'](_0x4bc866);}catch(_0x142db3){utils['error'](util[_0xed41('0x1c')]('[%s]dialbegin',_0x4bc866[_0xed41('0x20')]),_0x142db3);}});ami['on'](_0xed41('0x42'),function(_0x5d6f2c){try{utils['debug'](util['format'](_0xed41('0x43'),_0x5d6f2c['uniqueid']),_0x5d6f2c);dials['dialend'](_0x5d6f2c);}catch(_0x45c70b){utils[_0xed41('0x16')](util[_0xed41('0x1c')](_0xed41('0x43'),_0x5d6f2c['uniqueid']),_0x45c70b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 5d3d26c..881e878 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 _0x4c91=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','destination','[%s][members][cdr]','lodash','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','[%s][members][writeDB]','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','voice','TALKING','now','agent','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]'];(function(_0x2c8e51,_0x158fd9){var _0x57e3fd=function(_0x18e05c){while(--_0x18e05c){_0x2c8e51['push'](_0x2c8e51['shift']());}};_0x57e3fd(++_0x158fd9);}(_0x4c91,0x161));var _0x14c9=function(_0x26621f,_0x2c1ef8){_0x26621f=_0x26621f-0x0;var _0x1d7ad7=_0x4c91[_0x26621f];return _0x1d7ad7;};'use strict';var _=require(_0x14c9('0x0'));var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x14c9('0x1'),_0x14c9('0x2')];function writeDB(_0x192b1c){utils[_0x14c9('0x3')](util[_0x14c9('0x4')](_0x14c9('0x5'),_0x192b1c['uniqueid'],_0x192b1c[_0x14c9('0x6')],_0x192b1c[_0x14c9('0x7')],_0x192b1c[_0x14c9('0x8')],_0x192b1c[_0x14c9('0x9')],_0x192b1c[_0x14c9('0xa')]));if(_0x192b1c['interface']){utils[_0x14c9('0xb')](_0x192b1c[_0x14c9('0x6')])[_0x14c9('0xc')](function(_0x3054ad){if(_0x3054ad){_0x192b1c['membername']=_0x3054ad[_0x14c9('0xd')];_0x192b1c[_0x14c9('0xe')]=_0x3054ad[_0x14c9('0xe')];utils[_0x14c9('0xf')](_0x14c9('0x10'),_0x192b1c);}else{utils[_0x14c9('0x11')](_0x192b1c[_0x14c9('0x6')][_0x14c9('0x12')]('/')[0x1])['then'](function(_0x5819ed){if(_0x5819ed){_0x192b1c[_0x14c9('0x9')]=_0x5819ed[_0x14c9('0xd')];_0x192b1c[_0x14c9('0xe')]=_0x5819ed[_0x14c9('0xe')];utils[_0x14c9('0xf')]('CreateMemberReport',_0x192b1c);}});}})['catch'](function(_0x1f06d2){utils[_0x14c9('0x13')](util[_0x14c9('0x4')](_0x14c9('0x14'),_0x192b1c['uniqueid']),_0x1f06d2);});}delete members[_0x192b1c[_0x14c9('0x6')]];}function startsWith(_0x46a16b,_0x45825a){return _['some'](_0x46a16b,function(_0x450264){return _[_0x14c9('0x15')](_0x45825a,_0x450264);});}exports[_0x14c9('0x16')]=function(_0x526b10){try{utils[_0x14c9('0x17')](util[_0x14c9('0x4')](_0x14c9('0x18'),members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10[_0x14c9('0x19')]),_0x526b10);utils['info'](util[_0x14c9('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10[_0x14c9('0x19')],_0x526b10[_0x14c9('0x1b')],_0x526b10[_0x14c9('0x19')]));switch(_0x526b10[_0x14c9('0x1b')]){case _0x14c9('0x1c'):case'BUSY':if(!startsWith(exclude,_0x526b10['device'])){members[_0x526b10[_0x14c9('0x19')]]={'channel':_0x14c9('0x1d'),'interface':_0x526b10[_0x14c9('0x19')],'type':_0x14c9('0x1e'),'enterAt':utils[_0x14c9('0x1f')](),'role':_0x14c9('0x20')};}break;case'NOT_INUSE':if(!_[_0x14c9('0x21')](members[_0x526b10[_0x14c9('0x19')]])){members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x22')]=utils['now']();members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x23')]=utils[_0x14c9('0x24')](members[_0x526b10['device']][_0x14c9('0x22')],members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x25')]);if(members[_0x526b10[_0x14c9('0x19')]]['uniqueid']){writeDB(members[_0x526b10[_0x14c9('0x19')]]);}}break;default:break;}}catch(_0x17dae3){utils[_0x14c9('0x13')](util[_0x14c9('0x4')]('[%s][members][devicestatechange]',members[_0x526b10[_0x14c9('0x19')]]?members[_0x526b10[_0x14c9('0x19')]][_0x14c9('0x1a')]:_0x526b10['device']),_0x17dae3);}};exports['agentcomplete']=function(_0x7f394e){try{if(!_[_0x14c9('0x21')](members[_0x7f394e['interface']])){utils['debug'](util[_0x14c9('0x4')](_0x14c9('0x26'),_0x7f394e[_0x14c9('0x1a')]),_0x7f394e);utils[_0x14c9('0x3')](util['format'](_0x14c9('0x27'),_0x7f394e['uniqueid'],_0x7f394e[_0x14c9('0x6')],_0x7f394e['queue']));members[_0x7f394e[_0x14c9('0x6')]]=_[_0x14c9('0x28')](members[_0x7f394e[_0x14c9('0x6')]],{'data4':_0x7f394e[_0x14c9('0x29')],'uniqueid':_0x7f394e[_0x14c9('0x1a')]});}}catch(_0x5533a6){utils['error'](util[_0x14c9('0x4')](_0x14c9('0x26'),_0x7f394e['uniqueid']),_0x5533a6);}};exports['cdr']=function(_0xaba681){try{utils[_0x14c9('0x17')](util['format']('[%s][members][cdr]',_0xaba681[_0x14c9('0x1a')]),_0xaba681);if(_0xaba681[_0x14c9('0x7')]){var _0x32f8d2=_0xaba681[_0x14c9('0x7')]['split']('-')[0x0];if(!_[_0x14c9('0x21')](members[_0x32f8d2])){members[_0x32f8d2]=_[_0x14c9('0x28')](members[_0x32f8d2],{'data1':members[_0x32f8d2]['data1']||_0xaba681[_0x14c9('0xa')],'data2':members[_0x32f8d2][_0x14c9('0x8')]||_0xaba681[_0x14c9('0x2a')],'data3':members[_0x32f8d2][_0x14c9('0x2b')]||_0xaba681['destination'],'uniqueid':members[_0x32f8d2][_0x14c9('0x1a')]||_0xaba681['uniqueid']});utils[_0x14c9('0x3')](util['format'](_0x14c9('0x2c'),_0xaba681[_0x14c9('0x1a')],members[_0x32f8d2][_0x14c9('0x2d')],members[_0x32f8d2][_0x14c9('0x8')],members[_0x32f8d2][_0x14c9('0x2b')]));if(members[_0x32f8d2]['exitAt']){writeDB(members[_0x32f8d2]);}}}if(_0xaba681['destinationchannel']){var _0x3d761d=_0xaba681[_0x14c9('0x2e')][_0x14c9('0x12')]('-')[0x0];if(!_[_0x14c9('0x21')](members[_0x3d761d])){members[_0x3d761d]=_['assign'](members[_0x3d761d],{'data1':members[_0x3d761d][_0x14c9('0x2d')]||_0xaba681[_0x14c9('0xa')],'data2':members[_0x3d761d][_0x14c9('0x8')]||_0xaba681['source'],'data3':members[_0x3d761d][_0x14c9('0x2b')]||_0xaba681[_0x14c9('0x2f')],'uniqueid':members[_0x3d761d][_0x14c9('0x1a')]||_0xaba681[_0x14c9('0x1a')]});utils[_0x14c9('0x3')](util[_0x14c9('0x4')](_0x14c9('0x2c'),_0xaba681['uniqueid'],members[_0x3d761d][_0x14c9('0x2d')],members[_0x3d761d][_0x14c9('0x8')],members[_0x3d761d][_0x14c9('0x2b')]));if(members[_0x3d761d]['exitAt']){writeDB(members[_0x3d761d]);}}}}catch(_0x11fe14){utils[_0x14c9('0x13')](util[_0x14c9('0x4')](_0x14c9('0x30'),_0xaba681[_0x14c9('0x1a')]),_0x11fe14);}}; \ No newline at end of file +var _0xff4f=['[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','data3','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','split','name','catch','error','[%s][members][writeDB]','debug','[%s][members][devicestatechange]','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','device','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]'];(function(_0x2e5e85,_0x5201c5){var _0x46ce0d=function(_0x2d84b1){while(--_0x2d84b1){_0x2e5e85['push'](_0x2e5e85['shift']());}};_0x46ce0d(++_0x5201c5);}(_0xff4f,0x19a));var _0xfff4=function(_0x77d9fa,_0x60cc7e){_0x77d9fa=_0x77d9fa-0x0;var _0x379045=_0xff4f[_0x77d9fa];return _0x379045;};'use strict';var _=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var utils=require('./utils');var members={};var exclude=[_0xfff4('0x2'),_0xfff4('0x3')];function writeDB(_0xb9b14e){utils[_0xfff4('0x4')](util[_0xfff4('0x5')](_0xfff4('0x6'),_0xb9b14e[_0xfff4('0x7')],_0xb9b14e[_0xfff4('0x8')],_0xb9b14e[_0xfff4('0x9')],_0xb9b14e[_0xfff4('0xa')],_0xb9b14e[_0xfff4('0xb')],_0xb9b14e[_0xfff4('0xc')]));if(_0xb9b14e[_0xfff4('0x8')]){utils[_0xfff4('0xd')](_0xb9b14e['interface'])[_0xfff4('0xe')](function(_0xf13ece){if(_0xf13ece){_0xb9b14e[_0xfff4('0xb')]=_0xf13ece['name'];_0xb9b14e[_0xfff4('0xf')]=_0xf13ece[_0xfff4('0xf')];utils[_0xfff4('0x10')](_0xfff4('0x11'),_0xb9b14e);}else{utils['getUserByName'](_0xb9b14e[_0xfff4('0x8')][_0xfff4('0x12')]('/')[0x1])[_0xfff4('0xe')](function(_0x2f1f6a){if(_0x2f1f6a){_0xb9b14e[_0xfff4('0xb')]=_0x2f1f6a[_0xfff4('0x13')];_0xb9b14e['internal']=_0x2f1f6a[_0xfff4('0xf')];utils[_0xfff4('0x10')](_0xfff4('0x11'),_0xb9b14e);}});}})[_0xfff4('0x14')](function(_0x4b0a2a){utils[_0xfff4('0x15')](util['format'](_0xfff4('0x16'),_0xb9b14e['uniqueid']),_0x4b0a2a);});}delete members[_0xb9b14e[_0xfff4('0x8')]];}function startsWith(_0x2f37c1,_0x52e481){return _['some'](_0x2f37c1,function(_0x56bb0c){return _['startsWith'](_0x52e481,_0x56bb0c);});}exports['devicestatechange']=function(_0x4f1a3a){try{utils[_0xfff4('0x17')](util[_0xfff4('0x5')](_0xfff4('0x18'),members[_0x4f1a3a['device']]?members[_0x4f1a3a['device']][_0xfff4('0x7')]:_0x4f1a3a['device']),_0x4f1a3a);utils[_0xfff4('0x4')](util['format'](_0xfff4('0x19'),members[_0x4f1a3a[_0xfff4('0x1a')]]?members[_0x4f1a3a[_0xfff4('0x1a')]][_0xfff4('0x7')]:_0x4f1a3a['device'],_0x4f1a3a['state'],_0x4f1a3a[_0xfff4('0x1a')]));switch(_0x4f1a3a[_0xfff4('0x1b')]){case _0xfff4('0x1c'):case'BUSY':if(!startsWith(exclude,_0x4f1a3a[_0xfff4('0x1a')])){members[_0x4f1a3a['device']]={'channel':_0xfff4('0x1d'),'interface':_0x4f1a3a[_0xfff4('0x1a')],'type':_0xfff4('0x1e'),'enterAt':utils[_0xfff4('0x1f')](),'role':_0xfff4('0x20')};}break;case _0xfff4('0x21'):if(!_[_0xfff4('0x22')](members[_0x4f1a3a[_0xfff4('0x1a')]])){members[_0x4f1a3a[_0xfff4('0x1a')]][_0xfff4('0x23')]=utils['now']();members[_0x4f1a3a['device']][_0xfff4('0x24')]=utils[_0xfff4('0x25')](members[_0x4f1a3a[_0xfff4('0x1a')]][_0xfff4('0x23')],members[_0x4f1a3a[_0xfff4('0x1a')]]['enterAt']);if(members[_0x4f1a3a['device']]['uniqueid']){writeDB(members[_0x4f1a3a[_0xfff4('0x1a')]]);}}break;default:break;}}catch(_0x927a75){utils[_0xfff4('0x15')](util[_0xfff4('0x5')]('[%s][members][devicestatechange]',members[_0x4f1a3a[_0xfff4('0x1a')]]?members[_0x4f1a3a['device']][_0xfff4('0x7')]:_0x4f1a3a[_0xfff4('0x1a')]),_0x927a75);}};exports[_0xfff4('0x26')]=function(_0x5caff5){try{if(!_[_0xfff4('0x22')](members[_0x5caff5[_0xfff4('0x8')]])){utils[_0xfff4('0x17')](util[_0xfff4('0x5')](_0xfff4('0x27'),_0x5caff5['uniqueid']),_0x5caff5);utils[_0xfff4('0x4')](util[_0xfff4('0x5')](_0xfff4('0x28'),_0x5caff5[_0xfff4('0x7')],_0x5caff5[_0xfff4('0x8')],_0x5caff5[_0xfff4('0x29')]));members[_0x5caff5[_0xfff4('0x8')]]=_[_0xfff4('0x2a')](members[_0x5caff5[_0xfff4('0x8')]],{'data4':_0x5caff5[_0xfff4('0x29')],'uniqueid':_0x5caff5['uniqueid']});}}catch(_0x3e3f47){utils[_0xfff4('0x15')](util[_0xfff4('0x5')]('[%s][members][agentcomplete]',_0x5caff5[_0xfff4('0x7')]),_0x3e3f47);}};exports['cdr']=function(_0x53a9a9){try{utils['debug'](util['format'](_0xfff4('0x2b'),_0x53a9a9[_0xfff4('0x7')]),_0x53a9a9);if(_0x53a9a9[_0xfff4('0x9')]){var _0x4a0951=_0x53a9a9[_0xfff4('0x9')][_0xfff4('0x12')]('-')[0x0];if(!_['isNil'](members[_0x4a0951])){members[_0x4a0951]=_['assign'](members[_0x4a0951],{'data1':members[_0x4a0951][_0xfff4('0x2c')]||_0x53a9a9['type'],'data2':members[_0x4a0951][_0xfff4('0xa')]||_0x53a9a9['source'],'data3':members[_0x4a0951]['data3']||_0x53a9a9[_0xfff4('0x2d')],'uniqueid':members[_0x4a0951][_0xfff4('0x7')]||_0x53a9a9[_0xfff4('0x7')]});utils[_0xfff4('0x4')](util[_0xfff4('0x5')](_0xfff4('0x2e'),_0x53a9a9[_0xfff4('0x7')],members[_0x4a0951][_0xfff4('0x2c')],members[_0x4a0951][_0xfff4('0xa')],members[_0x4a0951]['data3']));if(members[_0x4a0951][_0xfff4('0x23')]){writeDB(members[_0x4a0951]);}}}if(_0x53a9a9[_0xfff4('0x2f')]){var _0x192e79=_0x53a9a9['destinationchannel'][_0xfff4('0x12')]('-')[0x0];if(!_[_0xfff4('0x22')](members[_0x192e79])){members[_0x192e79]=_['assign'](members[_0x192e79],{'data1':members[_0x192e79][_0xfff4('0x2c')]||_0x53a9a9[_0xfff4('0xc')],'data2':members[_0x192e79][_0xfff4('0xa')]||_0x53a9a9[_0xfff4('0x30')],'data3':members[_0x192e79]['data3']||_0x53a9a9[_0xfff4('0x2d')],'uniqueid':members[_0x192e79]['uniqueid']||_0x53a9a9[_0xfff4('0x7')]});utils['info'](util[_0xfff4('0x5')](_0xfff4('0x2e'),_0x53a9a9[_0xfff4('0x7')],members[_0x192e79][_0xfff4('0x2c')],members[_0x192e79][_0xfff4('0xa')],members[_0x192e79][_0xfff4('0x31')]));if(members[_0x192e79][_0xfff4('0x23')]){writeDB(members[_0x192e79]);}}}}catch(_0x4b7ec9){utils[_0xfff4('0x15')](util[_0xfff4('0x5')](_0xfff4('0x2b'),_0x53a9a9[_0xfff4('0x7')]),_0x4b7ec9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 347e63b..3865e5d 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 _0x0c97=['queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','queuecallerenterreason','calleridname','mohtime','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','calleridnum','accountcode','queue','then','CreateVoiceQueueReport','request','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','error','varset','queuestatus','value','toUpperCase','CONTINUE','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x40b09f,_0x161f4f){var _0x3dbee2=function(_0x135eb7){while(--_0x135eb7){_0x40b09f['push'](_0x40b09f['shift']());}};_0x3dbee2(++_0x161f4f);}(_0x0c97,0x104));var _0x70c9=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x0c97[_0xb0de07];return _0x4633d8;};'use strict';var _=require(_0x70c9('0x0'));var util=require(_0x70c9('0x1'));var utils=require(_0x70c9('0x2'));var queues={};function writeDB(_0x8f17d2){utils[_0x70c9('0x3')](util[_0x70c9('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x8f17d2[_0x70c9('0x5')],_0x8f17d2[_0x70c9('0x6')],_0x8f17d2['queue'],_0x8f17d2['lastAssignedTo'],_0x8f17d2[_0x70c9('0x7')],_0x8f17d2[_0x70c9('0x8')],_0x8f17d2['queuecallerexitreason']));if(_0x8f17d2[_0x70c9('0x9')]){utils['getVoiceQueueByName'](_0x8f17d2[_0x70c9('0x9')])[_0x70c9('0xa')](function(_0x185699){if(_0x185699){_0x8f17d2['type']=_0x185699['type'];}utils['request'](_0x70c9('0xb'),_0x8f17d2);});}else{utils[_0x70c9('0xc')](_0x70c9('0xb'),_0x8f17d2);}if(_0x8f17d2[_0x70c9('0xd')]){delete queues[_0x8f17d2['transfereduniqueid']];}else{delete queues[_0x8f17d2[_0x70c9('0x5')]];}}exports['queuecallerjoin']=function(_0x5ebb0d){try{utils[_0x70c9('0xe')](util[_0x70c9('0x4')](_0x70c9('0xf'),_0x5ebb0d[_0x70c9('0x5')]),_0x5ebb0d);utils[_0x70c9('0x3')](util[_0x70c9('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5ebb0d[_0x70c9('0x5')],_0x5ebb0d[_0x70c9('0x9')],_0x5ebb0d[_0x70c9('0x10')]));queues[_0x5ebb0d['uniqueid']]=_[_0x70c9('0x11')](_0x5ebb0d,{'originalposition':_0x5ebb0d['position'],'queuecallerjoinAt':utils[_0x70c9('0x12')](),'mohtime':0x0});}catch(_0x44856b){utils['error'](util[_0x70c9('0x4')](_0x70c9('0xf'),_0x5ebb0d['uniqueid']),_0x44856b);}};exports[_0x70c9('0x13')]=function(_0x73ff3d){try{if(!_[_0x70c9('0x14')](queues[_0x73ff3d['uniqueid']])){utils[_0x70c9('0xe')](util['format'](_0x70c9('0x15'),_0x73ff3d[_0x70c9('0x5')]),_0x73ff3d);if(queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x16')]){if(!queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x17')]&&!queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x18')]){queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x19')]=!![];queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x1a')]=utils[_0x70c9('0x12')]();queues[_0x73ff3d['uniqueid']][_0x70c9('0x1b')]='COMPLETEDBYAGENT';}utils['info'](util[_0x70c9('0x4')](_0x70c9('0x1c'),_0x73ff3d[_0x70c9('0x5')],queues[_0x73ff3d['uniqueid']]['name'],queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0x1b')]));writeDB(queues[_0x73ff3d[_0x70c9('0x5')]]);}else if(queues[_0x73ff3d[_0x70c9('0x5')]]['transfereduniqueid']){utils[_0x70c9('0x3')](util['format'](_0x70c9('0x1d'),_0x73ff3d['uniqueid'],queues[_0x73ff3d['uniqueid']][_0x70c9('0x1e')],queues[_0x73ff3d[_0x70c9('0x5')]]['transfereduniqueid']));queues[queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0xd')]]=queues[_0x73ff3d[_0x70c9('0x5')]];queues[queues[_0x73ff3d[_0x70c9('0x5')]][_0x70c9('0xd')]]['queuecallerenterreason']=0x2;delete queues[_0x73ff3d[_0x70c9('0x5')]];}}}catch(_0x2a50cc){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')]('[%s][queues][hangup]',_0x73ff3d[_0x70c9('0x5')]),_0x2a50cc);}};exports[_0x70c9('0x20')]=function(_0x4ea007){try{utils[_0x70c9('0xe')](util[_0x70c9('0x4')]('[%s][queues][varset]',_0x4ea007[_0x70c9('0x5')]),_0x4ea007);if(!_[_0x70c9('0x14')](_0x4ea007['variable'][_0x70c9('0x21')])&&_0x4ea007[_0x70c9('0x22')][_0x70c9('0x23')]()!==_0x70c9('0x24')){if(!_[_0x70c9('0x14')](queues[_0x4ea007['uniqueid']])){queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x17')]=![];queues[_0x4ea007[_0x70c9('0x5')]]['queuecallerabandonAt']=null;queues[_0x4ea007['uniqueid']][_0x70c9('0x18')]=!![];queues[_0x4ea007[_0x70c9('0x5')]]['queuecallerexitAt']=utils[_0x70c9('0x12')]();queues[_0x4ea007['uniqueid']][_0x70c9('0x1b')]=_0x4ea007[_0x70c9('0x22')][_0x70c9('0x23')]();utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x25'),_0x4ea007[_0x70c9('0x5')],queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x1e')],_0x4ea007['value'],queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x1b')]));writeDB(queues[_0x4ea007[_0x70c9('0x5')]]);}}else if(!_[_0x70c9('0x14')](_0x4ea007[_0x70c9('0x26')][_0x70c9('0x27')])){if(!_[_0x70c9('0x14')](queues[_0x4ea007['uniqueid']])&&!queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x17')]){queues[_0x4ea007[_0x70c9('0x5')]]['queuecallerabandon']=![];queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x28')]=null;queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x18')]=!![];queues[_0x4ea007[_0x70c9('0x5')]][_0x70c9('0x29')]=utils['now']();queues[_0x4ea007['uniqueid']][_0x70c9('0x1b')]='EXITWITHKEY';utils[_0x70c9('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4ea007[_0x70c9('0x5')],queues[_0x4ea007['uniqueid']][_0x70c9('0x1e')],_0x4ea007['value'],queues[_0x4ea007[_0x70c9('0x5')]]['queuecallerexitreason']));}}}catch(_0x50f813){utils['error'](util['format'](_0x70c9('0x2a'),_0x4ea007[_0x70c9('0x5')]),_0x50f813);}};exports[_0x70c9('0x17')]=function(_0x5c9313){try{if(!_['isNil'](queues[_0x5c9313[_0x70c9('0x5')]])){utils['debug'](util[_0x70c9('0x4')](_0x70c9('0x2b'),_0x5c9313['uniqueid']),_0x5c9313);queues[_0x5c9313['uniqueid']][_0x70c9('0x18')]=![];queues[_0x5c9313['uniqueid']][_0x70c9('0x29')]=null;queues[_0x5c9313['uniqueid']][_0x70c9('0x17')]=!![];queues[_0x5c9313['uniqueid']][_0x70c9('0x28')]=utils[_0x70c9('0x12')]();queues[_0x5c9313[_0x70c9('0x5')]][_0x70c9('0x1b')]=_0x70c9('0x2c');utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x2d'),_0x5c9313[_0x70c9('0x5')],queues[_0x5c9313[_0x70c9('0x5')]][_0x70c9('0x1e')],queues[_0x5c9313[_0x70c9('0x5')]][_0x70c9('0x1b')]));}}catch(_0x5ac81d){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')](_0x70c9('0x2b'),_0x5c9313[_0x70c9('0x5')]),_0x5ac81d);}};exports[_0x70c9('0x2e')]=function(_0x218b31){try{if(!_[_0x70c9('0x14')](queues[_0x218b31[_0x70c9('0x5')]])){utils[_0x70c9('0xe')](util[_0x70c9('0x4')]('[%s][queues][queuecallerleave]',_0x218b31[_0x70c9('0x5')]),_0x218b31);utils['info'](util[_0x70c9('0x4')](_0x70c9('0x2f'),_0x218b31[_0x70c9('0x5')],queues[_0x218b31['uniqueid']]['name'],_0x218b31[_0x70c9('0x30')],_0x218b31[_0x70c9('0x31')]));queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x2e')]=!![];queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x16')]=utils[_0x70c9('0x12')]();queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x32')]=utils[_0x70c9('0x33')](queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x16')],queues[_0x218b31['uniqueid']][_0x70c9('0x34')]);queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x10')]=_0x218b31[_0x70c9('0x10')];queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x35')]=_0x218b31[_0x70c9('0x35')];queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x30')]=_0x218b31[_0x70c9('0x30')];queues[_0x218b31[_0x70c9('0x5')]][_0x70c9('0x31')]=_0x218b31[_0x70c9('0x31')];}}catch(_0x4af478){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')](_0x70c9('0x36'),_0x218b31[_0x70c9('0x5')]),_0x4af478);}};exports[_0x70c9('0x37')]=function(_0x21494c){try{if(!_[_0x70c9('0x14')](queues[_0x21494c['uniqueid']])){utils['debug'](util[_0x70c9('0x4')](_0x70c9('0x38'),_0x21494c[_0x70c9('0x5')]),_0x21494c);utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x39'),_0x21494c['uniqueid'],queues[_0x21494c['uniqueid']][_0x70c9('0x1e')],_0x21494c[_0x70c9('0x3a')],_0x21494c['destaccountcode']));queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x17')]=![];queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x17')]=![];queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x28')]=null;queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x18')]=![];queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x1b')]=null;queues[_0x21494c['uniqueid']][_0x70c9('0x29')]=null;queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x3b')]=!![];queues[_0x21494c[_0x70c9('0x5')]][_0x70c9('0x8')]=_0x21494c['destaccountcode'];queues[_0x21494c['uniqueid']][_0x70c9('0x3c')]=_0x21494c[_0x70c9('0x3a')];}}catch(_0x1e2ea9){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')](_0x70c9('0x38'),_0x21494c['uniqueid']),_0x1e2ea9);}};exports[_0x70c9('0x3d')]=function(_0xc2c542){try{if(!_[_0x70c9('0x14')](queues[_0xc2c542[_0x70c9('0x5')]])){if(queues[_0xc2c542[_0x70c9('0x5')]]['queuecallerleaveAt']){utils['debug'](util[_0x70c9('0x4')](_0x70c9('0x3e'),_0xc2c542[_0x70c9('0x5')]),_0xc2c542);queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x17')]=![];queues[_0xc2c542[_0x70c9('0x5')]]['queuecallerabandon']=![];queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x28')]=null;queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x18')]=![];queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x29')]=null;queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x3b')]=!![];queues[_0xc2c542[_0x70c9('0x5')]]['lastAssignedTo']=_0xc2c542[_0x70c9('0x3a')];queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x19')]=!![];queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x1a')]=utils[_0x70c9('0x12')]();if(_0xc2c542[_0x70c9('0x3f')]==_0x70c9('0x40')){if(!queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x40')]){queues[_0xc2c542[_0x70c9('0x5')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0xc2c542['uniqueid']]['queuecallerexitreason']=_0x70c9('0x41')+_0xc2c542[_0x70c9('0x3f')][_0x70c9('0x23')]();}utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x42'),_0xc2c542[_0x70c9('0x5')],queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x1e')],_0xc2c542[_0x70c9('0x3a')],queues[_0xc2c542[_0x70c9('0x5')]][_0x70c9('0x1b')]));writeDB(queues[_0xc2c542['uniqueid']]);}}}catch(_0x10c1f5){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')](_0x70c9('0x3e'),_0xc2c542[_0x70c9('0x5')]),_0x10c1f5);}};exports[_0x70c9('0x43')]=function(_0x391029){try{if(!_['isNil'](queues[_0x391029['transfereeuniqueid']])){utils[_0x70c9('0xe')](util[_0x70c9('0x4')](_0x70c9('0x44'),_0x391029[_0x70c9('0x5')]),_0x391029);queues[_0x391029[_0x70c9('0x45')]][_0x70c9('0x40')]=!![];queues[_0x391029[_0x70c9('0x45')]][_0x70c9('0x46')]=_0x70c9('0x47');queues[_0x391029[_0x70c9('0x45')]][_0x70c9('0x48')]=_0x391029[_0x70c9('0x49')];queues[_0x391029['transfereeuniqueid']][_0x70c9('0x4a')]=_0x391029[_0x70c9('0x45')];queues[_0x391029['transfereeuniqueid']][_0x70c9('0x1b')]=_0x70c9('0x4b');utils[_0x70c9('0x3')](util[_0x70c9('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x391029[_0x70c9('0x5')],queues[_0x391029['transfereeuniqueid']]['name'],_0x391029[_0x70c9('0x45')],_0x391029[_0x70c9('0x49')]));}}catch(_0xda3836){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')](_0x70c9('0x44'),_0x391029[_0x70c9('0x5')]),_0xda3836);}};exports[_0x70c9('0x4c')]=function(_0x1fe6dc){try{utils[_0x70c9('0xe')](util['format']('[%s][queues][attendedtransfer]',_0x1fe6dc[_0x70c9('0x4d')]),_0x1fe6dc);if(_0x1fe6dc[_0x70c9('0x4d')]==_0x1fe6dc[_0x70c9('0x4e')]){if(!_[_0x70c9('0x14')](queues[_0x1fe6dc[_0x70c9('0x4f')]])){utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x50'),_0x1fe6dc['origtransfereruniqueid'],queues[_0x1fe6dc[_0x70c9('0x4f')]][_0x70c9('0x1e')],_0x1fe6dc[_0x70c9('0x51')]));queues[_0x1fe6dc['secondtransfererlinkedid']]['transfer']=!![];queues[_0x1fe6dc['secondtransfererlinkedid']][_0x70c9('0x46')]=_0x70c9('0x52');queues[_0x1fe6dc['secondtransfererlinkedid']][_0x70c9('0x48')]=_0x1fe6dc[_0x70c9('0x51')];queues[_0x1fe6dc['secondtransfererlinkedid']][_0x70c9('0x4a')]=_0x1fe6dc[_0x70c9('0x4d')];queues[_0x1fe6dc[_0x70c9('0x4f')]][_0x70c9('0x1b')]=_0x70c9('0x53');}if(!_[_0x70c9('0x14')](queues[_0x1fe6dc[_0x70c9('0x4e')]])){if(_0x1fe6dc[_0x70c9('0x54')]&&queues[_0x1fe6dc[_0x70c9('0x54')]]){queues[_0x1fe6dc['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x1fe6dc[_0x70c9('0x45')]]=_[_0x70c9('0x55')](queues[_0x1fe6dc[_0x70c9('0x54')]]);queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0xd')]=_0x1fe6dc[_0x70c9('0x56')];queues[_0x1fe6dc['transfereeuniqueid']][_0x70c9('0x57')]=0x2;queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x7')]=queues[_0x1fe6dc[_0x70c9('0x4f')]]['calleridnum'];queues[_0x1fe6dc['transfereeuniqueid']][_0x70c9('0x58')]=queues[_0x1fe6dc[_0x70c9('0x4f')]][_0x70c9('0x58')];queues[_0x1fe6dc['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0x70c9('0x12')]();queues[_0x1fe6dc['transfereeuniqueid']][_0x70c9('0x16')]=utils[_0x70c9('0x12')]();queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x32')]=0x0;queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x59')]=0x0;utils[_0x70c9('0x3')](util[_0x70c9('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x1fe6dc[_0x70c9('0x4d')],queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x1e')],queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x7')],queues[_0x1fe6dc[_0x70c9('0x45')]][_0x70c9('0x58')]));}else{utils['info'](util[_0x70c9('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1fe6dc[_0x70c9('0x4d')],queues[_0x1fe6dc[_0x70c9('0x4e')]][_0x70c9('0x1e')],_0x1fe6dc[_0x70c9('0x4f')]));queues[_0x1fe6dc[_0x70c9('0x4e')]]['transfereduniqueid']=_0x1fe6dc['secondtransfererlinkedid'];}}}else if(_0x1fe6dc[_0x70c9('0x5a')]==_0x1fe6dc[_0x70c9('0x4f')]){if(!_['isNil'](queues[_0x1fe6dc[_0x70c9('0x4e')]])){utils[_0x70c9('0x3')](util['format'](_0x70c9('0x5b'),_0x1fe6dc[_0x70c9('0x4d')],queues[_0x1fe6dc[_0x70c9('0x4e')]][_0x70c9('0x1e')],_0x1fe6dc[_0x70c9('0x5a')],_0x1fe6dc[_0x70c9('0x5c')]));queues[_0x1fe6dc[_0x70c9('0x4e')]][_0x70c9('0x40')]=!![];queues[_0x1fe6dc['origtransfererlinkedid']][_0x70c9('0x46')]='ATTENDED';queues[_0x1fe6dc['origtransfererlinkedid']][_0x70c9('0x48')]=_0x1fe6dc[_0x70c9('0x5c')];queues[_0x1fe6dc['origtransfererlinkedid']]['transferuniqueid']=_0x1fe6dc[_0x70c9('0x5a')];queues[_0x1fe6dc[_0x70c9('0x4e')]][_0x70c9('0x1b')]=_0x70c9('0x53');}if(!_['isNil'](queues[_0x1fe6dc['secondtransfererlinkedid']])){if(_0x1fe6dc[_0x70c9('0x5d')]&&queues[_0x1fe6dc[_0x70c9('0x5d')]]){queues[_0x1fe6dc[_0x70c9('0x5d')]][_0x70c9('0x57')]=0x1;queues[_0x1fe6dc['transfertargetuniqueid']]=_['clone'](queues[_0x1fe6dc[_0x70c9('0x5d')]]);queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0xd')]=_0x1fe6dc[_0x70c9('0x56')];queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x57')]=0x2;queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x7')]=queues[_0x1fe6dc['origtransfererlinkedid']][_0x70c9('0x7')];queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x58')]=queues[_0x1fe6dc[_0x70c9('0x4e')]][_0x70c9('0x58')];queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x34')]=utils[_0x70c9('0x12')]();queues[_0x1fe6dc[_0x70c9('0x56')]]['queuecallerleaveAt']=utils[_0x70c9('0x12')]();queues[_0x1fe6dc[_0x70c9('0x56')]]['holdtime']=0x0;queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x59')]=0x0;utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x5e'),_0x1fe6dc[_0x70c9('0x4d')],queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x1e')],queues[_0x1fe6dc['transfertargetuniqueid']][_0x70c9('0xd')],queues[_0x1fe6dc[_0x70c9('0x56')]]['calleridnum'],queues[_0x1fe6dc[_0x70c9('0x56')]][_0x70c9('0x58')]));}else{utils[_0x70c9('0x3')](util[_0x70c9('0x4')](_0x70c9('0x5f'),_0x1fe6dc[_0x70c9('0x4d')],queues[_0x1fe6dc['secondtransfererlinkedid']][_0x70c9('0x1e')],_0x1fe6dc['origtransfererlinkedid']));queues[_0x1fe6dc[_0x70c9('0x4f')]]['transfereduniqueid']=_0x1fe6dc[_0x70c9('0x4e')];}}}}catch(_0x560b99){utils['error'](util[_0x70c9('0x4')](_0x70c9('0x60'),_0x1fe6dc['origtransfereruniqueid']),_0x560b99);}};exports[_0x70c9('0x61')]=function(_0xd44664){try{if(!_[_0x70c9('0x14')](queues[_0xd44664[_0x70c9('0x5')]])){utils['debug'](util[_0x70c9('0x4')]('[%s][queues][musiconholdstart]',_0xd44664[_0x70c9('0x5')]),_0xd44664);queues[_0xd44664[_0x70c9('0x5')]][_0x70c9('0x62')]=utils[_0x70c9('0x12')]();utils[_0x70c9('0x3')](util['format'](_0x70c9('0x63'),_0xd44664[_0x70c9('0x5')],queues[_0xd44664[_0x70c9('0x5')]][_0x70c9('0x1e')],queues[_0xd44664['uniqueid']][_0x70c9('0x62')]));}}catch(_0x149f1d){utils['error'](util[_0x70c9('0x4')]('[%s][queues][musiconholdstart]',_0xd44664['uniqueid']),_0x149f1d);}};exports[_0x70c9('0x64')]=function(_0x19cd22){try{if(!_[_0x70c9('0x14')](queues[_0x19cd22['uniqueid']])){if(!_[_0x70c9('0x14')](queues[_0x19cd22[_0x70c9('0x5')]][_0x70c9('0x62')])){utils[_0x70c9('0xe')](util[_0x70c9('0x4')](_0x70c9('0x65'),_0x19cd22[_0x70c9('0x5')]),_0x19cd22);queues[_0x19cd22[_0x70c9('0x5')]][_0x70c9('0x59')]+=utils[_0x70c9('0x33')](utils['now'](),queues[_0x19cd22[_0x70c9('0x5')]][_0x70c9('0x62')]);utils['info'](util[_0x70c9('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x19cd22['uniqueid'],queues[_0x19cd22['uniqueid']][_0x70c9('0x1e')],queues[_0x19cd22[_0x70c9('0x5')]][_0x70c9('0x59')]));delete queues[_0x19cd22[_0x70c9('0x5')]]['musiconholdstartAt'];}}}catch(_0x2b5933){utils[_0x70c9('0x1f')](util[_0x70c9('0x4')]('[%s][queues][musiconholdstop]',_0x19cd22[_0x70c9('0x5')]),_0x2b5933);}}; \ No newline at end of file +var _0xa0c0=['holdtime','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','lastAssignedTo','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','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','ATTENDEDTRANSFER','transfertargetlinkedid','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt'];(function(_0x279f52,_0x2634f2){var _0x57e6b5=function(_0x331bde){while(--_0x331bde){_0x279f52['push'](_0x279f52['shift']());}};_0x57e6b5(++_0x2634f2);}(_0xa0c0,0x16f));var _0x0a0c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa0c0[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0a0c('0x0'));var util=require(_0x0a0c('0x1'));var utils=require(_0x0a0c('0x2'));var queues={};function writeDB(_0x1d8caa){utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1d8caa[_0x0a0c('0x5')],_0x1d8caa[_0x0a0c('0x6')],_0x1d8caa[_0x0a0c('0x7')],_0x1d8caa['lastAssignedTo'],_0x1d8caa[_0x0a0c('0x8')],_0x1d8caa[_0x0a0c('0x9')],_0x1d8caa[_0x0a0c('0xa')]));if(_0x1d8caa[_0x0a0c('0x7')]){utils[_0x0a0c('0xb')](_0x1d8caa['queue'])[_0x0a0c('0xc')](function(_0x36046a){if(_0x36046a){_0x1d8caa[_0x0a0c('0xd')]=_0x36046a['type'];}utils[_0x0a0c('0xe')](_0x0a0c('0xf'),_0x1d8caa);});}else{utils['request']('CreateVoiceQueueReport',_0x1d8caa);}if(_0x1d8caa[_0x0a0c('0x10')]){delete queues[_0x1d8caa[_0x0a0c('0x10')]];}else{delete queues[_0x1d8caa[_0x0a0c('0x5')]];}}exports['queuecallerjoin']=function(_0x33050f){try{utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')]('[%s][queues][queuecallerjoin]',_0x33050f[_0x0a0c('0x5')]),_0x33050f);utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x12'),_0x33050f[_0x0a0c('0x5')],_0x33050f[_0x0a0c('0x7')],_0x33050f['position']));queues[_0x33050f[_0x0a0c('0x5')]]=_['assign'](_0x33050f,{'originalposition':_0x33050f[_0x0a0c('0x13')],'queuecallerjoinAt':utils[_0x0a0c('0x14')](),'mohtime':0x0});}catch(_0x521296){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')](_0x0a0c('0x16'),_0x33050f[_0x0a0c('0x5')]),_0x521296);}};exports[_0x0a0c('0x17')]=function(_0x59a449){try{if(!_[_0x0a0c('0x18')](queues[_0x59a449[_0x0a0c('0x5')]])){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')](_0x0a0c('0x19'),_0x59a449[_0x0a0c('0x5')]),_0x59a449);if(queues[_0x59a449['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x59a449['uniqueid']][_0x0a0c('0x1a')]&&!queues[_0x59a449['uniqueid']][_0x0a0c('0x1b')]){queues[_0x59a449[_0x0a0c('0x5')]][_0x0a0c('0x1c')]=!![];queues[_0x59a449[_0x0a0c('0x5')]]['queuecallercompleteAt']=utils[_0x0a0c('0x14')]();queues[_0x59a449[_0x0a0c('0x5')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x0a0c('0x3')](util['format'](_0x0a0c('0x1d'),_0x59a449[_0x0a0c('0x5')],queues[_0x59a449[_0x0a0c('0x5')]][_0x0a0c('0x1e')],queues[_0x59a449[_0x0a0c('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x59a449['uniqueid']]);}else if(queues[_0x59a449[_0x0a0c('0x5')]][_0x0a0c('0x10')]){utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x1f'),_0x59a449[_0x0a0c('0x5')],queues[_0x59a449[_0x0a0c('0x5')]]['name'],queues[_0x59a449[_0x0a0c('0x5')]]['transfereduniqueid']));queues[queues[_0x59a449[_0x0a0c('0x5')]][_0x0a0c('0x10')]]=queues[_0x59a449[_0x0a0c('0x5')]];queues[queues[_0x59a449[_0x0a0c('0x5')]][_0x0a0c('0x10')]][_0x0a0c('0x20')]=0x2;delete queues[_0x59a449['uniqueid']];}}}catch(_0x39cc30){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')](_0x0a0c('0x19'),_0x59a449['uniqueid']),_0x39cc30);}};exports[_0x0a0c('0x21')]=function(_0x2d1497){try{utils[_0x0a0c('0x11')](util['format'](_0x0a0c('0x22'),_0x2d1497[_0x0a0c('0x5')]),_0x2d1497);if(!_[_0x0a0c('0x18')](_0x2d1497['variable'][_0x0a0c('0x23')])&&_0x2d1497[_0x0a0c('0x24')][_0x0a0c('0x25')]()!==_0x0a0c('0x26')){if(!_['isNil'](queues[_0x2d1497[_0x0a0c('0x5')]])){queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x1a')]=![];queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x27')]=null;queues[_0x2d1497['uniqueid']][_0x0a0c('0x1b')]=!![];queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x28')]=utils[_0x0a0c('0x14')]();queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0xa')]=_0x2d1497[_0x0a0c('0x24')][_0x0a0c('0x25')]();utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')](_0x0a0c('0x29'),_0x2d1497[_0x0a0c('0x5')],queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x1e')],_0x2d1497[_0x0a0c('0x24')],queues[_0x2d1497[_0x0a0c('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x2d1497[_0x0a0c('0x5')]]);}}else if(!_['isNil'](_0x2d1497[_0x0a0c('0x2a')][_0x0a0c('0x2b')])){if(!_[_0x0a0c('0x18')](queues[_0x2d1497[_0x0a0c('0x5')]])&&!queues[_0x2d1497['uniqueid']][_0x0a0c('0x1a')]){queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x1a')]=![];queues[_0x2d1497[_0x0a0c('0x5')]]['queuecallerabandonAt']=null;queues[_0x2d1497[_0x0a0c('0x5')]]['queuecallerexit']=!![];queues[_0x2d1497['uniqueid']][_0x0a0c('0x28')]=utils[_0x0a0c('0x14')]();queues[_0x2d1497['uniqueid']][_0x0a0c('0xa')]=_0x0a0c('0x2c');utils[_0x0a0c('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x2d1497['uniqueid'],queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0x1e')],_0x2d1497['value'],queues[_0x2d1497[_0x0a0c('0x5')]][_0x0a0c('0xa')]));}}}catch(_0x581e27){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')]('[%s][queues][varset]',_0x2d1497[_0x0a0c('0x5')]),_0x581e27);}};exports[_0x0a0c('0x1a')]=function(_0x592096){try{if(!_['isNil'](queues[_0x592096[_0x0a0c('0x5')]])){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')]('[%s][queues][queuecallerabandon]',_0x592096[_0x0a0c('0x5')]),_0x592096);queues[_0x592096[_0x0a0c('0x5')]]['queuecallerexit']=![];queues[_0x592096[_0x0a0c('0x5')]][_0x0a0c('0x28')]=null;queues[_0x592096[_0x0a0c('0x5')]][_0x0a0c('0x1a')]=!![];queues[_0x592096[_0x0a0c('0x5')]][_0x0a0c('0x27')]=utils[_0x0a0c('0x14')]();queues[_0x592096[_0x0a0c('0x5')]]['queuecallerexitreason']=_0x0a0c('0x2d');utils[_0x0a0c('0x3')](util['format'](_0x0a0c('0x2e'),_0x592096[_0x0a0c('0x5')],queues[_0x592096[_0x0a0c('0x5')]][_0x0a0c('0x1e')],queues[_0x592096['uniqueid']][_0x0a0c('0xa')]));}}catch(_0x33c37d){utils['error'](util[_0x0a0c('0x4')]('[%s][queues][queuecallerabandon]',_0x592096[_0x0a0c('0x5')]),_0x33c37d);}};exports['queuecallerleave']=function(_0x51ff35){try{if(!_[_0x0a0c('0x18')](queues[_0x51ff35['uniqueid']])){utils[_0x0a0c('0x11')](util['format'](_0x0a0c('0x2f'),_0x51ff35['uniqueid']),_0x51ff35);utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x30'),_0x51ff35[_0x0a0c('0x5')],queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x1e')],_0x51ff35[_0x0a0c('0x31')],_0x51ff35[_0x0a0c('0x32')]));queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x33')]=!![];queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x34')]=utils['now']();queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x35')]=utils['diffTime'](queues[_0x51ff35[_0x0a0c('0x5')]]['queuecallerleaveAt'],queues[_0x51ff35[_0x0a0c('0x5')]]['queuecallerjoinAt']);queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x13')]=_0x51ff35[_0x0a0c('0x13')];queues[_0x51ff35['uniqueid']][_0x0a0c('0x36')]=_0x51ff35[_0x0a0c('0x36')];queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x31')]=_0x51ff35['connectedlinenum'];queues[_0x51ff35[_0x0a0c('0x5')]][_0x0a0c('0x32')]=_0x51ff35[_0x0a0c('0x32')];}}catch(_0x2c36c3){utils['error'](util[_0x0a0c('0x4')](_0x0a0c('0x2f'),_0x51ff35[_0x0a0c('0x5')]),_0x2c36c3);}};exports[_0x0a0c('0x37')]=function(_0x3ef096){try{if(!_[_0x0a0c('0x18')](queues[_0x3ef096[_0x0a0c('0x5')]])){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')]('[%s][queues][agentconnect]',_0x3ef096[_0x0a0c('0x5')]),_0x3ef096);utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')](_0x0a0c('0x38'),_0x3ef096[_0x0a0c('0x5')],queues[_0x3ef096[_0x0a0c('0x5')]][_0x0a0c('0x1e')],_0x3ef096[_0x0a0c('0x39')],_0x3ef096[_0x0a0c('0x3a')]));queues[_0x3ef096[_0x0a0c('0x5')]][_0x0a0c('0x1a')]=![];queues[_0x3ef096['uniqueid']][_0x0a0c('0x1a')]=![];queues[_0x3ef096[_0x0a0c('0x5')]][_0x0a0c('0x27')]=null;queues[_0x3ef096['uniqueid']]['queuecallerexit']=![];queues[_0x3ef096[_0x0a0c('0x5')]]['queuecallerexitreason']=null;queues[_0x3ef096[_0x0a0c('0x5')]][_0x0a0c('0x28')]=null;queues[_0x3ef096[_0x0a0c('0x5')]]['assigned']=!![];queues[_0x3ef096[_0x0a0c('0x5')]]['accountcode']=_0x3ef096[_0x0a0c('0x3a')];queues[_0x3ef096['uniqueid']]['lastAssignedTo']=_0x3ef096['membername'];}}catch(_0x17f0ec){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')]('[%s][queues][agentconnect]',_0x3ef096[_0x0a0c('0x5')]),_0x17f0ec);}};exports[_0x0a0c('0x3b')]=function(_0x2956ba){try{if(!_[_0x0a0c('0x18')](queues[_0x2956ba[_0x0a0c('0x5')]])){if(queues[_0x2956ba['uniqueid']]['queuecallerleaveAt']){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')](_0x0a0c('0x3c'),_0x2956ba['uniqueid']),_0x2956ba);queues[_0x2956ba['uniqueid']][_0x0a0c('0x1a')]=![];queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0x1a')]=![];queues[_0x2956ba['uniqueid']][_0x0a0c('0x27')]=null;queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0x1b')]=![];queues[_0x2956ba[_0x0a0c('0x5')]]['queuecallerexitAt']=null;queues[_0x2956ba['uniqueid']][_0x0a0c('0x3d')]=!![];queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0x3e')]=_0x2956ba[_0x0a0c('0x39')];queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0x1c')]=!![];queues[_0x2956ba[_0x0a0c('0x5')]]['queuecallercompleteAt']=utils[_0x0a0c('0x14')]();if(_0x2956ba[_0x0a0c('0x3f')]=='transfer'){if(!queues[_0x2956ba['uniqueid']][_0x0a0c('0x40')]){queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0xa')]='TRANSFER';}}else{queues[_0x2956ba['uniqueid']][_0x0a0c('0xa')]='COMPLETEDBY'+_0x2956ba[_0x0a0c('0x3f')][_0x0a0c('0x25')]();}utils[_0x0a0c('0x3')](util['format'](_0x0a0c('0x41'),_0x2956ba[_0x0a0c('0x5')],queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0x1e')],_0x2956ba[_0x0a0c('0x39')],queues[_0x2956ba[_0x0a0c('0x5')]][_0x0a0c('0xa')]));writeDB(queues[_0x2956ba[_0x0a0c('0x5')]]);}}}catch(_0x350d29){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')]('[%s][queues][agentcomplete]',_0x2956ba['uniqueid']),_0x350d29);}};exports[_0x0a0c('0x42')]=function(_0x3d8bea){try{if(!_[_0x0a0c('0x18')](queues[_0x3d8bea[_0x0a0c('0x43')]])){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')](_0x0a0c('0x44'),_0x3d8bea[_0x0a0c('0x5')]),_0x3d8bea);queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0x40')]=!![];queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0x45')]=_0x0a0c('0x46');queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0x47')]=_0x3d8bea[_0x0a0c('0x48')];queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0x49')]=_0x3d8bea['transfereeuniqueid'];queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0xa')]=_0x0a0c('0x4a');utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x4b'),_0x3d8bea[_0x0a0c('0x5')],queues[_0x3d8bea[_0x0a0c('0x43')]][_0x0a0c('0x1e')],_0x3d8bea[_0x0a0c('0x43')],_0x3d8bea[_0x0a0c('0x48')]));}}catch(_0x57efd0){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')](_0x0a0c('0x44'),_0x3d8bea[_0x0a0c('0x5')]),_0x57efd0);}};exports['attendedtransfer']=function(_0x1311b5){try{utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')](_0x0a0c('0x4c'),_0x1311b5[_0x0a0c('0x4d')]),_0x1311b5);if(_0x1311b5[_0x0a0c('0x4d')]==_0x1311b5[_0x0a0c('0x4e')]){if(!_[_0x0a0c('0x18')](queues[_0x1311b5[_0x0a0c('0x4f')]])){utils[_0x0a0c('0x3')](util['format'](_0x0a0c('0x50'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x1e')],_0x1311b5[_0x0a0c('0x51')]));queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x40')]=!![];queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x45')]=_0x0a0c('0x52');queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x47')]=_0x1311b5['origtransfererexten'];queues[_0x1311b5[_0x0a0c('0x4f')]]['transferuniqueid']=_0x1311b5[_0x0a0c('0x4d')];queues[_0x1311b5[_0x0a0c('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1311b5[_0x0a0c('0x4e')]])){if(_0x1311b5['transfereelinkedid']&&queues[_0x1311b5[_0x0a0c('0x53')]]){queues[_0x1311b5[_0x0a0c('0x53')]][_0x0a0c('0x20')]=0x1;queues[_0x1311b5[_0x0a0c('0x43')]]=_[_0x0a0c('0x54')](queues[_0x1311b5[_0x0a0c('0x53')]]);queues[_0x1311b5['transfereeuniqueid']][_0x0a0c('0x10')]=_0x1311b5[_0x0a0c('0x55')];queues[_0x1311b5['transfereeuniqueid']][_0x0a0c('0x20')]=0x2;queues[_0x1311b5[_0x0a0c('0x43')]][_0x0a0c('0x8')]=queues[_0x1311b5['secondtransfererlinkedid']][_0x0a0c('0x8')];queues[_0x1311b5[_0x0a0c('0x43')]][_0x0a0c('0x56')]=queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x56')];queues[_0x1311b5[_0x0a0c('0x43')]]['queuecallerjoinAt']=utils[_0x0a0c('0x14')]();queues[_0x1311b5[_0x0a0c('0x43')]][_0x0a0c('0x34')]=utils[_0x0a0c('0x14')]();queues[_0x1311b5[_0x0a0c('0x43')]]['holdtime']=0x0;queues[_0x1311b5[_0x0a0c('0x43')]][_0x0a0c('0x57')]=0x0;utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')](_0x0a0c('0x58'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5['transfereeuniqueid']]['name'],queues[_0x1311b5['transfereeuniqueid']][_0x0a0c('0x8')],queues[_0x1311b5['transfereeuniqueid']][_0x0a0c('0x56')]));}else{utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x59'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x1e')],_0x1311b5['secondtransfererlinkedid']));queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x10')]=_0x1311b5[_0x0a0c('0x4f')];}}}else if(_0x1311b5[_0x0a0c('0x5a')]==_0x1311b5[_0x0a0c('0x4f')]){if(!_[_0x0a0c('0x18')](queues[_0x1311b5['origtransfererlinkedid']])){utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')](_0x0a0c('0x5b'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x1e')],_0x1311b5[_0x0a0c('0x5a')],_0x1311b5['secondtransfererexten']));queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x40')]=!![];queues[_0x1311b5[_0x0a0c('0x4e')]]['transfertype']='ATTENDED';queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x47')]=_0x1311b5[_0x0a0c('0x5c')];queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x49')]=_0x1311b5['secondtransfereruniqueid'];queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0xa')]=_0x0a0c('0x5d');}if(!_[_0x0a0c('0x18')](queues[_0x1311b5[_0x0a0c('0x4f')]])){if(_0x1311b5[_0x0a0c('0x5e')]&&queues[_0x1311b5[_0x0a0c('0x5e')]]){queues[_0x1311b5[_0x0a0c('0x5e')]][_0x0a0c('0x20')]=0x1;queues[_0x1311b5[_0x0a0c('0x55')]]=_[_0x0a0c('0x54')](queues[_0x1311b5[_0x0a0c('0x5e')]]);queues[_0x1311b5[_0x0a0c('0x55')]]['transfereduniqueid']=_0x1311b5[_0x0a0c('0x55')];queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x20')]=0x2;queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x8')]=queues[_0x1311b5['origtransfererlinkedid']][_0x0a0c('0x8')];queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x56')]=queues[_0x1311b5[_0x0a0c('0x4e')]][_0x0a0c('0x56')];queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x5f')]=utils['now']();queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x34')]=utils[_0x0a0c('0x14')]();queues[_0x1311b5[_0x0a0c('0x55')]]['holdtime']=0x0;queues[_0x1311b5[_0x0a0c('0x55')]]['mohtime']=0x0;utils[_0x0a0c('0x3')](util[_0x0a0c('0x4')](_0x0a0c('0x60'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5['transfertargetuniqueid']][_0x0a0c('0x1e')],queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x10')],queues[_0x1311b5['transfertargetuniqueid']][_0x0a0c('0x8')],queues[_0x1311b5[_0x0a0c('0x55')]][_0x0a0c('0x56')]));}else{utils['info'](util['format'](_0x0a0c('0x59'),_0x1311b5[_0x0a0c('0x4d')],queues[_0x1311b5[_0x0a0c('0x4f')]][_0x0a0c('0x1e')],_0x1311b5[_0x0a0c('0x4e')]));queues[_0x1311b5['secondtransfererlinkedid']][_0x0a0c('0x10')]=_0x1311b5['origtransfererlinkedid'];}}}}catch(_0x14d5f4){utils[_0x0a0c('0x15')](util['format'](_0x0a0c('0x4c'),_0x1311b5['origtransfereruniqueid']),_0x14d5f4);}};exports[_0x0a0c('0x61')]=function(_0x167044){try{if(!_[_0x0a0c('0x18')](queues[_0x167044['uniqueid']])){utils[_0x0a0c('0x11')](util[_0x0a0c('0x4')]('[%s][queues][musiconholdstart]',_0x167044[_0x0a0c('0x5')]),_0x167044);queues[_0x167044[_0x0a0c('0x5')]]['musiconholdstartAt']=utils[_0x0a0c('0x14')]();utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x62'),_0x167044[_0x0a0c('0x5')],queues[_0x167044[_0x0a0c('0x5')]][_0x0a0c('0x1e')],queues[_0x167044[_0x0a0c('0x5')]][_0x0a0c('0x63')]));}}catch(_0x8b3bf4){utils[_0x0a0c('0x15')](util['format'](_0x0a0c('0x64'),_0x167044[_0x0a0c('0x5')]),_0x8b3bf4);}};exports[_0x0a0c('0x65')]=function(_0x5cf26c){try{if(!_[_0x0a0c('0x18')](queues[_0x5cf26c[_0x0a0c('0x5')]])){if(!_[_0x0a0c('0x18')](queues[_0x5cf26c[_0x0a0c('0x5')]][_0x0a0c('0x63')])){utils['debug'](util[_0x0a0c('0x4')](_0x0a0c('0x66'),_0x5cf26c[_0x0a0c('0x5')]),_0x5cf26c);queues[_0x5cf26c['uniqueid']][_0x0a0c('0x57')]+=utils[_0x0a0c('0x67')](utils[_0x0a0c('0x14')](),queues[_0x5cf26c['uniqueid']][_0x0a0c('0x63')]);utils['info'](util[_0x0a0c('0x4')](_0x0a0c('0x68'),_0x5cf26c[_0x0a0c('0x5')],queues[_0x5cf26c[_0x0a0c('0x5')]][_0x0a0c('0x1e')],queues[_0x5cf26c[_0x0a0c('0x5')]][_0x0a0c('0x57')]));delete queues[_0x5cf26c[_0x0a0c('0x5')]][_0x0a0c('0x63')];}}}catch(_0x57c6c3){utils[_0x0a0c('0x15')](util[_0x0a0c('0x4')]('[%s][queues][musiconholdstop]',_0x5cf26c[_0x0a0c('0x5')]),_0x57c6c3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f23946e..d93fd40 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 _0x746a=['recording','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','UserId','CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','error','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','variable','value','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','outbound','connectedlinenum','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x746a,0x129));var _0xa746=function(_0x5b4cfe,_0x99d79e){_0x5b4cfe=_0x5b4cfe-0x0;var _0x13e892=_0x746a[_0x5b4cfe];return _0x13e892;};'use strict';var _=require('lodash');var util=require(_0xa746('0x0'));var utils=require(_0xa746('0x1'));var transfers=require(_0xa746('0x2'));var recordings={};function writeDB(_0x20a4d2){var _0x4413cc;utils[_0xa746('0x3')](util[_0xa746('0x4')](_0xa746('0x5'),_0x20a4d2[_0xa746('0x6')]));if(transfers[_0xa746('0x7')][_0x20a4d2[_0xa746('0x6')]]){_0x4413cc=_0x20a4d2['uniqueid'];_0x20a4d2[_0xa746('0x6')]=transfers['blinds'][_0x20a4d2['uniqueid']][_0xa746('0x8')];}if(_0x20a4d2[_0xa746('0x9')]){utils['getUserByInternal'](_0x20a4d2[_0xa746('0x9')])[_0xa746('0xa')](function(_0x503168){if(_0x503168){_0x20a4d2[_0xa746('0xb')]=_0x503168[_0xa746('0xc')];_0x20a4d2[_0xa746('0xd')]=_0x503168['id'];}utils['request'](_0xa746('0xe'),_0x20a4d2);});}else{utils['request']('CreateVoiceRecording',_0x20a4d2);}if(_0x4413cc)delete transfers['blinds'][_0x4413cc];}exports[_0xa746('0xf')]=function(_0x39ec8c){try{utils[_0xa746('0x10')](util[_0xa746('0x4')]('[%s][recordings][newchannel]',_0x39ec8c[_0xa746('0x6')]),_0x39ec8c);if(_0x39ec8c[_0xa746('0x6')]==_0x39ec8c[_0xa746('0x11')]){utils[_0xa746('0x3')](util['format'](_0xa746('0x12'),_0x39ec8c['uniqueid'],_0x39ec8c['context'],_0x39ec8c[_0xa746('0x13')]));recordings[_0x39ec8c['uniqueid']]={'uniqueid':_0x39ec8c[_0xa746('0x6')],'accountcode':_0x39ec8c[_0xa746('0x9')],'exten':_0x39ec8c[_0xa746('0x13')],'context':_0x39ec8c[_0xa746('0x14')],'channel':_0x39ec8c['channel'],'monitors':[]};}}catch(_0x6807ed){utils[_0xa746('0x15')](util['format'](_0xa746('0x16'),_0x39ec8c[_0xa746('0x6')]),_0x6807ed);}};exports[_0xa746('0x17')]=function(_0xc10ad2){try{utils[_0xa746('0x10')](util['format'](_0xa746('0x18'),_0xc10ad2[_0xa746('0x6')]),_0xc10ad2);if(!_[_0xa746('0x19')](recordings[_0xc10ad2[_0xa746('0x6')]])&&_0xc10ad2[_0xa746('0x1a')]==0x6){utils[_0xa746('0x3')](util[_0xa746('0x4')](_0xa746('0x1b'),_0xc10ad2['uniqueid'],_0xc10ad2['context'],_0xc10ad2[_0xa746('0x1c')]));}else if(!_[_0xa746('0x19')](recordings[_0xc10ad2[_0xa746('0x11')]])&&_0xc10ad2[_0xa746('0x1a')]==0x6&&_0xc10ad2[_0xa746('0x14')]!=_0xa746('0x1d')){utils[_0xa746('0x3')](util[_0xa746('0x4')](_0xa746('0x1e'),_0xc10ad2[_0xa746('0x6')],_0xc10ad2['linkedid'],_0xc10ad2[_0xa746('0x14')],_0xc10ad2['channel']));recordings[_0xc10ad2[_0xa746('0x11')]][_0xa746('0x9')]=_0xc10ad2[_0xa746('0x9')];}}catch(_0xc65fe2){utils[_0xa746('0x15')](util[_0xa746('0x4')](_0xa746('0x18'),_0xc10ad2[_0xa746('0x6')]),_0xc65fe2);}};exports[_0xa746('0x1f')]=function(_0x579a00){try{if(!_['isNil'](_0x579a00['variable'])&&!_['isNil'](_0x579a00['variable'][_0xa746('0x20')])){utils[_0xa746('0x10')](util[_0xa746('0x4')]('[%s][recordings][varset]',_0x579a00[_0xa746('0x6')]),_0x579a00);utils[_0xa746('0x3')](util['format'](_0xa746('0x21'),_0x579a00[_0xa746('0x6')],_0x579a00[_0xa746('0x22')],_0x579a00[_0xa746('0x23')]));if(_['endsWith'](_0x579a00[_0xa746('0x23')],_0xa746('0x24'))){_0x579a00['value']=_0x579a00[_0xa746('0x23')][_0xa746('0x25')](_0xa746('0x24'),'.WAV');}if(recordings[_0x579a00[_0xa746('0x11')]]){var _0x5994f7=_[_0xa746('0x26')](recordings[_0x579a00[_0xa746('0x11')]]['monitors'],{'value':_0x579a00[_0xa746('0x23')]});if(_[_0xa746('0x19')](_0x5994f7)){recordings[_0x579a00[_0xa746('0x11')]][_0xa746('0x27')][_0xa746('0x28')]({'value':_0x579a00['value']});}}}}catch(_0x5c3f0a){utils[_0xa746('0x15')](util['format'](_0xa746('0x29'),_0x579a00[_0xa746('0x6')]),_0x5c3f0a);}};exports[_0xa746('0x2a')]=function(_0x4d3de7){try{if(!_[_0xa746('0x19')](recordings[_0x4d3de7['uniqueid']])){utils['debug'](util[_0xa746('0x4')](_0xa746('0x2b'),_0x4d3de7[_0xa746('0x6')]),_0x4d3de7);utils[_0xa746('0x3')](util['format'](_0xa746('0x2c'),_0x4d3de7[_0xa746('0x6')],_0x4d3de7['calleridnum'],_0x4d3de7[_0xa746('0x2d')],_0x4d3de7[_0xa746('0x2e')]));recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x2f')]=_0x4d3de7['calleridnum'];recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x2d')]=_0x4d3de7[_0xa746('0x2d')];recordings[_0x4d3de7[_0xa746('0x6')]]['connectedlinenum']=_0x4d3de7['connectedlinenum'];recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x30')]=_0x4d3de7[_0xa746('0x30')];if(recordings[_0x4d3de7['uniqueid']]['type']==_0xa746('0x31')&&recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x9')]){recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x32')]=recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x9')];recordings[_0x4d3de7[_0xa746('0x6')]][_0xa746('0x30')]='';}recordings[_0x4d3de7[_0xa746('0x6')]]['monitors'][_0xa746('0x33')](function(_0x5a81d1){var _0x3b75f1=_[_0xa746('0x34')](recordings[_0x4d3de7[_0xa746('0x6')]]);_0x3b75f1[_0xa746('0x23')]=_0x5a81d1[_0xa746('0x23')];writeDB(_0x3b75f1);});delete recordings[_0x4d3de7[_0xa746('0x6')]];}}catch(_0x14f8b3){utils[_0xa746('0x15')](util['format'](_0xa746('0x2b'),_0x4d3de7['uniqueid']),_0x14f8b3);}};exports[_0xa746('0x35')]=function(_0x315a84){try{if(!_[_0xa746('0x19')](recordings[_0x315a84['uniqueid']])){utils[_0xa746('0x10')](util[_0xa746('0x4')](_0xa746('0x36'),_0x315a84[_0xa746('0x6')]),_0x315a84);utils['info'](util[_0xa746('0x4')](_0xa746('0x37'),_0x315a84[_0xa746('0x6')],_0x315a84[_0xa746('0x38')],_0x315a84[_0xa746('0x39')]));if(_0x315a84[_0xa746('0x38')][_0xa746('0x3a')]()=='set'&&_[_0xa746('0x3b')](_0x315a84[_0xa746('0x39')][_0xa746('0x3a')](),_0xa746('0x3c'))){var _0x40befc=_0x315a84['appdata'][_0xa746('0x3d')]('=');var _0x24e1d7=_0x40befc[0x0][_0xa746('0x3e')](_0x40befc[0x0]['lastIndexOf']('(')+0x1,_0x40befc[0x0]['lastIndexOf'](')'));var _0x3915fd=_0x40befc[0x1];recordings[_0x315a84[_0xa746('0x6')]][_0x24e1d7]=_0x3915fd;}}}catch(_0x2c1233){utils[_0xa746('0x15')](util['format'](_0xa746('0x36'),_0x315a84[_0xa746('0x6')]),_0x2c1233);}};exports['queuecallerjoin']=function(_0xbea4a1){try{if(!_[_0xa746('0x19')](recordings[_0xbea4a1['uniqueid']])){utils['debug'](util[_0xa746('0x4')](_0xa746('0x3f'),_0xbea4a1[_0xa746('0x6')]),_0xbea4a1);utils[_0xa746('0x3')](util['format'](_0xa746('0x40'),_0xbea4a1[_0xa746('0x6')],_0xbea4a1[_0xa746('0x41')]));recordings[_0xbea4a1['uniqueid']][_0xa746('0x41')]=_0xbea4a1['queue'];}}catch(_0x132ce5){utils[_0xa746('0x15')](util['format'](_0xa746('0x3f'),_0xbea4a1[_0xa746('0x6')]),_0x132ce5);}};exports[_0xa746('0x42')]=function(_0x45862b){try{utils['debug'](util[_0xa746('0x4')](_0xa746('0x43'),_0x45862b['uniqueid']),_0x45862b);utils[_0xa746('0x3')](util[_0xa746('0x4')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x45862b['uniqueid'],_0x45862b[_0xa746('0x44')],_0x45862b[_0xa746('0x45')],_0x45862b[_0xa746('0x46')],_0x45862b[_0xa746('0x47')]));if(recordings[_0x45862b[_0xa746('0x48')]]&&transfers[_0xa746('0x7')][_0x45862b[_0xa746('0x48')]]){transfers[_0xa746('0x7')][_0x45862b[_0xa746('0x48')]][_0xa746('0x49')]=!![];}}catch(_0x311876){utils[_0xa746('0x15')](util[_0xa746('0x4')](_0xa746('0x43'),_0x45862b[_0xa746('0x6')]),_0x311876);}}; \ No newline at end of file +var _0x11f9=['hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','request','CreateVoiceRecording','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors'];(function(_0x513465,_0x2b69c6){var _0x48e9e6=function(_0x438ae2){while(--_0x438ae2){_0x513465['push'](_0x513465['shift']());}};_0x48e9e6(++_0x2b69c6);}(_0x11f9,0x1d0));var _0x911f=function(_0x4dfa91,_0x30be73){_0x4dfa91=_0x4dfa91-0x0;var _0x511504=_0x11f9[_0x4dfa91];return _0x511504;};'use strict';var _=require(_0x911f('0x0'));var util=require(_0x911f('0x1'));var utils=require(_0x911f('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x5d08cf){var _0x4f721e;utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x5'),_0x5d08cf[_0x911f('0x6')]));if(transfers['blinds'][_0x5d08cf[_0x911f('0x6')]]){_0x4f721e=_0x5d08cf[_0x911f('0x6')];_0x5d08cf[_0x911f('0x6')]=transfers[_0x911f('0x7')][_0x5d08cf[_0x911f('0x6')]][_0x911f('0x8')];}if(_0x5d08cf[_0x911f('0x9')]){utils[_0x911f('0xa')](_0x5d08cf[_0x911f('0x9')])[_0x911f('0xb')](function(_0x23bc05){if(_0x23bc05){_0x5d08cf[_0x911f('0xc')]=_0x23bc05[_0x911f('0xd')];_0x5d08cf['UserId']=_0x23bc05['id'];}utils[_0x911f('0xe')](_0x911f('0xf'),_0x5d08cf);});}else{utils[_0x911f('0xe')]('CreateVoiceRecording',_0x5d08cf);}if(_0x4f721e)delete transfers['blinds'][_0x4f721e];}exports['newchannel']=function(_0x300859){try{utils[_0x911f('0x10')](util[_0x911f('0x4')]('[%s][recordings][newchannel]',_0x300859[_0x911f('0x6')]),_0x300859);if(_0x300859['uniqueid']==_0x300859[_0x911f('0x11')]){utils['info'](util['format'](_0x911f('0x12'),_0x300859[_0x911f('0x6')],_0x300859[_0x911f('0x13')],_0x300859[_0x911f('0x14')]));recordings[_0x300859[_0x911f('0x6')]]={'uniqueid':_0x300859['uniqueid'],'accountcode':_0x300859[_0x911f('0x9')],'exten':_0x300859[_0x911f('0x14')],'context':_0x300859['context'],'channel':_0x300859['channel'],'monitors':[]};}}catch(_0x136210){utils[_0x911f('0x15')](util[_0x911f('0x4')]('[%s][recordings][newchannel]',_0x300859[_0x911f('0x6')]),_0x136210);}};exports[_0x911f('0x16')]=function(_0x3eb268){try{utils[_0x911f('0x10')](util[_0x911f('0x4')](_0x911f('0x17'),_0x3eb268[_0x911f('0x6')]),_0x3eb268);if(!_[_0x911f('0x18')](recordings[_0x3eb268[_0x911f('0x6')]])&&_0x3eb268['channelstate']==0x6){utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x19'),_0x3eb268[_0x911f('0x6')],_0x3eb268[_0x911f('0x13')],_0x3eb268[_0x911f('0x1a')]));}else if(!_[_0x911f('0x18')](recordings[_0x3eb268[_0x911f('0x11')]])&&_0x3eb268[_0x911f('0x1b')]==0x6&&_0x3eb268[_0x911f('0x13')]!='transfer'){utils['info'](util[_0x911f('0x4')](_0x911f('0x1c'),_0x3eb268['uniqueid'],_0x3eb268[_0x911f('0x11')],_0x3eb268[_0x911f('0x13')],_0x3eb268['channel']));recordings[_0x3eb268[_0x911f('0x11')]][_0x911f('0x9')]=_0x3eb268[_0x911f('0x9')];}}catch(_0x161d09){utils[_0x911f('0x15')](util[_0x911f('0x4')](_0x911f('0x17'),_0x3eb268['uniqueid']),_0x161d09);}};exports[_0x911f('0x1d')]=function(_0x12161a){try{if(!_[_0x911f('0x18')](_0x12161a[_0x911f('0x1e')])&&!_[_0x911f('0x18')](_0x12161a[_0x911f('0x1e')][_0x911f('0x1f')])){utils[_0x911f('0x10')](util[_0x911f('0x4')](_0x911f('0x20'),_0x12161a[_0x911f('0x6')]),_0x12161a);utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x21'),_0x12161a[_0x911f('0x6')],_0x12161a[_0x911f('0x1e')],_0x12161a[_0x911f('0x22')]));if(_[_0x911f('0x23')](_0x12161a[_0x911f('0x22')],_0x911f('0x24'))){_0x12161a[_0x911f('0x22')]=_0x12161a[_0x911f('0x22')][_0x911f('0x25')](_0x911f('0x24'),'.WAV');}if(recordings[_0x12161a['linkedid']]){var _0x1ae2f0=_[_0x911f('0x26')](recordings[_0x12161a[_0x911f('0x11')]][_0x911f('0x27')],{'value':_0x12161a['value']});if(_[_0x911f('0x18')](_0x1ae2f0)){recordings[_0x12161a[_0x911f('0x11')]][_0x911f('0x27')]['push']({'value':_0x12161a[_0x911f('0x22')]});}}}}catch(_0x59db93){utils[_0x911f('0x15')](util[_0x911f('0x4')]('[%s][recordings][varset]',_0x12161a[_0x911f('0x6')]),_0x59db93);}};exports[_0x911f('0x28')]=function(_0x5ab2b2){try{if(!_[_0x911f('0x18')](recordings[_0x5ab2b2[_0x911f('0x6')]])){utils[_0x911f('0x10')](util['format']('[%s][recordings][hangup]',_0x5ab2b2[_0x911f('0x6')]),_0x5ab2b2);utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x29'),_0x5ab2b2[_0x911f('0x6')],_0x5ab2b2['calleridnum'],_0x5ab2b2['calleridname'],_0x5ab2b2['cause-txt']));recordings[_0x5ab2b2['uniqueid']][_0x911f('0x2a')]=_0x5ab2b2['calleridnum'];recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x2b')]=_0x5ab2b2[_0x911f('0x2b')];recordings[_0x5ab2b2['uniqueid']]['connectedlinenum']=_0x5ab2b2[_0x911f('0x2c')];recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x2d')]=_0x5ab2b2[_0x911f('0x2d')];if(recordings[_0x5ab2b2['uniqueid']][_0x911f('0x2e')]==_0x911f('0x2f')&&recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x9')]){recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x2c')]=recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x9')];recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x2d')]='';}recordings[_0x5ab2b2[_0x911f('0x6')]][_0x911f('0x27')][_0x911f('0x30')](function(_0x157338){var _0x272bf1=_['clone'](recordings[_0x5ab2b2[_0x911f('0x6')]]);_0x272bf1[_0x911f('0x22')]=_0x157338[_0x911f('0x22')];writeDB(_0x272bf1);});delete recordings[_0x5ab2b2[_0x911f('0x6')]];}}catch(_0x51abd0){utils[_0x911f('0x15')](util[_0x911f('0x4')](_0x911f('0x31'),_0x5ab2b2['uniqueid']),_0x51abd0);}};exports[_0x911f('0x32')]=function(_0x424c0e){try{if(!_[_0x911f('0x18')](recordings[_0x424c0e[_0x911f('0x6')]])){utils[_0x911f('0x10')](util[_0x911f('0x4')](_0x911f('0x33'),_0x424c0e[_0x911f('0x6')]),_0x424c0e);utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x34'),_0x424c0e['uniqueid'],_0x424c0e[_0x911f('0x35')],_0x424c0e[_0x911f('0x36')]));if(_0x424c0e[_0x911f('0x35')][_0x911f('0x37')]()=='set'&&_[_0x911f('0x38')](_0x424c0e[_0x911f('0x36')][_0x911f('0x37')](),_0x911f('0x39'))){var _0x48015c=_0x424c0e[_0x911f('0x36')][_0x911f('0x3a')]('=');var _0x2bf9a4=_0x48015c[0x0][_0x911f('0x3b')](_0x48015c[0x0]['lastIndexOf']('(')+0x1,_0x48015c[0x0][_0x911f('0x3c')](')'));var _0x476914=_0x48015c[0x1];recordings[_0x424c0e['uniqueid']][_0x2bf9a4]=_0x476914;}}}catch(_0x1e9a1c){utils[_0x911f('0x15')](util[_0x911f('0x4')](_0x911f('0x33'),_0x424c0e[_0x911f('0x6')]),_0x1e9a1c);}};exports[_0x911f('0x3d')]=function(_0x909dd6){try{if(!_['isNil'](recordings[_0x909dd6['uniqueid']])){utils[_0x911f('0x10')](util[_0x911f('0x4')]('[%s][recordings][queuecallerjoin]',_0x909dd6['uniqueid']),_0x909dd6);utils[_0x911f('0x3')](util[_0x911f('0x4')](_0x911f('0x3e'),_0x909dd6['uniqueid'],_0x909dd6[_0x911f('0x3f')]));recordings[_0x909dd6['uniqueid']][_0x911f('0x3f')]=_0x909dd6[_0x911f('0x3f')];}}catch(_0x270b4e){utils[_0x911f('0x15')](util[_0x911f('0x4')](_0x911f('0x40'),_0x909dd6['uniqueid']),_0x270b4e);}};exports[_0x911f('0x41')]=function(_0x49cd91){try{utils[_0x911f('0x10')](util[_0x911f('0x4')](_0x911f('0x42'),_0x49cd91[_0x911f('0x6')]),_0x49cd91);utils[_0x911f('0x3')](util['format'](_0x911f('0x43'),_0x49cd91[_0x911f('0x6')],_0x49cd91['transferercalleridnum'],_0x49cd91['transferercalleridname'],_0x49cd91[_0x911f('0x44')],_0x49cd91[_0x911f('0x45')]));if(recordings[_0x49cd91[_0x911f('0x46')]]&&transfers[_0x911f('0x7')][_0x49cd91[_0x911f('0x46')]]){transfers[_0x911f('0x7')][_0x49cd91[_0x911f('0x46')]][_0x911f('0x47')]=!![];}}catch(_0x120762){utils[_0x911f('0x15')](util[_0x911f('0x4')](_0x911f('0x42'),_0x49cd91[_0x911f('0x6')]),_0x120762);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1f079bc..e3fb325 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 _0x6fd3=['origtransferercalleridnum','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','request','blinds','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_0x6fd3,0x163));var _0x36fd=function(_0x1a191d,_0x599d8e){_0x1a191d=_0x1a191d-0x0;var _0x4dba42=_0x6fd3[_0x1a191d];return _0x4dba42;};'use strict';var _=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var utils=require('./utils');function writeDB(_0x2bd412){utils[_0x36fd('0x2')](util[_0x36fd('0x3')](_0x36fd('0x4'),_0x2bd412['type']===_0x36fd('0x5')?_0x2bd412[_0x36fd('0x6')]:_0x2bd412['uniqueid'],_0x2bd412[_0x36fd('0x7')]));utils[_0x36fd('0x8')]('CreateVoiceTransferReport',_0x2bd412);}exports[_0x36fd('0x9')]={};exports['blindtransfer']=function(_0x24fa30){try{utils['debug'](util[_0x36fd('0x3')](_0x36fd('0xa'),_0x24fa30[_0x36fd('0xb')]),_0x24fa30);utils[_0x36fd('0x2')](util[_0x36fd('0x3')](_0x36fd('0xc'),_0x24fa30[_0x36fd('0xb')],_0x24fa30[_0x36fd('0xd')],_0x24fa30[_0x36fd('0xe')],_0x24fa30[_0x36fd('0xf')],_0x24fa30[_0x36fd('0x10')]));_0x24fa30[_0x36fd('0x7')]=_0x36fd('0x11');exports[_0x36fd('0x9')][_0x24fa30['transfereruniqueid']]=_0x24fa30;writeDB(_0x24fa30);}catch(_0x2b4727){utils[_0x36fd('0x12')](util[_0x36fd('0x3')](_0x36fd('0xa'),_0x24fa30[_0x36fd('0xb')]),_0x2b4727);}};exports[_0x36fd('0x13')]=function(_0x1ed844){try{utils[_0x36fd('0x14')](util[_0x36fd('0x3')](_0x36fd('0x15'),_0x1ed844['origtransfereruniqueid']),_0x1ed844);utils[_0x36fd('0x2')](util['format'](_0x36fd('0x16'),_0x1ed844[_0x36fd('0x6')],_0x1ed844[_0x36fd('0x17')],_0x1ed844['origtransferercalleridname'],_0x1ed844[_0x36fd('0x18')],_0x1ed844['transfertargetcalleridname']));_0x1ed844=_[_0x36fd('0x19')](_0x1ed844,{'transfererchannel':_0x1ed844[_0x36fd('0x1a')],'transferercalleridnum':_0x1ed844['origtransferercalleridnum'],'transferercalleridname':_0x1ed844[_0x36fd('0x1b')],'transfererconnectedlinenum':_0x1ed844[_0x36fd('0x1c')],'transfererconnectedlinename':_0x1ed844[_0x36fd('0x1d')],'transfereraccountcode':_0x1ed844[_0x36fd('0x1e')],'transferercontext':_0x1ed844['secondtransferercontext'],'transfererexten':_0x1ed844[_0x36fd('0x1f')],'transfererlinkedid':_0x1ed844[_0x36fd('0x20')],'context':_0x1ed844[_0x36fd('0x21')],'extension':_0x1ed844[_0x36fd('0x22')],'type':_0x36fd('0x5')});if(_[_0x36fd('0x23')](_0x1ed844[_0x36fd('0x24')])){_0x1ed844=_[_0x36fd('0x19')](_0x1ed844,{'transfereechannel':_0x1ed844['transfertargetchannel'],'transfereecalleridnum':_0x1ed844[_0x36fd('0x18')],'transfereecalleridname':_0x1ed844[_0x36fd('0x25')],'transfereeconnectedlinenum':_0x1ed844[_0x36fd('0x26')],'transfereeconnectedlinename':_0x1ed844['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1ed844[_0x36fd('0x27')],'transfereecontext':_0x1ed844['transfertargetcontext'],'transfereeexten':_0x1ed844[_0x36fd('0x28')],'transfereelinkedid':_0x1ed844[_0x36fd('0x29')]});}writeDB(_0x1ed844);}catch(_0x1b3708){utils[_0x36fd('0x12')](util[_0x36fd('0x3')](_0x36fd('0x15'),_0x1ed844[_0x36fd('0x6')]),_0x1b3708);}}; \ No newline at end of file +var _0x36d3=['debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','assign','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','CreateVoiceTransferReport','blinds','blindtransfer'];(function(_0x35464a,_0xd1fc4){var _0x2aeb64=function(_0x3f8bcb){while(--_0x3f8bcb){_0x35464a['push'](_0x35464a['shift']());}};_0x2aeb64(++_0xd1fc4);}(_0x36d3,0x1d6));var _0x336d=function(_0x581a07,_0x3bb875){_0x581a07=_0x581a07-0x0;var _0x48c338=_0x36d3[_0x581a07];return _0x48c338;};'use strict';var _=require(_0x336d('0x0'));var util=require('util');var utils=require(_0x336d('0x1'));function writeDB(_0x3c3a7c){utils['info'](util[_0x336d('0x2')](_0x336d('0x3'),_0x3c3a7c['type']===_0x336d('0x4')?_0x3c3a7c['origtransfereruniqueid']:_0x3c3a7c[_0x336d('0x5')],_0x3c3a7c[_0x336d('0x6')]));utils['request'](_0x336d('0x7'),_0x3c3a7c);}exports[_0x336d('0x8')]={};exports[_0x336d('0x9')]=function(_0x23ad94){try{utils[_0x336d('0xa')](util[_0x336d('0x2')]('[%s][transfers][blindtransfer]',_0x23ad94['uniqueid']),_0x23ad94);utils['info'](util['format'](_0x336d('0xb'),_0x23ad94['uniqueid'],_0x23ad94[_0x336d('0xc')],_0x23ad94['transferercalleridname'],_0x23ad94[_0x336d('0xd')],_0x23ad94[_0x336d('0xe')]));_0x23ad94['type']=_0x336d('0xf');exports[_0x336d('0x8')][_0x23ad94[_0x336d('0x10')]]=_0x23ad94;writeDB(_0x23ad94);}catch(_0x5ae7c9){utils['error'](util['format'](_0x336d('0x11'),_0x23ad94[_0x336d('0x5')]),_0x5ae7c9);}};exports['attendedtransfer']=function(_0x4fbc22){try{utils[_0x336d('0xa')](util['format'](_0x336d('0x12'),_0x4fbc22['origtransfereruniqueid']),_0x4fbc22);utils['info'](util[_0x336d('0x2')](_0x336d('0x13'),_0x4fbc22[_0x336d('0x14')],_0x4fbc22[_0x336d('0x15')],_0x4fbc22['origtransferercalleridname'],_0x4fbc22[_0x336d('0x16')],_0x4fbc22['transfertargetcalleridname']));_0x4fbc22=_[_0x336d('0x17')](_0x4fbc22,{'transfererchannel':_0x4fbc22['origtransfererchannel'],'transferercalleridnum':_0x4fbc22[_0x336d('0x15')],'transferercalleridname':_0x4fbc22[_0x336d('0x18')],'transfererconnectedlinenum':_0x4fbc22[_0x336d('0x19')],'transfererconnectedlinename':_0x4fbc22[_0x336d('0x1a')],'transfereraccountcode':_0x4fbc22[_0x336d('0x1b')],'transferercontext':_0x4fbc22[_0x336d('0x1c')],'transfererexten':_0x4fbc22[_0x336d('0x1d')],'transfererlinkedid':_0x4fbc22[_0x336d('0x1e')],'context':_0x4fbc22[_0x336d('0x1f')],'extension':_0x4fbc22[_0x336d('0x20')],'type':_0x336d('0x4')});if(_[_0x336d('0x21')](_0x4fbc22['transfereechannel'])){_0x4fbc22=_[_0x336d('0x17')](_0x4fbc22,{'transfereechannel':_0x4fbc22[_0x336d('0x22')],'transfereecalleridnum':_0x4fbc22[_0x336d('0x16')],'transfereecalleridname':_0x4fbc22[_0x336d('0x23')],'transfereeconnectedlinenum':_0x4fbc22['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4fbc22['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4fbc22[_0x336d('0x24')],'transfereecontext':_0x4fbc22[_0x336d('0x25')],'transfereeexten':_0x4fbc22[_0x336d('0x26')],'transfereelinkedid':_0x4fbc22['transfertargetlinkedid']});}writeDB(_0x4fbc22);}catch(_0x479f96){utils[_0x336d('0x27')](util['format'](_0x336d('0x12'),_0x4fbc22[_0x336d('0x14')]),_0x479f96);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ef91663..1a0907b 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 _0x62f2=['bluebird','jayson/promise','moment','util','http','../../config/logger','xdr','info','inspect','debug','request','catch','error','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','sumTime','now','format','isAfter','isBefore'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x62f2,0xff));var _0x262f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x62f2[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x262f('0x0'));var jayson=require(_0x262f('0x1'));var moment=require(_0x262f('0x2'));var util=require(_0x262f('0x3'));var client=jayson['client'][_0x262f('0x4')]({'port':0x2329});var logger=require(_0x262f('0x5'))(_0x262f('0x6'));exports['info']=function(_0x23ebfb,_0x282e78){logger[_0x262f('0x7')](_0x23ebfb,_0x282e78?util[_0x262f('0x8')](_0x282e78,{'showHidden':![],'depth':null}):'');};exports[_0x262f('0x9')]=function(_0x5d5b29,_0x4c3631){logger[_0x262f('0x9')](_0x5d5b29,_0x4c3631?util[_0x262f('0x8')](_0x4c3631,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xe40b08,_0x1ff4cc){logger['error'](_0xe40b08,_0x1ff4cc?util[_0x262f('0x8')](_0x1ff4cc,{'showHidden':![],'depth':null}):'');};exports[_0x262f('0xa')]=function(_0x3bd9fb,_0x3a9f73){return client[_0x262f('0xa')](_0x3bd9fb,{'body':_0x3a9f73})['then'](function(_0x284574){logger[_0x262f('0x9')]('[utils][request]\x20name:%s',_0x3bd9fb,_0x284574?util[_0x262f('0x8')](_0x284574,{'showHidden':![],'depth':null}):'');})[_0x262f('0xb')](function(_0x55f9e3){logger[_0x262f('0xc')](_0x262f('0xd'),_0x3bd9fb,_0x55f9e3?util['inspect'](_0x55f9e3,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3d4625){return client['request'](_0x262f('0xe'),{'options':{'raw':!![],'attributes':['id',_0x262f('0xf'),_0x262f('0x10'),_0x262f('0x11')],'where':_0x3d4625,'limit':0x1}})[_0x262f('0x12')](function(_0x2e27a8){logger[_0x262f('0x9')](_0x262f('0x13'),JSON[_0x262f('0x14')](_0x3d4625),_0x2e27a8?util['inspect'](_0x2e27a8,{'showHidden':![],'depth':null}):'');return _0x2e27a8[_0x262f('0x15')][_0x262f('0x16')]?_0x2e27a8[_0x262f('0x15')][0x0]:null;});}exports[_0x262f('0x17')]=function(_0x3dade4){return new BPromise(function(_0x36684b,_0x580315){if(_0x3dade4){return getUser({'internal':_0x3dade4})[_0x262f('0x12')](function(_0x2a53a2){logger['info'](_0x262f('0x18'),_0x3dade4,_0x2a53a2?_0x262f('0x19'):_0x262f('0x1a'));return _0x36684b(_0x2a53a2);})[_0x262f('0xb')](function(_0x54fd7f){logger[_0x262f('0xc')](_0x262f('0x1b'),_0x54fd7f?util[_0x262f('0x8')](_0x54fd7f,{'showHidden':![],'depth':null}):'');return _0x36684b(null);});}return _0x36684b(null);});};exports[_0x262f('0x1c')]=function(_0x33a685){return new BPromise(function(_0x558f33,_0x4b9238){if(_0x33a685){return getUser({'interface':_0x33a685})[_0x262f('0x12')](function(_0x2597cd){logger[_0x262f('0x7')](_0x262f('0x1d'),_0x33a685,_0x2597cd?_0x262f('0x19'):_0x262f('0x1a'));return _0x558f33(_0x2597cd);})[_0x262f('0xb')](function(_0x5555a2){logger['error'](_0x262f('0x1e'),_0x5555a2?util[_0x262f('0x8')](_0x5555a2,{'showHidden':![],'depth':null}):'');return _0x558f33(null);});}return _0x558f33(null);});};exports[_0x262f('0x1f')]=function(_0x532a25){return new BPromise(function(_0x5ebea9,_0x21f9cc){if(_0x532a25){return getUser({'name':_0x532a25})[_0x262f('0x12')](function(_0x32a95d){logger[_0x262f('0x7')](_0x262f('0x20'),_0x532a25,_0x32a95d?'found':_0x262f('0x1a'));return _0x5ebea9(_0x32a95d);})[_0x262f('0xb')](function(_0x2dd870){logger[_0x262f('0xc')](_0x262f('0x21'),_0x2dd870?util[_0x262f('0x8')](_0x2dd870,{'showHidden':![],'depth':null}):'');return _0x5ebea9(null);});}return _0x5ebea9(null);});};exports[_0x262f('0x22')]=function(_0x25be2e){return new BPromise(function(_0x2cf539,_0x577c52){if(_0x25be2e){return client[_0x262f('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x262f('0x23'),_0x262f('0x24'),'acwTimeout'],'where':{'name':_0x25be2e},'limit':0x1}})[_0x262f('0x12')](function(_0x28abc4){logger[_0x262f('0x9')](_0x262f('0x25'),_0x25be2e,_0x28abc4?util['inspect'](_0x28abc4,{'showHidden':![],'depth':null}):'');logger[_0x262f('0x7')](_0x262f('0x26'),_0x25be2e,_0x28abc4?_0x262f('0x19'):_0x262f('0x1a'));return _0x2cf539(_0x28abc4[_0x262f('0x15')][_0x262f('0x16')]?_0x28abc4[_0x262f('0x15')][0x0]:null);})['catch'](function(_0xac00bf){logger['error'](_0x262f('0x27'),_0xac00bf?util['inspect'](_0xac00bf,{'showHidden':![],'depth':null}):'');return _0x2cf539(null);});}return _0x2cf539(null);});};exports[_0x262f('0x28')]=function(_0x1d82bb,_0x5876f1){return moment(_0x1d82bb)[_0x262f('0x29')](_0x5876f1,_0x262f('0x2a'))['format'](_0x262f('0x2b'));};exports[_0x262f('0x2c')]=function(_0x4642cb,_0xba6eed){return moment(_0x4642cb)[_0x262f('0x2d')](_0xba6eed,_0x262f('0x2a'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x163dc9,_0x900602){return moment(_0x163dc9)['diff'](moment(_0x900602),_0x262f('0x2a'));};exports[_0x262f('0x2e')]=function(_0x10a756,_0x55deea){return parseInt(_0x10a756,0xa)+parseInt(_0x55deea,0xa);};exports[_0x262f('0x2f')]=function(){return moment()[_0x262f('0x30')](_0x262f('0x2b'));};exports[_0x262f('0x31')]=function(_0x25ca41,_0x5ab5a7){if(_0x5ab5a7){return moment(_0x25ca41)['isAfter'](_0x5ab5a7);}return!![];};exports[_0x262f('0x32')]=function(_0x107922,_0x212137){if(_0x212137){return moment(_0x107922)[_0x262f('0x32')](_0x212137);}else if(_0x107922){return!![];}return![];}; \ No newline at end of file +var _0x1fe7=['xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','addTime','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger'];(function(_0x388d01,_0x36ed5f){var _0x3442b4=function(_0x310147){while(--_0x310147){_0x388d01['push'](_0x388d01['shift']());}};_0x3442b4(++_0x36ed5f);}(_0x1fe7,0xe4));var _0x71fe=function(_0x56ee81,_0xca744f){_0x56ee81=_0x56ee81-0x0;var _0x4f0b02=_0x1fe7[_0x56ee81];return _0x4f0b02;};'use strict';var BPromise=require(_0x71fe('0x0'));var jayson=require(_0x71fe('0x1'));var moment=require(_0x71fe('0x2'));var util=require(_0x71fe('0x3'));var client=jayson[_0x71fe('0x4')][_0x71fe('0x5')]({'port':0x2329});var logger=require(_0x71fe('0x6'))(_0x71fe('0x7'));exports[_0x71fe('0x8')]=function(_0x40bd2f,_0x41396c){logger[_0x71fe('0x8')](_0x40bd2f,_0x41396c?util[_0x71fe('0x9')](_0x41396c,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x504d06,_0x57011e){logger[_0x71fe('0xa')](_0x504d06,_0x57011e?util[_0x71fe('0x9')](_0x57011e,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x1e022c,_0x42cf7b){logger[_0x71fe('0xb')](_0x1e022c,_0x42cf7b?util[_0x71fe('0x9')](_0x42cf7b,{'showHidden':![],'depth':null}):'');};exports[_0x71fe('0xc')]=function(_0x56b775,_0x419c3b){return client[_0x71fe('0xc')](_0x56b775,{'body':_0x419c3b})[_0x71fe('0xd')](function(_0x19f4fd){logger[_0x71fe('0xa')](_0x71fe('0xe'),_0x56b775,_0x19f4fd?util[_0x71fe('0x9')](_0x19f4fd,{'showHidden':![],'depth':null}):'');})[_0x71fe('0xf')](function(_0x3d3bda){logger['error'](_0x71fe('0xe'),_0x56b775,_0x3d3bda?util['inspect'](_0x3d3bda,{'showHidden':![],'depth':null}):'');});};function getUser(_0x551b78){return client['request'](_0x71fe('0x10'),{'options':{'raw':!![],'attributes':['id',_0x71fe('0x11'),_0x71fe('0x12'),_0x71fe('0x13')],'where':_0x551b78,'limit':0x1}})[_0x71fe('0xd')](function(_0x12573b){logger[_0x71fe('0xa')](_0x71fe('0x14'),JSON[_0x71fe('0x15')](_0x551b78),_0x12573b?util[_0x71fe('0x9')](_0x12573b,{'showHidden':![],'depth':null}):'');return _0x12573b[_0x71fe('0x16')][_0x71fe('0x17')]?_0x12573b[_0x71fe('0x16')][0x0]:null;});}exports[_0x71fe('0x18')]=function(_0x3ad76a){return new BPromise(function(_0x513ce3,_0x574987){if(_0x3ad76a){return getUser({'internal':_0x3ad76a})['then'](function(_0x2db114){logger['info'](_0x71fe('0x19'),_0x3ad76a,_0x2db114?_0x71fe('0x1a'):_0x71fe('0x1b'));return _0x513ce3(_0x2db114);})[_0x71fe('0xf')](function(_0xbd293c){logger[_0x71fe('0xb')](_0x71fe('0x1c'),_0xbd293c?util['inspect'](_0xbd293c,{'showHidden':![],'depth':null}):'');return _0x513ce3(null);});}return _0x513ce3(null);});};exports['getUserByInterface']=function(_0x339428){return new BPromise(function(_0x3a3c7d,_0x4644d9){if(_0x339428){return getUser({'interface':_0x339428})['then'](function(_0x4f458){logger[_0x71fe('0x8')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x339428,_0x4f458?_0x71fe('0x1a'):_0x71fe('0x1b'));return _0x3a3c7d(_0x4f458);})[_0x71fe('0xf')](function(_0x3f3eab){logger[_0x71fe('0xb')]('[utils][getUserByInterface]',_0x3f3eab?util[_0x71fe('0x9')](_0x3f3eab,{'showHidden':![],'depth':null}):'');return _0x3a3c7d(null);});}return _0x3a3c7d(null);});};exports[_0x71fe('0x1d')]=function(_0x311b16){return new BPromise(function(_0x2d7fc3,_0xdf99f){if(_0x311b16){return getUser({'name':_0x311b16})[_0x71fe('0xd')](function(_0x583850){logger[_0x71fe('0x8')](_0x71fe('0x1e'),_0x311b16,_0x583850?_0x71fe('0x1a'):'notfound');return _0x2d7fc3(_0x583850);})[_0x71fe('0xf')](function(_0x1d631d){logger[_0x71fe('0xb')]('[utils][getUserByName]',_0x1d631d?util[_0x71fe('0x9')](_0x1d631d,{'showHidden':![],'depth':null}):'');return _0x2d7fc3(null);});}return _0x2d7fc3(null);});};exports[_0x71fe('0x1f')]=function(_0x3ce060){return new BPromise(function(_0x504d6f,_0x134245){if(_0x3ce060){return client[_0x71fe('0xc')](_0x71fe('0x20'),{'options':{'raw':!![],'attributes':['id',_0x71fe('0x12'),_0x71fe('0x21'),_0x71fe('0x22'),_0x71fe('0x23')],'where':{'name':_0x3ce060},'limit':0x1}})[_0x71fe('0xd')](function(_0x1a6c08){logger[_0x71fe('0xa')]('[utils][getVoiceQueueByName]\x20name:%s',_0x3ce060,_0x1a6c08?util[_0x71fe('0x9')](_0x1a6c08,{'showHidden':![],'depth':null}):'');logger[_0x71fe('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x3ce060,_0x1a6c08?_0x71fe('0x1a'):_0x71fe('0x1b'));return _0x504d6f(_0x1a6c08[_0x71fe('0x16')][_0x71fe('0x17')]?_0x1a6c08[_0x71fe('0x16')][0x0]:null);})[_0x71fe('0xf')](function(_0x16dc73){logger[_0x71fe('0xb')]('[utils][getVoiceQueueByName]',_0x16dc73?util[_0x71fe('0x9')](_0x16dc73,{'showHidden':![],'depth':null}):'');return _0x504d6f(null);});}return _0x504d6f(null);});};exports[_0x71fe('0x24')]=function(_0x2f1b4c,_0x3a9a5b){return moment(_0x2f1b4c)['add'](_0x3a9a5b,_0x71fe('0x25'))[_0x71fe('0x26')](_0x71fe('0x27'));};exports['subtractTime']=function(_0x2e1653,_0x3ecad5){return moment(_0x2e1653)[_0x71fe('0x28')](_0x3ecad5,_0x71fe('0x25'))[_0x71fe('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x71fe('0x29')]=function(_0x2b5aa3,_0x382745){return moment(_0x2b5aa3)[_0x71fe('0x2a')](moment(_0x382745),_0x71fe('0x25'));};exports[_0x71fe('0x2b')]=function(_0x2b7103,_0x21dd9e){return parseInt(_0x2b7103,0xa)+parseInt(_0x21dd9e,0xa);};exports[_0x71fe('0x2c')]=function(){return moment()['format'](_0x71fe('0x27'));};exports[_0x71fe('0x2d')]=function(_0x52a70a,_0x1f0495){if(_0x1f0495){return moment(_0x52a70a)[_0x71fe('0x2d')](_0x1f0495);}return!![];};exports[_0x71fe('0x2e')]=function(_0x30bd27,_0x3a8dd8){if(_0x3a8dd8){return moment(_0x30bd27)[_0x71fe('0x2e')](_0x3a8dd8);}else if(_0x30bd27){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 5ab1c15..a452aaf 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 _0xc88e=['./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','timestamp','error','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','statusCode','responseTime','%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','connection','url','other','setupLoggers','fs-extra'];(function(_0x1d4cac,_0x153b2a){var _0x5beee1=function(_0x5c0765){while(--_0x5c0765){_0x1d4cac['push'](_0x1d4cac['shift']());}};_0x5beee1(++_0x153b2a);}(_0xc88e,0x12c));var _0xec88=function(_0x130719,_0x2a7018){_0x130719=_0x130719-0x0;var _0x159865=_0xc88e[_0x130719];return _0x159865;};var fs=require(_0xec88('0x0'));var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0xec88('0x1'))[_0xec88('0x2')];var safeTemplate=require(_0xec88('0x3'))[_0xec88('0x4')];var maskSensitiveData=require('./mask-sensitive-data')[_0xec88('0x5')];function ClientSideLogger(){function _0x33c720(_0x2719d8){var _0x19beae=path[_0xec88('0x6')](_0xec88('0x7'),_0xec88('0x8'),_0xec88('0x9'));var _0xf0d0b8=path['join'](_0xec88('0xa'),_0x2719d8[_0xec88('0xb')]+'-'+_0x2719d8[_0xec88('0xc')]);return fs[_0xec88('0xd')](path[_0xec88('0x6')](_0x19beae,_0xf0d0b8))[_0xec88('0xe')](function(){var _0x5d67a4=fileLogger(_0xec88('0xa'),path[_0xec88('0x6')](_0x19beae,_0xf0d0b8));return _0x5d67a4;})[_0xec88('0xf')](function(_0x364a61){throw _0x364a61;});}this[_0xec88('0x8')]=function(_0x39de46,_0xa01109,_0x24cb77,_0x5d3e1c){return _0x33c720(_0x39de46[_0xec88('0x10')])[_0xec88('0xe')](function(_0x1e1665){var _0x33c910=_0x1e1665[_0xa01109];return _0x33c910;})[_0xec88('0xe')](function(_0x2e58d7){var _0xf353e8=_0x39de46[_0xec88('0x10')]?_0x39de46[_0xec88('0x10')]['id']:'no-user';var _0x4583cb=_0x5d3e1c['data'];var _0x2aefa5=_0x5d3e1c[_0xec88('0x11')];var _0x31c2ab=new Date(Number(_0x2aefa5));return _0x2e58d7(_0xf353e8,_0x31c2ab,_0x24cb77,_0x4583cb);})[_0xec88('0xf')](function(_0x4661d6){fileLogger(_0xec88('0xa'))[_0xec88('0x12')](_0x4661d6);});};}function setupLoggers(_0x4bba71){return new Promise(function(_0x3b01db){var _0x315524=new ClientSideLogger();var _0x19f488=fileLogger(_0xec88('0x13'));var _0x1c64e3=fileLogger(_0xec88('0x14'));_0x4bba71['set'](_0xec88('0x15'),_0x315524);_0x4bba71[_0xec88('0x16')](ewinston[_0xec88('0x17')]({'winstonInstance':_0x19f488,'meta':![],'statusLevels':!![],'msg':function(_0x1644bc,_0x318f9d){var _0x29c5c8=_0xec88('0x18');if(!_[_0xec88('0x19')](_0x1644bc[_0xec88('0x1a')])){_0x29c5c8+=_0xec88('0x1b');var _0x3726d8=_0x1644bc[_0xec88('0x1a')];maskSensitiveData(_0x3726d8);}return safeTemplate(util[_0xec88('0x1c')](_0x29c5c8,_0x1644bc['method'],_0x1644bc[_0xec88('0x1d')][_0xec88('0x1e')]?_0x1644bc[_0xec88('0x1d')]['x-forwarded-for']:_0x1644bc['connection'][_0xec88('0x1f')]||_0x1644bc['ip'],_0x1644bc['url'],_0x318f9d[_0xec88('0x20')],_0x318f9d[_0xec88('0x21')],_0x1644bc[_0xec88('0x10')]?_0x1644bc[_0xec88('0x10')]['id']:null,_0x1644bc[_0xec88('0x10')]?_0x1644bc[_0xec88('0x10')]['name']:null,_0x1644bc[_0xec88('0x10')]?_0x1644bc[_0xec88('0x10')][_0xec88('0xb')]:null,_0x3726d8?util['inspect'](_0x3726d8,![],null):''));}}));_0x4bba71[_0xec88('0x16')](ewinston[_0xec88('0x17')]({'winstonInstance':_0x1c64e3,'meta':![],'statusLevels':!![],'msg':function(_0x503ad4,_0x20e24d){var _0x5d47a6=_0xec88('0x22');if(_0x503ad4[_0xec88('0x1a')]&&_0x503ad4[_0xec88('0x1a')][_0xec88('0x23')]&&_0x503ad4[_0xec88('0x1a')][_0xec88('0x24')]){_0x5d47a6=_0xec88('0x25');}return util['format'](_0x5d47a6,_0x503ad4[_0xec88('0x26')],_0x503ad4['headers'][_0xec88('0x1e')]?_0x503ad4[_0xec88('0x1d')][_0xec88('0x1e')]:_0x503ad4[_0xec88('0x27')][_0xec88('0x1f')]||_0x503ad4['ip'],_0x503ad4[_0xec88('0x28')],_0x20e24d[_0xec88('0x20')],_0x20e24d[_0xec88('0x21')],_0x503ad4[_0xec88('0x10')]?_0x503ad4['user']['id']:null,_0x503ad4[_0xec88('0x10')]?_0x503ad4[_0xec88('0x10')][_0xec88('0xc')]:null,_0x503ad4[_0xec88('0x10')]?_0x503ad4[_0xec88('0x10')][_0xec88('0xb')]:null,_0x503ad4[_0xec88('0x1a')]&&_0x503ad4[_0xec88('0x1a')]['device']?_0x503ad4['body'][_0xec88('0x23')]:_0xec88('0x29'),_0x503ad4[_0xec88('0x1a')]&&_0x503ad4[_0xec88('0x1a')][_0xec88('0x24')]?_0x503ad4[_0xec88('0x1a')][_0xec88('0x24')]:'',_0x503ad4[_0xec88('0x1a')]&&_0x503ad4['body']['agent_name']?_0x503ad4[_0xec88('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x49b1a1){var _0x2afb2a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2afb2a['test'](_0x49b1a1[_0xec88('0x28')]);}}));return _0x3b01db();});}exports[_0xec88('0x2a')]=setupLoggers; \ No newline at end of file +var _0x3239=['api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','x-forwarded-for','connection','remoteAddress','url','statusCode','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','format','headers','responseTime','name','device','other','agent_name','test','setupLoggers','fs-extra','express-winston','path','util','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','/var','log','xcally','join','role','ensureDir','then','client','catch','user','no-user','data','timestamp'];(function(_0x43dffc,_0x2fa480){var _0xe20b22=function(_0x486380){while(--_0x486380){_0x43dffc['push'](_0x43dffc['shift']());}};_0xe20b22(++_0x2fa480);}(_0x3239,0x105));var _0x9323=function(_0x22db09,_0x2f1990){_0x22db09=_0x22db09-0x0;var _0x245e38=_0x3239[_0x22db09];return _0x245e38;};var fs=require(_0x9323('0x0'));var _=require('lodash');var ewinston=require(_0x9323('0x1'));var path=require(_0x9323('0x2'));var util=require(_0x9323('0x3'));var fileLogger=require('./loggers')[_0x9323('0x4')];var safeTemplate=require(_0x9323('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x9323('0x6'))[_0x9323('0x7')];function ClientSideLogger(){function _0x19542c(_0x251c67){var _0x14ad86=path['join'](_0x9323('0x8'),_0x9323('0x9'),_0x9323('0xa'));var _0x205eed=path[_0x9323('0xb')]('client',_0x251c67[_0x9323('0xc')]+'-'+_0x251c67['name']);return fs[_0x9323('0xd')](path[_0x9323('0xb')](_0x14ad86,_0x205eed))[_0x9323('0xe')](function(){var _0x58fd29=fileLogger(_0x9323('0xf'),path[_0x9323('0xb')](_0x14ad86,_0x205eed));return _0x58fd29;})[_0x9323('0x10')](function(_0x1d4570){throw _0x1d4570;});}this[_0x9323('0x9')]=function(_0x2f2388,_0x4cc03e,_0x2388f7,_0x30a2a1){return _0x19542c(_0x2f2388[_0x9323('0x11')])['then'](function(_0x124522){var _0x48be02=_0x124522[_0x4cc03e];return _0x48be02;})['then'](function(_0xc849d1){var _0x5694a4=_0x2f2388[_0x9323('0x11')]?_0x2f2388[_0x9323('0x11')]['id']:_0x9323('0x12');var _0x49dec2=_0x30a2a1[_0x9323('0x13')];var _0x35a4ef=_0x30a2a1[_0x9323('0x14')];var _0x5c2d68=new Date(Number(_0x35a4ef));return _0xc849d1(_0x5694a4,_0x5c2d68,_0x2388f7,_0x49dec2);})['catch'](function(_0x5eb903){fileLogger(_0x9323('0xf'))['error'](_0x5eb903);});};}function setupLoggers(_0x5dada8){return new Promise(function(_0xe2a4f3){var _0x407a5f=new ClientSideLogger();var _0x50e04a=fileLogger(_0x9323('0x15'));var _0x3e8739=fileLogger(_0x9323('0x16'));_0x5dada8[_0x9323('0x17')]('client-side-logger',_0x407a5f);_0x5dada8[_0x9323('0x18')](ewinston['logger']({'winstonInstance':_0x50e04a,'meta':![],'statusLevels':!![],'msg':function(_0xd8d991,_0x462389){var _0x4d1847=_0x9323('0x19');if(!_[_0x9323('0x1a')](_0xd8d991[_0x9323('0x1b')])){_0x4d1847+=_0x9323('0x1c');var _0x478a74=_0xd8d991[_0x9323('0x1b')];maskSensitiveData(_0x478a74);}return safeTemplate(util['format'](_0x4d1847,_0xd8d991['method'],_0xd8d991['headers'][_0x9323('0x1d')]?_0xd8d991['headers'][_0x9323('0x1d')]:_0xd8d991[_0x9323('0x1e')][_0x9323('0x1f')]||_0xd8d991['ip'],_0xd8d991[_0x9323('0x20')],_0x462389[_0x9323('0x21')],_0x462389['responseTime'],_0xd8d991[_0x9323('0x11')]?_0xd8d991[_0x9323('0x11')]['id']:null,_0xd8d991[_0x9323('0x11')]?_0xd8d991['user']['name']:null,_0xd8d991['user']?_0xd8d991[_0x9323('0x11')]['role']:null,_0x478a74?util[_0x9323('0x22')](_0x478a74,![],null):''));}}));_0x5dada8[_0x9323('0x18')](ewinston[_0x9323('0x23')]({'winstonInstance':_0x3e8739,'meta':![],'statusLevels':!![],'msg':function(_0x2aba43,_0x511398){var _0x502fc0=_0x9323('0x24');if(_0x2aba43[_0x9323('0x1b')]&&_0x2aba43[_0x9323('0x1b')]['device']&&_0x2aba43[_0x9323('0x1b')][_0x9323('0x25')]){_0x502fc0='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x9323('0x26')](_0x502fc0,_0x2aba43['method'],_0x2aba43[_0x9323('0x27')][_0x9323('0x1d')]?_0x2aba43['headers'][_0x9323('0x1d')]:_0x2aba43[_0x9323('0x1e')][_0x9323('0x1f')]||_0x2aba43['ip'],_0x2aba43['url'],_0x511398[_0x9323('0x21')],_0x511398[_0x9323('0x28')],_0x2aba43['user']?_0x2aba43['user']['id']:null,_0x2aba43[_0x9323('0x11')]?_0x2aba43[_0x9323('0x11')][_0x9323('0x29')]:null,_0x2aba43['user']?_0x2aba43[_0x9323('0x11')]['role']:null,_0x2aba43[_0x9323('0x1b')]&&_0x2aba43['body'][_0x9323('0x2a')]?_0x2aba43['body'][_0x9323('0x2a')]:_0x9323('0x2b'),_0x2aba43[_0x9323('0x1b')]&&_0x2aba43[_0x9323('0x1b')][_0x9323('0x25')]?_0x2aba43[_0x9323('0x1b')][_0x9323('0x25')]:'',_0x2aba43['body']&&_0x2aba43[_0x9323('0x1b')]['agent_name']?_0x2aba43['body'][_0x9323('0x2c')]:'');},'ignoreRoute':function(_0x31216b){var _0x33e38e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x33e38e[_0x9323('0x2d')](_0x31216b[_0x9323('0x20')]);}}));return _0xe2a4f3();});}exports[_0x9323('0x2e')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 4f215e2..b2b1dda 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe75a=['fileLogger','path','util','moment','winston','../config/environment','info','redBG\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','warn','File','%s-%s','error','Console','consoleLogger'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xe75a,0xcd));var _0xae75=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xe75a[_0x609988];return _0x159984;};'use strict';var path=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var moment=require(_0xae75('0x2'));var winston=require(_0xae75('0x3'));var config=require(_0xae75('0x4'));var debugLevel=config['debugLevel']?config['debugLevel']['toLowerCase']():_0xae75('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xae75('0x6'),'error':'red','warn':'bold\x20yellow','info':'white','print':'bold\x20white','success':_0xae75('0x7'),'http':_0xae75('0x8'),'verbose':'bold\x20magenta','debug':_0xae75('0x9'),'silly':_0xae75('0xa')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x558477,_0x3bdf5e,_0x48eee7){var _0x4fb398=_0x558477||_0xae75('0xb');return path['join'](_0x4fb398,util[_0xae75('0xc')](_0xae75('0xd'),_0x3bdf5e,_0x48eee7));}function formatter(_0x4c35f6,_0x5f3803){_0x5f3803[_0xae75('0xe')]=_0x5f3803['message'][_0xae75('0xf')](/@@{/g,_0xae75('0x10'))[_0xae75('0xf')](/}@@/g,_0xae75('0x11'))[_0xae75('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xae75('0xc')](_0xae75('0x12'),moment()[_0xae75('0xc')](_0xae75('0x13')),_0x5f3803['level']['toUpperCase'](),_0x4c35f6,_0x5f3803[_0xae75('0xe')]);}function fileFormat(_0x55fab0,_0x4e6715){_0x4e6715[_0xae75('0xe')]=_0x4e6715[_0xae75('0xe')][_0xae75('0xf')](/@@{/g,_0xae75('0x10'))['replace'](/}@@/g,_0xae75('0x11'))[_0xae75('0xf')](/@{/g,'{{')[_0xae75('0xf')](/}@/g,'}}');var _0x29650d=_0x4e6715[_0xae75('0x14')]&&Object[_0xae75('0x15')](_0x4e6715[_0xae75('0x14')])['length']?'\x0a\x09'+JSON[_0xae75('0x16')](_0x4e6715['meta']):'';return util[_0xae75('0xc')](_0xae75('0x17'),moment()[_0xae75('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4e6715[_0xae75('0x18')]['toUpperCase'](),_0x55fab0,_0x4e6715['message'],_0x29650d);}function consoleLogger(){var _0x3f45ed=new winston[(_0xae75('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xae75('0x1a'))]['Console']({'level':_0xae75('0x1b'),'json':![],'formatter':function(_0x52d0c5){return formatter('',_0x52d0c5);}})]});return _0x3f45ed;}function fileLogger(_0x3783ee,_0x515282){var _0x4f1eed=new winston[(_0xae75('0x19'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xae75('0x1a'))][(_0xae75('0x1c'))]({'name':util[_0xae75('0xc')](_0xae75('0x1d'),_0x3783ee,'error'),'filename':getLogFileName(_0x515282,_0x3783ee,'error'),'level':_0xae75('0x1e'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e2ab8){return fileFormat(_0x3783ee,_0x1e2ab8);}}),new winston[(_0xae75('0x1a'))]['File']({'name':util[_0xae75('0xc')](_0xae75('0x1d'),_0x3783ee,debugLevel),'filename':getLogFileName(_0x515282,_0x3783ee,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x580ee3){return fileFormat(_0x3783ee,_0x580ee3);}}),new winston[(_0xae75('0x1a'))][(_0xae75('0x1f'))]({'level':_0xae75('0x1b'),'json':![],'formatter':function(_0x24adcd){return fileFormat(_0x3783ee,_0x24adcd);}})]});return _0x4f1eed;}exports[_0xae75('0x20')]=consoleLogger;exports[_0xae75('0x21')]=fileLogger; \ No newline at end of file +var _0x7caf=['%s-%s','warn','consoleLogger','fileLogger','path','util','winston','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','%s-%s.log','message','replace','{{{','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','length','stringify','Logger','transports','Console','File','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7caf,0x11c));var _0xf7ca=function(_0x177a2e,_0x411570){_0x177a2e=_0x177a2e-0x0;var _0x13ba4c=_0x7caf[_0x177a2e];return _0x13ba4c;};'use strict';var path=require(_0xf7ca('0x0'));var util=require(_0xf7ca('0x1'));var moment=require('moment');var winston=require(_0xf7ca('0x2'));var config=require('../config/environment');var debugLevel=config[_0xf7ca('0x3')]?config[_0xf7ca('0x3')][_0xf7ca('0x4')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0xf7ca('0x5'),'warn':_0xf7ca('0x6'),'info':_0xf7ca('0x7'),'print':'bold\x20white','success':_0xf7ca('0x8'),'http':_0xf7ca('0x9'),'verbose':_0xf7ca('0xa'),'debug':_0xf7ca('0xb'),'silly':'bold\x20cyan'};winston[_0xf7ca('0xc')](XC_LOG_COLORS);function getLogFileName(_0x368a47,_0x155070,_0x22e203){var _0x206aa0=_0x368a47||'/var/log/xcally';return path['join'](_0x206aa0,util['format'](_0xf7ca('0xd'),_0x155070,_0x22e203));}function formatter(_0x1c64fb,_0x522cd6){_0x522cd6[_0xf7ca('0xe')]=_0x522cd6[_0xf7ca('0xe')][_0xf7ca('0xf')](/@@{/g,_0xf7ca('0x10'))[_0xf7ca('0xf')](/}@@/g,'}}}')[_0xf7ca('0xf')](/@{/g,'{{')[_0xf7ca('0xf')](/}@/g,'}}');return util[_0xf7ca('0x11')](_0xf7ca('0x12'),moment()['format'](_0xf7ca('0x13')),_0x522cd6[_0xf7ca('0x14')][_0xf7ca('0x15')](),_0x1c64fb,_0x522cd6[_0xf7ca('0xe')]);}function fileFormat(_0x5826e9,_0x4b6079){_0x4b6079[_0xf7ca('0xe')]=_0x4b6079[_0xf7ca('0xe')][_0xf7ca('0xf')](/@@{/g,_0xf7ca('0x10'))[_0xf7ca('0xf')](/}@@/g,_0xf7ca('0x16'))[_0xf7ca('0xf')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xf63da3=_0x4b6079[_0xf7ca('0x17')]&&Object['keys'](_0x4b6079[_0xf7ca('0x17')])[_0xf7ca('0x18')]?'\x0a\x09'+JSON[_0xf7ca('0x19')](_0x4b6079[_0xf7ca('0x17')]):'';return util[_0xf7ca('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xf7ca('0x11')](_0xf7ca('0x13')),_0x4b6079[_0xf7ca('0x14')]['toUpperCase'](),_0x5826e9,_0x4b6079[_0xf7ca('0xe')],_0xf63da3);}function consoleLogger(){var _0x25f556=new winston[(_0xf7ca('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf7ca('0x1b'))][(_0xf7ca('0x1c'))]({'level':'warn','json':![],'formatter':function(_0x529887){return formatter('',_0x529887);}})]});return _0x25f556;}function fileLogger(_0x14b07e,_0x40b206){var _0x221807=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xf7ca('0x1b'))][(_0xf7ca('0x1d'))]({'name':util['format']('%s-%s',_0x14b07e,_0xf7ca('0x1e')),'filename':getLogFileName(_0x40b206,_0x14b07e,_0xf7ca('0x1e')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x51430d){return fileFormat(_0x14b07e,_0x51430d);}}),new winston['transports'][(_0xf7ca('0x1d'))]({'name':util[_0xf7ca('0x11')](_0xf7ca('0x1f'),_0x14b07e,debugLevel),'filename':getLogFileName(_0x40b206,_0x14b07e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a211a){return fileFormat(_0x14b07e,_0x5a211a);}}),new winston[(_0xf7ca('0x1b'))][(_0xf7ca('0x1c'))]({'level':_0xf7ca('0x20'),'json':![],'formatter':function(_0x1ff966){return fileFormat(_0x14b07e,_0x1ff966);}})]});return _0x221807;}exports[_0xf7ca('0x21')]=consoleLogger;exports[_0xf7ca('0x22')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index e0c5b40..bb7f038 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 _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0xd2d555,_0x77fbe0){var _0x21bf39=function(_0x36116d){while(--_0x36116d){_0xd2d555['push'](_0xd2d555['shift']());}};_0x21bf39(++_0x77fbe0);}(_0xda2d,0x102));var _0xdda2=function(_0x1944ce,_0x1c6cb7){_0x1944ce=_0x1944ce-0x0;var _0x298d34=_0xda2d[_0x1944ce];return _0x298d34;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x27f822,_0x397b44){var _0x24fd0f=function(_0x577dfc){while(--_0x577dfc){_0x27f822['push'](_0x27f822['shift']());}};_0x24fd0f(++_0x397b44);}(_0xadb5,0xad));var _0x5adb=function(_0x12324e,_0x4d570b){_0x12324e=_0x12324e-0x0;var _0xf64543=_0xadb5[_0x12324e];return _0xf64543;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index bee2521..ec8bf97 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x28e007,_0x342906){var _0x31c148=function(_0x46803a){while(--_0x46803a){_0x28e007['push'](_0x28e007['shift']());}};_0x31c148(++_0x342906);}(_0x4024,0x89));var _0x4402=function(_0xc4d7e0,_0x40b754){_0xc4d7e0=_0xc4d7e0-0x0;var _0x52d121=_0x4024[_0xc4d7e0];return _0x52d121;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xed3c=['{\x20{\x20','\x20}\x20}','string','replace','isPlainObject','keys','reduce','safeTemplate','lodash'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xed3c,0x1a6));var _0xced3=function(_0x1ae125,_0x20820a){_0x1ae125=_0x1ae125-0x0;var _0x1f3b2b=_0xed3c[_0x1ae125];return _0x1f3b2b;};var _=require(_0xced3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x408853){return _0x408853==='{{'?_0xced3('0x1'):_0xced3('0x2');}function safeTemplate(_0x558ee8){var _0xfdc1ed=_0x558ee8;if(typeof _0x558ee8===_0xced3('0x3')){_0xfdc1ed=_0x558ee8[_0xced3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x558ee8)){_0xfdc1ed=_0x558ee8['map'](function(_0x3d3aa0){return safeTemplate(_0x3d3aa0);});}else if(_[_0xced3('0x5')](_0x558ee8)){_0xfdc1ed=Object[_0xced3('0x6')](_0x558ee8)[_0xced3('0x7')](function(_0x4795cd,_0x510164){_0x4795cd[_0x510164]=safeTemplate(_0x558ee8[_0x510164]);return _0x4795cd;},{});}return _0xfdc1ed;}module['exports'][_0xced3('0x8')]=safeTemplate; \ No newline at end of file